@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,496 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _L2IFVMDUcjs = require('./L2IFVMDU.cjs');
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
var _XPQIHUQ7cjs = require('./XPQIHUQ7.cjs');
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
var _D4HCGWOUcjs = require('./D4HCGWOU.cjs');
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
var _NG34QRI6cjs = require('./NG34QRI6.cjs');
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
var _QAUJZR6Ycjs = require('./QAUJZR6Y.cjs');
|
|
48
|
+
|
|
49
|
+
// ../ariakit-react-components/dist/composite/composite.js
|
|
50
|
+
var _react = require('react');
|
|
51
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
52
|
+
var TagName = "div";
|
|
53
|
+
function isGrid(items) {
|
|
54
|
+
return items.some((item) => !!item.rowId);
|
|
55
|
+
}
|
|
56
|
+
function isPrintableKey(event) {
|
|
57
|
+
const target = event.target;
|
|
58
|
+
if (target && !_QAUJZR6Ycjs.isTextField.call(void 0, target)) return false;
|
|
59
|
+
return event.key.length === 1 && !event.ctrlKey && !event.metaKey;
|
|
60
|
+
}
|
|
61
|
+
function isModifierKey(event) {
|
|
62
|
+
return event.key === "Shift" || event.key === "Control" || event.key === "Alt" || event.key === "Meta";
|
|
63
|
+
}
|
|
64
|
+
function useKeyboardEventProxy(store, onKeyboardEvent, previousElementRef) {
|
|
65
|
+
return _QAUJZR6Ycjs.useEvent.call(void 0, (event) => {
|
|
66
|
+
var _a;
|
|
67
|
+
onKeyboardEvent == null ? void 0 : onKeyboardEvent(event);
|
|
68
|
+
if (event.defaultPrevented) return;
|
|
69
|
+
if (event.isPropagationStopped()) return;
|
|
70
|
+
if (!_QAUJZR6Ycjs.isSelfTarget.call(void 0, event)) return;
|
|
71
|
+
if (isModifierKey(event)) return;
|
|
72
|
+
if (isPrintableKey(event)) return;
|
|
73
|
+
const activeElement = (_a = _L2IFVMDUcjs.getEnabledItem.call(void 0, store, store.getState().activeId)) == null ? void 0 : _a.element;
|
|
74
|
+
if (!activeElement) return;
|
|
75
|
+
const { view, ...eventInit } = event;
|
|
76
|
+
if (activeElement !== (previousElementRef == null ? void 0 : previousElementRef.current)) activeElement.focus();
|
|
77
|
+
if (!_QAUJZR6Ycjs.fireKeyboardEvent.call(void 0, activeElement, event.type, eventInit)) event.preventDefault();
|
|
78
|
+
if (event.currentTarget.contains(activeElement)) event.stopPropagation();
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
function findFirstEnabledItemInTheLastRow(items) {
|
|
82
|
+
return _L2IFVMDUcjs.findFirstEnabledItem.call(void 0, _QAUJZR6Ycjs.flatten2DArray.call(void 0, _QAUJZR6Ycjs.reverseArray.call(void 0, _L2IFVMDUcjs.groupItemsByRows.call(void 0, items))));
|
|
83
|
+
}
|
|
84
|
+
function withBaseScrollPreserved(store, callback) {
|
|
85
|
+
const { virtualFocus, baseElement } = store.getState();
|
|
86
|
+
if (!virtualFocus || !baseElement || !_QAUJZR6Ycjs.isTextField.call(void 0, baseElement)) {
|
|
87
|
+
callback();
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
const savedScrollLeft = baseElement.scrollLeft;
|
|
91
|
+
const savedScrollTop = baseElement.scrollTop;
|
|
92
|
+
callback();
|
|
93
|
+
baseElement.scrollLeft = savedScrollLeft;
|
|
94
|
+
baseElement.scrollTop = savedScrollTop;
|
|
95
|
+
}
|
|
96
|
+
function useScheduleFocus(store) {
|
|
97
|
+
const [scheduled, setScheduled] = _react.useState.call(void 0, false);
|
|
98
|
+
const schedule = _react.useCallback.call(void 0, () => setScheduled(true), []);
|
|
99
|
+
const activeItem = _D4HCGWOUcjs.useStoreState.call(void 0, store, (state) => _L2IFVMDUcjs.getEnabledItem.call(void 0, store, state.activeId));
|
|
100
|
+
_react.useEffect.call(void 0, () => {
|
|
101
|
+
const activeElement = activeItem == null ? void 0 : activeItem.element;
|
|
102
|
+
if (!scheduled) return;
|
|
103
|
+
if (!activeElement) return;
|
|
104
|
+
setScheduled(false);
|
|
105
|
+
withBaseScrollPreserved(store, () => {
|
|
106
|
+
activeElement.focus({ preventScroll: true });
|
|
107
|
+
});
|
|
108
|
+
}, [
|
|
109
|
+
store,
|
|
110
|
+
activeItem,
|
|
111
|
+
scheduled
|
|
112
|
+
]);
|
|
113
|
+
return schedule;
|
|
114
|
+
}
|
|
115
|
+
var useComposite = _QAUJZR6Ycjs.createHook.call(void 0, function useComposite2({ store, composite = true, focusOnMove = composite, moveOnKeyPress = true, ...props }) {
|
|
116
|
+
const context = _L2IFVMDUcjs.useCompositeProviderContext.call(void 0, );
|
|
117
|
+
store = store || context;
|
|
118
|
+
_QAUJZR6Ycjs.invariant.call(void 0, store, "Composite must receive a `store` prop or be wrapped in a CompositeProvider component.");
|
|
119
|
+
const ref = _react.useRef.call(void 0, null);
|
|
120
|
+
const previousElementRef = _react.useRef.call(void 0, null);
|
|
121
|
+
const scheduleFocus = useScheduleFocus(store);
|
|
122
|
+
const moves = _D4HCGWOUcjs.useStoreState.call(void 0, store, "moves");
|
|
123
|
+
const [, setBaseElement] = _QAUJZR6Ycjs.useTransactionState.call(void 0, composite ? store.setBaseElement : null);
|
|
124
|
+
_react.useEffect.call(void 0, () => {
|
|
125
|
+
var _a;
|
|
126
|
+
if (!store) return;
|
|
127
|
+
if (!moves) return;
|
|
128
|
+
if (!composite) return;
|
|
129
|
+
if (!focusOnMove) return;
|
|
130
|
+
const { activeId: activeId2 } = store.getState();
|
|
131
|
+
const itemElement = (_a = _L2IFVMDUcjs.getEnabledItem.call(void 0, store, activeId2)) == null ? void 0 : _a.element;
|
|
132
|
+
if (!itemElement) return;
|
|
133
|
+
withBaseScrollPreserved(store, () => _QAUJZR6Ycjs.focusIntoView.call(void 0, itemElement));
|
|
134
|
+
}, [
|
|
135
|
+
store,
|
|
136
|
+
moves,
|
|
137
|
+
composite,
|
|
138
|
+
focusOnMove
|
|
139
|
+
]);
|
|
140
|
+
_QAUJZR6Ycjs.useSafeLayoutEffect.call(void 0, () => {
|
|
141
|
+
if (!store) return;
|
|
142
|
+
if (!moves) return;
|
|
143
|
+
if (!composite) return;
|
|
144
|
+
const { baseElement, activeId: activeId2 } = store.getState();
|
|
145
|
+
if (!(activeId2 === null)) return;
|
|
146
|
+
if (!baseElement) return;
|
|
147
|
+
const previousElement = previousElementRef.current;
|
|
148
|
+
previousElementRef.current = null;
|
|
149
|
+
if (previousElement) _QAUJZR6Ycjs.fireBlurEvent.call(void 0, previousElement, { relatedTarget: baseElement });
|
|
150
|
+
if (!_QAUJZR6Ycjs.hasFocus.call(void 0, baseElement)) baseElement.focus();
|
|
151
|
+
}, [
|
|
152
|
+
store,
|
|
153
|
+
moves,
|
|
154
|
+
composite
|
|
155
|
+
]);
|
|
156
|
+
const activeId = _D4HCGWOUcjs.useStoreState.call(void 0, store, "activeId");
|
|
157
|
+
const virtualFocus = _D4HCGWOUcjs.useStoreState.call(void 0, store, "virtualFocus");
|
|
158
|
+
_QAUJZR6Ycjs.useSafeLayoutEffect.call(void 0, () => {
|
|
159
|
+
var _a;
|
|
160
|
+
if (!store) return;
|
|
161
|
+
if (!composite) return;
|
|
162
|
+
if (!virtualFocus) return;
|
|
163
|
+
const previousElement = previousElementRef.current;
|
|
164
|
+
previousElementRef.current = null;
|
|
165
|
+
if (!previousElement) return;
|
|
166
|
+
const relatedTarget = ((_a = _L2IFVMDUcjs.getEnabledItem.call(void 0, store, activeId)) == null ? void 0 : _a.element) || _QAUJZR6Ycjs.getActiveElement.call(void 0, previousElement);
|
|
167
|
+
if (relatedTarget === previousElement) return;
|
|
168
|
+
_QAUJZR6Ycjs.fireBlurEvent.call(void 0, previousElement, { relatedTarget });
|
|
169
|
+
}, [
|
|
170
|
+
store,
|
|
171
|
+
activeId,
|
|
172
|
+
virtualFocus,
|
|
173
|
+
composite
|
|
174
|
+
]);
|
|
175
|
+
const onKeyDownCapture = useKeyboardEventProxy(store, props.onKeyDownCapture, previousElementRef);
|
|
176
|
+
const onKeyUpCapture = useKeyboardEventProxy(store, props.onKeyUpCapture, previousElementRef);
|
|
177
|
+
const onFocusCaptureProp = props.onFocusCapture;
|
|
178
|
+
const onFocusCapture = _QAUJZR6Ycjs.useEvent.call(void 0, (event) => {
|
|
179
|
+
onFocusCaptureProp == null ? void 0 : onFocusCaptureProp(event);
|
|
180
|
+
if (event.defaultPrevented) return;
|
|
181
|
+
if (!store) return;
|
|
182
|
+
const { virtualFocus: virtualFocus2 } = store.getState();
|
|
183
|
+
if (!virtualFocus2) return;
|
|
184
|
+
const previousActiveElement = event.relatedTarget;
|
|
185
|
+
const isSilentlyFocused = _L2IFVMDUcjs.silentlyFocused.call(void 0, event.currentTarget);
|
|
186
|
+
if (_QAUJZR6Ycjs.isSelfTarget.call(void 0, event) && isSilentlyFocused) {
|
|
187
|
+
event.stopPropagation();
|
|
188
|
+
previousElementRef.current = previousActiveElement;
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
const onFocusProp = props.onFocus;
|
|
192
|
+
const onFocus = _QAUJZR6Ycjs.useEvent.call(void 0, (event) => {
|
|
193
|
+
onFocusProp == null ? void 0 : onFocusProp(event);
|
|
194
|
+
if (event.defaultPrevented) return;
|
|
195
|
+
if (!composite) return;
|
|
196
|
+
if (!store) return;
|
|
197
|
+
const { relatedTarget } = event;
|
|
198
|
+
const { virtualFocus: virtualFocus2 } = store.getState();
|
|
199
|
+
if (virtualFocus2) {
|
|
200
|
+
if (_QAUJZR6Ycjs.isSelfTarget.call(void 0, event) && !_L2IFVMDUcjs.isItem.call(void 0, store, relatedTarget)) queueMicrotask(scheduleFocus);
|
|
201
|
+
} else if (_QAUJZR6Ycjs.isSelfTarget.call(void 0, event)) store.setActiveId(null);
|
|
202
|
+
});
|
|
203
|
+
const onBlurCaptureProp = props.onBlurCapture;
|
|
204
|
+
const onBlurCapture = _QAUJZR6Ycjs.useEvent.call(void 0, (event) => {
|
|
205
|
+
var _a;
|
|
206
|
+
onBlurCaptureProp == null ? void 0 : onBlurCaptureProp(event);
|
|
207
|
+
if (event.defaultPrevented) return;
|
|
208
|
+
if (!store) return;
|
|
209
|
+
const { virtualFocus: virtualFocus2, activeId: activeId2 } = store.getState();
|
|
210
|
+
if (!virtualFocus2) return;
|
|
211
|
+
const activeElement = (_a = _L2IFVMDUcjs.getEnabledItem.call(void 0, store, activeId2)) == null ? void 0 : _a.element;
|
|
212
|
+
const nextActiveElement = event.relatedTarget;
|
|
213
|
+
const nextActiveElementIsItem = _L2IFVMDUcjs.isItem.call(void 0, store, nextActiveElement);
|
|
214
|
+
const previousElement = previousElementRef.current;
|
|
215
|
+
previousElementRef.current = null;
|
|
216
|
+
if (_QAUJZR6Ycjs.isSelfTarget.call(void 0, event) && nextActiveElementIsItem) {
|
|
217
|
+
if (nextActiveElement === activeElement) {
|
|
218
|
+
if (previousElement && previousElement !== nextActiveElement) _QAUJZR6Ycjs.fireBlurEvent.call(void 0, previousElement, event);
|
|
219
|
+
} else if (activeElement) _QAUJZR6Ycjs.fireBlurEvent.call(void 0, activeElement, event);
|
|
220
|
+
else if (previousElement) _QAUJZR6Ycjs.fireBlurEvent.call(void 0, previousElement, event);
|
|
221
|
+
event.stopPropagation();
|
|
222
|
+
} else if (!_L2IFVMDUcjs.isItem.call(void 0, store, event.target) && activeElement) _QAUJZR6Ycjs.fireBlurEvent.call(void 0, activeElement, event);
|
|
223
|
+
});
|
|
224
|
+
const onKeyDownProp = props.onKeyDown;
|
|
225
|
+
const moveOnKeyPressProp = _QAUJZR6Ycjs.useBooleanEvent.call(void 0, moveOnKeyPress);
|
|
226
|
+
const onKeyDown = _QAUJZR6Ycjs.useEvent.call(void 0, (event) => {
|
|
227
|
+
var _a, _b;
|
|
228
|
+
onKeyDownProp == null ? void 0 : onKeyDownProp(event);
|
|
229
|
+
if (event.nativeEvent.isComposing) return;
|
|
230
|
+
if (event.defaultPrevented) return;
|
|
231
|
+
if (!store) return;
|
|
232
|
+
if (!_QAUJZR6Ycjs.isSelfTarget.call(void 0, event)) return;
|
|
233
|
+
const { orientation, renderedItems, activeId: activeId2 } = store.getState();
|
|
234
|
+
if ((_b = (_a = _L2IFVMDUcjs.getEnabledItem.call(void 0, store, activeId2)) == null ? void 0 : _a.element) == null ? void 0 : _b.isConnected) return;
|
|
235
|
+
const isVertical = orientation !== "horizontal";
|
|
236
|
+
const isHorizontal = orientation !== "vertical";
|
|
237
|
+
const grid = isGrid(renderedItems);
|
|
238
|
+
if ((event.key === "ArrowLeft" || event.key === "ArrowRight" || event.key === "Home" || event.key === "End") && _QAUJZR6Ycjs.isTextField.call(void 0, event.currentTarget)) return;
|
|
239
|
+
const up = () => {
|
|
240
|
+
var _a2;
|
|
241
|
+
if (grid) return (_a2 = findFirstEnabledItemInTheLastRow(renderedItems)) == null ? void 0 : _a2.id;
|
|
242
|
+
return store == null ? void 0 : store.last();
|
|
243
|
+
};
|
|
244
|
+
const action = {
|
|
245
|
+
ArrowUp: (grid || isVertical) && up,
|
|
246
|
+
ArrowRight: (grid || isHorizontal) && store.first,
|
|
247
|
+
ArrowDown: (grid || isVertical) && store.first,
|
|
248
|
+
ArrowLeft: (grid || isHorizontal) && store.last,
|
|
249
|
+
Home: store.first,
|
|
250
|
+
End: store.last,
|
|
251
|
+
PageUp: store.first,
|
|
252
|
+
PageDown: store.last
|
|
253
|
+
}[event.key];
|
|
254
|
+
if (action) {
|
|
255
|
+
const id = action();
|
|
256
|
+
if (id !== void 0) {
|
|
257
|
+
if (!moveOnKeyPressProp(event)) return;
|
|
258
|
+
event.preventDefault();
|
|
259
|
+
store.move(id);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
props = _QAUJZR6Ycjs.useWrapElement.call(void 0, props, (element) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _L2IFVMDUcjs.CompositeContextProvider, {
|
|
264
|
+
value: store,
|
|
265
|
+
children: element
|
|
266
|
+
}), [store]);
|
|
267
|
+
props = {
|
|
268
|
+
"aria-activedescendant": _D4HCGWOUcjs.useStoreState.call(void 0, store, (state) => {
|
|
269
|
+
var _a;
|
|
270
|
+
if (!store) return;
|
|
271
|
+
if (!composite) return;
|
|
272
|
+
if (!state.virtualFocus) return;
|
|
273
|
+
return (_a = _L2IFVMDUcjs.getEnabledItem.call(void 0, store, state.activeId)) == null ? void 0 : _a.id;
|
|
274
|
+
}),
|
|
275
|
+
...props,
|
|
276
|
+
ref: _QAUJZR6Ycjs.useMergeRefs.call(void 0, ref, setBaseElement, props.ref),
|
|
277
|
+
onKeyDownCapture,
|
|
278
|
+
onKeyUpCapture,
|
|
279
|
+
onFocusCapture,
|
|
280
|
+
onFocus,
|
|
281
|
+
onBlurCapture,
|
|
282
|
+
onKeyDown
|
|
283
|
+
};
|
|
284
|
+
props = _NG34QRI6cjs.useFocusable.call(void 0, {
|
|
285
|
+
focusable: _D4HCGWOUcjs.useStoreState.call(void 0, store, (state) => composite && (state.virtualFocus || state.activeId === null)),
|
|
286
|
+
...props
|
|
287
|
+
});
|
|
288
|
+
return props;
|
|
289
|
+
});
|
|
290
|
+
var Composite = _QAUJZR6Ycjs.forwardRef.call(void 0, function Composite2(props) {
|
|
291
|
+
return _QAUJZR6Ycjs.createElement.call(void 0, TagName, useComposite(props));
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
// ../ariakit-components/dist/composite/composite-store.js
|
|
295
|
+
var NULL_ITEM = { id: null };
|
|
296
|
+
function findFirstEnabledItem2(items, excludeId) {
|
|
297
|
+
return items.find((item) => {
|
|
298
|
+
if (excludeId) return !item.disabled && item.id !== excludeId;
|
|
299
|
+
return !item.disabled;
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
function getEnabledItems(items, excludeId) {
|
|
303
|
+
return items.filter((item) => {
|
|
304
|
+
if (excludeId) return !item.disabled && item.id !== excludeId;
|
|
305
|
+
return !item.disabled;
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
function getItemsInRow(items, rowId) {
|
|
309
|
+
return items.filter((item) => item.rowId === rowId);
|
|
310
|
+
}
|
|
311
|
+
function flipItems(items, activeId, shouldInsertNullItem = false) {
|
|
312
|
+
const index = items.findIndex((item) => item.id === activeId);
|
|
313
|
+
return [
|
|
314
|
+
...items.slice(index + 1),
|
|
315
|
+
...shouldInsertNullItem ? [NULL_ITEM] : [],
|
|
316
|
+
...items.slice(0, index)
|
|
317
|
+
];
|
|
318
|
+
}
|
|
319
|
+
function groupItemsByRows2(items) {
|
|
320
|
+
const rows = [];
|
|
321
|
+
for (const item of items) {
|
|
322
|
+
const row = rows.find((currentRow) => {
|
|
323
|
+
var _a;
|
|
324
|
+
return ((_a = currentRow[0]) == null ? void 0 : _a.rowId) === item.rowId;
|
|
325
|
+
});
|
|
326
|
+
if (row) row.push(item);
|
|
327
|
+
else rows.push([item]);
|
|
328
|
+
}
|
|
329
|
+
return rows;
|
|
330
|
+
}
|
|
331
|
+
function getMaxRowLength(array) {
|
|
332
|
+
let maxLength = 0;
|
|
333
|
+
for (const { length } of array) if (length > maxLength) maxLength = length;
|
|
334
|
+
return maxLength;
|
|
335
|
+
}
|
|
336
|
+
function createEmptyItem(rowId) {
|
|
337
|
+
return {
|
|
338
|
+
id: "__EMPTY_ITEM__",
|
|
339
|
+
disabled: true,
|
|
340
|
+
rowId
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
function normalizeRows(rows, activeId, focusShift) {
|
|
344
|
+
const maxLength = getMaxRowLength(rows);
|
|
345
|
+
for (const row of rows) for (let i = 0; i < maxLength; i += 1) {
|
|
346
|
+
const item = row[i];
|
|
347
|
+
if (!item || focusShift && item.disabled) {
|
|
348
|
+
const previousItem = i === 0 && focusShift ? findFirstEnabledItem2(row) : row[i - 1];
|
|
349
|
+
row[i] = previousItem && activeId !== previousItem.id && focusShift ? previousItem : createEmptyItem(previousItem == null ? void 0 : previousItem.rowId);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
return rows;
|
|
353
|
+
}
|
|
354
|
+
function verticalizeItems(items) {
|
|
355
|
+
const rows = groupItemsByRows2(items);
|
|
356
|
+
const maxLength = getMaxRowLength(rows);
|
|
357
|
+
const verticalized = [];
|
|
358
|
+
for (let i = 0; i < maxLength; i += 1) for (const row of rows) {
|
|
359
|
+
const item = row[i];
|
|
360
|
+
if (item) verticalized.push({
|
|
361
|
+
...item,
|
|
362
|
+
rowId: item.rowId ? `${i}` : void 0
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
return verticalized;
|
|
366
|
+
}
|
|
367
|
+
function createCompositeStore(props = {}) {
|
|
368
|
+
var _a, _b;
|
|
369
|
+
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
370
|
+
const collection = _XPQIHUQ7cjs.createCollectionStore.call(void 0, props);
|
|
371
|
+
const activeId = _QAUJZR6Ycjs.defaultValue.call(void 0, props.activeId, syncState == null ? void 0 : syncState.activeId, props.defaultActiveId);
|
|
372
|
+
const composite = _D4HCGWOUcjs.createStore.call(void 0, {
|
|
373
|
+
...collection.getState(),
|
|
374
|
+
id: (_b = _QAUJZR6Ycjs.defaultValue.call(void 0, props.id, syncState == null ? void 0 : syncState.id)) != null ? _b : `id-${Math.random().toString(36).slice(2, 8)}`,
|
|
375
|
+
activeId,
|
|
376
|
+
baseElement: _QAUJZR6Ycjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.baseElement, null),
|
|
377
|
+
includesBaseElement: _QAUJZR6Ycjs.defaultValue.call(void 0, props.includesBaseElement, syncState == null ? void 0 : syncState.includesBaseElement, activeId === null),
|
|
378
|
+
moves: _QAUJZR6Ycjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.moves, 0),
|
|
379
|
+
orientation: _QAUJZR6Ycjs.defaultValue.call(void 0, props.orientation, syncState == null ? void 0 : syncState.orientation, "both"),
|
|
380
|
+
rtl: _QAUJZR6Ycjs.defaultValue.call(void 0, props.rtl, syncState == null ? void 0 : syncState.rtl, false),
|
|
381
|
+
virtualFocus: _QAUJZR6Ycjs.defaultValue.call(void 0, props.virtualFocus, syncState == null ? void 0 : syncState.virtualFocus, false),
|
|
382
|
+
focusLoop: _QAUJZR6Ycjs.defaultValue.call(void 0, props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, false),
|
|
383
|
+
focusWrap: _QAUJZR6Ycjs.defaultValue.call(void 0, props.focusWrap, syncState == null ? void 0 : syncState.focusWrap, false),
|
|
384
|
+
focusShift: _QAUJZR6Ycjs.defaultValue.call(void 0, props.focusShift, syncState == null ? void 0 : syncState.focusShift, false)
|
|
385
|
+
}, collection, props.store);
|
|
386
|
+
_D4HCGWOUcjs.setup.call(void 0, composite, () => _D4HCGWOUcjs.sync.call(void 0, composite, ["renderedItems", "activeId"], (state) => {
|
|
387
|
+
composite.setState("activeId", (activeId2) => {
|
|
388
|
+
var _a2;
|
|
389
|
+
if (activeId2 !== void 0) return activeId2;
|
|
390
|
+
return (_a2 = findFirstEnabledItem2(state.renderedItems)) == null ? void 0 : _a2.id;
|
|
391
|
+
});
|
|
392
|
+
}));
|
|
393
|
+
const getNextId = (direction = "next", options = {}) => {
|
|
394
|
+
var _a2, _b2, _c, _d;
|
|
395
|
+
const defaultState = composite.getState();
|
|
396
|
+
const { skip = 0, activeId: activeId2 = defaultState.activeId, focusShift = defaultState.focusShift, focusLoop = defaultState.focusLoop, focusWrap = defaultState.focusWrap, includesBaseElement = defaultState.includesBaseElement, renderedItems = defaultState.renderedItems, rtl = defaultState.rtl } = options;
|
|
397
|
+
const isVerticalDirection = direction === "up" || direction === "down";
|
|
398
|
+
const isNextDirection = direction === "next" || direction === "down";
|
|
399
|
+
const canReverse = isNextDirection ? rtl && !isVerticalDirection : !rtl || isVerticalDirection;
|
|
400
|
+
const canShift = focusShift && !skip;
|
|
401
|
+
let items = !isVerticalDirection ? renderedItems : _QAUJZR6Ycjs.flatten2DArray.call(void 0, normalizeRows(groupItemsByRows2(renderedItems), activeId2, canShift));
|
|
402
|
+
items = canReverse ? _QAUJZR6Ycjs.reverseArray.call(void 0, items) : items;
|
|
403
|
+
items = isVerticalDirection ? verticalizeItems(items) : items;
|
|
404
|
+
if (activeId2 == null) return (_a2 = findFirstEnabledItem2(items)) == null ? void 0 : _a2.id;
|
|
405
|
+
const activeItem = items.find((item) => item.id === activeId2);
|
|
406
|
+
if (!activeItem) return (_b2 = findFirstEnabledItem2(items)) == null ? void 0 : _b2.id;
|
|
407
|
+
const isGrid2 = items.some((item) => item.rowId);
|
|
408
|
+
const activeIndex = items.indexOf(activeItem);
|
|
409
|
+
const nextItems = items.slice(activeIndex + 1);
|
|
410
|
+
const nextItemsInRow = getItemsInRow(nextItems, activeItem.rowId);
|
|
411
|
+
if (skip) {
|
|
412
|
+
const nextEnabledItemsInRow = getEnabledItems(nextItemsInRow, activeId2);
|
|
413
|
+
return (_c = nextEnabledItemsInRow.slice(skip)[0] || nextEnabledItemsInRow[nextEnabledItemsInRow.length - 1]) == null ? void 0 : _c.id;
|
|
414
|
+
}
|
|
415
|
+
const canLoop = focusLoop && (isVerticalDirection ? focusLoop !== "horizontal" : focusLoop !== "vertical");
|
|
416
|
+
const canWrap = isGrid2 && focusWrap && (isVerticalDirection ? focusWrap !== "horizontal" : focusWrap !== "vertical");
|
|
417
|
+
const hasNullItem = isNextDirection ? (!isGrid2 || isVerticalDirection) && canLoop && includesBaseElement : isVerticalDirection ? includesBaseElement : false;
|
|
418
|
+
if (canLoop) return (_d = findFirstEnabledItem2(flipItems(canWrap && !hasNullItem ? items : getItemsInRow(items, activeItem.rowId), activeId2, hasNullItem), activeId2)) == null ? void 0 : _d.id;
|
|
419
|
+
if (canWrap) {
|
|
420
|
+
const nextItem2 = findFirstEnabledItem2(hasNullItem ? nextItemsInRow : nextItems, activeId2);
|
|
421
|
+
return hasNullItem ? (nextItem2 == null ? void 0 : nextItem2.id) || null : nextItem2 == null ? void 0 : nextItem2.id;
|
|
422
|
+
}
|
|
423
|
+
const nextItem = findFirstEnabledItem2(nextItemsInRow, activeId2);
|
|
424
|
+
if (!nextItem && hasNullItem) return null;
|
|
425
|
+
return nextItem == null ? void 0 : nextItem.id;
|
|
426
|
+
};
|
|
427
|
+
return {
|
|
428
|
+
...collection,
|
|
429
|
+
...composite,
|
|
430
|
+
setBaseElement: (element) => composite.setState("baseElement", element),
|
|
431
|
+
setActiveId: (id) => composite.setState("activeId", id),
|
|
432
|
+
move: (id) => {
|
|
433
|
+
if (id === void 0) return;
|
|
434
|
+
composite.setState("activeId", id);
|
|
435
|
+
composite.setState("moves", (moves) => moves + 1);
|
|
436
|
+
},
|
|
437
|
+
first: () => {
|
|
438
|
+
var _a2;
|
|
439
|
+
return (_a2 = findFirstEnabledItem2(composite.getState().renderedItems)) == null ? void 0 : _a2.id;
|
|
440
|
+
},
|
|
441
|
+
last: () => {
|
|
442
|
+
var _a2;
|
|
443
|
+
return (_a2 = findFirstEnabledItem2(_QAUJZR6Ycjs.reverseArray.call(void 0, composite.getState().renderedItems))) == null ? void 0 : _a2.id;
|
|
444
|
+
},
|
|
445
|
+
next: (options) => {
|
|
446
|
+
if (options !== void 0 && typeof options === "number") options = { skip: options };
|
|
447
|
+
return getNextId("next", options);
|
|
448
|
+
},
|
|
449
|
+
previous: (options) => {
|
|
450
|
+
if (options !== void 0 && typeof options === "number") options = { skip: options };
|
|
451
|
+
return getNextId("previous", options);
|
|
452
|
+
},
|
|
453
|
+
down: (options) => {
|
|
454
|
+
if (options !== void 0 && typeof options === "number") options = { skip: options };
|
|
455
|
+
return getNextId("down", options);
|
|
456
|
+
},
|
|
457
|
+
up: (options) => {
|
|
458
|
+
if (options !== void 0 && typeof options === "number") options = { skip: options };
|
|
459
|
+
return getNextId("up", options);
|
|
460
|
+
}
|
|
461
|
+
};
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
// ../ariakit-react-components/dist/composite/composite-store.js
|
|
465
|
+
function useCompositeStoreOptions(props) {
|
|
466
|
+
return {
|
|
467
|
+
id: _QAUJZR6Ycjs.useId.call(void 0, props.id),
|
|
468
|
+
...props
|
|
469
|
+
};
|
|
470
|
+
}
|
|
471
|
+
function useCompositeStoreProps(store, update, props) {
|
|
472
|
+
store = _XPQIHUQ7cjs.useCollectionStoreProps.call(void 0, store, update, props);
|
|
473
|
+
_D4HCGWOUcjs.useStoreProps.call(void 0, store, props, "activeId", "setActiveId");
|
|
474
|
+
_D4HCGWOUcjs.useStoreProps.call(void 0, store, props, "includesBaseElement");
|
|
475
|
+
_D4HCGWOUcjs.useStoreProps.call(void 0, store, props, "virtualFocus");
|
|
476
|
+
_D4HCGWOUcjs.useStoreProps.call(void 0, store, props, "orientation");
|
|
477
|
+
_D4HCGWOUcjs.useStoreProps.call(void 0, store, props, "rtl");
|
|
478
|
+
_D4HCGWOUcjs.useStoreProps.call(void 0, store, props, "focusLoop");
|
|
479
|
+
_D4HCGWOUcjs.useStoreProps.call(void 0, store, props, "focusWrap");
|
|
480
|
+
_D4HCGWOUcjs.useStoreProps.call(void 0, store, props, "focusShift");
|
|
481
|
+
return store;
|
|
482
|
+
}
|
|
483
|
+
function useCompositeStore(props = {}) {
|
|
484
|
+
props = useCompositeStoreOptions(props);
|
|
485
|
+
const [store, update] = _D4HCGWOUcjs.useStore.call(void 0, createCompositeStore, props);
|
|
486
|
+
return useCompositeStoreProps(store, update, props);
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
|
|
490
|
+
|
|
491
|
+
|
|
492
|
+
|
|
493
|
+
|
|
494
|
+
|
|
495
|
+
|
|
496
|
+
exports.useComposite = useComposite; exports.Composite = Composite; exports.createCompositeStore = createCompositeStore; exports.useCompositeStoreOptions = useCompositeStoreOptions; exports.useCompositeStoreProps = useCompositeStoreProps; exports.useCompositeStore = useCompositeStore;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
var _NMUCJYMRcjs = require('./NMUCJYMR.cjs');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _L2IFVMDUcjs = require('./L2IFVMDU.cjs');
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
var _D4HCGWOUcjs = require('./D4HCGWOU.cjs');
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
var _QAUJZR6Ycjs = require('./QAUJZR6Y.cjs');
|
|
23
|
+
|
|
24
|
+
// ../ariakit-react-components/dist/menubar/menubar-context.js
|
|
25
|
+
var _react = require('react');
|
|
26
|
+
var menubar = _QAUJZR6Ycjs.createStoreContext.call(void 0, [_L2IFVMDUcjs.CompositeContextProvider], [_L2IFVMDUcjs.CompositeScopedContextProvider]);
|
|
27
|
+
var useMenubarContext = menubar.useContext;
|
|
28
|
+
var useMenubarScopedContext = menubar.useScopedContext;
|
|
29
|
+
var useMenubarProviderContext = menubar.useProviderContext;
|
|
30
|
+
var MenubarContextProvider = menubar.ContextProvider;
|
|
31
|
+
var MenubarScopedContextProvider = menubar.ScopedContextProvider;
|
|
32
|
+
var MenuItemCheckedContext = _react.createContext.call(void 0, void 0);
|
|
33
|
+
|
|
34
|
+
// ../ariakit-components/dist/menubar/menubar-store.js
|
|
35
|
+
function createMenubarStore(props = {}) {
|
|
36
|
+
var _a;
|
|
37
|
+
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
38
|
+
const composite = _NMUCJYMRcjs.createCompositeStore.call(void 0, {
|
|
39
|
+
...props,
|
|
40
|
+
orientation: _QAUJZR6Ycjs.defaultValue.call(void 0, props.orientation, syncState == null ? void 0 : syncState.orientation, "horizontal"),
|
|
41
|
+
focusLoop: _QAUJZR6Ycjs.defaultValue.call(void 0, props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true)
|
|
42
|
+
});
|
|
43
|
+
const menubar2 = _D4HCGWOUcjs.createStore.call(void 0, { ...composite.getState() }, composite, props.store);
|
|
44
|
+
return {
|
|
45
|
+
...composite,
|
|
46
|
+
...menubar2
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// ../ariakit-react-components/dist/menubar/menubar-store.js
|
|
51
|
+
function useMenubarStoreProps(store, update, props) {
|
|
52
|
+
return _NMUCJYMRcjs.useCompositeStoreProps.call(void 0, store, update, props);
|
|
53
|
+
}
|
|
54
|
+
function useMenubarStore(props = {}) {
|
|
55
|
+
const [store, update] = _D4HCGWOUcjs.useStore.call(void 0, createMenubarStore, props);
|
|
56
|
+
return useMenubarStoreProps(store, update, props);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// ../ariakit-react-components/dist/menubar/menubar.js
|
|
60
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
61
|
+
var TagName = "div";
|
|
62
|
+
var useMenubar = _QAUJZR6Ycjs.createHook.call(void 0, function useMenubar2({ store: storeProp, composite = true, orientation: orientationProp, virtualFocus, focusLoop, rtl, ...props }) {
|
|
63
|
+
const context = useMenubarProviderContext();
|
|
64
|
+
storeProp = storeProp || context;
|
|
65
|
+
const store = useMenubarStore({
|
|
66
|
+
store: storeProp,
|
|
67
|
+
orientation: orientationProp,
|
|
68
|
+
virtualFocus,
|
|
69
|
+
focusLoop,
|
|
70
|
+
rtl
|
|
71
|
+
});
|
|
72
|
+
const orientation = _D4HCGWOUcjs.useStoreState.call(void 0, store, (state) => !composite || state.orientation === "both" ? void 0 : state.orientation);
|
|
73
|
+
props = _QAUJZR6Ycjs.useWrapElement.call(void 0, props, (element) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, MenubarScopedContextProvider, {
|
|
74
|
+
value: store,
|
|
75
|
+
children: element
|
|
76
|
+
}), [store]);
|
|
77
|
+
if (composite) props = {
|
|
78
|
+
role: "menubar",
|
|
79
|
+
"aria-orientation": orientation,
|
|
80
|
+
...props
|
|
81
|
+
};
|
|
82
|
+
props = _NMUCJYMRcjs.useComposite.call(void 0, {
|
|
83
|
+
store,
|
|
84
|
+
composite,
|
|
85
|
+
...props
|
|
86
|
+
});
|
|
87
|
+
return props;
|
|
88
|
+
});
|
|
89
|
+
var Menubar = _QAUJZR6Ycjs.forwardRef.call(void 0, function Menubar2(props) {
|
|
90
|
+
return _QAUJZR6Ycjs.createElement.call(void 0, TagName, useMenubar(props));
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
// ../ariakit-react-components/dist/menubar/menubar-provider.js
|
|
94
|
+
|
|
95
|
+
function MenubarProvider(props = {}) {
|
|
96
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, MenubarContextProvider, {
|
|
97
|
+
value: useMenubarStore(props),
|
|
98
|
+
children: props.children
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
exports.useMenubarContext = useMenubarContext; exports.useMenubarScopedContext = useMenubarScopedContext; exports.useMenubarStore = useMenubarStore; exports.useMenubar = useMenubar; exports.Menubar = Menubar; exports.MenubarProvider = MenubarProvider;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|