@ariakit/react-core 0.2.8 → 0.2.9
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/CHANGELOG.md +12 -0
- package/cjs/__chunks/{6UH7OSG5.cjs → 364WU3DX.cjs} +2 -2
- package/cjs/__chunks/4CQBSK3W.cjs +46 -0
- package/cjs/__chunks/{6UM5H74J.cjs → 6GU25WKL.cjs} +2 -2
- package/cjs/__chunks/{4K22VVH6.cjs → 6WLP7YXF.cjs} +2 -2
- package/cjs/__chunks/{MJQOSYPH.cjs → 6Y7OJ66S.cjs} +2 -2
- package/cjs/__chunks/{HBWDRXN5.cjs → 7BSXU2OL.cjs} +2 -2
- package/cjs/__chunks/{JV2X54UE.cjs → BWQVQDGC.cjs} +6 -5
- package/cjs/__chunks/{TSZDLL4X.cjs → CEDXB2ML.cjs} +2 -2
- package/cjs/__chunks/{LULOLUTN.cjs → DFJJN2WM.cjs} +7 -13
- package/cjs/__chunks/{UUHO6ZXS.cjs → EYNBXS3C.cjs} +2 -2
- package/cjs/__chunks/{AYLR4G5I.cjs → FIEVSSEV.cjs} +1 -1
- package/cjs/__chunks/{7F62IPL4.cjs → FSADYSOP.cjs} +14 -6
- package/cjs/__chunks/{QAEK22OL.cjs → G2UKCWYO.cjs} +2 -2
- package/cjs/__chunks/{6WWAF5Y2.cjs → GJ2WWSXI.cjs} +2 -2
- package/cjs/__chunks/{FMIZNXEA.cjs → GQUXK6V2.cjs} +18 -10
- package/cjs/__chunks/{S35Z3MRE.cjs → HM3GZVEF.cjs} +2 -2
- package/cjs/__chunks/{5NZUFDNS.cjs → HTXMZNNP.cjs} +4 -4
- package/cjs/__chunks/{GZNLXFK3.cjs → HVCML4SE.cjs} +2 -2
- package/cjs/__chunks/{QUOAEQQ7.cjs → I4VW4CPQ.cjs} +2 -2
- package/cjs/__chunks/{6SZXUPLG.cjs → LGMGD2LT.cjs} +2 -2
- package/cjs/__chunks/{K3VYU4RD.cjs → MOOOVIIV.cjs} +2 -2
- package/cjs/__chunks/{NRIAM6MC.cjs → O22LNQHS.cjs} +8 -2
- package/cjs/__chunks/{FM2UUSFC.cjs → OEERYQSB.cjs} +2 -2
- package/cjs/__chunks/{3VAV4ULL.cjs → OZQD6TLQ.cjs} +2 -2
- package/cjs/__chunks/{GOWDAADN.cjs → PZBTPQEZ.cjs} +36 -45
- package/cjs/__chunks/{MUDM7N7Y.cjs → R32BMUUT.cjs} +2 -2
- package/cjs/__chunks/{RYACMEZB.cjs → S2VSVWFY.cjs} +12 -6
- package/cjs/__chunks/{47DEI3MG.cjs → SDW7WM6J.cjs} +2 -2
- package/cjs/__chunks/{QGYOOPA2.cjs → XIQNHQGW.cjs} +2 -2
- package/cjs/__chunks/Z3TLXRS7.cjs +19 -0
- package/cjs/__chunks/{RYADB3U4.cjs → ZEDBIWF2.cjs} +2 -2
- package/cjs/button/button.cjs +4 -4
- package/cjs/checkbox/checkbox.cjs +4 -4
- package/cjs/combobox/combobox-cancel.cjs +4 -4
- package/cjs/combobox/combobox-disclosure.cjs +6 -6
- package/cjs/combobox/combobox-item.cjs +4 -4
- package/cjs/combobox/combobox-list.cjs +3 -3
- package/cjs/combobox/combobox-popover.cjs +18 -14
- package/cjs/combobox/combobox-store.d.ts +1 -0
- package/cjs/combobox/combobox.cjs +3 -3
- package/cjs/command/command.cjs +3 -3
- package/cjs/composite/composite-item.cjs +4 -4
- package/cjs/composite/composite-overflow-disclosure.cjs +9 -9
- package/cjs/composite/composite-overflow.cjs +16 -12
- package/cjs/composite/composite.cjs +3 -3
- package/cjs/dialog/dialog-backdrop.cjs +7 -4
- package/cjs/dialog/dialog-disclosure.cjs +6 -6
- package/cjs/dialog/dialog-dismiss.cjs +5 -5
- package/cjs/dialog/dialog.cjs +15 -11
- package/cjs/dialog/dialog.d.ts +2 -0
- package/cjs/dialog/utils/disable-accessibility-tree-outside.cjs +4 -3
- package/cjs/dialog/utils/disable-tree-outside.cjs +5 -4
- package/cjs/dialog/utils/is-backdrop.cjs +4 -18
- package/cjs/dialog/utils/is-backdrop.d.ts +1 -1
- package/cjs/dialog/utils/mark-tree-outside.cjs +4 -3
- package/cjs/dialog/utils/orchestrate.cjs +2 -2
- package/cjs/dialog/utils/orchestrate.d.ts +2 -7
- package/cjs/dialog/utils/use-hide-on-interact-outside.cjs +6 -5
- package/cjs/dialog/utils/use-prevent-body-scroll.cjs +4 -3
- package/cjs/dialog/utils/use-prevent-body-scroll.d.ts +1 -2
- package/cjs/dialog/utils/use-root-dialog.cjs +9 -0
- package/cjs/dialog/utils/use-root-dialog.d.ts +8 -0
- package/cjs/disclosure/disclosure.cjs +5 -5
- package/cjs/focusable/focusable.cjs +2 -2
- package/cjs/form/form-checkbox.cjs +4 -4
- package/cjs/form/form-input.cjs +2 -2
- package/cjs/form/form-push.cjs +4 -4
- package/cjs/form/form-radio.cjs +5 -5
- package/cjs/form/form-remove.cjs +4 -4
- package/cjs/form/form-reset.cjs +4 -4
- package/cjs/form/form-submit.cjs +4 -4
- package/cjs/hovercard/hovercard-anchor.cjs +3 -3
- package/cjs/hovercard/hovercard-disclosure.cjs +6 -6
- package/cjs/hovercard/hovercard-dismiss.cjs +7 -7
- package/cjs/hovercard/hovercard.cjs +17 -13
- package/cjs/menu/menu-bar.cjs +3 -3
- package/cjs/menu/menu-button.cjs +9 -9
- package/cjs/menu/menu-dismiss.cjs +7 -7
- package/cjs/menu/menu-item-checkbox.cjs +7 -7
- package/cjs/menu/menu-item-radio.cjs +7 -7
- package/cjs/menu/menu-item.cjs +5 -5
- package/cjs/menu/menu-list.cjs +4 -4
- package/cjs/menu/menu-store.d.ts +1 -0
- package/cjs/menu/menu.cjs +19 -16
- package/cjs/popover/popover-disclosure.cjs +7 -7
- package/cjs/popover/popover-dismiss.cjs +6 -6
- package/cjs/popover/popover.cjs +16 -12
- package/cjs/radio/radio-group.cjs +3 -3
- package/cjs/radio/radio.cjs +5 -5
- package/cjs/select/select-item.cjs +4 -4
- package/cjs/select/select-list.cjs +4 -4
- package/cjs/select/select-popover.cjs +19 -15
- package/cjs/select/select-store.d.ts +1 -0
- package/cjs/select/select.cjs +7 -7
- package/cjs/tab/tab-list.cjs +3 -3
- package/cjs/tab/tab-panel.cjs +2 -2
- package/cjs/tab/tab.cjs +4 -4
- package/cjs/toolbar/toolbar-container.cjs +5 -5
- package/cjs/toolbar/toolbar-input.cjs +5 -5
- package/cjs/toolbar/toolbar-item.cjs +5 -5
- package/cjs/toolbar/toolbar.cjs +3 -3
- package/cjs/tooltip/tooltip-anchor.cjs +3 -3
- package/cjs/tooltip/tooltip.cjs +17 -13
- package/cjs/tsconfig.build.tsbuildinfo +1 -1
- package/dialog/utils/use-root-dialog/package.json +8 -0
- package/esm/__chunks/{IVDTLBEM.js → 2NDM3R77.js} +1 -1
- package/esm/__chunks/{J3XSDPNL.js → 6ICCUPPR.js} +1 -1
- package/esm/__chunks/{7GXM6KPX.js → 77C2ITJF.js} +1 -1
- package/esm/__chunks/{ZAKCZSVG.js → 7MJF27QJ.js} +1 -1
- package/esm/__chunks/{265D6T7T.js → CYJJUQU3.js} +7 -1
- package/esm/__chunks/{WANT555J.js → EUD77B6Z.js} +1 -1
- package/esm/__chunks/{T6V23Y6E.js → FW6QFGFT.js} +6 -5
- package/esm/__chunks/{ITSGLTHL.js → FYZCYWPI.js} +1 -1
- package/esm/__chunks/{6P5ZHMMU.js → GMDF663U.js} +1 -1
- package/esm/__chunks/{TJKNVC7W.js → HCZMY53N.js} +10 -2
- package/esm/__chunks/{VC2N3HOU.js → HNO7M6GL.js} +1 -1
- package/esm/__chunks/IXXFVVA2.js +19 -0
- package/esm/__chunks/{YKJNQJWA.js → KF3PP2P3.js} +1 -1
- package/esm/__chunks/{QTOJ32BQ.js → LIFXUQPU.js} +7 -13
- package/esm/__chunks/{DCSOYJXT.js → MO5Q5FB7.js} +1 -1
- package/esm/__chunks/{JTITB4L3.js → N36XUJ4I.js} +1 -1
- package/esm/__chunks/{THTPXSX5.js → OTMCQXXR.js} +1 -1
- package/esm/__chunks/{WKNIYKJV.js → OUTTLNN7.js} +1 -1
- package/esm/__chunks/PYB45PRS.js +46 -0
- package/esm/__chunks/{FB4T6LXQ.js → Q6CBZJ7X.js} +1 -1
- package/esm/__chunks/{CKSO3V6B.js → QLHUIPVK.js} +8 -2
- package/esm/__chunks/{5EHZOHU4.js → QTPMBYCP.js} +1 -1
- package/esm/__chunks/{MCW3SATG.js → RU5SBKR3.js} +16 -8
- package/esm/__chunks/{B4DAIM7E.js → TQ2K6WFI.js} +1 -1
- package/esm/__chunks/{MQRO7CTY.js → UYTR2SZP.js} +1 -1
- package/esm/__chunks/{RJWQJQSA.js → VSM5JGQO.js} +1 -1
- package/esm/__chunks/{PZMNV3SF.js → VV72RDTD.js} +3 -3
- package/esm/__chunks/{6R5NAG5K.js → WQIYBPAY.js} +1 -1
- package/esm/__chunks/{4E4RWZ6B.js → XECTFJQS.js} +28 -37
- package/esm/__chunks/{ZNCBVBWF.js → XJM2RD5W.js} +1 -1
- package/esm/__chunks/{OMYYUT2M.js → YNUPNUID.js} +1 -1
- package/esm/button/button.js +3 -3
- package/esm/checkbox/checkbox.js +3 -3
- package/esm/combobox/combobox-cancel.js +3 -3
- package/esm/combobox/combobox-disclosure.js +5 -5
- package/esm/combobox/combobox-item.js +3 -3
- package/esm/combobox/combobox-list.js +2 -2
- package/esm/combobox/combobox-popover.js +16 -12
- package/esm/combobox/combobox-store.d.ts +1 -0
- package/esm/combobox/combobox.js +2 -2
- package/esm/command/command.js +2 -2
- package/esm/composite/composite-item.js +3 -3
- package/esm/composite/composite-overflow-disclosure.js +7 -7
- package/esm/composite/composite-overflow.js +15 -11
- package/esm/composite/composite.js +2 -2
- package/esm/dialog/dialog-backdrop.js +6 -3
- package/esm/dialog/dialog-disclosure.js +5 -5
- package/esm/dialog/dialog-dismiss.js +4 -4
- package/esm/dialog/dialog.d.ts +2 -0
- package/esm/dialog/dialog.js +14 -10
- package/esm/dialog/utils/disable-accessibility-tree-outside.js +3 -2
- package/esm/dialog/utils/disable-tree-outside.js +4 -3
- package/esm/dialog/utils/is-backdrop.d.ts +1 -1
- package/esm/dialog/utils/is-backdrop.js +3 -17
- package/esm/dialog/utils/mark-tree-outside.js +3 -2
- package/esm/dialog/utils/orchestrate.d.ts +2 -7
- package/esm/dialog/utils/orchestrate.js +1 -1
- package/esm/dialog/utils/use-hide-on-interact-outside.js +5 -4
- package/esm/dialog/utils/use-prevent-body-scroll.d.ts +1 -2
- package/esm/dialog/utils/use-prevent-body-scroll.js +3 -2
- package/esm/dialog/utils/use-root-dialog.d.ts +8 -0
- package/esm/dialog/utils/use-root-dialog.js +9 -0
- package/esm/disclosure/disclosure.js +4 -4
- package/esm/focusable/focusable.js +1 -1
- package/esm/form/form-checkbox.js +3 -3
- package/esm/form/form-input.js +1 -1
- package/esm/form/form-push.js +3 -3
- package/esm/form/form-radio.js +4 -4
- package/esm/form/form-remove.js +3 -3
- package/esm/form/form-reset.js +3 -3
- package/esm/form/form-submit.js +3 -3
- package/esm/hovercard/hovercard-anchor.js +2 -2
- package/esm/hovercard/hovercard-disclosure.js +5 -5
- package/esm/hovercard/hovercard-dismiss.js +6 -6
- package/esm/hovercard/hovercard.js +16 -12
- package/esm/menu/menu-bar.js +2 -2
- package/esm/menu/menu-button.js +7 -7
- package/esm/menu/menu-dismiss.js +6 -6
- package/esm/menu/menu-item-checkbox.js +5 -5
- package/esm/menu/menu-item-radio.js +5 -5
- package/esm/menu/menu-item.js +4 -4
- package/esm/menu/menu-list.js +3 -3
- package/esm/menu/menu-store.d.ts +1 -0
- package/esm/menu/menu.js +17 -14
- package/esm/popover/popover-disclosure.js +6 -6
- package/esm/popover/popover-dismiss.js +5 -5
- package/esm/popover/popover.js +15 -11
- package/esm/radio/radio-group.js +2 -2
- package/esm/radio/radio.js +4 -4
- package/esm/select/select-item.js +3 -3
- package/esm/select/select-list.js +3 -3
- package/esm/select/select-popover.js +17 -13
- package/esm/select/select-store.d.ts +1 -0
- package/esm/select/select.js +6 -6
- package/esm/tab/tab-list.js +2 -2
- package/esm/tab/tab-panel.js +1 -1
- package/esm/tab/tab.js +3 -3
- package/esm/toolbar/toolbar-container.js +4 -4
- package/esm/toolbar/toolbar-input.js +4 -4
- package/esm/toolbar/toolbar-item.js +4 -4
- package/esm/toolbar/toolbar.js +2 -2
- package/esm/tooltip/tooltip-anchor.js +2 -2
- package/esm/tooltip/tooltip.js +16 -12
- package/esm/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +6 -2
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isBackdrop
|
|
3
|
+
} from "./IXXFVVA2.js";
|
|
1
4
|
import {
|
|
2
5
|
setAttribute
|
|
3
|
-
} from "./
|
|
6
|
+
} from "./FW6QFGFT.js";
|
|
4
7
|
import {
|
|
5
8
|
walkTreeOutside
|
|
6
9
|
} from "./FV23EKJL.js";
|
|
@@ -11,7 +14,10 @@ function hideElementFromAccessibilityTree(element) {
|
|
|
11
14
|
}
|
|
12
15
|
function disableAccessibilityTreeOutside(...elements) {
|
|
13
16
|
const cleanups = [];
|
|
17
|
+
const ids = elements.map((el) => el == null ? void 0 : el.id);
|
|
14
18
|
walkTreeOutside(elements, (element) => {
|
|
19
|
+
if (isBackdrop(element, ...ids))
|
|
20
|
+
return;
|
|
15
21
|
cleanups.unshift(hideElementFromAccessibilityTree(element));
|
|
16
22
|
});
|
|
17
23
|
const restoreAccessibilityTree = () => {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// src/dialog/utils/orchestrate.ts
|
|
2
|
-
var cleanups =
|
|
2
|
+
var cleanups = /* @__PURE__ */ new WeakMap();
|
|
3
3
|
function orchestrate(element, key, setup) {
|
|
4
|
-
if (!element
|
|
5
|
-
element
|
|
4
|
+
if (!cleanups.has(element)) {
|
|
5
|
+
cleanups.set(element, /* @__PURE__ */ new Map());
|
|
6
6
|
}
|
|
7
|
-
const elementCleanups = element
|
|
7
|
+
const elementCleanups = cleanups.get(element);
|
|
8
8
|
const prevCleanup = elementCleanups.get(key);
|
|
9
9
|
if (!prevCleanup) {
|
|
10
10
|
elementCleanups.set(key, setup());
|
|
@@ -22,7 +22,8 @@ function orchestrate(element, key, setup) {
|
|
|
22
22
|
};
|
|
23
23
|
elementCleanups.set(key, nextCleanup);
|
|
24
24
|
return () => {
|
|
25
|
-
|
|
25
|
+
const isCurrent = elementCleanups.get(key) === nextCleanup;
|
|
26
|
+
if (!isCurrent)
|
|
26
27
|
return;
|
|
27
28
|
cleanup();
|
|
28
29
|
elementCleanups.set(key, prevCleanup);
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isBackdrop
|
|
3
|
+
} from "./IXXFVVA2.js";
|
|
1
4
|
import {
|
|
2
5
|
setProperty
|
|
3
|
-
} from "./
|
|
6
|
+
} from "./FW6QFGFT.js";
|
|
4
7
|
import {
|
|
5
8
|
walkTreeOutside
|
|
6
9
|
} from "./FV23EKJL.js";
|
|
@@ -37,9 +40,14 @@ function isElementMarked(element, id) {
|
|
|
37
40
|
}
|
|
38
41
|
function markTreeOutside(dialogId, ...elements) {
|
|
39
42
|
const cleanups = [];
|
|
43
|
+
const ids = elements.map((el) => el == null ? void 0 : el.id);
|
|
40
44
|
walkTreeOutside(
|
|
41
45
|
elements,
|
|
42
|
-
(element) =>
|
|
46
|
+
(element) => {
|
|
47
|
+
if (isBackdrop(element, ...ids))
|
|
48
|
+
return;
|
|
49
|
+
cleanups.unshift(markElement(element, dialogId));
|
|
50
|
+
},
|
|
43
51
|
(ancestor) => cleanups.unshift(markAncestor(ancestor, dialogId))
|
|
44
52
|
);
|
|
45
53
|
const restoreAccessibilityTree = () => {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// src/dialog/utils/is-backdrop.ts
|
|
2
|
+
function isBackdrop(element, ...ids) {
|
|
3
|
+
if (!element)
|
|
4
|
+
return false;
|
|
5
|
+
const backdrop = element.getAttribute("data-backdrop");
|
|
6
|
+
if (backdrop == null)
|
|
7
|
+
return false;
|
|
8
|
+
if (backdrop === "")
|
|
9
|
+
return true;
|
|
10
|
+
if (backdrop === "true")
|
|
11
|
+
return true;
|
|
12
|
+
if (!ids.length)
|
|
13
|
+
return true;
|
|
14
|
+
return ids.some((id) => backdrop === id);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export {
|
|
18
|
+
isBackdrop
|
|
19
|
+
};
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
markAncestor
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./HCZMY53N.js";
|
|
4
4
|
import {
|
|
5
5
|
Role
|
|
6
6
|
} from "./TZIIKRHF.js";
|
|
7
7
|
import {
|
|
8
8
|
useDisclosureContent
|
|
9
9
|
} from "./WFPVIVLA.js";
|
|
10
|
+
import {
|
|
11
|
+
useDisclosureStore
|
|
12
|
+
} from "./2XOPWNSQ.js";
|
|
10
13
|
import {
|
|
11
14
|
useMergeRefs,
|
|
12
15
|
useSafeLayoutEffect
|
|
@@ -17,8 +20,7 @@ import {
|
|
|
17
20
|
} from "./4BKCJXBM.js";
|
|
18
21
|
|
|
19
22
|
// src/dialog/dialog-backdrop.tsx
|
|
20
|
-
import { isValidElement,
|
|
21
|
-
import { noop } from "@ariakit/core/utils/misc";
|
|
23
|
+
import { isValidElement, useRef } from "react";
|
|
22
24
|
import { jsx } from "react/jsx-runtime";
|
|
23
25
|
function DialogBackdrop({
|
|
24
26
|
store,
|
|
@@ -28,14 +30,7 @@ function DialogBackdrop({
|
|
|
28
30
|
hidden
|
|
29
31
|
}) {
|
|
30
32
|
const ref = useRef(null);
|
|
31
|
-
|
|
32
|
-
() => __spreadProps(__spreadValues({}, store), {
|
|
33
|
-
// Override the setContentElement method to prevent the backdrop from
|
|
34
|
-
// overwriting the dialog's content element. TODO: Refactor this.
|
|
35
|
-
setContentElement: noop
|
|
36
|
-
}),
|
|
37
|
-
[store]
|
|
38
|
-
);
|
|
33
|
+
const disclosure = useDisclosureStore({ disclosure: store });
|
|
39
34
|
const contentElement = store.useState("contentElement");
|
|
40
35
|
useSafeLayoutEffect(() => {
|
|
41
36
|
const backdrop2 = ref.current;
|
|
@@ -59,8 +54,7 @@ function DialogBackdrop({
|
|
|
59
54
|
backdropProps = __spreadProps(__spreadValues({}, backdropProps), { hidden });
|
|
60
55
|
}
|
|
61
56
|
const props = useDisclosureContent(__spreadProps(__spreadValues({
|
|
62
|
-
store,
|
|
63
|
-
id: void 0,
|
|
57
|
+
store: disclosure,
|
|
64
58
|
role: "presentation",
|
|
65
59
|
"data-backdrop": (contentElement == null ? void 0 : contentElement.id) || "",
|
|
66
60
|
alwaysVisible
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useForceUpdate
|
|
3
|
+
} from "./SN2N5P2D.js";
|
|
4
|
+
|
|
5
|
+
// src/dialog/utils/use-root-dialog.ts
|
|
6
|
+
import { useCallback, useEffect } from "react";
|
|
7
|
+
import { getDocument } from "@ariakit/core/utils/dom";
|
|
8
|
+
import { flushSync } from "react-dom";
|
|
9
|
+
function useRootDialog({
|
|
10
|
+
attribute,
|
|
11
|
+
contentId,
|
|
12
|
+
contentElement,
|
|
13
|
+
enabled
|
|
14
|
+
}) {
|
|
15
|
+
const [updated, retry] = useForceUpdate();
|
|
16
|
+
const isRootDialog = useCallback(() => {
|
|
17
|
+
if (!enabled)
|
|
18
|
+
return false;
|
|
19
|
+
if (!contentElement)
|
|
20
|
+
return false;
|
|
21
|
+
const { body } = getDocument(contentElement);
|
|
22
|
+
const id = body.getAttribute(attribute);
|
|
23
|
+
return !id || id === contentId;
|
|
24
|
+
}, [updated, enabled, contentElement, attribute, contentId]);
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
if (!enabled)
|
|
27
|
+
return;
|
|
28
|
+
if (!contentId)
|
|
29
|
+
return;
|
|
30
|
+
if (!contentElement)
|
|
31
|
+
return;
|
|
32
|
+
const { body } = getDocument(contentElement);
|
|
33
|
+
if (isRootDialog()) {
|
|
34
|
+
body.setAttribute(attribute, contentId);
|
|
35
|
+
return () => body.removeAttribute(attribute);
|
|
36
|
+
}
|
|
37
|
+
const observer = new MutationObserver(() => flushSync(retry));
|
|
38
|
+
observer.observe(body, { attributeFilter: [attribute] });
|
|
39
|
+
return () => observer.disconnect();
|
|
40
|
+
}, [updated, enabled, contentId, contentElement, isRootDialog, attribute]);
|
|
41
|
+
return isRootDialog;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export {
|
|
45
|
+
useRootDialog
|
|
46
|
+
};
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
hideElementFromAccessibilityTree
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./CYJJUQU3.js";
|
|
4
4
|
import {
|
|
5
5
|
supportsInert
|
|
6
6
|
} from "./KOVUJERF.js";
|
|
7
|
+
import {
|
|
8
|
+
isBackdrop
|
|
9
|
+
} from "./IXXFVVA2.js";
|
|
7
10
|
import {
|
|
8
11
|
assignStyle,
|
|
9
12
|
setAttribute,
|
|
10
13
|
setProperty
|
|
11
|
-
} from "./
|
|
14
|
+
} from "./FW6QFGFT.js";
|
|
12
15
|
import {
|
|
13
16
|
walkTreeOutside
|
|
14
17
|
} from "./FV23EKJL.js";
|
|
@@ -34,6 +37,7 @@ function disableElement(element) {
|
|
|
34
37
|
}
|
|
35
38
|
function disableTreeOutside(...elements) {
|
|
36
39
|
const cleanups = [];
|
|
40
|
+
const ids = elements.map((el) => el == null ? void 0 : el.id);
|
|
37
41
|
if (!supportsInert()) {
|
|
38
42
|
getAllTabbable().forEach((element) => {
|
|
39
43
|
if (elements.some((el) => el && contains(el, element)))
|
|
@@ -42,6 +46,8 @@ function disableTreeOutside(...elements) {
|
|
|
42
46
|
});
|
|
43
47
|
}
|
|
44
48
|
walkTreeOutside(elements, (element) => {
|
|
49
|
+
if (isBackdrop(element, ...ids))
|
|
50
|
+
return;
|
|
45
51
|
cleanups.unshift(disableElement(element));
|
|
46
52
|
});
|
|
47
53
|
const restoreTreeOutside = () => {
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
assignStyle,
|
|
3
3
|
setCSSProperty
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./FW6QFGFT.js";
|
|
5
5
|
import {
|
|
6
|
-
|
|
7
|
-
} from "./
|
|
6
|
+
useRootDialog
|
|
7
|
+
} from "./PYB45PRS.js";
|
|
8
8
|
|
|
9
9
|
// src/dialog/utils/use-prevent-body-scroll.ts
|
|
10
|
+
import { useEffect } from "react";
|
|
10
11
|
import { getDocument, getWindow } from "@ariakit/core/utils/dom";
|
|
11
12
|
import { chain } from "@ariakit/core/utils/misc";
|
|
12
13
|
import { isApple, isMac } from "@ariakit/core/utils/platform";
|
|
@@ -15,11 +16,18 @@ function getPaddingProperty(documentElement) {
|
|
|
15
16
|
const scrollbarX = Math.round(documentLeft) + documentElement.scrollLeft;
|
|
16
17
|
return scrollbarX ? "paddingLeft" : "paddingRight";
|
|
17
18
|
}
|
|
18
|
-
function usePreventBodyScroll(
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
function usePreventBodyScroll(contentElement, contentId, enabled) {
|
|
20
|
+
const isRootDialog = useRootDialog({
|
|
21
|
+
attribute: "data-dialog-prevent-body-scroll",
|
|
22
|
+
contentElement,
|
|
23
|
+
contentId,
|
|
24
|
+
enabled
|
|
25
|
+
});
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
if (!isRootDialog())
|
|
28
|
+
return;
|
|
29
|
+
if (!contentElement)
|
|
21
30
|
return;
|
|
22
|
-
const { contentElement } = store.getState();
|
|
23
31
|
const doc = getDocument(contentElement);
|
|
24
32
|
const win = getWindow(contentElement);
|
|
25
33
|
const { documentElement, body } = doc;
|
|
@@ -60,7 +68,7 @@ function usePreventBodyScroll(store, enabled) {
|
|
|
60
68
|
setScrollbarWidthProperty(),
|
|
61
69
|
isIOS ? setIOSStyle() : setStyle()
|
|
62
70
|
);
|
|
63
|
-
}, [
|
|
71
|
+
}, [isRootDialog, contentElement]);
|
|
64
72
|
}
|
|
65
73
|
|
|
66
74
|
export {
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DialogBackdrop
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./LIFXUQPU.js";
|
|
4
4
|
import {
|
|
5
5
|
disableTreeOutside
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./QLHUIPVK.js";
|
|
7
7
|
import {
|
|
8
8
|
disableAccessibilityTreeOutside
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./CYJJUQU3.js";
|
|
10
10
|
import {
|
|
11
11
|
usePreventBodyScroll
|
|
12
|
-
} from "./
|
|
12
|
+
} from "./RU5SBKR3.js";
|
|
13
13
|
import {
|
|
14
14
|
useNestedDialogs
|
|
15
15
|
} from "./J4BKICPJ.js";
|
|
16
16
|
import {
|
|
17
17
|
useHideOnInteractOutside
|
|
18
|
-
} from "./
|
|
18
|
+
} from "./VV72RDTD.js";
|
|
19
19
|
import {
|
|
20
20
|
prependHiddenDismiss
|
|
21
21
|
} from "./62DFK33R.js";
|
|
22
22
|
import {
|
|
23
23
|
isElementMarked,
|
|
24
24
|
markTreeOutside
|
|
25
|
-
} from "./
|
|
25
|
+
} from "./HCZMY53N.js";
|
|
26
26
|
import {
|
|
27
27
|
useFocusableContainer
|
|
28
28
|
} from "./GKH7N3JM.js";
|
|
@@ -43,7 +43,7 @@ import {
|
|
|
43
43
|
} from "./WFPVIVLA.js";
|
|
44
44
|
import {
|
|
45
45
|
useFocusable
|
|
46
|
-
} from "./
|
|
46
|
+
} from "./YNUPNUID.js";
|
|
47
47
|
import {
|
|
48
48
|
createComponent,
|
|
49
49
|
createElement,
|
|
@@ -140,10 +140,7 @@ var useDialog = createHook(
|
|
|
140
140
|
"finalFocus"
|
|
141
141
|
]);
|
|
142
142
|
const ref = useRef(null);
|
|
143
|
-
const { portalRef,
|
|
144
|
-
portal,
|
|
145
|
-
props.portalRef
|
|
146
|
-
);
|
|
143
|
+
const { portalRef, domReady } = usePortalRef(portal, props.portalRef);
|
|
147
144
|
const preserveTabOrderProp = props.preserveTabOrder;
|
|
148
145
|
const preserveTabOrder = store.useState(
|
|
149
146
|
(state) => preserveTabOrderProp && !modal && state.mounted
|
|
@@ -153,7 +150,7 @@ var useDialog = createHook(
|
|
|
153
150
|
const mounted = store.useState("mounted");
|
|
154
151
|
const contentElement = store.useState("contentElement");
|
|
155
152
|
const hidden = isHidden(mounted, props.hidden, props.alwaysVisible);
|
|
156
|
-
usePreventBodyScroll(
|
|
153
|
+
usePreventBodyScroll(contentElement, id, preventBodyScroll && !hidden);
|
|
157
154
|
useHideOnInteractOutside(store, hideOnInteractOutside);
|
|
158
155
|
const { wrapElement, nestedDialogs } = useNestedDialogs(store);
|
|
159
156
|
props = useWrapElement(props, wrapElement, [wrapElement]);
|
|
@@ -222,6 +219,8 @@ var useDialog = createHook(
|
|
|
222
219
|
}, [mounted, domReady, shouldDisableAccessibilityTree]);
|
|
223
220
|
const getPersistentElementsProp = useEvent(getPersistentElements);
|
|
224
221
|
useSafeLayoutEffect(() => {
|
|
222
|
+
if (!domReady)
|
|
223
|
+
return;
|
|
225
224
|
if (!id)
|
|
226
225
|
return;
|
|
227
226
|
if (!open)
|
|
@@ -230,14 +229,8 @@ var useDialog = createHook(
|
|
|
230
229
|
const dialog = ref.current;
|
|
231
230
|
const persistentElements = getPersistentElementsProp() || [];
|
|
232
231
|
const allElements = [
|
|
233
|
-
// In addition to the dialog element, we also include the portal node
|
|
234
|
-
// here so nested dialogs are considered as well.
|
|
235
232
|
dialog,
|
|
236
|
-
portalNode,
|
|
237
233
|
...persistentElements,
|
|
238
|
-
// We still need to include nested dialogs here because they may be
|
|
239
|
-
// outside the portal node or the parent dialog may not be using a
|
|
240
|
-
// portal.
|
|
241
234
|
...nestedDialogs.map((dialog2) => dialog2.getState().contentElement)
|
|
242
235
|
];
|
|
243
236
|
if (!shouldDisableAccessibilityTree) {
|
|
@@ -254,13 +247,12 @@ var useDialog = createHook(
|
|
|
254
247
|
disableAccessibilityTreeOutside(...allElements)
|
|
255
248
|
);
|
|
256
249
|
}, [
|
|
250
|
+
domReady,
|
|
257
251
|
id,
|
|
258
252
|
open,
|
|
259
253
|
store,
|
|
260
|
-
portal,
|
|
261
|
-
portalNode,
|
|
262
|
-
nestedDialogs,
|
|
263
254
|
getPersistentElementsProp,
|
|
255
|
+
nestedDialogs,
|
|
264
256
|
shouldDisableAccessibilityTree,
|
|
265
257
|
modal
|
|
266
258
|
]);
|
|
@@ -407,22 +399,21 @@ var useDialog = createHook(
|
|
|
407
399
|
props = useWrapElement(
|
|
408
400
|
props,
|
|
409
401
|
(element) => {
|
|
410
|
-
if (backdrop)
|
|
411
|
-
return
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
}
|
|
425
|
-
return element;
|
|
402
|
+
if (!backdrop)
|
|
403
|
+
return element;
|
|
404
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
405
|
+
/* @__PURE__ */ jsx(
|
|
406
|
+
DialogBackdrop,
|
|
407
|
+
{
|
|
408
|
+
store,
|
|
409
|
+
backdrop,
|
|
410
|
+
backdropProps,
|
|
411
|
+
hidden: hiddenProp,
|
|
412
|
+
alwaysVisible
|
|
413
|
+
}
|
|
414
|
+
),
|
|
415
|
+
element
|
|
416
|
+
] });
|
|
426
417
|
},
|
|
427
418
|
[store, backdrop, backdropProps, hiddenProp, alwaysVisible]
|
|
428
419
|
);
|
|
@@ -232,7 +232,7 @@ var useFocusable = createHook(
|
|
|
232
232
|
receivedFocus = true;
|
|
233
233
|
};
|
|
234
234
|
const options = { capture: true, once: true };
|
|
235
|
-
|
|
235
|
+
element.addEventListener("focusin", onFocus, options);
|
|
236
236
|
queueBeforeEvent(element, "mouseup", () => {
|
|
237
237
|
element.removeEventListener("focusin", onFocus, true);
|
|
238
238
|
if (receivedFocus)
|
package/esm/button/button.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Button,
|
|
3
3
|
useButton
|
|
4
|
-
} from "../__chunks/
|
|
5
|
-
import "../__chunks/
|
|
6
|
-
import "../__chunks/
|
|
4
|
+
} from "../__chunks/EUD77B6Z.js";
|
|
5
|
+
import "../__chunks/WQIYBPAY.js";
|
|
6
|
+
import "../__chunks/YNUPNUID.js";
|
|
7
7
|
import "../__chunks/BMLNRUFQ.js";
|
|
8
8
|
import "../__chunks/7GCARSHZ.js";
|
|
9
9
|
import "../__chunks/SN2N5P2D.js";
|
package/esm/checkbox/checkbox.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Checkbox,
|
|
3
3
|
useCheckbox
|
|
4
|
-
} from "../__chunks/
|
|
4
|
+
} from "../__chunks/FYZCYWPI.js";
|
|
5
5
|
import "../__chunks/M5KYRTQG.js";
|
|
6
|
-
import "../__chunks/
|
|
7
|
-
import "../__chunks/
|
|
6
|
+
import "../__chunks/WQIYBPAY.js";
|
|
7
|
+
import "../__chunks/YNUPNUID.js";
|
|
8
8
|
import "../__chunks/BMLNRUFQ.js";
|
|
9
9
|
import "../__chunks/7GCARSHZ.js";
|
|
10
10
|
import "../__chunks/USB5JBON.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useButton
|
|
3
|
-
} from "../__chunks/
|
|
4
|
-
import "../__chunks/
|
|
5
|
-
import "../__chunks/
|
|
3
|
+
} from "../__chunks/EUD77B6Z.js";
|
|
4
|
+
import "../__chunks/WQIYBPAY.js";
|
|
5
|
+
import "../__chunks/YNUPNUID.js";
|
|
6
6
|
import "../__chunks/BMLNRUFQ.js";
|
|
7
7
|
import {
|
|
8
8
|
createComponent,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useDialogDisclosure
|
|
3
|
-
} from "../__chunks/
|
|
4
|
-
import "../__chunks/
|
|
5
|
-
import "../__chunks/
|
|
6
|
-
import "../__chunks/
|
|
7
|
-
import "../__chunks/
|
|
3
|
+
} from "../__chunks/KF3PP2P3.js";
|
|
4
|
+
import "../__chunks/OTMCQXXR.js";
|
|
5
|
+
import "../__chunks/EUD77B6Z.js";
|
|
6
|
+
import "../__chunks/WQIYBPAY.js";
|
|
7
|
+
import "../__chunks/YNUPNUID.js";
|
|
8
8
|
import "../__chunks/BMLNRUFQ.js";
|
|
9
9
|
import {
|
|
10
10
|
createComponent,
|