git.iko.soy/typeable/elm-ui
on 2dcbb80 help sign in
4 files changed+27−53
since splitsnapshots
unifiedsplit
README.md−4 elm.json+1−1 src/Element/Input.elm+24−42 src/Internal/Model.elm+2−6
README.md−4
@@ -66,10 +66,6 @@ The work is based off of a rewrite of the [Style Elements](https://github.com/md
6666
6767The community around `elm-ui` is maintaining a collection of examples called the [elm-ui-cookbook](https://github.com/rofrol/elm-ui-cookbook). If you are just starting out with `elm-ui`, or get stuck on specific things, this can be a great resource.
6868
69−## Notes
70−
71−Make sure to have `<!DOCTYPE html>` on top of your application; otherwise, things might get messed up in some browsers.
72−
7369## Contributing
7470
7571Want to help out fixing bugs or reporting issues?
elm.json+1−1
@@ -3,7 +3,7 @@
33 "name": "mdgriffith/elm-ui",
44 "summary": "Layout and style that's easy to refactor, all without thinking about CSS.",
55 "license": "BSD-3-Clause",
6− "version": "1.1.8",
6+ "version": "1.1.7",
77 "exposed-modules": [
88 "Element",
99 "Element.Input",
src/Element/Input.elm+24−42
@@ -369,17 +369,7 @@ button attrs { onPress, label } =
369369
370370 Just msg ->
371371 Events.onClick msg
372− :: onKeyLookup
373− (\code ->
374− if code == enter then
375− Just msg
376−
377− else if code == space then
378− Just msg
379−
380− else
381− Nothing
382− )
372+ :: onEnter msg
383373 :: attrs
384374 )
385375 )
@@ -457,24 +447,22 @@ checkbox attrs { label, icon, checked, onChange } =
457447 ]
458448 ++ attrs
459449 in
460− applyLabel
461− (Internal.Attr (Html.Attributes.attribute "role" "checkbox")
462− :: Internal.Attr
463− (Html.Attributes.attribute "aria-checked" <|
450+ applyLabel attributes
451+ label
452+ (Internal.element
453+ Internal.asEl
454+ Internal.div
455+ [ Internal.Attr <|
456+ Html.Attributes.attribute "role" "checkbox"
457+ , Internal.Attr <|
458+ Html.Attributes.attribute "aria-checked" <|
464459 if checked then
465460 "true"
466461
467462 else
468463 "false"
469− )
470− :: hiddenLabelAttribute label
471− :: attributes
472− )
473− label
474− (Internal.element
475− Internal.asEl
476− Internal.div
477− [ Element.centerY
464+ , hiddenLabelAttribute label
465+ , Element.centerY
478466 , Element.height Element.fill
479467 , Element.width Element.shrink
480468 ]
@@ -713,7 +701,7 @@ slider attributes input =
713701 ("input[type=\"range\"]." ++ className ++ "::-ms-thumb")
714702 thumbShadowStyle
715703 )
716− , Internal.Attr (Html.Attributes.class (className ++ " ui-slide-bar focusable-parent"))
704+ , Internal.Attr (Html.Attributes.class (className ++ " focusable-parent"))
717705 , Internal.Attr
718706 (Html.Events.onInput
719707 (\str ->
@@ -779,10 +767,10 @@ slider attributes input =
779767 -- This is after `attributes` because the thumb should be in front of everything.
780768 ++ [ Element.behindContent <|
781769 if vertical then
782− viewVerticalThumb factor (Internal.htmlClass "focusable-thumb" :: thumbAttributes) trackWidth
770+ viewVerticalThumb factor thumbAttributes trackWidth
783771
784772 else
785− viewHorizontalThumb factor (Internal.htmlClass "focusable-thumb" :: thumbAttributes) trackHeight
773+ viewHorizontalThumb factor thumbAttributes trackHeight
786774 ]
787775 )
788776 Element.none
@@ -1565,8 +1553,6 @@ email =
15651553
15661554By default it will have a minimum height of one line and resize based on it's contents.
15671555
1568−Use `Element.spacing` to change its line-height.
1569−
15701556-}
15711557multiline :
15721558 List (Attribute msg)
@@ -2105,11 +2091,7 @@ onKeyLookup lookup =
21052091 Json.field "key" Json.string
21062092 |> Json.andThen decode
21072093 in
2108− -- We generally want these attached to the keydown event becaues it allows us to prevent default on things like spacebar scrolling the page.
2109− -- https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/button_role
2110− Internal.Attr <|
2111− Html.Events.preventDefaultOn "keydown"
2112− (Json.map (\fired -> ( fired, True )) isKey)
2094+ Internal.Attr <| Html.Events.on "keyup" isKey
21132095
21142096
21152097{-| -}
@@ -2205,8 +2187,7 @@ defaultCheckbox : Bool -> Element msg
22052187defaultCheckbox checked =
22062188 Element.el
22072189 [ Internal.htmlClass "focusable"
2208− , Element.width
2209− (Element.px 14)
2190+ , Element.width (Element.px 14)
22102191 , Element.height (Element.px 14)
22112192 , Font.color white
22122193 , Element.centerY
@@ -2242,8 +2223,9 @@ defaultCheckbox checked =
22422223
22432224 else
22442225 1
2245− , Element.inFront
2246− (Element.el
2226+ ]
2227+ (if checked then
2228+ Element.el
22472229 [ Border.color white
22482230 , Element.height (Element.px 6)
22492231 , Element.width (Element.px 9)
@@ -2251,7 +2233,6 @@ defaultCheckbox checked =
22512233 , Element.centerX
22522234 , Element.centerY
22532235 , Element.moveUp 1
2254− , Element.transparent (not checked)
22552236 , Border.widthEach
22562237 { top = 0
22572238 , left = 2
@@ -2260,6 +2241,7 @@ defaultCheckbox checked =
22602241 }
22612242 ]
22622243 Element.none
2263− )
2264− ]
2265− Element.none
2244+
2245+ else
2246+ Element.none
2247+ )
src/Internal/Model.elm+2−6
@@ -2244,11 +2244,7 @@ renderFocusStyle focus =
22442244 , Just <| Property "outline" "none"
22452245 ]
22462246 )
2247− , Style
2248− ((Internal.Style.dot classes.any ++ ":focus .focusable, ")
2249− ++ (Internal.Style.dot classes.any ++ ".focusable:focus, ")
2250− ++ (".ui-slide-bar:focus + " ++ Internal.Style.dot classes.any ++ " .focusable-thumb")
2251− )
2247+ , Style (Internal.Style.dot classes.any ++ ":focus .focusable, " ++ Internal.Style.dot classes.any ++ ".focusable:focus")
22522248 (List.filterMap identity
22532249 [ Maybe.map (\color -> Property "border-color" (formatColor color)) focus.borderColor
22542250 , Maybe.map (\color -> Property "background-color" (formatColor color)) focus.backgroundColor
@@ -2656,7 +2652,7 @@ renderStyle options maybePseudo selector props =
26562652 , (selector ++ "-fs:focus-within {")
26572653 ++ renderedProps
26582654 ++ "\n}"
2659− , (".ui-slide-bar:focus + " ++ Internal.Style.dot classes.any ++ " .focusable-thumb" ++ selector ++ "-fs {")
2655+ , (".focusable-parent:focus ~ " ++ "." ++ classes.any ++ " " ++ selector ++ "-fs {")
26602656 ++ renderedProps
26612657 ++ "\n}"
26622658 ]