MadonnaMat/elm-select-two/1.0.2

NOTE: this package is not compatible with Elm 0.19.1

SelectTwo

This library is the basic controls for your model's select2 object and some helper methods

#Basic Controls

update : SelectTwoMsg msg -> Model b msg -> ( Model b msg, Cmd msg )

used in your elm project's update as a way to control the select two boxes on screen it is used by

yourUpdate : Msg -> Model -> ( Model, Cmd Msg )
yourUpdate msg model =
    case msg of
        SelectTwo stmsg ->
            update stmsg model
new : List String -> SelectTwoDropdown msg -> Model b msg -> Model b msg

Create a new instance of the selectTwo record in your model

map : (SelectTwo msg -> SelectTwo msg) -> Model b msg -> Model b msg

modify selectTwo record in your model

setSearch : String -> Model b msg -> Model b msg

set the search parameter in your selectTwo record

Helper Methods

basicSelectOptions : (a -> msg) -> List ( a, String ) -> List (GroupSelectTwoOption msg)

turn a list of Tuples into a list of GroupSelectTwoOptions with one group. The first parameter is their shared trigger message, the second parameter is the list of tuples which are formatted as (Key, "Display"), and the return can be used in the list option of the config

[ ( Just "a", "a" )
, ( Just "b", "b" )
, ( Just "c", "c" )
]
    |> SelectTwo.basicSelectOptions Test
(a -> msg)
-> List ( a, String, String )
-> List (GroupSelectTwoOption msg)

turn a list of Tuples3 into a list of GroupSelectTwoOptions with actual grouping. The first parameter is their shared trigger message, the second parameter is the list of tuples which are formatted as (Key, "Display", "Group Name"), and the return can be used in the list option of the config

[ ( Just "a", "a", "Group 1")
, ( Just "b", "b", "Group 1")
, ( Just "c", "c", "Group 2")
]
    |> SelectTwo.basicSelectOptions Test