@digigov/form 2.0.0-daaf7bdf → 2.0.0-e20fed09
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/{Form.stories → 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 +37 -25
- package/Field/FieldBase.js.map +2 -2
- package/Field/FieldBaseContainer/index.js +38 -18
- package/Field/FieldBaseContainer.d.ts +1 -1
- package/Field/FieldBaseContainer.js.map +2 -2
- package/Field/FieldConditional/index.js +4 -0
- package/Field/FieldConditional.js.map +2 -2
- package/Field/index.js +15 -4
- package/Field/index.js.map +2 -2
- package/Field/types.d.ts +21 -10
- package/Field/utils/index.js +9 -1
- package/Field/utils/index.js.map +2 -2
- package/Field/utils/useField/index.js +14 -1
- package/Field/utils/useField.js.map +2 -2
- package/FieldArray/FieldArray.stories.d.ts +1 -0
- package/FieldArray/FormDialog/index.js +397 -0
- package/{Questions/Questions.stories → FieldArray/FormDialog}/package.json +1 -1
- package/FieldArray/FormDialog.d.ts +66 -0
- package/FieldArray/FormDialog.js.map +7 -0
- package/FieldArray/__stories__/Default.d.ts +1 -1
- package/FieldArray/__stories__/WithExactLength.d.ts +1 -1
- package/FieldArray/__stories__/WithModal.d.ts +2 -0
- package/FieldArray/index.d.ts +6 -0
- package/FieldArray/index.js +87 -29
- package/FieldArray/index.js.map +2 -2
- package/FieldObject/index.d.ts +5 -0
- package/FieldObject/index.js +32 -17
- package/FieldObject/index.js.map +2 -2
- package/Fieldset/index.d.ts +1 -1
- package/Fieldset/index.js +5 -5
- package/Fieldset/index.js.map +2 -2
- package/Fieldset/types.d.ts +2 -2
- package/FormBuilder/FormBuilder.stories.d.ts +4 -0
- package/FormBuilder/__stories__/AutoErrorGrouping.d.ts +3 -0
- package/FormBuilder/__stories__/Default.d.ts +1 -1
- package/FormBuilder/__stories__/ErrorGrouping.d.ts +3 -0
- package/FormBuilder/index.d.ts +1 -1
- package/FormBuilder/index.js +94 -11
- package/FormBuilder/index.js.map +2 -2
- package/FormBuilder/interaction.test.d.ts +1 -0
- package/FormContext/index.js +6 -2
- package/FormContext.d.ts +1 -0
- package/FormContext.js.map +2 -2
- package/MultiplicityField/MultiplicityField.stories.d.ts +2 -0
- package/MultiplicityField/__stories__/Default.d.ts +1 -1
- package/MultiplicityField/__stories__/PreviewDisplay.d.ts +1 -1
- package/MultiplicityField/__stories__/WithExactLength.d.ts +1 -1
- package/MultiplicityField/__stories__/WithMaxLength.d.ts +1 -1
- package/MultiplicityField/__stories__/WithMinAndMaxLength.d.ts +1 -1
- package/MultiplicityField/__stories__/WithMinLength.d.ts +1 -1
- package/MultiplicityField/add-objects/index.js +10 -6
- package/MultiplicityField/add-objects.js.map +2 -2
- package/MultiplicityField/index.js +17 -11
- package/MultiplicityField/index.js.map +2 -2
- package/MultiplicityField/types.d.ts +2 -2
- package/Questions/Questions/index.js +5 -4
- package/Questions/Questions.js.map +2 -2
- package/Questions/Questions.stories.d.ts +2 -0
- package/Questions/Step/StepArrayReview.js.map +2 -2
- package/Questions/Step/StepTitle/index.js +4 -3
- package/Questions/Step/StepTitle.d.ts +1 -1
- package/Questions/Step/StepTitle.js.map +2 -2
- package/Questions/__stories__/Default.d.ts +1 -1
- package/cjs/Field/ErrorGroup/index.js +82 -0
- package/cjs/Field/ErrorGroup.js.map +7 -0
- package/cjs/Field/FieldBase/index.js +36 -24
- package/cjs/Field/FieldBase.js.map +2 -2
- package/cjs/Field/FieldBaseContainer/index.js +37 -17
- package/cjs/Field/FieldBaseContainer.js.map +3 -3
- package/cjs/Field/FieldConditional/index.js +4 -0
- package/cjs/Field/FieldConditional.js.map +2 -2
- package/cjs/Field/index.js +15 -4
- package/cjs/Field/index.js.map +2 -2
- package/cjs/Field/types.js.map +1 -1
- package/cjs/Field/utils/index.js +9 -1
- package/cjs/Field/utils/index.js.map +3 -3
- package/cjs/Field/utils/useField/index.js +14 -1
- package/cjs/Field/utils/useField.js.map +2 -2
- package/cjs/FieldArray/FormDialog/index.js +416 -0
- package/cjs/FieldArray/FormDialog.js.map +7 -0
- package/cjs/FieldArray/index.js +85 -27
- package/cjs/FieldArray/index.js.map +3 -3
- package/cjs/FieldObject/index.js +32 -17
- package/cjs/FieldObject/index.js.map +3 -3
- package/cjs/Fieldset/index.js +10 -10
- package/cjs/Fieldset/index.js.map +3 -3
- package/cjs/Fieldset/types.js.map +1 -1
- package/cjs/FormBuilder/index.js +94 -11
- package/cjs/FormBuilder/index.js.map +3 -3
- package/cjs/FormContext/index.js +9 -4
- package/cjs/FormContext.js.map +3 -3
- package/cjs/MultiplicityField/add-objects/index.js +14 -10
- package/cjs/MultiplicityField/add-objects.js.map +3 -3
- package/cjs/MultiplicityField/index.js +16 -15
- package/cjs/MultiplicityField/index.js.map +3 -3
- package/cjs/MultiplicityField/types.js.map +1 -1
- package/cjs/Questions/Questions/index.js +5 -4
- package/cjs/Questions/Questions.js.map +2 -2
- package/cjs/Questions/Step/StepArrayReview.js.map +2 -2
- package/cjs/Questions/Step/StepTitle/index.js +5 -5
- package/cjs/Questions/Step/StepTitle.js.map +3 -3
- package/cjs/inputs/AutoCompleteInput/index.js +8 -7
- package/cjs/inputs/AutoCompleteInput/index.js.map +3 -3
- package/cjs/inputs/Checkboxes/index.js +9 -9
- package/cjs/inputs/Checkboxes/index.js.map +3 -3
- package/cjs/inputs/DateInput/index.js +51 -22
- package/cjs/inputs/DateInput/index.js.map +3 -3
- package/cjs/inputs/DateTimeInput/index.js +245 -0
- package/cjs/inputs/DateTimeInput/index.js.map +7 -0
- package/cjs/inputs/FileInput/index.js +72 -35
- package/cjs/inputs/FileInput/index.js.map +3 -3
- 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 +54 -18
- package/cjs/inputs/ImageInput/index.js.map +3 -3
- package/cjs/inputs/Input/index.js +12 -4
- package/cjs/inputs/Input/index.js.map +2 -2
- package/cjs/inputs/Label/index.js +3 -3
- package/cjs/inputs/Label/index.js.map +3 -3
- package/cjs/inputs/OtpInput/index.js +1 -0
- package/cjs/inputs/OtpInput/index.js.map +2 -2
- package/cjs/inputs/Radio/index.js +12 -13
- package/cjs/inputs/Radio/index.js.map +3 -3
- package/cjs/inputs/Select/index.js +11 -5
- package/cjs/inputs/Select/index.js.map +3 -3
- package/cjs/inputs/inputsScenarios/index.js +6 -12
- package/cjs/inputs/inputsScenarios.js.map +2 -2
- package/cjs/{lazy/index.js → lazy.js} +49 -35
- package/cjs/lazy.js.map +3 -3
- package/cjs/locales/el.js.map +1 -1
- package/cjs/{registry/index.js → registry.js} +72 -62
- package/cjs/registry.js.map +3 -3
- package/cjs/types.js.map +1 -1
- package/cjs/utils/index.js +22 -7
- package/cjs/utils.js.map +2 -2
- package/cjs/validators/index.js +55 -85
- package/cjs/validators/index.js.map +3 -3
- 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/file/index.js +30 -17
- package/cjs/validators/utils/file.js.map +2 -2
- package/cjs/validators/utils/index.js +10 -2
- package/cjs/validators/utils/index.js.map +2 -2
- package/cjs/validators/utils/int/index.js +1 -1
- package/cjs/validators/utils/int.js.map +2 -2
- package/cjs/validators/utils/number/index.js +1 -1
- package/cjs/validators/utils/number.js.map +2 -2
- package/cjs/validators/utils/phone.js.map +2 -2
- package/cjs/validators/utils/postal_code.js.map +1 -1
- package/cjs/validators/utils/uuid4.js.map +2 -2
- package/index.js +1 -1
- package/inputs/AutoCompleteInput/AutoComplete.stories.d.ts +2 -0
- package/inputs/AutoCompleteInput/__stories__/Default.d.ts +1 -1
- package/inputs/AutoCompleteInput/__stories__/Multiple.d.ts +1 -1
- package/inputs/AutoCompleteInput/index.d.ts +1 -1
- package/inputs/AutoCompleteInput/index.js +10 -7
- package/inputs/AutoCompleteInput/index.js.map +2 -2
- package/inputs/Checkboxes/Checkboxes.stories.d.ts +2 -0
- package/inputs/Checkboxes/__stories__/Conditional.d.ts +1 -1
- package/inputs/Checkboxes/__stories__/Default.d.ts +1 -1
- package/inputs/Checkboxes/__stories__/WithDivider.d.ts +1 -1
- package/inputs/Checkboxes/index.d.ts +1 -1
- package/inputs/Checkboxes/index.js +10 -6
- package/inputs/Checkboxes/index.js.map +2 -2
- package/inputs/DateInput/DateInput.stories.d.ts +6 -0
- package/inputs/DateInput/__stories__/Default.d.ts +1 -1
- 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 +1 -2
- package/inputs/DateInput/index.js +54 -22
- package/inputs/DateInput/index.js.map +2 -2
- 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 +13 -0
- package/inputs/DateTimeInput/index.js +215 -0
- package/inputs/DateTimeInput/index.js.map +7 -0
- package/inputs/DateTimeInput/index.test.d.ts +1 -0
- package/inputs/{Input/Input.stories → DateTimeInput}/package.json +1 -1
- package/inputs/FileInput/FileInput.stories.d.ts +3 -0
- package/inputs/FileInput/__stories__/Default.d.ts +1 -1
- package/inputs/FileInput/__stories__/WithBorderAndLink.d.ts +3 -0
- package/inputs/FileInput/index.d.ts +17 -1
- package/inputs/FileInput/index.js +76 -36
- package/inputs/FileInput/index.js.map +2 -2
- package/inputs/ImageInput/ImageInput.stories.d.ts +4 -1
- package/inputs/ImageInput/__stories__/Default.d.ts +1 -1
- package/inputs/ImageInput/__stories__/MaxSize.d.ts +1 -1
- package/inputs/ImageInput/__stories__/WithInitialValues.d.ts +3 -0
- package/inputs/ImageInput/__stories__/WithInvalidImageDimension.d.ts +1 -1
- package/inputs/ImageInput/__stories__/logo.d/index.js +1 -0
- package/inputs/{DateInput/__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 +9 -1
- package/inputs/ImageInput/index.js +54 -18
- package/inputs/ImageInput/index.js.map +2 -2
- package/inputs/Input/Input.stories.d.ts +5 -0
- package/inputs/Input/__stories__/AFM.d.ts +1 -1
- package/inputs/Input/__stories__/AMKA.d.ts +3 -0
- package/inputs/Input/__stories__/Boolean.d.ts +1 -1
- package/inputs/Input/__stories__/Email.d.ts +3 -0
- package/inputs/Input/__stories__/IBAN.d.ts +1 -1
- package/inputs/Input/__stories__/Integer.d.ts +1 -1
- package/inputs/Input/__stories__/LandlineNumber.d.ts +1 -1
- package/inputs/Input/__stories__/MobilePhone.d.ts +1 -1
- package/inputs/Input/__stories__/PhoneNumber.d.ts +1 -1
- package/inputs/Input/__stories__/PostalCode.d.ts +1 -1
- package/inputs/Input/__stories__/String.d.ts +1 -1
- package/inputs/Input/__stories__/StringWithTrimValidation.d.ts +3 -0
- package/inputs/Input/__stories__/TextWithLimit.d.ts +1 -1
- package/inputs/Input/index.d.ts +2 -1
- package/inputs/Input/index.js +12 -4
- package/inputs/Input/index.js.map +2 -2
- package/inputs/Label/Label.stories.d.ts +2 -0
- package/inputs/Label/__stories__/Default.d.ts +1 -1
- package/inputs/Label/index.d.ts +0 -2
- package/inputs/Label/index.js +2 -2
- package/inputs/Label/index.js.map +2 -2
- package/inputs/OtpInput/OtpInput.stories.d.ts +2 -0
- package/inputs/OtpInput/__stories__/Default.d.ts +1 -1
- package/inputs/OtpInput/index.js +1 -0
- package/inputs/OtpInput/index.js.map +2 -2
- package/inputs/Radio/Radio.stories.d.ts +2 -0
- package/inputs/Radio/__stories__/Conditional.d.ts +1 -1
- package/inputs/Radio/__stories__/Default.d.ts +1 -1
- package/inputs/Radio/__stories__/WithDivider.d.ts +1 -1
- package/inputs/Radio/index.d.ts +1 -1
- package/inputs/Radio/index.js +8 -5
- package/inputs/Radio/index.js.map +2 -2
- package/inputs/Select/Select.stories.d.ts +2 -0
- package/inputs/Select/__stories__/Default.d.ts +1 -1
- package/inputs/Select/index.d.ts +3 -2
- package/inputs/Select/index.js +13 -4
- package/inputs/Select/index.js.map +2 -2
- package/inputs/inputsScenarios/index.js +6 -12
- package/inputs/inputsScenarios.d.ts +1 -1
- package/inputs/inputsScenarios.js.map +2 -2
- package/lazy/index.js +77 -67
- package/locales/el.js.map +1 -1
- package/package.json +8 -8
- package/registry/index.js +116 -107
- package/src/Field/ErrorGroup.tsx +84 -0
- package/src/Field/FieldBase.tsx +39 -24
- package/src/Field/FieldBaseContainer.tsx +70 -47
- package/src/Field/FieldConditional.tsx +6 -2
- package/src/Field/doc.mdx +207 -0
- package/src/Field/index.tsx +20 -5
- package/src/Field/types.tsx +42 -29
- package/src/Field/utils/index.ts +8 -0
- package/src/Field/utils/useField.ts +14 -2
- package/src/FieldArray/FieldArray.stories.js +1 -0
- package/src/FieldArray/FormDialog.tsx +565 -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/index.test.tsx +8 -0
- package/src/FieldArray/index.tsx +119 -54
- package/src/FieldObject/index.tsx +41 -20
- package/src/Fieldset/index.tsx +5 -5
- package/src/Fieldset/types.tsx +2 -2
- package/src/FormBuilder/FormBuilder.stories.js +5 -0
- 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 +12 -0
- package/src/FormBuilder/index.tsx +104 -14
- package/src/FormBuilder/interaction.test.tsx +40 -0
- package/src/FormBuilder/scenarios.test.tsx +1002 -130
- package/src/FormContext.tsx +5 -2
- package/src/MultiplicityField/MultiplicityField.stories.js +3 -0
- package/src/MultiplicityField/__stories__/Default.tsx +1 -1
- package/src/MultiplicityField/__stories__/PreviewDisplay.tsx +1 -1
- package/src/MultiplicityField/__stories__/WithExactLength.tsx +1 -1
- package/src/MultiplicityField/__stories__/WithMaxLength.tsx +1 -1
- package/src/MultiplicityField/__stories__/WithMinAndMaxLength.tsx +1 -1
- package/src/MultiplicityField/__stories__/WithMinLength.tsx +1 -1
- package/src/MultiplicityField/add-objects.tsx +11 -9
- package/src/MultiplicityField/{MultiplicityField.mdx → doc.mdx} +112 -98
- package/src/MultiplicityField/index.test.tsx +4 -0
- package/src/MultiplicityField/index.tsx +17 -12
- package/src/MultiplicityField/types.ts +2 -2
- package/src/Questions/Questions.stories.js +3 -0
- package/src/Questions/Questions.tsx +4 -4
- package/src/Questions/Step/StepArrayReview.tsx +1 -1
- package/src/Questions/Step/StepTitle.tsx +4 -3
- package/src/Questions/__snapshots__/index.spec.tsx.snap +11 -5
- package/src/Questions/__stories__/Default.tsx +1 -1
- package/src/Questions/{index.mdx → doc.mdx} +30 -53
- package/src/Questions/index.spec.tsx +14 -2
- package/src/Questions/index.test.tsx +4 -0
- package/src/create-simple-form.mdx +2 -6
- package/src/{index.mdx → doc.mdx} +29 -18
- package/src/inputs/AutoCompleteInput/AutoComplete.stories.js +3 -0
- package/src/inputs/AutoCompleteInput/__stories__/Default.tsx +3 -11
- package/src/inputs/AutoCompleteInput/__stories__/Multiple.tsx +2 -8
- package/src/inputs/AutoCompleteInput/{index.mdx → doc.mdx} +2 -13
- package/src/inputs/AutoCompleteInput/index.test.tsx +4 -0
- package/src/inputs/AutoCompleteInput/index.tsx +32 -28
- package/src/inputs/Checkboxes/Checkboxes.stories.js +3 -0
- package/src/inputs/Checkboxes/__stories__/Conditional.tsx +1 -1
- package/src/inputs/Checkboxes/__stories__/Default.tsx +1 -1
- package/src/inputs/Checkboxes/__stories__/WithDivider.tsx +1 -1
- package/src/inputs/Checkboxes/{index.mdx → doc.mdx} +5 -15
- package/src/inputs/Checkboxes/index.test.tsx +4 -0
- package/src/inputs/Checkboxes/index.tsx +28 -28
- package/src/inputs/DateInput/DateInput.stories.js +7 -0
- package/src/inputs/DateInput/__stories__/Default.tsx +8 -13
- 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/{index.mdx → doc.mdx} +1 -8
- package/src/inputs/DateInput/index.test.tsx +20 -0
- package/src/inputs/DateInput/index.tsx +58 -21
- 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 +233 -0
- package/src/inputs/FileInput/FileInput.stories.js +4 -0
- package/src/inputs/FileInput/__stories__/Default.tsx +1 -1
- package/src/inputs/FileInput/__stories__/WithBorderAndLink.tsx +34 -0
- package/src/inputs/FileInput/{index.mdx → doc.mdx} +1 -5
- package/src/inputs/FileInput/index.test.tsx +8 -0
- package/src/inputs/FileInput/index.tsx +106 -41
- package/src/inputs/ImageInput/ImageInput.stories.js +5 -2
- package/src/inputs/ImageInput/__stories__/Default.tsx +1 -1
- package/src/inputs/ImageInput/__stories__/MaxSize.tsx +5 -4
- package/src/inputs/ImageInput/__stories__/{WithInvalidImageSize.tsx → WithInitialValues.tsx} +12 -3
- 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 +8 -4
- package/src/inputs/ImageInput/index.tsx +103 -50
- package/src/inputs/Input/Input.stories.js +6 -0
- 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__/String.tsx +1 -1
- package/src/inputs/Input/__stories__/StringWithTrimValidation.tsx +26 -0
- package/src/inputs/Input/__stories__/TextWithLimit.tsx +2 -1
- package/src/inputs/Input/doc.mdx +56 -0
- package/src/inputs/Input/index.test.tsx +16 -0
- package/src/inputs/Input/index.tsx +30 -12
- package/src/inputs/Label/Label.stories.js +3 -0
- package/src/inputs/Label/__stories__/Default.tsx +1 -1
- package/src/inputs/Label/doc.mdx +14 -0
- package/src/inputs/Label/index.test.tsx +4 -0
- package/src/inputs/Label/index.tsx +2 -6
- package/src/inputs/OtpInput/OtpInput.stories.js +3 -0
- package/src/inputs/OtpInput/__stories__/Default.tsx +1 -1
- package/src/inputs/OtpInput/{index.mdx → doc.mdx} +1 -8
- package/src/inputs/OtpInput/index.test.tsx +4 -0
- package/src/inputs/OtpInput/index.tsx +3 -1
- package/src/inputs/Radio/Radio.stories.js +3 -0
- package/src/inputs/Radio/__stories__/Conditional.tsx +1 -1
- package/src/inputs/Radio/__stories__/Default.tsx +1 -1
- package/src/inputs/Radio/__stories__/WithDivider.tsx +1 -1
- package/src/inputs/Radio/{index.mdx → doc.mdx} +5 -15
- package/src/inputs/Radio/index.test.tsx +4 -0
- package/src/inputs/Radio/index.tsx +59 -56
- package/src/inputs/Select/Select.stories.js +3 -0
- package/src/inputs/Select/__stories__/Default.tsx +1 -1
- package/src/inputs/Select/{index.mdx → doc.mdx} +1 -5
- package/src/inputs/Select/index.test.tsx +4 -0
- package/src/inputs/Select/index.tsx +18 -7
- package/src/inputs/inputsScenarios.ts +36 -42
- package/src/installation.mdx +2 -5
- package/src/lazy.js +77 -64
- package/src/locales/el.ts +1 -1
- package/src/registry.js +108 -100
- package/src/types.tsx +4 -3
- package/src/utils.ts +29 -8
- package/src/validators/index.ts +103 -91
- 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/file.ts +33 -17
- package/src/validators/utils/index.ts +6 -1
- package/src/validators/utils/int.ts +1 -1
- package/src/validators/utils/number.ts +1 -1
- package/src/validators/utils/phone.ts +1 -1
- package/src/validators/utils/postal_code.ts +1 -1
- package/src/validators/utils/uuid4.ts +2 -1
- package/src/validators/validators.spec.ts +3 -3
- package/types.d.ts +4 -3
- package/types.js.map +1 -1
- package/utils/index.js +22 -7
- package/utils.d.ts +2 -0
- package/utils.js.map +2 -2
- package/validators/index.d.ts +1 -1
- package/validators/index.js +63 -86
- package/validators/index.js.map +2 -2
- package/validators/utils/amka/index.js +36 -0
- package/{FieldArray/FieldArray.stories → validators/utils/amka}/package.json +1 -1
- 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/file/index.js +30 -17
- package/validators/utils/file.js.map +2 -2
- package/validators/utils/index.d.ts +3 -0
- package/validators/utils/index.js +6 -1
- package/validators/utils/index.js.map +2 -2
- package/validators/utils/int/index.js +1 -1
- package/validators/utils/int.js.map +2 -2
- package/validators/utils/number/index.js +1 -1
- package/validators/utils/number.js.map +2 -2
- package/validators/utils/phone.d.ts +1 -1
- package/validators/utils/phone.js.map +2 -2
- package/validators/utils/postal_code.d.ts +1 -1
- package/validators/utils/postal_code.js.map +1 -1
- package/validators/utils/uuid4.js.map +2 -2
- package/FieldArray/FieldArray.stories/index.js +0 -14
- package/FieldArray/FieldArray.stories.js.map +0 -7
- package/FieldArray/__stories__/Default/index.js +0 -95
- package/FieldArray/__stories__/Default/package.json +0 -6
- package/FieldArray/__stories__/Default.js.map +0 -7
- package/FieldArray/__stories__/WithExactLength/index.js +0 -95
- package/FieldArray/__stories__/WithExactLength/package.json +0 -6
- package/FieldArray/__stories__/WithExactLength.js.map +0 -7
- package/Form.stories/index.js +0 -7
- package/Form.stories.js.map +0 -7
- package/FormBuilder/FormBuilder.stories/index.js +0 -12
- package/FormBuilder/FormBuilder.stories/package.json +0 -6
- package/FormBuilder/FormBuilder.stories.js.map +0 -7
- package/FormBuilder/__stories__/Default/index.js +0 -32
- package/FormBuilder/__stories__/Default/package.json +0 -6
- package/FormBuilder/__stories__/Default.js.map +0 -7
- package/MultiplicityField/MultiplicityField.stories/index.js +0 -22
- package/MultiplicityField/MultiplicityField.stories/package.json +0 -6
- package/MultiplicityField/MultiplicityField.stories.js.map +0 -7
- package/MultiplicityField/__stories__/Default/index.js +0 -100
- package/MultiplicityField/__stories__/Default/package.json +0 -6
- package/MultiplicityField/__stories__/Default.js.map +0 -7
- package/MultiplicityField/__stories__/PreviewDisplay/index.js +0 -70
- package/MultiplicityField/__stories__/PreviewDisplay/package.json +0 -6
- package/MultiplicityField/__stories__/PreviewDisplay.js.map +0 -7
- package/MultiplicityField/__stories__/WithExactLength/index.js +0 -97
- package/MultiplicityField/__stories__/WithExactLength/package.json +0 -6
- package/MultiplicityField/__stories__/WithExactLength.js.map +0 -7
- package/MultiplicityField/__stories__/WithMaxLength/index.js +0 -100
- package/MultiplicityField/__stories__/WithMaxLength/package.json +0 -6
- package/MultiplicityField/__stories__/WithMaxLength.js.map +0 -7
- package/MultiplicityField/__stories__/WithMinAndMaxLength/index.js +0 -101
- package/MultiplicityField/__stories__/WithMinAndMaxLength/package.json +0 -6
- package/MultiplicityField/__stories__/WithMinAndMaxLength.js.map +0 -7
- package/MultiplicityField/__stories__/WithMinLength/index.js +0 -100
- package/MultiplicityField/__stories__/WithMinLength/package.json +0 -6
- package/MultiplicityField/__stories__/WithMinLength.js.map +0 -7
- package/Questions/Questions.stories/index.js +0 -12
- package/Questions/Questions.stories.js.map +0 -7
- package/Questions/__stories__/Default/index.js +0 -108
- package/Questions/__stories__/Default/package.json +0 -6
- package/Questions/__stories__/Default.js.map +0 -7
- package/cjs/FieldArray/FieldArray.stories/index.js +0 -48
- package/cjs/FieldArray/FieldArray.stories.js.map +0 -7
- package/cjs/FieldArray/__stories__/Default/index.js +0 -128
- package/cjs/FieldArray/__stories__/Default.js.map +0 -7
- package/cjs/FieldArray/__stories__/WithExactLength/index.js +0 -128
- package/cjs/FieldArray/__stories__/WithExactLength.js.map +0 -7
- package/cjs/Form.stories/index.js +0 -26
- package/cjs/Form.stories.js.map +0 -7
- package/cjs/FormBuilder/FormBuilder.stories/index.js +0 -45
- package/cjs/FormBuilder/FormBuilder.stories.js.map +0 -7
- package/cjs/FormBuilder/__stories__/Default/index.js +0 -65
- package/cjs/FormBuilder/__stories__/Default.js.map +0 -7
- package/cjs/MultiplicityField/MultiplicityField.stories/index.js +0 -60
- package/cjs/MultiplicityField/MultiplicityField.stories.js.map +0 -7
- package/cjs/MultiplicityField/__stories__/Default/index.js +0 -133
- package/cjs/MultiplicityField/__stories__/Default.js.map +0 -7
- package/cjs/MultiplicityField/__stories__/PreviewDisplay/index.js +0 -86
- package/cjs/MultiplicityField/__stories__/PreviewDisplay.js.map +0 -7
- package/cjs/MultiplicityField/__stories__/WithExactLength/index.js +0 -130
- package/cjs/MultiplicityField/__stories__/WithExactLength.js.map +0 -7
- package/cjs/MultiplicityField/__stories__/WithMaxLength/index.js +0 -133
- package/cjs/MultiplicityField/__stories__/WithMaxLength.js.map +0 -7
- package/cjs/MultiplicityField/__stories__/WithMinAndMaxLength/index.js +0 -134
- package/cjs/MultiplicityField/__stories__/WithMinAndMaxLength.js.map +0 -7
- package/cjs/MultiplicityField/__stories__/WithMinLength/index.js +0 -133
- package/cjs/MultiplicityField/__stories__/WithMinLength.js.map +0 -7
- package/cjs/Questions/Questions.stories/index.js +0 -45
- package/cjs/Questions/Questions.stories.js.map +0 -7
- package/cjs/Questions/__stories__/Default/index.js +0 -136
- package/cjs/Questions/__stories__/Default.js.map +0 -7
- package/cjs/inputs/AutoCompleteInput/AutoComplete.stories/index.js +0 -48
- package/cjs/inputs/AutoCompleteInput/AutoComplete.stories.js.map +0 -7
- package/cjs/inputs/AutoCompleteInput/__stories__/Default/index.js +0 -83
- package/cjs/inputs/AutoCompleteInput/__stories__/Default.js.map +0 -7
- package/cjs/inputs/AutoCompleteInput/__stories__/Multiple/index.js +0 -83
- package/cjs/inputs/AutoCompleteInput/__stories__/Multiple.js.map +0 -7
- package/cjs/inputs/Checkboxes/Checkboxes.stories/index.js +0 -51
- package/cjs/inputs/Checkboxes/Checkboxes.stories.js.map +0 -7
- package/cjs/inputs/Checkboxes/__stories__/Conditional/index.js +0 -133
- package/cjs/inputs/Checkboxes/__stories__/Conditional.js.map +0 -7
- package/cjs/inputs/Checkboxes/__stories__/Default/index.js +0 -77
- package/cjs/inputs/Checkboxes/__stories__/Default.js.map +0 -7
- package/cjs/inputs/Checkboxes/__stories__/WithDivider/index.js +0 -78
- package/cjs/inputs/Checkboxes/__stories__/WithDivider.js.map +0 -7
- package/cjs/inputs/DateInput/DateInput.stories/index.js +0 -45
- package/cjs/inputs/DateInput/DateInput.stories.js.map +0 -7
- package/cjs/inputs/DateInput/__stories__/Default/index.js +0 -61
- package/cjs/inputs/DateInput/__stories__/Default.js.map +0 -7
- package/cjs/inputs/FileInput/FileInput.stories/index.js +0 -45
- package/cjs/inputs/FileInput/FileInput.stories.js.map +0 -7
- package/cjs/inputs/FileInput/__stories__/Default/index.js +0 -61
- package/cjs/inputs/FileInput/__stories__/Default.js.map +0 -7
- package/cjs/inputs/ImageInput/ImageInput.stories/index.js +0 -51
- package/cjs/inputs/ImageInput/ImageInput.stories.js.map +0 -7
- package/cjs/inputs/ImageInput/__stories__/Default/index.js +0 -63
- package/cjs/inputs/ImageInput/__stories__/Default.js.map +0 -7
- package/cjs/inputs/ImageInput/__stories__/MaxSize/index.js +0 -69
- package/cjs/inputs/ImageInput/__stories__/MaxSize.js.map +0 -7
- package/cjs/inputs/ImageInput/__stories__/WithInvalidImageDimension/index.js +0 -71
- package/cjs/inputs/ImageInput/__stories__/WithInvalidImageDimension.js.map +0 -7
- package/cjs/inputs/ImageInput/__stories__/WithInvalidImageSize/index.js +0 -68
- package/cjs/inputs/ImageInput/__stories__/WithInvalidImageSize.js.map +0 -7
- package/cjs/inputs/Input/Input.stories/index.js +0 -72
- package/cjs/inputs/Input/Input.stories.js.map +0 -7
- package/cjs/inputs/Input/__stories__/AFM/index.js +0 -63
- package/cjs/inputs/Input/__stories__/AFM.js.map +0 -7
- package/cjs/inputs/Input/__stories__/Boolean/index.js +0 -64
- package/cjs/inputs/Input/__stories__/Boolean.js.map +0 -7
- package/cjs/inputs/Input/__stories__/IBAN/index.js +0 -64
- package/cjs/inputs/Input/__stories__/IBAN.js.map +0 -7
- package/cjs/inputs/Input/__stories__/Integer/index.js +0 -78
- package/cjs/inputs/Input/__stories__/Integer.js.map +0 -7
- package/cjs/inputs/Input/__stories__/LandlineNumber/index.js +0 -67
- package/cjs/inputs/Input/__stories__/LandlineNumber.js.map +0 -7
- package/cjs/inputs/Input/__stories__/MobilePhone/index.js +0 -67
- package/cjs/inputs/Input/__stories__/MobilePhone.js.map +0 -7
- package/cjs/inputs/Input/__stories__/PhoneNumber/index.js +0 -66
- package/cjs/inputs/Input/__stories__/PhoneNumber.js.map +0 -7
- package/cjs/inputs/Input/__stories__/PostalCode/index.js +0 -64
- package/cjs/inputs/Input/__stories__/PostalCode.js.map +0 -7
- package/cjs/inputs/Input/__stories__/String/index.js +0 -64
- package/cjs/inputs/Input/__stories__/String.js.map +0 -7
- package/cjs/inputs/Input/__stories__/TextWithLimit/index.js +0 -64
- package/cjs/inputs/Input/__stories__/TextWithLimit.js.map +0 -7
- package/cjs/inputs/Input/inputsInputScenarios/index.js +0 -439
- package/cjs/inputs/Input/inputsInputScenarios.js.map +0 -7
- package/cjs/inputs/Label/Label.stories/index.js +0 -45
- package/cjs/inputs/Label/Label.stories.js.map +0 -7
- package/cjs/inputs/Label/__stories__/Default/index.js +0 -72
- package/cjs/inputs/Label/__stories__/Default.js.map +0 -7
- package/cjs/inputs/OtpInput/OtpInput.stories/index.js +0 -45
- package/cjs/inputs/OtpInput/OtpInput.stories.js.map +0 -7
- package/cjs/inputs/OtpInput/__stories__/Default/index.js +0 -64
- package/cjs/inputs/OtpInput/__stories__/Default.js.map +0 -7
- package/cjs/inputs/Radio/Radio.stories/index.js +0 -51
- package/cjs/inputs/Radio/Radio.stories.js.map +0 -7
- package/cjs/inputs/Radio/__stories__/Conditional/index.js +0 -133
- package/cjs/inputs/Radio/__stories__/Conditional.js.map +0 -7
- package/cjs/inputs/Radio/__stories__/Default/index.js +0 -81
- package/cjs/inputs/Radio/__stories__/Default.js.map +0 -7
- package/cjs/inputs/Radio/__stories__/WithDivider/index.js +0 -82
- package/cjs/inputs/Radio/__stories__/WithDivider.js.map +0 -7
- package/cjs/inputs/Select/Select.stories/index.js +0 -45
- package/cjs/inputs/Select/Select.stories.js.map +0 -7
- package/cjs/inputs/Select/__stories__/Default/index.js +0 -86
- package/cjs/inputs/Select/__stories__/Default.js.map +0 -7
- package/inputs/AutoCompleteInput/AutoComplete.stories/index.js +0 -14
- package/inputs/AutoCompleteInput/AutoComplete.stories/package.json +0 -6
- package/inputs/AutoCompleteInput/AutoComplete.stories.js.map +0 -7
- package/inputs/AutoCompleteInput/__stories__/Default/index.js +0 -50
- package/inputs/AutoCompleteInput/__stories__/Default/package.json +0 -6
- package/inputs/AutoCompleteInput/__stories__/Default.js.map +0 -7
- package/inputs/AutoCompleteInput/__stories__/Multiple/index.js +0 -50
- package/inputs/AutoCompleteInput/__stories__/Multiple/package.json +0 -6
- package/inputs/AutoCompleteInput/__stories__/Multiple.js.map +0 -7
- package/inputs/Checkboxes/Checkboxes.stories/index.js +0 -16
- package/inputs/Checkboxes/Checkboxes.stories/package.json +0 -6
- package/inputs/Checkboxes/Checkboxes.stories.js.map +0 -7
- package/inputs/Checkboxes/__stories__/Conditional/index.js +0 -100
- package/inputs/Checkboxes/__stories__/Conditional/package.json +0 -6
- package/inputs/Checkboxes/__stories__/Conditional.js.map +0 -7
- package/inputs/Checkboxes/__stories__/Default/index.js +0 -44
- package/inputs/Checkboxes/__stories__/Default/package.json +0 -6
- package/inputs/Checkboxes/__stories__/Default.js.map +0 -7
- package/inputs/Checkboxes/__stories__/WithDivider/index.js +0 -45
- package/inputs/Checkboxes/__stories__/WithDivider/package.json +0 -6
- package/inputs/Checkboxes/__stories__/WithDivider.js.map +0 -7
- package/inputs/DateInput/DateInput.stories/index.js +0 -12
- package/inputs/DateInput/DateInput.stories/package.json +0 -6
- package/inputs/DateInput/DateInput.stories.js.map +0 -7
- package/inputs/DateInput/__stories__/Default/index.js +0 -28
- package/inputs/DateInput/__stories__/Default.js.map +0 -7
- package/inputs/FileInput/FileInput.stories/index.js +0 -12
- package/inputs/FileInput/FileInput.stories/package.json +0 -6
- package/inputs/FileInput/FileInput.stories.js.map +0 -7
- package/inputs/FileInput/__stories__/Default/index.js +0 -28
- package/inputs/FileInput/__stories__/Default/package.json +0 -6
- package/inputs/FileInput/__stories__/Default.js.map +0 -7
- package/inputs/ImageInput/ImageInput.stories/index.js +0 -16
- package/inputs/ImageInput/ImageInput.stories/package.json +0 -6
- package/inputs/ImageInput/ImageInput.stories.js.map +0 -7
- package/inputs/ImageInput/__stories__/Default/index.js +0 -30
- package/inputs/ImageInput/__stories__/Default/package.json +0 -6
- package/inputs/ImageInput/__stories__/Default.js.map +0 -7
- package/inputs/ImageInput/__stories__/MaxSize/index.js +0 -36
- package/inputs/ImageInput/__stories__/MaxSize/package.json +0 -6
- package/inputs/ImageInput/__stories__/MaxSize.js.map +0 -7
- package/inputs/ImageInput/__stories__/WithInvalidImageDimension/index.js +0 -38
- package/inputs/ImageInput/__stories__/WithInvalidImageDimension/package.json +0 -6
- package/inputs/ImageInput/__stories__/WithInvalidImageDimension.js.map +0 -7
- package/inputs/ImageInput/__stories__/WithInvalidImageSize/index.js +0 -35
- package/inputs/ImageInput/__stories__/WithInvalidImageSize/package.json +0 -6
- package/inputs/ImageInput/__stories__/WithInvalidImageSize.d.ts +0 -3
- package/inputs/ImageInput/__stories__/WithInvalidImageSize.js.map +0 -7
- package/inputs/Input/Input.stories/index.js +0 -30
- package/inputs/Input/Input.stories.js.map +0 -7
- package/inputs/Input/__stories__/AFM/index.js +0 -30
- package/inputs/Input/__stories__/AFM/package.json +0 -6
- package/inputs/Input/__stories__/AFM.js.map +0 -7
- package/inputs/Input/__stories__/Boolean/index.js +0 -31
- package/inputs/Input/__stories__/Boolean/package.json +0 -6
- package/inputs/Input/__stories__/Boolean.js.map +0 -7
- package/inputs/Input/__stories__/IBAN/index.js +0 -31
- package/inputs/Input/__stories__/IBAN/package.json +0 -6
- package/inputs/Input/__stories__/IBAN.js.map +0 -7
- package/inputs/Input/__stories__/Integer/index.js +0 -45
- package/inputs/Input/__stories__/Integer/package.json +0 -6
- package/inputs/Input/__stories__/Integer.js.map +0 -7
- package/inputs/Input/__stories__/LandlineNumber/index.js +0 -34
- package/inputs/Input/__stories__/LandlineNumber/package.json +0 -6
- package/inputs/Input/__stories__/LandlineNumber.js.map +0 -7
- package/inputs/Input/__stories__/MobilePhone/index.js +0 -34
- package/inputs/Input/__stories__/MobilePhone/package.json +0 -6
- package/inputs/Input/__stories__/MobilePhone.js.map +0 -7
- package/inputs/Input/__stories__/PhoneNumber/index.js +0 -33
- package/inputs/Input/__stories__/PhoneNumber/package.json +0 -6
- package/inputs/Input/__stories__/PhoneNumber.js.map +0 -7
- package/inputs/Input/__stories__/PostalCode/index.js +0 -31
- package/inputs/Input/__stories__/PostalCode/package.json +0 -6
- package/inputs/Input/__stories__/PostalCode.js.map +0 -7
- package/inputs/Input/__stories__/String/index.js +0 -31
- package/inputs/Input/__stories__/String/package.json +0 -6
- package/inputs/Input/__stories__/String.js.map +0 -7
- package/inputs/Input/__stories__/TextWithLimit/index.js +0 -31
- package/inputs/Input/__stories__/TextWithLimit/package.json +0 -6
- package/inputs/Input/__stories__/TextWithLimit.js.map +0 -7
- package/inputs/Input/inputsInputScenarios/index.js +0 -406
- package/inputs/Input/inputsInputScenarios/package.json +0 -6
- package/inputs/Input/inputsInputScenarios.d.ts +0 -57
- package/inputs/Input/inputsInputScenarios.js.map +0 -7
- package/inputs/Label/Label.stories/index.js +0 -12
- package/inputs/Label/Label.stories/package.json +0 -6
- package/inputs/Label/Label.stories.js.map +0 -7
- package/inputs/Label/__stories__/Default/index.js +0 -39
- package/inputs/Label/__stories__/Default/package.json +0 -6
- package/inputs/Label/__stories__/Default.js.map +0 -7
- package/inputs/OtpInput/OtpInput.stories/index.js +0 -12
- package/inputs/OtpInput/OtpInput.stories/package.json +0 -6
- package/inputs/OtpInput/OtpInput.stories.js.map +0 -7
- package/inputs/OtpInput/__stories__/Default/index.js +0 -31
- package/inputs/OtpInput/__stories__/Default/package.json +0 -6
- package/inputs/OtpInput/__stories__/Default.js.map +0 -7
- package/inputs/Radio/Radio.stories/index.js +0 -16
- package/inputs/Radio/Radio.stories/package.json +0 -6
- package/inputs/Radio/Radio.stories.js.map +0 -7
- package/inputs/Radio/__stories__/Conditional/index.js +0 -100
- package/inputs/Radio/__stories__/Conditional/package.json +0 -6
- package/inputs/Radio/__stories__/Conditional.js.map +0 -7
- package/inputs/Radio/__stories__/Default/index.js +0 -48
- package/inputs/Radio/__stories__/Default/package.json +0 -6
- package/inputs/Radio/__stories__/Default.js.map +0 -7
- package/inputs/Radio/__stories__/WithDivider/index.js +0 -49
- package/inputs/Radio/__stories__/WithDivider/package.json +0 -6
- package/inputs/Radio/__stories__/WithDivider.js.map +0 -7
- package/inputs/Select/Select.stories/index.js +0 -12
- package/inputs/Select/Select.stories/package.json +0 -6
- package/inputs/Select/Select.stories.js.map +0 -7
- package/inputs/Select/__stories__/Default/index.js +0 -53
- package/inputs/Select/__stories__/Default/package.json +0 -6
- package/inputs/Select/__stories__/Default.js.map +0 -7
- package/lazy.d.ts +0 -77
- package/lazy.js.map +0 -7
- package/registry.d.ts +0 -70
- package/registry.js.map +0 -7
- package/src/Field/index.mdx +0 -6
- package/src/inputs/ImageInput/index.mdx +0 -19
- package/src/inputs/Input/index.mdx +0 -95
- package/src/inputs/Input/inputsInputScenarios.ts +0 -405
- package/src/inputs/Label/index.mdx +0 -0
|
@@ -3,13 +3,11 @@ id: ask-users-recursive
|
|
|
3
3
|
title: Ask users for recursive data
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
# MultiplicityField
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
be used to input a fixed, a minimum, and a maximum length of instances.
|
|
12
|
-
</LeadText>
|
|
8
|
+
Multiplicity & FieldArray fields allow users to input data described by a
|
|
9
|
+
particular schema for an arbitrary number of times until they are done. It can
|
|
10
|
+
be used to input a fixed, a minimum, and a maximum length of instances.
|
|
13
11
|
|
|
14
12
|
## What we are trying to achieve
|
|
15
13
|
|
|
@@ -32,7 +30,7 @@ properties for a data entity like a citizen and their personal details, and it
|
|
|
32
30
|
can be reused internally multiple times by `@digigov/form` to generate data
|
|
33
31
|
objects based on this schema.
|
|
34
32
|
|
|
35
|
-
## Accessibility &
|
|
33
|
+
## Accessibility & Usability
|
|
36
34
|
|
|
37
35
|
We aim to have semantically correct and valid forms, and as a result we cannot
|
|
38
36
|
mix form-related HTML elements, like `form`, `input`, `label` with generic ones,
|
|
@@ -108,43 +106,45 @@ This field is the most complex component we currently offer, and it uses the
|
|
|
108
106
|
react-hook-form under the hood. First, let's take a look at what it looks like, and then we can
|
|
109
107
|
break down its functionality and how you can use it.
|
|
110
108
|
|
|
111
|
-
```jsx
|
|
109
|
+
```jsx
|
|
112
110
|
import React from 'react';
|
|
113
111
|
import Form, { Field } from '@digigov/form';
|
|
114
112
|
import Button from '@digigov/ui/form/Button';
|
|
115
113
|
|
|
116
|
-
export
|
|
114
|
+
export function SimpleForm() {
|
|
117
115
|
return (
|
|
118
116
|
<Form>
|
|
119
117
|
<Field
|
|
120
118
|
key="vehicles"
|
|
121
119
|
name="vehicles"
|
|
122
|
-
|
|
120
|
+
multiplicity={true}
|
|
121
|
+
label={{ primary: 'Οχήματα' }}
|
|
123
122
|
type="array"
|
|
124
123
|
extra={{
|
|
125
124
|
border: true,
|
|
126
125
|
label: {
|
|
127
126
|
object: {
|
|
128
|
-
title: '
|
|
129
|
-
title_added: '
|
|
130
|
-
add: '
|
|
131
|
-
delete: '
|
|
127
|
+
title: 'Οχήματα',
|
|
128
|
+
title_added: 'Τα οχήματα που έχετε που έχετε προσθέσει',
|
|
129
|
+
add: 'Προσθήκη',
|
|
130
|
+
delete: 'Αφαίρεση',
|
|
132
131
|
},
|
|
133
132
|
question: {
|
|
134
|
-
title: '
|
|
133
|
+
title: 'Θέλετε να προσθέσετε και άλλα οχήματα;',
|
|
135
134
|
objectLabel: {
|
|
136
|
-
primary: '
|
|
137
|
-
secondary:
|
|
135
|
+
primary: 'Προσθέστε άλλο ένα όχημα',
|
|
136
|
+
secondary:
|
|
137
|
+
'Συμπληρώστε τα παρακάτω πεδία και πατήστε "Προσθήκη".',
|
|
138
138
|
},
|
|
139
|
-
yes: '
|
|
140
|
-
no: '
|
|
139
|
+
yes: 'Ναι',
|
|
140
|
+
no: 'Όχι',
|
|
141
141
|
},
|
|
142
142
|
},
|
|
143
143
|
of: {
|
|
144
144
|
type: 'object',
|
|
145
145
|
label: {
|
|
146
|
-
primary: '
|
|
147
|
-
secondary: '
|
|
146
|
+
primary: 'Περιγραφή Οχήματος',
|
|
147
|
+
secondary: 'Αλλάξτε τα στοιχεία του οχήματος',
|
|
148
148
|
},
|
|
149
149
|
extra: {
|
|
150
150
|
fields: [
|
|
@@ -152,14 +152,14 @@ export default function SimpleForm() {
|
|
|
152
152
|
key: 'registration_date',
|
|
153
153
|
type: 'date',
|
|
154
154
|
required: true,
|
|
155
|
-
label: { primary: '
|
|
155
|
+
label: { primary: 'Ημερομηνία Κυκλοφορίας' },
|
|
156
156
|
},
|
|
157
157
|
{
|
|
158
158
|
key: 'make',
|
|
159
159
|
type: 'string',
|
|
160
160
|
required: true,
|
|
161
161
|
label: {
|
|
162
|
-
primary: '
|
|
162
|
+
primary: 'Κατασκευαστής',
|
|
163
163
|
},
|
|
164
164
|
},
|
|
165
165
|
{
|
|
@@ -167,7 +167,7 @@ export default function SimpleForm() {
|
|
|
167
167
|
type: 'string',
|
|
168
168
|
required: true,
|
|
169
169
|
label: {
|
|
170
|
-
primary: '
|
|
170
|
+
primary: 'Μοντέλο',
|
|
171
171
|
},
|
|
172
172
|
},
|
|
173
173
|
],
|
|
@@ -176,10 +176,11 @@ export default function SimpleForm() {
|
|
|
176
176
|
}}
|
|
177
177
|
required
|
|
178
178
|
/>
|
|
179
|
-
<Button type="submit"
|
|
179
|
+
<Button type="submit">Συνέχεια</Button>
|
|
180
180
|
</Form>
|
|
181
181
|
);
|
|
182
182
|
}
|
|
183
|
+
export default SimpleForm;
|
|
183
184
|
```
|
|
184
185
|
|
|
185
186
|
### How to use it
|
|
@@ -196,7 +197,7 @@ export default function MultiplicityForm() {
|
|
|
196
197
|
return (
|
|
197
198
|
<Form>
|
|
198
199
|
{/* this is where all fields will eventually be rendered */}
|
|
199
|
-
<Button type="submit"
|
|
200
|
+
<Button type="submit">Συνέχεια</Button>
|
|
200
201
|
</Form>
|
|
201
202
|
);
|
|
202
203
|
}
|
|
@@ -209,11 +210,11 @@ are asking users for information about their vehicles, we can also fill in the `
|
|
|
209
210
|
`label.primary`, as well as the `type` and `required`
|
|
210
211
|
props.
|
|
211
212
|
|
|
212
|
-
```jsx
|
|
213
|
+
```jsx pure
|
|
213
214
|
<Field
|
|
214
215
|
key="vehicles"
|
|
215
216
|
name="vehicles"
|
|
216
|
-
label={{ primary: '
|
|
217
|
+
label={{ primary: 'Οχήματα' }}
|
|
217
218
|
type="array"
|
|
218
219
|
required
|
|
219
220
|
/>
|
|
@@ -232,14 +233,14 @@ inner form, respectively.
|
|
|
232
233
|
Inside the `of` key you can add an `extra` key that will then contain a `fields`
|
|
233
234
|
key describing the field props for all inputs needed.
|
|
234
235
|
|
|
235
|
-
```js
|
|
236
|
+
```js pure
|
|
236
237
|
// this will be used as value for the `extra` prop
|
|
237
238
|
{
|
|
238
239
|
of: {
|
|
239
240
|
type: 'object',
|
|
240
241
|
label: {
|
|
241
|
-
primary: '
|
|
242
|
-
secondary: '
|
|
242
|
+
primary: 'Περιγραφή Οχήματος',
|
|
243
|
+
secondary: 'Αλλάξτε τα στοιχεία του οχήματος',
|
|
243
244
|
},
|
|
244
245
|
extra: {
|
|
245
246
|
fields: [
|
|
@@ -247,14 +248,16 @@ key describing the field props for all inputs needed.
|
|
|
247
248
|
key: 'registration_date',
|
|
248
249
|
type: 'date',
|
|
249
250
|
required: true,
|
|
250
|
-
label: {
|
|
251
|
+
label: {
|
|
252
|
+
primary: 'Ημερομηνία Κυκλοφορίας'
|
|
253
|
+
},
|
|
251
254
|
},
|
|
252
255
|
{
|
|
253
256
|
key: 'make',
|
|
254
257
|
type: 'string',
|
|
255
258
|
required: true,
|
|
256
259
|
label: {
|
|
257
|
-
primary: '
|
|
260
|
+
primary: 'Κατασκευαστής',
|
|
258
261
|
},
|
|
259
262
|
},
|
|
260
263
|
{
|
|
@@ -262,7 +265,7 @@ key describing the field props for all inputs needed.
|
|
|
262
265
|
type: 'string',
|
|
263
266
|
required: true,
|
|
264
267
|
label: {
|
|
265
|
-
primary: '
|
|
268
|
+
primary: 'Μοντέλο',
|
|
266
269
|
},
|
|
267
270
|
},
|
|
268
271
|
],
|
|
@@ -287,14 +290,14 @@ FieldArray instead of the Multiplicity, is to explicitly disable the
|
|
|
287
290
|
multiplicity functionality, by using the `multiplicity={false}` prop.
|
|
288
291
|
|
|
289
292
|
As a result, if you learn how to use one, you can easily use the other, and
|
|
290
|
-
naturally, you can also change their
|
|
293
|
+
naturally, you can also change their behavior by changing a single prop in your
|
|
291
294
|
React code.
|
|
292
295
|
|
|
293
|
-
```jsx
|
|
296
|
+
```jsx pure
|
|
294
297
|
<Field
|
|
295
298
|
key="vehicles"
|
|
296
299
|
name="vehicles"
|
|
297
|
-
label={{ primary: '
|
|
300
|
+
label={{ primary: 'Οχήματα' }}
|
|
298
301
|
type="array"
|
|
299
302
|
// highlight-next-line
|
|
300
303
|
multiplicity={false}
|
|
@@ -305,45 +308,46 @@ React code.
|
|
|
305
308
|
The end result looks very different from Multiplicity at first glance, but you
|
|
306
309
|
can achieve the same results with both of them.
|
|
307
310
|
|
|
308
|
-
```jsx
|
|
311
|
+
```jsx
|
|
309
312
|
import React from 'react';
|
|
310
313
|
import Form, { Field } from '@digigov/form';
|
|
311
314
|
import Button from '@digigov/ui/form/Button';
|
|
312
315
|
|
|
313
|
-
export
|
|
316
|
+
export function SimpleForm() {
|
|
314
317
|
return (
|
|
315
318
|
<Form>
|
|
316
319
|
<Field
|
|
317
320
|
key="vehicles"
|
|
318
321
|
name="vehicles"
|
|
319
|
-
label={{ primary: 'Vehicles' }}
|
|
320
|
-
type="array"
|
|
321
322
|
multiplicity={false}
|
|
323
|
+
editable={true}
|
|
324
|
+
label={{ primary: 'Οχήματα' }}
|
|
325
|
+
type="array"
|
|
322
326
|
extra={{
|
|
323
327
|
border: true,
|
|
324
328
|
label: {
|
|
325
329
|
object: {
|
|
326
|
-
title: '
|
|
327
|
-
title_added: '
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
delete: 'Remove',
|
|
330
|
+
title: 'Οχήματα',
|
|
331
|
+
title_added: 'Τα οχήματα που έχετε που έχετε προσθέσει',
|
|
332
|
+
add: 'Προσθήκη',
|
|
333
|
+
delete: 'Αφαίρεση',
|
|
331
334
|
},
|
|
332
335
|
question: {
|
|
333
|
-
title: '
|
|
336
|
+
title: 'Θέλετε να προσθέσετε και άλλα οχήματα;',
|
|
334
337
|
objectLabel: {
|
|
335
|
-
primary: '
|
|
336
|
-
secondary:
|
|
338
|
+
primary: 'Προσθέστε άλλο ένα όχημα',
|
|
339
|
+
secondary:
|
|
340
|
+
'Συμπληρώστε τα παρακάτω πεδία και πατήστε "Προσθήκη".',
|
|
337
341
|
},
|
|
338
|
-
yes: '
|
|
339
|
-
no: '
|
|
342
|
+
yes: 'Ναι',
|
|
343
|
+
no: 'Όχι',
|
|
340
344
|
},
|
|
341
345
|
},
|
|
342
346
|
of: {
|
|
343
347
|
type: 'object',
|
|
344
348
|
label: {
|
|
345
|
-
primary: '
|
|
346
|
-
secondary: '
|
|
349
|
+
primary: 'Περιγραφή Οχήματος',
|
|
350
|
+
secondary: 'Αλλάξτε τα στοιχεία του οχήματος',
|
|
347
351
|
},
|
|
348
352
|
extra: {
|
|
349
353
|
fields: [
|
|
@@ -351,14 +355,14 @@ export default function SimpleForm() {
|
|
|
351
355
|
key: 'registration_date',
|
|
352
356
|
type: 'date',
|
|
353
357
|
required: true,
|
|
354
|
-
label: { primary: '
|
|
358
|
+
label: { primary: 'Ημερομηνία Κυκλοφορίας' },
|
|
355
359
|
},
|
|
356
360
|
{
|
|
357
361
|
key: 'make',
|
|
358
362
|
type: 'string',
|
|
359
363
|
required: true,
|
|
360
364
|
label: {
|
|
361
|
-
primary: '
|
|
365
|
+
primary: 'Κατασκευαστής',
|
|
362
366
|
},
|
|
363
367
|
},
|
|
364
368
|
{
|
|
@@ -366,7 +370,7 @@ export default function SimpleForm() {
|
|
|
366
370
|
type: 'string',
|
|
367
371
|
required: true,
|
|
368
372
|
label: {
|
|
369
|
-
primary: '
|
|
373
|
+
primary: 'Μοντέλο',
|
|
370
374
|
},
|
|
371
375
|
},
|
|
372
376
|
],
|
|
@@ -375,10 +379,11 @@ export default function SimpleForm() {
|
|
|
375
379
|
}}
|
|
376
380
|
required
|
|
377
381
|
/>
|
|
378
|
-
<Button type="submit"
|
|
382
|
+
<Button type="submit">Συνέχεια</Button>
|
|
379
383
|
</Form>
|
|
380
384
|
);
|
|
381
385
|
}
|
|
386
|
+
export default SimpleForm;
|
|
382
387
|
```
|
|
383
388
|
|
|
384
389
|
## Validating form data
|
|
@@ -396,7 +401,7 @@ should expect to need some length validation sooner than later.
|
|
|
396
401
|
You can easily validate the exact length of the items added to the multipliticy
|
|
397
402
|
array, simply by using the `extra.length` prop.
|
|
398
403
|
|
|
399
|
-
```jsx
|
|
404
|
+
```jsx pure
|
|
400
405
|
<Field
|
|
401
406
|
extra={{
|
|
402
407
|
length: 2,
|
|
@@ -409,45 +414,47 @@ array, simply by using the `extra.length` prop.
|
|
|
409
414
|
The example below will validate this and show all the error messages necessary
|
|
410
415
|
to make sure that the users understand what is going wrong with the process.
|
|
411
416
|
|
|
412
|
-
```jsx
|
|
417
|
+
```jsx
|
|
413
418
|
import React from 'react';
|
|
414
419
|
import Form, { Field } from '@digigov/form';
|
|
415
420
|
import Button from '@digigov/ui/form/Button';
|
|
416
421
|
|
|
417
|
-
export
|
|
422
|
+
export function SimpleForm() {
|
|
418
423
|
return (
|
|
419
424
|
<Form>
|
|
420
425
|
<Field
|
|
421
426
|
key="vehicles"
|
|
422
427
|
name="vehicles"
|
|
423
|
-
label={{ primary: '
|
|
428
|
+
label={{ primary: 'Οχήματα' }}
|
|
424
429
|
type="array"
|
|
425
430
|
multiplicity={true}
|
|
426
431
|
extra={{
|
|
432
|
+
length: 2,
|
|
427
433
|
border: true,
|
|
428
|
-
length: 3,
|
|
429
434
|
label: {
|
|
430
435
|
object: {
|
|
431
|
-
title: '
|
|
432
|
-
title_added: '
|
|
433
|
-
|
|
434
|
-
|
|
436
|
+
title: 'Οχήματα',
|
|
437
|
+
title_added: 'Τα οχήματα που έχετε προσθέσει',
|
|
438
|
+
nothing_added: 'Δεν έχετε προσθέσει κανένα όχημα ακόμα.',
|
|
439
|
+
add: 'Προσθήκη οχήματος',
|
|
440
|
+
delete: 'Αφαίρεση',
|
|
435
441
|
},
|
|
436
442
|
question: {
|
|
437
|
-
title: '
|
|
443
|
+
title: 'Θέλετε να προσθέσετε περισσότερα οχήματα;',
|
|
438
444
|
objectLabel: {
|
|
439
|
-
primary: '
|
|
440
|
-
secondary:
|
|
445
|
+
primary: 'Προσθέστε ακόμα ένα από τα οχήματά σας',
|
|
446
|
+
secondary:
|
|
447
|
+
'Συμπληρώστε τα παρακάτω πεδία και πατήστε "Προσθήκη".',
|
|
441
448
|
},
|
|
442
|
-
yes: '
|
|
443
|
-
no: '
|
|
449
|
+
yes: 'Ναι',
|
|
450
|
+
no: 'Όχι',
|
|
444
451
|
},
|
|
445
452
|
},
|
|
446
453
|
of: {
|
|
447
454
|
type: 'object',
|
|
448
455
|
label: {
|
|
449
|
-
primary: '
|
|
450
|
-
secondary: '
|
|
456
|
+
primary: 'Περιγραφή Οχήματος',
|
|
457
|
+
secondary: 'Αλλάξτε τα στοιχεία του οχήματος',
|
|
451
458
|
},
|
|
452
459
|
extra: {
|
|
453
460
|
fields: [
|
|
@@ -455,14 +462,16 @@ export default function SimpleForm() {
|
|
|
455
462
|
key: 'registration_date',
|
|
456
463
|
type: 'date',
|
|
457
464
|
required: true,
|
|
458
|
-
label: {
|
|
465
|
+
label: {
|
|
466
|
+
primary: 'Ημερομηνία Κυκλοφορίας',
|
|
467
|
+
},
|
|
459
468
|
},
|
|
460
469
|
{
|
|
461
470
|
key: 'make',
|
|
462
471
|
type: 'string',
|
|
463
472
|
required: true,
|
|
464
473
|
label: {
|
|
465
|
-
primary: '
|
|
474
|
+
primary: 'Κατασκευαστής',
|
|
466
475
|
},
|
|
467
476
|
},
|
|
468
477
|
{
|
|
@@ -470,7 +479,7 @@ export default function SimpleForm() {
|
|
|
470
479
|
type: 'string',
|
|
471
480
|
required: true,
|
|
472
481
|
label: {
|
|
473
|
-
primary: '
|
|
482
|
+
primary: 'Μοντέλο',
|
|
474
483
|
},
|
|
475
484
|
},
|
|
476
485
|
],
|
|
@@ -479,10 +488,11 @@ export default function SimpleForm() {
|
|
|
479
488
|
}}
|
|
480
489
|
required
|
|
481
490
|
/>
|
|
482
|
-
<Button type="submit"
|
|
491
|
+
<Button type="submit">Συνέχεια</Button>
|
|
483
492
|
</Form>
|
|
484
493
|
);
|
|
485
494
|
}
|
|
495
|
+
export default SimpleForm;
|
|
486
496
|
```
|
|
487
497
|
|
|
488
498
|
### Min or max length
|
|
@@ -497,7 +507,7 @@ Do not mix and match the exact `length` validation with the `min` or `max`.
|
|
|
497
507
|
|
|
498
508
|
:::
|
|
499
509
|
|
|
500
|
-
```jsx
|
|
510
|
+
```jsx pure
|
|
501
511
|
<Field
|
|
502
512
|
extra={{
|
|
503
513
|
min: 2,
|
|
@@ -511,47 +521,48 @@ Do not mix and match the exact `length` validation with the `min` or `max`.
|
|
|
511
521
|
The example below will validate this and show all the error messages necessary
|
|
512
522
|
to make sure that the users understand what is going wrong with the process.
|
|
513
523
|
|
|
514
|
-
```jsx
|
|
524
|
+
```jsx
|
|
515
525
|
import React from 'react';
|
|
516
526
|
import Form, { Field } from '@digigov/form';
|
|
517
527
|
import Button from '@digigov/ui/form/Button';
|
|
518
528
|
|
|
519
|
-
export
|
|
529
|
+
export function SimpleForm() {
|
|
520
530
|
return (
|
|
521
531
|
<Form>
|
|
522
532
|
<Field
|
|
523
533
|
key="vehicles"
|
|
524
534
|
name="vehicles"
|
|
525
|
-
label={{ primary: '
|
|
535
|
+
label={{ primary: 'Οχήματα' }}
|
|
526
536
|
type="array"
|
|
527
537
|
multiplicity={true}
|
|
528
538
|
extra={{
|
|
529
|
-
border: true,
|
|
530
539
|
min: 2,
|
|
531
540
|
max: 5,
|
|
541
|
+
border: true,
|
|
532
542
|
label: {
|
|
533
543
|
object: {
|
|
534
|
-
title: '
|
|
535
|
-
title_added: '
|
|
536
|
-
nothing_added: '
|
|
537
|
-
add: '
|
|
538
|
-
delete: '
|
|
544
|
+
title: 'Οχήματα',
|
|
545
|
+
title_added: 'Τα οχήματα που έχετε προσθέσει',
|
|
546
|
+
nothing_added: 'Δεν έχετε προσθέσει κανένα όχημα ακόμα.',
|
|
547
|
+
add: 'Προσθήκη οχήματος',
|
|
548
|
+
delete: 'Αφαίρεση',
|
|
539
549
|
},
|
|
540
550
|
question: {
|
|
541
|
-
title: '
|
|
551
|
+
title: 'Θέλετε να προσθέσετε περισσότερα οχήματα;',
|
|
542
552
|
objectLabel: {
|
|
543
|
-
primary: '
|
|
544
|
-
secondary:
|
|
553
|
+
primary: 'Προσθέστε ακόμα ένα από τα οχήματά σας',
|
|
554
|
+
secondary:
|
|
555
|
+
'Συμπληρώστε τα παρακάτω πεδία και πατήστε "Προσθήκη".',
|
|
545
556
|
},
|
|
546
|
-
yes: '
|
|
547
|
-
no: '
|
|
557
|
+
yes: 'Ναι',
|
|
558
|
+
no: 'Όχι',
|
|
548
559
|
},
|
|
549
560
|
},
|
|
550
561
|
of: {
|
|
551
562
|
type: 'object',
|
|
552
563
|
label: {
|
|
553
|
-
primary: '
|
|
554
|
-
secondary: '
|
|
564
|
+
primary: 'Περιγραφή Οχήματος',
|
|
565
|
+
secondary: 'Αλλάξτε τα στοιχεία του οχήματος',
|
|
555
566
|
},
|
|
556
567
|
extra: {
|
|
557
568
|
fields: [
|
|
@@ -559,14 +570,16 @@ export default function SimpleForm() {
|
|
|
559
570
|
key: 'registration_date',
|
|
560
571
|
type: 'date',
|
|
561
572
|
required: true,
|
|
562
|
-
label: {
|
|
573
|
+
label: {
|
|
574
|
+
primary: 'Ημερομηνία Κυκλοφορίας',
|
|
575
|
+
},
|
|
563
576
|
},
|
|
564
577
|
{
|
|
565
578
|
key: 'make',
|
|
566
579
|
type: 'string',
|
|
567
580
|
required: true,
|
|
568
581
|
label: {
|
|
569
|
-
primary: '
|
|
582
|
+
primary: 'Κατασκευαστής',
|
|
570
583
|
},
|
|
571
584
|
},
|
|
572
585
|
{
|
|
@@ -574,7 +587,7 @@ export default function SimpleForm() {
|
|
|
574
587
|
type: 'string',
|
|
575
588
|
required: true,
|
|
576
589
|
label: {
|
|
577
|
-
primary: '
|
|
590
|
+
primary: 'Μοντέλο',
|
|
578
591
|
},
|
|
579
592
|
},
|
|
580
593
|
],
|
|
@@ -583,8 +596,9 @@ export default function SimpleForm() {
|
|
|
583
596
|
}}
|
|
584
597
|
required
|
|
585
598
|
/>
|
|
586
|
-
<Button type="submit"
|
|
599
|
+
<Button type="submit">Συνέχεια</Button>
|
|
587
600
|
</Form>
|
|
588
601
|
);
|
|
589
602
|
}
|
|
603
|
+
export default SimpleForm;
|
|
590
604
|
```
|
|
@@ -34,6 +34,10 @@ test('renders the All MultiplicityField variants', async ({ mount, page }) => {
|
|
|
34
34
|
)
|
|
35
35
|
await page.evaluate(() => document.fonts.ready);
|
|
36
36
|
|
|
37
|
+
// Move the mouse to the top-left corner to avoid random hover issues
|
|
38
|
+
await page.mouse.move(0, 0);
|
|
39
|
+
|
|
40
|
+
|
|
37
41
|
const screenshot = await page.screenshot({ fullPage: true, animations: 'disabled' });
|
|
38
42
|
expect(screenshot).toMatchSnapshot();
|
|
39
43
|
});
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
import { useFieldArray, UseFormReturn } from 'react-hook-form';
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
import
|
|
6
|
-
import AddObjects from '@digigov/form/MultiplicityField/add-objects';
|
|
3
|
+
import { FieldBaseContainer } from '@digigov/form/Field/FieldBaseContainer';
|
|
4
|
+
import { FieldObject } from '@digigov/form/FieldObject';
|
|
5
|
+
import { AddObjects } from '@digigov/form/MultiplicityField/add-objects';
|
|
7
6
|
import {
|
|
8
7
|
MultiplicityProps,
|
|
9
8
|
StashedObject,
|
|
10
9
|
} from '@digigov/form/MultiplicityField/types';
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
import {
|
|
11
|
+
Card,
|
|
12
|
+
CardHeading,
|
|
13
|
+
CardContent,
|
|
14
|
+
CardAction,
|
|
15
|
+
} from '@digigov/ui/content/Card';
|
|
16
|
+
import { Button } from '@digigov/ui/form/Button';
|
|
17
|
+
import { Heading } from '@digigov/ui/typography/Heading';
|
|
17
18
|
|
|
18
19
|
// epeidh einai forwardRef to ref mas to dinei xwrista apo ta props
|
|
19
20
|
export const Multiplicity: React.FC<MultiplicityProps> = ({
|
|
@@ -30,6 +31,7 @@ export const Multiplicity: React.FC<MultiplicityProps> = ({
|
|
|
30
31
|
setValue,
|
|
31
32
|
getValues,
|
|
32
33
|
unregister,
|
|
34
|
+
resetField,
|
|
33
35
|
Field,
|
|
34
36
|
}) => {
|
|
35
37
|
const { fields, append, remove } = useFieldArray({
|
|
@@ -48,7 +50,7 @@ export const Multiplicity: React.FC<MultiplicityProps> = ({
|
|
|
48
50
|
setStashedObjects(newStashedObjects);
|
|
49
51
|
};
|
|
50
52
|
return (
|
|
51
|
-
<
|
|
53
|
+
<FieldBaseContainer
|
|
52
54
|
label={label}
|
|
53
55
|
layout={layout}
|
|
54
56
|
error={
|
|
@@ -56,8 +58,10 @@ export const Multiplicity: React.FC<MultiplicityProps> = ({
|
|
|
56
58
|
? error
|
|
57
59
|
: undefined
|
|
58
60
|
}
|
|
61
|
+
hasError={formState.isSubmitted && !formState.isSubmitting && !!error}
|
|
59
62
|
wrapper="fieldset"
|
|
60
63
|
name={name}
|
|
64
|
+
register={register}
|
|
61
65
|
>
|
|
62
66
|
{stashedObjects.length > 0 ? (
|
|
63
67
|
<div>
|
|
@@ -96,10 +100,11 @@ export const Multiplicity: React.FC<MultiplicityProps> = ({
|
|
|
96
100
|
getValues={getValues}
|
|
97
101
|
unregister={unregister}
|
|
98
102
|
trigger={trigger}
|
|
103
|
+
resetField={resetField}
|
|
99
104
|
clearErrors={clearErrors}
|
|
100
105
|
Field={Field}
|
|
101
106
|
/>
|
|
102
|
-
</
|
|
107
|
+
</FieldBaseContainer>
|
|
103
108
|
);
|
|
104
109
|
};
|
|
105
110
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ErrorOption, UseFormReturn } from 'react-hook-form';
|
|
2
|
-
import { FieldSpec } from '@digigov/form/Field/types';
|
|
3
|
-
import { ControlledFieldProps } from '@digigov/form/Field/types';
|
|
2
|
+
import { FieldSpec, ControlledFieldProps } from '@digigov/form/Field/types';
|
|
4
3
|
|
|
5
4
|
export interface MultiplicityProps
|
|
6
5
|
extends Omit<ControlledFieldProps, 'value' | 'onChange' | 'error' | 'extra'> {
|
|
@@ -13,6 +12,7 @@ export interface MultiplicityProps
|
|
|
13
12
|
setValue: UseFormReturn['setValue'];
|
|
14
13
|
getValues: UseFormReturn['getValues'];
|
|
15
14
|
unregister: UseFormReturn['unregister'];
|
|
15
|
+
resetField?: UseFormReturn['resetField'];
|
|
16
16
|
error?: ErrorOption;
|
|
17
17
|
extra?: Record<string, any>;
|
|
18
18
|
label?: FieldSpec['label'];
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import Questions from '@digigov/form/Questions';
|
|
2
|
+
import doc from './doc.mdx?raw';
|
|
2
3
|
export default {
|
|
3
4
|
title: 'Digigov Form/Questions',
|
|
4
5
|
component: Questions,
|
|
6
|
+
tags: ['autodocs'],
|
|
7
|
+
markdown: doc,
|
|
5
8
|
displayName: 'Questions',
|
|
6
9
|
};
|
|
7
10
|
export { Default } from '@digigov/form/Questions/__stories__/Default';
|
|
@@ -31,7 +31,7 @@ export const Questions: React.FC<QuestionsInterface> = ({
|
|
|
31
31
|
useEffect(() => {
|
|
32
32
|
if (forceStepName !== currentStep.name) {
|
|
33
33
|
const forceStep = steps.find(({ name }) => name === forceStepName);
|
|
34
|
-
forceStep
|
|
34
|
+
if (forceStep) setCurrentStep(forceStep);
|
|
35
35
|
}
|
|
36
36
|
}, [forceStepName]);
|
|
37
37
|
const localData =
|
|
@@ -42,16 +42,16 @@ export const Questions: React.FC<QuestionsInterface> = ({
|
|
|
42
42
|
const submitStep = (stepName, stepData): void => {
|
|
43
43
|
data[stepName] = stepData;
|
|
44
44
|
if (localDraft) {
|
|
45
|
-
isBrowser
|
|
45
|
+
if (isBrowser)
|
|
46
46
|
window.localStorage.setItem(`questions-${name}`, JSON.stringify(data));
|
|
47
47
|
}
|
|
48
48
|
if (onChange) {
|
|
49
|
-
onChange
|
|
49
|
+
onChange(data);
|
|
50
50
|
}
|
|
51
51
|
setData(data);
|
|
52
52
|
const nextStep = getNextStep(currentStep, steps, data);
|
|
53
53
|
if (nextStep) {
|
|
54
|
-
onActiveStep
|
|
54
|
+
if (onActiveStep) onActiveStep(nextStep);
|
|
55
55
|
setCurrentStep(nextStep);
|
|
56
56
|
} else {
|
|
57
57
|
onSubmit(data);
|