@digigov/form 2.0.0-254f7786 → 2.0.0-290ada95
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Field/ErrorGroup.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 -107
- package/Field/types.d.ts +27 -12
- package/Field/types.js +0 -0
- package/Field/utils/evaluateFieldWithConditions.d.ts +2 -2
- 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 +1 -1
- 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 +117 -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 +10 -2
- package/FieldArray/index.js +65 -74
- package/FieldObject/index.d.ts +8 -3
- package/FieldObject/index.js +51 -68
- package/Fieldset/FieldsetWithContext.js +27 -0
- package/Fieldset/index.d.ts +1 -1
- package/Fieldset/index.js +18 -30
- package/Fieldset/types.d.ts +2 -2
- package/Fieldset/types.js +0 -0
- package/FormBuilder/index.d.ts +2 -2
- package/FormBuilder/index.js +234 -153
- package/FormContext.d.ts +3 -2
- package/FormContext.js +7 -0
- package/MultiplicityField/add-objects.d.ts +2 -2
- package/MultiplicityField/add-objects.js +107 -0
- package/MultiplicityField/index.d.ts +2 -2
- package/MultiplicityField/index.js +81 -115
- package/MultiplicityField/types.d.ts +3 -2
- package/MultiplicityField/types.js +0 -0
- package/Questions/Questions.d.ts +1 -1
- package/Questions/Questions.js +48 -0
- package/Questions/QuestionsContext.d.ts +1 -1
- 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 -1
- 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 +1 -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 -11
- package/Questions/Step/index.js +13 -16
- package/Questions/Step/types.d.ts +1 -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 -7
- package/Questions/types.d.ts +1 -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 -5
- package/index.js +8 -13
- package/inputs/AutoCompleteInput/index.d.ts +3 -3
- package/inputs/AutoCompleteInput/index.js +39 -62
- package/inputs/Checkboxes/index.d.ts +5 -3
- package/inputs/Checkboxes/index.js +50 -76
- package/inputs/DateInput/index.d.ts +2 -5
- package/inputs/DateInput/index.js +125 -114
- 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 -45
- package/inputs/ImageInput/index.d.ts +10 -2
- package/inputs/ImageInput/index.js +85 -48
- package/inputs/Input/index.d.ts +5 -2
- package/inputs/Input/index.js +60 -61
- package/inputs/Label/index.d.ts +1 -1
- package/inputs/Label/index.js +13 -16
- package/inputs/OtpInput/index.d.ts +1 -5
- package/inputs/OtpInput/index.js +117 -140
- package/inputs/Radio/index.d.ts +6 -4
- package/inputs/Radio/index.js +71 -101
- package/inputs/Select/index.d.ts +6 -3
- package/inputs/Select/index.js +24 -26
- package/inputs/index.d.ts +9 -9
- package/inputs/index.js +10 -21
- package/{Field/utils/index.d.ts → inputs/registry.d.ts} +2 -1
- package/inputs/registry.js +80 -0
- package/internal.d.ts +5 -5
- package/internal.js +6 -0
- package/lazy.d.ts +97 -0
- package/lazy.js +163 -0
- package/package.json +12 -12
- package/registry.d.ts +82 -0
- package/registry.js +170 -0
- package/src/Field/ErrorGroup.tsx +84 -0
- package/src/Field/FieldBase.tsx +42 -26
- package/src/Field/FieldBaseContainer.tsx +69 -45
- package/src/Field/FieldConditional.tsx +5 -1
- package/src/Field/doc.mdx +202 -1
- package/src/Field/index.tsx +32 -37
- package/src/Field/types.tsx +30 -14
- package/src/Field/utils/evaluateFieldWithConditions.ts +5 -2
- package/src/Field/utils/resolveField.ts +58 -0
- package/src/Field/utils/useField.ts +17 -3
- package/src/FieldArray/BaseFieldArray.tsx +97 -0
- package/src/FieldArray/FieldArray.stories.js +2 -0
- 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 +337 -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 +124 -0
- package/src/FieldArray/__stories__/Default.tsx +2 -1
- package/src/FieldArray/__stories__/WithExactLength.tsx +2 -1
- package/src/FieldArray/__stories__/WithModal.tsx +160 -0
- package/src/FieldArray/__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 +25 -14
- package/src/FieldArray/index.tsx +78 -60
- package/src/FieldObject/index.tsx +43 -30
- package/src/Fieldset/FieldsetWithContext.tsx +1 -1
- package/src/Fieldset/index.tsx +1 -1
- package/src/Fieldset/types.tsx +2 -2
- package/src/FormBuilder/FormBuilder.stories.js +5 -0
- package/src/FormBuilder/__stories__/AutoErrorGrouping.tsx +63 -0
- package/src/FormBuilder/__stories__/Default.tsx +1 -1
- package/src/FormBuilder/__stories__/ErrorGrouping.tsx +43 -0
- package/src/FormBuilder/doc.mdx +10 -5
- package/src/FormBuilder/index.test.tsx +22 -11
- package/src/FormBuilder/index.tsx +226 -89
- package/src/FormBuilder/interaction.test.tsx +40 -0
- package/src/FormBuilder/scenarios.test.tsx +1042 -131
- package/src/FormContext.tsx +7 -2
- package/src/MultiplicityField/MultiplicityField.stories.js +3 -0
- package/src/MultiplicityField/__stories__/Default.tsx +1 -1
- package/src/MultiplicityField/__stories__/PreviewDisplay.tsx +2 -4
- package/src/MultiplicityField/__stories__/WithExactLength.tsx +1 -1
- package/src/MultiplicityField/__stories__/WithMaxLength.tsx +1 -1
- package/src/MultiplicityField/__stories__/WithMinAndMaxLength.tsx +1 -1
- package/src/MultiplicityField/__stories__/WithMinLength.tsx +1 -1
- package/src/MultiplicityField/add-objects.tsx +14 -21
- package/src/MultiplicityField/doc.mdx +101 -83
- package/src/MultiplicityField/index.test.tsx +29 -26
- package/src/MultiplicityField/index.tsx +7 -2
- package/src/MultiplicityField/types.ts +6 -2
- package/src/Questions/Questions.stories.js +3 -0
- package/src/Questions/Questions.tsx +2 -2
- package/src/Questions/QuestionsContext.tsx +1 -1
- package/src/Questions/Step/Step.tsx +1 -1
- package/src/Questions/Step/StepArrayReview.tsx +2 -2
- 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 +2 -1
- package/src/Questions/Step/getAddMoreFields.tsx +2 -2
- package/src/Questions/Step/types.tsx +1 -1
- package/src/Questions/__snapshots__/index.spec.tsx.snap +3 -1
- package/src/Questions/__stories__/Default.tsx +1 -1
- package/src/Questions/doc.mdx +21 -41
- package/src/Questions/getNextStep.tsx +1 -1
- package/src/Questions/index.spec.tsx +8 -0
- package/src/Questions/index.test.tsx +14 -11
- package/src/Questions/types.tsx +1 -1
- package/src/doc.mdx +26 -11
- 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/inputs/AutoCompleteInput/AutoComplete.stories.js +3 -0
- package/src/inputs/AutoCompleteInput/__stories__/Default.tsx +1 -1
- package/src/inputs/AutoCompleteInput/__stories__/Multiple.tsx +1 -1
- package/src/inputs/AutoCompleteInput/doc.mdx +2 -2
- package/src/inputs/AutoCompleteInput/index.test.tsx +17 -14
- package/src/inputs/AutoCompleteInput/index.tsx +5 -6
- package/src/inputs/Checkboxes/Checkboxes.stories.js +3 -0
- package/src/inputs/Checkboxes/__stories__/Conditional.tsx +1 -1
- package/src/inputs/Checkboxes/__stories__/Default.tsx +1 -1
- package/src/inputs/Checkboxes/__stories__/WithDivider.tsx +1 -1
- package/src/inputs/Checkboxes/doc.mdx +3 -3
- package/src/inputs/Checkboxes/index.test.tsx +20 -17
- package/src/inputs/Checkboxes/index.tsx +98 -89
- package/src/inputs/DateInput/DateInput.stories.js +7 -0
- package/src/inputs/DateInput/__stories__/Default.tsx +1 -1
- 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/doc.mdx +1 -1
- package/src/inputs/DateInput/index.test.tsx +30 -11
- package/src/inputs/DateInput/index.tsx +71 -23
- 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 +4 -0
- package/src/inputs/FileInput/__stories__/Default.tsx +1 -1
- package/src/inputs/FileInput/__stories__/WithBorderAndLink.tsx +34 -0
- package/src/inputs/FileInput/doc.mdx +1 -1
- package/src/inputs/FileInput/index.test.tsx +18 -11
- package/src/inputs/FileInput/index.tsx +98 -38
- package/src/inputs/ImageInput/ImageInput.stories.js +5 -1
- package/src/inputs/ImageInput/__stories__/Default.tsx +1 -1
- package/src/inputs/ImageInput/__stories__/MaxSize.tsx +3 -2
- package/src/inputs/ImageInput/__stories__/{WithInvalidImageSize.tsx → WithInitialValues.tsx} +12 -3
- package/src/inputs/ImageInput/__stories__/WithInvalidImageDimension.tsx +1 -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 +3 -3
- package/src/inputs/ImageInput/index.test.tsx +24 -21
- package/src/inputs/ImageInput/index.tsx +102 -44
- package/src/inputs/Input/Input.stories.js +7 -0
- package/src/inputs/Input/__stories__/AFM.tsx +1 -1
- package/src/inputs/Input/__stories__/AMKA.tsx +23 -0
- package/src/inputs/Input/__stories__/Boolean.tsx +1 -1
- package/src/inputs/Input/__stories__/Email.tsx +23 -0
- package/src/inputs/Input/__stories__/IBAN.tsx +1 -1
- package/src/inputs/Input/__stories__/Integer.tsx +1 -1
- package/src/inputs/Input/__stories__/LandlineNumber.tsx +1 -1
- package/src/inputs/Input/__stories__/MobilePhone.tsx +1 -1
- package/src/inputs/Input/__stories__/PhoneNumber.tsx +1 -1
- package/src/inputs/Input/__stories__/PostalCode.tsx +1 -1
- package/src/inputs/Input/__stories__/Rate.tsx +25 -0
- package/src/inputs/Input/__stories__/String.tsx +1 -1
- package/src/inputs/Input/__stories__/StringWithTrimValidation.tsx +26 -0
- package/src/inputs/Input/__stories__/TextWithLimit.tsx +2 -1
- package/src/inputs/Input/doc.mdx +10 -10
- package/src/inputs/Input/index.test.tsx +57 -38
- package/src/inputs/Input/index.tsx +25 -8
- package/src/inputs/Label/Label.stories.js +3 -0
- package/src/inputs/Label/__stories__/Default.tsx +1 -1
- package/src/inputs/Label/doc.mdx +1 -1
- package/src/inputs/Label/index.test.tsx +14 -11
- package/src/inputs/Label/index.tsx +1 -1
- package/src/inputs/OtpInput/OtpInput.stories.js +3 -0
- package/src/inputs/OtpInput/__stories__/Default.tsx +1 -1
- package/src/inputs/OtpInput/doc.mdx +1 -1
- package/src/inputs/OtpInput/index.test.tsx +14 -11
- package/src/inputs/OtpInput/index.tsx +43 -33
- package/src/inputs/Radio/Radio.stories.js +3 -0
- package/src/inputs/Radio/__stories__/Conditional.tsx +1 -1
- package/src/inputs/Radio/__stories__/Default.tsx +1 -1
- package/src/inputs/Radio/__stories__/WithDivider.tsx +1 -1
- package/src/inputs/Radio/doc.mdx +3 -3
- package/src/inputs/Radio/index.test.tsx +20 -17
- package/src/inputs/Radio/index.tsx +34 -22
- package/src/inputs/Select/Select.stories.js +3 -0
- package/src/inputs/Select/__stories__/Default.tsx +1 -1
- package/src/inputs/Select/doc.mdx +1 -1
- package/src/inputs/Select/index.test.tsx +14 -11
- package/src/inputs/Select/index.tsx +17 -6
- package/src/{Field/utils/index.ts → inputs/registry.ts} +11 -1
- package/{lazy/index.js → src/lazy.ts} +11 -22
- package/{registry/index.js → src/registry.ts} +39 -17
- package/src/types.tsx +14 -5
- package/src/utils.ts +41 -8
- package/src/validators/index.ts +101 -29
- package/src/validators/types.ts +1 -1
- package/src/validators/utils/amka.ts +39 -0
- package/src/validators/utils/date.ts +30 -6
- package/src/validators/utils/datetime.ts +222 -0
- package/src/validators/utils/email.ts +11 -0
- package/src/validators/utils/file.ts +35 -21
- package/src/validators/utils/iban.ts +2 -2
- package/src/validators/utils/image.ts +2 -2
- package/src/validators/utils/index.ts +14 -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 +2 -2
- package/src/validators/utils/postal_code.ts +2 -2
- package/src/validators/utils/text_limit.ts +2 -2
- package/types.d.ts +11 -5
- 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 +112 -121
- 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 +3 -3
- 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 -12
- package/validators/utils/index.js +59 -89
- 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 +2 -2
- package/validators/utils/phone.js +198 -0
- package/validators/utils/postal_code.d.ts +2 -2
- 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 -109
- package/Field/FieldBase/package.json +0 -6
- package/Field/FieldBase.js.map +0 -7
- package/Field/FieldBaseContainer/index.js +0 -32
- package/Field/FieldBaseContainer/package.json +0 -6
- package/Field/FieldBaseContainer.js.map +0 -7
- package/Field/FieldConditional/index.js +0 -85
- package/Field/FieldConditional/package.json +0 -6
- package/Field/FieldConditional.js.map +0 -7
- package/Field/index.js.map +0 -7
- package/Field/package.json +0 -6
- package/Field/types/index.js +0 -1
- package/Field/types/package.json +0 -6
- package/Field/types.js.map +0 -7
- package/Field/utils/calculateField/index.js +0 -27
- package/Field/utils/calculateField/package.json +0 -6
- package/Field/utils/calculateField.d.ts +0 -2
- package/Field/utils/calculateField.js.map +0 -7
- package/Field/utils/evaluateFieldWithConditions/index.js +0 -26
- package/Field/utils/evaluateFieldWithConditions/package.json +0 -6
- package/Field/utils/evaluateFieldWithConditions.js.map +0 -7
- package/Field/utils/index.js +0 -78
- package/Field/utils/index.js.map +0 -7
- package/Field/utils/package.json +0 -6
- package/Field/utils/useField/index.js +0 -51
- package/Field/utils/useField/package.json +0 -6
- package/Field/utils/useField.js.map +0 -7
- package/FieldArray/FieldArray.stories.d.ts +0 -9
- package/FieldArray/__stories__/Default.d.ts +0 -2
- package/FieldArray/__stories__/WithExactLength.d.ts +0 -2
- package/FieldArray/index.js.map +0 -7
- package/FieldArray/index.test.d.ts +0 -1
- package/FieldArray/package.json +0 -6
- package/FieldObject/index.js.map +0 -7
- package/FieldObject/package.json +0 -6
- package/Fieldset/FieldsetWithContext/index.js +0 -31
- package/Fieldset/FieldsetWithContext/package.json +0 -6
- package/Fieldset/FieldsetWithContext.js.map +0 -7
- package/Fieldset/index.js.map +0 -7
- package/Fieldset/package.json +0 -6
- package/Fieldset/types/index.js +0 -1
- package/Fieldset/types/package.json +0 -6
- package/Fieldset/types.js.map +0 -7
- package/Form.stories.d.ts +0 -4
- package/FormBuilder/FormBuilder.stories.d.ts +0 -8
- package/FormBuilder/__stories__/Default.d.ts +0 -3
- package/FormBuilder/index.js.map +0 -7
- package/FormBuilder/index.test.d.ts +0 -1
- package/FormBuilder/package.json +0 -6
- package/FormBuilder/scenarios.test.d.ts +0 -88
- package/FormContext/index.js +0 -9
- package/FormContext/package.json +0 -6
- package/FormContext.js.map +0 -7
- package/MultiplicityField/MultiplicityField.stories.d.ts +0 -13
- package/MultiplicityField/__stories__/Default.d.ts +0 -2
- package/MultiplicityField/__stories__/PreviewDisplay.d.ts +0 -2
- package/MultiplicityField/__stories__/WithExactLength.d.ts +0 -2
- package/MultiplicityField/__stories__/WithMaxLength.d.ts +0 -2
- package/MultiplicityField/__stories__/WithMinAndMaxLength.d.ts +0 -2
- package/MultiplicityField/__stories__/WithMinLength.d.ts +0 -2
- package/MultiplicityField/add-objects/index.js +0 -153
- package/MultiplicityField/add-objects/package.json +0 -6
- package/MultiplicityField/add-objects.js.map +0 -7
- package/MultiplicityField/index.js.map +0 -7
- package/MultiplicityField/index.test.d.ts +0 -1
- package/MultiplicityField/package.json +0 -6
- package/MultiplicityField/types/index.js +0 -1
- package/MultiplicityField/types/package.json +0 -6
- package/MultiplicityField/types.js.map +0 -7
- package/Questions/Questions/index.js +0 -67
- package/Questions/Questions/package.json +0 -6
- package/Questions/Questions.js.map +0 -7
- package/Questions/Questions.stories.d.ts +0 -8
- package/Questions/QuestionsContext/index.js +0 -11
- package/Questions/QuestionsContext/package.json +0 -6
- package/Questions/QuestionsContext.js.map +0 -7
- package/Questions/Step/ReviewStep/index.js +0 -38
- package/Questions/Step/ReviewStep/package.json +0 -6
- package/Questions/Step/ReviewStep.js.map +0 -7
- package/Questions/Step/Step/index.js +0 -54
- package/Questions/Step/Step/package.json +0 -6
- package/Questions/Step/Step.js.map +0 -7
- package/Questions/Step/StepArrayReview/index.js +0 -42
- package/Questions/Step/StepArrayReview/package.json +0 -6
- package/Questions/Step/StepArrayReview.js.map +0 -7
- package/Questions/Step/StepContext/index.js +0 -23
- package/Questions/Step/StepContext/package.json +0 -6
- package/Questions/Step/StepContext.js.map +0 -7
- package/Questions/Step/StepDescription/index.js +0 -24
- package/Questions/Step/StepDescription/package.json +0 -6
- package/Questions/Step/StepDescription.js.map +0 -7
- package/Questions/Step/StepForm/index.js +0 -34
- package/Questions/Step/StepForm/package.json +0 -6
- package/Questions/Step/StepForm.js.map +0 -7
- package/Questions/Step/StepQuote/index.js +0 -11
- package/Questions/Step/StepQuote/package.json +0 -6
- package/Questions/Step/StepQuote.js.map +0 -7
- package/Questions/Step/StepTitle/index.js +0 -44
- package/Questions/Step/StepTitle/package.json +0 -6
- package/Questions/Step/StepTitle.js.map +0 -7
- package/Questions/Step/getAddMoreFields/index.js +0 -29
- package/Questions/Step/getAddMoreFields/package.json +0 -6
- package/Questions/Step/getAddMoreFields.js.map +0 -7
- package/Questions/Step/index.js.map +0 -7
- 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/Step/types.js.map +0 -7
- package/Questions/__stories__/Default.d.ts +0 -3
- package/Questions/getNextStep/index.js +0 -22
- package/Questions/getNextStep/package.json +0 -6
- package/Questions/getNextStep.js.map +0 -7
- package/Questions/index.js.map +0 -7
- package/Questions/index.spec.d.ts +0 -1
- package/Questions/index.test.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/Questions/types.js.map +0 -7
- package/cjs/Field/FieldBase/index.js +0 -142
- package/cjs/Field/FieldBase.js.map +0 -7
- package/cjs/Field/FieldBaseContainer/index.js +0 -65
- package/cjs/Field/FieldBaseContainer.js.map +0 -7
- package/cjs/Field/FieldConditional/index.js +0 -118
- package/cjs/Field/FieldConditional.js.map +0 -7
- package/cjs/Field/index.js +0 -139
- package/cjs/Field/index.js.map +0 -7
- package/cjs/Field/types/index.js +0 -16
- package/cjs/Field/types.js.map +0 -7
- package/cjs/Field/utils/calculateField/index.js +0 -50
- package/cjs/Field/utils/calculateField.js.map +0 -7
- package/cjs/Field/utils/evaluateFieldWithConditions/index.js +0 -49
- package/cjs/Field/utils/evaluateFieldWithConditions.js.map +0 -7
- package/cjs/Field/utils/index.js +0 -113
- package/cjs/Field/utils/index.js.map +0 -7
- package/cjs/Field/utils/useField/index.js +0 -74
- package/cjs/Field/utils/useField.js.map +0 -7
- package/cjs/FieldArray/index.js +0 -108
- package/cjs/FieldArray/index.js.map +0 -7
- package/cjs/FieldObject/index.js +0 -102
- package/cjs/FieldObject/index.js.map +0 -7
- package/cjs/Fieldset/FieldsetWithContext/index.js +0 -59
- package/cjs/Fieldset/FieldsetWithContext.js.map +0 -7
- package/cjs/Fieldset/index.js +0 -66
- package/cjs/Fieldset/index.js.map +0 -7
- package/cjs/Fieldset/types/index.js +0 -16
- package/cjs/Fieldset/types.js.map +0 -7
- package/cjs/FormBuilder/index.js +0 -194
- package/cjs/FormBuilder/index.js.map +0 -7
- package/cjs/FormContext/index.js +0 -32
- package/cjs/FormContext.js.map +0 -7
- package/cjs/MultiplicityField/add-objects/index.js +0 -181
- package/cjs/MultiplicityField/add-objects.js.map +0 -7
- package/cjs/MultiplicityField/index.js +0 -149
- package/cjs/MultiplicityField/index.js.map +0 -7
- package/cjs/MultiplicityField/types/index.js +0 -16
- package/cjs/MultiplicityField/types.js.map +0 -7
- package/cjs/Questions/Questions/index.js +0 -100
- package/cjs/Questions/Questions.js.map +0 -7
- package/cjs/Questions/QuestionsContext/index.js +0 -34
- package/cjs/Questions/QuestionsContext.js.map +0 -7
- package/cjs/Questions/Step/ReviewStep/index.js +0 -65
- package/cjs/Questions/Step/ReviewStep.js.map +0 -7
- package/cjs/Questions/Step/Step/index.js +0 -87
- package/cjs/Questions/Step/Step.js.map +0 -7
- package/cjs/Questions/Step/StepArrayReview/index.js +0 -67
- package/cjs/Questions/Step/StepArrayReview.js.map +0 -7
- package/cjs/Questions/Step/StepContext/index.js +0 -46
- package/cjs/Questions/Step/StepContext.js.map +0 -7
- package/cjs/Questions/Step/StepDescription/index.js +0 -58
- package/cjs/Questions/Step/StepDescription.js.map +0 -7
- package/cjs/Questions/Step/StepForm/index.js +0 -67
- package/cjs/Questions/Step/StepForm.js.map +0 -7
- package/cjs/Questions/Step/StepQuote/index.js +0 -44
- package/cjs/Questions/Step/StepQuote.js.map +0 -7
- package/cjs/Questions/Step/StepTitle/index.js +0 -76
- package/cjs/Questions/Step/StepTitle.js.map +0 -7
- package/cjs/Questions/Step/getAddMoreFields/index.js +0 -52
- package/cjs/Questions/Step/getAddMoreFields.js.map +0 -7
- package/cjs/Questions/Step/index.js +0 -59
- package/cjs/Questions/Step/index.js.map +0 -7
- package/cjs/Questions/Step/types/index.js +0 -16
- package/cjs/Questions/Step/types.js.map +0 -7
- package/cjs/Questions/getNextStep/index.js +0 -45
- package/cjs/Questions/getNextStep.js.map +0 -7
- package/cjs/Questions/index.js +0 -31
- package/cjs/Questions/index.js.map +0 -7
- package/cjs/Questions/types/index.js +0 -16
- package/cjs/Questions/types.js.map +0 -7
- package/cjs/index.js +0 -49
- package/cjs/index.js.map +0 -7
- package/cjs/inputs/AutoCompleteInput/index.js +0 -97
- package/cjs/inputs/AutoCompleteInput/index.js.map +0 -7
- package/cjs/inputs/Checkboxes/index.js +0 -105
- package/cjs/inputs/Checkboxes/index.js.map +0 -7
- package/cjs/inputs/DateInput/index.js +0 -153
- package/cjs/inputs/DateInput/index.js.map +0 -7
- package/cjs/inputs/FileInput/index.js +0 -80
- package/cjs/inputs/FileInput/index.js.map +0 -7
- package/cjs/inputs/ImageInput/index.js +0 -93
- package/cjs/inputs/ImageInput/index.js.map +0 -7
- package/cjs/inputs/Input/index.js +0 -103
- package/cjs/inputs/Input/index.js.map +0 -7
- package/cjs/inputs/Input/inputsInputScenarios/index.js +0 -439
- package/cjs/inputs/Input/inputsInputScenarios.js.map +0 -7
- package/cjs/inputs/Label/index.js +0 -50
- package/cjs/inputs/Label/index.js.map +0 -7
- package/cjs/inputs/OtpInput/index.js +0 -180
- package/cjs/inputs/OtpInput/index.js.map +0 -7
- package/cjs/inputs/Radio/index.js +0 -133
- package/cjs/inputs/Radio/index.js.map +0 -7
- package/cjs/inputs/Select/index.js +0 -56
- package/cjs/inputs/Select/index.js.map +0 -7
- package/cjs/inputs/index.js +0 -62
- package/cjs/inputs/index.js.map +0 -7
- package/cjs/inputs/inputsScenarios/index.js +0 -533
- package/cjs/inputs/inputsScenarios.js.map +0 -7
- package/cjs/internal/index.js +0 -38
- package/cjs/internal.js.map +0 -7
- package/cjs/lazy/index.js +0 -100
- package/cjs/lazy.js.map +0 -7
- package/cjs/locales/el/index.js +0 -35
- package/cjs/locales/el.js.map +0 -7
- package/cjs/registry/index.js +0 -187
- package/cjs/registry.js.map +0 -7
- package/cjs/types/index.js +0 -22
- package/cjs/types.js.map +0 -7
- package/cjs/utils/index.js +0 -83
- package/cjs/utils.js.map +0 -7
- package/cjs/validators/index.js +0 -145
- package/cjs/validators/index.js.map +0 -7
- package/cjs/validators/types/index.js +0 -16
- package/cjs/validators/types.js.map +0 -7
- package/cjs/validators/utils/afm/index.js +0 -55
- package/cjs/validators/utils/afm.js.map +0 -7
- package/cjs/validators/utils/date/index.js +0 -138
- package/cjs/validators/utils/date.js.map +0 -7
- package/cjs/validators/utils/file/index.js +0 -48
- package/cjs/validators/utils/file.js.map +0 -7
- package/cjs/validators/utils/iban/index.js +0 -142
- package/cjs/validators/utils/iban.js.map +0 -7
- package/cjs/validators/utils/image/index.js +0 -102
- package/cjs/validators/utils/image.js.map +0 -7
- package/cjs/validators/utils/index.js +0 -142
- package/cjs/validators/utils/index.js.map +0 -7
- package/cjs/validators/utils/int/index.js +0 -48
- package/cjs/validators/utils/int.js.map +0 -7
- package/cjs/validators/utils/number/index.js +0 -44
- package/cjs/validators/utils/number.js.map +0 -7
- package/cjs/validators/utils/otp/index.js +0 -54
- package/cjs/validators/utils/otp.js.map +0 -7
- package/cjs/validators/utils/phone/index.js +0 -198
- package/cjs/validators/utils/phone.js.map +0 -7
- package/cjs/validators/utils/postal_code/index.js +0 -54
- package/cjs/validators/utils/postal_code.js.map +0 -7
- package/cjs/validators/utils/text_limit/index.js +0 -69
- package/cjs/validators/utils/text_limit.js.map +0 -7
- package/cjs/validators/utils/uuid4/index.js +0 -46
- package/cjs/validators/utils/uuid4.js.map +0 -7
- package/index.js.map +0 -7
- package/inputs/AutoCompleteInput/AutoComplete.stories.d.ts +0 -9
- package/inputs/AutoCompleteInput/__stories__/Default.d.ts +0 -3
- package/inputs/AutoCompleteInput/__stories__/Multiple.d.ts +0 -3
- package/inputs/AutoCompleteInput/index.js.map +0 -7
- package/inputs/AutoCompleteInput/index.test.d.ts +0 -1
- package/inputs/AutoCompleteInput/package.json +0 -6
- package/inputs/Checkboxes/Checkboxes.stories.d.ts +0 -10
- package/inputs/Checkboxes/__stories__/Conditional.d.ts +0 -3
- package/inputs/Checkboxes/__stories__/Default.d.ts +0 -3
- package/inputs/Checkboxes/__stories__/WithDivider.d.ts +0 -3
- package/inputs/Checkboxes/index.js.map +0 -7
- package/inputs/Checkboxes/index.test.d.ts +0 -1
- package/inputs/Checkboxes/package.json +0 -6
- package/inputs/DateInput/DateInput.stories.d.ts +0 -8
- package/inputs/DateInput/__stories__/Default.d.ts +0 -3
- package/inputs/DateInput/index.js.map +0 -7
- package/inputs/DateInput/index.test.d.ts +0 -1
- package/inputs/DateInput/package.json +0 -6
- package/inputs/FileInput/FileInput.stories.d.ts +0 -8
- package/inputs/FileInput/__stories__/Default.d.ts +0 -3
- package/inputs/FileInput/index.js.map +0 -7
- package/inputs/FileInput/index.test.d.ts +0 -1
- package/inputs/FileInput/package.json +0 -6
- package/inputs/ImageInput/ImageInput.stories.d.ts +0 -10
- package/inputs/ImageInput/__stories__/Default.d.ts +0 -3
- package/inputs/ImageInput/__stories__/MaxSize.d.ts +0 -3
- package/inputs/ImageInput/__stories__/WithInvalidImageDimension.d.ts +0 -3
- package/inputs/ImageInput/__stories__/WithInvalidImageSize.d.ts +0 -3
- package/inputs/ImageInput/index.js.map +0 -7
- package/inputs/ImageInput/index.test.d.ts +0 -1
- package/inputs/ImageInput/package.json +0 -6
- package/inputs/Input/Input.stories.d.ts +0 -17
- package/inputs/Input/__stories__/AFM.d.ts +0 -3
- package/inputs/Input/__stories__/Boolean.d.ts +0 -3
- package/inputs/Input/__stories__/IBAN.d.ts +0 -3
- package/inputs/Input/__stories__/Integer.d.ts +0 -3
- package/inputs/Input/__stories__/LandlineNumber.d.ts +0 -3
- package/inputs/Input/__stories__/MobilePhone.d.ts +0 -3
- package/inputs/Input/__stories__/PhoneNumber.d.ts +0 -3
- package/inputs/Input/__stories__/PostalCode.d.ts +0 -3
- package/inputs/Input/__stories__/String.d.ts +0 -3
- package/inputs/Input/__stories__/TextWithLimit.d.ts +0 -3
- package/inputs/Input/index.js.map +0 -7
- package/inputs/Input/index.test.d.ts +0 -1
- package/inputs/Input/inputsInputScenarios/index.js +0 -406
- package/inputs/Input/inputsInputScenarios/package.json +0 -6
- package/inputs/Input/inputsInputScenarios.d.ts +0 -57
- package/inputs/Input/inputsInputScenarios.js.map +0 -7
- package/inputs/Input/package.json +0 -6
- package/inputs/Label/Label.stories.d.ts +0 -8
- package/inputs/Label/__stories__/Default.d.ts +0 -3
- package/inputs/Label/index.js.map +0 -7
- package/inputs/Label/index.test.d.ts +0 -1
- package/inputs/Label/package.json +0 -6
- package/inputs/OtpInput/OtpInput.stories.d.ts +0 -8
- package/inputs/OtpInput/__stories__/Default.d.ts +0 -3
- package/inputs/OtpInput/index.js.map +0 -7
- package/inputs/OtpInput/index.test.d.ts +0 -1
- package/inputs/OtpInput/package.json +0 -6
- package/inputs/Radio/Radio.stories.d.ts +0 -10
- package/inputs/Radio/__stories__/Conditional.d.ts +0 -3
- package/inputs/Radio/__stories__/Default.d.ts +0 -3
- package/inputs/Radio/__stories__/WithDivider.d.ts +0 -3
- package/inputs/Radio/index.js.map +0 -7
- package/inputs/Radio/index.test.d.ts +0 -1
- package/inputs/Radio/package.json +0 -6
- package/inputs/Select/Select.stories.d.ts +0 -8
- package/inputs/Select/__stories__/Default.d.ts +0 -3
- package/inputs/Select/index.js.map +0 -7
- package/inputs/Select/index.test.d.ts +0 -1
- package/inputs/Select/package.json +0 -6
- package/inputs/index.js.map +0 -7
- package/inputs/inputsScenarios/index.js +0 -499
- package/inputs/inputsScenarios/package.json +0 -6
- package/inputs/inputsScenarios.d.ts +0 -296
- package/inputs/inputsScenarios.js.map +0 -7
- package/inputs/package.json +0 -6
- package/internal/index.js +0 -10
- package/internal/package.json +0 -6
- package/internal.js.map +0 -7
- package/lazy/package.json +0 -6
- package/locales/el/index.js +0 -6
- package/locales/el/package.json +0 -6
- package/locales/el.d.ts +0 -2
- package/locales/el.js.map +0 -7
- package/registry/package.json +0 -6
- package/src/Field/utils/calculateField.ts +0 -49
- package/src/inputs/Input/inputsInputScenarios.ts +0 -404
- package/src/inputs/inputsScenarios.ts +0 -496
- package/src/locales/el.ts +0 -3
- package/types/index.js +0 -2
- package/types/package.json +0 -6
- package/types.js.map +0 -7
- package/utils/index.js +0 -60
- package/utils/package.json +0 -6
- package/utils.js.map +0 -7
- package/validators/index.js.map +0 -7
- package/validators/package.json +0 -6
- package/validators/types/index.js +0 -1
- package/validators/types/package.json +0 -6
- package/validators/types.js.map +0 -7
- package/validators/utils/afm/index.js +0 -31
- package/validators/utils/afm/package.json +0 -6
- package/validators/utils/afm.js.map +0 -7
- package/validators/utils/date/index.js +0 -103
- package/validators/utils/date/package.json +0 -6
- package/validators/utils/date.js.map +0 -7
- package/validators/utils/file/index.js +0 -25
- package/validators/utils/file/package.json +0 -6
- package/validators/utils/file.js.map +0 -7
- package/validators/utils/iban/index.js +0 -118
- package/validators/utils/iban/package.json +0 -6
- package/validators/utils/iban.js.map +0 -7
- package/validators/utils/image/index.js +0 -79
- package/validators/utils/image/package.json +0 -6
- package/validators/utils/image.js.map +0 -7
- package/validators/utils/index.js.map +0 -7
- package/validators/utils/int/index.js +0 -24
- package/validators/utils/int/package.json +0 -6
- package/validators/utils/int.js.map +0 -7
- package/validators/utils/number/index.js +0 -20
- package/validators/utils/number/package.json +0 -6
- package/validators/utils/number.js.map +0 -7
- package/validators/utils/otp/index.js +0 -30
- package/validators/utils/otp/package.json +0 -6
- package/validators/utils/otp.js.map +0 -7
- package/validators/utils/package.json +0 -6
- package/validators/utils/phone/index.js +0 -172
- package/validators/utils/phone/package.json +0 -6
- package/validators/utils/phone.js.map +0 -7
- package/validators/utils/postal_code/index.js +0 -30
- package/validators/utils/postal_code/package.json +0 -6
- package/validators/utils/postal_code.js.map +0 -7
- package/validators/utils/text_limit/index.js +0 -45
- package/validators/utils/text_limit/package.json +0 -6
- package/validators/utils/text_limit.js.map +0 -7
- package/validators/utils/uuid4/index.js +0 -22
- package/validators/utils/uuid4/package.json +0 -6
- package/validators/utils/uuid4.js.map +0 -7
- package/validators/validators.spec.d.ts +0 -1
package/Field/index.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/Field/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import React, { useMemo } from 'react';\nimport { FieldBase } from '@digigov/form/Field/FieldBase';\nimport FieldConditional from '@digigov/form/Field/FieldConditional';\nimport {\n FieldWithCondition,\n CalculatedField,\n FieldProps,\n} from '@digigov/form/Field/types';\nimport {\n FIELD_COMPONENTS,\n ALTERNATIVE_COMPONENTS,\n} from '@digigov/form/Field/utils';\nimport { calculateField } from '@digigov/form/Field/utils/calculateField';\nimport { useField } from '@digigov/form/Field/utils/useField';\nimport FieldArray from '@digigov/form/FieldArray';\nimport Multiplicity from '@digigov/form/MultiplicityField';\nexport const Field: React.FC<FieldProps> = ({\n name,\n disabled,\n children,\n ...customField\n}) => {\n const {\n field,\n control,\n register,\n reset,\n error,\n componentRegistry,\n formState,\n setValue,\n getValues,\n unregister,\n trigger,\n clearErrors,\n } = useField(name, customField?.type ? customField : null);\n const calculatedField: CalculatedField = useMemo(\n () =>\n calculateField(\n children,\n field,\n {\n ...FIELD_COMPONENTS,\n ...componentRegistry,\n },\n ALTERNATIVE_COMPONENTS\n ),\n [field]\n );\n\n if (calculatedField.condition) {\n return (\n <FieldConditional\n control={control}\n reset={reset}\n register={register}\n field={calculatedField as FieldWithCondition}\n error={error}\n Field={Field}\n />\n );\n }\n if (calculatedField.type === 'array' && !calculatedField.multiplicity) {\n calculatedField.name = name;\n return (\n <FieldArray\n control={control}\n register={register}\n error={error}\n formState={formState}\n Field={Field}\n {...calculatedField}\n />\n );\n }\n if (\n calculatedField.type === 'array' &&\n calculatedField.multiplicity === true\n ) {\n calculatedField.name = name;\n return (\n <Multiplicity\n control={control}\n register={register}\n trigger={trigger}\n clearErrors={clearErrors}\n error={error}\n formState={formState}\n setValue={setValue}\n getValues={getValues}\n unregister={unregister}\n Field={Field}\n {...calculatedField}\n />\n );\n }\n return (\n <FieldBase\n {...calculatedField}\n name={name}\n disabled={disabled}\n control={control}\n register={register}\n reset={reset}\n error={error}\n Field={Field}\n />\n );\n};\n\nexport default Field;\n"],
|
|
5
|
-
"mappings": "AAAA,OAAO,SAAS,eAAe;AAC/B,SAAS,iBAAiB;AAC1B,OAAO,sBAAsB;AAM7B;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,sBAAsB;AAC/B,SAAS,gBAAgB;AACzB,OAAO,gBAAgB;AACvB,OAAO,kBAAkB;AAClB,MAAM,QAA8B,CAAC;AAAA,EAC1C;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,SAAS,MAAM,aAAa,OAAO,cAAc,IAAI;AACzD,QAAM,kBAAmC;AAAA,IACvC,MACE;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,QACE,GAAG;AAAA,QACH,GAAG;AAAA,MACL;AAAA,MACA;AAAA,IACF;AAAA,IACF,CAAC,KAAK;AAAA,EACR;AAEA,MAAI,gBAAgB,WAAW;AAC7B,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA,OAAO;AAAA,QACP;AAAA,QACA;AAAA;AAAA,IACF;AAAA,EAEJ;AACA,MAAI,gBAAgB,SAAS,WAAW,CAAC,gBAAgB,cAAc;AACrE,oBAAgB,OAAO;AACvB,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACC,GAAG;AAAA;AAAA,IACN;AAAA,EAEJ;AACA,MACE,gBAAgB,SAAS,WACzB,gBAAgB,iBAAiB,MACjC;AACA,oBAAgB,OAAO;AACvB,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACC,GAAG;AAAA;AAAA,IACN;AAAA,EAEJ;AACA,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,EACF;AAEJ;AAEA,IAAO,gBAAQ;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/Field/package.json
DELETED
package/Field/types/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=types.js.map
|
package/Field/types/package.json
DELETED
package/Field/types.js.map
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
function calculateField(children, field, fieldComponentRegistry, alternativeComponents) {
|
|
2
|
-
const calculatedField = { ...field };
|
|
3
|
-
if (children) {
|
|
4
|
-
calculatedField.component = children;
|
|
5
|
-
calculatedField.controlled = true;
|
|
6
|
-
} else if (typeof field.component === "function") {
|
|
7
|
-
} else if (!field.component && !field.type) {
|
|
8
|
-
calculatedField.component = fieldComponentRegistry.string.component;
|
|
9
|
-
calculatedField.controlled = fieldComponentRegistry.string?.controlled || false;
|
|
10
|
-
} else if (typeof field?.extra?.component === "string" && alternativeComponents[field.extra.component]) {
|
|
11
|
-
calculatedField.controlled = alternativeComponents[field.extra.component]?.controlled || false;
|
|
12
|
-
calculatedField.component = alternativeComponents[field.extra.component].component;
|
|
13
|
-
calculatedField.wrapper = alternativeComponents[field.extra.component].wrapper;
|
|
14
|
-
} else if (!field.component && field.type && fieldComponentRegistry[field.type]) {
|
|
15
|
-
calculatedField.component = fieldComponentRegistry[field.type].component;
|
|
16
|
-
calculatedField.wrapper = fieldComponentRegistry[field.type].wrapper;
|
|
17
|
-
calculatedField.controlled = fieldComponentRegistry[field.type]?.controlled || false;
|
|
18
|
-
} else {
|
|
19
|
-
calculatedField.component = fieldComponentRegistry.string.component;
|
|
20
|
-
calculatedField.controlled = fieldComponentRegistry.string?.controlled || false;
|
|
21
|
-
}
|
|
22
|
-
return calculatedField;
|
|
23
|
-
}
|
|
24
|
-
export {
|
|
25
|
-
calculateField
|
|
26
|
-
};
|
|
27
|
-
//# sourceMappingURL=calculateField.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { FieldProps, FieldSpec, FieldComponentRegistry, CalculatedField } from '@digigov/form/Field/types';
|
|
2
|
-
export declare function calculateField(children: FieldProps['children'], field: FieldSpec, fieldComponentRegistry: FieldComponentRegistry, alternativeComponents: FieldComponentRegistry): CalculatedField;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/Field/utils/calculateField.ts"],
|
|
4
|
-
"sourcesContent": ["import {\n FieldProps,\n FieldSpec,\n FieldComponentRegistry,\n CalculatedField,\n} from '@digigov/form/Field/types';\n\nexport function calculateField(\n children: FieldProps['children'],\n field: FieldSpec,\n fieldComponentRegistry: FieldComponentRegistry,\n alternativeComponents: FieldComponentRegistry\n): CalculatedField {\n const calculatedField = { ...field };\n if (children) {\n calculatedField.component = children;\n calculatedField.controlled = true;\n } else if (typeof field.component === 'function') {\n // leave as is\n } else if (!field.component && !field.type) {\n calculatedField.component = fieldComponentRegistry.string.component;\n calculatedField.controlled =\n fieldComponentRegistry.string?.controlled || false;\n } else if (\n typeof field?.extra?.component === 'string' &&\n alternativeComponents[field.extra.component]\n ) {\n calculatedField.controlled =\n alternativeComponents[field.extra.component]?.controlled || false;\n calculatedField.component =\n alternativeComponents[field.extra.component].component;\n calculatedField.wrapper =\n alternativeComponents[field.extra.component].wrapper;\n } else if (\n !field.component &&\n field.type &&\n fieldComponentRegistry[field.type]\n ) {\n calculatedField.component = fieldComponentRegistry[field.type].component;\n calculatedField.wrapper = fieldComponentRegistry[field.type].wrapper;\n calculatedField.controlled =\n fieldComponentRegistry[field.type]?.controlled || false;\n } else {\n calculatedField.component = fieldComponentRegistry.string.component;\n calculatedField.controlled =\n fieldComponentRegistry.string?.controlled || false;\n }\n return calculatedField as CalculatedField;\n}\n"],
|
|
5
|
-
"mappings": "AAOO,SAAS,eACd,UACA,OACA,wBACA,uBACiB;AACjB,QAAM,kBAAkB,EAAE,GAAG,MAAM;AACnC,MAAI,UAAU;AACZ,oBAAgB,YAAY;AAC5B,oBAAgB,aAAa;AAAA,EAC/B,WAAW,OAAO,MAAM,cAAc,YAAY;AAAA,EAElD,WAAW,CAAC,MAAM,aAAa,CAAC,MAAM,MAAM;AAC1C,oBAAgB,YAAY,uBAAuB,OAAO;AAC1D,oBAAgB,aACd,uBAAuB,QAAQ,cAAc;AAAA,EACjD,WACE,OAAO,OAAO,OAAO,cAAc,YACnC,sBAAsB,MAAM,MAAM,SAAS,GAC3C;AACA,oBAAgB,aACd,sBAAsB,MAAM,MAAM,SAAS,GAAG,cAAc;AAC9D,oBAAgB,YACd,sBAAsB,MAAM,MAAM,SAAS,EAAE;AAC/C,oBAAgB,UACd,sBAAsB,MAAM,MAAM,SAAS,EAAE;AAAA,EACjD,WACE,CAAC,MAAM,aACP,MAAM,QACN,uBAAuB,MAAM,IAAI,GACjC;AACA,oBAAgB,YAAY,uBAAuB,MAAM,IAAI,EAAE;AAC/D,oBAAgB,UAAU,uBAAuB,MAAM,IAAI,EAAE;AAC7D,oBAAgB,aACd,uBAAuB,MAAM,IAAI,GAAG,cAAc;AAAA,EACtD,OAAO;AACL,oBAAgB,YAAY,uBAAuB,OAAO;AAC1D,oBAAgB,aACd,uBAAuB,QAAQ,cAAc;AAAA,EACjD;AACA,SAAO;AACT;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
function evaluateFieldWithConditions(field, variables) {
|
|
2
|
-
const newField = { ...field };
|
|
3
|
-
if (variables) {
|
|
4
|
-
for (const key in variables) {
|
|
5
|
-
if (field.condition[key] && field.condition[key].is) {
|
|
6
|
-
const is = field.condition[key].is;
|
|
7
|
-
if (is === variables[key] || Array.isArray(variables[key]) && variables[key].includes(is)) {
|
|
8
|
-
const then = field.condition[key].then || {};
|
|
9
|
-
for (const attr in then) {
|
|
10
|
-
newField[attr] = then[attr];
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
} else if (field.condition[key]) {
|
|
14
|
-
const otherwise = field.condition[key].else || {};
|
|
15
|
-
for (const attr in otherwise) {
|
|
16
|
-
newField[attr] = otherwise[attr];
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
return newField;
|
|
22
|
-
}
|
|
23
|
-
export {
|
|
24
|
-
evaluateFieldWithConditions
|
|
25
|
-
};
|
|
26
|
-
//# sourceMappingURL=evaluateFieldWithConditions.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/Field/utils/evaluateFieldWithConditions.ts"],
|
|
4
|
-
"sourcesContent": ["import { FieldWithCondition, CalculatedField } from '@digigov/form/Field/types';\n\nexport function evaluateFieldWithConditions(\n field: FieldWithCondition,\n variables: FormData\n): CalculatedField {\n const newField = { ...field };\n if (variables) {\n for (const key in variables) {\n if (field.condition[key] && field.condition[key].is) {\n const is = field.condition[key].is;\n if (\n is === variables[key] ||\n (Array.isArray(variables[key]) && variables[key].includes(is))\n ) {\n const then = field.condition[key].then || {};\n for (const attr in then) {\n newField[attr] = then[attr];\n }\n }\n } else if (field.condition[key]) {\n const otherwise = field.condition[key].else || {};\n for (const attr in otherwise) {\n newField[attr] = otherwise[attr];\n }\n }\n }\n }\n return newField;\n}\n"],
|
|
5
|
-
"mappings": "AAEO,SAAS,4BACd,OACA,WACiB;AACjB,QAAM,WAAW,EAAE,GAAG,MAAM;AAC5B,MAAI,WAAW;AACb,eAAW,OAAO,WAAW;AAC3B,UAAI,MAAM,UAAU,GAAG,KAAK,MAAM,UAAU,GAAG,EAAE,IAAI;AACnD,cAAM,KAAK,MAAM,UAAU,GAAG,EAAE;AAChC,YACE,OAAO,UAAU,GAAG,KACnB,MAAM,QAAQ,UAAU,GAAG,CAAC,KAAK,UAAU,GAAG,EAAE,SAAS,EAAE,GAC5D;AACA,gBAAM,OAAO,MAAM,UAAU,GAAG,EAAE,QAAQ,CAAC;AAC3C,qBAAW,QAAQ,MAAM;AACvB,qBAAS,IAAI,IAAI,KAAK,IAAI;AAAA,UAC5B;AAAA,QACF;AAAA,MACF,WAAW,MAAM,UAAU,GAAG,GAAG;AAC/B,cAAM,YAAY,MAAM,UAAU,GAAG,EAAE,QAAQ,CAAC;AAChD,mBAAW,QAAQ,WAAW;AAC5B,mBAAS,IAAI,IAAI,UAAU,IAAI;AAAA,QACjC;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/Field/utils/index.js
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import AutoCompleteInput from "@digigov/form/inputs/AutoCompleteInput";
|
|
2
|
-
import Checkboxes from "@digigov/form/inputs/Checkboxes";
|
|
3
|
-
import DateInput from "@digigov/form/inputs/DateInput";
|
|
4
|
-
import FileInput from "@digigov/form/inputs/FileInput";
|
|
5
|
-
import ImageInput from "@digigov/form/inputs/ImageInput";
|
|
6
|
-
import Input from "@digigov/form/inputs/Input";
|
|
7
|
-
import OtpInput from "@digigov/form/inputs/OtpInput";
|
|
8
|
-
import Radio, { ControlledRadioButtonsGroup } from "@digigov/form/inputs/Radio";
|
|
9
|
-
import Select from "@digigov/form/inputs/Select";
|
|
10
|
-
const FIELD_COMPONENTS = {
|
|
11
|
-
text: {
|
|
12
|
-
component: Input
|
|
13
|
-
},
|
|
14
|
-
string: {
|
|
15
|
-
component: Input
|
|
16
|
-
},
|
|
17
|
-
file: {
|
|
18
|
-
wrapper: "fieldset",
|
|
19
|
-
component: FileInput
|
|
20
|
-
},
|
|
21
|
-
image: {
|
|
22
|
-
wrapper: "fieldset",
|
|
23
|
-
component: ImageInput
|
|
24
|
-
},
|
|
25
|
-
date: {
|
|
26
|
-
wrapper: "fieldset",
|
|
27
|
-
controlled: true,
|
|
28
|
-
component: DateInput
|
|
29
|
-
},
|
|
30
|
-
otp: {
|
|
31
|
-
wrapper: "fieldset",
|
|
32
|
-
controlled: true,
|
|
33
|
-
component: OtpInput
|
|
34
|
-
},
|
|
35
|
-
"choice:multiple": {
|
|
36
|
-
wrapper: "fieldset",
|
|
37
|
-
controlled: true,
|
|
38
|
-
component: Checkboxes
|
|
39
|
-
},
|
|
40
|
-
"choice:single": {
|
|
41
|
-
wrapper: "fieldset",
|
|
42
|
-
controlled: false,
|
|
43
|
-
component: Radio
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
const ALTERNATIVE_COMPONENTS = {
|
|
47
|
-
Select: {
|
|
48
|
-
component: Select,
|
|
49
|
-
controlled: false
|
|
50
|
-
},
|
|
51
|
-
AutoComplete: {
|
|
52
|
-
component: AutoCompleteInput,
|
|
53
|
-
controlled: true,
|
|
54
|
-
wrapper: "fieldset"
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
const CONTROLLED_FIELD_COMPONENTS = {
|
|
58
|
-
...FIELD_COMPONENTS,
|
|
59
|
-
"choice:single": {
|
|
60
|
-
wrapper: "fieldset",
|
|
61
|
-
controlled: true,
|
|
62
|
-
component: ControlledRadioButtonsGroup
|
|
63
|
-
},
|
|
64
|
-
text: {
|
|
65
|
-
component: Input,
|
|
66
|
-
controlled: true
|
|
67
|
-
},
|
|
68
|
-
string: {
|
|
69
|
-
component: Input,
|
|
70
|
-
controlled: true
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
export {
|
|
74
|
-
ALTERNATIVE_COMPONENTS,
|
|
75
|
-
CONTROLLED_FIELD_COMPONENTS,
|
|
76
|
-
FIELD_COMPONENTS
|
|
77
|
-
};
|
|
78
|
-
//# sourceMappingURL=index.js.map
|
package/Field/utils/index.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/Field/utils/index.ts"],
|
|
4
|
-
"sourcesContent": ["import { FieldComponentRegistry } from '@digigov/form/Field/types';\nimport AutoCompleteInput from '@digigov/form/inputs/AutoCompleteInput';\nimport Checkboxes from '@digigov/form/inputs/Checkboxes';\nimport DateInput from '@digigov/form/inputs/DateInput';\nimport FileInput from '@digigov/form/inputs/FileInput';\nimport ImageInput from '@digigov/form/inputs/ImageInput';\nimport Input from '@digigov/form/inputs/Input';\nimport OtpInput from '@digigov/form/inputs/OtpInput';\nimport Radio, { ControlledRadioButtonsGroup } from '@digigov/form/inputs/Radio';\nimport Select from '@digigov/form/inputs/Select';\n\nexport const FIELD_COMPONENTS: FieldComponentRegistry = {\n text: {\n component: Input,\n },\n string: {\n component: Input,\n },\n file: {\n wrapper: 'fieldset',\n component: FileInput,\n },\n image: {\n wrapper: 'fieldset',\n component: ImageInput,\n },\n date: {\n wrapper: 'fieldset',\n controlled: true,\n component: DateInput,\n },\n otp: {\n wrapper: 'fieldset',\n controlled: true,\n component: OtpInput,\n },\n 'choice:multiple': {\n wrapper: 'fieldset',\n controlled: true,\n component: Checkboxes,\n },\n 'choice:single': {\n wrapper: 'fieldset',\n controlled: false,\n component: Radio,\n },\n};\n\nexport const ALTERNATIVE_COMPONENTS: FieldComponentRegistry = {\n Select: {\n component: Select,\n controlled: false,\n },\n AutoComplete: {\n component: AutoCompleteInput,\n controlled: true,\n wrapper: 'fieldset',\n },\n};\n\nexport const CONTROLLED_FIELD_COMPONENTS: FieldComponentRegistry = {\n ...FIELD_COMPONENTS,\n 'choice:single': {\n wrapper: 'fieldset',\n controlled: true,\n component: ControlledRadioButtonsGroup,\n },\n text: {\n component: Input,\n controlled: true,\n },\n string: {\n component: Input,\n controlled: true,\n },\n};\n"],
|
|
5
|
-
"mappings": "AACA,OAAO,uBAAuB;AAC9B,OAAO,gBAAgB;AACvB,OAAO,eAAe;AACtB,OAAO,eAAe;AACtB,OAAO,gBAAgB;AACvB,OAAO,WAAW;AAClB,OAAO,cAAc;AACrB,OAAO,SAAS,mCAAmC;AACnD,OAAO,YAAY;AAEZ,MAAM,mBAA2C;AAAA,EACtD,MAAM;AAAA,IACJ,WAAW;AAAA,EACb;AAAA,EACA,QAAQ;AAAA,IACN,WAAW;AAAA,EACb;AAAA,EACA,MAAM;AAAA,IACJ,SAAS;AAAA,IACT,WAAW;AAAA,EACb;AAAA,EACA,OAAO;AAAA,IACL,SAAS;AAAA,IACT,WAAW;AAAA,EACb;AAAA,EACA,MAAM;AAAA,IACJ,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,WAAW;AAAA,EACb;AAAA,EACA,KAAK;AAAA,IACH,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,WAAW;AAAA,EACb;AAAA,EACA,mBAAmB;AAAA,IACjB,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,WAAW;AAAA,EACb;AAAA,EACA,iBAAiB;AAAA,IACf,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,WAAW;AAAA,EACb;AACF;AAEO,MAAM,yBAAiD;AAAA,EAC5D,QAAQ;AAAA,IACN,WAAW;AAAA,IACX,YAAY;AAAA,EACd;AAAA,EACA,cAAc;AAAA,IACZ,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,SAAS;AAAA,EACX;AACF;AAEO,MAAM,8BAAsD;AAAA,EACjE,GAAG;AAAA,EACH,iBAAiB;AAAA,IACf,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,WAAW;AAAA,EACb;AAAA,EACA,MAAM;AAAA,IACJ,WAAW;AAAA,IACX,YAAY;AAAA,EACd;AAAA,EACA,QAAQ;AAAA,IACN,WAAW;AAAA,IACX,YAAY;AAAA,EACd;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/Field/utils/package.json
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { useContext, useMemo } from "react";
|
|
2
|
-
import { FormContext } from "@digigov/form/FormContext";
|
|
3
|
-
const useField = (name, customField) => {
|
|
4
|
-
const {
|
|
5
|
-
fieldsMap,
|
|
6
|
-
control,
|
|
7
|
-
register,
|
|
8
|
-
reset,
|
|
9
|
-
trigger,
|
|
10
|
-
clearErrors,
|
|
11
|
-
errors,
|
|
12
|
-
registerField,
|
|
13
|
-
watch,
|
|
14
|
-
componentRegistry,
|
|
15
|
-
getFieldState,
|
|
16
|
-
setValue,
|
|
17
|
-
getValues,
|
|
18
|
-
unregister,
|
|
19
|
-
formState
|
|
20
|
-
} = useContext(FormContext);
|
|
21
|
-
if (!registerField) {
|
|
22
|
-
throw new Error(`
|
|
23
|
-
You can't use the Field component without wrapping it in FormBuilder.
|
|
24
|
-
https://devs.pages.grnet.gr/digigov/digigov-sdk/sdk-docs/forms/create-simple-form/
|
|
25
|
-
`);
|
|
26
|
-
}
|
|
27
|
-
useMemo(
|
|
28
|
-
() => customField?.type && registerField({ ...customField, key: name }),
|
|
29
|
-
[customField, name, registerField]
|
|
30
|
-
);
|
|
31
|
-
return {
|
|
32
|
-
field: customField || fieldsMap[name],
|
|
33
|
-
control,
|
|
34
|
-
register,
|
|
35
|
-
reset,
|
|
36
|
-
trigger,
|
|
37
|
-
watch,
|
|
38
|
-
componentRegistry,
|
|
39
|
-
getFieldState,
|
|
40
|
-
setValue,
|
|
41
|
-
clearErrors,
|
|
42
|
-
getValues,
|
|
43
|
-
unregister,
|
|
44
|
-
formState,
|
|
45
|
-
error: errors[name]
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
export {
|
|
49
|
-
useField
|
|
50
|
-
};
|
|
51
|
-
//# sourceMappingURL=useField.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/Field/utils/useField.ts"],
|
|
4
|
-
"sourcesContent": ["import { useContext, useMemo } from 'react';\nimport { FieldSpec, UseFieldProps } from '@digigov/form/Field/types';\nimport { FormContext } from '@digigov/form/FormContext';\n\nexport const useField = (\n name: string,\n customField: FieldSpec | null\n): UseFieldProps => {\n const {\n fieldsMap,\n control,\n register,\n reset,\n trigger,\n clearErrors,\n errors,\n registerField,\n watch,\n componentRegistry,\n getFieldState,\n setValue,\n getValues,\n unregister,\n formState,\n } = useContext(FormContext);\n\n if (!registerField) {\n throw new Error(`\n You can't use the Field component without wrapping it in FormBuilder.\n https://devs.pages.grnet.gr/digigov/digigov-sdk/sdk-docs/forms/create-simple-form/\n `);\n }\n\n useMemo(\n () => customField?.type && registerField({ ...customField, key: name }),\n [customField, name, registerField]\n );\n return {\n field: customField || fieldsMap[name],\n control,\n register,\n reset,\n trigger,\n watch,\n componentRegistry,\n getFieldState,\n setValue,\n clearErrors,\n getValues,\n unregister,\n formState,\n error: errors[name],\n };\n};\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,YAAY,eAAe;AAEpC,SAAS,mBAAmB;AAErB,MAAM,WAAW,CACtB,MACA,gBACkB;AAClB,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,WAAW,WAAW;AAE1B,MAAI,CAAC,eAAe;AAClB,UAAM,IAAI,MAAM;AAAA;AAAA;AAAA,KAGf;AAAA,EACH;AAEA;AAAA,IACE,MAAM,aAAa,QAAQ,cAAc,EAAE,GAAG,aAAa,KAAK,KAAK,CAAC;AAAA,IACtE,CAAC,aAAa,MAAM,aAAa;AAAA,EACnC;AACA,SAAO;AAAA,IACL,OAAO,eAAe,UAAU,IAAI;AAAA,IACpC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,OAAO,IAAI;AAAA,EACpB;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
declare namespace _default {
|
|
2
|
-
export let title: string;
|
|
3
|
-
export { FieldArray as component };
|
|
4
|
-
export let displayName: string;
|
|
5
|
-
}
|
|
6
|
-
export default _default;
|
|
7
|
-
export { Default } from "@digigov/form/FieldArray/__stories__/Default";
|
|
8
|
-
export { WithExactLength } from "@digigov/form/FieldArray/__stories__/WithExactLength";
|
|
9
|
-
import FieldArray from '@digigov/form/FieldArray';
|
package/FieldArray/index.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/FieldArray/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import React from 'react';\nimport { ErrorOption, useFieldArray, UseFormReturn } from 'react-hook-form';\nimport { FieldBaseContainer } from '@digigov/form/Field/FieldBaseContainer';\nimport { FieldProps } from '@digigov/form/Field/types';\nimport { FieldObject } from '@digigov/form/FieldObject';\nimport { FieldsetLabel, Fieldset } from '@digigov/form/Fieldset';\nimport { Card } from '@digigov/ui/content/Card';\nimport { Button } from '@digigov/ui/form/Button';\nimport { Hint } from '@digigov/ui/typography/Hint';\n\nexport interface FieldArrayProps extends FieldProps {\n control: UseFormReturn['control'];\n register: UseFormReturn['register'];\n formState: UseFormReturn['formState'];\n error?: ErrorOption;\n Field: React.FC<FieldProps>;\n}\nexport const FieldArray: React.FC<FieldArrayProps> = ({\n name,\n register,\n control,\n formState,\n error,\n layout,\n label,\n Field,\n ...customField\n}) => {\n const { fields, append, remove } = useFieldArray({\n control,\n name,\n });\n\n return (\n <FieldBaseContainer\n label={label}\n layout={layout}\n error={\n formState.isSubmitted &&\n !formState.isSubmitting &&\n error?.message &&\n error\n ? error\n : undefined\n }\n wrapper=\"fieldset\"\n name={name}\n >\n {fields.length === 0 && (\n <Hint>{customField.extra?.label.object?.nothing_added}</Hint>\n )}\n {fields.map((field, index) => (\n <Card variant=\"border\" key={field.id}>\n <Fieldset>\n <FieldsetLabel>\n {customField.extra?.label.object.title} {index + 1}\n </FieldsetLabel>\n <FieldObject\n name={`${name}.${index}`}\n error={Array.isArray(error) && error[index]}\n formState={formState}\n register={register}\n control={control}\n {...customField.extra?.of}\n Field={Field}\n />\n <Button\n name={`${name}-object-remove`}\n type=\"button\"\n color=\"warning\"\n onClick={() => remove(index)}\n >\n {customField.extra?.label.object?.delete}\n </Button>\n </Fieldset>\n </Card>\n ))}\n\n <Button\n type=\"button\"\n name={`${name}-add-object`}\n color=\"secondary\"\n onClick={(ev) => {\n ev.preventDefault();\n append({});\n }}\n >\n {customField.extra?.label.object?.add}\n </Button>\n </FieldBaseContainer>\n );\n};\n\nexport default FieldArray;\n"],
|
|
5
|
-
"mappings": "AAAA,OAAO,WAAW;AAClB,SAAsB,qBAAoC;AAC1D,SAAS,0BAA0B;AAEnC,SAAS,mBAAmB;AAC5B,SAAS,eAAe,gBAAgB;AACxC,SAAS,YAAY;AACrB,SAAS,cAAc;AACvB,SAAS,YAAY;AASd,MAAM,aAAwC,CAAC;AAAA,EACpD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,EAAE,QAAQ,QAAQ,OAAO,IAAI,cAAc;AAAA,IAC/C;AAAA,IACA;AAAA,EACF,CAAC;AAED,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA,OACE,UAAU,eACV,CAAC,UAAU,gBACX,OAAO,WACP,QACI,QACA;AAAA,MAEN,SAAQ;AAAA,MACR;AAAA;AAAA,IAEC,OAAO,WAAW,KACjB,oCAAC,YAAM,YAAY,OAAO,MAAM,QAAQ,aAAc;AAAA,IAEvD,OAAO,IAAI,CAAC,OAAO,UAClB,oCAAC,QAAK,SAAQ,UAAS,KAAK,MAAM,MAChC,oCAAC,gBACC,oCAAC,qBACE,YAAY,OAAO,MAAM,OAAO,OAAM,KAAE,QAAQ,CACnD,GACA;AAAA,MAAC;AAAA;AAAA,QACC,MAAM,GAAG,IAAI,IAAI,KAAK;AAAA,QACtB,OAAO,MAAM,QAAQ,KAAK,KAAK,MAAM,KAAK;AAAA,QAC1C;AAAA,QACA;AAAA,QACA;AAAA,QACC,GAAG,YAAY,OAAO;AAAA,QACvB;AAAA;AAAA,IACF,GACA;AAAA,MAAC;AAAA;AAAA,QACC,MAAM,GAAG,IAAI;AAAA,QACb,MAAK;AAAA,QACL,OAAM;AAAA,QACN,SAAS,MAAM,OAAO,KAAK;AAAA;AAAA,MAE1B,YAAY,OAAO,MAAM,QAAQ;AAAA,IACpC,CACF,CACF,CACD;AAAA,IAED;AAAA,MAAC;AAAA;AAAA,QACC,MAAK;AAAA,QACL,MAAM,GAAG,IAAI;AAAA,QACb,OAAM;AAAA,QACN,SAAS,CAAC,OAAO;AACf,aAAG,eAAe;AAClB,iBAAO,CAAC,CAAC;AAAA,QACX;AAAA;AAAA,MAEC,YAAY,OAAO,MAAM,QAAQ;AAAA,IACpC;AAAA,EACF;AAEJ;AAEA,IAAO,qBAAQ;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/FieldArray/package.json
DELETED
package/FieldObject/index.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/FieldObject/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import React, { useMemo } from 'react';\nimport { ErrorOption, UseFormReturn } from 'react-hook-form';\nimport { FieldBase } from '@digigov/form/Field/FieldBase';\nimport { CalculatedField, FieldProps } from '@digigov/form/Field/types';\nimport {\n FIELD_COMPONENTS,\n ALTERNATIVE_COMPONENTS,\n} from '@digigov/form/Field/utils';\nimport { calculateField } from '@digigov/form/Field/utils/calculateField';\nimport { Fieldset, FieldsetCaption } from '@digigov/form/Fieldset';\nimport { FieldSpec } from '@digigov/form/types';\nimport { FieldsetLegend } from '@digigov/ui/form/FieldContainer';\nimport { useTranslation } from '@digigov/ui/i18n';\n\nexport interface FieldObjectProps extends Omit<FieldProps, 'key'> {\n control: UseFormReturn['control'];\n register: UseFormReturn['register'];\n reset: UseFormReturn['reset'];\n formState: UseFormReturn['formState'];\n error?: ErrorOption;\n Field: React.FC<FieldProps>;\n}\n\nexport const FieldObject: React.FC<FieldObjectProps> = ({\n name,\n label,\n extra,\n control,\n register,\n reset,\n formState,\n error,\n Field,\n}) => {\n const { t } = useTranslation();\n\n return (\n <Fieldset>\n {label?.primary && (\n <FieldsetLegend size=\"sm\">{t(label.primary)}</FieldsetLegend>\n )}\n {label?.secondary && (\n <FieldsetCaption>{t(label.secondary)}</FieldsetCaption>\n )}\n {extra?.fields.map((field) => (\n <FieldObjectItem\n key={`${name}.${field.key}`}\n name={`${name}.${field.key}`}\n control={control}\n register={register}\n reset={reset}\n field={field}\n error={error && error[field.key]}\n formState={formState}\n Field={Field}\n />\n ))}\n </Fieldset>\n );\n};\n\nexport interface FieldObjectItemProps {\n name: string;\n field: FieldSpec;\n control: UseFormReturn['control'];\n register: UseFormReturn['register'];\n reset: UseFormReturn['reset'];\n formState: UseFormReturn['formState'];\n error?: ErrorOption;\n children?: React.ReactNode;\n Field: React.FC<FieldProps>;\n}\n\nconst FieldObjectItem: React.FC<FieldObjectItemProps> = ({\n name,\n children,\n field,\n error,\n control,\n formState,\n reset,\n register,\n Field,\n}) => {\n const calculatedField: CalculatedField = useMemo(\n () =>\n calculateField(children, field, FIELD_COMPONENTS, ALTERNATIVE_COMPONENTS),\n [field]\n );\n\n const customError = error ? error : formState?.errors[name];\n return (\n <FieldBase\n {...calculatedField}\n name={name}\n Field={Field}\n control={control}\n reset={reset}\n register={register}\n error={customError}\n />\n );\n};\n\nexport default FieldObject;\n"],
|
|
5
|
-
"mappings": "AAAA,OAAO,SAAS,eAAe;AAE/B,SAAS,iBAAiB;AAE1B;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,sBAAsB;AAC/B,SAAS,UAAU,uBAAuB;AAE1C,SAAS,sBAAsB;AAC/B,SAAS,sBAAsB;AAWxB,MAAM,cAA0C,CAAC;AAAA,EACtD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,EAAE,EAAE,IAAI,eAAe;AAE7B,SACE,oCAAC,gBACE,OAAO,WACN,oCAAC,kBAAe,MAAK,QAAM,EAAE,MAAM,OAAO,CAAE,GAE7C,OAAO,aACN,oCAAC,uBAAiB,EAAE,MAAM,SAAS,CAAE,GAEtC,OAAO,OAAO,IAAI,CAAC,UAClB;AAAA,IAAC;AAAA;AAAA,MACC,KAAK,GAAG,IAAI,IAAI,MAAM,GAAG;AAAA,MACzB,MAAM,GAAG,IAAI,IAAI,MAAM,GAAG;AAAA,MAC1B;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,OAAO,SAAS,MAAM,MAAM,GAAG;AAAA,MAC/B;AAAA,MACA;AAAA;AAAA,EACF,CACD,CACH;AAEJ;AAcA,MAAM,kBAAkD,CAAC;AAAA,EACvD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,kBAAmC;AAAA,IACvC,MACE,eAAe,UAAU,OAAO,kBAAkB,sBAAsB;AAAA,IAC1E,CAAC,KAAK;AAAA,EACR;AAEA,QAAM,cAAc,QAAQ,QAAQ,WAAW,OAAO,IAAI;AAC1D,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,OAAO;AAAA;AAAA,EACT;AAEJ;AAEA,IAAO,sBAAQ;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/FieldObject/package.json
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import React, { useContext, useMemo } from "react";
|
|
2
|
-
import Field from "@digigov/form/Field";
|
|
3
|
-
import {
|
|
4
|
-
Fieldset,
|
|
5
|
-
FieldsetLabel,
|
|
6
|
-
FieldsetCaption,
|
|
7
|
-
FieldsetBody
|
|
8
|
-
} from "@digigov/form/Fieldset/";
|
|
9
|
-
import { FormContext } from "@digigov/form/FormContext";
|
|
10
|
-
import { useTranslation } from "@digigov/ui/i18n";
|
|
11
|
-
const FieldsetWithContext = ({ name }) => {
|
|
12
|
-
const { label, body, fields } = useFieldset(name);
|
|
13
|
-
const { t } = useTranslation();
|
|
14
|
-
return useMemo(
|
|
15
|
-
() => /* @__PURE__ */ React.createElement(Fieldset, null, label?.primary && /* @__PURE__ */ React.createElement(FieldsetLabel, null, t(label.primary)), label?.secondary && /* @__PURE__ */ React.createElement(FieldsetCaption, null, t(label.secondary)), body && /* @__PURE__ */ React.createElement(FieldsetBody, null, body), fields.map((field) => /* @__PURE__ */ React.createElement(Field, { key: field, name: field }))),
|
|
16
|
-
[label?.primary, label?.secondary, body, fields]
|
|
17
|
-
);
|
|
18
|
-
};
|
|
19
|
-
const useFieldset = (name) => {
|
|
20
|
-
const { fieldsetsMap } = useContext(FormContext);
|
|
21
|
-
if (fieldsetsMap && fieldsetsMap[name]) {
|
|
22
|
-
return useMemo(() => fieldsetsMap[name], [name]);
|
|
23
|
-
} else {
|
|
24
|
-
if (!fieldsetsMap) throw new Error(`Fieldsets is not defined`);
|
|
25
|
-
throw new Error(`No fieldset with name ${name} found`);
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
export {
|
|
29
|
-
FieldsetWithContext
|
|
30
|
-
};
|
|
31
|
-
//# sourceMappingURL=FieldsetWithContext.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/Fieldset/FieldsetWithContext.tsx"],
|
|
4
|
-
"sourcesContent": ["import React, { useContext, useMemo } from 'react';\nimport Field from '@digigov/form/Field';\nimport {\n Fieldset,\n FieldsetLabel,\n FieldsetCaption,\n FieldsetBody,\n} from '@digigov/form/Fieldset/';\nimport { FormContext } from '@digigov/form/FormContext';\nimport { FieldsetSpec } from '@digigov/form/types';\nimport { useTranslation } from '@digigov/ui/i18n';\n\nexport const FieldsetWithContext: React.FC<{ name: string }> = ({ name }) => {\n const { label, body, fields } = useFieldset(name);\n const { t } = useTranslation();\n return useMemo(\n () => (\n <Fieldset>\n {label?.primary && <FieldsetLabel>{t(label.primary)}</FieldsetLabel>}\n {label?.secondary && (\n <FieldsetCaption>{t(label.secondary)}</FieldsetCaption>\n )}\n {body && <FieldsetBody>{body}</FieldsetBody>}\n {fields.map((field) => (\n <Field key={field} name={field} />\n ))}\n </Fieldset>\n ),\n [label?.primary, label?.secondary, body, fields]\n );\n};\n\nconst useFieldset = (name: string): FieldsetSpec => {\n const { fieldsetsMap } = useContext(FormContext);\n if (fieldsetsMap && fieldsetsMap[name]) {\n return useMemo(() => fieldsetsMap[name], [name]);\n } else {\n if (!fieldsetsMap) throw new Error(`Fieldsets is not defined`);\n throw new Error(`No fieldset with name ${name} found`);\n }\n};\n"],
|
|
5
|
-
"mappings": "AAAA,OAAO,SAAS,YAAY,eAAe;AAC3C,OAAO,WAAW;AAClB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,mBAAmB;AAE5B,SAAS,sBAAsB;AAExB,MAAM,sBAAkD,CAAC,EAAE,KAAK,MAAM;AAC3E,QAAM,EAAE,OAAO,MAAM,OAAO,IAAI,YAAY,IAAI;AAChD,QAAM,EAAE,EAAE,IAAI,eAAe;AAC7B,SAAO;AAAA,IACL,MACE,oCAAC,gBACE,OAAO,WAAW,oCAAC,qBAAe,EAAE,MAAM,OAAO,CAAE,GACnD,OAAO,aACN,oCAAC,uBAAiB,EAAE,MAAM,SAAS,CAAE,GAEtC,QAAQ,oCAAC,oBAAc,IAAK,GAC5B,OAAO,IAAI,CAAC,UACX,oCAAC,SAAM,KAAK,OAAO,MAAM,OAAO,CACjC,CACH;AAAA,IAEF,CAAC,OAAO,SAAS,OAAO,WAAW,MAAM,MAAM;AAAA,EACjD;AACF;AAEA,MAAM,cAAc,CAAC,SAA+B;AAClD,QAAM,EAAE,aAAa,IAAI,WAAW,WAAW;AAC/C,MAAI,gBAAgB,aAAa,IAAI,GAAG;AACtC,WAAO,QAAQ,MAAM,aAAa,IAAI,GAAG,CAAC,IAAI,CAAC;AAAA,EACjD,OAAO;AACL,QAAI,CAAC,aAAc,OAAM,IAAI,MAAM,0BAA0B;AAC7D,UAAM,IAAI,MAAM,yBAAyB,IAAI,QAAQ;AAAA,EACvD;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/Fieldset/index.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/Fieldset/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import React from 'react';\nimport {\n FieldsetLabelProps,\n FieldsetCaptionProps,\n FieldsetBodyProps,\n} from '@digigov/form/Fieldset/types';\nimport { Fieldset } from '@digigov/react-core/Fieldset';\nimport { FieldsetLegend } from '@digigov/ui/form/FieldContainer';\nimport { Grid } from '@digigov/ui/layouts/Grid';\nimport { Hint } from '@digigov/ui/typography/Hint';\nimport { NormalText } from '@digigov/ui/typography/NormalText';\n\nexport const FieldsetLabel: React.FC<FieldsetLabelProps> = ({\n children,\n ...props\n}) => {\n return (\n <FieldsetLegend heading size=\"xl\" {...props}>\n {children}\n </FieldsetLegend>\n );\n};\n\nexport const FieldsetCaption: React.FC<FieldsetCaptionProps> = ({\n children,\n ...props\n}) => {\n return <Hint {...props}>{children}</Hint>;\n};\n\nexport const FieldsetBody: React.FC<FieldsetBodyProps> = ({ children }) => {\n return (\n <Grid item xs={12}>\n <NormalText>{children}</NormalText>\n </Grid>\n );\n};\n\nexport { Fieldset };\nexport default Fieldset;\n"],
|
|
5
|
-
"mappings": "AAAA,OAAO,WAAW;AAMlB,SAAS,gBAAgB;AACzB,SAAS,sBAAsB;AAC/B,SAAS,YAAY;AACrB,SAAS,YAAY;AACrB,SAAS,kBAAkB;AAEpB,MAAM,gBAA8C,CAAC;AAAA,EAC1D;AAAA,EACA,GAAG;AACL,MAAM;AACJ,SACE,oCAAC,kBAAe,SAAO,MAAC,MAAK,MAAM,GAAG,SACnC,QACH;AAEJ;AAEO,MAAM,kBAAkD,CAAC;AAAA,EAC9D;AAAA,EACA,GAAG;AACL,MAAM;AACJ,SAAO,oCAAC,QAAM,GAAG,SAAQ,QAAS;AACpC;AAEO,MAAM,eAA4C,CAAC,EAAE,SAAS,MAAM;AACzE,SACE,oCAAC,QAAK,MAAI,MAAC,IAAI,MACb,oCAAC,kBAAY,QAAS,CACxB;AAEJ;AAGA,IAAO,mBAAQ;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/Fieldset/package.json
DELETED
package/Fieldset/types/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=types.js.map
|
package/Fieldset/types.js.map
DELETED
package/Form.stories.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
declare namespace _default {
|
|
2
|
-
export let title: string;
|
|
3
|
-
export { FormBuilder as component };
|
|
4
|
-
export let displayName: string;
|
|
5
|
-
}
|
|
6
|
-
export default _default;
|
|
7
|
-
export { Default } from "@digigov/form/FormBuilder/__stories__/Default";
|
|
8
|
-
import FormBuilder from '@digigov/form/FormBuilder';
|
package/FormBuilder/index.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/FormBuilder/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import React, { useCallback, useContext, useRef } from 'react';\nimport { useForm } from 'react-hook-form';\nimport { Field } from '@digigov/form/Field';\nimport { CONTROLLED_FIELD_COMPONENTS } from '@digigov/form/Field/utils';\nimport { Fieldset } from '@digigov/form/Fieldset';\nimport { FormContext } from '@digigov/form/FormContext';\nimport { FormBaseProps, FormData, FormBuilderProps } from '@digigov/form/types';\nimport { yupResolver } from '@digigov/form/utils';\nimport { useValidationSchema } from '@digigov/form/validators';\nimport { Button } from '@digigov/ui/form/Button';\nimport { Form } from '@digigov/ui/form/Form';\n\nconst FormBase = React.forwardRef(function FormBase(\n {\n onSubmit,\n children,\n registerField,\n fieldsMap,\n fieldsetsMap,\n resolver,\n mode,\n initial,\n reValidateMode,\n shouldFocusError,\n criteriaMode,\n componentRegistry,\n grid,\n ...props\n }: FormBaseProps,\n ref: React.Ref<HTMLFormElement>\n) {\n const form = useForm({\n resolver,\n mode,\n defaultValues: initial,\n reValidateMode,\n shouldFocusError,\n criteriaMode,\n });\n\n const handleSubmit = useCallback(\n (data: FormData): void => {\n if (onSubmit) onSubmit(data);\n },\n [onSubmit]\n );\n const submit = form.handleSubmit(handleSubmit);\n const ctx = {\n fieldsMap,\n fieldsetsMap,\n control: form.control,\n register: form.register,\n watch: form.watch,\n resetField: form.resetField,\n registerField: registerField,\n errors: form.formState.errors,\n formState: form.formState,\n reset: form.reset,\n trigger: form.trigger,\n getFieldState: form.getFieldState,\n setValue: form.setValue,\n clearErrors: form.clearErrors,\n getValues: form.getValues,\n unregister: form.unregister,\n componentRegistry,\n setError: form.setError,\n formRef: ref,\n submit,\n };\n return (\n <FormContext.Provider value={ctx}>\n <Form grid={grid} onSubmit={submit} ref={ref} {...props}>\n {children}\n </Form>\n </FormContext.Provider>\n );\n});\n\nconst useFormContext = () => {\n return useContext(FormContext);\n};\nconst useFormValues = () => {\n const ctx = useFormContext();\n return ctx.getValues();\n};\nconst FormBuilder = React.forwardRef(function FormBuilder(\n {\n fields = [],\n fieldsets,\n initial = {},\n onSubmit,\n children,\n reValidateMode = 'onSubmit',\n mode = 'onSubmit',\n shouldFocusError = true,\n criteriaMode = 'all',\n auto = false,\n validatorRegistry,\n componentRegistry,\n grid = false,\n ...props\n }: FormBuilderProps,\n ref: React.Ref<HTMLFormElement>\n): React.ReactElement {\n const fieldsState = useRef(fields);\n const setFieldsState = useCallback((newFields) => {\n fieldsState.current = newFields;\n }, []);\n const schema = useValidationSchema(fieldsState, validatorRegistry);\n const registerField = useCallback((field) => {\n const fieldIndex = fieldsState.current.findIndex(\n (f) => f.key === field.key\n );\n if (fieldIndex > -1) {\n fieldsState.current[fieldIndex] = field;\n } else {\n fieldsState.current.push(field);\n }\n setFieldsState(fieldsState.current);\n }, []);\n let resolver;\n let fieldsMap;\n let fieldsetsMap;\n let fieldChildren;\n if (schema) {\n resolver = yupResolver(schema);\n fieldsMap = fields\n ? fields.reduce((map, field) => ({ ...map, [field.key]: field }), {})\n : {};\n fieldsetsMap =\n fieldsets &&\n fieldsets.reduce(\n (map, fieldset) => ({ ...map, [fieldset.key]: fieldset }),\n {}\n );\n\n if (auto) {\n if (fieldsets) {\n fieldChildren = fieldsets.map((fieldset) => (\n <Fieldset key={fieldset.key} />\n ));\n } else if (fields) {\n fieldChildren = fields.map((field) => (\n <Field key={field.key} name={field.key} />\n ));\n }\n }\n }\n return (\n <FormBase\n resolver={resolver}\n fieldsetsMap={fieldsetsMap}\n fieldsMap={fieldsMap}\n registerField={registerField}\n initial={initial}\n reValidateMode={reValidateMode}\n mode={mode}\n shouldFocusError={shouldFocusError}\n criteriaMode={criteriaMode}\n onSubmit={onSubmit}\n componentRegistry={componentRegistry}\n ref={ref}\n grid={grid}\n {...props}\n >\n {fieldChildren}\n {auto && <Button type=\"submit\">\u03A3\u03C5\u03BD\u03AD\u03C7\u03B5\u03B9\u03B1</Button>}\n {children}\n </FormBase>\n );\n});\nexport const ControlledFormBuilder = (props) => {\n return (\n <FormBuilder {...props} componentRegistry={CONTROLLED_FIELD_COMPONENTS} />\n );\n};\nexport default FormBuilder;\n\nexport { useFormContext, useFormValues, FormBase };\n"],
|
|
5
|
-
"mappings": "AAAA,OAAO,SAAS,aAAa,YAAY,cAAc;AACvD,SAAS,eAAe;AACxB,SAAS,aAAa;AACtB,SAAS,mCAAmC;AAC5C,SAAS,gBAAgB;AACzB,SAAS,mBAAmB;AAE5B,SAAS,mBAAmB;AAC5B,SAAS,2BAA2B;AACpC,SAAS,cAAc;AACvB,SAAS,YAAY;AAErB,MAAM,WAAW,MAAM,WAAW,SAASA,UACzC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GACA,KACA;AACA,QAAM,OAAO,QAAQ;AAAA,IACnB;AAAA,IACA;AAAA,IACA,eAAe;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAED,QAAM,eAAe;AAAA,IACnB,CAAC,SAAyB;AACxB,UAAI,SAAU,UAAS,IAAI;AAAA,IAC7B;AAAA,IACA,CAAC,QAAQ;AAAA,EACX;AACA,QAAM,SAAS,KAAK,aAAa,YAAY;AAC7C,QAAM,MAAM;AAAA,IACV;AAAA,IACA;AAAA,IACA,SAAS,KAAK;AAAA,IACd,UAAU,KAAK;AAAA,IACf,OAAO,KAAK;AAAA,IACZ,YAAY,KAAK;AAAA,IACjB;AAAA,IACA,QAAQ,KAAK,UAAU;AAAA,IACvB,WAAW,KAAK;AAAA,IAChB,OAAO,KAAK;AAAA,IACZ,SAAS,KAAK;AAAA,IACd,eAAe,KAAK;AAAA,IACpB,UAAU,KAAK;AAAA,IACf,aAAa,KAAK;AAAA,IAClB,WAAW,KAAK;AAAA,IAChB,YAAY,KAAK;AAAA,IACjB;AAAA,IACA,UAAU,KAAK;AAAA,IACf,SAAS;AAAA,IACT;AAAA,EACF;AACA,SACE,oCAAC,YAAY,UAAZ,EAAqB,OAAO,OAC3B,oCAAC,QAAK,MAAY,UAAU,QAAQ,KAAW,GAAG,SAC/C,QACH,CACF;AAEJ,CAAC;AAED,MAAM,iBAAiB,MAAM;AAC3B,SAAO,WAAW,WAAW;AAC/B;AACA,MAAM,gBAAgB,MAAM;AAC1B,QAAM,MAAM,eAAe;AAC3B,SAAO,IAAI,UAAU;AACvB;AACA,MAAM,cAAc,MAAM,WAAW,SAASC,aAC5C;AAAA,EACE,SAAS,CAAC;AAAA,EACV;AAAA,EACA,UAAU,CAAC;AAAA,EACX;AAAA,EACA;AAAA,EACA,iBAAiB;AAAA,EACjB,OAAO;AAAA,EACP,mBAAmB;AAAA,EACnB,eAAe;AAAA,EACf,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP,GAAG;AACL,GACA,KACoB;AACpB,QAAM,cAAc,OAAO,MAAM;AACjC,QAAM,iBAAiB,YAAY,CAAC,cAAc;AAChD,gBAAY,UAAU;AAAA,EACxB,GAAG,CAAC,CAAC;AACL,QAAM,SAAS,oBAAoB,aAAa,iBAAiB;AACjE,QAAM,gBAAgB,YAAY,CAAC,UAAU;AAC3C,UAAM,aAAa,YAAY,QAAQ;AAAA,MACrC,CAAC,MAAM,EAAE,QAAQ,MAAM;AAAA,IACzB;AACA,QAAI,aAAa,IAAI;AACnB,kBAAY,QAAQ,UAAU,IAAI;AAAA,IACpC,OAAO;AACL,kBAAY,QAAQ,KAAK,KAAK;AAAA,IAChC;AACA,mBAAe,YAAY,OAAO;AAAA,EACpC,GAAG,CAAC,CAAC;AACL,MAAI;AACJ,MAAI;AACJ,MAAI;AACJ,MAAI;AACJ,MAAI,QAAQ;AACV,eAAW,YAAY,MAAM;AAC7B,gBAAY,SACR,OAAO,OAAO,CAAC,KAAK,WAAW,EAAE,GAAG,KAAK,CAAC,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,CAAC,IAClE,CAAC;AACL,mBACE,aACA,UAAU;AAAA,MACR,CAAC,KAAK,cAAc,EAAE,GAAG,KAAK,CAAC,SAAS,GAAG,GAAG,SAAS;AAAA,MACvD,CAAC;AAAA,IACH;AAEF,QAAI,MAAM;AACR,UAAI,WAAW;AACb,wBAAgB,UAAU,IAAI,CAAC,aAC7B,oCAAC,YAAS,KAAK,SAAS,KAAK,CAC9B;AAAA,MACH,WAAW,QAAQ;AACjB,wBAAgB,OAAO,IAAI,CAAC,UAC1B,oCAAC,SAAM,KAAK,MAAM,KAAK,MAAM,MAAM,KAAK,CACzC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AACA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACC,GAAG;AAAA;AAAA,IAEH;AAAA,IACA,QAAQ,oCAAC,UAAO,MAAK,YAAS,kDAAQ;AAAA,IACtC;AAAA,EACH;AAEJ,CAAC;AACM,MAAM,wBAAwB,CAAC,UAAU;AAC9C,SACE,oCAAC,eAAa,GAAG,OAAO,mBAAmB,6BAA6B;AAE5E;AACA,IAAO,sBAAQ;",
|
|
6
|
-
"names": ["FormBase", "FormBuilder"]
|
|
7
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/FormBuilder/package.json
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
export declare const INPUTS_FIELDS: ({
|
|
2
|
-
key: string;
|
|
3
|
-
type: string;
|
|
4
|
-
required: boolean;
|
|
5
|
-
label: {
|
|
6
|
-
primary: string;
|
|
7
|
-
secondary: string;
|
|
8
|
-
};
|
|
9
|
-
maxLength?: undefined;
|
|
10
|
-
extra?: undefined;
|
|
11
|
-
} | {
|
|
12
|
-
key: string;
|
|
13
|
-
type: string;
|
|
14
|
-
maxLength: number;
|
|
15
|
-
label: {
|
|
16
|
-
primary: string;
|
|
17
|
-
secondary?: undefined;
|
|
18
|
-
};
|
|
19
|
-
required: boolean;
|
|
20
|
-
extra?: undefined;
|
|
21
|
-
} | {
|
|
22
|
-
key: string;
|
|
23
|
-
type: string;
|
|
24
|
-
required: boolean;
|
|
25
|
-
label: {
|
|
26
|
-
primary: string;
|
|
27
|
-
secondary?: undefined;
|
|
28
|
-
};
|
|
29
|
-
extra: {
|
|
30
|
-
options: {
|
|
31
|
-
label: {
|
|
32
|
-
primary: string;
|
|
33
|
-
};
|
|
34
|
-
value: string;
|
|
35
|
-
}[];
|
|
36
|
-
component?: undefined;
|
|
37
|
-
multiple?: undefined;
|
|
38
|
-
};
|
|
39
|
-
maxLength?: undefined;
|
|
40
|
-
} | {
|
|
41
|
-
key: string;
|
|
42
|
-
required: boolean;
|
|
43
|
-
type: string;
|
|
44
|
-
label: {
|
|
45
|
-
primary: string;
|
|
46
|
-
secondary?: undefined;
|
|
47
|
-
};
|
|
48
|
-
extra: {
|
|
49
|
-
component: string;
|
|
50
|
-
multiple: boolean;
|
|
51
|
-
options: {
|
|
52
|
-
label: {
|
|
53
|
-
primary: string;
|
|
54
|
-
};
|
|
55
|
-
value: string;
|
|
56
|
-
}[];
|
|
57
|
-
};
|
|
58
|
-
maxLength?: undefined;
|
|
59
|
-
} | {
|
|
60
|
-
key: string;
|
|
61
|
-
type: string;
|
|
62
|
-
required: boolean;
|
|
63
|
-
label: {
|
|
64
|
-
primary: string;
|
|
65
|
-
secondary?: undefined;
|
|
66
|
-
};
|
|
67
|
-
extra: {
|
|
68
|
-
component: string;
|
|
69
|
-
options: {
|
|
70
|
-
label: {
|
|
71
|
-
primary: string;
|
|
72
|
-
};
|
|
73
|
-
value: string;
|
|
74
|
-
}[];
|
|
75
|
-
multiple?: undefined;
|
|
76
|
-
};
|
|
77
|
-
maxLength?: undefined;
|
|
78
|
-
} | {
|
|
79
|
-
key: string;
|
|
80
|
-
type: string;
|
|
81
|
-
required: boolean;
|
|
82
|
-
label: {
|
|
83
|
-
primary: string;
|
|
84
|
-
secondary?: undefined;
|
|
85
|
-
};
|
|
86
|
-
maxLength?: undefined;
|
|
87
|
-
extra?: undefined;
|
|
88
|
-
})[];
|