@digigov/form 2.0.0-rc.7 → 2.0.2
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/CHANGELOG.md +113 -3
- package/Field/ErrorGroup.d.ts +15 -0
- package/Field/ErrorGroup.js +53 -0
- package/Field/FieldBase.d.ts +1 -1
- package/Field/FieldBase.js +77 -0
- package/Field/FieldBaseContainer.d.ts +2 -2
- package/Field/FieldBaseContainer.js +43 -0
- package/Field/FieldConditional.d.ts +1 -1
- package/Field/FieldConditional.js +45 -0
- package/Field/index.d.ts +1 -1
- package/Field/index.js +70 -68
- package/Field/types.d.ts +61 -11
- package/Field/utils/evaluateFieldWithConditions.d.ts +2 -0
- package/Field/utils/evaluateFieldWithConditions.js +19 -0
- package/Field/utils/resolveField.d.ts +3 -0
- package/Field/utils/resolveField.js +32 -0
- package/Field/utils/useField.d.ts +2 -0
- package/Field/utils/useField.js +47 -0
- package/FieldArray/BaseFieldArray.d.ts +5 -0
- package/FieldArray/BaseFieldArray.js +46 -0
- package/FieldArray/FormDialog/ArrayDisplay/ArrayContainerDisplay.d.ts +9 -0
- package/FieldArray/FormDialog/ArrayDisplay/ArrayContainerDisplay.js +13 -0
- package/FieldArray/FormDialog/ArrayDisplay/ArrayItemDisplay.d.ts +26 -0
- package/FieldArray/FormDialog/ArrayDisplay/ArrayItemDisplay.js +134 -0
- package/FieldArray/FormDialog/ArrayDisplay/ArrayItemHeader.d.ts +5 -0
- package/FieldArray/FormDialog/ArrayDisplay/ArrayItemHeader.js +6 -0
- package/FieldArray/FormDialog/ArrayDisplay/index.d.ts +15 -0
- package/FieldArray/FormDialog/ArrayDisplay/index.js +32 -0
- package/FieldArray/FormDialog/ArrayEditModal.d.ts +24 -0
- package/FieldArray/FormDialog/ArrayEditModal.js +138 -0
- package/FieldArray/FormDialog/index.d.ts +19 -0
- package/FieldArray/FormDialog/index.js +199 -0
- package/FieldArray/index.d.ts +11 -2
- package/FieldArray/index.js +65 -60
- package/FieldObject/index.d.ts +11 -3
- package/FieldObject/index.js +53 -52
- package/Fieldset/FieldsetWithContext.js +27 -0
- package/Fieldset/index.d.ts +2 -2
- package/Fieldset/index.js +18 -32
- package/Fieldset/types.d.ts +3 -2
- package/FormBuilder/index.d.ts +8 -1
- package/FormBuilder/index.js +239 -2
- package/FormContext.d.ts +3 -2
- package/FormContext.js +7 -0
- package/MultiplicityField/add-objects.d.ts +3 -2
- package/MultiplicityField/add-objects.js +107 -0
- package/MultiplicityField/index.d.ts +2 -19
- package/MultiplicityField/index.js +84 -111
- package/MultiplicityField/types.d.ts +19 -0
- package/Questions/Questions.d.ts +1 -1
- package/Questions/Questions.js +48 -0
- package/Questions/QuestionsContext.d.ts +1 -2
- package/Questions/QuestionsContext.js +10 -0
- package/Questions/Step/ReviewStep.js +32 -0
- package/Questions/Step/Step.d.ts +1 -1
- package/Questions/Step/Step.js +39 -0
- package/Questions/Step/StepArrayReview.d.ts +1 -1
- package/Questions/Step/StepArrayReview.js +35 -0
- package/Questions/Step/StepContext.d.ts +1 -2
- package/Questions/Step/StepContext.js +28 -0
- package/Questions/Step/StepDescription.d.ts +1 -1
- package/Questions/Step/StepDescription.js +18 -0
- package/Questions/Step/StepForm.d.ts +2 -2
- package/Questions/Step/StepForm.js +29 -0
- package/Questions/Step/StepQuote.d.ts +1 -1
- package/Questions/Step/StepQuote.js +5 -0
- package/Questions/Step/StepTitle.d.ts +2 -1
- package/Questions/Step/StepTitle.js +25 -0
- package/Questions/Step/getAddMoreFields.d.ts +2 -2
- package/Questions/Step/getAddMoreFields.js +24 -0
- package/Questions/Step/index.d.ts +11 -12
- package/Questions/Step/index.js +13 -13
- package/Questions/Step/types.d.ts +2 -1
- package/Questions/Step/types.js +0 -0
- package/Questions/getNextStep.d.ts +1 -1
- package/Questions/getNextStep.js +13 -0
- package/Questions/index.d.ts +2 -2
- package/Questions/index.js +4 -3
- package/Questions/types.d.ts +2 -1
- package/Questions/types.js +0 -0
- package/hooks/useFieldFocusManager.d.ts +25 -0
- package/hooks/useFieldFocusManager.js +83 -0
- package/hooks/utils.d.ts +18 -0
- package/hooks/utils.js +60 -0
- package/index.d.ts +5 -2
- package/index.js +8 -4
- package/inputs/AutoCompleteInput/index.d.ts +5 -5
- package/inputs/AutoCompleteInput/index.js +42 -44
- package/inputs/Checkboxes/index.d.ts +7 -4
- package/inputs/Checkboxes/index.js +50 -91
- package/inputs/DateInput/index.d.ts +3 -7
- package/inputs/DateInput/index.js +128 -125
- package/inputs/DateTimeInput/index.d.ts +10 -0
- package/inputs/DateTimeInput/index.js +190 -0
- package/inputs/FileInput/index.d.ts +18 -2
- package/inputs/FileInput/index.js +59 -56
- package/inputs/ImageInput/index.d.ts +10 -2
- package/inputs/ImageInput/index.js +94 -74
- package/inputs/Input/index.d.ts +5 -2
- package/inputs/Input/index.js +67 -67
- package/inputs/Label/index.d.ts +2 -4
- package/inputs/Label/index.js +13 -21
- package/inputs/OtpInput/index.d.ts +1 -5
- package/inputs/OtpInput/index.js +122 -139
- package/inputs/Radio/index.d.ts +10 -3
- package/inputs/Radio/index.js +72 -56
- package/inputs/Select/index.d.ts +7 -4
- package/inputs/Select/index.js +23 -30
- package/inputs/index.d.ts +9 -9
- package/inputs/index.js +10 -9
- package/inputs/registry.d.ts +5 -0
- package/inputs/registry.js +80 -0
- package/internal.d.ts +5 -34
- package/internal.js +6 -0
- package/lazy.d.ts +93 -65
- package/lazy.js +163 -0
- package/package.json +12 -13
- package/registry.d.ts +45 -27
- package/registry.js +170 -0
- package/src/Field/ErrorGroup.tsx +84 -0
- package/src/Field/FieldBase.tsx +43 -25
- 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 +92 -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 +370 -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 +241 -0
- package/src/FieldArray/FormDialog/index.tsx +302 -0
- package/src/FieldArray/__stories__/CardsWithError.tsx +110 -0
- package/src/FieldArray/__stories__/Default.tsx +2 -1
- package/src/FieldArray/__stories__/TableWithError.tsx +111 -0
- package/src/FieldArray/__stories__/WithExactLength.tsx +2 -1
- package/src/FieldArray/__stories__/WithModal.tsx +188 -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 +43 -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 +2775 -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 +4 -6
- 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/{Questions/index.mdx → src/Questions/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/src/{index.mdx → 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 -2
- package/src/inputs/AutoCompleteInput/__stories__/Default.tsx +3 -11
- package/src/inputs/AutoCompleteInput/__stories__/Multiple.tsx +3 -10
- package/{cjs/inputs/AutoCompleteInput/index.mdx → src/inputs/AutoCompleteInput/doc.mdx} +2 -13
- package/src/inputs/AutoCompleteInput/index.test.tsx +28 -0
- package/src/inputs/AutoCompleteInput/index.tsx +49 -35
- package/src/inputs/Checkboxes/Checkboxes.stories.js +6 -3
- 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 +32 -0
- package/src/inputs/Checkboxes/index.tsx +106 -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/{index.mdx → doc.mdx} +1 -8
- 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/{inputs/FileInput/index.mdx → src/inputs/FileInput/doc.mdx} +1 -5
- package/src/inputs/FileInput/index.test.tsx +28 -0
- package/src/inputs/FileInput/index.tsx +102 -43
- 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 +105 -52
- package/src/inputs/Input/Input.stories.js +17 -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__/Rate.tsx +25 -0
- 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 +76 -0
- package/src/inputs/Input/index.tsx +55 -35
- 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/{cjs/inputs/OtpInput/index.mdx → src/inputs/OtpInput/doc.mdx} +1 -8
- package/src/inputs/OtpInput/index.test.tsx +24 -0
- package/src/inputs/OtpInput/index.tsx +45 -34
- package/src/inputs/Radio/Radio.stories.js +6 -3
- package/src/inputs/Radio/__stories__/Conditional.tsx +3 -2
- package/src/inputs/Radio/__stories__/Default.tsx +1 -1
- package/src/inputs/Radio/__stories__/WithDivider.tsx +1 -1
- package/{cjs/inputs/Radio/index.mdx → src/inputs/Radio/doc.mdx} +5 -15
- package/src/inputs/Radio/index.test.tsx +32 -0
- package/src/inputs/Radio/index.tsx +93 -12
- package/src/inputs/Select/Select.stories.js +4 -1
- 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 +24 -0
- package/src/inputs/Select/index.tsx +22 -9
- package/src/inputs/registry.ts +86 -0
- package/src/installation.mdx +2 -5
- package/src/internal.ts +2 -31
- package/src/lazy.ts +56 -0
- package/src/registry.ts +179 -0
- package/src/types.tsx +21 -65
- package/src/utils.ts +67 -33
- package/src/validators/index.ts +138 -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 +35 -19
- package/src/validators/utils/iban.ts +2 -2
- package/src/validators/utils/image.ts +2 -2
- package/src/validators/utils/index.ts +15 -6
- 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.d.ts +14 -37
- package/types.js +1 -0
- package/utils.d.ts +4 -1
- package/utils.js +56 -0
- package/validators/index.d.ts +6 -6
- package/validators/index.js +115 -180
- package/validators/types.d.ts +1 -1
- package/validators/types.js +0 -0
- package/validators/utils/afm.js +19 -0
- package/validators/utils/amka.d.ts +6 -0
- package/validators/utils/amka.js +27 -0
- package/validators/utils/date.d.ts +9 -0
- package/validators/utils/date.js +95 -0
- package/validators/utils/datetime.d.ts +9 -0
- package/validators/utils/datetime.js +121 -0
- package/validators/utils/email.d.ts +5 -0
- package/validators/utils/email.js +10 -0
- package/validators/utils/file.d.ts +2 -2
- package/validators/utils/file.js +31 -0
- package/validators/utils/iban.d.ts +2 -2
- package/validators/utils/iban.js +104 -0
- package/validators/utils/image.d.ts +2 -2
- package/validators/utils/image.js +65 -0
- package/validators/utils/index.d.ts +14 -11
- package/validators/utils/index.js +62 -85
- package/validators/utils/int.d.ts +1 -1
- package/validators/utils/int.js +13 -0
- package/validators/utils/number.d.ts +1 -1
- package/validators/utils/number.js +12 -0
- package/validators/utils/otp.d.ts +2 -2
- package/validators/utils/otp.js +21 -0
- package/validators/utils/phone.d.ts +3 -3
- package/validators/utils/phone.js +198 -0
- package/validators/utils/postal_code.d.ts +3 -3
- package/validators/utils/postal_code.js +18 -0
- package/validators/utils/text_limit.d.ts +2 -2
- package/validators/utils/text_limit.js +34 -0
- package/validators/utils/uuid4.js +14 -0
- package/Field/FieldBase/index.js +0 -82
- package/Field/FieldBase/package.json +0 -6
- package/Field/FieldBaseContainer/index.js +0 -40
- package/Field/FieldBaseContainer/package.json +0 -6
- package/Field/FieldConditional/index.js +0 -59
- package/Field/FieldConditional/package.json +0 -6
- package/Field/index.mdx +0 -6
- package/Field/package.json +0 -6
- package/Field/types/index.js +0 -1
- package/Field/types/package.json +0 -6
- package/Field/utils/index.js +0 -153
- package/Field/utils/package.json +0 -6
- 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.d.ts +0 -9
- 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__/Default.d.ts +0 -2
- package/FieldArray/__stories__/WithExactLength/index.js +0 -88
- package/FieldArray/__stories__/WithExactLength/package.json +0 -6
- package/FieldArray/__stories__/WithExactLength.d.ts +0 -2
- package/FieldArray/package.json +0 -6
- package/FieldObject/package.json +0 -6
- package/Fieldset/FieldsetWithContext/index.js +0 -35
- package/Fieldset/FieldsetWithContext/package.json +0 -6
- package/Fieldset/package.json +0 -6
- package/Fieldset/types/index.js +0 -1
- package/Fieldset/types/package.json +0 -6
- package/Form.stories/index.js +0 -3
- package/Form.stories/package.json +0 -6
- package/Form.stories.d.ts +0 -4
- package/FormBuilder/FormBuilder/index.js +0 -152
- package/FormBuilder/FormBuilder/package.json +0 -6
- 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.d.ts +0 -8
- 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/FormBuilder/__stories__/Default.d.ts +0 -3
- package/FormBuilder/package.json +0 -6
- package/FormContext/index.js +0 -5
- package/FormContext/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.d.ts +0 -13
- 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__/Default.d.ts +0 -2
- package/MultiplicityField/__stories__/PreviewDisplay/index.js +0 -72
- package/MultiplicityField/__stories__/PreviewDisplay/package.json +0 -6
- package/MultiplicityField/__stories__/PreviewDisplay.d.ts +0 -2
- package/MultiplicityField/__stories__/WithExactLength/index.js +0 -90
- package/MultiplicityField/__stories__/WithExactLength/package.json +0 -6
- package/MultiplicityField/__stories__/WithExactLength.d.ts +0 -2
- package/MultiplicityField/__stories__/WithMaxLength/index.js +0 -93
- package/MultiplicityField/__stories__/WithMaxLength/package.json +0 -6
- package/MultiplicityField/__stories__/WithMaxLength.d.ts +0 -2
- package/MultiplicityField/__stories__/WithMinAndMaxLength/index.js +0 -94
- package/MultiplicityField/__stories__/WithMinAndMaxLength/package.json +0 -6
- package/MultiplicityField/__stories__/WithMinAndMaxLength.d.ts +0 -2
- package/MultiplicityField/__stories__/WithMinLength/index.js +0 -93
- package/MultiplicityField/__stories__/WithMinLength/package.json +0 -6
- package/MultiplicityField/__stories__/WithMinLength.d.ts +0 -2
- package/MultiplicityField/add-objects/index.js +0 -148
- package/MultiplicityField/add-objects/package.json +0 -6
- package/MultiplicityField/package.json +0 -6
- package/Questions/Questions/index.js +0 -75
- package/Questions/Questions/package.json +0 -6
- package/Questions/Questions.stories/index.js +0 -7
- package/Questions/Questions.stories/package.json +0 -6
- package/Questions/Questions.stories.d.ts +0 -8
- package/Questions/QuestionsContext/index.js +0 -11
- package/Questions/QuestionsContext/package.json +0 -6
- package/Questions/Step/ReviewStep/index.js +0 -50
- package/Questions/Step/ReviewStep/package.json +0 -6
- package/Questions/Step/Step/index.js +0 -62
- package/Questions/Step/Step/package.json +0 -6
- package/Questions/Step/StepArrayReview/index.js +0 -46
- package/Questions/Step/StepArrayReview/package.json +0 -6
- package/Questions/Step/StepContext/index.js +0 -27
- package/Questions/Step/StepContext/package.json +0 -6
- package/Questions/Step/StepDescription/index.js +0 -24
- package/Questions/Step/StepDescription/package.json +0 -6
- package/Questions/Step/StepForm/index.js +0 -44
- package/Questions/Step/StepForm/package.json +0 -6
- package/Questions/Step/StepQuote/index.js +0 -10
- package/Questions/Step/StepQuote/package.json +0 -6
- package/Questions/Step/StepTitle/index.js +0 -41
- package/Questions/Step/StepTitle/package.json +0 -6
- package/Questions/Step/getAddMoreFields/index.js +0 -21
- package/Questions/Step/getAddMoreFields/package.json +0 -6
- package/Questions/Step/package.json +0 -6
- package/Questions/Step/types/index.js +0 -1
- package/Questions/Step/types/package.json +0 -6
- 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/__stories__/Default.d.ts +0 -3
- package/Questions/getNextStep/index.js +0 -20
- package/Questions/getNextStep/package.json +0 -6
- package/Questions/index.spec/index.js +0 -59
- package/Questions/index.spec/package.json +0 -6
- package/Questions/index.spec.d.ts +0 -1
- package/Questions/package.json +0 -6
- package/Questions/types/index.js +0 -1
- package/Questions/types/package.json +0 -6
- package/cjs/Field/FieldBase/index.js +0 -89
- package/cjs/Field/FieldBaseContainer/index.js +0 -47
- package/cjs/Field/FieldConditional/index.js +0 -66
- package/cjs/Field/index.js +0 -80
- package/cjs/Field/index.mdx +0 -6
- package/cjs/Field/types/index.js +0 -5
- package/cjs/Field/utils/index.js +0 -162
- 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/FieldArray/index.js +0 -68
- package/cjs/FieldObject/index.js +0 -64
- package/cjs/Fieldset/FieldsetWithContext/index.js +0 -45
- package/cjs/Fieldset/index.js +0 -44
- package/cjs/Fieldset/types/index.js +0 -5
- 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/FormBuilder/index.js +0 -8
- package/cjs/FormContext/index.js +0 -11
- 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/MultiplicityField/add-objects/index.js +0 -155
- package/cjs/MultiplicityField/index.js +0 -123
- package/cjs/Questions/Questions/index.js +0 -85
- package/cjs/Questions/Questions.stories/index.js +0 -26
- package/cjs/Questions/QuestionsContext/index.js +0 -17
- package/cjs/Questions/Step/ReviewStep/index.js +0 -60
- package/cjs/Questions/Step/Step/index.js +0 -72
- package/cjs/Questions/Step/StepArrayReview/index.js +0 -56
- package/cjs/Questions/Step/StepContext/index.js +0 -33
- package/cjs/Questions/Step/StepDescription/index.js +0 -34
- package/cjs/Questions/Step/StepForm/index.js +0 -54
- package/cjs/Questions/Step/StepQuote/index.js +0 -17
- package/cjs/Questions/Step/StepTitle/index.js +0 -51
- package/cjs/Questions/Step/getAddMoreFields/index.js +0 -27
- package/cjs/Questions/Step/index.js +0 -143
- package/cjs/Questions/Step/types/index.js +0 -5
- package/cjs/Questions/__snapshots__/index.spec.tsx.snap +0 -596
- package/cjs/Questions/__stories__/Default/index.js +0 -113
- package/cjs/Questions/getNextStep/index.js +0 -26
- package/cjs/Questions/index.js +0 -21
- package/cjs/Questions/index.mdx +0 -415
- package/cjs/Questions/index.spec/index.js +0 -63
- package/cjs/Questions/types/index.js +0 -5
- package/cjs/create-simple-form.mdx +0 -539
- package/cjs/index.js +0 -22
- package/cjs/index.mdx +0 -51
- package/cjs/inputs/AutoCompleteInput/AutoComplete.stories/index.js +0 -38
- package/cjs/inputs/AutoCompleteInput/__stories__/Default/index.js +0 -51
- package/cjs/inputs/AutoCompleteInput/__stories__/Multiple/index.js +0 -52
- package/cjs/inputs/AutoCompleteInput/index.js +0 -55
- 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 -103
- 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.js +0 -101
- package/cjs/inputs/Checkboxes/index.mdx +0 -33
- 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/DateInput/index.js +0 -141
- package/cjs/inputs/DateInput/index.mdx +0 -23
- 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/FileInput/index.js +0 -68
- package/cjs/inputs/FileInput/index.mdx +0 -19
- 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/ImageInput/index.js +0 -86
- package/cjs/inputs/ImageInput/index.mdx +0 -19
- 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.js +0 -76
- package/cjs/inputs/Input/index.mdx +0 -95
- 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.js +0 -29
- package/cjs/inputs/OtpInput/OtpInput.stories/index.js +0 -26
- package/cjs/inputs/OtpInput/__stories__/Default/index.js +0 -39
- package/cjs/inputs/OtpInput/index.js +0 -151
- 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 -103
- 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.js +0 -64
- 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/inputs/Select/index.js +0 -38
- package/cjs/inputs/Select/index.mdx +0 -17
- package/cjs/inputs/index.js +0 -69
- package/cjs/installation.mdx +0 -68
- package/cjs/internal/index.js +0 -348
- package/cjs/lazy/index.js +0 -517
- package/cjs/registry/index.js +0 -147
- package/cjs/types/index.js +0 -5
- package/cjs/utils/index.js +0 -87
- package/cjs/validators/index.js +0 -193
- package/cjs/validators/types/index.js +0 -5
- package/cjs/validators/utils/afm/index.js +0 -38
- package/cjs/validators/utils/file/index.js +0 -43
- package/cjs/validators/utils/iban/index.js +0 -123
- package/cjs/validators/utils/image/index.js +0 -126
- package/cjs/validators/utils/index.js +0 -204
- package/cjs/validators/utils/int/index.js +0 -26
- package/cjs/validators/utils/number/index.js +0 -22
- package/cjs/validators/utils/otp/index.js +0 -32
- package/cjs/validators/utils/phone/index.js +0 -143
- package/cjs/validators/utils/postal_code/index.js +0 -34
- package/cjs/validators/utils/text_limit/index.js +0 -54
- package/cjs/validators/utils/uuid4/index.js +0 -25
- package/cjs/validators/validators.spec/index.js +0 -87
- package/create-simple-form.mdx +0 -539
- package/index.mdx +0 -51
- package/inputs/AutoCompleteInput/AutoComplete.stories/index.js +0 -8
- package/inputs/AutoCompleteInput/AutoComplete.stories/package.json +0 -6
- package/inputs/AutoCompleteInput/AutoComplete.stories.d.ts +0 -9
- package/inputs/AutoCompleteInput/__stories__/Default/index.js +0 -44
- package/inputs/AutoCompleteInput/__stories__/Default/package.json +0 -6
- package/inputs/AutoCompleteInput/__stories__/Default.d.ts +0 -3
- package/inputs/AutoCompleteInput/__stories__/Multiple/index.js +0 -45
- package/inputs/AutoCompleteInput/__stories__/Multiple/package.json +0 -6
- package/inputs/AutoCompleteInput/__stories__/Multiple.d.ts +0 -3
- package/inputs/AutoCompleteInput/index.mdx +0 -29
- package/inputs/AutoCompleteInput/package.json +0 -6
- package/inputs/Checkboxes/Checkboxes.stories/index.js +0 -9
- package/inputs/Checkboxes/Checkboxes.stories/package.json +0 -6
- package/inputs/Checkboxes/Checkboxes.stories.d.ts +0 -10
- package/inputs/Checkboxes/Checkboxes.stories.playwright.json +0 -85
- package/inputs/Checkboxes/__stories__/Conditional/index.js +0 -93
- package/inputs/Checkboxes/__stories__/Conditional/package.json +0 -6
- package/inputs/Checkboxes/__stories__/Conditional.d.ts +0 -3
- package/inputs/Checkboxes/__stories__/Default/index.js +0 -40
- package/inputs/Checkboxes/__stories__/Default/package.json +0 -6
- package/inputs/Checkboxes/__stories__/Default.d.ts +0 -3
- package/inputs/Checkboxes/__stories__/WithDivider/index.js +0 -41
- package/inputs/Checkboxes/__stories__/WithDivider/package.json +0 -6
- package/inputs/Checkboxes/__stories__/WithDivider.d.ts +0 -3
- package/inputs/Checkboxes/index.mdx +0 -33
- package/inputs/Checkboxes/package.json +0 -6
- package/inputs/DateInput/DateInput.stories/index.js +0 -7
- package/inputs/DateInput/DateInput.stories/package.json +0 -6
- package/inputs/DateInput/DateInput.stories.d.ts +0 -8
- package/inputs/DateInput/DateInput.stories.playwright.json +0 -72
- package/inputs/DateInput/__stories__/Default/index.js +0 -23
- package/inputs/DateInput/__stories__/Default/package.json +0 -6
- package/inputs/DateInput/__stories__/Default.d.ts +0 -3
- package/inputs/DateInput/index.mdx +0 -23
- package/inputs/DateInput/package.json +0 -6
- package/inputs/FileInput/FileInput.stories/index.js +0 -7
- package/inputs/FileInput/FileInput.stories/package.json +0 -6
- package/inputs/FileInput/FileInput.stories.d.ts +0 -8
- package/inputs/FileInput/FileInput.stories.playwright.json +0 -75
- package/inputs/FileInput/__stories__/Default/index.js +0 -20
- package/inputs/FileInput/__stories__/Default/package.json +0 -6
- package/inputs/FileInput/__stories__/Default.d.ts +0 -3
- package/inputs/FileInput/package.json +0 -6
- package/inputs/ImageInput/ImageInput.stories/index.js +0 -9
- package/inputs/ImageInput/ImageInput.stories/package.json +0 -6
- package/inputs/ImageInput/ImageInput.stories.d.ts +0 -10
- 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__/Default.d.ts +0 -3
- package/inputs/ImageInput/__stories__/WithInvalidImageDimension/index.js +0 -36
- package/inputs/ImageInput/__stories__/WithInvalidImageDimension/package.json +0 -6
- package/inputs/ImageInput/__stories__/WithInvalidImageDimension.d.ts +0 -3
- 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/ImageInput/index.mdx +0 -19
- package/inputs/ImageInput/package.json +0 -6
- package/inputs/Input/Input.stories/index.js +0 -16
- package/inputs/Input/Input.stories/package.json +0 -6
- package/inputs/Input/Input.stories.d.ts +0 -17
- 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__/AFM.d.ts +0 -3
- package/inputs/Input/__stories__/Boolean/index.js +0 -23
- package/inputs/Input/__stories__/Boolean/package.json +0 -6
- package/inputs/Input/__stories__/Boolean.d.ts +0 -3
- 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__/IBAN.d.ts +0 -3
- package/inputs/Input/__stories__/Integer/index.js +0 -31
- package/inputs/Input/__stories__/Integer/package.json +0 -6
- package/inputs/Input/__stories__/Integer.d.ts +0 -3
- package/inputs/Input/__stories__/LandlineNumber/index.js +0 -26
- package/inputs/Input/__stories__/LandlineNumber/package.json +0 -6
- package/inputs/Input/__stories__/LandlineNumber.d.ts +0 -3
- package/inputs/Input/__stories__/MobilePhone/index.js +0 -26
- package/inputs/Input/__stories__/MobilePhone/package.json +0 -6
- package/inputs/Input/__stories__/MobilePhone.d.ts +0 -3
- package/inputs/Input/__stories__/PhoneNumber/index.js +0 -25
- package/inputs/Input/__stories__/PhoneNumber/package.json +0 -6
- package/inputs/Input/__stories__/PhoneNumber.d.ts +0 -3
- package/inputs/Input/__stories__/PostalCode/index.js +0 -25
- package/inputs/Input/__stories__/PostalCode/package.json +0 -6
- package/inputs/Input/__stories__/PostalCode.d.ts +0 -3
- 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 -95
- package/inputs/Input/package.json +0 -6
- package/inputs/Label/Label.stories/index.js +0 -7
- package/inputs/Label/Label.stories/package.json +0 -6
- package/inputs/Label/Label.stories.d.ts +0 -8
- 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/__stories__/Default.d.ts +0 -3
- package/inputs/Label/package.json +0 -6
- package/inputs/OtpInput/OtpInput.stories/index.js +0 -7
- package/inputs/OtpInput/OtpInput.stories/package.json +0 -6
- package/inputs/OtpInput/OtpInput.stories.d.ts +0 -8
- package/inputs/OtpInput/__stories__/Default/index.js +0 -29
- package/inputs/OtpInput/__stories__/Default/package.json +0 -6
- package/inputs/OtpInput/__stories__/Default.d.ts +0 -3
- package/inputs/OtpInput/index.mdx +0 -23
- package/inputs/OtpInput/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.d.ts +0 -10
- package/inputs/Radio/Radio.stories.playwright.json +0 -73
- package/inputs/Radio/__stories__/Conditional/index.js +0 -93
- package/inputs/Radio/__stories__/Conditional/package.json +0 -6
- package/inputs/Radio/__stories__/Conditional.d.ts +0 -3
- package/inputs/Radio/__stories__/Default/index.js +0 -45
- package/inputs/Radio/__stories__/Default/package.json +0 -6
- package/inputs/Radio/__stories__/Default.d.ts +0 -3
- package/inputs/Radio/__stories__/WithDivider/index.js +0 -46
- package/inputs/Radio/__stories__/WithDivider/package.json +0 -6
- package/inputs/Radio/__stories__/WithDivider.d.ts +0 -3
- package/inputs/Radio/index.mdx +0 -33
- package/inputs/Radio/package.json +0 -6
- package/inputs/Select/Select.stories/index.js +0 -7
- package/inputs/Select/Select.stories/package.json +0 -6
- package/inputs/Select/Select.stories.d.ts +0 -8
- 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/inputs/Select/__stories__/Default.d.ts +0 -3
- package/inputs/Select/index.mdx +0 -17
- package/inputs/Select/package.json +0 -6
- package/inputs/package.json +0 -6
- package/installation.mdx +0 -68
- package/internal/index.js +0 -34
- package/internal/package.json +0 -6
- package/lazy/index.js +0 -395
- package/lazy/package.json +0 -6
- package/registry/index.js +0 -138
- package/registry/package.json +0 -6
- 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/Questions/index.mdx +0 -415
- package/src/inputs/AutoCompleteInput/index.mdx +0 -29
- package/src/inputs/Checkboxes/Checkboxes.stories.playwright.json +0 -85
- package/src/inputs/DateInput/DateInput.stories.playwright.json +0 -72
- package/src/inputs/FileInput/FileInput.stories.playwright.json +0 -75
- package/src/inputs/FileInput/index.mdx +0 -19
- package/src/inputs/ImageInput/ImageInput.stories.playwright.json +0 -77
- package/src/inputs/ImageInput/index.mdx +0 -19
- package/src/inputs/Input/Input.stories.playwright.json +0 -376
- package/src/inputs/Input/index.mdx +0 -95
- package/src/inputs/Label/Label.stories.playwright.json +0 -40
- package/src/inputs/OtpInput/index.mdx +0 -23
- package/src/inputs/Radio/Radio.stories.playwright.json +0 -73
- package/src/inputs/Radio/index.mdx +0 -33
- package/src/inputs/Select/Select.stories.playwright.json +0 -22
- package/src/lazy.js +0 -60
- package/src/registry.js +0 -145
- package/types/index.js +0 -1
- package/types/package.json +0 -6
- package/utils/index.js +0 -80
- package/utils/package.json +0 -6
- package/validators/package.json +0 -6
- package/validators/types/index.js +0 -1
- package/validators/types/package.json +0 -6
- package/validators/utils/afm/index.js +0 -31
- package/validators/utils/afm/package.json +0 -6
- package/validators/utils/file/index.js +0 -37
- package/validators/utils/file/package.json +0 -6
- package/validators/utils/iban/index.js +0 -116
- package/validators/utils/iban/package.json +0 -6
- package/validators/utils/image/index.js +0 -119
- package/validators/utils/image/package.json +0 -6
- package/validators/utils/int/index.js +0 -19
- package/validators/utils/int/package.json +0 -6
- package/validators/utils/number/index.js +0 -15
- package/validators/utils/number/package.json +0 -6
- package/validators/utils/otp/index.js +0 -25
- package/validators/utils/otp/package.json +0 -6
- package/validators/utils/package.json +0 -6
- package/validators/utils/phone/index.js +0 -134
- package/validators/utils/phone/package.json +0 -6
- package/validators/utils/postal_code/index.js +0 -27
- package/validators/utils/postal_code/package.json +0 -6
- package/validators/utils/text_limit/index.js +0 -47
- package/validators/utils/text_limit/package.json +0 -6
- package/validators/utils/uuid4/index.js +0 -18
- package/validators/utils/uuid4/package.json +0 -6
- package/validators/validators.spec/index.js +0 -85
- package/validators/validators.spec/package.json +0 -6
- package/validators/validators.spec.d.ts +0 -1
- /package/{cjs/inputs/Label/index.mdx → Field/types.js} +0 -0
- /package/{inputs/Label/index.mdx → Fieldset/types.js} +0 -0
- /package/{src/inputs/Label/index.mdx → MultiplicityField/types.js} +0 -0
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
var _exportNames = {
|
|
8
|
-
getYupField: true,
|
|
9
|
-
computeShape: true,
|
|
10
|
-
getYupObjectShape: true
|
|
11
|
-
};
|
|
12
|
-
exports.computeShape = computeShape;
|
|
13
|
-
exports.getYupField = getYupField;
|
|
14
|
-
exports.getYupObjectShape = getYupObjectShape;
|
|
15
|
-
var yup = _interopRequireWildcard(require("yup"));
|
|
16
|
-
var _afm = require("@digigov/form/validators/utils/afm");
|
|
17
|
-
Object.keys(_afm).forEach(function (key) {
|
|
18
|
-
if (key === "default" || key === "__esModule") return;
|
|
19
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
20
|
-
if (key in exports && exports[key] === _afm[key]) return;
|
|
21
|
-
Object.defineProperty(exports, key, {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
get: function get() {
|
|
24
|
-
return _afm[key];
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
var _file = require("@digigov/form/validators/utils/file");
|
|
29
|
-
Object.keys(_file).forEach(function (key) {
|
|
30
|
-
if (key === "default" || key === "__esModule") return;
|
|
31
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
32
|
-
if (key in exports && exports[key] === _file[key]) return;
|
|
33
|
-
Object.defineProperty(exports, key, {
|
|
34
|
-
enumerable: true,
|
|
35
|
-
get: function get() {
|
|
36
|
-
return _file[key];
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
var _iban = require("@digigov/form/validators/utils/iban");
|
|
41
|
-
Object.keys(_iban).forEach(function (key) {
|
|
42
|
-
if (key === "default" || key === "__esModule") return;
|
|
43
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
44
|
-
if (key in exports && exports[key] === _iban[key]) return;
|
|
45
|
-
Object.defineProperty(exports, key, {
|
|
46
|
-
enumerable: true,
|
|
47
|
-
get: function get() {
|
|
48
|
-
return _iban[key];
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
var _otp = require("@digigov/form/validators/utils/otp");
|
|
53
|
-
Object.keys(_otp).forEach(function (key) {
|
|
54
|
-
if (key === "default" || key === "__esModule") return;
|
|
55
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
56
|
-
if (key in exports && exports[key] === _otp[key]) return;
|
|
57
|
-
Object.defineProperty(exports, key, {
|
|
58
|
-
enumerable: true,
|
|
59
|
-
get: function get() {
|
|
60
|
-
return _otp[key];
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
var _image = require("@digigov/form/validators/utils/image");
|
|
65
|
-
Object.keys(_image).forEach(function (key) {
|
|
66
|
-
if (key === "default" || key === "__esModule") return;
|
|
67
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
68
|
-
if (key in exports && exports[key] === _image[key]) return;
|
|
69
|
-
Object.defineProperty(exports, key, {
|
|
70
|
-
enumerable: true,
|
|
71
|
-
get: function get() {
|
|
72
|
-
return _image[key];
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
var _phone = require("@digigov/form/validators/utils/phone");
|
|
77
|
-
Object.keys(_phone).forEach(function (key) {
|
|
78
|
-
if (key === "default" || key === "__esModule") return;
|
|
79
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
80
|
-
if (key in exports && exports[key] === _phone[key]) return;
|
|
81
|
-
Object.defineProperty(exports, key, {
|
|
82
|
-
enumerable: true,
|
|
83
|
-
get: function get() {
|
|
84
|
-
return _phone[key];
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
var _postal_code = require("@digigov/form/validators/utils/postal_code");
|
|
89
|
-
Object.keys(_postal_code).forEach(function (key) {
|
|
90
|
-
if (key === "default" || key === "__esModule") return;
|
|
91
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
92
|
-
if (key in exports && exports[key] === _postal_code[key]) return;
|
|
93
|
-
Object.defineProperty(exports, key, {
|
|
94
|
-
enumerable: true,
|
|
95
|
-
get: function get() {
|
|
96
|
-
return _postal_code[key];
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
});
|
|
100
|
-
var _uuid = require("@digigov/form/validators/utils/uuid4");
|
|
101
|
-
Object.keys(_uuid).forEach(function (key) {
|
|
102
|
-
if (key === "default" || key === "__esModule") return;
|
|
103
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
104
|
-
if (key in exports && exports[key] === _uuid[key]) return;
|
|
105
|
-
Object.defineProperty(exports, key, {
|
|
106
|
-
enumerable: true,
|
|
107
|
-
get: function get() {
|
|
108
|
-
return _uuid[key];
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
var _text_limit = require("@digigov/form/validators/utils/text_limit");
|
|
113
|
-
Object.keys(_text_limit).forEach(function (key) {
|
|
114
|
-
if (key === "default" || key === "__esModule") return;
|
|
115
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
116
|
-
if (key in exports && exports[key] === _text_limit[key]) return;
|
|
117
|
-
Object.defineProperty(exports, key, {
|
|
118
|
-
enumerable: true,
|
|
119
|
-
get: function get() {
|
|
120
|
-
return _text_limit[key];
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
});
|
|
124
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
125
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
126
|
-
function getYupField(field, yupTypeMap) {
|
|
127
|
-
var yupField = yupTypeMap[(field === null || field === void 0 ? void 0 : field.type) || 'string'] || yupTypeMap['string'];
|
|
128
|
-
return yupField(field);
|
|
129
|
-
}
|
|
130
|
-
function computeShape(fields, yupTypeMap, validatorRegistry) {
|
|
131
|
-
var fieldSchemas = {};
|
|
132
|
-
var objectFields = {};
|
|
133
|
-
fields.forEach(function (field) {
|
|
134
|
-
var yupField = getYupField(field, yupTypeMap);
|
|
135
|
-
if (field.condition) {
|
|
136
|
-
var _loop = function _loop(key) {
|
|
137
|
-
var then, otherwise;
|
|
138
|
-
if (field.condition[key].then) {
|
|
139
|
-
var _field$condition$key$, _field$condition$key$2;
|
|
140
|
-
if (((_field$condition$key$ = field.condition[key].then) === null || _field$condition$key$ === void 0 ? void 0 : _field$condition$key$.required) === false) {
|
|
141
|
-
then = yupField.nullable();
|
|
142
|
-
} else if (((_field$condition$key$2 = field.condition[key].then) === null || _field$condition$key$2 === void 0 ? void 0 : _field$condition$key$2.required) === true) {
|
|
143
|
-
then = yupField.nullable().required('form.error.required');
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
if (field.condition[key]["else"]) {
|
|
147
|
-
var _field$condition$key$3, _field$condition$key$4;
|
|
148
|
-
if (((_field$condition$key$3 = field.condition[key]["else"]) === null || _field$condition$key$3 === void 0 ? void 0 : _field$condition$key$3.required) === false) {
|
|
149
|
-
otherwise = yupField.nullable();
|
|
150
|
-
} else if (((_field$condition$key$4 = field.condition[key]["else"]) === null || _field$condition$key$4 === void 0 ? void 0 : _field$condition$key$4.required) === true) {
|
|
151
|
-
otherwise = yupField.nullable().required('form.error.required');
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
if (then || otherwise) {
|
|
155
|
-
yupField = yupField.when(key, {
|
|
156
|
-
is: function is(val) {
|
|
157
|
-
//@ts-ignore
|
|
158
|
-
var is = field.condition[key].is;
|
|
159
|
-
if (is === val || Array.isArray(val) && val.includes(is)) {
|
|
160
|
-
return true;
|
|
161
|
-
} else {
|
|
162
|
-
return false;
|
|
163
|
-
}
|
|
164
|
-
},
|
|
165
|
-
then: then,
|
|
166
|
-
otherwise: otherwise
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
};
|
|
170
|
-
for (var key in field.condition) {
|
|
171
|
-
_loop(key);
|
|
172
|
-
}
|
|
173
|
-
} else if (field.required) {
|
|
174
|
-
yupField = yupField.nullable().required('form.error.required');
|
|
175
|
-
}
|
|
176
|
-
if (validatorRegistry && field.type && validatorRegistry[field.type]) {
|
|
177
|
-
validatorRegistry[field.type].forEach(function (validator) {
|
|
178
|
-
yupField = yupField.test(validator);
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
if (field.validators) {
|
|
182
|
-
field.validators.forEach(function (validator) {
|
|
183
|
-
yupField = yupField.test(validator);
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
fieldSchemas[field.key] = yupField;
|
|
187
|
-
});
|
|
188
|
-
for (var objectKey in objectFields) {
|
|
189
|
-
fieldSchemas[objectKey] = getYupObjectShape(objectFields[objectKey], yupTypeMap, validatorRegistry);
|
|
190
|
-
}
|
|
191
|
-
return fieldSchemas;
|
|
192
|
-
}
|
|
193
|
-
function getYupObjectShape(
|
|
194
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
195
|
-
fields, yupTypeMap, validatorRegistry) {
|
|
196
|
-
if (!fields.current) {
|
|
197
|
-
var fieldSchemas = computeShape(fields, yupTypeMap, validatorRegistry);
|
|
198
|
-
return yup.object().shape(fieldSchemas);
|
|
199
|
-
}
|
|
200
|
-
return yup.lazy(function () {
|
|
201
|
-
var fieldSchemas = computeShape(Object.values(fields.current), yupTypeMap, validatorRegistry);
|
|
202
|
-
return yup.object().shape(fieldSchemas);
|
|
203
|
-
});
|
|
204
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.INT_VALIDATOR = void 0;
|
|
7
|
-
exports.validateIntNumber = validateIntNumber;
|
|
8
|
-
function validateIntNumber(number) {
|
|
9
|
-
if (number === undefined) {
|
|
10
|
-
return false;
|
|
11
|
-
} else {
|
|
12
|
-
return Number.isInteger(number) && Number(number) > 0;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
var INT_VALIDATOR = exports.INT_VALIDATOR = function INT_VALIDATOR() {
|
|
16
|
-
return {
|
|
17
|
-
name: 'int-validator',
|
|
18
|
-
message: 'form.error.positive_integer_number',
|
|
19
|
-
test: function test(value) {
|
|
20
|
-
if (value === null) {
|
|
21
|
-
return true;
|
|
22
|
-
}
|
|
23
|
-
return validateIntNumber(value);
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.NUMBER_VALIDATOR = void 0;
|
|
7
|
-
exports.validateNumber = validateNumber;
|
|
8
|
-
function validateNumber(number) {
|
|
9
|
-
return !Number.isNaN(number);
|
|
10
|
-
}
|
|
11
|
-
var NUMBER_VALIDATOR = exports.NUMBER_VALIDATOR = function NUMBER_VALIDATOR() {
|
|
12
|
-
return {
|
|
13
|
-
name: 'number-validator',
|
|
14
|
-
message: 'form.error.number',
|
|
15
|
-
test: function test(value) {
|
|
16
|
-
if (value === null) {
|
|
17
|
-
return true;
|
|
18
|
-
}
|
|
19
|
-
return validateNumber(value);
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.OTP_VALIDATOR = void 0;
|
|
7
|
-
exports.validateOtp = validateOtp;
|
|
8
|
-
function validateOtp(value, maxLength) {
|
|
9
|
-
if (value.length === maxLength) {
|
|
10
|
-
return true;
|
|
11
|
-
} else {
|
|
12
|
-
return false;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
var OTP_VALIDATOR = exports.OTP_VALIDATOR = function OTP_VALIDATOR(field) {
|
|
16
|
-
var maxLength = field === null || field === void 0 ? void 0 : field.maxLength;
|
|
17
|
-
return {
|
|
18
|
-
name: 'otp-validator',
|
|
19
|
-
message: {
|
|
20
|
-
key: 'form.error.otp.less_than',
|
|
21
|
-
context: {
|
|
22
|
-
maxLength: field === null || field === void 0 ? void 0 : field.maxLength
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
test: function test(value) {
|
|
26
|
-
if (!value) {
|
|
27
|
-
return true;
|
|
28
|
-
}
|
|
29
|
-
return validateOtp(value, maxLength);
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
};
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.PHONE_NUMBER_VALIDATOR = exports.MOBILE_PHONE_VALIDATOR = void 0;
|
|
8
|
-
exports.discoverPhoneType = discoverPhoneType;
|
|
9
|
-
exports.validatePhoneNumber = validatePhoneNumber;
|
|
10
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
-
// add more countries from here libphonenumber-js/metadata.full.json
|
|
12
|
-
var countryPhoneData = {
|
|
13
|
-
"GR": ["30", "00", "5005000\\d{3}|8\\d{9,11}|(?:[269]\\d|70)\\d{8}", [10, 11, 12], [["(\\d{2})(\\d{4})(\\d{4})", "$1 $2 $3", ["21|7"]], ["(\\d{4})(\\d{6})", "$1 $2", ["2(?:2|3[2-57-9]|4[2-469]|5[2-59]|6[2-9]|7[2-69]|8[2-49])|5"]], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["[2689]"]], ["(\\d{3})(\\d{3,4})(\\d{5})", "$1 $2 $3", ["8"]]], 0, 0, 0, 0, 0, 0, [["2(?:1\\d\\d|2(?:2[1-46-9]|[36][1-8]|4[1-7]|5[1-4]|7[1-5]|[89][1-9])|3(?:1\\d|2[1-57]|[35][1-3]|4[13]|7[1-7]|8[124-6]|9[1-79])|4(?:1\\d|2[1-8]|3[1-4]|4[13-5]|6[1-578]|9[1-5])|5(?:1\\d|[29][1-4]|3[1-5]|4[124]|5[1-6])|6(?:1\\d|[269][1-6]|3[1245]|4[1-7]|5[13-9]|7[14]|8[1-5])|7(?:1\\d|2[1-5]|3[1-6]|4[1-7]|5[1-57]|6[135]|9[125-7])|8(?:1\\d|2[1-5]|[34][1-4]|9[1-57]))\\d{6}", [10]], ["68[57-9]\\d{7}|(?:69|94)\\d{8}", [10]], ["800\\d{7,9}"], ["90[19]\\d{7}", [10]], ["70\\d{8}", [10]], 0, ["5005000\\d{3}", [10]], 0, 0, ["8(?:0[16]|12|[27]5|50)\\d{7}", [10]]]]
|
|
14
|
-
};
|
|
15
|
-
function expandPhoneNumberStructure(compressed) {
|
|
16
|
-
var countries = Object.keys(compressed);
|
|
17
|
-
var expanded = {};
|
|
18
|
-
for (var _i = 0, _countries = countries; _i < _countries.length; _i++) {
|
|
19
|
-
var country = _countries[_i];
|
|
20
|
-
expanded[country] = {
|
|
21
|
-
fixedLine: {
|
|
22
|
-
possibleLengths: {
|
|
23
|
-
_national: compressed[country][3].map(String)
|
|
24
|
-
},
|
|
25
|
-
nationalNumberPattern: compressed[country][11][0][0]
|
|
26
|
-
},
|
|
27
|
-
mobile: {
|
|
28
|
-
nationalNumberPattern: compressed[country][11][1][0]
|
|
29
|
-
},
|
|
30
|
-
tollFree: {
|
|
31
|
-
nationalNumberPattern: compressed[country][11][2][0]
|
|
32
|
-
},
|
|
33
|
-
premiumRate: {
|
|
34
|
-
nationalNumberPattern: compressed[country][11][3][0]
|
|
35
|
-
},
|
|
36
|
-
sharedCost: {
|
|
37
|
-
nationalNumberPattern: compressed[country][11][9][0]
|
|
38
|
-
},
|
|
39
|
-
personalNumber: {
|
|
40
|
-
nationalNumberPattern: compressed[country][11][4][0]
|
|
41
|
-
},
|
|
42
|
-
uan: {
|
|
43
|
-
nationalNumberPattern: compressed[country][11][6][0]
|
|
44
|
-
},
|
|
45
|
-
id: country,
|
|
46
|
-
countryCode: compressed[country][0],
|
|
47
|
-
internationalPrefix: compressed[country][1]
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
return expanded;
|
|
51
|
-
}
|
|
52
|
-
var PHONENUMBER_SPEC = expandPhoneNumberStructure(countryPhoneData);
|
|
53
|
-
function discoverPhoneType(phoneNumber, config) {
|
|
54
|
-
var cleanNumber = phoneNumber.replace(/\D/g, "").replace(/\s/g, "").replace(/^\+/, "").replace(new RegExp("^" + config.internationalPrefix, ""), "").replace(new RegExp("^" + config.countryCode, ""), "");
|
|
55
|
-
var categories = {
|
|
56
|
-
"landline": config.fixedLine,
|
|
57
|
-
mobile: config.mobile,
|
|
58
|
-
"toll-free": config.tollFree,
|
|
59
|
-
"premium-rate": config.premiumRate
|
|
60
|
-
};
|
|
61
|
-
for (var _i2 = 0, _Object$entries = Object.entries(categories); _i2 < _Object$entries.length; _i2++) {
|
|
62
|
-
var _Object$entries$_i = (0, _slicedToArray2["default"])(_Object$entries[_i2], 2),
|
|
63
|
-
categoryName = _Object$entries$_i[0],
|
|
64
|
-
categoryDetails = _Object$entries$_i[1];
|
|
65
|
-
var pattern = new RegExp("^(" + categoryDetails.nationalNumberPattern.replace(/\s/g, "") + ")$", "");
|
|
66
|
-
if (cleanNumber.match(pattern)) {
|
|
67
|
-
return categoryName; // Returns the category name if the number matches the pattern
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// If no category matches, return 'Unknown'
|
|
72
|
-
return "unknown";
|
|
73
|
-
}
|
|
74
|
-
function getNumberType(phoneNumber, country) {
|
|
75
|
-
var spec = PHONENUMBER_SPEC[country.toUpperCase()];
|
|
76
|
-
if (!spec) {
|
|
77
|
-
throw new Error("Country ".concat(country, " is not supported"));
|
|
78
|
-
}
|
|
79
|
-
var type = discoverPhoneType(phoneNumber, spec);
|
|
80
|
-
return type;
|
|
81
|
-
}
|
|
82
|
-
function isPhoneNumberValid(phoneNumber, countries) {
|
|
83
|
-
var types = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ['mobile', 'landline'];
|
|
84
|
-
return countries.some(function (country) {
|
|
85
|
-
var numberType = getNumberType(phoneNumber, country);
|
|
86
|
-
if (numberType && types.includes(numberType)) {
|
|
87
|
-
return true;
|
|
88
|
-
}
|
|
89
|
-
return false;
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
function isNumberOfType(phoneNumber, country, type) {
|
|
93
|
-
var numberType = getNumberType(phoneNumber, country);
|
|
94
|
-
if (numberType === type) {
|
|
95
|
-
return true;
|
|
96
|
-
}
|
|
97
|
-
return false;
|
|
98
|
-
}
|
|
99
|
-
function validatePhoneNumber(phoneNumber) {
|
|
100
|
-
var countries = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ['gr'];
|
|
101
|
-
var typeOfPhoneNumber = arguments.length > 2 ? arguments[2] : undefined;
|
|
102
|
-
if (!countries || countries.length === 0) {
|
|
103
|
-
return true;
|
|
104
|
-
}
|
|
105
|
-
return isPhoneNumberValid(phoneNumber, countries, typeOfPhoneNumber ? [typeOfPhoneNumber] : undefined);
|
|
106
|
-
}
|
|
107
|
-
function validateMobile(value) {
|
|
108
|
-
return isNumberOfType(value, 'gr', 'mobile');
|
|
109
|
-
}
|
|
110
|
-
var MOBILE_PHONE_VALIDATOR = exports.MOBILE_PHONE_VALIDATOR = {
|
|
111
|
-
name: 'mobile-phone-validator',
|
|
112
|
-
message: 'form.error.mobile_phone',
|
|
113
|
-
test: function test(value) {
|
|
114
|
-
if (value) {
|
|
115
|
-
return validateMobile(value);
|
|
116
|
-
}
|
|
117
|
-
return true;
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
var PHONE_NUMBER_VALIDATOR = exports.PHONE_NUMBER_VALIDATOR = function PHONE_NUMBER_VALIDATOR(field) {
|
|
121
|
-
var _field$extra, _field$extra2;
|
|
122
|
-
var countryCodes = field === null || field === void 0 ? void 0 : (_field$extra = field.extra) === null || _field$extra === void 0 ? void 0 : _field$extra.countries;
|
|
123
|
-
var typeOfPhone = field === null || field === void 0 ? void 0 : (_field$extra2 = field.extra) === null || _field$extra2 === void 0 ? void 0 : _field$extra2.phoneType;
|
|
124
|
-
return {
|
|
125
|
-
name: 'phone-number-validator',
|
|
126
|
-
message: function message() {
|
|
127
|
-
if (typeOfPhone === 'mobile') {
|
|
128
|
-
return 'form.error.mobile_phone';
|
|
129
|
-
}
|
|
130
|
-
if (typeOfPhone === 'landline') {
|
|
131
|
-
return 'form.error.landline';
|
|
132
|
-
} else {
|
|
133
|
-
return 'form.error.phone_number';
|
|
134
|
-
}
|
|
135
|
-
},
|
|
136
|
-
test: function test(value) {
|
|
137
|
-
if (!value) {
|
|
138
|
-
return true;
|
|
139
|
-
}
|
|
140
|
-
return validatePhoneNumber(value, countryCodes, typeOfPhone);
|
|
141
|
-
}
|
|
142
|
-
};
|
|
143
|
-
};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.POSTALCODE_VALIDATOR = void 0;
|
|
7
|
-
exports.validatePostalCode = validatePostalCode;
|
|
8
|
-
var CODE_REGEX = /^[12345678][0-9]{4}$/;
|
|
9
|
-
function validatePostalCode(number, countries) {
|
|
10
|
-
if (!countries) {
|
|
11
|
-
return false;
|
|
12
|
-
} else {
|
|
13
|
-
if (countries.length === 1 && countries[0].toUpperCase() === 'GR') {
|
|
14
|
-
// Greek postal code must be 5 digits long and shouldn't start with 0 or 9.
|
|
15
|
-
return CODE_REGEX.test(number);
|
|
16
|
-
} else {
|
|
17
|
-
return true;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
var POSTALCODE_VALIDATOR = exports.POSTALCODE_VALIDATOR = function POSTALCODE_VALIDATOR(field) {
|
|
22
|
-
var _field$extra;
|
|
23
|
-
var countryCode = field === null || field === void 0 ? void 0 : (_field$extra = field.extra) === null || _field$extra === void 0 ? void 0 : _field$extra.countries;
|
|
24
|
-
return {
|
|
25
|
-
name: 'postal-code-validator',
|
|
26
|
-
message: 'form.error.postalCode',
|
|
27
|
-
test: function test(value) {
|
|
28
|
-
if (!value) {
|
|
29
|
-
return true;
|
|
30
|
-
}
|
|
31
|
-
return validatePostalCode(value, countryCode);
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.TEXT_LIMIT_VALIDATOR = void 0;
|
|
7
|
-
exports.validateText = validateText;
|
|
8
|
-
function validateText(value, min, max) {
|
|
9
|
-
var validator;
|
|
10
|
-
if (min || max) {
|
|
11
|
-
if (value.length < min || value.length > max) {
|
|
12
|
-
return validator = false;
|
|
13
|
-
} else {
|
|
14
|
-
return validator = true;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
return validator;
|
|
18
|
-
}
|
|
19
|
-
var TEXT_LIMIT_VALIDATOR = exports.TEXT_LIMIT_VALIDATOR = function TEXT_LIMIT_VALIDATOR(field) {
|
|
20
|
-
var _field$extra, _field$extra$limit, _field$extra2, _field$extra2$limit;
|
|
21
|
-
var min = field === null || field === void 0 ? void 0 : (_field$extra = field.extra) === null || _field$extra === void 0 ? void 0 : (_field$extra$limit = _field$extra.limit) === null || _field$extra$limit === void 0 ? void 0 : _field$extra$limit.min;
|
|
22
|
-
var max = field === null || field === void 0 ? void 0 : (_field$extra2 = field.extra) === null || _field$extra2 === void 0 ? void 0 : (_field$extra2$limit = _field$extra2.limit) === null || _field$extra2$limit === void 0 ? void 0 : _field$extra2$limit.max;
|
|
23
|
-
return {
|
|
24
|
-
name: 'text-limit-validator',
|
|
25
|
-
message: function message(v) {
|
|
26
|
-
if (min || max) {
|
|
27
|
-
if (v.value.length < min) {
|
|
28
|
-
var _field$extra3, _field$extra3$limit;
|
|
29
|
-
return {
|
|
30
|
-
key: 'form.error.text.less_than',
|
|
31
|
-
context: {
|
|
32
|
-
min: field === null || field === void 0 ? void 0 : (_field$extra3 = field.extra) === null || _field$extra3 === void 0 ? void 0 : (_field$extra3$limit = _field$extra3.limit) === null || _field$extra3$limit === void 0 ? void 0 : _field$extra3$limit.min
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
if (v.value.length > max) {
|
|
37
|
-
var _field$extra4, _field$extra4$limit;
|
|
38
|
-
return {
|
|
39
|
-
key: 'form.error.text.more_than',
|
|
40
|
-
context: {
|
|
41
|
-
max: field === null || field === void 0 ? void 0 : (_field$extra4 = field.extra) === null || _field$extra4 === void 0 ? void 0 : (_field$extra4$limit = _field$extra4.limit) === null || _field$extra4$limit === void 0 ? void 0 : _field$extra4$limit.max
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
test: function test(value) {
|
|
48
|
-
if (!value) {
|
|
49
|
-
return true;
|
|
50
|
-
}
|
|
51
|
-
return validateText(value, min, max);
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.UUID4_VALIDATOR = void 0;
|
|
7
|
-
exports.validateUUID4 = validateUUID4;
|
|
8
|
-
var UUID4_PATTERN = /^[0-9A-F]{8}-[0-9A-F]{4}-[4][0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i;
|
|
9
|
-
function validateUUID4(uuid4) {
|
|
10
|
-
if (uuid4.length !== 36) {
|
|
11
|
-
// This uuid4 should be 36 characters long
|
|
12
|
-
return false;
|
|
13
|
-
}
|
|
14
|
-
return UUID4_PATTERN.test(uuid4);
|
|
15
|
-
}
|
|
16
|
-
var UUID4_VALIDATOR = exports.UUID4_VALIDATOR = {
|
|
17
|
-
name: 'uuid4-validator',
|
|
18
|
-
message: 'form.error.uuid4',
|
|
19
|
-
test: function test(value) {
|
|
20
|
-
if (value) {
|
|
21
|
-
return validateUUID4(value);
|
|
22
|
-
}
|
|
23
|
-
return true;
|
|
24
|
-
}
|
|
25
|
-
};
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _utils = require("@digigov/form/validators/utils");
|
|
4
|
-
it('validates wrong uuid4 for empty value', function () {
|
|
5
|
-
expect((0, _utils.validateUUID4)('')).toBe(false);
|
|
6
|
-
});
|
|
7
|
-
it('validates wrong uuid4 because of length', function () {
|
|
8
|
-
expect((0, _utils.validateUUID4)('9e463bc44a294bab8ee23af6cc3cbbe3')).toBe(false);
|
|
9
|
-
});
|
|
10
|
-
it('validates wrong uuid4 with correct length and wrong form', function () {
|
|
11
|
-
expect((0, _utils.validateUUID4)('ab123cd1-1234-ad34-ad45-12345abcdefg')).toBe(false);
|
|
12
|
-
});
|
|
13
|
-
it('validates correct uuid4 validator', function () {
|
|
14
|
-
expect((0, _utils.validateUUID4)('9e463bc4-4a29-4bab-8ee2-3af6cc3cbbe3')).toBe(true);
|
|
15
|
-
});
|
|
16
|
-
it('validates correct gr iban', function () {
|
|
17
|
-
expect((0, _utils.validateIban)('GR7801100800000008009825202', 'GR')).toBe(true);
|
|
18
|
-
});
|
|
19
|
-
it('validates correct iban with spaces and dashes', function () {
|
|
20
|
-
expect((0, _utils.validateIban)('GR 7801-1008 0000-0008 0098-25202', 'GR')).toBe(true);
|
|
21
|
-
});
|
|
22
|
-
it('validates correct foreign iban', function () {
|
|
23
|
-
expect((0, _utils.validateIban)('DE75512108001245126199', 'DE')).toBe(true);
|
|
24
|
-
});
|
|
25
|
-
it('validates wrong iban for empty value', function () {
|
|
26
|
-
expect((0, _utils.validateIban)('', '')).toBe(false);
|
|
27
|
-
});
|
|
28
|
-
it('validates wrong greek iban for wrong length', function () {
|
|
29
|
-
expect((0, _utils.validateIban)('GR78011008000000080098252020', 'gr')).toBe(false);
|
|
30
|
-
});
|
|
31
|
-
it('validates wrong iban for non existing country code', function () {
|
|
32
|
-
expect((0, _utils.validateIban)('AAA78011008000000080098252020', 'aaa')).toBe(false);
|
|
33
|
-
});
|
|
34
|
-
it('validates correct greek iban whithout country code', function () {
|
|
35
|
-
expect((0, _utils.validateIban)('7801100800000008009825202', '')).toBe(true);
|
|
36
|
-
});
|
|
37
|
-
it('validates wrong postal code without country code', function () {
|
|
38
|
-
expect((0, _utils.validatePostalCode)('123', [])).toBe(true);
|
|
39
|
-
});
|
|
40
|
-
it('validates wrong postal code with wrong country code', function () {
|
|
41
|
-
expect((0, _utils.validatePostalCode)('123', ['FR'])).toBe(true);
|
|
42
|
-
});
|
|
43
|
-
it('validates wrong postal code with greek country code', function () {
|
|
44
|
-
expect((0, _utils.validatePostalCode)('123', ['GR'])).toBe(false);
|
|
45
|
-
});
|
|
46
|
-
it('validates postal code with greek country code', function () {
|
|
47
|
-
expect((0, _utils.validatePostalCode)('11143', ['GR'])).toBe(true);
|
|
48
|
-
});
|
|
49
|
-
it('validates phone number type landline with greek country code', function () {
|
|
50
|
-
expect((0, _utils.validatePhoneNumber)('2102934896', ['GR'], 'landline')).toBe(true);
|
|
51
|
-
});
|
|
52
|
-
it('validates phone number type landline with ch country code', function () {
|
|
53
|
-
expect((0, _utils.validatePhoneNumber)('2102934896', ['CH'], 'landline')).toBe(false);
|
|
54
|
-
});
|
|
55
|
-
it('validates phone number type landline with ch and gr countries code', function () {
|
|
56
|
-
expect((0, _utils.validatePhoneNumber)('2102934896', ['GR', 'CH'], 'landline')).toBe(true);
|
|
57
|
-
});
|
|
58
|
-
it('validatesphone number type landline with ch and gr countries code', function () {
|
|
59
|
-
expect((0, _utils.validatePhoneNumber)('41446681800', ['GR', 'CH'], 'landline')).toBe(true);
|
|
60
|
-
});
|
|
61
|
-
it('validates phone number type landline with ch and gr countries code but phone number is mobile', function () {
|
|
62
|
-
expect((0, _utils.validatePhoneNumber)('2102934896', ['GR', 'CH'], 'mobile')).toBe(false);
|
|
63
|
-
});
|
|
64
|
-
it('validates phone number type mobile with ch and gr countries code', function () {
|
|
65
|
-
expect((0, _utils.validatePhoneNumber)('6934100982', ['GR', 'CH'], 'mobile')).toBe(true);
|
|
66
|
-
});
|
|
67
|
-
it('validates phone number type mobile with gr country code', function () {
|
|
68
|
-
expect((0, _utils.validatePhoneNumber)('6934100982', ['GR'], 'mobile')).toBe(true);
|
|
69
|
-
});
|
|
70
|
-
it('validates phone number type mobile with ch country code', function () {
|
|
71
|
-
expect((0, _utils.validatePhoneNumber)('6934100982', ['CH'], 'mobile')).toBe(false);
|
|
72
|
-
});
|
|
73
|
-
it('validates phone number with no type and ch country code', function () {
|
|
74
|
-
expect((0, _utils.validatePhoneNumber)('6934100982', ['CH'], null)).toBe(false);
|
|
75
|
-
});
|
|
76
|
-
it('validates phone number with no type and gr country code', function () {
|
|
77
|
-
expect((0, _utils.validatePhoneNumber)('6934100982', ['gr'], null)).toBe(true);
|
|
78
|
-
});
|
|
79
|
-
it('validates phone number with no type and ch country code', function () {
|
|
80
|
-
expect((0, _utils.validatePhoneNumber)('41446681800', ['CH'], null)).toBe(true);
|
|
81
|
-
});
|
|
82
|
-
it('validates phone number with no type and gr country code', function () {
|
|
83
|
-
expect((0, _utils.validatePhoneNumber)('41446681800', ['gr'], null)).toBe(false);
|
|
84
|
-
});
|
|
85
|
-
it('validates phone number with no type and gr and ch countries code', function () {
|
|
86
|
-
expect((0, _utils.validatePhoneNumber)('41446681800', ['gr', 'ch'], null)).toBe(true);
|
|
87
|
-
});
|