@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,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {Field} from "@digigov/form";
|
|
3
|
-
import Questions, {Step, StepForm, StepTitle} from "@digigov/form/Questions";
|
|
2
|
+
import { Field } from "@digigov/form";
|
|
3
|
+
import Questions, { Step, StepForm, StepTitle } from "@digigov/form/Questions";
|
|
4
4
|
import Header from "@digigov/ui/app/Header";
|
|
5
5
|
import HeaderContent from "@digigov/ui/app/Header/HeaderContent";
|
|
6
6
|
import HeaderSection from "@digigov/ui/app/Header/HeaderSection";
|
|
@@ -39,11 +39,11 @@ const steps = [
|
|
|
39
39
|
required: true,
|
|
40
40
|
options: [
|
|
41
41
|
{
|
|
42
|
-
label: {primary: "Yes"},
|
|
42
|
+
label: { primary: "Yes" },
|
|
43
43
|
value: "yes"
|
|
44
44
|
},
|
|
45
45
|
{
|
|
46
|
-
label: {primary: "No"},
|
|
46
|
+
label: { primary: "No" },
|
|
47
47
|
value: "no"
|
|
48
48
|
}
|
|
49
49
|
]
|
|
@@ -61,11 +61,11 @@ const steps = [
|
|
|
61
61
|
required: true,
|
|
62
62
|
options: [
|
|
63
63
|
{
|
|
64
|
-
label: {primary: "Yes"},
|
|
64
|
+
label: { primary: "Yes" },
|
|
65
65
|
value: "yes"
|
|
66
66
|
},
|
|
67
67
|
{
|
|
68
|
-
label: {primary: "No"},
|
|
68
|
+
label: { primary: "No" },
|
|
69
69
|
value: "no"
|
|
70
70
|
}
|
|
71
71
|
]
|
|
@@ -74,38 +74,31 @@ const steps = [
|
|
|
74
74
|
}
|
|
75
75
|
];
|
|
76
76
|
function Default() {
|
|
77
|
-
return /* @__PURE__ */ React.createElement(BasicLayout, null, /* @__PURE__ */ React.createElement(Top, null, /* @__PURE__ */ React.createElement(Header, null, /* @__PURE__ */ React.createElement(HeaderContent, null, /* @__PURE__ */ React.createElement(HeaderSection, null, /* @__PURE__ */ React.createElement(GovGRLogo, {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
name: "age"
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
backButton: "\u03A0\u03AF\u03C3\u03C9"
|
|
103
|
-
}), /* @__PURE__ */ React.createElement(StepForm, {
|
|
104
|
-
submitButton: true
|
|
105
|
-
}, /* @__PURE__ */ React.createElement(Field, {
|
|
106
|
-
key: "citizen-adult-employed",
|
|
107
|
-
name: "citizen-adult-employed"
|
|
108
|
-
})))))), /* @__PURE__ */ React.createElement(Bottom, null, /* @__PURE__ */ React.createElement(GovGRFooter, null)));
|
|
77
|
+
return /* @__PURE__ */ React.createElement(BasicLayout, null, /* @__PURE__ */ React.createElement(Top, null, /* @__PURE__ */ React.createElement(Header, null, /* @__PURE__ */ React.createElement(HeaderContent, null, /* @__PURE__ */ React.createElement(HeaderSection, null, /* @__PURE__ */ React.createElement(GovGRLogo, { href: "#" }))))), /* @__PURE__ */ React.createElement(Container, null, /* @__PURE__ */ React.createElement(Main, null, /* @__PURE__ */ React.createElement(
|
|
78
|
+
Questions,
|
|
79
|
+
{
|
|
80
|
+
name: "example",
|
|
81
|
+
steps,
|
|
82
|
+
onSubmit: (data) => {
|
|
83
|
+
console.log(data);
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
/* @__PURE__ */ React.createElement(Step, { name: "age" }, /* @__PURE__ */ React.createElement(StepTitle, null), /* @__PURE__ */ React.createElement(StepForm, { submitButton: true }, /* @__PURE__ */ React.createElement(Field, { key: "age", name: "age" }))),
|
|
87
|
+
/* @__PURE__ */ React.createElement(Step, { name: "citizen-underage" }, /* @__PURE__ */ React.createElement(StepTitle, null), /* @__PURE__ */ React.createElement(StepForm, { submitButton: true }, /* @__PURE__ */ React.createElement(
|
|
88
|
+
Field,
|
|
89
|
+
{
|
|
90
|
+
key: "citizen-underage-student",
|
|
91
|
+
name: "citizen-underage-student"
|
|
92
|
+
}
|
|
93
|
+
))),
|
|
94
|
+
/* @__PURE__ */ React.createElement(Step, { name: "citizen-adult" }, /* @__PURE__ */ React.createElement(StepTitle, { backButton: "\u03A0\u03AF\u03C3\u03C9" }), /* @__PURE__ */ React.createElement(StepForm, { submitButton: true }, /* @__PURE__ */ React.createElement(
|
|
95
|
+
Field,
|
|
96
|
+
{
|
|
97
|
+
key: "citizen-adult-employed",
|
|
98
|
+
name: "citizen-adult-employed"
|
|
99
|
+
}
|
|
100
|
+
)))
|
|
101
|
+
))), /* @__PURE__ */ React.createElement(Bottom, null, /* @__PURE__ */ React.createElement(GovGRFooter, null)));
|
|
109
102
|
}
|
|
110
103
|
var Default_default = Default;
|
|
111
104
|
export {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function Default(): JSX.Element;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare function Default(): React.JSX.Element;
|
|
3
3
|
export default Default;
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/Questions/__stories__/Default.tsx"],
|
|
4
4
|
"sourcesContent": ["import React from 'react';\nimport { Field } from '@digigov/form';\nimport Questions, { Step, StepForm, StepTitle } from '@digigov/form/Questions';\nimport Header from '@digigov/ui/app/Header';\nimport HeaderContent from '@digigov/ui/app/Header/HeaderContent';\nimport HeaderSection from '@digigov/ui/app/Header/HeaderSection';\nimport GovGRFooter from '@digigov/ui/govgr/Footer';\nimport GovGRLogo from '@digigov/ui/govgr/GovGRLogo';\nimport BasicLayout, {\n Top,\n Container,\n Main,\n Bottom,\n} from '@digigov/ui/layouts/Basic';\n\nconst steps = [\n {\n name: 'age',\n title: 'What is your age?',\n backButton: 'Back',\n fields: [\n {\n key: 'age',\n type: 'int',\n required: true,\n },\n ],\n nextStep: (data) => {\n return data.age > 17 ? 'citizen-adult' : 'citizen-underage';\n },\n },\n {\n name: 'citizen-underage',\n title: 'Are you a student?',\n backButton: 'Back',\n fields: [\n {\n key: 'citizen-underage-student',\n type: 'radio',\n required: true,\n options: [\n {\n label: { primary: 'Yes' },\n value: 'yes',\n },\n {\n label: { primary: 'No' },\n value: 'no',\n },\n ],\n },\n ],\n },\n {\n name: 'citizen-adult',\n title: 'Are you currently employed?',\n backButton: 'Back',\n fields: [\n {\n key: 'citizen-adult-employed',\n type: 'radio',\n required: true,\n options: [\n {\n label: { primary: 'Yes' },\n value: 'yes',\n },\n {\n label: { primary: 'No' },\n value: 'no',\n },\n ],\n },\n ],\n },\n];\n\nexport function Default() {\n return (\n <BasicLayout>\n <Top>\n <Header>\n <HeaderContent>\n <HeaderSection>\n <GovGRLogo href=\"#\" />\n </HeaderSection>\n </HeaderContent>\n </Header>\n </Top>\n <Container>\n <Main>\n <Questions\n name={'example'}\n steps={steps}\n onSubmit={(data) => {\n console.log(data);\n }}\n >\n <Step name=\"age\">\n <StepTitle />\n <StepForm submitButton={true}>\n <Field key=\"age\" name=\"age\" />\n </StepForm>\n </Step>\n <Step name=\"citizen-underage\">\n <StepTitle />\n <StepForm submitButton={true}>\n <Field\n key=\"citizen-underage-student\"\n name=\"citizen-underage-student\"\n />\n </StepForm>\n </Step>\n <Step name=\"citizen-adult\">\n <StepTitle backButton=\"\u03A0\u03AF\u03C3\u03C9\" />\n <StepForm submitButton={true}>\n <Field\n key=\"citizen-adult-employed\"\n name=\"citizen-adult-employed\"\n />\n </StepForm>\n </Step>\n </Questions>\n </Main>\n </Container>\n <Bottom>\n <GovGRFooter />\n </Bottom>\n </BasicLayout>\n );\n}\n\nexport default Default;\n"],
|
|
5
|
-
"mappings": "AAAA;
|
|
5
|
+
"mappings": "AAAA,OAAO,WAAW;AAClB,SAAS,aAAa;AACtB,OAAO,aAAa,MAAM,UAAU,iBAAiB;AACrD,OAAO,YAAY;AACnB,OAAO,mBAAmB;AAC1B,OAAO,mBAAmB;AAC1B,OAAO,iBAAiB;AACxB,OAAO,eAAe;AACtB,OAAO;AAAA,EACL;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,MAAM,QAAQ;AAAA,EACZ;AAAA,IACE,MAAM;AAAA,IACN,OAAO;AAAA,IACP,YAAY;AAAA,IACZ,QAAQ;AAAA,MACN;AAAA,QACE,KAAK;AAAA,QACL,MAAM;AAAA,QACN,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,UAAU,CAAC,SAAS;AAClB,aAAO,KAAK,MAAM,KAAK,kBAAkB;AAAA,IAC3C;AAAA,EACF;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,OAAO;AAAA,IACP,YAAY;AAAA,IACZ,QAAQ;AAAA,MACN;AAAA,QACE,KAAK;AAAA,QACL,MAAM;AAAA,QACN,UAAU;AAAA,QACV,SAAS;AAAA,UACP;AAAA,YACE,OAAO,EAAE,SAAS,MAAM;AAAA,YACxB,OAAO;AAAA,UACT;AAAA,UACA;AAAA,YACE,OAAO,EAAE,SAAS,KAAK;AAAA,YACvB,OAAO;AAAA,UACT;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,OAAO;AAAA,IACP,YAAY;AAAA,IACZ,QAAQ;AAAA,MACN;AAAA,QACE,KAAK;AAAA,QACL,MAAM;AAAA,QACN,UAAU;AAAA,QACV,SAAS;AAAA,UACP;AAAA,YACE,OAAO,EAAE,SAAS,MAAM;AAAA,YACxB,OAAO;AAAA,UACT;AAAA,UACA;AAAA,YACE,OAAO,EAAE,SAAS,KAAK;AAAA,YACvB,OAAO;AAAA,UACT;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAEO,SAAS,UAAU;AACxB,SACE,oCAAC,mBACC,oCAAC,WACC,oCAAC,cACC,oCAAC,qBACC,oCAAC,qBACC,oCAAC,aAAU,MAAK,KAAI,CACtB,CACF,CACF,CACF,GACA,oCAAC,iBACC,oCAAC,YACC;AAAA,IAAC;AAAA;AAAA,MACC,MAAM;AAAA,MACN;AAAA,MACA,UAAU,CAAC,SAAS;AAClB,gBAAQ,IAAI,IAAI;AAAA,MAClB;AAAA;AAAA,IAEA,oCAAC,QAAK,MAAK,SACT,oCAAC,eAAU,GACX,oCAAC,YAAS,cAAc,QACtB,oCAAC,SAAM,KAAI,OAAM,MAAK,OAAM,CAC9B,CACF;AAAA,IACA,oCAAC,QAAK,MAAK,sBACT,oCAAC,eAAU,GACX,oCAAC,YAAS,cAAc,QACtB;AAAA,MAAC;AAAA;AAAA,QACC,KAAI;AAAA,QACJ,MAAK;AAAA;AAAA,IACP,CACF,CACF;AAAA,IACA,oCAAC,QAAK,MAAK,mBACT,oCAAC,aAAU,YAAW,4BAAO,GAC7B,oCAAC,YAAS,cAAc,QACtB;AAAA,MAAC;AAAA;AAAA,QACC,KAAI;AAAA,QACJ,MAAK;AAAA;AAAA,IACP,CACF,CACF;AAAA,EACF,CACF,CACF,GACA,oCAAC,cACC,oCAAC,iBAAY,CACf,CACF;AAEJ;AAEA,IAAO,kBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -5,7 +5,9 @@ function getNextStep(currentStep, steps, data) {
|
|
|
5
5
|
return steps.find((step) => step.name === nextStepName);
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
|
-
const currentStepIndex = steps.findIndex(
|
|
8
|
+
const currentStepIndex = steps.findIndex(
|
|
9
|
+
(step) => step.name === currentStep.name
|
|
10
|
+
);
|
|
9
11
|
const nextStep = steps.slice(currentStepIndex + 1).find((step) => {
|
|
10
12
|
if (step.show) {
|
|
11
13
|
return step.show(data);
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Questions/getNextStep.tsx"],
|
|
4
4
|
"sourcesContent": ["import { StepInterface } from '@digigov/form/Questions/Step/types';\n\nexport function getNextStep(\n currentStep: any,\n steps: any[],\n data: any\n): StepInterface | null {\n if (currentStep.nextStep) {\n const nextStepName = currentStep.nextStep(data);\n if (nextStepName) {\n return steps.find((step) => step.name === nextStepName);\n }\n }\n const currentStepIndex = steps.findIndex(\n (step) => step.name === currentStep.name\n );\n const nextStep = steps.slice(currentStepIndex + 1).find((step) => {\n if (step.show) {\n return step.show(data);\n }\n return true;\n });\n return nextStep;\n}\n"],
|
|
5
|
-
"mappings": "AAEO,
|
|
5
|
+
"mappings": "AAEO,SAAS,YACd,aACA,OACA,MACsB;AACtB,MAAI,YAAY,UAAU;AACxB,UAAM,eAAe,YAAY,SAAS,IAAI;AAC9C,QAAI,cAAc;AAChB,aAAO,MAAM,KAAK,CAAC,SAAS,KAAK,SAAS,YAAY;AAAA,IACxD;AAAA,EACF;AACA,QAAM,mBAAmB,MAAM;AAAA,IAC7B,CAAC,SAAS,KAAK,SAAS,YAAY;AAAA,EACtC;AACA,QAAM,WAAW,MAAM,MAAM,mBAAmB,CAAC,EAAE,KAAK,CAAC,SAAS;AAChE,QAAI,KAAK,MAAM;AACb,aAAO,KAAK,KAAK,IAAI;AAAA,IACvB;AACA,WAAO;AAAA,EACT,CAAC;AACD,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/Questions/index.js
CHANGED
package/Questions/index.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Questions/index.tsx"],
|
|
4
4
|
"sourcesContent": ["import { Questions } from '@digigov/form/Questions/Questions';\n\nexport default Questions;\n\nexport * from '@digigov/form/Questions/Step';\n"],
|
|
5
|
-
"mappings": "AAAA;
|
|
5
|
+
"mappings": "AAAA,SAAS,iBAAiB;AAE1B,IAAO,oBAAQ;AAEf,cAAc;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/Questions/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { StepInterface } from '@digigov/form/Questions/Step/types';
|
|
2
3
|
export interface QuestionsInterface {
|
|
3
4
|
name: string;
|
|
@@ -9,6 +10,7 @@ export interface QuestionsInterface {
|
|
|
9
10
|
initialData?: any;
|
|
10
11
|
localDraft?: boolean;
|
|
11
12
|
errorLabels?: Record<string, string>;
|
|
13
|
+
children?: React.ReactNode;
|
|
12
14
|
}
|
|
13
15
|
export interface QuestionsContextInterface {
|
|
14
16
|
currentStep: StepInterface;
|
|
@@ -1,32 +1,38 @@
|
|
|
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 FieldBase_exports = {};
|
|
29
|
+
__export(FieldBase_exports, {
|
|
25
30
|
FieldBase: () => FieldBase
|
|
26
31
|
});
|
|
27
|
-
|
|
28
|
-
var
|
|
29
|
-
var
|
|
32
|
+
module.exports = __toCommonJS(FieldBase_exports);
|
|
33
|
+
var import_react = __toESM(require("react"));
|
|
34
|
+
var import_react_hook_form = require("react-hook-form");
|
|
35
|
+
var import_FieldBaseContainer = __toESM(require("@digigov/form/Field/FieldBaseContainer"));
|
|
30
36
|
const FieldBase = (props) => {
|
|
31
37
|
const {
|
|
32
38
|
required,
|
|
@@ -50,62 +56,83 @@ const FieldBase = (props) => {
|
|
|
50
56
|
return null;
|
|
51
57
|
}
|
|
52
58
|
if (controlled) {
|
|
53
|
-
return /* @__PURE__ */ import_react.default.createElement(
|
|
59
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
60
|
+
import_FieldBaseContainer.default,
|
|
61
|
+
{
|
|
62
|
+
label,
|
|
63
|
+
layout,
|
|
64
|
+
error,
|
|
65
|
+
wrapper,
|
|
66
|
+
name
|
|
67
|
+
},
|
|
68
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
69
|
+
import_react_hook_form.Controller,
|
|
70
|
+
{
|
|
71
|
+
control,
|
|
72
|
+
name,
|
|
73
|
+
render: ({ field }) => {
|
|
74
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
75
|
+
Component,
|
|
76
|
+
{
|
|
77
|
+
...field,
|
|
78
|
+
ref: void 0,
|
|
79
|
+
defaultValue,
|
|
80
|
+
extra,
|
|
81
|
+
error: !!error,
|
|
82
|
+
type,
|
|
83
|
+
"aria-required": !!required,
|
|
84
|
+
"aria-describedby": error && `${name}-error`,
|
|
85
|
+
required,
|
|
86
|
+
disabled: editable === false,
|
|
87
|
+
...componentProps
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
)
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
96
|
+
import_FieldBaseContainer.default,
|
|
97
|
+
{
|
|
54
98
|
label,
|
|
55
99
|
layout,
|
|
56
100
|
error,
|
|
57
101
|
wrapper,
|
|
58
102
|
name
|
|
59
|
-
},
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
disabled: editable === false,
|
|
74
|
-
...componentProps
|
|
75
|
-
});
|
|
103
|
+
},
|
|
104
|
+
Component?.render ? /* @__PURE__ */ import_react.default.createElement(
|
|
105
|
+
Component,
|
|
106
|
+
{
|
|
107
|
+
...register(name),
|
|
108
|
+
control,
|
|
109
|
+
error: !!error,
|
|
110
|
+
extra,
|
|
111
|
+
type,
|
|
112
|
+
"aria-required": !!required,
|
|
113
|
+
"aria-describedby": error && `${name}-error`,
|
|
114
|
+
required,
|
|
115
|
+
disabled: editable === false,
|
|
116
|
+
...componentProps
|
|
76
117
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
...componentProps
|
|
96
|
-
}) : /* @__PURE__ */ import_react.default.createElement(Component, {
|
|
97
|
-
...register(name),
|
|
98
|
-
register,
|
|
99
|
-
control,
|
|
100
|
-
error: !!error,
|
|
101
|
-
extra,
|
|
102
|
-
type,
|
|
103
|
-
"aria-required": !!required,
|
|
104
|
-
"aria-describedby": error && `${name}-error`,
|
|
105
|
-
required,
|
|
106
|
-
disabled: editable === false,
|
|
107
|
-
...componentProps
|
|
108
|
-
}));
|
|
118
|
+
) : /* @__PURE__ */ import_react.default.createElement(
|
|
119
|
+
Component,
|
|
120
|
+
{
|
|
121
|
+
...register(name),
|
|
122
|
+
register,
|
|
123
|
+
control,
|
|
124
|
+
error: !!error,
|
|
125
|
+
extra,
|
|
126
|
+
type,
|
|
127
|
+
"aria-required": !!required,
|
|
128
|
+
"aria-describedby": error && `${name}-error`,
|
|
129
|
+
required,
|
|
130
|
+
disabled: editable === false,
|
|
131
|
+
ref: void 0,
|
|
132
|
+
...componentProps
|
|
133
|
+
}
|
|
134
|
+
)
|
|
135
|
+
);
|
|
109
136
|
};
|
|
110
137
|
// Annotate the CommonJS export names for ESM import in node:
|
|
111
138
|
0 && (module.exports = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/Field/FieldBase.tsx"],
|
|
4
|
-
"sourcesContent": ["import React from 'react';\nimport { Controller } from 'react-hook-form';\nimport FieldBaseContainer from '@digigov/form/Field/FieldBaseContainer';\nimport { FieldBaseProps } from '@digigov/form/Field/types';\n\nexport const FieldBase: React.FC<FieldBaseProps> = (props) => {\n const {\n required,\n name,\n component: Component,\n wrapper,\n control,\n type,\n controlled = false,\n enabled = true,\n editable,\n defaultValue,\n label,\n extra = {},\n layout,\n error,\n register,\n ...componentProps\n } = props;\n if (!enabled) {\n return null;\n }\n if (controlled) {\n return (\n <FieldBaseContainer\n label={label}\n layout={layout}\n error={error}\n wrapper={wrapper}\n name={name}\n >\n <Controller\n control={control}\n name={name}\n render={({ field }) => {\n return (\n <Component\n {...field}\n ref={undefined}\n defaultValue={defaultValue}\n extra={extra}\n error={!!error}\n type={type}\n aria-required={!!required}\n aria-describedby={error && `${name}-error`}\n required={required}\n disabled={editable === false}\n {...componentProps}\n />\n );\n }}\n />\n </FieldBaseContainer>\n );\n }\n\n return (\n <FieldBaseContainer\n label={label}\n layout={layout}\n error={error}\n wrapper={wrapper}\n name={name}\n >\n {Component?.render ? (\n <Component\n {...register(name)}\n control={control}\n error={!!error}\n extra={extra}\n type={type}\n aria-required={!!required}\n aria-describedby={error && `${name}-error`}\n required={required}\n disabled={editable === false}\n {...componentProps}\n />\n ) : (\n <Component\n {...register(name)}\n register={register}\n control={control}\n error={!!error}\n extra={extra}\n type={type}\n aria-required={!!required}\n aria-describedby={error && `${name}-error`}\n required={required}\n disabled={editable === false}\n {...componentProps}\n />\n )}\n </FieldBaseContainer>\n );\n};\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": []
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport { Controller } from 'react-hook-form';\nimport FieldBaseContainer from '@digigov/form/Field/FieldBaseContainer';\nimport { FieldBaseProps } from '@digigov/form/Field/types';\n\nexport const FieldBase: React.FC<FieldBaseProps> = (props) => {\n const {\n required,\n name,\n component: Component,\n wrapper,\n control,\n type,\n controlled = false,\n enabled = true,\n editable,\n defaultValue,\n label,\n extra = {},\n layout,\n error,\n register,\n ...componentProps\n } = props;\n if (!enabled) {\n return null;\n }\n if (controlled) {\n return (\n <FieldBaseContainer\n label={label}\n layout={layout}\n error={error}\n wrapper={wrapper}\n name={name}\n >\n <Controller\n control={control}\n name={name}\n render={({ field }) => {\n return (\n <Component\n {...field}\n ref={undefined}\n defaultValue={defaultValue}\n extra={extra}\n error={!!error}\n type={type}\n aria-required={!!required}\n aria-describedby={error && `${name}-error`}\n required={required}\n disabled={editable === false}\n {...componentProps}\n />\n );\n }}\n />\n </FieldBaseContainer>\n );\n }\n\n return (\n <FieldBaseContainer\n label={label}\n layout={layout}\n error={error}\n wrapper={wrapper}\n name={name}\n >\n {Component?.render ? (\n <Component\n {...register(name)}\n control={control}\n error={!!error}\n extra={extra}\n type={type}\n aria-required={!!required}\n aria-describedby={error && `${name}-error`}\n required={required}\n disabled={editable === false}\n {...componentProps}\n />\n ) : (\n <Component\n {...register(name)}\n register={register}\n control={control}\n error={!!error}\n extra={extra}\n type={type}\n aria-required={!!required}\n aria-describedby={error && `${name}-error`}\n required={required}\n disabled={editable === false}\n ref={undefined}\n {...componentProps}\n />\n )}\n </FieldBaseContainer>\n );\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAClB,6BAA2B;AAC3B,gCAA+B;AAGxB,MAAM,YAAsC,CAAC,UAAU;AAC5D,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,WAAW;AAAA,IACX;AAAA,IACA;AAAA,IACA;AAAA,IACA,aAAa;AAAA,IACb,UAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA,QAAQ,CAAC;AAAA,IACT;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,IAAI;AACJ,MAAI,CAAC,SAAS;AACZ,WAAO;AAAA,EACT;AACA,MAAI,YAAY;AACd,WACE,6BAAAA,QAAA;AAAA,MAAC,0BAAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA;AAAA,MAEA,6BAAAD,QAAA;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA,QAAQ,CAAC,EAAE,MAAM,MAAM;AACrB,mBACE,6BAAAA,QAAA;AAAA,cAAC;AAAA;AAAA,gBACE,GAAG;AAAA,gBACJ,KAAK;AAAA,gBACL;AAAA,gBACA;AAAA,gBACA,OAAO,CAAC,CAAC;AAAA,gBACT;AAAA,gBACA,iBAAe,CAAC,CAAC;AAAA,gBACjB,oBAAkB,SAAS,GAAG,IAAI;AAAA,gBAClC;AAAA,gBACA,UAAU,aAAa;AAAA,gBACtB,GAAG;AAAA;AAAA,YACN;AAAA,UAEJ;AAAA;AAAA,MACF;AAAA,IACF;AAAA,EAEJ;AAEA,SACE,6BAAAA,QAAA;AAAA,IAAC,0BAAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,IAEC,WAAW,SACV,6BAAAD,QAAA;AAAA,MAAC;AAAA;AAAA,QACE,GAAG,SAAS,IAAI;AAAA,QACjB;AAAA,QACA,OAAO,CAAC,CAAC;AAAA,QACT;AAAA,QACA;AAAA,QACA,iBAAe,CAAC,CAAC;AAAA,QACjB,oBAAkB,SAAS,GAAG,IAAI;AAAA,QAClC;AAAA,QACA,UAAU,aAAa;AAAA,QACtB,GAAG;AAAA;AAAA,IACN,IAEA,6BAAAA,QAAA;AAAA,MAAC;AAAA;AAAA,QACE,GAAG,SAAS,IAAI;AAAA,QACjB;AAAA,QACA;AAAA,QACA,OAAO,CAAC,CAAC;AAAA,QACT;AAAA,QACA;AAAA,QACA,iBAAe,CAAC,CAAC;AAAA,QACjB,oBAAkB,SAAS,GAAG,IAAI;AAAA,QAClC;AAAA,QACA,UAAU,aAAa;AAAA,QACvB,KAAK;AAAA,QACJ,GAAG;AAAA;AAAA,IACN;AAAA,EAEJ;AAEJ;",
|
|
6
|
+
"names": ["React", "FieldBaseContainer"]
|
|
7
7
|
}
|
|
@@ -1,39 +1,45 @@
|
|
|
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 FieldBaseContainer_exports = {};
|
|
29
|
+
__export(FieldBaseContainer_exports, {
|
|
25
30
|
FieldBaseContainer: () => FieldBaseContainer,
|
|
26
31
|
default: () => FieldBaseContainer_default
|
|
27
32
|
});
|
|
28
|
-
|
|
29
|
-
var
|
|
30
|
-
var
|
|
31
|
-
var
|
|
32
|
-
var
|
|
33
|
-
var
|
|
34
|
-
var
|
|
35
|
-
var
|
|
36
|
-
var
|
|
33
|
+
module.exports = __toCommonJS(FieldBaseContainer_exports);
|
|
34
|
+
var import_react = __toESM(require("react"));
|
|
35
|
+
var import_Label = __toESM(require("@digigov/form/inputs/Label"));
|
|
36
|
+
var import_ErrorMessage = __toESM(require("@digigov/react-core/ErrorMessage"));
|
|
37
|
+
var import_FieldContainer = __toESM(require("@digigov/react-core/FieldContainer"));
|
|
38
|
+
var import_Fieldset = __toESM(require("@digigov/react-core/Fieldset"));
|
|
39
|
+
var import_FieldsetLegend = __toESM(require("@digigov/react-core/FieldsetLegend"));
|
|
40
|
+
var import_Hint = __toESM(require("@digigov/react-core/Hint"));
|
|
41
|
+
var import_LabelContainer = __toESM(require("@digigov/react-core/LabelContainer"));
|
|
42
|
+
var import_i18n = require("@digigov/ui/i18n");
|
|
37
43
|
const FieldBaseContainer = ({
|
|
38
44
|
name,
|
|
39
45
|
wrapper,
|
|
@@ -42,27 +48,13 @@ const FieldBaseContainer = ({
|
|
|
42
48
|
error,
|
|
43
49
|
layout
|
|
44
50
|
}) => {
|
|
45
|
-
const {t} = (0, import_i18n.useTranslation)();
|
|
51
|
+
const { t } = (0, import_i18n.useTranslation)();
|
|
46
52
|
const errorMessage = error?.message.key ? error.message.key : error?.message || "";
|
|
47
53
|
const errorContext = error?.message.context || {};
|
|
48
54
|
if (wrapper === "fieldset") {
|
|
49
|
-
return /* @__PURE__ */ import_react.default.createElement(import_FieldContainer.default, {
|
|
50
|
-
error: !!error,
|
|
51
|
-
...layout
|
|
52
|
-
}, /* @__PURE__ */ import_react.default.createElement(import_Fieldset.default, null, /* @__PURE__ */ import_react.default.createElement(import_FieldsetLegend.default, {
|
|
53
|
-
size: "sm"
|
|
54
|
-
}, label && label.primary), label && label.secondary && /* @__PURE__ */ import_react.default.createElement(import_Hint.default, null, t(label.secondary)), error && /* @__PURE__ */ import_react.default.createElement(import_ErrorMessage.default, {
|
|
55
|
-
id: `${name}-error`
|
|
56
|
-
}, t(errorMessage, errorContext)), children));
|
|
55
|
+
return /* @__PURE__ */ import_react.default.createElement(import_FieldContainer.default, { error: !!error, ...layout }, /* @__PURE__ */ import_react.default.createElement(import_Fieldset.default, null, /* @__PURE__ */ import_react.default.createElement(import_FieldsetLegend.default, { size: "sm" }, label && label.primary), label && label.secondary && /* @__PURE__ */ import_react.default.createElement(import_Hint.default, null, t(label.secondary)), error && /* @__PURE__ */ import_react.default.createElement(import_ErrorMessage.default, { id: `${name}-error` }, t(errorMessage, errorContext)), children));
|
|
57
56
|
} else {
|
|
58
|
-
return /* @__PURE__ */ import_react.default.createElement(import_FieldContainer.default, {
|
|
59
|
-
error: !!error,
|
|
60
|
-
...layout
|
|
61
|
-
}, /* @__PURE__ */ import_react.default.createElement(import_LabelContainer.default, null, label && /* @__PURE__ */ import_react.default.createElement(import_Label.default, {
|
|
62
|
-
label
|
|
63
|
-
}), error && /* @__PURE__ */ import_react.default.createElement(import_ErrorMessage.default, {
|
|
64
|
-
id: `${name}-error`
|
|
65
|
-
}, t(errorMessage, errorContext)), children));
|
|
57
|
+
return /* @__PURE__ */ import_react.default.createElement(import_FieldContainer.default, { error: !!error, ...layout }, /* @__PURE__ */ import_react.default.createElement(import_LabelContainer.default, null, label && /* @__PURE__ */ import_react.default.createElement(import_Label.default, { label }), error && /* @__PURE__ */ import_react.default.createElement(import_ErrorMessage.default, { id: `${name}-error` }, t(errorMessage, errorContext)), children));
|
|
66
58
|
}
|
|
67
59
|
};
|
|
68
60
|
var FieldBaseContainer_default = FieldBaseContainer;
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/Field/FieldBaseContainer.tsx"],
|
|
4
4
|
"sourcesContent": ["import React from 'react';\nimport { FieldContainerProps } from '@digigov/form/Field/types';\nimport Label from '@digigov/form/inputs/Label';\nimport ErrorMessage from '@digigov/react-core/ErrorMessage';\nimport FieldContainer from '@digigov/react-core/FieldContainer';\nimport CoreFieldset from '@digigov/react-core/Fieldset';\nimport FieldsetLegend from '@digigov/react-core/FieldsetLegend';\nimport Hint from '@digigov/react-core/Hint';\nimport LabelContainer from '@digigov/react-core/LabelContainer';\nimport { useTranslation } from '@digigov/ui/i18n';\n\nexport const FieldBaseContainer: React.FC<FieldContainerProps> = ({\n name,\n wrapper,\n label,\n children,\n error,\n layout,\n}) => {\n const { t } = useTranslation();\n const errorMessage = error?.message.key\n ? error.message.key\n : error?.message || '';\n const errorContext = error?.message.context || {};\n if (wrapper === 'fieldset') {\n return (\n <FieldContainer error={!!error} {...layout}>\n <CoreFieldset>\n <FieldsetLegend size=\"sm\">{label && label.primary}</FieldsetLegend>\n {label && label.secondary && <Hint>{t(label.secondary)}</Hint>}\n {error && (\n <ErrorMessage id={`${name}-error`}>\n {t(errorMessage, errorContext)}\n </ErrorMessage>\n )}\n {children}\n </CoreFieldset>\n </FieldContainer>\n );\n } else {\n return (\n <FieldContainer error={!!error} {...layout}>\n <LabelContainer>\n {label && <Label label={label} />}\n {error && (\n <ErrorMessage id={`${name}-error`}>\n {t(errorMessage, errorContext)}\n </ErrorMessage>\n )}\n {children}\n </LabelContainer>\n </FieldContainer>\n );\n }\n};\n\nexport default FieldBaseContainer;\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAElB,mBAAkB;AAClB,0BAAyB;AACzB,4BAA2B;AAC3B,sBAAyB;AACzB,4BAA2B;AAC3B,kBAAiB;AACjB,4BAA2B;AAC3B,kBAA+B;AAExB,MAAM,qBAAoD,CAAC;AAAA,EAChE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,EAAE,EAAE,QAAI,4BAAe;AAC7B,QAAM,eAAe,OAAO,QAAQ,MAChC,MAAM,QAAQ,MACd,OAAO,WAAW;AACtB,QAAM,eAAe,OAAO,QAAQ,WAAW,CAAC;AAChD,MAAI,YAAY,YAAY;AAC1B,WACE,6BAAAA,QAAA,cAAC,sBAAAC,SAAA,EAAe,OAAO,CAAC,CAAC,OAAQ,GAAG,UAClC,6BAAAD,QAAA,cAAC,gBAAAE,SAAA,MACC,6BAAAF,QAAA,cAAC,sBAAAG,SAAA,EAAe,MAAK,QAAM,SAAS,MAAM,OAAQ,GACjD,SAAS,MAAM,aAAa,6BAAAH,QAAA,cAAC,YAAAI,SAAA,MAAM,EAAE,MAAM,SAAS,CAAE,GACtD,SACC,6BAAAJ,QAAA,cAAC,oBAAAK,SAAA,EAAa,IAAI,GAAG,IAAI,YACtB,EAAE,cAAc,YAAY,CAC/B,GAED,QACH,CACF;AAAA,EAEJ,OAAO;AACL,WACE,6BAAAL,QAAA,cAAC,sBAAAC,SAAA,EAAe,OAAO,CAAC,CAAC,OAAQ,GAAG,UAClC,6BAAAD,QAAA,cAAC,sBAAAM,SAAA,MACE,SAAS,6BAAAN,QAAA,cAAC,aAAAO,SAAA,EAAM,OAAc,GAC9B,SACC,6BAAAP,QAAA,cAAC,oBAAAK,SAAA,EAAa,IAAI,GAAG,IAAI,YACtB,EAAE,cAAc,YAAY,CAC/B,GAED,QACH,CACF;AAAA,EAEJ;AACF;AAEA,IAAO,6BAAQ;",
|
|
6
|
+
"names": ["React", "FieldContainer", "CoreFieldset", "FieldsetLegend", "Hint", "ErrorMessage", "LabelContainer", "Label"]
|
|
7
7
|
}
|