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