@digigov/form 2.0.0-rc.7 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +113 -3
- package/Field/ErrorGroup.d.ts +15 -0
- package/Field/ErrorGroup.js +53 -0
- package/Field/FieldBase.d.ts +1 -1
- package/Field/FieldBase.js +77 -0
- package/Field/FieldBaseContainer.d.ts +2 -2
- package/Field/FieldBaseContainer.js +43 -0
- package/Field/FieldConditional.d.ts +1 -1
- package/Field/FieldConditional.js +45 -0
- package/Field/index.d.ts +1 -1
- package/Field/index.js +70 -68
- package/Field/types.d.ts +61 -11
- package/Field/utils/evaluateFieldWithConditions.d.ts +2 -0
- package/Field/utils/evaluateFieldWithConditions.js +19 -0
- package/Field/utils/resolveField.d.ts +3 -0
- package/Field/utils/resolveField.js +32 -0
- package/Field/utils/useField.d.ts +2 -0
- package/Field/utils/useField.js +47 -0
- package/FieldArray/BaseFieldArray.d.ts +5 -0
- package/FieldArray/BaseFieldArray.js +46 -0
- package/FieldArray/FormDialog/ArrayDisplay/ArrayContainerDisplay.d.ts +9 -0
- package/FieldArray/FormDialog/ArrayDisplay/ArrayContainerDisplay.js +13 -0
- package/FieldArray/FormDialog/ArrayDisplay/ArrayItemDisplay.d.ts +26 -0
- package/FieldArray/FormDialog/ArrayDisplay/ArrayItemDisplay.js +134 -0
- package/FieldArray/FormDialog/ArrayDisplay/ArrayItemHeader.d.ts +5 -0
- package/FieldArray/FormDialog/ArrayDisplay/ArrayItemHeader.js +6 -0
- package/FieldArray/FormDialog/ArrayDisplay/index.d.ts +15 -0
- package/FieldArray/FormDialog/ArrayDisplay/index.js +32 -0
- package/FieldArray/FormDialog/ArrayEditModal.d.ts +24 -0
- package/FieldArray/FormDialog/ArrayEditModal.js +138 -0
- package/FieldArray/FormDialog/index.d.ts +19 -0
- package/FieldArray/FormDialog/index.js +199 -0
- package/FieldArray/index.d.ts +11 -2
- package/FieldArray/index.js +65 -60
- package/FieldObject/index.d.ts +11 -3
- package/FieldObject/index.js +53 -52
- package/Fieldset/FieldsetWithContext.js +27 -0
- package/Fieldset/index.d.ts +2 -2
- package/Fieldset/index.js +18 -32
- package/Fieldset/types.d.ts +3 -2
- package/FormBuilder/index.d.ts +8 -1
- package/FormBuilder/index.js +239 -2
- package/FormContext.d.ts +3 -2
- package/FormContext.js +7 -0
- package/MultiplicityField/add-objects.d.ts +3 -2
- package/MultiplicityField/add-objects.js +107 -0
- package/MultiplicityField/index.d.ts +2 -19
- package/MultiplicityField/index.js +84 -111
- package/MultiplicityField/types.d.ts +19 -0
- package/Questions/Questions.d.ts +1 -1
- package/Questions/Questions.js +48 -0
- package/Questions/QuestionsContext.d.ts +1 -2
- package/Questions/QuestionsContext.js +10 -0
- package/Questions/Step/ReviewStep.js +32 -0
- package/Questions/Step/Step.d.ts +1 -1
- package/Questions/Step/Step.js +39 -0
- package/Questions/Step/StepArrayReview.d.ts +1 -1
- package/Questions/Step/StepArrayReview.js +35 -0
- package/Questions/Step/StepContext.d.ts +1 -2
- package/Questions/Step/StepContext.js +28 -0
- package/Questions/Step/StepDescription.d.ts +1 -1
- package/Questions/Step/StepDescription.js +18 -0
- package/Questions/Step/StepForm.d.ts +2 -2
- package/Questions/Step/StepForm.js +29 -0
- package/Questions/Step/StepQuote.d.ts +1 -1
- package/Questions/Step/StepQuote.js +5 -0
- package/Questions/Step/StepTitle.d.ts +2 -1
- package/Questions/Step/StepTitle.js +25 -0
- package/Questions/Step/getAddMoreFields.d.ts +2 -2
- package/Questions/Step/getAddMoreFields.js +24 -0
- package/Questions/Step/index.d.ts +11 -12
- package/Questions/Step/index.js +13 -13
- package/Questions/Step/types.d.ts +2 -1
- package/Questions/Step/types.js +0 -0
- package/Questions/getNextStep.d.ts +1 -1
- package/Questions/getNextStep.js +13 -0
- package/Questions/index.d.ts +2 -2
- package/Questions/index.js +4 -3
- package/Questions/types.d.ts +2 -1
- package/Questions/types.js +0 -0
- package/hooks/useFieldFocusManager.d.ts +25 -0
- package/hooks/useFieldFocusManager.js +83 -0
- package/hooks/utils.d.ts +18 -0
- package/hooks/utils.js +60 -0
- package/index.d.ts +5 -2
- package/index.js +8 -4
- package/inputs/AutoCompleteInput/index.d.ts +5 -5
- package/inputs/AutoCompleteInput/index.js +42 -44
- package/inputs/Checkboxes/index.d.ts +7 -4
- package/inputs/Checkboxes/index.js +50 -91
- package/inputs/DateInput/index.d.ts +3 -7
- package/inputs/DateInput/index.js +128 -125
- package/inputs/DateTimeInput/index.d.ts +10 -0
- package/inputs/DateTimeInput/index.js +190 -0
- package/inputs/FileInput/index.d.ts +18 -2
- package/inputs/FileInput/index.js +59 -56
- package/inputs/ImageInput/index.d.ts +10 -2
- package/inputs/ImageInput/index.js +94 -74
- package/inputs/Input/index.d.ts +5 -2
- package/inputs/Input/index.js +67 -67
- package/inputs/Label/index.d.ts +2 -4
- package/inputs/Label/index.js +13 -21
- package/inputs/OtpInput/index.d.ts +1 -5
- package/inputs/OtpInput/index.js +122 -139
- package/inputs/Radio/index.d.ts +10 -3
- package/inputs/Radio/index.js +72 -56
- package/inputs/Select/index.d.ts +7 -4
- package/inputs/Select/index.js +23 -30
- package/inputs/index.d.ts +9 -9
- package/inputs/index.js +10 -9
- package/inputs/registry.d.ts +5 -0
- package/inputs/registry.js +80 -0
- package/internal.d.ts +5 -34
- package/internal.js +6 -0
- package/lazy.d.ts +93 -65
- package/lazy.js +163 -0
- package/package.json +12 -13
- package/registry.d.ts +45 -27
- package/registry.js +170 -0
- package/src/Field/ErrorGroup.tsx +84 -0
- package/src/Field/FieldBase.tsx +43 -25
- package/src/Field/FieldBaseContainer.tsx +71 -47
- package/src/Field/FieldConditional.tsx +10 -2
- package/src/Field/doc.mdx +207 -0
- package/src/Field/index.tsx +37 -23
- package/src/Field/types.tsx +92 -13
- package/src/Field/utils/evaluateFieldWithConditions.ts +33 -0
- package/src/Field/utils/resolveField.ts +58 -0
- package/src/Field/utils/useField.ts +68 -0
- package/src/FieldArray/BaseFieldArray.tsx +97 -0
- package/src/FieldArray/FieldArray.stories.js +4 -2
- package/src/FieldArray/FormDialog/ArrayDisplay/ArrayContainerDisplay.tsx +45 -0
- package/src/FieldArray/FormDialog/ArrayDisplay/ArrayDisplay.stories.js +14 -0
- package/src/FieldArray/FormDialog/ArrayDisplay/ArrayItemDisplay.tsx +370 -0
- package/src/FieldArray/FormDialog/ArrayDisplay/ArrayItemHeader.tsx +15 -0
- package/src/FieldArray/FormDialog/ArrayDisplay/__stories__/Cards.tsx +88 -0
- package/src/FieldArray/FormDialog/ArrayDisplay/__stories__/Default.tsx +93 -0
- package/src/FieldArray/FormDialog/ArrayDisplay/__stories__/ReadOnly.tsx +79 -0
- package/src/FieldArray/FormDialog/ArrayDisplay/__stories__/ReadOnlyCards.tsx +75 -0
- package/src/FieldArray/FormDialog/ArrayDisplay/__stories__/Sortable.tsx +93 -0
- package/src/FieldArray/FormDialog/ArrayDisplay/__stories__/SortableCards.tsx +88 -0
- package/src/FieldArray/FormDialog/ArrayDisplay/index.test.tsx +44 -0
- package/src/FieldArray/FormDialog/ArrayDisplay/index.tsx +67 -0
- package/src/FieldArray/FormDialog/ArrayEditModal.tsx +241 -0
- package/src/FieldArray/FormDialog/index.tsx +302 -0
- package/src/FieldArray/__stories__/CardsWithError.tsx +110 -0
- package/src/FieldArray/__stories__/Default.tsx +2 -1
- package/src/FieldArray/__stories__/TableWithError.tsx +111 -0
- package/src/FieldArray/__stories__/WithExactLength.tsx +2 -1
- package/src/FieldArray/__stories__/WithModal.tsx +188 -0
- package/src/FieldArray/__tests__/fieldset-multiplicity.spec.tsx +271 -0
- package/src/FieldArray/__tests__/multiplicity-attachment.spec.tsx +280 -0
- package/src/FieldArray/__tests__/multiplicity-optional.spec.tsx +232 -0
- package/src/FieldArray/__tests__/multiplicity-required.spec.tsx +170 -0
- package/src/FieldArray/__tests__/nested-fieldset-multiplicity.spec.tsx +627 -0
- package/src/FieldArray/__tests__/preference-multiple-choice.spec.tsx +222 -0
- package/src/FieldArray/index.spec.tsx +355 -0
- package/src/FieldArray/index.test.tsx +43 -0
- package/src/FieldArray/index.tsx +84 -55
- package/src/FieldObject/index.tsx +53 -27
- package/src/Fieldset/FieldsetWithContext.tsx +1 -1
- package/src/Fieldset/index.tsx +6 -6
- package/src/Fieldset/types.tsx +5 -3
- package/src/FormBuilder/FormBuilder.stories.js +6 -1
- package/src/FormBuilder/__stories__/AutoErrorGrouping.tsx +63 -0
- package/src/FormBuilder/__stories__/Default.tsx +1 -1
- package/src/FormBuilder/__stories__/ErrorGrouping.tsx +43 -0
- package/src/FormBuilder/{FormBuilder.mdx → doc.mdx} +27 -35
- package/src/FormBuilder/index.test.tsx +32 -0
- package/src/FormBuilder/index.tsx +314 -1
- package/src/FormBuilder/interaction.test.tsx +40 -0
- package/src/FormBuilder/scenarios.test.tsx +2775 -0
- package/src/FormContext.tsx +7 -3
- package/src/MultiplicityField/MultiplicityField.stories.js +9 -6
- package/src/MultiplicityField/__stories__/Default.tsx +1 -1
- package/src/MultiplicityField/__stories__/PreviewDisplay.tsx +4 -6
- package/src/MultiplicityField/__stories__/WithExactLength.tsx +2 -2
- package/src/MultiplicityField/__stories__/WithMaxLength.tsx +2 -2
- package/src/MultiplicityField/__stories__/WithMinAndMaxLength.tsx +2 -2
- package/src/MultiplicityField/__stories__/WithMinLength.tsx +2 -2
- package/src/MultiplicityField/add-objects.tsx +39 -30
- package/{cjs/MultiplicityField/MultiplicityField.mdx → src/MultiplicityField/doc.mdx} +112 -98
- package/src/MultiplicityField/index.test.tsx +44 -0
- package/src/MultiplicityField/index.tsx +25 -34
- package/src/MultiplicityField/types.ts +25 -0
- package/src/Questions/Questions.stories.js +4 -1
- package/src/Questions/Questions.tsx +6 -6
- package/src/Questions/QuestionsContext.tsx +1 -1
- package/src/Questions/Step/Step.tsx +1 -1
- package/src/Questions/Step/StepArrayReview.tsx +3 -3
- package/src/Questions/Step/StepContext.tsx +1 -1
- package/src/Questions/Step/StepDescription.tsx +2 -1
- package/src/Questions/Step/StepForm.tsx +2 -2
- package/src/Questions/Step/StepQuote.tsx +2 -1
- package/src/Questions/Step/StepTitle.tsx +6 -3
- package/src/Questions/Step/getAddMoreFields.tsx +2 -2
- package/src/Questions/Step/index.ts +0 -1
- package/src/Questions/Step/types.tsx +2 -1
- package/src/Questions/__snapshots__/index.spec.tsx.snap +74 -587
- package/src/Questions/__stories__/Default.tsx +1 -1
- package/{Questions/index.mdx → src/Questions/doc.mdx} +34 -57
- package/src/Questions/getNextStep.tsx +1 -1
- package/src/Questions/index.spec.tsx +17 -5
- package/src/Questions/index.test.tsx +24 -0
- package/src/Questions/types.tsx +2 -1
- package/src/create-simple-form.mdx +2 -6
- package/src/{index.mdx → doc.mdx} +29 -18
- package/src/hooks/__tests__/useFieldFocusManager.spec.tsx +1079 -0
- package/src/hooks/__tests__/utils.spec.ts +568 -0
- package/src/hooks/useFieldFocusManager.ts +162 -0
- package/src/hooks/utils.ts +122 -0
- package/src/index.ts +4 -1
- package/src/inputs/AutoCompleteInput/AutoComplete.stories.js +5 -2
- package/src/inputs/AutoCompleteInput/__stories__/Default.tsx +3 -11
- package/src/inputs/AutoCompleteInput/__stories__/Multiple.tsx +3 -10
- package/{cjs/inputs/AutoCompleteInput/index.mdx → src/inputs/AutoCompleteInput/doc.mdx} +2 -13
- package/src/inputs/AutoCompleteInput/index.test.tsx +28 -0
- package/src/inputs/AutoCompleteInput/index.tsx +49 -35
- package/src/inputs/Checkboxes/Checkboxes.stories.js +6 -3
- package/src/inputs/Checkboxes/__stories__/Conditional.tsx +1 -1
- package/src/inputs/Checkboxes/__stories__/Default.tsx +1 -1
- package/src/inputs/Checkboxes/__stories__/WithDivider.tsx +1 -1
- package/src/inputs/Checkboxes/{index.mdx → doc.mdx} +5 -15
- package/src/inputs/Checkboxes/index.test.tsx +32 -0
- package/src/inputs/Checkboxes/index.tsx +106 -92
- package/src/inputs/DateInput/DateInput.stories.js +8 -1
- package/src/inputs/DateInput/__stories__/Default.tsx +17 -16
- package/src/inputs/DateInput/__stories__/WithDefaultValue.tsx +26 -0
- package/src/inputs/DateInput/__stories__/WithInitialValue.tsx +28 -0
- package/src/inputs/DateInput/__stories__/WithWrongDefaultValue.tsx +26 -0
- package/src/inputs/DateInput/__stories__/WithWrongInitialValue.tsx +28 -0
- package/src/inputs/DateInput/{index.mdx → doc.mdx} +1 -8
- package/src/inputs/DateInput/index.test.tsx +40 -0
- package/src/inputs/DateInput/index.tsx +77 -27
- package/src/inputs/DateTimeInput/DateTimeInput.stories.js +14 -0
- package/src/inputs/DateTimeInput/__stories__/Default.tsx +25 -0
- package/src/inputs/DateTimeInput/__stories__/WithDefaultValue.tsx +26 -0
- package/src/inputs/DateTimeInput/__stories__/WithInitialValue.tsx +28 -0
- package/src/inputs/DateTimeInput/__stories__/WithWrongDefaultValue.tsx +26 -0
- package/src/inputs/DateTimeInput/__stories__/WithWrongInitialValue.tsx +28 -0
- package/src/inputs/DateTimeInput/doc.mdx +16 -0
- package/src/inputs/DateTimeInput/index.test.tsx +40 -0
- package/src/inputs/DateTimeInput/index.tsx +246 -0
- package/src/inputs/FileInput/FileInput.stories.js +5 -1
- package/src/inputs/FileInput/__stories__/Default.tsx +1 -1
- package/src/inputs/FileInput/__stories__/WithBorderAndLink.tsx +34 -0
- package/{inputs/FileInput/index.mdx → src/inputs/FileInput/doc.mdx} +1 -5
- package/src/inputs/FileInput/index.test.tsx +28 -0
- package/src/inputs/FileInput/index.tsx +102 -43
- package/src/inputs/ImageInput/ImageInput.stories.js +7 -3
- package/src/inputs/ImageInput/__stories__/Default.tsx +1 -1
- package/src/inputs/ImageInput/__stories__/{WithInvalidImageSize.tsx → MaxSize.tsx} +5 -3
- package/src/inputs/ImageInput/__stories__/WithInitialValues.tsx +45 -0
- package/src/inputs/ImageInput/__stories__/WithInvalidImageDimension.tsx +3 -1
- package/src/inputs/ImageInput/__stories__/logo.d.ts +4 -0
- package/src/inputs/ImageInput/__stories__/logo.png +0 -0
- package/src/inputs/ImageInput/doc.mdx +23 -0
- package/src/inputs/ImageInput/index.test.tsx +36 -0
- package/src/inputs/ImageInput/index.tsx +105 -52
- package/src/inputs/Input/Input.stories.js +17 -10
- package/src/inputs/Input/__stories__/AFM.tsx +1 -1
- package/src/inputs/Input/__stories__/AMKA.tsx +23 -0
- package/src/inputs/Input/__stories__/Boolean.tsx +1 -1
- package/src/inputs/Input/__stories__/Email.tsx +23 -0
- package/src/inputs/Input/__stories__/IBAN.tsx +1 -1
- package/src/inputs/Input/__stories__/Integer.tsx +1 -1
- package/src/inputs/Input/__stories__/LandlineNumber.tsx +3 -2
- package/src/inputs/Input/__stories__/MobilePhone.tsx +2 -1
- package/src/inputs/Input/__stories__/PhoneNumber.tsx +2 -1
- package/src/inputs/Input/__stories__/PostalCode.tsx +2 -1
- package/src/inputs/Input/__stories__/Rate.tsx +25 -0
- package/src/inputs/Input/__stories__/{Default.tsx → String.tsx} +2 -2
- package/src/inputs/Input/__stories__/StringWithTrimValidation.tsx +26 -0
- package/src/inputs/Input/__stories__/{TextWithCharacterLimit.tsx → TextWithLimit.tsx} +3 -2
- package/src/inputs/Input/doc.mdx +56 -0
- package/src/inputs/Input/index.test.tsx +76 -0
- package/src/inputs/Input/index.tsx +55 -35
- package/src/inputs/Label/Label.stories.js +4 -1
- package/src/inputs/Label/__stories__/Default.tsx +4 -2
- package/src/inputs/Label/doc.mdx +14 -0
- package/src/inputs/Label/index.test.tsx +24 -0
- package/src/inputs/Label/index.tsx +4 -11
- package/src/inputs/OtpInput/OtpInput.stories.js +4 -1
- package/src/inputs/OtpInput/__stories__/Default.tsx +1 -1
- package/{cjs/inputs/OtpInput/index.mdx → src/inputs/OtpInput/doc.mdx} +1 -8
- package/src/inputs/OtpInput/index.test.tsx +24 -0
- package/src/inputs/OtpInput/index.tsx +45 -34
- package/src/inputs/Radio/Radio.stories.js +6 -3
- package/src/inputs/Radio/__stories__/Conditional.tsx +3 -2
- package/src/inputs/Radio/__stories__/Default.tsx +1 -1
- package/src/inputs/Radio/__stories__/WithDivider.tsx +1 -1
- package/{cjs/inputs/Radio/index.mdx → src/inputs/Radio/doc.mdx} +5 -15
- package/src/inputs/Radio/index.test.tsx +32 -0
- package/src/inputs/Radio/index.tsx +93 -12
- package/src/inputs/Select/Select.stories.js +4 -1
- package/src/inputs/Select/__stories__/Default.tsx +1 -1
- package/src/inputs/Select/{index.mdx → doc.mdx} +1 -5
- package/src/inputs/Select/index.test.tsx +24 -0
- package/src/inputs/Select/index.tsx +22 -9
- package/src/inputs/registry.ts +86 -0
- package/src/installation.mdx +2 -5
- package/src/internal.ts +2 -31
- package/src/lazy.ts +56 -0
- package/src/registry.ts +179 -0
- package/src/types.tsx +21 -65
- package/src/utils.ts +67 -33
- package/src/validators/index.ts +138 -99
- package/src/validators/types.ts +1 -1
- package/src/validators/utils/amka.ts +39 -0
- package/src/validators/utils/date.ts +131 -0
- package/src/validators/utils/datetime.ts +222 -0
- package/src/validators/utils/email.ts +11 -0
- package/src/validators/utils/file.ts +35 -19
- package/src/validators/utils/iban.ts +2 -2
- package/src/validators/utils/image.ts +2 -2
- package/src/validators/utils/index.ts +15 -6
- package/src/validators/utils/int.ts +2 -2
- package/src/validators/utils/number.ts +2 -2
- package/src/validators/utils/otp.ts +2 -2
- package/src/validators/utils/phone.ts +65 -74
- package/src/validators/utils/postal_code.ts +3 -3
- package/src/validators/utils/text_limit.ts +2 -2
- package/src/validators/utils/uuid4.ts +2 -1
- package/src/validators/validators.spec.ts +6 -40
- package/types.d.ts +14 -37
- package/types.js +1 -0
- package/utils.d.ts +4 -1
- package/utils.js +56 -0
- package/validators/index.d.ts +6 -6
- package/validators/index.js +115 -180
- package/validators/types.d.ts +1 -1
- package/validators/types.js +0 -0
- package/validators/utils/afm.js +19 -0
- package/validators/utils/amka.d.ts +6 -0
- package/validators/utils/amka.js +27 -0
- package/validators/utils/date.d.ts +9 -0
- package/validators/utils/date.js +95 -0
- package/validators/utils/datetime.d.ts +9 -0
- package/validators/utils/datetime.js +121 -0
- package/validators/utils/email.d.ts +5 -0
- package/validators/utils/email.js +10 -0
- package/validators/utils/file.d.ts +2 -2
- package/validators/utils/file.js +31 -0
- package/validators/utils/iban.d.ts +2 -2
- package/validators/utils/iban.js +104 -0
- package/validators/utils/image.d.ts +2 -2
- package/validators/utils/image.js +65 -0
- package/validators/utils/index.d.ts +14 -11
- package/validators/utils/index.js +62 -85
- package/validators/utils/int.d.ts +1 -1
- package/validators/utils/int.js +13 -0
- package/validators/utils/number.d.ts +1 -1
- package/validators/utils/number.js +12 -0
- package/validators/utils/otp.d.ts +2 -2
- package/validators/utils/otp.js +21 -0
- package/validators/utils/phone.d.ts +3 -3
- package/validators/utils/phone.js +198 -0
- package/validators/utils/postal_code.d.ts +3 -3
- package/validators/utils/postal_code.js +18 -0
- package/validators/utils/text_limit.d.ts +2 -2
- package/validators/utils/text_limit.js +34 -0
- package/validators/utils/uuid4.js +14 -0
- package/Field/FieldBase/index.js +0 -82
- package/Field/FieldBase/package.json +0 -6
- package/Field/FieldBaseContainer/index.js +0 -40
- package/Field/FieldBaseContainer/package.json +0 -6
- package/Field/FieldConditional/index.js +0 -59
- package/Field/FieldConditional/package.json +0 -6
- package/Field/index.mdx +0 -6
- package/Field/package.json +0 -6
- package/Field/types/index.js +0 -1
- package/Field/types/package.json +0 -6
- package/Field/utils/index.js +0 -153
- package/Field/utils/package.json +0 -6
- package/Field/utils.d.ts +0 -5
- package/FieldArray/FieldArray.stories/index.js +0 -8
- package/FieldArray/FieldArray.stories/package.json +0 -6
- package/FieldArray/FieldArray.stories.d.ts +0 -9
- package/FieldArray/FieldArray.stories.playwright.json +0 -353
- package/FieldArray/__stories__/Default/index.js +0 -88
- package/FieldArray/__stories__/Default/package.json +0 -6
- package/FieldArray/__stories__/Default.d.ts +0 -2
- package/FieldArray/__stories__/WithExactLength/index.js +0 -88
- package/FieldArray/__stories__/WithExactLength/package.json +0 -6
- package/FieldArray/__stories__/WithExactLength.d.ts +0 -2
- package/FieldArray/package.json +0 -6
- package/FieldObject/package.json +0 -6
- package/Fieldset/FieldsetWithContext/index.js +0 -35
- package/Fieldset/FieldsetWithContext/package.json +0 -6
- package/Fieldset/package.json +0 -6
- package/Fieldset/types/index.js +0 -1
- package/Fieldset/types/package.json +0 -6
- package/Form.stories/index.js +0 -3
- package/Form.stories/package.json +0 -6
- package/Form.stories.d.ts +0 -4
- package/FormBuilder/FormBuilder/index.js +0 -152
- package/FormBuilder/FormBuilder/package.json +0 -6
- package/FormBuilder/FormBuilder.d.ts +0 -5
- package/FormBuilder/FormBuilder.mdx +0 -256
- package/FormBuilder/FormBuilder.stories/index.js +0 -7
- package/FormBuilder/FormBuilder.stories/package.json +0 -6
- package/FormBuilder/FormBuilder.stories.d.ts +0 -8
- package/FormBuilder/FormBuilder.stories.playwright.json +0 -52
- package/FormBuilder/__stories__/Default/index.js +0 -26
- package/FormBuilder/__stories__/Default/package.json +0 -6
- package/FormBuilder/__stories__/Default.d.ts +0 -3
- package/FormBuilder/package.json +0 -6
- package/FormContext/index.js +0 -5
- package/FormContext/package.json +0 -6
- package/MultiplicityField/MultiplicityField.mdx +0 -590
- package/MultiplicityField/MultiplicityField.stories/index.js +0 -12
- package/MultiplicityField/MultiplicityField.stories/package.json +0 -6
- package/MultiplicityField/MultiplicityField.stories.d.ts +0 -13
- package/MultiplicityField/MultiplicityField.stories.playwright.json +0 -1370
- package/MultiplicityField/__stories__/Default/index.js +0 -95
- package/MultiplicityField/__stories__/Default/package.json +0 -6
- package/MultiplicityField/__stories__/Default.d.ts +0 -2
- package/MultiplicityField/__stories__/PreviewDisplay/index.js +0 -72
- package/MultiplicityField/__stories__/PreviewDisplay/package.json +0 -6
- package/MultiplicityField/__stories__/PreviewDisplay.d.ts +0 -2
- package/MultiplicityField/__stories__/WithExactLength/index.js +0 -90
- package/MultiplicityField/__stories__/WithExactLength/package.json +0 -6
- package/MultiplicityField/__stories__/WithExactLength.d.ts +0 -2
- package/MultiplicityField/__stories__/WithMaxLength/index.js +0 -93
- package/MultiplicityField/__stories__/WithMaxLength/package.json +0 -6
- package/MultiplicityField/__stories__/WithMaxLength.d.ts +0 -2
- package/MultiplicityField/__stories__/WithMinAndMaxLength/index.js +0 -94
- package/MultiplicityField/__stories__/WithMinAndMaxLength/package.json +0 -6
- package/MultiplicityField/__stories__/WithMinAndMaxLength.d.ts +0 -2
- package/MultiplicityField/__stories__/WithMinLength/index.js +0 -93
- package/MultiplicityField/__stories__/WithMinLength/package.json +0 -6
- package/MultiplicityField/__stories__/WithMinLength.d.ts +0 -2
- package/MultiplicityField/add-objects/index.js +0 -148
- package/MultiplicityField/add-objects/package.json +0 -6
- package/MultiplicityField/package.json +0 -6
- package/Questions/Questions/index.js +0 -75
- package/Questions/Questions/package.json +0 -6
- package/Questions/Questions.stories/index.js +0 -7
- package/Questions/Questions.stories/package.json +0 -6
- package/Questions/Questions.stories.d.ts +0 -8
- package/Questions/QuestionsContext/index.js +0 -11
- package/Questions/QuestionsContext/package.json +0 -6
- package/Questions/Step/ReviewStep/index.js +0 -50
- package/Questions/Step/ReviewStep/package.json +0 -6
- package/Questions/Step/Step/index.js +0 -62
- package/Questions/Step/Step/package.json +0 -6
- package/Questions/Step/StepArrayReview/index.js +0 -46
- package/Questions/Step/StepArrayReview/package.json +0 -6
- package/Questions/Step/StepContext/index.js +0 -27
- package/Questions/Step/StepContext/package.json +0 -6
- package/Questions/Step/StepDescription/index.js +0 -24
- package/Questions/Step/StepDescription/package.json +0 -6
- package/Questions/Step/StepForm/index.js +0 -44
- package/Questions/Step/StepForm/package.json +0 -6
- package/Questions/Step/StepQuote/index.js +0 -10
- package/Questions/Step/StepQuote/package.json +0 -6
- package/Questions/Step/StepTitle/index.js +0 -41
- package/Questions/Step/StepTitle/package.json +0 -6
- package/Questions/Step/getAddMoreFields/index.js +0 -21
- package/Questions/Step/getAddMoreFields/package.json +0 -6
- package/Questions/Step/package.json +0 -6
- package/Questions/Step/types/index.js +0 -1
- package/Questions/Step/types/package.json +0 -6
- package/Questions/__snapshots__/index.spec.tsx.snap +0 -596
- package/Questions/__stories__/Default/index.js +0 -102
- package/Questions/__stories__/Default/package.json +0 -6
- package/Questions/__stories__/Default.d.ts +0 -3
- package/Questions/getNextStep/index.js +0 -20
- package/Questions/getNextStep/package.json +0 -6
- package/Questions/index.spec/index.js +0 -59
- package/Questions/index.spec/package.json +0 -6
- package/Questions/index.spec.d.ts +0 -1
- package/Questions/package.json +0 -6
- package/Questions/types/index.js +0 -1
- package/Questions/types/package.json +0 -6
- package/cjs/Field/FieldBase/index.js +0 -89
- package/cjs/Field/FieldBaseContainer/index.js +0 -47
- package/cjs/Field/FieldConditional/index.js +0 -66
- package/cjs/Field/index.js +0 -80
- package/cjs/Field/index.mdx +0 -6
- package/cjs/Field/types/index.js +0 -5
- package/cjs/Field/utils/index.js +0 -162
- package/cjs/FieldArray/FieldArray.stories/index.js +0 -38
- package/cjs/FieldArray/FieldArray.stories.playwright.json +0 -353
- package/cjs/FieldArray/__stories__/Default/index.js +0 -98
- package/cjs/FieldArray/__stories__/WithExactLength/index.js +0 -98
- package/cjs/FieldArray/index.js +0 -68
- package/cjs/FieldObject/index.js +0 -64
- package/cjs/Fieldset/FieldsetWithContext/index.js +0 -45
- package/cjs/Fieldset/index.js +0 -44
- package/cjs/Fieldset/types/index.js +0 -5
- package/cjs/Form.stories/index.js +0 -9
- package/cjs/FormBuilder/FormBuilder/index.js +0 -162
- package/cjs/FormBuilder/FormBuilder.mdx +0 -256
- package/cjs/FormBuilder/FormBuilder.stories/index.js +0 -26
- package/cjs/FormBuilder/FormBuilder.stories.playwright.json +0 -52
- package/cjs/FormBuilder/__stories__/Default/index.js +0 -36
- package/cjs/FormBuilder/index.js +0 -8
- package/cjs/FormContext/index.js +0 -11
- package/cjs/MultiplicityField/MultiplicityField.stories/index.js +0 -86
- package/cjs/MultiplicityField/MultiplicityField.stories.playwright.json +0 -1370
- package/cjs/MultiplicityField/__stories__/Default/index.js +0 -105
- package/cjs/MultiplicityField/__stories__/PreviewDisplay/index.js +0 -82
- package/cjs/MultiplicityField/__stories__/WithExactLength/index.js +0 -100
- package/cjs/MultiplicityField/__stories__/WithMaxLength/index.js +0 -103
- package/cjs/MultiplicityField/__stories__/WithMinAndMaxLength/index.js +0 -104
- package/cjs/MultiplicityField/__stories__/WithMinLength/index.js +0 -103
- package/cjs/MultiplicityField/add-objects/index.js +0 -155
- package/cjs/MultiplicityField/index.js +0 -123
- package/cjs/Questions/Questions/index.js +0 -85
- package/cjs/Questions/Questions.stories/index.js +0 -26
- package/cjs/Questions/QuestionsContext/index.js +0 -17
- package/cjs/Questions/Step/ReviewStep/index.js +0 -60
- package/cjs/Questions/Step/Step/index.js +0 -72
- package/cjs/Questions/Step/StepArrayReview/index.js +0 -56
- package/cjs/Questions/Step/StepContext/index.js +0 -33
- package/cjs/Questions/Step/StepDescription/index.js +0 -34
- package/cjs/Questions/Step/StepForm/index.js +0 -54
- package/cjs/Questions/Step/StepQuote/index.js +0 -17
- package/cjs/Questions/Step/StepTitle/index.js +0 -51
- package/cjs/Questions/Step/getAddMoreFields/index.js +0 -27
- package/cjs/Questions/Step/index.js +0 -143
- package/cjs/Questions/Step/types/index.js +0 -5
- package/cjs/Questions/__snapshots__/index.spec.tsx.snap +0 -596
- package/cjs/Questions/__stories__/Default/index.js +0 -113
- package/cjs/Questions/getNextStep/index.js +0 -26
- package/cjs/Questions/index.js +0 -21
- package/cjs/Questions/index.mdx +0 -415
- package/cjs/Questions/index.spec/index.js +0 -63
- package/cjs/Questions/types/index.js +0 -5
- package/cjs/create-simple-form.mdx +0 -539
- package/cjs/index.js +0 -22
- package/cjs/index.mdx +0 -51
- package/cjs/inputs/AutoCompleteInput/AutoComplete.stories/index.js +0 -38
- package/cjs/inputs/AutoCompleteInput/__stories__/Default/index.js +0 -51
- package/cjs/inputs/AutoCompleteInput/__stories__/Multiple/index.js +0 -52
- package/cjs/inputs/AutoCompleteInput/index.js +0 -55
- package/cjs/inputs/Checkboxes/Checkboxes.stories/index.js +0 -50
- package/cjs/inputs/Checkboxes/Checkboxes.stories.playwright.json +0 -85
- package/cjs/inputs/Checkboxes/__stories__/Conditional/index.js +0 -103
- package/cjs/inputs/Checkboxes/__stories__/Default/index.js +0 -50
- package/cjs/inputs/Checkboxes/__stories__/WithDivider/index.js +0 -51
- package/cjs/inputs/Checkboxes/index.js +0 -101
- package/cjs/inputs/Checkboxes/index.mdx +0 -33
- package/cjs/inputs/DateInput/DateInput.stories/index.js +0 -26
- package/cjs/inputs/DateInput/DateInput.stories.playwright.json +0 -72
- package/cjs/inputs/DateInput/__stories__/Default/index.js +0 -33
- package/cjs/inputs/DateInput/index.js +0 -141
- package/cjs/inputs/DateInput/index.mdx +0 -23
- package/cjs/inputs/FileInput/FileInput.stories/index.js +0 -26
- package/cjs/inputs/FileInput/FileInput.stories.playwright.json +0 -75
- package/cjs/inputs/FileInput/__stories__/Default/index.js +0 -30
- package/cjs/inputs/FileInput/index.js +0 -68
- package/cjs/inputs/FileInput/index.mdx +0 -19
- package/cjs/inputs/ImageInput/ImageInput.stories/index.js +0 -50
- package/cjs/inputs/ImageInput/ImageInput.stories.playwright.json +0 -77
- package/cjs/inputs/ImageInput/__stories__/Default/index.js +0 -38
- package/cjs/inputs/ImageInput/__stories__/WithInvalidImageDimension/index.js +0 -46
- package/cjs/inputs/ImageInput/__stories__/WithInvalidImageSize/index.js +0 -43
- package/cjs/inputs/ImageInput/index.js +0 -86
- package/cjs/inputs/ImageInput/index.mdx +0 -19
- package/cjs/inputs/Input/Input.stories/index.js +0 -134
- package/cjs/inputs/Input/Input.stories.playwright.json +0 -376
- package/cjs/inputs/Input/__stories__/AFM/index.js +0 -32
- package/cjs/inputs/Input/__stories__/Boolean/index.js +0 -33
- package/cjs/inputs/Input/__stories__/Default/index.js +0 -33
- package/cjs/inputs/Input/__stories__/IBAN/index.js +0 -33
- package/cjs/inputs/Input/__stories__/Integer/index.js +0 -41
- package/cjs/inputs/Input/__stories__/LandlineNumber/index.js +0 -36
- package/cjs/inputs/Input/__stories__/MobilePhone/index.js +0 -36
- package/cjs/inputs/Input/__stories__/PhoneNumber/index.js +0 -35
- package/cjs/inputs/Input/__stories__/PostalCode/index.js +0 -35
- package/cjs/inputs/Input/__stories__/TextWithCharacterLimit/index.js +0 -39
- package/cjs/inputs/Input/index.js +0 -76
- package/cjs/inputs/Input/index.mdx +0 -95
- package/cjs/inputs/Label/Label.stories/index.js +0 -26
- package/cjs/inputs/Label/Label.stories.playwright.json +0 -40
- package/cjs/inputs/Label/__stories__/Default/index.js +0 -37
- package/cjs/inputs/Label/index.js +0 -29
- package/cjs/inputs/OtpInput/OtpInput.stories/index.js +0 -26
- package/cjs/inputs/OtpInput/__stories__/Default/index.js +0 -39
- package/cjs/inputs/OtpInput/index.js +0 -151
- package/cjs/inputs/Radio/Radio.stories/index.js +0 -50
- package/cjs/inputs/Radio/Radio.stories.playwright.json +0 -73
- package/cjs/inputs/Radio/__stories__/Conditional/index.js +0 -103
- package/cjs/inputs/Radio/__stories__/Default/index.js +0 -55
- package/cjs/inputs/Radio/__stories__/WithDivider/index.js +0 -56
- package/cjs/inputs/Radio/index.js +0 -64
- package/cjs/inputs/Select/Select.stories/index.js +0 -26
- package/cjs/inputs/Select/Select.stories.playwright.json +0 -22
- package/cjs/inputs/Select/__stories__/Default/index.js +0 -61
- package/cjs/inputs/Select/index.js +0 -38
- package/cjs/inputs/Select/index.mdx +0 -17
- package/cjs/inputs/index.js +0 -69
- package/cjs/installation.mdx +0 -68
- package/cjs/internal/index.js +0 -348
- package/cjs/lazy/index.js +0 -517
- package/cjs/registry/index.js +0 -147
- package/cjs/types/index.js +0 -5
- package/cjs/utils/index.js +0 -87
- package/cjs/validators/index.js +0 -193
- package/cjs/validators/types/index.js +0 -5
- package/cjs/validators/utils/afm/index.js +0 -38
- package/cjs/validators/utils/file/index.js +0 -43
- package/cjs/validators/utils/iban/index.js +0 -123
- package/cjs/validators/utils/image/index.js +0 -126
- package/cjs/validators/utils/index.js +0 -204
- package/cjs/validators/utils/int/index.js +0 -26
- package/cjs/validators/utils/number/index.js +0 -22
- package/cjs/validators/utils/otp/index.js +0 -32
- package/cjs/validators/utils/phone/index.js +0 -143
- package/cjs/validators/utils/postal_code/index.js +0 -34
- package/cjs/validators/utils/text_limit/index.js +0 -54
- package/cjs/validators/utils/uuid4/index.js +0 -25
- package/cjs/validators/validators.spec/index.js +0 -87
- package/create-simple-form.mdx +0 -539
- package/index.mdx +0 -51
- package/inputs/AutoCompleteInput/AutoComplete.stories/index.js +0 -8
- package/inputs/AutoCompleteInput/AutoComplete.stories/package.json +0 -6
- package/inputs/AutoCompleteInput/AutoComplete.stories.d.ts +0 -9
- package/inputs/AutoCompleteInput/__stories__/Default/index.js +0 -44
- package/inputs/AutoCompleteInput/__stories__/Default/package.json +0 -6
- package/inputs/AutoCompleteInput/__stories__/Default.d.ts +0 -3
- package/inputs/AutoCompleteInput/__stories__/Multiple/index.js +0 -45
- package/inputs/AutoCompleteInput/__stories__/Multiple/package.json +0 -6
- package/inputs/AutoCompleteInput/__stories__/Multiple.d.ts +0 -3
- package/inputs/AutoCompleteInput/index.mdx +0 -29
- package/inputs/AutoCompleteInput/package.json +0 -6
- package/inputs/Checkboxes/Checkboxes.stories/index.js +0 -9
- package/inputs/Checkboxes/Checkboxes.stories/package.json +0 -6
- package/inputs/Checkboxes/Checkboxes.stories.d.ts +0 -10
- package/inputs/Checkboxes/Checkboxes.stories.playwright.json +0 -85
- package/inputs/Checkboxes/__stories__/Conditional/index.js +0 -93
- package/inputs/Checkboxes/__stories__/Conditional/package.json +0 -6
- package/inputs/Checkboxes/__stories__/Conditional.d.ts +0 -3
- package/inputs/Checkboxes/__stories__/Default/index.js +0 -40
- package/inputs/Checkboxes/__stories__/Default/package.json +0 -6
- package/inputs/Checkboxes/__stories__/Default.d.ts +0 -3
- package/inputs/Checkboxes/__stories__/WithDivider/index.js +0 -41
- package/inputs/Checkboxes/__stories__/WithDivider/package.json +0 -6
- package/inputs/Checkboxes/__stories__/WithDivider.d.ts +0 -3
- package/inputs/Checkboxes/index.mdx +0 -33
- package/inputs/Checkboxes/package.json +0 -6
- package/inputs/DateInput/DateInput.stories/index.js +0 -7
- package/inputs/DateInput/DateInput.stories/package.json +0 -6
- package/inputs/DateInput/DateInput.stories.d.ts +0 -8
- package/inputs/DateInput/DateInput.stories.playwright.json +0 -72
- package/inputs/DateInput/__stories__/Default/index.js +0 -23
- package/inputs/DateInput/__stories__/Default/package.json +0 -6
- package/inputs/DateInput/__stories__/Default.d.ts +0 -3
- package/inputs/DateInput/index.mdx +0 -23
- package/inputs/DateInput/package.json +0 -6
- package/inputs/FileInput/FileInput.stories/index.js +0 -7
- package/inputs/FileInput/FileInput.stories/package.json +0 -6
- package/inputs/FileInput/FileInput.stories.d.ts +0 -8
- package/inputs/FileInput/FileInput.stories.playwright.json +0 -75
- package/inputs/FileInput/__stories__/Default/index.js +0 -20
- package/inputs/FileInput/__stories__/Default/package.json +0 -6
- package/inputs/FileInput/__stories__/Default.d.ts +0 -3
- package/inputs/FileInput/package.json +0 -6
- package/inputs/ImageInput/ImageInput.stories/index.js +0 -9
- package/inputs/ImageInput/ImageInput.stories/package.json +0 -6
- package/inputs/ImageInput/ImageInput.stories.d.ts +0 -10
- package/inputs/ImageInput/ImageInput.stories.playwright.json +0 -77
- package/inputs/ImageInput/__stories__/Default/index.js +0 -28
- package/inputs/ImageInput/__stories__/Default/package.json +0 -6
- package/inputs/ImageInput/__stories__/Default.d.ts +0 -3
- package/inputs/ImageInput/__stories__/WithInvalidImageDimension/index.js +0 -36
- package/inputs/ImageInput/__stories__/WithInvalidImageDimension/package.json +0 -6
- package/inputs/ImageInput/__stories__/WithInvalidImageDimension.d.ts +0 -3
- package/inputs/ImageInput/__stories__/WithInvalidImageSize/index.js +0 -33
- package/inputs/ImageInput/__stories__/WithInvalidImageSize/package.json +0 -6
- package/inputs/ImageInput/__stories__/WithInvalidImageSize.d.ts +0 -3
- package/inputs/ImageInput/index.mdx +0 -19
- package/inputs/ImageInput/package.json +0 -6
- package/inputs/Input/Input.stories/index.js +0 -16
- package/inputs/Input/Input.stories/package.json +0 -6
- package/inputs/Input/Input.stories.d.ts +0 -17
- package/inputs/Input/Input.stories.playwright.json +0 -376
- package/inputs/Input/__stories__/AFM/index.js +0 -22
- package/inputs/Input/__stories__/AFM/package.json +0 -6
- package/inputs/Input/__stories__/AFM.d.ts +0 -3
- package/inputs/Input/__stories__/Boolean/index.js +0 -23
- package/inputs/Input/__stories__/Boolean/package.json +0 -6
- package/inputs/Input/__stories__/Boolean.d.ts +0 -3
- package/inputs/Input/__stories__/Default/index.js +0 -23
- package/inputs/Input/__stories__/Default/package.json +0 -6
- package/inputs/Input/__stories__/Default.d.ts +0 -3
- package/inputs/Input/__stories__/IBAN/index.js +0 -23
- package/inputs/Input/__stories__/IBAN/package.json +0 -6
- package/inputs/Input/__stories__/IBAN.d.ts +0 -3
- package/inputs/Input/__stories__/Integer/index.js +0 -31
- package/inputs/Input/__stories__/Integer/package.json +0 -6
- package/inputs/Input/__stories__/Integer.d.ts +0 -3
- package/inputs/Input/__stories__/LandlineNumber/index.js +0 -26
- package/inputs/Input/__stories__/LandlineNumber/package.json +0 -6
- package/inputs/Input/__stories__/LandlineNumber.d.ts +0 -3
- package/inputs/Input/__stories__/MobilePhone/index.js +0 -26
- package/inputs/Input/__stories__/MobilePhone/package.json +0 -6
- package/inputs/Input/__stories__/MobilePhone.d.ts +0 -3
- package/inputs/Input/__stories__/PhoneNumber/index.js +0 -25
- package/inputs/Input/__stories__/PhoneNumber/package.json +0 -6
- package/inputs/Input/__stories__/PhoneNumber.d.ts +0 -3
- package/inputs/Input/__stories__/PostalCode/index.js +0 -25
- package/inputs/Input/__stories__/PostalCode/package.json +0 -6
- package/inputs/Input/__stories__/PostalCode.d.ts +0 -3
- package/inputs/Input/__stories__/TextWithCharacterLimit/index.js +0 -29
- package/inputs/Input/__stories__/TextWithCharacterLimit/package.json +0 -6
- package/inputs/Input/__stories__/TextWithCharacterLimit.d.ts +0 -3
- package/inputs/Input/index.mdx +0 -95
- package/inputs/Input/package.json +0 -6
- package/inputs/Label/Label.stories/index.js +0 -7
- package/inputs/Label/Label.stories/package.json +0 -6
- package/inputs/Label/Label.stories.d.ts +0 -8
- package/inputs/Label/Label.stories.playwright.json +0 -40
- package/inputs/Label/__stories__/Default/index.js +0 -27
- package/inputs/Label/__stories__/Default/package.json +0 -6
- package/inputs/Label/__stories__/Default.d.ts +0 -3
- package/inputs/Label/package.json +0 -6
- package/inputs/OtpInput/OtpInput.stories/index.js +0 -7
- package/inputs/OtpInput/OtpInput.stories/package.json +0 -6
- package/inputs/OtpInput/OtpInput.stories.d.ts +0 -8
- package/inputs/OtpInput/__stories__/Default/index.js +0 -29
- package/inputs/OtpInput/__stories__/Default/package.json +0 -6
- package/inputs/OtpInput/__stories__/Default.d.ts +0 -3
- package/inputs/OtpInput/index.mdx +0 -23
- package/inputs/OtpInput/package.json +0 -6
- package/inputs/Radio/Radio.stories/index.js +0 -9
- package/inputs/Radio/Radio.stories/package.json +0 -6
- package/inputs/Radio/Radio.stories.d.ts +0 -10
- package/inputs/Radio/Radio.stories.playwright.json +0 -73
- package/inputs/Radio/__stories__/Conditional/index.js +0 -93
- package/inputs/Radio/__stories__/Conditional/package.json +0 -6
- package/inputs/Radio/__stories__/Conditional.d.ts +0 -3
- package/inputs/Radio/__stories__/Default/index.js +0 -45
- package/inputs/Radio/__stories__/Default/package.json +0 -6
- package/inputs/Radio/__stories__/Default.d.ts +0 -3
- package/inputs/Radio/__stories__/WithDivider/index.js +0 -46
- package/inputs/Radio/__stories__/WithDivider/package.json +0 -6
- package/inputs/Radio/__stories__/WithDivider.d.ts +0 -3
- package/inputs/Radio/index.mdx +0 -33
- package/inputs/Radio/package.json +0 -6
- package/inputs/Select/Select.stories/index.js +0 -7
- package/inputs/Select/Select.stories/package.json +0 -6
- package/inputs/Select/Select.stories.d.ts +0 -8
- package/inputs/Select/Select.stories.playwright.json +0 -22
- package/inputs/Select/__stories__/Default/index.js +0 -51
- package/inputs/Select/__stories__/Default/package.json +0 -6
- package/inputs/Select/__stories__/Default.d.ts +0 -3
- package/inputs/Select/index.mdx +0 -17
- package/inputs/Select/package.json +0 -6
- package/inputs/package.json +0 -6
- package/installation.mdx +0 -68
- package/internal/index.js +0 -34
- package/internal/package.json +0 -6
- package/lazy/index.js +0 -395
- package/lazy/package.json +0 -6
- package/registry/index.js +0 -138
- package/registry/package.json +0 -6
- package/src/Field/index.mdx +0 -6
- package/src/Field/utils.ts +0 -191
- package/src/FieldArray/FieldArray.stories.playwright.json +0 -353
- package/src/FormBuilder/FormBuilder.stories.playwright.json +0 -52
- package/src/FormBuilder/FormBuilder.tsx +0 -166
- package/src/MultiplicityField/MultiplicityField.mdx +0 -590
- package/src/MultiplicityField/MultiplicityField.stories.playwright.json +0 -1370
- package/src/Questions/index.mdx +0 -415
- package/src/inputs/AutoCompleteInput/index.mdx +0 -29
- package/src/inputs/Checkboxes/Checkboxes.stories.playwright.json +0 -85
- package/src/inputs/DateInput/DateInput.stories.playwright.json +0 -72
- package/src/inputs/FileInput/FileInput.stories.playwright.json +0 -75
- package/src/inputs/FileInput/index.mdx +0 -19
- package/src/inputs/ImageInput/ImageInput.stories.playwright.json +0 -77
- package/src/inputs/ImageInput/index.mdx +0 -19
- package/src/inputs/Input/Input.stories.playwright.json +0 -376
- package/src/inputs/Input/index.mdx +0 -95
- package/src/inputs/Label/Label.stories.playwright.json +0 -40
- package/src/inputs/OtpInput/index.mdx +0 -23
- package/src/inputs/Radio/Radio.stories.playwright.json +0 -73
- package/src/inputs/Radio/index.mdx +0 -33
- package/src/inputs/Select/Select.stories.playwright.json +0 -22
- package/src/lazy.js +0 -60
- package/src/registry.js +0 -145
- package/types/index.js +0 -1
- package/types/package.json +0 -6
- package/utils/index.js +0 -80
- package/utils/package.json +0 -6
- package/validators/package.json +0 -6
- package/validators/types/index.js +0 -1
- package/validators/types/package.json +0 -6
- package/validators/utils/afm/index.js +0 -31
- package/validators/utils/afm/package.json +0 -6
- package/validators/utils/file/index.js +0 -37
- package/validators/utils/file/package.json +0 -6
- package/validators/utils/iban/index.js +0 -116
- package/validators/utils/iban/package.json +0 -6
- package/validators/utils/image/index.js +0 -119
- package/validators/utils/image/package.json +0 -6
- package/validators/utils/int/index.js +0 -19
- package/validators/utils/int/package.json +0 -6
- package/validators/utils/number/index.js +0 -15
- package/validators/utils/number/package.json +0 -6
- package/validators/utils/otp/index.js +0 -25
- package/validators/utils/otp/package.json +0 -6
- package/validators/utils/package.json +0 -6
- package/validators/utils/phone/index.js +0 -134
- package/validators/utils/phone/package.json +0 -6
- package/validators/utils/postal_code/index.js +0 -27
- package/validators/utils/postal_code/package.json +0 -6
- package/validators/utils/text_limit/index.js +0 -47
- package/validators/utils/text_limit/package.json +0 -6
- package/validators/utils/uuid4/index.js +0 -18
- package/validators/utils/uuid4/package.json +0 -6
- package/validators/validators.spec/index.js +0 -85
- package/validators/validators.spec/package.json +0 -6
- package/validators/validators.spec.d.ts +0 -1
- /package/{cjs/inputs/Label/index.mdx → Field/types.js} +0 -0
- /package/{inputs/Label/index.mdx → Fieldset/types.js} +0 -0
- /package/{src/inputs/Label/index.mdx → MultiplicityField/types.js} +0 -0
package/Field/types.d.ts
CHANGED
|
@@ -1,11 +1,51 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ErrorOption, UseFormReturn } from 'react-hook-form';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { ErrorOption, UseFormReturn, UseFormProps } from 'react-hook-form';
|
|
3
|
+
import type { FieldComponentRegistry } from '../inputs/registry.js';
|
|
4
|
+
import type { registerFieldFocus } from '../types.js';
|
|
5
|
+
import type { ValidatorSchema } from '../validators/types.js';
|
|
6
|
+
import type { FieldsetLegendProps } from '@digigov/ui/form/FieldContainer';
|
|
7
|
+
import type { GridProps } from '@digigov/ui/layouts/Grid';
|
|
8
|
+
export interface FieldLabelProps {
|
|
9
|
+
primary?: string;
|
|
10
|
+
secondary?: string;
|
|
11
|
+
hint?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface FieldSpec {
|
|
14
|
+
key: string;
|
|
15
|
+
type?: 'int' | 'string' | 'text' | 'boolean' | 'email' | 'uuid4' | 'choice:multiple' | 'choice:single' | 'mobile_phone' | 'date' | 'datetime' | 'otp' | 'afm' | 'amka' | 'iban' | 'file' | 'rate' | 'image' | 'postal_code' | 'phone_number' | 'array' | 'object';
|
|
16
|
+
trim?: boolean;
|
|
17
|
+
component?: any;
|
|
18
|
+
autoComplete?: string;
|
|
19
|
+
placeholder?: string;
|
|
20
|
+
maxLength?: number;
|
|
21
|
+
condition?: Record<string, FieldCondition>;
|
|
22
|
+
controlled?: boolean;
|
|
23
|
+
label?: FieldLabelProps;
|
|
24
|
+
extra?: Record<string, any>;
|
|
25
|
+
editable?: boolean;
|
|
26
|
+
variant?: 'inline' | 'dialog';
|
|
27
|
+
required?: boolean;
|
|
28
|
+
enabled?: boolean;
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
layout?: Record<string, GridProps['xs'] | GridProps['sm'] | GridProps['md'] | GridProps['lg'] | GridProps['xl']>;
|
|
31
|
+
validators?: ValidatorSchema[];
|
|
32
|
+
wrapper?: 'label' | 'fieldset';
|
|
33
|
+
maxWidth?: string;
|
|
34
|
+
maxHeight?: string;
|
|
35
|
+
width?: string;
|
|
36
|
+
min?: number;
|
|
37
|
+
max?: number;
|
|
38
|
+
}
|
|
39
|
+
export interface FieldCondition {
|
|
40
|
+
is: string | string[] | number | number[] | boolean | boolean[];
|
|
41
|
+
then?: Partial<FieldSpec>;
|
|
42
|
+
else?: Partial<FieldSpec>;
|
|
43
|
+
}
|
|
5
44
|
export interface ChildFieldMemoProps extends FieldConditionalProps {
|
|
6
45
|
dependencies: FormData;
|
|
7
46
|
}
|
|
8
|
-
export
|
|
47
|
+
export type FormData = UseFormProps['defaultValues'];
|
|
48
|
+
export interface FieldWithCondition extends Omit<ResolvedField, 'condition'> {
|
|
9
49
|
condition: Record<string, FieldCondition>;
|
|
10
50
|
}
|
|
11
51
|
export interface FieldConditionalProps {
|
|
@@ -13,23 +53,27 @@ export interface FieldConditionalProps {
|
|
|
13
53
|
control: UseFormReturn['control'];
|
|
14
54
|
register: UseFormReturn['register'];
|
|
15
55
|
reset: UseFormReturn['reset'];
|
|
56
|
+
resetField?: UseFormReturn['resetField'];
|
|
16
57
|
error?: ErrorOption;
|
|
58
|
+
Field: React.FC<FieldProps>;
|
|
17
59
|
}
|
|
18
|
-
export
|
|
60
|
+
export interface FieldComponentItem {
|
|
19
61
|
component: any;
|
|
20
62
|
controlled?: boolean;
|
|
21
63
|
wrapper?: FieldSpec['wrapper'];
|
|
22
|
-
}
|
|
64
|
+
}
|
|
23
65
|
export interface FieldContainerProps {
|
|
24
66
|
name?: FieldSpec['key'];
|
|
67
|
+
register: FieldBaseProps['register'];
|
|
25
68
|
layout?: FieldSpec['layout'];
|
|
26
69
|
label?: FieldSpec['label'];
|
|
27
70
|
error?: ErrorOption | Record<string, any>;
|
|
71
|
+
hasError?: boolean;
|
|
28
72
|
children?: React.ReactNode;
|
|
73
|
+
controlled?: boolean;
|
|
29
74
|
wrapper?: FieldSpec['wrapper'];
|
|
75
|
+
labelSize?: FieldsetLegendProps['size'];
|
|
30
76
|
}
|
|
31
|
-
export type FieldComponentRegistry = Record<string, FieldComponentItem>;
|
|
32
|
-
export type OmittedFieldSpec = Omit<FieldSpec, 'component'>;
|
|
33
77
|
export type UnknownValue = never | never[];
|
|
34
78
|
export interface ControlledFieldProps {
|
|
35
79
|
type?: string;
|
|
@@ -41,6 +85,7 @@ export interface ControlledFieldProps {
|
|
|
41
85
|
error?: boolean;
|
|
42
86
|
name?: string;
|
|
43
87
|
disabled?: boolean;
|
|
88
|
+
Field?: React.FC<FieldProps>;
|
|
44
89
|
}
|
|
45
90
|
export interface UncontrolledFieldProps {
|
|
46
91
|
name: string;
|
|
@@ -50,8 +95,9 @@ export interface UncontrolledFieldProps {
|
|
|
50
95
|
extra?: Record<string, never>;
|
|
51
96
|
type?: string;
|
|
52
97
|
disabled?: boolean;
|
|
98
|
+
Field: React.FC<FieldProps>;
|
|
53
99
|
}
|
|
54
|
-
export interface
|
|
100
|
+
export interface ResolvedField extends Omit<FieldSpec, 'component'> {
|
|
55
101
|
name: string;
|
|
56
102
|
component: any;
|
|
57
103
|
defaultValue?: never;
|
|
@@ -59,10 +105,12 @@ export interface CalculatedField extends OmittedFieldSpec {
|
|
|
59
105
|
wrapper?: FieldComponentItem['wrapper'];
|
|
60
106
|
multiplicity?: boolean;
|
|
61
107
|
}
|
|
62
|
-
export interface FieldBaseProps extends
|
|
108
|
+
export interface FieldBaseProps extends ResolvedField {
|
|
63
109
|
control: UseFormReturn['control'];
|
|
64
110
|
register: UseFormReturn['register'];
|
|
65
111
|
reset: UseFormReturn['reset'];
|
|
112
|
+
resetField?: UseFormReturn['resetField'];
|
|
113
|
+
Field?: React.FC<FieldProps>;
|
|
66
114
|
}
|
|
67
115
|
export interface FieldProps extends FieldSpec {
|
|
68
116
|
name: string;
|
|
@@ -73,6 +121,7 @@ export interface UseFieldProps {
|
|
|
73
121
|
control: FieldBaseProps['control'];
|
|
74
122
|
register: FieldBaseProps['register'];
|
|
75
123
|
reset: FieldBaseProps['reset'];
|
|
124
|
+
resetField: FieldBaseProps['resetField'];
|
|
76
125
|
watch: UseFormReturn['watch'];
|
|
77
126
|
formState: UseFormReturn['formState'];
|
|
78
127
|
getFieldState: UseFormReturn['getFieldState'];
|
|
@@ -82,5 +131,6 @@ export interface UseFieldProps {
|
|
|
82
131
|
trigger: UseFormReturn['trigger'];
|
|
83
132
|
clearErrors: UseFormReturn['clearErrors'];
|
|
84
133
|
error?: ErrorOption;
|
|
134
|
+
registerFieldFocus: registerFieldFocus;
|
|
85
135
|
componentRegistry?: FieldComponentRegistry;
|
|
86
136
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
function evaluateFieldWithConditions(field, variables) {
|
|
2
|
+
const newField = {
|
|
3
|
+
...field
|
|
4
|
+
};
|
|
5
|
+
if (variables) {
|
|
6
|
+
for(const key in variables)if (field.condition[key] && field.condition[key].is) {
|
|
7
|
+
const is = field.condition[key].is;
|
|
8
|
+
if (is === variables[key] || Array.isArray(variables[key]) && variables[key].includes(is)) {
|
|
9
|
+
const then = field.condition[key].then || {};
|
|
10
|
+
for(const attr in then)newField[attr] = then[attr];
|
|
11
|
+
}
|
|
12
|
+
} else if (field.condition[key]) {
|
|
13
|
+
const otherwise = field.condition[key].else || {};
|
|
14
|
+
for(const attr in otherwise)newField[attr] = otherwise[attr];
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return newField;
|
|
18
|
+
}
|
|
19
|
+
export { evaluateFieldWithConditions };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { FieldProps, FieldSpec, ResolvedField } from '../types.js';
|
|
2
|
+
import { type FieldComponentRegistry } from '../../inputs/registry.js';
|
|
3
|
+
export declare function resolveField(children: FieldProps['children'], field: FieldSpec, customComponentRegistry?: FieldComponentRegistry): ResolvedField;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ALTERNATIVE_COMPONENTS, FIELD_COMPONENTS } from "../../inputs/registry.js";
|
|
2
|
+
function resolveField(children, field, customComponentRegistry) {
|
|
3
|
+
const fieldComponentRegistry = {
|
|
4
|
+
...FIELD_COMPONENTS,
|
|
5
|
+
...customComponentRegistry ?? {}
|
|
6
|
+
};
|
|
7
|
+
const resolvedField = {
|
|
8
|
+
...field
|
|
9
|
+
};
|
|
10
|
+
if (children) {
|
|
11
|
+
resolvedField.component = children;
|
|
12
|
+
resolvedField.controlled = true;
|
|
13
|
+
} else if ('function' == typeof field.component) ;
|
|
14
|
+
else if (field.component || field.type) if ('string' == typeof field?.extra?.component && ALTERNATIVE_COMPONENTS[field.extra.component]) {
|
|
15
|
+
resolvedField.controlled = ALTERNATIVE_COMPONENTS[field.extra.component]?.controlled || false;
|
|
16
|
+
resolvedField.component = ALTERNATIVE_COMPONENTS[field.extra.component].component;
|
|
17
|
+
resolvedField.wrapper = ALTERNATIVE_COMPONENTS[field.extra.component].wrapper;
|
|
18
|
+
} else if (!field.component && field.type && fieldComponentRegistry[field.type]) {
|
|
19
|
+
resolvedField.component = fieldComponentRegistry[field.type].component;
|
|
20
|
+
resolvedField.wrapper = fieldComponentRegistry[field.type].wrapper;
|
|
21
|
+
resolvedField.controlled = fieldComponentRegistry[field.type]?.controlled || false;
|
|
22
|
+
} else {
|
|
23
|
+
resolvedField.component = fieldComponentRegistry.string.component;
|
|
24
|
+
resolvedField.controlled = fieldComponentRegistry.string?.controlled || false;
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
resolvedField.component = fieldComponentRegistry.string.component;
|
|
28
|
+
resolvedField.controlled = fieldComponentRegistry.string?.controlled || false;
|
|
29
|
+
}
|
|
30
|
+
return resolvedField;
|
|
31
|
+
}
|
|
32
|
+
export { resolveField };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { useContext, useMemo } from "react";
|
|
2
|
+
import { FormContext } from "../../FormContext.js";
|
|
3
|
+
const useField = (name, customField)=>{
|
|
4
|
+
const { fieldsMap, control, register, reset, resetField, trigger, clearErrors, errors, registerField, watch, componentRegistry, getFieldState, setValue, getValues, unregister, formState, registerFieldFocus } = useContext(FormContext);
|
|
5
|
+
if (!registerField) throw new Error(`
|
|
6
|
+
You can't use the Field component without wrapping it in FormBuilder.
|
|
7
|
+
https://devs.pages.grnet.gr/digigov/digigov-sdk/sdk-docs/forms/create-simple-form/
|
|
8
|
+
`);
|
|
9
|
+
let error = errors[name];
|
|
10
|
+
const nameIndexRegex = name.match(/^\[*(.*?)\.(\d+)\]*$/);
|
|
11
|
+
if (nameIndexRegex) {
|
|
12
|
+
const [, fieldArrayName, indexStr] = nameIndexRegex;
|
|
13
|
+
error = errors[fieldArrayName]?.[Number(indexStr)];
|
|
14
|
+
}
|
|
15
|
+
const nestedNameIndexRegex = name.match(/^\[*(.*?)\.(\d+)\.(.*?)\]*$/);
|
|
16
|
+
if (nestedNameIndexRegex) {
|
|
17
|
+
const [, fieldArrayName, indexStr, fieldItemName] = nestedNameIndexRegex;
|
|
18
|
+
error = errors[fieldArrayName]?.[Number(indexStr)]?.[fieldItemName];
|
|
19
|
+
}
|
|
20
|
+
useMemo(()=>customField?.type && registerField({
|
|
21
|
+
...customField,
|
|
22
|
+
key: name
|
|
23
|
+
}), [
|
|
24
|
+
customField,
|
|
25
|
+
name,
|
|
26
|
+
registerField
|
|
27
|
+
]);
|
|
28
|
+
return {
|
|
29
|
+
field: customField || fieldsMap[name],
|
|
30
|
+
control,
|
|
31
|
+
register,
|
|
32
|
+
reset,
|
|
33
|
+
resetField,
|
|
34
|
+
trigger,
|
|
35
|
+
watch,
|
|
36
|
+
componentRegistry,
|
|
37
|
+
getFieldState,
|
|
38
|
+
setValue,
|
|
39
|
+
clearErrors,
|
|
40
|
+
getValues,
|
|
41
|
+
unregister,
|
|
42
|
+
formState,
|
|
43
|
+
error,
|
|
44
|
+
registerFieldFocus
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
export { useField };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { FieldArrayProps } from './index.js';
|
|
3
|
+
type BaseFieldArrayProps = Omit<FieldArrayProps, 'registerFieldFocus' | 'trigger' | 'clearErrors' | 'setValue' | 'reset' | 'resetField'>;
|
|
4
|
+
export declare const BaseFieldArray: React.ForwardRefExoticComponent<BaseFieldArrayProps & React.RefAttributes<HTMLButtonElement>>;
|
|
5
|
+
export default BaseFieldArray;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import react from "react";
|
|
2
|
+
import { useFieldArray } from "react-hook-form";
|
|
3
|
+
import { FieldObject } from "../FieldObject/index.js";
|
|
4
|
+
import { Fieldset, FieldsetLabel } from "../Fieldset/index.js";
|
|
5
|
+
import { Card } from "@digigov/ui/content/Card/index.js";
|
|
6
|
+
import { Button } from "@digigov/ui/form/Button/index.js";
|
|
7
|
+
const BaseFieldArray_BaseFieldArray = /*#__PURE__*/ react.forwardRef(({ name, register, control, formState, error, getValues, Field, ...customField }, ref)=>{
|
|
8
|
+
const { append, remove } = useFieldArray({
|
|
9
|
+
control,
|
|
10
|
+
name
|
|
11
|
+
});
|
|
12
|
+
const fields = getValues(name) || [];
|
|
13
|
+
return /*#__PURE__*/ react.createElement(react.Fragment, null, fields.map((field, index)=>/*#__PURE__*/ react.createElement(Card, {
|
|
14
|
+
variant: customField.extra?.border ? 'border' : 'divider',
|
|
15
|
+
key: field.id || index
|
|
16
|
+
}, /*#__PURE__*/ react.createElement(Fieldset, null, /*#__PURE__*/ react.createElement(FieldsetLabel, null, `${customField.extra?.label.object.title}${!customField.extra?.noIndex ? ' ' + String(index + 1) : ''}`), /*#__PURE__*/ react.createElement(FieldObject, {
|
|
17
|
+
name: `${name}.${index}`,
|
|
18
|
+
error: Array.isArray(error) && error[index],
|
|
19
|
+
formState: formState,
|
|
20
|
+
register: register,
|
|
21
|
+
control: control,
|
|
22
|
+
...customField.extra?.of,
|
|
23
|
+
Field: Field
|
|
24
|
+
}), /*#__PURE__*/ react.createElement(Button, {
|
|
25
|
+
name: `${name}-object-remove`,
|
|
26
|
+
variant: customField.extra?.label.object?.deleteButtonVariant,
|
|
27
|
+
type: "button",
|
|
28
|
+
color: "warning",
|
|
29
|
+
onClick: ()=>remove(index),
|
|
30
|
+
disabled: !customField?.editable
|
|
31
|
+
}, customField.extra?.label.object?.delete)))), customField.editable && /*#__PURE__*/ react.createElement(Button, {
|
|
32
|
+
ref: ref,
|
|
33
|
+
type: "button",
|
|
34
|
+
name: `${name}-add-object`,
|
|
35
|
+
color: "secondary",
|
|
36
|
+
variant: customField.extra?.label.object?.addButtonVariant,
|
|
37
|
+
onClick: (ev)=>{
|
|
38
|
+
ev.preventDefault();
|
|
39
|
+
append({});
|
|
40
|
+
},
|
|
41
|
+
disabled: !customField?.editable
|
|
42
|
+
}, customField.extra?.label.object?.add));
|
|
43
|
+
});
|
|
44
|
+
BaseFieldArray_BaseFieldArray.displayName = 'BaseFieldArray';
|
|
45
|
+
const BaseFieldArray = BaseFieldArray_BaseFieldArray;
|
|
46
|
+
export { BaseFieldArray_BaseFieldArray as BaseFieldArray, BaseFieldArray as default };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface ArrayContainerDisplayProps {
|
|
3
|
+
fieldArrayValues: any[];
|
|
4
|
+
ofField: any;
|
|
5
|
+
customField: any;
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export declare const ArrayContainerDisplay: ({ fieldArrayValues, ofField, customField, children, }: ArrayContainerDisplayProps) => React.JSX.Element;
|
|
9
|
+
export default ArrayContainerDisplay;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import react from "react";
|
|
2
|
+
import { ArrayItemHeader } from "./ArrayItemHeader.js";
|
|
3
|
+
import { Table, TableBody, TableContainer } from "@digigov/ui/content/index.js";
|
|
4
|
+
const ArrayContainerDisplay = ({ fieldArrayValues, ofField, customField, children })=>/*#__PURE__*/ react.createElement(react.Fragment, null, customField?.extra?.layout === 'card' ? children : /*#__PURE__*/ react.createElement(TableContainer, customField.extra?.tableContainer, /*#__PURE__*/ react.createElement(Table, {
|
|
5
|
+
verticalAlign: customField.extra?.verticalAlign
|
|
6
|
+
}, !customField.extra?.noHeader && ofField?.extra && fieldArrayValues?.length > 0 && /*#__PURE__*/ react.createElement(ArrayItemHeader, {
|
|
7
|
+
labels: 'object' === ofField.type ? ofField.extra.fields.map(({ label })=>label.primary) : [
|
|
8
|
+
ofField.label.primary
|
|
9
|
+
],
|
|
10
|
+
disabled: customField?.editable === false
|
|
11
|
+
}), /*#__PURE__*/ react.createElement(TableBody, null, children))));
|
|
12
|
+
const ArrayDisplay_ArrayContainerDisplay = ArrayContainerDisplay;
|
|
13
|
+
export { ArrayContainerDisplay, ArrayDisplay_ArrayContainerDisplay as default };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ErrorOption, UseFieldArrayMove } from 'react-hook-form';
|
|
3
|
+
import type { StackProps } from '@digigov/ui/layouts';
|
|
4
|
+
export interface ArrayItemDisplayProps {
|
|
5
|
+
data: any;
|
|
6
|
+
name: string;
|
|
7
|
+
edit: (name: string) => void;
|
|
8
|
+
remove: (name: string) => void;
|
|
9
|
+
disabledEdit?: boolean;
|
|
10
|
+
disabledDelete?: boolean;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
sortable: boolean;
|
|
13
|
+
index: number;
|
|
14
|
+
isFirst: boolean;
|
|
15
|
+
isLast: boolean;
|
|
16
|
+
move: UseFieldArrayMove;
|
|
17
|
+
valueDisplay?: (value: any) => React.ReactNode;
|
|
18
|
+
border: boolean;
|
|
19
|
+
wordBreak?: 'break-all' | 'none';
|
|
20
|
+
stackProps?: StackProps;
|
|
21
|
+
customField: any;
|
|
22
|
+
ofField: any;
|
|
23
|
+
fieldArrayValues: any[];
|
|
24
|
+
error?: Record<string, ErrorOption> | undefined;
|
|
25
|
+
}
|
|
26
|
+
export declare const ArrayItemDisplay: ({ name, data, edit, remove, disabledEdit, disabledDelete, disabled, sortable, index, isFirst, isLast, move, valueDisplay, border, wordBreak, stackProps, customField, ofField, fieldArrayValues, error, }: ArrayItemDisplayProps) => React.JSX.Element | null;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import react from "react";
|
|
2
|
+
import { omit } from "../../../utils.js";
|
|
3
|
+
import { ErrorMessage } from "@digigov/ui/index.js";
|
|
4
|
+
import { Card, SummaryList, SummaryListItem, SummaryListItemKey, SummaryListItemValue, TableDataCell, TableRow } from "@digigov/ui/content/index.js";
|
|
5
|
+
import { Button, ButtonGroup } from "@digigov/ui/form/Button/index.js";
|
|
6
|
+
import { Grid, SectionBreak, Stack } from "@digigov/ui/layouts/index.js";
|
|
7
|
+
import Heading from "@digigov/ui/typography/Heading/index.js";
|
|
8
|
+
import { NormalText } from "@digigov/ui/typography/NormalText/index.js";
|
|
9
|
+
const getFieldKey = (ofField, valueIndex)=>ofField?.type === 'object' ? ofField?.extra?.fields?.[valueIndex]?.key : ofField?.key;
|
|
10
|
+
const getFieldValue = (value, valueIndex, ofField, valueDisplay)=>{
|
|
11
|
+
if (Array.isArray(value)) return value.join('\n');
|
|
12
|
+
if ('object' == typeof value) return value?.name;
|
|
13
|
+
if (valueDisplay) return valueDisplay(value);
|
|
14
|
+
const option = ofField?.extra?.fields?.[valueIndex]?.extra?.options?.find?.((option)=>option.value === value);
|
|
15
|
+
if (option) return option.label?.primary ?? value;
|
|
16
|
+
return value;
|
|
17
|
+
};
|
|
18
|
+
const ArrayItemDisplay = ({ name, data, edit, remove, disabledEdit, disabledDelete, disabled, sortable, index, isFirst, isLast, move, valueDisplay, border = true, wordBreak = 'break-all', stackProps = {
|
|
19
|
+
spacing: 4,
|
|
20
|
+
alignItems: 'flex-end',
|
|
21
|
+
justifyContent: 'flex-end',
|
|
22
|
+
direction: 'column'
|
|
23
|
+
}, customField, ofField, fieldArrayValues, error })=>{
|
|
24
|
+
console.log('error', error);
|
|
25
|
+
if (null == data) return null;
|
|
26
|
+
if (0 === Object.keys(data).length || 1 === Object.keys(data).length && data.id) return null;
|
|
27
|
+
const values = 'string' == typeof data ? [
|
|
28
|
+
data
|
|
29
|
+
] : Object.values(data ? omit(data, [
|
|
30
|
+
'id'
|
|
31
|
+
]) : {});
|
|
32
|
+
const borderVariant = false === border || sortable ? 'none' : 'border';
|
|
33
|
+
const hasItemButtons = !disabled && (!disabledEdit || !disabledDelete);
|
|
34
|
+
const fieldLabel = ofField?.type === 'object' ? ofField?.extra?.fields.reduce((acc, { key, label })=>({
|
|
35
|
+
...acc,
|
|
36
|
+
[key]: label.primary
|
|
37
|
+
}), {}) : ofField?.label?.primary;
|
|
38
|
+
return /*#__PURE__*/ react.createElement(react.Fragment, null, customField?.extra?.layout === 'card' ? /*#__PURE__*/ react.createElement(Card, {
|
|
39
|
+
borderColor: "light",
|
|
40
|
+
variant: "border",
|
|
41
|
+
dense: true,
|
|
42
|
+
...customField?.extra.cardContainer
|
|
43
|
+
}, sortable && /*#__PURE__*/ react.createElement(Heading, {
|
|
44
|
+
size: "sm"
|
|
45
|
+
}, "Επιλογή #", index + 1), /*#__PURE__*/ react.createElement(SummaryList, {
|
|
46
|
+
mb: 0,
|
|
47
|
+
noLastBorder: !hasItemButtons,
|
|
48
|
+
error: !!error
|
|
49
|
+
}, error && Object.keys(error).length > 0 && Object.entries(error).map(([fieldKey, fieldError])=>/*#__PURE__*/ react.createElement(ErrorMessage, {
|
|
50
|
+
key: fieldKey,
|
|
51
|
+
id: `${name}-error`
|
|
52
|
+
}, `${ofField?.type === 'object' && ofField?.extra?.fields ? `${fieldLabel[fieldKey] || fieldKey}: ` : ''}`, fieldError.message)), values?.map?.((value, valueIndex)=>{
|
|
53
|
+
const key = getFieldKey(ofField, valueIndex);
|
|
54
|
+
console.log('key', key);
|
|
55
|
+
const label = ofField?.type === 'object' ? fieldLabel[key] : fieldLabel;
|
|
56
|
+
console.log('label', label);
|
|
57
|
+
const fieldValue = getFieldValue(value, valueIndex, ofField, valueDisplay);
|
|
58
|
+
console.log('fieldValue', fieldValue);
|
|
59
|
+
const shouldShowKey = !customField?.extra?.noHeader && ofField?.extra && fieldArrayValues?.length > 0;
|
|
60
|
+
return /*#__PURE__*/ react.createElement(SummaryListItem, {
|
|
61
|
+
key: valueIndex
|
|
62
|
+
}, shouldShowKey && /*#__PURE__*/ react.createElement(SummaryListItemKey, {
|
|
63
|
+
error: !!error && Object.keys(error)?.includes(key)
|
|
64
|
+
}, label), /*#__PURE__*/ react.createElement(SummaryListItemValue, {
|
|
65
|
+
error: !shouldShowKey && !!error && Object.keys(error)?.includes(key)
|
|
66
|
+
}, fieldValue || ''));
|
|
67
|
+
})), true === disabled || true === disabledEdit && true === disabledDelete ? null : /*#__PURE__*/ react.createElement(ButtonGroup, {
|
|
68
|
+
mb: 0,
|
|
69
|
+
...customField?.extra?.cardButtonGroup
|
|
70
|
+
}, true !== disabledEdit && /*#__PURE__*/ react.createElement(Button, {
|
|
71
|
+
variant: "link",
|
|
72
|
+
type: "button",
|
|
73
|
+
onClick: ()=>{
|
|
74
|
+
edit(name);
|
|
75
|
+
}
|
|
76
|
+
}, "Επεξεργασία"), true !== disabledDelete && /*#__PURE__*/ react.createElement(Button, {
|
|
77
|
+
variant: "link",
|
|
78
|
+
type: "button",
|
|
79
|
+
onClick: ()=>remove(name)
|
|
80
|
+
}, "Διαγραφή")), sortable && /*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement(SectionBreak, null), sortable && !disabled && !(isFirst && isLast) && /*#__PURE__*/ react.createElement(NormalText, {
|
|
81
|
+
mb: 0
|
|
82
|
+
}, "Μετακίνηση", ' ', !isFirst && /*#__PURE__*/ react.createElement(react.Fragment, null, "προς τα", ' ', /*#__PURE__*/ react.createElement(Button, {
|
|
83
|
+
type: "button",
|
|
84
|
+
variant: "link",
|
|
85
|
+
onClick: ()=>move(index, index - 1)
|
|
86
|
+
}, "πάνω")), !isFirst && !isLast && ' ή ', !isLast && /*#__PURE__*/ react.createElement(react.Fragment, null, "προς τα", ' ', /*#__PURE__*/ react.createElement(Button, {
|
|
87
|
+
type: "button",
|
|
88
|
+
variant: "link",
|
|
89
|
+
onClick: ()=>move(index, index + 1)
|
|
90
|
+
}, "κάτω"))))) : /*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement(TableRow, null, values?.map?.((value, valueIndex)=>{
|
|
91
|
+
const fieldKey = getFieldKey(ofField, valueIndex);
|
|
92
|
+
console.log('fieldKey', fieldKey);
|
|
93
|
+
const fieldValue = getFieldValue(value, valueIndex, ofField, valueDisplay);
|
|
94
|
+
console.log('fieldValue', fieldValue);
|
|
95
|
+
return /*#__PURE__*/ react.createElement(TableDataCell, {
|
|
96
|
+
key: valueIndex,
|
|
97
|
+
variant: borderVariant,
|
|
98
|
+
wordBreak: wordBreak,
|
|
99
|
+
pb: sortable ? 0 : void 0,
|
|
100
|
+
pt: sortable ? 4 : void 0,
|
|
101
|
+
highlight: !!error && Object.keys(error)?.includes(fieldKey) ? 'error' : void 0
|
|
102
|
+
}, sortable && 0 === valueIndex && /*#__PURE__*/ react.createElement(Heading, {
|
|
103
|
+
size: "sm",
|
|
104
|
+
mb: 2
|
|
105
|
+
}, "Επιλογή #", index + 1), fieldValue || '');
|
|
106
|
+
}), true === disabled || true === disabledEdit && true === disabledDelete ? null : /*#__PURE__*/ react.createElement(TableDataCell, {
|
|
107
|
+
variant: borderVariant
|
|
108
|
+
}, /*#__PURE__*/ react.createElement(Stack, stackProps, true !== disabledEdit && /*#__PURE__*/ react.createElement(Button, {
|
|
109
|
+
variant: "link",
|
|
110
|
+
type: "button",
|
|
111
|
+
onClick: ()=>{
|
|
112
|
+
edit(name);
|
|
113
|
+
}
|
|
114
|
+
}, "Επεξεργασία"), true !== disabledDelete && /*#__PURE__*/ react.createElement(Button, {
|
|
115
|
+
variant: "link",
|
|
116
|
+
type: "button",
|
|
117
|
+
onClick: ()=>remove(name)
|
|
118
|
+
}, "Διαγραφή")))), sortable && /*#__PURE__*/ react.createElement(TableRow, null, /*#__PURE__*/ react.createElement(TableDataCell, {
|
|
119
|
+
variant: isLast ? 'none' : 'border',
|
|
120
|
+
colSpan: true === disabled || true === disabledEdit && true === disabledDelete ? values.length : values.length + 1
|
|
121
|
+
}, sortable && !disabled && !(isFirst && isLast) && /*#__PURE__*/ react.createElement(Grid, {
|
|
122
|
+
xs: 12,
|
|
123
|
+
mt: 2
|
|
124
|
+
}, "Μετακίνηση", ' ', !isFirst && /*#__PURE__*/ react.createElement(react.Fragment, null, "προς τα", ' ', /*#__PURE__*/ react.createElement(Button, {
|
|
125
|
+
type: "button",
|
|
126
|
+
variant: "link",
|
|
127
|
+
onClick: ()=>move(index, index - 1)
|
|
128
|
+
}, "πάνω")), !isFirst && !isLast && ' ή ', !isLast && /*#__PURE__*/ react.createElement(react.Fragment, null, "προς τα", ' ', /*#__PURE__*/ react.createElement(Button, {
|
|
129
|
+
type: "button",
|
|
130
|
+
variant: "link",
|
|
131
|
+
onClick: ()=>move(index, index + 1)
|
|
132
|
+
}, "κάτω")))))));
|
|
133
|
+
};
|
|
134
|
+
export { ArrayItemDisplay };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import react from "react";
|
|
2
|
+
import { TableHead, TableHeadCell, TableRow } from "@digigov/ui/content/index.js";
|
|
3
|
+
const ArrayItemHeader = ({ labels, disabled })=>/*#__PURE__*/ react.createElement(TableHead, null, /*#__PURE__*/ react.createElement(TableRow, null, labels.map((label, index)=>/*#__PURE__*/ react.createElement(TableHeadCell, {
|
|
4
|
+
key: index
|
|
5
|
+
}, label)), !disabled && /*#__PURE__*/ react.createElement(TableHeadCell, null, "Ενέργειες")));
|
|
6
|
+
export { ArrayItemHeader };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { UseFieldArrayMove } from 'react-hook-form';
|
|
3
|
+
export interface ArrayDisplayProps {
|
|
4
|
+
fieldArrayName: string;
|
|
5
|
+
fieldArrayValues: any[];
|
|
6
|
+
ofField: any;
|
|
7
|
+
customField: any;
|
|
8
|
+
onEdit: (index: number) => void;
|
|
9
|
+
onRemove: (index: number) => void;
|
|
10
|
+
move: UseFieldArrayMove;
|
|
11
|
+
sortable: boolean;
|
|
12
|
+
error?: any;
|
|
13
|
+
}
|
|
14
|
+
export declare const ArrayDisplay: ({ fieldArrayName, fieldArrayValues, ofField, customField, onEdit, onRemove, move, sortable, error, }: ArrayDisplayProps) => React.JSX.Element;
|
|
15
|
+
export default ArrayDisplay;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import react from "react";
|
|
2
|
+
import { ArrayContainerDisplay } from "./ArrayContainerDisplay.js";
|
|
3
|
+
import { ArrayItemDisplay } from "./ArrayItemDisplay.js";
|
|
4
|
+
const ArrayDisplay = ({ fieldArrayName, fieldArrayValues, ofField, customField, onEdit, onRemove, move, sortable, error })=>/*#__PURE__*/ react.createElement(ArrayContainerDisplay, {
|
|
5
|
+
fieldArrayValues: fieldArrayValues,
|
|
6
|
+
ofField: ofField,
|
|
7
|
+
customField: customField
|
|
8
|
+
}, fieldArrayValues?.map?.((field, index)=>/*#__PURE__*/ react.createElement(ArrayItemDisplay, {
|
|
9
|
+
error: error && error[index] ? error[index] : void 0,
|
|
10
|
+
key: index,
|
|
11
|
+
name: `${fieldArrayName}.${index}`,
|
|
12
|
+
index: index,
|
|
13
|
+
isFirst: 0 === index,
|
|
14
|
+
isLast: index === fieldArrayValues.length - 1,
|
|
15
|
+
data: field,
|
|
16
|
+
edit: ()=>onEdit(index),
|
|
17
|
+
stackProps: customField?.extra?.stackProps,
|
|
18
|
+
wordBreak: customField?.extra?.wordBreak,
|
|
19
|
+
valueDisplay: customField?.extra?.valueDisplay,
|
|
20
|
+
remove: ()=>onRemove(index),
|
|
21
|
+
border: customField.extra?.border,
|
|
22
|
+
move: move,
|
|
23
|
+
sortable: sortable,
|
|
24
|
+
disabledEdit: sortable ? true : customField.extra?.noEdit ?? false,
|
|
25
|
+
disabledDelete: customField.extra?.noDelete ?? false,
|
|
26
|
+
disabled: customField?.editable === false,
|
|
27
|
+
fieldArrayValues: fieldArrayValues,
|
|
28
|
+
ofField: ofField,
|
|
29
|
+
customField: customField
|
|
30
|
+
})));
|
|
31
|
+
const FormDialog_ArrayDisplay = ArrayDisplay;
|
|
32
|
+
export { ArrayDisplay, FormDialog_ArrayDisplay as default };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ErrorOption } from 'react-hook-form';
|
|
3
|
+
import type { FieldProps, FormData } from '../../Field/types.js';
|
|
4
|
+
import type { ModalProps } from '@digigov/ui/app/Modal';
|
|
5
|
+
export interface ArrayEditModalProps extends Omit<ModalProps, 'children'> {
|
|
6
|
+
type: 'append' | 'edit';
|
|
7
|
+
name: string;
|
|
8
|
+
title?: string;
|
|
9
|
+
hint?: string;
|
|
10
|
+
editOrAppend: (data: FormData) => void;
|
|
11
|
+
cancel: () => void;
|
|
12
|
+
addTitle?: string;
|
|
13
|
+
editLabel?: string;
|
|
14
|
+
editProps?: any;
|
|
15
|
+
appendLabel?: string;
|
|
16
|
+
appendProps?: any;
|
|
17
|
+
cancelLabel?: string;
|
|
18
|
+
cancelProps?: any;
|
|
19
|
+
ofField?: any;
|
|
20
|
+
defaultValue?: any;
|
|
21
|
+
Field: React.FC<FieldProps>;
|
|
22
|
+
error?: ErrorOption;
|
|
23
|
+
}
|
|
24
|
+
export declare const ArrayEditModal: React.ForwardRefExoticComponent<Omit<ArrayEditModalProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|