@@ -149,53 +149,70 @@ field full@Full {fullArgs = args, fullParser = parser, fullViewer = viewer} opts
149
149
( \ x ->
150
150
singleton
151
151
. keyed (decodeUtf8 . unTagged $ htmlUid uid)
152
- . label_ mempty
153
- . (text x : )
154
- . (br_ mempty : )
155
- )
156
- (optsLabel opts)
157
- ( [ input_
158
- $ ( catMaybes
159
- [ Just . type_ $ htmlFieldType typ,
160
- fmap required_
161
- $ st
162
- ^? cloneTraversal optic
163
- . # fieldRequired,
164
- fmap
165
- (textProp " defaultValue" )
166
- ( st
167
- ^? cloneTraversal
168
- optic
169
- . # fieldInput
170
- . # uniqueValue
171
- ),
172
- Just
173
- $ onInput onInputAction,
174
- Just
175
- . disabled_
176
- $ opts
177
- ^. # optsDisabled,
178
- fmap placeholder_
179
- $ if null placeholder
180
- then optsLabel opts
181
- else Just placeholder,
182
- Just
183
- . id_
184
- . either impureThrow id
185
- . decodeUtf8Strict
186
- . unTagged
187
- $ htmlUid uid,
188
- Just
189
- . onKeyDown
190
- $ action
191
- . optsOnKeyDownAction opts uid,
192
- Just
193
- $ onBlur onBlurAction
152
+ . label_
153
+ [ style_
154
+ [ (" display" , " flex" ),
155
+ (" flex-wrap" , " wrap" ),
156
+ (" flex-direction" , " row" ),
157
+ (" align-items" , " center" )
194
158
]
159
+ ]
160
+ . ( span_
161
+ [style_ [(" width" , " 100%" )]]
162
+ [text x]
163
+ :
195
164
)
196
- <> ( opts ^. # optsExtraAttributes
197
- )
198
- ]
165
+ )
166
+ (optsLabel opts)
167
+ ( leadingWidgets
168
+ <> [ input_
169
+ $ ( catMaybes
170
+ [ Just
171
+ $ style_
172
+ [ (" width" , " 0" ),
173
+ (" flex-grow" , " 1" )
174
+ ],
175
+ Just . type_ $ htmlFieldType typ,
176
+ fmap required_
177
+ $ st
178
+ ^? cloneTraversal optic
179
+ . # fieldRequired,
180
+ fmap
181
+ (textProp " defaultValue" )
182
+ ( st
183
+ ^? cloneTraversal
184
+ optic
185
+ . # fieldInput
186
+ . # uniqueValue
187
+ ),
188
+ Just
189
+ $ onInput onInputAction,
190
+ Just
191
+ . disabled_
192
+ $ opts
193
+ ^. # optsDisabled,
194
+ fmap placeholder_
195
+ $ if null placeholder
196
+ then optsLabel opts
197
+ else Just placeholder,
198
+ Just
199
+ . id_
200
+ . either impureThrow id
201
+ . decodeUtf8Strict
202
+ . unTagged
203
+ $ htmlUid uid,
204
+ Just
205
+ . onKeyDown
206
+ $ action
207
+ . optsOnKeyDownAction opts uid,
208
+ Just
209
+ $ onBlur onBlurAction
210
+ ]
211
+ )
212
+ <> ( opts ^. # optsExtraAttributes
213
+ )
214
+ ]
215
+ <> trailingWidgets
199
216
<> ( if typ /= FieldTypeImage
200
217
then mempty
201
218
else do
@@ -206,12 +223,11 @@ field full@Full {fullArgs = args, fullParser = parser, fullViewer = viewer} opts
206
223
. # fieldInput
207
224
. # uniqueValue
208
225
[ input_
209
- $ catMaybes
210
- [ Just $ type_ " file" ,
211
- Just $ accept_ " image/*" ,
212
- Just $ onInput onInputFileAction,
213
- Just
214
- . id_
226
+ $ [ type_ " file" ,
227
+ accept_ " image/*" ,
228
+ onInput onInputFileAction,
229
+ style_ [(" width" , " 100%" )],
230
+ id_
215
231
. either impureThrow (" file-" <> )
216
232
. decodeUtf8Strict
217
233
. unTagged
@@ -231,27 +247,6 @@ field full@Full {fullArgs = args, fullParser = parser, fullViewer = viewer} opts
231
247
]
232
248
)
233
249
)
234
- --
235
- -- TODO : with new semantic layout separate leading/trailing
236
- -- widgets do not make a lot of sense, should be a single option
237
- -- which is just a list widgets.
238
- --
239
- <> catMaybes
240
- [ fmap
241
- (fieldIcon full opts)
242
- ( opts
243
- ^? # optsLeadingWidget
244
- . _Just
245
- . cloneTraversal widgetOptic
246
- ),
247
- fmap
248
- (fieldIcon full opts)
249
- ( opts
250
- ^? # optsTrailingWidget
251
- . _Just
252
- . cloneTraversal widgetOptic
253
- )
254
- ]
255
250
)
256
251
where
257
252
st = argsModel args
@@ -285,6 +280,24 @@ field full@Full {fullArgs = args, fullParser = parser, fullViewer = viewer} opts
285
280
if isJust next || (inp == viewer out)
286
281
then Nothing
287
282
else Just out
283
+ leadingWidgets =
284
+ maybeToList
285
+ $ fmap
286
+ (fieldIcon full opts)
287
+ ( opts
288
+ ^? # optsLeadingWidget
289
+ . _Just
290
+ . cloneTraversal widgetOptic
291
+ )
292
+ trailingWidgets =
293
+ maybeToList
294
+ $ fmap
295
+ (fieldIcon full opts)
296
+ ( opts
297
+ ^? # optsTrailingWidget
298
+ . _Just
299
+ . cloneTraversal widgetOptic
300
+ )
288
301
onBlurAction =
289
302
action . PureUpdate $ \ prev ->
290
303
prev
@@ -828,7 +841,7 @@ truncateUnicode limit input =
828
841
then input
829
842
else
830
843
take half input
831
- <> " ..."
844
+ <> " ... "
832
845
<> MS. takeEnd half input
833
846
where
834
847
full = fromMaybe defTruncateLimit limit
0 commit comments