@charcuterie/ui 4.27.3 → 4.28.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/Accordion/AccordionSection.d.ts.map +1 -1
- package/dist/Accordion/AccordionSection.js +43 -4
- package/dist/Accordion/AccordionSection.js.map +1 -1
- package/dist/Combobox/Combobox.d.ts.map +1 -1
- package/dist/Combobox/Combobox.js +3 -3
- package/dist/Combobox/Combobox.js.map +1 -1
- package/dist/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/DatePicker/DatePicker.js +3 -3
- package/dist/DatePicker/DatePicker.js.map +1 -1
- package/dist/Dialog/Dialog.d.ts +7 -1
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +2 -2
- package/dist/Dialog/Dialog.js.map +1 -1
- package/dist/GroupedList/GroupedList.d.ts +9 -2
- package/dist/GroupedList/GroupedList.d.ts.map +1 -1
- package/dist/GroupedList/GroupedList.js +39 -5
- package/dist/GroupedList/GroupedList.js.map +1 -1
- package/dist/GroupedList/GroupedListRow.d.ts +4 -1
- package/dist/GroupedList/GroupedListRow.d.ts.map +1 -1
- package/dist/GroupedList/GroupedListRow.js +3 -3
- package/dist/GroupedList/GroupedListRow.js.map +1 -1
- package/dist/GroupedList/GroupedListRows.d.ts +16 -0
- package/dist/GroupedList/GroupedListRows.d.ts.map +1 -0
- package/dist/GroupedList/GroupedListRows.js +17 -0
- package/dist/GroupedList/GroupedListRows.js.map +1 -0
- package/dist/Listbox/Listbox.d.ts.map +1 -1
- package/dist/Listbox/Listbox.js +6 -4
- package/dist/Listbox/Listbox.js.map +1 -1
- package/dist/Menu/Menu.d.ts.map +1 -1
- package/dist/Menu/Menu.js +6 -4
- package/dist/Menu/Menu.js.map +1 -1
- package/dist/Modal/Modal.d.ts +7 -1
- package/dist/Modal/Modal.d.ts.map +1 -1
- package/dist/Modal/Modal.js +1 -1
- package/dist/Modal/Modal.js.map +1 -1
- package/dist/Motion/useLastPresentValue.d.ts +21 -0
- package/dist/Motion/useLastPresentValue.d.ts.map +1 -0
- package/dist/Motion/useLastPresentValue.js +30 -0
- package/dist/Motion/useLastPresentValue.js.map +1 -0
- package/dist/Motion/useListMotion.d.ts +111 -0
- package/dist/Motion/useListMotion.d.ts.map +1 -0
- package/dist/Motion/useListMotion.js +358 -0
- package/dist/Motion/useListMotion.js.map +1 -0
- package/dist/Motion/usePresence.d.ts +81 -0
- package/dist/Motion/usePresence.d.ts.map +1 -0
- package/dist/Motion/usePresence.js +131 -0
- package/dist/Motion/usePresence.js.map +1 -0
- package/dist/Motion/useValueChangeMotion.d.ts +52 -0
- package/dist/Motion/useValueChangeMotion.d.ts.map +1 -0
- package/dist/Motion/useValueChangeMotion.js +87 -0
- package/dist/Motion/useValueChangeMotion.js.map +1 -0
- package/dist/Overlay/OverlayPanel.d.ts +18 -1
- package/dist/Overlay/OverlayPanel.d.ts.map +1 -1
- package/dist/Overlay/OverlayPanel.js +83 -11
- package/dist/Overlay/OverlayPanel.js.map +1 -1
- package/dist/Overlay/SharedBackdrop.d.ts +3 -0
- package/dist/Overlay/SharedBackdrop.d.ts.map +1 -1
- package/dist/Overlay/SharedBackdrop.js +8 -2
- package/dist/Overlay/SharedBackdrop.js.map +1 -1
- package/dist/Overlay/focusHistory.d.ts +16 -0
- package/dist/Overlay/focusHistory.d.ts.map +1 -0
- package/dist/Overlay/focusHistory.js +110 -0
- package/dist/Overlay/focusHistory.js.map +1 -0
- package/dist/Overlay/useAnchoredOverlay.d.ts +17 -3
- package/dist/Overlay/useAnchoredOverlay.d.ts.map +1 -1
- package/dist/Overlay/useAnchoredOverlay.js +23 -5
- package/dist/Overlay/useAnchoredOverlay.js.map +1 -1
- package/dist/Popover/Popover.d.ts.map +1 -1
- package/dist/Popover/Popover.js +4 -2
- package/dist/Popover/Popover.js.map +1 -1
- package/dist/ReorderList/ReorderList.d.ts +6 -0
- package/dist/ReorderList/ReorderList.d.ts.map +1 -1
- package/dist/ReorderList/ReorderList.js +23 -6
- package/dist/ReorderList/ReorderList.js.map +1 -1
- package/dist/TableViewport/TableViewport.d.ts.map +1 -1
- package/dist/TableViewport/TableViewport.js +9 -1
- package/dist/TableViewport/TableViewport.js.map +1 -1
- package/dist/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/Tooltip/Tooltip.js +16 -13
- package/dist/Tooltip/Tooltip.js.map +1 -1
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -1
- package/dist/styles.css +191 -1
- package/package.json +6 -6
- package/src/Accordion/AccordionSection.tsx +63 -4
- package/src/Combobox/Combobox.tsx +8 -2
- package/src/DatePicker/DatePicker.tsx +7 -1
- package/src/Dialog/Dialog.tsx +8 -0
- package/src/GroupedList/GroupedList.mdx +3 -2
- package/src/GroupedList/GroupedList.test.tsx +283 -0
- package/src/GroupedList/GroupedList.tsx +88 -44
- package/src/GroupedList/GroupedListRow.tsx +8 -0
- package/src/GroupedList/GroupedListRows.tsx +51 -0
- package/src/Listbox/Listbox.tsx +9 -1
- package/src/Menu/Menu.tsx +9 -1
- package/src/Modal/Modal.tsx +8 -0
- package/src/Motion/useLastPresentValue.test.tsx +66 -0
- package/src/Motion/useLastPresentValue.ts +38 -0
- package/src/Motion/useListMotion.test.tsx +527 -0
- package/src/Motion/useListMotion.ts +674 -0
- package/src/Motion/usePresence.test.tsx +223 -0
- package/src/Motion/usePresence.ts +252 -0
- package/src/Motion/useValueChangeMotion.test.tsx +131 -0
- package/src/Motion/useValueChangeMotion.ts +110 -0
- package/src/Overlay/OverlayPanel.server.test.ts +30 -0
- package/src/Overlay/OverlayPanel.tsx +146 -14
- package/src/Overlay/SharedBackdrop.tsx +17 -2
- package/src/Overlay/focusHistory.ts +152 -0
- package/src/Overlay/overlayReturnFocus.storyHelpers.tsx +242 -0
- package/src/Overlay/overlayReturnFocus.test.tsx +255 -0
- package/src/Overlay/useAnchoredOverlay.ts +56 -4
- package/src/Popover/Popover.tsx +9 -1
- package/src/ReorderList/ReorderList.test.tsx +76 -0
- package/src/ReorderList/ReorderList.tsx +86 -48
- package/src/TableViewport/TableViewport.tsx +4 -0
- package/src/Tooltip/Tooltip.tsx +32 -4
- package/src/index.ts +30 -0
- package/src/styles.css +191 -1
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { useCallback, useState } from "react";
|
|
2
|
+
const POP_ANIMATIONS = new Set([
|
|
3
|
+
"charcuterie-value-pop",
|
|
4
|
+
"charcuterie-value-pop-again",
|
|
5
|
+
]);
|
|
6
|
+
/**
|
|
7
|
+
* Props that make an element pop briefly each time `value` changes: a
|
|
8
|
+
* balance after a purchase, a count after an add, a status after a
|
|
9
|
+
* save. They show the user which part of the screen their action
|
|
10
|
+
* changed.
|
|
11
|
+
*
|
|
12
|
+
* ```tsx
|
|
13
|
+
* const changeMotion = useValueChangeMotion(balance.spendable)
|
|
14
|
+
*
|
|
15
|
+
* <div
|
|
16
|
+
* {...changeMotion}
|
|
17
|
+
* className={toClassName("inline-block text-3xl tabular-nums", changeMotion.className)}
|
|
18
|
+
* >
|
|
19
|
+
* {formatPoints(balance.spendable)}
|
|
20
|
+
* </div>
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* ### What counts as a change
|
|
24
|
+
*
|
|
25
|
+
* The first value does not pop, and neither does the first real value
|
|
26
|
+
* after `null` or `undefined` — that is data arriving, not an action
|
|
27
|
+
* changing it. Values are compared with `Object.is`, so pass the
|
|
28
|
+
* number or string that is shown, not a fresh object.
|
|
29
|
+
*
|
|
30
|
+
* ### Why the class comes off, and why there are two
|
|
31
|
+
*
|
|
32
|
+
* The class is removed when its animation ends. An element that goes
|
|
33
|
+
* from `display: none` back to shown restarts its CSS animation, so a
|
|
34
|
+
* class left on would pop again each time a hidden tab is shown, for
|
|
35
|
+
* a change made long ago.
|
|
36
|
+
*
|
|
37
|
+
* A CSS animation restarts only when its name changes. A change that
|
|
38
|
+
* arrives while the last pop is still running switches to a second
|
|
39
|
+
* class, with identical keyframes under another name, so two
|
|
40
|
+
* purchases in a row pop twice.
|
|
41
|
+
*
|
|
42
|
+
* ### On the element
|
|
43
|
+
*
|
|
44
|
+
* Spread the props onto the element that shows the value. If it has
|
|
45
|
+
* its own `onAnimationEnd`, call both. The pop animates the `scale`
|
|
46
|
+
* property, which does nothing on a plain inline element: give the
|
|
47
|
+
* element `inline-block` or `block` layout. Under reduced motion the
|
|
48
|
+
* class has no animation and the new value is simply shown.
|
|
49
|
+
*/
|
|
50
|
+
export const useValueChangeMotion = (value) => {
|
|
51
|
+
const [state, setState] = useState({
|
|
52
|
+
changeCount: 0,
|
|
53
|
+
settledCount: 0,
|
|
54
|
+
value,
|
|
55
|
+
});
|
|
56
|
+
if (!Object.is(state.value, value)) {
|
|
57
|
+
const isArrival = state.value === null || state.value === undefined;
|
|
58
|
+
setState({
|
|
59
|
+
changeCount: isArrival
|
|
60
|
+
? state.changeCount
|
|
61
|
+
: state.changeCount + 1,
|
|
62
|
+
settledCount: isArrival
|
|
63
|
+
? state.changeCount
|
|
64
|
+
: state.settledCount,
|
|
65
|
+
value,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
const onAnimationEnd = useCallback((event) => {
|
|
69
|
+
if (event.target === event.currentTarget &&
|
|
70
|
+
POP_ANIMATIONS.has(event.animationName)) {
|
|
71
|
+
setState((previous) => ({
|
|
72
|
+
...previous,
|
|
73
|
+
settledCount: previous.changeCount,
|
|
74
|
+
}));
|
|
75
|
+
}
|
|
76
|
+
}, []);
|
|
77
|
+
const isPopping = state.changeCount !== state.settledCount;
|
|
78
|
+
return {
|
|
79
|
+
className: isPopping
|
|
80
|
+
? state.changeCount % 2 === 1
|
|
81
|
+
? "charcuterie-value-changed"
|
|
82
|
+
: "charcuterie-value-changed-again"
|
|
83
|
+
: undefined,
|
|
84
|
+
onAnimationEnd,
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
//# sourceMappingURL=useValueCh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C;gBACtB,GAAG,QAAQ;gBACX,YAAY,EAAE,QAAQ,CAAC,WAAW;aACnC,CAAC,CAAC,CAAA;QACL,CAAC;IACH,CAAC,EACD,EAAE,CACH,CAAA;IAED,MAAM,SAAS,GAAG,KAAK,CAAC,WAAW,KAAK,KAAK,CAAC,YAAY,CAAA;IAE1D,OAAO;QACL,SAAS,EAAE,SAAS;YAClB,CAAC,CAAC,KAAK,CAAC,WAAW,GAAG,CAAC,KAAK,CAAC;gBAC3B,CAAC,CAAC,2BAA2B;gBAC7B,CAAC,CAAC,iCAAiC;YACrC,CAAC,CAAC,SAAS;QACb,cAAc;KACf,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -34,6 +34,17 @@ import type { ReactNode, RefObject } from "react";
|
|
|
34
34
|
* `aria-label` / `aria-labelledby` must be present. Missing both is a
|
|
35
35
|
* dev-time warning, not a throw — the lesson `Spinner`, `Popover`, and
|
|
36
36
|
* `Modal` each learned, applied without breaking a render.
|
|
37
|
+
*
|
|
38
|
+
* ### It opens and closes with motion
|
|
39
|
+
*
|
|
40
|
+
* The panel scales and fades in, and on close it stays in the page
|
|
41
|
+
* until its exit animation ends (`usePresence`). While it leaves it is
|
|
42
|
+
* already closed to everything but the eye: it leaves the stack at
|
|
43
|
+
* once, so the panel under it is live again; its focus manager is
|
|
44
|
+
* disabled, which returns focus to the trigger immediately; and it is
|
|
45
|
+
* `inert`, `aria-hidden`, and click-through. Under reduced motion and
|
|
46
|
+
* in the automated suites the exit has no length, so it is removed in
|
|
47
|
+
* the same commit exactly as before.
|
|
37
48
|
*/
|
|
38
49
|
export type OverlayPanelProps = {
|
|
39
50
|
"aria-label"?: string;
|
|
@@ -51,11 +62,17 @@ export type OverlayPanelProps = {
|
|
|
51
62
|
* manager wins, which reads as the app ignoring you.
|
|
52
63
|
*/
|
|
53
64
|
initialFocus?: RefObject<HTMLElement | null>;
|
|
65
|
+
/**
|
|
66
|
+
* `false` only for a caller that animates the panel itself, as
|
|
67
|
+
* `TableViewport` does when it grows a table out of the page. Every
|
|
68
|
+
* other panel keeps the library's enter and exit motion.
|
|
69
|
+
*/
|
|
70
|
+
hasMotion?: boolean;
|
|
54
71
|
/** Escape and an outside press both close. */
|
|
55
72
|
isDismissable?: boolean;
|
|
56
73
|
isVisible: boolean;
|
|
57
74
|
onClose: () => void;
|
|
58
75
|
role?: "alertdialog" | "dialog";
|
|
59
76
|
};
|
|
60
|
-
export declare const OverlayPanel: ({ "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, children, className, initialFocus, isDismissable, isVisible, onClose, role, }: OverlayPanelProps) => ReactNode;
|
|
77
|
+
export declare const OverlayPanel: ({ "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, children, className, hasMotion, initialFocus, isDismissable, isVisible, onClose, role, }: OverlayPanelProps) => ReactNode;
|
|
61
78
|
//# sourceMappingURL=OverlayPanel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OverlayPanel.d.ts","sourceRoot":"","sources":["../../src/Overlay/OverlayPanel.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"OverlayPanel.d.ts","sourceRoot":"","sources":["../../src/Overlay/OverlayPanel.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAuBjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,QAAQ,EAAE,SAAS,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;;;;;;;OASG;IACH,YAAY,CAAC,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;IAC5C;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,8CAA8C;IAC9C,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,SAAS,EAAE,OAAO,CAAA;IAClB,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,IAAI,CAAC,EAAE,aAAa,GAAG,QAAQ,CAAA;CAChC,CAAA;AAED,eAAO,MAAM,YAAY,GAAI,wJAW1B,iBAAiB,KAAG,SAmStB,CAAA"}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useLatestRef, useUniqueId, } from "@charcuterie/logic";
|
|
3
|
-
import { FloatingFocusManager, FloatingPortal, useDismiss, useFloating, useInteractions, useRole, } from "@floating-ui/react";
|
|
4
|
-
import { useCallback, useEffect } from "react";
|
|
3
|
+
import { FloatingFocusManager, FloatingPortal, useDismiss, useFloating, useInteractions, useMergeRefs, useRole, } from "@floating-ui/react";
|
|
4
|
+
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, } from "react";
|
|
5
|
+
import { toOverlayMotionClass, usePresence, } from "../Motion/usePresence.js";
|
|
6
|
+
import { toClassName } from "../toClassName.js";
|
|
5
7
|
import { AnchoredOverlayScopeContext, useAnchoredOverlayScope, } from "./AnchoredOverlayScope.js";
|
|
8
|
+
import { findReturnFocusTarget } from "./focusHistory.js";
|
|
6
9
|
import { lockScrollBehind } from "./lockScrollBehind.js";
|
|
7
10
|
import { useOverlayStack } from "./OverlayStack.js";
|
|
8
11
|
import { SharedBackdrop } from "./SharedBackdrop.js";
|
|
9
|
-
export const OverlayPanel = ({ "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, children, className, initialFocus, isDismissable = true, isVisible, onClose, role = "dialog", }) => {
|
|
12
|
+
export const OverlayPanel = ({ "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, children, className, hasMotion = true, initialFocus, isDismissable = true, isVisible, onClose, role = "dialog", }) => {
|
|
10
13
|
const stack = useOverlayStack();
|
|
11
14
|
const id = useUniqueId();
|
|
12
15
|
// A stable close, so registering it does not churn the stack as the
|
|
@@ -15,7 +18,48 @@ export const OverlayPanel = ({ "aria-label": ariaLabel, "aria-labelledby": ariaL
|
|
|
15
18
|
const stableOnClose = useCallback(() => {
|
|
16
19
|
onCloseRef.current();
|
|
17
20
|
}, [onCloseRef]);
|
|
18
|
-
const
|
|
21
|
+
const { isExiting, isMounted, presenceRef } = usePresence(isVisible);
|
|
22
|
+
// Where focus goes when the panel closes: the element that had focus
|
|
23
|
+
// when it opened, or, if that has gone, the most recently focused
|
|
24
|
+
// element that is still there (`findReturnFocusTarget`).
|
|
25
|
+
//
|
|
26
|
+
// The focus manager's own memory is not enough. When a panel stacked
|
|
27
|
+
// on this one closes, this one's manager is enabled again and
|
|
28
|
+
// remembers whatever had focus then, which is a button INSIDE this
|
|
29
|
+
// panel. Unmounted at once, that button was gone and floating-ui fell
|
|
30
|
+
// back further; kept in the page for the exit motion, it is still
|
|
31
|
+
// there, but inert, so focus landed nowhere.
|
|
32
|
+
//
|
|
33
|
+
// Recorded in a layout effect, which never runs on the server, and
|
|
34
|
+
// which runs before the focus manager moves focus inside: it does
|
|
35
|
+
// that in a microtask.
|
|
36
|
+
const openerRef = useRef(null);
|
|
37
|
+
const panelElementRef = useRef(null);
|
|
38
|
+
useLayoutEffect(() => {
|
|
39
|
+
if (!isVisible) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const focused = document.activeElement;
|
|
43
|
+
openerRef.current =
|
|
44
|
+
focused instanceof HTMLElement ? focused : null;
|
|
45
|
+
}, [isVisible]);
|
|
46
|
+
useLayoutEffect(() => {
|
|
47
|
+
if (!isMounted) {
|
|
48
|
+
openerRef.current = null;
|
|
49
|
+
}
|
|
50
|
+
}, [isMounted]);
|
|
51
|
+
// The manager reads `returnFocus.current` as the panel closes, so a
|
|
52
|
+
// getter decides then, with the page as it is at that moment, rather
|
|
53
|
+
// than in an earlier render.
|
|
54
|
+
const returnFocus = useMemo(() => ({
|
|
55
|
+
get current() {
|
|
56
|
+
return findReturnFocusTarget({
|
|
57
|
+
opener: openerRef.current,
|
|
58
|
+
panel: panelElementRef.current,
|
|
59
|
+
});
|
|
60
|
+
},
|
|
61
|
+
}), []);
|
|
62
|
+
const isTop = !isExiting && (!stack.isProvided || stack.topId === id);
|
|
19
63
|
const anchors = useAnchoredOverlayScope();
|
|
20
64
|
const hasOpenAnchor = anchors.topId !== null;
|
|
21
65
|
const { context, refs } = useFloating({
|
|
@@ -72,7 +116,27 @@ export const OverlayPanel = ({ "aria-label": ariaLabel, "aria-labelledby": ariaL
|
|
|
72
116
|
* `--layer-modal` it paints. `0` when unprovided — a lone `Modal`
|
|
73
117
|
* is the only thing open.
|
|
74
118
|
*/
|
|
75
|
-
const
|
|
119
|
+
const registeredIndex = stack.orderedIds.indexOf(id);
|
|
120
|
+
// A closing panel has already left the stack, so its own index is
|
|
121
|
+
// gone. It keeps the layer it had, or the panel it is leaving would
|
|
122
|
+
// be drawn under the one it was covering for the length of its exit.
|
|
123
|
+
// State with a render-phase update, not a ref written during render,
|
|
124
|
+
// so a render React throws away cannot leave a layer behind.
|
|
125
|
+
const [lastStackIndex, setLastStackIndex] = useState(0);
|
|
126
|
+
if (registeredIndex >= 0 &&
|
|
127
|
+
registeredIndex !== lastStackIndex) {
|
|
128
|
+
setLastStackIndex(registeredIndex);
|
|
129
|
+
}
|
|
130
|
+
const stackIndex = registeredIndex >= 0
|
|
131
|
+
? registeredIndex
|
|
132
|
+
: isExiting
|
|
133
|
+
? lastStackIndex
|
|
134
|
+
: 0;
|
|
135
|
+
const setPanelRef = useMergeRefs([
|
|
136
|
+
refs.setFloating,
|
|
137
|
+
presenceRef,
|
|
138
|
+
panelElementRef,
|
|
139
|
+
]);
|
|
76
140
|
useEffect(() => {
|
|
77
141
|
if (!isVisible) {
|
|
78
142
|
return;
|
|
@@ -85,7 +149,11 @@ export const OverlayPanel = ({ "aria-label": ariaLabel, "aria-labelledby": ariaL
|
|
|
85
149
|
// Ref-counted through `lockScrollBehind`'s module scope, so N
|
|
86
150
|
// stacked panels lock the page once and free it only when the last
|
|
87
151
|
// closes — with or without a provider.
|
|
88
|
-
|
|
152
|
+
//
|
|
153
|
+
// Held while the panel is mounted, not only while it is visible, so
|
|
154
|
+
// the page's scrollbar does not come back, and shift the page
|
|
155
|
+
// sideways, while the panel is still fading out over it.
|
|
156
|
+
useEffect(() => (isMounted ? lockScrollBehind() : undefined), [isMounted]);
|
|
89
157
|
useEffect(() => {
|
|
90
158
|
if (isVisible &&
|
|
91
159
|
ariaLabel === undefined &&
|
|
@@ -93,10 +161,13 @@ export const OverlayPanel = ({ "aria-label": ariaLabel, "aria-labelledby": ariaL
|
|
|
93
161
|
console.warn('OverlayPanel: a modal needs an accessible name. Pass `aria-label` or `aria-labelledby` — a `role="dialog"` takes none from its content and is announced as just "dialog".');
|
|
94
162
|
}
|
|
95
163
|
}, [ariaLabel, ariaLabelledBy, isVisible]);
|
|
96
|
-
if (!
|
|
164
|
+
if (!isMounted) {
|
|
97
165
|
return null;
|
|
98
166
|
}
|
|
99
|
-
return (_jsxs(_Fragment, { children: [stack.isProvided ? null : (_jsx(SharedBackdrop, { isVisible:
|
|
167
|
+
return (_jsxs(_Fragment, { children: [stack.isProvided ? null : (_jsx(SharedBackdrop, { isVisible: isVisible })), _jsx(FloatingPortal, { children: _jsx("div", { className: toClassName("fixed inset-0 flex items-center justify-center",
|
|
168
|
+
// The centring layer covers the viewport. While the panel
|
|
169
|
+
// leaves, a press must reach the page under it.
|
|
170
|
+
isExiting && "pointer-events-none"),
|
|
100
171
|
/*
|
|
101
172
|
* ⚠️ Cascading, not one shared layer.
|
|
102
173
|
*
|
|
@@ -120,12 +191,13 @@ export const OverlayPanel = ({ "aria-label": ariaLabel, "aria-labelledby": ariaL
|
|
|
120
191
|
initialFocus: initialFocus ?? undefined,
|
|
121
192
|
// Only the top traps focus; a lower panel is `inert`
|
|
122
193
|
// anyway, and two live traps fight over one caret.
|
|
123
|
-
disabled: !isTop, modal: true, children: _jsx("div", { ...getFloatingProps(), "aria-label": ariaLabel,
|
|
124
|
-
"aria-labelledby": ariaLabelledBy, className: className,
|
|
194
|
+
disabled: !isTop, modal: true, returnFocus: returnFocus, children: _jsx("div", { ...getFloatingProps(), "aria-label": ariaLabel,
|
|
195
|
+
"aria-labelledby": ariaLabelledBy, "aria-hidden": isExiting ? true : undefined, className: toClassName(className, hasMotion &&
|
|
196
|
+
toOverlayMotionClass(isExiting)), "data-overlay-exiting": isExiting ? "" : undefined, "data-overlay-panel": "",
|
|
125
197
|
// The fallback the plan calls for: `inert` on every panel
|
|
126
198
|
// but the top, so a lower modal is unreachable across the
|
|
127
199
|
// portal boundary even where `FloatingFocusManager`'s
|
|
128
200
|
// outside-hiding does not reach a sibling portal.
|
|
129
|
-
inert: isTop ? undefined : true, ref:
|
|
201
|
+
inert: isTop ? undefined : true, ref: setPanelRef, role: role, children: _jsx(AnchoredOverlayScopeContext.Provider, { value: anchors, children: children }) }) }) }) })] }));
|
|
130
202
|
};
|
|
131
203
|
//# sourceMappingURL=OverlayPanel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OverlayPanel.js","sourceRoot":"","sources":["../../src/Overlay/OverlayPanel.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,YAAY,EACZ,WAAW,GACZ,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EACL,oBAAoB,EACpB,cAAc,EACd,UAAU,EACV,WAAW,EACX,eAAe,EACf,OAAO,GACR,MAAM,oBAAoB,CAAA;AAE3B,OAAO,
|
|
1
|
+
{"version":3,"file":"OverlayPanel.js","sourceRoot":"","sources":["../../src/Overlay/OverlayPanel.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,YAAY,EACZ,WAAW,GACZ,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EACL,oBAAoB,EACpB,cAAc,EACd,UAAU,EACV,WAAW,EACX,eAAe,EACf,YAAY,EACZ,OAAO,GACR,MAAM,oBAAo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,cACb,cACE,SAAS,EAAE,WAAW,CACpB,gDAAgD;oBAChD,0DAA0D;oBAC1D,gDAAgD;oBAChD,SAAS,IAAI,qBAAqB,CACnC;oBACD;;;;;;;;;;;;;uBAaG;oBACH,KAAK,EAAE;wBACL,MAAM,EAAE,6BAA6B,UAAU,GAAG;qBACnD,YAED,KAAC,oBAAoB,IACnB,OAAO,EAAE,OAAO;wBAChB,yDAAyD;wBACzD,0DAA0D;wBAC1D,OAAO;wBACP,YAAY,EAAE,YAAY,IAAI,SAAS;wBACvC,qDAAqD;wBACrD,mDAAmD;wBACnD,QAAQ,EAAE,CAAC,KAAK,EAChB,KAAK,QACL,WAAW,EAAE,WAAW,YAExB,iBACM,gBAAgB,EAAE,EAOpB,YAAY,EAAE,SAAS;4BACvB,iBAAiB,EAAE,cAAc,iBAEtB,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,EACzC,SAAS,EAAE,WAAW,CACpB,SAAS,EACT,SAAS;gCACP,oBAAoB,CAAC,SAAS,CAAC,CAClC,0BAMC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,wBAET,EAAE;4BACrB,0DAA0D;4BAC1D,0DAA0D;4BAC1D,sDAAsD;4BACtD,kDAAkD;4BAClD,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,EAC/B,GAAG,EAAE,WAAW,EAChB,IAAI,EAAE,IAAI,YAEV,KAAC,2BAA2B,CAAC,QAAQ,IACnC,KAAK,EAAE,OAAO,YAEb,QAAQ,GAC4B,GACnC,GACe,GACnB,GACS,IAChB,CACJ,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -17,6 +17,9 @@ import type { ReactNode } from "react";
|
|
|
17
17
|
* — a real bug a same-z-plus-DOM-order scheme has, because a
|
|
18
18
|
* later-mounted scrim then covers the panel. Stacking *between* panels
|
|
19
19
|
* still falls out of append order at the one `--layer-modal`.
|
|
20
|
+
*
|
|
21
|
+
* It fades in with the first panel and out with the last, and during
|
|
22
|
+
* the fade out it is click-through like the panel leaving with it.
|
|
20
23
|
*/
|
|
21
24
|
export declare const SharedBackdrop: ({ isVisible, }: {
|
|
22
25
|
isVisible: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SharedBackdrop.d.ts","sourceRoot":"","sources":["../../src/Overlay/SharedBackdrop.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"SharedBackdrop.d.ts","sourceRoot":"","sources":["../../src/Overlay/SharedBackdrop.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAOtC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,cAAc,GAAI,gBAE5B;IACD,SAAS,EAAE,OAAO,CAAA;CACnB,KAAG,SAoBH,CAAA"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { FloatingPortal } from "@floating-ui/react";
|
|
3
|
+
import { toFadeMotionClass, usePresence, } from "../Motion/usePresence.js";
|
|
4
|
+
import { toClassName } from "../toClassName.js";
|
|
3
5
|
/**
|
|
4
6
|
* The scrim, and there is exactly one of it however many backdrop
|
|
5
7
|
* modals are stacked.
|
|
@@ -18,11 +20,15 @@ import { FloatingPortal } from "@floating-ui/react";
|
|
|
18
20
|
* — a real bug a same-z-plus-DOM-order scheme has, because a
|
|
19
21
|
* later-mounted scrim then covers the panel. Stacking *between* panels
|
|
20
22
|
* still falls out of append order at the one `--layer-modal`.
|
|
23
|
+
*
|
|
24
|
+
* It fades in with the first panel and out with the last, and during
|
|
25
|
+
* the fade out it is click-through like the panel leaving with it.
|
|
21
26
|
*/
|
|
22
27
|
export const SharedBackdrop = ({ isVisible, }) => {
|
|
23
|
-
|
|
28
|
+
const { isExiting, isMounted, presenceRef } = usePresence(isVisible);
|
|
29
|
+
if (!isMounted) {
|
|
24
30
|
return null;
|
|
25
31
|
}
|
|
26
|
-
return (_jsx(FloatingPortal, { children: _jsx("div", { "aria-hidden": "true", className: "fixed inset-0 z-[var(--layer-overlay)] bg-scrim" }) }));
|
|
32
|
+
return (_jsx(FloatingPortal, { children: _jsx("div", { "aria-hidden": "true", className: toClassName("fixed inset-0 z-[var(--layer-overlay)] bg-scrim", toFadeMotionClass(isExiting)), ref: presenceRef }) }));
|
|
27
33
|
};
|
|
28
34
|
//# sourceMappingURL=SharedBackdrop.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SharedBackdrop.js","sourceRoot":"","sources":["../../src/Overlay/SharedBackdrop.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"SharedBackdrop.js","sourceRoot":"","sources":["../../src/Overlay/SharedBackdrop.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAEnD,OAAO,EACL,iBAAiB,EACjB,WAAW,GACZ,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAE/C;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,EAC7B,SAAS,GAGV,EAAa,EAAE;IACd,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,GACzC,WAAW,CAAiB,SAAS,CAAC,CAAA;IAExC,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO,IAAI,CAAA;IACb,CAAC;IAED,OAAO,CACL,KAAC,cAAc,cACb,6BACc,MAAM,EAClB,SAAS,EAAE,WAAW,CACpB,iDAAiD,EACjD,iBAAiB,CAAC,SAAS,CAAC,CAC7B,EACD,GAAG,EAAE,WAAW,GAChB,GACa,CAClB,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where a closing panel sends focus: the element that opened it if
|
|
3
|
+
* that still can take focus; otherwise, if there was an opener, the
|
|
4
|
+
* most recently focused element that can and is not a text field.
|
|
5
|
+
*
|
|
6
|
+
* A panel that opened while nothing had focus returns nothing, so
|
|
7
|
+
* focus stays where it was, as before. The history is only for an
|
|
8
|
+
* opener that has gone, not for a panel that never had one: sending
|
|
9
|
+
* focus to a field the user left minutes ago would open the keyboard
|
|
10
|
+
* on a phone.
|
|
11
|
+
*/
|
|
12
|
+
export declare const findReturnFocusTarget: ({ opener, panel, }: {
|
|
13
|
+
opener: HTMLElement | null;
|
|
14
|
+
panel: HTMLElement | null;
|
|
15
|
+
}) => HTMLElement | null;
|
|
16
|
+
//# sourceMappingURL=focusHistory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"focusHistory.d.ts","sourceRoot":"","sources":["../../src/Overlay/focusHistory.ts"],"names":[],"mappings":"AA0GA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,qBAAqB,GAAI,oBAGnC;IACD,MAAM,EAAE,WAAW,GAAG,IAAI,CAAA;IAC1B,KAAK,EAAE,WAAW,GAAG,IAAI,CAAA;CAC1B,KAAG,WAAW,GAAG,IA4BjB,CAAA"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The elements the user has focused, newest last, so a closing panel
|
|
3
|
+
* can find somewhere real to send focus when its opener has gone.
|
|
4
|
+
*
|
|
5
|
+
* floating-ui keeps a list like this, but it is private, and a panel
|
|
6
|
+
* that passes its own `returnFocus` target no longer falls back to it.
|
|
7
|
+
*
|
|
8
|
+
* Weak references, so a removed element is not kept alive by the list.
|
|
9
|
+
*/
|
|
10
|
+
const LIMIT = 20;
|
|
11
|
+
let history = [];
|
|
12
|
+
const remember = (event) => {
|
|
13
|
+
const { target } = event;
|
|
14
|
+
if (!(target instanceof HTMLElement) ||
|
|
15
|
+
target === target.ownerDocument.body) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
history = [
|
|
19
|
+
...history.filter((entry) => {
|
|
20
|
+
const element = entry.deref();
|
|
21
|
+
return element !== undefined && element !== target;
|
|
22
|
+
}),
|
|
23
|
+
new WeakRef(target),
|
|
24
|
+
].slice(-LIMIT);
|
|
25
|
+
};
|
|
26
|
+
// Installed when the module first loads in a browser, so an element
|
|
27
|
+
// focused before any panel ever opened, such as a menu's trigger, is
|
|
28
|
+
// already in the list. Nothing runs on the server.
|
|
29
|
+
if (typeof document !== "undefined") {
|
|
30
|
+
document.addEventListener("focusin", remember, true);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Whether focus can land on `element` once `panel` has closed: it is
|
|
34
|
+
* still in the page, enabled, and rendered; it is outside the closing
|
|
35
|
+
* panel and outside any panel that is itself leaving; and it is not
|
|
36
|
+
* inside anything else that is `inert`, such as a menu that is still
|
|
37
|
+
* leaving.
|
|
38
|
+
*
|
|
39
|
+
* An `inert` overlay panel does not rule an element out: a lower panel
|
|
40
|
+
* that the closing one covered is still `inert` at the moment this is
|
|
41
|
+
* read, and is turned back on in the same commit.
|
|
42
|
+
*/
|
|
43
|
+
const isReturnable = (element, panel) => {
|
|
44
|
+
if (element?.isConnected !== true ||
|
|
45
|
+
element === element.ownerDocument.body ||
|
|
46
|
+
(panel?.contains(element) ?? false) ||
|
|
47
|
+
element.closest("[data-overlay-exiting]") !== null ||
|
|
48
|
+
element.matches(":disabled")) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
if (typeof element.checkVisibility === "function" &&
|
|
52
|
+
!element.checkVisibility()) {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
const inertAncestor = element.closest("[inert]");
|
|
56
|
+
return (inertAncestor === null ||
|
|
57
|
+
inertAncestor.hasAttribute("data-overlay-panel"));
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Input types that do not bring up an on-screen keyboard.
|
|
61
|
+
*/
|
|
62
|
+
const KEYLESS_INPUT_TYPES = new Set([
|
|
63
|
+
"button",
|
|
64
|
+
"checkbox",
|
|
65
|
+
"color",
|
|
66
|
+
"file",
|
|
67
|
+
"image",
|
|
68
|
+
"radio",
|
|
69
|
+
"range",
|
|
70
|
+
"reset",
|
|
71
|
+
"submit",
|
|
72
|
+
]);
|
|
73
|
+
/**
|
|
74
|
+
* Whether focusing `element` brings up the keyboard on a phone. The
|
|
75
|
+
* history fallback skips these: the user left that field, and did not
|
|
76
|
+
* ask to type in it again.
|
|
77
|
+
*/
|
|
78
|
+
const isTextEntry = (element) => element instanceof HTMLTextAreaElement ||
|
|
79
|
+
element.isContentEditable ||
|
|
80
|
+
(element instanceof HTMLInputElement &&
|
|
81
|
+
!KEYLESS_INPUT_TYPES.has(element.type));
|
|
82
|
+
/**
|
|
83
|
+
* Where a closing panel sends focus: the element that opened it if
|
|
84
|
+
* that still can take focus; otherwise, if there was an opener, the
|
|
85
|
+
* most recently focused element that can and is not a text field.
|
|
86
|
+
*
|
|
87
|
+
* A panel that opened while nothing had focus returns nothing, so
|
|
88
|
+
* focus stays where it was, as before. The history is only for an
|
|
89
|
+
* opener that has gone, not for a panel that never had one: sending
|
|
90
|
+
* focus to a field the user left minutes ago would open the keyboard
|
|
91
|
+
* on a phone.
|
|
92
|
+
*/
|
|
93
|
+
export const findReturnFocusTarget = ({ opener, panel, }) => {
|
|
94
|
+
if (opener === null ||
|
|
95
|
+
opener === opener.ownerDocument.body) {
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
if (isReturnable(opener, panel)) {
|
|
99
|
+
return opener;
|
|
100
|
+
}
|
|
101
|
+
for (let index = history.length - 1; index >= 0; index -= 1) {
|
|
102
|
+
const element = history[index]?.deref();
|
|
103
|
+
if (isReturnable(element, panel) &&
|
|
104
|
+
!isTextEntry(element)) {
|
|
105
|
+
return element;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return null;
|
|
109
|
+
};
|
|
110
|
+
//# sourceMappingURL=focusHistory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"focusHistory.js","sourceRoot":"","sources":["../../src/Overlay/focusHistory.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,KAAK,GAAG,EAAE,CAAA;AAEhB,IAAI,OAAO,GAA2B,EAAE,CAAA;AAExC,MAAM,QAAQ,GAAG,CAAC,KAAiB,EAAE,EAAE;IACrC,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,CAAA;IAExB,IACE,CAAC,CAAC,MAAM,YAAY,WAAW,CAAC;QAChC,MAAM,KAAK,MAAM,CAAC,aAAa,CAAC,IAAI,EACpC,CAAC;QACD,OAAM;IACR,CAAC;IAED,OAAO,GAAG;QACR,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;YAC1B,MAAM,OAAO,GAAG,KAAK,CAAC,KAAK,EAAE,CAAA;YAE7B,OAAO,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,MAAM,CAAA;QACpD,CAAC,CAAC;QACF,IAAI,OAAO,CAAC,MAAM,CAAC;KACpB,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAA;AACjB,CAAC,CAAA;AAED,oEAAoE;AACpE,qEAAqE;AACrE,mDAAmD;AACnD,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,CAAC;IACpC,QAAQ,CAAC,gBAAgB,CAAC,SAAS,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAA;AACtD,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,YAAY,GAAG,CACnB,OAAuC,EACvC,KAAyB,EACD,EAAE;IAC1B,IACE,OAAO,EAAE,WAAW,KAAK,IAAI;QAC7B,OAAO,KAAK,OAAO,CAAC,aAAa,CAAC,IAAI;QACtC,CAAC,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,I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M,GAAG,CAAC,EAC9B,KAAK,IAAI,CAAC,EACV,KAAK,IAAI,CAAC,EACV,CAAC;QACD,MAAM,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,CAAA;QAEvC,IACE,YAAY,CAAC,OAAO,EAAE,KAAK,CAAC;YAC5B,CAAC,WAAW,CAAC,OAAO,CAAC,EACrB,CAAC;YACD,OAAO,OAAO,CAAA;QAChB,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAA;AACb,CAAC,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Placement, VirtualElement } from "@floating-ui/react";
|
|
2
|
-
import type { ReactElement, RefObject } from "react";
|
|
2
|
+
import type { CSSProperties, ReactElement, RefObject } from "react";
|
|
3
3
|
/**
|
|
4
4
|
* The floating-ui block every anchored overlay — `Popover`, `Menu`,
|
|
5
5
|
* `Listbox`, `Combobox` — wrote out for itself, consolidated once.
|
|
@@ -44,6 +44,17 @@ import type { ReactElement, RefObject } from "react";
|
|
|
44
44
|
* Whether the panel goes in a `FloatingPortal`, the top layer, or in
|
|
45
45
|
* place is the component's call, which is what lets the same hook back
|
|
46
46
|
* a portalled `Listbox` and (for now) a top-layer `Popover`.
|
|
47
|
+
*
|
|
48
|
+
* ### Presence, so the panel can leave with motion
|
|
49
|
+
*
|
|
50
|
+
* A component renders its panel while `isMounted`, not while
|
|
51
|
+
* `isVisible`: the two differ only while `isExiting`, the length of
|
|
52
|
+
* the exit animation. During that time the component makes the panel
|
|
53
|
+
* `inert` and `aria-hidden` and disables any focus manager on it, so
|
|
54
|
+
* it is closed to everything but the eye. `motionClassName` is the
|
|
55
|
+
* enter or exit class, and `floatingStyles` already carries the
|
|
56
|
+
* `transform-origin` that makes the panel grow out of its trigger,
|
|
57
|
+
* flipped with the placement.
|
|
47
58
|
*/
|
|
48
59
|
export type AnchoredOverlayRole = "dialog" | "listbox" | "menu";
|
|
49
60
|
/**
|
|
@@ -148,9 +159,12 @@ export declare const useAnchoredOverlay: ({ anchorRef, isEscapeDismissable, isHe
|
|
|
148
159
|
refs: import("@floating-ui/react").ExtendedRefs<import("@floating-ui/react").ReferenceType>;
|
|
149
160
|
elements: import("@floating-ui/react").ExtendedElements<import("@floating-ui/react").ReferenceType>;
|
|
150
161
|
};
|
|
151
|
-
floatingStyles:
|
|
162
|
+
floatingStyles: CSSProperties;
|
|
152
163
|
getFloatingProps: (userProps?: React.HTMLProps<HTMLElement>) => Record<string, unknown>;
|
|
153
|
-
|
|
164
|
+
isExiting: boolean;
|
|
165
|
+
isMounted: boolean;
|
|
166
|
+
motionClassName: string;
|
|
167
|
+
setFloating: (node: HTMLElement | null) => void;
|
|
154
168
|
triggerId: string;
|
|
155
169
|
};
|
|
156
170
|
//# sourceMappingURL=useAnchoredOverlay.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAnchoredOverlay.d.ts","sourceRoot":"","sources":["../../src/Overlay/useAnchoredOverlay.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,SAAS,EACT,cAAc,EACf,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"useAnchoredOverlay.d.ts","sourceRoot":"","sources":["../../src/Overlay/useAnchoredOverlay.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,SAAS,EACT,cAAc,EACf,MAAM,oBAAoB,CAAA;AAa3B,OAAO,KAAK,EACV,aAAa,EACb,YAAY,EACZ,SAAS,EACV,MAAM,OAAO,CAAA;AAcd;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AACH,MAAM,MAAM,mBAAmB,GAC3B,QAAQ,GACR,SAAS,GACT,MAAM,CAAA;AAEV;;;;;;;;;;GAUG;AACH,MAAM,MAAM,qBAAqB,GAC7B,WAAW,GACX,cAAc,CAAA;AAElB,MAAM,MAAM,yBAAyB,GAAG;IACtC;;;;;;;;;;OAUG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC,qBAAqB,GAAG,IAAI,CAAC,CAAA;IACnD;;;;;;OAMG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B;;;;;;;;;OASG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,yBAAyB,CAAC,EAAE,OAAO,CAAA;IACnC,+DAA+D;IAC/D,qBAAqB,CAAC,EAAE,OAAO,CAAA;IAC/B;;;;;;;;;;;OAWG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,SAAS,EAAE,OAAO,CAAA;IAClB,iEAAiE;IACjE,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,0CAA0C;IAC1C,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,EAAE,MAAM,IAAI,CAAA;IACrB,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,IAAI,EAAE,mBAAmB,CAAA;IACzB;;;OAGG;IACH,OAAO,CAAC,EAAE,YAAY,CAAA;CACvB,CAAA;AAQD,eAAO,MAAM,kBAAkB,GAAI,8MAehC,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;wBAiNjB,WAAW,GAAG,IAAI;;CAsB5B,CAAA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useClonedChild, useUniqueId, } from "@charcuterie/logic";
|
|
2
|
-
import { autoUpdate, flip, offset, shift, size, useDismiss, useFloating, useInteractions, useRole, } from "@floating-ui/react";
|
|
3
|
-
import { createElement, useContext, useLayoutEffect, } from "react";
|
|
2
|
+
import { autoUpdate, flip, offset, shift, size, useDismiss, useFloating, useInteractions, useMergeRefs, useRole, } from "@floating-ui/react";
|
|
3
|
+
import { createElement, useCallback, useContext, useLayoutEffect, } from "react";
|
|
4
|
+
import { toOverlayMotionClass, toTransformOrigin, usePresence, } from "../Motion/usePresence.js";
|
|
4
5
|
import { AnchoredOverlayScopeContext } from "./AnchoredOverlayScope.js";
|
|
5
6
|
// `useClonedChild` insists on exactly one element, and hooks cannot be
|
|
6
7
|
// called conditionally — so in `anchorRef` mode we still call it, on this
|
|
@@ -49,7 +50,7 @@ export const useAnchoredOverlay = ({ anchorRef, isEscapeDismissable = true, isHe
|
|
|
49
50
|
}));
|
|
50
51
|
}
|
|
51
52
|
const isAnchored = anchorRef !== undefined;
|
|
52
|
-
const { context, floatingStyles, refs } = useFloating({
|
|
53
|
+
const { context, floatingStyles, placement: resolvedPlacement, refs, } = useFloating({
|
|
53
54
|
// Read-only. Charcuterie remains the sole owner; floating-ui is
|
|
54
55
|
// told what is true and never decides it.
|
|
55
56
|
open: isVisible,
|
|
@@ -162,12 +163,29 @@ export const useAnchoredOverlay = ({ anchorRef, isEscapeDismissable = true, isHe
|
|
|
162
163
|
...(isAnchored ? {} : { ref: refs.setReference }),
|
|
163
164
|
});
|
|
164
165
|
const clonedTrigger = isAnchored ? null : clonedChild;
|
|
166
|
+
const { isExiting, isMounted, presenceRef } = usePresence(isVisible);
|
|
167
|
+
const mergedFloatingRef = useMergeRefs([
|
|
168
|
+
refs.setFloating,
|
|
169
|
+
presenceRef,
|
|
170
|
+
]);
|
|
171
|
+
// Re-typed as the plain callback `refs.setFloating` was, so the
|
|
172
|
+
// hook's inferred return type names nothing from React's internals.
|
|
173
|
+
const setFloating = useCallback((node) => {
|
|
174
|
+
mergedFloatingRef?.(node);
|
|
175
|
+
}, [mergedFloatingRef]);
|
|
176
|
+
const panelStyles = {
|
|
177
|
+
...floatingStyles,
|
|
178
|
+
transformOrigin: toTransformOrigin(resolvedPlacement),
|
|
179
|
+
};
|
|
165
180
|
return {
|
|
166
181
|
clonedTrigger,
|
|
167
182
|
context,
|
|
168
|
-
floatingStyles,
|
|
183
|
+
floatingStyles: panelStyles,
|
|
169
184
|
getFloatingProps,
|
|
170
|
-
|
|
185
|
+
isExiting,
|
|
186
|
+
isMounted,
|
|
187
|
+
motionClassName: toOverlayMotionClass(isExiting),
|
|
188
|
+
setFloating,
|
|
171
189
|
triggerId,
|
|
172
190
|
};
|
|
173
191
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAnchoredOverlay.js","sourceRoot":"","sources":["../../src/Overlay/useAnchoredOverlay.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,WAAW,GACZ,MAAM,oBAAoB,CAAA;AAK3B,OAAO,EACL,UAAU,EACV,IAAI,EACJ,MAAM,EACN,KAAK,EACL,IAAI,EACJ,UAAU,EACV,WAAW,EACX,eAAe,EACf,OAAO,GACR,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"useAnchoredOverlay.js","sourceRoot":"","sources":["../../src/Overlay/useAnchoredOverlay.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,WAAW,GACZ,MAAM,oBAAoB,CAAA;AAK3B,OAAO,EACL,UAAU,EACV,IAAI,EACJ,MAAM,EACN,KAAK,EACL,IAAI,EACJ,UAAU,EACV,WAAW,EACX,eAAe,EACf,YAAY,EACZ,OAAO,GACR,MAAM,oBAAoB,CAAA;AAM3B,OAAO,EACL,aAAa,EACb,WAAW,EACX,UAAU,EACV,eAAe,GAChB,MAAM,OAAO,CAAA;AACd,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,WAAW,GACZ,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAA;AAqJvE,uEAAuE;AACvE,0EAA0E;AAC1E,oEAAoE;AACpE,8DAA8D;AAC9D,MAAM,mBAAmB,GAAG,aAAa,CAAC,MAAM,CAAC,CAAA;AAEjD,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,EACjC,SAAS,EACT,mBAAmB,GAAG,IAAI,EAC1B,eAAe,GAAG,KAAK,EACvB,yBAAyB,GAAG,IAAI,EAChC,qBAAqB,GAAG,KAAK,EAC7B,SAAS,EACT,cAAc,GAAG,KAAK,EACtB,WAAW,EACX,UAAU,E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M,OAAO,GAAI,6EAQrB,YAAY,KAAG,
|
|
1
|
+
{"version":3,"file":"Popover.d.ts","sourceRoot":"","sources":["../../src/Popover/Popover.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAKnD,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAMpD,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,EAAE,SAAS,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;;;;OAMG;IACH,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,OAAO,CAAA;IAClB;;;OAGG;IACH,SAAS,EAAE,MAAM,IAAI,CAAA;IACrB,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB;;;;OAIG;IACH,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,OAAO,GAAI,6EAQrB,YAAY,KAAG,SA0DjB,CAAA"}
|