@digigov/form 2.0.0-85c27c19 → 2.0.0-8e254888
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/index.js +48 -0
- package/{Form.stories → Field/ErrorGroup}/package.json +1 -1
- package/Field/ErrorGroup.d.ts +15 -0
- package/Field/ErrorGroup.js.map +7 -0
- package/Field/FieldBase/index.js +31 -22
- package/Field/FieldBase.js.map +2 -2
- package/Field/FieldBaseContainer/index.js +5 -4
- package/Field/FieldBaseContainer.js.map +2 -2
- package/Field/FieldConditional/index.js +7 -3
- package/Field/FieldConditional.js.map +2 -2
- package/Field/index.js +10 -2
- package/Field/index.js.map +2 -2
- package/Field/types.d.ts +15 -9
- package/Field/utils/index.d.ts +1 -0
- package/Field/utils/index.js +24 -1
- package/Field/utils/index.js.map +2 -2
- package/Field/utils/useField/index.js +7 -1
- package/Field/utils/useField.js.map +2 -2
- package/FieldArray/FieldArray.stories.d.ts +1 -0
- package/FieldArray/FormDialog/index.js +279 -0
- package/{Questions/Questions.stories → FieldArray/FormDialog}/package.json +1 -1
- package/FieldArray/FormDialog.d.ts +53 -0
- package/FieldArray/FormDialog.js.map +7 -0
- package/FieldArray/__stories__/WithModal.d.ts +2 -0
- package/FieldArray/index.d.ts +6 -0
- package/FieldArray/index.js +59 -23
- package/FieldArray/index.js.map +2 -2
- package/FieldObject/index.d.ts +4 -0
- package/FieldObject/index.js +16 -8
- package/FieldObject/index.js.map +2 -2
- package/Fieldset/index.d.ts +1 -1
- package/Fieldset/index.js +5 -5
- package/Fieldset/index.js.map +2 -2
- package/Fieldset/types.d.ts +2 -3
- package/FormBuilder/FormBuilder.stories.d.ts +2 -0
- package/FormBuilder/__stories__/AutoErrorGrouping.d.ts +3 -0
- package/FormBuilder/__stories__/ErrorGrouping.d.ts +3 -0
- package/FormBuilder/index.d.ts +8 -2
- package/FormBuilder/index.js +229 -6
- package/FormBuilder/index.js.map +3 -3
- package/FormBuilder/interaction.test.d.ts +1 -0
- package/FormContext.js.map +2 -2
- package/MultiplicityField/add-objects/index.js +11 -7
- package/MultiplicityField/add-objects.js.map +2 -2
- package/MultiplicityField/index.js +17 -12
- package/MultiplicityField/index.js.map +2 -2
- package/MultiplicityField/types.d.ts +1 -2
- package/Questions/Questions/index.js +5 -4
- package/Questions/Questions.js.map +2 -2
- package/Questions/QuestionsContext.d.ts +0 -1
- package/Questions/Step/StepArrayReview.js.map +2 -2
- package/Questions/Step/StepContext.d.ts +0 -1
- package/Questions/Step/StepTitle/index.js +4 -3
- package/Questions/Step/StepTitle.d.ts +1 -1
- package/Questions/Step/StepTitle.js.map +2 -2
- package/Questions/Step/types.d.ts +0 -1
- package/Questions/types.d.ts +0 -1
- package/cjs/Field/ErrorGroup/index.js +82 -0
- package/cjs/Field/ErrorGroup.js.map +7 -0
- package/cjs/Field/FieldBase/index.js +30 -21
- package/cjs/Field/FieldBase.js.map +2 -2
- package/cjs/Field/FieldBaseContainer/index.js +5 -4
- package/cjs/Field/FieldBaseContainer.js.map +3 -3
- package/cjs/Field/FieldConditional/index.js +7 -3
- package/cjs/Field/FieldConditional.js.map +2 -2
- package/cjs/Field/index.js +10 -2
- package/cjs/Field/index.js.map +2 -2
- package/cjs/Field/types.js.map +1 -1
- package/cjs/Field/utils/index.js +24 -0
- package/cjs/Field/utils/index.js.map +3 -3
- package/cjs/Field/utils/useField/index.js +7 -1
- package/cjs/Field/utils/useField.js.map +2 -2
- package/cjs/FieldArray/FormDialog/index.js +301 -0
- package/cjs/FieldArray/FormDialog.js.map +7 -0
- package/cjs/FieldArray/index.js +58 -22
- package/cjs/FieldArray/index.js.map +3 -3
- package/cjs/FieldObject/index.js +17 -9
- package/cjs/FieldObject/index.js.map +3 -3
- package/cjs/Fieldset/index.js +10 -10
- package/cjs/Fieldset/index.js.map +3 -3
- package/cjs/Fieldset/types.js.map +1 -1
- package/cjs/FormBuilder/index.js +244 -5
- package/cjs/FormBuilder/index.js.map +3 -3
- package/cjs/FormContext/index.js +2 -2
- package/cjs/FormContext.js.map +3 -3
- package/cjs/MultiplicityField/add-objects/index.js +15 -11
- package/cjs/MultiplicityField/add-objects.js.map +3 -3
- package/cjs/MultiplicityField/index.js +16 -16
- package/cjs/MultiplicityField/index.js.map +3 -3
- package/cjs/MultiplicityField/types.js.map +1 -1
- package/cjs/Questions/Questions/index.js +5 -4
- package/cjs/Questions/Questions.js.map +2 -2
- package/cjs/Questions/Step/StepArrayReview.js.map +2 -2
- package/cjs/Questions/Step/StepTitle/index.js +5 -5
- package/cjs/Questions/Step/StepTitle.js.map +3 -3
- package/cjs/index.js +11 -155
- package/cjs/index.js.map +4 -4
- package/cjs/inputs/AutoCompleteInput/index.js +12 -9
- package/cjs/inputs/AutoCompleteInput/index.js.map +3 -3
- package/cjs/inputs/Checkboxes/index.js +9 -9
- package/cjs/inputs/Checkboxes/index.js.map +3 -3
- package/cjs/inputs/DateInput/index.js +10 -8
- package/cjs/inputs/DateInput/index.js.map +3 -3
- package/cjs/inputs/DateTimeInput/index.js +211 -0
- package/cjs/inputs/DateTimeInput/index.js.map +7 -0
- package/cjs/inputs/FileInput/index.js +41 -27
- package/cjs/inputs/FileInput/index.js.map +3 -3
- package/cjs/inputs/ImageInput/index.js +16 -10
- package/cjs/inputs/ImageInput/index.js.map +3 -3
- package/cjs/inputs/Input/index.js +29 -8
- package/cjs/inputs/Input/index.js.map +3 -3
- package/cjs/inputs/Input/inputsInputScenarios.js.map +2 -2
- package/cjs/inputs/Label/index.js +3 -3
- package/cjs/inputs/Label/index.js.map +3 -3
- package/cjs/inputs/OtpInput/index.js +1 -0
- package/cjs/inputs/OtpInput/index.js.map +2 -2
- package/cjs/inputs/Radio/index.js +57 -10
- package/cjs/inputs/Radio/index.js.map +3 -3
- package/cjs/inputs/Select/index.js +10 -5
- package/cjs/inputs/Select/index.js.map +3 -3
- package/cjs/inputs/inputsScenarios/index.js +4 -11
- package/cjs/inputs/inputsScenarios.js.map +2 -2
- package/cjs/lazy/index.js +49 -34
- package/cjs/lazy.js.map +3 -3
- package/cjs/locales/el.js.map +1 -1
- package/cjs/registry/index.js +72 -62
- package/cjs/registry.js.map +3 -3
- package/cjs/types.js.map +1 -1
- package/cjs/utils/index.js +2 -1
- package/cjs/utils.js.map +2 -2
- package/cjs/validators/index.js +44 -79
- package/cjs/validators/index.js.map +3 -3
- package/cjs/validators/utils/date/index.js +138 -0
- package/cjs/validators/utils/date.js.map +7 -0
- package/cjs/validators/utils/datetime/index.js +151 -0
- package/cjs/validators/utils/datetime.js.map +7 -0
- package/cjs/validators/utils/file/index.js +2 -2
- package/cjs/validators/utils/file.js.map +2 -2
- package/cjs/validators/utils/index.js +5 -1
- package/cjs/validators/utils/index.js.map +2 -2
- package/cjs/validators/utils/int/index.js +1 -1
- package/cjs/validators/utils/int.js.map +2 -2
- package/cjs/validators/utils/number/index.js +1 -1
- package/cjs/validators/utils/number.js.map +2 -2
- package/cjs/validators/utils/phone.js.map +2 -2
- package/cjs/validators/utils/postal_code.js.map +1 -1
- package/cjs/validators/utils/uuid4.js.map +2 -2
- package/index.d.ts +5 -8
- package/index.js +9 -152
- package/index.js.map +4 -4
- package/inputs/AutoCompleteInput/index.d.ts +1 -1
- package/inputs/AutoCompleteInput/index.js +14 -9
- package/inputs/AutoCompleteInput/index.js.map +2 -2
- package/inputs/Checkboxes/index.d.ts +1 -1
- package/inputs/Checkboxes/index.js +10 -6
- package/inputs/Checkboxes/index.js.map +2 -2
- package/inputs/DateInput/index.d.ts +1 -2
- package/inputs/DateInput/index.js +12 -7
- package/inputs/DateInput/index.js.map +2 -2
- package/inputs/DateTimeInput/DateTimeInput.stories.d.ts +7 -0
- package/inputs/DateTimeInput/__stories__/Default.d.ts +3 -0
- package/inputs/DateTimeInput/index.d.ts +13 -0
- package/inputs/DateTimeInput/index.js +181 -0
- package/inputs/DateTimeInput/index.js.map +7 -0
- package/inputs/DateTimeInput/index.test.d.ts +1 -0
- package/inputs/{Input/Input.stories → DateTimeInput}/package.json +1 -1
- package/inputs/FileInput/index.d.ts +9 -0
- package/inputs/FileInput/index.js +41 -27
- package/inputs/FileInput/index.js.map +2 -2
- package/inputs/ImageInput/ImageInput.stories.d.ts +1 -1
- package/inputs/ImageInput/__stories__/MaxSize.d.ts +3 -0
- package/inputs/ImageInput/index.js +15 -9
- package/inputs/ImageInput/index.js.map +2 -2
- package/inputs/Input/Input.stories.d.ts +1 -0
- package/inputs/Input/__stories__/StringWithTrimValidation.d.ts +3 -0
- package/inputs/Input/index.js +27 -6
- package/inputs/Input/index.js.map +3 -3
- package/inputs/Input/inputsInputScenarios.js.map +2 -2
- package/inputs/Label/index.d.ts +0 -2
- package/inputs/Label/index.js +2 -2
- package/inputs/Label/index.js.map +2 -2
- package/inputs/OtpInput/index.js +1 -0
- package/inputs/OtpInput/index.js.map +2 -2
- package/inputs/Radio/index.d.ts +5 -1
- package/inputs/Radio/index.js +58 -8
- package/inputs/Radio/index.js.map +2 -2
- package/inputs/Select/index.d.ts +1 -1
- package/inputs/Select/index.js +11 -3
- package/inputs/Select/index.js.map +2 -2
- package/inputs/inputsScenarios/index.js +4 -11
- package/inputs/inputsScenarios.d.ts +0 -42
- package/inputs/inputsScenarios.js.map +2 -2
- package/lazy/index.js +76 -65
- package/locales/el.js.map +1 -1
- package/package.json +4 -4
- package/registry/index.js +116 -107
- package/src/Field/ErrorGroup.tsx +84 -0
- package/src/Field/FieldBase.tsx +34 -22
- package/src/Field/FieldBaseContainer.tsx +7 -4
- package/src/Field/FieldConditional.tsx +4 -0
- package/src/Field/index.tsx +9 -1
- package/src/Field/types.tsx +15 -8
- package/src/Field/utils/index.ts +24 -1
- package/src/Field/utils/useField.ts +7 -3
- package/src/FieldArray/FieldArray.stories.js +1 -0
- package/src/FieldArray/FormDialog.tsx +378 -0
- package/src/FieldArray/__stories__/Default.tsx +1 -0
- package/src/FieldArray/__stories__/WithExactLength.tsx +1 -0
- package/src/FieldArray/__stories__/WithModal.tsx +159 -0
- package/src/FieldArray/index.test.tsx +4 -0
- package/src/FieldArray/index.tsx +88 -43
- package/src/FieldObject/index.tsx +17 -5
- package/src/Fieldset/index.tsx +5 -5
- package/src/Fieldset/types.tsx +2 -2
- package/src/FormBuilder/FormBuilder.stories.js +2 -0
- package/src/FormBuilder/__stories__/AutoErrorGrouping.tsx +63 -0
- package/src/FormBuilder/__stories__/ErrorGrouping.tsx +43 -0
- package/src/FormBuilder/{FormBuilder.mdx → doc.mdx} +20 -33
- package/src/FormBuilder/index.test.tsx +8 -0
- package/src/FormBuilder/index.tsx +264 -7
- package/src/FormBuilder/interaction.test.tsx +32 -0
- package/src/FormBuilder/scenarios.test.tsx +121 -7
- package/src/FormContext.tsx +1 -2
- package/src/MultiplicityField/add-objects.tsx +10 -8
- package/src/MultiplicityField/{MultiplicityField.mdx → doc.mdx} +12 -16
- package/src/MultiplicityField/index.tsx +16 -12
- package/src/MultiplicityField/types.ts +1 -2
- package/src/Questions/Questions.tsx +4 -4
- package/src/Questions/Step/StepArrayReview.tsx +1 -1
- package/src/Questions/Step/StepTitle.tsx +4 -3
- package/src/Questions/__snapshots__/index.spec.tsx.snap +10 -5
- package/src/Questions/{index.mdx → doc.mdx} +9 -12
- package/src/Questions/index.spec.tsx +14 -2
- package/src/create-simple-form.mdx +2 -6
- package/src/{index.mdx → doc.mdx} +4 -8
- package/src/index.ts +6 -0
- package/src/inputs/AutoCompleteInput/__stories__/Default.tsx +2 -10
- package/src/inputs/AutoCompleteInput/__stories__/Multiple.tsx +1 -8
- package/src/inputs/AutoCompleteInput/{index.mdx → doc.mdx} +2 -13
- package/src/inputs/AutoCompleteInput/index.tsx +37 -31
- package/src/inputs/Checkboxes/{index.mdx → doc.mdx} +5 -15
- package/src/inputs/Checkboxes/index.tsx +12 -8
- package/src/inputs/DateInput/__stories__/Default.tsx +7 -12
- package/src/inputs/DateInput/{index.mdx → doc.mdx} +1 -8
- package/src/inputs/DateInput/index.tsx +12 -7
- package/src/inputs/DateTimeInput/DateTimeInput.stories.js +8 -0
- package/src/inputs/DateTimeInput/__stories__/Default.tsx +25 -0
- package/src/inputs/DateTimeInput/doc.mdx +16 -0
- package/src/inputs/DateTimeInput/index.test.tsx +20 -0
- package/src/inputs/DateTimeInput/index.tsx +194 -0
- package/src/inputs/FileInput/{index.mdx → doc.mdx} +1 -5
- package/src/inputs/FileInput/index.tsx +33 -10
- package/src/inputs/ImageInput/ImageInput.stories.js +1 -1
- package/src/inputs/ImageInput/__stories__/MaxSize.tsx +37 -0
- package/src/inputs/ImageInput/__stories__/WithInvalidImageDimension.tsx +2 -0
- package/src/inputs/ImageInput/doc.mdx +23 -0
- package/src/inputs/ImageInput/index.test.tsx +4 -0
- package/src/inputs/ImageInput/index.tsx +17 -16
- package/src/inputs/Input/Input.stories.js +1 -0
- package/src/inputs/Input/__stories__/LandlineNumber.tsx +2 -1
- package/src/inputs/Input/__stories__/MobilePhone.tsx +1 -0
- package/src/inputs/Input/__stories__/PhoneNumber.tsx +1 -0
- package/src/inputs/Input/__stories__/PostalCode.tsx +1 -0
- package/src/inputs/Input/__stories__/StringWithTrimValidation.tsx +26 -0
- package/src/inputs/Input/__stories__/TextWithLimit.tsx +1 -0
- package/src/inputs/Input/doc.mdx +56 -0
- package/src/inputs/Input/index.test.tsx +4 -0
- package/src/inputs/Input/index.tsx +41 -30
- package/src/inputs/Input/inputsInputScenarios.ts +244 -245
- package/src/inputs/Label/doc.mdx +14 -0
- package/src/inputs/Label/index.tsx +2 -6
- package/src/inputs/OtpInput/{index.mdx → doc.mdx} +1 -8
- package/src/inputs/OtpInput/index.tsx +3 -1
- package/src/inputs/Radio/__stories__/Conditional.tsx +2 -1
- package/src/inputs/Radio/{index.mdx → doc.mdx} +5 -15
- package/src/inputs/Radio/index.tsx +77 -10
- package/src/inputs/Select/{index.mdx → doc.mdx} +1 -5
- package/src/inputs/Select/index.tsx +12 -4
- package/src/inputs/inputsScenarios.ts +174 -181
- package/src/installation.mdx +2 -5
- package/src/lazy.js +76 -62
- package/src/locales/el.ts +1 -1
- package/src/registry.js +108 -100
- package/src/types.tsx +3 -2
- package/src/utils.ts +2 -2
- package/src/validators/index.ts +86 -85
- package/src/validators/utils/date.ts +107 -0
- package/src/validators/utils/datetime.ts +130 -0
- package/src/validators/utils/file.ts +5 -3
- package/src/validators/utils/index.ts +2 -0
- package/src/validators/utils/int.ts +1 -1
- package/src/validators/utils/number.ts +1 -1
- package/src/validators/utils/phone.ts +1 -1
- package/src/validators/utils/postal_code.ts +1 -1
- package/src/validators/utils/uuid4.ts +2 -1
- package/src/validators/validators.spec.ts +3 -3
- package/types.d.ts +3 -3
- package/types.js.map +1 -1
- package/utils/index.js +2 -1
- package/utils.js.map +2 -2
- package/validators/index.js +51 -80
- package/validators/index.js.map +2 -2
- package/validators/utils/date/index.js +103 -0
- package/{FieldArray/FieldArray.stories → validators/utils/date}/package.json +1 -1
- package/validators/utils/date.d.ts +9 -0
- package/validators/utils/date.js.map +7 -0
- package/validators/utils/datetime/index.js +116 -0
- package/validators/utils/datetime/package.json +6 -0
- package/validators/utils/datetime.d.ts +9 -0
- package/validators/utils/datetime.js.map +7 -0
- package/validators/utils/file/index.js +2 -2
- package/validators/utils/file.js.map +2 -2
- package/validators/utils/index.d.ts +2 -0
- package/validators/utils/index.js +2 -0
- package/validators/utils/index.js.map +2 -2
- package/validators/utils/int/index.js +1 -1
- package/validators/utils/int.js.map +2 -2
- package/validators/utils/number/index.js +1 -1
- package/validators/utils/number.js.map +2 -2
- package/validators/utils/phone.d.ts +1 -1
- package/validators/utils/phone.js.map +2 -2
- package/validators/utils/postal_code.d.ts +1 -1
- package/validators/utils/postal_code.js.map +1 -1
- package/validators/utils/uuid4.js.map +2 -2
- package/FieldArray/FieldArray.stories/index.js +0 -14
- package/FieldArray/FieldArray.stories.js.map +0 -7
- package/FieldArray/__stories__/Default/index.js +0 -95
- package/FieldArray/__stories__/Default/package.json +0 -6
- package/FieldArray/__stories__/Default.js.map +0 -7
- package/FieldArray/__stories__/WithExactLength/index.js +0 -95
- package/FieldArray/__stories__/WithExactLength/package.json +0 -6
- package/FieldArray/__stories__/WithExactLength.js.map +0 -7
- package/Form.stories/index.js +0 -7
- package/Form.stories.js.map +0 -7
- package/FormBuilder/FormBuilder.stories/index.js +0 -12
- package/FormBuilder/FormBuilder.stories/package.json +0 -6
- package/FormBuilder/FormBuilder.stories.js.map +0 -7
- package/FormBuilder/__stories__/Default/index.js +0 -32
- package/FormBuilder/__stories__/Default/package.json +0 -6
- package/FormBuilder/__stories__/Default.js.map +0 -7
- package/MultiplicityField/MultiplicityField.stories/index.js +0 -22
- package/MultiplicityField/MultiplicityField.stories/package.json +0 -6
- package/MultiplicityField/MultiplicityField.stories.js.map +0 -7
- package/MultiplicityField/__stories__/Default/index.js +0 -100
- package/MultiplicityField/__stories__/Default/package.json +0 -6
- package/MultiplicityField/__stories__/Default.js.map +0 -7
- package/MultiplicityField/__stories__/PreviewDisplay/index.js +0 -70
- package/MultiplicityField/__stories__/PreviewDisplay/package.json +0 -6
- package/MultiplicityField/__stories__/PreviewDisplay.js.map +0 -7
- package/MultiplicityField/__stories__/WithExactLength/index.js +0 -97
- package/MultiplicityField/__stories__/WithExactLength/package.json +0 -6
- package/MultiplicityField/__stories__/WithExactLength.js.map +0 -7
- package/MultiplicityField/__stories__/WithMaxLength/index.js +0 -100
- package/MultiplicityField/__stories__/WithMaxLength/package.json +0 -6
- package/MultiplicityField/__stories__/WithMaxLength.js.map +0 -7
- package/MultiplicityField/__stories__/WithMinAndMaxLength/index.js +0 -101
- package/MultiplicityField/__stories__/WithMinAndMaxLength/package.json +0 -6
- package/MultiplicityField/__stories__/WithMinAndMaxLength.js.map +0 -7
- package/MultiplicityField/__stories__/WithMinLength/index.js +0 -100
- package/MultiplicityField/__stories__/WithMinLength/package.json +0 -6
- package/MultiplicityField/__stories__/WithMinLength.js.map +0 -7
- package/Questions/Questions.stories/index.js +0 -12
- package/Questions/Questions.stories.js.map +0 -7
- package/Questions/__stories__/Default/index.js +0 -108
- package/Questions/__stories__/Default/package.json +0 -6
- package/Questions/__stories__/Default.js.map +0 -7
- package/cjs/FieldArray/FieldArray.stories/index.js +0 -48
- package/cjs/FieldArray/FieldArray.stories.js.map +0 -7
- package/cjs/FieldArray/__stories__/Default/index.js +0 -128
- package/cjs/FieldArray/__stories__/Default.js.map +0 -7
- package/cjs/FieldArray/__stories__/WithExactLength/index.js +0 -128
- package/cjs/FieldArray/__stories__/WithExactLength.js.map +0 -7
- package/cjs/Form.stories/index.js +0 -26
- package/cjs/Form.stories.js.map +0 -7
- package/cjs/FormBuilder/FormBuilder.stories/index.js +0 -45
- package/cjs/FormBuilder/FormBuilder.stories.js.map +0 -7
- package/cjs/FormBuilder/__stories__/Default/index.js +0 -65
- package/cjs/FormBuilder/__stories__/Default.js.map +0 -7
- package/cjs/MultiplicityField/MultiplicityField.stories/index.js +0 -60
- package/cjs/MultiplicityField/MultiplicityField.stories.js.map +0 -7
- package/cjs/MultiplicityField/__stories__/Default/index.js +0 -133
- package/cjs/MultiplicityField/__stories__/Default.js.map +0 -7
- package/cjs/MultiplicityField/__stories__/PreviewDisplay/index.js +0 -86
- package/cjs/MultiplicityField/__stories__/PreviewDisplay.js.map +0 -7
- package/cjs/MultiplicityField/__stories__/WithExactLength/index.js +0 -130
- package/cjs/MultiplicityField/__stories__/WithExactLength.js.map +0 -7
- package/cjs/MultiplicityField/__stories__/WithMaxLength/index.js +0 -133
- package/cjs/MultiplicityField/__stories__/WithMaxLength.js.map +0 -7
- package/cjs/MultiplicityField/__stories__/WithMinAndMaxLength/index.js +0 -134
- package/cjs/MultiplicityField/__stories__/WithMinAndMaxLength.js.map +0 -7
- package/cjs/MultiplicityField/__stories__/WithMinLength/index.js +0 -133
- package/cjs/MultiplicityField/__stories__/WithMinLength.js.map +0 -7
- package/cjs/Questions/Questions.stories/index.js +0 -45
- package/cjs/Questions/Questions.stories.js.map +0 -7
- package/cjs/Questions/__stories__/Default/index.js +0 -136
- package/cjs/Questions/__stories__/Default.js.map +0 -7
- package/cjs/inputs/AutoCompleteInput/AutoComplete.stories/index.js +0 -48
- package/cjs/inputs/AutoCompleteInput/AutoComplete.stories.js.map +0 -7
- package/cjs/inputs/AutoCompleteInput/__stories__/Default/index.js +0 -83
- package/cjs/inputs/AutoCompleteInput/__stories__/Default.js.map +0 -7
- package/cjs/inputs/AutoCompleteInput/__stories__/Multiple/index.js +0 -84
- package/cjs/inputs/AutoCompleteInput/__stories__/Multiple.js.map +0 -7
- package/cjs/inputs/Checkboxes/Checkboxes.stories/index.js +0 -51
- package/cjs/inputs/Checkboxes/Checkboxes.stories.js.map +0 -7
- package/cjs/inputs/Checkboxes/__stories__/Conditional/index.js +0 -133
- package/cjs/inputs/Checkboxes/__stories__/Conditional.js.map +0 -7
- package/cjs/inputs/Checkboxes/__stories__/Default/index.js +0 -77
- package/cjs/inputs/Checkboxes/__stories__/Default.js.map +0 -7
- package/cjs/inputs/Checkboxes/__stories__/WithDivider/index.js +0 -78
- package/cjs/inputs/Checkboxes/__stories__/WithDivider.js.map +0 -7
- package/cjs/inputs/DateInput/DateInput.stories/index.js +0 -45
- package/cjs/inputs/DateInput/DateInput.stories.js.map +0 -7
- package/cjs/inputs/DateInput/__stories__/Default/index.js +0 -61
- package/cjs/inputs/DateInput/__stories__/Default.js.map +0 -7
- package/cjs/inputs/FileInput/FileInput.stories/index.js +0 -45
- package/cjs/inputs/FileInput/FileInput.stories.js.map +0 -7
- package/cjs/inputs/FileInput/__stories__/Default/index.js +0 -61
- package/cjs/inputs/FileInput/__stories__/Default.js.map +0 -7
- package/cjs/inputs/ImageInput/ImageInput.stories/index.js +0 -51
- package/cjs/inputs/ImageInput/ImageInput.stories.js.map +0 -7
- package/cjs/inputs/ImageInput/__stories__/Default/index.js +0 -63
- package/cjs/inputs/ImageInput/__stories__/Default.js.map +0 -7
- package/cjs/inputs/ImageInput/__stories__/WithInvalidImageDimension/index.js +0 -71
- package/cjs/inputs/ImageInput/__stories__/WithInvalidImageDimension.js.map +0 -7
- package/cjs/inputs/ImageInput/__stories__/WithInvalidImageSize/index.js +0 -68
- package/cjs/inputs/ImageInput/__stories__/WithInvalidImageSize.js.map +0 -7
- package/cjs/inputs/Input/Input.stories/index.js +0 -72
- package/cjs/inputs/Input/Input.stories.js.map +0 -7
- package/cjs/inputs/Input/__stories__/AFM/index.js +0 -63
- package/cjs/inputs/Input/__stories__/AFM.js.map +0 -7
- package/cjs/inputs/Input/__stories__/Boolean/index.js +0 -64
- package/cjs/inputs/Input/__stories__/Boolean.js.map +0 -7
- package/cjs/inputs/Input/__stories__/IBAN/index.js +0 -64
- package/cjs/inputs/Input/__stories__/IBAN.js.map +0 -7
- package/cjs/inputs/Input/__stories__/Integer/index.js +0 -78
- package/cjs/inputs/Input/__stories__/Integer.js.map +0 -7
- package/cjs/inputs/Input/__stories__/LandlineNumber/index.js +0 -67
- package/cjs/inputs/Input/__stories__/LandlineNumber.js.map +0 -7
- package/cjs/inputs/Input/__stories__/MobilePhone/index.js +0 -67
- package/cjs/inputs/Input/__stories__/MobilePhone.js.map +0 -7
- package/cjs/inputs/Input/__stories__/PhoneNumber/index.js +0 -66
- package/cjs/inputs/Input/__stories__/PhoneNumber.js.map +0 -7
- package/cjs/inputs/Input/__stories__/PostalCode/index.js +0 -64
- package/cjs/inputs/Input/__stories__/PostalCode.js.map +0 -7
- package/cjs/inputs/Input/__stories__/String/index.js +0 -64
- package/cjs/inputs/Input/__stories__/String.js.map +0 -7
- package/cjs/inputs/Input/__stories__/TextWithLimit/index.js +0 -64
- package/cjs/inputs/Input/__stories__/TextWithLimit.js.map +0 -7
- package/cjs/inputs/Label/Label.stories/index.js +0 -45
- package/cjs/inputs/Label/Label.stories.js.map +0 -7
- package/cjs/inputs/Label/__stories__/Default/index.js +0 -72
- package/cjs/inputs/Label/__stories__/Default.js.map +0 -7
- package/cjs/inputs/OtpInput/OtpInput.stories/index.js +0 -45
- package/cjs/inputs/OtpInput/OtpInput.stories.js.map +0 -7
- package/cjs/inputs/OtpInput/__stories__/Default/index.js +0 -64
- package/cjs/inputs/OtpInput/__stories__/Default.js.map +0 -7
- package/cjs/inputs/Radio/Radio.stories/index.js +0 -51
- package/cjs/inputs/Radio/Radio.stories.js.map +0 -7
- package/cjs/inputs/Radio/__stories__/Conditional/index.js +0 -133
- package/cjs/inputs/Radio/__stories__/Conditional.js.map +0 -7
- package/cjs/inputs/Radio/__stories__/Default/index.js +0 -81
- package/cjs/inputs/Radio/__stories__/Default.js.map +0 -7
- package/cjs/inputs/Radio/__stories__/WithDivider/index.js +0 -82
- package/cjs/inputs/Radio/__stories__/WithDivider.js.map +0 -7
- package/cjs/inputs/Select/Select.stories/index.js +0 -45
- package/cjs/inputs/Select/Select.stories.js.map +0 -7
- package/cjs/inputs/Select/__stories__/Default/index.js +0 -86
- package/cjs/inputs/Select/__stories__/Default.js.map +0 -7
- package/inputs/AutoCompleteInput/AutoComplete.stories/index.js +0 -14
- package/inputs/AutoCompleteInput/AutoComplete.stories/package.json +0 -6
- package/inputs/AutoCompleteInput/AutoComplete.stories.js.map +0 -7
- package/inputs/AutoCompleteInput/__stories__/Default/index.js +0 -50
- package/inputs/AutoCompleteInput/__stories__/Default/package.json +0 -6
- package/inputs/AutoCompleteInput/__stories__/Default.js.map +0 -7
- package/inputs/AutoCompleteInput/__stories__/Multiple/index.js +0 -51
- package/inputs/AutoCompleteInput/__stories__/Multiple/package.json +0 -6
- package/inputs/AutoCompleteInput/__stories__/Multiple.js.map +0 -7
- package/inputs/Checkboxes/Checkboxes.stories/index.js +0 -16
- package/inputs/Checkboxes/Checkboxes.stories/package.json +0 -6
- package/inputs/Checkboxes/Checkboxes.stories.js.map +0 -7
- package/inputs/Checkboxes/__stories__/Conditional/index.js +0 -100
- package/inputs/Checkboxes/__stories__/Conditional/package.json +0 -6
- package/inputs/Checkboxes/__stories__/Conditional.js.map +0 -7
- package/inputs/Checkboxes/__stories__/Default/index.js +0 -44
- package/inputs/Checkboxes/__stories__/Default/package.json +0 -6
- package/inputs/Checkboxes/__stories__/Default.js.map +0 -7
- package/inputs/Checkboxes/__stories__/WithDivider/index.js +0 -45
- package/inputs/Checkboxes/__stories__/WithDivider/package.json +0 -6
- package/inputs/Checkboxes/__stories__/WithDivider.js.map +0 -7
- package/inputs/DateInput/DateInput.stories/index.js +0 -12
- package/inputs/DateInput/DateInput.stories/package.json +0 -6
- package/inputs/DateInput/DateInput.stories.js.map +0 -7
- package/inputs/DateInput/__stories__/Default/index.js +0 -28
- package/inputs/DateInput/__stories__/Default/package.json +0 -6
- package/inputs/DateInput/__stories__/Default.js.map +0 -7
- package/inputs/FileInput/FileInput.stories/index.js +0 -12
- package/inputs/FileInput/FileInput.stories/package.json +0 -6
- package/inputs/FileInput/FileInput.stories.js.map +0 -7
- package/inputs/FileInput/__stories__/Default/index.js +0 -28
- package/inputs/FileInput/__stories__/Default/package.json +0 -6
- package/inputs/FileInput/__stories__/Default.js.map +0 -7
- package/inputs/ImageInput/ImageInput.stories/index.js +0 -16
- package/inputs/ImageInput/ImageInput.stories/package.json +0 -6
- package/inputs/ImageInput/ImageInput.stories.js.map +0 -7
- package/inputs/ImageInput/__stories__/Default/index.js +0 -30
- package/inputs/ImageInput/__stories__/Default/package.json +0 -6
- package/inputs/ImageInput/__stories__/Default.js.map +0 -7
- package/inputs/ImageInput/__stories__/WithInvalidImageDimension/index.js +0 -38
- package/inputs/ImageInput/__stories__/WithInvalidImageDimension/package.json +0 -6
- package/inputs/ImageInput/__stories__/WithInvalidImageDimension.js.map +0 -7
- package/inputs/ImageInput/__stories__/WithInvalidImageSize/index.js +0 -35
- package/inputs/ImageInput/__stories__/WithInvalidImageSize/package.json +0 -6
- package/inputs/ImageInput/__stories__/WithInvalidImageSize.js.map +0 -7
- package/inputs/Input/Input.stories/index.js +0 -30
- package/inputs/Input/Input.stories.js.map +0 -7
- package/inputs/Input/__stories__/AFM/index.js +0 -30
- package/inputs/Input/__stories__/AFM/package.json +0 -6
- package/inputs/Input/__stories__/AFM.js.map +0 -7
- package/inputs/Input/__stories__/Boolean/index.js +0 -31
- package/inputs/Input/__stories__/Boolean/package.json +0 -6
- package/inputs/Input/__stories__/Boolean.js.map +0 -7
- package/inputs/Input/__stories__/IBAN/index.js +0 -31
- package/inputs/Input/__stories__/IBAN/package.json +0 -6
- package/inputs/Input/__stories__/IBAN.js.map +0 -7
- package/inputs/Input/__stories__/Integer/index.js +0 -45
- package/inputs/Input/__stories__/Integer/package.json +0 -6
- package/inputs/Input/__stories__/Integer.js.map +0 -7
- package/inputs/Input/__stories__/LandlineNumber/index.js +0 -34
- package/inputs/Input/__stories__/LandlineNumber/package.json +0 -6
- package/inputs/Input/__stories__/LandlineNumber.js.map +0 -7
- package/inputs/Input/__stories__/MobilePhone/index.js +0 -34
- package/inputs/Input/__stories__/MobilePhone/package.json +0 -6
- package/inputs/Input/__stories__/MobilePhone.js.map +0 -7
- package/inputs/Input/__stories__/PhoneNumber/index.js +0 -33
- package/inputs/Input/__stories__/PhoneNumber/package.json +0 -6
- package/inputs/Input/__stories__/PhoneNumber.js.map +0 -7
- package/inputs/Input/__stories__/PostalCode/index.js +0 -31
- package/inputs/Input/__stories__/PostalCode/package.json +0 -6
- package/inputs/Input/__stories__/PostalCode.js.map +0 -7
- package/inputs/Input/__stories__/String/index.js +0 -31
- package/inputs/Input/__stories__/String/package.json +0 -6
- package/inputs/Input/__stories__/String.js.map +0 -7
- package/inputs/Input/__stories__/TextWithLimit/index.js +0 -31
- package/inputs/Input/__stories__/TextWithLimit/package.json +0 -6
- package/inputs/Input/__stories__/TextWithLimit.js.map +0 -7
- package/inputs/Label/Label.stories/index.js +0 -12
- package/inputs/Label/Label.stories/package.json +0 -6
- package/inputs/Label/Label.stories.js.map +0 -7
- package/inputs/Label/__stories__/Default/index.js +0 -39
- package/inputs/Label/__stories__/Default/package.json +0 -6
- package/inputs/Label/__stories__/Default.js.map +0 -7
- package/inputs/OtpInput/OtpInput.stories/index.js +0 -12
- package/inputs/OtpInput/OtpInput.stories/package.json +0 -6
- package/inputs/OtpInput/OtpInput.stories.js.map +0 -7
- package/inputs/OtpInput/__stories__/Default/index.js +0 -31
- package/inputs/OtpInput/__stories__/Default/package.json +0 -6
- package/inputs/OtpInput/__stories__/Default.js.map +0 -7
- package/inputs/Radio/Radio.stories/index.js +0 -16
- package/inputs/Radio/Radio.stories/package.json +0 -6
- package/inputs/Radio/Radio.stories.js.map +0 -7
- package/inputs/Radio/__stories__/Conditional/index.js +0 -100
- package/inputs/Radio/__stories__/Conditional/package.json +0 -6
- package/inputs/Radio/__stories__/Conditional.js.map +0 -7
- package/inputs/Radio/__stories__/Default/index.js +0 -48
- package/inputs/Radio/__stories__/Default/package.json +0 -6
- package/inputs/Radio/__stories__/Default.js.map +0 -7
- package/inputs/Radio/__stories__/WithDivider/index.js +0 -49
- package/inputs/Radio/__stories__/WithDivider/package.json +0 -6
- package/inputs/Radio/__stories__/WithDivider.js.map +0 -7
- package/inputs/Select/Select.stories/index.js +0 -12
- package/inputs/Select/Select.stories/package.json +0 -6
- package/inputs/Select/Select.stories.js.map +0 -7
- package/inputs/Select/__stories__/Default/index.js +0 -53
- package/inputs/Select/__stories__/Default/package.json +0 -6
- package/inputs/Select/__stories__/Default.js.map +0 -7
- package/lazy.d.ts +0 -72
- package/lazy.js.map +0 -7
- package/registry.d.ts +0 -70
- package/registry.js.map +0 -7
- package/src/index.tsx +0 -178
- package/src/inputs/ImageInput/index.mdx +0 -19
- package/src/inputs/Input/index.mdx +0 -95
- package/src/inputs/Label/index.mdx +0 -0
- /package/src/Field/{index.mdx → doc.mdx} +0 -0
|
@@ -22,7 +22,7 @@ const Questions = ({
|
|
|
22
22
|
useEffect(() => {
|
|
23
23
|
if (forceStepName !== currentStep.name) {
|
|
24
24
|
const forceStep = steps.find(({ name: name2 }) => name2 === forceStepName);
|
|
25
|
-
forceStep
|
|
25
|
+
if (forceStep) setCurrentStep(forceStep);
|
|
26
26
|
}
|
|
27
27
|
}, [forceStepName]);
|
|
28
28
|
const localData = isBrowser && localDraft && window.localStorage.getItem(`questions-${name}`);
|
|
@@ -32,15 +32,16 @@ const Questions = ({
|
|
|
32
32
|
const submitStep = (stepName, stepData) => {
|
|
33
33
|
data[stepName] = stepData;
|
|
34
34
|
if (localDraft) {
|
|
35
|
-
|
|
35
|
+
if (isBrowser)
|
|
36
|
+
window.localStorage.setItem(`questions-${name}`, JSON.stringify(data));
|
|
36
37
|
}
|
|
37
38
|
if (onChange) {
|
|
38
|
-
onChange
|
|
39
|
+
onChange(data);
|
|
39
40
|
}
|
|
40
41
|
setData(data);
|
|
41
42
|
const nextStep = getNextStep(currentStep, steps, data);
|
|
42
43
|
if (nextStep) {
|
|
43
|
-
onActiveStep
|
|
44
|
+
if (onActiveStep) onActiveStep(nextStep);
|
|
44
45
|
setCurrentStep(nextStep);
|
|
45
46
|
} else {
|
|
46
47
|
onSubmit(data);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Questions/Questions.tsx"],
|
|
4
|
-
"sourcesContent": ["import React, { useState, useEffect } from 'react';\nimport { getNextStep } from '@digigov/form/Questions/getNextStep';\nimport { QuestionsContext } from '@digigov/form/Questions/QuestionsContext';\nimport { StepInterface } from '@digigov/form/Questions/Step/types';\nimport { QuestionsInterface } from '@digigov/form/Questions/types';\n\nconst isBrowser = typeof window !== 'undefined';\n\n/**\n * The Question component accepts question data as props\n * uses composable components to provide a wholesome UX\n *\n */\nexport const Questions: React.FC<QuestionsInterface> = ({\n name,\n steps,\n initialData = {},\n onChange,\n onSubmit,\n onActiveStep,\n forceStepName,\n localDraft = false,\n children,\n}) => {\n const [currentStep, setCurrentStep] = useState<StepInterface>({ name: '' });\n useEffect(() => {\n if (!forceStepName) {\n setCurrentStep(steps[0]);\n }\n }, [forceStepName, steps]);\n useEffect(() => {\n if (forceStepName !== currentStep.name) {\n const forceStep = steps.find(({ name }) => name === forceStepName);\n forceStep
|
|
5
|
-
"mappings": "AAAA,OAAO,SAAS,UAAU,iBAAiB;AAC3C,SAAS,mBAAmB;AAC5B,SAAS,wBAAwB;AAIjC,MAAM,YAAY,OAAO,WAAW;AAO7B,MAAM,YAA0C,CAAC;AAAA,EACtD;AAAA,EACA;AAAA,EACA,cAAc,CAAC;AAAA,EACf;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb;AACF,MAAM;AACJ,QAAM,CAAC,aAAa,cAAc,IAAI,SAAwB,EAAE,MAAM,GAAG,CAAC;AAC1E,YAAU,MAAM;AACd,QAAI,CAAC,eAAe;AAClB,qBAAe,MAAM,CAAC,CAAC;AAAA,IACzB;AAAA,EACF,GAAG,CAAC,eAAe,KAAK,CAAC;AACzB,YAAU,MAAM;AACd,QAAI,kBAAkB,YAAY,MAAM;AACtC,YAAM,YAAY,MAAM,KAAK,CAAC,EAAE,MAAAA,MAAK,MAAMA,UAAS,aAAa;AACjE,
|
|
4
|
+
"sourcesContent": ["import React, { useState, useEffect } from 'react';\nimport { getNextStep } from '@digigov/form/Questions/getNextStep';\nimport { QuestionsContext } from '@digigov/form/Questions/QuestionsContext';\nimport { StepInterface } from '@digigov/form/Questions/Step/types';\nimport { QuestionsInterface } from '@digigov/form/Questions/types';\n\nconst isBrowser = typeof window !== 'undefined';\n\n/**\n * The Question component accepts question data as props\n * uses composable components to provide a wholesome UX\n *\n */\nexport const Questions: React.FC<QuestionsInterface> = ({\n name,\n steps,\n initialData = {},\n onChange,\n onSubmit,\n onActiveStep,\n forceStepName,\n localDraft = false,\n children,\n}) => {\n const [currentStep, setCurrentStep] = useState<StepInterface>({ name: '' });\n useEffect(() => {\n if (!forceStepName) {\n setCurrentStep(steps[0]);\n }\n }, [forceStepName, steps]);\n useEffect(() => {\n if (forceStepName !== currentStep.name) {\n const forceStep = steps.find(({ name }) => name === forceStepName);\n if (forceStep) setCurrentStep(forceStep);\n }\n }, [forceStepName]);\n const localData =\n isBrowser && localDraft && window.localStorage.getItem(`questions-${name}`);\n const [data, setData] = useState(\n (localData && JSON.parse(localData)) || initialData\n );\n const submitStep = (stepName, stepData): void => {\n data[stepName] = stepData;\n if (localDraft) {\n if (isBrowser)\n window.localStorage.setItem(`questions-${name}`, JSON.stringify(data));\n }\n if (onChange) {\n onChange(data);\n }\n setData(data);\n const nextStep = getNextStep(currentStep, steps, data);\n if (nextStep) {\n if (onActiveStep) onActiveStep(nextStep);\n setCurrentStep(nextStep);\n } else {\n onSubmit(data);\n }\n };\n\n return (\n <QuestionsContext.Provider\n value={{\n steps,\n currentStep,\n submitStep,\n data,\n onActiveStep,\n }}\n >\n {children}\n </QuestionsContext.Provider>\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO,SAAS,UAAU,iBAAiB;AAC3C,SAAS,mBAAmB;AAC5B,SAAS,wBAAwB;AAIjC,MAAM,YAAY,OAAO,WAAW;AAO7B,MAAM,YAA0C,CAAC;AAAA,EACtD;AAAA,EACA;AAAA,EACA,cAAc,CAAC;AAAA,EACf;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb;AACF,MAAM;AACJ,QAAM,CAAC,aAAa,cAAc,IAAI,SAAwB,EAAE,MAAM,GAAG,CAAC;AAC1E,YAAU,MAAM;AACd,QAAI,CAAC,eAAe;AAClB,qBAAe,MAAM,CAAC,CAAC;AAAA,IACzB;AAAA,EACF,GAAG,CAAC,eAAe,KAAK,CAAC;AACzB,YAAU,MAAM;AACd,QAAI,kBAAkB,YAAY,MAAM;AACtC,YAAM,YAAY,MAAM,KAAK,CAAC,EAAE,MAAAA,MAAK,MAAMA,UAAS,aAAa;AACjE,UAAI,UAAW,gBAAe,SAAS;AAAA,IACzC;AAAA,EACF,GAAG,CAAC,aAAa,CAAC;AAClB,QAAM,YACJ,aAAa,cAAc,OAAO,aAAa,QAAQ,aAAa,IAAI,EAAE;AAC5E,QAAM,CAAC,MAAM,OAAO,IAAI;AAAA,IACrB,aAAa,KAAK,MAAM,SAAS,KAAM;AAAA,EAC1C;AACA,QAAM,aAAa,CAAC,UAAU,aAAmB;AAC/C,SAAK,QAAQ,IAAI;AACjB,QAAI,YAAY;AACd,UAAI;AACF,eAAO,aAAa,QAAQ,aAAa,IAAI,IAAI,KAAK,UAAU,IAAI,CAAC;AAAA,IACzE;AACA,QAAI,UAAU;AACZ,eAAS,IAAI;AAAA,IACf;AACA,YAAQ,IAAI;AACZ,UAAM,WAAW,YAAY,aAAa,OAAO,IAAI;AACrD,QAAI,UAAU;AACZ,UAAI,aAAc,cAAa,QAAQ;AACvC,qBAAe,QAAQ;AAAA,IACzB,OAAO;AACL,eAAS,IAAI;AAAA,IACf;AAAA,EACF;AAEA,SACE;AAAA,IAAC,iBAAiB;AAAA,IAAjB;AAAA,MACC,OAAO;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA;AAAA,IAEC;AAAA,EACH;AAEJ;",
|
|
6
6
|
"names": ["name"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/Questions/Step/StepArrayReview.tsx"],
|
|
4
|
-
"sourcesContent": ["import React, { useContext } from 'react';\nimport { Field } from '@digigov/form/Field';\nimport { Fieldset } from '@digigov/form/Fieldset';\nimport FormBuilder from '@digigov/form/FormBuilder';\nimport Label from '@digigov/form/inputs/Label';\nimport { QuestionsContext } from '@digigov/form/Questions/QuestionsContext';\nimport { getAddMoreFields } from '@digigov/form/Questions/Step/getAddMoreFields';\nimport { StepArrayReviewInterface } from '@digigov/form/Questions/Step/types';\nimport { FieldSpec } from '@digigov/form/types';\nimport PageTitleContainer, {\n PageTitleHeading,\n} from '@digigov/ui/app/PageTitleContainer';\nimport {\n SummaryList,\n SummaryListItem,\n SummaryListItemKey,\n SummaryListItemValue,\n SummaryListItemAction,\n} from '@digigov/ui/content/SummaryList';\nimport Button from '@digigov/ui/form/Button';\nimport { useTranslation } from '@digigov/ui/i18n';\n\nexport const StepArrayReview: React.FC<StepArrayReviewInterface> = (props) => {\n const { t } = useTranslation();\n const { currentStep } = useContext(QuestionsContext);\n const fields = getAddMoreFields(currentStep);\n const primaryField =\n currentStep.fields.find(\n (field: { key: any }) => field.key === currentStep.review?.primaryFieldKey\n ) || {};\n return (\n <>\n <PageTitleContainer>\n <PageTitleHeading>\n {currentStep.review?.title && t(currentStep.review?.title)}\n </PageTitleHeading>\n </PageTitleContainer>\n <SummaryList>\n {props.array.map(\n (item:
|
|
5
|
-
"mappings": "AAAA,OAAO,SAAS,kBAAkB;AAClC,SAAS,aAAa;AACtB,SAAS,gBAAgB;AACzB,OAAO,iBAAiB;AACxB,OAAO,WAAW;AAClB,SAAS,wBAAwB;AACjC,SAAS,wBAAwB;AAGjC,OAAO;AAAA,EACL;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,OAAO,YAAY;AACnB,SAAS,sBAAsB;AAExB,MAAM,kBAAsD,CAAC,UAAU;AAC5E,QAAM,EAAE,EAAE,IAAI,eAAe;AAC7B,QAAM,EAAE,YAAY,IAAI,WAAW,gBAAgB;AACnD,QAAM,SAAS,iBAAiB,WAAW;AAC3C,QAAM,eACJ,YAAY,OAAO;AAAA,IACjB,CAAC,UAAwB,MAAM,QAAQ,YAAY,QAAQ;AAAA,EAC7D,KAAK,CAAC;AACR,SACE,0DACE,oCAAC,0BACC,oCAAC,wBACE,YAAY,QAAQ,SAAS,EAAE,YAAY,QAAQ,KAAK,CAC3D,CACF,GACA,oCAAC,mBACE,MAAM,MAAM;AAAA,IACX,CAAC,
|
|
4
|
+
"sourcesContent": ["import React, { useContext } from 'react';\nimport { Field } from '@digigov/form/Field';\nimport { Fieldset } from '@digigov/form/Fieldset';\nimport FormBuilder from '@digigov/form/FormBuilder';\nimport Label from '@digigov/form/inputs/Label';\nimport { QuestionsContext } from '@digigov/form/Questions/QuestionsContext';\nimport { getAddMoreFields } from '@digigov/form/Questions/Step/getAddMoreFields';\nimport { StepArrayReviewInterface } from '@digigov/form/Questions/Step/types';\nimport { FieldSpec } from '@digigov/form/types';\nimport PageTitleContainer, {\n PageTitleHeading,\n} from '@digigov/ui/app/PageTitleContainer';\nimport {\n SummaryList,\n SummaryListItem,\n SummaryListItemKey,\n SummaryListItemValue,\n SummaryListItemAction,\n} from '@digigov/ui/content/SummaryList';\nimport Button from '@digigov/ui/form/Button';\nimport { useTranslation } from '@digigov/ui/i18n';\n\nexport const StepArrayReview: React.FC<StepArrayReviewInterface> = (props) => {\n const { t } = useTranslation();\n const { currentStep } = useContext(QuestionsContext);\n const fields = getAddMoreFields(currentStep);\n const primaryField =\n currentStep.fields.find(\n (field: { key: any }) => field.key === currentStep.review?.primaryFieldKey\n ) || {};\n return (\n <>\n <PageTitleContainer>\n <PageTitleHeading>\n {currentStep.review?.title && t(currentStep.review?.title)}\n </PageTitleHeading>\n </PageTitleContainer>\n <SummaryList>\n {props.array.map(\n (item: Record<string, React.ReactNode>, idx: number) => (\n <SummaryListItem key={idx}>\n <SummaryListItemKey>\n {t(primaryField.label.primary)}\n </SummaryListItemKey>\n <SummaryListItemValue>\n {item[primaryField.key]}\n </SummaryListItemValue>\n <SummaryListItemAction\n onClick={(): void => props.handleDelete(idx)}\n >\n {t('button.delete')}\n </SummaryListItemAction>\n </SummaryListItem>\n )\n )}\n </SummaryList>\n <FormBuilder key=\"addmore\" fields={fields} onSubmit={props.handleSubmit}>\n <Fieldset>\n <Label label={currentStep.review?.addMore.title} />\n {fields.map((field: FieldSpec) => (\n <Field key={field.key} name={field.key} />\n ))}\n </Fieldset>\n <Button type=\"submit\">{t('button.submit')}</Button>\n </FormBuilder>\n </>\n );\n};\n\nexport default StepArrayReview;\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO,SAAS,kBAAkB;AAClC,SAAS,aAAa;AACtB,SAAS,gBAAgB;AACzB,OAAO,iBAAiB;AACxB,OAAO,WAAW;AAClB,SAAS,wBAAwB;AACjC,SAAS,wBAAwB;AAGjC,OAAO;AAAA,EACL;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,OAAO,YAAY;AACnB,SAAS,sBAAsB;AAExB,MAAM,kBAAsD,CAAC,UAAU;AAC5E,QAAM,EAAE,EAAE,IAAI,eAAe;AAC7B,QAAM,EAAE,YAAY,IAAI,WAAW,gBAAgB;AACnD,QAAM,SAAS,iBAAiB,WAAW;AAC3C,QAAM,eACJ,YAAY,OAAO;AAAA,IACjB,CAAC,UAAwB,MAAM,QAAQ,YAAY,QAAQ;AAAA,EAC7D,KAAK,CAAC;AACR,SACE,0DACE,oCAAC,0BACC,oCAAC,wBACE,YAAY,QAAQ,SAAS,EAAE,YAAY,QAAQ,KAAK,CAC3D,CACF,GACA,oCAAC,mBACE,MAAM,MAAM;AAAA,IACX,CAAC,MAAuC,QACtC,oCAAC,mBAAgB,KAAK,OACpB,oCAAC,0BACE,EAAE,aAAa,MAAM,OAAO,CAC/B,GACA,oCAAC,4BACE,KAAK,aAAa,GAAG,CACxB,GACA;AAAA,MAAC;AAAA;AAAA,QACC,SAAS,MAAY,MAAM,aAAa,GAAG;AAAA;AAAA,MAE1C,EAAE,eAAe;AAAA,IACpB,CACF;AAAA,EAEJ,CACF,GACA,oCAAC,eAAY,KAAI,WAAU,QAAgB,UAAU,MAAM,gBACzD,oCAAC,gBACC,oCAAC,SAAM,OAAO,YAAY,QAAQ,QAAQ,OAAO,GAChD,OAAO,IAAI,CAAC,UACX,oCAAC,SAAM,KAAK,MAAM,KAAK,MAAM,MAAM,KAAK,CACzC,CACH,GACA,oCAAC,UAAO,MAAK,YAAU,EAAE,eAAe,CAAE,CAC5C,CACF;AAEJ;AAEA,IAAO,0BAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import React, { useContext } from "react";
|
|
2
2
|
import { StepContext } from "@digigov/form/Questions/Step/StepContext";
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
import PageTitleContainer, {
|
|
3
|
+
import {
|
|
4
|
+
PageTitleContainer,
|
|
6
5
|
PageTitleCaption
|
|
7
6
|
} from "@digigov/ui/app/PageTitleContainer";
|
|
8
7
|
import { useTranslation } from "@digigov/ui/i18n";
|
|
9
8
|
import { BackLink } from "@digigov/ui/navigation/BackLink";
|
|
9
|
+
import { Heading } from "@digigov/ui/typography/Heading";
|
|
10
|
+
import { HeadingCaption } from "@digigov/ui/typography/HeadingCaption";
|
|
10
11
|
const StepTitleHeading = (props) => {
|
|
11
12
|
return /* @__PURE__ */ React.createElement(Heading, null, props.children);
|
|
12
13
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/Questions/Step/StepTitle.tsx"],
|
|
4
|
-
"sourcesContent": ["import React, { useContext } from 'react';\nimport { StepContext } from '@digigov/form/Questions/Step/StepContext';\nimport
|
|
5
|
-
"mappings": "AAAA,OAAO,SAAS,kBAAkB;AAClC,SAAS,mBAAmB;AAC5B
|
|
4
|
+
"sourcesContent": ["import React, { useContext } from 'react';\nimport { StepContext } from '@digigov/form/Questions/Step/StepContext';\nimport {\n PageTitleContainer,\n PageTitleCaption,\n} from '@digigov/ui/app/PageTitleContainer';\nimport { useTranslation } from '@digigov/ui/i18n';\nimport { BackLink } from '@digigov/ui/navigation/BackLink';\nimport { Heading, HeadingProps } from '@digigov/ui/typography/Heading';\nimport { HeadingCaption } from '@digigov/ui/typography/HeadingCaption';\n\nexport interface StepTitleInterface {\n title?: string;\n backButton?: string;\n caption?: string;\n step?: string;\n children?: React.ReactNode;\n}\n\nexport const StepTitleHeading: React.FC<HeadingProps> = (props) => {\n return <Heading>{props.children}</Heading>;\n};\n\nexport const StepTitleBase: React.FC<StepTitleInterface> = ({\n caption,\n step,\n title,\n backButton,\n children,\n}): React.ReactElement => {\n const { t } = useTranslation();\n return (\n <>\n <BackLink>{backButton || t('button.back')}</BackLink>\n <PageTitleContainer>\n {children || (\n <>\n <HeadingCaption size=\"xl\">{caption && t(caption)}</HeadingCaption>\n {step && <PageTitleCaption>{step}</PageTitleCaption>}\n <StepTitleHeading>{title && t(title)}</StepTitleHeading>\n </>\n )}\n </PageTitleContainer>\n </>\n );\n};\n\n/**\n * The StepTitle component accepts a title, a caption and a step indicator\n * about the Step asked to the User\n */\nexport const StepTitle: React.FC<StepTitleInterface> = (props) => {\n const { caption, title, step, backButton } = useContext(StepContext);\n return (\n <StepTitleBase\n backButton={backButton}\n caption={caption}\n step={step}\n title={title}\n >\n {props.children}\n </StepTitleBase>\n );\n};\n\nexport default StepTitle;\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO,SAAS,kBAAkB;AAClC,SAAS,mBAAmB;AAC5B;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,sBAAsB;AAC/B,SAAS,gBAAgB;AACzB,SAAS,eAA6B;AACtC,SAAS,sBAAsB;AAUxB,MAAM,mBAA2C,CAAC,UAAU;AACjE,SAAO,oCAAC,eAAS,MAAM,QAAS;AAClC;AAEO,MAAM,gBAA8C,CAAC;AAAA,EAC1D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAA0B;AACxB,QAAM,EAAE,EAAE,IAAI,eAAe;AAC7B,SACE,0DACE,oCAAC,gBAAU,cAAc,EAAE,aAAa,CAAE,GAC1C,oCAAC,0BACE,YACC,0DACE,oCAAC,kBAAe,MAAK,QAAM,WAAW,EAAE,OAAO,CAAE,GAChD,QAAQ,oCAAC,wBAAkB,IAAK,GACjC,oCAAC,wBAAkB,SAAS,EAAE,KAAK,CAAE,CACvC,CAEJ,CACF;AAEJ;AAMO,MAAM,YAA0C,CAAC,UAAU;AAChE,QAAM,EAAE,SAAS,OAAO,MAAM,WAAW,IAAI,WAAW,WAAW;AACnE,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,IAEC,MAAM;AAAA,EACT;AAEJ;AAEA,IAAO,oBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/Questions/types.d.ts
CHANGED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var ErrorGroup_exports = {};
|
|
29
|
+
__export(ErrorGroup_exports, {
|
|
30
|
+
ErrorGroup: () => ErrorGroup,
|
|
31
|
+
ErrorGroupContext: () => ErrorGroupContext,
|
|
32
|
+
default: () => ErrorGroup_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(ErrorGroup_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_List = require("@digigov/ui/content/List");
|
|
37
|
+
var import_ErrorSummary = require("@digigov/ui/feedback/ErrorSummary");
|
|
38
|
+
var import_i18n = require("@digigov/ui/i18n");
|
|
39
|
+
var import_Link = require("@digigov/ui/navigation/Link");
|
|
40
|
+
var import_Heading = require("@digigov/ui/typography/Heading");
|
|
41
|
+
var import_Base = require("@digigov/ui/utils/Base");
|
|
42
|
+
const ErrorGroupContext = (0, import_react.createContext)(
|
|
43
|
+
null
|
|
44
|
+
);
|
|
45
|
+
const ErrorGroup = ({
|
|
46
|
+
children,
|
|
47
|
+
screenSize,
|
|
48
|
+
fieldOrder
|
|
49
|
+
}) => {
|
|
50
|
+
const [errors, setErrors] = (0, import_react.useState)({});
|
|
51
|
+
const { t } = (0, import_i18n.useTranslation)();
|
|
52
|
+
const setError = (name, label, error) => {
|
|
53
|
+
if (errors[name] !== error && errors[name]?.message !== error?.message) {
|
|
54
|
+
if (!error?.message) {
|
|
55
|
+
const updatedErrors = { ...errors };
|
|
56
|
+
delete updatedErrors[name];
|
|
57
|
+
setErrors(updatedErrors);
|
|
58
|
+
} else {
|
|
59
|
+
setErrors({
|
|
60
|
+
...errors,
|
|
61
|
+
[name]: {
|
|
62
|
+
...error,
|
|
63
|
+
label: label.primary
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
(0, import_react.useEffect)(() => {
|
|
70
|
+
setErrors({});
|
|
71
|
+
}, [screenSize]);
|
|
72
|
+
return /* @__PURE__ */ import_react.default.createElement(ErrorGroupContext.Provider, { value: { setError } }, Object.keys(errors).length !== 0 && /* @__PURE__ */ import_react.default.createElement(import_ErrorSummary.ErrorSummary, { variant: "error-group" }, /* @__PURE__ */ import_react.default.createElement(import_Heading.Heading, { size: "sm" }, "\u03A4\u03B1 \u03C0\u03B1\u03C1\u03B1\u03BA\u03AC\u03C4\u03C9 \u03C0\u03B5\u03B4\u03AF\u03B1 \u03C4\u03B7\u03C2 \u03C6\u03CC\u03C1\u03BC\u03B1\u03C2 \u03B5\u03B9\u03BD\u03B1\u03B9 \u03BB\u03AC\u03B8\u03BF\u03C2.", " "), /* @__PURE__ */ import_react.default.createElement(import_List.List, { listStyle: "bullet" }, (fieldOrder || Object.keys(errors).reverse()).filter((fieldName) => errors[fieldName]).map((fieldName, index) => {
|
|
73
|
+
return /* @__PURE__ */ import_react.default.createElement(import_List.ListItem, { key: index, id: `${fieldName}-error` }, /* @__PURE__ */ import_react.default.createElement(import_Base.Base, { as: "b" }, t(errors[fieldName]?.label), ":"), " ", /* @__PURE__ */ import_react.default.createElement(import_Link.Link, { href: `#${fieldName}` }, t(errors[fieldName]?.message)));
|
|
74
|
+
}))), children);
|
|
75
|
+
};
|
|
76
|
+
var ErrorGroup_default = ErrorGroup;
|
|
77
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
78
|
+
0 && (module.exports = {
|
|
79
|
+
ErrorGroup,
|
|
80
|
+
ErrorGroupContext
|
|
81
|
+
});
|
|
82
|
+
//# sourceMappingURL=ErrorGroup.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/Field/ErrorGroup.tsx"],
|
|
4
|
+
"sourcesContent": ["import React, { createContext, useEffect, useState } from 'react';\nimport { ErrorOption } from 'react-hook-form';\nimport { FieldLabelProps } from '@digigov/form/Field/types';\nimport { List, ListItem } from '@digigov/ui/content/List';\nimport { ErrorSummary } from '@digigov/ui/feedback/ErrorSummary';\nimport { useTranslation } from '@digigov/ui/i18n';\nimport { Link } from '@digigov/ui/navigation/Link';\nimport { Heading } from '@digigov/ui/typography/Heading';\nimport { Base } from '@digigov/ui/utils/Base';\nimport { Breakpoints } from '@digigov/ui/utils/hooks/useScreen';\ninterface ErrorGroupContextType {\n setError: (\n name?: string,\n label?: FieldLabelProps,\n error?: ErrorOption\n ) => void;\n}\nexport const ErrorGroupContext = createContext<ErrorGroupContextType | null>(\n null\n);\n\nexport interface ErrorGroupProps {\n children: React.ReactNode;\n screenSize?: Breakpoints | undefined;\n fieldOrder?: any[];\n}\n\nexport const ErrorGroup: React.FC<ErrorGroupProps> = ({\n children,\n screenSize,\n fieldOrder,\n}) => {\n const [errors, setErrors] = useState<ErrorOption>({});\n const { t } = useTranslation();\n const setError = (name, label, error) => {\n if (errors[name] !== error && errors[name]?.message !== error?.message) {\n if (!error?.message) {\n const updatedErrors = { ...errors };\n delete updatedErrors[name];\n setErrors(updatedErrors);\n } else {\n setErrors({\n ...errors,\n [name]: {\n ...error,\n label: label.primary,\n },\n });\n }\n }\n };\n\n useEffect(() => {\n setErrors({});\n }, [screenSize]);\n return (\n <ErrorGroupContext.Provider value={{ setError }}>\n {Object.keys(errors).length !== 0 && (\n <ErrorSummary variant=\"error-group\">\n <Heading size=\"sm\">\n \u03A4\u03B1 \u03C0\u03B1\u03C1\u03B1\u03BA\u03AC\u03C4\u03C9 \u03C0\u03B5\u03B4\u03AF\u03B1 \u03C4\u03B7\u03C2 \u03C6\u03CC\u03C1\u03BC\u03B1\u03C2 \u03B5\u03B9\u03BD\u03B1\u03B9 \u03BB\u03AC\u03B8\u03BF\u03C2.{' '}\n </Heading>\n <List listStyle=\"bullet\">\n {(fieldOrder || Object.keys(errors).reverse())\n .filter((fieldName) => errors[fieldName])\n .map((fieldName, index) => {\n return (\n <ListItem key={index} id={`${fieldName}-error`}>\n <Base as=\"b\">{t(errors[fieldName]?.label)}:</Base>{' '}\n <Link href={`#${fieldName}`}>\n {t(errors[fieldName]?.message)}\n </Link>\n </ListItem>\n );\n })}\n </List>\n </ErrorSummary>\n )}\n {children}\n </ErrorGroupContext.Provider>\n );\n};\n\nexport default ErrorGroup;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA0D;AAG1D,kBAA+B;AAC/B,0BAA6B;AAC7B,kBAA+B;AAC/B,kBAAqB;AACrB,qBAAwB;AACxB,kBAAqB;AASd,MAAM,wBAAoB;AAAA,EAC/B;AACF;AAQO,MAAM,aAAwC,CAAC;AAAA,EACpD;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,CAAC,QAAQ,SAAS,QAAI,uBAAsB,CAAC,CAAC;AACpD,QAAM,EAAE,EAAE,QAAI,4BAAe;AAC7B,QAAM,WAAW,CAAC,MAAM,OAAO,UAAU;AACvC,QAAI,OAAO,IAAI,MAAM,SAAS,OAAO,IAAI,GAAG,YAAY,OAAO,SAAS;AACtE,UAAI,CAAC,OAAO,SAAS;AACnB,cAAM,gBAAgB,EAAE,GAAG,OAAO;AAClC,eAAO,cAAc,IAAI;AACzB,kBAAU,aAAa;AAAA,MACzB,OAAO;AACL,kBAAU;AAAA,UACR,GAAG;AAAA,UACH,CAAC,IAAI,GAAG;AAAA,YACN,GAAG;AAAA,YACH,OAAO,MAAM;AAAA,UACf;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AAEA,8BAAU,MAAM;AACd,cAAU,CAAC,CAAC;AAAA,EACd,GAAG,CAAC,UAAU,CAAC;AACf,SACE,6BAAAA,QAAA,cAAC,kBAAkB,UAAlB,EAA2B,OAAO,EAAE,SAAS,KAC3C,OAAO,KAAK,MAAM,EAAE,WAAW,KAC9B,6BAAAA,QAAA,cAAC,oCAAa,SAAQ,iBACpB,6BAAAA,QAAA,cAAC,0BAAQ,MAAK,QAAK,uNACyB,GAC5C,GACA,6BAAAA,QAAA,cAAC,oBAAK,WAAU,aACZ,cAAc,OAAO,KAAK,MAAM,EAAE,QAAQ,GACzC,OAAO,CAAC,cAAc,OAAO,SAAS,CAAC,EACvC,IAAI,CAAC,WAAW,UAAU;AACzB,WACE,6BAAAA,QAAA,cAAC,wBAAS,KAAK,OAAO,IAAI,GAAG,SAAS,YACpC,6BAAAA,QAAA,cAAC,oBAAK,IAAG,OAAK,EAAE,OAAO,SAAS,GAAG,KAAK,GAAE,GAAC,GAAQ,KACnD,6BAAAA,QAAA,cAAC,oBAAK,MAAM,IAAI,SAAS,MACtB,EAAE,OAAO,SAAS,GAAG,OAAO,CAC/B,CACF;AAAA,EAEJ,CAAC,CACL,CACF,GAED,QACH;AAEJ;AAEA,IAAO,qBAAQ;",
|
|
6
|
+
"names": ["React"]
|
|
7
|
+
}
|
|
@@ -32,26 +32,32 @@ __export(FieldBase_exports, {
|
|
|
32
32
|
module.exports = __toCommonJS(FieldBase_exports);
|
|
33
33
|
var import_react = __toESM(require("react"));
|
|
34
34
|
var import_react_hook_form = require("react-hook-form");
|
|
35
|
+
var import_ErrorGroup = require("@digigov/form/Field/ErrorGroup");
|
|
35
36
|
var import_FieldBaseContainer = __toESM(require("@digigov/form/Field/FieldBaseContainer"));
|
|
36
|
-
const FieldBase = (
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
37
|
+
const FieldBase = ({
|
|
38
|
+
required,
|
|
39
|
+
name,
|
|
40
|
+
component: Component,
|
|
41
|
+
wrapper,
|
|
42
|
+
control,
|
|
43
|
+
type,
|
|
44
|
+
controlled = false,
|
|
45
|
+
enabled = true,
|
|
46
|
+
editable,
|
|
47
|
+
defaultValue,
|
|
48
|
+
label,
|
|
49
|
+
extra = {},
|
|
50
|
+
layout,
|
|
51
|
+
error,
|
|
52
|
+
register,
|
|
53
|
+
...componentProps
|
|
54
|
+
}) => {
|
|
55
|
+
const errorGroupContext = (0, import_react.useContext)(import_ErrorGroup.ErrorGroupContext);
|
|
56
|
+
(0, import_react.useEffect)(() => {
|
|
57
|
+
if (errorGroupContext) {
|
|
58
|
+
errorGroupContext.setError(name, label, error);
|
|
59
|
+
}
|
|
60
|
+
}, [error, name, errorGroupContext?.setError]);
|
|
55
61
|
if (!enabled) {
|
|
56
62
|
return null;
|
|
57
63
|
}
|
|
@@ -61,7 +67,8 @@ const FieldBase = (props) => {
|
|
|
61
67
|
{
|
|
62
68
|
label,
|
|
63
69
|
layout,
|
|
64
|
-
error,
|
|
70
|
+
error: errorGroupContext ? void 0 : error,
|
|
71
|
+
hasError: !!error,
|
|
65
72
|
wrapper,
|
|
66
73
|
name
|
|
67
74
|
},
|
|
@@ -75,6 +82,7 @@ const FieldBase = (props) => {
|
|
|
75
82
|
Component,
|
|
76
83
|
{
|
|
77
84
|
...field,
|
|
85
|
+
control,
|
|
78
86
|
ref: void 0,
|
|
79
87
|
defaultValue,
|
|
80
88
|
extra,
|
|
@@ -97,7 +105,8 @@ const FieldBase = (props) => {
|
|
|
97
105
|
{
|
|
98
106
|
label,
|
|
99
107
|
layout,
|
|
100
|
-
error,
|
|
108
|
+
error: errorGroupContext ? void 0 : error,
|
|
109
|
+
hasError: !!error,
|
|
101
110
|
wrapper,
|
|
102
111
|
name
|
|
103
112
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/Field/FieldBase.tsx"],
|
|
4
|
-
"sourcesContent": ["import React from 'react';\nimport { Controller } from 'react-hook-form';\nimport FieldBaseContainer from '@digigov/form/Field/FieldBaseContainer';\nimport { FieldBaseProps } from '@digigov/form/Field/types';\n\nexport const FieldBase: React.FC<FieldBaseProps> = (
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,
|
|
4
|
+
"sourcesContent": ["import React, { useContext, useEffect } from 'react';\nimport { Controller } from 'react-hook-form';\nimport { ErrorGroupContext } from '@digigov/form/Field/ErrorGroup';\nimport FieldBaseContainer from '@digigov/form/Field/FieldBaseContainer';\nimport { FieldBaseProps } from '@digigov/form/Field/types';\n\nexport const FieldBase: React.FC<FieldBaseProps> = ({\n required,\n name,\n component: Component,\n wrapper,\n control,\n type,\n controlled = false,\n enabled = true,\n editable,\n defaultValue,\n label,\n extra = {},\n layout,\n error,\n register,\n ...componentProps\n}) => {\n const errorGroupContext = useContext(ErrorGroupContext);\n\n useEffect(() => {\n if (errorGroupContext) {\n errorGroupContext.setError(name, label, error);\n }\n }, [error, name, errorGroupContext?.setError]);\n\n if (!enabled) {\n return null;\n }\n\n if (controlled) {\n return (\n <FieldBaseContainer\n label={label}\n layout={layout}\n error={errorGroupContext ? undefined : error}\n hasError={!!error}\n wrapper={wrapper}\n name={name}\n >\n <Controller\n control={control}\n name={name}\n render={({ field }) => {\n return (\n <Component\n {...field}\n control={control}\n ref={undefined}\n defaultValue={defaultValue}\n extra={extra}\n error={!!error}\n type={type}\n aria-required={!!required}\n aria-describedby={error && `${name}-error`}\n required={required}\n disabled={editable === false}\n {...componentProps}\n />\n );\n }}\n />\n </FieldBaseContainer>\n );\n }\n\n return (\n <FieldBaseContainer\n label={label}\n layout={layout}\n error={errorGroupContext ? undefined : error}\n hasError={!!error}\n wrapper={wrapper}\n name={name}\n >\n {Component?.render ? (\n <Component\n {...register(name)}\n control={control}\n error={!!error}\n extra={extra}\n type={type}\n aria-required={!!required}\n aria-describedby={error && `${name}-error`}\n required={required}\n disabled={editable === false}\n {...componentProps}\n />\n ) : (\n <Component\n {...register(name)}\n register={register}\n control={control}\n error={!!error}\n extra={extra}\n type={type}\n aria-required={!!required}\n aria-describedby={error && `${name}-error`}\n required={required}\n disabled={editable === false}\n ref={undefined}\n {...componentProps}\n />\n )}\n </FieldBaseContainer>\n );\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA6C;AAC7C,6BAA2B;AAC3B,wBAAkC;AAClC,gCAA+B;AAGxB,MAAM,YAAsC,CAAC;AAAA,EAClD;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb,UAAU;AAAA,EACV;AAAA,EACA;AAAA,EACA;AAAA,EACA,QAAQ,CAAC;AAAA,EACT;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,wBAAoB,yBAAW,mCAAiB;AAEtD,8BAAU,MAAM;AACd,QAAI,mBAAmB;AACrB,wBAAkB,SAAS,MAAM,OAAO,KAAK;AAAA,IAC/C;AAAA,EACF,GAAG,CAAC,OAAO,MAAM,mBAAmB,QAAQ,CAAC;AAE7C,MAAI,CAAC,SAAS;AACZ,WAAO;AAAA,EACT;AAEA,MAAI,YAAY;AACd,WACE,6BAAAA,QAAA;AAAA,MAAC,0BAAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA,OAAO,oBAAoB,SAAY;AAAA,QACvC,UAAU,CAAC,CAAC;AAAA,QACZ;AAAA,QACA;AAAA;AAAA,MAEA,6BAAAD,QAAA;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA,QAAQ,CAAC,EAAE,MAAM,MAAM;AACrB,mBACE,6BAAAA,QAAA;AAAA,cAAC;AAAA;AAAA,gBACE,GAAG;AAAA,gBACJ;AAAA,gBACA,KAAK;AAAA,gBACL;AAAA,gBACA;AAAA,gBACA,OAAO,CAAC,CAAC;AAAA,gBACT;AAAA,gBACA,iBAAe,CAAC,CAAC;AAAA,gBACjB,oBAAkB,SAAS,GAAG,IAAI;AAAA,gBAClC;AAAA,gBACA,UAAU,aAAa;AAAA,gBACtB,GAAG;AAAA;AAAA,YACN;AAAA,UAEJ;AAAA;AAAA,MACF;AAAA,IACF;AAAA,EAEJ;AAEA,SACE,6BAAAA,QAAA;AAAA,IAAC,0BAAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA,OAAO,oBAAoB,SAAY;AAAA,MACvC,UAAU,CAAC,CAAC;AAAA,MACZ;AAAA,MACA;AAAA;AAAA,IAEC,WAAW,SACV,6BAAAD,QAAA;AAAA,MAAC;AAAA;AAAA,QACE,GAAG,SAAS,IAAI;AAAA,QACjB;AAAA,QACA,OAAO,CAAC,CAAC;AAAA,QACT;AAAA,QACA;AAAA,QACA,iBAAe,CAAC,CAAC;AAAA,QACjB,oBAAkB,SAAS,GAAG,IAAI;AAAA,QAClC;AAAA,QACA,UAAU,aAAa;AAAA,QACtB,GAAG;AAAA;AAAA,IACN,IAEA,6BAAAA,QAAA;AAAA,MAAC;AAAA;AAAA,QACE,GAAG,SAAS,IAAI;AAAA,QACjB;AAAA,QACA;AAAA,QACA,OAAO,CAAC,CAAC;AAAA,QACT;AAAA,QACA;AAAA,QACA,iBAAe,CAAC,CAAC;AAAA,QACjB,oBAAkB,SAAS,GAAG,IAAI;AAAA,QAClC;AAAA,QACA,UAAU,aAAa;AAAA,QACvB,KAAK;AAAA,QACJ,GAAG;AAAA;AAAA,IACN;AAAA,EAEJ;AAEJ;",
|
|
6
6
|
"names": ["React", "FieldBaseContainer"]
|
|
7
7
|
}
|
|
@@ -33,28 +33,29 @@ __export(FieldBaseContainer_exports, {
|
|
|
33
33
|
module.exports = __toCommonJS(FieldBaseContainer_exports);
|
|
34
34
|
var import_react = __toESM(require("react"));
|
|
35
35
|
var import_Label = __toESM(require("@digigov/form/inputs/Label"));
|
|
36
|
-
var import_ErrorMessage =
|
|
36
|
+
var import_ErrorMessage = require("@digigov/react-core/ErrorMessage");
|
|
37
37
|
var import_FieldContainer = __toESM(require("@digigov/react-core/FieldContainer"));
|
|
38
38
|
var import_Fieldset = __toESM(require("@digigov/react-core/Fieldset"));
|
|
39
39
|
var import_FieldsetLegend = __toESM(require("@digigov/react-core/FieldsetLegend"));
|
|
40
|
-
var import_Hint = __toESM(require("@digigov/react-core/Hint"));
|
|
41
40
|
var import_LabelContainer = __toESM(require("@digigov/react-core/LabelContainer"));
|
|
42
41
|
var import_i18n = require("@digigov/ui/i18n");
|
|
42
|
+
var import_Hint = require("@digigov/ui/typography/Hint");
|
|
43
43
|
const FieldBaseContainer = ({
|
|
44
44
|
name,
|
|
45
45
|
wrapper,
|
|
46
46
|
label,
|
|
47
47
|
children,
|
|
48
48
|
error,
|
|
49
|
+
hasError,
|
|
49
50
|
layout
|
|
50
51
|
}) => {
|
|
51
52
|
const { t } = (0, import_i18n.useTranslation)();
|
|
52
53
|
const errorMessage = error?.message.key ? error.message.key : error?.message || "";
|
|
53
54
|
const errorContext = error?.message.context || {};
|
|
54
55
|
if (wrapper === "fieldset") {
|
|
55
|
-
return /* @__PURE__ */ import_react.default.createElement(import_FieldContainer.default, { error:
|
|
56
|
+
return /* @__PURE__ */ import_react.default.createElement(import_FieldContainer.default, { error: hasError, ...layout }, /* @__PURE__ */ import_react.default.createElement(import_Fieldset.default, null, /* @__PURE__ */ import_react.default.createElement(import_FieldsetLegend.default, { size: "sm" }, label && label.primary), label && label.secondary && /* @__PURE__ */ import_react.default.createElement(import_Hint.Hint, null, t(label.secondary)), error && /* @__PURE__ */ import_react.default.createElement(import_ErrorMessage.ErrorMessage, { id: `${name}-error` }, t(errorMessage, errorContext)), children, label && label.hint && /* @__PURE__ */ import_react.default.createElement(import_Hint.Hint, { size: "sm" }, label.hint)));
|
|
56
57
|
} else {
|
|
57
|
-
return /* @__PURE__ */ import_react.default.createElement(import_FieldContainer.default, { error:
|
|
58
|
+
return /* @__PURE__ */ import_react.default.createElement(import_FieldContainer.default, { error: hasError, ...layout }, /* @__PURE__ */ import_react.default.createElement(import_LabelContainer.default, null, label && /* @__PURE__ */ import_react.default.createElement(import_Label.default, { label }), error && /* @__PURE__ */ import_react.default.createElement(import_ErrorMessage.ErrorMessage, { id: `${name}-error` }, t(errorMessage, errorContext)), children, label && label.hint && /* @__PURE__ */ import_react.default.createElement(import_Hint.Hint, { size: "sm" }, label.hint)));
|
|
58
59
|
}
|
|
59
60
|
};
|
|
60
61
|
var FieldBaseContainer_default = FieldBaseContainer;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/Field/FieldBaseContainer.tsx"],
|
|
4
|
-
"sourcesContent": ["import React from 'react';\nimport { FieldContainerProps } from '@digigov/form/Field/types';\nimport Label from '@digigov/form/inputs/Label';\nimport ErrorMessage from '@digigov/react-core/ErrorMessage';\nimport FieldContainer from '@digigov/react-core/FieldContainer';\nimport CoreFieldset from '@digigov/react-core/Fieldset';\nimport FieldsetLegend from '@digigov/react-core/FieldsetLegend';\nimport
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAElB,mBAAkB;AAClB,
|
|
6
|
-
"names": ["React", "FieldContainer", "CoreFieldset", "FieldsetLegend", "
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport { FieldContainerProps } from '@digigov/form/Field/types';\nimport Label from '@digigov/form/inputs/Label';\nimport { ErrorMessage } from '@digigov/react-core/ErrorMessage';\nimport FieldContainer from '@digigov/react-core/FieldContainer';\nimport CoreFieldset from '@digigov/react-core/Fieldset';\nimport FieldsetLegend from '@digigov/react-core/FieldsetLegend';\nimport LabelContainer from '@digigov/react-core/LabelContainer';\nimport { useTranslation } from '@digigov/ui/i18n';\nimport { Hint } from '@digigov/ui/typography/Hint';\n\nexport const FieldBaseContainer: React.FC<FieldContainerProps> = ({\n name,\n wrapper,\n label,\n children,\n error,\n hasError,\n layout,\n}) => {\n const { t } = useTranslation();\n const errorMessage = error?.message.key\n ? error.message.key\n : error?.message || '';\n const errorContext = error?.message.context || {};\n if (wrapper === 'fieldset') {\n return (\n <FieldContainer error={hasError} {...layout}>\n <CoreFieldset>\n <FieldsetLegend size=\"sm\">{label && label.primary}</FieldsetLegend>\n {label && label.secondary && <Hint>{t(label.secondary)}</Hint>}\n {error && (\n <ErrorMessage id={`${name}-error`}>\n {t(errorMessage, errorContext)}\n </ErrorMessage>\n )}\n {children}\n {label && label.hint && <Hint size=\"sm\">{label.hint}</Hint>}\n </CoreFieldset>\n </FieldContainer>\n );\n } else {\n return (\n <FieldContainer error={hasError} {...layout}>\n <LabelContainer>\n {label && <Label label={label} />}\n {error && (\n <ErrorMessage id={`${name}-error`}>\n {t(errorMessage, errorContext)}\n </ErrorMessage>\n )}\n {children}\n {label && label.hint && <Hint size=\"sm\">{label.hint}</Hint>}\n </LabelContainer>\n </FieldContainer>\n );\n }\n};\n\nexport default FieldBaseContainer;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAElB,mBAAkB;AAClB,0BAA6B;AAC7B,4BAA2B;AAC3B,sBAAyB;AACzB,4BAA2B;AAC3B,4BAA2B;AAC3B,kBAA+B;AAC/B,kBAAqB;AAEd,MAAM,qBAAoD,CAAC;AAAA,EAChE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,EAAE,EAAE,QAAI,4BAAe;AAC7B,QAAM,eAAe,OAAO,QAAQ,MAChC,MAAM,QAAQ,MACd,OAAO,WAAW;AACtB,QAAM,eAAe,OAAO,QAAQ,WAAW,CAAC;AAChD,MAAI,YAAY,YAAY;AAC1B,WACE,6BAAAA,QAAA,cAAC,sBAAAC,SAAA,EAAe,OAAO,UAAW,GAAG,UACnC,6BAAAD,QAAA,cAAC,gBAAAE,SAAA,MACC,6BAAAF,QAAA,cAAC,sBAAAG,SAAA,EAAe,MAAK,QAAM,SAAS,MAAM,OAAQ,GACjD,SAAS,MAAM,aAAa,6BAAAH,QAAA,cAAC,wBAAM,EAAE,MAAM,SAAS,CAAE,GACtD,SACC,6BAAAA,QAAA,cAAC,oCAAa,IAAI,GAAG,IAAI,YACtB,EAAE,cAAc,YAAY,CAC/B,GAED,UACA,SAAS,MAAM,QAAQ,6BAAAA,QAAA,cAAC,oBAAK,MAAK,QAAM,MAAM,IAAK,CACtD,CACF;AAAA,EAEJ,OAAO;AACL,WACE,6BAAAA,QAAA,cAAC,sBAAAC,SAAA,EAAe,OAAO,UAAW,GAAG,UACnC,6BAAAD,QAAA,cAAC,sBAAAI,SAAA,MACE,SAAS,6BAAAJ,QAAA,cAAC,aAAAK,SAAA,EAAM,OAAc,GAC9B,SACC,6BAAAL,QAAA,cAAC,oCAAa,IAAI,GAAG,IAAI,YACtB,EAAE,cAAc,YAAY,CAC/B,GAED,UACA,SAAS,MAAM,QAAQ,6BAAAA,QAAA,cAAC,oBAAK,MAAK,QAAM,MAAM,IAAK,CACtD,CACF;AAAA,EAEJ;AACF;AAEA,IAAO,6BAAQ;",
|
|
6
|
+
"names": ["React", "FieldContainer", "CoreFieldset", "FieldsetLegend", "LabelContainer", "Label"]
|
|
7
7
|
}
|
|
@@ -42,7 +42,8 @@ const ChildFieldMemo = import_react.default.memo(
|
|
|
42
42
|
control,
|
|
43
43
|
reset,
|
|
44
44
|
register,
|
|
45
|
-
error
|
|
45
|
+
error,
|
|
46
|
+
Field
|
|
46
47
|
}) {
|
|
47
48
|
const newField = (0, import_evaluateFieldWithConditions.evaluateFieldWithConditions)(
|
|
48
49
|
field,
|
|
@@ -52,6 +53,7 @@ const ChildFieldMemo = import_react.default.memo(
|
|
|
52
53
|
import_FieldBase.FieldBase,
|
|
53
54
|
{
|
|
54
55
|
...newField,
|
|
56
|
+
Field,
|
|
55
57
|
name: newField.key,
|
|
56
58
|
reset,
|
|
57
59
|
control,
|
|
@@ -80,7 +82,8 @@ const FieldConditional = ({
|
|
|
80
82
|
field,
|
|
81
83
|
register,
|
|
82
84
|
reset,
|
|
83
|
-
error
|
|
85
|
+
error,
|
|
86
|
+
Field
|
|
84
87
|
}) => {
|
|
85
88
|
const dependencyKeys = Object.keys(field.condition);
|
|
86
89
|
const dependencyValues = (0, import_react_hook_form.useWatch)({
|
|
@@ -102,7 +105,8 @@ const FieldConditional = ({
|
|
|
102
105
|
control,
|
|
103
106
|
register,
|
|
104
107
|
reset,
|
|
105
|
-
error
|
|
108
|
+
error,
|
|
109
|
+
Field
|
|
106
110
|
}
|
|
107
111
|
);
|
|
108
112
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/Field/FieldConditional.tsx"],
|
|
4
|
-
"sourcesContent": ["import React from 'react';\nimport { useWatch } from 'react-hook-form';\nimport { FieldBase } from '@digigov/form/Field/FieldBase';\nimport {\n ChildFieldMemoProps,\n FieldConditionalProps,\n} from '@digigov/form/Field/types';\nimport { evaluateFieldWithConditions } from '@digigov/form/Field/utils/evaluateFieldWithConditions';\n\nconst ChildFieldMemo = React.memo(\n function ChildField({\n dependencies,\n field,\n control,\n reset,\n register,\n error,\n }: ChildFieldMemoProps) {\n const newField = evaluateFieldWithConditions(\n field,\n dependencies as FormData\n );\n return (\n <FieldBase\n {...newField}\n name={newField.key}\n reset={reset}\n control={control}\n register={register}\n error={error}\n />\n );\n },\n (prev, next) => {\n if (!prev || !prev.dependencies) {\n return false;\n }\n if (prev.error !== next.error) {\n return false;\n }\n for (const dep in next.dependencies) {\n if (next.dependencies[dep] !== prev.dependencies[dep]) {\n return false;\n }\n }\n return true;\n }\n);\n\nexport const FieldConditional: React.FC<FieldConditionalProps> = ({\n control,\n field,\n register,\n reset,\n error,\n}) => {\n const dependencyKeys = Object.keys(field.condition);\n const dependencyValues = useWatch({\n name: dependencyKeys,\n control,\n });\n const variables = dependencyKeys.reduce(\n (data, fieldKey, index) => ({\n ...data,\n [fieldKey]: dependencyValues[index],\n }),\n {}\n );\n return (\n <ChildFieldMemo\n dependencies={variables}\n field={field}\n control={control}\n register={register}\n reset={reset}\n error={error}\n />\n );\n};\n\nexport default FieldConditional;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAClB,6BAAyB;AACzB,uBAA0B;AAK1B,yCAA4C;AAE5C,MAAM,iBAAiB,aAAAA,QAAM;AAAA,EAC3B,SAAS,WAAW;AAAA,IAClB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,GAAwB;AACtB,UAAM,eAAW;AAAA,MACf;AAAA,MACA;AAAA,IACF;AACA,WACE,6BAAAA,QAAA;AAAA,MAAC;AAAA;AAAA,QACE,GAAG;AAAA,QACJ,MAAM,SAAS;AAAA,QACf;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACF;AAAA,EAEJ;AAAA,EACA,CAAC,MAAM,SAAS;AACd,QAAI,CAAC,QAAQ,CAAC,KAAK,cAAc;AAC/B,aAAO;AAAA,IACT;AACA,QAAI,KAAK,UAAU,KAAK,OAAO;AAC7B,aAAO;AAAA,IACT;AACA,eAAW,OAAO,KAAK,cAAc;AACnC,UAAI,KAAK,aAAa,GAAG,MAAM,KAAK,aAAa,GAAG,GAAG;AACrD,eAAO;AAAA,MACT;AAAA,IACF;AACA,WAAO;AAAA,EACT;AACF;AAEO,MAAM,mBAAoD,CAAC;AAAA,EAChE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,iBAAiB,OAAO,KAAK,MAAM,SAAS;AAClD,QAAM,uBAAmB,iCAAS;AAAA,IAChC,MAAM;AAAA,IACN;AAAA,EACF,CAAC;AACD,QAAM,YAAY,eAAe;AAAA,IAC/B,CAAC,MAAM,UAAU,WAAW;AAAA,MAC1B,GAAG;AAAA,MACH,CAAC,QAAQ,GAAG,iBAAiB,KAAK;AAAA,IACpC;AAAA,IACA,CAAC;AAAA,EACH;AACA,SACE,6BAAAA,QAAA;AAAA,IAAC;AAAA;AAAA,MACC,cAAc;AAAA,MACd;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,EACF;AAEJ;AAEA,IAAO,2BAAQ;",
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport { useWatch } from 'react-hook-form';\nimport { FieldBase } from '@digigov/form/Field/FieldBase';\nimport {\n ChildFieldMemoProps,\n FieldConditionalProps,\n} from '@digigov/form/Field/types';\nimport { evaluateFieldWithConditions } from '@digigov/form/Field/utils/evaluateFieldWithConditions';\n\nconst ChildFieldMemo = React.memo(\n function ChildField({\n dependencies,\n field,\n control,\n reset,\n register,\n error,\n Field,\n }: ChildFieldMemoProps) {\n const newField = evaluateFieldWithConditions(\n field,\n dependencies as FormData\n );\n return (\n <FieldBase\n {...newField}\n Field={Field}\n name={newField.key}\n reset={reset}\n control={control}\n register={register}\n error={error}\n />\n );\n },\n (prev, next) => {\n if (!prev || !prev.dependencies) {\n return false;\n }\n if (prev.error !== next.error) {\n return false;\n }\n for (const dep in next.dependencies) {\n if (next.dependencies[dep] !== prev.dependencies[dep]) {\n return false;\n }\n }\n return true;\n }\n);\n\nexport const FieldConditional: React.FC<FieldConditionalProps> = ({\n control,\n field,\n register,\n reset,\n error,\n Field,\n}) => {\n const dependencyKeys = Object.keys(field.condition);\n const dependencyValues = useWatch({\n name: dependencyKeys,\n control,\n });\n const variables = dependencyKeys.reduce(\n (data, fieldKey, index) => ({\n ...data,\n [fieldKey]: dependencyValues[index],\n }),\n {}\n );\n return (\n <ChildFieldMemo\n dependencies={variables}\n field={field}\n control={control}\n register={register}\n reset={reset}\n error={error}\n Field={Field}\n />\n );\n};\n\nexport default FieldConditional;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAClB,6BAAyB;AACzB,uBAA0B;AAK1B,yCAA4C;AAE5C,MAAM,iBAAiB,aAAAA,QAAM;AAAA,EAC3B,SAAS,WAAW;AAAA,IAClB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,GAAwB;AACtB,UAAM,eAAW;AAAA,MACf;AAAA,MACA;AAAA,IACF;AACA,WACE,6BAAAA,QAAA;AAAA,MAAC;AAAA;AAAA,QACE,GAAG;AAAA,QACJ;AAAA,QACA,MAAM,SAAS;AAAA,QACf;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACF;AAAA,EAEJ;AAAA,EACA,CAAC,MAAM,SAAS;AACd,QAAI,CAAC,QAAQ,CAAC,KAAK,cAAc;AAC/B,aAAO;AAAA,IACT;AACA,QAAI,KAAK,UAAU,KAAK,OAAO;AAC7B,aAAO;AAAA,IACT;AACA,eAAW,OAAO,KAAK,cAAc;AACnC,UAAI,KAAK,aAAa,GAAG,MAAM,KAAK,aAAa,GAAG,GAAG;AACrD,eAAO;AAAA,MACT;AAAA,IACF;AACA,WAAO;AAAA,EACT;AACF;AAEO,MAAM,mBAAoD,CAAC;AAAA,EAChE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,iBAAiB,OAAO,KAAK,MAAM,SAAS;AAClD,QAAM,uBAAmB,iCAAS;AAAA,IAChC,MAAM;AAAA,IACN;AAAA,EACF,CAAC;AACD,QAAM,YAAY,eAAe;AAAA,IAC/B,CAAC,MAAM,UAAU,WAAW;AAAA,MAC1B,GAAG;AAAA,MACH,CAAC,QAAQ,GAAG,iBAAiB,KAAK;AAAA,IACpC;AAAA,IACA,CAAC;AAAA,EACH;AACA,SACE,6BAAAA,QAAA;AAAA,IAAC;AAAA;AAAA,MACC,cAAc;AAAA,MACd;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,EACF;AAEJ;AAEA,IAAO,2BAAQ;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|
package/cjs/Field/index.js
CHANGED
|
@@ -79,7 +79,8 @@ const Field = ({
|
|
|
79
79
|
reset,
|
|
80
80
|
register,
|
|
81
81
|
field: calculatedField,
|
|
82
|
-
error
|
|
82
|
+
error,
|
|
83
|
+
Field
|
|
83
84
|
}
|
|
84
85
|
);
|
|
85
86
|
}
|
|
@@ -89,9 +90,15 @@ const Field = ({
|
|
|
89
90
|
import_FieldArray.default,
|
|
90
91
|
{
|
|
91
92
|
control,
|
|
93
|
+
trigger,
|
|
92
94
|
register,
|
|
95
|
+
clearErrors,
|
|
93
96
|
error,
|
|
97
|
+
getValues,
|
|
98
|
+
setValue,
|
|
94
99
|
formState,
|
|
100
|
+
Field,
|
|
101
|
+
reset,
|
|
95
102
|
...calculatedField
|
|
96
103
|
}
|
|
97
104
|
);
|
|
@@ -110,6 +117,7 @@ const Field = ({
|
|
|
110
117
|
setValue,
|
|
111
118
|
getValues,
|
|
112
119
|
unregister,
|
|
120
|
+
Field,
|
|
113
121
|
...calculatedField
|
|
114
122
|
}
|
|
115
123
|
);
|
|
@@ -124,7 +132,7 @@ const Field = ({
|
|
|
124
132
|
register,
|
|
125
133
|
reset,
|
|
126
134
|
error,
|
|
127
|
-
|
|
135
|
+
Field
|
|
128
136
|
}
|
|
129
137
|
);
|
|
130
138
|
};
|
package/cjs/Field/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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 />\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 {...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 {...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
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA+B;AAC/B,uBAA0B;AAC1B,8BAA6B;AAM7B,mBAGO;AACP,4BAA+B;AAC/B,sBAAyB;AACzB,wBAAuB;AACvB,+BAAyB;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,QAAI,0BAAS,MAAM,aAAa,OAAO,cAAc,IAAI;AACzD,QAAM,sBAAmC;AAAA,IACvC,UACE;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,6BAAAA,QAAA;AAAA,MAAC,wBAAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA,OAAO;AAAA,QACP;AAAA;AAAA,IACF;AAAA,EAEJ;AACA,MAAI,gBAAgB,SAAS,WAAW,CAAC,gBAAgB,cAAc;AACrE,oBAAgB,OAAO;AACvB,WACE,6BAAAD,QAAA;AAAA,MAAC,kBAAAE;AAAA,MAAA;AAAA,QACC;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,6BAAAF,QAAA;AAAA,MAAC,yBAAAG;AAAA,MAAA;AAAA,QACC;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,6BAAAH,QAAA;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA
|
|
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 trigger={trigger}\n register={register}\n clearErrors={clearErrors}\n error={error}\n getValues={getValues}\n setValue={setValue}\n formState={formState}\n Field={Field}\n reset={reset}\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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA+B;AAC/B,uBAA0B;AAC1B,8BAA6B;AAM7B,mBAGO;AACP,4BAA+B;AAC/B,sBAAyB;AACzB,wBAAuB;AACvB,+BAAyB;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,QAAI,0BAAS,MAAM,aAAa,OAAO,cAAc,IAAI;AACzD,QAAM,sBAAmC;AAAA,IACvC,UACE;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,6BAAAA,QAAA;AAAA,MAAC,wBAAAC;AAAA,MAAA;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,6BAAAD,QAAA;AAAA,MAAC,kBAAAE;AAAA,MAAA;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,MACE,gBAAgB,SAAS,WACzB,gBAAgB,iBAAiB,MACjC;AACA,oBAAgB,OAAO;AACvB,WACE,6BAAAF,QAAA;AAAA,MAAC,yBAAAG;AAAA,MAAA;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,6BAAAH,QAAA;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
6
|
"names": ["React", "FieldConditional", "FieldArray", "Multiplicity"]
|
|
7
7
|
}
|
package/cjs/Field/types.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/Field/types.tsx"],
|
|
4
|
-
"sourcesContent": ["import React from 'react';\nimport { ErrorOption, UseFormReturn, UseFormProps } from 'react-hook-form';\nimport { ValidatorSchema } from '@digigov/form/validators/types';\nimport { GridProps } from '@digigov/ui/layouts/Grid';\n\nexport
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport { ErrorOption, UseFormReturn, UseFormProps } from 'react-hook-form';\nimport { ValidatorSchema } from '@digigov/form/validators/types';\nimport { GridProps } from '@digigov/ui/layouts/Grid';\n\nexport interface FieldLabelProps {\n primary?: string;\n secondary?: string;\n hint?: string;\n}\n\nexport interface FieldSpec {\n key: string; // !TODO rename key to name;\n type?:\n | 'int'\n | 'string'\n | 'text'\n | 'boolean'\n | 'email'\n | 'uuid4'\n | 'choice:multiple'\n | 'choice:single'\n | 'mobile_phone'\n | 'date'\n | 'datetime'\n | 'otp'\n | 'afm'\n | 'iban'\n | 'file'\n | 'image'\n | 'postal_code'\n | 'phone_number'\n | 'array'\n | 'object';\n trim?: boolean;\n component?: any;\n autoComplete?: string;\n maxLength?: number;\n condition?: Record<string, FieldCondition>;\n controlled?: boolean;\n label?: FieldLabelProps;\n extra?: Record<string, any>;\n editable?: boolean;\n variant?: 'inline' | 'dialog';\n required?: boolean;\n enabled?: boolean;\n disabled?: boolean;\n layout?: Record<\n string,\n | GridProps['xs']\n | GridProps['sm']\n | GridProps['md']\n | GridProps['lg']\n | GridProps['xl']\n >;\n validators?: ValidatorSchema[];\n wrapper?: 'label' | 'fieldset';\n maxWidth?: string;\n maxHeight?: string;\n width?: string;\n}\n\nexport interface FieldCondition {\n is: string | string[] | number | number[] | boolean | boolean[];\n then?: Partial<FieldSpec>;\n else?: Partial<FieldSpec>;\n}\nexport interface ChildFieldMemoProps extends FieldConditionalProps {\n dependencies: FormData;\n}\nexport type FormData = UseFormProps['defaultValues'];\n\nexport interface FieldWithCondition extends Omit<CalculatedField, 'condition'> {\n condition: Record<string, FieldCondition>;\n}\n\nexport interface FieldConditionalProps {\n field: FieldWithCondition;\n control: UseFormReturn['control'];\n register: UseFormReturn['register'];\n reset: UseFormReturn['reset'];\n error?: ErrorOption;\n Field: React.FC<FieldProps>;\n}\n\nexport interface FieldComponentItem {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n component: any;\n controlled?: boolean;\n wrapper?: FieldSpec['wrapper'];\n}\n\nexport interface FieldContainerProps {\n name?: FieldSpec['key'];\n layout?: FieldSpec['layout'];\n label?: FieldSpec['label'];\n error?: ErrorOption | Record<string, any>;\n hasError?: boolean;\n children?: React.ReactNode;\n wrapper?: FieldSpec['wrapper'];\n}\n\nexport type FieldComponentRegistry = Record<string, FieldComponentItem>;\n\nexport type OmittedFieldSpec = Omit<FieldSpec, 'component'>;\n\nexport type UnknownValue = never | never[];\n\nexport interface ControlledFieldProps {\n type?: string;\n value: UnknownValue;\n onChange: (v: UnknownValue) => void;\n defaultValue?: UnknownValue;\n onBlur?: (e: Event) => void;\n extra?: never;\n error?: boolean;\n name?: string;\n disabled?: boolean;\n Field: React.FC<FieldProps>;\n}\n\nexport interface UncontrolledFieldProps {\n name: string;\n register: FieldBaseProps['register'];\n control?: FieldBaseProps['control'];\n error?: boolean;\n extra?: Record<string, never>;\n type?: string;\n disabled?: boolean;\n Field: React.FC<FieldProps>;\n}\n\nexport interface CalculatedField extends OmittedFieldSpec {\n name: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n component: any;\n defaultValue?: never;\n error?: ErrorOption;\n wrapper?: FieldComponentItem['wrapper'];\n multiplicity?: boolean;\n}\n\nexport interface FieldBaseProps extends CalculatedField {\n control: UseFormReturn['control'];\n register: UseFormReturn['register'];\n reset: UseFormReturn['reset'];\n Field: React.FC<FieldProps>;\n}\n\nexport interface FieldProps extends FieldSpec {\n name: string;\n children?: React.ReactNode;\n}\n\nexport interface UseFieldProps {\n field: FieldSpec;\n control: FieldBaseProps['control'];\n register: FieldBaseProps['register'];\n reset: FieldBaseProps['reset'];\n watch: UseFormReturn['watch'];\n formState: UseFormReturn['formState'];\n getFieldState: UseFormReturn['getFieldState'];\n setValue: UseFormReturn['setValue'];\n getValues: UseFormReturn['getValues'];\n unregister: UseFormReturn['unregister'];\n trigger: UseFormReturn['trigger'];\n clearErrors: UseFormReturn['clearErrors'];\n error?: ErrorOption;\n componentRegistry?: FieldComponentRegistry;\n}\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;AAAA;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|