@digigov/form 2.0.0-cbc56209 → 2.0.0-d2ffc726
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/Field/ErrorGroup/index.js +48 -0
- package/{Questions/index.spec → Field/ErrorGroup}/package.json +1 -1
- package/Field/ErrorGroup.d.ts +15 -0
- package/Field/ErrorGroup.js.map +7 -0
- package/Field/FieldBase/index.js +115 -76
- package/Field/FieldBase.d.ts +1 -1
- package/Field/FieldBase.js.map +7 -0
- package/Field/FieldBaseContainer/index.js +50 -38
- package/Field/FieldBaseContainer.d.ts +2 -2
- package/Field/FieldBaseContainer.js.map +7 -0
- package/Field/FieldConditional/index.js +83 -53
- package/Field/FieldConditional.d.ts +1 -1
- package/Field/FieldConditional.js.map +7 -0
- package/Field/index.d.ts +1 -1
- package/Field/index.js +106 -66
- package/Field/index.js.map +7 -0
- package/Field/types/index.js +1 -1
- package/Field/types.d.ts +59 -11
- package/Field/types.js.map +7 -0
- package/Field/utils/evaluateFieldWithConditions/index.js +26 -0
- package/{inputs/DateInput/__stories__/Default → Field/utils/evaluateFieldWithConditions}/package.json +1 -1
- package/Field/utils/evaluateFieldWithConditions.d.ts +2 -0
- package/Field/utils/evaluateFieldWithConditions.js.map +7 -0
- package/Field/utils/resolveField/index.js +35 -0
- package/{Questions/Questions.stories → Field/utils/resolveField}/package.json +1 -1
- package/Field/utils/resolveField.d.ts +3 -0
- package/Field/utils/resolveField.js.map +7 -0
- package/Field/utils/useField/index.js +66 -0
- package/{FormBuilder/FormBuilder → Field/utils/useField}/package.json +1 -1
- package/Field/utils/useField.d.ts +2 -0
- package/Field/utils/useField.js.map +7 -0
- package/FieldArray/BaseFieldArray/index.js +76 -0
- package/FieldArray/BaseFieldArray/package.json +6 -0
- package/FieldArray/BaseFieldArray.d.ts +5 -0
- package/FieldArray/BaseFieldArray.js.map +7 -0
- package/FieldArray/FieldArray.stories.d.ts +4 -2
- package/FieldArray/FormDialog/ArrayDisplay/ArrayContainerDisplay/index.js +23 -0
- package/FieldArray/FormDialog/ArrayDisplay/ArrayContainerDisplay/package.json +6 -0
- package/FieldArray/FormDialog/ArrayDisplay/ArrayContainerDisplay.d.ts +9 -0
- package/FieldArray/FormDialog/ArrayDisplay/ArrayContainerDisplay.js.map +7 -0
- package/FieldArray/FormDialog/ArrayDisplay/ArrayDisplay.stories.d.ts +13 -0
- package/FieldArray/FormDialog/ArrayDisplay/ArrayItemDisplay/index.js +184 -0
- package/FieldArray/FormDialog/ArrayDisplay/ArrayItemDisplay/package.json +6 -0
- package/FieldArray/FormDialog/ArrayDisplay/ArrayItemDisplay.d.ts +26 -0
- package/FieldArray/FormDialog/ArrayDisplay/ArrayItemDisplay.js.map +7 -0
- package/FieldArray/FormDialog/ArrayDisplay/ArrayItemHeader/index.js +11 -0
- package/FieldArray/FormDialog/ArrayDisplay/ArrayItemHeader/package.json +6 -0
- package/FieldArray/FormDialog/ArrayDisplay/ArrayItemHeader.d.ts +5 -0
- package/FieldArray/FormDialog/ArrayDisplay/ArrayItemHeader.js.map +7 -0
- package/FieldArray/FormDialog/ArrayDisplay/__stories__/Cards.d.ts +2 -0
- package/FieldArray/FormDialog/ArrayDisplay/__stories__/Default.d.ts +2 -0
- package/FieldArray/FormDialog/ArrayDisplay/__stories__/ReadOnly.d.ts +2 -0
- package/FieldArray/FormDialog/ArrayDisplay/__stories__/ReadOnlyCards.d.ts +2 -0
- package/FieldArray/FormDialog/ArrayDisplay/__stories__/Sortable.d.ts +2 -0
- package/FieldArray/FormDialog/ArrayDisplay/__stories__/SortableCards.d.ts +2 -0
- package/FieldArray/FormDialog/ArrayDisplay/index.d.ts +15 -0
- package/FieldArray/FormDialog/ArrayDisplay/index.js +57 -0
- package/FieldArray/FormDialog/ArrayDisplay/index.js.map +7 -0
- package/{inputs/DateInput/DateInput.stories → FieldArray/FormDialog/ArrayDisplay}/package.json +1 -1
- package/FieldArray/FormDialog/ArrayEditModal/index.js +158 -0
- package/{inputs/Checkboxes/Checkboxes.stories → FieldArray/FormDialog/ArrayEditModal}/package.json +1 -1
- package/FieldArray/FormDialog/ArrayEditModal.d.ts +26 -0
- package/FieldArray/FormDialog/ArrayEditModal.js.map +7 -0
- package/FieldArray/FormDialog/index.d.ts +19 -0
- package/FieldArray/FormDialog/index.js +236 -0
- package/FieldArray/FormDialog/index.js.map +7 -0
- package/FieldArray/FormDialog/package.json +6 -0
- package/FieldArray/__stories__/CardsWithError.d.ts +15 -0
- package/FieldArray/__stories__/Default.d.ts +2 -2
- package/FieldArray/__stories__/WithExactLength.d.ts +2 -2
- package/FieldArray/__stories__/WithModal.d.ts +2 -0
- package/FieldArray/index.d.ts +11 -2
- package/FieldArray/index.js +91 -59
- package/FieldArray/index.js.map +7 -0
- package/FieldObject/index.d.ts +11 -3
- package/FieldObject/index.js +78 -52
- package/FieldObject/index.js.map +7 -0
- package/Fieldset/FieldsetWithContext/index.js +27 -31
- package/Fieldset/FieldsetWithContext.js.map +7 -0
- package/Fieldset/index.d.ts +2 -2
- package/Fieldset/index.js +27 -29
- package/Fieldset/index.js.map +7 -0
- package/Fieldset/types/index.js +1 -1
- package/Fieldset/types.d.ts +3 -2
- package/Fieldset/types.js.map +7 -0
- package/FormBuilder/FormBuilder.stories.d.ts +5 -1
- package/FormBuilder/__stories__/AutoErrorGrouping.d.ts +3 -0
- package/FormBuilder/__stories__/Default.d.ts +2 -2
- package/FormBuilder/__stories__/ErrorGrouping.d.ts +3 -0
- package/FormBuilder/index.d.ts +8 -1
- package/FormBuilder/index.js +267 -2
- package/FormBuilder/index.js.map +7 -0
- package/FormContext/index.js +11 -3
- package/FormContext.d.ts +3 -2
- package/FormContext.js.map +7 -0
- package/MultiplicityField/MultiplicityField.stories.d.ts +8 -6
- package/MultiplicityField/__stories__/Default.d.ts +2 -2
- package/MultiplicityField/__stories__/PreviewDisplay.d.ts +2 -2
- package/MultiplicityField/__stories__/WithExactLength.d.ts +2 -2
- package/MultiplicityField/__stories__/WithMaxLength.d.ts +2 -2
- package/MultiplicityField/__stories__/WithMinAndMaxLength.d.ts +2 -2
- package/MultiplicityField/__stories__/WithMinLength.d.ts +2 -2
- package/MultiplicityField/add-objects/index.js +131 -133
- package/MultiplicityField/add-objects.d.ts +3 -2
- package/MultiplicityField/add-objects.js.map +7 -0
- package/MultiplicityField/index.d.ts +2 -19
- package/MultiplicityField/index.js +117 -106
- package/MultiplicityField/index.js.map +7 -0
- package/MultiplicityField/types/index.js +1 -0
- package/MultiplicityField/types/package.json +6 -0
- package/MultiplicityField/types.d.ts +19 -0
- package/MultiplicityField/types.js.map +7 -0
- package/Questions/Questions/index.js +48 -56
- package/Questions/Questions.d.ts +1 -1
- package/Questions/Questions.js.map +7 -0
- package/Questions/Questions.stories.d.ts +3 -1
- package/Questions/QuestionsContext/index.js +9 -9
- package/Questions/QuestionsContext.d.ts +1 -2
- package/Questions/QuestionsContext.js.map +7 -0
- package/Questions/Step/ReviewStep/index.js +35 -47
- package/Questions/Step/ReviewStep.js.map +7 -0
- package/Questions/Step/Step/index.js +39 -47
- package/Questions/Step/Step.d.ts +1 -1
- package/Questions/Step/Step.js.map +7 -0
- package/Questions/Step/StepArrayReview/index.js +41 -45
- package/Questions/Step/StepArrayReview.d.ts +1 -1
- package/Questions/Step/StepArrayReview.js.map +7 -0
- package/Questions/Step/StepContext/index.js +15 -19
- package/Questions/Step/StepContext.d.ts +1 -2
- package/Questions/Step/StepContext.js.map +7 -0
- package/Questions/Step/StepDescription/index.js +22 -22
- package/Questions/Step/StepDescription.d.ts +1 -1
- package/Questions/Step/StepDescription.js.map +7 -0
- package/Questions/Step/StepForm/index.js +33 -43
- package/Questions/Step/StepForm.d.ts +2 -2
- package/Questions/Step/StepForm.js.map +7 -0
- package/Questions/Step/StepQuote/index.js +10 -9
- package/Questions/Step/StepQuote.d.ts +1 -1
- package/Questions/Step/StepQuote.js.map +7 -0
- package/Questions/Step/StepTitle/index.js +41 -38
- package/Questions/Step/StepTitle.d.ts +2 -1
- package/Questions/Step/StepTitle.js.map +7 -0
- package/Questions/Step/getAddMoreFields/index.js +28 -20
- package/Questions/Step/getAddMoreFields.d.ts +2 -2
- package/Questions/Step/getAddMoreFields.js.map +7 -0
- package/Questions/Step/index.d.ts +0 -1
- package/Questions/Step/index.js +16 -13
- package/Questions/Step/index.js.map +7 -0
- package/Questions/Step/types/index.js +1 -1
- package/Questions/Step/types.d.ts +2 -1
- package/Questions/Step/types.js.map +7 -0
- package/Questions/__stories__/Default.d.ts +2 -2
- package/Questions/getNextStep/index.js +12 -10
- package/Questions/getNextStep.d.ts +1 -1
- package/Questions/getNextStep.js.map +7 -0
- package/Questions/index.js +7 -3
- package/Questions/index.js.map +7 -0
- package/Questions/types/index.js +1 -1
- package/Questions/types.d.ts +2 -1
- package/Questions/types.js.map +7 -0
- package/cjs/Field/ErrorGroup/index.js +82 -0
- package/cjs/Field/ErrorGroup.js.map +7 -0
- package/cjs/Field/FieldBase/index.js +147 -82
- package/cjs/Field/FieldBase.js.map +7 -0
- package/cjs/Field/FieldBaseContainer/index.js +83 -45
- package/cjs/Field/FieldBaseContainer.js.map +7 -0
- package/cjs/Field/FieldConditional/index.js +115 -59
- package/cjs/Field/FieldConditional.js.map +7 -0
- package/cjs/Field/index.js +138 -75
- package/cjs/Field/index.js.map +7 -0
- package/cjs/Field/types/index.js +16 -5
- package/cjs/Field/types.js.map +7 -0
- package/cjs/Field/utils/evaluateFieldWithConditions/index.js +49 -0
- package/cjs/Field/utils/evaluateFieldWithConditions.js.map +7 -0
- package/cjs/Field/utils/resolveField/index.js +55 -0
- package/cjs/Field/utils/resolveField.js.map +7 -0
- package/cjs/Field/utils/useField/index.js +89 -0
- package/cjs/Field/utils/useField.js.map +7 -0
- package/cjs/FieldArray/BaseFieldArray/index.js +109 -0
- package/cjs/FieldArray/BaseFieldArray.js.map +7 -0
- package/cjs/FieldArray/FormDialog/ArrayDisplay/ArrayContainerDisplay/index.js +56 -0
- package/cjs/FieldArray/FormDialog/ArrayDisplay/ArrayContainerDisplay.js.map +7 -0
- package/cjs/FieldArray/FormDialog/ArrayDisplay/ArrayItemDisplay/index.js +209 -0
- package/cjs/FieldArray/FormDialog/ArrayDisplay/ArrayItemDisplay.js.map +7 -0
- package/cjs/FieldArray/FormDialog/ArrayDisplay/ArrayItemHeader/index.js +44 -0
- package/cjs/FieldArray/FormDialog/ArrayDisplay/ArrayItemHeader.js.map +7 -0
- package/cjs/FieldArray/FormDialog/ArrayDisplay/index.js +90 -0
- package/cjs/FieldArray/FormDialog/ArrayDisplay/index.js.map +7 -0
- package/cjs/FieldArray/FormDialog/ArrayEditModal/index.js +186 -0
- package/cjs/FieldArray/FormDialog/ArrayEditModal.js.map +7 -0
- package/cjs/FieldArray/FormDialog/index.js +263 -0
- package/cjs/FieldArray/FormDialog/index.js.map +7 -0
- package/cjs/FieldArray/index.js +123 -65
- package/cjs/FieldArray/index.js.map +7 -0
- package/cjs/FieldObject/index.js +110 -61
- package/cjs/FieldObject/index.js.map +7 -0
- package/cjs/Fieldset/FieldsetWithContext/index.js +54 -40
- package/cjs/Fieldset/FieldsetWithContext.js.map +7 -0
- package/cjs/Fieldset/index.js +61 -39
- package/cjs/Fieldset/index.js.map +7 -0
- package/cjs/Fieldset/types/index.js +16 -5
- package/cjs/Fieldset/types.js.map +7 -0
- package/cjs/FormBuilder/index.js +302 -7
- package/cjs/FormBuilder/index.js.map +7 -0
- package/cjs/FormContext/index.js +34 -8
- package/cjs/FormContext.js.map +7 -0
- package/cjs/MultiplicityField/add-objects/index.js +163 -139
- package/cjs/MultiplicityField/add-objects.js.map +7 -0
- package/cjs/MultiplicityField/index.js +145 -115
- package/cjs/MultiplicityField/index.js.map +7 -0
- package/cjs/MultiplicityField/types/index.js +16 -0
- package/cjs/MultiplicityField/types.js.map +7 -0
- package/cjs/Questions/Questions/index.js +80 -65
- package/cjs/Questions/Questions.js.map +7 -0
- package/cjs/Questions/QuestionsContext/index.js +31 -14
- package/cjs/Questions/QuestionsContext.js.map +7 -0
- package/cjs/Questions/Step/ReviewStep/index.js +61 -56
- package/cjs/Questions/Step/ReviewStep.js.map +7 -0
- package/cjs/Questions/Step/Step/index.js +71 -56
- package/cjs/Questions/Step/Step.js.map +7 -0
- package/cjs/Questions/Step/StepArrayReview/index.js +65 -54
- package/cjs/Questions/Step/StepArrayReview.js.map +7 -0
- package/cjs/Questions/Step/StepContext/index.js +37 -24
- package/cjs/Questions/Step/StepContext.js.map +7 -0
- package/cjs/Questions/Step/StepDescription/index.js +55 -31
- package/cjs/Questions/Step/StepDescription.js.map +7 -0
- package/cjs/Questions/Step/StepForm/index.js +65 -52
- package/cjs/Questions/Step/StepForm.js.map +7 -0
- package/cjs/Questions/Step/StepQuote/index.js +42 -15
- package/cjs/Questions/Step/StepQuote.js.map +7 -0
- package/cjs/Questions/Step/StepTitle/index.js +72 -47
- package/cjs/Questions/Step/StepTitle.js.map +7 -0
- package/cjs/Questions/Step/getAddMoreFields/index.js +50 -25
- package/cjs/Questions/Step/getAddMoreFields.js.map +7 -0
- package/cjs/Questions/Step/index.js +59 -143
- package/cjs/Questions/Step/index.js.map +7 -0
- package/cjs/Questions/Step/types/index.js +16 -5
- package/cjs/Questions/Step/types.js.map +7 -0
- package/cjs/Questions/getNextStep/index.js +33 -14
- package/cjs/Questions/getNextStep.js.map +7 -0
- package/cjs/Questions/index.js +29 -19
- package/cjs/Questions/index.js.map +7 -0
- package/cjs/Questions/types/index.js +16 -5
- package/cjs/Questions/types.js.map +7 -0
- package/cjs/hooks/useFieldFocusManager/index.js +135 -0
- package/cjs/hooks/useFieldFocusManager.js.map +7 -0
- package/cjs/hooks/utils/index.js +98 -0
- package/cjs/hooks/utils.js.map +7 -0
- package/cjs/index.js +47 -20
- package/cjs/index.js.map +7 -0
- package/cjs/inputs/AutoCompleteInput/index.js +92 -46
- package/cjs/inputs/AutoCompleteInput/index.js.map +7 -0
- package/cjs/inputs/Checkboxes/index.js +102 -92
- package/cjs/inputs/Checkboxes/index.js.map +7 -0
- package/cjs/inputs/DateInput/index.js +164 -117
- package/cjs/inputs/DateInput/index.js.map +7 -0
- package/cjs/inputs/DateTimeInput/index.js +250 -0
- package/cjs/inputs/DateTimeInput/index.js.map +7 -0
- package/cjs/inputs/FileInput/index.js +115 -65
- package/cjs/inputs/FileInput/index.js.map +7 -0
- package/cjs/inputs/ImageInput/__stories__/logo.d/index.js +1 -0
- package/cjs/inputs/ImageInput/__stories__/logo.d.js.map +7 -0
- package/cjs/inputs/ImageInput/index.js +127 -83
- package/cjs/inputs/ImageInput/index.js.map +7 -0
- package/cjs/inputs/Input/index.js +101 -68
- package/cjs/inputs/Input/index.js.map +7 -0
- package/cjs/inputs/Label/index.js +45 -24
- package/cjs/inputs/Label/index.js.map +7 -0
- package/cjs/inputs/OtpInput/index.js +163 -127
- package/cjs/inputs/OtpInput/index.js.map +7 -0
- package/cjs/inputs/Radio/index.js +132 -61
- package/cjs/inputs/Radio/index.js.map +7 -0
- package/cjs/inputs/Select/index.js +61 -36
- package/cjs/inputs/Select/index.js.map +7 -0
- package/cjs/inputs/index.js +62 -69
- package/cjs/inputs/index.js.map +7 -0
- package/cjs/inputs/registry/index.js +121 -0
- package/cjs/inputs/registry.js.map +7 -0
- package/cjs/internal/index.js +36 -346
- package/cjs/internal.js.map +7 -0
- package/cjs/lazy/index.js +113 -516
- package/cjs/lazy.js.map +7 -0
- package/cjs/registry/index.js +204 -142
- package/cjs/registry.js.map +7 -0
- package/cjs/types/index.js +22 -5
- package/cjs/types.js.map +7 -0
- package/cjs/utils/index.js +93 -83
- package/cjs/utils.js.map +7 -0
- package/cjs/validators/index.js +142 -167
- package/cjs/validators/index.js.map +7 -0
- package/cjs/validators/types/index.js +16 -5
- package/cjs/validators/types.js.map +7 -0
- package/cjs/validators/utils/afm/index.js +38 -21
- package/cjs/validators/utils/afm.js.map +7 -0
- package/cjs/validators/utils/amka/index.js +60 -0
- package/cjs/validators/utils/amka.js.map +7 -0
- package/cjs/validators/utils/date/index.js +161 -0
- package/cjs/validators/utils/date.js.map +7 -0
- package/cjs/validators/utils/datetime/index.js +245 -0
- package/cjs/validators/utils/datetime.js.map +7 -0
- package/cjs/validators/utils/email/index.js +39 -0
- package/cjs/validators/utils/email.js.map +7 -0
- package/cjs/validators/utils/file/index.js +53 -43
- package/cjs/validators/utils/file.js.map +7 -0
- package/cjs/validators/utils/iban/index.js +36 -17
- package/cjs/validators/utils/iban.js.map +7 -0
- package/cjs/validators/utils/image/index.js +88 -112
- package/cjs/validators/utils/image.js.map +7 -0
- package/cjs/validators/utils/index.js +103 -159
- package/cjs/validators/utils/index.js.map +7 -0
- package/cjs/validators/utils/int/index.js +35 -13
- package/cjs/validators/utils/int.js.map +7 -0
- package/cjs/validators/utils/number/index.js +34 -12
- package/cjs/validators/utils/number.js.map +7 -0
- package/cjs/validators/utils/otp/index.js +35 -13
- package/cjs/validators/utils/otp.js.map +7 -0
- package/cjs/validators/utils/phone/index.js +113 -58
- package/cjs/validators/utils/phone.js.map +7 -0
- package/cjs/validators/utils/postal_code/index.js +36 -16
- package/cjs/validators/utils/postal_code.js.map +7 -0
- package/cjs/validators/utils/text_limit/index.js +40 -25
- package/cjs/validators/utils/text_limit.js.map +7 -0
- package/cjs/validators/utils/uuid4/index.js +34 -13
- package/cjs/validators/utils/uuid4.js.map +7 -0
- package/hooks/useFieldFocusManager/index.js +116 -0
- package/hooks/useFieldFocusManager/package.json +6 -0
- package/hooks/useFieldFocusManager.d.ts +25 -0
- package/hooks/useFieldFocusManager.js.map +7 -0
- package/hooks/utils/index.js +73 -0
- package/{Form.stories → hooks/utils}/package.json +1 -1
- package/hooks/utils.d.ts +18 -0
- package/hooks/utils.js.map +7 -0
- package/index.d.ts +4 -1
- package/index.js +13 -4
- package/index.js.map +7 -0
- package/inputs/AutoCompleteInput/AutoComplete.stories.d.ts +4 -1
- package/inputs/AutoCompleteInput/__stories__/Default.d.ts +3 -2
- package/inputs/AutoCompleteInput/__stories__/Multiple.d.ts +3 -0
- package/inputs/AutoCompleteInput/index.d.ts +5 -5
- package/inputs/AutoCompleteInput/index.js +60 -37
- package/inputs/AutoCompleteInput/index.js.map +7 -0
- package/inputs/Checkboxes/Checkboxes.stories.d.ts +5 -3
- package/inputs/Checkboxes/__stories__/Conditional.d.ts +3 -2
- package/inputs/Checkboxes/__stories__/Default.d.ts +2 -2
- package/inputs/Checkboxes/__stories__/WithDivider.d.ts +2 -2
- package/inputs/Checkboxes/index.d.ts +5 -4
- package/inputs/Checkboxes/index.js +73 -82
- package/inputs/Checkboxes/index.js.map +7 -0
- package/inputs/DateInput/DateInput.stories.d.ts +7 -1
- package/inputs/DateInput/__stories__/Default.d.ts +2 -2
- package/inputs/DateInput/__stories__/WithDefaultValue.d.ts +3 -0
- package/inputs/DateInput/__stories__/WithInitialValue.d.ts +3 -0
- package/inputs/DateInput/__stories__/WithWrongDefaultValue.d.ts +3 -0
- package/inputs/DateInput/__stories__/WithWrongInitialValue.d.ts +3 -0
- package/inputs/DateInput/index.d.ts +3 -7
- package/inputs/DateInput/index.js +133 -106
- package/inputs/DateInput/index.js.map +7 -0
- package/inputs/DateTimeInput/DateTimeInput.stories.d.ts +14 -0
- package/inputs/DateTimeInput/__stories__/Default.d.ts +3 -0
- package/inputs/DateTimeInput/__stories__/WithDefaultValue.d.ts +3 -0
- package/inputs/DateTimeInput/__stories__/WithInitialValue.d.ts +3 -0
- package/inputs/DateTimeInput/__stories__/WithWrongDefaultValue.d.ts +3 -0
- package/inputs/DateTimeInput/__stories__/WithWrongInitialValue.d.ts +3 -0
- package/inputs/DateTimeInput/index.d.ts +10 -0
- package/inputs/DateTimeInput/index.js +220 -0
- package/inputs/DateTimeInput/index.js.map +7 -0
- package/inputs/DateTimeInput/package.json +6 -0
- package/inputs/FileInput/FileInput.stories.d.ts +4 -1
- package/inputs/FileInput/__stories__/Default.d.ts +2 -2
- package/inputs/FileInput/__stories__/WithBorderAndLink.d.ts +3 -0
- package/inputs/FileInput/index.d.ts +18 -2
- package/inputs/FileInput/index.js +83 -56
- package/inputs/FileInput/index.js.map +7 -0
- package/inputs/ImageInput/ImageInput.stories.d.ts +6 -3
- package/inputs/ImageInput/__stories__/Default.d.ts +2 -2
- package/inputs/ImageInput/__stories__/MaxSize.d.ts +3 -0
- package/inputs/ImageInput/__stories__/WithInitialValues.d.ts +3 -0
- package/inputs/ImageInput/__stories__/WithInvalidImageDimension.d.ts +2 -2
- package/inputs/ImageInput/__stories__/logo.d/index.js +1 -0
- package/inputs/{FileInput/__stories__/Default → ImageInput/__stories__/logo.d}/package.json +1 -1
- package/inputs/ImageInput/__stories__/logo.d.js.map +7 -0
- package/inputs/ImageInput/index.d.ts +10 -2
- package/inputs/ImageInput/index.js +95 -75
- package/inputs/ImageInput/index.js.map +7 -0
- package/inputs/Input/Input.stories.d.ts +15 -10
- package/inputs/Input/__stories__/AFM.d.ts +2 -2
- package/inputs/Input/__stories__/AMKA.d.ts +3 -0
- package/inputs/Input/__stories__/Boolean.d.ts +2 -2
- package/inputs/Input/__stories__/Email.d.ts +3 -0
- package/inputs/Input/__stories__/IBAN.d.ts +2 -2
- package/inputs/Input/__stories__/Integer.d.ts +2 -2
- package/inputs/Input/__stories__/LandlineNumber.d.ts +2 -2
- package/inputs/Input/__stories__/MobilePhone.d.ts +2 -2
- package/inputs/Input/__stories__/PhoneNumber.d.ts +2 -2
- package/inputs/Input/__stories__/PostalCode.d.ts +2 -2
- package/inputs/Input/__stories__/String.d.ts +3 -0
- package/inputs/Input/__stories__/StringWithTrimValidation.d.ts +3 -0
- package/inputs/Input/__stories__/TextWithLimit.d.ts +3 -0
- package/inputs/Input/index.d.ts +4 -3
- package/inputs/Input/index.js +69 -62
- package/inputs/Input/index.js.map +7 -0
- package/inputs/Label/Label.stories.d.ts +3 -1
- package/inputs/Label/__stories__/Default.d.ts +2 -2
- package/inputs/Label/index.d.ts +2 -4
- package/inputs/Label/index.js +12 -17
- package/inputs/Label/index.js.map +7 -0
- package/inputs/OtpInput/OtpInput.stories.d.ts +3 -1
- package/inputs/OtpInput/__stories__/Default.d.ts +2 -2
- package/inputs/OtpInput/index.d.ts +9 -6
- package/inputs/OtpInput/index.js +129 -117
- package/inputs/OtpInput/index.js.map +7 -0
- package/inputs/Radio/Radio.stories.d.ts +5 -3
- package/inputs/Radio/__stories__/Conditional.d.ts +3 -2
- package/inputs/Radio/__stories__/Default.d.ts +2 -2
- package/inputs/Radio/__stories__/WithDivider.d.ts +2 -2
- package/inputs/Radio/index.d.ts +8 -3
- package/inputs/Radio/index.js +103 -55
- package/inputs/Radio/index.js.map +7 -0
- package/inputs/Select/Select.stories.d.ts +3 -1
- package/inputs/Select/__stories__/Default.d.ts +2 -2
- package/inputs/Select/index.d.ts +5 -4
- package/inputs/Select/index.js +33 -31
- package/inputs/Select/index.js.map +7 -0
- package/inputs/index.js +21 -9
- package/inputs/index.js.map +7 -0
- package/inputs/registry/index.js +86 -0
- package/{Field/utils → inputs/registry}/package.json +1 -1
- package/inputs/registry.d.ts +5 -0
- package/inputs/registry.js.map +7 -0
- package/internal/index.js +10 -34
- package/internal.d.ts +2 -31
- package/internal.js.map +7 -0
- package/lazy/index.js +79 -393
- package/package.json +8 -9
- package/registry/index.js +140 -99
- package/src/Field/ErrorGroup.tsx +84 -0
- package/src/Field/FieldBase.tsx +41 -24
- package/src/Field/FieldBaseContainer.tsx +71 -47
- package/src/Field/FieldConditional.tsx +10 -2
- package/src/Field/doc.mdx +207 -0
- package/src/Field/index.tsx +37 -23
- package/src/Field/types.tsx +89 -13
- package/src/Field/utils/evaluateFieldWithConditions.ts +33 -0
- package/src/Field/utils/resolveField.ts +58 -0
- package/src/Field/utils/useField.ts +68 -0
- package/src/FieldArray/BaseFieldArray.tsx +97 -0
- package/src/FieldArray/FieldArray.stories.js +4 -2
- package/src/FieldArray/FormDialog/ArrayDisplay/ArrayContainerDisplay.tsx +45 -0
- package/src/FieldArray/FormDialog/ArrayDisplay/ArrayDisplay.stories.js +14 -0
- package/src/FieldArray/FormDialog/ArrayDisplay/ArrayItemDisplay.tsx +335 -0
- package/src/FieldArray/FormDialog/ArrayDisplay/ArrayItemHeader.tsx +15 -0
- package/src/FieldArray/FormDialog/ArrayDisplay/__stories__/Cards.tsx +88 -0
- package/src/FieldArray/FormDialog/ArrayDisplay/__stories__/Default.tsx +93 -0
- package/src/FieldArray/FormDialog/ArrayDisplay/__stories__/ReadOnly.tsx +79 -0
- package/src/FieldArray/FormDialog/ArrayDisplay/__stories__/ReadOnlyCards.tsx +75 -0
- package/src/FieldArray/FormDialog/ArrayDisplay/__stories__/Sortable.tsx +93 -0
- package/src/FieldArray/FormDialog/ArrayDisplay/__stories__/SortableCards.tsx +88 -0
- package/src/FieldArray/FormDialog/ArrayDisplay/index.test.tsx +44 -0
- package/src/FieldArray/FormDialog/ArrayDisplay/index.tsx +67 -0
- package/src/FieldArray/FormDialog/ArrayEditModal.tsx +243 -0
- package/src/FieldArray/FormDialog/index.tsx +304 -0
- package/src/FieldArray/__stories__/CardsWithError.tsx +124 -0
- package/src/FieldArray/__stories__/Default.tsx +2 -1
- package/src/FieldArray/__stories__/WithExactLength.tsx +2 -1
- package/src/FieldArray/__stories__/WithModal.tsx +160 -0
- package/src/FieldArray/__tests__/fieldset-multiplicity.spec.tsx +271 -0
- package/src/FieldArray/__tests__/multiplicity-attachment.spec.tsx +280 -0
- package/src/FieldArray/__tests__/multiplicity-optional.spec.tsx +232 -0
- package/src/FieldArray/__tests__/multiplicity-required.spec.tsx +170 -0
- package/src/FieldArray/__tests__/nested-fieldset-multiplicity.spec.tsx +627 -0
- package/src/FieldArray/__tests__/preference-multiple-choice.spec.tsx +222 -0
- package/src/FieldArray/index.spec.tsx +355 -0
- package/src/FieldArray/index.test.tsx +36 -0
- package/src/FieldArray/index.tsx +84 -55
- package/src/FieldObject/index.tsx +53 -27
- package/src/Fieldset/FieldsetWithContext.tsx +1 -1
- package/src/Fieldset/index.tsx +6 -6
- package/src/Fieldset/types.tsx +5 -3
- package/src/FormBuilder/FormBuilder.stories.js +6 -1
- package/src/FormBuilder/__stories__/AutoErrorGrouping.tsx +63 -0
- package/src/FormBuilder/__stories__/Default.tsx +1 -1
- package/src/FormBuilder/__stories__/ErrorGrouping.tsx +43 -0
- package/src/FormBuilder/{FormBuilder.mdx → doc.mdx} +27 -35
- package/src/FormBuilder/index.test.tsx +32 -0
- package/src/FormBuilder/index.tsx +314 -1
- package/src/FormBuilder/interaction.test.tsx +40 -0
- package/src/FormBuilder/scenarios.test.tsx +2737 -0
- package/src/FormContext.tsx +7 -3
- package/src/MultiplicityField/MultiplicityField.stories.js +9 -6
- package/src/MultiplicityField/__stories__/Default.tsx +1 -1
- package/src/MultiplicityField/__stories__/PreviewDisplay.tsx +3 -3
- package/src/MultiplicityField/__stories__/WithExactLength.tsx +2 -2
- package/src/MultiplicityField/__stories__/WithMaxLength.tsx +2 -2
- package/src/MultiplicityField/__stories__/WithMinAndMaxLength.tsx +2 -2
- package/src/MultiplicityField/__stories__/WithMinLength.tsx +2 -2
- package/src/MultiplicityField/add-objects.tsx +39 -30
- package/{cjs/MultiplicityField/MultiplicityField.mdx → src/MultiplicityField/doc.mdx} +112 -98
- package/src/MultiplicityField/index.test.tsx +44 -0
- package/src/MultiplicityField/index.tsx +25 -34
- package/src/MultiplicityField/types.ts +25 -0
- package/src/Questions/Questions.stories.js +4 -1
- package/src/Questions/Questions.tsx +6 -6
- package/src/Questions/QuestionsContext.tsx +1 -1
- package/src/Questions/Step/Step.tsx +1 -1
- package/src/Questions/Step/StepArrayReview.tsx +3 -3
- package/src/Questions/Step/StepContext.tsx +1 -1
- package/src/Questions/Step/StepDescription.tsx +2 -1
- package/src/Questions/Step/StepForm.tsx +2 -2
- package/src/Questions/Step/StepQuote.tsx +2 -1
- package/src/Questions/Step/StepTitle.tsx +6 -3
- package/src/Questions/Step/getAddMoreFields.tsx +2 -2
- package/src/Questions/Step/index.ts +0 -1
- package/src/Questions/Step/types.tsx +2 -1
- package/src/Questions/__snapshots__/index.spec.tsx.snap +74 -587
- package/src/Questions/__stories__/Default.tsx +1 -1
- package/src/Questions/{index.mdx → doc.mdx} +34 -57
- package/src/Questions/getNextStep.tsx +1 -1
- package/src/Questions/index.spec.tsx +17 -5
- package/src/Questions/index.test.tsx +24 -0
- package/src/Questions/types.tsx +2 -1
- package/src/create-simple-form.mdx +2 -6
- package/{index.mdx → src/doc.mdx} +29 -18
- package/src/hooks/__tests__/useFieldFocusManager.spec.tsx +1079 -0
- package/src/hooks/__tests__/utils.spec.ts +568 -0
- package/src/hooks/useFieldFocusManager.ts +162 -0
- package/src/hooks/utils.ts +122 -0
- package/src/index.ts +4 -1
- package/src/inputs/AutoCompleteInput/AutoComplete.stories.js +5 -1
- package/src/inputs/AutoCompleteInput/__stories__/Default.tsx +20 -19
- package/src/inputs/AutoCompleteInput/__stories__/Multiple.tsx +47 -0
- package/src/inputs/AutoCompleteInput/doc.mdx +18 -0
- package/src/inputs/AutoCompleteInput/index.test.tsx +28 -0
- package/src/inputs/AutoCompleteInput/index.tsx +48 -33
- package/src/inputs/Checkboxes/Checkboxes.stories.js +6 -3
- package/src/inputs/Checkboxes/__stories__/Conditional.tsx +3 -4
- package/src/inputs/Checkboxes/__stories__/Default.tsx +1 -1
- package/src/inputs/Checkboxes/__stories__/WithDivider.tsx +1 -1
- package/src/inputs/Checkboxes/doc.mdx +23 -0
- package/src/inputs/Checkboxes/index.test.tsx +32 -0
- package/src/inputs/Checkboxes/index.tsx +103 -92
- package/src/inputs/DateInput/DateInput.stories.js +8 -1
- package/src/inputs/DateInput/__stories__/Default.tsx +17 -16
- package/src/inputs/DateInput/__stories__/WithDefaultValue.tsx +26 -0
- package/src/inputs/DateInput/__stories__/WithInitialValue.tsx +28 -0
- package/src/inputs/DateInput/__stories__/WithWrongDefaultValue.tsx +26 -0
- package/src/inputs/DateInput/__stories__/WithWrongInitialValue.tsx +28 -0
- package/src/inputs/DateInput/doc.mdx +16 -0
- package/src/inputs/DateInput/index.test.tsx +40 -0
- package/src/inputs/DateInput/index.tsx +77 -27
- package/src/inputs/DateTimeInput/DateTimeInput.stories.js +14 -0
- package/src/inputs/DateTimeInput/__stories__/Default.tsx +25 -0
- package/src/inputs/DateTimeInput/__stories__/WithDefaultValue.tsx +26 -0
- package/src/inputs/DateTimeInput/__stories__/WithInitialValue.tsx +28 -0
- package/src/inputs/DateTimeInput/__stories__/WithWrongDefaultValue.tsx +26 -0
- package/src/inputs/DateTimeInput/__stories__/WithWrongInitialValue.tsx +28 -0
- package/src/inputs/DateTimeInput/doc.mdx +16 -0
- package/src/inputs/DateTimeInput/index.test.tsx +40 -0
- package/src/inputs/DateTimeInput/index.tsx +246 -0
- package/src/inputs/FileInput/FileInput.stories.js +5 -1
- package/src/inputs/FileInput/__stories__/Default.tsx +1 -1
- package/src/inputs/FileInput/__stories__/WithBorderAndLink.tsx +34 -0
- package/src/inputs/FileInput/doc.mdx +15 -0
- package/src/inputs/FileInput/index.test.tsx +28 -0
- package/src/inputs/FileInput/index.tsx +109 -42
- package/src/inputs/ImageInput/ImageInput.stories.js +7 -3
- package/src/inputs/ImageInput/__stories__/Default.tsx +1 -1
- package/src/inputs/ImageInput/__stories__/{WithInvalidImageSize.tsx → MaxSize.tsx} +5 -3
- package/src/inputs/ImageInput/__stories__/WithInitialValues.tsx +45 -0
- package/src/inputs/ImageInput/__stories__/WithInvalidImageDimension.tsx +3 -1
- package/src/inputs/ImageInput/__stories__/logo.d.ts +4 -0
- package/src/inputs/ImageInput/__stories__/logo.png +0 -0
- package/src/inputs/ImageInput/doc.mdx +23 -0
- package/src/inputs/ImageInput/index.test.tsx +36 -0
- package/src/inputs/ImageInput/index.tsx +104 -51
- package/src/inputs/Input/Input.stories.js +16 -10
- package/src/inputs/Input/__stories__/AFM.tsx +1 -1
- package/src/inputs/Input/__stories__/AMKA.tsx +23 -0
- package/src/inputs/Input/__stories__/Boolean.tsx +1 -1
- package/src/inputs/Input/__stories__/Email.tsx +23 -0
- package/src/inputs/Input/__stories__/IBAN.tsx +1 -1
- package/src/inputs/Input/__stories__/Integer.tsx +1 -1
- package/src/inputs/Input/__stories__/LandlineNumber.tsx +3 -2
- package/src/inputs/Input/__stories__/MobilePhone.tsx +2 -1
- package/src/inputs/Input/__stories__/PhoneNumber.tsx +2 -1
- package/src/inputs/Input/__stories__/PostalCode.tsx +2 -1
- package/src/inputs/Input/__stories__/{Default.tsx → String.tsx} +2 -2
- package/src/inputs/Input/__stories__/StringWithTrimValidation.tsx +26 -0
- package/src/inputs/Input/__stories__/{TextWithCharacterLimit.tsx → TextWithLimit.tsx} +3 -2
- package/src/inputs/Input/doc.mdx +56 -0
- package/src/inputs/Input/index.test.tsx +72 -0
- package/src/inputs/Input/index.tsx +87 -73
- package/src/inputs/Label/Label.stories.js +4 -1
- package/src/inputs/Label/__stories__/Default.tsx +4 -2
- package/src/inputs/Label/doc.mdx +14 -0
- package/src/inputs/Label/index.test.tsx +24 -0
- package/src/inputs/Label/index.tsx +4 -11
- package/src/inputs/OtpInput/OtpInput.stories.js +4 -1
- package/src/inputs/OtpInput/__stories__/Default.tsx +1 -1
- package/src/inputs/OtpInput/doc.mdx +16 -0
- package/src/inputs/OtpInput/index.test.tsx +24 -0
- package/src/inputs/OtpInput/index.tsx +46 -35
- package/src/inputs/Radio/Radio.stories.js +6 -3
- package/src/inputs/Radio/__stories__/Conditional.tsx +5 -2
- package/src/inputs/Radio/__stories__/Default.tsx +1 -1
- package/src/inputs/Radio/__stories__/WithDivider.tsx +1 -1
- package/src/inputs/Radio/doc.mdx +23 -0
- package/src/inputs/Radio/index.test.tsx +32 -0
- package/src/inputs/Radio/index.tsx +90 -12
- package/src/inputs/Select/Select.stories.js +4 -1
- package/src/inputs/Select/__stories__/Default.tsx +1 -1
- package/src/inputs/Select/doc.mdx +13 -0
- package/src/inputs/Select/index.test.tsx +24 -0
- package/src/inputs/Select/index.tsx +20 -9
- package/src/inputs/registry.ts +86 -0
- package/src/installation.mdx +2 -5
- package/src/internal.ts +2 -31
- package/src/lazy.js +80 -59
- package/src/registry.js +123 -89
- package/src/types.tsx +21 -65
- package/src/utils.ts +58 -35
- package/src/validators/index.ts +120 -99
- package/src/validators/types.ts +1 -1
- package/src/validators/utils/amka.ts +39 -0
- package/src/validators/utils/date.ts +131 -0
- package/src/validators/utils/datetime.ts +222 -0
- package/src/validators/utils/email.ts +11 -0
- package/src/validators/utils/file.ts +36 -20
- package/src/validators/utils/iban.ts +2 -2
- package/src/validators/utils/image.ts +2 -2
- package/src/validators/utils/index.ts +8 -3
- package/src/validators/utils/int.ts +2 -2
- package/src/validators/utils/number.ts +2 -2
- package/src/validators/utils/otp.ts +2 -2
- package/src/validators/utils/phone.ts +65 -74
- package/src/validators/utils/postal_code.ts +3 -3
- package/src/validators/utils/text_limit.ts +2 -2
- package/src/validators/utils/uuid4.ts +2 -1
- package/src/validators/validators.spec.ts +6 -40
- package/types/index.js +2 -1
- package/types.d.ts +14 -37
- package/types.js.map +7 -0
- package/utils/index.js +71 -77
- package/utils.d.ts +3 -1
- package/utils.js.map +7 -0
- package/validators/index.d.ts +6 -6
- package/validators/index.js +124 -153
- package/validators/index.js.map +7 -0
- package/validators/types/index.js +1 -1
- package/validators/types.d.ts +1 -1
- package/validators/types.js.map +7 -0
- package/validators/utils/afm/index.js +16 -16
- package/validators/utils/afm.js.map +7 -0
- package/validators/utils/amka/index.js +36 -0
- package/validators/utils/amka/package.json +6 -0
- package/validators/utils/amka.d.ts +6 -0
- package/validators/utils/amka.js.map +7 -0
- package/validators/utils/date/index.js +126 -0
- package/validators/utils/date/package.json +6 -0
- package/validators/utils/date.d.ts +9 -0
- package/validators/utils/date.js.map +7 -0
- package/validators/utils/datetime/index.js +210 -0
- package/validators/utils/datetime/package.json +6 -0
- package/validators/utils/datetime.d.ts +9 -0
- package/validators/utils/datetime.js.map +7 -0
- package/validators/utils/email/index.js +16 -0
- package/validators/utils/email/package.json +6 -0
- package/validators/utils/email.d.ts +5 -0
- package/validators/utils/email.js.map +7 -0
- package/validators/utils/file/index.js +31 -38
- package/validators/utils/file.d.ts +2 -2
- package/validators/utils/file.js.map +7 -0
- package/validators/utils/iban/index.js +14 -12
- package/validators/utils/iban.d.ts +2 -2
- package/validators/utils/iban.js.map +7 -0
- package/validators/utils/image/index.js +66 -106
- package/validators/utils/image.d.ts +2 -2
- package/validators/utils/image.js.map +7 -0
- package/validators/utils/index.d.ts +5 -2
- package/validators/utils/index.js +59 -48
- package/validators/utils/index.js.map +7 -0
- package/validators/utils/int/index.js +13 -8
- package/validators/utils/int.d.ts +1 -1
- package/validators/utils/int.js.map +7 -0
- package/validators/utils/number/index.js +12 -7
- package/validators/utils/number.d.ts +1 -1
- package/validators/utils/number.js.map +7 -0
- package/validators/utils/otp/index.js +13 -8
- package/validators/utils/otp.d.ts +2 -2
- package/validators/utils/otp.js.map +7 -0
- package/validators/utils/phone/index.js +89 -51
- package/validators/utils/phone.d.ts +3 -3
- package/validators/utils/phone.js.map +7 -0
- package/validators/utils/postal_code/index.js +14 -11
- package/validators/utils/postal_code.d.ts +3 -3
- package/validators/utils/postal_code.js.map +7 -0
- package/validators/utils/text_limit/index.js +18 -20
- package/validators/utils/text_limit.d.ts +2 -2
- package/validators/utils/text_limit.js.map +7 -0
- package/validators/utils/uuid4/index.js +12 -8
- package/validators/utils/uuid4.js.map +7 -0
- package/Field/index.mdx +0 -6
- package/Field/utils/index.js +0 -153
- package/Field/utils.d.ts +0 -5
- package/FieldArray/FieldArray.stories/index.js +0 -8
- package/FieldArray/FieldArray.stories/package.json +0 -6
- package/FieldArray/FieldArray.stories.playwright.json +0 -353
- package/FieldArray/__stories__/Default/index.js +0 -88
- package/FieldArray/__stories__/Default/package.json +0 -6
- package/FieldArray/__stories__/WithExactLength/index.js +0 -88
- package/FieldArray/__stories__/WithExactLength/package.json +0 -6
- package/Form.stories/index.js +0 -3
- package/FormBuilder/FormBuilder/index.js +0 -152
- package/FormBuilder/FormBuilder.d.ts +0 -5
- package/FormBuilder/FormBuilder.mdx +0 -256
- package/FormBuilder/FormBuilder.stories/index.js +0 -7
- package/FormBuilder/FormBuilder.stories/package.json +0 -6
- package/FormBuilder/FormBuilder.stories.playwright.json +0 -52
- package/FormBuilder/__stories__/Default/index.js +0 -26
- package/FormBuilder/__stories__/Default/package.json +0 -6
- package/MultiplicityField/MultiplicityField.mdx +0 -590
- package/MultiplicityField/MultiplicityField.stories/index.js +0 -12
- package/MultiplicityField/MultiplicityField.stories/package.json +0 -6
- package/MultiplicityField/MultiplicityField.stories.playwright.json +0 -1370
- package/MultiplicityField/__stories__/Default/index.js +0 -95
- package/MultiplicityField/__stories__/Default/package.json +0 -6
- package/MultiplicityField/__stories__/PreviewDisplay/index.js +0 -72
- package/MultiplicityField/__stories__/PreviewDisplay/package.json +0 -6
- package/MultiplicityField/__stories__/WithExactLength/index.js +0 -90
- package/MultiplicityField/__stories__/WithExactLength/package.json +0 -6
- package/MultiplicityField/__stories__/WithMaxLength/index.js +0 -93
- package/MultiplicityField/__stories__/WithMaxLength/package.json +0 -6
- package/MultiplicityField/__stories__/WithMinAndMaxLength/index.js +0 -94
- package/MultiplicityField/__stories__/WithMinAndMaxLength/package.json +0 -6
- package/MultiplicityField/__stories__/WithMinLength/index.js +0 -93
- package/MultiplicityField/__stories__/WithMinLength/package.json +0 -6
- package/Questions/Questions.stories/index.js +0 -7
- package/Questions/__snapshots__/index.spec.tsx.snap +0 -596
- package/Questions/__stories__/Default/index.js +0 -102
- package/Questions/__stories__/Default/package.json +0 -6
- package/Questions/index.mdx +0 -415
- package/Questions/index.spec/index.js +0 -59
- package/cjs/Field/index.mdx +0 -6
- package/cjs/Field/utils/index.js +0 -167
- package/cjs/FieldArray/FieldArray.stories/index.js +0 -38
- package/cjs/FieldArray/FieldArray.stories.playwright.json +0 -353
- package/cjs/FieldArray/__stories__/Default/index.js +0 -98
- package/cjs/FieldArray/__stories__/WithExactLength/index.js +0 -98
- package/cjs/Form.stories/index.js +0 -9
- package/cjs/FormBuilder/FormBuilder/index.js +0 -162
- package/cjs/FormBuilder/FormBuilder.mdx +0 -256
- package/cjs/FormBuilder/FormBuilder.stories/index.js +0 -26
- package/cjs/FormBuilder/FormBuilder.stories.playwright.json +0 -52
- package/cjs/FormBuilder/__stories__/Default/index.js +0 -36
- package/cjs/MultiplicityField/MultiplicityField.stories/index.js +0 -86
- package/cjs/MultiplicityField/MultiplicityField.stories.playwright.json +0 -1370
- package/cjs/MultiplicityField/__stories__/Default/index.js +0 -105
- package/cjs/MultiplicityField/__stories__/PreviewDisplay/index.js +0 -82
- package/cjs/MultiplicityField/__stories__/WithExactLength/index.js +0 -100
- package/cjs/MultiplicityField/__stories__/WithMaxLength/index.js +0 -103
- package/cjs/MultiplicityField/__stories__/WithMinAndMaxLength/index.js +0 -104
- package/cjs/MultiplicityField/__stories__/WithMinLength/index.js +0 -103
- package/cjs/Questions/Questions.stories/index.js +0 -26
- package/cjs/Questions/__snapshots__/index.spec.tsx.snap +0 -596
- package/cjs/Questions/__stories__/Default/index.js +0 -113
- package/cjs/Questions/index.mdx +0 -415
- package/cjs/Questions/index.spec/index.js +0 -63
- package/cjs/create-simple-form.mdx +0 -539
- package/cjs/index.mdx +0 -51
- package/cjs/inputs/AutoCompleteInput/AutoComplete.stories/index.js +0 -26
- package/cjs/inputs/AutoCompleteInput/__stories__/Default/index.js +0 -56
- package/cjs/inputs/Checkboxes/Checkboxes.stories/index.js +0 -50
- package/cjs/inputs/Checkboxes/Checkboxes.stories.playwright.json +0 -85
- package/cjs/inputs/Checkboxes/__stories__/Conditional/index.js +0 -102
- package/cjs/inputs/Checkboxes/__stories__/Default/index.js +0 -50
- package/cjs/inputs/Checkboxes/__stories__/WithDivider/index.js +0 -51
- package/cjs/inputs/Checkboxes/index.mdx +0 -0
- package/cjs/inputs/DateInput/DateInput.stories/index.js +0 -26
- package/cjs/inputs/DateInput/DateInput.stories.playwright.json +0 -72
- package/cjs/inputs/DateInput/__stories__/Default/index.js +0 -33
- package/cjs/inputs/FileInput/FileInput.stories/index.js +0 -26
- package/cjs/inputs/FileInput/FileInput.stories.playwright.json +0 -75
- package/cjs/inputs/FileInput/__stories__/Default/index.js +0 -30
- package/cjs/inputs/ImageInput/ImageInput.stories/index.js +0 -50
- package/cjs/inputs/ImageInput/ImageInput.stories.playwright.json +0 -77
- package/cjs/inputs/ImageInput/__stories__/Default/index.js +0 -38
- package/cjs/inputs/ImageInput/__stories__/WithInvalidImageDimension/index.js +0 -46
- package/cjs/inputs/ImageInput/__stories__/WithInvalidImageSize/index.js +0 -43
- package/cjs/inputs/Input/Input.stories/index.js +0 -134
- package/cjs/inputs/Input/Input.stories.playwright.json +0 -376
- package/cjs/inputs/Input/__stories__/AFM/index.js +0 -32
- package/cjs/inputs/Input/__stories__/Boolean/index.js +0 -33
- package/cjs/inputs/Input/__stories__/Default/index.js +0 -33
- package/cjs/inputs/Input/__stories__/IBAN/index.js +0 -33
- package/cjs/inputs/Input/__stories__/Integer/index.js +0 -41
- package/cjs/inputs/Input/__stories__/LandlineNumber/index.js +0 -36
- package/cjs/inputs/Input/__stories__/MobilePhone/index.js +0 -36
- package/cjs/inputs/Input/__stories__/PhoneNumber/index.js +0 -35
- package/cjs/inputs/Input/__stories__/PostalCode/index.js +0 -35
- package/cjs/inputs/Input/__stories__/TextWithCharacterLimit/index.js +0 -39
- package/cjs/inputs/Input/index.mdx +0 -8
- package/cjs/inputs/Label/Label.stories/index.js +0 -26
- package/cjs/inputs/Label/Label.stories.playwright.json +0 -40
- package/cjs/inputs/Label/__stories__/Default/index.js +0 -37
- package/cjs/inputs/Label/index.mdx +0 -0
- package/cjs/inputs/OtpInput/OtpInput.stories/index.js +0 -26
- package/cjs/inputs/OtpInput/__stories__/Default/index.js +0 -39
- package/cjs/inputs/Radio/Radio.stories/index.js +0 -50
- package/cjs/inputs/Radio/Radio.stories.playwright.json +0 -73
- package/cjs/inputs/Radio/__stories__/Conditional/index.js +0 -102
- package/cjs/inputs/Radio/__stories__/Default/index.js +0 -55
- package/cjs/inputs/Radio/__stories__/WithDivider/index.js +0 -56
- package/cjs/inputs/Radio/index.mdx +0 -0
- package/cjs/inputs/Select/Select.stories/index.js +0 -26
- package/cjs/inputs/Select/Select.stories.playwright.json +0 -22
- package/cjs/inputs/Select/__stories__/Default/index.js +0 -61
- package/cjs/installation.mdx +0 -68
- package/cjs/validators/validators.spec/index.js +0 -87
- package/create-simple-form.mdx +0 -539
- package/inputs/AutoCompleteInput/AutoComplete.stories/index.js +0 -7
- package/inputs/AutoCompleteInput/AutoComplete.stories/package.json +0 -6
- package/inputs/AutoCompleteInput/__stories__/Default/index.js +0 -46
- package/inputs/AutoCompleteInput/__stories__/Default/package.json +0 -6
- package/inputs/Checkboxes/Checkboxes.stories/index.js +0 -9
- package/inputs/Checkboxes/Checkboxes.stories.playwright.json +0 -85
- package/inputs/Checkboxes/__stories__/Conditional/index.js +0 -92
- package/inputs/Checkboxes/__stories__/Conditional/package.json +0 -6
- package/inputs/Checkboxes/__stories__/Default/index.js +0 -40
- package/inputs/Checkboxes/__stories__/Default/package.json +0 -6
- package/inputs/Checkboxes/__stories__/WithDivider/index.js +0 -41
- package/inputs/Checkboxes/__stories__/WithDivider/package.json +0 -6
- package/inputs/Checkboxes/index.mdx +0 -0
- package/inputs/DateInput/DateInput.stories/index.js +0 -7
- package/inputs/DateInput/DateInput.stories.playwright.json +0 -72
- package/inputs/DateInput/__stories__/Default/index.js +0 -23
- package/inputs/FileInput/FileInput.stories/index.js +0 -7
- package/inputs/FileInput/FileInput.stories/package.json +0 -6
- package/inputs/FileInput/FileInput.stories.playwright.json +0 -75
- package/inputs/FileInput/__stories__/Default/index.js +0 -20
- package/inputs/ImageInput/ImageInput.stories/index.js +0 -9
- package/inputs/ImageInput/ImageInput.stories/package.json +0 -6
- package/inputs/ImageInput/ImageInput.stories.playwright.json +0 -77
- package/inputs/ImageInput/__stories__/Default/index.js +0 -28
- package/inputs/ImageInput/__stories__/Default/package.json +0 -6
- package/inputs/ImageInput/__stories__/WithInvalidImageDimension/index.js +0 -36
- package/inputs/ImageInput/__stories__/WithInvalidImageDimension/package.json +0 -6
- package/inputs/ImageInput/__stories__/WithInvalidImageSize/index.js +0 -33
- package/inputs/ImageInput/__stories__/WithInvalidImageSize/package.json +0 -6
- package/inputs/ImageInput/__stories__/WithInvalidImageSize.d.ts +0 -3
- package/inputs/Input/Input.stories/index.js +0 -16
- package/inputs/Input/Input.stories/package.json +0 -6
- package/inputs/Input/Input.stories.playwright.json +0 -376
- package/inputs/Input/__stories__/AFM/index.js +0 -22
- package/inputs/Input/__stories__/AFM/package.json +0 -6
- package/inputs/Input/__stories__/Boolean/index.js +0 -23
- package/inputs/Input/__stories__/Boolean/package.json +0 -6
- package/inputs/Input/__stories__/Default/index.js +0 -23
- package/inputs/Input/__stories__/Default/package.json +0 -6
- package/inputs/Input/__stories__/Default.d.ts +0 -3
- package/inputs/Input/__stories__/IBAN/index.js +0 -23
- package/inputs/Input/__stories__/IBAN/package.json +0 -6
- package/inputs/Input/__stories__/Integer/index.js +0 -31
- package/inputs/Input/__stories__/Integer/package.json +0 -6
- package/inputs/Input/__stories__/LandlineNumber/index.js +0 -26
- package/inputs/Input/__stories__/LandlineNumber/package.json +0 -6
- package/inputs/Input/__stories__/MobilePhone/index.js +0 -26
- package/inputs/Input/__stories__/MobilePhone/package.json +0 -6
- package/inputs/Input/__stories__/PhoneNumber/index.js +0 -25
- package/inputs/Input/__stories__/PhoneNumber/package.json +0 -6
- package/inputs/Input/__stories__/PostalCode/index.js +0 -25
- package/inputs/Input/__stories__/PostalCode/package.json +0 -6
- package/inputs/Input/__stories__/TextWithCharacterLimit/index.js +0 -29
- package/inputs/Input/__stories__/TextWithCharacterLimit/package.json +0 -6
- package/inputs/Input/__stories__/TextWithCharacterLimit.d.ts +0 -3
- package/inputs/Input/index.mdx +0 -8
- package/inputs/Label/Label.stories/index.js +0 -7
- package/inputs/Label/Label.stories/package.json +0 -6
- package/inputs/Label/Label.stories.playwright.json +0 -40
- package/inputs/Label/__stories__/Default/index.js +0 -27
- package/inputs/Label/__stories__/Default/package.json +0 -6
- package/inputs/Label/index.mdx +0 -0
- package/inputs/OtpInput/OtpInput.stories/index.js +0 -7
- package/inputs/OtpInput/OtpInput.stories/package.json +0 -6
- package/inputs/OtpInput/__stories__/Default/index.js +0 -29
- package/inputs/OtpInput/__stories__/Default/package.json +0 -6
- package/inputs/Radio/Radio.stories/index.js +0 -9
- package/inputs/Radio/Radio.stories/package.json +0 -6
- package/inputs/Radio/Radio.stories.playwright.json +0 -73
- package/inputs/Radio/__stories__/Conditional/index.js +0 -92
- package/inputs/Radio/__stories__/Conditional/package.json +0 -6
- package/inputs/Radio/__stories__/Default/index.js +0 -45
- package/inputs/Radio/__stories__/Default/package.json +0 -6
- package/inputs/Radio/__stories__/WithDivider/index.js +0 -46
- package/inputs/Radio/__stories__/WithDivider/package.json +0 -6
- package/inputs/Radio/index.mdx +0 -0
- package/inputs/Select/Select.stories/index.js +0 -7
- package/inputs/Select/Select.stories/package.json +0 -6
- package/inputs/Select/Select.stories.playwright.json +0 -22
- package/inputs/Select/__stories__/Default/index.js +0 -51
- package/inputs/Select/__stories__/Default/package.json +0 -6
- package/installation.mdx +0 -68
- package/lazy.d.ts +0 -69
- package/registry.d.ts +0 -64
- package/src/Field/index.mdx +0 -6
- package/src/Field/utils.ts +0 -191
- package/src/FieldArray/FieldArray.stories.playwright.json +0 -353
- package/src/FormBuilder/FormBuilder.stories.playwright.json +0 -52
- package/src/FormBuilder/FormBuilder.tsx +0 -166
- package/src/MultiplicityField/MultiplicityField.mdx +0 -590
- package/src/MultiplicityField/MultiplicityField.stories.playwright.json +0 -1370
- package/src/index.mdx +0 -51
- package/src/inputs/Checkboxes/Checkboxes.stories.playwright.json +0 -85
- package/src/inputs/Checkboxes/index.mdx +0 -0
- package/src/inputs/DateInput/DateInput.stories.playwright.json +0 -72
- package/src/inputs/FileInput/FileInput.stories.playwright.json +0 -75
- package/src/inputs/ImageInput/ImageInput.stories.playwright.json +0 -77
- package/src/inputs/Input/Input.stories.playwright.json +0 -376
- package/src/inputs/Input/index.mdx +0 -8
- package/src/inputs/Label/Label.stories.playwright.json +0 -40
- package/src/inputs/Label/index.mdx +0 -0
- package/src/inputs/Radio/Radio.stories.playwright.json +0 -73
- package/src/inputs/Radio/index.mdx +0 -0
- package/src/inputs/Select/Select.stories.playwright.json +0 -22
- package/validators/validators.spec/index.js +0 -85
- package/validators/validators.spec/package.json +0 -6
- /package/{Questions/index.spec.d.ts → hooks/__tests__/utils.spec.d.ts} +0 -0
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const PhoneNumber: () => JSX.Element;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare const PhoneNumber: (_: any) => React.JSX.Element;
|
|
3
3
|
export default PhoneNumber;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const PostalCode: () => JSX.Element;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare const PostalCode: (_: any) => React.JSX.Element;
|
|
3
3
|
export default PostalCode;
|
package/inputs/Input/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { UncontrolledFieldProps } from '@digigov/form/Field/types';
|
|
3
|
-
export interface InputProps extends Omit<UncontrolledFieldProps, 'extra'> {
|
|
2
|
+
import type { UncontrolledFieldProps } from '@digigov/form/Field/types';
|
|
3
|
+
export interface InputProps extends Omit<UncontrolledFieldProps, 'extra' | 'Field'> {
|
|
4
4
|
extra?: {
|
|
5
5
|
fullWidth?: boolean;
|
|
6
6
|
multiline?: boolean;
|
|
@@ -11,6 +11,7 @@ export interface InputProps extends Omit<UncontrolledFieldProps, 'extra'> {
|
|
|
11
11
|
max?: number;
|
|
12
12
|
};
|
|
13
13
|
};
|
|
14
|
+
Field?: UncontrolledFieldProps['Field'];
|
|
14
15
|
}
|
|
15
|
-
export declare const Input: React.
|
|
16
|
+
export declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement | HTMLTextAreaElement>>;
|
|
16
17
|
export default Input;
|
package/inputs/Input/index.js
CHANGED
|
@@ -1,69 +1,76 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import { Hint } from
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"
|
|
13
|
-
text: 'text',
|
|
14
|
-
date: 'date'
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { useWatch } from "react-hook-form";
|
|
3
|
+
import { TextArea } from "@digigov/ui/form/TextArea";
|
|
4
|
+
import { TextInput } from "@digigov/ui/form/TextInput";
|
|
5
|
+
import { useTranslation } from "@digigov/ui/i18n";
|
|
6
|
+
import { Hint } from "@digigov/ui/typography/Hint";
|
|
7
|
+
const TYPES_MAP = {
|
|
8
|
+
string: "text",
|
|
9
|
+
password: "password",
|
|
10
|
+
int: "text",
|
|
11
|
+
text: "text",
|
|
12
|
+
date: "date"
|
|
15
13
|
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
22
|
-
// eslint-disable-next-line prefer-const
|
|
23
|
-
var _ref2 = extra || {},
|
|
24
|
-
_ref2$multiline = _ref2.multiline,
|
|
25
|
-
multiline = _ref2$multiline === void 0 ? false : _ref2$multiline,
|
|
26
|
-
rows = _ref2.rows,
|
|
27
|
-
limit = _ref2.limit;
|
|
28
|
-
var _ref3 = extra || {},
|
|
29
|
-
className = _ref3.className;
|
|
30
|
-
// if enforced to multiline use true. Derive from type otherwise.
|
|
31
|
-
multiline = multiline === true || type === 'text';
|
|
32
|
-
// use explicit rows value if set. Derive from multiline otherwise.
|
|
14
|
+
const Input = React.forwardRef(function WrappedInput({ name, control, type, extra, ...props }, ref) {
|
|
15
|
+
delete props["Field"];
|
|
16
|
+
let { multiline = false, rows, limit } = extra || {};
|
|
17
|
+
const { className } = extra || {};
|
|
18
|
+
multiline = multiline === true || type === "text";
|
|
33
19
|
rows = rows || (multiline ? 4 : 1);
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
20
|
+
const fieldType = TYPES_MAP[type || "text"] || "text";
|
|
21
|
+
const { t } = useTranslation();
|
|
22
|
+
const currentValue = useWatch({ control, name });
|
|
23
|
+
const getRemainingChars = (currentValue2, limit2) => {
|
|
24
|
+
if (currentValue2) {
|
|
25
|
+
return limit2?.max - currentValue2.length;
|
|
26
|
+
}
|
|
27
|
+
return limit2?.max;
|
|
28
|
+
};
|
|
29
|
+
const constructRemainingText = (currentValue2, limit2) => {
|
|
30
|
+
const remainingChars = getRemainingChars(currentValue2, limit2);
|
|
31
|
+
let remainingText = Math.abs(remainingChars) === 1 ? t("form.info.text.character") : t("form.info.text.characters");
|
|
32
|
+
remainingText += remainingChars > 0 ? ` ${t("form.info.text.remaining")}.` : ` ${t("form.info.text.too_many")}.`;
|
|
33
|
+
return remainingText;
|
|
34
|
+
};
|
|
42
35
|
if (multiline === true) {
|
|
43
|
-
return
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
36
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
37
|
+
TextArea,
|
|
38
|
+
{
|
|
39
|
+
name,
|
|
40
|
+
className,
|
|
41
|
+
rows,
|
|
42
|
+
ref,
|
|
43
|
+
id: name,
|
|
44
|
+
...{
|
|
45
|
+
...props,
|
|
46
|
+
reset: void 0,
|
|
47
|
+
required: void 0,
|
|
48
|
+
type: fieldType
|
|
49
|
+
}
|
|
55
50
|
}
|
|
56
|
-
|
|
51
|
+
), limit?.max && /* @__PURE__ */ React.createElement(Hint, { display: "flex" }, t("form.info.text.you_have"), /* @__PURE__ */ React.createElement(Hint, { fontWeight: "bold" }, "\xA0", `${Math.abs(getRemainingChars(currentValue, limit))}`, "\xA0"), constructRemainingText(currentValue, limit)));
|
|
57
52
|
} else {
|
|
58
|
-
return
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
53
|
+
return /* @__PURE__ */ React.createElement(
|
|
54
|
+
TextInput,
|
|
55
|
+
{
|
|
56
|
+
name,
|
|
57
|
+
id: name,
|
|
58
|
+
type: fieldType,
|
|
59
|
+
"data-type": type,
|
|
60
|
+
className,
|
|
61
|
+
ref,
|
|
62
|
+
...{
|
|
63
|
+
...props,
|
|
64
|
+
reset: void 0,
|
|
65
|
+
required: void 0
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
);
|
|
67
69
|
}
|
|
68
70
|
});
|
|
69
|
-
|
|
71
|
+
var Input_default = Input;
|
|
72
|
+
export {
|
|
73
|
+
Input,
|
|
74
|
+
Input_default as default
|
|
75
|
+
};
|
|
76
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/inputs/Input/index.tsx"],
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport { useWatch } from 'react-hook-form';\nimport type { UncontrolledFieldProps } from '@digigov/form/Field/types';\nimport { TextArea } from '@digigov/ui/form/TextArea';\nimport { TextInput } from '@digigov/ui/form/TextInput';\nimport { useTranslation } from '@digigov/ui/i18n';\nimport { Hint } from '@digigov/ui/typography/Hint';\n\nconst TYPES_MAP = {\n string: 'text',\n password: 'password',\n int: 'text',\n text: 'text',\n date: 'date',\n};\n\nexport interface InputProps\n extends Omit<UncontrolledFieldProps, 'extra' | 'Field'> {\n extra?: {\n fullWidth?: boolean;\n multiline?: boolean;\n className?: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n rows?: any;\n limit: {\n min?: number;\n max?: number;\n };\n };\n Field?: UncontrolledFieldProps['Field'];\n}\n\nexport const Input = React.forwardRef<\n HTMLInputElement | HTMLTextAreaElement,\n InputProps\n>(function WrappedInput({ name, control, type, extra, ...props }, ref) {\n delete props['Field'];\n // eslint-disable-next-line prefer-const\n let { multiline = false, rows, limit } = extra || {};\n const { className } = extra || {};\n // if enforced to multiline use true. Derive from type otherwise.\n multiline = multiline === true || type === 'text';\n // use explicit rows value if set. Derive from multiline otherwise.\n rows = rows || (multiline ? 4 : 1);\n // translate dilosi type to HTML Input type\n const fieldType = TYPES_MAP[type || 'text'] || 'text';\n const { t } = useTranslation();\n const currentValue: string | '' = useWatch({ control, name });\n\n const getRemainingChars = (currentValue, limit) => {\n if (currentValue) {\n return limit?.max - currentValue.length;\n }\n return limit?.max;\n };\n\n const constructRemainingText = (currentValue, limit) => {\n const remainingChars = getRemainingChars(currentValue, limit);\n let remainingText =\n Math.abs(remainingChars) === 1\n ? t('form.info.text.character')\n : t('form.info.text.characters');\n remainingText +=\n remainingChars > 0\n ? ` ${t('form.info.text.remaining')}.`\n : ` ${t('form.info.text.too_many')}.`;\n return remainingText;\n };\n\n if (multiline === true) {\n return (\n <>\n <TextArea\n name={name}\n className={className}\n rows={rows}\n ref={ref as React.RefObject<HTMLTextAreaElement>}\n id={name}\n {...{\n ...props,\n reset: undefined,\n required: undefined,\n type: fieldType,\n }}\n />\n {limit?.max && (\n <Hint display={'flex'}>\n {t('form.info.text.you_have')}\n <Hint fontWeight=\"bold\">\n {`${Math.abs(getRemainingChars(currentValue, limit))}`}\n \n </Hint>\n {constructRemainingText(currentValue, limit)}\n </Hint>\n )}\n </>\n );\n } else {\n return (\n <TextInput\n name={name}\n id={name}\n type={fieldType}\n data-type={type}\n className={className}\n ref={ref as React.RefObject<HTMLInputElement>}\n {...{\n ...props,\n reset: undefined,\n required: undefined,\n }}\n />\n );\n }\n});\n\nexport default Input;\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO,WAAW;AAClB,SAAS,gBAAgB;AAEzB,SAAS,gBAAgB;AACzB,SAAS,iBAAiB;AAC1B,SAAS,sBAAsB;AAC/B,SAAS,YAAY;AAErB,MAAM,YAAY;AAAA,EAChB,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,KAAK;AAAA,EACL,MAAM;AAAA,EACN,MAAM;AACR;AAkBO,MAAM,QAAQ,MAAM,WAGzB,SAAS,aAAa,EAAE,MAAM,SAAS,MAAM,OAAO,GAAG,MAAM,GAAG,KAAK;AACrE,SAAO,MAAM,OAAO;AAEpB,MAAI,EAAE,YAAY,OAAO,MAAM,MAAM,IAAI,SAAS,CAAC;AACnD,QAAM,EAAE,UAAU,IAAI,SAAS,CAAC;AAEhC,cAAY,cAAc,QAAQ,SAAS;AAE3C,SAAO,SAAS,YAAY,IAAI;AAEhC,QAAM,YAAY,UAAU,QAAQ,MAAM,KAAK;AAC/C,QAAM,EAAE,EAAE,IAAI,eAAe;AAC7B,QAAM,eAA4B,SAAS,EAAE,SAAS,KAAK,CAAC;AAE5D,QAAM,oBAAoB,CAACA,eAAcC,WAAU;AACjD,QAAID,eAAc;AAChB,aAAOC,QAAO,MAAMD,cAAa;AAAA,IACnC;AACA,WAAOC,QAAO;AAAA,EAChB;AAEA,QAAM,yBAAyB,CAACD,eAAcC,WAAU;AACtD,UAAM,iBAAiB,kBAAkBD,eAAcC,MAAK;AAC5D,QAAI,gBACF,KAAK,IAAI,cAAc,MAAM,IACzB,EAAE,0BAA0B,IAC5B,EAAE,2BAA2B;AACnC,qBACE,iBAAiB,IACb,IAAI,EAAE,0BAA0B,CAAC,MACjC,IAAI,EAAE,yBAAyB,CAAC;AACtC,WAAO;AAAA,EACT;AAEA,MAAI,cAAc,MAAM;AACtB,WACE,0DACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,IAAI;AAAA,QACH,GAAG;AAAA,UACF,GAAG;AAAA,UACH,OAAO;AAAA,UACP,UAAU;AAAA,UACV,MAAM;AAAA,QACR;AAAA;AAAA,IACF,GACC,OAAO,OACN,oCAAC,QAAK,SAAS,UACZ,EAAE,yBAAyB,GAC5B,oCAAC,QAAK,YAAW,UAAO,QACf,GAAG,KAAK,IAAI,kBAAkB,cAAc,KAAK,CAAC,CAAC,IAAG,MAE/D,GACC,uBAAuB,cAAc,KAAK,CAC7C,CAEJ;AAAA,EAEJ,OAAO;AACL,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,IAAI;AAAA,QACJ,MAAM;AAAA,QACN,aAAW;AAAA,QACX;AAAA,QACA;AAAA,QACC,GAAG;AAAA,UACF,GAAG;AAAA,UACH,OAAO;AAAA,UACP,UAAU;AAAA,QACZ;AAAA;AAAA,IACF;AAAA,EAEJ;AACF,CAAC;AAED,IAAO,gBAAQ;",
|
|
6
|
+
"names": ["currentValue", "limit"]
|
|
7
|
+
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
declare namespace _default {
|
|
2
2
|
export let title: string;
|
|
3
3
|
export { Label as component };
|
|
4
|
+
export let tags: string[];
|
|
5
|
+
export { doc as markdown };
|
|
4
6
|
export let displayName: string;
|
|
5
7
|
}
|
|
6
8
|
export default _default;
|
|
7
|
-
export
|
|
9
|
+
export { Default } from "@digigov/form/inputs/Label/__stories__/Default";
|
|
8
10
|
import Label from '@digigov/form/inputs/Label';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const Default: () => JSX.Element;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare const Default: (_: any) => React.JSX.Element;
|
|
3
3
|
export default Default;
|
package/inputs/Label/index.d.ts
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { FieldLabelProps } from '@digigov/form/types';
|
|
2
|
+
import type { FieldLabelProps } from '@digigov/form/types';
|
|
3
3
|
export interface FieldOptionProps {
|
|
4
4
|
label?: FieldLabelProps;
|
|
5
5
|
value: string;
|
|
6
6
|
show?: string[];
|
|
7
7
|
disabled?: boolean;
|
|
8
|
-
selected?: () => React.
|
|
8
|
+
selected?: () => React.ReactNode;
|
|
9
9
|
divider?: string;
|
|
10
10
|
}
|
|
11
11
|
export interface LabelProps {
|
|
12
12
|
primary?: string;
|
|
13
13
|
secondary?: string;
|
|
14
|
-
}
|
|
15
|
-
export interface LabelProps {
|
|
16
14
|
className?: string;
|
|
17
15
|
value?: string;
|
|
18
16
|
label?: FieldLabelProps;
|
package/inputs/Label/index.js
CHANGED
|
@@ -1,22 +1,17 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
label = _ref.label,
|
|
8
|
-
value = _ref.value;
|
|
9
|
-
var _useTranslation = useTranslation(),
|
|
10
|
-
t = _useTranslation.t;
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { LabelTitle } from "@digigov/ui/form/LabelContainer";
|
|
3
|
+
import { useTranslation } from "@digigov/ui/i18n";
|
|
4
|
+
import { Hint } from "@digigov/ui/typography/Hint";
|
|
5
|
+
const Label = ({ className, label, value }) => {
|
|
6
|
+
const { t } = useTranslation();
|
|
11
7
|
if ((!label || label && !label.primary && !label.secondary) && !value) {
|
|
12
8
|
return null;
|
|
13
9
|
}
|
|
14
|
-
return
|
|
15
|
-
className: className,
|
|
16
|
-
size: "sm"
|
|
17
|
-
}, label && label.primary && t(label.primary) || value), label && label.secondary && /*#__PURE__*/React.createElement(Hint, null, t(label.secondary)));
|
|
10
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(LabelTitle, { className, size: "sm" }, label && label.primary && t(label.primary) || value), label && label.secondary && /* @__PURE__ */ React.createElement(Hint, null, t(label.secondary)));
|
|
18
11
|
};
|
|
19
|
-
|
|
20
|
-
|
|
12
|
+
var Label_default = Label;
|
|
13
|
+
export {
|
|
14
|
+
Label,
|
|
15
|
+
Label_default as default
|
|
21
16
|
};
|
|
22
|
-
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/inputs/Label/index.tsx"],
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport type { FieldLabelProps } from '@digigov/form/types';\nimport { LabelTitle } from '@digigov/ui/form/LabelContainer';\nimport { useTranslation } from '@digigov/ui/i18n';\nimport { Hint } from '@digigov/ui/typography/Hint';\n\nexport interface FieldOptionProps {\n label?: FieldLabelProps;\n value: string;\n show?: string[];\n disabled?: boolean;\n selected?: () => React.ReactNode;\n divider?: string;\n}\n\nexport interface LabelProps {\n primary?: string;\n secondary?: string;\n className?: string;\n value?: string;\n label?: FieldLabelProps;\n}\n\nexport const Label: React.FC<LabelProps> = ({ className, label, value }) => {\n const { t } = useTranslation();\n if ((!label || (label && !label.primary && !label.secondary)) && !value) {\n return null;\n }\n return (\n <>\n <LabelTitle className={className} size=\"sm\">\n {(label && label.primary && t(label.primary)) || value}\n </LabelTitle>\n {label && label.secondary && <Hint>{t(label.secondary)}</Hint>}\n </>\n );\n};\n\nexport default Label;\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO,WAAW;AAElB,SAAS,kBAAkB;AAC3B,SAAS,sBAAsB;AAC/B,SAAS,YAAY;AAmBd,MAAM,QAA8B,CAAC,EAAE,WAAW,OAAO,MAAM,MAAM;AAC1E,QAAM,EAAE,EAAE,IAAI,eAAe;AAC7B,OAAK,CAAC,SAAU,SAAS,CAAC,MAAM,WAAW,CAAC,MAAM,cAAe,CAAC,OAAO;AACvE,WAAO;AAAA,EACT;AACA,SACE,0DACE,oCAAC,cAAW,WAAsB,MAAK,QACnC,SAAS,MAAM,WAAW,EAAE,MAAM,OAAO,KAAM,KACnD,GACC,SAAS,MAAM,aAAa,oCAAC,YAAM,EAAE,MAAM,SAAS,CAAE,CACzD;AAEJ;AAEA,IAAO,gBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
declare namespace _default {
|
|
2
2
|
export let title: string;
|
|
3
3
|
export { OtpInput as component };
|
|
4
|
+
export let tags: string[];
|
|
5
|
+
export { doc as markdown };
|
|
4
6
|
export let displayName: string;
|
|
5
7
|
}
|
|
6
8
|
export default _default;
|
|
7
|
-
export
|
|
9
|
+
export { Default } from "@digigov/form/inputs/OtpInput/__stories__/Default";
|
|
8
10
|
import OtpInput from '@digigov/form/inputs/OtpInput';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const Default: () => JSX.Element;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare const Default: (_: any) => React.JSX.Element;
|
|
3
3
|
export default Default;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
export declare const RE_DIGIT: RegExp;
|
|
3
3
|
export declare const REMOVE_SPACES: RegExp;
|
|
4
|
-
export declare
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
export declare function useOtp(onChange: any, maxLength: any): {
|
|
5
|
+
otpValues: string[];
|
|
6
|
+
handleOtpChange: (e: React.ChangeEvent<HTMLInputElement>, idx: number) => void;
|
|
7
|
+
handleKeyDown: (e: React.KeyboardEvent<HTMLInputElement>, idx: number) => void;
|
|
8
|
+
handleFocus: (e: React.FocusEvent<HTMLInputElement>) => void;
|
|
9
|
+
handlePaste: (e: React.ClipboardEvent<HTMLInputElement>) => void;
|
|
10
|
+
};
|
|
11
|
+
export declare const OtpInput: React.ForwardRefExoticComponent<Omit<Record<string, any>, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
9
12
|
export default OtpInput;
|
package/inputs/OtpInput/index.js
CHANGED
|
@@ -1,140 +1,152 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import React, { useState, useCallback } from 'react';
|
|
8
|
-
import SingleCharacterInputs, { SingleCharacterInput } from '@digigov/ui/form/SingleCharacterInputs';
|
|
9
|
-
export var RE_DIGIT = new RegExp(/^\d+$/);
|
|
10
|
-
export var REMOVE_SPACES = new RegExp(/\s+/g);
|
|
1
|
+
import React, { useState, useCallback } from "react";
|
|
2
|
+
import SingleCharacterInputs, {
|
|
3
|
+
SingleCharacterInput
|
|
4
|
+
} from "@digigov/ui/form/SingleCharacterInputs";
|
|
5
|
+
const RE_DIGIT = new RegExp(/^\d+$/);
|
|
6
|
+
const REMOVE_SPACES = new RegExp(/\s+/g);
|
|
11
7
|
function useOtp(onChange, maxLength) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
onChange
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
8
|
+
const [otpValues, setOtpValues] = useState(Array(maxLength).fill(""));
|
|
9
|
+
const handleChange = useCallback(
|
|
10
|
+
(otp) => {
|
|
11
|
+
setOtpValues(otp);
|
|
12
|
+
const otpValue = otp.join("");
|
|
13
|
+
onChange(otpValue);
|
|
14
|
+
},
|
|
15
|
+
[onChange]
|
|
16
|
+
);
|
|
17
|
+
const setOtp = (item, idx) => {
|
|
18
|
+
const updatedOTPValues = [...otpValues];
|
|
23
19
|
if (item.length === 1 || item.length === 0) {
|
|
24
|
-
updatedOTPValues[idx] = item[0] ||
|
|
20
|
+
updatedOTPValues[idx] = item[0] || "";
|
|
25
21
|
handleChange(updatedOTPValues);
|
|
26
22
|
} else if (item.length === maxLength) {
|
|
27
|
-
|
|
23
|
+
const valueArray = item.split("").slice(0, maxLength);
|
|
28
24
|
handleChange(valueArray);
|
|
29
25
|
}
|
|
30
26
|
};
|
|
31
|
-
|
|
27
|
+
const setSelectionRange = useCallback((target) => {
|
|
32
28
|
return target.setSelectionRange(0, target.value.length);
|
|
33
29
|
}, []);
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
const focusToNextInput = useCallback((target) => {
|
|
31
|
+
const nextElement = target.nextElementSibling;
|
|
36
32
|
if (nextElement) {
|
|
37
33
|
nextElement.focus();
|
|
38
34
|
}
|
|
39
35
|
}, []);
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
const focusToPrevInput = useCallback((target) => {
|
|
37
|
+
const previousElement = target.previousElementSibling;
|
|
42
38
|
if (previousElement) {
|
|
43
39
|
previousElement.focus();
|
|
44
40
|
}
|
|
45
41
|
}, []);
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
if (key === 'ArrowLeft' || key === 'ArrowUp') {
|
|
56
|
-
e.preventDefault();
|
|
57
|
-
return focusToPrevInput(target);
|
|
58
|
-
}
|
|
59
|
-
if (e.key === 'Backspace' || e.key === 'Delete') {
|
|
60
|
-
if (targetValue !== '') {
|
|
61
|
-
targetValue = '';
|
|
62
|
-
} else {
|
|
63
|
-
focusToPrevInput(target);
|
|
42
|
+
const handleKeyDown = useCallback(
|
|
43
|
+
(e, idx) => {
|
|
44
|
+
const { key } = e;
|
|
45
|
+
const target = e.target;
|
|
46
|
+
let targetValue = target.value;
|
|
47
|
+
setSelectionRange(target);
|
|
48
|
+
if (key === "ArrowRight" || key === "ArrowDown") {
|
|
49
|
+
e.preventDefault();
|
|
50
|
+
return focusToNextInput(target);
|
|
64
51
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}, [setOtp, focusToPrevInput, focusToNextInput]);
|
|
69
|
-
var handleFocus = useCallback(function (e) {
|
|
70
|
-
var target = e.target;
|
|
71
|
-
setSelectionRange(target);
|
|
72
|
-
}, [setSelectionRange]);
|
|
73
|
-
var handleOtpChange = useCallback(function (e, idx) {
|
|
74
|
-
var target = e.target;
|
|
75
|
-
var targetValue = target.value;
|
|
76
|
-
var isTargetValueDigit = RE_DIGIT.test(targetValue);
|
|
77
|
-
// We want to pass the empty string when the value is deleted
|
|
78
|
-
// emptry string replaces the deleted value
|
|
79
|
-
if (isTargetValueDigit || targetValue === '') {
|
|
80
|
-
setOtp(targetValue, idx);
|
|
81
|
-
if (target.value.length > 1) {
|
|
82
|
-
target.blur();
|
|
52
|
+
if (key === "ArrowLeft" || key === "ArrowUp") {
|
|
53
|
+
e.preventDefault();
|
|
54
|
+
return focusToPrevInput(target);
|
|
83
55
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
56
|
+
if (e.key === "Backspace" || e.key === "Delete") {
|
|
57
|
+
if (targetValue !== "") {
|
|
58
|
+
targetValue = "";
|
|
59
|
+
} else {
|
|
60
|
+
focusToPrevInput(target);
|
|
61
|
+
}
|
|
62
|
+
setOtp(targetValue, idx);
|
|
63
|
+
return e.preventDefault();
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
[setOtp, focusToPrevInput, focusToNextInput]
|
|
67
|
+
);
|
|
68
|
+
const handleFocus = useCallback(
|
|
69
|
+
(e) => {
|
|
70
|
+
const { target } = e;
|
|
71
|
+
setSelectionRange(target);
|
|
72
|
+
},
|
|
73
|
+
[setSelectionRange]
|
|
74
|
+
);
|
|
75
|
+
const handleOtpChange = useCallback(
|
|
76
|
+
(e, idx) => {
|
|
77
|
+
const target = e.target;
|
|
78
|
+
const targetValue = target.value;
|
|
79
|
+
const isTargetValueDigit = RE_DIGIT.test(targetValue);
|
|
80
|
+
if (isTargetValueDigit || targetValue === "") {
|
|
81
|
+
setOtp(targetValue, idx);
|
|
82
|
+
if (target.value.length > 1) {
|
|
83
|
+
target.blur();
|
|
84
|
+
}
|
|
85
|
+
focusToNextInput(target);
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
[setOtp, handleKeyDown, handleFocus]
|
|
89
|
+
);
|
|
90
|
+
const handlePaste = useCallback(
|
|
91
|
+
(e) => {
|
|
92
|
+
e.preventDefault();
|
|
93
|
+
const pastedData = e.clipboardData.getData("text/plain").replace(REMOVE_SPACES, "");
|
|
94
|
+
if (pastedData) {
|
|
95
|
+
setOtp(pastedData, 0);
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
[]
|
|
99
|
+
);
|
|
94
100
|
return {
|
|
95
|
-
otpValues
|
|
96
|
-
handleOtpChange
|
|
97
|
-
handleKeyDown
|
|
98
|
-
handleFocus
|
|
99
|
-
handlePaste
|
|
101
|
+
otpValues,
|
|
102
|
+
handleOtpChange,
|
|
103
|
+
handleKeyDown,
|
|
104
|
+
handleFocus,
|
|
105
|
+
handlePaste
|
|
100
106
|
};
|
|
101
107
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
108
|
+
const SingleCharacterInputPart = React.forwardRef(({ ...props }, ref) => {
|
|
109
|
+
return /* @__PURE__ */ React.createElement(SingleCharacterInput, { ...props, ref });
|
|
110
|
+
});
|
|
111
|
+
SingleCharacterInputPart.displayName = "SingleCharacterInputPart";
|
|
112
|
+
const OtpInput = React.forwardRef(
|
|
113
|
+
({ name, maxLength = 6, ...props }, ref) => {
|
|
114
|
+
const otp = useOtp(props.onChange, maxLength);
|
|
115
|
+
return /* @__PURE__ */ React.createElement(SingleCharacterInputs, null, otp.otpValues.map((digit, idx) => /* @__PURE__ */ React.createElement(
|
|
116
|
+
SingleCharacterInputPart,
|
|
117
|
+
{
|
|
118
|
+
ref: idx === 0 ? ref : null,
|
|
119
|
+
name: `${name}-${idx}`,
|
|
120
|
+
id: `${name}-${idx}`,
|
|
121
|
+
type: "text",
|
|
122
|
+
key: idx,
|
|
123
|
+
autoComplete: "one-time-code",
|
|
124
|
+
pattern: "\\d{1}",
|
|
125
|
+
maxLength,
|
|
126
|
+
value: digit,
|
|
127
|
+
disabled: props.disabled,
|
|
128
|
+
"aria-required": props["aria-required"],
|
|
129
|
+
onChange: (e) => otp.handleOtpChange(e, idx),
|
|
130
|
+
onInput: (e) => {
|
|
131
|
+
if (e.target.value === digit) {
|
|
132
|
+
otp.handleOtpChange(e, idx);
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
onKeyDown: (e) => otp.handleKeyDown(e, idx),
|
|
136
|
+
onFocus: otp.handleFocus,
|
|
137
|
+
onPaste: otp.handlePaste,
|
|
138
|
+
error: !digit ? props.error : false
|
|
139
|
+
}
|
|
140
|
+
)));
|
|
141
|
+
}
|
|
142
|
+
);
|
|
143
|
+
OtpInput.displayName = "OtpInput";
|
|
144
|
+
var OtpInput_default = OtpInput;
|
|
145
|
+
export {
|
|
146
|
+
OtpInput,
|
|
147
|
+
REMOVE_SPACES,
|
|
148
|
+
RE_DIGIT,
|
|
149
|
+
OtpInput_default as default,
|
|
150
|
+
useOtp
|
|
139
151
|
};
|
|
140
|
-
|
|
152
|
+
//# sourceMappingURL=index.js.map
|