@digigov/form 2.0.0-rc.8 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +118 -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 +4 -4
- package/inputs/AutoCompleteInput/index.js +42 -55
- 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 +94 -66
- 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 +2 -4
- 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 +2 -9
- 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 +40 -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 -78
- 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 -88
- 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 -66
- 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
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import dayjs from "dayjs";
|
|
2
|
+
import customParseFormat from "dayjs/plugin/customParseFormat.js";
|
|
3
|
+
dayjs.extend(customParseFormat);
|
|
4
|
+
const VALID_DATE_FORMATS = [
|
|
5
|
+
'DD/MM/YYYY'
|
|
6
|
+
];
|
|
7
|
+
const DATE_CACHE = {};
|
|
8
|
+
const onlyNumbersRegex = /^\d+$/;
|
|
9
|
+
const getDate = (v)=>DATE_CACHE[v] ? DATE_CACHE[v] : dayjs(v, VALID_DATE_FORMATS, true);
|
|
10
|
+
const getDaysInMonth = (month, year)=>dayjs(`${year}-${month}-01`).daysInMonth();
|
|
11
|
+
const checkPartialDate = (value)=>{
|
|
12
|
+
const [day, month, year] = value.split('/');
|
|
13
|
+
if (day && !month && !year) return 'form.error.date.invalid_month_year';
|
|
14
|
+
if (!day && month && !year) return 'form.error.date.invalid_day_year';
|
|
15
|
+
if (!day && !month && year) return 'form.error.date.invalid_day_month';
|
|
16
|
+
if (day && month && !year) return 'form.error.date.invalid_year';
|
|
17
|
+
if (day && !month && year) return 'form.error.date.invalid_month';
|
|
18
|
+
if (!day && month && year) return 'form.error.date.invalid_day';
|
|
19
|
+
if (day && month) {
|
|
20
|
+
const dayNum = parseInt(day);
|
|
21
|
+
const monthNum = parseInt(month);
|
|
22
|
+
const validYear = onlyNumbersRegex.test(year) ? year : void 0;
|
|
23
|
+
if (!validYear || year.length < 4) return 'form.error.date.invalid';
|
|
24
|
+
const yearNum = parseInt(validYear);
|
|
25
|
+
const maxDay = getDaysInMonth(monthNum, yearNum);
|
|
26
|
+
if (dayNum < 1 || dayNum > maxDay) return {
|
|
27
|
+
key: 'form.error.date.invalid_day_range',
|
|
28
|
+
context: {
|
|
29
|
+
maxDay: maxDay
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
if (monthNum < 1 || monthNum > 12) return 'form.error.datetime.invalid_month_range';
|
|
33
|
+
}
|
|
34
|
+
return 'form.error.date.invalid';
|
|
35
|
+
};
|
|
36
|
+
const LATER_THAN_VALIDATOR = (field)=>{
|
|
37
|
+
let minDate;
|
|
38
|
+
const params = field.extra || {};
|
|
39
|
+
if ('now' === params.min) {
|
|
40
|
+
const today = new Date();
|
|
41
|
+
minDate = new Date(today);
|
|
42
|
+
} else minDate = getDate(params.min).toDate();
|
|
43
|
+
const minPreviousDate = new Date(minDate);
|
|
44
|
+
minPreviousDate.setDate(minDate.getDate() - 1);
|
|
45
|
+
return {
|
|
46
|
+
name: 'later-than',
|
|
47
|
+
message: {
|
|
48
|
+
key: 'form.error.date.later_than',
|
|
49
|
+
context: {
|
|
50
|
+
minDate: minPreviousDate.toLocaleDateString()
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
test: function(value) {
|
|
54
|
+
if (!value) return true;
|
|
55
|
+
const date = getDate(value);
|
|
56
|
+
const isValid = +date.toDate() > +minDate;
|
|
57
|
+
return isValid;
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
const EARLIER_THAN_VALIDATOR = (field)=>{
|
|
62
|
+
let maxDate;
|
|
63
|
+
const params = field.extra || {};
|
|
64
|
+
if ('now' === params.max) {
|
|
65
|
+
const today = new Date();
|
|
66
|
+
maxDate = new Date(today);
|
|
67
|
+
} else maxDate = getDate(params.max).toDate();
|
|
68
|
+
const maxNextDate = new Date(maxDate);
|
|
69
|
+
maxNextDate.setDate(maxDate.getDate() + 1);
|
|
70
|
+
return {
|
|
71
|
+
name: 'earlier-than',
|
|
72
|
+
message: {
|
|
73
|
+
key: 'form.error.date.earlier_than',
|
|
74
|
+
context: {
|
|
75
|
+
maxDate: maxNextDate.toLocaleDateString()
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
test: function(value) {
|
|
79
|
+
if (!value) return true;
|
|
80
|
+
const date = getDate(value);
|
|
81
|
+
const isValid = +date.toDate() < +maxDate;
|
|
82
|
+
return isValid;
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
const DATE_VALIDATOR = {
|
|
87
|
+
name: 'date-validator',
|
|
88
|
+
message: (v)=>checkPartialDate(v.value),
|
|
89
|
+
test: function(value) {
|
|
90
|
+
if (!value) return true;
|
|
91
|
+
const date = getDate(value);
|
|
92
|
+
return date.isValid();
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
export { DATE_VALIDATOR, EARLIER_THAN_VALIDATOR, LATER_THAN_VALIDATOR };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { FieldSpec } from '../../types.js';
|
|
2
|
+
import type { ValidatorSchema } from '../types.js';
|
|
3
|
+
export declare const LATER_THAN_DATETIME_VALIDATOR: (field: FieldSpec) => ValidatorSchema;
|
|
4
|
+
export declare const EARLIER_THAN_DATETIME_VALIDATOR: (field: FieldSpec) => ValidatorSchema;
|
|
5
|
+
export declare const DATETIME_VALIDATOR: {
|
|
6
|
+
name: string;
|
|
7
|
+
message: (v: any) => string | object;
|
|
8
|
+
test: (value: string) => any;
|
|
9
|
+
};
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import dayjs from "dayjs";
|
|
2
|
+
import customParseFormat from "dayjs/plugin/customParseFormat.js";
|
|
3
|
+
dayjs.extend(customParseFormat);
|
|
4
|
+
const VALID_DATETIME_FORMATS = [
|
|
5
|
+
'DD/MM/YYYY HH:mm'
|
|
6
|
+
];
|
|
7
|
+
const DATETIME_CACHE = {};
|
|
8
|
+
const onlyNumbersRegex = /^\d+$/;
|
|
9
|
+
const getDateTime = (v)=>DATETIME_CACHE[v] ? DATETIME_CACHE[v] : dayjs(v, VALID_DATETIME_FORMATS, true);
|
|
10
|
+
const getDaysInMonth = (month, year)=>dayjs(`${year}-${month}-01`).daysInMonth();
|
|
11
|
+
const checkPartialDateTime = (value)=>{
|
|
12
|
+
const [datePart, timePart] = value.split(' ');
|
|
13
|
+
const [day, month, year] = datePart?.split('/') ?? [];
|
|
14
|
+
const [hours, minutes] = timePart?.split(':') ?? [];
|
|
15
|
+
const hasDay = Boolean(day);
|
|
16
|
+
const hasMonth = Boolean(month);
|
|
17
|
+
const hasYear = Boolean(year);
|
|
18
|
+
const hasHours = Boolean(hours);
|
|
19
|
+
const hasMinutes = Boolean(minutes);
|
|
20
|
+
if (hasDay && !hasMonth && !hasYear && !hasHours && !hasMinutes) return 'form.error.datetime.invalid_month_year_hours_minutes';
|
|
21
|
+
if (!hasDay && hasMonth && !hasYear && !hasHours && !hasMinutes) return 'form.error.datetime.invalid_day_year_hours_minutes';
|
|
22
|
+
if (!hasDay && !hasMonth && hasYear && !hasHours && !hasMinutes) return 'form.error.datetime.invalid_day_month_hours_minutes';
|
|
23
|
+
if (hasDay && hasMonth && !hasYear && !hasHours && !hasMinutes) return 'form.error.datetime.invalid_year_hours_minutes';
|
|
24
|
+
if (hasDay && !hasMonth && hasYear && !hasHours && !hasMinutes) return 'form.error.datetime.invalid_month_hours_minutes';
|
|
25
|
+
if (!hasDay && hasMonth && hasYear && !hasHours && !hasMinutes) return 'form.error.datetime.invalid_day_hours_minutes';
|
|
26
|
+
if (hasDay && hasMonth && hasYear && !hasHours && !hasMinutes) return 'form.error.datetime.invalid__hours_minutes';
|
|
27
|
+
if (hasDay && hasMonth && hasYear && hasHours && !hasMinutes) return 'form.error.datetime.invalid_minutes';
|
|
28
|
+
if (hasDay && hasMonth && hasYear && !hasHours && hasMinutes) return 'form.error.datetime.invalid_hours';
|
|
29
|
+
if (hasDay && !hasMonth && !hasYear && hasHours && !hasMinutes) return 'form.error.datetime.invalid_month_year_minutes';
|
|
30
|
+
if (hasDay && !hasMonth && !hasYear && !hasHours && hasMinutes) return 'form.error.datetime.invalid_month_year_hours';
|
|
31
|
+
if (hasDay && !hasMonth && !hasYear && hasHours && hasMinutes) return 'form.error.datetime.invalid_month_year';
|
|
32
|
+
if (!hasDay && hasMonth && !hasYear && hasHours && !hasMinutes) return 'form.error.datetime.invalid_day_year_minutes';
|
|
33
|
+
if (!hasDay && hasMonth && !hasYear && !hasHours && hasMinutes) return 'form.error.datetime.invalid_day_year_hours';
|
|
34
|
+
if (!hasDay && hasMonth && !hasYear && hasHours && hasMinutes) return 'form.error.datetime.invalid_day_year';
|
|
35
|
+
if (!hasDay && !hasMonth && hasYear && hasHours && !hasMinutes) return 'form.error.datetime.invalid_day_month_minutes';
|
|
36
|
+
if (!hasDay && !hasMonth && hasYear && !hasHours && hasMinutes) return 'form.error.datetime.invalid_day_month_hours';
|
|
37
|
+
if (!hasDay && !hasMonth && hasYear && hasHours && hasMinutes) return 'form.error.datetime.invalid_day_month';
|
|
38
|
+
if (!hasDay && !hasMonth && !hasYear && hasHours && hasMinutes) return 'form.error.datetime.invalid_day_month_year';
|
|
39
|
+
if (!hasDay && !hasMonth && !hasYear && !hasHours && hasMinutes) return 'form.error.datetime.invalid_day_month_year_hours';
|
|
40
|
+
if (hasDay && hasMonth && !hasYear && hasHours && !hasMinutes) return 'form.error.datetime.invalid_year_minutes';
|
|
41
|
+
if (hasDay && hasMonth && !hasYear && !hasHours && hasMinutes) return 'form.error.datetime.invalid_year_hours';
|
|
42
|
+
if (hasDay && hasMonth && !hasYear && hasHours && hasMinutes) return 'form.error.datetime.invalid_year';
|
|
43
|
+
if (hasDay && !hasMonth && hasYear && hasHours && !hasMinutes) return 'form.error.datetime.invalid_month_minutes';
|
|
44
|
+
if (hasDay && !hasMonth && hasYear && !hasHours && hasMinutes) return 'form.error.datetime.invalid_month_hours';
|
|
45
|
+
if (hasDay && !hasMonth && hasYear && hasHours && hasMinutes) return 'form.error.datetime.invalid_month';
|
|
46
|
+
if (!hasDay && hasMonth && hasYear && hasHours && !hasMinutes) return 'form.error.datetime.invalid_day_minutes';
|
|
47
|
+
if (!hasDay && hasMonth && hasYear && !hasHours && hasMinutes) return 'form.error.datetime.invalid_day_hours';
|
|
48
|
+
if (!hasDay && hasMonth && hasYear && hasHours && hasMinutes) return 'form.error.datetime.invalid_day';
|
|
49
|
+
if (!hasDay && !hasMonth && !hasYear && hasHours && !hasMinutes) return 'form.error.datetime.invalid_day_month_year_minutes';
|
|
50
|
+
if (hasDay && hasMonth && hasYear && !hasHours && !hasMinutes) return 'form.error.datetime.invalid_hours_minutes';
|
|
51
|
+
if (day && month) {
|
|
52
|
+
const dayNum = parseInt(day);
|
|
53
|
+
const monthNum = parseInt(month);
|
|
54
|
+
const validYear = onlyNumbersRegex.test(year) ? year : void 0;
|
|
55
|
+
if (!validYear || year.length < 4) return 'form.error.datetime.invalid';
|
|
56
|
+
const yearNum = parseInt(validYear);
|
|
57
|
+
const maxDay = getDaysInMonth(monthNum, yearNum);
|
|
58
|
+
if (dayNum < 1 || dayNum > maxDay) return {
|
|
59
|
+
key: 'form.error.datetime.invalid_day_range',
|
|
60
|
+
context: {
|
|
61
|
+
maxDay: maxDay
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
if (monthNum < 1 || monthNum > 12) return 'form.error.datetime.invalid_month_range';
|
|
65
|
+
}
|
|
66
|
+
if (hours && minutes) {
|
|
67
|
+
const hoursNum = parseInt(hours);
|
|
68
|
+
const minutesNum = parseInt(minutes);
|
|
69
|
+
if (hoursNum < 0 || hoursNum > 23) return 'form.error.datetime.invalid_hours_range';
|
|
70
|
+
if (minutesNum < 0 || minutesNum > 59) return 'form.error.datetime.invalid_minutes_range';
|
|
71
|
+
}
|
|
72
|
+
return 'form.error.datetime.invalid';
|
|
73
|
+
};
|
|
74
|
+
const LATER_THAN_DATETIME_VALIDATOR = (field)=>{
|
|
75
|
+
let minDateTime;
|
|
76
|
+
const params = field.extra || {};
|
|
77
|
+
minDateTime = 'now' === params.min ? dayjs() : getDateTime(params.min);
|
|
78
|
+
return {
|
|
79
|
+
name: 'later-than-datetime',
|
|
80
|
+
message: {
|
|
81
|
+
key: 'form.error.datetime.later_than',
|
|
82
|
+
context: {
|
|
83
|
+
minDateTime: minDateTime.format('DD/MM/YYYY HH:mm')
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
test: function(value) {
|
|
87
|
+
if (!value) return true;
|
|
88
|
+
const datetime = getDateTime(value);
|
|
89
|
+
return datetime.isValid() && datetime.isAfter(minDateTime);
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
const EARLIER_THAN_DATETIME_VALIDATOR = (field)=>{
|
|
94
|
+
let maxDateTime;
|
|
95
|
+
const params = field.extra || {};
|
|
96
|
+
maxDateTime = 'now' === params.max ? dayjs() : getDateTime(params.max);
|
|
97
|
+
return {
|
|
98
|
+
name: 'earlier-than-datetime',
|
|
99
|
+
message: {
|
|
100
|
+
key: 'form.error.datetime.earlier_than',
|
|
101
|
+
context: {
|
|
102
|
+
maxDateTime: maxDateTime.format('DD/MM/YYYY HH:mm')
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
test: function(value) {
|
|
106
|
+
if (!value) return true;
|
|
107
|
+
const datetime = getDateTime(value);
|
|
108
|
+
return datetime.isValid() && datetime.isBefore(maxDateTime);
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
const DATETIME_VALIDATOR = {
|
|
113
|
+
name: 'datetime-validator',
|
|
114
|
+
message: (v)=>checkPartialDateTime(v.value),
|
|
115
|
+
test: function(value) {
|
|
116
|
+
if (!value) return true;
|
|
117
|
+
const datetime = getDateTime(value);
|
|
118
|
+
return datetime.isValid();
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
export { DATETIME_VALIDATOR, EARLIER_THAN_DATETIME_VALIDATOR, LATER_THAN_DATETIME_VALIDATOR };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const EMAIL_VALIDATOR = {
|
|
2
|
+
name: 'email-validator',
|
|
3
|
+
message: 'form.error.email',
|
|
4
|
+
test: (value)=>{
|
|
5
|
+
if (!value) return true;
|
|
6
|
+
const EMAIL_REGEX = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
|
7
|
+
return EMAIL_REGEX.test(value);
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
export { EMAIL_VALIDATOR };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { FieldSpec } from '
|
|
2
|
-
import { ValidatorSchema } from '
|
|
1
|
+
import type { FieldSpec } from '../../types.js';
|
|
2
|
+
import type { ValidatorSchema } from '../types.js';
|
|
3
3
|
export declare const FILE_MAX_SIZE_VALIDATOR: (field: FieldSpec) => ValidatorSchema;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const DEFAULT_FILE_MAX_SIZE = 10000000;
|
|
2
|
+
const FILE_MAX_SIZE_VALIDATOR = (field)=>{
|
|
3
|
+
const maxSizeInBytes = field?.extra?.limit?.maxSize || DEFAULT_FILE_MAX_SIZE;
|
|
4
|
+
let maxSizeTransformed = maxSizeInBytes / 1048576;
|
|
5
|
+
let maxSizeText = 'MB';
|
|
6
|
+
if (0 === Math.round(maxSizeTransformed)) {
|
|
7
|
+
maxSizeTransformed = Math.round(maxSizeInBytes / 1024);
|
|
8
|
+
maxSizeText = 'KB';
|
|
9
|
+
}
|
|
10
|
+
if (0 === Math.round(maxSizeTransformed)) {
|
|
11
|
+
maxSizeTransformed = maxSizeInBytes;
|
|
12
|
+
maxSizeText = 'Bytes';
|
|
13
|
+
}
|
|
14
|
+
return {
|
|
15
|
+
name: 'file-max-size-validator',
|
|
16
|
+
message: {
|
|
17
|
+
key: 'file' === field.type ? 'form.error.file_size' : 'form.error.image_size',
|
|
18
|
+
context: {
|
|
19
|
+
maxSize: `${maxSizeTransformed} ${maxSizeText}`
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
test: (value)=>{
|
|
23
|
+
if (value) for (const file of Array.from(value)){
|
|
24
|
+
const maxSize = field?.extra?.limit?.maxSize || DEFAULT_FILE_MAX_SIZE;
|
|
25
|
+
if (file.size > maxSize) return false;
|
|
26
|
+
}
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
export { FILE_MAX_SIZE_VALIDATOR };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FieldSpec } from '
|
|
2
|
-
import { ValidatorSchema } from '
|
|
1
|
+
import type { FieldSpec } from '../../types.js';
|
|
2
|
+
import type { ValidatorSchema } from '../types.js';
|
|
3
3
|
export declare function validateIban(value: string, countryCode: string): boolean;
|
|
4
4
|
export declare const IBAN_VALIDATOR: (field: FieldSpec) => ValidatorSchema;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
function validateIban(value, countryCode) {
|
|
2
|
+
value = value.replace(/\s/g, '').replace(/-/g, '');
|
|
3
|
+
if (value.match(/^[0-9]*$/i)) {
|
|
4
|
+
if (25 !== value.length) return false;
|
|
5
|
+
} else {
|
|
6
|
+
value = value.toUpperCase();
|
|
7
|
+
if (countryCode) {
|
|
8
|
+
if (!value.startsWith(countryCode.toUpperCase())) return false;
|
|
9
|
+
if (value.length === ibanCountryCodesLengths[countryCode.toUpperCase()]) return true;
|
|
10
|
+
}
|
|
11
|
+
if (27 !== value.length) return false;
|
|
12
|
+
}
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
const IBAN_VALIDATOR = (field)=>{
|
|
16
|
+
const countryCode = field?.extra?.country;
|
|
17
|
+
return {
|
|
18
|
+
name: 'iban-validator',
|
|
19
|
+
message: 'form.error.iban',
|
|
20
|
+
test: (value)=>{
|
|
21
|
+
if (!value) return true;
|
|
22
|
+
return validateIban(value, countryCode);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
const ibanCountryCodesLengths = {
|
|
27
|
+
AD: 24,
|
|
28
|
+
AT: 20,
|
|
29
|
+
AZ: 28,
|
|
30
|
+
BH: 22,
|
|
31
|
+
BY: 28,
|
|
32
|
+
BE: 16,
|
|
33
|
+
BA: 20,
|
|
34
|
+
BR: 29,
|
|
35
|
+
BG: 22,
|
|
36
|
+
CR: 22,
|
|
37
|
+
HR: 21,
|
|
38
|
+
CY: 28,
|
|
39
|
+
CZ: 24,
|
|
40
|
+
DK: 18,
|
|
41
|
+
DO: 28,
|
|
42
|
+
EG: 29,
|
|
43
|
+
SV: 28,
|
|
44
|
+
EE: 20,
|
|
45
|
+
FO: 18,
|
|
46
|
+
FI: 18,
|
|
47
|
+
FR: 27,
|
|
48
|
+
GE: 22,
|
|
49
|
+
DE: 22,
|
|
50
|
+
GI: 23,
|
|
51
|
+
GR: 27,
|
|
52
|
+
GL: 18,
|
|
53
|
+
GT: 28,
|
|
54
|
+
VA: 22,
|
|
55
|
+
HU: 28,
|
|
56
|
+
IS: 26,
|
|
57
|
+
IQ: 23,
|
|
58
|
+
IE: 22,
|
|
59
|
+
IL: 23,
|
|
60
|
+
IT: 27,
|
|
61
|
+
JO: 30,
|
|
62
|
+
KZ: 20,
|
|
63
|
+
XK: 20,
|
|
64
|
+
KW: 30,
|
|
65
|
+
LV: 21,
|
|
66
|
+
LB: 28,
|
|
67
|
+
LI: 21,
|
|
68
|
+
LT: 20,
|
|
69
|
+
LU: 20,
|
|
70
|
+
MT: 31,
|
|
71
|
+
MR: 27,
|
|
72
|
+
MU: 30,
|
|
73
|
+
MD: 24,
|
|
74
|
+
MC: 27,
|
|
75
|
+
ME: 22,
|
|
76
|
+
NL: 18,
|
|
77
|
+
MK: 19,
|
|
78
|
+
NO: 15,
|
|
79
|
+
PK: 24,
|
|
80
|
+
PS: 29,
|
|
81
|
+
PL: 28,
|
|
82
|
+
PT: 25,
|
|
83
|
+
QA: 29,
|
|
84
|
+
RO: 24,
|
|
85
|
+
LC: 32,
|
|
86
|
+
SM: 27,
|
|
87
|
+
ST: 25,
|
|
88
|
+
SA: 24,
|
|
89
|
+
RS: 22,
|
|
90
|
+
SC: 31,
|
|
91
|
+
SK: 24,
|
|
92
|
+
SI: 19,
|
|
93
|
+
ES: 24,
|
|
94
|
+
SE: 24,
|
|
95
|
+
CH: 21,
|
|
96
|
+
TL: 23,
|
|
97
|
+
TN: 24,
|
|
98
|
+
TR: 26,
|
|
99
|
+
UA: 29,
|
|
100
|
+
AE: 23,
|
|
101
|
+
GB: 22,
|
|
102
|
+
VG: 24
|
|
103
|
+
};
|
|
104
|
+
export { IBAN_VALIDATOR, validateIban };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { FieldSpec } from '
|
|
2
|
-
import { ValidatorSchema } from '
|
|
1
|
+
import type { FieldSpec } from '../../types.js';
|
|
2
|
+
import type { ValidatorSchema } from '../types.js';
|
|
3
3
|
export declare const IMAGE_DIMENSION_VALIDATOR: (field: FieldSpec) => ValidatorSchema;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
const DEFAULT_IMAGE_MAX_HEIGHT_SIZE = 2000;
|
|
2
|
+
const DEFAULT_IMAGE_MAX_WIDTH_SIZE = 2000;
|
|
3
|
+
const DEFAULT_IMAGE_MIN_HEIGHT_SIZE = 100;
|
|
4
|
+
const DEFAULT_IMAGE_MIN_WIDTH_SIZE = 100;
|
|
5
|
+
function getImageDimensions(file) {
|
|
6
|
+
return new Promise((resolve, reject)=>{
|
|
7
|
+
const reader = new FileReader();
|
|
8
|
+
reader.onload = (event)=>{
|
|
9
|
+
const img = new Image();
|
|
10
|
+
img.onload = ()=>{
|
|
11
|
+
resolve({
|
|
12
|
+
width: img.width,
|
|
13
|
+
height: img.height
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
img.onerror = reject;
|
|
17
|
+
const result = event?.target?.result;
|
|
18
|
+
if (result && 'string' == typeof result) img.src = result;
|
|
19
|
+
else reject(new Error('Invalid file format'));
|
|
20
|
+
};
|
|
21
|
+
reader.onerror = reject;
|
|
22
|
+
reader.readAsDataURL(file);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
const IMAGE_DIMENSION_VALIDATOR = (field)=>({
|
|
26
|
+
name: 'image-dimension-validator',
|
|
27
|
+
message: (value)=>{
|
|
28
|
+
const minHeight = field?.extra?.limit?.minHeight || DEFAULT_IMAGE_MIN_HEIGHT_SIZE;
|
|
29
|
+
const minWidth = field?.extra?.limit?.minWidth || DEFAULT_IMAGE_MIN_WIDTH_SIZE;
|
|
30
|
+
const maxHeight = field?.extra?.limit?.maxHeight || DEFAULT_IMAGE_MAX_HEIGHT_SIZE;
|
|
31
|
+
const maxWidth = field?.extra?.limit?.maxWidth || DEFAULT_IMAGE_MAX_WIDTH_SIZE;
|
|
32
|
+
if (!value || 0 === value.length) return {
|
|
33
|
+
name: 'image-validator',
|
|
34
|
+
message: 'form.error.required'
|
|
35
|
+
};
|
|
36
|
+
return {
|
|
37
|
+
key: 'form.error.image.image_dimension_size',
|
|
38
|
+
context: {
|
|
39
|
+
maxHeight: maxHeight,
|
|
40
|
+
maxWidth: maxWidth,
|
|
41
|
+
minHeight: minHeight,
|
|
42
|
+
minWidth: minWidth
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
},
|
|
46
|
+
test: async (value)=>{
|
|
47
|
+
if (!value || 0 === value.length) return true;
|
|
48
|
+
const file = value[0];
|
|
49
|
+
const { width, height } = await getImageDimensions(file);
|
|
50
|
+
const maxHeight = field?.extra?.limit?.maxHeight || DEFAULT_IMAGE_MAX_HEIGHT_SIZE;
|
|
51
|
+
const maxWidth = field?.extra?.limit?.maxWidth || DEFAULT_IMAGE_MAX_WIDTH_SIZE;
|
|
52
|
+
const minHeight = field?.extra?.limit?.minHeight || DEFAULT_IMAGE_MIN_HEIGHT_SIZE;
|
|
53
|
+
const minWidth = field?.extra?.limit?.minWidth || DEFAULT_IMAGE_MIN_WIDTH_SIZE;
|
|
54
|
+
if (!file) return true;
|
|
55
|
+
try {
|
|
56
|
+
if (height > maxHeight || width > maxWidth) return false;
|
|
57
|
+
if (height < minHeight || width < minWidth) return false;
|
|
58
|
+
return true;
|
|
59
|
+
} catch (error) {
|
|
60
|
+
console.error('Error getting image dimensions:', error);
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
export { IMAGE_DIMENSION_VALIDATOR };
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
|
-
import { FieldSpec } from '
|
|
3
|
-
import { ValidatorSchema } from '
|
|
4
|
-
export * from '
|
|
5
|
-
export * from '
|
|
6
|
-
export * from '
|
|
7
|
-
export * from '
|
|
8
|
-
export * from '
|
|
9
|
-
export * from '
|
|
10
|
-
export * from '
|
|
11
|
-
export * from '
|
|
12
|
-
export * from '
|
|
2
|
+
import type { FieldSpec } from '../../types.js';
|
|
3
|
+
import type { ValidatorSchema } from '../types.js';
|
|
4
|
+
export * from './afm.js';
|
|
5
|
+
export * from './amka.js';
|
|
6
|
+
export * from './file.js';
|
|
7
|
+
export * from './iban.js';
|
|
8
|
+
export * from './otp.js';
|
|
9
|
+
export * from './image.js';
|
|
10
|
+
export * from './phone.js';
|
|
11
|
+
export * from './postal_code.js';
|
|
12
|
+
export * from './uuid4.js';
|
|
13
|
+
export * from './text_limit.js';
|
|
14
|
+
export * from './date.js';
|
|
15
|
+
export * from './datetime.js';
|
|
13
16
|
export declare function getYupField(field: FieldSpec, yupTypeMap: Record<string, any>): any;
|
|
14
17
|
export declare function computeShape(fields: FieldSpec[], yupTypeMap: Record<string, ValidatorSchema>, validatorRegistry: Record<string, ValidatorSchema[]> | undefined): {};
|
|
15
18
|
export declare function getYupObjectShape(fields: FieldSpec[] | any, yupTypeMap: Record<string, any>, validatorRegistry?: Record<string, ValidatorSchema[]>): yup.ObjectSchema<{
|
|
@@ -1,89 +1,66 @@
|
|
|
1
|
-
import
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
9
|
-
export * from
|
|
10
|
-
export * from
|
|
11
|
-
export
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { lazy, object } from "yup";
|
|
2
|
+
export * from "./afm.js";
|
|
3
|
+
export * from "./amka.js";
|
|
4
|
+
export * from "./file.js";
|
|
5
|
+
export * from "./iban.js";
|
|
6
|
+
export * from "./otp.js";
|
|
7
|
+
export * from "./image.js";
|
|
8
|
+
export * from "./phone.js";
|
|
9
|
+
export * from "./postal_code.js";
|
|
10
|
+
export * from "./uuid4.js";
|
|
11
|
+
export * from "./text_limit.js";
|
|
12
|
+
export * from "./date.js";
|
|
13
|
+
export * from "./datetime.js";
|
|
14
|
+
function getYupField(field, yupTypeMap) {
|
|
15
|
+
const yupField = yupTypeMap[field?.type || 'string'] || yupTypeMap['string'];
|
|
16
|
+
return yupField(field);
|
|
14
17
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
18
|
+
function computeShape(fields, yupTypeMap, validatorRegistry) {
|
|
19
|
+
const fieldSchemas = {};
|
|
20
|
+
const objectFields = {};
|
|
21
|
+
fields.forEach((field)=>{
|
|
22
|
+
let yupField = getYupField(field, yupTypeMap);
|
|
23
|
+
if (field.condition) for(const key in field.condition){
|
|
24
|
+
let then, otherwise;
|
|
25
|
+
if (field.condition[key].then) {
|
|
26
|
+
if (field.condition[key].then?.required === false) then = yupField.nullable();
|
|
27
|
+
else if (field.condition[key].then?.required === true) then = yupField.nullable().required('form.error.required');
|
|
28
|
+
}
|
|
29
|
+
if (field.condition[key].else) {
|
|
30
|
+
if (field.condition[key].else?.required === false) otherwise = yupField.nullable();
|
|
31
|
+
else if (field.condition[key].else?.required === true) otherwise = yupField.nullable().required('form.error.required');
|
|
32
|
+
}
|
|
33
|
+
if (then || otherwise) yupField = yupField.when(key, {
|
|
34
|
+
is: (val)=>{
|
|
35
|
+
const is = field.condition[key].is;
|
|
36
|
+
if (is === val || Array.isArray(val) && val.includes(is)) return true;
|
|
37
|
+
return false;
|
|
38
|
+
},
|
|
39
|
+
then,
|
|
40
|
+
otherwise
|
|
41
|
+
});
|
|
30
42
|
}
|
|
31
|
-
if (field.
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
then: then,
|
|
51
|
-
otherwise: otherwise
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
for (var key in field.condition) {
|
|
56
|
-
_loop(key);
|
|
57
|
-
}
|
|
58
|
-
} else if (field.required) {
|
|
59
|
-
yupField = yupField.nullable().required('form.error.required');
|
|
60
|
-
}
|
|
61
|
-
if (validatorRegistry && field.type && validatorRegistry[field.type]) {
|
|
62
|
-
validatorRegistry[field.type].forEach(function (validator) {
|
|
63
|
-
yupField = yupField.test(validator);
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
if (field.validators) {
|
|
67
|
-
field.validators.forEach(function (validator) {
|
|
68
|
-
yupField = yupField.test(validator);
|
|
69
|
-
});
|
|
43
|
+
else if (field.required) yupField = yupField.nullable().required('form.error.required');
|
|
44
|
+
if (validatorRegistry && field.type && validatorRegistry[field.type]) if (Array.isArray(validatorRegistry[field.type])) validatorRegistry[field.type].forEach((validator)=>{
|
|
45
|
+
yupField = yupField.test(validator);
|
|
46
|
+
});
|
|
47
|
+
else yupField = yupField.test(validatorRegistry[field.type]);
|
|
48
|
+
if (field.validators) field.validators.forEach((validator)=>{
|
|
49
|
+
yupField = yupField.test(validator);
|
|
50
|
+
});
|
|
51
|
+
fieldSchemas[field.key] = yupField;
|
|
52
|
+
});
|
|
53
|
+
for(const objectKey in objectFields)fieldSchemas[objectKey] = getYupObjectShape(objectFields[objectKey], yupTypeMap, validatorRegistry);
|
|
54
|
+
return fieldSchemas;
|
|
55
|
+
}
|
|
56
|
+
function getYupObjectShape(fields, yupTypeMap, validatorRegistry) {
|
|
57
|
+
if (!fields.current) {
|
|
58
|
+
const fieldSchemas = computeShape(fields, yupTypeMap, validatorRegistry);
|
|
59
|
+
return object().shape(fieldSchemas);
|
|
70
60
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
return fieldSchemas;
|
|
61
|
+
return lazy(function() {
|
|
62
|
+
const fieldSchemas = computeShape(Object.values(fields.current).filter((f)=>!f.key.includes('.')), yupTypeMap, validatorRegistry);
|
|
63
|
+
return object().shape(fieldSchemas);
|
|
64
|
+
});
|
|
77
65
|
}
|
|
78
|
-
export
|
|
79
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
80
|
-
fields, yupTypeMap, validatorRegistry) {
|
|
81
|
-
if (!fields.current) {
|
|
82
|
-
var fieldSchemas = computeShape(fields, yupTypeMap, validatorRegistry);
|
|
83
|
-
return yup.object().shape(fieldSchemas);
|
|
84
|
-
}
|
|
85
|
-
return yup.lazy(function () {
|
|
86
|
-
var fieldSchemas = computeShape(Object.values(fields.current), yupTypeMap, validatorRegistry);
|
|
87
|
-
return yup.object().shape(fieldSchemas);
|
|
88
|
-
});
|
|
89
|
-
}
|
|
66
|
+
export { computeShape, getYupField, getYupObjectShape };
|