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