@sanity/ui 4.0.0-static.2 → 4.0.0-static.21

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 (74) hide show
  1. package/dist/css/index.css +2 -1
  2. package/dist/css/index.css.map +1 -0
  3. package/dist/css/index.d.ts +29 -1
  4. package/dist/css/index.js +17965 -50
  5. package/dist/css/index.js.map +1 -1
  6. package/dist/index.d.ts +1 -1
  7. package/dist/index.js +14 -16
  8. package/dist/index.js.map +1 -1
  9. package/package.json +38 -48
  10. package/src/core/components/autocomplete/__workshop__/custom.tsx +14 -1
  11. package/src/core/components/autocomplete/__workshop__/example.tsx +12 -1
  12. package/src/core/components/dialog/__workshop__/position.tsx +9 -1
  13. package/src/core/components/dialog/__workshop__/props.tsx +2 -0
  14. package/src/core/components/menu/__workshop__/menuButton.tsx +6 -1
  15. package/src/core/components/menu/__workshop__/tones.tsx +7 -1
  16. package/src/core/components/menu/menu.tsx +1 -1
  17. package/src/core/components/menu/menuButton.tsx +10 -5
  18. package/src/core/components/menu/menuContext.ts +1 -1
  19. package/src/core/components/menu/menuGroup.tsx +7 -4
  20. package/src/core/components/menu/menuItem.tsx +1 -1
  21. package/src/core/components/toast/__workshop__/toast.tsx +2 -0
  22. package/src/core/primitives/avatar/__workshop__/asButton.tsx +8 -1
  23. package/src/core/primitives/avatar/__workshop__/stack.tsx +5 -1
  24. package/src/core/primitives/badge/__workshop__/props.tsx +12 -1
  25. package/src/core/primitives/box/__workshop__/props.tsx +6 -1
  26. package/src/core/primitives/button/__workshop__/props.tsx +22 -0
  27. package/src/core/primitives/button/__workshop__/stacked.tsx +16 -0
  28. package/src/core/primitives/card/__workshop__/props.tsx +10 -0
  29. package/src/core/primitives/card/__workshop__/selected.tsx +1 -1
  30. package/src/core/primitives/card/card.tsx +2 -2
  31. package/src/core/primitives/code/__workshop__/props.tsx +6 -1
  32. package/src/core/primitives/container/__workshop__/example.tsx +6 -1
  33. package/src/core/primitives/flex/__workshop__/example.tsx +7 -1
  34. package/src/core/primitives/heading/__workshop__/plain.tsx +12 -1
  35. package/src/core/primitives/inline/__workshop__/plain.tsx +5 -1
  36. package/src/core/primitives/label/__workshop__/plain.tsx +15 -1
  37. package/src/core/primitives/popover/__workshop__/AlignedStory.tsx +13 -1
  38. package/src/core/primitives/popover/__workshop__/MatchReferenceWidthStory.tsx +2 -0
  39. package/src/core/primitives/popover/__workshop__/PlainStory.tsx +8 -0
  40. package/src/core/primitives/popover/__workshop__/SidePanelStory.tsx +7 -1
  41. package/src/core/primitives/popover/__workshop__/TestStory.tsx +6 -0
  42. package/src/core/primitives/popover/popover.tsx +0 -1
  43. package/src/core/primitives/select/__workshop__/plain.tsx +4 -0
  44. package/src/core/primitives/skeleton/__workshop__/delay.tsx +9 -1
  45. package/src/core/primitives/skeleton/__workshop__/skeleton.tsx +9 -1
  46. package/src/core/primitives/spinner/__workshop__/Props.tsx +6 -1
  47. package/src/core/primitives/stack/__workshop__/plain.tsx +4 -1
  48. package/src/core/primitives/text/__workshop__/colored.tsx +8 -1
  49. package/src/core/primitives/text/__workshop__/example.tsx +15 -1
  50. package/src/core/primitives/textArea/__workshop__/plain.tsx +8 -0
  51. package/src/core/primitives/textInput/__workshop__/plain.tsx +34 -4
  52. package/src/core/primitives/textInput/__workshop__/typed.tsx +7 -1
  53. package/src/core/primitives/textInput/textInput.tsx +1 -1
  54. package/src/core/primitives/tooltip/__workshop__/customPortal.tsx +2 -0
  55. package/src/core/primitives/tooltip/__workshop__/overflowingBoundary.tsx +2 -0
  56. package/src/core/primitives/tooltip/__workshop__/props.tsx +12 -0
  57. package/src/core/primitives/tooltip/__workshop__/resizableBoundary.tsx +5 -0
  58. package/src/css/primitives/avatar/avatar.css.ts +9 -5
  59. package/src/css/primitives/card/__workshop__/color.tsx +9 -1
  60. package/src/css/primitives/card/card.css.ts +10 -0
  61. package/src/css/theme/buildCSSTheme.ts +4 -0
  62. package/src/css/types.ts +4 -0
  63. package/src/css/vars.css.ts +4 -0
  64. package/dist/_chunks-cjs/refractor.cjs +0 -22
  65. package/dist/_chunks-cjs/refractor.cjs.map +0 -1
  66. package/dist/css/index.cjs +0 -966
  67. package/dist/css/index.cjs.map +0 -1
  68. package/dist/css/index.d.cts +0 -1370
  69. package/dist/index.cjs +0 -4515
  70. package/dist/index.cjs.map +0 -1
  71. package/dist/index.d.cts +0 -2521
  72. package/dist/theme.cjs +0 -870
  73. package/dist/theme.cjs.map +0 -1
  74. package/dist/theme.d.cts +0 -499
package/dist/index.cjs DELETED
@@ -1,4515 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: !0 });
3
- var jsxRuntime = require("react/jsx-runtime"), icons = require("@sanity/icons"), react = require("react"), compilerRuntime = require("react/compiler-runtime"), css = require("@sanity/ui/css"), reactIs = require("react-is"), reactDom$1 = require("@floating-ui/react-dom"), framerMotion = require("framer-motion"), reactDom = require("react-dom"), dynamic = require("@vanilla-extract/dynamic"), useEffectEvent = require("use-effect-event"), resizeObserver = require("@juggle/resize-observer");
4
- const EMPTY_ARRAY = [], EMPTY_RECORD = {}, POPOVER_MOTION_PROPS = {
5
- card: {
6
- initial: {
7
- scale: 0.97,
8
- willChange: "transform"
9
- },
10
- hidden: {
11
- opacity: 0
12
- },
13
- visible: {
14
- opacity: 1,
15
- transition: {
16
- when: "beforeChildren",
17
- duration: 0.1
18
- }
19
- },
20
- scaleIn: {
21
- scale: 1
22
- },
23
- scaleOut: {
24
- scale: 0.97
25
- }
26
- },
27
- transition: {
28
- type: "spring",
29
- visualDuration: 0.2,
30
- bounce: 0.25
31
- }
32
- }, Z_OFFSETS = {
33
- dialog: 600,
34
- popover: 400,
35
- tooltip: 200
36
- };
37
- function _raf(fn) {
38
- const frameId = requestAnimationFrame(fn);
39
- return () => {
40
- cancelAnimationFrame(frameId);
41
- };
42
- }
43
- function _raf2(fn) {
44
- let innerDispose = null;
45
- const outerDispose = _raf(() => {
46
- innerDispose = _raf(fn);
47
- });
48
- return () => {
49
- innerDispose && innerDispose(), outerDispose();
50
- };
51
- }
52
- function _isEnterToClickElement(element) {
53
- return isHTMLAnchorElement(element) || isHTMLButtonElement(element);
54
- }
55
- function isHTMLElement(node) {
56
- return node instanceof Node && node.nodeType === Node.ELEMENT_NODE;
57
- }
58
- function isHTMLAnchorElement(element) {
59
- return isHTMLElement(element) && element.nodeName === "A";
60
- }
61
- function isHTMLInputElement(element) {
62
- return isHTMLElement(element) && element.nodeName === "INPUT";
63
- }
64
- function isHTMLButtonElement(element) {
65
- return isHTMLElement(element) && element.nodeName === "BUTTON";
66
- }
67
- function isHTMLSelectElement(element) {
68
- return isHTMLElement(element) && element.nodeName === "SELECT";
69
- }
70
- function isHTMLTextAreaElement(element) {
71
- return isHTMLElement(element) && element.nodeName === "TEXTAREA";
72
- }
73
- function containsOrEqualsElement(element, node) {
74
- return element.contains(node) || element === node;
75
- }
76
- function _hasFocus(element) {
77
- return !!document.activeElement && element.contains(document.activeElement);
78
- }
79
- function isFocusable(element) {
80
- return element.tabIndex > 0 || element.tabIndex === 0 && element.getAttribute("tabIndex") !== null ? !0 : isHTMLAnchorElement(element) ? !!element.href && element.rel !== "ignore" : isHTMLInputElement(element) ? element.type !== "hidden" && element.type !== "file" && !element.disabled : isHTMLButtonElement(element) || isHTMLSelectElement(element) || isHTMLTextAreaElement(element) ? !element.disabled : !1;
81
- }
82
- function attemptFocus(element) {
83
- if (!isFocusable(element))
84
- return !1;
85
- try {
86
- element.focus();
87
- } catch {
88
- }
89
- return document.activeElement === element;
90
- }
91
- function focusFirstDescendant(element) {
92
- for (let i = 0; i < element.childNodes.length; i++) {
93
- const child = element.childNodes[i];
94
- if (isHTMLElement(child) && (attemptFocus(child) || focusFirstDescendant(child)))
95
- return !0;
96
- }
97
- return !1;
98
- }
99
- function focusLastDescendant(element) {
100
- for (let i = element.childNodes.length - 1; i >= 0; i--) {
101
- const child = element.childNodes[i];
102
- if (isHTMLElement(child) && (attemptFocus(child) || focusLastDescendant(child)))
103
- return !0;
104
- }
105
- return !1;
106
- }
107
- function isArray(val) {
108
- return Array.isArray(val);
109
- }
110
- function isRecord(value) {
111
- return !!(value && typeof value == "object" && !Array.isArray(value));
112
- }
113
- function _getArrayProp(val, defaultVal) {
114
- return val === void 0 ? defaultVal || EMPTY_ARRAY : Array.isArray(val) ? val : [val];
115
- }
116
- function _getResponsiveProp(val, defaultVal) {
117
- return val === void 0 ? defaultVal || EMPTY_ARRAY : isArray(val) || isRecord(val) ? val : [val];
118
- }
119
- function useResponsiveProp(val, defaultVal) {
120
- const $ = compilerRuntime.c(3);
121
- let t0;
122
- $[0] !== defaultVal || $[1] !== val ? (t0 = () => [_getResponsiveProp(val, defaultVal), JSON.stringify(val ?? defaultVal)], $[0] = defaultVal, $[1] = val, $[2] = t0) : t0 = $[2];
123
- const [t1, setCache] = react.useState(t0), [cachedVal, cachedHash] = t1, hash = JSON.stringify(val ?? defaultVal);
124
- return hash !== cachedHash && setCache([_getResponsiveProp(val, defaultVal), hash]), cachedVal;
125
- }
126
- const DEFAULT_BOX_ELEMENT = "div";
127
- function Box(props) {
128
- const $ = compilerRuntime.c(132), t0 = props;
129
- let alignItems, borderBottom, borderLeft, borderRight, borderTop, children, className, flex, flexDirection, flexWrap, gap, gapX, gapY, gridAutoColumns, gridAutoFlow, gridAutoRows, gridColumn, gridColumnEnd, gridColumnStart, gridRow, gridRowEnd, gridRowStart, gridTemplateColumns, gridTemplateRows, height, inset, insetBottom, insetLeft, insetRight, insetTop, justifyContent, marginBottom, marginLeft, marginRight, marginTop, marginX, marginY, maxWidth, muted, outline, overflow, overflowX, overflowY, paddingBottom, paddingLeft, paddingRight, paddingTop, paddingX, paddingY, pointerEvents, position, radius, rest, shadow, t1, t2, t3, t4, t5, t6, t7, t8, textAlign, width;
130
- $[0] !== t0 ? ({
131
- alignItems,
132
- as: t1,
133
- border: t2,
134
- borderTop,
135
- borderRight,
136
- borderBottom,
137
- borderLeft,
138
- className,
139
- children,
140
- display: t3,
141
- flex,
142
- flexDirection,
143
- flexWrap,
144
- gap,
145
- gapX,
146
- gapY,
147
- gridAutoColumns,
148
- gridAutoFlow,
149
- gridAutoRows,
150
- gridColumn,
151
- gridColumnEnd,
152
- gridColumnStart,
153
- gridRow,
154
- gridRowEnd,
155
- gridRowStart,
156
- gridTemplateColumns,
157
- gridTemplateRows,
158
- height,
159
- inset,
160
- insetBottom,
161
- insetLeft,
162
- insetRight,
163
- insetTop,
164
- justifyContent,
165
- margin: t4,
166
- marginX,
167
- marginY,
168
- marginTop,
169
- marginRight,
170
- marginBottom,
171
- marginLeft,
172
- maxWidth,
173
- minHeight: t5,
174
- minWidth: t6,
175
- muted,
176
- outline,
177
- overflow,
178
- overflowX,
179
- overflowY,
180
- padding: t7,
181
- paddingX,
182
- paddingY,
183
- paddingTop,
184
- paddingRight,
185
- paddingBottom,
186
- paddingLeft,
187
- pointerEvents,
188
- position,
189
- radius,
190
- shadow,
191
- sizing: t8,
192
- textAlign,
193
- width,
194
- ...rest
195
- } = t0, $[0] = t0, $[1] = alignItems, $[2] = borderBottom, $[3] = borderLeft, $[4] = borderRight, $[5] = borderTop, $[6] = children, $[7] = className, $[8] = flex, $[9] = flexDirection, $[10] = flexWrap, $[11] = gap, $[12] = gapX, $[13] = gapY, $[14] = gridAutoColumns, $[15] = gridAutoFlow, $[16] = gridAutoRows, $[17] = gridColumn, $[18] = gridColumnEnd, $[19] = gridColumnStart, $[20] = gridRow, $[21] = gridRowEnd, $[22] = gridRowStart, $[23] = gridTemplateColumns, $[24] = gridTemplateRows, $[25] = height, $[26] = inset, $[27] = insetBottom, $[28] = insetLeft, $[29] = insetRight, $[30] = insetTop, $[31] = justifyContent, $[32] = marginBottom, $[33] = marginLeft, $[34] = marginRight, $[35] = marginTop, $[36] = marginX, $[37] = marginY, $[38] = maxWidth, $[39] = muted, $[40] = outline, $[41] = overflow, $[42] = overflowX, $[43] = overflowY, $[44] = paddingBottom, $[45] = paddingLeft, $[46] = paddingRight, $[47] = paddingTop, $[48] = paddingX, $[49] = paddingY, $[50] = pointerEvents, $[51] = position, $[52] = radius, $[53] = rest, $[54] = shadow, $[55] = t1, $[56] = t2, $[57] = t3, $[58] = t4, $[59] = t5, $[60] = t6, $[61] = t7, $[62] = t8, $[63] = textAlign, $[64] = width) : (alignItems = $[1], borderBottom = $[2], borderLeft = $[3], borderRight = $[4], borderTop = $[5], children = $[6], className = $[7], flex = $[8], flexDirection = $[9], flexWrap = $[10], gap = $[11], gapX = $[12], gapY = $[13], gridAutoColumns = $[14], gridAutoFlow = $[15], gridAutoRows = $[16], gridColumn = $[17], gridColumnEnd = $[18], gridColumnStart = $[19], gridRow = $[20], gridRowEnd = $[21], gridRowStart = $[22], gridTemplateColumns = $[23], gridTemplateRows = $[24], height = $[25], inset = $[26], insetBottom = $[27], insetLeft = $[28], insetRight = $[29], insetTop = $[30], justifyContent = $[31], marginBottom = $[32], marginLeft = $[33], marginRight = $[34], marginTop = $[35], marginX = $[36], marginY = $[37], maxWidth = $[38], muted = $[39], outline = $[40], overflow = $[41], overflowX = $[42], overflowY = $[43], paddingBottom = $[44], paddingLeft = $[45], paddingRight = $[46], paddingTop = $[47], paddingX = $[48], paddingY = $[49], pointerEvents = $[50], position = $[51], radius = $[52], rest = $[53], shadow = $[54], t1 = $[55], t2 = $[56], t3 = $[57], t4 = $[58], t5 = $[59], t6 = $[60], t7 = $[61], t8 = $[62], textAlign = $[63], width = $[64]);
196
- const Element2 = t1 === void 0 ? DEFAULT_BOX_ELEMENT : t1, border = t2 === void 0 ? !1 : t2, display = t3 === void 0 ? "block" : t3, margin = t4 === void 0 ? 0 : t4, minHeight = t5 === void 0 ? 0 : t5, minWidth = t6 === void 0 ? 0 : t6, padding = t7 === void 0 ? 0 : t7, sizing = t8 === void 0 ? "border" : t8;
197
- let t9;
198
- $[65] !== alignItems || $[66] !== border || $[67] !== borderBottom || $[68] !== borderLeft || $[69] !== borderRight || $[70] !== borderTop || $[71] !== className || $[72] !== display || $[73] !== flex || $[74] !== flexDirection || $[75] !== flexWrap || $[76] !== gap || $[77] !== gapX || $[78] !== gapY || $[79] !== gridAutoColumns || $[80] !== gridAutoFlow || $[81] !== gridAutoRows || $[82] !== gridColumn || $[83] !== gridColumnEnd || $[84] !== gridColumnStart || $[85] !== gridRow || $[86] !== gridRowEnd || $[87] !== gridRowStart || $[88] !== gridTemplateColumns || $[89] !== gridTemplateRows || $[90] !== height || $[91] !== inset || $[92] !== insetBottom || $[93] !== insetLeft || $[94] !== insetRight || $[95] !== insetTop || $[96] !== justifyContent || $[97] !== margin || $[98] !== marginBottom || $[99] !== marginLeft || $[100] !== marginRight || $[101] !== marginTop || $[102] !== marginX || $[103] !== marginY || $[104] !== maxWidth || $[105] !== minHeight || $[106] !== minWidth || $[107] !== muted || $[108] !== outline || $[109] !== overflow || $[110] !== overflowX || $[111] !== overflowY || $[112] !== padding || $[113] !== paddingBottom || $[114] !== paddingLeft || $[115] !== paddingRight || $[116] !== paddingTop || $[117] !== paddingX || $[118] !== paddingY || $[119] !== pointerEvents || $[120] !== position || $[121] !== radius || $[122] !== shadow || $[123] !== sizing || $[124] !== textAlign || $[125] !== width ? (t9 = css.box({
199
- className,
200
- alignItems,
201
- border,
202
- borderTop,
203
- borderRight,
204
- borderBottom,
205
- borderLeft,
206
- display,
207
- flex,
208
- flexDirection,
209
- flexWrap,
210
- gap,
211
- gapX,
212
- gapY,
213
- gridAutoColumns,
214
- gridAutoFlow,
215
- gridAutoRows,
216
- gridColumn,
217
- gridColumnEnd,
218
- gridColumnStart,
219
- gridRow,
220
- gridRowEnd,
221
- gridRowStart,
222
- gridTemplateColumns,
223
- gridTemplateRows,
224
- height,
225
- inset,
226
- insetBottom,
227
- insetLeft,
228
- insetRight,
229
- insetTop,
230
- justifyContent,
231
- margin,
232
- marginX,
233
- marginY,
234
- marginTop,
235
- marginRight,
236
- marginBottom,
237
- marginLeft,
238
- maxWidth,
239
- minHeight,
240
- minWidth,
241
- muted,
242
- outline,
243
- overflow,
244
- overflowX,
245
- overflowY,
246
- padding,
247
- paddingX,
248
- paddingY,
249
- paddingTop,
250
- paddingRight,
251
- paddingBottom,
252
- paddingLeft,
253
- pointerEvents,
254
- position,
255
- radius,
256
- shadow,
257
- sizing,
258
- textAlign,
259
- width
260
- }), $[65] = alignItems, $[66] = border, $[67] = borderBottom, $[68] = borderLeft, $[69] = borderRight, $[70] = borderTop, $[71] = className, $[72] = display, $[73] = flex, $[74] = flexDirection, $[75] = flexWrap, $[76] = gap, $[77] = gapX, $[78] = gapY, $[79] = gridAutoColumns, $[80] = gridAutoFlow, $[81] = gridAutoRows, $[82] = gridColumn, $[83] = gridColumnEnd, $[84] = gridColumnStart, $[85] = gridRow, $[86] = gridRowEnd, $[87] = gridRowStart, $[88] = gridTemplateColumns, $[89] = gridTemplateRows, $[90] = height, $[91] = inset, $[92] = insetBottom, $[93] = insetLeft, $[94] = insetRight, $[95] = insetTop, $[96] = justifyContent, $[97] = margin, $[98] = marginBottom, $[99] = marginLeft, $[100] = marginRight, $[101] = marginTop, $[102] = marginX, $[103] = marginY, $[104] = maxWidth, $[105] = minHeight, $[106] = minWidth, $[107] = muted, $[108] = outline, $[109] = overflow, $[110] = overflowX, $[111] = overflowY, $[112] = padding, $[113] = paddingBottom, $[114] = paddingLeft, $[115] = paddingRight, $[116] = paddingTop, $[117] = paddingX, $[118] = paddingY, $[119] = pointerEvents, $[120] = position, $[121] = radius, $[122] = shadow, $[123] = sizing, $[124] = textAlign, $[125] = width, $[126] = t9) : t9 = $[126];
261
- let t10;
262
- return $[127] !== Element2 || $[128] !== children || $[129] !== rest || $[130] !== t9 ? (t10 = /* @__PURE__ */ jsxRuntime.jsx(Element2, { "data-ui": "Box", ...rest, className: t9, children }), $[127] = Element2, $[128] = children, $[129] = rest, $[130] = t9, $[131] = t10) : t10 = $[131], t10;
263
- }
264
- const DEFAULT_TEXT_ELEMENT = "div";
265
- function Text(props) {
266
- const $ = compilerRuntime.c(30), t0 = props;
267
- let align, children, className, flex, muted, rest, t1, t2, t3, t4, textOverflowProp;
268
- $[0] !== t0 ? ({
269
- align,
270
- as: t1,
271
- children,
272
- className,
273
- flex,
274
- maxWidth: t2,
275
- muted,
276
- size: t3,
277
- textOverflow: textOverflowProp,
278
- weight: t4,
279
- ...rest
280
- } = t0, $[0] = t0, $[1] = align, $[2] = children, $[3] = className, $[4] = flex, $[5] = muted, $[6] = rest, $[7] = t1, $[8] = t2, $[9] = t3, $[10] = t4, $[11] = textOverflowProp) : (align = $[1], children = $[2], className = $[3], flex = $[4], muted = $[5], rest = $[6], t1 = $[7], t2 = $[8], t3 = $[9], t4 = $[10], textOverflowProp = $[11]);
281
- const Element2 = t1 === void 0 ? DEFAULT_TEXT_ELEMENT : t1, maxWidth = t2 === void 0 ? "fill" : t2, size2 = t3 === void 0 ? 2 : t3, weight = t4 === void 0 ? "regular" : t4;
282
- let t5;
283
- $[12] !== align || $[13] !== className || $[14] !== flex || $[15] !== maxWidth || $[16] !== muted || $[17] !== size2 || $[18] !== weight ? (t5 = css.text({
284
- className,
285
- align,
286
- flex,
287
- maxWidth,
288
- muted,
289
- size: size2,
290
- weight
291
- }), $[12] = align, $[13] = className, $[14] = flex, $[15] = maxWidth, $[16] = muted, $[17] = size2, $[18] = weight, $[19] = t5) : t5 = $[19];
292
- let t6;
293
- $[20] !== textOverflowProp ? (t6 = css.textOverflow({
294
- textOverflow: textOverflowProp
295
- }), $[20] = textOverflowProp, $[21] = t6) : t6 = $[21];
296
- let t7;
297
- $[22] !== children || $[23] !== t6 ? (t7 = /* @__PURE__ */ jsxRuntime.jsx("span", { className: t6, children }), $[22] = children, $[23] = t6, $[24] = t7) : t7 = $[24];
298
- let t8;
299
- return $[25] !== Element2 || $[26] !== rest || $[27] !== t5 || $[28] !== t7 ? (t8 = /* @__PURE__ */ jsxRuntime.jsx(Element2, { "data-ui": "Text", ...rest, className: t5, children: t7 }), $[25] = Element2, $[26] = rest, $[27] = t5, $[28] = t7, $[29] = t8) : t8 = $[29], t8;
300
- }
301
- function AnimatedSpinnerIcon(props) {
302
- const $ = compilerRuntime.c(5);
303
- let rest;
304
- $[0] !== props ? ({
305
- ...rest
306
- } = props, $[0] = props, $[1] = rest) : rest = $[1];
307
- let t0;
308
- $[2] === Symbol.for("react.memo_cache_sentinel") ? (t0 = css.animatedSpinnerIcon(), $[2] = t0) : t0 = $[2];
309
- let t1;
310
- return $[3] !== rest ? (t1 = /* @__PURE__ */ jsxRuntime.jsx(icons.SpinnerIcon, { "data-sanity-icon": "animated-spinner", ...rest, className: t0 }), $[3] = rest, $[4] = t1) : t1 = $[4], t1;
311
- }
312
- const DEFAULT_SPINNER_ELEMENT = "div";
313
- function Spinner(props) {
314
- const $ = compilerRuntime.c(11), t0 = props;
315
- let className, rest, t1;
316
- $[0] !== t0 ? ({
317
- as: t1,
318
- className,
319
- ...rest
320
- } = t0, $[0] = t0, $[1] = className, $[2] = rest, $[3] = t1) : (className = $[1], rest = $[2], t1 = $[3]);
321
- const as = t1 === void 0 ? DEFAULT_SPINNER_ELEMENT : t1;
322
- let t2;
323
- $[4] !== className ? (t2 = css.spinner({
324
- className
325
- }), $[4] = className, $[5] = t2) : t2 = $[5];
326
- let t3;
327
- $[6] === Symbol.for("react.memo_cache_sentinel") ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(AnimatedSpinnerIcon, {}), $[6] = t3) : t3 = $[6];
328
- let t4;
329
- return $[7] !== as || $[8] !== rest || $[9] !== t2 ? (t4 = /* @__PURE__ */ jsxRuntime.jsx(Text, { as, "data-ui": "Spinner", ...rest, className: t2, children: t3 }), $[7] = as, $[8] = rest, $[9] = t2, $[10] = t4) : t4 = $[10], t4;
330
- }
331
- const DEFAULT_BUTTON_ELEMENT = "button";
332
- function Button(props) {
333
- const {
334
- align = "center",
335
- as: Element2 = DEFAULT_BUTTON_ELEMENT,
336
- children,
337
- className,
338
- disabled,
339
- flex,
340
- fontSize = 1,
341
- gap = props.padding ?? 3,
342
- gapX,
343
- gapY,
344
- icon: IconComponent,
345
- iconRight: IconRightComponent,
346
- justify = "center",
347
- loading,
348
- mode = "default",
349
- padding = 3,
350
- paddingX,
351
- paddingY,
352
- paddingTop,
353
- paddingBottom,
354
- paddingLeft,
355
- paddingRight,
356
- radius = 2,
357
- selected,
358
- text,
359
- textAlign,
360
- textOverflow = "ellipsis",
361
- textWeight = "medium",
362
- tone = "default",
363
- type = "button",
364
- muted = !1,
365
- width,
366
- ...rest
367
- } = props;
368
- let href;
369
- return "href" in rest && (href = typeof rest.href == "string" ? rest.href : href, delete rest.href), /* @__PURE__ */ jsxRuntime.jsxs(
370
- Element2,
371
- {
372
- "data-ui": "Button",
373
- ...rest,
374
- className: css.button({
375
- className,
376
- flex,
377
- mode,
378
- radius,
379
- tone,
380
- width
381
- }),
382
- "data-disabled": loading || disabled ? "" : void 0,
383
- "data-selected": selected ? "" : void 0,
384
- disabled: !!(loading || disabled),
385
- href: disabled ? void 0 : href,
386
- type,
387
- children: [
388
- !!loading && /* @__PURE__ */ jsxRuntime.jsx(Box, { alignItems: "center", as: "span", className: css.buttonLoadingBox(), display: "flex", flex: 1, justifyContent: "center", width: "fill", children: /* @__PURE__ */ jsxRuntime.jsx(Spinner, { size: fontSize }) }),
389
- (IconComponent || text || IconRightComponent) && /* @__PURE__ */ jsxRuntime.jsxs(Box, { alignItems: align, as: "span", display: "flex", flex: 1, gap, gapX, gapY, justifyContent: justify, padding, paddingX, paddingY, paddingTop, paddingBottom, paddingLeft, paddingRight, children: [
390
- IconComponent && /* @__PURE__ */ jsxRuntime.jsxs(Text, { as: "span", flex: "none", muted: !0, size: fontSize, children: [
391
- react.isValidElement(IconComponent) && IconComponent,
392
- reactIs.isValidElementType(IconComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconComponent, {})
393
- ] }),
394
- text && /* @__PURE__ */ jsxRuntime.jsx(Box, { as: "span", maxWidth: "auto", children: /* @__PURE__ */ jsxRuntime.jsx(Text, { align: textAlign, as: "span", muted, size: fontSize, textOverflow, weight: textWeight, children: text }) }),
395
- IconRightComponent && /* @__PURE__ */ jsxRuntime.jsxs(Text, { as: "span", flex: "none", muted: !0, size: fontSize, children: [
396
- react.isValidElement(IconRightComponent) && IconRightComponent,
397
- reactIs.isValidElementType(IconRightComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconRightComponent, {})
398
- ] })
399
- ] }),
400
- children && /* @__PURE__ */ jsxRuntime.jsx(Box, { as: "span", flex: 1, padding, paddingX, paddingY, paddingTop, paddingBottom, paddingLeft, paddingRight, children })
401
- ]
402
- }
403
- );
404
- }
405
- function useMatchMedia(mediaQueryString, getServerSnapshot2) {
406
- const $ = compilerRuntime.c(4);
407
- react.useDebugValue(mediaQueryString);
408
- let t0;
409
- $[0] !== mediaQueryString ? (t0 = (onStoreChange) => {
410
- const media2 = window.matchMedia(mediaQueryString);
411
- return media2.addEventListener("change", onStoreChange), () => media2.removeEventListener("change", onStoreChange);
412
- }, $[0] = mediaQueryString, $[1] = t0) : t0 = $[1];
413
- let t1;
414
- return $[2] !== mediaQueryString ? (t1 = () => window.matchMedia(mediaQueryString).matches, $[2] = mediaQueryString, $[3] = t1) : t1 = $[3], react.useSyncExternalStore(t0, t1, getServerSnapshot2);
415
- }
416
- function usePrefersReducedMotion(t0) {
417
- return useMatchMedia("(prefers-reduced-motion: reduce)", t0 === void 0 ? _temp$a : t0);
418
- }
419
- function _temp$a() {
420
- return !1;
421
- }
422
- const origin = {
423
- name: "@sanity/ui/origin",
424
- fn({
425
- middlewareData,
426
- placement,
427
- rects
428
- }) {
429
- const [side] = placement.split("-"), floatingWidth = rects.floating.width, floatingHeight = rects.floating.height, shiftX = middlewareData.shift?.x || 0, shiftY = middlewareData.shift?.y || 0;
430
- if (floatingWidth <= 0 || floatingHeight <= 0)
431
- return {};
432
- const isVerticalPlacement = ["bottom", "top"].includes(side), {
433
- originX,
434
- originY
435
- } = isVerticalPlacement ? {
436
- originX: clamp(0.5 - shiftX / floatingWidth, 0, 1),
437
- originY: side === "bottom" ? 0 : 1
438
- } : {
439
- originX: side === "left" ? 1 : 0,
440
- originY: clamp(0.5 - shiftY / floatingHeight, 0, 1)
441
- };
442
- return {
443
- data: {
444
- originX,
445
- originY
446
- }
447
- };
448
- }
449
- };
450
- function clamp(num, min, max) {
451
- return Math.min(Math.max(num, min), max);
452
- }
453
- function getGlobalScope() {
454
- if (typeof globalThis < "u") return globalThis;
455
- if (typeof window < "u") return window;
456
- if (typeof self < "u") return self;
457
- if (typeof global < "u") return global;
458
- throw new Error("@sanity/ui: could not locate global scope");
459
- }
460
- const globalScope = getGlobalScope();
461
- function createGlobalScopedContext(key2, defaultValue) {
462
- const symbol = Symbol.for(key2);
463
- if (typeof document > "u")
464
- return react.createContext(defaultValue);
465
- const symbolMap = globalScope;
466
- return symbolMap[symbol] = symbolMap[symbol] || react.createContext(defaultValue), symbolMap[symbol];
467
- }
468
- const BoundaryElementContext = createGlobalScopedContext("@sanity/ui/v3/boundaryElement", null), DEFAULT_VALUE = {
469
- version: 0,
470
- element: null
471
- };
472
- function useBoundaryElement() {
473
- const value = react.useContext(BoundaryElementContext);
474
- if (value && (!isRecord(value) || value.version !== 0))
475
- throw new Error("useBoundaryElement(): the context value is not compatible");
476
- return value || DEFAULT_VALUE;
477
- }
478
- function getElementRef(element) {
479
- let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get, mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
480
- return mayWarn ? element.ref : (getter = Object.getOwnPropertyDescriptor(element, "ref")?.get, mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning, mayWarn ? element.props.ref : element.props.ref || element.ref);
481
- }
482
- const CardContext = createGlobalScopedContext("@sanity/ui/v3/card", null);
483
- function CardProvider(props) {
484
- const $ = compilerRuntime.c(7), {
485
- children,
486
- tone,
487
- scheme,
488
- unstable_CompatProvider
489
- } = props;
490
- let t0, t1;
491
- $[0] !== scheme || $[1] !== tone || $[2] !== unstable_CompatProvider ? (t1 = {
492
- tone,
493
- scheme,
494
- unstable_CompatProvider
495
- }, $[0] = scheme, $[1] = tone, $[2] = unstable_CompatProvider, $[3] = t1) : t1 = $[3], t0 = t1;
496
- let t2;
497
- return $[4] !== children || $[5] !== t0 ? (t2 = /* @__PURE__ */ jsxRuntime.jsx(CardContext.Provider, { value: t0, children }), $[4] = children, $[5] = t0, $[6] = t2) : t2 = $[6], t2;
498
- }
499
- function useCard() {
500
- const card = react.useContext(CardContext);
501
- if (!card)
502
- throw new Error("useCard(): missing context value");
503
- return card;
504
- }
505
- const key = "@sanity/ui/v3/portal", elementKey = Symbol.for(`${key}/element`), elementMap = globalScope;
506
- elementMap[elementKey] = null;
507
- const defaultContextValue = {
508
- version: 0,
509
- boundaryElement: null,
510
- get element() {
511
- return typeof document > "u" ? null : (elementMap[elementKey] || (elementMap[elementKey] = document.createElement("div"), elementMap[elementKey].setAttribute("data-portal", ""), document.body.appendChild(elementMap[elementKey])), elementMap[elementKey]);
512
- }
513
- }, PortalContext = createGlobalScopedContext(key, defaultContextValue);
514
- function usePortal() {
515
- const value = react.useContext(PortalContext);
516
- if (!value)
517
- throw new Error("usePortal(): missing context value");
518
- if (!isRecord(value) || value.version !== 0)
519
- throw new Error("usePortal(): the context value is not compatible");
520
- return value;
521
- }
522
- function Portal(props) {
523
- const $ = compilerRuntime.c(6), {
524
- children,
525
- __unstable_name: name
526
- } = props, card = useCard(), portal = usePortal(), portalElement = (name ? portal.elements && portal.elements[name] : portal.element) || portal.elements?.default;
527
- if (!portalElement)
528
- return null;
529
- let t0;
530
- $[0] !== card.scheme || $[1] !== children ? (t0 = /* @__PURE__ */ jsxRuntime.jsx(CardProvider, { tone: "transparent", scheme: card.scheme, children }), $[0] = card.scheme, $[1] = children, $[2] = t0) : t0 = $[2];
531
- let t1;
532
- return $[3] !== portalElement || $[4] !== t0 ? (t1 = reactDom.createPortal(t0, portalElement), $[3] = portalElement, $[4] = t0, $[5] = t1) : t1 = $[5], t1;
533
- }
534
- function getLayerContext(contextValue) {
535
- if (!isRecord(contextValue) || contextValue.version !== 0)
536
- throw new Error("the context value is not compatible");
537
- if (!contextValue)
538
- throw new Error("components using `useLayer()` should be wrapped in a <LayerProvider>.");
539
- if (contextValue.version === 0)
540
- return contextValue;
541
- throw new Error("could not get layer context");
542
- }
543
- const LayerContext = createGlobalScopedContext("@sanity/ui/v3/layer", null);
544
- function useLayer() {
545
- const $ = compilerRuntime.c(2), value = react.useContext(LayerContext);
546
- if (!value)
547
- throw new Error("useLayer(): missing context value");
548
- try {
549
- let t1;
550
- return $[0] !== value ? (t1 = getLayerContext(value), $[0] = value, $[1] = t1) : t1 = $[1], t1;
551
- } catch (t0) {
552
- const err = t0;
553
- throw err instanceof Error ? new Error(`useLayer(): ${err.message}`) : new Error(`useLayer(): ${err}`);
554
- }
555
- }
556
- const DEFAULT_POPOVER_DISTANCE = 4, DEFAULT_POPOVER_PADDING = 4, DEFAULT_POPOVER_ARROW_WIDTH = 19, DEFAULT_POPOVER_ARROW_HEIGHT = 8, DEFAULT_POPOVER_ARROW_RADIUS = 2, DEFAULT_POPOVER_MARGINS = [0, 0, 0, 0], DEFAULT_FALLBACK_PLACEMENTS$1 = {
557
- top: ["bottom", "left", "right"],
558
- "top-start": ["bottom-start", "left-start", "right-start"],
559
- "top-end": ["bottom-end", "left-end", "right-end"],
560
- bottom: ["top", "left", "right"],
561
- "bottom-start": ["top-start", "left-start", "right-start"],
562
- "bottom-end": ["top-end", "left-end", "right-end"],
563
- left: ["right", "top", "bottom"],
564
- "left-start": ["right-start", "top-start", "bottom-start"],
565
- "left-end": ["right-end", "top-end", "bottom-end"],
566
- right: ["left", "top", "bottom"],
567
- "right-start": ["left-start", "top-start", "bottom-start"],
568
- "right-end": ["left-end", "top-end", "bottom-end"]
569
- };
570
- function size(options) {
571
- const {
572
- apply,
573
- margins,
574
- padding = 0
575
- } = options;
576
- return {
577
- name: "@sanity/ui/size",
578
- async fn(args) {
579
- const {
580
- elements,
581
- placement,
582
- platform,
583
- rects
584
- } = args, {
585
- floating,
586
- reference
587
- } = rects, overflow = await reactDom$1.detectOverflow(args, {
588
- altBoundary: !0,
589
- boundary: options.boundaryElement || void 0,
590
- elementContext: "floating",
591
- padding,
592
- rootBoundary: "viewport"
593
- });
594
- let maxWidth = 1 / 0, maxHeight = 1 / 0;
595
- const floatingW = floating.width, floatingH = floating.height;
596
- placement.includes("top") && (maxWidth = floatingW - (overflow.left + overflow.right), maxHeight = floatingH - overflow.top), placement.includes("right") && (maxWidth = floatingW - overflow.right, maxHeight = floatingH - (overflow.top + overflow.bottom)), placement.includes("bottom") && (maxWidth = floatingW - (overflow.left + overflow.right), maxHeight = floatingH - overflow.bottom), placement.includes("left") && (maxWidth = floatingW - overflow.left, maxHeight = floatingH - (overflow.top + overflow.bottom)), apply({
597
- availableWidth: maxWidth - margins[1] - margins[3],
598
- availableHeight: maxHeight - margins[0] - margins[2],
599
- elements,
600
- referenceWidth: reference.width - margins[1] - margins[3]
601
- });
602
- const nextDimensions = await platform.getDimensions(elements.floating), targetH = nextDimensions.height, targetW = nextDimensions.width;
603
- return floatingW !== targetW || floatingH !== targetH ? {
604
- reset: {
605
- rects: !0
606
- }
607
- } : {};
608
- }
609
- };
610
- }
611
- function moveTowardsLength(movingPoint, targetPoint, amount) {
612
- const width = targetPoint.x - movingPoint.x, height = targetPoint.y - movingPoint.y, distance = Math.sqrt(width * width + height * height);
613
- return moveTowardsFractional(movingPoint, targetPoint, Math.min(1, amount / distance));
614
- }
615
- function moveTowardsFractional(movingPoint, targetPoint, fraction) {
616
- return {
617
- x: movingPoint.x + (targetPoint.x - movingPoint.x) * fraction,
618
- y: movingPoint.y + (targetPoint.y - movingPoint.y) * fraction
619
- };
620
- }
621
- function getRoundedCommands(points) {
622
- const len = points.length, cmds = [];
623
- for (let i = 0; i < len; i += 1) {
624
- const point = points[i], prevPoint = points[i - 1], nextPoint = points[i + 1];
625
- if (prevPoint && point.radius) {
626
- const curveStart = moveTowardsLength(point, prevPoint, point.radius), curveEnd = moveTowardsLength(point, nextPoint, point.radius), startControl = moveTowardsFractional(curveStart, point, 0.5), endControl = moveTowardsFractional(point, curveEnd, 0.5);
627
- cmds.push({
628
- type: "point",
629
- ...curveStart
630
- }), cmds.push({
631
- type: "curve",
632
- curveEnd,
633
- startControl,
634
- endControl
635
- });
636
- } else
637
- cmds.push({
638
- type: "point",
639
- ...point
640
- });
641
- }
642
- return cmds;
643
- }
644
- function compileCommands(cmds) {
645
- return cmds.map((n, idx) => n.type === "point" ? `${idx === 0 ? "M" : "L"} ${n.x} ${n.y}` : n.type === "curve" ? `C ${n.startControl.x} ${n.startControl.y} ${n.endControl.x} ${n.endControl.y} ${n.curveEnd.x} ${n.curveEnd.y}` : "").join(" ");
646
- }
647
- const DEFAULT_ARROW_ELEMENT = "div";
648
- function Arrow(props) {
649
- const $ = compilerRuntime.c(34), t0 = props;
650
- let h, rest, style, t1, t2, w;
651
- $[0] !== t0 ? ({
652
- as: t1,
653
- width: w,
654
- height: h,
655
- radius: t2,
656
- style,
657
- ...rest
658
- } = t0, $[0] = t0, $[1] = h, $[2] = rest, $[3] = style, $[4] = t1, $[5] = t2, $[6] = w) : (h = $[1], rest = $[2], style = $[3], t1 = $[4], t2 = $[5], w = $[6]);
659
- const Element2 = t1 === void 0 ? DEFAULT_ARROW_ELEMENT : t1, radius = t2 === void 0 ? 0 : t2, center = w / 2;
660
- let t3;
661
- const points = [{
662
- x: 0,
663
- y: 0
664
- }, {
665
- x: radius,
666
- y: 0,
667
- radius
668
- }, {
669
- x: center,
670
- y: h - 1,
671
- radius
672
- }, {
673
- x: w - radius,
674
- y: 0,
675
- radius
676
- }, {
677
- x: w,
678
- y: 0
679
- }], cmds = getRoundedCommands(points);
680
- t3 = compileCommands(cmds);
681
- const path = t3, strokePath = `${path}`, fillPath = `${path} M ${w} -1 M 0 -1 Z`;
682
- let t4;
683
- $[7] === Symbol.for("react.memo_cache_sentinel") ? (t4 = css._arrow(), $[7] = t4) : t4 = $[7];
684
- const t5 = `${w}px`;
685
- let t6;
686
- $[8] !== t5 ? (t6 = dynamic.assignInlineVars({
687
- [css.vars.arrow.size]: t5
688
- }), $[8] = t5, $[9] = t6) : t6 = $[9];
689
- let t7;
690
- $[10] !== style || $[11] !== t6 ? (t7 = {
691
- ...style,
692
- ...t6
693
- }, $[10] = style, $[11] = t6, $[12] = t7) : t7 = $[12];
694
- let t8;
695
- $[13] === Symbol.for("react.memo_cache_sentinel") ? (t8 = css._arrowSvg(), $[13] = t8) : t8 = $[13];
696
- const t9 = `0 0 ${w} ${w}`;
697
- let t10;
698
- $[14] === Symbol.for("react.memo_cache_sentinel") ? (t10 = css._arrowStrokeMask(), $[14] = t10) : t10 = $[14];
699
- let t11;
700
- $[15] !== w ? (t11 = /* @__PURE__ */ jsxRuntime.jsx("mask", { id: "stroke-mask", children: /* @__PURE__ */ jsxRuntime.jsx("rect", { className: t10, x: 0, width: w, height: w, fill: "white" }) }), $[15] = w, $[16] = t11) : t11 = $[16];
701
- let t12;
702
- $[17] === Symbol.for("react.memo_cache_sentinel") ? (t12 = css._arrowStroke(), $[17] = t12) : t12 = $[17];
703
- let t13;
704
- $[18] !== strokePath ? (t13 = /* @__PURE__ */ jsxRuntime.jsx("path", { className: t12, d: strokePath, mask: "url(#stroke-mask)" }), $[18] = strokePath, $[19] = t13) : t13 = $[19];
705
- let t14;
706
- $[20] === Symbol.for("react.memo_cache_sentinel") ? (t14 = css._arrowShape(), $[20] = t14) : t14 = $[20];
707
- let t15;
708
- $[21] !== fillPath ? (t15 = /* @__PURE__ */ jsxRuntime.jsx("path", { className: t14, d: fillPath }), $[21] = fillPath, $[22] = t15) : t15 = $[22];
709
- let t16;
710
- $[23] !== t11 || $[24] !== t13 || $[25] !== t15 || $[26] !== t9 || $[27] !== w ? (t16 = /* @__PURE__ */ jsxRuntime.jsxs("svg", { className: t8, width: w, height: w, viewBox: t9, children: [
711
- t11,
712
- t13,
713
- t15
714
- ] }), $[23] = t11, $[24] = t13, $[25] = t15, $[26] = t9, $[27] = w, $[28] = t16) : t16 = $[28];
715
- let t17;
716
- return $[29] !== Element2 || $[30] !== rest || $[31] !== t16 || $[32] !== t7 ? (t17 = /* @__PURE__ */ jsxRuntime.jsx(Element2, { ...rest, className: t4, style: t7, children: t16 }), $[29] = Element2, $[30] = rest, $[31] = t16, $[32] = t7, $[33] = t17) : t17 = $[33], t17;
717
- }
718
- const DEFAULT_FLEX_ELEMENT = "div";
719
- function Flex(props) {
720
- const $ = compilerRuntime.c(14), t0 = props;
721
- let align, justify, rest, t1, t2, wrap;
722
- $[0] !== t0 ? ({
723
- align,
724
- as: t1,
725
- direction: t2,
726
- justify,
727
- wrap,
728
- ...rest
729
- } = t0, $[0] = t0, $[1] = align, $[2] = justify, $[3] = rest, $[4] = t1, $[5] = t2, $[6] = wrap) : (align = $[1], justify = $[2], rest = $[3], t1 = $[4], t2 = $[5], wrap = $[6]);
730
- const as = t1 === void 0 ? DEFAULT_FLEX_ELEMENT : t1, direction = t2 === void 0 ? "row" : t2;
731
- let t3;
732
- return $[7] !== align || $[8] !== as || $[9] !== direction || $[10] !== justify || $[11] !== rest || $[12] !== wrap ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(Box, { "data-ui": "Flex", ...rest, alignItems: align, as, display: "flex", flexDirection: direction, flexWrap: wrap, justifyContent: justify }), $[7] = align, $[8] = as, $[9] = direction, $[10] = justify, $[11] = rest, $[12] = wrap, $[13] = t3) : t3 = $[13], t3;
733
- }
734
- const DEFAULT_CARD_ELEMENT = "div";
735
- function Card(props) {
736
- const $ = compilerRuntime.c(38), t0 = props;
737
- let className, disabled, pressed, rest, schemeProp, selected, style, t1, t2, t3, t4, t5;
738
- $[0] !== t0 ? ({
739
- __unstable_checkered: t1,
740
- __unstable_focusRing: t2,
741
- as: t3,
742
- className,
743
- disabled,
744
- pressed,
745
- radius: t4,
746
- scheme: schemeProp,
747
- selected,
748
- style,
749
- tone: t5,
750
- ...rest
751
- } = t0, $[0] = t0, $[1] = className, $[2] = disabled, $[3] = pressed, $[4] = rest, $[5] = schemeProp, $[6] = selected, $[7] = style, $[8] = t1, $[9] = t2, $[10] = t3, $[11] = t4, $[12] = t5) : (className = $[1], disabled = $[2], pressed = $[3], rest = $[4], schemeProp = $[5], selected = $[6], style = $[7], t1 = $[8], t2 = $[9], t3 = $[10], t4 = $[11], t5 = $[12]);
752
- const checkered = t1 === void 0 ? !1 : t1, focusRing = t2 === void 0 ? !1 : t2, as = t3 === void 0 ? DEFAULT_CARD_ELEMENT : t3, radius = t4 === void 0 ? 0 : t4, toneProp = t5 === void 0 ? "default" : t5, parent = react.useContext(CardContext), tone = toneProp === "inherit" ? parent?.tone : toneProp, scheme = schemeProp === void 0 ? parent?.scheme : schemeProp, t6 = scheme === parent?.scheme ? void 0 : scheme;
753
- let t7;
754
- $[13] !== className || $[14] !== t6 || $[15] !== tone ? (t7 = css.card({
755
- className,
756
- scheme: t6,
757
- tone
758
- }), $[13] = className, $[14] = t6, $[15] = tone, $[16] = t7) : t7 = $[16];
759
- const t8 = checkered ? "" : void 0, t9 = disabled ? "" : void 0, t10 = focusRing ? "" : void 0, t11 = pressed ? "" : void 0, t12 = selected ? "" : void 0;
760
- let t13;
761
- $[17] !== as || $[18] !== radius || $[19] !== rest || $[20] !== style || $[21] !== t10 || $[22] !== t11 || $[23] !== t12 || $[24] !== t7 || $[25] !== t8 || $[26] !== t9 ? (t13 = /* @__PURE__ */ jsxRuntime.jsx(Box, { "data-ui": "Card", ...rest, as, className: t7, "data-checkered": t8, "data-disabled": t9, "data-focus-ring": t10, "data-pressed": t11, "data-selected": t12, radius, style }), $[17] = as, $[18] = radius, $[19] = rest, $[20] = style, $[21] = t10, $[22] = t11, $[23] = t12, $[24] = t7, $[25] = t8, $[26] = t9, $[27] = t13) : t13 = $[27];
762
- let node = t13;
763
- if (scheme === parent?.scheme && tone === parent?.tone)
764
- return node;
765
- const t14 = scheme ?? "light", t15 = tone ?? "default", t16 = parent?.unstable_CompatProvider;
766
- let t17;
767
- if ($[28] !== node || $[29] !== t14 || $[30] !== t15 || $[31] !== t16 ? (t17 = /* @__PURE__ */ jsxRuntime.jsx(CardProvider, { scheme: t14, tone: t15, unstable_CompatProvider: t16, children: node }), $[28] = node, $[29] = t14, $[30] = t15, $[31] = t16, $[32] = t17) : t17 = $[32], node = t17, parent?.unstable_CompatProvider) {
768
- const CompatProvider = parent.unstable_CompatProvider, t18 = scheme ?? "light", t19 = tone ?? parent.tone;
769
- let t20;
770
- return $[33] !== CompatProvider || $[34] !== node || $[35] !== t18 || $[36] !== t19 ? (t20 = /* @__PURE__ */ jsxRuntime.jsx(CompatProvider, { scheme: t18, tone: t19, children: node }), $[33] = CompatProvider, $[34] = node, $[35] = t18, $[36] = t19, $[37] = t20) : t20 = $[37], t20;
771
- }
772
- return node;
773
- }
774
- const DEFAULT_LAYER_CARD_ELEMENT = "div";
775
- function LayerCard(props) {
776
- const $ = compilerRuntime.c(27), t0 = props;
777
- let children, forwardedRef, onActivate, onFocus, rest, t1, t2, t3;
778
- $[0] !== t0 ? ({
779
- as: t1,
780
- children,
781
- onActivate,
782
- onFocus,
783
- position: t2,
784
- ref: forwardedRef,
785
- style: t3,
786
- ...rest
787
- } = t0, $[0] = t0, $[1] = children, $[2] = forwardedRef, $[3] = onActivate, $[4] = onFocus, $[5] = rest, $[6] = t1, $[7] = t2, $[8] = t3) : (children = $[1], forwardedRef = $[2], onActivate = $[3], onFocus = $[4], rest = $[5], t1 = $[6], t2 = $[7], t3 = $[8]);
788
- const as = t1 === void 0 ? DEFAULT_LAYER_CARD_ELEMENT : t1, position = t2 === void 0 ? "relative" : t2, style = t3 === void 0 ? EMPTY_RECORD : t3, {
789
- zIndex,
790
- isTopLayer
791
- } = useLayer(), lastFocusedRef = react.useRef(null), ref = react.useRef(null), isTopLayerRef = react.useRef(isTopLayer);
792
- let t4;
793
- $[9] === Symbol.for("react.memo_cache_sentinel") ? (t4 = () => ref.current, $[9] = t4) : t4 = $[9], react.useImperativeHandle(forwardedRef, t4);
794
- let t5, t6;
795
- $[10] !== isTopLayer || $[11] !== onActivate ? (t5 = () => {
796
- isTopLayerRef.current !== isTopLayer && isTopLayer && onActivate?.({
797
- activeElement: lastFocusedRef.current
798
- }), isTopLayerRef.current = isTopLayer;
799
- }, t6 = [isTopLayer, onActivate], $[10] = isTopLayer, $[11] = onActivate, $[12] = t5, $[13] = t6) : (t5 = $[12], t6 = $[13]), react.useEffect(t5, t6);
800
- let t7;
801
- $[14] !== isTopLayer || $[15] !== onFocus ? (t7 = (event) => {
802
- onFocus?.(event);
803
- const rootElement = ref.current, target = document.activeElement;
804
- !isTopLayer || !rootElement || !target || isHTMLElement(target) && containsOrEqualsElement(rootElement, target) && (lastFocusedRef.current = target);
805
- }, $[14] = isTopLayer, $[15] = onFocus, $[16] = t7) : t7 = $[16];
806
- const handleFocus = t7, t8 = as;
807
- let t9;
808
- $[17] !== style || $[18] !== zIndex ? (t9 = {
809
- ...style,
810
- zIndex
811
- }, $[17] = style, $[18] = zIndex, $[19] = t9) : t9 = $[19];
812
- let t10;
813
- return $[20] !== children || $[21] !== handleFocus || $[22] !== position || $[23] !== rest || $[24] !== t8 || $[25] !== t9 ? (t10 = /* @__PURE__ */ jsxRuntime.jsx(Card, { "data-ui": "Layer", ...rest, as: t8, onFocus: handleFocus, position, ref, style: t9, children }), $[20] = children, $[21] = handleFocus, $[22] = position, $[23] = rest, $[24] = t8, $[25] = t9, $[26] = t10) : t10 = $[26], t10;
814
- }
815
- const media = Object.values(css.BREAKPOINTS);
816
- function _getMediaQuery(media2, index) {
817
- return index === 0 ? `screen and (max-width: ${media2[index + 1] - 1}px)` : index === media2.length - 1 ? `screen and (min-width: ${media2[index]}px)` : `screen and (min-width: ${media2[index]}px) and (max-width: ${media2[index + 1] - 1}px)`;
818
- }
819
- function _createMediaStore() {
820
- const mediaLen = media.length;
821
- let sizes;
822
- const getSizes = () => {
823
- if (typeof window > "u")
824
- return sizes;
825
- if (!sizes) {
826
- sizes = [];
827
- for (let index = mediaLen; index > -1; index -= 1) {
828
- const mediaQuery = _getMediaQuery(media, index);
829
- sizes.push({
830
- index,
831
- mq: window.matchMedia(mediaQuery)
832
- });
833
- }
834
- }
835
- return sizes;
836
- };
837
- return {
838
- getSnapshot: () => {
839
- for (const {
840
- index,
841
- mq
842
- } of getSizes() ?? [])
843
- if (mq.matches) return index;
844
- return 0;
845
- },
846
- subscribe: (onStoreChange) => {
847
- const disposeFns = [];
848
- for (const {
849
- mq
850
- } of getSizes() ?? []) {
851
- const handleChange = () => {
852
- mq.matches && onStoreChange();
853
- };
854
- mq.addEventListener("change", handleChange), disposeFns.push(() => mq.removeEventListener("change", handleChange));
855
- }
856
- return () => {
857
- for (const disposeFn of disposeFns)
858
- disposeFn();
859
- };
860
- }
861
- };
862
- }
863
- function getServerSnapshot() {
864
- return 0;
865
- }
866
- function useMediaIndex() {
867
- const $ = compilerRuntime.c(1);
868
- let t0, t1;
869
- $[0] === Symbol.for("react.memo_cache_sentinel") ? (t1 = _createMediaStore(), $[0] = t1) : t1 = $[0], t0 = t1;
870
- const store = t0;
871
- return react.useSyncExternalStore(store.subscribe, store.getSnapshot, getServerSnapshot);
872
- }
873
- function LayerProvider(props) {
874
- const $ = compilerRuntime.c(19), {
875
- children,
876
- zOffset: t0
877
- } = props, zOffsetProp = t0 === void 0 ? 0 : t0, parentContextValue = react.useContext(LayerContext);
878
- let t1;
879
- $[0] !== parentContextValue ? (t1 = parentContextValue && getLayerContext(parentContextValue), $[0] = parentContextValue, $[1] = t1) : t1 = $[1];
880
- const parent = t1, parentRegisterChild = parent?.registerChild, level = (parent?.level ?? 0) + 1, zOffset = useResponsiveProp(zOffsetProp), maxMediaIndex = Object.values(zOffset).length - 1, mediaIndex = Math.min(useMediaIndex(), maxMediaIndex), zIndex = parent ? parent.zIndex + (zOffset[mediaIndex] ?? 0) : zOffset[mediaIndex] ?? 0;
881
- let t2;
882
- $[2] === Symbol.for("react.memo_cache_sentinel") ? (t2 = {}, $[2] = t2) : t2 = $[2];
883
- const [, setChildLayers] = react.useState(t2), [size2, setSize] = react.useState(0), isTopLayer = size2 === 0;
884
- let t3;
885
- $[3] !== parentRegisterChild || $[4] !== setChildLayers ? (t3 = (childLevel) => {
886
- const parentDispose = parentRegisterChild?.(childLevel);
887
- return childLevel !== void 0 ? setChildLayers((state) => {
888
- const prevLen = state[childLevel] ?? 0, nextState = {
889
- ...state,
890
- [childLevel]: prevLen + 1
891
- };
892
- return setSize(Object.keys(nextState).length), nextState;
893
- }) : setSize(_temp$9), () => {
894
- childLevel !== void 0 ? setChildLayers((state_0) => {
895
- const nextState_0 = {
896
- ...state_0
897
- };
898
- return nextState_0[childLevel] === 1 ? (delete nextState_0[childLevel], setSize(Object.keys(nextState_0).length)) : nextState_0[childLevel] = nextState_0[childLevel] - 1, nextState_0;
899
- }) : setSize(_temp2$2), parentDispose?.();
900
- };
901
- }, $[3] = parentRegisterChild, $[4] = setChildLayers, $[5] = t3) : t3 = $[5];
902
- const registerChild = t3;
903
- let t4, t5;
904
- $[6] !== level || $[7] !== parentRegisterChild ? (t4 = () => parentRegisterChild?.(level), t5 = [level, parentRegisterChild], $[6] = level, $[7] = parentRegisterChild, $[8] = t4, $[9] = t5) : (t4 = $[8], t5 = $[9]), react.useEffect(t4, t5);
905
- let t6, t7;
906
- $[10] !== isTopLayer || $[11] !== level || $[12] !== registerChild || $[13] !== size2 || $[14] !== zIndex ? (t7 = {
907
- version: 0,
908
- isTopLayer,
909
- level,
910
- registerChild,
911
- size: size2,
912
- zIndex
913
- }, $[10] = isTopLayer, $[11] = level, $[12] = registerChild, $[13] = size2, $[14] = zIndex, $[15] = t7) : t7 = $[15], t6 = t7;
914
- const value = t6;
915
- let t8;
916
- return $[16] !== children || $[17] !== value ? (t8 = /* @__PURE__ */ jsxRuntime.jsx(LayerContext.Provider, { value, children }), $[16] = children, $[17] = value, $[18] = t8) : t8 = $[18], t8;
917
- }
918
- function _temp2$2(v_0) {
919
- return v_0 - 1;
920
- }
921
- function _temp$9(v) {
922
- return v + 1;
923
- }
924
- const DEFAULT_LAYER_ELEMENT = "div";
925
- function Layer(props) {
926
- const $ = compilerRuntime.c(12), t0 = props;
927
- let children, rest, t1, t2;
928
- $[0] !== t0 ? ({
929
- as: t1,
930
- children,
931
- zOffset: t2,
932
- ...rest
933
- } = t0, $[0] = t0, $[1] = children, $[2] = rest, $[3] = t1, $[4] = t2) : (children = $[1], rest = $[2], t1 = $[3], t2 = $[4]);
934
- const as = t1 === void 0 ? DEFAULT_LAYER_ELEMENT : t1, zOffset = t2 === void 0 ? 1 : t2;
935
- let t3;
936
- $[5] !== as || $[6] !== children || $[7] !== rest ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(LayerCard, { ...rest, as, children }), $[5] = as, $[6] = children, $[7] = rest, $[8] = t3) : t3 = $[8];
937
- let t4;
938
- return $[9] !== t3 || $[10] !== zOffset ? (t4 = /* @__PURE__ */ jsxRuntime.jsx(LayerProvider, { zOffset, children: t3 }), $[9] = t3, $[10] = zOffset, $[11] = t4) : t4 = $[11], t4;
939
- }
940
- function PopoverLayer(props) {
941
- const $ = compilerRuntime.c(65);
942
- let animate, arrow, arrowRef, arrowX, arrowY, children, marginsProp, maxWidth, originX, originY, overflow, padding, placement, radius, referenceWidth, rest, shadow, strategy, style, t0, xProp, yProp;
943
- $[0] !== props ? ({
944
- __unstable_margins: marginsProp,
945
- animate,
946
- arrow,
947
- arrowRef,
948
- arrowX,
949
- arrowY,
950
- children,
951
- maxWidth,
952
- padding,
953
- placement,
954
- originX,
955
- originY,
956
- overflow,
957
- radius,
958
- referenceWidth,
959
- shadow,
960
- strategy,
961
- style,
962
- tone: t0,
963
- x: xProp,
964
- y: yProp,
965
- ...rest
966
- } = props, $[0] = props, $[1] = animate, $[2] = arrow, $[3] = arrowRef, $[4] = arrowX, $[5] = arrowY, $[6] = children, $[7] = marginsProp, $[8] = maxWidth, $[9] = originX, $[10] = originY, $[11] = overflow, $[12] = padding, $[13] = placement, $[14] = radius, $[15] = referenceWidth, $[16] = rest, $[17] = shadow, $[18] = strategy, $[19] = style, $[20] = t0, $[21] = xProp, $[22] = yProp) : (animate = $[1], arrow = $[2], arrowRef = $[3], arrowX = $[4], arrowY = $[5], children = $[6], marginsProp = $[7], maxWidth = $[8], originX = $[9], originY = $[10], overflow = $[11], padding = $[12], placement = $[13], radius = $[14], referenceWidth = $[15], rest = $[16], shadow = $[17], strategy = $[18], style = $[19], t0 = $[20], xProp = $[21], yProp = $[22]);
967
- const tone = t0 === void 0 ? "inherit" : t0;
968
- let t1;
969
- t1 = marginsProp || DEFAULT_POPOVER_MARGINS;
970
- const margins = t1, x = (xProp ?? 0) + margins[3], y = (yProp ?? 0) + margins[0];
971
- let t2;
972
- const t3 = animate ? "transform" : void 0;
973
- let t4;
974
- $[23] !== originX || $[24] !== originY || $[25] !== referenceWidth || $[26] !== style || $[27] !== t3 || $[28] !== x || $[29] !== y ? (t4 = {
975
- left: x,
976
- originX,
977
- originY,
978
- top: y,
979
- width: referenceWidth,
980
- willChange: t3,
981
- ...style
982
- }, $[23] = originX, $[24] = originY, $[25] = referenceWidth, $[26] = style, $[27] = t3, $[28] = x, $[29] = y, $[30] = t4) : t4 = $[30], t2 = t4;
983
- const rootStyle = t2;
984
- let t5;
985
- const t6 = arrowX !== null ? arrowX : void 0, t7 = arrowY !== null ? arrowY : void 0;
986
- let t8;
987
- $[31] !== t6 || $[32] !== t7 ? (t8 = {
988
- left: t6,
989
- top: t7,
990
- right: void 0,
991
- bottom: void 0
992
- }, $[31] = t6, $[32] = t7, $[33] = t8) : t8 = $[33], t5 = t8;
993
- const arrowStyle = t5;
994
- let t9;
995
- $[34] === Symbol.for("react.memo_cache_sentinel") ? (t9 = css.popoverCard(), $[34] = t9) : t9 = $[34];
996
- let t10;
997
- $[35] !== animate ? (t10 = animate ? ["hidden", "initial"] : void 0, $[35] = animate, $[36] = t10) : t10 = $[36];
998
- let t11;
999
- $[37] !== animate ? (t11 = animate ? ["visible", "scaleIn"] : void 0, $[37] = animate, $[38] = t11) : t11 = $[38];
1000
- let t12;
1001
- $[39] !== animate ? (t12 = animate ? ["hidden", "scaleOut"] : void 0, $[39] = animate, $[40] = t12) : t12 = $[40];
1002
- let t13;
1003
- $[41] !== children || $[42] !== padding ? (t13 = /* @__PURE__ */ jsxRuntime.jsx(Flex, { direction: "column", flex: 1, padding, children }), $[41] = children, $[42] = padding, $[43] = t13) : t13 = $[43];
1004
- let t14;
1005
- $[44] !== maxWidth || $[45] !== overflow || $[46] !== t13 ? (t14 = /* @__PURE__ */ jsxRuntime.jsx(Flex, { "data-ui": "Popover__wrapper", direction: "column", flex: 1, maxWidth, overflow, children: t13 }), $[44] = maxWidth, $[45] = overflow, $[46] = t13, $[47] = t14) : t14 = $[47];
1006
- let t15;
1007
- $[48] !== arrow || $[49] !== arrowRef || $[50] !== arrowStyle ? (t15 = arrow && /* @__PURE__ */ jsxRuntime.jsx(Arrow, { ref: arrowRef, style: arrowStyle, width: DEFAULT_POPOVER_ARROW_WIDTH, height: DEFAULT_POPOVER_ARROW_HEIGHT, radius: DEFAULT_POPOVER_ARROW_RADIUS }), $[48] = arrow, $[49] = arrowRef, $[50] = arrowStyle, $[51] = t15) : t15 = $[51];
1008
- let t16;
1009
- return $[52] !== placement || $[53] !== radius || $[54] !== rest || $[55] !== rootStyle || $[56] !== shadow || $[57] !== strategy || $[58] !== t10 || $[59] !== t11 || $[60] !== t12 || $[61] !== t14 || $[62] !== t15 || $[63] !== tone ? (t16 = /* @__PURE__ */ jsxRuntime.jsxs(Layer, { className: t9, "data-ui": "Popover", ...rest, as: framerMotion.motion.div, "data-context-tone": tone, "data-placement": placement, flexDirection: "column", display: "flex", position: strategy, radius, shadow, sizing: "border", style: rootStyle, tone, variants: POPOVER_MOTION_PROPS.card, transition: POPOVER_MOTION_PROPS.transition, initial: t10, animate: t11, exit: t12, children: [
1010
- t14,
1011
- t15
1012
- ] }), $[52] = placement, $[53] = radius, $[54] = rest, $[55] = rootStyle, $[56] = shadow, $[57] = strategy, $[58] = t10, $[59] = t11, $[60] = t12, $[61] = t14, $[62] = t15, $[63] = tone, $[64] = t16) : t16 = $[64], t16;
1013
- }
1014
- const DEFAULT_POPOVER_ELEMENT = "div";
1015
- function ViewportOverlay() {
1016
- const $ = compilerRuntime.c(2), {
1017
- zIndex
1018
- } = useLayer();
1019
- let t0;
1020
- return $[0] !== zIndex ? (t0 = /* @__PURE__ */ jsxRuntime.jsx("div", { style: {
1021
- position: "fixed",
1022
- inset: 0,
1023
- width: "100vw",
1024
- height: "100vh",
1025
- zIndex
1026
- } }), $[0] = zIndex, $[1] = t0) : t0 = $[1], t0;
1027
- }
1028
- function Popover(props) {
1029
- const boundaryElementContext = useBoundaryElement(), {
1030
- __unstable_margins: margins = DEFAULT_POPOVER_MARGINS,
1031
- animate: _animate = !1,
1032
- arrow: arrowProp = !1,
1033
- as = DEFAULT_POPOVER_ELEMENT,
1034
- children: childProp,
1035
- className,
1036
- constrainSize = !1,
1037
- content: content2,
1038
- disabled,
1039
- fallbackPlacements = props.fallbackPlacements ?? DEFAULT_FALLBACK_PLACEMENTS$1[props.placement ?? "bottom"],
1040
- matchReferenceWidth,
1041
- floatingBoundary = boundaryElementContext.element,
1042
- modal,
1043
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1044
- onActivate,
1045
- open,
1046
- overflow = "hidden",
1047
- padding,
1048
- placement: placementProp = "bottom",
1049
- placementStrategy = "flip",
1050
- portal,
1051
- preventOverflow = !0,
1052
- radius = 3,
1053
- ref: forwardedRef,
1054
- referenceBoundary = boundaryElementContext.element,
1055
- referenceElement,
1056
- scheme,
1057
- shadow = 3,
1058
- tone = "inherit",
1059
- width: widthProp = "auto",
1060
- zOffset: zOffsetProp = Z_OFFSETS.popover,
1061
- updateRef,
1062
- ...rest
1063
- } = props, card = useCard(), animate = usePrefersReducedMotion() ? !1 : _animate, zOffset = useResponsiveProp(zOffsetProp), ref = react.useRef(null), arrowRef = react.useRef(null), rootBoundary = "viewport";
1064
- react.useImperativeHandle(forwardedRef, () => ref.current);
1065
- const referenceWidthRef = react.useRef(void 0), middleware = react.useMemo(() => {
1066
- const ret = [];
1067
- return (constrainSize || preventOverflow) && (placementStrategy === "autoPlacement" ? ret.push(reactDom$1.autoPlacement({
1068
- allowedPlacements: [placementProp].concat(fallbackPlacements)
1069
- })) : ret.push(reactDom$1.flip({
1070
- boundary: floatingBoundary || void 0,
1071
- fallbackPlacements,
1072
- padding: DEFAULT_POPOVER_PADDING,
1073
- rootBoundary
1074
- }))), ret.push(reactDom$1.offset({
1075
- mainAxis: DEFAULT_POPOVER_DISTANCE
1076
- })), (constrainSize || matchReferenceWidth) && ret.push(size({
1077
- apply({
1078
- availableWidth,
1079
- availableHeight,
1080
- elements,
1081
- referenceWidth
1082
- }) {
1083
- referenceWidthRef.current = referenceWidth, matchReferenceWidth && (elements.floating.style.width = `${referenceWidth}px`), constrainSize && (elements.floating.style.maxWidth = `${availableWidth}px`, elements.floating.style.maxHeight = `${availableHeight}px`);
1084
- },
1085
- boundaryElement: floatingBoundary || void 0,
1086
- margins,
1087
- padding: DEFAULT_POPOVER_PADDING
1088
- })), preventOverflow && ret.push(reactDom$1.shift({
1089
- boundary: floatingBoundary || void 0,
1090
- rootBoundary,
1091
- padding: DEFAULT_POPOVER_PADDING
1092
- })), arrowProp && ret.push(reactDom$1.arrow({
1093
- element: arrowRef,
1094
- padding: DEFAULT_POPOVER_PADDING
1095
- })), animate && ret.push(origin), ret.push(reactDom$1.hide({
1096
- boundary: referenceBoundary || void 0,
1097
- padding: DEFAULT_POPOVER_PADDING,
1098
- strategy: "referenceHidden"
1099
- })), ret;
1100
- }, [animate, arrowProp, constrainSize, fallbackPlacements, floatingBoundary, placementProp, placementStrategy, margins, matchReferenceWidth, preventOverflow, referenceBoundary]), {
1101
- x,
1102
- y,
1103
- middlewareData,
1104
- placement,
1105
- refs,
1106
- strategy,
1107
- update
1108
- } = reactDom$1.useFloating({
1109
- middleware,
1110
- placement: placementProp,
1111
- whileElementsMounted: reactDom$1.autoUpdate,
1112
- elements: referenceElement ? {
1113
- reference: referenceElement
1114
- } : void 0
1115
- }), referenceHidden = middlewareData.hide?.referenceHidden, arrowX = middlewareData.arrow?.x, arrowY = middlewareData.arrow?.y, originX = middlewareData["@sanity/ui/origin"]?.originX, originY = middlewareData["@sanity/ui/origin"]?.originY, setArrow = react.useCallback((arrowEl) => {
1116
- arrowRef.current = arrowEl;
1117
- }, []), setFloating = react.useCallback((node) => {
1118
- ref.current = node, refs.setFloating(node);
1119
- }, [refs]), setReference = react.useCallback((node_0) => {
1120
- if (refs.setReference(node_0), !childProp) return;
1121
- const childRef = getElementRef(childProp);
1122
- typeof childRef == "function" ? childRef(node_0) : childRef && (childRef.current = node_0);
1123
- }, [childProp, refs]), child = react.useMemo(() => referenceElement ? childProp : childProp ? react.cloneElement(childProp, {
1124
- ref: setReference
1125
- }) : null, [childProp, referenceElement, setReference]);
1126
- if (react.useEffect(() => {
1127
- updateRef && (typeof updateRef == "function" ? updateRef(update) : updateRef && (updateRef.current = update));
1128
- }, [update, updateRef]), disabled)
1129
- return childProp || /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {});
1130
- const node_1 = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1131
- modal && /* @__PURE__ */ jsxRuntime.jsx(ViewportOverlay, {}),
1132
- /* @__PURE__ */ jsxRuntime.jsx(PopoverLayer, { ...rest, __unstable_margins: margins, animate, arrow: arrowProp, arrowRef: setArrow, arrowX, arrowY, as, className: css.popover({
1133
- className
1134
- }), hidden: referenceHidden, maxWidth: widthProp, overflow, padding, placement, radius, ref: setFloating, scheme, shadow, originX, originY, tone, strategy, x, y, zOffset, children: content2 })
1135
- ] }), children = open && (portal ? /* @__PURE__ */ jsxRuntime.jsx(Portal, { __unstable_name: typeof portal == "string" ? portal : void 0, children: /* @__PURE__ */ jsxRuntime.jsx(CardProvider, { tone: tone === "inherit" ? card.tone : tone, scheme: scheme ?? "light", children: node_1 }) }) : node_1);
1136
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1137
- animate ? /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children }) : children,
1138
- child
1139
- ] });
1140
- }
1141
- const DEFAULT_SELECTABLE_ELEMENT = "button";
1142
- function Selectable(props) {
1143
- const $ = compilerRuntime.c(16), t0 = props;
1144
- let className, radius, rest, selected, t1, tone;
1145
- $[0] !== t0 ? ({
1146
- as: t1,
1147
- className,
1148
- radius,
1149
- selected,
1150
- tone,
1151
- ...rest
1152
- } = t0, $[0] = t0, $[1] = className, $[2] = radius, $[3] = rest, $[4] = selected, $[5] = t1, $[6] = tone) : (className = $[1], radius = $[2], rest = $[3], selected = $[4], t1 = $[5], tone = $[6]);
1153
- const as = t1 === void 0 ? DEFAULT_SELECTABLE_ELEMENT : t1;
1154
- let t2;
1155
- $[7] !== className || $[8] !== radius || $[9] !== tone ? (t2 = css._selectable({
1156
- className,
1157
- radius,
1158
- tone
1159
- }), $[7] = className, $[8] = radius, $[9] = tone, $[10] = t2) : t2 = $[10];
1160
- const t3 = selected ? "" : void 0;
1161
- let t4;
1162
- return $[11] !== as || $[12] !== rest || $[13] !== t2 || $[14] !== t3 ? (t4 = /* @__PURE__ */ jsxRuntime.jsx(Box, { ...rest, as, className: t2, "data-selected": t3 }), $[11] = as, $[12] = rest, $[13] = t2, $[14] = t3, $[15] = t4) : t4 = $[15], t4;
1163
- }
1164
- const DEFAULT_STACK_ELEMENT = "div";
1165
- function Stack(props) {
1166
- const $ = compilerRuntime.c(12), t0 = props;
1167
- let className, gap, rest, t1;
1168
- $[0] !== t0 ? ({
1169
- as: t1,
1170
- className,
1171
- gap,
1172
- ...rest
1173
- } = t0, $[0] = t0, $[1] = className, $[2] = gap, $[3] = rest, $[4] = t1) : (className = $[1], gap = $[2], rest = $[3], t1 = $[4]);
1174
- const as = t1 === void 0 ? DEFAULT_STACK_ELEMENT : t1;
1175
- let t2;
1176
- $[5] !== className ? (t2 = css.stack({
1177
- className
1178
- }), $[5] = className, $[6] = t2) : t2 = $[6];
1179
- let t3;
1180
- return $[7] !== as || $[8] !== gap || $[9] !== rest || $[10] !== t2 ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(Box, { "data-ui": "Stack", ...rest, as, gridAutoRows: "min", className: t2, display: "grid", gap }), $[7] = as, $[8] = gap, $[9] = rest, $[10] = t2, $[11] = t3) : t3 = $[11], t3;
1181
- }
1182
- function useCustomValidity(ref, customValidity) {
1183
- const $ = compilerRuntime.c(6);
1184
- let t0;
1185
- $[0] !== customValidity || $[1] !== ref.current ? (t0 = () => {
1186
- ref.current?.setCustomValidity(customValidity || "");
1187
- }, $[0] = customValidity, $[1] = ref.current, $[2] = t0) : t0 = $[2];
1188
- let t1;
1189
- $[3] !== customValidity || $[4] !== ref ? (t1 = [customValidity, ref], $[3] = customValidity, $[4] = ref, $[5] = t1) : t1 = $[5], react.useEffect(t0, t1);
1190
- }
1191
- const DEFAULT_TEXT_INPUT_ELEMENT = "input";
1192
- function TextInput(props) {
1193
- const $ = compilerRuntime.c(88), t0 = props;
1194
- let IconComponent, IconRightComponent, __unstable_disableFocusRing, className, clearButton, customValidity, forwardedRef, onClear, prefix, readOnly, rest, suffix, t1, t2, t3, t4, t5, t6, t7, t8, width;
1195
- if ($[0] !== t0) {
1196
- const {
1197
- __unstable_disableFocusRing: t92,
1198
- as: t102,
1199
- border: t112,
1200
- className: t122,
1201
- clearButton: t132,
1202
- disabled: t142,
1203
- fontSize: t152,
1204
- gap: t162,
1205
- icon: t172,
1206
- iconRight: t182,
1207
- onClear: t192,
1208
- padding: t202,
1209
- prefix: t212,
1210
- radius: t222,
1211
- readOnly: t232,
1212
- ref: t242,
1213
- suffix: t252,
1214
- customValidity: t262,
1215
- type: t272,
1216
- weight: _width,
1217
- width: t282,
1218
- ...t292
1219
- } = t0;
1220
- __unstable_disableFocusRing = t92, t1 = t102, t2 = t112, className = t122, clearButton = t132, t3 = t142, t4 = t152, t5 = t162, IconComponent = t172, IconRightComponent = t182, onClear = t192, t6 = t202, prefix = t212, t7 = t222, readOnly = t232, forwardedRef = t242, suffix = t252, customValidity = t262, t8 = t272, width = t282, rest = t292, $[0] = t0, $[1] = IconComponent, $[2] = IconRightComponent, $[3] = __unstable_disableFocusRing, $[4] = className, $[5] = clearButton, $[6] = customValidity, $[7] = forwardedRef, $[8] = onClear, $[9] = prefix, $[10] = readOnly, $[11] = rest, $[12] = suffix, $[13] = t1, $[14] = t2, $[15] = t3, $[16] = t4, $[17] = t5, $[18] = t6, $[19] = t7, $[20] = t8, $[21] = width;
1221
- } else
1222
- IconComponent = $[1], IconRightComponent = $[2], __unstable_disableFocusRing = $[3], className = $[4], clearButton = $[5], customValidity = $[6], forwardedRef = $[7], onClear = $[8], prefix = $[9], readOnly = $[10], rest = $[11], suffix = $[12], t1 = $[13], t2 = $[14], t3 = $[15], t4 = $[16], t5 = $[17], t6 = $[18], t7 = $[19], t8 = $[20], width = $[21];
1223
- const Element2 = t1 === void 0 ? DEFAULT_TEXT_INPUT_ELEMENT : t1, border = t2 === void 0 ? !0 : t2, disabled = t3 === void 0 ? !1 : t3, fontSize = t4 === void 0 ? 2 : t4, gap = t5 === void 0 ? 3 : t5, padding = t6 === void 0 ? 3 : t6, radius = t7 === void 0 ? 2 : t7, type = t8 === void 0 ? "text" : t8, ref = react.useRef(null), responsivePadding = useResponsiveProp(padding), withClearButton = !!clearButton;
1224
- let t9;
1225
- $[22] === Symbol.for("react.memo_cache_sentinel") ? (t9 = () => ref.current, $[22] = t9) : t9 = $[22], react.useImperativeHandle(forwardedRef, t9), useCustomValidity(ref, customValidity);
1226
- const handleClearMouseDown = _temp$8;
1227
- let t10;
1228
- $[23] !== onClear ? (t10 = (event_0) => {
1229
- event_0.preventDefault(), event_0.stopPropagation(), onClear && onClear(), ref.current?.focus();
1230
- }, $[23] = onClear, $[24] = t10) : t10 = $[24];
1231
- const handleClearClick = t10;
1232
- let t11, t12;
1233
- $[25] !== responsivePadding ? (t12 = Object.fromEntries(Object.entries(responsivePadding).map(_temp2$1)), $[25] = responsivePadding, $[26] = t12) : t12 = $[26], t11 = t12;
1234
- const clearButtonBoxPadding = t11;
1235
- let t13, t14;
1236
- $[27] !== responsivePadding ? (t14 = Object.fromEntries(Object.entries(responsivePadding).map(_temp3)), $[27] = responsivePadding, $[28] = t14) : t14 = $[28], t13 = t14;
1237
- const clearButtonPadding = t13;
1238
- let t15;
1239
- t15 = isRecord(clearButton) ? clearButton : EMPTY_RECORD;
1240
- const clearButtonProps = t15;
1241
- let t16;
1242
- $[29] !== border || $[30] !== className || $[31] !== fontSize || $[32] !== gap || $[33] !== padding || $[34] !== radius || $[35] !== width ? (t16 = css.textInput({
1243
- className,
1244
- border,
1245
- fontSize,
1246
- padding,
1247
- radius,
1248
- gap,
1249
- width
1250
- }), $[29] = border, $[30] = className, $[31] = fontSize, $[32] = gap, $[33] = padding, $[34] = radius, $[35] = width, $[36] = t16) : t16 = $[36];
1251
- const t17 = IconComponent ? "" : void 0, t18 = IconRightComponent ? "" : void 0, t19 = customValidity ? "" : void 0, t20 = prefix ? "" : void 0, t21 = !disabled && readOnly ? "" : void 0, t22 = suffix ? "" : void 0;
1252
- let t23;
1253
- $[37] !== prefix ? (t23 = prefix && /* @__PURE__ */ jsxRuntime.jsx(Box, { className: css.textInputPrefix(), sizing: "border", children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: prefix }) }), $[37] = prefix, $[38] = t23) : t23 = $[38];
1254
- let t24;
1255
- $[39] === Symbol.for("react.memo_cache_sentinel") ? (t24 = css.textInputElement(), $[39] = t24) : t24 = $[39];
1256
- let t25;
1257
- $[40] === Symbol.for("react.memo_cache_sentinel") ? (t25 = css._inputElement(), $[40] = t25) : t25 = $[40];
1258
- const t26 = __unstable_disableFocusRing ? "" : void 0;
1259
- let t27;
1260
- $[41] !== Element2 || $[42] !== disabled || $[43] !== readOnly || $[44] !== rest || $[45] !== t26 || $[46] !== type ? (t27 = /* @__PURE__ */ jsxRuntime.jsx(Element2, { ...rest, className: t25, "data-no-focus-ring": t26, disabled, readOnly, ref, type }), $[41] = Element2, $[42] = disabled, $[43] = readOnly, $[44] = rest, $[45] = t26, $[46] = type, $[47] = t27) : t27 = $[47];
1261
- let t28;
1262
- $[48] === Symbol.for("react.memo_cache_sentinel") ? (t28 = css._inputPresentation(), $[48] = t28) : t28 = $[48];
1263
- let t29;
1264
- $[49] !== IconComponent || $[50] !== fontSize || $[51] !== padding ? (t29 = IconComponent && /* @__PURE__ */ jsxRuntime.jsx(Box, { padding, position: "absolute", insetTop: 0, insetLeft: 0, children: /* @__PURE__ */ jsxRuntime.jsxs(Text, { size: fontSize, children: [
1265
- react.isValidElement(IconComponent) && IconComponent,
1266
- reactIs.isValidElementType(IconComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconComponent, {})
1267
- ] }) }), $[49] = IconComponent, $[50] = fontSize, $[51] = padding, $[52] = t29) : t29 = $[52];
1268
- let t30;
1269
- $[53] !== IconRightComponent || $[54] !== fontSize || $[55] !== padding || $[56] !== withClearButton ? (t30 = !withClearButton && IconRightComponent && /* @__PURE__ */ jsxRuntime.jsx(Box, { padding, position: "absolute", insetTop: 0, insetRight: 0, children: /* @__PURE__ */ jsxRuntime.jsxs(Text, { size: fontSize, children: [
1270
- react.isValidElement(IconRightComponent) && IconRightComponent,
1271
- reactIs.isValidElementType(IconRightComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconRightComponent, {})
1272
- ] }) }), $[53] = IconRightComponent, $[54] = fontSize, $[55] = padding, $[56] = withClearButton, $[57] = t30) : t30 = $[57];
1273
- let t31;
1274
- $[58] !== t29 || $[59] !== t30 ? (t31 = /* @__PURE__ */ jsxRuntime.jsxs(Box, { className: t28, position: "absolute", children: [
1275
- t29,
1276
- t30
1277
- ] }), $[58] = t29, $[59] = t30, $[60] = t31) : t31 = $[60];
1278
- let t32;
1279
- $[61] !== clearButton || $[62] !== clearButtonBoxPadding || $[63] !== clearButtonPadding || $[64] !== clearButtonProps || $[65] !== disabled || $[66] !== fontSize || $[67] !== handleClearClick || $[68] !== radius || $[69] !== readOnly ? (t32 = !disabled && !readOnly && clearButton && /* @__PURE__ */ jsxRuntime.jsx(Box, { insetTop: 0, insetRight: 0, padding: clearButtonBoxPadding, position: "absolute", style: {
1280
- zIndex: 2
1281
- }, children: /* @__PURE__ */ jsxRuntime.jsx(Button, { "aria-label": "Clear", "data-qa": "clear-button", display: "block", fontSize, icon: icons.CloseIcon, mode: "bleed", padding: clearButtonPadding, radius, ...clearButtonProps, onClick: handleClearClick, onMouseDown: handleClearMouseDown }) }), $[61] = clearButton, $[62] = clearButtonBoxPadding, $[63] = clearButtonPadding, $[64] = clearButtonProps, $[65] = disabled, $[66] = fontSize, $[67] = handleClearClick, $[68] = radius, $[69] = readOnly, $[70] = t32) : t32 = $[70];
1282
- let t33;
1283
- $[71] !== t27 || $[72] !== t31 || $[73] !== t32 ? (t33 = /* @__PURE__ */ jsxRuntime.jsxs(Box, { className: t24, flex: 1, position: "relative", children: [
1284
- t27,
1285
- t31,
1286
- t32
1287
- ] }), $[71] = t27, $[72] = t31, $[73] = t32, $[74] = t33) : t33 = $[74];
1288
- let t34;
1289
- $[75] !== suffix ? (t34 = suffix && /* @__PURE__ */ jsxRuntime.jsx(Box, { className: css.textInputSuffix(), sizing: "border", children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: suffix }) }), $[75] = suffix, $[76] = t34) : t34 = $[76];
1290
- let t35;
1291
- return $[77] !== t16 || $[78] !== t17 || $[79] !== t18 || $[80] !== t19 || $[81] !== t20 || $[82] !== t21 || $[83] !== t22 || $[84] !== t23 || $[85] !== t33 || $[86] !== t34 ? (t35 = /* @__PURE__ */ jsxRuntime.jsxs(Box, { alignItems: "center", className: t16, "data-icon-left": t17, "data-icon-right": t18, "data-invalid": t19, "data-prefix": t20, "data-read-only": t21, "data-suffix": t22, "data-ui": "TextInput", display: "flex", children: [
1292
- t23,
1293
- t33,
1294
- t34
1295
- ] }), $[77] = t16, $[78] = t17, $[79] = t18, $[80] = t19, $[81] = t20, $[82] = t21, $[83] = t22, $[84] = t23, $[85] = t33, $[86] = t34, $[87] = t35) : t35 = $[87], t35;
1296
- }
1297
- function _temp3(t0) {
1298
- const [key_0, value_0] = t0;
1299
- return value_0 === 0 ? [key_0, 0] : value_0 === 1 ? [key_0, 0] : value_0 === 2 ? [key_0, 1] : [key_0, typeof value_0 == "number" ? value_0 - 1 : 0];
1300
- }
1301
- function _temp2$1(t0) {
1302
- const [key2, value] = t0;
1303
- return value === 0 ? [key2, 0] : value === 1 ? [key2, 1] : value === 2 ? [key2, 1] : [key2, typeof value == "number" ? value - 2 : 0];
1304
- }
1305
- function _temp$8(event) {
1306
- event.preventDefault(), event.stopPropagation();
1307
- }
1308
- function AutocompleteOption(props) {
1309
- const $ = compilerRuntime.c(11), {
1310
- children,
1311
- id,
1312
- onSelect,
1313
- selected,
1314
- value
1315
- } = props;
1316
- let t0;
1317
- $[0] !== onSelect || $[1] !== value ? (t0 = () => {
1318
- setTimeout(() => {
1319
- onSelect(value);
1320
- }, 0);
1321
- }, $[0] = onSelect, $[1] = value, $[2] = t0) : t0 = $[2];
1322
- const handleClick = t0;
1323
- let t1;
1324
- $[3] !== handleClick ? (t1 = (event) => {
1325
- event.key === "Enter" && !_isEnterToClickElement(event.currentTarget) && handleClick();
1326
- }, $[3] = handleClick, $[4] = t1) : t1 = $[4];
1327
- const handleKeyDown = t1;
1328
- let t2;
1329
- return $[5] !== children || $[6] !== handleClick || $[7] !== handleKeyDown || $[8] !== id || $[9] !== selected ? (t2 = /* @__PURE__ */ jsxRuntime.jsx("li", { "aria-selected": selected, "data-ui": "AutocompleteOption", id, role: "option", onClick: handleClick, onKeyDown: handleKeyDown, children }), $[5] = children, $[6] = handleClick, $[7] = handleKeyDown, $[8] = id, $[9] = selected, $[10] = t2) : t2 = $[10], t2;
1330
- }
1331
- function autocompleteReducer(state, msg) {
1332
- return msg.type === "input/change" ? {
1333
- ...state,
1334
- activeValue: null,
1335
- focused: !0,
1336
- query: msg.query
1337
- } : msg.type === "input/focus" ? {
1338
- ...state,
1339
- focused: !0
1340
- } : msg.type === "root/blur" ? {
1341
- ...state,
1342
- focused: !1,
1343
- query: null
1344
- } : msg.type === "root/clear" ? {
1345
- ...state,
1346
- activeValue: null,
1347
- query: null,
1348
- value: null
1349
- } : msg.type === "root/escape" ? {
1350
- ...state,
1351
- focused: !1,
1352
- query: null
1353
- } : msg.type === "root/open" ? {
1354
- ...state,
1355
- query: state.query || msg.query
1356
- } : msg.type === "root/setActiveValue" ? {
1357
- ...state,
1358
- activeValue: msg.value,
1359
- listFocused: msg.listFocused || state.listFocused
1360
- } : msg.type === "root/setListFocused" ? {
1361
- ...state,
1362
- listFocused: msg.listFocused
1363
- } : msg.type === "value/change" ? {
1364
- ...state,
1365
- activeValue: msg.value,
1366
- query: null,
1367
- value: msg.value
1368
- } : state;
1369
- }
1370
- const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = ["Control", "Shift", "Alt", "Enter", "Home", "End", "PageUp", "PageDown", "Meta", "Tab", "CapsLock"], AUTOCOMPLETE_POPOVER_PLACEMENT = "bottom-start", AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS = ["bottom-start", "top-start"], DEFAULT_AUTOCOMPLETE_ELEMENT = "input", DEFAULT_RENDER_VALUE = (value, option) => option ? option.value : value, DEFAULT_FILTER_OPTION = (query, option) => option.value.toLowerCase().indexOf(query.toLowerCase()) > -1;
1371
- function Autocomplete(props) {
1372
- const {
1373
- as = DEFAULT_AUTOCOMPLETE_ELEMENT,
1374
- border = !0,
1375
- customValidity,
1376
- disabled,
1377
- filterOption: filterOptionProp,
1378
- fontSize = 2,
1379
- icon,
1380
- id,
1381
- listBox = EMPTY_RECORD,
1382
- loading,
1383
- onBlur,
1384
- onChange,
1385
- onFocus,
1386
- onQueryChange,
1387
- onSelect,
1388
- openButton,
1389
- openOnFocus,
1390
- options: optionsProp,
1391
- padding: paddingProp = 3,
1392
- popover = EMPTY_RECORD,
1393
- prefix,
1394
- radius = 2,
1395
- readOnly,
1396
- ref: forwardedRef,
1397
- relatedElements,
1398
- renderOption: renderOptionProp,
1399
- renderPopover,
1400
- renderValue = DEFAULT_RENDER_VALUE,
1401
- suffix,
1402
- value: valueProp,
1403
- ...rest
1404
- } = props, [state, dispatch] = react.useReducer(autocompleteReducer, {
1405
- activeValue: valueProp || null,
1406
- focused: !1,
1407
- listFocused: !1,
1408
- query: null,
1409
- value: valueProp || null
1410
- }), {
1411
- activeValue,
1412
- focused,
1413
- listFocused,
1414
- query,
1415
- value
1416
- } = state, defaultRenderOption = react.useCallback(({
1417
- value: value_0
1418
- }) => /* @__PURE__ */ jsxRuntime.jsx(Selectable, { as: "button", padding: paddingProp, radius: 2, children: /* @__PURE__ */ jsxRuntime.jsx(Text, { size: fontSize, textOverflow: "ellipsis", children: value_0 }) }), [fontSize, paddingProp]), renderOption = typeof renderOptionProp == "function" ? renderOptionProp : defaultRenderOption, filterOption = typeof filterOptionProp == "function" ? filterOptionProp : DEFAULT_FILTER_OPTION, rootElementRef = react.useRef(null), resultsPopoverElementRef = react.useRef(null), inputElementRef = react.useRef(null), listBoxElementRef = react.useRef(null), listFocusedRef = react.useRef(!1), valueRef = react.useRef(value), valuePropRef = react.useRef(valueProp), popoverMouseWithinRef = react.useRef(!1);
1419
- react.useImperativeHandle(forwardedRef, () => inputElementRef.current);
1420
- const listBoxId = `${id}-listbox`, options = Array.isArray(optionsProp) ? optionsProp : EMPTY_ARRAY, padding = useResponsiveProp(paddingProp), currentOption = react.useMemo(() => value !== null ? options.find((o) => o.value === value) : void 0, [options, value]), filteredOptions = react.useMemo(() => options.filter((option) => query ? filterOption(query, option) : !0), [filterOption, options, query]), filteredOptionsLen = filteredOptions.length, activeItemId = activeValue ? `${id}-option-${activeValue}` : void 0, expanded = query !== null && loading || focused && query !== null, handleRootBlur = react.useCallback((event) => {
1421
- setTimeout(() => {
1422
- if (popoverMouseWithinRef.current)
1423
- return;
1424
- const elements = (relatedElements || []).concat(rootElementRef.current ? [rootElementRef.current] : [], resultsPopoverElementRef.current ? [resultsPopoverElementRef.current] : []);
1425
- let focusInside = !1;
1426
- if (document.activeElement) {
1427
- for (const e of elements)
1428
- if (e === document.activeElement || e.contains(document.activeElement)) {
1429
- focusInside = !0;
1430
- break;
1431
- }
1432
- }
1433
- focusInside === !1 && (dispatch({
1434
- type: "root/blur"
1435
- }), popoverMouseWithinRef.current = !1, onQueryChange && onQueryChange(null), onBlur && onBlur(event));
1436
- }, 0);
1437
- }, [onBlur, onQueryChange, relatedElements]), handleRootFocus = react.useCallback((event_0) => {
1438
- const listBoxElement = listBoxElementRef.current, focusedElement = event_0.target instanceof HTMLElement ? event_0.target : null, listFocused_0 = listBoxElement?.contains(focusedElement) || !1;
1439
- listFocused_0 !== listFocusedRef.current && (listFocusedRef.current = listFocused_0, dispatch({
1440
- type: "root/setListFocused",
1441
- listFocused: listFocused_0
1442
- }));
1443
- }, []), handleOptionSelect = react.useCallback((v) => {
1444
- dispatch({
1445
- type: "value/change",
1446
- value: v
1447
- }), popoverMouseWithinRef.current = !1, onSelect && onSelect(v), valueRef.current = v, onChange && onChange(v), onQueryChange && onQueryChange(null), inputElementRef.current?.focus();
1448
- }, [onChange, onSelect, onQueryChange]), handleRootKeyDown = react.useCallback((event_1) => {
1449
- if (event_1.key === "ArrowDown") {
1450
- if (event_1.preventDefault(), !filteredOptionsLen) return;
1451
- const activeOption = filteredOptions.find((o_0) => o_0.value === activeValue), activeIndex = activeOption ? filteredOptions.indexOf(activeOption) : -1, nextActiveOption = filteredOptions[(activeIndex + 1) % filteredOptionsLen];
1452
- nextActiveOption && dispatch({
1453
- type: "root/setActiveValue",
1454
- value: nextActiveOption.value,
1455
- listFocused: !0
1456
- });
1457
- return;
1458
- }
1459
- if (event_1.key === "ArrowUp") {
1460
- if (event_1.preventDefault(), !filteredOptionsLen) return;
1461
- const activeOption_0 = filteredOptions.find((o_1) => o_1.value === activeValue), activeIndex_0 = activeOption_0 ? filteredOptions.indexOf(activeOption_0) : -1, nextActiveOption_0 = filteredOptions[activeIndex_0 === -1 ? filteredOptionsLen - 1 : (filteredOptionsLen + activeIndex_0 - 1) % filteredOptionsLen];
1462
- nextActiveOption_0 && dispatch({
1463
- type: "root/setActiveValue",
1464
- value: nextActiveOption_0.value,
1465
- listFocused: !0
1466
- });
1467
- return;
1468
- }
1469
- if (event_1.key === "Escape") {
1470
- dispatch({
1471
- type: "root/escape"
1472
- }), popoverMouseWithinRef.current = !1, onQueryChange && onQueryChange(null), inputElementRef.current?.focus();
1473
- return;
1474
- }
1475
- const target = event_1.target, listEl = listBoxElementRef.current;
1476
- if ((listEl === target || listEl?.contains(target)) && !AUTOCOMPLETE_LISTBOX_IGNORE_KEYS.includes(event_1.key)) {
1477
- inputElementRef.current?.focus();
1478
- return;
1479
- }
1480
- }, [activeValue, filteredOptions, filteredOptionsLen, onQueryChange]), handleInputChange = react.useCallback((event_2) => {
1481
- const nextQuery = event_2.currentTarget.value;
1482
- dispatch({
1483
- type: "input/change",
1484
- query: nextQuery
1485
- }), onQueryChange && onQueryChange(nextQuery);
1486
- }, [onQueryChange]), dispatchOpen = react.useCallback(() => {
1487
- dispatch({
1488
- type: "root/open",
1489
- query: value ? renderValue(value, currentOption) : ""
1490
- });
1491
- }, [currentOption, renderValue, value]), handleInputFocus = react.useCallback((event_3) => {
1492
- focused || (dispatch({
1493
- type: "input/focus"
1494
- }), onFocus && onFocus(event_3), openOnFocus && dispatchOpen());
1495
- }, [focused, onFocus, openOnFocus, dispatchOpen]), handlePopoverMouseEnter = react.useCallback(() => {
1496
- popoverMouseWithinRef.current = !0;
1497
- }, []), handlePopoverMouseLeave = react.useCallback(() => {
1498
- popoverMouseWithinRef.current = !1;
1499
- }, []), handleClearButtonClick = react.useCallback(() => {
1500
- dispatch({
1501
- type: "root/clear"
1502
- }), valueRef.current = "", onChange && onChange(""), onQueryChange && onQueryChange(null), inputElementRef.current?.focus();
1503
- }, [onChange, onQueryChange]), handleClearButtonFocus = react.useCallback(() => {
1504
- dispatch({
1505
- type: "input/focus"
1506
- });
1507
- }, []);
1508
- react.useEffect(() => {
1509
- if (valueProp !== valuePropRef.current) {
1510
- valuePropRef.current = valueProp, valueProp !== void 0 && (dispatch({
1511
- type: "value/change",
1512
- value: valueProp
1513
- }), valueRef.current = valueProp);
1514
- return;
1515
- }
1516
- valueProp !== valueRef.current && (valueRef.current = valueProp || null, dispatch({
1517
- type: "value/change",
1518
- value: valueProp || null
1519
- }));
1520
- }, [valueProp]), react.useEffect(() => {
1521
- !focused && valueRef.current && dispatch({
1522
- type: "root/setActiveValue",
1523
- value: valueRef.current
1524
- });
1525
- }, [focused]), react.useEffect(() => {
1526
- const listElement = listBoxElementRef.current;
1527
- if (!listElement) return;
1528
- const activeOption_1 = filteredOptions.find((o_2) => o_2.value === activeValue);
1529
- if (activeOption_1) {
1530
- const activeIndex_1 = filteredOptions.indexOf(activeOption_1), activeItemElement = listElement.childNodes[activeIndex_1];
1531
- if (activeItemElement) {
1532
- if (_hasFocus(activeItemElement))
1533
- return;
1534
- focusFirstDescendant(activeItemElement);
1535
- }
1536
- }
1537
- }, [activeValue, filteredOptions]);
1538
- const clearButton = react.useMemo(() => {
1539
- if (!loading && !disabled && value)
1540
- return {
1541
- "aria-label": "Clear",
1542
- onFocus: handleClearButtonFocus
1543
- };
1544
- }, [disabled, handleClearButtonFocus, loading, value]), openButtonBoxPadding = react.useMemo(() => Object.fromEntries(Object.entries(padding).map(([key2, value_1]) => value_1 === 0 ? [key2, 0] : value_1 === 1 ? [key2, 1] : value_1 === 2 ? [key2, 1] : [key2, value_1 - 2])), [padding]), openButtonPadding = react.useMemo(() => Object.values(padding).map((v_0) => Math.max(v_0 - 1, 0)), [padding]), openButtonProps = react.useMemo(() => typeof openButton == "object" ? openButton : EMPTY_RECORD, [openButton]), handleOpenClick = react.useCallback((event_4) => {
1545
- dispatchOpen(), openButtonProps.onClick && openButtonProps.onClick(event_4), _raf(() => inputElementRef.current?.focus());
1546
- }, [openButtonProps, dispatchOpen]), openButtonNode = react.useMemo(() => !disabled && !readOnly && openButton ? /* @__PURE__ */ jsxRuntime.jsx(Box, { "aria-hidden": expanded, padding: openButtonBoxPadding, children: /* @__PURE__ */ jsxRuntime.jsx(Button, { "aria-label": "Open", disabled: expanded, display: "block", fontSize, icon: icons.ChevronDownIcon, mode: "bleed", padding: openButtonPadding, ...openButtonProps, onClick: handleOpenClick }) }) : void 0, [disabled, expanded, fontSize, handleOpenClick, openButton, openButtonBoxPadding, openButtonPadding, openButtonProps, readOnly]), inputValue = react.useMemo(() => query === null ? value !== null ? renderValue(value, currentOption) : "" : query, [currentOption, query, renderValue, value]), input = /* @__PURE__ */ jsxRuntime.jsx(TextInput, { ...rest, "aria-activedescendant": activeItemId, "aria-autocomplete": "list", "aria-expanded": expanded, "aria-owns": listBoxId, autoCapitalize: "off", autoComplete: "off", autoCorrect: "off", as, border, clearButton, customValidity, disabled, fontSize, icon, iconRight: loading && AnimatedSpinnerIcon, id, inputMode: "search", onChange: handleInputChange, onClear: handleClearButtonClick, onFocus: handleInputFocus, padding, prefix, radius, readOnly, ref: inputElementRef, role: "combobox", spellCheck: !1, suffix: suffix || openButtonNode, value: inputValue }), handleListBoxKeyDown = react.useCallback((event_5) => {
1547
- event_5.key === "Tab" && listFocused && inputElementRef.current?.focus();
1548
- }, [listFocused]), content2 = react.useMemo(() => filteredOptions.length === 0 ? null : /* @__PURE__ */ jsxRuntime.jsx(Box, { "data-ui": "AutoComplete__results", onKeyDown: handleListBoxKeyDown, padding: 1, ...listBox, tabIndex: -1, children: /* @__PURE__ */ jsxRuntime.jsx(Stack, { as: "ul", "aria-multiselectable": !1, "data-ui": "AutoComplete__resultsList", gap: 1, id: listBoxId, ref: listBoxElementRef, role: "listbox", children: filteredOptions.map((option_0) => {
1549
- const active = activeValue !== null ? option_0.value === activeValue : currentOption === option_0;
1550
- return /* @__PURE__ */ jsxRuntime.jsx(AutocompleteOption, { id: `${id}-option-${option_0.value}`, onSelect: handleOptionSelect, selected: active, value: option_0.value, children: react.cloneElement(renderOption(option_0), {
1551
- disabled: loading,
1552
- selected: active,
1553
- tabIndex: listFocused && active ? 0 : -1
1554
- }) }, option_0.value);
1555
- }) }) }), [activeValue, currentOption, filteredOptions, handleOptionSelect, handleListBoxKeyDown, id, listBox, listBoxId, listFocused, loading, renderOption]), results = react.useMemo(() => renderPopover ? renderPopover({
1556
- content: content2,
1557
- hidden: !expanded,
1558
- inputElement: inputElementRef.current,
1559
- onMouseEnter: handlePopoverMouseEnter,
1560
- onMouseLeave: handlePopoverMouseLeave
1561
- }, resultsPopoverElementRef) : filteredOptionsLen === 0 ? null : /* @__PURE__ */ jsxRuntime.jsx(Popover, { arrow: !1, constrainSize: !0, content: content2, fallbackPlacements: AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS, matchReferenceWidth: !0, onMouseEnter: handlePopoverMouseEnter, onMouseLeave: handlePopoverMouseLeave, open: expanded, overflow: "auto", placement: AUTOCOMPLETE_POPOVER_PLACEMENT, portal: !0, radius: 3, ref: resultsPopoverElementRef, referenceElement: inputElementRef.current, ...popover }), [content2, expanded, filteredOptionsLen, handlePopoverMouseEnter, handlePopoverMouseLeave, popover, renderPopover]);
1562
- return (
1563
- // eslint-disable-next-line jsx-a11y/no-static-element-interactions
1564
- /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-ui": "Autocomplete", onBlur: handleRootBlur, onFocus: handleRootFocus, onKeyDown: handleRootKeyDown, ref: rootElementRef, children: [
1565
- input,
1566
- results
1567
- ] })
1568
- );
1569
- }
1570
- function useClickOutsideEvent(listener, t0, boundaryElement) {
1571
- const $ = compilerRuntime.c(9), elementsArg = t0 === void 0 ? _temp$7 : t0;
1572
- let t1;
1573
- $[0] !== boundaryElement || $[1] !== elementsArg || $[2] !== listener ? (t1 = (evt) => {
1574
- if (!listener)
1575
- return;
1576
- const target = evt.target;
1577
- if (!(target instanceof Node))
1578
- return;
1579
- const resolvedBoundaryElement = boundaryElement?.();
1580
- if (resolvedBoundaryElement && !resolvedBoundaryElement.contains(target))
1581
- return;
1582
- const elements = elementsArg().flat();
1583
- for (const el of elements)
1584
- if (el && (target === el || el.contains(target)))
1585
- return;
1586
- listener(evt);
1587
- }, $[0] = boundaryElement, $[1] = elementsArg, $[2] = listener, $[3] = t1) : t1 = $[3];
1588
- const onEvent = useEffectEvent.useEffectEvent(t1), hasListener = !!listener;
1589
- let t2;
1590
- $[4] !== hasListener || $[5] !== onEvent ? (t2 = () => {
1591
- if (!hasListener)
1592
- return;
1593
- const handleEvent = (evt_0) => onEvent(evt_0);
1594
- return document.addEventListener("mousedown", handleEvent), () => {
1595
- document.removeEventListener("mousedown", handleEvent);
1596
- };
1597
- }, $[4] = hasListener, $[5] = onEvent, $[6] = t2) : t2 = $[6];
1598
- let t3;
1599
- $[7] !== hasListener ? (t3 = [hasListener], $[7] = hasListener, $[8] = t3) : t3 = $[8], react.useEffect(t2, t3), react.useDebugValue(listener ? "MouseDown On" : "MouseDown Off");
1600
- }
1601
- function _temp$7() {
1602
- return EMPTY_ARRAY;
1603
- }
1604
- const DEFAULT_BREADCRUMBS_ELEMENT = "nav";
1605
- function Breadcrumbs(props) {
1606
- const {
1607
- as = DEFAULT_BREADCRUMBS_ELEMENT,
1608
- children,
1609
- className,
1610
- expandButton: expandButtonProps,
1611
- gap = 2,
1612
- gapX,
1613
- gapY,
1614
- maxLength,
1615
- separator,
1616
- ...rest
1617
- } = props, [open, setOpen] = react.useState(!1), expandElementRef = react.useRef(null), popoverElementRef = react.useRef(null), collapse = react.useCallback(() => setOpen(!1), []), expand = react.useCallback(() => setOpen(!0), []);
1618
- useClickOutsideEvent(collapse, () => [expandElementRef.current, popoverElementRef.current]);
1619
- const rawItems = react.useMemo(() => react.Children.toArray(children).filter(react.isValidElement), [children]), items = react.useMemo(() => {
1620
- const len = rawItems.length;
1621
- if (maxLength && len > maxLength) {
1622
- const beforeLength = Math.ceil(maxLength / 2), afterLength = Math.floor(maxLength / 2);
1623
- return [...rawItems.slice(0, beforeLength - 1), /* @__PURE__ */ jsxRuntime.jsx(Popover, { constrainSize: !0, content: /* @__PURE__ */ jsxRuntime.jsx(Stack, { as: "ol", gap: gapY, overflow: "auto", children: rawItems.slice(beforeLength - 1, len - afterLength) }), open, padding: 2, placement: "top", portal: !0, ref: popoverElementRef, children: /* @__PURE__ */ jsxRuntime.jsx(Button, { mode: "bleed", padding: 0, text: "\u2026", ...expandButtonProps, onClick: open ? collapse : expand, ref: expandElementRef, selected: open }) }, "button"), ...rawItems.slice(len - afterLength)];
1624
- }
1625
- return rawItems;
1626
- }, [collapse, expand, expandButtonProps, gapY, maxLength, open, rawItems]);
1627
- return /* @__PURE__ */ jsxRuntime.jsx(Flex, { as, "data-ui": "Breadcrumbs", ...rest, className: css.breadcrumbs({
1628
- className
1629
- }), gap, gapX, gapY, children: items.map((item, itemIndex) => /* @__PURE__ */ jsxRuntime.jsxs(react.Fragment, { children: [
1630
- itemIndex > 0 && /* @__PURE__ */ jsxRuntime.jsx(Box, { "aria-hidden": !0, as: "li", children: separator || /* @__PURE__ */ jsxRuntime.jsx(Text, { muted: !0, children: "/" }) }),
1631
- /* @__PURE__ */ jsxRuntime.jsx(Box, { as: "li", children: item })
1632
- ] }, itemIndex)) });
1633
- }
1634
- const DEFAULT_CONTAINER_ELEMENT = "div";
1635
- function Container(props) {
1636
- const $ = compilerRuntime.c(12), t0 = props;
1637
- let className, rest, t1, t2;
1638
- $[0] !== t0 ? ({
1639
- as: t1,
1640
- className,
1641
- width: t2,
1642
- ...rest
1643
- } = t0, $[0] = t0, $[1] = className, $[2] = rest, $[3] = t1, $[4] = t2) : (className = $[1], rest = $[2], t1 = $[3], t2 = $[4]);
1644
- const as = t1 === void 0 ? DEFAULT_CONTAINER_ELEMENT : t1, width = t2 === void 0 ? 2 : t2;
1645
- let t3;
1646
- $[5] !== className || $[6] !== width ? (t3 = css.container({
1647
- className,
1648
- width
1649
- }), $[5] = className, $[6] = width, $[7] = t3) : t3 = $[7];
1650
- let t4;
1651
- return $[8] !== as || $[9] !== rest || $[10] !== t3 ? (t4 = /* @__PURE__ */ jsxRuntime.jsx(Box, { "data-ui": "Container", ...rest, as, className: t3 }), $[8] = as, $[9] = rest, $[10] = t3, $[11] = t4) : t4 = $[11], t4;
1652
- }
1653
- function useGlobalKeyDown(onKeyDown) {
1654
- const $ = compilerRuntime.c(5);
1655
- let t0;
1656
- $[0] !== onKeyDown ? (t0 = (event) => onKeyDown(event), $[0] = onKeyDown, $[1] = t0) : t0 = $[1];
1657
- const handleKeyDown = useEffectEvent.useEffectEvent(t0);
1658
- let t1;
1659
- $[2] !== handleKeyDown ? (t1 = () => {
1660
- const handler = (event_0) => handleKeyDown(event_0);
1661
- return window.addEventListener("keydown", handler), () => window.removeEventListener("keydown", handler);
1662
- }, $[2] = handleKeyDown, $[3] = t1) : t1 = $[3];
1663
- let t2;
1664
- $[4] === Symbol.for("react.memo_cache_sentinel") ? (t2 = [], $[4] = t2) : t2 = $[4], react.useEffect(t1, t2);
1665
- }
1666
- function isTargetWithinScope(boundaryElement, portalElement, target) {
1667
- return !boundaryElement || !portalElement ? !0 : containsOrEqualsElement(boundaryElement, target) || containsOrEqualsElement(portalElement, target);
1668
- }
1669
- const DEFAULT_DIALOG_CARD_ELEMENT = "div";
1670
- function DialogCard(props) {
1671
- const $ = compilerRuntime.c(61), t0 = props;
1672
- let autoFocus, children, footer, forwardedContentRef, forwardedRef, header, hideCloseButton, id, onClickOutside, onClose, portalProp, rest, t1;
1673
- $[0] !== t0 ? ({
1674
- __unstable_autoFocus: autoFocus,
1675
- __unstable_hideCloseButton: hideCloseButton,
1676
- as: t1,
1677
- children,
1678
- contentRef: forwardedContentRef,
1679
- footer,
1680
- header,
1681
- id,
1682
- onClickOutside,
1683
- onClose,
1684
- portal: portalProp,
1685
- ref: forwardedRef,
1686
- ...rest
1687
- } = t0, $[0] = t0, $[1] = autoFocus, $[2] = children, $[3] = footer, $[4] = forwardedContentRef, $[5] = forwardedRef, $[6] = header, $[7] = hideCloseButton, $[8] = id, $[9] = onClickOutside, $[10] = onClose, $[11] = portalProp, $[12] = rest, $[13] = t1) : (autoFocus = $[1], children = $[2], footer = $[3], forwardedContentRef = $[4], forwardedRef = $[5], header = $[6], hideCloseButton = $[7], id = $[8], onClickOutside = $[9], onClose = $[10], portalProp = $[11], rest = $[12], t1 = $[13]);
1688
- const as = t1 === void 0 ? DEFAULT_DIALOG_CARD_ELEMENT : t1, portal = usePortal(), portalElement = portalProp ? portal.elements?.[portalProp] || null : portal.element, boundaryElement = useBoundaryElement().element, ref = react.useRef(null), contentRef = react.useRef(null), layer = useLayer(), {
1689
- isTopLayer
1690
- } = layer, labelId = `${id}_label`, showCloseButton = !!onClose && hideCloseButton === !1, showHeader = !!header || showCloseButton, [scrollTop, setScrollTop] = react.useState(0), [scrollHeight, setScrollHeight] = react.useState(0), scrollBottom = scrollHeight - scrollTop;
1691
- let t2;
1692
- $[14] === Symbol.for("react.memo_cache_sentinel") ? (t2 = () => ref.current, $[14] = t2) : t2 = $[14], react.useImperativeHandle(forwardedRef, t2);
1693
- let t3;
1694
- $[15] === Symbol.for("react.memo_cache_sentinel") ? (t3 = () => contentRef.current, $[15] = t3) : t3 = $[15], react.useImperativeHandle(forwardedContentRef, t3);
1695
- let t4, t5;
1696
- $[16] !== autoFocus ? (t4 = () => {
1697
- autoFocus && ref.current && focusFirstDescendant(ref.current);
1698
- }, t5 = [autoFocus, ref], $[16] = autoFocus, $[17] = t4, $[18] = t5) : (t4 = $[17], t5 = $[18]), react.useEffect(t4, t5);
1699
- let t6;
1700
- $[19] !== boundaryElement || $[20] !== isTopLayer || $[21] !== onClose || $[22] !== portalElement ? (t6 = (event) => {
1701
- if (!isTopLayer || !onClose)
1702
- return;
1703
- const target = document.activeElement;
1704
- target && !isTargetWithinScope(boundaryElement, portalElement, target) || event.key === "Escape" && (event.preventDefault(), event.stopPropagation(), onClose());
1705
- }, $[19] = boundaryElement, $[20] = isTopLayer, $[21] = onClose, $[22] = portalElement, $[23] = t6) : t6 = $[23], useGlobalKeyDown(t6);
1706
- let t7;
1707
- $[24] !== boundaryElement || $[25] !== isTopLayer || $[26] !== onClickOutside || $[27] !== portalElement ? (t7 = isTopLayer && onClickOutside && ((event_0) => {
1708
- const target_0 = event_0.target;
1709
- target_0 && !isTargetWithinScope(boundaryElement, portalElement, target_0) || onClickOutside();
1710
- }), $[24] = boundaryElement, $[25] = isTopLayer, $[26] = onClickOutside, $[27] = portalElement, $[28] = t7) : t7 = $[28];
1711
- let t8;
1712
- $[29] === Symbol.for("react.memo_cache_sentinel") ? (t8 = () => [ref.current], $[29] = t8) : t8 = $[29], useClickOutsideEvent(t7, t8);
1713
- let t10, t9;
1714
- $[30] === Symbol.for("react.memo_cache_sentinel") ? (t9 = () => {
1715
- const el = contentRef.current;
1716
- if (!el)
1717
- return;
1718
- const handleScroll = () => {
1719
- setScrollTop(el.scrollTop), setScrollHeight(el.scrollHeight - el.offsetHeight);
1720
- };
1721
- return el.addEventListener("scroll", handleScroll, {
1722
- passive: !0
1723
- }), () => {
1724
- el.removeEventListener("scroll", handleScroll);
1725
- };
1726
- }, t10 = [], $[30] = t10, $[31] = t9) : (t10 = $[30], t9 = $[31]), react.useEffect(t9, t10);
1727
- let t11;
1728
- $[32] === Symbol.for("react.memo_cache_sentinel") ? (t11 = css.dialogCard(), $[32] = t11) : t11 = $[32];
1729
- let t12;
1730
- $[33] !== header || $[34] !== labelId || $[35] !== onClose || $[36] !== showCloseButton || $[37] !== showHeader ? (t12 = showHeader && /* @__PURE__ */ jsxRuntime.jsxs(Flex, { align: "flex-start", className: css.dialogHeader(), padding: 3, position: "relative", children: [
1731
- /* @__PURE__ */ jsxRuntime.jsx(Box, { flex: 1, padding: 2, children: header && /* @__PURE__ */ jsxRuntime.jsx(Text, { id: labelId, size: 1, weight: "semibold", children: header }) }),
1732
- showCloseButton && /* @__PURE__ */ jsxRuntime.jsx(Box, { flex: "none", children: /* @__PURE__ */ jsxRuntime.jsx(Button, { "aria-label": "Close dialog", disabled: !onClose, icon: icons.CloseIcon, mode: "bleed", onClick: onClose, padding: 2 }) })
1733
- ] }), $[33] = header, $[34] = labelId, $[35] = onClose, $[36] = showCloseButton, $[37] = showHeader, $[38] = t12) : t12 = $[38];
1734
- let t13;
1735
- $[39] === Symbol.for("react.memo_cache_sentinel") ? (t13 = css.dialogContent(), $[39] = t13) : t13 = $[39];
1736
- let t14;
1737
- $[40] !== scrollTop || $[41] !== showHeader ? (t14 = showHeader && /* @__PURE__ */ jsxRuntime.jsx("div", { className: css.dialogScrollerShadowTop(), style: {
1738
- opacity: Math.min(scrollTop, 32) / 32
1739
- } }), $[40] = scrollTop, $[41] = showHeader, $[42] = t14) : t14 = $[42];
1740
- let t15;
1741
- $[43] === Symbol.for("react.memo_cache_sentinel") ? (t15 = css.dialogScroller(), $[43] = t15) : t15 = $[43];
1742
- let t16;
1743
- $[44] !== children ? (t16 = /* @__PURE__ */ jsxRuntime.jsx(Box, { className: t15, overflow: "auto", ref: contentRef, children }), $[44] = children, $[45] = t16) : t16 = $[45];
1744
- let t17;
1745
- $[46] !== footer || $[47] !== scrollBottom ? (t17 = footer && /* @__PURE__ */ jsxRuntime.jsx("div", { className: css.dialogScrollerShadowBottom(), style: {
1746
- opacity: Math.min(scrollBottom, 32) / 32
1747
- } }), $[46] = footer, $[47] = scrollBottom, $[48] = t17) : t17 = $[48];
1748
- let t18;
1749
- $[49] !== t14 || $[50] !== t16 || $[51] !== t17 ? (t18 = /* @__PURE__ */ jsxRuntime.jsxs(Box, { className: t13, flex: 1, position: "relative", tabIndex: -1, children: [
1750
- t14,
1751
- t16,
1752
- t17
1753
- ] }), $[49] = t14, $[50] = t16, $[51] = t17, $[52] = t18) : t18 = $[52];
1754
- let t19;
1755
- $[53] !== footer ? (t19 = footer && /* @__PURE__ */ jsxRuntime.jsx(Box, { className: css.dialogFooter(), position: "relative", children: footer }), $[53] = footer, $[54] = t19) : t19 = $[54];
1756
- let t20;
1757
- return $[55] !== as || $[56] !== rest || $[57] !== t12 || $[58] !== t18 || $[59] !== t19 ? (t20 = /* @__PURE__ */ jsxRuntime.jsxs(Card, { ...rest, as, className: t11, display: "flex", flexDirection: "column", ref, children: [
1758
- t12,
1759
- t18,
1760
- t19
1761
- ] }), $[55] = as, $[56] = rest, $[57] = t12, $[58] = t18, $[59] = t19, $[60] = t20) : t20 = $[60], t20;
1762
- }
1763
- const DialogContext = createGlobalScopedContext("@sanity/ui/v3/dialog", {
1764
- version: 0
1765
- });
1766
- function useDialog() {
1767
- return react.useContext(DialogContext);
1768
- }
1769
- const DEFAULT_DIALOG_ELEMENT = "div";
1770
- function Dialog(props) {
1771
- const $ = compilerRuntime.c(69), context = useDialog(), t0 = props;
1772
- let _positionProp, _zOffsetProp, children, className, contentRef, footer, header, id, onActivate, onClickOutside, onClose, onFocus, portalProp, rest, scheme, t1, t2, t3, t4, t5, t6, t7, tone;
1773
- $[0] !== t0 ? ({
1774
- __unstable_autoFocus: t1,
1775
- __unstable_hideCloseButton: t2,
1776
- animate: t3,
1777
- cardRadius: t4,
1778
- children,
1779
- className,
1780
- contentRef,
1781
- footer,
1782
- header,
1783
- id,
1784
- onActivate,
1785
- onClickOutside,
1786
- onClose,
1787
- onFocus,
1788
- padding: t5,
1789
- portal: portalProp,
1790
- position: _positionProp,
1791
- scheme,
1792
- shadow: t6,
1793
- width: t7,
1794
- zOffset: _zOffsetProp,
1795
- tone,
1796
- ...rest
1797
- } = t0, $[0] = t0, $[1] = _positionProp, $[2] = _zOffsetProp, $[3] = children, $[4] = className, $[5] = contentRef, $[6] = footer, $[7] = header, $[8] = id, $[9] = onActivate, $[10] = onClickOutside, $[11] = onClose, $[12] = onFocus, $[13] = portalProp, $[14] = rest, $[15] = scheme, $[16] = t1, $[17] = t2, $[18] = t3, $[19] = t4, $[20] = t5, $[21] = t6, $[22] = t7, $[23] = tone) : (_positionProp = $[1], _zOffsetProp = $[2], children = $[3], className = $[4], contentRef = $[5], footer = $[6], header = $[7], id = $[8], onActivate = $[9], onClickOutside = $[10], onClose = $[11], onFocus = $[12], portalProp = $[13], rest = $[14], scheme = $[15], t1 = $[16], t2 = $[17], t3 = $[18], t4 = $[19], t5 = $[20], t6 = $[21], t7 = $[22], tone = $[23]);
1798
- const autoFocus = t1 === void 0 ? !0 : t1, hideCloseButton = t2 === void 0 ? !1 : t2, _animate = t3 === void 0 ? !1 : t3, cardRadiusProp = t4 === void 0 ? 4 : t4, padding = t5 === void 0 ? 3 : t5, cardShadow = t6 === void 0 ? 4 : t6, width = t7 === void 0 ? 0 : t7, positionProp = _positionProp ?? context.position ?? "fixed", zOffsetProp = _zOffsetProp ?? context.zOffset ?? Z_OFFSETS.dialog, animate = usePrefersReducedMotion() ? !1 : _animate, portal = usePortal(), portalElement = portalProp ? portal.elements?.[portalProp] || null : portal.element, boundaryElement = useBoundaryElement().element, cardRadius = useResponsiveProp(cardRadiusProp), position = useResponsiveProp(positionProp), zOffset = useResponsiveProp(zOffsetProp), preDivRef = react.useRef(null), postDivRef = react.useRef(null), cardRef = react.useRef(null), focusedElementRef = react.useRef(null);
1799
- let t8;
1800
- $[24] !== onFocus ? (t8 = (event) => {
1801
- onFocus?.(event);
1802
- const target = event.target, cardElement = cardRef.current;
1803
- if (cardElement && target === preDivRef.current) {
1804
- focusLastDescendant(cardElement);
1805
- return;
1806
- }
1807
- if (cardElement && target === postDivRef.current) {
1808
- focusFirstDescendant(cardElement);
1809
- return;
1810
- }
1811
- isHTMLElement(event.target) && (focusedElementRef.current = event.target);
1812
- }, $[24] = onFocus, $[25] = t8) : t8 = $[25];
1813
- const handleFocus = t8, labelId = `${id}_label`, rootClickTimeoutRef = react.useRef(void 0);
1814
- let t9;
1815
- $[26] !== boundaryElement || $[27] !== portalElement ? (t9 = () => {
1816
- rootClickTimeoutRef.current && clearTimeout(rootClickTimeoutRef.current), rootClickTimeoutRef.current = setTimeout(() => {
1817
- const activeElement = document.activeElement;
1818
- if (activeElement && !isTargetWithinScope(boundaryElement, portalElement, activeElement)) {
1819
- const target_0 = focusedElementRef.current;
1820
- if (!target_0 || !document.body.contains(target_0)) {
1821
- const cardElement_0 = cardRef.current;
1822
- cardElement_0 && focusFirstDescendant(cardElement_0);
1823
- return;
1824
- }
1825
- target_0.focus();
1826
- }
1827
- }, 0);
1828
- }, $[26] = boundaryElement, $[27] = portalElement, $[28] = t9) : t9 = $[28];
1829
- const handleRootClick = t9;
1830
- let t10;
1831
- $[29] !== className ? (t10 = css.dialog({
1832
- className
1833
- }), $[29] = className, $[30] = t10) : t10 = $[30];
1834
- const t11 = animate ? "" : void 0;
1835
- let t12;
1836
- $[31] === Symbol.for("react.memo_cache_sentinel") ? (t12 = /* @__PURE__ */ jsxRuntime.jsx("div", { ref: preDivRef, tabIndex: 0 }), $[31] = t12) : t12 = $[31];
1837
- let t13;
1838
- $[32] === Symbol.for("react.memo_cache_sentinel") ? (t13 = css.dialogContainer(), $[32] = t13) : t13 = $[32];
1839
- let t14;
1840
- $[33] !== autoFocus || $[34] !== cardRadius || $[35] !== cardShadow || $[36] !== children || $[37] !== contentRef || $[38] !== footer || $[39] !== header || $[40] !== hideCloseButton || $[41] !== id || $[42] !== onClickOutside || $[43] !== onClose || $[44] !== portalProp || $[45] !== scheme || $[46] !== tone || $[47] !== width ? (t14 = /* @__PURE__ */ jsxRuntime.jsx(DialogCard, { __unstable_autoFocus: autoFocus, __unstable_hideCloseButton: hideCloseButton, contentRef, footer, header, id, onClickOutside, onClose, portal: portalProp, radius: cardRadius, ref: cardRef, scheme, shadow: cardShadow, tone, width, children }), $[33] = autoFocus, $[34] = cardRadius, $[35] = cardShadow, $[36] = children, $[37] = contentRef, $[38] = footer, $[39] = header, $[40] = hideCloseButton, $[41] = id, $[42] = onClickOutside, $[43] = onClose, $[44] = portalProp, $[45] = scheme, $[46] = tone, $[47] = width, $[48] = t14) : t14 = $[48];
1841
- let t15;
1842
- $[49] !== t14 || $[50] !== width ? (t15 = /* @__PURE__ */ jsxRuntime.jsx(Container, { alignItems: "center", className: t13, "data-ui": "DialogCard", flexDirection: "column", display: "flex", justifyContent: "center", width, children: t14 }), $[49] = t14, $[50] = width, $[51] = t15) : t15 = $[51];
1843
- let t16;
1844
- $[52] === Symbol.for("react.memo_cache_sentinel") ? (t16 = /* @__PURE__ */ jsxRuntime.jsx("div", { ref: postDivRef, tabIndex: 0 }), $[52] = t16) : t16 = $[52];
1845
- let t17;
1846
- $[53] !== handleFocus || $[54] !== handleRootClick || $[55] !== id || $[56] !== labelId || $[57] !== onActivate || $[58] !== padding || $[59] !== position || $[60] !== rest || $[61] !== t10 || $[62] !== t11 || $[63] !== t15 || $[64] !== zOffset ? (t17 = /* @__PURE__ */ jsxRuntime.jsxs(Layer, { ...rest, "aria-labelledby": labelId, "aria-modal": !0, className: t10, "data-animate": t11, "data-ui": "Dialog", display: "flex", id, onActivate, onClick: handleRootClick, onFocus: handleFocus, padding, position, role: "dialog", zOffset, children: [
1847
- t12,
1848
- t15,
1849
- t16
1850
- ] }), $[53] = handleFocus, $[54] = handleRootClick, $[55] = id, $[56] = labelId, $[57] = onActivate, $[58] = padding, $[59] = position, $[60] = rest, $[61] = t10, $[62] = t11, $[63] = t15, $[64] = zOffset, $[65] = t17) : t17 = $[65];
1851
- let t18;
1852
- return $[66] !== portalProp || $[67] !== t17 ? (t18 = /* @__PURE__ */ jsxRuntime.jsx(Portal, { __unstable_name: portalProp, children: t17 }), $[66] = portalProp, $[67] = t17, $[68] = t18) : t18 = $[68], t18;
1853
- }
1854
- function DialogProvider(props) {
1855
- const $ = compilerRuntime.c(6), {
1856
- children,
1857
- position,
1858
- zOffset
1859
- } = props;
1860
- let t0, t1;
1861
- $[0] !== position || $[1] !== zOffset ? (t1 = {
1862
- version: 0,
1863
- position,
1864
- zOffset
1865
- }, $[0] = position, $[1] = zOffset, $[2] = t1) : t1 = $[2], t0 = t1;
1866
- const contextValue = t0;
1867
- let t2;
1868
- return $[3] !== children || $[4] !== contextValue ? (t2 = /* @__PURE__ */ jsxRuntime.jsx(DialogContext.Provider, { value: contextValue, children }), $[3] = children, $[4] = contextValue, $[5] = t2) : t2 = $[5], t2;
1869
- }
1870
- const DEFAULT_KBD_ELEMENT = "kbd";
1871
- function KBD(props) {
1872
- const $ = compilerRuntime.c(22), t0 = props;
1873
- let children, className, rest, t1, t2, t3, t4, t5;
1874
- $[0] !== t0 ? ({
1875
- as: t1,
1876
- children,
1877
- className,
1878
- display: t2,
1879
- fontSize: t3,
1880
- padding: t4,
1881
- radius: t5,
1882
- ...rest
1883
- } = t0, $[0] = t0, $[1] = children, $[2] = className, $[3] = rest, $[4] = t1, $[5] = t2, $[6] = t3, $[7] = t4, $[8] = t5) : (children = $[1], className = $[2], rest = $[3], t1 = $[4], t2 = $[5], t3 = $[6], t4 = $[7], t5 = $[8]);
1884
- const as = t1 === void 0 ? DEFAULT_KBD_ELEMENT : t1, display = t2 === void 0 ? "inline-block" : t2, fontSize = t3 === void 0 ? 1 : t3, padding = t4 === void 0 ? 1 : t4, radius = t5 === void 0 ? 2 : t5, t6 = as;
1885
- let t7;
1886
- $[9] !== className || $[10] !== radius ? (t7 = css.kbd({
1887
- className,
1888
- radius
1889
- }), $[9] = className, $[10] = radius, $[11] = t7) : t7 = $[11];
1890
- let t8;
1891
- $[12] !== children || $[13] !== fontSize ? (t8 = /* @__PURE__ */ jsxRuntime.jsx(Text, { as: "span", muted: !0, size: fontSize, weight: "medium", children }), $[12] = children, $[13] = fontSize, $[14] = t8) : t8 = $[14];
1892
- let t9;
1893
- return $[15] !== display || $[16] !== padding || $[17] !== rest || $[18] !== t6 || $[19] !== t7 || $[20] !== t8 ? (t9 = /* @__PURE__ */ jsxRuntime.jsx(Box, { "data-ui": "KBD", ...rest, as: t6, className: t7, display, muted: !0, padding, children: t8 }), $[15] = display, $[16] = padding, $[17] = rest, $[18] = t6, $[19] = t7, $[20] = t8, $[21] = t9) : t9 = $[21], t9;
1894
- }
1895
- const DEFAULT_HOTKEYS_ELEMENT = "kbd";
1896
- function Hotkeys(props) {
1897
- const $ = compilerRuntime.c(26), t0 = props;
1898
- let fontSize, gapX, gapY, keys, padding, radius, rest, t1, t2;
1899
- $[0] !== t0 ? ({
1900
- as: t1,
1901
- fontSize,
1902
- gap: t2,
1903
- gapX,
1904
- gapY,
1905
- keys,
1906
- padding,
1907
- radius,
1908
- ...rest
1909
- } = t0, $[0] = t0, $[1] = fontSize, $[2] = gapX, $[3] = gapY, $[4] = keys, $[5] = padding, $[6] = radius, $[7] = rest, $[8] = t1, $[9] = t2) : (fontSize = $[1], gapX = $[2], gapY = $[3], keys = $[4], padding = $[5], radius = $[6], rest = $[7], t1 = $[8], t2 = $[9]);
1910
- const as = t1 === void 0 ? DEFAULT_HOTKEYS_ELEMENT : t1, gap = t2 === void 0 ? 1 : t2;
1911
- if (!keys || keys.length === 0)
1912
- return;
1913
- let t3;
1914
- if ($[10] !== fontSize || $[11] !== keys || $[12] !== padding || $[13] !== radius) {
1915
- let t42;
1916
- $[15] !== fontSize || $[16] !== padding || $[17] !== radius ? (t42 = (key2, i) => /* @__PURE__ */ jsxRuntime.jsx(KBD, { fontSize, padding, radius, children: key2 }, i), $[15] = fontSize, $[16] = padding, $[17] = radius, $[18] = t42) : t42 = $[18], t3 = keys.map(t42), $[10] = fontSize, $[11] = keys, $[12] = padding, $[13] = radius, $[14] = t3;
1917
- } else
1918
- t3 = $[14];
1919
- let t4;
1920
- return $[19] !== as || $[20] !== gap || $[21] !== gapX || $[22] !== gapY || $[23] !== rest || $[24] !== t3 ? (t4 = /* @__PURE__ */ jsxRuntime.jsx(Box, { as, "data-ui": "Hotkeys", ...rest, display: "flex", gap, gapX, gapY, children: t3 }), $[19] = as, $[20] = gap, $[21] = gapX, $[22] = gapY, $[23] = rest, $[24] = t3, $[25] = t4) : t4 = $[25], t4;
1921
- }
1922
- const MenuContext = createGlobalScopedContext("@sanity/ui/v3/menu", null);
1923
- function _isFocusable(element) {
1924
- return isHTMLAnchorElement(element) && element.getAttribute("data-disabled") !== "true" || isHTMLButtonElement(element) && !element.disabled;
1925
- }
1926
- function _getFocusableElements(elements) {
1927
- return elements.filter(_isFocusable);
1928
- }
1929
- function _getDOMPath(rootElement, el) {
1930
- const path = [];
1931
- let e = el;
1932
- for (; e !== rootElement; ) {
1933
- const parentElement = e.parentElement;
1934
- if (!parentElement) return path;
1935
- const index = Array.from(parentElement.childNodes).indexOf(e);
1936
- if (path.unshift(index), parentElement === rootElement)
1937
- return path;
1938
- e = parentElement;
1939
- }
1940
- return path;
1941
- }
1942
- const EMPTY_PATH = [];
1943
- function _sortElements(rootElement, elements) {
1944
- if (!rootElement) return;
1945
- const map = /* @__PURE__ */ new WeakMap();
1946
- for (const el of elements)
1947
- map.set(el, _getDOMPath(rootElement, el));
1948
- const _sort = (a, b) => {
1949
- const _a = map.get(a) || EMPTY_PATH, _b = map.get(b) || EMPTY_PATH, len = Math.max(_a.length, _b.length);
1950
- for (let i = 0; i < len; i += 1) {
1951
- const aIndex = _a[i] || -1, bIndex = _b[i] || -1;
1952
- if (aIndex !== bIndex)
1953
- return aIndex - bIndex;
1954
- }
1955
- return 0;
1956
- };
1957
- elements.sort(_sort);
1958
- }
1959
- function useMenuController(props) {
1960
- const {
1961
- onKeyDown,
1962
- originElement,
1963
- shouldFocus,
1964
- rootElementRef
1965
- } = props, elementsRef = react.useRef([]), [activeIndex, _setActiveIndex] = react.useState(-1), activeIndexRef = react.useRef(activeIndex), activeElement = react.useMemo(() => elementsRef.current[activeIndex] || null, [activeIndex]), mounted = !!rootElementRef.current, setActiveIndex = react.useCallback((nextActiveIndex) => {
1966
- _setActiveIndex(nextActiveIndex), activeIndexRef.current = nextActiveIndex;
1967
- }, []), mount = react.useCallback((element, selected) => {
1968
- if (!element) return () => {
1969
- };
1970
- if (elementsRef.current.indexOf(element) === -1 && (elementsRef.current.push(element), _sortElements(rootElementRef.current, elementsRef.current)), selected) {
1971
- const selectedIndex = elementsRef.current.indexOf(element);
1972
- setActiveIndex(selectedIndex);
1973
- }
1974
- return () => {
1975
- const idx = elementsRef.current.indexOf(element);
1976
- idx > -1 && elementsRef.current.splice(idx, 1);
1977
- };
1978
- }, [rootElementRef, setActiveIndex]), handleKeyDown = react.useCallback((event) => {
1979
- if (event.key === "Tab") {
1980
- originElement && originElement.focus();
1981
- return;
1982
- }
1983
- if (event.key === "Home") {
1984
- event.preventDefault(), event.stopPropagation();
1985
- const el = _getFocusableElements(elementsRef.current)[0];
1986
- if (!el) return;
1987
- const currentIndex = elementsRef.current.indexOf(el);
1988
- setActiveIndex(currentIndex);
1989
- return;
1990
- }
1991
- if (event.key === "End") {
1992
- event.preventDefault(), event.stopPropagation();
1993
- const focusableElements_0 = _getFocusableElements(elementsRef.current), el_0 = focusableElements_0[focusableElements_0.length - 1];
1994
- if (!el_0) return;
1995
- const currentIndex_0 = elementsRef.current.indexOf(el_0);
1996
- setActiveIndex(currentIndex_0);
1997
- return;
1998
- }
1999
- if (event.key === "ArrowUp") {
2000
- event.preventDefault(), event.stopPropagation();
2001
- const focusableElements_1 = _getFocusableElements(elementsRef.current), focusableLen = focusableElements_1.length;
2002
- if (focusableLen === 0) return;
2003
- const focusedElement = elementsRef.current[activeIndexRef.current];
2004
- let focusedIndex = focusableElements_1.indexOf(focusedElement);
2005
- focusedIndex = (focusedIndex - 1 + focusableLen) % focusableLen;
2006
- const el_1 = focusableElements_1[focusedIndex], currentIndex_1 = elementsRef.current.indexOf(el_1);
2007
- setActiveIndex(currentIndex_1);
2008
- return;
2009
- }
2010
- if (event.key === "ArrowDown") {
2011
- event.preventDefault(), event.stopPropagation();
2012
- const focusableElements_2 = _getFocusableElements(elementsRef.current), focusableLen_0 = focusableElements_2.length;
2013
- if (focusableLen_0 === 0) return;
2014
- const focusedElement_0 = elementsRef.current[activeIndexRef.current];
2015
- let focusedIndex_0 = focusableElements_2.indexOf(focusedElement_0);
2016
- focusedIndex_0 = (focusedIndex_0 + 1) % focusableLen_0;
2017
- const el_2 = focusableElements_2[focusedIndex_0], currentIndex_2 = elementsRef.current.indexOf(el_2);
2018
- setActiveIndex(currentIndex_2);
2019
- return;
2020
- }
2021
- onKeyDown && onKeyDown(event);
2022
- }, [onKeyDown, originElement, setActiveIndex]), handleItemMouseEnter = react.useCallback((event_0) => {
2023
- const element_0 = event_0.currentTarget, currentIndex_3 = elementsRef.current.indexOf(element_0);
2024
- setActiveIndex(currentIndex_3);
2025
- }, [setActiveIndex]), handleItemMouseLeave = react.useCallback(() => {
2026
- setActiveIndex(-2), rootElementRef.current?.focus();
2027
- }, [rootElementRef, setActiveIndex]);
2028
- return react.useEffect(() => {
2029
- if (!mounted) return;
2030
- const rafId = requestAnimationFrame(() => {
2031
- if (activeIndex === -1) {
2032
- if (shouldFocus === "first") {
2033
- const el_3 = _getFocusableElements(elementsRef.current)[0];
2034
- if (el_3) {
2035
- const currentIndex_4 = elementsRef.current.indexOf(el_3);
2036
- setActiveIndex(currentIndex_4);
2037
- }
2038
- }
2039
- if (shouldFocus === "last") {
2040
- const focusableElements_4 = _getFocusableElements(elementsRef.current), el_4 = focusableElements_4[focusableElements_4.length - 1];
2041
- if (el_4) {
2042
- const currentIndex_5 = elementsRef.current.indexOf(el_4);
2043
- setActiveIndex(currentIndex_5);
2044
- }
2045
- }
2046
- return;
2047
- }
2048
- (elementsRef.current[activeIndex] || null)?.focus();
2049
- });
2050
- return () => cancelAnimationFrame(rafId);
2051
- }, [activeIndex, mounted, setActiveIndex, shouldFocus]), {
2052
- activeElement,
2053
- activeIndex,
2054
- handleItemMouseEnter,
2055
- handleItemMouseLeave,
2056
- handleKeyDown,
2057
- mount
2058
- };
2059
- }
2060
- const DEFAULT_MENU_ELEMENT = "div";
2061
- function Menu(props) {
2062
- const $ = compilerRuntime.c(57), t0 = props;
2063
- let _shouldFocus, children, className, forwardedRef, onClickOutside, onEscape, onItemClick, onItemSelect, onKeyDown, originElement, registerElement, rest, t1, t2, t3;
2064
- $[0] !== t0 ? ({
2065
- as: t1,
2066
- children,
2067
- className,
2068
- gap: t2,
2069
- onClickOutside,
2070
- onEscape,
2071
- onItemClick,
2072
- onItemSelect,
2073
- onKeyDown,
2074
- originElement,
2075
- padding: t3,
2076
- ref: forwardedRef,
2077
- registerElement,
2078
- shouldFocus: _shouldFocus,
2079
- ...rest
2080
- } = t0, $[0] = t0, $[1] = _shouldFocus, $[2] = children, $[3] = className, $[4] = forwardedRef, $[5] = onClickOutside, $[6] = onEscape, $[7] = onItemClick, $[8] = onItemSelect, $[9] = onKeyDown, $[10] = originElement, $[11] = registerElement, $[12] = rest, $[13] = t1, $[14] = t2, $[15] = t3) : (_shouldFocus = $[1], children = $[2], className = $[3], forwardedRef = $[4], onClickOutside = $[5], onEscape = $[6], onItemClick = $[7], onItemSelect = $[8], onKeyDown = $[9], originElement = $[10], registerElement = $[11], rest = $[12], t1 = $[13], t2 = $[14], t3 = $[15]);
2081
- const as = t1 === void 0 ? DEFAULT_MENU_ELEMENT : t1, gap = t2 === void 0 ? 1 : t2, padding = t3 === void 0 ? 1 : t3, shouldFocus = _shouldFocus ?? null, ref = react.useRef(null);
2082
- let t4;
2083
- $[16] === Symbol.for("react.memo_cache_sentinel") ? (t4 = () => ref.current, $[16] = t4) : t4 = $[16], react.useImperativeHandle(forwardedRef, t4);
2084
- const {
2085
- isTopLayer
2086
- } = useLayer();
2087
- let t5;
2088
- $[17] !== onKeyDown || $[18] !== originElement || $[19] !== shouldFocus ? (t5 = {
2089
- onKeyDown,
2090
- originElement,
2091
- shouldFocus,
2092
- rootElementRef: ref
2093
- }, $[17] = onKeyDown, $[18] = originElement, $[19] = shouldFocus, $[20] = t5) : t5 = $[20];
2094
- const {
2095
- activeElement,
2096
- activeIndex,
2097
- handleItemMouseEnter,
2098
- handleItemMouseLeave,
2099
- handleKeyDown,
2100
- mount
2101
- } = useMenuController(t5), unregisterElementRef = react.useRef(null);
2102
- let t6;
2103
- $[21] !== registerElement ? (t6 = (el) => {
2104
- unregisterElementRef.current && (unregisterElementRef.current(), unregisterElementRef.current = null), ref.current = el, ref.current && registerElement && (unregisterElementRef.current = registerElement(ref.current));
2105
- }, $[21] = registerElement, $[22] = t6) : t6 = $[22];
2106
- const handleRefChange = t6;
2107
- let t7, t8;
2108
- $[23] !== activeIndex || $[24] !== onItemSelect ? (t7 = () => {
2109
- onItemSelect && onItemSelect(activeIndex);
2110
- }, t8 = [activeIndex, onItemSelect], $[23] = activeIndex, $[24] = onItemSelect, $[25] = t7, $[26] = t8) : (t7 = $[25], t8 = $[26]), react.useEffect(t7, t8);
2111
- let t9;
2112
- $[27] === Symbol.for("react.memo_cache_sentinel") ? (t9 = () => [ref.current], $[27] = t9) : t9 = $[27], useClickOutsideEvent(isTopLayer && onClickOutside, t9);
2113
- let t10;
2114
- $[28] !== isTopLayer || $[29] !== onEscape ? (t10 = (event) => {
2115
- isTopLayer && event.key === "Escape" && (event.stopPropagation(), onEscape && onEscape());
2116
- }, $[28] = isTopLayer, $[29] = onEscape, $[30] = t10) : t10 = $[30], useGlobalKeyDown(t10);
2117
- let t11, t12;
2118
- $[31] !== activeElement || $[32] !== activeIndex || $[33] !== handleItemMouseEnter || $[34] !== handleItemMouseLeave || $[35] !== mount || $[36] !== onClickOutside || $[37] !== onEscape || $[38] !== onItemClick || $[39] !== registerElement ? (t12 = {
2119
- version: 0,
2120
- activeElement,
2121
- activeIndex,
2122
- mount,
2123
- onClickOutside,
2124
- onEscape,
2125
- onItemClick,
2126
- onItemMouseEnter: handleItemMouseEnter,
2127
- onItemMouseLeave: handleItemMouseLeave,
2128
- registerElement,
2129
- onMouseEnter: handleItemMouseEnter,
2130
- onMouseLeave: handleItemMouseLeave
2131
- }, $[31] = activeElement, $[32] = activeIndex, $[33] = handleItemMouseEnter, $[34] = handleItemMouseLeave, $[35] = mount, $[36] = onClickOutside, $[37] = onEscape, $[38] = onItemClick, $[39] = registerElement, $[40] = t12) : t12 = $[40], t11 = t12;
2132
- const value = t11;
2133
- let t13;
2134
- $[41] !== className ? (t13 = css.menu({
2135
- className
2136
- }), $[41] = className, $[42] = t13) : t13 = $[42];
2137
- let t14;
2138
- $[43] !== children || $[44] !== gap ? (t14 = /* @__PURE__ */ jsxRuntime.jsx(Stack, { gap, children }), $[43] = children, $[44] = gap, $[45] = t14) : t14 = $[45];
2139
- let t15;
2140
- $[46] !== as || $[47] !== handleKeyDown || $[48] !== handleRefChange || $[49] !== padding || $[50] !== rest || $[51] !== t13 || $[52] !== t14 ? (t15 = /* @__PURE__ */ jsxRuntime.jsx(Box, { "data-ui": "Menu", ...rest, as, className: t13, onKeyDown: handleKeyDown, overflow: "auto", outline: "none", padding, ref: handleRefChange, role: "menu", tabIndex: -1, children: t14 }), $[46] = as, $[47] = handleKeyDown, $[48] = handleRefChange, $[49] = padding, $[50] = rest, $[51] = t13, $[52] = t14, $[53] = t15) : t15 = $[53];
2141
- let t16;
2142
- return $[54] !== t15 || $[55] !== value ? (t16 = /* @__PURE__ */ jsxRuntime.jsx(MenuContext.Provider, { value, children: t15 }), $[54] = t15, $[55] = value, $[56] = t16) : t16 = $[56], t16;
2143
- }
2144
- function MenuButton(props) {
2145
- const $ = compilerRuntime.c(57), {
2146
- __unstable_disableRestoreFocusOnClose: t0,
2147
- button: buttonProp,
2148
- id,
2149
- menu: menuProp,
2150
- onClose,
2151
- onOpen,
2152
- popover,
2153
- ref: forwardedRef
2154
- } = props, disableRestoreFocusOnClose = t0 === void 0 ? !1 : t0, [open, setOpen] = react.useState(!1), [shouldFocus, setShouldFocus] = react.useState(null), [buttonElement, setButtonElement] = react.useState(null);
2155
- let t1;
2156
- $[0] === Symbol.for("react.memo_cache_sentinel") ? (t1 = [], $[0] = t1) : t1 = $[0];
2157
- const [menuElements, setChildMenuElements] = react.useState(t1), openRef = react.useRef(open);
2158
- let t2, t3;
2159
- $[1] !== onOpen || $[2] !== open ? (t2 = () => {
2160
- onOpen && open && !openRef.current && onOpen();
2161
- }, t3 = [onOpen, open], $[1] = onOpen, $[2] = open, $[3] = t2, $[4] = t3) : (t2 = $[3], t3 = $[4]), react.useEffect(t2, t3);
2162
- let t4, t5;
2163
- $[5] !== onClose || $[6] !== open ? (t4 = () => {
2164
- onClose && !open && openRef.current && onClose();
2165
- }, t5 = [onClose, open], $[5] = onClose, $[6] = open, $[7] = t4, $[8] = t5) : (t4 = $[7], t5 = $[8]), react.useEffect(t4, t5);
2166
- let t6, t7;
2167
- $[9] !== open ? (t6 = () => {
2168
- openRef.current = open;
2169
- }, t7 = [open], $[9] = open, $[10] = t6, $[11] = t7) : (t6 = $[10], t7 = $[11]), react.useEffect(t6, t7);
2170
- let t8;
2171
- $[12] === Symbol.for("react.memo_cache_sentinel") ? (t8 = () => {
2172
- setOpen(_temp$6), setShouldFocus(null);
2173
- }, $[12] = t8) : t8 = $[12];
2174
- const handleButtonClick = t8;
2175
- let t9;
2176
- $[13] !== open ? (t9 = (event) => {
2177
- open && event.preventDefault();
2178
- }, $[13] = open, $[14] = t9) : t9 = $[14];
2179
- const handleMouseDown = t9;
2180
- let t10;
2181
- $[15] === Symbol.for("react.memo_cache_sentinel") ? (t10 = (event_0) => {
2182
- if (event_0.key === "ArrowDown" || event_0.key === "Enter" || event_0.key === " ") {
2183
- event_0.preventDefault(), setOpen(!0), setShouldFocus("first");
2184
- return;
2185
- }
2186
- if (event_0.key === "ArrowUp") {
2187
- event_0.preventDefault(), setOpen(!0), setShouldFocus("last");
2188
- return;
2189
- }
2190
- }, $[15] = t10) : t10 = $[15];
2191
- const handleButtonKeyDown = t10;
2192
- let t11;
2193
- $[16] !== buttonElement || $[17] !== menuElements ? (t11 = (event_1) => {
2194
- const target = event_1.target;
2195
- if (target instanceof Node && !(buttonElement && (target === buttonElement || buttonElement.contains(target)))) {
2196
- for (const el of menuElements)
2197
- if (target === el || el.contains(target))
2198
- return;
2199
- setOpen(!1);
2200
- }
2201
- }, $[16] = buttonElement, $[17] = menuElements, $[18] = t11) : t11 = $[18];
2202
- const handleMenuClickOutside = t11;
2203
- let t12;
2204
- $[19] !== buttonElement || $[20] !== disableRestoreFocusOnClose ? (t12 = () => {
2205
- setOpen(!1), !disableRestoreFocusOnClose && buttonElement && buttonElement.focus();
2206
- }, $[19] = buttonElement, $[20] = disableRestoreFocusOnClose, $[21] = t12) : t12 = $[21];
2207
- const handleMenuEscape = t12;
2208
- let t13;
2209
- $[22] !== menuElements ? (t13 = (event_2) => {
2210
- const target_0 = event_2.relatedTarget;
2211
- if (target_0 instanceof Node) {
2212
- for (const el_0 of menuElements)
2213
- if (el_0 === target_0 || el_0.contains(target_0))
2214
- return;
2215
- setOpen(!1);
2216
- }
2217
- }, $[22] = menuElements, $[23] = t13) : t13 = $[23];
2218
- const handleBlur = t13;
2219
- let t14;
2220
- $[24] !== buttonElement || $[25] !== disableRestoreFocusOnClose ? (t14 = () => {
2221
- setOpen(!1), !disableRestoreFocusOnClose && buttonElement && buttonElement.focus();
2222
- }, $[24] = buttonElement, $[25] = disableRestoreFocusOnClose, $[26] = t14) : t14 = $[26];
2223
- const handleItemClick = t14;
2224
- let t15;
2225
- $[27] === Symbol.for("react.memo_cache_sentinel") ? (t15 = (el_1) => (setChildMenuElements((els) => els.concat([el_1])), () => setChildMenuElements((els_0) => els_0.filter((_el) => _el !== el_1))), $[27] = t15) : t15 = $[27];
2226
- const registerElement = t15;
2227
- let t16;
2228
- $[28] !== buttonElement || $[29] !== handleBlur || $[30] !== handleItemClick || $[31] !== handleMenuClickOutside || $[32] !== handleMenuEscape || $[33] !== id || $[34] !== menuProp || $[35] !== shouldFocus ? (t16 = menuProp && react.cloneElement(menuProp, {
2229
- "aria-labelledby": id,
2230
- onBlurCapture: handleBlur,
2231
- onClickOutside: handleMenuClickOutside,
2232
- onEscape: handleMenuEscape,
2233
- onItemClick: handleItemClick,
2234
- originElement: buttonElement,
2235
- registerElement,
2236
- shouldFocus
2237
- }), $[28] = buttonElement, $[29] = handleBlur, $[30] = handleItemClick, $[31] = handleMenuClickOutside, $[32] = handleMenuEscape, $[33] = id, $[34] = menuProp, $[35] = shouldFocus, $[36] = t16) : t16 = $[36];
2238
- const menu = t16;
2239
- let t17;
2240
- bb0: {
2241
- if (!buttonProp) {
2242
- t17 = null;
2243
- break bb0;
2244
- }
2245
- const t182 = buttonProp.props.selected ?? open;
2246
- let t192;
2247
- $[37] !== buttonProp || $[38] !== handleMouseDown || $[39] !== id || $[40] !== open || $[41] !== t182 ? (t192 = react.cloneElement(buttonProp, {
2248
- "data-ui": "MenuButton",
2249
- id,
2250
- onClick: handleButtonClick,
2251
- onKeyDown: handleButtonKeyDown,
2252
- onMouseDown: handleMouseDown,
2253
- "aria-haspopup": !0,
2254
- "aria-expanded": open,
2255
- ref: setButtonElement,
2256
- selected: t182
2257
- }), $[37] = buttonProp, $[38] = handleMouseDown, $[39] = id, $[40] = open, $[41] = t182, $[42] = t192) : t192 = $[42], t17 = t192;
2258
- }
2259
- const button = t17;
2260
- let t18, t19;
2261
- $[43] !== buttonElement ? (t18 = () => buttonElement, t19 = [buttonElement], $[43] = buttonElement, $[44] = t18, $[45] = t19) : (t18 = $[44], t19 = $[45]), react.useImperativeHandle(forwardedRef, t18, t19);
2262
- let t20, t21;
2263
- $[46] !== popover ? (t21 = popover || {}, $[46] = popover, $[47] = t21) : t21 = $[47];
2264
- let t22;
2265
- $[48] !== t21 ? (t22 = {
2266
- overflow: "auto",
2267
- ...t21
2268
- }, $[48] = t21, $[49] = t22) : t22 = $[49], t20 = t22;
2269
- const popoverProps = t20;
2270
- let t23;
2271
- $[50] !== button ? (t23 = button || /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {}), $[50] = button, $[51] = t23) : t23 = $[51];
2272
- let t24;
2273
- return $[52] !== menu || $[53] !== open || $[54] !== popoverProps || $[55] !== t23 ? (t24 = /* @__PURE__ */ jsxRuntime.jsx(Popover, { "data-ui": "MenuButton__popover", ...popoverProps, content: menu, open, children: t23 }), $[52] = menu, $[53] = open, $[54] = popoverProps, $[55] = t23, $[56] = t24) : t24 = $[56], t24;
2274
- }
2275
- function _temp$6(v) {
2276
- return !v;
2277
- }
2278
- const DEFAULT_MENU_DIVIDER_ELEMENT = "hr";
2279
- function MenuDivider(props) {
2280
- const $ = compilerRuntime.c(10), t0 = props;
2281
- let className, rest, t1;
2282
- $[0] !== t0 ? ({
2283
- as: t1,
2284
- className,
2285
- ...rest
2286
- } = t0, $[0] = t0, $[1] = className, $[2] = rest, $[3] = t1) : (className = $[1], rest = $[2], t1 = $[3]);
2287
- const Element2 = t1 === void 0 ? DEFAULT_MENU_DIVIDER_ELEMENT : t1;
2288
- let t2;
2289
- $[4] !== className ? (t2 = css.menuDivider({
2290
- className
2291
- }), $[4] = className, $[5] = t2) : t2 = $[5];
2292
- let t3;
2293
- return $[6] !== Element2 || $[7] !== rest || $[8] !== t2 ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(Element2, { ...rest, className: t2 }), $[6] = Element2, $[7] = rest, $[8] = t2, $[9] = t3) : t3 = $[9], t3;
2294
- }
2295
- function useMenu() {
2296
- const value = react.useContext(MenuContext);
2297
- if (!value)
2298
- throw new Error("useMenu(): missing context value");
2299
- if (!isRecord(value) || value.version !== 0)
2300
- throw new Error("useMenu(): the context value is not compatible");
2301
- return value;
2302
- }
2303
- const DEFAULT_MENU_GROUP_ELEMENT = "button";
2304
- function MenuGroup(props) {
2305
- const $ = compilerRuntime.c(77), t0 = props;
2306
- let IconComponent, children, menuProps, onClick, popover, rest, t1, t2, t3, t4, t5, t6, text;
2307
- $[0] !== t0 ? ({
2308
- as: t1,
2309
- children,
2310
- fontSize: t2,
2311
- gap: t3,
2312
- icon: IconComponent,
2313
- menu: menuProps,
2314
- onClick,
2315
- padding: t4,
2316
- popover,
2317
- radius: t5,
2318
- text,
2319
- tone: t6,
2320
- ...rest
2321
- } = t0, $[0] = t0, $[1] = IconComponent, $[2] = children, $[3] = menuProps, $[4] = onClick, $[5] = popover, $[6] = rest, $[7] = t1, $[8] = t2, $[9] = t3, $[10] = t4, $[11] = t5, $[12] = t6, $[13] = text) : (IconComponent = $[1], children = $[2], menuProps = $[3], onClick = $[4], popover = $[5], rest = $[6], t1 = $[7], t2 = $[8], t3 = $[9], t4 = $[10], t5 = $[11], t6 = $[12], text = $[13]);
2322
- const as = t1 === void 0 ? DEFAULT_MENU_GROUP_ELEMENT : t1, fontSize = t2 === void 0 ? 1 : t2, gap = t3 === void 0 ? 3 : t3, padding = t4 === void 0 ? 3 : t4, radius = t5 === void 0 ? 2 : t5, tone = t6 === void 0 ? "default" : t6, {
2323
- activeElement,
2324
- mount,
2325
- onClickOutside,
2326
- onEscape,
2327
- onItemClick,
2328
- onItemMouseEnter,
2329
- registerElement
2330
- } = useMenu(), [rootElement, setRootElement] = react.useState(null), [open, setOpen] = react.useState(!1), [shouldFocus, setShouldFocus] = react.useState(null), active = !!activeElement && activeElement === rootElement, [withinMenu, setWithinMenu] = react.useState(!1);
2331
- let t7;
2332
- $[14] !== onItemMouseEnter ? (t7 = (event) => {
2333
- setWithinMenu(!1), onItemMouseEnter?.(event), setOpen(!0);
2334
- }, $[14] = onItemMouseEnter, $[15] = t7) : t7 = $[15];
2335
- const handleMouseEnter = t7;
2336
- let t8;
2337
- $[16] !== rootElement ? (t8 = (event_0) => {
2338
- event_0.key === "ArrowLeft" && (event_0.stopPropagation(), setOpen(!1), requestAnimationFrame(() => {
2339
- rootElement?.focus();
2340
- }));
2341
- }, $[16] = rootElement, $[17] = t8) : t8 = $[17];
2342
- const handleMenuKeyDown = t8;
2343
- let t9;
2344
- $[18] !== onClick ? (t9 = (event_1) => {
2345
- onClick?.(event_1), setShouldFocus("first"), setOpen(!0);
2346
- }, $[18] = onClick, $[19] = t9) : t9 = $[19];
2347
- const handleClick = t9;
2348
- let t10;
2349
- $[20] !== onItemClick ? (t10 = () => {
2350
- setOpen(!1), onItemClick?.();
2351
- }, $[20] = onItemClick, $[21] = t10) : t10 = $[21];
2352
- const handleChildItemClick = t10;
2353
- let t11;
2354
- $[22] === Symbol.for("react.memo_cache_sentinel") ? (t11 = () => setWithinMenu(!0), $[22] = t11) : t11 = $[22];
2355
- const handleMenuMouseEnter = t11;
2356
- let t12, t13;
2357
- $[23] !== mount || $[24] !== rootElement ? (t12 = () => mount(rootElement), t13 = [mount, rootElement], $[23] = mount, $[24] = rootElement, $[25] = t12, $[26] = t13) : (t12 = $[25], t13 = $[26]), react.useEffect(t12, t13);
2358
- let t14, t15;
2359
- $[27] !== active ? (t14 = () => {
2360
- active || setOpen(!1);
2361
- }, t15 = [active], $[27] = active, $[28] = t14, $[29] = t15) : (t14 = $[28], t15 = $[29]), react.useEffect(t14, t15);
2362
- let t16, t17;
2363
- $[30] !== open ? (t16 = () => {
2364
- open || setWithinMenu(!1);
2365
- }, t17 = [open], $[30] = open, $[31] = t16, $[32] = t17) : (t16 = $[31], t17 = $[32]), react.useEffect(t16, t17);
2366
- let t18, t19;
2367
- $[33] !== shouldFocus ? (t18 = () => {
2368
- if (!shouldFocus)
2369
- return;
2370
- const rafId = requestAnimationFrame(() => setShouldFocus(null));
2371
- return () => cancelAnimationFrame(rafId);
2372
- }, t19 = [shouldFocus], $[33] = shouldFocus, $[34] = t18, $[35] = t19) : (t18 = $[34], t19 = $[35]), react.useEffect(t18, t19);
2373
- let t20;
2374
- $[36] !== children || $[37] !== handleChildItemClick || $[38] !== handleMenuKeyDown || $[39] !== menuProps || $[40] !== onClickOutside || $[41] !== onEscape || $[42] !== registerElement || $[43] !== shouldFocus ? (t20 = /* @__PURE__ */ jsxRuntime.jsx(Menu, { ...menuProps, onClickOutside, onEscape, onItemClick: handleChildItemClick, onKeyDown: handleMenuKeyDown, onMouseEnter: handleMenuMouseEnter, registerElement, shouldFocus, children }), $[36] = children, $[37] = handleChildItemClick, $[38] = handleMenuKeyDown, $[39] = menuProps, $[40] = onClickOutside, $[41] = onEscape, $[42] = registerElement, $[43] = shouldFocus, $[44] = t20) : t20 = $[44];
2375
- const childMenu = t20;
2376
- let t21;
2377
- $[45] === Symbol.for("react.memo_cache_sentinel") ? (t21 = (event_2) => {
2378
- const target = event_2.currentTarget;
2379
- if (document.activeElement === target && event_2.key === "ArrowRight") {
2380
- setShouldFocus("first"), setOpen(!0), setWithinMenu(!0);
2381
- return;
2382
- }
2383
- }, $[45] = t21) : t21 = $[45];
2384
- const handleKeyDown = t21, t22 = as === "button" ? withinMenu : void 0, t23 = as === "button" ? "button" : void 0;
2385
- let t24;
2386
- $[46] !== IconComponent || $[47] !== fontSize ? (t24 = IconComponent && /* @__PURE__ */ jsxRuntime.jsxs(Text, { size: fontSize, children: [
2387
- react.isValidElement(IconComponent) && IconComponent,
2388
- reactIs.isValidElementType(IconComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconComponent, {})
2389
- ] }), $[46] = IconComponent, $[47] = fontSize, $[48] = t24) : t24 = $[48];
2390
- let t25;
2391
- $[49] !== fontSize || $[50] !== text ? (t25 = /* @__PURE__ */ jsxRuntime.jsx(Box, { flex: 1, children: /* @__PURE__ */ jsxRuntime.jsx(Text, { size: fontSize, textOverflow: "ellipsis", weight: "medium", children: text }) }), $[49] = fontSize, $[50] = text, $[51] = t25) : t25 = $[51];
2392
- let t26;
2393
- $[52] === Symbol.for("react.memo_cache_sentinel") ? (t26 = /* @__PURE__ */ jsxRuntime.jsx(icons.ChevronRightIcon, {}), $[52] = t26) : t26 = $[52];
2394
- let t27;
2395
- $[53] !== fontSize ? (t27 = /* @__PURE__ */ jsxRuntime.jsx(Text, { size: fontSize, children: t26 }), $[53] = fontSize, $[54] = t27) : t27 = $[54];
2396
- let t28;
2397
- $[55] !== gap || $[56] !== padding || $[57] !== t24 || $[58] !== t25 || $[59] !== t27 ? (t28 = /* @__PURE__ */ jsxRuntime.jsxs(Flex, { gap, padding, children: [
2398
- t24,
2399
- t25,
2400
- t27
2401
- ] }), $[55] = gap, $[56] = padding, $[57] = t24, $[58] = t25, $[59] = t27, $[60] = t28) : t28 = $[60];
2402
- let t29;
2403
- $[61] !== as || $[62] !== handleClick || $[63] !== handleMouseEnter || $[64] !== radius || $[65] !== rest || $[66] !== t22 || $[67] !== t23 || $[68] !== t28 || $[69] !== tone || $[70] !== withinMenu ? (t29 = /* @__PURE__ */ jsxRuntime.jsx(Selectable, { "data-ui": "MenuGroup", ...rest, "aria-pressed": t22, as, onClick: handleClick, onKeyDown: handleKeyDown, onMouseEnter: handleMouseEnter, radius, ref: setRootElement, selected: withinMenu, tabIndex: -1, tone, type: t23, children: t28 }), $[61] = as, $[62] = handleClick, $[63] = handleMouseEnter, $[64] = radius, $[65] = rest, $[66] = t22, $[67] = t23, $[68] = t28, $[69] = tone, $[70] = withinMenu, $[71] = t29) : t29 = $[71];
2404
- let t30;
2405
- return $[72] !== childMenu || $[73] !== open || $[74] !== popover || $[75] !== t29 ? (t30 = /* @__PURE__ */ jsxRuntime.jsx(Popover, { ...popover, content: childMenu, "data-ui": "MenuGroup__popover", open, children: t29 }), $[72] = childMenu, $[73] = open, $[74] = popover, $[75] = t29, $[76] = t30) : t30 = $[76], t30;
2406
- }
2407
- const DEFAULT_MENU_ITEM_ELEMENT = "button";
2408
- function MenuItem(props) {
2409
- const $ = compilerRuntime.c(75), t0 = props;
2410
- let IconComponent, IconRightComponent, children, disabled, forwardedRef, gapX, gapY, hotkeys, onClick, paddingBottom, paddingLeft, paddingRight, paddingTop, paddingX, paddingY, pressed, rest, selectedProp, t1, t2, t3, t4, t5, t6, t7, text;
2411
- $[0] !== t0 ? ({
2412
- as: t1,
2413
- children,
2414
- disabled,
2415
- fontSize: t2,
2416
- gap: t3,
2417
- gapX,
2418
- gapY,
2419
- hotkeys,
2420
- icon: IconComponent,
2421
- iconRight: IconRightComponent,
2422
- onClick,
2423
- padding: t4,
2424
- paddingX,
2425
- paddingY,
2426
- paddingTop,
2427
- paddingRight,
2428
- paddingBottom,
2429
- paddingLeft,
2430
- pressed,
2431
- radius: t5,
2432
- ref: forwardedRef,
2433
- role: t6,
2434
- selected: selectedProp,
2435
- text,
2436
- tone: t7,
2437
- ...rest
2438
- } = t0, $[0] = t0, $[1] = IconComponent, $[2] = IconRightComponent, $[3] = children, $[4] = disabled, $[5] = forwardedRef, $[6] = gapX, $[7] = gapY, $[8] = hotkeys, $[9] = onClick, $[10] = paddingBottom, $[11] = paddingLeft, $[12] = paddingRight, $[13] = paddingTop, $[14] = paddingX, $[15] = paddingY, $[16] = pressed, $[17] = rest, $[18] = selectedProp, $[19] = t1, $[20] = t2, $[21] = t3, $[22] = t4, $[23] = t5, $[24] = t6, $[25] = t7, $[26] = text) : (IconComponent = $[1], IconRightComponent = $[2], children = $[3], disabled = $[4], forwardedRef = $[5], gapX = $[6], gapY = $[7], hotkeys = $[8], onClick = $[9], paddingBottom = $[10], paddingLeft = $[11], paddingRight = $[12], paddingTop = $[13], paddingX = $[14], paddingY = $[15], pressed = $[16], rest = $[17], selectedProp = $[18], t1 = $[19], t2 = $[20], t3 = $[21], t4 = $[22], t5 = $[23], t6 = $[24], t7 = $[25], text = $[26]);
2439
- const as = t1 === void 0 ? DEFAULT_MENU_ITEM_ELEMENT : t1, fontSize = t2 === void 0 ? 1 : t2, gap = t3 === void 0 ? 3 : t3, padding = t4 === void 0 ? 3 : t4, radius = t5 === void 0 ? 2 : t5, role = t6 === void 0 ? "menuitem" : t6, tone = t7 === void 0 ? "default" : t7, menu = useMenu(), {
2440
- activeElement,
2441
- mount,
2442
- onItemClick,
2443
- onItemMouseEnter,
2444
- onItemMouseLeave
2445
- } = menu, [rootElement, setRootElement] = react.useState(null), active = !!activeElement && activeElement === rootElement, ref = react.useRef(null);
2446
- let t8;
2447
- $[27] === Symbol.for("react.memo_cache_sentinel") ? (t8 = () => ref.current, $[27] = t8) : t8 = $[27], react.useImperativeHandle(forwardedRef, t8);
2448
- let t10, t9;
2449
- $[28] !== mount || $[29] !== rootElement || $[30] !== selectedProp ? (t9 = () => mount(rootElement, selectedProp), t10 = [mount, rootElement, selectedProp], $[28] = mount, $[29] = rootElement, $[30] = selectedProp, $[31] = t10, $[32] = t9) : (t10 = $[31], t9 = $[32]), react.useEffect(t9, t10);
2450
- let t11;
2451
- $[33] !== disabled || $[34] !== onClick || $[35] !== onItemClick ? (t11 = (event) => {
2452
- disabled || (onClick && onClick(event), onItemClick && onItemClick());
2453
- }, $[33] = disabled, $[34] = onClick, $[35] = onItemClick, $[36] = t11) : t11 = $[36];
2454
- const handleClick = t11;
2455
- let t12, t13;
2456
- $[37] !== padding || $[38] !== paddingBottom || $[39] !== paddingLeft || $[40] !== paddingRight || $[41] !== paddingTop || $[42] !== paddingX || $[43] !== paddingY ? (t13 = {
2457
- padding,
2458
- paddingX,
2459
- paddingY,
2460
- paddingTop,
2461
- paddingRight,
2462
- paddingBottom,
2463
- paddingLeft
2464
- }, $[37] = padding, $[38] = paddingBottom, $[39] = paddingLeft, $[40] = paddingRight, $[41] = paddingTop, $[42] = paddingX, $[43] = paddingY, $[44] = t13) : t13 = $[44], t12 = t13;
2465
- const paddingProps = t12;
2466
- let t14;
2467
- $[45] === Symbol.for("react.memo_cache_sentinel") ? (t14 = (el) => {
2468
- ref.current = el, setRootElement(el);
2469
- }, $[45] = t14) : t14 = $[45];
2470
- const setRef = t14, t15 = pressed ? "" : void 0, t16 = active ? "" : void 0, t17 = disabled ? "" : void 0, t18 = as === "button" ? "button" : void 0;
2471
- let t19;
2472
- $[46] !== IconComponent || $[47] !== IconRightComponent || $[48] !== fontSize || $[49] !== gap || $[50] !== gapX || $[51] !== gapY || $[52] !== hotkeys || $[53] !== paddingProps || $[54] !== text ? (t19 = (IconComponent || text || IconRightComponent) && /* @__PURE__ */ jsxRuntime.jsxs(Flex, { as: "span", gap, gapX, gapY, align: "center", ...paddingProps, children: [
2473
- IconComponent && /* @__PURE__ */ jsxRuntime.jsxs(Text, { muted: !0, size: fontSize, children: [
2474
- react.isValidElement(IconComponent) && IconComponent,
2475
- reactIs.isValidElementType(IconComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconComponent, {})
2476
- ] }),
2477
- text && /* @__PURE__ */ jsxRuntime.jsx(Box, { flex: 1, children: /* @__PURE__ */ jsxRuntime.jsx(Text, { size: fontSize, textOverflow: "ellipsis", weight: "medium", children: text }) }),
2478
- hotkeys && /* @__PURE__ */ jsxRuntime.jsx(Hotkeys, { keys: hotkeys, style: {
2479
- marginTop: -4,
2480
- marginBottom: -4
2481
- } }),
2482
- IconRightComponent && /* @__PURE__ */ jsxRuntime.jsxs(Text, { muted: !0, size: fontSize, children: [
2483
- react.isValidElement(IconRightComponent) && IconRightComponent,
2484
- reactIs.isValidElementType(IconRightComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconRightComponent, {})
2485
- ] })
2486
- ] }), $[46] = IconComponent, $[47] = IconRightComponent, $[48] = fontSize, $[49] = gap, $[50] = gapX, $[51] = gapY, $[52] = hotkeys, $[53] = paddingProps, $[54] = text, $[55] = t19) : t19 = $[55];
2487
- let t20;
2488
- $[56] !== children || $[57] !== paddingProps ? (t20 = children && /* @__PURE__ */ jsxRuntime.jsx(Box, { as: "span", ...paddingProps, children }), $[56] = children, $[57] = paddingProps, $[58] = t20) : t20 = $[58];
2489
- let t21;
2490
- return $[59] !== as || $[60] !== disabled || $[61] !== handleClick || $[62] !== onItemMouseEnter || $[63] !== onItemMouseLeave || $[64] !== radius || $[65] !== rest || $[66] !== role || $[67] !== t15 || $[68] !== t16 || $[69] !== t17 || $[70] !== t18 || $[71] !== t19 || $[72] !== t20 || $[73] !== tone ? (t21 = /* @__PURE__ */ jsxRuntime.jsxs(Selectable, { "data-ui": "MenuItem", ...rest, as, "data-pressed": t15, "data-selected": t16, "data-disabled": t17, radius, disabled, onClick: handleClick, onMouseEnter: onItemMouseEnter, onMouseLeave: onItemMouseLeave, ref: setRef, role, tabIndex: -1, tone, type: t18, children: [
2491
- t19,
2492
- t20
2493
- ] }), $[59] = as, $[60] = disabled, $[61] = handleClick, $[62] = onItemMouseEnter, $[63] = onItemMouseLeave, $[64] = radius, $[65] = rest, $[66] = role, $[67] = t15, $[68] = t16, $[69] = t17, $[70] = t18, $[71] = t19, $[72] = t20, $[73] = tone, $[74] = t21) : t21 = $[74], t21;
2494
- }
2495
- const DEFAULT_TAB_ELEMENT = "button";
2496
- function Tab(props) {
2497
- const $ = compilerRuntime.c(33), t0 = props;
2498
- let focused, forwardedRef, icon, id, label, onClick, onFocus, rest, selected, t1, t2, t3;
2499
- $[0] !== t0 ? ({
2500
- as: t1,
2501
- icon,
2502
- id,
2503
- focused,
2504
- fontSize: t2,
2505
- label,
2506
- onClick,
2507
- onFocus,
2508
- padding: t3,
2509
- ref: forwardedRef,
2510
- selected,
2511
- ...rest
2512
- } = t0, $[0] = t0, $[1] = focused, $[2] = forwardedRef, $[3] = icon, $[4] = id, $[5] = label, $[6] = onClick, $[7] = onFocus, $[8] = rest, $[9] = selected, $[10] = t1, $[11] = t2, $[12] = t3) : (focused = $[1], forwardedRef = $[2], icon = $[3], id = $[4], label = $[5], onClick = $[6], onFocus = $[7], rest = $[8], selected = $[9], t1 = $[10], t2 = $[11], t3 = $[12]);
2513
- const as = t1 === void 0 ? DEFAULT_TAB_ELEMENT : t1, fontSize = t2 === void 0 ? 1 : t2, padding = t3 === void 0 ? 2 : t3, ref = react.useRef(null), focusedRef = react.useRef(!1);
2514
- let t4;
2515
- $[13] === Symbol.for("react.memo_cache_sentinel") ? (t4 = () => ref.current, $[13] = t4) : t4 = $[13], react.useImperativeHandle(forwardedRef, t4);
2516
- let t5;
2517
- $[14] === Symbol.for("react.memo_cache_sentinel") ? (t5 = () => {
2518
- focusedRef.current = !1;
2519
- }, $[14] = t5) : t5 = $[14];
2520
- const handleBlur = t5;
2521
- let t6;
2522
- $[15] !== onFocus ? (t6 = (event) => {
2523
- focusedRef.current = !0, onFocus && onFocus(event);
2524
- }, $[15] = onFocus, $[16] = t6) : t6 = $[16];
2525
- const handleFocus = t6;
2526
- let t7, t8;
2527
- $[17] !== focused ? (t7 = () => {
2528
- focused && !focusedRef.current && (ref.current && ref.current.focus(), focusedRef.current = !0);
2529
- }, t8 = [focused], $[17] = focused, $[18] = t7, $[19] = t8) : (t7 = $[18], t8 = $[19]), react.useEffect(t7, t8);
2530
- const t9 = selected ? "true" : "false", t10 = selected ? 0 : -1;
2531
- let t11;
2532
- return $[20] !== as || $[21] !== fontSize || $[22] !== handleFocus || $[23] !== icon || $[24] !== id || $[25] !== label || $[26] !== onClick || $[27] !== padding || $[28] !== rest || $[29] !== selected || $[30] !== t10 || $[31] !== t9 ? (t11 = /* @__PURE__ */ jsxRuntime.jsx(Button, { "data-ui": "Tab", ...rest, "aria-selected": t9, as, fontSize, icon, id, mode: "bleed", onClick, onBlur: handleBlur, onFocus: handleFocus, padding, ref, role: "tab", selected, tabIndex: t10, text: label, type: "button" }), $[20] = as, $[21] = fontSize, $[22] = handleFocus, $[23] = icon, $[24] = id, $[25] = label, $[26] = onClick, $[27] = padding, $[28] = rest, $[29] = selected, $[30] = t10, $[31] = t9, $[32] = t11) : t11 = $[32], t11;
2533
- }
2534
- const DEFAULT_TAB_LIST_ELEMENT = "div";
2535
- function TabList(props) {
2536
- const $ = compilerRuntime.c(20), t0 = props;
2537
- let childrenProp, rest, t1, t2, t3;
2538
- $[0] !== t0 ? ({
2539
- as: t1,
2540
- children: childrenProp,
2541
- gap: t2,
2542
- wrap: t3,
2543
- ...rest
2544
- } = t0, $[0] = t0, $[1] = childrenProp, $[2] = rest, $[3] = t1, $[4] = t2, $[5] = t3) : (childrenProp = $[1], rest = $[2], t1 = $[3], t2 = $[4], t3 = $[5]);
2545
- const as = t1 === void 0 ? DEFAULT_TAB_LIST_ELEMENT : t1, gap = t2 === void 0 ? 1 : t2, wrap = t3 === void 0 ? "nowrap" : t3, [focusedIndex, setFocusedIndex] = react.useState(-1);
2546
- let t4;
2547
- if ($[6] !== childrenProp || $[7] !== focusedIndex) {
2548
- const children = react.Children.toArray(childrenProp).filter(_isReactElement);
2549
- let t52;
2550
- $[9] !== focusedIndex ? (t52 = (child, childIndex) => react.cloneElement(child, {
2551
- focused: focusedIndex === childIndex,
2552
- key: childIndex,
2553
- onFocus: () => setFocusedIndex(childIndex)
2554
- }), $[9] = focusedIndex, $[10] = t52) : t52 = $[10], t4 = children.map(t52), $[6] = childrenProp, $[7] = focusedIndex, $[8] = t4;
2555
- } else
2556
- t4 = $[8];
2557
- const tabs = t4, numTabs = tabs.length;
2558
- let t5;
2559
- $[11] !== numTabs ? (t5 = (event) => {
2560
- event.key === "ArrowLeft" && setFocusedIndex((prevIndex) => (prevIndex + numTabs - 1) % numTabs), event.key === "ArrowRight" && setFocusedIndex((prevIndex_0) => (prevIndex_0 + 1) % numTabs);
2561
- }, $[11] = numTabs, $[12] = t5) : t5 = $[12];
2562
- const handleKeyDown = t5;
2563
- let t6;
2564
- return $[13] !== as || $[14] !== gap || $[15] !== handleKeyDown || $[16] !== rest || $[17] !== tabs || $[18] !== wrap ? (t6 = /* @__PURE__ */ jsxRuntime.jsx(Flex, { "data-ui": "TabList", ...rest, as, gap, onKeyDown: handleKeyDown, role: "tablist", wrap, children: tabs }), $[13] = as, $[14] = gap, $[15] = handleKeyDown, $[16] = rest, $[17] = tabs, $[18] = wrap, $[19] = t6) : t6 = $[19], t6;
2565
- }
2566
- function _isReactElement(node) {
2567
- return !!node;
2568
- }
2569
- const DEFAULT_TAB_PANEL_ELEMENT = "div";
2570
- function TabPanel(props) {
2571
- const $ = compilerRuntime.c(10), t0 = props;
2572
- let children, rest, t1, tabIndex;
2573
- $[0] !== t0 ? ({
2574
- as: t1,
2575
- children,
2576
- tabIndex,
2577
- ...rest
2578
- } = t0, $[0] = t0, $[1] = children, $[2] = rest, $[3] = t1, $[4] = tabIndex) : (children = $[1], rest = $[2], t1 = $[3], tabIndex = $[4]);
2579
- const as = t1 === void 0 ? DEFAULT_TAB_PANEL_ELEMENT : t1, t2 = tabIndex === void 0 ? 0 : tabIndex;
2580
- let t3;
2581
- return $[5] !== as || $[6] !== children || $[7] !== rest || $[8] !== t2 ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(Box, { "data-ui": "TabPanel", ...rest, as, role: "tabpanel", tabIndex: t2, children }), $[5] = as, $[6] = children, $[7] = rest, $[8] = t2, $[9] = t3) : t3 = $[9], t3;
2582
- }
2583
- const DEFAULT_TOAST_ELEMENT = "li", LONG_ENOUGH_BUT_NOT_TOO_LONG = 1e3 * 60 * 60 * 24 * 24, ROLES = {
2584
- error: "alert",
2585
- warning: "alert",
2586
- success: "alert",
2587
- info: "alert"
2588
- }, STATUS_CARD_TONE = {
2589
- error: "critical",
2590
- warning: "caution",
2591
- success: "positive",
2592
- info: "neutral"
2593
- }, BUTTON_TONE = {
2594
- error: "critical",
2595
- warning: "caution",
2596
- success: "positive",
2597
- info: "neutral"
2598
- };
2599
- function Toast(props) {
2600
- const $ = compilerRuntime.c(42), t0 = props;
2601
- let closable, description, duration, onClose, rest, status, t1, t2, title;
2602
- $[0] !== t0 ? ({
2603
- as: t1,
2604
- closable,
2605
- description,
2606
- duration,
2607
- onClose,
2608
- radius: t2,
2609
- title,
2610
- status,
2611
- ...rest
2612
- } = t0, $[0] = t0, $[1] = closable, $[2] = description, $[3] = duration, $[4] = onClose, $[5] = rest, $[6] = status, $[7] = t1, $[8] = t2, $[9] = title) : (closable = $[1], description = $[2], duration = $[3], onClose = $[4], rest = $[5], status = $[6], t1 = $[7], t2 = $[8], title = $[9]);
2613
- const as = t1 === void 0 ? DEFAULT_TOAST_ELEMENT : t1, radius = t2 === void 0 ? 3 : t2, cardTone = status ? STATUS_CARD_TONE[status] : "default", buttonTone = status ? BUTTON_TONE[status] : "default", role = status ? ROLES[status] : "status", visualDuration = usePrefersReducedMotion() ? 0 : 0.26;
2614
- let t3;
2615
- $[10] !== visualDuration ? (t3 = visualDuration ? {
2616
- type: "spring",
2617
- visualDuration,
2618
- bounce: 0.25
2619
- } : {
2620
- duration: 0
2621
- }, $[10] = visualDuration, $[11] = t3) : t3 = $[11];
2622
- const transition = t3, hasDuration = duration && isFinite(duration) && duration < LONG_ENOUGH_BUT_NOT_TOO_LONG;
2623
- let t4;
2624
- $[12] === Symbol.for("react.memo_cache_sentinel") ? (t4 = ["hidden", "initial"], $[12] = t4) : t4 = $[12];
2625
- const initial = t4;
2626
- let t5;
2627
- $[13] === Symbol.for("react.memo_cache_sentinel") ? (t5 = ["visible", "slideIn"], $[13] = t5) : t5 = $[13];
2628
- const animate = t5;
2629
- let t6;
2630
- $[14] === Symbol.for("react.memo_cache_sentinel") ? (t6 = ["hidden", "slideOut"], $[14] = t6) : t6 = $[14];
2631
- const exit = t6;
2632
- let t7;
2633
- $[15] === Symbol.for("react.memo_cache_sentinel") ? (t7 = css.toast(), $[15] = t7) : t7 = $[15];
2634
- const t8 = hasDuration ? "" : void 0;
2635
- let t9;
2636
- $[16] !== title ? (t9 = title && /* @__PURE__ */ jsxRuntime.jsx(Text, { size: 1, weight: "medium", children: title }), $[16] = title, $[17] = t9) : t9 = $[17];
2637
- let t10;
2638
- $[18] !== description || $[19] !== transition ? (t10 = description && /* @__PURE__ */ jsxRuntime.jsx(MotionText, { muted: !0, size: 1, variants: content, transition, children: description }), $[18] = description, $[19] = transition, $[20] = t10) : t10 = $[20];
2639
- let t11;
2640
- $[21] !== t10 || $[22] !== t9 ? (t11 = /* @__PURE__ */ jsxRuntime.jsx(Flex, { flex: 1, overflowX: "auto", padding: 3, children: /* @__PURE__ */ jsxRuntime.jsxs(Stack, { gap: 3, children: [
2641
- t9,
2642
- t10
2643
- ] }) }), $[21] = t10, $[22] = t9, $[23] = t11) : t11 = $[23];
2644
- let t12;
2645
- $[24] !== buttonTone || $[25] !== closable || $[26] !== onClose ? (t12 = closable && /* @__PURE__ */ jsxRuntime.jsx(Box, { padding: 1, children: /* @__PURE__ */ jsxRuntime.jsx(Button, { as: "button", icon: icons.CloseIcon, mode: "bleed", padding: 2, tone: buttonTone, onClick: onClose, style: {
2646
- verticalAlign: "top"
2647
- } }) }), $[24] = buttonTone, $[25] = closable, $[26] = onClose, $[27] = t12) : t12 = $[27];
2648
- let t13;
2649
- $[28] !== t11 || $[29] !== t12 || $[30] !== transition ? (t13 = /* @__PURE__ */ jsxRuntime.jsxs(MotionFlex, { align: "flex-start", variants: content, transition, children: [
2650
- t11,
2651
- t12
2652
- ] }), $[28] = t11, $[29] = t12, $[30] = transition, $[31] = t13) : t13 = $[31];
2653
- let t14;
2654
- return $[32] !== as || $[33] !== cardTone || $[34] !== radius || $[35] !== rest || $[36] !== role || $[37] !== t13 || $[38] !== t8 || $[39] !== transition || $[40] !== visualDuration ? (t14 = /* @__PURE__ */ jsxRuntime.jsx(MotionCard, { as, className: t7, "data-ui": "Toast", role, ...rest, custom: visualDuration, "data-has-duration": t8, radius, shadow: 2, tone: cardTone, layout: "position", variants: container, initial, animate, exit, transition, position: "relative", children: t13 }), $[32] = as, $[33] = cardTone, $[34] = radius, $[35] = rest, $[36] = role, $[37] = t13, $[38] = t8, $[39] = transition, $[40] = visualDuration, $[41] = t14) : t14 = $[41], t14;
2655
- }
2656
- const container = {
2657
- initial: {
2658
- y: 32,
2659
- scale: 0.5,
2660
- zIndex: 1
2661
- },
2662
- hidden: {
2663
- opacity: 0
2664
- },
2665
- visible: (visualDuration) => visualDuration ? {
2666
- opacity: 1,
2667
- transition: {
2668
- when: "beforeChildren",
2669
- staggerChildren: visualDuration / 3,
2670
- duration: visualDuration / 3
2671
- }
2672
- } : {
2673
- opacity: 1
2674
- },
2675
- slideIn: {
2676
- y: 0,
2677
- scale: 1
2678
- },
2679
- slideOut: {
2680
- zIndex: 0,
2681
- scale: 0.75
2682
- }
2683
- }, content = {
2684
- initial: {
2685
- willChange: "transform"
2686
- },
2687
- hidden: {
2688
- opacity: 0
2689
- },
2690
- visible: {
2691
- opacity: 1
2692
- }
2693
- }, MotionCard = framerMotion.motion.create(Card), MotionFlex = framerMotion.motion.create(Flex), MotionText = framerMotion.motion.create(Text);
2694
- function useMounted() {
2695
- return react.useSyncExternalStore(subscribe, _temp$5, _temp2);
2696
- }
2697
- function _temp2() {
2698
- return !1;
2699
- }
2700
- function _temp$5() {
2701
- return !0;
2702
- }
2703
- const subscribe = () => () => {
2704
- }, ToastContext = createGlobalScopedContext("@sanity/ui/v3/toast", null), DEFAULT_GRID_ELEMENT = "div";
2705
- function Grid(props) {
2706
- const $ = compilerRuntime.c(8), t0 = props;
2707
- let children, rest, t1;
2708
- $[0] !== t0 ? ({
2709
- as: t1,
2710
- children,
2711
- ...rest
2712
- } = t0, $[0] = t0, $[1] = children, $[2] = rest, $[3] = t1) : (children = $[1], rest = $[2], t1 = $[3]);
2713
- const as = t1 === void 0 ? DEFAULT_GRID_ELEMENT : t1;
2714
- let t2;
2715
- return $[4] !== as || $[5] !== children || $[6] !== rest ? (t2 = /* @__PURE__ */ jsxRuntime.jsx(Box, { "data-ui": "Grid", ...rest, as, display: "grid", children }), $[4] = as, $[5] = children, $[6] = rest, $[7] = t2) : t2 = $[7], t2;
2716
- }
2717
- const DEFAULT_TOAST_LAYER_ELEMENT = "ul";
2718
- function ToastLayer(props) {
2719
- const $ = compilerRuntime.c(11), {
2720
- as: t0,
2721
- children,
2722
- padding: t1,
2723
- paddingX,
2724
- paddingY,
2725
- gap: t2
2726
- } = props, as = t0 === void 0 ? DEFAULT_TOAST_LAYER_ELEMENT : t0, padding = t1 === void 0 ? 4 : t1, gap = t2 === void 0 ? 3 : t2, {
2727
- zIndex
2728
- } = useLayer();
2729
- let t3;
2730
- $[0] === Symbol.for("react.memo_cache_sentinel") ? (t3 = css.toastLayer(), $[0] = t3) : t3 = $[0];
2731
- let t4;
2732
- $[1] !== zIndex ? (t4 = {
2733
- zIndex
2734
- }, $[1] = zIndex, $[2] = t4) : t4 = $[2];
2735
- let t5;
2736
- return $[3] !== as || $[4] !== children || $[5] !== gap || $[6] !== padding || $[7] !== paddingX || $[8] !== paddingY || $[9] !== t4 ? (t5 = /* @__PURE__ */ jsxRuntime.jsx(Grid, { as, className: t3, "data-ui": "ToastProvider", padding, paddingX, paddingY, gap, gridTemplateColumns: 1, style: t4, children }), $[3] = as, $[4] = children, $[5] = gap, $[6] = padding, $[7] = paddingX, $[8] = paddingY, $[9] = t4, $[10] = t5) : t5 = $[10], t5;
2737
- }
2738
- let toastId = 0;
2739
- function generateToastId() {
2740
- return String(toastId++);
2741
- }
2742
- function ToastProvider(props) {
2743
- const $ = compilerRuntime.c(13), {
2744
- children,
2745
- padding,
2746
- paddingX,
2747
- paddingY,
2748
- gap,
2749
- zOffset: t0
2750
- } = props, zOffset = t0 === void 0 ? 1 : t0;
2751
- let t1;
2752
- $[0] === Symbol.for("react.memo_cache_sentinel") ? (t1 = [], $[0] = t1) : t1 = $[0];
2753
- const [state, setState] = react.useState(t1), mounted = useMounted();
2754
- let t2, t3;
2755
- $[1] === Symbol.for("react.memo_cache_sentinel") ? (t3 = {
2756
- version: 0,
2757
- push: (params) => {
2758
- const id = params.id ?? generateToastId(), duration = params.duration ?? 5e3;
2759
- return react.startTransition(() => {
2760
- setState((prevState) => {
2761
- if (duration === 0.01)
2762
- return prevState.filter((toast) => toast.id !== id);
2763
- const dismiss = () => {
2764
- react.startTransition(() => {
2765
- timeoutId && clearTimeout(timeoutId), setState((currentState) => currentState.filter((toast_0) => toast_0.id !== id));
2766
- });
2767
- }, timeoutId = setTimeout(dismiss, duration);
2768
- return [...prevState.filter((toast_1) => toast_1.id !== id), {
2769
- dismiss,
2770
- id,
2771
- params: {
2772
- ...params,
2773
- duration
2774
- }
2775
- }];
2776
- });
2777
- }), id;
2778
- }
2779
- }, $[1] = t3) : t3 = $[1], t2 = t3;
2780
- const value = t2;
2781
- let t4;
2782
- $[2] !== gap || $[3] !== mounted || $[4] !== padding || $[5] !== paddingX || $[6] !== paddingY || $[7] !== state || $[8] !== zOffset ? (t4 = mounted && /* @__PURE__ */ jsxRuntime.jsx(LayerProvider, { zOffset, children: /* @__PURE__ */ jsxRuntime.jsx(ToastLayer, { padding, paddingX, paddingY, gap, children: /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { initial: !1, mode: "popLayout", children: state.map(_temp$4) }) }) }), $[2] = gap, $[3] = mounted, $[4] = padding, $[5] = paddingX, $[6] = paddingY, $[7] = state, $[8] = zOffset, $[9] = t4) : t4 = $[9];
2783
- let t5;
2784
- return $[10] !== children || $[11] !== t4 ? (t5 = /* @__PURE__ */ jsxRuntime.jsxs(ToastContext.Provider, { value, children: [
2785
- children,
2786
- t4
2787
- ] }), $[10] = children, $[11] = t4, $[12] = t5) : t5 = $[12], t5;
2788
- }
2789
- function _temp$4(t0) {
2790
- const {
2791
- dismiss: dismiss_0,
2792
- id: id_0,
2793
- params: params_0
2794
- } = t0;
2795
- return /* @__PURE__ */ jsxRuntime.jsx(Toast, { closable: params_0.closable, description: params_0.description, onClose: dismiss_0, status: params_0.status, title: params_0.title, duration: params_0.duration }, id_0);
2796
- }
2797
- function useToast() {
2798
- const value = react.useContext(ToastContext);
2799
- if (!value)
2800
- throw new Error("useToast(): missing context value");
2801
- if (!isRecord(value) || value.version !== 0)
2802
- throw new Error("useToast(): the context value is not compatible");
2803
- return value;
2804
- }
2805
- function _findPrevItemElement(state, itemElements, focusedElement) {
2806
- const idx = itemElements.indexOf(focusedElement), els = itemElements.slice(0, idx), len = els.length;
2807
- for (let i = len - 1; i >= 0; i -= 1) {
2808
- const itemKey = els[i].getAttribute("data-tree-key");
2809
- if (!itemKey)
2810
- continue;
2811
- const segments = itemKey.split("/");
2812
- segments.pop();
2813
- const p = [];
2814
- let expanded = !0;
2815
- for (let j = 0; j < segments.length; j += 1) {
2816
- p.push(segments[j]);
2817
- const k = p.join("/");
2818
- if (!state[k]?.expanded) {
2819
- expanded = !1;
2820
- break;
2821
- }
2822
- }
2823
- if (expanded)
2824
- return els[i];
2825
- }
2826
- return null;
2827
- }
2828
- function _findNextItemElement(state, itemElements, focusedElement) {
2829
- const idx = itemElements.indexOf(focusedElement), els = itemElements.slice(idx), len = itemElements.length;
2830
- for (let i = 1; i < len; i += 1) {
2831
- if (!els[i])
2832
- continue;
2833
- const itemKey = els[i].getAttribute("data-tree-key");
2834
- if (!itemKey)
2835
- continue;
2836
- const segments = itemKey.split("/");
2837
- segments.pop();
2838
- const p = [];
2839
- let expanded = !0;
2840
- for (let j = 0; j < segments.length; j += 1) {
2841
- p.push(segments[j]);
2842
- const k = p.join("/");
2843
- if (!state[k]?.expanded) {
2844
- expanded = !1;
2845
- break;
2846
- }
2847
- }
2848
- if (expanded)
2849
- return els[i];
2850
- }
2851
- return null;
2852
- }
2853
- function _focusItemElement(el) {
2854
- if (el.getAttribute("role") === "treeitem" && el.focus(), el.getAttribute("role") === "none") {
2855
- const firstChild = el.firstChild;
2856
- firstChild && firstChild instanceof HTMLElement && firstChild.focus();
2857
- }
2858
- }
2859
- const TreeContext = createGlobalScopedContext("@sanity/ui/v3/tree", null), DEFAULT_TREE_ELEMENT = "div";
2860
- function Tree(props) {
2861
- const $ = compilerRuntime.c(38), t0 = props;
2862
- let children, forwardedRef, onFocus, rest, t1;
2863
- $[0] !== t0 ? ({
2864
- children,
2865
- gap: t1,
2866
- onFocus,
2867
- ref: forwardedRef,
2868
- ...rest
2869
- } = t0, $[0] = t0, $[1] = children, $[2] = forwardedRef, $[3] = onFocus, $[4] = rest, $[5] = t1) : (children = $[1], forwardedRef = $[2], onFocus = $[3], rest = $[4], t1 = $[5]);
2870
- const gap = t1 === void 0 ? 1 : t1, ref = react.useRef(null), [focusedElement, setFocusedElement] = react.useState(null), focusedElementRef = react.useRef(focusedElement);
2871
- let t2, t3;
2872
- $[6] === Symbol.for("react.memo_cache_sentinel") ? (t3 = [], $[6] = t3) : t3 = $[6], t2 = t3;
2873
- const path = t2;
2874
- let t4;
2875
- $[7] === Symbol.for("react.memo_cache_sentinel") ? (t4 = [], $[7] = t4) : t4 = $[7];
2876
- const [itemElements, setItemElements] = react.useState(t4);
2877
- let t5;
2878
- $[8] === Symbol.for("react.memo_cache_sentinel") ? (t5 = {}, $[8] = t5) : t5 = $[8];
2879
- const [state, setState] = react.useState(t5), stateRef = react.useRef(state);
2880
- let t6;
2881
- $[9] === Symbol.for("react.memo_cache_sentinel") ? (t6 = () => ref.current, $[9] = t6) : t6 = $[9], react.useImperativeHandle(forwardedRef, t6);
2882
- let t7, t8;
2883
- $[10] !== focusedElement ? (t7 = () => {
2884
- focusedElementRef.current = focusedElement;
2885
- }, t8 = [focusedElement], $[10] = focusedElement, $[11] = t7, $[12] = t8) : (t7 = $[11], t8 = $[12]), react.useEffect(t7, t8);
2886
- let t10, t9;
2887
- $[13] !== state ? (t9 = () => {
2888
- stateRef.current = state;
2889
- }, t10 = [state], $[13] = state, $[14] = t10, $[15] = t9) : (t10 = $[14], t9 = $[15]), react.useEffect(t9, t10);
2890
- let t11;
2891
- $[16] === Symbol.for("react.memo_cache_sentinel") ? (t11 = (element, path_0, expanded, selected) => (setState((s) => ({
2892
- ...s,
2893
- [path_0]: {
2894
- element,
2895
- expanded
2896
- }
2897
- })), selected && setFocusedElement(element), () => {
2898
- setState((s_0) => {
2899
- const newState = {
2900
- ...s_0
2901
- };
2902
- return delete newState[path_0], newState;
2903
- });
2904
- }), $[16] = t11) : t11 = $[16];
2905
- const registerItem = t11;
2906
- let t12;
2907
- $[17] === Symbol.for("react.memo_cache_sentinel") ? (t12 = (path_1, expanded_0) => {
2908
- setState((s_1) => {
2909
- const itemState = s_1[path_1];
2910
- return itemState ? {
2911
- ...s_1,
2912
- [path_1]: {
2913
- ...itemState,
2914
- expanded: expanded_0
2915
- }
2916
- } : s_1;
2917
- });
2918
- }, $[17] = t12) : t12 = $[17];
2919
- const setExpanded = t12;
2920
- let t13;
2921
- const t14 = focusedElement || itemElements[0] || null;
2922
- let t15;
2923
- $[18] !== gap || $[19] !== state || $[20] !== t14 ? (t15 = {
2924
- version: 0,
2925
- focusedElement: t14,
2926
- gap,
2927
- level: 0,
2928
- path,
2929
- registerItem,
2930
- setExpanded,
2931
- setFocusedElement,
2932
- state
2933
- }, $[18] = gap, $[19] = state, $[20] = t14, $[21] = t15) : t15 = $[21], t13 = t15;
2934
- const contextValue = t13;
2935
- let t16;
2936
- $[22] !== itemElements ? (t16 = (event) => {
2937
- if (focusedElementRef.current) {
2938
- if (event.key === "ArrowDown") {
2939
- event.preventDefault();
2940
- const nextEl = _findNextItemElement(stateRef.current, itemElements, focusedElementRef.current);
2941
- nextEl && (_focusItemElement(nextEl), setFocusedElement(nextEl));
2942
- return;
2943
- }
2944
- if (event.key === "ArrowUp") {
2945
- event.preventDefault();
2946
- const prevEl = _findPrevItemElement(stateRef.current, itemElements, focusedElementRef.current);
2947
- prevEl && (_focusItemElement(prevEl), setFocusedElement(prevEl));
2948
- return;
2949
- }
2950
- if (event.key === "ArrowLeft") {
2951
- event.preventDefault();
2952
- const itemKey = focusedElementRef.current.getAttribute("data-tree-key");
2953
- if (!itemKey)
2954
- return;
2955
- const itemState_0 = stateRef.current[itemKey];
2956
- if (!itemState_0)
2957
- return;
2958
- if (itemState_0.expanded)
2959
- setState((s_2) => {
2960
- const itemState_1 = s_2[itemKey];
2961
- return itemState_1 ? {
2962
- ...s_2,
2963
- [itemKey]: {
2964
- ...itemState_1,
2965
- expanded: !1
2966
- }
2967
- } : s_2;
2968
- });
2969
- else {
2970
- const itemPath = itemKey.split("/");
2971
- itemPath.pop();
2972
- const parentKey = itemPath.join("/"), parentState = parentKey && stateRef.current[parentKey];
2973
- parentState && (parentState.element.focus(), setFocusedElement(parentState.element));
2974
- }
2975
- return;
2976
- }
2977
- if (event.key === "ArrowRight") {
2978
- event.preventDefault();
2979
- const focusedKey = focusedElementRef.current.getAttribute("data-tree-key");
2980
- if (!focusedKey)
2981
- return;
2982
- stateRef.current[focusedKey]?.expanded || setState((s_3) => {
2983
- const itemState_2 = s_3[focusedKey];
2984
- return itemState_2 ? {
2985
- ...s_3,
2986
- [focusedKey]: {
2987
- ...itemState_2,
2988
- expanded: !0
2989
- }
2990
- } : s_3;
2991
- });
2992
- return;
2993
- }
2994
- }
2995
- }, $[22] = itemElements, $[23] = t16) : t16 = $[23];
2996
- const handleKeyDown = t16;
2997
- let t17;
2998
- $[24] !== onFocus ? (t17 = (event_0) => {
2999
- setFocusedElement(event_0.target), onFocus?.(event_0);
3000
- }, $[24] = onFocus, $[25] = t17) : t17 = $[25];
3001
- const handleFocus = t17;
3002
- let t18;
3003
- $[26] === Symbol.for("react.memo_cache_sentinel") ? (t18 = () => {
3004
- if (!ref.current)
3005
- return;
3006
- const _itemElements = Array.from(ref.current.querySelectorAll('[data-ui="TreeItem"]'));
3007
- setItemElements(_itemElements);
3008
- }, $[26] = t18) : t18 = $[26];
3009
- let t19;
3010
- $[27] !== children ? (t19 = [children], $[27] = children, $[28] = t19) : t19 = $[28], react.useEffect(t18, t19);
3011
- let t20;
3012
- $[29] !== children || $[30] !== gap || $[31] !== handleFocus || $[32] !== handleKeyDown || $[33] !== rest ? (t20 = /* @__PURE__ */ jsxRuntime.jsx(Stack, { as: "ul", "data-ui": "Tree", ...rest, gap, onFocus: handleFocus, onKeyDown: handleKeyDown, ref, role: "tree", children }), $[29] = children, $[30] = gap, $[31] = handleFocus, $[32] = handleKeyDown, $[33] = rest, $[34] = t20) : t20 = $[34];
3013
- let t21;
3014
- return $[35] !== contextValue || $[36] !== t20 ? (t21 = /* @__PURE__ */ jsxRuntime.jsx(TreeContext.Provider, { value: contextValue, children: t20 }), $[35] = contextValue, $[36] = t20, $[37] = t21) : t21 = $[37], t21;
3015
- }
3016
- function useTree() {
3017
- const tree = react.useContext(TreeContext);
3018
- if (!tree)
3019
- throw new Error("Tree: missing context value");
3020
- return tree;
3021
- }
3022
- const TreeGroup = function(props) {
3023
- const $ = compilerRuntime.c(9), t0 = props;
3024
- let children, rest, t1;
3025
- $[0] !== t0 ? ({
3026
- children,
3027
- expanded: t1,
3028
- ...rest
3029
- } = t0, $[0] = t0, $[1] = children, $[2] = rest, $[3] = t1) : (children = $[1], rest = $[2], t1 = $[3]);
3030
- const expanded = t1 === void 0 ? !1 : t1, tree = useTree(), t2 = !expanded;
3031
- let t3;
3032
- return $[4] !== children || $[5] !== rest || $[6] !== t2 || $[7] !== tree.gap ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(Stack, { as: "ul", "data-ui": "TreeGroup", ...rest, hidden: t2, marginTop: tree.gap, role: "group", gap: tree.gap, children }), $[4] = children, $[5] = rest, $[6] = t2, $[7] = tree.gap, $[8] = t3) : t3 = $[8], t3;
3033
- }, DEFAULT_TREE_ITEM_ELEMENT = "a";
3034
- function TreeItem(props) {
3035
- const {
3036
- children,
3037
- className,
3038
- expanded: expandedProp = !1,
3039
- fontSize = 1,
3040
- href,
3041
- icon: IconComponent,
3042
- id: idProp,
3043
- linkAs = "a",
3044
- muted,
3045
- onClick,
3046
- padding = 2,
3047
- radius = 2,
3048
- selected = !1,
3049
- space = 2,
3050
- text,
3051
- weight,
3052
- ...rest
3053
- } = props, rootRef = react.useRef(null), treeitemRef = react.useRef(null), tree = useTree(), {
3054
- path,
3055
- registerItem,
3056
- setExpanded,
3057
- setFocusedElement
3058
- } = tree, _id = react.useId(), id = idProp || _id, itemPath = react.useMemo(() => path.concat([id || ""]), [id, path]), itemKey = itemPath.join("/"), itemState = tree.state[itemKey], expanded = itemState?.expanded === void 0 ? expandedProp : itemState?.expanded || !1, focused = tree.focusedElement && tree.focusedElement === rootRef.current, tabIndex = focused ? 0 : -1, contextValue = react.useMemo(() => ({
3059
- ...tree,
3060
- level: tree.level + 1,
3061
- path: itemPath
3062
- }), [itemPath, tree]), handleClick = react.useCallback((event) => {
3063
- onClick && onClick(event);
3064
- const target = event.target;
3065
- target instanceof HTMLElement && (target.getAttribute("data-ui") === "TreeItem" || target.closest('[data-ui="TreeItem__box"]')) && (event.stopPropagation(), setExpanded(itemKey, !expanded), setFocusedElement(rootRef.current));
3066
- }, [expanded, itemKey, onClick, setExpanded, setFocusedElement]), handleKeyDown = react.useCallback((event_0) => {
3067
- focused && event_0.key === "Enter" && (treeitemRef.current || rootRef.current)?.click();
3068
- }, [focused]);
3069
- react.useEffect(() => {
3070
- if (rootRef.current)
3071
- return registerItem(rootRef.current, itemPath.join("/"), expanded, selected);
3072
- }, [expanded, itemPath, registerItem, selected]);
3073
- const content2 = /* @__PURE__ */ jsxRuntime.jsxs(Flex, { gap: space, padding, children: [
3074
- /* @__PURE__ */ jsxRuntime.jsxs(Box, { style: {
3075
- visibility: IconComponent || children ? "visible" : "hidden",
3076
- pointerEvents: "none"
3077
- }, children: [
3078
- IconComponent && /* @__PURE__ */ jsxRuntime.jsx(Text, { muted, size: fontSize, weight, children: /* @__PURE__ */ jsxRuntime.jsx(IconComponent, {}) }),
3079
- !IconComponent && /* @__PURE__ */ jsxRuntime.jsx(Text, { muted, size: fontSize, weight, children: /* @__PURE__ */ jsxRuntime.jsx(icons.ToggleArrowRightIcon, { style: {
3080
- transform: expanded ? "rotate(90deg)" : void 0
3081
- } }) })
3082
- ] }),
3083
- /* @__PURE__ */ jsxRuntime.jsx(Box, { flex: 1, children: /* @__PURE__ */ jsxRuntime.jsx(Text, { muted, size: fontSize, textOverflow: "ellipsis", weight, children: text }) })
3084
- ] });
3085
- return href ? /* @__PURE__ */ jsxRuntime.jsxs(Box, { "data-selected": selected ? "" : void 0, "data-tree-id": id, "data-tree-key": itemKey, "data-ui": "TreeItem", ...rest, as: "li", className: css.treeItem({
3086
- className
3087
- }), onClick: handleClick, ref: rootRef, role: "none", children: [
3088
- /* @__PURE__ */ jsxRuntime.jsx(
3089
- Selectable,
3090
- {
3091
- "aria-expanded": expanded,
3092
- as: linkAs,
3093
- "data-ui": "TreeItem__box",
3094
- href,
3095
- radius,
3096
- ref: treeitemRef,
3097
- role: "treeitem",
3098
- selected,
3099
- tabIndex,
3100
- style: {
3101
- paddingLeft: `calc(${css.vars.space[2]} * ${tree.level})`
3102
- },
3103
- children: content2
3104
- }
3105
- ),
3106
- /* @__PURE__ */ jsxRuntime.jsx(TreeContext.Provider, { value: contextValue, children: children && /* @__PURE__ */ jsxRuntime.jsx(TreeGroup, { hidden: !expanded, children }) })
3107
- ] }) : /* @__PURE__ */ jsxRuntime.jsxs(Box, { "data-selected": selected ? "" : void 0, "data-ui": "TreeItem", "data-tree-id": id, "data-tree-key": itemKey, ...rest, "aria-expanded": expanded, className: css.treeItem({
3108
- className
3109
- }), onClick: handleClick, onKeyDown: handleKeyDown, ref: rootRef, role: "treeitem", tabIndex, children: [
3110
- /* @__PURE__ */ jsxRuntime.jsx(
3111
- Selectable,
3112
- {
3113
- as: "button",
3114
- "data-focused": focused ? "" : void 0,
3115
- "data-ui": "TreeItem__box",
3116
- radius,
3117
- selected,
3118
- style: {
3119
- paddingLeft: `calc(${css.vars.space[2]} * ${tree.level})`
3120
- },
3121
- children: content2
3122
- }
3123
- ),
3124
- /* @__PURE__ */ jsxRuntime.jsx(TreeContext.Provider, { value: contextValue, children: children && /* @__PURE__ */ jsxRuntime.jsx(TreeGroup, { expanded, children }) })
3125
- ] });
3126
- }
3127
- function _isScrollable(el) {
3128
- if (!(el instanceof Element)) return !1;
3129
- const style = window.getComputedStyle(el);
3130
- return style.overflowX.includes("auto") || style.overflowX.includes("scroll") || style.overflowY.includes("auto") || style.overflowY.includes("scroll");
3131
- }
3132
- const _ResizeObserver = typeof document < "u" && typeof window < "u" && window.ResizeObserver ? window.ResizeObserver : resizeObserver.ResizeObserver, DEFAULT_VIRTUAL_LIST_ELEMENT = "div";
3133
- function VirtualList(props) {
3134
- const $ = compilerRuntime.c(61), t0 = props;
3135
- let forwardedRef, getItemKey, onChange, renderItem, rest, t1, t2, t3;
3136
- $[0] !== t0 ? ({
3137
- as: t1,
3138
- gap: t2,
3139
- getItemKey,
3140
- items: t3,
3141
- onChange,
3142
- renderItem,
3143
- ref: forwardedRef,
3144
- ...rest
3145
- } = t0, $[0] = t0, $[1] = forwardedRef, $[2] = getItemKey, $[3] = onChange, $[4] = renderItem, $[5] = rest, $[6] = t1, $[7] = t2, $[8] = t3) : (forwardedRef = $[1], getItemKey = $[2], onChange = $[3], renderItem = $[4], rest = $[5], t1 = $[6], t2 = $[7], t3 = $[8]);
3146
- const as = t1 === void 0 ? DEFAULT_VIRTUAL_LIST_ELEMENT : t1, gap = t2 === void 0 ? 0 : t2;
3147
- let t4;
3148
- $[9] !== t3 ? (t4 = t3 === void 0 ? [] : t3, $[9] = t3, $[10] = t4) : t4 = $[10];
3149
- const items = t4, ref = react.useRef(null), wrapperRef = react.useRef(null), [scrollTop, setScrollTop] = react.useState(0), [scrollHeight, setScrollHeight] = react.useState(0), [itemHeight, setItemHeight] = react.useState(-1), [gapValue, setGapValue] = react.useState(0);
3150
- let t5;
3151
- $[11] === Symbol.for("react.memo_cache_sentinel") ? (t5 = () => ref.current, $[11] = t5) : t5 = $[11], react.useImperativeHandle(forwardedRef, t5);
3152
- let t6, t7;
3153
- $[12] === Symbol.for("react.memo_cache_sentinel") ? (t6 = () => {
3154
- if (!ref.current)
3155
- return;
3156
- const scrollEl = findScrollable(ref.current.parentNode);
3157
- if (scrollEl) {
3158
- if (!(scrollEl instanceof HTMLElement))
3159
- return;
3160
- const handleScroll = () => {
3161
- setScrollTop(scrollEl.scrollTop);
3162
- };
3163
- scrollEl.addEventListener("scroll", handleScroll, {
3164
- passive: !0
3165
- });
3166
- const ro = new _ResizeObserver((entries) => {
3167
- setScrollHeight(entries[0].contentRect.height);
3168
- });
3169
- return ro.observe(scrollEl), handleScroll(), () => {
3170
- scrollEl.removeEventListener("scroll", handleScroll), ro.unobserve(scrollEl), ro.disconnect();
3171
- };
3172
- }
3173
- const handleScroll_0 = () => {
3174
- setScrollTop(window.scrollY);
3175
- }, handleResize = () => {
3176
- setScrollHeight(window.innerHeight);
3177
- };
3178
- return window.addEventListener("scroll", handleScroll_0, {
3179
- passive: !0
3180
- }), window.addEventListener("resize", handleResize), setScrollHeight(window.innerHeight), handleScroll_0(), () => {
3181
- window.removeEventListener("scroll", handleScroll_0), window.removeEventListener("resize", handleResize);
3182
- };
3183
- }, t7 = [], $[12] = t6, $[13] = t7) : (t6 = $[12], t7 = $[13]), react.useEffect(t6, t7);
3184
- const len = items.length, height = itemHeight ? len * (itemHeight + gapValue) - gapValue : 0, fromIndex = height ? Math.max(Math.floor(scrollTop / height * len) - 2, 0) : 0, toIndex = height ? Math.ceil((scrollTop + scrollHeight) / height * len) + 1 : 0;
3185
- let t8, t9;
3186
- $[14] !== fromIndex || $[15] !== gapValue || $[16] !== itemHeight || $[17] !== onChange || $[18] !== scrollHeight || $[19] !== scrollTop || $[20] !== toIndex ? (t8 = () => {
3187
- onChange?.({
3188
- fromIndex,
3189
- gap: gapValue,
3190
- itemHeight,
3191
- scrollHeight,
3192
- scrollTop,
3193
- toIndex
3194
- });
3195
- }, t9 = [fromIndex, gapValue, itemHeight, onChange, scrollHeight, scrollTop, toIndex], $[14] = fromIndex, $[15] = gapValue, $[16] = itemHeight, $[17] = onChange, $[18] = scrollHeight, $[19] = scrollTop, $[20] = toIndex, $[21] = t8, $[22] = t9) : (t8 = $[21], t9 = $[22]), react.useEffect(t8, t9);
3196
- let t10;
3197
- $[23] === Symbol.for("react.memo_cache_sentinel") ? (t10 = () => {
3198
- setItemHeight(-1);
3199
- }, $[23] = t10) : t10 = $[23];
3200
- let t11;
3201
- $[24] !== renderItem ? (t11 = [renderItem], $[24] = renderItem, $[25] = t11) : t11 = $[25], react.useEffect(t10, t11);
3202
- let t12;
3203
- bb0: {
3204
- if (!renderItem || items.length === 0) {
3205
- t12 = null;
3206
- break bb0;
3207
- }
3208
- if (itemHeight === -1) {
3209
- let t133;
3210
- $[26] === Symbol.for("react.memo_cache_sentinel") ? (t133 = (el) => el ? setItemHeight(el.offsetHeight) : void 0, $[26] = t133) : t133 = $[26];
3211
- let t142;
3212
- $[27] !== items[0] || $[28] !== renderItem ? (t142 = renderItem(items[0]), $[27] = items[0], $[28] = renderItem, $[29] = t142) : t142 = $[29];
3213
- let t152;
3214
- $[30] !== t142 ? (t152 = /* @__PURE__ */ jsxRuntime.jsx(Box, { ref: t133, insetTop: 0, insetLeft: 0, insetRight: 0, position: "absolute", children: t142 }, 0), $[30] = t142, $[31] = t152) : t152 = $[31];
3215
- let t162;
3216
- $[32] === Symbol.for("react.memo_cache_sentinel") ? (t162 = (el_0) => el_0 ? setGapValue(el_0.offsetHeight) : void 0, $[32] = t162) : t162 = $[32];
3217
- const t17 = css.vars.space[gap];
3218
- let t18;
3219
- $[33] !== t17 ? (t18 = /* @__PURE__ */ jsxRuntime.jsx("div", { ref: t162, style: {
3220
- height: t17
3221
- } }), $[33] = t17, $[34] = t18) : t18 = $[34];
3222
- let t19;
3223
- $[35] !== t152 || $[36] !== t18 ? (t19 = [/* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3224
- t152,
3225
- t18
3226
- ] })], $[35] = t152, $[36] = t18, $[37] = t19) : t19 = $[37], t12 = t19;
3227
- break bb0;
3228
- }
3229
- let t132;
3230
- if ($[38] !== fromIndex || $[39] !== gapValue || $[40] !== getItemKey || $[41] !== itemHeight || $[42] !== items || $[43] !== renderItem || $[44] !== toIndex) {
3231
- let t142;
3232
- $[46] !== fromIndex || $[47] !== gapValue || $[48] !== getItemKey || $[49] !== itemHeight || $[50] !== renderItem ? (t142 = (item, _itemIndex) => {
3233
- const itemIndex = fromIndex + _itemIndex, node = renderItem(item), key2 = getItemKey ? getItemKey(item, itemIndex) : itemIndex;
3234
- return /* @__PURE__ */ jsxRuntime.jsx(Box, { insetLeft: 0, insetRight: 0, position: "absolute", style: {
3235
- top: itemIndex * (itemHeight + gapValue)
3236
- }, children: node }, key2);
3237
- }, $[46] = fromIndex, $[47] = gapValue, $[48] = getItemKey, $[49] = itemHeight, $[50] = renderItem, $[51] = t142) : t142 = $[51], t132 = items.slice(fromIndex, toIndex).map(t142), $[38] = fromIndex, $[39] = gapValue, $[40] = getItemKey, $[41] = itemHeight, $[42] = items, $[43] = renderItem, $[44] = toIndex, $[45] = t132;
3238
- } else
3239
- t132 = $[45];
3240
- t12 = t132;
3241
- }
3242
- const children = t12;
3243
- let t13, t14;
3244
- $[52] !== height ? (t14 = {
3245
- height
3246
- }, $[52] = height, $[53] = t14) : t14 = $[53], t13 = t14;
3247
- const wrapperStyle = t13;
3248
- let t15;
3249
- $[54] !== children || $[55] !== wrapperStyle ? (t15 = /* @__PURE__ */ jsxRuntime.jsx("div", { ref: wrapperRef, style: wrapperStyle, children }), $[54] = children, $[55] = wrapperStyle, $[56] = t15) : t15 = $[56];
3250
- let t16;
3251
- return $[57] !== as || $[58] !== rest || $[59] !== t15 ? (t16 = /* @__PURE__ */ jsxRuntime.jsx(Box, { "data-ui": "VirtualList", ...rest, as, position: "relative", ref, children: t15 }), $[57] = as, $[58] = rest, $[59] = t15, $[60] = t16) : t16 = $[60], t16;
3252
- }
3253
- function findScrollable(parentNode) {
3254
- let _scrollEl = parentNode;
3255
- for (; _scrollEl && !_isScrollable(_scrollEl); )
3256
- _scrollEl = _scrollEl.parentNode;
3257
- return _scrollEl;
3258
- }
3259
- const _elementSizeObserver = _createElementSizeObserver();
3260
- function _createElementRectValueListener() {
3261
- return {
3262
- subscribe(element, subscriber) {
3263
- const resizeObserver2 = new _ResizeObserver(([entry]) => {
3264
- subscriber({
3265
- _contentRect: entry.contentRect,
3266
- border: {
3267
- width: entry.borderBoxSize[0].inlineSize,
3268
- height: entry.borderBoxSize[0].blockSize
3269
- },
3270
- content: {
3271
- width: entry.contentRect.width,
3272
- height: entry.contentRect.height
3273
- }
3274
- });
3275
- });
3276
- return resizeObserver2.observe(element), () => {
3277
- resizeObserver2.unobserve(element), resizeObserver2.disconnect();
3278
- };
3279
- }
3280
- };
3281
- }
3282
- function _createElementSizeObserver() {
3283
- const disposeCache = /* @__PURE__ */ new WeakMap(), subscribersCache = /* @__PURE__ */ new WeakMap();
3284
- return {
3285
- subscribe(element, subscriber) {
3286
- const subscribers = subscribersCache.get(element) || [];
3287
- let dispose = disposeCache.get(element);
3288
- return subscribersCache.has(element) || (subscribersCache.set(element, subscribers), dispose = _createElementRectValueListener().subscribe(element, (elementRect) => {
3289
- for (const sub of subscribers)
3290
- sub(elementRect);
3291
- })), subscribers.push(subscriber), () => {
3292
- const idx = subscribers.indexOf(subscriber);
3293
- idx > -1 && subscribers.splice(idx, 1), subscribers.length === 0 && dispose && dispose();
3294
- };
3295
- }
3296
- };
3297
- }
3298
- function useElementSize(element) {
3299
- const $ = compilerRuntime.c(3), [size2, setSize] = react.useState(null);
3300
- let t0, t1;
3301
- return $[0] !== element ? (t0 = () => {
3302
- if (element)
3303
- return _elementSizeObserver.subscribe(element, setSize);
3304
- }, t1 = [element], $[0] = element, $[1] = t0, $[2] = t1) : (t0 = $[1], t1 = $[2]), react.useEffect(t0, t1), size2;
3305
- }
3306
- function usePrefersDark(t0) {
3307
- return useMatchMedia("(prefers-color-scheme: dark)", t0 === void 0 ? _temp$3 : t0);
3308
- }
3309
- function _temp$3() {
3310
- return !1;
3311
- }
3312
- const DEFAULT_LABEL_ELEMENT = "div";
3313
- function Label(props) {
3314
- const $ = compilerRuntime.c(26);
3315
- let align, children, className, rest, t0, t1, t2, t3, textOverflowProp;
3316
- $[0] !== props ? ({
3317
- align,
3318
- as: t0,
3319
- children,
3320
- className,
3321
- muted: t1,
3322
- size: t2,
3323
- textOverflow: textOverflowProp,
3324
- weight: t3,
3325
- ...rest
3326
- } = props, $[0] = props, $[1] = align, $[2] = children, $[3] = className, $[4] = rest, $[5] = t0, $[6] = t1, $[7] = t2, $[8] = t3, $[9] = textOverflowProp) : (align = $[1], children = $[2], className = $[3], rest = $[4], t0 = $[5], t1 = $[6], t2 = $[7], t3 = $[8], textOverflowProp = $[9]);
3327
- const Element2 = t0 === void 0 ? DEFAULT_LABEL_ELEMENT : t0, muted = t1 === void 0 ? !1 : t1, size2 = t2 === void 0 ? 1 : t2, weight = t3 === void 0 ? "regular" : t3;
3328
- let t4;
3329
- $[10] !== align || $[11] !== className || $[12] !== muted || $[13] !== size2 || $[14] !== weight ? (t4 = css.label({
3330
- className,
3331
- align,
3332
- muted,
3333
- size: size2,
3334
- weight
3335
- }), $[10] = align, $[11] = className, $[12] = muted, $[13] = size2, $[14] = weight, $[15] = t4) : t4 = $[15];
3336
- let t5;
3337
- $[16] !== textOverflowProp ? (t5 = css.textOverflow({
3338
- textOverflow: textOverflowProp
3339
- }), $[16] = textOverflowProp, $[17] = t5) : t5 = $[17];
3340
- let t6;
3341
- $[18] !== children || $[19] !== t5 ? (t6 = /* @__PURE__ */ jsxRuntime.jsx("span", { className: t5, children }), $[18] = children, $[19] = t5, $[20] = t6) : t6 = $[20];
3342
- let t7;
3343
- return $[21] !== Element2 || $[22] !== rest || $[23] !== t4 || $[24] !== t6 ? (t7 = /* @__PURE__ */ jsxRuntime.jsx(Element2, { "data-ui": "Label", ...rest, className: t4, children: t6 }), $[21] = Element2, $[22] = rest, $[23] = t4, $[24] = t6, $[25] = t7) : t7 = $[25], t7;
3344
- }
3345
- const DEFAULT_AVATAR_ELEMENT = "span";
3346
- function Avatar(props) {
3347
- const $ = compilerRuntime.c(50), t0 = props;
3348
- let __unstable_hideInnerStroke, animateArrowFrom, arrowPositionProp, className, initials, onImageLoadError, rest, src, t1, t2, t3, title;
3349
- $[0] !== t0 ? ({
3350
- __unstable_hideInnerStroke,
3351
- as: t1,
3352
- className,
3353
- color: t2,
3354
- src,
3355
- title,
3356
- initials,
3357
- onImageLoadError,
3358
- arrowPosition: arrowPositionProp,
3359
- animateArrowFrom,
3360
- size: t3,
3361
- ...rest
3362
- } = t0, $[0] = t0, $[1] = __unstable_hideInnerStroke, $[2] = animateArrowFrom, $[3] = arrowPositionProp, $[4] = className, $[5] = initials, $[6] = onImageLoadError, $[7] = rest, $[8] = src, $[9] = t1, $[10] = t2, $[11] = t3, $[12] = title) : (__unstable_hideInnerStroke = $[1], animateArrowFrom = $[2], arrowPositionProp = $[3], className = $[4], initials = $[5], onImageLoadError = $[6], rest = $[7], src = $[8], t1 = $[9], t2 = $[10], t3 = $[11], title = $[12]);
3363
- const Element2 = t1 === void 0 ? DEFAULT_AVATAR_ELEMENT : t1, color = t2 === void 0 ? "magenta" : t2, sizeProp = t3 === void 0 ? 1 : t3, size2 = useResponsiveProp(sizeProp), [arrowPosition, setArrowPosition] = react.useState(animateArrowFrom || arrowPositionProp || "inside"), [imageError, setImageError] = react.useState(!1);
3364
- let t4, t5;
3365
- $[13] !== arrowPosition || $[14] !== arrowPositionProp ? (t4 = () => {
3366
- if (arrowPosition === arrowPositionProp)
3367
- return;
3368
- const raf = requestAnimationFrame(() => setArrowPosition(arrowPositionProp));
3369
- return () => cancelAnimationFrame(raf);
3370
- }, t5 = [arrowPosition, arrowPositionProp], $[13] = arrowPosition, $[14] = arrowPositionProp, $[15] = t4, $[16] = t5) : (t4 = $[15], t5 = $[16]), react.useEffect(t4, t5);
3371
- let t6, t7;
3372
- $[17] !== src ? (t6 = () => {
3373
- src && setImageError(!1);
3374
- }, t7 = [src], $[17] = src, $[18] = t6, $[19] = t7) : (t6 = $[18], t7 = $[19]), react.useEffect(t6, t7);
3375
- let t8;
3376
- $[20] !== onImageLoadError ? (t8 = () => {
3377
- setImageError(!0), onImageLoadError && onImageLoadError(new Error("Avatar: the image failed to load"));
3378
- }, $[20] = onImageLoadError, $[21] = t8) : t8 = $[21];
3379
- const handleImageError = t8;
3380
- let t9, t10;
3381
- $[22] !== size2 ? (t10 = Object.values(size2).map(_temp$2), $[22] = size2, $[23] = t10) : t10 = $[23], t9 = t10;
3382
- const initialsSize = t9, t11 = __unstable_hideInnerStroke ? "" : void 0;
3383
- let t12;
3384
- $[24] !== className || $[25] !== color || $[26] !== sizeProp ? (t12 = css.avatar({
3385
- className,
3386
- color,
3387
- size: sizeProp
3388
- }), $[24] = className, $[25] = color, $[26] = sizeProp, $[27] = t12) : t12 = $[27];
3389
- const t13 = imageError ? "" : void 0;
3390
- let t14;
3391
- $[28] === Symbol.for("react.memo_cache_sentinel") ? (t14 = css.avatarArrow(), $[28] = t14) : t14 = $[28];
3392
- let t15;
3393
- $[29] !== color ? (t15 = /* @__PURE__ */ jsxRuntime.jsx("span", { className: t14, children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "11", height: "7", viewBox: "0 0 11 7", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M6.67948 1.50115L11 7L0 7L4.32052 1.50115C4.92109 0.736796 6.07891 0.736795 6.67948 1.50115Z", fill: color }) }) }), $[29] = color, $[30] = t15) : t15 = $[30];
3394
- let t16;
3395
- $[31] === Symbol.for("react.memo_cache_sentinel") ? (t16 = css.avatarInitials(), $[31] = t16) : t16 = $[31];
3396
- let t17;
3397
- $[32] !== initials || $[33] !== initialsSize ? (t17 = /* @__PURE__ */ jsxRuntime.jsx(Box, { alignItems: "center", as: "span", className: t16, display: "flex", justifyContent: "center", position: "absolute", inset: 0, children: /* @__PURE__ */ jsxRuntime.jsx(Label, { align: "center", as: "span", size: initialsSize, weight: "medium", children: initials }) }), $[32] = initials, $[33] = initialsSize, $[34] = t17) : t17 = $[34];
3398
- let t18;
3399
- $[35] !== handleImageError || $[36] !== initials || $[37] !== src ? (t18 = src && /* @__PURE__ */ jsxRuntime.jsxs(Box, { className: css.avatarImage(), inset: 0, position: "absolute", children: [
3400
- /* @__PURE__ */ jsxRuntime.jsx("img", { alt: initials, onError: handleImageError, src }),
3401
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: css.avatarImageOutline() })
3402
- ] }), $[35] = handleImageError, $[36] = initials, $[37] = src, $[38] = t18) : t18 = $[38];
3403
- let t19;
3404
- return $[39] !== Element2 || $[40] !== arrowPosition || $[41] !== rest || $[42] !== t11 || $[43] !== t12 || $[44] !== t13 || $[45] !== t15 || $[46] !== t17 || $[47] !== t18 || $[48] !== title ? (t19 = /* @__PURE__ */ jsxRuntime.jsxs(Element2, { "data-hide-inner-stroke": t11, "data-ui": "Avatar", ...rest, "aria-label": title, className: t12, "data-arrow-position": arrowPosition, "data-image-error": t13, title, children: [
3405
- t15,
3406
- t17,
3407
- t18
3408
- ] }), $[39] = Element2, $[40] = arrowPosition, $[41] = rest, $[42] = t11, $[43] = t12, $[44] = t13, $[45] = t15, $[46] = t17, $[47] = t18, $[48] = title, $[49] = t19) : t19 = $[49], t19;
3409
- }
3410
- function _temp$2(s) {
3411
- return s === 1 ? 1 : s === 2 ? 3 : s === 3 ? 5 : 0;
3412
- }
3413
- const DEFAULT_AVATAR_COUNTER_ELEMENT = "span";
3414
- function AvatarCounter(props) {
3415
- const $ = compilerRuntime.c(19), t0 = props;
3416
- let className, count, rest, t1, t2;
3417
- $[0] !== t0 ? ({
3418
- as: t1,
3419
- className,
3420
- count,
3421
- size: t2,
3422
- ...rest
3423
- } = t0, $[0] = t0, $[1] = className, $[2] = count, $[3] = rest, $[4] = t1, $[5] = t2) : (className = $[1], count = $[2], rest = $[3], t1 = $[4], t2 = $[5]);
3424
- const as = t1 === void 0 ? DEFAULT_AVATAR_COUNTER_ELEMENT : t1, size2 = useResponsiveProp(t2 === void 0 ? 1 : t2);
3425
- let t3, t4;
3426
- $[6] !== size2 ? (t4 = Object.values(size2).map(_temp$1), $[6] = size2, $[7] = t4) : t4 = $[7], t3 = t4;
3427
- const labelSize = t3;
3428
- let t5;
3429
- $[8] !== className || $[9] !== size2 ? (t5 = css.avatarCounter({
3430
- className,
3431
- size: size2
3432
- }), $[8] = className, $[9] = size2, $[10] = t5) : t5 = $[10];
3433
- let t6;
3434
- $[11] !== count || $[12] !== labelSize ? (t6 = /* @__PURE__ */ jsxRuntime.jsx(Label, { align: "center", as: "span", size: labelSize, weight: "medium", children: count }), $[11] = count, $[12] = labelSize, $[13] = t6) : t6 = $[13];
3435
- let t7;
3436
- return $[14] !== as || $[15] !== rest || $[16] !== t5 || $[17] !== t6 ? (t7 = /* @__PURE__ */ jsxRuntime.jsx(Box, { "data-ui": "AvatarCounter", ...rest, alignItems: "center", as, className: t5, display: "flex", flex: "none", justifyContent: "center", paddingX: 2, sizing: "border", children: t6 }), $[14] = as, $[15] = rest, $[16] = t5, $[17] = t6, $[18] = t7) : t7 = $[18], t7;
3437
- }
3438
- function _temp$1(s) {
3439
- return s === 1 ? 1 : s === 2 ? 3 : s === 3 ? 5 : 0;
3440
- }
3441
- const DEFAULT_AVATAR_STACK_ELEMENT = "span";
3442
- function AvatarStack(props) {
3443
- const $ = compilerRuntime.c(20), t0 = props;
3444
- let childrenProp, className, rest, t1, t2, t3;
3445
- $[0] !== t0 ? ({
3446
- as: t1,
3447
- children: childrenProp,
3448
- className,
3449
- maxLength: t2,
3450
- size: t3,
3451
- ...rest
3452
- } = t0, $[0] = t0, $[1] = childrenProp, $[2] = className, $[3] = rest, $[4] = t1, $[5] = t2, $[6] = t3) : (childrenProp = $[1], className = $[2], rest = $[3], t1 = $[4], t2 = $[5], t3 = $[6]);
3453
- const as = t1 === void 0 ? DEFAULT_AVATAR_STACK_ELEMENT : t1, maxLengthProp = t2 === void 0 ? 4 : t2, sizeProp = t3 === void 0 ? 1 : t3, children = react.Children.toArray(childrenProp).filter(react.isValidElement), maxLength = Math.max(maxLengthProp, 0), size2 = useResponsiveProp(sizeProp), len = children.length, visibleCount = maxLength - 1, extraCount = len - visibleCount, visibleChildren = extraCount > 1 ? children.slice(extraCount, len) : children, T0 = Box, t4 = "AvatarStack", t5 = "center";
3454
- let t6;
3455
- $[7] !== className || $[8] !== size2 ? (t6 = css.avatarStack({
3456
- className,
3457
- size: size2
3458
- }), $[7] = className, $[8] = size2, $[9] = t6) : t6 = $[9];
3459
- const t7 = "flex", t8 = "flex-start", t9 = len === 0 && /* @__PURE__ */ jsxRuntime.jsx(AvatarCounter, { count: len, size: size2 }), t10 = len !== 0 && extraCount > 1 && /* @__PURE__ */ jsxRuntime.jsx(AvatarCounter, { count: extraCount, size: size2 });
3460
- let t11;
3461
- $[10] !== size2 ? (t11 = (child, childIndex) => /* @__PURE__ */ jsxRuntime.jsx(react.Fragment, { children: react.cloneElement(child, {
3462
- size: size2
3463
- }) }, String(childIndex)), $[10] = size2, $[11] = t11) : t11 = $[11];
3464
- const t12 = visibleChildren.map(t11);
3465
- let t13;
3466
- return $[12] !== T0 || $[13] !== as || $[14] !== rest || $[15] !== t10 || $[16] !== t12 || $[17] !== t6 || $[18] !== t9 ? (t13 = /* @__PURE__ */ jsxRuntime.jsxs(T0, { "data-ui": t4, ...rest, alignItems: t5, as, className: t6, display: t7, justifyContent: t8, children: [
3467
- t9,
3468
- t10,
3469
- t12
3470
- ] }), $[12] = T0, $[13] = as, $[14] = rest, $[15] = t10, $[16] = t12, $[17] = t6, $[18] = t9, $[19] = t13) : t13 = $[19], t13;
3471
- }
3472
- const DEFAULT_BADGE_ELEMENT = "span";
3473
- function Badge(props) {
3474
- const $ = compilerRuntime.c(24), t0 = props;
3475
- let children, className, rest, t1, t2, t3, t4, t5, t6;
3476
- $[0] !== t0 ? ({
3477
- as: t1,
3478
- children,
3479
- className,
3480
- flex: t2,
3481
- fontSize: t3,
3482
- padding: t4,
3483
- radius: t5,
3484
- tone: t6,
3485
- ...rest
3486
- } = t0, $[0] = t0, $[1] = children, $[2] = className, $[3] = rest, $[4] = t1, $[5] = t2, $[6] = t3, $[7] = t4, $[8] = t5, $[9] = t6) : (children = $[1], className = $[2], rest = $[3], t1 = $[4], t2 = $[5], t3 = $[6], t4 = $[7], t5 = $[8], t6 = $[9]);
3487
- const as = t1 === void 0 ? DEFAULT_BADGE_ELEMENT : t1, flex = t2 === void 0 ? "none" : t2, fontSize = t3 === void 0 ? 1 : t3, padding = t4 === void 0 ? 1 : t4, radius = t5 === void 0 ? 2 : t5, tone = t6 === void 0 ? "default" : t6;
3488
- let t7;
3489
- $[10] !== className || $[11] !== tone ? (t7 = css.badge({
3490
- className,
3491
- tone
3492
- }), $[10] = className, $[11] = tone, $[12] = t7) : t7 = $[12];
3493
- let t8;
3494
- $[13] !== children || $[14] !== fontSize ? (t8 = /* @__PURE__ */ jsxRuntime.jsx(Text, { size: fontSize, children }), $[13] = children, $[14] = fontSize, $[15] = t8) : t8 = $[15];
3495
- let t9;
3496
- return $[16] !== as || $[17] !== flex || $[18] !== padding || $[19] !== radius || $[20] !== rest || $[21] !== t7 || $[22] !== t8 ? (t9 = /* @__PURE__ */ jsxRuntime.jsx(Box, { "data-ui": "Badge", ...rest, as, className: t7, flex, display: "flex", maxWidth: "fill", padding, radius, width: "min", children: t8 }), $[16] = as, $[17] = flex, $[18] = padding, $[19] = radius, $[20] = rest, $[21] = t7, $[22] = t8, $[23] = t9) : t9 = $[23], t9;
3497
- }
3498
- const DEFAULT_CHECKBOX_ELEMENT = "input";
3499
- function Checkbox(props) {
3500
- const $ = compilerRuntime.c(29), t0 = props;
3501
- let className, customValidity, disabled, forwardedRef, indeterminate, readOnly, rest, style, t1;
3502
- $[0] !== t0 ? ({
3503
- as: t1,
3504
- className,
3505
- disabled,
3506
- indeterminate,
3507
- customValidity,
3508
- readOnly,
3509
- ref: forwardedRef,
3510
- style,
3511
- ...rest
3512
- } = t0, $[0] = t0, $[1] = className, $[2] = customValidity, $[3] = disabled, $[4] = forwardedRef, $[5] = indeterminate, $[6] = readOnly, $[7] = rest, $[8] = style, $[9] = t1) : (className = $[1], customValidity = $[2], disabled = $[3], forwardedRef = $[4], indeterminate = $[5], readOnly = $[6], rest = $[7], style = $[8], t1 = $[9]);
3513
- const Element2 = t1 === void 0 ? DEFAULT_CHECKBOX_ELEMENT : t1, ref = react.useRef(null);
3514
- let t2;
3515
- $[10] === Symbol.for("react.memo_cache_sentinel") ? (t2 = () => ref.current, $[10] = t2) : t2 = $[10], react.useImperativeHandle(forwardedRef, t2);
3516
- let t3, t4;
3517
- $[11] !== indeterminate ? (t3 = () => {
3518
- ref.current && (ref.current.indeterminate = indeterminate || !1);
3519
- }, t4 = [indeterminate], $[11] = indeterminate, $[12] = t3, $[13] = t4) : (t3 = $[12], t4 = $[13]), react.useEffect(t3, t4), useCustomValidity(ref, customValidity);
3520
- let t5;
3521
- $[14] !== className ? (t5 = css.checkbox({
3522
- className
3523
- }), $[14] = className, $[15] = t5) : t5 = $[15];
3524
- let t6;
3525
- $[16] === Symbol.for("react.memo_cache_sentinel") ? (t6 = css.checkboxInput(), $[16] = t6) : t6 = $[16];
3526
- const t7 = customValidity ? "" : void 0, t8 = !disabled && readOnly ? "" : void 0, t9 = disabled || readOnly;
3527
- let t10;
3528
- $[17] !== Element2 || $[18] !== readOnly || $[19] !== rest || $[20] !== t7 || $[21] !== t8 || $[22] !== t9 ? (t10 = /* @__PURE__ */ jsxRuntime.jsx(Element2, { ...rest, className: t6, "data-invalid": t7, "data-read-only": t8, disabled: t9, type: "checkbox", readOnly, ref }), $[17] = Element2, $[18] = readOnly, $[19] = rest, $[20] = t7, $[21] = t8, $[22] = t9, $[23] = t10) : t10 = $[23];
3529
- let t11;
3530
- $[24] === Symbol.for("react.memo_cache_sentinel") ? (t11 = /* @__PURE__ */ jsxRuntime.jsxs("span", { className: css.checkboxPresentation(), children: [
3531
- /* @__PURE__ */ jsxRuntime.jsx(icons.CheckmarkIcon, {}),
3532
- /* @__PURE__ */ jsxRuntime.jsx(icons.RemoveIcon, {})
3533
- ] }), $[24] = t11) : t11 = $[24];
3534
- let t12;
3535
- return $[25] !== style || $[26] !== t10 || $[27] !== t5 ? (t12 = /* @__PURE__ */ jsxRuntime.jsxs("span", { className: t5, "data-ui": "Checkbox", style, children: [
3536
- t10,
3537
- t11
3538
- ] }), $[25] = style, $[26] = t10, $[27] = t5, $[28] = t12) : t12 = $[28], t12;
3539
- }
3540
- const LazyRefractor = react.lazy(() => Promise.resolve().then(function() {
3541
- return require("./_chunks-cjs/refractor.cjs");
3542
- })), DEFAULT_CODE_ELEMENT = "pre";
3543
- function Code(props) {
3544
- const $ = compilerRuntime.c(25), t0 = props;
3545
- let children, className, languageProp, rest, t1, t2, t3;
3546
- $[0] !== t0 ? ({
3547
- as: t1,
3548
- children,
3549
- className,
3550
- language: languageProp,
3551
- size: t2,
3552
- weight: t3,
3553
- ...rest
3554
- } = t0, $[0] = t0, $[1] = children, $[2] = className, $[3] = languageProp, $[4] = rest, $[5] = t1, $[6] = t2, $[7] = t3) : (children = $[1], className = $[2], languageProp = $[3], rest = $[4], t1 = $[5], t2 = $[6], t3 = $[7]);
3555
- const Element2 = t1 === void 0 ? DEFAULT_CODE_ELEMENT : t1, size2 = t2 === void 0 ? 2 : t2, weight = t3 === void 0 ? "regular" : t3, language = typeof languageProp == "string" ? languageProp : void 0;
3556
- let t4;
3557
- $[8] !== className || $[9] !== size2 || $[10] !== weight ? (t4 = css.code({
3558
- className,
3559
- size: size2,
3560
- weight
3561
- }), $[8] = className, $[9] = size2, $[10] = weight, $[11] = t4) : t4 = $[11];
3562
- let t5;
3563
- $[12] !== children ? (t5 = /* @__PURE__ */ jsxRuntime.jsx("code", { children }), $[12] = children, $[13] = t5) : t5 = $[13];
3564
- let t6;
3565
- $[14] !== children || $[15] !== language ? (t6 = /* @__PURE__ */ jsxRuntime.jsx(LazyRefractor, { language, value: children }), $[14] = children, $[15] = language, $[16] = t6) : t6 = $[16];
3566
- let t7;
3567
- $[17] !== t5 || $[18] !== t6 ? (t7 = /* @__PURE__ */ jsxRuntime.jsx(react.Suspense, { fallback: t5, children: t6 }), $[17] = t5, $[18] = t6, $[19] = t7) : t7 = $[19];
3568
- let t8;
3569
- return $[20] !== Element2 || $[21] !== rest || $[22] !== t4 || $[23] !== t7 ? (t8 = /* @__PURE__ */ jsxRuntime.jsx(Element2, { "data-ui": "Code", ...rest, className: t4, children: t7 }), $[20] = Element2, $[21] = rest, $[22] = t4, $[23] = t7, $[24] = t8) : t8 = $[24], t8;
3570
- }
3571
- const DEFAULT_HEADING_ELEMENT = "div";
3572
- function Heading(props) {
3573
- const $ = compilerRuntime.c(28), t0 = props;
3574
- let align, children, className, flex, rest, t1, t2, t3, t4, textOverflowProp;
3575
- $[0] !== t0 ? ({
3576
- align,
3577
- as: t1,
3578
- children,
3579
- className,
3580
- flex,
3581
- muted: t2,
3582
- size: t3,
3583
- textOverflow: textOverflowProp,
3584
- weight: t4,
3585
- ...rest
3586
- } = t0, $[0] = t0, $[1] = align, $[2] = children, $[3] = className, $[4] = flex, $[5] = rest, $[6] = t1, $[7] = t2, $[8] = t3, $[9] = t4, $[10] = textOverflowProp) : (align = $[1], children = $[2], className = $[3], flex = $[4], rest = $[5], t1 = $[6], t2 = $[7], t3 = $[8], t4 = $[9], textOverflowProp = $[10]);
3587
- const Element2 = t1 === void 0 ? DEFAULT_HEADING_ELEMENT : t1, muted = t2 === void 0 ? !1 : t2, size2 = t3 === void 0 ? 2 : t3, weight = t4 === void 0 ? "regular" : t4;
3588
- let t5;
3589
- $[11] !== align || $[12] !== className || $[13] !== flex || $[14] !== muted || $[15] !== size2 || $[16] !== weight ? (t5 = css.heading({
3590
- className,
3591
- align,
3592
- flex,
3593
- muted,
3594
- size: size2,
3595
- weight
3596
- }), $[11] = align, $[12] = className, $[13] = flex, $[14] = muted, $[15] = size2, $[16] = weight, $[17] = t5) : t5 = $[17];
3597
- let t6;
3598
- $[18] !== textOverflowProp ? (t6 = css.textOverflow({
3599
- textOverflow: textOverflowProp
3600
- }), $[18] = textOverflowProp, $[19] = t6) : t6 = $[19];
3601
- let t7;
3602
- $[20] !== children || $[21] !== t6 ? (t7 = /* @__PURE__ */ jsxRuntime.jsx("span", { className: t6, children }), $[20] = children, $[21] = t6, $[22] = t7) : t7 = $[22];
3603
- let t8;
3604
- return $[23] !== Element2 || $[24] !== rest || $[25] !== t5 || $[26] !== t7 ? (t8 = /* @__PURE__ */ jsxRuntime.jsx(Element2, { "data-ui": "Heading", ...rest, className: t5, children: t7 }), $[23] = Element2, $[24] = rest, $[25] = t5, $[26] = t7, $[27] = t8) : t8 = $[27], t8;
3605
- }
3606
- const DEFAULT_INLINE_ELEMENT = "div";
3607
- function Inline(props) {
3608
- const $ = compilerRuntime.c(10), t0 = props;
3609
- let children, gap, rest, t1;
3610
- $[0] !== t0 ? ({
3611
- as: t1,
3612
- children,
3613
- gap,
3614
- ...rest
3615
- } = t0, $[0] = t0, $[1] = children, $[2] = gap, $[3] = rest, $[4] = t1) : (children = $[1], gap = $[2], rest = $[3], t1 = $[4]);
3616
- const as = t1 === void 0 ? DEFAULT_INLINE_ELEMENT : t1;
3617
- let t2;
3618
- return $[5] !== as || $[6] !== children || $[7] !== gap || $[8] !== rest ? (t2 = /* @__PURE__ */ jsxRuntime.jsx(Box, { "data-ui": "Inline", ...rest, alignItems: "center", as, display: "flex", gap, flexWrap: "wrap", children }), $[5] = as, $[6] = children, $[7] = gap, $[8] = rest, $[9] = t2) : t2 = $[9], t2;
3619
- }
3620
- const DEFAULT_RADIO_ELEMENT = "input";
3621
- function Radio(props) {
3622
- const $ = compilerRuntime.c(25), t0 = props;
3623
- let className, customValidity, disabled, forwardedRef, readOnly, rest, style, t1;
3624
- $[0] !== t0 ? ({
3625
- as: t1,
3626
- className,
3627
- disabled,
3628
- style,
3629
- customValidity,
3630
- readOnly,
3631
- ref: forwardedRef,
3632
- ...rest
3633
- } = t0, $[0] = t0, $[1] = className, $[2] = customValidity, $[3] = disabled, $[4] = forwardedRef, $[5] = readOnly, $[6] = rest, $[7] = style, $[8] = t1) : (className = $[1], customValidity = $[2], disabled = $[3], forwardedRef = $[4], readOnly = $[5], rest = $[6], style = $[7], t1 = $[8]);
3634
- const Element2 = t1 === void 0 ? DEFAULT_RADIO_ELEMENT : t1, ref = react.useRef(null);
3635
- let t2;
3636
- $[9] === Symbol.for("react.memo_cache_sentinel") ? (t2 = () => ref.current, $[9] = t2) : t2 = $[9], react.useImperativeHandle(forwardedRef, t2), useCustomValidity(ref, customValidity);
3637
- let t3;
3638
- $[10] !== className ? (t3 = css.radio({
3639
- className
3640
- }), $[10] = className, $[11] = t3) : t3 = $[11];
3641
- let t4;
3642
- $[12] === Symbol.for("react.memo_cache_sentinel") ? (t4 = css.radioInput(), $[12] = t4) : t4 = $[12];
3643
- const t5 = customValidity ? "" : void 0, t6 = !disabled && readOnly ? "" : void 0, t7 = disabled || readOnly;
3644
- let t8;
3645
- $[13] !== Element2 || $[14] !== readOnly || $[15] !== rest || $[16] !== t5 || $[17] !== t6 || $[18] !== t7 ? (t8 = /* @__PURE__ */ jsxRuntime.jsx(Element2, { ...rest, className: t4, "data-invalid": t5, "data-read-only": t6, disabled: t7, readOnly, ref, type: "radio" }), $[13] = Element2, $[14] = readOnly, $[15] = rest, $[16] = t5, $[17] = t6, $[18] = t7, $[19] = t8) : t8 = $[19];
3646
- let t9;
3647
- $[20] === Symbol.for("react.memo_cache_sentinel") ? (t9 = /* @__PURE__ */ jsxRuntime.jsx("span", { className: css.radioPresentation() }), $[20] = t9) : t9 = $[20];
3648
- let t10;
3649
- return $[21] !== style || $[22] !== t3 || $[23] !== t8 ? (t10 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: t3, "data-ui": "Radio", style, children: [
3650
- t8,
3651
- t9
3652
- ] }), $[21] = style, $[22] = t3, $[23] = t8, $[24] = t10) : t10 = $[24], t10;
3653
- }
3654
- const DEFAULT_SELECT_ELEMENT = "select";
3655
- function Select(props) {
3656
- const $ = compilerRuntime.c(37), t0 = props;
3657
- let children, customValidity, disabled, forwardedRef, readOnly, rest, t1, t2, t3, t4, t5, t6;
3658
- $[0] !== t0 ? ({
3659
- as: t1,
3660
- border: t2,
3661
- children,
3662
- customValidity,
3663
- disabled,
3664
- fontSize: t3,
3665
- gap: t4,
3666
- padding: t5,
3667
- radius: t6,
3668
- readOnly,
3669
- ref: forwardedRef,
3670
- ...rest
3671
- } = t0, $[0] = t0, $[1] = children, $[2] = customValidity, $[3] = disabled, $[4] = forwardedRef, $[5] = readOnly, $[6] = rest, $[7] = t1, $[8] = t2, $[9] = t3, $[10] = t4, $[11] = t5, $[12] = t6) : (children = $[1], customValidity = $[2], disabled = $[3], forwardedRef = $[4], readOnly = $[5], rest = $[6], t1 = $[7], t2 = $[8], t3 = $[9], t4 = $[10], t5 = $[11], t6 = $[12]);
3672
- const Element2 = t1 === void 0 ? DEFAULT_SELECT_ELEMENT : t1, border = t2 === void 0 ? !0 : t2, fontSize = t3 === void 0 ? 2 : t3, gap = t4 === void 0 ? 2 : t4, padding = t5 === void 0 ? 3 : t5, radius = t6 === void 0 ? 1 : t6, ref = react.useRef(null);
3673
- let t7;
3674
- $[13] === Symbol.for("react.memo_cache_sentinel") ? (t7 = () => ref.current, $[13] = t7) : t7 = $[13], react.useImperativeHandle(forwardedRef, t7), useCustomValidity(ref, customValidity);
3675
- let t8;
3676
- $[14] !== border || $[15] !== fontSize || $[16] !== gap || $[17] !== padding || $[18] !== radius ? (t8 = css.select({
3677
- border,
3678
- fontSize,
3679
- gap,
3680
- padding,
3681
- radius
3682
- }), $[14] = border, $[15] = fontSize, $[16] = gap, $[17] = padding, $[18] = radius, $[19] = t8) : t8 = $[19];
3683
- let t9;
3684
- $[20] === Symbol.for("react.memo_cache_sentinel") ? (t9 = css._inputElement(), $[20] = t9) : t9 = $[20];
3685
- const t10 = disabled || readOnly;
3686
- let t11;
3687
- $[21] !== Element2 || $[22] !== children || $[23] !== rest || $[24] !== t10 ? (t11 = /* @__PURE__ */ jsxRuntime.jsx(Element2, { ...rest, className: t9, disabled: t10, ref, children }), $[21] = Element2, $[22] = children, $[23] = rest, $[24] = t10, $[25] = t11) : t11 = $[25];
3688
- let t12;
3689
- $[26] === Symbol.for("react.memo_cache_sentinel") ? (t12 = css.selectPresentation(), $[26] = t12) : t12 = $[26];
3690
- let t13;
3691
- $[27] === Symbol.for("react.memo_cache_sentinel") ? (t13 = /* @__PURE__ */ jsxRuntime.jsx(icons.ChevronDownIcon, {}), $[27] = t13) : t13 = $[27];
3692
- let t14;
3693
- $[28] !== fontSize ? (t14 = /* @__PURE__ */ jsxRuntime.jsx(Text, { size: fontSize, children: t13 }), $[28] = fontSize, $[29] = t14) : t14 = $[29];
3694
- let t15;
3695
- $[30] !== padding || $[31] !== t14 ? (t15 = /* @__PURE__ */ jsxRuntime.jsx("span", { className: t12, children: /* @__PURE__ */ jsxRuntime.jsx(Box, { as: "span", display: "inline-block", padding, children: t14 }) }), $[30] = padding, $[31] = t14, $[32] = t15) : t15 = $[32];
3696
- let t16;
3697
- return $[33] !== t11 || $[34] !== t15 || $[35] !== t8 ? (t16 = /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-ui": "Select", className: t8, "data-icon-right": "", children: [
3698
- t11,
3699
- t15
3700
- ] }), $[33] = t11, $[34] = t15, $[35] = t8, $[36] = t16) : t16 = $[36], t16;
3701
- }
3702
- const DEFAULT_SKELETON_ELEMENT = "div";
3703
- function Skeleton(props) {
3704
- const $ = compilerRuntime.c(18), t0 = props;
3705
- let className, delay, rest, t1, t2;
3706
- $[0] !== t0 ? ({
3707
- as: t1,
3708
- animated: t2,
3709
- className,
3710
- delay,
3711
- ...rest
3712
- } = t0, $[0] = t0, $[1] = className, $[2] = delay, $[3] = rest, $[4] = t1, $[5] = t2) : (className = $[1], delay = $[2], rest = $[3], t1 = $[4], t2 = $[5]);
3713
- const As = t1 === void 0 ? DEFAULT_SKELETON_ELEMENT : t1, animated = t2 === void 0 ? !1 : t2, [visible, setVisible] = react.useState(!delay);
3714
- let t3, t4;
3715
- $[6] !== delay ? (t3 = () => {
3716
- if (!delay)
3717
- return setVisible(!0);
3718
- const timeout = setTimeout(() => {
3719
- setVisible(!0);
3720
- }, delay);
3721
- return () => {
3722
- clearTimeout(timeout);
3723
- };
3724
- }, t4 = [delay], $[6] = delay, $[7] = t3, $[8] = t4) : (t3 = $[7], t4 = $[8]), react.useEffect(t3, t4);
3725
- let t5;
3726
- $[9] !== className || $[10] !== rest ? (t5 = css.skeleton({
3727
- className,
3728
- ...rest
3729
- }), $[9] = className, $[10] = rest, $[11] = t5) : t5 = $[11];
3730
- const t6 = animated ? "" : void 0, t7 = visible ? "" : void 0;
3731
- let t8;
3732
- return $[12] !== As || $[13] !== rest || $[14] !== t5 || $[15] !== t6 || $[16] !== t7 ? (t8 = /* @__PURE__ */ jsxRuntime.jsx(As, { "data-ui": "Skeleton", ...rest, className: t5, "data-animated": t6, "data-visible": t7 }), $[12] = As, $[13] = rest, $[14] = t5, $[15] = t6, $[16] = t7, $[17] = t8) : t8 = $[17], t8;
3733
- }
3734
- const DEFAULT_CODE_SKELETON_ELEMENT = "div";
3735
- function CodeSkeleton(props) {
3736
- const $ = compilerRuntime.c(10), t0 = props;
3737
- let className, rest, t1;
3738
- $[0] !== t0 ? ({
3739
- className,
3740
- size: t1,
3741
- ...rest
3742
- } = t0, $[0] = t0, $[1] = className, $[2] = rest, $[3] = t1) : (className = $[1], rest = $[2], t1 = $[3]);
3743
- const size2 = t1 === void 0 ? 2 : t1;
3744
- let t2;
3745
- $[4] !== className || $[5] !== size2 ? (t2 = css.codeSkeleton({
3746
- className,
3747
- size: size2
3748
- }), $[4] = className, $[5] = size2, $[6] = t2) : t2 = $[6];
3749
- let t3;
3750
- return $[7] !== rest || $[8] !== t2 ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { ...rest, className: t2 }), $[7] = rest, $[8] = t2, $[9] = t3) : t3 = $[9], t3;
3751
- }
3752
- const DEFAULT_HEADING_SKELETON_ELEMENT = "div";
3753
- function HeadingSkeleton(props) {
3754
- const $ = compilerRuntime.c(10), t0 = props;
3755
- let className, rest, t1;
3756
- $[0] !== t0 ? ({
3757
- className,
3758
- size: t1,
3759
- ...rest
3760
- } = t0, $[0] = t0, $[1] = className, $[2] = rest, $[3] = t1) : (className = $[1], rest = $[2], t1 = $[3]);
3761
- const size2 = t1 === void 0 ? 2 : t1;
3762
- let t2;
3763
- $[4] !== className || $[5] !== size2 ? (t2 = css.headingSkeleton({
3764
- className,
3765
- size: size2
3766
- }), $[4] = className, $[5] = size2, $[6] = t2) : t2 = $[6];
3767
- let t3;
3768
- return $[7] !== rest || $[8] !== t2 ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { ...rest, className: t2 }), $[7] = rest, $[8] = t2, $[9] = t3) : t3 = $[9], t3;
3769
- }
3770
- const DEFAULT_LABEL_SKELETON_ELEMENT = "div";
3771
- function LabelSkeleton(props) {
3772
- const $ = compilerRuntime.c(10), t0 = props;
3773
- let className, rest, t1;
3774
- $[0] !== t0 ? ({
3775
- className,
3776
- size: t1,
3777
- ...rest
3778
- } = t0, $[0] = t0, $[1] = className, $[2] = rest, $[3] = t1) : (className = $[1], rest = $[2], t1 = $[3]);
3779
- const size2 = t1 === void 0 ? 2 : t1;
3780
- let t2;
3781
- $[4] !== className || $[5] !== size2 ? (t2 = css.labelSkeleton({
3782
- className,
3783
- size: size2
3784
- }), $[4] = className, $[5] = size2, $[6] = t2) : t2 = $[6];
3785
- let t3;
3786
- return $[7] !== rest || $[8] !== t2 ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { ...rest, className: t2 }), $[7] = rest, $[8] = t2, $[9] = t3) : t3 = $[9], t3;
3787
- }
3788
- const DEFAULT_TEXT_SKELETON_ELEMENT = "div";
3789
- function TextSkeleton(props) {
3790
- const $ = compilerRuntime.c(10), t0 = props;
3791
- let className, rest, t1;
3792
- $[0] !== t0 ? ({
3793
- className,
3794
- size: t1,
3795
- ...rest
3796
- } = t0, $[0] = t0, $[1] = className, $[2] = rest, $[3] = t1) : (className = $[1], rest = $[2], t1 = $[3]);
3797
- const size2 = t1 === void 0 ? 2 : t1;
3798
- let t2;
3799
- $[4] !== className || $[5] !== size2 ? (t2 = css.textSkeleton({
3800
- className,
3801
- size: size2
3802
- }), $[4] = className, $[5] = size2, $[6] = t2) : t2 = $[6];
3803
- let t3;
3804
- return $[7] !== rest || $[8] !== t2 ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { ...rest, className: t2 }), $[7] = rest, $[8] = t2, $[9] = t3) : t3 = $[9], t3;
3805
- }
3806
- const DEFAULT_SR_ONLY_ELEMENT = "span";
3807
- function SrOnly(props) {
3808
- const $ = compilerRuntime.c(12), t0 = props;
3809
- let children, className, rest, t1;
3810
- $[0] !== t0 ? ({
3811
- as: t1,
3812
- children,
3813
- className,
3814
- ...rest
3815
- } = t0, $[0] = t0, $[1] = children, $[2] = className, $[3] = rest, $[4] = t1) : (children = $[1], className = $[2], rest = $[3], t1 = $[4]);
3816
- const Element2 = t1 === void 0 ? DEFAULT_SR_ONLY_ELEMENT : t1;
3817
- let t2;
3818
- $[5] !== className ? (t2 = css.srOnly({
3819
- className
3820
- }), $[5] = className, $[6] = t2) : t2 = $[6];
3821
- let t3;
3822
- return $[7] !== Element2 || $[8] !== children || $[9] !== rest || $[10] !== t2 ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(Element2, { "data-ui": "SrOnly", ...rest, "aria-hidden": !0, className: t2, children }), $[7] = Element2, $[8] = children, $[9] = rest, $[10] = t2, $[11] = t3) : t3 = $[11], t3;
3823
- }
3824
- const DEFAULT_SWITCH_ELEMENT = "input";
3825
- function Switch(props) {
3826
- const $ = compilerRuntime.c(26), t0 = props;
3827
- let className, disabled, forwardedRef, indeterminate, readOnly, rest, style, t1;
3828
- $[0] !== t0 ? ({
3829
- as: t1,
3830
- className,
3831
- disabled,
3832
- indeterminate,
3833
- readOnly,
3834
- ref: forwardedRef,
3835
- style,
3836
- ...rest
3837
- } = t0, $[0] = t0, $[1] = className, $[2] = disabled, $[3] = forwardedRef, $[4] = indeterminate, $[5] = readOnly, $[6] = rest, $[7] = style, $[8] = t1) : (className = $[1], disabled = $[2], forwardedRef = $[3], indeterminate = $[4], readOnly = $[5], rest = $[6], style = $[7], t1 = $[8]);
3838
- const Element2 = t1 === void 0 ? DEFAULT_SWITCH_ELEMENT : t1, ref = react.useRef(null);
3839
- let t2;
3840
- $[9] === Symbol.for("react.memo_cache_sentinel") ? (t2 = () => ref.current, $[9] = t2) : t2 = $[9], react.useImperativeHandle(forwardedRef, t2);
3841
- let t3, t4;
3842
- $[10] !== indeterminate ? (t3 = () => {
3843
- ref.current && (ref.current.indeterminate = indeterminate || !1);
3844
- }, t4 = [indeterminate], $[10] = indeterminate, $[11] = t3, $[12] = t4) : (t3 = $[11], t4 = $[12]), react.useEffect(t3, t4);
3845
- let t5;
3846
- $[13] !== className ? (t5 = css._switch({
3847
- className
3848
- }), $[13] = className, $[14] = t5) : t5 = $[14];
3849
- let t6;
3850
- $[15] === Symbol.for("react.memo_cache_sentinel") ? (t6 = css._switchElement(), $[15] = t6) : t6 = $[15];
3851
- const t7 = !disabled && readOnly ? "" : void 0, t8 = disabled || readOnly;
3852
- let t9;
3853
- $[16] !== Element2 || $[17] !== rest || $[18] !== t7 || $[19] !== t8 ? (t9 = /* @__PURE__ */ jsxRuntime.jsx(Element2, { ...rest, className: t6, "data-read-only": t7, disabled: t8, type: "checkbox", ref }), $[16] = Element2, $[17] = rest, $[18] = t7, $[19] = t8, $[20] = t9) : t9 = $[20];
3854
- let t10;
3855
- $[21] === Symbol.for("react.memo_cache_sentinel") ? (t10 = /* @__PURE__ */ jsxRuntime.jsxs("span", { "aria-hidden": !0, className: css._switchPresentation(), children: [
3856
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: css._switchTrack() }),
3857
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: css._switchThumb() })
3858
- ] }), $[21] = t10) : t10 = $[21];
3859
- let t11;
3860
- return $[22] !== style || $[23] !== t5 || $[24] !== t9 ? (t11 = /* @__PURE__ */ jsxRuntime.jsxs(Box, { className: t5, "data-ui": "Switch", display: "block", position: "relative", style, children: [
3861
- t9,
3862
- t10
3863
- ] }), $[22] = style, $[23] = t5, $[24] = t9, $[25] = t11) : t11 = $[25], t11;
3864
- }
3865
- const DEFAULT_TEXT_AREA_ELEMENT = "textarea";
3866
- function TextArea(props) {
3867
- const $ = compilerRuntime.c(33), t0 = props;
3868
- let __unstable_disableFocusRing, customValidity, forwardedRef, readOnly, rest, t1, t2, t3, t4, t5, t6, t7;
3869
- $[0] !== t0 ? ({
3870
- __unstable_disableFocusRing,
3871
- as: t1,
3872
- border: t2,
3873
- customValidity,
3874
- disabled: t3,
3875
- fontSize: t4,
3876
- gap: t5,
3877
- padding: t6,
3878
- radius: t7,
3879
- readOnly,
3880
- ref: forwardedRef,
3881
- ...rest
3882
- } = t0, $[0] = t0, $[1] = __unstable_disableFocusRing, $[2] = customValidity, $[3] = forwardedRef, $[4] = readOnly, $[5] = rest, $[6] = t1, $[7] = t2, $[8] = t3, $[9] = t4, $[10] = t5, $[11] = t6, $[12] = t7) : (__unstable_disableFocusRing = $[1], customValidity = $[2], forwardedRef = $[3], readOnly = $[4], rest = $[5], t1 = $[6], t2 = $[7], t3 = $[8], t4 = $[9], t5 = $[10], t6 = $[11], t7 = $[12]);
3883
- const Element2 = t1 === void 0 ? DEFAULT_TEXT_AREA_ELEMENT : t1, border = t2 === void 0 ? !0 : t2, disabled = t3 === void 0 ? !1 : t3, fontSize = t4 === void 0 ? 2 : t4, gap = t5 === void 0 ? 3 : t5, padding = t6 === void 0 ? 3 : t6, radius = t7 === void 0 ? 2 : t7, ref = react.useRef(null);
3884
- let t8;
3885
- $[13] === Symbol.for("react.memo_cache_sentinel") ? (t8 = () => ref.current, $[13] = t8) : t8 = $[13], react.useImperativeHandle(forwardedRef, t8), useCustomValidity(ref, customValidity);
3886
- let t9;
3887
- $[14] !== border || $[15] !== fontSize || $[16] !== gap || $[17] !== padding || $[18] !== radius ? (t9 = css.textArea({
3888
- border,
3889
- fontSize,
3890
- padding,
3891
- radius,
3892
- gap
3893
- }), $[14] = border, $[15] = fontSize, $[16] = gap, $[17] = padding, $[18] = radius, $[19] = t9) : t9 = $[19];
3894
- const t10 = customValidity ? "" : void 0, t11 = !disabled && readOnly ? "" : void 0;
3895
- let t12;
3896
- $[20] === Symbol.for("react.memo_cache_sentinel") ? (t12 = css._inputElement(), $[20] = t12) : t12 = $[20];
3897
- const t13 = __unstable_disableFocusRing ? "" : void 0;
3898
- let t14;
3899
- $[21] !== Element2 || $[22] !== disabled || $[23] !== readOnly || $[24] !== rest || $[25] !== t13 ? (t14 = /* @__PURE__ */ jsxRuntime.jsx(Element2, { ...rest, className: t12, "data-no-focus-ring": t13, disabled, readOnly, ref }), $[21] = Element2, $[22] = disabled, $[23] = readOnly, $[24] = rest, $[25] = t13, $[26] = t14) : t14 = $[26];
3900
- let t15;
3901
- $[27] === Symbol.for("react.memo_cache_sentinel") ? (t15 = /* @__PURE__ */ jsxRuntime.jsx("span", { className: css._inputPresentation() }), $[27] = t15) : t15 = $[27];
3902
- let t16;
3903
- return $[28] !== t10 || $[29] !== t11 || $[30] !== t14 || $[31] !== t9 ? (t16 = /* @__PURE__ */ jsxRuntime.jsxs("span", { className: t9, "data-invalid": t10, "data-read-only": t11, "data-ui": "TextArea", children: [
3904
- t14,
3905
- t15
3906
- ] }), $[28] = t10, $[29] = t11, $[30] = t14, $[31] = t9, $[32] = t16) : t16 = $[32], t16;
3907
- }
3908
- function useDelayedState(initialState) {
3909
- const $ = compilerRuntime.c(3), [state, setState] = react.useState(initialState), delayedAction = react.useRef(void 0);
3910
- let t0;
3911
- $[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = (nextState, delay) => {
3912
- const action = () => {
3913
- setState(nextState);
3914
- };
3915
- if (delayedAction.current && (clearTimeout(delayedAction.current), delayedAction.current = void 0), !delay)
3916
- return action();
3917
- delayedAction.current = setTimeout(action, delay);
3918
- }, $[0] = t0) : t0 = $[0];
3919
- const onStateChange = t0;
3920
- let t1;
3921
- return $[1] !== state ? (t1 = [state, onStateChange], $[1] = state, $[2] = t1) : t1 = $[2], t1;
3922
- }
3923
- const DEFAULT_TOOLTIP_ARROW_WIDTH = 15, DEFAULT_TOOLTIP_ARROW_HEIGHT = 6, DEFAULT_TOOLTIP_ARROW_RADIUS = 2, DEFAULT_TOOLTIP_DISTANCE = 4, DEFAULT_TOOLTIP_PADDING = 4, DEFAULT_FALLBACK_PLACEMENTS = {
3924
- top: ["top-end", "top-start", "bottom", "left", "right"],
3925
- "top-start": ["top", "top-end", "bottom-start", "left-start", "right-start"],
3926
- "top-end": ["top", "top-start", "bottom-end", "left-end", "right-end"],
3927
- bottom: ["bottom-end", "bottom-start", "top", "left", "right"],
3928
- "bottom-start": ["bottom", "bottom-end", "top-start", "left-start", "right-start"],
3929
- "bottom-end": ["bottom", "bottom-start", "top-end", "left-end", "right-end"],
3930
- left: ["left-end", "left-start", "right", "top", "bottom"],
3931
- "left-start": ["left", "left-end", "right-start", "top-start", "bottom-start"],
3932
- "left-end": ["left", "left-start", "right-end", "top-end", "bottom-end"],
3933
- right: ["right-end", "right-start", "left", "top", "bottom"],
3934
- "right-start": ["right", "right-end", "left-start", "top-start", "bottom-start"],
3935
- "right-end": ["right", "right-start", "left-end", "top-end", "bottom-end"]
3936
- }, TooltipDelayGroupContext = createGlobalScopedContext("@sanity/ui/v3/tooltipDelayGroup", null);
3937
- function TooltipDelayGroupProvider(props) {
3938
- const $ = compilerRuntime.c(9), {
3939
- children,
3940
- delay
3941
- } = props, [isGroupActive, setIsGroupActive] = useDelayedState(!1), [openTooltipId, setOpenTooltipId] = useDelayedState(null), openDelay = typeof delay == "number" ? delay : delay?.open || 0, closeDelay = typeof delay == "number" ? delay : delay?.close || 0;
3942
- let t0;
3943
- const t1 = isGroupActive ? 1 : openDelay;
3944
- let t2;
3945
- $[0] !== closeDelay || $[1] !== openTooltipId || $[2] !== setIsGroupActive || $[3] !== setOpenTooltipId || $[4] !== t1 ? (t2 = {
3946
- setIsGroupActive,
3947
- openTooltipId,
3948
- setOpenTooltipId,
3949
- openDelay: t1,
3950
- closeDelay
3951
- }, $[0] = closeDelay, $[1] = openTooltipId, $[2] = setIsGroupActive, $[3] = setOpenTooltipId, $[4] = t1, $[5] = t2) : t2 = $[5], t0 = t2;
3952
- const value = t0;
3953
- let t3;
3954
- return $[6] !== children || $[7] !== value ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(TooltipDelayGroupContext.Provider, { value, children }), $[6] = children, $[7] = value, $[8] = t3) : t3 = $[8], t3;
3955
- }
3956
- function useTooltipDelayGroup() {
3957
- return react.useContext(TooltipDelayGroupContext);
3958
- }
3959
- function TooltipLayer(props) {
3960
- const $ = compilerRuntime.c(50);
3961
- let animate, arrow, arrowRef, arrowX, arrowY, children, originX, originY, padding, placement, radius, rest, scheme, shadow, style, t0;
3962
- $[0] !== props ? ({
3963
- animate,
3964
- arrow,
3965
- arrowRef,
3966
- arrowX,
3967
- arrowY,
3968
- children,
3969
- originX,
3970
- originY,
3971
- padding,
3972
- placement,
3973
- radius,
3974
- scheme,
3975
- shadow,
3976
- style,
3977
- tone: t0,
3978
- ...rest
3979
- } = props, $[0] = props, $[1] = animate, $[2] = arrow, $[3] = arrowRef, $[4] = arrowX, $[5] = arrowY, $[6] = children, $[7] = originX, $[8] = originY, $[9] = padding, $[10] = placement, $[11] = radius, $[12] = rest, $[13] = scheme, $[14] = shadow, $[15] = style, $[16] = t0) : (animate = $[1], arrow = $[2], arrowRef = $[3], arrowX = $[4], arrowY = $[5], children = $[6], originX = $[7], originY = $[8], padding = $[9], placement = $[10], radius = $[11], rest = $[12], scheme = $[13], shadow = $[14], style = $[15], t0 = $[16]);
3980
- const tone = t0 === void 0 ? "inherit" : t0;
3981
- let t1;
3982
- const t2 = animate ? "transform" : void 0;
3983
- let t3;
3984
- $[17] !== originX || $[18] !== originY || $[19] !== style || $[20] !== t2 ? (t3 = {
3985
- originX,
3986
- originY,
3987
- willChange: t2,
3988
- ...style
3989
- }, $[17] = originX, $[18] = originY, $[19] = style, $[20] = t2, $[21] = t3) : t3 = $[21], t1 = t3;
3990
- const rootStyle = t1;
3991
- let t4;
3992
- const t5 = arrowX !== null ? arrowX : void 0, t6 = arrowY !== null ? arrowY : void 0;
3993
- let t7;
3994
- $[22] !== t5 || $[23] !== t6 ? (t7 = {
3995
- left: t5,
3996
- top: t6,
3997
- right: void 0,
3998
- bottom: void 0
3999
- }, $[22] = t5, $[23] = t6, $[24] = t7) : t7 = $[24], t4 = t7;
4000
- const arrowStyle = t4, t8 = animate ? "" : void 0;
4001
- let t9;
4002
- $[25] !== animate ? (t9 = animate ? ["hidden", "initial"] : void 0, $[25] = animate, $[26] = t9) : t9 = $[26];
4003
- let t10;
4004
- $[27] !== animate ? (t10 = animate ? ["visible", "scaleIn"] : void 0, $[27] = animate, $[28] = t10) : t10 = $[28];
4005
- let t11;
4006
- $[29] !== animate ? (t11 = animate ? ["hidden", "scaleOut"] : void 0, $[29] = animate, $[30] = t11) : t11 = $[30];
4007
- let t12;
4008
- $[31] !== arrow || $[32] !== arrowRef || $[33] !== arrowStyle ? (t12 = arrow && /* @__PURE__ */ jsxRuntime.jsx(Arrow, { ref: arrowRef, style: arrowStyle, width: DEFAULT_TOOLTIP_ARROW_WIDTH, height: DEFAULT_TOOLTIP_ARROW_HEIGHT, radius: DEFAULT_TOOLTIP_ARROW_RADIUS }), $[31] = arrow, $[32] = arrowRef, $[33] = arrowStyle, $[34] = t12) : t12 = $[34];
4009
- let t13;
4010
- return $[35] !== children || $[36] !== padding || $[37] !== placement || $[38] !== radius || $[39] !== rest || $[40] !== rootStyle || $[41] !== scheme || $[42] !== shadow || $[43] !== t10 || $[44] !== t11 || $[45] !== t12 || $[46] !== t8 || $[47] !== t9 || $[48] !== tone ? (t13 = /* @__PURE__ */ jsxRuntime.jsxs(Layer, { "data-ui": "Tooltip__layer", ...rest, as: framerMotion.motion.div, "data-animate": t8, "data-placement": placement, padding, radius, scheme, shadow, style: rootStyle, variants: POPOVER_MOTION_PROPS.card, transition: POPOVER_MOTION_PROPS.transition, initial: t9, animate: t10, exit: t11, tone, children: [
4011
- children,
4012
- t12
4013
- ] }), $[35] = children, $[36] = padding, $[37] = placement, $[38] = radius, $[39] = rest, $[40] = rootStyle, $[41] = scheme, $[42] = shadow, $[43] = t10, $[44] = t11, $[45] = t12, $[46] = t8, $[47] = t9, $[48] = tone, $[49] = t13) : t13 = $[49], t13;
4014
- }
4015
- const DEFAULT_TOOLTIP_ELEMENT = "div";
4016
- function Tooltip(props) {
4017
- const boundaryElementContext = useBoundaryElement(), {
4018
- animate: _animate = !1,
4019
- arrow: arrowProp = !1,
4020
- as = DEFAULT_TOOLTIP_ELEMENT,
4021
- boundaryElement = boundaryElementContext?.element,
4022
- children: childProp,
4023
- className,
4024
- content: content2,
4025
- delay,
4026
- disabled,
4027
- fallbackPlacements = props.fallbackPlacements ?? DEFAULT_FALLBACK_PLACEMENTS[props.placement ?? "bottom"],
4028
- padding = 2,
4029
- placement: placementProp = "bottom",
4030
- portal: portalProp,
4031
- radius = 3,
4032
- ref: forwardedRef,
4033
- scheme,
4034
- shadow = 2,
4035
- zOffset = Z_OFFSETS.tooltip,
4036
- tone = "inherit",
4037
- ...rest
4038
- } = props, card = useCard(), animate = usePrefersReducedMotion() ? !1 : _animate, ref = react.useRef(null), [referenceElement, setReferenceElement] = react.useState(null), arrowRef = react.useRef(null), rootBoundary = "viewport", [tooltipMaxWidth, setTooltipMaxWidth] = react.useState(0);
4039
- react.useImperativeHandle(forwardedRef, () => ref.current);
4040
- const portal = usePortal(), portalElement = typeof portalProp == "string" ? portal.elements?.[portalProp] || null : portal.element, middleware = react.useMemo(() => {
4041
- const ret = [];
4042
- return ret.push(reactDom$1.flip({
4043
- boundary: boundaryElement || void 0,
4044
- fallbackPlacements,
4045
- padding: DEFAULT_TOOLTIP_PADDING,
4046
- rootBoundary
4047
- })), ret.push(reactDom$1.offset({
4048
- mainAxis: DEFAULT_TOOLTIP_DISTANCE
4049
- })), ret.push(reactDom$1.shift({
4050
- boundary: boundaryElement || void 0,
4051
- rootBoundary,
4052
- padding: DEFAULT_TOOLTIP_PADDING
4053
- })), arrowProp && ret.push(reactDom$1.arrow({
4054
- element: arrowRef,
4055
- padding: DEFAULT_TOOLTIP_PADDING
4056
- })), animate && ret.push(origin), ret;
4057
- }, [animate, arrowProp, boundaryElement, fallbackPlacements]), {
4058
- floatingStyles,
4059
- placement,
4060
- middlewareData,
4061
- refs,
4062
- update
4063
- } = reactDom$1.useFloating({
4064
- middleware,
4065
- placement: placementProp,
4066
- whileElementsMounted: reactDom$1.autoUpdate,
4067
- elements: {
4068
- reference: referenceElement
4069
- },
4070
- transform: !1
4071
- }), arrowX = middlewareData.arrow?.x, arrowY = middlewareData.arrow?.y, originX = middlewareData["@sanity/ui/origin"]?.originX, originY = middlewareData["@sanity/ui/origin"]?.originY, tooltipId = react.useId(), [isOpen, setIsOpen] = useDelayedState(!1), delayGroupContext = useTooltipDelayGroup(), {
4072
- setIsGroupActive,
4073
- setOpenTooltipId
4074
- } = delayGroupContext || {}, showTooltip = isOpen || delayGroupContext?.openTooltipId === tooltipId, isInsideGroup = delayGroupContext !== null, openDelayProp = typeof delay == "number" ? delay : delay?.open || 0, closeDelayProp = typeof delay == "number" ? delay : delay?.close || 0, openDelay = isInsideGroup ? delayGroupContext.openDelay : openDelayProp, closeDelay = isInsideGroup ? delayGroupContext.closeDelay : closeDelayProp, handleIsOpenChange = react.useCallback((open, immediate) => {
4075
- if (isInsideGroup)
4076
- if (open) {
4077
- const groupedOpenDelay = immediate ? 0 : openDelay;
4078
- setIsGroupActive?.(open, groupedOpenDelay), setOpenTooltipId?.(tooltipId, groupedOpenDelay);
4079
- } else {
4080
- const groupDeactivateDelay = closeDelay > 200 ? closeDelay : 200;
4081
- setIsGroupActive?.(open, groupDeactivateDelay), setOpenTooltipId?.(null, immediate ? 0 : closeDelay);
4082
- }
4083
- else
4084
- setIsOpen(open, immediate ? 0 : open ? openDelay : closeDelay);
4085
- }, [isInsideGroup, openDelay, setIsGroupActive, setOpenTooltipId, tooltipId, closeDelay, setIsOpen]), handleBlur = react.useCallback((e) => {
4086
- handleIsOpenChange(!1), childProp?.props?.onBlur?.(e);
4087
- }, [childProp?.props, handleIsOpenChange]), handleClick = react.useCallback((e_0) => {
4088
- handleIsOpenChange(!1, !0), childProp?.props.onClick?.(e_0);
4089
- }, [childProp?.props, handleIsOpenChange]), handleContextMenu = react.useCallback((e_1) => {
4090
- handleIsOpenChange(!1, !0), childProp?.props.onContextMenu?.(e_1);
4091
- }, [childProp?.props, handleIsOpenChange]), handleFocus = react.useCallback((e_2) => {
4092
- handleIsOpenChange(!0), childProp?.props?.onFocus?.(e_2);
4093
- }, [childProp?.props, handleIsOpenChange]), handleMouseEnter = react.useCallback((e_3) => {
4094
- handleIsOpenChange(!0), childProp?.props?.onMouseEnter?.(e_3);
4095
- }, [childProp?.props, handleIsOpenChange]), handleMouseLeave = react.useCallback((e_4) => {
4096
- handleIsOpenChange(!1), childProp?.props?.onMouseLeave?.(e_4);
4097
- }, [childProp?.props, handleIsOpenChange]);
4098
- useCloseOnMouseLeave({
4099
- handleIsOpenChange,
4100
- referenceElement,
4101
- showTooltip,
4102
- isInsideGroup
4103
- }), react.useEffect(() => {
4104
- disabled && showTooltip && handleIsOpenChange(!1);
4105
- }, [disabled, handleIsOpenChange, showTooltip]), react.useEffect(() => {
4106
- !content2 && showTooltip && handleIsOpenChange(!1);
4107
- }, [content2, handleIsOpenChange, showTooltip]), react.useEffect(() => {
4108
- if (!showTooltip) return;
4109
- function handleWindowKeyDown(event) {
4110
- event.key === "Escape" && handleIsOpenChange(!1, !0);
4111
- }
4112
- return window.addEventListener("keydown", handleWindowKeyDown), () => {
4113
- window.removeEventListener("keydown", handleWindowKeyDown);
4114
- };
4115
- }, [handleIsOpenChange, showTooltip]), react.useLayoutEffect(() => {
4116
- const availableWidths = [...boundaryElement ? [boundaryElement.offsetWidth] : [], portalElement?.offsetWidth || document.body.offsetWidth];
4117
- setTooltipMaxWidth(Math.min(...availableWidths) - DEFAULT_TOOLTIP_PADDING * 2);
4118
- }, [boundaryElement, portalElement]);
4119
- const setArrow = react.useCallback((arrowEl) => {
4120
- arrowRef.current = arrowEl, update();
4121
- }, [update]), setFloating = react.useCallback((node) => {
4122
- ref.current = node, refs.setFloating(node);
4123
- }, [refs]), child = react.useMemo(() => childProp ? react.cloneElement(childProp, {
4124
- onBlur: handleBlur,
4125
- onFocus: handleFocus,
4126
- onMouseEnter: handleMouseEnter,
4127
- onMouseLeave: handleMouseLeave,
4128
- onClick: handleClick,
4129
- onContextMenu: handleContextMenu,
4130
- ref: setReferenceElement
4131
- }) : null, [childProp, handleBlur, handleClick, handleContextMenu, handleFocus, handleMouseEnter, handleMouseLeave]);
4132
- if (react.useImperativeHandle(childProp ? getElementRef(childProp) : null, () => referenceElement, [referenceElement]), !child) return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {});
4133
- if (disabled) return child;
4134
- const node_0 = /* @__PURE__ */ jsxRuntime.jsx(TooltipLayer, { "data-ui": "Tooltip", ...rest, animate, arrow: arrowProp, arrowRef: setArrow, arrowX, arrowY, as, className: css.tooltip({
4135
- className
4136
- }), originX, originY, padding, placement, radius, ref: setFloating, scheme, shadow, style: {
4137
- ...floatingStyles,
4138
- maxWidth: tooltipMaxWidth > 0 ? `${tooltipMaxWidth}px` : void 0
4139
- }, tone, zOffset, children: content2 }), children = showTooltip && (portalProp ? /* @__PURE__ */ jsxRuntime.jsx(Portal, { __unstable_name: typeof portalProp == "string" ? portalProp : void 0, children: /* @__PURE__ */ jsxRuntime.jsx(CardProvider, { tone: tone === "inherit" ? card.tone : tone, scheme: scheme ?? "light", children: node_0 }) }) : node_0);
4140
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4141
- animate ? /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children }) : children,
4142
- child
4143
- ] });
4144
- }
4145
- function useCloseOnMouseLeave(t0) {
4146
- const $ = compilerRuntime.c(10), {
4147
- handleIsOpenChange,
4148
- referenceElement,
4149
- showTooltip,
4150
- isInsideGroup
4151
- } = t0;
4152
- let t1;
4153
- $[0] !== handleIsOpenChange || $[1] !== referenceElement ? (t1 = (target, teardown) => {
4154
- referenceElement && (referenceElement === target || target instanceof Node && referenceElement.contains(target) || (handleIsOpenChange(!1), teardown()));
4155
- }, $[0] = handleIsOpenChange, $[1] = referenceElement, $[2] = t1) : t1 = $[2];
4156
- const onMouseMove = useEffectEvent.useEffectEvent(t1);
4157
- let t2;
4158
- $[3] !== isInsideGroup || $[4] !== onMouseMove || $[5] !== showTooltip ? (t2 = () => {
4159
- if (!showTooltip || isInsideGroup)
4160
- return;
4161
- const handleMouseMove = (event) => {
4162
- onMouseMove(event.target, () => window.removeEventListener("mousemove", handleMouseMove));
4163
- };
4164
- return window.addEventListener("mousemove", handleMouseMove), () => window.removeEventListener("mousemove", handleMouseMove);
4165
- }, $[3] = isInsideGroup, $[4] = onMouseMove, $[5] = showTooltip, $[6] = t2) : t2 = $[6];
4166
- let t3;
4167
- $[7] !== isInsideGroup || $[8] !== showTooltip ? (t3 = [isInsideGroup, showTooltip], $[7] = isInsideGroup, $[8] = showTooltip, $[9] = t3) : t3 = $[9], react.useEffect(t2, t3);
4168
- }
4169
- function BoundaryElementProvider(props) {
4170
- const $ = compilerRuntime.c(5), {
4171
- children,
4172
- element
4173
- } = props;
4174
- let t0, t1;
4175
- $[0] !== element ? (t1 = {
4176
- version: 0,
4177
- element
4178
- }, $[0] = element, $[1] = t1) : t1 = $[1], t0 = t1;
4179
- const value = t0;
4180
- let t2;
4181
- return $[2] !== children || $[3] !== value ? (t2 = /* @__PURE__ */ jsxRuntime.jsx(BoundaryElementContext.Provider, { value, children }), $[2] = children, $[3] = value, $[4] = t2) : t2 = $[4], t2;
4182
- }
4183
- function findMaxBreakpoints(media2, width) {
4184
- const ret = [];
4185
- for (let i = 0; i < media2.length; i += 1)
4186
- media2[i] > width && ret.push(i);
4187
- return ret;
4188
- }
4189
- function findMinBreakpoints(media2, width) {
4190
- const ret = [];
4191
- for (let i = 0; i < media2.length; i += 1)
4192
- media2[i] <= width && ret.push(i);
4193
- return ret;
4194
- }
4195
- const DEFAULT_ELEMENT_QUERY_ELEMENT = "div", DEFAULT_BREAKPOINTS = Object.values(css.BREAKPOINTS);
4196
- function ElementQuery(props) {
4197
- const $ = compilerRuntime.c(21), t0 = props;
4198
- let children, forwardedRef, mediaProp, rest, t1;
4199
- $[0] !== t0 ? ({
4200
- as: t1,
4201
- children,
4202
- media: mediaProp,
4203
- ref: forwardedRef,
4204
- ...rest
4205
- } = t0, $[0] = t0, $[1] = children, $[2] = forwardedRef, $[3] = mediaProp, $[4] = rest, $[5] = t1) : (children = $[1], forwardedRef = $[2], mediaProp = $[3], rest = $[4], t1 = $[5]);
4206
- const Element2 = t1 === void 0 ? DEFAULT_ELEMENT_QUERY_ELEMENT : t1, breakpoints = mediaProp ?? DEFAULT_BREAKPOINTS, [element, setElement] = react.useState(null), elementSize = useElementSize(element);
4207
- let t2;
4208
- t2 = elementSize?.border.width ?? window.innerWidth;
4209
- const width = t2;
4210
- let t3, t4;
4211
- if ($[6] !== breakpoints || $[7] !== width) {
4212
- const eq = findMaxBreakpoints(breakpoints, width);
4213
- t4 = eq.length ? eq.join(" ") : void 0, $[6] = breakpoints, $[7] = width, $[8] = t4;
4214
- } else
4215
- t4 = $[8];
4216
- t3 = t4;
4217
- const max = t3;
4218
- let t5, t6;
4219
- if ($[9] !== breakpoints || $[10] !== width) {
4220
- const eq_0 = findMinBreakpoints(breakpoints, width);
4221
- t6 = eq_0.length ? eq_0.join(" ") : void 0, $[9] = breakpoints, $[10] = width, $[11] = t6;
4222
- } else
4223
- t6 = $[11];
4224
- t5 = t6;
4225
- const min = t5;
4226
- let t7, t8;
4227
- $[12] !== element ? (t7 = () => element, t8 = [element], $[12] = element, $[13] = t7, $[14] = t8) : (t7 = $[13], t8 = $[14]), react.useImperativeHandle(forwardedRef, t7, t8);
4228
- let t9;
4229
- return $[15] !== Element2 || $[16] !== children || $[17] !== max || $[18] !== min || $[19] !== rest ? (t9 = /* @__PURE__ */ jsxRuntime.jsx(Element2, { "data-ui": "ElementQuery", ...rest, "data-eq-max": max, "data-eq-min": min, ref: setElement, children }), $[15] = Element2, $[16] = children, $[17] = max, $[18] = min, $[19] = rest, $[20] = t9) : t9 = $[20], t9;
4230
- }
4231
- class ErrorBoundary extends react.Component {
4232
- state = {
4233
- error: null
4234
- };
4235
- static displayName = "ErrorBoundary";
4236
- static getDerivedStateFromError(error) {
4237
- return {
4238
- error
4239
- };
4240
- }
4241
- componentDidCatch(error, info) {
4242
- this.props.onCatch({
4243
- error,
4244
- info
4245
- });
4246
- }
4247
- render() {
4248
- const {
4249
- error
4250
- } = this.state;
4251
- if (error) {
4252
- const message = typeof error?.message == "string" ? error.message : "Error";
4253
- return /* @__PURE__ */ jsxRuntime.jsx(Code, { children: message });
4254
- }
4255
- return this.props.children;
4256
- }
4257
- }
4258
- function PortalProvider(props) {
4259
- const $ = compilerRuntime.c(9), {
4260
- children,
4261
- element,
4262
- __unstable_elements: elementsProp
4263
- } = props, elements = useUnique(elementsProp), parentPortal = react.useContext(PortalContext);
4264
- let t0;
4265
- $[0] !== elements || $[1] !== parentPortal ? (t0 = () => elements?.default ?? (parentPortal.element || document.body), $[0] = elements, $[1] = parentPortal, $[2] = t0) : t0 = $[2];
4266
- const fallbackElement = react.useSyncExternalStore(emptySubscribe, t0, _temp);
4267
- let t1;
4268
- const t2 = element || fallbackElement;
4269
- let t3;
4270
- $[3] !== elements || $[4] !== t2 ? (t3 = {
4271
- version: 0,
4272
- boundaryElement: null,
4273
- element: t2,
4274
- elements
4275
- }, $[3] = elements, $[4] = t2, $[5] = t3) : t3 = $[5], t1 = t3;
4276
- const value = t1;
4277
- let t4;
4278
- return $[6] !== children || $[7] !== value ? (t4 = /* @__PURE__ */ jsxRuntime.jsx(PortalContext.Provider, { value, children }), $[6] = children, $[7] = value, $[8] = t4) : t4 = $[8], t4;
4279
- }
4280
- function _temp() {
4281
- return null;
4282
- }
4283
- const emptySubscribe = () => () => {
4284
- };
4285
- function useUnique(value) {
4286
- const valueRef = react.useRef(value);
4287
- return _isEqual(valueRef.current, value) || (valueRef.current = value), valueRef.current;
4288
- }
4289
- function _isEqual(objA, objB) {
4290
- if (!objA || !objB)
4291
- return objA === objB;
4292
- const keysA = Object.keys(objA), keysB = Object.keys(objB);
4293
- return keysA.length !== keysB.length ? !1 : keysA.every((key2) => objA[key2] === objB[key2]);
4294
- }
4295
- function RootProvider(props) {
4296
- const $ = compilerRuntime.c(10), {
4297
- boundaryElement: t0,
4298
- children,
4299
- portalElement: t1,
4300
- scheme: t2,
4301
- tone: t3
4302
- } = props, boundaryElement = t0 === void 0 ? null : t0, portalElement = t1 === void 0 ? null : t1, scheme = t2 === void 0 ? "light" : t2, tone = t3 === void 0 ? "transparent" : t3;
4303
- let t4;
4304
- $[0] !== children || $[1] !== portalElement ? (t4 = /* @__PURE__ */ jsxRuntime.jsx(PortalProvider, { element: portalElement, children }), $[0] = children, $[1] = portalElement, $[2] = t4) : t4 = $[2];
4305
- let t5;
4306
- $[3] !== boundaryElement || $[4] !== t4 ? (t5 = /* @__PURE__ */ jsxRuntime.jsx(ToastProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(BoundaryElementProvider, { element: boundaryElement, children: t4 }) }), $[3] = boundaryElement, $[4] = t4, $[5] = t5) : t5 = $[5];
4307
- let t6;
4308
- return $[6] !== scheme || $[7] !== t5 || $[8] !== tone ? (t6 = /* @__PURE__ */ jsxRuntime.jsx(LayerProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(CardProvider, { scheme, tone, children: t5 }) }), $[6] = scheme, $[7] = t5, $[8] = tone, $[9] = t6) : t6 = $[9], t6;
4309
- }
4310
- const DEFAULT_ROOT_ELEMENT = "html";
4311
- function Root(props) {
4312
- const $ = compilerRuntime.c(35), t0 = props;
4313
- let children, className, forwardedRef, height, rest, t1, t2, t3, t4;
4314
- $[0] !== t0 ? ({
4315
- as: t1,
4316
- children,
4317
- className,
4318
- height,
4319
- overflow: t2,
4320
- ref: forwardedRef,
4321
- scheme: t3,
4322
- tone: t4,
4323
- ...rest
4324
- } = t0, $[0] = t0, $[1] = children, $[2] = className, $[3] = forwardedRef, $[4] = height, $[5] = rest, $[6] = t1, $[7] = t2, $[8] = t3, $[9] = t4) : (children = $[1], className = $[2], forwardedRef = $[3], height = $[4], rest = $[5], t1 = $[6], t2 = $[7], t3 = $[8], t4 = $[9]);
4325
- const as = t1 === void 0 ? DEFAULT_ROOT_ELEMENT : t1, overflow = t2 === void 0 ? "hidden" : t2, scheme = t3 === void 0 ? "light" : t3, tone = t4 === void 0 ? "default" : t4, ref = react.useRef(null);
4326
- let t5;
4327
- $[10] === Symbol.for("react.memo_cache_sentinel") ? (t5 = () => ref.current, $[10] = t5) : t5 = $[10], react.useImperativeHandle(forwardedRef, t5);
4328
- const [portalElement, setPortalElement] = react.useState(null), [boundaryElement, setBoundaryElement] = react.useState(null);
4329
- let t6;
4330
- $[11] === Symbol.for("react.memo_cache_sentinel") ? (t6 = (el) => {
4331
- setBoundaryElement(el), ref.current = el;
4332
- }, $[11] = t6) : t6 = $[11];
4333
- const handleRef = t6;
4334
- let t7;
4335
- $[12] === Symbol.for("react.memo_cache_sentinel") ? (t7 = /* @__PURE__ */ jsxRuntime.jsx("div", { "data-portal": "", ref: setPortalElement }), $[12] = t7) : t7 = $[12];
4336
- let t8;
4337
- $[13] !== boundaryElement || $[14] !== children || $[15] !== portalElement || $[16] !== scheme || $[17] !== tone ? (t8 = /* @__PURE__ */ jsxRuntime.jsxs(RootProvider, { boundaryElement, portalElement, scheme, tone, children: [
4338
- children,
4339
- t7
4340
- ] }), $[13] = boundaryElement, $[14] = children, $[15] = portalElement, $[16] = scheme, $[17] = tone, $[18] = t8) : t8 = $[18];
4341
- let node = t8;
4342
- if (as === "html") {
4343
- let t92;
4344
- $[19] !== height ? (t92 = css.box({
4345
- height,
4346
- margin: 0
4347
- }), $[19] = height, $[20] = t92) : t92 = $[20];
4348
- let t102;
4349
- $[21] !== node || $[22] !== t92 ? (t102 = /* @__PURE__ */ jsxRuntime.jsx("body", { className: t92, children: node }), $[21] = node, $[22] = t92, $[23] = t102) : t102 = $[23], node = t102;
4350
- }
4351
- let t9;
4352
- $[24] !== className || $[25] !== height || $[26] !== scheme || $[27] !== tone ? (t9 = css.root({
4353
- className,
4354
- height,
4355
- scheme,
4356
- tone
4357
- }), $[24] = className, $[25] = height, $[26] = scheme, $[27] = tone, $[28] = t9) : t9 = $[28];
4358
- let t10;
4359
- return $[29] !== as || $[30] !== node || $[31] !== overflow || $[32] !== rest || $[33] !== t9 ? (t10 = /* @__PURE__ */ jsxRuntime.jsx(Box, { as, "data-ui": "Root", ...rest, className: t9, overflow, ref: handleRef, children: node }), $[29] = as, $[30] = node, $[31] = overflow, $[32] = rest, $[33] = t9, $[34] = t10) : t10 = $[34], t10;
4360
- }
4361
- exports.Arrow = Arrow;
4362
- exports.Autocomplete = Autocomplete;
4363
- exports.Avatar = Avatar;
4364
- exports.AvatarCounter = AvatarCounter;
4365
- exports.AvatarStack = AvatarStack;
4366
- exports.Badge = Badge;
4367
- exports.BoundaryElementProvider = BoundaryElementProvider;
4368
- exports.Box = Box;
4369
- exports.Breadcrumbs = Breadcrumbs;
4370
- exports.Button = Button;
4371
- exports.Card = Card;
4372
- exports.CardProvider = CardProvider;
4373
- exports.Checkbox = Checkbox;
4374
- exports.Code = Code;
4375
- exports.CodeSkeleton = CodeSkeleton;
4376
- exports.Container = Container;
4377
- exports.DEFAULT_ARROW_ELEMENT = DEFAULT_ARROW_ELEMENT;
4378
- exports.DEFAULT_AUTOCOMPLETE_ELEMENT = DEFAULT_AUTOCOMPLETE_ELEMENT;
4379
- exports.DEFAULT_AVATAR_COUNTER_ELEMENT = DEFAULT_AVATAR_COUNTER_ELEMENT;
4380
- exports.DEFAULT_AVATAR_ELEMENT = DEFAULT_AVATAR_ELEMENT;
4381
- exports.DEFAULT_AVATAR_STACK_ELEMENT = DEFAULT_AVATAR_STACK_ELEMENT;
4382
- exports.DEFAULT_BADGE_ELEMENT = DEFAULT_BADGE_ELEMENT;
4383
- exports.DEFAULT_BOX_ELEMENT = DEFAULT_BOX_ELEMENT;
4384
- exports.DEFAULT_BREADCRUMBS_ELEMENT = DEFAULT_BREADCRUMBS_ELEMENT;
4385
- exports.DEFAULT_BUTTON_ELEMENT = DEFAULT_BUTTON_ELEMENT;
4386
- exports.DEFAULT_CARD_ELEMENT = DEFAULT_CARD_ELEMENT;
4387
- exports.DEFAULT_CHECKBOX_ELEMENT = DEFAULT_CHECKBOX_ELEMENT;
4388
- exports.DEFAULT_CODE_ELEMENT = DEFAULT_CODE_ELEMENT;
4389
- exports.DEFAULT_CODE_SKELETON_ELEMENT = DEFAULT_CODE_SKELETON_ELEMENT;
4390
- exports.DEFAULT_CONTAINER_ELEMENT = DEFAULT_CONTAINER_ELEMENT;
4391
- exports.DEFAULT_DIALOG_ELEMENT = DEFAULT_DIALOG_ELEMENT;
4392
- exports.DEFAULT_ELEMENT_QUERY_ELEMENT = DEFAULT_ELEMENT_QUERY_ELEMENT;
4393
- exports.DEFAULT_FLEX_ELEMENT = DEFAULT_FLEX_ELEMENT;
4394
- exports.DEFAULT_GRID_ELEMENT = DEFAULT_GRID_ELEMENT;
4395
- exports.DEFAULT_HEADING_ELEMENT = DEFAULT_HEADING_ELEMENT;
4396
- exports.DEFAULT_HEADING_SKELETON_ELEMENT = DEFAULT_HEADING_SKELETON_ELEMENT;
4397
- exports.DEFAULT_HOTKEYS_ELEMENT = DEFAULT_HOTKEYS_ELEMENT;
4398
- exports.DEFAULT_INLINE_ELEMENT = DEFAULT_INLINE_ELEMENT;
4399
- exports.DEFAULT_KBD_ELEMENT = DEFAULT_KBD_ELEMENT;
4400
- exports.DEFAULT_LABEL_ELEMENT = DEFAULT_LABEL_ELEMENT;
4401
- exports.DEFAULT_LABEL_SKELETON_ELEMENT = DEFAULT_LABEL_SKELETON_ELEMENT;
4402
- exports.DEFAULT_LAYER_ELEMENT = DEFAULT_LAYER_ELEMENT;
4403
- exports.DEFAULT_MENU_DIVIDER_ELEMENT = DEFAULT_MENU_DIVIDER_ELEMENT;
4404
- exports.DEFAULT_MENU_ELEMENT = DEFAULT_MENU_ELEMENT;
4405
- exports.DEFAULT_MENU_GROUP_ELEMENT = DEFAULT_MENU_GROUP_ELEMENT;
4406
- exports.DEFAULT_MENU_ITEM_ELEMENT = DEFAULT_MENU_ITEM_ELEMENT;
4407
- exports.DEFAULT_POPOVER_ELEMENT = DEFAULT_POPOVER_ELEMENT;
4408
- exports.DEFAULT_RADIO_ELEMENT = DEFAULT_RADIO_ELEMENT;
4409
- exports.DEFAULT_ROOT_ELEMENT = DEFAULT_ROOT_ELEMENT;
4410
- exports.DEFAULT_SELECTABLE_ELEMENT = DEFAULT_SELECTABLE_ELEMENT;
4411
- exports.DEFAULT_SELECT_ELEMENT = DEFAULT_SELECT_ELEMENT;
4412
- exports.DEFAULT_SKELETON_ELEMENT = DEFAULT_SKELETON_ELEMENT;
4413
- exports.DEFAULT_SPINNER_ELEMENT = DEFAULT_SPINNER_ELEMENT;
4414
- exports.DEFAULT_SR_ONLY_ELEMENT = DEFAULT_SR_ONLY_ELEMENT;
4415
- exports.DEFAULT_STACK_ELEMENT = DEFAULT_STACK_ELEMENT;
4416
- exports.DEFAULT_SWITCH_ELEMENT = DEFAULT_SWITCH_ELEMENT;
4417
- exports.DEFAULT_TAB_ELEMENT = DEFAULT_TAB_ELEMENT;
4418
- exports.DEFAULT_TAB_LIST_ELEMENT = DEFAULT_TAB_LIST_ELEMENT;
4419
- exports.DEFAULT_TAB_PANEL_ELEMENT = DEFAULT_TAB_PANEL_ELEMENT;
4420
- exports.DEFAULT_TEXT_AREA_ELEMENT = DEFAULT_TEXT_AREA_ELEMENT;
4421
- exports.DEFAULT_TEXT_ELEMENT = DEFAULT_TEXT_ELEMENT;
4422
- exports.DEFAULT_TEXT_INPUT_ELEMENT = DEFAULT_TEXT_INPUT_ELEMENT;
4423
- exports.DEFAULT_TEXT_SKELETON_ELEMENT = DEFAULT_TEXT_SKELETON_ELEMENT;
4424
- exports.DEFAULT_TOAST_ELEMENT = DEFAULT_TOAST_ELEMENT;
4425
- exports.DEFAULT_TOOLTIP_ELEMENT = DEFAULT_TOOLTIP_ELEMENT;
4426
- exports.DEFAULT_TREE_ELEMENT = DEFAULT_TREE_ELEMENT;
4427
- exports.DEFAULT_TREE_ITEM_ELEMENT = DEFAULT_TREE_ITEM_ELEMENT;
4428
- exports.DEFAULT_VIRTUAL_LIST_ELEMENT = DEFAULT_VIRTUAL_LIST_ELEMENT;
4429
- exports.Dialog = Dialog;
4430
- exports.DialogContext = DialogContext;
4431
- exports.DialogProvider = DialogProvider;
4432
- exports.ElementQuery = ElementQuery;
4433
- exports.ErrorBoundary = ErrorBoundary;
4434
- exports.Flex = Flex;
4435
- exports.Grid = Grid;
4436
- exports.Heading = Heading;
4437
- exports.HeadingSkeleton = HeadingSkeleton;
4438
- exports.Hotkeys = Hotkeys;
4439
- exports.Inline = Inline;
4440
- exports.KBD = KBD;
4441
- exports.Label = Label;
4442
- exports.LabelSkeleton = LabelSkeleton;
4443
- exports.Layer = Layer;
4444
- exports.LayerProvider = LayerProvider;
4445
- exports.Menu = Menu;
4446
- exports.MenuButton = MenuButton;
4447
- exports.MenuDivider = MenuDivider;
4448
- exports.MenuGroup = MenuGroup;
4449
- exports.MenuItem = MenuItem;
4450
- exports.Popover = Popover;
4451
- exports.Portal = Portal;
4452
- exports.PortalProvider = PortalProvider;
4453
- exports.Radio = Radio;
4454
- exports.Root = Root;
4455
- exports.RootProvider = RootProvider;
4456
- exports.Select = Select;
4457
- exports.Selectable = Selectable;
4458
- exports.Skeleton = Skeleton;
4459
- exports.Spinner = Spinner;
4460
- exports.SrOnly = SrOnly;
4461
- exports.Stack = Stack;
4462
- exports.Switch = Switch;
4463
- exports.Tab = Tab;
4464
- exports.TabList = TabList;
4465
- exports.TabPanel = TabPanel;
4466
- exports.Text = Text;
4467
- exports.TextArea = TextArea;
4468
- exports.TextInput = TextInput;
4469
- exports.TextSkeleton = TextSkeleton;
4470
- exports.Toast = Toast;
4471
- exports.ToastProvider = ToastProvider;
4472
- exports.Tooltip = Tooltip;
4473
- exports.TooltipDelayGroupContext = TooltipDelayGroupContext;
4474
- exports.TooltipDelayGroupProvider = TooltipDelayGroupProvider;
4475
- exports.Tree = Tree;
4476
- exports.TreeItem = TreeItem;
4477
- exports.VirtualList = VirtualList;
4478
- exports._ResizeObserver = _ResizeObserver;
4479
- exports._elementSizeObserver = _elementSizeObserver;
4480
- exports._getArrayProp = _getArrayProp;
4481
- exports._getResponsiveProp = _getResponsiveProp;
4482
- exports._hasFocus = _hasFocus;
4483
- exports._isEnterToClickElement = _isEnterToClickElement;
4484
- exports._isScrollable = _isScrollable;
4485
- exports._raf = _raf;
4486
- exports._raf2 = _raf2;
4487
- exports.attemptFocus = attemptFocus;
4488
- exports.containsOrEqualsElement = containsOrEqualsElement;
4489
- exports.focusFirstDescendant = focusFirstDescendant;
4490
- exports.focusLastDescendant = focusLastDescendant;
4491
- exports.isFocusable = isFocusable;
4492
- exports.isHTMLAnchorElement = isHTMLAnchorElement;
4493
- exports.isHTMLButtonElement = isHTMLButtonElement;
4494
- exports.isHTMLElement = isHTMLElement;
4495
- exports.isHTMLInputElement = isHTMLInputElement;
4496
- exports.isHTMLSelectElement = isHTMLSelectElement;
4497
- exports.isHTMLTextAreaElement = isHTMLTextAreaElement;
4498
- exports.useBoundaryElement = useBoundaryElement;
4499
- exports.useCard = useCard;
4500
- exports.useClickOutsideEvent = useClickOutsideEvent;
4501
- exports.useCustomValidity = useCustomValidity;
4502
- exports.useDialog = useDialog;
4503
- exports.useElementSize = useElementSize;
4504
- exports.useGlobalKeyDown = useGlobalKeyDown;
4505
- exports.useLayer = useLayer;
4506
- exports.useMatchMedia = useMatchMedia;
4507
- exports.useMediaIndex = useMediaIndex;
4508
- exports.usePortal = usePortal;
4509
- exports.usePrefersDark = usePrefersDark;
4510
- exports.usePrefersReducedMotion = usePrefersReducedMotion;
4511
- exports.useResponsiveProp = useResponsiveProp;
4512
- exports.useToast = useToast;
4513
- exports.useTooltipDelayGroup = useTooltipDelayGroup;
4514
- exports.useTree = useTree;
4515
- //# sourceMappingURL=index.cjs.map