@sanity/ui 2.3.6-canary.0 → 2.3.6-canary.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.compiled.mjs +2486 -2257
- package/dist/index.compiled.mjs.map +1 -1
- package/dist/index.d.mts +10 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.esm.js +965 -979
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +970 -984
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +965 -979
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/core/components/autocomplete/autocomplete.tsx +2 -2
- package/src/core/components/breadcrumbs/breadcrumbs.tsx +3 -2
- package/src/core/components/dialog/dialog.tsx +19 -10
- package/src/core/components/hotkeys/hotkeys.tsx +3 -3
- package/src/core/components/menu/menuGroup.tsx +5 -4
- package/src/core/components/menu/menuItem.tsx +6 -4
- package/src/core/components/skeleton/skeleton.tsx +5 -11
- package/src/core/components/skeleton/textSkeleton.tsx +6 -7
- package/src/core/hooks/useArrayProp.ts +11 -10
- package/src/core/primitives/avatar/avatar.tsx +4 -4
- package/src/core/primitives/avatar/avatarCounter.tsx +2 -3
- package/src/core/primitives/avatar/avatarStack.tsx +2 -3
- package/src/core/primitives/badge/badge.tsx +7 -4
- package/src/core/primitives/box/box.tsx +53 -27
- package/src/core/primitives/button/button.tsx +11 -12
- package/src/core/primitives/card/card.tsx +17 -9
- package/src/core/primitives/code/code.tsx +4 -3
- package/src/core/primitives/container/container.tsx +4 -11
- package/src/core/primitives/flex/flex.tsx +13 -7
- package/src/core/primitives/grid/grid.tsx +19 -10
- package/src/core/primitives/heading/heading.tsx +7 -4
- package/src/core/primitives/inline/inline.tsx +3 -2
- package/src/core/primitives/kbd/kbd.tsx +4 -3
- package/src/core/primitives/label/label.tsx +7 -4
- package/src/core/primitives/popover/popover.tsx +7 -6
- package/src/core/primitives/select/select.tsx +12 -6
- package/src/core/primitives/stack/stack.tsx +4 -3
- package/src/core/primitives/text/text.tsx +7 -4
- package/src/core/primitives/textArea/textArea.tsx +12 -6
- package/src/core/primitives/textInput/textInput.tsx +6 -5
- package/src/core/primitives/tooltip/tooltip.tsx +6 -2
- package/src/core/theme/themeProvider.tsx +2 -1
- package/src/core/utils/layer/layerProvider.tsx +3 -2
package/dist/index.mjs
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 {
|
|
4
|
-
import
|
|
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,146 @@ function responsiveTextAlignStyle(props) {
|
|
|
120
120
|
function responsiveTextFont(props) {
|
|
121
121
|
return responsiveFont("text", props);
|
|
122
122
|
}
|
|
123
|
-
function
|
|
124
|
-
|
|
125
|
-
return
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
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 parentTheme = useContext(ThemeContext), {
|
|
138
|
+
children,
|
|
139
|
+
// scheme = parentTheme?.scheme || 'light',
|
|
140
|
+
theme: rootTheme = (parentTheme == null ? void 0 : parentTheme.theme) || null,
|
|
141
|
+
tone = (parentTheme == null ? void 0 : parentTheme.tone) || "default"
|
|
142
|
+
} = props, scheme = (_a = props.scheme) != null ? _a : (parentTheme == null ? void 0 : parentTheme.scheme) || "light", themeContext = useMemo(() => rootTheme ? {
|
|
143
|
+
version: 0,
|
|
144
|
+
theme: rootTheme,
|
|
145
|
+
scheme,
|
|
146
|
+
tone
|
|
147
|
+
} : null, [rootTheme, scheme, tone]), theme = useMemo(() => rootTheme ? getScopedTheme(rootTheme, scheme, tone) : null, [scheme, rootTheme, tone]);
|
|
148
|
+
return theme ? /* @__PURE__ */ jsx(ThemeContext.Provider, { value: themeContext, children: /* @__PURE__ */ jsx(ThemeProvider$1, { theme, children }) }) : /* @__PURE__ */ jsx("pre", { children: 'ThemeProvider: no "theme" property provided' });
|
|
149
|
+
}
|
|
150
|
+
function useRootTheme() {
|
|
151
|
+
const value = useContext(ThemeContext);
|
|
152
|
+
if (!value)
|
|
153
|
+
throw new Error("useRootTheme(): missing context value");
|
|
154
|
+
return value;
|
|
155
|
+
}
|
|
156
|
+
function ThemeColorProvider(props) {
|
|
157
|
+
const { children, scheme, tone } = props, root = useRootTheme();
|
|
158
|
+
return /* @__PURE__ */ jsx(ThemeProvider, { scheme: scheme || root.scheme, theme: root.theme, tone, children });
|
|
159
|
+
}
|
|
160
|
+
function useTheme() {
|
|
161
|
+
return useTheme$1();
|
|
162
|
+
}
|
|
163
|
+
function useTheme_v2() {
|
|
164
|
+
return getTheme_v2(useTheme$1());
|
|
165
|
+
}
|
|
166
|
+
function responsiveBorderStyle() {
|
|
167
|
+
return [border, borderTop, borderRight, borderBottom, borderLeft];
|
|
168
|
+
}
|
|
169
|
+
function border(props) {
|
|
170
|
+
var _a, _b;
|
|
171
|
+
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)`;
|
|
172
|
+
return _responsive(
|
|
173
|
+
media,
|
|
174
|
+
props.$border,
|
|
175
|
+
(value) => value ? { "&&": { border: borderStyle } } : { "&&": { border: 0 } }
|
|
130
176
|
);
|
|
131
177
|
}
|
|
132
|
-
function
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
178
|
+
function borderTop(props) {
|
|
179
|
+
var _a, _b;
|
|
180
|
+
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)`;
|
|
181
|
+
return _responsive(
|
|
182
|
+
media,
|
|
183
|
+
props.$borderTop,
|
|
184
|
+
(value) => value ? { "&&": { borderTop: borderStyle } } : { "&&": { borderTop: 0 } }
|
|
185
|
+
);
|
|
137
186
|
}
|
|
138
|
-
function
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
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;
|
|
187
|
+
function borderRight(props) {
|
|
188
|
+
var _a, _b;
|
|
189
|
+
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)`;
|
|
190
|
+
return _responsive(
|
|
191
|
+
media,
|
|
192
|
+
props.$borderRight,
|
|
193
|
+
(value) => value ? { "&&": { borderRight: borderStyle } } : { "&&": { borderRight: 0 } }
|
|
194
|
+
);
|
|
171
195
|
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
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;
|
|
196
|
+
function borderBottom(props) {
|
|
197
|
+
var _a, _b;
|
|
198
|
+
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)`;
|
|
199
|
+
return _responsive(
|
|
200
|
+
media,
|
|
201
|
+
props.$borderBottom,
|
|
202
|
+
(value) => value ? { "&&": { borderBottom: borderStyle } } : { "&&": { borderBottom: 0 } }
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
function borderLeft(props) {
|
|
206
|
+
var _a, _b;
|
|
207
|
+
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)`;
|
|
208
|
+
return _responsive(
|
|
209
|
+
media,
|
|
210
|
+
props.$borderLeft,
|
|
211
|
+
(value) => value ? { "&&": { borderLeft: borderStyle } } : { "&&": { borderLeft: 0 } }
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
const BASE_STYLE$4 = {
|
|
215
|
+
'&[data-as="ul"],&[data-as="ol"]': {
|
|
216
|
+
listStyle: "none"
|
|
212
217
|
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
}
|
|
239
|
-
return
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
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"
|
|
218
|
+
}, BOX_SIZING = {
|
|
219
|
+
content: "content-box",
|
|
220
|
+
border: "border-box"
|
|
221
|
+
}, BOX_HEIGHT = {
|
|
222
|
+
stretch: "stretch",
|
|
223
|
+
fill: "100%"
|
|
224
|
+
};
|
|
225
|
+
function boxStyle() {
|
|
226
|
+
return BASE_STYLE$4;
|
|
227
|
+
}
|
|
228
|
+
function responsiveBoxStyle() {
|
|
229
|
+
return [
|
|
230
|
+
responsiveBoxSizingStyle,
|
|
231
|
+
responsiveBoxHeightStyle,
|
|
232
|
+
responsiveBoxOverflowStyle,
|
|
233
|
+
responsiveBoxDisplayStyle
|
|
234
|
+
];
|
|
235
|
+
}
|
|
236
|
+
function responsiveBoxDisplayStyle(props) {
|
|
237
|
+
const { media } = getTheme_v2(props.theme);
|
|
238
|
+
return _responsive(media, props.$display, (display) => ({
|
|
239
|
+
"&:not([hidden])": { display }
|
|
240
|
+
}));
|
|
241
|
+
}
|
|
242
|
+
function responsiveBoxSizingStyle(props) {
|
|
243
|
+
const { media } = getTheme_v2(props.theme);
|
|
244
|
+
return _responsive(media, props.$sizing, (sizing) => ({
|
|
245
|
+
boxSizing: BOX_SIZING[sizing]
|
|
246
|
+
}));
|
|
247
|
+
}
|
|
248
|
+
function responsiveBoxHeightStyle(props) {
|
|
249
|
+
const { media } = getTheme_v2(props.theme);
|
|
250
|
+
return _responsive(media, props.$height, (height) => ({
|
|
251
|
+
height: BOX_HEIGHT[height]
|
|
252
|
+
}));
|
|
253
|
+
}
|
|
254
|
+
function responsiveBoxOverflowStyle(props) {
|
|
255
|
+
const { media } = getTheme_v2(props.theme);
|
|
256
|
+
return _responsive(media, props.$overflow, (overflow) => ({
|
|
257
|
+
overflow
|
|
258
|
+
}));
|
|
259
|
+
}
|
|
260
|
+
const BASE_STYLE$3 = {
|
|
261
|
+
"&&:not([hidden])": {
|
|
262
|
+
display: "flex"
|
|
734
263
|
}
|
|
735
264
|
};
|
|
736
265
|
function responsiveFlexStyle() {
|
|
@@ -1244,7 +773,7 @@ const Root$C = styled.div(responsiveLabelFont, responsiveTextAlignStyle, labelBa
|
|
|
1244
773
|
textOverflow,
|
|
1245
774
|
weight,
|
|
1246
775
|
...restProps
|
|
1247
|
-
} = props;
|
|
776
|
+
} = props, $size = useMemo(() => _getArrayProp(size2), [size2]), $align = useMemo(() => _getArrayProp(align), [align]);
|
|
1248
777
|
let children = childrenProp;
|
|
1249
778
|
return textOverflow === "ellipsis" ? children = /* @__PURE__ */ jsx(SpanWithTextOverflow$2, { children }) : children = /* @__PURE__ */ jsx("span", { children }), /* @__PURE__ */ jsx(
|
|
1250
779
|
Root$C,
|
|
@@ -1252,9 +781,9 @@ const Root$C = styled.div(responsiveLabelFont, responsiveTextAlignStyle, labelBa
|
|
|
1252
781
|
"data-ui": "Label",
|
|
1253
782
|
...restProps,
|
|
1254
783
|
$accent: accent,
|
|
1255
|
-
$align
|
|
784
|
+
$align,
|
|
785
|
+
$size,
|
|
1256
786
|
$muted: muted,
|
|
1257
|
-
$size: useArrayProp(size2),
|
|
1258
787
|
$weight: weight,
|
|
1259
788
|
ref,
|
|
1260
789
|
children
|
|
@@ -1413,7 +942,7 @@ const Root$B = styled.div(
|
|
|
1413
942
|
status = "online",
|
|
1414
943
|
size: sizeProp = 1,
|
|
1415
944
|
...restProps
|
|
1416
|
-
} = props, { avatar } = useTheme_v2(), as =
|
|
945
|
+
} = 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
946
|
animateArrowFrom || arrowPositionProp || "inside"
|
|
1418
947
|
), [imageFailed, setImageFailed] = useState(!1), imageId = `avatar-image-${elementId}`;
|
|
1419
948
|
useEffect(() => {
|
|
@@ -1523,7 +1052,7 @@ const Root$A = styled.div(
|
|
|
1523
1052
|
_responsiveAvatarCounterSizeStyle,
|
|
1524
1053
|
_avatarCounterBaseStyle
|
|
1525
1054
|
), AvatarCounter = forwardRef(function(props, ref) {
|
|
1526
|
-
const { count, size: sizeProp = 1 } = props, size2 =
|
|
1055
|
+
const { count, size: sizeProp = 1 } = props, size2 = useMemo(() => _getArrayProp(sizeProp), [sizeProp]), fontSize2 = useMemo(
|
|
1527
1056
|
() => size2.map((s) => s === 1 ? 1 : s === 2 ? 3 : s === 3 ? 5 : 0),
|
|
1528
1057
|
[size2]
|
|
1529
1058
|
);
|
|
@@ -1562,7 +1091,7 @@ const Root$z = styled.div(responsiveAvatarStackSizeStyle, avatarStackStyle), Ava
|
|
|
1562
1091
|
} = props, children = useMemo(
|
|
1563
1092
|
() => Children.toArray(childrenProp).filter(isValidElement),
|
|
1564
1093
|
[childrenProp]
|
|
1565
|
-
), maxLength = Math.max(maxLengthProp, 0), size2 =
|
|
1094
|
+
), 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
1095
|
return /* @__PURE__ */ jsxs(Root$z, { "data-ui": "AvatarStack", ...restProps, ref, $size: size2, children: [
|
|
1567
1096
|
len === 0 && /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(AvatarCounter, { count: len, size: size2 }) }),
|
|
1568
1097
|
len !== 0 && extraCount > 1 && /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(AvatarCounter, { count: extraCount, size: size2 }) }),
|
|
@@ -1604,38 +1133,38 @@ const Root$z = styled.div(responsiveAvatarStackSizeStyle, avatarStackStyle), Ava
|
|
|
1604
1133
|
rowEnd,
|
|
1605
1134
|
sizing,
|
|
1606
1135
|
...restProps
|
|
1607
|
-
} = props;
|
|
1136
|
+
} = 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
1137
|
return /* @__PURE__ */ jsx(
|
|
1609
1138
|
Root$y,
|
|
1610
1139
|
{
|
|
1611
1140
|
"data-as": typeof asProp == "string" ? asProp : void 0,
|
|
1612
1141
|
"data-ui": "Box",
|
|
1613
1142
|
...restProps,
|
|
1614
|
-
$column
|
|
1615
|
-
$columnStart
|
|
1616
|
-
$columnEnd
|
|
1617
|
-
$display
|
|
1618
|
-
$flex
|
|
1619
|
-
$height
|
|
1620
|
-
$margin
|
|
1621
|
-
$marginX
|
|
1622
|
-
$marginY
|
|
1623
|
-
$marginTop
|
|
1624
|
-
$marginRight
|
|
1625
|
-
$marginBottom
|
|
1626
|
-
$marginLeft
|
|
1627
|
-
$overflow
|
|
1628
|
-
$padding
|
|
1629
|
-
$paddingX
|
|
1630
|
-
$paddingY
|
|
1631
|
-
$paddingTop
|
|
1632
|
-
$paddingRight
|
|
1633
|
-
$paddingBottom
|
|
1634
|
-
$paddingLeft
|
|
1635
|
-
$row
|
|
1636
|
-
$rowStart
|
|
1637
|
-
$rowEnd
|
|
1638
|
-
$sizing
|
|
1143
|
+
$column,
|
|
1144
|
+
$columnStart,
|
|
1145
|
+
$columnEnd,
|
|
1146
|
+
$display,
|
|
1147
|
+
$flex,
|
|
1148
|
+
$height,
|
|
1149
|
+
$margin,
|
|
1150
|
+
$marginX,
|
|
1151
|
+
$marginY,
|
|
1152
|
+
$marginTop,
|
|
1153
|
+
$marginRight,
|
|
1154
|
+
$marginBottom,
|
|
1155
|
+
$marginLeft,
|
|
1156
|
+
$overflow,
|
|
1157
|
+
$padding,
|
|
1158
|
+
$paddingX,
|
|
1159
|
+
$paddingY,
|
|
1160
|
+
$paddingTop,
|
|
1161
|
+
$paddingRight,
|
|
1162
|
+
$paddingBottom,
|
|
1163
|
+
$paddingLeft,
|
|
1164
|
+
$row,
|
|
1165
|
+
$rowStart,
|
|
1166
|
+
$rowEnd,
|
|
1167
|
+
$sizing,
|
|
1639
1168
|
as: asProp,
|
|
1640
1169
|
ref,
|
|
1641
1170
|
children: props.children
|
|
@@ -1725,7 +1254,7 @@ const Root$x = styled.div(
|
|
|
1725
1254
|
textOverflow,
|
|
1726
1255
|
weight,
|
|
1727
1256
|
...restProps
|
|
1728
|
-
} = props;
|
|
1257
|
+
} = props, $size = useMemo(() => _getArrayProp(size2), [size2]), $align = useMemo(() => _getArrayProp(align), [align]);
|
|
1729
1258
|
let children = childrenProp;
|
|
1730
1259
|
return textOverflow === "ellipsis" && (children = /* @__PURE__ */ jsx(SpanWithTextOverflow$1, { children })), /* @__PURE__ */ jsx(
|
|
1731
1260
|
Root$x,
|
|
@@ -1733,10 +1262,10 @@ const Root$x = styled.div(
|
|
|
1733
1262
|
"data-ui": "Text",
|
|
1734
1263
|
...restProps,
|
|
1735
1264
|
$accent: accent,
|
|
1736
|
-
$align
|
|
1265
|
+
$align,
|
|
1266
|
+
$size,
|
|
1737
1267
|
$muted: muted,
|
|
1738
1268
|
ref,
|
|
1739
|
-
$size: useArrayProp(size2),
|
|
1740
1269
|
$weight: weight,
|
|
1741
1270
|
children: /* @__PURE__ */ jsx("span", { children })
|
|
1742
1271
|
}
|
|
@@ -1768,15 +1297,15 @@ const Root$w = styled(Box)(
|
|
|
1768
1297
|
radius = "full",
|
|
1769
1298
|
tone = "default",
|
|
1770
1299
|
...restProps
|
|
1771
|
-
} = props;
|
|
1300
|
+
} = props, $radius = useMemo(() => _getArrayProp(radius), [radius]), $padding = useMemo(() => _getArrayProp(padding), [padding]);
|
|
1772
1301
|
return /* @__PURE__ */ jsx(
|
|
1773
1302
|
Root$w,
|
|
1774
1303
|
{
|
|
1775
1304
|
"data-ui": "Badge",
|
|
1776
1305
|
...restProps,
|
|
1777
1306
|
$tone: tone,
|
|
1778
|
-
$radius
|
|
1779
|
-
padding:
|
|
1307
|
+
$radius,
|
|
1308
|
+
padding: $padding,
|
|
1780
1309
|
ref,
|
|
1781
1310
|
children: /* @__PURE__ */ jsx(Text, { size: fontSize2, children })
|
|
1782
1311
|
}
|
|
@@ -1785,17 +1314,17 @@ const Root$w = styled(Box)(
|
|
|
1785
1314
|
flexItemStyle,
|
|
1786
1315
|
responsiveFlexStyle
|
|
1787
1316
|
), Flex = forwardRef(function(props, ref) {
|
|
1788
|
-
const { align, as, direction = "row", gap, justify, wrap, ...restProps } = props;
|
|
1317
|
+
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
1318
|
return /* @__PURE__ */ jsx(
|
|
1790
1319
|
Root$v,
|
|
1791
1320
|
{
|
|
1792
1321
|
"data-ui": "Flex",
|
|
1793
1322
|
...restProps,
|
|
1794
|
-
$align
|
|
1795
|
-
$direction
|
|
1796
|
-
$gap
|
|
1797
|
-
$justify
|
|
1798
|
-
$wrap
|
|
1323
|
+
$align,
|
|
1324
|
+
$direction,
|
|
1325
|
+
$gap,
|
|
1326
|
+
$justify,
|
|
1327
|
+
$wrap,
|
|
1799
1328
|
forwardedAs: as,
|
|
1800
1329
|
ref
|
|
1801
1330
|
}
|
|
@@ -1969,278 +1498,744 @@ function buttonColorStyles(props) {
|
|
|
1969
1498
|
},
|
|
1970
1499
|
"&[data-selected]": _cardColorStyle(baseColor, color.pressed)
|
|
1971
1500
|
}
|
|
1972
|
-
},
|
|
1973
|
-
(_a = style == null ? void 0 : style.button) == null ? void 0 : _a.root
|
|
1974
|
-
].filter(Boolean);
|
|
1501
|
+
},
|
|
1502
|
+
(_a = style == null ? void 0 : style.button) == null ? void 0 : _a.root
|
|
1503
|
+
].filter(Boolean);
|
|
1504
|
+
}
|
|
1505
|
+
const Root$t = styled.button(responsiveRadiusStyle, buttonBaseStyles, buttonColorStyles), LoadingBox = styled.div`
|
|
1506
|
+
position: absolute;
|
|
1507
|
+
top: 0;
|
|
1508
|
+
left: 0;
|
|
1509
|
+
right: 0;
|
|
1510
|
+
bottom: 0;
|
|
1511
|
+
display: flex;
|
|
1512
|
+
align-items: center;
|
|
1513
|
+
justify-content: center;
|
|
1514
|
+
background-color: var(--card-bg-color);
|
|
1515
|
+
border-radius: inherit;
|
|
1516
|
+
z-index: 1;
|
|
1517
|
+
box-shadow: inherit;
|
|
1518
|
+
`, Button = forwardRef(function(props, ref) {
|
|
1519
|
+
const {
|
|
1520
|
+
children,
|
|
1521
|
+
disabled,
|
|
1522
|
+
fontSize: fontSize2 = 1,
|
|
1523
|
+
icon: IconComponent,
|
|
1524
|
+
iconRight: IconRightComponent,
|
|
1525
|
+
justify: justifyProp = "center",
|
|
1526
|
+
loading,
|
|
1527
|
+
mode = "default",
|
|
1528
|
+
padding: paddingProp = 3,
|
|
1529
|
+
paddingX: paddingXProp,
|
|
1530
|
+
paddingY: paddingYProp,
|
|
1531
|
+
paddingTop: paddingTopProp,
|
|
1532
|
+
paddingBottom: paddingBottomProp,
|
|
1533
|
+
paddingLeft: paddingLeftProp,
|
|
1534
|
+
paddingRight: paddingRightProp,
|
|
1535
|
+
radius: radiusProp = 2,
|
|
1536
|
+
selected,
|
|
1537
|
+
space: spaceProp = 3,
|
|
1538
|
+
text,
|
|
1539
|
+
textAlign,
|
|
1540
|
+
tone = "default",
|
|
1541
|
+
type = "button",
|
|
1542
|
+
muted = !1,
|
|
1543
|
+
width,
|
|
1544
|
+
...restProps
|
|
1545
|
+
} = 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(
|
|
1546
|
+
() => ({
|
|
1547
|
+
// flex: 1,
|
|
1548
|
+
padding,
|
|
1549
|
+
paddingX,
|
|
1550
|
+
paddingY,
|
|
1551
|
+
paddingTop,
|
|
1552
|
+
paddingBottom,
|
|
1553
|
+
paddingLeft,
|
|
1554
|
+
paddingRight
|
|
1555
|
+
}),
|
|
1556
|
+
[padding, paddingX, paddingY, paddingTop, paddingBottom, paddingLeft, paddingRight]
|
|
1557
|
+
);
|
|
1558
|
+
return /* @__PURE__ */ jsxs(
|
|
1559
|
+
Root$t,
|
|
1560
|
+
{
|
|
1561
|
+
"data-ui": "Button",
|
|
1562
|
+
...restProps,
|
|
1563
|
+
$mode: mode,
|
|
1564
|
+
$radius: radius,
|
|
1565
|
+
$tone: tone,
|
|
1566
|
+
"data-disabled": !!(loading || disabled),
|
|
1567
|
+
"data-selected": selected ? "" : void 0,
|
|
1568
|
+
disabled: !!(loading || disabled),
|
|
1569
|
+
ref,
|
|
1570
|
+
type,
|
|
1571
|
+
$width: width,
|
|
1572
|
+
children: [
|
|
1573
|
+
!!loading && /* @__PURE__ */ jsx(LoadingBox, { children: /* @__PURE__ */ jsx(Spinner, {}) }),
|
|
1574
|
+
(IconComponent || text || IconRightComponent) && /* @__PURE__ */ jsx(Box, { as: "span", ...boxProps, children: /* @__PURE__ */ jsxs(Flex, { as: "span", justify, gap: space, children: [
|
|
1575
|
+
IconComponent && /* @__PURE__ */ jsxs(Text, { size: fontSize2, children: [
|
|
1576
|
+
isValidElement(IconComponent) && IconComponent,
|
|
1577
|
+
isValidElementType(IconComponent) && /* @__PURE__ */ jsx(IconComponent, {})
|
|
1578
|
+
] }),
|
|
1579
|
+
text && /* @__PURE__ */ jsx(
|
|
1580
|
+
Text,
|
|
1581
|
+
{
|
|
1582
|
+
muted,
|
|
1583
|
+
align: textAlign,
|
|
1584
|
+
size: fontSize2,
|
|
1585
|
+
textOverflow: "ellipsis",
|
|
1586
|
+
weight: button.textWeight,
|
|
1587
|
+
children: text
|
|
1588
|
+
}
|
|
1589
|
+
),
|
|
1590
|
+
IconRightComponent && /* @__PURE__ */ jsxs(Text, { size: fontSize2, children: [
|
|
1591
|
+
isValidElement(IconRightComponent) && IconRightComponent,
|
|
1592
|
+
isValidElementType(IconRightComponent) && /* @__PURE__ */ jsx(IconRightComponent, {})
|
|
1593
|
+
] })
|
|
1594
|
+
] }) }),
|
|
1595
|
+
children && /* @__PURE__ */ jsx(Box, { as: "span", ...boxProps, children })
|
|
1596
|
+
]
|
|
1597
|
+
}
|
|
1598
|
+
);
|
|
1599
|
+
});
|
|
1600
|
+
function cardStyle(props) {
|
|
1601
|
+
return [cardBaseStyle(props), cardColorStyle(props)];
|
|
1602
|
+
}
|
|
1603
|
+
function cardBaseStyle(props) {
|
|
1604
|
+
const { $checkered } = props, { space } = getTheme_v2(props.theme);
|
|
1605
|
+
return css`
|
|
1606
|
+
${$checkered && css`
|
|
1607
|
+
background-size: ${space[3]}px ${space[3]}px;
|
|
1608
|
+
background-position: 50% 50%;
|
|
1609
|
+
background-image: var(--card-bg-image);
|
|
1610
|
+
`}
|
|
1611
|
+
|
|
1612
|
+
&[data-as='button'] {
|
|
1613
|
+
-webkit-font-smoothing: inherit;
|
|
1614
|
+
appearance: none;
|
|
1615
|
+
outline: none;
|
|
1616
|
+
font: inherit;
|
|
1617
|
+
text-align: inherit;
|
|
1618
|
+
border: 0;
|
|
1619
|
+
width: -moz-available;
|
|
1620
|
+
width: -webkit-fill-available;
|
|
1621
|
+
width: stretch;
|
|
1622
|
+
}
|
|
1623
|
+
|
|
1624
|
+
/* &:is(a) */
|
|
1625
|
+
&[data-as='a'] {
|
|
1626
|
+
outline: none;
|
|
1627
|
+
text-decoration: none;
|
|
1628
|
+
}
|
|
1629
|
+
|
|
1630
|
+
/* &:is(pre) */
|
|
1631
|
+
&[data-as='pre'] {
|
|
1632
|
+
font: inherit;
|
|
1633
|
+
}
|
|
1634
|
+
`;
|
|
1635
|
+
}
|
|
1636
|
+
function cardColorStyle(props) {
|
|
1637
|
+
var _a;
|
|
1638
|
+
const { $checkered, $focusRing, $muted } = props, { card, color, style } = getTheme_v2(props.theme), border2 = { width: card.border.width, color: "var(--card-border-color)" };
|
|
1639
|
+
return css`
|
|
1640
|
+
color-scheme: ${color._dark ? "dark" : "light"};
|
|
1641
|
+
|
|
1642
|
+
${_cardColorStyle(color, color, $checkered)}
|
|
1643
|
+
|
|
1644
|
+
background-color: ${$muted ? "var(--card-muted-bg-color)" : "var(--card-bg-color)"};
|
|
1645
|
+
color: var(--card-fg-color);
|
|
1646
|
+
|
|
1647
|
+
/* &:is(button) */
|
|
1648
|
+
&[data-as='button'] {
|
|
1649
|
+
--card-focus-ring-box-shadow: none;
|
|
1650
|
+
|
|
1651
|
+
cursor: default;
|
|
1652
|
+
box-shadow: var(--card-focus-ring-box-shadow);
|
|
1653
|
+
|
|
1654
|
+
&:disabled {
|
|
1655
|
+
${_cardColorStyle(color, color.selectable.default.disabled, $checkered)}
|
|
1656
|
+
}
|
|
1657
|
+
|
|
1658
|
+
&:not(:disabled) {
|
|
1659
|
+
&[data-pressed] {
|
|
1660
|
+
${_cardColorStyle(color, color.selectable.default.pressed, $checkered)}
|
|
1661
|
+
}
|
|
1662
|
+
|
|
1663
|
+
&[data-selected] {
|
|
1664
|
+
${_cardColorStyle(color, color.selectable.default.selected, $checkered)}
|
|
1665
|
+
}
|
|
1666
|
+
|
|
1667
|
+
@media (hover: hover) {
|
|
1668
|
+
&:not([data-pressed]):not([data-selected]) {
|
|
1669
|
+
&[data-hovered],
|
|
1670
|
+
&:hover {
|
|
1671
|
+
${_cardColorStyle(color, color.selectable.default.hovered, $checkered)}
|
|
1672
|
+
}
|
|
1673
|
+
|
|
1674
|
+
&:active {
|
|
1675
|
+
${_cardColorStyle(color, color.selectable.default.pressed, $checkered)}
|
|
1676
|
+
}
|
|
1677
|
+
}
|
|
1678
|
+
}
|
|
1679
|
+
|
|
1680
|
+
&:focus-visible {
|
|
1681
|
+
--card-focus-ring-box-shadow: ${$focusRing ? focusRingStyle({ base: color, border: border2, focusRing: card.focusRing }) : void 0};
|
|
1682
|
+
}
|
|
1683
|
+
}
|
|
1684
|
+
}
|
|
1685
|
+
|
|
1686
|
+
/* &:is(a) */
|
|
1687
|
+
&[data-as='a'] {
|
|
1688
|
+
cursor: pointer;
|
|
1689
|
+
box-shadow: var(--card-focus-ring-box-shadow);
|
|
1690
|
+
|
|
1691
|
+
&[data-disabled] {
|
|
1692
|
+
${_cardColorStyle(color, color.selectable.default.disabled, $checkered)}
|
|
1693
|
+
}
|
|
1694
|
+
|
|
1695
|
+
&:not([data-disabled]) {
|
|
1696
|
+
&[data-pressed] {
|
|
1697
|
+
${_cardColorStyle(color, color.selectable.default.pressed, $checkered)}
|
|
1698
|
+
}
|
|
1699
|
+
|
|
1700
|
+
&[data-selected] {
|
|
1701
|
+
${_cardColorStyle(color, color.selectable.default.selected, $checkered)}
|
|
1702
|
+
}
|
|
1703
|
+
|
|
1704
|
+
@media (hover: hover) {
|
|
1705
|
+
&:not([data-pressed]):not([data-selected]) {
|
|
1706
|
+
&[data-hovered],
|
|
1707
|
+
&:hover {
|
|
1708
|
+
${_cardColorStyle(color, color.selectable.default.hovered, $checkered)}
|
|
1709
|
+
}
|
|
1710
|
+
|
|
1711
|
+
&:active {
|
|
1712
|
+
${_cardColorStyle(color, color.selectable.default.pressed, $checkered)}
|
|
1713
|
+
}
|
|
1714
|
+
}
|
|
1715
|
+
}
|
|
1716
|
+
|
|
1717
|
+
&:focus-visible {
|
|
1718
|
+
--card-focus-ring-box-shadow: ${$focusRing ? focusRingStyle({ base: color, border: border2, focusRing: card.focusRing }) : void 0};
|
|
1719
|
+
}
|
|
1720
|
+
}
|
|
1721
|
+
}
|
|
1722
|
+
|
|
1723
|
+
${(_a = style == null ? void 0 : style.card) == null ? void 0 : _a.root}
|
|
1724
|
+
`;
|
|
1975
1725
|
}
|
|
1976
|
-
const Root$
|
|
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) {
|
|
1726
|
+
const Root$s = styled(Box)(responsiveBorderStyle, responsiveRadiusStyle, responsiveShadowStyle, cardStyle), Card = forwardRef(function(props, ref) {
|
|
1990
1727
|
const {
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
paddingBottom: paddingBottomProp,
|
|
2004
|
-
paddingLeft: paddingLeftProp,
|
|
2005
|
-
paddingRight: paddingRightProp,
|
|
2006
|
-
radius: radiusProp = 2,
|
|
1728
|
+
__unstable_checkered: checkered = !1,
|
|
1729
|
+
__unstable_focusRing: focusRing = !1,
|
|
1730
|
+
as: asProp,
|
|
1731
|
+
border: border2,
|
|
1732
|
+
borderTop: borderTop2,
|
|
1733
|
+
borderRight: borderRight2,
|
|
1734
|
+
borderBottom: borderBottom2,
|
|
1735
|
+
borderLeft: borderLeft2,
|
|
1736
|
+
muted,
|
|
1737
|
+
pressed,
|
|
1738
|
+
radius = 0,
|
|
1739
|
+
scheme,
|
|
2007
1740
|
selected,
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
textAlign,
|
|
2011
|
-
tone = "default",
|
|
2012
|
-
type = "button",
|
|
2013
|
-
muted = !1,
|
|
2014
|
-
width,
|
|
1741
|
+
shadow,
|
|
1742
|
+
tone: toneProp = "default",
|
|
2015
1743
|
...restProps
|
|
2016
|
-
} = props,
|
|
2017
|
-
|
|
2018
|
-
|
|
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,
|
|
1744
|
+
} = 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]);
|
|
1745
|
+
return /* @__PURE__ */ jsx(ThemeColorProvider, { scheme, tone, children: /* @__PURE__ */ jsx(
|
|
1746
|
+
Root$s,
|
|
2031
1747
|
{
|
|
2032
|
-
"data-
|
|
1748
|
+
"data-as": typeof as == "string" ? as : void 0,
|
|
1749
|
+
"data-scheme": rootTheme.scheme,
|
|
1750
|
+
"data-ui": "Card",
|
|
1751
|
+
"data-tone": tone,
|
|
2033
1752
|
...restProps,
|
|
2034
|
-
$
|
|
2035
|
-
$
|
|
1753
|
+
$border,
|
|
1754
|
+
$borderTop,
|
|
1755
|
+
$borderRight,
|
|
1756
|
+
$borderBottom,
|
|
1757
|
+
$borderLeft,
|
|
1758
|
+
$radius,
|
|
1759
|
+
$shadow,
|
|
1760
|
+
$checkered: checkered,
|
|
1761
|
+
$focusRing: focusRing,
|
|
1762
|
+
$muted: muted,
|
|
2036
1763
|
$tone: tone,
|
|
2037
|
-
"data-
|
|
1764
|
+
"data-checkered": checkered ? "" : void 0,
|
|
1765
|
+
"data-pressed": pressed ? "" : void 0,
|
|
2038
1766
|
"data-selected": selected ? "" : void 0,
|
|
2039
|
-
|
|
1767
|
+
forwardedAs: as,
|
|
2040
1768
|
ref,
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
1769
|
+
selected
|
|
1770
|
+
}
|
|
1771
|
+
) });
|
|
1772
|
+
});
|
|
1773
|
+
function useArrayProp(val, defaultVal) {
|
|
1774
|
+
return useMemo(() => _getArrayProp(val, defaultVal), [defaultVal, val]);
|
|
1775
|
+
}
|
|
1776
|
+
function _getElements(element, elementsArg) {
|
|
1777
|
+
const ret = [element];
|
|
1778
|
+
for (const el of elementsArg)
|
|
1779
|
+
Array.isArray(el) ? ret.push(...el) : ret.push(el);
|
|
1780
|
+
return ret.filter(Boolean);
|
|
1781
|
+
}
|
|
1782
|
+
function useClickOutside(listener, elementsArg = EMPTY_ARRAY, boundaryElement) {
|
|
1783
|
+
const [element, setElement] = useState(null), [elements, setElements] = useState(() => _getElements(element, elementsArg)), elementsRef = useRef(elements);
|
|
1784
|
+
return useEffect(() => {
|
|
1785
|
+
const prevElements = elementsRef.current, nextElements = _getElements(element, elementsArg);
|
|
1786
|
+
if (prevElements.length !== nextElements.length) {
|
|
1787
|
+
setElements(nextElements), elementsRef.current = nextElements;
|
|
1788
|
+
return;
|
|
1789
|
+
}
|
|
1790
|
+
for (const el of prevElements)
|
|
1791
|
+
if (!nextElements.includes(el)) {
|
|
1792
|
+
setElements(nextElements), elementsRef.current = nextElements;
|
|
1793
|
+
return;
|
|
1794
|
+
}
|
|
1795
|
+
for (const el of nextElements)
|
|
1796
|
+
if (!prevElements.includes(el)) {
|
|
1797
|
+
setElements(nextElements), elementsRef.current = nextElements;
|
|
1798
|
+
return;
|
|
1799
|
+
}
|
|
1800
|
+
}, [element, elementsArg]), useEffect(() => {
|
|
1801
|
+
if (!listener) return;
|
|
1802
|
+
const handleWindowMouseDown = (evt) => {
|
|
1803
|
+
const target = evt.target;
|
|
1804
|
+
if (target instanceof Node && !(boundaryElement && !boundaryElement.contains(target))) {
|
|
1805
|
+
for (const el of elements)
|
|
1806
|
+
if (target === el || el.contains(target))
|
|
1807
|
+
return;
|
|
1808
|
+
listener(evt);
|
|
1809
|
+
}
|
|
1810
|
+
};
|
|
1811
|
+
return window.addEventListener("mousedown", handleWindowMouseDown), () => {
|
|
1812
|
+
window.removeEventListener("mousedown", handleWindowMouseDown);
|
|
1813
|
+
};
|
|
1814
|
+
}, [boundaryElement, listener, elements]), setElement;
|
|
1815
|
+
}
|
|
1816
|
+
var resizeObservers = [], hasActiveObservations = function() {
|
|
1817
|
+
return resizeObservers.some(function(ro) {
|
|
1818
|
+
return ro.activeTargets.length > 0;
|
|
1819
|
+
});
|
|
1820
|
+
}, hasSkippedObservations = function() {
|
|
1821
|
+
return resizeObservers.some(function(ro) {
|
|
1822
|
+
return ro.skippedTargets.length > 0;
|
|
1823
|
+
});
|
|
1824
|
+
}, msg = "ResizeObserver loop completed with undelivered notifications.", deliverResizeLoopError = function() {
|
|
1825
|
+
var event;
|
|
1826
|
+
typeof ErrorEvent == "function" ? event = new ErrorEvent("error", {
|
|
1827
|
+
message: msg
|
|
1828
|
+
}) : (event = document.createEvent("Event"), event.initEvent("error", !1, !1), event.message = msg), window.dispatchEvent(event);
|
|
1829
|
+
}, ResizeObserverBoxOptions;
|
|
1830
|
+
(function(ResizeObserverBoxOptions2) {
|
|
1831
|
+
ResizeObserverBoxOptions2.BORDER_BOX = "border-box", ResizeObserverBoxOptions2.CONTENT_BOX = "content-box", ResizeObserverBoxOptions2.DEVICE_PIXEL_CONTENT_BOX = "device-pixel-content-box";
|
|
1832
|
+
})(ResizeObserverBoxOptions || (ResizeObserverBoxOptions = {}));
|
|
1833
|
+
var freeze = function(obj) {
|
|
1834
|
+
return Object.freeze(obj);
|
|
1835
|
+
}, ResizeObserverSize = /* @__PURE__ */ function() {
|
|
1836
|
+
function ResizeObserverSize2(inlineSize, blockSize) {
|
|
1837
|
+
this.inlineSize = inlineSize, this.blockSize = blockSize, freeze(this);
|
|
1838
|
+
}
|
|
1839
|
+
return ResizeObserverSize2;
|
|
1840
|
+
}(), DOMRectReadOnly = function() {
|
|
1841
|
+
function DOMRectReadOnly2(x, y, width, height) {
|
|
1842
|
+
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);
|
|
1843
|
+
}
|
|
1844
|
+
return DOMRectReadOnly2.prototype.toJSON = function() {
|
|
1845
|
+
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;
|
|
1846
|
+
return { x, y, top, right, bottom, left, width, height };
|
|
1847
|
+
}, DOMRectReadOnly2.fromRect = function(rectangle) {
|
|
1848
|
+
return new DOMRectReadOnly2(rectangle.x, rectangle.y, rectangle.width, rectangle.height);
|
|
1849
|
+
}, DOMRectReadOnly2;
|
|
1850
|
+
}(), isSVG = function(target) {
|
|
1851
|
+
return target instanceof SVGElement && "getBBox" in target;
|
|
1852
|
+
}, isHidden = function(target) {
|
|
1853
|
+
if (isSVG(target)) {
|
|
1854
|
+
var _a = target.getBBox(), width = _a.width, height = _a.height;
|
|
1855
|
+
return !width && !height;
|
|
1856
|
+
}
|
|
1857
|
+
var _b = target, offsetWidth = _b.offsetWidth, offsetHeight = _b.offsetHeight;
|
|
1858
|
+
return !(offsetWidth || offsetHeight || target.getClientRects().length);
|
|
1859
|
+
}, isElement = function(obj) {
|
|
1860
|
+
var _a;
|
|
1861
|
+
if (obj instanceof Element)
|
|
1862
|
+
return !0;
|
|
1863
|
+
var scope = (_a = obj == null ? void 0 : obj.ownerDocument) === null || _a === void 0 ? void 0 : _a.defaultView;
|
|
1864
|
+
return !!(scope && obj instanceof scope.Element);
|
|
1865
|
+
}, isReplacedElement = function(target) {
|
|
1866
|
+
switch (target.tagName) {
|
|
1867
|
+
case "INPUT":
|
|
1868
|
+
if (target.type !== "image")
|
|
1869
|
+
break;
|
|
1870
|
+
case "VIDEO":
|
|
1871
|
+
case "AUDIO":
|
|
1872
|
+
case "EMBED":
|
|
1873
|
+
case "OBJECT":
|
|
1874
|
+
case "CANVAS":
|
|
1875
|
+
case "IFRAME":
|
|
1876
|
+
case "IMG":
|
|
1877
|
+
return !0;
|
|
1878
|
+
}
|
|
1879
|
+
return !1;
|
|
1880
|
+
}, 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) {
|
|
1881
|
+
return parseFloat(pixel || "0");
|
|
1882
|
+
}, size$1 = function(inlineSize, blockSize, switchSizes) {
|
|
1883
|
+
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);
|
|
1884
|
+
}, zeroBoxes = freeze({
|
|
1885
|
+
devicePixelContentBoxSize: size$1(),
|
|
1886
|
+
borderBoxSize: size$1(),
|
|
1887
|
+
contentBoxSize: size$1(),
|
|
1888
|
+
contentRect: new DOMRectReadOnly(0, 0, 0, 0)
|
|
1889
|
+
}), calculateBoxSizes = function(target, forceRecalculation) {
|
|
1890
|
+
if (forceRecalculation === void 0 && (forceRecalculation = !1), cache.has(target) && !forceRecalculation)
|
|
1891
|
+
return cache.get(target);
|
|
1892
|
+
if (isHidden(target))
|
|
1893
|
+
return cache.set(target, zeroBoxes), zeroBoxes;
|
|
1894
|
+
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({
|
|
1895
|
+
devicePixelContentBoxSize: size$1(Math.round(contentWidth * devicePixelRatio), Math.round(contentHeight * devicePixelRatio), switchSizes),
|
|
1896
|
+
borderBoxSize: size$1(borderBoxWidth, borderBoxHeight, switchSizes),
|
|
1897
|
+
contentBoxSize: size$1(contentWidth, contentHeight, switchSizes),
|
|
1898
|
+
contentRect: new DOMRectReadOnly(paddingLeft, paddingTop, contentWidth, contentHeight)
|
|
1899
|
+
});
|
|
1900
|
+
return cache.set(target, boxes), boxes;
|
|
1901
|
+
}, calculateBoxSize = function(target, observedBox, forceRecalculation) {
|
|
1902
|
+
var _a = calculateBoxSizes(target, forceRecalculation), borderBoxSize = _a.borderBoxSize, contentBoxSize = _a.contentBoxSize, devicePixelContentBoxSize = _a.devicePixelContentBoxSize;
|
|
1903
|
+
switch (observedBox) {
|
|
1904
|
+
case ResizeObserverBoxOptions.DEVICE_PIXEL_CONTENT_BOX:
|
|
1905
|
+
return devicePixelContentBoxSize;
|
|
1906
|
+
case ResizeObserverBoxOptions.BORDER_BOX:
|
|
1907
|
+
return borderBoxSize;
|
|
1908
|
+
default:
|
|
1909
|
+
return contentBoxSize;
|
|
1910
|
+
}
|
|
1911
|
+
}, ResizeObserverEntry = /* @__PURE__ */ function() {
|
|
1912
|
+
function ResizeObserverEntry2(target) {
|
|
1913
|
+
var boxes = calculateBoxSizes(target);
|
|
1914
|
+
this.target = target, this.contentRect = boxes.contentRect, this.borderBoxSize = freeze([boxes.borderBoxSize]), this.contentBoxSize = freeze([boxes.contentBoxSize]), this.devicePixelContentBoxSize = freeze([boxes.devicePixelContentBoxSize]);
|
|
1915
|
+
}
|
|
1916
|
+
return ResizeObserverEntry2;
|
|
1917
|
+
}(), calculateDepthForNode = function(node) {
|
|
1918
|
+
if (isHidden(node))
|
|
1919
|
+
return 1 / 0;
|
|
1920
|
+
for (var depth = 0, parent = node.parentNode; parent; )
|
|
1921
|
+
depth += 1, parent = parent.parentNode;
|
|
1922
|
+
return depth;
|
|
1923
|
+
}, broadcastActiveObservations = function() {
|
|
1924
|
+
var shallowestDepth = 1 / 0, callbacks2 = [];
|
|
1925
|
+
resizeObservers.forEach(function(ro) {
|
|
1926
|
+
if (ro.activeTargets.length !== 0) {
|
|
1927
|
+
var entries = [];
|
|
1928
|
+
ro.activeTargets.forEach(function(ot) {
|
|
1929
|
+
var entry = new ResizeObserverEntry(ot.target), targetDepth = calculateDepthForNode(ot.target);
|
|
1930
|
+
entries.push(entry), ot.lastReportedSize = calculateBoxSize(ot.target, ot.observedBox), targetDepth < shallowestDepth && (shallowestDepth = targetDepth);
|
|
1931
|
+
}), callbacks2.push(function() {
|
|
1932
|
+
ro.callback.call(ro.observer, entries, ro.observer);
|
|
1933
|
+
}), ro.activeTargets.splice(0, ro.activeTargets.length);
|
|
2068
1934
|
}
|
|
2069
|
-
);
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
}
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
1935
|
+
});
|
|
1936
|
+
for (var _i = 0, callbacks_1 = callbacks2; _i < callbacks_1.length; _i++) {
|
|
1937
|
+
var callback = callbacks_1[_i];
|
|
1938
|
+
callback();
|
|
1939
|
+
}
|
|
1940
|
+
return shallowestDepth;
|
|
1941
|
+
}, gatherActiveObservationsAtDepth = function(depth) {
|
|
1942
|
+
resizeObservers.forEach(function(ro) {
|
|
1943
|
+
ro.activeTargets.splice(0, ro.activeTargets.length), ro.skippedTargets.splice(0, ro.skippedTargets.length), ro.observationTargets.forEach(function(ot) {
|
|
1944
|
+
ot.isActive() && (calculateDepthForNode(ot.target) > depth ? ro.activeTargets.push(ot) : ro.skippedTargets.push(ot));
|
|
1945
|
+
});
|
|
1946
|
+
});
|
|
1947
|
+
}, process = function() {
|
|
1948
|
+
var depth = 0;
|
|
1949
|
+
for (gatherActiveObservationsAtDepth(depth); hasActiveObservations(); )
|
|
1950
|
+
depth = broadcastActiveObservations(), gatherActiveObservationsAtDepth(depth);
|
|
1951
|
+
return hasSkippedObservations() && deliverResizeLoopError(), depth > 0;
|
|
1952
|
+
}, trigger, callbacks = [], notify = function() {
|
|
1953
|
+
return callbacks.splice(0).forEach(function(cb) {
|
|
1954
|
+
return cb();
|
|
1955
|
+
});
|
|
1956
|
+
}, queueMicroTask = function(callback) {
|
|
1957
|
+
if (!trigger) {
|
|
1958
|
+
var toggle_1 = 0, el_1 = document.createTextNode(""), config = { characterData: !0 };
|
|
1959
|
+
new MutationObserver(function() {
|
|
1960
|
+
return notify();
|
|
1961
|
+
}).observe(el_1, config), trigger = function() {
|
|
1962
|
+
el_1.textContent = "".concat(toggle_1 ? toggle_1-- : toggle_1++);
|
|
1963
|
+
};
|
|
1964
|
+
}
|
|
1965
|
+
callbacks.push(callback), trigger();
|
|
1966
|
+
}, queueResizeObserver = function(cb) {
|
|
1967
|
+
queueMicroTask(function() {
|
|
1968
|
+
requestAnimationFrame(cb);
|
|
1969
|
+
});
|
|
1970
|
+
}, watching = 0, isWatching = function() {
|
|
1971
|
+
return !!watching;
|
|
1972
|
+
}, CATCH_PERIOD = 250, observerConfig = { attributes: !0, characterData: !0, childList: !0, subtree: !0 }, events = [
|
|
1973
|
+
"resize",
|
|
1974
|
+
"load",
|
|
1975
|
+
"transitionend",
|
|
1976
|
+
"animationend",
|
|
1977
|
+
"animationstart",
|
|
1978
|
+
"animationiteration",
|
|
1979
|
+
"keyup",
|
|
1980
|
+
"keydown",
|
|
1981
|
+
"mouseup",
|
|
1982
|
+
"mousedown",
|
|
1983
|
+
"mouseover",
|
|
1984
|
+
"mouseout",
|
|
1985
|
+
"blur",
|
|
1986
|
+
"focus"
|
|
1987
|
+
], time = function(timeout) {
|
|
1988
|
+
return timeout === void 0 && (timeout = 0), Date.now() + timeout;
|
|
1989
|
+
}, scheduled = !1, Scheduler = function() {
|
|
1990
|
+
function Scheduler2() {
|
|
1991
|
+
var _this = this;
|
|
1992
|
+
this.stopped = !0, this.listener = function() {
|
|
1993
|
+
return _this.schedule();
|
|
1994
|
+
};
|
|
1995
|
+
}
|
|
1996
|
+
return Scheduler2.prototype.run = function(timeout) {
|
|
1997
|
+
var _this = this;
|
|
1998
|
+
if (timeout === void 0 && (timeout = CATCH_PERIOD), !scheduled) {
|
|
1999
|
+
scheduled = !0;
|
|
2000
|
+
var until = time(timeout);
|
|
2001
|
+
queueResizeObserver(function() {
|
|
2002
|
+
var elementsHaveResized = !1;
|
|
2003
|
+
try {
|
|
2004
|
+
elementsHaveResized = process();
|
|
2005
|
+
} finally {
|
|
2006
|
+
if (scheduled = !1, timeout = until - time(), !isWatching())
|
|
2007
|
+
return;
|
|
2008
|
+
elementsHaveResized ? _this.run(1e3) : timeout > 0 ? _this.run(timeout) : _this.start();
|
|
2009
|
+
}
|
|
2010
|
+
});
|
|
2093
2011
|
}
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2012
|
+
}, Scheduler2.prototype.schedule = function() {
|
|
2013
|
+
this.stop(), this.run();
|
|
2014
|
+
}, Scheduler2.prototype.observe = function() {
|
|
2015
|
+
var _this = this, cb = function() {
|
|
2016
|
+
return _this.observer && _this.observer.observe(document.body, observerConfig);
|
|
2017
|
+
};
|
|
2018
|
+
document.body ? cb() : global$1.addEventListener("DOMContentLoaded", cb);
|
|
2019
|
+
}, Scheduler2.prototype.start = function() {
|
|
2020
|
+
var _this = this;
|
|
2021
|
+
this.stopped && (this.stopped = !1, this.observer = new MutationObserver(this.listener), this.observe(), events.forEach(function(name) {
|
|
2022
|
+
return global$1.addEventListener(name, _this.listener, !0);
|
|
2023
|
+
}));
|
|
2024
|
+
}, Scheduler2.prototype.stop = function() {
|
|
2025
|
+
var _this = this;
|
|
2026
|
+
this.stopped || (this.observer && this.observer.disconnect(), events.forEach(function(name) {
|
|
2027
|
+
return global$1.removeEventListener(name, _this.listener, !0);
|
|
2028
|
+
}), this.stopped = !0);
|
|
2029
|
+
}, Scheduler2;
|
|
2030
|
+
}(), scheduler = new Scheduler(), updateCount = function(n) {
|
|
2031
|
+
!watching && n > 0 && scheduler.start(), watching += n, !watching && scheduler.stop();
|
|
2032
|
+
}, skipNotifyOnElement = function(target) {
|
|
2033
|
+
return !isSVG(target) && !isReplacedElement(target) && getComputedStyle(target).display === "inline";
|
|
2034
|
+
}, ResizeObservation = function() {
|
|
2035
|
+
function ResizeObservation2(target, observedBox) {
|
|
2036
|
+
this.target = target, this.observedBox = observedBox || ResizeObserverBoxOptions.CONTENT_BOX, this.lastReportedSize = {
|
|
2037
|
+
inlineSize: 0,
|
|
2038
|
+
blockSize: 0
|
|
2039
|
+
};
|
|
2040
|
+
}
|
|
2041
|
+
return ResizeObservation2.prototype.isActive = function() {
|
|
2042
|
+
var size2 = calculateBoxSize(this.target, this.observedBox, !0);
|
|
2043
|
+
return skipNotifyOnElement(this.target) && (this.lastReportedSize = size2), this.lastReportedSize.inlineSize !== size2.inlineSize || this.lastReportedSize.blockSize !== size2.blockSize;
|
|
2044
|
+
}, ResizeObservation2;
|
|
2045
|
+
}(), ResizeObserverDetail = /* @__PURE__ */ function() {
|
|
2046
|
+
function ResizeObserverDetail2(resizeObserver, callback) {
|
|
2047
|
+
this.activeTargets = [], this.skippedTargets = [], this.observationTargets = [], this.observer = resizeObserver, this.callback = callback;
|
|
2048
|
+
}
|
|
2049
|
+
return ResizeObserverDetail2;
|
|
2050
|
+
}(), observerMap = /* @__PURE__ */ new WeakMap(), getObservationIndex = function(observationTargets, target) {
|
|
2051
|
+
for (var i = 0; i < observationTargets.length; i += 1)
|
|
2052
|
+
if (observationTargets[i].target === target)
|
|
2053
|
+
return i;
|
|
2054
|
+
return -1;
|
|
2055
|
+
}, ResizeObserverController = function() {
|
|
2056
|
+
function ResizeObserverController2() {
|
|
2057
|
+
}
|
|
2058
|
+
return ResizeObserverController2.connect = function(resizeObserver, callback) {
|
|
2059
|
+
var detail = new ResizeObserverDetail(resizeObserver, callback);
|
|
2060
|
+
observerMap.set(resizeObserver, detail);
|
|
2061
|
+
}, ResizeObserverController2.observe = function(resizeObserver, target, options) {
|
|
2062
|
+
var detail = observerMap.get(resizeObserver), firstObservation = detail.observationTargets.length === 0;
|
|
2063
|
+
getObservationIndex(detail.observationTargets, target) < 0 && (firstObservation && resizeObservers.push(detail), detail.observationTargets.push(new ResizeObservation(target, options && options.box)), updateCount(1), scheduler.schedule());
|
|
2064
|
+
}, ResizeObserverController2.unobserve = function(resizeObserver, target) {
|
|
2065
|
+
var detail = observerMap.get(resizeObserver), index = getObservationIndex(detail.observationTargets, target), lastObservation = detail.observationTargets.length === 1;
|
|
2066
|
+
index >= 0 && (lastObservation && resizeObservers.splice(resizeObservers.indexOf(detail), 1), detail.observationTargets.splice(index, 1), updateCount(-1));
|
|
2067
|
+
}, ResizeObserverController2.disconnect = function(resizeObserver) {
|
|
2068
|
+
var _this = this, detail = observerMap.get(resizeObserver);
|
|
2069
|
+
detail.observationTargets.slice().forEach(function(ot) {
|
|
2070
|
+
return _this.unobserve(resizeObserver, ot.target);
|
|
2071
|
+
}), detail.activeTargets.splice(0, detail.activeTargets.length);
|
|
2072
|
+
}, ResizeObserverController2;
|
|
2073
|
+
}(), ResizeObserver = function() {
|
|
2074
|
+
function ResizeObserver2(callback) {
|
|
2075
|
+
if (arguments.length === 0)
|
|
2076
|
+
throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");
|
|
2077
|
+
if (typeof callback != "function")
|
|
2078
|
+
throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");
|
|
2079
|
+
ResizeObserverController.connect(this, callback);
|
|
2080
|
+
}
|
|
2081
|
+
return ResizeObserver2.prototype.observe = function(target, options) {
|
|
2082
|
+
if (arguments.length === 0)
|
|
2083
|
+
throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");
|
|
2084
|
+
if (!isElement(target))
|
|
2085
|
+
throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");
|
|
2086
|
+
ResizeObserverController.observe(this, target, options);
|
|
2087
|
+
}, ResizeObserver2.prototype.unobserve = function(target) {
|
|
2088
|
+
if (arguments.length === 0)
|
|
2089
|
+
throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");
|
|
2090
|
+
if (!isElement(target))
|
|
2091
|
+
throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");
|
|
2092
|
+
ResizeObserverController.unobserve(this, target);
|
|
2093
|
+
}, ResizeObserver2.prototype.disconnect = function() {
|
|
2094
|
+
ResizeObserverController.disconnect(this);
|
|
2095
|
+
}, ResizeObserver2.toString = function() {
|
|
2096
|
+
return "function ResizeObserver () { [polyfill code] }";
|
|
2097
|
+
}, ResizeObserver2;
|
|
2098
|
+
}();
|
|
2099
|
+
const _ResizeObserver = typeof document < "u" && typeof window < "u" && window.ResizeObserver ? window.ResizeObserver : ResizeObserver, _elementSizeObserver = _createElementSizeObserver();
|
|
2100
|
+
function _createElementRectValueListener() {
|
|
2101
|
+
return {
|
|
2102
|
+
subscribe(element, subscriber) {
|
|
2103
|
+
const resizeObserver = new _ResizeObserver(([entry]) => {
|
|
2104
|
+
subscriber({
|
|
2105
|
+
_contentRect: entry.contentRect,
|
|
2106
|
+
border: {
|
|
2107
|
+
width: entry.borderBoxSize[0].inlineSize,
|
|
2108
|
+
height: entry.borderBoxSize[0].blockSize
|
|
2109
|
+
},
|
|
2110
|
+
content: {
|
|
2111
|
+
width: entry.contentRect.width,
|
|
2112
|
+
height: entry.contentRect.height
|
|
2113
|
+
}
|
|
2114
|
+
});
|
|
2115
|
+
});
|
|
2116
|
+
return resizeObserver.observe(element), () => {
|
|
2117
|
+
resizeObserver.unobserve(element), resizeObserver.disconnect();
|
|
2118
|
+
};
|
|
2099
2119
|
}
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2120
|
+
};
|
|
2121
|
+
}
|
|
2122
|
+
function _createElementSizeObserver() {
|
|
2123
|
+
const disposeCache = /* @__PURE__ */ new WeakMap(), subscribersCache = /* @__PURE__ */ new WeakMap();
|
|
2124
|
+
return {
|
|
2125
|
+
subscribe(element, subscriber) {
|
|
2126
|
+
const subscribers = subscribersCache.get(element) || [];
|
|
2127
|
+
let dispose = disposeCache.get(element);
|
|
2128
|
+
return subscribersCache.has(element) || (subscribersCache.set(element, subscribers), dispose = _createElementRectValueListener().subscribe(element, (elementRect) => {
|
|
2129
|
+
for (const sub of subscribers)
|
|
2130
|
+
sub(elementRect);
|
|
2131
|
+
})), subscribers.push(subscriber), () => {
|
|
2132
|
+
const idx = subscribers.indexOf(subscriber);
|
|
2133
|
+
idx > -1 && subscribers.splice(idx, 1), subscribers.length === 0 && dispose && dispose();
|
|
2134
|
+
};
|
|
2104
2135
|
}
|
|
2105
|
-
|
|
2136
|
+
};
|
|
2106
2137
|
}
|
|
2107
|
-
function
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
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
|
-
}
|
|
2138
|
+
function useElementSize(element) {
|
|
2139
|
+
const [size2, setSize] = useState(null);
|
|
2140
|
+
return useEffect(() => {
|
|
2141
|
+
if (element)
|
|
2142
|
+
return _elementSizeObserver.subscribe(element, setSize);
|
|
2143
|
+
}, [element]), size2;
|
|
2144
|
+
}
|
|
2145
|
+
function useElementRect(element) {
|
|
2146
|
+
const elementSize = useElementSize(element);
|
|
2147
|
+
return (elementSize == null ? void 0 : elementSize._contentRect) || null;
|
|
2148
|
+
}
|
|
2149
|
+
function useGlobalKeyDown(onKeyDown) {
|
|
2150
|
+
return useEffect(() => (addEventListener("keydown", onKeyDown), () => removeEventListener("keydown", onKeyDown)), [onKeyDown]);
|
|
2151
|
+
}
|
|
2152
|
+
const MEDIA_STORE_CACHE = /* @__PURE__ */ new WeakMap();
|
|
2153
|
+
function _getMediaQuery(media, index) {
|
|
2154
|
+
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)`;
|
|
2155
|
+
}
|
|
2156
|
+
function _createMediaStore(media) {
|
|
2157
|
+
const mediaLen = media.length;
|
|
2158
|
+
let sizes;
|
|
2159
|
+
const getSizes = () => {
|
|
2160
|
+
if (!sizes) {
|
|
2161
|
+
sizes = [];
|
|
2162
|
+
for (let index = mediaLen; index > -1; index -= 1) {
|
|
2163
|
+
const mediaQuery = _getMediaQuery(media, index);
|
|
2164
|
+
sizes.push({ index, mq: window.matchMedia(mediaQuery) });
|
|
2154
2165
|
}
|
|
2155
2166
|
}
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
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
|
-
}
|
|
2167
|
+
return sizes;
|
|
2168
|
+
};
|
|
2169
|
+
return { getSnapshot: () => {
|
|
2170
|
+
for (const { index, mq } of getSizes())
|
|
2171
|
+
if (mq.matches) return index;
|
|
2172
|
+
return 0;
|
|
2173
|
+
}, subscribe: (onStoreChange) => {
|
|
2174
|
+
const disposeFns = [];
|
|
2175
|
+
for (const { mq } of getSizes()) {
|
|
2176
|
+
const handleChange = () => {
|
|
2177
|
+
mq.matches && onStoreChange();
|
|
2178
|
+
};
|
|
2179
|
+
mq.addEventListener("change", handleChange), disposeFns.push(() => mq.removeEventListener("change", handleChange));
|
|
2192
2180
|
}
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2181
|
+
return () => {
|
|
2182
|
+
for (const disposeFn of disposeFns)
|
|
2183
|
+
disposeFn();
|
|
2184
|
+
};
|
|
2185
|
+
} };
|
|
2186
|
+
}
|
|
2187
|
+
function getServerSnapshot$2() {
|
|
2188
|
+
return 0;
|
|
2189
|
+
}
|
|
2190
|
+
function useMediaIndex() {
|
|
2191
|
+
const { media } = useTheme_v2();
|
|
2192
|
+
let store = MEDIA_STORE_CACHE.get(media);
|
|
2193
|
+
return store || (store = _createMediaStore(media), MEDIA_STORE_CACHE.set(media, store)), useSyncExternalStore(store.subscribe, store.getSnapshot, getServerSnapshot$2);
|
|
2194
|
+
}
|
|
2195
|
+
let MEDIA_QUERY_CACHE$1;
|
|
2196
|
+
function getMatchMedia$1() {
|
|
2197
|
+
return MEDIA_QUERY_CACHE$1 || (MEDIA_QUERY_CACHE$1 = window.matchMedia("(prefers-color-scheme: dark)")), MEDIA_QUERY_CACHE$1;
|
|
2198
|
+
}
|
|
2199
|
+
function subscribe$2(onStoreChange) {
|
|
2200
|
+
const matchMedia = getMatchMedia$1();
|
|
2201
|
+
return matchMedia.addEventListener("change", onStoreChange), () => matchMedia.removeEventListener("change", onStoreChange);
|
|
2202
|
+
}
|
|
2203
|
+
function getSnapshot$1() {
|
|
2204
|
+
return getMatchMedia$1().matches;
|
|
2205
|
+
}
|
|
2206
|
+
function getServerSnapshot$1() {
|
|
2207
|
+
return !1;
|
|
2208
|
+
}
|
|
2209
|
+
function usePrefersDark() {
|
|
2210
|
+
return useSyncExternalStore(subscribe$2, getSnapshot$1, getServerSnapshot$1);
|
|
2211
|
+
}
|
|
2212
|
+
let MEDIA_QUERY_CACHE;
|
|
2213
|
+
function getMatchMedia() {
|
|
2214
|
+
return MEDIA_QUERY_CACHE || (MEDIA_QUERY_CACHE = window.matchMedia("(prefers-reduced-motion: reduce)")), MEDIA_QUERY_CACHE;
|
|
2215
|
+
}
|
|
2216
|
+
function subscribe$1(onStoreChange) {
|
|
2217
|
+
const matchMedia = getMatchMedia();
|
|
2218
|
+
return matchMedia.addEventListener("change", onStoreChange), () => matchMedia.removeEventListener("change", onStoreChange);
|
|
2219
|
+
}
|
|
2220
|
+
function getSnapshot() {
|
|
2221
|
+
return getMatchMedia().matches;
|
|
2222
|
+
}
|
|
2223
|
+
function getServerSnapshot() {
|
|
2224
|
+
return !1;
|
|
2225
|
+
}
|
|
2226
|
+
function usePrefersReducedMotion() {
|
|
2227
|
+
return useSyncExternalStore(subscribe$1, getSnapshot, getServerSnapshot);
|
|
2228
|
+
}
|
|
2229
|
+
function useForwardedRef(ref) {
|
|
2230
|
+
const innerRef = useRef(null);
|
|
2231
|
+
return useImperativeHandle(ref, () => innerRef.current), innerRef;
|
|
2232
|
+
}
|
|
2233
|
+
function useCustomValidity(ref, customValidity) {
|
|
2234
|
+
useEffect(() => {
|
|
2235
|
+
var _a;
|
|
2236
|
+
(_a = ref.current) == null || _a.setCustomValidity(customValidity || "");
|
|
2237
|
+
}, [customValidity, ref]);
|
|
2196
2238
|
}
|
|
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
2239
|
function checkboxBaseStyles() {
|
|
2245
2240
|
return css`
|
|
2246
2241
|
position: relative;
|
|
@@ -2469,8 +2464,8 @@ function codeBaseStyle() {
|
|
|
2469
2464
|
`;
|
|
2470
2465
|
}
|
|
2471
2466
|
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
|
|
2467
|
+
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]);
|
|
2468
|
+
return /* @__PURE__ */ jsxs(Root$q, { "data-ui": "Code", ...restProps, $size, $weight: weight, ref, children: [
|
|
2474
2469
|
!(language && registered) && /* @__PURE__ */ jsx("code", { children }),
|
|
2475
2470
|
language && registered && /* @__PURE__ */ jsx(Refractor, { inline: !0, language, value: String(children) })
|
|
2476
2471
|
] });
|
|
@@ -2491,33 +2486,24 @@ const Root$p = styled(Box)(
|
|
|
2491
2486
|
containerBaseStyle,
|
|
2492
2487
|
responsiveContainerWidthStyle
|
|
2493
2488
|
), 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
|
-
);
|
|
2489
|
+
const { as, width = 2, ...restProps } = props, $width = useMemo(() => _getArrayProp(width), [width]);
|
|
2490
|
+
return /* @__PURE__ */ jsx(Root$p, { "data-ui": "Container", ...restProps, $width, forwardedAs: as, ref });
|
|
2505
2491
|
}), Root$o = styled(Box)(responsiveGridStyle), Grid = forwardRef(function(props, ref) {
|
|
2506
|
-
const { as, autoRows, autoCols, autoFlow, columns, gap, gapX, gapY, rows, children, ...restProps } = props;
|
|
2492
|
+
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
2493
|
return /* @__PURE__ */ jsx(
|
|
2508
2494
|
Root$o,
|
|
2509
2495
|
{
|
|
2510
2496
|
"data-as": typeof as == "string" ? as : void 0,
|
|
2511
2497
|
"data-ui": "Grid",
|
|
2512
2498
|
...restProps,
|
|
2513
|
-
$autoRows
|
|
2514
|
-
$autoCols
|
|
2515
|
-
$autoFlow
|
|
2516
|
-
$columns
|
|
2517
|
-
$gap
|
|
2518
|
-
$gapX
|
|
2519
|
-
$gapY
|
|
2520
|
-
$rows
|
|
2499
|
+
$autoRows,
|
|
2500
|
+
$autoCols,
|
|
2501
|
+
$autoFlow,
|
|
2502
|
+
$columns,
|
|
2503
|
+
$gap,
|
|
2504
|
+
$gapX,
|
|
2505
|
+
$gapY,
|
|
2506
|
+
$rows,
|
|
2521
2507
|
forwardedAs: as,
|
|
2522
2508
|
ref,
|
|
2523
2509
|
children
|
|
@@ -2594,7 +2580,7 @@ const Root$n = styled.div(headingBaseStyle, responsiveTextAlignStyle, responsive
|
|
|
2594
2580
|
textOverflow,
|
|
2595
2581
|
weight,
|
|
2596
2582
|
...restProps
|
|
2597
|
-
} = props;
|
|
2583
|
+
} = props, $size = useMemo(() => _getArrayProp(size2), [size2]), $align = useMemo(() => _getArrayProp(align), [align]);
|
|
2598
2584
|
let children = childrenProp;
|
|
2599
2585
|
return textOverflow === "ellipsis" && (children = /* @__PURE__ */ jsx(SpanWithTextOverflow, { children })), /* @__PURE__ */ jsx(
|
|
2600
2586
|
Root$n,
|
|
@@ -2602,9 +2588,9 @@ const Root$n = styled.div(headingBaseStyle, responsiveTextAlignStyle, responsive
|
|
|
2602
2588
|
"data-ui": "Heading",
|
|
2603
2589
|
...restProps,
|
|
2604
2590
|
$accent: accent,
|
|
2605
|
-
$align
|
|
2591
|
+
$align,
|
|
2592
|
+
$size,
|
|
2606
2593
|
$muted: muted,
|
|
2607
|
-
$size: useArrayProp(size2),
|
|
2608
2594
|
$weight: weight,
|
|
2609
2595
|
ref,
|
|
2610
2596
|
children: /* @__PURE__ */ jsx("span", { children })
|
|
@@ -2634,7 +2620,7 @@ function inlineSpaceStyle(props) {
|
|
|
2634
2620
|
});
|
|
2635
2621
|
}
|
|
2636
2622
|
const Root$m = styled(Box)(inlineBaseStyle, inlineSpaceStyle), Inline = forwardRef(function(props, ref) {
|
|
2637
|
-
const { as, children: childrenProp, space, ...restProps } = props, children = useMemo(
|
|
2623
|
+
const { as, children: childrenProp, space, ...restProps } = props, $space = useMemo(() => _getArrayProp(space), [space]), children = useMemo(
|
|
2638
2624
|
() => Children.map(childrenProp, (child) => child && /* @__PURE__ */ jsx("div", { children: child })),
|
|
2639
2625
|
[childrenProp]
|
|
2640
2626
|
);
|
|
@@ -2643,7 +2629,7 @@ const Root$m = styled(Box)(inlineBaseStyle, inlineSpaceStyle), Inline = forwardR
|
|
|
2643
2629
|
{
|
|
2644
2630
|
"data-ui": "Inline",
|
|
2645
2631
|
...restProps,
|
|
2646
|
-
$space
|
|
2632
|
+
$space,
|
|
2647
2633
|
forwardedAs: as,
|
|
2648
2634
|
ref,
|
|
2649
2635
|
children
|
|
@@ -2668,8 +2654,8 @@ function kbdStyle() {
|
|
|
2668
2654
|
`;
|
|
2669
2655
|
}
|
|
2670
2656
|
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
|
|
2657
|
+
const { children, fontSize: fontSize2 = 0, padding = 1, radius = 2, ...restProps } = props, $radius = useMemo(() => _getArrayProp(radius), [radius]);
|
|
2658
|
+
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
2659
|
}), origin = {
|
|
2674
2660
|
name: "@sanity/ui/origin",
|
|
2675
2661
|
fn({ middlewareData, placement, rects }) {
|
|
@@ -2989,7 +2975,7 @@ function _isScrollable(el) {
|
|
|
2989
2975
|
}
|
|
2990
2976
|
function LayerProvider(props) {
|
|
2991
2977
|
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 =
|
|
2978
|
+
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
2979
|
(childLevel) => {
|
|
2994
2980
|
const parentDispose = parentRegisterChild == null ? void 0 : parentRegisterChild(childLevel);
|
|
2995
2981
|
return childLevel !== void 0 ? setChildLayers((state) => {
|
|
@@ -3318,7 +3304,7 @@ const Popover = memo(
|
|
|
3318
3304
|
zOffset: zOffsetProp = layer.popover.zOffset,
|
|
3319
3305
|
updateRef,
|
|
3320
3306
|
...restProps
|
|
3321
|
-
} = props, animate = usePrefersReducedMotion() ? !1 : _animate, boundarySize = (_e = useElementSize(boundaryElement)) == null ? void 0 : _e.border, padding =
|
|
3307
|
+
} = 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
3308
|
useImperativeHandle(
|
|
3323
3309
|
forwardedRef,
|
|
3324
3310
|
() => ref.current
|
|
@@ -3744,20 +3730,22 @@ const selectStyle = {
|
|
|
3744
3730
|
space = 3,
|
|
3745
3731
|
...restProps
|
|
3746
3732
|
} = props, ref = useRef(null);
|
|
3747
|
-
|
|
3733
|
+
useImperativeHandle(
|
|
3748
3734
|
forwardedRef,
|
|
3749
3735
|
() => ref.current
|
|
3750
|
-
), useCustomValidity(ref, customValidity)
|
|
3736
|
+
), useCustomValidity(ref, customValidity);
|
|
3737
|
+
const $fontSize = useMemo(() => _getArrayProp(fontSize2), [fontSize2]), $padding = useMemo(() => _getArrayProp(padding), [padding]), $radius = useMemo(() => _getArrayProp(radius), [radius]), $space = useMemo(() => _getArrayProp(space), [space]);
|
|
3738
|
+
return /* @__PURE__ */ jsxs(Root$f, { "data-ui": "Select", children: [
|
|
3751
3739
|
/* @__PURE__ */ jsx(
|
|
3752
3740
|
Input$3,
|
|
3753
3741
|
{
|
|
3754
3742
|
"data-read-only": !disabled && readOnly ? "" : void 0,
|
|
3755
3743
|
"data-ui": "Select",
|
|
3756
3744
|
...restProps,
|
|
3757
|
-
$fontSize
|
|
3758
|
-
$padding
|
|
3759
|
-
$radius
|
|
3760
|
-
$space
|
|
3745
|
+
$fontSize,
|
|
3746
|
+
$padding,
|
|
3747
|
+
$radius,
|
|
3748
|
+
$space,
|
|
3761
3749
|
disabled: disabled || readOnly,
|
|
3762
3750
|
ref,
|
|
3763
3751
|
children
|
|
@@ -3785,14 +3773,14 @@ function responsiveStackSpaceStyle(props) {
|
|
|
3785
3773
|
}));
|
|
3786
3774
|
}
|
|
3787
3775
|
const Root$e = styled(Box)(stackBaseStyle, responsiveStackSpaceStyle), Stack = forwardRef(function(props, ref) {
|
|
3788
|
-
const { as, space, ...restProps } = props;
|
|
3776
|
+
const { as, space, ...restProps } = props, $space = useMemo(() => _getArrayProp(space), [space]);
|
|
3789
3777
|
return /* @__PURE__ */ jsx(
|
|
3790
3778
|
Root$e,
|
|
3791
3779
|
{
|
|
3792
3780
|
"data-as": typeof as == "string" ? as : void 0,
|
|
3793
3781
|
"data-ui": "Stack",
|
|
3794
3782
|
...restProps,
|
|
3795
|
-
$space
|
|
3783
|
+
$space,
|
|
3796
3784
|
forwardedAs: as,
|
|
3797
3785
|
ref
|
|
3798
3786
|
}
|
|
@@ -3987,10 +3975,12 @@ const Root$d = styled.span(switchBaseStyles), Input$2 = styled.input(switchInput
|
|
|
3987
3975
|
weight,
|
|
3988
3976
|
...restProps
|
|
3989
3977
|
} = props, ref = useRef(null), rootTheme = useRootTheme();
|
|
3990
|
-
|
|
3978
|
+
useImperativeHandle(
|
|
3991
3979
|
forwardedRef,
|
|
3992
3980
|
() => ref.current
|
|
3993
|
-
), useCustomValidity(ref, customValidity)
|
|
3981
|
+
), useCustomValidity(ref, customValidity);
|
|
3982
|
+
const $radius = useMemo(() => _getArrayProp(radius), [radius]), $fontSize = useMemo(() => _getArrayProp(fontSize2), [fontSize2]), $padding = useMemo(() => _getArrayProp(padding), [padding]), $space = useMemo(() => _getArrayProp(0), []);
|
|
3983
|
+
return /* @__PURE__ */ jsx(Root$c, { "data-ui": "TextArea", children: /* @__PURE__ */ jsxs(InputRoot$1, { children: [
|
|
3994
3984
|
/* @__PURE__ */ jsx(
|
|
3995
3985
|
Input$1,
|
|
3996
3986
|
{
|
|
@@ -3998,10 +3988,10 @@ const Root$d = styled.span(switchBaseStyles), Input$2 = styled.input(switchInput
|
|
|
3998
3988
|
"data-scheme": rootTheme.scheme,
|
|
3999
3989
|
"data-tone": rootTheme.tone,
|
|
4000
3990
|
...restProps,
|
|
4001
|
-
$fontSize
|
|
4002
|
-
$padding
|
|
3991
|
+
$fontSize,
|
|
3992
|
+
$padding,
|
|
3993
|
+
$space,
|
|
4003
3994
|
$scheme: rootTheme.scheme,
|
|
4004
|
-
$space: useArrayProp(0),
|
|
4005
3995
|
$tone: rootTheme.tone,
|
|
4006
3996
|
$weight: weight,
|
|
4007
3997
|
disabled,
|
|
@@ -4011,7 +4001,7 @@ const Root$d = styled.span(switchBaseStyles), Input$2 = styled.input(switchInput
|
|
|
4011
4001
|
/* @__PURE__ */ jsx(
|
|
4012
4002
|
Presentation$1,
|
|
4013
4003
|
{
|
|
4014
|
-
$radius
|
|
4004
|
+
$radius,
|
|
4015
4005
|
$scheme: rootTheme.scheme,
|
|
4016
4006
|
$tone: rootTheme.tone,
|
|
4017
4007
|
"data-border": border2 ? "" : void 0,
|
|
@@ -4085,7 +4075,7 @@ const Root$d = styled.span(switchBaseStyles), Input$2 = styled.input(switchInput
|
|
|
4085
4075
|
type = "text",
|
|
4086
4076
|
weight,
|
|
4087
4077
|
...restProps
|
|
4088
|
-
} = props, ref = useRef(null), rootTheme = useRootTheme(), fontSize2 =
|
|
4078
|
+
} = 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
4079
|
useImperativeHandle(
|
|
4090
4080
|
forwardedRef,
|
|
4091
4081
|
() => ref.current
|
|
@@ -4355,7 +4345,10 @@ const Root$a = styled(Layer)`
|
|
|
4355
4345
|
zOffset = layer.tooltip.zOffset,
|
|
4356
4346
|
delay,
|
|
4357
4347
|
...restProps
|
|
4358
|
-
} = props, animate = usePrefersReducedMotion() ? !1 : _animate, fallbackPlacements =
|
|
4348
|
+
} = props, animate = usePrefersReducedMotion() ? !1 : _animate, fallbackPlacements = useMemo(
|
|
4349
|
+
() => _getArrayProp(fallbackPlacementsProp),
|
|
4350
|
+
[fallbackPlacementsProp]
|
|
4351
|
+
), ref = useRef(null), [referenceElement, setReferenceElement] = useState(null), arrowRef = useRef(null), rootBoundary = "viewport";
|
|
4359
4352
|
useImperativeHandle(forwardedRef, () => ref.current);
|
|
4360
4353
|
const portal = usePortal(), portalElement = typeof portalProp == "string" ? ((_c = portal.elements) == null ? void 0 : _c[portalProp]) || null : portal.element, documentBodyOffsetWidth = useSyncExternalStore(
|
|
4361
4354
|
emptySubscribe,
|
|
@@ -4644,7 +4637,7 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = [
|
|
|
4644
4637
|
forwardedRef,
|
|
4645
4638
|
() => inputElementRef.current
|
|
4646
4639
|
);
|
|
4647
|
-
const listBoxId = `${id}-listbox`, options = Array.isArray(optionsProp) ? optionsProp : EMPTY_ARRAY, padding =
|
|
4640
|
+
const listBoxId = `${id}-listbox`, options = Array.isArray(optionsProp) ? optionsProp : EMPTY_ARRAY, padding = useMemo(() => _getArrayProp(paddingProp), [paddingProp]), currentOption = useMemo(
|
|
4648
4641
|
() => value !== null ? options.find((o) => o.value === value) : void 0,
|
|
4649
4642
|
[options, value]
|
|
4650
4643
|
), filteredOptions = useMemo(
|
|
@@ -4950,7 +4943,7 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = [
|
|
|
4950
4943
|
appearance: none;
|
|
4951
4944
|
margin: -4px;
|
|
4952
4945
|
`, Breadcrumbs = forwardRef(function(props, ref) {
|
|
4953
|
-
const { children, maxLength, separator, space: spaceRaw = 2, ...restProps } = props, space =
|
|
4946
|
+
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
4947
|
useClickOutside(collapse, [expandElement, popoverElement]);
|
|
4955
4948
|
const rawItems = useMemo(() => Children.toArray(children).filter(isValidElement), [children]), items = useMemo(() => {
|
|
4956
4949
|
const len = rawItems.length;
|
|
@@ -5099,7 +5092,7 @@ const Root$7 = styled(Layer)(responsivePaddingStyle, dialogStyle, responsiveDial
|
|
|
5099
5092
|
scheme,
|
|
5100
5093
|
shadow: shadowProp,
|
|
5101
5094
|
width: widthProp
|
|
5102
|
-
} = props, portal = usePortal(), portalElement = portalProp ? ((_a = portal.elements) == null ? void 0 : _a[portalProp]) || null : portal.element, boundaryElement = useBoundaryElement().element, radius =
|
|
5095
|
+
} = 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
5096
|
useImperativeHandle(forwardedRef, () => ref.current), useImperativeHandle(
|
|
5104
5097
|
forwardedContentRef,
|
|
5105
5098
|
() => contentRef.current
|
|
@@ -5170,7 +5163,7 @@ const Root$7 = styled(Layer)(responsivePaddingStyle, dialogStyle, responsiveDial
|
|
|
5170
5163
|
zOffset: zOffsetProp = dialog.zOffset || layer.dialog.zOffset,
|
|
5171
5164
|
animate: _animate = !1,
|
|
5172
5165
|
...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 =
|
|
5166
|
+
} = 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
5167
|
(event) => {
|
|
5175
5168
|
onFocus == null || onFocus(event);
|
|
5176
5169
|
const target = event.target, cardElement = cardRef.current;
|
|
@@ -5266,7 +5259,7 @@ const Root$6 = styled.kbd`
|
|
|
5266
5259
|
display: block;
|
|
5267
5260
|
}
|
|
5268
5261
|
`, Hotkeys = forwardRef(function(props, ref) {
|
|
5269
|
-
const { fontSize: fontSize2, keys, padding, radius, space: spaceProp = 0.5, ...restProps } = props, space =
|
|
5262
|
+
const { fontSize: fontSize2, keys, padding, radius, space: spaceProp = 0.5, ...restProps } = props, space = useMemo(() => _getArrayProp(spaceProp), [spaceProp]);
|
|
5270
5263
|
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
5264
|
}), key$2 = Symbol.for("@sanity/ui/context/menu"), MenuContext = createGlobalScopedContext(key$2, null);
|
|
5272
5265
|
function _isFocusable(element) {
|
|
@@ -5772,7 +5765,7 @@ function MenuGroup(props) {
|
|
|
5772
5765
|
onClick,
|
|
5773
5766
|
padding = 3,
|
|
5774
5767
|
popover,
|
|
5775
|
-
radius = 2,
|
|
5768
|
+
radius: radiusProp = 2,
|
|
5776
5769
|
space = 3,
|
|
5777
5770
|
text,
|
|
5778
5771
|
tone = "default",
|
|
@@ -5785,7 +5778,7 @@ function MenuGroup(props) {
|
|
|
5785
5778
|
onItemClick,
|
|
5786
5779
|
onItemMouseEnter = menu.onMouseEnter,
|
|
5787
5780
|
registerElement
|
|
5788
|
-
} = menu, [rootElement, setRootElement] = useState(null), [open, setOpen] = useState(!1), shouldFocusRef = useRef(null), active = !!activeElement && activeElement === rootElement, [withinMenu, setWithinMenu] = useState(!1), handleMouseEnter = useCallback(
|
|
5781
|
+
} = 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
5782
|
(event) => {
|
|
5790
5783
|
setWithinMenu(!1), onItemMouseEnter(event), setOpen(!0);
|
|
5791
5784
|
},
|
|
@@ -5843,7 +5836,7 @@ function MenuGroup(props) {
|
|
|
5843
5836
|
"aria-pressed": as === "button" ? withinMenu : void 0,
|
|
5844
5837
|
"data-pressed": as !== "button" ? withinMenu : void 0,
|
|
5845
5838
|
"data-selected": !withinMenu && active ? "" : void 0,
|
|
5846
|
-
$radius:
|
|
5839
|
+
$radius: radius,
|
|
5847
5840
|
$tone: tone,
|
|
5848
5841
|
$scheme: scheme,
|
|
5849
5842
|
onClick: handleClick,
|
|
@@ -5911,7 +5904,7 @@ const MenuItem = forwardRef(function(props, forwardedRef) {
|
|
|
5911
5904
|
paddingLeft
|
|
5912
5905
|
}),
|
|
5913
5906
|
[padding, paddingX, paddingY, paddingTop, paddingRight, paddingBottom, paddingLeft]
|
|
5914
|
-
), hotkeysFontSize =
|
|
5907
|
+
), hotkeysFontSize = useMemo(() => _getArrayProp(fontSize2).map((s) => s - 1), [fontSize2]), $radius = useMemo(() => _getArrayProp(radius), [radius]), $padding = useMemo(() => _getArrayProp(0), []), setRef = useCallback((el) => {
|
|
5915
5908
|
ref.current = el, setRootElement(el);
|
|
5916
5909
|
}, []);
|
|
5917
5910
|
return /* @__PURE__ */ jsxs(
|
|
@@ -5924,8 +5917,8 @@ const MenuItem = forwardRef(function(props, forwardedRef) {
|
|
|
5924
5917
|
"data-selected": active ? "" : void 0,
|
|
5925
5918
|
"data-disabled": disabled ? "" : void 0,
|
|
5926
5919
|
forwardedAs: as,
|
|
5927
|
-
$radius
|
|
5928
|
-
$padding
|
|
5920
|
+
$radius,
|
|
5921
|
+
$padding,
|
|
5929
5922
|
$tone: disabled ? "default" : tone,
|
|
5930
5923
|
$scheme: scheme,
|
|
5931
5924
|
disabled,
|
|
@@ -6001,7 +5994,7 @@ const MenuItem = forwardRef(function(props, forwardedRef) {
|
|
|
6001
5994
|
skeletonStyle
|
|
6002
5995
|
), Skeleton = forwardRef(function(props, ref) {
|
|
6003
5996
|
const { animated = !1, delay, radius, ...restProps } = props, [visible, setVisible] = useState(!delay);
|
|
6004
|
-
|
|
5997
|
+
useEffect(() => {
|
|
6005
5998
|
if (!delay)
|
|
6006
5999
|
return setVisible(!0);
|
|
6007
6000
|
const timeout = setTimeout(() => {
|
|
@@ -6010,16 +6003,9 @@ const MenuItem = forwardRef(function(props, forwardedRef) {
|
|
|
6010
6003
|
return () => {
|
|
6011
6004
|
clearTimeout(timeout);
|
|
6012
6005
|
};
|
|
6013
|
-
}, [delay])
|
|
6014
|
-
|
|
6015
|
-
|
|
6016
|
-
...restProps,
|
|
6017
|
-
$animated: animated,
|
|
6018
|
-
$radius: useArrayProp(radius),
|
|
6019
|
-
$visible: visible,
|
|
6020
|
-
ref
|
|
6021
|
-
}
|
|
6022
|
-
);
|
|
6006
|
+
}, [delay]);
|
|
6007
|
+
const $radius = useMemo(() => _getArrayProp(radius), [radius]);
|
|
6008
|
+
return /* @__PURE__ */ jsx(Root$4, { ...restProps, $animated: animated, $radius, $visible: visible, ref });
|
|
6023
6009
|
}), Root$3 = styled(Skeleton)((props) => {
|
|
6024
6010
|
const { $size, $style } = props, { font, media } = getTheme_v2(props.theme), fontStyle = font[$style];
|
|
6025
6011
|
return _responsive(media, $size, (sizeIndex) => {
|
|
@@ -6027,16 +6013,16 @@ const MenuItem = forwardRef(function(props, forwardedRef) {
|
|
|
6027
6013
|
return { height: fontSize2.lineHeight - fontSize2.ascenderHeight - fontSize2.descenderHeight };
|
|
6028
6014
|
});
|
|
6029
6015
|
}), TextSkeleton = forwardRef(function(props, ref) {
|
|
6030
|
-
const { size: size2 = 2, ...restProps } = props, $size =
|
|
6016
|
+
const { size: size2 = 2, ...restProps } = props, $size = useMemo(() => _getArrayProp(size2), [size2]);
|
|
6031
6017
|
return /* @__PURE__ */ jsx(Root$3, { ...restProps, $size, ref, $style: "text" });
|
|
6032
6018
|
}), LabelSkeleton = forwardRef(function(props, ref) {
|
|
6033
|
-
const { size: size2 = 2, ...restProps } = props, $size =
|
|
6019
|
+
const { size: size2 = 2, ...restProps } = props, $size = useMemo(() => _getArrayProp(size2), [size2]);
|
|
6034
6020
|
return /* @__PURE__ */ jsx(Root$3, { ...restProps, $size, ref, $style: "label" });
|
|
6035
6021
|
}), HeadingSkeleton = forwardRef(function(props, ref) {
|
|
6036
|
-
const { size: size2 = 2, ...restProps } = props, $size =
|
|
6022
|
+
const { size: size2 = 2, ...restProps } = props, $size = useMemo(() => _getArrayProp(size2), [size2]);
|
|
6037
6023
|
return /* @__PURE__ */ jsx(Root$3, { ...restProps, $size, ref, $style: "heading" });
|
|
6038
6024
|
}), CodeSkeleton = forwardRef(function(props, ref) {
|
|
6039
|
-
const { size: size2 = 2, ...restProps } = props, $size =
|
|
6025
|
+
const { size: size2 = 2, ...restProps } = props, $size = useMemo(() => _getArrayProp(size2), [size2]);
|
|
6040
6026
|
return /* @__PURE__ */ jsx(Root$3, { ...restProps, $size, ref, $style: "code" });
|
|
6041
6027
|
}), CustomButton = styled(Button)`
|
|
6042
6028
|
max-width: 100%;
|