@flipdish/ui-library 0.50.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 +11 -3
- 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 +12 -4
- 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/molecules/Alert/index.cjs +5 -25
- package/dist/components/molecules/Alert/index.cjs.map +1 -1
- package/dist/components/molecules/Alert/index.d.ts +9 -94
- package/dist/components/molecules/Alert/index.d.ts.map +1 -1
- package/dist/components/molecules/Alert/index.js +5 -25
- package/dist/components/molecules/Alert/index.js.map +1 -1
- package/dist/components/molecules/Alerts/components/Alert.cjs +39 -0
- package/dist/components/molecules/Alerts/components/Alert.cjs.map +1 -0
- package/dist/components/molecules/Alerts/components/Alert.d.ts +104 -0
- package/dist/components/molecules/Alerts/components/Alert.d.ts.map +1 -0
- package/dist/components/molecules/Alerts/components/Alert.js +36 -0
- package/dist/components/molecules/Alerts/components/Alert.js.map +1 -0
- package/dist/components/molecules/Alerts/components/SaveErrorAlert.cjs +26 -0
- package/dist/components/molecules/Alerts/components/SaveErrorAlert.cjs.map +1 -0
- package/dist/components/molecules/Alerts/components/SaveErrorAlert.d.ts +25 -0
- package/dist/components/molecules/Alerts/components/SaveErrorAlert.d.ts.map +1 -0
- package/dist/components/molecules/Alerts/components/SaveErrorAlert.js +24 -0
- package/dist/components/molecules/Alerts/components/SaveErrorAlert.js.map +1 -0
- package/dist/components/molecules/Alerts/hooks/useAlertActions.cjs +26 -0
- package/dist/components/molecules/Alerts/hooks/useAlertActions.cjs.map +1 -0
- package/dist/components/molecules/Alerts/hooks/useAlertActions.d.ts +13 -0
- package/dist/components/molecules/Alerts/hooks/useAlertActions.d.ts.map +1 -0
- package/dist/components/molecules/Alerts/hooks/useAlertActions.js +24 -0
- package/dist/components/molecules/Alerts/hooks/useAlertActions.js.map +1 -0
- package/dist/components/molecules/Alerts/index.cjs +11 -0
- package/dist/components/molecules/Alerts/index.cjs.map +1 -0
- package/dist/components/molecules/Alerts/index.d.ts +12 -0
- package/dist/components/molecules/Alerts/index.d.ts.map +1 -0
- package/dist/components/molecules/Alerts/index.js +3 -0
- package/dist/components/molecules/Alerts/index.js.map +1 -0
- package/dist/components/molecules/Modal/index.cjs +9 -39
- package/dist/components/molecules/Modal/index.cjs.map +1 -1
- package/dist/components/molecules/Modal/index.d.ts +13 -36
- package/dist/components/molecules/Modal/index.d.ts.map +1 -1
- package/dist/components/molecules/Modal/index.js +8 -38
- package/dist/components/molecules/Modal/index.js.map +1 -1
- package/dist/components/molecules/Modals/components/ConfirmationModal.cjs +32 -0
- package/dist/components/molecules/Modals/components/ConfirmationModal.cjs.map +1 -0
- package/dist/components/molecules/Modals/components/ConfirmationModal.d.ts +28 -0
- package/dist/components/molecules/Modals/components/ConfirmationModal.d.ts.map +1 -0
- package/dist/components/molecules/Modals/components/ConfirmationModal.js +30 -0
- package/dist/components/molecules/Modals/components/ConfirmationModal.js.map +1 -0
- package/dist/components/molecules/Modals/components/Modal.cjs +48 -0
- package/dist/components/molecules/Modals/components/Modal.cjs.map +1 -0
- package/dist/components/molecules/Modals/components/Modal.d.ts +37 -0
- package/dist/components/molecules/Modals/components/Modal.d.ts.map +1 -0
- package/dist/components/molecules/Modals/components/Modal.js +43 -0
- package/dist/components/molecules/Modals/components/Modal.js.map +1 -0
- package/dist/components/molecules/Modals/components/UnsavedChangesModal.cjs +30 -0
- package/dist/components/molecules/Modals/components/UnsavedChangesModal.cjs.map +1 -0
- package/dist/components/molecules/Modals/components/UnsavedChangesModal.d.ts +14 -0
- package/dist/components/molecules/Modals/components/UnsavedChangesModal.d.ts.map +1 -0
- package/dist/components/molecules/Modals/components/UnsavedChangesModal.js +28 -0
- package/dist/components/molecules/Modals/components/UnsavedChangesModal.js.map +1 -0
- package/dist/components/molecules/Modals/index.cjs +15 -0
- package/dist/components/molecules/Modals/index.cjs.map +1 -0
- package/dist/components/molecules/Modals/index.d.ts +14 -0
- package/dist/components/molecules/Modals/index.d.ts.map +1 -0
- package/dist/components/molecules/Modals/index.js +4 -0
- package/dist/components/molecules/Modals/index.js.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/DatePicker/components/CalendarOverlay.cjs +2 -2
- package/dist/components/organisms/DatePicker/components/CalendarOverlay.cjs.map +1 -1
- package/dist/components/organisms/DatePicker/components/CalendarOverlay.js +1 -1
- package/dist/components/organisms/DatePicker/components/DateRangePicker.cjs +4 -1
- package/dist/components/organisms/DatePicker/components/DateRangePicker.cjs.map +1 -1
- package/dist/components/organisms/DatePicker/components/DateRangePicker.d.ts.map +1 -1
- package/dist/components/organisms/DatePicker/components/DateRangePicker.js +5 -2
- package/dist/components/organisms/DatePicker/components/DateRangePicker.js.map +1 -1
- package/dist/components/organisms/GradientPicker/components/GradientStopRow.cjs +1 -1
- package/dist/components/organisms/GradientPicker/components/GradientStopRow.js +1 -1
- package/dist/hooks/__internal__/useReturnFocus/useReturnFocus.cjs +48 -0
- package/dist/hooks/__internal__/useReturnFocus/useReturnFocus.cjs.map +1 -0
- package/dist/hooks/__internal__/useReturnFocus/useReturnFocus.d.ts +23 -0
- package/dist/hooks/__internal__/useReturnFocus/useReturnFocus.d.ts.map +1 -0
- package/dist/hooks/__internal__/useReturnFocus/useReturnFocus.js +45 -0
- package/dist/hooks/__internal__/useReturnFocus/useReturnFocus.js.map +1 -0
- package/dist/hooks/useUnsavedChangesGuard/index.cjs +28 -0
- package/dist/hooks/useUnsavedChangesGuard/index.cjs.map +1 -0
- package/dist/hooks/useUnsavedChangesGuard/index.d.ts +18 -0
- package/dist/hooks/useUnsavedChangesGuard/index.d.ts.map +1 -0
- package/dist/hooks/useUnsavedChangesGuard/index.js +26 -0
- package/dist/hooks/useUnsavedChangesGuard/index.js.map +1 -0
- package/dist/hooks/useUnsavedChangesGuard/providers/UnsavedChangesGuard.context.cjs +8 -0
- package/dist/hooks/useUnsavedChangesGuard/providers/UnsavedChangesGuard.context.cjs.map +1 -0
- package/dist/hooks/useUnsavedChangesGuard/providers/UnsavedChangesGuard.context.d.ts +13 -0
- package/dist/hooks/useUnsavedChangesGuard/providers/UnsavedChangesGuard.context.d.ts.map +1 -0
- package/dist/hooks/useUnsavedChangesGuard/providers/UnsavedChangesGuard.context.js +6 -0
- package/dist/hooks/useUnsavedChangesGuard/providers/UnsavedChangesGuard.context.js.map +1 -0
- 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/native/components/molecules/Alerts/index.d.ts +12 -0
- package/dist/native/components/molecules/Modals/index.d.ts +12 -0
- package/dist/native/hooks/useUnsavedChangesGuard/index.d.ts +12 -0
- package/dist/native/providers/UnsavedChangesGuardProvider/index.d.ts +12 -0
- package/dist/providers/UIProvider/hooks/useBrowserRouter.cjs +70 -0
- package/dist/providers/UIProvider/hooks/useBrowserRouter.cjs.map +1 -0
- package/dist/providers/UIProvider/hooks/useBrowserRouter.d.ts +12 -0
- package/dist/providers/UIProvider/hooks/useBrowserRouter.d.ts.map +1 -0
- package/dist/providers/UIProvider/hooks/useBrowserRouter.js +68 -0
- package/dist/providers/UIProvider/hooks/useBrowserRouter.js.map +1 -0
- package/dist/providers/UIProvider/index.cjs +19 -6
- package/dist/providers/UIProvider/index.cjs.map +1 -1
- package/dist/providers/UIProvider/index.d.ts +2 -2
- package/dist/providers/UIProvider/index.d.ts.map +1 -1
- package/dist/providers/UIProvider/index.js +20 -7
- package/dist/providers/UIProvider/index.js.map +1 -1
- package/dist/providers/UnsavedChangesGuardProvider/index.cjs +191 -0
- package/dist/providers/UnsavedChangesGuardProvider/index.cjs.map +1 -0
- package/dist/providers/UnsavedChangesGuardProvider/index.d.ts +10 -0
- package/dist/providers/UnsavedChangesGuardProvider/index.d.ts.map +1 -0
- package/dist/providers/UnsavedChangesGuardProvider/index.js +189 -0
- package/dist/providers/UnsavedChangesGuardProvider/index.js.map +1 -0
- package/dist/providers/UnsavedChangesGuardProvider/unsavedChangesGuard.constants.cjs +7 -0
- package/dist/providers/UnsavedChangesGuardProvider/unsavedChangesGuard.constants.cjs.map +1 -0
- package/dist/providers/UnsavedChangesGuardProvider/unsavedChangesGuard.constants.d.ts +3 -0
- package/dist/providers/UnsavedChangesGuardProvider/unsavedChangesGuard.constants.d.ts.map +1 -0
- package/dist/providers/UnsavedChangesGuardProvider/unsavedChangesGuard.constants.js +5 -0
- package/dist/providers/UnsavedChangesGuardProvider/unsavedChangesGuard.constants.js.map +1 -0
- package/dist/providers/UnsavedChangesGuardProvider/unsavedChangesGuard.types.d.ts +21 -0
- package/dist/providers/UnsavedChangesGuardProvider/unsavedChangesGuard.types.d.ts.map +1 -0
- package/dist/providers/UnsavedChangesGuardProvider/utilities/unsavedChangesGuard.utils.cjs +97 -0
- package/dist/providers/UnsavedChangesGuardProvider/utilities/unsavedChangesGuard.utils.cjs.map +1 -0
- package/dist/providers/UnsavedChangesGuardProvider/utilities/unsavedChangesGuard.utils.d.ts +62 -0
- package/dist/providers/UnsavedChangesGuardProvider/utilities/unsavedChangesGuard.utils.d.ts.map +1 -0
- package/dist/providers/UnsavedChangesGuardProvider/utilities/unsavedChangesGuard.utils.js +88 -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/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
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var zod = require('zod');
|
|
4
|
+
var builtInText_utils = require('../../../utilities/__internal__/builtInTextUtils/builtInText.utils.cjs');
|
|
5
|
+
var useSchemaResolver = require('./hooks/useSchemaResolver.cjs');
|
|
6
|
+
|
|
7
|
+
// A decimal amount of zero or more with at most two decimal places, such as 15 or 12.50.
|
|
8
|
+
const AMOUNT = /^\d+(\.\d{1,2})?$/;
|
|
9
|
+
const NUMBER = /^-?\d+(\.\d+)?$/;
|
|
10
|
+
const WHOLE_NUMBER = /^-?\d+$/;
|
|
11
|
+
const DIGITS = /^\d+$/;
|
|
12
|
+
const HEX_COLOUR = /^#[0-9a-f]{6}$/i;
|
|
13
|
+
const HEX_COLOUR_WITH_ALPHA = /^#(?:[0-9a-f]{6}|[0-9a-f]{8})$/i;
|
|
14
|
+
/**
|
|
15
|
+
* Accepts a phone number that is plausible to dial: digits with optional spaces, brackets, dashes and a leading `+`.
|
|
16
|
+
*
|
|
17
|
+
* @param phone The number as typed.
|
|
18
|
+
* @returns `true` when it has 7 to 15 digits and nothing else but those separators.
|
|
19
|
+
*/
|
|
20
|
+
const isPlausiblePhone = (phone) => {
|
|
21
|
+
const digits = phone.replace(/\D/g, '');
|
|
22
|
+
return /^\+?[\d\s()-]+$/.test(phone) && digits.length >= 7 && digits.length <= 15;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Reads a rule's limit and the message for breaking it.
|
|
26
|
+
*
|
|
27
|
+
* @param rule The limit, alone or with its message.
|
|
28
|
+
* @param defaultId The library message shown when the rule names none.
|
|
29
|
+
* @returns The limit and the message to show.
|
|
30
|
+
*/
|
|
31
|
+
const limitOf = (rule, defaultId) => Array.isArray(rule) ? rule : [rule, builtInText_utils.builtInTextTemplate(defaultId)];
|
|
32
|
+
/**
|
|
33
|
+
* Reads the message for an empty field.
|
|
34
|
+
*
|
|
35
|
+
* @param required The field's `required` rule.
|
|
36
|
+
* @param defaultId The library message shown when the rule names none.
|
|
37
|
+
* @returns The message to show, or `undefined` for an optional field.
|
|
38
|
+
*/
|
|
39
|
+
const requiredMessage = (required, defaultId = 'This_field_is_required') => {
|
|
40
|
+
if (typeof required === 'string')
|
|
41
|
+
return required || undefined;
|
|
42
|
+
return required ? builtInText_utils.builtInTextTemplate(defaultId) : undefined;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Adds a rule that an empty value passes: an empty value is `required`'s to report, so the field shows one message and
|
|
46
|
+
* an optional field may stay empty.
|
|
47
|
+
*
|
|
48
|
+
* @param schema The string schema to add the rule to.
|
|
49
|
+
* @param isValid Whether a value that is not empty is acceptable.
|
|
50
|
+
* @param message The message for one that is not.
|
|
51
|
+
* @param params The values the message's placeholders may use.
|
|
52
|
+
* @returns The schema with the rule added.
|
|
53
|
+
*/
|
|
54
|
+
const unlessEmpty = (schema, isValid, message, params) => schema.refine((value) => value === '' || isValid(value), { message, params });
|
|
55
|
+
/**
|
|
56
|
+
* The rules for a text field, such as `FormInput` or `FormTextArea`. Spaces around the value are dropped before the
|
|
57
|
+
* rules run and from the validated value.
|
|
58
|
+
*
|
|
59
|
+
* @param options The rules to apply; a rule given without a message shows the library's default. None makes any text valid.
|
|
60
|
+
* @returns A zod string schema, which takes further zod rules.
|
|
61
|
+
*/
|
|
62
|
+
const text = ({ required, min, max, pattern } = {}) => {
|
|
63
|
+
let schema = zod.z.string().trim();
|
|
64
|
+
const emptyMessage = requiredMessage(required);
|
|
65
|
+
if (emptyMessage)
|
|
66
|
+
schema = schema.min(1, emptyMessage);
|
|
67
|
+
if (min !== undefined) {
|
|
68
|
+
const [limit, message] = limitOf(min, 'Enter_{min}_or_more_characters');
|
|
69
|
+
schema = unlessEmpty(schema, (value) => value.length >= limit, message, { min: limit });
|
|
70
|
+
}
|
|
71
|
+
if (max !== undefined)
|
|
72
|
+
schema = schema.max(...limitOf(max, 'Enter_{max}_characters_or_fewer'));
|
|
73
|
+
if (pattern) {
|
|
74
|
+
const [shape, message] = limitOf(pattern, 'Enter_a_valid_value');
|
|
75
|
+
// A pattern with the `g` or `y` flag starts each test where its last one ended, so it is put back to the start.
|
|
76
|
+
const matches = (value) => {
|
|
77
|
+
shape.lastIndex = 0;
|
|
78
|
+
return shape.test(value);
|
|
79
|
+
};
|
|
80
|
+
schema = unlessEmpty(schema, matches, message);
|
|
81
|
+
}
|
|
82
|
+
return schema;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* The rules for an email address.
|
|
86
|
+
*
|
|
87
|
+
* @param messages `invalid` for a value that is not an email address, and `required` to refuse an empty one; each has a default, and without `required` the field is optional.
|
|
88
|
+
* @returns A zod string schema whose validated value is the trimmed address.
|
|
89
|
+
*/
|
|
90
|
+
const email = ({ required, invalid = builtInText_utils.builtInTextTemplate('Enter_a_valid_email_address') } = {}) => unlessEmpty(text({ required }), (value) => zod.z.email().safeParse(value).success, invalid);
|
|
91
|
+
/**
|
|
92
|
+
* The rules for a web address.
|
|
93
|
+
*
|
|
94
|
+
* @param messages `invalid` for a value that is not an `http` or `https` address, and `required` to refuse an empty one; each has a default, and without `required` the field is optional.
|
|
95
|
+
* @returns A zod string schema whose validated value is the trimmed address.
|
|
96
|
+
*/
|
|
97
|
+
const url = ({ required, invalid = builtInText_utils.builtInTextTemplate('Enter_a_valid_web_address') } = {}) => unlessEmpty(text({ required }), (value) => zod.z.httpUrl().safeParse(value).success, invalid);
|
|
98
|
+
/**
|
|
99
|
+
* The rules for a phone number: 7 to 15 digits, with optional spaces, brackets, dashes and a leading `+`. It checks the
|
|
100
|
+
* number is plausible to dial, not that it exists.
|
|
101
|
+
*
|
|
102
|
+
* @param messages `invalid` for a value that is not such a number, and `required` to refuse an empty one; each has a default, and without `required` the field is optional.
|
|
103
|
+
* @returns A zod string schema whose validated value is the trimmed number, as typed.
|
|
104
|
+
*/
|
|
105
|
+
const phone = ({ required, invalid = builtInText_utils.builtInTextTemplate('Enter_a_valid_phone_number') } = {}) => unlessEmpty(text({ required }), isPlausiblePhone, invalid);
|
|
106
|
+
/**
|
|
107
|
+
* The rules shared by every number typed into a text field: its format first, then the range it must sit in.
|
|
108
|
+
*
|
|
109
|
+
* @param format The shape a value must have to count as a number here.
|
|
110
|
+
* @param formatMessage The message for a value that does not have it.
|
|
111
|
+
* @param options Whether the field is required, and the smallest and largest number allowed.
|
|
112
|
+
* @returns A zod string schema; the validated value stays the text typed.
|
|
113
|
+
*/
|
|
114
|
+
const numeric = (format, formatMessage, { required, min, max }) => {
|
|
115
|
+
let schema = text({ required, pattern: [format, formatMessage] });
|
|
116
|
+
// A value that is not a number is the format's to report, so the range passes it.
|
|
117
|
+
const inRange = (isWithin) => (value) => !format.test(value) || isWithin(Number(value));
|
|
118
|
+
if (min !== undefined) {
|
|
119
|
+
const [limit, message] = limitOf(min, 'Enter_{min}_or_more');
|
|
120
|
+
schema = unlessEmpty(schema, inRange((value) => value >= limit), message, { min: limit });
|
|
121
|
+
}
|
|
122
|
+
if (max !== undefined) {
|
|
123
|
+
const [limit, message] = limitOf(max, 'Enter_{max}_or_less');
|
|
124
|
+
schema = unlessEmpty(schema, inRange((value) => value <= limit), message, { max: limit });
|
|
125
|
+
}
|
|
126
|
+
return schema;
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* The rules for a money amount typed into a text field: zero or more, with at most two decimal places.
|
|
130
|
+
*
|
|
131
|
+
* @param options `invalid` for a value that is not such an amount, the optional `min` and `max` it must sit between, and
|
|
132
|
+
* `required` to refuse an empty value; each message has a default, and without `required` the field is optional.
|
|
133
|
+
* @returns A zod string schema; the validated value stays the text typed, such as `'12.50'`.
|
|
134
|
+
*/
|
|
135
|
+
const amount = ({ invalid = builtInText_utils.builtInTextTemplate('Enter_a_valid_amount'), ...options } = {}) => numeric(AMOUNT, invalid, options);
|
|
136
|
+
/**
|
|
137
|
+
* The rules for a number typed into a text field, such as a quantity or a percentage.
|
|
138
|
+
*
|
|
139
|
+
* @param options `invalid` for a value that is not a number, the optional `min` and `max` it must sit between, `isWhole` to
|
|
140
|
+
* refuse a decimal, and `required` to refuse an empty value; each message has a default, and without `required` the field is optional.
|
|
141
|
+
* @returns A zod string schema; the validated value stays the text typed, so convert it with `Number` when saving.
|
|
142
|
+
*/
|
|
143
|
+
const number = ({ invalid, isWhole = false, ...options } = {}) => numeric(isWhole ? WHOLE_NUMBER : NUMBER, invalid ?? builtInText_utils.builtInTextTemplate(isWhole ? 'Enter_a_whole_number' : 'Enter_a_number'), options);
|
|
144
|
+
/**
|
|
145
|
+
* The rules for a code made only of digits, such as a PIN, a verification code or an account number. Unlike `number`
|
|
146
|
+
* it keeps leading zeros, takes no sign or decimal point, and limits how many digits there are.
|
|
147
|
+
*
|
|
148
|
+
* @param options `invalid` for a value with anything but digits, the `length` it must have or the `min` and `max` digits it
|
|
149
|
+
* may have, and `required` to refuse an empty value; each message has a default, and without `required` the field is optional.
|
|
150
|
+
* @returns A zod string schema; the validated value is the digits as typed.
|
|
151
|
+
*/
|
|
152
|
+
const digits = ({ required, invalid = builtInText_utils.builtInTextTemplate('Enter_digits_only'), length, min, max } = {}) => {
|
|
153
|
+
let schema = text({ required, pattern: [DIGITS, invalid] });
|
|
154
|
+
// A value with something other than digits is `invalid`'s to report, so the counts pass it.
|
|
155
|
+
const counted = (isAllowed) => (value) => !DIGITS.test(value) || isAllowed(value.length);
|
|
156
|
+
const rules = [
|
|
157
|
+
{ rule: length, id: 'Enter_{length}_digits', name: 'length', isAllowed: (count, limit) => count === limit },
|
|
158
|
+
{ rule: min, id: 'Enter_{min}_or_more_characters', name: 'min', isAllowed: (count, limit) => count >= limit },
|
|
159
|
+
{ rule: max, id: 'Enter_{max}_characters_or_fewer', name: 'max', isAllowed: (count, limit) => count <= limit },
|
|
160
|
+
];
|
|
161
|
+
for (const { rule, id, name, isAllowed } of rules) {
|
|
162
|
+
if (rule === undefined)
|
|
163
|
+
continue;
|
|
164
|
+
const [limit, message] = limitOf(rule, id);
|
|
165
|
+
schema = unlessEmpty(schema, counted((count) => isAllowed(count, limit)), message, { [name]: limit });
|
|
166
|
+
}
|
|
167
|
+
return schema;
|
|
168
|
+
};
|
|
169
|
+
/**
|
|
170
|
+
* The rule for a box the user must tick or a switch they must turn on, such as accepting terms with `FormCheckbox`.
|
|
171
|
+
*
|
|
172
|
+
* @param required The message while it is off; the library's default without it.
|
|
173
|
+
* @returns A zod boolean schema, which only `true` passes.
|
|
174
|
+
*/
|
|
175
|
+
const checked = (required = builtInText_utils.builtInTextTemplate('Select_this_box_to_continue')) => zod.z.boolean().refine((value) => value, required);
|
|
176
|
+
const requiredColour = (isColour, required, invalid) =>
|
|
177
|
+
// The message is given to the type check as well: `null` is not a string, and zod's own wording for that is not for users.
|
|
178
|
+
zod.z
|
|
179
|
+
.string(required)
|
|
180
|
+
.min(1, required)
|
|
181
|
+
.refine((value) => !value || isColour(value), invalid);
|
|
182
|
+
const optionalColour = (isColour, invalid) => zod.z
|
|
183
|
+
.string()
|
|
184
|
+
.nullish()
|
|
185
|
+
.refine((value) => !value || isColour(value), invalid);
|
|
186
|
+
/**
|
|
187
|
+
* The rules for a colour held as a hex string, as `FormColorPicker` writes it. A field with no colour is one holding
|
|
188
|
+
* `null`, `undefined` or `''`: the picker writes back whichever of them the form itself uses for an empty field.
|
|
189
|
+
*
|
|
190
|
+
* @param options `required` to refuse a field with no colour, the message for a value that is not a hex colour, and whether a see-through colour passes.
|
|
191
|
+
* @returns A zod schema of a string, which also takes `null` and `undefined` unless the colour is required.
|
|
192
|
+
*/
|
|
193
|
+
const hexColour = (({ required, invalid = builtInText_utils.builtInTextTemplate('Enter_a_valid_colour'), isAlphaAllowed = false, } = {}) => {
|
|
194
|
+
const pattern = isAlphaAllowed ? HEX_COLOUR_WITH_ALPHA : HEX_COLOUR;
|
|
195
|
+
const isColour = (value) => pattern.test(value);
|
|
196
|
+
const emptyMessage = requiredMessage(required);
|
|
197
|
+
return emptyMessage ? requiredColour(isColour, emptyMessage, invalid) : optionalColour(isColour, invalid);
|
|
198
|
+
// The schema follows `required`, which only the two call shapes above can say.
|
|
199
|
+
});
|
|
200
|
+
/**
|
|
201
|
+
* The rules for a date held as an ISO date string (`YYYY-MM-DD`) or `null`, as `FormDatePicker` writes it.
|
|
202
|
+
*
|
|
203
|
+
* @param options `required` to refuse a field with no date, and the optional `min` and `max` it must sit between. A limit
|
|
204
|
+
* may be a function, read at each validation, for one that moves such as today. A default message shows the limit as
|
|
205
|
+
* a date, such as `13 Nov 2026`.
|
|
206
|
+
* @returns A zod schema of a string or `null`.
|
|
207
|
+
*/
|
|
208
|
+
const date = ({ required, min, max } = {}) => {
|
|
209
|
+
const read = (limit) => (typeof limit === 'function' ? limit() : limit);
|
|
210
|
+
let schema = zod.z.string().nullable();
|
|
211
|
+
const emptyMessage = requiredMessage(required);
|
|
212
|
+
if (emptyMessage)
|
|
213
|
+
schema = schema.refine((value) => Boolean(value), emptyMessage);
|
|
214
|
+
const earliest = min && limitOf(min, 'Choose_a_date_on_or_after_{min}');
|
|
215
|
+
const latest = max && limitOf(max, 'Choose_a_date_on_or_before_{max}');
|
|
216
|
+
return schema.superRefine((value, context) => {
|
|
217
|
+
if (!value)
|
|
218
|
+
return;
|
|
219
|
+
// ISO dates of the same length sort as their text. A limit is read here, so one that moves is current.
|
|
220
|
+
// Only the date is compared, of the value and of a limit alike: one given with a time would sort after that same date.
|
|
221
|
+
const from = earliest && read(earliest[0])?.slice(0, 10);
|
|
222
|
+
const to = latest && read(latest[0])?.slice(0, 10);
|
|
223
|
+
const day = value.slice(0, 10);
|
|
224
|
+
if (earliest && from && day < from)
|
|
225
|
+
context.addIssue({ code: 'custom', message: earliest[1], params: { min: from } });
|
|
226
|
+
if (latest && to && day > to)
|
|
227
|
+
context.addIssue({ code: 'custom', message: latest[1], params: { max: to } });
|
|
228
|
+
});
|
|
229
|
+
};
|
|
230
|
+
/**
|
|
231
|
+
* The rules for a field that holds one of a fixed set of ids, such as `FormSelect` or `FormRadioGroup`.
|
|
232
|
+
*
|
|
233
|
+
* @param options Every id the field may hold.
|
|
234
|
+
* @param required The message for a field with no choice, or a value outside `options`; the library's default without it.
|
|
235
|
+
* @returns A zod enum schema, so the validated value is typed as one of `options`.
|
|
236
|
+
*/
|
|
237
|
+
const oneOf = (options, required = builtInText_utils.builtInTextTemplate('Choose_an_option')) => zod.z.enum(options, required);
|
|
238
|
+
/**
|
|
239
|
+
* Adds the size rules of a list that needs at least one entry.
|
|
240
|
+
*
|
|
241
|
+
* @param list The array schema to add the rules to.
|
|
242
|
+
* @param options The message for an empty list, and the most entries allowed.
|
|
243
|
+
* @returns The schema with the rules added.
|
|
244
|
+
*/
|
|
245
|
+
const sized = (list, { required = builtInText_utils.builtInTextTemplate('Choose_at_least_one_option'), max }) => {
|
|
246
|
+
const atLeastOneEntry = list.min(1, required);
|
|
247
|
+
return max === undefined ? atLeastOneEntry : atLeastOneEntry.max(...limitOf(max, 'Choose_{max}_or_fewer'));
|
|
248
|
+
};
|
|
249
|
+
/**
|
|
250
|
+
* The rules for a field that holds a list of any strings and needs at least one entry, such as a `FormMultiSelect`
|
|
251
|
+
* whose items are loaded.
|
|
252
|
+
*
|
|
253
|
+
* @param options `required` for an empty list and the optional `max` entries it may hold; each message has a default.
|
|
254
|
+
* @returns A zod array schema.
|
|
255
|
+
*/
|
|
256
|
+
const atLeastOne = (options = {}) => sized(zod.z.array(zod.z.string()), options);
|
|
257
|
+
/**
|
|
258
|
+
* The rules for a field that holds a list from a fixed set of ids and needs at least one entry, such as
|
|
259
|
+
* `FormCheckboxGroup`.
|
|
260
|
+
*
|
|
261
|
+
* @param ids Every id the list may hold.
|
|
262
|
+
* @param options `required` for an empty list and the optional `max` entries it may hold; each message has a default.
|
|
263
|
+
* @returns A zod array schema, so the validated value is typed as a list of `ids`.
|
|
264
|
+
*/
|
|
265
|
+
const atLeastOneOf = (ids, options = {}) => sized(zod.z.array(zod.z.enum(ids)), options);
|
|
266
|
+
// Marks an issue a cross-field rule raised. A later rule that reads the field it sits on still runs: that field did not fail its own rules.
|
|
267
|
+
const CROSS_FIELD = 'crossField';
|
|
268
|
+
/**
|
|
269
|
+
* Adds the rules that read more than one field, such as a postcode whose shape depends on the country. Each rule runs
|
|
270
|
+
* as soon as the fields it reads are valid: left to itself zod skips it while any field in the form fails, so its
|
|
271
|
+
* error would only show on a second save.
|
|
272
|
+
*
|
|
273
|
+
* @param schema The object schema holding each field's own rules.
|
|
274
|
+
* @param rules The rules to add, in the order they should run.
|
|
275
|
+
* @returns The same schema with the rules applied; its `shape` and value type are unchanged.
|
|
276
|
+
*/
|
|
277
|
+
const crossFieldRules = (schema, ...rules) => rules.reduce((refined, { reads, reportsOn, check }) => {
|
|
278
|
+
const readNames = reads;
|
|
279
|
+
return refined.superRefine((values, context) => {
|
|
280
|
+
const result = check(values);
|
|
281
|
+
if (!result)
|
|
282
|
+
return;
|
|
283
|
+
const { key, values: params } = typeof result === 'string' ? { key: result, values: undefined } : result;
|
|
284
|
+
context.addIssue({ code: 'custom', message: key, path: [reportsOn], params, [CROSS_FIELD]: true });
|
|
285
|
+
},
|
|
286
|
+
// Read from the issues the fields have raised, never by parsing the values again: they are already the fields'
|
|
287
|
+
// output, which a field that transforms its value would reject, and a field with an async rule cannot be parsed in step.
|
|
288
|
+
// An issue with no path is the object's own, such as a nested group that is missing: there are no fields to read.
|
|
289
|
+
{
|
|
290
|
+
when: ({ issues }) => !issues.some((issue) => !(CROSS_FIELD in issue) && (!issue.path?.length || readNames.includes(issue.path[0]))),
|
|
291
|
+
});
|
|
292
|
+
}, schema);
|
|
293
|
+
|
|
294
|
+
exports.useSchemaResolver = useSchemaResolver.useSchemaResolver;
|
|
295
|
+
exports.amount = amount;
|
|
296
|
+
exports.atLeastOne = atLeastOne;
|
|
297
|
+
exports.atLeastOneOf = atLeastOneOf;
|
|
298
|
+
exports.checked = checked;
|
|
299
|
+
exports.crossFieldRules = crossFieldRules;
|
|
300
|
+
exports.date = date;
|
|
301
|
+
exports.digits = digits;
|
|
302
|
+
exports.email = email;
|
|
303
|
+
exports.hexColour = hexColour;
|
|
304
|
+
exports.number = number;
|
|
305
|
+
exports.oneOf = oneOf;
|
|
306
|
+
exports.phone = phone;
|
|
307
|
+
exports.text = text;
|
|
308
|
+
exports.url = url;
|
|
309
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../../src/components/forms/validation/index.ts"],"sourcesContent":[null],"names":["builtInTextTemplate","z"],"mappings":";;;;;;AAoFA;AACA,MAAM,MAAM,GAAG,mBAAmB;AAClC,MAAM,MAAM,GAAG,iBAAiB;AAChC,MAAM,YAAY,GAAG,SAAS;AAC9B,MAAM,MAAM,GAAG,OAAO;AACtB,MAAM,UAAU,GAAG,iBAAiB;AACpC,MAA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IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,KACf,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,KAAK,EAAE,WAAW,IAAI,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,IAAI,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAgB,CAAC,CAAC,CAAC;AAChI,KAAA,CACF;AACH,CAAC,EAAE,MAAM;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { MessageValues } from './validation.types';
|
|
3
|
+
export { useSchemaResolver } from './hooks/useSchemaResolver';
|
|
4
|
+
export type { MessageValues, Translate } from './validation.types';
|
|
5
|
+
/**
|
|
6
|
+
* A rule's limit: the limit alone, which shows the library's default message, or the limit with the message to show, a
|
|
7
|
+
* translation key or the text itself. A message may name the limit with a placeholder, `{min}` or `{max}`.
|
|
8
|
+
*/
|
|
9
|
+
export type RuleLimit<TLimit> = TLimit | readonly [limit: TLimit, message: string];
|
|
10
|
+
/**
|
|
11
|
+
* Whether a field must be filled: `true` shows the library's default message for an empty one, and a string is the
|
|
12
|
+
* message to show, a translation key or the text itself. Without it the field is optional.
|
|
13
|
+
*/
|
|
14
|
+
export type RequiredRule = boolean | string;
|
|
15
|
+
export interface TextRuleOptions {
|
|
16
|
+
/** Makes the field required. Without it the field is optional, and its other rules pass while it is empty. */
|
|
17
|
+
required?: RequiredRule;
|
|
18
|
+
/** The fewest characters a value may have. */
|
|
19
|
+
min?: RuleLimit<number>;
|
|
20
|
+
/** The most characters a value may have. */
|
|
21
|
+
max?: RuleLimit<number>;
|
|
22
|
+
/** The shape a value must have. */
|
|
23
|
+
pattern?: RuleLimit<RegExp>;
|
|
24
|
+
}
|
|
25
|
+
/** The messages of a rule that checks a value's format. */
|
|
26
|
+
export interface FormatRuleMessages {
|
|
27
|
+
/** Makes the field required. Without it the field is optional. */
|
|
28
|
+
required?: RequiredRule;
|
|
29
|
+
/** The message for a value in the wrong format; the library's default without it. */
|
|
30
|
+
invalid?: string;
|
|
31
|
+
}
|
|
32
|
+
export interface NumberRuleOptions extends FormatRuleMessages {
|
|
33
|
+
/** The smallest number allowed. */
|
|
34
|
+
min?: RuleLimit<number>;
|
|
35
|
+
/** The largest number allowed. */
|
|
36
|
+
max?: RuleLimit<number>;
|
|
37
|
+
/** Whether a decimal is refused, as for a quantity. */
|
|
38
|
+
isWhole?: boolean;
|
|
39
|
+
}
|
|
40
|
+
/** The rules of a money amount: those of a number, without the choice of whole numbers. */
|
|
41
|
+
export type AmountRuleOptions = Omit<NumberRuleOptions, 'isWhole'>;
|
|
42
|
+
export interface DigitsRuleOptions extends FormatRuleMessages {
|
|
43
|
+
/** The exact number of digits a value must have, as a PIN or a verification code does. */
|
|
44
|
+
length?: RuleLimit<number>;
|
|
45
|
+
/** The fewest digits a value may have. */
|
|
46
|
+
min?: RuleLimit<number>;
|
|
47
|
+
/** The most digits a value may have. */
|
|
48
|
+
max?: RuleLimit<number>;
|
|
49
|
+
}
|
|
50
|
+
export interface ListRuleOptions {
|
|
51
|
+
/** The message for an empty list; the library's default without it. */
|
|
52
|
+
required?: string;
|
|
53
|
+
/** The most entries the list may hold. */
|
|
54
|
+
max?: RuleLimit<number>;
|
|
55
|
+
}
|
|
56
|
+
export interface DateRuleOptions {
|
|
57
|
+
/** Makes the field required. Without it the field is optional. */
|
|
58
|
+
required?: RequiredRule;
|
|
59
|
+
/** The earliest date allowed, as an ISO date string or a function returning one; `{min}` in the message is that date. */
|
|
60
|
+
min?: RuleLimit<string | (() => string)>;
|
|
61
|
+
/** The latest date allowed, as an ISO date string or a function returning one; `{max}` in the message is that date. */
|
|
62
|
+
max?: RuleLimit<string | (() => string)>;
|
|
63
|
+
}
|
|
64
|
+
export interface HexColourRuleOptions {
|
|
65
|
+
/** Makes the field required. Without it the field is optional, for a colour the user may remove. */
|
|
66
|
+
required?: RequiredRule;
|
|
67
|
+
/** The message for a value that is not a hex colour; the library's default without it. */
|
|
68
|
+
invalid?: string;
|
|
69
|
+
/** Accepts the eight-digit form the picker writes for a see-through colour; by default only a solid, six-digit colour passes. */
|
|
70
|
+
isAlphaAllowed?: boolean;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* The rules for a text field, such as `FormInput` or `FormTextArea`. Spaces around the value are dropped before the
|
|
74
|
+
* rules run and from the validated value.
|
|
75
|
+
*
|
|
76
|
+
* @param options The rules to apply; a rule given without a message shows the library's default. None makes any text valid.
|
|
77
|
+
* @returns A zod string schema, which takes further zod rules.
|
|
78
|
+
*/
|
|
79
|
+
export declare const text: ({ required, min, max, pattern }?: TextRuleOptions) => z.ZodString;
|
|
80
|
+
/**
|
|
81
|
+
* The rules for an email address.
|
|
82
|
+
*
|
|
83
|
+
* @param messages `invalid` for a value that is not an email address, and `required` to refuse an empty one; each has a default, and without `required` the field is optional.
|
|
84
|
+
* @returns A zod string schema whose validated value is the trimmed address.
|
|
85
|
+
*/
|
|
86
|
+
export declare const email: ({ required, invalid }?: FormatRuleMessages) => z.ZodString;
|
|
87
|
+
/**
|
|
88
|
+
* The rules for a web address.
|
|
89
|
+
*
|
|
90
|
+
* @param messages `invalid` for a value that is not an `http` or `https` address, and `required` to refuse an empty one; each has a default, and without `required` the field is optional.
|
|
91
|
+
* @returns A zod string schema whose validated value is the trimmed address.
|
|
92
|
+
*/
|
|
93
|
+
export declare const url: ({ required, invalid }?: FormatRuleMessages) => z.ZodString;
|
|
94
|
+
/**
|
|
95
|
+
* The rules for a phone number: 7 to 15 digits, with optional spaces, brackets, dashes and a leading `+`. It checks the
|
|
96
|
+
* number is plausible to dial, not that it exists.
|
|
97
|
+
*
|
|
98
|
+
* @param messages `invalid` for a value that is not such a number, and `required` to refuse an empty one; each has a default, and without `required` the field is optional.
|
|
99
|
+
* @returns A zod string schema whose validated value is the trimmed number, as typed.
|
|
100
|
+
*/
|
|
101
|
+
export declare const phone: ({ required, invalid }?: FormatRuleMessages) => z.ZodString;
|
|
102
|
+
/**
|
|
103
|
+
* The rules for a money amount typed into a text field: zero or more, with at most two decimal places.
|
|
104
|
+
*
|
|
105
|
+
* @param options `invalid` for a value that is not such an amount, the optional `min` and `max` it must sit between, and
|
|
106
|
+
* `required` to refuse an empty value; each message has a default, and without `required` the field is optional.
|
|
107
|
+
* @returns A zod string schema; the validated value stays the text typed, such as `'12.50'`.
|
|
108
|
+
*/
|
|
109
|
+
export declare const amount: ({ invalid, ...options }?: AmountRuleOptions) => z.ZodString;
|
|
110
|
+
/**
|
|
111
|
+
* The rules for a number typed into a text field, such as a quantity or a percentage.
|
|
112
|
+
*
|
|
113
|
+
* @param options `invalid` for a value that is not a number, the optional `min` and `max` it must sit between, `isWhole` to
|
|
114
|
+
* refuse a decimal, and `required` to refuse an empty value; each message has a default, and without `required` the field is optional.
|
|
115
|
+
* @returns A zod string schema; the validated value stays the text typed, so convert it with `Number` when saving.
|
|
116
|
+
*/
|
|
117
|
+
export declare const number: ({ invalid, isWhole, ...options }?: NumberRuleOptions) => z.ZodString;
|
|
118
|
+
/**
|
|
119
|
+
* The rules for a code made only of digits, such as a PIN, a verification code or an account number. Unlike `number`
|
|
120
|
+
* it keeps leading zeros, takes no sign or decimal point, and limits how many digits there are.
|
|
121
|
+
*
|
|
122
|
+
* @param options `invalid` for a value with anything but digits, the `length` it must have or the `min` and `max` digits it
|
|
123
|
+
* may have, and `required` to refuse an empty value; each message has a default, and without `required` the field is optional.
|
|
124
|
+
* @returns A zod string schema; the validated value is the digits as typed.
|
|
125
|
+
*/
|
|
126
|
+
export declare const digits: ({ required, invalid, length, min, max }?: DigitsRuleOptions) => z.ZodString;
|
|
127
|
+
/**
|
|
128
|
+
* The rule for a box the user must tick or a switch they must turn on, such as accepting terms with `FormCheckbox`.
|
|
129
|
+
*
|
|
130
|
+
* @param required The message while it is off; the library's default without it.
|
|
131
|
+
* @returns A zod boolean schema, which only `true` passes.
|
|
132
|
+
*/
|
|
133
|
+
export declare const checked: (required?: string) => z.ZodBoolean;
|
|
134
|
+
declare const requiredColour: (isColour: (value: string) => boolean, required: string, invalid: string) => z.ZodString;
|
|
135
|
+
declare const optionalColour: (isColour: (value: string) => boolean, invalid: string) => z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
136
|
+
type KnownMessage<TMessage extends string> = string extends TMessage ? never : Exclude<TMessage, ''>;
|
|
137
|
+
/** `hexColour`'s two shapes: a colour the call itself makes required is a string, and any other may also be `null` or `undefined`. */
|
|
138
|
+
interface HexColourRule {
|
|
139
|
+
<TMessage extends string>(options: Omit<HexColourRuleOptions, 'required'> & {
|
|
140
|
+
required: true | (TMessage & KnownMessage<TMessage>);
|
|
141
|
+
}): ReturnType<typeof requiredColour>;
|
|
142
|
+
(options?: HexColourRuleOptions): ReturnType<typeof optionalColour>;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* The rules for a colour held as a hex string, as `FormColorPicker` writes it. A field with no colour is one holding
|
|
146
|
+
* `null`, `undefined` or `''`: the picker writes back whichever of them the form itself uses for an empty field.
|
|
147
|
+
*
|
|
148
|
+
* @param options `required` to refuse a field with no colour, the message for a value that is not a hex colour, and whether a see-through colour passes.
|
|
149
|
+
* @returns A zod schema of a string, which also takes `null` and `undefined` unless the colour is required.
|
|
150
|
+
*/
|
|
151
|
+
export declare const hexColour: HexColourRule;
|
|
152
|
+
/**
|
|
153
|
+
* The rules for a date held as an ISO date string (`YYYY-MM-DD`) or `null`, as `FormDatePicker` writes it.
|
|
154
|
+
*
|
|
155
|
+
* @param options `required` to refuse a field with no date, and the optional `min` and `max` it must sit between. A limit
|
|
156
|
+
* may be a function, read at each validation, for one that moves such as today. A default message shows the limit as
|
|
157
|
+
* a date, such as `13 Nov 2026`.
|
|
158
|
+
* @returns A zod schema of a string or `null`.
|
|
159
|
+
*/
|
|
160
|
+
export declare const date: ({ required, min, max }?: DateRuleOptions) => z.ZodNullable<z.ZodString>;
|
|
161
|
+
/**
|
|
162
|
+
* The rules for a field that holds one of a fixed set of ids, such as `FormSelect` or `FormRadioGroup`.
|
|
163
|
+
*
|
|
164
|
+
* @param options Every id the field may hold.
|
|
165
|
+
* @param required The message for a field with no choice, or a value outside `options`; the library's default without it.
|
|
166
|
+
* @returns A zod enum schema, so the validated value is typed as one of `options`.
|
|
167
|
+
*/
|
|
168
|
+
export declare const oneOf: <const TOptions extends readonly [string, ...string[]]>(options: TOptions, required?: string) => z.ZodEnum<{ [k_1 in TOptions[number]]: k_1; } extends infer T ? { [k in keyof T]: T[k]; } : never>;
|
|
169
|
+
/**
|
|
170
|
+
* The rules for a field that holds a list of any strings and needs at least one entry, such as a `FormMultiSelect`
|
|
171
|
+
* whose items are loaded.
|
|
172
|
+
*
|
|
173
|
+
* @param options `required` for an empty list and the optional `max` entries it may hold; each message has a default.
|
|
174
|
+
* @returns A zod array schema.
|
|
175
|
+
*/
|
|
176
|
+
export declare const atLeastOne: (options?: ListRuleOptions) => z.ZodArray<z.ZodString>;
|
|
177
|
+
/**
|
|
178
|
+
* The rules for a field that holds a list from a fixed set of ids and needs at least one entry, such as
|
|
179
|
+
* `FormCheckboxGroup`.
|
|
180
|
+
*
|
|
181
|
+
* @param ids Every id the list may hold.
|
|
182
|
+
* @param options `required` for an empty list and the optional `max` entries it may hold; each message has a default.
|
|
183
|
+
* @returns A zod array schema, so the validated value is typed as a list of `ids`.
|
|
184
|
+
*/
|
|
185
|
+
export declare const atLeastOneOf: <const TOptions extends readonly [string, ...string[]]>(ids: TOptions, options?: ListRuleOptions) => z.ZodArray<z.ZodEnum<{ [k_1 in TOptions[number]]: k_1; } extends infer T ? { [k in keyof T]: T[k]; } : never>>;
|
|
186
|
+
/** A cross-field rule's message with the values for its placeholders. */
|
|
187
|
+
export interface CrossFieldMessage {
|
|
188
|
+
/** The message: a translation key, or the text itself. */
|
|
189
|
+
key: string;
|
|
190
|
+
/** The value for each `{name}` placeholder in the message. */
|
|
191
|
+
values: MessageValues;
|
|
192
|
+
}
|
|
193
|
+
export interface CrossFieldRule<TSchema extends z.ZodObject> {
|
|
194
|
+
/** The fields the rule reads. It runs once these are valid, whatever else in the form is wrong. */
|
|
195
|
+
reads: readonly (keyof z.output<TSchema> & string)[];
|
|
196
|
+
/** The field the error is shown on: the one the user changes to fix it. */
|
|
197
|
+
reportsOn: keyof z.output<TSchema> & string;
|
|
198
|
+
/**
|
|
199
|
+
* Returns the message to show, or `undefined` when the fields agree; `{ key, values }` for a message with
|
|
200
|
+
* placeholders. Only the fields in `reads` are sure to be valid.
|
|
201
|
+
*/
|
|
202
|
+
check: (values: z.output<TSchema>) => string | CrossFieldMessage | undefined;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Adds the rules that read more than one field, such as a postcode whose shape depends on the country. Each rule runs
|
|
206
|
+
* as soon as the fields it reads are valid: left to itself zod skips it while any field in the form fails, so its
|
|
207
|
+
* error would only show on a second save.
|
|
208
|
+
*
|
|
209
|
+
* @param schema The object schema holding each field's own rules.
|
|
210
|
+
* @param rules The rules to add, in the order they should run.
|
|
211
|
+
* @returns The same schema with the rules applied; its `shape` and value type are unchanged.
|
|
212
|
+
*/
|
|
213
|
+
export declare const crossFieldRules: <TSchema extends z.ZodObject>(schema: TSchema, ...rules: CrossFieldRule<TSchema>[]) => TSchema;
|
|
214
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/validation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEnE;;;GAGG;AACH,MAAM,MAAM,SAAS,CAAC,MAAM,IAAI,MAAM,GAA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