@digigov/form 2.0.0-7d9a8d86 → 2.0.0-85c27c19
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 +72 -51
- package/Field/FieldBase.js.map +2 -2
- package/Field/FieldBaseContainer/index.js +4 -18
- package/Field/FieldBaseContainer.js.map +1 -1
- package/Field/FieldConditional/index.js +55 -40
- package/Field/FieldConditional.js.map +2 -2
- package/Field/index.js +67 -36
- package/Field/index.js.map +2 -2
- package/Field/types.d.ts +36 -3
- package/Field/utils/calculateField/index.js +27 -0
- package/{inputs/Input/__stories__/Default → Field/utils/calculateField}/package.json +1 -1
- package/Field/utils/calculateField.d.ts +2 -0
- package/Field/utils/calculateField.js.map +7 -0
- package/Field/utils/evaluateFieldWithConditions/index.js +26 -0
- package/Field/utils/evaluateFieldWithConditions/package.json +6 -0
- package/Field/utils/evaluateFieldWithConditions.d.ts +2 -0
- package/Field/utils/evaluateFieldWithConditions.js.map +7 -0
- package/Field/utils/index.d.ts +3 -0
- package/Field/utils/index.js +4 -95
- package/Field/utils/index.js.map +7 -0
- package/Field/utils/useField/index.js +51 -0
- package/{FormBuilder/FormBuilder → Field/utils/useField}/package.json +1 -1
- package/Field/utils/useField.d.ts +2 -0
- package/Field/utils/useField.js.map +7 -0
- package/FieldArray/FieldArray.stories/index.js +4 -2
- package/FieldArray/FieldArray.stories.d.ts +2 -2
- package/FieldArray/FieldArray.stories.js.map +2 -2
- package/FieldArray/__stories__/Default/index.js +15 -17
- package/FieldArray/__stories__/Default.d.ts +2 -2
- package/FieldArray/__stories__/Default.js.map +1 -1
- package/FieldArray/__stories__/WithExactLength/index.js +15 -17
- package/FieldArray/__stories__/WithExactLength.d.ts +2 -2
- package/FieldArray/__stories__/WithExactLength.js.map +1 -1
- package/FieldArray/index.js +50 -32
- package/FieldArray/index.js.map +2 -2
- package/FieldArray/index.test.d.ts +1 -0
- package/FieldObject/index.d.ts +1 -0
- package/FieldObject/index.js +41 -29
- package/FieldObject/index.js.map +2 -2
- package/Fieldset/FieldsetWithContext/index.js +12 -13
- package/Fieldset/FieldsetWithContext.js.map +1 -1
- package/Fieldset/index.js +4 -13
- package/Fieldset/index.js.map +1 -1
- package/Fieldset/types.d.ts +2 -0
- package/Form.stories.js.map +1 -1
- package/FormBuilder/FormBuilder.stories/index.js +2 -1
- package/FormBuilder/FormBuilder.stories.d.ts +1 -1
- package/FormBuilder/FormBuilder.stories.js.map +2 -2
- package/FormBuilder/__stories__/Default/index.js +21 -15
- package/FormBuilder/__stories__/Default.d.ts +2 -2
- package/FormBuilder/__stories__/Default.js.map +1 -1
- package/FormBuilder/index.d.ts +2 -1
- package/FormBuilder/index.js +10 -2
- package/FormBuilder/index.js.map +2 -2
- package/FormBuilder/index.test.d.ts +1 -0
- package/FormBuilder/scenarios.test.d.ts +88 -0
- package/FormContext/index.js +1 -1
- package/FormContext.js.map +1 -1
- package/MultiplicityField/MultiplicityField.stories/index.js +12 -6
- package/MultiplicityField/MultiplicityField.stories.d.ts +6 -6
- package/MultiplicityField/MultiplicityField.stories.js.map +2 -2
- package/MultiplicityField/__stories__/Default/index.js +15 -19
- package/MultiplicityField/__stories__/Default.d.ts +2 -2
- package/MultiplicityField/__stories__/Default.js.map +1 -1
- package/MultiplicityField/__stories__/PreviewDisplay/index.js +6 -27
- package/MultiplicityField/__stories__/PreviewDisplay.d.ts +2 -2
- package/MultiplicityField/__stories__/PreviewDisplay.js.map +2 -2
- package/MultiplicityField/__stories__/WithExactLength/index.js +15 -19
- package/MultiplicityField/__stories__/WithExactLength.d.ts +2 -2
- package/MultiplicityField/__stories__/WithExactLength.js.map +2 -2
- package/MultiplicityField/__stories__/WithMaxLength/index.js +15 -19
- package/MultiplicityField/__stories__/WithMaxLength.d.ts +2 -2
- package/MultiplicityField/__stories__/WithMaxLength.js.map +2 -2
- package/MultiplicityField/__stories__/WithMinAndMaxLength/index.js +15 -19
- package/MultiplicityField/__stories__/WithMinAndMaxLength.d.ts +2 -2
- package/MultiplicityField/__stories__/WithMinAndMaxLength.js.map +2 -2
- package/MultiplicityField/__stories__/WithMinLength/index.js +15 -19
- package/MultiplicityField/__stories__/WithMinLength.d.ts +2 -2
- package/MultiplicityField/__stories__/WithMinLength.js.map +2 -2
- package/MultiplicityField/add-objects/index.js +71 -39
- package/MultiplicityField/add-objects.d.ts +2 -1
- package/MultiplicityField/add-objects.js.map +2 -2
- package/MultiplicityField/index.d.ts +2 -19
- package/MultiplicityField/index.js +66 -59
- package/MultiplicityField/index.js.map +2 -2
- package/MultiplicityField/index.test.d.ts +1 -0
- package/MultiplicityField/types/index.js +1 -0
- package/{validators/validators.spec → MultiplicityField/types}/package.json +1 -1
- package/MultiplicityField/types.d.ts +19 -0
- package/MultiplicityField/types.js.map +7 -0
- package/Questions/Questions/index.js +21 -15
- package/Questions/Questions.js.map +2 -2
- package/Questions/Questions.stories/index.js +2 -1
- package/Questions/Questions.stories.d.ts +1 -1
- package/Questions/Questions.stories.js.map +2 -2
- package/Questions/QuestionsContext/index.js +2 -2
- package/Questions/QuestionsContext.js.map +1 -1
- package/Questions/Step/ReviewStep/index.js +20 -26
- package/Questions/Step/ReviewStep.js.map +1 -1
- package/Questions/Step/Step/index.js +24 -18
- package/Questions/Step/Step.js.map +2 -2
- package/Questions/Step/StepArrayReview/index.js +20 -25
- package/Questions/Step/StepArrayReview.js.map +1 -1
- package/Questions/Step/StepContext/index.js +3 -3
- package/Questions/Step/StepContext.js.map +1 -1
- package/Questions/Step/StepDescription/index.js +7 -12
- package/Questions/Step/StepDescription.js.map +1 -1
- package/Questions/Step/StepForm/index.js +16 -19
- package/Questions/Step/StepForm.js.map +1 -1
- package/Questions/Step/StepQuote/index.js +2 -4
- package/Questions/Step/StepQuote.js.map +1 -1
- package/Questions/Step/StepTitle/index.js +17 -15
- package/Questions/Step/StepTitle.d.ts +1 -0
- package/Questions/Step/StepTitle.js.map +2 -2
- package/Questions/Step/getAddMoreFields.js.map +1 -1
- package/Questions/Step/index.d.ts +0 -1
- package/Questions/Step/index.js +0 -1
- package/Questions/Step/index.js.map +2 -2
- package/Questions/Step/types.d.ts +2 -0
- package/Questions/__stories__/Default/index.js +31 -38
- package/Questions/__stories__/Default.d.ts +2 -2
- package/Questions/__stories__/Default.js.map +1 -1
- package/Questions/getNextStep/index.js +3 -1
- package/Questions/getNextStep.js.map +1 -1
- package/Questions/index.js +1 -1
- package/Questions/index.js.map +1 -1
- package/Questions/index.test.d.ts +1 -0
- package/Questions/types.d.ts +2 -0
- package/cjs/Field/FieldBase/index.js +95 -68
- package/cjs/Field/FieldBase.js.map +3 -3
- package/cjs/Field/FieldBaseContainer/index.js +33 -41
- package/cjs/Field/FieldBaseContainer.js.map +2 -2
- package/cjs/Field/FieldConditional/index.js +77 -56
- package/cjs/Field/FieldConditional.js.map +3 -3
- package/cjs/Field/index.js +89 -55
- package/cjs/Field/index.js.map +3 -3
- package/cjs/Field/types/index.js +14 -2
- package/cjs/Field/types.js.map +2 -2
- package/cjs/Field/utils/calculateField/index.js +50 -0
- package/cjs/Field/utils/calculateField.js.map +7 -0
- package/cjs/Field/utils/evaluateFieldWithConditions/index.js +49 -0
- package/cjs/Field/utils/evaluateFieldWithConditions.js.map +7 -0
- package/cjs/Field/utils/index.js +35 -121
- package/cjs/Field/utils/index.js.map +7 -0
- package/cjs/Field/utils/useField/index.js +74 -0
- package/cjs/Field/utils/useField.js.map +7 -0
- package/cjs/FieldArray/FieldArray.stories/index.js +30 -19
- package/cjs/FieldArray/FieldArray.stories.js.map +3 -3
- package/cjs/FieldArray/__stories__/Default/index.js +37 -33
- package/cjs/FieldArray/__stories__/Default.js.map +2 -2
- package/cjs/FieldArray/__stories__/WithExactLength/index.js +37 -33
- package/cjs/FieldArray/__stories__/WithExactLength.js.map +2 -2
- package/cjs/FieldArray/index.js +75 -51
- package/cjs/FieldArray/index.js.map +3 -3
- package/cjs/FieldObject/index.js +59 -44
- package/cjs/FieldObject/index.js.map +3 -3
- package/cjs/Fieldset/FieldsetWithContext/index.js +35 -30
- package/cjs/Fieldset/FieldsetWithContext.js.map +2 -2
- package/cjs/Fieldset/index.js +31 -34
- package/cjs/Fieldset/index.js.map +2 -2
- package/cjs/Fieldset/types/index.js +14 -2
- package/cjs/Fieldset/types.js.map +2 -2
- package/cjs/Form.stories/index.js +16 -6
- package/cjs/Form.stories.js.map +1 -1
- package/cjs/FormBuilder/FormBuilder.stories/index.js +27 -18
- package/cjs/FormBuilder/FormBuilder.stories.js.map +3 -3
- package/cjs/FormBuilder/__stories__/Default/index.js +43 -31
- package/cjs/FormBuilder/__stories__/Default.js.map +2 -2
- package/cjs/FormBuilder/index.js +24 -21
- package/cjs/FormBuilder/index.js.map +2 -2
- package/cjs/FormContext/index.js +14 -18
- package/cjs/FormContext.js.map +2 -2
- package/cjs/MultiplicityField/MultiplicityField.stories/index.js +42 -23
- package/cjs/MultiplicityField/MultiplicityField.stories.js.map +3 -3
- package/cjs/MultiplicityField/__stories__/Default/index.js +37 -35
- package/cjs/MultiplicityField/__stories__/Default.js.map +2 -2
- package/cjs/MultiplicityField/__stories__/PreviewDisplay/index.js +32 -47
- package/cjs/MultiplicityField/__stories__/PreviewDisplay.js.map +3 -3
- package/cjs/MultiplicityField/__stories__/WithExactLength/index.js +37 -35
- package/cjs/MultiplicityField/__stories__/WithExactLength.js.map +3 -3
- package/cjs/MultiplicityField/__stories__/WithMaxLength/index.js +37 -35
- package/cjs/MultiplicityField/__stories__/WithMaxLength.js.map +3 -3
- package/cjs/MultiplicityField/__stories__/WithMinAndMaxLength/index.js +37 -35
- package/cjs/MultiplicityField/__stories__/WithMinAndMaxLength.js.map +3 -3
- package/cjs/MultiplicityField/__stories__/WithMinLength/index.js +37 -35
- package/cjs/MultiplicityField/__stories__/WithMinLength.js.map +3 -3
- package/cjs/MultiplicityField/add-objects/index.js +94 -59
- package/cjs/MultiplicityField/add-objects.js.map +3 -3
- package/cjs/MultiplicityField/index.js +90 -77
- package/cjs/MultiplicityField/index.js.map +3 -3
- package/cjs/MultiplicityField/types/index.js +16 -0
- package/cjs/MultiplicityField/types.js.map +7 -0
- package/cjs/Questions/Questions/index.js +42 -30
- package/cjs/Questions/Questions.js.map +2 -2
- package/cjs/Questions/Questions.stories/index.js +27 -18
- package/cjs/Questions/Questions.stories.js.map +3 -3
- package/cjs/Questions/QuestionsContext/index.js +15 -19
- package/cjs/Questions/QuestionsContext.js.map +1 -1
- package/cjs/Questions/Step/ReviewStep/index.js +43 -43
- package/cjs/Questions/Step/ReviewStep.js.map +2 -2
- package/cjs/Questions/Step/Step/index.js +45 -33
- package/cjs/Questions/Step/Step.js.map +2 -2
- package/cjs/Questions/Step/StepArrayReview/index.js +46 -45
- package/cjs/Questions/Step/StepArrayReview.js.map +2 -2
- package/cjs/Questions/Step/StepContext/index.js +16 -20
- package/cjs/Questions/Step/StepContext.js.map +1 -1
- package/cjs/Questions/Step/StepDescription/index.js +29 -28
- package/cjs/Questions/Step/StepDescription.js.map +2 -2
- package/cjs/Questions/Step/StepForm/index.js +41 -38
- package/cjs/Questions/Step/StepForm.js.map +2 -2
- package/cjs/Questions/Step/StepQuote/index.js +25 -21
- package/cjs/Questions/Step/StepQuote.js.map +2 -2
- package/cjs/Questions/Step/StepTitle/index.js +41 -33
- package/cjs/Questions/Step/StepTitle.js.map +3 -3
- package/cjs/Questions/Step/getAddMoreFields/index.js +16 -4
- package/cjs/Questions/Step/getAddMoreFields.js.map +1 -1
- package/cjs/Questions/Step/index.js +45 -28
- package/cjs/Questions/Step/index.js.map +3 -3
- package/cjs/Questions/Step/types/index.js +14 -2
- package/cjs/Questions/Step/types.js.map +2 -2
- package/cjs/Questions/__stories__/Default/index.js +59 -60
- package/cjs/Questions/__stories__/Default.js.map +2 -2
- package/cjs/Questions/getNextStep/index.js +19 -5
- package/cjs/Questions/getNextStep.js.map +1 -1
- package/cjs/Questions/index.js +19 -20
- package/cjs/Questions/index.js.map +1 -1
- package/cjs/Questions/types/index.js +14 -2
- package/cjs/Questions/types.js.map +2 -2
- package/cjs/index.js +180 -19
- package/cjs/index.js.map +4 -4
- package/cjs/inputs/AutoCompleteInput/AutoComplete.stories/index.js +30 -19
- package/cjs/inputs/AutoCompleteInput/AutoComplete.stories.js.map +3 -3
- package/cjs/inputs/AutoCompleteInput/__stories__/Default/index.js +46 -36
- package/cjs/inputs/AutoCompleteInput/__stories__/Default.js.map +3 -3
- package/cjs/inputs/AutoCompleteInput/__stories__/Multiple/index.js +50 -38
- package/cjs/inputs/AutoCompleteInput/__stories__/Multiple.js.map +3 -3
- package/cjs/inputs/AutoCompleteInput/index.js +67 -42
- package/cjs/inputs/AutoCompleteInput/index.js.map +3 -3
- package/cjs/inputs/Checkboxes/Checkboxes.stories/index.js +33 -20
- package/cjs/inputs/Checkboxes/Checkboxes.stories.js.map +3 -3
- package/cjs/inputs/Checkboxes/__stories__/Conditional/index.js +35 -29
- package/cjs/inputs/Checkboxes/__stories__/Conditional.js.map +2 -2
- package/cjs/inputs/Checkboxes/__stories__/Default/index.js +58 -46
- package/cjs/inputs/Checkboxes/__stories__/Default.js.map +2 -2
- package/cjs/inputs/Checkboxes/__stories__/WithDivider/index.js +59 -47
- package/cjs/inputs/Checkboxes/__stories__/WithDivider.js.map +2 -2
- package/cjs/inputs/Checkboxes/index.js +70 -62
- package/cjs/inputs/Checkboxes/index.js.map +3 -3
- package/cjs/inputs/DateInput/DateInput.stories/index.js +27 -18
- package/cjs/inputs/DateInput/DateInput.stories.js.map +3 -3
- package/cjs/inputs/DateInput/__stories__/Default/index.js +41 -32
- package/cjs/inputs/DateInput/__stories__/Default.js.map +3 -3
- package/cjs/inputs/DateInput/index.js +73 -60
- package/cjs/inputs/DateInput/index.js.map +3 -3
- package/cjs/inputs/FileInput/FileInput.stories/index.js +27 -18
- package/cjs/inputs/FileInput/FileInput.stories.js.map +3 -3
- package/cjs/inputs/FileInput/__stories__/Default/index.js +43 -29
- package/cjs/inputs/FileInput/__stories__/Default.js.map +2 -2
- package/cjs/inputs/FileInput/index.js +56 -42
- package/cjs/inputs/FileInput/index.js.map +2 -2
- package/cjs/inputs/ImageInput/ImageInput.stories/index.js +33 -20
- package/cjs/inputs/ImageInput/ImageInput.stories.js.map +3 -3
- package/cjs/inputs/ImageInput/__stories__/Default/index.js +35 -29
- package/cjs/inputs/ImageInput/__stories__/Default.js.map +2 -2
- package/cjs/inputs/ImageInput/__stories__/WithInvalidImageDimension/index.js +35 -29
- package/cjs/inputs/ImageInput/__stories__/WithInvalidImageDimension.js.map +2 -2
- package/cjs/inputs/ImageInput/__stories__/WithInvalidImageSize/index.js +35 -29
- package/cjs/inputs/ImageInput/__stories__/WithInvalidImageSize.js.map +2 -2
- package/cjs/inputs/ImageInput/index.js +72 -66
- package/cjs/inputs/ImageInput/index.js.map +2 -2
- package/cjs/inputs/Input/Input.stories/index.js +54 -27
- package/cjs/inputs/Input/Input.stories.js.map +3 -3
- package/cjs/inputs/Input/__stories__/AFM/index.js +44 -32
- package/cjs/inputs/Input/__stories__/AFM.js.map +2 -2
- package/cjs/inputs/Input/__stories__/Boolean/index.js +45 -33
- package/cjs/inputs/Input/__stories__/Boolean.js.map +2 -2
- package/cjs/inputs/Input/__stories__/IBAN/index.js +45 -33
- package/cjs/inputs/Input/__stories__/IBAN.js.map +2 -2
- package/cjs/inputs/Input/__stories__/Integer/index.js +57 -41
- package/cjs/inputs/Input/__stories__/Integer.js.map +2 -2
- package/cjs/inputs/Input/__stories__/LandlineNumber/index.js +48 -36
- package/cjs/inputs/Input/__stories__/LandlineNumber.js.map +2 -2
- package/cjs/inputs/Input/__stories__/MobilePhone/index.js +48 -36
- package/cjs/inputs/Input/__stories__/MobilePhone.js.map +2 -2
- package/cjs/inputs/Input/__stories__/PhoneNumber/index.js +47 -35
- package/cjs/inputs/Input/__stories__/PhoneNumber.js.map +2 -2
- package/cjs/inputs/Input/__stories__/PostalCode/index.js +45 -33
- package/cjs/inputs/Input/__stories__/PostalCode.js.map +2 -2
- package/cjs/inputs/Input/__stories__/String/index.js +64 -0
- package/cjs/inputs/Input/__stories__/String.js.map +7 -0
- package/cjs/inputs/Input/__stories__/TextWithLimit/index.js +64 -0
- package/cjs/inputs/Input/__stories__/TextWithLimit.js.map +7 -0
- package/cjs/inputs/Input/index.js +65 -53
- package/cjs/inputs/Input/index.js.map +2 -2
- package/cjs/inputs/Input/inputsInputScenarios/index.js +439 -0
- package/cjs/inputs/Input/inputsInputScenarios.js.map +7 -0
- package/cjs/inputs/Label/Label.stories/index.js +27 -18
- package/cjs/inputs/Label/Label.stories.js.map +3 -3
- package/cjs/inputs/Label/__stories__/Default/index.js +54 -36
- package/cjs/inputs/Label/__stories__/Default.js.map +3 -3
- package/cjs/inputs/Label/index.js +28 -28
- package/cjs/inputs/Label/index.js.map +3 -3
- package/cjs/inputs/OtpInput/OtpInput.stories/index.js +27 -18
- package/cjs/inputs/OtpInput/OtpInput.stories.js.map +3 -3
- package/cjs/inputs/OtpInput/__stories__/Default/index.js +35 -29
- package/cjs/inputs/OtpInput/__stories__/Default.js.map +2 -2
- package/cjs/inputs/OtpInput/index.js +118 -94
- package/cjs/inputs/OtpInput/index.js.map +3 -3
- package/cjs/inputs/Radio/Radio.stories/index.js +33 -20
- package/cjs/inputs/Radio/Radio.stories.js.map +3 -3
- package/cjs/inputs/Radio/__stories__/Conditional/index.js +35 -29
- package/cjs/inputs/Radio/__stories__/Conditional.js.map +2 -2
- package/cjs/inputs/Radio/__stories__/Default/index.js +62 -50
- package/cjs/inputs/Radio/__stories__/Default.js.map +2 -2
- package/cjs/inputs/Radio/__stories__/WithDivider/index.js +63 -51
- package/cjs/inputs/Radio/__stories__/WithDivider.js.map +2 -2
- package/cjs/inputs/Radio/index.js +61 -55
- package/cjs/inputs/Radio/index.js.map +3 -3
- package/cjs/inputs/Select/Select.stories/index.js +27 -18
- package/cjs/inputs/Select/Select.stories.js.map +3 -3
- package/cjs/inputs/Select/__stories__/Default/index.js +67 -55
- package/cjs/inputs/Select/__stories__/Default.js.map +2 -2
- package/cjs/inputs/Select/index.js +39 -30
- package/cjs/inputs/Select/index.js.map +2 -2
- package/cjs/inputs/index.js +30 -24
- package/cjs/inputs/index.js.map +1 -1
- package/cjs/inputs/inputsScenarios/index.js +540 -0
- package/cjs/inputs/inputsScenarios.js.map +7 -0
- package/cjs/internal/index.js +24 -77
- package/cjs/internal.js.map +2 -2
- package/cjs/lazy/index.js +81 -74
- package/cjs/lazy.js.map +3 -3
- package/cjs/locales/el/index.js +35 -0
- package/cjs/locales/el.js.map +7 -0
- package/cjs/registry/index.js +107 -88
- package/cjs/registry.js.map +2 -2
- package/cjs/types/index.js +20 -2
- package/cjs/types.js.map +2 -2
- package/cjs/utils/index.js +47 -34
- package/cjs/utils.js.map +3 -3
- package/cjs/validators/index.js +34 -30
- package/cjs/validators/index.js.map +3 -3
- package/cjs/validators/types/index.js +14 -2
- package/cjs/validators/types.js.map +1 -1
- package/cjs/validators/utils/afm/index.js +16 -4
- package/cjs/validators/utils/afm.js.map +1 -1
- package/cjs/validators/utils/file/index.js +25 -13
- package/cjs/validators/utils/file.js.map +2 -2
- package/cjs/validators/utils/iban/index.js +16 -4
- package/cjs/validators/utils/iban.js.map +1 -1
- package/cjs/validators/utils/image/index.js +18 -6
- package/cjs/validators/utils/image.js.map +1 -1
- package/cjs/validators/utils/index.js +52 -28
- package/cjs/validators/utils/index.js.map +1 -1
- package/cjs/validators/utils/int/index.js +16 -4
- package/cjs/validators/utils/int.js.map +1 -1
- package/cjs/validators/utils/number/index.js +16 -4
- package/cjs/validators/utils/number.js.map +1 -1
- package/cjs/validators/utils/otp/index.js +16 -4
- package/cjs/validators/utils/otp.js.map +1 -1
- package/cjs/validators/utils/phone/index.js +25 -6
- package/cjs/validators/utils/phone.js.map +2 -2
- package/cjs/validators/utils/postal_code/index.js +16 -4
- package/cjs/validators/utils/postal_code.js.map +1 -1
- package/cjs/validators/utils/text_limit/index.js +18 -6
- package/cjs/validators/utils/text_limit.js.map +1 -1
- package/cjs/validators/utils/uuid4/index.js +16 -4
- package/cjs/validators/utils/uuid4.js.map +1 -1
- package/index.d.ts +7 -1
- package/index.js +151 -3
- package/index.js.map +4 -4
- package/inputs/AutoCompleteInput/AutoComplete.stories/index.js +4 -2
- package/inputs/AutoCompleteInput/AutoComplete.stories.d.ts +2 -2
- package/inputs/AutoCompleteInput/AutoComplete.stories.js.map +2 -2
- package/inputs/AutoCompleteInput/__stories__/Default/index.js +22 -18
- package/inputs/AutoCompleteInput/__stories__/Default.d.ts +2 -2
- package/inputs/AutoCompleteInput/__stories__/Default.js.map +2 -2
- package/inputs/AutoCompleteInput/__stories__/Multiple/index.js +26 -20
- package/inputs/AutoCompleteInput/__stories__/Multiple.d.ts +3 -2
- package/inputs/AutoCompleteInput/__stories__/Multiple.js.map +2 -2
- package/inputs/AutoCompleteInput/index.d.ts +1 -1
- package/inputs/AutoCompleteInput/index.js +45 -26
- package/inputs/AutoCompleteInput/index.js.map +3 -3
- package/inputs/AutoCompleteInput/index.test.d.ts +1 -0
- package/inputs/Checkboxes/Checkboxes.stories/index.js +6 -3
- package/inputs/Checkboxes/Checkboxes.stories.d.ts +3 -3
- package/inputs/Checkboxes/Checkboxes.stories.js.map +2 -2
- package/inputs/Checkboxes/__stories__/Conditional/index.js +13 -13
- package/inputs/Checkboxes/__stories__/Conditional.d.ts +2 -2
- package/inputs/Checkboxes/__stories__/Conditional.js.map +1 -1
- package/inputs/Checkboxes/__stories__/Default/index.js +36 -30
- package/inputs/Checkboxes/__stories__/Default.d.ts +2 -2
- package/inputs/Checkboxes/__stories__/Default.js.map +1 -1
- package/inputs/Checkboxes/__stories__/WithDivider/index.js +37 -31
- package/inputs/Checkboxes/__stories__/WithDivider.d.ts +2 -2
- package/inputs/Checkboxes/__stories__/WithDivider.js.map +1 -1
- package/inputs/Checkboxes/index.d.ts +1 -0
- package/inputs/Checkboxes/index.js +46 -44
- package/inputs/Checkboxes/index.js.map +2 -2
- package/inputs/Checkboxes/index.test.d.ts +1 -0
- package/inputs/DateInput/DateInput.stories/index.js +2 -1
- package/inputs/DateInput/DateInput.stories.d.ts +1 -1
- package/inputs/DateInput/DateInput.stories.js.map +2 -2
- package/inputs/DateInput/__stories__/Default/index.js +19 -16
- package/inputs/DateInput/__stories__/Default.d.ts +2 -2
- package/inputs/DateInput/__stories__/Default.js.map +2 -2
- package/inputs/DateInput/index.d.ts +2 -2
- package/inputs/DateInput/index.js +48 -41
- package/inputs/DateInput/index.js.map +3 -3
- package/inputs/DateInput/index.test.d.ts +1 -0
- package/inputs/FileInput/FileInput.stories/index.js +2 -1
- package/inputs/FileInput/FileInput.stories.d.ts +1 -1
- package/inputs/FileInput/FileInput.stories.js.map +2 -2
- package/inputs/FileInput/__stories__/Default/index.js +21 -13
- package/inputs/FileInput/__stories__/Default.d.ts +2 -2
- package/inputs/FileInput/__stories__/Default.js.map +1 -1
- package/inputs/FileInput/index.js +30 -22
- package/inputs/FileInput/index.js.map +2 -2
- package/inputs/FileInput/index.test.d.ts +1 -0
- package/inputs/ImageInput/ImageInput.stories/index.js +6 -3
- package/inputs/ImageInput/ImageInput.stories.d.ts +3 -3
- package/inputs/ImageInput/ImageInput.stories.js.map +2 -2
- package/inputs/ImageInput/__stories__/Default/index.js +13 -13
- package/inputs/ImageInput/__stories__/Default.d.ts +2 -2
- package/inputs/ImageInput/__stories__/Default.js.map +1 -1
- package/inputs/ImageInput/__stories__/WithInvalidImageDimension/index.js +13 -13
- package/inputs/ImageInput/__stories__/WithInvalidImageDimension.d.ts +2 -2
- package/inputs/ImageInput/__stories__/WithInvalidImageDimension.js.map +1 -1
- package/inputs/ImageInput/__stories__/WithInvalidImageSize/index.js +13 -13
- package/inputs/ImageInput/__stories__/WithInvalidImageSize.d.ts +2 -2
- package/inputs/ImageInput/__stories__/WithInvalidImageSize.js.map +1 -1
- package/inputs/ImageInput/index.js +47 -47
- package/inputs/ImageInput/index.js.map +2 -2
- package/inputs/ImageInput/index.test.d.ts +1 -0
- package/inputs/Input/Input.stories/index.js +20 -10
- package/inputs/Input/Input.stories.d.ts +10 -10
- package/inputs/Input/Input.stories.js.map +2 -2
- package/inputs/Input/__stories__/AFM/index.js +22 -16
- package/inputs/Input/__stories__/AFM.d.ts +2 -2
- package/inputs/Input/__stories__/AFM.js.map +1 -1
- package/inputs/Input/__stories__/Boolean/index.js +23 -17
- package/inputs/Input/__stories__/Boolean.d.ts +2 -2
- package/inputs/Input/__stories__/Boolean.js.map +1 -1
- package/inputs/Input/__stories__/IBAN/index.js +23 -17
- package/inputs/Input/__stories__/IBAN.d.ts +2 -2
- package/inputs/Input/__stories__/IBAN.js.map +1 -1
- package/inputs/Input/__stories__/Integer/index.js +35 -25
- package/inputs/Input/__stories__/Integer.d.ts +2 -2
- package/inputs/Input/__stories__/Integer.js.map +1 -1
- package/inputs/Input/__stories__/LandlineNumber/index.js +26 -20
- package/inputs/Input/__stories__/LandlineNumber.d.ts +2 -2
- package/inputs/Input/__stories__/LandlineNumber.js.map +1 -1
- package/inputs/Input/__stories__/MobilePhone/index.js +26 -20
- package/inputs/Input/__stories__/MobilePhone.d.ts +2 -2
- package/inputs/Input/__stories__/MobilePhone.js.map +1 -1
- package/inputs/Input/__stories__/PhoneNumber/index.js +25 -19
- package/inputs/Input/__stories__/PhoneNumber.d.ts +2 -2
- package/inputs/Input/__stories__/PhoneNumber.js.map +1 -1
- package/inputs/Input/__stories__/PostalCode/index.js +23 -17
- package/inputs/Input/__stories__/PostalCode.d.ts +2 -2
- package/inputs/Input/__stories__/PostalCode.js.map +1 -1
- package/inputs/Input/__stories__/String/index.js +31 -0
- package/inputs/Input/__stories__/String/package.json +6 -0
- package/inputs/Input/__stories__/String.d.ts +3 -0
- package/inputs/Input/__stories__/String.js.map +7 -0
- package/inputs/Input/__stories__/TextWithLimit/index.js +31 -0
- package/inputs/Input/__stories__/TextWithLimit/package.json +6 -0
- package/inputs/Input/__stories__/TextWithLimit.d.ts +3 -0
- package/inputs/Input/__stories__/TextWithLimit.js.map +7 -0
- package/inputs/Input/index.js +41 -35
- package/inputs/Input/index.js.map +1 -1
- package/inputs/Input/index.test.d.ts +1 -0
- package/inputs/Input/inputsInputScenarios/index.js +406 -0
- package/inputs/Input/inputsInputScenarios/package.json +6 -0
- package/inputs/Input/inputsInputScenarios.d.ts +57 -0
- package/inputs/Input/inputsInputScenarios.js.map +7 -0
- package/inputs/Label/Label.stories/index.js +2 -1
- package/inputs/Label/Label.stories.d.ts +1 -1
- package/inputs/Label/Label.stories.js.map +2 -2
- package/inputs/Label/__stories__/Default/index.js +32 -20
- package/inputs/Label/__stories__/Default.d.ts +2 -2
- package/inputs/Label/__stories__/Default.js.map +2 -2
- package/inputs/Label/index.d.ts +1 -1
- package/inputs/Label/index.js +4 -10
- package/inputs/Label/index.js.map +2 -2
- package/inputs/Label/index.test.d.ts +1 -0
- package/inputs/OtpInput/OtpInput.stories/index.js +2 -1
- package/inputs/OtpInput/OtpInput.stories.d.ts +1 -1
- package/inputs/OtpInput/OtpInput.stories.js.map +2 -2
- package/inputs/OtpInput/__stories__/Default/index.js +13 -13
- package/inputs/OtpInput/__stories__/Default.d.ts +2 -2
- package/inputs/OtpInput/__stories__/Default.js.map +1 -1
- package/inputs/OtpInput/index.d.ts +9 -2
- package/inputs/OtpInput/index.js +94 -77
- package/inputs/OtpInput/index.js.map +2 -2
- package/inputs/OtpInput/index.test.d.ts +1 -0
- package/inputs/Radio/Radio.stories/index.js +6 -3
- package/inputs/Radio/Radio.stories.d.ts +3 -3
- package/inputs/Radio/Radio.stories.js.map +2 -2
- package/inputs/Radio/__stories__/Conditional/index.js +13 -13
- package/inputs/Radio/__stories__/Conditional.d.ts +2 -2
- package/inputs/Radio/__stories__/Conditional.js.map +1 -1
- package/inputs/Radio/__stories__/Default/index.js +40 -34
- package/inputs/Radio/__stories__/Default.d.ts +2 -2
- package/inputs/Radio/__stories__/Default.js.map +1 -1
- package/inputs/Radio/__stories__/WithDivider/index.js +41 -35
- package/inputs/Radio/__stories__/WithDivider.d.ts +2 -2
- package/inputs/Radio/__stories__/WithDivider.js.map +1 -1
- package/inputs/Radio/index.d.ts +1 -0
- package/inputs/Radio/index.js +36 -36
- package/inputs/Radio/index.js.map +2 -2
- package/inputs/Radio/index.test.d.ts +1 -0
- package/inputs/Select/Select.stories/index.js +2 -1
- package/inputs/Select/Select.stories.d.ts +1 -1
- package/inputs/Select/Select.stories.js.map +2 -2
- package/inputs/Select/__stories__/Default/index.js +45 -39
- package/inputs/Select/__stories__/Default.d.ts +2 -2
- package/inputs/Select/__stories__/Default.js.map +1 -1
- package/inputs/Select/index.js +15 -12
- package/inputs/Select/index.js.map +1 -1
- package/inputs/Select/index.test.d.ts +1 -0
- package/inputs/index.js +9 -9
- package/inputs/index.js.map +2 -2
- package/inputs/inputsScenarios/index.js +506 -0
- package/inputs/inputsScenarios/package.json +6 -0
- package/inputs/inputsScenarios.d.ts +338 -0
- package/inputs/inputsScenarios.js.map +7 -0
- package/internal/index.js +4 -45
- package/internal.d.ts +2 -31
- package/internal.js.map +2 -2
- package/lazy/index.js +60 -57
- package/lazy.d.ts +33 -30
- package/lazy.js.map +2 -2
- package/locales/el/index.js +6 -0
- package/{Questions/index.spec → locales/el}/package.json +1 -1
- package/locales/el.d.ts +2 -0
- package/locales/el.js.map +7 -0
- package/package.json +7 -7
- package/registry/index.js +26 -11
- package/registry.d.ts +7 -1
- package/registry.js.map +2 -2
- package/src/Field/FieldBase.tsx +1 -0
- package/src/Field/FieldConditional.tsx +1 -1
- package/src/Field/index.tsx +19 -3
- package/src/Field/types.tsx +64 -3
- package/src/Field/utils/calculateField.ts +49 -0
- package/src/Field/utils/evaluateFieldWithConditions.ts +30 -0
- package/src/Field/utils/index.ts +59 -0
- package/src/Field/utils/useField.ts +54 -0
- package/src/FieldArray/FieldArray.stories.js +2 -2
- package/src/FieldArray/index.test.tsx +24 -0
- package/src/FieldArray/index.tsx +11 -3
- package/src/FieldObject/index.tsx +10 -3
- package/src/Fieldset/types.tsx +3 -1
- package/src/FormBuilder/FormBuilder.stories.js +1 -1
- package/src/FormBuilder/index.test.tsx +20 -0
- package/src/FormBuilder/index.tsx +7 -2
- package/src/FormBuilder/scenarios.test.tsx +1864 -0
- package/src/MultiplicityField/MultiplicityField.stories.js +6 -6
- package/src/MultiplicityField/__stories__/PreviewDisplay.tsx +2 -2
- package/src/MultiplicityField/__stories__/WithExactLength.tsx +1 -1
- package/src/MultiplicityField/__stories__/WithMaxLength.tsx +1 -1
- package/src/MultiplicityField/__stories__/WithMinAndMaxLength.tsx +1 -1
- package/src/MultiplicityField/__stories__/WithMinLength.tsx +1 -1
- package/src/MultiplicityField/add-objects.tsx +23 -9
- package/src/MultiplicityField/index.test.tsx +40 -0
- package/src/MultiplicityField/index.tsx +9 -26
- package/src/MultiplicityField/types.ts +22 -0
- package/src/Questions/Questions.stories.js +1 -1
- package/src/Questions/Step/StepTitle.tsx +1 -0
- package/src/Questions/Step/index.ts +0 -1
- package/src/Questions/Step/types.tsx +1 -0
- package/src/Questions/__snapshots__/index.spec.tsx.snap +67 -586
- package/src/Questions/index.mdx +4 -4
- package/src/Questions/index.spec.tsx +3 -3
- package/src/Questions/index.test.tsx +20 -0
- package/src/Questions/types.tsx +1 -0
- package/src/{FormBuilder/FormBuilder.tsx → index.tsx} +21 -9
- package/src/inputs/AutoCompleteInput/AutoComplete.stories.js +2 -2
- package/src/inputs/AutoCompleteInput/__stories__/Default.tsx +26 -18
- package/src/inputs/AutoCompleteInput/__stories__/Multiple.tsx +27 -19
- package/src/inputs/AutoCompleteInput/index.mdx +8 -2
- package/src/inputs/AutoCompleteInput/index.test.tsx +24 -0
- package/src/inputs/AutoCompleteInput/index.tsx +22 -12
- package/src/inputs/Checkboxes/Checkboxes.stories.js +3 -3
- package/src/inputs/Checkboxes/index.test.tsx +28 -0
- package/src/inputs/Checkboxes/index.tsx +28 -25
- package/src/inputs/DateInput/DateInput.stories.js +1 -1
- package/src/inputs/DateInput/__stories__/Default.tsx +21 -15
- package/src/inputs/DateInput/index.test.tsx +20 -0
- package/src/inputs/DateInput/index.tsx +2 -2
- package/src/inputs/FileInput/FileInput.stories.js +1 -1
- package/src/inputs/FileInput/index.test.tsx +20 -0
- package/src/inputs/ImageInput/ImageInput.stories.js +3 -3
- package/src/inputs/ImageInput/index.test.tsx +28 -0
- package/src/inputs/Input/Input.stories.js +10 -10
- package/src/inputs/Input/__stories__/{Default.tsx → String.tsx} +2 -2
- package/src/inputs/Input/__stories__/{TextWithCharacterLimit.tsx → TextWithLimit.tsx} +2 -2
- package/src/inputs/Input/index.mdx +4 -4
- package/src/inputs/Input/index.test.tsx +56 -0
- package/src/inputs/Input/inputsInputScenarios.ts +405 -0
- package/src/inputs/Label/Label.stories.js +1 -1
- package/src/inputs/Label/__stories__/Default.tsx +3 -1
- package/src/inputs/Label/index.test.tsx +20 -0
- package/src/inputs/Label/index.tsx +1 -4
- package/src/inputs/OtpInput/OtpInput.stories.js +1 -1
- package/src/inputs/OtpInput/index.test.tsx +20 -0
- package/src/inputs/OtpInput/index.tsx +1 -1
- package/src/inputs/Radio/Radio.stories.js +3 -3
- package/src/inputs/Radio/index.test.tsx +28 -0
- package/src/inputs/Radio/index.tsx +6 -3
- package/src/inputs/Select/Select.stories.js +1 -1
- package/src/inputs/Select/index.test.tsx +20 -0
- package/src/inputs/inputsScenarios.ts +503 -0
- package/src/internal.ts +2 -31
- package/src/lazy.js +18 -15
- package/src/locales/el.ts +3 -0
- package/src/registry.js +14 -2
- package/src/types.tsx +9 -63
- package/src/utils.ts +34 -33
- package/src/validators/index.ts +5 -0
- package/src/validators/utils/file.ts +9 -9
- package/src/validators/utils/phone.ts +62 -71
- package/src/validators/validators.spec.ts +3 -37
- package/types/index.js +1 -0
- package/types.d.ts +4 -33
- package/types.js.map +3 -3
- package/utils/index.js +34 -17
- package/utils.js.map +3 -3
- package/validators/index.js +9 -11
- package/validators/index.js.map +2 -2
- package/validators/utils/afm.js.map +1 -1
- package/validators/utils/file/index.js +9 -9
- package/validators/utils/file.js.map +2 -2
- package/validators/utils/iban.js.map +1 -1
- package/validators/utils/image/index.js +2 -2
- package/validators/utils/image.js.map +1 -1
- package/validators/utils/index.js +10 -2
- package/validators/utils/index.js.map +1 -1
- package/validators/utils/int.js.map +1 -1
- package/validators/utils/number.js.map +1 -1
- package/validators/utils/otp.js.map +1 -1
- package/validators/utils/phone/index.js +9 -2
- package/validators/utils/phone.js.map +2 -2
- package/validators/utils/postal_code.js.map +1 -1
- package/validators/utils/text_limit/index.js +2 -2
- package/validators/utils/text_limit.js.map +1 -1
- package/validators/utils/uuid4.js.map +1 -1
- package/Field/utils.d.ts +0 -5
- package/Field/utils.js.map +0 -7
- package/FormBuilder/FormBuilder/index.js +0 -138
- package/FormBuilder/FormBuilder.d.ts +0 -5
- package/FormBuilder/FormBuilder.js.map +0 -7
- package/Questions/index.spec/index.js +0 -65
- package/Questions/index.spec.js.map +0 -7
- package/cjs/Field/utils.js.map +0 -7
- package/cjs/FormBuilder/FormBuilder/index.js +0 -166
- package/cjs/FormBuilder/FormBuilder.js.map +0 -7
- package/cjs/Questions/index.spec/index.js +0 -83
- package/cjs/Questions/index.spec.js.map +0 -7
- package/cjs/inputs/Input/__stories__/Default/index.js +0 -52
- package/cjs/inputs/Input/__stories__/Default.js.map +0 -7
- package/cjs/inputs/Input/__stories__/TextWithCharacterLimit/index.js +0 -52
- package/cjs/inputs/Input/__stories__/TextWithCharacterLimit.js.map +0 -7
- package/cjs/validators/validators.spec/index.js +0 -104
- package/cjs/validators/validators.spec.js.map +0 -7
- package/inputs/Input/__stories__/Default/index.js +0 -25
- package/inputs/Input/__stories__/Default.d.ts +0 -3
- package/inputs/Input/__stories__/Default.js.map +0 -7
- package/inputs/Input/__stories__/TextWithCharacterLimit/index.js +0 -25
- package/inputs/Input/__stories__/TextWithCharacterLimit/package.json +0 -6
- package/inputs/Input/__stories__/TextWithCharacterLimit.d.ts +0 -3
- package/inputs/Input/__stories__/TextWithCharacterLimit.js.map +0 -7
- package/src/Field/utils.ts +0 -191
- package/src/FieldArray/FieldArray.stories.playwright.json +0 -353
- package/src/FormBuilder/FormBuilder.stories.playwright.json +0 -52
- package/src/MultiplicityField/MultiplicityField.stories.playwright.json +0 -1370
- package/src/index.ts +0 -3
- package/src/inputs/Checkboxes/Checkboxes.stories.playwright.json +0 -85
- package/src/inputs/DateInput/DateInput.stories.playwright.json +0 -72
- package/src/inputs/FileInput/FileInput.stories.playwright.json +0 -75
- package/src/inputs/ImageInput/ImageInput.stories.playwright.json +0 -77
- package/src/inputs/Input/Input.stories.playwright.json +0 -376
- package/src/inputs/Label/Label.stories.playwright.json +0 -40
- package/src/inputs/Radio/Radio.stories.playwright.json +0 -73
- package/src/inputs/Select/Select.stories.playwright.json +0 -22
- package/validators/validators.spec/index.js +0 -91
- package/validators/validators.spec.js.map +0 -7
|
@@ -1,65 +1,80 @@
|
|
|
1
1
|
var __create = Object.create;
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
3
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
4
6
|
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
7
|
var __export = (target, all) => {
|
|
9
8
|
for (var name in all)
|
|
10
|
-
__defProp(target, name, {get: all[name], enumerable: true});
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
10
|
};
|
|
12
|
-
var
|
|
13
|
-
if (
|
|
14
|
-
for (let key of __getOwnPropNames(
|
|
15
|
-
if (!__hasOwnProp.call(
|
|
16
|
-
__defProp(
|
|
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 });
|
|
17
16
|
}
|
|
18
|
-
return
|
|
17
|
+
return to;
|
|
19
18
|
};
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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 FieldConditional_exports = {};
|
|
29
|
+
__export(FieldConditional_exports, {
|
|
25
30
|
FieldConditional: () => FieldConditional,
|
|
26
31
|
default: () => FieldConditional_default
|
|
27
32
|
});
|
|
28
|
-
|
|
29
|
-
var
|
|
30
|
-
var
|
|
31
|
-
var
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
register,
|
|
38
|
-
error
|
|
39
|
-
}) {
|
|
40
|
-
const newField = (0, import_utils.evaluateFieldWithConditions)(field, dependencies);
|
|
41
|
-
return /* @__PURE__ */ import_react.default.createElement(import_FieldBase.FieldBase, {
|
|
42
|
-
...newField,
|
|
43
|
-
name: newField.key,
|
|
44
|
-
reset,
|
|
33
|
+
module.exports = __toCommonJS(FieldConditional_exports);
|
|
34
|
+
var import_react = __toESM(require("react"));
|
|
35
|
+
var import_react_hook_form = require("react-hook-form");
|
|
36
|
+
var import_FieldBase = require("@digigov/form/Field/FieldBase");
|
|
37
|
+
var import_evaluateFieldWithConditions = require("@digigov/form/Field/utils/evaluateFieldWithConditions");
|
|
38
|
+
const ChildFieldMemo = import_react.default.memo(
|
|
39
|
+
function ChildField({
|
|
40
|
+
dependencies,
|
|
41
|
+
field,
|
|
45
42
|
control,
|
|
43
|
+
reset,
|
|
46
44
|
register,
|
|
47
45
|
error
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
46
|
+
}) {
|
|
47
|
+
const newField = (0, import_evaluateFieldWithConditions.evaluateFieldWithConditions)(
|
|
48
|
+
field,
|
|
49
|
+
dependencies
|
|
50
|
+
);
|
|
51
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
52
|
+
import_FieldBase.FieldBase,
|
|
53
|
+
{
|
|
54
|
+
...newField,
|
|
55
|
+
name: newField.key,
|
|
56
|
+
reset,
|
|
57
|
+
control,
|
|
58
|
+
register,
|
|
59
|
+
error
|
|
60
|
+
}
|
|
61
|
+
);
|
|
62
|
+
},
|
|
63
|
+
(prev, next) => {
|
|
64
|
+
if (!prev || !prev.dependencies) {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
if (prev.error !== next.error) {
|
|
58
68
|
return false;
|
|
59
69
|
}
|
|
70
|
+
for (const dep in next.dependencies) {
|
|
71
|
+
if (next.dependencies[dep] !== prev.dependencies[dep]) {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return true;
|
|
60
76
|
}
|
|
61
|
-
|
|
62
|
-
});
|
|
77
|
+
);
|
|
63
78
|
const FieldConditional = ({
|
|
64
79
|
control,
|
|
65
80
|
field,
|
|
@@ -72,18 +87,24 @@ const FieldConditional = ({
|
|
|
72
87
|
name: dependencyKeys,
|
|
73
88
|
control
|
|
74
89
|
});
|
|
75
|
-
const variables = dependencyKeys.reduce(
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
90
|
+
const variables = dependencyKeys.reduce(
|
|
91
|
+
(data, fieldKey, index) => ({
|
|
92
|
+
...data,
|
|
93
|
+
[fieldKey]: dependencyValues[index]
|
|
94
|
+
}),
|
|
95
|
+
{}
|
|
96
|
+
);
|
|
97
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
98
|
+
ChildFieldMemo,
|
|
99
|
+
{
|
|
100
|
+
dependencies: variables,
|
|
101
|
+
field,
|
|
102
|
+
control,
|
|
103
|
+
register,
|
|
104
|
+
reset,
|
|
105
|
+
error
|
|
106
|
+
}
|
|
107
|
+
);
|
|
87
108
|
};
|
|
88
109
|
var FieldConditional_default = FieldConditional;
|
|
89
110
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -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';\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": "
|
|
6
|
-
"names": []
|
|
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;",
|
|
6
|
+
"names": ["React"]
|
|
7
7
|
}
|
package/cjs/Field/index.js
CHANGED
|
@@ -1,38 +1,47 @@
|
|
|
1
1
|
var __create = Object.create;
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
3
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
4
6
|
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
7
|
var __export = (target, all) => {
|
|
9
8
|
for (var name in all)
|
|
10
|
-
__defProp(target, name, {get: all[name], enumerable: true});
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
10
|
};
|
|
12
|
-
var
|
|
13
|
-
if (
|
|
14
|
-
for (let key of __getOwnPropNames(
|
|
15
|
-
if (!__hasOwnProp.call(
|
|
16
|
-
__defProp(
|
|
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 });
|
|
17
16
|
}
|
|
18
|
-
return
|
|
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);
|
|
17
|
+
return to;
|
|
22
18
|
};
|
|
23
|
-
|
|
24
|
-
|
|
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 Field_exports = {};
|
|
29
|
+
__export(Field_exports, {
|
|
25
30
|
Field: () => Field,
|
|
26
31
|
default: () => Field_default
|
|
27
32
|
});
|
|
28
|
-
|
|
29
|
-
var
|
|
30
|
-
var
|
|
31
|
-
var
|
|
32
|
-
var
|
|
33
|
-
var
|
|
33
|
+
module.exports = __toCommonJS(Field_exports);
|
|
34
|
+
var import_react = __toESM(require("react"));
|
|
35
|
+
var import_FieldBase = require("@digigov/form/Field/FieldBase");
|
|
36
|
+
var import_FieldConditional = __toESM(require("@digigov/form/Field/FieldConditional"));
|
|
37
|
+
var import_utils = require("@digigov/form/Field/utils");
|
|
38
|
+
var import_calculateField = require("@digigov/form/Field/utils/calculateField");
|
|
39
|
+
var import_useField = require("@digigov/form/Field/utils/useField");
|
|
40
|
+
var import_FieldArray = __toESM(require("@digigov/form/FieldArray"));
|
|
41
|
+
var import_MultiplicityField = __toESM(require("@digigov/form/MultiplicityField"));
|
|
34
42
|
const Field = ({
|
|
35
43
|
name,
|
|
44
|
+
disabled,
|
|
36
45
|
children,
|
|
37
46
|
...customField
|
|
38
47
|
}) => {
|
|
@@ -49,50 +58,75 @@ const Field = ({
|
|
|
49
58
|
unregister,
|
|
50
59
|
trigger,
|
|
51
60
|
clearErrors
|
|
52
|
-
} = (0,
|
|
53
|
-
const calculatedField = (0, import_react.useMemo)(
|
|
61
|
+
} = (0, import_useField.useField)(name, customField?.type ? customField : null);
|
|
62
|
+
const calculatedField = (0, import_react.useMemo)(
|
|
63
|
+
() => (0, import_calculateField.calculateField)(
|
|
64
|
+
children,
|
|
65
|
+
field,
|
|
66
|
+
{
|
|
67
|
+
...import_utils.FIELD_COMPONENTS,
|
|
68
|
+
...componentRegistry
|
|
69
|
+
},
|
|
70
|
+
import_utils.ALTERNATIVE_COMPONENTS
|
|
71
|
+
),
|
|
72
|
+
[field]
|
|
73
|
+
);
|
|
54
74
|
if (calculatedField.condition) {
|
|
55
|
-
return /* @__PURE__ */ import_react.default.createElement(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
75
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
76
|
+
import_FieldConditional.default,
|
|
77
|
+
{
|
|
78
|
+
control,
|
|
79
|
+
reset,
|
|
80
|
+
register,
|
|
81
|
+
field: calculatedField,
|
|
82
|
+
error
|
|
83
|
+
}
|
|
84
|
+
);
|
|
62
85
|
}
|
|
63
86
|
if (calculatedField.type === "array" && !calculatedField.multiplicity) {
|
|
64
87
|
calculatedField.name = name;
|
|
65
|
-
return /* @__PURE__ */ import_react.default.createElement(
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
88
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
89
|
+
import_FieldArray.default,
|
|
90
|
+
{
|
|
91
|
+
control,
|
|
92
|
+
register,
|
|
93
|
+
error,
|
|
94
|
+
formState,
|
|
95
|
+
...calculatedField
|
|
96
|
+
}
|
|
97
|
+
);
|
|
72
98
|
}
|
|
73
99
|
if (calculatedField.type === "array" && calculatedField.multiplicity === true) {
|
|
74
100
|
calculatedField.name = name;
|
|
75
|
-
return /* @__PURE__ */ import_react.default.createElement(
|
|
101
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
102
|
+
import_MultiplicityField.default,
|
|
103
|
+
{
|
|
104
|
+
control,
|
|
105
|
+
register,
|
|
106
|
+
trigger,
|
|
107
|
+
clearErrors,
|
|
108
|
+
error,
|
|
109
|
+
formState,
|
|
110
|
+
setValue,
|
|
111
|
+
getValues,
|
|
112
|
+
unregister,
|
|
113
|
+
...calculatedField
|
|
114
|
+
}
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
118
|
+
import_FieldBase.FieldBase,
|
|
119
|
+
{
|
|
120
|
+
...calculatedField,
|
|
121
|
+
name,
|
|
122
|
+
disabled,
|
|
76
123
|
control,
|
|
77
124
|
register,
|
|
78
|
-
|
|
79
|
-
clearErrors,
|
|
125
|
+
reset,
|
|
80
126
|
error,
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
unregister,
|
|
85
|
-
...calculatedField
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
return /* @__PURE__ */ import_react.default.createElement(import_FieldBase.FieldBase, {
|
|
89
|
-
...calculatedField,
|
|
90
|
-
name,
|
|
91
|
-
control,
|
|
92
|
-
register,
|
|
93
|
-
reset,
|
|
94
|
-
error
|
|
95
|
-
});
|
|
127
|
+
fieldComponent: Field
|
|
128
|
+
}
|
|
129
|
+
);
|
|
96
130
|
};
|
|
97
131
|
var Field_default = Field;
|
|
98
132
|
// Annotate the CommonJS export names for ESM import in node:
|
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 {
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": []
|
|
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 fieldComponent={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;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,gBAAgB;AAAA;AAAA,EAClB;AAEJ;AAEA,IAAO,gBAAQ;",
|
|
6
|
+
"names": ["React", "FieldConditional", "FieldArray", "Multiplicity"]
|
|
7
7
|
}
|
package/cjs/Field/types/index.js
CHANGED
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
+
var types_exports = {};
|
|
15
|
+
module.exports = __toCommonJS(types_exports);
|
|
4
16
|
//# sourceMappingURL=types.js.map
|
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 } from 'react-hook-form';\nimport {
|
|
5
|
-
"mappings": "
|
|
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 type FieldLabelProps = {\n primary?: string;\n secondary?: 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 | 'otp'\n | 'afm'\n | 'iban'\n | 'file'\n | 'image'\n | 'postal_code'\n | 'phone_number'\n | 'array'\n | 'object';\n component?: any;\n maxLength?: number;\n condition?: Record<string, FieldCondition>;\n controlled?: boolean;\n label?: FieldLabelProps;\n extra?: {\n [key: string]: any;\n };\n editable?: boolean;\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}\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 fieldComponent?: React.FC<FieldBaseProps>;\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;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var calculateField_exports = {};
|
|
19
|
+
__export(calculateField_exports, {
|
|
20
|
+
calculateField: () => calculateField
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(calculateField_exports);
|
|
23
|
+
function calculateField(children, field, fieldComponentRegistry, alternativeComponents) {
|
|
24
|
+
const calculatedField = { ...field };
|
|
25
|
+
if (children) {
|
|
26
|
+
calculatedField.component = children;
|
|
27
|
+
calculatedField.controlled = true;
|
|
28
|
+
} else if (typeof field.component === "function") {
|
|
29
|
+
} else if (!field.component && !field.type) {
|
|
30
|
+
calculatedField.component = fieldComponentRegistry.string.component;
|
|
31
|
+
calculatedField.controlled = fieldComponentRegistry.string?.controlled || false;
|
|
32
|
+
} else if (typeof field?.extra?.component === "string" && alternativeComponents[field.extra.component]) {
|
|
33
|
+
calculatedField.controlled = alternativeComponents[field.extra.component]?.controlled || false;
|
|
34
|
+
calculatedField.component = alternativeComponents[field.extra.component].component;
|
|
35
|
+
calculatedField.wrapper = alternativeComponents[field.extra.component].wrapper;
|
|
36
|
+
} else if (!field.component && field.type && fieldComponentRegistry[field.type]) {
|
|
37
|
+
calculatedField.component = fieldComponentRegistry[field.type].component;
|
|
38
|
+
calculatedField.wrapper = fieldComponentRegistry[field.type].wrapper;
|
|
39
|
+
calculatedField.controlled = fieldComponentRegistry[field.type]?.controlled || false;
|
|
40
|
+
} else {
|
|
41
|
+
calculatedField.component = fieldComponentRegistry.string.component;
|
|
42
|
+
calculatedField.controlled = fieldComponentRegistry.string?.controlled || false;
|
|
43
|
+
}
|
|
44
|
+
return calculatedField;
|
|
45
|
+
}
|
|
46
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
47
|
+
0 && (module.exports = {
|
|
48
|
+
calculateField
|
|
49
|
+
});
|
|
50
|
+
//# sourceMappingURL=calculateField.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/Field/utils/calculateField.ts"],
|
|
4
|
+
"sourcesContent": ["import {\n FieldProps,\n FieldSpec,\n FieldComponentRegistry,\n CalculatedField,\n} from '@digigov/form/Field/types';\n\nexport function calculateField(\n children: FieldProps['children'],\n field: FieldSpec,\n fieldComponentRegistry: FieldComponentRegistry,\n alternativeComponents: FieldComponentRegistry\n): CalculatedField {\n const calculatedField = { ...field };\n if (children) {\n calculatedField.component = children;\n calculatedField.controlled = true;\n } else if (typeof field.component === 'function') {\n // leave as is\n } else if (!field.component && !field.type) {\n calculatedField.component = fieldComponentRegistry.string.component;\n calculatedField.controlled =\n fieldComponentRegistry.string?.controlled || false;\n } else if (\n typeof field?.extra?.component === 'string' &&\n alternativeComponents[field.extra.component]\n ) {\n calculatedField.controlled =\n alternativeComponents[field.extra.component]?.controlled || false;\n calculatedField.component =\n alternativeComponents[field.extra.component].component;\n calculatedField.wrapper =\n alternativeComponents[field.extra.component].wrapper;\n } else if (\n !field.component &&\n field.type &&\n fieldComponentRegistry[field.type]\n ) {\n calculatedField.component = fieldComponentRegistry[field.type].component;\n calculatedField.wrapper = fieldComponentRegistry[field.type].wrapper;\n calculatedField.controlled =\n fieldComponentRegistry[field.type]?.controlled || false;\n } else {\n calculatedField.component = fieldComponentRegistry.string.component;\n calculatedField.controlled =\n fieldComponentRegistry.string?.controlled || false;\n }\n return calculatedField as CalculatedField;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOO,SAAS,eACd,UACA,OACA,wBACA,uBACiB;AACjB,QAAM,kBAAkB,EAAE,GAAG,MAAM;AACnC,MAAI,UAAU;AACZ,oBAAgB,YAAY;AAC5B,oBAAgB,aAAa;AAAA,EAC/B,WAAW,OAAO,MAAM,cAAc,YAAY;AAAA,EAElD,WAAW,CAAC,MAAM,aAAa,CAAC,MAAM,MAAM;AAC1C,oBAAgB,YAAY,uBAAuB,OAAO;AAC1D,oBAAgB,aACd,uBAAuB,QAAQ,cAAc;AAAA,EACjD,WACE,OAAO,OAAO,OAAO,cAAc,YACnC,sBAAsB,MAAM,MAAM,SAAS,GAC3C;AACA,oBAAgB,aACd,sBAAsB,MAAM,MAAM,SAAS,GAAG,cAAc;AAC9D,oBAAgB,YACd,sBAAsB,MAAM,MAAM,SAAS,EAAE;AAC/C,oBAAgB,UACd,sBAAsB,MAAM,MAAM,SAAS,EAAE;AAAA,EACjD,WACE,CAAC,MAAM,aACP,MAAM,QACN,uBAAuB,MAAM,IAAI,GACjC;AACA,oBAAgB,YAAY,uBAAuB,MAAM,IAAI,EAAE;AAC/D,oBAAgB,UAAU,uBAAuB,MAAM,IAAI,EAAE;AAC7D,oBAAgB,aACd,uBAAuB,MAAM,IAAI,GAAG,cAAc;AAAA,EACtD,OAAO;AACL,oBAAgB,YAAY,uBAAuB,OAAO;AAC1D,oBAAgB,aACd,uBAAuB,QAAQ,cAAc;AAAA,EACjD;AACA,SAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var evaluateFieldWithConditions_exports = {};
|
|
19
|
+
__export(evaluateFieldWithConditions_exports, {
|
|
20
|
+
evaluateFieldWithConditions: () => evaluateFieldWithConditions
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(evaluateFieldWithConditions_exports);
|
|
23
|
+
function evaluateFieldWithConditions(field, variables) {
|
|
24
|
+
const newField = { ...field };
|
|
25
|
+
if (variables) {
|
|
26
|
+
for (const key in variables) {
|
|
27
|
+
if (field.condition[key] && field.condition[key].is) {
|
|
28
|
+
const is = field.condition[key].is;
|
|
29
|
+
if (is === variables[key] || Array.isArray(variables[key]) && variables[key].includes(is)) {
|
|
30
|
+
const then = field.condition[key].then || {};
|
|
31
|
+
for (const attr in then) {
|
|
32
|
+
newField[attr] = then[attr];
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
} else if (field.condition[key]) {
|
|
36
|
+
const otherwise = field.condition[key].else || {};
|
|
37
|
+
for (const attr in otherwise) {
|
|
38
|
+
newField[attr] = otherwise[attr];
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return newField;
|
|
44
|
+
}
|
|
45
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
46
|
+
0 && (module.exports = {
|
|
47
|
+
evaluateFieldWithConditions
|
|
48
|
+
});
|
|
49
|
+
//# sourceMappingURL=evaluateFieldWithConditions.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/Field/utils/evaluateFieldWithConditions.ts"],
|
|
4
|
+
"sourcesContent": ["import { FieldWithCondition, CalculatedField } from '@digigov/form/Field/types';\n\nexport function evaluateFieldWithConditions(\n field: FieldWithCondition,\n variables: FormData\n): CalculatedField {\n const newField = { ...field };\n if (variables) {\n for (const key in variables) {\n if (field.condition[key] && field.condition[key].is) {\n const is = field.condition[key].is;\n if (\n is === variables[key] ||\n (Array.isArray(variables[key]) && variables[key].includes(is))\n ) {\n const then = field.condition[key].then || {};\n for (const attr in then) {\n newField[attr] = then[attr];\n }\n }\n } else if (field.condition[key]) {\n const otherwise = field.condition[key].else || {};\n for (const attr in otherwise) {\n newField[attr] = otherwise[attr];\n }\n }\n }\n }\n return newField;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,SAAS,4BACd,OACA,WACiB;AACjB,QAAM,WAAW,EAAE,GAAG,MAAM;AAC5B,MAAI,WAAW;AACb,eAAW,OAAO,WAAW;AAC3B,UAAI,MAAM,UAAU,GAAG,KAAK,MAAM,UAAU,GAAG,EAAE,IAAI;AACnD,cAAM,KAAK,MAAM,UAAU,GAAG,EAAE;AAChC,YACE,OAAO,UAAU,GAAG,KACnB,MAAM,QAAQ,UAAU,GAAG,CAAC,KAAK,UAAU,GAAG,EAAE,SAAS,EAAE,GAC5D;AACA,gBAAM,OAAO,MAAM,UAAU,GAAG,EAAE,QAAQ,CAAC;AAC3C,qBAAW,QAAQ,MAAM;AACvB,qBAAS,IAAI,IAAI,KAAK,IAAI;AAAA,UAC5B;AAAA,QACF;AAAA,MACF,WAAW,MAAM,UAAU,GAAG,GAAG;AAC/B,cAAM,YAAY,MAAM,UAAU,GAAG,EAAE,QAAQ,CAAC;AAChD,mBAAW,QAAQ,WAAW;AAC5B,mBAAS,IAAI,IAAI,UAAU,IAAI;AAAA,QACjC;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|