Skip to content

Commit

Permalink
Merge pull request isosphere#18 from dricair/main
Browse files Browse the repository at this point in the history
Fix for Issue isosphere#12
  • Loading branch information
isosphere authored Apr 12, 2023
2 parents c70442b + 72ce4f5 commit b576d56
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 30 deletions.
4 changes: 2 additions & 2 deletions packages/yew-bootstrap/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "yew-bootstrap"
version = "0.5.13"
version = "0.5.14"
authors = ["Matthew Scheffel <[email protected]>", "Foorack <[email protected]>"]
edition = "2021"
license = "MIT"
Expand All @@ -22,4 +22,4 @@ log = "0.4"

[dev-dependencies]
wasm-bindgen = "0.2.*"
web-sys = { version = "0.3.*", features = ["HtmlTextAreaElement", "HtmlSelectElement"] }
web-sys = { version = "0.3.*", features = ["HtmlTextAreaElement", "HtmlSelectElement"] }
46 changes: 23 additions & 23 deletions packages/yew-bootstrap/src/component/form/form_control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ where T: std::fmt::Display {
/// use yew_bootstrap::component::form::*;
/// fn test() -> Html {
/// html! {
/// <FormControl
/// id="input-text"
/// <FormControl
/// id="input-text"
/// ctype={FormControlType::Text}
/// class="mb-3"
/// label="Text"
Expand All @@ -134,22 +134,22 @@ where T: std::fmt::Display {
/// }
/// ```
///
/// Some input types need parameters for the `ctype` enum. Optional parameters use `Option` enums.
/// Some input types need parameters for the `ctype` enum. Optional parameters use `Option` enums.
/// ```rust
/// use yew::prelude::*;
/// use yew_bootstrap::component::form::*;
/// fn test() -> Html {
/// html! {
/// <FormControl
/// <FormControl
/// id="input-number"
/// ctype={
/// FormControlType::Number {
/// min: Some(10),
/// ctype={
/// FormControlType::Number {
/// min: Some(10),
/// max: Some(20)
/// }
/// }
/// }
/// class="mb-3"
/// label="Number in range 10-20"
/// class="mb-3"
/// label="Number in range 10-20"
/// value="12"
/// />
/// }
Expand All @@ -164,17 +164,17 @@ where T: std::fmt::Display {
/// use yew_bootstrap::component::form::*;
/// fn test() -> Html {
/// html! {
/// <FormControl
/// <FormControl
/// id="input-datetime2"
/// ctype={
/// ctype={
/// FormControlType::DatetimeMinMax {
/// min: Some(AttrValue::from("2023-01-01T12:00")),
/// max: Some(AttrValue::from("2023-01-01T18:00"))
/// }
/// max: Some(AttrValue::from("2023-01-01T18:00"))
/// }
/// }
/// class="mb-3"
/// class="mb-3"
/// label="Date and time (1st Jan 2023, 12:00 to 18:00)"
/// value="2023-01-01T15:00"
/// value="2023-01-01T15:00"
/// />
/// }
/// }
Expand All @@ -187,13 +187,13 @@ where T: std::fmt::Display {
/// use yew_bootstrap::component::form::*;
/// fn test() -> Html {
/// html! {
/// <FormControl
/// id="input-select-feedback"
/// ctype={ FormControlType::Select}
/// <FormControl
/// id="input-select-feedback"
/// ctype={ FormControlType::Select}
/// class="mb-3"
/// label={ "Form control invalid" }
/// validation={
/// FormControlValidation::Invalid(AttrValue::from("Select an option"))
/// validation={
/// FormControlValidation::Invalid(AttrValue::from("Select an option"))
/// }
/// >
/// <SelectOption key=0 label="Select an option" selected=true />
Expand Down Expand Up @@ -354,11 +354,11 @@ pub fn FormControl(props: &FormControlProps) -> Html {
<div class={ classes }>
{ label_before }
<select
class={ input_classes }
class={ input_classes }
id={ props.id.clone()}
name={ props.name.clone() }
disabled={ props.disabled }
onchange={ props.onchange.clone() }
onchange={ props.onchange.clone() }
onclick={ props.onclick.clone() }
required={ props.required }
>
Expand Down
6 changes: 1 addition & 5 deletions packages/yew-bootstrap/src/component/form/form_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,7 @@ pub enum FormControlType {
/// File input. Accept is a vector of formats, like "image/png", ".docx"
File { accept: Vec<AttrValue> },
/// Hidden input, used to transmit data
Hidden,

/// Submit button
Submit,
Hidden
}

impl FormControlType {
Expand All @@ -68,7 +65,6 @@ impl FormControlType {
Self::Radio => "radio",
Self::Range { .. } => "range",
Self::Select => "select",
Self::Submit => "submit",
Self::Text => "text",
Self::TextArea { .. } => "",
Self::Time | Self::TimeMinMax { .. } => "time",
Expand Down

0 comments on commit b576d56

Please sign in to comment.