@digigov/form 1.2.0-dcbd7ded → 2.0.0-7d9a8d86
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/FieldBase/index.js +74 -68
- package/Field/FieldBase.js.map +7 -0
- package/Field/FieldBaseContainer/index.js +40 -34
- package/Field/FieldBaseContainer.js.map +7 -0
- package/Field/FieldConditional/index.js +48 -41
- package/Field/FieldConditional.js.map +7 -0
- package/Field/index.js +66 -61
- package/Field/index.js.map +7 -0
- package/Field/types/index.js +1 -1
- package/Field/types.js.map +7 -0
- package/Field/utils/index.js +84 -85
- package/Field/utils.js.map +7 -0
- package/FieldArray/FieldArray.stories/index.js +10 -6
- package/FieldArray/FieldArray.stories.js.map +7 -0
- package/FieldArray/__stories__/Default/index.js +90 -81
- package/FieldArray/__stories__/Default.js.map +7 -0
- package/FieldArray/__stories__/WithExactLength/index.js +90 -81
- package/FieldArray/__stories__/WithExactLength.js.map +7 -0
- package/FieldArray/index.js +49 -54
- package/FieldArray/index.js.map +7 -0
- package/FieldObject/index.js +52 -50
- package/FieldObject/index.js.map +7 -0
- package/Fieldset/FieldsetWithContext/index.js +28 -31
- package/Fieldset/FieldsetWithContext.js.map +7 -0
- package/Fieldset/index.js +33 -26
- package/Fieldset/index.js.map +7 -0
- package/Fieldset/types/index.js +1 -1
- package/Fieldset/types.js.map +7 -0
- package/Form.stories/index.js +7 -3
- package/Form.stories.js.map +7 -0
- package/FormBuilder/FormBuilder/index.js +99 -113
- package/FormBuilder/FormBuilder.js.map +7 -0
- package/FormBuilder/FormBuilder.stories/index.js +9 -5
- package/FormBuilder/FormBuilder.stories.js.map +7 -0
- package/FormBuilder/__stories__/Default/index.js +23 -23
- package/FormBuilder/__stories__/Default.js.map +7 -0
- package/FormBuilder/index.js +6 -2
- package/FormBuilder/index.js.map +7 -0
- package/FormContext/index.js +7 -3
- package/FormContext.js.map +7 -0
- package/MultiplicityField/MultiplicityField.stories/index.js +14 -10
- package/MultiplicityField/MultiplicityField.stories.js.map +7 -0
- package/MultiplicityField/__stories__/Default/index.js +94 -85
- package/MultiplicityField/__stories__/Default.js.map +7 -0
- package/MultiplicityField/__stories__/PreviewDisplay/index.js +84 -65
- package/MultiplicityField/__stories__/PreviewDisplay.js.map +7 -0
- package/MultiplicityField/__stories__/WithExactLength/index.js +91 -80
- package/MultiplicityField/__stories__/WithExactLength.js.map +7 -0
- package/MultiplicityField/__stories__/WithMaxLength/index.js +94 -83
- package/MultiplicityField/__stories__/WithMaxLength.js.map +7 -0
- package/MultiplicityField/__stories__/WithMinAndMaxLength/index.js +95 -84
- package/MultiplicityField/__stories__/WithMinAndMaxLength.js.map +7 -0
- package/MultiplicityField/__stories__/WithMinLength/index.js +94 -83
- package/MultiplicityField/__stories__/WithMinLength.js.map +7 -0
- package/MultiplicityField/add-objects/index.js +100 -131
- package/MultiplicityField/add-objects.js.map +7 -0
- package/MultiplicityField/index.js +94 -98
- package/MultiplicityField/index.js.map +7 -0
- package/Questions/Questions/index.js +35 -50
- package/Questions/Questions.js.map +7 -0
- package/Questions/Questions.stories/index.js +9 -5
- package/Questions/Questions.stories.js.map +7 -0
- package/Questions/QuestionsContext/index.js +9 -9
- package/Questions/QuestionsContext.js.map +7 -0
- package/Questions/Step/ReviewStep/index.js +40 -46
- package/Questions/Step/ReviewStep.js.map +7 -0
- package/Questions/Step/Step/index.js +29 -43
- package/Questions/Step/Step.js.map +7 -0
- package/Questions/Step/StepArrayReview/index.js +43 -42
- package/Questions/Step/StepArrayReview.js.map +7 -0
- package/Questions/Step/StepContext/index.js +15 -19
- package/Questions/Step/StepContext.js.map +7 -0
- package/Questions/Step/StepDescription/index.js +27 -22
- package/Questions/Step/StepDescription.js.map +7 -0
- package/Questions/Step/StepForm/index.js +32 -39
- package/Questions/Step/StepForm.js.map +7 -0
- package/Questions/Step/StepQuote/index.js +12 -9
- package/Questions/Step/StepQuote.js.map +7 -0
- package/Questions/Step/StepTitle/index.js +36 -36
- package/Questions/Step/StepTitle.js.map +7 -0
- package/Questions/Step/getAddMoreFields/index.js +28 -20
- package/Questions/Step/getAddMoreFields.js.map +7 -0
- package/Questions/Step/index.js +17 -13
- package/Questions/Step/index.js.map +7 -0
- package/Questions/Step/types/index.js +1 -1
- package/Questions/Step/types.js.map +7 -0
- package/Questions/__stories__/Default/index.js +111 -98
- package/Questions/__stories__/Default.js.map +7 -0
- package/Questions/getNextStep/index.js +10 -10
- package/Questions/getNextStep.js.map +7 -0
- package/Questions/index.js +7 -3
- package/Questions/index.js.map +7 -0
- package/Questions/index.spec/index.js +63 -57
- package/Questions/index.spec.js.map +7 -0
- package/Questions/types/index.js +1 -1
- package/Questions/types.js.map +7 -0
- package/cjs/Field/FieldBase/index.js +100 -74
- package/cjs/Field/FieldBase.js.map +7 -0
- package/cjs/Field/FieldBaseContainer/index.js +66 -40
- package/cjs/Field/FieldBaseContainer.js.map +7 -0
- package/cjs/Field/FieldConditional/index.js +74 -47
- package/cjs/Field/FieldConditional.js.map +7 -0
- package/cjs/Field/index.js +92 -70
- package/cjs/Field/index.js.map +7 -0
- package/cjs/Field/types/index.js +4 -5
- package/cjs/Field/types.js.map +7 -0
- package/cjs/Field/utils/index.js +120 -106
- package/cjs/Field/utils.js.map +7 -0
- package/cjs/FieldArray/FieldArray.stories/index.js +36 -37
- package/cjs/FieldArray/FieldArray.stories.js.map +7 -0
- package/cjs/FieldArray/__stories__/Default/index.js +116 -90
- package/cjs/FieldArray/__stories__/Default.js.map +7 -0
- package/cjs/FieldArray/__stories__/WithExactLength/index.js +116 -90
- package/cjs/FieldArray/__stories__/WithExactLength.js.map +7 -0
- package/cjs/FieldArray/index.js +75 -60
- package/cjs/FieldArray/index.js.map +7 -0
- package/cjs/FieldObject/index.js +78 -59
- package/cjs/FieldObject/index.js.map +7 -0
- package/cjs/Fieldset/FieldsetWithContext/index.js +49 -40
- package/cjs/Fieldset/FieldsetWithContext.js.map +7 -0
- package/cjs/Fieldset/index.js +61 -36
- package/cjs/Fieldset/index.js.map +7 -0
- package/cjs/Fieldset/types/index.js +4 -5
- package/cjs/Fieldset/types.js.map +7 -0
- package/cjs/Form.stories/index.js +15 -8
- package/cjs/Form.stories.js.map +7 -0
- package/cjs/FormBuilder/FormBuilder/index.js +127 -123
- package/cjs/FormBuilder/FormBuilder.js.map +7 -0
- package/cjs/FormBuilder/FormBuilder.stories/index.js +35 -25
- package/cjs/FormBuilder/FormBuilder.stories.js.map +7 -0
- package/cjs/FormBuilder/__stories__/Default/index.js +50 -33
- package/cjs/FormBuilder/__stories__/Default.js.map +7 -0
- package/cjs/FormBuilder/index.js +30 -7
- package/cjs/FormBuilder/index.js.map +7 -0
- package/cjs/FormContext/index.js +33 -8
- package/cjs/FormContext.js.map +7 -0
- package/cjs/MultiplicityField/MultiplicityField.stories/index.js +40 -85
- package/cjs/MultiplicityField/MultiplicityField.stories.js.map +7 -0
- package/cjs/MultiplicityField/__stories__/Default/index.js +120 -94
- package/cjs/MultiplicityField/__stories__/Default.js.map +7 -0
- package/cjs/MultiplicityField/__stories__/PreviewDisplay/index.js +93 -74
- package/cjs/MultiplicityField/__stories__/PreviewDisplay.js.map +7 -0
- package/cjs/MultiplicityField/__stories__/WithExactLength/index.js +117 -89
- package/cjs/MultiplicityField/__stories__/WithExactLength.js.map +7 -0
- package/cjs/MultiplicityField/__stories__/WithMaxLength/index.js +120 -92
- package/cjs/MultiplicityField/__stories__/WithMaxLength.js.map +7 -0
- package/cjs/MultiplicityField/__stories__/WithMinAndMaxLength/index.js +121 -93
- package/cjs/MultiplicityField/__stories__/WithMinAndMaxLength.js.map +7 -0
- package/cjs/MultiplicityField/__stories__/WithMinLength/index.js +120 -92
- package/cjs/MultiplicityField/__stories__/WithMinLength.js.map +7 -0
- package/cjs/MultiplicityField/add-objects/index.js +124 -137
- package/cjs/MultiplicityField/add-objects.js.map +7 -0
- package/cjs/MultiplicityField/index.js +121 -107
- package/cjs/MultiplicityField/index.js.map +7 -0
- package/cjs/Questions/Questions/index.js +61 -59
- package/cjs/Questions/Questions.js.map +7 -0
- package/cjs/Questions/Questions.stories/index.js +35 -25
- package/cjs/Questions/Questions.stories.js.map +7 -0
- package/cjs/Questions/QuestionsContext/index.js +35 -14
- package/cjs/Questions/QuestionsContext.js.map +7 -0
- package/cjs/Questions/Step/ReviewStep/index.js +60 -55
- package/cjs/Questions/Step/ReviewStep.js.map +7 -0
- package/cjs/Questions/Step/Step/index.js +55 -52
- package/cjs/Questions/Step/Step.js.map +7 -0
- package/cjs/Questions/Step/StepArrayReview/index.js +61 -51
- package/cjs/Questions/Step/StepArrayReview.js.map +7 -0
- package/cjs/Questions/Step/StepContext/index.js +41 -24
- package/cjs/Questions/Step/StepContext.js.map +7 -0
- package/cjs/Questions/Step/StepDescription/index.js +54 -31
- package/cjs/Questions/Step/StepDescription.js.map +7 -0
- package/cjs/Questions/Step/StepForm/index.js +58 -48
- package/cjs/Questions/Step/StepForm.js.map +7 -0
- package/cjs/Questions/Step/StepQuote/index.js +38 -15
- package/cjs/Questions/Step/StepQuote.js.map +7 -0
- package/cjs/Questions/Step/StepTitle/index.js +62 -45
- package/cjs/Questions/Step/StepTitle.js.map +7 -0
- package/cjs/Questions/Step/getAddMoreFields/index.js +38 -25
- package/cjs/Questions/Step/getAddMoreFields.js.map +7 -0
- package/cjs/Questions/Step/index.js +42 -143
- package/cjs/Questions/Step/index.js.map +7 -0
- package/cjs/Questions/Step/types/index.js +4 -5
- package/cjs/Questions/Step/types.js.map +7 -0
- package/cjs/Questions/__stories__/Default/index.js +131 -107
- package/cjs/Questions/__stories__/Default.js.map +7 -0
- package/cjs/Questions/getNextStep/index.js +19 -14
- package/cjs/Questions/getNextStep.js.map +7 -0
- package/cjs/Questions/index.js +31 -20
- package/cjs/Questions/index.js.map +7 -0
- package/cjs/Questions/index.spec/index.js +81 -61
- package/cjs/Questions/index.spec.js.map +7 -0
- package/cjs/Questions/types/index.js +4 -5
- package/cjs/Questions/types.js.map +7 -0
- package/cjs/index.js +31 -21
- package/cjs/index.js.map +7 -0
- package/cjs/inputs/AutoCompleteInput/AutoComplete.stories/index.js +36 -25
- package/cjs/inputs/AutoCompleteInput/AutoComplete.stories.js.map +7 -0
- package/cjs/inputs/AutoCompleteInput/__stories__/Default/index.js +70 -53
- package/cjs/inputs/AutoCompleteInput/__stories__/Default.js.map +7 -0
- package/cjs/inputs/AutoCompleteInput/__stories__/Multiple/index.js +72 -0
- package/cjs/inputs/AutoCompleteInput/__stories__/Multiple.js.map +7 -0
- package/cjs/inputs/AutoCompleteInput/index.js +58 -40
- package/cjs/inputs/AutoCompleteInput/index.js.map +7 -0
- package/cjs/inputs/Checkboxes/Checkboxes.stories/index.js +37 -49
- package/cjs/inputs/Checkboxes/Checkboxes.stories.js.map +7 -0
- package/cjs/inputs/Checkboxes/__stories__/Conditional/index.js +113 -88
- package/cjs/inputs/Checkboxes/__stories__/Conditional.js.map +7 -0
- package/cjs/inputs/Checkboxes/__stories__/Default/index.js +63 -48
- package/cjs/inputs/Checkboxes/__stories__/Default.js.map +7 -0
- package/cjs/inputs/Checkboxes/__stories__/WithDivider/index.js +64 -49
- package/cjs/inputs/Checkboxes/__stories__/WithDivider.js.map +7 -0
- package/cjs/inputs/Checkboxes/index.js +96 -98
- package/cjs/inputs/Checkboxes/index.js.map +7 -0
- package/cjs/inputs/DateInput/DateInput.stories/index.js +35 -25
- package/cjs/inputs/DateInput/DateInput.stories.js.map +7 -0
- package/cjs/inputs/DateInput/__stories__/Default/index.js +50 -31
- package/cjs/inputs/DateInput/__stories__/Default.js.map +7 -0
- package/cjs/inputs/DateInput/index.js +90 -90
- package/cjs/inputs/DateInput/index.js.map +7 -0
- package/cjs/inputs/FileInput/FileInput.stories/index.js +35 -25
- package/cjs/inputs/FileInput/FileInput.stories.js.map +7 -0
- package/cjs/inputs/FileInput/__stories__/Default/index.js +46 -29
- package/cjs/inputs/FileInput/__stories__/Default.js.map +7 -0
- package/cjs/inputs/FileInput/index.js +58 -59
- package/cjs/inputs/FileInput/index.js.map +7 -0
- package/cjs/inputs/ImageInput/ImageInput.stories/index.js +37 -49
- package/cjs/inputs/ImageInput/ImageInput.stories.js.map +7 -0
- package/cjs/inputs/ImageInput/__stories__/Default/index.js +54 -35
- package/cjs/inputs/ImageInput/__stories__/Default.js.map +7 -0
- package/cjs/inputs/ImageInput/__stories__/WithInvalidImageDimension/index.js +61 -42
- package/cjs/inputs/ImageInput/__stories__/WithInvalidImageDimension.js.map +7 -0
- package/cjs/inputs/ImageInput/__stories__/WithInvalidImageSize/index.js +58 -39
- package/cjs/inputs/ImageInput/__stories__/WithInvalidImageSize.js.map +7 -0
- package/cjs/inputs/ImageInput/index.js +65 -64
- package/cjs/inputs/ImageInput/index.js.map +7 -0
- package/cjs/inputs/Input/Input.stories/index.js +45 -134
- package/cjs/inputs/Input/Input.stories.js.map +7 -0
- package/cjs/inputs/Input/__stories__/AFM/index.js +49 -30
- package/cjs/inputs/Input/__stories__/AFM.js.map +7 -0
- package/cjs/inputs/Input/__stories__/Boolean/index.js +50 -31
- package/cjs/inputs/Input/__stories__/Boolean.js.map +7 -0
- package/cjs/inputs/Input/__stories__/Default/index.js +50 -31
- package/cjs/inputs/Input/__stories__/Default.js.map +7 -0
- package/cjs/inputs/Input/__stories__/IBAN/index.js +50 -31
- package/cjs/inputs/Input/__stories__/IBAN.js.map +7 -0
- package/cjs/inputs/Input/__stories__/Integer/index.js +47 -26
- package/cjs/inputs/Input/__stories__/Integer.js.map +7 -0
- package/cjs/inputs/Input/__stories__/LandlineNumber/index.js +53 -34
- package/cjs/inputs/Input/__stories__/LandlineNumber.js.map +7 -0
- package/cjs/inputs/Input/__stories__/MobilePhone/index.js +53 -34
- package/cjs/inputs/Input/__stories__/MobilePhone.js.map +7 -0
- package/cjs/inputs/Input/__stories__/PhoneNumber/index.js +52 -33
- package/cjs/inputs/Input/__stories__/PhoneNumber.js.map +7 -0
- package/cjs/inputs/Input/__stories__/PostalCode/index.js +50 -33
- package/cjs/inputs/Input/__stories__/PostalCode.js.map +7 -0
- package/cjs/inputs/Input/__stories__/TextWithCharacterLimit/index.js +50 -37
- package/cjs/inputs/Input/__stories__/TextWithCharacterLimit.js.map +7 -0
- package/cjs/inputs/Input/index.js +69 -67
- package/cjs/inputs/Input/index.js.map +7 -0
- package/cjs/inputs/Label/Label.stories/index.js +35 -25
- package/cjs/inputs/Label/Label.stories.js.map +7 -0
- package/cjs/inputs/Label/__stories__/Default/index.js +52 -35
- package/cjs/inputs/Label/__stories__/Default.js.map +7 -0
- package/cjs/inputs/Label/index.js +41 -20
- package/cjs/inputs/Label/index.js.map +7 -0
- package/cjs/inputs/OtpInput/OtpInput.stories/index.js +35 -25
- package/cjs/inputs/OtpInput/OtpInput.stories.js.map +7 -0
- package/cjs/inputs/OtpInput/__stories__/Default/index.js +55 -36
- package/cjs/inputs/OtpInput/__stories__/Default.js.map +7 -0
- package/cjs/inputs/OtpInput/index.js +102 -96
- package/cjs/inputs/OtpInput/index.js.map +7 -0
- package/cjs/inputs/Radio/Radio.stories/index.js +37 -49
- package/cjs/inputs/Radio/Radio.stories.js.map +7 -0
- package/cjs/inputs/Radio/__stories__/Conditional/index.js +113 -88
- package/cjs/inputs/Radio/__stories__/Conditional.js.map +7 -0
- package/cjs/inputs/Radio/__stories__/Default/index.js +67 -53
- package/cjs/inputs/Radio/__stories__/Default.js.map +7 -0
- package/cjs/inputs/Radio/__stories__/WithDivider/index.js +68 -54
- package/cjs/inputs/Radio/__stories__/WithDivider.js.map +7 -0
- package/cjs/inputs/Radio/index.js +77 -60
- package/cjs/inputs/Radio/index.js.map +7 -0
- package/cjs/inputs/Select/Select.stories/index.js +35 -25
- package/cjs/inputs/Select/Select.stories.js.map +7 -0
- package/cjs/inputs/Select/__stories__/Default/index.js +72 -59
- package/cjs/inputs/Select/__stories__/Default.js.map +7 -0
- package/cjs/inputs/Select/index.js +46 -36
- package/cjs/inputs/Select/index.js.map +7 -0
- package/cjs/inputs/index.js +56 -69
- package/cjs/inputs/index.js.map +7 -0
- package/cjs/internal/index.js +89 -346
- package/cjs/internal.js.map +7 -0
- package/cjs/lazy/index.js +87 -516
- package/cjs/lazy.js.map +7 -0
- package/cjs/registry/index.js +156 -137
- package/cjs/registry.js.map +7 -0
- package/cjs/types/index.js +4 -5
- package/cjs/types.js.map +7 -0
- package/cjs/utils/index.js +61 -79
- package/cjs/utils.js.map +7 -0
- package/cjs/validators/index.js +129 -131
- package/cjs/validators/index.js.map +7 -0
- package/cjs/validators/types/index.js +4 -5
- package/cjs/validators/types.js.map +7 -0
- package/cjs/validators/utils/afm/index.js +26 -21
- package/cjs/validators/utils/afm.js.map +7 -0
- package/cjs/validators/utils/file/index.js +31 -46
- package/cjs/validators/utils/file.js.map +7 -0
- package/cjs/validators/utils/iban/index.js +24 -17
- package/cjs/validators/utils/iban.js.map +7 -0
- package/cjs/validators/utils/image/index.js +76 -112
- package/cjs/validators/utils/image.js.map +7 -0
- package/cjs/validators/utils/index.js +70 -158
- package/cjs/validators/utils/index.js.map +7 -0
- package/cjs/validators/utils/int/index.js +22 -12
- package/cjs/validators/utils/int.js.map +7 -0
- package/cjs/validators/utils/number/index.js +21 -11
- package/cjs/validators/utils/number.js.map +7 -0
- package/cjs/validators/utils/otp/index.js +23 -13
- package/cjs/validators/utils/otp.js.map +7 -0
- package/cjs/validators/utils/phone/index.js +94 -58
- package/cjs/validators/utils/phone.js.map +7 -0
- package/cjs/validators/utils/postal_code/index.js +24 -16
- package/cjs/validators/utils/postal_code.js.map +7 -0
- package/cjs/validators/utils/text_limit/index.js +28 -25
- package/cjs/validators/utils/text_limit.js.map +7 -0
- package/cjs/validators/utils/uuid4/index.js +22 -13
- package/cjs/validators/utils/uuid4.js.map +7 -0
- package/cjs/validators/validators.spec/index.js +77 -60
- package/cjs/validators/validators.spec.js.map +7 -0
- package/index.js +8 -4
- package/index.js.map +7 -0
- package/inputs/AutoCompleteInput/AutoComplete.stories/index.js +10 -5
- package/inputs/AutoCompleteInput/AutoComplete.stories.d.ts +1 -0
- package/inputs/AutoCompleteInput/AutoComplete.stories.js.map +7 -0
- package/inputs/AutoCompleteInput/__stories__/Default/index.js +44 -44
- package/inputs/AutoCompleteInput/__stories__/Default.d.ts +1 -0
- package/inputs/AutoCompleteInput/__stories__/Default.js.map +7 -0
- package/inputs/AutoCompleteInput/__stories__/Multiple/index.js +45 -0
- package/inputs/AutoCompleteInput/__stories__/Multiple/package.json +6 -0
- package/inputs/AutoCompleteInput/__stories__/Multiple.d.ts +2 -0
- package/inputs/AutoCompleteInput/__stories__/Multiple.js.map +7 -0
- package/inputs/AutoCompleteInput/index.js +32 -31
- package/inputs/AutoCompleteInput/index.js.map +7 -0
- package/inputs/Checkboxes/Checkboxes.stories/index.js +11 -7
- package/inputs/Checkboxes/Checkboxes.stories.js.map +7 -0
- package/inputs/Checkboxes/__stories__/Conditional/index.js +87 -79
- package/inputs/Checkboxes/__stories__/Conditional.d.ts +1 -0
- package/inputs/Checkboxes/__stories__/Conditional.js.map +7 -0
- package/inputs/Checkboxes/__stories__/Default/index.js +36 -38
- package/inputs/Checkboxes/__stories__/Default.js.map +7 -0
- package/inputs/Checkboxes/__stories__/WithDivider/index.js +37 -39
- package/inputs/Checkboxes/__stories__/WithDivider.js.map +7 -0
- package/inputs/Checkboxes/index.js +70 -89
- package/inputs/Checkboxes/index.js.map +7 -0
- package/inputs/DateInput/DateInput.stories/index.js +9 -5
- package/inputs/DateInput/DateInput.stories.js.map +7 -0
- package/inputs/DateInput/__stories__/Default/index.js +23 -21
- package/inputs/DateInput/__stories__/Default.js.map +7 -0
- package/inputs/DateInput/index.js +63 -80
- package/inputs/DateInput/index.js.map +7 -0
- package/inputs/FileInput/FileInput.stories/index.js +9 -5
- package/inputs/FileInput/FileInput.stories.js.map +7 -0
- package/inputs/FileInput/__stories__/Default/index.js +19 -19
- package/inputs/FileInput/__stories__/Default.js.map +7 -0
- package/inputs/FileInput/index.js +32 -50
- package/inputs/FileInput/index.js.map +7 -0
- package/inputs/ImageInput/ImageInput.stories/index.js +11 -7
- package/inputs/ImageInput/ImageInput.stories.js.map +7 -0
- package/inputs/ImageInput/__stories__/Default/index.js +27 -25
- package/inputs/ImageInput/__stories__/Default.js.map +7 -0
- package/inputs/ImageInput/__stories__/WithInvalidImageDimension/index.js +34 -32
- package/inputs/ImageInput/__stories__/WithInvalidImageDimension.js.map +7 -0
- package/inputs/ImageInput/__stories__/WithInvalidImageSize/index.js +31 -29
- package/inputs/ImageInput/__stories__/WithInvalidImageSize.js.map +7 -0
- package/inputs/ImageInput/index.js +38 -55
- package/inputs/ImageInput/index.js.map +7 -0
- package/inputs/Input/Input.stories/index.js +18 -14
- package/inputs/Input/Input.stories.js.map +7 -0
- package/inputs/Input/__stories__/AFM/index.js +22 -20
- package/inputs/Input/__stories__/AFM.js.map +7 -0
- package/inputs/Input/__stories__/Boolean/index.js +23 -21
- package/inputs/Input/__stories__/Boolean.js.map +7 -0
- package/inputs/Input/__stories__/Default/index.js +23 -21
- package/inputs/Input/__stories__/Default.js.map +7 -0
- package/inputs/Input/__stories__/IBAN/index.js +23 -21
- package/inputs/Input/__stories__/IBAN.js.map +7 -0
- package/inputs/Input/__stories__/Integer/index.js +21 -17
- package/inputs/Input/__stories__/Integer.js.map +7 -0
- package/inputs/Input/__stories__/LandlineNumber/index.js +26 -24
- package/inputs/Input/__stories__/LandlineNumber.js.map +7 -0
- package/inputs/Input/__stories__/MobilePhone/index.js +26 -24
- package/inputs/Input/__stories__/MobilePhone.js.map +7 -0
- package/inputs/Input/__stories__/PhoneNumber/index.js +25 -23
- package/inputs/Input/__stories__/PhoneNumber.js.map +7 -0
- package/inputs/Input/__stories__/PostalCode/index.js +23 -23
- package/inputs/Input/__stories__/PostalCode.js.map +7 -0
- package/inputs/Input/__stories__/TextWithCharacterLimit/index.js +23 -27
- package/inputs/Input/__stories__/TextWithCharacterLimit.js.map +7 -0
- package/inputs/Input/index.js +43 -61
- package/inputs/Input/index.js.map +7 -0
- package/inputs/Label/Label.stories/index.js +9 -5
- package/inputs/Label/Label.stories.js.map +7 -0
- package/inputs/Label/__stories__/Default/index.js +25 -25
- package/inputs/Label/__stories__/Default.js.map +7 -0
- package/inputs/Label/index.js +15 -14
- package/inputs/Label/index.js.map +7 -0
- package/inputs/OtpInput/OtpInput.stories/index.js +9 -5
- package/inputs/OtpInput/OtpInput.stories.js.map +7 -0
- package/inputs/OtpInput/__stories__/Default/index.js +28 -26
- package/inputs/OtpInput/__stories__/Default.js.map +7 -0
- package/inputs/OtpInput/index.js +76 -87
- package/inputs/OtpInput/index.js.map +7 -0
- package/inputs/Radio/Radio.stories/index.js +11 -7
- package/inputs/Radio/Radio.stories.js.map +7 -0
- package/inputs/Radio/__stories__/Conditional/index.js +87 -79
- package/inputs/Radio/__stories__/Conditional.d.ts +1 -0
- package/inputs/Radio/__stories__/Conditional.js.map +7 -0
- package/inputs/Radio/__stories__/Default/index.js +40 -43
- package/inputs/Radio/__stories__/Default.js.map +7 -0
- package/inputs/Radio/__stories__/WithDivider/index.js +41 -44
- package/inputs/Radio/__stories__/WithDivider.js.map +7 -0
- package/inputs/Radio/index.js +51 -54
- package/inputs/Radio/index.js.map +7 -0
- package/inputs/Select/Select.stories/index.js +9 -5
- package/inputs/Select/Select.stories.js.map +7 -0
- package/inputs/Select/__stories__/Default/index.js +45 -49
- package/inputs/Select/__stories__/Default.js.map +7 -0
- package/inputs/Select/index.js +20 -30
- package/inputs/Select/index.js.map +7 -0
- package/inputs/index.js +21 -9
- package/inputs/index.js.map +7 -0
- package/internal/index.js +51 -34
- package/internal.js.map +7 -0
- package/lazy/index.js +63 -395
- package/lazy.d.ts +1 -1
- package/lazy.js.map +7 -0
- package/package.json +6 -7
- package/registry/index.js +132 -129
- package/registry.js.map +7 -0
- package/src/Field/FieldBase.tsx +1 -0
- package/src/Field/utils.ts +4 -4
- package/src/inputs/AutoCompleteInput/AutoComplete.stories.js +1 -0
- package/src/inputs/AutoCompleteInput/__stories__/Default.tsx +1 -0
- package/src/inputs/AutoCompleteInput/__stories__/Multiple.tsx +46 -0
- package/src/inputs/AutoCompleteInput/index.mdx +23 -0
- package/src/inputs/AutoCompleteInput/index.tsx +3 -2
- package/src/inputs/Checkboxes/__stories__/Conditional.tsx +2 -3
- package/src/inputs/Checkboxes/index.mdx +33 -0
- package/src/inputs/Checkboxes/index.tsx +2 -2
- package/src/inputs/DateInput/index.mdx +23 -0
- package/src/inputs/DateInput/index.tsx +1 -1
- package/src/inputs/FileInput/index.mdx +19 -0
- package/src/inputs/ImageInput/index.mdx +19 -0
- package/src/inputs/Input/index.mdx +90 -3
- package/src/inputs/OtpInput/index.mdx +23 -0
- package/src/inputs/OtpInput/index.tsx +1 -1
- package/src/inputs/Radio/__stories__/Conditional.tsx +2 -0
- package/src/inputs/Radio/index.mdx +33 -0
- package/src/inputs/Select/index.mdx +17 -0
- package/types/index.js +1 -1
- package/types.js.map +7 -0
- package/utils/index.js +35 -73
- package/utils.js.map +7 -0
- package/validators/index.js +106 -113
- package/validators/index.js.map +7 -0
- package/validators/types/index.js +1 -1
- package/validators/types.js.map +7 -0
- package/validators/utils/afm/index.js +16 -16
- package/validators/utils/afm.js.map +7 -0
- package/validators/utils/file/index.js +21 -41
- package/validators/utils/file.js.map +7 -0
- package/validators/utils/iban/index.js +14 -12
- package/validators/utils/iban.js.map +7 -0
- package/validators/utils/image/index.js +66 -106
- package/validators/utils/image.js.map +7 -0
- package/validators/utils/index.js +45 -47
- package/validators/utils/index.js.map +7 -0
- package/validators/utils/int/index.js +12 -7
- package/validators/utils/int.js.map +7 -0
- package/validators/utils/number/index.js +11 -6
- package/validators/utils/number.js.map +7 -0
- package/validators/utils/otp/index.js +13 -8
- package/validators/utils/otp.js.map +7 -0
- package/validators/utils/phone/index.js +82 -51
- package/validators/utils/phone.js.map +7 -0
- package/validators/utils/postal_code/index.js +14 -11
- package/validators/utils/postal_code.js.map +7 -0
- package/validators/utils/text_limit/index.js +18 -20
- package/validators/utils/text_limit.js.map +7 -0
- package/validators/utils/uuid4/index.js +12 -8
- package/validators/utils/uuid4.js.map +7 -0
- package/validators/validators.spec/index.js +64 -58
- package/validators/validators.spec.js.map +7 -0
- package/Field/index.mdx +0 -6
- package/FieldArray/FieldArray.stories.playwright.json +0 -353
- package/FormBuilder/FormBuilder.mdx +0 -256
- package/FormBuilder/FormBuilder.stories.playwright.json +0 -52
- package/MultiplicityField/MultiplicityField.mdx +0 -590
- package/MultiplicityField/MultiplicityField.stories.playwright.json +0 -1370
- package/Questions/__snapshots__/index.spec.tsx.snap +0 -596
- package/Questions/index.mdx +0 -415
- package/cjs/Field/index.mdx +0 -6
- package/cjs/FieldArray/FieldArray.stories.playwright.json +0 -353
- package/cjs/FormBuilder/FormBuilder.mdx +0 -256
- package/cjs/FormBuilder/FormBuilder.stories.playwright.json +0 -52
- package/cjs/MultiplicityField/MultiplicityField.mdx +0 -590
- package/cjs/MultiplicityField/MultiplicityField.stories.playwright.json +0 -1370
- package/cjs/Questions/__snapshots__/index.spec.tsx.snap +0 -596
- package/cjs/Questions/index.mdx +0 -415
- package/cjs/create-simple-form.mdx +0 -539
- package/cjs/index.mdx +0 -51
- package/cjs/inputs/Checkboxes/Checkboxes.stories.playwright.json +0 -85
- package/cjs/inputs/Checkboxes/index.mdx +0 -0
- package/cjs/inputs/DateInput/DateInput.stories.playwright.json +0 -72
- package/cjs/inputs/FileInput/FileInput.stories.playwright.json +0 -75
- package/cjs/inputs/ImageInput/ImageInput.stories.playwright.json +0 -77
- package/cjs/inputs/Input/Input.stories.playwright.json +0 -376
- package/cjs/inputs/Input/index.mdx +0 -8
- package/cjs/inputs/Label/Label.stories.playwright.json +0 -40
- package/cjs/inputs/Label/index.mdx +0 -0
- package/cjs/inputs/Radio/Radio.stories.playwright.json +0 -73
- package/cjs/inputs/Radio/index.mdx +0 -0
- package/cjs/inputs/Select/Select.stories.playwright.json +0 -22
- package/cjs/installation.mdx +0 -68
- package/create-simple-form.mdx +0 -539
- package/index.mdx +0 -51
- package/inputs/Checkboxes/Checkboxes.stories.playwright.json +0 -85
- package/inputs/Checkboxes/index.mdx +0 -0
- package/inputs/DateInput/DateInput.stories.playwright.json +0 -72
- package/inputs/FileInput/FileInput.stories.playwright.json +0 -75
- package/inputs/ImageInput/ImageInput.stories.playwright.json +0 -77
- package/inputs/Input/Input.stories.playwright.json +0 -376
- package/inputs/Input/index.mdx +0 -8
- package/inputs/Label/Label.stories.playwright.json +0 -40
- package/inputs/Label/index.mdx +0 -0
- package/inputs/Radio/Radio.stories.playwright.json +0 -73
- package/inputs/Radio/index.mdx +0 -0
- package/inputs/Select/Select.stories.playwright.json +0 -22
- package/installation.mdx +0 -68
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 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';\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,mBAAkB;AAClB,6BAAyB;AACzB,uBAA0B;AAK1B,mBAA4C;AAE5C,MAAM,iBAAiB,qBAAM,KAC3B,oBAAoB;AAAA,EAClB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,GACsB;AACtB,QAAM,WAAW,8CACf,OACA;AAEF,SACE,mDAAC,4BAAD;AAAA,OACM;AAAA,IACJ,MAAM,SAAS;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAAA,GAIN,CAAC,MAAM,SAAS;AACd,MAAI,CAAC,QAAQ,CAAC,KAAK,cAAc;AAC/B,WAAO;AAAA;AAET,MAAI,KAAK,UAAU,KAAK,OAAO;AAC7B,WAAO;AAAA;AAET,aAAW,OAAO,KAAK,cAAc;AACnC,QAAI,KAAK,aAAa,SAAS,KAAK,aAAa,MAAM;AACrD,aAAO;AAAA;AAAA;AAGX,SAAO;AAAA;AAIJ,MAAM,mBAAoD,CAAC;AAAA,EAChE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,MACI;AACJ,QAAM,iBAAiB,OAAO,KAAK,MAAM;AACzC,QAAM,mBAAmB,qCAAS;AAAA,IAChC,MAAM;AAAA,IACN;AAAA;AAEF,QAAM,YAAY,eAAe,OAC/B,CAAC,MAAM,UAAU,UAAW;AAAA,OACvB;AAAA,KACF,WAAW,iBAAiB;AAAA,MAE/B;AAEF,SACE,mDAAC,gBAAD;AAAA,IACE,cAAc;AAAA,IACd;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAAA;AAKN,IAAO,2BAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/cjs/Field/index.js
CHANGED
|
@@ -1,80 +1,102 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
Object.
|
|
6
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", {value: true});
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, {get: all[name], enumerable: true});
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && key !== "default")
|
|
16
|
+
__defProp(target, key, {get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable});
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toModule = (module2) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? {get: () => module2.default, enumerable: true} : {value: module2, enumerable: true})), module2);
|
|
22
|
+
};
|
|
23
|
+
__markAsModule(exports);
|
|
24
|
+
__export(exports, {
|
|
25
|
+
Field: () => Field,
|
|
26
|
+
default: () => Field_default
|
|
7
27
|
});
|
|
8
|
-
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
var
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
unregister = _useField.unregister,
|
|
35
|
-
trigger = _useField.trigger,
|
|
36
|
-
clearErrors = _useField.clearErrors;
|
|
37
|
-
var calculatedField = (0, _react.useMemo)(function () {
|
|
38
|
-
return (0, _utils.calculateField)(children, field, componentRegistry);
|
|
39
|
-
}, [field]);
|
|
28
|
+
var import_react = __toModule(require("react"));
|
|
29
|
+
var import_FieldBase = __toModule(require("@digigov/form/Field/FieldBase"));
|
|
30
|
+
var import_FieldConditional = __toModule(require("@digigov/form/Field/FieldConditional"));
|
|
31
|
+
var import_utils = __toModule(require("@digigov/form/Field/utils"));
|
|
32
|
+
var import_FieldArray = __toModule(require("@digigov/form/FieldArray"));
|
|
33
|
+
var import_MultiplicityField = __toModule(require("@digigov/form/MultiplicityField"));
|
|
34
|
+
const Field = ({
|
|
35
|
+
name,
|
|
36
|
+
children,
|
|
37
|
+
...customField
|
|
38
|
+
}) => {
|
|
39
|
+
const {
|
|
40
|
+
field,
|
|
41
|
+
control,
|
|
42
|
+
register,
|
|
43
|
+
reset,
|
|
44
|
+
error,
|
|
45
|
+
componentRegistry,
|
|
46
|
+
formState,
|
|
47
|
+
setValue,
|
|
48
|
+
getValues,
|
|
49
|
+
unregister,
|
|
50
|
+
trigger,
|
|
51
|
+
clearErrors
|
|
52
|
+
} = (0, import_utils.useField)(name, customField?.type ? customField : null);
|
|
53
|
+
const calculatedField = (0, import_react.useMemo)(() => (0, import_utils.calculateField)(children, field, componentRegistry), [field]);
|
|
40
54
|
if (calculatedField.condition) {
|
|
41
|
-
return
|
|
42
|
-
control
|
|
43
|
-
reset
|
|
44
|
-
register
|
|
55
|
+
return /* @__PURE__ */ import_react.default.createElement(import_FieldConditional.default, {
|
|
56
|
+
control,
|
|
57
|
+
reset,
|
|
58
|
+
register,
|
|
45
59
|
field: calculatedField,
|
|
46
|
-
error
|
|
60
|
+
error
|
|
47
61
|
});
|
|
48
62
|
}
|
|
49
|
-
if (calculatedField.type ===
|
|
63
|
+
if (calculatedField.type === "array" && !calculatedField.multiplicity) {
|
|
50
64
|
calculatedField.name = name;
|
|
51
|
-
return
|
|
52
|
-
control
|
|
53
|
-
register
|
|
54
|
-
error
|
|
55
|
-
formState
|
|
56
|
-
|
|
65
|
+
return /* @__PURE__ */ import_react.default.createElement(import_FieldArray.default, {
|
|
66
|
+
control,
|
|
67
|
+
register,
|
|
68
|
+
error,
|
|
69
|
+
formState,
|
|
70
|
+
...calculatedField
|
|
71
|
+
});
|
|
57
72
|
}
|
|
58
|
-
if (calculatedField.type ===
|
|
73
|
+
if (calculatedField.type === "array" && calculatedField.multiplicity === true) {
|
|
59
74
|
calculatedField.name = name;
|
|
60
|
-
return
|
|
61
|
-
control
|
|
62
|
-
register
|
|
63
|
-
trigger
|
|
64
|
-
clearErrors
|
|
65
|
-
error
|
|
66
|
-
formState
|
|
67
|
-
setValue
|
|
68
|
-
getValues
|
|
69
|
-
unregister
|
|
70
|
-
|
|
75
|
+
return /* @__PURE__ */ import_react.default.createElement(import_MultiplicityField.default, {
|
|
76
|
+
control,
|
|
77
|
+
register,
|
|
78
|
+
trigger,
|
|
79
|
+
clearErrors,
|
|
80
|
+
error,
|
|
81
|
+
formState,
|
|
82
|
+
setValue,
|
|
83
|
+
getValues,
|
|
84
|
+
unregister,
|
|
85
|
+
...calculatedField
|
|
86
|
+
});
|
|
71
87
|
}
|
|
72
|
-
return
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
88
|
+
return /* @__PURE__ */ import_react.default.createElement(import_FieldBase.FieldBase, {
|
|
89
|
+
...calculatedField,
|
|
90
|
+
name,
|
|
91
|
+
control,
|
|
92
|
+
register,
|
|
93
|
+
reset,
|
|
94
|
+
error
|
|
95
|
+
});
|
|
79
96
|
};
|
|
80
|
-
var
|
|
97
|
+
var Field_default = Field;
|
|
98
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
99
|
+
0 && (module.exports = {
|
|
100
|
+
Field
|
|
101
|
+
});
|
|
102
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
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 { useField, calculateField } from '@digigov/form/Field/utils';\nimport FieldArray from '@digigov/form/FieldArray';\nimport Multiplicity from '@digigov/form/MultiplicityField';\n\nexport const Field: React.FC<FieldProps> = ({\n name,\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 () => calculateField(children, field, componentRegistry),\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 control={control}\n register={register}\n reset={reset}\n error={error}\n />\n );\n};\n\nexport default Field;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA+B;AAC/B,uBAA0B;AAC1B,8BAA6B;AAM7B,mBAAyC;AACzC,wBAAuB;AACvB,+BAAyB;AAElB,MAAM,QAA8B,CAAC;AAAA,EAC1C;AAAA,EACA;AAAA,KACG;AAAA,MACC;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,MACE,2BAAS,MAAM,aAAa,OAAO,cAAc;AACrD,QAAM,kBAAmC,0BACvC,MAAM,iCAAe,UAAU,OAAO,oBACtC,CAAC;AAGH,MAAI,gBAAgB,WAAW;AAC7B,WACE,mDAAC,iCAAD;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA,OAAO;AAAA,MACP;AAAA;AAAA;AAIN,MAAI,gBAAgB,SAAS,WAAW,CAAC,gBAAgB,cAAc;AACrE,oBAAgB,OAAO;AACvB,WACE,mDAAC,2BAAD;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,SACI;AAAA;AAAA;AAIV,MACE,gBAAgB,SAAS,WACzB,gBAAgB,iBAAiB,MACjC;AACA,oBAAgB,OAAO;AACvB,WACE,mDAAC,kCAAD;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,SACI;AAAA;AAAA;AAIV,SACE,mDAAC,4BAAD;AAAA,OACM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAAA;AAKN,IAAO,gBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/cjs/Field/types/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", {value: true});
|
|
3
|
+
__markAsModule(exports);
|
|
4
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/Field/types.tsx"],
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport { ErrorOption, UseFormReturn } from 'react-hook-form';\nimport { FieldSpec } from '@digigov/form/types';\nimport { FieldCondition, FormData } from '@digigov/form/types';\n\nexport interface ChildFieldMemoProps extends FieldConditionalProps {\n dependencies: FormData;\n}\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}\n\nexport type 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 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}\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}\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}\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
|
+
"mappings": ";;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/cjs/Field/utils/index.js
CHANGED
|
@@ -1,167 +1,181 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
Object.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", {value: true});
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, {get: all[name], enumerable: true});
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && key !== "default")
|
|
16
|
+
__defProp(target, key, {get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable});
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toModule = (module2) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? {get: () => module2.default, enumerable: true} : {value: module2, enumerable: true})), module2);
|
|
22
|
+
};
|
|
23
|
+
__markAsModule(exports);
|
|
24
|
+
__export(exports, {
|
|
25
|
+
calculateField: () => calculateField,
|
|
26
|
+
evaluateFieldWithConditions: () => evaluateFieldWithConditions,
|
|
27
|
+
useField: () => useField
|
|
28
28
|
});
|
|
29
|
-
var
|
|
29
|
+
var import_react = __toModule(require("react"));
|
|
30
|
+
var import_FormContext = __toModule(require("@digigov/form/FormContext"));
|
|
31
|
+
var import_Checkboxes = __toModule(require("@digigov/form/inputs/Checkboxes"));
|
|
32
|
+
var import_DateInput = __toModule(require("@digigov/form/inputs/DateInput"));
|
|
33
|
+
var import_FileInput = __toModule(require("@digigov/form/inputs/FileInput"));
|
|
34
|
+
var import_ImageInput = __toModule(require("@digigov/form/inputs/ImageInput"));
|
|
35
|
+
var import_Input = __toModule(require("@digigov/form/inputs/Input"));
|
|
36
|
+
var import_OtpInput = __toModule(require("@digigov/form/inputs/OtpInput"));
|
|
37
|
+
var import_Radio = __toModule(require("@digigov/form/inputs/Radio"));
|
|
38
|
+
var import_Select = __toModule(require("@digigov/form/inputs/Select"));
|
|
39
|
+
var import_AutoCompleteInput = __toModule(require("@digigov/form/inputs/AutoCompleteInput"));
|
|
40
|
+
const FIELD_COMPONENTS = {
|
|
30
41
|
text: {
|
|
31
|
-
component:
|
|
42
|
+
component: import_Input.default
|
|
32
43
|
},
|
|
33
44
|
string: {
|
|
34
|
-
component:
|
|
45
|
+
component: import_Input.default
|
|
35
46
|
},
|
|
36
47
|
file: {
|
|
37
|
-
wrapper:
|
|
38
|
-
component:
|
|
48
|
+
wrapper: "fieldset",
|
|
49
|
+
component: import_FileInput.default
|
|
39
50
|
},
|
|
40
51
|
image: {
|
|
41
|
-
wrapper:
|
|
42
|
-
component:
|
|
52
|
+
wrapper: "fieldset",
|
|
53
|
+
component: import_ImageInput.default
|
|
43
54
|
},
|
|
44
55
|
date: {
|
|
45
|
-
wrapper:
|
|
56
|
+
wrapper: "fieldset",
|
|
46
57
|
controlled: true,
|
|
47
|
-
component:
|
|
58
|
+
component: import_DateInput.default
|
|
48
59
|
},
|
|
49
60
|
otp: {
|
|
50
|
-
wrapper:
|
|
61
|
+
wrapper: "fieldset",
|
|
51
62
|
controlled: true,
|
|
52
|
-
component:
|
|
63
|
+
component: import_OtpInput.default
|
|
53
64
|
},
|
|
54
|
-
|
|
55
|
-
wrapper:
|
|
65
|
+
"choice:multiple": {
|
|
66
|
+
wrapper: "fieldset",
|
|
56
67
|
controlled: true,
|
|
57
|
-
component:
|
|
68
|
+
component: import_Checkboxes.default
|
|
58
69
|
},
|
|
59
|
-
|
|
60
|
-
wrapper:
|
|
70
|
+
"choice:single": {
|
|
71
|
+
wrapper: "fieldset",
|
|
61
72
|
controlled: false,
|
|
62
|
-
component:
|
|
73
|
+
component: import_Radio.default
|
|
63
74
|
}
|
|
64
75
|
};
|
|
65
|
-
|
|
76
|
+
const ALTERNATIVE_COMPONENTS = {
|
|
66
77
|
Select: {
|
|
67
|
-
component:
|
|
78
|
+
component: import_Select.default,
|
|
68
79
|
controlled: false
|
|
69
80
|
},
|
|
70
81
|
AutoComplete: {
|
|
71
|
-
component:
|
|
72
|
-
controlled: true
|
|
82
|
+
component: import_AutoCompleteInput.default,
|
|
83
|
+
controlled: true,
|
|
84
|
+
wrapper: "fieldset"
|
|
73
85
|
}
|
|
74
86
|
};
|
|
75
87
|
function calculateField(children, field, componentRegistry) {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
var fieldComponentRegistry = (0, _extends2["default"])({}, FIELD_COMPONENTS, componentRegistry);
|
|
88
|
+
const calculatedField = {...field};
|
|
89
|
+
const fieldComponentRegistry = {...FIELD_COMPONENTS, ...componentRegistry};
|
|
79
90
|
if (children) {
|
|
80
91
|
calculatedField.component = children;
|
|
81
92
|
calculatedField.controlled = true;
|
|
82
|
-
} else if (typeof field.component ===
|
|
83
|
-
// leave as is
|
|
93
|
+
} else if (typeof field.component === "function") {
|
|
84
94
|
} else if (!field.component && !field.type) {
|
|
85
|
-
var _fieldComponentRegist;
|
|
86
95
|
calculatedField.component = fieldComponentRegistry.string.component;
|
|
87
|
-
calculatedField.controlled =
|
|
88
|
-
} else if (typeof
|
|
89
|
-
|
|
90
|
-
calculatedField.controlled = ((_ALTERNATIVE_COMPONEN = ALTERNATIVE_COMPONENTS[field.extra.component]) === null || _ALTERNATIVE_COMPONEN === void 0 ? void 0 : _ALTERNATIVE_COMPONEN.controlled) || false;
|
|
96
|
+
calculatedField.controlled = fieldComponentRegistry.string?.controlled || false;
|
|
97
|
+
} else if (typeof field?.extra?.component === "string" && ALTERNATIVE_COMPONENTS[field.extra.component]) {
|
|
98
|
+
calculatedField.controlled = ALTERNATIVE_COMPONENTS[field.extra.component]?.controlled || false;
|
|
91
99
|
calculatedField.component = ALTERNATIVE_COMPONENTS[field.extra.component].component;
|
|
100
|
+
calculatedField.wrapper = ALTERNATIVE_COMPONENTS[field.extra.component].wrapper;
|
|
92
101
|
} else if (!field.component && field.type && fieldComponentRegistry[field.type]) {
|
|
93
|
-
var _fieldComponentRegist2;
|
|
94
102
|
calculatedField.component = fieldComponentRegistry[field.type].component;
|
|
95
103
|
calculatedField.wrapper = fieldComponentRegistry[field.type].wrapper;
|
|
96
|
-
calculatedField.controlled =
|
|
104
|
+
calculatedField.controlled = fieldComponentRegistry[field.type]?.controlled || false;
|
|
97
105
|
} else {
|
|
98
|
-
var _fieldComponentRegist3;
|
|
99
106
|
calculatedField.component = fieldComponentRegistry.string.component;
|
|
100
|
-
calculatedField.controlled =
|
|
107
|
+
calculatedField.controlled = fieldComponentRegistry.string?.controlled || false;
|
|
101
108
|
}
|
|
102
109
|
return calculatedField;
|
|
103
110
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
fieldsMap
|
|
107
|
-
control
|
|
108
|
-
register
|
|
109
|
-
reset
|
|
110
|
-
trigger
|
|
111
|
-
clearErrors
|
|
112
|
-
errors
|
|
113
|
-
registerField
|
|
114
|
-
watch
|
|
115
|
-
componentRegistry
|
|
116
|
-
getFieldState
|
|
117
|
-
setValue
|
|
118
|
-
getValues
|
|
119
|
-
unregister
|
|
120
|
-
formState
|
|
111
|
+
const useField = (name, customField) => {
|
|
112
|
+
const {
|
|
113
|
+
fieldsMap,
|
|
114
|
+
control,
|
|
115
|
+
register,
|
|
116
|
+
reset,
|
|
117
|
+
trigger,
|
|
118
|
+
clearErrors,
|
|
119
|
+
errors,
|
|
120
|
+
registerField,
|
|
121
|
+
watch,
|
|
122
|
+
componentRegistry,
|
|
123
|
+
getFieldState,
|
|
124
|
+
setValue,
|
|
125
|
+
getValues,
|
|
126
|
+
unregister,
|
|
127
|
+
formState
|
|
128
|
+
} = (0, import_react.useContext)(import_FormContext.FormContext);
|
|
121
129
|
if (!registerField) {
|
|
122
|
-
throw new Error(
|
|
130
|
+
throw new Error(`
|
|
131
|
+
You can't use the Field component without wrapping it in FormBuilder.
|
|
132
|
+
https://devs.pages.grnet.gr/digigov/digigov-sdk/sdk-docs/forms/create-simple-form/
|
|
133
|
+
`);
|
|
123
134
|
}
|
|
124
|
-
(0,
|
|
125
|
-
return (customField === null || customField === void 0 ? void 0 : customField.type) && registerField((0, _extends2["default"])({}, customField, {
|
|
126
|
-
key: name
|
|
127
|
-
}));
|
|
128
|
-
}, [customField, name, registerField]);
|
|
135
|
+
(0, import_react.useMemo)(() => customField?.type && registerField({...customField, key: name}), [customField, name, registerField]);
|
|
129
136
|
return {
|
|
130
137
|
field: customField || fieldsMap[name],
|
|
131
|
-
control
|
|
132
|
-
register
|
|
133
|
-
reset
|
|
134
|
-
trigger
|
|
135
|
-
watch
|
|
136
|
-
componentRegistry
|
|
137
|
-
getFieldState
|
|
138
|
-
setValue
|
|
139
|
-
clearErrors
|
|
140
|
-
getValues
|
|
141
|
-
unregister
|
|
142
|
-
formState
|
|
138
|
+
control,
|
|
139
|
+
register,
|
|
140
|
+
reset,
|
|
141
|
+
trigger,
|
|
142
|
+
watch,
|
|
143
|
+
componentRegistry,
|
|
144
|
+
getFieldState,
|
|
145
|
+
setValue,
|
|
146
|
+
clearErrors,
|
|
147
|
+
getValues,
|
|
148
|
+
unregister,
|
|
149
|
+
formState,
|
|
143
150
|
error: errors[name]
|
|
144
151
|
};
|
|
145
152
|
};
|
|
146
153
|
function evaluateFieldWithConditions(field, variables) {
|
|
147
|
-
|
|
154
|
+
const newField = {...field};
|
|
148
155
|
if (variables) {
|
|
149
|
-
for (
|
|
156
|
+
for (const key in variables) {
|
|
150
157
|
if (field.condition[key] && field.condition[key].is) {
|
|
151
|
-
|
|
158
|
+
const is = field.condition[key].is;
|
|
152
159
|
if (is === variables[key] || Array.isArray(variables[key]) && variables[key].includes(is)) {
|
|
153
|
-
|
|
154
|
-
for (
|
|
160
|
+
const then = field.condition[key].then || {};
|
|
161
|
+
for (const attr in then) {
|
|
155
162
|
newField[attr] = then[attr];
|
|
156
163
|
}
|
|
157
164
|
}
|
|
158
165
|
} else if (field.condition[key]) {
|
|
159
|
-
|
|
160
|
-
for (
|
|
161
|
-
newField[
|
|
166
|
+
const otherwise = field.condition[key].else || {};
|
|
167
|
+
for (const attr in otherwise) {
|
|
168
|
+
newField[attr] = otherwise[attr];
|
|
162
169
|
}
|
|
163
170
|
}
|
|
164
171
|
}
|
|
165
172
|
}
|
|
166
173
|
return newField;
|
|
167
|
-
}
|
|
174
|
+
}
|
|
175
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
176
|
+
0 && (module.exports = {
|
|
177
|
+
calculateField,
|
|
178
|
+
evaluateFieldWithConditions,
|
|
179
|
+
useField
|
|
180
|
+
});
|
|
181
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/Field/utils.ts"],
|
|
4
|
+
"sourcesContent": ["import { useContext, useMemo } from 'react';\nimport {\n CalculatedField,\n FieldComponentRegistry,\n FieldProps,\n FieldWithCondition,\n UseFieldProps,\n} from '@digigov/form/Field/types';\nimport { FormContext } from '@digigov/form/FormContext';\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 from '@digigov/form/inputs/Radio';\nimport Select from '@digigov/form/inputs/Select';\nimport AutoCompleteInput from '@digigov/form/inputs/AutoCompleteInput';\nimport { FieldSpec } from '@digigov/form/types';\n\n\nconst 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\nconst 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 function calculateField(\n children: FieldProps['children'],\n field: FieldSpec,\n componentRegistry?: FieldComponentRegistry\n): CalculatedField {\n const calculatedField = { ...field };\n const fieldComponentRegistry = { ...FIELD_COMPONENTS, ...componentRegistry };\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 ALTERNATIVE_COMPONENTS[field.extra.component]\n ) {\n calculatedField.controlled =\n ALTERNATIVE_COMPONENTS[field.extra.component]?.controlled || false;\n calculatedField.component =\n ALTERNATIVE_COMPONENTS[field.extra.component].component;\n calculatedField.wrapper = ALTERNATIVE_COMPONENTS[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\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\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": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAoC;AAQpC,yBAA4B;AAC5B,wBAAuB;AACvB,uBAAsB;AACtB,uBAAsB;AACtB,wBAAuB;AACvB,mBAAkB;AAClB,sBAAqB;AACrB,mBAAkB;AAClB,oBAAmB;AACnB,+BAA8B;AAI9B,MAAM,mBAA2C;AAAA,EAC/C,MAAM;AAAA,IACJ,WAAW;AAAA;AAAA,EAEb,QAAQ;AAAA,IACN,WAAW;AAAA;AAAA,EAEb,MAAM;AAAA,IACJ,SAAS;AAAA,IACT,WAAW;AAAA;AAAA,EAEb,OAAO;AAAA,IACL,SAAS;AAAA,IACT,WAAW;AAAA;AAAA,EAEb,MAAM;AAAA,IACJ,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,WAAW;AAAA;AAAA,EAEb,KAAK;AAAA,IACH,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,WAAW;AAAA;AAAA,EAEb,mBAAmB;AAAA,IACjB,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,WAAW;AAAA;AAAA,EAEb,iBAAiB;AAAA,IACf,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,WAAW;AAAA;AAAA;AAIf,MAAM,yBAAiD;AAAA,EACrD,QAAQ;AAAA,IACN,WAAW;AAAA,IACX,YAAY;AAAA;AAAA,EAEd,cAAc;AAAA,IACZ,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,SAAS;AAAA;AAAA;AAIN,wBACL,UACA,OACA,mBACiB;AACjB,QAAM,kBAAkB,IAAK;AAC7B,QAAM,yBAAyB,IAAK,qBAAqB;AACzD,MAAI,UAAU;AACZ,oBAAgB,YAAY;AAC5B,oBAAgB,aAAa;AAAA,aACpB,OAAO,MAAM,cAAc,YAAY;AAAA,aAEvC,CAAC,MAAM,aAAa,CAAC,MAAM,MAAM;AAC1C,oBAAgB,YAAY,uBAAuB,OAAO;AAC1D,oBAAgB,aACd,uBAAuB,QAAQ,cAAc;AAAA,aAE/C,OAAO,OAAO,OAAO,cAAc,YACnC,uBAAuB,MAAM,MAAM,YACnC;AACA,oBAAgB,aACd,uBAAuB,MAAM,MAAM,YAAY,cAAc;AAC/D,oBAAgB,YACd,uBAAuB,MAAM,MAAM,WAAW;AAC9C,oBAAgB,UAAU,uBAAuB,MAAM,MAAM,WAAW;AAAA,aAE1E,CAAC,MAAM,aACP,MAAM,QACN,uBAAuB,MAAM,OAC7B;AACA,oBAAgB,YAAY,uBAAuB,MAAM,MAAM;AAC/D,oBAAgB,UAAU,uBAAuB,MAAM,MAAM;AAC7D,oBAAgB,aACd,uBAAuB,MAAM,OAAO,cAAc;AAAA,SAC/C;AACL,oBAAgB,YAAY,uBAAuB,OAAO;AAC1D,oBAAgB,aACd,uBAAuB,QAAQ,cAAc;AAAA;AAEjD,SAAO;AAAA;AAGF,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,MACE,6BAAW;AAEf,MAAI,CAAC,eAAe;AAClB,UAAM,IAAI,MAAM;AAAA;AAAA;AAAA;AAAA;AAMlB,4BACE,MAAM,aAAa,QAAQ,cAAc,IAAK,aAAa,KAAK,QAChE,CAAC,aAAa,MAAM;AAEtB,SAAO;AAAA,IACL,OAAO,eAAe,UAAU;AAAA,IAChC;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;AAAA;AAAA;AAIX,qCACL,OACA,WACiB;AACjB,QAAM,WAAW,IAAK;AACtB,MAAI,WAAW;AACb,eAAW,OAAO,WAAW;AAC3B,UAAI,MAAM,UAAU,QAAQ,MAAM,UAAU,KAAK,IAAI;AACnD,cAAM,KAAK,MAAM,UAAU,KAAK;AAChC,YACE,OAAO,UAAU,QAChB,MAAM,QAAQ,UAAU,SAAS,UAAU,KAAK,SAAS,KAC1D;AACA,gBAAM,OAAO,MAAM,UAAU,KAAK,QAAQ;AAC1C,qBAAW,QAAQ,MAAM;AACvB,qBAAS,QAAQ,KAAK;AAAA;AAAA;AAAA,iBAGjB,MAAM,UAAU,MAAM;AAC/B,cAAM,YAAY,MAAM,UAAU,KAAK,QAAQ;AAC/C,mBAAW,QAAQ,WAAW;AAC5B,mBAAS,QAAQ,UAAU;AAAA;AAAA;AAAA;AAAA;AAKnC,SAAO;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,38 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
Object.
|
|
5
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", {value: true});
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, {get: all[name], enumerable: true});
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && key !== "default")
|
|
16
|
+
__defProp(target, key, {get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable});
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toModule = (module2) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? {get: () => module2.default, enumerable: true} : {value: module2, enumerable: true})), module2);
|
|
22
|
+
};
|
|
23
|
+
__markAsModule(exports);
|
|
24
|
+
__export(exports, {
|
|
25
|
+
default: () => FieldArray_stories_default
|
|
6
26
|
});
|
|
7
|
-
var
|
|
8
|
-
exports
|
|
9
|
-
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return _Default[key];
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
});
|
|
22
|
-
var _WithExactLength = require("@digigov/form/FieldArray/__stories__/WithExactLength");
|
|
23
|
-
Object.keys(_WithExactLength).forEach(function (key) {
|
|
24
|
-
if (key === "default" || key === "__esModule") return;
|
|
25
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
26
|
-
if (key in exports && exports[key] === _WithExactLength[key]) return;
|
|
27
|
-
Object.defineProperty(exports, key, {
|
|
28
|
-
enumerable: true,
|
|
29
|
-
get: function get() {
|
|
30
|
-
return _WithExactLength[key];
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
var _default = exports["default"] = {
|
|
35
|
-
title: 'Digigov Form/FieldArray',
|
|
36
|
-
component: _FieldArray["default"],
|
|
37
|
-
displayName: 'FieldArray'
|
|
38
|
-
};
|
|
27
|
+
var import_FieldArray = __toModule(require("@digigov/form/FieldArray"));
|
|
28
|
+
__reExport(exports, __toModule(require("@digigov/form/FieldArray/__stories__/Default")));
|
|
29
|
+
__reExport(exports, __toModule(require("@digigov/form/FieldArray/__stories__/WithExactLength")));
|
|
30
|
+
var FieldArray_stories_default = {
|
|
31
|
+
title: "Digigov Form/FieldArray",
|
|
32
|
+
component: import_FieldArray.default,
|
|
33
|
+
displayName: "FieldArray"
|
|
34
|
+
};
|
|
35
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
36
|
+
0 && (module.exports = {});
|
|
37
|
+
//# sourceMappingURL=FieldArray.stories.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/FieldArray/FieldArray.stories.js"],
|
|
4
|
+
"sourcesContent": ["import FieldArray from '@digigov/form/FieldArray';\nexport default {\n title: 'Digigov Form/FieldArray',\n component: FieldArray,\n displayName: 'FieldArray',\n};\nexport * from '@digigov/form/FieldArray/__stories__/Default';\nexport * from '@digigov/form/FieldArray/__stories__/WithExactLength';\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA,wBAAuB;AAMvB,oBAAc;AACd,oBAAc;AANd,IAAO,6BAAQ;AAAA,EACb,OAAO;AAAA,EACP,WAAW;AAAA,EACX,aAAa;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|