Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e013bdc

Browse files
committed
Wrap selection element into jf-element di
1 parent 20dbd6b commit e013bdc

File tree

1 file changed

+60
-44
lines changed

1 file changed

+60
-44
lines changed

‎src/Json/Form/Selection.elm

Lines changed: 60 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -37,32 +37,40 @@ switch model schema isRequired isDisabled path =
3737
actuallyDisabled =
3838
isDisabled || disabled
3939
in
40-
label
40+
div
4141
[ classList
42-
[ ( "jf-switch", True )
43-
, ( "jf-switch--on", isChecked )
44-
, ( "jf-switch--focused", model.focused |> Maybe.map ((==) path) |> Maybe.withDefault False )
45-
, ( "jf-switch--invalid", hasError )
46-
, ( "jf-switch--disabled", actuallyDisabled )
47-
, ( "jf-switch--hidden", hidden )
42+
[ ( "jf-element", True )
43+
, ( "jf-element--hidden", hidden )
44+
, ( "jf-element--invalid", hasError )
4845
]
4946
]
50-
[ input
51-
[ type_ "checkbox"
52-
, class "jf-switch__input"
53-
, checked isChecked
54-
, onFocus <| FocusInput (Just path)
55-
, onBlur <| FocusInput Nothing
56-
, onCheck <| (JsonValue.BoolValue >> EditValue path)
57-
, Html.Attributes.id id
58-
, Html.Attributes.name id
59-
, Html.Attributes.disabled actuallyDisabled
47+
[ label
48+
[ classList
49+
[ ( "jf-switch", True )
50+
, ( "jf-switch--on", isChecked )
51+
, ( "jf-switch--focused", model.focused |> Maybe.map ((==) path) |> Maybe.withDefault False )
52+
, ( "jf-switch--invalid", hasError )
53+
, ( "jf-switch--disabled", actuallyDisabled )
54+
, ( "jf-switch--hidden", hidden )
55+
]
56+
]
57+
[ input
58+
[ type_ "checkbox"
59+
, class "jf-switch__input"
60+
, checked isChecked
61+
, onFocus <| FocusInput (Just path)
62+
, onBlur <| FocusInput Nothing
63+
, onCheck <| (JsonValue.BoolValue >> EditValue path)
64+
, Html.Attributes.id id
65+
, Html.Attributes.name id
66+
, Html.Attributes.disabled actuallyDisabled
67+
]
68+
[]
69+
, span [ class "jf-switch__label" ] [ schema |> getTitle isRequired |> text ]
70+
, div [ class "jf-switch__track" ] []
71+
, div [ class "jf-switch__thumb" ] []
72+
, div [ class "jf-switch__helper-text" ] [ helperText ]
6073
]
61-
[]
62-
, span [ class "jf-switch__label" ] [ schema |> getTitle isRequired |> text ]
63-
, div [ class "jf-switch__track" ] []
64-
, div [ class "jf-switch__thumb" ] []
65-
, div [ class "jf-switch__helper-text" ] [ helperText ]
6674
]
6775

6876

@@ -92,31 +100,39 @@ checkbox model schema isRequired isDisabled path =
92100
actuallyDisabled =
93101
isDisabled || disabled
94102
in
95-
label
103+
div
96104
[ classList
97-
[ ( "jf-checkbox", True )
98-
, ( "jf-checkbox--on", isChecked )
99-
, ( "jf-checkbox--focused", model.focused |> Maybe.map ((==) path) |> Maybe.withDefault False )
100-
, ( "jf-checkbox--invalid", hasError )
101-
, ( "jf-checkbox--disabled", actuallyDisabled )
102-
, ( "jf-checkbox--hidden", hidden )
105+
[ ( "jf-element", True )
106+
, ( "jf-element--hidden", hidden )
107+
, ( "jf-element--invalid", hasError )
103108
]
104109
]
105-
[ input
106-
[ type_ "checkbox"
107-
, class "jf-checkbox__input"
108-
, checked isChecked
109-
, Html.Attributes.id id
110-
, Html.Attributes.name id
111-
, Html.Attributes.disabled actuallyDisabled
112-
, onFocus <| FocusInput (Just path)
113-
, onBlur <| FocusInput Nothing
114-
, onCheck <| (JsonValue.BoolValue >> EditValue path)
110+
[ label
111+
[ classList
112+
[ ( "jf-checkbox", True )
113+
, ( "jf-checkbox--on", isChecked )
114+
, ( "jf-checkbox--focused", model.focused |> Maybe.map ((==) path) |> Maybe.withDefault False )
115+
, ( "jf-checkbox--invalid", hasError )
116+
, ( "jf-checkbox--disabled", actuallyDisabled )
117+
, ( "jf-checkbox--hidden", hidden )
118+
]
115119
]
116-
[]
117-
, span [ class "jf-checkbox__label" ] [ schema |> getTitle isRequired |> text ]
118-
, div [ class "jf-checkbox__box-outline" ]
119-
[ div [ class "jf-checkbox__tick-outline" ] []
120+
[ input
121+
[ type_ "checkbox"
122+
, class "jf-checkbox__input"
123+
, checked isChecked
124+
, Html.Attributes.id id
125+
, Html.Attributes.name id
126+
, Html.Attributes.disabled actuallyDisabled
127+
, onFocus <| FocusInput (Just path)
128+
, onBlur <| FocusInput Nothing
129+
, onCheck <| (JsonValue.BoolValue >> EditValue path)
130+
]
131+
[]
132+
, span [ class "jf-checkbox__label" ] [ schema |> getTitle isRequired |> text ]
133+
, div [ class "jf-checkbox__box-outline" ]
134+
[ div [ class "jf-checkbox__tick-outline" ] []
135+
]
136+
, div [ class "jf-checkbox__helper-text" ] [ helperText ]
120137
]
121-
, div [ class "jf-checkbox__helper-text" ] [ helperText ]
122138
]

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /