@sanity/ui 4.0.0-next.4 → 4.0.0-next.5

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 (97) hide show
  1. package/README.md +4 -0
  2. package/dist/_system-CTe2lb5l.d.ts +40 -0
  3. package/dist/_system-CTe2lb5l.d.ts.map +1 -0
  4. package/dist/arrow-BG0EMNiC.js +159 -0
  5. package/dist/arrow-BG0EMNiC.js.map +1 -0
  6. package/dist/autocomplete.d.ts +140 -0
  7. package/dist/autocomplete.d.ts.map +1 -0
  8. package/dist/autocomplete.js +468 -0
  9. package/dist/autocomplete.js.map +1 -0
  10. package/dist/breadcrumbs.d.ts +18 -0
  11. package/dist/breadcrumbs.d.ts.map +1 -0
  12. package/dist/breadcrumbs.js +112 -0
  13. package/dist/breadcrumbs.js.map +1 -0
  14. package/dist/button-BzoZs3Sl.d.ts +76 -0
  15. package/dist/button-BzoZs3Sl.d.ts.map +1 -0
  16. package/dist/button-DZkAQOL2.js +174 -0
  17. package/dist/button-DZkAQOL2.js.map +1 -0
  18. package/dist/card-C0a0wQTc.d.ts +7 -0
  19. package/dist/card-C0a0wQTc.d.ts.map +1 -0
  20. package/dist/code.d.ts +20 -0
  21. package/dist/code.d.ts.map +1 -0
  22. package/dist/code.js +85 -0
  23. package/dist/code.js.map +1 -0
  24. package/dist/codeFontStyle-DYUujk7K.js +11 -0
  25. package/dist/codeFontStyle-DYUujk7K.js.map +1 -0
  26. package/dist/component-DVlwaWB-.d.ts +25 -0
  27. package/dist/component-DVlwaWB-.d.ts.map +1 -0
  28. package/dist/element-BYgCE_iK.js +51 -0
  29. package/dist/element-BYgCE_iK.js.map +1 -0
  30. package/dist/{getScopedTheme-CqaSCfTH.js → factory-CvRcEQ36.js} +6 -753
  31. package/dist/factory-CvRcEQ36.js.map +1 -0
  32. package/dist/flex-BYRpBTOc.js +69 -0
  33. package/dist/flex-BYRpBTOc.js.map +1 -0
  34. package/dist/font-EtfxKPUz.d.ts +49 -0
  35. package/dist/font-EtfxKPUz.d.ts.map +1 -0
  36. package/dist/getElementRef-5HZQ-Owu.js +91 -0
  37. package/dist/getElementRef-5HZQ-Owu.js.map +1 -0
  38. package/dist/getScopedTheme-C-sZsyAz.js +267 -0
  39. package/dist/getScopedTheme-C-sZsyAz.js.map +1 -0
  40. package/dist/getTheme_v2-y09KqtEb.js +487 -0
  41. package/dist/getTheme_v2-y09KqtEb.js.map +1 -0
  42. package/dist/grid-D88j-N7f.js +108 -0
  43. package/dist/grid-D88j-N7f.js.map +1 -0
  44. package/dist/helpers-bwfx1e-Y.js +67 -0
  45. package/dist/helpers-bwfx1e-Y.js.map +1 -0
  46. package/dist/hotkeys-B08HIKNu.js +145 -0
  47. package/dist/hotkeys-B08HIKNu.js.map +1 -0
  48. package/dist/index.d.ts +112 -896
  49. package/dist/index.d.ts.map +1 -1
  50. package/dist/index.js +93 -4409
  51. package/dist/index.js.map +1 -1
  52. package/dist/layer-BQfdK7rt.d.ts +242 -0
  53. package/dist/layer-BQfdK7rt.d.ts.map +1 -0
  54. package/dist/layer-BdkSGATt.js +56 -0
  55. package/dist/layer-BdkSGATt.js.map +1 -0
  56. package/dist/menu.d.ts +146 -0
  57. package/dist/menu.d.ts.map +1 -0
  58. package/dist/menu.js +602 -0
  59. package/dist/menu.js.map +1 -0
  60. package/dist/popover-DmmmSNzL.d.ts +96 -0
  61. package/dist/popover-DmmmSNzL.d.ts.map +1 -0
  62. package/dist/popover-Iy6EZEmv.js +406 -0
  63. package/dist/popover-Iy6EZEmv.js.map +1 -0
  64. package/dist/popover.d.ts +2 -0
  65. package/dist/popover.js +3 -0
  66. package/dist/responsiveFont-hN1mZFjm.js +55 -0
  67. package/dist/responsiveFont-hN1mZFjm.js.map +1 -0
  68. package/dist/{rgba-LmTDhX0u.d.ts → rgba-BSYaEUW6.d.ts} +4 -87
  69. package/dist/rgba-BSYaEUW6.d.ts.map +1 -0
  70. package/dist/selectable-B0GUIL74.d.ts +7 -0
  71. package/dist/selectable-B0GUIL74.d.ts.map +1 -0
  72. package/dist/stack-C5WV-BRh.js +98 -0
  73. package/dist/stack-C5WV-BRh.js.map +1 -0
  74. package/dist/styles.css +1 -0
  75. package/dist/textInput-IbiDH7Jc.js +315 -0
  76. package/dist/textInput-IbiDH7Jc.js.map +1 -0
  77. package/dist/theme.d.ts +3 -1
  78. package/dist/theme.d.ts.map +1 -1
  79. package/dist/theme.js +3 -1
  80. package/dist/theme.js.map +1 -1
  81. package/dist/toast.d.ts +73 -0
  82. package/dist/toast.d.ts.map +1 -0
  83. package/dist/toast.js +297 -0
  84. package/dist/toast.js.map +1 -0
  85. package/dist/tooltip.d.ts +88 -0
  86. package/dist/tooltip.d.ts.map +1 -0
  87. package/dist/tooltip.js +432 -0
  88. package/dist/tooltip.js.map +1 -0
  89. package/dist/useClickOutsideEvent-lEVhDFCQ.js +36 -0
  90. package/dist/useClickOutsideEvent-lEVhDFCQ.js.map +1 -0
  91. package/dist/useElementSize-BJvbGHq8.js +51 -0
  92. package/dist/useElementSize-BJvbGHq8.js.map +1 -0
  93. package/dist/useLayer-9Pz-GG0r.js +704 -0
  94. package/dist/useLayer-9Pz-GG0r.js.map +1 -0
  95. package/package.json +15 -3
  96. package/dist/getScopedTheme-CqaSCfTH.js.map +0 -1
  97. package/dist/rgba-LmTDhX0u.d.ts.map +0 -1
package/dist/index.js CHANGED
@@ -1,18 +1,28 @@
1
1
  "use client";
2
- import { a as createColorTheme$1, c as multiply$1, d as hexToRgb$1, f as hslToRgb$1, i as getTheme_v2, l as rgba$1, m as rgbToHsl$1, o as buildTheme, p as rgbToHex$1, s as screen$1, t as getScopedTheme, u as parseColor$1 } from "./getScopedTheme-CqaSCfTH.js";
2
+ import { a as rem, i as _responsive, n as _getArrayProp, r as _getResponsiveSpace, s as EMPTY_RECORD, t as _fillCSSObject } from "./helpers-bwfx1e-Y.js";
3
+ import { a as textInputRootStyle, c as useCustomValidity, d as focusFirstDescendant, f as focusLastDescendant, h as _raf2, i as textInputRepresentationStyle, l as _hasFocus, m as _raf, n as textInputBaseStyle, o as responsiveInputPaddingIconRightStyle, p as isFocusable, r as textInputFontSizeStyle, s as responsiveInputPaddingStyle, t as TextInput, u as attemptFocus } from "./textInput-IbiDH7Jc.js";
4
+ import { a as isHTMLElement, c as isHTMLTextAreaElement, i as isHTMLButtonElement, n as containsOrEqualsElement, o as isHTMLInputElement, r as isHTMLAnchorElement, s as isHTMLSelectElement, t as _isEnterToClickElement } from "./element-BYgCE_iK.js";
5
+ import { t as getTheme_v2 } from "./getTheme_v2-y09KqtEb.js";
6
+ import { _ as useTheme_v2, a as useMatchMedia, b as responsivePaddingStyle, c as ThemeColorProvider, d as createGlobalScopedContext, g as useTheme, h as _cardColorStyle, i as usePrefersReducedMotion, l as useRootTheme, m as focusRingStyle, n as LayerProvider, o as useMediaIndex, p as focusRingBorderStyle, s as Card, t as useLayer, u as ThemeProvider, v as responsiveRadiusStyle, y as Box } from "./useLayer-9Pz-GG0r.js";
7
+ import { t as Flex } from "./flex-BYRpBTOc.js";
8
+ import { a as responsiveTextAlignStyle, i as responsiveTextFont, n as Text, r as SpanWithTextOverflow, t as Stack } from "./stack-C5WV-BRh.js";
9
+ import { t as responsiveFont } from "./responsiveFont-hN1mZFjm.js";
10
+ import { n as Spinner, t as Button } from "./button-DZkAQOL2.js";
11
+ import { n as _elementSizeObserver, t as useElementSize } from "./useElementSize-BJvbGHq8.js";
12
+ import { a as useBoundaryElement, i as PortalContext, n as Portal, o as BoundaryElementContext, r as usePortal, t as Arrow } from "./arrow-BG0EMNiC.js";
13
+ import { t as useClickOutsideEvent } from "./useClickOutsideEvent-lEVhDFCQ.js";
14
+ import { t as responsiveCodeFontStyle } from "./codeFontStyle-DYUujk7K.js";
15
+ import { a as rgba$1, c as hslToRgb$1, i as multiply$1, l as rgbToHex$1, n as buildTheme, o as parseColor$1, r as screen$1, s as hexToRgb$1, t as createColorTheme$1, u as rgbToHsl$1 } from "./factory-CvRcEQ36.js";
16
+ import { i as useGlobalKeyDown, n as KBD, r as Inline, t as Hotkeys } from "./hotkeys-B08HIKNu.js";
17
+ import { t as Layer } from "./layer-BdkSGATt.js";
18
+ import { t as Grid } from "./grid-D88j-N7f.js";
3
19
  import { c } from "react/compiler-runtime";
4
20
  import { ChevronDownIcon } from "@sanity/icons/ChevronDown";
5
- import { Activity, Children, Component, Fragment, Suspense, cloneElement, createContext, isValidElement, lazy, startTransition, useContext, useDebugValue, useEffect, useId, useImperativeHandle, useLayoutEffect, useReducer, useRef, useState, useSyncExternalStore } from "react";
6
- import { ThemeProvider as ThemeProvider$1, css, keyframes, styled, useTheme as useTheme$1 } from "styled-components";
21
+ import { Children, Component, cloneElement, isValidElement, startTransition, useContext, useEffect, useId, useImperativeHandle, useRef, useState, useSyncExternalStore } from "react";
22
+ import { css, keyframes, styled } from "styled-components";
7
23
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
8
- import ReactIs, { isValidElementType } from "react-is";
9
- import { SpinnerIcon } from "@sanity/icons/Spinner";
10
- import { arrow, autoPlacement, autoUpdate, detectOverflow, flip, hide, offset, shift, useFloating } from "@floating-ui/react-dom";
11
- import { AnimatePresence, PresenceChild, invariant, motion, stagger } from "motion/react";
12
- import { createPortal } from "react-dom";
24
+ import ReactIs from "react-is";
13
25
  import { CloseIcon } from "@sanity/icons/Close";
14
- import { useEffectEvent } from "use-effect-event";
15
- import { ChevronRightIcon } from "@sanity/icons/ChevronRight";
16
26
  import { ToggleArrowRightIcon } from "@sanity/icons/ToggleArrowRight";
17
27
  import { CheckmarkIcon } from "@sanity/icons/Checkmark";
18
28
  import { RemoveIcon } from "@sanity/icons/Remove";
@@ -20,2721 +30,7 @@ import { RemoveIcon } from "@sanity/icons/Remove";
20
30
  * @public
21
31
  * @deprecated Use `createColorTheme` from `@sanity/ui/theme` instead.
22
32
  */
23
- const createColorTheme = createColorTheme$1, hexToRgb = hexToRgb$1, hslToRgb = hslToRgb$1, multiply = multiply$1, parseColor = parseColor$1, rgbToHex = rgbToHex$1, rgbToHsl = rgbToHsl$1, rgba = rgba$1, screen = screen$1, studioTheme = buildTheme(), EMPTY_ARRAY = [], EMPTY_RECORD = {}, POPOVER_MOTION_DURATION = .2, POPOVER_MOTION_PROPS = {
24
- card: {
25
- initial: {
26
- scale: .97,
27
- willChange: "transform"
28
- },
29
- hidden: { opacity: 0 },
30
- visible: {
31
- opacity: 1,
32
- transition: {
33
- when: "beforeChildren",
34
- duration: POPOVER_MOTION_DURATION / 2
35
- }
36
- },
37
- scaleIn: { scale: 1 },
38
- scaleOut: { scale: .97 }
39
- },
40
- children: {
41
- hidden: { opacity: 0 },
42
- visible: { opacity: 1 }
43
- },
44
- transition: {
45
- type: "spring",
46
- visualDuration: POPOVER_MOTION_DURATION,
47
- bounce: .25
48
- }
49
- };
50
- /**
51
- * @internal
52
- */
53
- function _raf(fn) {
54
- let frameId = requestAnimationFrame(fn);
55
- return () => {
56
- cancelAnimationFrame(frameId);
57
- };
58
- }
59
- /**
60
- * @internal
61
- */
62
- function _raf2(fn) {
63
- let innerDispose = null, outerDispose = _raf(() => {
64
- innerDispose = _raf(fn);
65
- });
66
- return () => {
67
- innerDispose && innerDispose(), outerDispose();
68
- };
69
- }
70
- /**
71
- * @internal
72
- */
73
- function _isEnterToClickElement(element) {
74
- return isHTMLAnchorElement(element) || isHTMLButtonElement(element);
75
- }
76
- /**
77
- * @internal
78
- */
79
- function isHTMLElement(node) {
80
- return node instanceof Node && node.nodeType === Node.ELEMENT_NODE;
81
- }
82
- /**
83
- * @internal
84
- */
85
- function isHTMLAnchorElement(element) {
86
- return isHTMLElement(element) && element.nodeName === "A";
87
- }
88
- /**
89
- * @internal
90
- */
91
- function isHTMLInputElement(element) {
92
- return isHTMLElement(element) && element.nodeName === "INPUT";
93
- }
94
- /**
95
- * @internal
96
- */
97
- function isHTMLButtonElement(element) {
98
- return isHTMLElement(element) && element.nodeName === "BUTTON";
99
- }
100
- /**
101
- * @internal
102
- */
103
- function isHTMLSelectElement(element) {
104
- return isHTMLElement(element) && element.nodeName === "SELECT";
105
- }
106
- /**
107
- * @internal
108
- */
109
- function isHTMLTextAreaElement(element) {
110
- return isHTMLElement(element) && element.nodeName === "TEXTAREA";
111
- }
112
- /**
113
- * @internal
114
- */
115
- function containsOrEqualsElement(element, node) {
116
- return element.contains(node) || element === node;
117
- }
118
- /**
119
- * @internal
120
- */
121
- function _hasFocus(element) {
122
- return !!document.activeElement && element.contains(document.activeElement);
123
- }
124
- /**
125
- * @internal
126
- */
127
- function isFocusable(element) {
128
- 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;
129
- }
130
- /**
131
- * @internal
132
- */
133
- function attemptFocus(element) {
134
- if (!isFocusable(element)) return !1;
135
- try {
136
- element.focus();
137
- } catch {}
138
- return document.activeElement === element;
139
- }
140
- /**
141
- * @internal
142
- */
143
- function focusFirstDescendant(element) {
144
- for (let i = 0; i < element.childNodes.length; i++) {
145
- let child = element.childNodes[i];
146
- if (isHTMLElement(child) && (attemptFocus(child) || focusFirstDescendant(child))) return !0;
147
- }
148
- return !1;
149
- }
150
- /**
151
- * @internal
152
- */
153
- function focusLastDescendant(element) {
154
- for (let i = element.childNodes.length - 1; i >= 0; i--) {
155
- let child = element.childNodes[i];
156
- if (isHTMLElement(child) && (attemptFocus(child) || focusLastDescendant(child))) return !0;
157
- }
158
- return !1;
159
- }
160
- /**
161
- * @internal
162
- */
163
- function _fillCSSObject(keys, value) {
164
- return keys.reduce((style, key) => (style[key] = value, style), {});
165
- }
166
- /**
167
- * @public
168
- */
169
- function rem(pixelValue) {
170
- return pixelValue === 0 ? 0 : `${pixelValue / 16}rem`;
171
- }
172
- /**
173
- * @internal
174
- */
175
- function _responsive(media, values, callback) {
176
- return (values?.map(callback) || []).map((statement, mediaIndex) => mediaIndex === 0 ? statement : { [`@media screen and (min-width: ${media[mediaIndex - 1]}px)`]: statement });
177
- }
178
- /**
179
- * @internal
180
- */
181
- function _getArrayProp(val, defaultVal) {
182
- return val === void 0 ? defaultVal || EMPTY_ARRAY : Array.isArray(val) ? val : [val];
183
- }
184
- /**
185
- * @internal
186
- */
187
- function _getResponsiveSpace(theme, props, spaceIndexes = EMPTY_ARRAY) {
188
- if (!Array.isArray(spaceIndexes)) throw Error("the property must be array of numbers");
189
- if (spaceIndexes.length === 0) return null;
190
- let { media, space } = getTheme_v2(theme);
191
- return _responsive(media, spaceIndexes, (spaceIndex) => _fillCSSObject(props, rem(space[spaceIndex])));
192
- }
193
- const BASE_STYLE$4 = { "&[data-as=\"ul\"],&[data-as=\"ol\"]": { listStyle: "none" } }, BOX_SIZING = {
194
- content: "content-box",
195
- border: "border-box"
196
- }, BOX_HEIGHT = {
197
- stretch: "stretch",
198
- fill: "100%"
199
- };
200
- function boxStyle() {
201
- return BASE_STYLE$4;
202
- }
203
- function responsiveBoxStyle() {
204
- return [
205
- responsiveBoxSizingStyle,
206
- responsiveBoxHeightStyle,
207
- responsiveBoxOverflowStyle,
208
- responsiveBoxDisplayStyle
209
- ];
210
- }
211
- function responsiveBoxDisplayStyle(props) {
212
- let { media } = getTheme_v2(props.theme);
213
- return _responsive(media, props.$display, (display) => ({ "&:not([hidden])": { display } }));
214
- }
215
- function responsiveBoxSizingStyle(props) {
216
- let { media } = getTheme_v2(props.theme);
217
- return _responsive(media, props.$sizing, (sizing) => ({ boxSizing: BOX_SIZING[sizing] }));
218
- }
219
- function responsiveBoxHeightStyle(props) {
220
- let { media } = getTheme_v2(props.theme);
221
- return _responsive(media, props.$height, (height) => ({ height: BOX_HEIGHT[height] }));
222
- }
223
- function responsiveBoxOverflowStyle(props) {
224
- let { media } = getTheme_v2(props.theme);
225
- return _responsive(media, props.$overflow, (overflow) => ({ overflow }));
226
- }
227
- const BASE_STYLE$3 = {
228
- minWidth: 0,
229
- minHeight: 0
230
- };
231
- function flexItemStyle() {
232
- return [BASE_STYLE$3, responsiveFlexItemStyle];
233
- }
234
- function responsiveFlexItemStyle(props) {
235
- let { media } = getTheme_v2(props.theme);
236
- return props.$flex ? _responsive(media, props.$flex, (flex) => ({ flex: `${flex}` })) : EMPTY_ARRAY;
237
- }
238
- function responsiveGridItemStyle() {
239
- return [
240
- responsiveGridItemRowStyle,
241
- responsiveGridItemRowStartStyle,
242
- responsiveGridItemRowEndStyle,
243
- responsiveGridItemColumnStyle,
244
- responsiveGridItemColumnStartStyle,
245
- responsiveGridItemColumnEndStyle
246
- ];
247
- }
248
- const GRID_ITEM_ROW = {
249
- auto: "auto",
250
- full: "1 / -1"
251
- }, GRID_ITEM_COLUMN = {
252
- auto: "auto",
253
- full: "1 / -1"
254
- };
255
- function responsiveGridItemRowStyle(props) {
256
- let { media } = getTheme_v2(props.theme);
257
- return _responsive(media, props.$row, (row) => typeof row == "number" ? { gridRow: `span ${row} / span ${row}` } : { gridRow: GRID_ITEM_ROW[row] });
258
- }
259
- function responsiveGridItemRowStartStyle(props) {
260
- let { media } = getTheme_v2(props.theme);
261
- return _responsive(media, props.$rowStart, (rowStart) => ({ gridRowStart: `${rowStart}` }));
262
- }
263
- function responsiveGridItemRowEndStyle(props) {
264
- let { media } = getTheme_v2(props.theme);
265
- return _responsive(media, props.$rowEnd, (rowEnd) => ({ gridRowEnd: `${rowEnd}` }));
266
- }
267
- function responsiveGridItemColumnStyle(props) {
268
- let { media } = getTheme_v2(props.theme);
269
- return _responsive(media, props.$column, (column) => typeof column == "number" ? { gridColumn: `span ${column} / span ${column}` } : { gridColumn: GRID_ITEM_COLUMN[column] });
270
- }
271
- function responsiveGridItemColumnStartStyle(props) {
272
- let { media } = getTheme_v2(props.theme);
273
- return _responsive(media, props.$columnStart, (columnStart) => ({ gridColumnStart: `${columnStart}` }));
274
- }
275
- function responsiveGridItemColumnEndStyle(props) {
276
- let { media } = getTheme_v2(props.theme);
277
- return _responsive(media, props.$columnEnd, (columnEnd) => ({ gridColumnEnd: `${columnEnd}` }));
278
- }
279
- function responsiveMarginStyle(props) {
280
- let { theme } = props;
281
- return [
282
- _getResponsiveSpace(theme, ["margin"], props.$margin),
283
- _getResponsiveSpace(theme, ["marginLeft", "marginRight"], props.$marginX),
284
- _getResponsiveSpace(theme, ["marginTop", "marginBottom"], props.$marginY),
285
- _getResponsiveSpace(theme, ["marginTop"], props.$marginTop),
286
- _getResponsiveSpace(theme, ["marginRight"], props.$marginRight),
287
- _getResponsiveSpace(theme, ["marginBottom"], props.$marginBottom),
288
- _getResponsiveSpace(theme, ["marginLeft"], props.$marginLeft)
289
- ].filter(Boolean);
290
- }
291
- function responsivePaddingStyle(props) {
292
- let { theme } = props;
293
- return [
294
- _getResponsiveSpace(theme, ["padding"], props.$padding),
295
- _getResponsiveSpace(theme, ["paddingLeft", "paddingRight"], props.$paddingX),
296
- _getResponsiveSpace(theme, ["paddingTop", "paddingBottom"], props.$paddingY),
297
- _getResponsiveSpace(theme, ["paddingTop"], props.$paddingTop),
298
- _getResponsiveSpace(theme, ["paddingRight"], props.$paddingRight),
299
- _getResponsiveSpace(theme, ["paddingBottom"], props.$paddingBottom),
300
- _getResponsiveSpace(theme, ["paddingLeft"], props.$paddingLeft)
301
- ].filter(Boolean);
302
- }
303
- const StyledBox = /* @__PURE__ */ styled.div.withConfig({
304
- displayName: "StyledBox",
305
- componentId: "sc-w5d1un-0"
306
- })(boxStyle, flexItemStyle, responsiveBoxStyle, responsiveGridItemStyle, responsiveMarginStyle, responsivePaddingStyle), Box = function Box(props) {
307
- let $ = c(110), flex, gridColumn, gridColumnEnd, gridColumnStart, gridRow, gridRowEnd, gridRowStart, height, marginBottom, marginLeft, marginRight, marginTop, marginX, marginY, overflow, paddingBottom, paddingLeft, paddingRight, paddingTop, paddingX, paddingY, ref, restProps, sizing, t0, t1, t2, t3;
308
- $[0] === props ? (flex = $[1], gridColumn = $[2], gridColumnEnd = $[3], gridColumnStart = $[4], gridRow = $[5], gridRowEnd = $[6], gridRowStart = $[7], height = $[8], marginBottom = $[9], marginLeft = $[10], marginRight = $[11], marginTop = $[12], marginX = $[13], marginY = $[14], overflow = $[15], paddingBottom = $[16], paddingLeft = $[17], paddingRight = $[18], paddingTop = $[19], paddingX = $[20], paddingY = $[21], ref = $[22], restProps = $[23], sizing = $[24], t0 = $[25], t1 = $[26], t2 = $[27], t3 = $[28]) : ({as: t0, ref, gridColumn, gridColumnStart, gridColumnEnd, display: t1, flex, height, margin: t2, marginX, marginY, marginTop, marginRight, marginBottom, marginLeft, overflow, padding: t3, paddingX, paddingY, paddingTop, paddingRight, paddingBottom, paddingLeft, gridRow, gridRowStart, gridRowEnd, sizing, ...restProps} = props, $[0] = props, $[1] = flex, $[2] = gridColumn, $[3] = gridColumnEnd, $[4] = gridColumnStart, $[5] = gridRow, $[6] = gridRowEnd, $[7] = gridRowStart, $[8] = height, $[9] = marginBottom, $[10] = marginLeft, $[11] = marginRight, $[12] = marginTop, $[13] = marginX, $[14] = marginY, $[15] = overflow, $[16] = paddingBottom, $[17] = paddingLeft, $[18] = paddingRight, $[19] = paddingTop, $[20] = paddingX, $[21] = paddingY, $[22] = ref, $[23] = restProps, $[24] = sizing, $[25] = t0, $[26] = t1, $[27] = t2, $[28] = t3);
309
- let asProp = t0 === void 0 ? "div" : t0, display = t1 === void 0 ? "block" : t1, margin = t2 === void 0 ? 0 : t2, padding = t3 === void 0 ? 0 : t3, t4 = typeof asProp == "string" ? asProp : void 0, t5;
310
- $[29] === gridColumn ? t5 = $[30] : (t5 = _getArrayProp(gridColumn), $[29] = gridColumn, $[30] = t5);
311
- let t6;
312
- $[31] === gridColumnStart ? t6 = $[32] : (t6 = _getArrayProp(gridColumnStart), $[31] = gridColumnStart, $[32] = t6);
313
- let t7;
314
- $[33] === gridColumnEnd ? t7 = $[34] : (t7 = _getArrayProp(gridColumnEnd), $[33] = gridColumnEnd, $[34] = t7);
315
- let t8;
316
- $[35] === display ? t8 = $[36] : (t8 = _getArrayProp(display), $[35] = display, $[36] = t8);
317
- let t9;
318
- $[37] === flex ? t9 = $[38] : (t9 = _getArrayProp(flex), $[37] = flex, $[38] = t9);
319
- let t10;
320
- $[39] === height ? t10 = $[40] : (t10 = _getArrayProp(height), $[39] = height, $[40] = t10);
321
- let t11;
322
- $[41] === margin ? t11 = $[42] : (t11 = _getArrayProp(margin), $[41] = margin, $[42] = t11);
323
- let t12;
324
- $[43] === marginX ? t12 = $[44] : (t12 = _getArrayProp(marginX), $[43] = marginX, $[44] = t12);
325
- let t13;
326
- $[45] === marginY ? t13 = $[46] : (t13 = _getArrayProp(marginY), $[45] = marginY, $[46] = t13);
327
- let t14;
328
- $[47] === marginTop ? t14 = $[48] : (t14 = _getArrayProp(marginTop), $[47] = marginTop, $[48] = t14);
329
- let t15;
330
- $[49] === marginRight ? t15 = $[50] : (t15 = _getArrayProp(marginRight), $[49] = marginRight, $[50] = t15);
331
- let t16;
332
- $[51] === marginBottom ? t16 = $[52] : (t16 = _getArrayProp(marginBottom), $[51] = marginBottom, $[52] = t16);
333
- let t17;
334
- $[53] === marginLeft ? t17 = $[54] : (t17 = _getArrayProp(marginLeft), $[53] = marginLeft, $[54] = t17);
335
- let t18;
336
- $[55] === overflow ? t18 = $[56] : (t18 = _getArrayProp(overflow), $[55] = overflow, $[56] = t18);
337
- let t19;
338
- $[57] === padding ? t19 = $[58] : (t19 = _getArrayProp(padding), $[57] = padding, $[58] = t19);
339
- let t20;
340
- $[59] === paddingX ? t20 = $[60] : (t20 = _getArrayProp(paddingX), $[59] = paddingX, $[60] = t20);
341
- let t21;
342
- $[61] === paddingY ? t21 = $[62] : (t21 = _getArrayProp(paddingY), $[61] = paddingY, $[62] = t21);
343
- let t22;
344
- $[63] === paddingTop ? t22 = $[64] : (t22 = _getArrayProp(paddingTop), $[63] = paddingTop, $[64] = t22);
345
- let t23;
346
- $[65] === paddingRight ? t23 = $[66] : (t23 = _getArrayProp(paddingRight), $[65] = paddingRight, $[66] = t23);
347
- let t24;
348
- $[67] === paddingBottom ? t24 = $[68] : (t24 = _getArrayProp(paddingBottom), $[67] = paddingBottom, $[68] = t24);
349
- let t25;
350
- $[69] === paddingLeft ? t25 = $[70] : (t25 = _getArrayProp(paddingLeft), $[69] = paddingLeft, $[70] = t25);
351
- let t26;
352
- $[71] === gridRow ? t26 = $[72] : (t26 = _getArrayProp(gridRow), $[71] = gridRow, $[72] = t26);
353
- let t27;
354
- $[73] === gridRowStart ? t27 = $[74] : (t27 = _getArrayProp(gridRowStart), $[73] = gridRowStart, $[74] = t27);
355
- let t28;
356
- $[75] === gridRowEnd ? t28 = $[76] : (t28 = _getArrayProp(gridRowEnd), $[75] = gridRowEnd, $[76] = t28);
357
- let t29;
358
- $[77] === sizing ? t29 = $[78] : (t29 = _getArrayProp(sizing), $[77] = sizing, $[78] = t29);
359
- let t30;
360
- return $[79] !== asProp || $[80] !== props.children || $[81] !== ref || $[82] !== restProps || $[83] !== t10 || $[84] !== t11 || $[85] !== t12 || $[86] !== t13 || $[87] !== t14 || $[88] !== t15 || $[89] !== t16 || $[90] !== t17 || $[91] !== t18 || $[92] !== t19 || $[93] !== t20 || $[94] !== t21 || $[95] !== t22 || $[96] !== t23 || $[97] !== t24 || $[98] !== t25 || $[99] !== t26 || $[100] !== t27 || $[101] !== t28 || $[102] !== t29 || $[103] !== t4 || $[104] !== t5 || $[105] !== t6 || $[106] !== t7 || $[107] !== t8 || $[108] !== t9 ? (t30 = /* @__PURE__ */ jsx(StyledBox, {
361
- "data-as": t4,
362
- "data-ui": "Box",
363
- ...restProps,
364
- $column: t5,
365
- $columnStart: t6,
366
- $columnEnd: t7,
367
- $display: t8,
368
- $flex: t9,
369
- $height: t10,
370
- $margin: t11,
371
- $marginX: t12,
372
- $marginY: t13,
373
- $marginTop: t14,
374
- $marginRight: t15,
375
- $marginBottom: t16,
376
- $marginLeft: t17,
377
- $overflow: t18,
378
- $padding: t19,
379
- $paddingX: t20,
380
- $paddingY: t21,
381
- $paddingTop: t22,
382
- $paddingRight: t23,
383
- $paddingBottom: t24,
384
- $paddingLeft: t25,
385
- $row: t26,
386
- $rowStart: t27,
387
- $rowEnd: t28,
388
- $sizing: t29,
389
- as: asProp,
390
- ref,
391
- children: props.children
392
- }), $[79] = asProp, $[80] = props.children, $[81] = ref, $[82] = restProps, $[83] = t10, $[84] = t11, $[85] = t12, $[86] = t13, $[87] = t14, $[88] = t15, $[89] = t16, $[90] = t17, $[91] = t18, $[92] = t19, $[93] = t20, $[94] = t21, $[95] = t22, $[96] = t23, $[97] = t24, $[98] = t25, $[99] = t26, $[100] = t27, $[101] = t28, $[102] = t29, $[103] = t4, $[104] = t5, $[105] = t6, $[106] = t7, $[107] = t8, $[108] = t9, $[109] = t30) : t30 = $[109], t30;
393
- };
394
- function responsiveRadiusStyle(props) {
395
- let { media, radius } = getTheme_v2(props.theme);
396
- return _responsive(media, props.$radius, (value) => {
397
- let borderRadius = 0;
398
- return typeof value == "number" && (borderRadius = rem(radius[value])), value === "full" && (borderRadius = "9999px"), { borderRadius };
399
- });
400
- }
401
- /**
402
- * @public
403
- */
404
- function useTheme() {
405
- return useTheme$1();
406
- }
407
- /**
408
- * @public
409
- */
410
- function useTheme_v2() {
411
- let $ = c(2), t0 = useTheme$1(), t1;
412
- return $[0] === t0 ? t1 = $[1] : (t1 = getTheme_v2(t0), $[0] = t0, $[1] = t1), t1;
413
- }
414
- const BASE_STYLE$2 = { "&&:not([hidden])": { display: "flex" } };
415
- function responsiveFlexStyle() {
416
- return [
417
- BASE_STYLE$2,
418
- responsiveFlexAlignStyle,
419
- responsiveFlexGapStyle,
420
- responsiveFlexWrapStyle,
421
- responsiveFlexJustifyStyle,
422
- responsiveFlexDirectionStyle
423
- ];
424
- }
425
- function responsiveFlexAlignStyle(props) {
426
- let { media } = getTheme_v2(props.theme);
427
- return _responsive(media, props.$align, (align) => ({ alignItems: align }));
428
- }
429
- function responsiveFlexGapStyle(props) {
430
- let { media, space } = getTheme_v2(props.theme);
431
- return _responsive(media, props.$gap, (gap) => ({ gap: gap ? rem(space[gap]) : void 0 }));
432
- }
433
- function responsiveFlexWrapStyle(props) {
434
- let { media } = getTheme_v2(props.theme);
435
- return _responsive(media, props.$wrap, (wrap) => ({ flexWrap: wrap }));
436
- }
437
- function responsiveFlexJustifyStyle(props) {
438
- let { media } = getTheme_v2(props.theme);
439
- return _responsive(media, props.$justify, (justify) => ({ justifyContent: justify }));
440
- }
441
- function responsiveFlexDirectionStyle(props) {
442
- let { media } = getTheme_v2(props.theme);
443
- return _responsive(media, props.$direction, (direction) => ({ flexDirection: direction }));
444
- }
445
- const StyledFlex = /* @__PURE__ */ styled(Box).withConfig({
446
- displayName: "StyledFlex",
447
- componentId: "sc-ggyczz-0"
448
- })(flexItemStyle, responsiveFlexStyle), Flex = function Flex(props) {
449
- let $ = c(28), align, as, gap, justify, ref, restProps, t0, wrap;
450
- $[0] === props ? (align = $[1], as = $[2], gap = $[3], justify = $[4], ref = $[5], restProps = $[6], t0 = $[7], wrap = $[8]) : ({align, as, direction: t0, gap, justify, ref, wrap, ...restProps} = props, $[0] = props, $[1] = align, $[2] = as, $[3] = gap, $[4] = justify, $[5] = ref, $[6] = restProps, $[7] = t0, $[8] = wrap);
451
- let direction = t0 === void 0 ? "row" : t0, t1;
452
- $[9] === align ? t1 = $[10] : (t1 = _getArrayProp(align), $[9] = align, $[10] = t1);
453
- let t2;
454
- $[11] === direction ? t2 = $[12] : (t2 = _getArrayProp(direction), $[11] = direction, $[12] = t2);
455
- let t3;
456
- $[13] === gap ? t3 = $[14] : (t3 = _getArrayProp(gap), $[13] = gap, $[14] = t3);
457
- let t4;
458
- $[15] === justify ? t4 = $[16] : (t4 = _getArrayProp(justify), $[15] = justify, $[16] = t4);
459
- let t5;
460
- $[17] === wrap ? t5 = $[18] : (t5 = _getArrayProp(wrap), $[17] = wrap, $[18] = t5);
461
- let t6;
462
- return $[19] !== as || $[20] !== ref || $[21] !== restProps || $[22] !== t1 || $[23] !== t2 || $[24] !== t3 || $[25] !== t4 || $[26] !== t5 ? (t6 = /* @__PURE__ */ jsx(StyledFlex, {
463
- "data-ui": "Flex",
464
- ...restProps,
465
- $align: t1,
466
- $direction: t2,
467
- $gap: t3,
468
- $justify: t4,
469
- $wrap: t5,
470
- forwardedAs: as,
471
- ref
472
- }), $[19] = as, $[20] = ref, $[21] = restProps, $[22] = t1, $[23] = t2, $[24] = t3, $[25] = t4, $[26] = t5, $[27] = t6) : t6 = $[27], t6;
473
- };
474
- /**
475
- * Get responsive text align styles.
476
- * @internal
477
- */
478
- function responsiveTextAlignStyle(props) {
479
- let { media } = getTheme_v2(props.theme);
480
- return _responsive(media, props.$align, (textAlign) => ({ textAlign }));
481
- }
482
- /**
483
- * A utility function getting responsive font styles.
484
- * @internal
485
- */
486
- function responsiveFont(fontKey, props) {
487
- let { $size, $weight } = props, { font, media } = getTheme_v2(props.theme), { family, sizes, weights } = font[fontKey], fontWeight = $weight && weights[$weight] || weights.regular, defaultSize = sizes[2], base = {
488
- position: "relative",
489
- fontFamily: family,
490
- fontWeight: `${fontWeight}`,
491
- padding: "1px 0",
492
- margin: 0,
493
- "&:before": {
494
- content: "\"\"",
495
- display: "block",
496
- height: 0
497
- },
498
- "&:after": {
499
- content: "\"\"",
500
- display: "block",
501
- height: 0
502
- },
503
- "& > code, & > span": { display: "block" },
504
- "&:not([hidden])": { display: "block" }
505
- };
506
- return $size ? [base, ..._responsive(media, $size, (sizeIndex) => fontSize(sizes[sizeIndex] || defaultSize))] : (responsiveFont.warned ||= (console.warn("No size specified for responsive font", {
507
- fontKey,
508
- $size,
509
- props,
510
- base
511
- }), !0), [base]);
512
- }
513
- function fontSize(size) {
514
- let { ascenderHeight, descenderHeight, fontSize, iconSize, letterSpacing, lineHeight } = size, negHeight = ascenderHeight + descenderHeight, capHeight = lineHeight - negHeight, iconOffset = (capHeight - iconSize) / 2, customIconSize = Math.floor(fontSize * 1.125 / 2) * 2 + 1, customIconOffset = (capHeight - customIconSize) / 2;
515
- return {
516
- fontSize: rem(fontSize),
517
- lineHeight: `calc(${lineHeight} / ${fontSize})`,
518
- letterSpacing: rem(letterSpacing),
519
- transform: `translateY(${rem(descenderHeight)})`,
520
- "&:before": { marginTop: `calc(${rem(0 - negHeight)} - 1px)` },
521
- "&:after": { marginBottom: "-1px" },
522
- "& svg:not([data-sanity-icon])": {
523
- fontSize: `calc(${customIconSize} / 16 * 1rem)`,
524
- margin: rem(customIconOffset)
525
- },
526
- "& [data-sanity-icon]": {
527
- fontSize: `calc(${iconSize} / 16 * 1rem)`,
528
- margin: rem(iconOffset)
529
- }
530
- };
531
- }
532
- /**
533
- * Get responsive CSS for the `text` font style.
534
- * @internal
535
- */
536
- function responsiveTextFont(props) {
537
- return responsiveFont("text", props);
538
- }
539
- /** @internal */
540
- const SpanWithTextOverflow = styled.span.withConfig({
541
- displayName: "SpanWithTextOverflow",
542
- componentId: "sc-xkyu3h-0"
543
- })`display:block;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;overflow:clip;`;
544
- function textBaseStyle(props) {
545
- let { $accent, $muted } = props, { font } = getTheme_v2(props.theme);
546
- return css`color:var(--card-fg-color);${$accent && css`color:var(--card-accent-fg-color);`} ${$muted && css`color:var(--card-muted-fg-color);`} & code{font-family:${font.code.family};border-radius:1px;background-color:var(--card-code-bg-color);color:var(--card-code-fg-color);}& a{text-decoration:none;border-radius:1px;color:var(--card-link-color);outline:none;@media (hover:hover){&:hover{text-decoration:underline;}}&:focus{box-shadow:0 0 0 1px var(--card-bg-color),0 0 0 3px var(--card-focus-ring-color);}&:focus:not(:focus-visible){box-shadow:none;}}& strong{font-weight:${font.text.weights.bold};}& svg{display:inline;}& [data-sanity-icon]{vertical-align:baseline;color:var(--card-icon-color);& path{vector-effect:non-scaling-stroke !important;}}`;
547
- }
548
- const StyledText = /* @__PURE__ */ styled.div.withConfig({
549
- displayName: "StyledText",
550
- componentId: "sc-b3ymr4-0"
551
- })(responsiveTextFont, responsiveTextAlignStyle, textBaseStyle), Text = function Text(props) {
552
- let $ = c(27), align, childrenProp, ref, restProps, t0, t1, t2, textOverflow, weight;
553
- $[0] === props ? (align = $[1], childrenProp = $[2], ref = $[3], restProps = $[4], t0 = $[5], t1 = $[6], t2 = $[7], textOverflow = $[8], weight = $[9]) : ({accent: t0, align, children: childrenProp, muted: t1, ref, size: t2, textOverflow, weight, ...restProps} = props, $[0] = props, $[1] = align, $[2] = childrenProp, $[3] = ref, $[4] = restProps, $[5] = t0, $[6] = t1, $[7] = t2, $[8] = textOverflow, $[9] = weight);
554
- let accent = t0 !== void 0 && t0, muted = t1 !== void 0 && t1, size = t2 === void 0 ? 2 : t2, children = childrenProp;
555
- if (textOverflow === "ellipsis") {
556
- let t3;
557
- $[10] === children ? t3 = $[11] : (t3 = /* @__PURE__ */ jsx(SpanWithTextOverflow, { children }), $[10] = children, $[11] = t3), children = t3;
558
- }
559
- let t3;
560
- $[12] === align ? t3 = $[13] : (t3 = _getArrayProp(align), $[12] = align, $[13] = t3);
561
- let t4;
562
- $[14] === size ? t4 = $[15] : (t4 = _getArrayProp(size), $[14] = size, $[15] = t4);
563
- let t5;
564
- $[16] === children ? t5 = $[17] : (t5 = /* @__PURE__ */ jsx("span", { children }), $[16] = children, $[17] = t5);
565
- let t6;
566
- return $[18] !== accent || $[19] !== muted || $[20] !== ref || $[21] !== restProps || $[22] !== t3 || $[23] !== t4 || $[24] !== t5 || $[25] !== weight ? (t6 = /* @__PURE__ */ jsx(StyledText, {
567
- "data-ui": "Text",
568
- ...restProps,
569
- $accent: accent,
570
- $align: t3,
571
- $muted: muted,
572
- ref,
573
- $size: t4,
574
- $weight: weight,
575
- children: t5
576
- }), $[18] = accent, $[19] = muted, $[20] = ref, $[21] = restProps, $[22] = t3, $[23] = t4, $[24] = t5, $[25] = weight, $[26] = t6) : t6 = $[26], t6;
577
- }, rotate$1 = keyframes`from{transform:rotate(0deg);}to{transform:rotate(360deg);}`, StyledSpinner = styled(Text).withConfig({
578
- displayName: "StyledSpinner",
579
- componentId: "sc-2umvqs-0"
580
- })`& > span > svg{animation:${rotate$1} 500ms linear infinite;}`, Spinner = function Spinner(props) {
581
- let $ = c(3), t0;
582
- $[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = /* @__PURE__ */ jsx(SpinnerIcon, {}), $[0] = t0) : t0 = $[0];
583
- let t1;
584
- return $[1] === props ? t1 = $[2] : (t1 = /* @__PURE__ */ jsx(StyledSpinner, {
585
- "data-ui": "Spinner",
586
- ...props,
587
- children: t0
588
- }), $[1] = props, $[2] = t1), t1;
589
- };
590
- /**
591
- * @internal
592
- */
593
- function _cardColorStyle(base, color, checkered = !1) {
594
- return {
595
- "--card-backdrop-color": base.backdrop,
596
- "--card-focus-ring-color": base.focusRing,
597
- "--card-shadow-outline-color": base.shadow.outline,
598
- "--card-shadow-umbra-color": base.shadow.umbra,
599
- "--card-shadow-penumbra-color": base.shadow.penumbra,
600
- "--card-shadow-ambient-color": base.shadow.ambient,
601
- "--card-accent-fg-color": color.accent.fg,
602
- "--card-avatar-gray-bg-color": color.avatar.gray.bg,
603
- "--card-avatar-gray-fg-color": color.avatar.gray.fg,
604
- "--card-avatar-blue-bg-color": color.avatar.blue.bg,
605
- "--card-avatar-blue-fg-color": color.avatar.blue.fg,
606
- "--card-avatar-purple-bg-color": color.avatar.purple.bg,
607
- "--card-avatar-purple-fg-color": color.avatar.purple.fg,
608
- "--card-avatar-magenta-bg-color": color.avatar.magenta.bg,
609
- "--card-avatar-magenta-fg-color": color.avatar.magenta.fg,
610
- "--card-avatar-red-bg-color": color.avatar.red.bg,
611
- "--card-avatar-red-fg-color": color.avatar.red.fg,
612
- "--card-avatar-orange-bg-color": color.avatar.orange.bg,
613
- "--card-avatar-orange-fg-color": color.avatar.orange.fg,
614
- "--card-avatar-yellow-bg-color": color.avatar.yellow.bg,
615
- "--card-avatar-yellow-fg-color": color.avatar.yellow.fg,
616
- "--card-avatar-green-bg-color": color.avatar.green.bg,
617
- "--card-avatar-green-fg-color": color.avatar.green.fg,
618
- "--card-avatar-cyan-bg-color": color.avatar.cyan.bg,
619
- "--card-avatar-cyan-fg-color": color.avatar.cyan.fg,
620
- "--card-bg-color": color.bg,
621
- "--card-bg-image": checkered ? `repeating-conic-gradient(${color.bg} 0% 25%, ${color.muted.bg} 0% 50%)` : void 0,
622
- "--card-border-color": color.border,
623
- "--card-badge-default-bg-color": color.badge.default.bg,
624
- "--card-badge-default-dot-color": color.badge.default.dot,
625
- "--card-badge-default-fg-color": color.badge.default.fg,
626
- "--card-badge-default-icon-color": color.badge.default.icon,
627
- "--card-badge-neutral-bg-color": color.badge.neutral?.bg,
628
- "--card-badge-neutral-dot-color": color.badge.neutral?.dot,
629
- "--card-badge-neutral-fg-color": color.badge.neutral?.fg,
630
- "--card-badge-neutral-icon-color": color.badge.neutral?.icon,
631
- "--card-badge-primary-bg-color": color.badge.primary.bg,
632
- "--card-badge-primary-dot-color": color.badge.primary.dot,
633
- "--card-badge-primary-fg-color": color.badge.primary.fg,
634
- "--card-badge-primary-icon-color": color.badge.primary.icon,
635
- "--card-badge-suggest-bg-color": color.badge.suggest?.bg,
636
- "--card-badge-suggest-dot-color": color.badge.suggest?.dot,
637
- "--card-badge-suggest-fg-color": color.badge.suggest?.fg,
638
- "--card-badge-suggest-icon-color": color.badge.suggest?.icon,
639
- "--card-badge-positive-bg-color": color.badge.positive.bg,
640
- "--card-badge-positive-dot-color": color.badge.positive.dot,
641
- "--card-badge-positive-fg-color": color.badge.positive.fg,
642
- "--card-badge-positive-icon-color": color.badge.positive.icon,
643
- "--card-badge-caution-bg-color": color.badge.caution.bg,
644
- "--card-badge-caution-dot-color": color.badge.caution.dot,
645
- "--card-badge-caution-fg-color": color.badge.caution.fg,
646
- "--card-badge-caution-icon-color": color.badge.caution.icon,
647
- "--card-badge-critical-bg-color": color.badge.critical.bg,
648
- "--card-badge-critical-dot-color": color.badge.critical.dot,
649
- "--card-badge-critical-fg-color": color.badge.critical.fg,
650
- "--card-badge-critical-icon-color": color.badge.critical.icon,
651
- "--card-code-bg-color": color.code.bg,
652
- "--card-code-fg-color": color.code.fg,
653
- "--card-fg-color": color.fg,
654
- "--card-icon-color": color.icon,
655
- "--card-kbd-bg-color": color.kbd.bg,
656
- "--card-kbd-border-color": color.kbd.border,
657
- "--card-kbd-fg-color": color.kbd.fg,
658
- "--card-link-fg-color": color.link.fg,
659
- "--card-muted-bg-color": color.muted.bg,
660
- "--card-muted-fg-color": color.muted.fg,
661
- "--card-skeleton-color-from": color.skeleton.from,
662
- "--card-skeleton-color-to": color.skeleton.to,
663
- "--card-bg2-color": color.muted.bg,
664
- "--card-link-color": color.link.fg,
665
- "--card-hairline-soft-color": color.border,
666
- "--card-hairline-hard-color": color.border
667
- };
668
- }
669
- function focusRingBorderStyle(border) {
670
- return `inset 0 0 0 ${border.width}px ${border.color}`;
671
- }
672
- function focusRingStyle(opts) {
673
- let { base, border, focusRing } = opts, focusRingOutsetWidth = focusRing.offset + focusRing.width, focusRingInsetWidth = 0 - focusRing.offset, bgColor = base ? base.bg : "var(--card-bg-color)";
674
- return [
675
- focusRingInsetWidth > 0 && `inset 0 0 0 ${focusRingInsetWidth}px var(--card-focus-ring-color)`,
676
- border && focusRingBorderStyle(border),
677
- focusRingInsetWidth < 0 && `0 0 0 ${0 - focusRingInsetWidth}px ${bgColor}`,
678
- focusRingOutsetWidth > 0 && `0 0 0 ${focusRingOutsetWidth}px var(--card-focus-ring-color)`
679
- ].filter(Boolean).join(",");
680
- }
681
- /**
682
- * @internal
683
- */
684
- function buttonBaseStyles(props) {
685
- let { $width } = props, { style } = getTheme_v2(props.theme);
686
- return css`${style?.button};-webkit-font-smoothing:inherit;appearance:none;display:inline-flex;align-items:center;font:inherit;border:0;outline:none;user-select:none;text-decoration:none;border:0;box-sizing:border-box;padding:0;margin:0;white-space:nowrap;text-align:left;position:relative;vertical-align:top;${$width === "fill" && css`width:-moz-available;width:-webkit-fill-available;width:stretch;`} & > span{display:block;flex:1;min-width:0;border-radius:inherit;}&::-moz-focus-inner{border:0;padding:0;}`;
687
- }
688
- function combineBoxShadow(...boxShadows) {
689
- return boxShadows.filter(Boolean).join(",");
690
- }
691
- /**
692
- * @internal
693
- */
694
- function buttonColorStyles(props) {
695
- let { $mode } = props, { button, color: baseColor, style } = getTheme_v2(props.theme);
696
- props.$mode;
697
- let mode = baseColor.button[$mode] || baseColor.button.default, color = mode[props.$tone] || mode.default, border = {
698
- width: button.border.width,
699
- color: "var(--card-border-color)"
700
- };
701
- return [
702
- _cardColorStyle(baseColor, color.enabled),
703
- {
704
- backgroundColor: "var(--card-bg-color)",
705
- color: "var(--card-fg-color)",
706
- boxShadow: focusRingBorderStyle(border),
707
- "&:disabled, &[data-disabled=\"true\"]": _cardColorStyle(baseColor, color.disabled),
708
- "&:not([data-disabled='true'])": {
709
- boxShadow: combineBoxShadow(focusRingBorderStyle(border), void 0),
710
- "&:focus": { boxShadow: focusRingStyle({
711
- base: baseColor,
712
- border: {
713
- width: 2,
714
- color: baseColor.bg
715
- },
716
- focusRing: button.focusRing
717
- }) },
718
- "&:focus:not(:focus-visible)": { boxShadow: combineBoxShadow(focusRingBorderStyle(border), void 0) },
719
- "@media (hover: hover)": {
720
- "&:hover": _cardColorStyle(baseColor, color.hovered),
721
- "&:active": _cardColorStyle(baseColor, color.pressed),
722
- "&[data-hovered]": _cardColorStyle(baseColor, color.hovered)
723
- },
724
- "&[data-selected]": _cardColorStyle(baseColor, color.pressed)
725
- }
726
- },
727
- style?.button?.root
728
- ].filter(Boolean);
729
- }
730
- const StyledButton = /* @__PURE__ */ styled.button.withConfig({
731
- displayName: "StyledButton",
732
- componentId: "sc-7pa0ky-0"
733
- })(responsiveRadiusStyle, buttonBaseStyles, buttonColorStyles), LoadingBox = styled.div.withConfig({
734
- displayName: "LoadingBox",
735
- componentId: "sc-7pa0ky-1"
736
- })`position:absolute;top:0;left:0;right:0;bottom:0;display:flex;align-items:center;justify-content:center;background-color:var(--card-bg-color);border-radius:inherit;z-index:1;box-shadow:inherit;`, Button = function Button(props) {
737
- let $ = c(87), IconComponent, IconRightComponent, children, disabled, loading, paddingBottomProp, paddingLeftProp, paddingRightProp, paddingTopProp, paddingXProp, paddingYProp, ref, restProps, selected, t0, t1, t2, t3, t4, t5, t6, t7, t8, text, textAlign, textWeight, width;
738
- $[0] === props ? (IconComponent = $[1], IconRightComponent = $[2], children = $[3], disabled = $[4], loading = $[5], paddingBottomProp = $[6], paddingLeftProp = $[7], paddingRightProp = $[8], paddingTopProp = $[9], paddingXProp = $[10], paddingYProp = $[11], ref = $[12], restProps = $[13], selected = $[14], t0 = $[15], t1 = $[16], t2 = $[17], t3 = $[18], t4 = $[19], t5 = $[20], t6 = $[21], t7 = $[22], t8 = $[23], text = $[24], textAlign = $[25], textWeight = $[26], width = $[27]) : ({children, disabled, ref, fontSize: t0, icon: IconComponent, iconRight: IconRightComponent, justify: t1, loading, mode: t2, padding: t3, paddingX: paddingXProp, paddingY: paddingYProp, paddingTop: paddingTopProp, paddingBottom: paddingBottomProp, paddingLeft: paddingLeftProp, paddingRight: paddingRightProp, radius: t4, selected, gap: t5, text, textAlign, textWeight, tone: t6, type: t7, muted: t8, width, ...restProps} = props, $[0] = props, $[1] = IconComponent, $[2] = IconRightComponent, $[3] = children, $[4] = disabled, $[5] = loading, $[6] = paddingBottomProp, $[7] = paddingLeftProp, $[8] = paddingRightProp, $[9] = paddingTopProp, $[10] = paddingXProp, $[11] = paddingYProp, $[12] = ref, $[13] = restProps, $[14] = selected, $[15] = t0, $[16] = t1, $[17] = t2, $[18] = t3, $[19] = t4, $[20] = t5, $[21] = t6, $[22] = t7, $[23] = t8, $[24] = text, $[25] = textAlign, $[26] = textWeight, $[27] = width);
739
- let fontSize = t0 === void 0 ? 1 : t0, justifyProp = t1 === void 0 ? "center" : t1, mode = t2 === void 0 ? "default" : t2, paddingProp = t3 === void 0 ? 3 : t3, radiusProp = t4 === void 0 ? 2 : t4, gap = t5 === void 0 ? 3 : t5, tone = t6 === void 0 ? "default" : t6, type = t7 === void 0 ? "button" : t7, muted = t8 !== void 0 && t8, { button } = useTheme_v2(), t9;
740
- $[28] === justifyProp ? t9 = $[29] : (t9 = _getArrayProp(justifyProp), $[28] = justifyProp, $[29] = t9);
741
- let justify = t9, t10;
742
- $[30] === paddingProp ? t10 = $[31] : (t10 = _getArrayProp(paddingProp), $[30] = paddingProp, $[31] = t10);
743
- let padding = t10, t11;
744
- $[32] === paddingXProp ? t11 = $[33] : (t11 = _getArrayProp(paddingXProp), $[32] = paddingXProp, $[33] = t11);
745
- let paddingX = t11, t12;
746
- $[34] === paddingYProp ? t12 = $[35] : (t12 = _getArrayProp(paddingYProp), $[34] = paddingYProp, $[35] = t12);
747
- let paddingY = t12, t13;
748
- $[36] === paddingTopProp ? t13 = $[37] : (t13 = _getArrayProp(paddingTopProp), $[36] = paddingTopProp, $[37] = t13);
749
- let paddingTop = t13, t14;
750
- $[38] === paddingBottomProp ? t14 = $[39] : (t14 = _getArrayProp(paddingBottomProp), $[38] = paddingBottomProp, $[39] = t14);
751
- let paddingBottom = t14, t15;
752
- $[40] === paddingLeftProp ? t15 = $[41] : (t15 = _getArrayProp(paddingLeftProp), $[40] = paddingLeftProp, $[41] = t15);
753
- let paddingLeft = t15, t16;
754
- $[42] === paddingRightProp ? t16 = $[43] : (t16 = _getArrayProp(paddingRightProp), $[42] = paddingRightProp, $[43] = t16);
755
- let paddingRight = t16, t17;
756
- $[44] === radiusProp ? t17 = $[45] : (t17 = _getArrayProp(radiusProp), $[44] = radiusProp, $[45] = t17);
757
- let radius = t17, t18;
758
- $[46] === gap ? t18 = $[47] : (t18 = _getArrayProp(gap), $[46] = gap, $[47] = t18);
759
- let spacing = t18, t19;
760
- $[48] !== padding || $[49] !== paddingBottom || $[50] !== paddingLeft || $[51] !== paddingRight || $[52] !== paddingTop || $[53] !== paddingX || $[54] !== paddingY ? (t19 = {
761
- padding,
762
- paddingX,
763
- paddingY,
764
- paddingTop,
765
- paddingBottom,
766
- paddingLeft,
767
- paddingRight
768
- }, $[48] = padding, $[49] = paddingBottom, $[50] = paddingLeft, $[51] = paddingRight, $[52] = paddingTop, $[53] = paddingX, $[54] = paddingY, $[55] = t19) : t19 = $[55];
769
- let boxProps = t19, t20 = !!(loading || disabled), t21 = selected ? "" : void 0, t22 = !!(loading || disabled), t23;
770
- $[56] === loading ? t23 = $[57] : (t23 = !!loading && /* @__PURE__ */ jsx(LoadingBox, { children: /* @__PURE__ */ jsx(Spinner, {}) }), $[56] = loading, $[57] = t23);
771
- let t24;
772
- $[58] !== IconComponent || $[59] !== IconRightComponent || $[60] !== boxProps || $[61] !== button || $[62] !== fontSize || $[63] !== justify || $[64] !== muted || $[65] !== spacing || $[66] !== text || $[67] !== textAlign || $[68] !== textWeight ? (t24 = (IconComponent || text || IconRightComponent) && /* @__PURE__ */ jsx(Box, {
773
- as: "span",
774
- ...boxProps,
775
- children: /* @__PURE__ */ jsxs(Flex, {
776
- as: "span",
777
- justify,
778
- gap: spacing,
779
- children: [
780
- IconComponent && /* @__PURE__ */ jsxs(Text, {
781
- size: fontSize,
782
- children: [isValidElement(IconComponent) && IconComponent, isValidElementType(IconComponent) && /* @__PURE__ */ jsx(IconComponent, {})]
783
- }),
784
- text && /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Text, {
785
- muted,
786
- align: textAlign,
787
- size: fontSize,
788
- textOverflow: "ellipsis",
789
- weight: textWeight ?? button.textWeight,
790
- children: text
791
- }) }),
792
- IconRightComponent && /* @__PURE__ */ jsxs(Text, {
793
- size: fontSize,
794
- children: [isValidElement(IconRightComponent) && IconRightComponent, isValidElementType(IconRightComponent) && /* @__PURE__ */ jsx(IconRightComponent, {})]
795
- })
796
- ]
797
- })
798
- }), $[58] = IconComponent, $[59] = IconRightComponent, $[60] = boxProps, $[61] = button, $[62] = fontSize, $[63] = justify, $[64] = muted, $[65] = spacing, $[66] = text, $[67] = textAlign, $[68] = textWeight, $[69] = t24) : t24 = $[69];
799
- let t25;
800
- $[70] !== boxProps || $[71] !== children ? (t25 = children && /* @__PURE__ */ jsx(Box, {
801
- as: "span",
802
- ...boxProps,
803
- children
804
- }), $[70] = boxProps, $[71] = children, $[72] = t25) : t25 = $[72];
805
- let t26;
806
- return $[73] !== mode || $[74] !== radius || $[75] !== ref || $[76] !== restProps || $[77] !== t20 || $[78] !== t21 || $[79] !== t22 || $[80] !== t23 || $[81] !== t24 || $[82] !== t25 || $[83] !== tone || $[84] !== type || $[85] !== width ? (t26 = /* @__PURE__ */ jsxs(StyledButton, {
807
- "data-ui": "Button",
808
- ...restProps,
809
- $mode: mode,
810
- $radius: radius,
811
- $tone: tone,
812
- "data-disabled": t20,
813
- "data-selected": t21,
814
- disabled: t22,
815
- ref,
816
- type,
817
- $width: width,
818
- children: [
819
- t23,
820
- t24,
821
- t25
822
- ]
823
- }), $[73] = mode, $[74] = radius, $[75] = ref, $[76] = restProps, $[77] = t20, $[78] = t21, $[79] = t22, $[80] = t23, $[81] = t24, $[82] = t25, $[83] = tone, $[84] = type, $[85] = width, $[86] = t26) : t26 = $[86], t26;
824
- };
825
- function responsiveBorderStyle() {
826
- return [
827
- border,
828
- borderTop,
829
- borderRight,
830
- borderBottom,
831
- borderLeft
832
- ];
833
- }
834
- function border(props) {
835
- let { card, media } = getTheme_v2(props.theme), borderStyle = `${card.border?.width ?? 1}px solid var(--card-border-color)`;
836
- return _responsive(media, props.$border, (value) => value ? { "&&": { border: borderStyle } } : { "&&": { border: 0 } });
837
- }
838
- function borderTop(props) {
839
- let { card, media } = getTheme_v2(props.theme), borderStyle = `${card.border?.width ?? 1}px solid var(--card-border-color)`;
840
- return _responsive(media, props.$borderTop, (value) => value ? { "&&": { borderTop: borderStyle } } : { "&&": { borderTop: 0 } });
841
- }
842
- function borderRight(props) {
843
- let { card, media } = getTheme_v2(props.theme), borderStyle = `${card.border?.width ?? 1}px solid var(--card-border-color)`;
844
- return _responsive(media, props.$borderRight, (value) => value ? { "&&": { borderRight: borderStyle } } : { "&&": { borderRight: 0 } });
845
- }
846
- function borderBottom(props) {
847
- let { card, media } = getTheme_v2(props.theme), borderStyle = `${card.border?.width ?? 1}px solid var(--card-border-color)`;
848
- return _responsive(media, props.$borderBottom, (value) => value ? { "&&": { borderBottom: borderStyle } } : { "&&": { borderBottom: 0 } });
849
- }
850
- function borderLeft(props) {
851
- let { card, media } = getTheme_v2(props.theme), borderStyle = `${card.border?.width ?? 1}px solid var(--card-border-color)`;
852
- return _responsive(media, props.$borderLeft, (value) => value ? { "&&": { borderLeft: borderStyle } } : { "&&": { borderLeft: 0 } });
853
- }
854
- function toBoxShadow(shadow, color) {
855
- return `${shadow.map(rem).join(" ")} ${color}`;
856
- }
857
- function shadowStyle(shadow, outlineWidth = 1) {
858
- return shadow ? { boxShadow: `${`0 0 0 ${rem(outlineWidth)} var(--card-shadow-outline-color)`}, ${toBoxShadow(shadow.umbra, "var(--card-shadow-umbra-color)")}, ${toBoxShadow(shadow.penumbra, "var(--card-shadow-penumbra-color)")}, ${toBoxShadow(shadow.ambient, "var(--card-shadow-ambient-color)")}` } : EMPTY_RECORD;
859
- }
860
- function responsiveShadowStyle(props) {
861
- let { card, media, shadow } = getTheme_v2(props.theme);
862
- return _responsive(media, props.$shadow, (index) => shadowStyle(shadow[index], card.shadow.outline));
863
- }
864
- /**
865
- * Gets the global scope instance in a given environment.
866
- *
867
- * The strategy is to return the most modern, and if not, the most common:
868
- * - The `globalThis` variable is the modern approach to accessing the global scope
869
- * - The `window` variable is the global scope in a web browser
870
- * - The `self` variable is the global scope in workers and others
871
- * - The `global` variable is the global scope in Node.js
872
- */
873
- function getGlobalScope() {
874
- if (typeof globalThis < "u") return globalThis;
875
- if (typeof window < "u") return window;
876
- if (typeof self < "u") return self;
877
- if (typeof global < "u") return global;
878
- throw Error("@sanity/ui: could not locate global scope");
879
- }
880
- const globalScope = getGlobalScope();
881
- /**
882
- * As `@sanity/ui` is declared as a dependency, and may be duplicated, sometimes across major versions
883
- * it's critical that vital react contexts are shared even when there is a duplicate.
884
- * If we used a model similar to `sanity` itself, or `styled-components`, this would be unnecessary as
885
- * those libraries enforce single instances.
886
- * Since we don't enforce it we have to support a sanity plugin being able to call hooks like `useToast`, and then
887
- * read the context setup by `sanity`, which calls `ToastProvider`, even if the provider and hook are different instances in memory.
888
- * It's also why it's vital that all changes to globally scoped providers remain fully backwards compatible to v1.
889
- */
890
- function createGlobalScopedContext(key, defaultValue) {
891
- let symbol = Symbol.for(key);
892
- /**
893
- * Prevent errors about re-renders on React SSR on Next.js App Router
894
- */
895
- if (typeof document > "u") {
896
- let context = createContext(defaultValue);
897
- return context.displayName = key, context;
898
- }
899
- return globalScope[symbol] = globalScope[symbol] || createContext(defaultValue), globalScope[symbol];
900
- }
901
- /**
902
- * @internal
903
- */
904
- const ThemeContext = createGlobalScopedContext("@sanity/ui/context/theme", null);
905
- /**
906
- * @public
907
- */
908
- function ThemeProvider(props) {
909
- let $ = c(15), parentTheme = useContext(ThemeContext), { children } = props, scheme = props.scheme ?? (parentTheme?.scheme || "light"), rootTheme = props.theme ?? (parentTheme?.theme || null), tone = props.tone ?? (parentTheme?.tone || "default"), t0;
910
- bb0: {
911
- if (!rootTheme) {
912
- t0 = null;
913
- break bb0;
914
- }
915
- let t1;
916
- $[0] !== rootTheme || $[1] !== scheme || $[2] !== tone ? (t1 = {
917
- version: 0,
918
- theme: rootTheme,
919
- scheme,
920
- tone
921
- }, $[0] = rootTheme, $[1] = scheme, $[2] = tone, $[3] = t1) : t1 = $[3], t0 = t1;
922
- }
923
- let themeContext = t0, t1;
924
- bb1: {
925
- if (!rootTheme) {
926
- t1 = null;
927
- break bb1;
928
- }
929
- let t2;
930
- $[4] !== rootTheme || $[5] !== scheme || $[6] !== tone ? (t2 = getScopedTheme(rootTheme, scheme, tone), $[4] = rootTheme, $[5] = scheme, $[6] = tone, $[7] = t2) : t2 = $[7], t1 = t2;
931
- }
932
- let theme = t1;
933
- if (!theme) {
934
- let t2;
935
- return $[8] === Symbol.for("react.memo_cache_sentinel") ? (t2 = /* @__PURE__ */ jsx("pre", { children: "ThemeProvider: no \"theme\" property provided" }), $[8] = t2) : t2 = $[8], t2;
936
- }
937
- let t2;
938
- $[9] !== children || $[10] !== theme ? (t2 = /* @__PURE__ */ jsx(ThemeProvider$1, {
939
- theme,
940
- children
941
- }), $[9] = children, $[10] = theme, $[11] = t2) : t2 = $[11];
942
- let t3;
943
- return $[12] !== t2 || $[13] !== themeContext ? (t3 = /* @__PURE__ */ jsx(ThemeContext.Provider, {
944
- value: themeContext,
945
- children: t2
946
- }), $[12] = t2, $[13] = themeContext, $[14] = t3) : t3 = $[14], t3;
947
- }
948
- /**
949
- * @public
950
- */
951
- function useRootTheme() {
952
- let value = useContext(ThemeContext);
953
- if (!value) throw Error("useRootTheme(): missing context value");
954
- return value;
955
- }
956
- /**
957
- * @public
958
- */
959
- function ThemeColorProvider(props) {
960
- let $ = c(5), { children, scheme, tone } = props, root = useRootTheme(), t0 = scheme || root.scheme, t1;
961
- return $[0] !== children || $[1] !== root.theme || $[2] !== t0 || $[3] !== tone ? (t1 = /* @__PURE__ */ jsx(ThemeProvider, {
962
- scheme: t0,
963
- theme: root.theme,
964
- tone,
965
- children
966
- }), $[0] = children, $[1] = root.theme, $[2] = t0, $[3] = tone, $[4] = t1) : t1 = $[4], t1;
967
- }
968
- function cardStyle(props) {
969
- return [cardBaseStyle(props), cardColorStyle(props)];
970
- }
971
- function cardBaseStyle(props) {
972
- let { $checkered } = props, { space } = getTheme_v2(props.theme);
973
- return css`${$checkered && css`background-size:${space[3]}px ${space[3]}px;background-position:50% 50%;background-image:var(--card-bg-image);`} &[data-as='button']{-webkit-font-smoothing:inherit;appearance:none;outline:none;font:inherit;text-align:inherit;border:0;width:-moz-available;width:-webkit-fill-available;width:stretch;}&[data-as='a']{outline:none;text-decoration:none;}&[data-as='pre']{font:inherit;}`;
974
- }
975
- function cardColorStyle(props) {
976
- let { $checkered, $focusRing, $muted } = props, { card, color, style } = getTheme_v2(props.theme), border = {
977
- width: card.border.width,
978
- color: "var(--card-border-color)"
979
- };
980
- return css`color-scheme:${color._dark ? "dark" : "light"};${_cardColorStyle(color, color, $checkered)} background-color:${$muted ? "var(--card-muted-bg-color)" : "var(--card-bg-color)"};color:var(--card-fg-color);&[data-as='button']{--card-focus-ring-box-shadow:none;cursor:default;box-shadow:var(--card-focus-ring-box-shadow);&:disabled{${_cardColorStyle(color, color.selectable.default.disabled, $checkered)}}&:not(:disabled){&[data-pressed]{${_cardColorStyle(color, color.selectable.default.pressed, $checkered)}}&[data-selected]{${_cardColorStyle(color, color.selectable.default.selected, $checkered)}}@media (hover:hover){&:not([data-pressed]):not([data-selected]){&[data-hovered],&:hover{${_cardColorStyle(color, color.selectable.default.hovered, $checkered)}}&:active{${_cardColorStyle(color, color.selectable.default.pressed, $checkered)}}}}&:focus-visible{--card-focus-ring-box-shadow:${$focusRing ? focusRingStyle({
981
- base: color,
982
- border,
983
- focusRing: card.focusRing
984
- }) : void 0};}}}&[data-as='a']{cursor:pointer;box-shadow:var(--card-focus-ring-box-shadow);&[data-disabled]{${_cardColorStyle(color, color.selectable.default.disabled, $checkered)}}&:not([data-disabled]){&[data-pressed]{${_cardColorStyle(color, color.selectable.default.pressed, $checkered)}}&[data-selected]{${_cardColorStyle(color, color.selectable.default.selected, $checkered)}}@media (hover:hover){&:not([data-pressed]):not([data-selected]){&[data-hovered],&:hover{${_cardColorStyle(color, color.selectable.default.hovered, $checkered)}}&:active{${_cardColorStyle(color, color.selectable.default.pressed, $checkered)}}}}&:focus-visible{--card-focus-ring-box-shadow:${$focusRing ? focusRingStyle({
985
- base: color,
986
- border,
987
- focusRing: card.focusRing
988
- }) : void 0};}}}${style?.card?.root}`;
989
- }
990
- const StyledCard = /* @__PURE__ */ styled(Box).withConfig({
991
- displayName: "StyledCard",
992
- componentId: "sc-46g0j2-0"
993
- })(responsiveBorderStyle, responsiveRadiusStyle, responsiveShadowStyle, cardStyle), Card = function Card(props) {
994
- let $ = c(57), asProp, border, borderBottom, borderLeft, borderRight, borderTop, muted, pressed, ref, restProps, scheme, selected, shadow, t0, t1, t2, t3;
995
- $[0] === props ? (asProp = $[1], border = $[2], borderBottom = $[3], borderLeft = $[4], borderRight = $[5], borderTop = $[6], muted = $[7], pressed = $[8], ref = $[9], restProps = $[10], scheme = $[11], selected = $[12], shadow = $[13], t0 = $[14], t1 = $[15], t2 = $[16], t3 = $[17]) : ({__unstable_checkered: t0, __unstable_focusRing: t1, as: asProp, border, borderTop, borderRight, borderBottom, borderLeft, muted, pressed, radius: t2, ref, scheme, selected, shadow, tone: t3, ...restProps} = props, $[0] = props, $[1] = asProp, $[2] = border, $[3] = borderBottom, $[4] = borderLeft, $[5] = borderRight, $[6] = borderTop, $[7] = muted, $[8] = pressed, $[9] = ref, $[10] = restProps, $[11] = scheme, $[12] = selected, $[13] = shadow, $[14] = t0, $[15] = t1, $[16] = t2, $[17] = t3);
996
- let checkered = t0 !== void 0 && t0, focusRing = t1 !== void 0 && t1, radius = t2 === void 0 ? 0 : t2, toneProp = t3 === void 0 ? "default" : t3, as = isValidElementType(asProp) ? asProp : "div", rootTheme = useRootTheme(), tone = toneProp === "inherit" ? rootTheme.tone : toneProp, t4 = typeof as == "string" ? as : void 0, t5 = rootTheme.scheme, t6;
997
- $[18] === border ? t6 = $[19] : (t6 = _getArrayProp(border), $[18] = border, $[19] = t6);
998
- let t7;
999
- $[20] === borderTop ? t7 = $[21] : (t7 = _getArrayProp(borderTop), $[20] = borderTop, $[21] = t7);
1000
- let t8;
1001
- $[22] === borderRight ? t8 = $[23] : (t8 = _getArrayProp(borderRight), $[22] = borderRight, $[23] = t8);
1002
- let t9;
1003
- $[24] === borderBottom ? t9 = $[25] : (t9 = _getArrayProp(borderBottom), $[24] = borderBottom, $[25] = t9);
1004
- let t10;
1005
- $[26] === borderLeft ? t10 = $[27] : (t10 = _getArrayProp(borderLeft), $[26] = borderLeft, $[27] = t10);
1006
- let t11;
1007
- $[28] === radius ? t11 = $[29] : (t11 = _getArrayProp(radius), $[28] = radius, $[29] = t11);
1008
- let t12;
1009
- $[30] === shadow ? t12 = $[31] : (t12 = _getArrayProp(shadow), $[30] = shadow, $[31] = t12);
1010
- let t13 = checkered ? "" : void 0, t14 = pressed ? "" : void 0, t15 = selected ? "" : void 0, t16;
1011
- $[32] !== as || $[33] !== checkered || $[34] !== focusRing || $[35] !== muted || $[36] !== ref || $[37] !== restProps || $[38] !== rootTheme.scheme || $[39] !== selected || $[40] !== t10 || $[41] !== t11 || $[42] !== t12 || $[43] !== t13 || $[44] !== t14 || $[45] !== t15 || $[46] !== t4 || $[47] !== t6 || $[48] !== t7 || $[49] !== t8 || $[50] !== t9 || $[51] !== tone ? (t16 = /* @__PURE__ */ jsx(StyledCard, {
1012
- "data-as": t4,
1013
- "data-scheme": t5,
1014
- "data-ui": "Card",
1015
- "data-tone": tone,
1016
- ...restProps,
1017
- $border: t6,
1018
- $borderTop: t7,
1019
- $borderRight: t8,
1020
- $borderBottom: t9,
1021
- $borderLeft: t10,
1022
- $checkered: checkered,
1023
- $focusRing: focusRing,
1024
- $muted: muted,
1025
- $radius: t11,
1026
- $shadow: t12,
1027
- $tone: tone,
1028
- "data-checkered": t13,
1029
- "data-pressed": t14,
1030
- "data-selected": t15,
1031
- forwardedAs: as,
1032
- ref,
1033
- selected
1034
- }), $[32] = as, $[33] = checkered, $[34] = focusRing, $[35] = muted, $[36] = ref, $[37] = restProps, $[38] = rootTheme.scheme, $[39] = selected, $[40] = t10, $[41] = t11, $[42] = t12, $[43] = t13, $[44] = t14, $[45] = t15, $[46] = t4, $[47] = t6, $[48] = t7, $[49] = t8, $[50] = t9, $[51] = tone, $[52] = t16) : t16 = $[52];
1035
- let t17;
1036
- return $[53] !== scheme || $[54] !== t16 || $[55] !== tone ? (t17 = /* @__PURE__ */ jsx(ThemeColorProvider, {
1037
- scheme,
1038
- tone,
1039
- children: t16
1040
- }), $[53] = scheme, $[54] = t16, $[55] = tone, $[56] = t17) : t17 = $[56], t17;
1041
- }, _elementSizeObserver = _createElementSizeObserver();
1042
- function _createElementRectValueListener() {
1043
- return { subscribe(element, subscriber) {
1044
- let resizeObserver = new ResizeObserver(([entry]) => {
1045
- subscriber({
1046
- _contentRect: entry.contentRect,
1047
- border: {
1048
- width: entry.borderBoxSize[0].inlineSize,
1049
- height: entry.borderBoxSize[0].blockSize
1050
- },
1051
- content: {
1052
- width: entry.contentRect.width,
1053
- height: entry.contentRect.height
1054
- }
1055
- });
1056
- });
1057
- return resizeObserver.observe(element), () => {
1058
- resizeObserver.unobserve(element), resizeObserver.disconnect();
1059
- };
1060
- } };
1061
- }
1062
- function _createElementSizeObserver() {
1063
- let disposeCache = /* @__PURE__ */ new WeakMap(), subscribersCache = /* @__PURE__ */ new WeakMap();
1064
- return { subscribe(element, subscriber) {
1065
- let subscribers = subscribersCache.get(element) || [], dispose = disposeCache.get(element);
1066
- return subscribersCache.has(element) || (subscribersCache.set(element, subscribers), dispose = _createElementRectValueListener().subscribe(element, (elementRect) => {
1067
- for (let sub of subscribers) sub(elementRect);
1068
- })), subscribers.push(subscriber), () => {
1069
- let idx = subscribers.indexOf(subscriber);
1070
- idx > -1 && subscribers.splice(idx, 1), subscribers.length === 0 && dispose && dispose();
1071
- };
1072
- } };
1073
- }
1074
- /**
1075
- * Subscribe to the size of a DOM element.
1076
- * @beta
1077
- */
1078
- function useElementSize(element) {
1079
- let $ = c(3), [size, setSize] = useState(null), t0, t1;
1080
- return $[0] === element ? (t0 = $[1], t1 = $[2]) : (t0 = () => {
1081
- if (element) return _elementSizeObserver.subscribe(element, setSize);
1082
- }, t1 = [element], $[0] = element, $[1] = t0, $[2] = t1), useEffect(t0, t1), size;
1083
- }
1084
- function _getMediaQuery(media, index) {
1085
- return index === 0 ? `screen and (max-width: ${media[index] - 1}px)` : index === media.length ? `screen and (min-width: ${media[index - 1]}px)` : `screen and (min-width: ${media[index - 1]}px) and (max-width: ${media[index] - 1}px)`;
1086
- }
1087
- function _createMediaStore(media) {
1088
- let mediaLen = media.length, sizes, getSizes = () => {
1089
- if (!sizes) {
1090
- sizes = [];
1091
- for (let index = mediaLen; index > -1; --index) {
1092
- let mediaQuery = _getMediaQuery(media, index);
1093
- sizes.push({
1094
- index,
1095
- mq: window.matchMedia(mediaQuery)
1096
- });
1097
- }
1098
- }
1099
- return sizes;
1100
- }, getSnapshot = () => {
1101
- for (let { index, mq } of getSizes()) if (mq.matches) return index;
1102
- return 0;
1103
- }, subscribe = (onStoreChange) => {
1104
- let disposeFns = [];
1105
- for (let { mq } of getSizes()) {
1106
- let handleChange = () => {
1107
- mq.matches && onStoreChange();
1108
- };
1109
- mq.addEventListener("change", handleChange), disposeFns.push(() => mq.removeEventListener("change", handleChange));
1110
- }
1111
- return () => {
1112
- for (let disposeFn of disposeFns) disposeFn();
1113
- };
1114
- };
1115
- return {
1116
- getSnapshot,
1117
- subscribe
1118
- };
1119
- }
1120
- /**
1121
- * Only called during server-side rendering, and hydration if using hydrateRoot
1122
- * Since the server environment doesn't have access to the DOM, we can't determine the current value of the media query
1123
- * and we assume `(prefers-color-scheme: light)` since it's the most common scheme
1124
- *
1125
- * @link https://beta.reactjs.org/apis/react/useSyncExternalStore#adding-support-for-server-rendering
1126
- */
1127
- function getServerSnapshot() {
1128
- return 0;
1129
- }
1130
- /**
1131
- * This API might change. DO NOT USE IN PRODUCTION.
1132
- * @beta
1133
- */
1134
- function useMediaIndex() {
1135
- let $ = c(2), { media } = useTheme_v2(), t0;
1136
- $[0] === media ? t0 = $[1] : (t0 = _createMediaStore(media), $[0] = media, $[1] = t0);
1137
- let store = t0;
1138
- return useSyncExternalStore(store.subscribe, store.getSnapshot, getServerSnapshot);
1139
- }
1140
- /**
1141
- * Efficiently subscribes to `window.matchMedia` queries
1142
- *
1143
- * @param getServerSnapshot - Only called during server-side rendering, and hydration if using hydrateRoot. Required if the hook is called during SSR (https://react.dev/reference/react/useSyncExternalStore#adding-support-for-server-rendering)
1144
- *
1145
- * @public
1146
- */
1147
- function useMatchMedia(mediaQueryString, getServerSnapshot) {
1148
- let $ = c(4);
1149
- useDebugValue(mediaQueryString);
1150
- let t0;
1151
- $[0] === mediaQueryString ? t0 = $[1] : (t0 = (onStoreChange) => {
1152
- let media = window.matchMedia(mediaQueryString);
1153
- return media.addEventListener("change", onStoreChange), () => media.removeEventListener("change", onStoreChange);
1154
- }, $[0] = mediaQueryString, $[1] = t0);
1155
- let t1;
1156
- return $[2] === mediaQueryString ? t1 = $[3] : (t1 = () => window.matchMedia(mediaQueryString).matches, $[2] = mediaQueryString, $[3] = t1), useSyncExternalStore(t0, t1, getServerSnapshot);
1157
- }
1158
- /**
1159
- * Returns true if motion should be reduced
1160
- *
1161
- * @param getServerSnapshot - Only called during server-side rendering, and hydration if using hydrateRoot. Since the server environment doesn't have access to the DOM, we can't determine the current value of the media query and we assume `(prefers-reduced-motion: no-preference)` since it's the most common scheme (https://react.dev/reference/react/useSyncExternalStore#adding-support-for-server-rendering)
1162
- *
1163
- * If you persist the detected preference in a cookie or a header then you may implement your own server snapshot to read it.
1164
- * Chrome supports reading the `prefers-reduced-motion` media query from a header if the server response: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Sec-CH-Prefers-Reduced-Motion
1165
- * @example https://gist.github.com/stipsan/0c0f839a27842249cada893e9fb7767b
1166
- *
1167
- * @public
1168
- */
1169
- function usePrefersReducedMotion(t0) {
1170
- return useMatchMedia("(prefers-reduced-motion: reduce)", t0 === void 0 ? _temp$14 : t0);
1171
- }
1172
- function _temp$14() {
1173
- return !1;
1174
- }
1175
- /**
1176
- * Custom floating-ui middleware which calculates transform-origin X + Y offsets
1177
- * based on the current floating rect's dimensions and shift offset.
1178
- *
1179
- * Scaling popovers with these transform-origin offsets will give the effect of
1180
- * popvers slightly 'growing' from the origin/reference element.
1181
- *
1182
- * This middleware must be applied after both `@sanity/ui/size` and `shift` middlewares.
1183
- */
1184
- const origin = {
1185
- name: "@sanity/ui/origin",
1186
- fn({ middlewareData, placement, rects }) {
1187
- let [side] = placement.split("-"), floatingWidth = rects.floating.width, floatingHeight = rects.floating.height, shiftX = middlewareData.shift?.x || 0, shiftY = middlewareData.shift?.y || 0;
1188
- if (floatingWidth <= 0 || floatingHeight <= 0) return {};
1189
- let { originX, originY } = ["bottom", "top"].includes(side) ? {
1190
- originX: clamp(.5 - shiftX / floatingWidth, 0, 1),
1191
- originY: side === "bottom" ? 0 : 1
1192
- } : {
1193
- originX: +(side === "left"),
1194
- originY: clamp(.5 - shiftY / floatingHeight, 0, 1)
1195
- };
1196
- return { data: {
1197
- originX,
1198
- originY
1199
- } };
1200
- }
1201
- };
1202
- function clamp(num, min, max) {
1203
- return Math.min(Math.max(num, min), max);
1204
- }
1205
- /**
1206
- * MIT License
1207
- *
1208
- * Copyright (c) 2024 Motion One
1209
- *
1210
- * Permission is hereby granted, free of charge, to any person obtaining a copy
1211
- * of this software and associated documentation files (the "Software"), to deal
1212
- * in the Software without restriction, including without limitation the rights
1213
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1214
- * copies of the Software, and to permit persons to whom the Software is
1215
- * furnished to do so, subject to the following conditions:
1216
- *
1217
- * The above copyright notice and this permission notice shall be included in all
1218
- * copies or substantial portions of the Software.
1219
- *
1220
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1221
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1222
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1223
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1224
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1225
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1226
- * SOFTWARE.
1227
- */
1228
- /**
1229
- * Animated version of React's `Activity` that defers `mode="hidden"` until
1230
- * child exit animations have finished.
1231
- *
1232
- * @internal
1233
- */
1234
- function AnimateActivity(t0) {
1235
- let $ = c(9), { mode: modeFromProps, layoutMode, children } = t0, [mode, setMode] = useState(modeFromProps), isPresent = modeFromProps === "visible";
1236
- if (isPresent && mode !== "visible") return setMode("visible"), null;
1237
- let t1;
1238
- $[0] === Symbol.for("react.memo_cache_sentinel") ? (t1 = () => setMode("hidden"), $[0] = t1) : t1 = $[0];
1239
- let onExitComplete = t1;
1240
- invariant(!!Activity, "Activity component not found - upgrade to React 19.2.0 or higher");
1241
- let t2 = isPresent ? void 0 : onExitComplete, t3 = layoutMode === "pop" ? "popLayout" : "sync", t4 = children, t5;
1242
- $[1] !== isPresent || $[2] !== t2 || $[3] !== t3 || $[4] !== t4 ? (t5 = /* @__PURE__ */ jsx(PresenceChild, {
1243
- isPresent,
1244
- onExitComplete: t2,
1245
- presenceAffectsLayout: !1,
1246
- mode: t3,
1247
- children: t4
1248
- }), $[1] = isPresent, $[2] = t2, $[3] = t3, $[4] = t4, $[5] = t5) : t5 = $[5];
1249
- let t6;
1250
- return $[6] !== mode || $[7] !== t5 ? (t6 = /* @__PURE__ */ jsx(Activity, {
1251
- mode,
1252
- children: t5
1253
- }), $[6] = mode, $[7] = t5, $[8] = t6) : t6 = $[8], t6;
1254
- }
1255
- function isRecord(value) {
1256
- return !!(value && typeof value == "object" && !Array.isArray(value));
1257
- }
1258
- const BoundaryElementContext = createGlobalScopedContext("@sanity/ui/context/boundaryElement", null), DEFAULT_VALUE = {
1259
- version: 0,
1260
- element: null
1261
- };
1262
- /**
1263
- * @public
1264
- */
1265
- function useBoundaryElement() {
1266
- let value = useContext(BoundaryElementContext);
1267
- if (value && (!isRecord(value) || value.version !== 0)) throw Error("useBoundaryElement(): the context value is not compatible");
1268
- return value || DEFAULT_VALUE;
1269
- }
1270
- function getElementRef(element) {
1271
- let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get, mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
1272
- 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);
1273
- }
1274
- function getLayerContext(contextValue) {
1275
- if (!isRecord(contextValue) || contextValue.version !== 0) throw Error("the context value is not compatible");
1276
- if (!contextValue) throw Error("components using `useLayer()` should be wrapped in a <LayerProvider>.");
1277
- if (contextValue.version === 0) return contextValue;
1278
- throw Error("could not get layer context");
1279
- }
1280
- const LayerContext = createGlobalScopedContext("@sanity/ui/context/layer", null);
1281
- /**
1282
- * @public
1283
- */
1284
- function LayerProvider(props) {
1285
- let $ = c(21), { children, zOffset: t0 } = props, zOffsetProp = t0 === void 0 ? 0 : t0, parentContextValue = useContext(LayerContext), t1;
1286
- $[0] === parentContextValue ? t1 = $[1] : (t1 = parentContextValue && getLayerContext(parentContextValue), $[0] = parentContextValue, $[1] = t1);
1287
- let parent = t1, parentRegisterChild = parent?.registerChild, level = (parent?.level ?? 0) + 1, t2;
1288
- $[2] === zOffsetProp ? t2 = $[3] : (t2 = _getArrayProp(zOffsetProp), $[2] = zOffsetProp, $[3] = t2);
1289
- let zOffset = t2, maxMediaIndex = zOffset.length - 1, mediaIndex = Math.min(useMediaIndex(), maxMediaIndex), zIndex = parent ? parent.zIndex + zOffset[mediaIndex] : zOffset[mediaIndex], t3;
1290
- $[4] === Symbol.for("react.memo_cache_sentinel") ? (t3 = {}, $[4] = t3) : t3 = $[4];
1291
- let [, setChildLayers] = useState(t3), [size, setSize] = useState(0), isTopLayer = size === 0, t4;
1292
- $[5] !== parentRegisterChild || $[6] !== setChildLayers ? (t4 = (childLevel) => {
1293
- let parentDispose = parentRegisterChild?.(childLevel);
1294
- return childLevel === void 0 ? setSize(_temp$13) : setChildLayers((state) => {
1295
- let prevLen = state[childLevel] ?? 0, nextState = {
1296
- ...state,
1297
- [childLevel]: prevLen + 1
1298
- };
1299
- return setSize(Object.keys(nextState).length), nextState;
1300
- }), () => {
1301
- childLevel === void 0 ? setSize(_temp2$4) : setChildLayers((state_0) => {
1302
- let nextState_0 = { ...state_0 };
1303
- return nextState_0[childLevel] === 1 ? (delete nextState_0[childLevel], setSize(Object.keys(nextState_0).length)) : nextState_0[childLevel] = nextState_0[childLevel] - 1, nextState_0;
1304
- }), parentDispose?.();
1305
- };
1306
- }, $[5] = parentRegisterChild, $[6] = setChildLayers, $[7] = t4) : t4 = $[7];
1307
- let registerChild = t4, t5, t6;
1308
- $[8] !== level || $[9] !== parentRegisterChild ? (t5 = () => parentRegisterChild?.(level), t6 = [level, parentRegisterChild], $[8] = level, $[9] = parentRegisterChild, $[10] = t5, $[11] = t6) : (t5 = $[10], t6 = $[11]), useEffect(t5, t6);
1309
- let t7;
1310
- $[12] !== isTopLayer || $[13] !== level || $[14] !== registerChild || $[15] !== size || $[16] !== zIndex ? (t7 = {
1311
- version: 0,
1312
- isTopLayer,
1313
- level,
1314
- registerChild,
1315
- size,
1316
- zIndex
1317
- }, $[12] = isTopLayer, $[13] = level, $[14] = registerChild, $[15] = size, $[16] = zIndex, $[17] = t7) : t7 = $[17];
1318
- let value = t7, t8;
1319
- return $[18] !== children || $[19] !== value ? (t8 = /* @__PURE__ */ jsx(LayerContext.Provider, {
1320
- value,
1321
- children
1322
- }), $[18] = children, $[19] = value, $[20] = t8) : t8 = $[20], t8;
1323
- }
1324
- function _temp2$4(v_0) {
1325
- return v_0 - 1;
1326
- }
1327
- function _temp$13(v) {
1328
- return v + 1;
1329
- }
1330
- /**
1331
- * @public
1332
- */
1333
- function useLayer() {
1334
- let $ = c(2), value = useContext(LayerContext);
1335
- if (!value) throw Error("useLayer(): missing context value");
1336
- try {
1337
- let t1;
1338
- return $[0] === value ? t1 = $[1] : (t1 = getLayerContext(value), $[0] = value, $[1] = t1), t1;
1339
- } catch (t0) {
1340
- let err = t0;
1341
- throw err instanceof Error ? Error(`useLayer(): ${err.message}`) : Error(`useLayer(): ${err}`);
1342
- }
1343
- }
1344
- const key = "@sanity/ui/context/portal", elementKey = Symbol.for(`${key}/element`);
1345
- globalScope[elementKey] = null;
1346
- const PortalContext = createGlobalScopedContext(key, {
1347
- version: 0,
1348
- boundaryElement: null,
1349
- get element() {
1350
- return typeof document > "u" ? null : globalScope[elementKey] ? globalScope[elementKey] : (globalScope[elementKey] = document.createElement("div"), globalScope[elementKey].setAttribute("data-portal", ""), document.body.appendChild(globalScope[elementKey]), globalScope[elementKey]);
1351
- }
1352
- });
1353
- /**
1354
- * @public
1355
- */
1356
- function usePortal() {
1357
- let value = useContext(PortalContext);
1358
- if (!value) throw Error("usePortal(): missing context value");
1359
- if (!isRecord(value) || value.version !== 0) throw Error("usePortal(): the context value is not compatible");
1360
- return value;
1361
- }
1362
- /**
1363
- * @public
1364
- */
1365
- function Portal(props) {
1366
- let $ = c(3), { children, __unstable_name: name } = props, portal = usePortal(), portalElement = (name ? portal.elements && portal.elements[name] : portal.element) || portal.elements?.default;
1367
- if (!portalElement) return null;
1368
- let t0;
1369
- return $[0] !== children || $[1] !== portalElement ? (t0 = createPortal(children, portalElement), $[0] = children, $[1] = portalElement, $[2] = t0) : t0 = $[2], t0;
1370
- }
1371
- const DEFAULT_POPOVER_MARGINS = [
1372
- 0,
1373
- 0,
1374
- 0,
1375
- 0
1376
- ], DEFAULT_FALLBACK_PLACEMENTS$1 = {
1377
- top: [
1378
- "bottom",
1379
- "left",
1380
- "right"
1381
- ],
1382
- "top-start": [
1383
- "bottom-start",
1384
- "left-start",
1385
- "right-start"
1386
- ],
1387
- "top-end": [
1388
- "bottom-end",
1389
- "left-end",
1390
- "right-end"
1391
- ],
1392
- bottom: [
1393
- "top",
1394
- "left",
1395
- "right"
1396
- ],
1397
- "bottom-start": [
1398
- "top-start",
1399
- "left-start",
1400
- "right-start"
1401
- ],
1402
- "bottom-end": [
1403
- "top-end",
1404
- "left-end",
1405
- "right-end"
1406
- ],
1407
- left: [
1408
- "right",
1409
- "top",
1410
- "bottom"
1411
- ],
1412
- "left-start": [
1413
- "right-start",
1414
- "top-start",
1415
- "bottom-start"
1416
- ],
1417
- "left-end": [
1418
- "right-end",
1419
- "top-end",
1420
- "bottom-end"
1421
- ],
1422
- right: [
1423
- "left",
1424
- "top",
1425
- "bottom"
1426
- ],
1427
- "right-start": [
1428
- "left-start",
1429
- "top-start",
1430
- "bottom-start"
1431
- ],
1432
- "right-end": [
1433
- "left-end",
1434
- "top-end",
1435
- "bottom-end"
1436
- ]
1437
- };
1438
- function size(options) {
1439
- let { constrainSize, margins, matchReferenceWidth, maxWidthRef, padding = 0, referenceWidthRef, setReferenceWidth, widthRef } = options;
1440
- return {
1441
- name: "@sanity/ui/size",
1442
- async fn(args) {
1443
- let { elements, placement, platform, rects } = args, { floating, reference } = rects, overflow = await detectOverflow(args, {
1444
- altBoundary: !0,
1445
- boundary: options.boundaryElement || void 0,
1446
- elementContext: "floating",
1447
- padding,
1448
- rootBoundary: "viewport"
1449
- }), maxWidth = Infinity, maxHeight = Infinity, floatingW = floating.width, floatingH = floating.height;
1450
- 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));
1451
- let availableWidth = maxWidth - margins[1] - margins[3], availableHeight = maxHeight - margins[0] - margins[2], referenceWidth = reference.width - margins[1] - margins[3];
1452
- referenceWidthRef.current = referenceWidth, setReferenceWidth(referenceWidth), matchReferenceWidth ? elements.floating.style.width = `${referenceWidth}px` : widthRef.current !== void 0 && (elements.floating.style.width = `${widthRef.current}px`), constrainSize && (elements.floating.style.maxWidth = `${Math.min(availableWidth, maxWidthRef.current ?? Infinity)}px`, elements.floating.style.maxHeight = `${availableHeight}px`);
1453
- let nextDimensions = await platform.getDimensions(elements.floating), targetH = nextDimensions.height;
1454
- return floatingW !== nextDimensions.width || floatingH !== targetH ? { reset: { rects: !0 } } : {};
1455
- }
1456
- };
1457
- }
1458
- function calcCurrentWidth(params) {
1459
- let { container, mediaIndex, width } = params, w = width[mediaIndex], currentWidth = w === void 0 ? width[width.length - 1] : w;
1460
- return typeof currentWidth == "number" ? container[currentWidth] : void 0;
1461
- }
1462
- function calcMaxWidth(params) {
1463
- let { boundaryWidth, currentWidth } = params;
1464
- if (currentWidth !== void 0 || boundaryWidth !== void 0) return Math.min(currentWidth ?? Infinity, (boundaryWidth || Infinity) - 8);
1465
- }
1466
- function moveTowardsLength(movingPoint, targetPoint, amount) {
1467
- let width = targetPoint.x - movingPoint.x, height = targetPoint.y - movingPoint.y, distance = Math.sqrt(width * width + height * height);
1468
- return moveTowardsFractional(movingPoint, targetPoint, Math.min(1, amount / distance));
1469
- }
1470
- function moveTowardsFractional(movingPoint, targetPoint, fraction) {
1471
- return {
1472
- x: movingPoint.x + (targetPoint.x - movingPoint.x) * fraction,
1473
- y: movingPoint.y + (targetPoint.y - movingPoint.y) * fraction
1474
- };
1475
- }
1476
- function getRoundedCommands(points) {
1477
- let len = points.length, cmds = [];
1478
- for (let i = 0; i < len; i += 1) {
1479
- let point = points[i], prevPoint = points[i - 1], nextPoint = points[i + 1];
1480
- if (prevPoint && point.radius) {
1481
- let curveStart = moveTowardsLength(point, prevPoint, point.radius), curveEnd = moveTowardsLength(point, nextPoint, point.radius), startControl = moveTowardsFractional(curveStart, point, .5), endControl = moveTowardsFractional(point, curveEnd, .5);
1482
- cmds.push({
1483
- type: "point",
1484
- ...curveStart
1485
- }), cmds.push({
1486
- type: "curve",
1487
- curveEnd,
1488
- startControl,
1489
- endControl
1490
- });
1491
- } else cmds.push({
1492
- type: "point",
1493
- ...point
1494
- });
1495
- }
1496
- return cmds;
1497
- }
1498
- function compileCommands(cmds) {
1499
- 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(" ");
1500
- }
1501
- const StyledArrow = /* @__PURE__ */ styled.div.withConfig({
1502
- displayName: "StyledArrow",
1503
- componentId: "sc-gl2lu8-0"
1504
- })(({ $w: w }) => css`position:absolute;width:${w}px;height:${w}px;:empty + &{display:none;}& > svg{display:block;line-height:0;transform-origin:${w / 2}px ${w / 2}px;}[data-placement^='top'] > &{bottom:-${w}px;& > svg{transform:rotate(0);}}[data-placement^='right'] > &{left:-${w}px;& > svg{transform:rotate(90deg);}}[data-placement^='left'] > &{right:-${w}px;& > svg{transform:rotate(-90deg);}}[data-placement^='bottom'] > &{top:-${w}px;& > svg{transform:rotate(180deg);}}`), StrokePath = styled.path.withConfig({
1505
- displayName: "StrokePath",
1506
- componentId: "sc-gl2lu8-1"
1507
- })`stroke:var(--card-shadow-outline-color);`, ShapePath = styled.path.withConfig({
1508
- displayName: "ShapePath",
1509
- componentId: "sc-gl2lu8-2"
1510
- })`fill:var(--card-bg-color);`, Arrow = function Arrow(props) {
1511
- let $ = c(30), h, ref, restProps, t0, w;
1512
- $[0] === props ? (h = $[1], ref = $[2], restProps = $[3], t0 = $[4], w = $[5]) : ({width: w, height: h, radius: t0, ref, ...restProps} = props, $[0] = props, $[1] = h, $[2] = ref, $[3] = restProps, $[4] = t0, $[5] = w);
1513
- let radius = t0 === void 0 ? 0 : t0, { card } = useTheme_v2(), strokeWidth = card.shadow.outline, center = w / 2, t1;
1514
- $[6] !== center || $[7] !== h || $[8] !== radius || $[9] !== w ? (t1 = compileCommands(getRoundedCommands([
1515
- {
1516
- x: 0,
1517
- y: 0
1518
- },
1519
- {
1520
- x: radius,
1521
- y: 0,
1522
- radius
1523
- },
1524
- {
1525
- x: center,
1526
- y: h - 1,
1527
- radius
1528
- },
1529
- {
1530
- x: w - radius,
1531
- y: 0,
1532
- radius
1533
- },
1534
- {
1535
- x: w,
1536
- y: 0
1537
- }
1538
- ])), $[6] = center, $[7] = h, $[8] = radius, $[9] = w, $[10] = t1) : t1 = $[10];
1539
- let path = t1, strokePath = `${path}`, fillPath = `${path} M ${w} -1 M 0 -1 Z`, t2 = `0 0 ${w} ${w}`, t3;
1540
- $[11] !== strokeWidth || $[12] !== w ? (t3 = /* @__PURE__ */ jsx("mask", {
1541
- id: "stroke-mask",
1542
- children: /* @__PURE__ */ jsx("rect", {
1543
- x: 0,
1544
- y: strokeWidth,
1545
- width: w,
1546
- height: w,
1547
- fill: "white"
1548
- })
1549
- }), $[11] = strokeWidth, $[12] = w, $[13] = t3) : t3 = $[13];
1550
- let t4 = strokeWidth * 2, t5;
1551
- $[14] !== strokePath || $[15] !== t4 ? (t5 = /* @__PURE__ */ jsx(StrokePath, {
1552
- d: strokePath,
1553
- mask: "url(#stroke-mask)",
1554
- strokeWidth: t4
1555
- }), $[14] = strokePath, $[15] = t4, $[16] = t5) : t5 = $[16];
1556
- let t6;
1557
- $[17] === fillPath ? t6 = $[18] : (t6 = /* @__PURE__ */ jsx(ShapePath, { d: fillPath }), $[17] = fillPath, $[18] = t6);
1558
- let t7;
1559
- $[19] !== t2 || $[20] !== t3 || $[21] !== t5 || $[22] !== t6 || $[23] !== w ? (t7 = /* @__PURE__ */ jsxs("svg", {
1560
- width: w,
1561
- height: w,
1562
- viewBox: t2,
1563
- children: [
1564
- t3,
1565
- t5,
1566
- t6
1567
- ]
1568
- }), $[19] = t2, $[20] = t3, $[21] = t5, $[22] = t6, $[23] = w, $[24] = t7) : t7 = $[24];
1569
- let t8;
1570
- return $[25] !== ref || $[26] !== restProps || $[27] !== t7 || $[28] !== w ? (t8 = /* @__PURE__ */ jsx(StyledArrow, {
1571
- ...restProps,
1572
- $w: w,
1573
- ref,
1574
- children: t7
1575
- }), $[25] = ref, $[26] = restProps, $[27] = t7, $[28] = w, $[29] = t8) : t8 = $[29], t8;
1576
- }, MotionCard$1 = styled(motion.create(Card)).withConfig({
1577
- displayName: "MotionCard",
1578
- componentId: "sc-go15t4-0"
1579
- })`&:not([hidden]){display:flex;}flex-direction:column;width:max-content;min-width:min-content;will-change:transform;`, MotionFlex$1 = styled(motion.create(Flex)).withConfig({
1580
- displayName: "MotionFlex",
1581
- componentId: "sc-go15t4-1"
1582
- })`will-change:opacity;`, PopoverCard = function PopoverCard(props) {
1583
- let $ = c(67), animate, arrow, arrowRef, arrowX, arrowY, children, marginsProp, originX, originY, overflow, padding, placement, radius, ref, restProps, scheme, shadow, strategy, style, tone, width, xProp, yProp;
1584
- $[0] === props ? (animate = $[1], arrow = $[2], arrowRef = $[3], arrowX = $[4], arrowY = $[5], children = $[6], marginsProp = $[7], originX = $[8], originY = $[9], overflow = $[10], padding = $[11], placement = $[12], radius = $[13], ref = $[14], restProps = $[15], scheme = $[16], shadow = $[17], strategy = $[18], style = $[19], tone = $[20], width = $[21], xProp = $[22], yProp = $[23]) : ({__unstable_margins: marginsProp, animate, arrow, arrowRef, arrowX, arrowY, children, padding, placement, originX, originY, overflow, radius, ref, scheme, shadow, strategy, style, tone, width, x: xProp, y: yProp, ...restProps} = props, $[0] = props, $[1] = animate, $[2] = arrow, $[3] = arrowRef, $[4] = arrowX, $[5] = arrowY, $[6] = children, $[7] = marginsProp, $[8] = originX, $[9] = originY, $[10] = overflow, $[11] = padding, $[12] = placement, $[13] = radius, $[14] = ref, $[15] = restProps, $[16] = scheme, $[17] = shadow, $[18] = strategy, $[19] = style, $[20] = tone, $[21] = width, $[22] = xProp, $[23] = yProp);
1585
- let { zIndex } = useLayer(), margins = marginsProp || DEFAULT_POPOVER_MARGINS, x = (xProp ?? 0) + margins[3], y = (yProp ?? 0) + margins[0], t0 = animate ? "transform" : void 0, t1;
1586
- $[24] !== originX || $[25] !== originY || $[26] !== strategy || $[27] !== style || $[28] !== t0 || $[29] !== width || $[30] !== x || $[31] !== y || $[32] !== zIndex ? (t1 = {
1587
- left: x,
1588
- originX,
1589
- originY,
1590
- position: strategy,
1591
- top: y,
1592
- width,
1593
- zIndex,
1594
- willChange: t0,
1595
- ...style
1596
- }, $[24] = originX, $[25] = originY, $[26] = strategy, $[27] = style, $[28] = t0, $[29] = width, $[30] = x, $[31] = y, $[32] = zIndex, $[33] = t1) : t1 = $[33];
1597
- let rootStyle = t1, t2 = arrowX === null ? void 0 : arrowX, t3 = arrowY === null ? void 0 : arrowY, t4;
1598
- $[34] !== t2 || $[35] !== t3 ? (t4 = {
1599
- left: t2,
1600
- top: t3,
1601
- right: void 0,
1602
- bottom: void 0
1603
- }, $[34] = t2, $[35] = t3, $[36] = t4) : t4 = $[36];
1604
- let arrowStyle = t4, t5 = restProps, t6;
1605
- $[37] === animate ? t6 = $[38] : (t6 = animate ? ["hidden", "initial"] : void 0, $[37] = animate, $[38] = t6);
1606
- let t7;
1607
- $[39] === animate ? t7 = $[40] : (t7 = animate ? ["visible", "scaleIn"] : void 0, $[39] = animate, $[40] = t7);
1608
- let t8;
1609
- $[41] === animate ? t8 = $[42] : (t8 = animate ? ["hidden", "scaleOut"] : void 0, $[41] = animate, $[42] = t8);
1610
- let t9;
1611
- $[43] !== children || $[44] !== padding ? (t9 = /* @__PURE__ */ jsx(Flex, {
1612
- direction: "column",
1613
- flex: 1,
1614
- padding,
1615
- children
1616
- }), $[43] = children, $[44] = padding, $[45] = t9) : t9 = $[45];
1617
- let t10;
1618
- $[46] !== overflow || $[47] !== t9 ? (t10 = /* @__PURE__ */ jsx(MotionFlex$1, {
1619
- "data-ui": "Popover__wrapper",
1620
- direction: "column",
1621
- flex: 1,
1622
- overflow,
1623
- variants: POPOVER_MOTION_PROPS.children,
1624
- transition: POPOVER_MOTION_PROPS.transition,
1625
- children: t9
1626
- }), $[46] = overflow, $[47] = t9, $[48] = t10) : t10 = $[48];
1627
- let t11;
1628
- $[49] !== arrow || $[50] !== arrowRef || $[51] !== arrowStyle ? (t11 = arrow && /* @__PURE__ */ jsx(Arrow, {
1629
- ref: arrowRef,
1630
- style: arrowStyle,
1631
- width: 19,
1632
- height: 8,
1633
- radius: 2
1634
- }), $[49] = arrow, $[50] = arrowRef, $[51] = arrowStyle, $[52] = t11) : t11 = $[52];
1635
- let t12;
1636
- return $[53] !== placement || $[54] !== radius || $[55] !== ref || $[56] !== rootStyle || $[57] !== scheme || $[58] !== shadow || $[59] !== t10 || $[60] !== t11 || $[61] !== t5 || $[62] !== t6 || $[63] !== t7 || $[64] !== t8 || $[65] !== tone ? (t12 = /* @__PURE__ */ jsxs(MotionCard$1, {
1637
- "data-ui": "Popover",
1638
- ...t5,
1639
- "data-placement": placement,
1640
- radius,
1641
- ref,
1642
- scheme,
1643
- shadow,
1644
- sizing: "border",
1645
- style: rootStyle,
1646
- tone,
1647
- variants: POPOVER_MOTION_PROPS.card,
1648
- transition: POPOVER_MOTION_PROPS.transition,
1649
- initial: t6,
1650
- animate: t7,
1651
- exit: t8,
1652
- children: [t10, t11]
1653
- }), $[53] = placement, $[54] = radius, $[55] = ref, $[56] = rootStyle, $[57] = scheme, $[58] = shadow, $[59] = t10, $[60] = t11, $[61] = t5, $[62] = t6, $[63] = t7, $[64] = t8, $[65] = tone, $[66] = t12) : t12 = $[66], t12;
1654
- }, ViewportOverlay = () => {
1655
- let $ = c(2), { zIndex } = useLayer(), t0;
1656
- return $[0] === zIndex ? t0 = $[1] : (t0 = /* @__PURE__ */ jsx("div", { style: {
1657
- height: "100vh",
1658
- inset: 0,
1659
- position: "fixed",
1660
- width: "100vw",
1661
- zIndex
1662
- } }), $[0] = zIndex, $[1] = t0), t0;
1663
- }, Popover = function Popover(props) {
1664
- let $ = c(126), { container, layer } = useTheme_v2(), boundaryElementContext = useBoundaryElement(), _fallbackPlacements, _floatingBoundary, _referenceBoundary, _zOffsetProp, childProp, content, disabled, forwardedRef, matchReferenceWidth, modal, open, paddingProp, portal, referenceElement, restProps, scheme, t0, t1, t10, t11, t2, t3, t4, t5, t6, t7, t8, t9, updateRef;
1665
- if ($[0] !== props) {
1666
- let { __unstable_margins: t12, animate: t13, arrow: t14, children: t15, constrainSize: t16, content: t17, disabled: t18, fallbackPlacements: t19, matchReferenceWidth: t20, floatingBoundary: t21, modal: t22, onActivate, open: t23, overflow: t24, padding: t25, placement: t26, placementStrategy: t27, portal: t28, preventOverflow: t29, radius: t30, ref: t31, referenceBoundary: t32, referenceElement: t33, scheme: t34, shadow: t35, tone: t36, width: t37, zOffset: t38, updateRef: t39, ...t40 } = props;
1667
- t0 = t12, t1 = t13, t2 = t14, childProp = t15, t3 = t16, content = t17, disabled = t18, _fallbackPlacements = t19, matchReferenceWidth = t20, _floatingBoundary = t21, modal = t22, open = t23, t4 = t24, paddingProp = t25, t5 = t26, t6 = t27, portal = t28, t7 = t29, t8 = t30, forwardedRef = t31, _referenceBoundary = t32, referenceElement = t33, scheme = t34, t9 = t35, t10 = t36, t11 = t37, _zOffsetProp = t38, updateRef = t39, restProps = t40, $[0] = props, $[1] = _fallbackPlacements, $[2] = _floatingBoundary, $[3] = _referenceBoundary, $[4] = _zOffsetProp, $[5] = childProp, $[6] = content, $[7] = disabled, $[8] = forwardedRef, $[9] = matchReferenceWidth, $[10] = modal, $[11] = open, $[12] = paddingProp, $[13] = portal, $[14] = referenceElement, $[15] = restProps, $[16] = scheme, $[17] = t0, $[18] = t1, $[19] = t10, $[20] = t11, $[21] = t2, $[22] = t3, $[23] = t4, $[24] = t5, $[25] = t6, $[26] = t7, $[27] = t8, $[28] = t9, $[29] = updateRef;
1668
- } else _fallbackPlacements = $[1], _floatingBoundary = $[2], _referenceBoundary = $[3], _zOffsetProp = $[4], childProp = $[5], content = $[6], disabled = $[7], forwardedRef = $[8], matchReferenceWidth = $[9], modal = $[10], open = $[11], paddingProp = $[12], portal = $[13], referenceElement = $[14], restProps = $[15], scheme = $[16], t0 = $[17], t1 = $[18], t10 = $[19], t11 = $[20], t2 = $[21], t3 = $[22], t4 = $[23], t5 = $[24], t6 = $[25], t7 = $[26], t8 = $[27], t9 = $[28], updateRef = $[29];
1669
- let margins = t0 === void 0 ? DEFAULT_POPOVER_MARGINS : t0, _animate = t1 !== void 0 && t1, arrowProp = t2 !== void 0 && t2, constrainSize = t3 !== void 0 && t3, overflow = t4 === void 0 ? "hidden" : t4, placementProp = t5 === void 0 ? "bottom" : t5, placementStrategy = t6 === void 0 ? "flip" : t6, preventOverflow = t7 === void 0 || t7, radiusProp = t8 === void 0 ? 3 : t8, shadowProp = t9 === void 0 ? 3 : t9, tone = t10 === void 0 ? "inherit" : t10, widthProp = t11 === void 0 ? "auto" : t11, fallbackPlacements = _fallbackPlacements ?? DEFAULT_FALLBACK_PLACEMENTS$1[props.placement ?? "bottom"], floatingBoundary = _floatingBoundary ?? boundaryElementContext.element, referenceBoundary = _referenceBoundary ?? boundaryElementContext.element, boundaryElement = boundaryElementContext.element ?? floatingBoundary, zOffsetProp = _zOffsetProp ?? layer.popover.zOffset, animate = !usePrefersReducedMotion() && _animate, boundarySize = useElementSize(boundaryElement)?.border, t12;
1670
- $[30] === paddingProp ? t12 = $[31] : (t12 = _getArrayProp(paddingProp), $[30] = paddingProp, $[31] = t12);
1671
- let padding = t12, t13;
1672
- $[32] === radiusProp ? t13 = $[33] : (t13 = _getArrayProp(radiusProp), $[32] = radiusProp, $[33] = t13);
1673
- let radius = t13, t14;
1674
- $[34] === shadowProp ? t14 = $[35] : (t14 = _getArrayProp(shadowProp), $[34] = shadowProp, $[35] = t14);
1675
- let shadow = t14, widthArrayProp = _getArrayProp(widthProp), t15;
1676
- $[36] === zOffsetProp ? t15 = $[37] : (t15 = _getArrayProp(zOffsetProp), $[36] = zOffsetProp, $[37] = t15);
1677
- let zOffset = t15, ref = useRef(null), arrowRef = useRef(null), t16;
1678
- $[38] === Symbol.for("react.memo_cache_sentinel") ? (t16 = () => ref.current, $[38] = t16) : t16 = $[38], useImperativeHandle(forwardedRef, t16);
1679
- let mediaIndex = useMediaIndex(), boundaryWidth = constrainSize || preventOverflow ? boundarySize?.width : void 0, width = calcCurrentWidth({
1680
- container,
1681
- mediaIndex,
1682
- width: widthArrayProp
1683
- }), widthRef = useRef(width), t17, t18;
1684
- $[39] === width ? (t17 = $[40], t18 = $[41]) : (t17 = () => {
1685
- widthRef.current = width;
1686
- }, t18 = [width], $[39] = width, $[40] = t17, $[41] = t18), useEffect(t17, t18);
1687
- let t19;
1688
- $[42] !== boundaryWidth || $[43] !== width ? (t19 = calcMaxWidth({
1689
- boundaryWidth,
1690
- currentWidth: width
1691
- }), $[42] = boundaryWidth, $[43] = width, $[44] = t19) : t19 = $[44];
1692
- let maxWidth = t19, maxWidthRef = useRef(maxWidth), t20, t21;
1693
- $[45] === maxWidth ? (t20 = $[46], t21 = $[47]) : (t20 = () => {
1694
- maxWidthRef.current = maxWidth;
1695
- }, t21 = [maxWidth], $[45] = maxWidth, $[46] = t20, $[47] = t21), useEffect(t20, t21);
1696
- let referenceWidthRef = useRef(void 0), t22, t23;
1697
- $[48] !== matchReferenceWidth || $[49] !== maxWidth || $[50] !== open || $[51] !== width ? (t22 = () => {
1698
- let floatingElement = ref.current;
1699
- if (!open || !floatingElement) return;
1700
- let referenceWidth = referenceWidthRef.current;
1701
- matchReferenceWidth ? referenceWidth !== void 0 && (floatingElement.style.width = `${referenceWidth}px`) : width !== void 0 && (floatingElement.style.width = `${width}px`), typeof maxWidth == "number" && (floatingElement.style.maxWidth = `${maxWidth}px`);
1702
- }, t23 = [
1703
- width,
1704
- matchReferenceWidth,
1705
- maxWidth,
1706
- open
1707
- ], $[48] = matchReferenceWidth, $[49] = maxWidth, $[50] = open, $[51] = width, $[52] = t22, $[53] = t23) : (t22 = $[52], t23 = $[53]), useEffect(t22, t23);
1708
- let [referenceWidth_0, setReferenceWidth] = useState(void 0), t24;
1709
- $[54] !== animate || $[55] !== arrowProp || $[56] !== constrainSize || $[57] !== fallbackPlacements || $[58] !== floatingBoundary || $[59] !== margins || $[60] !== matchReferenceWidth || $[61] !== placementProp || $[62] !== placementStrategy || $[63] !== preventOverflow || $[64] !== referenceBoundary ? (t24 = {
1710
- animate,
1711
- arrowProp,
1712
- arrowRef,
1713
- constrainSize,
1714
- fallbackPlacements,
1715
- floatingBoundary,
1716
- margins,
1717
- matchReferenceWidth,
1718
- maxWidthRef,
1719
- placementProp,
1720
- placementStrategy,
1721
- preventOverflow,
1722
- referenceBoundary,
1723
- referenceWidthRef,
1724
- rootBoundary: "viewport",
1725
- setReferenceWidth,
1726
- widthRef
1727
- }, $[54] = animate, $[55] = arrowProp, $[56] = constrainSize, $[57] = fallbackPlacements, $[58] = floatingBoundary, $[59] = margins, $[60] = matchReferenceWidth, $[61] = placementProp, $[62] = placementStrategy, $[63] = preventOverflow, $[64] = referenceBoundary, $[65] = t24) : t24 = $[65];
1728
- let middleware = useMiddleware$1(t24), t25;
1729
- $[66] === referenceElement ? t25 = $[67] : (t25 = referenceElement ? { reference: referenceElement } : void 0, $[66] = referenceElement, $[67] = t25);
1730
- let t26;
1731
- $[68] !== middleware || $[69] !== placementProp || $[70] !== t25 ? (t26 = {
1732
- middleware,
1733
- placement: placementProp,
1734
- whileElementsMounted: autoUpdate,
1735
- elements: t25
1736
- }, $[68] = middleware, $[69] = placementProp, $[70] = t25, $[71] = t26) : t26 = $[71];
1737
- let { x, y, middlewareData, placement, refs, strategy, update } = useFloating(t26), referenceHidden = middlewareData.hide?.referenceHidden, arrowX = middlewareData.arrow?.x, arrowY = middlewareData.arrow?.y, originX = middlewareData["@sanity/ui/origin"]?.originX, originY = middlewareData["@sanity/ui/origin"]?.originY, t27;
1738
- $[72] === Symbol.for("react.memo_cache_sentinel") ? (t27 = (arrowEl) => {
1739
- arrowRef.current = arrowEl;
1740
- }, $[72] = t27) : t27 = $[72];
1741
- let setArrow = t27, t28;
1742
- $[73] === refs ? t28 = $[74] : (t28 = (node) => {
1743
- ref.current = node, refs.setFloating(node);
1744
- }, $[73] = refs, $[74] = t28);
1745
- let setFloating = t28, t29;
1746
- $[75] === childProp ? t29 = $[76] : (t29 = childProp ? getElementRef(childProp) : null, $[75] = childProp, $[76] = t29);
1747
- let t30;
1748
- $[77] === refs.reference.current ? t30 = $[78] : (t30 = () => refs.reference.current, $[77] = refs.reference.current, $[78] = t30), useImperativeHandle(t29, t30);
1749
- let t31;
1750
- bb0: {
1751
- if (referenceElement) {
1752
- t31 = childProp;
1753
- break bb0;
1754
- }
1755
- if (!childProp) {
1756
- t31 = null;
1757
- break bb0;
1758
- }
1759
- let t32;
1760
- $[79] !== childProp || $[80] !== refs.setReference ? (t32 = cloneElement(childProp, { ref: refs.setReference }), $[79] = childProp, $[80] = refs.setReference, $[81] = t32) : t32 = $[81], t31 = t32;
1761
- }
1762
- let child = t31, t32, t33;
1763
- if ($[82] === update ? (t32 = $[83], t33 = $[84]) : (t32 = () => update, t33 = [update], $[82] = update, $[83] = t32, $[84] = t33), useImperativeHandle(updateRef, t32, t33), disabled) {
1764
- let t34;
1765
- return $[85] === childProp ? t34 = $[86] : (t34 = childProp || /* @__PURE__ */ jsx(Fragment$1, {}), $[85] = childProp, $[86] = t34), t34;
1766
- }
1767
- let t34;
1768
- $[87] === modal ? t34 = $[88] : (t34 = modal && /* @__PURE__ */ jsx(ViewportOverlay, {}), $[87] = modal, $[88] = t34);
1769
- let t35 = matchReferenceWidth ? referenceWidth_0 : width, t36;
1770
- $[89] !== animate || $[90] !== arrowProp || $[91] !== arrowX || $[92] !== arrowY || $[93] !== content || $[94] !== margins || $[95] !== originX || $[96] !== originY || $[97] !== overflow || $[98] !== padding || $[99] !== placement || $[100] !== radius || $[101] !== referenceHidden || $[102] !== restProps || $[103] !== scheme || $[104] !== setFloating || $[105] !== shadow || $[106] !== strategy || $[107] !== t35 || $[108] !== tone || $[109] !== x || $[110] !== y ? (t36 = /* @__PURE__ */ jsx(PopoverCard, {
1771
- ...restProps,
1772
- __unstable_margins: margins,
1773
- animate,
1774
- arrow: arrowProp,
1775
- arrowRef: setArrow,
1776
- arrowX,
1777
- arrowY,
1778
- hidden: referenceHidden,
1779
- overflow,
1780
- padding,
1781
- placement,
1782
- radius,
1783
- ref: setFloating,
1784
- scheme,
1785
- shadow,
1786
- originX,
1787
- originY,
1788
- strategy,
1789
- tone,
1790
- width: t35,
1791
- x,
1792
- y,
1793
- children: content
1794
- }), $[89] = animate, $[90] = arrowProp, $[91] = arrowX, $[92] = arrowY, $[93] = content, $[94] = margins, $[95] = originX, $[96] = originY, $[97] = overflow, $[98] = padding, $[99] = placement, $[100] = radius, $[101] = referenceHidden, $[102] = restProps, $[103] = scheme, $[104] = setFloating, $[105] = shadow, $[106] = strategy, $[107] = t35, $[108] = tone, $[109] = x, $[110] = y, $[111] = t36) : t36 = $[111];
1795
- let t37;
1796
- $[112] !== t34 || $[113] !== t36 || $[114] !== zOffset ? (t37 = /* @__PURE__ */ jsxs(LayerProvider, {
1797
- zOffset,
1798
- children: [t34, t36]
1799
- }), $[112] = t34, $[113] = t36, $[114] = zOffset, $[115] = t37) : t37 = $[115];
1800
- let popover = t37, t38;
1801
- $[116] !== popover || $[117] !== portal ? (t38 = portal ? /* @__PURE__ */ jsx(Portal, {
1802
- __unstable_name: typeof portal == "string" ? portal : void 0,
1803
- children: popover
1804
- }) : popover, $[116] = popover, $[117] = portal, $[118] = t38) : t38 = $[118];
1805
- let popoverNode = t38, t39;
1806
- $[119] !== animate || $[120] !== open || $[121] !== popoverNode ? (t39 = animate ? /* @__PURE__ */ jsx(AnimateActivity, {
1807
- layoutMode: "default",
1808
- mode: open ? "visible" : "hidden",
1809
- children: popoverNode
1810
- }) : /* @__PURE__ */ jsx(Activity, {
1811
- mode: open ? "visible" : "hidden",
1812
- children: popoverNode
1813
- }), $[119] = animate, $[120] = open, $[121] = popoverNode, $[122] = t39) : t39 = $[122];
1814
- let t40;
1815
- return $[123] !== child || $[124] !== t39 ? (t40 = /* @__PURE__ */ jsxs(Fragment$1, { children: [t39, child] }), $[123] = child, $[124] = t39, $[125] = t40) : t40 = $[125], t40;
1816
- };
1817
- function useMiddleware$1(t0) {
1818
- let $ = c(42), { animate, arrowProp, arrowRef, constrainSize, fallbackPlacements, floatingBoundary, margins, matchReferenceWidth, maxWidthRef, placementProp, placementStrategy, preventOverflow, referenceBoundary, referenceWidthRef, rootBoundary, setReferenceWidth, widthRef } = t0, ret;
1819
- if ($[0] !== animate || $[1] !== arrowProp || $[2] !== arrowRef || $[3] !== constrainSize || $[4] !== fallbackPlacements || $[5] !== floatingBoundary || $[6] !== margins || $[7] !== matchReferenceWidth || $[8] !== maxWidthRef || $[9] !== placementProp || $[10] !== placementStrategy || $[11] !== preventOverflow || $[12] !== referenceBoundary || $[13] !== referenceWidthRef || $[14] !== rootBoundary || $[15] !== setReferenceWidth || $[16] !== widthRef) {
1820
- if (ret = [], constrainSize || preventOverflow) if (placementStrategy === "autoPlacement") {
1821
- let t1;
1822
- $[18] !== fallbackPlacements || $[19] !== placementProp ? (t1 = autoPlacement({ allowedPlacements: [placementProp].concat(fallbackPlacements) }), $[18] = fallbackPlacements, $[19] = placementProp, $[20] = t1) : t1 = $[20], ret.push(t1);
1823
- } else {
1824
- let t1 = floatingBoundary || void 0, t2;
1825
- $[21] !== fallbackPlacements || $[22] !== rootBoundary || $[23] !== t1 ? (t2 = flip({
1826
- boundary: t1,
1827
- fallbackPlacements,
1828
- padding: 4,
1829
- rootBoundary
1830
- }), $[21] = fallbackPlacements, $[22] = rootBoundary, $[23] = t1, $[24] = t2) : t2 = $[24], ret.push(t2);
1831
- }
1832
- let t1;
1833
- if ($[25] === Symbol.for("react.memo_cache_sentinel") ? (t1 = offset({ mainAxis: 4 }), $[25] = t1) : t1 = $[25], ret.push(t1), constrainSize || matchReferenceWidth) {
1834
- let t2 = floatingBoundary || void 0, t3;
1835
- $[26] !== constrainSize || $[27] !== margins || $[28] !== matchReferenceWidth || $[29] !== maxWidthRef || $[30] !== referenceWidthRef || $[31] !== setReferenceWidth || $[32] !== t2 || $[33] !== widthRef ? (t3 = size({
1836
- boundaryElement: t2,
1837
- constrainSize,
1838
- margins,
1839
- matchReferenceWidth,
1840
- maxWidthRef,
1841
- padding: 4,
1842
- referenceWidthRef,
1843
- setReferenceWidth,
1844
- widthRef
1845
- }), $[26] = constrainSize, $[27] = margins, $[28] = matchReferenceWidth, $[29] = maxWidthRef, $[30] = referenceWidthRef, $[31] = setReferenceWidth, $[32] = t2, $[33] = widthRef, $[34] = t3) : t3 = $[34], ret.push(t3);
1846
- }
1847
- if (preventOverflow) {
1848
- let t2 = floatingBoundary || void 0, t3;
1849
- $[35] !== rootBoundary || $[36] !== t2 ? (t3 = shift({
1850
- boundary: t2,
1851
- rootBoundary,
1852
- padding: 4
1853
- }), $[35] = rootBoundary, $[36] = t2, $[37] = t3) : t3 = $[37], ret.push(t3);
1854
- }
1855
- if (arrowProp) {
1856
- let t2;
1857
- $[38] === arrowRef ? t2 = $[39] : (t2 = arrow({
1858
- element: arrowRef,
1859
- padding: 4
1860
- }), $[38] = arrowRef, $[39] = t2), ret.push(t2);
1861
- }
1862
- animate && ret.push(origin);
1863
- let t2 = referenceBoundary || void 0, t3;
1864
- $[40] === t2 ? t3 = $[41] : (t3 = hide({
1865
- boundary: t2,
1866
- padding: 4,
1867
- strategy: "referenceHidden"
1868
- }), $[40] = t2, $[41] = t3), ret.push(t3), $[0] = animate, $[1] = arrowProp, $[2] = arrowRef, $[3] = constrainSize, $[4] = fallbackPlacements, $[5] = floatingBoundary, $[6] = margins, $[7] = matchReferenceWidth, $[8] = maxWidthRef, $[9] = placementProp, $[10] = placementStrategy, $[11] = preventOverflow, $[12] = referenceBoundary, $[13] = referenceWidthRef, $[14] = rootBoundary, $[15] = setReferenceWidth, $[16] = widthRef, $[17] = ret;
1869
- } else ret = $[17];
1870
- return ret;
1871
- }
1872
- const BASE_STYLE$1 = {
1873
- "&&:not([hidden])": { display: "grid" },
1874
- "&[data-as=\"ul\"],&[data-as=\"ol\"]": { listStyle: "none" },
1875
- gridTemplateColumns: "minmax(0, 1fr)",
1876
- gridAutoRows: "min-content"
1877
- };
1878
- function stackBaseStyle() {
1879
- return BASE_STYLE$1;
1880
- }
1881
- function responsiveStackSpaceStyle(props) {
1882
- let { media, space } = getTheme_v2(props.theme);
1883
- return _responsive(media, props.$space, (spaceIndex) => ({ gridGap: rem(space[spaceIndex]) }));
1884
- }
1885
- const StyledStack = /* @__PURE__ */ styled(Box).withConfig({
1886
- displayName: "StyledStack",
1887
- componentId: "sc-9rj35p-0"
1888
- })(stackBaseStyle, responsiveStackSpaceStyle), Stack = function Stack(props) {
1889
- let $ = c(13), as, gap, ref, restProps;
1890
- $[0] === props ? (as = $[1], gap = $[2], ref = $[3], restProps = $[4]) : ({as, gap, ref, ...restProps} = props, $[0] = props, $[1] = as, $[2] = gap, $[3] = ref, $[4] = restProps);
1891
- let t0 = typeof as == "string" ? as : void 0, t1;
1892
- $[5] === gap ? t1 = $[6] : (t1 = _getArrayProp(gap), $[5] = gap, $[6] = t1);
1893
- let t2;
1894
- return $[7] !== as || $[8] !== ref || $[9] !== restProps || $[10] !== t0 || $[11] !== t1 ? (t2 = /* @__PURE__ */ jsx(StyledStack, {
1895
- "data-as": t0,
1896
- "data-ui": "Stack",
1897
- ...restProps,
1898
- $space: t1,
1899
- forwardedAs: as,
1900
- ref
1901
- }), $[7] = as, $[8] = ref, $[9] = restProps, $[10] = t0, $[11] = t1, $[12] = t2) : t2 = $[12], t2;
1902
- };
1903
- /**
1904
- * @beta
1905
- */
1906
- function useCustomValidity(ref, customValidity) {
1907
- let $ = c(4), t0, t1;
1908
- $[0] !== customValidity || $[1] !== ref ? (t0 = () => {
1909
- ref.current?.setCustomValidity(customValidity || "");
1910
- }, t1 = [customValidity, ref], $[0] = customValidity, $[1] = ref, $[2] = t0, $[3] = t1) : (t0 = $[2], t1 = $[3]), useEffect(t0, t1);
1911
- }
1912
- function responsiveInputPaddingStyle(props) {
1913
- let { $fontSize, $iconLeft, $iconRight, $padding, $space } = props, { font, media, space } = getTheme_v2(props.theme), len = Math.max($padding.length, $space.length, $fontSize.length), _padding = [], _space = [], _fontSize = [];
1914
- for (let i = 0; i < len; i += 1) _fontSize[i] = $fontSize[i] === void 0 ? _fontSize[i - 1] : $fontSize[i], _padding[i] = $padding[i] === void 0 ? _padding[i - 1] : $padding[i], _space[i] = $space[i] === void 0 ? _space[i - 1] : $space[i];
1915
- return _responsive(media, _padding, (_, i) => {
1916
- let size = font.text.sizes[_fontSize[i]] || font.text.sizes[2], emSize = size.lineHeight - size.ascenderHeight - size.descenderHeight, p = space[_padding[i]], s = space[_space[i]], styles = {
1917
- paddingTop: rem(p - size.ascenderHeight),
1918
- paddingRight: rem(p),
1919
- paddingBottom: rem(p - size.descenderHeight),
1920
- paddingLeft: rem(p)
1921
- };
1922
- return $iconRight && (styles.paddingRight = rem(p + emSize + s)), $iconLeft && (styles.paddingLeft = rem(p + emSize + s)), styles;
1923
- });
1924
- }
1925
- function responsiveInputPaddingIconRightStyle(props) {
1926
- return responsiveInputPaddingStyle({
1927
- ...props,
1928
- $iconRight: !0
1929
- });
1930
- }
1931
- const ROOT_STYLE = css`&:not([hidden]){display:flex;}align-items:center;`;
1932
- function textInputRootStyle() {
1933
- return ROOT_STYLE;
1934
- }
1935
- function textInputBaseStyle(props) {
1936
- let { $scheme, $tone, $weight } = props, { color, font } = getTheme_v2(props.theme);
1937
- return css`appearance:none;background:none;border:0;border-radius:0;outline:none;width:100%;box-sizing:border-box;font-family:${font.text.family};font-weight:${$weight && font.text.weights[$weight] || font.text.weights.regular};margin:0;position:relative;z-index:1;display:block;&:-webkit-autofill,&:-webkit-autofill:hover,&:-webkit-autofill:focus,&:-webkit-autofill:active{-webkit-text-fill-color:var(--input-fg-color) !important;transition:background-color 5000s;transition-delay:86400s;}&[data-as='textarea']{resize:none;}color:var(--input-fg-color);&::placeholder{color:var(--input-placeholder-color);}&[data-scheme='${$scheme}'][data-tone='${$tone}']{--input-fg-color:${color.input.default.enabled.fg};--input-placeholder-color:${color.input.default.enabled.placeholder};&:not(:invalid):not(:disabled):not(:read-only){--input-fg-color:${color.input.default.enabled.fg};--input-placeholder-color:${color.input.default.enabled.placeholder};}&:not(:invalid):disabled{--input-fg-color:${color.input.default.disabled.fg};--input-placeholder-color:${color.input.default.disabled.placeholder};}&:invalid{--input-fg-color:${color.input.invalid.enabled.fg};--input-placeholder-color:${color.input.invalid.enabled.placeholder};}&:read-only{--input-fg-color:${color.input.default.readOnly.fg};--input-placeholder-color:${color.input.default.readOnly.placeholder};}}`;
1938
- }
1939
- function textInputFontSizeStyle(props) {
1940
- let { font, media } = getTheme_v2(props.theme);
1941
- return _responsive(media, props.$fontSize, (sizeIndex) => {
1942
- let size = font.text.sizes[sizeIndex] || font.text.sizes[2];
1943
- return {
1944
- fontSize: rem(size.fontSize),
1945
- lineHeight: `${size.lineHeight / size.fontSize}`
1946
- };
1947
- });
1948
- }
1949
- function textInputRepresentationStyle(props) {
1950
- let { $hasPrefix, $hasSuffix, $scheme, $tone, $unstableDisableFocusRing } = props, { color, input } = getTheme_v2(props.theme);
1951
- return css`--input-box-shadow:none;position:absolute;top:0;left:0;right:0;bottom:0;display:block;pointer-events:none;z-index:0;background-color:var(--card-bg-color);box-shadow:var(--input-box-shadow);border-top-left-radius:${$hasPrefix ? 0 : void 0};border-bottom-left-radius:${$hasPrefix ? 0 : void 0};border-top-right-radius:${$hasSuffix ? 0 : void 0};border-bottom-right-radius:${$hasSuffix ? 0 : void 0};&[data-scheme='${$scheme}'][data-tone='${$tone}']{--card-bg-color:${color.input.default.enabled.bg};--card-fg-color:${color.input.default.enabled.fg};*:not(:disabled) + &[data-border]{--input-box-shadow:${focusRingBorderStyle({
1952
- color: color.input.default.enabled.border,
1953
- width: input.border.width
1954
- })};}*:not(:disabled):invalid + &{--card-bg-color:${color.input.invalid.enabled.bg};--card-fg-color:${color.input.invalid.enabled.fg};&[data-border]{--input-box-shadow:${focusRingBorderStyle({
1955
- color: color.input.invalid.enabled.border,
1956
- width: input.border.width
1957
- })};}}*:not(:disabled):focus + &{&[data-border]{--input-box-shadow:${$unstableDisableFocusRing ? void 0 : focusRingStyle({
1958
- border: {
1959
- color: color.input.default.enabled.border,
1960
- width: input.border.width
1961
- },
1962
- focusRing: input.text.focusRing
1963
- })};}&:not([data-border]){--input-box-shadow:${$unstableDisableFocusRing ? void 0 : focusRingStyle({ focusRing: input.text.focusRing })};}}*:not(:invalid):disabled + &{--card-bg-color:${color.input.default.disabled.bg} !important;--card-fg-color:${color.input.default.disabled.fg} !important;--card-icon-color:${color.input.default.disabled.fg} !important;&[data-border]{--input-box-shadow:${focusRingBorderStyle({
1964
- color: color.input.default.disabled.border,
1965
- width: input.border.width
1966
- })};}}*:invalid:disabled + &{--card-bg-color:${color.input.invalid.disabled.bg} !important;--card-fg-color:${color.input.invalid.disabled.fg} !important;--card-icon-color:${color.input.invalid.disabled.fg} !important;&[data-border]{--input-box-shadow:${focusRingBorderStyle({
1967
- color: color.input.invalid.disabled.border,
1968
- width: input.border.width
1969
- })};}}*:not(:invalid):read-only + &{--card-bg-color:${color.input.default.readOnly.bg} !important;--card-fg-color:${color.input.default.readOnly.fg} !important;}*:invalid:read-only + &{--card-bg-color:${color.input.invalid.readOnly.bg} !important;--card-fg-color:${color.input.invalid.readOnly.fg} !important;}@media (hover:hover){*:not(:disabled):not(:read-only):not(:invalid):hover + &{--card-bg-color:${color.input.default.hovered.bg};--card-fg-color:${color.input.default.hovered.fg};}*:invalid:not(:disabled):not(:read-only):hover + &{--card-bg-color:${color.input.invalid.hovered.bg};--card-fg-color:${color.input.invalid.hovered.fg};}*:not(:disabled):not(:read-only):not(:invalid):not(:focus):hover + &[data-border]{--input-box-shadow:${focusRingBorderStyle({
1970
- color: color.input.default.hovered.border,
1971
- width: input.border.width
1972
- })};}*:invalid:not(:disabled):not(:read-only):not(:focus):hover + &[data-border]{--input-box-shadow:${focusRingBorderStyle({
1973
- color: color.input.invalid.hovered.border,
1974
- width: input.border.width
1975
- })};}}}`;
1976
- }
1977
- const CLEAR_BUTTON_BOX_STYLE = { zIndex: 2 }, StyledTextInput = /* @__PURE__ */ styled(Card).attrs({ forwardedAs: "span" }).withConfig({
1978
- displayName: "StyledTextInput",
1979
- componentId: "sc-jgyv6p-0"
1980
- })(textInputRootStyle), InputRoot$1 = styled.span.withConfig({
1981
- displayName: "InputRoot",
1982
- componentId: "sc-jgyv6p-1"
1983
- })`flex:1;min-width:0;display:block;position:relative;`, Prefix = styled(Card).attrs({ forwardedAs: "span" }).withConfig({
1984
- displayName: "Prefix",
1985
- componentId: "sc-jgyv6p-2"
1986
- })`border-top-right-radius:0;border-bottom-right-radius:0;& > span{display:block;margin:-1px;}`, Suffix = styled(Card).attrs({ forwardedAs: "span" }).withConfig({
1987
- displayName: "Suffix",
1988
- componentId: "sc-jgyv6p-3"
1989
- })`border-top-left-radius:0;border-bottom-left-radius:0;& > span{display:block;margin:-1px;}`, Input$5 = /* @__PURE__ */ styled.input.withConfig({
1990
- displayName: "Input",
1991
- componentId: "sc-jgyv6p-4"
1992
- })(responsiveInputPaddingStyle, textInputBaseStyle, textInputFontSizeStyle), Presentation$1 = /* @__PURE__ */ styled.span.withConfig({
1993
- displayName: "Presentation",
1994
- componentId: "sc-jgyv6p-5"
1995
- })(responsiveRadiusStyle, textInputRepresentationStyle), LeftBox = styled(Box).withConfig({
1996
- displayName: "LeftBox",
1997
- componentId: "sc-jgyv6p-6"
1998
- })`position:absolute;top:0;left:0;`, RightBox = styled(Box).withConfig({
1999
- displayName: "RightBox",
2000
- componentId: "sc-jgyv6p-7"
2001
- })`position:absolute;top:0;right:0;`, RightCard = styled(Card).withConfig({
2002
- displayName: "RightCard",
2003
- componentId: "sc-jgyv6p-8"
2004
- })`background-color:transparent;position:absolute;top:0;right:0;`, TextInputClearButton = /* @__PURE__ */ styled(Button).withConfig({
2005
- displayName: "TextInputClearButton",
2006
- componentId: "sc-jgyv6p-9"
2007
- })({ "&:not([hidden])": { display: "block" } }), TextInput = function TextInput(props) {
2008
- let $ = c(93), IconComponent, IconRightComponent, __unstable_disableFocusRing, clearButton, customValidity, forwardedRef, onClear, prefix, readOnly, restProps, suffix, t0, t1, t2, t3, t4, t5, t6, weight;
2009
- $[0] === props ? (IconComponent = $[1], IconRightComponent = $[2], __unstable_disableFocusRing = $[3], clearButton = $[4], customValidity = $[5], forwardedRef = $[6], onClear = $[7], prefix = $[8], readOnly = $[9], restProps = $[10], suffix = $[11], t0 = $[12], t1 = $[13], t2 = $[14], t3 = $[15], t4 = $[16], t5 = $[17], t6 = $[18], weight = $[19]) : ({__unstable_disableFocusRing, border: t0, clearButton, disabled: t1, fontSize: t2, gap: t3, icon: IconComponent, iconRight: IconRightComponent, onClear, padding: t4, prefix, radius: t5, readOnly, ref: forwardedRef, suffix, customValidity, type: t6, weight, ...restProps} = props, $[0] = props, $[1] = IconComponent, $[2] = IconRightComponent, $[3] = __unstable_disableFocusRing, $[4] = clearButton, $[5] = customValidity, $[6] = forwardedRef, $[7] = onClear, $[8] = prefix, $[9] = readOnly, $[10] = restProps, $[11] = suffix, $[12] = t0, $[13] = t1, $[14] = t2, $[15] = t3, $[16] = t4, $[17] = t5, $[18] = t6, $[19] = weight);
2010
- let border = t0 === void 0 || t0, disabled = t1 !== void 0 && t1, fontSizeProp = t2 === void 0 ? 2 : t2, gap = t3 === void 0 ? 3 : t3, paddingProp = t4 === void 0 ? 3 : t4, radiusProp = t5 === void 0 ? 2 : t5, type = t6 === void 0 ? "text" : t6, ref = useRef(null), rootTheme = useRootTheme(), t7;
2011
- $[20] === fontSizeProp ? t7 = $[21] : (t7 = _getArrayProp(fontSizeProp), $[20] = fontSizeProp, $[21] = t7);
2012
- let fontSize = t7, t8;
2013
- $[22] === paddingProp ? t8 = $[23] : (t8 = _getArrayProp(paddingProp), $[22] = paddingProp, $[23] = t8);
2014
- let padding = t8, t9;
2015
- $[24] === radiusProp ? t9 = $[25] : (t9 = _getArrayProp(radiusProp), $[24] = radiusProp, $[25] = t9);
2016
- let radius = t9, t10;
2017
- $[26] === gap ? t10 = $[27] : (t10 = _getArrayProp(gap), $[26] = gap, $[27] = t10);
2018
- let space = t10, $hasClearButton = !!clearButton, $hasIcon = !!IconComponent, $hasIconRight = !!IconRightComponent, $hasSuffix = !!suffix, $hasPrefix = !!prefix, t11;
2019
- $[28] === Symbol.for("react.memo_cache_sentinel") ? (t11 = () => ref.current, $[28] = t11) : t11 = $[28], useImperativeHandle(forwardedRef, t11), useCustomValidity(ref, customValidity);
2020
- let handleClearMouseDown = _temp$12, t12;
2021
- $[29] === onClear ? t12 = $[30] : (t12 = (event_0) => {
2022
- event_0.preventDefault(), event_0.stopPropagation(), onClear && onClear(), ref.current?.focus();
2023
- }, $[29] = onClear, $[30] = t12);
2024
- let handleClearClick = t12, t13;
2025
- $[31] !== prefix || $[32] !== radius ? (t13 = prefix && /* @__PURE__ */ jsx(Prefix, {
2026
- borderTop: !0,
2027
- borderLeft: !0,
2028
- borderBottom: !0,
2029
- radius,
2030
- sizing: "border",
2031
- tone: "inherit",
2032
- children: /* @__PURE__ */ jsx("span", { children: prefix })
2033
- }), $[31] = prefix, $[32] = radius, $[33] = t13) : t13 = $[33];
2034
- let prefixNode = t13, t14 = border ? "" : void 0, t15;
2035
- $[34] !== IconComponent || $[35] !== fontSize || $[36] !== padding ? (t15 = IconComponent && /* @__PURE__ */ jsx(LeftBox, {
2036
- padding,
2037
- children: /* @__PURE__ */ jsxs(Text, {
2038
- size: fontSize,
2039
- children: [isValidElement(IconComponent) && IconComponent, isValidElementType(IconComponent) && /* @__PURE__ */ jsx(IconComponent, {})]
2040
- })
2041
- }), $[34] = IconComponent, $[35] = fontSize, $[36] = padding, $[37] = t15) : t15 = $[37];
2042
- let t16;
2043
- $[38] !== $hasClearButton || $[39] !== IconRightComponent || $[40] !== fontSize || $[41] !== padding ? (t16 = !$hasClearButton && IconRightComponent && /* @__PURE__ */ jsx(RightBox, {
2044
- padding,
2045
- children: /* @__PURE__ */ jsxs(Text, {
2046
- size: fontSize,
2047
- children: [isValidElement(IconRightComponent) && IconRightComponent, isValidElementType(IconRightComponent) && /* @__PURE__ */ jsx(IconRightComponent, {})]
2048
- })
2049
- }), $[38] = $hasClearButton, $[39] = IconRightComponent, $[40] = fontSize, $[41] = padding, $[42] = t16) : t16 = $[42];
2050
- let t17;
2051
- $[43] !== $hasPrefix || $[44] !== $hasSuffix || $[45] !== __unstable_disableFocusRing || $[46] !== radius || $[47] !== rootTheme.scheme || $[48] !== rootTheme.tone || $[49] !== t14 || $[50] !== t15 || $[51] !== t16 ? (t17 = /* @__PURE__ */ jsxs(Presentation$1, {
2052
- $hasPrefix,
2053
- $unstableDisableFocusRing: __unstable_disableFocusRing,
2054
- $hasSuffix,
2055
- $radius: radius,
2056
- $scheme: rootTheme.scheme,
2057
- $tone: rootTheme.tone,
2058
- "data-border": t14,
2059
- "data-scheme": rootTheme.scheme,
2060
- "data-tone": rootTheme.tone,
2061
- children: [t15, t16]
2062
- }), $[43] = $hasPrefix, $[44] = $hasSuffix, $[45] = __unstable_disableFocusRing, $[46] = radius, $[47] = rootTheme.scheme, $[48] = rootTheme.tone, $[49] = t14, $[50] = t15, $[51] = t16, $[52] = t17) : t17 = $[52];
2063
- let presentationNode = t17, t18;
2064
- $[53] === padding ? t18 = $[54] : (t18 = padding.map(_temp2$3), $[53] = padding, $[54] = t18);
2065
- let clearButtonBoxPadding = t18, t19;
2066
- $[55] === padding ? t19 = $[56] : (t19 = padding.map(_temp3), $[55] = padding, $[56] = t19);
2067
- let clearButtonPadding = t19, clearButtonProps = typeof clearButton == "object" ? clearButton : EMPTY_RECORD, t20;
2068
- $[57] !== clearButton || $[58] !== clearButtonBoxPadding || $[59] !== clearButtonPadding || $[60] !== clearButtonProps || $[61] !== customValidity || $[62] !== disabled || $[63] !== fontSize || $[64] !== handleClearClick || $[65] !== radius || $[66] !== readOnly ? (t20 = !disabled && !readOnly && clearButton && /* @__PURE__ */ jsx(RightCard, {
2069
- forwardedAs: "span",
2070
- padding: clearButtonBoxPadding,
2071
- style: CLEAR_BUTTON_BOX_STYLE,
2072
- tone: customValidity ? "critical" : "inherit",
2073
- children: /* @__PURE__ */ jsx(TextInputClearButton, {
2074
- "aria-label": "Clear",
2075
- "data-qa": "clear-button",
2076
- fontSize,
2077
- icon: CloseIcon,
2078
- mode: "bleed",
2079
- padding: clearButtonPadding,
2080
- radius,
2081
- ...clearButtonProps,
2082
- onClick: handleClearClick,
2083
- onMouseDown: handleClearMouseDown
2084
- })
2085
- }), $[57] = clearButton, $[58] = clearButtonBoxPadding, $[59] = clearButtonPadding, $[60] = clearButtonProps, $[61] = customValidity, $[62] = disabled, $[63] = fontSize, $[64] = handleClearClick, $[65] = radius, $[66] = readOnly, $[67] = t20) : t20 = $[67];
2086
- let clearButtonNode = t20, t21;
2087
- $[68] !== radius || $[69] !== suffix ? (t21 = suffix && /* @__PURE__ */ jsx(Suffix, {
2088
- borderTop: !0,
2089
- borderRight: !0,
2090
- borderBottom: !0,
2091
- radius,
2092
- sizing: "border",
2093
- tone: "inherit",
2094
- children: /* @__PURE__ */ jsx("span", { children: suffix })
2095
- }), $[68] = radius, $[69] = suffix, $[70] = t21) : t21 = $[70];
2096
- let suffixNode = t21, t22 = $hasIconRight || $hasClearButton, t23;
2097
- $[71] !== $hasIcon || $[72] !== disabled || $[73] !== fontSize || $[74] !== padding || $[75] !== readOnly || $[76] !== restProps || $[77] !== rootTheme.scheme || $[78] !== rootTheme.tone || $[79] !== space || $[80] !== t22 || $[81] !== type || $[82] !== weight ? (t23 = /* @__PURE__ */ jsx(Input$5, {
2098
- "data-as": "input",
2099
- "data-scheme": rootTheme.scheme,
2100
- "data-tone": rootTheme.tone,
2101
- ...restProps,
2102
- $fontSize: fontSize,
2103
- $iconLeft: $hasIcon,
2104
- $iconRight: t22,
2105
- $padding: padding,
2106
- $scheme: rootTheme.scheme,
2107
- $space: space,
2108
- $tone: rootTheme.tone,
2109
- $weight: weight,
2110
- disabled,
2111
- readOnly,
2112
- ref,
2113
- type
2114
- }), $[71] = $hasIcon, $[72] = disabled, $[73] = fontSize, $[74] = padding, $[75] = readOnly, $[76] = restProps, $[77] = rootTheme.scheme, $[78] = rootTheme.tone, $[79] = space, $[80] = t22, $[81] = type, $[82] = weight, $[83] = t23) : t23 = $[83];
2115
- let t24;
2116
- $[84] !== clearButtonNode || $[85] !== presentationNode || $[86] !== t23 ? (t24 = /* @__PURE__ */ jsxs(InputRoot$1, { children: [
2117
- t23,
2118
- presentationNode,
2119
- clearButtonNode
2120
- ] }), $[84] = clearButtonNode, $[85] = presentationNode, $[86] = t23, $[87] = t24) : t24 = $[87];
2121
- let t25;
2122
- return $[88] !== prefixNode || $[89] !== rootTheme.tone || $[90] !== suffixNode || $[91] !== t24 ? (t25 = /* @__PURE__ */ jsxs(StyledTextInput, {
2123
- "data-ui": "TextInput",
2124
- tone: rootTheme.tone,
2125
- children: [
2126
- prefixNode,
2127
- t24,
2128
- suffixNode
2129
- ]
2130
- }), $[88] = prefixNode, $[89] = rootTheme.tone, $[90] = suffixNode, $[91] = t24, $[92] = t25) : t25 = $[92], t25;
2131
- };
2132
- function _temp$12(event) {
2133
- event.preventDefault(), event.stopPropagation();
2134
- }
2135
- function _temp2$3(v) {
2136
- return v === 0 ? 0 : v === 1 || v === 2 ? 1 : v - 2;
2137
- }
2138
- function _temp3(v_0) {
2139
- return v_0 === 0 || v_0 === 1 ? 0 : v_0 === 2 ? 1 : v_0 - 1;
2140
- }
2141
- /**
2142
- * @internal
2143
- */
2144
- const StyledAutocomplete = styled.div.withConfig({
2145
- displayName: "StyledAutocomplete",
2146
- componentId: "sc-ilitn5-0"
2147
- })`line-height:0;`, ListBox = styled(Box).withConfig({
2148
- displayName: "ListBox",
2149
- componentId: "sc-ilitn5-1"
2150
- })`& > ul{list-style:none;padding:0;margin:0;}`, rotate = keyframes`from{transform:rotate(0deg);}to{transform:rotate(360deg);}`, AnimatedSpinnerIcon = styled(SpinnerIcon).withConfig({
2151
- displayName: "AnimatedSpinnerIcon",
2152
- componentId: "sc-ilitn5-2"
2153
- })`animation:${rotate} 500ms linear infinite;`;
2154
- function AutocompleteOption(props) {
2155
- let $ = c(11), { children, id, onSelect, selected, value } = props, t0;
2156
- $[0] !== onSelect || $[1] !== value ? (t0 = () => {
2157
- setTimeout(() => {
2158
- onSelect(value);
2159
- }, 0);
2160
- }, $[0] = onSelect, $[1] = value, $[2] = t0) : t0 = $[2];
2161
- let handleClick = t0, t1;
2162
- $[3] === handleClick ? t1 = $[4] : (t1 = (event) => {
2163
- event.key === "Enter" && !_isEnterToClickElement(event.currentTarget) && handleClick();
2164
- }, $[3] = handleClick, $[4] = t1);
2165
- let handleKeyDown = t1, t2;
2166
- return $[5] !== children || $[6] !== handleClick || $[7] !== handleKeyDown || $[8] !== id || $[9] !== selected ? (t2 = /* @__PURE__ */ jsx("li", {
2167
- "aria-selected": selected,
2168
- "data-ui": "AutocompleteOption",
2169
- id,
2170
- role: "option",
2171
- onClick: handleClick,
2172
- onKeyDown: handleKeyDown,
2173
- children
2174
- }), $[5] = children, $[6] = handleClick, $[7] = handleKeyDown, $[8] = id, $[9] = selected, $[10] = t2) : t2 = $[10], t2;
2175
- }
2176
- /**
2177
- * @internal
2178
- */
2179
- function autocompleteReducer(state, msg) {
2180
- return msg.type === "input/change" ? {
2181
- ...state,
2182
- activeValue: null,
2183
- focused: !0,
2184
- query: msg.query
2185
- } : msg.type === "input/focus" ? {
2186
- ...state,
2187
- focused: !0
2188
- } : msg.type === "root/blur" ? {
2189
- ...state,
2190
- focused: !1,
2191
- query: null
2192
- } : msg.type === "root/clear" ? {
2193
- ...state,
2194
- activeValue: null,
2195
- query: null,
2196
- value: null
2197
- } : msg.type === "root/escape" ? {
2198
- ...state,
2199
- focused: !1,
2200
- query: null
2201
- } : msg.type === "root/open" ? {
2202
- ...state,
2203
- query: state.query || msg.query
2204
- } : msg.type === "root/setActiveValue" ? {
2205
- ...state,
2206
- activeValue: msg.value,
2207
- listFocused: msg.listFocused || state.listFocused
2208
- } : msg.type === "root/setListFocused" ? {
2209
- ...state,
2210
- listFocused: msg.listFocused
2211
- } : msg.type === "value/change" ? {
2212
- ...state,
2213
- activeValue: msg.value,
2214
- query: null,
2215
- value: msg.value
2216
- } : state;
2217
- }
2218
- /**
2219
- * @internal
2220
- */
2221
- const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = [
2222
- "Control",
2223
- "Shift",
2224
- "Alt",
2225
- "Enter",
2226
- "Home",
2227
- "End",
2228
- "PageUp",
2229
- "PageDown",
2230
- "Meta",
2231
- "Tab",
2232
- "CapsLock"
2233
- ], AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS = ["bottom-start", "top-start"], DEFAULT_RENDER_VALUE = (value, option) => option ? option.value : value, DEFAULT_FILTER_OPTION = (query, option) => option.value.toLowerCase().indexOf(query.toLowerCase()) > -1, Autocomplete = function Autocomplete(props) {
2234
- let $ = c(182), customValidity, disabled, filterOptionProp, forwardedRef, icon, id, loading, onBlur, onChange, onFocus, onQueryChange, onSelect, openButton, openOnFocus, optionsProp, prefix, readOnly, relatedElements, renderOptionProp, renderPopover, restProps, suffix, t0, t1, t2, t3, t4, t5, t6, valueProp;
2235
- $[0] === props ? (customValidity = $[1], disabled = $[2], filterOptionProp = $[3], forwardedRef = $[4], icon = $[5], id = $[6], loading = $[7], onBlur = $[8], onChange = $[9], onFocus = $[10], onQueryChange = $[11], onSelect = $[12], openButton = $[13], openOnFocus = $[14], optionsProp = $[15], prefix = $[16], readOnly = $[17], relatedElements = $[18], renderOptionProp = $[19], renderPopover = $[20], restProps = $[21], suffix = $[22], t0 = $[23], t1 = $[24], t2 = $[25], t3 = $[26], t4 = $[27], t5 = $[28], t6 = $[29], valueProp = $[30]) : ({border: t0, customValidity, disabled, filterOption: filterOptionProp, fontSize: t1, icon, id, listBox: t2, loading, onBlur, onChange, onFocus, onQueryChange, onSelect, openButton, openOnFocus, options: optionsProp, padding: t3, popover: t4, prefix, radius: t5, readOnly, ref: forwardedRef, relatedElements, renderOption: renderOptionProp, renderPopover, renderValue: t6, suffix, value: valueProp, ...restProps} = props, $[0] = props, $[1] = customValidity, $[2] = disabled, $[3] = filterOptionProp, $[4] = forwardedRef, $[5] = icon, $[6] = id, $[7] = loading, $[8] = onBlur, $[9] = onChange, $[10] = onFocus, $[11] = onQueryChange, $[12] = onSelect, $[13] = openButton, $[14] = openOnFocus, $[15] = optionsProp, $[16] = prefix, $[17] = readOnly, $[18] = relatedElements, $[19] = renderOptionProp, $[20] = renderPopover, $[21] = restProps, $[22] = suffix, $[23] = t0, $[24] = t1, $[25] = t2, $[26] = t3, $[27] = t4, $[28] = t5, $[29] = t6, $[30] = valueProp);
2236
- let border = t0 === void 0 || t0, fontSize = t1 === void 0 ? 2 : t1, listBox = t2 === void 0 ? EMPTY_RECORD : t2, paddingProp = t3 === void 0 ? 3 : t3, popover = t4 === void 0 ? EMPTY_RECORD : t4, radius = t5 === void 0 ? 2 : t5, renderValue = t6 === void 0 ? DEFAULT_RENDER_VALUE : t6, t7 = valueProp || null, t8 = valueProp || null, t9;
2237
- $[31] !== t7 || $[32] !== t8 ? (t9 = {
2238
- activeValue: t7,
2239
- focused: !1,
2240
- listFocused: !1,
2241
- query: null,
2242
- value: t8
2243
- }, $[31] = t7, $[32] = t8, $[33] = t9) : t9 = $[33];
2244
- let [state, dispatch] = useReducer(autocompleteReducer, t9), { activeValue, focused, listFocused, query, value } = state, t10;
2245
- $[34] !== fontSize || $[35] !== paddingProp ? (t10 = (t11) => {
2246
- let { value: value_0 } = t11;
2247
- return /* @__PURE__ */ jsx(Card, {
2248
- "data-as": "button",
2249
- padding: paddingProp,
2250
- radius: 2,
2251
- tone: "inherit",
2252
- children: /* @__PURE__ */ jsx(Text, {
2253
- size: fontSize,
2254
- textOverflow: "ellipsis",
2255
- children: value_0
2256
- })
2257
- });
2258
- }, $[34] = fontSize, $[35] = paddingProp, $[36] = t10) : t10 = $[36];
2259
- let renderOption = typeof renderOptionProp == "function" ? renderOptionProp : t10, filterOption = typeof filterOptionProp == "function" ? filterOptionProp : DEFAULT_FILTER_OPTION, rootElementRef = useRef(null), resultsPopoverElementRef = useRef(null), inputElementRef = useRef(null), listBoxElementRef = useRef(null), [inputElement, _setInputElement] = useState(null), t11;
2260
- $[37] === Symbol.for("react.memo_cache_sentinel") ? (t11 = (node) => {
2261
- startTransition(() => _setInputElement(node));
2262
- }, $[37] = t11) : t11 = $[37];
2263
- let setInputElement = t11, listFocusedRef = useRef(!1), valueRef = useRef(value), valuePropRef = useRef(valueProp), popoverMouseWithinRef = useRef(!1), t12, t13;
2264
- $[38] === inputElement ? (t12 = $[39], t13 = $[40]) : (t12 = () => inputElement, t13 = [inputElement], $[38] = inputElement, $[39] = t12, $[40] = t13), useImperativeHandle(inputElementRef, t12, t13);
2265
- let t14, t15;
2266
- $[41] === inputElement ? (t14 = $[42], t15 = $[43]) : (t14 = () => inputElement, t15 = [inputElement], $[41] = inputElement, $[42] = t14, $[43] = t15), useImperativeHandle(forwardedRef, t14, t15);
2267
- let listBoxId = `${id}-listbox`, options = Array.isArray(optionsProp) ? optionsProp : EMPTY_ARRAY, padding = _getArrayProp(paddingProp), t16;
2268
- $[44] !== options || $[45] !== value ? (t16 = value === null ? void 0 : options.find((o) => o.value === value), $[44] = options, $[45] = value, $[46] = t16) : t16 = $[46];
2269
- let currentOption = t16, t17;
2270
- if ($[47] !== filterOption || $[48] !== options || $[49] !== query) {
2271
- let t18;
2272
- $[51] !== filterOption || $[52] !== query ? (t18 = (option) => !query || filterOption(query, option), $[51] = filterOption, $[52] = query, $[53] = t18) : t18 = $[53], t17 = options.filter(t18), $[47] = filterOption, $[48] = options, $[49] = query, $[50] = t17;
2273
- } else t17 = $[50];
2274
- let filteredOptions = t17, filteredOptionsLen = filteredOptions.length, activeItemId = activeValue ? `${id}-option-${activeValue}` : void 0, expanded = query !== null && loading || focused && query !== null, t18;
2275
- $[54] !== onBlur || $[55] !== onQueryChange || $[56] !== relatedElements ? (t18 = (event) => {
2276
- setTimeout(() => {
2277
- if (popoverMouseWithinRef.current) return;
2278
- let elements = (relatedElements || []).concat(rootElementRef.current ? [rootElementRef.current] : [], resultsPopoverElementRef.current ? [resultsPopoverElementRef.current] : []), focusInside = !1;
2279
- if (document.activeElement) {
2280
- for (let e of elements) if (e === document.activeElement || e.contains(document.activeElement)) {
2281
- focusInside = !0;
2282
- break;
2283
- }
2284
- }
2285
- focusInside === !1 && (dispatch({ type: "root/blur" }), popoverMouseWithinRef.current = !1, onQueryChange && onQueryChange(null), onBlur && onBlur(event));
2286
- }, 0);
2287
- }, $[54] = onBlur, $[55] = onQueryChange, $[56] = relatedElements, $[57] = t18) : t18 = $[57];
2288
- let handleRootBlur = t18, t19;
2289
- $[58] === Symbol.for("react.memo_cache_sentinel") ? (t19 = (event_0) => {
2290
- let listBoxElement = listBoxElementRef.current, focusedElement = event_0.target instanceof HTMLElement ? event_0.target : null, listFocused_0 = listBoxElement?.contains(focusedElement) || !1;
2291
- listFocused_0 !== listFocusedRef.current && (listFocusedRef.current = listFocused_0, dispatch({
2292
- type: "root/setListFocused",
2293
- listFocused: listFocused_0
2294
- }));
2295
- }, $[58] = t19) : t19 = $[58];
2296
- let handleRootFocus = t19, t20;
2297
- $[59] !== onChange || $[60] !== onQueryChange || $[61] !== onSelect ? (t20 = (v) => {
2298
- dispatch({
2299
- type: "value/change",
2300
- value: v
2301
- }), popoverMouseWithinRef.current = !1, onSelect && onSelect(v), valueRef.current = v, onChange && onChange(v), onQueryChange && onQueryChange(null), inputElementRef.current?.focus();
2302
- }, $[59] = onChange, $[60] = onQueryChange, $[61] = onSelect, $[62] = t20) : t20 = $[62];
2303
- let handleOptionSelect = t20, t21;
2304
- $[63] !== activeValue || $[64] !== filteredOptions || $[65] !== filteredOptionsLen || $[66] !== onQueryChange ? (t21 = (event_1) => {
2305
- if (event_1.key === "ArrowDown") {
2306
- if (event_1.preventDefault(), !filteredOptionsLen) return;
2307
- let activeOption = filteredOptions.find((o_0) => o_0.value === activeValue), activeIndex = activeOption ? filteredOptions.indexOf(activeOption) : -1, nextActiveOption = filteredOptions[(activeIndex + 1) % filteredOptionsLen];
2308
- nextActiveOption && dispatch({
2309
- type: "root/setActiveValue",
2310
- value: nextActiveOption.value,
2311
- listFocused: !0
2312
- });
2313
- return;
2314
- }
2315
- if (event_1.key === "ArrowUp") {
2316
- if (event_1.preventDefault(), !filteredOptionsLen) return;
2317
- let 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];
2318
- nextActiveOption_0 && dispatch({
2319
- type: "root/setActiveValue",
2320
- value: nextActiveOption_0.value,
2321
- listFocused: !0
2322
- });
2323
- return;
2324
- }
2325
- if (event_1.key === "Escape") {
2326
- dispatch({ type: "root/escape" }), popoverMouseWithinRef.current = !1, onQueryChange && onQueryChange(null), inputElementRef.current?.focus();
2327
- return;
2328
- }
2329
- let target = event_1.target, listEl = listBoxElementRef.current;
2330
- if ((listEl === target || listEl?.contains(target)) && !AUTOCOMPLETE_LISTBOX_IGNORE_KEYS.includes(event_1.key)) {
2331
- inputElementRef.current?.focus();
2332
- return;
2333
- }
2334
- }, $[63] = activeValue, $[64] = filteredOptions, $[65] = filteredOptionsLen, $[66] = onQueryChange, $[67] = t21) : t21 = $[67];
2335
- let handleRootKeyDown = t21, t22;
2336
- $[68] === onQueryChange ? t22 = $[69] : (t22 = (event_2) => {
2337
- let nextQuery = event_2.currentTarget.value;
2338
- dispatch({
2339
- type: "input/change",
2340
- query: nextQuery
2341
- }), onQueryChange && onQueryChange(nextQuery);
2342
- }, $[68] = onQueryChange, $[69] = t22);
2343
- let handleInputChange = t22, t23;
2344
- $[70] !== currentOption || $[71] !== renderValue || $[72] !== value ? (t23 = () => {
2345
- dispatch({
2346
- type: "root/open",
2347
- query: value ? renderValue(value, currentOption) : ""
2348
- });
2349
- }, $[70] = currentOption, $[71] = renderValue, $[72] = value, $[73] = t23) : t23 = $[73];
2350
- let dispatchOpen = t23, t24;
2351
- $[74] !== dispatchOpen || $[75] !== focused || $[76] !== onFocus || $[77] !== openOnFocus ? (t24 = (event_3) => {
2352
- focused || (dispatch({ type: "input/focus" }), onFocus && onFocus(event_3), openOnFocus && dispatchOpen());
2353
- }, $[74] = dispatchOpen, $[75] = focused, $[76] = onFocus, $[77] = openOnFocus, $[78] = t24) : t24 = $[78];
2354
- let handleInputFocus = t24, t25;
2355
- $[79] === Symbol.for("react.memo_cache_sentinel") ? (t25 = () => {
2356
- popoverMouseWithinRef.current = !0;
2357
- }, $[79] = t25) : t25 = $[79];
2358
- let handlePopoverMouseEnter = t25, t26;
2359
- $[80] === Symbol.for("react.memo_cache_sentinel") ? (t26 = () => {
2360
- popoverMouseWithinRef.current = !1;
2361
- }, $[80] = t26) : t26 = $[80];
2362
- let handlePopoverMouseLeave = t26, t27;
2363
- $[81] !== onChange || $[82] !== onQueryChange ? (t27 = () => {
2364
- dispatch({ type: "root/clear" }), valueRef.current = "", onChange && onChange(""), onQueryChange && onQueryChange(null), inputElementRef.current?.focus();
2365
- }, $[81] = onChange, $[82] = onQueryChange, $[83] = t27) : t27 = $[83];
2366
- let handleClearButtonClick = t27, t28;
2367
- $[84] === Symbol.for("react.memo_cache_sentinel") ? (t28 = () => {
2368
- dispatch({ type: "input/focus" });
2369
- }, $[84] = t28) : t28 = $[84];
2370
- let handleClearButtonFocus = t28, t29, t30;
2371
- $[85] === valueProp ? (t29 = $[86], t30 = $[87]) : (t29 = () => {
2372
- if (valueProp !== valuePropRef.current) {
2373
- valuePropRef.current = valueProp, valueProp !== void 0 && (dispatch({
2374
- type: "value/change",
2375
- value: valueProp
2376
- }), valueRef.current = valueProp);
2377
- return;
2378
- }
2379
- valueProp !== valueRef.current && (valueRef.current = valueProp || null, dispatch({
2380
- type: "value/change",
2381
- value: valueProp || null
2382
- }));
2383
- }, t30 = [valueProp], $[85] = valueProp, $[86] = t29, $[87] = t30), useEffect(t29, t30);
2384
- let t31, t32;
2385
- $[88] === focused ? (t31 = $[89], t32 = $[90]) : (t31 = () => {
2386
- !focused && valueRef.current && dispatch({
2387
- type: "root/setActiveValue",
2388
- value: valueRef.current
2389
- });
2390
- }, t32 = [focused], $[88] = focused, $[89] = t31, $[90] = t32), useEffect(t31, t32);
2391
- let t33, t34;
2392
- $[91] !== activeValue || $[92] !== filteredOptions ? (t33 = () => {
2393
- let listElement = listBoxElementRef.current;
2394
- if (!listElement) return;
2395
- let activeOption_1 = filteredOptions.find((o_2) => o_2.value === activeValue);
2396
- if (activeOption_1) {
2397
- let activeIndex_1 = filteredOptions.indexOf(activeOption_1), activeItemElement = listElement.childNodes[activeIndex_1];
2398
- if (activeItemElement) {
2399
- if (_hasFocus(activeItemElement)) return;
2400
- focusFirstDescendant(activeItemElement);
2401
- }
2402
- }
2403
- }, t34 = [activeValue, filteredOptions], $[91] = activeValue, $[92] = filteredOptions, $[93] = t33, $[94] = t34) : (t33 = $[93], t34 = $[94]), useEffect(t33, t34);
2404
- let t35;
2405
- bb0: {
2406
- if (!loading && !disabled && value) {
2407
- let t36;
2408
- $[95] === Symbol.for("react.memo_cache_sentinel") ? (t36 = {
2409
- "aria-label": "Clear",
2410
- onFocus: handleClearButtonFocus
2411
- }, $[95] = t36) : t36 = $[95], t35 = t36;
2412
- break bb0;
2413
- }
2414
- t35 = void 0;
2415
- }
2416
- let clearButton = t35, openButtonBoxPadding = padding.map(_temp$11), openButtonPadding = padding.map(_temp2$2), openButtonProps = typeof openButton == "object" ? openButton : EMPTY_RECORD, t36;
2417
- $[96] !== dispatchOpen || $[97] !== openButtonProps ? (t36 = (event_4) => {
2418
- dispatchOpen(), openButtonProps.onClick && openButtonProps.onClick(event_4), _raf(() => inputElementRef.current?.focus());
2419
- }, $[96] = dispatchOpen, $[97] = openButtonProps, $[98] = t36) : t36 = $[98];
2420
- let handleOpenClick = t36, t37;
2421
- $[99] !== disabled || $[100] !== expanded || $[101] !== fontSize || $[102] !== handleOpenClick || $[103] !== openButton || $[104] !== openButtonBoxPadding || $[105] !== openButtonPadding || $[106] !== openButtonProps || $[107] !== readOnly ? (t37 = !disabled && !readOnly && openButton ? /* @__PURE__ */ jsx(Box, {
2422
- "aria-hidden": expanded,
2423
- padding: openButtonBoxPadding,
2424
- children: /* @__PURE__ */ jsx(Button, {
2425
- "aria-label": "Open",
2426
- disabled: expanded,
2427
- fontSize,
2428
- icon: ChevronDownIcon,
2429
- mode: "bleed",
2430
- padding: openButtonPadding,
2431
- ...openButtonProps,
2432
- onClick: handleOpenClick
2433
- })
2434
- }) : void 0, $[99] = disabled, $[100] = expanded, $[101] = fontSize, $[102] = handleOpenClick, $[103] = openButton, $[104] = openButtonBoxPadding, $[105] = openButtonPadding, $[106] = openButtonProps, $[107] = readOnly, $[108] = t37) : t37 = $[108];
2435
- let openButtonNode = t37, t38;
2436
- bb1: {
2437
- if (query === null) {
2438
- if (value !== null) {
2439
- let t39;
2440
- $[109] !== currentOption || $[110] !== renderValue || $[111] !== value ? (t39 = renderValue(value, currentOption), $[109] = currentOption, $[110] = renderValue, $[111] = value, $[112] = t39) : t39 = $[112], t38 = t39;
2441
- break bb1;
2442
- }
2443
- t38 = "";
2444
- break bb1;
2445
- }
2446
- t38 = query;
2447
- }
2448
- let inputValue = t38, t39;
2449
- $[113] === listFocused ? t39 = $[114] : (t39 = (event_5) => {
2450
- event_5.key === "Tab" && listFocused && inputElementRef.current?.focus();
2451
- }, $[113] = listFocused, $[114] = t39);
2452
- let handleListBoxKeyDown = t39, t40;
2453
- bb2: {
2454
- if (filteredOptions.length === 0) {
2455
- t40 = null;
2456
- break bb2;
2457
- }
2458
- let t41;
2459
- if ($[115] !== activeValue || $[116] !== currentOption || $[117] !== filteredOptions || $[118] !== handleOptionSelect || $[119] !== id || $[120] !== listFocused || $[121] !== loading || $[122] !== renderOption) {
2460
- let t42;
2461
- $[124] !== activeValue || $[125] !== currentOption || $[126] !== handleOptionSelect || $[127] !== id || $[128] !== listFocused || $[129] !== loading || $[130] !== renderOption ? (t42 = (option_0) => {
2462
- let active = activeValue === null ? currentOption === option_0 : option_0.value === activeValue;
2463
- return /* @__PURE__ */ jsx(AutocompleteOption, {
2464
- id: `${id}-option-${option_0.value}`,
2465
- onSelect: handleOptionSelect,
2466
- selected: active,
2467
- value: option_0.value,
2468
- children: cloneElement(renderOption(option_0), {
2469
- disabled: loading,
2470
- selected: active,
2471
- tabIndex: listFocused && active ? 0 : -1
2472
- })
2473
- }, option_0.value);
2474
- }, $[124] = activeValue, $[125] = currentOption, $[126] = handleOptionSelect, $[127] = id, $[128] = listFocused, $[129] = loading, $[130] = renderOption, $[131] = t42) : t42 = $[131], t41 = filteredOptions.map(t42), $[115] = activeValue, $[116] = currentOption, $[117] = filteredOptions, $[118] = handleOptionSelect, $[119] = id, $[120] = listFocused, $[121] = loading, $[122] = renderOption, $[123] = t41;
2475
- } else t41 = $[123];
2476
- let t42;
2477
- $[132] !== listBoxId || $[133] !== t41 ? (t42 = /* @__PURE__ */ jsx(Stack, {
2478
- as: "ul",
2479
- "aria-multiselectable": !1,
2480
- "data-ui": "AutoComplete__resultsList",
2481
- id: listBoxId,
2482
- ref: listBoxElementRef,
2483
- role: "listbox",
2484
- gap: 1,
2485
- children: t41
2486
- }), $[132] = listBoxId, $[133] = t41, $[134] = t42) : t42 = $[134];
2487
- let t43;
2488
- $[135] !== handleListBoxKeyDown || $[136] !== listBox || $[137] !== t42 ? (t43 = /* @__PURE__ */ jsx(ListBox, {
2489
- "data-ui": "AutoComplete__results",
2490
- onKeyDown: handleListBoxKeyDown,
2491
- padding: 1,
2492
- ...listBox,
2493
- tabIndex: -1,
2494
- children: t42
2495
- }), $[135] = handleListBoxKeyDown, $[136] = listBox, $[137] = t42, $[138] = t43) : t43 = $[138], t40 = t43;
2496
- }
2497
- let content = t40, t41;
2498
- bb3: {
2499
- if (renderPopover) {
2500
- let t42 = !expanded, t43;
2501
- $[139] !== content || $[140] !== handlePopoverMouseEnter || $[141] !== handlePopoverMouseLeave || $[142] !== inputElement || $[143] !== renderPopover || $[144] !== t42 ? (t43 = /* @__PURE__ */ jsx(RenderPopover, {
2502
- content,
2503
- hidden: t42,
2504
- inputElement,
2505
- onMouseEnter: handlePopoverMouseEnter,
2506
- onMouseLeave: handlePopoverMouseLeave,
2507
- resultsPopoverElementRef,
2508
- renderPopover
2509
- }), $[139] = content, $[140] = handlePopoverMouseEnter, $[141] = handlePopoverMouseLeave, $[142] = inputElement, $[143] = renderPopover, $[144] = t42, $[145] = t43) : t43 = $[145], t41 = t43;
2510
- break bb3;
2511
- }
2512
- if (filteredOptionsLen === 0) {
2513
- t41 = null;
2514
- break bb3;
2515
- }
2516
- let t42;
2517
- $[146] !== content || $[147] !== expanded || $[148] !== handlePopoverMouseEnter || $[149] !== handlePopoverMouseLeave || $[150] !== inputElement || $[151] !== popover || $[152] !== radius ? (t42 = /* @__PURE__ */ jsx(Popover, {
2518
- arrow: !1,
2519
- constrainSize: !0,
2520
- content,
2521
- fallbackPlacements: AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS,
2522
- matchReferenceWidth: !0,
2523
- onMouseEnter: handlePopoverMouseEnter,
2524
- onMouseLeave: handlePopoverMouseLeave,
2525
- open: expanded,
2526
- overflow: "auto",
2527
- placement: "bottom-start",
2528
- portal: !0,
2529
- radius,
2530
- ref: resultsPopoverElementRef,
2531
- referenceElement: inputElement,
2532
- ...popover
2533
- }), $[146] = content, $[147] = expanded, $[148] = handlePopoverMouseEnter, $[149] = handlePopoverMouseLeave, $[150] = inputElement, $[151] = popover, $[152] = radius, $[153] = t42) : t42 = $[153], t41 = t42;
2534
- }
2535
- let results = t41, t42 = loading && AnimatedSpinnerIcon, t43 = suffix || openButtonNode, t44;
2536
- $[154] !== activeItemId || $[155] !== border || $[156] !== clearButton || $[157] !== customValidity || $[158] !== disabled || $[159] !== expanded || $[160] !== fontSize || $[161] !== handleClearButtonClick || $[162] !== handleInputChange || $[163] !== handleInputFocus || $[164] !== icon || $[165] !== id || $[166] !== inputValue || $[167] !== listBoxId || $[168] !== padding || $[169] !== prefix || $[170] !== radius || $[171] !== readOnly || $[172] !== restProps || $[173] !== t42 || $[174] !== t43 ? (t44 = /* @__PURE__ */ jsx(TextInput, {
2537
- ...restProps,
2538
- "aria-activedescendant": activeItemId,
2539
- "aria-autocomplete": "list",
2540
- "aria-expanded": expanded,
2541
- "aria-owns": listBoxId,
2542
- autoCapitalize: "off",
2543
- autoComplete: "off",
2544
- autoCorrect: "off",
2545
- border,
2546
- clearButton,
2547
- customValidity,
2548
- disabled,
2549
- fontSize,
2550
- icon,
2551
- iconRight: t42,
2552
- id,
2553
- inputMode: "search",
2554
- onChange: handleInputChange,
2555
- onClear: handleClearButtonClick,
2556
- onFocus: handleInputFocus,
2557
- padding,
2558
- prefix,
2559
- radius,
2560
- readOnly,
2561
- ref: setInputElement,
2562
- role: "combobox",
2563
- spellCheck: !1,
2564
- suffix: t43,
2565
- value: inputValue
2566
- }), $[154] = activeItemId, $[155] = border, $[156] = clearButton, $[157] = customValidity, $[158] = disabled, $[159] = expanded, $[160] = fontSize, $[161] = handleClearButtonClick, $[162] = handleInputChange, $[163] = handleInputFocus, $[164] = icon, $[165] = id, $[166] = inputValue, $[167] = listBoxId, $[168] = padding, $[169] = prefix, $[170] = radius, $[171] = readOnly, $[172] = restProps, $[173] = t42, $[174] = t43, $[175] = t44) : t44 = $[175];
2567
- let t45;
2568
- return $[176] !== handleRootBlur || $[177] !== handleRootFocus || $[178] !== handleRootKeyDown || $[179] !== results || $[180] !== t44 ? (t45 = /* @__PURE__ */ jsxs(StyledAutocomplete, {
2569
- "data-ui": "Autocomplete",
2570
- onBlur: handleRootBlur,
2571
- onFocus: handleRootFocus,
2572
- onKeyDown: handleRootKeyDown,
2573
- ref: rootElementRef,
2574
- children: [t44, results]
2575
- }), $[176] = handleRootBlur, $[177] = handleRootFocus, $[178] = handleRootKeyDown, $[179] = results, $[180] = t44, $[181] = t45) : t45 = $[181], t45;
2576
- };
2577
- function RenderPopover({ renderPopover, content, hidden, inputElement, onMouseEnter, onMouseLeave, resultsPopoverElementRef }) {
2578
- return renderPopover({
2579
- content,
2580
- hidden,
2581
- inputElement,
2582
- onMouseEnter,
2583
- onMouseLeave
2584
- }, resultsPopoverElementRef);
2585
- }
2586
- function _temp$11(v_0) {
2587
- return v_0 === 0 ? 0 : v_0 === 1 || v_0 === 2 ? 1 : v_0 - 2;
2588
- }
2589
- function _temp2$2(v_1) {
2590
- return Math.max(v_1 - 1, 0);
2591
- }
2592
- /**
2593
- * @public
2594
- */
2595
- function useClickOutsideEvent(listener, t0, boundaryElement) {
2596
- let $ = c(9), elementsArg = t0 === void 0 ? _temp$10 : t0, t1;
2597
- $[0] !== boundaryElement || $[1] !== elementsArg || $[2] !== listener ? (t1 = (evt) => {
2598
- if (!listener) return;
2599
- let target = evt.target;
2600
- if (!(target instanceof Node)) return;
2601
- let resolvedBoundaryElement = boundaryElement?.();
2602
- if (resolvedBoundaryElement && !resolvedBoundaryElement.contains(target)) return;
2603
- let elements = elementsArg().flat();
2604
- for (let el of elements) if (el && (target === el || el.contains(target))) return;
2605
- listener(evt);
2606
- }, $[0] = boundaryElement, $[1] = elementsArg, $[2] = listener, $[3] = t1) : t1 = $[3];
2607
- let onEvent = useEffectEvent(t1), hasListener = !!listener, t2;
2608
- $[4] !== hasListener || $[5] !== onEvent ? (t2 = () => {
2609
- if (!hasListener) return;
2610
- let handleEvent = (evt_0) => onEvent(evt_0);
2611
- return document.addEventListener("mousedown", handleEvent), () => {
2612
- document.removeEventListener("mousedown", handleEvent);
2613
- };
2614
- }, $[4] = hasListener, $[5] = onEvent, $[6] = t2) : t2 = $[6];
2615
- let t3;
2616
- $[7] === hasListener ? t3 = $[8] : (t3 = [hasListener], $[7] = hasListener, $[8] = t3), useEffect(t2, t3), useDebugValue(listener ? "MouseDown On" : "MouseDown Off");
2617
- }
2618
- function _temp$10() {
2619
- return EMPTY_ARRAY;
2620
- }
2621
- const StyledBreadcrumbs = styled.ol.withConfig({
2622
- displayName: "StyledBreadcrumbs",
2623
- componentId: "sc-s3y9xo-0"
2624
- })`margin:0;padding:0;display:flex;list-style:none;align-items:center;white-space:nowrap;line-height:0;`, ExpandButton = styled(Button).withConfig({
2625
- displayName: "ExpandButton",
2626
- componentId: "sc-s3y9xo-1"
2627
- })`appearance:none;margin:-4px;`, Breadcrumbs = function Breadcrumbs(props) {
2628
- let $ = c(30), children, maxLength, ref, restProps, separator, t0;
2629
- $[0] === props ? (children = $[1], maxLength = $[2], ref = $[3], restProps = $[4], separator = $[5], t0 = $[6]) : ({children, gap: t0, maxLength, ref, separator, ...restProps} = props, $[0] = props, $[1] = children, $[2] = maxLength, $[3] = ref, $[4] = restProps, $[5] = separator, $[6] = t0);
2630
- let gap = t0 === void 0 ? 2 : t0, t1;
2631
- $[7] === gap ? t1 = $[8] : (t1 = _getArrayProp(gap), $[7] = gap, $[8] = t1);
2632
- let space = t1, [open, setOpen] = useState(!1), expandElementRef = useRef(null), popoverElementRef = useRef(null), t2;
2633
- $[9] === Symbol.for("react.memo_cache_sentinel") ? (t2 = () => setOpen(!1), $[9] = t2) : t2 = $[9];
2634
- let collapse = t2, t3;
2635
- $[10] === Symbol.for("react.memo_cache_sentinel") ? (t3 = () => setOpen(!0), $[10] = t3) : t3 = $[10];
2636
- let expand = t3, t4;
2637
- $[11] === Symbol.for("react.memo_cache_sentinel") ? (t4 = () => [expandElementRef.current, popoverElementRef.current], $[11] = t4) : t4 = $[11], useClickOutsideEvent(collapse, t4);
2638
- let t5;
2639
- $[12] === children ? t5 = $[13] : (t5 = Children.toArray(children).filter(isValidElement), $[12] = children, $[13] = t5);
2640
- let rawItems = t5, t6;
2641
- $[14] !== maxLength || $[15] !== open || $[16] !== rawItems || $[17] !== space ? (t6 = {
2642
- collapse,
2643
- expand,
2644
- expandElementRef,
2645
- maxLength,
2646
- open,
2647
- popoverElementRef,
2648
- rawItems,
2649
- space
2650
- }, $[14] = maxLength, $[15] = open, $[16] = rawItems, $[17] = space, $[18] = t6) : t6 = $[18];
2651
- let items = useItems(t6), t7;
2652
- if ($[19] !== items || $[20] !== separator || $[21] !== space) {
2653
- let t8;
2654
- $[23] !== separator || $[24] !== space ? (t8 = (item, itemIndex) => /* @__PURE__ */ jsxs(Fragment, { children: [itemIndex > 0 && /* @__PURE__ */ jsx(Box, {
2655
- "aria-hidden": !0,
2656
- as: "li",
2657
- paddingX: space,
2658
- children: separator || /* @__PURE__ */ jsx(Text, {
2659
- muted: !0,
2660
- children: "/"
2661
- })
2662
- }), /* @__PURE__ */ jsx(Box, {
2663
- as: "li",
2664
- children: item
2665
- })] }, itemIndex), $[23] = separator, $[24] = space, $[25] = t8) : t8 = $[25], t7 = items.map(t8), $[19] = items, $[20] = separator, $[21] = space, $[22] = t7;
2666
- } else t7 = $[22];
2667
- let t8;
2668
- return $[26] !== ref || $[27] !== restProps || $[28] !== t7 ? (t8 = /* @__PURE__ */ jsx(StyledBreadcrumbs, {
2669
- "data-ui": "Breadcrumbs",
2670
- ...restProps,
2671
- ref,
2672
- children: t7
2673
- }), $[26] = ref, $[27] = restProps, $[28] = t7, $[29] = t8) : t8 = $[29], t8;
2674
- };
2675
- function useItems(t0) {
2676
- let $ = c(28), { collapse, expand, expandElementRef, maxLength, open, popoverElementRef, rawItems, space } = t0, len = rawItems.length;
2677
- if (maxLength && len > maxLength) {
2678
- let beforeLength = Math.ceil(maxLength / 2), afterLength = Math.floor(maxLength / 2), t1;
2679
- if ($[0] !== afterLength || $[1] !== beforeLength || $[2] !== collapse || $[3] !== expand || $[4] !== expandElementRef || $[5] !== len || $[6] !== open || $[7] !== popoverElementRef || $[8] !== rawItems || $[9] !== space) {
2680
- let t2 = rawItems.slice(0, beforeLength - 1), t3;
2681
- $[11] !== afterLength || $[12] !== beforeLength || $[13] !== len || $[14] !== rawItems ? (t3 = rawItems.slice(beforeLength - 1, len - afterLength), $[11] = afterLength, $[12] = beforeLength, $[13] = len, $[14] = rawItems, $[15] = t3) : t3 = $[15];
2682
- let t4;
2683
- $[16] !== space || $[17] !== t3 ? (t4 = /* @__PURE__ */ jsx(Stack, {
2684
- as: "ol",
2685
- overflow: "auto",
2686
- padding: space,
2687
- gap: space,
2688
- children: t3
2689
- }), $[16] = space, $[17] = t3, $[18] = t4) : t4 = $[18];
2690
- let t5 = open ? collapse : expand, t6;
2691
- $[19] !== expandElementRef || $[20] !== open || $[21] !== t5 ? (t6 = /* @__PURE__ */ jsx(ExpandButton, {
2692
- fontSize: 1,
2693
- mode: "bleed",
2694
- onClick: t5,
2695
- padding: 1,
2696
- ref: expandElementRef,
2697
- selected: open,
2698
- text: "…"
2699
- }), $[19] = expandElementRef, $[20] = open, $[21] = t5, $[22] = t6) : t6 = $[22];
2700
- let t7;
2701
- $[23] !== open || $[24] !== popoverElementRef || $[25] !== t4 || $[26] !== t6 ? (t7 = /* @__PURE__ */ jsx(Popover, {
2702
- constrainSize: !0,
2703
- content: t4,
2704
- open,
2705
- placement: "top",
2706
- portal: !0,
2707
- ref: popoverElementRef,
2708
- children: t6
2709
- }, "button"), $[23] = open, $[24] = popoverElementRef, $[25] = t4, $[26] = t6, $[27] = t7) : t7 = $[27], t1 = [
2710
- ...t2,
2711
- t7,
2712
- ...rawItems.slice(len - afterLength)
2713
- ], $[0] = afterLength, $[1] = beforeLength, $[2] = collapse, $[3] = expand, $[4] = expandElementRef, $[5] = len, $[6] = open, $[7] = popoverElementRef, $[8] = rawItems, $[9] = space, $[10] = t1;
2714
- } else t1 = $[10];
2715
- return t1;
2716
- }
2717
- return rawItems;
2718
- }
2719
- /**
2720
- * Adds global keydown event listener to the window.
2721
- *
2722
- * @param onKeyDown - The function to call when a keydown event is triggered.
2723
- * @param options - The options to pass to the addEventListener function (example, capture: true)
2724
- * @beta
2725
- */
2726
- function useGlobalKeyDown(onKeyDown, options) {
2727
- let $ = c(7), t0;
2728
- $[0] === onKeyDown ? t0 = $[1] : (t0 = (event) => onKeyDown(event), $[0] = onKeyDown, $[1] = t0);
2729
- let handleKeyDown = useEffectEvent(t0), t1;
2730
- $[2] !== handleKeyDown || $[3] !== options ? (t1 = () => {
2731
- let handler = (event_0) => handleKeyDown(event_0);
2732
- return window.addEventListener("keydown", handler, options), () => window.removeEventListener("keydown", handler, options);
2733
- }, $[2] = handleKeyDown, $[3] = options, $[4] = t1) : t1 = $[4];
2734
- let t2;
2735
- $[5] === options ? t2 = $[6] : (t2 = [options], $[5] = options, $[6] = t2), useEffect(t1, t2);
2736
- }
2737
- const BASE_STYLE = {
33
+ const createColorTheme = createColorTheme$1, hexToRgb = hexToRgb$1, hslToRgb = hslToRgb$1, multiply = multiply$1, parseColor = parseColor$1, rgbToHex = rgbToHex$1, rgbToHsl = rgbToHsl$1, rgba = rgba$1, screen = screen$1, studioTheme = buildTheme(), BASE_STYLE = {
2738
34
  width: "100%",
2739
35
  margin: "0 auto"
2740
36
  };
@@ -2761,51 +57,6 @@ const StyledContainer = /* @__PURE__ */ styled(Box).withConfig({
2761
57
  forwardedAs: as,
2762
58
  ref
2763
59
  }), $[7] = as, $[8] = ref, $[9] = restProps, $[10] = t1, $[11] = t2) : t2 = $[11], t2;
2764
- }, StyledLayer$1 = /* @__PURE__ */ styled.div.withConfig({
2765
- displayName: "StyledLayer",
2766
- componentId: "sc-omj35q-0"
2767
- })({ position: "relative" }), LayerChildren = function LayerChildren(props) {
2768
- let $ = c(23), children, forwardedRef, onActivate, onFocus, restProps, t0;
2769
- $[0] === props ? (children = $[1], forwardedRef = $[2], onActivate = $[3], onFocus = $[4], restProps = $[5], t0 = $[6]) : ({children, onActivate, onFocus, ref: forwardedRef, style: t0, ...restProps} = props, $[0] = props, $[1] = children, $[2] = forwardedRef, $[3] = onActivate, $[4] = onFocus, $[5] = restProps, $[6] = t0);
2770
- let style = t0 === void 0 ? EMPTY_RECORD : t0, { zIndex, isTopLayer } = useLayer(), lastFocusedRef = useRef(null), ref = useRef(null), isTopLayerRef = useRef(isTopLayer), t1;
2771
- $[7] === Symbol.for("react.memo_cache_sentinel") ? (t1 = () => ref.current, $[7] = t1) : t1 = $[7], useImperativeHandle(forwardedRef, t1);
2772
- let t2, t3;
2773
- $[8] !== isTopLayer || $[9] !== onActivate ? (t2 = () => {
2774
- isTopLayerRef.current !== isTopLayer && isTopLayer && onActivate?.({ activeElement: lastFocusedRef.current }), isTopLayerRef.current = isTopLayer;
2775
- }, t3 = [isTopLayer, onActivate], $[8] = isTopLayer, $[9] = onActivate, $[10] = t2, $[11] = t3) : (t2 = $[10], t3 = $[11]), useEffect(t2, t3);
2776
- let t4;
2777
- $[12] !== isTopLayer || $[13] !== onFocus ? (t4 = (event) => {
2778
- onFocus?.(event);
2779
- let rootElement = ref.current, target = document.activeElement;
2780
- !isTopLayer || !rootElement || !target || isHTMLElement(target) && containsOrEqualsElement(rootElement, target) && (lastFocusedRef.current = target);
2781
- }, $[12] = isTopLayer, $[13] = onFocus, $[14] = t4) : t4 = $[14];
2782
- let handleFocus = t4, t5;
2783
- $[15] !== style || $[16] !== zIndex ? (t5 = {
2784
- ...style,
2785
- zIndex
2786
- }, $[15] = style, $[16] = zIndex, $[17] = t5) : t5 = $[17];
2787
- let t6;
2788
- return $[18] !== children || $[19] !== handleFocus || $[20] !== restProps || $[21] !== t5 ? (t6 = /* @__PURE__ */ jsx(StyledLayer$1, {
2789
- ...restProps,
2790
- "data-ui": "Layer",
2791
- onFocus: handleFocus,
2792
- ref,
2793
- style: t5,
2794
- children
2795
- }), $[18] = children, $[19] = handleFocus, $[20] = restProps, $[21] = t5, $[22] = t6) : t6 = $[22], t6;
2796
- }, Layer = function Layer(props) {
2797
- let $ = c(10), children, restProps, t0;
2798
- $[0] === props ? (children = $[1], restProps = $[2], t0 = $[3]) : ({children, zOffset: t0, ...restProps} = props, $[0] = props, $[1] = children, $[2] = restProps, $[3] = t0);
2799
- let zOffset = t0 === void 0 ? 1 : t0, t1;
2800
- $[4] !== children || $[5] !== restProps ? (t1 = /* @__PURE__ */ jsx(LayerChildren, {
2801
- ...restProps,
2802
- children
2803
- }), $[4] = children, $[5] = restProps, $[6] = t1) : t1 = $[6];
2804
- let t2;
2805
- return $[7] !== t1 || $[8] !== zOffset ? (t2 = /* @__PURE__ */ jsx(LayerProvider, {
2806
- zOffset,
2807
- children: t1
2808
- }), $[7] = t1, $[8] = zOffset, $[9] = t2) : t2 = $[9], t2;
2809
60
  };
2810
61
  function dialogStyle({ theme }) {
2811
62
  let { color } = getTheme_v2(theme);
@@ -2999,766 +250,69 @@ const StyledDialog = /* @__PURE__ */ styled(Layer).withConfig({
2999
250
  $[39] !== autoFocus || $[40] !== cardRadius || $[41] !== cardShadow || $[42] !== children || $[43] !== contentRef || $[44] !== footer || $[45] !== header || $[46] !== hideCloseButton || $[47] !== id || $[48] !== onClickOutside || $[49] !== onClose || $[50] !== portalProp || $[51] !== scheme || $[52] !== width ? (t15 = /* @__PURE__ */ jsx(DialogCard, {
3000
251
  __unstable_autoFocus: autoFocus,
3001
252
  __unstable_hideCloseButton: hideCloseButton,
3002
- contentRef,
3003
- footer,
3004
- header,
3005
- id,
3006
- onClickOutside,
3007
- onClose,
3008
- portal: portalProp,
3009
- radius: cardRadius,
3010
- ref: cardRef,
3011
- scheme,
3012
- shadow: cardShadow,
3013
- width,
3014
- children
3015
- }), $[39] = autoFocus, $[40] = cardRadius, $[41] = cardShadow, $[42] = children, $[43] = contentRef, $[44] = footer, $[45] = header, $[46] = hideCloseButton, $[47] = id, $[48] = onClickOutside, $[49] = onClose, $[50] = portalProp, $[51] = scheme, $[52] = width, $[53] = t15) : t15 = $[53];
3016
- let t16;
3017
- $[54] === Symbol.for("react.memo_cache_sentinel") ? (t16 = /* @__PURE__ */ jsx("div", {
3018
- ref: postDivRef,
3019
- tabIndex: 0
3020
- }), $[54] = t16) : t16 = $[54];
3021
- let t17;
3022
- $[55] !== animate || $[56] !== handleFocus || $[57] !== handleRootClick || $[58] !== id || $[59] !== labelId || $[60] !== onActivate || $[61] !== padding || $[62] !== position || $[63] !== ref || $[64] !== restProps || $[65] !== t15 || $[66] !== zOffset ? (t17 = /* @__PURE__ */ jsxs(StyledDialog, {
3023
- ...restProps,
3024
- $animate: animate,
3025
- $padding: padding,
3026
- $position: position,
3027
- "aria-labelledby": labelId,
3028
- "aria-modal": !0,
3029
- "data-ui": "Dialog",
3030
- id,
3031
- onActivate,
3032
- onClick: handleRootClick,
3033
- onFocus: handleFocus,
3034
- ref,
3035
- role: "dialog",
3036
- zOffset,
3037
- children: [
3038
- t14,
3039
- t15,
3040
- t16
3041
- ]
3042
- }), $[55] = animate, $[56] = handleFocus, $[57] = handleRootClick, $[58] = id, $[59] = labelId, $[60] = onActivate, $[61] = padding, $[62] = position, $[63] = ref, $[64] = restProps, $[65] = t15, $[66] = zOffset, $[67] = t17) : t17 = $[67];
3043
- let t18;
3044
- return $[68] !== portalProp || $[69] !== t17 ? (t18 = /* @__PURE__ */ jsx(Portal, {
3045
- __unstable_name: portalProp,
3046
- children: t17
3047
- }), $[68] = portalProp, $[69] = t17, $[70] = t18) : t18 = $[70], t18;
3048
- };
3049
- /**
3050
- * This API might change. DO NOT USE IN PRODUCTION.
3051
- * @beta
3052
- */
3053
- function DialogProvider(props) {
3054
- let $ = c(6), { children, position, zOffset } = props, t0;
3055
- $[0] !== position || $[1] !== zOffset ? (t0 = {
3056
- version: 0,
3057
- position,
3058
- zOffset
3059
- }, $[0] = position, $[1] = zOffset, $[2] = t0) : t0 = $[2];
3060
- let contextValue = t0, t1;
3061
- return $[3] !== children || $[4] !== contextValue ? (t1 = /* @__PURE__ */ jsx(DialogContext.Provider, {
3062
- value: contextValue,
3063
- children
3064
- }), $[3] = children, $[4] = contextValue, $[5] = t1) : t1 = $[5], t1;
3065
- }
3066
- function inlineBaseStyle() {
3067
- return {
3068
- lineHeight: "0",
3069
- "&&:not([hidden])": { display: "block" },
3070
- "& > div": {
3071
- display: "inline-block",
3072
- verticalAlign: "middle"
3073
- }
3074
- };
3075
- }
3076
- function inlineSpaceStyle(props) {
3077
- let { media, space } = getTheme_v2(props.theme);
3078
- return _responsive(media, props.$space, (spaceIndex) => {
3079
- let _space = rem(spaceIndex === .5 ? space[1] / 2 : space[spaceIndex]);
3080
- return {
3081
- margin: `-${_space} 0 0 -${_space}`,
3082
- "& > div": { padding: `${_space} 0 0 ${_space}` }
3083
- };
3084
- });
3085
- }
3086
- const StyledInline = /* @__PURE__ */ styled(Box).withConfig({
3087
- displayName: "StyledInline",
3088
- componentId: "sc-3t6t7g-0"
3089
- })(inlineBaseStyle, inlineSpaceStyle), Inline = function Inline(props) {
3090
- let $ = c(16), as, childrenProp, gap, ref, restProps;
3091
- $[0] === props ? (as = $[1], childrenProp = $[2], gap = $[3], ref = $[4], restProps = $[5]) : ({as, children: childrenProp, gap, ref, ...restProps} = props, $[0] = props, $[1] = as, $[2] = childrenProp, $[3] = gap, $[4] = ref, $[5] = restProps);
3092
- let t0;
3093
- $[6] === childrenProp ? t0 = $[7] : (t0 = Children.map(childrenProp, _temp$9), $[6] = childrenProp, $[7] = t0);
3094
- let children = t0, t1;
3095
- $[8] === gap ? t1 = $[9] : (t1 = _getArrayProp(gap), $[8] = gap, $[9] = t1);
3096
- let t2;
3097
- return $[10] !== as || $[11] !== children || $[12] !== ref || $[13] !== restProps || $[14] !== t1 ? (t2 = /* @__PURE__ */ jsx(StyledInline, {
3098
- "data-ui": "Inline",
3099
- ...restProps,
3100
- $space: t1,
3101
- forwardedAs: as,
3102
- ref,
3103
- children
3104
- }), $[10] = as, $[11] = children, $[12] = ref, $[13] = restProps, $[14] = t1, $[15] = t2) : t2 = $[15], t2;
3105
- };
3106
- function _temp$9(child) {
3107
- return child && /* @__PURE__ */ jsx("div", { children: child });
3108
- }
3109
- function kbdStyle() {
3110
- return css`--card-bg-color:var(--card-kbd-bg-color);--card-border-color:var(--card-kbd-border-color);--card-fg-color:var(--card-kbd-fg-color);box-shadow:inset 0 0 0 1px var(--card-border-color);background:var(--card-bg-color);font:inherit;vertical-align:top;&:not([hidden]){display:inline-block;}`;
3111
- }
3112
- const StyledKBD = /* @__PURE__ */ styled.kbd.withConfig({
3113
- displayName: "StyledKBD",
3114
- componentId: "sc-yqxdiu-0"
3115
- })(responsiveRadiusStyle, kbdStyle), KBD = function KBD(props) {
3116
- let $ = c(20), children, ref, restProps, t0, t1, t2;
3117
- $[0] === props ? (children = $[1], ref = $[2], restProps = $[3], t0 = $[4], t1 = $[5], t2 = $[6]) : ({children, fontSize: t0, padding: t1, radius: t2, ref, ...restProps} = props, $[0] = props, $[1] = children, $[2] = ref, $[3] = restProps, $[4] = t0, $[5] = t1, $[6] = t2);
3118
- let fontSize = t0 === void 0 ? 0 : t0, padding = t1 === void 0 ? 1 : t1, radius = t2 === void 0 ? 2 : t2, t3;
3119
- $[7] === radius ? t3 = $[8] : (t3 = _getArrayProp(radius), $[7] = radius, $[8] = t3);
3120
- let t4;
3121
- $[9] !== children || $[10] !== fontSize ? (t4 = /* @__PURE__ */ jsx(Text, {
3122
- as: "span",
3123
- size: fontSize,
3124
- weight: "semibold",
3125
- children
3126
- }), $[9] = children, $[10] = fontSize, $[11] = t4) : t4 = $[11];
3127
- let t5;
3128
- $[12] !== padding || $[13] !== t4 ? (t5 = /* @__PURE__ */ jsx(Box, {
3129
- as: "span",
3130
- padding,
3131
- children: t4
3132
- }), $[12] = padding, $[13] = t4, $[14] = t5) : t5 = $[14];
3133
- let t6;
3134
- return $[15] !== ref || $[16] !== restProps || $[17] !== t3 || $[18] !== t5 ? (t6 = /* @__PURE__ */ jsx(StyledKBD, {
3135
- "data-ui": "KBD",
3136
- ...restProps,
3137
- $radius: t3,
3138
- ref,
3139
- children: t5
3140
- }), $[15] = ref, $[16] = restProps, $[17] = t3, $[18] = t5, $[19] = t6) : t6 = $[19], t6;
3141
- }, StyledHotkeys = styled.kbd.withConfig({
3142
- displayName: "StyledHotkeys",
3143
- componentId: "sc-qvwif3-0"
3144
- })`font:inherit;padding:1px;&:not([hidden]){display:block;}`, Key = styled(KBD).withConfig({
3145
- displayName: "Key",
3146
- componentId: "sc-qvwif3-1"
3147
- })`&:not([hidden]){display:block;}`, Hotkeys = function Hotkeys(props) {
3148
- let $ = c(27), fontSize, keys, padding, radius, ref, restProps, t0;
3149
- $[0] === props ? (fontSize = $[1], keys = $[2], padding = $[3], radius = $[4], ref = $[5], restProps = $[6], t0 = $[7]) : ({fontSize, gap: t0, keys, padding, radius, ref, ...restProps} = props, $[0] = props, $[1] = fontSize, $[2] = keys, $[3] = padding, $[4] = radius, $[5] = ref, $[6] = restProps, $[7] = t0);
3150
- let gap = t0 === void 0 ? .5 : t0, t1;
3151
- $[8] === gap ? t1 = $[9] : (t1 = _getArrayProp(gap), $[8] = gap, $[9] = t1);
3152
- let spacing = t1;
3153
- if (!keys || keys.length === 0) {
3154
- let t2;
3155
- return $[10] === Symbol.for("react.memo_cache_sentinel") ? (t2 = /* @__PURE__ */ jsx(Fragment$1, {}), $[10] = t2) : t2 = $[10], t2;
3156
- }
3157
- let t2;
3158
- if ($[11] !== fontSize || $[12] !== keys || $[13] !== padding || $[14] !== radius) {
3159
- let t3;
3160
- $[16] !== fontSize || $[17] !== padding || $[18] !== radius ? (t3 = (key, i) => /* @__PURE__ */ jsx(Key, {
3161
- fontSize,
3162
- padding,
3163
- radius,
3164
- children: key
3165
- }, i), $[16] = fontSize, $[17] = padding, $[18] = radius, $[19] = t3) : t3 = $[19], t2 = keys.map(t3), $[11] = fontSize, $[12] = keys, $[13] = padding, $[14] = radius, $[15] = t2;
3166
- } else t2 = $[15];
3167
- let t3;
3168
- $[20] !== spacing || $[21] !== t2 ? (t3 = /* @__PURE__ */ jsx(Inline, {
3169
- as: "span",
3170
- gap: spacing,
3171
- children: t2
3172
- }), $[20] = spacing, $[21] = t2, $[22] = t3) : t3 = $[22];
3173
- let t4;
3174
- return $[23] !== ref || $[24] !== restProps || $[25] !== t3 ? (t4 = /* @__PURE__ */ jsx(StyledHotkeys, {
3175
- "data-ui": "Hotkeys",
3176
- ...restProps,
3177
- ref,
3178
- children: t3
3179
- }), $[23] = ref, $[24] = restProps, $[25] = t3, $[26] = t4) : t4 = $[26], t4;
3180
- }, MenuContext = createGlobalScopedContext("@sanity/ui/context/menu", null);
3181
- /**
3182
- * @internal
3183
- */
3184
- function _isFocusable(element) {
3185
- return isHTMLAnchorElement(element) && element.getAttribute("data-disabled") !== "true" || isHTMLButtonElement(element) && !element.disabled;
3186
- }
3187
- /**
3188
- * @internal
3189
- */
3190
- function _getFocusableElements(elements) {
3191
- return elements.filter(_isFocusable);
3192
- }
3193
- function _getDOMPath(rootElement, el) {
3194
- let path = [], e = el;
3195
- for (; e !== rootElement;) {
3196
- let parentElement = e.parentElement;
3197
- if (!parentElement) return path;
3198
- let index = Array.from(parentElement.childNodes).indexOf(e);
3199
- if (path.unshift(index), parentElement === rootElement) return path;
3200
- e = parentElement;
3201
- }
3202
- return path;
3203
- }
3204
- const EMPTY_PATH = [];
3205
- /**
3206
- * @internal
3207
- */
3208
- function _sortElements(rootElement, elements) {
3209
- if (!rootElement) return;
3210
- let map = /* @__PURE__ */ new WeakMap();
3211
- for (let el of elements) map.set(el, _getDOMPath(rootElement, el));
3212
- let _sort = (a, b) => {
3213
- let _a = map.get(a) || EMPTY_PATH, _b = map.get(b) || EMPTY_PATH, len = Math.max(_a.length, _b.length);
3214
- for (let i = 0; i < len; i += 1) {
3215
- let aIndex = _a[i] || -1, bIndex = _b[i] || -1;
3216
- if (aIndex !== bIndex) return aIndex - bIndex;
3217
- }
3218
- return 0;
3219
- };
3220
- elements.sort(_sort);
3221
- }
3222
- /**
3223
- * This controller is responsible for controlling UI menu state.
3224
- *
3225
- * @internal
3226
- */
3227
- function useMenuController(props) {
3228
- let $ = c(23), { onKeyDown, originElement, shouldFocus, rootElementRef } = props, t0;
3229
- $[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = [], $[0] = t0) : t0 = $[0];
3230
- let elementsRef = useRef(t0), [activeIndex, _setActiveIndex] = useState(-1), activeIndexRef = useRef(activeIndex), [activeElement, setActiveElement] = useState(null), t1;
3231
- $[1] === Symbol.for("react.memo_cache_sentinel") ? (t1 = (nextActiveIndex) => {
3232
- _setActiveIndex(nextActiveIndex), activeIndexRef.current = nextActiveIndex, setActiveElement(elementsRef.current[nextActiveIndex] || null);
3233
- }, $[1] = t1) : t1 = $[1];
3234
- let setActiveIndex = t1, t2;
3235
- $[2] === rootElementRef ? t2 = $[3] : (t2 = (element, selected) => {
3236
- if (!element) return _temp$8;
3237
- if (elementsRef.current.indexOf(element) === -1 && (elementsRef.current.push(element), _sortElements(rootElementRef.current, elementsRef.current)), selected) {
3238
- let selectedIndex = elementsRef.current.indexOf(element);
3239
- setActiveIndex(selectedIndex);
3240
- }
3241
- return () => {
3242
- let idx = elementsRef.current.indexOf(element);
3243
- idx > -1 && elementsRef.current.splice(idx, 1);
3244
- };
3245
- }, $[2] = rootElementRef, $[3] = t2);
3246
- let mount = t2, t3, t4;
3247
- $[4] === Symbol.for("react.memo_cache_sentinel") ? (t3 = () => () => setActiveIndex(-1), t4 = [setActiveIndex], $[4] = t3, $[5] = t4) : (t3 = $[4], t4 = $[5]), useEffect(t3, t4);
3248
- let t5;
3249
- $[6] !== onKeyDown || $[7] !== originElement ? (t5 = (event) => {
3250
- if (event.key === "Tab") {
3251
- originElement && originElement.focus();
3252
- return;
3253
- }
3254
- if (event.key === "Home") {
3255
- event.preventDefault(), event.stopPropagation();
3256
- let el = _getFocusableElements(elementsRef.current)[0];
3257
- if (!el) return;
3258
- let currentIndex = elementsRef.current.indexOf(el);
3259
- setActiveIndex(currentIndex);
3260
- return;
3261
- }
3262
- if (event.key === "End") {
3263
- event.preventDefault(), event.stopPropagation();
3264
- let focusableElements_0 = _getFocusableElements(elementsRef.current), el_0 = focusableElements_0[focusableElements_0.length - 1];
3265
- if (!el_0) return;
3266
- let currentIndex_0 = elementsRef.current.indexOf(el_0);
3267
- setActiveIndex(currentIndex_0);
3268
- return;
3269
- }
3270
- if (event.key === "ArrowUp") {
3271
- event.preventDefault(), event.stopPropagation();
3272
- let focusableElements_1 = _getFocusableElements(elementsRef.current), focusableLen = focusableElements_1.length;
3273
- if (focusableLen === 0) return;
3274
- let focusedElement = elementsRef.current[activeIndexRef.current], focusedIndex = focusableElements_1.indexOf(focusedElement);
3275
- focusedIndex = (focusedIndex - 1 + focusableLen) % focusableLen;
3276
- let el_1 = focusableElements_1[focusedIndex], currentIndex_1 = elementsRef.current.indexOf(el_1);
3277
- setActiveIndex(currentIndex_1);
3278
- return;
3279
- }
3280
- if (event.key === "ArrowDown") {
3281
- event.preventDefault(), event.stopPropagation();
3282
- let focusableElements_2 = _getFocusableElements(elementsRef.current), focusableLen_0 = focusableElements_2.length;
3283
- if (focusableLen_0 === 0) return;
3284
- let focusedElement_0 = elementsRef.current[activeIndexRef.current], focusedIndex_0 = focusableElements_2.indexOf(focusedElement_0);
3285
- focusedIndex_0 = (focusedIndex_0 + 1) % focusableLen_0;
3286
- let el_2 = focusableElements_2[focusedIndex_0], currentIndex_2 = elementsRef.current.indexOf(el_2);
3287
- setActiveIndex(currentIndex_2);
3288
- return;
3289
- }
3290
- onKeyDown && onKeyDown(event);
3291
- }, $[6] = onKeyDown, $[7] = originElement, $[8] = t5) : t5 = $[8];
3292
- let handleKeyDown = t5, t6;
3293
- $[9] === Symbol.for("react.memo_cache_sentinel") ? (t6 = (event_0) => {
3294
- let element_0 = event_0.currentTarget, currentIndex_3 = elementsRef.current.indexOf(element_0);
3295
- setActiveIndex(currentIndex_3);
3296
- }, $[9] = t6) : t6 = $[9];
3297
- let handleItemMouseEnter = t6, t7;
3298
- $[10] === rootElementRef ? t7 = $[11] : (t7 = () => {
3299
- setActiveIndex(-2), rootElementRef.current?.focus();
3300
- }, $[10] = rootElementRef, $[11] = t7);
3301
- let handleItemMouseLeave = t7, t8, t9;
3302
- $[12] !== activeIndex || $[13] !== rootElementRef || $[14] !== shouldFocus ? (t8 = () => {
3303
- if (!rootElementRef.current) return;
3304
- let rafId = requestAnimationFrame(() => {
3305
- if (activeIndex === -1) {
3306
- if (shouldFocus === "first") {
3307
- let el_3 = _getFocusableElements(elementsRef.current)[0];
3308
- if (el_3) {
3309
- let currentIndex_4 = elementsRef.current.indexOf(el_3);
3310
- setActiveIndex(currentIndex_4);
3311
- }
3312
- }
3313
- if (shouldFocus === "last") {
3314
- let focusableElements_4 = _getFocusableElements(elementsRef.current), el_4 = focusableElements_4[focusableElements_4.length - 1];
3315
- if (el_4) {
3316
- let currentIndex_5 = elementsRef.current.indexOf(el_4);
3317
- setActiveIndex(currentIndex_5);
3318
- }
3319
- }
3320
- return;
3321
- }
3322
- (elementsRef.current[activeIndex] || null)?.focus();
3323
- });
3324
- return () => cancelAnimationFrame(rafId);
3325
- }, t9 = [
3326
- activeIndex,
3327
- rootElementRef,
3328
- setActiveIndex,
3329
- shouldFocus
3330
- ], $[12] = activeIndex, $[13] = rootElementRef, $[14] = shouldFocus, $[15] = t8, $[16] = t9) : (t8 = $[15], t9 = $[16]), useEffect(t8, t9);
3331
- let t10;
3332
- return $[17] !== activeElement || $[18] !== activeIndex || $[19] !== handleItemMouseLeave || $[20] !== handleKeyDown || $[21] !== mount ? (t10 = {
3333
- activeElement,
3334
- activeIndex,
3335
- handleItemMouseEnter,
3336
- handleItemMouseLeave,
3337
- handleKeyDown,
3338
- mount
3339
- }, $[17] = activeElement, $[18] = activeIndex, $[19] = handleItemMouseLeave, $[20] = handleKeyDown, $[21] = mount, $[22] = t10) : t10 = $[22], t10;
3340
- }
3341
- function _temp$8() {}
3342
- const StyledMenu = styled(Box).withConfig({
3343
- displayName: "StyledMenu",
3344
- componentId: "sc-1dh4ar-0"
3345
- })`outline:none;overflow:auto;`, Menu = function Menu(props) {
3346
- let $ = c(50), children, forwardedRef, onClickOutside, onEscape, onItemClick, onItemSelect, onKeyDown, originElement, registerElement, restProps, t0, t1, t2;
3347
- $[0] === props ? (children = $[1], forwardedRef = $[2], onClickOutside = $[3], onEscape = $[4], onItemClick = $[5], onItemSelect = $[6], onKeyDown = $[7], originElement = $[8], registerElement = $[9], restProps = $[10], t0 = $[11], t1 = $[12], t2 = $[13]) : ({children, onClickOutside, onEscape, onItemClick, onItemSelect, onKeyDown, originElement, padding: t0, ref: forwardedRef, registerElement, shouldFocus: t1, gap: t2, ...restProps} = props, $[0] = props, $[1] = children, $[2] = forwardedRef, $[3] = onClickOutside, $[4] = onEscape, $[5] = onItemClick, $[6] = onItemSelect, $[7] = onKeyDown, $[8] = originElement, $[9] = registerElement, $[10] = restProps, $[11] = t0, $[12] = t1, $[13] = t2);
3348
- let padding = t0 === void 0 ? 1 : t0, shouldFocus = t1 === void 0 ? null : t1, gap = t2 === void 0 ? 1 : t2, ref = useRef(null), t3;
3349
- $[14] === Symbol.for("react.memo_cache_sentinel") ? (t3 = () => ref.current, $[14] = t3) : t3 = $[14], useImperativeHandle(forwardedRef, t3);
3350
- let { isTopLayer } = useLayer(), t4;
3351
- $[15] !== onKeyDown || $[16] !== originElement || $[17] !== shouldFocus ? (t4 = {
3352
- onKeyDown,
3353
- originElement,
3354
- shouldFocus,
3355
- rootElementRef: ref
3356
- }, $[15] = onKeyDown, $[16] = originElement, $[17] = shouldFocus, $[18] = t4) : t4 = $[18];
3357
- let { activeElement, activeIndex, handleItemMouseEnter, handleItemMouseLeave, handleKeyDown, mount } = useMenuController(t4), unregisterElementRef = useRef(null), t5;
3358
- $[19] === registerElement ? t5 = $[20] : (t5 = (el) => {
3359
- unregisterElementRef.current &&= (unregisterElementRef.current(), null), ref.current = el, ref.current && registerElement && (unregisterElementRef.current = registerElement(ref.current));
3360
- }, $[19] = registerElement, $[20] = t5);
3361
- let handleRefChange = t5, t6, t7;
3362
- $[21] !== activeIndex || $[22] !== onItemSelect ? (t6 = () => {
3363
- onItemSelect && onItemSelect(activeIndex);
3364
- }, t7 = [activeIndex, onItemSelect], $[21] = activeIndex, $[22] = onItemSelect, $[23] = t6, $[24] = t7) : (t6 = $[23], t7 = $[24]), useEffect(t6, t7);
3365
- let t8;
3366
- $[25] === Symbol.for("react.memo_cache_sentinel") ? (t8 = () => [ref.current], $[25] = t8) : t8 = $[25], useClickOutsideEvent(isTopLayer && onClickOutside, t8);
3367
- let t9;
3368
- $[26] !== isTopLayer || $[27] !== onEscape ? (t9 = (event) => {
3369
- isTopLayer && event.key === "Escape" && (event.stopPropagation(), onEscape && onEscape());
3370
- }, $[26] = isTopLayer, $[27] = onEscape, $[28] = t9) : t9 = $[28], useGlobalKeyDown(t9);
3371
- let t10;
3372
- $[29] !== activeElement || $[30] !== handleItemMouseEnter || $[31] !== handleItemMouseLeave || $[32] !== mount || $[33] !== onClickOutside || $[34] !== onEscape || $[35] !== onItemClick || $[36] !== registerElement ? (t10 = {
3373
- version: 2,
3374
- activeElement,
3375
- mount,
3376
- onClickOutside,
3377
- onEscape,
3378
- onItemClick,
3379
- onItemMouseEnter: handleItemMouseEnter,
3380
- onItemMouseLeave: handleItemMouseLeave,
3381
- registerElement
3382
- }, $[29] = activeElement, $[30] = handleItemMouseEnter, $[31] = handleItemMouseLeave, $[32] = mount, $[33] = onClickOutside, $[34] = onEscape, $[35] = onItemClick, $[36] = registerElement, $[37] = t10) : t10 = $[37];
3383
- let value = t10, t11;
3384
- $[38] !== children || $[39] !== gap ? (t11 = /* @__PURE__ */ jsx(Stack, {
3385
- gap,
3386
- children
3387
- }), $[38] = children, $[39] = gap, $[40] = t11) : t11 = $[40];
3388
- let t12;
3389
- $[41] !== handleKeyDown || $[42] !== handleRefChange || $[43] !== padding || $[44] !== restProps || $[45] !== t11 ? (t12 = /* @__PURE__ */ jsx(StyledMenu, {
3390
- "data-ui": "Menu",
3391
- ...restProps,
3392
- onKeyDown: handleKeyDown,
3393
- padding,
3394
- ref: handleRefChange,
3395
- role: "menu",
3396
- tabIndex: -1,
3397
- children: t11
3398
- }), $[41] = handleKeyDown, $[42] = handleRefChange, $[43] = padding, $[44] = restProps, $[45] = t11, $[46] = t12) : t12 = $[46];
3399
- let t13;
3400
- return $[47] !== t12 || $[48] !== value ? (t13 = /* @__PURE__ */ jsx(MenuContext.Provider, {
3401
- value,
3402
- children: t12
3403
- }), $[47] = t12, $[48] = value, $[49] = t13) : t13 = $[49], t13;
3404
- }, MenuButton = function MenuButton(props) {
3405
- let $ = c(56), { __unstable_disableRestoreFocusOnClose: t0, button: buttonProp, id, menu: menuProp, onClose, onOpen, popover, ref: forwardedRef } = props, disableRestoreFocusOnClose = t0 !== void 0 && t0, [open, setOpen] = useState(!1), [shouldFocus, setShouldFocus] = useState(null), [buttonElement, setButtonElement] = useState(null), t1;
3406
- $[0] === Symbol.for("react.memo_cache_sentinel") ? (t1 = [], $[0] = t1) : t1 = $[0];
3407
- let [menuElements, setChildMenuElements] = useState(t1), openRef = useRef(open), t2, t3;
3408
- $[1] !== onOpen || $[2] !== open ? (t2 = () => {
3409
- onOpen && open && !openRef.current && onOpen();
3410
- }, t3 = [onOpen, open], $[1] = onOpen, $[2] = open, $[3] = t2, $[4] = t3) : (t2 = $[3], t3 = $[4]), useEffect(t2, t3);
3411
- let t4, t5;
3412
- $[5] !== onClose || $[6] !== open ? (t4 = () => {
3413
- onClose && !open && openRef.current && onClose();
3414
- }, t5 = [onClose, open], $[5] = onClose, $[6] = open, $[7] = t4, $[8] = t5) : (t4 = $[7], t5 = $[8]), useEffect(t4, t5);
3415
- let t6, t7;
3416
- $[9] === open ? (t6 = $[10], t7 = $[11]) : (t6 = () => {
3417
- openRef.current = open;
3418
- }, t7 = [open], $[9] = open, $[10] = t6, $[11] = t7), useEffect(t6, t7);
3419
- let t8;
3420
- $[12] === Symbol.for("react.memo_cache_sentinel") ? (t8 = () => {
3421
- setOpen(_temp$7), setShouldFocus(null);
3422
- }, $[12] = t8) : t8 = $[12];
3423
- let handleButtonClick = t8, t9;
3424
- $[13] === open ? t9 = $[14] : (t9 = (event) => {
3425
- open && event.preventDefault();
3426
- }, $[13] = open, $[14] = t9);
3427
- let handleMouseDown = t9, t10;
3428
- $[15] === Symbol.for("react.memo_cache_sentinel") ? (t10 = (event_0) => {
3429
- if (event_0.key === "ArrowDown" || event_0.key === "Enter" || event_0.key === " ") {
3430
- event_0.preventDefault(), setOpen(!0), setShouldFocus("first");
3431
- return;
3432
- }
3433
- if (event_0.key === "ArrowUp") {
3434
- event_0.preventDefault(), setOpen(!0), setShouldFocus("last");
3435
- return;
3436
- }
3437
- }, $[15] = t10) : t10 = $[15];
3438
- let handleButtonKeyDown = t10, t11;
3439
- $[16] !== buttonElement || $[17] !== menuElements ? (t11 = (event_1) => {
3440
- let target = event_1.target;
3441
- if (target instanceof Node && !(buttonElement && (target === buttonElement || buttonElement.contains(target)))) {
3442
- for (let el of menuElements) if (target === el || el.contains(target)) return;
3443
- setOpen(!1);
3444
- }
3445
- }, $[16] = buttonElement, $[17] = menuElements, $[18] = t11) : t11 = $[18];
3446
- let handleMenuClickOutside = t11, t12;
3447
- $[19] !== buttonElement || $[20] !== disableRestoreFocusOnClose ? (t12 = () => {
3448
- setOpen(!1), !disableRestoreFocusOnClose && buttonElement && buttonElement.focus();
3449
- }, $[19] = buttonElement, $[20] = disableRestoreFocusOnClose, $[21] = t12) : t12 = $[21];
3450
- let handleMenuEscape = t12, t13;
3451
- $[22] === menuElements ? t13 = $[23] : (t13 = (event_2) => {
3452
- let target_0 = event_2.relatedTarget;
3453
- if (target_0 instanceof Node) {
3454
- for (let el_0 of menuElements) if (el_0 === target_0 || el_0.contains(target_0)) return;
3455
- setOpen(!1);
3456
- }
3457
- }, $[22] = menuElements, $[23] = t13);
3458
- let handleBlur = t13, t14;
3459
- $[24] !== buttonElement || $[25] !== disableRestoreFocusOnClose ? (t14 = () => {
3460
- setOpen(!1), !disableRestoreFocusOnClose && buttonElement && buttonElement.focus();
3461
- }, $[24] = buttonElement, $[25] = disableRestoreFocusOnClose, $[26] = t14) : t14 = $[26];
3462
- let handleItemClick = t14, t15;
3463
- $[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];
3464
- let registerElement = t15, t16;
3465
- $[28] !== buttonElement || $[29] !== handleBlur || $[30] !== handleItemClick || $[31] !== handleMenuClickOutside || $[32] !== handleMenuEscape || $[33] !== id || $[34] !== menuProp || $[35] !== shouldFocus ? (t16 = menuProp && cloneElement(menuProp, {
3466
- "aria-labelledby": id,
3467
- onBlurCapture: handleBlur,
3468
- onClickOutside: handleMenuClickOutside,
3469
- onEscape: handleMenuEscape,
3470
- onItemClick: handleItemClick,
3471
- originElement: buttonElement,
3472
- registerElement,
3473
- shouldFocus
3474
- }), $[28] = buttonElement, $[29] = handleBlur, $[30] = handleItemClick, $[31] = handleMenuClickOutside, $[32] = handleMenuEscape, $[33] = id, $[34] = menuProp, $[35] = shouldFocus, $[36] = t16) : t16 = $[36];
3475
- let menu = t16, t17;
3476
- $[37] !== buttonProp || $[38] !== handleMouseDown || $[39] !== id || $[40] !== open ? (t17 = buttonProp && cloneElement(buttonProp, {
3477
- "data-ui": "MenuButton",
3478
- id,
3479
- onClick: handleButtonClick,
3480
- onKeyDown: handleButtonKeyDown,
3481
- onMouseDown: handleMouseDown,
3482
- "aria-haspopup": !0,
3483
- "aria-expanded": open,
3484
- ref: setButtonElement,
3485
- selected: buttonProp.props.selected ?? open
3486
- }), $[37] = buttonProp, $[38] = handleMouseDown, $[39] = id, $[40] = open, $[41] = t17) : t17 = $[41];
3487
- let button = t17, t18, t19;
3488
- $[42] === buttonElement ? (t18 = $[43], t19 = $[44]) : (t18 = () => buttonElement, t19 = [buttonElement], $[42] = buttonElement, $[43] = t18, $[44] = t19), useImperativeHandle(forwardedRef, t18, t19);
3489
- let t20;
3490
- $[45] === popover ? t20 = $[46] : (t20 = popover || {}, $[45] = popover, $[46] = t20);
3491
- let t21;
3492
- $[47] === t20 ? t21 = $[48] : (t21 = {
3493
- overflow: "auto",
3494
- portal: !0,
3495
- ...t20
3496
- }, $[47] = t20, $[48] = t21);
3497
- let popoverProps = t21, t22;
3498
- $[49] === button ? t22 = $[50] : (t22 = button || /* @__PURE__ */ jsx(Fragment$1, {}), $[49] = button, $[50] = t22);
3499
- let t23;
3500
- return $[51] !== menu || $[52] !== open || $[53] !== popoverProps || $[54] !== t22 ? (t23 = /* @__PURE__ */ jsx(Popover, {
3501
- "data-ui": "MenuButton__popover",
3502
- ...popoverProps,
3503
- content: menu,
3504
- open,
3505
- children: t22
3506
- }), $[51] = menu, $[52] = open, $[53] = popoverProps, $[54] = t22, $[55] = t23) : t23 = $[55], t23;
3507
- };
3508
- function _temp$7(v) {
3509
- return !v;
3510
- }
3511
- /**
3512
- * @public
3513
- */
3514
- const MenuDivider = styled.hr.withConfig({
3515
- displayName: "MenuDivider",
3516
- componentId: "sc-sxuath-0"
3517
- })`height:1px;border:0;background:var(--card-hairline-soft-color);margin:0;`;
3518
- function selectableBaseStyle() {
3519
- return css`background-color:inherit;color:inherit;&[data-as='button']{-webkit-font-smoothing:inherit;appearance:none;outline:none;font:inherit;text-align:inherit;border:0;width:-moz-available;width:-webkit-fill-available;width:stretch;}&[data-as='a']{text-decoration:none;}`;
3520
- }
3521
- function selectableColorStyle(props) {
3522
- let { $tone } = props, { color, style } = getTheme_v2(props.theme), tone = color.selectable[$tone];
3523
- return css`${_cardColorStyle(color, tone.enabled)} background-color:var(--card-bg-color);color:var(--card-fg-color);outline:none;&[data-as='button']{&:disabled{${_cardColorStyle(color, tone.disabled)}}&:not(:disabled){&[aria-pressed='true']{${_cardColorStyle(color, tone.pressed)}}&[data-selected],&[aria-selected='true'] > &{${_cardColorStyle(color, tone.selected)}}@media (hover:hover){&:not([data-selected]){&[data-hovered],&:hover{${_cardColorStyle(color, tone.hovered)}}&:active{${_cardColorStyle(color, tone.pressed)}}}}}}&[data-as='a']{&[data-disabled]{${_cardColorStyle(color, tone.disabled)}}&:not([data-disabled]){&[data-pressed]{${_cardColorStyle(color, tone.pressed)}}&[data-selected]{${_cardColorStyle(color, tone.selected)}}@media (hover:hover){&:not([data-selected]){&[data-hovered],&:hover{${_cardColorStyle(color, tone.hovered)}}&:active{${_cardColorStyle(color, tone.pressed)}}}}}}${style?.card?.root}`;
3524
- }
3525
- /**
3526
- * @internal
3527
- */
3528
- const Selectable = /* @__PURE__ */ styled(Box).withConfig({
3529
- displayName: "Selectable",
3530
- componentId: "sc-njdnrn-0"
3531
- })(responsiveRadiusStyle, selectableBaseStyle, selectableColorStyle);
3532
- function useMenu() {
3533
- let value = useContext(MenuContext);
3534
- if (!value) throw Error("useMenu(): missing context value");
3535
- if (!isRecord(value) || value.version !== 2) throw Error("useMenu(): the context value is not compatible");
3536
- return value;
3537
- }
3538
- /**
3539
- * @public
3540
- */
3541
- const MenuGroup = function MenuGroup(props) {
3542
- let $ = c(81), IconComponent, children, menuProps, onClick, popover, restProps, t0, t1, t2, t3, t4, t5, text;
3543
- $[0] === props ? (IconComponent = $[1], children = $[2], menuProps = $[3], onClick = $[4], popover = $[5], restProps = $[6], t0 = $[7], t1 = $[8], t2 = $[9], t3 = $[10], t4 = $[11], t5 = $[12], text = $[13]) : ({as: t0, children, fontSize: t1, icon: IconComponent, menu: menuProps, onClick, padding: t2, popover, radius: t3, gap: t4, text, tone: t5, ...restProps} = props, $[0] = props, $[1] = IconComponent, $[2] = children, $[3] = menuProps, $[4] = onClick, $[5] = popover, $[6] = restProps, $[7] = t0, $[8] = t1, $[9] = t2, $[10] = t3, $[11] = t4, $[12] = t5, $[13] = text);
3544
- let as = t0 === void 0 ? "button" : t0, fontSize = t1 === void 0 ? 1 : t1, padding = t2 === void 0 ? 3 : t2, radius = t3 === void 0 ? 2 : t3, gap = t4 === void 0 ? 3 : t4, tone = t5 === void 0 ? "default" : t5, menu = useMenu(), { scheme } = useRootTheme(), { activeElement, mount, onClickOutside, onEscape, onItemClick, onItemMouseEnter: _onItemMouseEnter, registerElement } = menu, onItemMouseEnter = _onItemMouseEnter ?? menu.onItemMouseEnter, [rootElement, setRootElement] = useState(null), [open, setOpen] = useState(!1), [shouldFocus, setShouldFocus] = useState(null), active = !!activeElement && activeElement === rootElement, [withinMenu, setWithinMenu] = useState(!1), t6;
3545
- $[14] === onItemMouseEnter ? t6 = $[15] : (t6 = (event) => {
3546
- setWithinMenu(!1), onItemMouseEnter(event), setOpen(!0);
3547
- }, $[14] = onItemMouseEnter, $[15] = t6);
3548
- let handleMouseEnter = t6, t7;
3549
- $[16] === rootElement ? t7 = $[17] : (t7 = (event_0) => {
3550
- event_0.key === "ArrowLeft" && (event_0.stopPropagation(), setOpen(!1), requestAnimationFrame(() => {
3551
- rootElement?.focus();
3552
- }));
3553
- }, $[16] = rootElement, $[17] = t7);
3554
- let handleMenuKeyDown = t7, t8;
3555
- $[18] === onClick ? t8 = $[19] : (t8 = (event_1) => {
3556
- onClick?.(event_1), setShouldFocus("first"), setOpen(!0);
3557
- }, $[18] = onClick, $[19] = t8);
3558
- let handleClick = t8, t9;
3559
- $[20] === onItemClick ? t9 = $[21] : (t9 = () => {
3560
- setOpen(!1), onItemClick?.();
3561
- }, $[20] = onItemClick, $[21] = t9);
3562
- let handleChildItemClick = t9, t10;
3563
- $[22] === Symbol.for("react.memo_cache_sentinel") ? (t10 = () => setWithinMenu(!0), $[22] = t10) : t10 = $[22];
3564
- let handleMenuMouseEnter = t10, t11, t12;
3565
- $[23] !== mount || $[24] !== rootElement ? (t11 = () => mount(rootElement), t12 = [mount, rootElement], $[23] = mount, $[24] = rootElement, $[25] = t11, $[26] = t12) : (t11 = $[25], t12 = $[26]), useEffect(t11, t12);
3566
- let t13, t14;
3567
- $[27] === active ? (t13 = $[28], t14 = $[29]) : (t13 = () => {
3568
- active || setOpen(!1);
3569
- }, t14 = [active], $[27] = active, $[28] = t13, $[29] = t14), useEffect(t13, t14);
3570
- let t15, t16;
3571
- $[30] === open ? (t15 = $[31], t16 = $[32]) : (t15 = () => {
3572
- open || setWithinMenu(!1);
3573
- }, t16 = [open], $[30] = open, $[31] = t15, $[32] = t16), useEffect(t15, t16);
3574
- let t17, t18;
3575
- $[33] === shouldFocus ? (t17 = $[34], t18 = $[35]) : (t17 = () => {
3576
- if (!shouldFocus) return;
3577
- let rafId = requestAnimationFrame(() => setShouldFocus(null));
3578
- return () => cancelAnimationFrame(rafId);
3579
- }, t18 = [shouldFocus], $[33] = shouldFocus, $[34] = t17, $[35] = t18), useEffect(t17, t18);
3580
- let t19;
3581
- $[36] !== children || $[37] !== handleChildItemClick || $[38] !== handleMenuKeyDown || $[39] !== menuProps || $[40] !== onClickOutside || $[41] !== onEscape || $[42] !== registerElement || $[43] !== shouldFocus ? (t19 = /* @__PURE__ */ jsx(Menu, {
3582
- ...menuProps,
253
+ contentRef,
254
+ footer,
255
+ header,
256
+ id,
3583
257
  onClickOutside,
3584
- onEscape,
3585
- onItemClick: handleChildItemClick,
3586
- onKeyDown: handleMenuKeyDown,
3587
- onMouseEnter: handleMenuMouseEnter,
3588
- registerElement,
3589
- shouldFocus,
258
+ onClose,
259
+ portal: portalProp,
260
+ radius: cardRadius,
261
+ ref: cardRef,
262
+ scheme,
263
+ shadow: cardShadow,
264
+ width,
3590
265
  children
3591
- }), $[36] = children, $[37] = handleChildItemClick, $[38] = handleMenuKeyDown, $[39] = menuProps, $[40] = onClickOutside, $[41] = onEscape, $[42] = registerElement, $[43] = shouldFocus, $[44] = t19) : t19 = $[44];
3592
- let childMenu = t19, t20;
3593
- $[45] === Symbol.for("react.memo_cache_sentinel") ? (t20 = (event_2) => {
3594
- let target = event_2.currentTarget;
3595
- if (document.activeElement === target && event_2.key === "ArrowRight") {
3596
- setShouldFocus("first"), setOpen(!0), setWithinMenu(!0);
3597
- return;
3598
- }
3599
- }, $[45] = t20) : t20 = $[45];
3600
- let handleKeyDown = t20, t21 = as === "button" ? withinMenu : void 0, t22 = as === "button" ? void 0 : withinMenu, t23 = !withinMenu && active ? "" : void 0, t24;
3601
- $[46] === radius ? t24 = $[47] : (t24 = _getArrayProp(radius), $[46] = radius, $[47] = t24);
3602
- let t25 = as === "button" ? "button" : void 0, t26;
3603
- $[48] !== IconComponent || $[49] !== fontSize ? (t26 = IconComponent && /* @__PURE__ */ jsxs(Text, {
3604
- size: fontSize,
3605
- children: [isValidElement(IconComponent) && IconComponent, isValidElementType(IconComponent) && /* @__PURE__ */ jsx(IconComponent, {})]
3606
- }), $[48] = IconComponent, $[49] = fontSize, $[50] = t26) : t26 = $[50];
3607
- let t27;
3608
- $[51] !== fontSize || $[52] !== text ? (t27 = /* @__PURE__ */ jsx(Box, {
3609
- flex: 1,
3610
- children: /* @__PURE__ */ jsx(Text, {
3611
- size: fontSize,
3612
- textOverflow: "ellipsis",
3613
- weight: "medium",
3614
- children: text
3615
- })
3616
- }), $[51] = fontSize, $[52] = text, $[53] = t27) : t27 = $[53];
3617
- let t28;
3618
- $[54] === Symbol.for("react.memo_cache_sentinel") ? (t28 = /* @__PURE__ */ jsx(ChevronRightIcon, {}), $[54] = t28) : t28 = $[54];
3619
- let t29;
3620
- $[55] === fontSize ? t29 = $[56] : (t29 = /* @__PURE__ */ jsx(Text, {
3621
- size: fontSize,
3622
- children: t28
3623
- }), $[55] = fontSize, $[56] = t29);
3624
- let t30;
3625
- $[57] !== gap || $[58] !== padding || $[59] !== t26 || $[60] !== t27 || $[61] !== t29 ? (t30 = /* @__PURE__ */ jsxs(Flex, {
3626
- gap,
3627
- padding,
3628
- children: [
3629
- t26,
3630
- t27,
3631
- t29
3632
- ]
3633
- }), $[57] = gap, $[58] = padding, $[59] = t26, $[60] = t27, $[61] = t29, $[62] = t30) : t30 = $[62];
3634
- let t31;
3635
- $[63] !== as || $[64] !== handleClick || $[65] !== handleMouseEnter || $[66] !== restProps || $[67] !== scheme || $[68] !== t21 || $[69] !== t22 || $[70] !== t23 || $[71] !== t24 || $[72] !== t25 || $[73] !== t30 || $[74] !== tone ? (t31 = /* @__PURE__ */ jsx(Selectable, {
3636
- "data-as": as,
3637
- "data-ui": "MenuGroup",
3638
- forwardedAs: as,
3639
- ...restProps,
3640
- "aria-pressed": t21,
3641
- "data-pressed": t22,
3642
- "data-selected": t23,
3643
- $radius: t24,
3644
- $tone: tone,
3645
- $scheme: scheme,
3646
- onClick: handleClick,
3647
- onKeyDown: handleKeyDown,
3648
- onMouseEnter: handleMouseEnter,
3649
- ref: setRootElement,
3650
- tabIndex: -1,
3651
- type: t25,
3652
- children: t30
3653
- }), $[63] = as, $[64] = handleClick, $[65] = handleMouseEnter, $[66] = restProps, $[67] = scheme, $[68] = t21, $[69] = t22, $[70] = t23, $[71] = t24, $[72] = t25, $[73] = t30, $[74] = tone, $[75] = t31) : t31 = $[75];
3654
- let t32;
3655
- return $[76] !== childMenu || $[77] !== open || $[78] !== popover || $[79] !== t31 ? (t32 = /* @__PURE__ */ jsx(Popover, {
3656
- ...popover,
3657
- content: childMenu,
3658
- "data-ui": "MenuGroup__popover",
3659
- open,
3660
- children: t31
3661
- }), $[76] = childMenu, $[77] = open, $[78] = popover, $[79] = t31, $[80] = t32) : t32 = $[80], t32;
3662
- }, MenuItem = function MenuItem(props) {
3663
- let $ = c(76), IconComponent, IconRightComponent, children, disabled, forwardedRef, hotkeys, onClick, paddingBottom, paddingLeft, paddingRight, paddingTop, paddingX, paddingY, pressed, restProps, selectedProp, t0, t1, t2, t3, t4, t5, text;
3664
- $[0] === props ? (IconComponent = $[1], IconRightComponent = $[2], children = $[3], disabled = $[4], forwardedRef = $[5], hotkeys = $[6], onClick = $[7], paddingBottom = $[8], paddingLeft = $[9], paddingRight = $[10], paddingTop = $[11], paddingX = $[12], paddingY = $[13], pressed = $[14], restProps = $[15], selectedProp = $[16], t0 = $[17], t1 = $[18], t2 = $[19], t3 = $[20], t4 = $[21], t5 = $[22], text = $[23]) : ({as: t0, children, disabled, fontSize: t1, hotkeys, icon: IconComponent, iconRight: IconRightComponent, onClick, padding: t2, paddingX, paddingY, paddingTop, paddingRight, paddingBottom, paddingLeft, pressed, radius: t3, ref: forwardedRef, selected: selectedProp, gap: t4, text, tone: t5, ...restProps} = props, $[0] = props, $[1] = IconComponent, $[2] = IconRightComponent, $[3] = children, $[4] = disabled, $[5] = forwardedRef, $[6] = hotkeys, $[7] = onClick, $[8] = paddingBottom, $[9] = paddingLeft, $[10] = paddingRight, $[11] = paddingTop, $[12] = paddingX, $[13] = paddingY, $[14] = pressed, $[15] = restProps, $[16] = selectedProp, $[17] = t0, $[18] = t1, $[19] = t2, $[20] = t3, $[21] = t4, $[22] = t5, $[23] = text);
3665
- let as = t0 === void 0 ? "button" : t0, fontSize = t1 === void 0 ? 1 : t1, padding = t2 === void 0 ? 3 : t2, radius = t3 === void 0 ? 2 : t3, gap = t4 === void 0 ? 3 : t4, tone = t5 === void 0 ? "default" : t5, { scheme } = useRootTheme(), menu = useMenu(), { activeElement, mount, onItemClick, onItemMouseEnter: _onItemMouseEnter, onItemMouseLeave: _onItemMouseLeave } = menu, onItemMouseEnter = _onItemMouseEnter ?? menu.onItemMouseEnter, onItemMouseLeave = _onItemMouseLeave ?? menu.onItemMouseLeave, [rootElement, setRootElement] = useState(null), active = !!activeElement && activeElement === rootElement, ref = useRef(null), t6;
3666
- $[24] === Symbol.for("react.memo_cache_sentinel") ? (t6 = () => ref.current, $[24] = t6) : t6 = $[24], useImperativeHandle(forwardedRef, t6);
3667
- let t7, t8;
3668
- $[25] !== mount || $[26] !== rootElement || $[27] !== selectedProp ? (t7 = () => mount(rootElement, selectedProp), t8 = [
3669
- mount,
3670
- rootElement,
3671
- selectedProp
3672
- ], $[25] = mount, $[26] = rootElement, $[27] = selectedProp, $[28] = t7, $[29] = t8) : (t7 = $[28], t8 = $[29]), useEffect(t7, t8);
3673
- let t9;
3674
- $[30] !== disabled || $[31] !== onClick || $[32] !== onItemClick ? (t9 = (event) => {
3675
- disabled || (onClick && onClick(event), onItemClick && onItemClick());
3676
- }, $[30] = disabled, $[31] = onClick, $[32] = onItemClick, $[33] = t9) : t9 = $[33];
3677
- let handleClick = t9, t10;
3678
- $[34] !== padding || $[35] !== paddingBottom || $[36] !== paddingLeft || $[37] !== paddingRight || $[38] !== paddingTop || $[39] !== paddingX || $[40] !== paddingY ? (t10 = {
3679
- padding,
3680
- paddingX,
3681
- paddingY,
3682
- paddingTop,
3683
- paddingRight,
3684
- paddingBottom,
3685
- paddingLeft
3686
- }, $[34] = padding, $[35] = paddingBottom, $[36] = paddingLeft, $[37] = paddingRight, $[38] = paddingTop, $[39] = paddingX, $[40] = paddingY, $[41] = t10) : t10 = $[41];
3687
- let paddingProps = t10, t11;
3688
- $[42] === fontSize ? t11 = $[43] : (t11 = _getArrayProp(fontSize).map(_temp$6), $[42] = fontSize, $[43] = t11);
3689
- let hotkeysFontSize = t11, t12;
3690
- $[44] === Symbol.for("react.memo_cache_sentinel") ? (t12 = (el) => {
3691
- ref.current = el, setRootElement(el);
3692
- }, $[44] = t12) : t12 = $[44];
3693
- let setRef = t12, t13 = as !== "button" && pressed ? "" : void 0, t14 = active ? "" : void 0, t15 = disabled ? "" : void 0, t16;
3694
- $[45] === radius ? t16 = $[46] : (t16 = _getArrayProp(radius), $[45] = radius, $[46] = t16);
266
+ }), $[39] = autoFocus, $[40] = cardRadius, $[41] = cardShadow, $[42] = children, $[43] = contentRef, $[44] = footer, $[45] = header, $[46] = hideCloseButton, $[47] = id, $[48] = onClickOutside, $[49] = onClose, $[50] = portalProp, $[51] = scheme, $[52] = width, $[53] = t15) : t15 = $[53];
267
+ let t16;
268
+ $[54] === Symbol.for("react.memo_cache_sentinel") ? (t16 = /* @__PURE__ */ jsx("div", {
269
+ ref: postDivRef,
270
+ tabIndex: 0
271
+ }), $[54] = t16) : t16 = $[54];
3695
272
  let t17;
3696
- $[47] === Symbol.for("react.memo_cache_sentinel") ? (t17 = _getArrayProp(0), $[47] = t17) : t17 = $[47];
3697
- let t18 = disabled ? "default" : tone, t19 = as === "button" ? "button" : void 0, t20;
3698
- $[48] !== IconComponent || $[49] !== IconRightComponent || $[50] !== fontSize || $[51] !== gap || $[52] !== hotkeys || $[53] !== hotkeysFontSize || $[54] !== paddingProps || $[55] !== text ? (t20 = (IconComponent || text || IconRightComponent) && /* @__PURE__ */ jsxs(Flex, {
3699
- as: "span",
3700
- gap,
3701
- align: "center",
3702
- ...paddingProps,
273
+ $[55] !== animate || $[56] !== handleFocus || $[57] !== handleRootClick || $[58] !== id || $[59] !== labelId || $[60] !== onActivate || $[61] !== padding || $[62] !== position || $[63] !== ref || $[64] !== restProps || $[65] !== t15 || $[66] !== zOffset ? (t17 = /* @__PURE__ */ jsxs(StyledDialog, {
274
+ ...restProps,
275
+ $animate: animate,
276
+ $padding: padding,
277
+ $position: position,
278
+ "aria-labelledby": labelId,
279
+ "aria-modal": !0,
280
+ "data-ui": "Dialog",
281
+ id,
282
+ onActivate,
283
+ onClick: handleRootClick,
284
+ onFocus: handleFocus,
285
+ ref,
286
+ role: "dialog",
287
+ zOffset,
3703
288
  children: [
3704
- IconComponent && /* @__PURE__ */ jsxs(Text, {
3705
- size: fontSize,
3706
- children: [isValidElement(IconComponent) && IconComponent, isValidElementType(IconComponent) && /* @__PURE__ */ jsx(IconComponent, {})]
3707
- }),
3708
- text && /* @__PURE__ */ jsx(Box, {
3709
- flex: 1,
3710
- children: /* @__PURE__ */ jsx(Text, {
3711
- size: fontSize,
3712
- textOverflow: "ellipsis",
3713
- weight: "medium",
3714
- children: text
3715
- })
3716
- }),
3717
- hotkeys && /* @__PURE__ */ jsx(Hotkeys, {
3718
- fontSize: hotkeysFontSize,
3719
- keys: hotkeys,
3720
- style: {
3721
- marginTop: -4,
3722
- marginBottom: -4
3723
- }
3724
- }),
3725
- IconRightComponent && /* @__PURE__ */ jsxs(Text, {
3726
- size: fontSize,
3727
- children: [isValidElement(IconRightComponent) && IconRightComponent, isValidElementType(IconRightComponent) && /* @__PURE__ */ jsx(IconRightComponent, {})]
3728
- })
289
+ t14,
290
+ t15,
291
+ t16
3729
292
  ]
3730
- }), $[48] = IconComponent, $[49] = IconRightComponent, $[50] = fontSize, $[51] = gap, $[52] = hotkeys, $[53] = hotkeysFontSize, $[54] = paddingProps, $[55] = text, $[56] = t20) : t20 = $[56];
3731
- let t21;
3732
- $[57] !== children || $[58] !== paddingProps ? (t21 = children && /* @__PURE__ */ jsx(Box, {
3733
- as: "span",
3734
- ...paddingProps,
3735
- children
3736
- }), $[57] = children, $[58] = paddingProps, $[59] = t21) : t21 = $[59];
3737
- let t22;
3738
- return $[60] !== as || $[61] !== disabled || $[62] !== handleClick || $[63] !== onItemMouseEnter || $[64] !== onItemMouseLeave || $[65] !== restProps || $[66] !== scheme || $[67] !== t13 || $[68] !== t14 || $[69] !== t15 || $[70] !== t16 || $[71] !== t18 || $[72] !== t19 || $[73] !== t20 || $[74] !== t21 ? (t22 = /* @__PURE__ */ jsxs(Selectable, {
3739
- "data-ui": "MenuItem",
3740
- role: "menuitem",
3741
- ...restProps,
3742
- "data-pressed": t13,
3743
- "data-selected": t14,
3744
- "data-disabled": t15,
3745
- forwardedAs: as,
3746
- $radius: t16,
3747
- $padding: t17,
3748
- $tone: t18,
3749
- $scheme: scheme,
3750
- disabled,
3751
- onClick: handleClick,
3752
- onMouseEnter: onItemMouseEnter,
3753
- onMouseLeave: onItemMouseLeave,
3754
- ref: setRef,
3755
- tabIndex: -1,
3756
- type: t19,
3757
- children: [t20, t21]
3758
- }), $[60] = as, $[61] = disabled, $[62] = handleClick, $[63] = onItemMouseEnter, $[64] = onItemMouseLeave, $[65] = restProps, $[66] = scheme, $[67] = t13, $[68] = t14, $[69] = t15, $[70] = t16, $[71] = t18, $[72] = t19, $[73] = t20, $[74] = t21, $[75] = t22) : t22 = $[75], t22;
293
+ }), $[55] = animate, $[56] = handleFocus, $[57] = handleRootClick, $[58] = id, $[59] = labelId, $[60] = onActivate, $[61] = padding, $[62] = position, $[63] = ref, $[64] = restProps, $[65] = t15, $[66] = zOffset, $[67] = t17) : t17 = $[67];
294
+ let t18;
295
+ return $[68] !== portalProp || $[69] !== t17 ? (t18 = /* @__PURE__ */ jsx(Portal, {
296
+ __unstable_name: portalProp,
297
+ children: t17
298
+ }), $[68] = portalProp, $[69] = t17, $[70] = t18) : t18 = $[70], t18;
3759
299
  };
3760
- function _temp$6(s) {
3761
- return s - 1;
300
+ /**
301
+ * This API might change. DO NOT USE IN PRODUCTION.
302
+ * @beta
303
+ */
304
+ function DialogProvider(props) {
305
+ let $ = c(6), { children, position, zOffset } = props, t0;
306
+ $[0] !== position || $[1] !== zOffset ? (t0 = {
307
+ version: 0,
308
+ position,
309
+ zOffset
310
+ }, $[0] = position, $[1] = zOffset, $[2] = t0) : t0 = $[2];
311
+ let contextValue = t0, t1;
312
+ return $[3] !== children || $[4] !== contextValue ? (t1 = /* @__PURE__ */ jsx(DialogContext.Provider, {
313
+ value: contextValue,
314
+ children
315
+ }), $[3] = children, $[4] = contextValue, $[5] = t1) : t1 = $[5], t1;
3762
316
  }
3763
317
  const animation = css`background-image:linear-gradient( to right,var(--card-skeleton-color-from),var(--card-skeleton-color-to),var(--card-skeleton-color-from),var(--card-skeleton-color-from),var(--card-skeleton-color-from) );background-position:100%;background-size:200% 100%;background-attachment:fixed;animation-name:${keyframes`0%{background-position:100%;}100%{background-position:-100%;}`};animation-timing-function:ease-in-out;animation-iteration-count:infinite;animation-duration:2000ms;`, skeletonStyle = css`opacity:${({ $visible }) => +!!$visible};transition:opacity 200ms ease-in;@media screen and (prefers-reduced-motion:no-preference){${({ $animated }) => $animated ? animation : css`background-color:var(--card-skeleton-color-from);`}}@media screen and (prefers-reduced-motion:reduce){background-color:var(--card-skeleton-color-from);}`, StyledSkeleton$1 = /* @__PURE__ */ styled(Box).withConfig({
3764
318
  displayName: "StyledSkeleton",
@@ -3919,385 +473,7 @@ const animation = css`background-image:linear-gradient( to right,var(--card-skel
3919
473
  tabIndex: t0,
3920
474
  children: props.children
3921
475
  }), $[3] = flex, $[4] = props.children, $[5] = restProps, $[6] = t0, $[7] = t1) : t1 = $[7], t1;
3922
- }, STATUS_CARD_TONE = {
3923
- error: "critical",
3924
- warning: "caution",
3925
- success: "positive",
3926
- info: "neutral"
3927
- }, BUTTON_TONE = {
3928
- error: "critical",
3929
- warning: "caution",
3930
- success: "positive",
3931
- info: "neutral"
3932
- }, TextBox = styled(Flex).withConfig({
3933
- displayName: "TextBox",
3934
- componentId: "sc-xd2ehd-0"
3935
- })`overflow-x:auto;`, StyledToast = styled(Card).withConfig({
3936
- displayName: "StyledToast",
3937
- componentId: "sc-xd2ehd-1"
3938
- })`pointer-events:all;width:100%;position:relative;overflow:hidden;overflow:clip;&[data-has-duration]{padding-bottom:calc(${2}px / 2);}`, LoadingBar = styled.div.withConfig({
3939
- displayName: "LoadingBar",
3940
- componentId: "sc-xd2ehd-2"
3941
- })`display:flex;position:absolute;bottom:0px;top:0px;left:0px;right:0px;pointer-events:none;z-index:-1;overflow:hidden;overflow:clip;background:transparent;align-items:flex-end;will-change:opacity;`, LoadingBarMask = styled(Card).withConfig({
3942
- displayName: "LoadingBarMask",
3943
- componentId: "sc-xd2ehd-3"
3944
- })`position:absolute;top:0;left:-${2}px;right:-${2}px;bottom:${2}px;z-index:1;`, LoadingBarProgress = styled(Card).withConfig({
3945
- displayName: "LoadingBarProgress",
3946
- componentId: "sc-xd2ehd-4"
3947
- })`display:block;height:100%;width:100%;transform-origin:0% 50%;background-color:${(props) => {
3948
- let { color } = getTheme_v2(props.theme);
3949
- return color.button.default[props.tone].enabled.bg;
3950
- }};`, ROLES = {
3951
- error: "alert",
3952
- warning: "alert",
3953
- success: "alert",
3954
- info: "alert"
3955
- };
3956
- /**
3957
- * The `Toast` component gives feedback to users when an action has taken place.
3958
- *
3959
- * Toasts can be closed with a close button, or auto-dismiss after a certain timeout.
3960
- *
3961
- * @public
3962
- */
3963
- function Toast(props) {
3964
- let $ = c(50), closable, description, duration, onClose, restProps, status, t0, title, updatedAt;
3965
- $[0] === props ? (closable = $[1], description = $[2], duration = $[3], onClose = $[4], restProps = $[5], status = $[6], t0 = $[7], title = $[8], updatedAt = $[9]) : ({closable, description, duration, onClose, radius: t0, title, status, updatedAt, ...restProps} = props, $[0] = props, $[1] = closable, $[2] = description, $[3] = duration, $[4] = onClose, $[5] = restProps, $[6] = status, $[7] = t0, $[8] = title, $[9] = updatedAt);
3966
- let radius = t0 === void 0 ? 3 : t0, cardTone = status ? STATUS_CARD_TONE[status] : "default", buttonTone = status ? BUTTON_TONE[status] : "default", role = status ? ROLES[status] : "status", visualDuration = usePrefersReducedMotion() ? 0 : .26, t1;
3967
- $[10] === visualDuration ? t1 = $[11] : (t1 = visualDuration ? {
3968
- type: "spring",
3969
- visualDuration,
3970
- bounce: .25
3971
- } : { duration: 0 }, $[10] = visualDuration, $[11] = t1);
3972
- let transition = t1, hasDuration = duration && isFinite(duration) && duration < 20736e5, t2;
3973
- $[12] === Symbol.for("react.memo_cache_sentinel") ? (t2 = ["hidden", "initial"], $[12] = t2) : t2 = $[12];
3974
- let initial = t2, t3;
3975
- $[13] === Symbol.for("react.memo_cache_sentinel") ? (t3 = ["visible", "slideIn"], $[13] = t3) : t3 = $[13];
3976
- let animate = t3, t4;
3977
- $[14] === Symbol.for("react.memo_cache_sentinel") ? (t4 = ["hidden", "slideOut"], $[14] = t4) : t4 = $[14];
3978
- let exit = t4, t5 = hasDuration ? "" : void 0, t6;
3979
- $[15] === title ? t6 = $[16] : (t6 = title && /* @__PURE__ */ jsx(Text, {
3980
- size: 1,
3981
- weight: "medium",
3982
- children: title
3983
- }), $[15] = title, $[16] = t6);
3984
- let t7;
3985
- $[17] !== description || $[18] !== transition ? (t7 = description && /* @__PURE__ */ jsx(MotionText, {
3986
- muted: !0,
3987
- size: 1,
3988
- variants: content,
3989
- transition,
3990
- children: description
3991
- }), $[17] = description, $[18] = transition, $[19] = t7) : t7 = $[19];
3992
- let t8;
3993
- $[20] !== t6 || $[21] !== t7 ? (t8 = /* @__PURE__ */ jsx(TextBox, {
3994
- flex: 1,
3995
- padding: 3,
3996
- children: /* @__PURE__ */ jsxs(Stack, {
3997
- gap: 3,
3998
- children: [t6, t7]
3999
- })
4000
- }), $[20] = t6, $[21] = t7, $[22] = t8) : t8 = $[22];
4001
- let t9;
4002
- $[23] !== buttonTone || $[24] !== closable || $[25] !== onClose ? (t9 = closable && /* @__PURE__ */ jsx(Box, {
4003
- padding: 1,
4004
- children: /* @__PURE__ */ jsx(Button, {
4005
- as: "button",
4006
- icon: CloseIcon,
4007
- mode: "bleed",
4008
- padding: 2,
4009
- tone: buttonTone,
4010
- onClick: onClose,
4011
- style: { verticalAlign: "top" }
4012
- })
4013
- }), $[23] = buttonTone, $[24] = closable, $[25] = onClose, $[26] = t9) : t9 = $[26];
4014
- let t10;
4015
- $[27] !== t8 || $[28] !== t9 || $[29] !== transition ? (t10 = /* @__PURE__ */ jsxs(MotionFlex, {
4016
- align: "flex-start",
4017
- variants: content,
4018
- transition,
4019
- children: [t8, t9]
4020
- }), $[27] = t8, $[28] = t9, $[29] = transition, $[30] = t10) : t10 = $[30];
4021
- let t11;
4022
- $[31] !== cardTone || $[32] !== duration || $[33] !== hasDuration || $[34] !== onClose || $[35] !== radius || $[36] !== transition || $[37] !== updatedAt || $[38] !== visualDuration ? (t11 = hasDuration && /* @__PURE__ */ jsxs(MotionLoadingBar, {
4023
- variants: content,
4024
- transition,
4025
- children: [/* @__PURE__ */ jsx(LoadingBarMask, {
4026
- tone: cardTone,
4027
- radius
4028
- }), /* @__PURE__ */ jsx(MotionLoadingBarProgress, {
4029
- tone: cardTone,
4030
- initial: { scaleX: 0 },
4031
- animate: { scaleX: 1 },
4032
- transition: {
4033
- delay: visualDuration,
4034
- duration: duration / 1e3,
4035
- ease: "linear"
4036
- },
4037
- onAnimationComplete: onClose
4038
- }, `progress-${updatedAt}`)]
4039
- }), $[31] = cardTone, $[32] = duration, $[33] = hasDuration, $[34] = onClose, $[35] = radius, $[36] = transition, $[37] = updatedAt, $[38] = visualDuration, $[39] = t11) : t11 = $[39];
4040
- let t12;
4041
- return $[40] !== cardTone || $[41] !== radius || $[42] !== restProps || $[43] !== role || $[44] !== t10 || $[45] !== t11 || $[46] !== t5 || $[47] !== transition || $[48] !== visualDuration ? (t12 = /* @__PURE__ */ jsxs(MotionToast, {
4042
- "data-ui": "Toast",
4043
- role,
4044
- ...restProps,
4045
- "data-has-duration": t5,
4046
- custom: visualDuration,
4047
- radius,
4048
- shadow: 2,
4049
- tone: cardTone,
4050
- forwardedAs: "li",
4051
- layout: "position",
4052
- variants: container,
4053
- initial,
4054
- animate,
4055
- exit,
4056
- transition,
4057
- children: [t10, t11]
4058
- }), $[40] = cardTone, $[41] = radius, $[42] = restProps, $[43] = role, $[44] = t10, $[45] = t11, $[46] = t5, $[47] = transition, $[48] = visualDuration, $[49] = t12) : t12 = $[49], t12;
4059
- }
4060
- const container = {
4061
- initial: {
4062
- y: 32,
4063
- scale: .5,
4064
- zIndex: 1
4065
- },
4066
- hidden: { opacity: 0 },
4067
- visible: (visualDuration) => visualDuration ? {
4068
- opacity: 1,
4069
- transition: {
4070
- when: "beforeChildren",
4071
- delayChildren: stagger(visualDuration / 3),
4072
- duration: visualDuration / 3
4073
- }
4074
- } : { opacity: 1 },
4075
- slideIn: {
4076
- y: 0,
4077
- scale: 1
4078
- },
4079
- slideOut: {
4080
- zIndex: 0,
4081
- scale: .75
4082
- }
4083
- }, content = {
4084
- initial: { willChange: "transform" },
4085
- hidden: { opacity: 0 },
4086
- visible: { opacity: 1 }
4087
- }, MotionToast = motion.create(StyledToast), MotionFlex = motion.create(Flex), MotionText = motion.create(Text), MotionLoadingBar = motion.create(LoadingBar), MotionLoadingBarProgress = motion.create(LoadingBarProgress);
4088
- /**
4089
- * Some components should only render after mounting to the DOM, and not be rendered at all during SSR renderToString or equivalent.
4090
- * @public
4091
- */
4092
- function useMounted() {
4093
- return useSyncExternalStore(subscribe, _temp$5, _temp2$1);
4094
- }
4095
- function _temp2$1() {
4096
- return !1;
4097
- }
4098
- function _temp$5() {
4099
- return !0;
4100
- }
4101
- const subscribe = () => () => {}, ToastContext = createGlobalScopedContext("@sanity/ui/context/toast", null), GRID_CSS = {
4102
- "&&:not([hidden])": { display: "grid" },
4103
- "&[data-as=\"ul\"],&[data-as=\"ol\"]": { listStyle: "none" }
4104
- }, GRID_AUTO_COLUMS = {
4105
- auto: "auto",
4106
- min: "min-content",
4107
- max: "max-content",
4108
- fr: "minmax(0, 1fr)"
4109
- }, GRID_AUTO_ROWS = {
4110
- auto: "auto",
4111
- min: "min-content",
4112
- max: "max-content",
4113
- fr: "minmax(0, 1fr)"
4114
476
  };
4115
- function responsiveGridStyle() {
4116
- return [
4117
- GRID_CSS,
4118
- responsiveGridAutoFlowStyle,
4119
- responsiveGridAutoRowsStyle,
4120
- responsiveGridAutoColsStyle,
4121
- responsiveGridColumnsStyle,
4122
- responsiveGridRowsStyle,
4123
- responsiveGridGapStyle,
4124
- responsiveGridGapXStyle,
4125
- responsiveGridGapYStyle
4126
- ];
4127
- }
4128
- function responsiveGridAutoFlowStyle(props) {
4129
- let { media } = getTheme_v2(props.theme);
4130
- return _responsive(media, props.$autoFlow, (autoFlow) => ({ gridAutoFlow: autoFlow }));
4131
- }
4132
- function responsiveGridAutoRowsStyle(props) {
4133
- let { media } = getTheme_v2(props.theme);
4134
- return _responsive(media, props.$autoRows, (autoRows) => ({ gridAutoRows: autoRows && GRID_AUTO_ROWS[autoRows] }));
4135
- }
4136
- function responsiveGridAutoColsStyle(props) {
4137
- let { media } = getTheme_v2(props.theme);
4138
- return _responsive(media, props.$autoCols, (autoCols) => ({ gridAutoColumns: autoCols && GRID_AUTO_COLUMS[autoCols] }));
4139
- }
4140
- function responsiveGridColumnsStyle(props) {
4141
- let { media } = getTheme_v2(props.theme);
4142
- return _responsive(media, props.$columns, (columns) => ({ gridTemplateColumns: columns && `repeat(${columns},minmax(0,1fr));` }));
4143
- }
4144
- function responsiveGridRowsStyle(props) {
4145
- let { media } = getTheme_v2(props.theme);
4146
- return _responsive(media, props.$rows, (rows) => ({ gridTemplateRows: rows && `repeat(${rows},minmax(0,1fr));` }));
4147
- }
4148
- function responsiveGridGapStyle(props) {
4149
- let { media, space } = getTheme_v2(props.theme);
4150
- return _responsive(media, props.$gap, (gap) => ({ gridGap: gap ? rem(space[gap]) : void 0 }));
4151
- }
4152
- function responsiveGridGapXStyle(props) {
4153
- let { media, space } = getTheme_v2(props.theme);
4154
- return _responsive(media, props.$gapX, (gapX) => ({ columnGap: gapX ? rem(space[gapX]) : void 0 }));
4155
- }
4156
- function responsiveGridGapYStyle(props) {
4157
- let { media, space } = getTheme_v2(props.theme);
4158
- return _responsive(media, props.$gapY, (gapY) => ({ rowGap: gapY ? rem(space[gapY]) : void 0 }));
4159
- }
4160
- const StyledGrid = /* @__PURE__ */ styled(Box).withConfig({
4161
- displayName: "StyledGrid",
4162
- componentId: "sc-47qdzn-0"
4163
- })(responsiveGridStyle), Grid = function Grid(props) {
4164
- let $ = c(43), as, autoCols, autoFlow, autoRows, children, gap, gapX, gapY, gridTemplateColumns, gridTemplateRows, ref, restProps;
4165
- $[0] === props ? (as = $[1], autoCols = $[2], autoFlow = $[3], autoRows = $[4], children = $[5], gap = $[6], gapX = $[7], gapY = $[8], gridTemplateColumns = $[9], gridTemplateRows = $[10], ref = $[11], restProps = $[12]) : ({as, autoRows, autoCols, autoFlow, gridTemplateColumns, gap, gapX, gapY, gridTemplateRows, children, ref, ...restProps} = props, $[0] = props, $[1] = as, $[2] = autoCols, $[3] = autoFlow, $[4] = autoRows, $[5] = children, $[6] = gap, $[7] = gapX, $[8] = gapY, $[9] = gridTemplateColumns, $[10] = gridTemplateRows, $[11] = ref, $[12] = restProps);
4166
- let t0 = typeof as == "string" ? as : void 0, t1;
4167
- $[13] === autoRows ? t1 = $[14] : (t1 = _getArrayProp(autoRows), $[13] = autoRows, $[14] = t1);
4168
- let t2;
4169
- $[15] === autoCols ? t2 = $[16] : (t2 = _getArrayProp(autoCols), $[15] = autoCols, $[16] = t2);
4170
- let t3;
4171
- $[17] === autoFlow ? t3 = $[18] : (t3 = _getArrayProp(autoFlow), $[17] = autoFlow, $[18] = t3);
4172
- let t4;
4173
- $[19] === gridTemplateColumns ? t4 = $[20] : (t4 = _getArrayProp(gridTemplateColumns), $[19] = gridTemplateColumns, $[20] = t4);
4174
- let t5;
4175
- $[21] === gap ? t5 = $[22] : (t5 = _getArrayProp(gap), $[21] = gap, $[22] = t5);
4176
- let t6;
4177
- $[23] === gapX ? t6 = $[24] : (t6 = _getArrayProp(gapX), $[23] = gapX, $[24] = t6);
4178
- let t7;
4179
- $[25] === gapY ? t7 = $[26] : (t7 = _getArrayProp(gapY), $[25] = gapY, $[26] = t7);
4180
- let t8;
4181
- $[27] === gridTemplateRows ? t8 = $[28] : (t8 = _getArrayProp(gridTemplateRows), $[27] = gridTemplateRows, $[28] = t8);
4182
- let t9;
4183
- return $[29] !== as || $[30] !== children || $[31] !== ref || $[32] !== restProps || $[33] !== t0 || $[34] !== t1 || $[35] !== t2 || $[36] !== t3 || $[37] !== t4 || $[38] !== t5 || $[39] !== t6 || $[40] !== t7 || $[41] !== t8 ? (t9 = /* @__PURE__ */ jsx(StyledGrid, {
4184
- "data-as": t0,
4185
- "data-ui": "Grid",
4186
- ...restProps,
4187
- $autoRows: t1,
4188
- $autoCols: t2,
4189
- $autoFlow: t3,
4190
- $columns: t4,
4191
- $gap: t5,
4192
- $gapX: t6,
4193
- $gapY: t7,
4194
- $rows: t8,
4195
- forwardedAs: as,
4196
- ref,
4197
- children
4198
- }), $[29] = as, $[30] = children, $[31] = ref, $[32] = restProps, $[33] = t0, $[34] = t1, $[35] = t2, $[36] = t3, $[37] = t4, $[38] = t5, $[39] = t6, $[40] = t7, $[41] = t8, $[42] = t9) : t9 = $[42], t9;
4199
- };
4200
- /**
4201
- * @internal
4202
- */
4203
- function ToastLayer(props) {
4204
- let $ = c(9), { children, padding: t0, paddingX, paddingY, gap: t1 } = props, padding = t0 === void 0 ? 4 : t0, gap = t1 === void 0 ? 3 : t1, { zIndex } = useLayer(), t2;
4205
- $[0] === zIndex ? t2 = $[1] : (t2 = { zIndex }, $[0] = zIndex, $[1] = t2);
4206
- let t3;
4207
- return $[2] !== children || $[3] !== gap || $[4] !== padding || $[5] !== paddingX || $[6] !== paddingY || $[7] !== t2 ? (t3 = /* @__PURE__ */ jsx(StyledLayer, {
4208
- forwardedAs: "ul",
4209
- "data-ui": "ToastProvider",
4210
- padding,
4211
- paddingX,
4212
- paddingY,
4213
- gap,
4214
- gridTemplateColumns: 1,
4215
- style: t2,
4216
- children
4217
- }), $[2] = children, $[3] = gap, $[4] = padding, $[5] = paddingX, $[6] = paddingY, $[7] = t2, $[8] = t3) : t3 = $[8], t3;
4218
- }
4219
- const StyledLayer = styled(Grid).withConfig({
4220
- displayName: "StyledLayer",
4221
- componentId: "sc-kxgg1x-0"
4222
- })`box-sizing:border-box;position:fixed;right:0;bottom:0;list-style:none;pointer-events:none;max-width:420px;width:100%;`;
4223
- let toastId = 0;
4224
- /** @internal */
4225
- function generateToastId() {
4226
- return String(toastId++);
4227
- }
4228
- /**
4229
- * @public
4230
- */
4231
- function ToastProvider(props) {
4232
- let $ = c(13), { children, padding, paddingX, paddingY, gap, zOffset: t0 } = props, zOffset = t0 === void 0 ? 1 : t0, t1;
4233
- $[0] === Symbol.for("react.memo_cache_sentinel") ? (t1 = [], $[0] = t1) : t1 = $[0];
4234
- let [state, setState] = useState(t1), mounted = useMounted(), t2;
4235
- if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
4236
- let push = (params) => {
4237
- let id = params.id || generateToastId(), duration = params.duration || 5e3;
4238
- return startTransition(() => {
4239
- setState((prevState) => {
4240
- if (duration === .01) return prevState.filter((toast) => toast.id !== id);
4241
- let dismiss = () => startTransition(() => setState((currentState) => currentState.filter((toast_0) => toast_0.id !== id)));
4242
- return [...prevState.filter((toast_1) => toast_1.id !== id), {
4243
- dismiss,
4244
- id,
4245
- updatedAt: Date.now(),
4246
- params: {
4247
- ...params,
4248
- duration
4249
- }
4250
- }];
4251
- });
4252
- }), id;
4253
- };
4254
- t2 = {
4255
- version: 0,
4256
- push
4257
- }, $[1] = t2;
4258
- } else t2 = $[1];
4259
- let value = t2, t3;
4260
- $[2] !== gap || $[3] !== mounted || $[4] !== padding || $[5] !== paddingX || $[6] !== paddingY || $[7] !== state || $[8] !== zOffset ? (t3 = mounted && /* @__PURE__ */ jsx(LayerProvider, {
4261
- zOffset,
4262
- children: /* @__PURE__ */ jsx(ToastLayer, {
4263
- padding,
4264
- paddingX,
4265
- paddingY,
4266
- gap,
4267
- children: /* @__PURE__ */ jsx(AnimatePresence, {
4268
- initial: !1,
4269
- mode: "popLayout",
4270
- children: state.map(_temp$4)
4271
- })
4272
- })
4273
- }), $[2] = gap, $[3] = mounted, $[4] = padding, $[5] = paddingX, $[6] = paddingY, $[7] = state, $[8] = zOffset, $[9] = t3) : t3 = $[9];
4274
- let t4;
4275
- return $[10] !== children || $[11] !== t3 ? (t4 = /* @__PURE__ */ jsxs(ToastContext.Provider, {
4276
- value,
4277
- children: [children, t3]
4278
- }), $[10] = children, $[11] = t3, $[12] = t4) : t4 = $[12], t4;
4279
- }
4280
- function _temp$4(t0) {
4281
- let { dismiss: dismiss_0, id: id_0, params: params_0, updatedAt } = t0;
4282
- return /* @__PURE__ */ jsx(Toast, {
4283
- closable: params_0.closable,
4284
- description: params_0.description,
4285
- onClose: dismiss_0,
4286
- status: params_0.status,
4287
- title: params_0.title,
4288
- duration: params_0.duration,
4289
- updatedAt
4290
- }, id_0);
4291
- }
4292
- /**
4293
- * @public
4294
- */
4295
- function useToast() {
4296
- let value = useContext(ToastContext);
4297
- if (!value) throw Error("useToast(): missing context value");
4298
- if (!isRecord(value) || value.version !== 0) throw Error("useToast(): the context value is not compatible");
4299
- return value;
4300
- }
4301
477
  function _findPrevItemElement(state, itemElements, focusedElement) {
4302
478
  let idx = itemElements.indexOf(focusedElement), els = itemElements.slice(0, idx), len = els.length;
4303
479
  for (let i = len - 1; i >= 0; --i) {
@@ -5228,87 +1404,6 @@ const StyledCheckbox = /* @__PURE__ */ styled.div.withConfig({
5228
1404
  }), $[22] = className, $[23] = style, $[24] = t6, $[25] = t8) : t8 = $[25], t8;
5229
1405
  };
5230
1406
  /**
5231
- * Get responsive CSS for the `code` font style.
5232
- * @internal
5233
- */
5234
- function responsiveCodeFontStyle(props) {
5235
- return responsiveFont("code", props);
5236
- }
5237
- function codeSyntaxHighlightingStyle({ theme }) {
5238
- let { color: { syntax: color } } = getTheme_v2(theme);
5239
- return {
5240
- "&.atrule": { color: color.atrule },
5241
- "&.attr-name": { color: color.attrName },
5242
- "&.attr-value": { color: color.attrValue },
5243
- "&.attribute": { color: color.attribute },
5244
- "&.boolean": { color: color.boolean },
5245
- "&.builtin": { color: color.builtin },
5246
- "&.cdata": { color: color.cdata },
5247
- "&.char": { color: color.char },
5248
- "&.class": { color: color.class },
5249
- "&.class-name": { color: color.className },
5250
- "&.comment": { color: color.comment },
5251
- "&.constant": { color: color.constant },
5252
- "&.deleted": { color: color.deleted },
5253
- "&.doctype": { color: color.doctype },
5254
- "&.entity": { color: color.entity },
5255
- "&.function": { color: color.function },
5256
- "&.hexcode": { color: color.hexcode },
5257
- "&.id": { color: color.id },
5258
- "&.important": { color: color.important },
5259
- "&.inserted": { color: color.inserted },
5260
- "&.keyword": { color: color.keyword },
5261
- "&.number": { color: color.number },
5262
- "&.operator": { color: color.operator },
5263
- "&.prolog": { color: color.prolog },
5264
- "&.property": { color: color.property },
5265
- "&.pseudo-class": { color: color.pseudoClass },
5266
- "&.pseudo-element": { color: color.pseudoElement },
5267
- "&.punctuation": { color: color.punctuation },
5268
- "&.regex": { color: color.regex },
5269
- "&.selector": { color: color.selector },
5270
- "&.string": { color: color.string },
5271
- "&.symbol": { color: color.symbol },
5272
- "&.tag": { color: color.tag },
5273
- "&.unit": { color: color.unit },
5274
- "&.url": { color: color.url },
5275
- "&.variable": { color: color.variable }
5276
- };
5277
- }
5278
- function codeBaseStyle() {
5279
- return css`color:var(--card-code-fg-color);& code{font-family:inherit;&.refractor .token{${codeSyntaxHighlightingStyle}}}& a{color:inherit;text-decoration:underline;border-radius:1px;}& svg{display:inline;}& [data-sanity-icon]{vertical-align:baseline;}`;
5280
- }
5281
- const LazyRefractor = lazy(() => import("./refractor-CC48DwHi.js")), StyledCode = /* @__PURE__ */ styled.pre.withConfig({
5282
- displayName: "StyledCode",
5283
- componentId: "sc-o5lc7q-0"
5284
- })(codeBaseStyle, responsiveCodeFontStyle), Code = function Code(props) {
5285
- let $ = c(23), children, language, ref, restProps, t0, weight;
5286
- $[0] === props ? (children = $[1], language = $[2], ref = $[3], restProps = $[4], t0 = $[5], weight = $[6]) : ({children, language, ref, size: t0, weight, ...restProps} = props, $[0] = props, $[1] = children, $[2] = language, $[3] = ref, $[4] = restProps, $[5] = t0, $[6] = weight);
5287
- let size = t0 === void 0 ? 2 : t0, t1;
5288
- $[7] === size ? t1 = $[8] : (t1 = _getArrayProp(size), $[7] = size, $[8] = t1);
5289
- let t2 = weight, t3;
5290
- $[9] === children ? t3 = $[10] : (t3 = /* @__PURE__ */ jsx("code", { children }), $[9] = children, $[10] = t3);
5291
- let t4;
5292
- $[11] !== children || $[12] !== language ? (t4 = /* @__PURE__ */ jsx(LazyRefractor, {
5293
- language,
5294
- value: children
5295
- }), $[11] = children, $[12] = language, $[13] = t4) : t4 = $[13];
5296
- let t5;
5297
- $[14] !== t3 || $[15] !== t4 ? (t5 = /* @__PURE__ */ jsx(Suspense, {
5298
- fallback: t3,
5299
- children: t4
5300
- }), $[14] = t3, $[15] = t4, $[16] = t5) : t5 = $[16];
5301
- let t6;
5302
- return $[17] !== ref || $[18] !== restProps || $[19] !== t1 || $[20] !== t2 || $[21] !== t5 ? (t6 = /* @__PURE__ */ jsx(StyledCode, {
5303
- "data-ui": "Code",
5304
- ...restProps,
5305
- $size: t1,
5306
- $weight: t2,
5307
- ref,
5308
- children: t5
5309
- }), $[17] = ref, $[18] = restProps, $[19] = t1, $[20] = t2, $[21] = t5, $[22] = t6) : t6 = $[22], t6;
5310
- };
5311
- /**
5312
1407
  * Get responsive CSS for the `heading` font style.
5313
1408
  * @internal
5314
1409
  */
@@ -5637,422 +1732,6 @@ const StyledSwitch = /* @__PURE__ */ styled.span.withConfig({
5637
1732
  }), $[33] = t12, $[34] = t15, $[35] = t16) : t16 = $[35], t16;
5638
1733
  };
5639
1734
  /**
5640
- * @beta
5641
- */
5642
- function useDelayedState(initialState) {
5643
- let $ = c(5), [state, setState] = useState(initialState), delayedAction = useRef(void 0), t0;
5644
- $[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = (nextState, delay) => {
5645
- let action = () => {
5646
- setState(nextState);
5647
- };
5648
- if (delayedAction.current &&= (clearTimeout(delayedAction.current), void 0), !delay) return action();
5649
- delayedAction.current = setTimeout(action, delay);
5650
- }, $[0] = t0) : t0 = $[0];
5651
- let onStateChange = t0, t1, t2;
5652
- $[1] === Symbol.for("react.memo_cache_sentinel") ? (t1 = () => () => {
5653
- delayedAction.current && clearTimeout(delayedAction.current);
5654
- }, t2 = [], $[1] = t1, $[2] = t2) : (t1 = $[1], t2 = $[2]), useEffect(t1, t2);
5655
- let t3;
5656
- return $[3] === state ? t3 = $[4] : (t3 = [state, onStateChange], $[3] = state, $[4] = t3), t3;
5657
- }
5658
- const DEFAULT_FALLBACK_PLACEMENTS = {
5659
- top: [
5660
- "top-end",
5661
- "top-start",
5662
- "bottom",
5663
- "left",
5664
- "right"
5665
- ],
5666
- "top-start": [
5667
- "top",
5668
- "top-end",
5669
- "bottom-start",
5670
- "left-start",
5671
- "right-start"
5672
- ],
5673
- "top-end": [
5674
- "top",
5675
- "top-start",
5676
- "bottom-end",
5677
- "left-end",
5678
- "right-end"
5679
- ],
5680
- bottom: [
5681
- "bottom-end",
5682
- "bottom-start",
5683
- "top",
5684
- "left",
5685
- "right"
5686
- ],
5687
- "bottom-start": [
5688
- "bottom",
5689
- "bottom-end",
5690
- "top-start",
5691
- "left-start",
5692
- "right-start"
5693
- ],
5694
- "bottom-end": [
5695
- "bottom",
5696
- "bottom-start",
5697
- "top-end",
5698
- "left-end",
5699
- "right-end"
5700
- ],
5701
- left: [
5702
- "left-end",
5703
- "left-start",
5704
- "right",
5705
- "top",
5706
- "bottom"
5707
- ],
5708
- "left-start": [
5709
- "left",
5710
- "left-end",
5711
- "right-start",
5712
- "top-start",
5713
- "bottom-start"
5714
- ],
5715
- "left-end": [
5716
- "left",
5717
- "left-start",
5718
- "right-end",
5719
- "top-end",
5720
- "bottom-end"
5721
- ],
5722
- right: [
5723
- "right-end",
5724
- "right-start",
5725
- "left",
5726
- "top",
5727
- "bottom"
5728
- ],
5729
- "right-start": [
5730
- "right",
5731
- "right-end",
5732
- "left-start",
5733
- "top-start",
5734
- "bottom-start"
5735
- ],
5736
- "right-end": [
5737
- "right",
5738
- "right-start",
5739
- "left-end",
5740
- "top-end",
5741
- "bottom-end"
5742
- ]
5743
- }, MotionCard = styled(motion.create(Card)).withConfig({
5744
- displayName: "MotionCard",
5745
- componentId: "sc-qzzn8n-0"
5746
- })`will-change:transform;`, TooltipCard = function TooltipCard(props) {
5747
- let $ = c(49), animate, arrow, arrowRef, arrowX, arrowY, children, originX, originY, padding, placement, radius, ref, restProps, scheme, shadow, style;
5748
- $[0] === props ? (animate = $[1], arrow = $[2], arrowRef = $[3], arrowX = $[4], arrowY = $[5], children = $[6], originX = $[7], originY = $[8], padding = $[9], placement = $[10], radius = $[11], ref = $[12], restProps = $[13], scheme = $[14], shadow = $[15], style = $[16]) : ({animate, arrow, arrowRef, arrowX, arrowY, children, originX, originY, padding, placement, radius, ref, scheme, shadow, style, ...restProps} = 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] = ref, $[13] = restProps, $[14] = scheme, $[15] = shadow, $[16] = style);
5749
- let t0 = animate ? "transform" : void 0, t1;
5750
- $[17] !== originX || $[18] !== originY || $[19] !== style || $[20] !== t0 ? (t1 = {
5751
- originX,
5752
- originY,
5753
- willChange: t0,
5754
- ...style
5755
- }, $[17] = originX, $[18] = originY, $[19] = style, $[20] = t0, $[21] = t1) : t1 = $[21];
5756
- let rootStyle = t1, t2 = arrowX === null ? void 0 : arrowX, t3 = arrowY === null ? void 0 : arrowY, t4;
5757
- $[22] !== t2 || $[23] !== t3 ? (t4 = {
5758
- left: t2,
5759
- top: t3,
5760
- right: void 0,
5761
- bottom: void 0
5762
- }, $[22] = t2, $[23] = t3, $[24] = t4) : t4 = $[24];
5763
- let arrowStyle = t4, t5 = restProps, t6;
5764
- $[25] === animate ? t6 = $[26] : (t6 = animate ? ["hidden", "initial"] : void 0, $[25] = animate, $[26] = t6);
5765
- let t7;
5766
- $[27] === animate ? t7 = $[28] : (t7 = animate ? ["visible", "scaleIn"] : void 0, $[27] = animate, $[28] = t7);
5767
- let t8;
5768
- $[29] === animate ? t8 = $[30] : (t8 = animate ? ["hidden", "scaleOut"] : void 0, $[29] = animate, $[30] = t8);
5769
- let t9;
5770
- $[31] !== arrow || $[32] !== arrowRef || $[33] !== arrowStyle ? (t9 = arrow && /* @__PURE__ */ jsx(Arrow, {
5771
- ref: arrowRef,
5772
- style: arrowStyle,
5773
- width: 15,
5774
- height: 6,
5775
- radius: 2
5776
- }), $[31] = arrow, $[32] = arrowRef, $[33] = arrowStyle, $[34] = t9) : t9 = $[34];
5777
- let t10;
5778
- return $[35] !== children || $[36] !== padding || $[37] !== placement || $[38] !== radius || $[39] !== ref || $[40] !== rootStyle || $[41] !== scheme || $[42] !== shadow || $[43] !== t5 || $[44] !== t6 || $[45] !== t7 || $[46] !== t8 || $[47] !== t9 ? (t10 = /* @__PURE__ */ jsxs(MotionCard, {
5779
- "data-ui": "Tooltip__card",
5780
- ...t5,
5781
- "data-placement": placement,
5782
- padding,
5783
- radius,
5784
- ref,
5785
- scheme,
5786
- shadow,
5787
- style: rootStyle,
5788
- variants: POPOVER_MOTION_PROPS.card,
5789
- transition: POPOVER_MOTION_PROPS.transition,
5790
- initial: t6,
5791
- animate: t7,
5792
- exit: t8,
5793
- children: [children, t9]
5794
- }), $[35] = children, $[36] = padding, $[37] = placement, $[38] = radius, $[39] = ref, $[40] = rootStyle, $[41] = scheme, $[42] = shadow, $[43] = t5, $[44] = t6, $[45] = t7, $[46] = t8, $[47] = t9, $[48] = t10) : t10 = $[48], t10;
5795
- }, TooltipDelayGroupContext = createGlobalScopedContext("@sanity/ui/context/tooltipDelayGroup", null);
5796
- /**
5797
- * @beta
5798
- */
5799
- function useTooltipDelayGroup() {
5800
- return useContext(TooltipDelayGroupContext);
5801
- }
5802
- const StyledTooltip = styled(Layer).withConfig({
5803
- displayName: "StyledTooltip",
5804
- componentId: "sc-yxng5e-0"
5805
- })`pointer-events:none;`, Tooltip = function Tooltip(props) {
5806
- let $ = c(138), boundaryElementContext = useBoundaryElement(), { layer } = useTheme_v2(), _boundaryElement, _fallbackPlacementsProp, _zOffset, childProp, content, delay, disabled, forwardedRef, portalProp, restProps, scheme, t0, t1, t2, t3, t4, t5;
5807
- $[0] === props ? (_boundaryElement = $[1], _fallbackPlacementsProp = $[2], _zOffset = $[3], childProp = $[4], content = $[5], delay = $[6], disabled = $[7], forwardedRef = $[8], portalProp = $[9], restProps = $[10], scheme = $[11], t0 = $[12], t1 = $[13], t2 = $[14], t3 = $[15], t4 = $[16], t5 = $[17]) : ({animate: t0, arrow: t1, boundaryElement: _boundaryElement, children: childProp, content, disabled, fallbackPlacements: _fallbackPlacementsProp, padding: t2, placement: t3, portal: portalProp, radius: t4, ref: forwardedRef, scheme, shadow: t5, zOffset: _zOffset, delay, ...restProps} = props, $[0] = props, $[1] = _boundaryElement, $[2] = _fallbackPlacementsProp, $[3] = _zOffset, $[4] = childProp, $[5] = content, $[6] = delay, $[7] = disabled, $[8] = forwardedRef, $[9] = portalProp, $[10] = restProps, $[11] = scheme, $[12] = t0, $[13] = t1, $[14] = t2, $[15] = t3, $[16] = t4, $[17] = t5);
5808
- let _animate = t0 !== void 0 && t0, arrowProp = t1 !== void 0 && t1, padding = t2 === void 0 ? 2 : t2, placementProp = t3 === void 0 ? "bottom" : t3, radius = t4 === void 0 ? 2 : t4, shadow = t5 === void 0 ? 2 : t5, boundaryElement = _boundaryElement ?? boundaryElementContext?.element, fallbackPlacementsProp = _fallbackPlacementsProp ?? DEFAULT_FALLBACK_PLACEMENTS[props.placement ?? "bottom"], zOffset = _zOffset ?? layer.tooltip.zOffset, animate = !usePrefersReducedMotion() && _animate, t6;
5809
- $[18] === fallbackPlacementsProp ? t6 = $[19] : (t6 = _getArrayProp(fallbackPlacementsProp), $[18] = fallbackPlacementsProp, $[19] = t6);
5810
- let fallbackPlacements = t6, ref = useRef(null), [referenceElement, setReferenceElement] = useState(null), arrowRef = useRef(null), [tooltipMaxWidth, setTooltipMaxWidth] = useState(0), t7;
5811
- $[20] === Symbol.for("react.memo_cache_sentinel") ? (t7 = () => ref.current, $[20] = t7) : t7 = $[20], useImperativeHandle(forwardedRef, t7);
5812
- let portal = usePortal(), portalElement = typeof portalProp == "string" ? portal.elements?.[portalProp] || null : portal.element, t8;
5813
- $[21] !== animate || $[22] !== arrowProp || $[23] !== boundaryElement || $[24] !== fallbackPlacements ? (t8 = {
5814
- animate,
5815
- arrowProp,
5816
- arrowRef,
5817
- boundaryElement,
5818
- fallbackPlacements,
5819
- rootBoundary: "viewport"
5820
- }, $[21] = animate, $[22] = arrowProp, $[23] = boundaryElement, $[24] = fallbackPlacements, $[25] = t8) : t8 = $[25];
5821
- let middleware = useMiddleware(t8), t9;
5822
- $[26] === referenceElement ? t9 = $[27] : (t9 = { reference: referenceElement }, $[26] = referenceElement, $[27] = t9);
5823
- let t10;
5824
- $[28] !== middleware || $[29] !== placementProp || $[30] !== t9 ? (t10 = {
5825
- middleware,
5826
- placement: placementProp,
5827
- whileElementsMounted: autoUpdate,
5828
- elements: t9
5829
- }, $[28] = middleware, $[29] = placementProp, $[30] = t9, $[31] = t10) : t10 = $[31];
5830
- let { floatingStyles, placement, middlewareData, refs, update } = useFloating(t10), arrowX = middlewareData.arrow?.x, arrowY = middlewareData.arrow?.y, originX = middlewareData["@sanity/ui/origin"]?.originX, originY = middlewareData["@sanity/ui/origin"]?.originY, tooltipId = useId(), [isOpen, setIsOpen] = useDelayedState(!1), delayGroupContext = useTooltipDelayGroup(), t11;
5831
- $[32] === delayGroupContext ? t11 = $[33] : (t11 = delayGroupContext || {}, $[32] = delayGroupContext, $[33] = t11);
5832
- let { setIsGroupActive, setOpenTooltipId } = t11, 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, t12;
5833
- $[34] !== closeDelay || $[35] !== isInsideGroup || $[36] !== openDelay || $[37] !== setIsGroupActive || $[38] !== setIsOpen || $[39] !== setOpenTooltipId || $[40] !== tooltipId ? (t12 = (open, immediate) => {
5834
- if (isInsideGroup) if (open) {
5835
- let groupedOpenDelay = immediate ? 0 : openDelay;
5836
- setIsGroupActive?.(open, groupedOpenDelay), setOpenTooltipId?.(tooltipId, groupedOpenDelay);
5837
- } else setIsGroupActive?.(open, closeDelay > 200 ? closeDelay : 200), setOpenTooltipId?.(null, immediate ? 0 : closeDelay);
5838
- else setIsOpen(open, immediate ? 0 : open ? openDelay : closeDelay);
5839
- }, $[34] = closeDelay, $[35] = isInsideGroup, $[36] = openDelay, $[37] = setIsGroupActive, $[38] = setIsOpen, $[39] = setOpenTooltipId, $[40] = tooltipId, $[41] = t12) : t12 = $[41];
5840
- let handleIsOpenChange = t12, t13;
5841
- $[42] !== childProp?.props || $[43] !== handleIsOpenChange ? (t13 = (e) => {
5842
- handleIsOpenChange(!1), childProp?.props?.onBlur?.(e);
5843
- }, $[42] = childProp?.props, $[43] = handleIsOpenChange, $[44] = t13) : t13 = $[44], childProp?.props;
5844
- let handleBlur = t13, t14;
5845
- $[45] !== childProp?.props || $[46] !== handleIsOpenChange ? (t14 = (e_0) => {
5846
- handleIsOpenChange(!1, !0), childProp?.props.onClick?.(e_0);
5847
- }, $[45] = childProp?.props, $[46] = handleIsOpenChange, $[47] = t14) : t14 = $[47], childProp?.props;
5848
- let handleClick = t14, t15;
5849
- $[48] !== childProp?.props || $[49] !== handleIsOpenChange ? (t15 = (e_1) => {
5850
- handleIsOpenChange(!1, !0), childProp?.props.onContextMenu?.(e_1);
5851
- }, $[48] = childProp?.props, $[49] = handleIsOpenChange, $[50] = t15) : t15 = $[50], childProp?.props;
5852
- let handleContextMenu = t15, t16;
5853
- $[51] !== childProp?.props || $[52] !== handleIsOpenChange ? (t16 = (e_2) => {
5854
- handleIsOpenChange(!0), childProp?.props?.onFocus?.(e_2);
5855
- }, $[51] = childProp?.props, $[52] = handleIsOpenChange, $[53] = t16) : t16 = $[53], childProp?.props;
5856
- let handleFocus = t16, t17;
5857
- $[54] !== childProp?.props || $[55] !== handleIsOpenChange ? (t17 = (e_3) => {
5858
- handleIsOpenChange(!0), childProp?.props?.onMouseEnter?.(e_3);
5859
- }, $[54] = childProp?.props, $[55] = handleIsOpenChange, $[56] = t17) : t17 = $[56], childProp?.props;
5860
- let handleMouseEnter = t17, t18;
5861
- $[57] !== childProp?.props || $[58] !== handleIsOpenChange ? (t18 = (e_4) => {
5862
- handleIsOpenChange(!1), childProp?.props?.onMouseLeave?.(e_4);
5863
- }, $[57] = childProp?.props, $[58] = handleIsOpenChange, $[59] = t18) : t18 = $[59], childProp?.props;
5864
- let handleMouseLeave = t18, t19;
5865
- $[60] !== handleIsOpenChange || $[61] !== isInsideGroup || $[62] !== referenceElement || $[63] !== showTooltip ? (t19 = {
5866
- handleIsOpenChange,
5867
- referenceElement,
5868
- showTooltip,
5869
- isInsideGroup
5870
- }, $[60] = handleIsOpenChange, $[61] = isInsideGroup, $[62] = referenceElement, $[63] = showTooltip, $[64] = t19) : t19 = $[64], useCloseOnMouseLeave(t19);
5871
- let t20, t21;
5872
- $[65] !== disabled || $[66] !== handleIsOpenChange || $[67] !== showTooltip ? (t20 = () => {
5873
- disabled && showTooltip && handleIsOpenChange(!1);
5874
- }, t21 = [
5875
- disabled,
5876
- handleIsOpenChange,
5877
- showTooltip
5878
- ], $[65] = disabled, $[66] = handleIsOpenChange, $[67] = showTooltip, $[68] = t20, $[69] = t21) : (t20 = $[68], t21 = $[69]), useEffect(t20, t21);
5879
- let t22, t23;
5880
- $[70] !== content || $[71] !== handleIsOpenChange || $[72] !== showTooltip ? (t22 = () => {
5881
- !content && showTooltip && handleIsOpenChange(!1);
5882
- }, t23 = [
5883
- content,
5884
- handleIsOpenChange,
5885
- showTooltip
5886
- ], $[70] = content, $[71] = handleIsOpenChange, $[72] = showTooltip, $[73] = t22, $[74] = t23) : (t22 = $[73], t23 = $[74]), useEffect(t22, t23);
5887
- let t24, t25;
5888
- $[75] !== handleIsOpenChange || $[76] !== showTooltip ? (t24 = () => {
5889
- if (!showTooltip) return;
5890
- let handleWindowKeyDown = function handleWindowKeyDown(event) {
5891
- event.key === "Escape" && handleIsOpenChange(!1, !0);
5892
- };
5893
- return window.addEventListener("keydown", handleWindowKeyDown), () => {
5894
- window.removeEventListener("keydown", handleWindowKeyDown);
5895
- };
5896
- }, t25 = [handleIsOpenChange, showTooltip], $[75] = handleIsOpenChange, $[76] = showTooltip, $[77] = t24, $[78] = t25) : (t24 = $[77], t25 = $[78]), useEffect(t24, t25);
5897
- let t26;
5898
- $[79] !== boundaryElement || $[80] !== portalElement?.offsetWidth ? (t26 = () => {
5899
- let availableWidths = [...boundaryElement ? [boundaryElement.offsetWidth] : [], portalElement?.offsetWidth || document.body.offsetWidth];
5900
- setTooltipMaxWidth(Math.min(...availableWidths) - 8);
5901
- }, $[79] = boundaryElement, $[80] = portalElement?.offsetWidth, $[81] = t26) : t26 = $[81];
5902
- let t27;
5903
- $[82] !== boundaryElement || $[83] !== portalElement ? (t27 = [boundaryElement, portalElement], $[82] = boundaryElement, $[83] = portalElement, $[84] = t27) : t27 = $[84], useLayoutEffect(t26, t27);
5904
- let t28;
5905
- $[85] === update ? t28 = $[86] : (t28 = (arrowEl) => {
5906
- arrowRef.current = arrowEl, update();
5907
- }, $[85] = update, $[86] = t28);
5908
- let setArrow = t28, t29;
5909
- $[87] === refs ? t29 = $[88] : (t29 = (node) => {
5910
- ref.current = node, refs.setFloating(node);
5911
- }, $[87] = refs, $[88] = t29);
5912
- let setFloating = t29, t30;
5913
- bb0: {
5914
- if (!childProp) {
5915
- t30 = null;
5916
- break bb0;
5917
- }
5918
- let t31;
5919
- $[89] !== childProp || $[90] !== handleBlur || $[91] !== handleClick || $[92] !== handleContextMenu || $[93] !== handleFocus || $[94] !== handleMouseEnter || $[95] !== handleMouseLeave ? (t31 = cloneElement(childProp, {
5920
- onBlur: handleBlur,
5921
- onFocus: handleFocus,
5922
- onMouseEnter: handleMouseEnter,
5923
- onMouseLeave: handleMouseLeave,
5924
- onClick: handleClick,
5925
- onContextMenu: handleContextMenu,
5926
- ref: setReferenceElement
5927
- }), $[89] = childProp, $[90] = handleBlur, $[91] = handleClick, $[92] = handleContextMenu, $[93] = handleFocus, $[94] = handleMouseEnter, $[95] = handleMouseLeave, $[96] = t31) : t31 = $[96], t30 = t31;
5928
- }
5929
- let child = t30, t31;
5930
- $[97] === childProp ? t31 = $[98] : (t31 = childProp ? getElementRef(childProp) : null, $[97] = childProp, $[98] = t31);
5931
- let t32, t33;
5932
- if ($[99] === referenceElement ? (t32 = $[100], t33 = $[101]) : (t32 = () => referenceElement, t33 = [referenceElement], $[99] = referenceElement, $[100] = t32, $[101] = t33), useImperativeHandle(t31, t32, t33), !child) {
5933
- let t34;
5934
- return $[102] === Symbol.for("react.memo_cache_sentinel") ? (t34 = /* @__PURE__ */ jsx(Fragment$1, {}), $[102] = t34) : t34 = $[102], t34;
5935
- }
5936
- if (disabled) return child;
5937
- let t34 = tooltipMaxWidth > 0 ? `${tooltipMaxWidth}px` : void 0, t35;
5938
- $[103] !== floatingStyles || $[104] !== t34 ? (t35 = {
5939
- ...floatingStyles,
5940
- maxWidth: t34
5941
- }, $[103] = floatingStyles, $[104] = t34, $[105] = t35) : t35 = $[105];
5942
- let t36;
5943
- $[106] !== animate || $[107] !== arrowProp || $[108] !== arrowX || $[109] !== arrowY || $[110] !== content || $[111] !== originX || $[112] !== originY || $[113] !== padding || $[114] !== placement || $[115] !== radius || $[116] !== restProps || $[117] !== scheme || $[118] !== setArrow || $[119] !== setFloating || $[120] !== shadow ? (t36 = /* @__PURE__ */ jsx(TooltipCard, {
5944
- ...restProps,
5945
- animate,
5946
- arrow: arrowProp,
5947
- arrowRef: setArrow,
5948
- arrowX,
5949
- arrowY,
5950
- originX,
5951
- originY,
5952
- padding,
5953
- placement,
5954
- radius,
5955
- ref: setFloating,
5956
- scheme,
5957
- shadow,
5958
- children: content
5959
- }), $[106] = animate, $[107] = arrowProp, $[108] = arrowX, $[109] = arrowY, $[110] = content, $[111] = originX, $[112] = originY, $[113] = padding, $[114] = placement, $[115] = radius, $[116] = restProps, $[117] = scheme, $[118] = setArrow, $[119] = setFloating, $[120] = shadow, $[121] = t36) : t36 = $[121];
5960
- let t37;
5961
- $[122] !== restProps || $[123] !== setFloating || $[124] !== t35 || $[125] !== t36 || $[126] !== zOffset ? (t37 = /* @__PURE__ */ jsx(StyledTooltip, {
5962
- "data-ui": "Tooltip",
5963
- ...restProps,
5964
- ref: setFloating,
5965
- style: t35,
5966
- zOffset,
5967
- children: t36
5968
- }), $[122] = restProps, $[123] = setFloating, $[124] = t35, $[125] = t36, $[126] = zOffset, $[127] = t37) : t37 = $[127];
5969
- let tooltip = t37, t38;
5970
- $[128] !== portalProp || $[129] !== tooltip ? (t38 = portalProp ? /* @__PURE__ */ jsx(Portal, {
5971
- __unstable_name: typeof portalProp == "string" ? portalProp : void 0,
5972
- children: tooltip
5973
- }) : tooltip, $[128] = portalProp, $[129] = tooltip, $[130] = t38) : t38 = $[130];
5974
- let tooltipNode = t38, t39;
5975
- $[131] !== animate || $[132] !== showTooltip || $[133] !== tooltipNode ? (t39 = animate ? /* @__PURE__ */ jsx(AnimateActivity, {
5976
- layoutMode: "default",
5977
- mode: showTooltip ? "visible" : "hidden",
5978
- children: tooltipNode
5979
- }) : /* @__PURE__ */ jsx(Activity, {
5980
- mode: showTooltip ? "visible" : "hidden",
5981
- children: tooltipNode
5982
- }), $[131] = animate, $[132] = showTooltip, $[133] = tooltipNode, $[134] = t39) : t39 = $[134];
5983
- let t40;
5984
- return $[135] !== child || $[136] !== t39 ? (t40 = /* @__PURE__ */ jsxs(Fragment$1, { children: [t39, child] }), $[135] = child, $[136] = t39, $[137] = t40) : t40 = $[137], t40;
5985
- };
5986
- function useMiddleware(t0) {
5987
- let $ = c(17), { animate, arrowProp, arrowRef, boundaryElement, fallbackPlacements, rootBoundary } = t0, ret;
5988
- if ($[0] !== animate || $[1] !== arrowProp || $[2] !== arrowRef || $[3] !== boundaryElement || $[4] !== fallbackPlacements || $[5] !== rootBoundary) {
5989
- ret = [];
5990
- let t1 = boundaryElement || void 0, t2;
5991
- $[7] !== fallbackPlacements || $[8] !== rootBoundary || $[9] !== t1 ? (t2 = flip({
5992
- boundary: t1,
5993
- fallbackPlacements,
5994
- padding: 4,
5995
- rootBoundary
5996
- }), $[7] = fallbackPlacements, $[8] = rootBoundary, $[9] = t1, $[10] = t2) : t2 = $[10], ret.push(t2);
5997
- let t3;
5998
- $[11] === Symbol.for("react.memo_cache_sentinel") ? (t3 = offset({ mainAxis: 4 }), $[11] = t3) : t3 = $[11], ret.push(t3);
5999
- let t4 = boundaryElement || void 0, t5;
6000
- if ($[12] !== rootBoundary || $[13] !== t4 ? (t5 = shift({
6001
- boundary: t4,
6002
- rootBoundary,
6003
- padding: 4
6004
- }), $[12] = rootBoundary, $[13] = t4, $[14] = t5) : t5 = $[14], ret.push(t5), arrowProp) {
6005
- let t6;
6006
- $[15] === arrowRef ? t6 = $[16] : (t6 = arrow({
6007
- element: arrowRef,
6008
- padding: 4
6009
- }), $[15] = arrowRef, $[16] = t6), ret.push(t6);
6010
- }
6011
- animate && ret.push(origin), $[0] = animate, $[1] = arrowProp, $[2] = arrowRef, $[3] = boundaryElement, $[4] = fallbackPlacements, $[5] = rootBoundary, $[6] = ret;
6012
- } else ret = $[6];
6013
- return ret;
6014
- }
6015
- /**
6016
- * As `useEffectEvent` should never be passed to other components or hooks, this custom hook groups together the `useEffectEvent` and the `useEffect` hook using it.
6017
- * @see https://19.react.dev/learn/separating-events-from-effects#reading-latest-props-and-state-with-effect-events:~:text=Never%20pass%20them%20to%20other%20components%20or%20Hooks
6018
- */
6019
- function useCloseOnMouseLeave(t0) {
6020
- let $ = c(10), { handleIsOpenChange, referenceElement, showTooltip, isInsideGroup } = t0, t1;
6021
- $[0] !== handleIsOpenChange || $[1] !== referenceElement ? (t1 = (target, teardown) => {
6022
- referenceElement && (referenceElement === target || target instanceof Node && referenceElement.contains(target) || (handleIsOpenChange(!1), teardown()));
6023
- }, $[0] = handleIsOpenChange, $[1] = referenceElement, $[2] = t1) : t1 = $[2];
6024
- let onMouseMove = useEffectEvent(t1), t2;
6025
- $[3] !== isInsideGroup || $[4] !== onMouseMove || $[5] !== showTooltip ? (t2 = () => {
6026
- if (!showTooltip || isInsideGroup) return;
6027
- let handleMouseMove = (event) => {
6028
- onMouseMove(event.target, () => window.removeEventListener("mousemove", handleMouseMove));
6029
- };
6030
- return window.addEventListener("mousemove", handleMouseMove), () => window.removeEventListener("mousemove", handleMouseMove);
6031
- }, $[3] = isInsideGroup, $[4] = onMouseMove, $[5] = showTooltip, $[6] = t2) : t2 = $[6];
6032
- let t3;
6033
- $[7] !== isInsideGroup || $[8] !== showTooltip ? (t3 = [isInsideGroup, showTooltip], $[7] = isInsideGroup, $[8] = showTooltip, $[9] = t3) : t3 = $[9], useEffect(t2, t3);
6034
- }
6035
- /**
6036
- * @public
6037
- * Provides context for a group of tooltip elements that should share a delay
6038
- * which temporarily becomes 1 ms after the first floating element of the group opens.
6039
- */
6040
- function TooltipDelayGroupProvider(props) {
6041
- let $ = c(9), { children, delay } = 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, t0 = isGroupActive ? 1 : openDelay, t1;
6042
- $[0] !== closeDelay || $[1] !== openTooltipId || $[2] !== setIsGroupActive || $[3] !== setOpenTooltipId || $[4] !== t0 ? (t1 = {
6043
- setIsGroupActive,
6044
- openTooltipId,
6045
- setOpenTooltipId,
6046
- openDelay: t0,
6047
- closeDelay
6048
- }, $[0] = closeDelay, $[1] = openTooltipId, $[2] = setIsGroupActive, $[3] = setOpenTooltipId, $[4] = t0, $[5] = t1) : t1 = $[5];
6049
- let value = t1, t2;
6050
- return $[6] !== children || $[7] !== value ? (t2 = /* @__PURE__ */ jsx(TooltipDelayGroupContext.Provider, {
6051
- value,
6052
- children
6053
- }), $[6] = children, $[7] = value, $[8] = t2) : t2 = $[8], t2;
6054
- }
6055
- /**
6056
1735
  * @public
6057
1736
  */
6058
1737
  function BoundaryElementProvider(props) {
@@ -6130,7 +1809,10 @@ var ErrorBoundary = class extends Component {
6130
1809
  }
6131
1810
  render() {
6132
1811
  let { error } = this.state;
6133
- return error ? /* @__PURE__ */ jsx(Code, { children: typeof error?.message == "string" ? error.message : "Error" }) : this.props.children;
1812
+ return error ? /* @__PURE__ */ jsx("pre", {
1813
+ "data-ui": "ErrorBoundary",
1814
+ children: /* @__PURE__ */ jsx("code", { children: typeof error?.message == "string" ? error.message : "Error" })
1815
+ }) : this.props.children;
6134
1816
  }
6135
1817
  };
6136
1818
  /**
@@ -6156,18 +1838,20 @@ function _temp2() {
6156
1838
  function _temp() {
6157
1839
  return document.body;
6158
1840
  }
6159
- const emptySubscribe = () => () => {}, StyledSrOnly = styled.div.withConfig({
6160
- displayName: "StyledSrOnly",
6161
- componentId: "sc-vau3g1-0"
6162
- })`display:block;width:0;height:0;position:absolute;overflow:hidden;overflow:clip;`, SrOnly = function SrOnly(props) {
6163
- let $ = c(4), { as, children, ref } = props, t0;
6164
- return $[0] !== as || $[1] !== children || $[2] !== ref ? (t0 = /* @__PURE__ */ jsx(StyledSrOnly, {
1841
+ const emptySubscribe = () => () => {};
1842
+ var srOnly = "_1omd6w40";
1843
+ /**
1844
+ * @public
1845
+ */
1846
+ const SrOnly = function SrOnly(props) {
1847
+ let $ = c(4), { as: t0, children, ref } = props, Component = t0 === void 0 ? "div" : t0, t1;
1848
+ return $[0] !== Component || $[1] !== children || $[2] !== ref ? (t1 = /* @__PURE__ */ jsx(Component, {
6165
1849
  "aria-hidden": !0,
6166
- as,
1850
+ className: srOnly,
6167
1851
  "data-ui": "SrOnly",
6168
1852
  ref,
6169
1853
  children
6170
- }), $[0] = as, $[1] = children, $[2] = ref, $[3] = t0) : t0 = $[3], t0;
1854
+ }), $[0] = Component, $[1] = children, $[2] = ref, $[3] = t1) : t1 = $[3], t1;
6171
1855
  }, StyledVirtualList = styled.div.withConfig({
6172
1856
  displayName: "StyledVirtualList",
6173
1857
  componentId: "sc-ltnren-0"
@@ -6290,6 +1974,6 @@ function findScrollable(parentNode) {
6290
1974
  for (; _scrollEl && !_isScrollable(_scrollEl);) _scrollEl = _scrollEl.parentNode;
6291
1975
  return _scrollEl;
6292
1976
  }
6293
- export { Arrow, Autocomplete, Avatar, AvatarCounter, AvatarStack, Badge, BoundaryElementProvider, Box, Breadcrumbs, Button, Card, Checkbox, Code, CodeSkeleton, ConditionalWrapper, Container, Dialog, DialogContext, DialogProvider, ElementQuery, ErrorBoundary, Flex, Grid, Heading, HeadingSkeleton, Hotkeys, Inline, KBD, Label, LabelSkeleton, Layer, LayerProvider, Menu, MenuButton, MenuDivider, MenuGroup, MenuItem, Popover, Portal, PortalProvider, Radio, Select, Skeleton, Spinner, SrOnly, Stack, Switch, Tab, TabList, TabPanel, Text, TextArea, TextInput, TextSkeleton, ThemeColorProvider, ThemeProvider, Toast, ToastProvider, Tooltip, TooltipDelayGroupContext, TooltipDelayGroupProvider, Tree, TreeItem, VirtualList, _elementSizeObserver, _fillCSSObject, _getArrayProp, _getResponsiveSpace, _hasFocus, _isEnterToClickElement, _isScrollable, _raf, _raf2, _responsive, attemptFocus, containsOrEqualsElement, createColorTheme, focusFirstDescendant, focusLastDescendant, hexToRgb, hslToRgb, isFocusable, isHTMLAnchorElement, isHTMLButtonElement, isHTMLElement, isHTMLInputElement, isHTMLSelectElement, isHTMLTextAreaElement, multiply, parseColor, rem, responsiveCodeFontStyle, responsiveHeadingFont, responsiveLabelFont, responsiveTextAlignStyle, responsiveTextFont, rgbToHex, rgbToHsl, rgba, screen, studioTheme, useArrayProp, useBoundaryElement, useClickOutside, useClickOutsideEvent, useCustomValidity, useDialog, useElementRect, useElementSize, useForwardedRef, useGlobalKeyDown, useLayer, useMatchMedia, useMediaIndex, usePortal, usePrefersDark, usePrefersReducedMotion, useRootTheme, useTheme, useTheme_v2, useToast, useTooltipDelayGroup, useTree };
1977
+ export { Arrow, Avatar, AvatarCounter, AvatarStack, Badge, BoundaryElementProvider, Box, Button, Card, Checkbox, CodeSkeleton, ConditionalWrapper, Container, Dialog, DialogContext, DialogProvider, ElementQuery, ErrorBoundary, Flex, Grid, Heading, HeadingSkeleton, Hotkeys, Inline, KBD, Label, LabelSkeleton, Layer, LayerProvider, Portal, PortalProvider, Radio, Select, Skeleton, Spinner, SrOnly, Stack, Switch, Tab, TabList, TabPanel, Text, TextArea, TextInput, TextSkeleton, ThemeColorProvider, ThemeProvider, Tree, TreeItem, VirtualList, _elementSizeObserver, _fillCSSObject, _getArrayProp, _getResponsiveSpace, _hasFocus, _isEnterToClickElement, _isScrollable, _raf, _raf2, _responsive, attemptFocus, containsOrEqualsElement, createColorTheme, focusFirstDescendant, focusLastDescendant, hexToRgb, hslToRgb, isFocusable, isHTMLAnchorElement, isHTMLButtonElement, isHTMLElement, isHTMLInputElement, isHTMLSelectElement, isHTMLTextAreaElement, multiply, parseColor, rem, responsiveCodeFontStyle, responsiveHeadingFont, responsiveLabelFont, responsiveTextAlignStyle, responsiveTextFont, rgbToHex, rgbToHsl, rgba, screen, studioTheme, useArrayProp, useBoundaryElement, useClickOutside, useClickOutsideEvent, useCustomValidity, useDialog, useElementRect, useElementSize, useForwardedRef, useGlobalKeyDown, useLayer, useMatchMedia, useMediaIndex, usePortal, usePrefersDark, usePrefersReducedMotion, useRootTheme, useTheme, useTheme_v2, useTree };
6294
1978
 
6295
1979
  //# sourceMappingURL=index.js.map