@flipdish/ui-library 0.50.0 → 0.51.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/dist/components/atoms/Checkbox/index.cjs +8 -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 +9 -3
- package/dist/components/atoms/Checkbox/index.js.map +1 -1
- 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/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/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/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/unsavedChangesGuard.utils.cjs +97 -0
- package/dist/providers/UnsavedChangesGuardProvider/unsavedChangesGuard.utils.cjs.map +1 -0
- package/dist/providers/UnsavedChangesGuardProvider/unsavedChangesGuard.utils.d.ts +62 -0
- package/dist/providers/UnsavedChangesGuardProvider/unsavedChangesGuard.utils.d.ts.map +1 -0
- package/dist/providers/UnsavedChangesGuardProvider/unsavedChangesGuard.utils.js +88 -0
- package/dist/providers/UnsavedChangesGuardProvider/unsavedChangesGuard.utils.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SaveErrorAlert.cjs","sources":["../../../../../src/components/molecules/Alerts/components/SaveErrorAlert.tsx"],"sourcesContent":[null],"names":["useResolvedTestId","useAlertActions","_jsx","AlertFloating"],"mappings":";;;;;;;AAwBA;;;;;AAKG;MACU,cAAc,GAAG,CAAC,EAC7B,KAAK,EACL,WAAW,EACX,OAAO,EACP,SAAS,EACT,aAAa,GAAG,uBAAuB,EACvC,aAAa,EAAE,UAAU,GACL,KAAI;AACxB,IAAA,MAAM,UAAU,GAAGA,6BAAiB,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,kBAAkB,EAAE,CAAC;;AAEvH,IAAA,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,GAAGC,+BAAe,CAAC,aAAa,EAAE,eAAe,CAAC;IAEhF;;IAEEC,cAAA,CAAA,KAAA,EAAA,EAAK,IAAI,EAAC,OAAO,EAAC,GAAG,EAAE,SAAS,EAAA,QAAA,EAC9BA,cAAA,CAACC,mBAAa,EAAA,EACZ,KAAK,EAAC,OAAO,EACb,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,WAAW,EACxB,YAAY,EAAC,WAAW;;AAExB,YAAA,SAAS,EAAE,SAAS,CAAC,OAAO,CAAC,EAC7B,OAAO,EAAE,SAAS,CAAC,SAAS,CAAC,EAAA,aAAA,EAChB,UAAU,EAAA,CACvB,EAAA,CACE;AAEV;;"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface SaveErrorAlertProps {
|
|
2
|
+
/** What failed, such as "Your changes could not be saved". */
|
|
3
|
+
title: string;
|
|
4
|
+
/** What happened to the user's edits and what to do next. */
|
|
5
|
+
description: string;
|
|
6
|
+
/** Sends the same save again. */
|
|
7
|
+
onRetry: () => void;
|
|
8
|
+
/** Hides the alert; the caller stops rendering it. */
|
|
9
|
+
onDismiss: () => void;
|
|
10
|
+
/**
|
|
11
|
+
* A CSS selector for the control that takes focus when the alert leaves, found in the nearest form or section around
|
|
12
|
+
* it. Defaults to that form's submit button; name the control instead when a single control failed to save.
|
|
13
|
+
*/
|
|
14
|
+
returnFocusTo?: string;
|
|
15
|
+
/** Overrides the root `data-testid` (defaults to `fd-save-error-alert`); the retry, dismiss and close buttons derive theirs from it. */
|
|
16
|
+
'data-testid'?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Reports a save that failed outright: announced as an alert with "Try again", while the user's edits stay in place.
|
|
20
|
+
* Render it inside the form or section whose save failed, beside the control that started it.
|
|
21
|
+
*
|
|
22
|
+
* @summary inline alert for a failed save, with a retry
|
|
23
|
+
*/
|
|
24
|
+
export declare const SaveErrorAlert: ({ title, description, onRetry, onDismiss, returnFocusTo, "data-testid": dataTestId, }: SaveErrorAlertProps) => import("react").JSX.Element;
|
|
25
|
+
//# sourceMappingURL=SaveErrorAlert.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SaveErrorAlert.d.ts","sourceRoot":"","sources":["../../../../../src/components/molecules/Alerts/components/SaveErrorAlert.tsx"],"names":[],"mappings":"AAMA,MAAM,WAAW,mBAAmB;IAClC,8DAA8D;IAC9D,KAAK,EAAE,MAAM,CAAC;IACd,6DAA6D;IAC7D,WAAW,EAAE,MAAM,CAAC;IACpB,iCAAiC;IACjC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,sDAAsD;IACtD,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,wIAAwI;IACxI,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GAAI,uFAO5B,mBAAmB,gCAoBrB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useResolvedTestId } from '@flipdish/ui-library/utilities/testIdUtils';
|
|
3
|
+
import { useAlertActions } from '../hooks/useAlertActions.js';
|
|
4
|
+
import { AlertFloating } from './Alert.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Reports a save that failed outright: announced as an alert with "Try again", while the user's edits stay in place.
|
|
8
|
+
* Render it inside the form or section whose save failed, beside the control that started it.
|
|
9
|
+
*
|
|
10
|
+
* @summary inline alert for a failed save, with a retry
|
|
11
|
+
*/
|
|
12
|
+
const SaveErrorAlert = ({ title, description, onRetry, onDismiss, returnFocusTo = 'button[type="submit"]', 'data-testid': dataTestId, }) => {
|
|
13
|
+
const rootTestId = useResolvedTestId({ testId: dataTestId, segment: 'save-error-alert', rootName: 'save-error-alert' });
|
|
14
|
+
// Its own form or section only: the default names any submit button, and one elsewhere on the page is not this save's.
|
|
15
|
+
const { originRef, leaveThen } = useAlertActions(returnFocusTo, 'form, section');
|
|
16
|
+
return (
|
|
17
|
+
// Focus stays where the user was: a field keeps it through the save, so the alert only has to be announced.
|
|
18
|
+
jsx("div", { role: "alert", ref: originRef, children: jsx(AlertFloating, { color: "error", title: title, description: description, confirmLabel: "Try again",
|
|
19
|
+
// Both buttons remove the alert, so each hands focus on first.
|
|
20
|
+
onConfirm: leaveThen(onRetry), onClose: leaveThen(onDismiss), "data-testid": rootTestId }) }));
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export { SaveErrorAlert };
|
|
24
|
+
//# sourceMappingURL=SaveErrorAlert.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SaveErrorAlert.js","sources":["../../../../../src/components/molecules/Alerts/components/SaveErrorAlert.tsx"],"sourcesContent":[null],"names":["_jsx"],"mappings":";;;;;AAwBA;;;;;AAKG;MACU,cAAc,GAAG,CAAC,EAC7B,KAAK,EACL,WAAW,EACX,OAAO,EACP,SAAS,EACT,aAAa,GAAG,uBAAuB,EACvC,aAAa,EAAE,UAAU,GACL,KAAI;AACxB,IAAA,MAAM,UAAU,GAAG,iBAAiB,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,kBAAkB,EAAE,CAAC;;AAEvH,IAAA,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,eAAe,CAAC,aAAa,EAAE,eAAe,CAAC;IAEhF;;IAEEA,GAAA,CAAA,KAAA,EAAA,EAAK,IAAI,EAAC,OAAO,EAAC,GAAG,EAAE,SAAS,EAAA,QAAA,EAC9BA,GAAA,CAAC,aAAa,EAAA,EACZ,KAAK,EAAC,OAAO,EACb,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,WAAW,EACxB,YAAY,EAAC,WAAW;;AAExB,YAAA,SAAS,EAAE,SAAS,CAAC,OAAO,CAAC,EAC7B,OAAO,EAAE,SAAS,CAAC,SAAS,CAAC,EAAA,aAAA,EAChB,UAAU,EAAA,CACvB,EAAA,CACE;AAEV;;"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var useReturnFocus = require('../../../../hooks/__internal__/useReturnFocus/useReturnFocus.cjs');
|
|
4
|
+
|
|
5
|
+
// Nearest first, out to the page: the control named by `returnFocusTo` may sit beside the alert or anywhere around it.
|
|
6
|
+
const PAGE_CONTAINERS = 'form, section, main, body';
|
|
7
|
+
/**
|
|
8
|
+
* Wraps an alert's actions so focus leaves for the `returnFocusTo` control before the action runs: an action that
|
|
9
|
+
* removes the alert would otherwise drop focus to the top of the page.
|
|
10
|
+
*
|
|
11
|
+
* @param returnFocusTo The selector the consumer gave, or `undefined` to leave focus alone.
|
|
12
|
+
* @param containerSelector The containers the control is looked for in, nearest first; the whole page unless narrowed.
|
|
13
|
+
* @returns `originRef` for the alert's root, and `leaveThen`, which wraps a handler and keeps an absent one absent.
|
|
14
|
+
*/
|
|
15
|
+
const useAlertActions = (returnFocusTo, containerSelector = PAGE_CONTAINERS) => {
|
|
16
|
+
const { originRef, returnFocus } = useReturnFocus.useReturnFocus(returnFocusTo, containerSelector);
|
|
17
|
+
const leaveThen = (action) => action &&
|
|
18
|
+
(() => {
|
|
19
|
+
returnFocus();
|
|
20
|
+
action();
|
|
21
|
+
});
|
|
22
|
+
return { originRef, leaveThen };
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
exports.useAlertActions = useAlertActions;
|
|
26
|
+
//# sourceMappingURL=useAlertActions.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAlertActions.cjs","sources":["../../../../../src/components/molecules/Alerts/hooks/useAlertActions.ts"],"sourcesContent":[null],"names":["useReturnFocus"],"mappings":";;;;AAEA;AACA,MAAM,eAAe,GAAG,2BAA2B;AAEnD;;;;;;;AAOG;AACI,MAAM,eAAe,GAAG,CAAC,aAAiC,EAAE,iBAAiB,GAAG,eAAe,KAAI;AACxG,IAAA,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,GAAGA,6BAAc,CAAiB,aAAa,EAAE,iBAAiB,CAAC;AACnG,IAAA,MAAM,SAAS,GAAG,CAAC,MAAgC,KACjD,MAAM;AACN,SAAC,MAAK;AACJ,YAAA,WAAW,EAAE;AACb,YAAA,MAAM,EAAE;AACV,QAAA,CAAC,CAAC;AAEJ,IAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE;AACjC;;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wraps an alert's actions so focus leaves for the `returnFocusTo` control before the action runs: an action that
|
|
3
|
+
* removes the alert would otherwise drop focus to the top of the page.
|
|
4
|
+
*
|
|
5
|
+
* @param returnFocusTo The selector the consumer gave, or `undefined` to leave focus alone.
|
|
6
|
+
* @param containerSelector The containers the control is looked for in, nearest first; the whole page unless narrowed.
|
|
7
|
+
* @returns `originRef` for the alert's root, and `leaveThen`, which wraps a handler and keeps an absent one absent.
|
|
8
|
+
*/
|
|
9
|
+
export declare const useAlertActions: (returnFocusTo: string | undefined, containerSelector?: string) => {
|
|
10
|
+
originRef: import("react").RefObject<HTMLDivElement | null>;
|
|
11
|
+
leaveThen: (action: (() => void) | undefined) => (() => void) | undefined;
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=useAlertActions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAlertActions.d.ts","sourceRoot":"","sources":["../../../../../src/components/molecules/Alerts/hooks/useAlertActions.ts"],"names":[],"mappings":"AAKA;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,GAAI,eAAe,MAAM,GAAG,SAAS,EAAE,0BAAmC;;wBAEzE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS;CAQpD,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { useReturnFocus } from '../../../../hooks/__internal__/useReturnFocus/useReturnFocus.js';
|
|
2
|
+
|
|
3
|
+
// Nearest first, out to the page: the control named by `returnFocusTo` may sit beside the alert or anywhere around it.
|
|
4
|
+
const PAGE_CONTAINERS = 'form, section, main, body';
|
|
5
|
+
/**
|
|
6
|
+
* Wraps an alert's actions so focus leaves for the `returnFocusTo` control before the action runs: an action that
|
|
7
|
+
* removes the alert would otherwise drop focus to the top of the page.
|
|
8
|
+
*
|
|
9
|
+
* @param returnFocusTo The selector the consumer gave, or `undefined` to leave focus alone.
|
|
10
|
+
* @param containerSelector The containers the control is looked for in, nearest first; the whole page unless narrowed.
|
|
11
|
+
* @returns `originRef` for the alert's root, and `leaveThen`, which wraps a handler and keeps an absent one absent.
|
|
12
|
+
*/
|
|
13
|
+
const useAlertActions = (returnFocusTo, containerSelector = PAGE_CONTAINERS) => {
|
|
14
|
+
const { originRef, returnFocus } = useReturnFocus(returnFocusTo, containerSelector);
|
|
15
|
+
const leaveThen = (action) => action &&
|
|
16
|
+
(() => {
|
|
17
|
+
returnFocus();
|
|
18
|
+
action();
|
|
19
|
+
});
|
|
20
|
+
return { originRef, leaveThen };
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export { useAlertActions };
|
|
24
|
+
//# sourceMappingURL=useAlertActions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAlertActions.js","sources":["../../../../../src/components/molecules/Alerts/hooks/useAlertActions.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAEA;AACA,MAAM,eAAe,GAAG,2BAA2B;AAEnD;;;;;;;AAOG;AACI,MAAM,eAAe,GAAG,CAAC,aAAiC,EAAE,iBAAiB,GAAG,eAAe,KAAI;AACxG,IAAA,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,GAAG,cAAc,CAAiB,aAAa,EAAE,iBAAiB,CAAC;AACnG,IAAA,MAAM,SAAS,GAAG,CAAC,MAAgC,KACjD,MAAM;AACN,SAAC,MAAK;AACJ,YAAA,WAAW,EAAE;AACb,YAAA,MAAM,EAAE;AACV,QAAA,CAAC,CAAC;AAEJ,IAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE;AACjC;;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var Alert = require('./components/Alert.cjs');
|
|
4
|
+
var SaveErrorAlert = require('./components/SaveErrorAlert.cjs');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
exports.AlertFloating = Alert.AlertFloating;
|
|
9
|
+
exports.AlertFullWidth = Alert.AlertFullWidth;
|
|
10
|
+
exports.SaveErrorAlert = SaveErrorAlert.SaveErrorAlert;
|
|
11
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inline alerts and their ready-made forms: `AlertFloating` and `AlertFullWidth` for a message you word yourself, and
|
|
3
|
+
* the alerts built on them for one job each, such as reporting a save that failed.
|
|
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 Alerts exposes.
|
|
7
|
+
*/
|
|
8
|
+
export type { AlertFloatingProps, AlertFullWidthProps } from './components/Alert';
|
|
9
|
+
export { AlertFloating, AlertFullWidth } from './components/Alert';
|
|
10
|
+
export type { SaveErrorAlertProps } from './components/SaveErrorAlert';
|
|
11
|
+
export { SaveErrorAlert } from './components/SaveErrorAlert';
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/Alerts/index.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,YAAY,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAClF,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACnE,YAAY,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -1,45 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
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');
|
|
3
|
+
var Modals = require('@flipdish/ui-library/components/molecules/Modals');
|
|
7
4
|
|
|
8
|
-
/**
|
|
9
|
-
const DialogTrigger =
|
|
10
|
-
/**
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
};
|
|
5
|
+
/** @deprecated Import from `@flipdish/ui-library/components/molecules/Modals`. Removed in the next major. */
|
|
6
|
+
const DialogTrigger = Modals.DialogTrigger;
|
|
7
|
+
/** @deprecated Import from `@flipdish/ui-library/components/molecules/Modals`. Removed in the next major. */
|
|
8
|
+
const ModalOverlay = Modals.ModalOverlay;
|
|
9
|
+
/** @deprecated Import from `@flipdish/ui-library/components/molecules/Modals`. Removed in the next major. */
|
|
10
|
+
const Modal = Modals.Modal;
|
|
11
|
+
/** @deprecated Import from `@flipdish/ui-library/components/molecules/Modals`. Removed in the next major. */
|
|
12
|
+
const Dialog = Modals.Dialog;
|
|
43
13
|
|
|
44
14
|
exports.Dialog = Dialog;
|
|
45
15
|
exports.DialogTrigger = DialogTrigger;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../../src/components/molecules/Modal/index.tsx"],"sourcesContent":[null],"names":["
|
|
1
|
+
{"version":3,"file":"index.cjs","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;;;;;"}
|
|
@@ -1,37 +1,14 @@
|
|
|
1
|
-
import type
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
|
|
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;
|
|
1
|
+
import { type DialogProps as DialogPropsNext, type ModalOverlayProps as ModalOverlayPropsNext } from '@flipdish/ui-library/components/molecules/Modals';
|
|
2
|
+
/** @deprecated Import from `@flipdish/ui-library/components/molecules/Modals`. Removed in the next major. */
|
|
3
|
+
export declare const DialogTrigger: typeof import("react-aria-components").DialogTrigger;
|
|
4
|
+
/** @deprecated Import from `@flipdish/ui-library/components/molecules/Modals`. Removed in the next major. */
|
|
5
|
+
export declare const ModalOverlay: ({ "data-testid": dataTestId, ...props }: ModalOverlayPropsNext) => import("react").JSX.Element;
|
|
6
|
+
/** @deprecated Import from `@flipdish/ui-library/components/molecules/Modals`. Removed in the next major. */
|
|
7
|
+
export declare const Modal: (props: import("react-aria-components").ModalOverlayProps) => import("react").JSX.Element;
|
|
8
|
+
/** @deprecated Import from `@flipdish/ui-library/components/molecules/Modals`. Removed in the next major. */
|
|
9
|
+
export declare const Dialog: ({ "data-testid": dataTestId, ...props }: DialogPropsNext) => import("react").JSX.Element;
|
|
10
|
+
/** @deprecated Import from `@flipdish/ui-library/components/molecules/Modals`. Removed in the next major. */
|
|
11
|
+
export type ModalOverlayProps = ModalOverlayPropsNext;
|
|
12
|
+
/** @deprecated Import from `@flipdish/ui-library/components/molecules/Modals`. Removed in the next major. */
|
|
13
|
+
export type DialogProps = DialogPropsNext;
|
|
37
14
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -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"],"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,GAAGA,6BAAiB,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,oBAAoB,EAAE,QAAQ,EAAE,oBAAoB,EAAE,CAAC;AAC3H,IAAA,MAAM,OAAO,GAAGC,WAAK,EAAE;AACvB,IAAA,MAAM,aAAa,GAAGA,WAAK,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,QACEC,cAAA,CAACC,kBAAY,EAAA,EACX,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,YAAY;;;AAG1B,QAAA,yBAAyB,EAAE,YAAY,EAAA,aAAA,EAC1B,UAAU,EAAA,QAAA,EAEvBD,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,EAAA,QAAA,EAClFC,eAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,KAAK,EAAA,QAAA,EAAA,CAClBJ,uBAAI,EAAE,EAAE,OAAO,EAAE,SAAS,EAAC,oCAAoC,EAAA,QAAA,EAC5D,KAAK,EAAA,CACH,EACLA,cAAA,CAAA,GAAA,EAAA,EAAG,EAAE,EAAE,aAAa,EAAE,SAAS,EAAC,6BAA6B,EAAA,QAAA,EAC1D,WAAW,EAAA,CACV,EACJI,eAAA,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,aAAA,EAC1B,UAAU,EAAA,QAAA,EAEvBA,GAAA,CAAC,KAAK,EAAA,EAAC,SAAS,EAAC,qBAAqB,EAAA,QAAA,EACpCA,GAAA,CAAC,MAAM,EAAA,EAAC,IAAI,EAAC,aAAa,EAAA,iBAAA,EAAkB,OAAO,EAAA,kBAAA,EAAoB,aAAa,EAAA,QAAA,EAClFC,IAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,KAAK,EAAA,QAAA,EAAA,CAClBD,YAAI,EAAE,EAAE,OAAO,EAAE,SAAS,EAAC,oCAAoC,EAAA,QAAA,EAC5D,KAAK,EAAA,CACH,EACLA,GAAA,CAAA,GAAA,EAAA,EAAG,EAAE,EAAE,aAAa,EAAE,SAAS,EAAC,6BAA6B,EAAA,QAAA,EAC1D,WAAW,EAAA,CACV,EACJC,IAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,6DAA6D,EAAA,QAAA,EAAA,CAC1ED,GAAA,CAAC,MAAM,EAAA,EAAC,KAAK,EAAC,WAAW,EAAC,IAAI,EAAC,IAAI,EAAC,UAAU,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,EAAA,aAAA,EAAe,UAAU,CAAC,UAAU,EAAE,QAAQ,CAAC,EAAA,QAAA,EAAA,QAAA,EAAA,CAEnH,EACTA,GAAA,CAAC,MAAM,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,EACH,UAAU,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,48 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-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,aAAa,GAAGA;AAU7B;;;;;;AAMG;AACI,MAAM,YAAY,GAAG,CAAC,EAAE,aAAa,EAAE,UAAU,EAAE,GAAG,KAAK,EAAqB,KAAI;AACzF,IAAA,MAAM,UAAU,GAAGC,6BAAiB,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;IAEjG,QACEC,cAAA,CAACC,0BAAc,EAAA,EAAC,KAAK,EAAE,UAAU,EAAA,QAAA,EAC/BD,cAAA,CAACE,gCAAgB,EAAA,EAAA,GACX,KAAK,iBACI,UAAU,EACvB,SAAS,EAAE,CAAC,KAAK,KACfC,KAAE,CACA,mKAAmK;;YAEnK,+HAA+H;;AAE/H,YAAA,KAAK,CAAC,UAAU,IAAI,0CAA0C,EAC9D,KAAK,CAAC,SAAS,IAAI,2CAA2C,EAC9D,OAAO,KAAK,CAAC,SAAS,KAAK,UAAU,GAAG,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,SAAS,CACjF,EAAA,CAEH,EAAA,CACa;AAErB;AAEA;;;;;;AAMG;AACI,MAAM,KAAK,GAAG,CAAC,KAA4B,MAChDH,cAAA,CAACI,yBAAS,OACJ,KAAK,EACT,SAAS,EAAE,CAAC,KAAK,KACfD,KAAE,CACA,mGAAmG;;IAEnG,6EAA6E;;AAE7E,IAAA,KAAK,CAAC,UAAU,IAAI,6CAA6C,EACjE,KAAK,CAAC,SAAS,IAAI,8CAA8C,EACjE,OAAO,KAAK,CAAC,SAAS,KAAK,UAAU,GAAG,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,SAAS,CACjF,EAAA,CAEH;AAWJ;AACO,MAAM,MAAM,GAAG,CAAC,EAAE,aAAa,EAAE,UAAU,EAAE,GAAG,KAAK,EAAe,KAAI;AAC7E,IAAA,MAAM,MAAM,GAAGE,2BAAe,EAAE;IAChC,MAAM,YAAY,GAAG,UAAU,KAAK,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"}
|