@easypost/easy-ui 1.0.0-alpha.4 → 1.0.0-alpha.6

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 (133) hide show
  1. package/Badge/index.js +32 -26
  2. package/Badge/index.mjs +32 -26
  3. package/Banner/index.js +15 -16
  4. package/Banner/index.mjs +15 -16
  5. package/Button/Button.d.ts +61 -0
  6. package/Button/Button.d.ts.map +1 -1
  7. package/Button/index.js +34 -69
  8. package/Button/index.mjs +33 -68
  9. package/CHANGELOG.md +21 -0
  10. package/Card/index.js +84 -5
  11. package/Card/index.mjs +84 -5
  12. package/Checkbox/index.js +84 -72
  13. package/Checkbox/index.mjs +84 -72
  14. package/CodeBlock/index.js +43 -49
  15. package/CodeBlock/index.mjs +43 -49
  16. package/DropdownButton/DropdownButton.d.ts +48 -0
  17. package/DropdownButton/DropdownButton.d.ts.map +1 -1
  18. package/DropdownButton/index.js +29 -101
  19. package/DropdownButton/index.mjs +29 -85
  20. package/HorizontalGrid/index.js +11 -31
  21. package/HorizontalGrid/index.mjs +11 -31
  22. package/HorizontalStack/index.js +48 -4
  23. package/HorizontalStack/index.mjs +48 -4
  24. package/Icon/Icon.d.ts +51 -0
  25. package/Icon/Icon.d.ts.map +1 -1
  26. package/Icon/index.js +38 -4
  27. package/Icon/index.mjs +38 -4
  28. package/IconButton/IconButton.d.ts +62 -0
  29. package/IconButton/IconButton.d.ts.map +1 -1
  30. package/IconButton/index.js +26 -43
  31. package/IconButton/index.mjs +25 -42
  32. package/InputField/Label.d.ts +2 -2
  33. package/InputField/index.js +282 -10
  34. package/InputField/index.mjs +266 -10
  35. package/InputField/utilities.d.ts +1 -1
  36. package/InputField/utilities.d.ts.map +1 -1
  37. package/Menu/MenuOverlay.d.ts.map +1 -1
  38. package/Menu/index.js +178 -1958
  39. package/Menu/index.mjs +168 -1948
  40. package/Menu/utilities.d.ts +11 -0
  41. package/Menu/utilities.d.ts.map +1 -0
  42. package/Notification/index.js +1534 -14
  43. package/Notification/index.mjs +1518 -14
  44. package/Provider/index.js +15 -15
  45. package/Provider/index.mjs +15 -15
  46. package/RadioGroup/index.js +63 -63
  47. package/RadioGroup/index.mjs +63 -63
  48. package/Select/Select.d.ts +88 -0
  49. package/Select/Select.d.ts.map +1 -0
  50. package/Select/Select.stories.d.ts +17 -0
  51. package/Select/Select.stories.d.ts.map +1 -0
  52. package/Select/Select.test.d.ts +2 -0
  53. package/Select/Select.test.d.ts.map +1 -0
  54. package/Select/SelectContext.d.ts +14 -0
  55. package/Select/SelectContext.d.ts.map +1 -0
  56. package/Select/SelectField.d.ts +62 -0
  57. package/Select/SelectField.d.ts.map +1 -0
  58. package/Select/SelectOption.d.ts +23 -0
  59. package/Select/SelectOption.d.ts.map +1 -0
  60. package/Select/SelectOverlay.d.ts +3 -0
  61. package/Select/SelectOverlay.d.ts.map +1 -0
  62. package/Select/SelectSection.d.ts +22 -0
  63. package/Select/SelectSection.d.ts.map +1 -0
  64. package/Select/SelectTrigger.d.ts +30 -0
  65. package/Select/SelectTrigger.d.ts.map +1 -0
  66. package/Select/index.d.ts +2 -0
  67. package/Select/index.d.ts.map +1 -0
  68. package/Select/index.js +816 -0
  69. package/Select/index.mjs +816 -0
  70. package/SelectorErrorTooltip/index.js +102 -11
  71. package/SelectorErrorTooltip/index.mjs +86 -11
  72. package/Text/index.js +85 -4
  73. package/Text/index.mjs +85 -4
  74. package/TextField/index.js +19 -38
  75. package/TextField/index.mjs +19 -38
  76. package/Textarea/index.js +20 -37
  77. package/Textarea/index.mjs +20 -37
  78. package/Theme/index.js +145 -9
  79. package/Theme/index.mjs +145 -9
  80. package/Toggle/index.js +51 -50
  81. package/Toggle/index.mjs +51 -50
  82. package/Tooltip/index.js +299 -10
  83. package/Tooltip/index.mjs +299 -10
  84. package/UnstyledButton/index.js +4 -4
  85. package/UnstyledButton/index.mjs +3 -3
  86. package/VerticalStack/index.js +13 -47
  87. package/VerticalStack/index.mjs +13 -47
  88. package/__chunks__/ExpandMore400-7c5263a4.mjs +49 -0
  89. package/__chunks__/ExpandMore400-92646971.js +65 -0
  90. package/__chunks__/InputIcon-2317befd.mjs +148 -0
  91. package/__chunks__/InputIcon-d3963cf8.js +147 -0
  92. package/__chunks__/{import-e7f45c7e.mjs → import-0561e1ba.mjs} +3 -3
  93. package/__chunks__/{import-b7971a11.mjs → import-19bc38ac.mjs} +72 -34
  94. package/__chunks__/{import-01299af6.js → import-24a482e1.js} +3 -2
  95. package/__chunks__/{import-baa3cd0c.mjs → import-29af6941.mjs} +4 -3
  96. package/__chunks__/{import-0d1b4d93.js → import-2b302763.js} +193 -141
  97. package/__chunks__/{import-ab878fb6.mjs → import-3d962a94.mjs} +205 -153
  98. package/__chunks__/{import-86330a7c.mjs → import-6a831ca1.mjs} +16 -15
  99. package/__chunks__/{import-7545401a.js → import-8b6c0bc7.js} +3 -3
  100. package/__chunks__/{import-63bf0645.js → import-a1e0f814.js} +47 -9
  101. package/__chunks__/{import-3ab42f86.js → import-a2023d8f.js} +35 -22
  102. package/__chunks__/{import-76076ca6.js → import-dea5a24d.js} +15 -14
  103. package/__chunks__/{import-856e0385.mjs → import-f1f4792a.mjs} +36 -23
  104. package/__chunks__/{UnstyledButton-883f0c6c.mjs → index-29d7bca9.mjs} +17 -42
  105. package/__chunks__/{UnstyledButton-96172ec0.js → index-3985350a.js} +17 -42
  106. package/__chunks__/{overlayscrollbars-react.es-c8369a03.mjs → overlayscrollbars-react.es-7f332a3b.mjs} +4 -4
  107. package/__chunks__/{overlayscrollbars-react.es-20563393.js → overlayscrollbars-react.es-f2a0bcff.js} +4 -4
  108. package/__chunks__/{real-module-e4cd2301.mjs → real-module-515df21d.mjs} +1 -1
  109. package/__chunks__/{real-module-ae2a4342.js → real-module-e36b1436.js} +1 -1
  110. package/__chunks__/useTriggerWidth-156b038a.js +2030 -0
  111. package/__chunks__/useTriggerWidth-addcd1d6.mjs +2031 -0
  112. package/package.json +11 -11
  113. package/style.css +1423 -1196
  114. package/utilities/css.js +14 -58
  115. package/utilities/css.mjs +14 -58
  116. package/__chunks__/Card-7bbd41e0.mjs +0 -110
  117. package/__chunks__/Card-dac53c75.js +0 -109
  118. package/__chunks__/HorizontalStack-a441c63f.mjs +0 -80
  119. package/__chunks__/HorizontalStack-a862839b.js +0 -79
  120. package/__chunks__/Icon-3d00481a.js +0 -44
  121. package/__chunks__/Icon-a75b5201.mjs +0 -45
  122. package/__chunks__/InputField-4fbaae06.js +0 -487
  123. package/__chunks__/InputField-a272f602.mjs +0 -472
  124. package/__chunks__/Notification-b8eafec6.mjs +0 -1456
  125. package/__chunks__/Notification-c5b34eb3.js +0 -1471
  126. package/__chunks__/SelectorErrorTooltip-43c5e29e.js +0 -84
  127. package/__chunks__/SelectorErrorTooltip-b6204987.mjs +0 -69
  128. package/__chunks__/Text-1ae70c19.js +0 -102
  129. package/__chunks__/Text-4ae50d5c.mjs +0 -103
  130. package/__chunks__/Theme-4e498252.mjs +0 -132
  131. package/__chunks__/Theme-751e5575.js +0 -131
  132. package/__chunks__/Tooltip-bd55165e.js +0 -317
  133. package/__chunks__/Tooltip-f7e67b21.mjs +0 -318
@@ -0,0 +1,2030 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
4
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
5
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
8
+ var __knownSymbol = (name, symbol) => {
9
+ if (symbol = Symbol[name])
10
+ return symbol;
11
+ throw Error("Symbol." + name + " is not defined");
12
+ };
13
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
14
+ var __spreadValues = (a, b) => {
15
+ for (var prop in b || (b = {}))
16
+ if (__hasOwnProp.call(b, prop))
17
+ __defNormalProp(a, prop, b[prop]);
18
+ if (__getOwnPropSymbols)
19
+ for (var prop of __getOwnPropSymbols(b)) {
20
+ if (__propIsEnum.call(b, prop))
21
+ __defNormalProp(a, prop, b[prop]);
22
+ }
23
+ return a;
24
+ };
25
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26
+ var __objRest = (source, exclude) => {
27
+ var target = {};
28
+ for (var prop in source)
29
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
30
+ target[prop] = source[prop];
31
+ if (source != null && __getOwnPropSymbols)
32
+ for (var prop of __getOwnPropSymbols(source)) {
33
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
34
+ target[prop] = source[prop];
35
+ }
36
+ return target;
37
+ };
38
+ var __await = function(promise, isYieldStar) {
39
+ this[0] = promise;
40
+ this[1] = isYieldStar;
41
+ };
42
+ var __yieldStar = (value) => {
43
+ var obj = value[__knownSymbol("asyncIterator")];
44
+ var isAwait = false;
45
+ var method;
46
+ var it = {};
47
+ if (obj == null) {
48
+ obj = value[__knownSymbol("iterator")]();
49
+ method = (k) => it[k] = (x) => obj[k](x);
50
+ } else {
51
+ obj = obj.call(value);
52
+ method = (k) => it[k] = (v) => {
53
+ if (isAwait) {
54
+ isAwait = false;
55
+ if (k === "throw")
56
+ throw v;
57
+ return v;
58
+ }
59
+ isAwait = true;
60
+ return {
61
+ done: false,
62
+ value: new __await(new Promise((resolve) => {
63
+ var x = obj[k](v);
64
+ if (!(x instanceof Object))
65
+ throw TypeError("Object expected");
66
+ resolve(x);
67
+ }), 1)
68
+ };
69
+ };
70
+ }
71
+ return it[__knownSymbol("iterator")] = () => it, method("next"), "throw" in obj ? method("throw") : it.throw = (x) => {
72
+ throw x;
73
+ }, "return" in obj && method("return"), it;
74
+ };
75
+ const _import = require("./import-a1e0f814.js");
76
+ const _import$1 = require("./import-2b302763.js");
77
+ const _import$2 = require("./import-a2023d8f.js");
78
+ const React = require("react");
79
+ const realModule = require("./real-module-e36b1436.js");
80
+ const _import$3 = require("./import-dea5a24d.js");
81
+ const utilities_css = require("../utilities/css.js");
82
+ function $feb5ffebff200149$export$d3e3bd3e26688c04(e) {
83
+ return _import.$c87311424ea30a05$export$e1865c3bedcd822b() ? e.altKey : e.ctrlKey;
84
+ }
85
+ function $feb5ffebff200149$export$16792effe837dba3(e) {
86
+ if (_import.$c87311424ea30a05$export$9ac100e40613ea10())
87
+ return e.metaKey;
88
+ return e.ctrlKey;
89
+ }
90
+ const $fb3050f43d946246$var$TYPEAHEAD_DEBOUNCE_WAIT_MS = 1e3;
91
+ function $fb3050f43d946246$export$e32c88dfddc6e1d8(options) {
92
+ let { keyboardDelegate, selectionManager, onTypeSelect } = options;
93
+ let state = React.useRef({
94
+ search: "",
95
+ timeout: null
96
+ }).current;
97
+ let onKeyDown = (e) => {
98
+ let character = $fb3050f43d946246$var$getStringForKey(e.key);
99
+ if (!character || e.ctrlKey || e.metaKey || !e.currentTarget.contains(e.target))
100
+ return;
101
+ if (character === " " && state.search.trim().length > 0) {
102
+ e.preventDefault();
103
+ if (!("continuePropagation" in e))
104
+ e.stopPropagation();
105
+ }
106
+ state.search += character;
107
+ let key = keyboardDelegate.getKeyForSearch(state.search, selectionManager.focusedKey);
108
+ if (key == null)
109
+ key = keyboardDelegate.getKeyForSearch(state.search);
110
+ if (key != null) {
111
+ selectionManager.setFocusedKey(key);
112
+ if (onTypeSelect)
113
+ onTypeSelect(key);
114
+ }
115
+ clearTimeout(state.timeout);
116
+ state.timeout = setTimeout(() => {
117
+ state.search = "";
118
+ }, $fb3050f43d946246$var$TYPEAHEAD_DEBOUNCE_WAIT_MS);
119
+ };
120
+ return {
121
+ typeSelectProps: {
122
+ // Using a capturing listener to catch the keydown event before
123
+ // other hooks in order to handle the Spacebar event.
124
+ onKeyDownCapture: keyboardDelegate.getKeyForSearch ? onKeyDown : null
125
+ }
126
+ };
127
+ }
128
+ function $fb3050f43d946246$var$getStringForKey(key) {
129
+ if (key.length === 1 || !/^[A-Z]/i.test(key))
130
+ return key;
131
+ return "";
132
+ }
133
+ function $ae20dd8cbca75726$export$d6daf82dcd84e87c(options) {
134
+ let { selectionManager: manager, keyboardDelegate: delegate, ref, autoFocus = false, shouldFocusWrap = false, disallowEmptySelection = false, disallowSelectAll = false, selectOnFocus = manager.selectionBehavior === "replace", disallowTypeAhead = false, shouldUseVirtualFocus, allowsTabNavigation = false, isVirtualized, scrollRef = ref } = options;
135
+ let { direction } = realModule.$18f2051aff69b9bf$export$43bb16f9c6d9e3f7();
136
+ let onKeyDown = (e) => {
137
+ if (e.altKey && e.key === "Tab")
138
+ e.preventDefault();
139
+ if (!ref.current.contains(e.target))
140
+ return;
141
+ const navigateToKey = (key, childFocus) => {
142
+ if (key != null) {
143
+ manager.setFocusedKey(key, childFocus);
144
+ if (e.shiftKey && manager.selectionMode === "multiple")
145
+ manager.extendSelection(key);
146
+ else if (selectOnFocus && !$feb5ffebff200149$export$d3e3bd3e26688c04(e))
147
+ manager.replaceSelection(key);
148
+ }
149
+ };
150
+ switch (e.key) {
151
+ case "ArrowDown":
152
+ if (delegate.getKeyBelow) {
153
+ var _delegate_getFirstKey, _delegate_getFirstKey1;
154
+ e.preventDefault();
155
+ let nextKey = manager.focusedKey != null ? delegate.getKeyBelow(manager.focusedKey) : (_delegate_getFirstKey = delegate.getFirstKey) === null || _delegate_getFirstKey === void 0 ? void 0 : _delegate_getFirstKey.call(delegate);
156
+ if (nextKey == null && shouldFocusWrap)
157
+ nextKey = (_delegate_getFirstKey1 = delegate.getFirstKey) === null || _delegate_getFirstKey1 === void 0 ? void 0 : _delegate_getFirstKey1.call(delegate, manager.focusedKey);
158
+ navigateToKey(nextKey);
159
+ }
160
+ break;
161
+ case "ArrowUp":
162
+ if (delegate.getKeyAbove) {
163
+ var _delegate_getLastKey, _delegate_getLastKey1;
164
+ e.preventDefault();
165
+ let nextKey = manager.focusedKey != null ? delegate.getKeyAbove(manager.focusedKey) : (_delegate_getLastKey = delegate.getLastKey) === null || _delegate_getLastKey === void 0 ? void 0 : _delegate_getLastKey.call(delegate);
166
+ if (nextKey == null && shouldFocusWrap)
167
+ nextKey = (_delegate_getLastKey1 = delegate.getLastKey) === null || _delegate_getLastKey1 === void 0 ? void 0 : _delegate_getLastKey1.call(delegate, manager.focusedKey);
168
+ navigateToKey(nextKey);
169
+ }
170
+ break;
171
+ case "ArrowLeft":
172
+ if (delegate.getKeyLeftOf) {
173
+ var _delegate_getFirstKey2, _delegate_getLastKey2;
174
+ e.preventDefault();
175
+ let nextKey = delegate.getKeyLeftOf(manager.focusedKey);
176
+ if (nextKey == null && shouldFocusWrap)
177
+ nextKey = direction === "rtl" ? (_delegate_getFirstKey2 = delegate.getFirstKey) === null || _delegate_getFirstKey2 === void 0 ? void 0 : _delegate_getFirstKey2.call(delegate, manager.focusedKey) : (_delegate_getLastKey2 = delegate.getLastKey) === null || _delegate_getLastKey2 === void 0 ? void 0 : _delegate_getLastKey2.call(delegate, manager.focusedKey);
178
+ navigateToKey(nextKey, direction === "rtl" ? "first" : "last");
179
+ }
180
+ break;
181
+ case "ArrowRight":
182
+ if (delegate.getKeyRightOf) {
183
+ var _delegate_getLastKey3, _delegate_getFirstKey3;
184
+ e.preventDefault();
185
+ let nextKey = delegate.getKeyRightOf(manager.focusedKey);
186
+ if (nextKey == null && shouldFocusWrap)
187
+ nextKey = direction === "rtl" ? (_delegate_getLastKey3 = delegate.getLastKey) === null || _delegate_getLastKey3 === void 0 ? void 0 : _delegate_getLastKey3.call(delegate, manager.focusedKey) : (_delegate_getFirstKey3 = delegate.getFirstKey) === null || _delegate_getFirstKey3 === void 0 ? void 0 : _delegate_getFirstKey3.call(delegate, manager.focusedKey);
188
+ navigateToKey(nextKey, direction === "rtl" ? "last" : "first");
189
+ }
190
+ break;
191
+ case "Home":
192
+ if (delegate.getFirstKey) {
193
+ e.preventDefault();
194
+ let firstKey = delegate.getFirstKey(manager.focusedKey, $feb5ffebff200149$export$16792effe837dba3(e));
195
+ manager.setFocusedKey(firstKey);
196
+ if ($feb5ffebff200149$export$16792effe837dba3(e) && e.shiftKey && manager.selectionMode === "multiple")
197
+ manager.extendSelection(firstKey);
198
+ else if (selectOnFocus)
199
+ manager.replaceSelection(firstKey);
200
+ }
201
+ break;
202
+ case "End":
203
+ if (delegate.getLastKey) {
204
+ e.preventDefault();
205
+ let lastKey = delegate.getLastKey(manager.focusedKey, $feb5ffebff200149$export$16792effe837dba3(e));
206
+ manager.setFocusedKey(lastKey);
207
+ if ($feb5ffebff200149$export$16792effe837dba3(e) && e.shiftKey && manager.selectionMode === "multiple")
208
+ manager.extendSelection(lastKey);
209
+ else if (selectOnFocus)
210
+ manager.replaceSelection(lastKey);
211
+ }
212
+ break;
213
+ case "PageDown":
214
+ if (delegate.getKeyPageBelow) {
215
+ e.preventDefault();
216
+ let nextKey = delegate.getKeyPageBelow(manager.focusedKey);
217
+ navigateToKey(nextKey);
218
+ }
219
+ break;
220
+ case "PageUp":
221
+ if (delegate.getKeyPageAbove) {
222
+ e.preventDefault();
223
+ let nextKey = delegate.getKeyPageAbove(manager.focusedKey);
224
+ navigateToKey(nextKey);
225
+ }
226
+ break;
227
+ case "a":
228
+ if ($feb5ffebff200149$export$16792effe837dba3(e) && manager.selectionMode === "multiple" && disallowSelectAll !== true) {
229
+ e.preventDefault();
230
+ manager.selectAll();
231
+ }
232
+ break;
233
+ case "Escape":
234
+ e.preventDefault();
235
+ if (!disallowEmptySelection)
236
+ manager.clearSelection();
237
+ break;
238
+ case "Tab":
239
+ if (!allowsTabNavigation) {
240
+ if (e.shiftKey)
241
+ ref.current.focus();
242
+ else {
243
+ let walker = _import$1.$9bf71ea28793e738$export$2d6ec8fc375ceafa(ref.current, {
244
+ tabbable: true
245
+ });
246
+ let next;
247
+ let last;
248
+ do {
249
+ last = walker.lastChild();
250
+ if (last)
251
+ next = last;
252
+ } while (last);
253
+ if (next && !next.contains(document.activeElement))
254
+ _import.$7215afc6de606d6b$export$de79e2c695e052f3(next);
255
+ }
256
+ break;
257
+ }
258
+ }
259
+ };
260
+ let scrollPos = React.useRef({
261
+ top: 0,
262
+ left: 0
263
+ });
264
+ _import.$e9faafb641e167db$export$90fc3a17d93f704c(scrollRef, "scroll", isVirtualized ? null : () => {
265
+ scrollPos.current = {
266
+ top: scrollRef.current.scrollTop,
267
+ left: scrollRef.current.scrollLeft
268
+ };
269
+ });
270
+ let onFocus = (e) => {
271
+ if (manager.isFocused) {
272
+ if (!e.currentTarget.contains(e.target))
273
+ manager.setFocused(false);
274
+ return;
275
+ }
276
+ if (!e.currentTarget.contains(e.target))
277
+ return;
278
+ manager.setFocused(true);
279
+ if (manager.focusedKey == null) {
280
+ let navigateToFirstKey = (key) => {
281
+ if (key != null) {
282
+ manager.setFocusedKey(key);
283
+ if (selectOnFocus)
284
+ manager.replaceSelection(key);
285
+ }
286
+ };
287
+ let relatedTarget = e.relatedTarget;
288
+ var _manager_lastSelectedKey, _manager_firstSelectedKey;
289
+ if (relatedTarget && e.currentTarget.compareDocumentPosition(relatedTarget) & Node.DOCUMENT_POSITION_FOLLOWING)
290
+ navigateToFirstKey((_manager_lastSelectedKey = manager.lastSelectedKey) !== null && _manager_lastSelectedKey !== void 0 ? _manager_lastSelectedKey : delegate.getLastKey());
291
+ else
292
+ navigateToFirstKey((_manager_firstSelectedKey = manager.firstSelectedKey) !== null && _manager_firstSelectedKey !== void 0 ? _manager_firstSelectedKey : delegate.getFirstKey());
293
+ } else if (!isVirtualized) {
294
+ scrollRef.current.scrollTop = scrollPos.current.top;
295
+ scrollRef.current.scrollLeft = scrollPos.current.left;
296
+ }
297
+ if (!isVirtualized && manager.focusedKey != null) {
298
+ let element = scrollRef.current.querySelector(`[data-key="${manager.focusedKey}"]`);
299
+ if (element) {
300
+ _import.$7215afc6de606d6b$export$de79e2c695e052f3(element);
301
+ let modality = _import$1.$507fabe10e71c6fb$export$630ff653c5ada6a9();
302
+ if (modality === "keyboard")
303
+ _import.$2f04cbc44ee30ce0$export$c826860796309d1b(element, {
304
+ containingElement: ref.current
305
+ });
306
+ }
307
+ }
308
+ };
309
+ let onBlur = (e) => {
310
+ if (!e.currentTarget.contains(e.relatedTarget))
311
+ manager.setFocused(false);
312
+ };
313
+ const autoFocusRef = React.useRef(autoFocus);
314
+ React.useEffect(() => {
315
+ if (autoFocusRef.current) {
316
+ let focusedKey = null;
317
+ if (autoFocus === "first")
318
+ focusedKey = delegate.getFirstKey();
319
+ if (autoFocus === "last")
320
+ focusedKey = delegate.getLastKey();
321
+ let selectedKeys = manager.selectedKeys;
322
+ if (selectedKeys.size)
323
+ focusedKey = selectedKeys.values().next().value;
324
+ manager.setFocused(true);
325
+ manager.setFocusedKey(focusedKey);
326
+ if (focusedKey == null && !shouldUseVirtualFocus)
327
+ _import$1.$6a99195332edec8b$export$80f3e147d781571c(ref.current);
328
+ }
329
+ autoFocusRef.current = false;
330
+ }, []);
331
+ let lastFocusedKey = React.useRef(manager.focusedKey);
332
+ React.useEffect(() => {
333
+ let modality = _import$1.$507fabe10e71c6fb$export$630ff653c5ada6a9();
334
+ if (manager.isFocused && manager.focusedKey != null && (scrollRef === null || scrollRef === void 0 ? void 0 : scrollRef.current)) {
335
+ let element = scrollRef.current.querySelector(`[data-key="${manager.focusedKey}"]`);
336
+ if (element && modality === "keyboard") {
337
+ if (!isVirtualized)
338
+ _import.$2f04cbc44ee30ce0$export$53a0910f038337bd(scrollRef.current, element);
339
+ _import.$2f04cbc44ee30ce0$export$c826860796309d1b(element, {
340
+ containingElement: ref.current
341
+ });
342
+ }
343
+ }
344
+ if (manager.isFocused && manager.focusedKey == null && lastFocusedKey.current != null)
345
+ _import$1.$6a99195332edec8b$export$80f3e147d781571c(ref.current);
346
+ lastFocusedKey.current = manager.focusedKey;
347
+ }, [
348
+ isVirtualized,
349
+ scrollRef,
350
+ manager.focusedKey,
351
+ manager.isFocused,
352
+ ref
353
+ ]);
354
+ let handlers = {
355
+ onKeyDown,
356
+ onFocus,
357
+ onBlur,
358
+ onMouseDown(e) {
359
+ if (scrollRef.current === e.target)
360
+ e.preventDefault();
361
+ }
362
+ };
363
+ let { typeSelectProps } = $fb3050f43d946246$export$e32c88dfddc6e1d8({
364
+ keyboardDelegate: delegate,
365
+ selectionManager: manager
366
+ });
367
+ if (!disallowTypeAhead)
368
+ handlers = _import.$3ef42575df84b30b$export$9d1611c77c2fe928(typeSelectProps, handlers);
369
+ let tabIndex;
370
+ if (!shouldUseVirtualFocus)
371
+ tabIndex = manager.focusedKey == null ? 0 : -1;
372
+ return {
373
+ collectionProps: __spreadProps(__spreadValues({}, handlers), {
374
+ tabIndex
375
+ })
376
+ };
377
+ }
378
+ function $880e95eb8b93ba9a$export$ecf600387e221c37(options) {
379
+ let { selectionManager: manager, key, ref, shouldSelectOnPressUp, shouldUseVirtualFocus, focus, isDisabled, onAction, allowsDifferentPressOrigin } = options;
380
+ let onSelect = (e) => {
381
+ if (e.pointerType === "keyboard" && $feb5ffebff200149$export$d3e3bd3e26688c04(e))
382
+ manager.toggleSelection(key);
383
+ else {
384
+ if (manager.selectionMode === "none")
385
+ return;
386
+ if (manager.selectionMode === "single") {
387
+ if (manager.isSelected(key) && !manager.disallowEmptySelection)
388
+ manager.toggleSelection(key);
389
+ else
390
+ manager.replaceSelection(key);
391
+ } else if (e && e.shiftKey)
392
+ manager.extendSelection(key);
393
+ else if (manager.selectionBehavior === "toggle" || e && ($feb5ffebff200149$export$16792effe837dba3(e) || e.pointerType === "touch" || e.pointerType === "virtual"))
394
+ manager.toggleSelection(key);
395
+ else
396
+ manager.replaceSelection(key);
397
+ }
398
+ };
399
+ React.useEffect(() => {
400
+ let isFocused = key === manager.focusedKey;
401
+ if (isFocused && manager.isFocused && !shouldUseVirtualFocus) {
402
+ if (focus)
403
+ focus();
404
+ else if (document.activeElement !== ref.current)
405
+ _import$1.$6a99195332edec8b$export$80f3e147d781571c(ref.current);
406
+ }
407
+ }, [
408
+ ref,
409
+ key,
410
+ manager.focusedKey,
411
+ manager.childFocusStrategy,
412
+ manager.isFocused,
413
+ shouldUseVirtualFocus
414
+ ]);
415
+ isDisabled = isDisabled || manager.isDisabled(key);
416
+ let itemProps = {};
417
+ if (!shouldUseVirtualFocus && !isDisabled)
418
+ itemProps = {
419
+ tabIndex: key === manager.focusedKey ? 0 : -1,
420
+ onFocus(e) {
421
+ if (e.target === ref.current)
422
+ manager.setFocusedKey(key);
423
+ }
424
+ };
425
+ else if (isDisabled)
426
+ itemProps.onMouseDown = (e) => {
427
+ e.preventDefault();
428
+ };
429
+ let allowsSelection = !isDisabled && manager.canSelectItem(key);
430
+ let allowsActions = onAction && !isDisabled;
431
+ let hasPrimaryAction = allowsActions && (manager.selectionBehavior === "replace" ? !allowsSelection : manager.isEmpty);
432
+ let hasSecondaryAction = allowsActions && allowsSelection && manager.selectionBehavior === "replace";
433
+ let hasAction = hasPrimaryAction || hasSecondaryAction;
434
+ let modality = React.useRef(null);
435
+ let longPressEnabled = hasAction && allowsSelection;
436
+ let longPressEnabledOnPressStart = React.useRef(false);
437
+ let hadPrimaryActionOnPressStart = React.useRef(false);
438
+ let itemPressProps = {};
439
+ if (shouldSelectOnPressUp) {
440
+ itemPressProps.onPressStart = (e) => {
441
+ modality.current = e.pointerType;
442
+ longPressEnabledOnPressStart.current = longPressEnabled;
443
+ if (e.pointerType === "keyboard" && (!hasAction || $880e95eb8b93ba9a$var$isSelectionKey()))
444
+ onSelect(e);
445
+ };
446
+ if (!allowsDifferentPressOrigin)
447
+ itemPressProps.onPress = (e) => {
448
+ if (hasPrimaryAction || hasSecondaryAction && e.pointerType !== "mouse") {
449
+ if (e.pointerType === "keyboard" && !$880e95eb8b93ba9a$var$isActionKey())
450
+ return;
451
+ onAction();
452
+ } else if (e.pointerType !== "keyboard")
453
+ onSelect(e);
454
+ };
455
+ else {
456
+ itemPressProps.onPressUp = (e) => {
457
+ if (e.pointerType !== "keyboard")
458
+ onSelect(e);
459
+ };
460
+ itemPressProps.onPress = hasPrimaryAction ? () => onAction() : null;
461
+ }
462
+ } else {
463
+ itemPressProps.onPressStart = (e) => {
464
+ modality.current = e.pointerType;
465
+ longPressEnabledOnPressStart.current = longPressEnabled;
466
+ hadPrimaryActionOnPressStart.current = hasPrimaryAction;
467
+ if (e.pointerType === "mouse" && !hasPrimaryAction || e.pointerType === "keyboard" && (!onAction || $880e95eb8b93ba9a$var$isSelectionKey()))
468
+ onSelect(e);
469
+ };
470
+ itemPressProps.onPress = (e) => {
471
+ if (e.pointerType === "touch" || e.pointerType === "pen" || e.pointerType === "virtual" || e.pointerType === "keyboard" && hasAction && $880e95eb8b93ba9a$var$isActionKey() || e.pointerType === "mouse" && hadPrimaryActionOnPressStart.current) {
472
+ if (hasAction)
473
+ onAction();
474
+ else
475
+ onSelect(e);
476
+ }
477
+ };
478
+ }
479
+ itemProps["data-key"] = key;
480
+ itemPressProps.preventFocusOnPress = shouldUseVirtualFocus;
481
+ let { pressProps, isPressed } = _import$1.$f6c31cce2adf654f$export$45712eceda6fad21(itemPressProps);
482
+ let onDoubleClick = hasSecondaryAction ? (e) => {
483
+ if (modality.current === "mouse") {
484
+ e.stopPropagation();
485
+ e.preventDefault();
486
+ onAction();
487
+ }
488
+ } : void 0;
489
+ let { longPressProps } = _import$1.$8a26561d2877236e$export$c24ed0104d07eab9({
490
+ isDisabled: !longPressEnabled,
491
+ onLongPress(e) {
492
+ if (e.pointerType === "touch") {
493
+ onSelect(e);
494
+ manager.setSelectionBehavior("toggle");
495
+ }
496
+ }
497
+ });
498
+ let onDragStartCapture = (e) => {
499
+ if (modality.current === "touch" && longPressEnabledOnPressStart.current)
500
+ e.preventDefault();
501
+ };
502
+ return {
503
+ itemProps: _import.$3ef42575df84b30b$export$9d1611c77c2fe928(itemProps, allowsSelection || hasPrimaryAction ? pressProps : {}, longPressEnabled ? longPressProps : {}, {
504
+ onDoubleClick,
505
+ onDragStartCapture
506
+ }),
507
+ isPressed,
508
+ isSelected: manager.isSelected(key),
509
+ isFocused: manager.isFocused && manager.focusedKey === key,
510
+ isDisabled,
511
+ allowsSelection,
512
+ hasAction
513
+ };
514
+ }
515
+ function $880e95eb8b93ba9a$var$isActionKey() {
516
+ let event = window.event;
517
+ return (event === null || event === void 0 ? void 0 : event.key) === "Enter";
518
+ }
519
+ function $880e95eb8b93ba9a$var$isSelectionKey() {
520
+ let event = window.event;
521
+ return (event === null || event === void 0 ? void 0 : event.key) === " " || (event === null || event === void 0 ? void 0 : event.code) === "Space";
522
+ }
523
+ class $2a25aae57d74318e$export$a05409b8bb224a5a {
524
+ getNextKey(key) {
525
+ key = this.collection.getKeyAfter(key);
526
+ while (key != null) {
527
+ let item = this.collection.getItem(key);
528
+ if (item.type === "item" && !this.disabledKeys.has(key))
529
+ return key;
530
+ key = this.collection.getKeyAfter(key);
531
+ }
532
+ return null;
533
+ }
534
+ getPreviousKey(key) {
535
+ key = this.collection.getKeyBefore(key);
536
+ while (key != null) {
537
+ let item = this.collection.getItem(key);
538
+ if (item.type === "item" && !this.disabledKeys.has(key))
539
+ return key;
540
+ key = this.collection.getKeyBefore(key);
541
+ }
542
+ return null;
543
+ }
544
+ findKey(key, nextKey, shouldSkip) {
545
+ let item = this.getItem(key);
546
+ if (!item)
547
+ return null;
548
+ let prevRect = item.getBoundingClientRect();
549
+ do {
550
+ key = nextKey(key);
551
+ item = this.getItem(key);
552
+ } while (item && shouldSkip(prevRect, item.getBoundingClientRect()));
553
+ return key;
554
+ }
555
+ isSameRow(prevRect, itemRect) {
556
+ return prevRect.top === itemRect.top || prevRect.left !== itemRect.left;
557
+ }
558
+ isSameColumn(prevRect, itemRect) {
559
+ return prevRect.left === itemRect.left || prevRect.top !== itemRect.top;
560
+ }
561
+ getKeyBelow(key) {
562
+ if (this.layout === "grid" && this.orientation === "vertical")
563
+ return this.findKey(key, (key2) => this.getNextKey(key2), this.isSameRow);
564
+ else
565
+ return this.getNextKey(key);
566
+ }
567
+ getKeyAbove(key) {
568
+ if (this.layout === "grid" && this.orientation === "vertical")
569
+ return this.findKey(key, (key2) => this.getPreviousKey(key2), this.isSameRow);
570
+ else
571
+ return this.getPreviousKey(key);
572
+ }
573
+ getNextColumn(key, right) {
574
+ return right ? this.getPreviousKey(key) : this.getNextKey(key);
575
+ }
576
+ getKeyRightOf(key) {
577
+ if (this.layout === "grid") {
578
+ if (this.orientation === "vertical")
579
+ return this.getNextColumn(key, this.direction === "rtl");
580
+ else
581
+ return this.findKey(key, (key2) => this.getNextColumn(key2, this.direction === "rtl"), this.isSameColumn);
582
+ } else if (this.orientation === "horizontal")
583
+ return this.getNextColumn(key, this.direction === "rtl");
584
+ return null;
585
+ }
586
+ getKeyLeftOf(key) {
587
+ if (this.layout === "grid") {
588
+ if (this.orientation === "vertical")
589
+ return this.getNextColumn(key, this.direction === "ltr");
590
+ else
591
+ return this.findKey(key, (key2) => this.getNextColumn(key2, this.direction === "ltr"), this.isSameColumn);
592
+ } else if (this.orientation === "horizontal")
593
+ return this.getNextColumn(key, this.direction === "ltr");
594
+ return null;
595
+ }
596
+ getFirstKey() {
597
+ let key = this.collection.getFirstKey();
598
+ while (key != null) {
599
+ let item = this.collection.getItem(key);
600
+ if (item.type === "item" && !this.disabledKeys.has(key))
601
+ return key;
602
+ key = this.collection.getKeyAfter(key);
603
+ }
604
+ return null;
605
+ }
606
+ getLastKey() {
607
+ let key = this.collection.getLastKey();
608
+ while (key != null) {
609
+ let item = this.collection.getItem(key);
610
+ if (item.type === "item" && !this.disabledKeys.has(key))
611
+ return key;
612
+ key = this.collection.getKeyBefore(key);
613
+ }
614
+ return null;
615
+ }
616
+ getItem(key) {
617
+ return this.ref.current.querySelector(`[data-key="${key}"]`);
618
+ }
619
+ getKeyPageAbove(key) {
620
+ let menu = this.ref.current;
621
+ let item = this.getItem(key);
622
+ if (!item)
623
+ return null;
624
+ if (!_import.$62d8ded9296f3872$export$2bb74740c4e19def(menu))
625
+ return this.getFirstKey();
626
+ let containerRect = menu.getBoundingClientRect();
627
+ let itemRect = item.getBoundingClientRect();
628
+ if (this.orientation === "horizontal") {
629
+ let containerX = containerRect.x - menu.scrollLeft;
630
+ let pageX = Math.max(0, itemRect.x - containerX + itemRect.width - containerRect.width);
631
+ while (item && itemRect.x - containerX > pageX) {
632
+ key = this.getKeyAbove(key);
633
+ item = key == null ? null : this.getItem(key);
634
+ itemRect = item === null || item === void 0 ? void 0 : item.getBoundingClientRect();
635
+ }
636
+ } else {
637
+ let containerY = containerRect.y - menu.scrollTop;
638
+ let pageY = Math.max(0, itemRect.y - containerY + itemRect.height - containerRect.height);
639
+ while (item && itemRect.y - containerY > pageY) {
640
+ key = this.getKeyAbove(key);
641
+ item = key == null ? null : this.getItem(key);
642
+ itemRect = item === null || item === void 0 ? void 0 : item.getBoundingClientRect();
643
+ }
644
+ }
645
+ return key !== null && key !== void 0 ? key : this.getFirstKey();
646
+ }
647
+ getKeyPageBelow(key) {
648
+ let menu = this.ref.current;
649
+ let item = this.getItem(key);
650
+ if (!item)
651
+ return null;
652
+ if (!_import.$62d8ded9296f3872$export$2bb74740c4e19def(menu))
653
+ return this.getLastKey();
654
+ let containerRect = menu.getBoundingClientRect();
655
+ let itemRect = item.getBoundingClientRect();
656
+ if (this.orientation === "horizontal") {
657
+ let containerX = containerRect.x - menu.scrollLeft;
658
+ let pageX = Math.min(menu.scrollWidth, itemRect.x - containerX - itemRect.width + containerRect.width);
659
+ while (item && itemRect.x - containerX < pageX) {
660
+ key = this.getKeyBelow(key);
661
+ item = key == null ? null : this.getItem(key);
662
+ itemRect = item === null || item === void 0 ? void 0 : item.getBoundingClientRect();
663
+ }
664
+ } else {
665
+ let containerY = containerRect.y - menu.scrollTop;
666
+ let pageY = Math.min(menu.scrollHeight, itemRect.y - containerY - itemRect.height + containerRect.height);
667
+ while (item && itemRect.y - containerY < pageY) {
668
+ key = this.getKeyBelow(key);
669
+ item = key == null ? null : this.getItem(key);
670
+ itemRect = item === null || item === void 0 ? void 0 : item.getBoundingClientRect();
671
+ }
672
+ }
673
+ return key !== null && key !== void 0 ? key : this.getLastKey();
674
+ }
675
+ getKeyForSearch(search, fromKey) {
676
+ if (!this.collator)
677
+ return null;
678
+ let collection = this.collection;
679
+ let key = fromKey || this.getFirstKey();
680
+ while (key != null) {
681
+ let item = collection.getItem(key);
682
+ let substring = item.textValue.slice(0, search.length);
683
+ if (item.textValue && this.collator.compare(substring, search) === 0)
684
+ return key;
685
+ key = this.getKeyBelow(key);
686
+ }
687
+ return null;
688
+ }
689
+ constructor(...args) {
690
+ if (args.length === 1) {
691
+ let opts = args[0];
692
+ this.collection = opts.collection;
693
+ this.ref = opts.ref;
694
+ this.disabledKeys = opts.disabledKeys || /* @__PURE__ */ new Set();
695
+ this.orientation = opts.orientation;
696
+ this.direction = opts.direction;
697
+ this.layout = opts.layout || "stack";
698
+ } else {
699
+ this.collection = args[0];
700
+ this.disabledKeys = args[1];
701
+ this.ref = args[2];
702
+ this.collator = args[3];
703
+ this.layout = "stack";
704
+ this.orientation = "vertical";
705
+ }
706
+ if (this.layout === "stack" && this.orientation === "vertical") {
707
+ this.getKeyLeftOf = void 0;
708
+ this.getKeyRightOf = void 0;
709
+ }
710
+ }
711
+ }
712
+ function $982254629710d113$export$b95089534ab7c1fd(props) {
713
+ let { selectionManager, collection, disabledKeys, ref, keyboardDelegate, autoFocus, shouldFocusWrap, isVirtualized, disallowEmptySelection, selectOnFocus = selectionManager.selectionBehavior === "replace", disallowTypeAhead, shouldUseVirtualFocus, allowsTabNavigation } = props;
714
+ let collator = realModule.$325a3faab7a68acd$export$a16aca283550c30d({
715
+ usage: "search",
716
+ sensitivity: "base"
717
+ });
718
+ let disabledBehavior = selectionManager.disabledBehavior;
719
+ let delegate = React.useMemo(() => keyboardDelegate || new $2a25aae57d74318e$export$a05409b8bb224a5a(collection, disabledBehavior === "selection" ? /* @__PURE__ */ new Set() : disabledKeys, ref, collator), [
720
+ keyboardDelegate,
721
+ collection,
722
+ disabledKeys,
723
+ ref,
724
+ collator,
725
+ disabledBehavior
726
+ ]);
727
+ let { collectionProps } = $ae20dd8cbca75726$export$d6daf82dcd84e87c({
728
+ ref,
729
+ selectionManager,
730
+ keyboardDelegate: delegate,
731
+ autoFocus,
732
+ shouldFocusWrap,
733
+ disallowEmptySelection,
734
+ selectOnFocus,
735
+ disallowTypeAhead,
736
+ shouldUseVirtualFocus,
737
+ allowsTabNavigation,
738
+ isVirtualized,
739
+ scrollRef: ref
740
+ });
741
+ return {
742
+ listProps: collectionProps
743
+ };
744
+ }
745
+ function $c1d7fb2ec91bae71$var$Item(props) {
746
+ return null;
747
+ }
748
+ $c1d7fb2ec91bae71$var$Item.getCollectionNode = function* getCollectionNode(props, context) {
749
+ let { childItems, title, children } = props;
750
+ let rendered = props.title || props.children;
751
+ let textValue = props.textValue || (typeof rendered === "string" ? rendered : "") || props["aria-label"] || "";
752
+ if (!textValue && !(context === null || context === void 0 ? void 0 : context.suppressTextValueWarning))
753
+ console.warn("<Item> with non-plain text contents is unsupported by type to select for accessibility. Please add a `textValue` prop.");
754
+ yield {
755
+ type: "item",
756
+ props,
757
+ rendered,
758
+ textValue,
759
+ "aria-label": props["aria-label"],
760
+ hasChildNodes: $c1d7fb2ec91bae71$var$hasChildItems(props),
761
+ *childNodes() {
762
+ if (childItems)
763
+ for (let child of childItems)
764
+ yield {
765
+ type: "item",
766
+ value: child
767
+ };
768
+ else if (title) {
769
+ let items = [];
770
+ React.Children.forEach(children, (child) => {
771
+ items.push({
772
+ type: "item",
773
+ element: child
774
+ });
775
+ });
776
+ yield* __yieldStar(items);
777
+ }
778
+ }
779
+ };
780
+ };
781
+ function $c1d7fb2ec91bae71$var$hasChildItems(props) {
782
+ if (props.hasChildItems != null)
783
+ return props.hasChildItems;
784
+ if (props.childItems)
785
+ return true;
786
+ if (props.title && React.Children.count(props.children) > 0)
787
+ return true;
788
+ return false;
789
+ }
790
+ let $c1d7fb2ec91bae71$export$6d08773d2e66f8f2 = $c1d7fb2ec91bae71$var$Item;
791
+ function $9fc4852771d079eb$var$Section(props) {
792
+ return null;
793
+ }
794
+ $9fc4852771d079eb$var$Section.getCollectionNode = function* getCollectionNode2(props) {
795
+ let { children, title, items } = props;
796
+ yield {
797
+ type: "section",
798
+ props,
799
+ hasChildNodes: true,
800
+ rendered: title,
801
+ "aria-label": props["aria-label"],
802
+ *childNodes() {
803
+ if (typeof children === "function") {
804
+ if (!items)
805
+ throw new Error("props.children was a function but props.items is missing");
806
+ for (let item of items)
807
+ yield {
808
+ type: "item",
809
+ value: item,
810
+ renderer: children
811
+ };
812
+ } else {
813
+ let items2 = [];
814
+ React.Children.forEach(children, (child) => {
815
+ items2.push({
816
+ type: "item",
817
+ element: child
818
+ });
819
+ });
820
+ yield* __yieldStar(items2);
821
+ }
822
+ }
823
+ };
824
+ };
825
+ let $9fc4852771d079eb$export$6e2c8f0811a474ce = $9fc4852771d079eb$var$Section;
826
+ class $eb2240fc39a57fa5$export$bf788dd355e3a401 {
827
+ build(props, context) {
828
+ this.context = context;
829
+ return $eb2240fc39a57fa5$var$iterable(() => this.iterateCollection(props));
830
+ }
831
+ *iterateCollection(props) {
832
+ let { children, items } = props;
833
+ if (typeof children === "function") {
834
+ if (!items)
835
+ throw new Error("props.children was a function but props.items is missing");
836
+ for (let item of props.items)
837
+ yield* __yieldStar(this.getFullNode({
838
+ value: item
839
+ }, {
840
+ renderer: children
841
+ }));
842
+ } else {
843
+ let items2 = [];
844
+ React.Children.forEach(children, (child) => {
845
+ items2.push(child);
846
+ });
847
+ let index = 0;
848
+ for (let item of items2) {
849
+ let nodes = this.getFullNode({
850
+ element: item,
851
+ index
852
+ }, {});
853
+ for (let node of nodes) {
854
+ index++;
855
+ yield node;
856
+ }
857
+ }
858
+ }
859
+ }
860
+ getKey(item, partialNode, state, parentKey) {
861
+ if (item.key != null)
862
+ return item.key;
863
+ if (partialNode.type === "cell" && partialNode.key != null)
864
+ return `${parentKey}${partialNode.key}`;
865
+ let v = partialNode.value;
866
+ if (v != null) {
867
+ var _v_key;
868
+ let key = (_v_key = v.key) !== null && _v_key !== void 0 ? _v_key : v.id;
869
+ if (key == null)
870
+ throw new Error("No key found for item");
871
+ return key;
872
+ }
873
+ return parentKey ? `${parentKey}.${partialNode.index}` : `$.${partialNode.index}`;
874
+ }
875
+ getChildState(state, partialNode) {
876
+ return {
877
+ renderer: partialNode.renderer || state.renderer
878
+ };
879
+ }
880
+ *getFullNode(partialNode, state, parentKey, parentNode) {
881
+ let element = partialNode.element;
882
+ if (!element && partialNode.value && state && state.renderer) {
883
+ let cached = this.cache.get(partialNode.value);
884
+ if (cached && (!cached.shouldInvalidate || !cached.shouldInvalidate(this.context))) {
885
+ cached.index = partialNode.index;
886
+ cached.parentKey = parentNode ? parentNode.key : null;
887
+ yield cached;
888
+ return;
889
+ }
890
+ element = state.renderer(partialNode.value);
891
+ }
892
+ if (React.isValidElement(element)) {
893
+ let type = element.type;
894
+ if (typeof type !== "function" && typeof type.getCollectionNode !== "function") {
895
+ let name = typeof element.type === "function" ? element.type.name : element.type;
896
+ throw new Error(`Unknown element <${name}> in collection.`);
897
+ }
898
+ let childNodes = type.getCollectionNode(element.props, this.context);
899
+ let index = partialNode.index;
900
+ let result = childNodes.next();
901
+ while (!result.done && result.value) {
902
+ let childNode = result.value;
903
+ partialNode.index = index;
904
+ let nodeKey = childNode.key;
905
+ if (!nodeKey)
906
+ nodeKey = childNode.element ? null : this.getKey(element, partialNode, state, parentKey);
907
+ let nodes = this.getFullNode(__spreadProps(__spreadValues({}, childNode), {
908
+ key: nodeKey,
909
+ index,
910
+ wrapper: $eb2240fc39a57fa5$var$compose(partialNode.wrapper, childNode.wrapper)
911
+ }), this.getChildState(state, childNode), parentKey ? `${parentKey}${element.key}` : element.key, parentNode);
912
+ let children = [
913
+ ...nodes
914
+ ];
915
+ for (let node2 of children) {
916
+ node2.value = childNode.value || partialNode.value;
917
+ if (node2.value)
918
+ this.cache.set(node2.value, node2);
919
+ if (partialNode.type && node2.type !== partialNode.type)
920
+ throw new Error(`Unsupported type <${$eb2240fc39a57fa5$var$capitalize(node2.type)}> in <${$eb2240fc39a57fa5$var$capitalize(parentNode.type)}>. Only <${$eb2240fc39a57fa5$var$capitalize(partialNode.type)}> is supported.`);
921
+ index++;
922
+ yield node2;
923
+ }
924
+ result = childNodes.next(children);
925
+ }
926
+ return;
927
+ }
928
+ if (partialNode.key == null)
929
+ return;
930
+ let builder = this;
931
+ let node = {
932
+ type: partialNode.type,
933
+ props: partialNode.props,
934
+ key: partialNode.key,
935
+ parentKey: parentNode ? parentNode.key : null,
936
+ value: partialNode.value,
937
+ level: parentNode ? parentNode.level + 1 : 0,
938
+ index: partialNode.index,
939
+ rendered: partialNode.rendered,
940
+ textValue: partialNode.textValue,
941
+ "aria-label": partialNode["aria-label"],
942
+ wrapper: partialNode.wrapper,
943
+ shouldInvalidate: partialNode.shouldInvalidate,
944
+ hasChildNodes: partialNode.hasChildNodes,
945
+ childNodes: $eb2240fc39a57fa5$var$iterable(function* () {
946
+ if (!partialNode.hasChildNodes)
947
+ return;
948
+ let index = 0;
949
+ for (let child of partialNode.childNodes()) {
950
+ if (child.key != null)
951
+ child.key = `${node.key}${child.key}`;
952
+ child.index = index;
953
+ let nodes = builder.getFullNode(child, builder.getChildState(state, child), node.key, node);
954
+ for (let node2 of nodes) {
955
+ index++;
956
+ yield node2;
957
+ }
958
+ }
959
+ })
960
+ };
961
+ yield node;
962
+ }
963
+ constructor() {
964
+ this.cache = /* @__PURE__ */ new WeakMap();
965
+ }
966
+ }
967
+ function $eb2240fc39a57fa5$var$iterable(iterator) {
968
+ let cache = [];
969
+ let iterable = null;
970
+ return {
971
+ *[Symbol.iterator]() {
972
+ for (let item of cache)
973
+ yield item;
974
+ if (!iterable)
975
+ iterable = iterator();
976
+ for (let item of iterable) {
977
+ cache.push(item);
978
+ yield item;
979
+ }
980
+ }
981
+ };
982
+ }
983
+ function $eb2240fc39a57fa5$var$compose(outer, inner) {
984
+ if (outer && inner)
985
+ return (element) => outer(inner(element));
986
+ if (outer)
987
+ return outer;
988
+ if (inner)
989
+ return inner;
990
+ }
991
+ function $eb2240fc39a57fa5$var$capitalize(str) {
992
+ return str[0].toUpperCase() + str.slice(1);
993
+ }
994
+ function $7613b1592d41b092$export$6cd28814d92fa9c9(props, factory, context) {
995
+ let builder = React.useMemo(() => new $eb2240fc39a57fa5$export$bf788dd355e3a401(), []);
996
+ let { children, items, collection } = props;
997
+ let result = React.useMemo(() => {
998
+ if (collection)
999
+ return collection;
1000
+ let nodes = builder.build({
1001
+ children,
1002
+ items
1003
+ }, context);
1004
+ return factory(nodes);
1005
+ }, [
1006
+ builder,
1007
+ children,
1008
+ items,
1009
+ collection,
1010
+ context,
1011
+ factory
1012
+ ]);
1013
+ return result;
1014
+ }
1015
+ function $c5a24bc478652b5f$export$1005530eda016c13(node, collection) {
1016
+ if (typeof collection.getChildren === "function")
1017
+ return collection.getChildren(node.key);
1018
+ return node.childNodes;
1019
+ }
1020
+ function $c5a24bc478652b5f$export$fbdeaa6a76694f71(iterable) {
1021
+ return $c5a24bc478652b5f$export$5f3398f8733f90e2(iterable, 0);
1022
+ }
1023
+ function $c5a24bc478652b5f$export$5f3398f8733f90e2(iterable, index) {
1024
+ if (index < 0)
1025
+ return void 0;
1026
+ let i = 0;
1027
+ for (let item of iterable) {
1028
+ if (i === index)
1029
+ return item;
1030
+ i++;
1031
+ }
1032
+ }
1033
+ function $c5a24bc478652b5f$export$8c434b3a7a4dad6(collection, a, b) {
1034
+ if (a.parentKey === b.parentKey)
1035
+ return a.index - b.index;
1036
+ let aAncestors = $c5a24bc478652b5f$var$getAncestors(collection, a);
1037
+ let bAncestors = $c5a24bc478652b5f$var$getAncestors(collection, b);
1038
+ let firstNonMatchingAncestor = aAncestors.slice(0, bAncestors.length).findIndex((a2, i) => a2 !== bAncestors[i]);
1039
+ if (firstNonMatchingAncestor !== -1) {
1040
+ a = aAncestors[firstNonMatchingAncestor];
1041
+ b = bAncestors[firstNonMatchingAncestor];
1042
+ return a.index - b.index;
1043
+ }
1044
+ return -1;
1045
+ }
1046
+ function $c5a24bc478652b5f$var$getAncestors(collection, node) {
1047
+ let parents = [];
1048
+ while ((node === null || node === void 0 ? void 0 : node.parentKey) != null) {
1049
+ node = collection.getItem(node.parentKey);
1050
+ parents.unshift(node);
1051
+ }
1052
+ return parents;
1053
+ }
1054
+ const $453cc9f0df89c0a5$var$cache = /* @__PURE__ */ new WeakMap();
1055
+ function $453cc9f0df89c0a5$export$77d5aafae4e095b2(collection) {
1056
+ let count = $453cc9f0df89c0a5$var$cache.get(collection);
1057
+ if (count != null)
1058
+ return count;
1059
+ count = 0;
1060
+ let countItems = (items) => {
1061
+ for (let item of items)
1062
+ if (item.type === "section")
1063
+ countItems($c5a24bc478652b5f$export$1005530eda016c13(item, collection));
1064
+ else
1065
+ count++;
1066
+ };
1067
+ countItems(collection);
1068
+ $453cc9f0df89c0a5$var$cache.set(collection, count);
1069
+ return count;
1070
+ }
1071
+ function $parcel$interopDefault(a) {
1072
+ return a && a.__esModule ? a.default : a;
1073
+ }
1074
+ var $2cbb7ca666678a14$exports = {};
1075
+ var $c0398ad35c3639b7$exports = {};
1076
+ $c0398ad35c3639b7$exports = {
1077
+ "longPressMessage": `اضغط مطولاً أو اضغط على Alt + السهم لأسفل لفتح القائمة`
1078
+ };
1079
+ var $7af657c4165927c3$exports = {};
1080
+ $7af657c4165927c3$exports = {
1081
+ "longPressMessage": `Натиснете продължително или натиснете Alt+ стрелка надолу, за да отворите менюто`
1082
+ };
1083
+ var $d95d4da6d531ab81$exports = {};
1084
+ $d95d4da6d531ab81$exports = {
1085
+ "longPressMessage": `Dlouhým stiskem nebo stisknutím kláves Alt + šipka dolů otevřete nabídku`
1086
+ };
1087
+ var $24ebda9c775dca17$exports = {};
1088
+ $24ebda9c775dca17$exports = {
1089
+ "longPressMessage": `Langt tryk eller tryk på Alt + pil ned for at åbne menuen`
1090
+ };
1091
+ var $743e0dfca6cab1e9$exports = {};
1092
+ $743e0dfca6cab1e9$exports = {
1093
+ "longPressMessage": `Drücken Sie lange oder drücken Sie Alt + Nach-unten, um das Menü zu öffnen`
1094
+ };
1095
+ var $a2f41026e05f1c84$exports = {};
1096
+ $a2f41026e05f1c84$exports = {
1097
+ "longPressMessage": `Πιέστε παρατεταμένα ή πατήστε Alt + κάτω βέλος για να ανοίξετε το μενού`
1098
+ };
1099
+ var $43b800e97c901737$exports = {};
1100
+ $43b800e97c901737$exports = {
1101
+ "longPressMessage": `Long press or press Alt + ArrowDown to open menu`
1102
+ };
1103
+ var $442f5f6ac211e29f$exports = {};
1104
+ $442f5f6ac211e29f$exports = {
1105
+ "longPressMessage": `Mantenga pulsado o pulse Alt + flecha abajo para abrir el menú`
1106
+ };
1107
+ var $dff280acfeb2d8ac$exports = {};
1108
+ $dff280acfeb2d8ac$exports = {
1109
+ "longPressMessage": `Menüü avamiseks vajutage pikalt või vajutage klahve Alt + allanool`
1110
+ };
1111
+ var $51608325613944d7$exports = {};
1112
+ $51608325613944d7$exports = {
1113
+ "longPressMessage": `Avaa valikko painamalla pohjassa tai näppäinyhdistelmällä Alt + Alanuoli`
1114
+ };
1115
+ var $c4a1b1eabeaa87be$exports = {};
1116
+ $c4a1b1eabeaa87be$exports = {
1117
+ "longPressMessage": `Appuyez de manière prolongée ou appuyez sur Alt + Flèche vers le bas pour ouvrir le menu.`
1118
+ };
1119
+ var $8c74815cdee18d1b$exports = {};
1120
+ $8c74815cdee18d1b$exports = {
1121
+ "longPressMessage": `לחץ לחיצה ארוכה או הקש Alt + ArrowDown כדי לפתוח את התפריט`
1122
+ };
1123
+ var $fd0e9ef6a7fe0ec9$exports = {};
1124
+ $fd0e9ef6a7fe0ec9$exports = {
1125
+ "longPressMessage": `Dugo pritisnite ili pritisnite Alt + strelicu prema dolje za otvaranje izbornika`
1126
+ };
1127
+ var $a89a74a39eba465a$exports = {};
1128
+ $a89a74a39eba465a$exports = {
1129
+ "longPressMessage": `Nyomja meg hosszan, vagy nyomja meg az Alt + lefele nyíl gombot a menü megnyitásához`
1130
+ };
1131
+ var $edc7c66594a0ae8a$exports = {};
1132
+ $edc7c66594a0ae8a$exports = {
1133
+ "longPressMessage": `Premere a lungo o premere Alt + Freccia giù per aprire il menu`
1134
+ };
1135
+ var $f1ab51510712db52$exports = {};
1136
+ $f1ab51510712db52$exports = {
1137
+ "longPressMessage": `長押しまたは Alt+下矢印キーでメニューを開く`
1138
+ };
1139
+ var $f9b672d9b82fa3d6$exports = {};
1140
+ $f9b672d9b82fa3d6$exports = {
1141
+ "longPressMessage": `길게 누르거나 Alt + 아래쪽 화살표를 눌러 메뉴 열기`
1142
+ };
1143
+ var $a385f3910feda499$exports = {};
1144
+ $a385f3910feda499$exports = {
1145
+ "longPressMessage": `Norėdami atidaryti meniu, nuspaudę palaikykite arba paspauskite „Alt + ArrowDown“.`
1146
+ };
1147
+ var $4f1bde932c441789$exports = {};
1148
+ $4f1bde932c441789$exports = {
1149
+ "longPressMessage": `Lai atvērtu izvēlni, turiet nospiestu vai nospiediet taustiņu kombināciju Alt + lejupvērstā bultiņa`
1150
+ };
1151
+ var $914a51a8a594d5be$exports = {};
1152
+ $914a51a8a594d5be$exports = {
1153
+ "longPressMessage": `Langt trykk eller trykk Alt + PilNed for å åpne menyen`
1154
+ };
1155
+ var $89aaf803103bb500$exports = {};
1156
+ $89aaf803103bb500$exports = {
1157
+ "longPressMessage": `Druk lang op Alt + pijl-omlaag of druk op Alt om het menu te openen`
1158
+ };
1159
+ var $c685891476dbaaca$exports = {};
1160
+ $c685891476dbaaca$exports = {
1161
+ "longPressMessage": `Naciśnij i przytrzymaj lub naciśnij klawisze Alt + Strzałka w dół, aby otworzyć menu`
1162
+ };
1163
+ var $885879b9b10c2959$exports = {};
1164
+ $885879b9b10c2959$exports = {
1165
+ "longPressMessage": `Pressione e segure ou pressione Alt + Seta para baixo para abrir o menu`
1166
+ };
1167
+ var $6b39616688a51692$exports = {};
1168
+ $6b39616688a51692$exports = {
1169
+ "longPressMessage": `Prima continuamente ou prima Alt + Seta Para Baixo para abrir o menu`
1170
+ };
1171
+ var $f26362aed63f47e2$exports = {};
1172
+ $f26362aed63f47e2$exports = {
1173
+ "longPressMessage": `Apăsați lung sau apăsați pe Alt + săgeată în jos pentru a deschide meniul`
1174
+ };
1175
+ var $06cbade644558bf0$exports = {};
1176
+ $06cbade644558bf0$exports = {
1177
+ "longPressMessage": `Нажмите и удерживайте или нажмите Alt + Стрелка вниз, чтобы открыть меню`
1178
+ };
1179
+ var $0a391ff68f9d59b1$exports = {};
1180
+ $0a391ff68f9d59b1$exports = {
1181
+ "longPressMessage": `Ponuku otvoríte dlhým stlačením alebo stlačením klávesu Alt + klávesu so šípkou nadol`
1182
+ };
1183
+ var $8193cf0e649c7928$exports = {};
1184
+ $8193cf0e649c7928$exports = {
1185
+ "longPressMessage": `Za odprtje menija pritisnite in držite gumb ali pritisnite Alt+puščica navzdol`
1186
+ };
1187
+ var $f398debcce5a5c55$exports = {};
1188
+ $f398debcce5a5c55$exports = {
1189
+ "longPressMessage": `Dugo pritisnite ili pritisnite Alt + strelicu prema dole da otvorite meni`
1190
+ };
1191
+ var $9e9fef000aa4c013$exports = {};
1192
+ $9e9fef000aa4c013$exports = {
1193
+ "longPressMessage": `Håll nedtryckt eller tryck på Alt + pil nedåt för att öppna menyn`
1194
+ };
1195
+ var $c016c8183bbe3d68$exports = {};
1196
+ $c016c8183bbe3d68$exports = {
1197
+ "longPressMessage": `Menüyü açmak için uzun basın veya Alt + Aşağı Ok tuşuna basın`
1198
+ };
1199
+ var $ca4f6c8462244e62$exports = {};
1200
+ $ca4f6c8462244e62$exports = {
1201
+ "longPressMessage": `Довго або звичайно натисніть комбінацію клавіш Alt і стрілка вниз, щоб відкрити меню`
1202
+ };
1203
+ var $2d9960c02ccac927$exports = {};
1204
+ $2d9960c02ccac927$exports = {
1205
+ "longPressMessage": `长按或按 Alt + 向下方向键以打开菜单`
1206
+ };
1207
+ var $f1b682a4c8c5631c$exports = {};
1208
+ $f1b682a4c8c5631c$exports = {
1209
+ "longPressMessage": `長按或按 Alt+向下鍵以開啟功能表`
1210
+ };
1211
+ $2cbb7ca666678a14$exports = {
1212
+ "ar-AE": $c0398ad35c3639b7$exports,
1213
+ "bg-BG": $7af657c4165927c3$exports,
1214
+ "cs-CZ": $d95d4da6d531ab81$exports,
1215
+ "da-DK": $24ebda9c775dca17$exports,
1216
+ "de-DE": $743e0dfca6cab1e9$exports,
1217
+ "el-GR": $a2f41026e05f1c84$exports,
1218
+ "en-US": $43b800e97c901737$exports,
1219
+ "es-ES": $442f5f6ac211e29f$exports,
1220
+ "et-EE": $dff280acfeb2d8ac$exports,
1221
+ "fi-FI": $51608325613944d7$exports,
1222
+ "fr-FR": $c4a1b1eabeaa87be$exports,
1223
+ "he-IL": $8c74815cdee18d1b$exports,
1224
+ "hr-HR": $fd0e9ef6a7fe0ec9$exports,
1225
+ "hu-HU": $a89a74a39eba465a$exports,
1226
+ "it-IT": $edc7c66594a0ae8a$exports,
1227
+ "ja-JP": $f1ab51510712db52$exports,
1228
+ "ko-KR": $f9b672d9b82fa3d6$exports,
1229
+ "lt-LT": $a385f3910feda499$exports,
1230
+ "lv-LV": $4f1bde932c441789$exports,
1231
+ "nb-NO": $914a51a8a594d5be$exports,
1232
+ "nl-NL": $89aaf803103bb500$exports,
1233
+ "pl-PL": $c685891476dbaaca$exports,
1234
+ "pt-BR": $885879b9b10c2959$exports,
1235
+ "pt-PT": $6b39616688a51692$exports,
1236
+ "ro-RO": $f26362aed63f47e2$exports,
1237
+ "ru-RU": $06cbade644558bf0$exports,
1238
+ "sk-SK": $0a391ff68f9d59b1$exports,
1239
+ "sl-SI": $8193cf0e649c7928$exports,
1240
+ "sr-SP": $f398debcce5a5c55$exports,
1241
+ "sv-SE": $9e9fef000aa4c013$exports,
1242
+ "tr-TR": $c016c8183bbe3d68$exports,
1243
+ "uk-UA": $ca4f6c8462244e62$exports,
1244
+ "zh-CN": $2d9960c02ccac927$exports,
1245
+ "zh-TW": $f1b682a4c8c5631c$exports
1246
+ };
1247
+ function $168583247155ddda$export$dc9c12ed27dd1b49(props, state, ref) {
1248
+ let { type = "menu", isDisabled, trigger = "press" } = props;
1249
+ let menuTriggerId = _import.$bdb11010cef70236$export$f680877a34711e37();
1250
+ let { triggerProps, overlayProps } = _import$2.$628037886ba31236$export$f9d5c8beee7d008d({
1251
+ type
1252
+ }, state, ref);
1253
+ let onKeyDown = (e) => {
1254
+ if (isDisabled)
1255
+ return;
1256
+ if (trigger === "longPress" && !e.altKey)
1257
+ return;
1258
+ if (ref && ref.current)
1259
+ switch (e.key) {
1260
+ case "Enter":
1261
+ case " ":
1262
+ if (trigger === "longPress")
1263
+ return;
1264
+ case "ArrowDown":
1265
+ if (!("continuePropagation" in e))
1266
+ e.stopPropagation();
1267
+ e.preventDefault();
1268
+ state.toggle("first");
1269
+ break;
1270
+ case "ArrowUp":
1271
+ if (!("continuePropagation" in e))
1272
+ e.stopPropagation();
1273
+ e.preventDefault();
1274
+ state.toggle("last");
1275
+ break;
1276
+ }
1277
+ };
1278
+ let stringFormatter = realModule.$fca6afa0e843324b$export$f12b703ca79dfbb1(/* @__PURE__ */ $parcel$interopDefault($2cbb7ca666678a14$exports));
1279
+ let { longPressProps } = _import$1.$8a26561d2877236e$export$c24ed0104d07eab9({
1280
+ isDisabled: isDisabled || trigger !== "longPress",
1281
+ accessibilityDescription: stringFormatter.format("longPressMessage"),
1282
+ onLongPressStart() {
1283
+ state.close();
1284
+ },
1285
+ onLongPress() {
1286
+ state.open("first");
1287
+ }
1288
+ });
1289
+ let pressProps = {
1290
+ onPressStart(e) {
1291
+ if (e.pointerType !== "touch" && e.pointerType !== "keyboard" && !isDisabled)
1292
+ state.toggle(e.pointerType === "virtual" ? "first" : null);
1293
+ },
1294
+ onPress(e) {
1295
+ if (e.pointerType === "touch" && !isDisabled)
1296
+ state.toggle();
1297
+ }
1298
+ };
1299
+ delete triggerProps.onPress;
1300
+ return {
1301
+ menuTriggerProps: __spreadProps(__spreadValues(__spreadValues({}, triggerProps), trigger === "press" ? pressProps : longPressProps), {
1302
+ id: menuTriggerId,
1303
+ onKeyDown
1304
+ }),
1305
+ menuProps: __spreadProps(__spreadValues({}, overlayProps), {
1306
+ "aria-labelledby": menuTriggerId,
1307
+ autoFocus: state.focusStrategy || true,
1308
+ onClose: state.close
1309
+ })
1310
+ };
1311
+ }
1312
+ const $d5336fe17ce95402$export$6f49b4016bfc8d56 = /* @__PURE__ */ new WeakMap();
1313
+ function $d5336fe17ce95402$export$38eaa17faae8f579(props, state, ref) {
1314
+ let _a = props, { shouldFocusWrap = true } = _a, otherProps = __objRest(_a, ["shouldFocusWrap"]);
1315
+ if (!props["aria-label"] && !props["aria-labelledby"])
1316
+ console.warn("An aria-label or aria-labelledby prop is required for accessibility.");
1317
+ let domProps = _import.$65484d02dcb7eb3e$export$457c3d6518dd4c6f(props, {
1318
+ labelable: true
1319
+ });
1320
+ let { listProps } = $982254629710d113$export$b95089534ab7c1fd(__spreadProps(__spreadValues({}, otherProps), {
1321
+ ref,
1322
+ selectionManager: state.selectionManager,
1323
+ collection: state.collection,
1324
+ disabledKeys: state.disabledKeys,
1325
+ shouldFocusWrap
1326
+ }));
1327
+ $d5336fe17ce95402$export$6f49b4016bfc8d56.set(state, {
1328
+ onClose: props.onClose,
1329
+ onAction: props.onAction
1330
+ });
1331
+ return {
1332
+ menuProps: _import.$3ef42575df84b30b$export$9d1611c77c2fe928(domProps, __spreadProps(__spreadValues({
1333
+ role: "menu",
1334
+ // this forces AT to move their cursors into any open sub dialogs, the sub dialogs contain hidden close buttons in order to come back to this level of the menu
1335
+ "aria-hidden": state.expandedKeys.size > 0 ? true : void 0
1336
+ }, listProps), {
1337
+ onKeyDown: (e) => {
1338
+ if (e.key !== "Escape")
1339
+ listProps.onKeyDown(e);
1340
+ }
1341
+ }))
1342
+ };
1343
+ }
1344
+ function $a2e5df62f93c7633$export$9d32628fc2aea7da(props, state, ref) {
1345
+ let { key, closeOnSelect, isVirtualized, "aria-haspopup": hasPopup } = props;
1346
+ let { direction } = realModule.$18f2051aff69b9bf$export$43bb16f9c6d9e3f7();
1347
+ let isTrigger = !!hasPopup;
1348
+ let isOpen = state.expandedKeys.has(key);
1349
+ var _props_isDisabled;
1350
+ let isDisabled = (_props_isDisabled = props.isDisabled) !== null && _props_isDisabled !== void 0 ? _props_isDisabled : state.disabledKeys.has(key);
1351
+ var _props_isSelected;
1352
+ let isSelected = (_props_isSelected = props.isSelected) !== null && _props_isSelected !== void 0 ? _props_isSelected : state.selectionManager.isSelected(key);
1353
+ let openTimeout = React.useRef();
1354
+ let cancelOpenTimeout = React.useCallback(() => {
1355
+ if (openTimeout.current) {
1356
+ clearTimeout(openTimeout.current);
1357
+ openTimeout.current = void 0;
1358
+ }
1359
+ }, [
1360
+ openTimeout
1361
+ ]);
1362
+ let onSubmenuOpen = _import.$8ae05eaa5c114e9c$export$7f54fc3180508a52(() => {
1363
+ cancelOpenTimeout();
1364
+ state.setExpandedKeys(/* @__PURE__ */ new Set([
1365
+ key
1366
+ ]));
1367
+ });
1368
+ _import.$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
1369
+ return () => cancelOpenTimeout();
1370
+ }, [
1371
+ cancelOpenTimeout
1372
+ ]);
1373
+ let data = $d5336fe17ce95402$export$6f49b4016bfc8d56.get(state);
1374
+ let onClose = props.onClose || data.onClose;
1375
+ let onActionMenuDialogTrigger = React.useCallback(() => {
1376
+ onSubmenuOpen();
1377
+ }, []);
1378
+ let onAction = isTrigger ? onActionMenuDialogTrigger : props.onAction || data.onAction;
1379
+ let role = "menuitem";
1380
+ if (state.selectionManager.selectionMode === "single")
1381
+ role = "menuitemradio";
1382
+ else if (state.selectionManager.selectionMode === "multiple")
1383
+ role = "menuitemcheckbox";
1384
+ let labelId = _import.$bdb11010cef70236$export$b4cc09c592e8fdb8();
1385
+ let descriptionId = _import.$bdb11010cef70236$export$b4cc09c592e8fdb8();
1386
+ let keyboardId = _import.$bdb11010cef70236$export$b4cc09c592e8fdb8();
1387
+ let ariaProps = {
1388
+ "aria-disabled": isDisabled || void 0,
1389
+ role,
1390
+ "aria-label": props["aria-label"],
1391
+ "aria-labelledby": labelId,
1392
+ "aria-describedby": [
1393
+ descriptionId,
1394
+ keyboardId
1395
+ ].filter(Boolean).join(" ") || void 0
1396
+ };
1397
+ if (state.selectionManager.selectionMode !== "none")
1398
+ ariaProps["aria-checked"] = isSelected;
1399
+ if (isVirtualized) {
1400
+ ariaProps["aria-posinset"] = state.collection.getItem(key).index;
1401
+ ariaProps["aria-setsize"] = $453cc9f0df89c0a5$export$77d5aafae4e095b2(state.collection);
1402
+ }
1403
+ if (hasPopup != null) {
1404
+ ariaProps["aria-haspopup"] = hasPopup;
1405
+ ariaProps["aria-expanded"] = isOpen ? "true" : "false";
1406
+ }
1407
+ let onPressStart = (e) => {
1408
+ if (e.pointerType === "keyboard" && onAction)
1409
+ onAction(key);
1410
+ };
1411
+ let onPressUp = (e) => {
1412
+ if (e.pointerType !== "keyboard") {
1413
+ if (onAction)
1414
+ onAction(key);
1415
+ if (!isTrigger && onClose && (closeOnSelect !== null && closeOnSelect !== void 0 ? closeOnSelect : state.selectionManager.selectionMode !== "multiple"))
1416
+ onClose();
1417
+ }
1418
+ };
1419
+ let { itemProps, isFocused } = $880e95eb8b93ba9a$export$ecf600387e221c37({
1420
+ selectionManager: state.selectionManager,
1421
+ key,
1422
+ ref,
1423
+ shouldSelectOnPressUp: true,
1424
+ allowsDifferentPressOrigin: true
1425
+ });
1426
+ let { pressProps, isPressed } = _import$1.$f6c31cce2adf654f$export$45712eceda6fad21({
1427
+ onPressStart,
1428
+ onPressUp,
1429
+ isDisabled: isDisabled || isTrigger && state.expandedKeys.has(key)
1430
+ });
1431
+ let { hoverProps } = _import$1.$6179b936705e76d3$export$ae780daf29e6d456({
1432
+ isDisabled,
1433
+ onHoverStart() {
1434
+ if (!_import$1.$507fabe10e71c6fb$export$b9b3dfddab17db27() && !(isTrigger && state.expandedKeys.has(key))) {
1435
+ state.selectionManager.setFocused(true);
1436
+ state.selectionManager.setFocusedKey(key);
1437
+ let isFocused2 = key === state.selectionManager.focusedKey;
1438
+ if (isFocused2 && state.selectionManager.isFocused && document.activeElement !== ref.current)
1439
+ _import$1.$6a99195332edec8b$export$80f3e147d781571c(ref.current);
1440
+ }
1441
+ },
1442
+ onHoverChange: (isHovered) => {
1443
+ if (isHovered && isTrigger && !state.expandedKeys.has(key)) {
1444
+ if (!openTimeout.current)
1445
+ openTimeout.current = setTimeout(() => {
1446
+ onSubmenuOpen();
1447
+ }, 200);
1448
+ } else if (!isHovered)
1449
+ cancelOpenTimeout();
1450
+ }
1451
+ });
1452
+ let { keyboardProps } = _import$1.$46d819fcbaf35654$export$8f71654801c2f7cd({
1453
+ onKeyDown: (e) => {
1454
+ if (e.repeat) {
1455
+ e.continuePropagation();
1456
+ return;
1457
+ }
1458
+ switch (e.key) {
1459
+ case " ":
1460
+ if (!isDisabled && state.selectionManager.selectionMode === "none" && !isTrigger && closeOnSelect !== false && onClose)
1461
+ onClose();
1462
+ break;
1463
+ case "Enter":
1464
+ if (!isDisabled && closeOnSelect !== false && !isTrigger && onClose)
1465
+ onClose();
1466
+ break;
1467
+ case "ArrowRight":
1468
+ if (isTrigger && direction === "ltr")
1469
+ onSubmenuOpen();
1470
+ else
1471
+ e.continuePropagation();
1472
+ break;
1473
+ case "ArrowLeft":
1474
+ if (isTrigger && direction === "rtl")
1475
+ onSubmenuOpen();
1476
+ else
1477
+ e.continuePropagation();
1478
+ break;
1479
+ default:
1480
+ e.continuePropagation();
1481
+ break;
1482
+ }
1483
+ }
1484
+ });
1485
+ return {
1486
+ menuItemProps: __spreadValues(__spreadValues({}, ariaProps), _import.$3ef42575df84b30b$export$9d1611c77c2fe928(itemProps, pressProps, hoverProps, keyboardProps)),
1487
+ labelProps: {
1488
+ id: labelId
1489
+ },
1490
+ descriptionProps: {
1491
+ id: descriptionId
1492
+ },
1493
+ keyboardShortcutProps: {
1494
+ id: keyboardId
1495
+ },
1496
+ isFocused,
1497
+ isSelected,
1498
+ isPressed,
1499
+ isDisabled
1500
+ };
1501
+ }
1502
+ function $3e5eb2498db5b506$export$73f7a44322579622(props) {
1503
+ let { heading, "aria-label": ariaLabel } = props;
1504
+ let headingId = _import.$bdb11010cef70236$export$f680877a34711e37();
1505
+ return {
1506
+ itemProps: {
1507
+ role: "presentation"
1508
+ },
1509
+ headingProps: heading ? {
1510
+ // Techincally, menus cannot contain headings according to ARIA.
1511
+ // We hide the heading from assistive technology, using role="presentation",
1512
+ // and only use it as a label for the nested group.
1513
+ id: headingId,
1514
+ role: "presentation"
1515
+ } : {},
1516
+ groupProps: {
1517
+ role: "group",
1518
+ "aria-label": ariaLabel,
1519
+ "aria-labelledby": heading ? headingId : void 0
1520
+ }
1521
+ };
1522
+ }
1523
+ function $f4b273590fab9f93$export$52210f68a14655d0(props) {
1524
+ let domProps = _import.$65484d02dcb7eb3e$export$457c3d6518dd4c6f(props, {
1525
+ labelable: true
1526
+ });
1527
+ let ariaOrientation;
1528
+ if (props.orientation === "vertical")
1529
+ ariaOrientation = "vertical";
1530
+ if (props.elementType !== "hr")
1531
+ return {
1532
+ separatorProps: __spreadProps(__spreadValues({}, domProps), {
1533
+ role: "separator",
1534
+ "aria-orientation": ariaOrientation
1535
+ })
1536
+ };
1537
+ return {
1538
+ separatorProps: domProps
1539
+ };
1540
+ }
1541
+ class $e40ea825a81a3709$export$52baac22726c72bf extends Set {
1542
+ constructor(keys, anchorKey, currentKey) {
1543
+ super(keys);
1544
+ if (keys instanceof $e40ea825a81a3709$export$52baac22726c72bf) {
1545
+ this.anchorKey = anchorKey || keys.anchorKey;
1546
+ this.currentKey = currentKey || keys.currentKey;
1547
+ } else {
1548
+ this.anchorKey = anchorKey;
1549
+ this.currentKey = currentKey;
1550
+ }
1551
+ }
1552
+ }
1553
+ function $7af3f5b51489e0b5$var$equalSets(setA, setB) {
1554
+ if (setA.size !== setB.size)
1555
+ return false;
1556
+ for (let item of setA) {
1557
+ if (!setB.has(item))
1558
+ return false;
1559
+ }
1560
+ return true;
1561
+ }
1562
+ function $7af3f5b51489e0b5$export$253fe78d46329472(props) {
1563
+ let { selectionMode = "none", disallowEmptySelection, allowDuplicateSelectionEvents, selectionBehavior: selectionBehaviorProp = "toggle", disabledBehavior = "all" } = props;
1564
+ let isFocusedRef = React.useRef(false);
1565
+ let [, setFocused] = React.useState(false);
1566
+ let focusedKeyRef = React.useRef(null);
1567
+ let childFocusStrategyRef = React.useRef(null);
1568
+ let [, setFocusedKey] = React.useState(null);
1569
+ let selectedKeysProp = React.useMemo(() => $7af3f5b51489e0b5$var$convertSelection(props.selectedKeys), [
1570
+ props.selectedKeys
1571
+ ]);
1572
+ let defaultSelectedKeys = React.useMemo(() => $7af3f5b51489e0b5$var$convertSelection(props.defaultSelectedKeys, new $e40ea825a81a3709$export$52baac22726c72bf()), [
1573
+ props.defaultSelectedKeys
1574
+ ]);
1575
+ let [selectedKeys, setSelectedKeys] = _import$3.$458b0a5536c1a7cf$export$40bfa8c7b0832715(selectedKeysProp, defaultSelectedKeys, props.onSelectionChange);
1576
+ let disabledKeysProp = React.useMemo(() => props.disabledKeys ? new Set(props.disabledKeys) : /* @__PURE__ */ new Set(), [
1577
+ props.disabledKeys
1578
+ ]);
1579
+ let [selectionBehavior, setSelectionBehavior] = React.useState(selectionBehaviorProp);
1580
+ if (selectionBehaviorProp === "replace" && selectionBehavior === "toggle" && typeof selectedKeys === "object" && selectedKeys.size === 0)
1581
+ setSelectionBehavior("replace");
1582
+ let lastSelectionBehavior = React.useRef(selectionBehaviorProp);
1583
+ React.useEffect(() => {
1584
+ if (selectionBehaviorProp !== lastSelectionBehavior.current) {
1585
+ setSelectionBehavior(selectionBehaviorProp);
1586
+ lastSelectionBehavior.current = selectionBehaviorProp;
1587
+ }
1588
+ }, [
1589
+ selectionBehaviorProp
1590
+ ]);
1591
+ return {
1592
+ selectionMode,
1593
+ disallowEmptySelection,
1594
+ selectionBehavior,
1595
+ setSelectionBehavior,
1596
+ get isFocused() {
1597
+ return isFocusedRef.current;
1598
+ },
1599
+ setFocused(f) {
1600
+ isFocusedRef.current = f;
1601
+ setFocused(f);
1602
+ },
1603
+ get focusedKey() {
1604
+ return focusedKeyRef.current;
1605
+ },
1606
+ get childFocusStrategy() {
1607
+ return childFocusStrategyRef.current;
1608
+ },
1609
+ setFocusedKey(k, childFocusStrategy = "first") {
1610
+ focusedKeyRef.current = k;
1611
+ childFocusStrategyRef.current = childFocusStrategy;
1612
+ setFocusedKey(k);
1613
+ },
1614
+ selectedKeys,
1615
+ setSelectedKeys(keys) {
1616
+ if (allowDuplicateSelectionEvents || !$7af3f5b51489e0b5$var$equalSets(keys, selectedKeys))
1617
+ setSelectedKeys(keys);
1618
+ },
1619
+ disabledKeys: disabledKeysProp,
1620
+ disabledBehavior
1621
+ };
1622
+ }
1623
+ function $7af3f5b51489e0b5$var$convertSelection(selection, defaultValue) {
1624
+ if (!selection)
1625
+ return defaultValue;
1626
+ return selection === "all" ? "all" : new $e40ea825a81a3709$export$52baac22726c72bf(selection);
1627
+ }
1628
+ class $d496c0a20b6e58ec$export$6c8a5aaad13c9852 {
1629
+ /**
1630
+ * The type of selection that is allowed in the collection.
1631
+ */
1632
+ get selectionMode() {
1633
+ return this.state.selectionMode;
1634
+ }
1635
+ /**
1636
+ * Whether the collection allows empty selection.
1637
+ */
1638
+ get disallowEmptySelection() {
1639
+ return this.state.disallowEmptySelection;
1640
+ }
1641
+ /**
1642
+ * The selection behavior for the collection.
1643
+ */
1644
+ get selectionBehavior() {
1645
+ return this.state.selectionBehavior;
1646
+ }
1647
+ /**
1648
+ * Sets the selection behavior for the collection.
1649
+ */
1650
+ setSelectionBehavior(selectionBehavior) {
1651
+ this.state.setSelectionBehavior(selectionBehavior);
1652
+ }
1653
+ /**
1654
+ * Whether the collection is currently focused.
1655
+ */
1656
+ get isFocused() {
1657
+ return this.state.isFocused;
1658
+ }
1659
+ /**
1660
+ * Sets whether the collection is focused.
1661
+ */
1662
+ setFocused(isFocused) {
1663
+ this.state.setFocused(isFocused);
1664
+ }
1665
+ /**
1666
+ * The current focused key in the collection.
1667
+ */
1668
+ get focusedKey() {
1669
+ return this.state.focusedKey;
1670
+ }
1671
+ /** Whether the first or last child of the focused key should receive focus. */
1672
+ get childFocusStrategy() {
1673
+ return this.state.childFocusStrategy;
1674
+ }
1675
+ /**
1676
+ * Sets the focused key.
1677
+ */
1678
+ setFocusedKey(key, childFocusStrategy) {
1679
+ if (key == null || this.collection.getItem(key))
1680
+ this.state.setFocusedKey(key, childFocusStrategy);
1681
+ }
1682
+ /**
1683
+ * The currently selected keys in the collection.
1684
+ */
1685
+ get selectedKeys() {
1686
+ return this.state.selectedKeys === "all" ? new Set(this.getSelectAllKeys()) : this.state.selectedKeys;
1687
+ }
1688
+ /**
1689
+ * The raw selection value for the collection.
1690
+ * Either 'all' for select all, or a set of keys.
1691
+ */
1692
+ get rawSelection() {
1693
+ return this.state.selectedKeys;
1694
+ }
1695
+ /**
1696
+ * Returns whether a key is selected.
1697
+ */
1698
+ isSelected(key) {
1699
+ if (this.state.selectionMode === "none")
1700
+ return false;
1701
+ key = this.getKey(key);
1702
+ return this.state.selectedKeys === "all" ? this.canSelectItem(key) : this.state.selectedKeys.has(key);
1703
+ }
1704
+ /**
1705
+ * Whether the selection is empty.
1706
+ */
1707
+ get isEmpty() {
1708
+ return this.state.selectedKeys !== "all" && this.state.selectedKeys.size === 0;
1709
+ }
1710
+ /**
1711
+ * Whether all items in the collection are selected.
1712
+ */
1713
+ get isSelectAll() {
1714
+ if (this.isEmpty)
1715
+ return false;
1716
+ if (this.state.selectedKeys === "all")
1717
+ return true;
1718
+ if (this._isSelectAll != null)
1719
+ return this._isSelectAll;
1720
+ let allKeys = this.getSelectAllKeys();
1721
+ let selectedKeys = this.state.selectedKeys;
1722
+ this._isSelectAll = allKeys.every((k) => selectedKeys.has(k));
1723
+ return this._isSelectAll;
1724
+ }
1725
+ get firstSelectedKey() {
1726
+ let first = null;
1727
+ for (let key of this.state.selectedKeys) {
1728
+ let item = this.collection.getItem(key);
1729
+ if (!first || item && $c5a24bc478652b5f$export$8c434b3a7a4dad6(this.collection, item, first) < 0)
1730
+ first = item;
1731
+ }
1732
+ return first === null || first === void 0 ? void 0 : first.key;
1733
+ }
1734
+ get lastSelectedKey() {
1735
+ let last = null;
1736
+ for (let key of this.state.selectedKeys) {
1737
+ let item = this.collection.getItem(key);
1738
+ if (!last || item && $c5a24bc478652b5f$export$8c434b3a7a4dad6(this.collection, item, last) > 0)
1739
+ last = item;
1740
+ }
1741
+ return last === null || last === void 0 ? void 0 : last.key;
1742
+ }
1743
+ get disabledKeys() {
1744
+ return this.state.disabledKeys;
1745
+ }
1746
+ get disabledBehavior() {
1747
+ return this.state.disabledBehavior;
1748
+ }
1749
+ /**
1750
+ * Extends the selection to the given key.
1751
+ */
1752
+ extendSelection(toKey) {
1753
+ if (this.selectionMode === "none")
1754
+ return;
1755
+ if (this.selectionMode === "single") {
1756
+ this.replaceSelection(toKey);
1757
+ return;
1758
+ }
1759
+ toKey = this.getKey(toKey);
1760
+ let selection;
1761
+ if (this.state.selectedKeys === "all")
1762
+ selection = new $e40ea825a81a3709$export$52baac22726c72bf([
1763
+ toKey
1764
+ ], toKey, toKey);
1765
+ else {
1766
+ let selectedKeys = this.state.selectedKeys;
1767
+ let anchorKey = selectedKeys.anchorKey || toKey;
1768
+ selection = new $e40ea825a81a3709$export$52baac22726c72bf(selectedKeys, anchorKey, toKey);
1769
+ for (let key of this.getKeyRange(anchorKey, selectedKeys.currentKey || toKey))
1770
+ selection.delete(key);
1771
+ for (let key of this.getKeyRange(toKey, anchorKey))
1772
+ if (this.canSelectItem(key))
1773
+ selection.add(key);
1774
+ }
1775
+ this.state.setSelectedKeys(selection);
1776
+ }
1777
+ getKeyRange(from, to) {
1778
+ let fromItem = this.collection.getItem(from);
1779
+ let toItem = this.collection.getItem(to);
1780
+ if (fromItem && toItem) {
1781
+ if ($c5a24bc478652b5f$export$8c434b3a7a4dad6(this.collection, fromItem, toItem) <= 0)
1782
+ return this.getKeyRangeInternal(from, to);
1783
+ return this.getKeyRangeInternal(to, from);
1784
+ }
1785
+ return [];
1786
+ }
1787
+ getKeyRangeInternal(from, to) {
1788
+ let keys = [];
1789
+ let key = from;
1790
+ while (key) {
1791
+ let item = this.collection.getItem(key);
1792
+ if (item && item.type === "item" || item.type === "cell" && this.allowsCellSelection)
1793
+ keys.push(key);
1794
+ if (key === to)
1795
+ return keys;
1796
+ key = this.collection.getKeyAfter(key);
1797
+ }
1798
+ return [];
1799
+ }
1800
+ getKey(key) {
1801
+ let item = this.collection.getItem(key);
1802
+ if (!item)
1803
+ return key;
1804
+ if (item.type === "cell" && this.allowsCellSelection)
1805
+ return key;
1806
+ while (item.type !== "item" && item.parentKey != null)
1807
+ item = this.collection.getItem(item.parentKey);
1808
+ if (!item || item.type !== "item")
1809
+ return null;
1810
+ return item.key;
1811
+ }
1812
+ /**
1813
+ * Toggles whether the given key is selected.
1814
+ */
1815
+ toggleSelection(key) {
1816
+ if (this.selectionMode === "none")
1817
+ return;
1818
+ if (this.selectionMode === "single" && !this.isSelected(key)) {
1819
+ this.replaceSelection(key);
1820
+ return;
1821
+ }
1822
+ key = this.getKey(key);
1823
+ if (key == null)
1824
+ return;
1825
+ let keys = new $e40ea825a81a3709$export$52baac22726c72bf(this.state.selectedKeys === "all" ? this.getSelectAllKeys() : this.state.selectedKeys);
1826
+ if (keys.has(key))
1827
+ keys.delete(key);
1828
+ else if (this.canSelectItem(key)) {
1829
+ keys.add(key);
1830
+ keys.anchorKey = key;
1831
+ keys.currentKey = key;
1832
+ }
1833
+ if (this.disallowEmptySelection && keys.size === 0)
1834
+ return;
1835
+ this.state.setSelectedKeys(keys);
1836
+ }
1837
+ /**
1838
+ * Replaces the selection with only the given key.
1839
+ */
1840
+ replaceSelection(key) {
1841
+ if (this.selectionMode === "none")
1842
+ return;
1843
+ key = this.getKey(key);
1844
+ if (key == null)
1845
+ return;
1846
+ let selection = this.canSelectItem(key) ? new $e40ea825a81a3709$export$52baac22726c72bf([
1847
+ key
1848
+ ], key, key) : new $e40ea825a81a3709$export$52baac22726c72bf();
1849
+ this.state.setSelectedKeys(selection);
1850
+ }
1851
+ /**
1852
+ * Replaces the selection with the given keys.
1853
+ */
1854
+ setSelectedKeys(keys) {
1855
+ if (this.selectionMode === "none")
1856
+ return;
1857
+ let selection = new $e40ea825a81a3709$export$52baac22726c72bf();
1858
+ for (let key of keys) {
1859
+ key = this.getKey(key);
1860
+ if (key != null) {
1861
+ selection.add(key);
1862
+ if (this.selectionMode === "single")
1863
+ break;
1864
+ }
1865
+ }
1866
+ this.state.setSelectedKeys(selection);
1867
+ }
1868
+ getSelectAllKeys() {
1869
+ let keys = [];
1870
+ let addKeys = (key) => {
1871
+ while (key) {
1872
+ if (this.canSelectItem(key)) {
1873
+ let item = this.collection.getItem(key);
1874
+ if (item.type === "item")
1875
+ keys.push(key);
1876
+ if (item.hasChildNodes && (this.allowsCellSelection || item.type !== "item"))
1877
+ addKeys($c5a24bc478652b5f$export$fbdeaa6a76694f71($c5a24bc478652b5f$export$1005530eda016c13(item, this.collection)).key);
1878
+ }
1879
+ key = this.collection.getKeyAfter(key);
1880
+ }
1881
+ };
1882
+ addKeys(this.collection.getFirstKey());
1883
+ return keys;
1884
+ }
1885
+ /**
1886
+ * Selects all items in the collection.
1887
+ */
1888
+ selectAll() {
1889
+ if (!this.isSelectAll && this.selectionMode === "multiple")
1890
+ this.state.setSelectedKeys("all");
1891
+ }
1892
+ /**
1893
+ * Removes all keys from the selection.
1894
+ */
1895
+ clearSelection() {
1896
+ if (!this.disallowEmptySelection && (this.state.selectedKeys === "all" || this.state.selectedKeys.size > 0))
1897
+ this.state.setSelectedKeys(new $e40ea825a81a3709$export$52baac22726c72bf());
1898
+ }
1899
+ /**
1900
+ * Toggles between select all and an empty selection.
1901
+ */
1902
+ toggleSelectAll() {
1903
+ if (this.isSelectAll)
1904
+ this.clearSelection();
1905
+ else
1906
+ this.selectAll();
1907
+ }
1908
+ select(key, e) {
1909
+ if (this.selectionMode === "none")
1910
+ return;
1911
+ if (this.selectionMode === "single") {
1912
+ if (this.isSelected(key) && !this.disallowEmptySelection)
1913
+ this.toggleSelection(key);
1914
+ else
1915
+ this.replaceSelection(key);
1916
+ } else if (this.selectionBehavior === "toggle" || e && (e.pointerType === "touch" || e.pointerType === "virtual"))
1917
+ this.toggleSelection(key);
1918
+ else
1919
+ this.replaceSelection(key);
1920
+ }
1921
+ /**
1922
+ * Returns whether the current selection is equal to the given selection.
1923
+ */
1924
+ isSelectionEqual(selection) {
1925
+ if (selection === this.state.selectedKeys)
1926
+ return true;
1927
+ let selectedKeys = this.selectedKeys;
1928
+ if (selection.size !== selectedKeys.size)
1929
+ return false;
1930
+ for (let key of selection) {
1931
+ if (!selectedKeys.has(key))
1932
+ return false;
1933
+ }
1934
+ for (let key of selectedKeys) {
1935
+ if (!selection.has(key))
1936
+ return false;
1937
+ }
1938
+ return true;
1939
+ }
1940
+ canSelectItem(key) {
1941
+ if (this.state.selectionMode === "none" || this.state.disabledKeys.has(key))
1942
+ return false;
1943
+ let item = this.collection.getItem(key);
1944
+ if (!item || item.type === "cell" && !this.allowsCellSelection)
1945
+ return false;
1946
+ return true;
1947
+ }
1948
+ isDisabled(key) {
1949
+ return this.state.disabledKeys.has(key) && this.state.disabledBehavior === "all";
1950
+ }
1951
+ constructor(collection, state, options) {
1952
+ this.collection = collection;
1953
+ this.state = state;
1954
+ var _options_allowsCellSelection;
1955
+ this.allowsCellSelection = (_options_allowsCellSelection = options === null || options === void 0 ? void 0 : options.allowsCellSelection) !== null && _options_allowsCellSelection !== void 0 ? _options_allowsCellSelection : false;
1956
+ this._isSelectAll = null;
1957
+ }
1958
+ }
1959
+ function $a28c903ee9ad8dc5$export$79fefeb1c2091ac3(props) {
1960
+ let overlayTriggerState = _import$2.$fc909762b330b746$export$61c6a8c84e605fb6(props);
1961
+ let [focusStrategy, setFocusStrategy] = React.useState(null);
1962
+ return __spreadProps(__spreadValues({
1963
+ focusStrategy
1964
+ }, overlayTriggerState), {
1965
+ open(focusStrategy2 = null) {
1966
+ setFocusStrategy(focusStrategy2);
1967
+ overlayTriggerState.open();
1968
+ },
1969
+ toggle(focusStrategy2 = null) {
1970
+ setFocusStrategy(focusStrategy2);
1971
+ overlayTriggerState.toggle();
1972
+ }
1973
+ });
1974
+ }
1975
+ const DEFAULT_MAX_ITEMS_UNTIL_SCROLL = 5;
1976
+ const DEFAULT_PLACEMENT = "bottom";
1977
+ const DEFAULT_WIDTH = "auto";
1978
+ const ITEM_HEIGHT = 32;
1979
+ const Y_PADDING_INSIDE_OVERLAY = 8;
1980
+ const OVERLAY_OFFSET = 8;
1981
+ const OVERLAY_PADDING_FROM_CONTAINER = 12;
1982
+ function getUnmergedPopoverStyles(width, triggerWidth) {
1983
+ return __spreadValues(__spreadValues(__spreadValues(__spreadValues({}, utilities_css.getComponentToken("menu", "item_height", `${utilities_css.pxToRem(ITEM_HEIGHT)}rem`)), utilities_css.getComponentToken("menu", "padding.y", `${utilities_css.pxToRem(Y_PADDING_INSIDE_OVERLAY)}rem`)), utilities_css.getComponentToken("menu", "min-width", width === "auto" ? `${triggerWidth}px` : void 0)), utilities_css.getResponsiveValue("menu", "width", width !== "auto" && width !== "fit-content" ? width : "auto"));
1984
+ }
1985
+ function useTriggerWidth(triggerRef) {
1986
+ const [triggerWidth, setTriggerWidth] = React.useState(null);
1987
+ _import.$9daab02d461809db$export$683480f191c0e3ea({
1988
+ ref: triggerRef,
1989
+ onResize: () => {
1990
+ if (triggerRef.current) {
1991
+ const { width } = triggerRef.current.getBoundingClientRect();
1992
+ setTriggerWidth(width);
1993
+ }
1994
+ }
1995
+ });
1996
+ const initialRef = React.useRef(false);
1997
+ React.useEffect(() => {
1998
+ if (triggerRef.current && !initialRef.current) {
1999
+ const { width } = triggerRef.current.getBoundingClientRect();
2000
+ setTriggerWidth(width);
2001
+ initialRef.current = true;
2002
+ }
2003
+ }, [triggerRef]);
2004
+ return triggerWidth;
2005
+ }
2006
+ exports.$168583247155ddda$export$dc9c12ed27dd1b49 = $168583247155ddda$export$dc9c12ed27dd1b49;
2007
+ exports.$2a25aae57d74318e$export$a05409b8bb224a5a = $2a25aae57d74318e$export$a05409b8bb224a5a;
2008
+ exports.$3e5eb2498db5b506$export$73f7a44322579622 = $3e5eb2498db5b506$export$73f7a44322579622;
2009
+ exports.$453cc9f0df89c0a5$export$77d5aafae4e095b2 = $453cc9f0df89c0a5$export$77d5aafae4e095b2;
2010
+ exports.$7613b1592d41b092$export$6cd28814d92fa9c9 = $7613b1592d41b092$export$6cd28814d92fa9c9;
2011
+ exports.$7af3f5b51489e0b5$export$253fe78d46329472 = $7af3f5b51489e0b5$export$253fe78d46329472;
2012
+ exports.$880e95eb8b93ba9a$export$ecf600387e221c37 = $880e95eb8b93ba9a$export$ecf600387e221c37;
2013
+ exports.$982254629710d113$export$b95089534ab7c1fd = $982254629710d113$export$b95089534ab7c1fd;
2014
+ exports.$9fc4852771d079eb$export$6e2c8f0811a474ce = $9fc4852771d079eb$export$6e2c8f0811a474ce;
2015
+ exports.$a28c903ee9ad8dc5$export$79fefeb1c2091ac3 = $a28c903ee9ad8dc5$export$79fefeb1c2091ac3;
2016
+ exports.$a2e5df62f93c7633$export$9d32628fc2aea7da = $a2e5df62f93c7633$export$9d32628fc2aea7da;
2017
+ exports.$c1d7fb2ec91bae71$export$6d08773d2e66f8f2 = $c1d7fb2ec91bae71$export$6d08773d2e66f8f2;
2018
+ exports.$d496c0a20b6e58ec$export$6c8a5aaad13c9852 = $d496c0a20b6e58ec$export$6c8a5aaad13c9852;
2019
+ exports.$d5336fe17ce95402$export$38eaa17faae8f579 = $d5336fe17ce95402$export$38eaa17faae8f579;
2020
+ exports.$f4b273590fab9f93$export$52210f68a14655d0 = $f4b273590fab9f93$export$52210f68a14655d0;
2021
+ exports.$fb3050f43d946246$export$e32c88dfddc6e1d8 = $fb3050f43d946246$export$e32c88dfddc6e1d8;
2022
+ exports.DEFAULT_MAX_ITEMS_UNTIL_SCROLL = DEFAULT_MAX_ITEMS_UNTIL_SCROLL;
2023
+ exports.DEFAULT_PLACEMENT = DEFAULT_PLACEMENT;
2024
+ exports.DEFAULT_WIDTH = DEFAULT_WIDTH;
2025
+ exports.ITEM_HEIGHT = ITEM_HEIGHT;
2026
+ exports.OVERLAY_OFFSET = OVERLAY_OFFSET;
2027
+ exports.OVERLAY_PADDING_FROM_CONTAINER = OVERLAY_PADDING_FROM_CONTAINER;
2028
+ exports.Y_PADDING_INSIDE_OVERLAY = Y_PADDING_INSIDE_OVERLAY;
2029
+ exports.getUnmergedPopoverStyles = getUnmergedPopoverStyles;
2030
+ exports.useTriggerWidth = useTriggerWidth;