@flipdish/ui-library 0.51.0 → 0.53.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/useSaveForm/useSaveForm.cjs +93 -0
- package/dist/components/forms/Form/hooks/useSaveForm/useSaveForm.cjs.map +1 -0
- package/dist/components/forms/Form/hooks/useSaveForm/useSaveForm.d.ts +54 -0
- package/dist/components/forms/Form/hooks/useSaveForm/useSaveForm.d.ts.map +1 -0
- package/dist/components/forms/Form/hooks/useSaveForm/useSaveForm.js +91 -0
- package/dist/components/forms/Form/hooks/useSaveForm/useSaveForm.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 +63 -0
- package/dist/components/forms/Form/index.cjs.map +1 -0
- package/dist/components/forms/Form/index.d.ts +37 -0
- package/dist/components/forms/Form/index.d.ts.map +1 -0
- package/dist/components/forms/Form/index.js +59 -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 +56 -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/FormSaveErrorAlert/index.cjs +28 -0
- package/dist/components/forms/FormSaveErrorAlert/index.cjs.map +1 -0
- package/dist/components/forms/FormSaveErrorAlert/index.d.ts +18 -0
- package/dist/components/forms/FormSaveErrorAlert/index.d.ts.map +1 -0
- package/dist/components/forms/FormSaveErrorAlert/index.js +26 -0
- package/dist/components/forms/FormSaveErrorAlert/index.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/FormUnsavedChangesModal/index.cjs +24 -0
- package/dist/components/forms/FormUnsavedChangesModal/index.cjs.map +1 -0
- package/dist/components/forms/FormUnsavedChangesModal/index.d.ts +14 -0
- package/dist/components/forms/FormUnsavedChangesModal/index.d.ts.map +1 -0
- package/dist/components/forms/FormUnsavedChangesModal/index.js +22 -0
- package/dist/components/forms/FormUnsavedChangesModal/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 +147 -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 +145 -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/fieldDependents.utils.cjs +47 -0
- package/dist/components/forms/__internal__/formField/utilities/fieldDependents.utils.cjs.map +1 -0
- package/dist/components/forms/__internal__/formField/utilities/fieldDependents.utils.d.ts +26 -0
- package/dist/components/forms/__internal__/formField/utilities/fieldDependents.utils.d.ts.map +1 -0
- package/dist/components/forms/__internal__/formField/utilities/fieldDependents.utils.js +43 -0
- package/dist/components/forms/__internal__/formField/utilities/fieldDependents.utils.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/__internal__/formSubmit/providers/FormSubmit.context.cjs +12 -0
- package/dist/components/forms/__internal__/formSubmit/providers/FormSubmit.context.cjs.map +1 -0
- package/dist/components/forms/__internal__/formSubmit/providers/FormSubmit.context.d.ts +6 -0
- package/dist/components/forms/__internal__/formSubmit/providers/FormSubmit.context.d.ts.map +1 -0
- package/dist/components/forms/__internal__/formSubmit/providers/FormSubmit.context.js +10 -0
- package/dist/components/forms/__internal__/formSubmit/providers/FormSubmit.context.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 +19 -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 +19 -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 +24 -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 +20 -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 +19 -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 +20 -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 +32 -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 +20 -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 +19 -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 +20 -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 +19 -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 +19 -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 +44 -0
- package/dist/components/forms/validation/hooks/useSchemaResolver.cjs.map +1 -0
- package/dist/components/forms/validation/hooks/useSchemaResolver.d.ts +16 -0
- package/dist/components/forms/validation/hooks/useSchemaResolver.d.ts.map +1 -0
- package/dist/components/forms/validation/hooks/useSchemaResolver.js +42 -0
- package/dist/components/forms/validation/hooks/useSchemaResolver.js.map +1 -0
- package/dist/components/forms/validation/index.cjs +413 -0
- package/dist/components/forms/validation/index.cjs.map +1 -0
- package/dist/components/forms/validation/index.d.ts +278 -0
- package/dist/components/forms/validation/index.d.ts.map +1 -0
- package/dist/components/forms/validation/index.js +394 -0
- package/dist/components/forms/validation/index.js.map +1 -0
- package/dist/components/forms/validation/utilities/validation.utils.cjs +72 -0
- package/dist/components/forms/validation/utilities/validation.utils.cjs.map +1 -0
- package/dist/components/forms/validation/utilities/validation.utils.d.ts +38 -0
- package/dist/components/forms/validation/utilities/validation.utils.d.ts.map +1 -0
- package/dist/components/forms/validation/utilities/validation.utils.js +67 -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/hooks/useFocusAfterRetry/index.cjs +7 -3
- package/dist/hooks/useFocusAfterRetry/index.cjs.map +1 -1
- package/dist/hooks/useFocusAfterRetry/index.d.ts +8 -2
- package/dist/hooks/useFocusAfterRetry/index.d.ts.map +1 -1
- package/dist/hooks/useFocusAfterRetry/index.js +7 -3
- package/dist/hooks/useFocusAfterRetry/index.js.map +1 -1
- package/dist/localization/en.json.cjs +117 -0
- package/dist/localization/en.json.cjs.map +1 -0
- package/dist/localization/en.json.js +98 -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/FormSaveErrorAlert/index.d.ts +12 -0
- package/dist/native/components/forms/FormSection/index.d.ts +12 -0
- package/dist/native/components/forms/FormUnsavedChangesModal/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/utilities/colorUtils/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/dist/utilities/colorUtils/index.cjs +24 -0
- package/dist/utilities/colorUtils/index.cjs.map +1 -0
- package/dist/utilities/colorUtils/index.d.ts +8 -0
- package/dist/utilities/colorUtils/index.d.ts.map +1 -0
- package/dist/utilities/colorUtils/index.js +22 -0
- package/dist/utilities/colorUtils/index.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
package/README.md
CHANGED
|
@@ -73,6 +73,7 @@ A handful of components are backed by larger third-party libraries declared as *
|
|
|
73
73
|
| `VerificationCodeInput` | `input-otp` |
|
|
74
74
|
| `CommandMenu` | `react-hotkeys-hook` |
|
|
75
75
|
| `FileUpload`, `SidebarNavigation` | `motion` |
|
|
76
|
+
| `forms/*` (except `FormSection`) | `react-hook-form`; `forms/validation` needs `zod` and `@hookform/resolvers` as well |
|
|
76
77
|
|
|
77
78
|
## Tailwind setup
|
|
78
79
|
|
|
@@ -81,11 +82,11 @@ Import the library's shared runtime from your CSS entry **in this exact layer or
|
|
|
81
82
|
```css
|
|
82
83
|
@layer theme, base, components, utilities;
|
|
83
84
|
|
|
84
|
-
@import
|
|
85
|
-
@import
|
|
86
|
-
@import
|
|
87
|
-
@import
|
|
88
|
-
@import
|
|
85
|
+
@import 'tailwindcss/theme.css' layer(theme);
|
|
86
|
+
@import '@flipdish/ui-tokens/css' layer(theme);
|
|
87
|
+
@import 'tailwindcss/preflight.css' layer(base);
|
|
88
|
+
@import '@flipdish/ui-library/styles';
|
|
89
|
+
@import 'tailwindcss/utilities.css' layer(utilities);
|
|
89
90
|
```
|
|
90
91
|
|
|
91
92
|
## React Native
|
|
@@ -110,7 +111,7 @@ Import paths are identical across platforms — Metro picks the native build via
|
|
|
110
111
|
|
|
111
112
|
```tsx
|
|
112
113
|
// Resolves to the web build under Vite/webpack, the native build under Metro.
|
|
113
|
-
import { Avatar } from
|
|
114
|
+
import { Avatar } from '@flipdish/ui-library/components/atoms/Avatar';
|
|
114
115
|
```
|
|
115
116
|
|
|
116
117
|
> `react-native >= 0.81` is load-bearing, not just a version floor. Every public subpath of
|
|
@@ -128,15 +129,15 @@ In your app's `global.css` — the file you import from your root component and
|
|
|
128
129
|
[`withNativewind`](https://www.nativewind.dev/v5/api/with-nativewind) at in `metro.config.js`:
|
|
129
130
|
|
|
130
131
|
```css
|
|
131
|
-
@import
|
|
132
|
-
@import
|
|
133
|
-
@import
|
|
132
|
+
@import 'tailwindcss/theme.css' layer(theme);
|
|
133
|
+
@import '@flipdish/ui-tokens/css' layer(theme);
|
|
134
|
+
@import 'tailwindcss/preflight.css' layer(base);
|
|
134
135
|
|
|
135
136
|
/* NativeWind's own theme variables — required by its Metro transformer. */
|
|
136
|
-
@import
|
|
137
|
+
@import 'nativewind/theme';
|
|
137
138
|
|
|
138
|
-
@import
|
|
139
|
-
@import
|
|
139
|
+
@import '@flipdish/ui-library/styles.native';
|
|
140
|
+
@import 'tailwindcss/utilities.css';
|
|
140
141
|
```
|
|
141
142
|
|
|
142
143
|
`styles.native` contributes exactly one thing: `@source "./native"`, which tells Tailwind to
|
|
@@ -199,8 +200,8 @@ Then add it to your PostCSS config:
|
|
|
199
200
|
|
|
200
201
|
```js
|
|
201
202
|
// postcss.config.mjs
|
|
202
|
-
import prefixSelector from
|
|
203
|
-
import { createScopedPrefixTransform } from
|
|
203
|
+
import prefixSelector from 'postcss-prefix-selector';
|
|
204
|
+
import { createScopedPrefixTransform } from '@flipdish/ui-library/utilities/cssScopeUtils';
|
|
204
205
|
|
|
205
206
|
// Your Portal microFrontendWindowName; must match <UIProvider scopeId="sale-service">.
|
|
206
207
|
const SCOPE = '[data-mfe-scope="sale-service"]';
|
|
@@ -228,8 +229,8 @@ Tailwind's output becomes plain `[data-mfe-scope="sale-service"] .px-4 { … }`,
|
|
|
228
229
|
| `matchRootElement` | `boolean` | `true` | Also emit a compound selector so the scope root itself matches class and attribute selectors; `[data-theme="dark"]` on the themed root needs it. |
|
|
229
230
|
|
|
230
231
|
```js
|
|
231
|
-
createScopedPrefixTransform(
|
|
232
|
-
shouldScope: (file) => !file || !file.includes(
|
|
232
|
+
createScopedPrefixTransform('[data-tailwind]', {
|
|
233
|
+
shouldScope: (file) => !file || !file.includes('node_modules'),
|
|
233
234
|
scopeBody: true,
|
|
234
235
|
});
|
|
235
236
|
```
|
|
@@ -33,7 +33,9 @@ const Checkbox = ({ label, hint, size = 'sm', className, 'data-testid': dataTest
|
|
|
33
33
|
const isReadOnly = (isStandaloneInGroup && groupState?.isReadOnly) || ariaCheckboxProps.isReadOnly;
|
|
34
34
|
const isGroupOption = !dataTestId && group && value !== undefined;
|
|
35
35
|
const checkboxTestId = isGroupOption ? testIdUtils.joinTestId(group.testIdPrefix, `option-${testIdUtils.slugifyTestId(value)}`) : fallbackTestId;
|
|
36
|
-
const checkbox = (jsxRuntime.jsx(reactAriaComponents.Checkbox, { ...ariaCheckboxProps,
|
|
36
|
+
const checkbox = (jsxRuntime.jsx(reactAriaComponents.Checkbox, { ...ariaCheckboxProps,
|
|
37
|
+
// Each box resolves this by itself and would fall back to the browser's own check, whatever its group asked for (react-aria-components 1.19).
|
|
38
|
+
validationBehavior: ariaCheckboxProps.validationBehavior ?? group?.validationBehavior, isDisabled: isDisabled, isReadOnly: isReadOnly, "data-testid": checkboxTestId, className: (state) => cx.cx('relative flex items-start', state.isDisabled && 'cursor-not-allowed', selectionControl_styles.selectionControlSizes[size].root, typeof className === 'function' ? className(state) : className), children: ({ isSelected, isIndeterminate, isDisabled, isFocusVisible }) => (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(CheckboxBase, { size: size, isSelected: isSelected, isIndeterminate: isIndeterminate, isDisabled: isDisabled, isFocusVisible: isFocusVisible, className: label || hint ? 'mt-0.5' : '' }), (label || hint) && (jsxRuntime.jsxs("div", { className: cx.cx('inline-flex flex-col', selectionControl_styles.selectionControlSizes[size].textWrapper), children: [label && jsxRuntime.jsx("p", { className: cx.cx('text-secondary select-none', selectionControl_styles.selectionControlSizes[size].label), children: label }), hint && (
|
|
37
39
|
// biome-ignore lint/a11y/noStaticElementInteractions: not independently interactive — only stops the click reaching outer React handlers, see below
|
|
38
40
|
// biome-ignore lint/a11y/useKeyWithClickEvents: same as above, no keyboard equivalent needed
|
|
39
41
|
jsxRuntime.jsx("span", { className: cx.cx('text-tertiary', selectionControl_styles.selectionControlSizes[size].hint), onClick: (event) => {
|
|
@@ -57,7 +59,7 @@ Checkbox.displayName = 'Checkbox';
|
|
|
57
59
|
/** Wrapper around react-aria-components' `CheckboxGroup` that names a set of `Checkbox` children, holds their ticked values as a list, and shows one hint or error for the set. */
|
|
58
60
|
const CheckboxGroup = ({ children, label, hint, size = 'sm', className, 'data-testid': dataTestId, ...props }) => {
|
|
59
61
|
const rootTestId = testIdUtils.useResolvedTestId({ testId: dataTestId, segment: 'checkbox-group', rootName: 'checkbox-group' });
|
|
60
|
-
return (jsxRuntime.jsx(CheckboxGroupContext.Provider, { value: { size, testIdPrefix: rootTestId }, children: jsxRuntime.jsx(reactAriaComponents.CheckboxGroup, { ...props, "data-testid": rootTestId, className: cx.cx('flex flex-col gap-3', className), children: ({ isInvalid, isRequired }) => (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [label && (jsxRuntime.jsx(Input.Label, { isRequired: isRequired, isInvalid: isInvalid, children: label })), children, hint && jsxRuntime.jsx(Input.HintText, { isInvalid: isInvalid, children: hint })] })) }) }));
|
|
62
|
+
return (jsxRuntime.jsx(CheckboxGroupContext.Provider, { value: { size, testIdPrefix: rootTestId, validationBehavior: props.validationBehavior }, children: jsxRuntime.jsx(reactAriaComponents.CheckboxGroup, { ...props, "data-testid": rootTestId, className: cx.cx('flex flex-col gap-3', className), children: ({ isInvalid, isRequired }) => (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [label && (jsxRuntime.jsx(Input.Label, { isRequired: isRequired, isInvalid: isInvalid, children: label })), children, hint && jsxRuntime.jsx(Input.HintText, { isInvalid: isInvalid, children: hint })] })) }) }));
|
|
61
63
|
};
|
|
62
64
|
CheckboxGroup.displayName = 'CheckboxGroup';
|
|
63
65
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../../src/components/atoms/Checkbox/index.tsx"],"sourcesContent":[null],"names":["createContext","_jsxs","cx","_jsx","useContext","CheckboxGroupStateContext","useResolvedTestId","joinTestId","slugifyTestId","AriaCheckbox","selectionControlSizes","_Fragment","AriaCheckboxGroup","Label","HintText"],"mappings":";;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../../src/components/atoms/Checkbox/index.tsx"],"sourcesContent":[null],"names":["createContext","_jsxs","cx","_jsx","useContext","CheckboxGroupStateContext","useResolvedTestId","joinTestId","slugifyTestId","AriaCheckbox","selectionControlSizes","_Fragment","AriaCheckboxGroup","Label","HintText"],"mappings":";;;;;;;;;;AAqBA,MAAM,oBAAoB,GAAGA,mBAAa,CAAkC,IAAI,CAAC;AAiBjF;MACa,YAAY,GAAG,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,eAAe,EAAE,IAAI,GAAG,IAAI,EAAE,cAAc,GAAG,KAAK,EAAqB,KAAI;AAC7I,IAAA,QACEC,eAAA,CAAA,KAAA,EAAA,EACE,SAAS,EAAEC,KAAE,CACX,4IAA4I,EAC5I,IAAI,KAAK,IAAI,IAAI,mBAAmB,EACpC,CAAC,UAAU,IAAI,eAAe,KAAK,iCAAiC,EACpE,UAAU,IAAI,+BAA+B,EAC7C,UAAU,IAAI,EAAE,U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AS,CAAC;IACpB,yFAAyF;IACzF,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,gHAAgH;IAChH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,2FAA2F;IAC3F,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACnB,mDAAmD;IACnD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4HAA4H;IAC5H,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,mLAAmL;AACnL,eAAO,MAAM,aAAa;sFAA4F,kBAAkB;;CAqBvI,CAAC"}
|
|
@@ -31,7 +31,9 @@ const Checkbox = ({ label, hint, size = 'sm', className, 'data-testid': dataTest
|
|
|
31
31
|
const isReadOnly = (isStandaloneInGroup && groupState?.isReadOnly) || ariaCheckboxProps.isReadOnly;
|
|
32
32
|
const isGroupOption = !dataTestId && group && value !== undefined;
|
|
33
33
|
const checkboxTestId = isGroupOption ? joinTestId(group.testIdPrefix, `option-${slugifyTestId(value)}`) : fallbackTestId;
|
|
34
|
-
const checkbox = (jsx(Checkbox$1, { ...ariaCheckboxProps,
|
|
34
|
+
const checkbox = (jsx(Checkbox$1, { ...ariaCheckboxProps,
|
|
35
|
+
// Each box resolves this by itself and would fall back to the browser's own check, whatever its group asked for (react-aria-components 1.19).
|
|
36
|
+
validationBehavior: ariaCheckboxProps.validationBehavior ?? group?.validationBehavior, isDisabled: isDisabled, isReadOnly: isReadOnly, "data-testid": checkboxTestId, className: (state) => cx('relative flex items-start', state.isDisabled && 'cursor-not-allowed', selectionControlSizes[size].root, typeof className === 'function' ? className(state) : className), children: ({ isSelected, isIndeterminate, isDisabled, isFocusVisible }) => (jsxs(Fragment, { children: [jsx(CheckboxBase, { size: size, isSelected: isSelected, isIndeterminate: isIndeterminate, isDisabled: isDisabled, isFocusVisible: isFocusVisible, className: label || hint ? 'mt-0.5' : '' }), (label || hint) && (jsxs("div", { className: cx('inline-flex flex-col', selectionControlSizes[size].textWrapper), children: [label && jsx("p", { className: cx('text-secondary select-none', selectionControlSizes[size].label), children: label }), hint && (
|
|
35
37
|
// biome-ignore lint/a11y/noStaticElementInteractions: not independently interactive — only stops the click reaching outer React handlers, see below
|
|
36
38
|
// biome-ignore lint/a11y/useKeyWithClickEvents: same as above, no keyboard equivalent needed
|
|
37
39
|
jsx("span", { className: cx('text-tertiary', selectionControlSizes[size].hint), onClick: (event) => {
|
|
@@ -55,7 +57,7 @@ Checkbox.displayName = 'Checkbox';
|
|
|
55
57
|
/** Wrapper around react-aria-components' `CheckboxGroup` that names a set of `Checkbox` children, holds their ticked values as a list, and shows one hint or error for the set. */
|
|
56
58
|
const CheckboxGroup = ({ children, label, hint, size = 'sm', className, 'data-testid': dataTestId, ...props }) => {
|
|
57
59
|
const rootTestId = useResolvedTestId({ testId: dataTestId, segment: 'checkbox-group', rootName: 'checkbox-group' });
|
|
58
|
-
return (jsx(CheckboxGroupContext.Provider, { value: { size, testIdPrefix: rootTestId }, children: jsx(CheckboxGroup$1, { ...props, "data-testid": rootTestId, className: cx('flex flex-col gap-3', className), children: ({ isInvalid, isRequired }) => (jsxs(Fragment, { children: [label && (jsx(Label, { isRequired: isRequired, isInvalid: isInvalid, children: label })), children, hint && jsx(HintText, { isInvalid: isInvalid, children: hint })] })) }) }));
|
|
60
|
+
return (jsx(CheckboxGroupContext.Provider, { value: { size, testIdPrefix: rootTestId, validationBehavior: props.validationBehavior }, children: jsx(CheckboxGroup$1, { ...props, "data-testid": rootTestId, className: cx('flex flex-col gap-3', className), children: ({ isInvalid, isRequired }) => (jsxs(Fragment, { children: [label && (jsx(Label, { isRequired: isRequired, isInvalid: isInvalid, children: label })), children, hint && jsx(HintText, { isInvalid: isInvalid, children: hint })] })) }) }));
|
|
59
61
|
};
|
|
60
62
|
CheckboxGroup.displayName = 'CheckboxGroup';
|
|
61
63
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/atoms/Checkbox/index.tsx"],"sourcesContent":[null],"names":["_jsxs","_jsx","AriaCheckbox","_Fragment","AriaCheckboxGroup"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/atoms/Checkbox/index.tsx"],"sourcesContent":[null],"names":["_jsxs","_jsx","AriaCheckbox","_Fragment","AriaCheckboxGroup"],"mappings":";;;;;;;;AAqBA,MAAM,oBAAoB,GAAG,aAAa,CAAkC,IAAI,CAAC;AAiBjF;MACa,YAAY,GAAG,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,eAAe,EAAE,IAAI,GAAG,IAAI,EAAE,cAAc,GAAG,KAAK,EAAqB,KAAI;AAC7I,IAAA,QACEA,IAAA,CAAA,KAAA,EAAA,EACE,SAAS,EAAE,EAAE,CACX,4IAA4I,EAC5I,IAAI,KAAK,IAAI,IAAI,mBAAmB,EACpC,CAAC,UAAU,IAAI,eAAe,KAAK,iCAAiC,EACpE,UAAU,IAAI,+BAA+B,EAC7C,UAAU,IAAI,EAAE,UAAU,IAAI,eAAe,CAAC,IAAI,aAAa,EAC/D,cAAc,IAAI,+CAA+C,EACjE,SAAS,CACV,EAAA,QAAA,EAAA,CAEDC,GAAA,CAAA,KAAA,EAAA,EAAA,aAAA,EACc,MAAM,EAClB,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,SAAS,EAAE,EAAE,CACX,uFAAuF,EACvF,IAAI,KAAK,IAAI,IAAI,UAAU,EAC3B,eAAe,IAAI,aAAa,CACjC,EAAA,QAAA,EAEDA,cAAM,CAAC,EAAC,oBAAoB,EAAC,MAAM,EAAC,cAAc,EAAC,WAAW,EAAC,GAAG,EAAC,aAAa,EAAC,OAAO,EAAC,cAAc,EAAC,OAAO,EAAA,CAAG,EAAA,CAC9G,EAENA,GAAA,CAAA,KAAA,EAAA,EAAA,aAAA,EACc,MAAM,EAClB,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,SAAS,EAAE,EAAE,CACX,oFAAoF,EACpF,I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AAA,EAAC,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAA,QAAA,EAChD,KAAK,EAAA,CACA,CACT,EACA,QAAQ,EAER,IAAI,IAAIA,GAAA,CAAC,QAAQ,EAAA,EAAC,SAAS,EAAE,SAAS,EAAA,QAAA,EAAG,IAAI,EAAA,CAAY,CAAA,EAAA,CACzD,CACJ,EAAA,CACiB,EAAA,CACU;AAEpC;AACA,aAAa,CAAC,WAAW,GAAG,eAAe;;"}
|
|
@@ -19,7 +19,7 @@ const styles = cx.sortCx({
|
|
|
19
19
|
*
|
|
20
20
|
* @summary draggable range input for selecting a numeric value
|
|
21
21
|
*/
|
|
22
|
-
const Slider = ({ labelPosition = 'default', minValue = 0, maxValue = 100, label, hint, labelFormatter, formatOptions, className, 'aria-describedby': ariaDescribedBy, 'data-testid': dataTestId, ...rest }) => {
|
|
22
|
+
const Slider = ({ labelPosition = 'default', minValue = 0, maxValue = 100, label, hint, labelFormatter, isInvalid, formatOptions, className, 'aria-describedby': ariaDescribedBy, 'data-testid': dataTestId, ...rest }) => {
|
|
23
23
|
// Format thumb value as percentage by default.
|
|
24
24
|
const defaultFormatOptions = {
|
|
25
25
|
style: 'percent',
|
|
@@ -38,7 +38,7 @@ const Slider = ({ labelPosition = 'default', minValue = 0, maxValue = 100, label
|
|
|
38
38
|
} }), values.map((_, index) => {
|
|
39
39
|
return (jsxRuntime.jsx(reactAriaComponents.SliderThumb
|
|
40
40
|
// biome-ignore lint/suspicious/noArrayIndexKey: static, ordered list of thumbs
|
|
41
|
-
, { index: index, "data-testid": testIdUtils.joinTestId(sliderTestId, `thumb-${index}`), className: ({ isFocusVisible, isDragging }) => cx.cx('top-1/2 box-border size-6 cursor-grab rounded-full bg-slider-handle-bg shadow-md ring-2 ring-slider-handle-border ring-inset', isFocusVisible && 'outline-2 outline-offset-2 outline-focus-ring', isDragging && 'cursor-grabbing'), children: jsxRuntime.jsx(reactAriaComponents.SliderOutput, { className: cx.cx('whitespace-nowrap', styles[labelPosition]), "data-testid": testIdUtils.joinTestId(sliderTestId, `output-${index}`), children: labelFormatter ? labelFormatter(getThumbValue(index)) : getFormattedValue(getThumbValue(index) / 100) }) }, index));
|
|
41
|
+
, { index: index, isInvalid: isInvalid, "data-testid": testIdUtils.joinTestId(sliderTestId, `thumb-${index}`), className: ({ isFocusVisible, isDragging }) => cx.cx('top-1/2 box-border size-6 cursor-grab rounded-full bg-slider-handle-bg shadow-md ring-2 ring-slider-handle-border ring-inset', isFocusVisible && 'outline-2 outline-offset-2 outline-focus-ring', isDragging && 'cursor-grabbing'), children: jsxRuntime.jsx(reactAriaComponents.SliderOutput, { className: cx.cx('whitespace-nowrap', styles[labelPosition]), "data-testid": testIdUtils.joinTestId(sliderTestId, `output-${index}`), children: labelFormatter ? labelFormatter(getThumbValue(index)) : getFormattedValue(getThumbValue(index) / 100) }) }, index));
|
|
42
42
|
})] }));
|
|
43
43
|
} }), hint ? jsxRuntime.jsx(Input.HintText, { id: hintId, children: hint }) : null] }));
|
|
44
44
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../../src/components/atoms/Slider/index.tsx"],"sourcesContent":[null],"names":["sortCx","useResolvedTestId","useId","joinIds","_jsxs","AriaSlider","cx","_jsx","Label","AriaSliderTrack","joinTestId","_Fragment","AriaSliderThumb","AriaSliderOutput","HintText"],"mappings":";;;;;;;;;;AAeA,MAAM,MAAM,GAAGA,SAAM,CAAC;AACpB,IAAA,OAAO,EAAE,QAAQ;AACjB,IAAA,MAAM,EAAE,4FAA4F;AACpG,IAAA,cAAc,EACZ,wKAAwK;AAC3K,CAAA,CAAC;
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../../src/components/atoms/Slider/index.tsx"],"sourcesContent":[null],"names":["sortCx","useResolvedTestId","useId","joinIds","_jsxs","AriaSlider","cx","_jsx","Label","AriaSliderTrack","joinTestId","_Fragment","AriaSliderThumb","AriaSliderOutput","HintText"],"mappings":";;;;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GHC,eAACM,gCAAgB,EAAA,EACf,SAAS,EAAEP,KAAE,CAAC,mBAAmB,EAAE,MAAM,CAAC,aAAa,CAAC,CAAC,EAAA,aAAA,EAC5CI,sBAAU,CAAC,YAAY,EAAE,CAAA,OAAA,EAAU,KAAK,EAAE,CAAC,EAAA,QAAA,EAEvD,cAAc,GAAG,cAAc,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,GAAG,iBAAiB,CAAC,aAAa,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,EAAA,CACrF,IAjBd,KAAK,CAkBM;4BAEtB,CAAC,CAAC,CAAA,EAAA,CACD;gBAEP,CAAC,EAAA,CACe,EACjB,IAAI,GAAGH,cAAA,CAACO,cAAQ,EAAA,EAAC,EAAE,EAAE,MAAM,EAAA,QAAA,EAAG,IAAI,EAAA,CAAY,GAAG,IAAI,CAAA,EAAA,CAC3C;AAEjB;;"}
|
|
@@ -13,6 +13,8 @@ export interface SliderProps extends AriaSliderProps {
|
|
|
13
13
|
hint?: string;
|
|
14
14
|
/** Formats each thumb's value label, replacing the default whole-number percentage. */
|
|
15
15
|
labelFormatter?: (value: number) => string;
|
|
16
|
+
/** Marks each thumb `aria-invalid`, for a value a form has rejected; say why in `hint` or with `aria-describedby`. */
|
|
17
|
+
isInvalid?: boolean;
|
|
16
18
|
/** Overrides the `data-testid` (defaults to `fd-slider`); the track, thumb(s), and output derive their ids from it. */
|
|
17
19
|
'data-testid'?: string;
|
|
18
20
|
}
|
|
@@ -22,6 +24,6 @@ export interface SliderProps extends AriaSliderProps {
|
|
|
22
24
|
*
|
|
23
25
|
* @summary draggable range input for selecting a numeric value
|
|
24
26
|
*/
|
|
25
|
-
export declare const Slider: ({ labelPosition, minValue, maxValue, label, hint, labelFormatter, formatOptions, className, "aria-describedby": ariaDescribedBy, "data-testid": dataTestId, ...rest }: SliderProps) => import("react").JSX.Element;
|
|
27
|
+
export declare const Slider: ({ labelPosition, minValue, maxValue, label, hint, labelFormatter, isInvalid, formatOptions, className, "aria-describedby": ariaDescribedBy, "data-testid": dataTestId, ...rest }: SliderProps) => import("react").JSX.Element;
|
|
26
28
|
export {};
|
|
27
29
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/atoms/Slider/index.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAS5E,QAAA,MAAM,MAAM;;;;CAKV,CAAC;AAEH,MAAM,WAAW,WAAY,SAAQ,eAAe;IAClD,qIAAqI;IACrI,aAAa,CAAC,EAAE,MAAM,OAAO,MAAM,CAAC;IACpC,iHAAiH;IACjH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yIAAyI;IACzI,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uFAAuF;IACvF,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAC3C,uHAAuH;IACvH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;GAKG;AACH,eAAO,MAAM,MAAM,GAAI,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/atoms/Slider/index.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAS5E,QAAA,MAAM,MAAM;;;;CAKV,CAAC;AAEH,MAAM,WAAW,WAAY,SAAQ,eAAe;IAClD,qIAAqI;IACrI,aAAa,CAAC,EAAE,MAAM,OAAO,MAAM,CAAC;IACpC,iHAAiH;IACjH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yIAAyI;IACzI,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uFAAuF;IACvF,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAC3C,sHAAsH;IACtH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,uHAAuH;IACvH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;GAKG;AACH,eAAO,MAAM,MAAM,GAAI,kLAapB,WAAW,gCAwEb,CAAC"}
|
|
@@ -17,7 +17,7 @@ const styles = sortCx({
|
|
|
17
17
|
*
|
|
18
18
|
* @summary draggable range input for selecting a numeric value
|
|
19
19
|
*/
|
|
20
|
-
const Slider = ({ labelPosition = 'default', minValue = 0, maxValue = 100, label, hint, labelFormatter, formatOptions, className, 'aria-describedby': ariaDescribedBy, 'data-testid': dataTestId, ...rest }) => {
|
|
20
|
+
const Slider = ({ labelPosition = 'default', minValue = 0, maxValue = 100, label, hint, labelFormatter, isInvalid, formatOptions, className, 'aria-describedby': ariaDescribedBy, 'data-testid': dataTestId, ...rest }) => {
|
|
21
21
|
// Format thumb value as percentage by default.
|
|
22
22
|
const defaultFormatOptions = {
|
|
23
23
|
style: 'percent',
|
|
@@ -36,7 +36,7 @@ const Slider = ({ labelPosition = 'default', minValue = 0, maxValue = 100, label
|
|
|
36
36
|
} }), values.map((_, index) => {
|
|
37
37
|
return (jsx(SliderThumb
|
|
38
38
|
// biome-ignore lint/suspicious/noArrayIndexKey: static, ordered list of thumbs
|
|
39
|
-
, { index: index, "data-testid": joinTestId(sliderTestId, `thumb-${index}`), className: ({ isFocusVisible, isDragging }) => cx('top-1/2 box-border size-6 cursor-grab rounded-full bg-slider-handle-bg shadow-md ring-2 ring-slider-handle-border ring-inset', isFocusVisible && 'outline-2 outline-offset-2 outline-focus-ring', isDragging && 'cursor-grabbing'), children: jsx(SliderOutput, { className: cx('whitespace-nowrap', styles[labelPosition]), "data-testid": joinTestId(sliderTestId, `output-${index}`), children: labelFormatter ? labelFormatter(getThumbValue(index)) : getFormattedValue(getThumbValue(index) / 100) }) }, index));
|
|
39
|
+
, { index: index, isInvalid: isInvalid, "data-testid": joinTestId(sliderTestId, `thumb-${index}`), className: ({ isFocusVisible, isDragging }) => cx('top-1/2 box-border size-6 cursor-grab rounded-full bg-slider-handle-bg shadow-md ring-2 ring-slider-handle-border ring-inset', isFocusVisible && 'outline-2 outline-offset-2 outline-focus-ring', isDragging && 'cursor-grabbing'), children: jsx(SliderOutput, { className: cx('whitespace-nowrap', styles[labelPosition]), "data-testid": joinTestId(sliderTestId, `output-${index}`), children: labelFormatter ? labelFormatter(getThumbValue(index)) : getFormattedValue(getThumbValue(index) / 100) }) }, index));
|
|
40
40
|
})] }));
|
|
41
41
|
} }), hint ? jsx(HintText, { id: hintId, children: hint }) : null] }));
|
|
42
42
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/atoms/Slider/index.tsx"],"sourcesContent":[null],"names":["_jsxs","AriaSlider","_jsx","AriaSliderTrack","_Fragment","AriaSliderThumb","AriaSliderOutput"],"mappings":";;;;;;;;AAeA,MAAM,MAAM,GAAG,MAAM,CAAC;AACpB,IAAA,OAAO,EAAE,QAAQ;AACjB,IAAA,MAAM,EAAE,4FAA4F;AACpG,IAAA,cAAc,EACZ,wKAAwK;AAC3K,CAAA,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/atoms/Slider/index.tsx"],"sourcesContent":[null],"names":["_jsxs","AriaSlider","_jsx","AriaSliderTrack","_Fragment","AriaSliderThumb","AriaSliderOutput"],"mappings":";;;;;;;;AAeA,MAAM,MAAM,GAAG,MAAM,CAAC;AACpB,IAAA,OAAO,EAAE,QAAQ;AACjB,IAAA,MAAM,EAAE,4FAA4F;AACpG,IAAA,cAAc,EACZ,wKAAwK;AAC3K,CAAA,CAAC;AAiBF;;;;;AAKG;AACI,MAAM,MAAM,GAAG,CAAC,EACrB,aAAa,GAAG,SAAS,EACzB,QAAQ,GAAG,CAAC,EACZ,QAAQ,GAAG,GAAG,EACd,KAAK,EACL,IAAI,EACJ,cAAc,EACd,SAAS,EACT,aAAa,EACb,SAAS,EACT,kBAAkB,EAAE,eAAe,EACn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EAAA,CACe,EACjB,IAAI,GAAGJ,GAAA,CAAC,QAAQ,EAAA,EAAC,EAAE,EAAE,MAAM,EAAA,QAAA,EAAG,IAAI,EAAA,CAAY,GAAG,IAAI,CAAA,EAAA,CAC3C;AAEjB;;"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var reactHookForm = require('react-hook-form');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* react-hook-form's `useForm` with the validation timing the `Form*` fields are built on: errors appear when the user
|
|
7
|
+
* leaves a field, and clear as they fix it. Use it for every form whose fields come from `components/forms`.
|
|
8
|
+
*
|
|
9
|
+
* @param options Every option react-hook-form's `useForm` takes. `mode` and `reValidateMode` default to `'onBlur'`;
|
|
10
|
+
* set either only for a form with none of the library's fields, since theirs validate twice per keystroke otherwise.
|
|
11
|
+
* `shouldFocusError` defaults to `false`: `Form` focuses the first invalid field in page order, where
|
|
12
|
+
* react-hook-form's own choice follows the order the fields mounted in.
|
|
13
|
+
* @returns The form, exactly as react-hook-form returns it, for `Form`'s `form` prop.
|
|
14
|
+
*/
|
|
15
|
+
// biome-ignore lint/suspicious/noExplicitAny: mirrors react-hook-form's own `TContext = any`, so the two signatures stay interchangeable
|
|
16
|
+
const useForm = (options) =>
|
|
17
|
+
// Read one by one, not spread over: an option passed as `undefined` would otherwise switch the default off.
|
|
18
|
+
reactHookForm.useForm({
|
|
19
|
+
...options,
|
|
20
|
+
mode: options?.mode ?? 'onBlur',
|
|
21
|
+
reValidateMode: options?.reValidateMode ?? 'onBlur',
|
|
22
|
+
shouldFocusError: options?.shouldFocusError ?? false,
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
exports.useForm = useForm;
|
|
26
|
+
//# sourceMappingURL=useForm.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useForm.cjs","sources":["../../../../../src/components/forms/Form/hooks/useForm.ts"],"sourcesContent":[null],"names":["useReactHookForm"],"mappings":";;;;AAEA;;;;;;;;;AASG;AACH;AACO,MAAM,OAAO,GAAG,CACrB,OAA6D;AAE7D;AACAA,qBAAgB,CAAwC;AACtD,IAAA,GAAG,OAAO;AACV,IAAA,IAAI,EAAE,OAAO,EAAE,IAAI,IAAI,QAAQ;AAC/B,IAAA,cAAc,EAAE,OAAO,EAAE,cAAc,IAAI,QAAQ;AACnD,IAAA,gBAAgB,EAAE,OAAO,EAAE,gBAAgB,IAAI,KAAK;AACrD,CAAA;;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type FieldValues, type UseFormProps, type UseFormReturn } from 'react-hook-form';
|
|
2
|
+
/**
|
|
3
|
+
* react-hook-form's `useForm` with the validation timing the `Form*` fields are built on: errors appear when the user
|
|
4
|
+
* leaves a field, and clear as they fix it. Use it for every form whose fields come from `components/forms`.
|
|
5
|
+
*
|
|
6
|
+
* @param options Every option react-hook-form's `useForm` takes. `mode` and `reValidateMode` default to `'onBlur'`;
|
|
7
|
+
* set either only for a form with none of the library's fields, since theirs validate twice per keystroke otherwise.
|
|
8
|
+
* `shouldFocusError` defaults to `false`: `Form` focuses the first invalid field in page order, where
|
|
9
|
+
* react-hook-form's own choice follows the order the fields mounted in.
|
|
10
|
+
* @returns The form, exactly as react-hook-form returns it, for `Form`'s `form` prop.
|
|
11
|
+
*/
|
|
12
|
+
export declare const useForm: <TValues extends FieldValues = FieldValues, TContext = any, TTransformedValues = TValues>(options?: UseFormProps<TValues, TContext, TTransformedValues>) => UseFormReturn<TValues, TContext, TTransformedValues>;
|
|
13
|
+
//# sourceMappingURL=useForm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useForm.d.ts","sourceRoot":"","sources":["../../../../../src/components/forms/Form/hooks/useForm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,YAAY,EAAE,KAAK,aAAa,EAA+B,MAAM,iBAAiB,CAAC;AAEvH;;;;;;;;;GASG;AAEH,eAAO,MAAM,OAAO,GAAI,OAAO,SAAS,WAAW,GAAG,WAAW,EAAE,QAAQ,GAAG,GAAG,EAAE,kBAAkB,GAAG,OAAO,EAC7G,UAAU,YAAY,CAAC,OAAO,EAAE,QAAQ,EAAE,kBAAkB,CAAC,KAC5D,aAAa,CAAC,OAAO,EAAE,QAAQ,EAAE,kBAAkB,CAOlD,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { useForm as useForm$1 } from 'react-hook-form';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* react-hook-form's `useForm` with the validation timing the `Form*` fields are built on: errors appear when the user
|
|
5
|
+
* leaves a field, and clear as they fix it. Use it for every form whose fields come from `components/forms`.
|
|
6
|
+
*
|
|
7
|
+
* @param options Every option react-hook-form's `useForm` takes. `mode` and `reValidateMode` default to `'onBlur'`;
|
|
8
|
+
* set either only for a form with none of the library's fields, since theirs validate twice per keystroke otherwise.
|
|
9
|
+
* `shouldFocusError` defaults to `false`: `Form` focuses the first invalid field in page order, where
|
|
10
|
+
* react-hook-form's own choice follows the order the fields mounted in.
|
|
11
|
+
* @returns The form, exactly as react-hook-form returns it, for `Form`'s `form` prop.
|
|
12
|
+
*/
|
|
13
|
+
// biome-ignore lint/suspicious/noExplicitAny: mirrors react-hook-form's own `TContext = any`, so the two signatures stay interchangeable
|
|
14
|
+
const useForm = (options) =>
|
|
15
|
+
// Read one by one, not spread over: an option passed as `undefined` would otherwise switch the default off.
|
|
16
|
+
useForm$1({
|
|
17
|
+
...options,
|
|
18
|
+
mode: options?.mode ?? 'onBlur',
|
|
19
|
+
reValidateMode: options?.reValidateMode ?? 'onBlur',
|
|
20
|
+
shouldFocusError: options?.shouldFocusError ?? false,
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export { useForm };
|
|
24
|
+
//# sourceMappingURL=useForm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useForm.js","sources":["../../../../../src/components/forms/Form/hooks/useForm.ts"],"sourcesContent":[null],"names":["useReactHookForm"],"mappings":";;AAEA;;;;;;;;;AASG;AACH;AACO,MAAM,OAAO,GAAG,CACrB,OAA6D;AAE7D;AACAA,SAAgB,CAAwC;AACtD,IAAA,GAAG,OAAO;AACV,IAAA,IAAI,EAAE,OAAO,EAAE,IAAI,IAAI,QAAQ;AAC/B,IAAA,cAAc,EAAE,OAAO,EAAE,cAAc,IAAI,QAAQ;AACnD,IAAA,gBAAgB,EAAE,OAAO,EAAE,gBAAgB,IAAI,KAAK;AACrD,CAAA;;"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var useForm = require('../useForm.cjs');
|
|
5
|
+
|
|
6
|
+
// A refetch brings newer values: the fields the user has edited keep the draft, the rest follow the server. The errors
|
|
7
|
+
// on screen and the dirty flag stay too, or a refetch would hide a rejection and switch Save off for a moment.
|
|
8
|
+
const FOLLOW_REFETCH = { keepDirtyValues: true, keepErrors: true, keepDirty: true };
|
|
9
|
+
// A save and Discard start the form again: `resetOptions` reaches each `reset` call, and would keep the edits and errors.
|
|
10
|
+
const START_AGAIN = { keepDirtyValues: false, keepErrors: false, keepDirty: false };
|
|
11
|
+
// A mapper written for the server's rejections may not expect a network failure, and one that threw would leave the save in flight for good.
|
|
12
|
+
const rejectedFieldOf = (fieldErrorOf, error) => {
|
|
13
|
+
try {
|
|
14
|
+
return fieldErrorOf?.(error);
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Creates a form that waits on Save, and owns what happens around the save: it starts again from what was saved, keeps
|
|
22
|
+
* a draft through a refetch, holds a refetch that lands mid-save, and reports a failure beside Save or beneath the field
|
|
23
|
+
* the server rejected. Use it in place of `useForm` for a form with `FormFooter`, mounted once per record: give the
|
|
24
|
+
* form's component a `key` of the record's id, so another record never inherits this one's save.
|
|
25
|
+
*
|
|
26
|
+
* @param options Every option this module's `useForm` takes except `resetOptions`, with `save` and `fieldErrorOf`; see
|
|
27
|
+
* `UseSaveFormOptions`. Pass the loaded record as `values`, so the fields the user has not edited follow a refetch.
|
|
28
|
+
* @returns The form and its save state, with one handler per action; see `UseSaveFormReturn`. "Try again" has none:
|
|
29
|
+
* `FormSaveErrorAlert` submits the form itself, as Save does.
|
|
30
|
+
*/
|
|
31
|
+
// biome-ignore lint/suspicious/noExplicitAny: mirrors react-hook-form's own `TContext = any`, so the two signatures stay interchangeable
|
|
32
|
+
const useSaveForm = ({ save, fieldErrorOf, values, ...options }) => {
|
|
33
|
+
const [saveState, setSaveState] = React.useState({ status: 'idle' });
|
|
34
|
+
const isSaving = saveState.status === 'saving';
|
|
35
|
+
const form = useForm.useForm({
|
|
36
|
+
...options,
|
|
37
|
+
// Held while a save is in flight: a refetch landing then would reset the form, which ends the lock on its fields.
|
|
38
|
+
values: isSaving ? undefined : values,
|
|
39
|
+
resetOptions: FOLLOW_REFETCH,
|
|
40
|
+
});
|
|
41
|
+
const { reset, setError, getValues } = form;
|
|
42
|
+
const { isDirty, errors } = form.formState;
|
|
43
|
+
// The saved check ends with the next edit, for good: undoing that edit by hand must not bring it back with nothing saved.
|
|
44
|
+
const hasSaved = saveState.status === 'saved';
|
|
45
|
+
React.useEffect(() => {
|
|
46
|
+
if (isDirty && hasSaved)
|
|
47
|
+
setSaveState({ status: 'idle' });
|
|
48
|
+
}, [isDirty, hasSaved]);
|
|
49
|
+
const rejectedField = saveState.status === 'failed' ? saveState.rejectedField : undefined;
|
|
50
|
+
// Set once the save has settled, not as it fails: the fields are still locked then, and a locked control refuses focus.
|
|
51
|
+
React.useEffect(() => {
|
|
52
|
+
if (rejectedField)
|
|
53
|
+
setError(rejectedField.field, { type: 'server', message: rejectedField.message }, { shouldFocus: true });
|
|
54
|
+
}, [rejectedField, setError]);
|
|
55
|
+
// Awaited by `Form`, so the form counts as submitting until the save lands, which locks its fields.
|
|
56
|
+
const submit = async (submitted) => {
|
|
57
|
+
setSaveState({ status: 'saving' });
|
|
58
|
+
try {
|
|
59
|
+
await save(submitted);
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
return setSaveState({ status: 'failed', error, rejectedField: rejectedFieldOf(fieldErrorOf, error) });
|
|
63
|
+
}
|
|
64
|
+
// What the form holds is what was sent: the resolved value may be any shape, and the saved record arrives through `values`.
|
|
65
|
+
reset(getValues(), START_AGAIN);
|
|
66
|
+
return setSaveState({ status: 'saved' });
|
|
67
|
+
};
|
|
68
|
+
const discard = () => {
|
|
69
|
+
// Mid-save it would end the hold on `values`, and a refetch landing then would unlock the fields.
|
|
70
|
+
if (isSaving)
|
|
71
|
+
return;
|
|
72
|
+
reset(undefined, START_AGAIN);
|
|
73
|
+
setSaveState({ status: 'idle' });
|
|
74
|
+
};
|
|
75
|
+
// Only a failure is dismissed: clearing a save in flight would end the hold on `values` too.
|
|
76
|
+
const dismissSaveError = () => setSaveState((current) => (current.status === 'failed' ? { status: 'idle' } : current));
|
|
77
|
+
const hasErrors = Object.keys(errors).length > 0;
|
|
78
|
+
const hasSaveError = saveState.status === 'failed' && !rejectedField;
|
|
79
|
+
return {
|
|
80
|
+
form,
|
|
81
|
+
submit,
|
|
82
|
+
discard,
|
|
83
|
+
isSaving,
|
|
84
|
+
// The saved check lasts until the next edit, or until an error shows.
|
|
85
|
+
isSaved: hasSaved && !isDirty && !hasErrors,
|
|
86
|
+
hasSaveError,
|
|
87
|
+
saveError: saveState.status === 'failed' && hasSaveError ? saveState.error : undefined,
|
|
88
|
+
dismissSaveError,
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
exports.useSaveForm = useSaveForm;
|
|
93
|
+
//# sourceMappingURL=useSaveForm.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSaveForm.cjs","sources":["../../../../../../src/components/forms/Form/hooks/useSaveForm/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AE,GAAG,OAAO,CAAC,CAAC;AAEtH,IAAA,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,GAAG,CAAC;IAChD,MAAM,YAAY,GAAG,SAAS,CAAC,MAAM,KAAK,QAAQ,IAAI,CAAC,aAAa;IAEpE,OAAO;QACL,IAAI;QACJ,MAAM;QACN,OAAO;QACP,QAAQ;;AAER,QAAA,OAAO,EAAE,QAAQ,IAAI,CAAC,OAAO,IAAI,CAAC,SAAS;QAC3C,YAAY;AACZ,QAAA,SAAS,EAAE,SAAS,CAAC,MAAM,KAAK,QAAQ,IAAI,YAAY,GAAG,SAAS,CAAC,KAAK,GAAG,SAAS;QACtF,gBAAgB;KACjB;AACH;;"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { FieldPath, FieldValues, SubmitHandler, UseFormProps, UseFormReturn } from 'react-hook-form';
|
|
2
|
+
/** A field the server rejected, which the form shows beneath that field in place of a failed-save alert. */
|
|
3
|
+
export interface SaveFieldError<TValues extends FieldValues> {
|
|
4
|
+
/** The rejected field's path in the form values. */
|
|
5
|
+
field: FieldPath<TValues>;
|
|
6
|
+
/** The server's message, shown beneath the field. */
|
|
7
|
+
message: string;
|
|
8
|
+
}
|
|
9
|
+
export interface UseSaveFormOptions<TValues extends FieldValues = FieldValues, TContext = any, TSubmitValues = TValues> extends Omit<UseFormProps<TValues, TContext, TSubmitValues>, 'resetOptions'> {
|
|
10
|
+
/**
|
|
11
|
+
* Sends the validated values, such as a mutation's `mutateAsync`; reject to report a failed save. What it resolves
|
|
12
|
+
* with is not read: the form starts again from what it holds, and a record the server changed on the way in reaches
|
|
13
|
+
* it through `values`. Resolve only once `values` holds the saved record: one that lands mid-save is taken as the
|
|
14
|
+
* saved one when the save succeeds, so a record read before the save would show as saved.
|
|
15
|
+
*/
|
|
16
|
+
save: (values: TSubmitValues) => Promise<unknown>;
|
|
17
|
+
/**
|
|
18
|
+
* Picks the field a failed save rejected, from what `save` rejected with. Return `undefined` for any other failure,
|
|
19
|
+
* and for a field the form does not show: that one is reported as a failed save, since no field can show it. One that
|
|
20
|
+
* throws is treated the same way.
|
|
21
|
+
*/
|
|
22
|
+
fieldErrorOf?: (error: unknown) => SaveFieldError<TValues> | undefined;
|
|
23
|
+
}
|
|
24
|
+
export interface UseSaveFormReturn<TValues extends FieldValues = FieldValues, TContext = any, TSubmitValues = TValues> {
|
|
25
|
+
/** The form, for `Form`'s `form` prop. */
|
|
26
|
+
form: UseFormReturn<TValues, TContext, TSubmitValues>;
|
|
27
|
+
/** Saves the validated values, for `Form`'s `onSubmit`. It never rejects: a failure shows in `hasSaveError` or beneath a field. */
|
|
28
|
+
submit: SubmitHandler<TSubmitValues>;
|
|
29
|
+
/** Puts the form back to what was loaded or last saved and clears a failed save, for `FormFooter`'s `onDiscard`. Ignored while a save is in flight. */
|
|
30
|
+
discard: () => void;
|
|
31
|
+
/** Whether a save is in flight. */
|
|
32
|
+
isSaving: boolean;
|
|
33
|
+
/** Whether the last save succeeded and nothing has changed since, for `FormFooter`'s `isSaved`. */
|
|
34
|
+
isSaved: boolean;
|
|
35
|
+
/** Whether the last save failed outright, which is when to render `FormSaveErrorAlert`. `false` when a field took the rejection. */
|
|
36
|
+
hasSaveError: boolean;
|
|
37
|
+
/** What `save` rejected with while `hasSaveError` is `true`, to read the server's reason from. */
|
|
38
|
+
saveError: unknown;
|
|
39
|
+
/** Clears a failed save, for `FormSaveErrorAlert`'s `onDismiss`. */
|
|
40
|
+
dismissSaveError: () => void;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Creates a form that waits on Save, and owns what happens around the save: it starts again from what was saved, keeps
|
|
44
|
+
* a draft through a refetch, holds a refetch that lands mid-save, and reports a failure beside Save or beneath the field
|
|
45
|
+
* the server rejected. Use it in place of `useForm` for a form with `FormFooter`, mounted once per record: give the
|
|
46
|
+
* form's component a `key` of the record's id, so another record never inherits this one's save.
|
|
47
|
+
*
|
|
48
|
+
* @param options Every option this module's `useForm` takes except `resetOptions`, with `save` and `fieldErrorOf`; see
|
|
49
|
+
* `UseSaveFormOptions`. Pass the loaded record as `values`, so the fields the user has not edited follow a refetch.
|
|
50
|
+
* @returns The form and its save state, with one handler per action; see `UseSaveFormReturn`. "Try again" has none:
|
|
51
|
+
* `FormSaveErrorAlert` submits the form itself, as Save does.
|
|
52
|
+
*/
|
|
53
|
+
export declare const useSaveForm: <TValues extends FieldValues = FieldValues, TContext = any, TSubmitValues = TValues>({ save, fieldErrorOf, values, ...options }: UseSaveFormOptions<TValues, TContext, TSubmitValues>) => UseSaveFormReturn<TValues, TContext, TSubmitValues>;
|
|
54
|
+
//# sourceMappingURL=useSaveForm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSaveForm.d.ts","sourceRoot":"","sources":["../../../../../../src/components/forms/Form/hooks/useSaveForm/useSaveForm.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAG1G,4GAA4G;AAC5G,MAAM,WAAW,cAAc,CAAC,OAAO,SAAS,WAAW;IACzD,oDAAoD;IACpD,KAAK,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;IAC1B,qDAAqD;IACrD,OAAO,EAAE,MAAM,CAAC;CACjB;AAGD,MAAM,WAAW,kBAAkB,CAAC,OAAO,SAAS,WAAW,GAAG,WAAW,EAAE,QAAQ,GAAG,GAAG,EAAE,aAAa,GAAG,OAAO,CACpH,SAAQ,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,QAAQ,EAAE,aAAa,CAAC,EAAE,cAAc,CAAC;IAC5E;;;;;OAKG;IACH,IAAI,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAClD;;;;OAIG;IACH,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,c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