abradley2 / form-elements / FormElements.SuperSelect

A "select" control that uses auto-complete to assist users.

Definitions

view : Model -> Props a -> Html (Msg a)

The view for displaying the element.

init : String -> Model

Creates the initial model for the element. id should be a unique string identifier.

update : Msg a -> Model -> Props a -> SuperSelectResult a

The main function for updating the element in response to Msg

subscriptions : Props a -> Platform.Sub.Sub (Msg a)

subscriptions As this element requires listening to keyboard events, the subscriptions must be added to your main function so it may do so. For each instance of this element in your application, wire up the subscriptions along with the associated Props you would give to that instance's view function

defaultProps : Props a

Default properties for the element. The props actually passed in should generally have label set to a non-empty string


type Msg a
    = NoOp
    | Clear
    | TextInputMsg FormElements.TextInput.Msg
    | UnsetFocusedOption
    | SetFocusedOption Basics.Int
    | OptionSelected (Option a)
    | KeyPress (Props a) Basics.Int

Messages output from the view in the Elm runtime. Combine these with update


type alias Model =
{ id : String
, textInputData : FormElements.TextInput.Model
, focusedOption : Maybe Basics.Int
, hasFocus : Basics.Bool 
}

The model the element uses to render itself.


type alias Props a =
{ id : String
, options : List (Option a)
, errorText : Maybe String
, helperText : Maybe String
, label : String
, value : Maybe a
, inputValue : String 
}

Configurable properties for rendering the view


type alias Option a =
( String, a )

An "option" for the menu. Each option has a label, and an associated value of whatever type.


type alias SuperSelectResult a =
ComponentResult Model (Msg a) (ExternalMsg a) Basics.Never

Alias for the element's Component Result type.


type ExternalMsg a
    = ValueChanged String (Maybe a)

The external message type for the Component Result