@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/Modal/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/Modal/index.tsx"],"names":[],"mappings":"AAIA,OAAO,EAEL,KAAK,WAAW,IAAI,eAAe,EAInC,KAAK,iBAAiB,IAAI,qBAAqB,EAChD,MAAM,kDAAkD,CAAC;AAE1D,6GAA6G;AAC7G,eAAO,MAAM,aAAa,sDAAoB,CAAC;AAC/C,6GAA6G;AAC7G,eAAO,MAAM,YAAY,iGAAmB,CAAC;AAC7C,6GAA6G;AAC7G,eAAO,MAAM,KAAK,2FAAY,CAAC;AAC/B,6GAA6G;AAC7G,eAAO,MAAM,MAAM,2FAAa,CAAC;AACjC,6GAA6G;AAC7G,MAAM,MAAM,iBAAiB,GAAG,qBAAqB,CAAC;AACtD,6GAA6G;AAC7G,MAAM,MAAM,WAAW,GAAG,eAAe,CAAC"}
|
|
@@ -1,43 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { cx } from '@flipdish/ui-library/utilities/cx';
|
|
3
|
-
import { useTestIdPrefix, joinTestId, useResolvedTestId, TestIdProvider } from '@flipdish/ui-library/utilities/testIdUtils';
|
|
4
|
-
import { DialogTrigger as DialogTrigger$1, Dialog as Dialog$1, Modal as Modal$1, ModalOverlay as ModalOverlay$1 } from 'react-aria-components';
|
|
1
|
+
import { Dialog as Dialog$1, DialogTrigger as DialogTrigger$1, Modal as Modal$1, ModalOverlay as ModalOverlay$1 } from '@flipdish/ui-library/components/molecules/Modals';
|
|
5
2
|
|
|
6
|
-
/**
|
|
3
|
+
/** @deprecated Import from `@flipdish/ui-library/components/molecules/Modals`. Removed in the next major. */
|
|
7
4
|
const DialogTrigger = DialogTrigger$1;
|
|
8
|
-
/**
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
*/
|
|
15
|
-
const ModalOverlay = ({ 'data-testid': dataTestId, ...props }) => {
|
|
16
|
-
const rootTestId = useResolvedTestId({ testId: dataTestId, segment: 'modal', rootName: 'modal' });
|
|
17
|
-
return (jsx(TestIdProvider, { value: rootTestId, children: jsx(ModalOverlay$1, { ...props, "data-testid": rootTestId, className: (state) => cx('fixed inset-0 z-50 flex min-h-dvh w-full items-end justify-center bg-overlay/70 px-4 outline-hidden backdrop-blur-[6px] sm:items-center sm:justify-center sm:px-8',
|
|
18
|
-
// Vertical padding
|
|
19
|
-
'pt-(--modal-pt) pb-(--modal-pb) [--modal-pb:clamp(16px,8vh,64px)] [--modal-pt:16px] sm:[--modal-pb:32px] sm:[--modal-pt:32px]',
|
|
20
|
-
// Animations
|
|
21
|
-
state.isEntering && 'duration-300 ease-out animate-in fade-in', state.isExiting && 'duration-200 ease-in animate-out fade-out', typeof props.className === 'function' ? props.className(state) : props.className) }) }));
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* Accessible overlay dialog built on react-aria primitives. Compose with `ModalOverlay`,
|
|
25
|
-
* `Dialog`, and optionally `DialogTrigger` to display focused content or actions in an overlay
|
|
26
|
-
* that blocks the rest of the page.
|
|
27
|
-
*
|
|
28
|
-
* @summary accessible overlay dialog for focused content or actions
|
|
29
|
-
*/
|
|
30
|
-
const Modal = (props) => (jsx(Modal$1, { ...props, className: (state) => cx('rounded-xl bg-primary align-middle shadow-xl outline-hidden max-sm:overflow-y-auto sm:rounded-2xl',
|
|
31
|
-
// Max height based on parent's vertical padding
|
|
32
|
-
'max-h-[calc(var(--visual-viewport-height)-var(--modal-pt)-var(--modal-pb))]',
|
|
33
|
-
// Animations
|
|
34
|
-
state.isEntering && 'duration-300 ease-out animate-in zoom-in-95', state.isExiting && 'duration-200 ease-in animate-out zoom-out-95', typeof props.className === 'function' ? props.className(state) : props.className) }));
|
|
35
|
-
/** Scrollable, focus-managed content container that sits inside `Modal` and holds the dialog's content. */
|
|
36
|
-
const Dialog = ({ 'data-testid': dataTestId, ...props }) => {
|
|
37
|
-
const prefix = useTestIdPrefix();
|
|
38
|
-
const dialogTestId = dataTestId ?? (prefix ? joinTestId(prefix, 'dialog') : undefined);
|
|
39
|
-
return (jsx(Dialog$1, { ...props, "data-testid": dialogTestId, className: cx('relative max-h-[inherit] w-full overflow-y-auto outline-hidden', props.className) }));
|
|
40
|
-
};
|
|
5
|
+
/** @deprecated Import from `@flipdish/ui-library/components/molecules/Modals`. Removed in the next major. */
|
|
6
|
+
const ModalOverlay = ModalOverlay$1;
|
|
7
|
+
/** @deprecated Import from `@flipdish/ui-library/components/molecules/Modals`. Removed in the next major. */
|
|
8
|
+
const Modal = Modal$1;
|
|
9
|
+
/** @deprecated Import from `@flipdish/ui-library/components/molecules/Modals`. Removed in the next major. */
|
|
10
|
+
const Dialog = Dialog$1;
|
|
41
11
|
|
|
42
12
|
export { Dialog, DialogTrigger, Modal, ModalOverlay };
|
|
43
13
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/molecules/Modal/index.tsx"],"sourcesContent":[null],"names":["
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/molecules/Modal/index.tsx"],"sourcesContent":[null],"names":["DialogTriggerNext","ModalOverlayNext","ModalNext","DialogNext"],"mappings":";;AAaA;AACO,MAAM,aAAa,GAAGA;AAC7B;AACO,MAAM,YAAY,GAAGC;AAC5B;AACO,MAAM,KAAK,GAAGC;AACrB;AACO,MAAM,MAAM,GAAGC;;"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var Button = require('@flipdish/ui-library/components/atoms/Button');
|
|
5
|
+
var testIdUtils = require('@flipdish/ui-library/utilities/testIdUtils');
|
|
6
|
+
var React = require('react');
|
|
7
|
+
var Modal = require('./Modal.cjs');
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Asks the user to confirm one action before it runs, with a button that backs out and a button that goes ahead.
|
|
11
|
+
* Use it before an action that removes something or cannot be undone from the page.
|
|
12
|
+
*
|
|
13
|
+
* @summary confirm dialog asked before a destructive or final action
|
|
14
|
+
*/
|
|
15
|
+
const ConfirmationModal = ({ isOpen, onOpenChange, title, description, confirmLabel, onConfirm, isDestructive = false, isConfirming = false, 'data-testid': dataTestId, }) => {
|
|
16
|
+
const rootTestId = testIdUtils.useResolvedTestId({ testId: dataTestId, segment: 'confirmation-modal', rootName: 'confirmation-modal' });
|
|
17
|
+
const titleId = React.useId();
|
|
18
|
+
const descriptionId = React.useId();
|
|
19
|
+
const cancel = () => onOpenChange(false);
|
|
20
|
+
// The buttons stay on screen while the dialog animates out, so a second press must not run the action again.
|
|
21
|
+
const confirm = () => {
|
|
22
|
+
if (isOpen)
|
|
23
|
+
onConfirm();
|
|
24
|
+
};
|
|
25
|
+
return (jsxRuntime.jsx(Modal.ModalOverlay, { isOpen: isOpen, onOpenChange: onOpenChange,
|
|
26
|
+
// Not dismissable by a press outside: the dialog asks a question, and a stray click must not answer it.
|
|
27
|
+
// Closing mid-action would hide whether it landed, so Escape waits until it settles too.
|
|
28
|
+
isKeyboardDismissDisabled: isConfirming, "data-testid": rootTestId, children: jsxRuntime.jsx(Modal.Modal, { className: "w-full sm:max-w-100", children: jsxRuntime.jsx(Modal.Dialog, { role: "alertdialog", "aria-labelledby": titleId, "aria-describedby": descriptionId, children: jsxRuntime.jsxs("div", { className: "p-6", children: [jsxRuntime.jsx("h2", { id: titleId, className: "text-lg font-semibold text-primary", children: title }), jsxRuntime.jsx("p", { id: descriptionId, className: "mt-2 text-sm text-secondary", children: description }), jsxRuntime.jsxs("div", { className: "mt-6 flex flex-col-reverse gap-3 sm:flex-row sm:justify-end", children: [jsxRuntime.jsx(Button.Button, { color: "secondary", size: "md", isDisabled: isConfirming, onPress: cancel, "data-testid": testIdUtils.joinTestId(rootTestId, 'cancel'), children: "Cancel" }), jsxRuntime.jsx(Button.Button, { color: isDestructive ? 'primary-destructive' : 'primary', size: "md", isLoading: isConfirming, showTextWhileLoading: true, onPress: confirm, "data-testid": testIdUtils.joinTestId(rootTestId, 'confirm'), children: confirmLabel })] })] }) }) }) }));
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
exports.ConfirmationModal = ConfirmationModal;
|
|
32
|
+
//# sourceMappingURL=ConfirmationModal.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfirmationModal.cjs","sources":["../../../../../src/components/molecules/Modals/components/ConfirmationModal.tsx"],"sourcesContent":[null],"names":["useResolvedTestId","useId","_jsx","ModalOverlay","Modal","Dialog","_jsxs","Button","joinTestId"],"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AAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,6DAA6D,EAAA,QAAA,EAAA,CAC1EJ,cAAA,CAACK,aAAM,EAAA,EAAC,KAAK,EAAC,WAAW,EAAC,IAAI,EAAC,IAAI,EAAC,UAAU,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,EAAA,aAAA,EAAeC,sBAAU,CAAC,UAAU,EAAE,QAAQ,CAAC,EAAA,QAAA,EAAA,QAAA,EAAA,CAEnH,EACTN,cAAA,CAACK,aAAM,EAAA,EACL,KAAK,EAAE,aAAa,GAAG,qBAAqB,GAAG,SAAS,EACxD,IAAI,EAAC,IAAI,EACT,SAAS,EAAE,YAAY,EACvB,oBAAoB,EAAA,IAAA,EACpB,OAAO,EAAE,OAAO,EAAA,aAAA,EACHC,sBAAU,CAAC,UAAU,EAAE,SAAS,CAAC,EAAA,QAAA,EAE7C,YAAY,EAAA,CACN,CAAA,EAAA,CACL,CAAA,EAAA,CACF,EAAA,CACC,EAAA,CACH,EAAA,CACK;AAEnB;;"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface ConfirmationModalProps {
|
|
2
|
+
/** Shows the dialog. */
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
/** Called with `false` when Cancel or Escape asks the dialog to close; set `isOpen` from it. A press outside does nothing. */
|
|
5
|
+
onOpenChange: (isOpen: boolean) => void;
|
|
6
|
+
/** The question being asked, such as "Remove this property?"; it names the dialog. */
|
|
7
|
+
title: string;
|
|
8
|
+
/** What confirming will do, beneath the title; it describes the dialog. */
|
|
9
|
+
description: string;
|
|
10
|
+
/** Text of the confirming button, naming the action, such as "Remove property". */
|
|
11
|
+
confirmLabel: string;
|
|
12
|
+
/** Runs the action. The dialog stays open until `isOpen` turns `false`, so close it here or once the action lands. */
|
|
13
|
+
onConfirm: () => void;
|
|
14
|
+
/** Colours the confirming button as destructive, for an action that removes something or cannot be undone. */
|
|
15
|
+
isDestructive?: boolean;
|
|
16
|
+
/** Shows the confirming button's loading state and stops the dialog being dismissed while the action is in flight. */
|
|
17
|
+
isConfirming?: boolean;
|
|
18
|
+
/** Overrides the root `data-testid` (defaults to `fd-confirmation-modal`); the dialog and buttons derive theirs from it. */
|
|
19
|
+
'data-testid'?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Asks the user to confirm one action before it runs, with a button that backs out and a button that goes ahead.
|
|
23
|
+
* Use it before an action that removes something or cannot be undone from the page.
|
|
24
|
+
*
|
|
25
|
+
* @summary confirm dialog asked before a destructive or final action
|
|
26
|
+
*/
|
|
27
|
+
export declare const ConfirmationModal: ({ isOpen, onOpenChange, title, description, confirmLabel, onConfirm, isDestructive, isConfirming, "data-testid": dataTestId, }: ConfirmationModalProps) => import("react").JSX.Element;
|
|
28
|
+
//# sourceMappingURL=ConfirmationModal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfirmationModal.d.ts","sourceRoot":"","sources":["../../../../../src/components/molecules/Modals/components/ConfirmationModal.tsx"],"names":[],"mappings":"AAOA,MAAM,WAAW,sBAAsB;IACrC,wBAAwB;IACxB,MAAM,EAAE,OAAO,CAAC;IAChB,8HAA8H;IAC9H,YAAY,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACxC,sFAAsF;IACtF,KAAK,EAAE,MAAM,CAAC;IACd,2EAA2E;IAC3E,WAAW,EAAE,MAAM,CAAC;IACpB,mFAAmF;IACnF,YAAY,EAAE,MAAM,CAAC;IACrB,sHAAsH;IACtH,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,8GAA8G;IAC9G,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,sHAAsH;IACtH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,4HAA4H;IAC5H,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAAI,gIAU/B,sBAAsB,gCAgDxB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { Button } from '@flipdish/ui-library/components/atoms/Button';
|
|
3
|
+
import { useResolvedTestId, joinTestId } from '@flipdish/ui-library/utilities/testIdUtils';
|
|
4
|
+
import { useId } from 'react';
|
|
5
|
+
import { ModalOverlay, Modal, Dialog } from './Modal.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Asks the user to confirm one action before it runs, with a button that backs out and a button that goes ahead.
|
|
9
|
+
* Use it before an action that removes something or cannot be undone from the page.
|
|
10
|
+
*
|
|
11
|
+
* @summary confirm dialog asked before a destructive or final action
|
|
12
|
+
*/
|
|
13
|
+
const ConfirmationModal = ({ isOpen, onOpenChange, title, description, confirmLabel, onConfirm, isDestructive = false, isConfirming = false, 'data-testid': dataTestId, }) => {
|
|
14
|
+
const rootTestId = useResolvedTestId({ testId: dataTestId, segment: 'confirmation-modal', rootName: 'confirmation-modal' });
|
|
15
|
+
const titleId = useId();
|
|
16
|
+
const descriptionId = useId();
|
|
17
|
+
const cancel = () => onOpenChange(false);
|
|
18
|
+
// The buttons stay on screen while the dialog animates out, so a second press must not run the action again.
|
|
19
|
+
const confirm = () => {
|
|
20
|
+
if (isOpen)
|
|
21
|
+
onConfirm();
|
|
22
|
+
};
|
|
23
|
+
return (jsx(ModalOverlay, { isOpen: isOpen, onOpenChange: onOpenChange,
|
|
24
|
+
// Not dismissable by a press outside: the dialog asks a question, and a stray click must not answer it.
|
|
25
|
+
// Closing mid-action would hide whether it landed, so Escape waits until it settles too.
|
|
26
|
+
isKeyboardDismissDisabled: isConfirming, "data-testid": rootTestId, children: jsx(Modal, { className: "w-full sm:max-w-100", children: jsx(Dialog, { role: "alertdialog", "aria-labelledby": titleId, "aria-describedby": descriptionId, children: jsxs("div", { className: "p-6", children: [jsx("h2", { id: titleId, className: "text-lg font-semibold text-primary", children: title }), jsx("p", { id: descriptionId, className: "mt-2 text-sm text-secondary", children: description }), jsxs("div", { className: "mt-6 flex flex-col-reverse gap-3 sm:flex-row sm:justify-end", children: [jsx(Button, { color: "secondary", size: "md", isDisabled: isConfirming, onPress: cancel, "data-testid": joinTestId(rootTestId, 'cancel'), children: "Cancel" }), jsx(Button, { color: isDestructive ? 'primary-destructive' : 'primary', size: "md", isLoading: isConfirming, showTextWhileLoading: true, onPress: confirm, "data-testid": joinTestId(rootTestId, 'confirm'), children: confirmLabel })] })] }) }) }) }));
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export { ConfirmationModal };
|
|
30
|
+
//# sourceMappingURL=ConfirmationModal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfirmationModal.js","sources":["../../../../../src/components/molecules/Modals/components/ConfirmationModal.tsx"],"sourcesContent":[null],"names":["_jsx","_jsxs"],"mappings":";;;;;;AA4BA;;;;;AAKG;AACI,MAAM,iBAAiB,GAAG,CAAC,EAChC,MAAM,EACN,YAAY,EACZ,KAAK,EACL,WAAW,EACX,YAAY,EACZ,SAAS,EACT,aAAa,GAAG,KAAK,EACrB,YAAY,GAAG,KAAK,EACpB,aAAa,EAAE,UAAU,GACF,KAAI;AAC3B,IAAA,MAAM,UAAU,GAAG,iBAAiB,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,oBAAoB,EAAE,QAAQ,EAAE,oBAAoB,EAAE,CAAC;AAC3H,IAAA,MAAM,OAAO,GAAG,KAAK,EAAE;AACvB,IAAA,MAAM,aAAa,GAAG,KAAK,EAAE;IAC7B,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,KAAK,CAAC;;IAExC,MAAM,OAAO,GAAG,MAAK;AACnB,QAAA,IAAI,MAAM;AAAE,YAAA,SAAS,EAAE;AACzB,IAAA,CAAC;IAED,QACEA,GAAA,CAAC,YAAY,EAAA,EACX,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,YAAY;;;AAG1B,QAAA,yBAAyB,EAAE,YAAY,EAAA,aAA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-runtime');
|
|
4
|
+
var cx = require('@flipdish/ui-library/utilities/cx');
|
|
5
|
+
var testIdUtils = require('@flipdish/ui-library/utilities/testIdUtils');
|
|
6
|
+
var reactAriaComponents = require('react-aria-components');
|
|
7
|
+
|
|
8
|
+
/** Opens the modal when its child button is pressed; a plain alias of react-aria-components' `DialogTrigger`. */
|
|
9
|
+
const DialogTrigger = reactAriaComponents.DialogTrigger;
|
|
10
|
+
/**
|
|
11
|
+
* Backdrop and positioning layer for a `Modal` dialog that interrupts the page for input or
|
|
12
|
+
* confirmation. Wrap `Modal` and `Dialog` in it; focus trapping, scroll lock and Escape are
|
|
13
|
+
* handled.
|
|
14
|
+
*
|
|
15
|
+
* @summary overlay dialog for focused input or confirmation
|
|
16
|
+
*/
|
|
17
|
+
const ModalOverlay = ({ 'data-testid': dataTestId, ...props }) => {
|
|
18
|
+
const rootTestId = testIdUtils.useResolvedTestId({ testId: dataTestId, segment: 'modal', rootName: 'modal' });
|
|
19
|
+
return (jsxRuntime.jsx(testIdUtils.TestIdProvider, { value: rootTestId, children: jsxRuntime.jsx(reactAriaComponents.ModalOverlay, { ...props, "data-testid": rootTestId, className: (state) => cx.cx('fixed inset-0 z-50 flex min-h-dvh w-full items-end justify-center bg-overlay/70 px-4 outline-hidden backdrop-blur-[6px] sm:items-center sm:justify-center sm:px-8',
|
|
20
|
+
// Vertical padding
|
|
21
|
+
'pt-(--modal-pt) pb-(--modal-pb) [--modal-pb:clamp(16px,8vh,64px)] [--modal-pt:16px] sm:[--modal-pb:32px] sm:[--modal-pt:32px]',
|
|
22
|
+
// Animations
|
|
23
|
+
state.isEntering && 'duration-300 ease-out animate-in fade-in', state.isExiting && 'duration-200 ease-in animate-out fade-out', typeof props.className === 'function' ? props.className(state) : props.className) }) }));
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Accessible overlay dialog built on react-aria primitives. Compose with `ModalOverlay`,
|
|
27
|
+
* `Dialog`, and optionally `DialogTrigger` to display focused content or actions in an overlay
|
|
28
|
+
* that blocks the rest of the page.
|
|
29
|
+
*
|
|
30
|
+
* @summary accessible overlay dialog for focused content or actions
|
|
31
|
+
*/
|
|
32
|
+
const Modal = (props) => (jsxRuntime.jsx(reactAriaComponents.Modal, { ...props, className: (state) => cx.cx('rounded-xl bg-primary align-middle shadow-xl outline-hidden max-sm:overflow-y-auto sm:rounded-2xl',
|
|
33
|
+
// Max height based on parent's vertical padding
|
|
34
|
+
'max-h-[calc(var(--visual-viewport-height)-var(--modal-pt)-var(--modal-pb))]',
|
|
35
|
+
// Animations
|
|
36
|
+
state.isEntering && 'duration-300 ease-out animate-in zoom-in-95', state.isExiting && 'duration-200 ease-in animate-out zoom-out-95', typeof props.className === 'function' ? props.className(state) : props.className) }));
|
|
37
|
+
/** Scrollable, focus-managed content container that sits inside `Modal` and holds the dialog's content. */
|
|
38
|
+
const Dialog = ({ 'data-testid': dataTestId, ...props }) => {
|
|
39
|
+
const prefix = testIdUtils.useTestIdPrefix();
|
|
40
|
+
const dialogTestId = dataTestId ?? (prefix ? testIdUtils.joinTestId(prefix, 'dialog') : undefined);
|
|
41
|
+
return (jsxRuntime.jsx(reactAriaComponents.Dialog, { ...props, "data-testid": dialogTestId, className: cx.cx('relative max-h-[inherit] w-full overflow-y-auto outline-hidden', props.className) }));
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
exports.Dialog = Dialog;
|
|
45
|
+
exports.DialogTrigger = DialogTrigger;
|
|
46
|
+
exports.Modal = Modal;
|
|
47
|
+
exports.ModalOverlay = ModalOverlay;
|
|
48
|
+
//# sourceMappingURL=Modal.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Modal.cjs","sources":["../../../../../src/components/molecules/Modals/components/Modal.tsx"],"sourcesContent":[null],"names":["AriaDialogTrigger","useResolvedTestId","_jsx","TestIdProvider","AriaModalOverlay","cx","AriaModal","useTestIdPrefix","joinTestId","AriaDialog"],"mappings":";;;;;;;AAYA;AACO,MAAM,a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AK,MAAM,GAAGC,sBAAU,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,SAAS,CAAC;IAEtF,QACEN,eAACO,0BAAU,EAAA,EAAA,GACL,KAAK,EAAA,aAAA,EACI,YAAY,EACzB,SAAS,EAAEJ,KAAE,CAAC,gEAAgE,EAAE,KAAK,CAAC,SAAS,CAAC,EAAA,CAChG;AAEN;;;;;"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { DialogProps as AriaDialogProps, ModalOverlayProps as AriaModalOverlayProps } from 'react-aria-components';
|
|
2
|
+
import { DialogTrigger as AriaDialogTrigger } from 'react-aria-components';
|
|
3
|
+
/** Opens the modal when its child button is pressed; a plain alias of react-aria-components' `DialogTrigger`. */
|
|
4
|
+
export declare const DialogTrigger: typeof AriaDialogTrigger;
|
|
5
|
+
export interface ModalOverlayProps extends AriaModalOverlayProps {
|
|
6
|
+
/**
|
|
7
|
+
* Overrides the derived root `data-testid` (defaults to `fd-modal`). `Dialog`
|
|
8
|
+
* derives its id from this prefix (`<root>--dialog`).
|
|
9
|
+
*/
|
|
10
|
+
'data-testid'?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Backdrop and positioning layer for a `Modal` dialog that interrupts the page for input or
|
|
14
|
+
* confirmation. Wrap `Modal` and `Dialog` in it; focus trapping, scroll lock and Escape are
|
|
15
|
+
* handled.
|
|
16
|
+
*
|
|
17
|
+
* @summary overlay dialog for focused input or confirmation
|
|
18
|
+
*/
|
|
19
|
+
export declare const ModalOverlay: ({ "data-testid": dataTestId, ...props }: ModalOverlayProps) => import("react").JSX.Element;
|
|
20
|
+
/**
|
|
21
|
+
* Accessible overlay dialog built on react-aria primitives. Compose with `ModalOverlay`,
|
|
22
|
+
* `Dialog`, and optionally `DialogTrigger` to display focused content or actions in an overlay
|
|
23
|
+
* that blocks the rest of the page.
|
|
24
|
+
*
|
|
25
|
+
* @summary accessible overlay dialog for focused content or actions
|
|
26
|
+
*/
|
|
27
|
+
export declare const Modal: (props: AriaModalOverlayProps) => import("react").JSX.Element;
|
|
28
|
+
export interface DialogProps extends AriaDialogProps {
|
|
29
|
+
/**
|
|
30
|
+
* Overrides the derived `data-testid` for the dialog (defaults to `<root>--dialog`,
|
|
31
|
+
* e.g. `fd-modal--dialog`, when nested under `ModalOverlay`).
|
|
32
|
+
*/
|
|
33
|
+
'data-testid'?: string;
|
|
34
|
+
}
|
|
35
|
+
/** Scrollable, focus-managed content container that sits inside `Modal` and holds the dialog's content. */
|
|
36
|
+
export declare const Dialog: ({ "data-testid": dataTestId, ...props }: DialogProps) => import("react").JSX.Element;
|
|
37
|
+
//# sourceMappingURL=Modal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../../../src/components/molecules/Modals/components/Modal.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,IAAI,eAAe,EAAE,iBAAiB,IAAI,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AACxH,OAAO,EAEL,aAAa,IAAI,iBAAiB,EAGnC,MAAM,uBAAuB,CAAC;AAE/B,iHAAiH;AACjH,eAAO,MAAM,aAAa,0BAAoB,CAAC;AAE/C,MAAM,WAAW,iBAAkB,SAAQ,qBAAqB;IAC9D;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,GAAI,yCAAyC,iBAAiB,gCAsBtF,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,KAAK,GAAI,OAAO,qBAAqB,gCAejD,CAAC;AAEF,MAAM,WAAW,WAAY,SAAQ,eAAe;IAClD;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,2GAA2G;AAC3G,eAAO,MAAM,MAAM,GAAI,yCAAyC,WAAW,gCAW1E,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { cx } from '@flipdish/ui-library/utilities/cx';
|
|
3
|
+
import { useTestIdPrefix, joinTestId, useResolvedTestId, TestIdProvider } from '@flipdish/ui-library/utilities/testIdUtils';
|
|
4
|
+
import { DialogTrigger as DialogTrigger$1, Dialog as Dialog$1, Modal as Modal$1, ModalOverlay as ModalOverlay$1 } from 'react-aria-components';
|
|
5
|
+
|
|
6
|
+
/** Opens the modal when its child button is pressed; a plain alias of react-aria-components' `DialogTrigger`. */
|
|
7
|
+
const DialogTrigger = DialogTrigger$1;
|
|
8
|
+
/**
|
|
9
|
+
* Backdrop and positioning layer for a `Modal` dialog that interrupts the page for input or
|
|
10
|
+
* confirmation. Wrap `Modal` and `Dialog` in it; focus trapping, scroll lock and Escape are
|
|
11
|
+
* handled.
|
|
12
|
+
*
|
|
13
|
+
* @summary overlay dialog for focused input or confirmation
|
|
14
|
+
*/
|
|
15
|
+
const ModalOverlay = ({ 'data-testid': dataTestId, ...props }) => {
|
|
16
|
+
const rootTestId = useResolvedTestId({ testId: dataTestId, segment: 'modal', rootName: 'modal' });
|
|
17
|
+
return (jsx(TestIdProvider, { value: rootTestId, children: jsx(ModalOverlay$1, { ...props, "data-testid": rootTestId, className: (state) => cx('fixed inset-0 z-50 flex min-h-dvh w-full items-end justify-center bg-overlay/70 px-4 outline-hidden backdrop-blur-[6px] sm:items-center sm:justify-center sm:px-8',
|
|
18
|
+
// Vertical padding
|
|
19
|
+
'pt-(--modal-pt) pb-(--modal-pb) [--modal-pb:clamp(16px,8vh,64px)] [--modal-pt:16px] sm:[--modal-pb:32px] sm:[--modal-pt:32px]',
|
|
20
|
+
// Animations
|
|
21
|
+
state.isEntering && 'duration-300 ease-out animate-in fade-in', state.isExiting && 'duration-200 ease-in animate-out fade-out', typeof props.className === 'function' ? props.className(state) : props.className) }) }));
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Accessible overlay dialog built on react-aria primitives. Compose with `ModalOverlay`,
|
|
25
|
+
* `Dialog`, and optionally `DialogTrigger` to display focused content or actions in an overlay
|
|
26
|
+
* that blocks the rest of the page.
|
|
27
|
+
*
|
|
28
|
+
* @summary accessible overlay dialog for focused content or actions
|
|
29
|
+
*/
|
|
30
|
+
const Modal = (props) => (jsx(Modal$1, { ...props, className: (state) => cx('rounded-xl bg-primary align-middle shadow-xl outline-hidden max-sm:overflow-y-auto sm:rounded-2xl',
|
|
31
|
+
// Max height based on parent's vertical padding
|
|
32
|
+
'max-h-[calc(var(--visual-viewport-height)-var(--modal-pt)-var(--modal-pb))]',
|
|
33
|
+
// Animations
|
|
34
|
+
state.isEntering && 'duration-300 ease-out animate-in zoom-in-95', state.isExiting && 'duration-200 ease-in animate-out zoom-out-95', typeof props.className === 'function' ? props.className(state) : props.className) }));
|
|
35
|
+
/** Scrollable, focus-managed content container that sits inside `Modal` and holds the dialog's content. */
|
|
36
|
+
const Dialog = ({ 'data-testid': dataTestId, ...props }) => {
|
|
37
|
+
const prefix = useTestIdPrefix();
|
|
38
|
+
const dialogTestId = dataTestId ?? (prefix ? joinTestId(prefix, 'dialog') : undefined);
|
|
39
|
+
return (jsx(Dialog$1, { ...props, "data-testid": dialogTestId, className: cx('relative max-h-[inherit] w-full overflow-y-auto outline-hidden', props.className) }));
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export { Dialog, DialogTrigger, Modal, ModalOverlay };
|
|
43
|
+
//# sourceMappingURL=Modal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Modal.js","sources":["../../../../../src/components/molecules/Modals/components/Modal.tsx"],"sourcesContent":[null],"names":["AriaDialogTrigger","_jsx","AriaModalOverlay","AriaModal","AriaDialog"],"mappings":";;;;;AAYA;AACO,MAAM,aAAa,GAAGA;AAU7B;;;;;;AAMG;AACI,MAAM,YAAY,GAAG,CAAC,EAAE,aAAa,EAAE,UAAU,EAAE,GAAG,KAAK,EAAqB,KAAI;AACzF,IAAA,MAAM,UAAU,GAAG,iB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E,EAAE,CAAC,gEAAgE,EAAE,KAAK,CAAC,SAAS,CAAC,EAAA,CAChG;AAEN;;"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var Button = require('@flipdish/ui-library/components/atoms/Button');
|
|
5
|
+
var useUnsavedChangesGuard = require('@flipdish/ui-library/hooks/useUnsavedChangesGuard');
|
|
6
|
+
var testIdUtils = require('@flipdish/ui-library/utilities/testIdUtils');
|
|
7
|
+
var React = require('react');
|
|
8
|
+
var Modal = require('./Modal.cjs');
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Asks before unsaved changes are lost: a confirm dialog on navigation and the back button, and the browser's own
|
|
12
|
+
* prompt on refresh or tab close. Render one beside any form that waits on a Save button, and pass its dirty flag.
|
|
13
|
+
*
|
|
14
|
+
* @summary confirm dialog that stops navigation losing unsaved changes
|
|
15
|
+
*/
|
|
16
|
+
const UnsavedChangesModal = ({ hasUnsavedChanges, 'data-testid': dataTestId }) => {
|
|
17
|
+
const { isPromptOpen, stay, discard } = useUnsavedChangesGuard.useUnsavedChangesGuard({ hasUnsavedChanges });
|
|
18
|
+
const rootTestId = testIdUtils.useResolvedTestId({ testId: dataTestId, segment: 'unsaved-changes-modal', rootName: 'unsaved-changes-modal' });
|
|
19
|
+
const titleId = React.useId();
|
|
20
|
+
const descriptionId = React.useId();
|
|
21
|
+
// Escape closes the dialog, which must cancel the navigation and never let it through.
|
|
22
|
+
const stayOnClose = (isOpen) => {
|
|
23
|
+
if (!isOpen)
|
|
24
|
+
stay();
|
|
25
|
+
};
|
|
26
|
+
return (jsxRuntime.jsx(Modal.ModalOverlay, { isOpen: isPromptOpen, onOpenChange: stayOnClose, "data-testid": rootTestId, children: jsxRuntime.jsx(Modal.Modal, { className: "w-full sm:max-w-100", children: jsxRuntime.jsx(Modal.Dialog, { role: "alertdialog", "aria-labelledby": titleId, "aria-describedby": descriptionId, children: jsxRuntime.jsxs("div", { className: "p-6", children: [jsxRuntime.jsx("h2", { id: titleId, className: "text-lg font-semibold text-primary", children: "Unsaved changes" }), jsxRuntime.jsx("p", { id: descriptionId, className: "mt-2 text-sm text-secondary", children: "You have changes that have not been saved. If you leave now, they will be lost." }), jsxRuntime.jsxs("div", { className: "mt-6 flex flex-col-reverse gap-3 sm:flex-row sm:justify-end", children: [jsxRuntime.jsx(Button.Button, { color: "secondary", onPress: stay, "data-testid": testIdUtils.joinTestId(rootTestId, 'stay'), children: "Stay" }), jsxRuntime.jsx(Button.Button, { color: "primary-destructive", onPress: discard, "data-testid": testIdUtils.joinTestId(rootTestId, 'discard'), children: "Discard changes" })] })] }) }) }) }));
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
exports.UnsavedChangesModal = UnsavedChangesModal;
|
|
30
|
+
//# sourceMappingURL=UnsavedChangesModal.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UnsavedChangesModal.cjs","sources":["../../../../../src/components/molecules/Modals/components/UnsavedChangesModal.tsx"],"sourcesContent":[null],"names":["useUnsavedChangesGuard","useResolvedTestId","useId","_jsx","ModalOverlay","Modal","Dialog","_jsxs","Button","joinTestId"],"mappings":";;;;;;;;;AAeA;;;;;AAKG;AACI,MAAM,mBAAmB,GAAG,CAAC,EAAE,iBAAiB,EAAE,aAAa,EAAE,UAAU,EAA4B,KAAI;AAChH,IAAA,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,OAAO,EAAE,GAAGA,6CAAsB,CAAC,EAAE,iBAAiB,EAAE,CAAC;AACrF,IAAA,MAAM,UAAU,GAAGC,6BAAiB,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,uBAAuB,EAAE,QAAQ,EAAE,uBAAuB,EAAE,CAAC;AACjI,IAAA,MAAM,OAAO,GAAGC,WAAK,EAAE;AACvB,IAAA,MAAM,aAAa,GAAGA,WAAK,EAAE;;AAE7B,IAAA,MAAM,WAAW,GAAG,CAAC,MAAe,KAAI;AACtC,QAAA,IAAI,CAAC,MAAM;AAAE,YAAA,IAAI,EAAE;AACrB,IAAA,CAAC;IAED,QACEC,eAACC,kBAAY,EAAA,EAAC,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,iBAAe,UAAU,EAAA,QAAA,EACpFD,cAAA,CAACE,WAAK,EAAA,EAAC,SAAS,EAAC,qBAAqB,EAAA,QAAA,EACpCF,cAAA,CAACG,YAAM,EAAA,EAAC,IAAI,EAAC,aAAa,EAAA,iBAAA,EAAkB,OAAO,EAAA,kBAAA,EAAoB,aAAa,YAClFC,eAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,KAAK,EAAA,QAAA,EAAA,CAClBJ,cAAA,CAAA,IAAA,EAAA,EAAI,EAAE,EAAE,OAAO,EAAE,SAAS,EAAC,oCAAoC,gCAE1D,EACLA,cAAA,CAAA,GAAA,EAAA,EAAG,EAAE,EAAE,aAAa,EAAE,SAAS,EAAC,6BAA6B,gGAEzD,EACJI,eAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,6DAA6D,EAAA,QAAA,EAAA,CAC1EJ,cAAA,CAACK,aAAM,EAAA,EAAC,KAAK,EAAC,WAAW,EAAC,OAAO,EAAE,IAAI,iBAAeC,sBAAU,CAAC,UAAU,EAAE,MAAM,CAAC,qBAE3E,EACTN,cAAA,CAACK,aAAM,EAAA,EAAC,KAAK,EAAC,qBAAqB,EAAC,OAAO,EAAE,OAAO,EAAA,aAAA,EAAeC,sBAAU,CAAC,UAAU,EAAE,SAAS,CAAC,EAAA,QAAA,EAAA,iBAAA,EAAA,CAE3F,CAAA,EAAA,CACL,IACF,EAAA,CACC,EAAA,CACH,EAAA,CACK;AAEnB;;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface UnsavedChangesModalProps {
|
|
2
|
+
/** Whether there are unsaved changes to protect, such as a form's dirty flag. */
|
|
3
|
+
hasUnsavedChanges: boolean;
|
|
4
|
+
/** Overrides the root `data-testid` (defaults to `fd-unsaved-changes-modal`); the buttons derive theirs from it. */
|
|
5
|
+
'data-testid'?: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Asks before unsaved changes are lost: a confirm dialog on navigation and the back button, and the browser's own
|
|
9
|
+
* prompt on refresh or tab close. Render one beside any form that waits on a Save button, and pass its dirty flag.
|
|
10
|
+
*
|
|
11
|
+
* @summary confirm dialog that stops navigation losing unsaved changes
|
|
12
|
+
*/
|
|
13
|
+
export declare const UnsavedChangesModal: ({ hasUnsavedChanges, "data-testid": dataTestId }: UnsavedChangesModalProps) => import("react").JSX.Element;
|
|
14
|
+
//# sourceMappingURL=UnsavedChangesModal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UnsavedChangesModal.d.ts","sourceRoot":"","sources":["../../../../../src/components/molecules/Modals/components/UnsavedChangesModal.tsx"],"names":[],"mappings":"AAQA,MAAM,WAAW,wBAAwB;IACvC,iFAAiF;IACjF,iBAAiB,EAAE,OAAO,CAAC;IAC3B,oHAAoH;IACpH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,GAAI,kDAAkD,wBAAwB,gCAkC7G,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { Button } from '@flipdish/ui-library/components/atoms/Button';
|
|
3
|
+
import { useUnsavedChangesGuard } from '@flipdish/ui-library/hooks/useUnsavedChangesGuard';
|
|
4
|
+
import { useResolvedTestId, joinTestId } from '@flipdish/ui-library/utilities/testIdUtils';
|
|
5
|
+
import { useId } from 'react';
|
|
6
|
+
import { ModalOverlay, Modal, Dialog } from './Modal.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Asks before unsaved changes are lost: a confirm dialog on navigation and the back button, and the browser's own
|
|
10
|
+
* prompt on refresh or tab close. Render one beside any form that waits on a Save button, and pass its dirty flag.
|
|
11
|
+
*
|
|
12
|
+
* @summary confirm dialog that stops navigation losing unsaved changes
|
|
13
|
+
*/
|
|
14
|
+
const UnsavedChangesModal = ({ hasUnsavedChanges, 'data-testid': dataTestId }) => {
|
|
15
|
+
const { isPromptOpen, stay, discard } = useUnsavedChangesGuard({ hasUnsavedChanges });
|
|
16
|
+
const rootTestId = useResolvedTestId({ testId: dataTestId, segment: 'unsaved-changes-modal', rootName: 'unsaved-changes-modal' });
|
|
17
|
+
const titleId = useId();
|
|
18
|
+
const descriptionId = useId();
|
|
19
|
+
// Escape closes the dialog, which must cancel the navigation and never let it through.
|
|
20
|
+
const stayOnClose = (isOpen) => {
|
|
21
|
+
if (!isOpen)
|
|
22
|
+
stay();
|
|
23
|
+
};
|
|
24
|
+
return (jsx(ModalOverlay, { isOpen: isPromptOpen, onOpenChange: stayOnClose, "data-testid": rootTestId, children: jsx(Modal, { className: "w-full sm:max-w-100", children: jsx(Dialog, { role: "alertdialog", "aria-labelledby": titleId, "aria-describedby": descriptionId, children: jsxs("div", { className: "p-6", children: [jsx("h2", { id: titleId, className: "text-lg font-semibold text-primary", children: "Unsaved changes" }), jsx("p", { id: descriptionId, className: "mt-2 text-sm text-secondary", children: "You have changes that have not been saved. If you leave now, they will be lost." }), jsxs("div", { className: "mt-6 flex flex-col-reverse gap-3 sm:flex-row sm:justify-end", children: [jsx(Button, { color: "secondary", onPress: stay, "data-testid": joinTestId(rootTestId, 'stay'), children: "Stay" }), jsx(Button, { color: "primary-destructive", onPress: discard, "data-testid": joinTestId(rootTestId, 'discard'), children: "Discard changes" })] })] }) }) }) }));
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export { UnsavedChangesModal };
|
|
28
|
+
//# sourceMappingURL=UnsavedChangesModal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UnsavedChangesModal.js","sources":["../../../../../src/components/molecules/Modals/components/UnsavedChangesMod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MAAM,EAAA,EAAC,KAAK,EAAC,WAAW,EAAC,OAAO,EAAE,IAAI,iBAAe,UAAU,CAAC,UAAU,EAAE,MAAM,CAAC,qBAE3E,EACTA,GAAA,CAAC,MAAM,EAAA,EAAC,KAAK,EAAC,qBAAqB,EAAC,OAAO,EAAE,OAAO,EAAA,aAAA,EAAe,UAAU,CAAC,UAAU,EAAE,SAAS,CAAC,EAAA,QAAA,EAAA,iBAAA,EAAA,CAE3F,CAAA,EAAA,CACL,IACF,EAAA,CACC,EAAA,CACH,EAAA,CACK;AAEnB;;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ConfirmationModal = require('./components/ConfirmationModal.cjs');
|
|
4
|
+
var Modal = require('./components/Modal.cjs');
|
|
5
|
+
var UnsavedChangesModal = require('./components/UnsavedChangesModal.cjs');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
exports.ConfirmationModal = ConfirmationModal.ConfirmationModal;
|
|
10
|
+
exports.Dialog = Modal.Dialog;
|
|
11
|
+
exports.DialogTrigger = Modal.DialogTrigger;
|
|
12
|
+
exports.Modal = Modal.Modal;
|
|
13
|
+
exports.ModalOverlay = Modal.ModalOverlay;
|
|
14
|
+
exports.UnsavedChangesModal = UnsavedChangesModal.UnsavedChangesModal;
|
|
15
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The modal dialog and its ready-made forms: `Modal` and its parts for a dialog you compose yourself, and the modals
|
|
3
|
+
* built on it for one job each, such as asking before unsaved changes are lost.
|
|
4
|
+
*
|
|
5
|
+
* Explicit named re-exports on purpose: `export *` would publish every symbol of every private sub-component file
|
|
6
|
+
* (import paths are the public API here), so this list is the single source of truth for what Modals exposes.
|
|
7
|
+
*/
|
|
8
|
+
export type { ConfirmationModalProps } from './components/ConfirmationModal';
|
|
9
|
+
export { ConfirmationModal } from './components/ConfirmationModal';
|
|
10
|
+
export type { DialogProps, ModalOverlayProps } from './components/Modal';
|
|
11
|
+
export { Dialog, DialogTrigger, Modal, ModalOverlay } from './components/Modal';
|
|
12
|
+
export type { UnsavedChangesModalProps } from './components/UnsavedChangesModal';
|
|
13
|
+
export { UnsavedChangesModal } from './components/UnsavedChangesModal';
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/Modals/index.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,YAAY,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,YAAY,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACzE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAChF,YAAY,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AACjF,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
|
@@ -9,9 +9,9 @@ var React = require('react');
|
|
|
9
9
|
var reactAriaComponents = require('react-aria-components');
|
|
10
10
|
var ScrollClosingPopover = require('../../../__internal__/popover/ScrollClosingPopover.cjs');
|
|
11
11
|
var ref_utils = require('../../../../utilities/__internal__/refUtils/ref.utils.cjs');
|
|
12
|
-
var colorPicker_utils = require('../colorPicker.utils.cjs');
|
|
13
12
|
var useColorFieldEdit = require('../hooks/useColorFieldEdit.cjs');
|
|
14
13
|
var ColorPicker_provider = require('../providers/ColorPicker.provider.cjs');
|
|
14
|
+
var colorPicker_utils = require('../utilities/colorPicker.utils.cjs');
|
|
15
15
|
var ColorPickerDialog = require('./ColorPickerDialog.cjs');
|
|
16
16
|
|
|
17
17
|
const ColorPickerField = ({ children, ref, value, onChange, onChangeEnd, onBlur, label, hint, isInvalid, placeholder = 'Add colour', defaultColor, isClearable, isDisabled, isRequired, size = 'md', 'aria-label': ariaLabel, 'data-testid': dataTestId, }) => {
|
|
@@ -19,7 +19,17 @@ const ColorPickerField = ({ children, ref, value, onChange, onChangeEnd, onBlur,
|
|
|
19
19
|
const labelId = React.useId();
|
|
20
20
|
const triggerId = React.useId();
|
|
21
21
|
const hintId = React.useId();
|
|
22
|
-
const { color, startValue, onOpenChange, onPick, onRemove, onKeyDownCapture } = useColorFieldEdit.useColorFieldEdit({
|
|
22
|
+
const { color, startValue, isPickerOpen, onOpenChange, onPick, onRemove, onKeyDownCapture } = useColorFieldEdit.useColorFieldEdit({
|
|
23
|
+
value,
|
|
24
|
+
defaultColor,
|
|
25
|
+
onChange,
|
|
26
|
+
onChangeEnd,
|
|
27
|
+
});
|
|
28
|
+
// Focus going into the picker is not the user leaving the field: a form would validate a colour they are about to change.
|
|
29
|
+
const blurUnlessPicking = () => {
|
|
30
|
+
if (!isPickerOpen.current)
|
|
31
|
+
onBlur?.();
|
|
32
|
+
};
|
|
23
33
|
const triggerText = color ? colorPicker_utils.toHexString(color) : placeholder;
|
|
24
34
|
// A button cannot carry `aria-required`, so a name given by `aria-label` says it in words, as the visible label does,
|
|
25
35
|
// and ends with the trigger's own text, so the value is announced with the name here too.
|
|
@@ -42,7 +52,7 @@ const ColorPickerField = ({ children, ref, value, onChange, onChangeEnd, onBlur,
|
|
|
42
52
|
// The Remove button leaves the page with the colour, so focus moves to the trigger instead of being lost.
|
|
43
53
|
root.current?.querySelector('button')?.focus();
|
|
44
54
|
};
|
|
45
|
-
return (jsxRuntime.jsxs("div", { ref: setRoot, "data-testid": fieldTestId, className: "flex flex-col items-start gap-1.5", children: [label && (jsxRuntime.jsxs("span", { id: labelId, className: "flex items-center gap-0.5 text-sm font-medium text-secondary", children: [label, isRequired && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("span", { "aria-hidden": "true", className: "text-brand-tertiary", children: "*" }), jsxRuntime.jsx("span", { className: "sr-only", children: "(required)" })] }))] })), jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [jsxRuntime.jsxs(reactAriaComponents.DialogTrigger, { onOpenChange: onOpenChange, children: [jsxRuntime.jsx(Button.Button, { id: triggerId, size: size, color: "secondary", isDisabled: isDisabled, onBlur:
|
|
55
|
+
return (jsxRuntime.jsxs("div", { ref: setRoot, "data-testid": fieldTestId, className: "flex flex-col items-start gap-1.5", children: [label && (jsxRuntime.jsxs("span", { id: labelId, className: "flex items-center gap-0.5 text-sm font-medium text-secondary", children: [label, isRequired && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("span", { "aria-hidden": "true", className: "text-brand-tertiary", children: "*" }), jsxRuntime.jsx("span", { className: "sr-only", children: "(required)" })] }))] })), jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [jsxRuntime.jsxs(reactAriaComponents.DialogTrigger, { onOpenChange: onOpenChange, children: [jsxRuntime.jsx(Button.Button, { id: triggerId, size: size, color: "secondary", isDisabled: isDisabled, onBlur: blurUnlessPicking,
|
|
46
56
|
// The picked colour is the user's data, not a token, so it can only be set inline.
|
|
47
57
|
iconLeading: color ? (jsxRuntime.jsx("span", { "aria-hidden": "true", className: "size-4 shrink-0 rounded-full ring-1 ring-alpha-black/10 ring-inset", style: { backgroundColor: colorPicker_utils.toHexString(color) } })) : (uiIcons.Plus), "aria-labelledby": label ? `${labelId} ${triggerId}` : undefined, "aria-label": label ? undefined : triggerName, "aria-describedby": hint ? hintId : undefined, "data-testid": testIdUtils.joinTestId(fieldTestId, 'trigger'), children: triggerText }), jsxRuntime.jsx(ScrollClosingPopover.ScrollClosingPopover, { placement: "bottom start", offset: 8, children: jsxRuntime.jsx("div", { className: "contents", onKeyDownCapture: onKeyDownCapture, children: jsxRuntime.jsx(reactAriaComponents.Dialog, { "aria-label": label ?? ariaLabel, className: "outline-hidden", children: jsxRuntime.jsx(ColorPickerDialog.ColorPickerDialog, { className: "p-4", "data-testid": testIdUtils.joinTestId(fieldTestId, 'picker'), children: jsxRuntime.jsx(ColorPicker_provider.Provider, { defaultValue: startValue, onChange: onPick, children: children }) }) }) }) })] }), isClearable && color && (jsxRuntime.jsx(Button.Button, { size: size, color: "link-gray", isDisabled: isDisabled, "aria-label": `Remove ${label ?? ariaLabel ?? 'colour'}`, onPress: handleRemove, "data-testid": testIdUtils.joinTestId(fieldTestId, 'remove'), children: "Remove" }))] }), hint && (jsxRuntime.jsx(Input.HintText, { id: hintId, isInvalid: isInvalid, children: hint }))] }));
|
|
48
58
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorPickerField.cjs","sources":["../../../../../src/components/organisms/ColorPicker/components/ColorPickerField.tsx"],"sourcesContent":[null],"names":["useResolvedTestId","useId","useColorFieldEdit","toHexString","useRef","useCallback","setRef","_jsxs","_Fragment","_jsx","AriaDialogTrigger","Button","Plus","joinTestId","ScrollClosingPopover","AriaDialog","ColorPickerDialog","Provider","HintText"],"mappings":";;;;;;;;;;;;;;;;MA0Da,gBAAgB,GAAG,CAAC,EAC/B,QAAQ,EACR,GAAG,EACH,KAAK,EACL,QAAQ,EACR,WAAW,EACX,MAAM,EACN,KAAK,EACL,IAAI,EACJ,SAAS,EACT,WAAW,GAAG,YAAY,EAC1B,YAAY,EACZ,WAAW,EACX,UAAU,EACV,UAAU,EACV,IAAI,GAAG,IAAI,EACX,YAAY,EAAE,SAAS,EACvB,aAAa,EAAE,UAAU,GAC4B,KAAI;AACzD,IAAA,MAAM,WAAW,GAAGA,6BAAiB,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,oBAAoB,EAAE,QAAQ,EAAE,oBAAoB,EAAE,CAAC;AAC5H,IAAA,MAAM,OAAO,GAAGC,WAAK,EAAE;AACvB,IAAA,MAAM,SAAS,GAAGA,WAAK,EAAE;AACzB,IAAA,MAAM,MAAM,GAAGA,WAAK,EAAE;
|
|
1
|
+
{"version":3,"file":"ColorPickerField.cjs","sources":["../../../../../src/components/organisms/ColorPicker/components/ColorPickerField.tsx"],"sourcesContent":[null],"names":["useResolvedTestId","useId","useColorFieldEdit","toHexString","useRef","useCallback","setRef","_jsxs","_Fragment","_jsx","AriaDialogTrigger","Button","Plus","joinTestId","ScrollClosingPopover","AriaDialog","ColorPickerDialog","Provider","HintText"],"mappings":";;;;;;;;;;;;;;;;MA0Da,gBAAgB,GAAG,CAAC,EAC/B,QAAQ,EACR,GAAG,EACH,KAAK,EACL,QAAQ,EACR,WAAW,EACX,MAAM,EACN,KAAK,EACL,IAAI,EACJ,SAAS,EACT,WAAW,GAAG,YAAY,EAC1B,YAAY,EACZ,WAAW,EACX,UAAU,EACV,UAAU,EACV,IAAI,GAAG,IAAI,EACX,YAAY,EAAE,SAAS,EACvB,aAAa,EAAE,UAAU,GAC4B,KAAI;AACzD,IAAA,MAAM,WAAW,GAAGA,6BAAiB,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,oBAAoB,EAAE,QAAQ,EAAE,oBAAoB,EAAE,CAAC;AAC5H,IAAA,MAAM,OAAO,GAAGC,WAAK,EAAE;AACvB,IAAA,MAAM,SAAS,GAAGA,WAAK,EAAE;AACzB,IAAA,MAAM,MAAM,GAAGA,WAAK,EAAE;AACtB,IAAA,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAgB,EAAE,GAAGC,mCAAiB,CAAC;QAC9G,KAAK;QACL,YAAY;QACZ,QAAQ;QACR,WAAW;AACZ,KAAA,CAAC;;IAEF,MAAM,iBAAiB,GAAG,MAAK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,EAAC,KAAK,EAAA,aAAA,EAAcH,sBAAU,CAAC,WAAW,EAAE,QAAQ,CAAC,EAAA,QAAA,EAE/EJ,cAAA,CAACQ,6BAAQ,EAAA,EAAC,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,YACjD,QAAQ,EAAA,CACA,EAAA,CACO,EAAA,CACT,EAAA,CACT,EAAA,CACe,IACL,EACnB,WAAW,IAAI,KAAK,KACnBR,cAAA,CAACE,aAAM,EAAA,EACL,IAAI,EAAE,IAAI,EACV,KAAK,EAAC,WAAW,EACjB,UAAU,EAAE,UAAU,EAAA,YAAA,EACV,CAAA,OAAA,EAAU,KAAK,IAAI,SAAS,IAAI,QAAQ,CAAA,CAAE,EACtD,OAAO,EAAE,YAAY,EAAA,aAAA,EACRE,sBAAU,CAAC,WAAW,EAAE,QAAQ,CAAC,EAAA,QAAA,EAAA,QAAA,EAAA,CAGvC,CACV,IACG,EACL,IAAI,KACHJ,cAAA,CAACS,cAAQ,EAAA,EAAC,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAA,QAAA,EACvC,IAAI,EAAA,CACI,CACZ,CAAA,EAAA,CACG;AAEV;;"}
|
|
@@ -9,7 +9,7 @@ interface ColorPickerFieldBaseProps {
|
|
|
9
9
|
onChange: (value: string | null) => void;
|
|
10
10
|
/** Called with the value once an edit is over: the picker has closed, or Remove was pressed. Validate here, not on every pick. */
|
|
11
11
|
onChangeEnd?: (value: string | null) => void;
|
|
12
|
-
/** Called when focus leaves the trigger. */
|
|
12
|
+
/** Called when focus leaves the trigger, unless it went into the picker the trigger opened. */
|
|
13
13
|
onBlur?: () => void;
|
|
14
14
|
/** Name of the field, shown above the trigger; the types ask for this or `aria-label`. */
|
|
15
15
|
label?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorPickerField.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/ColorPicker/components/ColorPickerField.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,8CAA8C,CAAC;AAGxF,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,GAAG,EAA8B,MAAM,OAAO,CAAC;AAS7E,UAAU,yBAAyB;IACjC,wFAAwF;IACxF,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;IAC1B,qHAAqH;IACrH,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACjC,gIAAgI;IAChI,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IACzC,kIAAkI;IAClI,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAC7C
|
|
1
|
+
{"version":3,"file":"ColorPickerField.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/ColorPicker/components/ColorPickerField.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,8CAA8C,CAAC;AAGxF,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,GAAG,EAA8B,MAAM,OAAO,CAAC;AAS7E,UAAU,yBAAyB;IACjC,wFAAwF;IACxF,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;IAC1B,qHAAqH;IACrH,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACjC,gIAAgI;IAChI,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IACzC,kIAAkI;IAClI,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAC7C,+FAA+F;IAC/F,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,0FAA0F;IAC1F,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yFAAyF;IACzF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,wCAAwC;IACxC,SA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