@digigov/form 1.0.0-rc.3 → 1.0.0-rc.5
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/{es/Field/FieldBase.js → Field/FieldBase/index.js} +18 -21
- package/Field/FieldBase/package.json +6 -0
- package/{esm/Field/FieldBaseContainer.js → Field/FieldBaseContainer/index.js} +6 -9
- package/Field/FieldBaseContainer/package.json +6 -0
- package/{es/Field/FieldConditional.js → Field/FieldConditional/index.js} +9 -12
- package/Field/FieldConditional/package.json +6 -0
- package/Field/index.js +31 -64
- package/Field/package.json +6 -0
- package/Field/types/package.json +6 -0
- package/Field/types.d.ts +4 -4
- package/{esm/Field/utils.js → Field/utils/index.js} +25 -34
- package/Field/utils/package.json +6 -0
- package/FieldArray/FieldArray.stories/package.json +6 -0
- package/{es/FieldArray/__stories__/Default.js → FieldArray/__stories__/Default/index.js} +0 -2
- package/FieldArray/__stories__/Default/package.json +6 -0
- package/FieldArray/__stories__/Default.d.ts +1 -0
- package/{es/FieldArray/__stories__/WithExactLength.js → FieldArray/__stories__/WithExactLength/index.js} +0 -2
- package/FieldArray/__stories__/WithExactLength/package.json +6 -0
- package/FieldArray/__stories__/WithExactLength.d.ts +1 -0
- package/FieldArray/index.js +31 -57
- package/FieldArray/package.json +6 -0
- package/FieldObject/index.js +30 -59
- package/FieldObject/package.json +6 -0
- package/{esm/Fieldset/FieldsetWithContext.js → Fieldset/FieldsetWithContext/index.js} +5 -11
- package/Fieldset/FieldsetWithContext/package.json +6 -0
- package/Fieldset/index.js +20 -52
- package/Fieldset/package.json +6 -0
- package/Fieldset/types/package.json +6 -0
- package/Form.stories/package.json +6 -0
- package/{esm/FormBuilder/FormBuilder.js → FormBuilder/FormBuilder/index.js} +35 -43
- package/FormBuilder/FormBuilder/package.json +6 -0
- package/FormBuilder/FormBuilder.mdx +7 -7
- package/FormBuilder/FormBuilder.stories/package.json +6 -0
- package/{es/FormBuilder/__stories__/Default.js → FormBuilder/__stories__/Default/index.js} +0 -2
- package/FormBuilder/__stories__/Default/package.json +6 -0
- package/FormBuilder/__stories__/Default.d.ts +1 -0
- package/FormBuilder/index.js +2 -11
- package/FormBuilder/package.json +6 -0
- package/FormContext/package.json +6 -0
- package/MultiplicityField/MultiplicityField.stories/package.json +6 -0
- package/{es/MultiplicityField/__stories__/Default.js → MultiplicityField/__stories__/Default/index.js} +0 -2
- package/MultiplicityField/__stories__/Default/package.json +6 -0
- package/MultiplicityField/__stories__/Default.d.ts +1 -0
- package/{esm/MultiplicityField/__stories__/PreviewDisplay.js → MultiplicityField/__stories__/PreviewDisplay/index.js} +3 -14
- package/MultiplicityField/__stories__/PreviewDisplay/package.json +6 -0
- package/MultiplicityField/__stories__/PreviewDisplay.d.ts +1 -0
- package/{es/MultiplicityField/__stories__/WithExactLength.js → MultiplicityField/__stories__/WithExactLength/index.js} +0 -2
- package/MultiplicityField/__stories__/WithExactLength/package.json +6 -0
- package/MultiplicityField/__stories__/WithExactLength.d.ts +1 -0
- package/{es/MultiplicityField/__stories__/WithMaxLength.js → MultiplicityField/__stories__/WithMaxLength/index.js} +0 -2
- package/MultiplicityField/__stories__/WithMaxLength/package.json +6 -0
- package/MultiplicityField/__stories__/WithMaxLength.d.ts +1 -0
- package/{esm/MultiplicityField/__stories__/WithMinAndMaxLength.js → MultiplicityField/__stories__/WithMinAndMaxLength/index.js} +0 -2
- package/MultiplicityField/__stories__/WithMinAndMaxLength/package.json +6 -0
- package/MultiplicityField/__stories__/WithMinAndMaxLength.d.ts +1 -0
- package/{esm/MultiplicityField/__stories__/WithMinLength.js → MultiplicityField/__stories__/WithMinLength/index.js} +0 -2
- package/MultiplicityField/__stories__/WithMinLength/package.json +6 -0
- package/MultiplicityField/__stories__/WithMinLength.d.ts +1 -0
- package/MultiplicityField/add-objects/index.js +148 -0
- package/MultiplicityField/add-objects/package.json +6 -0
- package/MultiplicityField/index.d.ts +1 -1
- package/MultiplicityField/index.js +53 -88
- package/MultiplicityField/package.json +6 -0
- package/{es/Questions/Questions.js → Questions/Questions/index.js} +19 -28
- package/Questions/Questions/package.json +6 -0
- package/Questions/Questions.stories/package.json +6 -0
- package/Questions/QuestionsContext/package.json +6 -0
- package/{es/Questions/Step/ReviewStep.js → Questions/Step/ReviewStep/index.js} +8 -11
- package/Questions/Step/ReviewStep/package.json +6 -0
- package/{esm/Questions/Step/Step.js → Questions/Step/Step/index.js} +11 -18
- package/Questions/Step/Step/package.json +6 -0
- package/{es/Questions/Step/StepArrayReview.js → Questions/Step/StepArrayReview/index.js} +2 -6
- package/Questions/Step/StepArrayReview/package.json +6 -0
- package/Questions/Step/StepContext/package.json +6 -0
- package/{esm/Questions/Step/StepDescription.js → Questions/Step/StepDescription/index.js} +4 -7
- package/Questions/Step/StepDescription/package.json +6 -0
- package/{es/Questions/Step/StepForm.js → Questions/Step/StepForm/index.js} +7 -11
- package/Questions/Step/StepForm/package.json +6 -0
- package/{es/Questions/Step/StepQuote.js → Questions/Step/StepQuote/index.js} +1 -2
- package/Questions/Step/StepQuote/package.json +6 -0
- package/{es/Questions/Step/StepTitle.js → Questions/Step/StepTitle/index.js} +14 -17
- package/Questions/Step/StepTitle/package.json +6 -0
- package/{esm/Questions/Step/getAddMoreFields.js → Questions/Step/getAddMoreFields/index.js} +0 -1
- package/Questions/Step/getAddMoreFields/package.json +6 -0
- package/Questions/Step/index.js +13 -170
- package/Questions/Step/package.json +6 -0
- package/Questions/Step/types/package.json +6 -0
- package/Questions/Step/types.d.ts +2 -2
- package/{es/Questions/__stories__/Default.js → Questions/__stories__/Default/index.js} +2 -8
- package/Questions/__stories__/Default/package.json +6 -0
- package/Questions/__stories__/Default.d.ts +1 -0
- package/{esm/Questions/getNextStep.js → Questions/getNextStep/index.js} +0 -3
- package/Questions/getNextStep/package.json +6 -0
- package/Questions/index.js +3 -25
- package/Questions/index.mdx +3 -3
- package/{esm/Questions/index.spec.js → Questions/index.spec/index.js} +0 -3
- package/Questions/index.spec/package.json +6 -0
- package/Questions/package.json +6 -0
- package/Questions/types/package.json +6 -0
- package/{Field/FieldBase.js → cjs/Field/FieldBase/index.js} +20 -33
- package/{Field/FieldBaseContainer.js → cjs/Field/FieldBaseContainer/index.js} +15 -33
- package/{Field/FieldConditional.js → cjs/Field/FieldConditional/index.js} +11 -26
- package/cjs/Field/index.js +80 -0
- package/{Field/utils.js → cjs/Field/utils/index.js} +28 -56
- package/{FieldArray/FieldArray.stories.js → cjs/FieldArray/FieldArray.stories/index.js} +2 -9
- package/{FieldArray/__stories__/Default.js → cjs/FieldArray/__stories__/Default/index.js} +5 -18
- package/{FieldArray/__stories__/WithExactLength.js → cjs/FieldArray/__stories__/WithExactLength/index.js} +5 -18
- package/cjs/FieldArray/index.js +68 -0
- package/cjs/FieldObject/index.js +64 -0
- package/{Fieldset/FieldsetWithContext.js → cjs/Fieldset/FieldsetWithContext/index.js} +9 -27
- package/cjs/Fieldset/index.js +44 -0
- package/{Form.stories.js → cjs/Form.stories/index.js} +2 -3
- package/{FormBuilder/FormBuilder.js → cjs/FormBuilder/FormBuilder/index.js} +42 -69
- package/{esm → cjs}/FormBuilder/FormBuilder.mdx +7 -7
- package/{FormBuilder/FormBuilder.stories.js → cjs/FormBuilder/FormBuilder.stories/index.js} +2 -7
- package/cjs/FormBuilder/__stories__/Default/index.js +36 -0
- package/cjs/FormBuilder/index.js +8 -0
- package/{FormContext.js → cjs/FormContext/index.js} +2 -5
- package/{MultiplicityField/MultiplicityField.stories.js → cjs/MultiplicityField/MultiplicityField.stories/index.js} +2 -17
- package/{MultiplicityField/__stories__/Default.js → cjs/MultiplicityField/__stories__/Default/index.js} +5 -18
- package/{MultiplicityField/__stories__/PreviewDisplay.js → cjs/MultiplicityField/__stories__/PreviewDisplay/index.js} +10 -34
- package/{MultiplicityField/__stories__/WithExactLength.js → cjs/MultiplicityField/__stories__/WithExactLength/index.js} +5 -18
- package/{MultiplicityField/__stories__/WithMaxLength.js → cjs/MultiplicityField/__stories__/WithMaxLength/index.js} +5 -18
- package/{MultiplicityField/__stories__/WithMinAndMaxLength.js → cjs/MultiplicityField/__stories__/WithMinAndMaxLength/index.js} +5 -18
- package/{MultiplicityField/__stories__/WithMinLength.js → cjs/MultiplicityField/__stories__/WithMinLength/index.js} +5 -18
- package/cjs/MultiplicityField/add-objects/index.js +155 -0
- package/cjs/MultiplicityField/index.js +118 -0
- package/{Questions/Questions.js → cjs/Questions/Questions/index.js} +23 -43
- package/{Questions/Questions.stories.js → cjs/Questions/Questions.stories/index.js} +2 -7
- package/{Questions/QuestionsContext.js → cjs/Questions/QuestionsContext/index.js} +2 -5
- package/{Questions/Step/ReviewStep.js → cjs/Questions/Step/ReviewStep/index.js} +15 -34
- package/{Questions/Step/Step.js → cjs/Questions/Step/Step/index.js} +15 -36
- package/{Questions/Step/StepArrayReview.js → cjs/Questions/Step/StepArrayReview/index.js} +10 -33
- package/{Questions/Step/StepContext.js → cjs/Questions/Step/StepContext/index.js} +2 -6
- package/cjs/Questions/Step/StepDescription/index.js +34 -0
- package/{Questions/Step/StepForm.js → cjs/Questions/Step/StepForm/index.js} +13 -33
- package/{Questions/Step/StepQuote.js → cjs/Questions/Step/StepQuote/index.js} +4 -13
- package/cjs/Questions/Step/StepTitle/index.js +51 -0
- package/{Questions/Step/getAddMoreFields.js → cjs/Questions/Step/getAddMoreFields/index.js} +2 -6
- package/cjs/Questions/Step/index.js +143 -0
- package/{Questions/__stories__/Default.js → cjs/Questions/__stories__/Default/index.js} +10 -32
- package/{Questions/getNextStep.js → cjs/Questions/getNextStep/index.js} +0 -4
- package/cjs/Questions/index.js +21 -0
- package/{es → cjs}/Questions/index.mdx +3 -3
- package/{Questions/index.spec.js → cjs/Questions/index.spec/index.js} +2 -12
- package/cjs/index.js +22 -0
- package/{inputs/AutoComplete/AutoComplete.stories.js → cjs/inputs/AutoCompleteInput/AutoComplete.stories/index.js} +7 -12
- package/{inputs/AutoComplete/__stories__/Default.js → cjs/inputs/AutoCompleteInput/__stories__/Default/index.js} +6 -21
- package/{inputs/AutoComplete → cjs/inputs/AutoCompleteInput}/index.js +11 -27
- package/{inputs/Checkboxes/Checkboxes.stories.js → cjs/inputs/Checkboxes/Checkboxes.stories/index.js} +2 -11
- package/{inputs/Checkboxes/__stories__/Conditional.js → cjs/inputs/Checkboxes/__stories__/Conditional/index.js} +5 -18
- package/cjs/inputs/Checkboxes/__stories__/Default/index.js +50 -0
- package/cjs/inputs/Checkboxes/__stories__/WithDivider/index.js +51 -0
- package/cjs/inputs/Checkboxes/index.js +101 -0
- package/{inputs/DateInput/DateInput.stories.js → cjs/inputs/DateInput/DateInput.stories/index.js} +2 -7
- package/cjs/inputs/DateInput/__stories__/Default/index.js +33 -0
- package/cjs/inputs/DateInput/index.js +141 -0
- package/{inputs/FileInput/FileInput.stories.js → cjs/inputs/FileInput/FileInput.stories/index.js} +2 -7
- package/cjs/inputs/FileInput/__stories__/Default/index.js +30 -0
- package/cjs/inputs/FileInput/index.js +68 -0
- package/cjs/inputs/ImageInput/ImageInput.stories/index.js +50 -0
- package/cjs/inputs/ImageInput/ImageInput.stories.playwright.json +77 -0
- package/cjs/inputs/ImageInput/__stories__/Default/index.js +38 -0
- package/cjs/inputs/ImageInput/__stories__/WithInvalidImageDimension/index.js +46 -0
- package/cjs/inputs/ImageInput/__stories__/WithInvalidImageSize/index.js +43 -0
- package/cjs/inputs/ImageInput/index.js +86 -0
- package/{inputs/Input/Input.stories.js → cjs/inputs/Input/Input.stories/index.js} +2 -23
- package/cjs/inputs/Input/__stories__/AFM/index.js +32 -0
- package/cjs/inputs/Input/__stories__/Boolean/index.js +33 -0
- package/cjs/inputs/Input/__stories__/Default/index.js +33 -0
- package/cjs/inputs/Input/__stories__/IBAN/index.js +33 -0
- package/{inputs/Input/__stories__/Integer.js → cjs/inputs/Input/__stories__/Integer/index.js} +5 -17
- package/cjs/inputs/Input/__stories__/MobilePhone/index.js +32 -0
- package/cjs/inputs/Input/__stories__/PhoneNumber/index.js +32 -0
- package/cjs/inputs/Input/__stories__/PostalCode/index.js +35 -0
- package/cjs/inputs/Input/__stories__/TextWithCharacterLimit/index.js +39 -0
- package/cjs/inputs/Input/index.js +76 -0
- package/{inputs/Label/Label.stories.js → cjs/inputs/Label/Label.stories/index.js} +2 -7
- package/cjs/inputs/Label/__stories__/Default/index.js +37 -0
- package/cjs/inputs/Label/index.js +29 -0
- package/{inputs/OtpInput/OtpInput.stories.js → cjs/inputs/OtpInput/OtpInput.stories/index.js} +2 -7
- package/cjs/inputs/OtpInput/__stories__/Default/index.js +39 -0
- package/cjs/inputs/OtpInput/index.js +150 -0
- package/{inputs/Radio/Radio.stories.js → cjs/inputs/Radio/Radio.stories/index.js} +2 -11
- package/{inputs/Radio/__stories__/Conditional.js → cjs/inputs/Radio/__stories__/Conditional/index.js} +5 -18
- package/{inputs/Radio/__stories__/Default.js → cjs/inputs/Radio/__stories__/Default/index.js} +5 -17
- package/{inputs/Radio/__stories__/WithDivider.js → cjs/inputs/Radio/__stories__/WithDivider/index.js} +5 -17
- package/cjs/inputs/Radio/index.js +64 -0
- package/{inputs/Select/Select.stories.js → cjs/inputs/Select/Select.stories/index.js} +2 -7
- package/{inputs/Select/__stories__/Default.js → cjs/inputs/Select/__stories__/Default/index.js} +5 -17
- package/cjs/inputs/Select/index.js +38 -0
- package/cjs/inputs/index.js +69 -0
- package/{internal.js → cjs/internal/index.js} +2 -45
- package/{registry.js → cjs/registry/index.js} +10 -71
- package/cjs/utils/index.js +87 -0
- package/{es → cjs}/validators/index.js +45 -38
- package/{validators/utils/afm.js → cjs/validators/utils/afm/index.js} +2 -9
- package/{validators/utils/file.js → cjs/validators/utils/file/index.js} +8 -19
- package/{validators/utils/iban.js → cjs/validators/utils/iban/index.js} +1 -12
- package/cjs/validators/utils/image/index.js +126 -0
- package/cjs/validators/utils/index.js +204 -0
- package/{validators/utils/int.js → cjs/validators/utils/int/index.js} +2 -7
- package/{validators/utils/number.js → cjs/validators/utils/number/index.js} +2 -7
- package/{validators/utils/otp.js → cjs/validators/utils/otp/index.js} +2 -7
- package/{validators/utils/phone.js → cjs/validators/utils/phone/index.js} +7 -32
- package/{validators/utils/postal_code.js → cjs/validators/utils/postal_code/index.js} +2 -8
- package/{validators/utils/text_limit.js → cjs/validators/utils/text_limit/index.js} +2 -13
- package/{validators/utils/uuid4.js → cjs/validators/utils/uuid4/index.js} +2 -7
- package/{validators/validators.spec.js → cjs/validators/validators.spec/index.js} +0 -1
- package/index.js +8 -28
- package/inputs/AutoCompleteInput/AutoComplete.stories/index.js +7 -0
- package/inputs/AutoCompleteInput/AutoComplete.stories/package.json +6 -0
- package/inputs/{AutoComplete → AutoCompleteInput}/AutoComplete.stories.d.ts +2 -2
- package/{esm/inputs/AutoComplete/__stories__/Default.js → inputs/AutoCompleteInput/__stories__/Default/index.js} +0 -3
- package/inputs/AutoCompleteInput/__stories__/Default/package.json +6 -0
- package/inputs/{AutoComplete → AutoCompleteInput}/__stories__/Default.d.ts +1 -0
- package/inputs/AutoCompleteInput/index.d.ts +14 -0
- package/{es/inputs/AutoComplete → inputs/AutoCompleteInput}/index.js +7 -10
- package/inputs/AutoCompleteInput/package.json +6 -0
- package/inputs/Checkboxes/Checkboxes.stories/package.json +6 -0
- package/{esm/inputs/Checkboxes/__stories__/Conditional.js → inputs/Checkboxes/__stories__/Conditional/index.js} +0 -3
- package/inputs/Checkboxes/__stories__/Conditional/package.json +6 -0
- package/inputs/Checkboxes/__stories__/Conditional.d.ts +1 -0
- package/{es/inputs/Checkboxes/__stories__/Default.js → inputs/Checkboxes/__stories__/Default/index.js} +0 -2
- package/inputs/Checkboxes/__stories__/Default/package.json +6 -0
- package/inputs/Checkboxes/__stories__/Default.d.ts +1 -0
- package/{es/inputs/Checkboxes/__stories__/WithDivider.js → inputs/Checkboxes/__stories__/WithDivider/index.js} +0 -2
- package/inputs/Checkboxes/__stories__/WithDivider/package.json +6 -0
- package/inputs/Checkboxes/__stories__/WithDivider.d.ts +1 -0
- package/inputs/Checkboxes/index.js +40 -76
- package/inputs/Checkboxes/package.json +6 -0
- package/inputs/DateInput/DateInput.stories/package.json +6 -0
- package/{esm/inputs/DateInput/__stories__/Default.js → inputs/DateInput/__stories__/Default/index.js} +0 -2
- package/inputs/DateInput/__stories__/Default/package.json +6 -0
- package/inputs/DateInput/__stories__/Default.d.ts +1 -0
- package/inputs/DateInput/index.d.ts +1 -0
- package/inputs/DateInput/index.js +39 -89
- package/inputs/DateInput/package.json +6 -0
- package/inputs/FileInput/FileInput.stories/package.json +6 -0
- package/{esm/inputs/FileInput/__stories__/Default.js → inputs/FileInput/__stories__/Default/index.js} +0 -2
- package/inputs/FileInput/__stories__/Default/package.json +6 -0
- package/inputs/FileInput/__stories__/Default.d.ts +1 -0
- package/inputs/FileInput/index.d.ts +3 -1
- package/inputs/FileInput/index.js +32 -66
- package/inputs/FileInput/package.json +6 -0
- package/inputs/ImageInput/ImageInput.stories/index.js +9 -0
- package/inputs/ImageInput/ImageInput.stories/package.json +6 -0
- package/inputs/ImageInput/ImageInput.stories.d.ts +10 -0
- package/inputs/ImageInput/ImageInput.stories.playwright.json +77 -0
- package/{esm/inputs/OtpInput/__stories__/Default.js → inputs/ImageInput/__stories__/Default/index.js} +3 -6
- package/inputs/ImageInput/__stories__/Default/package.json +6 -0
- package/inputs/ImageInput/__stories__/Default.d.ts +3 -0
- package/inputs/ImageInput/__stories__/WithInvalidImageDimension/index.js +36 -0
- package/inputs/ImageInput/__stories__/WithInvalidImageDimension/package.json +6 -0
- package/inputs/ImageInput/__stories__/WithInvalidImageDimension.d.ts +3 -0
- package/inputs/ImageInput/__stories__/WithInvalidImageSize/index.js +33 -0
- package/inputs/ImageInput/__stories__/WithInvalidImageSize/package.json +6 -0
- package/inputs/ImageInput/__stories__/WithInvalidImageSize.d.ts +3 -0
- package/inputs/ImageInput/index.d.ts +25 -0
- package/inputs/ImageInput/index.js +76 -0
- package/inputs/ImageInput/package.json +6 -0
- package/inputs/Input/Input.stories/package.json +6 -0
- package/{esm/inputs/Input/__stories__/AFM.js → inputs/Input/__stories__/AFM/index.js} +0 -2
- package/inputs/Input/__stories__/AFM/package.json +6 -0
- package/inputs/Input/__stories__/AFM.d.ts +1 -0
- package/{esm/inputs/Input/__stories__/Boolean.js → inputs/Input/__stories__/Boolean/index.js} +0 -2
- package/inputs/Input/__stories__/Boolean/package.json +6 -0
- package/inputs/Input/__stories__/Boolean.d.ts +1 -0
- package/{esm/inputs/Input/__stories__/Default.js → inputs/Input/__stories__/Default/index.js} +0 -2
- package/inputs/Input/__stories__/Default/package.json +6 -0
- package/inputs/Input/__stories__/Default.d.ts +1 -0
- package/{esm/inputs/Input/__stories__/IBAN.js → inputs/Input/__stories__/IBAN/index.js} +0 -2
- package/inputs/Input/__stories__/IBAN/package.json +6 -0
- package/inputs/Input/__stories__/IBAN.d.ts +1 -0
- package/{es/inputs/Input/__stories__/Integer.js → inputs/Input/__stories__/Integer/index.js} +0 -2
- package/inputs/Input/__stories__/Integer/package.json +6 -0
- package/inputs/Input/__stories__/Integer.d.ts +1 -0
- package/{esm/inputs/Input/__stories__/MobilePhone.js → inputs/Input/__stories__/MobilePhone/index.js} +0 -2
- package/inputs/Input/__stories__/MobilePhone/package.json +6 -0
- package/inputs/Input/__stories__/MobilePhone.d.ts +1 -0
- package/{esm/inputs/Input/__stories__/PhoneNumber.js → inputs/Input/__stories__/PhoneNumber/index.js} +0 -2
- package/inputs/Input/__stories__/PhoneNumber/package.json +6 -0
- package/inputs/Input/__stories__/PhoneNumber.d.ts +1 -0
- package/{es/inputs/Input/__stories__/PostalCode.js → inputs/Input/__stories__/PostalCode/index.js} +0 -2
- package/inputs/Input/__stories__/PostalCode/package.json +6 -0
- package/inputs/Input/__stories__/PostalCode.d.ts +1 -0
- package/{es/inputs/Input/__stories__/TextWithCharacterLimit.js → inputs/Input/__stories__/TextWithCharacterLimit/index.js} +0 -2
- package/inputs/Input/__stories__/TextWithCharacterLimit/package.json +6 -0
- package/inputs/Input/__stories__/TextWithCharacterLimit.d.ts +1 -0
- package/inputs/Input/index.js +33 -60
- package/inputs/Input/package.json +6 -0
- package/inputs/Label/Label.stories/package.json +6 -0
- package/{esm/inputs/Label/__stories__/Default.js → inputs/Label/__stories__/Default/index.js} +0 -2
- package/inputs/Label/__stories__/Default/package.json +6 -0
- package/inputs/Label/__stories__/Default.d.ts +1 -0
- package/inputs/Label/index.js +12 -31
- package/inputs/Label/package.json +6 -0
- package/inputs/OtpInput/OtpInput.stories/package.json +6 -0
- package/{es/inputs/OtpInput/__stories__/Default.js → inputs/OtpInput/__stories__/Default/index.js} +0 -2
- package/inputs/OtpInput/__stories__/Default/package.json +6 -0
- package/inputs/OtpInput/__stories__/Default.d.ts +1 -0
- package/inputs/OtpInput/index.d.ts +1 -0
- package/inputs/OtpInput/index.js +33 -75
- package/inputs/OtpInput/package.json +6 -0
- package/inputs/Radio/Radio.stories/package.json +6 -0
- package/{es/inputs/Radio/__stories__/Conditional.js → inputs/Radio/__stories__/Conditional/index.js} +0 -3
- package/inputs/Radio/__stories__/Conditional/package.json +6 -0
- package/inputs/Radio/__stories__/Conditional.d.ts +1 -0
- package/{esm/inputs/Radio/__stories__/Default.js → inputs/Radio/__stories__/Default/index.js} +0 -2
- package/inputs/Radio/__stories__/Default/package.json +6 -0
- package/inputs/Radio/__stories__/Default.d.ts +1 -0
- package/{esm/inputs/Radio/__stories__/WithDivider.js → inputs/Radio/__stories__/WithDivider/index.js} +0 -2
- package/inputs/Radio/__stories__/WithDivider/package.json +6 -0
- package/inputs/Radio/__stories__/WithDivider.d.ts +1 -0
- package/inputs/Radio/index.js +34 -59
- package/inputs/Radio/package.json +6 -0
- package/inputs/Select/Select.stories/package.json +6 -0
- package/{esm/inputs/Select/__stories__/Default.js → inputs/Select/__stories__/Default/index.js} +0 -2
- package/inputs/Select/__stories__/Default/package.json +6 -0
- package/inputs/Select/__stories__/Default.d.ts +1 -0
- package/inputs/Select/index.js +16 -34
- package/inputs/Select/package.json +6 -0
- package/inputs/index.d.ts +1 -0
- package/inputs/index.js +9 -71
- package/inputs/package.json +6 -0
- package/internal/package.json +6 -0
- package/package.json +6 -6
- package/{esm/registry.js → registry/index.js} +6 -4
- package/registry/package.json +6 -0
- package/registry.d.ts +4 -2
- package/src/Field/utils.ts +9 -2
- package/src/FormBuilder/FormBuilder.mdx +7 -7
- package/src/MultiplicityField/__stories__/PreviewDisplay.tsx +4 -3
- package/src/Questions/Step/ReviewStep.tsx +2 -2
- package/src/Questions/Step/StepArrayReview.tsx +3 -1
- package/src/Questions/Step/StepTitle.tsx +4 -4
- package/src/Questions/__stories__/Default.tsx +3 -3
- package/src/Questions/index.mdx +3 -3
- package/src/inputs/AutoCompleteInput/AutoComplete.stories.js +7 -0
- package/src/inputs/{AutoComplete → AutoCompleteInput}/index.tsx +5 -5
- package/src/inputs/FileInput/index.tsx +3 -1
- package/src/inputs/ImageInput/ImageInput.stories.js +9 -0
- package/src/inputs/ImageInput/ImageInput.stories.playwright.json +77 -0
- package/src/inputs/ImageInput/__stories__/Default.tsx +31 -0
- package/src/inputs/ImageInput/__stories__/WithInvalidImageDimension.tsx +39 -0
- package/src/inputs/ImageInput/__stories__/WithInvalidImageSize.tsx +36 -0
- package/src/inputs/ImageInput/index.tsx +110 -0
- package/src/inputs/Input/index.tsx +6 -6
- package/src/inputs/index.ts +1 -0
- package/src/registry.js +105 -39
- package/src/types.tsx +2 -0
- package/src/validators/index.ts +14 -0
- package/src/validators/utils/file.ts +2 -2
- package/src/validators/utils/image.ts +92 -0
- package/src/validators/utils/index.ts +1 -0
- package/types/package.json +6 -0
- package/types.d.ts +5 -4
- package/utils/index.js +80 -0
- package/utils/package.json +6 -0
- package/validators/index.js +34 -66
- package/validators/package.json +6 -0
- package/validators/types/package.json +6 -0
- package/validators/types.d.ts +1 -1
- package/{esm/validators/utils/afm.js → validators/utils/afm/index.js} +0 -4
- package/validators/utils/afm/package.json +6 -0
- package/{es/validators/utils/file.js → validators/utils/file/index.js} +6 -13
- package/validators/utils/file/package.json +6 -0
- package/{esm/validators/utils/iban.js → validators/utils/iban/index.js} +0 -7
- package/validators/utils/iban/package.json +6 -0
- package/validators/utils/image/index.js +119 -0
- package/validators/utils/image/package.json +6 -0
- package/validators/utils/image.d.ts +3 -0
- package/validators/utils/index.d.ts +1 -0
- package/validators/utils/index.js +15 -155
- package/{esm/validators/utils/int.js → validators/utils/int/index.js} +0 -1
- package/validators/utils/int/package.json +6 -0
- package/{esm/validators/utils/number.js → validators/utils/number/index.js} +0 -1
- package/validators/utils/number/package.json +6 -0
- package/{es/validators/utils/otp.js → validators/utils/otp/index.js} +0 -1
- package/validators/utils/otp/package.json +6 -0
- package/validators/utils/package.json +6 -0
- package/{esm/validators/utils/phone.js → validators/utils/phone/index.js} +2 -16
- package/validators/utils/phone/package.json +6 -0
- package/validators/utils/phone.d.ts +1 -1
- package/{es/validators/utils/postal_code.js → validators/utils/postal_code/index.js} +0 -2
- package/validators/utils/postal_code/package.json +6 -0
- package/{es/validators/utils/text_limit.js → validators/utils/text_limit/index.js} +0 -7
- package/validators/utils/text_limit/package.json +6 -0
- package/{esm/validators/utils/uuid4.js → validators/utils/uuid4/index.js} +0 -2
- package/validators/utils/uuid4/package.json +6 -0
- package/validators/validators.spec/package.json +6 -0
- package/FormBuilder/__stories__/Default.js +0 -49
- package/MultiplicityField/add-objects.js +0 -184
- package/Questions/Step/StepDescription.js +0 -55
- package/Questions/Step/StepTitle.js +0 -75
- package/es/Field/FieldBaseContainer.js +0 -43
- package/es/Field/index.js +0 -76
- package/es/Field/utils.js +0 -162
- package/es/FieldArray/index.js +0 -65
- package/es/FieldObject/index.js +0 -58
- package/es/Fieldset/FieldsetWithContext.js +0 -41
- package/es/Fieldset/index.js +0 -34
- package/es/FormBuilder/FormBuilder.js +0 -160
- package/es/FormBuilder/FormBuilder.mdx +0 -256
- package/es/FormBuilder/index.js +0 -2
- package/es/MultiplicityField/__stories__/PreviewDisplay.js +0 -83
- package/es/MultiplicityField/__stories__/WithMinAndMaxLength.js +0 -96
- package/es/MultiplicityField/__stories__/WithMinLength.js +0 -95
- package/es/MultiplicityField/add-objects.js +0 -160
- package/es/MultiplicityField/index.js +0 -114
- package/es/Questions/Step/Step.js +0 -69
- package/es/Questions/Step/StepDescription.js +0 -27
- package/es/Questions/Step/getAddMoreFields.js +0 -22
- package/es/Questions/Step/index.js +0 -13
- package/es/Questions/getNextStep.js +0 -23
- package/es/Questions/index.js +0 -3
- package/es/Questions/index.spec.js +0 -62
- package/es/index.js +0 -3
- package/es/inputs/AutoComplete/AutoComplete.stories.js +0 -7
- package/es/inputs/AutoComplete/__stories__/Default.js +0 -49
- package/es/inputs/Checkboxes/__stories__/Conditional.js +0 -95
- package/es/inputs/Checkboxes/index.js +0 -100
- package/es/inputs/DateInput/__stories__/Default.js +0 -25
- package/es/inputs/DateInput/index.js +0 -155
- package/es/inputs/FileInput/__stories__/Default.js +0 -22
- package/es/inputs/FileInput/index.js +0 -62
- package/es/inputs/Input/__stories__/AFM.js +0 -24
- package/es/inputs/Input/__stories__/Boolean.js +0 -25
- package/es/inputs/Input/__stories__/Default.js +0 -25
- package/es/inputs/Input/__stories__/IBAN.js +0 -25
- package/es/inputs/Input/__stories__/MobilePhone.js +0 -24
- package/es/inputs/Input/__stories__/PhoneNumber.js +0 -24
- package/es/inputs/Input/index.js +0 -75
- package/es/inputs/Label/__stories__/Default.js +0 -29
- package/es/inputs/Label/index.js +0 -25
- package/es/inputs/OtpInput/index.js +0 -157
- package/es/inputs/Radio/__stories__/Default.js +0 -47
- package/es/inputs/Radio/__stories__/WithDivider.js +0 -48
- package/es/inputs/Radio/index.js +0 -61
- package/es/inputs/Select/__stories__/Default.js +0 -53
- package/es/inputs/Select/index.js +0 -32
- package/es/inputs/index.js +0 -8
- package/es/registry.js +0 -136
- package/es/utils.js +0 -99
- package/es/validators/utils/afm.js +0 -35
- package/es/validators/utils/iban.js +0 -123
- package/es/validators/utils/index.js +0 -102
- package/es/validators/utils/int.js +0 -20
- package/es/validators/utils/number.js +0 -16
- package/es/validators/utils/phone.js +0 -122
- package/es/validators/utils/uuid4.js +0 -20
- package/esm/Field/FieldBase.js +0 -84
- package/esm/Field/FieldConditional.js +0 -62
- package/esm/Field/index.js +0 -76
- package/esm/Field/index.mdx +0 -6
- package/esm/Field/types.js +0 -1
- package/esm/FieldArray/FieldArray.stories.js +0 -8
- package/esm/FieldArray/FieldArray.stories.playwright.json +0 -353
- package/esm/FieldArray/__stories__/Default.js +0 -90
- package/esm/FieldArray/__stories__/WithExactLength.js +0 -90
- package/esm/FieldArray/index.js +0 -65
- package/esm/FieldObject/index.js +0 -58
- package/esm/Fieldset/index.js +0 -34
- package/esm/Fieldset/types.js +0 -1
- package/esm/Form.stories.js +0 -3
- package/esm/FormBuilder/FormBuilder.stories.js +0 -7
- package/esm/FormBuilder/FormBuilder.stories.playwright.json +0 -52
- package/esm/FormBuilder/__stories__/Default.js +0 -28
- package/esm/FormBuilder/index.js +0 -2
- package/esm/FormContext.js +0 -5
- package/esm/MultiplicityField/MultiplicityField.mdx +0 -590
- package/esm/MultiplicityField/MultiplicityField.stories.js +0 -12
- package/esm/MultiplicityField/MultiplicityField.stories.playwright.json +0 -1370
- package/esm/MultiplicityField/__stories__/Default.js +0 -97
- package/esm/MultiplicityField/__stories__/WithExactLength.js +0 -92
- package/esm/MultiplicityField/__stories__/WithMaxLength.js +0 -95
- package/esm/MultiplicityField/add-objects.js +0 -160
- package/esm/MultiplicityField/index.js +0 -114
- package/esm/Questions/Questions.js +0 -84
- package/esm/Questions/Questions.stories.js +0 -7
- package/esm/Questions/QuestionsContext.js +0 -11
- package/esm/Questions/Step/ReviewStep.js +0 -53
- package/esm/Questions/Step/StepArrayReview.js +0 -50
- package/esm/Questions/Step/StepContext.js +0 -27
- package/esm/Questions/Step/StepForm.js +0 -48
- package/esm/Questions/Step/StepQuote.js +0 -11
- package/esm/Questions/Step/StepTitle.js +0 -44
- package/esm/Questions/Step/index.js +0 -13
- package/esm/Questions/Step/types.js +0 -1
- package/esm/Questions/__snapshots__/index.spec.tsx.snap +0 -596
- package/esm/Questions/__stories__/Default.js +0 -108
- package/esm/Questions/index.js +0 -3
- package/esm/Questions/index.mdx +0 -415
- package/esm/Questions/types.js +0 -1
- package/esm/create-simple-form.mdx +0 -539
- package/esm/index.js +0 -8
- package/esm/index.mdx +0 -51
- package/esm/inputs/AutoComplete/AutoComplete.stories.js +0 -7
- package/esm/inputs/AutoComplete/index.js +0 -45
- package/esm/inputs/Checkboxes/Checkboxes.stories.js +0 -9
- package/esm/inputs/Checkboxes/Checkboxes.stories.playwright.json +0 -85
- package/esm/inputs/Checkboxes/__stories__/Default.js +0 -42
- package/esm/inputs/Checkboxes/__stories__/WithDivider.js +0 -43
- package/esm/inputs/Checkboxes/index.js +0 -100
- package/esm/inputs/Checkboxes/index.mdx +0 -0
- package/esm/inputs/DateInput/DateInput.stories.js +0 -7
- package/esm/inputs/DateInput/DateInput.stories.playwright.json +0 -72
- package/esm/inputs/DateInput/index.js +0 -155
- package/esm/inputs/FileInput/FileInput.stories.js +0 -7
- package/esm/inputs/FileInput/FileInput.stories.playwright.json +0 -75
- package/esm/inputs/FileInput/index.js +0 -62
- package/esm/inputs/Input/Input.stories.js +0 -15
- package/esm/inputs/Input/Input.stories.playwright.json +0 -376
- package/esm/inputs/Input/__stories__/Integer.js +0 -33
- package/esm/inputs/Input/__stories__/PostalCode.js +0 -27
- package/esm/inputs/Input/__stories__/TextWithCharacterLimit.js +0 -31
- package/esm/inputs/Input/index.js +0 -75
- package/esm/inputs/Input/index.mdx +0 -8
- package/esm/inputs/Label/Label.stories.js +0 -7
- package/esm/inputs/Label/Label.stories.playwright.json +0 -40
- package/esm/inputs/Label/index.js +0 -25
- package/esm/inputs/Label/index.mdx +0 -0
- package/esm/inputs/OtpInput/OtpInput.stories.js +0 -7
- package/esm/inputs/OtpInput/index.js +0 -157
- package/esm/inputs/Radio/Radio.stories.js +0 -9
- package/esm/inputs/Radio/Radio.stories.playwright.json +0 -73
- package/esm/inputs/Radio/__stories__/Conditional.js +0 -95
- package/esm/inputs/Radio/index.js +0 -61
- package/esm/inputs/Radio/index.mdx +0 -0
- package/esm/inputs/Select/Select.stories.js +0 -7
- package/esm/inputs/Select/Select.stories.playwright.json +0 -22
- package/esm/inputs/Select/index.js +0 -32
- package/esm/inputs/index.js +0 -8
- package/esm/installation.mdx +0 -68
- package/esm/internal.js +0 -34
- package/esm/types.js +0 -1
- package/esm/utils.js +0 -99
- package/esm/validators/index.js +0 -186
- package/esm/validators/types.js +0 -1
- package/esm/validators/utils/file.js +0 -52
- package/esm/validators/utils/index.js +0 -102
- package/esm/validators/utils/otp.js +0 -26
- package/esm/validators/utils/postal_code.js +0 -29
- package/esm/validators/utils/text_limit.js +0 -54
- package/esm/validators/validators.spec.js +0 -85
- package/inputs/AutoComplete/index.d.ts +0 -14
- package/inputs/Checkboxes/__stories__/Default.js +0 -62
- package/inputs/Checkboxes/__stories__/WithDivider.js +0 -63
- package/inputs/DateInput/__stories__/Default.js +0 -45
- package/inputs/FileInput/__stories__/Default.js +0 -42
- package/inputs/Input/__stories__/AFM.js +0 -44
- package/inputs/Input/__stories__/Boolean.js +0 -45
- package/inputs/Input/__stories__/Default.js +0 -45
- package/inputs/Input/__stories__/IBAN.js +0 -45
- package/inputs/Input/__stories__/MobilePhone.js +0 -44
- package/inputs/Input/__stories__/PhoneNumber.js +0 -44
- package/inputs/Input/__stories__/PostalCode.js +0 -47
- package/inputs/Input/__stories__/TextWithCharacterLimit.js +0 -51
- package/inputs/Label/__stories__/Default.js +0 -49
- package/inputs/OtpInput/__stories__/Default.js +0 -52
- package/src/inputs/AutoComplete/AutoComplete.stories.js +0 -7
- package/utils.js +0 -113
- /package/{es/Field/types.js → Field/types/index.js} +0 -0
- /package/{es/FieldArray/FieldArray.stories.js → FieldArray/FieldArray.stories/index.js} +0 -0
- /package/{es/Fieldset/types.js → Fieldset/types/index.js} +0 -0
- /package/{es/Form.stories.js → Form.stories/index.js} +0 -0
- /package/{es/FormBuilder/FormBuilder.stories.js → FormBuilder/FormBuilder.stories/index.js} +0 -0
- /package/{es/FormContext.js → FormContext/index.js} +0 -0
- /package/{es/MultiplicityField/MultiplicityField.stories.js → MultiplicityField/MultiplicityField.stories/index.js} +0 -0
- /package/{es/Questions/Questions.stories.js → Questions/Questions.stories/index.js} +0 -0
- /package/{es/Questions/QuestionsContext.js → Questions/QuestionsContext/index.js} +0 -0
- /package/{es/Questions/Step/StepContext.js → Questions/Step/StepContext/index.js} +0 -0
- /package/{es/Questions/Step/types.js → Questions/Step/types/index.js} +0 -0
- /package/{es/Questions/types.js → Questions/types/index.js} +0 -0
- /package/{es → cjs}/Field/index.mdx +0 -0
- /package/{Field/types.js → cjs/Field/types/index.js} +0 -0
- /package/{es → cjs}/FieldArray/FieldArray.stories.playwright.json +0 -0
- /package/{Fieldset/types.js → cjs/Fieldset/types/index.js} +0 -0
- /package/{es → cjs}/FormBuilder/FormBuilder.stories.playwright.json +0 -0
- /package/{es → cjs}/MultiplicityField/MultiplicityField.mdx +0 -0
- /package/{es → cjs}/MultiplicityField/MultiplicityField.stories.playwright.json +0 -0
- /package/{Questions/Step/types.js → cjs/Questions/Step/types/index.js} +0 -0
- /package/{es → cjs}/Questions/__snapshots__/index.spec.tsx.snap +0 -0
- /package/{Questions/types.js → cjs/Questions/types/index.js} +0 -0
- /package/{es → cjs}/create-simple-form.mdx +0 -0
- /package/{es → cjs}/index.mdx +0 -0
- /package/{es → cjs}/inputs/Checkboxes/Checkboxes.stories.playwright.json +0 -0
- /package/{es → cjs}/inputs/Checkboxes/index.mdx +0 -0
- /package/{es → cjs}/inputs/DateInput/DateInput.stories.playwright.json +0 -0
- /package/{es → cjs}/inputs/FileInput/FileInput.stories.playwright.json +0 -0
- /package/{es → cjs}/inputs/Input/Input.stories.playwright.json +0 -0
- /package/{es → cjs}/inputs/Input/index.mdx +0 -0
- /package/{es → cjs}/inputs/Label/Label.stories.playwright.json +0 -0
- /package/{es → cjs}/inputs/Label/index.mdx +0 -0
- /package/{es → cjs}/inputs/Radio/Radio.stories.playwright.json +0 -0
- /package/{es → cjs}/inputs/Radio/index.mdx +0 -0
- /package/{es → cjs}/inputs/Select/Select.stories.playwright.json +0 -0
- /package/{es → cjs}/installation.mdx +0 -0
- /package/{types.js → cjs/types/index.js} +0 -0
- /package/{validators/types.js → cjs/validators/types/index.js} +0 -0
- /package/{es/inputs/Checkboxes/Checkboxes.stories.js → inputs/Checkboxes/Checkboxes.stories/index.js} +0 -0
- /package/{es/inputs/DateInput/DateInput.stories.js → inputs/DateInput/DateInput.stories/index.js} +0 -0
- /package/{es/inputs/FileInput/FileInput.stories.js → inputs/FileInput/FileInput.stories/index.js} +0 -0
- /package/{es/inputs/Input/Input.stories.js → inputs/Input/Input.stories/index.js} +0 -0
- /package/{es/inputs/Label/Label.stories.js → inputs/Label/Label.stories/index.js} +0 -0
- /package/{es/inputs/OtpInput/OtpInput.stories.js → inputs/OtpInput/OtpInput.stories/index.js} +0 -0
- /package/{es/inputs/Radio/Radio.stories.js → inputs/Radio/Radio.stories/index.js} +0 -0
- /package/{es/inputs/Select/Select.stories.js → inputs/Select/Select.stories/index.js} +0 -0
- /package/{es/internal.js → internal/index.js} +0 -0
- /package/src/inputs/{AutoComplete → AutoCompleteInput}/__stories__/Default.tsx +0 -0
- /package/{es/types.js → types/index.js} +0 -0
- /package/{es/validators/types.js → validators/types/index.js} +0 -0
- /package/{es/validators/validators.spec.js → validators/validators.spec/index.js} +0 -0
|
@@ -6,29 +6,27 @@ import { Controller } from 'react-hook-form';
|
|
|
6
6
|
import FieldBaseContainer from '@digigov/form/Field/FieldBaseContainer';
|
|
7
7
|
export var FieldBase = function FieldBase(props) {
|
|
8
8
|
var required = props.required,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
9
|
+
name = props.name,
|
|
10
|
+
Component = props.component,
|
|
11
|
+
wrapper = props.wrapper,
|
|
12
|
+
control = props.control,
|
|
13
|
+
type = props.type,
|
|
14
|
+
_props$controlled = props.controlled,
|
|
15
|
+
controlled = _props$controlled === void 0 ? false : _props$controlled,
|
|
16
|
+
_props$enabled = props.enabled,
|
|
17
|
+
enabled = _props$enabled === void 0 ? true : _props$enabled,
|
|
18
|
+
editable = props.editable,
|
|
19
|
+
defaultValue = props.defaultValue,
|
|
20
|
+
label = props.label,
|
|
21
|
+
_props$extra = props.extra,
|
|
22
|
+
extra = _props$extra === void 0 ? {} : _props$extra,
|
|
23
|
+
layout = props.layout,
|
|
24
|
+
error = props.error,
|
|
25
|
+
register = props.register,
|
|
26
|
+
componentProps = _objectWithoutProperties(props, _excluded);
|
|
28
27
|
if (!enabled) {
|
|
29
28
|
return null;
|
|
30
29
|
}
|
|
31
|
-
|
|
32
30
|
if (controlled) {
|
|
33
31
|
return /*#__PURE__*/React.createElement(FieldBaseContainer, {
|
|
34
32
|
label: label,
|
|
@@ -54,7 +52,6 @@ export var FieldBase = function FieldBase(props) {
|
|
|
54
52
|
}
|
|
55
53
|
}));
|
|
56
54
|
}
|
|
57
|
-
|
|
58
55
|
return /*#__PURE__*/React.createElement(FieldBaseContainer, {
|
|
59
56
|
label: label,
|
|
60
57
|
layout: layout,
|
|
@@ -10,18 +10,15 @@ import LabelContainer from '@digigov/react-core/LabelContainer';
|
|
|
10
10
|
import { useTranslation } from '@digigov/ui/i18n';
|
|
11
11
|
export var FieldBaseContainer = function FieldBaseContainer(_ref) {
|
|
12
12
|
var name = _ref.name,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
wrapper = _ref.wrapper,
|
|
14
|
+
label = _ref.label,
|
|
15
|
+
children = _ref.children,
|
|
16
|
+
error = _ref.error,
|
|
17
|
+
layout = _ref.layout;
|
|
19
18
|
var _useTranslation = useTranslation(),
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
t = _useTranslation.t;
|
|
22
20
|
var errorMessage = error !== null && error !== void 0 && error.message.key ? error.message.key : (error === null || error === void 0 ? void 0 : error.message) || '';
|
|
23
21
|
var errorContext = (error === null || error === void 0 ? void 0 : error.message.context) || {};
|
|
24
|
-
|
|
25
22
|
if (wrapper === 'fieldset') {
|
|
26
23
|
return /*#__PURE__*/React.createElement(FieldContainer, _extends({
|
|
27
24
|
error: !!error
|
|
@@ -6,11 +6,11 @@ import { FieldBase } from '@digigov/form/Field/FieldBase';
|
|
|
6
6
|
import { evaluateFieldWithConditions } from '@digigov/form/Field/utils';
|
|
7
7
|
var ChildFieldMemo = /*#__PURE__*/React.memo(function ChildField(_ref) {
|
|
8
8
|
var dependencies = _ref.dependencies,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
field = _ref.field,
|
|
10
|
+
control = _ref.control,
|
|
11
|
+
reset = _ref.reset,
|
|
12
|
+
register = _ref.register,
|
|
13
|
+
error = _ref.error;
|
|
14
14
|
var newField = evaluateFieldWithConditions(field, dependencies);
|
|
15
15
|
return /*#__PURE__*/React.createElement(FieldBase, _extends({}, newField, {
|
|
16
16
|
name: newField.key,
|
|
@@ -23,25 +23,22 @@ var ChildFieldMemo = /*#__PURE__*/React.memo(function ChildField(_ref) {
|
|
|
23
23
|
if (!prev || !prev.dependencies) {
|
|
24
24
|
return false;
|
|
25
25
|
}
|
|
26
|
-
|
|
27
26
|
if (prev.error !== next.error) {
|
|
28
27
|
return false;
|
|
29
28
|
}
|
|
30
|
-
|
|
31
29
|
for (var dep in next.dependencies) {
|
|
32
30
|
if (next.dependencies[dep] !== prev.dependencies[dep]) {
|
|
33
31
|
return false;
|
|
34
32
|
}
|
|
35
33
|
}
|
|
36
|
-
|
|
37
34
|
return true;
|
|
38
35
|
});
|
|
39
36
|
export var FieldConditional = function FieldConditional(_ref2) {
|
|
40
37
|
var control = _ref2.control,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
38
|
+
field = _ref2.field,
|
|
39
|
+
register = _ref2.register,
|
|
40
|
+
reset = _ref2.reset,
|
|
41
|
+
error = _ref2.error;
|
|
45
42
|
var dependencyKeys = Object.keys(field.condition);
|
|
46
43
|
var dependencyValues = useWatch({
|
|
47
44
|
name: dependencyKeys,
|
package/Field/index.js
CHANGED
|
@@ -1,61 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(exports, "__esModule", {
|
|
8
|
-
value: true
|
|
9
|
-
});
|
|
10
|
-
exports["default"] = exports.Field = void 0;
|
|
11
|
-
|
|
12
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
-
|
|
14
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
15
|
-
|
|
16
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
17
|
-
|
|
18
|
-
var _FieldBase = require("@digigov/form/Field/FieldBase");
|
|
19
|
-
|
|
20
|
-
var _FieldConditional = _interopRequireDefault(require("@digigov/form/Field/FieldConditional"));
|
|
21
|
-
|
|
22
|
-
var _utils = require("@digigov/form/Field/utils");
|
|
23
|
-
|
|
24
|
-
var _FieldArray = _interopRequireDefault(require("@digigov/form/FieldArray"));
|
|
25
|
-
|
|
26
|
-
var _MultiplicityField = _interopRequireDefault(require("@digigov/form/MultiplicityField"));
|
|
27
|
-
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
28
3
|
var _excluded = ["name", "children"];
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
4
|
+
import React, { useMemo } from 'react';
|
|
5
|
+
import { FieldBase } from '@digigov/form/Field/FieldBase';
|
|
6
|
+
import FieldConditional from '@digigov/form/Field/FieldConditional';
|
|
7
|
+
import { useField, calculateField } from '@digigov/form/Field/utils';
|
|
8
|
+
import FieldArray from '@digigov/form/FieldArray';
|
|
9
|
+
import Multiplicity from '@digigov/form/MultiplicityField';
|
|
10
|
+
export var Field = function Field(_ref) {
|
|
35
11
|
var name = _ref.name,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
var calculatedField = (0, _react.useMemo)(function () {
|
|
54
|
-
return (0, _utils.calculateField)(children, field, componentRegistry);
|
|
12
|
+
children = _ref.children,
|
|
13
|
+
customField = _objectWithoutProperties(_ref, _excluded);
|
|
14
|
+
var _useField = useField(name, customField !== null && customField !== void 0 && customField.type ? customField : null),
|
|
15
|
+
field = _useField.field,
|
|
16
|
+
control = _useField.control,
|
|
17
|
+
register = _useField.register,
|
|
18
|
+
reset = _useField.reset,
|
|
19
|
+
error = _useField.error,
|
|
20
|
+
componentRegistry = _useField.componentRegistry,
|
|
21
|
+
formState = _useField.formState,
|
|
22
|
+
setValue = _useField.setValue,
|
|
23
|
+
getValues = _useField.getValues,
|
|
24
|
+
unregister = _useField.unregister,
|
|
25
|
+
trigger = _useField.trigger,
|
|
26
|
+
clearErrors = _useField.clearErrors;
|
|
27
|
+
var calculatedField = useMemo(function () {
|
|
28
|
+
return calculateField(children, field, componentRegistry);
|
|
55
29
|
}, [field]);
|
|
56
|
-
|
|
57
30
|
if (calculatedField.condition) {
|
|
58
|
-
return /*#__PURE__*/
|
|
31
|
+
return /*#__PURE__*/React.createElement(FieldConditional, {
|
|
59
32
|
control: control,
|
|
60
33
|
reset: reset,
|
|
61
34
|
register: register,
|
|
@@ -63,20 +36,18 @@ var Field = function Field(_ref) {
|
|
|
63
36
|
error: error
|
|
64
37
|
});
|
|
65
38
|
}
|
|
66
|
-
|
|
67
39
|
if (calculatedField.type === 'array' && !calculatedField.multiplicity) {
|
|
68
40
|
calculatedField.name = name;
|
|
69
|
-
return /*#__PURE__*/
|
|
41
|
+
return /*#__PURE__*/React.createElement(FieldArray, _extends({
|
|
70
42
|
control: control,
|
|
71
43
|
register: register,
|
|
72
44
|
error: error,
|
|
73
45
|
formState: formState
|
|
74
46
|
}, calculatedField));
|
|
75
47
|
}
|
|
76
|
-
|
|
77
48
|
if (calculatedField.type === 'array' && calculatedField.multiplicity === true) {
|
|
78
49
|
calculatedField.name = name;
|
|
79
|
-
return /*#__PURE__*/
|
|
50
|
+
return /*#__PURE__*/React.createElement(Multiplicity, _extends({
|
|
80
51
|
control: control,
|
|
81
52
|
register: register,
|
|
82
53
|
trigger: trigger,
|
|
@@ -88,8 +59,7 @@ var Field = function Field(_ref) {
|
|
|
88
59
|
unregister: unregister
|
|
89
60
|
}, calculatedField));
|
|
90
61
|
}
|
|
91
|
-
|
|
92
|
-
return /*#__PURE__*/_react["default"].createElement(_FieldBase.FieldBase, (0, _extends2["default"])({}, calculatedField, {
|
|
62
|
+
return /*#__PURE__*/React.createElement(FieldBase, _extends({}, calculatedField, {
|
|
93
63
|
name: name,
|
|
94
64
|
control: control,
|
|
95
65
|
register: register,
|
|
@@ -97,7 +67,4 @@ var Field = function Field(_ref) {
|
|
|
97
67
|
error: error
|
|
98
68
|
}));
|
|
99
69
|
};
|
|
100
|
-
|
|
101
|
-
exports.Field = Field;
|
|
102
|
-
var _default = Field;
|
|
103
|
-
exports["default"] = _default;
|
|
70
|
+
export default Field;
|
package/Field/types.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export interface FieldConditionalProps {
|
|
|
15
15
|
reset: UseFormReturn['reset'];
|
|
16
16
|
error?: ErrorOption;
|
|
17
17
|
}
|
|
18
|
-
export
|
|
18
|
+
export type FieldComponentItem = {
|
|
19
19
|
component: any;
|
|
20
20
|
controlled?: boolean;
|
|
21
21
|
wrapper?: FieldSpec['wrapper'];
|
|
@@ -28,9 +28,9 @@ export interface FieldContainerProps {
|
|
|
28
28
|
children?: React.ReactNode;
|
|
29
29
|
wrapper?: FieldSpec['wrapper'];
|
|
30
30
|
}
|
|
31
|
-
export
|
|
32
|
-
export
|
|
33
|
-
export
|
|
31
|
+
export type FieldComponentRegistry = Record<string, FieldComponentItem>;
|
|
32
|
+
export type OmittedFieldSpec = Omit<FieldSpec, 'component'>;
|
|
33
|
+
export type UnknownValue = never | never[];
|
|
34
34
|
export interface ControlledFieldProps {
|
|
35
35
|
type?: string;
|
|
36
36
|
value: UnknownValue;
|
|
@@ -4,12 +4,13 @@ import { FormContext } from '@digigov/form/FormContext';
|
|
|
4
4
|
import Checkboxes from '@digigov/form/inputs/Checkboxes';
|
|
5
5
|
import DateInput from '@digigov/form/inputs/DateInput';
|
|
6
6
|
import FileInput from '@digigov/form/inputs/FileInput';
|
|
7
|
+
import ImageInput from '@digigov/form/inputs/ImageInput';
|
|
7
8
|
import Input from '@digigov/form/inputs/Input';
|
|
8
9
|
import OtpInput from '@digigov/form/inputs/OtpInput';
|
|
9
10
|
import Radio from '@digigov/form/inputs/Radio';
|
|
10
11
|
import Select from '@digigov/form/inputs/Select';
|
|
11
|
-
var
|
|
12
|
-
return import('@digigov/form/inputs/
|
|
12
|
+
var AutoCompleteInput = /*#__PURE__*/lazy(function () {
|
|
13
|
+
return import('@digigov/form/inputs/AutoCompleteInput');
|
|
13
14
|
});
|
|
14
15
|
var FIELD_COMPONENTS = {
|
|
15
16
|
text: {
|
|
@@ -22,6 +23,10 @@ var FIELD_COMPONENTS = {
|
|
|
22
23
|
wrapper: 'fieldset',
|
|
23
24
|
component: FileInput
|
|
24
25
|
},
|
|
26
|
+
image: {
|
|
27
|
+
wrapper: 'fieldset',
|
|
28
|
+
component: ImageInput
|
|
29
|
+
},
|
|
25
30
|
date: {
|
|
26
31
|
wrapper: 'fieldset',
|
|
27
32
|
controlled: true,
|
|
@@ -49,68 +54,59 @@ var ALTERNATIVE_COMPONENTS = {
|
|
|
49
54
|
controlled: false
|
|
50
55
|
},
|
|
51
56
|
AutoComplete: {
|
|
52
|
-
component:
|
|
57
|
+
component: AutoCompleteInput,
|
|
53
58
|
controlled: true
|
|
54
59
|
}
|
|
55
60
|
};
|
|
56
61
|
export function calculateField(children, field, componentRegistry) {
|
|
57
62
|
var _field$extra;
|
|
58
|
-
|
|
59
63
|
var calculatedField = _extends({}, field);
|
|
60
|
-
|
|
61
64
|
var fieldComponentRegistry = _extends({}, FIELD_COMPONENTS, componentRegistry);
|
|
62
|
-
|
|
63
65
|
if (children) {
|
|
64
66
|
calculatedField.component = children;
|
|
65
67
|
calculatedField.controlled = true;
|
|
66
|
-
} else if (typeof field.component === 'function') {
|
|
68
|
+
} else if (typeof field.component === 'function') {
|
|
69
|
+
// leave as is
|
|
67
70
|
} else if (!field.component && !field.type) {
|
|
68
71
|
var _fieldComponentRegist;
|
|
69
|
-
|
|
70
72
|
calculatedField.component = fieldComponentRegistry.string.component;
|
|
71
73
|
calculatedField.controlled = ((_fieldComponentRegist = fieldComponentRegistry.string) === null || _fieldComponentRegist === void 0 ? void 0 : _fieldComponentRegist.controlled) || false;
|
|
72
74
|
} else if (typeof (field === null || field === void 0 ? void 0 : (_field$extra = field.extra) === null || _field$extra === void 0 ? void 0 : _field$extra.component) === 'string' && ALTERNATIVE_COMPONENTS[field.extra.component]) {
|
|
73
75
|
var _ALTERNATIVE_COMPONEN;
|
|
74
|
-
|
|
75
76
|
calculatedField.controlled = ((_ALTERNATIVE_COMPONEN = ALTERNATIVE_COMPONENTS[field.extra.component]) === null || _ALTERNATIVE_COMPONEN === void 0 ? void 0 : _ALTERNATIVE_COMPONEN.controlled) || false;
|
|
76
77
|
calculatedField.component = ALTERNATIVE_COMPONENTS[field.extra.component].component;
|
|
77
78
|
} else if (!field.component && field.type && fieldComponentRegistry[field.type]) {
|
|
78
79
|
var _fieldComponentRegist2;
|
|
79
|
-
|
|
80
80
|
calculatedField.component = fieldComponentRegistry[field.type].component;
|
|
81
81
|
calculatedField.wrapper = fieldComponentRegistry[field.type].wrapper;
|
|
82
82
|
calculatedField.controlled = ((_fieldComponentRegist2 = fieldComponentRegistry[field.type]) === null || _fieldComponentRegist2 === void 0 ? void 0 : _fieldComponentRegist2.controlled) || false;
|
|
83
83
|
} else {
|
|
84
84
|
var _fieldComponentRegist3;
|
|
85
|
-
|
|
86
85
|
calculatedField.component = fieldComponentRegistry.string.component;
|
|
87
86
|
calculatedField.controlled = ((_fieldComponentRegist3 = fieldComponentRegistry.string) === null || _fieldComponentRegist3 === void 0 ? void 0 : _fieldComponentRegist3.controlled) || false;
|
|
88
87
|
}
|
|
89
|
-
|
|
90
88
|
return calculatedField;
|
|
91
89
|
}
|
|
92
90
|
export var useField = function useField(name, customField) {
|
|
93
91
|
var _useContext = useContext(FormContext),
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
92
|
+
fieldsMap = _useContext.fieldsMap,
|
|
93
|
+
control = _useContext.control,
|
|
94
|
+
register = _useContext.register,
|
|
95
|
+
reset = _useContext.reset,
|
|
96
|
+
trigger = _useContext.trigger,
|
|
97
|
+
clearErrors = _useContext.clearErrors,
|
|
98
|
+
errors = _useContext.errors,
|
|
99
|
+
registerField = _useContext.registerField,
|
|
100
|
+
watch = _useContext.watch,
|
|
101
|
+
componentRegistry = _useContext.componentRegistry,
|
|
102
|
+
getFieldState = _useContext.getFieldState,
|
|
103
|
+
setValue = _useContext.setValue,
|
|
104
|
+
getValues = _useContext.getValues,
|
|
105
|
+
unregister = _useContext.unregister,
|
|
106
|
+
formState = _useContext.formState;
|
|
110
107
|
if (!registerField) {
|
|
111
108
|
throw new Error("\n You can't use the Field component without wrapping it in FormBuilder.\n https://devs.pages.grnet.gr/digigov/digigov-sdk/sdk-docs/forms/create-simple-form/\n ");
|
|
112
109
|
}
|
|
113
|
-
|
|
114
110
|
useMemo(function () {
|
|
115
111
|
return (customField === null || customField === void 0 ? void 0 : customField.type) && registerField(_extends({}, customField, {
|
|
116
112
|
key: name
|
|
@@ -135,28 +131,23 @@ export var useField = function useField(name, customField) {
|
|
|
135
131
|
};
|
|
136
132
|
export function evaluateFieldWithConditions(field, variables) {
|
|
137
133
|
var newField = _extends({}, field);
|
|
138
|
-
|
|
139
134
|
if (variables) {
|
|
140
135
|
for (var key in variables) {
|
|
141
136
|
if (field.condition[key] && field.condition[key].is) {
|
|
142
137
|
var is = field.condition[key].is;
|
|
143
|
-
|
|
144
138
|
if (is === variables[key] || Array.isArray(variables[key]) && variables[key].includes(is)) {
|
|
145
139
|
var then = field.condition[key].then || {};
|
|
146
|
-
|
|
147
140
|
for (var attr in then) {
|
|
148
141
|
newField[attr] = then[attr];
|
|
149
142
|
}
|
|
150
143
|
}
|
|
151
144
|
} else if (field.condition[key]) {
|
|
152
145
|
var otherwise = field.condition[key]["else"] || {};
|
|
153
|
-
|
|
154
146
|
for (var _attr in otherwise) {
|
|
155
147
|
newField[_attr] = otherwise[_attr];
|
|
156
148
|
}
|
|
157
149
|
}
|
|
158
150
|
}
|
|
159
151
|
}
|
|
160
|
-
|
|
161
152
|
return newField;
|
|
162
153
|
}
|
|
@@ -72,9 +72,7 @@ var fields = [{
|
|
|
72
72
|
secondary: 'Συμπληρώστε τον αριθμό τηλεφώνου'
|
|
73
73
|
}
|
|
74
74
|
}];
|
|
75
|
-
|
|
76
75
|
var _ref = /*#__PURE__*/React.createElement(Button, null, "\u03A3\u03C5\u03BD\u03AD\u03C7\u03B5\u03B9\u03B1");
|
|
77
|
-
|
|
78
76
|
export var Default = function Default() {
|
|
79
77
|
return /*#__PURE__*/React.createElement(FormBuilder, {
|
|
80
78
|
onSubmit: function onSubmit(data) {
|
|
@@ -72,9 +72,7 @@ var fields = [{
|
|
|
72
72
|
secondary: 'Συμπληρώστε τον αριθμό τηλεφώνου σας'
|
|
73
73
|
}
|
|
74
74
|
}];
|
|
75
|
-
|
|
76
75
|
var _ref = /*#__PURE__*/React.createElement(Button, null, "\u03A3\u03C5\u03BD\u03AD\u03C7\u03B5\u03B9\u03B1");
|
|
77
|
-
|
|
78
76
|
export var WithExactLength = function WithExactLength() {
|
|
79
77
|
return /*#__PURE__*/React.createElement(FormBuilder, {
|
|
80
78
|
onSubmit: function onSubmit(data) {
|
package/FieldArray/index.js
CHANGED
|
@@ -1,78 +1,55 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports["default"] = exports.FieldArray = void 0;
|
|
9
|
-
|
|
10
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
-
|
|
12
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
13
|
-
|
|
14
|
-
var _react = _interopRequireDefault(require("react"));
|
|
15
|
-
|
|
16
|
-
var _reactHookForm = require("react-hook-form");
|
|
17
|
-
|
|
18
|
-
var _FieldBaseContainer = _interopRequireDefault(require("@digigov/form/Field/FieldBaseContainer"));
|
|
19
|
-
|
|
20
|
-
var _FieldObject = _interopRequireDefault(require("@digigov/form/FieldObject"));
|
|
21
|
-
|
|
22
|
-
var _Fieldset = require("@digigov/form/Fieldset");
|
|
23
|
-
|
|
24
|
-
var _Fieldset2 = _interopRequireDefault(require("@digigov/react-core/Fieldset"));
|
|
25
|
-
|
|
26
|
-
var _ui = require("@digigov/ui");
|
|
27
|
-
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
28
3
|
var _excluded = ["name", "register", "control", "formState", "error", "layout", "label"];
|
|
29
|
-
|
|
30
|
-
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { useFieldArray } from 'react-hook-form';
|
|
6
|
+
import FieldContainer from '@digigov/form/Field/FieldBaseContainer';
|
|
7
|
+
import FieldObject from '@digigov/form/FieldObject';
|
|
8
|
+
import { FieldsetLabel } from '@digigov/form/Fieldset';
|
|
9
|
+
import Fieldset from '@digigov/react-core/Fieldset';
|
|
10
|
+
import { Button, Card, Hint } from '@digigov/ui';
|
|
11
|
+
export var FieldArray = function FieldArray(_ref) {
|
|
31
12
|
var _customField$extra, _customField$extra$la, _customField$extra4, _customField$extra4$l;
|
|
32
|
-
|
|
33
13
|
var name = _ref.name,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return /*#__PURE__*/_react["default"].createElement(_FieldBaseContainer["default"], {
|
|
14
|
+
register = _ref.register,
|
|
15
|
+
control = _ref.control,
|
|
16
|
+
formState = _ref.formState,
|
|
17
|
+
error = _ref.error,
|
|
18
|
+
layout = _ref.layout,
|
|
19
|
+
label = _ref.label,
|
|
20
|
+
customField = _objectWithoutProperties(_ref, _excluded);
|
|
21
|
+
var _useFieldArray = useFieldArray({
|
|
22
|
+
control: control,
|
|
23
|
+
name: name
|
|
24
|
+
}),
|
|
25
|
+
fields = _useFieldArray.fields,
|
|
26
|
+
append = _useFieldArray.append,
|
|
27
|
+
remove = _useFieldArray.remove;
|
|
28
|
+
return /*#__PURE__*/React.createElement(FieldContainer, {
|
|
51
29
|
label: label,
|
|
52
30
|
layout: layout,
|
|
53
31
|
error: formState.isSubmitted && !formState.isSubmitting && error !== null && error !== void 0 && error.message && error ? error : undefined,
|
|
54
32
|
wrapper: "fieldset",
|
|
55
33
|
name: name
|
|
56
|
-
}, fields.length === 0 && /*#__PURE__*/
|
|
34
|
+
}, fields.length === 0 && /*#__PURE__*/React.createElement(Hint, null, (_customField$extra = customField.extra) === null || _customField$extra === void 0 ? void 0 : (_customField$extra$la = _customField$extra.label.object) === null || _customField$extra$la === void 0 ? void 0 : _customField$extra$la.nothing_added), fields.map(function (field, index) {
|
|
57
35
|
var _customField$extra2, _customField$extra3;
|
|
58
|
-
|
|
59
|
-
return /*#__PURE__*/_react["default"].createElement(_ui.Card, {
|
|
36
|
+
return /*#__PURE__*/React.createElement(Card, {
|
|
60
37
|
variant: "border",
|
|
61
38
|
key: field.id
|
|
62
|
-
}, /*#__PURE__*/
|
|
39
|
+
}, /*#__PURE__*/React.createElement(Fieldset, null, /*#__PURE__*/React.createElement(FieldsetLabel, null, (_customField$extra2 = customField.extra) === null || _customField$extra2 === void 0 ? void 0 : _customField$extra2.label.object.title, " ", index + 1), /*#__PURE__*/React.createElement(FieldObject, _extends({
|
|
63
40
|
name: "".concat(name, ".").concat(index),
|
|
64
41
|
error: Array.isArray(error) && error[index],
|
|
65
42
|
formState: formState,
|
|
66
43
|
register: register,
|
|
67
44
|
control: control
|
|
68
|
-
}, (_customField$extra3 = customField.extra) === null || _customField$extra3 === void 0 ? void 0 : _customField$extra3.of)), /*#__PURE__*/
|
|
45
|
+
}, (_customField$extra3 = customField.extra) === null || _customField$extra3 === void 0 ? void 0 : _customField$extra3.of)), /*#__PURE__*/React.createElement(Button, {
|
|
69
46
|
type: "button",
|
|
70
47
|
color: "warning",
|
|
71
48
|
onClick: function onClick() {
|
|
72
49
|
return remove(index);
|
|
73
50
|
}
|
|
74
51
|
}, "Remove")));
|
|
75
|
-
}), /*#__PURE__*/
|
|
52
|
+
}), /*#__PURE__*/React.createElement(Button, {
|
|
76
53
|
type: "button",
|
|
77
54
|
color: "secondary",
|
|
78
55
|
onClick: function onClick(ev) {
|
|
@@ -81,7 +58,4 @@ var FieldArray = function FieldArray(_ref) {
|
|
|
81
58
|
}
|
|
82
59
|
}, (_customField$extra4 = customField.extra) === null || _customField$extra4 === void 0 ? void 0 : (_customField$extra4$l = _customField$extra4.label.object) === null || _customField$extra4$l === void 0 ? void 0 : _customField$extra4$l.add));
|
|
83
60
|
};
|
|
84
|
-
|
|
85
|
-
exports.FieldArray = FieldArray;
|
|
86
|
-
var _default = FieldArray;
|
|
87
|
-
exports["default"] = _default;
|
|
61
|
+
export default FieldArray;
|