@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
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports["default"] = exports.Checkboxes = void 0;
|
|
11
|
+
|
|
12
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
+
|
|
14
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
15
|
+
|
|
16
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
17
|
+
|
|
18
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
19
|
+
|
|
20
|
+
var _ = require("../..");
|
|
21
|
+
|
|
22
|
+
var _reactCore = require("@digigov/react-core");
|
|
23
|
+
|
|
24
|
+
var _Checkbox = _interopRequireDefault(require("@digigov/react-core/Checkbox"));
|
|
25
|
+
|
|
26
|
+
var _CheckboxItem = _interopRequireDefault(require("@digigov/react-core/CheckboxItem"));
|
|
27
|
+
|
|
28
|
+
var _Hint = _interopRequireDefault(require("@digigov/react-core/Hint"));
|
|
29
|
+
|
|
30
|
+
var _i18n = require("@digigov/ui/i18n");
|
|
31
|
+
|
|
32
|
+
var _excluded = ["name", "onChange", "value", "extra", "disabled"],
|
|
33
|
+
_excluded2 = ["label", "value", "show", "disabled", "selected"];
|
|
34
|
+
|
|
35
|
+
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); }
|
|
36
|
+
|
|
37
|
+
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; }
|
|
38
|
+
|
|
39
|
+
var Checkboxes = function Checkboxes(_ref) {
|
|
40
|
+
var name = _ref.name,
|
|
41
|
+
onChange = _ref.onChange,
|
|
42
|
+
value = _ref.value,
|
|
43
|
+
_ref$extra = _ref.extra,
|
|
44
|
+
options = _ref$extra.options,
|
|
45
|
+
className = _ref$extra.className,
|
|
46
|
+
disabled = _ref.disabled,
|
|
47
|
+
props = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
|
48
|
+
if (!value) value = [];
|
|
49
|
+
|
|
50
|
+
var handleChange = function handleChange(optionValue, idx, show) {
|
|
51
|
+
return function (evt) {
|
|
52
|
+
var newValue;
|
|
53
|
+
|
|
54
|
+
if (evt.currentTarget.checked) {
|
|
55
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
56
|
+
// @ts-ignore
|
|
57
|
+
newValue = value.concat([optionValue]);
|
|
58
|
+
} else {
|
|
59
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
60
|
+
// @ts-ignore
|
|
61
|
+
newValue = value.filter(function (val) {
|
|
62
|
+
return val !== optionValue;
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (show && show.length > 0) {
|
|
67
|
+
setChecked(function (items) {
|
|
68
|
+
return items.map(function (item, index) {
|
|
69
|
+
return index === idx ? !item : item;
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
} // reset value to undefined instead of an empty array
|
|
73
|
+
// so the error state mechanism can throw validation errors
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
if (newValue.length === 0) newValue = undefined;
|
|
77
|
+
onChange(newValue);
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
var _useTranslation = (0, _i18n.useTranslation)(),
|
|
82
|
+
t = _useTranslation.t;
|
|
83
|
+
|
|
84
|
+
var _useState = (0, _react.useState)(Array(options.length).fill(false)),
|
|
85
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
86
|
+
checked = _useState2[0],
|
|
87
|
+
setChecked = _useState2[1];
|
|
88
|
+
|
|
89
|
+
return /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
|
|
90
|
+
className: className
|
|
91
|
+
}, options.map(function (_ref2, index) {
|
|
92
|
+
var _value;
|
|
93
|
+
|
|
94
|
+
var label = _ref2.label,
|
|
95
|
+
v = _ref2.value,
|
|
96
|
+
show = _ref2.show,
|
|
97
|
+
optionDisabled = _ref2.disabled,
|
|
98
|
+
selected = _ref2.selected,
|
|
99
|
+
option = (0, _objectWithoutProperties2["default"])(_ref2, _excluded2);
|
|
100
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, {
|
|
101
|
+
key: index
|
|
102
|
+
}, /*#__PURE__*/_react["default"].createElement(_CheckboxItem["default"], (0, _extends2["default"])({
|
|
103
|
+
key: "".concat(name, ".").concat(index),
|
|
104
|
+
name: name,
|
|
105
|
+
value: v,
|
|
106
|
+
disabled: disabled || optionDisabled,
|
|
107
|
+
checked: (_value = value) === null || _value === void 0 ? void 0 : _value.includes(v),
|
|
108
|
+
onChange: handleChange(v, index, show)
|
|
109
|
+
}, option, (0, _extends2["default"])({}, props, {
|
|
110
|
+
reset: undefined,
|
|
111
|
+
defaultValue: undefined,
|
|
112
|
+
onBlur: undefined,
|
|
113
|
+
required: undefined,
|
|
114
|
+
'aria-describedby': undefined,
|
|
115
|
+
type: 'checkbox'
|
|
116
|
+
})), label && label.primary && t(label.primary) || value, label && label.secondary && /*#__PURE__*/_react["default"].createElement(_Hint["default"], null, t(label.secondary))), !!checked[index] && show && /*#__PURE__*/_react["default"].createElement(_reactCore.CheckboxConditional, null, show.map(function (fieldName) {
|
|
117
|
+
return /*#__PURE__*/_react["default"].createElement(_.Field, {
|
|
118
|
+
name: fieldName,
|
|
119
|
+
key: fieldName
|
|
120
|
+
});
|
|
121
|
+
})), selected && selected());
|
|
122
|
+
}));
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
exports.Checkboxes = Checkboxes;
|
|
126
|
+
var _default = Checkboxes;
|
|
127
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
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 _ = _interopRequireDefault(require("./"));
|
|
12
|
+
|
|
13
|
+
var _Default = require("./__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 = {
|
|
27
|
+
title: 'Digigov Form/inputs/DateInput',
|
|
28
|
+
component: _["default"],
|
|
29
|
+
displayName: 'DateInput'
|
|
30
|
+
};
|
|
31
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports["default"] = exports.Default = void 0;
|
|
11
|
+
|
|
12
|
+
var _react = _interopRequireDefault(require("react"));
|
|
13
|
+
|
|
14
|
+
var _ = _interopRequireWildcard(require("../../.."));
|
|
15
|
+
|
|
16
|
+
var _Button = require("@digigov/ui/form/Button");
|
|
17
|
+
|
|
18
|
+
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); }
|
|
19
|
+
|
|
20
|
+
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; }
|
|
21
|
+
|
|
22
|
+
var _ref = /*#__PURE__*/_react["default"].createElement(_Button.Button, {
|
|
23
|
+
type: "submit"
|
|
24
|
+
}, "\u03A3\u03C5\u03BD\u03AD\u03C7\u03B5\u03B9\u03B1");
|
|
25
|
+
|
|
26
|
+
var Default = function Default() {
|
|
27
|
+
return /*#__PURE__*/_react["default"].createElement(_["default"], {
|
|
28
|
+
onSubmit: function onSubmit(data) {
|
|
29
|
+
console.log(data);
|
|
30
|
+
}
|
|
31
|
+
}, /*#__PURE__*/_react["default"].createElement(_.Field, {
|
|
32
|
+
key: 'string',
|
|
33
|
+
name: "string",
|
|
34
|
+
type: "date",
|
|
35
|
+
required: true,
|
|
36
|
+
label: {
|
|
37
|
+
primary: 'Πότε εκδόθηκε το διαβατήριο σας;',
|
|
38
|
+
secondary: 'Για παράδειγμα, 05 11 2020'
|
|
39
|
+
}
|
|
40
|
+
}), _ref);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
exports.Default = Default;
|
|
44
|
+
var _default = Default;
|
|
45
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports["default"] = exports.DateInput = void 0;
|
|
11
|
+
|
|
12
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
13
|
+
|
|
14
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
15
|
+
|
|
16
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
17
|
+
|
|
18
|
+
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
19
|
+
|
|
20
|
+
var _customParseFormat = _interopRequireDefault(require("dayjs/plugin/customParseFormat"));
|
|
21
|
+
|
|
22
|
+
var _DateInputContainer = _interopRequireDefault(require("@digigov/react-core/DateInputContainer"));
|
|
23
|
+
|
|
24
|
+
var _DateInputItem = _interopRequireDefault(require("@digigov/react-core/DateInputItem"));
|
|
25
|
+
|
|
26
|
+
var _i18n = require("@digigov/ui/i18n");
|
|
27
|
+
|
|
28
|
+
var _excluded = ["label"],
|
|
29
|
+
_excluded2 = ["name", "type"];
|
|
30
|
+
|
|
31
|
+
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); }
|
|
32
|
+
|
|
33
|
+
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; }
|
|
34
|
+
|
|
35
|
+
_dayjs["default"].extend(_customParseFormat["default"]);
|
|
36
|
+
|
|
37
|
+
function useDate(value, onChange) {
|
|
38
|
+
var _useMemo = (0, _react.useMemo)(function () {
|
|
39
|
+
if (!value || value.length === 0) {
|
|
40
|
+
onChange('');
|
|
41
|
+
return ['', '', ''];
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
var _value$split = value.split('/'),
|
|
45
|
+
_value$split2 = (0, _slicedToArray2["default"])(_value$split, 3),
|
|
46
|
+
day = _value$split2[0],
|
|
47
|
+
month = _value$split2[1],
|
|
48
|
+
year = _value$split2[2];
|
|
49
|
+
|
|
50
|
+
return [year, month, day];
|
|
51
|
+
}, [value]),
|
|
52
|
+
_useMemo2 = (0, _slicedToArray2["default"])(_useMemo, 3),
|
|
53
|
+
year = _useMemo2[0],
|
|
54
|
+
month = _useMemo2[1],
|
|
55
|
+
day = _useMemo2[2];
|
|
56
|
+
|
|
57
|
+
function set(year, month, day) {
|
|
58
|
+
var value = "".concat(day || '', "/").concat(month || '', "/").concat(year || '');
|
|
59
|
+
|
|
60
|
+
if (!year && !month && !day) {
|
|
61
|
+
onChange(null);
|
|
62
|
+
} else {
|
|
63
|
+
onChange(value);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function setYear(evt) {
|
|
68
|
+
var val = evt.target.value;
|
|
69
|
+
set(val, month, day);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function setMonth(evt, cast) {
|
|
73
|
+
var val = evt.target.value;
|
|
74
|
+
|
|
75
|
+
if (cast && val && val.length === 1) {
|
|
76
|
+
val = '0' + val;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
set(year, val, day);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function setDay(evt, cast) {
|
|
83
|
+
var val = evt.target.value;
|
|
84
|
+
|
|
85
|
+
if (cast && val && val.length === 1) {
|
|
86
|
+
val = '0' + val;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
set(year, month, val);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return {
|
|
93
|
+
day: day,
|
|
94
|
+
month: month,
|
|
95
|
+
year: year,
|
|
96
|
+
setYear: setYear,
|
|
97
|
+
setMonth: setMonth,
|
|
98
|
+
setDay: setDay
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
var VALID_FORMATS = ['DD/MM/YYYY'];
|
|
103
|
+
|
|
104
|
+
var makeDate = function makeDate(val) {
|
|
105
|
+
var date = (0, _dayjs["default"])(val, VALID_FORMATS, true);
|
|
106
|
+
|
|
107
|
+
if (date.isValid()) {
|
|
108
|
+
return date.format('DD/MM/YYYY');
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return '';
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
var DatePart = function DatePart(_ref) {
|
|
115
|
+
var label = _ref.label,
|
|
116
|
+
props = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
|
117
|
+
return /*#__PURE__*/_react["default"].createElement(_DateInputItem["default"], props, label);
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
var DateInput = function DateInput(_ref2) {
|
|
121
|
+
var name = _ref2.name,
|
|
122
|
+
type = _ref2.type,
|
|
123
|
+
props = (0, _objectWithoutProperties2["default"])(_ref2, _excluded2);
|
|
124
|
+
|
|
125
|
+
var _useTranslation = (0, _i18n.useTranslation)(),
|
|
126
|
+
t = _useTranslation.t;
|
|
127
|
+
|
|
128
|
+
var _useState = (0, _react.useState)(props.value),
|
|
129
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 1),
|
|
130
|
+
initial = _useState2[0];
|
|
131
|
+
|
|
132
|
+
var value = (0, _react.useMemo)(function () {
|
|
133
|
+
if (initial === props.value) {
|
|
134
|
+
return makeDate(props.value);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return props.value;
|
|
138
|
+
}, [props.value, initial]);
|
|
139
|
+
var date = useDate(value || makeDate(props.defaultValue), props.onChange);
|
|
140
|
+
return /*#__PURE__*/_react["default"].createElement(_DateInputContainer["default"], null, /*#__PURE__*/_react["default"].createElement(DatePart, {
|
|
141
|
+
label: t('form.label.day'),
|
|
142
|
+
onChange: date.setDay,
|
|
143
|
+
onBlur: function onBlur(e) {
|
|
144
|
+
return date.setDay(e, true);
|
|
145
|
+
},
|
|
146
|
+
value: date.day,
|
|
147
|
+
width: 2,
|
|
148
|
+
name: "".concat(name, "-day"),
|
|
149
|
+
maxLength: "2",
|
|
150
|
+
disabled: props.disabled,
|
|
151
|
+
"aria-required": props['aria-required'],
|
|
152
|
+
error: !date.day ? props.error : false
|
|
153
|
+
}), /*#__PURE__*/_react["default"].createElement(DatePart, {
|
|
154
|
+
label: t('form.label.month'),
|
|
155
|
+
onChange: date.setMonth,
|
|
156
|
+
onBlur: function onBlur(e) {
|
|
157
|
+
return date.setMonth(e, true);
|
|
158
|
+
},
|
|
159
|
+
value: date.month,
|
|
160
|
+
width: 2,
|
|
161
|
+
name: "".concat(props.name, "-month"),
|
|
162
|
+
maxLength: "2",
|
|
163
|
+
disabled: props.disabled,
|
|
164
|
+
"aria-required": props['aria-required'],
|
|
165
|
+
error: !date.month ? props.error : false
|
|
166
|
+
}), /*#__PURE__*/_react["default"].createElement(DatePart, {
|
|
167
|
+
label: t('form.label.year'),
|
|
168
|
+
onChange: date.setYear,
|
|
169
|
+
value: date.year,
|
|
170
|
+
width: 4,
|
|
171
|
+
name: "".concat(props.name, "-year"),
|
|
172
|
+
maxLength: "4",
|
|
173
|
+
disabled: props.disabled,
|
|
174
|
+
"aria-required": props['aria-required'],
|
|
175
|
+
error: !date.year ? props.error : false
|
|
176
|
+
}));
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
exports.DateInput = DateInput;
|
|
180
|
+
var _default = DateInput;
|
|
181
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
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 _ = _interopRequireDefault(require("./"));
|
|
12
|
+
|
|
13
|
+
var _Default = require("./__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 = {
|
|
27
|
+
title: 'Digigov Form/inputs/FileInput',
|
|
28
|
+
component: _["default"],
|
|
29
|
+
displayName: 'FileInput'
|
|
30
|
+
};
|
|
31
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports["default"] = exports.Default = void 0;
|
|
11
|
+
|
|
12
|
+
var _react = _interopRequireDefault(require("react"));
|
|
13
|
+
|
|
14
|
+
var _ = _interopRequireWildcard(require("../../.."));
|
|
15
|
+
|
|
16
|
+
var _Button = require("@digigov/ui/form/Button");
|
|
17
|
+
|
|
18
|
+
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); }
|
|
19
|
+
|
|
20
|
+
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; }
|
|
21
|
+
|
|
22
|
+
var _ref = /*#__PURE__*/_react["default"].createElement(_Button.Button, null, "\u03A3\u03C5\u03BD\u03AD\u03C7\u03B5\u03B9\u03B1");
|
|
23
|
+
|
|
24
|
+
var Default = function Default() {
|
|
25
|
+
return /*#__PURE__*/_react["default"].createElement(_["default"], {
|
|
26
|
+
onSubmit: function onSubmit(data) {
|
|
27
|
+
console.log(data);
|
|
28
|
+
}
|
|
29
|
+
}, /*#__PURE__*/_react["default"].createElement(_.Field, {
|
|
30
|
+
key: 'string',
|
|
31
|
+
name: "file",
|
|
32
|
+
type: "file",
|
|
33
|
+
required: true,
|
|
34
|
+
label: {
|
|
35
|
+
primary: 'Βιογραφικό σημείωμα'
|
|
36
|
+
}
|
|
37
|
+
}), _ref);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
exports.Default = Default;
|
|
41
|
+
var _default = Default;
|
|
42
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports["default"] = exports.FileInput = void 0;
|
|
11
|
+
|
|
12
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
|
+
|
|
14
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
15
|
+
|
|
16
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
17
|
+
|
|
18
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
19
|
+
|
|
20
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
21
|
+
|
|
22
|
+
var _FileUpload = _interopRequireDefault(require("@digigov/react-core/FileUpload"));
|
|
23
|
+
|
|
24
|
+
var _FileUploadContainer = _interopRequireDefault(require("@digigov/react-core/FileUploadContainer"));
|
|
25
|
+
|
|
26
|
+
var _Hint = _interopRequireDefault(require("@digigov/react-core/Hint"));
|
|
27
|
+
|
|
28
|
+
var _Button = _interopRequireDefault(require("@digigov/ui/form/Button"));
|
|
29
|
+
|
|
30
|
+
var _i18n = require("@digigov/ui/i18n");
|
|
31
|
+
|
|
32
|
+
var _Paragraph = _interopRequireDefault(require("@digigov/ui/typography/Paragraph"));
|
|
33
|
+
|
|
34
|
+
var _excluded = ["name", "extra", "disabled", "reset", "onChange"];
|
|
35
|
+
|
|
36
|
+
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); }
|
|
37
|
+
|
|
38
|
+
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; }
|
|
39
|
+
|
|
40
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
41
|
+
var FileInput = /*#__PURE__*/_react["default"].forwardRef(function FileInput(_ref, ref) {
|
|
42
|
+
var name = _ref.name,
|
|
43
|
+
_ref$extra = _ref.extra,
|
|
44
|
+
extra = _ref$extra === void 0 ? {} : _ref$extra,
|
|
45
|
+
disabled = _ref.disabled,
|
|
46
|
+
reset = _ref.reset,
|
|
47
|
+
onChange = _ref.onChange,
|
|
48
|
+
props = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
|
49
|
+
|
|
50
|
+
var _useTranslation = (0, _i18n.useTranslation)(),
|
|
51
|
+
t = _useTranslation.t;
|
|
52
|
+
|
|
53
|
+
var _useState = (0, _react.useState)([]),
|
|
54
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
55
|
+
files = _useState2[0],
|
|
56
|
+
setFiles = _useState2[1];
|
|
57
|
+
|
|
58
|
+
var handleChange = function handleChange(e) {
|
|
59
|
+
var target = e.target;
|
|
60
|
+
var selectedFiles = Array.from(target.files).map(function (_ref2) {
|
|
61
|
+
var name = _ref2.name;
|
|
62
|
+
return name;
|
|
63
|
+
});
|
|
64
|
+
setFiles(selectedFiles); // proceed calling the onChange provided
|
|
65
|
+
// by react-hook-form
|
|
66
|
+
|
|
67
|
+
onChange(e);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_FileUploadContainer["default"], {
|
|
71
|
+
hasFiles: files && files.length > 0
|
|
72
|
+
}, files !== null && files !== void 0 && files.length ? /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_Paragraph["default"], null, /*#__PURE__*/_react["default"].createElement("b", null, t('upload.file'), ":"), " ", "".concat(files.join(', ')))) : /*#__PURE__*/_react["default"].createElement(_Hint["default"], null, t('upload.no_file')), /*#__PURE__*/_react["default"].createElement(_FileUpload["default"], (0, _extends2["default"])({
|
|
73
|
+
ref: ref,
|
|
74
|
+
hasFiles: !!(files !== null && files !== void 0 && files.length),
|
|
75
|
+
name: name,
|
|
76
|
+
disabled: disabled,
|
|
77
|
+
onChange: handleChange
|
|
78
|
+
}, (0, _extends2["default"])({}, props, {
|
|
79
|
+
required: undefined
|
|
80
|
+
})), files !== null && files !== void 0 && files.length ? t('upload.change_file') : t('upload.choose_file')), files !== undefined && files.length > 0 && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
81
|
+
variant: "link",
|
|
82
|
+
onClick: function onClick(event) {
|
|
83
|
+
event.preventDefault();
|
|
84
|
+
reset((0, _defineProperty2["default"])({}, name, ''));
|
|
85
|
+
setFiles(undefined);
|
|
86
|
+
}
|
|
87
|
+
}, t('upload.reset_file')))));
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
exports.FileInput = FileInput;
|
|
91
|
+
var _default = FileInput;
|
|
92
|
+
exports["default"] = _default;
|