@sanity/ui 2.3.6-0 → 2.3.6-canary.1

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 (44) hide show
  1. package/dist/index.compiled.mjs +7073 -0
  2. package/dist/index.compiled.mjs.map +1 -0
  3. package/dist/index.d.mts +10 -0
  4. package/dist/index.d.ts +10 -0
  5. package/dist/index.esm.js +966 -982
  6. package/dist/index.esm.js.map +1 -1
  7. package/dist/index.js +971 -987
  8. package/dist/index.js.map +1 -1
  9. package/dist/index.mjs +966 -982
  10. package/dist/index.mjs.map +1 -1
  11. package/package.json +6 -2
  12. package/src/core/components/autocomplete/autocomplete.tsx +2 -2
  13. package/src/core/components/breadcrumbs/breadcrumbs.tsx +3 -2
  14. package/src/core/components/dialog/dialog.tsx +19 -10
  15. package/src/core/components/hotkeys/hotkeys.tsx +3 -3
  16. package/src/core/components/menu/menuGroup.tsx +5 -4
  17. package/src/core/components/menu/menuItem.tsx +6 -4
  18. package/src/core/components/skeleton/skeleton.tsx +5 -11
  19. package/src/core/components/skeleton/textSkeleton.tsx +6 -7
  20. package/src/core/hooks/useArrayProp.ts +11 -10
  21. package/src/core/primitives/avatar/avatar.tsx +4 -4
  22. package/src/core/primitives/avatar/avatarCounter.tsx +2 -3
  23. package/src/core/primitives/avatar/avatarStack.tsx +2 -3
  24. package/src/core/primitives/badge/badge.tsx +7 -4
  25. package/src/core/primitives/box/box.tsx +53 -27
  26. package/src/core/primitives/button/button.tsx +11 -12
  27. package/src/core/primitives/card/card.tsx +17 -9
  28. package/src/core/primitives/code/code.tsx +4 -3
  29. package/src/core/primitives/container/container.tsx +4 -11
  30. package/src/core/primitives/flex/flex.tsx +13 -7
  31. package/src/core/primitives/grid/grid.tsx +19 -10
  32. package/src/core/primitives/heading/heading.tsx +7 -4
  33. package/src/core/primitives/inline/inline.tsx +3 -2
  34. package/src/core/primitives/kbd/kbd.tsx +4 -3
  35. package/src/core/primitives/label/label.tsx +7 -4
  36. package/src/core/primitives/popover/popover.tsx +7 -6
  37. package/src/core/primitives/select/select.tsx +12 -6
  38. package/src/core/primitives/stack/stack.tsx +4 -3
  39. package/src/core/primitives/text/text.tsx +7 -4
  40. package/src/core/primitives/textArea/textArea.tsx +12 -6
  41. package/src/core/primitives/textInput/textInput.tsx +6 -5
  42. package/src/core/primitives/tooltip/tooltip.tsx +6 -6
  43. package/src/core/theme/themeProvider.tsx +2 -1
  44. package/src/core/utils/layer/layerProvider.tsx +3 -2
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: !0 });
3
- var theme = require("@sanity/ui/theme"), jsxRuntime = require("react/jsx-runtime"), react = require("react"), ReactIs = require("react-is"), styledComponents = require("styled-components"), icons = require("@sanity/icons"), Refractor = require("react-refractor"), reactDom$1 = require("@floating-ui/react-dom"), framerMotion = require("framer-motion"), reactDom = require("react-dom");
3
+ var theme = require("@sanity/ui/theme"), jsxRuntime = require("react/jsx-runtime"), react = require("react"), reactIs = require("react-is"), styledComponents = require("styled-components"), icons = require("@sanity/icons"), Refractor = require("react-refractor"), reactDom$1 = require("@floating-ui/react-dom"), framerMotion = require("framer-motion"), reactDom = require("react-dom");
4
4
  function _interopDefaultCompat(e) {
5
5
  return e && typeof e == "object" && "default" in e ? e : { default: e };
6
6
  }
7
- var ReactIs__default = /* @__PURE__ */ _interopDefaultCompat(ReactIs), Refractor__default = /* @__PURE__ */ _interopDefaultCompat(Refractor);
7
+ var Refractor__default = /* @__PURE__ */ _interopDefaultCompat(Refractor);
8
8
  const createColorTheme = theme.createColorTheme, hexToRgb = theme.hexToRgb, hslToRgb = theme.hslToRgb, multiply = theme.multiply, parseColor = theme.parseColor, rgbToHex = theme.rgbToHex, rgbToHsl = theme.rgbToHsl, rgba = theme.rgba, screen = theme.screen, studioTheme = theme.buildTheme(), EMPTY_ARRAY = [], EMPTY_RECORD = {}, POPOVER_MOTION_CONTENT_OPACITY_PROPERTY = "--motion-content-opacity", POPOVER_MOTION_PROPS = {
9
9
  initial: {
10
10
  opacity: 0.5,
@@ -117,617 +117,146 @@ function responsiveTextAlignStyle(props) {
117
117
  function responsiveTextFont(props) {
118
118
  return responsiveFont("text", props);
119
119
  }
120
- function useArrayProp(val, defaultVal) {
121
- const __perf_hash__ = react.useMemo(() => JSON.stringify(val != null ? val : defaultVal), [defaultVal, val]);
122
- return react.useMemo(
123
- () => _getArrayProp(val, defaultVal),
124
- // Improve performance: Keep object identify for a given hash of the value
125
- // eslint-disable-next-line react-hooks/exhaustive-deps
126
- [__perf_hash__]
120
+ function getGlobalScope() {
121
+ if (typeof globalThis < "u") return globalThis;
122
+ if (typeof window < "u") return window;
123
+ if (typeof self < "u") return self;
124
+ if (typeof global < "u") return global;
125
+ throw new Error("@sanity/ui: could not locate global scope");
126
+ }
127
+ const globalScope = getGlobalScope();
128
+ function createGlobalScopedContext(key2, defaultValue) {
129
+ return typeof document > "u" ? react.createContext(defaultValue) : (globalScope[key2] = globalScope[key2] || react.createContext(defaultValue), globalScope[key2]);
130
+ }
131
+ const key$8 = Symbol.for("@sanity/ui/context/theme"), ThemeContext = createGlobalScopedContext(key$8, null);
132
+ function ThemeProvider(props) {
133
+ var _a;
134
+ const parentTheme = react.useContext(ThemeContext), {
135
+ children,
136
+ // scheme = parentTheme?.scheme || 'light',
137
+ theme: rootTheme = (parentTheme == null ? void 0 : parentTheme.theme) || null,
138
+ tone = (parentTheme == null ? void 0 : parentTheme.tone) || "default"
139
+ } = props, scheme = (_a = props.scheme) != null ? _a : (parentTheme == null ? void 0 : parentTheme.scheme) || "light", themeContext = react.useMemo(() => rootTheme ? {
140
+ version: 0,
141
+ theme: rootTheme,
142
+ scheme,
143
+ tone
144
+ } : null, [rootTheme, scheme, tone]), theme$1 = react.useMemo(() => rootTheme ? theme.getScopedTheme(rootTheme, scheme, tone) : null, [scheme, rootTheme, tone]);
145
+ return theme$1 ? /* @__PURE__ */ jsxRuntime.jsx(ThemeContext.Provider, { value: themeContext, children: /* @__PURE__ */ jsxRuntime.jsx(styledComponents.ThemeProvider, { theme: theme$1, children }) }) : /* @__PURE__ */ jsxRuntime.jsx("pre", { children: 'ThemeProvider: no "theme" property provided' });
146
+ }
147
+ function useRootTheme() {
148
+ const value = react.useContext(ThemeContext);
149
+ if (!value)
150
+ throw new Error("useRootTheme(): missing context value");
151
+ return value;
152
+ }
153
+ function ThemeColorProvider(props) {
154
+ const { children, scheme, tone } = props, root = useRootTheme();
155
+ return /* @__PURE__ */ jsxRuntime.jsx(ThemeProvider, { scheme: scheme || root.scheme, theme: root.theme, tone, children });
156
+ }
157
+ function useTheme() {
158
+ return styledComponents.useTheme();
159
+ }
160
+ function useTheme_v2() {
161
+ return theme.getTheme_v2(styledComponents.useTheme());
162
+ }
163
+ function responsiveBorderStyle() {
164
+ return [border, borderTop, borderRight, borderBottom, borderLeft];
165
+ }
166
+ function border(props) {
167
+ var _a, _b;
168
+ const { card, media } = theme.getTheme_v2(props.theme), borderStyle = `${(_b = (_a = card.border) == null ? void 0 : _a.width) != null ? _b : 1}px solid var(--card-border-color)`;
169
+ return _responsive(
170
+ media,
171
+ props.$border,
172
+ (value) => value ? { "&&": { border: borderStyle } } : { "&&": { border: 0 } }
127
173
  );
128
174
  }
129
- function _getElements(element, elementsArg) {
130
- const ret = [element];
131
- for (const el of elementsArg)
132
- Array.isArray(el) ? ret.push(...el) : ret.push(el);
133
- return ret.filter(Boolean);
175
+ function borderTop(props) {
176
+ var _a, _b;
177
+ const { card, media } = theme.getTheme_v2(props.theme), borderStyle = `${(_b = (_a = card.border) == null ? void 0 : _a.width) != null ? _b : 1}px solid var(--card-border-color)`;
178
+ return _responsive(
179
+ media,
180
+ props.$borderTop,
181
+ (value) => value ? { "&&": { borderTop: borderStyle } } : { "&&": { borderTop: 0 } }
182
+ );
134
183
  }
135
- function useClickOutside(listener, elementsArg = EMPTY_ARRAY, boundaryElement) {
136
- const [element, setElement] = react.useState(null), [elements, setElements] = react.useState(() => _getElements(element, elementsArg)), elementsRef = react.useRef(elements);
137
- return react.useEffect(() => {
138
- const prevElements = elementsRef.current, nextElements = _getElements(element, elementsArg);
139
- if (prevElements.length !== nextElements.length) {
140
- setElements(nextElements), elementsRef.current = nextElements;
141
- return;
142
- }
143
- for (const el of prevElements)
144
- if (!nextElements.includes(el)) {
145
- setElements(nextElements), elementsRef.current = nextElements;
146
- return;
147
- }
148
- for (const el of nextElements)
149
- if (!prevElements.includes(el)) {
150
- setElements(nextElements), elementsRef.current = nextElements;
151
- return;
152
- }
153
- }, [element, elementsArg]), react.useEffect(() => {
154
- if (!listener) return;
155
- const handleWindowMouseDown = (evt) => {
156
- const target = evt.target;
157
- if (target instanceof Node && !(boundaryElement && !boundaryElement.contains(target))) {
158
- for (const el of elements)
159
- if (target === el || el.contains(target))
160
- return;
161
- listener(evt);
162
- }
163
- };
164
- return window.addEventListener("mousedown", handleWindowMouseDown), () => {
165
- window.removeEventListener("mousedown", handleWindowMouseDown);
166
- };
167
- }, [boundaryElement, listener, elements]), setElement;
184
+ function borderRight(props) {
185
+ var _a, _b;
186
+ const { card, media } = theme.getTheme_v2(props.theme), borderStyle = `${(_b = (_a = card.border) == null ? void 0 : _a.width) != null ? _b : 1}px solid var(--card-border-color)`;
187
+ return _responsive(
188
+ media,
189
+ props.$borderRight,
190
+ (value) => value ? { "&&": { borderRight: borderStyle } } : { "&&": { borderRight: 0 } }
191
+ );
168
192
  }
169
- var resizeObservers = [], hasActiveObservations = function() {
170
- return resizeObservers.some(function(ro) {
171
- return ro.activeTargets.length > 0;
172
- });
173
- }, hasSkippedObservations = function() {
174
- return resizeObservers.some(function(ro) {
175
- return ro.skippedTargets.length > 0;
176
- });
177
- }, msg = "ResizeObserver loop completed with undelivered notifications.", deliverResizeLoopError = function() {
178
- var event;
179
- typeof ErrorEvent == "function" ? event = new ErrorEvent("error", {
180
- message: msg
181
- }) : (event = document.createEvent("Event"), event.initEvent("error", !1, !1), event.message = msg), window.dispatchEvent(event);
182
- }, ResizeObserverBoxOptions;
183
- (function(ResizeObserverBoxOptions2) {
184
- ResizeObserverBoxOptions2.BORDER_BOX = "border-box", ResizeObserverBoxOptions2.CONTENT_BOX = "content-box", ResizeObserverBoxOptions2.DEVICE_PIXEL_CONTENT_BOX = "device-pixel-content-box";
185
- })(ResizeObserverBoxOptions || (ResizeObserverBoxOptions = {}));
186
- var freeze = function(obj) {
187
- return Object.freeze(obj);
188
- }, ResizeObserverSize = /* @__PURE__ */ function() {
189
- function ResizeObserverSize2(inlineSize, blockSize) {
190
- this.inlineSize = inlineSize, this.blockSize = blockSize, freeze(this);
191
- }
192
- return ResizeObserverSize2;
193
- }(), DOMRectReadOnly = function() {
194
- function DOMRectReadOnly2(x, y, width, height) {
195
- return this.x = x, this.y = y, this.width = width, this.height = height, this.top = this.y, this.left = this.x, this.bottom = this.top + this.height, this.right = this.left + this.width, freeze(this);
196
- }
197
- return DOMRectReadOnly2.prototype.toJSON = function() {
198
- var _a = this, x = _a.x, y = _a.y, top = _a.top, right = _a.right, bottom = _a.bottom, left = _a.left, width = _a.width, height = _a.height;
199
- return { x, y, top, right, bottom, left, width, height };
200
- }, DOMRectReadOnly2.fromRect = function(rectangle) {
201
- return new DOMRectReadOnly2(rectangle.x, rectangle.y, rectangle.width, rectangle.height);
202
- }, DOMRectReadOnly2;
203
- }(), isSVG = function(target) {
204
- return target instanceof SVGElement && "getBBox" in target;
205
- }, isHidden = function(target) {
206
- if (isSVG(target)) {
207
- var _a = target.getBBox(), width = _a.width, height = _a.height;
208
- return !width && !height;
193
+ function borderBottom(props) {
194
+ var _a, _b;
195
+ const { card, media } = theme.getTheme_v2(props.theme), borderStyle = `${(_b = (_a = card.border) == null ? void 0 : _a.width) != null ? _b : 1}px solid var(--card-border-color)`;
196
+ return _responsive(
197
+ media,
198
+ props.$borderBottom,
199
+ (value) => value ? { "&&": { borderBottom: borderStyle } } : { "&&": { borderBottom: 0 } }
200
+ );
201
+ }
202
+ function borderLeft(props) {
203
+ var _a, _b;
204
+ const { card, media } = theme.getTheme_v2(props.theme), borderStyle = `${(_b = (_a = card.border) == null ? void 0 : _a.width) != null ? _b : 1}px solid var(--card-border-color)`;
205
+ return _responsive(
206
+ media,
207
+ props.$borderLeft,
208
+ (value) => value ? { "&&": { borderLeft: borderStyle } } : { "&&": { borderLeft: 0 } }
209
+ );
210
+ }
211
+ const BASE_STYLE$4 = {
212
+ '&[data-as="ul"],&[data-as="ol"]': {
213
+ listStyle: "none"
209
214
  }
210
- var _b = target, offsetWidth = _b.offsetWidth, offsetHeight = _b.offsetHeight;
211
- return !(offsetWidth || offsetHeight || target.getClientRects().length);
212
- }, isElement = function(obj) {
213
- var _a;
214
- if (obj instanceof Element)
215
- return !0;
216
- var scope = (_a = obj == null ? void 0 : obj.ownerDocument) === null || _a === void 0 ? void 0 : _a.defaultView;
217
- return !!(scope && obj instanceof scope.Element);
218
- }, isReplacedElement = function(target) {
219
- switch (target.tagName) {
220
- case "INPUT":
221
- if (target.type !== "image")
222
- break;
223
- case "VIDEO":
224
- case "AUDIO":
225
- case "EMBED":
226
- case "OBJECT":
227
- case "CANVAS":
228
- case "IFRAME":
229
- case "IMG":
230
- return !0;
231
- }
232
- return !1;
233
- }, global$1 = typeof window < "u" ? window : {}, cache = /* @__PURE__ */ new WeakMap(), scrollRegexp = /auto|scroll/, verticalRegexp = /^tb|vertical/, IE = /msie|trident/i.test(global$1.navigator && global$1.navigator.userAgent), parseDimension = function(pixel) {
234
- return parseFloat(pixel || "0");
235
- }, size$1 = function(inlineSize, blockSize, switchSizes) {
236
- return inlineSize === void 0 && (inlineSize = 0), blockSize === void 0 && (blockSize = 0), switchSizes === void 0 && (switchSizes = !1), new ResizeObserverSize((switchSizes ? blockSize : inlineSize) || 0, (switchSizes ? inlineSize : blockSize) || 0);
237
- }, zeroBoxes = freeze({
238
- devicePixelContentBoxSize: size$1(),
239
- borderBoxSize: size$1(),
240
- contentBoxSize: size$1(),
241
- contentRect: new DOMRectReadOnly(0, 0, 0, 0)
242
- }), calculateBoxSizes = function(target, forceRecalculation) {
243
- if (forceRecalculation === void 0 && (forceRecalculation = !1), cache.has(target) && !forceRecalculation)
244
- return cache.get(target);
245
- if (isHidden(target))
246
- return cache.set(target, zeroBoxes), zeroBoxes;
247
- var cs = getComputedStyle(target), svg = isSVG(target) && target.ownerSVGElement && target.getBBox(), removePadding = !IE && cs.boxSizing === "border-box", switchSizes = verticalRegexp.test(cs.writingMode || ""), canScrollVertically = !svg && scrollRegexp.test(cs.overflowY || ""), canScrollHorizontally = !svg && scrollRegexp.test(cs.overflowX || ""), paddingTop = svg ? 0 : parseDimension(cs.paddingTop), paddingRight = svg ? 0 : parseDimension(cs.paddingRight), paddingBottom = svg ? 0 : parseDimension(cs.paddingBottom), paddingLeft = svg ? 0 : parseDimension(cs.paddingLeft), borderTop2 = svg ? 0 : parseDimension(cs.borderTopWidth), borderRight2 = svg ? 0 : parseDimension(cs.borderRightWidth), borderBottom2 = svg ? 0 : parseDimension(cs.borderBottomWidth), borderLeft2 = svg ? 0 : parseDimension(cs.borderLeftWidth), horizontalPadding = paddingLeft + paddingRight, verticalPadding = paddingTop + paddingBottom, horizontalBorderArea = borderLeft2 + borderRight2, verticalBorderArea = borderTop2 + borderBottom2, horizontalScrollbarThickness = canScrollHorizontally ? target.offsetHeight - verticalBorderArea - target.clientHeight : 0, verticalScrollbarThickness = canScrollVertically ? target.offsetWidth - horizontalBorderArea - target.clientWidth : 0, widthReduction = removePadding ? horizontalPadding + horizontalBorderArea : 0, heightReduction = removePadding ? verticalPadding + verticalBorderArea : 0, contentWidth = svg ? svg.width : parseDimension(cs.width) - widthReduction - verticalScrollbarThickness, contentHeight = svg ? svg.height : parseDimension(cs.height) - heightReduction - horizontalScrollbarThickness, borderBoxWidth = contentWidth + horizontalPadding + verticalScrollbarThickness + horizontalBorderArea, borderBoxHeight = contentHeight + verticalPadding + horizontalScrollbarThickness + verticalBorderArea, boxes = freeze({
248
- devicePixelContentBoxSize: size$1(Math.round(contentWidth * devicePixelRatio), Math.round(contentHeight * devicePixelRatio), switchSizes),
249
- borderBoxSize: size$1(borderBoxWidth, borderBoxHeight, switchSizes),
250
- contentBoxSize: size$1(contentWidth, contentHeight, switchSizes),
251
- contentRect: new DOMRectReadOnly(paddingLeft, paddingTop, contentWidth, contentHeight)
252
- });
253
- return cache.set(target, boxes), boxes;
254
- }, calculateBoxSize = function(target, observedBox, forceRecalculation) {
255
- var _a = calculateBoxSizes(target, forceRecalculation), borderBoxSize = _a.borderBoxSize, contentBoxSize = _a.contentBoxSize, devicePixelContentBoxSize = _a.devicePixelContentBoxSize;
256
- switch (observedBox) {
257
- case ResizeObserverBoxOptions.DEVICE_PIXEL_CONTENT_BOX:
258
- return devicePixelContentBoxSize;
259
- case ResizeObserverBoxOptions.BORDER_BOX:
260
- return borderBoxSize;
261
- default:
262
- return contentBoxSize;
263
- }
264
- }, ResizeObserverEntry = /* @__PURE__ */ function() {
265
- function ResizeObserverEntry2(target) {
266
- var boxes = calculateBoxSizes(target);
267
- this.target = target, this.contentRect = boxes.contentRect, this.borderBoxSize = freeze([boxes.borderBoxSize]), this.contentBoxSize = freeze([boxes.contentBoxSize]), this.devicePixelContentBoxSize = freeze([boxes.devicePixelContentBoxSize]);
268
- }
269
- return ResizeObserverEntry2;
270
- }(), calculateDepthForNode = function(node) {
271
- if (isHidden(node))
272
- return 1 / 0;
273
- for (var depth = 0, parent = node.parentNode; parent; )
274
- depth += 1, parent = parent.parentNode;
275
- return depth;
276
- }, broadcastActiveObservations = function() {
277
- var shallowestDepth = 1 / 0, callbacks2 = [];
278
- resizeObservers.forEach(function(ro) {
279
- if (ro.activeTargets.length !== 0) {
280
- var entries = [];
281
- ro.activeTargets.forEach(function(ot) {
282
- var entry = new ResizeObserverEntry(ot.target), targetDepth = calculateDepthForNode(ot.target);
283
- entries.push(entry), ot.lastReportedSize = calculateBoxSize(ot.target, ot.observedBox), targetDepth < shallowestDepth && (shallowestDepth = targetDepth);
284
- }), callbacks2.push(function() {
285
- ro.callback.call(ro.observer, entries, ro.observer);
286
- }), ro.activeTargets.splice(0, ro.activeTargets.length);
287
- }
288
- });
289
- for (var _i = 0, callbacks_1 = callbacks2; _i < callbacks_1.length; _i++) {
290
- var callback = callbacks_1[_i];
291
- callback();
292
- }
293
- return shallowestDepth;
294
- }, gatherActiveObservationsAtDepth = function(depth) {
295
- resizeObservers.forEach(function(ro) {
296
- ro.activeTargets.splice(0, ro.activeTargets.length), ro.skippedTargets.splice(0, ro.skippedTargets.length), ro.observationTargets.forEach(function(ot) {
297
- ot.isActive() && (calculateDepthForNode(ot.target) > depth ? ro.activeTargets.push(ot) : ro.skippedTargets.push(ot));
298
- });
299
- });
300
- }, process = function() {
301
- var depth = 0;
302
- for (gatherActiveObservationsAtDepth(depth); hasActiveObservations(); )
303
- depth = broadcastActiveObservations(), gatherActiveObservationsAtDepth(depth);
304
- return hasSkippedObservations() && deliverResizeLoopError(), depth > 0;
305
- }, trigger, callbacks = [], notify = function() {
306
- return callbacks.splice(0).forEach(function(cb) {
307
- return cb();
308
- });
309
- }, queueMicroTask = function(callback) {
310
- if (!trigger) {
311
- var toggle_1 = 0, el_1 = document.createTextNode(""), config = { characterData: !0 };
312
- new MutationObserver(function() {
313
- return notify();
314
- }).observe(el_1, config), trigger = function() {
315
- el_1.textContent = "".concat(toggle_1 ? toggle_1-- : toggle_1++);
316
- };
317
- }
318
- callbacks.push(callback), trigger();
319
- }, queueResizeObserver = function(cb) {
320
- queueMicroTask(function() {
321
- requestAnimationFrame(cb);
322
- });
323
- }, watching = 0, isWatching = function() {
324
- return !!watching;
325
- }, CATCH_PERIOD = 250, observerConfig = { attributes: !0, characterData: !0, childList: !0, subtree: !0 }, events = [
326
- "resize",
327
- "load",
328
- "transitionend",
329
- "animationend",
330
- "animationstart",
331
- "animationiteration",
332
- "keyup",
333
- "keydown",
334
- "mouseup",
335
- "mousedown",
336
- "mouseover",
337
- "mouseout",
338
- "blur",
339
- "focus"
340
- ], time = function(timeout) {
341
- return timeout === void 0 && (timeout = 0), Date.now() + timeout;
342
- }, scheduled = !1, Scheduler = function() {
343
- function Scheduler2() {
344
- var _this = this;
345
- this.stopped = !0, this.listener = function() {
346
- return _this.schedule();
347
- };
348
- }
349
- return Scheduler2.prototype.run = function(timeout) {
350
- var _this = this;
351
- if (timeout === void 0 && (timeout = CATCH_PERIOD), !scheduled) {
352
- scheduled = !0;
353
- var until = time(timeout);
354
- queueResizeObserver(function() {
355
- var elementsHaveResized = !1;
356
- try {
357
- elementsHaveResized = process();
358
- } finally {
359
- if (scheduled = !1, timeout = until - time(), !isWatching())
360
- return;
361
- elementsHaveResized ? _this.run(1e3) : timeout > 0 ? _this.run(timeout) : _this.start();
362
- }
363
- });
364
- }
365
- }, Scheduler2.prototype.schedule = function() {
366
- this.stop(), this.run();
367
- }, Scheduler2.prototype.observe = function() {
368
- var _this = this, cb = function() {
369
- return _this.observer && _this.observer.observe(document.body, observerConfig);
370
- };
371
- document.body ? cb() : global$1.addEventListener("DOMContentLoaded", cb);
372
- }, Scheduler2.prototype.start = function() {
373
- var _this = this;
374
- this.stopped && (this.stopped = !1, this.observer = new MutationObserver(this.listener), this.observe(), events.forEach(function(name) {
375
- return global$1.addEventListener(name, _this.listener, !0);
376
- }));
377
- }, Scheduler2.prototype.stop = function() {
378
- var _this = this;
379
- this.stopped || (this.observer && this.observer.disconnect(), events.forEach(function(name) {
380
- return global$1.removeEventListener(name, _this.listener, !0);
381
- }), this.stopped = !0);
382
- }, Scheduler2;
383
- }(), scheduler = new Scheduler(), updateCount = function(n) {
384
- !watching && n > 0 && scheduler.start(), watching += n, !watching && scheduler.stop();
385
- }, skipNotifyOnElement = function(target) {
386
- return !isSVG(target) && !isReplacedElement(target) && getComputedStyle(target).display === "inline";
387
- }, ResizeObservation = function() {
388
- function ResizeObservation2(target, observedBox) {
389
- this.target = target, this.observedBox = observedBox || ResizeObserverBoxOptions.CONTENT_BOX, this.lastReportedSize = {
390
- inlineSize: 0,
391
- blockSize: 0
392
- };
393
- }
394
- return ResizeObservation2.prototype.isActive = function() {
395
- var size2 = calculateBoxSize(this.target, this.observedBox, !0);
396
- return skipNotifyOnElement(this.target) && (this.lastReportedSize = size2), this.lastReportedSize.inlineSize !== size2.inlineSize || this.lastReportedSize.blockSize !== size2.blockSize;
397
- }, ResizeObservation2;
398
- }(), ResizeObserverDetail = /* @__PURE__ */ function() {
399
- function ResizeObserverDetail2(resizeObserver, callback) {
400
- this.activeTargets = [], this.skippedTargets = [], this.observationTargets = [], this.observer = resizeObserver, this.callback = callback;
401
- }
402
- return ResizeObserverDetail2;
403
- }(), observerMap = /* @__PURE__ */ new WeakMap(), getObservationIndex = function(observationTargets, target) {
404
- for (var i = 0; i < observationTargets.length; i += 1)
405
- if (observationTargets[i].target === target)
406
- return i;
407
- return -1;
408
- }, ResizeObserverController = function() {
409
- function ResizeObserverController2() {
410
- }
411
- return ResizeObserverController2.connect = function(resizeObserver, callback) {
412
- var detail = new ResizeObserverDetail(resizeObserver, callback);
413
- observerMap.set(resizeObserver, detail);
414
- }, ResizeObserverController2.observe = function(resizeObserver, target, options) {
415
- var detail = observerMap.get(resizeObserver), firstObservation = detail.observationTargets.length === 0;
416
- getObservationIndex(detail.observationTargets, target) < 0 && (firstObservation && resizeObservers.push(detail), detail.observationTargets.push(new ResizeObservation(target, options && options.box)), updateCount(1), scheduler.schedule());
417
- }, ResizeObserverController2.unobserve = function(resizeObserver, target) {
418
- var detail = observerMap.get(resizeObserver), index = getObservationIndex(detail.observationTargets, target), lastObservation = detail.observationTargets.length === 1;
419
- index >= 0 && (lastObservation && resizeObservers.splice(resizeObservers.indexOf(detail), 1), detail.observationTargets.splice(index, 1), updateCount(-1));
420
- }, ResizeObserverController2.disconnect = function(resizeObserver) {
421
- var _this = this, detail = observerMap.get(resizeObserver);
422
- detail.observationTargets.slice().forEach(function(ot) {
423
- return _this.unobserve(resizeObserver, ot.target);
424
- }), detail.activeTargets.splice(0, detail.activeTargets.length);
425
- }, ResizeObserverController2;
426
- }(), ResizeObserver = function() {
427
- function ResizeObserver2(callback) {
428
- if (arguments.length === 0)
429
- throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");
430
- if (typeof callback != "function")
431
- throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");
432
- ResizeObserverController.connect(this, callback);
433
- }
434
- return ResizeObserver2.prototype.observe = function(target, options) {
435
- if (arguments.length === 0)
436
- throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");
437
- if (!isElement(target))
438
- throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");
439
- ResizeObserverController.observe(this, target, options);
440
- }, ResizeObserver2.prototype.unobserve = function(target) {
441
- if (arguments.length === 0)
442
- throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");
443
- if (!isElement(target))
444
- throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");
445
- ResizeObserverController.unobserve(this, target);
446
- }, ResizeObserver2.prototype.disconnect = function() {
447
- ResizeObserverController.disconnect(this);
448
- }, ResizeObserver2.toString = function() {
449
- return "function ResizeObserver () { [polyfill code] }";
450
- }, ResizeObserver2;
451
- }();
452
- const _ResizeObserver = typeof document < "u" && typeof window < "u" && window.ResizeObserver ? window.ResizeObserver : ResizeObserver, _elementSizeObserver = _createElementSizeObserver();
453
- function _createElementRectValueListener() {
454
- return {
455
- subscribe(element, subscriber) {
456
- const resizeObserver = new _ResizeObserver(([entry]) => {
457
- subscriber({
458
- _contentRect: entry.contentRect,
459
- border: {
460
- width: entry.borderBoxSize[0].inlineSize,
461
- height: entry.borderBoxSize[0].blockSize
462
- },
463
- content: {
464
- width: entry.contentRect.width,
465
- height: entry.contentRect.height
466
- }
467
- });
468
- });
469
- return resizeObserver.observe(element), () => {
470
- resizeObserver.unobserve(element), resizeObserver.disconnect();
471
- };
472
- }
473
- };
474
- }
475
- function _createElementSizeObserver() {
476
- const disposeCache = /* @__PURE__ */ new WeakMap(), subscribersCache = /* @__PURE__ */ new WeakMap();
477
- return {
478
- subscribe(element, subscriber) {
479
- const subscribers = subscribersCache.get(element) || [];
480
- let dispose = disposeCache.get(element);
481
- return subscribersCache.has(element) || (subscribersCache.set(element, subscribers), dispose = _createElementRectValueListener().subscribe(element, (elementRect) => {
482
- for (const sub of subscribers)
483
- sub(elementRect);
484
- })), subscribers.push(subscriber), () => {
485
- const idx = subscribers.indexOf(subscriber);
486
- idx > -1 && subscribers.splice(idx, 1), subscribers.length === 0 && dispose && dispose();
487
- };
488
- }
489
- };
490
- }
491
- function useElementSize(element) {
492
- const [size2, setSize] = react.useState(null);
493
- return react.useEffect(() => {
494
- if (element)
495
- return _elementSizeObserver.subscribe(element, setSize);
496
- }, [element]), size2;
497
- }
498
- function useElementRect(element) {
499
- const elementSize = useElementSize(element);
500
- return (elementSize == null ? void 0 : elementSize._contentRect) || null;
501
- }
502
- function useGlobalKeyDown(onKeyDown) {
503
- return react.useEffect(() => (addEventListener("keydown", onKeyDown), () => removeEventListener("keydown", onKeyDown)), [onKeyDown]);
504
- }
505
- function getGlobalScope() {
506
- if (typeof globalThis < "u") return globalThis;
507
- if (typeof window < "u") return window;
508
- if (typeof self < "u") return self;
509
- if (typeof global < "u") return global;
510
- throw new Error("@sanity/ui: could not locate global scope");
511
- }
512
- const globalScope = getGlobalScope();
513
- function createGlobalScopedContext(key2, defaultValue) {
514
- return typeof document > "u" ? react.createContext(defaultValue) : (globalScope[key2] = globalScope[key2] || react.createContext(defaultValue), globalScope[key2]);
515
- }
516
- const key$8 = Symbol.for("@sanity/ui/context/theme"), ThemeContext = createGlobalScopedContext(key$8, null);
517
- function ThemeProvider(props) {
518
- const parentTheme = react.useContext(ThemeContext), {
519
- children,
520
- scheme = (parentTheme == null ? void 0 : parentTheme.scheme) || "light",
521
- theme: rootTheme = (parentTheme == null ? void 0 : parentTheme.theme) || null,
522
- tone = (parentTheme == null ? void 0 : parentTheme.tone) || "default"
523
- } = props, themeContext = react.useMemo(() => rootTheme ? {
524
- version: 0,
525
- theme: rootTheme,
526
- scheme,
527
- tone
528
- } : null, [rootTheme, scheme, tone]), theme$1 = react.useMemo(() => rootTheme ? theme.getScopedTheme(rootTheme, scheme, tone) : null, [scheme, rootTheme, tone]);
529
- return theme$1 ? /* @__PURE__ */ jsxRuntime.jsx(ThemeContext.Provider, { value: themeContext, children: /* @__PURE__ */ jsxRuntime.jsx(styledComponents.ThemeProvider, { theme: theme$1, children }) }) : /* @__PURE__ */ jsxRuntime.jsx("pre", { children: 'ThemeProvider: no "theme" property provided' });
530
- }
531
- function useRootTheme() {
532
- const value = react.useContext(ThemeContext);
533
- if (!value)
534
- throw new Error("useRootTheme(): missing context value");
535
- return value;
536
- }
537
- function ThemeColorProvider(props) {
538
- const { children, scheme, tone } = props, root = useRootTheme();
539
- return /* @__PURE__ */ jsxRuntime.jsx(ThemeProvider, { scheme: scheme || root.scheme, theme: root.theme, tone, children });
540
- }
541
- function useTheme() {
542
- return styledComponents.useTheme();
543
- }
544
- function useTheme_v2() {
545
- return theme.getTheme_v2(styledComponents.useTheme());
546
- }
547
- const MEDIA_STORE_CACHE = /* @__PURE__ */ new WeakMap();
548
- function _getMediaQuery(media, index) {
549
- 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)`;
550
- }
551
- function _createMediaStore(media) {
552
- const mediaLen = media.length;
553
- let sizes;
554
- const getSizes = () => {
555
- if (!sizes) {
556
- sizes = [];
557
- for (let index = mediaLen; index > -1; index -= 1) {
558
- const mediaQuery = _getMediaQuery(media, index);
559
- sizes.push({ index, mq: window.matchMedia(mediaQuery) });
560
- }
561
- }
562
- return sizes;
563
- };
564
- return { getSnapshot: () => {
565
- for (const { index, mq } of getSizes())
566
- if (mq.matches) return index;
567
- return 0;
568
- }, subscribe: (onStoreChange) => {
569
- const disposeFns = [];
570
- for (const { mq } of getSizes()) {
571
- const handleChange = () => {
572
- mq.matches && onStoreChange();
573
- };
574
- mq.addEventListener("change", handleChange), disposeFns.push(() => mq.removeEventListener("change", handleChange));
575
- }
576
- return () => {
577
- for (const disposeFn of disposeFns)
578
- disposeFn();
579
- };
580
- } };
581
- }
582
- function getServerSnapshot$2() {
583
- return 0;
584
- }
585
- function useMediaIndex() {
586
- const { media } = useTheme_v2();
587
- let store = MEDIA_STORE_CACHE.get(media);
588
- return store || (store = _createMediaStore(media), MEDIA_STORE_CACHE.set(media, store)), react.useSyncExternalStore(store.subscribe, store.getSnapshot, getServerSnapshot$2);
589
- }
590
- let MEDIA_QUERY_CACHE$1;
591
- function getMatchMedia$1() {
592
- return MEDIA_QUERY_CACHE$1 || (MEDIA_QUERY_CACHE$1 = window.matchMedia("(prefers-color-scheme: dark)")), MEDIA_QUERY_CACHE$1;
593
- }
594
- function subscribe$2(onStoreChange) {
595
- const matchMedia = getMatchMedia$1();
596
- return matchMedia.addEventListener("change", onStoreChange), () => matchMedia.removeEventListener("change", onStoreChange);
597
- }
598
- function getSnapshot$1() {
599
- return getMatchMedia$1().matches;
600
- }
601
- function getServerSnapshot$1() {
602
- return !1;
603
- }
604
- function usePrefersDark() {
605
- return react.useSyncExternalStore(subscribe$2, getSnapshot$1, getServerSnapshot$1);
606
- }
607
- let MEDIA_QUERY_CACHE;
608
- function getMatchMedia() {
609
- return MEDIA_QUERY_CACHE || (MEDIA_QUERY_CACHE = window.matchMedia("(prefers-reduced-motion: reduce)")), MEDIA_QUERY_CACHE;
610
- }
611
- function subscribe$1(onStoreChange) {
612
- const matchMedia = getMatchMedia();
613
- return matchMedia.addEventListener("change", onStoreChange), () => matchMedia.removeEventListener("change", onStoreChange);
614
- }
615
- function getSnapshot() {
616
- return getMatchMedia().matches;
617
- }
618
- function getServerSnapshot() {
619
- return !1;
620
- }
621
- function usePrefersReducedMotion() {
622
- return react.useSyncExternalStore(subscribe$1, getSnapshot, getServerSnapshot);
623
- }
624
- function useForwardedRef(ref) {
625
- const innerRef = react.useRef(null);
626
- return react.useImperativeHandle(ref, () => innerRef.current), innerRef;
627
- }
628
- function useCustomValidity(ref, customValidity) {
629
- react.useEffect(() => {
630
- var _a;
631
- (_a = ref.current) == null || _a.setCustomValidity(customValidity || "");
632
- }, [customValidity, ref]);
633
- }
634
- function responsiveBorderStyle() {
635
- return [border, borderTop, borderRight, borderBottom, borderLeft];
636
- }
637
- function border(props) {
638
- var _a, _b;
639
- const { card, media } = theme.getTheme_v2(props.theme), borderStyle = `${(_b = (_a = card.border) == null ? void 0 : _a.width) != null ? _b : 1}px solid var(--card-border-color)`;
640
- return _responsive(
641
- media,
642
- props.$border,
643
- (value) => value ? { "&&": { border: borderStyle } } : { "&&": { border: 0 } }
644
- );
645
- }
646
- function borderTop(props) {
647
- var _a, _b;
648
- const { card, media } = theme.getTheme_v2(props.theme), borderStyle = `${(_b = (_a = card.border) == null ? void 0 : _a.width) != null ? _b : 1}px solid var(--card-border-color)`;
649
- return _responsive(
650
- media,
651
- props.$borderTop,
652
- (value) => value ? { "&&": { borderTop: borderStyle } } : { "&&": { borderTop: 0 } }
653
- );
654
- }
655
- function borderRight(props) {
656
- var _a, _b;
657
- const { card, media } = theme.getTheme_v2(props.theme), borderStyle = `${(_b = (_a = card.border) == null ? void 0 : _a.width) != null ? _b : 1}px solid var(--card-border-color)`;
658
- return _responsive(
659
- media,
660
- props.$borderRight,
661
- (value) => value ? { "&&": { borderRight: borderStyle } } : { "&&": { borderRight: 0 } }
662
- );
663
- }
664
- function borderBottom(props) {
665
- var _a, _b;
666
- const { card, media } = theme.getTheme_v2(props.theme), borderStyle = `${(_b = (_a = card.border) == null ? void 0 : _a.width) != null ? _b : 1}px solid var(--card-border-color)`;
667
- return _responsive(
668
- media,
669
- props.$borderBottom,
670
- (value) => value ? { "&&": { borderBottom: borderStyle } } : { "&&": { borderBottom: 0 } }
671
- );
672
- }
673
- function borderLeft(props) {
674
- var _a, _b;
675
- const { card, media } = theme.getTheme_v2(props.theme), borderStyle = `${(_b = (_a = card.border) == null ? void 0 : _a.width) != null ? _b : 1}px solid var(--card-border-color)`;
676
- return _responsive(
677
- media,
678
- props.$borderLeft,
679
- (value) => value ? { "&&": { borderLeft: borderStyle } } : { "&&": { borderLeft: 0 } }
680
- );
681
- }
682
- const BASE_STYLE$4 = {
683
- '&[data-as="ul"],&[data-as="ol"]': {
684
- listStyle: "none"
685
- }
686
- }, BOX_SIZING = {
687
- content: "content-box",
688
- border: "border-box"
689
- }, BOX_HEIGHT = {
690
- stretch: "stretch",
691
- fill: "100%"
692
- };
693
- function boxStyle() {
694
- return BASE_STYLE$4;
695
- }
696
- function responsiveBoxStyle() {
697
- return [
698
- responsiveBoxSizingStyle,
699
- responsiveBoxHeightStyle,
700
- responsiveBoxOverflowStyle,
701
- responsiveBoxDisplayStyle
702
- ];
703
- }
704
- function responsiveBoxDisplayStyle(props) {
705
- const { media } = theme.getTheme_v2(props.theme);
706
- return _responsive(media, props.$display, (display) => ({
707
- "&:not([hidden])": { display }
708
- }));
709
- }
710
- function responsiveBoxSizingStyle(props) {
711
- const { media } = theme.getTheme_v2(props.theme);
712
- return _responsive(media, props.$sizing, (sizing) => ({
713
- boxSizing: BOX_SIZING[sizing]
714
- }));
715
- }
716
- function responsiveBoxHeightStyle(props) {
717
- const { media } = theme.getTheme_v2(props.theme);
718
- return _responsive(media, props.$height, (height) => ({
719
- height: BOX_HEIGHT[height]
720
- }));
721
- }
722
- function responsiveBoxOverflowStyle(props) {
723
- const { media } = theme.getTheme_v2(props.theme);
724
- return _responsive(media, props.$overflow, (overflow) => ({
725
- overflow
726
- }));
727
- }
728
- const BASE_STYLE$3 = {
729
- "&&:not([hidden])": {
730
- display: "flex"
215
+ }, BOX_SIZING = {
216
+ content: "content-box",
217
+ border: "border-box"
218
+ }, BOX_HEIGHT = {
219
+ stretch: "stretch",
220
+ fill: "100%"
221
+ };
222
+ function boxStyle() {
223
+ return BASE_STYLE$4;
224
+ }
225
+ function responsiveBoxStyle() {
226
+ return [
227
+ responsiveBoxSizingStyle,
228
+ responsiveBoxHeightStyle,
229
+ responsiveBoxOverflowStyle,
230
+ responsiveBoxDisplayStyle
231
+ ];
232
+ }
233
+ function responsiveBoxDisplayStyle(props) {
234
+ const { media } = theme.getTheme_v2(props.theme);
235
+ return _responsive(media, props.$display, (display) => ({
236
+ "&:not([hidden])": { display }
237
+ }));
238
+ }
239
+ function responsiveBoxSizingStyle(props) {
240
+ const { media } = theme.getTheme_v2(props.theme);
241
+ return _responsive(media, props.$sizing, (sizing) => ({
242
+ boxSizing: BOX_SIZING[sizing]
243
+ }));
244
+ }
245
+ function responsiveBoxHeightStyle(props) {
246
+ const { media } = theme.getTheme_v2(props.theme);
247
+ return _responsive(media, props.$height, (height) => ({
248
+ height: BOX_HEIGHT[height]
249
+ }));
250
+ }
251
+ function responsiveBoxOverflowStyle(props) {
252
+ const { media } = theme.getTheme_v2(props.theme);
253
+ return _responsive(media, props.$overflow, (overflow) => ({
254
+ overflow
255
+ }));
256
+ }
257
+ const BASE_STYLE$3 = {
258
+ "&&:not([hidden])": {
259
+ display: "flex"
731
260
  }
732
261
  };
733
262
  function responsiveFlexStyle() {
@@ -1241,7 +770,7 @@ const Root$C = styledComponents.styled.div(responsiveLabelFont, responsiveTextAl
1241
770
  textOverflow,
1242
771
  weight,
1243
772
  ...restProps
1244
- } = props;
773
+ } = props, $size = react.useMemo(() => _getArrayProp(size2), [size2]), $align = react.useMemo(() => _getArrayProp(align), [align]);
1245
774
  let children = childrenProp;
1246
775
  return textOverflow === "ellipsis" ? children = /* @__PURE__ */ jsxRuntime.jsx(SpanWithTextOverflow$2, { children }) : children = /* @__PURE__ */ jsxRuntime.jsx("span", { children }), /* @__PURE__ */ jsxRuntime.jsx(
1247
776
  Root$C,
@@ -1249,9 +778,9 @@ const Root$C = styledComponents.styled.div(responsiveLabelFont, responsiveTextAl
1249
778
  "data-ui": "Label",
1250
779
  ...restProps,
1251
780
  $accent: accent,
1252
- $align: useArrayProp(align),
781
+ $align,
782
+ $size,
1253
783
  $muted: muted,
1254
- $size: useArrayProp(size2),
1255
784
  $weight: weight,
1256
785
  ref,
1257
786
  children
@@ -1410,7 +939,7 @@ const Root$B = styledComponents.styled.div(
1410
939
  status = "online",
1411
940
  size: sizeProp = 1,
1412
941
  ...restProps
1413
- } = props, { avatar } = useTheme_v2(), as = ReactIs__default.default.isValidElementType(asProp) ? asProp : "div", size2 = useArrayProp(sizeProp), _sizeRem = (avatar.sizes[size2[0]] || avatar.sizes[0]).size, _radius = _sizeRem / 2, elementId = react.useId(), [arrowPosition, setArrowPosition] = react.useState(
942
+ } = props, { avatar } = useTheme_v2(), as = reactIs.isValidElementType(asProp) ? asProp : "div", size2 = react.useMemo(() => _getArrayProp(sizeProp), [sizeProp]), _sizeRem = (avatar.sizes[size2[0]] || avatar.sizes[0]).size, _radius = _sizeRem / 2, elementId = react.useId(), [arrowPosition, setArrowPosition] = react.useState(
1414
943
  animateArrowFrom || arrowPositionProp || "inside"
1415
944
  ), [imageFailed, setImageFailed] = react.useState(!1), imageId = `avatar-image-${elementId}`;
1416
945
  react.useEffect(() => {
@@ -1520,7 +1049,7 @@ const Root$A = styledComponents.styled.div(
1520
1049
  _responsiveAvatarCounterSizeStyle,
1521
1050
  _avatarCounterBaseStyle
1522
1051
  ), AvatarCounter = react.forwardRef(function(props, ref) {
1523
- const { count, size: sizeProp = 1 } = props, size2 = useArrayProp(sizeProp), fontSize2 = react.useMemo(
1052
+ const { count, size: sizeProp = 1 } = props, size2 = react.useMemo(() => _getArrayProp(sizeProp), [sizeProp]), fontSize2 = react.useMemo(
1524
1053
  () => size2.map((s) => s === 1 ? 1 : s === 2 ? 3 : s === 3 ? 5 : 0),
1525
1054
  [size2]
1526
1055
  );
@@ -1559,7 +1088,7 @@ const Root$z = styledComponents.styled.div(responsiveAvatarStackSizeStyle, avata
1559
1088
  } = props, children = react.useMemo(
1560
1089
  () => react.Children.toArray(childrenProp).filter(react.isValidElement),
1561
1090
  [childrenProp]
1562
- ), maxLength = Math.max(maxLengthProp, 0), size2 = useArrayProp(sizeProp), len = children.length, visibleCount = maxLength - 1, extraCount = len - visibleCount, visibleChildren = extraCount > 1 ? children.slice(extraCount, len) : children;
1091
+ ), maxLength = Math.max(maxLengthProp, 0), size2 = react.useMemo(() => _getArrayProp(sizeProp), [sizeProp]), len = children.length, visibleCount = maxLength - 1, extraCount = len - visibleCount, visibleChildren = extraCount > 1 ? children.slice(extraCount, len) : children;
1563
1092
  return /* @__PURE__ */ jsxRuntime.jsxs(Root$z, { "data-ui": "AvatarStack", ...restProps, ref, $size: size2, children: [
1564
1093
  len === 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(AvatarCounter, { count: len, size: size2 }) }),
1565
1094
  len !== 0 && extraCount > 1 && /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(AvatarCounter, { count: extraCount, size: size2 }) }),
@@ -1601,38 +1130,38 @@ const Root$z = styledComponents.styled.div(responsiveAvatarStackSizeStyle, avata
1601
1130
  rowEnd,
1602
1131
  sizing,
1603
1132
  ...restProps
1604
- } = props;
1133
+ } = props, $column = react.useMemo(() => _getArrayProp(column), [column]), $columnStart = react.useMemo(() => _getArrayProp(columnStart), [columnStart]), $columnEnd = react.useMemo(() => _getArrayProp(columnEnd), [columnEnd]), $display = react.useMemo(() => _getArrayProp(display), [display]), $flex = react.useMemo(() => _getArrayProp(flex), [flex]), $height = react.useMemo(() => _getArrayProp(height), [height]), $margin = react.useMemo(() => _getArrayProp(margin), [margin]), $marginX = react.useMemo(() => _getArrayProp(marginX), [marginX]), $marginY = react.useMemo(() => _getArrayProp(marginY), [marginY]), $marginTop = react.useMemo(() => _getArrayProp(marginTop), [marginTop]), $marginRight = react.useMemo(() => _getArrayProp(marginRight), [marginRight]), $marginBottom = react.useMemo(() => _getArrayProp(marginBottom), [marginBottom]), $marginLeft = react.useMemo(() => _getArrayProp(marginLeft), [marginLeft]), $overflow = react.useMemo(() => _getArrayProp(overflow), [overflow]), $padding = react.useMemo(() => _getArrayProp(padding), [padding]), $paddingX = react.useMemo(() => _getArrayProp(paddingX), [paddingX]), $paddingY = react.useMemo(() => _getArrayProp(paddingY), [paddingY]), $paddingTop = react.useMemo(() => _getArrayProp(paddingTop), [paddingTop]), $paddingRight = react.useMemo(() => _getArrayProp(paddingRight), [paddingRight]), $paddingBottom = react.useMemo(() => _getArrayProp(paddingBottom), [paddingBottom]), $paddingLeft = react.useMemo(() => _getArrayProp(paddingLeft), [paddingLeft]), $row = react.useMemo(() => _getArrayProp(row), [row]), $rowStart = react.useMemo(() => _getArrayProp(rowStart), [rowStart]), $rowEnd = react.useMemo(() => _getArrayProp(rowEnd), [rowEnd]), $sizing = react.useMemo(() => _getArrayProp(sizing), [sizing]);
1605
1134
  return /* @__PURE__ */ jsxRuntime.jsx(
1606
1135
  Root$y,
1607
1136
  {
1608
1137
  "data-as": typeof asProp == "string" ? asProp : void 0,
1609
1138
  "data-ui": "Box",
1610
1139
  ...restProps,
1611
- $column: useArrayProp(column),
1612
- $columnStart: useArrayProp(columnStart),
1613
- $columnEnd: useArrayProp(columnEnd),
1614
- $display: useArrayProp(display),
1615
- $flex: useArrayProp(flex),
1616
- $height: useArrayProp(height),
1617
- $margin: useArrayProp(margin),
1618
- $marginX: useArrayProp(marginX),
1619
- $marginY: useArrayProp(marginY),
1620
- $marginTop: useArrayProp(marginTop),
1621
- $marginRight: useArrayProp(marginRight),
1622
- $marginBottom: useArrayProp(marginBottom),
1623
- $marginLeft: useArrayProp(marginLeft),
1624
- $overflow: useArrayProp(overflow),
1625
- $padding: useArrayProp(padding),
1626
- $paddingX: useArrayProp(paddingX),
1627
- $paddingY: useArrayProp(paddingY),
1628
- $paddingTop: useArrayProp(paddingTop),
1629
- $paddingRight: useArrayProp(paddingRight),
1630
- $paddingBottom: useArrayProp(paddingBottom),
1631
- $paddingLeft: useArrayProp(paddingLeft),
1632
- $row: useArrayProp(row),
1633
- $rowStart: useArrayProp(rowStart),
1634
- $rowEnd: useArrayProp(rowEnd),
1635
- $sizing: useArrayProp(sizing),
1140
+ $column,
1141
+ $columnStart,
1142
+ $columnEnd,
1143
+ $display,
1144
+ $flex,
1145
+ $height,
1146
+ $margin,
1147
+ $marginX,
1148
+ $marginY,
1149
+ $marginTop,
1150
+ $marginRight,
1151
+ $marginBottom,
1152
+ $marginLeft,
1153
+ $overflow,
1154
+ $padding,
1155
+ $paddingX,
1156
+ $paddingY,
1157
+ $paddingTop,
1158
+ $paddingRight,
1159
+ $paddingBottom,
1160
+ $paddingLeft,
1161
+ $row,
1162
+ $rowStart,
1163
+ $rowEnd,
1164
+ $sizing,
1636
1165
  as: asProp,
1637
1166
  ref,
1638
1167
  children: props.children
@@ -1722,7 +1251,7 @@ const Root$x = styledComponents.styled.div(
1722
1251
  textOverflow,
1723
1252
  weight,
1724
1253
  ...restProps
1725
- } = props;
1254
+ } = props, $size = react.useMemo(() => _getArrayProp(size2), [size2]), $align = react.useMemo(() => _getArrayProp(align), [align]);
1726
1255
  let children = childrenProp;
1727
1256
  return textOverflow === "ellipsis" && (children = /* @__PURE__ */ jsxRuntime.jsx(SpanWithTextOverflow$1, { children })), /* @__PURE__ */ jsxRuntime.jsx(
1728
1257
  Root$x,
@@ -1730,10 +1259,10 @@ const Root$x = styledComponents.styled.div(
1730
1259
  "data-ui": "Text",
1731
1260
  ...restProps,
1732
1261
  $accent: accent,
1733
- $align: useArrayProp(align),
1262
+ $align,
1263
+ $size,
1734
1264
  $muted: muted,
1735
1265
  ref,
1736
- $size: useArrayProp(size2),
1737
1266
  $weight: weight,
1738
1267
  children: /* @__PURE__ */ jsxRuntime.jsx("span", { children })
1739
1268
  }
@@ -1765,15 +1294,15 @@ const Root$w = styledComponents.styled(Box)(
1765
1294
  radius = "full",
1766
1295
  tone = "default",
1767
1296
  ...restProps
1768
- } = props;
1297
+ } = props, $radius = react.useMemo(() => _getArrayProp(radius), [radius]), $padding = react.useMemo(() => _getArrayProp(padding), [padding]);
1769
1298
  return /* @__PURE__ */ jsxRuntime.jsx(
1770
1299
  Root$w,
1771
1300
  {
1772
1301
  "data-ui": "Badge",
1773
1302
  ...restProps,
1774
1303
  $tone: tone,
1775
- $radius: useArrayProp(radius),
1776
- padding: useArrayProp(padding),
1304
+ $radius,
1305
+ padding: $padding,
1777
1306
  ref,
1778
1307
  children: /* @__PURE__ */ jsxRuntime.jsx(Text, { size: fontSize2, children })
1779
1308
  }
@@ -1782,17 +1311,17 @@ const Root$w = styledComponents.styled(Box)(
1782
1311
  flexItemStyle,
1783
1312
  responsiveFlexStyle
1784
1313
  ), Flex = react.forwardRef(function(props, ref) {
1785
- const { align, as, direction = "row", gap, justify, wrap, ...restProps } = props;
1314
+ const { align, as, direction = "row", gap, justify, wrap, ...restProps } = props, $align = react.useMemo(() => _getArrayProp(align), [align]), $direction = react.useMemo(() => _getArrayProp(direction), [direction]), $gap = react.useMemo(() => _getArrayProp(gap), [gap]), $justify = react.useMemo(() => _getArrayProp(justify), [justify]), $wrap = react.useMemo(() => _getArrayProp(wrap), [wrap]);
1786
1315
  return /* @__PURE__ */ jsxRuntime.jsx(
1787
1316
  Root$v,
1788
1317
  {
1789
1318
  "data-ui": "Flex",
1790
1319
  ...restProps,
1791
- $align: useArrayProp(align),
1792
- $direction: useArrayProp(direction),
1793
- $gap: useArrayProp(gap),
1794
- $justify: useArrayProp(justify),
1795
- $wrap: useArrayProp(wrap),
1320
+ $align,
1321
+ $direction,
1322
+ $gap,
1323
+ $justify,
1324
+ $wrap,
1796
1325
  forwardedAs: as,
1797
1326
  ref
1798
1327
  }
@@ -1966,278 +1495,744 @@ function buttonColorStyles(props) {
1966
1495
  },
1967
1496
  "&[data-selected]": _cardColorStyle(baseColor, color.pressed)
1968
1497
  }
1969
- },
1970
- (_a = style == null ? void 0 : style.button) == null ? void 0 : _a.root
1971
- ].filter(Boolean);
1498
+ },
1499
+ (_a = style == null ? void 0 : style.button) == null ? void 0 : _a.root
1500
+ ].filter(Boolean);
1501
+ }
1502
+ const Root$t = styledComponents.styled.button(responsiveRadiusStyle, buttonBaseStyles, buttonColorStyles), LoadingBox = styledComponents.styled.div`
1503
+ position: absolute;
1504
+ top: 0;
1505
+ left: 0;
1506
+ right: 0;
1507
+ bottom: 0;
1508
+ display: flex;
1509
+ align-items: center;
1510
+ justify-content: center;
1511
+ background-color: var(--card-bg-color);
1512
+ border-radius: inherit;
1513
+ z-index: 1;
1514
+ box-shadow: inherit;
1515
+ `, Button = react.forwardRef(function(props, ref) {
1516
+ const {
1517
+ children,
1518
+ disabled,
1519
+ fontSize: fontSize2 = 1,
1520
+ icon: IconComponent,
1521
+ iconRight: IconRightComponent,
1522
+ justify: justifyProp = "center",
1523
+ loading,
1524
+ mode = "default",
1525
+ padding: paddingProp = 3,
1526
+ paddingX: paddingXProp,
1527
+ paddingY: paddingYProp,
1528
+ paddingTop: paddingTopProp,
1529
+ paddingBottom: paddingBottomProp,
1530
+ paddingLeft: paddingLeftProp,
1531
+ paddingRight: paddingRightProp,
1532
+ radius: radiusProp = 2,
1533
+ selected,
1534
+ space: spaceProp = 3,
1535
+ text,
1536
+ textAlign,
1537
+ tone = "default",
1538
+ type = "button",
1539
+ muted = !1,
1540
+ width,
1541
+ ...restProps
1542
+ } = props, { button } = useTheme_v2(), justify = react.useMemo(() => _getArrayProp(justifyProp), [justifyProp]), padding = react.useMemo(() => _getArrayProp(paddingProp), [paddingProp]), paddingX = react.useMemo(() => _getArrayProp(paddingXProp), [paddingXProp]), paddingY = react.useMemo(() => _getArrayProp(paddingYProp), [paddingYProp]), paddingTop = react.useMemo(() => _getArrayProp(paddingTopProp), [paddingTopProp]), paddingBottom = react.useMemo(() => _getArrayProp(paddingBottomProp), [paddingBottomProp]), paddingLeft = react.useMemo(() => _getArrayProp(paddingLeftProp), [paddingLeftProp]), paddingRight = react.useMemo(() => _getArrayProp(paddingRightProp), [paddingRightProp]), radius = react.useMemo(() => _getArrayProp(radiusProp), [radiusProp]), space = react.useMemo(() => _getArrayProp(spaceProp), [spaceProp]), boxProps = react.useMemo(
1543
+ () => ({
1544
+ // flex: 1,
1545
+ padding,
1546
+ paddingX,
1547
+ paddingY,
1548
+ paddingTop,
1549
+ paddingBottom,
1550
+ paddingLeft,
1551
+ paddingRight
1552
+ }),
1553
+ [padding, paddingX, paddingY, paddingTop, paddingBottom, paddingLeft, paddingRight]
1554
+ );
1555
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1556
+ Root$t,
1557
+ {
1558
+ "data-ui": "Button",
1559
+ ...restProps,
1560
+ $mode: mode,
1561
+ $radius: radius,
1562
+ $tone: tone,
1563
+ "data-disabled": !!(loading || disabled),
1564
+ "data-selected": selected ? "" : void 0,
1565
+ disabled: !!(loading || disabled),
1566
+ ref,
1567
+ type,
1568
+ $width: width,
1569
+ children: [
1570
+ !!loading && /* @__PURE__ */ jsxRuntime.jsx(LoadingBox, { children: /* @__PURE__ */ jsxRuntime.jsx(Spinner, {}) }),
1571
+ (IconComponent || text || IconRightComponent) && /* @__PURE__ */ jsxRuntime.jsx(Box, { as: "span", ...boxProps, children: /* @__PURE__ */ jsxRuntime.jsxs(Flex, { as: "span", justify, gap: space, children: [
1572
+ IconComponent && /* @__PURE__ */ jsxRuntime.jsxs(Text, { size: fontSize2, children: [
1573
+ react.isValidElement(IconComponent) && IconComponent,
1574
+ reactIs.isValidElementType(IconComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconComponent, {})
1575
+ ] }),
1576
+ text && /* @__PURE__ */ jsxRuntime.jsx(
1577
+ Text,
1578
+ {
1579
+ muted,
1580
+ align: textAlign,
1581
+ size: fontSize2,
1582
+ textOverflow: "ellipsis",
1583
+ weight: button.textWeight,
1584
+ children: text
1585
+ }
1586
+ ),
1587
+ IconRightComponent && /* @__PURE__ */ jsxRuntime.jsxs(Text, { size: fontSize2, children: [
1588
+ react.isValidElement(IconRightComponent) && IconRightComponent,
1589
+ reactIs.isValidElementType(IconRightComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconRightComponent, {})
1590
+ ] })
1591
+ ] }) }),
1592
+ children && /* @__PURE__ */ jsxRuntime.jsx(Box, { as: "span", ...boxProps, children })
1593
+ ]
1594
+ }
1595
+ );
1596
+ });
1597
+ function cardStyle(props) {
1598
+ return [cardBaseStyle(props), cardColorStyle(props)];
1599
+ }
1600
+ function cardBaseStyle(props) {
1601
+ const { $checkered } = props, { space } = theme.getTheme_v2(props.theme);
1602
+ return styledComponents.css`
1603
+ ${$checkered && styledComponents.css`
1604
+ background-size: ${space[3]}px ${space[3]}px;
1605
+ background-position: 50% 50%;
1606
+ background-image: var(--card-bg-image);
1607
+ `}
1608
+
1609
+ &[data-as='button'] {
1610
+ -webkit-font-smoothing: inherit;
1611
+ appearance: none;
1612
+ outline: none;
1613
+ font: inherit;
1614
+ text-align: inherit;
1615
+ border: 0;
1616
+ width: -moz-available;
1617
+ width: -webkit-fill-available;
1618
+ width: stretch;
1619
+ }
1620
+
1621
+ /* &:is(a) */
1622
+ &[data-as='a'] {
1623
+ outline: none;
1624
+ text-decoration: none;
1625
+ }
1626
+
1627
+ /* &:is(pre) */
1628
+ &[data-as='pre'] {
1629
+ font: inherit;
1630
+ }
1631
+ `;
1632
+ }
1633
+ function cardColorStyle(props) {
1634
+ var _a;
1635
+ const { $checkered, $focusRing, $muted } = props, { card, color, style } = theme.getTheme_v2(props.theme), border2 = { width: card.border.width, color: "var(--card-border-color)" };
1636
+ return styledComponents.css`
1637
+ color-scheme: ${color._dark ? "dark" : "light"};
1638
+
1639
+ ${_cardColorStyle(color, color, $checkered)}
1640
+
1641
+ background-color: ${$muted ? "var(--card-muted-bg-color)" : "var(--card-bg-color)"};
1642
+ color: var(--card-fg-color);
1643
+
1644
+ /* &:is(button) */
1645
+ &[data-as='button'] {
1646
+ --card-focus-ring-box-shadow: none;
1647
+
1648
+ cursor: default;
1649
+ box-shadow: var(--card-focus-ring-box-shadow);
1650
+
1651
+ &:disabled {
1652
+ ${_cardColorStyle(color, color.selectable.default.disabled, $checkered)}
1653
+ }
1654
+
1655
+ &:not(:disabled) {
1656
+ &[data-pressed] {
1657
+ ${_cardColorStyle(color, color.selectable.default.pressed, $checkered)}
1658
+ }
1659
+
1660
+ &[data-selected] {
1661
+ ${_cardColorStyle(color, color.selectable.default.selected, $checkered)}
1662
+ }
1663
+
1664
+ @media (hover: hover) {
1665
+ &:not([data-pressed]):not([data-selected]) {
1666
+ &[data-hovered],
1667
+ &:hover {
1668
+ ${_cardColorStyle(color, color.selectable.default.hovered, $checkered)}
1669
+ }
1670
+
1671
+ &:active {
1672
+ ${_cardColorStyle(color, color.selectable.default.pressed, $checkered)}
1673
+ }
1674
+ }
1675
+ }
1676
+
1677
+ &:focus-visible {
1678
+ --card-focus-ring-box-shadow: ${$focusRing ? focusRingStyle({ base: color, border: border2, focusRing: card.focusRing }) : void 0};
1679
+ }
1680
+ }
1681
+ }
1682
+
1683
+ /* &:is(a) */
1684
+ &[data-as='a'] {
1685
+ cursor: pointer;
1686
+ box-shadow: var(--card-focus-ring-box-shadow);
1687
+
1688
+ &[data-disabled] {
1689
+ ${_cardColorStyle(color, color.selectable.default.disabled, $checkered)}
1690
+ }
1691
+
1692
+ &:not([data-disabled]) {
1693
+ &[data-pressed] {
1694
+ ${_cardColorStyle(color, color.selectable.default.pressed, $checkered)}
1695
+ }
1696
+
1697
+ &[data-selected] {
1698
+ ${_cardColorStyle(color, color.selectable.default.selected, $checkered)}
1699
+ }
1700
+
1701
+ @media (hover: hover) {
1702
+ &:not([data-pressed]):not([data-selected]) {
1703
+ &[data-hovered],
1704
+ &:hover {
1705
+ ${_cardColorStyle(color, color.selectable.default.hovered, $checkered)}
1706
+ }
1707
+
1708
+ &:active {
1709
+ ${_cardColorStyle(color, color.selectable.default.pressed, $checkered)}
1710
+ }
1711
+ }
1712
+ }
1713
+
1714
+ &:focus-visible {
1715
+ --card-focus-ring-box-shadow: ${$focusRing ? focusRingStyle({ base: color, border: border2, focusRing: card.focusRing }) : void 0};
1716
+ }
1717
+ }
1718
+ }
1719
+
1720
+ ${(_a = style == null ? void 0 : style.card) == null ? void 0 : _a.root}
1721
+ `;
1972
1722
  }
1973
- const Root$t = styledComponents.styled.button(responsiveRadiusStyle, buttonBaseStyles, buttonColorStyles), LoadingBox = styledComponents.styled.div`
1974
- position: absolute;
1975
- top: 0;
1976
- left: 0;
1977
- right: 0;
1978
- bottom: 0;
1979
- display: flex;
1980
- align-items: center;
1981
- justify-content: center;
1982
- background-color: var(--card-bg-color);
1983
- border-radius: inherit;
1984
- z-index: 1;
1985
- box-shadow: inherit;
1986
- `, Button = react.forwardRef(function(props, ref) {
1723
+ const Root$s = styledComponents.styled(Box)(responsiveBorderStyle, responsiveRadiusStyle, responsiveShadowStyle, cardStyle), Card = react.forwardRef(function(props, ref) {
1987
1724
  const {
1988
- children,
1989
- disabled,
1990
- fontSize: fontSize2 = 1,
1991
- icon: IconComponent,
1992
- iconRight: IconRightComponent,
1993
- justify: justifyProp = "center",
1994
- loading,
1995
- mode = "default",
1996
- padding: paddingProp = 3,
1997
- paddingX: paddingXProp,
1998
- paddingY: paddingYProp,
1999
- paddingTop: paddingTopProp,
2000
- paddingBottom: paddingBottomProp,
2001
- paddingLeft: paddingLeftProp,
2002
- paddingRight: paddingRightProp,
2003
- radius: radiusProp = 2,
1725
+ __unstable_checkered: checkered = !1,
1726
+ __unstable_focusRing: focusRing = !1,
1727
+ as: asProp,
1728
+ border: border2,
1729
+ borderTop: borderTop2,
1730
+ borderRight: borderRight2,
1731
+ borderBottom: borderBottom2,
1732
+ borderLeft: borderLeft2,
1733
+ muted,
1734
+ pressed,
1735
+ radius = 0,
1736
+ scheme,
2004
1737
  selected,
2005
- space: spaceProp = 3,
2006
- text,
2007
- textAlign,
2008
- tone = "default",
2009
- type = "button",
2010
- muted = !1,
2011
- width,
1738
+ shadow,
1739
+ tone: toneProp = "default",
2012
1740
  ...restProps
2013
- } = props, { button } = useTheme_v2(), justify = useArrayProp(justifyProp), padding = useArrayProp(paddingProp), paddingX = useArrayProp(paddingXProp), paddingY = useArrayProp(paddingYProp), paddingTop = useArrayProp(paddingTopProp), paddingBottom = useArrayProp(paddingBottomProp), paddingLeft = useArrayProp(paddingLeftProp), paddingRight = useArrayProp(paddingRightProp), radius = useArrayProp(radiusProp), space = useArrayProp(spaceProp), boxProps = react.useMemo(
2014
- () => ({
2015
- // flex: 1,
2016
- padding,
2017
- paddingX,
2018
- paddingY,
2019
- paddingTop,
2020
- paddingBottom,
2021
- paddingLeft,
2022
- paddingRight
2023
- }),
2024
- [padding, paddingX, paddingY, paddingTop, paddingBottom, paddingLeft, paddingRight]
2025
- );
2026
- return /* @__PURE__ */ jsxRuntime.jsxs(
2027
- Root$t,
1741
+ } = props, as = reactIs.isValidElementType(asProp) ? asProp : "div", rootTheme = useRootTheme(), tone = toneProp === "inherit" ? rootTheme.tone : toneProp, $border = react.useMemo(() => _getArrayProp(border2), [border2]), $borderTop = react.useMemo(() => _getArrayProp(borderTop2), [borderTop2]), $borderRight = react.useMemo(() => _getArrayProp(borderRight2), [borderRight2]), $borderBottom = react.useMemo(() => _getArrayProp(borderBottom2), [borderBottom2]), $borderLeft = react.useMemo(() => _getArrayProp(borderLeft2), [borderLeft2]), $radius = react.useMemo(() => _getArrayProp(radius), [radius]), $shadow = react.useMemo(() => _getArrayProp(shadow), [shadow]);
1742
+ return /* @__PURE__ */ jsxRuntime.jsx(ThemeColorProvider, { scheme, tone, children: /* @__PURE__ */ jsxRuntime.jsx(
1743
+ Root$s,
2028
1744
  {
2029
- "data-ui": "Button",
1745
+ "data-as": typeof as == "string" ? as : void 0,
1746
+ "data-scheme": rootTheme.scheme,
1747
+ "data-ui": "Card",
1748
+ "data-tone": tone,
2030
1749
  ...restProps,
2031
- $mode: mode,
2032
- $radius: radius,
1750
+ $border,
1751
+ $borderTop,
1752
+ $borderRight,
1753
+ $borderBottom,
1754
+ $borderLeft,
1755
+ $radius,
1756
+ $shadow,
1757
+ $checkered: checkered,
1758
+ $focusRing: focusRing,
1759
+ $muted: muted,
2033
1760
  $tone: tone,
2034
- "data-disabled": !!(loading || disabled),
1761
+ "data-checkered": checkered ? "" : void 0,
1762
+ "data-pressed": pressed ? "" : void 0,
2035
1763
  "data-selected": selected ? "" : void 0,
2036
- disabled: !!(loading || disabled),
1764
+ forwardedAs: as,
2037
1765
  ref,
2038
- type,
2039
- $width: width,
2040
- children: [
2041
- !!loading && /* @__PURE__ */ jsxRuntime.jsx(LoadingBox, { children: /* @__PURE__ */ jsxRuntime.jsx(Spinner, {}) }),
2042
- (IconComponent || text || IconRightComponent) && /* @__PURE__ */ jsxRuntime.jsx(Box, { as: "span", ...boxProps, children: /* @__PURE__ */ jsxRuntime.jsxs(Flex, { as: "span", justify, gap: space, children: [
2043
- IconComponent && /* @__PURE__ */ jsxRuntime.jsxs(Text, { size: fontSize2, children: [
2044
- react.isValidElement(IconComponent) && IconComponent,
2045
- ReactIs.isValidElementType(IconComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconComponent, {})
2046
- ] }),
2047
- text && /* @__PURE__ */ jsxRuntime.jsx(
2048
- Text,
2049
- {
2050
- muted,
2051
- align: textAlign,
2052
- size: fontSize2,
2053
- textOverflow: "ellipsis",
2054
- weight: button.textWeight,
2055
- children: text
2056
- }
2057
- ),
2058
- IconRightComponent && /* @__PURE__ */ jsxRuntime.jsxs(Text, { size: fontSize2, children: [
2059
- react.isValidElement(IconRightComponent) && IconRightComponent,
2060
- ReactIs.isValidElementType(IconRightComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconRightComponent, {})
2061
- ] })
2062
- ] }) }),
2063
- children && /* @__PURE__ */ jsxRuntime.jsx(Box, { as: "span", ...boxProps, children })
2064
- ]
1766
+ selected
1767
+ }
1768
+ ) });
1769
+ });
1770
+ function useArrayProp(val, defaultVal) {
1771
+ return react.useMemo(() => _getArrayProp(val, defaultVal), [defaultVal, val]);
1772
+ }
1773
+ function _getElements(element, elementsArg) {
1774
+ const ret = [element];
1775
+ for (const el of elementsArg)
1776
+ Array.isArray(el) ? ret.push(...el) : ret.push(el);
1777
+ return ret.filter(Boolean);
1778
+ }
1779
+ function useClickOutside(listener, elementsArg = EMPTY_ARRAY, boundaryElement) {
1780
+ const [element, setElement] = react.useState(null), [elements, setElements] = react.useState(() => _getElements(element, elementsArg)), elementsRef = react.useRef(elements);
1781
+ return react.useEffect(() => {
1782
+ const prevElements = elementsRef.current, nextElements = _getElements(element, elementsArg);
1783
+ if (prevElements.length !== nextElements.length) {
1784
+ setElements(nextElements), elementsRef.current = nextElements;
1785
+ return;
1786
+ }
1787
+ for (const el of prevElements)
1788
+ if (!nextElements.includes(el)) {
1789
+ setElements(nextElements), elementsRef.current = nextElements;
1790
+ return;
1791
+ }
1792
+ for (const el of nextElements)
1793
+ if (!prevElements.includes(el)) {
1794
+ setElements(nextElements), elementsRef.current = nextElements;
1795
+ return;
1796
+ }
1797
+ }, [element, elementsArg]), react.useEffect(() => {
1798
+ if (!listener) return;
1799
+ const handleWindowMouseDown = (evt) => {
1800
+ const target = evt.target;
1801
+ if (target instanceof Node && !(boundaryElement && !boundaryElement.contains(target))) {
1802
+ for (const el of elements)
1803
+ if (target === el || el.contains(target))
1804
+ return;
1805
+ listener(evt);
1806
+ }
1807
+ };
1808
+ return window.addEventListener("mousedown", handleWindowMouseDown), () => {
1809
+ window.removeEventListener("mousedown", handleWindowMouseDown);
1810
+ };
1811
+ }, [boundaryElement, listener, elements]), setElement;
1812
+ }
1813
+ var resizeObservers = [], hasActiveObservations = function() {
1814
+ return resizeObservers.some(function(ro) {
1815
+ return ro.activeTargets.length > 0;
1816
+ });
1817
+ }, hasSkippedObservations = function() {
1818
+ return resizeObservers.some(function(ro) {
1819
+ return ro.skippedTargets.length > 0;
1820
+ });
1821
+ }, msg = "ResizeObserver loop completed with undelivered notifications.", deliverResizeLoopError = function() {
1822
+ var event;
1823
+ typeof ErrorEvent == "function" ? event = new ErrorEvent("error", {
1824
+ message: msg
1825
+ }) : (event = document.createEvent("Event"), event.initEvent("error", !1, !1), event.message = msg), window.dispatchEvent(event);
1826
+ }, ResizeObserverBoxOptions;
1827
+ (function(ResizeObserverBoxOptions2) {
1828
+ ResizeObserverBoxOptions2.BORDER_BOX = "border-box", ResizeObserverBoxOptions2.CONTENT_BOX = "content-box", ResizeObserverBoxOptions2.DEVICE_PIXEL_CONTENT_BOX = "device-pixel-content-box";
1829
+ })(ResizeObserverBoxOptions || (ResizeObserverBoxOptions = {}));
1830
+ var freeze = function(obj) {
1831
+ return Object.freeze(obj);
1832
+ }, ResizeObserverSize = /* @__PURE__ */ function() {
1833
+ function ResizeObserverSize2(inlineSize, blockSize) {
1834
+ this.inlineSize = inlineSize, this.blockSize = blockSize, freeze(this);
1835
+ }
1836
+ return ResizeObserverSize2;
1837
+ }(), DOMRectReadOnly = function() {
1838
+ function DOMRectReadOnly2(x, y, width, height) {
1839
+ return this.x = x, this.y = y, this.width = width, this.height = height, this.top = this.y, this.left = this.x, this.bottom = this.top + this.height, this.right = this.left + this.width, freeze(this);
1840
+ }
1841
+ return DOMRectReadOnly2.prototype.toJSON = function() {
1842
+ var _a = this, x = _a.x, y = _a.y, top = _a.top, right = _a.right, bottom = _a.bottom, left = _a.left, width = _a.width, height = _a.height;
1843
+ return { x, y, top, right, bottom, left, width, height };
1844
+ }, DOMRectReadOnly2.fromRect = function(rectangle) {
1845
+ return new DOMRectReadOnly2(rectangle.x, rectangle.y, rectangle.width, rectangle.height);
1846
+ }, DOMRectReadOnly2;
1847
+ }(), isSVG = function(target) {
1848
+ return target instanceof SVGElement && "getBBox" in target;
1849
+ }, isHidden = function(target) {
1850
+ if (isSVG(target)) {
1851
+ var _a = target.getBBox(), width = _a.width, height = _a.height;
1852
+ return !width && !height;
1853
+ }
1854
+ var _b = target, offsetWidth = _b.offsetWidth, offsetHeight = _b.offsetHeight;
1855
+ return !(offsetWidth || offsetHeight || target.getClientRects().length);
1856
+ }, isElement = function(obj) {
1857
+ var _a;
1858
+ if (obj instanceof Element)
1859
+ return !0;
1860
+ var scope = (_a = obj == null ? void 0 : obj.ownerDocument) === null || _a === void 0 ? void 0 : _a.defaultView;
1861
+ return !!(scope && obj instanceof scope.Element);
1862
+ }, isReplacedElement = function(target) {
1863
+ switch (target.tagName) {
1864
+ case "INPUT":
1865
+ if (target.type !== "image")
1866
+ break;
1867
+ case "VIDEO":
1868
+ case "AUDIO":
1869
+ case "EMBED":
1870
+ case "OBJECT":
1871
+ case "CANVAS":
1872
+ case "IFRAME":
1873
+ case "IMG":
1874
+ return !0;
1875
+ }
1876
+ return !1;
1877
+ }, global$1 = typeof window < "u" ? window : {}, cache = /* @__PURE__ */ new WeakMap(), scrollRegexp = /auto|scroll/, verticalRegexp = /^tb|vertical/, IE = /msie|trident/i.test(global$1.navigator && global$1.navigator.userAgent), parseDimension = function(pixel) {
1878
+ return parseFloat(pixel || "0");
1879
+ }, size$1 = function(inlineSize, blockSize, switchSizes) {
1880
+ return inlineSize === void 0 && (inlineSize = 0), blockSize === void 0 && (blockSize = 0), switchSizes === void 0 && (switchSizes = !1), new ResizeObserverSize((switchSizes ? blockSize : inlineSize) || 0, (switchSizes ? inlineSize : blockSize) || 0);
1881
+ }, zeroBoxes = freeze({
1882
+ devicePixelContentBoxSize: size$1(),
1883
+ borderBoxSize: size$1(),
1884
+ contentBoxSize: size$1(),
1885
+ contentRect: new DOMRectReadOnly(0, 0, 0, 0)
1886
+ }), calculateBoxSizes = function(target, forceRecalculation) {
1887
+ if (forceRecalculation === void 0 && (forceRecalculation = !1), cache.has(target) && !forceRecalculation)
1888
+ return cache.get(target);
1889
+ if (isHidden(target))
1890
+ return cache.set(target, zeroBoxes), zeroBoxes;
1891
+ var cs = getComputedStyle(target), svg = isSVG(target) && target.ownerSVGElement && target.getBBox(), removePadding = !IE && cs.boxSizing === "border-box", switchSizes = verticalRegexp.test(cs.writingMode || ""), canScrollVertically = !svg && scrollRegexp.test(cs.overflowY || ""), canScrollHorizontally = !svg && scrollRegexp.test(cs.overflowX || ""), paddingTop = svg ? 0 : parseDimension(cs.paddingTop), paddingRight = svg ? 0 : parseDimension(cs.paddingRight), paddingBottom = svg ? 0 : parseDimension(cs.paddingBottom), paddingLeft = svg ? 0 : parseDimension(cs.paddingLeft), borderTop2 = svg ? 0 : parseDimension(cs.borderTopWidth), borderRight2 = svg ? 0 : parseDimension(cs.borderRightWidth), borderBottom2 = svg ? 0 : parseDimension(cs.borderBottomWidth), borderLeft2 = svg ? 0 : parseDimension(cs.borderLeftWidth), horizontalPadding = paddingLeft + paddingRight, verticalPadding = paddingTop + paddingBottom, horizontalBorderArea = borderLeft2 + borderRight2, verticalBorderArea = borderTop2 + borderBottom2, horizontalScrollbarThickness = canScrollHorizontally ? target.offsetHeight - verticalBorderArea - target.clientHeight : 0, verticalScrollbarThickness = canScrollVertically ? target.offsetWidth - horizontalBorderArea - target.clientWidth : 0, widthReduction = removePadding ? horizontalPadding + horizontalBorderArea : 0, heightReduction = removePadding ? verticalPadding + verticalBorderArea : 0, contentWidth = svg ? svg.width : parseDimension(cs.width) - widthReduction - verticalScrollbarThickness, contentHeight = svg ? svg.height : parseDimension(cs.height) - heightReduction - horizontalScrollbarThickness, borderBoxWidth = contentWidth + horizontalPadding + verticalScrollbarThickness + horizontalBorderArea, borderBoxHeight = contentHeight + verticalPadding + horizontalScrollbarThickness + verticalBorderArea, boxes = freeze({
1892
+ devicePixelContentBoxSize: size$1(Math.round(contentWidth * devicePixelRatio), Math.round(contentHeight * devicePixelRatio), switchSizes),
1893
+ borderBoxSize: size$1(borderBoxWidth, borderBoxHeight, switchSizes),
1894
+ contentBoxSize: size$1(contentWidth, contentHeight, switchSizes),
1895
+ contentRect: new DOMRectReadOnly(paddingLeft, paddingTop, contentWidth, contentHeight)
1896
+ });
1897
+ return cache.set(target, boxes), boxes;
1898
+ }, calculateBoxSize = function(target, observedBox, forceRecalculation) {
1899
+ var _a = calculateBoxSizes(target, forceRecalculation), borderBoxSize = _a.borderBoxSize, contentBoxSize = _a.contentBoxSize, devicePixelContentBoxSize = _a.devicePixelContentBoxSize;
1900
+ switch (observedBox) {
1901
+ case ResizeObserverBoxOptions.DEVICE_PIXEL_CONTENT_BOX:
1902
+ return devicePixelContentBoxSize;
1903
+ case ResizeObserverBoxOptions.BORDER_BOX:
1904
+ return borderBoxSize;
1905
+ default:
1906
+ return contentBoxSize;
1907
+ }
1908
+ }, ResizeObserverEntry = /* @__PURE__ */ function() {
1909
+ function ResizeObserverEntry2(target) {
1910
+ var boxes = calculateBoxSizes(target);
1911
+ this.target = target, this.contentRect = boxes.contentRect, this.borderBoxSize = freeze([boxes.borderBoxSize]), this.contentBoxSize = freeze([boxes.contentBoxSize]), this.devicePixelContentBoxSize = freeze([boxes.devicePixelContentBoxSize]);
1912
+ }
1913
+ return ResizeObserverEntry2;
1914
+ }(), calculateDepthForNode = function(node) {
1915
+ if (isHidden(node))
1916
+ return 1 / 0;
1917
+ for (var depth = 0, parent = node.parentNode; parent; )
1918
+ depth += 1, parent = parent.parentNode;
1919
+ return depth;
1920
+ }, broadcastActiveObservations = function() {
1921
+ var shallowestDepth = 1 / 0, callbacks2 = [];
1922
+ resizeObservers.forEach(function(ro) {
1923
+ if (ro.activeTargets.length !== 0) {
1924
+ var entries = [];
1925
+ ro.activeTargets.forEach(function(ot) {
1926
+ var entry = new ResizeObserverEntry(ot.target), targetDepth = calculateDepthForNode(ot.target);
1927
+ entries.push(entry), ot.lastReportedSize = calculateBoxSize(ot.target, ot.observedBox), targetDepth < shallowestDepth && (shallowestDepth = targetDepth);
1928
+ }), callbacks2.push(function() {
1929
+ ro.callback.call(ro.observer, entries, ro.observer);
1930
+ }), ro.activeTargets.splice(0, ro.activeTargets.length);
2065
1931
  }
2066
- );
2067
- });
2068
- function cardStyle(props) {
2069
- return [cardBaseStyle(props), cardColorStyle(props)];
2070
- }
2071
- function cardBaseStyle(props) {
2072
- const { $checkered } = props, { space } = theme.getTheme_v2(props.theme);
2073
- return styledComponents.css`
2074
- ${$checkered && styledComponents.css`
2075
- background-size: ${space[3]}px ${space[3]}px;
2076
- background-position: 50% 50%;
2077
- background-image: var(--card-bg-image);
2078
- `}
2079
-
2080
- &[data-as='button'] {
2081
- -webkit-font-smoothing: inherit;
2082
- appearance: none;
2083
- outline: none;
2084
- font: inherit;
2085
- text-align: inherit;
2086
- border: 0;
2087
- width: -moz-available;
2088
- width: -webkit-fill-available;
2089
- width: stretch;
1932
+ });
1933
+ for (var _i = 0, callbacks_1 = callbacks2; _i < callbacks_1.length; _i++) {
1934
+ var callback = callbacks_1[_i];
1935
+ callback();
1936
+ }
1937
+ return shallowestDepth;
1938
+ }, gatherActiveObservationsAtDepth = function(depth) {
1939
+ resizeObservers.forEach(function(ro) {
1940
+ ro.activeTargets.splice(0, ro.activeTargets.length), ro.skippedTargets.splice(0, ro.skippedTargets.length), ro.observationTargets.forEach(function(ot) {
1941
+ ot.isActive() && (calculateDepthForNode(ot.target) > depth ? ro.activeTargets.push(ot) : ro.skippedTargets.push(ot));
1942
+ });
1943
+ });
1944
+ }, process = function() {
1945
+ var depth = 0;
1946
+ for (gatherActiveObservationsAtDepth(depth); hasActiveObservations(); )
1947
+ depth = broadcastActiveObservations(), gatherActiveObservationsAtDepth(depth);
1948
+ return hasSkippedObservations() && deliverResizeLoopError(), depth > 0;
1949
+ }, trigger, callbacks = [], notify = function() {
1950
+ return callbacks.splice(0).forEach(function(cb) {
1951
+ return cb();
1952
+ });
1953
+ }, queueMicroTask = function(callback) {
1954
+ if (!trigger) {
1955
+ var toggle_1 = 0, el_1 = document.createTextNode(""), config = { characterData: !0 };
1956
+ new MutationObserver(function() {
1957
+ return notify();
1958
+ }).observe(el_1, config), trigger = function() {
1959
+ el_1.textContent = "".concat(toggle_1 ? toggle_1-- : toggle_1++);
1960
+ };
1961
+ }
1962
+ callbacks.push(callback), trigger();
1963
+ }, queueResizeObserver = function(cb) {
1964
+ queueMicroTask(function() {
1965
+ requestAnimationFrame(cb);
1966
+ });
1967
+ }, watching = 0, isWatching = function() {
1968
+ return !!watching;
1969
+ }, CATCH_PERIOD = 250, observerConfig = { attributes: !0, characterData: !0, childList: !0, subtree: !0 }, events = [
1970
+ "resize",
1971
+ "load",
1972
+ "transitionend",
1973
+ "animationend",
1974
+ "animationstart",
1975
+ "animationiteration",
1976
+ "keyup",
1977
+ "keydown",
1978
+ "mouseup",
1979
+ "mousedown",
1980
+ "mouseover",
1981
+ "mouseout",
1982
+ "blur",
1983
+ "focus"
1984
+ ], time = function(timeout) {
1985
+ return timeout === void 0 && (timeout = 0), Date.now() + timeout;
1986
+ }, scheduled = !1, Scheduler = function() {
1987
+ function Scheduler2() {
1988
+ var _this = this;
1989
+ this.stopped = !0, this.listener = function() {
1990
+ return _this.schedule();
1991
+ };
1992
+ }
1993
+ return Scheduler2.prototype.run = function(timeout) {
1994
+ var _this = this;
1995
+ if (timeout === void 0 && (timeout = CATCH_PERIOD), !scheduled) {
1996
+ scheduled = !0;
1997
+ var until = time(timeout);
1998
+ queueResizeObserver(function() {
1999
+ var elementsHaveResized = !1;
2000
+ try {
2001
+ elementsHaveResized = process();
2002
+ } finally {
2003
+ if (scheduled = !1, timeout = until - time(), !isWatching())
2004
+ return;
2005
+ elementsHaveResized ? _this.run(1e3) : timeout > 0 ? _this.run(timeout) : _this.start();
2006
+ }
2007
+ });
2090
2008
  }
2091
-
2092
- /* &:is(a) */
2093
- &[data-as='a'] {
2094
- outline: none;
2095
- text-decoration: none;
2009
+ }, Scheduler2.prototype.schedule = function() {
2010
+ this.stop(), this.run();
2011
+ }, Scheduler2.prototype.observe = function() {
2012
+ var _this = this, cb = function() {
2013
+ return _this.observer && _this.observer.observe(document.body, observerConfig);
2014
+ };
2015
+ document.body ? cb() : global$1.addEventListener("DOMContentLoaded", cb);
2016
+ }, Scheduler2.prototype.start = function() {
2017
+ var _this = this;
2018
+ this.stopped && (this.stopped = !1, this.observer = new MutationObserver(this.listener), this.observe(), events.forEach(function(name) {
2019
+ return global$1.addEventListener(name, _this.listener, !0);
2020
+ }));
2021
+ }, Scheduler2.prototype.stop = function() {
2022
+ var _this = this;
2023
+ this.stopped || (this.observer && this.observer.disconnect(), events.forEach(function(name) {
2024
+ return global$1.removeEventListener(name, _this.listener, !0);
2025
+ }), this.stopped = !0);
2026
+ }, Scheduler2;
2027
+ }(), scheduler = new Scheduler(), updateCount = function(n) {
2028
+ !watching && n > 0 && scheduler.start(), watching += n, !watching && scheduler.stop();
2029
+ }, skipNotifyOnElement = function(target) {
2030
+ return !isSVG(target) && !isReplacedElement(target) && getComputedStyle(target).display === "inline";
2031
+ }, ResizeObservation = function() {
2032
+ function ResizeObservation2(target, observedBox) {
2033
+ this.target = target, this.observedBox = observedBox || ResizeObserverBoxOptions.CONTENT_BOX, this.lastReportedSize = {
2034
+ inlineSize: 0,
2035
+ blockSize: 0
2036
+ };
2037
+ }
2038
+ return ResizeObservation2.prototype.isActive = function() {
2039
+ var size2 = calculateBoxSize(this.target, this.observedBox, !0);
2040
+ return skipNotifyOnElement(this.target) && (this.lastReportedSize = size2), this.lastReportedSize.inlineSize !== size2.inlineSize || this.lastReportedSize.blockSize !== size2.blockSize;
2041
+ }, ResizeObservation2;
2042
+ }(), ResizeObserverDetail = /* @__PURE__ */ function() {
2043
+ function ResizeObserverDetail2(resizeObserver, callback) {
2044
+ this.activeTargets = [], this.skippedTargets = [], this.observationTargets = [], this.observer = resizeObserver, this.callback = callback;
2045
+ }
2046
+ return ResizeObserverDetail2;
2047
+ }(), observerMap = /* @__PURE__ */ new WeakMap(), getObservationIndex = function(observationTargets, target) {
2048
+ for (var i = 0; i < observationTargets.length; i += 1)
2049
+ if (observationTargets[i].target === target)
2050
+ return i;
2051
+ return -1;
2052
+ }, ResizeObserverController = function() {
2053
+ function ResizeObserverController2() {
2054
+ }
2055
+ return ResizeObserverController2.connect = function(resizeObserver, callback) {
2056
+ var detail = new ResizeObserverDetail(resizeObserver, callback);
2057
+ observerMap.set(resizeObserver, detail);
2058
+ }, ResizeObserverController2.observe = function(resizeObserver, target, options) {
2059
+ var detail = observerMap.get(resizeObserver), firstObservation = detail.observationTargets.length === 0;
2060
+ getObservationIndex(detail.observationTargets, target) < 0 && (firstObservation && resizeObservers.push(detail), detail.observationTargets.push(new ResizeObservation(target, options && options.box)), updateCount(1), scheduler.schedule());
2061
+ }, ResizeObserverController2.unobserve = function(resizeObserver, target) {
2062
+ var detail = observerMap.get(resizeObserver), index = getObservationIndex(detail.observationTargets, target), lastObservation = detail.observationTargets.length === 1;
2063
+ index >= 0 && (lastObservation && resizeObservers.splice(resizeObservers.indexOf(detail), 1), detail.observationTargets.splice(index, 1), updateCount(-1));
2064
+ }, ResizeObserverController2.disconnect = function(resizeObserver) {
2065
+ var _this = this, detail = observerMap.get(resizeObserver);
2066
+ detail.observationTargets.slice().forEach(function(ot) {
2067
+ return _this.unobserve(resizeObserver, ot.target);
2068
+ }), detail.activeTargets.splice(0, detail.activeTargets.length);
2069
+ }, ResizeObserverController2;
2070
+ }(), ResizeObserver = function() {
2071
+ function ResizeObserver2(callback) {
2072
+ if (arguments.length === 0)
2073
+ throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");
2074
+ if (typeof callback != "function")
2075
+ throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");
2076
+ ResizeObserverController.connect(this, callback);
2077
+ }
2078
+ return ResizeObserver2.prototype.observe = function(target, options) {
2079
+ if (arguments.length === 0)
2080
+ throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");
2081
+ if (!isElement(target))
2082
+ throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");
2083
+ ResizeObserverController.observe(this, target, options);
2084
+ }, ResizeObserver2.prototype.unobserve = function(target) {
2085
+ if (arguments.length === 0)
2086
+ throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");
2087
+ if (!isElement(target))
2088
+ throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");
2089
+ ResizeObserverController.unobserve(this, target);
2090
+ }, ResizeObserver2.prototype.disconnect = function() {
2091
+ ResizeObserverController.disconnect(this);
2092
+ }, ResizeObserver2.toString = function() {
2093
+ return "function ResizeObserver () { [polyfill code] }";
2094
+ }, ResizeObserver2;
2095
+ }();
2096
+ const _ResizeObserver = typeof document < "u" && typeof window < "u" && window.ResizeObserver ? window.ResizeObserver : ResizeObserver, _elementSizeObserver = _createElementSizeObserver();
2097
+ function _createElementRectValueListener() {
2098
+ return {
2099
+ subscribe(element, subscriber) {
2100
+ const resizeObserver = new _ResizeObserver(([entry]) => {
2101
+ subscriber({
2102
+ _contentRect: entry.contentRect,
2103
+ border: {
2104
+ width: entry.borderBoxSize[0].inlineSize,
2105
+ height: entry.borderBoxSize[0].blockSize
2106
+ },
2107
+ content: {
2108
+ width: entry.contentRect.width,
2109
+ height: entry.contentRect.height
2110
+ }
2111
+ });
2112
+ });
2113
+ return resizeObserver.observe(element), () => {
2114
+ resizeObserver.unobserve(element), resizeObserver.disconnect();
2115
+ };
2096
2116
  }
2097
-
2098
- /* &:is(pre) */
2099
- &[data-as='pre'] {
2100
- font: inherit;
2117
+ };
2118
+ }
2119
+ function _createElementSizeObserver() {
2120
+ const disposeCache = /* @__PURE__ */ new WeakMap(), subscribersCache = /* @__PURE__ */ new WeakMap();
2121
+ return {
2122
+ subscribe(element, subscriber) {
2123
+ const subscribers = subscribersCache.get(element) || [];
2124
+ let dispose = disposeCache.get(element);
2125
+ return subscribersCache.has(element) || (subscribersCache.set(element, subscribers), dispose = _createElementRectValueListener().subscribe(element, (elementRect) => {
2126
+ for (const sub of subscribers)
2127
+ sub(elementRect);
2128
+ })), subscribers.push(subscriber), () => {
2129
+ const idx = subscribers.indexOf(subscriber);
2130
+ idx > -1 && subscribers.splice(idx, 1), subscribers.length === 0 && dispose && dispose();
2131
+ };
2101
2132
  }
2102
- `;
2133
+ };
2103
2134
  }
2104
- function cardColorStyle(props) {
2105
- var _a;
2106
- const { $checkered, $focusRing, $muted } = props, { card, color, style } = theme.getTheme_v2(props.theme), border2 = { width: card.border.width, color: "var(--card-border-color)" };
2107
- return styledComponents.css`
2108
- color-scheme: ${color._dark ? "dark" : "light"};
2109
-
2110
- ${_cardColorStyle(color, color, $checkered)}
2111
-
2112
- background-color: ${$muted ? "var(--card-muted-bg-color)" : "var(--card-bg-color)"};
2113
- color: var(--card-fg-color);
2114
-
2115
- /* &:is(button) */
2116
- &[data-as='button'] {
2117
- --card-focus-ring-box-shadow: none;
2118
-
2119
- cursor: default;
2120
- box-shadow: var(--card-focus-ring-box-shadow);
2121
-
2122
- &:disabled {
2123
- ${_cardColorStyle(color, color.selectable.default.disabled, $checkered)}
2124
- }
2125
-
2126
- &:not(:disabled) {
2127
- &[data-pressed] {
2128
- ${_cardColorStyle(color, color.selectable.default.pressed, $checkered)}
2129
- }
2130
-
2131
- &[data-selected] {
2132
- ${_cardColorStyle(color, color.selectable.default.selected, $checkered)}
2133
- }
2134
-
2135
- @media (hover: hover) {
2136
- &:not([data-pressed]):not([data-selected]) {
2137
- &[data-hovered],
2138
- &:hover {
2139
- ${_cardColorStyle(color, color.selectable.default.hovered, $checkered)}
2140
- }
2141
-
2142
- &:active {
2143
- ${_cardColorStyle(color, color.selectable.default.pressed, $checkered)}
2144
- }
2145
- }
2146
- }
2147
-
2148
- &:focus-visible {
2149
- --card-focus-ring-box-shadow: ${$focusRing ? focusRingStyle({ base: color, border: border2, focusRing: card.focusRing }) : void 0};
2150
- }
2135
+ function useElementSize(element) {
2136
+ const [size2, setSize] = react.useState(null);
2137
+ return react.useEffect(() => {
2138
+ if (element)
2139
+ return _elementSizeObserver.subscribe(element, setSize);
2140
+ }, [element]), size2;
2141
+ }
2142
+ function useElementRect(element) {
2143
+ const elementSize = useElementSize(element);
2144
+ return (elementSize == null ? void 0 : elementSize._contentRect) || null;
2145
+ }
2146
+ function useGlobalKeyDown(onKeyDown) {
2147
+ return react.useEffect(() => (addEventListener("keydown", onKeyDown), () => removeEventListener("keydown", onKeyDown)), [onKeyDown]);
2148
+ }
2149
+ const MEDIA_STORE_CACHE = /* @__PURE__ */ new WeakMap();
2150
+ function _getMediaQuery(media, index) {
2151
+ 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)`;
2152
+ }
2153
+ function _createMediaStore(media) {
2154
+ const mediaLen = media.length;
2155
+ let sizes;
2156
+ const getSizes = () => {
2157
+ if (!sizes) {
2158
+ sizes = [];
2159
+ for (let index = mediaLen; index > -1; index -= 1) {
2160
+ const mediaQuery = _getMediaQuery(media, index);
2161
+ sizes.push({ index, mq: window.matchMedia(mediaQuery) });
2151
2162
  }
2152
2163
  }
2153
-
2154
- /* &:is(a) */
2155
- &[data-as='a'] {
2156
- cursor: pointer;
2157
- box-shadow: var(--card-focus-ring-box-shadow);
2158
-
2159
- &[data-disabled] {
2160
- ${_cardColorStyle(color, color.selectable.default.disabled, $checkered)}
2161
- }
2162
-
2163
- &:not([data-disabled]) {
2164
- &[data-pressed] {
2165
- ${_cardColorStyle(color, color.selectable.default.pressed, $checkered)}
2166
- }
2167
-
2168
- &[data-selected] {
2169
- ${_cardColorStyle(color, color.selectable.default.selected, $checkered)}
2170
- }
2171
-
2172
- @media (hover: hover) {
2173
- &:not([data-pressed]):not([data-selected]) {
2174
- &[data-hovered],
2175
- &:hover {
2176
- ${_cardColorStyle(color, color.selectable.default.hovered, $checkered)}
2177
- }
2178
-
2179
- &:active {
2180
- ${_cardColorStyle(color, color.selectable.default.pressed, $checkered)}
2181
- }
2182
- }
2183
- }
2184
-
2185
- &:focus-visible {
2186
- --card-focus-ring-box-shadow: ${$focusRing ? focusRingStyle({ base: color, border: border2, focusRing: card.focusRing }) : void 0};
2187
- }
2188
- }
2164
+ return sizes;
2165
+ };
2166
+ return { getSnapshot: () => {
2167
+ for (const { index, mq } of getSizes())
2168
+ if (mq.matches) return index;
2169
+ return 0;
2170
+ }, subscribe: (onStoreChange) => {
2171
+ const disposeFns = [];
2172
+ for (const { mq } of getSizes()) {
2173
+ const handleChange = () => {
2174
+ mq.matches && onStoreChange();
2175
+ };
2176
+ mq.addEventListener("change", handleChange), disposeFns.push(() => mq.removeEventListener("change", handleChange));
2189
2177
  }
2190
-
2191
- ${(_a = style == null ? void 0 : style.card) == null ? void 0 : _a.root}
2192
- `;
2178
+ return () => {
2179
+ for (const disposeFn of disposeFns)
2180
+ disposeFn();
2181
+ };
2182
+ } };
2183
+ }
2184
+ function getServerSnapshot$2() {
2185
+ return 0;
2186
+ }
2187
+ function useMediaIndex() {
2188
+ const { media } = useTheme_v2();
2189
+ let store = MEDIA_STORE_CACHE.get(media);
2190
+ return store || (store = _createMediaStore(media), MEDIA_STORE_CACHE.set(media, store)), react.useSyncExternalStore(store.subscribe, store.getSnapshot, getServerSnapshot$2);
2191
+ }
2192
+ let MEDIA_QUERY_CACHE$1;
2193
+ function getMatchMedia$1() {
2194
+ return MEDIA_QUERY_CACHE$1 || (MEDIA_QUERY_CACHE$1 = window.matchMedia("(prefers-color-scheme: dark)")), MEDIA_QUERY_CACHE$1;
2195
+ }
2196
+ function subscribe$2(onStoreChange) {
2197
+ const matchMedia = getMatchMedia$1();
2198
+ return matchMedia.addEventListener("change", onStoreChange), () => matchMedia.removeEventListener("change", onStoreChange);
2199
+ }
2200
+ function getSnapshot$1() {
2201
+ return getMatchMedia$1().matches;
2202
+ }
2203
+ function getServerSnapshot$1() {
2204
+ return !1;
2205
+ }
2206
+ function usePrefersDark() {
2207
+ return react.useSyncExternalStore(subscribe$2, getSnapshot$1, getServerSnapshot$1);
2208
+ }
2209
+ let MEDIA_QUERY_CACHE;
2210
+ function getMatchMedia() {
2211
+ return MEDIA_QUERY_CACHE || (MEDIA_QUERY_CACHE = window.matchMedia("(prefers-reduced-motion: reduce)")), MEDIA_QUERY_CACHE;
2212
+ }
2213
+ function subscribe$1(onStoreChange) {
2214
+ const matchMedia = getMatchMedia();
2215
+ return matchMedia.addEventListener("change", onStoreChange), () => matchMedia.removeEventListener("change", onStoreChange);
2216
+ }
2217
+ function getSnapshot() {
2218
+ return getMatchMedia().matches;
2219
+ }
2220
+ function getServerSnapshot() {
2221
+ return !1;
2222
+ }
2223
+ function usePrefersReducedMotion() {
2224
+ return react.useSyncExternalStore(subscribe$1, getSnapshot, getServerSnapshot);
2225
+ }
2226
+ function useForwardedRef(ref) {
2227
+ const innerRef = react.useRef(null);
2228
+ return react.useImperativeHandle(ref, () => innerRef.current), innerRef;
2229
+ }
2230
+ function useCustomValidity(ref, customValidity) {
2231
+ react.useEffect(() => {
2232
+ var _a;
2233
+ (_a = ref.current) == null || _a.setCustomValidity(customValidity || "");
2234
+ }, [customValidity, ref]);
2193
2235
  }
2194
- const Root$s = styledComponents.styled(Box)(responsiveBorderStyle, responsiveRadiusStyle, responsiveShadowStyle, cardStyle), Card = react.forwardRef(function(props, ref) {
2195
- const {
2196
- __unstable_checkered: checkered = !1,
2197
- __unstable_focusRing: focusRing = !1,
2198
- as: asProp,
2199
- border: border2,
2200
- borderTop: borderTop2,
2201
- borderRight: borderRight2,
2202
- borderBottom: borderBottom2,
2203
- borderLeft: borderLeft2,
2204
- muted,
2205
- pressed,
2206
- radius = 0,
2207
- scheme,
2208
- selected,
2209
- shadow,
2210
- tone: toneProp = "default",
2211
- ...restProps
2212
- } = props, as = ReactIs.isValidElementType(asProp) ? asProp : "div", rootTheme = useRootTheme(), tone = toneProp === "inherit" ? rootTheme.tone : toneProp;
2213
- return /* @__PURE__ */ jsxRuntime.jsx(ThemeColorProvider, { scheme, tone, children: /* @__PURE__ */ jsxRuntime.jsx(
2214
- Root$s,
2215
- {
2216
- "data-as": typeof as == "string" ? as : void 0,
2217
- "data-scheme": rootTheme.scheme,
2218
- "data-ui": "Card",
2219
- "data-tone": tone,
2220
- ...restProps,
2221
- $border: useArrayProp(border2),
2222
- $borderTop: useArrayProp(borderTop2),
2223
- $borderRight: useArrayProp(borderRight2),
2224
- $borderBottom: useArrayProp(borderBottom2),
2225
- $borderLeft: useArrayProp(borderLeft2),
2226
- $checkered: checkered,
2227
- $focusRing: focusRing,
2228
- $muted: muted,
2229
- $radius: useArrayProp(radius),
2230
- $shadow: useArrayProp(shadow),
2231
- $tone: tone,
2232
- "data-checkered": checkered ? "" : void 0,
2233
- "data-pressed": pressed ? "" : void 0,
2234
- "data-selected": selected ? "" : void 0,
2235
- forwardedAs: as,
2236
- ref,
2237
- selected
2238
- }
2239
- ) });
2240
- });
2241
2236
  function checkboxBaseStyles() {
2242
2237
  return styledComponents.css`
2243
2238
  position: relative;
@@ -2466,8 +2461,8 @@ function codeBaseStyle() {
2466
2461
  `;
2467
2462
  }
2468
2463
  const Root$q = styledComponents.styled.pre(codeBaseStyle, responsiveCodeFontStyle), Code = react.forwardRef(function(props, ref) {
2469
- const { children, language: languageProp, size: size2 = 2, weight, ...restProps } = props, language = typeof languageProp == "string" ? languageProp : void 0, registered = language ? Refractor__default.default.hasLanguage(language) : !1;
2470
- return /* @__PURE__ */ jsxRuntime.jsxs(Root$q, { "data-ui": "Code", ...restProps, $size: useArrayProp(size2), $weight: weight, ref, children: [
2464
+ const { children, language: languageProp, size: size2 = 2, weight, ...restProps } = props, language = typeof languageProp == "string" ? languageProp : void 0, registered = language ? Refractor__default.default.hasLanguage(language) : !1, $size = react.useMemo(() => _getArrayProp(size2), [size2]);
2465
+ return /* @__PURE__ */ jsxRuntime.jsxs(Root$q, { "data-ui": "Code", ...restProps, $size, $weight: weight, ref, children: [
2471
2466
  !(language && registered) && /* @__PURE__ */ jsxRuntime.jsx("code", { children }),
2472
2467
  language && registered && /* @__PURE__ */ jsxRuntime.jsx(Refractor__default.default, { inline: !0, language, value: String(children) })
2473
2468
  ] });
@@ -2488,33 +2483,24 @@ const Root$p = styledComponents.styled(Box)(
2488
2483
  containerBaseStyle,
2489
2484
  responsiveContainerWidthStyle
2490
2485
  ), Container = react.forwardRef(function(props, ref) {
2491
- const { as, width = 2, ...restProps } = props;
2492
- return /* @__PURE__ */ jsxRuntime.jsx(
2493
- Root$p,
2494
- {
2495
- "data-ui": "Container",
2496
- ...restProps,
2497
- $width: useArrayProp(width),
2498
- forwardedAs: as,
2499
- ref
2500
- }
2501
- );
2486
+ const { as, width = 2, ...restProps } = props, $width = react.useMemo(() => _getArrayProp(width), [width]);
2487
+ return /* @__PURE__ */ jsxRuntime.jsx(Root$p, { "data-ui": "Container", ...restProps, $width, forwardedAs: as, ref });
2502
2488
  }), Root$o = styledComponents.styled(Box)(responsiveGridStyle), Grid = react.forwardRef(function(props, ref) {
2503
- const { as, autoRows, autoCols, autoFlow, columns, gap, gapX, gapY, rows, children, ...restProps } = props;
2489
+ const { as, autoRows, autoCols, autoFlow, columns, gap, gapX, gapY, rows, children, ...restProps } = props, $autoRows = react.useMemo(() => _getArrayProp(autoRows), [autoRows]), $autoCols = react.useMemo(() => _getArrayProp(autoCols), [autoCols]), $autoFlow = react.useMemo(() => _getArrayProp(autoFlow), [autoFlow]), $columns = react.useMemo(() => _getArrayProp(columns), [columns]), $gap = react.useMemo(() => _getArrayProp(gap), [gap]), $gapX = react.useMemo(() => _getArrayProp(gapX), [gapX]), $gapY = react.useMemo(() => _getArrayProp(gapY), [gapY]), $rows = react.useMemo(() => _getArrayProp(rows), [rows]);
2504
2490
  return /* @__PURE__ */ jsxRuntime.jsx(
2505
2491
  Root$o,
2506
2492
  {
2507
2493
  "data-as": typeof as == "string" ? as : void 0,
2508
2494
  "data-ui": "Grid",
2509
2495
  ...restProps,
2510
- $autoRows: useArrayProp(autoRows),
2511
- $autoCols: useArrayProp(autoCols),
2512
- $autoFlow: useArrayProp(autoFlow),
2513
- $columns: useArrayProp(columns),
2514
- $gap: useArrayProp(gap),
2515
- $gapX: useArrayProp(gapX),
2516
- $gapY: useArrayProp(gapY),
2517
- $rows: useArrayProp(rows),
2496
+ $autoRows,
2497
+ $autoCols,
2498
+ $autoFlow,
2499
+ $columns,
2500
+ $gap,
2501
+ $gapX,
2502
+ $gapY,
2503
+ $rows,
2518
2504
  forwardedAs: as,
2519
2505
  ref,
2520
2506
  children
@@ -2591,7 +2577,7 @@ const Root$n = styledComponents.styled.div(headingBaseStyle, responsiveTextAlign
2591
2577
  textOverflow,
2592
2578
  weight,
2593
2579
  ...restProps
2594
- } = props;
2580
+ } = props, $size = react.useMemo(() => _getArrayProp(size2), [size2]), $align = react.useMemo(() => _getArrayProp(align), [align]);
2595
2581
  let children = childrenProp;
2596
2582
  return textOverflow === "ellipsis" && (children = /* @__PURE__ */ jsxRuntime.jsx(SpanWithTextOverflow, { children })), /* @__PURE__ */ jsxRuntime.jsx(
2597
2583
  Root$n,
@@ -2599,9 +2585,9 @@ const Root$n = styledComponents.styled.div(headingBaseStyle, responsiveTextAlign
2599
2585
  "data-ui": "Heading",
2600
2586
  ...restProps,
2601
2587
  $accent: accent,
2602
- $align: useArrayProp(align),
2588
+ $align,
2589
+ $size,
2603
2590
  $muted: muted,
2604
- $size: useArrayProp(size2),
2605
2591
  $weight: weight,
2606
2592
  ref,
2607
2593
  children: /* @__PURE__ */ jsxRuntime.jsx("span", { children })
@@ -2631,7 +2617,7 @@ function inlineSpaceStyle(props) {
2631
2617
  });
2632
2618
  }
2633
2619
  const Root$m = styledComponents.styled(Box)(inlineBaseStyle, inlineSpaceStyle), Inline = react.forwardRef(function(props, ref) {
2634
- const { as, children: childrenProp, space, ...restProps } = props, children = react.useMemo(
2620
+ const { as, children: childrenProp, space, ...restProps } = props, $space = react.useMemo(() => _getArrayProp(space), [space]), children = react.useMemo(
2635
2621
  () => react.Children.map(childrenProp, (child) => child && /* @__PURE__ */ jsxRuntime.jsx("div", { children: child })),
2636
2622
  [childrenProp]
2637
2623
  );
@@ -2640,7 +2626,7 @@ const Root$m = styledComponents.styled(Box)(inlineBaseStyle, inlineSpaceStyle),
2640
2626
  {
2641
2627
  "data-ui": "Inline",
2642
2628
  ...restProps,
2643
- $space: useArrayProp(space),
2629
+ $space,
2644
2630
  forwardedAs: as,
2645
2631
  ref,
2646
2632
  children
@@ -2665,8 +2651,8 @@ function kbdStyle() {
2665
2651
  `;
2666
2652
  }
2667
2653
  const Root$l = styledComponents.styled.kbd(responsiveRadiusStyle, kbdStyle), KBD = react.forwardRef(function(props, ref) {
2668
- const { children, fontSize: fontSize2 = 0, padding = 1, radius = 2, ...restProps } = props;
2669
- return /* @__PURE__ */ jsxRuntime.jsx(Root$l, { "data-ui": "KBD", ...restProps, $radius: useArrayProp(radius), ref, children: /* @__PURE__ */ jsxRuntime.jsx(Box, { as: "span", padding, children: /* @__PURE__ */ jsxRuntime.jsx(Text, { as: "span", size: fontSize2, weight: "semibold", children }) }) });
2654
+ const { children, fontSize: fontSize2 = 0, padding = 1, radius = 2, ...restProps } = props, $radius = react.useMemo(() => _getArrayProp(radius), [radius]);
2655
+ return /* @__PURE__ */ jsxRuntime.jsx(Root$l, { "data-ui": "KBD", ...restProps, $radius, ref, children: /* @__PURE__ */ jsxRuntime.jsx(Box, { as: "span", padding, children: /* @__PURE__ */ jsxRuntime.jsx(Text, { as: "span", size: fontSize2, weight: "semibold", children }) }) });
2670
2656
  }), origin = {
2671
2657
  name: "@sanity/ui/origin",
2672
2658
  fn({ middlewareData, placement, rects }) {
@@ -2986,7 +2972,7 @@ function _isScrollable(el) {
2986
2972
  }
2987
2973
  function LayerProvider(props) {
2988
2974
  var _a;
2989
- const { children, zOffset: zOffsetProp = 0 } = props, parentContextValue = react.useContext(LayerContext), parent = parentContextValue && getLayerContext(parentContextValue), parentRegisterChild = parent == null ? void 0 : parent.registerChild, level = ((_a = parent == null ? void 0 : parent.level) != null ? _a : 0) + 1, zOffset = useArrayProp(zOffsetProp), maxMediaIndex = zOffset.length - 1, mediaIndex = Math.min(useMediaIndex(), maxMediaIndex), zIndex = parent ? parent.zIndex + zOffset[mediaIndex] : zOffset[mediaIndex], [, setChildLayers] = react.useState({}), [size2, setSize] = react.useState(0), isTopLayer = size2 === 0, registerChild = react.useCallback(
2975
+ const { children, zOffset: zOffsetProp = 0 } = props, parentContextValue = react.useContext(LayerContext), parent = parentContextValue && getLayerContext(parentContextValue), parentRegisterChild = parent == null ? void 0 : parent.registerChild, level = ((_a = parent == null ? void 0 : parent.level) != null ? _a : 0) + 1, zOffset = react.useMemo(() => _getArrayProp(zOffsetProp), [zOffsetProp]), maxMediaIndex = zOffset.length - 1, mediaIndex = Math.min(useMediaIndex(), maxMediaIndex), zIndex = parent ? parent.zIndex + zOffset[mediaIndex] : zOffset[mediaIndex], [, setChildLayers] = react.useState({}), [size2, setSize] = react.useState(0), isTopLayer = size2 === 0, registerChild = react.useCallback(
2990
2976
  (childLevel) => {
2991
2977
  const parentDispose = parentRegisterChild == null ? void 0 : parentRegisterChild(childLevel);
2992
2978
  return childLevel !== void 0 ? setChildLayers((state) => {
@@ -3315,7 +3301,7 @@ const Popover = react.memo(
3315
3301
  zOffset: zOffsetProp = layer.popover.zOffset,
3316
3302
  updateRef,
3317
3303
  ...restProps
3318
- } = props, animate = usePrefersReducedMotion() ? !1 : _animate, boundarySize = (_e = useElementSize(boundaryElement)) == null ? void 0 : _e.border, padding = useArrayProp(paddingProp), radius = useArrayProp(radiusProp), shadow = useArrayProp(shadowProp), widthArrayProp = useArrayProp(widthProp), zOffset = useArrayProp(zOffsetProp), ref = react.useRef(null), arrowRef = react.useRef(null), rootBoundary = "viewport";
3304
+ } = props, animate = usePrefersReducedMotion() ? !1 : _animate, boundarySize = (_e = useElementSize(boundaryElement)) == null ? void 0 : _e.border, padding = react.useMemo(() => _getArrayProp(paddingProp), [paddingProp]), radius = react.useMemo(() => _getArrayProp(radiusProp), [radiusProp]), shadow = react.useMemo(() => _getArrayProp(shadowProp), [shadowProp]), widthArrayProp = react.useMemo(() => _getArrayProp(widthProp), [widthProp]), zOffset = react.useMemo(() => _getArrayProp(zOffsetProp), [zOffsetProp]), ref = react.useRef(null), arrowRef = react.useRef(null), rootBoundary = "viewport";
3319
3305
  react.useImperativeHandle(
3320
3306
  forwardedRef,
3321
3307
  () => ref.current
@@ -3741,20 +3727,22 @@ const selectStyle = {
3741
3727
  space = 3,
3742
3728
  ...restProps
3743
3729
  } = props, ref = react.useRef(null);
3744
- return react.useImperativeHandle(
3730
+ react.useImperativeHandle(
3745
3731
  forwardedRef,
3746
3732
  () => ref.current
3747
- ), useCustomValidity(ref, customValidity), /* @__PURE__ */ jsxRuntime.jsxs(Root$f, { "data-ui": "Select", children: [
3733
+ ), useCustomValidity(ref, customValidity);
3734
+ const $fontSize = react.useMemo(() => _getArrayProp(fontSize2), [fontSize2]), $padding = react.useMemo(() => _getArrayProp(padding), [padding]), $radius = react.useMemo(() => _getArrayProp(radius), [radius]), $space = react.useMemo(() => _getArrayProp(space), [space]);
3735
+ return /* @__PURE__ */ jsxRuntime.jsxs(Root$f, { "data-ui": "Select", children: [
3748
3736
  /* @__PURE__ */ jsxRuntime.jsx(
3749
3737
  Input$3,
3750
3738
  {
3751
3739
  "data-read-only": !disabled && readOnly ? "" : void 0,
3752
3740
  "data-ui": "Select",
3753
3741
  ...restProps,
3754
- $fontSize: useArrayProp(fontSize2),
3755
- $padding: useArrayProp(padding),
3756
- $radius: useArrayProp(radius),
3757
- $space: useArrayProp(space),
3742
+ $fontSize,
3743
+ $padding,
3744
+ $radius,
3745
+ $space,
3758
3746
  disabled: disabled || readOnly,
3759
3747
  ref,
3760
3748
  children
@@ -3782,14 +3770,14 @@ function responsiveStackSpaceStyle(props) {
3782
3770
  }));
3783
3771
  }
3784
3772
  const Root$e = styledComponents.styled(Box)(stackBaseStyle, responsiveStackSpaceStyle), Stack = react.forwardRef(function(props, ref) {
3785
- const { as, space, ...restProps } = props;
3773
+ const { as, space, ...restProps } = props, $space = react.useMemo(() => _getArrayProp(space), [space]);
3786
3774
  return /* @__PURE__ */ jsxRuntime.jsx(
3787
3775
  Root$e,
3788
3776
  {
3789
3777
  "data-as": typeof as == "string" ? as : void 0,
3790
3778
  "data-ui": "Stack",
3791
3779
  ...restProps,
3792
- $space: useArrayProp(space),
3780
+ $space,
3793
3781
  forwardedAs: as,
3794
3782
  ref
3795
3783
  }
@@ -3984,10 +3972,12 @@ const Root$d = styledComponents.styled.span(switchBaseStyles), Input$2 = styledC
3984
3972
  weight,
3985
3973
  ...restProps
3986
3974
  } = props, ref = react.useRef(null), rootTheme = useRootTheme();
3987
- return react.useImperativeHandle(
3975
+ react.useImperativeHandle(
3988
3976
  forwardedRef,
3989
3977
  () => ref.current
3990
- ), useCustomValidity(ref, customValidity), /* @__PURE__ */ jsxRuntime.jsx(Root$c, { "data-ui": "TextArea", children: /* @__PURE__ */ jsxRuntime.jsxs(InputRoot$1, { children: [
3978
+ ), useCustomValidity(ref, customValidity);
3979
+ const $radius = react.useMemo(() => _getArrayProp(radius), [radius]), $fontSize = react.useMemo(() => _getArrayProp(fontSize2), [fontSize2]), $padding = react.useMemo(() => _getArrayProp(padding), [padding]), $space = react.useMemo(() => _getArrayProp(0), []);
3980
+ return /* @__PURE__ */ jsxRuntime.jsx(Root$c, { "data-ui": "TextArea", children: /* @__PURE__ */ jsxRuntime.jsxs(InputRoot$1, { children: [
3991
3981
  /* @__PURE__ */ jsxRuntime.jsx(
3992
3982
  Input$1,
3993
3983
  {
@@ -3995,10 +3985,10 @@ const Root$d = styledComponents.styled.span(switchBaseStyles), Input$2 = styledC
3995
3985
  "data-scheme": rootTheme.scheme,
3996
3986
  "data-tone": rootTheme.tone,
3997
3987
  ...restProps,
3998
- $fontSize: useArrayProp(fontSize2),
3999
- $padding: useArrayProp(padding),
3988
+ $fontSize,
3989
+ $padding,
3990
+ $space,
4000
3991
  $scheme: rootTheme.scheme,
4001
- $space: useArrayProp(0),
4002
3992
  $tone: rootTheme.tone,
4003
3993
  $weight: weight,
4004
3994
  disabled,
@@ -4008,7 +3998,7 @@ const Root$d = styledComponents.styled.span(switchBaseStyles), Input$2 = styledC
4008
3998
  /* @__PURE__ */ jsxRuntime.jsx(
4009
3999
  Presentation$1,
4010
4000
  {
4011
- $radius: useArrayProp(radius),
4001
+ $radius,
4012
4002
  $scheme: rootTheme.scheme,
4013
4003
  $tone: rootTheme.tone,
4014
4004
  "data-border": border2 ? "" : void 0,
@@ -4082,7 +4072,7 @@ const Root$d = styledComponents.styled.span(switchBaseStyles), Input$2 = styledC
4082
4072
  type = "text",
4083
4073
  weight,
4084
4074
  ...restProps
4085
- } = props, ref = react.useRef(null), rootTheme = useRootTheme(), fontSize2 = useArrayProp(fontSizeProp), padding = useArrayProp(paddingProp), radius = useArrayProp(radiusProp), space = useArrayProp(spaceProp), $hasClearButton = !!clearButton, $hasIcon = !!IconComponent, $hasIconRight = !!IconRightComponent, $hasSuffix = !!suffix, $hasPrefix = !!prefix;
4075
+ } = props, ref = react.useRef(null), rootTheme = useRootTheme(), fontSize2 = react.useMemo(() => _getArrayProp(fontSizeProp), [fontSizeProp]), padding = react.useMemo(() => _getArrayProp(paddingProp), [paddingProp]), radius = react.useMemo(() => _getArrayProp(radiusProp), [radiusProp]), space = react.useMemo(() => _getArrayProp(spaceProp), [spaceProp]), $hasClearButton = !!clearButton, $hasIcon = !!IconComponent, $hasIconRight = !!IconRightComponent, $hasSuffix = !!suffix, $hasPrefix = !!prefix;
4086
4076
  react.useImperativeHandle(
4087
4077
  forwardedRef,
4088
4078
  () => ref.current
@@ -4114,11 +4104,11 @@ const Root$d = styledComponents.styled.span(switchBaseStyles), Input$2 = styledC
4114
4104
  children: [
4115
4105
  IconComponent && /* @__PURE__ */ jsxRuntime.jsx(LeftBox, { padding, children: /* @__PURE__ */ jsxRuntime.jsxs(Text, { size: fontSize2, children: [
4116
4106
  react.isValidElement(IconComponent) && IconComponent,
4117
- ReactIs.isValidElementType(IconComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconComponent, {})
4107
+ reactIs.isValidElementType(IconComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconComponent, {})
4118
4108
  ] }) }),
4119
4109
  !$hasClearButton && IconRightComponent && /* @__PURE__ */ jsxRuntime.jsx(RightBox, { padding, children: /* @__PURE__ */ jsxRuntime.jsxs(Text, { size: fontSize2, children: [
4120
4110
  react.isValidElement(IconRightComponent) && IconRightComponent,
4121
- ReactIs.isValidElementType(IconRightComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconRightComponent, {})
4111
+ reactIs.isValidElementType(IconRightComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconRightComponent, {})
4122
4112
  ] }) })
4123
4113
  ]
4124
4114
  }
@@ -4352,7 +4342,10 @@ const Root$a = styledComponents.styled(Layer)`
4352
4342
  zOffset = layer.tooltip.zOffset,
4353
4343
  delay,
4354
4344
  ...restProps
4355
- } = props, animate = usePrefersReducedMotion() ? !1 : _animate, fallbackPlacements = useArrayProp(fallbackPlacementsProp), ref = react.useRef(null), [referenceElement, setReferenceElement] = react.useState(null), arrowRef = react.useRef(null), rootBoundary = "viewport";
4345
+ } = props, animate = usePrefersReducedMotion() ? !1 : _animate, fallbackPlacements = react.useMemo(
4346
+ () => _getArrayProp(fallbackPlacementsProp),
4347
+ [fallbackPlacementsProp]
4348
+ ), ref = react.useRef(null), [referenceElement, setReferenceElement] = react.useState(null), arrowRef = react.useRef(null), rootBoundary = "viewport";
4356
4349
  react.useImperativeHandle(forwardedRef, () => ref.current);
4357
4350
  const portal = usePortal(), portalElement = typeof portalProp == "string" ? ((_c = portal.elements) == null ? void 0 : _c[portalProp]) || null : portal.element, documentBodyOffsetWidth = react.useSyncExternalStore(
4358
4351
  emptySubscribe,
@@ -4467,9 +4460,7 @@ const Root$a = styledComponents.styled(Layer)`
4467
4460
  ref.current = node, refs.setFloating(node);
4468
4461
  },
4469
4462
  [refs]
4470
- ), childRef = react.useRef(null);
4471
- react.useImperativeHandle(childProp == null ? void 0 : childProp.ref, () => childRef.current);
4472
- const child = react.useMemo(() => childProp ? react.cloneElement(childProp, {
4463
+ ), childRef = react.useRef(null), child = react.useMemo(() => childProp ? react.cloneElement(childProp, {
4473
4464
  onBlur: handleBlur,
4474
4465
  onFocus: handleFocus,
4475
4466
  onMouseEnter: handleMouseEnter,
@@ -4643,7 +4634,7 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = [
4643
4634
  forwardedRef,
4644
4635
  () => inputElementRef.current
4645
4636
  );
4646
- const listBoxId = `${id}-listbox`, options = Array.isArray(optionsProp) ? optionsProp : EMPTY_ARRAY, padding = useArrayProp(paddingProp), currentOption = react.useMemo(
4637
+ const listBoxId = `${id}-listbox`, options = Array.isArray(optionsProp) ? optionsProp : EMPTY_ARRAY, padding = react.useMemo(() => _getArrayProp(paddingProp), [paddingProp]), currentOption = react.useMemo(
4647
4638
  () => value !== null ? options.find((o) => o.value === value) : void 0,
4648
4639
  [options, value]
4649
4640
  ), filteredOptions = react.useMemo(
@@ -4949,7 +4940,7 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = [
4949
4940
  appearance: none;
4950
4941
  margin: -4px;
4951
4942
  `, Breadcrumbs = react.forwardRef(function(props, ref) {
4952
- const { children, maxLength, separator, space: spaceRaw = 2, ...restProps } = props, space = useArrayProp(spaceRaw), [open, setOpen] = react.useState(!1), [expandElement, setExpandElement] = react.useState(null), [popoverElement, setPopoverElement] = react.useState(null), collapse = react.useCallback(() => setOpen(!1), []), expand = react.useCallback(() => setOpen(!0), []);
4943
+ const { children, maxLength, separator, space: spaceRaw = 2, ...restProps } = props, space = react.useMemo(() => _getArrayProp(spaceRaw), [spaceRaw]), [open, setOpen] = react.useState(!1), [expandElement, setExpandElement] = react.useState(null), [popoverElement, setPopoverElement] = react.useState(null), collapse = react.useCallback(() => setOpen(!1), []), expand = react.useCallback(() => setOpen(!0), []);
4953
4944
  useClickOutside(collapse, [expandElement, popoverElement]);
4954
4945
  const rawItems = react.useMemo(() => react.Children.toArray(children).filter(react.isValidElement), [children]), items = react.useMemo(() => {
4955
4946
  const len = rawItems.length;
@@ -5098,7 +5089,7 @@ const Root$7 = styledComponents.styled(Layer)(responsivePaddingStyle, dialogStyl
5098
5089
  scheme,
5099
5090
  shadow: shadowProp,
5100
5091
  width: widthProp
5101
- } = props, portal = usePortal(), portalElement = portalProp ? ((_a = portal.elements) == null ? void 0 : _a[portalProp]) || null : portal.element, boundaryElement = useBoundaryElement().element, radius = useArrayProp(radiusProp), shadow = useArrayProp(shadowProp), width = useArrayProp(widthProp), ref = react.useRef(null), [rootElement, setRootElement] = react.useState(null), contentRef = react.useRef(null), layer = useLayer(), { isTopLayer } = layer, labelId = `${id}_label`, showCloseButton = !!onClose && hideCloseButton === !1, showHeader = !!header || showCloseButton;
5092
+ } = props, portal = usePortal(), portalElement = portalProp ? ((_a = portal.elements) == null ? void 0 : _a[portalProp]) || null : portal.element, boundaryElement = useBoundaryElement().element, radius = react.useMemo(() => _getArrayProp(radiusProp), [radiusProp]), shadow = react.useMemo(() => _getArrayProp(shadowProp), [shadowProp]), width = react.useMemo(() => _getArrayProp(widthProp), [widthProp]), ref = react.useRef(null), [rootElement, setRootElement] = react.useState(null), contentRef = react.useRef(null), layer = useLayer(), { isTopLayer } = layer, labelId = `${id}_label`, showCloseButton = !!onClose && hideCloseButton === !1, showHeader = !!header || showCloseButton;
5102
5093
  react.useImperativeHandle(forwardedRef, () => ref.current), react.useImperativeHandle(
5103
5094
  forwardedContentRef,
5104
5095
  () => contentRef.current
@@ -5169,7 +5160,7 @@ const Root$7 = styledComponents.styled(Layer)(responsivePaddingStyle, dialogStyl
5169
5160
  zOffset: zOffsetProp = dialog.zOffset || layer.dialog.zOffset,
5170
5161
  animate: _animate = !1,
5171
5162
  ...restProps
5172
- } = props, animate = usePrefersReducedMotion() ? !1 : _animate, portal = usePortal(), portalElement = portalProp ? ((_a = portal.elements) == null ? void 0 : _a[portalProp]) || null : portal.element, boundaryElement = useBoundaryElement().element, cardRadius = useArrayProp(cardRadiusProp), padding = useArrayProp(paddingProp), position = useArrayProp(positionProp), width = useArrayProp(widthProp), zOffset = useArrayProp(zOffsetProp), preDivRef = react.useRef(null), postDivRef = react.useRef(null), cardRef = react.useRef(null), focusedElementRef = react.useRef(null), handleFocus = react.useCallback(
5163
+ } = props, animate = usePrefersReducedMotion() ? !1 : _animate, portal = usePortal(), portalElement = portalProp ? ((_a = portal.elements) == null ? void 0 : _a[portalProp]) || null : portal.element, boundaryElement = useBoundaryElement().element, cardRadius = react.useMemo(() => _getArrayProp(cardRadiusProp), [cardRadiusProp]), padding = react.useMemo(() => _getArrayProp(paddingProp), [paddingProp]), position = react.useMemo(() => _getArrayProp(positionProp), [positionProp]), width = react.useMemo(() => _getArrayProp(widthProp), [widthProp]), zOffset = react.useMemo(() => _getArrayProp(zOffsetProp), [zOffsetProp]), preDivRef = react.useRef(null), postDivRef = react.useRef(null), cardRef = react.useRef(null), focusedElementRef = react.useRef(null), handleFocus = react.useCallback(
5173
5164
  (event) => {
5174
5165
  onFocus == null || onFocus(event);
5175
5166
  const target = event.target, cardElement = cardRef.current;
@@ -5265,7 +5256,7 @@ const Root$6 = styledComponents.styled.kbd`
5265
5256
  display: block;
5266
5257
  }
5267
5258
  `, Hotkeys = react.forwardRef(function(props, ref) {
5268
- const { fontSize: fontSize2, keys, padding, radius, space: spaceProp = 0.5, ...restProps } = props, space = useArrayProp(spaceProp);
5259
+ const { fontSize: fontSize2, keys, padding, radius, space: spaceProp = 0.5, ...restProps } = props, space = react.useMemo(() => _getArrayProp(spaceProp), [spaceProp]);
5269
5260
  return !keys || keys.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {}) : /* @__PURE__ */ jsxRuntime.jsx(Root$6, { "data-ui": "Hotkeys", ...restProps, ref, children: /* @__PURE__ */ jsxRuntime.jsx(Inline, { as: "span", space, children: keys.map((key2, i) => /* @__PURE__ */ jsxRuntime.jsx(Key, { fontSize: fontSize2, padding, radius, children: key2 }, i)) }) });
5270
5261
  }), key$2 = Symbol.for("@sanity/ui/context/menu"), MenuContext = createGlobalScopedContext(key$2, null);
5271
5262
  function _isFocusable(element) {
@@ -5771,7 +5762,7 @@ function MenuGroup(props) {
5771
5762
  onClick,
5772
5763
  padding = 3,
5773
5764
  popover,
5774
- radius = 2,
5765
+ radius: radiusProp = 2,
5775
5766
  space = 3,
5776
5767
  text,
5777
5768
  tone = "default",
@@ -5784,7 +5775,7 @@ function MenuGroup(props) {
5784
5775
  onItemClick,
5785
5776
  onItemMouseEnter = menu.onMouseEnter,
5786
5777
  registerElement
5787
- } = menu, [rootElement, setRootElement] = react.useState(null), [open, setOpen] = react.useState(!1), shouldFocusRef = react.useRef(null), active = !!activeElement && activeElement === rootElement, [withinMenu, setWithinMenu] = react.useState(!1), handleMouseEnter = react.useCallback(
5778
+ } = menu, [rootElement, setRootElement] = react.useState(null), [open, setOpen] = react.useState(!1), shouldFocusRef = react.useRef(null), active = !!activeElement && activeElement === rootElement, [withinMenu, setWithinMenu] = react.useState(!1), radius = react.useMemo(() => _getArrayProp(radiusProp), [radiusProp]), handleMouseEnter = react.useCallback(
5788
5779
  (event) => {
5789
5780
  setWithinMenu(!1), onItemMouseEnter(event), setOpen(!0);
5790
5781
  },
@@ -5842,7 +5833,7 @@ function MenuGroup(props) {
5842
5833
  "aria-pressed": as === "button" ? withinMenu : void 0,
5843
5834
  "data-pressed": as !== "button" ? withinMenu : void 0,
5844
5835
  "data-selected": !withinMenu && active ? "" : void 0,
5845
- $radius: useArrayProp(radius),
5836
+ $radius: radius,
5846
5837
  $tone: tone,
5847
5838
  $scheme: scheme,
5848
5839
  onClick: handleClick,
@@ -5854,7 +5845,7 @@ function MenuGroup(props) {
5854
5845
  children: /* @__PURE__ */ jsxRuntime.jsxs(Flex, { gap: space, padding, children: [
5855
5846
  IconComponent && /* @__PURE__ */ jsxRuntime.jsxs(Text, { size: fontSize2, children: [
5856
5847
  react.isValidElement(IconComponent) && IconComponent,
5857
- ReactIs.isValidElementType(IconComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconComponent, {})
5848
+ reactIs.isValidElementType(IconComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconComponent, {})
5858
5849
  ] }),
5859
5850
  /* @__PURE__ */ jsxRuntime.jsx(Box, { flex: 1, children: /* @__PURE__ */ jsxRuntime.jsx(Text, { size: fontSize2, textOverflow: "ellipsis", weight: "medium", children: text }) }),
5860
5851
  /* @__PURE__ */ jsxRuntime.jsx(Text, { size: fontSize2, children: /* @__PURE__ */ jsxRuntime.jsx(icons.ChevronRightIcon, {}) })
@@ -5910,7 +5901,7 @@ const MenuItem = react.forwardRef(function(props, forwardedRef) {
5910
5901
  paddingLeft
5911
5902
  }),
5912
5903
  [padding, paddingX, paddingY, paddingTop, paddingRight, paddingBottom, paddingLeft]
5913
- ), hotkeysFontSize = useArrayProp(fontSize2).map((s) => s - 1), setRef = react.useCallback((el) => {
5904
+ ), hotkeysFontSize = react.useMemo(() => _getArrayProp(fontSize2).map((s) => s - 1), [fontSize2]), $radius = react.useMemo(() => _getArrayProp(radius), [radius]), $padding = react.useMemo(() => _getArrayProp(0), []), setRef = react.useCallback((el) => {
5914
5905
  ref.current = el, setRootElement(el);
5915
5906
  }, []);
5916
5907
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -5923,8 +5914,8 @@ const MenuItem = react.forwardRef(function(props, forwardedRef) {
5923
5914
  "data-selected": active ? "" : void 0,
5924
5915
  "data-disabled": disabled ? "" : void 0,
5925
5916
  forwardedAs: as,
5926
- $radius: useArrayProp(radius),
5927
- $padding: useArrayProp(0),
5917
+ $radius,
5918
+ $padding,
5928
5919
  $tone: disabled ? "default" : tone,
5929
5920
  $scheme: scheme,
5930
5921
  disabled,
@@ -5939,7 +5930,7 @@ const MenuItem = react.forwardRef(function(props, forwardedRef) {
5939
5930
  (IconComponent || text || IconRightComponent) && /* @__PURE__ */ jsxRuntime.jsxs(Flex, { as: "span", gap: space, align: "center", ...paddingProps, children: [
5940
5931
  IconComponent && /* @__PURE__ */ jsxRuntime.jsxs(Text, { size: fontSize2, children: [
5941
5932
  react.isValidElement(IconComponent) && IconComponent,
5942
- ReactIs.isValidElementType(IconComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconComponent, {})
5933
+ reactIs.isValidElementType(IconComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconComponent, {})
5943
5934
  ] }),
5944
5935
  text && /* @__PURE__ */ jsxRuntime.jsx(Box, { flex: 1, children: /* @__PURE__ */ jsxRuntime.jsx(Text, { size: fontSize2, textOverflow: "ellipsis", weight: "medium", children: text }) }),
5945
5936
  hotkeys && /* @__PURE__ */ jsxRuntime.jsx(
@@ -5952,7 +5943,7 @@ const MenuItem = react.forwardRef(function(props, forwardedRef) {
5952
5943
  ),
5953
5944
  IconRightComponent && /* @__PURE__ */ jsxRuntime.jsxs(Text, { size: fontSize2, children: [
5954
5945
  react.isValidElement(IconRightComponent) && IconRightComponent,
5955
- ReactIs.isValidElementType(IconRightComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconRightComponent, {})
5946
+ reactIs.isValidElementType(IconRightComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconRightComponent, {})
5956
5947
  ] })
5957
5948
  ] }),
5958
5949
  children && /* @__PURE__ */ jsxRuntime.jsx(Box, { as: "span", ...paddingProps, children })
@@ -6000,7 +5991,7 @@ const MenuItem = react.forwardRef(function(props, forwardedRef) {
6000
5991
  skeletonStyle
6001
5992
  ), Skeleton = react.forwardRef(function(props, ref) {
6002
5993
  const { animated = !1, delay, radius, ...restProps } = props, [visible, setVisible] = react.useState(!delay);
6003
- return react.useEffect(() => {
5994
+ react.useEffect(() => {
6004
5995
  if (!delay)
6005
5996
  return setVisible(!0);
6006
5997
  const timeout = setTimeout(() => {
@@ -6009,16 +6000,9 @@ const MenuItem = react.forwardRef(function(props, forwardedRef) {
6009
6000
  return () => {
6010
6001
  clearTimeout(timeout);
6011
6002
  };
6012
- }, [delay]), /* @__PURE__ */ jsxRuntime.jsx(
6013
- Root$4,
6014
- {
6015
- ...restProps,
6016
- $animated: animated,
6017
- $radius: useArrayProp(radius),
6018
- $visible: visible,
6019
- ref
6020
- }
6021
- );
6003
+ }, [delay]);
6004
+ const $radius = react.useMemo(() => _getArrayProp(radius), [radius]);
6005
+ return /* @__PURE__ */ jsxRuntime.jsx(Root$4, { ...restProps, $animated: animated, $radius, $visible: visible, ref });
6022
6006
  }), Root$3 = styledComponents.styled(Skeleton)((props) => {
6023
6007
  const { $size, $style } = props, { font, media } = theme.getTheme_v2(props.theme), fontStyle = font[$style];
6024
6008
  return _responsive(media, $size, (sizeIndex) => {
@@ -6026,16 +6010,16 @@ const MenuItem = react.forwardRef(function(props, forwardedRef) {
6026
6010
  return { height: fontSize2.lineHeight - fontSize2.ascenderHeight - fontSize2.descenderHeight };
6027
6011
  });
6028
6012
  }), TextSkeleton = react.forwardRef(function(props, ref) {
6029
- const { size: size2 = 2, ...restProps } = props, $size = useArrayProp(size2);
6013
+ const { size: size2 = 2, ...restProps } = props, $size = react.useMemo(() => _getArrayProp(size2), [size2]);
6030
6014
  return /* @__PURE__ */ jsxRuntime.jsx(Root$3, { ...restProps, $size, ref, $style: "text" });
6031
6015
  }), LabelSkeleton = react.forwardRef(function(props, ref) {
6032
- const { size: size2 = 2, ...restProps } = props, $size = useArrayProp(size2);
6016
+ const { size: size2 = 2, ...restProps } = props, $size = react.useMemo(() => _getArrayProp(size2), [size2]);
6033
6017
  return /* @__PURE__ */ jsxRuntime.jsx(Root$3, { ...restProps, $size, ref, $style: "label" });
6034
6018
  }), HeadingSkeleton = react.forwardRef(function(props, ref) {
6035
- const { size: size2 = 2, ...restProps } = props, $size = useArrayProp(size2);
6019
+ const { size: size2 = 2, ...restProps } = props, $size = react.useMemo(() => _getArrayProp(size2), [size2]);
6036
6020
  return /* @__PURE__ */ jsxRuntime.jsx(Root$3, { ...restProps, $size, ref, $style: "heading" });
6037
6021
  }), CodeSkeleton = react.forwardRef(function(props, ref) {
6038
- const { size: size2 = 2, ...restProps } = props, $size = useArrayProp(size2);
6022
+ const { size: size2 = 2, ...restProps } = props, $size = react.useMemo(() => _getArrayProp(size2), [size2]);
6039
6023
  return /* @__PURE__ */ jsxRuntime.jsx(Root$3, { ...restProps, $size, ref, $style: "code" });
6040
6024
  }), CustomButton = styledComponents.styled(Button)`
6041
6025
  max-width: 100%;