@colisweb/rescript-toolkit 2.56.1 → 2.57.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/locale/fr.json +5 -0
- package/package.json +14 -14
- package/src/form/Toolkit__Form.res +457 -1
- package/src/ui/Toolkit__Ui_RadioGroup.res +37 -0
- package/src/ui/styles.css +26 -15
- package/src/vendors/BsReactIcons.res +6 -0
package/locale/fr.json
CHANGED
|
@@ -94,6 +94,11 @@
|
|
|
94
94
|
"defaultMessage": "Doit être un entier positif ou un nombre a virgule",
|
|
95
95
|
"message": "Doit être un entier positif ou un nombre a virgule"
|
|
96
96
|
},
|
|
97
|
+
{
|
|
98
|
+
"id": "_e5c29cb8",
|
|
99
|
+
"defaultMessage": "(Optionnel)",
|
|
100
|
+
"message": "(Optionnel)"
|
|
101
|
+
},
|
|
97
102
|
{
|
|
98
103
|
"id": "_e6b5a42a",
|
|
99
104
|
"defaultMessage": "Nbr colis",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@colisweb/rescript-toolkit",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.57.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"clean": "rescript clean",
|
|
6
6
|
"build": "rescript build -with-deps",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"@colisweb/bs-react-intl-extractor-bin": "0.12.2",
|
|
28
28
|
"@colisweb/react-day-picker": "7.4.16",
|
|
29
29
|
"@colisweb/restorative": "0.5.1",
|
|
30
|
-
"@datadog/browser-rum": "4.
|
|
30
|
+
"@datadog/browser-rum": "4.26.0",
|
|
31
31
|
"@reach/accordion": "0.17.0",
|
|
32
32
|
"@reach/alert-dialog": "0.17.0",
|
|
33
33
|
"@reach/auto-id": "0.17.0",
|
|
@@ -43,12 +43,12 @@
|
|
|
43
43
|
"@reach/visually-hidden": "0.17.0",
|
|
44
44
|
"@rescript/react": "0.10.3",
|
|
45
45
|
"@tailwindcss/line-clamp": "0.4.2",
|
|
46
|
-
"autoprefixer": "10.4.
|
|
46
|
+
"autoprefixer": "10.4.13",
|
|
47
47
|
"axios": "0.24.0",
|
|
48
48
|
"bs-axios": "0.0.43",
|
|
49
49
|
"case": "1.6.3",
|
|
50
50
|
"click-outside-hook": "1.1.0",
|
|
51
|
-
"copy-to-clipboard": "3.3.
|
|
51
|
+
"copy-to-clipboard": "3.3.3",
|
|
52
52
|
"date-fns": "2.29.3",
|
|
53
53
|
"decco": "1.6.0",
|
|
54
54
|
"dedent": "0.7.0",
|
|
@@ -56,19 +56,19 @@
|
|
|
56
56
|
"lenses-ppx": "6.1.10",
|
|
57
57
|
"list-selectors": "2.0.1",
|
|
58
58
|
"lodash": "4.17.21",
|
|
59
|
-
"postcss": "8.4.
|
|
59
|
+
"postcss": "8.4.19",
|
|
60
60
|
"postcss-loader": "4.2.0",
|
|
61
61
|
"postcss-preset-env": "6.7.0",
|
|
62
62
|
"prismjs": "1.29.0",
|
|
63
63
|
"react": "18.2.0",
|
|
64
|
-
"react-big-calendar": "1.5.
|
|
64
|
+
"react-big-calendar": "1.5.2",
|
|
65
65
|
"react-datepicker": "3.8.0",
|
|
66
66
|
"react-dom": "18.2.0",
|
|
67
67
|
"react-error-boundary": "3.1.4",
|
|
68
68
|
"react-helmet": "6.1.0",
|
|
69
|
-
"react-icons": "4.
|
|
70
|
-
"react-intl": "6.
|
|
71
|
-
"react-select": "5.
|
|
69
|
+
"react-icons": "4.7.1",
|
|
70
|
+
"react-intl": "6.2.5",
|
|
71
|
+
"react-select": "5.7.0",
|
|
72
72
|
"react-table": "7.8.0",
|
|
73
73
|
"react-use": "17.4.0",
|
|
74
74
|
"reason-promise": "1.1.5",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"tailwindcss": "3.2.4"
|
|
83
83
|
},
|
|
84
84
|
"devDependencies": {
|
|
85
|
-
"@babel/core": "7.
|
|
85
|
+
"@babel/core": "7.20.5",
|
|
86
86
|
"@storybook/addon-actions": "6.1.21",
|
|
87
87
|
"@storybook/addon-essentials": "6.1.21",
|
|
88
88
|
"@storybook/addon-knobs": "6.1.21",
|
|
@@ -91,11 +91,11 @@
|
|
|
91
91
|
"@storybook/react": "6.1.21",
|
|
92
92
|
"@storybook/theming": "6.1.21",
|
|
93
93
|
"babel-loader": "8.2.5",
|
|
94
|
-
"highlight.js": "11.
|
|
95
|
-
"husky": "8.0.
|
|
94
|
+
"highlight.js": "11.7.0",
|
|
95
|
+
"husky": "8.0.2",
|
|
96
96
|
"is-ci": "3.0.1",
|
|
97
97
|
"raw-loader": "4.0.2",
|
|
98
|
-
"react-is": "
|
|
99
|
-
"sass": "1.
|
|
98
|
+
"react-is": "18.2.0",
|
|
99
|
+
"sass": "1.56.1"
|
|
100
100
|
}
|
|
101
101
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
open ReactIntl
|
|
2
|
+
|
|
1
3
|
module Helpers = {
|
|
2
4
|
let handleChange = (handleChange, event) => handleChange(ReactEvent.Form.target(event)["value"])
|
|
3
5
|
|
|
@@ -72,11 +74,26 @@ module Make = (StateLenses: Config) => {
|
|
|
72
74
|
form.submit()
|
|
73
75
|
}}>
|
|
74
76
|
children
|
|
75
|
-
<ReachUi.VisuallyHidden>
|
|
77
|
+
<ReachUi.VisuallyHidden>
|
|
78
|
+
<input type_="submit" hidden=true />
|
|
79
|
+
</ReachUi.VisuallyHidden>
|
|
76
80
|
</form>
|
|
77
81
|
}
|
|
78
82
|
}
|
|
79
83
|
|
|
84
|
+
module RadioGroup = {
|
|
85
|
+
@react.component
|
|
86
|
+
let make = (~field, ~elements, ~inline=?) =>
|
|
87
|
+
<Form.Field
|
|
88
|
+
field
|
|
89
|
+
render={({handleChange, error, value}) => <>
|
|
90
|
+
<Toolkit__Ui_RadioGroup
|
|
91
|
+
defaultValue=value onChange={v => handleChange(v)} elements ?inline
|
|
92
|
+
/>
|
|
93
|
+
<ErrorMessage ?error />
|
|
94
|
+
</>}
|
|
95
|
+
/>
|
|
96
|
+
}
|
|
80
97
|
module Input = {
|
|
81
98
|
@react.component
|
|
82
99
|
let make = (
|
|
@@ -189,4 +206,443 @@ module Make = (StateLenses: Config) => {
|
|
|
189
206
|
/>
|
|
190
207
|
}
|
|
191
208
|
}
|
|
209
|
+
|
|
210
|
+
module Int = {
|
|
211
|
+
@react.component
|
|
212
|
+
let make = (
|
|
213
|
+
~field,
|
|
214
|
+
~label=?,
|
|
215
|
+
~id,
|
|
216
|
+
~name=?,
|
|
217
|
+
~placeholder=?,
|
|
218
|
+
~autoFocus=?,
|
|
219
|
+
~disabled=?,
|
|
220
|
+
~isOptional=?,
|
|
221
|
+
~step=?,
|
|
222
|
+
~min=?,
|
|
223
|
+
~max=?,
|
|
224
|
+
~className=?,
|
|
225
|
+
) => {
|
|
226
|
+
let parseInt: string => option<int> = %raw(`
|
|
227
|
+
x => {
|
|
228
|
+
var result = parseInt(x, 10);
|
|
229
|
+
return isNaN(result) ? undefined : result;
|
|
230
|
+
}
|
|
231
|
+
`)
|
|
232
|
+
|
|
233
|
+
<Form.Field
|
|
234
|
+
field
|
|
235
|
+
render={({handleChange, error, value, validate, state}) => {
|
|
236
|
+
let isInvalid = error->Option.isSome
|
|
237
|
+
|
|
238
|
+
let onChange = event =>
|
|
239
|
+
ReactEvent.Form.target(event)["value"]->Option.flatMap(parseInt)->handleChange
|
|
240
|
+
|
|
241
|
+
let onBlur = _ =>
|
|
242
|
+
switch state {
|
|
243
|
+
| Pristine => ()
|
|
244
|
+
| _ => validate()
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
<>
|
|
248
|
+
{switch label {
|
|
249
|
+
| None => React.null
|
|
250
|
+
| Some(label) =>
|
|
251
|
+
<Toolkit__Ui_Label
|
|
252
|
+
htmlFor=id
|
|
253
|
+
optionalMessage={isOptional->Option.getWithDefault(false)
|
|
254
|
+
? <FormattedMessage defaultMessage="(Optionnel)" />
|
|
255
|
+
: React.null}>
|
|
256
|
+
label
|
|
257
|
+
</Toolkit__Ui_Label>
|
|
258
|
+
}}
|
|
259
|
+
<Toolkit__Ui_TextInput
|
|
260
|
+
?className
|
|
261
|
+
id
|
|
262
|
+
value={value->Option.map(Js.Int.toString)->Option.getWithDefault("")}
|
|
263
|
+
type_="number"
|
|
264
|
+
?name
|
|
265
|
+
?disabled
|
|
266
|
+
?placeholder
|
|
267
|
+
?autoFocus
|
|
268
|
+
?step
|
|
269
|
+
?min
|
|
270
|
+
?max
|
|
271
|
+
isInvalid
|
|
272
|
+
onChange
|
|
273
|
+
onBlur
|
|
274
|
+
/>
|
|
275
|
+
<ErrorMessage ?error />
|
|
276
|
+
</>
|
|
277
|
+
}}
|
|
278
|
+
/>
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
module DateTime = {
|
|
283
|
+
@react.component
|
|
284
|
+
let make = (
|
|
285
|
+
~field,
|
|
286
|
+
~label=?,
|
|
287
|
+
~id,
|
|
288
|
+
~name=?,
|
|
289
|
+
~startDate=?,
|
|
290
|
+
~endDate=?,
|
|
291
|
+
~selectsStart=?,
|
|
292
|
+
~selectsEnd=?,
|
|
293
|
+
~minDate=?,
|
|
294
|
+
~showTimeSelect=?,
|
|
295
|
+
~showYearDropdown=?,
|
|
296
|
+
~placeholder=?,
|
|
297
|
+
~autoFocus=?,
|
|
298
|
+
~disabled=?,
|
|
299
|
+
~isOptional=?,
|
|
300
|
+
~timeCaption=?,
|
|
301
|
+
~timeFormat=?,
|
|
302
|
+
~minTime=?,
|
|
303
|
+
~maxTime=?,
|
|
304
|
+
~timeIntervals=?,
|
|
305
|
+
~inline=?,
|
|
306
|
+
) =>
|
|
307
|
+
<Form.Field
|
|
308
|
+
field
|
|
309
|
+
render={({handleChange, error, value, validate, state}) => {
|
|
310
|
+
let isInvalid = error->Option.isSome
|
|
311
|
+
|
|
312
|
+
let onChange = value => handleChange(value->Js.Nullable.toOption)
|
|
313
|
+
|
|
314
|
+
let onBlur = _ =>
|
|
315
|
+
switch state {
|
|
316
|
+
| Pristine => ()
|
|
317
|
+
| _ => validate()
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
<>
|
|
321
|
+
{switch label {
|
|
322
|
+
| None => React.null
|
|
323
|
+
| Some(label) =>
|
|
324
|
+
<Toolkit__Ui_Label
|
|
325
|
+
htmlFor=id
|
|
326
|
+
optionalMessage={isOptional->Option.getWithDefault(false)
|
|
327
|
+
? <FormattedMessage defaultMessage="(Optionnel)" />
|
|
328
|
+
: React.null}>
|
|
329
|
+
label
|
|
330
|
+
</Toolkit__Ui_Label>
|
|
331
|
+
}}
|
|
332
|
+
<Toolkit__Ui_DatetimeInput
|
|
333
|
+
?value
|
|
334
|
+
?showTimeSelect
|
|
335
|
+
?showYearDropdown
|
|
336
|
+
?disabled
|
|
337
|
+
?startDate
|
|
338
|
+
?endDate
|
|
339
|
+
?inline
|
|
340
|
+
?selectsStart
|
|
341
|
+
?timeFormat
|
|
342
|
+
?timeCaption
|
|
343
|
+
?timeIntervals
|
|
344
|
+
?selectsEnd
|
|
345
|
+
?minTime
|
|
346
|
+
?maxTime
|
|
347
|
+
?minDate
|
|
348
|
+
id
|
|
349
|
+
?name
|
|
350
|
+
?placeholder
|
|
351
|
+
?autoFocus
|
|
352
|
+
onBlur
|
|
353
|
+
onChange
|
|
354
|
+
isInvalid
|
|
355
|
+
/>
|
|
356
|
+
<ErrorMessage ?error />
|
|
357
|
+
</>
|
|
358
|
+
}}
|
|
359
|
+
/>
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
module Textarea = {
|
|
363
|
+
@react.component
|
|
364
|
+
let make = (
|
|
365
|
+
~field,
|
|
366
|
+
~label=?,
|
|
367
|
+
~variant=#default,
|
|
368
|
+
~id,
|
|
369
|
+
~name=?,
|
|
370
|
+
~placeholder=?,
|
|
371
|
+
~autoFocus=?,
|
|
372
|
+
~disabled=?,
|
|
373
|
+
~isOptional=?,
|
|
374
|
+
~className=?,
|
|
375
|
+
) =>
|
|
376
|
+
<Form.Field
|
|
377
|
+
field
|
|
378
|
+
render={({handleChange, error, value, validate, state}) => {
|
|
379
|
+
let isInvalid = error->Option.isSome
|
|
380
|
+
|
|
381
|
+
let onChange = Helpers.handleChange(handleChange)
|
|
382
|
+
|
|
383
|
+
let onBlur = _ =>
|
|
384
|
+
switch state {
|
|
385
|
+
| Pristine => ()
|
|
386
|
+
| _ => validate()
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
<>
|
|
390
|
+
{switch label {
|
|
391
|
+
| None => React.null
|
|
392
|
+
| Some(label) =>
|
|
393
|
+
<Toolkit__Ui_Label
|
|
394
|
+
htmlFor=id
|
|
395
|
+
optionalMessage={isOptional->Option.getWithDefault(false)
|
|
396
|
+
? <FormattedMessage defaultMessage="(Optionnel)" />
|
|
397
|
+
: React.null}>
|
|
398
|
+
label
|
|
399
|
+
</Toolkit__Ui_Label>
|
|
400
|
+
}}
|
|
401
|
+
<Toolkit__Ui_TextareaInput
|
|
402
|
+
?className
|
|
403
|
+
id
|
|
404
|
+
variant
|
|
405
|
+
value
|
|
406
|
+
?name
|
|
407
|
+
?disabled
|
|
408
|
+
?placeholder
|
|
409
|
+
?autoFocus
|
|
410
|
+
isInvalid
|
|
411
|
+
onChange
|
|
412
|
+
onBlur
|
|
413
|
+
/>
|
|
414
|
+
<ErrorMessage ?error />
|
|
415
|
+
</>
|
|
416
|
+
}}
|
|
417
|
+
/>
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
module Checkbox = {
|
|
421
|
+
@react.component
|
|
422
|
+
let make = (~field, ~label, ~name=?, ~disabled=?, ~className=?) =>
|
|
423
|
+
<Form.Field
|
|
424
|
+
field
|
|
425
|
+
render={({handleChange, error, value}) => <>
|
|
426
|
+
<Toolkit__Ui_Checkbox
|
|
427
|
+
?className
|
|
428
|
+
checked={value->Obj.magic}
|
|
429
|
+
value={value->Obj.magic}
|
|
430
|
+
?name
|
|
431
|
+
?disabled
|
|
432
|
+
onChange={(checked, _value) => handleChange(checked)}>
|
|
433
|
+
label
|
|
434
|
+
</Toolkit__Ui_Checkbox>
|
|
435
|
+
<ErrorMessage ?error />
|
|
436
|
+
</>}
|
|
437
|
+
/>
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
module Select = {
|
|
441
|
+
@react.component
|
|
442
|
+
let make = (
|
|
443
|
+
~field,
|
|
444
|
+
~label=?,
|
|
445
|
+
~id,
|
|
446
|
+
~name=?,
|
|
447
|
+
~items,
|
|
448
|
+
~itemToLabel=?,
|
|
449
|
+
~itemToId=?,
|
|
450
|
+
~placeholder=?,
|
|
451
|
+
~hasPlaceholderOption=?,
|
|
452
|
+
~autoFocus=?,
|
|
453
|
+
~disabled=?,
|
|
454
|
+
~isOptional=?,
|
|
455
|
+
~className=?,
|
|
456
|
+
) => {
|
|
457
|
+
let valueRef = React.useRef(None)
|
|
458
|
+
|
|
459
|
+
<Form.Field
|
|
460
|
+
field
|
|
461
|
+
render={({handleChange, error, value, validate, state}) => {
|
|
462
|
+
let isInvalid = error->Option.isSome
|
|
463
|
+
|
|
464
|
+
let onChange = value => valueRef.current = Some(value)
|
|
465
|
+
|
|
466
|
+
let onBlur = _ => {
|
|
467
|
+
valueRef.current->Option.map(handleChange)->ignore
|
|
468
|
+
valueRef.current = None
|
|
469
|
+
|
|
470
|
+
switch state {
|
|
471
|
+
| Pristine => ()
|
|
472
|
+
| _ => validate()
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
<>
|
|
477
|
+
{switch label {
|
|
478
|
+
| None => React.null
|
|
479
|
+
| Some(label) =>
|
|
480
|
+
<Toolkit__Ui_Label
|
|
481
|
+
htmlFor=id
|
|
482
|
+
optionalMessage={isOptional->Option.getWithDefault(false)
|
|
483
|
+
? <FormattedMessage defaultMessage="(Optionnel)" />
|
|
484
|
+
: React.null}>
|
|
485
|
+
label
|
|
486
|
+
</Toolkit__Ui_Label>
|
|
487
|
+
}}
|
|
488
|
+
<Toolkit__Ui_ListboxInput.Select
|
|
489
|
+
?className
|
|
490
|
+
items
|
|
491
|
+
?name
|
|
492
|
+
?itemToLabel
|
|
493
|
+
?itemToId
|
|
494
|
+
id
|
|
495
|
+
?disabled
|
|
496
|
+
?placeholder
|
|
497
|
+
?hasPlaceholderOption
|
|
498
|
+
?autoFocus
|
|
499
|
+
isInvalid
|
|
500
|
+
onChange
|
|
501
|
+
onBlur
|
|
502
|
+
defaultValue=?value
|
|
503
|
+
/>
|
|
504
|
+
<ErrorMessage ?error />
|
|
505
|
+
</>
|
|
506
|
+
}}
|
|
507
|
+
/>
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
module SearchSelect = {
|
|
512
|
+
open! BsReactSelect
|
|
513
|
+
|
|
514
|
+
@react.component
|
|
515
|
+
let make = (
|
|
516
|
+
~field,
|
|
517
|
+
~label=?,
|
|
518
|
+
~id,
|
|
519
|
+
~name,
|
|
520
|
+
~options,
|
|
521
|
+
~placeholder=?,
|
|
522
|
+
~isDisabled=?,
|
|
523
|
+
~className="",
|
|
524
|
+
~isOptional=?,
|
|
525
|
+
~valueFormat,
|
|
526
|
+
~autoFocus=?,
|
|
527
|
+
) => {
|
|
528
|
+
<Form.Field
|
|
529
|
+
field
|
|
530
|
+
render={({handleChange, error, value}) => {
|
|
531
|
+
let isInvalid = error->Option.isSome
|
|
532
|
+
|
|
533
|
+
<>
|
|
534
|
+
{switch label {
|
|
535
|
+
| None => React.null
|
|
536
|
+
| Some(label) =>
|
|
537
|
+
<Toolkit__Ui_Label
|
|
538
|
+
htmlFor=id
|
|
539
|
+
optionalMessage={isOptional->Option.getWithDefault(false)
|
|
540
|
+
? <FormattedMessage defaultMessage="(Optionnel)" />
|
|
541
|
+
: React.null}>
|
|
542
|
+
label
|
|
543
|
+
</Toolkit__Ui_Label>
|
|
544
|
+
}}
|
|
545
|
+
<ReactSelect
|
|
546
|
+
defaultMenuIsOpen=?autoFocus
|
|
547
|
+
?autoFocus
|
|
548
|
+
name
|
|
549
|
+
?isDisabled
|
|
550
|
+
classNamePrefix="react-select"
|
|
551
|
+
className={cx([className, isInvalid ? "errored" : ""])}
|
|
552
|
+
?placeholder
|
|
553
|
+
onChange={o => handleChange(Some(o.value))}
|
|
554
|
+
value=?{value->Option.map(valueFormat)}
|
|
555
|
+
options
|
|
556
|
+
/>
|
|
557
|
+
<ErrorMessage ?error />
|
|
558
|
+
</>
|
|
559
|
+
}}
|
|
560
|
+
/>
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
module MultiSelect = {
|
|
565
|
+
@react.component
|
|
566
|
+
let make = (
|
|
567
|
+
~field,
|
|
568
|
+
~label=?,
|
|
569
|
+
~id,
|
|
570
|
+
~name=?,
|
|
571
|
+
~items,
|
|
572
|
+
~itemToLabel,
|
|
573
|
+
~itemToId,
|
|
574
|
+
~placeholder=?,
|
|
575
|
+
~hasPlaceholderOption=?,
|
|
576
|
+
~autoFocus=?,
|
|
577
|
+
~disabled=?,
|
|
578
|
+
~isOptional=?,
|
|
579
|
+
~className=?,
|
|
580
|
+
) => {
|
|
581
|
+
let valueRef = React.useRef(None)
|
|
582
|
+
|
|
583
|
+
<Form.Field
|
|
584
|
+
field
|
|
585
|
+
render={({handleChange, error, value, validate, state}) => {
|
|
586
|
+
let isInvalid = error->Option.isSome
|
|
587
|
+
|
|
588
|
+
let onChange = value => valueRef.current = Some(value)
|
|
589
|
+
|
|
590
|
+
let onBlur = _ => {
|
|
591
|
+
valueRef.current->Option.map(handleChange)->ignore
|
|
592
|
+
valueRef.current = None
|
|
593
|
+
|
|
594
|
+
switch state {
|
|
595
|
+
| Pristine => ()
|
|
596
|
+
| _ => validate()
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
<>
|
|
601
|
+
{switch label {
|
|
602
|
+
| None => React.null
|
|
603
|
+
| Some(label) =>
|
|
604
|
+
<Toolkit__Ui_Label
|
|
605
|
+
htmlFor=id
|
|
606
|
+
optionalMessage={isOptional->Option.getWithDefault(false)
|
|
607
|
+
? <FormattedMessage defaultMessage="(Optionnel)" />
|
|
608
|
+
: React.null}>
|
|
609
|
+
label
|
|
610
|
+
</Toolkit__Ui_Label>
|
|
611
|
+
}}
|
|
612
|
+
<Toolkit__Ui_ListboxInput.MultiSelect
|
|
613
|
+
?className
|
|
614
|
+
items
|
|
615
|
+
?name
|
|
616
|
+
itemToLabel
|
|
617
|
+
itemToId
|
|
618
|
+
id
|
|
619
|
+
value
|
|
620
|
+
?disabled
|
|
621
|
+
?placeholder
|
|
622
|
+
?hasPlaceholderOption
|
|
623
|
+
?autoFocus
|
|
624
|
+
isInvalid
|
|
625
|
+
onChange
|
|
626
|
+
onBlur
|
|
627
|
+
/>
|
|
628
|
+
<ErrorMessage ?error />
|
|
629
|
+
</>
|
|
630
|
+
}}
|
|
631
|
+
/>
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
module Switch = {
|
|
636
|
+
@react.component
|
|
637
|
+
let make = (~field, ~label=?, ~id, ~size=?) =>
|
|
638
|
+
<Form.Field
|
|
639
|
+
field
|
|
640
|
+
render={({handleChange, value}) => <>
|
|
641
|
+
{label->Option.mapWithDefault(React.null, label =>
|
|
642
|
+
<Toolkit__Ui_Label htmlFor=id> label </Toolkit__Ui_Label>
|
|
643
|
+
)}
|
|
644
|
+
<Toolkit__Ui_Switch onChange={value => handleChange(value)} name=id checked=value ?size />
|
|
645
|
+
</>}
|
|
646
|
+
/>
|
|
647
|
+
}
|
|
192
648
|
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
open ReachUi
|
|
2
|
+
module Radio = Toolkit__Ui.Radio
|
|
3
|
+
|
|
4
|
+
type element = {
|
|
5
|
+
label: React.element,
|
|
6
|
+
value: string,
|
|
7
|
+
disabled: bool,
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
@react.component
|
|
11
|
+
let make = (~onChange, ~elements: array<element>, ~defaultValue=?, ~inline=false) => {
|
|
12
|
+
let name = "radio-" ++ AutoId.use("")
|
|
13
|
+
let (value, setValue) = React.useState(() => defaultValue->Option.getWithDefault(""))
|
|
14
|
+
|
|
15
|
+
React.useEffect1(() => {
|
|
16
|
+
onChange(value)
|
|
17
|
+
None
|
|
18
|
+
}, [value])
|
|
19
|
+
|
|
20
|
+
<div className={inline ? "flex gap-3" : ""}>
|
|
21
|
+
{elements
|
|
22
|
+
->Array.mapWithIndex((i, element) =>
|
|
23
|
+
<Radio
|
|
24
|
+
key={"radio-" ++ string_of_int(i)}
|
|
25
|
+
value=element.value
|
|
26
|
+
name
|
|
27
|
+
disabled=element.disabled
|
|
28
|
+
checked={element.value === value}
|
|
29
|
+
onChange={value => {
|
|
30
|
+
setValue(_ => value)
|
|
31
|
+
}}>
|
|
32
|
+
element.label
|
|
33
|
+
</Radio>
|
|
34
|
+
)
|
|
35
|
+
->React.array}
|
|
36
|
+
</div>
|
|
37
|
+
}
|
package/src/ui/styles.css
CHANGED
|
@@ -111,7 +111,7 @@ body,
|
|
|
111
111
|
background-color: #1bb0c4;
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
.searchListBox [aria-selected=true] {
|
|
114
|
+
.searchListBox [aria-selected="true"] {
|
|
115
115
|
background-color: #1bb0c4 !important;
|
|
116
116
|
}
|
|
117
117
|
|
|
@@ -140,12 +140,16 @@ textarea:not([disabled]):not([tabindex="-1"]):focus,
|
|
|
140
140
|
button:not([disabled]):not([tabindex="-1"]):focus,
|
|
141
141
|
iframe:not([tabindex="-1"]):focus,
|
|
142
142
|
[tabindex]:not([tabindex="-1"]):focus,
|
|
143
|
-
[contentEditable=true]:not([tabindex="-1"]):focus,
|
|
143
|
+
[contentEditable="true"]:not([tabindex="-1"]):focus,
|
|
144
144
|
.focus {
|
|
145
145
|
outline: none !important;
|
|
146
146
|
box-shadow: rgba(66, 153, 225, 0.9) 0px 0px 0px 3px;
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
+
.react-select__control input:not([disabled]):not([tabindex="-1"]):focus {
|
|
150
|
+
box-shadow: none !important;
|
|
151
|
+
}
|
|
152
|
+
|
|
149
153
|
.no-focus {
|
|
150
154
|
outline: none !important;
|
|
151
155
|
box-shadow: none !important;
|
|
@@ -159,7 +163,8 @@ iframe:not([tabindex="-1"]):focus,
|
|
|
159
163
|
@apply bg-info-500;
|
|
160
164
|
}
|
|
161
165
|
|
|
162
|
-
.input-range
|
|
166
|
+
.input-range
|
|
167
|
+
.DayPicker-Day--selected:not(.DayPicker-Day--start):not(.DayPicker-Day--end):not(.DayPicker-Day--outside) {
|
|
163
168
|
background-color: #f0f8ff !important;
|
|
164
169
|
color: #4a90e2;
|
|
165
170
|
}
|
|
@@ -215,7 +220,8 @@ iframe:not([tabindex="-1"]):focus,
|
|
|
215
220
|
@apply shadow-none !important;
|
|
216
221
|
}
|
|
217
222
|
|
|
218
|
-
.Selectable
|
|
223
|
+
.Selectable
|
|
224
|
+
.DayPicker-Day--selected:not(.DayPicker-Day--start):not(.DayPicker-Day--end):not(.DayPicker-Day--outside) {
|
|
219
225
|
background-color: #f0f8ff !important;
|
|
220
226
|
color: #4a90e2;
|
|
221
227
|
}
|
|
@@ -260,12 +266,13 @@ iframe:not([tabindex="-1"]):focus,
|
|
|
260
266
|
@apply h-10 text-xl;
|
|
261
267
|
}
|
|
262
268
|
|
|
263
|
-
[data-reach-accordion-item][data-state=open] .cw-accordion-icon {
|
|
269
|
+
[data-reach-accordion-item][data-state="open"] .cw-accordion-icon {
|
|
264
270
|
display: block;
|
|
265
271
|
transform: rotate(90deg);
|
|
266
272
|
}
|
|
267
273
|
|
|
268
|
-
[data-reach-accordion-item][data-state=collapsed]
|
|
274
|
+
[data-reach-accordion-item][data-state="collapsed"]
|
|
275
|
+
.cw-accordion-collapsed-hide {
|
|
269
276
|
display: none !important;
|
|
270
277
|
}
|
|
271
278
|
|
|
@@ -321,7 +328,7 @@ input::-webkit-inner-spin-button {
|
|
|
321
328
|
}
|
|
322
329
|
|
|
323
330
|
/* Firefox */
|
|
324
|
-
input[type=number] {
|
|
331
|
+
input[type="number"] {
|
|
325
332
|
-moz-appearance: textfield;
|
|
326
333
|
}
|
|
327
334
|
|
|
@@ -333,7 +340,8 @@ input[type=number] {
|
|
|
333
340
|
.DayPicker .DayPicker-Day--selected {
|
|
334
341
|
border-radius: 0 !important;
|
|
335
342
|
}
|
|
336
|
-
.DayPicker
|
|
343
|
+
.DayPicker
|
|
344
|
+
.DayPicker-Day--selected:not(.DayPicker-Day--start):not(.DayPicker-Day--end) {
|
|
337
345
|
background-color: #e7edf3 !important;
|
|
338
346
|
color: #15373a;
|
|
339
347
|
}
|
|
@@ -352,11 +360,13 @@ input[type=number] {
|
|
|
352
360
|
.DayPicker .DayPicker-Day--closed {
|
|
353
361
|
border-radius: 0 !important;
|
|
354
362
|
}
|
|
355
|
-
.DayPicker
|
|
363
|
+
.DayPicker
|
|
364
|
+
.DayPicker-Day--closed:not(.DayPicker-Day--start):not(.DayPicker-Day--end) {
|
|
356
365
|
background-color: #ff634b !important;
|
|
357
366
|
color: #15373a;
|
|
358
367
|
}
|
|
359
|
-
.DayPicker
|
|
368
|
+
.DayPicker
|
|
369
|
+
.DayPicker-Day--closed.DayPicker-Day--start:not(.DayPicker-Day--end) {
|
|
360
370
|
border-top-left-radius: 50% !important;
|
|
361
371
|
border-bottom-left-radius: 50% !important;
|
|
362
372
|
border-top-right-radius: 0 !important;
|
|
@@ -364,7 +374,8 @@ input[type=number] {
|
|
|
364
374
|
background-color: #ff904b !important;
|
|
365
375
|
color: #15373a;
|
|
366
376
|
}
|
|
367
|
-
.DayPicker
|
|
377
|
+
.DayPicker
|
|
378
|
+
.DayPicker-Day--closed.DayPicker-Day--end:not(.DayPicker-Day--start) {
|
|
368
379
|
border-top-right-radius: 50% !important;
|
|
369
380
|
border-bottom-right-radius: 50% !important;
|
|
370
381
|
border-top-left-radius: 0 !important;
|
|
@@ -378,10 +389,10 @@ input[type=number] {
|
|
|
378
389
|
}
|
|
379
390
|
|
|
380
391
|
.cw-ButtonGroup > button {
|
|
381
|
-
@apply whitespace-nowrap h-full px-3 md:px-4 flex items-center justify-center rounded-3xl py-3
|
|
392
|
+
@apply whitespace-nowrap h-full px-3 md:px-4 flex items-center justify-center rounded-3xl py-3;
|
|
382
393
|
}
|
|
383
394
|
.cw-ButtonGroup > button:hover {
|
|
384
|
-
@apply bg-primary-300
|
|
395
|
+
@apply bg-primary-300;
|
|
385
396
|
}
|
|
386
397
|
|
|
387
398
|
.cw-ButtonGroup > button.selected {
|
|
@@ -390,7 +401,7 @@ input[type=number] {
|
|
|
390
401
|
}
|
|
391
402
|
|
|
392
403
|
.cw-Checkbox > input:checked + .checkmark > * {
|
|
393
|
-
@apply opacity-100
|
|
404
|
+
@apply opacity-100;
|
|
394
405
|
}
|
|
395
406
|
|
|
396
|
-
/* purgecss end ignore */
|
|
407
|
+
/* purgecss end ignore */
|
|
@@ -5923,6 +5923,12 @@ module FaUserCog = {
|
|
|
5923
5923
|
"FaUserCog"
|
|
5924
5924
|
}
|
|
5925
5925
|
|
|
5926
|
+
module FaUserCircle = {
|
|
5927
|
+
@module("react-icons/fa") @react.component
|
|
5928
|
+
external make: (~size: int=?, ~color: string=?, ~className: string=?) => React.element =
|
|
5929
|
+
"FaUserCircle"
|
|
5930
|
+
}
|
|
5931
|
+
|
|
5926
5932
|
module FaRedo = {
|
|
5927
5933
|
@module("react-icons/fa") @react.component
|
|
5928
5934
|
external make: (~size: int=?, ~color: string=?, ~className: string=?) => React.element = "FaRedo"
|