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

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 +1262 -1009
  2. package/dist/index.compiled.mjs.map +1 -1
  3. package/dist/index.d.mts +10 -0
  4. package/dist/index.d.ts +10 -0
  5. package/dist/index.esm.js +960 -979
  6. package/dist/index.esm.js.map +1 -1
  7. package/dist/index.js +965 -984
  8. package/dist/index.js.map +1 -1
  9. package/dist/index.mjs +960 -979
  10. package/dist/index.mjs.map +1 -1
  11. package/package.json +2 -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 -2
  43. package/src/core/theme/themeProvider.tsx +4 -6
  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,141 @@ 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 { children } = props, parentTheme = react.useContext(ThemeContext), scheme = (_a = props.scheme) != null ? _a : (parentTheme == null ? void 0 : parentTheme.scheme) || "light", rootTheme = (parentTheme == null ? void 0 : parentTheme.theme) || null, tone = (parentTheme == null ? void 0 : parentTheme.tone) || "default", themeContext = react.useMemo(() => rootTheme ? {
135
+ version: 0,
136
+ theme: rootTheme,
137
+ scheme,
138
+ tone
139
+ } : null, [rootTheme, scheme, tone]), theme$1 = react.useMemo(() => rootTheme ? theme.getScopedTheme(rootTheme, scheme, tone) : null, [scheme, rootTheme, tone]);
140
+ 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' });
141
+ }
142
+ function useRootTheme() {
143
+ const value = react.useContext(ThemeContext);
144
+ if (!value)
145
+ throw new Error("useRootTheme(): missing context value");
146
+ return value;
147
+ }
148
+ function ThemeColorProvider(props) {
149
+ const { children, scheme, tone } = props, root = useRootTheme();
150
+ return /* @__PURE__ */ jsxRuntime.jsx(ThemeProvider, { scheme: scheme || root.scheme, theme: root.theme, tone, children });
151
+ }
152
+ function useTheme() {
153
+ return styledComponents.useTheme();
154
+ }
155
+ function useTheme_v2() {
156
+ return theme.getTheme_v2(styledComponents.useTheme());
157
+ }
158
+ function responsiveBorderStyle() {
159
+ return [border, borderTop, borderRight, borderBottom, borderLeft];
160
+ }
161
+ function border(props) {
162
+ var _a, _b;
163
+ 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)`;
164
+ return _responsive(
165
+ media,
166
+ props.$border,
167
+ (value) => value ? { "&&": { border: borderStyle } } : { "&&": { border: 0 } }
127
168
  );
128
169
  }
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);
170
+ function borderTop(props) {
171
+ var _a, _b;
172
+ 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)`;
173
+ return _responsive(
174
+ media,
175
+ props.$borderTop,
176
+ (value) => value ? { "&&": { borderTop: borderStyle } } : { "&&": { borderTop: 0 } }
177
+ );
134
178
  }
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;
179
+ function borderRight(props) {
180
+ var _a, _b;
181
+ 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)`;
182
+ return _responsive(
183
+ media,
184
+ props.$borderRight,
185
+ (value) => value ? { "&&": { borderRight: borderStyle } } : { "&&": { borderRight: 0 } }
186
+ );
168
187
  }
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;
188
+ function borderBottom(props) {
189
+ var _a, _b;
190
+ 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)`;
191
+ return _responsive(
192
+ media,
193
+ props.$borderBottom,
194
+ (value) => value ? { "&&": { borderBottom: borderStyle } } : { "&&": { borderBottom: 0 } }
195
+ );
196
+ }
197
+ function borderLeft(props) {
198
+ var _a, _b;
199
+ 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)`;
200
+ return _responsive(
201
+ media,
202
+ props.$borderLeft,
203
+ (value) => value ? { "&&": { borderLeft: borderStyle } } : { "&&": { borderLeft: 0 } }
204
+ );
205
+ }
206
+ const BASE_STYLE$4 = {
207
+ '&[data-as="ul"],&[data-as="ol"]': {
208
+ listStyle: "none"
209
209
  }
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"
210
+ }, BOX_SIZING = {
211
+ content: "content-box",
212
+ border: "border-box"
213
+ }, BOX_HEIGHT = {
214
+ stretch: "stretch",
215
+ fill: "100%"
216
+ };
217
+ function boxStyle() {
218
+ return BASE_STYLE$4;
219
+ }
220
+ function responsiveBoxStyle() {
221
+ return [
222
+ responsiveBoxSizingStyle,
223
+ responsiveBoxHeightStyle,
224
+ responsiveBoxOverflowStyle,
225
+ responsiveBoxDisplayStyle
226
+ ];
227
+ }
228
+ function responsiveBoxDisplayStyle(props) {
229
+ const { media } = theme.getTheme_v2(props.theme);
230
+ return _responsive(media, props.$display, (display) => ({
231
+ "&:not([hidden])": { display }
232
+ }));
233
+ }
234
+ function responsiveBoxSizingStyle(props) {
235
+ const { media } = theme.getTheme_v2(props.theme);
236
+ return _responsive(media, props.$sizing, (sizing) => ({
237
+ boxSizing: BOX_SIZING[sizing]
238
+ }));
239
+ }
240
+ function responsiveBoxHeightStyle(props) {
241
+ const { media } = theme.getTheme_v2(props.theme);
242
+ return _responsive(media, props.$height, (height) => ({
243
+ height: BOX_HEIGHT[height]
244
+ }));
245
+ }
246
+ function responsiveBoxOverflowStyle(props) {
247
+ const { media } = theme.getTheme_v2(props.theme);
248
+ return _responsive(media, props.$overflow, (overflow) => ({
249
+ overflow
250
+ }));
251
+ }
252
+ const BASE_STYLE$3 = {
253
+ "&&:not([hidden])": {
254
+ display: "flex"
731
255
  }
732
256
  };
733
257
  function responsiveFlexStyle() {
@@ -1241,7 +765,7 @@ const Root$C = styledComponents.styled.div(responsiveLabelFont, responsiveTextAl
1241
765
  textOverflow,
1242
766
  weight,
1243
767
  ...restProps
1244
- } = props;
768
+ } = props, $size = react.useMemo(() => _getArrayProp(size2), [size2]), $align = react.useMemo(() => _getArrayProp(align), [align]);
1245
769
  let children = childrenProp;
1246
770
  return textOverflow === "ellipsis" ? children = /* @__PURE__ */ jsxRuntime.jsx(SpanWithTextOverflow$2, { children }) : children = /* @__PURE__ */ jsxRuntime.jsx("span", { children }), /* @__PURE__ */ jsxRuntime.jsx(
1247
771
  Root$C,
@@ -1249,9 +773,9 @@ const Root$C = styledComponents.styled.div(responsiveLabelFont, responsiveTextAl
1249
773
  "data-ui": "Label",
1250
774
  ...restProps,
1251
775
  $accent: accent,
1252
- $align: useArrayProp(align),
776
+ $align,
777
+ $size,
1253
778
  $muted: muted,
1254
- $size: useArrayProp(size2),
1255
779
  $weight: weight,
1256
780
  ref,
1257
781
  children
@@ -1410,7 +934,7 @@ const Root$B = styledComponents.styled.div(
1410
934
  status = "online",
1411
935
  size: sizeProp = 1,
1412
936
  ...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(
937
+ } = 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
938
  animateArrowFrom || arrowPositionProp || "inside"
1415
939
  ), [imageFailed, setImageFailed] = react.useState(!1), imageId = `avatar-image-${elementId}`;
1416
940
  react.useEffect(() => {
@@ -1520,7 +1044,7 @@ const Root$A = styledComponents.styled.div(
1520
1044
  _responsiveAvatarCounterSizeStyle,
1521
1045
  _avatarCounterBaseStyle
1522
1046
  ), AvatarCounter = react.forwardRef(function(props, ref) {
1523
- const { count, size: sizeProp = 1 } = props, size2 = useArrayProp(sizeProp), fontSize2 = react.useMemo(
1047
+ const { count, size: sizeProp = 1 } = props, size2 = react.useMemo(() => _getArrayProp(sizeProp), [sizeProp]), fontSize2 = react.useMemo(
1524
1048
  () => size2.map((s) => s === 1 ? 1 : s === 2 ? 3 : s === 3 ? 5 : 0),
1525
1049
  [size2]
1526
1050
  );
@@ -1559,7 +1083,7 @@ const Root$z = styledComponents.styled.div(responsiveAvatarStackSizeStyle, avata
1559
1083
  } = props, children = react.useMemo(
1560
1084
  () => react.Children.toArray(childrenProp).filter(react.isValidElement),
1561
1085
  [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;
1086
+ ), 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
1087
  return /* @__PURE__ */ jsxRuntime.jsxs(Root$z, { "data-ui": "AvatarStack", ...restProps, ref, $size: size2, children: [
1564
1088
  len === 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(AvatarCounter, { count: len, size: size2 }) }),
1565
1089
  len !== 0 && extraCount > 1 && /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(AvatarCounter, { count: extraCount, size: size2 }) }),
@@ -1601,38 +1125,38 @@ const Root$z = styledComponents.styled.div(responsiveAvatarStackSizeStyle, avata
1601
1125
  rowEnd,
1602
1126
  sizing,
1603
1127
  ...restProps
1604
- } = props;
1128
+ } = 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
1129
  return /* @__PURE__ */ jsxRuntime.jsx(
1606
1130
  Root$y,
1607
1131
  {
1608
1132
  "data-as": typeof asProp == "string" ? asProp : void 0,
1609
1133
  "data-ui": "Box",
1610
1134
  ...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),
1135
+ $column,
1136
+ $columnStart,
1137
+ $columnEnd,
1138
+ $display,
1139
+ $flex,
1140
+ $height,
1141
+ $margin,
1142
+ $marginX,
1143
+ $marginY,
1144
+ $marginTop,
1145
+ $marginRight,
1146
+ $marginBottom,
1147
+ $marginLeft,
1148
+ $overflow,
1149
+ $padding,
1150
+ $paddingX,
1151
+ $paddingY,
1152
+ $paddingTop,
1153
+ $paddingRight,
1154
+ $paddingBottom,
1155
+ $paddingLeft,
1156
+ $row,
1157
+ $rowStart,
1158
+ $rowEnd,
1159
+ $sizing,
1636
1160
  as: asProp,
1637
1161
  ref,
1638
1162
  children: props.children
@@ -1722,7 +1246,7 @@ const Root$x = styledComponents.styled.div(
1722
1246
  textOverflow,
1723
1247
  weight,
1724
1248
  ...restProps
1725
- } = props;
1249
+ } = props, $size = react.useMemo(() => _getArrayProp(size2), [size2]), $align = react.useMemo(() => _getArrayProp(align), [align]);
1726
1250
  let children = childrenProp;
1727
1251
  return textOverflow === "ellipsis" && (children = /* @__PURE__ */ jsxRuntime.jsx(SpanWithTextOverflow$1, { children })), /* @__PURE__ */ jsxRuntime.jsx(
1728
1252
  Root$x,
@@ -1730,10 +1254,10 @@ const Root$x = styledComponents.styled.div(
1730
1254
  "data-ui": "Text",
1731
1255
  ...restProps,
1732
1256
  $accent: accent,
1733
- $align: useArrayProp(align),
1257
+ $align,
1258
+ $size,
1734
1259
  $muted: muted,
1735
1260
  ref,
1736
- $size: useArrayProp(size2),
1737
1261
  $weight: weight,
1738
1262
  children: /* @__PURE__ */ jsxRuntime.jsx("span", { children })
1739
1263
  }
@@ -1765,15 +1289,15 @@ const Root$w = styledComponents.styled(Box)(
1765
1289
  radius = "full",
1766
1290
  tone = "default",
1767
1291
  ...restProps
1768
- } = props;
1292
+ } = props, $radius = react.useMemo(() => _getArrayProp(radius), [radius]), $padding = react.useMemo(() => _getArrayProp(padding), [padding]);
1769
1293
  return /* @__PURE__ */ jsxRuntime.jsx(
1770
1294
  Root$w,
1771
1295
  {
1772
1296
  "data-ui": "Badge",
1773
1297
  ...restProps,
1774
1298
  $tone: tone,
1775
- $radius: useArrayProp(radius),
1776
- padding: useArrayProp(padding),
1299
+ $radius,
1300
+ padding: $padding,
1777
1301
  ref,
1778
1302
  children: /* @__PURE__ */ jsxRuntime.jsx(Text, { size: fontSize2, children })
1779
1303
  }
@@ -1782,17 +1306,17 @@ const Root$w = styledComponents.styled(Box)(
1782
1306
  flexItemStyle,
1783
1307
  responsiveFlexStyle
1784
1308
  ), Flex = react.forwardRef(function(props, ref) {
1785
- const { align, as, direction = "row", gap, justify, wrap, ...restProps } = props;
1309
+ 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
1310
  return /* @__PURE__ */ jsxRuntime.jsx(
1787
1311
  Root$v,
1788
1312
  {
1789
1313
  "data-ui": "Flex",
1790
1314
  ...restProps,
1791
- $align: useArrayProp(align),
1792
- $direction: useArrayProp(direction),
1793
- $gap: useArrayProp(gap),
1794
- $justify: useArrayProp(justify),
1795
- $wrap: useArrayProp(wrap),
1315
+ $align,
1316
+ $direction,
1317
+ $gap,
1318
+ $justify,
1319
+ $wrap,
1796
1320
  forwardedAs: as,
1797
1321
  ref
1798
1322
  }
@@ -1966,278 +1490,744 @@ function buttonColorStyles(props) {
1966
1490
  },
1967
1491
  "&[data-selected]": _cardColorStyle(baseColor, color.pressed)
1968
1492
  }
1969
- },
1970
- (_a = style == null ? void 0 : style.button) == null ? void 0 : _a.root
1971
- ].filter(Boolean);
1493
+ },
1494
+ (_a = style == null ? void 0 : style.button) == null ? void 0 : _a.root
1495
+ ].filter(Boolean);
1496
+ }
1497
+ const Root$t = styledComponents.styled.button(responsiveRadiusStyle, buttonBaseStyles, buttonColorStyles), LoadingBox = styledComponents.styled.div`
1498
+ position: absolute;
1499
+ top: 0;
1500
+ left: 0;
1501
+ right: 0;
1502
+ bottom: 0;
1503
+ display: flex;
1504
+ align-items: center;
1505
+ justify-content: center;
1506
+ background-color: var(--card-bg-color);
1507
+ border-radius: inherit;
1508
+ z-index: 1;
1509
+ box-shadow: inherit;
1510
+ `, Button = react.forwardRef(function(props, ref) {
1511
+ const {
1512
+ children,
1513
+ disabled,
1514
+ fontSize: fontSize2 = 1,
1515
+ icon: IconComponent,
1516
+ iconRight: IconRightComponent,
1517
+ justify: justifyProp = "center",
1518
+ loading,
1519
+ mode = "default",
1520
+ padding: paddingProp = 3,
1521
+ paddingX: paddingXProp,
1522
+ paddingY: paddingYProp,
1523
+ paddingTop: paddingTopProp,
1524
+ paddingBottom: paddingBottomProp,
1525
+ paddingLeft: paddingLeftProp,
1526
+ paddingRight: paddingRightProp,
1527
+ radius: radiusProp = 2,
1528
+ selected,
1529
+ space: spaceProp = 3,
1530
+ text,
1531
+ textAlign,
1532
+ tone = "default",
1533
+ type = "button",
1534
+ muted = !1,
1535
+ width,
1536
+ ...restProps
1537
+ } = 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(
1538
+ () => ({
1539
+ // flex: 1,
1540
+ padding,
1541
+ paddingX,
1542
+ paddingY,
1543
+ paddingTop,
1544
+ paddingBottom,
1545
+ paddingLeft,
1546
+ paddingRight
1547
+ }),
1548
+ [padding, paddingX, paddingY, paddingTop, paddingBottom, paddingLeft, paddingRight]
1549
+ );
1550
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1551
+ Root$t,
1552
+ {
1553
+ "data-ui": "Button",
1554
+ ...restProps,
1555
+ $mode: mode,
1556
+ $radius: radius,
1557
+ $tone: tone,
1558
+ "data-disabled": !!(loading || disabled),
1559
+ "data-selected": selected ? "" : void 0,
1560
+ disabled: !!(loading || disabled),
1561
+ ref,
1562
+ type,
1563
+ $width: width,
1564
+ children: [
1565
+ !!loading && /* @__PURE__ */ jsxRuntime.jsx(LoadingBox, { children: /* @__PURE__ */ jsxRuntime.jsx(Spinner, {}) }),
1566
+ (IconComponent || text || IconRightComponent) && /* @__PURE__ */ jsxRuntime.jsx(Box, { as: "span", ...boxProps, children: /* @__PURE__ */ jsxRuntime.jsxs(Flex, { as: "span", justify, gap: space, children: [
1567
+ IconComponent && /* @__PURE__ */ jsxRuntime.jsxs(Text, { size: fontSize2, children: [
1568
+ react.isValidElement(IconComponent) && IconComponent,
1569
+ reactIs.isValidElementType(IconComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconComponent, {})
1570
+ ] }),
1571
+ text && /* @__PURE__ */ jsxRuntime.jsx(
1572
+ Text,
1573
+ {
1574
+ muted,
1575
+ align: textAlign,
1576
+ size: fontSize2,
1577
+ textOverflow: "ellipsis",
1578
+ weight: button.textWeight,
1579
+ children: text
1580
+ }
1581
+ ),
1582
+ IconRightComponent && /* @__PURE__ */ jsxRuntime.jsxs(Text, { size: fontSize2, children: [
1583
+ react.isValidElement(IconRightComponent) && IconRightComponent,
1584
+ reactIs.isValidElementType(IconRightComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconRightComponent, {})
1585
+ ] })
1586
+ ] }) }),
1587
+ children && /* @__PURE__ */ jsxRuntime.jsx(Box, { as: "span", ...boxProps, children })
1588
+ ]
1589
+ }
1590
+ );
1591
+ });
1592
+ function cardStyle(props) {
1593
+ return [cardBaseStyle(props), cardColorStyle(props)];
1594
+ }
1595
+ function cardBaseStyle(props) {
1596
+ const { $checkered } = props, { space } = theme.getTheme_v2(props.theme);
1597
+ return styledComponents.css`
1598
+ ${$checkered && styledComponents.css`
1599
+ background-size: ${space[3]}px ${space[3]}px;
1600
+ background-position: 50% 50%;
1601
+ background-image: var(--card-bg-image);
1602
+ `}
1603
+
1604
+ &[data-as='button'] {
1605
+ -webkit-font-smoothing: inherit;
1606
+ appearance: none;
1607
+ outline: none;
1608
+ font: inherit;
1609
+ text-align: inherit;
1610
+ border: 0;
1611
+ width: -moz-available;
1612
+ width: -webkit-fill-available;
1613
+ width: stretch;
1614
+ }
1615
+
1616
+ /* &:is(a) */
1617
+ &[data-as='a'] {
1618
+ outline: none;
1619
+ text-decoration: none;
1620
+ }
1621
+
1622
+ /* &:is(pre) */
1623
+ &[data-as='pre'] {
1624
+ font: inherit;
1625
+ }
1626
+ `;
1627
+ }
1628
+ function cardColorStyle(props) {
1629
+ var _a;
1630
+ const { $checkered, $focusRing, $muted } = props, { card, color, style } = theme.getTheme_v2(props.theme), border2 = { width: card.border.width, color: "var(--card-border-color)" };
1631
+ return styledComponents.css`
1632
+ color-scheme: ${color._dark ? "dark" : "light"};
1633
+
1634
+ ${_cardColorStyle(color, color, $checkered)}
1635
+
1636
+ background-color: ${$muted ? "var(--card-muted-bg-color)" : "var(--card-bg-color)"};
1637
+ color: var(--card-fg-color);
1638
+
1639
+ /* &:is(button) */
1640
+ &[data-as='button'] {
1641
+ --card-focus-ring-box-shadow: none;
1642
+
1643
+ cursor: default;
1644
+ box-shadow: var(--card-focus-ring-box-shadow);
1645
+
1646
+ &:disabled {
1647
+ ${_cardColorStyle(color, color.selectable.default.disabled, $checkered)}
1648
+ }
1649
+
1650
+ &:not(:disabled) {
1651
+ &[data-pressed] {
1652
+ ${_cardColorStyle(color, color.selectable.default.pressed, $checkered)}
1653
+ }
1654
+
1655
+ &[data-selected] {
1656
+ ${_cardColorStyle(color, color.selectable.default.selected, $checkered)}
1657
+ }
1658
+
1659
+ @media (hover: hover) {
1660
+ &:not([data-pressed]):not([data-selected]) {
1661
+ &[data-hovered],
1662
+ &:hover {
1663
+ ${_cardColorStyle(color, color.selectable.default.hovered, $checkered)}
1664
+ }
1665
+
1666
+ &:active {
1667
+ ${_cardColorStyle(color, color.selectable.default.pressed, $checkered)}
1668
+ }
1669
+ }
1670
+ }
1671
+
1672
+ &:focus-visible {
1673
+ --card-focus-ring-box-shadow: ${$focusRing ? focusRingStyle({ base: color, border: border2, focusRing: card.focusRing }) : void 0};
1674
+ }
1675
+ }
1676
+ }
1677
+
1678
+ /* &:is(a) */
1679
+ &[data-as='a'] {
1680
+ cursor: pointer;
1681
+ box-shadow: var(--card-focus-ring-box-shadow);
1682
+
1683
+ &[data-disabled] {
1684
+ ${_cardColorStyle(color, color.selectable.default.disabled, $checkered)}
1685
+ }
1686
+
1687
+ &:not([data-disabled]) {
1688
+ &[data-pressed] {
1689
+ ${_cardColorStyle(color, color.selectable.default.pressed, $checkered)}
1690
+ }
1691
+
1692
+ &[data-selected] {
1693
+ ${_cardColorStyle(color, color.selectable.default.selected, $checkered)}
1694
+ }
1695
+
1696
+ @media (hover: hover) {
1697
+ &:not([data-pressed]):not([data-selected]) {
1698
+ &[data-hovered],
1699
+ &:hover {
1700
+ ${_cardColorStyle(color, color.selectable.default.hovered, $checkered)}
1701
+ }
1702
+
1703
+ &:active {
1704
+ ${_cardColorStyle(color, color.selectable.default.pressed, $checkered)}
1705
+ }
1706
+ }
1707
+ }
1708
+
1709
+ &:focus-visible {
1710
+ --card-focus-ring-box-shadow: ${$focusRing ? focusRingStyle({ base: color, border: border2, focusRing: card.focusRing }) : void 0};
1711
+ }
1712
+ }
1713
+ }
1714
+
1715
+ ${(_a = style == null ? void 0 : style.card) == null ? void 0 : _a.root}
1716
+ `;
1972
1717
  }
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) {
1718
+ const Root$s = styledComponents.styled(Box)(responsiveBorderStyle, responsiveRadiusStyle, responsiveShadowStyle, cardStyle), Card = react.forwardRef(function(props, ref) {
1987
1719
  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,
1720
+ __unstable_checkered: checkered = !1,
1721
+ __unstable_focusRing: focusRing = !1,
1722
+ as: asProp,
1723
+ border: border2,
1724
+ borderTop: borderTop2,
1725
+ borderRight: borderRight2,
1726
+ borderBottom: borderBottom2,
1727
+ borderLeft: borderLeft2,
1728
+ muted,
1729
+ pressed,
1730
+ radius = 0,
1731
+ scheme,
2004
1732
  selected,
2005
- space: spaceProp = 3,
2006
- text,
2007
- textAlign,
2008
- tone = "default",
2009
- type = "button",
2010
- muted = !1,
2011
- width,
1733
+ shadow,
1734
+ tone: toneProp = "default",
2012
1735
  ...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,
1736
+ } = 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]);
1737
+ return /* @__PURE__ */ jsxRuntime.jsx(ThemeColorProvider, { scheme, tone, children: /* @__PURE__ */ jsxRuntime.jsx(
1738
+ Root$s,
2028
1739
  {
2029
- "data-ui": "Button",
1740
+ "data-as": typeof as == "string" ? as : void 0,
1741
+ "data-scheme": rootTheme.scheme,
1742
+ "data-ui": "Card",
1743
+ "data-tone": tone,
2030
1744
  ...restProps,
2031
- $mode: mode,
2032
- $radius: radius,
1745
+ $border,
1746
+ $borderTop,
1747
+ $borderRight,
1748
+ $borderBottom,
1749
+ $borderLeft,
1750
+ $radius,
1751
+ $shadow,
1752
+ $checkered: checkered,
1753
+ $focusRing: focusRing,
1754
+ $muted: muted,
2033
1755
  $tone: tone,
2034
- "data-disabled": !!(loading || disabled),
1756
+ "data-checkered": checkered ? "" : void 0,
1757
+ "data-pressed": pressed ? "" : void 0,
2035
1758
  "data-selected": selected ? "" : void 0,
2036
- disabled: !!(loading || disabled),
1759
+ forwardedAs: as,
2037
1760
  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
- ]
1761
+ selected
1762
+ }
1763
+ ) });
1764
+ });
1765
+ function useArrayProp(val, defaultVal) {
1766
+ return react.useMemo(() => _getArrayProp(val, defaultVal), [defaultVal, val]);
1767
+ }
1768
+ function _getElements(element, elementsArg) {
1769
+ const ret = [element];
1770
+ for (const el of elementsArg)
1771
+ Array.isArray(el) ? ret.push(...el) : ret.push(el);
1772
+ return ret.filter(Boolean);
1773
+ }
1774
+ function useClickOutside(listener, elementsArg = EMPTY_ARRAY, boundaryElement) {
1775
+ const [element, setElement] = react.useState(null), [elements, setElements] = react.useState(() => _getElements(element, elementsArg)), elementsRef = react.useRef(elements);
1776
+ return react.useEffect(() => {
1777
+ const prevElements = elementsRef.current, nextElements = _getElements(element, elementsArg);
1778
+ if (prevElements.length !== nextElements.length) {
1779
+ setElements(nextElements), elementsRef.current = nextElements;
1780
+ return;
1781
+ }
1782
+ for (const el of prevElements)
1783
+ if (!nextElements.includes(el)) {
1784
+ setElements(nextElements), elementsRef.current = nextElements;
1785
+ return;
1786
+ }
1787
+ for (const el of nextElements)
1788
+ if (!prevElements.includes(el)) {
1789
+ setElements(nextElements), elementsRef.current = nextElements;
1790
+ return;
1791
+ }
1792
+ }, [element, elementsArg]), react.useEffect(() => {
1793
+ if (!listener) return;
1794
+ const handleWindowMouseDown = (evt) => {
1795
+ const target = evt.target;
1796
+ if (target instanceof Node && !(boundaryElement && !boundaryElement.contains(target))) {
1797
+ for (const el of elements)
1798
+ if (target === el || el.contains(target))
1799
+ return;
1800
+ listener(evt);
1801
+ }
1802
+ };
1803
+ return window.addEventListener("mousedown", handleWindowMouseDown), () => {
1804
+ window.removeEventListener("mousedown", handleWindowMouseDown);
1805
+ };
1806
+ }, [boundaryElement, listener, elements]), setElement;
1807
+ }
1808
+ var resizeObservers = [], hasActiveObservations = function() {
1809
+ return resizeObservers.some(function(ro) {
1810
+ return ro.activeTargets.length > 0;
1811
+ });
1812
+ }, hasSkippedObservations = function() {
1813
+ return resizeObservers.some(function(ro) {
1814
+ return ro.skippedTargets.length > 0;
1815
+ });
1816
+ }, msg = "ResizeObserver loop completed with undelivered notifications.", deliverResizeLoopError = function() {
1817
+ var event;
1818
+ typeof ErrorEvent == "function" ? event = new ErrorEvent("error", {
1819
+ message: msg
1820
+ }) : (event = document.createEvent("Event"), event.initEvent("error", !1, !1), event.message = msg), window.dispatchEvent(event);
1821
+ }, ResizeObserverBoxOptions;
1822
+ (function(ResizeObserverBoxOptions2) {
1823
+ ResizeObserverBoxOptions2.BORDER_BOX = "border-box", ResizeObserverBoxOptions2.CONTENT_BOX = "content-box", ResizeObserverBoxOptions2.DEVICE_PIXEL_CONTENT_BOX = "device-pixel-content-box";
1824
+ })(ResizeObserverBoxOptions || (ResizeObserverBoxOptions = {}));
1825
+ var freeze = function(obj) {
1826
+ return Object.freeze(obj);
1827
+ }, ResizeObserverSize = /* @__PURE__ */ function() {
1828
+ function ResizeObserverSize2(inlineSize, blockSize) {
1829
+ this.inlineSize = inlineSize, this.blockSize = blockSize, freeze(this);
1830
+ }
1831
+ return ResizeObserverSize2;
1832
+ }(), DOMRectReadOnly = function() {
1833
+ function DOMRectReadOnly2(x, y, width, height) {
1834
+ 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);
1835
+ }
1836
+ return DOMRectReadOnly2.prototype.toJSON = function() {
1837
+ 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;
1838
+ return { x, y, top, right, bottom, left, width, height };
1839
+ }, DOMRectReadOnly2.fromRect = function(rectangle) {
1840
+ return new DOMRectReadOnly2(rectangle.x, rectangle.y, rectangle.width, rectangle.height);
1841
+ }, DOMRectReadOnly2;
1842
+ }(), isSVG = function(target) {
1843
+ return target instanceof SVGElement && "getBBox" in target;
1844
+ }, isHidden = function(target) {
1845
+ if (isSVG(target)) {
1846
+ var _a = target.getBBox(), width = _a.width, height = _a.height;
1847
+ return !width && !height;
1848
+ }
1849
+ var _b = target, offsetWidth = _b.offsetWidth, offsetHeight = _b.offsetHeight;
1850
+ return !(offsetWidth || offsetHeight || target.getClientRects().length);
1851
+ }, isElement = function(obj) {
1852
+ var _a;
1853
+ if (obj instanceof Element)
1854
+ return !0;
1855
+ var scope = (_a = obj == null ? void 0 : obj.ownerDocument) === null || _a === void 0 ? void 0 : _a.defaultView;
1856
+ return !!(scope && obj instanceof scope.Element);
1857
+ }, isReplacedElement = function(target) {
1858
+ switch (target.tagName) {
1859
+ case "INPUT":
1860
+ if (target.type !== "image")
1861
+ break;
1862
+ case "VIDEO":
1863
+ case "AUDIO":
1864
+ case "EMBED":
1865
+ case "OBJECT":
1866
+ case "CANVAS":
1867
+ case "IFRAME":
1868
+ case "IMG":
1869
+ return !0;
1870
+ }
1871
+ return !1;
1872
+ }, 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) {
1873
+ return parseFloat(pixel || "0");
1874
+ }, size$1 = function(inlineSize, blockSize, switchSizes) {
1875
+ 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);
1876
+ }, zeroBoxes = freeze({
1877
+ devicePixelContentBoxSize: size$1(),
1878
+ borderBoxSize: size$1(),
1879
+ contentBoxSize: size$1(),
1880
+ contentRect: new DOMRectReadOnly(0, 0, 0, 0)
1881
+ }), calculateBoxSizes = function(target, forceRecalculation) {
1882
+ if (forceRecalculation === void 0 && (forceRecalculation = !1), cache.has(target) && !forceRecalculation)
1883
+ return cache.get(target);
1884
+ if (isHidden(target))
1885
+ return cache.set(target, zeroBoxes), zeroBoxes;
1886
+ 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({
1887
+ devicePixelContentBoxSize: size$1(Math.round(contentWidth * devicePixelRatio), Math.round(contentHeight * devicePixelRatio), switchSizes),
1888
+ borderBoxSize: size$1(borderBoxWidth, borderBoxHeight, switchSizes),
1889
+ contentBoxSize: size$1(contentWidth, contentHeight, switchSizes),
1890
+ contentRect: new DOMRectReadOnly(paddingLeft, paddingTop, contentWidth, contentHeight)
1891
+ });
1892
+ return cache.set(target, boxes), boxes;
1893
+ }, calculateBoxSize = function(target, observedBox, forceRecalculation) {
1894
+ var _a = calculateBoxSizes(target, forceRecalculation), borderBoxSize = _a.borderBoxSize, contentBoxSize = _a.contentBoxSize, devicePixelContentBoxSize = _a.devicePixelContentBoxSize;
1895
+ switch (observedBox) {
1896
+ case ResizeObserverBoxOptions.DEVICE_PIXEL_CONTENT_BOX:
1897
+ return devicePixelContentBoxSize;
1898
+ case ResizeObserverBoxOptions.BORDER_BOX:
1899
+ return borderBoxSize;
1900
+ default:
1901
+ return contentBoxSize;
1902
+ }
1903
+ }, ResizeObserverEntry = /* @__PURE__ */ function() {
1904
+ function ResizeObserverEntry2(target) {
1905
+ var boxes = calculateBoxSizes(target);
1906
+ this.target = target, this.contentRect = boxes.contentRect, this.borderBoxSize = freeze([boxes.borderBoxSize]), this.contentBoxSize = freeze([boxes.contentBoxSize]), this.devicePixelContentBoxSize = freeze([boxes.devicePixelContentBoxSize]);
1907
+ }
1908
+ return ResizeObserverEntry2;
1909
+ }(), calculateDepthForNode = function(node) {
1910
+ if (isHidden(node))
1911
+ return 1 / 0;
1912
+ for (var depth = 0, parent = node.parentNode; parent; )
1913
+ depth += 1, parent = parent.parentNode;
1914
+ return depth;
1915
+ }, broadcastActiveObservations = function() {
1916
+ var shallowestDepth = 1 / 0, callbacks2 = [];
1917
+ resizeObservers.forEach(function(ro) {
1918
+ if (ro.activeTargets.length !== 0) {
1919
+ var entries = [];
1920
+ ro.activeTargets.forEach(function(ot) {
1921
+ var entry = new ResizeObserverEntry(ot.target), targetDepth = calculateDepthForNode(ot.target);
1922
+ entries.push(entry), ot.lastReportedSize = calculateBoxSize(ot.target, ot.observedBox), targetDepth < shallowestDepth && (shallowestDepth = targetDepth);
1923
+ }), callbacks2.push(function() {
1924
+ ro.callback.call(ro.observer, entries, ro.observer);
1925
+ }), ro.activeTargets.splice(0, ro.activeTargets.length);
2065
1926
  }
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;
1927
+ });
1928
+ for (var _i = 0, callbacks_1 = callbacks2; _i < callbacks_1.length; _i++) {
1929
+ var callback = callbacks_1[_i];
1930
+ callback();
1931
+ }
1932
+ return shallowestDepth;
1933
+ }, gatherActiveObservationsAtDepth = function(depth) {
1934
+ resizeObservers.forEach(function(ro) {
1935
+ ro.activeTargets.splice(0, ro.activeTargets.length), ro.skippedTargets.splice(0, ro.skippedTargets.length), ro.observationTargets.forEach(function(ot) {
1936
+ ot.isActive() && (calculateDepthForNode(ot.target) > depth ? ro.activeTargets.push(ot) : ro.skippedTargets.push(ot));
1937
+ });
1938
+ });
1939
+ }, process = function() {
1940
+ var depth = 0;
1941
+ for (gatherActiveObservationsAtDepth(depth); hasActiveObservations(); )
1942
+ depth = broadcastActiveObservations(), gatherActiveObservationsAtDepth(depth);
1943
+ return hasSkippedObservations() && deliverResizeLoopError(), depth > 0;
1944
+ }, trigger, callbacks = [], notify = function() {
1945
+ return callbacks.splice(0).forEach(function(cb) {
1946
+ return cb();
1947
+ });
1948
+ }, queueMicroTask = function(callback) {
1949
+ if (!trigger) {
1950
+ var toggle_1 = 0, el_1 = document.createTextNode(""), config = { characterData: !0 };
1951
+ new MutationObserver(function() {
1952
+ return notify();
1953
+ }).observe(el_1, config), trigger = function() {
1954
+ el_1.textContent = "".concat(toggle_1 ? toggle_1-- : toggle_1++);
1955
+ };
1956
+ }
1957
+ callbacks.push(callback), trigger();
1958
+ }, queueResizeObserver = function(cb) {
1959
+ queueMicroTask(function() {
1960
+ requestAnimationFrame(cb);
1961
+ });
1962
+ }, watching = 0, isWatching = function() {
1963
+ return !!watching;
1964
+ }, CATCH_PERIOD = 250, observerConfig = { attributes: !0, characterData: !0, childList: !0, subtree: !0 }, events = [
1965
+ "resize",
1966
+ "load",
1967
+ "transitionend",
1968
+ "animationend",
1969
+ "animationstart",
1970
+ "animationiteration",
1971
+ "keyup",
1972
+ "keydown",
1973
+ "mouseup",
1974
+ "mousedown",
1975
+ "mouseover",
1976
+ "mouseout",
1977
+ "blur",
1978
+ "focus"
1979
+ ], time = function(timeout) {
1980
+ return timeout === void 0 && (timeout = 0), Date.now() + timeout;
1981
+ }, scheduled = !1, Scheduler = function() {
1982
+ function Scheduler2() {
1983
+ var _this = this;
1984
+ this.stopped = !0, this.listener = function() {
1985
+ return _this.schedule();
1986
+ };
1987
+ }
1988
+ return Scheduler2.prototype.run = function(timeout) {
1989
+ var _this = this;
1990
+ if (timeout === void 0 && (timeout = CATCH_PERIOD), !scheduled) {
1991
+ scheduled = !0;
1992
+ var until = time(timeout);
1993
+ queueResizeObserver(function() {
1994
+ var elementsHaveResized = !1;
1995
+ try {
1996
+ elementsHaveResized = process();
1997
+ } finally {
1998
+ if (scheduled = !1, timeout = until - time(), !isWatching())
1999
+ return;
2000
+ elementsHaveResized ? _this.run(1e3) : timeout > 0 ? _this.run(timeout) : _this.start();
2001
+ }
2002
+ });
2090
2003
  }
2091
-
2092
- /* &:is(a) */
2093
- &[data-as='a'] {
2094
- outline: none;
2095
- text-decoration: none;
2004
+ }, Scheduler2.prototype.schedule = function() {
2005
+ this.stop(), this.run();
2006
+ }, Scheduler2.prototype.observe = function() {
2007
+ var _this = this, cb = function() {
2008
+ return _this.observer && _this.observer.observe(document.body, observerConfig);
2009
+ };
2010
+ document.body ? cb() : global$1.addEventListener("DOMContentLoaded", cb);
2011
+ }, Scheduler2.prototype.start = function() {
2012
+ var _this = this;
2013
+ this.stopped && (this.stopped = !1, this.observer = new MutationObserver(this.listener), this.observe(), events.forEach(function(name) {
2014
+ return global$1.addEventListener(name, _this.listener, !0);
2015
+ }));
2016
+ }, Scheduler2.prototype.stop = function() {
2017
+ var _this = this;
2018
+ this.stopped || (this.observer && this.observer.disconnect(), events.forEach(function(name) {
2019
+ return global$1.removeEventListener(name, _this.listener, !0);
2020
+ }), this.stopped = !0);
2021
+ }, Scheduler2;
2022
+ }(), scheduler = new Scheduler(), updateCount = function(n) {
2023
+ !watching && n > 0 && scheduler.start(), watching += n, !watching && scheduler.stop();
2024
+ }, skipNotifyOnElement = function(target) {
2025
+ return !isSVG(target) && !isReplacedElement(target) && getComputedStyle(target).display === "inline";
2026
+ }, ResizeObservation = function() {
2027
+ function ResizeObservation2(target, observedBox) {
2028
+ this.target = target, this.observedBox = observedBox || ResizeObserverBoxOptions.CONTENT_BOX, this.lastReportedSize = {
2029
+ inlineSize: 0,
2030
+ blockSize: 0
2031
+ };
2032
+ }
2033
+ return ResizeObservation2.prototype.isActive = function() {
2034
+ var size2 = calculateBoxSize(this.target, this.observedBox, !0);
2035
+ return skipNotifyOnElement(this.target) && (this.lastReportedSize = size2), this.lastReportedSize.inlineSize !== size2.inlineSize || this.lastReportedSize.blockSize !== size2.blockSize;
2036
+ }, ResizeObservation2;
2037
+ }(), ResizeObserverDetail = /* @__PURE__ */ function() {
2038
+ function ResizeObserverDetail2(resizeObserver, callback) {
2039
+ this.activeTargets = [], this.skippedTargets = [], this.observationTargets = [], this.observer = resizeObserver, this.callback = callback;
2040
+ }
2041
+ return ResizeObserverDetail2;
2042
+ }(), observerMap = /* @__PURE__ */ new WeakMap(), getObservationIndex = function(observationTargets, target) {
2043
+ for (var i = 0; i < observationTargets.length; i += 1)
2044
+ if (observationTargets[i].target === target)
2045
+ return i;
2046
+ return -1;
2047
+ }, ResizeObserverController = function() {
2048
+ function ResizeObserverController2() {
2049
+ }
2050
+ return ResizeObserverController2.connect = function(resizeObserver, callback) {
2051
+ var detail = new ResizeObserverDetail(resizeObserver, callback);
2052
+ observerMap.set(resizeObserver, detail);
2053
+ }, ResizeObserverController2.observe = function(resizeObserver, target, options) {
2054
+ var detail = observerMap.get(resizeObserver), firstObservation = detail.observationTargets.length === 0;
2055
+ getObservationIndex(detail.observationTargets, target) < 0 && (firstObservation && resizeObservers.push(detail), detail.observationTargets.push(new ResizeObservation(target, options && options.box)), updateCount(1), scheduler.schedule());
2056
+ }, ResizeObserverController2.unobserve = function(resizeObserver, target) {
2057
+ var detail = observerMap.get(resizeObserver), index = getObservationIndex(detail.observationTargets, target), lastObservation = detail.observationTargets.length === 1;
2058
+ index >= 0 && (lastObservation && resizeObservers.splice(resizeObservers.indexOf(detail), 1), detail.observationTargets.splice(index, 1), updateCount(-1));
2059
+ }, ResizeObserverController2.disconnect = function(resizeObserver) {
2060
+ var _this = this, detail = observerMap.get(resizeObserver);
2061
+ detail.observationTargets.slice().forEach(function(ot) {
2062
+ return _this.unobserve(resizeObserver, ot.target);
2063
+ }), detail.activeTargets.splice(0, detail.activeTargets.length);
2064
+ }, ResizeObserverController2;
2065
+ }(), ResizeObserver = function() {
2066
+ function ResizeObserver2(callback) {
2067
+ if (arguments.length === 0)
2068
+ throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");
2069
+ if (typeof callback != "function")
2070
+ throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");
2071
+ ResizeObserverController.connect(this, callback);
2072
+ }
2073
+ return ResizeObserver2.prototype.observe = function(target, options) {
2074
+ if (arguments.length === 0)
2075
+ throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");
2076
+ if (!isElement(target))
2077
+ throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");
2078
+ ResizeObserverController.observe(this, target, options);
2079
+ }, ResizeObserver2.prototype.unobserve = function(target) {
2080
+ if (arguments.length === 0)
2081
+ throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");
2082
+ if (!isElement(target))
2083
+ throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");
2084
+ ResizeObserverController.unobserve(this, target);
2085
+ }, ResizeObserver2.prototype.disconnect = function() {
2086
+ ResizeObserverController.disconnect(this);
2087
+ }, ResizeObserver2.toString = function() {
2088
+ return "function ResizeObserver () { [polyfill code] }";
2089
+ }, ResizeObserver2;
2090
+ }();
2091
+ const _ResizeObserver = typeof document < "u" && typeof window < "u" && window.ResizeObserver ? window.ResizeObserver : ResizeObserver, _elementSizeObserver = _createElementSizeObserver();
2092
+ function _createElementRectValueListener() {
2093
+ return {
2094
+ subscribe(element, subscriber) {
2095
+ const resizeObserver = new _ResizeObserver(([entry]) => {
2096
+ subscriber({
2097
+ _contentRect: entry.contentRect,
2098
+ border: {
2099
+ width: entry.borderBoxSize[0].inlineSize,
2100
+ height: entry.borderBoxSize[0].blockSize
2101
+ },
2102
+ content: {
2103
+ width: entry.contentRect.width,
2104
+ height: entry.contentRect.height
2105
+ }
2106
+ });
2107
+ });
2108
+ return resizeObserver.observe(element), () => {
2109
+ resizeObserver.unobserve(element), resizeObserver.disconnect();
2110
+ };
2096
2111
  }
2097
-
2098
- /* &:is(pre) */
2099
- &[data-as='pre'] {
2100
- font: inherit;
2112
+ };
2113
+ }
2114
+ function _createElementSizeObserver() {
2115
+ const disposeCache = /* @__PURE__ */ new WeakMap(), subscribersCache = /* @__PURE__ */ new WeakMap();
2116
+ return {
2117
+ subscribe(element, subscriber) {
2118
+ const subscribers = subscribersCache.get(element) || [];
2119
+ let dispose = disposeCache.get(element);
2120
+ return subscribersCache.has(element) || (subscribersCache.set(element, subscribers), dispose = _createElementRectValueListener().subscribe(element, (elementRect) => {
2121
+ for (const sub of subscribers)
2122
+ sub(elementRect);
2123
+ })), subscribers.push(subscriber), () => {
2124
+ const idx = subscribers.indexOf(subscriber);
2125
+ idx > -1 && subscribers.splice(idx, 1), subscribers.length === 0 && dispose && dispose();
2126
+ };
2101
2127
  }
2102
- `;
2128
+ };
2103
2129
  }
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
- }
2130
+ function useElementSize(element) {
2131
+ const [size2, setSize] = react.useState(null);
2132
+ return react.useEffect(() => {
2133
+ if (element)
2134
+ return _elementSizeObserver.subscribe(element, setSize);
2135
+ }, [element]), size2;
2136
+ }
2137
+ function useElementRect(element) {
2138
+ const elementSize = useElementSize(element);
2139
+ return (elementSize == null ? void 0 : elementSize._contentRect) || null;
2140
+ }
2141
+ function useGlobalKeyDown(onKeyDown) {
2142
+ return react.useEffect(() => (addEventListener("keydown", onKeyDown), () => removeEventListener("keydown", onKeyDown)), [onKeyDown]);
2143
+ }
2144
+ const MEDIA_STORE_CACHE = /* @__PURE__ */ new WeakMap();
2145
+ function _getMediaQuery(media, index) {
2146
+ 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)`;
2147
+ }
2148
+ function _createMediaStore(media) {
2149
+ const mediaLen = media.length;
2150
+ let sizes;
2151
+ const getSizes = () => {
2152
+ if (!sizes) {
2153
+ sizes = [];
2154
+ for (let index = mediaLen; index > -1; index -= 1) {
2155
+ const mediaQuery = _getMediaQuery(media, index);
2156
+ sizes.push({ index, mq: window.matchMedia(mediaQuery) });
2151
2157
  }
2152
2158
  }
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
- }
2159
+ return sizes;
2160
+ };
2161
+ return { getSnapshot: () => {
2162
+ for (const { index, mq } of getSizes())
2163
+ if (mq.matches) return index;
2164
+ return 0;
2165
+ }, subscribe: (onStoreChange) => {
2166
+ const disposeFns = [];
2167
+ for (const { mq } of getSizes()) {
2168
+ const handleChange = () => {
2169
+ mq.matches && onStoreChange();
2170
+ };
2171
+ mq.addEventListener("change", handleChange), disposeFns.push(() => mq.removeEventListener("change", handleChange));
2189
2172
  }
2190
-
2191
- ${(_a = style == null ? void 0 : style.card) == null ? void 0 : _a.root}
2192
- `;
2173
+ return () => {
2174
+ for (const disposeFn of disposeFns)
2175
+ disposeFn();
2176
+ };
2177
+ } };
2178
+ }
2179
+ function getServerSnapshot$2() {
2180
+ return 0;
2181
+ }
2182
+ function useMediaIndex() {
2183
+ const { media } = useTheme_v2();
2184
+ let store = MEDIA_STORE_CACHE.get(media);
2185
+ return store || (store = _createMediaStore(media), MEDIA_STORE_CACHE.set(media, store)), react.useSyncExternalStore(store.subscribe, store.getSnapshot, getServerSnapshot$2);
2186
+ }
2187
+ let MEDIA_QUERY_CACHE$1;
2188
+ function getMatchMedia$1() {
2189
+ return MEDIA_QUERY_CACHE$1 || (MEDIA_QUERY_CACHE$1 = window.matchMedia("(prefers-color-scheme: dark)")), MEDIA_QUERY_CACHE$1;
2190
+ }
2191
+ function subscribe$2(onStoreChange) {
2192
+ const matchMedia = getMatchMedia$1();
2193
+ return matchMedia.addEventListener("change", onStoreChange), () => matchMedia.removeEventListener("change", onStoreChange);
2194
+ }
2195
+ function getSnapshot$1() {
2196
+ return getMatchMedia$1().matches;
2197
+ }
2198
+ function getServerSnapshot$1() {
2199
+ return !1;
2200
+ }
2201
+ function usePrefersDark() {
2202
+ return react.useSyncExternalStore(subscribe$2, getSnapshot$1, getServerSnapshot$1);
2203
+ }
2204
+ let MEDIA_QUERY_CACHE;
2205
+ function getMatchMedia() {
2206
+ return MEDIA_QUERY_CACHE || (MEDIA_QUERY_CACHE = window.matchMedia("(prefers-reduced-motion: reduce)")), MEDIA_QUERY_CACHE;
2207
+ }
2208
+ function subscribe$1(onStoreChange) {
2209
+ const matchMedia = getMatchMedia();
2210
+ return matchMedia.addEventListener("change", onStoreChange), () => matchMedia.removeEventListener("change", onStoreChange);
2211
+ }
2212
+ function getSnapshot() {
2213
+ return getMatchMedia().matches;
2214
+ }
2215
+ function getServerSnapshot() {
2216
+ return !1;
2217
+ }
2218
+ function usePrefersReducedMotion() {
2219
+ return react.useSyncExternalStore(subscribe$1, getSnapshot, getServerSnapshot);
2220
+ }
2221
+ function useForwardedRef(ref) {
2222
+ const innerRef = react.useRef(null);
2223
+ return react.useImperativeHandle(ref, () => innerRef.current), innerRef;
2224
+ }
2225
+ function useCustomValidity(ref, customValidity) {
2226
+ react.useEffect(() => {
2227
+ var _a;
2228
+ (_a = ref.current) == null || _a.setCustomValidity(customValidity || "");
2229
+ }, [customValidity, ref]);
2193
2230
  }
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
2231
  function checkboxBaseStyles() {
2242
2232
  return styledComponents.css`
2243
2233
  position: relative;
@@ -2466,8 +2456,8 @@ function codeBaseStyle() {
2466
2456
  `;
2467
2457
  }
2468
2458
  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: [
2459
+ 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]);
2460
+ return /* @__PURE__ */ jsxRuntime.jsxs(Root$q, { "data-ui": "Code", ...restProps, $size, $weight: weight, ref, children: [
2471
2461
  !(language && registered) && /* @__PURE__ */ jsxRuntime.jsx("code", { children }),
2472
2462
  language && registered && /* @__PURE__ */ jsxRuntime.jsx(Refractor__default.default, { inline: !0, language, value: String(children) })
2473
2463
  ] });
@@ -2488,33 +2478,24 @@ const Root$p = styledComponents.styled(Box)(
2488
2478
  containerBaseStyle,
2489
2479
  responsiveContainerWidthStyle
2490
2480
  ), 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
- );
2481
+ const { as, width = 2, ...restProps } = props, $width = react.useMemo(() => _getArrayProp(width), [width]);
2482
+ return /* @__PURE__ */ jsxRuntime.jsx(Root$p, { "data-ui": "Container", ...restProps, $width, forwardedAs: as, ref });
2502
2483
  }), 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;
2484
+ 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
2485
  return /* @__PURE__ */ jsxRuntime.jsx(
2505
2486
  Root$o,
2506
2487
  {
2507
2488
  "data-as": typeof as == "string" ? as : void 0,
2508
2489
  "data-ui": "Grid",
2509
2490
  ...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),
2491
+ $autoRows,
2492
+ $autoCols,
2493
+ $autoFlow,
2494
+ $columns,
2495
+ $gap,
2496
+ $gapX,
2497
+ $gapY,
2498
+ $rows,
2518
2499
  forwardedAs: as,
2519
2500
  ref,
2520
2501
  children
@@ -2591,7 +2572,7 @@ const Root$n = styledComponents.styled.div(headingBaseStyle, responsiveTextAlign
2591
2572
  textOverflow,
2592
2573
  weight,
2593
2574
  ...restProps
2594
- } = props;
2575
+ } = props, $size = react.useMemo(() => _getArrayProp(size2), [size2]), $align = react.useMemo(() => _getArrayProp(align), [align]);
2595
2576
  let children = childrenProp;
2596
2577
  return textOverflow === "ellipsis" && (children = /* @__PURE__ */ jsxRuntime.jsx(SpanWithTextOverflow, { children })), /* @__PURE__ */ jsxRuntime.jsx(
2597
2578
  Root$n,
@@ -2599,9 +2580,9 @@ const Root$n = styledComponents.styled.div(headingBaseStyle, responsiveTextAlign
2599
2580
  "data-ui": "Heading",
2600
2581
  ...restProps,
2601
2582
  $accent: accent,
2602
- $align: useArrayProp(align),
2583
+ $align,
2584
+ $size,
2603
2585
  $muted: muted,
2604
- $size: useArrayProp(size2),
2605
2586
  $weight: weight,
2606
2587
  ref,
2607
2588
  children: /* @__PURE__ */ jsxRuntime.jsx("span", { children })
@@ -2631,7 +2612,7 @@ function inlineSpaceStyle(props) {
2631
2612
  });
2632
2613
  }
2633
2614
  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(
2615
+ const { as, children: childrenProp, space, ...restProps } = props, $space = react.useMemo(() => _getArrayProp(space), [space]), children = react.useMemo(
2635
2616
  () => react.Children.map(childrenProp, (child) => child && /* @__PURE__ */ jsxRuntime.jsx("div", { children: child })),
2636
2617
  [childrenProp]
2637
2618
  );
@@ -2640,7 +2621,7 @@ const Root$m = styledComponents.styled(Box)(inlineBaseStyle, inlineSpaceStyle),
2640
2621
  {
2641
2622
  "data-ui": "Inline",
2642
2623
  ...restProps,
2643
- $space: useArrayProp(space),
2624
+ $space,
2644
2625
  forwardedAs: as,
2645
2626
  ref,
2646
2627
  children
@@ -2665,8 +2646,8 @@ function kbdStyle() {
2665
2646
  `;
2666
2647
  }
2667
2648
  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 }) }) });
2649
+ const { children, fontSize: fontSize2 = 0, padding = 1, radius = 2, ...restProps } = props, $radius = react.useMemo(() => _getArrayProp(radius), [radius]);
2650
+ 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
2651
  }), origin = {
2671
2652
  name: "@sanity/ui/origin",
2672
2653
  fn({ middlewareData, placement, rects }) {
@@ -2986,7 +2967,7 @@ function _isScrollable(el) {
2986
2967
  }
2987
2968
  function LayerProvider(props) {
2988
2969
  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(
2970
+ 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
2971
  (childLevel) => {
2991
2972
  const parentDispose = parentRegisterChild == null ? void 0 : parentRegisterChild(childLevel);
2992
2973
  return childLevel !== void 0 ? setChildLayers((state) => {
@@ -3315,7 +3296,7 @@ const Popover = react.memo(
3315
3296
  zOffset: zOffsetProp = layer.popover.zOffset,
3316
3297
  updateRef,
3317
3298
  ...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";
3299
+ } = 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
3300
  react.useImperativeHandle(
3320
3301
  forwardedRef,
3321
3302
  () => ref.current
@@ -3741,20 +3722,22 @@ const selectStyle = {
3741
3722
  space = 3,
3742
3723
  ...restProps
3743
3724
  } = props, ref = react.useRef(null);
3744
- return react.useImperativeHandle(
3725
+ react.useImperativeHandle(
3745
3726
  forwardedRef,
3746
3727
  () => ref.current
3747
- ), useCustomValidity(ref, customValidity), /* @__PURE__ */ jsxRuntime.jsxs(Root$f, { "data-ui": "Select", children: [
3728
+ ), useCustomValidity(ref, customValidity);
3729
+ 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]);
3730
+ return /* @__PURE__ */ jsxRuntime.jsxs(Root$f, { "data-ui": "Select", children: [
3748
3731
  /* @__PURE__ */ jsxRuntime.jsx(
3749
3732
  Input$3,
3750
3733
  {
3751
3734
  "data-read-only": !disabled && readOnly ? "" : void 0,
3752
3735
  "data-ui": "Select",
3753
3736
  ...restProps,
3754
- $fontSize: useArrayProp(fontSize2),
3755
- $padding: useArrayProp(padding),
3756
- $radius: useArrayProp(radius),
3757
- $space: useArrayProp(space),
3737
+ $fontSize,
3738
+ $padding,
3739
+ $radius,
3740
+ $space,
3758
3741
  disabled: disabled || readOnly,
3759
3742
  ref,
3760
3743
  children
@@ -3782,14 +3765,14 @@ function responsiveStackSpaceStyle(props) {
3782
3765
  }));
3783
3766
  }
3784
3767
  const Root$e = styledComponents.styled(Box)(stackBaseStyle, responsiveStackSpaceStyle), Stack = react.forwardRef(function(props, ref) {
3785
- const { as, space, ...restProps } = props;
3768
+ const { as, space, ...restProps } = props, $space = react.useMemo(() => _getArrayProp(space), [space]);
3786
3769
  return /* @__PURE__ */ jsxRuntime.jsx(
3787
3770
  Root$e,
3788
3771
  {
3789
3772
  "data-as": typeof as == "string" ? as : void 0,
3790
3773
  "data-ui": "Stack",
3791
3774
  ...restProps,
3792
- $space: useArrayProp(space),
3775
+ $space,
3793
3776
  forwardedAs: as,
3794
3777
  ref
3795
3778
  }
@@ -3984,10 +3967,12 @@ const Root$d = styledComponents.styled.span(switchBaseStyles), Input$2 = styledC
3984
3967
  weight,
3985
3968
  ...restProps
3986
3969
  } = props, ref = react.useRef(null), rootTheme = useRootTheme();
3987
- return react.useImperativeHandle(
3970
+ react.useImperativeHandle(
3988
3971
  forwardedRef,
3989
3972
  () => ref.current
3990
- ), useCustomValidity(ref, customValidity), /* @__PURE__ */ jsxRuntime.jsx(Root$c, { "data-ui": "TextArea", children: /* @__PURE__ */ jsxRuntime.jsxs(InputRoot$1, { children: [
3973
+ ), useCustomValidity(ref, customValidity);
3974
+ const $radius = react.useMemo(() => _getArrayProp(radius), [radius]), $fontSize = react.useMemo(() => _getArrayProp(fontSize2), [fontSize2]), $padding = react.useMemo(() => _getArrayProp(padding), [padding]), $space = react.useMemo(() => _getArrayProp(0), []);
3975
+ return /* @__PURE__ */ jsxRuntime.jsx(Root$c, { "data-ui": "TextArea", children: /* @__PURE__ */ jsxRuntime.jsxs(InputRoot$1, { children: [
3991
3976
  /* @__PURE__ */ jsxRuntime.jsx(
3992
3977
  Input$1,
3993
3978
  {
@@ -3995,10 +3980,10 @@ const Root$d = styledComponents.styled.span(switchBaseStyles), Input$2 = styledC
3995
3980
  "data-scheme": rootTheme.scheme,
3996
3981
  "data-tone": rootTheme.tone,
3997
3982
  ...restProps,
3998
- $fontSize: useArrayProp(fontSize2),
3999
- $padding: useArrayProp(padding),
3983
+ $fontSize,
3984
+ $padding,
3985
+ $space,
4000
3986
  $scheme: rootTheme.scheme,
4001
- $space: useArrayProp(0),
4002
3987
  $tone: rootTheme.tone,
4003
3988
  $weight: weight,
4004
3989
  disabled,
@@ -4008,7 +3993,7 @@ const Root$d = styledComponents.styled.span(switchBaseStyles), Input$2 = styledC
4008
3993
  /* @__PURE__ */ jsxRuntime.jsx(
4009
3994
  Presentation$1,
4010
3995
  {
4011
- $radius: useArrayProp(radius),
3996
+ $radius,
4012
3997
  $scheme: rootTheme.scheme,
4013
3998
  $tone: rootTheme.tone,
4014
3999
  "data-border": border2 ? "" : void 0,
@@ -4082,7 +4067,7 @@ const Root$d = styledComponents.styled.span(switchBaseStyles), Input$2 = styledC
4082
4067
  type = "text",
4083
4068
  weight,
4084
4069
  ...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;
4070
+ } = 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
4071
  react.useImperativeHandle(
4087
4072
  forwardedRef,
4088
4073
  () => ref.current
@@ -4114,11 +4099,11 @@ const Root$d = styledComponents.styled.span(switchBaseStyles), Input$2 = styledC
4114
4099
  children: [
4115
4100
  IconComponent && /* @__PURE__ */ jsxRuntime.jsx(LeftBox, { padding, children: /* @__PURE__ */ jsxRuntime.jsxs(Text, { size: fontSize2, children: [
4116
4101
  react.isValidElement(IconComponent) && IconComponent,
4117
- ReactIs.isValidElementType(IconComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconComponent, {})
4102
+ reactIs.isValidElementType(IconComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconComponent, {})
4118
4103
  ] }) }),
4119
4104
  !$hasClearButton && IconRightComponent && /* @__PURE__ */ jsxRuntime.jsx(RightBox, { padding, children: /* @__PURE__ */ jsxRuntime.jsxs(Text, { size: fontSize2, children: [
4120
4105
  react.isValidElement(IconRightComponent) && IconRightComponent,
4121
- ReactIs.isValidElementType(IconRightComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconRightComponent, {})
4106
+ reactIs.isValidElementType(IconRightComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconRightComponent, {})
4122
4107
  ] }) })
4123
4108
  ]
4124
4109
  }
@@ -4352,7 +4337,10 @@ const Root$a = styledComponents.styled(Layer)`
4352
4337
  zOffset = layer.tooltip.zOffset,
4353
4338
  delay,
4354
4339
  ...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";
4340
+ } = props, animate = usePrefersReducedMotion() ? !1 : _animate, fallbackPlacements = react.useMemo(
4341
+ () => _getArrayProp(fallbackPlacementsProp),
4342
+ [fallbackPlacementsProp]
4343
+ ), ref = react.useRef(null), [referenceElement, setReferenceElement] = react.useState(null), arrowRef = react.useRef(null), rootBoundary = "viewport";
4356
4344
  react.useImperativeHandle(forwardedRef, () => ref.current);
4357
4345
  const portal = usePortal(), portalElement = typeof portalProp == "string" ? ((_c = portal.elements) == null ? void 0 : _c[portalProp]) || null : portal.element, documentBodyOffsetWidth = react.useSyncExternalStore(
4358
4346
  emptySubscribe,
@@ -4641,7 +4629,7 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = [
4641
4629
  forwardedRef,
4642
4630
  () => inputElementRef.current
4643
4631
  );
4644
- const listBoxId = `${id}-listbox`, options = Array.isArray(optionsProp) ? optionsProp : EMPTY_ARRAY, padding = useArrayProp(paddingProp), currentOption = react.useMemo(
4632
+ const listBoxId = `${id}-listbox`, options = Array.isArray(optionsProp) ? optionsProp : EMPTY_ARRAY, padding = react.useMemo(() => _getArrayProp(paddingProp), [paddingProp]), currentOption = react.useMemo(
4645
4633
  () => value !== null ? options.find((o) => o.value === value) : void 0,
4646
4634
  [options, value]
4647
4635
  ), filteredOptions = react.useMemo(
@@ -4947,7 +4935,7 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = [
4947
4935
  appearance: none;
4948
4936
  margin: -4px;
4949
4937
  `, Breadcrumbs = react.forwardRef(function(props, ref) {
4950
- 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), []);
4938
+ 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), []);
4951
4939
  useClickOutside(collapse, [expandElement, popoverElement]);
4952
4940
  const rawItems = react.useMemo(() => react.Children.toArray(children).filter(react.isValidElement), [children]), items = react.useMemo(() => {
4953
4941
  const len = rawItems.length;
@@ -5096,7 +5084,7 @@ const Root$7 = styledComponents.styled(Layer)(responsivePaddingStyle, dialogStyl
5096
5084
  scheme,
5097
5085
  shadow: shadowProp,
5098
5086
  width: widthProp
5099
- } = 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;
5087
+ } = 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;
5100
5088
  react.useImperativeHandle(forwardedRef, () => ref.current), react.useImperativeHandle(
5101
5089
  forwardedContentRef,
5102
5090
  () => contentRef.current
@@ -5167,7 +5155,7 @@ const Root$7 = styledComponents.styled(Layer)(responsivePaddingStyle, dialogStyl
5167
5155
  zOffset: zOffsetProp = dialog.zOffset || layer.dialog.zOffset,
5168
5156
  animate: _animate = !1,
5169
5157
  ...restProps
5170
- } = 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(
5158
+ } = 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(
5171
5159
  (event) => {
5172
5160
  onFocus == null || onFocus(event);
5173
5161
  const target = event.target, cardElement = cardRef.current;
@@ -5263,7 +5251,7 @@ const Root$6 = styledComponents.styled.kbd`
5263
5251
  display: block;
5264
5252
  }
5265
5253
  `, Hotkeys = react.forwardRef(function(props, ref) {
5266
- const { fontSize: fontSize2, keys, padding, radius, space: spaceProp = 0.5, ...restProps } = props, space = useArrayProp(spaceProp);
5254
+ const { fontSize: fontSize2, keys, padding, radius, space: spaceProp = 0.5, ...restProps } = props, space = react.useMemo(() => _getArrayProp(spaceProp), [spaceProp]);
5267
5255
  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)) }) });
5268
5256
  }), key$2 = Symbol.for("@sanity/ui/context/menu"), MenuContext = createGlobalScopedContext(key$2, null);
5269
5257
  function _isFocusable(element) {
@@ -5769,7 +5757,7 @@ function MenuGroup(props) {
5769
5757
  onClick,
5770
5758
  padding = 3,
5771
5759
  popover,
5772
- radius = 2,
5760
+ radius: radiusProp = 2,
5773
5761
  space = 3,
5774
5762
  text,
5775
5763
  tone = "default",
@@ -5782,7 +5770,7 @@ function MenuGroup(props) {
5782
5770
  onItemClick,
5783
5771
  onItemMouseEnter = menu.onMouseEnter,
5784
5772
  registerElement
5785
- } = 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(
5773
+ } = 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(
5786
5774
  (event) => {
5787
5775
  setWithinMenu(!1), onItemMouseEnter(event), setOpen(!0);
5788
5776
  },
@@ -5840,7 +5828,7 @@ function MenuGroup(props) {
5840
5828
  "aria-pressed": as === "button" ? withinMenu : void 0,
5841
5829
  "data-pressed": as !== "button" ? withinMenu : void 0,
5842
5830
  "data-selected": !withinMenu && active ? "" : void 0,
5843
- $radius: useArrayProp(radius),
5831
+ $radius: radius,
5844
5832
  $tone: tone,
5845
5833
  $scheme: scheme,
5846
5834
  onClick: handleClick,
@@ -5852,7 +5840,7 @@ function MenuGroup(props) {
5852
5840
  children: /* @__PURE__ */ jsxRuntime.jsxs(Flex, { gap: space, padding, children: [
5853
5841
  IconComponent && /* @__PURE__ */ jsxRuntime.jsxs(Text, { size: fontSize2, children: [
5854
5842
  react.isValidElement(IconComponent) && IconComponent,
5855
- ReactIs.isValidElementType(IconComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconComponent, {})
5843
+ reactIs.isValidElementType(IconComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconComponent, {})
5856
5844
  ] }),
5857
5845
  /* @__PURE__ */ jsxRuntime.jsx(Box, { flex: 1, children: /* @__PURE__ */ jsxRuntime.jsx(Text, { size: fontSize2, textOverflow: "ellipsis", weight: "medium", children: text }) }),
5858
5846
  /* @__PURE__ */ jsxRuntime.jsx(Text, { size: fontSize2, children: /* @__PURE__ */ jsxRuntime.jsx(icons.ChevronRightIcon, {}) })
@@ -5908,7 +5896,7 @@ const MenuItem = react.forwardRef(function(props, forwardedRef) {
5908
5896
  paddingLeft
5909
5897
  }),
5910
5898
  [padding, paddingX, paddingY, paddingTop, paddingRight, paddingBottom, paddingLeft]
5911
- ), hotkeysFontSize = useArrayProp(fontSize2).map((s) => s - 1), setRef = react.useCallback((el) => {
5899
+ ), 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) => {
5912
5900
  ref.current = el, setRootElement(el);
5913
5901
  }, []);
5914
5902
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -5921,8 +5909,8 @@ const MenuItem = react.forwardRef(function(props, forwardedRef) {
5921
5909
  "data-selected": active ? "" : void 0,
5922
5910
  "data-disabled": disabled ? "" : void 0,
5923
5911
  forwardedAs: as,
5924
- $radius: useArrayProp(radius),
5925
- $padding: useArrayProp(0),
5912
+ $radius,
5913
+ $padding,
5926
5914
  $tone: disabled ? "default" : tone,
5927
5915
  $scheme: scheme,
5928
5916
  disabled,
@@ -5937,7 +5925,7 @@ const MenuItem = react.forwardRef(function(props, forwardedRef) {
5937
5925
  (IconComponent || text || IconRightComponent) && /* @__PURE__ */ jsxRuntime.jsxs(Flex, { as: "span", gap: space, align: "center", ...paddingProps, children: [
5938
5926
  IconComponent && /* @__PURE__ */ jsxRuntime.jsxs(Text, { size: fontSize2, children: [
5939
5927
  react.isValidElement(IconComponent) && IconComponent,
5940
- ReactIs.isValidElementType(IconComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconComponent, {})
5928
+ reactIs.isValidElementType(IconComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconComponent, {})
5941
5929
  ] }),
5942
5930
  text && /* @__PURE__ */ jsxRuntime.jsx(Box, { flex: 1, children: /* @__PURE__ */ jsxRuntime.jsx(Text, { size: fontSize2, textOverflow: "ellipsis", weight: "medium", children: text }) }),
5943
5931
  hotkeys && /* @__PURE__ */ jsxRuntime.jsx(
@@ -5950,7 +5938,7 @@ const MenuItem = react.forwardRef(function(props, forwardedRef) {
5950
5938
  ),
5951
5939
  IconRightComponent && /* @__PURE__ */ jsxRuntime.jsxs(Text, { size: fontSize2, children: [
5952
5940
  react.isValidElement(IconRightComponent) && IconRightComponent,
5953
- ReactIs.isValidElementType(IconRightComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconRightComponent, {})
5941
+ reactIs.isValidElementType(IconRightComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconRightComponent, {})
5954
5942
  ] })
5955
5943
  ] }),
5956
5944
  children && /* @__PURE__ */ jsxRuntime.jsx(Box, { as: "span", ...paddingProps, children })
@@ -5998,7 +5986,7 @@ const MenuItem = react.forwardRef(function(props, forwardedRef) {
5998
5986
  skeletonStyle
5999
5987
  ), Skeleton = react.forwardRef(function(props, ref) {
6000
5988
  const { animated = !1, delay, radius, ...restProps } = props, [visible, setVisible] = react.useState(!delay);
6001
- return react.useEffect(() => {
5989
+ react.useEffect(() => {
6002
5990
  if (!delay)
6003
5991
  return setVisible(!0);
6004
5992
  const timeout = setTimeout(() => {
@@ -6007,16 +5995,9 @@ const MenuItem = react.forwardRef(function(props, forwardedRef) {
6007
5995
  return () => {
6008
5996
  clearTimeout(timeout);
6009
5997
  };
6010
- }, [delay]), /* @__PURE__ */ jsxRuntime.jsx(
6011
- Root$4,
6012
- {
6013
- ...restProps,
6014
- $animated: animated,
6015
- $radius: useArrayProp(radius),
6016
- $visible: visible,
6017
- ref
6018
- }
6019
- );
5998
+ }, [delay]);
5999
+ const $radius = react.useMemo(() => _getArrayProp(radius), [radius]);
6000
+ return /* @__PURE__ */ jsxRuntime.jsx(Root$4, { ...restProps, $animated: animated, $radius, $visible: visible, ref });
6020
6001
  }), Root$3 = styledComponents.styled(Skeleton)((props) => {
6021
6002
  const { $size, $style } = props, { font, media } = theme.getTheme_v2(props.theme), fontStyle = font[$style];
6022
6003
  return _responsive(media, $size, (sizeIndex) => {
@@ -6024,16 +6005,16 @@ const MenuItem = react.forwardRef(function(props, forwardedRef) {
6024
6005
  return { height: fontSize2.lineHeight - fontSize2.ascenderHeight - fontSize2.descenderHeight };
6025
6006
  });
6026
6007
  }), TextSkeleton = react.forwardRef(function(props, ref) {
6027
- const { size: size2 = 2, ...restProps } = props, $size = useArrayProp(size2);
6008
+ const { size: size2 = 2, ...restProps } = props, $size = react.useMemo(() => _getArrayProp(size2), [size2]);
6028
6009
  return /* @__PURE__ */ jsxRuntime.jsx(Root$3, { ...restProps, $size, ref, $style: "text" });
6029
6010
  }), LabelSkeleton = react.forwardRef(function(props, ref) {
6030
- const { size: size2 = 2, ...restProps } = props, $size = useArrayProp(size2);
6011
+ const { size: size2 = 2, ...restProps } = props, $size = react.useMemo(() => _getArrayProp(size2), [size2]);
6031
6012
  return /* @__PURE__ */ jsxRuntime.jsx(Root$3, { ...restProps, $size, ref, $style: "label" });
6032
6013
  }), HeadingSkeleton = react.forwardRef(function(props, ref) {
6033
- const { size: size2 = 2, ...restProps } = props, $size = useArrayProp(size2);
6014
+ const { size: size2 = 2, ...restProps } = props, $size = react.useMemo(() => _getArrayProp(size2), [size2]);
6034
6015
  return /* @__PURE__ */ jsxRuntime.jsx(Root$3, { ...restProps, $size, ref, $style: "heading" });
6035
6016
  }), CodeSkeleton = react.forwardRef(function(props, ref) {
6036
- const { size: size2 = 2, ...restProps } = props, $size = useArrayProp(size2);
6017
+ const { size: size2 = 2, ...restProps } = props, $size = react.useMemo(() => _getArrayProp(size2), [size2]);
6037
6018
  return /* @__PURE__ */ jsxRuntime.jsx(Root$3, { ...restProps, $size, ref, $style: "code" });
6038
6019
  }), CustomButton = styledComponents.styled(Button)`
6039
6020
  max-width: 100%;