@flipdish/ui-library 0.44.0 → 0.45.1
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/organisms/SidePanel/components/SidePanelRegion.cjs +8 -0
- package/dist/components/organisms/SidePanel/components/SidePanelRegion.cjs.map +1 -1
- package/dist/components/organisms/SidePanel/components/SidePanelRegion.d.ts.map +1 -1
- package/dist/components/organisms/SidePanel/components/SidePanelRegion.js +8 -0
- package/dist/components/organisms/SidePanel/components/SidePanelRegion.js.map +1 -1
- package/dist/components/organisms/SlideoutMenu/components/SlideoutShell.cjs +27 -60
- package/dist/components/organisms/SlideoutMenu/components/SlideoutShell.cjs.map +1 -1
- package/dist/components/organisms/SlideoutMenu/components/SlideoutShell.d.ts +2 -3
- package/dist/components/organisms/SlideoutMenu/components/SlideoutShell.d.ts.map +1 -1
- package/dist/components/organisms/SlideoutMenu/components/SlideoutShell.js +27 -60
- package/dist/components/organisms/SlideoutMenu/components/SlideoutShell.js.map +1 -1
- package/dist/components/organisms/SlideoutMenu/hooks/useCloseWhenCovered.cjs +31 -0
- package/dist/components/organisms/SlideoutMenu/hooks/useCloseWhenCovered.cjs.map +1 -0
- package/dist/components/organisms/SlideoutMenu/hooks/useCloseWhenCovered.d.ts +15 -0
- package/dist/components/organisms/SlideoutMenu/hooks/useCloseWhenCovered.d.ts.map +1 -0
- package/dist/components/organisms/SlideoutMenu/hooks/useCloseWhenCovered.js +29 -0
- package/dist/components/organisms/SlideoutMenu/hooks/useCloseWhenCovered.js.map +1 -0
- package/dist/components/organisms/SlideoutMenu/hooks/useDialogFocusSettle.cjs +41 -0
- package/dist/components/organisms/SlideoutMenu/hooks/useDialogFocusSettle.cjs.map +1 -0
- package/dist/components/organisms/SlideoutMenu/hooks/useDialogFocusSettle.d.ts +19 -0
- package/dist/components/organisms/SlideoutMenu/hooks/useDialogFocusSettle.d.ts.map +1 -0
- package/dist/components/organisms/SlideoutMenu/hooks/useDialogFocusSettle.js +39 -0
- package/dist/components/organisms/SlideoutMenu/hooks/useDialogFocusSettle.js.map +1 -0
- package/dist/components/organisms/SlideoutMenu/hooks/usePageEscapeDismiss.cjs +36 -0
- package/dist/components/organisms/SlideoutMenu/hooks/usePageEscapeDismiss.cjs.map +1 -0
- package/dist/components/organisms/SlideoutMenu/hooks/usePageEscapeDismiss.d.ts +21 -0
- package/dist/components/organisms/SlideoutMenu/hooks/usePageEscapeDismiss.d.ts.map +1 -0
- package/dist/components/organisms/SlideoutMenu/hooks/usePageEscapeDismiss.js +34 -0
- package/dist/components/organisms/SlideoutMenu/hooks/usePageEscapeDismiss.js.map +1 -0
- package/dist/components/organisms/SlideoutMenu/hooks/useSlideoutState.cjs +3 -2
- package/dist/components/organisms/SlideoutMenu/hooks/useSlideoutState.cjs.map +1 -1
- package/dist/components/organisms/SlideoutMenu/hooks/useSlideoutState.d.ts.map +1 -1
- package/dist/components/organisms/SlideoutMenu/hooks/useSlideoutState.js +4 -3
- package/dist/components/organisms/SlideoutMenu/hooks/useSlideoutState.js.map +1 -1
- package/dist/components/organisms/SlideoutMenu/index.cjs +5 -0
- package/dist/components/organisms/SlideoutMenu/index.cjs.map +1 -1
- package/dist/components/organisms/SlideoutMenu/index.d.ts +16 -9
- package/dist/components/organisms/SlideoutMenu/index.d.ts.map +1 -1
- package/dist/components/organisms/SlideoutMenu/index.js +5 -0
- package/dist/components/organisms/SlideoutMenu/index.js.map +1 -1
- package/dist/components/organisms/SlideoutMenu/providers/PageArea.context.cjs +4 -4
- package/dist/components/organisms/SlideoutMenu/providers/PageArea.context.d.ts +4 -4
- package/dist/components/organisms/SlideoutMenu/providers/PageArea.context.js +4 -4
- package/dist/hooks/__internal__/usePanelFocus/usePanelFocus.cjs +24 -8
- package/dist/hooks/__internal__/usePanelFocus/usePanelFocus.cjs.map +1 -1
- package/dist/hooks/__internal__/usePanelFocus/usePanelFocus.d.ts +3 -2
- package/dist/hooks/__internal__/usePanelFocus/usePanelFocus.d.ts.map +1 -1
- package/dist/hooks/__internal__/usePanelFocus/usePanelFocus.js +25 -9
- package/dist/hooks/__internal__/usePanelFocus/usePanelFocus.js.map +1 -1
- package/dist/providers/ThemeProvider/Theme.context.cjs +17 -0
- package/dist/providers/ThemeProvider/Theme.context.cjs.map +1 -0
- package/dist/providers/ThemeProvider/Theme.context.d.ts +16 -0
- package/dist/providers/ThemeProvider/Theme.context.d.ts.map +1 -0
- package/dist/providers/ThemeProvider/Theme.context.js +14 -0
- package/dist/providers/ThemeProvider/Theme.context.js.map +1 -0
- package/dist/providers/ThemeProvider/index.cjs +3 -11
- package/dist/providers/ThemeProvider/index.cjs.map +1 -1
- package/dist/providers/ThemeProvider/index.d.ts +1 -14
- package/dist/providers/ThemeProvider/index.d.ts.map +1 -1
- package/dist/providers/ThemeProvider/index.js +3 -10
- package/dist/providers/ThemeProvider/index.js.map +1 -1
- package/dist/utilities/__internal__/pageCoverUtils/pageCover.utils.cjs +30 -0
- package/dist/utilities/__internal__/pageCoverUtils/pageCover.utils.cjs.map +1 -0
- package/dist/utilities/__internal__/pageCoverUtils/pageCover.utils.d.ts +19 -0
- package/dist/utilities/__internal__/pageCoverUtils/pageCover.utils.d.ts.map +1 -0
- package/dist/utilities/__internal__/pageCoverUtils/pageCover.utils.js +26 -0
- package/dist/utilities/__internal__/pageCoverUtils/pageCover.utils.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { RefObject } from 'react';
|
|
2
|
+
interface UseDialogFocusSettleOptions {
|
|
3
|
+
/** The dialog to focus when a pointer open left focus on the row that opened it. */
|
|
4
|
+
dialogRef: RefObject<HTMLElement | null>;
|
|
5
|
+
/** False once the panel is animating out. */
|
|
6
|
+
isPresent: boolean;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Focuses the dialog one frame after the panel opens, when a row opened by mouse selects on
|
|
10
|
+
* pointerdown and the browser then lands focus back on that row. If nothing inside holds focus
|
|
11
|
+
* by that frame, the dialog takes it. A pointer or key before the frame means the user has moved
|
|
12
|
+
* on, such as to the next row, and the frame is dropped so focus is not pulled back.
|
|
13
|
+
*
|
|
14
|
+
* @param options The dialog element and whether the panel is still present.
|
|
15
|
+
* @returns Nothing. Focus is moved on the dialog element.
|
|
16
|
+
*/
|
|
17
|
+
export declare const useDialogFocusSettle: ({ dialogRef, isPresent }: UseDialogFocusSettleOptions) => void;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=useDialogFocusSettle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDialogFocusSettle.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/SlideoutMenu/hooks/useDialogFocusSettle.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,UAAU,2BAA2B;IACnC,oFAAoF;IACpF,SAAS,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IACzC,6CAA6C;IAC7C,SAAS,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,GAAI,0BAA0B,2BAA2B,KAAG,IAqB5F,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import { getFocusedElement } from '../../../../utilities/__internal__/focusUtils/focus.utils.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Focuses the dialog one frame after the panel opens, when a row opened by mouse selects on
|
|
6
|
+
* pointerdown and the browser then lands focus back on that row. If nothing inside holds focus
|
|
7
|
+
* by that frame, the dialog takes it. A pointer or key before the frame means the user has moved
|
|
8
|
+
* on, such as to the next row, and the frame is dropped so focus is not pulled back.
|
|
9
|
+
*
|
|
10
|
+
* @param options The dialog element and whether the panel is still present.
|
|
11
|
+
* @returns Nothing. Focus is moved on the dialog element.
|
|
12
|
+
*/
|
|
13
|
+
const useDialogFocusSettle = ({ dialogRef, isPresent }) => {
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
if (!isPresent)
|
|
16
|
+
return;
|
|
17
|
+
const stopWatching = () => {
|
|
18
|
+
document.removeEventListener('pointerdown', cancel, true);
|
|
19
|
+
document.removeEventListener('keydown', cancel, true);
|
|
20
|
+
};
|
|
21
|
+
const frame = requestAnimationFrame(() => {
|
|
22
|
+
stopWatching();
|
|
23
|
+
const dialog = dialogRef.current;
|
|
24
|
+
const focused = getFocusedElement();
|
|
25
|
+
if (dialog && !(focused && dialog.contains(focused)))
|
|
26
|
+
dialog.focus({ preventScroll: true });
|
|
27
|
+
});
|
|
28
|
+
const cancel = () => {
|
|
29
|
+
cancelAnimationFrame(frame);
|
|
30
|
+
stopWatching();
|
|
31
|
+
};
|
|
32
|
+
document.addEventListener('pointerdown', cancel, true);
|
|
33
|
+
document.addEventListener('keydown', cancel, true);
|
|
34
|
+
return cancel;
|
|
35
|
+
}, [dialogRef, isPresent]);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export { useDialogFocusSettle };
|
|
39
|
+
//# sourceMappingURL=useDialogFocusSettle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDialogFocusSettle.js","sources":["../../../../../src/components/organisms/SlideoutMenu/hooks/useDialogFocusSettle.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAaA;;;;;;;;AAQG;AACI,MAAM,oBAAoB,GAAG,CAAC,EAAE,SAAS,EAAE,SAAS,EAA+B,KAAU;IAClG,SAAS,CAAC,MAAK;AACb,QAAA,IAAI,CAAC,SAAS;YAAE;QAChB,MAAM,YAAY,GAAG,MAAK;YACxB,QAAQ,CAAC,mBAAmB,CAAC,aAAa,EAAE,MAAM,EAAE,IAAI,CAAC;YACzD,QAAQ,CAAC,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC;AACvD,QAAA,CAAC;AACD,QAAA,MAAM,KAAK,GAAG,qBAAqB,CAAC,MAAK;AACvC,YAAA,YAAY,EAAE;AACd,YAAA,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO;AAChC,YAAA,MAAM,OAAO,GAAG,iBAAiB,EAAE;AACnC,YAAA,IAAI,MAAM,IAAI,EAAE,OAAO,IAAI,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;gBAAE,MAAM,CAAC,KAAK,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;AAC7F,QAAA,CAAC,CAAC;QACF,MAAM,MAAM,GAAG,MAAK;YAClB,oBAAoB,CAAC,KAAK,CAAC;AAC3B,YAAA,YAAY,EAAE;AAChB,QAAA,CAAC;QACD,QAAQ,CAAC,gBAAgB,CAAC,aAAa,EAAE,MAAM,EAAE,IAAI,CAAC;QACtD,QAAQ,CAAC,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC;AAClD,QAAA,OAAO,MAAM;AACf,IAAA,CAAC,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;AAC5B;;"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var hotkeys_utils = require('../../../../utilities/__internal__/hotkeysUtils/hotkeys.utils.cjs');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Closes the panel on Escape pressed anywhere on the page. The panel is the transient thing the
|
|
8
|
+
* user opened. An overlay that already claimed the key (it prevents default and runs before this
|
|
9
|
+
* document listener), a composing key, Escape from inside the panel, and Escape from a field
|
|
10
|
+
* outside it are left alone. Focus stays where the user put it.
|
|
11
|
+
*
|
|
12
|
+
* @param options The panel element, whether dismiss is active, and how to close.
|
|
13
|
+
* @returns Nothing. The close is reported through `onClose`.
|
|
14
|
+
*/
|
|
15
|
+
const usePageEscapeDismiss = ({ panelRef, enabled, onClose }) => {
|
|
16
|
+
const closeRef = React.useRef(onClose);
|
|
17
|
+
closeRef.current = onClose;
|
|
18
|
+
React.useEffect(() => {
|
|
19
|
+
if (!enabled)
|
|
20
|
+
return;
|
|
21
|
+
const onKeyDown = (event) => {
|
|
22
|
+
if (event.key !== 'Escape' || event.defaultPrevented || event.isComposing)
|
|
23
|
+
return;
|
|
24
|
+
if (event.target instanceof Node && panelRef.current?.contains(event.target))
|
|
25
|
+
return;
|
|
26
|
+
if (hotkeys_utils.isTypingInField(event))
|
|
27
|
+
return;
|
|
28
|
+
closeRef.current();
|
|
29
|
+
};
|
|
30
|
+
document.addEventListener('keydown', onKeyDown);
|
|
31
|
+
return () => document.removeEventListener('keydown', onKeyDown);
|
|
32
|
+
}, [enabled, panelRef]);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
exports.usePageEscapeDismiss = usePageEscapeDismiss;
|
|
36
|
+
//# sourceMappingURL=usePageEscapeDismiss.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePageEscapeDismiss.cjs","sources":["../../../../../src/components/organisms/SlideoutMenu/hooks/usePageEscapeDismiss.ts"],"sourcesContent":[null],"names":["useRef","useEffect","isTypingInField"],"mappings":";;;;;AAeA;;;;;;;;AAQG;AACI,MAAM,oBAAoB,GAAG,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAA+B,KAAU;AACxG,IAAA,MAAM,QAAQ,GAAGA,YAAM,CAAC,OAAO,CAAC;AAChC,IAAA,QAAQ,CAAC,OAAO,GAAG,OAAO;IAE1BC,eAAS,CAAC,MAAK;AACb,QAAA,IAAI,CAAC,OAAO;YAAE;AACd,QAAA,MAAM,SAAS,GAAG,CAAC,KAAoB,KAAI;AACzC,YAAA,IAAI,KAAK,CAAC,GAAG,KAAK,QAAQ,IAAI,KAAK,CAAC,gBAAgB,IAAI,KAAK,CAAC,WAAW;gBAAE;AAC3E,YAAA,IAAI,KAAK,CAAC,MAAM,YAAY,IAAI,IAAI,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC;gBAAE;YAC9E,IAAIC,6BAAe,CAAC,KAAK,CAAC;gBAAE;YAC5B,QAAQ,CAAC,OAAO,EAAE;AACpB,QAAA,CAAC;AACD,QAAA,QAAQ,CAAC,gBAAgB,CAAC,SAAS,EAAE,SAAS,CAAC;QAC/C,OAAO,MAAM,QAAQ,CAAC,mBAAmB,CAAC,SAAS,EAAE,SAAS,CAAC;AACjE,IAAA,CAAC,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;AACzB;;"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { RefObject } from 'react';
|
|
2
|
+
interface UsePageEscapeDismissOptions {
|
|
3
|
+
/** The panel. Escape whose target is inside it is left to the overlay, which already closes. */
|
|
4
|
+
panelRef: RefObject<HTMLElement | null>;
|
|
5
|
+
/** False once the panel is leaving, and while keyboard dismiss is disabled. */
|
|
6
|
+
enabled: boolean;
|
|
7
|
+
/** Closes the panel. The listener calls the close from the latest render. */
|
|
8
|
+
onClose: () => void;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Closes the panel on Escape pressed anywhere on the page. The panel is the transient thing the
|
|
12
|
+
* user opened. An overlay that already claimed the key (it prevents default and runs before this
|
|
13
|
+
* document listener), a composing key, Escape from inside the panel, and Escape from a field
|
|
14
|
+
* outside it are left alone. Focus stays where the user put it.
|
|
15
|
+
*
|
|
16
|
+
* @param options The panel element, whether dismiss is active, and how to close.
|
|
17
|
+
* @returns Nothing. The close is reported through `onClose`.
|
|
18
|
+
*/
|
|
19
|
+
export declare const usePageEscapeDismiss: ({ panelRef, enabled, onClose }: UsePageEscapeDismissOptions) => void;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=usePageEscapeDismiss.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePageEscapeDismiss.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/SlideoutMenu/hooks/usePageEscapeDismiss.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,UAAU,2BAA2B;IACnC,gGAAgG;IAChG,QAAQ,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IACxC,+EAA+E;IAC/E,OAAO,EAAE,OAAO,CAAC;IACjB,6EAA6E;IAC7E,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,GAAI,gCAAgC,2BAA2B,KAAG,IAelG,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { useRef, useEffect } from 'react';
|
|
2
|
+
import { isTypingInField } from '../../../../utilities/__internal__/hotkeysUtils/hotkeys.utils.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Closes the panel on Escape pressed anywhere on the page. The panel is the transient thing the
|
|
6
|
+
* user opened. An overlay that already claimed the key (it prevents default and runs before this
|
|
7
|
+
* document listener), a composing key, Escape from inside the panel, and Escape from a field
|
|
8
|
+
* outside it are left alone. Focus stays where the user put it.
|
|
9
|
+
*
|
|
10
|
+
* @param options The panel element, whether dismiss is active, and how to close.
|
|
11
|
+
* @returns Nothing. The close is reported through `onClose`.
|
|
12
|
+
*/
|
|
13
|
+
const usePageEscapeDismiss = ({ panelRef, enabled, onClose }) => {
|
|
14
|
+
const closeRef = useRef(onClose);
|
|
15
|
+
closeRef.current = onClose;
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
if (!enabled)
|
|
18
|
+
return;
|
|
19
|
+
const onKeyDown = (event) => {
|
|
20
|
+
if (event.key !== 'Escape' || event.defaultPrevented || event.isComposing)
|
|
21
|
+
return;
|
|
22
|
+
if (event.target instanceof Node && panelRef.current?.contains(event.target))
|
|
23
|
+
return;
|
|
24
|
+
if (isTypingInField(event))
|
|
25
|
+
return;
|
|
26
|
+
closeRef.current();
|
|
27
|
+
};
|
|
28
|
+
document.addEventListener('keydown', onKeyDown);
|
|
29
|
+
return () => document.removeEventListener('keydown', onKeyDown);
|
|
30
|
+
}, [enabled, panelRef]);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export { usePageEscapeDismiss };
|
|
34
|
+
//# sourceMappingURL=usePageEscapeDismiss.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePageEscapeDismiss.js","sources":["../../../../../src/components/organisms/SlideoutMenu/hooks/usePageEscapeDismiss.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAeA;;;;;;;;AAQG;AACI,MAAM,oBAAoB,GAAG,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAA+B,KAAU;AACxG,IAAA,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC;AAChC,IAAA,QAAQ,CAAC,OAAO,GAAG,OAAO;IAE1B,SAAS,CAAC,MAAK;AACb,QAAA,IAAI,CAAC,OAAO;YAAE;AACd,QAAA,MAAM,SAAS,GAAG,CAAC,KAAoB,KAAI;AACzC,YAAA,IAAI,KAAK,CAAC,GAAG,KAAK,QAAQ,IAAI,KAAK,CAAC,gBAAgB,IAAI,KAAK,CAAC,WAAW;gBAAE;AAC3E,YAAA,IAAI,KAAK,CAAC,MAAM,YAAY,IAAI,IAAI,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC;gBAAE;YAC9E,IAAI,eAAe,CAAC,KAAK,CAAC;gBAAE;YAC5B,QAAQ,CAAC,OAAO,EAAE;AACpB,QAAA,CAAC;AACD,QAAA,QAAQ,CAAC,gBAAgB,CAAC,SAAS,EAAE,SAAS,CAAC;QAC/C,OAAO,MAAM,QAAQ,CAAC,mBAAmB,CAAC,SAAS,EAAE,SAAS,CAAC;AACjE,IAAA,CAAC,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;AACzB;;"}
|
|
@@ -13,10 +13,11 @@ const useSlideoutState = ({ isOpen, defaultOpen, onOpenChange }) => {
|
|
|
13
13
|
const [uncontrolledOpen, setUncontrolledOpen] = React.useState(defaultOpen ?? false);
|
|
14
14
|
const isOpenControlled = isOpen !== undefined;
|
|
15
15
|
const resolvedOpen = isOpenControlled ? isOpen : uncontrolledOpen;
|
|
16
|
-
// The latest callback and value live in refs so the returned API keeps its identity across renders.
|
|
16
|
+
// The latest callback and value live in refs so the returned API keeps its identity across renders. Synced in a layout
|
|
17
|
+
// effect, so a close asked for from a passive effect in the same commit, such as a side panel's cover, sees the open state.
|
|
17
18
|
const onOpenChangeRef = React.useRef(onOpenChange);
|
|
18
19
|
const isOpenRef = React.useRef(resolvedOpen);
|
|
19
|
-
React.
|
|
20
|
+
React.useLayoutEffect(() => {
|
|
20
21
|
onOpenChangeRef.current = onOpenChange;
|
|
21
22
|
isOpenRef.current = resolvedOpen;
|
|
22
23
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSlideoutState.cjs","sources":["../../../../../src/components/organisms/SlideoutMenu/hooks/useSlideoutState.ts"],"sourcesContent":[null],"names":["useState","useRef","
|
|
1
|
+
{"version":3,"file":"useSlideoutState.cjs","sources":["../../../../../src/components/organisms/SlideoutMenu/hooks/useSlideoutState.ts"],"sourcesContent":[null],"names":["useState","useRef","useLayoutEffect","useCallback","useMemo"],"mappings":";;;;AAmBA;;;;;;AAMG;AACI,MAAM,gBAAgB,GAAG,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,YAAY,EAA2B,KAAuB;AACpH,IAAA,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAGA,cAAQ,CAAC,WAAW,IAAI,KAAK,CAAC;AAC9E,IAAA,MAAM,gBAAgB,GAAG,MAAM,KAAK,SAAS;IAC7C,MAAM,YAAY,GAAG,gBAAgB,GAAG,MAAM,GAAG,gBAAgB;;;AAIjE,IAAA,MAAM,eAAe,GAAGC,YAAM,CAAC,YAAY,CAAC;AAC5C,IAAA,MAAM,SAAS,GAAGA,YAAM,CAAC,YAAY,CAAC;IACtCC,qBAAe,CAAC,MAAK;AACnB,QAAA,eAAe,CAAC,OAAO,GAAG,YAAY;AACtC,QAAA,SAAS,CAAC,OAAO,GAAG,YAAY;AAClC,IAAA,CAAC,CAAC;AAEF,IAAA,MAAM,OAAO,GAAGC,iBAAW,CACzB,CAAC,IAAa,KAAI;AAChB,QAAA,IAAI,CAAC,gBAAgB;YAAE,mBAAmB,CAAC,IAAI,CAAC;AAChD,QAAA,IAAI,IAAI,KAAK,SAAS,CAAC,OAAO;AAAE,YAAA,eAAe,CAAC,OAAO,GAAG,IAAI,CAAC;AACjE,IAAA,CAAC,EACD,CAAC,gBAAgB,CAAC,CACnB;AAED,IAAA,OAAOC,aAAO,CACZ,OAAO;AACL,QAAA,MAAM,EAAE,YAAY;QACpB,OAAO;AACP,QAAA,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC;AACzB,QAAA,KAAK,EAAE,MAAM,OAAO,CAAC,KAAK,CAAC;QAC3B,MAAM,EAAE,MAAM,OAAO,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC;AAC1C,KAAA,CAAC,EACF,CAAC,YAAY,EAAE,OAAO,CAAC,CACxB;AACH;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSlideoutState.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/SlideoutMenu/hooks/useSlideoutState.ts"],"names":[],"mappings":"AAIA,UAAU,uBAAuB;IAC/B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;CAC1C;AAED,wHAAwH;AACxH,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACnC,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,GAAI,uCAAuC,uBAAuB,KAAG,
|
|
1
|
+
{"version":3,"file":"useSlideoutState.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/SlideoutMenu/hooks/useSlideoutState.ts"],"names":[],"mappings":"AAIA,UAAU,uBAAuB;IAC/B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;CAC1C;AAED,wHAAwH;AACxH,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACnC,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,GAAI,uCAAuC,uBAAuB,KAAG,iBAgCjG,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useState, useRef,
|
|
1
|
+
import { useState, useRef, useLayoutEffect, useCallback, useMemo } from 'react';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Owns the panel's open state, controlled or uncontrolled by the usual pair of props, in the shape
|
|
@@ -11,10 +11,11 @@ const useSlideoutState = ({ isOpen, defaultOpen, onOpenChange }) => {
|
|
|
11
11
|
const [uncontrolledOpen, setUncontrolledOpen] = useState(defaultOpen ?? false);
|
|
12
12
|
const isOpenControlled = isOpen !== undefined;
|
|
13
13
|
const resolvedOpen = isOpenControlled ? isOpen : uncontrolledOpen;
|
|
14
|
-
// The latest callback and value live in refs so the returned API keeps its identity across renders.
|
|
14
|
+
// The latest callback and value live in refs so the returned API keeps its identity across renders. Synced in a layout
|
|
15
|
+
// effect, so a close asked for from a passive effect in the same commit, such as a side panel's cover, sees the open state.
|
|
15
16
|
const onOpenChangeRef = useRef(onOpenChange);
|
|
16
17
|
const isOpenRef = useRef(resolvedOpen);
|
|
17
|
-
|
|
18
|
+
useLayoutEffect(() => {
|
|
18
19
|
onOpenChangeRef.current = onOpenChange;
|
|
19
20
|
isOpenRef.current = resolvedOpen;
|
|
20
21
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSlideoutState.js","sources":["../../../../../src/components/organisms/SlideoutMenu/hooks/useSlideoutState.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAmBA;;;;;;AAMG;AACI,MAAM,gBAAgB,GAAG,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,YAAY,EAA2B,KAAuB;AACpH,IAAA,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,QAAQ,CAAC,WAAW,IAAI,KAAK,CAAC;AAC9E,IAAA,MAAM,gBAAgB,GAAG,MAAM,KAAK,SAAS;IAC7C,MAAM,YAAY,GAAG,gBAAgB,GAAG,MAAM,GAAG,gBAAgB
|
|
1
|
+
{"version":3,"file":"useSlideoutState.js","sources":["../../../../../src/components/organisms/SlideoutMenu/hooks/useSlideoutState.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAmBA;;;;;;AAMG;AACI,MAAM,gBAAgB,GAAG,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,YAAY,EAA2B,KAAuB;AACpH,IAAA,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,QAAQ,CAAC,WAAW,IAAI,KAAK,CAAC;AAC9E,IAAA,MAAM,gBAAgB,GAAG,MAAM,KAAK,SAAS;IAC7C,MAAM,YAAY,GAAG,gBAAgB,GAAG,MAAM,GAAG,gBAAgB;;;AAIjE,IAAA,MAAM,eAAe,GAAG,MAAM,CAAC,YAAY,CAAC;AAC5C,IAAA,MAAM,SAAS,GAAG,MAAM,CAAC,YAAY,CAAC;IACtC,eAAe,CAAC,MAAK;AACnB,QAAA,eAAe,CAAC,OAAO,GAAG,YAAY;AACtC,QAAA,SAAS,CAAC,OAAO,GAAG,YAAY;AAClC,IAAA,CAAC,CAAC;AAEF,IAAA,MAAM,OAAO,GAAG,WAAW,CACzB,CAAC,IAAa,KAAI;AAChB,QAAA,IAAI,CAAC,gBAAgB;YAAE,mBAAmB,CAAC,IAAI,CAAC;AAChD,QAAA,IAAI,IAAI,KAAK,SAAS,CAAC,OAAO;AAAE,YAAA,eAAe,CAAC,OAAO,GAAG,IAAI,CAAC;AACjE,IAAA,CAAC,EACD,CAAC,gBAAgB,CAAC,CACnB;AAED,IAAA,OAAO,OAAO,CACZ,OAAO;AACL,QAAA,MAAM,EAAE,YAAY;QACpB,OAAO;AACP,QAAA,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC;AACzB,QAAA,KAAK,EAAE,MAAM,OAAO,CAAC,KAAK,CAAC;QAC3B,MAAM,EAAE,MAAM,OAAO,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC;AAC1C,KAAA,CAAC,EACF,CAAC,YAAY,EAAE,OAAO,CAAC,CACxB;AACH;;"}
|
|
@@ -10,6 +10,7 @@ var utils = require('@react-aria/utils');
|
|
|
10
10
|
var React = require('react');
|
|
11
11
|
var reactAriaComponents = require('react-aria-components');
|
|
12
12
|
var SlideoutShell = require('./components/SlideoutShell.cjs');
|
|
13
|
+
var PageArea_context = require('./providers/PageArea.context.cjs');
|
|
13
14
|
var SlideoutMenu_context = require('./providers/SlideoutMenu.context.cjs');
|
|
14
15
|
var slideoutMenu_utils = require('./utilities/slideoutMenu.utils.cjs');
|
|
15
16
|
|
|
@@ -47,6 +48,9 @@ const Footer = ({ 'data-testid': dataTestId, ...props }) => {
|
|
|
47
48
|
return (jsxRuntime.jsx("div", { ...props, "data-testid": footerTestId, className: cx.cx('w-full p-4 shadow-[inset_0px_1px_0px_0px] shadow-border-secondary md:px-6', props.className) }));
|
|
48
49
|
};
|
|
49
50
|
Footer.displayName = 'SlideoutFooter';
|
|
51
|
+
/** Names what the slideouts below it cover below `lg`, for a layout of its own; `AppShell` does it for its page area. */
|
|
52
|
+
const PageArea = ({ areaRef, children }) => jsxRuntime.jsx(PageArea_context.PageAreaContext.Provider, { value: areaRef, children: children });
|
|
53
|
+
PageArea.displayName = 'SlideoutPageArea';
|
|
50
54
|
/**
|
|
51
55
|
* Panel that slides in from the right edge and floats over the page without dimming or blocking it,
|
|
52
56
|
* for the detail of the record the user just selected. It covers the page area only, never the header, the
|
|
@@ -61,6 +65,7 @@ SlideoutMenu.Trigger = reactAriaComponents.DialogTrigger;
|
|
|
61
65
|
SlideoutMenu.Content = Content;
|
|
62
66
|
SlideoutMenu.Header = Header;
|
|
63
67
|
SlideoutMenu.Footer = Footer;
|
|
68
|
+
SlideoutMenu.PageArea = PageArea;
|
|
64
69
|
|
|
65
70
|
exports.APP_HEADER_HEIGHT_VAR = slideoutMenu_utils.APP_HEADER_HEIGHT_VAR;
|
|
66
71
|
exports.APP_SIDEBAR_WIDTH_VAR = slideoutMenu_utils.APP_SIDEBAR_WIDTH_VAR;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../../src/components/organisms/SlideoutMenu/index.tsx"],"sourcesContent":[null],"names":["_jsx","SlideoutShell","useTestIdPrefix","joinTestId","cx","useContext","SlideoutMenuContext","useRef","useObjectRef","useLayoutEffect","_jsxs","ButtonUtility","ArrowUpRight","CloseButton","AriaDialogTrigger"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../../src/components/organisms/SlideoutMenu/index.tsx"],"sourcesContent":[null],"names":["_jsx","SlideoutShell","useTestIdPrefix","joinTestId","cx","useContext","SlideoutMenuContext","useRef","useObjectRef","useLayoutEffect","_jsxs","ButtonUtility","ArrowUpRight","CloseButton","PageAreaContext","AriaDialogTrigger"],"mappings":";;;;;;;;;;;;;;;;AAsDA,MAAM,IAAI,GAAG,CAAC,KAAwB,KAA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AAM,YAAY,GAAG,UAAU,KAAK,MAAM,GAAGC,sBAAU,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,SAAS,CAAC;;AAGtF,IAAA,QACEH,cAAA,CAAA,KAAA,EAAA,EAAA,GACM,KAAK,iBACI,YAAY,EACzB,SAAS,EAAEI,KAAE,CAAC,2EAA2E,EAAE,KAAK,CAAC,SAAS,CAAC,EAAA,CAC3G;AAEN,CAAC;AACD,MAAM,CAAC,WAAW,GAAG,gBAAgB;AAarC;AACA,MAAM,QAAQ,GAAG,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAyB,KAAKJ,eAACc,gCAAe,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,OAAO,EAAA,QAAA,EAAG,QAAQ,EAAA,CAA4B;AAClJ,QAAQ,CAAC,WAAW,GAAG,kBAAkB;AAEzC;;;;;;;AAOG;AACH,MAAM,YAAY,GAAG;AAOrB,YAAY,CAAC,WAAW,GAAG,cAAc;AAEzC,YAAY,CAAC,OAAO,GAAGC,iCAAiB;AACxC,YAAY,CAAC,OAAO,GAAG,OAAO;AAC9B,YAAY,CAAC,MAAM,GAAG,MAAM;AAC5B,YAAY,CAAC,MAAM,GAAG,MAAM;AAC5B,YAAY,CAAC,QAAQ,GAAG,QAAQ;;;;;"}
|
|
@@ -24,15 +24,6 @@ export interface SlideoutMenuProps {
|
|
|
24
24
|
* back to its variable when the others are omitted.
|
|
25
25
|
*/
|
|
26
26
|
bounds?: SlideoutBounds;
|
|
27
|
-
/**
|
|
28
|
-
* The page area the panel covers below `lg`: the element `bounds` describes. The panel makes it `inert` while it covers it,
|
|
29
|
-
* so keyboard and screen reader skip what nobody can see, and restores it as it closes. Without it, inside `AppShell` the
|
|
30
|
-
* shell's page area is covered, and elsewhere the app's root from `UIProvider` when overlays portal outside that root, as
|
|
31
|
-
* they do with `scopeId`; in a micro-frontend that root is the page area under the host's chrome. Pass it when the root
|
|
32
|
-
* holds the app's own header, or when overlays portal into the root. The element must stay mounted while the panel is
|
|
33
|
-
* open, and nothing else may write `inert` on it.
|
|
34
|
-
*/
|
|
35
|
-
pageAreaRef?: RefObject<HTMLElement | null>;
|
|
36
27
|
/** Names the dialog for assistive technology. Defaults to "Slideout menu"; prefer the name of what the panel shows. */
|
|
37
28
|
'aria-label'?: string;
|
|
38
29
|
/** Names the dialog by an element inside it, such as the heading in `Header`, instead of `aria-label`. */
|
|
@@ -80,6 +71,21 @@ declare const Footer: {
|
|
|
80
71
|
}): import("react").JSX.Element;
|
|
81
72
|
displayName: string;
|
|
82
73
|
};
|
|
74
|
+
export interface SlideoutPageAreaProps {
|
|
75
|
+
/**
|
|
76
|
+
* The element under the box slideouts cover below `lg`: the page area, with a side panel that covers it, never the header
|
|
77
|
+
* or the sidebar. It goes `inert` while a slideout covers it and is restored as the slideout closes, so it must stay
|
|
78
|
+
* mounted meanwhile, and nothing else may write `inert` on it.
|
|
79
|
+
*/
|
|
80
|
+
areaRef: RefObject<HTMLElement | null>;
|
|
81
|
+
/** The layout, wrapping every place a slideout renders from, such as the header as well as the page. */
|
|
82
|
+
children: ReactNode;
|
|
83
|
+
}
|
|
84
|
+
/** Names what the slideouts below it cover below `lg`, for a layout of its own; `AppShell` does it for its page area. */
|
|
85
|
+
declare const PageArea: {
|
|
86
|
+
({ areaRef, children }: SlideoutPageAreaProps): import("react").JSX.Element;
|
|
87
|
+
displayName: string;
|
|
88
|
+
};
|
|
83
89
|
/**
|
|
84
90
|
* Panel that slides in from the right edge and floats over the page without dimming or blocking it,
|
|
85
91
|
* for the detail of the record the user just selected. It covers the page area only, never the header, the
|
|
@@ -93,6 +99,7 @@ declare const SlideoutMenu: typeof Menu & {
|
|
|
93
99
|
Content: typeof Content;
|
|
94
100
|
Header: typeof Header;
|
|
95
101
|
Footer: typeof Footer;
|
|
102
|
+
PageArea: typeof PageArea;
|
|
96
103
|
};
|
|
97
104
|
export { SlideoutMenu };
|
|
98
105
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/organisms/SlideoutMenu/index.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,qBAAqB,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzE,OAAO,EAAE,aAAa,IAAI,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC3E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/organisms/SlideoutMenu/index.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,qBAAqB,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzE,OAAO,EAAE,aAAa,IAAI,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC3E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAItE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAErE,YAAY,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACtE,YAAY,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAExH,MAAM,WAAW,iBAAiB;IAChC,uGAAuG;IACvG,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,4CAA4C;IAC5C,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACzC,wFAAwF;IACxF,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC;;;;;OAKG;IACH,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,uHAAuH;IACvH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,0GAA0G;IAC1G,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qB;;CAAoF,CAAC;AAGnJ;;;;;;;GAOG;AACH,QAAA,MAAM,YAAY,EAAW,OAAO,IAAI,GAAG;IACzC,OAAO,EAAE,OAAO,iBAAiB,CAAC;IAClC,OAAO,EAAE,OAAO,OAAO,CAAC;IACxB,MAAM,EAAE,OAAO,MAAM,CAAC;IACtB,MAAM,EAAE,OAAO,MAAM,CAAC;IACtB,QAAQ,EAAE,OAAO,QAAQ,CAAC;CAC3B,CAAC;AASF,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -8,6 +8,7 @@ import { useObjectRef } from '@react-aria/utils';
|
|
|
8
8
|
import { useContext, useRef, useLayoutEffect } from 'react';
|
|
9
9
|
import { DialogTrigger } from 'react-aria-components';
|
|
10
10
|
import { SlideoutShell } from './components/SlideoutShell.js';
|
|
11
|
+
import { PageAreaContext } from './providers/PageArea.context.js';
|
|
11
12
|
import { SlideoutMenuContext } from './providers/SlideoutMenu.context.js';
|
|
12
13
|
export { APP_HEADER_HEIGHT_VAR, APP_SIDEBAR_WIDTH_VAR, APP_SIDE_PANEL_WIDTH_VAR } from './utilities/slideoutMenu.utils.js';
|
|
13
14
|
|
|
@@ -45,6 +46,9 @@ const Footer = ({ 'data-testid': dataTestId, ...props }) => {
|
|
|
45
46
|
return (jsx("div", { ...props, "data-testid": footerTestId, className: cx('w-full p-4 shadow-[inset_0px_1px_0px_0px] shadow-border-secondary md:px-6', props.className) }));
|
|
46
47
|
};
|
|
47
48
|
Footer.displayName = 'SlideoutFooter';
|
|
49
|
+
/** Names what the slideouts below it cover below `lg`, for a layout of its own; `AppShell` does it for its page area. */
|
|
50
|
+
const PageArea = ({ areaRef, children }) => jsx(PageAreaContext.Provider, { value: areaRef, children: children });
|
|
51
|
+
PageArea.displayName = 'SlideoutPageArea';
|
|
48
52
|
/**
|
|
49
53
|
* Panel that slides in from the right edge and floats over the page without dimming or blocking it,
|
|
50
54
|
* for the detail of the record the user just selected. It covers the page area only, never the header, the
|
|
@@ -59,6 +63,7 @@ SlideoutMenu.Trigger = DialogTrigger;
|
|
|
59
63
|
SlideoutMenu.Content = Content;
|
|
60
64
|
SlideoutMenu.Header = Header;
|
|
61
65
|
SlideoutMenu.Footer = Footer;
|
|
66
|
+
SlideoutMenu.PageArea = PageArea;
|
|
62
67
|
|
|
63
68
|
export { SlideoutMenu };
|
|
64
69
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/organisms/SlideoutMenu/index.tsx"],"sourcesContent":[null],"names":["_jsx","_jsxs","AriaDialogTrigger"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/organisms/SlideoutMenu/index.tsx"],"sourcesContent":[null],"names":["_jsx","_jsxs","AriaDialogTrigger"],"mappings":";;;;;;;;;;;;;;AAsDA,MAAM,IAAI,GAAG,CAAC,KAAwB,KAAKA,GAAA,CAAC,aAAa,EAAA,EAAA,GAAK,KAAK,EAAA,CAAI;AACvE,IAAI,CAAC,WAAW,GAAG,cAAc;AAEjC,MAAM,OAAO,GAAG,CAAC,EAAE,aAAa,EAAE,UAAU,EAAE,GAAG,KAAK,EAA6D,KAAI;AACrH,IAAA,MAAM,MAAM,GAAG,eAAe,EAAE;IAChC,MAAM,aAAa,GAAG,UAAU,KAAK,MAAM,GAAG,UAAU,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,SAAS,CAAC;;AAGxF,IAAA,QACEA,GAAA,CAAA,KAAA,EAAA,EAAA,GACM,KAAK,iBACI,aAAa,EAC1B,SAAS,EAAE,EAAE,CAAC,4EAA4E,EAAE,KAAK,CAAC,SAAS,CAAC,EAAA,CAC5G;AAEN,CAAC;AACD,OAAO,CAAC,WAAW,GAAG,iBAAiB;AAiBvC,MAAM,MAAM,GAAG,CAAC,EACd,SAAS,EACT,QAAQ,EACR,OAAO,EACP,UAAU,EACV,IAAI,EACJ,SAAS,GAAG,gBAAgB,EAC5B,WAAW,EACX,aAAa,EA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C5B,YAAY,CAAC,MAAM,GAAG,MAAM;AAC5B,YAAY,CAAC,QAAQ,GAAG,QAAQ;;"}
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
var React = require('react');
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Provided by `AppShell
|
|
7
|
-
* together with a side panel
|
|
8
|
-
* and assistive technology skip what nobody can see. Context
|
|
9
|
-
* the
|
|
6
|
+
* Provided by `AppShell`, or by `SlideoutMenu.PageArea` in a layout of its own: the element under the box a
|
|
7
|
+
* `SlideoutMenu` covers below `lg`, the page area together with a side panel beside it. The panel makes it
|
|
8
|
+
* inert while it covers it, so keyboard and assistive technology skip what nobody can see. Context, so a
|
|
9
|
+
* panel anywhere in the layout finds it, the header included.
|
|
10
10
|
*/
|
|
11
11
|
const PageAreaContext = React.createContext(undefined);
|
|
12
12
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { RefObject } from 'react';
|
|
2
2
|
/**
|
|
3
|
-
* Provided by `AppShell
|
|
4
|
-
* together with a side panel
|
|
5
|
-
* and assistive technology skip what nobody can see. Context
|
|
6
|
-
* the
|
|
3
|
+
* Provided by `AppShell`, or by `SlideoutMenu.PageArea` in a layout of its own: the element under the box a
|
|
4
|
+
* `SlideoutMenu` covers below `lg`, the page area together with a side panel beside it. The panel makes it
|
|
5
|
+
* inert while it covers it, so keyboard and assistive technology skip what nobody can see. Context, so a
|
|
6
|
+
* panel anywhere in the layout finds it, the header included.
|
|
7
7
|
*/
|
|
8
8
|
export declare const PageAreaContext: import("react").Context<RefObject<HTMLElement | null> | undefined>;
|
|
9
9
|
//# sourceMappingURL=PageArea.context.d.ts.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createContext } from 'react';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Provided by `AppShell
|
|
5
|
-
* together with a side panel
|
|
6
|
-
* and assistive technology skip what nobody can see. Context
|
|
7
|
-
* the
|
|
4
|
+
* Provided by `AppShell`, or by `SlideoutMenu.PageArea` in a layout of its own: the element under the box a
|
|
5
|
+
* `SlideoutMenu` covers below `lg`, the page area together with a side panel beside it. The panel makes it
|
|
6
|
+
* inert while it covers it, so keyboard and assistive technology skip what nobody can see. Context, so a
|
|
7
|
+
* panel anywhere in the layout finds it, the header included.
|
|
8
8
|
*/
|
|
9
9
|
const PageAreaContext = createContext(undefined);
|
|
10
10
|
|
|
@@ -9,18 +9,25 @@ const focusableSiblingBefore = (panel) => {
|
|
|
9
9
|
const sibling = panel.previousElementSibling;
|
|
10
10
|
return sibling instanceof HTMLElement && sibling.tabIndex >= 0 ? sibling : null;
|
|
11
11
|
};
|
|
12
|
-
/** Whether a hand-back can land: a control, or a region given a `tabindex`,
|
|
13
|
-
const canTakeFocus = (element) => element instanceof HTMLElement &&
|
|
12
|
+
/** Whether a hand-back can land: a control, or a region given a `tabindex`, neither disabled nor under a cover. */
|
|
13
|
+
const canTakeFocus = (element) => element instanceof HTMLElement &&
|
|
14
|
+
(element.tabIndex >= 0 || element.hasAttribute('tabindex')) &&
|
|
15
|
+
!element.matches(':disabled') &&
|
|
16
|
+
element.closest('[inert]') === null;
|
|
14
17
|
/**
|
|
15
18
|
* What covers an element under an inert ancestor: the last panel to cover that ancestor, else the sibling after it, as a
|
|
16
|
-
* side panel sits after the page it covers
|
|
19
|
+
* side panel sits after the page it covers, else the first region inside that sibling given a `tabindex` that can take
|
|
20
|
+
* focus, as a host wraps its side panel. Nothing when none of those can.
|
|
17
21
|
*/
|
|
18
22
|
const coverOver = (element) => {
|
|
19
23
|
const covered = element.closest('[inert]');
|
|
20
24
|
if (!(covered instanceof HTMLElement))
|
|
21
25
|
return null;
|
|
22
26
|
const candidate = inert_utils.lastCoverOf(covered) ?? covered.nextElementSibling;
|
|
23
|
-
|
|
27
|
+
if (canTakeFocus(candidate))
|
|
28
|
+
return candidate;
|
|
29
|
+
const regions = candidate ? [...candidate.querySelectorAll('[tabindex]')] : [];
|
|
30
|
+
return regions.find(canTakeFocus) ?? null;
|
|
24
31
|
};
|
|
25
32
|
/**
|
|
26
33
|
* What the panel covers: the given element, unless the panel sits inside it, as overlays do without a scoped anchor, when
|
|
@@ -39,8 +46,8 @@ const resolveCovered = (panel, coveredRef) => {
|
|
|
39
46
|
* a popover does.
|
|
40
47
|
*
|
|
41
48
|
* @param options See `UsePanelFocusOptions`.
|
|
42
|
-
* @returns a capture-phase focus handler to spread onto the panel element,
|
|
43
|
-
* close at another control after a content swap
|
|
49
|
+
* @returns a capture-phase focus handler to spread onto the panel element, `setOpener`, which points the hand-back on
|
|
50
|
+
* close at another control after a content swap, and `liftCover`, which lifts the cover ahead of the close that follows
|
|
44
51
|
*/
|
|
45
52
|
const usePanelFocus = ({ panelRef, isPresent, isDesktop, coveredRef, shouldFocusOnMount, contentKey }) => {
|
|
46
53
|
const openerRef = React.useRef(null);
|
|
@@ -99,6 +106,7 @@ const usePanelFocus = ({ panelRef, isPresent, isDesktop, coveredRef, shouldFocus
|
|
|
99
106
|
// React runs every cleanup before any effect in a commit, so the cover lifts before the hand-back above lands focus in the
|
|
100
107
|
// page. Covers are counted per element, so two panels over the same page restore its own `inert` only when the last lifts.
|
|
101
108
|
const isCovering = isPresent && !isDesktop;
|
|
109
|
+
const liftCoverRef = React.useRef(null);
|
|
102
110
|
React.useEffect(() => {
|
|
103
111
|
const panel = panelRef.current;
|
|
104
112
|
// Only a given element is covered; the panel's siblings are the layout's to cover, as `AppShell` does for a side panel.
|
|
@@ -110,8 +118,16 @@ const usePanelFocus = ({ panelRef, isPresent, isDesktop, coveredRef, shouldFocus
|
|
|
110
118
|
const focused = focus_utils.getFocusedElement();
|
|
111
119
|
if (focused && covered.contains(focused))
|
|
112
120
|
panel.focus({ preventScroll: true });
|
|
113
|
-
|
|
121
|
+
const lift = inert_utils.coverElement(covered, panel);
|
|
122
|
+
liftCoverRef.current = lift;
|
|
123
|
+
return () => {
|
|
124
|
+
lift();
|
|
125
|
+
liftCoverRef.current = null;
|
|
126
|
+
};
|
|
114
127
|
}, [panelRef, coveredRef, isCovering]);
|
|
128
|
+
// For a close that another panel caused: that panel is mounting under this cover in the same pass, and its focus call would
|
|
129
|
+
// be refused until the cover lifts at the next commit. Lifting is idempotent, so the effect's own cleanup stays harmless.
|
|
130
|
+
const liftCover = React.useCallback(() => liftCoverRef.current?.(), []);
|
|
115
131
|
// Swapping content unmounts whatever held focus, which drops it on the page. The region takes it, so Tab stays inside and
|
|
116
132
|
// closing can still hand it back. Content that focuses itself on mount (an `autoFocus` input) has done so by now and keeps it.
|
|
117
133
|
const previousContentKey = React.useRef(contentKey);
|
|
@@ -133,7 +149,7 @@ const usePanelFocus = ({ panelRef, isPresent, isDesktop, coveredRef, shouldFocus
|
|
|
133
149
|
const setOpener = React.useCallback((element) => {
|
|
134
150
|
openerRef.current = element;
|
|
135
151
|
}, []);
|
|
136
|
-
return { onFocusCapture, setOpener };
|
|
152
|
+
return { onFocusCapture, setOpener, liftCover };
|
|
137
153
|
};
|
|
138
154
|
|
|
139
155
|
exports.usePanelFocus = usePanelFocus;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePanelFocus.cjs","sources":["../../../../src/hooks/__internal__/usePanelFocus/usePanelFocus.ts"],"sourcesContent":[null],"names":["lastCoverOf","useRef","useState","getFocusedElement","useEffect","coverElement","
|
|
1
|
+
{"version":3,"file":"usePanelFocus.cjs","sources":["../../../../src/hooks/__internal__/usePanelFocus/usePanelFocus.ts"],"sourcesContent":[null],"names":["lastCoverOf","useRef","useState","getFocusedElement","useEffect","coverElement","useCallback","useLayoutEffect"],"mappings":";;;;;;AAOA;AACA,MAAM,sBAAsB,GAAG,CAAC,KAAkB,KAAwB;AACxE,IAAA,MAAM,OAAO,GAAG,KAAK,CAAC,sBAAsB;AAE5C,IAAA,OAAO,OAAO,YAAY,WAAW,IAAI,OAAO,CAAC,QAAQ,IAAI,CAAC,GAAG,OAAO,GAAG,IAAI;AACjF,CAAC;AAED;AACA,MAAM,YAAY,GAAG,C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AAE,YAAA,SAAS,CAAC,OAAO,GAAG,IAAI;AAChI,IAAA,CAAC;;AAGD,IAAA,MAAM,SAAS,GAAGG,iBAAW,CAAC,CAAC,OAAoB,KAAI;AACrD,QAAA,SAAS,CAAC,OAAO,GAAG,OAAO;IAC7B,CAAC,EAAE,EAAE,CAAC;AAEN,IAAA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,SAAS,EAAE;AACjD;;"}
|
|
@@ -24,12 +24,13 @@ interface UsePanelFocusOptions {
|
|
|
24
24
|
* a popover does.
|
|
25
25
|
*
|
|
26
26
|
* @param options See `UsePanelFocusOptions`.
|
|
27
|
-
* @returns a capture-phase focus handler to spread onto the panel element,
|
|
28
|
-
* close at another control after a content swap
|
|
27
|
+
* @returns a capture-phase focus handler to spread onto the panel element, `setOpener`, which points the hand-back on
|
|
28
|
+
* close at another control after a content swap, and `liftCover`, which lifts the cover ahead of the close that follows
|
|
29
29
|
*/
|
|
30
30
|
export declare const usePanelFocus: ({ panelRef, isPresent, isDesktop, coveredRef, shouldFocusOnMount, contentKey }: UsePanelFocusOptions) => {
|
|
31
31
|
onFocusCapture: (event: FocusEvent<HTMLElement>) => void;
|
|
32
32
|
setOpener: (element: HTMLElement) => void;
|
|
33
|
+
liftCover: () => void | undefined;
|
|
33
34
|
};
|
|
34
35
|
export {};
|
|
35
36
|
//# sourceMappingURL=usePanelFocus.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePanelFocus.d.ts","sourceRoot":"","sources":["../../../../src/hooks/__internal__/usePanelFocus/usePanelFocus.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"usePanelFocus.d.ts","sourceRoot":"","sources":["../../../../src/hooks/__internal__/usePanelFocus/usePanelFocus.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AA6CnD,UAAU,oBAAoB;IAC5B,QAAQ,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IACxC,kEAAkE;IAClE,SAAS,EAAE,OAAO,CAAC;IACnB,2EAA2E;IAC3E,SAAS,EAAE,OAAO,CAAC;IACnB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAC3C,wGAAwG;IACxG,kBAAkB,EAAE,OAAO,CAAC;IAC5B,6GAA6G;IAC7G,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,aAAa,GAAI,gFAAgF,oBAAoB;4BA2FjG,UAAU,CAAC,WAAW,CAAC;yBAMd,WAAW;;CAKpD,CAAC"}
|