@flipdish/ui-library 0.51.0 → 0.52.0
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/README.md +17 -16
- package/dist/components/atoms/Checkbox/index.cjs +4 -2
- package/dist/components/atoms/Checkbox/index.cjs.map +1 -1
- package/dist/components/atoms/Checkbox/index.d.ts.map +1 -1
- package/dist/components/atoms/Checkbox/index.js +4 -2
- package/dist/components/atoms/Checkbox/index.js.map +1 -1
- package/dist/components/atoms/Slider/index.cjs +2 -2
- package/dist/components/atoms/Slider/index.cjs.map +1 -1
- package/dist/components/atoms/Slider/index.d.ts +3 -1
- package/dist/components/atoms/Slider/index.d.ts.map +1 -1
- package/dist/components/atoms/Slider/index.js +2 -2
- package/dist/components/atoms/Slider/index.js.map +1 -1
- package/dist/components/forms/Form/hooks/useForm.cjs +26 -0
- package/dist/components/forms/Form/hooks/useForm.cjs.map +1 -0
- package/dist/components/forms/Form/hooks/useForm.d.ts +13 -0
- package/dist/components/forms/Form/hooks/useForm.d.ts.map +1 -0
- package/dist/components/forms/Form/hooks/useForm.js +24 -0
- package/dist/components/forms/Form/hooks/useForm.js.map +1 -0
- package/dist/components/forms/Form/hooks/useSubmitInTurn/useSubmitInTurn.cjs +28 -0
- package/dist/components/forms/Form/hooks/useSubmitInTurn/useSubmitInTurn.cjs.map +1 -0
- package/dist/components/forms/Form/hooks/useSubmitInTurn/useSubmitInTurn.d.ts +10 -0
- package/dist/components/forms/Form/hooks/useSubmitInTurn/useSubmitInTurn.d.ts.map +1 -0
- package/dist/components/forms/Form/hooks/useSubmitInTurn/useSubmitInTurn.js +26 -0
- package/dist/components/forms/Form/hooks/useSubmitInTurn/useSubmitInTurn.js.map +1 -0
- package/dist/components/forms/Form/index.cjs +43 -0
- package/dist/components/forms/Form/index.cjs.map +1 -0
- package/dist/components/forms/Form/index.d.ts +30 -0
- package/dist/components/forms/Form/index.d.ts.map +1 -0
- package/dist/components/forms/Form/index.js +40 -0
- package/dist/components/forms/Form/index.js.map +1 -0
- package/dist/components/forms/Form/utilities/formSubmit.utils.cjs +23 -0
- package/dist/components/forms/Form/utilities/formSubmit.utils.cjs.map +1 -0
- package/dist/components/forms/Form/utilities/formSubmit.utils.d.ts +14 -0
- package/dist/components/forms/Form/utilities/formSubmit.utils.d.ts.map +1 -0
- package/dist/components/forms/Form/utilities/formSubmit.utils.js +21 -0
- package/dist/components/forms/Form/utilities/formSubmit.utils.js.map +1 -0
- package/dist/components/forms/FormFooter/hooks/useDestructiveConfirmation.cjs +39 -0
- package/dist/components/forms/FormFooter/hooks/useDestructiveConfirmation.cjs.map +1 -0
- package/dist/components/forms/FormFooter/hooks/useDestructiveConfirmation.d.ts +17 -0
- package/dist/components/forms/FormFooter/hooks/useDestructiveConfirmation.d.ts.map +1 -0
- package/dist/components/forms/FormFooter/hooks/useDestructiveConfirmation.js +37 -0
- package/dist/components/forms/FormFooter/hooks/useDestructiveConfirmation.js.map +1 -0
- package/dist/components/forms/FormFooter/hooks/useHasFieldError.cjs +26 -0
- package/dist/components/forms/FormFooter/hooks/useHasFieldError.cjs.map +1 -0
- package/dist/components/forms/FormFooter/hooks/useHasFieldError.d.ts +9 -0
- package/dist/components/forms/FormFooter/hooks/useHasFieldError.d.ts.map +1 -0
- package/dist/components/forms/FormFooter/hooks/useHasFieldError.js +24 -0
- package/dist/components/forms/FormFooter/hooks/useHasFieldError.js.map +1 -0
- package/dist/components/forms/FormFooter/index.cjs +41 -0
- package/dist/components/forms/FormFooter/index.cjs.map +1 -0
- package/dist/components/forms/FormFooter/index.d.ts +52 -0
- package/dist/components/forms/FormFooter/index.d.ts.map +1 -0
- package/dist/components/forms/FormFooter/index.js +39 -0
- package/dist/components/forms/FormFooter/index.js.map +1 -0
- package/dist/components/forms/FormFooter/utilities/formFooter.utils.cjs +21 -0
- package/dist/components/forms/FormFooter/utilities/formFooter.utils.cjs.map +1 -0
- package/dist/components/forms/FormFooter/utilities/formFooter.utils.d.ts +12 -0
- package/dist/components/forms/FormFooter/utilities/formFooter.utils.d.ts.map +1 -0
- package/dist/components/forms/FormFooter/utilities/formFooter.utils.js +19 -0
- package/dist/components/forms/FormFooter/utilities/formFooter.utils.js.map +1 -0
- package/dist/components/forms/FormSection/FormSection.styles.cjs +15 -0
- package/dist/components/forms/FormSection/FormSection.styles.cjs.map +1 -0
- package/dist/components/forms/FormSection/FormSection.styles.d.ts +9 -0
- package/dist/components/forms/FormSection/FormSection.styles.d.ts.map +1 -0
- package/dist/components/forms/FormSection/FormSection.styles.js +13 -0
- package/dist/components/forms/FormSection/FormSection.styles.js.map +1 -0
- package/dist/components/forms/FormSection/index.cjs +43 -0
- package/dist/components/forms/FormSection/index.cjs.map +1 -0
- package/dist/components/forms/FormSection/index.d.ts +41 -0
- package/dist/components/forms/FormSection/index.d.ts.map +1 -0
- package/dist/components/forms/FormSection/index.js +41 -0
- package/dist/components/forms/FormSection/index.js.map +1 -0
- package/dist/components/forms/__internal__/formField/hooks/useFocusTarget.cjs +28 -0
- package/dist/components/forms/__internal__/formField/hooks/useFocusTarget.cjs.map +1 -0
- package/dist/components/forms/__internal__/formField/hooks/useFocusTarget.d.ts +12 -0
- package/dist/components/forms/__internal__/formField/hooks/useFocusTarget.d.ts.map +1 -0
- package/dist/components/forms/__internal__/formField/hooks/useFocusTarget.js +26 -0
- package/dist/components/forms/__internal__/formField/hooks/useFocusTarget.js.map +1 -0
- package/dist/components/forms/__internal__/formField/hooks/useFocusThroughSubmit.cjs +68 -0
- package/dist/components/forms/__internal__/formField/hooks/useFocusThroughSubmit.cjs.map +1 -0
- package/dist/components/forms/__internal__/formField/hooks/useFocusThroughSubmit.d.ts +26 -0
- package/dist/components/forms/__internal__/formField/hooks/useFocusThroughSubmit.d.ts.map +1 -0
- package/dist/components/forms/__internal__/formField/hooks/useFocusThroughSubmit.js +66 -0
- package/dist/components/forms/__internal__/formField/hooks/useFocusThroughSubmit.js.map +1 -0
- package/dist/components/forms/__internal__/formField/hooks/useFormField.cjs +142 -0
- package/dist/components/forms/__internal__/formField/hooks/useFormField.cjs.map +1 -0
- package/dist/components/forms/__internal__/formField/hooks/useFormField.d.ts +35 -0
- package/dist/components/forms/__internal__/formField/hooks/useFormField.d.ts.map +1 -0
- package/dist/components/forms/__internal__/formField/hooks/useFormField.js +140 -0
- package/dist/components/forms/__internal__/formField/hooks/useFormField.js.map +1 -0
- package/dist/components/forms/__internal__/formField/providers/FieldElements.context.cjs +12 -0
- package/dist/components/forms/__internal__/formField/providers/FieldElements.context.cjs.map +1 -0
- package/dist/components/forms/__internal__/formField/providers/FieldElements.context.d.ts +7 -0
- package/dist/components/forms/__internal__/formField/providers/FieldElements.context.d.ts.map +1 -0
- package/dist/components/forms/__internal__/formField/providers/FieldElements.context.js +10 -0
- package/dist/components/forms/__internal__/formField/providers/FieldElements.context.js.map +1 -0
- package/dist/components/forms/__internal__/formField/utilities/fieldElements.utils.cjs +39 -0
- package/dist/components/forms/__internal__/formField/utilities/fieldElements.utils.cjs.map +1 -0
- package/dist/components/forms/__internal__/formField/utilities/fieldElements.utils.d.ts +21 -0
- package/dist/components/forms/__internal__/formField/utilities/fieldElements.utils.d.ts.map +1 -0
- package/dist/components/forms/__internal__/formField/utilities/fieldElements.utils.js +37 -0
- package/dist/components/forms/__internal__/formField/utilities/fieldElements.utils.js.map +1 -0
- package/dist/components/forms/__internal__/formField/utilities/fieldValue.utils.cjs +40 -0
- package/dist/components/forms/__internal__/formField/utilities/fieldValue.utils.cjs.map +1 -0
- package/dist/components/forms/__internal__/formField/utilities/fieldValue.utils.d.ts +18 -0
- package/dist/components/forms/__internal__/formField/utilities/fieldValue.utils.d.ts.map +1 -0
- package/dist/components/forms/__internal__/formField/utilities/fieldValue.utils.js +37 -0
- package/dist/components/forms/__internal__/formField/utilities/fieldValue.utils.js.map +1 -0
- package/dist/components/forms/__internal__/formField/utilities/formFocus.utils.cjs +21 -0
- package/dist/components/forms/__internal__/formField/utilities/formFocus.utils.cjs.map +1 -0
- package/dist/components/forms/__internal__/formField/utilities/formFocus.utils.d.ts +11 -0
- package/dist/components/forms/__internal__/formField/utilities/formFocus.utils.d.ts.map +1 -0
- package/dist/components/forms/__internal__/formField/utilities/formFocus.utils.js +19 -0
- package/dist/components/forms/__internal__/formField/utilities/formFocus.utils.js.map +1 -0
- package/dist/components/forms/__internal__/formField/utilities/validationQueue.utils.cjs +128 -0
- package/dist/components/forms/__internal__/formField/utilities/validationQueue.utils.cjs.map +1 -0
- package/dist/components/forms/__internal__/formField/utilities/validationQueue.utils.d.ts +72 -0
- package/dist/components/forms/__internal__/formField/utilities/validationQueue.utils.d.ts.map +1 -0
- package/dist/components/forms/__internal__/formField/utilities/validationQueue.utils.js +121 -0
- package/dist/components/forms/__internal__/formField/utilities/validationQueue.utils.js.map +1 -0
- package/dist/components/forms/fields/FormCheckbox/index.cjs +34 -0
- package/dist/components/forms/fields/FormCheckbox/index.cjs.map +1 -0
- package/dist/components/forms/fields/FormCheckbox/index.d.ts +16 -0
- package/dist/components/forms/fields/FormCheckbox/index.d.ts.map +1 -0
- package/dist/components/forms/fields/FormCheckbox/index.js +32 -0
- package/dist/components/forms/fields/FormCheckbox/index.js.map +1 -0
- package/dist/components/forms/fields/FormCheckboxGroup/index.cjs +33 -0
- package/dist/components/forms/fields/FormCheckboxGroup/index.cjs.map +1 -0
- package/dist/components/forms/fields/FormCheckboxGroup/index.d.ts +16 -0
- package/dist/components/forms/fields/FormCheckboxGroup/index.d.ts.map +1 -0
- package/dist/components/forms/fields/FormCheckboxGroup/index.js +31 -0
- package/dist/components/forms/fields/FormCheckboxGroup/index.js.map +1 -0
- package/dist/components/forms/fields/FormColorPicker/hooks/useEmptyFieldValue.cjs +26 -0
- package/dist/components/forms/fields/FormColorPicker/hooks/useEmptyFieldValue.cjs.map +1 -0
- package/dist/components/forms/fields/FormColorPicker/hooks/useEmptyFieldValue.d.ts +11 -0
- package/dist/components/forms/fields/FormColorPicker/hooks/useEmptyFieldValue.d.ts.map +1 -0
- package/dist/components/forms/fields/FormColorPicker/hooks/useEmptyFieldValue.js +24 -0
- package/dist/components/forms/fields/FormColorPicker/hooks/useEmptyFieldValue.js.map +1 -0
- package/dist/components/forms/fields/FormColorPicker/index.cjs +33 -0
- package/dist/components/forms/fields/FormColorPicker/index.cjs.map +1 -0
- package/dist/components/forms/fields/FormColorPicker/index.d.ts +21 -0
- package/dist/components/forms/fields/FormColorPicker/index.d.ts.map +1 -0
- package/dist/components/forms/fields/FormColorPicker/index.js +31 -0
- package/dist/components/forms/fields/FormColorPicker/index.js.map +1 -0
- package/dist/components/forms/fields/FormColorPicker/utilities/formColorPicker.utils.cjs +20 -0
- package/dist/components/forms/fields/FormColorPicker/utilities/formColorPicker.utils.cjs.map +1 -0
- package/dist/components/forms/fields/FormColorPicker/utilities/formColorPicker.utils.d.ts +17 -0
- package/dist/components/forms/fields/FormColorPicker/utilities/formColorPicker.utils.d.ts.map +1 -0
- package/dist/components/forms/fields/FormColorPicker/utilities/formColorPicker.utils.js +18 -0
- package/dist/components/forms/fields/FormColorPicker/utilities/formColorPicker.utils.js.map +1 -0
- package/dist/components/forms/fields/FormDatePicker/index.cjs +35 -0
- package/dist/components/forms/fields/FormDatePicker/index.cjs.map +1 -0
- package/dist/components/forms/fields/FormDatePicker/index.d.ts +17 -0
- package/dist/components/forms/fields/FormDatePicker/index.d.ts.map +1 -0
- package/dist/components/forms/fields/FormDatePicker/index.js +33 -0
- package/dist/components/forms/fields/FormDatePicker/index.js.map +1 -0
- package/dist/components/forms/fields/FormDatePicker/utilities/formDatePicker.utils.cjs +23 -0
- package/dist/components/forms/fields/FormDatePicker/utilities/formDatePicker.utils.cjs.map +1 -0
- package/dist/components/forms/fields/FormDatePicker/utilities/formDatePicker.utils.d.ts +9 -0
- package/dist/components/forms/fields/FormDatePicker/utilities/formDatePicker.utils.d.ts.map +1 -0
- package/dist/components/forms/fields/FormDatePicker/utilities/formDatePicker.utils.js +21 -0
- package/dist/components/forms/fields/FormDatePicker/utilities/formDatePicker.utils.js.map +1 -0
- package/dist/components/forms/fields/FormInput/index.cjs +27 -0
- package/dist/components/forms/fields/FormInput/index.cjs.map +1 -0
- package/dist/components/forms/fields/FormInput/index.d.ts +16 -0
- package/dist/components/forms/fields/FormInput/index.d.ts.map +1 -0
- package/dist/components/forms/fields/FormInput/index.js +25 -0
- package/dist/components/forms/fields/FormInput/index.js.map +1 -0
- package/dist/components/forms/fields/FormMultiSelect/index.cjs +44 -0
- package/dist/components/forms/fields/FormMultiSelect/index.cjs.map +1 -0
- package/dist/components/forms/fields/FormMultiSelect/index.d.ts +17 -0
- package/dist/components/forms/fields/FormMultiSelect/index.d.ts.map +1 -0
- package/dist/components/forms/fields/FormMultiSelect/index.js +42 -0
- package/dist/components/forms/fields/FormMultiSelect/index.js.map +1 -0
- package/dist/components/forms/fields/FormRadioCardGroup/index.cjs +36 -0
- package/dist/components/forms/fields/FormRadioCardGroup/index.cjs.map +1 -0
- package/dist/components/forms/fields/FormRadioCardGroup/index.d.ts +29 -0
- package/dist/components/forms/fields/FormRadioCardGroup/index.d.ts.map +1 -0
- package/dist/components/forms/fields/FormRadioCardGroup/index.js +34 -0
- package/dist/components/forms/fields/FormRadioCardGroup/index.js.map +1 -0
- package/dist/components/forms/fields/FormRadioGroup/index.cjs +31 -0
- package/dist/components/forms/fields/FormRadioGroup/index.cjs.map +1 -0
- package/dist/components/forms/fields/FormRadioGroup/index.d.ts +17 -0
- package/dist/components/forms/fields/FormRadioGroup/index.d.ts.map +1 -0
- package/dist/components/forms/fields/FormRadioGroup/index.js +29 -0
- package/dist/components/forms/fields/FormRadioGroup/index.js.map +1 -0
- package/dist/components/forms/fields/FormSelect/index.cjs +30 -0
- package/dist/components/forms/fields/FormSelect/index.cjs.map +1 -0
- package/dist/components/forms/fields/FormSelect/index.d.ts +16 -0
- package/dist/components/forms/fields/FormSelect/index.d.ts.map +1 -0
- package/dist/components/forms/fields/FormSelect/index.js +28 -0
- package/dist/components/forms/fields/FormSelect/index.js.map +1 -0
- package/dist/components/forms/fields/FormSlider/index.cjs +43 -0
- package/dist/components/forms/fields/FormSlider/index.cjs.map +1 -0
- package/dist/components/forms/fields/FormSlider/index.d.ts +17 -0
- package/dist/components/forms/fields/FormSlider/index.d.ts.map +1 -0
- package/dist/components/forms/fields/FormSlider/index.js +41 -0
- package/dist/components/forms/fields/FormSlider/index.js.map +1 -0
- package/dist/components/forms/fields/FormTextArea/index.cjs +27 -0
- package/dist/components/forms/fields/FormTextArea/index.cjs.map +1 -0
- package/dist/components/forms/fields/FormTextArea/index.d.ts +16 -0
- package/dist/components/forms/fields/FormTextArea/index.d.ts.map +1 -0
- package/dist/components/forms/fields/FormTextArea/index.js +25 -0
- package/dist/components/forms/fields/FormTextArea/index.js.map +1 -0
- package/dist/components/forms/fields/FormToggle/index.cjs +32 -0
- package/dist/components/forms/fields/FormToggle/index.cjs.map +1 -0
- package/dist/components/forms/fields/FormToggle/index.d.ts +16 -0
- package/dist/components/forms/fields/FormToggle/index.d.ts.map +1 -0
- package/dist/components/forms/fields/FormToggle/index.js +30 -0
- package/dist/components/forms/fields/FormToggle/index.js.map +1 -0
- package/dist/components/forms/validation/hooks/useSchemaResolver.cjs +39 -0
- package/dist/components/forms/validation/hooks/useSchemaResolver.cjs.map +1 -0
- package/dist/components/forms/validation/hooks/useSchemaResolver.d.ts +15 -0
- package/dist/components/forms/validation/hooks/useSchemaResolver.d.ts.map +1 -0
- package/dist/components/forms/validation/hooks/useSchemaResolver.js +37 -0
- package/dist/components/forms/validation/hooks/useSchemaResolver.js.map +1 -0
- package/dist/components/forms/validation/index.cjs +309 -0
- package/dist/components/forms/validation/index.cjs.map +1 -0
- package/dist/components/forms/validation/index.d.ts +214 -0
- package/dist/components/forms/validation/index.d.ts.map +1 -0
- package/dist/components/forms/validation/index.js +293 -0
- package/dist/components/forms/validation/index.js.map +1 -0
- package/dist/components/forms/validation/utilities/validation.utils.cjs +42 -0
- package/dist/components/forms/validation/utilities/validation.utils.cjs.map +1 -0
- package/dist/components/forms/validation/utilities/validation.utils.d.ts +20 -0
- package/dist/components/forms/validation/utilities/validation.utils.d.ts.map +1 -0
- package/dist/components/forms/validation/utilities/validation.utils.js +39 -0
- package/dist/components/forms/validation/utilities/validation.utils.js.map +1 -0
- package/dist/components/forms/validation/validation.types.d.ts +8 -0
- package/dist/components/forms/validation/validation.types.d.ts.map +1 -0
- package/dist/components/organisms/ColorPicker/components/ColorPickerField.cjs +13 -3
- package/dist/components/organisms/ColorPicker/components/ColorPickerField.cjs.map +1 -1
- package/dist/components/organisms/ColorPicker/components/ColorPickerField.d.ts +1 -1
- package/dist/components/organisms/ColorPicker/components/ColorPickerField.d.ts.map +1 -1
- package/dist/components/organisms/ColorPicker/components/ColorPickerField.js +13 -3
- package/dist/components/organisms/ColorPicker/components/ColorPickerField.js.map +1 -1
- package/dist/components/organisms/ColorPicker/hooks/useColorFieldEdit.cjs +2 -2
- package/dist/components/organisms/ColorPicker/hooks/useColorFieldEdit.cjs.map +1 -1
- package/dist/components/organisms/ColorPicker/hooks/useColorFieldEdit.d.ts +1 -0
- package/dist/components/organisms/ColorPicker/hooks/useColorFieldEdit.d.ts.map +1 -1
- package/dist/components/organisms/ColorPicker/hooks/useColorFieldEdit.js +2 -2
- package/dist/components/organisms/ColorPicker/hooks/useColorFieldEdit.js.map +1 -1
- package/dist/components/organisms/ColorPicker/hooks/useCssColorField.cjs +1 -1
- package/dist/components/organisms/ColorPicker/hooks/useCssColorField.js +1 -1
- package/dist/components/organisms/ColorPicker/index.cjs +1 -1
- package/dist/components/organisms/ColorPicker/index.d.ts.map +1 -1
- package/dist/components/organisms/ColorPicker/index.js +1 -1
- package/dist/components/organisms/ColorPicker/providers/ColorPicker.provider.d.ts +1 -1
- package/dist/components/organisms/ColorPicker/providers/ColorPicker.provider.d.ts.map +1 -1
- package/dist/components/organisms/ColorPicker/utilities/colorPicker.utils.cjs.map +1 -0
- package/dist/components/organisms/ColorPicker/utilities/colorPicker.utils.d.ts.map +1 -0
- package/dist/components/organisms/ColorPicker/utilities/colorPicker.utils.js.map +1 -0
- package/dist/components/organisms/GradientPicker/components/GradientStopRow.cjs +1 -1
- package/dist/components/organisms/GradientPicker/components/GradientStopRow.js +1 -1
- package/dist/localization/en.json.cjs +98 -0
- package/dist/localization/en.json.cjs.map +1 -0
- package/dist/localization/en.json.js +81 -0
- package/dist/localization/en.json.js.map +1 -0
- package/dist/native/components/forms/Form/index.d.ts +12 -0
- package/dist/native/components/forms/FormFooter/index.d.ts +12 -0
- package/dist/native/components/forms/FormSection/index.d.ts +12 -0
- package/dist/native/components/forms/fields/FormCheckbox/index.d.ts +12 -0
- package/dist/native/components/forms/fields/FormCheckboxGroup/index.d.ts +12 -0
- package/dist/native/components/forms/fields/FormColorPicker/index.d.ts +12 -0
- package/dist/native/components/forms/fields/FormDatePicker/index.d.ts +12 -0
- package/dist/native/components/forms/fields/FormInput/index.d.ts +12 -0
- package/dist/native/components/forms/fields/FormMultiSelect/index.d.ts +12 -0
- package/dist/native/components/forms/fields/FormRadioCardGroup/index.d.ts +12 -0
- package/dist/native/components/forms/fields/FormRadioGroup/index.d.ts +12 -0
- package/dist/native/components/forms/fields/FormSelect/index.d.ts +12 -0
- package/dist/native/components/forms/fields/FormSlider/index.d.ts +12 -0
- package/dist/native/components/forms/fields/FormTextArea/index.d.ts +12 -0
- package/dist/native/components/forms/fields/FormToggle/index.d.ts +12 -0
- package/dist/native/components/forms/validation/index.d.ts +12 -0
- package/dist/providers/UnsavedChangesGuardProvider/index.cjs +1 -1
- package/dist/providers/UnsavedChangesGuardProvider/index.js +1 -1
- package/dist/providers/UnsavedChangesGuardProvider/utilities/unsavedChangesGuard.utils.cjs.map +1 -0
- package/dist/providers/UnsavedChangesGuardProvider/{unsavedChangesGuard.utils.d.ts → utilities/unsavedChangesGuard.utils.d.ts} +1 -1
- package/dist/providers/UnsavedChangesGuardProvider/utilities/unsavedChangesGuard.utils.d.ts.map +1 -0
- package/dist/providers/UnsavedChangesGuardProvider/utilities/unsavedChangesGuard.utils.js.map +1 -0
- package/dist/utilities/__internal__/builtInTextUtils/builtInText.utils.cjs +74 -0
- package/dist/utilities/__internal__/builtInTextUtils/builtInText.utils.cjs.map +1 -0
- package/dist/utilities/__internal__/builtInTextUtils/builtInText.utils.d.ts +51 -0
- package/dist/utilities/__internal__/builtInTextUtils/builtInText.utils.d.ts.map +1 -0
- package/dist/utilities/__internal__/builtInTextUtils/builtInText.utils.js +68 -0
- package/dist/utilities/__internal__/builtInTextUtils/builtInText.utils.js.map +1 -0
- package/package.json +41 -6
- package/dist/components/organisms/ColorPicker/colorPicker.utils.cjs.map +0 -1
- package/dist/components/organisms/ColorPicker/colorPicker.utils.d.ts.map +0 -1
- package/dist/components/organisms/ColorPicker/colorPicker.utils.js.map +0 -1
- package/dist/providers/UnsavedChangesGuardProvider/unsavedChangesGuard.utils.cjs.map +0 -1
- package/dist/providers/UnsavedChangesGuardProvider/unsavedChangesGuard.utils.d.ts.map +0 -1
- package/dist/providers/UnsavedChangesGuardProvider/unsavedChangesGuard.utils.js.map +0 -1
- /package/dist/components/organisms/ColorPicker/{colorPicker.utils.cjs → utilities/colorPicker.utils.cjs} +0 -0
- /package/dist/components/organisms/ColorPicker/{colorPicker.utils.d.ts → utilities/colorPicker.utils.d.ts} +0 -0
- /package/dist/components/organisms/ColorPicker/{colorPicker.utils.js → utilities/colorPicker.utils.js} +0 -0
- /package/dist/providers/UnsavedChangesGuardProvider/{unsavedChangesGuard.utils.cjs → utilities/unsavedChangesGuard.utils.cjs} +0 -0
- /package/dist/providers/UnsavedChangesGuardProvider/{unsavedChangesGuard.utils.js → utilities/unsavedChangesGuard.utils.js} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formColorPicker.utils.cjs","sources":["../../../../../../src/components/forms/fields/FormColorPicker/utilities/formColorPicker.utils.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAMA;;;;;;;;;AASG;AACI,MAAM,kBAAkB,GAAG,CAAC,UAA2B,EAAE,IAAY,EAAE,KAAgC,KAAqB;AACjI,IAAA,IAAI,CAAC,KAAK;AAAE,QAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE;AAClC,IAAA,OAAO,UAAU,CAAC,IAAI,KAAK,IAAI,GAAG,UAAU,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE;AACtE;;"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** The empty value a field was last seen to hold, kept with the field's name. */
|
|
2
|
+
export interface EmptyFieldValue {
|
|
3
|
+
name: string;
|
|
4
|
+
value: string | null | undefined;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Keeps track of the empty value a colour field itself uses, such as `undefined` for a field with no default or `''`
|
|
8
|
+
* for one an API sends empty. The picker reports an emptied field as `null`; writing the field's own empty value back
|
|
9
|
+
* lets a field the user put back as it was count as unchanged.
|
|
10
|
+
*
|
|
11
|
+
* @param remembered What was kept from the last render.
|
|
12
|
+
* @param name The field being rendered now. A change of name starts again: one field's empty value is never written to another.
|
|
13
|
+
* @param value The field's current value.
|
|
14
|
+
* @returns What to keep: the current value while the field is empty, else what was kept, or `null` for a field never seen empty.
|
|
15
|
+
*/
|
|
16
|
+
export declare const rememberEmptyValue: (remembered: EmptyFieldValue, name: string, value: string | null | undefined) => EmptyFieldValue;
|
|
17
|
+
//# sourceMappingURL=formColorPicker.utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formColorPicker.utils.d.ts","sourceRoot":"","sources":["../../../../../../src/components/forms/fields/FormColorPicker/utilities/formColorPicker.utils.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CAClC;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,GAAI,YAAY,eAAe,EAAE,MAAM,MAAM,EAAE,OAAO,MAAM,GAAG,IAAI,GAAG,SAAS,KAAG,eAGhH,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keeps track of the empty value a colour field itself uses, such as `undefined` for a field with no default or `''`
|
|
3
|
+
* for one an API sends empty. The picker reports an emptied field as `null`; writing the field's own empty value back
|
|
4
|
+
* lets a field the user put back as it was count as unchanged.
|
|
5
|
+
*
|
|
6
|
+
* @param remembered What was kept from the last render.
|
|
7
|
+
* @param name The field being rendered now. A change of name starts again: one field's empty value is never written to another.
|
|
8
|
+
* @param value The field's current value.
|
|
9
|
+
* @returns What to keep: the current value while the field is empty, else what was kept, or `null` for a field never seen empty.
|
|
10
|
+
*/
|
|
11
|
+
const rememberEmptyValue = (remembered, name, value) => {
|
|
12
|
+
if (!value)
|
|
13
|
+
return { name, value };
|
|
14
|
+
return remembered.name === name ? remembered : { name, value: null };
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export { rememberEmptyValue };
|
|
18
|
+
//# sourceMappingURL=formColorPicker.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formColorPicker.utils.js","sources":["../../../../../../src/components/forms/fields/FormColorPicker/utilities/formColorPicker.utils.ts"],"sourcesContent":[null],"names":[],"mappings":"AAMA;;;;;;;;;AASG;AACI,MAAM,kBAAkB,GAAG,CAAC,UAA2B,EAAE,IAAY,EAAE,KAAgC,KAAqB;AACjI,IAAA,IAAI,CAAC,KAAK;AAAE,QAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE;AAClC,IAAA,OAAO,UAAU,CAAC,IAAI,KAAK,IAAI,GAAG,UAAU,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE;AACtE;;"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var DatePicker = require('@flipdish/ui-library/components/organisms/DatePicker');
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var useFocusTarget = require('../../__internal__/formField/hooks/useFocusTarget.cjs');
|
|
7
|
+
var useFormField = require('../../__internal__/formField/hooks/useFormField.cjs');
|
|
8
|
+
var formDatePicker_utils = require('./utilities/formDatePicker.utils.cjs');
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* A `DatePicker` bound to a react-hook-form field: pressing Apply writes the date to the form as an ISO string
|
|
12
|
+
* (`YYYY-MM-DD`) and validates it at once, and the field's error shows in place of `hint`. Use it when the user picks
|
|
13
|
+
* a single date in a react-hook-form form.
|
|
14
|
+
*
|
|
15
|
+
* @summary date picker bound to a react-hook-form field
|
|
16
|
+
*/
|
|
17
|
+
const FormDatePicker = ({ name, revalidates, hint, ...datePickerProps }) => {
|
|
18
|
+
const { value, ref, onCommit, onBlur, isInvalid, errorMessage, isDisabled, isLocked } = useFormField.useFormField(name, revalidates);
|
|
19
|
+
// An unset, empty or unreadable field is no date; `null` keeps the picker controlled, and a stable date keeps its draft intact.
|
|
20
|
+
const date = React.useMemo(() => formDatePicker_utils.toCalendarDate(value), [value]);
|
|
21
|
+
// `DatePicker` reports a change only when Apply is pressed, so the draft the user is browsing never reaches the form.
|
|
22
|
+
const handleChange = (next) => onCommit(next ? next.toString() : null);
|
|
23
|
+
// `DatePicker`'s ref is its root div; the trigger is the only button in it, the calendar being portalled.
|
|
24
|
+
const focusRef = useFocusTarget.useFocusTarget(ref, 'button');
|
|
25
|
+
return (jsxRuntime.jsx(DatePicker.DatePicker
|
|
26
|
+
// The form's schema validates; the browser's own `required` check would block the submit before it runs.
|
|
27
|
+
, {
|
|
28
|
+
// The form's schema validates; the browser's own `required` check would block the submit before it runs.
|
|
29
|
+
validationBehavior: "aria", ...datePickerProps, ref: focusRef, name: name, value: date, onChange: handleChange, onBlur: onBlur, isInvalid: isInvalid, hint: errorMessage ?? hint,
|
|
30
|
+
// Disabled while the form submits: read-only would disable the trigger all the same, without looking it.
|
|
31
|
+
isDisabled: datePickerProps.isDisabled || isDisabled || isLocked }));
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
exports.FormDatePicker = FormDatePicker;
|
|
35
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../../../src/components/forms/fields/FormDatePicker/index.tsx"],"sourcesContent":[null],"names":["useFormField","useMemo","toCalendarDate","useFocusTarget","_jsx","DatePicker"],"mappings":";;;;;;;;;AAkBA;;;;;;AAMG;AACI,MAAM,cAAc,GAAG,CAA4C,EACxE,IAAI,EACJ,WAAW,EACX,IAAI,EACJ,GAAG,eAAe,EACW,KAAI;IACjC,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAGA,yBAAY,CAAyB,IAAI,EAAE,WAAW,CAAC;;AAE/I,IAAA,MAAM,IAAI,GAAGC,aAAO,CAAC,MAAMC,mCAAc,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;;IAE1D,MAAM,YAAY,GAAG,CAAC,IAAsB,KAAK,QAAQ,CAAC,IAAI,GAAG,IAAI,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC;;IAGxF,MAAM,QAAQ,GAAGC,6BAAc,CAAC,GAAG,EAAE,QAAQ,CAAC;IAE9C,QACEC,eAACC;;;;AAEC,QAAA,kBAAkB,EAAC,MAAM,EAAA,GACrB,eAAe,EACnB,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,IAAI,EACX,QAAQ,EAAE,YAAY,EACtB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,YAAY,IAAI,IAAI;;QAE1B,UAAU,EAAE,eAAe,CAAC,UAAU,IAAI,UAAU,IAAI,QAAQ,EAAA,CAChE;AAEN;;"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type DatePickerProps } from '@flipdish/ui-library/components/organisms/DatePicker';
|
|
2
|
+
import type { FieldPath, FieldValues } from 'react-hook-form';
|
|
3
|
+
export interface FormDatePickerProps<TValues extends FieldValues = FieldValues> extends Omit<DatePickerProps, 'name' | 'value' | 'defaultValue' | 'onChange' | 'onBlur' | 'isInvalid' | 'ref'> {
|
|
4
|
+
/** The field's path in the form values, such as `deliveryDate` or `promotion.endDate`. */
|
|
5
|
+
name: FieldPath<TValues>;
|
|
6
|
+
/** Other fields whose rule reads this one, such as a postcode that depends on this country; they re-validate when this changes. */
|
|
7
|
+
revalidates?: FieldPath<TValues> | FieldPath<TValues>[];
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* A `DatePicker` bound to a react-hook-form field: pressing Apply writes the date to the form as an ISO string
|
|
11
|
+
* (`YYYY-MM-DD`) and validates it at once, and the field's error shows in place of `hint`. Use it when the user picks
|
|
12
|
+
* a single date in a react-hook-form form.
|
|
13
|
+
*
|
|
14
|
+
* @summary date picker bound to a react-hook-form field
|
|
15
|
+
*/
|
|
16
|
+
export declare const FormDatePicker: <TValues extends FieldValues = FieldValues>({ name, revalidates, hint, ...datePickerProps }: FormDatePickerProps<TValues>) => import("react").JSX.Element;
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/forms/fields/FormDatePicker/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAc,KAAK,eAAe,EAAE,MAAM,sDAAsD,CAAC;AAGxG,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAK9D,MAAM,WAAW,mBAAmB,CAAC,OAAO,SAAS,WAAW,GAAG,WAAW,CAC5E,SAAQ,IAAI,CAAC,eAAe,EAAE,MAAM,GAAG,OAAO,GAAG,cAAc,GAAG,UAAU,GAAG,QAAQ,GAAG,WAAW,GAAG,KAAK,CAAC;IAC9G,0FAA0F;IAC1F,IAAI,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;IACzB,mIAAmI;IACnI,WAAW,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,GAAG,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;CACzD;AAED;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,GAAI,OAAO,SAAS,WAAW,GAAG,WAAW,EAAE,iDAKvE,mBAAmB,CAAC,OAAO,CAAC,gCA0B9B,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { DatePicker } from '@flipdish/ui-library/components/organisms/DatePicker';
|
|
3
|
+
import { useMemo } from 'react';
|
|
4
|
+
import { useFocusTarget } from '../../__internal__/formField/hooks/useFocusTarget.js';
|
|
5
|
+
import { useFormField } from '../../__internal__/formField/hooks/useFormField.js';
|
|
6
|
+
import { toCalendarDate } from './utilities/formDatePicker.utils.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* A `DatePicker` bound to a react-hook-form field: pressing Apply writes the date to the form as an ISO string
|
|
10
|
+
* (`YYYY-MM-DD`) and validates it at once, and the field's error shows in place of `hint`. Use it when the user picks
|
|
11
|
+
* a single date in a react-hook-form form.
|
|
12
|
+
*
|
|
13
|
+
* @summary date picker bound to a react-hook-form field
|
|
14
|
+
*/
|
|
15
|
+
const FormDatePicker = ({ name, revalidates, hint, ...datePickerProps }) => {
|
|
16
|
+
const { value, ref, onCommit, onBlur, isInvalid, errorMessage, isDisabled, isLocked } = useFormField(name, revalidates);
|
|
17
|
+
// An unset, empty or unreadable field is no date; `null` keeps the picker controlled, and a stable date keeps its draft intact.
|
|
18
|
+
const date = useMemo(() => toCalendarDate(value), [value]);
|
|
19
|
+
// `DatePicker` reports a change only when Apply is pressed, so the draft the user is browsing never reaches the form.
|
|
20
|
+
const handleChange = (next) => onCommit(next ? next.toString() : null);
|
|
21
|
+
// `DatePicker`'s ref is its root div; the trigger is the only button in it, the calendar being portalled.
|
|
22
|
+
const focusRef = useFocusTarget(ref, 'button');
|
|
23
|
+
return (jsx(DatePicker
|
|
24
|
+
// The form's schema validates; the browser's own `required` check would block the submit before it runs.
|
|
25
|
+
, {
|
|
26
|
+
// The form's schema validates; the browser's own `required` check would block the submit before it runs.
|
|
27
|
+
validationBehavior: "aria", ...datePickerProps, ref: focusRef, name: name, value: date, onChange: handleChange, onBlur: onBlur, isInvalid: isInvalid, hint: errorMessage ?? hint,
|
|
28
|
+
// Disabled while the form submits: read-only would disable the trigger all the same, without looking it.
|
|
29
|
+
isDisabled: datePickerProps.isDisabled || isDisabled || isLocked }));
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export { FormDatePicker };
|
|
33
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/components/forms/fields/FormDatePicker/index.tsx"],"sourcesContent":[null],"names":["_jsx"],"mappings":";;;;;;;AAkBA;;;;;;AAMG;AACI,MAAM,cAAc,GAAG,CAA4C,EACxE,IAAI,EACJ,WAAW,EACX,IAAI,EACJ,GAAG,eAAe,EACW,KAAI;IACjC,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,YAAY,CAAyB,IAAI,EAAE,WAAW,CAAC;;AAE/I,IAAA,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;;IAE1D,MAAM,YAAY,GAAG,CAAC,IAAsB,KAAK,QAAQ,CAAC,IAAI,GAAG,IAAI,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC;;IAGxF,MAAM,QAAQ,GAAG,cAAc,CAAC,GAAG,EAAE,QAAQ,CAAC;IAE9C,QACEA,IAAC;;;;AAEC,QAAA,kBAAkB,EAAC,MAAM,EAAA,GACrB,eAAe,EACnB,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,IAAI,EACX,QAAQ,EAAE,YAAY,EACtB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,YAAY,IAAI,IAAI;;QAE1B,UAAU,EAAE,eAAe,CAAC,UAAU,IAAI,UAAU,IAAI,QAAQ,EAAA,CAChE;AAEN;;"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var date = require('@internationalized/date');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Reads a form value as a calendar date without throwing, since a default value may come from an API in another shape.
|
|
7
|
+
*
|
|
8
|
+
* @param value The field's value: an ISO date (`2026-03-01`), or an ISO date-time whose date part is used.
|
|
9
|
+
* @returns The date, or `null` for an empty value or one that is not an ISO date.
|
|
10
|
+
*/
|
|
11
|
+
const toCalendarDate = (value) => {
|
|
12
|
+
if (typeof value !== 'string')
|
|
13
|
+
return null;
|
|
14
|
+
try {
|
|
15
|
+
return date.parseDate(value.slice(0, 10));
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
exports.toCalendarDate = toCalendarDate;
|
|
23
|
+
//# sourceMappingURL=formDatePicker.utils.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formDatePicker.utils.cjs","sources":["../../../../../../src/components/forms/fields/FormDatePicker/utilities/formDatePicker.utils.ts"],"sourcesContent":[null],"names":["parseDate"],"mappings":";;;;AAEA;;;;;AAKG;AACI,MAAM,cAAc,GAAG,CAAC,KAAgC,KAAyB;IACtF,IAAI,OAAO,KAAK,KAAK,QAAQ;AAAE,QAAA,OAAO,IAAI;AAC1C,IAAA,IAAI;QACF,OAAOA,cAAS,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACtC;AAAE,IAAA,MAAM;AACN,QAAA,OAAO,IAAI;IACb;AACF;;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type CalendarDate } from '@internationalized/date';
|
|
2
|
+
/**
|
|
3
|
+
* Reads a form value as a calendar date without throwing, since a default value may come from an API in another shape.
|
|
4
|
+
*
|
|
5
|
+
* @param value The field's value: an ISO date (`2026-03-01`), or an ISO date-time whose date part is used.
|
|
6
|
+
* @returns The date, or `null` for an empty value or one that is not an ISO date.
|
|
7
|
+
*/
|
|
8
|
+
export declare const toCalendarDate: (value: string | null | undefined) => CalendarDate | null;
|
|
9
|
+
//# sourceMappingURL=formDatePicker.utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formDatePicker.utils.d.ts","sourceRoot":"","sources":["../../../../../../src/components/forms/fields/FormDatePicker/utilities/formDatePicker.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAa,MAAM,yBAAyB,CAAC;AAEvE;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GAAI,OAAO,MAAM,GAAG,IAAI,GAAG,SAAS,KAAG,YAAY,GAAG,IAOhF,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { parseDate } from '@internationalized/date';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Reads a form value as a calendar date without throwing, since a default value may come from an API in another shape.
|
|
5
|
+
*
|
|
6
|
+
* @param value The field's value: an ISO date (`2026-03-01`), or an ISO date-time whose date part is used.
|
|
7
|
+
* @returns The date, or `null` for an empty value or one that is not an ISO date.
|
|
8
|
+
*/
|
|
9
|
+
const toCalendarDate = (value) => {
|
|
10
|
+
if (typeof value !== 'string')
|
|
11
|
+
return null;
|
|
12
|
+
try {
|
|
13
|
+
return parseDate(value.slice(0, 10));
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export { toCalendarDate };
|
|
21
|
+
//# sourceMappingURL=formDatePicker.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formDatePicker.utils.js","sources":["../../../../../../src/components/forms/fields/FormDatePicker/utilities/formDatePicker.utils.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAEA;;;;;AAKG;AACI,MAAM,cAAc,GAAG,CAAC,KAAgC,KAAyB;IACtF,IAAI,OAAO,KAAK,KAAK,QAAQ;AAAE,QAAA,OAAO,IAAI;AAC1C,IAAA,IAAI;QACF,OAAO,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACtC;AAAE,IAAA,MAAM;AACN,QAAA,OAAO,IAAI;IACb;AACF;;"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var Input = require('@flipdish/ui-library/components/atoms/Input');
|
|
5
|
+
var useFormField = require('../../__internal__/formField/hooks/useFormField.cjs');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* An `Input` bound to a react-hook-form field: it reads and writes the field's value, marks itself invalid and shows
|
|
9
|
+
* the field's error in place of `hint`. Use it for every text field in a form built with react-hook-form.
|
|
10
|
+
*
|
|
11
|
+
* @summary text input bound to a react-hook-form field
|
|
12
|
+
*/
|
|
13
|
+
const FormInput = ({ name, revalidates, hint, ...inputProps }) => {
|
|
14
|
+
const { value, ref, onChange, onBlur, isInvalid, errorMessage, isDisabled, isLocked } = useFormField.useFormField(name, revalidates);
|
|
15
|
+
return (jsxRuntime.jsx(Input.Input
|
|
16
|
+
// The form's schema validates; the browser's own `required` check would block the submit before it runs.
|
|
17
|
+
, {
|
|
18
|
+
// The form's schema validates; the browser's own `required` check would block the submit before it runs.
|
|
19
|
+
validationBehavior: "aria", ...inputProps, ref: ref, name: name, onChange: onChange, onBlur: onBlur,
|
|
20
|
+
// An unset field is `undefined`, which would flip the input between uncontrolled and controlled.
|
|
21
|
+
value: value ?? '', isInvalid: isInvalid, hint: errorMessage ?? hint, isDisabled: inputProps.isDisabled || isDisabled,
|
|
22
|
+
// Read-only while the form submits: the field keeps its focus and its value, and nothing typed meanwhile is lost to the save.
|
|
23
|
+
isReadOnly: inputProps.isReadOnly || isLocked }));
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
exports.FormInput = FormInput;
|
|
27
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../../../src/components/forms/fields/FormInput/index.tsx"],"sourcesContent":[null],"names":["useFormField","_jsx","Input"],"mappings":";;;;;;AAcA;;;;;AAKG;AACI,MAAM,SAAS,GAAG,CAA4C,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,GAAG,UAAU,EAA2B,KAAI;IAC1I,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAGA,yBAAY,CAAkB,IAAI,EAAE,WAAW,CAAC;IAExI,QACEC,eAACC;;;;AAEC,QAAA,kBAAkB,EAAC,MAAM,EAAA,GACrB,UAAU,EACd,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM;;QAEd,KAAK,EAAE,KAAK,IAAI,EAAE,EAClB,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,YAAY,IAAI,IAAI,EAC1B,UAAU,EAAE,UAAU,CAAC,UAAU,IAAI,UAAU;;QAE/C,UAAU,EAAE,UAAU,CAAC,UAAU,IAAI,QAAQ,EAAA,CAC7C;AAEN;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type InputProps } from '@flipdish/ui-library/components/atoms/Input';
|
|
2
|
+
import type { FieldPath, FieldValues } from 'react-hook-form';
|
|
3
|
+
export interface FormInputProps<TValues extends FieldValues = FieldValues> extends Omit<InputProps, 'name' | 'value' | 'defaultValue' | 'onChange' | 'onBlur' | 'isInvalid' | 'ref'> {
|
|
4
|
+
/** The field's path in the form values, such as `email` or `address.city`. */
|
|
5
|
+
name: FieldPath<TValues>;
|
|
6
|
+
/** Other fields whose rule reads this one, such as a postcode that depends on this country; they re-validate when this changes. */
|
|
7
|
+
revalidates?: FieldPath<TValues> | FieldPath<TValues>[];
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* An `Input` bound to a react-hook-form field: it reads and writes the field's value, marks itself invalid and shows
|
|
11
|
+
* the field's error in place of `hint`. Use it for every text field in a form built with react-hook-form.
|
|
12
|
+
*
|
|
13
|
+
* @summary text input bound to a react-hook-form field
|
|
14
|
+
*/
|
|
15
|
+
export declare const FormInput: <TValues extends FieldValues = FieldValues>({ name, revalidates, hint, ...inputProps }: FormInputProps<TValues>) => import("react").JSX.Element;
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/forms/fields/FormInput/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAS,KAAK,UAAU,EAAE,MAAM,6CAA6C,CAAC;AACrF,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAG9D,MAAM,WAAW,cAAc,CAAC,OAAO,SAAS,WAAW,GAAG,WAAW,CACvE,SAAQ,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,GAAG,cAAc,GAAG,UAAU,GAAG,QAAQ,GAAG,WAAW,GAAG,KAAK,CAAC;IACzG,8EAA8E;IAC9E,IAAI,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;IACzB,mIAAmI;IACnI,WAAW,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,GAAG,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;CACzD;AAED;;;;;GAKG;AACH,eAAO,MAAM,SAAS,GAAI,OAAO,SAAS,WAAW,GAAG,WAAW,EAAE,4CAA4C,cAAc,CAAC,OAAO,CAAC,gCAqBvI,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { Input } from '@flipdish/ui-library/components/atoms/Input';
|
|
3
|
+
import { useFormField } from '../../__internal__/formField/hooks/useFormField.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* An `Input` bound to a react-hook-form field: it reads and writes the field's value, marks itself invalid and shows
|
|
7
|
+
* the field's error in place of `hint`. Use it for every text field in a form built with react-hook-form.
|
|
8
|
+
*
|
|
9
|
+
* @summary text input bound to a react-hook-form field
|
|
10
|
+
*/
|
|
11
|
+
const FormInput = ({ name, revalidates, hint, ...inputProps }) => {
|
|
12
|
+
const { value, ref, onChange, onBlur, isInvalid, errorMessage, isDisabled, isLocked } = useFormField(name, revalidates);
|
|
13
|
+
return (jsx(Input
|
|
14
|
+
// The form's schema validates; the browser's own `required` check would block the submit before it runs.
|
|
15
|
+
, {
|
|
16
|
+
// The form's schema validates; the browser's own `required` check would block the submit before it runs.
|
|
17
|
+
validationBehavior: "aria", ...inputProps, ref: ref, name: name, onChange: onChange, onBlur: onBlur,
|
|
18
|
+
// An unset field is `undefined`, which would flip the input between uncontrolled and controlled.
|
|
19
|
+
value: value ?? '', isInvalid: isInvalid, hint: errorMessage ?? hint, isDisabled: inputProps.isDisabled || isDisabled,
|
|
20
|
+
// Read-only while the form submits: the field keeps its focus and its value, and nothing typed meanwhile is lost to the save.
|
|
21
|
+
isReadOnly: inputProps.isReadOnly || isLocked }));
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export { FormInput };
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/components/forms/fields/FormInput/index.tsx"],"sourcesContent":[null],"names":["_jsx"],"mappings":";;;;AAcA;;;;;AAKG;AACI,MAAM,SAAS,GAAG,CAA4C,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,GAAG,UAAU,EAA2B,KAAI;IAC1I,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,YAAY,CAAkB,IAAI,EAAE,WAAW,CAAC;IAExI,QACEA,IAAC;;;;AAEC,QAAA,kBAAkB,EAAC,MAAM,EAAA,GACrB,UAAU,EACd,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM;;QAEd,KAAK,EAAE,KAAK,IAAI,EAAE,EAClB,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,YAAY,IAAI,IAAI,EAC1B,UAAU,EAAE,UAAU,CAAC,UAAU,IAAI,UAAU;;QAE/C,UAAU,EAAE,UAAU,CAAC,UAAU,IAAI,QAAQ,EAAA,CAC7C;AAEN;;"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var Select = require('@flipdish/ui-library/components/molecules/Select');
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var useFocusTarget = require('../../__internal__/formField/hooks/useFocusTarget.cjs');
|
|
7
|
+
var useFormField = require('../../__internal__/formField/hooks/useFormField.cjs');
|
|
8
|
+
var multiSelect_utils = require('../../../molecules/Select/multiSelect.utils.cjs');
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* A `MultiSelect` bound to a react-hook-form field: every tick, Reset and Select all writes the chosen `id`s to the form
|
|
12
|
+
* as an array and validates it at once, and the field's error shows in place of `hint`. Use it when the user picks
|
|
13
|
+
* several options from a list in a react-hook-form form.
|
|
14
|
+
*
|
|
15
|
+
* @summary multi-option select bound to a react-hook-form field
|
|
16
|
+
*/
|
|
17
|
+
const FormMultiSelect = ({ name, revalidates, hint, items, children, onReset, onSelectAll, ...multiSelectProps }) => {
|
|
18
|
+
const { value, ref, onCommit, isInvalid, errorMessage, isDisabled, isLocked } = useFormField.useFormField(name, revalidates);
|
|
19
|
+
// An unset field is `undefined`, which would leave the list uncontrolled; a stable set avoids re-rendering every option.
|
|
20
|
+
const selectedKeys = React.useMemo(() => new Set(value ?? []), [value]);
|
|
21
|
+
// The same ids `MultiSelect`'s own Select all uses: from `items`, else from the static `MultiSelect.Item` children.
|
|
22
|
+
const allKeys = () => [
|
|
23
|
+
...multiSelect_utils.collectSelectableKeys(items?.map((item) => item.id), children),
|
|
24
|
+
];
|
|
25
|
+
// A react-aria `Selection` may be `'all'`, which a schema cannot validate, so it becomes the ids.
|
|
26
|
+
const handleSelectionChange = (keys) => onCommit(keys === 'all' ? allKeys() : [...keys]);
|
|
27
|
+
// A controlled `MultiSelect` leaves Reset and Select all to its parent.
|
|
28
|
+
const handleReset = () => {
|
|
29
|
+
onCommit([]);
|
|
30
|
+
onReset?.();
|
|
31
|
+
};
|
|
32
|
+
const handleSelectAll = () => {
|
|
33
|
+
onCommit(allKeys());
|
|
34
|
+
onSelectAll?.();
|
|
35
|
+
};
|
|
36
|
+
// `MultiSelect`'s ref is its wrapper div; the trigger is its only direct button child (the label's tooltip is nested).
|
|
37
|
+
const focusRef = useFocusTarget.useFocusTarget(ref, ':scope > button');
|
|
38
|
+
return (jsxRuntime.jsx(Select.MultiSelect, { ...multiSelectProps, ref: focusRef, items: items, selectedKeys: selectedKeys, onSelectionChange: handleSelectionChange, onReset: handleReset, onSelectAll: handleSelectAll, isInvalid: isInvalid, hint: errorMessage ?? hint,
|
|
39
|
+
// Disabled while the form submits, having no read-only mode: a change made meanwhile would be lost to the save.
|
|
40
|
+
isDisabled: multiSelectProps.isDisabled || isDisabled || isLocked, children: children }));
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
exports.FormMultiSelect = FormMultiSelect;
|
|
44
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../../../src/components/forms/fields/FormMultiSelect/index.tsx"],"sourcesContent":[null],"names":["useFormField","useMemo","collectSelectableKeys","useFocusTarget","_jsx","MultiSelect"],"mappings":";;;;;;;;;AAkBA;;;;;;AAMG;AACI,MAAM,eAAe,GAAG,CAA4C,EACzE,IAAI,EACJ,WAAW,EACX,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,OAAO,EACP,WAAW,EACX,GAAG,gBAAgB,EACW,KAAI;IAClC,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAGA,yBAAY,CAAiB,IAAI,EAAE,WAAW,CAAC;;AAE/H,IAAA,MAAM,YAAY,GAAGC,aAAO,CAAC,MAAM,IAAI,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;;AAEjE,IAAA,MAAM,OAAO,GAAG,MAAM;AACpB,QAAA,GAAGC,uCAAqB,CACtB,KAAK,EAAE,GAAG,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC,EAC7B,QAAQ,CACT;KACF;;IAGD,MAAM,qBAAqB,GAAG,CAAC,IAAe,KAAK,QAAQ,CAAC,IAAI,KAAK,KAAK,GAAG,OAAO,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;;IAEnG,MAAM,WAAW,GAAG,MAAK;QACvB,QAAQ,CAAC,EAAE,CAAC;QACZ,OAAO,IAAI;AACb,IAAA,CAAC;IACD,MAAM,eAAe,GAAG,MAAK;AAC3B,QAAA,QAAQ,CAAC,OAAO,EAAE,CAAC;QACnB,WAAW,IAAI;AACjB,IAAA,CAAC;;IAGD,MAAM,QAAQ,GAAGC,6BAAc,CAAC,GAAG,EAAE,iBAAiB,CAAC;AAEvD,IAAA,QACEC,cAAA,CAACC,kBAAW,EAAA,EAAA,GACN,gBAAgB,EACpB,GAAG,EAAE,QAAQ,EACb,KAAK,EAAE,KAAK,EACZ,YAAY,EAAE,YAAY,EAC1B,iBAAiB,EAAE,qBAAqB,EACxC,OAAO,EAAE,WAAW,EACpB,WAAW,EAAE,eAAe,EAC5B,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,YAAY,IAAI,IAAI;;AAE1B,QAAA,UAAU,EAAE,gBAAgB,CAAC,UAAU,IAAI,UAAU,IAAI,QAAQ,EAAA,QAAA,EAEhE,QAAQ,EAAA,CACG;AAElB;;"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type MultiSelectProps } from '@flipdish/ui-library/components/molecules/Select';
|
|
2
|
+
import type { FieldPath, FieldValues } from 'react-hook-form';
|
|
3
|
+
export interface FormMultiSelectProps<TValues extends FieldValues = FieldValues> extends Omit<MultiSelectProps, 'selectedKeys' | 'defaultSelectedKeys' | 'onSelectionChange' | 'isInvalid' | 'ref'> {
|
|
4
|
+
/** The field's path in the form values, such as `cuisines` or `menu.tags`. */
|
|
5
|
+
name: FieldPath<TValues>;
|
|
6
|
+
/** Other fields whose rule reads this one, such as a postcode that depends on this country; they re-validate when this changes. */
|
|
7
|
+
revalidates?: FieldPath<TValues> | FieldPath<TValues>[];
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* A `MultiSelect` bound to a react-hook-form field: every tick, Reset and Select all writes the chosen `id`s to the form
|
|
11
|
+
* as an array and validates it at once, and the field's error shows in place of `hint`. Use it when the user picks
|
|
12
|
+
* several options from a list in a react-hook-form form.
|
|
13
|
+
*
|
|
14
|
+
* @summary multi-option select bound to a react-hook-form field
|
|
15
|
+
*/
|
|
16
|
+
export declare const FormMultiSelect: <TValues extends FieldValues = FieldValues>({ name, revalidates, hint, items, children, onReset, onSelectAll, ...multiSelectProps }: FormMultiSelectProps<TValues>) => import("react").JSX.Element;
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/forms/fields/FormMultiSelect/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAe,KAAK,gBAAgB,EAAE,MAAM,kDAAkD,CAAC;AAGtG,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAK9D,MAAM,WAAW,oBAAoB,CAAC,OAAO,SAAS,WAAW,GAAG,WAAW,CAC7E,SAAQ,IAAI,CAAC,gBAAgB,EAAE,cAAc,GAAG,qBAAqB,GAAG,mBAAmB,GAAG,WAAW,GAAG,KAAK,CAAC;IAClH,8EAA8E;IAC9E,IAAI,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;IACzB,mIAAmI;IACnI,WAAW,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,GAAG,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;CACzD;AAED;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,GAAI,OAAO,SAAS,WAAW,GAAG,WAAW,EAAE,yFASxE,oBAAoB,CAAC,OAAO,CAAC,gCA4C/B,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { MultiSelect } from '@flipdish/ui-library/components/molecules/Select';
|
|
3
|
+
import { useMemo } from 'react';
|
|
4
|
+
import { useFocusTarget } from '../../__internal__/formField/hooks/useFocusTarget.js';
|
|
5
|
+
import { useFormField } from '../../__internal__/formField/hooks/useFormField.js';
|
|
6
|
+
import { collectSelectableKeys } from '../../../molecules/Select/multiSelect.utils.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* A `MultiSelect` bound to a react-hook-form field: every tick, Reset and Select all writes the chosen `id`s to the form
|
|
10
|
+
* as an array and validates it at once, and the field's error shows in place of `hint`. Use it when the user picks
|
|
11
|
+
* several options from a list in a react-hook-form form.
|
|
12
|
+
*
|
|
13
|
+
* @summary multi-option select bound to a react-hook-form field
|
|
14
|
+
*/
|
|
15
|
+
const FormMultiSelect = ({ name, revalidates, hint, items, children, onReset, onSelectAll, ...multiSelectProps }) => {
|
|
16
|
+
const { value, ref, onCommit, isInvalid, errorMessage, isDisabled, isLocked } = useFormField(name, revalidates);
|
|
17
|
+
// An unset field is `undefined`, which would leave the list uncontrolled; a stable set avoids re-rendering every option.
|
|
18
|
+
const selectedKeys = useMemo(() => new Set(value ?? []), [value]);
|
|
19
|
+
// The same ids `MultiSelect`'s own Select all uses: from `items`, else from the static `MultiSelect.Item` children.
|
|
20
|
+
const allKeys = () => [
|
|
21
|
+
...collectSelectableKeys(items?.map((item) => item.id), children),
|
|
22
|
+
];
|
|
23
|
+
// A react-aria `Selection` may be `'all'`, which a schema cannot validate, so it becomes the ids.
|
|
24
|
+
const handleSelectionChange = (keys) => onCommit(keys === 'all' ? allKeys() : [...keys]);
|
|
25
|
+
// A controlled `MultiSelect` leaves Reset and Select all to its parent.
|
|
26
|
+
const handleReset = () => {
|
|
27
|
+
onCommit([]);
|
|
28
|
+
onReset?.();
|
|
29
|
+
};
|
|
30
|
+
const handleSelectAll = () => {
|
|
31
|
+
onCommit(allKeys());
|
|
32
|
+
onSelectAll?.();
|
|
33
|
+
};
|
|
34
|
+
// `MultiSelect`'s ref is its wrapper div; the trigger is its only direct button child (the label's tooltip is nested).
|
|
35
|
+
const focusRef = useFocusTarget(ref, ':scope > button');
|
|
36
|
+
return (jsx(MultiSelect, { ...multiSelectProps, ref: focusRef, items: items, selectedKeys: selectedKeys, onSelectionChange: handleSelectionChange, onReset: handleReset, onSelectAll: handleSelectAll, isInvalid: isInvalid, hint: errorMessage ?? hint,
|
|
37
|
+
// Disabled while the form submits, having no read-only mode: a change made meanwhile would be lost to the save.
|
|
38
|
+
isDisabled: multiSelectProps.isDisabled || isDisabled || isLocked, children: children }));
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export { FormMultiSelect };
|
|
42
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/components/forms/fields/FormMultiSelect/index.tsx"],"sourcesContent":[null],"names":["_jsx"],"mappings":";;;;;;;AAkBA;;;;;;AAMG;AACI,MAAM,eAAe,GAAG,CAA4C,EACzE,IAAI,EACJ,WAAW,EACX,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,OAAO,EACP,WAAW,EACX,GAAG,gBAAgB,EACW,KAAI;IAClC,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,YAAY,CAAiB,IAAI,EAAE,WAAW,CAAC;;AAE/H,IAAA,MAAM,YAAY,GAAG,OAAO,CAAC,MAAM,IAAI,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;;AAEjE,IAAA,MAAM,OAAO,GAAG,MAAM;AACpB,QAAA,GAAG,qBAAqB,CACtB,KAAK,EAAE,GAAG,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC,EAC7B,QAAQ,CACT;KACF;;IAGD,MAAM,qBAAqB,GAAG,CAAC,IAAe,KAAK,QAAQ,CAAC,IAAI,KAAK,KAAK,GAAG,OAAO,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;;IAEnG,MAAM,WAAW,GAAG,MAAK;QACvB,QAAQ,CAAC,EAAE,CAAC;QACZ,OAAO,IAAI;AACb,IAAA,CAAC;IACD,MAAM,eAAe,GAAG,MAAK;AAC3B,QAAA,QAAQ,CAAC,OAAO,EAAE,CAAC;QACnB,WAAW,IAAI;AACjB,IAAA,CAAC;;IAGD,MAAM,QAAQ,GAAG,cAAc,CAAC,GAAG,EAAE,iBAAiB,CAAC;AAEvD,IAAA,QACEA,GAAA,CAAC,WAAW,EAAA,EAAA,GACN,gBAAgB,EACpB,GAAG,EAAE,QAAQ,EACb,KAAK,EAAE,KAAK,EACZ,YAAY,EAAE,YAAY,EAC1B,iBAAiB,EAAE,qBAAqB,EACxC,OAAO,EAAE,WAAW,EACpB,WAAW,EAAE,eAAe,EAC5B,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,YAAY,IAAI,IAAI;;AAE1B,QAAA,UAAU,EAAE,gBAAgB,CAAC,UAAU,IAAI,UAAU,IAAI,QAAQ,EAAA,QAAA,EAEhE,QAAQ,EAAA,CACG;AAElB;;"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var Input = require('@flipdish/ui-library/components/atoms/Input');
|
|
5
|
+
var RadioGroup = require('@flipdish/ui-library/components/molecules/RadioGroup');
|
|
6
|
+
var React = require('react');
|
|
7
|
+
var useFocusTarget = require('../../__internal__/formField/hooks/useFocusTarget.cjs');
|
|
8
|
+
var useFormField = require('../../__internal__/formField/hooks/useFormField.cjs');
|
|
9
|
+
var ariaIds_utils = require('../../../../utilities/__internal__/ariaIdsUtils/ariaIds.utils.cjs');
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The card radio group, `RadioGroup.RadioButton`, bound to a react-hook-form field: choosing a card writes its value to
|
|
13
|
+
* the form and validates it at once, and the field's error shows beneath the cards. Use it when each option needs a line of description.
|
|
14
|
+
*
|
|
15
|
+
* @summary card radio group bound to a react-hook-form field
|
|
16
|
+
*/
|
|
17
|
+
const FormRadioCardGroup = ({ name, revalidates, label, hint, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, ...radioGroupProps }) => {
|
|
18
|
+
const { value, ref, onCommit, onBlur, isInvalid, errorMessage, isDisabled, isLocked } = useFormField.useFormField(name, revalidates);
|
|
19
|
+
// The group takes no ref, so the wrapper hands the form the chosen radio, or the first when none is.
|
|
20
|
+
const focusRef = useFocusTarget.useFocusTarget(ref, 'input:checked:not(:disabled)', 'input:not(:disabled)');
|
|
21
|
+
const labelId = React.useId();
|
|
22
|
+
const messageId = React.useId();
|
|
23
|
+
const message = errorMessage ?? hint;
|
|
24
|
+
return (jsxRuntime.jsxs("div", { ref: focusRef, className: "flex w-full flex-col gap-1.5", children: [label && (jsxRuntime.jsxs("span", { id: labelId, className: "flex items-center gap-0.5 text-sm font-medium text-secondary", children: [label, radioGroupProps.isRequired && (jsxRuntime.jsx("span", { "aria-hidden": "true", className: "text-brand-tertiary", children: "*" }))] })), jsxRuntime.jsx(RadioGroup.RadioButton
|
|
25
|
+
// The form's schema validates; the browser's own `required` check would block the submit before it runs.
|
|
26
|
+
, {
|
|
27
|
+
// The form's schema validates; the browser's own `required` check would block the submit before it runs.
|
|
28
|
+
validationBehavior: "aria", ...radioGroupProps, name: name,
|
|
29
|
+
// An unset field is `undefined`, which would flip the group between uncontrolled and controlled.
|
|
30
|
+
value: value ?? null, onChange: onCommit, onBlur: onBlur, isInvalid: isInvalid, isDisabled: radioGroupProps.isDisabled || isDisabled,
|
|
31
|
+
// Read-only while the form submits: the field keeps its focus and its value, and nothing typed meanwhile is lost to the save.
|
|
32
|
+
isReadOnly: radioGroupProps.isReadOnly || isLocked, "aria-labelledby": ariaIds_utils.joinIds(ariaLabelledBy, label && labelId), "aria-describedby": ariaIds_utils.joinIds(ariaDescribedBy, message && messageId) }), message && (jsxRuntime.jsx(Input.HintText, { id: messageId, isInvalid: Boolean(errorMessage), children: message }))] }));
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
exports.FormRadioCardGroup = FormRadioCardGroup;
|
|
36
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../../../src/components/forms/fields/FormRadioCardGroup/index.tsx"],"sourcesContent":[null],"names":["useFormField","useFocusTarget","useId","_jsxs","_jsx","RadioButton","joinIds","HintText"],"mappings":";;;;;;;;;;AA0BA;;;;;AAKG;AACI,MAAM,kBAAkB,GAAG,CAA4C,EAC5E,IAAI,EACJ,WAAW,EACX,KAAK,EACL,IAAI,EACJ,iBAAiB,EAAE,cAAc,EACjC,kBAAkB,EAAE,eAAe,EACnC,GAAG,eAAe,EACe,KAAI;IACrC,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAGA,yBAAY,CAAkB,IAAI,EAAE,WAAW,CAAC;;IAExI,MAAM,QAAQ,GAAGC,6BAAc,CAAC,GAAG,EAAE,8BAA8B,EAAE,sBAAsB,CAAC;AAC5F,IAAA,MAAM,OAAO,GAAGC,WAAK,EAAE;AACvB,IAAA,MAAM,SAAS,GAAGA,WAAK,EAAE;AACzB,IAAA,MAAM,OAAO,GAAG,YAAY,IAAI,IAAI;AAEpC,IAAA,QACEC,eAAA,CAAA,KAAA,EAAA,EAAK,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAC,8BAA8B,EAAA,QAAA,EAAA,CACzD,KAAK,KACJA,eAAA,CAAA,MAAA,EAAA,EAAM,EAAE,EAAE,OAAO,EAAE,SAAS,EAAC,8DAA8D,EAAA,QAAA,EAAA,CACxF,KAAK,EACL,eAAe,CAAC,UAAU,KACzBC,cAAA,CAAA,MAAA,EAAA,EAAA,aAAA,EAAkB,MAAM,EAAC,SAAS,EAAC,qBAAqB,EAAA,QAAA,EAAA,GAAA,EAAA,CAEjD,CACR,IACI,CACR,EACDA,eAACC;;;;AAEC,gBAAA,kBAAkB,EAAC,MAAM,EAAA,GACrB,eAAe,EACnB,IAAI,EAAE,IAAI;;gBAEV,KAAK,EAAE,KAAK,IAAI,IAAI,EACpB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,eAAe,CAAC,UAAU,IAAI,UAAU;;gBAEpD,UAAU,EAAE,eAAe,CAAC,UAAU,IAAI,QAAQ,EAAA,iBAAA,EACjCC,qBAAO,CAAC,cAAc,EAAE,KAAK,IAAI,OAAO,CAAC,EAAA,kBAAA,EAExCA,qBAAO,CAAC,eAAe,EAAE,OAAO,IAAI,SAAS,CAAC,GAChE,EACD,OAAO,KACNF,cAAA,CAACG,cAAQ,EAAA,EAAC,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC,YAAY,CAAC,EAAA,QAAA,EACtD,OAAO,EAAA,CACC,CACZ,CAAA,EAAA,CACG;AAEV;;"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { RadioButton } from '@flipdish/ui-library/components/molecules/RadioGroup';
|
|
2
|
+
import { type ComponentProps } from 'react';
|
|
3
|
+
import type { FieldPath, FieldValues } from 'react-hook-form';
|
|
4
|
+
interface FormRadioCardGroupBaseProps<TValues extends FieldValues = FieldValues> extends Omit<ComponentProps<typeof RadioButton>, 'name' | 'value' | 'defaultValue' | 'onChange' | 'onBlur' | 'isInvalid'> {
|
|
5
|
+
/** The field's path in the form values, such as `template` or `delivery.method`. */
|
|
6
|
+
name: FieldPath<TValues>;
|
|
7
|
+
/** Other fields whose rule reads this one, such as a postcode that depends on this country; they re-validate when this changes. */
|
|
8
|
+
revalidates?: FieldPath<TValues> | FieldPath<TValues>[];
|
|
9
|
+
/** Name of the group, shown above the cards; the types ask for this, `aria-label` or `aria-labelledby`. */
|
|
10
|
+
label?: string;
|
|
11
|
+
/** Help text beneath the cards; the field's error replaces it. */
|
|
12
|
+
hint?: string;
|
|
13
|
+
}
|
|
14
|
+
export type FormRadioCardGroupProps<TValues extends FieldValues = FieldValues> = FormRadioCardGroupBaseProps<TValues> & ({
|
|
15
|
+
label: string;
|
|
16
|
+
} | {
|
|
17
|
+
'aria-label': string;
|
|
18
|
+
} | {
|
|
19
|
+
'aria-labelledby': string;
|
|
20
|
+
});
|
|
21
|
+
/**
|
|
22
|
+
* The card radio group, `RadioGroup.RadioButton`, bound to a react-hook-form field: choosing a card writes its value to
|
|
23
|
+
* the form and validates it at once, and the field's error shows beneath the cards. Use it when each option needs a line of description.
|
|
24
|
+
*
|
|
25
|
+
* @summary card radio group bound to a react-hook-form field
|
|
26
|
+
*/
|
|
27
|
+
export declare const FormRadioCardGroup: <TValues extends FieldValues = FieldValues>({ name, revalidates, label, hint, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, ...radioGroupProps }: FormRadioCardGroupProps<TValues>) => import("react").JSX.Element;
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/forms/fields/FormRadioCardGroup/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,sDAAsD,CAAC;AACnF,OAAO,EAAE,KAAK,cAAc,EAAS,MAAM,OAAO,CAAC;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAK9D,UAAU,2BAA2B,CAAC,OAAO,SAAS,WAAW,GAAG,WAAW,CAC7E,SAAQ,IAAI,CAAC,cAAc,CAAC,OAAO,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,cAAc,GAAG,UAAU,GAAG,QAAQ,GAAG,WAAW,CAAC;IACzH,oFAAoF;IACpF,IAAI,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;IACzB,mIAAmI;IACnI,WAAW,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,GAAG,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;IACxD,2GAA2G;IAC3G,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kEAAkE;IAClE,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAGD,MAAM,MAAM,uBAAuB,CAAC,OAAO,SAAS,WAAW,GAAG,WAAW,IAAI,2BAA2B,CAAC,OAAO,CAAC,GACnH,CAAC;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,YAAY,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,iBAAiB,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAEjF;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,GAAI,OAAO,SAAS,WAAW,GAAG,WAAW,EAAE,gIAQ3E,uBAAuB,CAAC,OAAO,CAAC,gCA4ClC,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { HintText } from '@flipdish/ui-library/components/atoms/Input';
|
|
3
|
+
import { RadioButton } from '@flipdish/ui-library/components/molecules/RadioGroup';
|
|
4
|
+
import { useId } from 'react';
|
|
5
|
+
import { useFocusTarget } from '../../__internal__/formField/hooks/useFocusTarget.js';
|
|
6
|
+
import { useFormField } from '../../__internal__/formField/hooks/useFormField.js';
|
|
7
|
+
import { joinIds } from '../../../../utilities/__internal__/ariaIdsUtils/ariaIds.utils.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The card radio group, `RadioGroup.RadioButton`, bound to a react-hook-form field: choosing a card writes its value to
|
|
11
|
+
* the form and validates it at once, and the field's error shows beneath the cards. Use it when each option needs a line of description.
|
|
12
|
+
*
|
|
13
|
+
* @summary card radio group bound to a react-hook-form field
|
|
14
|
+
*/
|
|
15
|
+
const FormRadioCardGroup = ({ name, revalidates, label, hint, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, ...radioGroupProps }) => {
|
|
16
|
+
const { value, ref, onCommit, onBlur, isInvalid, errorMessage, isDisabled, isLocked } = useFormField(name, revalidates);
|
|
17
|
+
// The group takes no ref, so the wrapper hands the form the chosen radio, or the first when none is.
|
|
18
|
+
const focusRef = useFocusTarget(ref, 'input:checked:not(:disabled)', 'input:not(:disabled)');
|
|
19
|
+
const labelId = useId();
|
|
20
|
+
const messageId = useId();
|
|
21
|
+
const message = errorMessage ?? hint;
|
|
22
|
+
return (jsxs("div", { ref: focusRef, className: "flex w-full flex-col gap-1.5", children: [label && (jsxs("span", { id: labelId, className: "flex items-center gap-0.5 text-sm font-medium text-secondary", children: [label, radioGroupProps.isRequired && (jsx("span", { "aria-hidden": "true", className: "text-brand-tertiary", children: "*" }))] })), jsx(RadioButton
|
|
23
|
+
// The form's schema validates; the browser's own `required` check would block the submit before it runs.
|
|
24
|
+
, {
|
|
25
|
+
// The form's schema validates; the browser's own `required` check would block the submit before it runs.
|
|
26
|
+
validationBehavior: "aria", ...radioGroupProps, name: name,
|
|
27
|
+
// An unset field is `undefined`, which would flip the group between uncontrolled and controlled.
|
|
28
|
+
value: value ?? null, onChange: onCommit, onBlur: onBlur, isInvalid: isInvalid, isDisabled: radioGroupProps.isDisabled || isDisabled,
|
|
29
|
+
// Read-only while the form submits: the field keeps its focus and its value, and nothing typed meanwhile is lost to the save.
|
|
30
|
+
isReadOnly: radioGroupProps.isReadOnly || isLocked, "aria-labelledby": joinIds(ariaLabelledBy, label && labelId), "aria-describedby": joinIds(ariaDescribedBy, message && messageId) }), message && (jsx(HintText, { id: messageId, isInvalid: Boolean(errorMessage), children: message }))] }));
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export { FormRadioCardGroup };
|
|
34
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/components/forms/fields/FormRadioCardGroup/index.tsx"],"sourcesContent":[null],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;AA0BA;;;;;AAKG;AACI,MAAM,kBAAkB,GAAG,CAA4C,EAC5E,IAAI,EACJ,WAAW,EACX,KAAK,EACL,IAAI,EACJ,iBAAiB,EAAE,cAAc,EACjC,kBAAkB,EAAE,eAAe,EACnC,GAAG,eAAe,EACe,KAAI;IACrC,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,YAAY,CAAkB,IAAI,EAAE,WAAW,CAAC;;IAExI,MAAM,QAAQ,GAAG,cAAc,CAAC,GAAG,EAAE,8BAA8B,EAAE,sBAAsB,CAAC;AAC5F,IAAA,MAAM,OAAO,GAAG,KAAK,EAAE;AACvB,IAAA,MAAM,SAAS,GAAG,KAAK,EAAE;AACzB,IAAA,MAAM,OAAO,GAAG,YAAY,IAAI,IAAI;AAEpC,IAAA,QACEA,IAAA,CAAA,KAAA,EAAA,EAAK,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAC,8BAA8B,EAAA,QAAA,EAAA,CACzD,KAAK,KACJA,IAAA,CAAA,MAAA,EAAA,EAAM,EAAE,EAAE,OAAO,EAAE,SAAS,EAAC,8DAA8D,EAAA,QAAA,EAAA,CACxF,KAAK,EACL,eAAe,CAAC,UAAU,KACzBC,GAAA,CAAA,MAAA,EAAA,EAAA,aAAA,EAAkB,MAAM,EAAC,SAAS,EAAC,qBAAqB,EAAA,QAAA,EAAA,GAAA,EAAA,CAEjD,CACR,IACI,CACR,EACDA,IAAC;;;;AAEC,gBAAA,kBAAkB,EAAC,MAAM,EAAA,GACrB,eAAe,EACnB,IAAI,EAAE,IAAI;;gBAEV,KAAK,EAAE,KAAK,IAAI,IAAI,EACpB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,eAAe,CAAC,UAAU,IAAI,UAAU;;gBAEpD,UAAU,EAAE,eAAe,CAAC,UAAU,IAAI,QAAQ,EAAA,iBAAA,EACjC,OAAO,CAAC,cAAc,EAAE,KAAK,IAAI,OAAO,CAAC,EAAA,kBAAA,EAExC,OAAO,CAAC,eAAe,EAAE,OAAO,IAAI,SAAS,CAAC,GAChE,EACD,OAAO,KACNA,GAAA,CAAC,QAAQ,EAAA,EAAC,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC,YAAY,CAAC,EAAA,QAAA,EACtD,OAAO,EAAA,CACC,CACZ,CAAA,EAAA,CACG;AAEV;;"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var Input = require('@flipdish/ui-library/components/atoms/Input');
|
|
5
|
+
var RadioButton = require('@flipdish/ui-library/components/atoms/RadioButton');
|
|
6
|
+
var useFocusTarget = require('../../__internal__/formField/hooks/useFocusTarget.cjs');
|
|
7
|
+
var useFormField = require('../../__internal__/formField/hooks/useFormField.cjs');
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* A `RadioGroup` bound to a react-hook-form field: choosing an option writes its value to the form and validates it
|
|
11
|
+
* at once, and the field's error shows beneath the group. Use it when the user picks one of a few visible options.
|
|
12
|
+
*
|
|
13
|
+
* @summary radio group bound to a react-hook-form field
|
|
14
|
+
*/
|
|
15
|
+
const FormRadioGroup = ({ name, revalidates, children, ...radioGroupProps }) => {
|
|
16
|
+
const { value, ref, onCommit, onBlur, isInvalid, errorMessage, isDisabled, isLocked } = useFormField.useFormField(name, revalidates);
|
|
17
|
+
// `RadioGroup` takes no ref, so a layout-neutral wrapper hands the form the chosen radio, or the first when none is.
|
|
18
|
+
const focusRef = useFocusTarget.useFocusTarget(ref, 'input:checked:not(:disabled)', 'input:not(:disabled)');
|
|
19
|
+
return (jsxRuntime.jsx("div", { ref: focusRef, className: "contents", children: jsxRuntime.jsxs(RadioButton.RadioGroup
|
|
20
|
+
// The form's schema validates; the browser's own `required` check would block the submit before it runs.
|
|
21
|
+
, {
|
|
22
|
+
// The form's schema validates; the browser's own `required` check would block the submit before it runs.
|
|
23
|
+
validationBehavior: "aria", ...radioGroupProps, name: name,
|
|
24
|
+
// An unset field is `undefined`, which would flip the group between uncontrolled and controlled.
|
|
25
|
+
value: value ?? null, onChange: onCommit, onBlur: onBlur, isInvalid: isInvalid, isDisabled: radioGroupProps.isDisabled || isDisabled,
|
|
26
|
+
// Read-only while the form submits: the field keeps its focus and its value, and nothing typed meanwhile is lost to the save.
|
|
27
|
+
isReadOnly: radioGroupProps.isReadOnly || isLocked, children: [children, isInvalid && errorMessage && (jsxRuntime.jsx(Input.HintText, { isInvalid: true, role: "alert", children: errorMessage }))] }) }));
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
exports.FormRadioGroup = FormRadioGroup;
|
|
31
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../../../src/components/forms/fields/FormRadioGroup/index.tsx"],"sourcesContent":[null],"names":["useFormField","useFocusTarget","_jsx","_jsxs","RadioGroup","HintText"],"mappings":";;;;;;;;AAiBA;;;;;AAKG;AACI,MAAM,cAAc,GAAG,CAA4C,EACxE,IAAI,EACJ,WAAW,EACX,QAAQ,EACR,GAAG,eAAe,EACW,KAAI;IACjC,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAGA,yBAAY,CAAkB,IAAI,EAAE,WAAW,CAAC;;IAExI,MAAM,QAAQ,GAAGC,6BAAc,CAAC,GAAG,EAAE,8BAA8B,EAAE,sBAAsB,CAAC;IAE5F,QACEC,cAAA,CAAA,KAAA,EAAA,EAAK,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAC,UAAU,EAAA,QAAA,EACtCC,eAAA,CAACC;;;;AAEC,YAAA,kBAAkB,EAAC,MAAM,EAAA,GACrB,eAAe,EACnB,IAAI,EAAE,IAAI;;YAEV,KAAK,EAAE,KAAK,IAAI,IAAI,EACpB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,eAAe,CAAC,UAAU,IAAI,UAAU;;AAEpD,YAAA,UAAU,EAAE,eAAe,CAAC,UAAU,IAAI,QAAQ,EAAA,QAAA,EAAA,CAEjD,QAAQ,EAER,SAAS,IAAI,YAAY,KACxBF,cAAA,CAACG,cAAQ,EAAA,EAAC,SAAS,EAAA,IAAA,EAAC,IAAI,EAAC,OAAO,EAAA,QAAA,EAC7B,YAAY,EAAA,CACJ,CACZ,CAAA,EAAA,CACU,EAAA,CACT;AAEV;;"}
|