@digigov/form 1.0.0-8ae63a77 → 1.0.0-8b33e4c8
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.js +14 -31
- package/Field/FieldBaseContainer.js +19 -41
- package/Field/FieldConditional.js +14 -33
- package/Field/index.js +18 -45
- package/Field/package.json +6 -0
- package/Field/types.js +1 -5
- package/Field/utils.js +30 -63
- package/FieldArray/FieldArray.stories.js +5 -42
- package/FieldArray/__stories__/Default.js +11 -32
- package/FieldArray/__stories__/WithExactLength.js +11 -32
- package/FieldArray/index.js +19 -41
- package/FieldArray/package.json +6 -0
- package/FieldObject/index.js +16 -41
- package/FieldObject/package.json +6 -0
- package/Fieldset/FieldsetWithContext.js +13 -35
- package/Fieldset/index.js +21 -51
- package/Fieldset/package.json +6 -0
- package/Fieldset/types.js +1 -5
- package/Form.stories.js +2 -9
- package/FormBuilder/FormBuilder.js +33 -62
- package/FormBuilder/FormBuilder.stories.js +4 -28
- package/FormBuilder/__stories__/Default.js +8 -29
- package/FormBuilder/index.js +2 -11
- package/FormBuilder/package.json +6 -0
- package/FormContext.js +3 -12
- package/MultiplicityField/MultiplicityField.stories.js +9 -98
- package/MultiplicityField/__stories__/Default.js +11 -32
- package/MultiplicityField/__stories__/PreviewDisplay.js +29 -52
- package/MultiplicityField/__stories__/WithExactLength.js +11 -32
- package/MultiplicityField/__stories__/WithMaxLength.js +11 -32
- package/MultiplicityField/__stories__/WithMinAndMaxLength.js +11 -32
- package/MultiplicityField/__stories__/WithMinLength.js +11 -32
- package/MultiplicityField/add-objects.js +25 -49
- package/MultiplicityField/index.js +26 -55
- package/MultiplicityField/package.json +6 -0
- package/Questions/Questions.js +14 -35
- package/Questions/Questions.stories.js +4 -28
- package/Questions/QuestionsContext.js +3 -12
- package/Questions/Step/ReviewStep.js +21 -47
- package/Questions/Step/Step.js +18 -42
- package/Questions/Step/StepArrayReview.js +23 -52
- package/Questions/Step/StepContext.js +3 -13
- package/Questions/Step/StepDescription.js +14 -42
- package/Questions/Step/StepForm.js +19 -45
- package/Questions/Step/StepQuote.js +8 -23
- package/Questions/Step/StepTitle.js +17 -48
- package/Questions/Step/getAddMoreFields.js +2 -11
- package/Questions/Step/index.js +13 -170
- package/Questions/Step/package.json +6 -0
- package/Questions/Step/types.js +1 -5
- package/Questions/__stories__/Default.js +24 -51
- package/Questions/getNextStep.js +1 -8
- package/Questions/index.js +3 -25
- package/Questions/index.spec.js +12 -23
- package/Questions/package.json +6 -0
- package/Questions/types.js +1 -5
- package/{es → cjs}/Field/FieldBase.js +31 -14
- package/cjs/Field/FieldBaseContainer.js +65 -0
- package/cjs/Field/FieldConditional.js +81 -0
- package/cjs/Field/index.js +103 -0
- package/cjs/Field/types.js +5 -0
- package/{es → cjs}/Field/utils.js +63 -30
- package/cjs/FieldArray/FieldArray.stories.js +45 -0
- package/cjs/FieldArray/__stories__/Default.js +111 -0
- package/cjs/FieldArray/__stories__/WithExactLength.js +111 -0
- package/cjs/FieldArray/index.js +87 -0
- package/cjs/FieldObject/index.js +83 -0
- package/cjs/Fieldset/FieldsetWithContext.js +63 -0
- package/cjs/Fieldset/index.js +64 -0
- package/cjs/Fieldset/types.js +5 -0
- package/cjs/Form.stories.js +10 -0
- package/{esm → cjs}/FormBuilder/FormBuilder.js +62 -33
- package/cjs/FormBuilder/FormBuilder.stories.js +31 -0
- package/cjs/FormBuilder/__stories__/Default.js +49 -0
- package/cjs/FormBuilder/index.js +11 -0
- package/cjs/FormContext.js +14 -0
- package/cjs/MultiplicityField/MultiplicityField.stories.js +101 -0
- package/{es → cjs}/MultiplicityField/__stories__/Default.js +32 -11
- package/cjs/MultiplicityField/__stories__/PreviewDisplay.js +106 -0
- package/{esm → cjs}/MultiplicityField/__stories__/WithExactLength.js +32 -11
- package/{es → cjs}/MultiplicityField/__stories__/WithMaxLength.js +32 -11
- package/{es → cjs}/MultiplicityField/__stories__/WithMinAndMaxLength.js +32 -11
- package/{esm → cjs}/MultiplicityField/__stories__/WithMinLength.js +32 -11
- package/{esm → cjs}/MultiplicityField/add-objects.js +49 -25
- package/cjs/MultiplicityField/index.js +143 -0
- package/cjs/Questions/Questions.js +105 -0
- package/cjs/Questions/Questions.stories.js +31 -0
- package/cjs/Questions/QuestionsContext.js +20 -0
- package/cjs/Questions/Step/ReviewStep.js +79 -0
- package/cjs/Questions/Step/Step.js +93 -0
- package/cjs/Questions/Step/StepArrayReview.js +79 -0
- package/{esm → cjs}/Questions/Step/StepContext.js +13 -3
- package/cjs/Questions/Step/StepDescription.js +55 -0
- package/cjs/Questions/Step/StepForm.js +74 -0
- package/cjs/Questions/Step/StepQuote.js +26 -0
- package/cjs/Questions/Step/StepTitle.js +75 -0
- package/{es → cjs}/Questions/Step/getAddMoreFields.js +11 -2
- package/cjs/Questions/Step/index.js +170 -0
- package/cjs/Questions/Step/types.js +5 -0
- package/cjs/Questions/__stories__/Default.js +135 -0
- package/{es → cjs}/Questions/getNextStep.js +8 -1
- package/cjs/Questions/index.js +25 -0
- package/cjs/Questions/index.spec.js +73 -0
- package/cjs/Questions/types.js +5 -0
- package/cjs/index.js +28 -0
- package/cjs/inputs/AutoComplete/AutoComplete.stories.js +31 -0
- package/cjs/inputs/AutoComplete/__stories__/Default.js +71 -0
- package/cjs/inputs/AutoComplete/index.js +68 -0
- package/cjs/inputs/Checkboxes/Checkboxes.stories.js +59 -0
- package/{es → cjs}/inputs/Checkboxes/__stories__/Conditional.js +28 -8
- package/cjs/inputs/Checkboxes/__stories__/Default.js +62 -0
- package/cjs/inputs/Checkboxes/__stories__/WithDivider.js +63 -0
- package/cjs/inputs/Checkboxes/index.js +127 -0
- package/cjs/inputs/DateInput/DateInput.stories.js +31 -0
- package/cjs/inputs/DateInput/__stories__/Default.js +45 -0
- package/cjs/inputs/DateInput/index.js +181 -0
- package/cjs/inputs/FileInput/FileInput.stories.js +31 -0
- package/cjs/inputs/FileInput/__stories__/Default.js +42 -0
- package/cjs/inputs/FileInput/index.js +92 -0
- package/cjs/inputs/Input/Input.stories.js +143 -0
- package/cjs/inputs/Input/__stories__/AFM.js +44 -0
- package/cjs/inputs/Input/__stories__/Boolean.js +45 -0
- package/cjs/inputs/Input/__stories__/Default.js +45 -0
- package/cjs/inputs/Input/__stories__/IBAN.js +45 -0
- package/cjs/inputs/Input/__stories__/Integer.js +53 -0
- package/cjs/inputs/Input/__stories__/MobilePhone.js +44 -0
- package/cjs/inputs/Input/__stories__/PhoneNumber.js +44 -0
- package/cjs/inputs/Input/__stories__/PostalCode.js +47 -0
- package/cjs/inputs/Input/__stories__/TextWithCharacterLimit.js +51 -0
- package/cjs/inputs/Input/index.js +96 -0
- package/cjs/inputs/Label/Label.stories.js +31 -0
- package/cjs/inputs/Label/__stories__/Default.js +49 -0
- package/cjs/inputs/Label/index.js +41 -0
- package/cjs/inputs/OtpInput/OtpInput.stories.js +31 -0
- package/cjs/inputs/OtpInput/__stories__/Default.js +52 -0
- package/cjs/inputs/OtpInput/index.js +182 -0
- package/cjs/inputs/Radio/Radio.stories.js +59 -0
- package/{es → cjs}/inputs/Radio/__stories__/Conditional.js +28 -8
- package/cjs/inputs/Radio/__stories__/Default.js +67 -0
- package/cjs/inputs/Radio/__stories__/WithDivider.js +68 -0
- package/cjs/inputs/Radio/index.js +82 -0
- package/cjs/inputs/Select/Select.stories.js +31 -0
- package/cjs/inputs/Select/__stories__/Default.js +73 -0
- package/cjs/inputs/Select/index.js +49 -0
- package/cjs/inputs/index.js +71 -0
- package/cjs/internal.js +391 -0
- package/cjs/registry.js +208 -0
- package/cjs/types.js +5 -0
- package/{es → cjs}/utils.js +26 -12
- package/{es → cjs}/validators/index.js +54 -26
- package/cjs/validators/types.js +5 -0
- package/{es → cjs}/validators/utils/afm.js +13 -3
- package/{es → cjs}/validators/utils/file.js +12 -2
- package/{esm → cjs}/validators/utils/iban.js +13 -2
- package/cjs/validators/utils/index.js +229 -0
- package/{es → cjs}/validators/utils/int.js +14 -3
- package/cjs/validators/utils/number.js +27 -0
- package/{esm → cjs}/validators/utils/otp.js +14 -3
- package/{esm → cjs}/validators/utils/phone.js +28 -6
- package/{es → cjs}/validators/utils/postal_code.js +14 -3
- package/{esm → cjs}/validators/utils/text_limit.js +14 -3
- package/{es → cjs}/validators/utils/uuid4.js +13 -3
- package/cjs/validators/validators.spec.js +88 -0
- package/index.js +8 -28
- package/inputs/AutoComplete/AutoComplete.stories.js +4 -28
- package/inputs/AutoComplete/__stories__/Default.js +13 -35
- package/inputs/AutoComplete/index.js +12 -35
- package/inputs/AutoComplete/package.json +6 -0
- package/inputs/Checkboxes/Checkboxes.stories.js +6 -56
- package/inputs/Checkboxes/__stories__/Conditional.js +8 -28
- package/inputs/Checkboxes/__stories__/Default.js +8 -28
- package/inputs/Checkboxes/__stories__/WithDivider.js +8 -28
- package/inputs/Checkboxes/index.js +25 -52
- package/inputs/Checkboxes/package.json +6 -0
- package/inputs/DateInput/DateInput.stories.js +4 -28
- package/inputs/DateInput/__stories__/Default.js +8 -28
- package/inputs/DateInput/index.js +26 -52
- package/inputs/DateInput/package.json +6 -0
- package/inputs/FileInput/FileInput.stories.js +4 -28
- package/inputs/FileInput/__stories__/Default.js +8 -28
- package/inputs/FileInput/index.js +22 -52
- package/inputs/FileInput/package.json +6 -0
- package/inputs/Input/Input.stories.js +12 -140
- package/inputs/Input/__stories__/AFM.js +8 -28
- package/inputs/Input/__stories__/Boolean.js +8 -28
- package/inputs/Input/__stories__/Default.js +8 -28
- package/inputs/Input/__stories__/IBAN.js +8 -28
- package/inputs/Input/__stories__/Integer.js +9 -29
- package/inputs/Input/__stories__/MobilePhone.js +8 -28
- package/inputs/Input/__stories__/PhoneNumber.js +8 -28
- package/inputs/Input/__stories__/PostalCode.js +8 -28
- package/inputs/Input/__stories__/TextWithCharacterLimit.js +8 -28
- package/inputs/Input/index.js +19 -40
- package/inputs/Input/package.json +6 -0
- package/inputs/Label/Label.stories.js +4 -28
- package/inputs/Label/__stories__/Default.js +9 -29
- package/inputs/Label/index.js +9 -25
- package/inputs/Label/package.json +6 -0
- package/inputs/OtpInput/OtpInput.stories.js +4 -28
- package/inputs/OtpInput/__stories__/Default.js +9 -30
- package/inputs/OtpInput/index.js +28 -53
- package/inputs/OtpInput/package.json +6 -0
- package/inputs/Radio/Radio.stories.js +6 -56
- package/inputs/Radio/__stories__/Conditional.js +8 -28
- package/inputs/Radio/__stories__/Default.js +8 -28
- package/inputs/Radio/__stories__/WithDivider.js +8 -28
- package/inputs/Radio/index.js +24 -45
- package/inputs/Radio/package.json +6 -0
- package/inputs/Select/Select.stories.js +4 -28
- package/inputs/Select/__stories__/Default.js +8 -28
- package/inputs/Select/index.js +12 -29
- package/inputs/Select/package.json +6 -0
- package/inputs/index.js +8 -71
- package/inputs/package.json +6 -0
- package/internal.js +34 -391
- package/package.json +6 -6
- package/registry.js +61 -133
- package/types.js +1 -5
- package/utils.js +12 -26
- package/validators/index.js +26 -54
- package/validators/package.json +6 -0
- package/validators/types.js +1 -5
- package/validators/utils/afm.js +3 -13
- package/validators/utils/file.js +2 -12
- package/validators/utils/iban.js +2 -13
- package/validators/utils/index.js +12 -139
- package/validators/utils/int.js +3 -14
- package/validators/utils/number.js +3 -14
- package/validators/utils/otp.js +3 -14
- package/validators/utils/package.json +6 -0
- package/validators/utils/phone.js +6 -28
- package/validators/utils/postal_code.js +3 -14
- package/validators/utils/text_limit.js +3 -14
- package/validators/utils/uuid4.js +3 -13
- package/validators/validators.spec.js +29 -32
- package/es/Field/FieldBaseContainer.js +0 -43
- package/es/Field/FieldConditional.js +0 -62
- package/es/Field/index.js +0 -76
- package/es/Field/types.js +0 -1
- package/es/FieldArray/FieldArray.stories.js +0 -8
- package/es/FieldArray/__stories__/Default.js +0 -90
- package/es/FieldArray/__stories__/WithExactLength.js +0 -90
- package/es/FieldArray/index.js +0 -65
- package/es/FieldObject/index.js +0 -58
- package/es/Fieldset/FieldsetWithContext.js +0 -41
- package/es/Fieldset/index.js +0 -34
- package/es/Fieldset/types.js +0 -1
- package/es/Form.stories.js +0 -3
- package/es/FormBuilder/FormBuilder.js +0 -160
- package/es/FormBuilder/FormBuilder.stories.js +0 -7
- package/es/FormBuilder/__stories__/Default.js +0 -28
- package/es/FormBuilder/index.js +0 -2
- package/es/FormContext.js +0 -5
- package/es/MultiplicityField/MultiplicityField.stories.js +0 -12
- package/es/MultiplicityField/__stories__/PreviewDisplay.js +0 -83
- package/es/MultiplicityField/__stories__/WithExactLength.js +0 -92
- package/es/MultiplicityField/__stories__/WithMinLength.js +0 -95
- package/es/MultiplicityField/add-objects.js +0 -160
- package/es/MultiplicityField/index.js +0 -114
- package/es/Questions/Questions.js +0 -84
- package/es/Questions/Questions.stories.js +0 -7
- package/es/Questions/QuestionsContext.js +0 -11
- package/es/Questions/Step/ReviewStep.js +0 -53
- package/es/Questions/Step/Step.js +0 -69
- package/es/Questions/Step/StepArrayReview.js +0 -50
- package/es/Questions/Step/StepContext.js +0 -27
- package/es/Questions/Step/StepDescription.js +0 -27
- package/es/Questions/Step/StepForm.js +0 -48
- package/es/Questions/Step/StepQuote.js +0 -11
- package/es/Questions/Step/StepTitle.js +0 -44
- package/es/Questions/Step/index.js +0 -13
- package/es/Questions/Step/types.js +0 -1
- package/es/Questions/__stories__/Default.js +0 -108
- package/es/Questions/index.js +0 -3
- package/es/Questions/index.spec.js +0 -62
- package/es/Questions/types.js +0 -1
- package/es/index.js +0 -3
- package/es/inputs/AutoComplete/AutoComplete.stories.js +0 -7
- package/es/inputs/AutoComplete/__stories__/Default.js +0 -49
- package/es/inputs/AutoComplete/index.js +0 -45
- package/es/inputs/Checkboxes/Checkboxes.stories.js +0 -9
- package/es/inputs/Checkboxes/__stories__/Default.js +0 -42
- package/es/inputs/Checkboxes/__stories__/WithDivider.js +0 -43
- package/es/inputs/Checkboxes/index.js +0 -100
- package/es/inputs/DateInput/DateInput.stories.js +0 -7
- package/es/inputs/DateInput/__stories__/Default.js +0 -25
- package/es/inputs/DateInput/index.js +0 -155
- package/es/inputs/FileInput/FileInput.stories.js +0 -7
- package/es/inputs/FileInput/__stories__/Default.js +0 -22
- package/es/inputs/FileInput/index.js +0 -62
- package/es/inputs/Input/Input.stories.js +0 -15
- package/es/inputs/Input/__stories__/AFM.js +0 -24
- package/es/inputs/Input/__stories__/Boolean.js +0 -25
- package/es/inputs/Input/__stories__/Default.js +0 -25
- package/es/inputs/Input/__stories__/IBAN.js +0 -25
- package/es/inputs/Input/__stories__/Integer.js +0 -33
- package/es/inputs/Input/__stories__/MobilePhone.js +0 -24
- package/es/inputs/Input/__stories__/PhoneNumber.js +0 -24
- package/es/inputs/Input/__stories__/PostalCode.js +0 -27
- package/es/inputs/Input/__stories__/TextWithCharacterLimit.js +0 -31
- package/es/inputs/Input/index.js +0 -75
- package/es/inputs/Label/Label.stories.js +0 -7
- package/es/inputs/Label/__stories__/Default.js +0 -29
- package/es/inputs/Label/index.js +0 -25
- package/es/inputs/OtpInput/OtpInput.stories.js +0 -7
- package/es/inputs/OtpInput/__stories__/Default.js +0 -31
- package/es/inputs/OtpInput/index.js +0 -157
- package/es/inputs/Radio/Radio.stories.js +0 -9
- package/es/inputs/Radio/__stories__/Default.js +0 -47
- package/es/inputs/Radio/__stories__/WithDivider.js +0 -48
- package/es/inputs/Radio/index.js +0 -61
- package/es/inputs/Select/Select.stories.js +0 -7
- package/es/inputs/Select/__stories__/Default.js +0 -53
- package/es/inputs/Select/index.js +0 -32
- package/es/inputs/index.js +0 -8
- package/es/internal.js +0 -34
- package/es/registry.js +0 -136
- package/es/types.js +0 -1
- package/es/validators/types.js +0 -1
- package/es/validators/utils/iban.js +0 -123
- package/es/validators/utils/index.js +0 -102
- package/es/validators/utils/number.js +0 -16
- package/es/validators/utils/otp.js +0 -26
- package/es/validators/utils/phone.js +0 -122
- package/es/validators/utils/text_limit.js +0 -54
- package/es/validators/validators.spec.js +0 -85
- package/esm/Field/FieldBase.js +0 -84
- package/esm/Field/FieldBaseContainer.js +0 -43
- package/esm/Field/FieldConditional.js +0 -62
- package/esm/Field/index.js +0 -76
- package/esm/Field/index.mdx +0 -6
- package/esm/Field/types.js +0 -1
- package/esm/Field/utils.js +0 -162
- package/esm/FieldArray/FieldArray.stories.js +0 -8
- package/esm/FieldArray/FieldArray.stories.playwright.json +0 -353
- package/esm/FieldArray/__stories__/Default.js +0 -90
- package/esm/FieldArray/__stories__/WithExactLength.js +0 -90
- package/esm/FieldArray/index.js +0 -65
- package/esm/FieldObject/index.js +0 -58
- package/esm/Fieldset/FieldsetWithContext.js +0 -41
- package/esm/Fieldset/index.js +0 -34
- package/esm/Fieldset/types.js +0 -1
- package/esm/Form.stories.js +0 -3
- package/esm/FormBuilder/FormBuilder.mdx +0 -256
- package/esm/FormBuilder/FormBuilder.stories.js +0 -7
- package/esm/FormBuilder/FormBuilder.stories.playwright.json +0 -52
- package/esm/FormBuilder/__stories__/Default.js +0 -28
- package/esm/FormBuilder/index.js +0 -2
- package/esm/FormContext.js +0 -5
- package/esm/MultiplicityField/MultiplicityField.mdx +0 -590
- package/esm/MultiplicityField/MultiplicityField.stories.js +0 -12
- package/esm/MultiplicityField/MultiplicityField.stories.playwright.json +0 -1370
- package/esm/MultiplicityField/__stories__/Default.js +0 -97
- package/esm/MultiplicityField/__stories__/PreviewDisplay.js +0 -83
- package/esm/MultiplicityField/__stories__/WithMaxLength.js +0 -95
- package/esm/MultiplicityField/__stories__/WithMinAndMaxLength.js +0 -96
- package/esm/MultiplicityField/index.js +0 -114
- package/esm/Questions/Questions.js +0 -84
- package/esm/Questions/Questions.stories.js +0 -7
- package/esm/Questions/QuestionsContext.js +0 -11
- package/esm/Questions/Step/ReviewStep.js +0 -53
- package/esm/Questions/Step/Step.js +0 -69
- package/esm/Questions/Step/StepArrayReview.js +0 -50
- package/esm/Questions/Step/StepDescription.js +0 -27
- package/esm/Questions/Step/StepForm.js +0 -48
- package/esm/Questions/Step/StepQuote.js +0 -11
- package/esm/Questions/Step/StepTitle.js +0 -44
- package/esm/Questions/Step/getAddMoreFields.js +0 -22
- package/esm/Questions/Step/index.js +0 -13
- package/esm/Questions/Step/types.js +0 -1
- package/esm/Questions/__snapshots__/index.spec.tsx.snap +0 -596
- package/esm/Questions/__stories__/Default.js +0 -108
- package/esm/Questions/getNextStep.js +0 -23
- package/esm/Questions/index.js +0 -3
- package/esm/Questions/index.mdx +0 -415
- package/esm/Questions/index.spec.js +0 -62
- package/esm/Questions/types.js +0 -1
- package/esm/create-simple-form.mdx +0 -539
- package/esm/index.js +0 -8
- package/esm/index.mdx +0 -51
- package/esm/inputs/AutoComplete/AutoComplete.stories.js +0 -7
- package/esm/inputs/AutoComplete/__stories__/Default.js +0 -49
- package/esm/inputs/AutoComplete/index.js +0 -45
- package/esm/inputs/Checkboxes/Checkboxes.stories.js +0 -9
- package/esm/inputs/Checkboxes/Checkboxes.stories.playwright.json +0 -85
- package/esm/inputs/Checkboxes/__stories__/Conditional.js +0 -95
- package/esm/inputs/Checkboxes/__stories__/Default.js +0 -42
- package/esm/inputs/Checkboxes/__stories__/WithDivider.js +0 -43
- package/esm/inputs/Checkboxes/index.js +0 -100
- package/esm/inputs/Checkboxes/index.mdx +0 -0
- package/esm/inputs/DateInput/DateInput.stories.js +0 -7
- package/esm/inputs/DateInput/DateInput.stories.playwright.json +0 -72
- package/esm/inputs/DateInput/__stories__/Default.js +0 -25
- package/esm/inputs/DateInput/index.js +0 -155
- package/esm/inputs/FileInput/FileInput.stories.js +0 -7
- package/esm/inputs/FileInput/FileInput.stories.playwright.json +0 -75
- package/esm/inputs/FileInput/__stories__/Default.js +0 -22
- package/esm/inputs/FileInput/index.js +0 -62
- package/esm/inputs/Input/Input.stories.js +0 -15
- package/esm/inputs/Input/Input.stories.playwright.json +0 -376
- package/esm/inputs/Input/__stories__/AFM.js +0 -24
- package/esm/inputs/Input/__stories__/Boolean.js +0 -25
- package/esm/inputs/Input/__stories__/Default.js +0 -25
- package/esm/inputs/Input/__stories__/IBAN.js +0 -25
- package/esm/inputs/Input/__stories__/Integer.js +0 -33
- package/esm/inputs/Input/__stories__/MobilePhone.js +0 -24
- package/esm/inputs/Input/__stories__/PhoneNumber.js +0 -24
- package/esm/inputs/Input/__stories__/PostalCode.js +0 -27
- package/esm/inputs/Input/__stories__/TextWithCharacterLimit.js +0 -31
- package/esm/inputs/Input/index.js +0 -75
- package/esm/inputs/Input/index.mdx +0 -8
- package/esm/inputs/Label/Label.stories.js +0 -7
- package/esm/inputs/Label/Label.stories.playwright.json +0 -40
- package/esm/inputs/Label/__stories__/Default.js +0 -29
- package/esm/inputs/Label/index.js +0 -25
- package/esm/inputs/Label/index.mdx +0 -0
- package/esm/inputs/OtpInput/OtpInput.stories.js +0 -7
- package/esm/inputs/OtpInput/__stories__/Default.js +0 -31
- package/esm/inputs/OtpInput/index.js +0 -157
- package/esm/inputs/Radio/Radio.stories.js +0 -9
- package/esm/inputs/Radio/Radio.stories.playwright.json +0 -73
- package/esm/inputs/Radio/__stories__/Conditional.js +0 -95
- package/esm/inputs/Radio/__stories__/Default.js +0 -47
- package/esm/inputs/Radio/__stories__/WithDivider.js +0 -48
- package/esm/inputs/Radio/index.js +0 -61
- package/esm/inputs/Radio/index.mdx +0 -0
- package/esm/inputs/Select/Select.stories.js +0 -7
- package/esm/inputs/Select/Select.stories.playwright.json +0 -22
- package/esm/inputs/Select/__stories__/Default.js +0 -53
- package/esm/inputs/Select/index.js +0 -32
- package/esm/inputs/index.js +0 -8
- package/esm/installation.mdx +0 -68
- package/esm/internal.js +0 -34
- package/esm/registry.js +0 -136
- package/esm/types.js +0 -1
- package/esm/utils.js +0 -99
- package/esm/validators/index.js +0 -186
- package/esm/validators/types.js +0 -1
- package/esm/validators/utils/afm.js +0 -35
- package/esm/validators/utils/file.js +0 -52
- package/esm/validators/utils/index.js +0 -102
- package/esm/validators/utils/int.js +0 -20
- package/esm/validators/utils/number.js +0 -16
- package/esm/validators/utils/postal_code.js +0 -29
- package/esm/validators/utils/uuid4.js +0 -20
- package/esm/validators/validators.spec.js +0 -85
- /package/{es → cjs}/Field/index.mdx +0 -0
- /package/{es → cjs}/FieldArray/FieldArray.stories.playwright.json +0 -0
- /package/{es → cjs}/FormBuilder/FormBuilder.mdx +0 -0
- /package/{es → cjs}/FormBuilder/FormBuilder.stories.playwright.json +0 -0
- /package/{es → cjs}/MultiplicityField/MultiplicityField.mdx +0 -0
- /package/{es → cjs}/MultiplicityField/MultiplicityField.stories.playwright.json +0 -0
- /package/{es → cjs}/Questions/__snapshots__/index.spec.tsx.snap +0 -0
- /package/{es → cjs}/Questions/index.mdx +0 -0
- /package/{es → cjs}/create-simple-form.mdx +0 -0
- /package/{es → cjs}/index.mdx +0 -0
- /package/{es → cjs}/inputs/Checkboxes/Checkboxes.stories.playwright.json +0 -0
- /package/{es → cjs}/inputs/Checkboxes/index.mdx +0 -0
- /package/{es → cjs}/inputs/DateInput/DateInput.stories.playwright.json +0 -0
- /package/{es → cjs}/inputs/FileInput/FileInput.stories.playwright.json +0 -0
- /package/{es → cjs}/inputs/Input/Input.stories.playwright.json +0 -0
- /package/{es → cjs}/inputs/Input/index.mdx +0 -0
- /package/{es → cjs}/inputs/Label/Label.stories.playwright.json +0 -0
- /package/{es → cjs}/inputs/Label/index.mdx +0 -0
- /package/{es → cjs}/inputs/Radio/Radio.stories.playwright.json +0 -0
- /package/{es → cjs}/inputs/Radio/index.mdx +0 -0
- /package/{es → cjs}/inputs/Select/Select.stories.playwright.json +0 -0
- /package/{es → cjs}/installation.mdx +0 -0
|
@@ -1,26 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(exports, "__esModule", {
|
|
8
|
-
value: true
|
|
9
|
-
});
|
|
10
|
-
exports.WithMinLength = void 0;
|
|
11
|
-
|
|
12
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
-
|
|
14
|
-
var _react = _interopRequireDefault(require("react"));
|
|
15
|
-
|
|
16
|
-
var _form = _interopRequireWildcard(require("@digigov/form"));
|
|
17
|
-
|
|
18
|
-
var _Button = require("@digigov/ui/form/Button");
|
|
19
|
-
|
|
20
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
21
|
-
|
|
22
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
23
|
-
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import FormBuilder, { Field } from "../..";
|
|
4
|
+
import { Button } from '@digigov/ui/form/Button';
|
|
24
5
|
var fields = [{
|
|
25
6
|
key: 'string',
|
|
26
7
|
type: 'string',
|
|
@@ -95,22 +76,20 @@ var fields = [{
|
|
|
95
76
|
}
|
|
96
77
|
}];
|
|
97
78
|
|
|
98
|
-
var _ref = /*#__PURE__*/
|
|
79
|
+
var _ref = /*#__PURE__*/React.createElement(Button, {
|
|
99
80
|
type: "submit"
|
|
100
81
|
}, "\u03A3\u03C5\u03BD\u03AD\u03C7\u03B5\u03B9\u03B1");
|
|
101
82
|
|
|
102
|
-
var WithMinLength = function WithMinLength() {
|
|
103
|
-
return /*#__PURE__*/
|
|
83
|
+
export var WithMinLength = function WithMinLength() {
|
|
84
|
+
return /*#__PURE__*/React.createElement(FormBuilder, {
|
|
104
85
|
onSubmit: function onSubmit(data) {
|
|
105
86
|
console.log(data);
|
|
106
87
|
}
|
|
107
|
-
}, /*#__PURE__*/
|
|
88
|
+
}, /*#__PURE__*/React.createElement(Field, _extends({
|
|
108
89
|
name: "string"
|
|
109
|
-
}, fields[0])), /*#__PURE__*/
|
|
90
|
+
}, fields[0])), /*#__PURE__*/React.createElement(Field, _extends({
|
|
110
91
|
name: "multiplicity"
|
|
111
|
-
}, fields[1])), /*#__PURE__*/
|
|
92
|
+
}, fields[1])), /*#__PURE__*/React.createElement(Field, _extends({
|
|
112
93
|
name: "phonenumber"
|
|
113
94
|
}, fields[2])), _ref);
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
exports.WithMinLength = WithMinLength;
|
|
95
|
+
};
|
|
@@ -1,41 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(exports, "__esModule", {
|
|
8
|
-
value: true
|
|
9
|
-
});
|
|
10
|
-
exports["default"] = exports.AddObjects = void 0;
|
|
11
|
-
|
|
12
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
-
|
|
14
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
15
|
-
|
|
16
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
17
|
-
|
|
18
|
-
var _reactHookForm = require("react-hook-form");
|
|
19
|
-
|
|
20
|
-
var _FieldBase = require("@digigov/form/Field/FieldBase");
|
|
21
|
-
|
|
22
|
-
var _utils = require("@digigov/form/Field/utils");
|
|
23
|
-
|
|
24
|
-
var _FieldObject = _interopRequireDefault(require("@digigov/form/FieldObject"));
|
|
25
|
-
|
|
26
|
-
var _Fieldset = _interopRequireDefault(require("@digigov/react-core/Fieldset"));
|
|
27
|
-
|
|
28
|
-
var _RadioConditional = _interopRequireDefault(require("@digigov/react-core/RadioConditional"));
|
|
29
|
-
|
|
30
|
-
var _Button = _interopRequireDefault(require("@digigov/ui/form/Button"));
|
|
31
|
-
|
|
32
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
33
|
-
|
|
34
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
1
|
+
import _typeof from "@babel/runtime/helpers/typeof";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
35
4
|
|
|
36
5
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
37
6
|
|
|
38
|
-
|
|
7
|
+
/* eslint-disable react/prop-types */
|
|
8
|
+
import React, { useEffect, useMemo } from 'react'; // import { FormBuilderProps } from '@digigov/form';
|
|
9
|
+
|
|
10
|
+
import { useWatch } from 'react-hook-form';
|
|
11
|
+
import { FieldBase } from "../Field/FieldBase";
|
|
12
|
+
import { calculateField, useField } from "../Field/utils";
|
|
13
|
+
import FieldObject from "../FieldObject";
|
|
14
|
+
import Fieldset from '@digigov/react-core/Fieldset';
|
|
15
|
+
import RadioConditional from '@digigov/react-core/RadioConditional';
|
|
16
|
+
import Button from '@digigov/ui/form/Button';
|
|
17
|
+
export var AddObjects = function AddObjects(_ref) {
|
|
39
18
|
var name = _ref.name,
|
|
40
19
|
fields = _ref.fields,
|
|
41
20
|
formState = _ref.formState,
|
|
@@ -73,9 +52,9 @@ var AddObjects = function AddObjects(_ref) {
|
|
|
73
52
|
},
|
|
74
53
|
value: 'yes',
|
|
75
54
|
selected: function RadioSelected() {
|
|
76
|
-
return /*#__PURE__*/
|
|
55
|
+
return /*#__PURE__*/React.createElement(RadioConditional, {
|
|
77
56
|
hidden: needsMore !== 'yes' || (extra === null || extra === void 0 ? void 0 : extra.max) && (extra === null || extra === void 0 ? void 0 : extra.max) - stashedObjects.length === 0
|
|
78
|
-
}, needsMore === 'yes' && fields.length > 0 && /*#__PURE__*/
|
|
57
|
+
}, needsMore === 'yes' && fields.length > 0 && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FieldObject, _extends({
|
|
79
58
|
name: currentName,
|
|
80
59
|
error: error && error[currentIndex],
|
|
81
60
|
register: register,
|
|
@@ -83,10 +62,10 @@ var AddObjects = function AddObjects(_ref) {
|
|
|
83
62
|
control: control
|
|
84
63
|
}, extra === null || extra === void 0 ? void 0 : extra.of, {
|
|
85
64
|
label: (extra === null || extra === void 0 ? void 0 : extra.label.question.objectLabel) || (extra === null || extra === void 0 ? void 0 : extra.of.label)
|
|
86
|
-
})), /*#__PURE__*/
|
|
65
|
+
})), /*#__PURE__*/React.createElement(Button, {
|
|
87
66
|
color: "secondary",
|
|
88
67
|
onClick: /*#__PURE__*/function () {
|
|
89
|
-
var _ref2 = (
|
|
68
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(e) {
|
|
90
69
|
var nestedFields, result;
|
|
91
70
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
92
71
|
while (1) {
|
|
@@ -127,21 +106,21 @@ var AddObjects = function AddObjects(_ref) {
|
|
|
127
106
|
}
|
|
128
107
|
};
|
|
129
108
|
|
|
130
|
-
var _useField =
|
|
109
|
+
var _useField = useField(radioField.key, radioField !== null && radioField !== void 0 && radioField.type ? radioField : null),
|
|
131
110
|
field = _useField.field,
|
|
132
111
|
control = _useField.control,
|
|
133
112
|
register = _useField.register,
|
|
134
113
|
reset = _useField.reset,
|
|
135
114
|
needsMoreError = _useField.error;
|
|
136
115
|
|
|
137
|
-
var calculatedField =
|
|
138
|
-
return
|
|
116
|
+
var calculatedField = useMemo(function () {
|
|
117
|
+
return calculateField(children, field);
|
|
139
118
|
}, [field]);
|
|
140
|
-
var needsMore =
|
|
119
|
+
var needsMore = useWatch({
|
|
141
120
|
name: field.key,
|
|
142
121
|
control: control
|
|
143
122
|
});
|
|
144
|
-
|
|
123
|
+
useEffect(function () {
|
|
145
124
|
if (needsMore === 'yes') {
|
|
146
125
|
append({
|
|
147
126
|
afm: '',
|
|
@@ -170,7 +149,7 @@ var AddObjects = function AddObjects(_ref) {
|
|
|
170
149
|
calculatedField.label.secondary = " \u0388\u03C7\u03B5\u03C4\u03B5 \u03C0\u03C1\u03BF\u03C3\u03B8\u03AD\u03C3\u03B5\u03B9 ".concat(stashedObjects.length, " \u03B5\u03B3\u03B3\u03C1\u03B1\u03C6\u03AD\u03C2 \u03BA\u03B1\u03B9 \u03C3\u03B1\u03C2 \u03B1\u03C0\u03BF\u03BC\u03AD\u03BD\u03BF\u03C5\u03BD ").concat(extra.max - stashedObjects.length, " \u03B5\u03C0\u03B9\u03C0\u03BB\u03AD\u03BF\u03BD \u03B5\u03B3\u03B3\u03C1\u03B1\u03C6\u03AD\u03C2.");
|
|
171
150
|
}
|
|
172
151
|
|
|
173
|
-
return /*#__PURE__*/
|
|
152
|
+
return /*#__PURE__*/React.createElement(Fieldset, null, /*#__PURE__*/React.createElement(FieldBase, _extends({}, calculatedField, {
|
|
174
153
|
name: calculatedField.key,
|
|
175
154
|
control: control,
|
|
176
155
|
register: register,
|
|
@@ -178,7 +157,4 @@ var AddObjects = function AddObjects(_ref) {
|
|
|
178
157
|
error: (extra === null || extra === void 0 ? void 0 : extra.max) - stashedObjects.length === 0 || (extra === null || extra === void 0 ? void 0 : extra.length) - stashedObjects.length === 0 ? error : needsMoreError
|
|
179
158
|
})));
|
|
180
159
|
};
|
|
181
|
-
|
|
182
|
-
exports.AddObjects = AddObjects;
|
|
183
|
-
var _default = AddObjects;
|
|
184
|
-
exports["default"] = _default;
|
|
160
|
+
export default AddObjects;
|
|
@@ -1,38 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
exports["default"] = exports.Multiplicity = exports.ListObject = void 0;
|
|
11
|
-
|
|
12
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
-
|
|
14
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
15
|
-
|
|
16
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
17
|
-
|
|
18
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
19
|
-
|
|
20
|
-
var _reactHookForm = require("react-hook-form");
|
|
21
|
-
|
|
22
|
-
var _FieldBaseContainer = _interopRequireDefault(require("@digigov/form/Field/FieldBaseContainer"));
|
|
23
|
-
|
|
24
|
-
var _FieldObject = _interopRequireDefault(require("@digigov/form/FieldObject"));
|
|
25
|
-
|
|
26
|
-
var _addObjects = _interopRequireDefault(require("@digigov/form/MultiplicityField/add-objects"));
|
|
27
|
-
|
|
28
|
-
var _reactCore = require("@digigov/react-core");
|
|
29
|
-
|
|
30
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
31
|
-
|
|
32
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
33
|
-
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
|
+
import React, { useState } from 'react';
|
|
5
|
+
import { useFieldArray } from 'react-hook-form';
|
|
6
|
+
import FieldContainer from "../Field/FieldBaseContainer";
|
|
7
|
+
import FieldObject from "../FieldObject";
|
|
8
|
+
import AddObjects from "./add-objects";
|
|
9
|
+
import { Card, CardContent, CardAction, Button, Heading, CardHeading } from '@digigov/react-core';
|
|
34
10
|
// epeidh einai forwardRef to ref mas to dinei xwrista apo ta props
|
|
35
|
-
var Multiplicity = function Multiplicity(_ref) {
|
|
11
|
+
export var Multiplicity = function Multiplicity(_ref) {
|
|
36
12
|
var extra = _ref.extra,
|
|
37
13
|
name = _ref.name,
|
|
38
14
|
control = _ref.control,
|
|
@@ -47,7 +23,7 @@ var Multiplicity = function Multiplicity(_ref) {
|
|
|
47
23
|
getValues = _ref.getValues,
|
|
48
24
|
unregister = _ref.unregister;
|
|
49
25
|
|
|
50
|
-
var _useFieldArray =
|
|
26
|
+
var _useFieldArray = useFieldArray({
|
|
51
27
|
control: control,
|
|
52
28
|
name: name
|
|
53
29
|
}),
|
|
@@ -55,33 +31,34 @@ var Multiplicity = function Multiplicity(_ref) {
|
|
|
55
31
|
append = _useFieldArray.append,
|
|
56
32
|
remove = _useFieldArray.remove;
|
|
57
33
|
|
|
58
|
-
var _useState =
|
|
59
|
-
_useState2 = (
|
|
34
|
+
var _useState = useState([]),
|
|
35
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
60
36
|
stashedObjects = _useState2[0],
|
|
61
37
|
setStashedObjects = _useState2[1];
|
|
62
38
|
|
|
63
39
|
var handleStash = function handleStash(data) {
|
|
64
|
-
setStashedObjects([].concat((
|
|
40
|
+
setStashedObjects([].concat(_toConsumableArray(stashedObjects), [data]));
|
|
65
41
|
};
|
|
66
42
|
|
|
67
43
|
var handleDelete = function handleDelete(index) {
|
|
68
44
|
remove(index); // creating a new array to maintain immutability
|
|
69
45
|
|
|
70
|
-
var newStashedObjects = (
|
|
46
|
+
var newStashedObjects = _toConsumableArray(stashedObjects);
|
|
47
|
+
|
|
71
48
|
newStashedObjects.splice(index, 1);
|
|
72
49
|
setStashedObjects(newStashedObjects);
|
|
73
50
|
};
|
|
74
51
|
|
|
75
|
-
return /*#__PURE__*/
|
|
52
|
+
return /*#__PURE__*/React.createElement(FieldContainer, {
|
|
76
53
|
label: label,
|
|
77
54
|
layout: layout,
|
|
78
55
|
error: formState.isSubmitted && !formState.isSubmitting && error !== null && error !== void 0 && error.message ? error : undefined,
|
|
79
56
|
wrapper: "fieldset",
|
|
80
57
|
name: name
|
|
81
|
-
}, stashedObjects.length > 0 ? /*#__PURE__*/
|
|
58
|
+
}, stashedObjects.length > 0 ? /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Heading, {
|
|
82
59
|
size: "md"
|
|
83
60
|
}, extra === null || extra === void 0 ? void 0 : extra.label.object.title_added), stashedObjects.map(function (_Object, index) {
|
|
84
|
-
return /*#__PURE__*/
|
|
61
|
+
return /*#__PURE__*/React.createElement(ListObject, {
|
|
85
62
|
key: "".concat(name, ".").concat(index),
|
|
86
63
|
index: index,
|
|
87
64
|
name: name,
|
|
@@ -91,7 +68,7 @@ var Multiplicity = function Multiplicity(_ref) {
|
|
|
91
68
|
formState: formState,
|
|
92
69
|
onDelete: handleDelete
|
|
93
70
|
});
|
|
94
|
-
})) : '', /*#__PURE__*/
|
|
71
|
+
})) : '', /*#__PURE__*/React.createElement(AddObjects, {
|
|
95
72
|
name: name,
|
|
96
73
|
register: register,
|
|
97
74
|
control: control,
|
|
@@ -110,12 +87,8 @@ var Multiplicity = function Multiplicity(_ref) {
|
|
|
110
87
|
clearErrors: clearErrors
|
|
111
88
|
}));
|
|
112
89
|
};
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
var _default = Multiplicity;
|
|
116
|
-
exports["default"] = _default;
|
|
117
|
-
|
|
118
|
-
var ListObject = function ListObject(_ref2) {
|
|
90
|
+
export default Multiplicity;
|
|
91
|
+
export var ListObject = function ListObject(_ref2) {
|
|
119
92
|
var index = _ref2.index,
|
|
120
93
|
name = _ref2.name,
|
|
121
94
|
extra = _ref2.extra,
|
|
@@ -124,20 +97,18 @@ var ListObject = function ListObject(_ref2) {
|
|
|
124
97
|
onDelete = _ref2.onDelete,
|
|
125
98
|
formState = _ref2.formState;
|
|
126
99
|
var currentName = "".concat(name, ".").concat(index);
|
|
127
|
-
return /*#__PURE__*/
|
|
100
|
+
return /*#__PURE__*/React.createElement(Card, {
|
|
128
101
|
variant: (extra === null || extra === void 0 ? void 0 : extra.border) && 'border'
|
|
129
|
-
}, /*#__PURE__*/
|
|
102
|
+
}, /*#__PURE__*/React.createElement(CardHeading, null, extra === null || extra === void 0 ? void 0 : extra.label.object.title, " #", index + 1), /*#__PURE__*/React.createElement(CardContent, null, /*#__PURE__*/React.createElement(FieldObject, _extends({
|
|
130
103
|
name: currentName,
|
|
131
104
|
formState: formState,
|
|
132
105
|
register: register,
|
|
133
106
|
control: control
|
|
134
|
-
}, extra === null || extra === void 0 ? void 0 : extra.of))), /*#__PURE__*/
|
|
107
|
+
}, extra === null || extra === void 0 ? void 0 : extra.of))), /*#__PURE__*/React.createElement(CardAction, null, /*#__PURE__*/React.createElement(Button, {
|
|
135
108
|
type: "button",
|
|
136
109
|
variant: "link",
|
|
137
110
|
onClick: function onClick() {
|
|
138
111
|
return onDelete(index);
|
|
139
112
|
}
|
|
140
113
|
}, extra === null || extra === void 0 ? void 0 : extra.label.object["delete"])));
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
exports.ListObject = ListObject;
|
|
114
|
+
};
|
package/Questions/Questions.js
CHANGED
|
@@ -1,26 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(exports, "__esModule", {
|
|
8
|
-
value: true
|
|
9
|
-
});
|
|
10
|
-
exports.Questions = void 0;
|
|
11
|
-
|
|
12
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
|
-
|
|
14
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
15
|
-
|
|
16
|
-
var _getNextStep = require("@digigov/form/Questions/getNextStep");
|
|
17
|
-
|
|
18
|
-
var _QuestionsContext = require("@digigov/form/Questions/QuestionsContext");
|
|
19
|
-
|
|
20
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
21
|
-
|
|
22
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
23
|
-
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import React, { useState, useEffect } from 'react';
|
|
3
|
+
import { getNextStep } from "./getNextStep";
|
|
4
|
+
import { QuestionsContext } from "./QuestionsContext";
|
|
24
5
|
var isBrowser = typeof window !== 'undefined';
|
|
25
6
|
/**
|
|
26
7
|
* The Question component accepts question data as props
|
|
@@ -28,7 +9,7 @@ var isBrowser = typeof window !== 'undefined';
|
|
|
28
9
|
*
|
|
29
10
|
*/
|
|
30
11
|
|
|
31
|
-
var Questions = function Questions(_ref) {
|
|
12
|
+
export var Questions = function Questions(_ref) {
|
|
32
13
|
var name = _ref.name,
|
|
33
14
|
steps = _ref.steps,
|
|
34
15
|
_ref$initialData = _ref.initialData,
|
|
@@ -41,19 +22,19 @@ var Questions = function Questions(_ref) {
|
|
|
41
22
|
localDraft = _ref$localDraft === void 0 ? false : _ref$localDraft,
|
|
42
23
|
children = _ref.children;
|
|
43
24
|
|
|
44
|
-
var _useState =
|
|
25
|
+
var _useState = useState({
|
|
45
26
|
name: ''
|
|
46
27
|
}),
|
|
47
|
-
_useState2 = (
|
|
28
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
48
29
|
currentStep = _useState2[0],
|
|
49
30
|
setCurrentStep = _useState2[1];
|
|
50
31
|
|
|
51
|
-
|
|
32
|
+
useEffect(function () {
|
|
52
33
|
if (!forceStepName) {
|
|
53
34
|
setCurrentStep(steps[0]);
|
|
54
35
|
}
|
|
55
36
|
}, [forceStepName, steps]);
|
|
56
|
-
|
|
37
|
+
useEffect(function () {
|
|
57
38
|
if (forceStepName !== currentStep.name) {
|
|
58
39
|
var forceStep = steps.find(function (_ref2) {
|
|
59
40
|
var name = _ref2.name;
|
|
@@ -64,8 +45,8 @@ var Questions = function Questions(_ref) {
|
|
|
64
45
|
}, [forceStepName]);
|
|
65
46
|
var localData = isBrowser && localDraft && window.localStorage.getItem("questions-".concat(name));
|
|
66
47
|
|
|
67
|
-
var _useState3 =
|
|
68
|
-
_useState4 = (
|
|
48
|
+
var _useState3 = useState(localData && JSON.parse(localData) || initialData),
|
|
49
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
69
50
|
data = _useState4[0],
|
|
70
51
|
setData = _useState4[1];
|
|
71
52
|
|
|
@@ -81,7 +62,7 @@ var Questions = function Questions(_ref) {
|
|
|
81
62
|
}
|
|
82
63
|
|
|
83
64
|
setData(data);
|
|
84
|
-
var nextStep =
|
|
65
|
+
var nextStep = getNextStep(currentStep, steps, data);
|
|
85
66
|
|
|
86
67
|
if (nextStep) {
|
|
87
68
|
onActiveStep && onActiveStep(nextStep);
|
|
@@ -91,7 +72,7 @@ var Questions = function Questions(_ref) {
|
|
|
91
72
|
}
|
|
92
73
|
};
|
|
93
74
|
|
|
94
|
-
return /*#__PURE__*/
|
|
75
|
+
return /*#__PURE__*/React.createElement(QuestionsContext.Provider, {
|
|
95
76
|
value: {
|
|
96
77
|
steps: steps,
|
|
97
78
|
currentStep: currentStep,
|
|
@@ -100,6 +81,4 @@ var Questions = function Questions(_ref) {
|
|
|
100
81
|
onActiveStep: onActiveStep
|
|
101
82
|
}
|
|
102
83
|
}, children);
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
exports.Questions = Questions;
|
|
84
|
+
};
|
|
@@ -1,31 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
var _exportNames = {};
|
|
9
|
-
exports["default"] = void 0;
|
|
10
|
-
|
|
11
|
-
var _Questions = _interopRequireDefault(require("@digigov/form/Questions"));
|
|
12
|
-
|
|
13
|
-
var _Default = require("@digigov/form/Questions/__stories__/Default");
|
|
14
|
-
|
|
15
|
-
Object.keys(_Default).forEach(function (key) {
|
|
16
|
-
if (key === "default" || key === "__esModule") return;
|
|
17
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
18
|
-
if (key in exports && exports[key] === _Default[key]) return;
|
|
19
|
-
Object.defineProperty(exports, key, {
|
|
20
|
-
enumerable: true,
|
|
21
|
-
get: function get() {
|
|
22
|
-
return _Default[key];
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
var _default = {
|
|
1
|
+
import Questions from "./";
|
|
2
|
+
export default {
|
|
27
3
|
title: 'Digigov Form/Questions',
|
|
28
|
-
component:
|
|
4
|
+
component: Questions,
|
|
29
5
|
displayName: 'Questions'
|
|
30
6
|
};
|
|
31
|
-
|
|
7
|
+
export * from "./__stories__/Default";
|
|
@@ -1,20 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.QuestionsContext = void 0;
|
|
7
|
-
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
|
|
1
|
+
import { createContext } from 'react';
|
|
10
2
|
var defaultStep = {
|
|
11
3
|
name: ''
|
|
12
4
|
};
|
|
13
|
-
var QuestionsContext = /*#__PURE__*/
|
|
5
|
+
export var QuestionsContext = /*#__PURE__*/createContext({
|
|
14
6
|
currentStep: defaultStep,
|
|
15
7
|
steps: [],
|
|
16
8
|
submitStep: function submitStep() {
|
|
17
9
|
return null;
|
|
18
10
|
}
|
|
19
|
-
});
|
|
20
|
-
exports.QuestionsContext = QuestionsContext;
|
|
11
|
+
});
|
|
@@ -1,43 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
-
|
|
14
|
-
var _QuestionsContext = require("@digigov/form/Questions/QuestionsContext");
|
|
15
|
-
|
|
16
|
-
var _StepContext = require("@digigov/form/Questions/Step/StepContext");
|
|
17
|
-
|
|
18
|
-
var _StepTitle = require("@digigov/form/Questions/Step/StepTitle");
|
|
19
|
-
|
|
20
|
-
var _SummaryList = require("@digigov/ui/content/SummaryList");
|
|
21
|
-
|
|
22
|
-
var _Button = require("@digigov/ui/form/Button");
|
|
23
|
-
|
|
24
|
-
var _i18n = require("@digigov/ui/i18n");
|
|
25
|
-
|
|
26
|
-
var _Title = _interopRequireDefault(require("@digigov/ui/typography/Title"));
|
|
27
|
-
|
|
28
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
29
|
-
|
|
30
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
31
|
-
|
|
32
|
-
var ReviewStep = function ReviewStep() {
|
|
33
|
-
var _useTranslation = (0, _i18n.useTranslation)(),
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
|
+
import { QuestionsContext } from "../QuestionsContext";
|
|
3
|
+
import { StepContext } from "./StepContext";
|
|
4
|
+
import { StepTitleBase } from "./StepTitle";
|
|
5
|
+
import { SummaryList, SummaryListItem, SummaryListItemKey, SummaryListItemValue, SummaryListItemAction } from '@digigov/ui/content/SummaryList';
|
|
6
|
+
import { Button } from '@digigov/ui/form/Button';
|
|
7
|
+
import { useTranslation } from '@digigov/ui/i18n';
|
|
8
|
+
import Title from '@digigov/ui/typography/Title';
|
|
9
|
+
export var ReviewStep = function ReviewStep() {
|
|
10
|
+
var _useTranslation = useTranslation(),
|
|
34
11
|
t = _useTranslation.t;
|
|
35
12
|
|
|
36
|
-
var _useContext =
|
|
13
|
+
var _useContext = useContext(StepContext),
|
|
37
14
|
submitStep = _useContext.submitStep,
|
|
38
15
|
title = _useContext.title;
|
|
39
16
|
|
|
40
|
-
var _useContext2 =
|
|
17
|
+
var _useContext2 = useContext(QuestionsContext),
|
|
41
18
|
data = _useContext2.data,
|
|
42
19
|
steps = _useContext2.steps,
|
|
43
20
|
onActiveStep = _useContext2.onActiveStep;
|
|
@@ -45,20 +22,20 @@ var ReviewStep = function ReviewStep() {
|
|
|
45
22
|
var filledSteps = steps.filter(function (step) {
|
|
46
23
|
return !!data[step.name];
|
|
47
24
|
});
|
|
48
|
-
return /*#__PURE__*/
|
|
25
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(StepTitleBase, {
|
|
49
26
|
title: title || 'Review answers'
|
|
50
27
|
}), filledSteps.map(function (step) {
|
|
51
|
-
return /*#__PURE__*/
|
|
28
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
52
29
|
key: step.name
|
|
53
|
-
}, /*#__PURE__*/
|
|
30
|
+
}, /*#__PURE__*/React.createElement(Title, {
|
|
54
31
|
size: 'md'
|
|
55
|
-
}, step.title), /*#__PURE__*/
|
|
56
|
-
return /*#__PURE__*/
|
|
32
|
+
}, step.title), /*#__PURE__*/React.createElement(SummaryList, null, Object.keys(data[step.name]).map(function (dataKey) {
|
|
33
|
+
return /*#__PURE__*/React.createElement(SummaryListItem, {
|
|
57
34
|
key: dataKey
|
|
58
|
-
}, /*#__PURE__*/
|
|
35
|
+
}, /*#__PURE__*/React.createElement(SummaryListItemKey, null, step.fields.find(function (_ref) {
|
|
59
36
|
var key = _ref.key;
|
|
60
37
|
return key === dataKey;
|
|
61
|
-
}).label.primary), /*#__PURE__*/
|
|
38
|
+
}).label.primary), /*#__PURE__*/React.createElement(SummaryListItemValue, null, data[step.name][dataKey]), /*#__PURE__*/React.createElement(SummaryListItemAction, null, /*#__PURE__*/React.createElement("a", {
|
|
62
39
|
style: {
|
|
63
40
|
cursor: 'pointer'
|
|
64
41
|
},
|
|
@@ -67,13 +44,10 @@ var ReviewStep = function ReviewStep() {
|
|
|
67
44
|
}
|
|
68
45
|
}, t('button.edit'))));
|
|
69
46
|
})));
|
|
70
|
-
}), /*#__PURE__*/
|
|
47
|
+
}), /*#__PURE__*/React.createElement(Button, {
|
|
71
48
|
onClick: function onClick() {
|
|
72
49
|
return submitStep && submitStep();
|
|
73
50
|
}
|
|
74
51
|
}, t('button.submit')));
|
|
75
52
|
};
|
|
76
|
-
|
|
77
|
-
exports.ReviewStep = ReviewStep;
|
|
78
|
-
var _default = ReviewStep;
|
|
79
|
-
exports["default"] = _default;
|
|
53
|
+
export default ReviewStep;
|