@ariakit/react 0.4.25 → 0.4.27
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 +31 -0
- package/cjs/__chunks/2HXQHKBC.cjs +59 -0
- package/cjs/__chunks/2MDC3Z3V.cjs +43 -0
- package/cjs/__chunks/334WKW6I.cjs +19 -0
- package/cjs/__chunks/34UJGLOZ.cjs +236 -0
- package/cjs/__chunks/3FIXGHZ2.cjs +59 -0
- package/cjs/__chunks/4RKQMGBK.cjs +1179 -0
- package/cjs/__chunks/5NTEPQ2U.cjs +148 -0
- package/cjs/__chunks/66G6K4UR.cjs +1 -0
- package/cjs/__chunks/6GNM57O7.cjs +1 -0
- package/cjs/__chunks/7M4GY5DS.cjs +255 -0
- package/cjs/__chunks/7MXJT4IN.cjs +17 -0
- package/cjs/__chunks/7POA4244.cjs +184 -0
- package/cjs/__chunks/ASOIXRUN.cjs +305 -0
- package/cjs/__chunks/C4NVIV6V.cjs +455 -0
- package/cjs/__chunks/CR6AS7WL.cjs +1 -0
- package/cjs/__chunks/D4HCGWOU.cjs +464 -0
- package/cjs/__chunks/DVWS2XPY.cjs +107 -0
- package/cjs/__chunks/DWSXHZYM.cjs +20 -0
- package/cjs/__chunks/E6EV2Q5P.cjs +1 -0
- package/cjs/__chunks/FELYQPO5.cjs +1025 -0
- package/cjs/__chunks/FHQ5DVYQ.cjs +34 -0
- package/cjs/__chunks/FIPBE5IX.cjs +23 -0
- package/cjs/__chunks/FVIS5BFZ.cjs +41 -0
- package/cjs/__chunks/GUB6WHB6.cjs +51 -0
- package/cjs/__chunks/GUY4MKX2.cjs +56 -0
- package/cjs/__chunks/IF5DZKAR.cjs +1 -0
- package/cjs/__chunks/IFZV5LA3.cjs +94 -0
- package/cjs/__chunks/IHVFJGGN.cjs +32 -0
- package/cjs/__chunks/L2IFVMDU.cjs +96 -0
- package/cjs/__chunks/LCX235VJ.cjs +53 -0
- package/cjs/__chunks/LMCBLO3G.cjs +42 -0
- package/cjs/__chunks/LS5VO6AA.cjs +44 -0
- package/cjs/__chunks/LVHC4DSB.cjs +117 -0
- package/cjs/__chunks/MN5TONXW.cjs +123 -0
- package/cjs/__chunks/N3DLR7OL.cjs +34 -0
- package/cjs/__chunks/NFZWL7LE.cjs +24 -0
- package/cjs/__chunks/NG34QRI6.cjs +264 -0
- package/cjs/__chunks/NIOJG7C4.cjs +1 -0
- package/cjs/__chunks/NMUCJYMR.cjs +496 -0
- package/cjs/__chunks/OOFUBC32.cjs +109 -0
- package/cjs/__chunks/OQRQJNBU.cjs +1 -0
- package/cjs/__chunks/PDPE2VAZ.cjs +1035 -0
- package/cjs/__chunks/PTE2IJM5.cjs +143 -0
- package/cjs/__chunks/PU63IQFD.cjs +447 -0
- package/cjs/__chunks/PZXRBFZF.cjs +38 -0
- package/cjs/__chunks/QAUJZR6Y.cjs +996 -0
- package/cjs/__chunks/QYDAT3QF.cjs +1 -0
- package/cjs/__chunks/QYLMYWKV.cjs +1 -0
- package/cjs/__chunks/RGH2H3WL.cjs +34 -0
- package/cjs/__chunks/RLKC7JVT.cjs +19 -0
- package/cjs/__chunks/RR46KI45.cjs +17 -0
- package/cjs/__chunks/RVXPEX7O.cjs +150 -0
- package/cjs/__chunks/RXZPZPJX.cjs +95 -0
- package/cjs/__chunks/SIF7IN4L.cjs +62 -0
- package/cjs/__chunks/SQ72MZ63.cjs +294 -0
- package/cjs/__chunks/SXAPGTJ4.cjs +23 -0
- package/cjs/__chunks/TLUFYZC7.cjs +37 -0
- package/cjs/__chunks/TSBEWPNT.cjs +1922 -0
- package/cjs/__chunks/U2UYQT45.cjs +1 -0
- package/cjs/__chunks/UUEFM3TG.cjs +75 -0
- package/cjs/__chunks/UV7CXZEM.cjs +36 -0
- package/cjs/__chunks/VXDLN5CP.cjs +234 -0
- package/cjs/__chunks/VXUZM542.cjs +789 -0
- package/cjs/__chunks/W27WRDUB.cjs +1 -0
- package/cjs/__chunks/X4U3XKYQ.cjs +7 -0
- package/cjs/__chunks/XH4GE3VE.cjs +29 -0
- package/cjs/__chunks/XPQIHUQ7.cjs +172 -0
- package/cjs/__chunks/YEXJT4IL.cjs +55 -0
- package/cjs/__chunks/Z5PDS46M.cjs +975 -0
- package/cjs/__chunks/ZNW2LLWJ.cjs +108 -0
- package/cjs/__chunks/ZYPARRXG.cjs +19 -0
- package/cjs/button.cjs +7 -3
- package/cjs/button.d.cts +2 -2
- package/cjs/button.d.ts +2 -2
- package/cjs/checkbox.cjs +11 -2
- package/cjs/checkbox.d.cts +9 -9
- package/cjs/checkbox.d.ts +9 -9
- package/cjs/collection.cjs +8 -2
- package/cjs/collection.d.cts +9 -9
- package/cjs/collection.d.ts +9 -9
- package/cjs/combobox.cjs +33 -2
- package/cjs/combobox.d.cts +33 -33
- package/cjs/combobox.d.ts +33 -33
- package/cjs/command.cjs +6 -3
- package/cjs/command.d.cts +2 -2
- package/cjs/command.d.ts +2 -2
- package/cjs/composite.cjs +24 -2
- package/cjs/composite.d.cts +21 -21
- package/cjs/composite.d.ts +21 -21
- package/cjs/dialog.cjs +24 -2
- package/cjs/dialog.d.cts +15 -15
- package/cjs/dialog.d.ts +15 -15
- package/cjs/disclosure.cjs +11 -2
- package/cjs/disclosure.d.cts +9 -9
- package/cjs/disclosure.d.ts +9 -9
- package/cjs/focus-trap.cjs +6 -2
- package/cjs/focus-trap.d.cts +4 -4
- package/cjs/focus-trap.d.ts +4 -4
- package/cjs/focusable.cjs +5 -3
- package/cjs/focusable.d.cts +2 -2
- package/cjs/focusable.d.ts +2 -2
- package/cjs/form.cjs +15 -2
- package/cjs/form.d.cts +37 -37
- package/cjs/form.d.ts +37 -37
- package/cjs/group.cjs +5 -3
- package/cjs/group.d.cts +4 -4
- package/cjs/group.d.ts +4 -4
- package/cjs/heading.cjs +7 -3
- package/cjs/heading.d.cts +4 -4
- package/cjs/heading.d.ts +4 -4
- package/cjs/hovercard.cjs +28 -2
- package/cjs/hovercard.d.cts +19 -19
- package/cjs/hovercard.d.ts +19 -19
- package/cjs/index.cjs +103 -28
- package/cjs/menu.cjs +44 -2
- package/cjs/menu.d.cts +41 -41
- package/cjs/menu.d.ts +41 -41
- package/cjs/menubar.cjs +10 -3
- package/cjs/menubar.d.cts +7 -7
- package/cjs/menubar.d.ts +7 -7
- package/cjs/popover.cjs +33 -2
- package/cjs/popover.d.cts +21 -21
- package/cjs/popover.d.ts +21 -21
- package/cjs/portal.cjs +7 -3
- package/cjs/portal.d.cts +3 -3
- package/cjs/portal.d.ts +3 -3
- package/cjs/radio.cjs +13 -2
- package/cjs/radio.d.cts +9 -9
- package/cjs/radio.d.ts +9 -9
- package/cjs/role.cjs +5 -3
- package/cjs/role.d.cts +2 -2
- package/cjs/role.d.ts +2 -2
- package/cjs/select.cjs +39 -2
- package/cjs/select.d.cts +33 -33
- package/cjs/select.d.ts +33 -33
- package/cjs/separator.cjs +5 -3
- package/cjs/separator.d.cts +2 -2
- package/cjs/separator.d.ts +2 -2
- package/cjs/store.cjs +5 -3
- package/cjs/store.d.cts +1 -1
- package/cjs/store.d.ts +1 -1
- package/cjs/tab.cjs +15 -2
- package/cjs/tab.d.cts +11 -11
- package/cjs/tab.d.ts +11 -11
- package/cjs/toolbar.cjs +13 -2
- package/cjs/toolbar.d.cts +15 -15
- package/cjs/toolbar.d.ts +15 -15
- package/cjs/tooltip.cjs +16 -2
- package/cjs/tooltip.d.cts +11 -11
- package/cjs/tooltip.d.ts +11 -11
- package/cjs/visually-hidden.cjs +5 -3
- package/cjs/visually-hidden.d.cts +2 -2
- package/cjs/visually-hidden.d.ts +2 -2
- package/esm/__chunks/2RKMXQTW.js +10 -0
- package/esm/__chunks/3Y4V2DTP.js +8 -0
- package/esm/__chunks/5FGJT4YF.js +10 -0
- package/esm/__chunks/ASWYYI35.js +26 -0
- package/esm/__chunks/BCX2X2B5.js +40 -0
- package/esm/__chunks/BLUBZ7NO.js +28 -0
- package/esm/__chunks/CKEWLSMJ.js +8 -0
- package/esm/__chunks/CSCX5ZBZ.js +40 -0
- package/esm/__chunks/CTJDBGJU.js +18 -0
- package/esm/__chunks/DAO5N24L.js +16 -0
- package/esm/__chunks/E3G6CWS6.js +16 -0
- package/esm/__chunks/IVVNCX6W.js +16 -0
- package/esm/__chunks/LQB76ROL.js +16 -0
- package/esm/__chunks/MALDUIAO.js +28 -0
- package/esm/__chunks/MP5ILXF3.js +14 -0
- package/esm/__chunks/O3FPWSHV.js +10 -0
- package/esm/__chunks/OKEWM6H4.js +10 -0
- package/esm/__chunks/QL3WKMBE.js +8 -0
- package/esm/__chunks/RD2DI27Y.js +44 -0
- package/esm/__chunks/SB7MN4B3.js +22 -0
- package/esm/__chunks/UA4GRLAL.js +52 -0
- package/esm/__chunks/UBB5N3OM.js +22 -0
- package/esm/__chunks/WC6KFHZH.js +8 -0
- package/esm/__chunks/WFREFNZD.js +8 -0
- package/esm/__chunks/WH35KJXV.js +8 -0
- package/esm/__chunks/WQKZESWL.js +18 -0
- package/esm/__chunks/YAS6EMRP.js +8 -0
- package/esm/button.d.ts +2 -2
- package/esm/button.js +1 -1
- package/esm/checkbox.d.ts +9 -9
- package/esm/checkbox.js +1 -1
- package/esm/collection.d.ts +9 -9
- package/esm/collection.js +1 -1
- package/esm/combobox.d.ts +33 -33
- package/esm/combobox.js +1 -1
- package/esm/command.d.ts +2 -2
- package/esm/command.js +1 -1
- package/esm/composite.d.ts +21 -21
- package/esm/composite.js +1 -1
- package/esm/dialog.d.ts +15 -15
- package/esm/dialog.js +1 -1
- package/esm/disclosure.d.ts +9 -9
- package/esm/disclosure.js +1 -1
- package/esm/focus-trap.d.ts +4 -4
- package/esm/focus-trap.js +1 -1
- package/esm/focusable.d.ts +2 -2
- package/esm/focusable.js +1 -1
- package/esm/form.d.ts +37 -37
- package/esm/form.js +1 -1
- package/esm/group.d.ts +4 -4
- package/esm/group.js +1 -1
- package/esm/heading.d.ts +4 -4
- package/esm/heading.js +1 -1
- package/esm/hovercard.d.ts +19 -19
- package/esm/hovercard.js +1 -1
- package/esm/index.js +27 -27
- package/esm/menu.d.ts +41 -41
- package/esm/menu.js +1 -1
- package/esm/menubar.d.ts +7 -7
- package/esm/menubar.js +1 -1
- package/esm/popover.d.ts +21 -21
- package/esm/popover.js +1 -1
- package/esm/portal.d.ts +3 -3
- package/esm/portal.js +1 -1
- package/esm/radio.d.ts +9 -9
- package/esm/radio.js +1 -1
- package/esm/role.d.ts +2 -2
- package/esm/role.js +1 -1
- package/esm/select.d.ts +33 -33
- package/esm/select.js +1 -1
- package/esm/separator.d.ts +2 -2
- package/esm/separator.js +1 -1
- package/esm/store.d.ts +1 -1
- package/esm/store.js +1 -1
- package/esm/tab.d.ts +11 -11
- package/esm/tab.js +1 -1
- package/esm/toolbar.d.ts +15 -15
- package/esm/toolbar.js +1 -1
- package/esm/tooltip.d.ts +11 -11
- package/esm/tooltip.js +1 -1
- package/esm/visually-hidden.d.ts +2 -2
- package/esm/visually-hidden.js +1 -1
- package/package.json +2 -2
- package/src/button.ts +5 -0
- package/src/checkbox.ts +19 -0
- package/src/collection.ts +19 -0
- package/src/combobox.ts +76 -0
- package/src/command.ts +5 -0
- package/src/composite.ts +49 -0
- package/src/dialog.ts +34 -0
- package/src/disclosure.ts +19 -0
- package/src/focus-trap.ts +11 -0
- package/src/focusable.ts +5 -0
- package/src/form.ts +90 -0
- package/src/group.ts +10 -0
- package/src/heading.ts +7 -0
- package/src/hovercard.ts +44 -0
- package/src/index.ts +27 -0
- package/src/menu.ts +100 -0
- package/src/menubar.ts +14 -0
- package/src/popover.ts +49 -0
- package/src/portal.ts +6 -0
- package/src/radio.ts +19 -0
- package/src/role.ts +5 -0
- package/src/select.ts +76 -0
- package/src/separator.ts +5 -0
- package/src/store.ts +1 -0
- package/src/tab.ts +21 -0
- package/src/toolbar.ts +34 -0
- package/src/tooltip.ts +24 -0
- package/src/visually-hidden.ts +5 -0
- package/cjs/__chunks/24MX6KII.cjs +0 -14
- package/cjs/__chunks/2IFRJ7YS.cjs +0 -6
- package/cjs/__chunks/32YVOHOP.cjs +0 -50
- package/cjs/__chunks/4BAIAF3U.cjs +0 -14
- package/cjs/__chunks/4J2CIZDN.cjs +0 -14
- package/cjs/__chunks/4TTUYQMJ.cjs +0 -20
- package/cjs/__chunks/6QAXTQNM.cjs +0 -16
- package/cjs/__chunks/6WNPYLAU.cjs +0 -6
- package/cjs/__chunks/A2CP2RQF.cjs +0 -24
- package/cjs/__chunks/AEV4Y6LH.cjs +0 -8
- package/cjs/__chunks/APHGV4DJ.cjs +0 -6
- package/cjs/__chunks/B34XK6WF.cjs +0 -8
- package/cjs/__chunks/BFD7ZBIV.cjs +0 -26
- package/cjs/__chunks/CZIDOP5N.cjs +0 -38
- package/cjs/__chunks/ETUDK33Z.cjs +0 -26
- package/cjs/__chunks/GJC4LCYO.cjs +0 -16
- package/cjs/__chunks/KGVA5X7R.cjs +0 -38
- package/cjs/__chunks/LAX4QA6C.cjs +0 -42
- package/cjs/__chunks/MDOKA7B5.cjs +0 -6
- package/cjs/__chunks/Q2GGGIV7.cjs +0 -6
- package/cjs/__chunks/QKCQWENM.cjs +0 -6
- package/cjs/__chunks/QPSUJCLN.cjs +0 -12
- package/cjs/__chunks/TDX6HS73.cjs +0 -8
- package/cjs/__chunks/UPMOBIQ3.cjs +0 -20
- package/cjs/__chunks/W6XMZ4GT.cjs +0 -14
- package/cjs/__chunks/WXEUE6MJ.cjs +0 -6
- package/cjs/__chunks/XTZIX6PF.cjs +0 -8
- package/esm/__chunks/3IMSX6M3.js +0 -8
- package/esm/__chunks/4H6IIOQF.js +0 -22
- package/esm/__chunks/5OF2JM6T.js +0 -16
- package/esm/__chunks/6FL2IFMJ.js +0 -16
- package/esm/__chunks/6N4GEF7O.js +0 -18
- package/esm/__chunks/6OHDLPN7.js +0 -8
- package/esm/__chunks/7FQAKYJR.js +0 -26
- package/esm/__chunks/AJMZU3YP.js +0 -28
- package/esm/__chunks/DZPSY7QT.js +0 -22
- package/esm/__chunks/H2GJECQG.js +0 -8
- package/esm/__chunks/JBAWBCWC.js +0 -8
- package/esm/__chunks/LI3X5M2M.js +0 -8
- package/esm/__chunks/NV5BVS3O.js +0 -8
- package/esm/__chunks/PGIWSRTG.js +0 -28
- package/esm/__chunks/PRYHFEBA.js +0 -10
- package/esm/__chunks/UTW5KHW6.js +0 -16
- package/esm/__chunks/VGHCPDMA.js +0 -8
- package/esm/__chunks/VHD2YK6B.js +0 -18
- package/esm/__chunks/WA3BE3AY.js +0 -10
- package/esm/__chunks/XHSNLTYJ.js +0 -10
- package/esm/__chunks/XIMRDTWX.js +0 -14
- package/esm/__chunks/YQF2RGHD.js +0 -44
- package/esm/__chunks/ZDPYYVJP.js +0 -40
- package/esm/__chunks/ZFJPKQV6.js +0 -52
- package/esm/__chunks/ZL4AJIDL.js +0 -10
- package/esm/__chunks/ZQSDMYJA.js +0 -16
- package/esm/__chunks/ZVIXWGHS.js +0 -40
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _7M4GY5DScjs = require('./7M4GY5DS.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _LMCBLO3Gcjs = require('./LMCBLO3G.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _D4HCGWOUcjs = require('./D4HCGWOU.cjs');
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
var _QAUJZR6Ycjs = require('./QAUJZR6Y.cjs');
|
|
20
|
+
|
|
21
|
+
// ../ariakit-react-components/dist/disclosure/disclosure.js
|
|
22
|
+
var _react = require('react');
|
|
23
|
+
var TagName = "button";
|
|
24
|
+
var symbol = /* @__PURE__ */ Symbol("disclosure");
|
|
25
|
+
var useDisclosure = _QAUJZR6Ycjs.createHook.call(void 0, function useDisclosure2({ store, toggleOnClick = true, ...props }) {
|
|
26
|
+
var _a;
|
|
27
|
+
const context = _7M4GY5DScjs.useDisclosureProviderContext.call(void 0, );
|
|
28
|
+
store = store || context;
|
|
29
|
+
_QAUJZR6Ycjs.invariant.call(void 0, store, "Disclosure must receive a `store` prop or be wrapped in a DisclosureProvider component.");
|
|
30
|
+
const ref = _react.useRef.call(void 0, null);
|
|
31
|
+
const [expanded, setExpanded] = _react.useState.call(void 0, false);
|
|
32
|
+
const disclosureElement = _D4HCGWOUcjs.useStoreState.call(void 0, store, "disclosureElement");
|
|
33
|
+
const open = _D4HCGWOUcjs.useStoreState.call(void 0, store, "open");
|
|
34
|
+
_react.useEffect.call(void 0, () => {
|
|
35
|
+
let isCurrentDisclosure = disclosureElement === ref.current;
|
|
36
|
+
if (!(disclosureElement == null ? void 0 : disclosureElement.isConnected)) {
|
|
37
|
+
store == null ? void 0 : store.setDisclosureElement(ref.current);
|
|
38
|
+
isCurrentDisclosure = true;
|
|
39
|
+
}
|
|
40
|
+
setExpanded(open && isCurrentDisclosure);
|
|
41
|
+
}, [
|
|
42
|
+
disclosureElement,
|
|
43
|
+
store,
|
|
44
|
+
open
|
|
45
|
+
]);
|
|
46
|
+
const onClickProp = props.onClick;
|
|
47
|
+
const toggleOnClickProp = _QAUJZR6Ycjs.useBooleanEvent.call(void 0, toggleOnClick);
|
|
48
|
+
const [isDuplicate, metadataProps] = _QAUJZR6Ycjs.useMetadataProps.call(void 0, props, symbol, true);
|
|
49
|
+
const onClick = _QAUJZR6Ycjs.useEvent.call(void 0, (event) => {
|
|
50
|
+
onClickProp == null ? void 0 : onClickProp(event);
|
|
51
|
+
if (event.defaultPrevented) return;
|
|
52
|
+
if (isDuplicate) return;
|
|
53
|
+
if (!toggleOnClickProp(event)) return;
|
|
54
|
+
store == null ? void 0 : store.setDisclosureElement(event.currentTarget);
|
|
55
|
+
store == null ? void 0 : store.toggle();
|
|
56
|
+
});
|
|
57
|
+
props = {
|
|
58
|
+
"aria-expanded": expanded,
|
|
59
|
+
"aria-controls": (_a = _D4HCGWOUcjs.useStoreState.call(void 0, store, "contentElement")) == null ? void 0 : _a.id,
|
|
60
|
+
...metadataProps,
|
|
61
|
+
...props,
|
|
62
|
+
ref: _QAUJZR6Ycjs.useMergeRefs.call(void 0, ref, props.ref),
|
|
63
|
+
onClick
|
|
64
|
+
};
|
|
65
|
+
props = _LMCBLO3Gcjs.useButton.call(void 0, props);
|
|
66
|
+
return props;
|
|
67
|
+
});
|
|
68
|
+
var Disclosure = _QAUJZR6Ycjs.forwardRef.call(void 0, function Disclosure2(props) {
|
|
69
|
+
return _QAUJZR6Ycjs.createElement.call(void 0, TagName, useDisclosure(props));
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
exports.useDisclosure = useDisclosure; exports.Disclosure = Disclosure;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _7M4GY5DScjs = require('./7M4GY5DS.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
var _QAUJZR6Ycjs = require('./QAUJZR6Y.cjs');
|
|
12
|
+
|
|
13
|
+
// ../ariakit-react-components/dist/dialog/dialog-description.js
|
|
14
|
+
var _react = require('react');
|
|
15
|
+
var TagName = "p";
|
|
16
|
+
var useDialogDescription = _QAUJZR6Ycjs.createHook.call(void 0, function useDialogDescription2({ store, ...props }) {
|
|
17
|
+
const setDescriptionId = _react.useContext.call(void 0, _7M4GY5DScjs.DialogDescriptionContext);
|
|
18
|
+
const id = _QAUJZR6Ycjs.useId.call(void 0, props.id);
|
|
19
|
+
_QAUJZR6Ycjs.useSafeLayoutEffect.call(void 0, () => {
|
|
20
|
+
setDescriptionId == null ? void 0 : setDescriptionId(id);
|
|
21
|
+
return () => setDescriptionId == null ? void 0 : setDescriptionId(void 0);
|
|
22
|
+
}, [setDescriptionId, id]);
|
|
23
|
+
props = {
|
|
24
|
+
...props,
|
|
25
|
+
id
|
|
26
|
+
};
|
|
27
|
+
return _QAUJZR6Ycjs.removeUndefinedValues.call(void 0, props);
|
|
28
|
+
});
|
|
29
|
+
var DialogDescription = _QAUJZR6Ycjs.forwardRef.call(void 0, function DialogDescription2(props) {
|
|
30
|
+
return _QAUJZR6Ycjs.createElement.call(void 0, TagName, useDialogDescription(props));
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
exports.useDialogDescription = useDialogDescription; exports.DialogDescription = DialogDescription;
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _N3DLR7OLcjs = require('./N3DLR7OL.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
var _QAUJZR6Ycjs = require('./QAUJZR6Y.cjs');
|
|
19
|
+
|
|
20
|
+
// ../ariakit-react-components/dist/portal/portal-context.js
|
|
21
|
+
var _react = require('react');
|
|
22
|
+
var PortalContext = _react.createContext.call(void 0, null);
|
|
23
|
+
|
|
24
|
+
// ../ariakit-react-components/dist/portal/portal.js
|
|
25
|
+
|
|
26
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
27
|
+
var _reactdom = require('react-dom');
|
|
28
|
+
var TagName = "div";
|
|
29
|
+
function getRootElement(element) {
|
|
30
|
+
const doc = _QAUJZR6Ycjs.getDocument.call(void 0, element);
|
|
31
|
+
const { fullscreenElement } = doc;
|
|
32
|
+
if (fullscreenElement instanceof HTMLElement) return fullscreenElement;
|
|
33
|
+
return doc.body;
|
|
34
|
+
}
|
|
35
|
+
function getPortalElement(element, portalElement) {
|
|
36
|
+
if (!portalElement) return _QAUJZR6Ycjs.getDocument.call(void 0, element).createElement("div");
|
|
37
|
+
if (typeof portalElement === "function") return portalElement(element);
|
|
38
|
+
return portalElement;
|
|
39
|
+
}
|
|
40
|
+
function getRandomId(prefix = "id") {
|
|
41
|
+
return `${prefix ? `${prefix}-` : ""}${Math.random().toString(36).slice(2, 8)}`;
|
|
42
|
+
}
|
|
43
|
+
function queueFocus(element) {
|
|
44
|
+
queueMicrotask(() => {
|
|
45
|
+
element == null ? void 0 : element.focus();
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
var usePortal = _QAUJZR6Ycjs.createHook.call(void 0, function usePortal2({ preserveTabOrder, preserveTabOrderAnchor, portalElement, portalRef, portal = true, ...props }) {
|
|
49
|
+
const ref = _react.useRef.call(void 0, null);
|
|
50
|
+
const refProp = _QAUJZR6Ycjs.useMergeRefs.call(void 0, ref, props.ref);
|
|
51
|
+
const context = _react.useContext.call(void 0, PortalContext);
|
|
52
|
+
const [portalNode, setPortalNode] = _react.useState.call(void 0, null);
|
|
53
|
+
const [anchorPortalNode, setAnchorPortalNode] = _react.useState.call(void 0, null);
|
|
54
|
+
const outerBeforeRef = _react.useRef.call(void 0, null);
|
|
55
|
+
const innerBeforeRef = _react.useRef.call(void 0, null);
|
|
56
|
+
const innerAfterRef = _react.useRef.call(void 0, null);
|
|
57
|
+
const outerAfterRef = _react.useRef.call(void 0, null);
|
|
58
|
+
_QAUJZR6Ycjs.useSafeLayoutEffect.call(void 0, () => {
|
|
59
|
+
const element = ref.current;
|
|
60
|
+
if (!element || !portal) {
|
|
61
|
+
setPortalNode(null);
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
const portalEl = getPortalElement(element, portalElement);
|
|
65
|
+
if (!portalEl) {
|
|
66
|
+
setPortalNode(null);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const isPortalInDocument = portalEl.isConnected;
|
|
70
|
+
if (!isPortalInDocument) (context || getRootElement(element)).appendChild(portalEl);
|
|
71
|
+
if (!portalEl.id) portalEl.id = element.id ? `portal/${element.id}` : getRandomId();
|
|
72
|
+
setPortalNode(portalEl);
|
|
73
|
+
_QAUJZR6Ycjs.setRef.call(void 0, portalRef, portalEl);
|
|
74
|
+
if (isPortalInDocument) return;
|
|
75
|
+
return () => {
|
|
76
|
+
portalEl.remove();
|
|
77
|
+
_QAUJZR6Ycjs.setRef.call(void 0, portalRef, null);
|
|
78
|
+
};
|
|
79
|
+
}, [
|
|
80
|
+
portal,
|
|
81
|
+
portalElement,
|
|
82
|
+
context,
|
|
83
|
+
portalRef
|
|
84
|
+
]);
|
|
85
|
+
_react.useEffect.call(void 0, () => {
|
|
86
|
+
if (!portalNode) return;
|
|
87
|
+
if (context) return;
|
|
88
|
+
if (portalElement) return;
|
|
89
|
+
const doc = _QAUJZR6Ycjs.getDocument.call(void 0, portalNode);
|
|
90
|
+
const onFullscreenChange = () => {
|
|
91
|
+
const rootElement = getRootElement(portalNode);
|
|
92
|
+
if (portalNode.parentElement !== rootElement) rootElement.appendChild(portalNode);
|
|
93
|
+
};
|
|
94
|
+
onFullscreenChange();
|
|
95
|
+
doc.addEventListener("fullscreenchange", onFullscreenChange);
|
|
96
|
+
return () => {
|
|
97
|
+
doc.removeEventListener("fullscreenchange", onFullscreenChange);
|
|
98
|
+
};
|
|
99
|
+
}, [
|
|
100
|
+
portalNode,
|
|
101
|
+
context,
|
|
102
|
+
portalElement
|
|
103
|
+
]);
|
|
104
|
+
_QAUJZR6Ycjs.useSafeLayoutEffect.call(void 0, () => {
|
|
105
|
+
if (!portal) return;
|
|
106
|
+
if (!preserveTabOrder) return;
|
|
107
|
+
if (!preserveTabOrderAnchor) return;
|
|
108
|
+
const element = _QAUJZR6Ycjs.getDocument.call(void 0, preserveTabOrderAnchor).createElement("span");
|
|
109
|
+
element.style.position = "fixed";
|
|
110
|
+
preserveTabOrderAnchor.insertAdjacentElement("afterend", element);
|
|
111
|
+
setAnchorPortalNode(element);
|
|
112
|
+
return () => {
|
|
113
|
+
element.remove();
|
|
114
|
+
setAnchorPortalNode(null);
|
|
115
|
+
};
|
|
116
|
+
}, [
|
|
117
|
+
portal,
|
|
118
|
+
preserveTabOrder,
|
|
119
|
+
preserveTabOrderAnchor
|
|
120
|
+
]);
|
|
121
|
+
_react.useEffect.call(void 0, () => {
|
|
122
|
+
if (!portalNode) return;
|
|
123
|
+
if (!preserveTabOrder) return;
|
|
124
|
+
let raf = 0;
|
|
125
|
+
const onFocus = (event) => {
|
|
126
|
+
if (!_QAUJZR6Ycjs.isFocusEventOutside.call(void 0, event)) return;
|
|
127
|
+
const focusing = event.type === "focusin";
|
|
128
|
+
cancelAnimationFrame(raf);
|
|
129
|
+
if (focusing) return _QAUJZR6Ycjs.restoreFocusIn.call(void 0, portalNode);
|
|
130
|
+
raf = requestAnimationFrame(() => {
|
|
131
|
+
_QAUJZR6Ycjs.disableFocusIn.call(void 0, portalNode, true);
|
|
132
|
+
});
|
|
133
|
+
};
|
|
134
|
+
portalNode.addEventListener("focusin", onFocus, true);
|
|
135
|
+
portalNode.addEventListener("focusout", onFocus, true);
|
|
136
|
+
return () => {
|
|
137
|
+
cancelAnimationFrame(raf);
|
|
138
|
+
portalNode.removeEventListener("focusin", onFocus, true);
|
|
139
|
+
portalNode.removeEventListener("focusout", onFocus, true);
|
|
140
|
+
};
|
|
141
|
+
}, [portalNode, preserveTabOrder]);
|
|
142
|
+
props = _QAUJZR6Ycjs.useWrapElement.call(void 0, props, (element) => {
|
|
143
|
+
element = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PortalContext.Provider, {
|
|
144
|
+
value: portalNode || context,
|
|
145
|
+
children: element
|
|
146
|
+
});
|
|
147
|
+
if (!portal) return element;
|
|
148
|
+
if (!portalNode) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", {
|
|
149
|
+
ref: refProp,
|
|
150
|
+
id: props.id,
|
|
151
|
+
style: { position: "fixed" },
|
|
152
|
+
hidden: true
|
|
153
|
+
});
|
|
154
|
+
element = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
155
|
+
preserveTabOrder && portalNode && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _N3DLR7OLcjs.FocusTrap, {
|
|
156
|
+
ref: innerBeforeRef,
|
|
157
|
+
"data-focus-trap": props.id,
|
|
158
|
+
className: "__focus-trap-inner-before",
|
|
159
|
+
onFocus: (event) => {
|
|
160
|
+
if (_QAUJZR6Ycjs.isFocusEventOutside.call(void 0, event, portalNode)) queueFocus(_QAUJZR6Ycjs.getNextTabbable.call(void 0, ));
|
|
161
|
+
else queueFocus(outerBeforeRef.current);
|
|
162
|
+
}
|
|
163
|
+
}),
|
|
164
|
+
element,
|
|
165
|
+
preserveTabOrder && portalNode && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _N3DLR7OLcjs.FocusTrap, {
|
|
166
|
+
ref: innerAfterRef,
|
|
167
|
+
"data-focus-trap": props.id,
|
|
168
|
+
className: "__focus-trap-inner-after",
|
|
169
|
+
onFocus: (event) => {
|
|
170
|
+
if (_QAUJZR6Ycjs.isFocusEventOutside.call(void 0, event, portalNode)) queueFocus(_QAUJZR6Ycjs.getPreviousTabbable.call(void 0, ));
|
|
171
|
+
else queueFocus(outerAfterRef.current);
|
|
172
|
+
}
|
|
173
|
+
})
|
|
174
|
+
] });
|
|
175
|
+
if (portalNode) element = _reactdom.createPortal.call(void 0, element, portalNode);
|
|
176
|
+
let preserveTabOrderElement = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
177
|
+
preserveTabOrder && portalNode && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _N3DLR7OLcjs.FocusTrap, {
|
|
178
|
+
ref: outerBeforeRef,
|
|
179
|
+
"data-focus-trap": props.id,
|
|
180
|
+
className: "__focus-trap-outer-before",
|
|
181
|
+
onFocus: (event) => {
|
|
182
|
+
if (!(event.relatedTarget === outerAfterRef.current) && _QAUJZR6Ycjs.isFocusEventOutside.call(void 0, event, portalNode)) queueFocus(innerBeforeRef.current);
|
|
183
|
+
else queueFocus(_QAUJZR6Ycjs.getPreviousTabbable.call(void 0, ));
|
|
184
|
+
}
|
|
185
|
+
}),
|
|
186
|
+
preserveTabOrder && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", {
|
|
187
|
+
"aria-owns": portalNode == null ? void 0 : portalNode.id,
|
|
188
|
+
style: { position: "fixed" }
|
|
189
|
+
}),
|
|
190
|
+
preserveTabOrder && portalNode && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _N3DLR7OLcjs.FocusTrap, {
|
|
191
|
+
ref: outerAfterRef,
|
|
192
|
+
"data-focus-trap": props.id,
|
|
193
|
+
className: "__focus-trap-outer-after",
|
|
194
|
+
onFocus: (event) => {
|
|
195
|
+
if (_QAUJZR6Ycjs.isFocusEventOutside.call(void 0, event, portalNode)) queueFocus(innerAfterRef.current);
|
|
196
|
+
else {
|
|
197
|
+
const nextTabbable = _QAUJZR6Ycjs.getNextTabbable.call(void 0, );
|
|
198
|
+
if (nextTabbable === innerBeforeRef.current) {
|
|
199
|
+
requestAnimationFrame(() => {
|
|
200
|
+
var _a;
|
|
201
|
+
return (_a = _QAUJZR6Ycjs.getNextTabbable.call(void 0, )) == null ? void 0 : _a.focus();
|
|
202
|
+
});
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
queueFocus(nextTabbable);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
})
|
|
209
|
+
] });
|
|
210
|
+
if (anchorPortalNode && preserveTabOrder) preserveTabOrderElement = _reactdom.createPortal.call(void 0, preserveTabOrderElement, anchorPortalNode);
|
|
211
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [preserveTabOrderElement, element] });
|
|
212
|
+
}, [
|
|
213
|
+
portalNode,
|
|
214
|
+
context,
|
|
215
|
+
portal,
|
|
216
|
+
props.id,
|
|
217
|
+
preserveTabOrder,
|
|
218
|
+
anchorPortalNode
|
|
219
|
+
]);
|
|
220
|
+
props = {
|
|
221
|
+
...props,
|
|
222
|
+
ref: refProp
|
|
223
|
+
};
|
|
224
|
+
return props;
|
|
225
|
+
});
|
|
226
|
+
var Portal = _QAUJZR6Ycjs.forwardRef.call(void 0, function Portal2(props) {
|
|
227
|
+
return _QAUJZR6Ycjs.createElement.call(void 0, TagName, usePortal(props));
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
exports.PortalContext = PortalContext; exports.usePortal = usePortal; exports.Portal = Portal;
|