@midas-ds/components 1.1.0 → 1.3.0
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 +63 -1
- package/accordion/AccordionItem.d.ts +2 -2
- package/index.cjs +138 -0
- package/index.css +1 -0
- package/index.d.ts +0 -2
- package/index.js +27094 -105
- package/package.json +22 -4
- package/table/Table.d.ts +3 -4
- package/textfield/TextField.d.ts +15 -4
- package/theme.cjs +1 -0
- package/theme.js +20 -0
- package/tokens-BskyMDHv.cjs +1 -0
- package/Breadcrumbs.css +0 -1
- package/Button-DL6nqUco.js +0 -182
- package/Button.css +0 -1
- package/ButtonGroup.css +0 -1
- package/Card.css +0 -1
- package/Checkbox-q0dugR2t.js +0 -402
- package/Checkbox.css +0 -1
- package/Collection-KMFfVuzU.js +0 -510
- package/ComboBox.css +0 -1
- package/DatePicker.css +0 -1
- package/Dialog-D6Bqrpn-.js +0 -1952
- package/Disclosure-dAZYXyTH.js +0 -225
- package/Disclosure.css +0 -1
- package/DragAndDrop-B0T3WgjL.js +0 -40
- package/Dropdown.css +0 -1
- package/FileUpload.css +0 -1
- package/Flex.css +0 -1
- package/Flex.module-CpoxBzQX.js +0 -37
- package/FocusScope-B7CkxXNC.js +0 -513
- package/Form-BWBjJC6v.js +0 -238
- package/Grid.css +0 -1
- package/Grid.module-Ia0e9Dix.js +0 -36
- package/Group-D7_8007y.js +0 -42
- package/Heading-RCRHv6hd.js +0 -15
- package/Hidden-CVlUgUJM.js +0 -37
- package/InfoBanner.css +0 -1
- package/Layout.css +0 -1
- package/Link-BnQvB-hH.js +0 -75
- package/Link.css +0 -1
- package/LinkButton.css +0 -1
- package/ListBox-DBBiqvcR.js +0 -474
- package/ListKeyboardDelegate-gCXy-Xnn.js +0 -172
- package/Logo.css +0 -1
- package/Modal.css +0 -1
- package/MultiSelect.css +0 -1
- package/PressResponder-B4g56kDz.js +0 -31
- package/RSPContexts-BW2SEIqe.js +0 -11
- package/Radio.css +0 -1
- package/SearchField.css +0 -1
- package/Select.css +0 -1
- package/SelectionManager-BfXUE1qg.js +0 -1031
- package/Separator-BBX9m2O2.js +0 -49
- package/Spinner.css +0 -1
- package/Table.css +0 -1
- package/Tabs.css +0 -1
- package/Tag-DWt0koFj.js +0 -728
- package/Tag.css +0 -1
- package/Text-BCF0xvqL.js +0 -15
- package/TextArea.css +0 -1
- package/TextField-CX4eOQf6.js +0 -225
- package/TextField.css +0 -1
- package/TextField.module-DdICj682.js +0 -143
- package/Toast.css +0 -1
- package/VisuallyHidden-Dhr5caPC.js +0 -39
- package/chevron-down-Cd1bkzXT.js +0 -13
- package/chevron-right-DBMc9VMi.js +0 -23
- package/clsx-OuTLNxxd.js +0 -16
- package/context-BpJLnOuu.js +0 -80
- package/createLucideIcon-DeWljiyi.js +0 -79
- package/index-B-jHjTDC.js +0 -120
- package/index-BPdc9gJ8.js +0 -3122
- package/index-KSgQWWiy.js +0 -26984
- package/index10.js +0 -4
- package/index11.js +0 -5
- package/index12.js +0 -4
- package/index13.js +0 -4
- package/index14.js +0 -4
- package/index15.js +0 -6
- package/index16.js +0 -6
- package/index17.js +0 -6
- package/index18.js +0 -4
- package/index19.js +0 -6
- package/index2.js +0 -8
- package/index20.js +0 -6
- package/index21.js +0 -4
- package/index22.js +0 -5
- package/index23.js +0 -5
- package/index24.js +0 -5
- package/index25.js +0 -6
- package/index26.js +0 -6
- package/index27.js +0 -6
- package/index28.js +0 -4
- package/index29.js +0 -6
- package/index3.js +0 -6
- package/index30.js +0 -21
- package/index31.js +0 -22
- package/index32.js +0 -14
- package/index33.js +0 -11
- package/index34.js +0 -31
- package/index35.js +0 -8
- package/index36.js +0 -9
- package/index37.js +0 -19
- package/index38.js +0 -9
- package/index39.js +0 -9
- package/index4.js +0 -4
- package/index40.js +0 -23
- package/index41.js +0 -63
- package/index42.js +0 -53
- package/index43.js +0 -18
- package/index44.js +0 -27
- package/index45.js +0 -18
- package/index46.js +0 -21
- package/index47.js +0 -49
- package/index48.js +0 -5
- package/index49.js +0 -25
- package/index5.js +0 -5
- package/index50.js +0 -18
- package/index51.js +0 -9
- package/index52.js +0 -25
- package/index53.js +0 -18
- package/index54.js +0 -11
- package/index55.js +0 -12
- package/index56.js +0 -15
- package/index57.js +0 -9
- package/index58.js +0 -9
- package/index59.js +0 -19
- package/index6.js +0 -4
- package/index60.js +0 -22
- package/index61.js +0 -61
- package/index62.js +0 -15
- package/index63.js +0 -11
- package/index64.js +0 -53
- package/index65.js +0 -85
- package/index66.js +0 -74
- package/index67.js +0 -24
- package/index68.js +0 -69
- package/index69.js +0 -80
- package/index7.js +0 -9
- package/index70.js +0 -140
- package/index71.js +0 -70
- package/index72.js +0 -42
- package/index73.js +0 -82
- package/index74.js +0 -71
- package/index75.js +0 -104
- package/index76.js +0 -275
- package/index77.js +0 -723
- package/index78.js +0 -489
- package/index79.js +0 -314
- package/index8.js +0 -4
- package/index80.js +0 -389
- package/index81.js +0 -252
- package/index82.js +0 -1364
- package/index83.js +0 -1009
- package/index84.js +0 -386
- package/index85.js +0 -2101
- package/index86.js +0 -2368
- package/index87.js +0 -6831
- package/index88.js +0 -17
- package/index89.js +0 -14
- package/index9.js +0 -5
- package/index90.js +0 -6
- package/index91.js +0 -9
- package/intlStrings-Cd44R5hT.js +0 -278
- package/react.esm-sMU8Z7rL.js +0 -11060
- package/triangle-alert-1OYl9KWz.js +0 -56
- package/useControlledState-Kv9K2AYu.js +0 -30
- package/useDescription-B7stiK3j.js +0 -32
- package/useEvent-Xk5kn5Ns.js +0 -21
- package/useField-DMzJIIN4.js +0 -67
- package/useFilter-Bt9dbV1U.js +0 -35
- package/useFocusRing-9PXyKy2A.js +0 -1297
- package/useFocusable-CcEBZe40.js +0 -59
- package/useGridSelectionCheckbox-DYgEnElE.js +0 -22
- package/useHasTabbableChild-D6DwR81L.js +0 -34
- package/useHighlightSelectionDescription-WYAbP4No.js +0 -552
- package/useLabels-9zaZ9oa0.js +0 -17
- package/useListState-BfTeKTk5.js +0 -119
- package/useLocalizedStringFormatter-BlCbn-hX.js +0 -96
- package/useSingleSelectListState-DPkaL0la.js +0 -34
- package/useUpdateEffect-Dtz-i14F.js +0 -12
- package/x-JK7i-TQC.js +0 -14
|
@@ -1,1031 +0,0 @@
|
|
|
1
|
-
import U, { useRef as A, useEffect as Y, useMemo as j, useState as ee } from "react";
|
|
2
|
-
import { l as ue, G as we, L as xe, n as me, e as se, M as Fe, p as Se, m as ce, u as ne, x as de, N as fe, k as Te, O as ke } from "./useFocusRing-9PXyKy2A.js";
|
|
3
|
-
import { $ as q } from "./useEvent-Xk5kn5Ns.js";
|
|
4
|
-
import { flushSync as De } from "react-dom";
|
|
5
|
-
import { $ as Ie } from "./FocusScope-B7CkxXNC.js";
|
|
6
|
-
import { $ as Ae } from "./context-BpJLnOuu.js";
|
|
7
|
-
import { $ as Ce } from "./useDescription-B7stiK3j.js";
|
|
8
|
-
import { $ as Me } from "./useControlledState-Kv9K2AYu.js";
|
|
9
|
-
function ae(n, e) {
|
|
10
|
-
const t = A(!0), l = A(null);
|
|
11
|
-
ue(() => (t.current = !0, () => {
|
|
12
|
-
t.current = !1;
|
|
13
|
-
}), []), ue(() => {
|
|
14
|
-
t.current ? t.current = !1 : (!l.current || e.some((i, u) => !Object.is(i, l[u]))) && n(), l.current = e;
|
|
15
|
-
}, e);
|
|
16
|
-
}
|
|
17
|
-
function Ee(n, e) {
|
|
18
|
-
if (!n) return !1;
|
|
19
|
-
let t = window.getComputedStyle(n), l = /(auto|scroll)/.test(t.overflow + t.overflowX + t.overflowY);
|
|
20
|
-
return l && e && (l = n.scrollHeight !== n.clientHeight || n.scrollWidth !== n.clientWidth), l;
|
|
21
|
-
}
|
|
22
|
-
function Be(n, e) {
|
|
23
|
-
const t = [];
|
|
24
|
-
for (; n && n !== document.documentElement; )
|
|
25
|
-
Ee(n, e) && t.push(n), n = n.parentElement;
|
|
26
|
-
return t;
|
|
27
|
-
}
|
|
28
|
-
function ve(n, e) {
|
|
29
|
-
let t = he(n, e, "left"), l = he(n, e, "top"), i = e.offsetWidth, u = e.offsetHeight, s = n.scrollLeft, f = n.scrollTop, { borderTopWidth: d, borderLeftWidth: m, scrollPaddingTop: w, scrollPaddingRight: v, scrollPaddingBottom: $, scrollPaddingLeft: a } = getComputedStyle(n), T = s + parseInt(m, 10), k = f + parseInt(d, 10), b = T + n.clientWidth, h = k + n.clientHeight, g = parseInt(w, 10) || 0, p = parseInt($, 10) || 0, x = parseInt(v, 10) || 0, F = parseInt(a, 10) || 0;
|
|
30
|
-
t <= s + F ? s = t - parseInt(m, 10) - F : t + i > b - x && (s += t + i - b + x), l <= k + g ? f = l - parseInt(d, 10) - g : l + u > h - p && (f += l + u - h + p), n.scrollLeft = s, n.scrollTop = f;
|
|
31
|
-
}
|
|
32
|
-
function he(n, e, t) {
|
|
33
|
-
const l = t === "left" ? "offsetLeft" : "offsetTop";
|
|
34
|
-
let i = 0;
|
|
35
|
-
for (; e.offsetParent && (i += e[l], e.offsetParent !== n); ) {
|
|
36
|
-
if (e.offsetParent.contains(n)) {
|
|
37
|
-
i -= n[l];
|
|
38
|
-
break;
|
|
39
|
-
}
|
|
40
|
-
e = e.offsetParent;
|
|
41
|
-
}
|
|
42
|
-
return i;
|
|
43
|
-
}
|
|
44
|
-
function ye(n, e) {
|
|
45
|
-
if (n && document.contains(n)) {
|
|
46
|
-
let s = document.scrollingElement || document.documentElement;
|
|
47
|
-
if (window.getComputedStyle(s).overflow === "hidden") {
|
|
48
|
-
let d = Be(n);
|
|
49
|
-
for (let m of d) ve(m, n);
|
|
50
|
-
} else {
|
|
51
|
-
var t;
|
|
52
|
-
let { left: d, top: m } = n.getBoundingClientRect();
|
|
53
|
-
n == null || (t = n.scrollIntoView) === null || t === void 0 || t.call(n, {
|
|
54
|
-
block: "nearest"
|
|
55
|
-
});
|
|
56
|
-
let { left: w, top: v } = n.getBoundingClientRect();
|
|
57
|
-
if (Math.abs(d - w) > 1 || Math.abs(m - v) > 1) {
|
|
58
|
-
var l, i, u;
|
|
59
|
-
e == null || (i = e.containingElement) === null || i === void 0 || (l = i.scrollIntoView) === null || l === void 0 || l.call(i, {
|
|
60
|
-
block: "center",
|
|
61
|
-
inline: "center"
|
|
62
|
-
}), (u = n.scrollIntoView) === null || u === void 0 || u.call(n, {
|
|
63
|
-
block: "nearest"
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
const Le = "react-aria-clear-focus", Re = "react-aria-focus", Pe = "react-aria-update-activedescendant";
|
|
70
|
-
function H(n) {
|
|
71
|
-
return we() ? n.metaKey : n.ctrlKey;
|
|
72
|
-
}
|
|
73
|
-
const Oe = 500;
|
|
74
|
-
function ze(n) {
|
|
75
|
-
let { isDisabled: e, onLongPressStart: t, onLongPressEnd: l, onLongPress: i, threshold: u = Oe, accessibilityDescription: s } = n;
|
|
76
|
-
const f = A(void 0);
|
|
77
|
-
let { addGlobalListener: d, removeGlobalListener: m } = xe(), { pressProps: w } = me({
|
|
78
|
-
isDisabled: e,
|
|
79
|
-
onPressStart($) {
|
|
80
|
-
if ($.continuePropagation(), ($.pointerType === "mouse" || $.pointerType === "touch") && (t && t({
|
|
81
|
-
...$,
|
|
82
|
-
type: "longpressstart"
|
|
83
|
-
}), f.current = setTimeout(() => {
|
|
84
|
-
$.target.dispatchEvent(new PointerEvent("pointercancel", {
|
|
85
|
-
bubbles: !0
|
|
86
|
-
})), i && i({
|
|
87
|
-
...$,
|
|
88
|
-
type: "longpress"
|
|
89
|
-
}), f.current = void 0;
|
|
90
|
-
}, u), $.pointerType === "touch")) {
|
|
91
|
-
let a = (T) => {
|
|
92
|
-
T.preventDefault();
|
|
93
|
-
};
|
|
94
|
-
d($.target, "contextmenu", a, {
|
|
95
|
-
once: !0
|
|
96
|
-
}), d(window, "pointerup", () => {
|
|
97
|
-
setTimeout(() => {
|
|
98
|
-
m($.target, "contextmenu", a);
|
|
99
|
-
}, 30);
|
|
100
|
-
}, {
|
|
101
|
-
once: !0
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
onPressEnd($) {
|
|
106
|
-
f.current && clearTimeout(f.current), l && ($.pointerType === "mouse" || $.pointerType === "touch") && l({
|
|
107
|
-
...$,
|
|
108
|
-
type: "longpressend"
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
}), v = Ce(i && !e ? s : void 0);
|
|
112
|
-
return {
|
|
113
|
-
longPressProps: se(w, v)
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
function ie(n) {
|
|
117
|
-
return Fe() ? n.altKey : n.ctrlKey;
|
|
118
|
-
}
|
|
119
|
-
const Ue = 1e3;
|
|
120
|
-
function We(n) {
|
|
121
|
-
let { keyboardDelegate: e, selectionManager: t, onTypeSelect: l } = n, i = A({
|
|
122
|
-
search: "",
|
|
123
|
-
timeout: void 0
|
|
124
|
-
}).current, u = (s) => {
|
|
125
|
-
let f = He(s.key);
|
|
126
|
-
if (!(!f || s.ctrlKey || s.metaKey || !s.currentTarget.contains(s.target))) {
|
|
127
|
-
if (f === " " && i.search.trim().length > 0 && (s.preventDefault(), "continuePropagation" in s || s.stopPropagation()), i.search += f, e.getKeyForSearch != null) {
|
|
128
|
-
let d = e.getKeyForSearch(i.search, t.focusedKey);
|
|
129
|
-
d == null && (d = e.getKeyForSearch(i.search)), d != null && (t.setFocusedKey(d), l && l(d));
|
|
130
|
-
}
|
|
131
|
-
clearTimeout(i.timeout), i.timeout = setTimeout(() => {
|
|
132
|
-
i.search = "";
|
|
133
|
-
}, Ue);
|
|
134
|
-
}
|
|
135
|
-
};
|
|
136
|
-
return {
|
|
137
|
-
typeSelectProps: {
|
|
138
|
-
// Using a capturing listener to catch the keydown event before
|
|
139
|
-
// other hooks in order to handle the Spacebar event.
|
|
140
|
-
onKeyDownCapture: e.getKeyForSearch ? u : void 0
|
|
141
|
-
}
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
function He(n) {
|
|
145
|
-
return n.length === 1 || !/^[A-Z]/i.test(n) ? n : "";
|
|
146
|
-
}
|
|
147
|
-
function nt(n) {
|
|
148
|
-
let { selectionManager: e, keyboardDelegate: t, ref: l, autoFocus: i = !1, shouldFocusWrap: u = !1, disallowEmptySelection: s = !1, disallowSelectAll: f = !1, selectOnFocus: d = e.selectionBehavior === "replace", disallowTypeAhead: m = !1, shouldUseVirtualFocus: w, allowsTabNavigation: v = !1, isVirtualized: $, scrollRef: a = l, linkBehavior: T = "action" } = n, { direction: k } = Ae(), b = Se(), h = (o) => {
|
|
149
|
-
var y;
|
|
150
|
-
if (o.altKey && o.key === "Tab" && o.preventDefault(), !(!((y = l.current) === null || y === void 0) && y.contains(o.target))) return;
|
|
151
|
-
const K = (c, z) => {
|
|
152
|
-
if (c != null) {
|
|
153
|
-
if (e.isLink(c) && T === "selection" && d && !ie(o)) {
|
|
154
|
-
var O;
|
|
155
|
-
De(() => {
|
|
156
|
-
e.setFocusedKey(c, z);
|
|
157
|
-
});
|
|
158
|
-
let re = (O = a.current) === null || O === void 0 ? void 0 : O.querySelector(`[data-key="${CSS.escape(c.toString())}"]`), oe = e.getItemProps(c);
|
|
159
|
-
re && b.open(re, o, oe.href, oe.routerOptions);
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
|
-
if (e.setFocusedKey(c, z), e.isLink(c) && T === "override") return;
|
|
163
|
-
o.shiftKey && e.selectionMode === "multiple" ? e.extendSelection(c) : d && !ie(o) && e.replaceSelection(c);
|
|
164
|
-
}
|
|
165
|
-
};
|
|
166
|
-
switch (o.key) {
|
|
167
|
-
case "ArrowDown":
|
|
168
|
-
if (t.getKeyBelow) {
|
|
169
|
-
var S, I, r;
|
|
170
|
-
let c = e.focusedKey != null ? (S = t.getKeyBelow) === null || S === void 0 ? void 0 : S.call(t, e.focusedKey) : (I = t.getFirstKey) === null || I === void 0 ? void 0 : I.call(t);
|
|
171
|
-
c == null && u && (c = (r = t.getFirstKey) === null || r === void 0 ? void 0 : r.call(t, e.focusedKey)), c != null && (o.preventDefault(), K(c));
|
|
172
|
-
}
|
|
173
|
-
break;
|
|
174
|
-
case "ArrowUp":
|
|
175
|
-
if (t.getKeyAbove) {
|
|
176
|
-
var P, B, X;
|
|
177
|
-
let c = e.focusedKey != null ? (P = t.getKeyAbove) === null || P === void 0 ? void 0 : P.call(t, e.focusedKey) : (B = t.getLastKey) === null || B === void 0 ? void 0 : B.call(t);
|
|
178
|
-
c == null && u && (c = (X = t.getLastKey) === null || X === void 0 ? void 0 : X.call(t, e.focusedKey)), c != null && (o.preventDefault(), K(c));
|
|
179
|
-
}
|
|
180
|
-
break;
|
|
181
|
-
case "ArrowLeft":
|
|
182
|
-
if (t.getKeyLeftOf) {
|
|
183
|
-
var V, Z, J;
|
|
184
|
-
let c = e.focusedKey != null ? (V = t.getKeyLeftOf) === null || V === void 0 ? void 0 : V.call(t, e.focusedKey) : null;
|
|
185
|
-
c == null && u && (c = k === "rtl" ? (Z = t.getFirstKey) === null || Z === void 0 ? void 0 : Z.call(t, e.focusedKey) : (J = t.getLastKey) === null || J === void 0 ? void 0 : J.call(t, e.focusedKey)), c != null && (o.preventDefault(), K(c, k === "rtl" ? "first" : "last"));
|
|
186
|
-
}
|
|
187
|
-
break;
|
|
188
|
-
case "ArrowRight":
|
|
189
|
-
if (t.getKeyRightOf) {
|
|
190
|
-
var Q, N, _;
|
|
191
|
-
let c = e.focusedKey != null ? (Q = t.getKeyRightOf) === null || Q === void 0 ? void 0 : Q.call(t, e.focusedKey) : null;
|
|
192
|
-
c == null && u && (c = k === "rtl" ? (N = t.getLastKey) === null || N === void 0 ? void 0 : N.call(t, e.focusedKey) : (_ = t.getFirstKey) === null || _ === void 0 ? void 0 : _.call(t, e.focusedKey)), c != null && (o.preventDefault(), K(c, k === "rtl" ? "last" : "first"));
|
|
193
|
-
}
|
|
194
|
-
break;
|
|
195
|
-
case "Home":
|
|
196
|
-
if (t.getFirstKey) {
|
|
197
|
-
if (e.focusedKey === null && o.shiftKey) return;
|
|
198
|
-
o.preventDefault();
|
|
199
|
-
let c = t.getFirstKey(e.focusedKey, H(o));
|
|
200
|
-
e.setFocusedKey(c), c != null && (H(o) && o.shiftKey && e.selectionMode === "multiple" ? e.extendSelection(c) : d && e.replaceSelection(c));
|
|
201
|
-
}
|
|
202
|
-
break;
|
|
203
|
-
case "End":
|
|
204
|
-
if (t.getLastKey) {
|
|
205
|
-
if (e.focusedKey === null && o.shiftKey) return;
|
|
206
|
-
o.preventDefault();
|
|
207
|
-
let c = t.getLastKey(e.focusedKey, H(o));
|
|
208
|
-
e.setFocusedKey(c), c != null && (H(o) && o.shiftKey && e.selectionMode === "multiple" ? e.extendSelection(c) : d && e.replaceSelection(c));
|
|
209
|
-
}
|
|
210
|
-
break;
|
|
211
|
-
case "PageDown":
|
|
212
|
-
if (t.getKeyPageBelow && e.focusedKey != null) {
|
|
213
|
-
let c = t.getKeyPageBelow(e.focusedKey);
|
|
214
|
-
c != null && (o.preventDefault(), K(c));
|
|
215
|
-
}
|
|
216
|
-
break;
|
|
217
|
-
case "PageUp":
|
|
218
|
-
if (t.getKeyPageAbove && e.focusedKey != null) {
|
|
219
|
-
let c = t.getKeyPageAbove(e.focusedKey);
|
|
220
|
-
c != null && (o.preventDefault(), K(c));
|
|
221
|
-
}
|
|
222
|
-
break;
|
|
223
|
-
case "a":
|
|
224
|
-
H(o) && e.selectionMode === "multiple" && f !== !0 && (o.preventDefault(), e.selectAll());
|
|
225
|
-
break;
|
|
226
|
-
case "Escape":
|
|
227
|
-
!s && e.selectedKeys.size !== 0 && (o.stopPropagation(), o.preventDefault(), e.clearSelection());
|
|
228
|
-
break;
|
|
229
|
-
case "Tab":
|
|
230
|
-
if (!v) {
|
|
231
|
-
if (o.shiftKey) l.current.focus();
|
|
232
|
-
else {
|
|
233
|
-
let c = Ie(l.current, {
|
|
234
|
-
tabbable: !0
|
|
235
|
-
}), z, O;
|
|
236
|
-
do
|
|
237
|
-
O = c.lastChild(), O && (z = O);
|
|
238
|
-
while (O);
|
|
239
|
-
z && !z.contains(document.activeElement) && fe(z);
|
|
240
|
-
}
|
|
241
|
-
break;
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
}, g = A({
|
|
245
|
-
top: 0,
|
|
246
|
-
left: 0
|
|
247
|
-
});
|
|
248
|
-
q(a, "scroll", $ ? void 0 : () => {
|
|
249
|
-
var o, y, K, S;
|
|
250
|
-
g.current = {
|
|
251
|
-
top: (K = (o = a.current) === null || o === void 0 ? void 0 : o.scrollTop) !== null && K !== void 0 ? K : 0,
|
|
252
|
-
left: (S = (y = a.current) === null || y === void 0 ? void 0 : y.scrollLeft) !== null && S !== void 0 ? S : 0
|
|
253
|
-
};
|
|
254
|
-
});
|
|
255
|
-
let p = (o) => {
|
|
256
|
-
if (e.isFocused) {
|
|
257
|
-
o.currentTarget.contains(o.target) || e.setFocused(!1);
|
|
258
|
-
return;
|
|
259
|
-
}
|
|
260
|
-
if (o.currentTarget.contains(o.target)) {
|
|
261
|
-
if (e.setFocused(!0), e.focusedKey == null) {
|
|
262
|
-
var y, K;
|
|
263
|
-
let r = (B) => {
|
|
264
|
-
B != null && (e.setFocusedKey(B), d && e.replaceSelection(B));
|
|
265
|
-
}, P = o.relatedTarget;
|
|
266
|
-
var S, I;
|
|
267
|
-
P && o.currentTarget.compareDocumentPosition(P) & Node.DOCUMENT_POSITION_FOLLOWING ? r((S = e.lastSelectedKey) !== null && S !== void 0 ? S : (y = t.getLastKey) === null || y === void 0 ? void 0 : y.call(t)) : r((I = e.firstSelectedKey) !== null && I !== void 0 ? I : (K = t.getFirstKey) === null || K === void 0 ? void 0 : K.call(t));
|
|
268
|
-
} else !$ && a.current && (a.current.scrollTop = g.current.top, a.current.scrollLeft = g.current.left);
|
|
269
|
-
if (e.focusedKey != null && a.current) {
|
|
270
|
-
let r = a.current.querySelector(`[data-key="${CSS.escape(e.focusedKey.toString())}"]`);
|
|
271
|
-
r && (r.contains(document.activeElement) || fe(r), de() === "keyboard" && ye(r, {
|
|
272
|
-
containingElement: l.current
|
|
273
|
-
}));
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
}, x = (o) => {
|
|
277
|
-
o.currentTarget.contains(o.relatedTarget) || e.setFocused(!1);
|
|
278
|
-
}, F = A(!1);
|
|
279
|
-
q(l, Re, w ? (o) => {
|
|
280
|
-
let { detail: y } = o;
|
|
281
|
-
o.stopPropagation(), e.setFocused(!0), (y == null ? void 0 : y.focusStrategy) === "first" && (F.current = !0);
|
|
282
|
-
} : void 0);
|
|
283
|
-
let L = ce(() => {
|
|
284
|
-
var o, y;
|
|
285
|
-
let K = (y = (o = t.getFirstKey) === null || o === void 0 ? void 0 : o.call(t)) !== null && y !== void 0 ? y : null;
|
|
286
|
-
if (K == null) {
|
|
287
|
-
var S;
|
|
288
|
-
(S = l.current) === null || S === void 0 || S.dispatchEvent(new CustomEvent(Pe, {
|
|
289
|
-
cancelable: !0,
|
|
290
|
-
bubbles: !0
|
|
291
|
-
})), e.collection.size > 0 && (F.current = !1);
|
|
292
|
-
} else
|
|
293
|
-
e.setFocusedKey(K), F.current = !1;
|
|
294
|
-
});
|
|
295
|
-
ae(() => {
|
|
296
|
-
F.current && L();
|
|
297
|
-
}, [
|
|
298
|
-
e.collection,
|
|
299
|
-
L
|
|
300
|
-
]);
|
|
301
|
-
let M = ce(() => {
|
|
302
|
-
e.collection.size > 0 && (F.current = !1);
|
|
303
|
-
});
|
|
304
|
-
ae(() => {
|
|
305
|
-
M();
|
|
306
|
-
}, [
|
|
307
|
-
e.focusedKey,
|
|
308
|
-
M
|
|
309
|
-
]), q(l, Le, w ? (o) => {
|
|
310
|
-
o.stopPropagation(), e.setFocused(!1), e.setFocusedKey(null);
|
|
311
|
-
} : void 0);
|
|
312
|
-
const D = A(i);
|
|
313
|
-
Y(() => {
|
|
314
|
-
if (D.current) {
|
|
315
|
-
var o, y;
|
|
316
|
-
let I = null;
|
|
317
|
-
var K;
|
|
318
|
-
i === "first" && (I = (K = (o = t.getFirstKey) === null || o === void 0 ? void 0 : o.call(t)) !== null && K !== void 0 ? K : null);
|
|
319
|
-
var S;
|
|
320
|
-
i === "last" && (I = (S = (y = t.getLastKey) === null || y === void 0 ? void 0 : y.call(t)) !== null && S !== void 0 ? S : null);
|
|
321
|
-
let r = e.selectedKeys;
|
|
322
|
-
if (r.size) {
|
|
323
|
-
for (let P of r) if (e.canSelectItem(P)) {
|
|
324
|
-
I = P;
|
|
325
|
-
break;
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
e.setFocused(!0), e.setFocusedKey(I), I == null && !w && l.current && ne(l.current);
|
|
329
|
-
}
|
|
330
|
-
}, []);
|
|
331
|
-
let W = A(e.focusedKey);
|
|
332
|
-
Y(() => {
|
|
333
|
-
if (e.isFocused && e.focusedKey != null && (e.focusedKey !== W.current || D.current) && a.current && l.current) {
|
|
334
|
-
let o = de(), y = l.current.querySelector(`[data-key="${CSS.escape(e.focusedKey.toString())}"]`);
|
|
335
|
-
if (!y)
|
|
336
|
-
return;
|
|
337
|
-
(o === "keyboard" || D.current) && (ve(a.current, y), o !== "virtual" && ye(y, {
|
|
338
|
-
containingElement: l.current
|
|
339
|
-
}));
|
|
340
|
-
}
|
|
341
|
-
!w && e.isFocused && e.focusedKey == null && W.current != null && l.current && ne(l.current), W.current = e.focusedKey, D.current = !1;
|
|
342
|
-
}), q(l, "react-aria-focus-scope-restore", (o) => {
|
|
343
|
-
o.preventDefault(), e.setFocused(!0);
|
|
344
|
-
});
|
|
345
|
-
let R = {
|
|
346
|
-
onKeyDown: h,
|
|
347
|
-
onFocus: p,
|
|
348
|
-
onBlur: x,
|
|
349
|
-
onMouseDown(o) {
|
|
350
|
-
a.current === o.target && o.preventDefault();
|
|
351
|
-
}
|
|
352
|
-
}, { typeSelectProps: E } = We({
|
|
353
|
-
keyboardDelegate: t,
|
|
354
|
-
selectionManager: e
|
|
355
|
-
});
|
|
356
|
-
m || (R = se(E, R));
|
|
357
|
-
let G;
|
|
358
|
-
return w ? G = -1 : G = e.focusedKey == null ? 0 : -1, {
|
|
359
|
-
collectionProps: {
|
|
360
|
-
...R,
|
|
361
|
-
tabIndex: G
|
|
362
|
-
}
|
|
363
|
-
};
|
|
364
|
-
}
|
|
365
|
-
function it(n) {
|
|
366
|
-
let { id: e, selectionManager: t, key: l, ref: i, shouldSelectOnPressUp: u, shouldUseVirtualFocus: s, focus: f, isDisabled: d, onAction: m, allowsDifferentPressOrigin: w, linkBehavior: v = "action" } = n, $ = Se();
|
|
367
|
-
e = Te(e);
|
|
368
|
-
let a = (r) => {
|
|
369
|
-
if (r.pointerType === "keyboard" && ie(r)) t.toggleSelection(l);
|
|
370
|
-
else {
|
|
371
|
-
if (t.selectionMode === "none") return;
|
|
372
|
-
if (t.isLink(l)) {
|
|
373
|
-
if (v === "selection" && i.current) {
|
|
374
|
-
let P = t.getItemProps(l);
|
|
375
|
-
$.open(i.current, r, P.href, P.routerOptions), t.setSelectedKeys(t.selectedKeys);
|
|
376
|
-
return;
|
|
377
|
-
} else if (v === "override" || v === "none") return;
|
|
378
|
-
}
|
|
379
|
-
t.selectionMode === "single" ? t.isSelected(l) && !t.disallowEmptySelection ? t.toggleSelection(l) : t.replaceSelection(l) : r && r.shiftKey ? t.extendSelection(l) : t.selectionBehavior === "toggle" || r && (H(r) || r.pointerType === "touch" || r.pointerType === "virtual") ? t.toggleSelection(l) : t.replaceSelection(l);
|
|
380
|
-
}
|
|
381
|
-
};
|
|
382
|
-
Y(() => {
|
|
383
|
-
if (l === t.focusedKey && t.isFocused)
|
|
384
|
-
if (!s)
|
|
385
|
-
f ? f() : document.activeElement !== i.current && i.current && ne(i.current);
|
|
386
|
-
else {
|
|
387
|
-
var P;
|
|
388
|
-
let B = new CustomEvent(Pe, {
|
|
389
|
-
cancelable: !0,
|
|
390
|
-
bubbles: !0
|
|
391
|
-
});
|
|
392
|
-
(P = i.current) === null || P === void 0 || P.dispatchEvent(B);
|
|
393
|
-
}
|
|
394
|
-
}, [
|
|
395
|
-
i,
|
|
396
|
-
l,
|
|
397
|
-
t.focusedKey,
|
|
398
|
-
t.childFocusStrategy,
|
|
399
|
-
t.isFocused,
|
|
400
|
-
s
|
|
401
|
-
]), d = d || t.isDisabled(l);
|
|
402
|
-
let T = {};
|
|
403
|
-
!s && !d ? T = {
|
|
404
|
-
tabIndex: l === t.focusedKey ? 0 : -1,
|
|
405
|
-
onFocus(r) {
|
|
406
|
-
r.target === i.current && t.setFocusedKey(l);
|
|
407
|
-
}
|
|
408
|
-
} : d && (T.onMouseDown = (r) => {
|
|
409
|
-
r.preventDefault();
|
|
410
|
-
});
|
|
411
|
-
let k = t.isLink(l) && v === "override", b = t.isLink(l) && v !== "selection" && v !== "none", h = !d && t.canSelectItem(l) && !k, g = (m || b) && !d, p = g && (t.selectionBehavior === "replace" ? !h : !h || t.isEmpty), x = g && h && t.selectionBehavior === "replace", F = p || x, L = A(null), M = F && h, D = A(!1), W = A(!1), R = (r) => {
|
|
412
|
-
if (m && m(), b && i.current) {
|
|
413
|
-
let P = t.getItemProps(l);
|
|
414
|
-
$.open(i.current, r, P.href, P.routerOptions);
|
|
415
|
-
}
|
|
416
|
-
}, E = {};
|
|
417
|
-
u ? (E.onPressStart = (r) => {
|
|
418
|
-
L.current = r.pointerType, D.current = M, r.pointerType === "keyboard" && (!F || be()) && a(r);
|
|
419
|
-
}, w ? (E.onPressUp = p ? void 0 : (r) => {
|
|
420
|
-
r.pointerType === "mouse" && h && a(r);
|
|
421
|
-
}, E.onPress = p ? R : (r) => {
|
|
422
|
-
r.pointerType !== "keyboard" && r.pointerType !== "mouse" && h && a(r);
|
|
423
|
-
}) : E.onPress = (r) => {
|
|
424
|
-
if (p || x && r.pointerType !== "mouse") {
|
|
425
|
-
if (r.pointerType === "keyboard" && !pe()) return;
|
|
426
|
-
R(r);
|
|
427
|
-
} else r.pointerType !== "keyboard" && h && a(r);
|
|
428
|
-
}) : (E.onPressStart = (r) => {
|
|
429
|
-
L.current = r.pointerType, D.current = M, W.current = p, h && (r.pointerType === "mouse" && !p || r.pointerType === "keyboard" && (!g || be())) && a(r);
|
|
430
|
-
}, E.onPress = (r) => {
|
|
431
|
-
(r.pointerType === "touch" || r.pointerType === "pen" || r.pointerType === "virtual" || r.pointerType === "keyboard" && F && pe() || r.pointerType === "mouse" && W.current) && (F ? R(r) : h && a(r));
|
|
432
|
-
}), T["data-key"] = l, E.preventFocusOnPress = s;
|
|
433
|
-
let { pressProps: G, isPressed: o } = me(E), y = x ? (r) => {
|
|
434
|
-
L.current === "mouse" && (r.stopPropagation(), r.preventDefault(), R(r));
|
|
435
|
-
} : void 0, { longPressProps: K } = ze({
|
|
436
|
-
isDisabled: !M,
|
|
437
|
-
onLongPress(r) {
|
|
438
|
-
r.pointerType === "touch" && (a(r), t.setSelectionBehavior("toggle"));
|
|
439
|
-
}
|
|
440
|
-
}), S = (r) => {
|
|
441
|
-
L.current === "touch" && D.current && r.preventDefault();
|
|
442
|
-
}, I = t.isLink(l) ? (r) => {
|
|
443
|
-
ke.isOpening || r.preventDefault();
|
|
444
|
-
} : void 0;
|
|
445
|
-
return {
|
|
446
|
-
itemProps: se(T, h || p ? G : {}, M ? K : {}, {
|
|
447
|
-
onDoubleClick: y,
|
|
448
|
-
onDragStartCapture: S,
|
|
449
|
-
onClick: I,
|
|
450
|
-
id: e
|
|
451
|
-
}),
|
|
452
|
-
isPressed: o,
|
|
453
|
-
isSelected: t.isSelected(l),
|
|
454
|
-
isFocused: t.isFocused && t.focusedKey === l,
|
|
455
|
-
isDisabled: d,
|
|
456
|
-
allowsSelection: h,
|
|
457
|
-
hasAction: F
|
|
458
|
-
};
|
|
459
|
-
}
|
|
460
|
-
function pe() {
|
|
461
|
-
let n = window.event;
|
|
462
|
-
return (n == null ? void 0 : n.key) === "Enter";
|
|
463
|
-
}
|
|
464
|
-
function be() {
|
|
465
|
-
let n = window.event;
|
|
466
|
-
return (n == null ? void 0 : n.key) === " " || (n == null ? void 0 : n.code) === "Space";
|
|
467
|
-
}
|
|
468
|
-
class Ge {
|
|
469
|
-
build(e, t) {
|
|
470
|
-
return this.context = t, $e(() => this.iterateCollection(e));
|
|
471
|
-
}
|
|
472
|
-
*iterateCollection(e) {
|
|
473
|
-
let { children: t, items: l } = e;
|
|
474
|
-
if (U.isValidElement(t) && t.type === U.Fragment) yield* this.iterateCollection({
|
|
475
|
-
children: t.props.children,
|
|
476
|
-
items: l
|
|
477
|
-
});
|
|
478
|
-
else if (typeof t == "function") {
|
|
479
|
-
if (!l) throw new Error("props.children was a function but props.items is missing");
|
|
480
|
-
let i = 0;
|
|
481
|
-
for (let u of l)
|
|
482
|
-
yield* this.getFullNode({
|
|
483
|
-
value: u,
|
|
484
|
-
index: i
|
|
485
|
-
}, {
|
|
486
|
-
renderer: t
|
|
487
|
-
}), i++;
|
|
488
|
-
} else {
|
|
489
|
-
let i = [];
|
|
490
|
-
U.Children.forEach(t, (s) => {
|
|
491
|
-
s && i.push(s);
|
|
492
|
-
});
|
|
493
|
-
let u = 0;
|
|
494
|
-
for (let s of i) {
|
|
495
|
-
let f = this.getFullNode({
|
|
496
|
-
element: s,
|
|
497
|
-
index: u
|
|
498
|
-
}, {});
|
|
499
|
-
for (let d of f)
|
|
500
|
-
u++, yield d;
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
getKey(e, t, l, i) {
|
|
505
|
-
if (e.key != null) return e.key;
|
|
506
|
-
if (t.type === "cell" && t.key != null) return `${i}${t.key}`;
|
|
507
|
-
let u = t.value;
|
|
508
|
-
if (u != null) {
|
|
509
|
-
var s;
|
|
510
|
-
let f = (s = u.key) !== null && s !== void 0 ? s : u.id;
|
|
511
|
-
if (f == null) throw new Error("No key found for item");
|
|
512
|
-
return f;
|
|
513
|
-
}
|
|
514
|
-
return i ? `${i}.${t.index}` : `$.${t.index}`;
|
|
515
|
-
}
|
|
516
|
-
getChildState(e, t) {
|
|
517
|
-
return {
|
|
518
|
-
renderer: t.renderer || e.renderer
|
|
519
|
-
};
|
|
520
|
-
}
|
|
521
|
-
*getFullNode(e, t, l, i) {
|
|
522
|
-
if (U.isValidElement(e.element) && e.element.type === U.Fragment) {
|
|
523
|
-
let b = [];
|
|
524
|
-
U.Children.forEach(e.element.props.children, (g) => {
|
|
525
|
-
b.push(g);
|
|
526
|
-
});
|
|
527
|
-
var u;
|
|
528
|
-
let h = (u = e.index) !== null && u !== void 0 ? u : 0;
|
|
529
|
-
for (const g of b) yield* this.getFullNode({
|
|
530
|
-
element: g,
|
|
531
|
-
index: h++
|
|
532
|
-
}, t, l, i);
|
|
533
|
-
return;
|
|
534
|
-
}
|
|
535
|
-
let s = e.element;
|
|
536
|
-
if (!s && e.value && t && t.renderer) {
|
|
537
|
-
let b = this.cache.get(e.value);
|
|
538
|
-
if (b && (!b.shouldInvalidate || !b.shouldInvalidate(this.context))) {
|
|
539
|
-
b.index = e.index, b.parentKey = i ? i.key : null, yield b;
|
|
540
|
-
return;
|
|
541
|
-
}
|
|
542
|
-
s = t.renderer(e.value);
|
|
543
|
-
}
|
|
544
|
-
if (U.isValidElement(s)) {
|
|
545
|
-
let b = s.type;
|
|
546
|
-
if (typeof b != "function" && typeof b.getCollectionNode != "function") {
|
|
547
|
-
let x = s.type;
|
|
548
|
-
throw new Error(`Unknown element <${x}> in collection.`);
|
|
549
|
-
}
|
|
550
|
-
let h = b.getCollectionNode(s.props, this.context);
|
|
551
|
-
var f;
|
|
552
|
-
let g = (f = e.index) !== null && f !== void 0 ? f : 0, p = h.next();
|
|
553
|
-
for (; !p.done && p.value; ) {
|
|
554
|
-
let x = p.value;
|
|
555
|
-
e.index = g;
|
|
556
|
-
var d;
|
|
557
|
-
let F = (d = x.key) !== null && d !== void 0 ? d : null;
|
|
558
|
-
F == null && (F = x.element ? null : this.getKey(s, e, t, l));
|
|
559
|
-
let M = [
|
|
560
|
-
...this.getFullNode({
|
|
561
|
-
...x,
|
|
562
|
-
key: F,
|
|
563
|
-
index: g,
|
|
564
|
-
wrapper: je(e.wrapper, x.wrapper)
|
|
565
|
-
}, this.getChildState(t, x), l ? `${l}${s.key}` : s.key, i)
|
|
566
|
-
];
|
|
567
|
-
for (let D of M) {
|
|
568
|
-
var m, w;
|
|
569
|
-
D.value = (w = (m = x.value) !== null && m !== void 0 ? m : e.value) !== null && w !== void 0 ? w : null, D.value && this.cache.set(D.value, D);
|
|
570
|
-
var v;
|
|
571
|
-
if (e.type && D.type !== e.type) throw new Error(`Unsupported type <${te(D.type)}> in <${te((v = i == null ? void 0 : i.type) !== null && v !== void 0 ? v : "unknown parent type")}>. Only <${te(e.type)}> is supported.`);
|
|
572
|
-
g++, yield D;
|
|
573
|
-
}
|
|
574
|
-
p = h.next(M);
|
|
575
|
-
}
|
|
576
|
-
return;
|
|
577
|
-
}
|
|
578
|
-
if (e.key == null || e.type == null) return;
|
|
579
|
-
let $ = this;
|
|
580
|
-
var a, T;
|
|
581
|
-
let k = {
|
|
582
|
-
type: e.type,
|
|
583
|
-
props: e.props,
|
|
584
|
-
key: e.key,
|
|
585
|
-
parentKey: i ? i.key : null,
|
|
586
|
-
value: (a = e.value) !== null && a !== void 0 ? a : null,
|
|
587
|
-
level: i ? i.level + 1 : 0,
|
|
588
|
-
index: e.index,
|
|
589
|
-
rendered: e.rendered,
|
|
590
|
-
textValue: (T = e.textValue) !== null && T !== void 0 ? T : "",
|
|
591
|
-
"aria-label": e["aria-label"],
|
|
592
|
-
wrapper: e.wrapper,
|
|
593
|
-
shouldInvalidate: e.shouldInvalidate,
|
|
594
|
-
hasChildNodes: e.hasChildNodes || !1,
|
|
595
|
-
childNodes: $e(function* () {
|
|
596
|
-
if (!e.hasChildNodes || !e.childNodes) return;
|
|
597
|
-
let b = 0;
|
|
598
|
-
for (let h of e.childNodes()) {
|
|
599
|
-
h.key != null && (h.key = `${k.key}${h.key}`);
|
|
600
|
-
let g = $.getFullNode({
|
|
601
|
-
...h,
|
|
602
|
-
index: b
|
|
603
|
-
}, $.getChildState(t, h), k.key, k);
|
|
604
|
-
for (let p of g)
|
|
605
|
-
b++, yield p;
|
|
606
|
-
}
|
|
607
|
-
})
|
|
608
|
-
};
|
|
609
|
-
yield k;
|
|
610
|
-
}
|
|
611
|
-
constructor() {
|
|
612
|
-
this.cache = /* @__PURE__ */ new WeakMap();
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
function $e(n) {
|
|
616
|
-
let e = [], t = null;
|
|
617
|
-
return {
|
|
618
|
-
*[Symbol.iterator]() {
|
|
619
|
-
for (let l of e) yield l;
|
|
620
|
-
t || (t = n());
|
|
621
|
-
for (let l of t)
|
|
622
|
-
e.push(l), yield l;
|
|
623
|
-
}
|
|
624
|
-
};
|
|
625
|
-
}
|
|
626
|
-
function je(n, e) {
|
|
627
|
-
if (n && e) return (t) => n(e(t));
|
|
628
|
-
if (n) return n;
|
|
629
|
-
if (e) return e;
|
|
630
|
-
}
|
|
631
|
-
function te(n) {
|
|
632
|
-
return n[0].toUpperCase() + n.slice(1);
|
|
633
|
-
}
|
|
634
|
-
function st(n, e, t) {
|
|
635
|
-
let l = j(() => new Ge(), []), { children: i, items: u, collection: s } = n;
|
|
636
|
-
return j(() => {
|
|
637
|
-
if (s) return s;
|
|
638
|
-
let d = l.build({
|
|
639
|
-
children: i,
|
|
640
|
-
items: u
|
|
641
|
-
}, t);
|
|
642
|
-
return e(d);
|
|
643
|
-
}, [
|
|
644
|
-
l,
|
|
645
|
-
i,
|
|
646
|
-
u,
|
|
647
|
-
s,
|
|
648
|
-
t,
|
|
649
|
-
e
|
|
650
|
-
]);
|
|
651
|
-
}
|
|
652
|
-
function qe(n, e) {
|
|
653
|
-
return typeof e.getChildren == "function" ? e.getChildren(n.key) : n.childNodes;
|
|
654
|
-
}
|
|
655
|
-
function Ye(n) {
|
|
656
|
-
return Xe(n, 0);
|
|
657
|
-
}
|
|
658
|
-
function Xe(n, e) {
|
|
659
|
-
if (e < 0) return;
|
|
660
|
-
let t = 0;
|
|
661
|
-
for (let l of n) {
|
|
662
|
-
if (t === e) return l;
|
|
663
|
-
t++;
|
|
664
|
-
}
|
|
665
|
-
}
|
|
666
|
-
function rt(n) {
|
|
667
|
-
let e;
|
|
668
|
-
for (let t of n) e = t;
|
|
669
|
-
return e;
|
|
670
|
-
}
|
|
671
|
-
function le(n, e, t) {
|
|
672
|
-
if (e.parentKey === t.parentKey) return e.index - t.index;
|
|
673
|
-
let l = [
|
|
674
|
-
...ge(n, e),
|
|
675
|
-
e
|
|
676
|
-
], i = [
|
|
677
|
-
...ge(n, t),
|
|
678
|
-
t
|
|
679
|
-
], u = l.slice(0, i.length).findIndex((s, f) => s !== i[f]);
|
|
680
|
-
return u !== -1 ? (e = l[u], t = i[u], e.index - t.index) : l.findIndex((s) => s === t) >= 0 ? 1 : (i.findIndex((s) => s === e) >= 0, -1);
|
|
681
|
-
}
|
|
682
|
-
function ge(n, e) {
|
|
683
|
-
let t = [], l = e;
|
|
684
|
-
for (; (l == null ? void 0 : l.parentKey) != null; )
|
|
685
|
-
l = n.getItem(l.parentKey), l && t.unshift(l);
|
|
686
|
-
return t;
|
|
687
|
-
}
|
|
688
|
-
class C extends Set {
|
|
689
|
-
constructor(e, t, l) {
|
|
690
|
-
super(e), e instanceof C ? (this.anchorKey = t ?? e.anchorKey, this.currentKey = l ?? e.currentKey) : (this.anchorKey = t ?? null, this.currentKey = l ?? null);
|
|
691
|
-
}
|
|
692
|
-
}
|
|
693
|
-
function Ve(n, e) {
|
|
694
|
-
if (n.size !== e.size) return !1;
|
|
695
|
-
for (let t of n)
|
|
696
|
-
if (!e.has(t)) return !1;
|
|
697
|
-
return !0;
|
|
698
|
-
}
|
|
699
|
-
function ot(n) {
|
|
700
|
-
let { selectionMode: e = "none", disallowEmptySelection: t = !1, allowDuplicateSelectionEvents: l, selectionBehavior: i = "toggle", disabledBehavior: u = "all" } = n, s = A(!1), [, f] = ee(!1), d = A(null), m = A(null), [, w] = ee(null), v = j(() => Ke(n.selectedKeys), [
|
|
701
|
-
n.selectedKeys
|
|
702
|
-
]), $ = j(() => Ke(n.defaultSelectedKeys, new C()), [
|
|
703
|
-
n.defaultSelectedKeys
|
|
704
|
-
]), [a, T] = Me(v, $, n.onSelectionChange), k = j(() => n.disabledKeys ? new Set(n.disabledKeys) : /* @__PURE__ */ new Set(), [
|
|
705
|
-
n.disabledKeys
|
|
706
|
-
]), [b, h] = ee(i);
|
|
707
|
-
i === "replace" && b === "toggle" && typeof a == "object" && a.size === 0 && h("replace");
|
|
708
|
-
let g = A(i);
|
|
709
|
-
return Y(() => {
|
|
710
|
-
i !== g.current && (h(i), g.current = i);
|
|
711
|
-
}, [
|
|
712
|
-
i
|
|
713
|
-
]), {
|
|
714
|
-
selectionMode: e,
|
|
715
|
-
disallowEmptySelection: t,
|
|
716
|
-
selectionBehavior: b,
|
|
717
|
-
setSelectionBehavior: h,
|
|
718
|
-
get isFocused() {
|
|
719
|
-
return s.current;
|
|
720
|
-
},
|
|
721
|
-
setFocused(p) {
|
|
722
|
-
s.current = p, f(p);
|
|
723
|
-
},
|
|
724
|
-
get focusedKey() {
|
|
725
|
-
return d.current;
|
|
726
|
-
},
|
|
727
|
-
get childFocusStrategy() {
|
|
728
|
-
return m.current;
|
|
729
|
-
},
|
|
730
|
-
setFocusedKey(p, x = "first") {
|
|
731
|
-
d.current = p, m.current = x, w(p);
|
|
732
|
-
},
|
|
733
|
-
selectedKeys: a,
|
|
734
|
-
setSelectedKeys(p) {
|
|
735
|
-
(l || !Ve(p, a)) && T(p);
|
|
736
|
-
},
|
|
737
|
-
disabledKeys: k,
|
|
738
|
-
disabledBehavior: u
|
|
739
|
-
};
|
|
740
|
-
}
|
|
741
|
-
function Ke(n, e) {
|
|
742
|
-
return n ? n === "all" ? "all" : new C(n) : e;
|
|
743
|
-
}
|
|
744
|
-
class ut {
|
|
745
|
-
/**
|
|
746
|
-
* The type of selection that is allowed in the collection.
|
|
747
|
-
*/
|
|
748
|
-
get selectionMode() {
|
|
749
|
-
return this.state.selectionMode;
|
|
750
|
-
}
|
|
751
|
-
/**
|
|
752
|
-
* Whether the collection allows empty selection.
|
|
753
|
-
*/
|
|
754
|
-
get disallowEmptySelection() {
|
|
755
|
-
return this.state.disallowEmptySelection;
|
|
756
|
-
}
|
|
757
|
-
/**
|
|
758
|
-
* The selection behavior for the collection.
|
|
759
|
-
*/
|
|
760
|
-
get selectionBehavior() {
|
|
761
|
-
return this.state.selectionBehavior;
|
|
762
|
-
}
|
|
763
|
-
/**
|
|
764
|
-
* Sets the selection behavior for the collection.
|
|
765
|
-
*/
|
|
766
|
-
setSelectionBehavior(e) {
|
|
767
|
-
this.state.setSelectionBehavior(e);
|
|
768
|
-
}
|
|
769
|
-
/**
|
|
770
|
-
* Whether the collection is currently focused.
|
|
771
|
-
*/
|
|
772
|
-
get isFocused() {
|
|
773
|
-
return this.state.isFocused;
|
|
774
|
-
}
|
|
775
|
-
/**
|
|
776
|
-
* Sets whether the collection is focused.
|
|
777
|
-
*/
|
|
778
|
-
setFocused(e) {
|
|
779
|
-
this.state.setFocused(e);
|
|
780
|
-
}
|
|
781
|
-
/**
|
|
782
|
-
* The current focused key in the collection.
|
|
783
|
-
*/
|
|
784
|
-
get focusedKey() {
|
|
785
|
-
return this.state.focusedKey;
|
|
786
|
-
}
|
|
787
|
-
/** Whether the first or last child of the focused key should receive focus. */
|
|
788
|
-
get childFocusStrategy() {
|
|
789
|
-
return this.state.childFocusStrategy;
|
|
790
|
-
}
|
|
791
|
-
/**
|
|
792
|
-
* Sets the focused key.
|
|
793
|
-
*/
|
|
794
|
-
setFocusedKey(e, t) {
|
|
795
|
-
(e == null || this.collection.getItem(e)) && this.state.setFocusedKey(e, t);
|
|
796
|
-
}
|
|
797
|
-
/**
|
|
798
|
-
* The currently selected keys in the collection.
|
|
799
|
-
*/
|
|
800
|
-
get selectedKeys() {
|
|
801
|
-
return this.state.selectedKeys === "all" ? new Set(this.getSelectAllKeys()) : this.state.selectedKeys;
|
|
802
|
-
}
|
|
803
|
-
/**
|
|
804
|
-
* The raw selection value for the collection.
|
|
805
|
-
* Either 'all' for select all, or a set of keys.
|
|
806
|
-
*/
|
|
807
|
-
get rawSelection() {
|
|
808
|
-
return this.state.selectedKeys;
|
|
809
|
-
}
|
|
810
|
-
/**
|
|
811
|
-
* Returns whether a key is selected.
|
|
812
|
-
*/
|
|
813
|
-
isSelected(e) {
|
|
814
|
-
if (this.state.selectionMode === "none") return !1;
|
|
815
|
-
let t = this.getKey(e);
|
|
816
|
-
return t == null ? !1 : this.state.selectedKeys === "all" ? this.canSelectItem(t) : this.state.selectedKeys.has(t);
|
|
817
|
-
}
|
|
818
|
-
/**
|
|
819
|
-
* Whether the selection is empty.
|
|
820
|
-
*/
|
|
821
|
-
get isEmpty() {
|
|
822
|
-
return this.state.selectedKeys !== "all" && this.state.selectedKeys.size === 0;
|
|
823
|
-
}
|
|
824
|
-
/**
|
|
825
|
-
* Whether all items in the collection are selected.
|
|
826
|
-
*/
|
|
827
|
-
get isSelectAll() {
|
|
828
|
-
if (this.isEmpty) return !1;
|
|
829
|
-
if (this.state.selectedKeys === "all") return !0;
|
|
830
|
-
if (this._isSelectAll != null) return this._isSelectAll;
|
|
831
|
-
let e = this.getSelectAllKeys(), t = this.state.selectedKeys;
|
|
832
|
-
return this._isSelectAll = e.every((l) => t.has(l)), this._isSelectAll;
|
|
833
|
-
}
|
|
834
|
-
get firstSelectedKey() {
|
|
835
|
-
let e = null;
|
|
836
|
-
for (let l of this.state.selectedKeys) {
|
|
837
|
-
let i = this.collection.getItem(l);
|
|
838
|
-
(!e || i && le(this.collection, i, e) < 0) && (e = i);
|
|
839
|
-
}
|
|
840
|
-
var t;
|
|
841
|
-
return (t = e == null ? void 0 : e.key) !== null && t !== void 0 ? t : null;
|
|
842
|
-
}
|
|
843
|
-
get lastSelectedKey() {
|
|
844
|
-
let e = null;
|
|
845
|
-
for (let l of this.state.selectedKeys) {
|
|
846
|
-
let i = this.collection.getItem(l);
|
|
847
|
-
(!e || i && le(this.collection, i, e) > 0) && (e = i);
|
|
848
|
-
}
|
|
849
|
-
var t;
|
|
850
|
-
return (t = e == null ? void 0 : e.key) !== null && t !== void 0 ? t : null;
|
|
851
|
-
}
|
|
852
|
-
get disabledKeys() {
|
|
853
|
-
return this.state.disabledKeys;
|
|
854
|
-
}
|
|
855
|
-
get disabledBehavior() {
|
|
856
|
-
return this.state.disabledBehavior;
|
|
857
|
-
}
|
|
858
|
-
/**
|
|
859
|
-
* Extends the selection to the given key.
|
|
860
|
-
*/
|
|
861
|
-
extendSelection(e) {
|
|
862
|
-
if (this.selectionMode === "none") return;
|
|
863
|
-
if (this.selectionMode === "single") {
|
|
864
|
-
this.replaceSelection(e);
|
|
865
|
-
return;
|
|
866
|
-
}
|
|
867
|
-
let t = this.getKey(e);
|
|
868
|
-
if (t == null) return;
|
|
869
|
-
let l;
|
|
870
|
-
if (this.state.selectedKeys === "all") l = new C([
|
|
871
|
-
t
|
|
872
|
-
], t, t);
|
|
873
|
-
else {
|
|
874
|
-
let s = this.state.selectedKeys;
|
|
875
|
-
var i;
|
|
876
|
-
let f = (i = s.anchorKey) !== null && i !== void 0 ? i : t;
|
|
877
|
-
l = new C(s, f, t);
|
|
878
|
-
var u;
|
|
879
|
-
for (let d of this.getKeyRange(f, (u = s.currentKey) !== null && u !== void 0 ? u : t)) l.delete(d);
|
|
880
|
-
for (let d of this.getKeyRange(t, f)) this.canSelectItem(d) && l.add(d);
|
|
881
|
-
}
|
|
882
|
-
this.state.setSelectedKeys(l);
|
|
883
|
-
}
|
|
884
|
-
getKeyRange(e, t) {
|
|
885
|
-
let l = this.collection.getItem(e), i = this.collection.getItem(t);
|
|
886
|
-
return l && i ? le(this.collection, l, i) <= 0 ? this.getKeyRangeInternal(e, t) : this.getKeyRangeInternal(t, e) : [];
|
|
887
|
-
}
|
|
888
|
-
getKeyRangeInternal(e, t) {
|
|
889
|
-
var l;
|
|
890
|
-
if (!((l = this.layoutDelegate) === null || l === void 0) && l.getKeyRange) return this.layoutDelegate.getKeyRange(e, t);
|
|
891
|
-
let i = [], u = e;
|
|
892
|
-
for (; u != null; ) {
|
|
893
|
-
let s = this.collection.getItem(u);
|
|
894
|
-
if (s && (s.type === "item" || s.type === "cell" && this.allowsCellSelection) && i.push(u), u === t) return i;
|
|
895
|
-
u = this.collection.getKeyAfter(u);
|
|
896
|
-
}
|
|
897
|
-
return [];
|
|
898
|
-
}
|
|
899
|
-
getKey(e) {
|
|
900
|
-
let t = this.collection.getItem(e);
|
|
901
|
-
if (!t || t.type === "cell" && this.allowsCellSelection) return e;
|
|
902
|
-
for (; t && t.type !== "item" && t.parentKey != null; ) t = this.collection.getItem(t.parentKey);
|
|
903
|
-
return !t || t.type !== "item" ? null : t.key;
|
|
904
|
-
}
|
|
905
|
-
/**
|
|
906
|
-
* Toggles whether the given key is selected.
|
|
907
|
-
*/
|
|
908
|
-
toggleSelection(e) {
|
|
909
|
-
if (this.selectionMode === "none") return;
|
|
910
|
-
if (this.selectionMode === "single" && !this.isSelected(e)) {
|
|
911
|
-
this.replaceSelection(e);
|
|
912
|
-
return;
|
|
913
|
-
}
|
|
914
|
-
let t = this.getKey(e);
|
|
915
|
-
if (t == null) return;
|
|
916
|
-
let l = new C(this.state.selectedKeys === "all" ? this.getSelectAllKeys() : this.state.selectedKeys);
|
|
917
|
-
l.has(t) ? l.delete(t) : this.canSelectItem(t) && (l.add(t), l.anchorKey = t, l.currentKey = t), !(this.disallowEmptySelection && l.size === 0) && this.state.setSelectedKeys(l);
|
|
918
|
-
}
|
|
919
|
-
/**
|
|
920
|
-
* Replaces the selection with only the given key.
|
|
921
|
-
*/
|
|
922
|
-
replaceSelection(e) {
|
|
923
|
-
if (this.selectionMode === "none") return;
|
|
924
|
-
let t = this.getKey(e);
|
|
925
|
-
if (t == null) return;
|
|
926
|
-
let l = this.canSelectItem(t) ? new C([
|
|
927
|
-
t
|
|
928
|
-
], t, t) : new C();
|
|
929
|
-
this.state.setSelectedKeys(l);
|
|
930
|
-
}
|
|
931
|
-
/**
|
|
932
|
-
* Replaces the selection with the given keys.
|
|
933
|
-
*/
|
|
934
|
-
setSelectedKeys(e) {
|
|
935
|
-
if (this.selectionMode === "none") return;
|
|
936
|
-
let t = new C();
|
|
937
|
-
for (let l of e) {
|
|
938
|
-
let i = this.getKey(l);
|
|
939
|
-
if (i != null && (t.add(i), this.selectionMode === "single"))
|
|
940
|
-
break;
|
|
941
|
-
}
|
|
942
|
-
this.state.setSelectedKeys(t);
|
|
943
|
-
}
|
|
944
|
-
getSelectAllKeys() {
|
|
945
|
-
let e = [], t = (l) => {
|
|
946
|
-
for (; l != null; ) {
|
|
947
|
-
if (this.canSelectItem(l)) {
|
|
948
|
-
var i;
|
|
949
|
-
let s = this.collection.getItem(l);
|
|
950
|
-
(s == null ? void 0 : s.type) === "item" && e.push(l);
|
|
951
|
-
var u;
|
|
952
|
-
s != null && s.hasChildNodes && (this.allowsCellSelection || s.type !== "item") && t((u = (i = Ye(qe(s, this.collection))) === null || i === void 0 ? void 0 : i.key) !== null && u !== void 0 ? u : null);
|
|
953
|
-
}
|
|
954
|
-
l = this.collection.getKeyAfter(l);
|
|
955
|
-
}
|
|
956
|
-
};
|
|
957
|
-
return t(this.collection.getFirstKey()), e;
|
|
958
|
-
}
|
|
959
|
-
/**
|
|
960
|
-
* Selects all items in the collection.
|
|
961
|
-
*/
|
|
962
|
-
selectAll() {
|
|
963
|
-
!this.isSelectAll && this.selectionMode === "multiple" && this.state.setSelectedKeys("all");
|
|
964
|
-
}
|
|
965
|
-
/**
|
|
966
|
-
* Removes all keys from the selection.
|
|
967
|
-
*/
|
|
968
|
-
clearSelection() {
|
|
969
|
-
!this.disallowEmptySelection && (this.state.selectedKeys === "all" || this.state.selectedKeys.size > 0) && this.state.setSelectedKeys(new C());
|
|
970
|
-
}
|
|
971
|
-
/**
|
|
972
|
-
* Toggles between select all and an empty selection.
|
|
973
|
-
*/
|
|
974
|
-
toggleSelectAll() {
|
|
975
|
-
this.isSelectAll ? this.clearSelection() : this.selectAll();
|
|
976
|
-
}
|
|
977
|
-
select(e, t) {
|
|
978
|
-
this.selectionMode !== "none" && (this.selectionMode === "single" ? this.isSelected(e) && !this.disallowEmptySelection ? this.toggleSelection(e) : this.replaceSelection(e) : this.selectionBehavior === "toggle" || t && (t.pointerType === "touch" || t.pointerType === "virtual") ? this.toggleSelection(e) : this.replaceSelection(e));
|
|
979
|
-
}
|
|
980
|
-
/**
|
|
981
|
-
* Returns whether the current selection is equal to the given selection.
|
|
982
|
-
*/
|
|
983
|
-
isSelectionEqual(e) {
|
|
984
|
-
if (e === this.state.selectedKeys) return !0;
|
|
985
|
-
let t = this.selectedKeys;
|
|
986
|
-
if (e.size !== t.size) return !1;
|
|
987
|
-
for (let l of e)
|
|
988
|
-
if (!t.has(l)) return !1;
|
|
989
|
-
for (let l of t)
|
|
990
|
-
if (!e.has(l)) return !1;
|
|
991
|
-
return !0;
|
|
992
|
-
}
|
|
993
|
-
canSelectItem(e) {
|
|
994
|
-
var t;
|
|
995
|
-
if (this.state.selectionMode === "none" || this.state.disabledKeys.has(e)) return !1;
|
|
996
|
-
let l = this.collection.getItem(e);
|
|
997
|
-
return !(!l || !(l == null || (t = l.props) === null || t === void 0) && t.isDisabled || l.type === "cell" && !this.allowsCellSelection);
|
|
998
|
-
}
|
|
999
|
-
isDisabled(e) {
|
|
1000
|
-
var t, l;
|
|
1001
|
-
return this.state.disabledBehavior === "all" && (this.state.disabledKeys.has(e) || !!(!((l = this.collection.getItem(e)) === null || l === void 0 || (t = l.props) === null || t === void 0) && t.isDisabled));
|
|
1002
|
-
}
|
|
1003
|
-
isLink(e) {
|
|
1004
|
-
var t, l;
|
|
1005
|
-
return !!(!((l = this.collection.getItem(e)) === null || l === void 0 || (t = l.props) === null || t === void 0) && t.href);
|
|
1006
|
-
}
|
|
1007
|
-
getItemProps(e) {
|
|
1008
|
-
var t;
|
|
1009
|
-
return (t = this.collection.getItem(e)) === null || t === void 0 ? void 0 : t.props;
|
|
1010
|
-
}
|
|
1011
|
-
constructor(e, t, l) {
|
|
1012
|
-
this.collection = e, this.state = t;
|
|
1013
|
-
var i;
|
|
1014
|
-
this.allowsCellSelection = (i = l == null ? void 0 : l.allowsCellSelection) !== null && i !== void 0 ? i : !1, this._isSelectAll = null, this.layoutDelegate = (l == null ? void 0 : l.layoutDelegate) || null;
|
|
1015
|
-
}
|
|
1016
|
-
}
|
|
1017
|
-
export {
|
|
1018
|
-
ot as $,
|
|
1019
|
-
st as a,
|
|
1020
|
-
ut as b,
|
|
1021
|
-
Ee as c,
|
|
1022
|
-
it as d,
|
|
1023
|
-
nt as e,
|
|
1024
|
-
qe as f,
|
|
1025
|
-
We as g,
|
|
1026
|
-
rt as h,
|
|
1027
|
-
ye as i,
|
|
1028
|
-
Xe as j,
|
|
1029
|
-
Ye as k,
|
|
1030
|
-
ze as l
|
|
1031
|
-
};
|