@strictly/react-form 0.0.1 → 0.0.3
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/.out/core/mobx/field_adapter.d.ts +7 -6
- package/.out/core/mobx/field_adapter_builder.d.ts +12 -13
- package/.out/core/mobx/field_adapter_builder.js +8 -12
- package/.out/core/mobx/field_adapters_of_values.d.ts +4 -0
- package/.out/core/mobx/flattened_adapters_of_fields.d.ts +2 -2
- package/.out/core/mobx/flattened_list_types_of_type.d.ts +8 -0
- package/.out/core/mobx/form_fields_of_field_adapters.d.ts +8 -0
- package/.out/core/mobx/form_presenter.d.ts +21 -24
- package/.out/core/mobx/form_presenter.js +64 -69
- package/.out/core/mobx/merge_field_adapters_with_two_way_converter.d.ts +13 -0
- package/.out/core/mobx/merge_field_adapters_with_two_way_converter.js +11 -0
- package/.out/core/mobx/merge_field_adapters_with_validators.d.ts +11 -0
- package/.out/core/mobx/merge_field_adapters_with_validators.js +45 -0
- package/.out/core/mobx/specs/fixtures.d.ts +7 -0
- package/.out/core/mobx/specs/fixtures.js +20 -0
- package/.out/core/mobx/specs/flattened_adapters_of_fields.tests.js +5 -2
- package/.out/core/mobx/specs/{flattened_list_type_defs_of.tests.js → flattened_list_types_of_types.tests.js} +7 -7
- package/.out/core/mobx/specs/form_presenter.tests.js +162 -60
- package/.out/core/mobx/specs/merge_field_adapters_with_two_way_converter.js +89 -0
- package/.out/core/mobx/specs/merge_field_adapters_with_validators.tests.js +172 -0
- package/.out/core/mobx/types.d.ts +2 -2
- package/.out/field_converters/chain_field_converter.d.ts +3 -3
- package/.out/field_converters/chain_field_converter.js +17 -12
- package/.out/field_converters/identity_converter.d.ts +3 -3
- package/.out/field_converters/identity_converter.js +10 -6
- package/.out/field_converters/integer_to_string_converter.d.ts +5 -4
- package/.out/field_converters/integer_to_string_converter.js +13 -6
- package/.out/field_converters/list_converter.d.ts +2 -2
- package/.out/field_converters/list_converter.js +6 -1
- package/.out/field_converters/maybe_identity_converter.d.ts +3 -3
- package/.out/field_converters/maybe_identity_converter.js +3 -1
- package/.out/field_converters/nullable_to_boolean_converter.d.ts +9 -8
- package/.out/field_converters/nullable_to_boolean_converter.js +13 -7
- package/.out/field_converters/select_value_type_converter.d.ts +20 -15
- package/.out/field_converters/select_value_type_converter.js +29 -14
- package/.out/field_converters/specs/chain_field_converter.tests.d.ts +1 -0
- package/.out/field_converters/specs/chain_field_converter.tests.js +251 -0
- package/.out/field_converters/trimming_string_converter.d.ts +3 -3
- package/.out/field_converters/trimming_string_converter.js +7 -3
- package/.out/field_converters/validating_converter.d.ts +3 -3
- package/.out/field_converters/validating_converter.js +7 -5
- package/.out/index.d.ts +9 -2
- package/.out/index.js +9 -2
- package/.out/mantine/create_checkbox.d.ts +2 -3
- package/.out/mantine/create_checkbox.js +6 -5
- package/.out/mantine/create_pill.js +2 -2
- package/.out/mantine/create_radio.js +1 -1
- package/.out/mantine/create_radio_group.d.ts +2 -3
- package/.out/mantine/create_radio_group.js +4 -3
- package/.out/mantine/create_text_input.d.ts +2 -3
- package/.out/mantine/create_text_input.js +6 -5
- package/.out/mantine/create_value_input.d.ts +2 -3
- package/.out/mantine/create_value_input.js +6 -5
- package/.out/mantine/error_renderer.d.ts +6 -0
- package/.out/mantine/error_renderer.js +5 -0
- package/.out/mantine/hooks.d.ts +9 -13
- package/.out/mantine/hooks.js +10 -15
- package/.out/mantine/specs/checkbox_hooks.stories.d.ts +7 -2
- package/.out/mantine/specs/checkbox_hooks.stories.js +33 -6
- package/.out/mantine/specs/list_hooks.stories.js +2 -2
- package/.out/mantine/specs/radio_group_hooks.stories.d.ts +7 -2
- package/.out/mantine/specs/radio_group_hooks.stories.js +33 -6
- package/.out/mantine/specs/select_hooks.stories.d.ts +8 -2
- package/.out/mantine/specs/select_hooks.stories.js +45 -8
- package/.out/mantine/specs/text_input_hooks.stories.d.ts +5 -1
- package/.out/mantine/specs/text_input_hooks.stories.js +23 -8
- package/.out/mantine/specs/value_input_hooks.stories.d.ts +7 -2
- package/.out/mantine/specs/value_input_hooks.stories.js +49 -15
- package/.out/mantine/types.d.ts +4 -1
- package/.out/tsconfig.tsbuildinfo +1 -1
- package/.out/types/error_of_field.d.ts +2 -0
- package/.out/types/error_of_field.js +1 -0
- package/.out/types/field.d.ts +1 -1
- package/.out/types/field_converters.d.ts +17 -10
- package/.out/types/field_converters.js +5 -5
- package/.out/types/flattened_validators_of_fields.d.ts +8 -0
- package/.out/types/flattened_validators_of_fields.js +1 -0
- package/.out/types/merge_validators.d.ts +7 -0
- package/.out/types/merge_validators.js +38 -0
- package/.out/types/specs/flattened_validators_of_fields.tests.d.ts +1 -0
- package/.out/types/specs/flattened_validators_of_fields.tests.js +16 -0
- package/.out/types/specs/merge_validators.tests.d.ts +1 -0
- package/.out/types/specs/merge_validators.tests.js +192 -0
- package/.out/util/partial.d.ts +11 -5
- package/.out/util/partial.js +55 -15
- package/.turbo/turbo-build.log +9 -9
- package/.turbo/turbo-check-types.log +1 -1
- package/.turbo/turbo-release$colon$exports.log +1 -1
- package/README.md +5 -1
- package/core/mobx/field_adapter.ts +15 -7
- package/core/mobx/field_adapter_builder.ts +39 -75
- package/core/mobx/field_adapters_of_values.ts +17 -0
- package/core/mobx/flattened_adapters_of_fields.ts +3 -3
- package/core/mobx/flattened_list_types_of_type.ts +17 -0
- package/core/mobx/form_fields_of_field_adapters.ts +16 -0
- package/core/mobx/form_presenter.ts +117 -104
- package/core/mobx/merge_field_adapters_with_two_way_converter.ts +68 -0
- package/core/mobx/merge_field_adapters_with_validators.ts +99 -0
- package/core/mobx/specs/fixtures.ts +73 -0
- package/core/mobx/specs/flattened_adapters_of_fields.tests.ts +23 -2
- package/core/mobx/specs/flattened_list_types_of_types.tests.ts +35 -0
- package/core/mobx/specs/form_presenter.tests.ts +248 -124
- package/core/mobx/specs/merge_field_adapters_with_two_way_converter.ts +140 -0
- package/core/mobx/specs/merge_field_adapters_with_validators.tests.ts +259 -0
- package/core/mobx/types.ts +3 -3
- package/dist/index.cjs +527 -10412
- package/dist/index.d.cts +153 -111
- package/dist/index.d.ts +153 -111
- package/dist/index.js +527 -10420
- package/field_converters/chain_field_converter.ts +37 -23
- package/field_converters/identity_converter.ts +14 -10
- package/field_converters/integer_to_string_converter.ts +15 -9
- package/field_converters/list_converter.ts +8 -3
- package/field_converters/maybe_identity_converter.ts +7 -4
- package/field_converters/nullable_to_boolean_converter.ts +23 -16
- package/field_converters/select_value_type_converter.ts +86 -26
- package/field_converters/specs/chain_field_converter.tests.ts +302 -0
- package/field_converters/trimming_string_converter.ts +11 -6
- package/field_converters/validating_converter.ts +21 -11
- package/index.ts +9 -2
- package/mantine/create_checkbox.tsx +15 -8
- package/mantine/create_list.tsx +1 -4
- package/mantine/create_pill.tsx +2 -2
- package/mantine/create_radio.tsx +1 -1
- package/mantine/create_radio_group.tsx +8 -6
- package/mantine/create_text_input.tsx +20 -8
- package/mantine/create_value_input.tsx +17 -8
- package/mantine/error_renderer.ts +15 -0
- package/mantine/hooks.tsx +25 -51
- package/mantine/specs/__snapshots__/checkbox_hooks.tests.tsx.snap +126 -0
- package/mantine/specs/__snapshots__/radio_group_hooks.tests.tsx.snap +356 -0
- package/mantine/specs/__snapshots__/select_hooks.tests.tsx.snap +208 -12
- package/mantine/specs/__snapshots__/text_input_hooks.tests.tsx.snap +45 -0
- package/mantine/specs/__snapshots__/value_input_hooks.tests.tsx.snap +194 -8
- package/mantine/specs/checkbox_hooks.stories.tsx +47 -7
- package/mantine/specs/list_hooks.stories.tsx +2 -2
- package/mantine/specs/radio_group_hooks.stories.tsx +47 -7
- package/mantine/specs/select_hooks.stories.tsx +55 -8
- package/mantine/specs/text_input_hooks.stories.tsx +32 -7
- package/mantine/specs/value_input_hooks.stories.tsx +57 -16
- package/mantine/types.ts +5 -1
- package/package.json +20 -7
- package/tsconfig.json +1 -0
- package/types/error_of_field.ts +3 -0
- package/types/field.ts +1 -1
- package/types/field_converters.ts +21 -10
- package/types/flattened_validators_of_fields.ts +34 -0
- package/types/merge_validators.ts +80 -0
- package/types/specs/error_type_of_field.tests.ts +2 -2
- package/types/specs/flattened_validators_of_fields.tests.ts +93 -0
- package/types/specs/merge_validators.tests.ts +267 -0
- package/util/partial.tsx +200 -16
- package/.out/core/mobx/flattened_list_type_defs_of.d.ts +0 -8
- package/.out/field_validators/minimum_string_length_field_validator.d.ts +0 -2
- package/.out/field_validators/minimum_string_length_field_validator.js +0 -8
- package/.out/types/error_type_of_field.d.ts +0 -2
- package/.out/types/field_validator.d.ts +0 -3
- package/.out/types/flattened_form_fields_of.d.ts +0 -9
- package/.out/types/specs/flattened_form_fields_of.tests.js +0 -13
- package/core/mobx/flattened_list_type_defs_of.ts +0 -17
- package/core/mobx/specs/flattened_list_type_defs_of.tests.ts +0 -35
- package/field_validators/minimum_string_length_field_validator.ts +0 -13
- package/mantine/specs/__snapshots__/check_box_hooks.tests.tsx.snap +0 -227
- package/types/error_type_of_field.ts +0 -3
- package/types/field_validator.ts +0 -7
- package/types/flattened_form_fields_of.ts +0 -16
- package/types/specs/flattened_form_fields_of.tests.ts +0 -43
- /package/.out/core/mobx/{flattened_list_type_defs_of.js → field_adapters_of_values.js} +0 -0
- /package/.out/core/mobx/{specs/flattened_list_type_defs_of.tests.d.ts → flattened_list_types_of_type.js} +0 -0
- /package/.out/{types/error_type_of_field.js → core/mobx/form_fields_of_field_adapters.js} +0 -0
- /package/.out/{types/field_validator.js → core/mobx/specs/flattened_list_types_of_types.tests.d.ts} +0 -0
- /package/.out/{types/flattened_form_fields_of.js → core/mobx/specs/merge_field_adapters_with_two_way_converter.d.ts} +0 -0
- /package/.out/{types/specs/flattened_form_fields_of.tests.d.ts → core/mobx/specs/merge_field_adapters_with_validators.tests.d.ts} +0 -0
|
@@ -335,6 +335,104 @@ exports[`mantine value input hooks > renders AnSlider 1`] = `
|
|
|
335
335
|
</div>
|
|
336
336
|
`;
|
|
337
337
|
|
|
338
|
+
exports[`mantine value input hooks > renders CustomErrorNumberInput 1`] = `
|
|
339
|
+
<div>
|
|
340
|
+
<style
|
|
341
|
+
data-mantine-styles="classes"
|
|
342
|
+
>
|
|
343
|
+
@media (max-width: 35.99375em) {.mantine-visible-from-xs {display: none !important;}}@media (min-width: 36em) {.mantine-hidden-from-xs {display: none !important;}}@media (max-width: 47.99375em) {.mantine-visible-from-sm {display: none !important;}}@media (min-width: 48em) {.mantine-hidden-from-sm {display: none !important;}}@media (max-width: 61.99375em) {.mantine-visible-from-md {display: none !important;}}@media (min-width: 62em) {.mantine-hidden-from-md {display: none !important;}}@media (max-width: 74.99375em) {.mantine-visible-from-lg {display: none !important;}}@media (min-width: 75em) {.mantine-hidden-from-lg {display: none !important;}}@media (max-width: 87.99375em) {.mantine-visible-from-xl {display: none !important;}}@media (min-width: 88em) {.mantine-hidden-from-xl {display: none !important;}}
|
|
344
|
+
</style>
|
|
345
|
+
<div
|
|
346
|
+
class="m_e2f5cd4e m_46b77525 mantine-InputWrapper-root mantine-NumberInput-root"
|
|
347
|
+
data-error="true"
|
|
348
|
+
>
|
|
349
|
+
<label
|
|
350
|
+
class="m_8fdc1311 mantine-InputWrapper-label mantine-NumberInput-label"
|
|
351
|
+
for="mantine-0cyk5rcyk"
|
|
352
|
+
id="mantine-0cyk5rcyk-label"
|
|
353
|
+
>
|
|
354
|
+
Number Input
|
|
355
|
+
</label>
|
|
356
|
+
<div
|
|
357
|
+
class="m_6c018570 mantine-Input-wrapper mantine-NumberInput-wrapper"
|
|
358
|
+
data-error="true"
|
|
359
|
+
data-variant="default"
|
|
360
|
+
data-with-right-section="true"
|
|
361
|
+
style="--input-margin-bottom: calc(var(--mantine-spacing-xs) / 2); --input-right-section-width: var(--ni-right-section-width-sm);"
|
|
362
|
+
>
|
|
363
|
+
<input
|
|
364
|
+
aria-describedby="mantine-0cyk5rcyk-error"
|
|
365
|
+
aria-invalid="true"
|
|
366
|
+
class="m_8fb7ebe7 mantine-Input-input mantine-NumberInput-input"
|
|
367
|
+
data-error="true"
|
|
368
|
+
data-variant="default"
|
|
369
|
+
id="mantine-0cyk5rcyk"
|
|
370
|
+
inputmode="numeric"
|
|
371
|
+
name="$"
|
|
372
|
+
type="text"
|
|
373
|
+
value="3"
|
|
374
|
+
/>
|
|
375
|
+
<div
|
|
376
|
+
class="m_82577fc2 mantine-Input-section mantine-NumberInput-section"
|
|
377
|
+
data-position="right"
|
|
378
|
+
>
|
|
379
|
+
<div
|
|
380
|
+
class="m_95e17d22 mantine-NumberInput-controls"
|
|
381
|
+
>
|
|
382
|
+
<button
|
|
383
|
+
aria-hidden="true"
|
|
384
|
+
class="mantine-focus-auto m_80b4b171 mantine-NumberInput-control m_87cf2631 mantine-UnstyledButton-root"
|
|
385
|
+
data-direction="up"
|
|
386
|
+
tabindex="-1"
|
|
387
|
+
type="button"
|
|
388
|
+
>
|
|
389
|
+
<svg
|
|
390
|
+
fill="none"
|
|
391
|
+
style="transform: rotate(180deg);"
|
|
392
|
+
viewBox="0 0 15 15"
|
|
393
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
394
|
+
>
|
|
395
|
+
<path
|
|
396
|
+
clip-rule="evenodd"
|
|
397
|
+
d="M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z"
|
|
398
|
+
fill="currentColor"
|
|
399
|
+
fill-rule="evenodd"
|
|
400
|
+
/>
|
|
401
|
+
</svg>
|
|
402
|
+
</button>
|
|
403
|
+
<button
|
|
404
|
+
aria-hidden="true"
|
|
405
|
+
class="mantine-focus-auto m_80b4b171 mantine-NumberInput-control m_87cf2631 mantine-UnstyledButton-root"
|
|
406
|
+
data-direction="down"
|
|
407
|
+
tabindex="-1"
|
|
408
|
+
type="button"
|
|
409
|
+
>
|
|
410
|
+
<svg
|
|
411
|
+
fill="none"
|
|
412
|
+
viewBox="0 0 15 15"
|
|
413
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
414
|
+
>
|
|
415
|
+
<path
|
|
416
|
+
clip-rule="evenodd"
|
|
417
|
+
d="M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z"
|
|
418
|
+
fill="currentColor"
|
|
419
|
+
fill-rule="evenodd"
|
|
420
|
+
/>
|
|
421
|
+
</svg>
|
|
422
|
+
</button>
|
|
423
|
+
</div>
|
|
424
|
+
</div>
|
|
425
|
+
</div>
|
|
426
|
+
<p
|
|
427
|
+
class="m_8f816625 mantine-InputWrapper-error mantine-NumberInput-error"
|
|
428
|
+
id="mantine-0cyk5rcyk-error"
|
|
429
|
+
>
|
|
430
|
+
a custom error
|
|
431
|
+
</p>
|
|
432
|
+
</div>
|
|
433
|
+
</div>
|
|
434
|
+
`;
|
|
435
|
+
|
|
338
436
|
exports[`mantine value input hooks > renders DisabledNumberInput 1`] = `
|
|
339
437
|
<div>
|
|
340
438
|
<style
|
|
@@ -440,17 +538,10 @@ exports[`mantine value input hooks > renders EmptyNumberInput 1`] = `
|
|
|
440
538
|
>
|
|
441
539
|
<label
|
|
442
540
|
class="m_8fdc1311 mantine-InputWrapper-label mantine-NumberInput-label"
|
|
443
|
-
data-required="true"
|
|
444
541
|
for="mantine-0px4bipx4"
|
|
445
542
|
id="mantine-0px4bipx4-label"
|
|
446
543
|
>
|
|
447
544
|
Number Input
|
|
448
|
-
<span
|
|
449
|
-
aria-hidden="true"
|
|
450
|
-
class="m_78a94662 mantine-InputWrapper-required mantine-NumberInput-required"
|
|
451
|
-
>
|
|
452
|
-
*
|
|
453
|
-
</span>
|
|
454
545
|
</label>
|
|
455
546
|
<div
|
|
456
547
|
class="m_6c018570 mantine-Input-wrapper mantine-NumberInput-wrapper"
|
|
@@ -465,7 +556,6 @@ exports[`mantine value input hooks > renders EmptyNumberInput 1`] = `
|
|
|
465
556
|
id="mantine-0px4bipx4"
|
|
466
557
|
inputmode="numeric"
|
|
467
558
|
name="$"
|
|
468
|
-
required=""
|
|
469
559
|
type="text"
|
|
470
560
|
value=""
|
|
471
561
|
/>
|
|
@@ -611,3 +701,99 @@ exports[`mantine value input hooks > renders PopulatedNumberInput 1`] = `
|
|
|
611
701
|
</div>
|
|
612
702
|
</div>
|
|
613
703
|
`;
|
|
704
|
+
|
|
705
|
+
exports[`mantine value input hooks > renders RequiredNumberInput 1`] = `
|
|
706
|
+
<div>
|
|
707
|
+
<style
|
|
708
|
+
data-mantine-styles="classes"
|
|
709
|
+
>
|
|
710
|
+
@media (max-width: 35.99375em) {.mantine-visible-from-xs {display: none !important;}}@media (min-width: 36em) {.mantine-hidden-from-xs {display: none !important;}}@media (max-width: 47.99375em) {.mantine-visible-from-sm {display: none !important;}}@media (min-width: 48em) {.mantine-hidden-from-sm {display: none !important;}}@media (max-width: 61.99375em) {.mantine-visible-from-md {display: none !important;}}@media (min-width: 62em) {.mantine-hidden-from-md {display: none !important;}}@media (max-width: 74.99375em) {.mantine-visible-from-lg {display: none !important;}}@media (min-width: 75em) {.mantine-hidden-from-lg {display: none !important;}}@media (max-width: 87.99375em) {.mantine-visible-from-xl {display: none !important;}}@media (min-width: 88em) {.mantine-hidden-from-xl {display: none !important;}}
|
|
711
|
+
</style>
|
|
712
|
+
<div
|
|
713
|
+
class="m_e2f5cd4e m_46b77525 mantine-InputWrapper-root mantine-NumberInput-root"
|
|
714
|
+
>
|
|
715
|
+
<label
|
|
716
|
+
class="m_8fdc1311 mantine-InputWrapper-label mantine-NumberInput-label"
|
|
717
|
+
data-required="true"
|
|
718
|
+
for="mantine-0cyk5rcyk"
|
|
719
|
+
id="mantine-0cyk5rcyk-label"
|
|
720
|
+
>
|
|
721
|
+
Number Input
|
|
722
|
+
<span
|
|
723
|
+
aria-hidden="true"
|
|
724
|
+
class="m_78a94662 mantine-InputWrapper-required mantine-NumberInput-required"
|
|
725
|
+
>
|
|
726
|
+
*
|
|
727
|
+
</span>
|
|
728
|
+
</label>
|
|
729
|
+
<div
|
|
730
|
+
class="m_6c018570 mantine-Input-wrapper mantine-NumberInput-wrapper"
|
|
731
|
+
data-variant="default"
|
|
732
|
+
data-with-right-section="true"
|
|
733
|
+
style="--input-right-section-width: var(--ni-right-section-width-sm);"
|
|
734
|
+
>
|
|
735
|
+
<input
|
|
736
|
+
aria-invalid="false"
|
|
737
|
+
class="m_8fb7ebe7 mantine-Input-input mantine-NumberInput-input"
|
|
738
|
+
data-variant="default"
|
|
739
|
+
id="mantine-0cyk5rcyk"
|
|
740
|
+
inputmode="numeric"
|
|
741
|
+
name="$"
|
|
742
|
+
required=""
|
|
743
|
+
type="text"
|
|
744
|
+
value="3"
|
|
745
|
+
/>
|
|
746
|
+
<div
|
|
747
|
+
class="m_82577fc2 mantine-Input-section mantine-NumberInput-section"
|
|
748
|
+
data-position="right"
|
|
749
|
+
>
|
|
750
|
+
<div
|
|
751
|
+
class="m_95e17d22 mantine-NumberInput-controls"
|
|
752
|
+
>
|
|
753
|
+
<button
|
|
754
|
+
aria-hidden="true"
|
|
755
|
+
class="mantine-focus-auto m_80b4b171 mantine-NumberInput-control m_87cf2631 mantine-UnstyledButton-root"
|
|
756
|
+
data-direction="up"
|
|
757
|
+
tabindex="-1"
|
|
758
|
+
type="button"
|
|
759
|
+
>
|
|
760
|
+
<svg
|
|
761
|
+
fill="none"
|
|
762
|
+
style="transform: rotate(180deg);"
|
|
763
|
+
viewBox="0 0 15 15"
|
|
764
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
765
|
+
>
|
|
766
|
+
<path
|
|
767
|
+
clip-rule="evenodd"
|
|
768
|
+
d="M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z"
|
|
769
|
+
fill="currentColor"
|
|
770
|
+
fill-rule="evenodd"
|
|
771
|
+
/>
|
|
772
|
+
</svg>
|
|
773
|
+
</button>
|
|
774
|
+
<button
|
|
775
|
+
aria-hidden="true"
|
|
776
|
+
class="mantine-focus-auto m_80b4b171 mantine-NumberInput-control m_87cf2631 mantine-UnstyledButton-root"
|
|
777
|
+
data-direction="down"
|
|
778
|
+
tabindex="-1"
|
|
779
|
+
type="button"
|
|
780
|
+
>
|
|
781
|
+
<svg
|
|
782
|
+
fill="none"
|
|
783
|
+
viewBox="0 0 15 15"
|
|
784
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
785
|
+
>
|
|
786
|
+
<path
|
|
787
|
+
clip-rule="evenodd"
|
|
788
|
+
d="M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z"
|
|
789
|
+
fill="currentColor"
|
|
790
|
+
fill-rule="evenodd"
|
|
791
|
+
/>
|
|
792
|
+
</svg>
|
|
793
|
+
</button>
|
|
794
|
+
</div>
|
|
795
|
+
</div>
|
|
796
|
+
</div>
|
|
797
|
+
</div>
|
|
798
|
+
</div>
|
|
799
|
+
`;
|
|
@@ -4,16 +4,27 @@ import {
|
|
|
4
4
|
type StoryObj,
|
|
5
5
|
} from '@storybook/react'
|
|
6
6
|
import { type FormProps } from 'core/props'
|
|
7
|
+
import { type ErrorRenderer } from 'mantine/error_renderer'
|
|
7
8
|
import { useMantineForm } from 'mantine/hooks'
|
|
8
9
|
import { type Field } from 'types/field'
|
|
9
10
|
import { CHECKBOX_LABEL } from './checkbox_constants'
|
|
10
11
|
|
|
11
|
-
function Component(
|
|
12
|
+
function Component({
|
|
13
|
+
ErrorRenderer,
|
|
14
|
+
...props
|
|
15
|
+
}: FormProps<{
|
|
12
16
|
$: Field<boolean, string>,
|
|
13
|
-
}>
|
|
17
|
+
}> & {
|
|
18
|
+
ErrorRenderer?: ErrorRenderer,
|
|
19
|
+
}) {
|
|
14
20
|
const inputProps = useMantineForm(props)
|
|
15
21
|
const CheckboxComponent = inputProps.checkbox('$')
|
|
16
|
-
return
|
|
22
|
+
return (
|
|
23
|
+
<CheckboxComponent
|
|
24
|
+
ErrorRenderer={ErrorRenderer}
|
|
25
|
+
label={CHECKBOX_LABEL}
|
|
26
|
+
/>
|
|
27
|
+
)
|
|
17
28
|
}
|
|
18
29
|
|
|
19
30
|
const meta: Meta<typeof Component> = {
|
|
@@ -34,7 +45,7 @@ export const Off: Story = {
|
|
|
34
45
|
args: {
|
|
35
46
|
fields: {
|
|
36
47
|
$: {
|
|
37
|
-
|
|
48
|
+
readonly: false,
|
|
38
49
|
required: false,
|
|
39
50
|
value: false,
|
|
40
51
|
},
|
|
@@ -46,7 +57,7 @@ export const On: Story = {
|
|
|
46
57
|
args: {
|
|
47
58
|
fields: {
|
|
48
59
|
$: {
|
|
49
|
-
|
|
60
|
+
readonly: false,
|
|
50
61
|
required: false,
|
|
51
62
|
value: true,
|
|
52
63
|
},
|
|
@@ -58,7 +69,7 @@ export const Required: Story = {
|
|
|
58
69
|
args: {
|
|
59
70
|
fields: {
|
|
60
71
|
$: {
|
|
61
|
-
|
|
72
|
+
readonly: false,
|
|
62
73
|
required: true,
|
|
63
74
|
value: false,
|
|
64
75
|
},
|
|
@@ -70,10 +81,39 @@ export const Disabled: Story = {
|
|
|
70
81
|
args: {
|
|
71
82
|
fields: {
|
|
72
83
|
$: {
|
|
73
|
-
|
|
84
|
+
readonly: true,
|
|
74
85
|
required: false,
|
|
75
86
|
value: false,
|
|
76
87
|
},
|
|
77
88
|
},
|
|
78
89
|
},
|
|
79
90
|
}
|
|
91
|
+
|
|
92
|
+
export const Error: Story = {
|
|
93
|
+
args: {
|
|
94
|
+
fields: {
|
|
95
|
+
$: {
|
|
96
|
+
readonly: false,
|
|
97
|
+
required: false,
|
|
98
|
+
value: true,
|
|
99
|
+
error: 'error',
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export const CustomError: Story = {
|
|
106
|
+
args: {
|
|
107
|
+
fields: {
|
|
108
|
+
$: {
|
|
109
|
+
readonly: false,
|
|
110
|
+
required: false,
|
|
111
|
+
value: true,
|
|
112
|
+
error: 'error',
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
ErrorRenderer: function () {
|
|
116
|
+
return 'custom error'
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
}
|
|
@@ -57,7 +57,7 @@ export const Empty: Story = {
|
|
|
57
57
|
args: {
|
|
58
58
|
fields: {
|
|
59
59
|
$: {
|
|
60
|
-
|
|
60
|
+
readonly: false,
|
|
61
61
|
required: false,
|
|
62
62
|
value: [],
|
|
63
63
|
},
|
|
@@ -69,7 +69,7 @@ export const Populated: Story = {
|
|
|
69
69
|
args: {
|
|
70
70
|
fields: {
|
|
71
71
|
$: {
|
|
72
|
-
|
|
72
|
+
readonly: false,
|
|
73
73
|
required: false,
|
|
74
74
|
value: [
|
|
75
75
|
'$.4',
|
|
@@ -7,6 +7,9 @@ import {
|
|
|
7
7
|
type StoryObj,
|
|
8
8
|
} from '@storybook/react'
|
|
9
9
|
import { type FormProps } from 'core/props'
|
|
10
|
+
import {
|
|
11
|
+
type ErrorRenderer,
|
|
12
|
+
} from 'mantine/error_renderer'
|
|
10
13
|
import { useMantineForm } from 'mantine/hooks'
|
|
11
14
|
import { type Field } from 'types/field'
|
|
12
15
|
import {
|
|
@@ -16,14 +19,22 @@ import {
|
|
|
16
19
|
type RadioValue,
|
|
17
20
|
} from './radio_group_constants'
|
|
18
21
|
|
|
19
|
-
function Component(
|
|
22
|
+
function Component({
|
|
23
|
+
ErrorRenderer,
|
|
24
|
+
...props
|
|
25
|
+
}: FormProps<{
|
|
20
26
|
$: Field<RadioValue | null, string>,
|
|
21
|
-
}>
|
|
27
|
+
}> & {
|
|
28
|
+
ErrorRenderer?: ErrorRenderer,
|
|
29
|
+
}) {
|
|
22
30
|
const form = useMantineForm(props)
|
|
23
31
|
const RadioGroupComponent = form.radioGroup('$')
|
|
24
32
|
|
|
25
33
|
return (
|
|
26
|
-
<RadioGroupComponent
|
|
34
|
+
<RadioGroupComponent
|
|
35
|
+
ErrorRenderer={ErrorRenderer}
|
|
36
|
+
label={RADIO_GROUP_LABEL}
|
|
37
|
+
>
|
|
27
38
|
<Stack>
|
|
28
39
|
{RADIO_VALUES.map(function (value: RadioValue) {
|
|
29
40
|
const label = RADIO_LABELS[value]
|
|
@@ -58,7 +69,7 @@ export const Empty: Story = {
|
|
|
58
69
|
args: {
|
|
59
70
|
fields: {
|
|
60
71
|
$: {
|
|
61
|
-
|
|
72
|
+
readonly: false,
|
|
62
73
|
required: false,
|
|
63
74
|
value: null,
|
|
64
75
|
},
|
|
@@ -70,7 +81,7 @@ export const Populated: Story = {
|
|
|
70
81
|
args: {
|
|
71
82
|
fields: {
|
|
72
83
|
$: {
|
|
73
|
-
|
|
84
|
+
readonly: false,
|
|
74
85
|
required: false,
|
|
75
86
|
value: '3',
|
|
76
87
|
},
|
|
@@ -82,7 +93,7 @@ export const Required: Story = {
|
|
|
82
93
|
args: {
|
|
83
94
|
fields: {
|
|
84
95
|
$: {
|
|
85
|
-
|
|
96
|
+
readonly: false,
|
|
86
97
|
required: true,
|
|
87
98
|
value: '1',
|
|
88
99
|
},
|
|
@@ -94,10 +105,39 @@ export const Disabled: Story = {
|
|
|
94
105
|
args: {
|
|
95
106
|
fields: {
|
|
96
107
|
$: {
|
|
97
|
-
|
|
108
|
+
readonly: true,
|
|
109
|
+
required: false,
|
|
110
|
+
value: '2',
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export const Error: Story = {
|
|
117
|
+
args: {
|
|
118
|
+
fields: {
|
|
119
|
+
$: {
|
|
120
|
+
readonly: false,
|
|
98
121
|
required: false,
|
|
99
122
|
value: '2',
|
|
123
|
+
error: 'error',
|
|
100
124
|
},
|
|
101
125
|
},
|
|
102
126
|
},
|
|
103
127
|
}
|
|
128
|
+
|
|
129
|
+
export const CustomError: Story = {
|
|
130
|
+
args: {
|
|
131
|
+
fields: {
|
|
132
|
+
$: {
|
|
133
|
+
readonly: false,
|
|
134
|
+
required: false,
|
|
135
|
+
value: '2',
|
|
136
|
+
error: 'error',
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
ErrorRenderer: function () {
|
|
140
|
+
return 'custom error'
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
}
|
|
@@ -4,17 +4,24 @@ import {
|
|
|
4
4
|
type StoryObj,
|
|
5
5
|
} from '@storybook/react'
|
|
6
6
|
import { type FormProps } from 'core/props'
|
|
7
|
+
import { type ErrorRenderer } from 'mantine/error_renderer'
|
|
7
8
|
import { useMantineForm } from 'mantine/hooks'
|
|
8
9
|
import { type Field } from 'types/field'
|
|
9
10
|
import { SELECT_LABEL } from './select_hooks_constant'
|
|
10
11
|
|
|
11
|
-
function Component(
|
|
12
|
+
function Component({
|
|
13
|
+
ErrorRenderer,
|
|
14
|
+
...props
|
|
15
|
+
}: FormProps<{
|
|
12
16
|
$: Field<string | null, string>,
|
|
13
|
-
}>
|
|
17
|
+
}> & {
|
|
18
|
+
ErrorRenderer?: ErrorRenderer,
|
|
19
|
+
}) {
|
|
14
20
|
const form = useMantineForm(props)
|
|
15
21
|
const SelectComponent = form.select('$')
|
|
16
22
|
return (
|
|
17
23
|
<SelectComponent
|
|
24
|
+
ErrorRenderer={ErrorRenderer}
|
|
18
25
|
data={[
|
|
19
26
|
'a',
|
|
20
27
|
'b',
|
|
@@ -43,8 +50,8 @@ export const EmptySelect: Story = {
|
|
|
43
50
|
args: {
|
|
44
51
|
fields: {
|
|
45
52
|
$: {
|
|
46
|
-
|
|
47
|
-
required:
|
|
53
|
+
readonly: false,
|
|
54
|
+
required: false,
|
|
48
55
|
value: '',
|
|
49
56
|
},
|
|
50
57
|
},
|
|
@@ -55,8 +62,8 @@ export const PopulatedSelect: Story = {
|
|
|
55
62
|
args: {
|
|
56
63
|
fields: {
|
|
57
64
|
$: {
|
|
58
|
-
|
|
59
|
-
required:
|
|
65
|
+
readonly: false,
|
|
66
|
+
required: false,
|
|
60
67
|
value: 'a',
|
|
61
68
|
},
|
|
62
69
|
},
|
|
@@ -67,11 +74,51 @@ export const InvalidSelect: Story = {
|
|
|
67
74
|
args: {
|
|
68
75
|
fields: {
|
|
69
76
|
$: {
|
|
70
|
-
|
|
71
|
-
required:
|
|
77
|
+
readonly: false,
|
|
78
|
+
required: false,
|
|
72
79
|
value: 'd',
|
|
73
80
|
error: 'invalid option',
|
|
74
81
|
},
|
|
75
82
|
},
|
|
76
83
|
},
|
|
77
84
|
}
|
|
85
|
+
|
|
86
|
+
export const RequiredSelect: Story = {
|
|
87
|
+
args: {
|
|
88
|
+
fields: {
|
|
89
|
+
$: {
|
|
90
|
+
readonly: false,
|
|
91
|
+
required: true,
|
|
92
|
+
value: 'a',
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export const DisabledSelect: Story = {
|
|
99
|
+
args: {
|
|
100
|
+
fields: {
|
|
101
|
+
$: {
|
|
102
|
+
readonly: true,
|
|
103
|
+
required: false,
|
|
104
|
+
value: 'a',
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export const CustomErrorSelect: Story = {
|
|
111
|
+
args: {
|
|
112
|
+
fields: {
|
|
113
|
+
$: {
|
|
114
|
+
readonly: false,
|
|
115
|
+
required: true,
|
|
116
|
+
value: 'c',
|
|
117
|
+
error: 'error',
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
ErrorRenderer: function () {
|
|
121
|
+
return 'custom error'
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
}
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
type SuppliedTextInputProps,
|
|
14
14
|
type TextInputTarget,
|
|
15
15
|
} from 'mantine/create_text_input'
|
|
16
|
+
import { type ErrorRenderer } from 'mantine/error_renderer'
|
|
16
17
|
import { useMantineForm } from 'mantine/hooks'
|
|
17
18
|
import { type ComponentType } from 'react'
|
|
18
19
|
import { type Field } from 'types/field'
|
|
@@ -22,15 +23,23 @@ type StoryTextInputProps<T extends TextInputTarget> = SuppliedTextInputProps<T>
|
|
|
22
23
|
|
|
23
24
|
function Component<T extends TextInputTarget>({
|
|
24
25
|
TextInput,
|
|
26
|
+
ErrorRenderer,
|
|
25
27
|
...props
|
|
26
28
|
}: FormProps<{
|
|
27
29
|
$: Field<string, string>,
|
|
28
30
|
}> & {
|
|
29
31
|
TextInput?: ComponentType<StoryTextInputProps<T>>,
|
|
32
|
+
} & {
|
|
33
|
+
ErrorRenderer?: ErrorRenderer,
|
|
30
34
|
}) {
|
|
31
35
|
const form = useMantineForm(props)
|
|
32
36
|
const TextInputComponent = form.textInput<'$', StoryTextInputProps<T>>('$', TextInput)
|
|
33
|
-
return
|
|
37
|
+
return (
|
|
38
|
+
<TextInputComponent
|
|
39
|
+
ErrorRenderer={ErrorRenderer}
|
|
40
|
+
label={TEXT_INPUT_LABEL}
|
|
41
|
+
/>
|
|
42
|
+
)
|
|
34
43
|
}
|
|
35
44
|
|
|
36
45
|
const meta: Meta<typeof Component> = {
|
|
@@ -53,7 +62,7 @@ export const Empty: Story = {
|
|
|
53
62
|
args: {
|
|
54
63
|
fields: {
|
|
55
64
|
$: {
|
|
56
|
-
|
|
65
|
+
readonly: false,
|
|
57
66
|
required: false,
|
|
58
67
|
value: '',
|
|
59
68
|
},
|
|
@@ -65,7 +74,7 @@ export const Populated: Story = {
|
|
|
65
74
|
args: {
|
|
66
75
|
fields: {
|
|
67
76
|
$: {
|
|
68
|
-
|
|
77
|
+
readonly: false,
|
|
69
78
|
required: false,
|
|
70
79
|
value: 'Hello',
|
|
71
80
|
},
|
|
@@ -77,7 +86,7 @@ export const Required: Story = {
|
|
|
77
86
|
args: {
|
|
78
87
|
fields: {
|
|
79
88
|
$: {
|
|
80
|
-
|
|
89
|
+
readonly: false,
|
|
81
90
|
required: true,
|
|
82
91
|
value: 'xxx',
|
|
83
92
|
},
|
|
@@ -89,7 +98,7 @@ export const Disabled: Story = {
|
|
|
89
98
|
args: {
|
|
90
99
|
fields: {
|
|
91
100
|
$: {
|
|
92
|
-
|
|
101
|
+
readonly: true,
|
|
93
102
|
required: false,
|
|
94
103
|
value: 'xxx',
|
|
95
104
|
},
|
|
@@ -97,11 +106,27 @@ export const Disabled: Story = {
|
|
|
97
106
|
},
|
|
98
107
|
}
|
|
99
108
|
|
|
109
|
+
export const CustomError: Story = {
|
|
110
|
+
args: {
|
|
111
|
+
fields: {
|
|
112
|
+
$: {
|
|
113
|
+
readonly: false,
|
|
114
|
+
required: false,
|
|
115
|
+
value: 'xxx',
|
|
116
|
+
error: 'error',
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
ErrorRenderer: function () {
|
|
120
|
+
return 'custom error'
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
}
|
|
124
|
+
|
|
100
125
|
export const OverriddenTextarea: Story<HTMLTextAreaElement> = {
|
|
101
126
|
args: {
|
|
102
127
|
fields: {
|
|
103
128
|
$: {
|
|
104
|
-
|
|
129
|
+
readonly: false,
|
|
105
130
|
required: false,
|
|
106
131
|
value: 'Textarea',
|
|
107
132
|
},
|
|
@@ -114,7 +139,7 @@ export const OverriddenPillsInputField: Story = {
|
|
|
114
139
|
args: {
|
|
115
140
|
fields: {
|
|
116
141
|
$: {
|
|
117
|
-
|
|
142
|
+
readonly: false,
|
|
118
143
|
required: false,
|
|
119
144
|
value: 'PillsInputField',
|
|
120
145
|
},
|