lucamug / style-framework / Framework.FormField

Demo

Fields

Input fields

inputText : List (Element.Attribute msg) -> { field : field, fieldValue : String, helperText : Maybe (Element msg), inputType : List (Element.Attribute msg) -> { label : Element.Input.Label msg, onChange : String -> msg, placeholder : Maybe (Element.Input.Placeholder msg), text : String } -> Element msg, inputTypeAttrs : List (Element.Attribute msg), label : Element msg, maybeFieldFocused : Maybe field, maybeMsgOnEnter : Maybe (field -> msg), msgOnChange : field -> String -> msg, msgOnFocus : field -> msg, msgOnLoseFocus : field -> msg } -> Element msg

inputPassword : List (Element.Attribute msg) -> { field : field, fieldValue : String, helperText : Maybe (Element msg), inputType : List (Element.Attribute msg) -> { label : Element.Input.Label msg, onChange : String -> msg, placeholder : Maybe (Element.Input.Placeholder msg), text : String, show : Basics.Bool } -> Element msg, inputTypeAttrs : List (Element.Attribute msg), label : Element msg, maybeFieldFocused : Maybe field, maybeMsgOnEnter : Maybe (field -> msg), msgOnChange : field -> String -> msg, msgOnFocus : field -> msg, msgOnLoseFocus : field -> msg, show : Basics.Bool, maybeShowHidePassword : Maybe { maybeHideIcon : Maybe (Element msg), maybeShowIcon : Maybe (Element msg), msgOnViewToggle : field -> msg } } -> Element msg

Introspection

Used internally to generate the Style Guide

introspection : { name : String, description : String, signature : String, variations : List ( String, List ( Element msg1, String ) ) }

example5 : Model -> ( Element Msg, String )

example6 : Model -> ( Element Msg, String )

example7 : Model -> ( Element Msg, String )

example8 : Model -> ( Element Msg, String )

example9 : Model -> ( Element Msg, String )


type Field
    = FieldEmail
    | FieldText
    | FieldUsername
    | FieldNewPassword
    | FieldCurrentPassword


type alias Model =
{ valueText : String
, valueEmail : String
, valueUsername : String
, valueNewPassword : String
, valueNewPasswordShow : Basics.Bool
, valueCurrentPassword : String
, valueCurrentPasswordShow : Basics.Bool
, focusedField : Maybe Field
, enteredField : Maybe Field 
}


type Msg
    = OnChange Field String
    | OnFocus Field
    | OnLoseFocus Field
    | OnEnter Field
    | OnViewToggle Field

initModel : Model

update : Msg -> Model -> ( Model, Platform.Cmd.Cmd Msg )