@digigov/form 2.0.0-555d1027 → 2.0.0-5e7a6790
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/ErrorGroup.d.ts +3 -3
- package/Field/ErrorGroup.js.map +1 -1
- package/Field/FieldBase/index.js +0 -1
- package/Field/FieldBase.d.ts +1 -1
- package/Field/FieldBase.js.map +2 -2
- package/Field/FieldBaseContainer/index.js +36 -34
- package/Field/FieldBaseContainer.d.ts +2 -2
- package/Field/FieldBaseContainer.js.map +2 -2
- package/Field/FieldConditional.d.ts +1 -1
- package/Field/FieldConditional.js.map +1 -1
- package/Field/index.d.ts +1 -1
- package/Field/index.js +15 -25
- package/Field/index.js.map +2 -2
- package/Field/types.d.ts +11 -10
- package/Field/utils/evaluateFieldWithConditions.d.ts +2 -2
- package/Field/utils/evaluateFieldWithConditions.js.map +2 -2
- package/Field/utils/resolveField/index.js +35 -0
- package/Field/utils/{calculateField → resolveField}/package.json +1 -1
- package/Field/utils/resolveField.d.ts +3 -0
- package/Field/utils/resolveField.js.map +7 -0
- package/Field/utils/useField/index.js +4 -2
- package/Field/utils/useField.d.ts +1 -1
- package/Field/utils/useField.js.map +2 -2
- package/FieldArray/BaseFieldArray/index.js +76 -0
- package/{inputs/inputsScenarios → FieldArray/BaseFieldArray}/package.json +1 -1
- package/FieldArray/BaseFieldArray.d.ts +5 -0
- package/FieldArray/BaseFieldArray.js.map +7 -0
- package/FieldArray/FormDialog/ArrayDisplay/ArrayDisplay.stories.d.ts +10 -0
- package/FieldArray/FormDialog/ArrayDisplay/ArrayItemDisplay/index.js +97 -0
- package/FieldArray/FormDialog/ArrayDisplay/ArrayItemDisplay/package.json +6 -0
- package/FieldArray/FormDialog/ArrayDisplay/ArrayItemDisplay.d.ts +22 -0
- package/FieldArray/FormDialog/ArrayDisplay/ArrayItemDisplay.js.map +7 -0
- package/FieldArray/FormDialog/ArrayDisplay/ArrayItemHeader/index.js +11 -0
- package/FieldArray/FormDialog/ArrayDisplay/ArrayItemHeader/package.json +6 -0
- package/FieldArray/FormDialog/ArrayDisplay/ArrayItemHeader.d.ts +5 -0
- package/FieldArray/FormDialog/ArrayDisplay/ArrayItemHeader.js.map +7 -0
- package/FieldArray/FormDialog/ArrayDisplay/__stories__/Default.d.ts +2 -0
- package/FieldArray/FormDialog/ArrayDisplay/__stories__/ReadOnly.d.ts +2 -0
- package/FieldArray/FormDialog/ArrayDisplay/__stories__/Sortable.d.ts +2 -0
- package/FieldArray/FormDialog/ArrayDisplay/index.d.ts +14 -0
- package/FieldArray/FormDialog/ArrayDisplay/index.js +51 -0
- package/FieldArray/FormDialog/ArrayDisplay/index.js.map +7 -0
- package/FieldArray/FormDialog/ArrayDisplay/package.json +6 -0
- package/FieldArray/FormDialog/ArrayEditModal/index.js +149 -0
- package/FieldArray/FormDialog/ArrayEditModal/package.json +6 -0
- package/FieldArray/FormDialog/ArrayEditModal.d.ts +26 -0
- package/FieldArray/FormDialog/ArrayEditModal.js.map +7 -0
- package/FieldArray/FormDialog/index.d.ts +19 -0
- package/FieldArray/FormDialog/index.js +139 -348
- package/FieldArray/FormDialog/index.js.map +7 -0
- package/FieldArray/index.d.ts +4 -2
- package/FieldArray/index.js +28 -54
- package/FieldArray/index.js.map +2 -2
- package/FieldObject/index.d.ts +4 -4
- package/FieldObject/index.js +5 -12
- package/FieldObject/index.js.map +2 -2
- package/Fieldset/FieldsetWithContext.js.map +1 -1
- package/Fieldset/index.d.ts +1 -1
- package/Fieldset/index.js.map +1 -1
- package/Fieldset/types.d.ts +2 -2
- package/FormBuilder/index.d.ts +1 -1
- package/FormBuilder/index.js +155 -130
- package/FormBuilder/index.js.map +2 -2
- package/FormContext.d.ts +2 -2
- package/FormContext.js.map +2 -2
- package/MultiplicityField/add-objects/index.js +10 -19
- package/MultiplicityField/add-objects.d.ts +1 -1
- package/MultiplicityField/add-objects.js.map +2 -2
- package/MultiplicityField/index.d.ts +2 -2
- package/MultiplicityField/index.js.map +2 -2
- package/MultiplicityField/types.d.ts +2 -2
- package/Questions/Questions.d.ts +1 -1
- package/Questions/Questions.js.map +1 -1
- package/Questions/QuestionsContext.d.ts +1 -1
- package/Questions/QuestionsContext.js.map +1 -1
- package/Questions/Step/Step.d.ts +1 -1
- package/Questions/Step/Step.js.map +1 -1
- package/Questions/Step/StepArrayReview.d.ts +1 -1
- package/Questions/Step/StepArrayReview.js.map +1 -1
- package/Questions/Step/StepContext.d.ts +1 -1
- package/Questions/Step/StepContext.js.map +1 -1
- package/Questions/Step/StepDescription.d.ts +1 -1
- package/Questions/Step/StepDescription.js.map +2 -2
- package/Questions/Step/StepForm.d.ts +2 -2
- package/Questions/Step/StepForm.js.map +1 -1
- package/Questions/Step/StepQuote.d.ts +1 -1
- package/Questions/Step/StepQuote.js.map +2 -2
- package/Questions/Step/StepTitle.d.ts +1 -1
- package/Questions/Step/StepTitle.js.map +2 -2
- package/Questions/Step/getAddMoreFields.d.ts +2 -2
- package/Questions/Step/getAddMoreFields.js.map +1 -1
- package/Questions/Step/types.d.ts +1 -1
- package/Questions/getNextStep.d.ts +1 -1
- package/Questions/getNextStep.js.map +1 -1
- package/Questions/types.d.ts +1 -1
- package/cjs/Field/ErrorGroup.js.map +1 -1
- package/cjs/Field/FieldBase/index.js +0 -1
- package/cjs/Field/FieldBase.js.map +2 -2
- package/cjs/Field/FieldBaseContainer/index.js +36 -34
- package/cjs/Field/FieldBaseContainer.js.map +2 -2
- package/cjs/Field/FieldConditional.js.map +1 -1
- package/cjs/Field/index.js +15 -22
- package/cjs/Field/index.js.map +2 -2
- package/cjs/Field/types.js.map +1 -1
- package/cjs/Field/utils/evaluateFieldWithConditions.js.map +2 -2
- package/cjs/Field/utils/resolveField/index.js +55 -0
- package/cjs/Field/utils/resolveField.js.map +7 -0
- package/cjs/Field/utils/useField/index.js +4 -2
- package/cjs/Field/utils/useField.js.map +2 -2
- package/cjs/FieldArray/BaseFieldArray/index.js +109 -0
- package/cjs/FieldArray/BaseFieldArray.js.map +7 -0
- package/cjs/FieldArray/FormDialog/ArrayDisplay/ArrayItemDisplay/index.js +130 -0
- package/cjs/FieldArray/FormDialog/ArrayDisplay/ArrayItemDisplay.js.map +7 -0
- package/cjs/{locales/el → FieldArray/FormDialog/ArrayDisplay/ArrayItemHeader}/index.js +16 -7
- package/cjs/FieldArray/FormDialog/ArrayDisplay/ArrayItemHeader.js.map +7 -0
- package/cjs/FieldArray/FormDialog/ArrayDisplay/index.js +84 -0
- package/cjs/FieldArray/FormDialog/ArrayDisplay/index.js.map +7 -0
- package/cjs/FieldArray/FormDialog/ArrayEditModal/index.js +177 -0
- package/cjs/FieldArray/FormDialog/ArrayEditModal.js.map +7 -0
- package/cjs/FieldArray/FormDialog/index.js +130 -331
- package/cjs/FieldArray/FormDialog/index.js.map +7 -0
- package/cjs/FieldArray/index.js +27 -53
- package/cjs/FieldArray/index.js.map +3 -3
- package/cjs/FieldObject/index.js +5 -9
- package/cjs/FieldObject/index.js.map +2 -2
- package/cjs/Fieldset/FieldsetWithContext.js.map +1 -1
- package/cjs/Fieldset/index.js.map +1 -1
- package/cjs/Fieldset/types.js.map +1 -1
- package/cjs/FormBuilder/index.js +156 -131
- package/cjs/FormBuilder/index.js.map +3 -3
- package/cjs/FormContext.js.map +2 -2
- package/cjs/MultiplicityField/add-objects/index.js +9 -13
- package/cjs/MultiplicityField/add-objects.js.map +2 -2
- package/cjs/MultiplicityField/index.js.map +2 -2
- package/cjs/MultiplicityField/types.js.map +1 -1
- package/cjs/Questions/Questions.js.map +1 -1
- package/cjs/Questions/QuestionsContext.js.map +1 -1
- package/cjs/Questions/Step/Step.js.map +1 -1
- package/cjs/Questions/Step/StepArrayReview.js.map +1 -1
- package/cjs/Questions/Step/StepContext.js.map +1 -1
- package/cjs/Questions/Step/StepDescription.js.map +2 -2
- package/cjs/Questions/Step/StepForm.js.map +1 -1
- package/cjs/Questions/Step/StepQuote.js.map +2 -2
- package/cjs/Questions/Step/StepTitle.js.map +2 -2
- package/cjs/Questions/Step/getAddMoreFields.js.map +1 -1
- package/cjs/Questions/Step/types.js.map +1 -1
- package/cjs/Questions/getNextStep.js.map +1 -1
- package/cjs/Questions/types.js.map +1 -1
- package/cjs/hooks/useFieldFocusManager/index.js +135 -0
- package/cjs/hooks/useFieldFocusManager.js.map +7 -0
- package/cjs/hooks/utils/index.js +98 -0
- package/cjs/hooks/utils.js.map +7 -0
- package/cjs/inputs/AutoCompleteInput/index.js.map +2 -2
- package/cjs/inputs/Checkboxes/index.js +67 -63
- package/cjs/inputs/Checkboxes/index.js.map +2 -2
- package/cjs/inputs/DateInput/index.js +10 -5
- package/cjs/inputs/DateInput/index.js.map +2 -2
- package/cjs/inputs/DateTimeInput/index.js +10 -5
- package/cjs/inputs/DateTimeInput/index.js.map +2 -2
- package/cjs/inputs/FileInput/index.js.map +2 -2
- package/cjs/inputs/ImageInput/index.js.map +1 -1
- package/cjs/inputs/Input/index.js +54 -56
- package/cjs/inputs/Input/index.js.map +2 -2
- package/cjs/inputs/Label/index.js.map +1 -1
- package/cjs/inputs/OtpInput/index.js +36 -31
- package/cjs/inputs/OtpInput/index.js.map +2 -2
- package/cjs/inputs/Radio/index.js +5 -4
- package/cjs/inputs/Radio/index.js.map +3 -3
- package/cjs/inputs/Select/index.js.map +1 -1
- package/cjs/{Field/utils → inputs/registry}/index.js +4 -4
- package/cjs/inputs/registry.js.map +7 -0
- package/cjs/{lazy/index.js → lazy.js} +10 -9
- package/cjs/lazy.js.map +2 -2
- package/cjs/{registry/index.js → registry.js} +23 -13
- package/cjs/registry.js.map +2 -2
- package/cjs/types.js.map +1 -1
- package/cjs/utils.js.map +2 -2
- package/cjs/validators/index.js.map +2 -2
- package/cjs/validators/types.js.map +1 -1
- package/cjs/validators/utils/date/index.js +6 -1
- package/cjs/validators/utils/date.js.map +2 -2
- package/cjs/validators/utils/datetime/index.js +6 -1
- package/cjs/validators/utils/datetime.js.map +2 -2
- package/cjs/validators/utils/file.js.map +1 -1
- package/cjs/validators/utils/iban.js.map +1 -1
- package/cjs/validators/utils/image.js.map +1 -1
- package/cjs/validators/utils/index.js.map +1 -1
- package/cjs/validators/utils/int.js.map +1 -1
- package/cjs/validators/utils/number.js.map +1 -1
- package/cjs/validators/utils/otp.js.map +1 -1
- package/cjs/validators/utils/phone.js.map +1 -1
- package/cjs/validators/utils/postal_code.js.map +1 -1
- package/cjs/validators/utils/text_limit.js.map +1 -1
- package/hooks/useFieldFocusManager/index.js +116 -0
- package/hooks/useFieldFocusManager/package.json +6 -0
- package/hooks/useFieldFocusManager.d.ts +25 -0
- package/hooks/useFieldFocusManager.js.map +7 -0
- package/hooks/utils/index.js +73 -0
- package/{Field → hooks}/utils/package.json +1 -1
- package/hooks/utils.d.ts +18 -0
- package/hooks/utils.js.map +7 -0
- package/index.js +1 -1
- package/inputs/AutoCompleteInput/index.d.ts +3 -3
- package/inputs/AutoCompleteInput/index.js +1 -3
- package/inputs/AutoCompleteInput/index.js.map +2 -2
- package/inputs/Checkboxes/index.d.ts +3 -3
- package/inputs/Checkboxes/index.js +67 -63
- package/inputs/Checkboxes/index.js.map +2 -2
- package/inputs/DateInput/index.d.ts +2 -5
- package/inputs/DateInput/index.js +10 -5
- package/inputs/DateInput/index.js.map +2 -2
- package/inputs/DateTimeInput/index.d.ts +2 -5
- package/inputs/DateTimeInput/index.js +10 -5
- package/inputs/DateTimeInput/index.js.map +2 -2
- package/inputs/FileInput/index.d.ts +4 -4
- package/inputs/FileInput/index.js +1 -4
- package/inputs/FileInput/index.js.map +2 -2
- package/inputs/ImageInput/index.d.ts +2 -2
- package/inputs/ImageInput/index.js.map +1 -1
- package/inputs/Input/index.d.ts +2 -2
- package/inputs/Input/index.js +54 -56
- package/inputs/Input/index.js.map +2 -2
- package/inputs/Label/index.d.ts +1 -1
- package/inputs/Label/index.js.map +1 -1
- package/inputs/OtpInput/index.d.ts +1 -5
- package/inputs/OtpInput/index.js +36 -31
- package/inputs/OtpInput/index.js.map +2 -2
- package/inputs/Radio/index.d.ts +4 -4
- package/inputs/Radio/index.js +5 -4
- package/inputs/Radio/index.js.map +3 -3
- package/inputs/Select/index.d.ts +2 -2
- package/inputs/Select/index.js.map +1 -1
- package/{Field/utils → inputs/registry}/index.js +1 -1
- package/{locales/el → inputs/registry}/package.json +1 -1
- package/{Field/utils/index.d.ts → inputs/registry.d.ts} +2 -1
- package/inputs/registry.js.map +7 -0
- package/lazy/index.js +10 -9
- package/package.json +4 -4
- package/registry/index.js +23 -13
- package/src/Field/ErrorGroup.tsx +3 -3
- package/src/Field/FieldBase.tsx +1 -2
- package/src/Field/FieldBaseContainer.tsx +68 -58
- package/src/Field/FieldConditional.tsx +1 -1
- package/src/Field/index.tsx +15 -33
- package/src/Field/types.tsx +11 -12
- package/src/Field/utils/evaluateFieldWithConditions.ts +5 -2
- package/src/Field/utils/resolveField.ts +58 -0
- package/src/Field/utils/useField.ts +3 -1
- package/src/FieldArray/BaseFieldArray.tsx +97 -0
- package/src/FieldArray/FormDialog/ArrayDisplay/ArrayDisplay.stories.js +11 -0
- package/src/FieldArray/FormDialog/ArrayDisplay/ArrayItemDisplay.tsx +165 -0
- package/src/FieldArray/FormDialog/ArrayDisplay/ArrayItemHeader.tsx +15 -0
- package/src/FieldArray/FormDialog/ArrayDisplay/__stories__/Default.tsx +93 -0
- package/src/FieldArray/FormDialog/ArrayDisplay/__stories__/ReadOnly.tsx +79 -0
- package/src/FieldArray/FormDialog/ArrayDisplay/__stories__/Sortable.tsx +93 -0
- package/src/FieldArray/FormDialog/ArrayDisplay/index.tsx +75 -0
- package/src/FieldArray/FormDialog/ArrayEditModal.tsx +233 -0
- package/src/FieldArray/FormDialog/index.tsx +247 -0
- package/src/FieldArray/__tests__/fieldset-multiplicity.spec.tsx +271 -0
- package/src/FieldArray/__tests__/multiplicity-attachment.spec.tsx +280 -0
- package/src/FieldArray/__tests__/multiplicity-required.spec.tsx +131 -0
- package/src/FieldArray/__tests__/nested-fieldset-multiplicity.spec.tsx +627 -0
- package/src/FieldArray/__tests__/preference-multiple-choice.spec.tsx +222 -0
- package/src/FieldArray/index.spec.tsx +355 -0
- package/src/FieldArray/index.tsx +34 -61
- package/src/FieldObject/index.tsx +9 -17
- package/src/Fieldset/FieldsetWithContext.tsx +1 -1
- package/src/Fieldset/index.tsx +1 -1
- package/src/Fieldset/types.tsx +2 -2
- package/src/FormBuilder/index.tsx +188 -142
- package/src/FormBuilder/scenarios.test.tsx +759 -1
- package/src/FormContext.tsx +3 -2
- package/src/MultiplicityField/add-objects.tsx +12 -21
- package/src/MultiplicityField/index.tsx +3 -2
- package/src/MultiplicityField/types.ts +5 -2
- package/src/Questions/Questions.tsx +2 -2
- package/src/Questions/QuestionsContext.tsx +1 -1
- package/src/Questions/Step/Step.tsx +1 -1
- package/src/Questions/Step/StepArrayReview.tsx +2 -2
- package/src/Questions/Step/StepContext.tsx +1 -1
- package/src/Questions/Step/StepDescription.tsx +2 -1
- package/src/Questions/Step/StepForm.tsx +2 -2
- package/src/Questions/Step/StepQuote.tsx +2 -1
- package/src/Questions/Step/StepTitle.tsx +2 -1
- package/src/Questions/Step/getAddMoreFields.tsx +2 -2
- package/src/Questions/Step/types.tsx +1 -1
- package/src/Questions/getNextStep.tsx +1 -1
- package/src/Questions/types.tsx +1 -1
- package/src/hooks/__tests__/useFieldFocusManager.spec.tsx +1079 -0
- package/src/hooks/__tests__/utils.spec.ts +568 -0
- package/src/hooks/useFieldFocusManager.ts +162 -0
- package/src/hooks/utils.ts +122 -0
- package/src/inputs/AutoCompleteInput/index.tsx +4 -6
- package/src/inputs/Checkboxes/index.tsx +95 -87
- package/src/inputs/DateInput/index.tsx +19 -6
- package/src/inputs/DateTimeInput/index.tsx +19 -6
- package/src/inputs/FileInput/index.tsx +9 -7
- package/src/inputs/ImageInput/index.tsx +2 -2
- package/src/inputs/Input/index.tsx +72 -71
- package/src/inputs/Label/index.tsx +1 -1
- package/src/inputs/OtpInput/index.tsx +43 -34
- package/src/inputs/Radio/index.tsx +29 -21
- package/src/inputs/Select/index.tsx +2 -2
- package/src/{Field/utils/index.ts → inputs/registry.ts} +3 -1
- package/src/lazy.js +10 -9
- package/src/registry.js +23 -13
- package/src/types.tsx +12 -5
- package/src/utils.ts +3 -2
- package/src/validators/index.ts +10 -9
- package/src/validators/types.ts +1 -1
- package/src/validators/utils/date.ts +8 -3
- package/src/validators/utils/datetime.ts +8 -3
- package/src/validators/utils/file.ts +2 -2
- package/src/validators/utils/iban.ts +2 -2
- package/src/validators/utils/image.ts +2 -2
- package/src/validators/utils/index.ts +2 -2
- package/src/validators/utils/int.ts +1 -1
- package/src/validators/utils/number.ts +1 -1
- package/src/validators/utils/otp.ts +2 -2
- package/src/validators/utils/phone.ts +2 -2
- package/src/validators/utils/postal_code.ts +2 -2
- package/src/validators/utils/text_limit.ts +2 -2
- package/types.d.ts +8 -4
- package/types.js.map +1 -1
- package/utils.d.ts +1 -1
- package/utils.js.map +2 -2
- package/validators/index.d.ts +5 -5
- package/validators/index.js.map +2 -2
- package/validators/types.d.ts +1 -1
- package/validators/utils/date/index.js +6 -1
- package/validators/utils/date.d.ts +2 -2
- package/validators/utils/date.js.map +2 -2
- package/validators/utils/datetime/index.js +6 -1
- package/validators/utils/datetime.d.ts +2 -2
- package/validators/utils/datetime.js.map +2 -2
- package/validators/utils/file.d.ts +2 -2
- package/validators/utils/file.js.map +1 -1
- package/validators/utils/iban.d.ts +2 -2
- package/validators/utils/iban.js.map +1 -1
- package/validators/utils/image.d.ts +2 -2
- package/validators/utils/image.js.map +1 -1
- package/validators/utils/index.d.ts +2 -2
- package/validators/utils/index.js.map +1 -1
- package/validators/utils/int.d.ts +1 -1
- package/validators/utils/int.js.map +1 -1
- package/validators/utils/number.d.ts +1 -1
- package/validators/utils/number.js.map +1 -1
- package/validators/utils/otp.d.ts +2 -2
- package/validators/utils/otp.js.map +1 -1
- package/validators/utils/phone.d.ts +2 -2
- package/validators/utils/phone.js.map +1 -1
- package/validators/utils/postal_code.d.ts +2 -2
- package/validators/utils/postal_code.js.map +1 -1
- package/validators/utils/text_limit.d.ts +2 -2
- package/validators/utils/text_limit.js.map +1 -1
- package/Field/utils/calculateField/index.js +0 -27
- package/Field/utils/calculateField.d.ts +0 -2
- package/Field/utils/calculateField.js.map +0 -7
- package/Field/utils/index.js.map +0 -7
- package/FieldArray/FormDialog.d.ts +0 -67
- package/FieldArray/FormDialog.js.map +0 -7
- package/FormBuilder/index.test.d.ts +0 -1
- package/FormBuilder/interaction.test.d.ts +0 -1
- package/FormBuilder/scenarios.test.d.ts +0 -88
- package/MultiplicityField/index.test.d.ts +0 -1
- package/Questions/index.spec.d.ts +0 -1
- package/Questions/index.test.d.ts +0 -1
- package/cjs/Field/utils/calculateField/index.js +0 -50
- package/cjs/Field/utils/calculateField.js.map +0 -7
- package/cjs/Field/utils/index.js.map +0 -7
- package/cjs/FieldArray/FormDialog.js.map +0 -7
- package/cjs/inputs/inputsScenarios/index.js +0 -533
- package/cjs/inputs/inputsScenarios.js.map +0 -7
- package/cjs/locales/el.js.map +0 -7
- package/inputs/AutoCompleteInput/index.test.d.ts +0 -1
- package/inputs/Checkboxes/index.test.d.ts +0 -1
- package/inputs/DateInput/index.test.d.ts +0 -1
- package/inputs/DateTimeInput/index.test.d.ts +0 -1
- package/inputs/FileInput/index.test.d.ts +0 -1
- package/inputs/ImageInput/index.test.d.ts +0 -1
- package/inputs/Input/index.test.d.ts +0 -1
- package/inputs/Label/index.test.d.ts +0 -1
- package/inputs/OtpInput/index.test.d.ts +0 -1
- package/inputs/Radio/index.test.d.ts +0 -1
- package/inputs/Select/index.test.d.ts +0 -1
- package/inputs/inputsScenarios/index.js +0 -499
- package/inputs/inputsScenarios.d.ts +0 -296
- package/inputs/inputsScenarios.js.map +0 -7
- package/locales/el/index.js +0 -6
- package/locales/el.d.ts +0 -2
- package/locales/el.js.map +0 -7
- package/src/Field/utils/calculateField.ts +0 -49
- package/src/FieldArray/FormDialog.tsx +0 -568
- package/src/inputs/inputsScenarios.ts +0 -496
- package/src/locales/el.ts +0 -3
- /package/{FieldArray/index.test.d.ts → hooks/__tests__/utils.spec.d.ts} +0 -0
package/inputs/Input/index.js
CHANGED
|
@@ -11,65 +11,63 @@ const TYPES_MAP = {
|
|
|
11
11
|
text: "text",
|
|
12
12
|
date: "date"
|
|
13
13
|
};
|
|
14
|
-
const Input = React.forwardRef(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
...
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
type: fieldType
|
|
50
|
-
}
|
|
14
|
+
const Input = React.forwardRef(function WrappedInput({ name, control, type, extra, ...props }, ref) {
|
|
15
|
+
delete props["Field"];
|
|
16
|
+
let { multiline = false, rows, limit } = extra || {};
|
|
17
|
+
const { className } = extra || {};
|
|
18
|
+
multiline = multiline === true || type === "text";
|
|
19
|
+
rows = rows || (multiline ? 4 : 1);
|
|
20
|
+
const fieldType = TYPES_MAP[type || "text"] || "text";
|
|
21
|
+
const { t } = useTranslation();
|
|
22
|
+
const currentValue = useWatch({ control, name });
|
|
23
|
+
const getRemainingChars = (currentValue2, limit2) => {
|
|
24
|
+
if (currentValue2) {
|
|
25
|
+
return limit2?.max - currentValue2.length;
|
|
26
|
+
}
|
|
27
|
+
return limit2?.max;
|
|
28
|
+
};
|
|
29
|
+
const constructRemainingText = (currentValue2, limit2) => {
|
|
30
|
+
const remainingChars = getRemainingChars(currentValue2, limit2);
|
|
31
|
+
let remainingText = Math.abs(remainingChars) === 1 ? t("form.info.text.character") : t("form.info.text.characters");
|
|
32
|
+
remainingText += remainingChars > 0 ? ` ${t("form.info.text.remaining")}.` : ` ${t("form.info.text.too_many")}.`;
|
|
33
|
+
return remainingText;
|
|
34
|
+
};
|
|
35
|
+
if (multiline === true) {
|
|
36
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
37
|
+
TextArea,
|
|
38
|
+
{
|
|
39
|
+
name,
|
|
40
|
+
className,
|
|
41
|
+
rows,
|
|
42
|
+
ref,
|
|
43
|
+
id: name,
|
|
44
|
+
...{
|
|
45
|
+
...props,
|
|
46
|
+
reset: void 0,
|
|
47
|
+
required: void 0,
|
|
48
|
+
type: fieldType
|
|
51
49
|
}
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
50
|
+
}
|
|
51
|
+
), limit?.max && /* @__PURE__ */ React.createElement(Hint, { display: "flex" }, t("form.info.text.you_have"), /* @__PURE__ */ React.createElement(Hint, { fontWeight: "bold" }, "\xA0", `${Math.abs(getRemainingChars(currentValue, limit))}`, "\xA0"), constructRemainingText(currentValue, limit)));
|
|
52
|
+
} else {
|
|
53
|
+
return /* @__PURE__ */ React.createElement(
|
|
54
|
+
TextInput,
|
|
55
|
+
{
|
|
56
|
+
name,
|
|
57
|
+
id: name,
|
|
58
|
+
type: fieldType,
|
|
59
|
+
"data-type": type,
|
|
60
|
+
className,
|
|
61
|
+
ref,
|
|
62
|
+
...{
|
|
63
|
+
...props,
|
|
64
|
+
reset: void 0,
|
|
65
|
+
required: void 0
|
|
68
66
|
}
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
}
|
|
68
|
+
);
|
|
71
69
|
}
|
|
72
|
-
);
|
|
70
|
+
});
|
|
73
71
|
var Input_default = Input;
|
|
74
72
|
export {
|
|
75
73
|
Input,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/inputs/Input/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import React from 'react';\nimport { useWatch } from 'react-hook-form';\nimport { UncontrolledFieldProps } from '@digigov/form/Field/types';\nimport { TextArea } from '@digigov/ui/form/TextArea';\nimport { TextInput } from '@digigov/ui/form/TextInput';\nimport { useTranslation } from '@digigov/ui/i18n';\nimport { Hint } from '@digigov/ui/typography/Hint';\n\nconst TYPES_MAP = {\n string: 'text',\n password: 'password',\n int: 'text',\n text: 'text',\n date: 'date',\n};\n\nexport interface InputProps\n extends Omit<UncontrolledFieldProps, 'extra' | 'Field'> {\n extra?: {\n fullWidth?: boolean;\n multiline?: boolean;\n className?: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n rows?: any;\n limit: {\n min?: number;\n max?: number;\n };\n };\n Field?: UncontrolledFieldProps['Field'];\n}\n\nexport const Input
|
|
5
|
-
"mappings": "AAAA,OAAO,WAAW;AAClB,SAAS,gBAAgB;AAEzB,SAAS,gBAAgB;AACzB,SAAS,iBAAiB;AAC1B,SAAS,sBAAsB;AAC/B,SAAS,YAAY;AAErB,MAAM,YAAY;AAAA,EAChB,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,KAAK;AAAA,EACL,MAAM;AAAA,EACN,MAAM;AACR;AAkBO,MAAM,
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport { useWatch } from 'react-hook-form';\nimport type { UncontrolledFieldProps } from '@digigov/form/Field/types';\nimport { TextArea } from '@digigov/ui/form/TextArea';\nimport { TextInput } from '@digigov/ui/form/TextInput';\nimport { useTranslation } from '@digigov/ui/i18n';\nimport { Hint } from '@digigov/ui/typography/Hint';\n\nconst TYPES_MAP = {\n string: 'text',\n password: 'password',\n int: 'text',\n text: 'text',\n date: 'date',\n};\n\nexport interface InputProps\n extends Omit<UncontrolledFieldProps, 'extra' | 'Field'> {\n extra?: {\n fullWidth?: boolean;\n multiline?: boolean;\n className?: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n rows?: any;\n limit: {\n min?: number;\n max?: number;\n };\n };\n Field?: UncontrolledFieldProps['Field'];\n}\n\nexport const Input = React.forwardRef<\n HTMLInputElement | HTMLTextAreaElement,\n InputProps\n>(function WrappedInput({ name, control, type, extra, ...props }, ref) {\n delete props['Field'];\n // eslint-disable-next-line prefer-const\n let { multiline = false, rows, limit } = extra || {};\n const { className } = extra || {};\n // if enforced to multiline use true. Derive from type otherwise.\n multiline = multiline === true || type === 'text';\n // use explicit rows value if set. Derive from multiline otherwise.\n rows = rows || (multiline ? 4 : 1);\n // translate dilosi type to HTML Input type\n const fieldType = TYPES_MAP[type || 'text'] || 'text';\n const { t } = useTranslation();\n const currentValue: string | '' = useWatch({ control, name });\n\n const getRemainingChars = (currentValue, limit) => {\n if (currentValue) {\n return limit?.max - currentValue.length;\n }\n return limit?.max;\n };\n\n const constructRemainingText = (currentValue, limit) => {\n const remainingChars = getRemainingChars(currentValue, limit);\n let remainingText =\n Math.abs(remainingChars) === 1\n ? t('form.info.text.character')\n : t('form.info.text.characters');\n remainingText +=\n remainingChars > 0\n ? ` ${t('form.info.text.remaining')}.`\n : ` ${t('form.info.text.too_many')}.`;\n return remainingText;\n };\n\n if (multiline === true) {\n return (\n <>\n <TextArea\n name={name}\n className={className}\n rows={rows}\n ref={ref as React.RefObject<HTMLTextAreaElement>}\n id={name}\n {...{\n ...props,\n reset: undefined,\n required: undefined,\n type: fieldType,\n }}\n />\n {limit?.max && (\n <Hint display={'flex'}>\n {t('form.info.text.you_have')}\n <Hint fontWeight=\"bold\">\n {`${Math.abs(getRemainingChars(currentValue, limit))}`}\n \n </Hint>\n {constructRemainingText(currentValue, limit)}\n </Hint>\n )}\n </>\n );\n } else {\n return (\n <TextInput\n name={name}\n id={name}\n type={fieldType}\n data-type={type}\n className={className}\n ref={ref as React.RefObject<HTMLInputElement>}\n {...{\n ...props,\n reset: undefined,\n required: undefined,\n }}\n />\n );\n }\n});\n\nexport default Input;\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO,WAAW;AAClB,SAAS,gBAAgB;AAEzB,SAAS,gBAAgB;AACzB,SAAS,iBAAiB;AAC1B,SAAS,sBAAsB;AAC/B,SAAS,YAAY;AAErB,MAAM,YAAY;AAAA,EAChB,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,KAAK;AAAA,EACL,MAAM;AAAA,EACN,MAAM;AACR;AAkBO,MAAM,QAAQ,MAAM,WAGzB,SAAS,aAAa,EAAE,MAAM,SAAS,MAAM,OAAO,GAAG,MAAM,GAAG,KAAK;AACrE,SAAO,MAAM,OAAO;AAEpB,MAAI,EAAE,YAAY,OAAO,MAAM,MAAM,IAAI,SAAS,CAAC;AACnD,QAAM,EAAE,UAAU,IAAI,SAAS,CAAC;AAEhC,cAAY,cAAc,QAAQ,SAAS;AAE3C,SAAO,SAAS,YAAY,IAAI;AAEhC,QAAM,YAAY,UAAU,QAAQ,MAAM,KAAK;AAC/C,QAAM,EAAE,EAAE,IAAI,eAAe;AAC7B,QAAM,eAA4B,SAAS,EAAE,SAAS,KAAK,CAAC;AAE5D,QAAM,oBAAoB,CAACA,eAAcC,WAAU;AACjD,QAAID,eAAc;AAChB,aAAOC,QAAO,MAAMD,cAAa;AAAA,IACnC;AACA,WAAOC,QAAO;AAAA,EAChB;AAEA,QAAM,yBAAyB,CAACD,eAAcC,WAAU;AACtD,UAAM,iBAAiB,kBAAkBD,eAAcC,MAAK;AAC5D,QAAI,gBACF,KAAK,IAAI,cAAc,MAAM,IACzB,EAAE,0BAA0B,IAC5B,EAAE,2BAA2B;AACnC,qBACE,iBAAiB,IACb,IAAI,EAAE,0BAA0B,CAAC,MACjC,IAAI,EAAE,yBAAyB,CAAC;AACtC,WAAO;AAAA,EACT;AAEA,MAAI,cAAc,MAAM;AACtB,WACE,0DACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,IAAI;AAAA,QACH,GAAG;AAAA,UACF,GAAG;AAAA,UACH,OAAO;AAAA,UACP,UAAU;AAAA,UACV,MAAM;AAAA,QACR;AAAA;AAAA,IACF,GACC,OAAO,OACN,oCAAC,QAAK,SAAS,UACZ,EAAE,yBAAyB,GAC5B,oCAAC,QAAK,YAAW,UAAO,QACf,GAAG,KAAK,IAAI,kBAAkB,cAAc,KAAK,CAAC,CAAC,IAAG,MAE/D,GACC,uBAAuB,cAAc,KAAK,CAC7C,CAEJ;AAAA,EAEJ,OAAO;AACL,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,IAAI;AAAA,QACJ,MAAM;AAAA,QACN,aAAW;AAAA,QACX;AAAA,QACA;AAAA,QACC,GAAG;AAAA,UACF,GAAG;AAAA,UACH,OAAO;AAAA,UACP,UAAU;AAAA,QACZ;AAAA;AAAA,IACF;AAAA,EAEJ;AACF,CAAC;AAED,IAAO,gBAAQ;",
|
|
6
6
|
"names": ["currentValue", "limit"]
|
|
7
7
|
}
|
package/inputs/Label/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/inputs/Label/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import React from 'react';\nimport { FieldLabelProps } from '@digigov/form/types';\nimport { LabelTitle } from '@digigov/ui/form/LabelContainer';\nimport { useTranslation } from '@digigov/ui/i18n';\nimport { Hint } from '@digigov/ui/typography/Hint';\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 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\nexport default Label;\n"],
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport type { FieldLabelProps } from '@digigov/form/types';\nimport { LabelTitle } from '@digigov/ui/form/LabelContainer';\nimport { useTranslation } from '@digigov/ui/i18n';\nimport { Hint } from '@digigov/ui/typography/Hint';\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 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\nexport default Label;\n"],
|
|
5
5
|
"mappings": "AAAA,OAAO,WAAW;AAElB,SAAS,kBAAkB;AAC3B,SAAS,sBAAsB;AAC/B,SAAS,YAAY;AAmBd,MAAM,QAA8B,CAAC,EAAE,WAAW,OAAO,MAAM,MAAM;AAC1E,QAAM,EAAE,EAAE,IAAI,eAAe;AAC7B,OAAK,CAAC,SAAU,SAAS,CAAC,MAAM,WAAW,CAAC,MAAM,cAAe,CAAC,OAAO;AACvE,WAAO;AAAA,EACT;AACA,SACE,0DACE,oCAAC,cAAW,WAAsB,MAAK,QACnC,SAAS,MAAM,WAAW,EAAE,MAAM,OAAO,KAAM,KACnD,GACC,SAAS,MAAM,aAAa,oCAAC,YAAM,EAAE,MAAM,SAAS,CAAE,CACzD;AAEJ;AAEA,IAAO,gBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -8,9 +8,5 @@ export declare function useOtp(onChange: any, maxLength: any): {
|
|
|
8
8
|
handleFocus: (e: React.FocusEvent<HTMLInputElement>) => void;
|
|
9
9
|
handlePaste: (e: React.ClipboardEvent<HTMLInputElement>) => void;
|
|
10
10
|
};
|
|
11
|
-
export declare const OtpInput:
|
|
12
|
-
[x: string]: any;
|
|
13
|
-
name: any;
|
|
14
|
-
maxLength?: number | undefined;
|
|
15
|
-
}) => React.JSX.Element;
|
|
11
|
+
export declare const OtpInput: React.ForwardRefExoticComponent<Omit<Record<string, any>, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
16
12
|
export default OtpInput;
|
package/inputs/OtpInput/index.js
CHANGED
|
@@ -105,37 +105,42 @@ function useOtp(onChange, maxLength) {
|
|
|
105
105
|
handlePaste
|
|
106
106
|
};
|
|
107
107
|
}
|
|
108
|
-
const SingleCharacterInputPart = ({ ...props }) => {
|
|
109
|
-
return /* @__PURE__ */ React.createElement(SingleCharacterInput, { ...props });
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
108
|
+
const SingleCharacterInputPart = React.forwardRef(({ ...props }, ref) => {
|
|
109
|
+
return /* @__PURE__ */ React.createElement(SingleCharacterInput, { ...props, ref });
|
|
110
|
+
});
|
|
111
|
+
SingleCharacterInputPart.displayName = "SingleCharacterInputPart";
|
|
112
|
+
const OtpInput = React.forwardRef(
|
|
113
|
+
({ name, maxLength = 6, ...props }, ref) => {
|
|
114
|
+
const otp = useOtp(props.onChange, maxLength);
|
|
115
|
+
return /* @__PURE__ */ React.createElement(SingleCharacterInputs, null, otp.otpValues.map((digit, idx) => /* @__PURE__ */ React.createElement(
|
|
116
|
+
SingleCharacterInputPart,
|
|
117
|
+
{
|
|
118
|
+
ref: idx === 0 ? ref : null,
|
|
119
|
+
name: `${name}-${idx}`,
|
|
120
|
+
id: `${name}-${idx}`,
|
|
121
|
+
type: "text",
|
|
122
|
+
key: idx,
|
|
123
|
+
autoComplete: "one-time-code",
|
|
124
|
+
pattern: "\\d{1}",
|
|
125
|
+
maxLength,
|
|
126
|
+
value: digit,
|
|
127
|
+
disabled: props.disabled,
|
|
128
|
+
"aria-required": props["aria-required"],
|
|
129
|
+
onChange: (e) => otp.handleOtpChange(e, idx),
|
|
130
|
+
onInput: (e) => {
|
|
131
|
+
if (e.target.value === digit) {
|
|
132
|
+
otp.handleOtpChange(e, idx);
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
onKeyDown: (e) => otp.handleKeyDown(e, idx),
|
|
136
|
+
onFocus: otp.handleFocus,
|
|
137
|
+
onPaste: otp.handlePaste,
|
|
138
|
+
error: !digit ? props.error : false
|
|
139
|
+
}
|
|
140
|
+
)));
|
|
141
|
+
}
|
|
142
|
+
);
|
|
143
|
+
OtpInput.displayName = "OtpInput";
|
|
139
144
|
var OtpInput_default = OtpInput;
|
|
140
145
|
export {
|
|
141
146
|
OtpInput,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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 =\n 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
|
|
5
|
-
"mappings": "AAAA,OAAO,SAAS,UAAU,mBAAmB;AAC7C,OAAO;AAAA,EACL;AAAA,OACK;AAEA,MAAM,WAAW,IAAI,OAAO,OAAO;AACnC,MAAM,gBAAgB,IAAI,OAAO,MAAM;AAEvC,SAAS,OAAO,UAAU,WAAW;AAC1C,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,MAAc,SAAS,EAAE,KAAK,EAAE,CAAC;AAC5E,QAAM,eAAe;AAAA,IACnB,CAAC,QAAkB;AACjB,mBAAa,GAAG;AAChB,YAAM,WAAW,IAAI,KAAK,EAAE;AAC5B,eAAS,QAAQ;AAAA,IACnB;AAAA,IACA,CAAC,QAAQ;AAAA,EACX;AAEA,QAAM,SAAS,CAAC,MAAc,QAAQ;AACpC,UAAM,mBAAmB,CAAC,GAAG,SAAS;AACtC,QAAI,KAAK,WAAW,KAAK,KAAK,WAAW,GAAG;AAC1C,uBAAiB,GAAG,IAAI,KAAK,CAAC,KAAK;AACnC,mBAAa,gBAAgB;AAAA,IAC/B,WAAW,KAAK,WAAW,WAAW;AACpC,YAAM,aAAa,KAAK,MAAM,EAAE,EAAE,MAAM,GAAG,SAA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,IACtB,CAAC,GAAwC,QAAgB;AACvD,YAAM,SAAS,EAAE;AACjB,YAAM,cAAc,OAAO;AAC3B,YAAM,qBAAqB,SAAS,KAAK,WAAW;AAGpD,UAAI,sBAAsB,gBAAgB,IAAI;AAC5C,eAAO,aAAa,GAAG;AACvB,YAAI,OAAO,MAAM,SAAS,GAAG;AAC3B,iBAAO,KAAK;AAAA,QACd;AACA,yBAAiB,MAAM;AAAA,MACzB;AAAA,IACF;AAAA,IACA,CAAC,QAAQ,eAAe,WAAW;AAAA,EACrC;AAEA,QAAM,cAAc;AAAA,IAClB,CAAC,MAA8C;AAC7C,QAAE,eAAe;AACjB,YAAM,aAAa,EAAE,cAClB,QAAQ,YAAY,EACpB,QAAQ,eAAe,EAAE;AAC5B,UAAI,YAAY;AACd,eAAO,YAAY,CAAC;AAAA,MACtB;AAAA,IACF;AAAA,IACA,CAAC;AAAA,EACH;AACA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AAEA,MAAM,2BAA2B,CAAC,EAAE,GAAG,MAAM,
|
|
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 =\n 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 = React.forwardRef<\n HTMLInputElement,\n Record<string, any>\n>(({ ...props }, ref) => {\n return <SingleCharacterInput {...props} ref={ref} />;\n});\nSingleCharacterInputPart.displayName = 'SingleCharacterInputPart';\n\nexport const OtpInput = React.forwardRef<HTMLInputElement, Record<string, any>>(\n ({ name, maxLength = 6, ...props }, ref) => {\n const otp = useOtp(props.onChange, maxLength);\n return (\n <SingleCharacterInputs>\n {otp.otpValues.map((digit, idx) => (\n <SingleCharacterInputPart\n ref={idx === 0 ? ref : null}\n name={`${name}-${idx}`}\n id={`${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);\n\nOtpInput.displayName = 'OtpInput';\n\nexport default OtpInput;\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO,SAAS,UAAU,mBAAmB;AAC7C,OAAO;AAAA,EACL;AAAA,OACK;AAEA,MAAM,WAAW,IAAI,OAAO,OAAO;AACnC,MAAM,gBAAgB,IAAI,OAAO,MAAM;AAEvC,SAAS,OAAO,UAAU,WAAW;AAC1C,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,MAAc,SAAS,EAAE,KAAK,EAAE,CAAC;AAC5E,QAAM,eAAe;AAAA,IACnB,CAAC,QAAkB;AACjB,mBAAa,GAAG;AAChB,YAAM,WAAW,IAAI,KAAK,EAAE;AAC5B,eAAS,QAAQ;AAAA,IACnB;AAAA,IACA,CAAC,QAAQ;AAAA,E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,6BACE,IAAI,UAAU,IAAI,CAAC,OAAO,QACzB;AAAA,MAAC;AAAA;AAAA,QACC,KAAK,QAAQ,IAAI,MAAM;AAAA,QACvB,MAAM,GAAG,IAAI,IAAI,GAAG;AAAA,QACpB,IAAI,GAAG,IAAI,IAAI,GAAG;AAAA,QAClB,MAAK;AAAA,QACL,KAAK;AAAA,QACL,cAAa;AAAA,QACb,SAAQ;AAAA,QACR;AAAA,QACA,OAAO;AAAA,QACP,UAAU,MAAM;AAAA,QAChB,iBAAe,MAAM,eAAe;AAAA,QACpC,UAAU,CAAC,MAAM,IAAI,gBAAgB,GAAG,GAAG;AAAA,QAC3C,SAAS,CAAC,MAAM;AACd,cAAI,EAAE,OAAO,UAAU,OAAO;AAC5B,gBAAI,gBAAgB,GAAG,GAAG;AAAA,UAC5B;AAAA,QACF;AAAA,QACA,WAAW,CAAC,MAAM,IAAI,cAAc,GAAG,GAAG;AAAA,QAC1C,SAAS,IAAI;AAAA,QACb,SAAS,IAAI;AAAA,QACb,OAAO,CAAC,QAAQ,MAAM,QAAQ;AAAA;AAAA,IAChC,CACD,CACH;AAAA,EAEJ;AACF;AAEA,SAAS,cAAc;AAEvB,IAAO,mBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/inputs/Radio/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { UncontrolledFieldProps } from '@digigov/form/Field/types';
|
|
3
|
-
import { FieldOptionProps } from '@digigov/form/inputs/Label';
|
|
2
|
+
import type { UncontrolledFieldProps } from '@digigov/form/Field/types';
|
|
3
|
+
import type { FieldOptionProps } from '@digigov/form/inputs/Label';
|
|
4
4
|
export interface RadioButtonsGroupProps extends Omit<UncontrolledFieldProps, 'extra'> {
|
|
5
5
|
extra: {
|
|
6
6
|
className?: string;
|
|
@@ -10,8 +10,8 @@ export interface RadioButtonsGroupProps extends Omit<UncontrolledFieldProps, 'ex
|
|
|
10
10
|
fieldComponent?: React.FC<Omit<UncontrolledFieldProps, 'register'>>;
|
|
11
11
|
}
|
|
12
12
|
export declare const RadioButtonsGroup: React.FC<RadioButtonsGroupProps>;
|
|
13
|
-
export declare const ControlledRadioButtonsGroup: React.
|
|
13
|
+
export declare const ControlledRadioButtonsGroup: React.ForwardRefExoticComponent<RadioButtonsGroupProps & {
|
|
14
14
|
onChange: (e: any) => void;
|
|
15
15
|
value: any;
|
|
16
|
-
}
|
|
16
|
+
} & React.RefAttributes<HTMLInputElement>>;
|
|
17
17
|
export default RadioButtonsGroup;
|
package/inputs/Radio/index.js
CHANGED
|
@@ -49,7 +49,7 @@ const RadioButtonsGroup = ({
|
|
|
49
49
|
), selected && selected(), currentValue === v && show && Field && /* @__PURE__ */ React.createElement(RadioConditional, null, show.map((fieldName) => /* @__PURE__ */ React.createElement(Field, { name: fieldName, key: fieldName }))))
|
|
50
50
|
));
|
|
51
51
|
};
|
|
52
|
-
const ControlledRadioButtonsGroup = ({
|
|
52
|
+
const ControlledRadioButtonsGroup = React.forwardRef(function ControlledRadioButtonsGroup2({
|
|
53
53
|
name,
|
|
54
54
|
extra: { options, className },
|
|
55
55
|
disabled,
|
|
@@ -57,7 +57,7 @@ const ControlledRadioButtonsGroup = ({
|
|
|
57
57
|
value,
|
|
58
58
|
Field,
|
|
59
59
|
...props
|
|
60
|
-
})
|
|
60
|
+
}, ref) {
|
|
61
61
|
const currentValue = value;
|
|
62
62
|
const { t } = useTranslation();
|
|
63
63
|
return /* @__PURE__ */ React.createElement(RadioContainer, { className, id: name }, options.map(
|
|
@@ -68,9 +68,10 @@ const ControlledRadioButtonsGroup = ({
|
|
|
68
68
|
disabled: optionDisabled,
|
|
69
69
|
selected,
|
|
70
70
|
...option
|
|
71
|
-
}) => /* @__PURE__ */ React.createElement(React.Fragment, { key: `${name}.${v}` }, /* @__PURE__ */ React.createElement(
|
|
71
|
+
}, index) => /* @__PURE__ */ React.createElement(React.Fragment, { key: `${name}.${v}` }, /* @__PURE__ */ React.createElement(
|
|
72
72
|
RadioItem,
|
|
73
73
|
{
|
|
74
|
+
ref: index === 0 ? ref : void 0,
|
|
74
75
|
onChange: (e) => {
|
|
75
76
|
console.log(e);
|
|
76
77
|
onChange(e);
|
|
@@ -94,7 +95,7 @@ const ControlledRadioButtonsGroup = ({
|
|
|
94
95
|
label && label.secondary && /* @__PURE__ */ React.createElement(Hint, null, t(label.secondary))
|
|
95
96
|
), selected && selected(), currentValue === v && show && /* @__PURE__ */ React.createElement(RadioConditional, null, show.map((fieldName) => /* @__PURE__ */ React.createElement(Field, { name: fieldName, key: fieldName }))))
|
|
96
97
|
));
|
|
97
|
-
};
|
|
98
|
+
});
|
|
98
99
|
var Radio_default = RadioButtonsGroup;
|
|
99
100
|
export {
|
|
100
101
|
ControlledRadioButtonsGroup,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/inputs/Radio/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import React from 'react';\nimport { useWatch } from 'react-hook-form';\nimport { UncontrolledFieldProps } from '@digigov/form/Field/types';\nimport { FieldOptionProps } from '@digigov/form/inputs/Label';\nimport {\n RadioContainer,\n RadioItem,\n RadioConditional,\n} from '@digigov/ui/form/RadioContainer';\nimport { useTranslation } from '@digigov/ui/i18n';\nimport { Hint } from '@digigov/ui/typography/Hint';\nimport { Base } from '@digigov/ui/utils/Base';\n\nexport interface RadioButtonsGroupProps\n extends Omit<UncontrolledFieldProps, 'extra'> {\n extra: {\n className?: string;\n options: FieldOptionProps[];\n dense?: boolean;\n };\n fieldComponent?: React.FC<Omit<UncontrolledFieldProps, 'register'>>;\n}\n\nexport const RadioButtonsGroup: React.FC<RadioButtonsGroupProps> = ({\n name,\n control,\n register,\n extra: { options, className },\n disabled,\n Field,\n ...props\n}) => {\n const currentValue: string | undefined = useWatch({ control, name });\n const { t } = useTranslation();\n return (\n <RadioContainer className={className} id={name}>\n {options.map(\n ({\n label,\n value: v,\n show,\n disabled: optionDisabled,\n selected,\n ...option\n }) => (\n <Base as=\"div\" key={`${name}.${v}`}>\n <RadioItem\n {...register(name)}\n id={`${name}.${v}`}\n value={v}\n disabled={disabled || optionDisabled}\n {...option}\n {...{\n ...props,\n reset: undefined,\n required: undefined,\n error: undefined,\n 'aria-describedby': undefined,\n type: 'radio',\n }}\n >\n {label && label.primary && (\n <Base as=\"span\">{t(label.primary) || v}</Base>\n )}\n {label && label.secondary && <Hint>{t(label.secondary)}</Hint>}\n </RadioItem>\n {selected && selected()}\n {currentValue === v && show && Field && (\n <RadioConditional>\n {show.map((fieldName) => (\n <Field name={fieldName} key={fieldName} />\n ))}\n </RadioConditional>\n )}\n </Base>\n )\n )}\n </RadioContainer>\n );\n};\nexport const ControlledRadioButtonsGroup
|
|
5
|
-
"mappings": "AAAA,OAAO,WAAW;AAClB,SAAS,gBAAgB;AAGzB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,sBAAsB;AAC/B,SAAS,YAAY;AACrB,SAAS,YAAY;AAYd,MAAM,oBAAsD,CAAC;AAAA,EAClE;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO,EAAE,SAAS,UAAU;AAAA,EAC5B;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,eAAmC,SAAS,EAAE,SAAS,KAAK,CAAC;AACnE,QAAM,EAAE,EAAE,IAAI,eAAe;AAC7B,SACE,oCAAC,kBAAe,WAAsB,IAAI,QACvC,QAAQ;AAAA,IACP,CAAC;AAAA,MACC;AAAA,MACA,OAAO;AAAA,MACP;AAAA,MACA,UAAU;AAAA,MACV;AAAA,MACA,GAAG;AAAA,IACL,MACE,oCAAC,QAAK,IAAG,OAAM,KAAK,GAAG,IAAI,IAAI,CAAC,MAC9B;AAAA,MAAC;AAAA;AAAA,QACE,GAAG,SAAS,IAAI;AAAA,QACjB,IAAI,GAAG,IAAI,IAAI,CAAC;AAAA,QAChB,OAAO;AAAA,QACP,UAAU,YAAY;AAAA,QACrB,GAAG;AAAA,QACH,GAAG;AAAA,UACF,GAAG;AAAA,UACH,OAAO;AAAA,UACP,UAAU;AAAA,UACV,OAAO;AAAA,UACP,oBAAoB;AAAA,UACpB,MAAM;AAAA,QACR;AAAA;AAAA,MAEC,SAAS,MAAM,WACd,oCAAC,QAAK,IAAG,UAAQ,EAAE,MAAM,OAAO,KAAK,CAAE;AAAA,MAExC,SAAS,MAAM,aAAa,oCAAC,YAAM,EAAE,MAAM,SAAS,CAAE;AAAA,IACzD,GACC,YAAY,SAAS,GACrB,iBAAiB,KAAK,QAAQ,SAC7B,oCAAC,wBACE,KAAK,IAAI,CAAC,cACT,oCAAC,SAAM,MAAM,WAAW,KAAK,WAAW,CACzC,CACH,CAEJ;AAAA,EAEJ,CACF;AAEJ;AACO,MAAM,
|
|
6
|
-
"names": []
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport { useWatch } from 'react-hook-form';\nimport type { UncontrolledFieldProps } from '@digigov/form/Field/types';\nimport type { FieldOptionProps } from '@digigov/form/inputs/Label';\nimport {\n RadioContainer,\n RadioItem,\n RadioConditional,\n} from '@digigov/ui/form/RadioContainer';\nimport { useTranslation } from '@digigov/ui/i18n';\nimport { Hint } from '@digigov/ui/typography/Hint';\nimport { Base } from '@digigov/ui/utils/Base';\n\nexport interface RadioButtonsGroupProps\n extends Omit<UncontrolledFieldProps, 'extra'> {\n extra: {\n className?: string;\n options: FieldOptionProps[];\n dense?: boolean;\n };\n fieldComponent?: React.FC<Omit<UncontrolledFieldProps, 'register'>>;\n}\n\nexport const RadioButtonsGroup: React.FC<RadioButtonsGroupProps> = ({\n name,\n control,\n register,\n extra: { options, className },\n disabled,\n Field,\n ...props\n}) => {\n const currentValue: string | undefined = useWatch({ control, name });\n const { t } = useTranslation();\n return (\n <RadioContainer className={className} id={name}>\n {options.map(\n ({\n label,\n value: v,\n show,\n disabled: optionDisabled,\n selected,\n ...option\n }) => (\n <Base as=\"div\" key={`${name}.${v}`}>\n <RadioItem\n {...register(name)}\n id={`${name}.${v}`}\n value={v}\n disabled={disabled || optionDisabled}\n {...option}\n {...{\n ...props,\n reset: undefined,\n required: undefined,\n error: undefined,\n 'aria-describedby': undefined,\n type: 'radio',\n }}\n >\n {label && label.primary && (\n <Base as=\"span\">{t(label.primary) || v}</Base>\n )}\n {label && label.secondary && <Hint>{t(label.secondary)}</Hint>}\n </RadioItem>\n {selected && selected()}\n {currentValue === v && show && Field && (\n <RadioConditional>\n {show.map((fieldName) => (\n <Field name={fieldName} key={fieldName} />\n ))}\n </RadioConditional>\n )}\n </Base>\n )\n )}\n </RadioContainer>\n );\n};\nexport const ControlledRadioButtonsGroup = React.forwardRef<\n HTMLInputElement,\n RadioButtonsGroupProps & { onChange: (e: any) => void; value: any }\n>(function ControlledRadioButtonsGroup(\n {\n name,\n extra: { options, className },\n disabled,\n onChange,\n value,\n Field,\n ...props\n },\n ref\n) {\n const currentValue: string | undefined = value;\n const { t } = useTranslation();\n return (\n <RadioContainer className={className} id={name}>\n {options.map(\n (\n {\n label,\n value: v,\n show,\n disabled: optionDisabled,\n selected,\n ...option\n },\n index\n ) => (\n <React.Fragment key={`${name}.${v}`}>\n <RadioItem\n ref={index === 0 ? ref : undefined}\n onChange={(e) => {\n console.log(e);\n onChange(e);\n }}\n id={`${name}.${v}`}\n value={v}\n checked={currentValue === v}\n disabled={disabled || optionDisabled}\n {...option}\n {...{\n ...props,\n reset: undefined,\n required: undefined,\n error: undefined,\n Field: undefined,\n 'aria-describedby': undefined,\n type: 'radio',\n }}\n >\n {(label && label.primary && t(label.primary)) || v}\n {label && label.secondary && <Hint>{t(label.secondary)}</Hint>}\n </RadioItem>\n {selected && selected()}\n {currentValue === v && show && (\n <RadioConditional>\n {show.map((fieldName) => (\n <Field name={fieldName} key={fieldName} />\n ))}\n </RadioConditional>\n )}\n </React.Fragment>\n )\n )}\n </RadioContainer>\n );\n});\n\nexport default RadioButtonsGroup;\n"],
|
|
5
|
+
"m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Group"]
|
|
7
7
|
}
|
package/inputs/Select/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { UncontrolledFieldProps } from '@digigov/form/Field/types';
|
|
3
|
-
import { FieldOptionProps } from '@digigov/form/inputs/Label';
|
|
2
|
+
import type { UncontrolledFieldProps } from '@digigov/form/Field/types';
|
|
3
|
+
import type { FieldOptionProps } from '@digigov/form/inputs/Label';
|
|
4
4
|
export interface SelectProps extends Omit<UncontrolledFieldProps, 'extra' | 'Field'> {
|
|
5
5
|
extra: {
|
|
6
6
|
className?: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/inputs/Select/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import React from 'react';\nimport { UncontrolledFieldProps } from '@digigov/form/Field/types';\nimport { FieldOptionProps } from '@digigov/form/inputs/Label';\nimport {\n SelectContainer,\n SelectOption,\n} from '@digigov/ui/form/SelectContainer';\n\nexport interface SelectProps\n extends Omit<UncontrolledFieldProps, 'extra' | 'Field'> {\n extra: {\n className?: string;\n options: FieldOptionProps[];\n };\n Field?: UncontrolledFieldProps['Field'];\n}\n\nexport const Select: React.ExoticComponent<SelectProps> = React.forwardRef(\n function WrappedSelect(\n { name, extra: { options, className }, disabled, ...props },\n ref: never\n ) {\n delete props.Field;\n return (\n <SelectContainer\n className={className}\n ref={ref}\n name={name}\n id={name}\n disabled={disabled}\n {...{\n ...props,\n reset: undefined,\n error: undefined,\n required: undefined,\n }}\n >\n {options.map(({ value, label }, index) => (\n <SelectOption key={index} value={value}>\n {label && label.primary ? label.primary : value}\n </SelectOption>\n ))}\n </SelectContainer>\n );\n }\n);\n\nexport default Select;\n"],
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport type { UncontrolledFieldProps } from '@digigov/form/Field/types';\nimport type { FieldOptionProps } from '@digigov/form/inputs/Label';\nimport {\n SelectContainer,\n SelectOption,\n} from '@digigov/ui/form/SelectContainer';\n\nexport interface SelectProps\n extends Omit<UncontrolledFieldProps, 'extra' | 'Field'> {\n extra: {\n className?: string;\n options: FieldOptionProps[];\n };\n Field?: UncontrolledFieldProps['Field'];\n}\n\nexport const Select: React.ExoticComponent<SelectProps> = React.forwardRef(\n function WrappedSelect(\n { name, extra: { options, className }, disabled, ...props },\n ref: never\n ) {\n delete props.Field;\n return (\n <SelectContainer\n className={className}\n ref={ref}\n name={name}\n id={name}\n disabled={disabled}\n {...{\n ...props,\n reset: undefined,\n error: undefined,\n required: undefined,\n }}\n >\n {options.map(({ value, label }, index) => (\n <SelectOption key={index} value={value}>\n {label && label.primary ? label.primary : value}\n </SelectOption>\n ))}\n </SelectContainer>\n );\n }\n);\n\nexport default Select;\n"],
|
|
5
5
|
"mappings": "AAAA,OAAO,WAAW;AAGlB;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAWA,MAAM,SAA6C,MAAM;AAAA,EAC9D,SAAS,cACP,EAAE,MAAM,OAAO,EAAE,SAAS,UAAU,GAAG,UAAU,GAAG,MAAM,GAC1D,KACA;AACA,WAAO,MAAM;AACb,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA,IAAI;AAAA,QACJ;AAAA,QACC,GAAG;AAAA,UACF,GAAG;AAAA,UACH,OAAO;AAAA,UACP,OAAO;AAAA,UACP,UAAU;AAAA,QACZ;AAAA;AAAA,MAEC,QAAQ,IAAI,CAAC,EAAE,OAAO,MAAM,GAAG,UAC9B,oCAAC,gBAAa,KAAK,OAAO,SACvB,SAAS,MAAM,UAAU,MAAM,UAAU,KAC5C,CACD;AAAA,IACH;AAAA,EAEJ;AACF;AAEA,IAAO,iBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type FieldComponentItem } from '@digigov/form/Field/types';
|
|
2
|
+
export type FieldComponentRegistry = Record<string, FieldComponentItem>;
|
|
2
3
|
export declare const FIELD_COMPONENTS: FieldComponentRegistry;
|
|
3
4
|
export declare const ALTERNATIVE_COMPONENTS: FieldComponentRegistry;
|
|
4
5
|
export declare const CONTROLLED_FIELD_COMPONENTS: FieldComponentRegistry;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/inputs/registry.ts"],
|
|
4
|
+
"sourcesContent": ["import { type FieldComponentItem } from '@digigov/form/Field/types';\nimport AutoCompleteInput from '@digigov/form/inputs/AutoCompleteInput';\nimport Checkboxes from '@digigov/form/inputs/Checkboxes';\nimport DateInput from '@digigov/form/inputs/DateInput';\nimport DateTimeInput from '@digigov/form/inputs/DateTimeInput';\nimport FileInput from '@digigov/form/inputs/FileInput';\nimport ImageInput from '@digigov/form/inputs/ImageInput';\nimport Input from '@digigov/form/inputs/Input';\nimport OtpInput from '@digigov/form/inputs/OtpInput';\nimport Radio, { ControlledRadioButtonsGroup } from '@digigov/form/inputs/Radio';\nimport Select from '@digigov/form/inputs/Select';\n\nexport type FieldComponentRegistry = Record<string, FieldComponentItem>;\n\nexport const FIELD_COMPONENTS: FieldComponentRegistry = {\n text: {\n component: Input,\n },\n string: {\n component: Input,\n },\n file: {\n wrapper: 'fieldset',\n component: FileInput,\n // controlled: true,\n },\n image: {\n wrapper: 'fieldset',\n component: ImageInput,\n controlled: true,\n },\n date: {\n wrapper: 'fieldset',\n controlled: true,\n component: DateInput,\n },\n datetime: {\n wrapper: 'fieldset',\n controlled: true,\n component: DateTimeInput,\n },\n otp: {\n wrapper: 'fieldset',\n controlled: true,\n component: OtpInput,\n },\n 'choice:multiple': {\n wrapper: 'fieldset',\n controlled: true,\n component: Checkboxes,\n },\n 'choice:single': {\n wrapper: 'fieldset',\n controlled: false,\n component: Radio,\n },\n};\n\nexport const ALTERNATIVE_COMPONENTS: FieldComponentRegistry = {\n Select: {\n component: Select,\n controlled: false,\n },\n AutoComplete: {\n component: AutoCompleteInput,\n controlled: true,\n wrapper: 'fieldset',\n },\n};\n\nexport const CONTROLLED_FIELD_COMPONENTS: FieldComponentRegistry = {\n ...FIELD_COMPONENTS,\n 'choice:single': {\n wrapper: 'fieldset',\n controlled: true,\n component: ControlledRadioButtonsGroup,\n },\n text: {\n component: Input,\n controlled: true,\n },\n string: {\n component: Input,\n controlled: true,\n },\n};\n"],
|
|
5
|
+
"mappings": "AACA,OAAO,uBAAuB;AAC9B,OAAO,gBAAgB;AACvB,OAAO,eAAe;AACtB,OAAO,mBAAmB;AAC1B,OAAO,eAAe;AACtB,OAAO,gBAAgB;AACvB,OAAO,WAAW;AAClB,OAAO,cAAc;AACrB,OAAO,SAAS,mCAAmC;AACnD,OAAO,YAAY;AAIZ,MAAM,mBAA2C;AAAA,EACtD,MAAM;AAAA,IACJ,WAAW;AAAA,EACb;AAAA,EACA,QAAQ;AAAA,IACN,WAAW;AAAA,EACb;AAAA,EACA,MAAM;AAAA,IACJ,SAAS;AAAA,IACT,WAAW;AAAA;AAAA,EAEb;AAAA,EACA,OAAO;AAAA,IACL,SAAS;AAAA,IACT,WAAW;AAAA,IACX,YAAY;AAAA,EACd;AAAA,EACA,MAAM;AAAA,IACJ,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,WAAW;AAAA,EACb;AAAA,EACA,UAAU;AAAA,IACR,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,WAAW;AAAA,EACb;AAAA,EACA,KAAK;AAAA,IACH,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,WAAW;AAAA,EACb;AAAA,EACA,mBAAmB;AAAA,IACjB,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,WAAW;AAAA,EACb;AAAA,EACA,iBAAiB;AAAA,IACf,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,WAAW;AAAA,EACb;AACF;AAEO,MAAM,yBAAiD;AAAA,EAC5D,QAAQ;AAAA,IACN,WAAW;AAAA,IACX,YAAY;AAAA,EACd;AAAA,EACA,cAAc;AAAA,IACZ,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,SAAS;AAAA,EACX;AACF;AAEO,MAAM,8BAAsD;AAAA,EACjE,GAAG;AAAA,EACH,iBAAiB;AAAA,IACf,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,WAAW;AAAA,EACb;AAAA,EACA,MAAM;AAAA,IACJ,WAAW;AAAA,IACX,YAAY;AAAA,EACd;AAAA,EACA,QAAQ;AAAA,IACN,WAAW;AAAA,IACX,YAAY;AAAA,EACd;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/lazy/index.js
CHANGED
|
@@ -9,10 +9,7 @@ export default {
|
|
|
9
9
|
'FieldBase': lazy(() => import('@digigov/form/Field/FieldBase').then((module) => ({ default: module['FieldBase'] }))),
|
|
10
10
|
'FieldBaseContainer': lazy(() => import('@digigov/form/Field/FieldBaseContainer').then((module) => ({ default: module['FieldBaseContainer'] }))),
|
|
11
11
|
'FieldConditional': lazy(() => import('@digigov/form/Field/FieldConditional').then((module) => ({ default: module['FieldConditional'] }))),
|
|
12
|
-
'
|
|
13
|
-
'ArrayItemModal': lazy(() => import('@digigov/form/FieldArray/FormDialog').then((module) => ({ default: module['ArrayItemModal'] }))),
|
|
14
|
-
'ArrayItemHeader': lazy(() => import('@digigov/form/FieldArray/FormDialog').then((module) => ({ default: module['ArrayItemHeader'] }))),
|
|
15
|
-
'ArrayItemDisplay': lazy(() => import('@digigov/form/FieldArray/FormDialog').then((module) => ({ default: module['ArrayItemDisplay'] }))),
|
|
12
|
+
'BaseFieldArray': lazy(() => import('@digigov/form/FieldArray/BaseFieldArray').then((module) => ({ default: module['BaseFieldArray'] }))),
|
|
16
13
|
'FieldArray': lazy(() => import('@digigov/form/FieldArray').then((module) => ({ default: module['FieldArray'] }))),
|
|
17
14
|
'FieldObject': lazy(() => import('@digigov/form/FieldObject').then((module) => ({ default: module['FieldObject'] }))),
|
|
18
15
|
'FieldsetWithContext': lazy(() => import('@digigov/form/Fieldset/FieldsetWithContext').then((module) => ({ default: module['FieldsetWithContext'] }))),
|
|
@@ -45,10 +42,11 @@ export default {
|
|
|
45
42
|
'Input': lazy(() => import('@digigov/form/inputs/Input').then((module) => ({ default: module['Input'] }))),
|
|
46
43
|
'Radio': lazy(() => import('@digigov/form/inputs').then((module) => ({ default: module['Radio'] }))),
|
|
47
44
|
'Select': lazy(() => import('@digigov/form/inputs/Select').then((module) => ({ default: module['Select'] }))),
|
|
48
|
-
'
|
|
49
|
-
'
|
|
50
|
-
'
|
|
51
|
-
'
|
|
45
|
+
'FIELD_COMPONENTS': lazy(() => import('@digigov/form/inputs/registry').then((module) => ({ default: module['FIELD_COMPONENTS'] }))),
|
|
46
|
+
'ALTERNATIVE_COMPONENTS': lazy(() => import('@digigov/form/inputs/registry').then((module) => ({ default: module['ALTERNATIVE_COMPONENTS'] }))),
|
|
47
|
+
'CONTROLLED_FIELD_COMPONENTS': lazy(() => import('@digigov/form/inputs/registry').then((module) => ({ default: module['CONTROLLED_FIELD_COMPONENTS'] }))),
|
|
48
|
+
'ArrayEditModal': lazy(() => import('@digigov/form/FieldArray/FormDialog/ArrayEditModal').then((module) => ({ default: module['ArrayEditModal'] }))),
|
|
49
|
+
'FormDialog': lazy(() => import('@digigov/form/FieldArray/FormDialog').then((module) => ({ default: module['FormDialog'] }))),
|
|
52
50
|
'AutoCompleteInput': lazy(() => import('@digigov/form/inputs/AutoCompleteInput').then((module) => ({ default: module['AutoCompleteInput'] }))),
|
|
53
51
|
'DateTimeInput': lazy(() => import('@digigov/form/inputs/DateTimeInput').then((module) => ({ default: module['DateTimeInput'] }))),
|
|
54
52
|
'Image': lazy(() => import('@digigov/form/inputs/ImageInput').then((module) => ({ default: module['Image'] }))),
|
|
@@ -74,5 +72,8 @@ export default {
|
|
|
74
72
|
'UUID4_VALIDATOR': lazy(() => import('@digigov/form/validators/utils/uuid4').then((module) => ({ default: module['UUID4_VALIDATOR'] }))),
|
|
75
73
|
'TEXT_LIMIT_VALIDATOR': lazy(() => import('@digigov/form/validators/utils/text_limit').then((module) => ({ default: module['TEXT_LIMIT_VALIDATOR'] }))),
|
|
76
74
|
'INT_VALIDATOR': lazy(() => import('@digigov/form/validators/utils/int').then((module) => ({ default: module['INT_VALIDATOR'] }))),
|
|
77
|
-
'NUMBER_VALIDATOR': lazy(() => import('@digigov/form/validators/utils/number').then((module) => ({ default: module['NUMBER_VALIDATOR'] })))
|
|
75
|
+
'NUMBER_VALIDATOR': lazy(() => import('@digigov/form/validators/utils/number').then((module) => ({ default: module['NUMBER_VALIDATOR'] }))),
|
|
76
|
+
'ArrayItemDisplay': lazy(() => import('@digigov/form/FieldArray/FormDialog/ArrayDisplay/ArrayItemDisplay').then((module) => ({ default: module['ArrayItemDisplay'] }))),
|
|
77
|
+
'ArrayItemHeader': lazy(() => import('@digigov/form/FieldArray/FormDialog/ArrayDisplay/ArrayItemHeader').then((module) => ({ default: module['ArrayItemHeader'] }))),
|
|
78
|
+
'ArrayDisplay': lazy(() => import('@digigov/form/FieldArray/FormDialog/ArrayDisplay').then((module) => ({ default: module['ArrayDisplay'] })))
|
|
78
79
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digigov/form",
|
|
3
|
-
"version": "2.0.0-
|
|
3
|
+
"version": "2.0.0-5e7a6790",
|
|
4
4
|
"description": "@digigov form builder",
|
|
5
5
|
"author": "GRNET Developers <devs@lists.grnet.gr>",
|
|
6
6
|
"license": "BSD-2-Clause",
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
"yup": "0.32.11",
|
|
15
15
|
"dayjs": "1.10.4",
|
|
16
16
|
"@hookform/resolvers": "5.0.1",
|
|
17
|
-
"@digigov/react-icons": "2.0.0-
|
|
17
|
+
"@digigov/react-icons": "2.0.0-5e7a6790"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
|
-
"@digigov/ui": "2.0.0-
|
|
21
|
-
"@digigov/react-core": "2.0.0-
|
|
20
|
+
"@digigov/ui": "2.0.0-5e7a6790",
|
|
21
|
+
"@digigov/react-core": "2.0.0-5e7a6790",
|
|
22
22
|
"clsx": "1.1.1",
|
|
23
23
|
"react": "^18.3.0 || ^19.1.0",
|
|
24
24
|
"react-dom": "^18.3.0 || ^19.1.0"
|