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