Begin replacing focusables type

This commit is contained in:
Tessa Kelly 2020-07-02 12:54:08 -07:00
parent 434ec45805
commit f5c7ee38a1

View File

@ -276,8 +276,8 @@ custom styles =
{-| -} {-| -}
type Focusable msg type alias Focusable msg =
= Focusable (Attribute msg) (List (Attribute msg)) Attribute msg
{-| -} {-| -}
@ -290,43 +290,6 @@ multipleFocusableElementView :
) )
-> Focusable msg -> Focusable msg
multipleFocusableElementView f = multipleFocusableElementView f =
Focusable (multipleFocusableElementView_ (\attributes -> f attributes)) []
{-| -}
onlyFocusableElementView :
({ onlyFocusableElement : List (Html.Attribute msg)
}
-> Html msg
)
-> Focusable msg
onlyFocusableElementView f =
Focusable
(Attribute
(\config ->
{ config
| content =
\{ onlyFocusableElement } ->
f
{ onlyFocusableElement = onlyFocusableElement
}
}
)
)
[ Attribute (\config -> { config | autofocusOn = Last })
]
{-| -}
multipleFocusableElementView_ :
({ firstFocusableElement : List (Html.Attribute msg)
, lastFocusableElement : List (Html.Attribute msg)
, autofocusElement : Html.Attribute msg
}
-> Html msg
)
-> Attribute msg
multipleFocusableElementView_ f =
Attribute Attribute
(\config -> (\config ->
{ config { config
@ -341,6 +304,27 @@ multipleFocusableElementView_ f =
) )
{-| -}
onlyFocusableElementView :
({ onlyFocusableElement : List (Html.Attribute msg)
}
-> Html msg
)
-> Focusable msg
onlyFocusableElementView f =
Attribute
(\config ->
{ config
| content =
\{ onlyFocusableElement } ->
f
{ onlyFocusableElement = onlyFocusableElement
}
, autofocusOn = Last
}
)
-- VIEW -- VIEW
@ -368,9 +352,7 @@ view theme config getFocusable model =
} }
focusables = focusables =
case getFocusable viewFuncs of getFocusable viewFuncs
Focusable fst rst ->
fst :: rst
in in
view_ view_
config.wrapMsg config.wrapMsg
@ -411,7 +393,7 @@ view theme config getFocusable model =
, Css.border Css.zero , Css.border Css.zero
] ]
] ]
++ focusables ++ [ focusables ]
) )
model model
|> List.singleton |> List.singleton