@digigov/form 0.10.7 → 0.10.8
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 +8 -1
- package/{dist/Field → Field}/FieldBase.d.ts +0 -0
- package/{dist/Field → Field}/FieldBase.js +0 -0
- package/{dist/Field → Field}/FieldBaseContainer.d.ts +0 -0
- package/{dist/Field → Field}/FieldBaseContainer.js +0 -0
- package/{dist/Field → Field}/FieldConditional.d.ts +0 -0
- package/{dist/Field → Field}/FieldConditional.js +0 -0
- package/{dist/Field → Field}/index.d.ts +0 -0
- package/{dist/Field → Field}/index.js +0 -0
- package/{dist/Field → Field}/index.mdx +0 -0
- package/{dist/Field → Field}/types.d.ts +0 -0
- package/{dist/Field → Field}/types.js +0 -0
- package/{dist/Field → Field}/utils.d.ts +0 -0
- package/{dist/Field → Field}/utils.js +0 -0
- package/{dist/FieldArray → FieldArray}/FieldArray.stories.d.ts +1 -0
- package/{dist/FieldArray → FieldArray}/FieldArray.stories.js +2 -1
- package/{dist/FieldArray → FieldArray}/FieldArray.stories.playwright.json +0 -0
- package/{dist/FieldArray → FieldArray}/__stories__/Default.d.ts +0 -0
- package/{dist/FieldArray → FieldArray}/__stories__/Default.js +0 -0
- package/{dist/FieldArray → FieldArray}/__stories__/WithExactLength.d.ts +0 -0
- package/{dist/FieldArray → FieldArray}/__stories__/WithExactLength.js +0 -0
- package/{dist/FieldArray → FieldArray}/index.d.ts +0 -0
- package/{dist/FieldArray → FieldArray}/index.js +0 -0
- package/{dist/FieldObject → FieldObject}/index.d.ts +0 -0
- package/{dist/FieldObject → FieldObject}/index.js +0 -0
- package/{dist/Fieldset → Fieldset}/FieldsetWithContext.d.ts +0 -0
- package/{dist/Fieldset → Fieldset}/FieldsetWithContext.js +0 -0
- package/{dist/Fieldset → Fieldset}/index.d.ts +0 -0
- package/{dist/Fieldset → Fieldset}/index.js +0 -0
- package/{dist/Fieldset → Fieldset}/types.d.ts +0 -0
- package/{dist/Fieldset → Fieldset}/types.js +0 -0
- package/{dist/Form.stories.d.ts → Form.stories.d.ts} +0 -0
- package/{dist/Form.stories.js → Form.stories.js} +0 -0
- package/{dist/Form.stories.playwright.json → Form.stories.playwright.json} +0 -0
- package/{dist/FormBuilder → FormBuilder}/FormBuilder.d.ts +0 -0
- package/{dist/FormBuilder → FormBuilder}/FormBuilder.js +0 -0
- package/{dist/FormBuilder → FormBuilder}/FormBuilder.mdx +0 -0
- package/{dist/FormBuilder → FormBuilder}/FormBuilder.stories.d.ts +1 -0
- package/{dist/FormBuilder → FormBuilder}/FormBuilder.stories.js +2 -1
- package/{dist/FormBuilder → FormBuilder}/FormBuilder.stories.playwright.json +0 -0
- package/{dist/FormBuilder → FormBuilder}/__stories__/Default.d.ts +0 -0
- package/{dist/FormBuilder → FormBuilder}/__stories__/Default.js +0 -0
- package/{dist/FormBuilder → FormBuilder}/index.d.ts +0 -0
- package/{dist/FormBuilder → FormBuilder}/index.js +0 -0
- package/{dist/FormContext.d.ts → FormContext.d.ts} +0 -0
- package/{dist/FormContext.js → FormContext.js} +0 -0
- package/{dist/LICENSE → LICENSE} +0 -0
- package/{dist/MultiplicityField → MultiplicityField}/MultiplicityField.mdx +0 -0
- package/{dist/MultiplicityField → MultiplicityField}/MultiplicityField.stories.d.ts +1 -0
- package/{dist/MultiplicityField → MultiplicityField}/MultiplicityField.stories.js +2 -1
- package/{dist/MultiplicityField → MultiplicityField}/MultiplicityField.stories.playwright.json +0 -0
- package/{dist/MultiplicityField → MultiplicityField}/__stories__/Default.d.ts +0 -0
- package/{dist/MultiplicityField → MultiplicityField}/__stories__/Default.js +0 -0
- package/{dist/MultiplicityField → MultiplicityField}/__stories__/PreviewDisplay.d.ts +0 -0
- package/{dist/MultiplicityField → MultiplicityField}/__stories__/PreviewDisplay.js +0 -0
- package/{dist/MultiplicityField → MultiplicityField}/__stories__/WithExactLength.d.ts +0 -0
- package/{dist/MultiplicityField → MultiplicityField}/__stories__/WithExactLength.js +0 -0
- package/{dist/MultiplicityField → MultiplicityField}/__stories__/WithMaxLength.d.ts +0 -0
- package/{dist/MultiplicityField → MultiplicityField}/__stories__/WithMaxLength.js +0 -0
- package/{dist/MultiplicityField → MultiplicityField}/__stories__/WithMinAndMaxLength.d.ts +0 -0
- package/{dist/MultiplicityField → MultiplicityField}/__stories__/WithMinAndMaxLength.js +0 -0
- package/{dist/MultiplicityField → MultiplicityField}/__stories__/WithMinLength.d.ts +0 -0
- package/{dist/MultiplicityField → MultiplicityField}/__stories__/WithMinLength.js +0 -0
- package/{dist/MultiplicityField → MultiplicityField}/add-objects.d.ts +0 -0
- package/{dist/MultiplicityField → MultiplicityField}/add-objects.js +0 -0
- package/{dist/MultiplicityField → MultiplicityField}/index.d.ts +0 -0
- package/{dist/MultiplicityField → MultiplicityField}/index.js +0 -0
- package/{dist/Questions → Questions}/Questions.d.ts +0 -0
- package/{dist/Questions → Questions}/Questions.js +0 -0
- package/Questions/Questions.stories.d.ts +8 -0
- package/Questions/Questions.stories.js +31 -0
- package/{dist/Questions → Questions}/QuestionsContext.d.ts +0 -0
- package/{dist/Questions → Questions}/QuestionsContext.js +0 -0
- package/{dist/Questions → Questions}/Step/ReviewStep.d.ts +0 -0
- package/{dist/Questions → Questions}/Step/ReviewStep.js +0 -0
- package/{dist/Questions → Questions}/Step/Step.d.ts +0 -0
- package/{dist/Questions → Questions}/Step/Step.js +0 -0
- package/{dist/Questions → Questions}/Step/StepArrayReview.d.ts +0 -0
- package/{dist/Questions → Questions}/Step/StepArrayReview.js +0 -0
- package/{dist/Questions → Questions}/Step/StepContext.d.ts +0 -0
- package/{dist/Questions → Questions}/Step/StepContext.js +0 -0
- package/{dist/Questions → Questions}/Step/StepDescription.d.ts +0 -0
- package/{dist/Questions → Questions}/Step/StepDescription.js +0 -0
- package/{dist/Questions → Questions}/Step/StepForm.d.ts +0 -0
- package/{dist/Questions → Questions}/Step/StepForm.js +0 -0
- package/{dist/Questions → Questions}/Step/StepQuote.d.ts +0 -0
- package/{dist/Questions → Questions}/Step/StepQuote.js +0 -0
- package/{dist/Questions → Questions}/Step/StepTitle.d.ts +0 -0
- package/{dist/Questions → Questions}/Step/StepTitle.js +0 -0
- package/{dist/Questions → Questions}/Step/getAddMoreFields.d.ts +0 -0
- package/{dist/Questions → Questions}/Step/getAddMoreFields.js +0 -0
- package/{dist/Questions → Questions}/Step/index.d.ts +0 -0
- package/{dist/Questions → Questions}/Step/index.js +0 -0
- package/{dist/Questions → Questions}/Step/types.d.ts +0 -0
- package/{dist/Questions → Questions}/Step/types.js +0 -0
- package/{dist/Questions → Questions}/__snapshots__/index.spec.tsx.snap +0 -0
- package/Questions/__stories__/Default.d.ts +2 -0
- package/Questions/__stories__/Default.js +130 -0
- package/{dist/Questions → Questions}/getNextStep.d.ts +0 -0
- package/{dist/Questions → Questions}/getNextStep.js +0 -0
- package/{dist/Questions → Questions}/index.d.ts +0 -0
- package/{dist/Questions → Questions}/index.js +0 -0
- package/Questions/index.mdx +418 -0
- package/{dist/Questions → Questions}/index.spec.d.ts +0 -0
- package/{dist/Questions → Questions}/index.spec.js +0 -0
- package/{dist/Questions → Questions}/types.d.ts +0 -0
- package/{dist/Questions → Questions}/types.js +0 -0
- package/{dist/__stories__ → __stories__}/AutoCompleteField.d.ts +0 -0
- package/{dist/__stories__ → __stories__}/AutoCompleteField.js +0 -0
- package/{dist/__stories__ → __stories__}/IntField.d.ts +0 -0
- package/{dist/__stories__ → __stories__}/IntField.js +0 -0
- package/{dist/create-simple-form.mdx → create-simple-form.mdx} +0 -0
- package/{dist/es → es}/Field/FieldBase.js +0 -0
- package/{dist/es → es}/Field/FieldBaseContainer.js +0 -0
- package/{dist/es → es}/Field/FieldConditional.js +0 -0
- package/{dist/es → es}/Field/index.js +0 -0
- package/{dist/es → es}/Field/index.mdx +0 -0
- package/{dist/es → es}/Field/types.js +0 -0
- package/{dist/es → es}/Field/utils.js +0 -0
- package/{src → es}/FieldArray/FieldArray.stories.js +2 -1
- package/{dist/es → es}/FieldArray/FieldArray.stories.playwright.json +0 -0
- package/{dist/es → es}/FieldArray/__stories__/Default.js +0 -0
- package/{dist/es → es}/FieldArray/__stories__/WithExactLength.js +0 -0
- package/{dist/es → es}/FieldArray/index.js +0 -0
- package/{dist/es → es}/FieldObject/index.js +0 -0
- package/{dist/es → es}/Fieldset/FieldsetWithContext.js +0 -0
- package/{dist/es → es}/Fieldset/index.js +0 -0
- package/{dist/es → es}/Fieldset/types.js +0 -0
- package/{dist/es → es}/Form.stories.js +0 -0
- package/{dist/es → es}/Form.stories.playwright.json +0 -0
- package/{dist/es → es}/FormBuilder/FormBuilder.js +0 -0
- package/{dist/es → es}/FormBuilder/FormBuilder.mdx +0 -0
- package/{src → es}/FormBuilder/FormBuilder.stories.js +2 -1
- package/{dist/es → es}/FormBuilder/FormBuilder.stories.playwright.json +0 -0
- package/{dist/es → es}/FormBuilder/__stories__/Default.js +0 -0
- package/{dist/es → es}/FormBuilder/index.js +0 -0
- package/{dist/es → es}/FormContext.js +0 -0
- package/{dist/es → es}/MultiplicityField/MultiplicityField.mdx +0 -0
- package/{src → es}/MultiplicityField/MultiplicityField.stories.js +2 -1
- package/{dist/es → es}/MultiplicityField/MultiplicityField.stories.playwright.json +0 -0
- package/{dist/es → es}/MultiplicityField/__stories__/Default.js +0 -0
- package/{dist/es → es}/MultiplicityField/__stories__/PreviewDisplay.js +0 -0
- package/{dist/es → es}/MultiplicityField/__stories__/WithExactLength.js +0 -0
- package/{dist/es → es}/MultiplicityField/__stories__/WithMaxLength.js +0 -0
- package/{dist/es → es}/MultiplicityField/__stories__/WithMinAndMaxLength.js +0 -0
- package/{dist/es → es}/MultiplicityField/__stories__/WithMinLength.js +0 -0
- package/{dist/es → es}/MultiplicityField/add-objects.js +0 -0
- package/{dist/es → es}/MultiplicityField/index.js +0 -0
- package/{dist/es → es}/Questions/Questions.js +0 -0
- package/es/Questions/Questions.stories.js +7 -0
- package/{dist/es → es}/Questions/QuestionsContext.js +0 -0
- package/{dist/es → es}/Questions/Step/ReviewStep.js +0 -0
- package/{dist/es → es}/Questions/Step/Step.js +0 -0
- package/{dist/es → es}/Questions/Step/StepArrayReview.js +0 -0
- package/{dist/es → es}/Questions/Step/StepContext.js +0 -0
- package/{dist/es → es}/Questions/Step/StepDescription.js +0 -0
- package/{dist/es → es}/Questions/Step/StepForm.js +0 -0
- package/{dist/es → es}/Questions/Step/StepQuote.js +0 -0
- package/{dist/es → es}/Questions/Step/StepTitle.js +0 -0
- package/{dist/es → es}/Questions/Step/getAddMoreFields.js +0 -0
- package/{dist/es → es}/Questions/Step/index.js +0 -0
- package/{dist/es → es}/Questions/Step/types.js +0 -0
- package/{dist/es → es}/Questions/__snapshots__/index.spec.tsx.snap +0 -0
- package/es/Questions/__stories__/Default.js +103 -0
- package/{dist/es → es}/Questions/getNextStep.js +0 -0
- package/{dist/es → es}/Questions/index.js +0 -0
- package/es/Questions/index.mdx +418 -0
- package/{dist/es → es}/Questions/index.spec.js +0 -0
- package/{dist/es → es}/Questions/types.js +0 -0
- package/{dist/es → es}/__stories__/AutoCompleteField.js +0 -0
- package/{dist/es → es}/__stories__/IntField.js +0 -0
- package/{dist/es → es}/create-simple-form.mdx +0 -0
- package/{dist/es → es}/index.js +0 -0
- package/{dist/es → es}/index.mdx +0 -0
- package/{dist/es → es}/inputs/AutoComplete/index.js +0 -0
- package/{src → es}/inputs/Checkboxes/Checkboxes.stories.js +2 -1
- package/{dist/es → es}/inputs/Checkboxes/Checkboxes.stories.playwright.json +0 -0
- package/{dist/es → es}/inputs/Checkboxes/__stories__/Default.js +0 -0
- package/{dist/es → es}/inputs/Checkboxes/index.js +0 -0
- package/{dist/es → es}/inputs/Checkboxes/index.mdx +0 -0
- package/{src → es}/inputs/DateInput/DateInput.stories.js +2 -1
- package/{dist/es → es}/inputs/DateInput/DateInput.stories.playwright.json +0 -0
- package/{dist/es → es}/inputs/DateInput/__stories__/Default.js +0 -0
- package/{dist/es → es}/inputs/DateInput/index.js +0 -0
- package/{src → es}/inputs/FileInput/FileInput.stories.js +2 -1
- package/{dist/es → es}/inputs/FileInput/FileInput.stories.playwright.json +0 -0
- package/{dist/es → es}/inputs/FileInput/__stories__/Default.js +0 -0
- package/{dist/es → es}/inputs/FileInput/index.js +0 -0
- package/{src → es}/inputs/Input/Input.stories.js +2 -1
- package/{dist/es → es}/inputs/Input/Input.stories.playwright.json +0 -0
- package/{dist/es → es}/inputs/Input/__stories__/AFM.js +0 -0
- package/{dist/es → es}/inputs/Input/__stories__/Boolean.js +0 -0
- package/{dist/es → es}/inputs/Input/__stories__/Default.js +0 -0
- package/{dist/es → es}/inputs/Input/__stories__/IBAN.js +0 -0
- package/{dist/es → es}/inputs/Input/__stories__/Integer.js +0 -0
- package/{dist/es → es}/inputs/Input/__stories__/MobilePhone.js +0 -0
- package/{dist/es → es}/inputs/Input/__stories__/PhoneNumber.js +0 -0
- package/{dist/es → es}/inputs/Input/__stories__/PostalCode.js +0 -0
- package/{dist/es → es}/inputs/Input/index.js +0 -0
- package/{dist/es → es}/inputs/Input/index.mdx +0 -0
- package/{src → es}/inputs/Label/Label.stories.js +2 -1
- package/{dist/es → es}/inputs/Label/Label.stories.playwright.json +0 -0
- package/{dist/es → es}/inputs/Label/__stories__/Default.js +0 -0
- package/{dist/es → es}/inputs/Label/index.js +0 -0
- package/{dist/es → es}/inputs/Label/index.mdx +0 -0
- package/{src → es}/inputs/Radio/Radio.stories.js +2 -1
- package/{dist/es → es}/inputs/Radio/Radio.stories.playwright.json +0 -0
- package/{dist/es → es}/inputs/Radio/__stories__/Default.js +0 -0
- package/{dist/es → es}/inputs/Radio/index.js +0 -0
- package/{dist/es → es}/inputs/Radio/index.mdx +0 -0
- package/{src → es}/inputs/Select/Select.stories.js +2 -1
- package/{dist/es → es}/inputs/Select/Select.stories.playwright.json +0 -0
- package/{dist/es → es}/inputs/Select/__stories__/Default.js +0 -0
- package/{dist/es → es}/inputs/Select/index.js +0 -0
- package/{dist/es → es}/inputs/index.js +0 -0
- package/{dist/es → es}/installation.mdx +0 -0
- package/{dist/es → es}/internal.js +0 -0
- package/{dist/es → es}/registry.js +0 -0
- package/{dist/es → es}/types.js +0 -0
- package/{dist/es → es}/utils.js +0 -0
- package/{dist/es → es}/validators/index.js +0 -0
- package/{dist/es → es}/validators/types.js +0 -0
- package/{dist/es → es}/validators/utils/afm.js +0 -0
- package/{dist/es → es}/validators/utils/file.js +0 -0
- package/{dist/es → es}/validators/utils/iban.js +0 -0
- package/{dist/es → es}/validators/utils/index.js +0 -0
- package/{dist/es → es}/validators/utils/int.js +0 -0
- package/{dist/es → es}/validators/utils/number.js +0 -0
- package/{dist/es → es}/validators/utils/phone.js +0 -0
- package/{dist/es → es}/validators/utils/postal_code.js +0 -0
- package/{dist/es → es}/validators/utils/uuid4.js +0 -0
- package/{dist/es → es}/validators/validators.spec.js +0 -0
- package/{dist/esm → esm}/Field/FieldBase.js +0 -0
- package/{dist/esm → esm}/Field/FieldBaseContainer.js +0 -0
- package/{dist/esm → esm}/Field/FieldConditional.js +0 -0
- package/{dist/esm → esm}/Field/index.js +0 -0
- package/{dist/esm → esm}/Field/index.mdx +0 -0
- package/{dist/esm → esm}/Field/types.js +0 -0
- package/{dist/esm → esm}/Field/utils.js +0 -0
- package/{dist/esm → esm}/FieldArray/FieldArray.stories.js +2 -1
- package/{dist/esm → esm}/FieldArray/FieldArray.stories.playwright.json +0 -0
- package/{dist/esm → esm}/FieldArray/__stories__/Default.js +0 -0
- package/{dist/esm → esm}/FieldArray/__stories__/WithExactLength.js +0 -0
- package/{dist/esm → esm}/FieldArray/index.js +0 -0
- package/{dist/esm → esm}/FieldObject/index.js +0 -0
- package/{dist/esm → esm}/Fieldset/FieldsetWithContext.js +0 -0
- package/{dist/esm → esm}/Fieldset/index.js +0 -0
- package/{dist/esm → esm}/Fieldset/types.js +0 -0
- package/{dist/esm → esm}/Form.stories.js +0 -0
- package/{dist/esm → esm}/Form.stories.playwright.json +0 -0
- package/{dist/esm → esm}/FormBuilder/FormBuilder.js +0 -0
- package/{dist/esm → esm}/FormBuilder/FormBuilder.mdx +0 -0
- package/esm/FormBuilder/FormBuilder.stories.js +7 -0
- package/{dist/esm → esm}/FormBuilder/FormBuilder.stories.playwright.json +0 -0
- package/{dist/esm → esm}/FormBuilder/__stories__/Default.js +0 -0
- package/{dist/esm → esm}/FormBuilder/index.js +0 -0
- package/{dist/esm → esm}/FormContext.js +0 -0
- package/{dist/esm → esm}/MultiplicityField/MultiplicityField.mdx +0 -0
- package/{dist/es → esm}/MultiplicityField/MultiplicityField.stories.js +2 -1
- package/{dist/esm → esm}/MultiplicityField/MultiplicityField.stories.playwright.json +0 -0
- package/{dist/esm → esm}/MultiplicityField/__stories__/Default.js +0 -0
- package/{dist/esm → esm}/MultiplicityField/__stories__/PreviewDisplay.js +0 -0
- package/{dist/esm → esm}/MultiplicityField/__stories__/WithExactLength.js +0 -0
- package/{dist/esm → esm}/MultiplicityField/__stories__/WithMaxLength.js +0 -0
- package/{dist/esm → esm}/MultiplicityField/__stories__/WithMinAndMaxLength.js +0 -0
- package/{dist/esm → esm}/MultiplicityField/__stories__/WithMinLength.js +0 -0
- package/{dist/esm → esm}/MultiplicityField/add-objects.js +0 -0
- package/{dist/esm → esm}/MultiplicityField/index.js +0 -0
- package/{dist/esm → esm}/Questions/Questions.js +0 -0
- package/esm/Questions/Questions.stories.js +7 -0
- package/{dist/esm → esm}/Questions/QuestionsContext.js +0 -0
- package/{dist/esm → esm}/Questions/Step/ReviewStep.js +0 -0
- package/{dist/esm → esm}/Questions/Step/Step.js +0 -0
- package/{dist/esm → esm}/Questions/Step/StepArrayReview.js +0 -0
- package/{dist/esm → esm}/Questions/Step/StepContext.js +0 -0
- package/{dist/esm → esm}/Questions/Step/StepDescription.js +0 -0
- package/{dist/esm → esm}/Questions/Step/StepForm.js +0 -0
- package/{dist/esm → esm}/Questions/Step/StepQuote.js +0 -0
- package/{dist/esm → esm}/Questions/Step/StepTitle.js +0 -0
- package/{dist/esm → esm}/Questions/Step/getAddMoreFields.js +0 -0
- package/{dist/esm → esm}/Questions/Step/index.js +0 -0
- package/{dist/esm → esm}/Questions/Step/types.js +0 -0
- package/{dist/esm → esm}/Questions/__snapshots__/index.spec.tsx.snap +0 -0
- package/esm/Questions/__stories__/Default.js +103 -0
- package/{dist/esm → esm}/Questions/getNextStep.js +0 -0
- package/{dist/esm → esm}/Questions/index.js +0 -0
- package/esm/Questions/index.mdx +418 -0
- package/{dist/esm → esm}/Questions/index.spec.js +0 -0
- package/{dist/esm → esm}/Questions/types.js +0 -0
- package/{dist/esm → esm}/__stories__/AutoCompleteField.js +0 -0
- package/{dist/esm → esm}/__stories__/IntField.js +0 -0
- package/{dist/esm → esm}/create-simple-form.mdx +0 -0
- package/{dist/esm → esm}/index.js +1 -1
- package/{dist/esm → esm}/index.mdx +0 -0
- package/{dist/esm → esm}/inputs/AutoComplete/index.js +0 -0
- package/{dist/es → esm}/inputs/Checkboxes/Checkboxes.stories.js +2 -1
- package/{dist/esm → esm}/inputs/Checkboxes/Checkboxes.stories.playwright.json +0 -0
- package/{dist/esm → esm}/inputs/Checkboxes/__stories__/Default.js +0 -0
- package/{dist/esm → esm}/inputs/Checkboxes/index.js +0 -0
- package/{dist/esm → esm}/inputs/Checkboxes/index.mdx +0 -0
- package/{dist/esm → esm}/inputs/DateInput/DateInput.stories.js +2 -1
- package/{dist/esm → esm}/inputs/DateInput/DateInput.stories.playwright.json +0 -0
- package/{dist/esm → esm}/inputs/DateInput/__stories__/Default.js +0 -0
- package/{dist/esm → esm}/inputs/DateInput/index.js +0 -0
- package/{dist/es → esm}/inputs/FileInput/FileInput.stories.js +2 -1
- package/{dist/esm → esm}/inputs/FileInput/FileInput.stories.playwright.json +0 -0
- package/{dist/esm → esm}/inputs/FileInput/__stories__/Default.js +0 -0
- package/{dist/esm → esm}/inputs/FileInput/index.js +0 -0
- package/{dist/es → esm}/inputs/Input/Input.stories.js +2 -1
- package/{dist/esm → esm}/inputs/Input/Input.stories.playwright.json +0 -0
- package/{dist/esm → esm}/inputs/Input/__stories__/AFM.js +0 -0
- package/{dist/esm → esm}/inputs/Input/__stories__/Boolean.js +0 -0
- package/{dist/esm → esm}/inputs/Input/__stories__/Default.js +0 -0
- package/{dist/esm → esm}/inputs/Input/__stories__/IBAN.js +0 -0
- package/{dist/esm → esm}/inputs/Input/__stories__/Integer.js +0 -0
- package/{dist/esm → esm}/inputs/Input/__stories__/MobilePhone.js +0 -0
- package/{dist/esm → esm}/inputs/Input/__stories__/PhoneNumber.js +0 -0
- package/{dist/esm → esm}/inputs/Input/__stories__/PostalCode.js +0 -0
- package/{dist/esm → esm}/inputs/Input/index.js +0 -0
- package/{dist/esm → esm}/inputs/Input/index.mdx +0 -0
- package/{dist/es → esm}/inputs/Label/Label.stories.js +2 -1
- package/{dist/esm → esm}/inputs/Label/Label.stories.playwright.json +0 -0
- package/{dist/esm → esm}/inputs/Label/__stories__/Default.js +0 -0
- package/{dist/esm → esm}/inputs/Label/index.js +0 -0
- package/{dist/esm → esm}/inputs/Label/index.mdx +0 -0
- package/{dist/es → esm}/inputs/Radio/Radio.stories.js +2 -1
- package/{dist/esm → esm}/inputs/Radio/Radio.stories.playwright.json +0 -0
- package/{dist/esm → esm}/inputs/Radio/__stories__/Default.js +0 -0
- package/{dist/esm → esm}/inputs/Radio/index.js +0 -0
- package/{dist/esm → esm}/inputs/Radio/index.mdx +0 -0
- package/{dist/es → esm}/inputs/Select/Select.stories.js +2 -1
- package/{dist/esm → esm}/inputs/Select/Select.stories.playwright.json +0 -0
- package/{dist/esm → esm}/inputs/Select/__stories__/Default.js +0 -0
- package/{dist/esm → esm}/inputs/Select/index.js +0 -0
- package/{dist/esm → esm}/inputs/index.js +0 -0
- package/{dist/esm → esm}/installation.mdx +0 -0
- package/{dist/esm → esm}/internal.js +0 -0
- package/{dist/esm → esm}/registry.js +0 -0
- package/{dist/esm → esm}/types.js +0 -0
- package/{dist/esm → esm}/utils.js +0 -0
- package/{dist/esm → esm}/validators/index.js +0 -0
- package/{dist/esm → esm}/validators/types.js +0 -0
- package/{dist/esm → esm}/validators/utils/afm.js +0 -0
- package/{dist/esm → esm}/validators/utils/file.js +0 -0
- package/{dist/esm → esm}/validators/utils/iban.js +0 -0
- package/{dist/esm → esm}/validators/utils/index.js +0 -0
- package/{dist/esm → esm}/validators/utils/int.js +0 -0
- package/{dist/esm → esm}/validators/utils/number.js +0 -0
- package/{dist/esm → esm}/validators/utils/phone.js +0 -0
- package/{dist/esm → esm}/validators/utils/postal_code.js +0 -0
- package/{dist/esm → esm}/validators/utils/uuid4.js +0 -0
- package/{dist/esm → esm}/validators/validators.spec.js +0 -0
- package/{dist/index.d.ts → index.d.ts} +0 -0
- package/{dist/index.js → index.js} +0 -0
- package/{dist/index.mdx → index.mdx} +0 -0
- package/{dist/inputs → inputs}/AutoComplete/index.d.ts +0 -0
- package/{dist/inputs → inputs}/AutoComplete/index.js +0 -0
- package/{dist/inputs → inputs}/Checkboxes/Checkboxes.stories.d.ts +1 -0
- package/{dist/inputs → inputs}/Checkboxes/Checkboxes.stories.js +2 -1
- package/{dist/inputs → inputs}/Checkboxes/Checkboxes.stories.playwright.json +0 -0
- package/{dist/inputs → inputs}/Checkboxes/__stories__/Default.d.ts +0 -0
- package/{dist/inputs → inputs}/Checkboxes/__stories__/Default.js +0 -0
- package/{dist/inputs → inputs}/Checkboxes/index.d.ts +0 -0
- package/{dist/inputs → inputs}/Checkboxes/index.js +0 -0
- package/{dist/inputs → inputs}/Checkboxes/index.mdx +0 -0
- package/{dist/inputs → inputs}/DateInput/DateInput.stories.d.ts +1 -0
- package/{dist/inputs → inputs}/DateInput/DateInput.stories.js +2 -1
- package/{dist/inputs → inputs}/DateInput/DateInput.stories.playwright.json +0 -0
- package/{dist/inputs → inputs}/DateInput/__stories__/Default.d.ts +0 -0
- package/{dist/inputs → inputs}/DateInput/__stories__/Default.js +0 -0
- package/{dist/inputs → inputs}/DateInput/index.d.ts +0 -0
- package/{dist/inputs → inputs}/DateInput/index.js +0 -0
- package/{dist/inputs → inputs}/FileInput/FileInput.stories.d.ts +1 -0
- package/{dist/inputs → inputs}/FileInput/FileInput.stories.js +2 -1
- package/{dist/inputs → inputs}/FileInput/FileInput.stories.playwright.json +0 -0
- package/{dist/inputs → inputs}/FileInput/__stories__/Default.d.ts +0 -0
- package/{dist/inputs → inputs}/FileInput/__stories__/Default.js +0 -0
- package/{dist/inputs → inputs}/FileInput/index.d.ts +0 -0
- package/{dist/inputs → inputs}/FileInput/index.js +0 -0
- package/{dist/inputs → inputs}/Input/Input.stories.d.ts +1 -0
- package/{dist/inputs → inputs}/Input/Input.stories.js +2 -1
- package/{dist/inputs → inputs}/Input/Input.stories.playwright.json +0 -0
- package/{dist/inputs → inputs}/Input/__stories__/AFM.d.ts +0 -0
- package/{dist/inputs → inputs}/Input/__stories__/AFM.js +0 -0
- package/{dist/inputs → inputs}/Input/__stories__/Boolean.d.ts +0 -0
- package/{dist/inputs → inputs}/Input/__stories__/Boolean.js +0 -0
- package/{dist/inputs → inputs}/Input/__stories__/Default.d.ts +0 -0
- package/{dist/inputs → inputs}/Input/__stories__/Default.js +0 -0
- package/{dist/inputs → inputs}/Input/__stories__/IBAN.d.ts +0 -0
- package/{dist/inputs → inputs}/Input/__stories__/IBAN.js +0 -0
- package/{dist/inputs → inputs}/Input/__stories__/Integer.d.ts +0 -0
- package/{dist/inputs → inputs}/Input/__stories__/Integer.js +0 -0
- package/{dist/inputs → inputs}/Input/__stories__/MobilePhone.d.ts +0 -0
- package/{dist/inputs → inputs}/Input/__stories__/MobilePhone.js +0 -0
- package/{dist/inputs → inputs}/Input/__stories__/PhoneNumber.d.ts +0 -0
- package/{dist/inputs → inputs}/Input/__stories__/PhoneNumber.js +0 -0
- package/{dist/inputs → inputs}/Input/__stories__/PostalCode.d.ts +0 -0
- package/{dist/inputs → inputs}/Input/__stories__/PostalCode.js +0 -0
- package/{dist/inputs → inputs}/Input/index.d.ts +0 -0
- package/{dist/inputs → inputs}/Input/index.js +0 -0
- package/{dist/inputs → inputs}/Input/index.mdx +0 -0
- package/{dist/inputs → inputs}/Label/Label.stories.d.ts +1 -0
- package/{dist/inputs → inputs}/Label/Label.stories.js +2 -1
- package/{dist/inputs → inputs}/Label/Label.stories.playwright.json +0 -0
- package/{dist/inputs → inputs}/Label/__stories__/Default.d.ts +0 -0
- package/{dist/inputs → inputs}/Label/__stories__/Default.js +0 -0
- package/{dist/inputs → inputs}/Label/index.d.ts +0 -0
- package/{dist/inputs → inputs}/Label/index.js +0 -0
- package/{dist/inputs → inputs}/Label/index.mdx +0 -0
- package/{dist/inputs → inputs}/Radio/Radio.stories.d.ts +1 -0
- package/{dist/inputs → inputs}/Radio/Radio.stories.js +2 -1
- package/{dist/inputs → inputs}/Radio/Radio.stories.playwright.json +0 -0
- package/{dist/inputs → inputs}/Radio/__stories__/Default.d.ts +0 -0
- package/{dist/inputs → inputs}/Radio/__stories__/Default.js +0 -0
- package/{dist/inputs → inputs}/Radio/index.d.ts +0 -0
- package/{dist/inputs → inputs}/Radio/index.js +0 -0
- package/{dist/inputs → inputs}/Radio/index.mdx +0 -0
- package/{dist/inputs → inputs}/Select/Select.stories.d.ts +1 -0
- package/{dist/inputs → inputs}/Select/Select.stories.js +2 -1
- package/{dist/inputs → inputs}/Select/Select.stories.playwright.json +0 -0
- package/{dist/inputs → inputs}/Select/__stories__/Default.d.ts +0 -0
- package/{dist/inputs → inputs}/Select/__stories__/Default.js +0 -0
- package/{dist/inputs → inputs}/Select/index.d.ts +0 -0
- package/{dist/inputs → inputs}/Select/index.js +0 -0
- package/{dist/inputs → inputs}/index.d.ts +0 -0
- package/{dist/inputs → inputs}/index.js +0 -0
- package/{dist/installation.mdx → installation.mdx} +0 -0
- package/{dist/internal.d.ts → internal.d.ts} +0 -0
- package/{dist/internal.js → internal.js} +0 -0
- package/package.json +10 -31
- package/{dist/registry.d.ts → registry.d.ts} +0 -0
- package/{dist/registry.js → registry.js} +0 -0
- package/{dist/types.d.ts → types.d.ts} +0 -0
- package/{dist/types.js → types.js} +0 -0
- package/{dist/utils.d.ts → utils.d.ts} +0 -0
- package/{dist/utils.js → utils.js} +0 -0
- package/{dist/validators → validators}/index.d.ts +0 -0
- package/{dist/validators → validators}/index.js +0 -0
- package/{dist/validators → validators}/types.d.ts +0 -0
- package/{dist/validators → validators}/types.js +0 -0
- package/{dist/validators → validators}/utils/afm.d.ts +0 -0
- package/{dist/validators → validators}/utils/afm.js +0 -0
- package/{dist/validators → validators}/utils/file.d.ts +0 -0
- package/{dist/validators → validators}/utils/file.js +0 -0
- package/{dist/validators → validators}/utils/iban.d.ts +0 -0
- package/{dist/validators → validators}/utils/iban.js +0 -0
- package/{dist/validators → validators}/utils/index.d.ts +0 -0
- package/{dist/validators → validators}/utils/index.js +0 -0
- package/{dist/validators → validators}/utils/int.d.ts +0 -0
- package/{dist/validators → validators}/utils/int.js +0 -0
- package/{dist/validators → validators}/utils/number.d.ts +0 -0
- package/{dist/validators → validators}/utils/number.js +0 -0
- package/{dist/validators → validators}/utils/phone.d.ts +0 -0
- package/{dist/validators → validators}/utils/phone.js +0 -0
- package/{dist/validators → validators}/utils/postal_code.d.ts +0 -0
- package/{dist/validators → validators}/utils/postal_code.js +0 -0
- package/{dist/validators → validators}/utils/uuid4.d.ts +0 -0
- package/{dist/validators → validators}/utils/uuid4.js +0 -0
- package/{dist/validators → validators}/validators.spec.d.ts +0 -0
- package/{dist/validators → validators}/validators.spec.js +0 -0
- package/.eslintrc.js +0 -3
- package/.prettierrc.js +0 -3
- package/CHANGELOG.json +0 -1392
- package/coverage/clover.xml +0 -859
- package/coverage/coverage-final.json +0 -51
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -386
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -196
- package/coverage/lcov-report/src/Field/FieldBase.tsx.html +0 -379
- package/coverage/lcov-report/src/Field/FieldConditional.tsx.html +0 -310
- package/coverage/lcov-report/src/Field/FieldContainer.tsx.html +0 -256
- package/coverage/lcov-report/src/Field/index.html +0 -176
- package/coverage/lcov-report/src/Field/index.tsx.html +0 -352
- package/coverage/lcov-report/src/Field/utils.ts.html +0 -559
- package/coverage/lcov-report/src/FieldArray/index.html +0 -116
- package/coverage/lcov-report/src/FieldArray/index.tsx.html +0 -319
- package/coverage/lcov-report/src/FieldObject/index.html +0 -116
- package/coverage/lcov-report/src/FieldObject/index.tsx.html +0 -364
- package/coverage/lcov-report/src/Fieldset/index.html +0 -116
- package/coverage/lcov-report/src/Fieldset/index.tsx.html +0 -202
- package/coverage/lcov-report/src/FormBuilder/FormBuilder.tsx.html +0 -580
- package/coverage/lcov-report/src/FormBuilder/index.html +0 -131
- package/coverage/lcov-report/src/FormBuilder/index.tsx.html +0 -94
- package/coverage/lcov-report/src/FormContext.tsx.html +0 -109
- package/coverage/lcov-report/src/MultiplicityField/add-objects.tsx.html +0 -637
- package/coverage/lcov-report/src/MultiplicityField/index.html +0 -131
- package/coverage/lcov-report/src/MultiplicityField/index.tsx.html +0 -580
- package/coverage/lcov-report/src/Questions/Questions.tsx.html +0 -307
- package/coverage/lcov-report/src/Questions/QuestionsContext.tsx.html +0 -112
- package/coverage/lcov-report/src/Questions/Step/ReviewStep.tsx.html +0 -274
- package/coverage/lcov-report/src/Questions/Step/Step.tsx.html +0 -286
- package/coverage/lcov-report/src/Questions/Step/StepArrayReview.tsx.html +0 -289
- package/coverage/lcov-report/src/Questions/Step/StepContext.tsx.html +0 -148
- package/coverage/lcov-report/src/Questions/Step/StepDescription.tsx.html +0 -184
- package/coverage/lcov-report/src/Questions/Step/StepForm.tsx.html +0 -265
- package/coverage/lcov-report/src/Questions/Step/StepQuote.tsx.html +0 -109
- package/coverage/lcov-report/src/Questions/Step/StepTitle.tsx.html +0 -265
- package/coverage/lcov-report/src/Questions/Step/getAddMoreFields.tsx.html +0 -169
- package/coverage/lcov-report/src/Questions/Step/index.html +0 -266
- package/coverage/lcov-report/src/Questions/Step/index.ts.html +0 -124
- package/coverage/lcov-report/src/Questions/Step/types.tsx.html +0 -181
- package/coverage/lcov-report/src/Questions/getNextStep.tsx.html +0 -157
- package/coverage/lcov-report/src/Questions/index.html +0 -161
- package/coverage/lcov-report/src/Questions/index.tsx.html +0 -100
- package/coverage/lcov-report/src/index.html +0 -176
- package/coverage/lcov-report/src/index.ts.html +0 -94
- package/coverage/lcov-report/src/inputs/Checkboxes/index.html +0 -116
- package/coverage/lcov-report/src/inputs/Checkboxes/index.tsx.html +0 -307
- package/coverage/lcov-report/src/inputs/DateInput/index.html +0 -116
- package/coverage/lcov-report/src/inputs/DateInput/index.tsx.html +0 -475
- package/coverage/lcov-report/src/inputs/FileInput/index.html +0 -116
- package/coverage/lcov-report/src/inputs/FileInput/index.tsx.html +0 -313
- package/coverage/lcov-report/src/inputs/Input/index.html +0 -116
- package/coverage/lcov-report/src/inputs/Input/index.tsx.html +0 -271
- package/coverage/lcov-report/src/inputs/Label/index.html +0 -116
- package/coverage/lcov-report/src/inputs/Label/index.tsx.html +0 -217
- package/coverage/lcov-report/src/inputs/Radio/index.html +0 -116
- package/coverage/lcov-report/src/inputs/Radio/index.tsx.html +0 -256
- package/coverage/lcov-report/src/inputs/Select/index.html +0 -116
- package/coverage/lcov-report/src/inputs/Select/index.tsx.html +0 -196
- package/coverage/lcov-report/src/inputs/index.html +0 -116
- package/coverage/lcov-report/src/inputs/index.ts.html +0 -106
- package/coverage/lcov-report/src/internal.ts.html +0 -184
- package/coverage/lcov-report/src/types.tsx.html +0 -406
- package/coverage/lcov-report/src/utils.ts.html +0 -319
- package/coverage/lcov-report/src/validators/index.html +0 -116
- package/coverage/lcov-report/src/validators/index.ts.html +0 -694
- package/coverage/lcov-report/src/validators/utils/afm.ts.html +0 -196
- package/coverage/lcov-report/src/validators/utils/file.ts.html +0 -160
- package/coverage/lcov-report/src/validators/utils/iban.ts.html +0 -442
- package/coverage/lcov-report/src/validators/utils/index.html +0 -236
- package/coverage/lcov-report/src/validators/utils/index.ts.html +0 -367
- package/coverage/lcov-report/src/validators/utils/int.ts.html +0 -151
- package/coverage/lcov-report/src/validators/utils/number.ts.html +0 -139
- package/coverage/lcov-report/src/validators/utils/phone.ts.html +0 -445
- package/coverage/lcov-report/src/validators/utils/postal_code.ts.html +0 -184
- package/coverage/lcov-report/src/validators/utils/uuid4.ts.html +0 -148
- package/coverage/lcov.info +0 -1969
- package/dist/CHANGELOG.md +0 -432
- package/dist/Questions/index.mdx +0 -13
- package/dist/README.md +0 -0
- package/dist/es/FieldArray/FieldArray.stories.js +0 -7
- package/dist/es/FormBuilder/FormBuilder.stories.js +0 -6
- package/dist/es/Questions/index.mdx +0 -13
- package/dist/es/inputs/DateInput/DateInput.stories.js +0 -6
- package/dist/esm/FormBuilder/FormBuilder.stories.js +0 -6
- package/dist/esm/MultiplicityField/MultiplicityField.stories.js +0 -11
- package/dist/esm/Questions/index.mdx +0 -13
- package/dist/esm/inputs/Checkboxes/Checkboxes.stories.js +0 -6
- package/dist/esm/inputs/FileInput/FileInput.stories.js +0 -6
- package/dist/esm/inputs/Input/Input.stories.js +0 -13
- package/dist/esm/inputs/Label/Label.stories.js +0 -6
- package/dist/esm/inputs/Radio/Radio.stories.js +0 -6
- package/dist/esm/inputs/Select/Select.stories.js +0 -6
- package/dist/package.json +0 -31
- package/docs/index.mdx +0 -6
- package/form.build.log +0 -16
- package/src/Field/FieldBase.tsx +0 -99
- package/src/Field/FieldBaseContainer.tsx +0 -57
- package/src/Field/FieldConditional.tsx +0 -75
- package/src/Field/index.mdx +0 -6
- package/src/Field/index.tsx +0 -92
- package/src/Field/types.tsx +0 -102
- package/src/Field/utils.ts +0 -164
- package/src/FieldArray/FieldArray.stories.playwright.json +0 -353
- package/src/FieldArray/__stories__/Default.tsx +0 -95
- package/src/FieldArray/__stories__/WithExactLength.tsx +0 -95
- package/src/FieldArray/index.tsx +0 -83
- package/src/FieldObject/index.tsx +0 -92
- package/src/Fieldset/FieldsetWithContext.tsx +0 -41
- package/src/Fieldset/index.tsx +0 -40
- package/src/Fieldset/types.tsx +0 -6
- package/src/Form.stories.js +0 -5
- package/src/Form.stories.playwright.json +0 -143
- package/src/FormBuilder/FormBuilder.mdx +0 -271
- package/src/FormBuilder/FormBuilder.stories.playwright.json +0 -52
- package/src/FormBuilder/FormBuilder.tsx +0 -165
- package/src/FormBuilder/__stories__/Default.tsx +0 -23
- package/src/FormBuilder/index.tsx +0 -3
- package/src/FormContext.tsx +0 -8
- package/src/MultiplicityField/MultiplicityField.mdx +0 -580
- package/src/MultiplicityField/MultiplicityField.stories.playwright.json +0 -1370
- package/src/MultiplicityField/__stories__/Default.tsx +0 -100
- package/src/MultiplicityField/__stories__/PreviewDisplay.tsx +0 -160
- package/src/MultiplicityField/__stories__/WithExactLength.tsx +0 -99
- package/src/MultiplicityField/__stories__/WithMaxLength.tsx +0 -102
- package/src/MultiplicityField/__stories__/WithMinAndMaxLength.tsx +0 -103
- package/src/MultiplicityField/__stories__/WithMinLength.tsx +0 -102
- package/src/MultiplicityField/add-objects.tsx +0 -186
- package/src/MultiplicityField/index.tsx +0 -166
- package/src/Questions/Questions.tsx +0 -74
- package/src/Questions/QuestionsContext.tsx +0 -9
- package/src/Questions/Step/ReviewStep.tsx +0 -63
- package/src/Questions/Step/Step.tsx +0 -67
- package/src/Questions/Step/StepArrayReview.tsx +0 -68
- package/src/Questions/Step/StepContext.tsx +0 -21
- package/src/Questions/Step/StepDescription.tsx +0 -33
- package/src/Questions/Step/StepForm.tsx +0 -60
- package/src/Questions/Step/StepQuote.tsx +0 -8
- package/src/Questions/Step/StepTitle.tsx +0 -60
- package/src/Questions/Step/getAddMoreFields.tsx +0 -28
- package/src/Questions/Step/index.ts +0 -13
- package/src/Questions/Step/types.tsx +0 -32
- package/src/Questions/__snapshots__/index.spec.tsx.snap +0 -887
- package/src/Questions/getNextStep.tsx +0 -24
- package/src/Questions/index.mdx +0 -13
- package/src/Questions/index.spec.tsx +0 -72
- package/src/Questions/index.tsx +0 -5
- package/src/Questions/types.tsx +0 -25
- package/src/__stories__/AutoCompleteField.tsx +0 -45
- package/src/__stories__/IntField.tsx +0 -38
- package/src/create-simple-form.mdx +0 -518
- package/src/index.mdx +0 -44
- package/src/index.ts +0 -3
- package/src/inputs/AutoComplete/index.tsx +0 -85
- package/src/inputs/Checkboxes/Checkboxes.stories.playwright.json +0 -69
- package/src/inputs/Checkboxes/__stories__/Default.tsx +0 -39
- package/src/inputs/Checkboxes/index.mdx +0 -0
- package/src/inputs/Checkboxes/index.tsx +0 -77
- package/src/inputs/DateInput/DateInput.stories.playwright.json +0 -72
- package/src/inputs/DateInput/__stories__/Default.tsx +0 -41
- package/src/inputs/DateInput/index.tsx +0 -130
- package/src/inputs/FileInput/FileInput.stories.playwright.json +0 -75
- package/src/inputs/FileInput/__stories__/Default.tsx +0 -23
- package/src/inputs/FileInput/index.tsx +0 -76
- package/src/inputs/Input/Input.stories.playwright.json +0 -376
- package/src/inputs/Input/__stories__/AFM.tsx +0 -24
- package/src/inputs/Input/__stories__/Boolean.tsx +0 -26
- package/src/inputs/Input/__stories__/Default.tsx +0 -25
- package/src/inputs/Input/__stories__/IBAN.tsx +0 -26
- package/src/inputs/Input/__stories__/Integer.tsx +0 -25
- package/src/inputs/Input/__stories__/MobilePhone.tsx +0 -24
- package/src/inputs/Input/__stories__/PhoneNumber.tsx +0 -24
- package/src/inputs/Input/__stories__/PostalCode.tsx +0 -25
- package/src/inputs/Input/index.mdx +0 -8
- package/src/inputs/Input/index.tsx +0 -62
- package/src/inputs/Label/Label.stories.playwright.json +0 -40
- package/src/inputs/Label/__stories__/Default.tsx +0 -28
- package/src/inputs/Label/index.mdx +0 -0
- package/src/inputs/Label/index.tsx +0 -44
- package/src/inputs/Radio/Radio.stories.playwright.json +0 -57
- package/src/inputs/Radio/__stories__/Default.tsx +0 -42
- package/src/inputs/Radio/index.mdx +0 -0
- package/src/inputs/Radio/index.tsx +0 -57
- package/src/inputs/Select/Select.stories.playwright.json +0 -22
- package/src/inputs/Select/__stories__/Default.tsx +0 -47
- package/src/inputs/Select/index.tsx +0 -37
- package/src/inputs/index.ts +0 -7
- package/src/installation.mdx +0 -72
- package/src/internal.ts +0 -34
- package/src/registry.js +0 -134
- package/src/types.tsx +0 -110
- package/src/utils.ts +0 -78
- package/src/validators/index.ts +0 -203
- package/src/validators/types.ts +0 -2
- package/src/validators/utils/afm.ts +0 -37
- package/src/validators/utils/file.ts +0 -25
- package/src/validators/utils/iban.ts +0 -119
- package/src/validators/utils/index.ts +0 -94
- package/src/validators/utils/int.ts +0 -22
- package/src/validators/utils/number.ts +0 -18
- package/src/validators/utils/phone.ts +0 -120
- package/src/validators/utils/postal_code.ts +0 -33
- package/src/validators/utils/uuid4.ts +0 -21
- package/src/validators/validators.spec.ts +0 -122
- package/tsconfig.json +0 -14
- package/tsconfig.production.json +0 -49
package/src/types.tsx
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import { UseFormReturn, UseFormProps } from 'react-hook-form';
|
|
2
|
-
import { GridProps } from '@digigov/ui/layouts/Grid';
|
|
3
|
-
import { ValidatorSchema } from '@digigov/form/validators/types';
|
|
4
|
-
import { FieldComponentRegistry } from '@digigov/form/Field/types';
|
|
5
|
-
|
|
6
|
-
export type FieldError = {
|
|
7
|
-
message: string;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export type FieldLabelProps = {
|
|
11
|
-
primary?: string;
|
|
12
|
-
secondary?: string;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export interface FieldCondition {
|
|
16
|
-
is: string;
|
|
17
|
-
then?: Partial<FieldSpec>;
|
|
18
|
-
else?: Partial<FieldSpec>;
|
|
19
|
-
}
|
|
20
|
-
export interface FieldSpec {
|
|
21
|
-
key: string; // !TODO rename key to name;
|
|
22
|
-
type?:
|
|
23
|
-
| 'int'
|
|
24
|
-
| 'string'
|
|
25
|
-
| 'text'
|
|
26
|
-
| 'boolean'
|
|
27
|
-
| 'email'
|
|
28
|
-
| 'uuid4'
|
|
29
|
-
| 'choice:multiple'
|
|
30
|
-
| 'choice:single'
|
|
31
|
-
| 'mobile_phone'
|
|
32
|
-
| 'date'
|
|
33
|
-
| 'afm'
|
|
34
|
-
| 'iban'
|
|
35
|
-
| 'file'
|
|
36
|
-
| 'postal_code'
|
|
37
|
-
| 'phone_number'
|
|
38
|
-
| 'array'
|
|
39
|
-
| 'object';
|
|
40
|
-
component?: any;
|
|
41
|
-
condition?: Record<string, FieldCondition>;
|
|
42
|
-
controlled?: boolean;
|
|
43
|
-
label?: FieldLabelProps;
|
|
44
|
-
extra?: Record<string, any>;
|
|
45
|
-
editable?: boolean;
|
|
46
|
-
required?: boolean;
|
|
47
|
-
enabled?: boolean;
|
|
48
|
-
layout?: Record<
|
|
49
|
-
string,
|
|
50
|
-
| GridProps['xs']
|
|
51
|
-
| GridProps['sm']
|
|
52
|
-
| GridProps['md']
|
|
53
|
-
| GridProps['lg']
|
|
54
|
-
| GridProps['xl']
|
|
55
|
-
>;
|
|
56
|
-
validators?: ValidatorSchema[];
|
|
57
|
-
wrapper?: 'label' | 'fieldset';
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export interface FieldsetSpec {
|
|
61
|
-
key: string;
|
|
62
|
-
fields: string[];
|
|
63
|
-
label?: FieldLabelProps;
|
|
64
|
-
body?: React.ReactNode;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export type FormData = UseFormProps['defaultValues'];
|
|
68
|
-
|
|
69
|
-
export interface FormContextProps {
|
|
70
|
-
fieldsetsMap?: Record<string, FieldsetSpec>;
|
|
71
|
-
fieldsMap: Record<string, FieldSpec>;
|
|
72
|
-
control: UseFormReturn['control'];
|
|
73
|
-
register: UseFormReturn['register'];
|
|
74
|
-
trigger: UseFormReturn['trigger'];
|
|
75
|
-
clearErrors: UseFormReturn['clearErrors'];
|
|
76
|
-
watch: UseFormReturn['watch'];
|
|
77
|
-
getFieldState: UseFormReturn['getFieldState'];
|
|
78
|
-
setValue: UseFormReturn['setValue'];
|
|
79
|
-
getValues: UseFormReturn['getValues'];
|
|
80
|
-
unregister: UseFormReturn['unregister'];
|
|
81
|
-
formState: UseFormReturn['formState'];
|
|
82
|
-
reset: UseFormReturn['reset'];
|
|
83
|
-
registerField: (field: FieldSpec) => void;
|
|
84
|
-
errors: UseFormReturn['formState']['errors'];
|
|
85
|
-
componentRegistry?: FieldComponentRegistry;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export interface FormBuilderProps {
|
|
89
|
-
fields?: FieldSpec[];
|
|
90
|
-
fieldsets?: FieldsetSpec[];
|
|
91
|
-
initial?: FormData;
|
|
92
|
-
onSubmit?: (data: FormData) => void | null | FieldError[];
|
|
93
|
-
mode?: UseFormProps['mode'];
|
|
94
|
-
reValidateMode?: UseFormProps['reValidateMode'];
|
|
95
|
-
criteriaMode?: UseFormProps['criteriaMode'];
|
|
96
|
-
children?: React.ReactNode;
|
|
97
|
-
shouldFocusError?: boolean;
|
|
98
|
-
auto?: boolean;
|
|
99
|
-
validatorRegistry?: Record<string, ValidatorSchema[]>;
|
|
100
|
-
componentRegistry?: FieldComponentRegistry;
|
|
101
|
-
grid?: boolean;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export interface FormBaseProps
|
|
105
|
-
extends Omit<FormBuilderProps, 'fields' | 'fieldsets' | 'auto'> {
|
|
106
|
-
fieldsetsMap?: Record<string, FieldsetSpec>;
|
|
107
|
-
fieldsMap: Record<string, FieldSpec>;
|
|
108
|
-
registerField: (field: FieldSpec) => void;
|
|
109
|
-
resolver: any;
|
|
110
|
-
}
|
package/src/utils.ts
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import * as Yup from 'yup';
|
|
2
|
-
import { validateFieldsNatively } from '@hookform/resolvers';
|
|
3
|
-
import { appendErrors, FieldError } from 'react-hook-form';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Why `path!` ? because it could be `undefined` in some case
|
|
7
|
-
* https://github.com/jquense/yup#validationerrorerrors-string--arraystring-value-any-path-string
|
|
8
|
-
*/
|
|
9
|
-
const parseErrorSchema = (
|
|
10
|
-
error: Yup.ValidationError,
|
|
11
|
-
validateAllFieldCriteria: boolean
|
|
12
|
-
) => {
|
|
13
|
-
return (error.inner || []).reduce<Record<string, FieldError>>(
|
|
14
|
-
(previous, error) => {
|
|
15
|
-
error.path = error.path?.replace(/\[([0-9]+)\]/g, '.$1');
|
|
16
|
-
if (!previous[error.path!]) {
|
|
17
|
-
previous[error.path!] = { message: error.message, type: error.type! };
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
if (validateAllFieldCriteria) {
|
|
21
|
-
const types = previous[error.path!].types;
|
|
22
|
-
const messages = types && types[error.type!];
|
|
23
|
-
|
|
24
|
-
previous[error.path!] = appendErrors(
|
|
25
|
-
error.path!,
|
|
26
|
-
validateAllFieldCriteria,
|
|
27
|
-
previous,
|
|
28
|
-
error.type!,
|
|
29
|
-
messages
|
|
30
|
-
? ([] as string[]).concat(messages as string[], error.message)
|
|
31
|
-
: error.message
|
|
32
|
-
) as FieldError;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return previous;
|
|
36
|
-
},
|
|
37
|
-
{}
|
|
38
|
-
);
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export const yupResolver = (
|
|
42
|
-
schema: any,
|
|
43
|
-
schemaOptions: any = {},
|
|
44
|
-
resolverOptions: any = {}
|
|
45
|
-
) => async (values, context, options) => {
|
|
46
|
-
try {
|
|
47
|
-
if (schemaOptions.context && process.env.NODE_ENV === 'development') {
|
|
48
|
-
// eslint-disable-next-line no-console
|
|
49
|
-
console.warn(
|
|
50
|
-
"You should not used the yup options context. Please, use the 'useForm' context object instead"
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const result = await schema[
|
|
55
|
-
resolverOptions.mode === 'sync' ? 'validateSync' : 'validate'
|
|
56
|
-
](values, Object.assign({ abortEarly: false }, schemaOptions, { context }));
|
|
57
|
-
|
|
58
|
-
options.shouldUseNativeValidation && validateFieldsNatively({}, options);
|
|
59
|
-
|
|
60
|
-
return {
|
|
61
|
-
values: resolverOptions.rawValues ? values : result,
|
|
62
|
-
errors: {},
|
|
63
|
-
};
|
|
64
|
-
} catch (e) {
|
|
65
|
-
if (!e.inner) {
|
|
66
|
-
throw e;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
const parsed = parseErrorSchema(
|
|
70
|
-
e,
|
|
71
|
-
!options.shouldUseNativeValidation && options.criteriaMode === 'all'
|
|
72
|
-
);
|
|
73
|
-
return {
|
|
74
|
-
values: {},
|
|
75
|
-
errors: parsed,
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
};
|
package/src/validators/index.ts
DELETED
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
import * as yup from 'yup';
|
|
2
|
-
import { FieldSpec } from '@digigov/form/types';
|
|
3
|
-
import { ValidatorSchema } from '@digigov/form/validators/types';
|
|
4
|
-
import { MutableRefObject, useMemo } from 'react';
|
|
5
|
-
import dayjs from 'dayjs';
|
|
6
|
-
import customParseFormat from 'dayjs/plugin/customParseFormat';
|
|
7
|
-
import {
|
|
8
|
-
getYupObjectShape,
|
|
9
|
-
AFM_VALIDATOR,
|
|
10
|
-
FILE_MAX_SIZE_VALIDATOR,
|
|
11
|
-
IBAN_VALIDATOR,
|
|
12
|
-
MOBILE_PHONE_VALIDATOR,
|
|
13
|
-
PHONE_NUMBER_VALIDATOR,
|
|
14
|
-
POSTALCODE_VALIDATOR,
|
|
15
|
-
UUID4_VALIDATOR,
|
|
16
|
-
} from '@digigov/form/validators/utils';
|
|
17
|
-
import { MixedSchema } from 'yup/lib/mixed';
|
|
18
|
-
import { RequiredArraySchema } from 'yup/lib/array';
|
|
19
|
-
import { AnyObject } from 'yup/lib/types';
|
|
20
|
-
import Lazy from 'yup/lib/Lazy';
|
|
21
|
-
import { TypeOfShape, AssertsShape } from 'yup/lib/object';
|
|
22
|
-
import { AnyObjectSchema, StringSchema } from 'yup';
|
|
23
|
-
import { NUMBER_VALIDATOR } from '@digigov/form/validators/utils/number';
|
|
24
|
-
import { INT_VALIDATOR } from '@digigov/form/validators/utils/int';
|
|
25
|
-
dayjs.extend(customParseFormat);
|
|
26
|
-
|
|
27
|
-
const VALID_DATE_FORMATS = ['DD/MM/YYYY'];
|
|
28
|
-
const DATE_CACHE = {};
|
|
29
|
-
const getDate = (v) => {
|
|
30
|
-
return DATE_CACHE[v] ? DATE_CACHE[v] : dayjs(v, VALID_DATE_FORMATS, true);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export const getYUPTypeMap = (): Record<string, any> => {
|
|
34
|
-
const yupTypeMap = {
|
|
35
|
-
file: (field): MixedSchema => {
|
|
36
|
-
return yup
|
|
37
|
-
.mixed()
|
|
38
|
-
.transform((value) => {
|
|
39
|
-
if (!value.length) {
|
|
40
|
-
return null;
|
|
41
|
-
}
|
|
42
|
-
return value;
|
|
43
|
-
})
|
|
44
|
-
.nullable()
|
|
45
|
-
.test(FILE_MAX_SIZE_VALIDATOR(field));
|
|
46
|
-
},
|
|
47
|
-
string: yup.string,
|
|
48
|
-
text: yup.string,
|
|
49
|
-
boolean: yup.boolean,
|
|
50
|
-
object: (
|
|
51
|
-
field
|
|
52
|
-
):
|
|
53
|
-
| yup.ObjectSchema<any, AnyObject, TypeOfShape<any>, AssertsShape<any>>
|
|
54
|
-
| Lazy<any, unknown> => {
|
|
55
|
-
return getYupObjectShape(field.extra.fields, yupTypeMap);
|
|
56
|
-
},
|
|
57
|
-
array: (
|
|
58
|
-
field
|
|
59
|
-
):
|
|
60
|
-
| yup.ArraySchema<any, AnyObject, any[] | undefined>
|
|
61
|
-
| RequiredArraySchema<any, AnyObject, any[] | undefined> => {
|
|
62
|
-
if (typeof field.extra.of === 'object') {
|
|
63
|
-
// else if the field is an object then it is a scalar type
|
|
64
|
-
// eg. number, string etc.
|
|
65
|
-
let arrayValidator = yup
|
|
66
|
-
.array()
|
|
67
|
-
.of(yupTypeMap[field.extra.of.type](field.extra.of))
|
|
68
|
-
.required(field.required);
|
|
69
|
-
if (field.extra.length)
|
|
70
|
-
arrayValidator = arrayValidator.length(field.extra.length, {
|
|
71
|
-
key: 'form.error.array.length',
|
|
72
|
-
context: {
|
|
73
|
-
length: field.extra.length,
|
|
74
|
-
},
|
|
75
|
-
});
|
|
76
|
-
if (field.extra.min)
|
|
77
|
-
arrayValidator = arrayValidator.min(field.extra.min, {
|
|
78
|
-
key: 'form.error.array.min',
|
|
79
|
-
context: {
|
|
80
|
-
min: field.extra.min,
|
|
81
|
-
},
|
|
82
|
-
});
|
|
83
|
-
if (field.extra.max)
|
|
84
|
-
arrayValidator = arrayValidator.max(field.extra.max, {
|
|
85
|
-
key: 'form.error.array.max',
|
|
86
|
-
context: {
|
|
87
|
-
max: field.extra.max,
|
|
88
|
-
},
|
|
89
|
-
});
|
|
90
|
-
return arrayValidator;
|
|
91
|
-
} else if (typeof field.extra.of === 'string') {
|
|
92
|
-
return yup.array().of(yupTypeMap[field.extra.of]());
|
|
93
|
-
} else {
|
|
94
|
-
// in any other case it will be string
|
|
95
|
-
return yup.array().of(yup.string());
|
|
96
|
-
}
|
|
97
|
-
},
|
|
98
|
-
int: (): MixedSchema =>
|
|
99
|
-
yup
|
|
100
|
-
.mixed()
|
|
101
|
-
.transform((_, val) => (val !== '' ? Number(val) : null))
|
|
102
|
-
.test(NUMBER_VALIDATOR())
|
|
103
|
-
.test(INT_VALIDATOR()),
|
|
104
|
-
email: (): yup.StringSchema => yup.string().email('form.error.email'),
|
|
105
|
-
afm: (): yup.StringSchema => yup.string().test(AFM_VALIDATOR),
|
|
106
|
-
uuid4: (): yup.StringSchema => yup.string().test(UUID4_VALIDATOR),
|
|
107
|
-
iban: (field): yup.StringSchema => yup.string().test(IBAN_VALIDATOR(field)),
|
|
108
|
-
postal_code: (field): yup.StringSchema =>
|
|
109
|
-
yup.string().test(POSTALCODE_VALIDATOR(field)),
|
|
110
|
-
mobile_phone: (): yup.StringSchema =>
|
|
111
|
-
yup.string().test(MOBILE_PHONE_VALIDATOR),
|
|
112
|
-
phone_number: (field): yup.StringSchema =>
|
|
113
|
-
yup.string().test(PHONE_NUMBER_VALIDATOR(field)),
|
|
114
|
-
'choice:multiple': (): yup.ArraySchema<
|
|
115
|
-
yup.StringSchema<string | undefined, AnyObject, string | undefined>,
|
|
116
|
-
AnyObject,
|
|
117
|
-
(string | undefined)[] | null | undefined,
|
|
118
|
-
(string | undefined)[] | null | undefined
|
|
119
|
-
> => yup.array().of(yup.string()).nullable(),
|
|
120
|
-
'choice:single': (): StringSchema<
|
|
121
|
-
string | null | undefined,
|
|
122
|
-
AnyObject,
|
|
123
|
-
string | null | undefined
|
|
124
|
-
> => yup.string().nullable(),
|
|
125
|
-
date: (field) => {
|
|
126
|
-
let simpleDate = yup
|
|
127
|
-
.string()
|
|
128
|
-
.nullable(true)
|
|
129
|
-
.test('date', 'form.error.date.invalid', function (value) {
|
|
130
|
-
if (!value) return true;
|
|
131
|
-
const date = getDate(value);
|
|
132
|
-
return date.isValid();
|
|
133
|
-
});
|
|
134
|
-
const params = field.extra || {};
|
|
135
|
-
if (params.max) {
|
|
136
|
-
let maxDate;
|
|
137
|
-
if (params.max === 'now') {
|
|
138
|
-
const today = new Date();
|
|
139
|
-
maxDate = new Date(today);
|
|
140
|
-
} else {
|
|
141
|
-
maxDate = getDate(params.max).toDate();
|
|
142
|
-
}
|
|
143
|
-
const maxNextDate = new Date(maxDate);
|
|
144
|
-
maxNextDate.setDate(maxDate.getDate() + 1);
|
|
145
|
-
simpleDate = simpleDate.test({
|
|
146
|
-
name: 'earlier-than',
|
|
147
|
-
message: {
|
|
148
|
-
key: 'form.error.date.earlier_than',
|
|
149
|
-
context: {
|
|
150
|
-
maxDate: maxNextDate.toLocaleDateString(),
|
|
151
|
-
},
|
|
152
|
-
},
|
|
153
|
-
test: function (value) {
|
|
154
|
-
if (!value) return true;
|
|
155
|
-
const date = getDate(value);
|
|
156
|
-
const isValid = +date.toDate() < +maxDate;
|
|
157
|
-
return isValid;
|
|
158
|
-
},
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
if (params.min) {
|
|
162
|
-
let minDate;
|
|
163
|
-
if (params.min === 'now') {
|
|
164
|
-
const today = new Date();
|
|
165
|
-
minDate = new Date(today);
|
|
166
|
-
} else {
|
|
167
|
-
minDate = getDate(params.min).toDate();
|
|
168
|
-
}
|
|
169
|
-
const minPreviousDate = new Date(minDate);
|
|
170
|
-
minPreviousDate.setDate(minDate.getDate() - 1);
|
|
171
|
-
simpleDate = simpleDate.test({
|
|
172
|
-
name: 'later-than',
|
|
173
|
-
message: {
|
|
174
|
-
key: 'form.error.date.later_than',
|
|
175
|
-
context: {
|
|
176
|
-
minDate: minPreviousDate.toLocaleDateString(),
|
|
177
|
-
},
|
|
178
|
-
},
|
|
179
|
-
test: function (value) {
|
|
180
|
-
if (!value) return true;
|
|
181
|
-
const date = getDate(value);
|
|
182
|
-
const isValid = +date.toDate() > +minDate;
|
|
183
|
-
return isValid;
|
|
184
|
-
},
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
return simpleDate;
|
|
188
|
-
},
|
|
189
|
-
};
|
|
190
|
-
return yupTypeMap;
|
|
191
|
-
};
|
|
192
|
-
|
|
193
|
-
export interface MutableRefObjectProps {}
|
|
194
|
-
// Create a yup validation schema from given fields input
|
|
195
|
-
export function useValidationSchema(
|
|
196
|
-
fields: FieldSpec[] | MutableRefObject<MutableRefObjectProps>,
|
|
197
|
-
validatorRegistry?: Record<string, ValidatorSchema[]>
|
|
198
|
-
): Lazy<any, unknown> | AnyObjectSchema | void {
|
|
199
|
-
return useMemo(() => {
|
|
200
|
-
const yupTypeMap = getYUPTypeMap();
|
|
201
|
-
return getYupObjectShape(fields, yupTypeMap, validatorRegistry);
|
|
202
|
-
}, []);
|
|
203
|
-
}
|
package/src/validators/types.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
export function validateAFM(afm: string): boolean {
|
|
2
|
-
if (afm.length !== 9) {
|
|
3
|
-
// "afm should be 9 digits"
|
|
4
|
-
return false;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
if (!/^\d+$/.test(afm)) {
|
|
8
|
-
// "This is not a number"
|
|
9
|
-
return false;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
if (afm === '0'.repeat(9)) {
|
|
13
|
-
// "This is zero number (000000000)"
|
|
14
|
-
return false;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const sum = afm
|
|
18
|
-
.substring(0, 8)
|
|
19
|
-
.split('')
|
|
20
|
-
.reduce((s, v, i) => s + (parseInt(v) << (8 - i)), 0);
|
|
21
|
-
|
|
22
|
-
const calc = sum % 11;
|
|
23
|
-
const d9 = parseInt(afm[8]);
|
|
24
|
-
const valid = calc % 10 === d9;
|
|
25
|
-
return valid;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export const AFM_VALIDATOR = {
|
|
29
|
-
name: 'afm-validator',
|
|
30
|
-
message: 'form.error.afm',
|
|
31
|
-
test: (value): boolean => {
|
|
32
|
-
if (value) {
|
|
33
|
-
return validateAFM(value);
|
|
34
|
-
}
|
|
35
|
-
return true;
|
|
36
|
-
},
|
|
37
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { ValidatorSchema } from '@digigov/form/validators/types';
|
|
2
|
-
import { FieldSpec } from '@digigov/form/types';
|
|
3
|
-
|
|
4
|
-
const DEFAULT_FILE_MAX_SIZE = 10000000;
|
|
5
|
-
|
|
6
|
-
export const FILE_MAX_SIZE_VALIDATOR = (field: FieldSpec): ValidatorSchema => ({
|
|
7
|
-
name: 'file-max-size-validator',
|
|
8
|
-
message: 'form.error.file_size',
|
|
9
|
-
test: (value: File[]): boolean => {
|
|
10
|
-
if (field.extra && field.extra.maxSize && value) {
|
|
11
|
-
for (const file of value) {
|
|
12
|
-
if (file.size >= field.extra.maxSize) {
|
|
13
|
-
return false;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
} else if (value) {
|
|
17
|
-
for (const file of value) {
|
|
18
|
-
if (file.size >= DEFAULT_FILE_MAX_SIZE) {
|
|
19
|
-
return false;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return true;
|
|
24
|
-
},
|
|
25
|
-
});
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import { FieldSpec } from '@digigov/form/types';
|
|
2
|
-
import { ValidatorSchema } from '@digigov/form/validators/types';
|
|
3
|
-
export function validateIban(value: string, countryCode: string): boolean {
|
|
4
|
-
value = value.replace(/\s/g, '').replace(/-/g, '');
|
|
5
|
-
if (value.match(/^[0-9]*$/i)) {
|
|
6
|
-
// this is for greek iban without the country code
|
|
7
|
-
if (value.length !== 25) {
|
|
8
|
-
return false;
|
|
9
|
-
}
|
|
10
|
-
} else {
|
|
11
|
-
value = value.toUpperCase();
|
|
12
|
-
if (countryCode) {
|
|
13
|
-
if (!value.startsWith(countryCode.toUpperCase())) {
|
|
14
|
-
return false;
|
|
15
|
-
}
|
|
16
|
-
if (value.length === ibanCountryCodesLengths[countryCode.toUpperCase()]) {
|
|
17
|
-
return true;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
if (value.length !== 27) {
|
|
21
|
-
// this is for greek iban
|
|
22
|
-
return false;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return true;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export const IBAN_VALIDATOR = (field: FieldSpec): ValidatorSchema => {
|
|
29
|
-
const countryCode = field?.extra?.country;
|
|
30
|
-
return {
|
|
31
|
-
name: 'iban-validator',
|
|
32
|
-
message: 'form.error.iban',
|
|
33
|
-
test: (value: string): boolean => {
|
|
34
|
-
if (!value) {
|
|
35
|
-
return true;
|
|
36
|
-
}
|
|
37
|
-
return validateIban(value, countryCode);
|
|
38
|
-
},
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
const ibanCountryCodesLengths = {
|
|
43
|
-
AD: 24,
|
|
44
|
-
AT: 20,
|
|
45
|
-
AZ: 28,
|
|
46
|
-
BH: 22,
|
|
47
|
-
BY: 28,
|
|
48
|
-
BE: 16,
|
|
49
|
-
BA: 20,
|
|
50
|
-
BR: 29,
|
|
51
|
-
BG: 22,
|
|
52
|
-
CR: 22,
|
|
53
|
-
HR: 21,
|
|
54
|
-
CY: 28,
|
|
55
|
-
CZ: 24,
|
|
56
|
-
DK: 18,
|
|
57
|
-
DO: 28,
|
|
58
|
-
EG: 29,
|
|
59
|
-
SV: 28,
|
|
60
|
-
EE: 20,
|
|
61
|
-
FO: 18,
|
|
62
|
-
FI: 18,
|
|
63
|
-
FR: 27,
|
|
64
|
-
GE: 22,
|
|
65
|
-
DE: 22,
|
|
66
|
-
GI: 23,
|
|
67
|
-
GR: 27,
|
|
68
|
-
GL: 18,
|
|
69
|
-
GT: 28,
|
|
70
|
-
VA: 22,
|
|
71
|
-
HU: 28,
|
|
72
|
-
IS: 26,
|
|
73
|
-
IQ: 23,
|
|
74
|
-
IE: 22,
|
|
75
|
-
IL: 23,
|
|
76
|
-
IT: 27,
|
|
77
|
-
JO: 30,
|
|
78
|
-
KZ: 20,
|
|
79
|
-
XK: 20,
|
|
80
|
-
KW: 30,
|
|
81
|
-
LV: 21,
|
|
82
|
-
LB: 28,
|
|
83
|
-
LI: 21,
|
|
84
|
-
LT: 20,
|
|
85
|
-
LU: 20,
|
|
86
|
-
MT: 31,
|
|
87
|
-
MR: 27,
|
|
88
|
-
MU: 30,
|
|
89
|
-
MD: 24,
|
|
90
|
-
MC: 27,
|
|
91
|
-
ME: 22,
|
|
92
|
-
NL: 18,
|
|
93
|
-
MK: 19,
|
|
94
|
-
NO: 15,
|
|
95
|
-
PK: 24,
|
|
96
|
-
PS: 29,
|
|
97
|
-
PL: 28,
|
|
98
|
-
PT: 25,
|
|
99
|
-
QA: 29,
|
|
100
|
-
RO: 24,
|
|
101
|
-
LC: 32,
|
|
102
|
-
SM: 27,
|
|
103
|
-
ST: 25,
|
|
104
|
-
SA: 24,
|
|
105
|
-
RS: 22,
|
|
106
|
-
SC: 31,
|
|
107
|
-
SK: 24,
|
|
108
|
-
SI: 19,
|
|
109
|
-
ES: 24,
|
|
110
|
-
SE: 24,
|
|
111
|
-
CH: 21,
|
|
112
|
-
TL: 23,
|
|
113
|
-
TN: 24,
|
|
114
|
-
TR: 26,
|
|
115
|
-
UA: 29,
|
|
116
|
-
AE: 23,
|
|
117
|
-
GB: 22,
|
|
118
|
-
VG: 24,
|
|
119
|
-
};
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import * as yup from 'yup';
|
|
2
|
-
import { FieldSpec } from '@digigov/form/types';
|
|
3
|
-
import { ValidatorSchema } from '@digigov/form/validators/types';
|
|
4
|
-
|
|
5
|
-
export * from '@digigov/form/validators/utils/afm';
|
|
6
|
-
export * from '@digigov/form/validators/utils/file';
|
|
7
|
-
export * from '@digigov/form/validators/utils/iban';
|
|
8
|
-
export * from '@digigov/form/validators/utils/phone';
|
|
9
|
-
export * from '@digigov/form/validators/utils/postal_code';
|
|
10
|
-
export * from '@digigov/form/validators/utils/uuid4';
|
|
11
|
-
|
|
12
|
-
export function getYupField(field: FieldSpec, yupTypeMap: Record<string, any>) {
|
|
13
|
-
const yupField = yupTypeMap[field?.type || 'string'] || yupTypeMap['string'];
|
|
14
|
-
return yupField(field);
|
|
15
|
-
}
|
|
16
|
-
export function computeShape(
|
|
17
|
-
fields: FieldSpec[],
|
|
18
|
-
yupTypeMap: Record<string, ValidatorSchema>,
|
|
19
|
-
validatorRegistry: Record<string, ValidatorSchema[]> | undefined
|
|
20
|
-
) {
|
|
21
|
-
const fieldSchemas = {};
|
|
22
|
-
const objectFields: Record<string, FieldSpec[]> = {};
|
|
23
|
-
fields.forEach((field) => {
|
|
24
|
-
let yupField = getYupField(field, yupTypeMap);
|
|
25
|
-
if (field.condition) {
|
|
26
|
-
for (const key in field.condition) {
|
|
27
|
-
let then: any, otherwise: any;
|
|
28
|
-
if (field.condition[key].then) {
|
|
29
|
-
if (field.condition[key].then?.required === false) {
|
|
30
|
-
then = yupField;
|
|
31
|
-
} else if (field.condition[key].then?.required === true) {
|
|
32
|
-
then = yupField.required('form.error.required');
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
if (field.condition[key].else) {
|
|
36
|
-
if (field.condition[key].else?.required === false) {
|
|
37
|
-
otherwise = yupField;
|
|
38
|
-
} else if (field.condition[key].else?.required === true) {
|
|
39
|
-
otherwise = yupField.required('form.error.required');
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
if (then || otherwise) {
|
|
43
|
-
yupField = yupField.when(key, {
|
|
44
|
-
is: field.condition[key].is,
|
|
45
|
-
then,
|
|
46
|
-
otherwise,
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
} else if (field.required) {
|
|
51
|
-
yupField = yupField.required('form.error.required');
|
|
52
|
-
}
|
|
53
|
-
if (validatorRegistry && field.type && validatorRegistry[field.type]) {
|
|
54
|
-
validatorRegistry[field.type].forEach((validator: any) => {
|
|
55
|
-
yupField = yupField.test(validator);
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
if (field.validators) {
|
|
59
|
-
field.validators.forEach((validator) => {
|
|
60
|
-
yupField = yupField.test(validator);
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
fieldSchemas[field.key] = yupField;
|
|
64
|
-
});
|
|
65
|
-
for (const objectKey in objectFields) {
|
|
66
|
-
fieldSchemas[objectKey] = getYupObjectShape(
|
|
67
|
-
objectFields[objectKey],
|
|
68
|
-
yupTypeMap,
|
|
69
|
-
validatorRegistry
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
return fieldSchemas;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export function getYupObjectShape(
|
|
76
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
77
|
-
fields: FieldSpec[] | any,
|
|
78
|
-
yupTypeMap: Record<string, any>,
|
|
79
|
-
validatorRegistry?: Record<string, ValidatorSchema[]>
|
|
80
|
-
) {
|
|
81
|
-
if (!fields.current) {
|
|
82
|
-
const fieldSchemas = computeShape(fields, yupTypeMap, validatorRegistry);
|
|
83
|
-
return yup.object().shape(fieldSchemas);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return yup.lazy(function () {
|
|
87
|
-
const fieldSchemas = computeShape(
|
|
88
|
-
Object.values(fields.current),
|
|
89
|
-
yupTypeMap,
|
|
90
|
-
validatorRegistry
|
|
91
|
-
);
|
|
92
|
-
return yup.object().shape(fieldSchemas);
|
|
93
|
-
});
|
|
94
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { ValidatorSchema } from '@digigov/form/validators/types';
|
|
2
|
-
|
|
3
|
-
export function validateIntNumber(number: number): boolean {
|
|
4
|
-
if (number === undefined) {
|
|
5
|
-
return false;
|
|
6
|
-
} else {
|
|
7
|
-
return Number.isInteger(number) && Number(number) > 0;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export const INT_VALIDATOR = (): ValidatorSchema => {
|
|
12
|
-
return {
|
|
13
|
-
name: 'int-validator',
|
|
14
|
-
message: 'form.error.positive_integer_number',
|
|
15
|
-
test: (value: number): boolean => {
|
|
16
|
-
if (value === null) {
|
|
17
|
-
return true;
|
|
18
|
-
}
|
|
19
|
-
return validateIntNumber(value);
|
|
20
|
-
},
|
|
21
|
-
};
|
|
22
|
-
};
|