@digigov/form 1.1.2 → 1.1.4-mobile
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Field/FieldBase/index.js +103 -76
- package/Field/FieldBase.js.map +7 -0
- package/Field/FieldBaseContainer/index.js +29 -37
- package/Field/FieldBaseContainer.js.map +7 -0
- package/Field/FieldConditional/index.js +79 -53
- package/Field/FieldConditional.js.map +7 -0
- package/Field/index.js +89 -63
- package/Field/index.js.map +7 -0
- package/Field/types/index.js +1 -1
- package/Field/types.d.ts +4 -0
- package/Field/types.js.map +7 -0
- package/Field/utils/index.js +96 -85
- package/Field/utils.d.ts +1 -0
- package/Field/utils.js.map +7 -0
- package/FieldArray/FieldArray.stories/index.js +12 -6
- package/FieldArray/FieldArray.stories.d.ts +2 -2
- package/FieldArray/FieldArray.stories.js.map +7 -0
- package/FieldArray/__stories__/Default/index.js +87 -80
- package/FieldArray/__stories__/Default.d.ts +2 -2
- package/FieldArray/__stories__/Default.js.map +7 -0
- package/FieldArray/__stories__/WithExactLength/index.js +87 -80
- package/FieldArray/__stories__/WithExactLength.d.ts +2 -2
- package/FieldArray/__stories__/WithExactLength.js.map +7 -0
- package/FieldArray/index.d.ts +1 -0
- package/FieldArray/index.js +65 -59
- package/FieldArray/index.js.map +7 -0
- package/FieldArray/index.test.d.ts +1 -0
- package/FieldObject/index.d.ts +3 -0
- package/FieldObject/index.js +66 -52
- package/FieldObject/index.js.map +7 -0
- package/Fieldset/FieldsetWithContext/index.js +27 -31
- package/Fieldset/FieldsetWithContext.js.map +7 -0
- package/Fieldset/index.js +27 -29
- package/Fieldset/index.js.map +7 -0
- package/Fieldset/types/index.js +1 -1
- package/Fieldset/types.d.ts +2 -0
- package/Fieldset/types.js.map +7 -0
- package/Form.stories/index.js +7 -3
- package/Form.stories.js.map +7 -0
- package/FormBuilder/FormBuilder/index.js +123 -118
- package/FormBuilder/FormBuilder.d.ts +1 -0
- package/FormBuilder/FormBuilder.js.map +7 -0
- package/FormBuilder/FormBuilder.stories/index.js +10 -5
- package/FormBuilder/FormBuilder.stories.d.ts +1 -1
- package/FormBuilder/FormBuilder.stories.js.map +7 -0
- package/FormBuilder/__stories__/Default/index.js +27 -21
- package/FormBuilder/__stories__/Default.d.ts +2 -2
- package/FormBuilder/__stories__/Default.js.map +7 -0
- package/FormBuilder/index.js +6 -2
- package/FormBuilder/index.js.map +7 -0
- package/FormBuilder/index.test.d.ts +1 -0
- package/FormBuilder/scenarios.test.d.ts +88 -0
- package/FormContext/index.js +7 -3
- package/FormContext.js.map +7 -0
- package/MultiplicityField/MultiplicityField.stories/index.js +20 -10
- package/MultiplicityField/MultiplicityField.stories.d.ts +6 -6
- package/MultiplicityField/MultiplicityField.stories.js.map +7 -0
- package/MultiplicityField/__stories__/Default/index.js +90 -85
- package/MultiplicityField/__stories__/Default.d.ts +2 -2
- package/MultiplicityField/__stories__/Default.js.map +7 -0
- package/MultiplicityField/__stories__/PreviewDisplay/index.js +70 -72
- package/MultiplicityField/__stories__/PreviewDisplay.d.ts +2 -2
- package/MultiplicityField/__stories__/PreviewDisplay.js.map +7 -0
- package/MultiplicityField/__stories__/WithExactLength/index.js +87 -80
- package/MultiplicityField/__stories__/WithExactLength.d.ts +2 -2
- package/MultiplicityField/__stories__/WithExactLength.js.map +7 -0
- package/MultiplicityField/__stories__/WithMaxLength/index.js +90 -83
- package/MultiplicityField/__stories__/WithMaxLength.d.ts +2 -2
- package/MultiplicityField/__stories__/WithMaxLength.js.map +7 -0
- package/MultiplicityField/__stories__/WithMinAndMaxLength/index.js +91 -84
- package/MultiplicityField/__stories__/WithMinAndMaxLength.d.ts +2 -2
- package/MultiplicityField/__stories__/WithMinAndMaxLength.js.map +7 -0
- package/MultiplicityField/__stories__/WithMinLength/index.js +90 -83
- package/MultiplicityField/__stories__/WithMinLength.d.ts +2 -2
- package/MultiplicityField/__stories__/WithMinLength.js.map +7 -0
- package/MultiplicityField/add-objects/index.js +130 -132
- package/MultiplicityField/add-objects.d.ts +1 -0
- package/MultiplicityField/add-objects.js.map +7 -0
- package/MultiplicityField/index.d.ts +1 -1
- package/MultiplicityField/index.js +111 -101
- package/MultiplicityField/index.js.map +7 -0
- package/MultiplicityField/index.test.d.ts +1 -0
- package/Questions/Questions/index.js +44 -53
- package/Questions/Questions.js.map +7 -0
- package/Questions/Questions.stories/index.js +10 -5
- package/Questions/Questions.stories.d.ts +1 -1
- package/Questions/Questions.stories.js.map +7 -0
- package/Questions/QuestionsContext/index.js +9 -9
- package/Questions/QuestionsContext.js.map +7 -0
- package/Questions/Step/ReviewStep/index.js +35 -47
- package/Questions/Step/ReviewStep.js.map +7 -0
- package/Questions/Step/Step/index.js +39 -47
- package/Questions/Step/Step.js.map +7 -0
- package/Questions/Step/StepArrayReview/index.js +41 -45
- package/Questions/Step/StepArrayReview.js.map +7 -0
- package/Questions/Step/StepContext/index.js +15 -19
- package/Questions/Step/StepContext.js.map +7 -0
- package/Questions/Step/StepDescription/index.js +22 -22
- package/Questions/Step/StepDescription.js.map +7 -0
- package/Questions/Step/StepForm/index.js +33 -43
- package/Questions/Step/StepForm.js.map +7 -0
- package/Questions/Step/StepQuote/index.js +10 -9
- package/Questions/Step/StepQuote.js.map +7 -0
- package/Questions/Step/StepTitle/index.js +40 -38
- package/Questions/Step/StepTitle.d.ts +1 -0
- package/Questions/Step/StepTitle.js.map +7 -0
- package/Questions/Step/getAddMoreFields/index.js +28 -20
- package/Questions/Step/getAddMoreFields.js.map +7 -0
- package/Questions/Step/index.d.ts +0 -1
- package/Questions/Step/index.js +16 -13
- package/Questions/Step/index.js.map +7 -0
- package/Questions/Step/types/index.js +1 -1
- package/Questions/Step/types.d.ts +2 -0
- package/Questions/Step/types.js.map +7 -0
- package/Questions/__stories__/Default/index.js +106 -100
- package/Questions/__stories__/Default.d.ts +2 -2
- package/Questions/__stories__/Default.js.map +7 -0
- package/Questions/getNextStep/index.js +12 -10
- package/Questions/getNextStep.js.map +7 -0
- package/Questions/index.js +7 -3
- package/Questions/index.js.map +7 -0
- package/Questions/index.test.d.ts +1 -0
- package/Questions/types/index.js +1 -1
- package/Questions/types.d.ts +2 -0
- package/Questions/types.js.map +7 -0
- package/cjs/Field/FieldBase/index.js +135 -82
- package/cjs/Field/FieldBase.js.map +7 -0
- package/cjs/Field/FieldBaseContainer/index.js +61 -43
- package/cjs/Field/FieldBaseContainer.js.map +7 -0
- package/cjs/Field/FieldConditional/index.js +111 -59
- package/cjs/Field/FieldConditional.js.map +7 -0
- package/cjs/Field/index.js +121 -72
- package/cjs/Field/index.js.map +7 -0
- package/cjs/Field/types/index.js +16 -5
- package/cjs/Field/types.js.map +7 -0
- package/cjs/Field/utils/index.js +139 -106
- package/cjs/Field/utils.js.map +7 -0
- package/cjs/FieldArray/FieldArray.stories/index.js +46 -36
- package/cjs/FieldArray/FieldArray.stories.js.map +7 -0
- package/cjs/FieldArray/__stories__/Default/index.js +119 -89
- package/cjs/FieldArray/__stories__/Default.js.map +7 -0
- package/cjs/FieldArray/__stories__/WithExactLength/index.js +119 -89
- package/cjs/FieldArray/__stories__/WithExactLength.js.map +7 -0
- package/cjs/FieldArray/index.js +97 -65
- package/cjs/FieldArray/index.js.map +7 -0
- package/cjs/FieldObject/index.js +98 -61
- package/cjs/FieldObject/index.js.map +7 -0
- package/cjs/Fieldset/FieldsetWithContext/index.js +54 -40
- package/cjs/Fieldset/FieldsetWithContext.js.map +7 -0
- package/cjs/Fieldset/index.js +61 -39
- package/cjs/Fieldset/index.js.map +7 -0
- package/cjs/Fieldset/types/index.js +16 -5
- package/cjs/Fieldset/types.js.map +7 -0
- package/cjs/Form.stories/index.js +25 -8
- package/cjs/Form.stories.js.map +7 -0
- package/cjs/FormBuilder/FormBuilder/index.js +158 -128
- package/cjs/FormBuilder/FormBuilder.js.map +7 -0
- package/cjs/FormBuilder/FormBuilder.stories/index.js +43 -24
- package/cjs/FormBuilder/FormBuilder.stories.js.map +7 -0
- package/cjs/FormBuilder/__stories__/Default/index.js +60 -31
- package/cjs/FormBuilder/__stories__/Default.js.map +7 -0
- package/cjs/FormBuilder/index.js +24 -7
- package/cjs/FormBuilder/index.js.map +7 -0
- package/cjs/FormContext/index.js +29 -8
- package/cjs/FormContext.js.map +7 -0
- package/cjs/MultiplicityField/MultiplicityField.stories/index.js +58 -84
- package/cjs/MultiplicityField/MultiplicityField.stories.js.map +7 -0
- package/cjs/MultiplicityField/__stories__/Default/index.js +122 -94
- package/cjs/MultiplicityField/__stories__/Default.js.map +7 -0
- package/cjs/MultiplicityField/__stories__/PreviewDisplay/index.js +85 -81
- package/cjs/MultiplicityField/__stories__/PreviewDisplay.js.map +7 -0
- package/cjs/MultiplicityField/__stories__/WithExactLength/index.js +119 -89
- package/cjs/MultiplicityField/__stories__/WithExactLength.js.map +7 -0
- package/cjs/MultiplicityField/__stories__/WithMaxLength/index.js +122 -92
- package/cjs/MultiplicityField/__stories__/WithMaxLength.js.map +7 -0
- package/cjs/MultiplicityField/__stories__/WithMinAndMaxLength/index.js +123 -93
- package/cjs/MultiplicityField/__stories__/WithMinAndMaxLength.js.map +7 -0
- package/cjs/MultiplicityField/__stories__/WithMinLength/index.js +122 -92
- package/cjs/MultiplicityField/__stories__/WithMinLength.js.map +7 -0
- package/cjs/MultiplicityField/add-objects/index.js +160 -138
- package/cjs/MultiplicityField/add-objects.js.map +7 -0
- package/cjs/MultiplicityField/index.js +144 -110
- package/cjs/MultiplicityField/index.js.map +7 -0
- package/cjs/Questions/Questions/index.js +76 -62
- package/cjs/Questions/Questions.js.map +7 -0
- package/cjs/Questions/Questions.stories/index.js +43 -24
- package/cjs/Questions/Questions.stories.js.map +7 -0
- package/cjs/Questions/QuestionsContext/index.js +31 -14
- package/cjs/Questions/QuestionsContext.js.map +7 -0
- package/cjs/Questions/Step/ReviewStep/index.js +61 -56
- package/cjs/Questions/Step/ReviewStep.js.map +7 -0
- package/cjs/Questions/Step/Step/index.js +71 -56
- package/cjs/Questions/Step/Step.js.map +7 -0
- package/cjs/Questions/Step/StepArrayReview/index.js +65 -54
- package/cjs/Questions/Step/StepArrayReview.js.map +7 -0
- package/cjs/Questions/Step/StepContext/index.js +37 -24
- package/cjs/Questions/Step/StepContext.js.map +7 -0
- package/cjs/Questions/Step/StepDescription/index.js +55 -31
- package/cjs/Questions/Step/StepDescription.js.map +7 -0
- package/cjs/Questions/Step/StepForm/index.js +65 -52
- package/cjs/Questions/Step/StepForm.js.map +7 -0
- package/cjs/Questions/Step/StepQuote/index.js +42 -15
- package/cjs/Questions/Step/StepQuote.js.map +7 -0
- package/cjs/Questions/Step/StepTitle/index.js +72 -47
- package/cjs/Questions/Step/StepTitle.js.map +7 -0
- package/cjs/Questions/Step/getAddMoreFields/index.js +50 -25
- package/cjs/Questions/Step/getAddMoreFields.js.map +7 -0
- package/cjs/Questions/Step/index.js +59 -143
- package/cjs/Questions/Step/index.js.map +7 -0
- package/cjs/Questions/Step/types/index.js +16 -5
- package/cjs/Questions/Step/types.js.map +7 -0
- package/cjs/Questions/__stories__/Default/index.js +132 -109
- package/cjs/Questions/__stories__/Default.js.map +7 -0
- package/cjs/Questions/getNextStep/index.js +33 -14
- package/cjs/Questions/getNextStep.js.map +7 -0
- package/cjs/Questions/index.js +29 -19
- package/cjs/Questions/index.js.map +7 -0
- package/cjs/Questions/types/index.js +16 -5
- package/cjs/Questions/types.js.map +7 -0
- package/cjs/index.js +47 -20
- package/cjs/index.js.map +7 -0
- package/cjs/inputs/AutoCompleteInput/AutoComplete.stories/index.js +46 -24
- package/cjs/inputs/AutoCompleteInput/AutoComplete.stories.js.map +7 -0
- package/cjs/inputs/AutoCompleteInput/__stories__/Default/index.js +78 -51
- package/cjs/inputs/AutoCompleteInput/__stories__/Default.js.map +7 -0
- package/cjs/inputs/AutoCompleteInput/__stories__/Multiple/index.js +84 -0
- package/cjs/inputs/AutoCompleteInput/__stories__/Multiple.js.map +7 -0
- package/cjs/inputs/AutoCompleteInput/index.js +90 -46
- package/cjs/inputs/AutoCompleteInput/index.js.map +7 -0
- package/cjs/inputs/Checkboxes/Checkboxes.stories/index.js +49 -48
- package/cjs/inputs/Checkboxes/Checkboxes.stories.js.map +7 -0
- package/cjs/inputs/Checkboxes/__stories__/Conditional/index.js +120 -89
- package/cjs/inputs/Checkboxes/__stories__/Conditional.js.map +7 -0
- package/cjs/inputs/Checkboxes/__stories__/Default/index.js +73 -46
- package/cjs/inputs/Checkboxes/__stories__/Default.js.map +7 -0
- package/cjs/inputs/Checkboxes/__stories__/WithDivider/index.js +74 -47
- package/cjs/inputs/Checkboxes/__stories__/WithDivider.js.map +7 -0
- package/cjs/inputs/Checkboxes/index.js +102 -96
- package/cjs/inputs/Checkboxes/index.js.map +7 -0
- package/cjs/inputs/DateInput/DateInput.stories/index.js +43 -24
- package/cjs/inputs/DateInput/DateInput.stories.js.map +7 -0
- package/cjs/inputs/DateInput/__stories__/Default/index.js +56 -28
- package/cjs/inputs/DateInput/__stories__/Default.js.map +7 -0
- package/cjs/inputs/DateInput/index.js +122 -109
- package/cjs/inputs/DateInput/index.js.map +7 -0
- package/cjs/inputs/FileInput/FileInput.stories/index.js +43 -24
- package/cjs/inputs/FileInput/FileInput.stories.js.map +7 -0
- package/cjs/inputs/FileInput/__stories__/Default/index.js +57 -26
- package/cjs/inputs/FileInput/__stories__/Default.js.map +7 -0
- package/cjs/inputs/FileInput/index.js +76 -63
- package/cjs/inputs/FileInput/index.js.map +7 -0
- package/cjs/inputs/ImageInput/ImageInput.stories/index.js +49 -48
- package/cjs/inputs/ImageInput/ImageInput.stories.js.map +7 -0
- package/cjs/inputs/ImageInput/__stories__/Default/index.js +58 -33
- package/cjs/inputs/ImageInput/__stories__/Default.js.map +7 -0
- package/cjs/inputs/ImageInput/__stories__/WithInvalidImageDimension/index.js +65 -40
- package/cjs/inputs/ImageInput/__stories__/WithInvalidImageDimension.js.map +7 -0
- package/cjs/inputs/ImageInput/__stories__/WithInvalidImageSize/index.js +62 -37
- package/cjs/inputs/ImageInput/__stories__/WithInvalidImageSize.js.map +7 -0
- package/cjs/inputs/ImageInput/index.js +91 -83
- package/cjs/inputs/ImageInput/index.js.map +7 -0
- package/cjs/inputs/Input/Input.stories/index.js +70 -120
- package/cjs/inputs/Input/Input.stories.js.map +7 -0
- package/cjs/inputs/Input/__stories__/AFM/index.js +60 -29
- package/cjs/inputs/Input/__stories__/AFM.js.map +7 -0
- package/cjs/inputs/Input/__stories__/Boolean/index.js +61 -30
- package/cjs/inputs/Input/__stories__/Boolean.js.map +7 -0
- package/cjs/inputs/Input/__stories__/IBAN/index.js +61 -30
- package/cjs/inputs/Input/__stories__/IBAN.js.map +7 -0
- package/cjs/inputs/Input/__stories__/Integer/index.js +75 -38
- package/cjs/inputs/Input/__stories__/Integer.js.map +7 -0
- package/cjs/inputs/Input/__stories__/LandlineNumber/index.js +67 -0
- package/cjs/inputs/Input/__stories__/LandlineNumber.js.map +7 -0
- package/cjs/inputs/Input/__stories__/MobilePhone/index.js +64 -29
- package/cjs/inputs/Input/__stories__/MobilePhone.js.map +7 -0
- package/cjs/inputs/Input/__stories__/PhoneNumber/index.js +63 -29
- package/cjs/inputs/Input/__stories__/PhoneNumber.js.map +7 -0
- package/cjs/inputs/Input/__stories__/PostalCode/index.js +60 -31
- package/cjs/inputs/Input/__stories__/PostalCode.js.map +7 -0
- package/cjs/inputs/Input/__stories__/String/index.js +64 -0
- package/cjs/inputs/Input/__stories__/String.js.map +7 -0
- package/cjs/inputs/Input/__stories__/TextWithLimit/index.js +64 -0
- package/cjs/inputs/Input/__stories__/TextWithLimit.js.map +7 -0
- package/cjs/inputs/Input/index.js +87 -72
- package/cjs/inputs/Input/index.js.map +7 -0
- package/cjs/inputs/Input/inputsInputScenarios/index.js +439 -0
- package/cjs/inputs/Input/inputsInputScenarios.js.map +7 -0
- package/cjs/inputs/Label/Label.stories/index.js +43 -24
- package/cjs/inputs/Label/Label.stories.js.map +7 -0
- package/cjs/inputs/Label/__stories__/Default/index.js +66 -33
- package/cjs/inputs/Label/__stories__/Default.js.map +7 -0
- package/cjs/inputs/Label/index.js +45 -24
- package/cjs/inputs/Label/index.js.map +7 -0
- package/cjs/inputs/OtpInput/OtpInput.stories/index.js +43 -24
- package/cjs/inputs/OtpInput/OtpInput.stories.js.map +7 -0
- package/cjs/inputs/OtpInput/__stories__/Default/index.js +59 -34
- package/cjs/inputs/OtpInput/__stories__/Default.js.map +7 -0
- package/cjs/inputs/OtpInput/index.js +142 -112
- package/cjs/inputs/OtpInput/index.js.map +7 -0
- package/cjs/inputs/Radio/Radio.stories/index.js +49 -48
- package/cjs/inputs/Radio/Radio.stories.js.map +7 -0
- package/cjs/inputs/Radio/__stories__/Conditional/index.js +120 -89
- package/cjs/inputs/Radio/__stories__/Conditional.js.map +7 -0
- package/cjs/inputs/Radio/__stories__/Default/index.js +77 -51
- package/cjs/inputs/Radio/__stories__/Default.js.map +7 -0
- package/cjs/inputs/Radio/__stories__/WithDivider/index.js +78 -52
- package/cjs/inputs/Radio/__stories__/WithDivider.js.map +7 -0
- package/cjs/inputs/Radio/index.js +132 -61
- package/cjs/inputs/Radio/index.js.map +7 -0
- package/cjs/inputs/Select/Select.stories/index.js +43 -24
- package/cjs/inputs/Select/Select.stories.js.map +7 -0
- package/cjs/inputs/Select/__stories__/Default/index.js +82 -57
- package/cjs/inputs/Select/__stories__/Default.js.map +7 -0
- package/cjs/inputs/Select/index.js +55 -36
- package/cjs/inputs/Select/index.js.map +7 -0
- package/cjs/inputs/index.js +62 -69
- package/cjs/inputs/index.js.map +7 -0
- package/cjs/inputs/inputsScenarios/index.js +540 -0
- package/cjs/inputs/inputsScenarios.js.map +7 -0
- package/cjs/internal/index.js +116 -346
- package/cjs/internal.js.map +7 -0
- package/cjs/lazy/index.js +93 -0
- package/cjs/lazy.js.map +7 -0
- package/cjs/locales/el/index.js +35 -0
- package/cjs/locales/el.js.map +7 -0
- package/cjs/registry/index.js +174 -142
- package/cjs/registry.js.map +7 -0
- package/cjs/types/index.js +16 -5
- package/cjs/types.js.map +7 -0
- package/cjs/utils/index.js +78 -83
- package/cjs/utils.js.map +7 -0
- package/cjs/validators/index.js +130 -128
- package/cjs/validators/index.js.map +7 -0
- package/cjs/validators/types/index.js +16 -5
- package/cjs/validators/types.js.map +7 -0
- package/cjs/validators/utils/afm/index.js +38 -21
- package/cjs/validators/utils/afm.js.map +7 -0
- package/cjs/validators/utils/file/index.js +44 -47
- package/cjs/validators/utils/file.js.map +7 -0
- package/cjs/validators/utils/iban/index.js +36 -17
- package/cjs/validators/utils/iban.js.map +7 -0
- package/cjs/validators/utils/image/index.js +88 -112
- package/cjs/validators/utils/image.js.map +7 -0
- package/cjs/validators/utils/index.js +95 -159
- package/cjs/validators/utils/index.js.map +7 -0
- package/cjs/validators/utils/int/index.js +34 -12
- package/cjs/validators/utils/int.js.map +7 -0
- package/cjs/validators/utils/number/index.js +33 -11
- package/cjs/validators/utils/number.js.map +7 -0
- package/cjs/validators/utils/otp/index.js +35 -13
- package/cjs/validators/utils/otp.js.map +7 -0
- package/cjs/validators/utils/phone/index.js +171 -92
- package/cjs/validators/utils/phone.js.map +7 -0
- package/cjs/validators/utils/postal_code/index.js +36 -16
- package/cjs/validators/utils/postal_code.js.map +7 -0
- package/cjs/validators/utils/text_limit/index.js +40 -25
- package/cjs/validators/utils/text_limit.js.map +7 -0
- package/cjs/validators/utils/uuid4/index.js +34 -13
- package/cjs/validators/utils/uuid4.js.map +7 -0
- package/index.d.ts +4 -1
- package/index.js +13 -4
- package/index.js.map +7 -0
- package/inputs/AutoCompleteInput/AutoComplete.stories/index.js +12 -5
- package/inputs/AutoCompleteInput/AutoComplete.stories.d.ts +2 -1
- package/inputs/AutoCompleteInput/AutoComplete.stories.js.map +7 -0
- package/inputs/AutoCompleteInput/__stories__/Default/index.js +46 -42
- package/inputs/AutoCompleteInput/__stories__/Default.d.ts +3 -2
- package/inputs/AutoCompleteInput/__stories__/Default.js.map +7 -0
- package/inputs/AutoCompleteInput/__stories__/Multiple/index.js +51 -0
- package/inputs/AutoCompleteInput/__stories__/Multiple/package.json +6 -0
- package/inputs/AutoCompleteInput/__stories__/Multiple.d.ts +3 -0
- package/inputs/AutoCompleteInput/__stories__/Multiple.js.map +7 -0
- package/inputs/AutoCompleteInput/index.d.ts +1 -1
- package/inputs/AutoCompleteInput/index.js +58 -37
- package/inputs/AutoCompleteInput/index.js.map +7 -0
- package/inputs/AutoCompleteInput/index.test.d.ts +1 -0
- package/inputs/Checkboxes/Checkboxes.stories/index.js +14 -7
- package/inputs/Checkboxes/Checkboxes.stories.d.ts +3 -3
- package/inputs/Checkboxes/Checkboxes.stories.js.map +7 -0
- package/inputs/Checkboxes/__stories__/Conditional/index.js +88 -80
- package/inputs/Checkboxes/__stories__/Conditional.d.ts +3 -2
- package/inputs/Checkboxes/__stories__/Conditional.js.map +7 -0
- package/inputs/Checkboxes/__stories__/Default/index.js +40 -36
- package/inputs/Checkboxes/__stories__/Default.d.ts +2 -2
- package/inputs/Checkboxes/__stories__/Default.js.map +7 -0
- package/inputs/Checkboxes/__stories__/WithDivider/index.js +41 -37
- package/inputs/Checkboxes/__stories__/WithDivider.d.ts +2 -2
- package/inputs/Checkboxes/__stories__/WithDivider.js.map +7 -0
- package/inputs/Checkboxes/index.js +70 -87
- package/inputs/Checkboxes/index.js.map +7 -0
- package/inputs/Checkboxes/index.test.d.ts +1 -0
- package/inputs/DateInput/DateInput.stories/index.js +10 -5
- package/inputs/DateInput/DateInput.stories.d.ts +1 -1
- package/inputs/DateInput/DateInput.stories.js.map +7 -0
- package/inputs/DateInput/__stories__/Default/index.js +23 -18
- package/inputs/DateInput/__stories__/Default.d.ts +2 -2
- package/inputs/DateInput/__stories__/Default.js.map +7 -0
- package/inputs/DateInput/index.d.ts +2 -2
- package/inputs/DateInput/index.js +89 -99
- package/inputs/DateInput/index.js.map +7 -0
- package/inputs/DateInput/index.test.d.ts +1 -0
- package/inputs/FileInput/FileInput.stories/index.js +10 -5
- package/inputs/FileInput/FileInput.stories.d.ts +1 -1
- package/inputs/FileInput/FileInput.stories.js.map +7 -0
- package/inputs/FileInput/__stories__/Default/index.js +24 -16
- package/inputs/FileInput/__stories__/Default.d.ts +2 -2
- package/inputs/FileInput/__stories__/Default.js.map +7 -0
- package/inputs/FileInput/index.js +44 -54
- package/inputs/FileInput/index.js.map +7 -0
- package/inputs/FileInput/index.test.d.ts +1 -0
- package/inputs/ImageInput/ImageInput.stories/index.js +14 -7
- package/inputs/ImageInput/ImageInput.stories.d.ts +3 -3
- package/inputs/ImageInput/ImageInput.stories.js.map +7 -0
- package/inputs/ImageInput/__stories__/Default/index.js +25 -23
- package/inputs/ImageInput/__stories__/Default.d.ts +2 -2
- package/inputs/ImageInput/__stories__/Default.js.map +7 -0
- package/inputs/ImageInput/__stories__/WithInvalidImageDimension/index.js +32 -30
- package/inputs/ImageInput/__stories__/WithInvalidImageDimension.d.ts +2 -2
- package/inputs/ImageInput/__stories__/WithInvalidImageDimension.js.map +7 -0
- package/inputs/ImageInput/__stories__/WithInvalidImageSize/index.js +29 -27
- package/inputs/ImageInput/__stories__/WithInvalidImageSize.d.ts +2 -2
- package/inputs/ImageInput/__stories__/WithInvalidImageSize.js.map +7 -0
- package/inputs/ImageInput/index.js +59 -75
- package/inputs/ImageInput/index.js.map +7 -0
- package/inputs/ImageInput/index.test.d.ts +1 -0
- package/inputs/Input/Input.stories/index.js +28 -13
- package/inputs/Input/Input.stories.d.ts +10 -9
- package/inputs/Input/Input.stories.js.map +7 -0
- package/inputs/Input/__stories__/AFM/index.js +27 -19
- package/inputs/Input/__stories__/AFM.d.ts +2 -2
- package/inputs/Input/__stories__/AFM.js.map +7 -0
- package/inputs/Input/__stories__/Boolean/index.js +28 -20
- package/inputs/Input/__stories__/Boolean.d.ts +2 -2
- package/inputs/Input/__stories__/Boolean.js.map +7 -0
- package/inputs/Input/__stories__/IBAN/index.js +28 -20
- package/inputs/Input/__stories__/IBAN.d.ts +2 -2
- package/inputs/Input/__stories__/IBAN.js.map +7 -0
- package/inputs/Input/__stories__/Integer/index.js +43 -29
- package/inputs/Input/__stories__/Integer.d.ts +2 -2
- package/inputs/Input/__stories__/Integer.js.map +7 -0
- package/inputs/Input/__stories__/LandlineNumber/index.js +34 -0
- package/inputs/Input/__stories__/LandlineNumber/package.json +6 -0
- package/inputs/Input/__stories__/LandlineNumber.d.ts +3 -0
- package/inputs/Input/__stories__/LandlineNumber.js.map +7 -0
- package/inputs/Input/__stories__/MobilePhone/index.js +31 -19
- package/inputs/Input/__stories__/MobilePhone.d.ts +2 -2
- package/inputs/Input/__stories__/MobilePhone.js.map +7 -0
- package/inputs/Input/__stories__/PhoneNumber/index.js +30 -19
- package/inputs/Input/__stories__/PhoneNumber.d.ts +2 -2
- package/inputs/Input/__stories__/PhoneNumber.js.map +7 -0
- package/inputs/Input/__stories__/PostalCode/index.js +27 -21
- package/inputs/Input/__stories__/PostalCode.d.ts +2 -2
- package/inputs/Input/__stories__/PostalCode.js.map +7 -0
- package/inputs/Input/__stories__/String/index.js +31 -0
- package/inputs/Input/__stories__/{Default → String}/package.json +1 -1
- package/inputs/Input/__stories__/String.d.ts +3 -0
- package/inputs/Input/__stories__/String.js.map +7 -0
- package/inputs/Input/__stories__/TextWithLimit/index.js +31 -0
- package/inputs/Input/__stories__/TextWithLimit/package.json +6 -0
- package/inputs/Input/__stories__/TextWithLimit.d.ts +3 -0
- package/inputs/Input/__stories__/TextWithLimit.js.map +7 -0
- package/inputs/Input/index.js +56 -67
- package/inputs/Input/index.js.map +7 -0
- package/inputs/Input/index.test.d.ts +1 -0
- package/inputs/Input/inputsInputScenarios/index.js +406 -0
- package/inputs/Input/inputsInputScenarios/package.json +6 -0
- package/inputs/Input/inputsInputScenarios.d.ts +57 -0
- package/inputs/Input/inputsInputScenarios.js.map +7 -0
- package/inputs/Label/Label.stories/index.js +10 -5
- package/inputs/Label/Label.stories.d.ts +1 -1
- package/inputs/Label/Label.stories.js.map +7 -0
- package/inputs/Label/__stories__/Default/index.js +33 -23
- package/inputs/Label/__stories__/Default.d.ts +2 -2
- package/inputs/Label/__stories__/Default.js.map +7 -0
- package/inputs/Label/index.d.ts +1 -1
- package/inputs/Label/index.js +12 -17
- package/inputs/Label/index.js.map +7 -0
- package/inputs/Label/index.test.d.ts +1 -0
- package/inputs/OtpInput/OtpInput.stories/index.js +10 -5
- package/inputs/OtpInput/OtpInput.stories.d.ts +1 -1
- package/inputs/OtpInput/OtpInput.stories.js.map +7 -0
- package/inputs/OtpInput/__stories__/Default/index.js +26 -24
- package/inputs/OtpInput/__stories__/Default.d.ts +2 -2
- package/inputs/OtpInput/__stories__/Default.js.map +7 -0
- package/inputs/OtpInput/index.d.ts +9 -2
- package/inputs/OtpInput/index.js +109 -103
- package/inputs/OtpInput/index.js.map +7 -0
- package/inputs/OtpInput/index.test.d.ts +1 -0
- package/inputs/Radio/Radio.stories/index.js +14 -7
- package/inputs/Radio/Radio.stories.d.ts +3 -3
- package/inputs/Radio/Radio.stories.js.map +7 -0
- package/inputs/Radio/__stories__/Conditional/index.js +88 -80
- package/inputs/Radio/__stories__/Conditional.d.ts +3 -2
- package/inputs/Radio/__stories__/Conditional.js.map +7 -0
- package/inputs/Radio/__stories__/Default/index.js +44 -41
- package/inputs/Radio/__stories__/Default.d.ts +2 -2
- package/inputs/Radio/__stories__/Default.js.map +7 -0
- package/inputs/Radio/__stories__/WithDivider/index.js +45 -42
- package/inputs/Radio/__stories__/WithDivider.d.ts +2 -2
- package/inputs/Radio/__stories__/WithDivider.js.map +7 -0
- package/inputs/Radio/index.d.ts +4 -0
- package/inputs/Radio/index.js +99 -55
- package/inputs/Radio/index.js.map +7 -0
- package/inputs/Radio/index.test.d.ts +1 -0
- package/inputs/Select/Select.stories/index.js +10 -5
- package/inputs/Select/Select.stories.d.ts +1 -1
- package/inputs/Select/Select.stories.js.map +7 -0
- package/inputs/Select/__stories__/Default/index.js +49 -47
- package/inputs/Select/__stories__/Default.d.ts +2 -2
- package/inputs/Select/__stories__/Default.js.map +7 -0
- package/inputs/Select/index.js +24 -31
- package/inputs/Select/index.js.map +7 -0
- package/inputs/Select/index.test.d.ts +1 -0
- package/inputs/index.js +21 -9
- package/inputs/index.js.map +7 -0
- package/inputs/inputsScenarios/index.js +506 -0
- package/{validators/validators.spec → inputs/inputsScenarios}/package.json +1 -1
- package/inputs/inputsScenarios.d.ts +338 -0
- package/inputs/inputsScenarios.js.map +7 -0
- package/internal/index.js +51 -34
- package/internal.js.map +7 -0
- package/lazy/index.js +64 -0
- package/{Questions/index.spec → lazy}/package.json +1 -1
- package/lazy.d.ts +70 -0
- package/lazy.js.map +7 -0
- package/locales/el/index.js +6 -0
- package/locales/el/package.json +6 -0
- package/locales/el.d.ts +2 -0
- package/locales/el.js.map +7 -0
- package/package.json +5 -7
- package/registry/index.js +146 -134
- package/registry.d.ts +3 -0
- package/registry.js.map +7 -0
- package/src/Field/FieldBase.tsx +2 -0
- package/src/Field/FieldBaseContainer.tsx +1 -1
- package/src/Field/FieldConditional.tsx +4 -0
- package/src/Field/index.tsx +7 -1
- package/src/Field/types.tsx +7 -0
- package/src/Field/utils.ts +13 -6
- package/src/FieldArray/FieldArray.stories.js +2 -2
- package/src/FieldArray/index.test.tsx +24 -0
- package/src/FieldArray/index.tsx +12 -6
- package/src/FieldObject/index.tsx +10 -2
- package/src/Fieldset/types.tsx +3 -1
- package/src/FormBuilder/FormBuilder.stories.js +1 -1
- package/src/FormBuilder/FormBuilder.tsx +15 -3
- package/src/FormBuilder/index.test.tsx +20 -0
- package/src/FormBuilder/scenarios.test.tsx +1864 -0
- package/src/MultiplicityField/MultiplicityField.stories.js +6 -6
- package/src/MultiplicityField/__stories__/PreviewDisplay.tsx +2 -2
- package/src/MultiplicityField/__stories__/WithExactLength.tsx +1 -1
- package/src/MultiplicityField/__stories__/WithMaxLength.tsx +1 -1
- package/src/MultiplicityField/__stories__/WithMinAndMaxLength.tsx +1 -1
- package/src/MultiplicityField/__stories__/WithMinLength.tsx +1 -1
- package/src/MultiplicityField/add-objects.tsx +26 -23
- package/src/MultiplicityField/index.test.tsx +40 -0
- package/src/MultiplicityField/index.tsx +9 -9
- package/src/Questions/Questions.stories.js +1 -1
- package/src/Questions/Step/StepTitle.tsx +1 -0
- package/src/Questions/Step/index.ts +0 -1
- package/src/Questions/Step/types.tsx +1 -0
- package/src/Questions/__snapshots__/index.spec.tsx.snap +67 -586
- package/src/Questions/index.mdx +4 -4
- package/src/Questions/index.spec.tsx +3 -3
- package/src/Questions/index.test.tsx +20 -0
- package/src/Questions/types.tsx +1 -0
- package/src/index.ts +4 -1
- package/src/inputs/AutoCompleteInput/AutoComplete.stories.js +2 -1
- package/src/inputs/AutoCompleteInput/__stories__/Default.tsx +27 -18
- package/src/inputs/AutoCompleteInput/__stories__/Multiple.tsx +54 -0
- package/src/inputs/AutoCompleteInput/index.mdx +29 -0
- package/src/inputs/AutoCompleteInput/index.test.tsx +24 -0
- package/src/inputs/AutoCompleteInput/index.tsx +29 -17
- package/src/inputs/Checkboxes/Checkboxes.stories.js +3 -3
- package/src/inputs/Checkboxes/__stories__/Conditional.tsx +2 -3
- package/src/inputs/Checkboxes/index.mdx +33 -0
- package/src/inputs/Checkboxes/index.test.tsx +29 -0
- package/src/inputs/Checkboxes/index.tsx +28 -26
- package/src/inputs/DateInput/DateInput.stories.js +1 -1
- package/src/inputs/DateInput/__stories__/Default.tsx +21 -15
- package/src/inputs/DateInput/index.mdx +23 -0
- package/src/inputs/DateInput/index.test.tsx +20 -0
- package/src/inputs/DateInput/index.tsx +3 -3
- package/src/inputs/FileInput/FileInput.stories.js +1 -1
- package/src/inputs/FileInput/index.mdx +19 -0
- package/src/inputs/FileInput/index.test.tsx +20 -0
- package/src/inputs/ImageInput/ImageInput.stories.js +3 -3
- package/src/inputs/ImageInput/index.mdx +19 -0
- package/src/inputs/ImageInput/index.test.tsx +28 -0
- package/src/inputs/ImageInput/index.tsx +4 -4
- package/src/inputs/Input/Input.stories.js +10 -9
- package/src/inputs/Input/__stories__/LandlineNumber.tsx +27 -0
- package/src/inputs/Input/__stories__/MobilePhone.tsx +4 -0
- package/src/inputs/Input/__stories__/PhoneNumber.tsx +4 -1
- package/src/inputs/Input/__stories__/{Default.tsx → String.tsx} +2 -2
- package/src/inputs/Input/__stories__/{TextWithCharacterLimit.tsx → TextWithLimit.tsx} +2 -2
- package/src/inputs/Input/index.mdx +90 -3
- package/src/inputs/Input/index.test.tsx +56 -0
- package/src/inputs/Input/index.tsx +13 -13
- package/src/inputs/Input/inputsInputScenarios.ts +405 -0
- package/src/inputs/Label/Label.stories.js +1 -1
- package/src/inputs/Label/index.test.tsx +20 -0
- package/src/inputs/Label/index.tsx +1 -4
- package/src/inputs/OtpInput/OtpInput.stories.js +1 -1
- package/src/inputs/OtpInput/index.mdx +23 -0
- package/src/inputs/OtpInput/index.test.tsx +20 -0
- package/src/inputs/OtpInput/index.tsx +2 -2
- package/src/inputs/Radio/Radio.stories.js +3 -3
- package/src/inputs/Radio/__stories__/Conditional.tsx +4 -1
- package/src/inputs/Radio/index.mdx +33 -0
- package/src/inputs/Radio/index.test.tsx +28 -0
- package/src/inputs/Radio/index.tsx +65 -6
- package/src/inputs/Select/Select.stories.js +1 -1
- package/src/inputs/Select/index.mdx +17 -0
- package/src/inputs/Select/index.test.tsx +20 -0
- package/src/inputs/inputsScenarios.ts +503 -0
- package/src/lazy.js +61 -0
- package/src/locales/el.ts +3 -0
- package/src/registry.js +6 -0
- package/src/types.tsx +21 -19
- package/src/utils.ts +34 -33
- package/src/validators/index.ts +5 -0
- package/src/validators/utils/file.ts +9 -9
- package/src/validators/utils/phone.ts +143 -72
- package/src/validators/validators.spec.ts +3 -37
- package/types/index.js +1 -1
- package/types.d.ts +2 -0
- package/types.js.map +7 -0
- package/utils/index.js +56 -77
- package/utils.js.map +7 -0
- package/validators/index.js +101 -110
- package/validators/index.js.map +7 -0
- package/validators/types/index.js +1 -1
- package/validators/types.js.map +7 -0
- package/validators/utils/afm/index.js +16 -16
- package/validators/utils/afm.js.map +7 -0
- package/validators/utils/file/index.js +22 -42
- package/validators/utils/file.js.map +7 -0
- package/validators/utils/iban/index.js +14 -12
- package/validators/utils/iban.js.map +7 -0
- package/validators/utils/image/index.js +66 -106
- package/validators/utils/image.js.map +7 -0
- package/validators/utils/index.js +54 -48
- package/validators/utils/index.js.map +7 -0
- package/validators/utils/int/index.js +12 -7
- package/validators/utils/int.js.map +7 -0
- package/validators/utils/number/index.js +11 -6
- package/validators/utils/number.js.map +7 -0
- package/validators/utils/otp/index.js +13 -8
- package/validators/utils/otp.js.map +7 -0
- package/validators/utils/phone/index.js +146 -82
- package/validators/utils/phone.d.ts +2 -2
- package/validators/utils/phone.js.map +7 -0
- package/validators/utils/postal_code/index.js +14 -11
- package/validators/utils/postal_code.js.map +7 -0
- package/validators/utils/text_limit/index.js +18 -20
- package/validators/utils/text_limit.js.map +7 -0
- package/validators/utils/uuid4/index.js +12 -8
- package/validators/utils/uuid4.js.map +7 -0
- package/Field/index.mdx +0 -6
- package/FieldArray/FieldArray.stories.playwright.json +0 -353
- package/FormBuilder/FormBuilder.mdx +0 -256
- package/FormBuilder/FormBuilder.stories.playwright.json +0 -52
- package/MultiplicityField/MultiplicityField.mdx +0 -590
- package/MultiplicityField/MultiplicityField.stories.playwright.json +0 -1370
- package/Questions/__snapshots__/index.spec.tsx.snap +0 -596
- package/Questions/index.mdx +0 -415
- package/Questions/index.spec/index.js +0 -59
- package/cjs/Field/index.mdx +0 -6
- package/cjs/FieldArray/FieldArray.stories.playwright.json +0 -353
- package/cjs/FormBuilder/FormBuilder.mdx +0 -256
- package/cjs/FormBuilder/FormBuilder.stories.playwright.json +0 -52
- package/cjs/MultiplicityField/MultiplicityField.mdx +0 -590
- package/cjs/MultiplicityField/MultiplicityField.stories.playwright.json +0 -1370
- package/cjs/Questions/__snapshots__/index.spec.tsx.snap +0 -596
- package/cjs/Questions/index.mdx +0 -415
- package/cjs/Questions/index.spec/index.js +0 -63
- package/cjs/create-simple-form.mdx +0 -539
- package/cjs/index.mdx +0 -51
- package/cjs/inputs/Checkboxes/Checkboxes.stories.playwright.json +0 -85
- package/cjs/inputs/Checkboxes/index.mdx +0 -0
- package/cjs/inputs/DateInput/DateInput.stories.playwright.json +0 -72
- package/cjs/inputs/FileInput/FileInput.stories.playwright.json +0 -75
- package/cjs/inputs/ImageInput/ImageInput.stories.playwright.json +0 -77
- package/cjs/inputs/Input/Input.stories.playwright.json +0 -376
- package/cjs/inputs/Input/__stories__/Default/index.js +0 -33
- package/cjs/inputs/Input/__stories__/TextWithCharacterLimit/index.js +0 -39
- package/cjs/inputs/Input/index.mdx +0 -8
- package/cjs/inputs/Label/Label.stories.playwright.json +0 -40
- package/cjs/inputs/Label/index.mdx +0 -0
- package/cjs/inputs/Radio/Radio.stories.playwright.json +0 -73
- package/cjs/inputs/Radio/index.mdx +0 -0
- package/cjs/inputs/Select/Select.stories.playwright.json +0 -22
- package/cjs/installation.mdx +0 -68
- package/cjs/validators/validators.spec/index.js +0 -87
- package/create-simple-form.mdx +0 -539
- package/index.mdx +0 -51
- package/inputs/Checkboxes/Checkboxes.stories.playwright.json +0 -85
- package/inputs/Checkboxes/index.mdx +0 -0
- package/inputs/DateInput/DateInput.stories.playwright.json +0 -72
- package/inputs/FileInput/FileInput.stories.playwright.json +0 -75
- package/inputs/ImageInput/ImageInput.stories.playwright.json +0 -77
- package/inputs/Input/Input.stories.playwright.json +0 -376
- package/inputs/Input/__stories__/Default/index.js +0 -23
- package/inputs/Input/__stories__/Default.d.ts +0 -3
- package/inputs/Input/__stories__/TextWithCharacterLimit/index.js +0 -29
- package/inputs/Input/__stories__/TextWithCharacterLimit/package.json +0 -6
- package/inputs/Input/__stories__/TextWithCharacterLimit.d.ts +0 -3
- package/inputs/Input/index.mdx +0 -8
- package/inputs/Label/Label.stories.playwright.json +0 -40
- package/inputs/Label/index.mdx +0 -0
- package/inputs/Radio/Radio.stories.playwright.json +0 -73
- package/inputs/Radio/index.mdx +0 -0
- package/inputs/Select/Select.stories.playwright.json +0 -22
- package/installation.mdx +0 -68
- package/src/FieldArray/FieldArray.stories.playwright.json +0 -353
- package/src/FormBuilder/FormBuilder.stories.playwright.json +0 -52
- package/src/MultiplicityField/MultiplicityField.stories.playwright.json +0 -1370
- package/src/inputs/Checkboxes/Checkboxes.stories.playwright.json +0 -85
- package/src/inputs/DateInput/DateInput.stories.playwright.json +0 -72
- package/src/inputs/FileInput/FileInput.stories.playwright.json +0 -75
- package/src/inputs/ImageInput/ImageInput.stories.playwright.json +0 -77
- package/src/inputs/Input/Input.stories.playwright.json +0 -376
- package/src/inputs/Label/Label.stories.playwright.json +0 -40
- package/src/inputs/Radio/Radio.stories.playwright.json +0 -73
- package/src/inputs/Select/Select.stories.playwright.json +0 -22
- package/validators/validators.spec/index.js +0 -85
|
@@ -1,29 +1,50 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
Object.
|
|
5
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var Label_exports = {};
|
|
29
|
+
__export(Label_exports, {
|
|
30
|
+
Label: () => Label,
|
|
31
|
+
default: () => Label_default
|
|
6
32
|
});
|
|
7
|
-
exports
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
label = _ref.label,
|
|
15
|
-
value = _ref.value;
|
|
16
|
-
var _useTranslation = (0, _i18n.useTranslation)(),
|
|
17
|
-
t = _useTranslation.t;
|
|
33
|
+
module.exports = __toCommonJS(Label_exports);
|
|
34
|
+
var import_react = __toESM(require("react"));
|
|
35
|
+
var import_Hint = __toESM(require("@digigov/react-core/Hint"));
|
|
36
|
+
var import_LabelTitle = __toESM(require("@digigov/react-core/LabelTitle"));
|
|
37
|
+
var import_i18n = require("@digigov/ui/i18n");
|
|
38
|
+
const Label = ({ className, label, value }) => {
|
|
39
|
+
const { t } = (0, import_i18n.useTranslation)();
|
|
18
40
|
if ((!label || label && !label.primary && !label.secondary) && !value) {
|
|
19
41
|
return null;
|
|
20
42
|
}
|
|
21
|
-
return
|
|
22
|
-
className: className,
|
|
23
|
-
size: "sm"
|
|
24
|
-
}, label && label.primary && t(label.primary) || value), label && label.secondary && /*#__PURE__*/_react["default"].createElement(_Hint["default"], null, t(label.secondary)));
|
|
43
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(import_LabelTitle.default, { className, size: "sm" }, label && label.primary && t(label.primary) || value), label && label.secondary && /* @__PURE__ */ import_react.default.createElement(import_Hint.default, null, t(label.secondary)));
|
|
25
44
|
};
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
45
|
+
var Label_default = Label;
|
|
46
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
47
|
+
0 && (module.exports = {
|
|
48
|
+
Label
|
|
49
|
+
});
|
|
50
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/inputs/Label/index.tsx"],
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport { FieldLabelProps } from '@digigov/form/types';\nimport Hint from '@digigov/react-core/Hint';\nimport LabelTitle from '@digigov/react-core/LabelTitle';\nimport { useTranslation } from '@digigov/ui/i18n';\n\nexport interface FieldOptionProps {\n label?: FieldLabelProps;\n value: string;\n show?: string[];\n disabled?: boolean;\n selected?: () => React.ReactNode;\n divider?: string;\n}\n\nexport interface LabelProps {\n primary?: string;\n secondary?: string;\n}\n\nexport interface LabelProps {\n className?: string;\n value?: string;\n label?: FieldLabelProps;\n}\n\nexport const Label: React.FC<LabelProps> = ({ className, label, value }) => {\n const { t } = useTranslation();\n if ((!label || (label && !label.primary && !label.secondary)) && !value) {\n return null;\n }\n return (\n <>\n <LabelTitle className={className} size=\"sm\">\n {(label && label.primary && t(label.primary)) || value}\n </LabelTitle>\n {label && label.secondary && <Hint>{t(label.secondary)}</Hint>}\n </>\n );\n};\n\n\nexport default Label;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAElB,kBAAiB;AACjB,wBAAuB;AACvB,kBAA+B;AAsBxB,MAAM,QAA8B,CAAC,EAAE,WAAW,OAAO,MAAM,MAAM;AAC1E,QAAM,EAAE,EAAE,QAAI,4BAAe;AAC7B,OAAK,CAAC,SAAU,SAAS,CAAC,MAAM,WAAW,CAAC,MAAM,cAAe,CAAC,OAAO;AACvE,WAAO;AAAA,EACT;AACA,SACE,6BAAAA,QAAA,2BAAAA,QAAA,gBACE,6BAAAA,QAAA,cAAC,kBAAAC,SAAA,EAAW,WAAsB,MAAK,QACnC,SAAS,MAAM,WAAW,EAAE,MAAM,OAAO,KAAM,KACnD,GACC,SAAS,MAAM,aAAa,6BAAAD,QAAA,cAAC,YAAAE,SAAA,MAAM,EAAE,MAAM,SAAS,CAAE,CACzD;AAEJ;AAGA,IAAO,gBAAQ;",
|
|
6
|
+
"names": ["React", "LabelTitle", "Hint"]
|
|
7
|
+
}
|
|
@@ -1,26 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
Object.
|
|
5
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var OtpInput_stories_exports = {};
|
|
29
|
+
__export(OtpInput_stories_exports, {
|
|
30
|
+
Default: () => import_Default.Default,
|
|
31
|
+
default: () => OtpInput_stories_default
|
|
6
32
|
});
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return _Default[key];
|
|
19
|
-
}
|
|
20
|
-
});
|
|
33
|
+
module.exports = __toCommonJS(OtpInput_stories_exports);
|
|
34
|
+
var import_OtpInput = __toESM(require("@digigov/form/inputs/OtpInput"));
|
|
35
|
+
var import_Default = require("@digigov/form/inputs/OtpInput/__stories__/Default");
|
|
36
|
+
var OtpInput_stories_default = {
|
|
37
|
+
title: "Digigov Form/inputs/OtpInput",
|
|
38
|
+
component: import_OtpInput.default,
|
|
39
|
+
displayName: "OtpInput"
|
|
40
|
+
};
|
|
41
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
42
|
+
0 && (module.exports = {
|
|
43
|
+
Default
|
|
21
44
|
});
|
|
22
|
-
|
|
23
|
-
title: 'Digigov Form/inputs/OtpInput',
|
|
24
|
-
component: _OtpInput["default"],
|
|
25
|
-
displayName: 'OtpInput'
|
|
26
|
-
};
|
|
45
|
+
//# sourceMappingURL=OtpInput.stories.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/inputs/OtpInput/OtpInput.stories.js"],
|
|
4
|
+
"sourcesContent": ["import OtpInput from '@digigov/form/inputs/OtpInput';\nexport default {\n title: 'Digigov Form/inputs/OtpInput',\n component: OtpInput,\n displayName: 'OtpInput',\n};\nexport { Default } from '@digigov/form/inputs/OtpInput/__stories__/Default';\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAqB;AAMrB,qBAAwB;AALxB,IAAO,2BAAQ;AAAA,EACb,OAAO;AAAA,EACP,WAAW,gBAAAA;AAAA,EACX,aAAa;AACf;",
|
|
6
|
+
"names": ["OtpInput"]
|
|
7
|
+
}
|
|
@@ -1,39 +1,64 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
Object.
|
|
6
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var Default_exports = {};
|
|
29
|
+
__export(Default_exports, {
|
|
30
|
+
Default: () => Default,
|
|
31
|
+
default: () => Default_default
|
|
7
32
|
});
|
|
8
|
-
exports
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
33
|
+
module.exports = __toCommonJS(Default_exports);
|
|
34
|
+
var import_react = __toESM(require("react"));
|
|
35
|
+
var import_form = __toESM(require("@digigov/form"));
|
|
36
|
+
var import_Button = require("@digigov/ui/form/Button");
|
|
37
|
+
const FIELDS = [
|
|
38
|
+
{
|
|
39
|
+
key: "otp",
|
|
40
|
+
type: "otp",
|
|
41
|
+
maxLength: 6,
|
|
42
|
+
required: true,
|
|
43
|
+
label: {
|
|
44
|
+
primary: "\u039A\u03C9\u03B4\u03B9\u03BA\u03CC\u03C2 \u0395\u03C0\u03B9\u03B2\u03B5\u03B2\u03B1\u03AF\u03C9\u03C3\u03B7\u03C2"
|
|
45
|
+
}
|
|
21
46
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
var Default = exports.Default = function Default() {
|
|
27
|
-
return /*#__PURE__*/_react["default"].createElement(_form["default"], {
|
|
47
|
+
];
|
|
48
|
+
const Default = () => /* @__PURE__ */ import_react.default.createElement(
|
|
49
|
+
import_form.default,
|
|
50
|
+
{
|
|
28
51
|
fields: FIELDS,
|
|
29
|
-
onSubmit:
|
|
52
|
+
onSubmit: (data) => {
|
|
30
53
|
console.log(data);
|
|
31
54
|
}
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
55
|
+
},
|
|
56
|
+
/* @__PURE__ */ import_react.default.createElement(import_form.Fieldset, null, FIELDS.map((field) => /* @__PURE__ */ import_react.default.createElement(import_form.Field, { key: field.key, name: field.key }))),
|
|
57
|
+
/* @__PURE__ */ import_react.default.createElement(import_Button.Button, { type: "submit" }, "\u03A3\u03C5\u03BD\u03AD\u03C7\u03B5\u03B9\u03B1")
|
|
58
|
+
);
|
|
59
|
+
var Default_default = Default;
|
|
60
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
61
|
+
0 && (module.exports = {
|
|
62
|
+
Default
|
|
63
|
+
});
|
|
64
|
+
//# sourceMappingURL=Default.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/inputs/OtpInput/__stories__/Default.tsx"],
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport FormBuilder, { Field, Fieldset } from '@digigov/form';\nimport { FieldSpec } from '@digigov/form/types';\nimport { Button } from '@digigov/ui/form/Button';\nconst FIELDS: FieldSpec[] = [\n {\n key: 'otp',\n type: 'otp',\n maxLength: 6,\n required: true,\n label: {\n primary: '\u039A\u03C9\u03B4\u03B9\u03BA\u03CC\u03C2 \u0395\u03C0\u03B9\u03B2\u03B5\u03B2\u03B1\u03AF\u03C9\u03C3\u03B7\u03C2',\n },\n },\n];\n\nexport const Default = () => (\n <FormBuilder\n fields={FIELDS}\n onSubmit={(data) => {\n console.log(data);\n }}\n >\n <Fieldset>\n {FIELDS.map((field) => (\n <Field key={field.key} name={field.key} />\n ))}\n </Fieldset>\n <Button type=\"submit\">\u03A3\u03C5\u03BD\u03AD\u03C7\u03B5\u03B9\u03B1</Button>\n </FormBuilder>\n);\nexport default Default;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAClB,kBAA6C;AAE7C,oBAAuB;AACvB,MAAM,SAAsB;AAAA,EAC1B;AAAA,IACE,KAAK;AAAA,IACL,MAAM;AAAA,IACN,WAAW;AAAA,IACX,UAAU;AAAA,IACV,OAAO;AAAA,MACL,SAAS;AAAA,IACX;AAAA,EACF;AACF;AAEO,MAAM,UAAU,MACrB,6BAAAA,QAAA;AAAA,EAAC,YAAAC;AAAA,EAAA;AAAA,IACC,QAAQ;AAAA,IACR,UAAU,CAAC,SAAS;AAClB,cAAQ,IAAI,IAAI;AAAA,IAClB;AAAA;AAAA,EAEA,6BAAAD,QAAA,cAAC,4BACE,OAAO,IAAI,CAAC,UACX,6BAAAA,QAAA,cAAC,qBAAM,KAAK,MAAM,KAAK,MAAM,MAAM,KAAK,CACzC,CACH;AAAA,EACA,6BAAAA,QAAA,cAAC,wBAAO,MAAK,YAAS,kDAAQ;AAChC;AAEF,IAAO,kBAAQ;",
|
|
6
|
+
"names": ["React", "FormBuilder"]
|
|
7
|
+
}
|
|
@@ -1,150 +1,180 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
Object.
|
|
6
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var OtpInput_exports = {};
|
|
29
|
+
__export(OtpInput_exports, {
|
|
30
|
+
OtpInput: () => OtpInput,
|
|
31
|
+
REMOVE_SPACES: () => REMOVE_SPACES,
|
|
32
|
+
RE_DIGIT: () => RE_DIGIT,
|
|
33
|
+
default: () => OtpInput_default,
|
|
34
|
+
useOtp: () => useOtp
|
|
7
35
|
});
|
|
8
|
-
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
14
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
15
|
-
var _SingleCharacterInputs = _interopRequireWildcard(require("@digigov/ui/cjs/form/SingleCharacterInputs"));
|
|
16
|
-
var _excluded = ["name", "maxLength"];
|
|
17
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
18
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
19
|
-
var RE_DIGIT = exports.RE_DIGIT = new RegExp(/^\d+$/);
|
|
20
|
-
var REMOVE_SPACES = exports.REMOVE_SPACES = new RegExp(/\s+/g);
|
|
36
|
+
module.exports = __toCommonJS(OtpInput_exports);
|
|
37
|
+
var import_react = __toESM(require("react"));
|
|
38
|
+
var import_SingleCharacterInputs = __toESM(require("@digigov/ui/form/SingleCharacterInputs"));
|
|
39
|
+
const RE_DIGIT = new RegExp(/^\d+$/);
|
|
40
|
+
const REMOVE_SPACES = new RegExp(/\s+/g);
|
|
21
41
|
function useOtp(onChange, maxLength) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
onChange
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
42
|
+
const [otpValues, setOtpValues] = (0, import_react.useState)(Array(maxLength).fill(""));
|
|
43
|
+
const handleChange = (0, import_react.useCallback)(
|
|
44
|
+
(otp) => {
|
|
45
|
+
setOtpValues(otp);
|
|
46
|
+
const otpValue = otp.join("");
|
|
47
|
+
onChange(otpValue);
|
|
48
|
+
},
|
|
49
|
+
[onChange]
|
|
50
|
+
);
|
|
51
|
+
const setOtp = (item, idx) => {
|
|
52
|
+
const updatedOTPValues = [...otpValues];
|
|
33
53
|
if (item.length === 1 || item.length === 0) {
|
|
34
|
-
updatedOTPValues[idx] = item[0] ||
|
|
54
|
+
updatedOTPValues[idx] = item[0] || "";
|
|
35
55
|
handleChange(updatedOTPValues);
|
|
36
56
|
} else if (item.length === maxLength) {
|
|
37
|
-
|
|
57
|
+
const valueArray = item.split("").slice(0, maxLength);
|
|
38
58
|
handleChange(valueArray);
|
|
39
59
|
}
|
|
40
60
|
};
|
|
41
|
-
|
|
61
|
+
const setSelectionRange = (0, import_react.useCallback)((target) => {
|
|
42
62
|
return target.setSelectionRange(0, target.value.length);
|
|
43
63
|
}, []);
|
|
44
|
-
|
|
45
|
-
|
|
64
|
+
const focusToNextInput = (0, import_react.useCallback)((target) => {
|
|
65
|
+
const nextElement = target.nextElementSibling;
|
|
46
66
|
if (nextElement) {
|
|
47
67
|
nextElement.focus();
|
|
48
68
|
}
|
|
49
69
|
}, []);
|
|
50
|
-
|
|
51
|
-
|
|
70
|
+
const focusToPrevInput = (0, import_react.useCallback)((target) => {
|
|
71
|
+
const previousElement = target.previousElementSibling;
|
|
52
72
|
if (previousElement) {
|
|
53
73
|
previousElement.focus();
|
|
54
74
|
}
|
|
55
75
|
}, []);
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
if (key === 'ArrowLeft' || key === 'ArrowUp') {
|
|
66
|
-
e.preventDefault();
|
|
67
|
-
return focusToPrevInput(target);
|
|
68
|
-
}
|
|
69
|
-
if (e.key === 'Backspace' || e.key === 'Delete') {
|
|
70
|
-
if (targetValue !== '') {
|
|
71
|
-
targetValue = '';
|
|
72
|
-
} else {
|
|
73
|
-
focusToPrevInput(target);
|
|
76
|
+
const handleKeyDown = (0, import_react.useCallback)(
|
|
77
|
+
(e, idx) => {
|
|
78
|
+
const { key } = e;
|
|
79
|
+
const target = e.target;
|
|
80
|
+
let targetValue = target.value;
|
|
81
|
+
setSelectionRange(target);
|
|
82
|
+
if (key === "ArrowRight" || key === "ArrowDown") {
|
|
83
|
+
e.preventDefault();
|
|
84
|
+
return focusToNextInput(target);
|
|
74
85
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}, [setOtp, focusToPrevInput, focusToNextInput]);
|
|
79
|
-
var handleFocus = (0, _react.useCallback)(function (e) {
|
|
80
|
-
var target = e.target;
|
|
81
|
-
setSelectionRange(target);
|
|
82
|
-
}, [setSelectionRange]);
|
|
83
|
-
var handleOtpChange = (0, _react.useCallback)(function (e, idx) {
|
|
84
|
-
var target = e.target;
|
|
85
|
-
var targetValue = target.value;
|
|
86
|
-
var isTargetValueDigit = RE_DIGIT.test(targetValue);
|
|
87
|
-
// We want to pass the empty string when the value is deleted
|
|
88
|
-
// emptry string replaces the deleted value
|
|
89
|
-
if (isTargetValueDigit || targetValue === '') {
|
|
90
|
-
setOtp(targetValue, idx);
|
|
91
|
-
if (target.value.length > 1) {
|
|
92
|
-
target.blur();
|
|
86
|
+
if (key === "ArrowLeft" || key === "ArrowUp") {
|
|
87
|
+
e.preventDefault();
|
|
88
|
+
return focusToPrevInput(target);
|
|
93
89
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
90
|
+
if (e.key === "Backspace" || e.key === "Delete") {
|
|
91
|
+
if (targetValue !== "") {
|
|
92
|
+
targetValue = "";
|
|
93
|
+
} else {
|
|
94
|
+
focusToPrevInput(target);
|
|
95
|
+
}
|
|
96
|
+
setOtp(targetValue, idx);
|
|
97
|
+
return e.preventDefault();
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
[setOtp, focusToPrevInput, focusToNextInput]
|
|
101
|
+
);
|
|
102
|
+
const handleFocus = (0, import_react.useCallback)(
|
|
103
|
+
(e) => {
|
|
104
|
+
const { target } = e;
|
|
105
|
+
setSelectionRange(target);
|
|
106
|
+
},
|
|
107
|
+
[setSelectionRange]
|
|
108
|
+
);
|
|
109
|
+
const handleOtpChange = (0, import_react.useCallback)(
|
|
110
|
+
(e, idx) => {
|
|
111
|
+
const target = e.target;
|
|
112
|
+
const targetValue = target.value;
|
|
113
|
+
const isTargetValueDigit = RE_DIGIT.test(targetValue);
|
|
114
|
+
if (isTargetValueDigit || targetValue === "") {
|
|
115
|
+
setOtp(targetValue, idx);
|
|
116
|
+
if (target.value.length > 1) {
|
|
117
|
+
target.blur();
|
|
118
|
+
}
|
|
119
|
+
focusToNextInput(target);
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
[setOtp, handleKeyDown, handleFocus]
|
|
123
|
+
);
|
|
124
|
+
const handlePaste = (0, import_react.useCallback)(
|
|
125
|
+
(e) => {
|
|
126
|
+
e.preventDefault();
|
|
127
|
+
const pastedData = e.clipboardData.getData("text/plain").replace(REMOVE_SPACES, "");
|
|
128
|
+
if (pastedData) {
|
|
129
|
+
setOtp(pastedData, 0);
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
[]
|
|
133
|
+
);
|
|
104
134
|
return {
|
|
105
|
-
otpValues
|
|
106
|
-
handleOtpChange
|
|
107
|
-
handleKeyDown
|
|
108
|
-
handleFocus
|
|
109
|
-
handlePaste
|
|
135
|
+
otpValues,
|
|
136
|
+
handleOtpChange,
|
|
137
|
+
handleKeyDown,
|
|
138
|
+
handleFocus,
|
|
139
|
+
handlePaste
|
|
110
140
|
};
|
|
111
141
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
return /*#__PURE__*/_react["default"].createElement(_SingleCharacterInputs.SingleCharacterInput, props);
|
|
142
|
+
const SingleCharacterInputPart = ({ ...props }) => {
|
|
143
|
+
return /* @__PURE__ */ import_react.default.createElement(import_SingleCharacterInputs.SingleCharacterInput, { ...props });
|
|
115
144
|
};
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
return /*#__PURE__*/_react["default"].createElement(_SingleCharacterInputs["default"], null, otp.otpValues.map(function (digit, idx) {
|
|
123
|
-
return /*#__PURE__*/_react["default"].createElement(SingleCharacterInputPart, {
|
|
124
|
-
name: "".concat(name, "-").concat(idx),
|
|
145
|
+
const OtpInput = ({ name, maxLength = 6, ...props }) => {
|
|
146
|
+
const otp = useOtp(props.onChange, maxLength);
|
|
147
|
+
return /* @__PURE__ */ import_react.default.createElement(import_SingleCharacterInputs.default, null, otp.otpValues.map((digit, idx) => /* @__PURE__ */ import_react.default.createElement(
|
|
148
|
+
SingleCharacterInputPart,
|
|
149
|
+
{
|
|
150
|
+
name: `${name}-${idx}`,
|
|
125
151
|
type: "text",
|
|
126
152
|
key: idx,
|
|
127
153
|
autoComplete: "one-time-code",
|
|
128
154
|
pattern: "\\d{1}",
|
|
129
|
-
maxLength
|
|
155
|
+
maxLength,
|
|
130
156
|
value: digit,
|
|
131
157
|
disabled: props.disabled,
|
|
132
|
-
"aria-required": props[
|
|
133
|
-
onChange:
|
|
134
|
-
|
|
135
|
-
},
|
|
136
|
-
onInput: function onInput(e) {
|
|
158
|
+
"aria-required": props["aria-required"],
|
|
159
|
+
onChange: (e) => otp.handleOtpChange(e, idx),
|
|
160
|
+
onInput: (e) => {
|
|
137
161
|
if (e.target.value === digit) {
|
|
138
162
|
otp.handleOtpChange(e, idx);
|
|
139
163
|
}
|
|
140
164
|
},
|
|
141
|
-
onKeyDown:
|
|
142
|
-
return otp.handleKeyDown(e, idx);
|
|
143
|
-
},
|
|
165
|
+
onKeyDown: (e) => otp.handleKeyDown(e, idx),
|
|
144
166
|
onFocus: otp.handleFocus,
|
|
145
167
|
onPaste: otp.handlePaste,
|
|
146
168
|
error: !digit ? props.error : false
|
|
147
|
-
}
|
|
148
|
-
|
|
169
|
+
}
|
|
170
|
+
)));
|
|
149
171
|
};
|
|
150
|
-
var
|
|
172
|
+
var OtpInput_default = OtpInput;
|
|
173
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
174
|
+
0 && (module.exports = {
|
|
175
|
+
OtpInput,
|
|
176
|
+
REMOVE_SPACES,
|
|
177
|
+
RE_DIGIT,
|
|
178
|
+
useOtp
|
|
179
|
+
});
|
|
180
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/inputs/OtpInput/index.tsx"],
|
|
4
|
+
"sourcesContent": ["import React, { useState, useCallback } from 'react';\nimport SingleCharacterInputs, {\n SingleCharacterInput,\n} from '@digigov/ui/form/SingleCharacterInputs';\n\nexport const RE_DIGIT = new RegExp(/^\\d+$/);\nexport const REMOVE_SPACES = new RegExp(/\\s+/g);\n\nexport function useOtp(onChange, maxLength) {\n const [otpValues, setOtpValues] = useState(Array<string>(maxLength).fill(''));\n const handleChange = useCallback(\n (otp: string[]) => {\n setOtpValues(otp);\n const otpValue = otp.join('');\n onChange(otpValue);\n },\n [onChange]\n );\n\n const setOtp = (item: string, idx) => {\n const updatedOTPValues = [...otpValues];\n if (item.length === 1 || item.length === 0) {\n updatedOTPValues[idx] = item[0] || '';\n handleChange(updatedOTPValues);\n } else if (item.length === maxLength) {\n const valueArray = item.split('').slice(0, maxLength);\n handleChange(valueArray);\n }\n };\n\n const setSelectionRange = useCallback((target) => {\n return target.setSelectionRange(0, target.value.length);\n }, []);\n\n const focusToNextInput = useCallback((target: HTMLElement) => {\n const nextElement = target.nextElementSibling as HTMLInputElement | null;\n if (nextElement) {\n nextElement.focus();\n }\n }, []);\n\n const focusToPrevInput = useCallback((target: HTMLElement) => {\n const previousElement = target.previousElementSibling as HTMLInputElement | null;\n if (previousElement) {\n previousElement.focus();\n }\n }, []);\n\n const handleKeyDown = useCallback(\n (e: React.KeyboardEvent<HTMLInputElement>, idx: number) => {\n const { key } = e;\n const target = e.target as HTMLInputElement;\n let targetValue = target.value;\n setSelectionRange(target);\n if (key === 'ArrowRight' || key === 'ArrowDown') {\n e.preventDefault();\n return focusToNextInput(target);\n }\n if (key === 'ArrowLeft' || key === 'ArrowUp') {\n e.preventDefault();\n return focusToPrevInput(target);\n }\n if (e.key === 'Backspace' || e.key === 'Delete') {\n if (targetValue !== '') {\n targetValue = '';\n } else {\n focusToPrevInput(target);\n }\n setOtp(targetValue, idx);\n return e.preventDefault();\n }\n },\n [setOtp, focusToPrevInput, focusToNextInput]\n );\n\n const handleFocus = useCallback(\n (e: React.FocusEvent<HTMLInputElement>) => {\n const { target } = e;\n setSelectionRange(target);\n },\n [setSelectionRange]\n );\n const handleOtpChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>, idx: number) => {\n const target = e.target;\n const targetValue = target.value;\n const isTargetValueDigit = RE_DIGIT.test(targetValue);\n // We want to pass the empty string when the value is deleted\n // emptry string replaces the deleted value\n if (isTargetValueDigit || targetValue === '') {\n setOtp(targetValue, idx);\n if (target.value.length > 1) {\n target.blur();\n }\n focusToNextInput(target);\n }\n },\n [setOtp, handleKeyDown, handleFocus]\n );\n\n const handlePaste = useCallback(\n (e: React.ClipboardEvent<HTMLInputElement>) => {\n e.preventDefault();\n const pastedData = e.clipboardData\n .getData('text/plain')\n .replace(REMOVE_SPACES, '');\n if (pastedData) {\n setOtp(pastedData, 0);\n }\n },\n []\n );\n return {\n otpValues,\n handleOtpChange,\n handleKeyDown,\n handleFocus,\n handlePaste,\n };\n}\n\nconst SingleCharacterInputPart = ({ ...props }) => {\n return <SingleCharacterInput {...props} />;\n};\n\nexport const OtpInput = ({ name, maxLength = 6, ...props }) => {\n const otp = useOtp(props.onChange, maxLength);\n return (\n <SingleCharacterInputs>\n {otp.otpValues.map((digit, idx) => (\n <SingleCharacterInputPart\n name={`${name}-${idx}`}\n type=\"text\"\n key={idx}\n autoComplete=\"one-time-code\"\n pattern=\"\\d{1}\"\n maxLength={maxLength}\n value={digit}\n disabled={props.disabled}\n aria-required={props['aria-required']}\n onChange={(e) => otp.handleOtpChange(e, idx)}\n onInput={(e) => {\n if (e.target.value === digit) {\n otp.handleOtpChange(e, idx);\n }\n }}\n onKeyDown={(e) => otp.handleKeyDown(e, idx)}\n onFocus={otp.handleFocus}\n onPaste={otp.handlePaste}\n error={!digit ? props.error : false}\n />\n ))}\n </SingleCharacterInputs>\n );\n};\n\nexport default OtpInput;\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["React", "SingleCharacterInputs"]
|
|
7
|
+
}
|