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