NoRedInk/noredink-ui/9.8.1

NOTE: the latest version is 35.9.3

Nri.Ui.Modal.V8

Changes from V7:

  • More customizable attributes
  • Rather than accepting any number of attributes, Modal provides one callback that returns a focusable
  • viewFooter has been merged into viewContent
  • viewContent and closeButton are now callbacks that are pre-configured with settings (previously you passed config through)

State and updates

type alias Model =
Model
init : Model
type alias Msg =
Msg
{ dismissOnEscAndOverlayClick : Bool }
-> Msg
-> Model
-> ( Model, Cmd Msg )
subscriptions : Model -> Sub Msg

Include the subscription if you want the modal to dismiss on Esc.

open : String -> Msg

Pass the id of the element that focus should return to when the modal closes.

close : Msg

Views

Modals

info : Config msg -> (ViewFuncs msg -> Focusable msg) -> Model -> Html msg
warning : Config msg -> (ViewFuncs msg -> Focusable msg) -> Model -> Html msg
type alias ViewFuncs msg =
{ viewContent :
{ content : List (Html msg)
, footer : List (Html msg)
}
-> Html msg
, closeButton : List (Attribute msg) -> Html msg
}

Focusable

type Focusable msg
( { firstFocusableElement : List (Attribute msg)
, lastFocusableElement : List (Attribute msg)
, autofocusElement : Attribute msg
}
-> Html msg
)
-> Focusable msg
onlyFocusableElementView : (List (Attribute msg) -> Html msg) -> Focusable msg