@sanity/ui 2.3.6 → 2.3.7-canary.0
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 +7488 -0
- package/dist/index.compiled.mjs.map +1 -0
- package/dist/index.d.mts +13 -1
- package/dist/index.d.ts +13 -1
- package/dist/index.esm.js +1047 -1072
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1054 -1079
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1047 -1072
- package/dist/index.mjs.map +1 -1
- package/package.json +31 -35
- package/src/core/components/autocomplete/autocomplete.tsx +31 -34
- package/src/core/components/breadcrumbs/breadcrumbs.tsx +3 -2
- package/src/core/components/dialog/dialog.tsx +23 -12
- package/src/core/components/hotkeys/hotkeys.tsx +3 -3
- package/src/core/components/menu/menu.tsx +5 -1
- package/src/core/components/menu/menuButton.tsx +17 -32
- package/src/core/components/menu/menuGroup.tsx +7 -5
- package/src/core/components/menu/menuItem.tsx +10 -6
- package/src/core/components/skeleton/skeleton.tsx +5 -11
- package/src/core/components/skeleton/textSkeleton.tsx +6 -7
- package/src/core/components/toast/toastProvider.tsx +26 -24
- package/src/core/components/tree/treeItem.styles.ts +21 -0
- package/src/core/components/tree/treeItem.tsx +31 -44
- package/src/core/hooks/useArrayProp.ts +11 -10
- package/src/core/primitives/avatar/avatar.tsx +11 -15
- package/src/core/primitives/avatar/avatarCounter.tsx +11 -17
- package/src/core/primitives/avatar/avatarStack.tsx +3 -7
- 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 +49 -49
- 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 +14 -7
- package/src/core/theme/themeProvider.tsx +4 -6
- package/src/core/utils/elementQuery/elementQuery.tsx +4 -3
- package/src/core/utils/layer/getLayerContext.test.ts +0 -4
- package/src/core/utils/layer/layer.test.tsx +0 -2
- package/src/core/utils/layer/layerProvider.tsx +35 -43
- package/src/core/utils/layer/types.ts +0 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { buildTheme, createColorTheme as createColorTheme$1, hexToRgb as hexToRgb$1, hslToRgb as hslToRgb$1, multiply as multiply$1, parseColor as parseColor$1, rgbToHex as rgbToHex$1, rgbToHsl as rgbToHsl$1, rgba as rgba$1, screen as screen$1, getTheme_v2, getScopedTheme } from "@sanity/ui/theme";
|
|
2
2
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
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,141 @@ 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, _b, _c;
|
|
137
|
+
const { children } = props, parentTheme = useContext(ThemeContext), scheme = (_a = props.scheme) != null ? _a : (parentTheme == null ? void 0 : parentTheme.scheme) || "light", rootTheme = (_b = props.theme) != null ? _b : (parentTheme == null ? void 0 : parentTheme.theme) || null, tone = (_c = props.tone) != null ? _c : (parentTheme == null ? void 0 : parentTheme.tone) || "default", themeContext = useMemo(() => rootTheme ? {
|
|
138
|
+
version: 0,
|
|
139
|
+
theme: rootTheme,
|
|
140
|
+
scheme,
|
|
141
|
+
tone
|
|
142
|
+
} : null, [rootTheme, scheme, tone]), theme = useMemo(() => rootTheme ? getScopedTheme(rootTheme, scheme, tone) : null, [scheme, rootTheme, tone]);
|
|
143
|
+
return theme ? /* @__PURE__ */ jsx(ThemeContext.Provider, { value: themeContext, children: /* @__PURE__ */ jsx(ThemeProvider$1, { theme, children }) }) : /* @__PURE__ */ jsx("pre", { children: 'ThemeProvider: no "theme" property provided' });
|
|
144
|
+
}
|
|
145
|
+
function useRootTheme() {
|
|
146
|
+
const value = useContext(ThemeContext);
|
|
147
|
+
if (!value)
|
|
148
|
+
throw new Error("useRootTheme(): missing context value");
|
|
149
|
+
return value;
|
|
150
|
+
}
|
|
151
|
+
function ThemeColorProvider(props) {
|
|
152
|
+
const { children, scheme, tone } = props, root = useRootTheme();
|
|
153
|
+
return /* @__PURE__ */ jsx(ThemeProvider, { scheme: scheme || root.scheme, theme: root.theme, tone, children });
|
|
154
|
+
}
|
|
155
|
+
function useTheme() {
|
|
156
|
+
return useTheme$1();
|
|
157
|
+
}
|
|
158
|
+
function useTheme_v2() {
|
|
159
|
+
return getTheme_v2(useTheme$1());
|
|
160
|
+
}
|
|
161
|
+
function responsiveBorderStyle() {
|
|
162
|
+
return [border, borderTop, borderRight, borderBottom, borderLeft];
|
|
163
|
+
}
|
|
164
|
+
function border(props) {
|
|
165
|
+
var _a, _b;
|
|
166
|
+
const { card, media } = getTheme_v2(props.theme), borderStyle = `${(_b = (_a = card.border) == null ? void 0 : _a.width) != null ? _b : 1}px solid var(--card-border-color)`;
|
|
167
|
+
return _responsive(
|
|
168
|
+
media,
|
|
169
|
+
props.$border,
|
|
170
|
+
(value) => value ? { "&&": { border: borderStyle } } : { "&&": { border: 0 } }
|
|
130
171
|
);
|
|
131
172
|
}
|
|
132
|
-
function
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
173
|
+
function borderTop(props) {
|
|
174
|
+
var _a, _b;
|
|
175
|
+
const { card, media } = getTheme_v2(props.theme), borderStyle = `${(_b = (_a = card.border) == null ? void 0 : _a.width) != null ? _b : 1}px solid var(--card-border-color)`;
|
|
176
|
+
return _responsive(
|
|
177
|
+
media,
|
|
178
|
+
props.$borderTop,
|
|
179
|
+
(value) => value ? { "&&": { borderTop: borderStyle } } : { "&&": { borderTop: 0 } }
|
|
180
|
+
);
|
|
137
181
|
}
|
|
138
|
-
function
|
|
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;
|
|
182
|
+
function borderRight(props) {
|
|
183
|
+
var _a, _b;
|
|
184
|
+
const { card, media } = getTheme_v2(props.theme), borderStyle = `${(_b = (_a = card.border) == null ? void 0 : _a.width) != null ? _b : 1}px solid var(--card-border-color)`;
|
|
185
|
+
return _responsive(
|
|
186
|
+
media,
|
|
187
|
+
props.$borderRight,
|
|
188
|
+
(value) => value ? { "&&": { borderRight: borderStyle } } : { "&&": { borderRight: 0 } }
|
|
189
|
+
);
|
|
171
190
|
}
|
|
172
|
-
|
|
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;
|
|
191
|
+
function borderBottom(props) {
|
|
192
|
+
var _a, _b;
|
|
193
|
+
const { card, media } = getTheme_v2(props.theme), borderStyle = `${(_b = (_a = card.border) == null ? void 0 : _a.width) != null ? _b : 1}px solid var(--card-border-color)`;
|
|
194
|
+
return _responsive(
|
|
195
|
+
media,
|
|
196
|
+
props.$borderBottom,
|
|
197
|
+
(value) => value ? { "&&": { borderBottom: borderStyle } } : { "&&": { borderBottom: 0 } }
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
function borderLeft(props) {
|
|
201
|
+
var _a, _b;
|
|
202
|
+
const { card, media } = getTheme_v2(props.theme), borderStyle = `${(_b = (_a = card.border) == null ? void 0 : _a.width) != null ? _b : 1}px solid var(--card-border-color)`;
|
|
203
|
+
return _responsive(
|
|
204
|
+
media,
|
|
205
|
+
props.$borderLeft,
|
|
206
|
+
(value) => value ? { "&&": { borderLeft: borderStyle } } : { "&&": { borderLeft: 0 } }
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
const BASE_STYLE$4 = {
|
|
210
|
+
'&[data-as="ul"],&[data-as="ol"]': {
|
|
211
|
+
listStyle: "none"
|
|
212
212
|
}
|
|
213
|
-
|
|
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"
|
|
213
|
+
}, BOX_SIZING = {
|
|
214
|
+
content: "content-box",
|
|
215
|
+
border: "border-box"
|
|
216
|
+
}, BOX_HEIGHT = {
|
|
217
|
+
stretch: "stretch",
|
|
218
|
+
fill: "100%"
|
|
219
|
+
};
|
|
220
|
+
function boxStyle() {
|
|
221
|
+
return BASE_STYLE$4;
|
|
222
|
+
}
|
|
223
|
+
function responsiveBoxStyle() {
|
|
224
|
+
return [
|
|
225
|
+
responsiveBoxSizingStyle,
|
|
226
|
+
responsiveBoxHeightStyle,
|
|
227
|
+
responsiveBoxOverflowStyle,
|
|
228
|
+
responsiveBoxDisplayStyle
|
|
229
|
+
];
|
|
230
|
+
}
|
|
231
|
+
function responsiveBoxDisplayStyle(props) {
|
|
232
|
+
const { media } = getTheme_v2(props.theme);
|
|
233
|
+
return _responsive(media, props.$display, (display) => ({
|
|
234
|
+
"&:not([hidden])": { display }
|
|
235
|
+
}));
|
|
236
|
+
}
|
|
237
|
+
function responsiveBoxSizingStyle(props) {
|
|
238
|
+
const { media } = getTheme_v2(props.theme);
|
|
239
|
+
return _responsive(media, props.$sizing, (sizing) => ({
|
|
240
|
+
boxSizing: BOX_SIZING[sizing]
|
|
241
|
+
}));
|
|
242
|
+
}
|
|
243
|
+
function responsiveBoxHeightStyle(props) {
|
|
244
|
+
const { media } = getTheme_v2(props.theme);
|
|
245
|
+
return _responsive(media, props.$height, (height) => ({
|
|
246
|
+
height: BOX_HEIGHT[height]
|
|
247
|
+
}));
|
|
248
|
+
}
|
|
249
|
+
function responsiveBoxOverflowStyle(props) {
|
|
250
|
+
const { media } = getTheme_v2(props.theme);
|
|
251
|
+
return _responsive(media, props.$overflow, (overflow) => ({
|
|
252
|
+
overflow
|
|
253
|
+
}));
|
|
254
|
+
}
|
|
255
|
+
const BASE_STYLE$3 = {
|
|
256
|
+
"&&:not([hidden])": {
|
|
257
|
+
display: "flex"
|
|
734
258
|
}
|
|
735
259
|
};
|
|
736
260
|
function responsiveFlexStyle() {
|
|
@@ -1244,7 +768,7 @@ const Root$C = styled.div(responsiveLabelFont, responsiveTextAlignStyle, labelBa
|
|
|
1244
768
|
textOverflow,
|
|
1245
769
|
weight,
|
|
1246
770
|
...restProps
|
|
1247
|
-
} = props;
|
|
771
|
+
} = props, $size = useMemo(() => _getArrayProp(size2), [size2]), $align = useMemo(() => _getArrayProp(align), [align]);
|
|
1248
772
|
let children = childrenProp;
|
|
1249
773
|
return textOverflow === "ellipsis" ? children = /* @__PURE__ */ jsx(SpanWithTextOverflow$2, { children }) : children = /* @__PURE__ */ jsx("span", { children }), /* @__PURE__ */ jsx(
|
|
1250
774
|
Root$C,
|
|
@@ -1252,9 +776,9 @@ const Root$C = styled.div(responsiveLabelFont, responsiveTextAlignStyle, labelBa
|
|
|
1252
776
|
"data-ui": "Label",
|
|
1253
777
|
...restProps,
|
|
1254
778
|
$accent: accent,
|
|
1255
|
-
$align
|
|
779
|
+
$align,
|
|
780
|
+
$size,
|
|
1256
781
|
$muted: muted,
|
|
1257
|
-
$size: useArrayProp(size2),
|
|
1258
782
|
$weight: weight,
|
|
1259
783
|
ref,
|
|
1260
784
|
children
|
|
@@ -1413,7 +937,7 @@ const Root$B = styled.div(
|
|
|
1413
937
|
status = "online",
|
|
1414
938
|
size: sizeProp = 1,
|
|
1415
939
|
...restProps
|
|
1416
|
-
} = props, { avatar } = useTheme_v2(), as =
|
|
940
|
+
} = props, { avatar } = useTheme_v2(), as = isValidElementType(asProp) ? asProp : "div", size2 = _getArrayProp(sizeProp), _sizeRem = (avatar.sizes[size2[0]] || avatar.sizes[0]).size, _radius = _sizeRem / 2, elementId = useId(), [arrowPosition, setArrowPosition] = useState(
|
|
1417
941
|
animateArrowFrom || arrowPositionProp || "inside"
|
|
1418
942
|
), [imageFailed, setImageFailed] = useState(!1), imageId = `avatar-image-${elementId}`;
|
|
1419
943
|
useEffect(() => {
|
|
@@ -1425,10 +949,7 @@ const Root$B = styled.div(
|
|
|
1425
949
|
}, [src]);
|
|
1426
950
|
const handleImageError = useCallback(() => {
|
|
1427
951
|
setImageFailed(!0), onImageLoadError && onImageLoadError(new Error("Avatar: the image failed to load"));
|
|
1428
|
-
}, [onImageLoadError]), initialsSize =
|
|
1429
|
-
() => size2.map((s) => s === 1 ? 1 : s === 2 ? 3 : s === 3 ? 5 : 0),
|
|
1430
|
-
[size2]
|
|
1431
|
-
);
|
|
952
|
+
}, [onImageLoadError]), initialsSize = size2.map((s) => s === 1 ? 1 : s === 2 ? 3 : s === 3 ? 5 : 0);
|
|
1432
953
|
return /* @__PURE__ */ jsxs(
|
|
1433
954
|
Root$B,
|
|
1434
955
|
{
|
|
@@ -1523,11 +1044,8 @@ const Root$A = styled.div(
|
|
|
1523
1044
|
_responsiveAvatarCounterSizeStyle,
|
|
1524
1045
|
_avatarCounterBaseStyle
|
|
1525
1046
|
), AvatarCounter = forwardRef(function(props, ref) {
|
|
1526
|
-
const { count, size:
|
|
1527
|
-
|
|
1528
|
-
[size2]
|
|
1529
|
-
);
|
|
1530
|
-
return /* @__PURE__ */ jsx(Root$A, { $size: size2, "data-ui": "AvatarCounter", ref, children: /* @__PURE__ */ jsx(Label, { as: "span", size: fontSize2, weight: "medium", children: count }) });
|
|
1047
|
+
const { count, size: size2 } = props, $size = _getArrayProp(size2 != null ? size2 : 1), fontSize2 = $size.map((s) => s === 1 ? 1 : s === 2 ? 3 : s === 3 ? 5 : 0);
|
|
1048
|
+
return /* @__PURE__ */ jsx(Root$A, { $size, "data-ui": "AvatarCounter", ref, children: /* @__PURE__ */ jsx(Label, { as: "span", size: fontSize2, weight: "medium", children: count }) });
|
|
1531
1049
|
}), BASE_STYLES = css`
|
|
1532
1050
|
white-space: nowrap;
|
|
1533
1051
|
|
|
@@ -1559,10 +1077,7 @@ const Root$z = styled.div(responsiveAvatarStackSizeStyle, avatarStackStyle), Ava
|
|
|
1559
1077
|
maxLength: maxLengthProp = 4,
|
|
1560
1078
|
size: sizeProp = 1,
|
|
1561
1079
|
...restProps
|
|
1562
|
-
} = props, children = useMemo(
|
|
1563
|
-
() => Children.toArray(childrenProp).filter(isValidElement),
|
|
1564
|
-
[childrenProp]
|
|
1565
|
-
), maxLength = Math.max(maxLengthProp, 0), size2 = useArrayProp(sizeProp), len = children.length, visibleCount = maxLength - 1, extraCount = len - visibleCount, visibleChildren = extraCount > 1 ? children.slice(extraCount, len) : children;
|
|
1080
|
+
} = props, children = Children.toArray(childrenProp).filter(isValidElement), 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
1081
|
return /* @__PURE__ */ jsxs(Root$z, { "data-ui": "AvatarStack", ...restProps, ref, $size: size2, children: [
|
|
1567
1082
|
len === 0 && /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(AvatarCounter, { count: len, size: size2 }) }),
|
|
1568
1083
|
len !== 0 && extraCount > 1 && /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(AvatarCounter, { count: extraCount, size: size2 }) }),
|
|
@@ -1604,38 +1119,38 @@ const Root$z = styled.div(responsiveAvatarStackSizeStyle, avatarStackStyle), Ava
|
|
|
1604
1119
|
rowEnd,
|
|
1605
1120
|
sizing,
|
|
1606
1121
|
...restProps
|
|
1607
|
-
} = props;
|
|
1122
|
+
} = 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
1123
|
return /* @__PURE__ */ jsx(
|
|
1609
1124
|
Root$y,
|
|
1610
1125
|
{
|
|
1611
1126
|
"data-as": typeof asProp == "string" ? asProp : void 0,
|
|
1612
1127
|
"data-ui": "Box",
|
|
1613
1128
|
...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
|
|
1129
|
+
$column,
|
|
1130
|
+
$columnStart,
|
|
1131
|
+
$columnEnd,
|
|
1132
|
+
$display,
|
|
1133
|
+
$flex,
|
|
1134
|
+
$height,
|
|
1135
|
+
$margin,
|
|
1136
|
+
$marginX,
|
|
1137
|
+
$marginY,
|
|
1138
|
+
$marginTop,
|
|
1139
|
+
$marginRight,
|
|
1140
|
+
$marginBottom,
|
|
1141
|
+
$marginLeft,
|
|
1142
|
+
$overflow,
|
|
1143
|
+
$padding,
|
|
1144
|
+
$paddingX,
|
|
1145
|
+
$paddingY,
|
|
1146
|
+
$paddingTop,
|
|
1147
|
+
$paddingRight,
|
|
1148
|
+
$paddingBottom,
|
|
1149
|
+
$paddingLeft,
|
|
1150
|
+
$row,
|
|
1151
|
+
$rowStart,
|
|
1152
|
+
$rowEnd,
|
|
1153
|
+
$sizing,
|
|
1639
1154
|
as: asProp,
|
|
1640
1155
|
ref,
|
|
1641
1156
|
children: props.children
|
|
@@ -1725,7 +1240,7 @@ const Root$x = styled.div(
|
|
|
1725
1240
|
textOverflow,
|
|
1726
1241
|
weight,
|
|
1727
1242
|
...restProps
|
|
1728
|
-
} = props;
|
|
1243
|
+
} = props, $size = useMemo(() => _getArrayProp(size2), [size2]), $align = useMemo(() => _getArrayProp(align), [align]);
|
|
1729
1244
|
let children = childrenProp;
|
|
1730
1245
|
return textOverflow === "ellipsis" && (children = /* @__PURE__ */ jsx(SpanWithTextOverflow$1, { children })), /* @__PURE__ */ jsx(
|
|
1731
1246
|
Root$x,
|
|
@@ -1733,10 +1248,10 @@ const Root$x = styled.div(
|
|
|
1733
1248
|
"data-ui": "Text",
|
|
1734
1249
|
...restProps,
|
|
1735
1250
|
$accent: accent,
|
|
1736
|
-
$align
|
|
1251
|
+
$align,
|
|
1252
|
+
$size,
|
|
1737
1253
|
$muted: muted,
|
|
1738
1254
|
ref,
|
|
1739
|
-
$size: useArrayProp(size2),
|
|
1740
1255
|
$weight: weight,
|
|
1741
1256
|
children: /* @__PURE__ */ jsx("span", { children })
|
|
1742
1257
|
}
|
|
@@ -1768,15 +1283,15 @@ const Root$w = styled(Box)(
|
|
|
1768
1283
|
radius = "full",
|
|
1769
1284
|
tone = "default",
|
|
1770
1285
|
...restProps
|
|
1771
|
-
} = props;
|
|
1286
|
+
} = props, $radius = useMemo(() => _getArrayProp(radius), [radius]), $padding = useMemo(() => _getArrayProp(padding), [padding]);
|
|
1772
1287
|
return /* @__PURE__ */ jsx(
|
|
1773
1288
|
Root$w,
|
|
1774
1289
|
{
|
|
1775
1290
|
"data-ui": "Badge",
|
|
1776
1291
|
...restProps,
|
|
1777
1292
|
$tone: tone,
|
|
1778
|
-
$radius
|
|
1779
|
-
padding:
|
|
1293
|
+
$radius,
|
|
1294
|
+
padding: $padding,
|
|
1780
1295
|
ref,
|
|
1781
1296
|
children: /* @__PURE__ */ jsx(Text, { size: fontSize2, children })
|
|
1782
1297
|
}
|
|
@@ -1785,17 +1300,17 @@ const Root$w = styled(Box)(
|
|
|
1785
1300
|
flexItemStyle,
|
|
1786
1301
|
responsiveFlexStyle
|
|
1787
1302
|
), Flex = forwardRef(function(props, ref) {
|
|
1788
|
-
const { align, as, direction = "row", gap, justify, wrap, ...restProps } = props;
|
|
1303
|
+
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
1304
|
return /* @__PURE__ */ jsx(
|
|
1790
1305
|
Root$v,
|
|
1791
1306
|
{
|
|
1792
1307
|
"data-ui": "Flex",
|
|
1793
1308
|
...restProps,
|
|
1794
|
-
$align
|
|
1795
|
-
$direction
|
|
1796
|
-
$gap
|
|
1797
|
-
$justify
|
|
1798
|
-
$wrap
|
|
1309
|
+
$align,
|
|
1310
|
+
$direction,
|
|
1311
|
+
$gap,
|
|
1312
|
+
$justify,
|
|
1313
|
+
$wrap,
|
|
1799
1314
|
forwardedAs: as,
|
|
1800
1315
|
ref
|
|
1801
1316
|
}
|
|
@@ -2013,7 +1528,7 @@ const Root$t = styled.button(responsiveRadiusStyle, buttonBaseStyles, buttonColo
|
|
|
2013
1528
|
muted = !1,
|
|
2014
1529
|
width,
|
|
2015
1530
|
...restProps
|
|
2016
|
-
} = props, { button } = useTheme_v2(), justify =
|
|
1531
|
+
} = 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(
|
|
2017
1532
|
() => ({
|
|
2018
1533
|
// flex: 1,
|
|
2019
1534
|
padding,
|
|
@@ -2066,181 +1581,647 @@ const Root$t = styled.button(responsiveRadiusStyle, buttonBaseStyles, buttonColo
|
|
|
2066
1581
|
children && /* @__PURE__ */ jsx(Box, { as: "span", ...boxProps, children })
|
|
2067
1582
|
]
|
|
2068
1583
|
}
|
|
2069
|
-
);
|
|
1584
|
+
);
|
|
1585
|
+
});
|
|
1586
|
+
function cardStyle(props) {
|
|
1587
|
+
return [cardBaseStyle(props), cardColorStyle(props)];
|
|
1588
|
+
}
|
|
1589
|
+
function cardBaseStyle(props) {
|
|
1590
|
+
const { $checkered } = props, { space } = getTheme_v2(props.theme);
|
|
1591
|
+
return css`
|
|
1592
|
+
${$checkered && css`
|
|
1593
|
+
background-size: ${space[3]}px ${space[3]}px;
|
|
1594
|
+
background-position: 50% 50%;
|
|
1595
|
+
background-image: var(--card-bg-image);
|
|
1596
|
+
`}
|
|
1597
|
+
|
|
1598
|
+
&[data-as='button'] {
|
|
1599
|
+
-webkit-font-smoothing: inherit;
|
|
1600
|
+
appearance: none;
|
|
1601
|
+
outline: none;
|
|
1602
|
+
font: inherit;
|
|
1603
|
+
text-align: inherit;
|
|
1604
|
+
border: 0;
|
|
1605
|
+
width: -moz-available;
|
|
1606
|
+
width: -webkit-fill-available;
|
|
1607
|
+
width: stretch;
|
|
1608
|
+
}
|
|
1609
|
+
|
|
1610
|
+
/* &:is(a) */
|
|
1611
|
+
&[data-as='a'] {
|
|
1612
|
+
outline: none;
|
|
1613
|
+
text-decoration: none;
|
|
1614
|
+
}
|
|
1615
|
+
|
|
1616
|
+
/* &:is(pre) */
|
|
1617
|
+
&[data-as='pre'] {
|
|
1618
|
+
font: inherit;
|
|
1619
|
+
}
|
|
1620
|
+
`;
|
|
1621
|
+
}
|
|
1622
|
+
function cardColorStyle(props) {
|
|
1623
|
+
var _a;
|
|
1624
|
+
const { $checkered, $focusRing, $muted } = props, { card, color, style } = getTheme_v2(props.theme), border2 = { width: card.border.width, color: "var(--card-border-color)" };
|
|
1625
|
+
return css`
|
|
1626
|
+
color-scheme: ${color._dark ? "dark" : "light"};
|
|
1627
|
+
|
|
1628
|
+
${_cardColorStyle(color, color, $checkered)}
|
|
1629
|
+
|
|
1630
|
+
background-color: ${$muted ? "var(--card-muted-bg-color)" : "var(--card-bg-color)"};
|
|
1631
|
+
color: var(--card-fg-color);
|
|
1632
|
+
|
|
1633
|
+
/* &:is(button) */
|
|
1634
|
+
&[data-as='button'] {
|
|
1635
|
+
--card-focus-ring-box-shadow: none;
|
|
1636
|
+
|
|
1637
|
+
cursor: default;
|
|
1638
|
+
box-shadow: var(--card-focus-ring-box-shadow);
|
|
1639
|
+
|
|
1640
|
+
&:disabled {
|
|
1641
|
+
${_cardColorStyle(color, color.selectable.default.disabled, $checkered)}
|
|
1642
|
+
}
|
|
1643
|
+
|
|
1644
|
+
&:not(:disabled) {
|
|
1645
|
+
&[data-pressed] {
|
|
1646
|
+
${_cardColorStyle(color, color.selectable.default.pressed, $checkered)}
|
|
1647
|
+
}
|
|
1648
|
+
|
|
1649
|
+
&[data-selected] {
|
|
1650
|
+
${_cardColorStyle(color, color.selectable.default.selected, $checkered)}
|
|
1651
|
+
}
|
|
1652
|
+
|
|
1653
|
+
@media (hover: hover) {
|
|
1654
|
+
&:not([data-pressed]):not([data-selected]) {
|
|
1655
|
+
&[data-hovered],
|
|
1656
|
+
&:hover {
|
|
1657
|
+
${_cardColorStyle(color, color.selectable.default.hovered, $checkered)}
|
|
1658
|
+
}
|
|
1659
|
+
|
|
1660
|
+
&:active {
|
|
1661
|
+
${_cardColorStyle(color, color.selectable.default.pressed, $checkered)}
|
|
1662
|
+
}
|
|
1663
|
+
}
|
|
1664
|
+
}
|
|
1665
|
+
|
|
1666
|
+
&:focus-visible {
|
|
1667
|
+
--card-focus-ring-box-shadow: ${$focusRing ? focusRingStyle({ base: color, border: border2, focusRing: card.focusRing }) : void 0};
|
|
1668
|
+
}
|
|
1669
|
+
}
|
|
1670
|
+
}
|
|
1671
|
+
|
|
1672
|
+
/* &:is(a) */
|
|
1673
|
+
&[data-as='a'] {
|
|
1674
|
+
cursor: pointer;
|
|
1675
|
+
box-shadow: var(--card-focus-ring-box-shadow);
|
|
1676
|
+
|
|
1677
|
+
&[data-disabled] {
|
|
1678
|
+
${_cardColorStyle(color, color.selectable.default.disabled, $checkered)}
|
|
1679
|
+
}
|
|
1680
|
+
|
|
1681
|
+
&:not([data-disabled]) {
|
|
1682
|
+
&[data-pressed] {
|
|
1683
|
+
${_cardColorStyle(color, color.selectable.default.pressed, $checkered)}
|
|
1684
|
+
}
|
|
1685
|
+
|
|
1686
|
+
&[data-selected] {
|
|
1687
|
+
${_cardColorStyle(color, color.selectable.default.selected, $checkered)}
|
|
1688
|
+
}
|
|
1689
|
+
|
|
1690
|
+
@media (hover: hover) {
|
|
1691
|
+
&:not([data-pressed]):not([data-selected]) {
|
|
1692
|
+
&[data-hovered],
|
|
1693
|
+
&:hover {
|
|
1694
|
+
${_cardColorStyle(color, color.selectable.default.hovered, $checkered)}
|
|
1695
|
+
}
|
|
1696
|
+
|
|
1697
|
+
&:active {
|
|
1698
|
+
${_cardColorStyle(color, color.selectable.default.pressed, $checkered)}
|
|
1699
|
+
}
|
|
1700
|
+
}
|
|
1701
|
+
}
|
|
1702
|
+
|
|
1703
|
+
&:focus-visible {
|
|
1704
|
+
--card-focus-ring-box-shadow: ${$focusRing ? focusRingStyle({ base: color, border: border2, focusRing: card.focusRing }) : void 0};
|
|
1705
|
+
}
|
|
1706
|
+
}
|
|
1707
|
+
}
|
|
1708
|
+
|
|
1709
|
+
${(_a = style == null ? void 0 : style.card) == null ? void 0 : _a.root}
|
|
1710
|
+
`;
|
|
1711
|
+
}
|
|
1712
|
+
const Root$s = styled(Box)(responsiveBorderStyle, responsiveRadiusStyle, responsiveShadowStyle, cardStyle), Card = forwardRef(function(props, ref) {
|
|
1713
|
+
const {
|
|
1714
|
+
__unstable_checkered: checkered = !1,
|
|
1715
|
+
__unstable_focusRing: focusRing = !1,
|
|
1716
|
+
as: asProp,
|
|
1717
|
+
border: border2,
|
|
1718
|
+
borderTop: borderTop2,
|
|
1719
|
+
borderRight: borderRight2,
|
|
1720
|
+
borderBottom: borderBottom2,
|
|
1721
|
+
borderLeft: borderLeft2,
|
|
1722
|
+
muted,
|
|
1723
|
+
pressed,
|
|
1724
|
+
radius = 0,
|
|
1725
|
+
scheme,
|
|
1726
|
+
selected,
|
|
1727
|
+
shadow,
|
|
1728
|
+
tone: toneProp = "default",
|
|
1729
|
+
...restProps
|
|
1730
|
+
} = 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]);
|
|
1731
|
+
return /* @__PURE__ */ jsx(ThemeColorProvider, { scheme, tone, children: /* @__PURE__ */ jsx(
|
|
1732
|
+
Root$s,
|
|
1733
|
+
{
|
|
1734
|
+
"data-as": typeof as == "string" ? as : void 0,
|
|
1735
|
+
"data-scheme": rootTheme.scheme,
|
|
1736
|
+
"data-ui": "Card",
|
|
1737
|
+
"data-tone": tone,
|
|
1738
|
+
...restProps,
|
|
1739
|
+
$border,
|
|
1740
|
+
$borderTop,
|
|
1741
|
+
$borderRight,
|
|
1742
|
+
$borderBottom,
|
|
1743
|
+
$borderLeft,
|
|
1744
|
+
$radius,
|
|
1745
|
+
$shadow,
|
|
1746
|
+
$checkered: checkered,
|
|
1747
|
+
$focusRing: focusRing,
|
|
1748
|
+
$muted: muted,
|
|
1749
|
+
$tone: tone,
|
|
1750
|
+
"data-checkered": checkered ? "" : void 0,
|
|
1751
|
+
"data-pressed": pressed ? "" : void 0,
|
|
1752
|
+
"data-selected": selected ? "" : void 0,
|
|
1753
|
+
forwardedAs: as,
|
|
1754
|
+
ref,
|
|
1755
|
+
selected
|
|
1756
|
+
}
|
|
1757
|
+
) });
|
|
2070
1758
|
});
|
|
2071
|
-
function
|
|
2072
|
-
return
|
|
1759
|
+
function useArrayProp(val, defaultVal) {
|
|
1760
|
+
return useMemo(() => _getArrayProp(val, defaultVal), [defaultVal, val]);
|
|
2073
1761
|
}
|
|
2074
|
-
function
|
|
2075
|
-
const
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
font: inherit;
|
|
2088
|
-
text-align: inherit;
|
|
2089
|
-
border: 0;
|
|
2090
|
-
width: -moz-available;
|
|
2091
|
-
width: -webkit-fill-available;
|
|
2092
|
-
width: stretch;
|
|
1762
|
+
function _getElements(element, elementsArg) {
|
|
1763
|
+
const ret = [element];
|
|
1764
|
+
for (const el of elementsArg)
|
|
1765
|
+
Array.isArray(el) ? ret.push(...el) : ret.push(el);
|
|
1766
|
+
return ret.filter(Boolean);
|
|
1767
|
+
}
|
|
1768
|
+
function useClickOutside(listener, elementsArg = EMPTY_ARRAY, boundaryElement) {
|
|
1769
|
+
const [element, setElement] = useState(null), [elements, setElements] = useState(() => _getElements(element, elementsArg)), elementsRef = useRef(elements);
|
|
1770
|
+
return useEffect(() => {
|
|
1771
|
+
const prevElements = elementsRef.current, nextElements = _getElements(element, elementsArg);
|
|
1772
|
+
if (prevElements.length !== nextElements.length) {
|
|
1773
|
+
setElements(nextElements), elementsRef.current = nextElements;
|
|
1774
|
+
return;
|
|
2093
1775
|
}
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
1776
|
+
for (const el of prevElements)
|
|
1777
|
+
if (!nextElements.includes(el)) {
|
|
1778
|
+
setElements(nextElements), elementsRef.current = nextElements;
|
|
1779
|
+
return;
|
|
1780
|
+
}
|
|
1781
|
+
for (const el of nextElements)
|
|
1782
|
+
if (!prevElements.includes(el)) {
|
|
1783
|
+
setElements(nextElements), elementsRef.current = nextElements;
|
|
1784
|
+
return;
|
|
1785
|
+
}
|
|
1786
|
+
}, [element, elementsArg]), useEffect(() => {
|
|
1787
|
+
if (!listener) return;
|
|
1788
|
+
const handleWindowMouseDown = (evt) => {
|
|
1789
|
+
const target = evt.target;
|
|
1790
|
+
if (target instanceof Node && !(boundaryElement && !boundaryElement.contains(target))) {
|
|
1791
|
+
for (const el of elements)
|
|
1792
|
+
if (target === el || el.contains(target))
|
|
1793
|
+
return;
|
|
1794
|
+
listener(evt);
|
|
1795
|
+
}
|
|
1796
|
+
};
|
|
1797
|
+
return window.addEventListener("mousedown", handleWindowMouseDown), () => {
|
|
1798
|
+
window.removeEventListener("mousedown", handleWindowMouseDown);
|
|
1799
|
+
};
|
|
1800
|
+
}, [boundaryElement, listener, elements]), setElement;
|
|
1801
|
+
}
|
|
1802
|
+
var resizeObservers = [], hasActiveObservations = function() {
|
|
1803
|
+
return resizeObservers.some(function(ro) {
|
|
1804
|
+
return ro.activeTargets.length > 0;
|
|
1805
|
+
});
|
|
1806
|
+
}, hasSkippedObservations = function() {
|
|
1807
|
+
return resizeObservers.some(function(ro) {
|
|
1808
|
+
return ro.skippedTargets.length > 0;
|
|
1809
|
+
});
|
|
1810
|
+
}, msg = "ResizeObserver loop completed with undelivered notifications.", deliverResizeLoopError = function() {
|
|
1811
|
+
var event;
|
|
1812
|
+
typeof ErrorEvent == "function" ? event = new ErrorEvent("error", {
|
|
1813
|
+
message: msg
|
|
1814
|
+
}) : (event = document.createEvent("Event"), event.initEvent("error", !1, !1), event.message = msg), window.dispatchEvent(event);
|
|
1815
|
+
}, ResizeObserverBoxOptions;
|
|
1816
|
+
(function(ResizeObserverBoxOptions2) {
|
|
1817
|
+
ResizeObserverBoxOptions2.BORDER_BOX = "border-box", ResizeObserverBoxOptions2.CONTENT_BOX = "content-box", ResizeObserverBoxOptions2.DEVICE_PIXEL_CONTENT_BOX = "device-pixel-content-box";
|
|
1818
|
+
})(ResizeObserverBoxOptions || (ResizeObserverBoxOptions = {}));
|
|
1819
|
+
var freeze = function(obj) {
|
|
1820
|
+
return Object.freeze(obj);
|
|
1821
|
+
}, ResizeObserverSize = /* @__PURE__ */ function() {
|
|
1822
|
+
function ResizeObserverSize2(inlineSize, blockSize) {
|
|
1823
|
+
this.inlineSize = inlineSize, this.blockSize = blockSize, freeze(this);
|
|
1824
|
+
}
|
|
1825
|
+
return ResizeObserverSize2;
|
|
1826
|
+
}(), DOMRectReadOnly = function() {
|
|
1827
|
+
function DOMRectReadOnly2(x, y, width, height) {
|
|
1828
|
+
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);
|
|
1829
|
+
}
|
|
1830
|
+
return DOMRectReadOnly2.prototype.toJSON = function() {
|
|
1831
|
+
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;
|
|
1832
|
+
return { x, y, top, right, bottom, left, width, height };
|
|
1833
|
+
}, DOMRectReadOnly2.fromRect = function(rectangle) {
|
|
1834
|
+
return new DOMRectReadOnly2(rectangle.x, rectangle.y, rectangle.width, rectangle.height);
|
|
1835
|
+
}, DOMRectReadOnly2;
|
|
1836
|
+
}(), isSVG = function(target) {
|
|
1837
|
+
return target instanceof SVGElement && "getBBox" in target;
|
|
1838
|
+
}, isHidden = function(target) {
|
|
1839
|
+
if (isSVG(target)) {
|
|
1840
|
+
var _a = target.getBBox(), width = _a.width, height = _a.height;
|
|
1841
|
+
return !width && !height;
|
|
1842
|
+
}
|
|
1843
|
+
var _b = target, offsetWidth = _b.offsetWidth, offsetHeight = _b.offsetHeight;
|
|
1844
|
+
return !(offsetWidth || offsetHeight || target.getClientRects().length);
|
|
1845
|
+
}, isElement = function(obj) {
|
|
1846
|
+
var _a;
|
|
1847
|
+
if (obj instanceof Element)
|
|
1848
|
+
return !0;
|
|
1849
|
+
var scope = (_a = obj == null ? void 0 : obj.ownerDocument) === null || _a === void 0 ? void 0 : _a.defaultView;
|
|
1850
|
+
return !!(scope && obj instanceof scope.Element);
|
|
1851
|
+
}, isReplacedElement = function(target) {
|
|
1852
|
+
switch (target.tagName) {
|
|
1853
|
+
case "INPUT":
|
|
1854
|
+
if (target.type !== "image")
|
|
1855
|
+
break;
|
|
1856
|
+
case "VIDEO":
|
|
1857
|
+
case "AUDIO":
|
|
1858
|
+
case "EMBED":
|
|
1859
|
+
case "OBJECT":
|
|
1860
|
+
case "CANVAS":
|
|
1861
|
+
case "IFRAME":
|
|
1862
|
+
case "IMG":
|
|
1863
|
+
return !0;
|
|
1864
|
+
}
|
|
1865
|
+
return !1;
|
|
1866
|
+
}, 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) {
|
|
1867
|
+
return parseFloat(pixel || "0");
|
|
1868
|
+
}, size$1 = function(inlineSize, blockSize, switchSizes) {
|
|
1869
|
+
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);
|
|
1870
|
+
}, zeroBoxes = freeze({
|
|
1871
|
+
devicePixelContentBoxSize: size$1(),
|
|
1872
|
+
borderBoxSize: size$1(),
|
|
1873
|
+
contentBoxSize: size$1(),
|
|
1874
|
+
contentRect: new DOMRectReadOnly(0, 0, 0, 0)
|
|
1875
|
+
}), calculateBoxSizes = function(target, forceRecalculation) {
|
|
1876
|
+
if (forceRecalculation === void 0 && (forceRecalculation = !1), cache.has(target) && !forceRecalculation)
|
|
1877
|
+
return cache.get(target);
|
|
1878
|
+
if (isHidden(target))
|
|
1879
|
+
return cache.set(target, zeroBoxes), zeroBoxes;
|
|
1880
|
+
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({
|
|
1881
|
+
devicePixelContentBoxSize: size$1(Math.round(contentWidth * devicePixelRatio), Math.round(contentHeight * devicePixelRatio), switchSizes),
|
|
1882
|
+
borderBoxSize: size$1(borderBoxWidth, borderBoxHeight, switchSizes),
|
|
1883
|
+
contentBoxSize: size$1(contentWidth, contentHeight, switchSizes),
|
|
1884
|
+
contentRect: new DOMRectReadOnly(paddingLeft, paddingTop, contentWidth, contentHeight)
|
|
1885
|
+
});
|
|
1886
|
+
return cache.set(target, boxes), boxes;
|
|
1887
|
+
}, calculateBoxSize = function(target, observedBox, forceRecalculation) {
|
|
1888
|
+
var _a = calculateBoxSizes(target, forceRecalculation), borderBoxSize = _a.borderBoxSize, contentBoxSize = _a.contentBoxSize, devicePixelContentBoxSize = _a.devicePixelContentBoxSize;
|
|
1889
|
+
switch (observedBox) {
|
|
1890
|
+
case ResizeObserverBoxOptions.DEVICE_PIXEL_CONTENT_BOX:
|
|
1891
|
+
return devicePixelContentBoxSize;
|
|
1892
|
+
case ResizeObserverBoxOptions.BORDER_BOX:
|
|
1893
|
+
return borderBoxSize;
|
|
1894
|
+
default:
|
|
1895
|
+
return contentBoxSize;
|
|
1896
|
+
}
|
|
1897
|
+
}, ResizeObserverEntry = /* @__PURE__ */ function() {
|
|
1898
|
+
function ResizeObserverEntry2(target) {
|
|
1899
|
+
var boxes = calculateBoxSizes(target);
|
|
1900
|
+
this.target = target, this.contentRect = boxes.contentRect, this.borderBoxSize = freeze([boxes.borderBoxSize]), this.contentBoxSize = freeze([boxes.contentBoxSize]), this.devicePixelContentBoxSize = freeze([boxes.devicePixelContentBoxSize]);
|
|
1901
|
+
}
|
|
1902
|
+
return ResizeObserverEntry2;
|
|
1903
|
+
}(), calculateDepthForNode = function(node) {
|
|
1904
|
+
if (isHidden(node))
|
|
1905
|
+
return 1 / 0;
|
|
1906
|
+
for (var depth = 0, parent = node.parentNode; parent; )
|
|
1907
|
+
depth += 1, parent = parent.parentNode;
|
|
1908
|
+
return depth;
|
|
1909
|
+
}, broadcastActiveObservations = function() {
|
|
1910
|
+
var shallowestDepth = 1 / 0, callbacks2 = [];
|
|
1911
|
+
resizeObservers.forEach(function(ro) {
|
|
1912
|
+
if (ro.activeTargets.length !== 0) {
|
|
1913
|
+
var entries = [];
|
|
1914
|
+
ro.activeTargets.forEach(function(ot) {
|
|
1915
|
+
var entry = new ResizeObserverEntry(ot.target), targetDepth = calculateDepthForNode(ot.target);
|
|
1916
|
+
entries.push(entry), ot.lastReportedSize = calculateBoxSize(ot.target, ot.observedBox), targetDepth < shallowestDepth && (shallowestDepth = targetDepth);
|
|
1917
|
+
}), callbacks2.push(function() {
|
|
1918
|
+
ro.callback.call(ro.observer, entries, ro.observer);
|
|
1919
|
+
}), ro.activeTargets.splice(0, ro.activeTargets.length);
|
|
1920
|
+
}
|
|
1921
|
+
});
|
|
1922
|
+
for (var _i = 0, callbacks_1 = callbacks2; _i < callbacks_1.length; _i++) {
|
|
1923
|
+
var callback = callbacks_1[_i];
|
|
1924
|
+
callback();
|
|
1925
|
+
}
|
|
1926
|
+
return shallowestDepth;
|
|
1927
|
+
}, gatherActiveObservationsAtDepth = function(depth) {
|
|
1928
|
+
resizeObservers.forEach(function(ro) {
|
|
1929
|
+
ro.activeTargets.splice(0, ro.activeTargets.length), ro.skippedTargets.splice(0, ro.skippedTargets.length), ro.observationTargets.forEach(function(ot) {
|
|
1930
|
+
ot.isActive() && (calculateDepthForNode(ot.target) > depth ? ro.activeTargets.push(ot) : ro.skippedTargets.push(ot));
|
|
1931
|
+
});
|
|
1932
|
+
});
|
|
1933
|
+
}, process = function() {
|
|
1934
|
+
var depth = 0;
|
|
1935
|
+
for (gatherActiveObservationsAtDepth(depth); hasActiveObservations(); )
|
|
1936
|
+
depth = broadcastActiveObservations(), gatherActiveObservationsAtDepth(depth);
|
|
1937
|
+
return hasSkippedObservations() && deliverResizeLoopError(), depth > 0;
|
|
1938
|
+
}, trigger, callbacks = [], notify = function() {
|
|
1939
|
+
return callbacks.splice(0).forEach(function(cb) {
|
|
1940
|
+
return cb();
|
|
1941
|
+
});
|
|
1942
|
+
}, queueMicroTask = function(callback) {
|
|
1943
|
+
if (!trigger) {
|
|
1944
|
+
var toggle_1 = 0, el_1 = document.createTextNode(""), config = { characterData: !0 };
|
|
1945
|
+
new MutationObserver(function() {
|
|
1946
|
+
return notify();
|
|
1947
|
+
}).observe(el_1, config), trigger = function() {
|
|
1948
|
+
el_1.textContent = "".concat(toggle_1 ? toggle_1-- : toggle_1++);
|
|
1949
|
+
};
|
|
1950
|
+
}
|
|
1951
|
+
callbacks.push(callback), trigger();
|
|
1952
|
+
}, queueResizeObserver = function(cb) {
|
|
1953
|
+
queueMicroTask(function() {
|
|
1954
|
+
requestAnimationFrame(cb);
|
|
1955
|
+
});
|
|
1956
|
+
}, watching = 0, isWatching = function() {
|
|
1957
|
+
return !!watching;
|
|
1958
|
+
}, CATCH_PERIOD = 250, observerConfig = { attributes: !0, characterData: !0, childList: !0, subtree: !0 }, events = [
|
|
1959
|
+
"resize",
|
|
1960
|
+
"load",
|
|
1961
|
+
"transitionend",
|
|
1962
|
+
"animationend",
|
|
1963
|
+
"animationstart",
|
|
1964
|
+
"animationiteration",
|
|
1965
|
+
"keyup",
|
|
1966
|
+
"keydown",
|
|
1967
|
+
"mouseup",
|
|
1968
|
+
"mousedown",
|
|
1969
|
+
"mouseover",
|
|
1970
|
+
"mouseout",
|
|
1971
|
+
"blur",
|
|
1972
|
+
"focus"
|
|
1973
|
+
], time = function(timeout) {
|
|
1974
|
+
return timeout === void 0 && (timeout = 0), Date.now() + timeout;
|
|
1975
|
+
}, scheduled = !1, Scheduler = function() {
|
|
1976
|
+
function Scheduler2() {
|
|
1977
|
+
var _this = this;
|
|
1978
|
+
this.stopped = !0, this.listener = function() {
|
|
1979
|
+
return _this.schedule();
|
|
1980
|
+
};
|
|
1981
|
+
}
|
|
1982
|
+
return Scheduler2.prototype.run = function(timeout) {
|
|
1983
|
+
var _this = this;
|
|
1984
|
+
if (timeout === void 0 && (timeout = CATCH_PERIOD), !scheduled) {
|
|
1985
|
+
scheduled = !0;
|
|
1986
|
+
var until = time(timeout);
|
|
1987
|
+
queueResizeObserver(function() {
|
|
1988
|
+
var elementsHaveResized = !1;
|
|
1989
|
+
try {
|
|
1990
|
+
elementsHaveResized = process();
|
|
1991
|
+
} finally {
|
|
1992
|
+
if (scheduled = !1, timeout = until - time(), !isWatching())
|
|
1993
|
+
return;
|
|
1994
|
+
elementsHaveResized ? _this.run(1e3) : timeout > 0 ? _this.run(timeout) : _this.start();
|
|
1995
|
+
}
|
|
1996
|
+
});
|
|
2099
1997
|
}
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
1998
|
+
}, Scheduler2.prototype.schedule = function() {
|
|
1999
|
+
this.stop(), this.run();
|
|
2000
|
+
}, Scheduler2.prototype.observe = function() {
|
|
2001
|
+
var _this = this, cb = function() {
|
|
2002
|
+
return _this.observer && _this.observer.observe(document.body, observerConfig);
|
|
2003
|
+
};
|
|
2004
|
+
document.body ? cb() : global$1.addEventListener("DOMContentLoaded", cb);
|
|
2005
|
+
}, Scheduler2.prototype.start = function() {
|
|
2006
|
+
var _this = this;
|
|
2007
|
+
this.stopped && (this.stopped = !1, this.observer = new MutationObserver(this.listener), this.observe(), events.forEach(function(name) {
|
|
2008
|
+
return global$1.addEventListener(name, _this.listener, !0);
|
|
2009
|
+
}));
|
|
2010
|
+
}, Scheduler2.prototype.stop = function() {
|
|
2011
|
+
var _this = this;
|
|
2012
|
+
this.stopped || (this.observer && this.observer.disconnect(), events.forEach(function(name) {
|
|
2013
|
+
return global$1.removeEventListener(name, _this.listener, !0);
|
|
2014
|
+
}), this.stopped = !0);
|
|
2015
|
+
}, Scheduler2;
|
|
2016
|
+
}(), scheduler = new Scheduler(), updateCount = function(n) {
|
|
2017
|
+
!watching && n > 0 && scheduler.start(), watching += n, !watching && scheduler.stop();
|
|
2018
|
+
}, skipNotifyOnElement = function(target) {
|
|
2019
|
+
return !isSVG(target) && !isReplacedElement(target) && getComputedStyle(target).display === "inline";
|
|
2020
|
+
}, ResizeObservation = function() {
|
|
2021
|
+
function ResizeObservation2(target, observedBox) {
|
|
2022
|
+
this.target = target, this.observedBox = observedBox || ResizeObserverBoxOptions.CONTENT_BOX, this.lastReportedSize = {
|
|
2023
|
+
inlineSize: 0,
|
|
2024
|
+
blockSize: 0
|
|
2025
|
+
};
|
|
2026
|
+
}
|
|
2027
|
+
return ResizeObservation2.prototype.isActive = function() {
|
|
2028
|
+
var size2 = calculateBoxSize(this.target, this.observedBox, !0);
|
|
2029
|
+
return skipNotifyOnElement(this.target) && (this.lastReportedSize = size2), this.lastReportedSize.inlineSize !== size2.inlineSize || this.lastReportedSize.blockSize !== size2.blockSize;
|
|
2030
|
+
}, ResizeObservation2;
|
|
2031
|
+
}(), ResizeObserverDetail = /* @__PURE__ */ function() {
|
|
2032
|
+
function ResizeObserverDetail2(resizeObserver, callback) {
|
|
2033
|
+
this.activeTargets = [], this.skippedTargets = [], this.observationTargets = [], this.observer = resizeObserver, this.callback = callback;
|
|
2034
|
+
}
|
|
2035
|
+
return ResizeObserverDetail2;
|
|
2036
|
+
}(), observerMap = /* @__PURE__ */ new WeakMap(), getObservationIndex = function(observationTargets, target) {
|
|
2037
|
+
for (var i = 0; i < observationTargets.length; i += 1)
|
|
2038
|
+
if (observationTargets[i].target === target)
|
|
2039
|
+
return i;
|
|
2040
|
+
return -1;
|
|
2041
|
+
}, ResizeObserverController = function() {
|
|
2042
|
+
function ResizeObserverController2() {
|
|
2043
|
+
}
|
|
2044
|
+
return ResizeObserverController2.connect = function(resizeObserver, callback) {
|
|
2045
|
+
var detail = new ResizeObserverDetail(resizeObserver, callback);
|
|
2046
|
+
observerMap.set(resizeObserver, detail);
|
|
2047
|
+
}, ResizeObserverController2.observe = function(resizeObserver, target, options) {
|
|
2048
|
+
var detail = observerMap.get(resizeObserver), firstObservation = detail.observationTargets.length === 0;
|
|
2049
|
+
getObservationIndex(detail.observationTargets, target) < 0 && (firstObservation && resizeObservers.push(detail), detail.observationTargets.push(new ResizeObservation(target, options && options.box)), updateCount(1), scheduler.schedule());
|
|
2050
|
+
}, ResizeObserverController2.unobserve = function(resizeObserver, target) {
|
|
2051
|
+
var detail = observerMap.get(resizeObserver), index = getObservationIndex(detail.observationTargets, target), lastObservation = detail.observationTargets.length === 1;
|
|
2052
|
+
index >= 0 && (lastObservation && resizeObservers.splice(resizeObservers.indexOf(detail), 1), detail.observationTargets.splice(index, 1), updateCount(-1));
|
|
2053
|
+
}, ResizeObserverController2.disconnect = function(resizeObserver) {
|
|
2054
|
+
var _this = this, detail = observerMap.get(resizeObserver);
|
|
2055
|
+
detail.observationTargets.slice().forEach(function(ot) {
|
|
2056
|
+
return _this.unobserve(resizeObserver, ot.target);
|
|
2057
|
+
}), detail.activeTargets.splice(0, detail.activeTargets.length);
|
|
2058
|
+
}, ResizeObserverController2;
|
|
2059
|
+
}(), ResizeObserver = function() {
|
|
2060
|
+
function ResizeObserver2(callback) {
|
|
2061
|
+
if (arguments.length === 0)
|
|
2062
|
+
throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");
|
|
2063
|
+
if (typeof callback != "function")
|
|
2064
|
+
throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");
|
|
2065
|
+
ResizeObserverController.connect(this, callback);
|
|
2066
|
+
}
|
|
2067
|
+
return ResizeObserver2.prototype.observe = function(target, options) {
|
|
2068
|
+
if (arguments.length === 0)
|
|
2069
|
+
throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");
|
|
2070
|
+
if (!isElement(target))
|
|
2071
|
+
throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");
|
|
2072
|
+
ResizeObserverController.observe(this, target, options);
|
|
2073
|
+
}, ResizeObserver2.prototype.unobserve = function(target) {
|
|
2074
|
+
if (arguments.length === 0)
|
|
2075
|
+
throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");
|
|
2076
|
+
if (!isElement(target))
|
|
2077
|
+
throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");
|
|
2078
|
+
ResizeObserverController.unobserve(this, target);
|
|
2079
|
+
}, ResizeObserver2.prototype.disconnect = function() {
|
|
2080
|
+
ResizeObserverController.disconnect(this);
|
|
2081
|
+
}, ResizeObserver2.toString = function() {
|
|
2082
|
+
return "function ResizeObserver () { [polyfill code] }";
|
|
2083
|
+
}, ResizeObserver2;
|
|
2084
|
+
}();
|
|
2085
|
+
const _ResizeObserver = typeof document < "u" && typeof window < "u" && window.ResizeObserver ? window.ResizeObserver : ResizeObserver, _elementSizeObserver = _createElementSizeObserver();
|
|
2086
|
+
function _createElementRectValueListener() {
|
|
2087
|
+
return {
|
|
2088
|
+
subscribe(element, subscriber) {
|
|
2089
|
+
const resizeObserver = new _ResizeObserver(([entry]) => {
|
|
2090
|
+
subscriber({
|
|
2091
|
+
_contentRect: entry.contentRect,
|
|
2092
|
+
border: {
|
|
2093
|
+
width: entry.borderBoxSize[0].inlineSize,
|
|
2094
|
+
height: entry.borderBoxSize[0].blockSize
|
|
2095
|
+
},
|
|
2096
|
+
content: {
|
|
2097
|
+
width: entry.contentRect.width,
|
|
2098
|
+
height: entry.contentRect.height
|
|
2099
|
+
}
|
|
2100
|
+
});
|
|
2101
|
+
});
|
|
2102
|
+
return resizeObserver.observe(element), () => {
|
|
2103
|
+
resizeObserver.unobserve(element), resizeObserver.disconnect();
|
|
2104
|
+
};
|
|
2104
2105
|
}
|
|
2105
|
-
|
|
2106
|
+
};
|
|
2106
2107
|
}
|
|
2107
|
-
function
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
--card-focus-ring-box-shadow: none;
|
|
2121
|
-
|
|
2122
|
-
cursor: default;
|
|
2123
|
-
box-shadow: var(--card-focus-ring-box-shadow);
|
|
2124
|
-
|
|
2125
|
-
&:disabled {
|
|
2126
|
-
${_cardColorStyle(color, color.selectable.default.disabled, $checkered)}
|
|
2127
|
-
}
|
|
2128
|
-
|
|
2129
|
-
&:not(:disabled) {
|
|
2130
|
-
&[data-pressed] {
|
|
2131
|
-
${_cardColorStyle(color, color.selectable.default.pressed, $checkered)}
|
|
2132
|
-
}
|
|
2133
|
-
|
|
2134
|
-
&[data-selected] {
|
|
2135
|
-
${_cardColorStyle(color, color.selectable.default.selected, $checkered)}
|
|
2136
|
-
}
|
|
2137
|
-
|
|
2138
|
-
@media (hover: hover) {
|
|
2139
|
-
&:not([data-pressed]):not([data-selected]) {
|
|
2140
|
-
&[data-hovered],
|
|
2141
|
-
&:hover {
|
|
2142
|
-
${_cardColorStyle(color, color.selectable.default.hovered, $checkered)}
|
|
2143
|
-
}
|
|
2144
|
-
|
|
2145
|
-
&:active {
|
|
2146
|
-
${_cardColorStyle(color, color.selectable.default.pressed, $checkered)}
|
|
2147
|
-
}
|
|
2148
|
-
}
|
|
2149
|
-
}
|
|
2150
|
-
|
|
2151
|
-
&:focus-visible {
|
|
2152
|
-
--card-focus-ring-box-shadow: ${$focusRing ? focusRingStyle({ base: color, border: border2, focusRing: card.focusRing }) : void 0};
|
|
2153
|
-
}
|
|
2154
|
-
}
|
|
2108
|
+
function _createElementSizeObserver() {
|
|
2109
|
+
const disposeCache = /* @__PURE__ */ new WeakMap(), subscribersCache = /* @__PURE__ */ new WeakMap();
|
|
2110
|
+
return {
|
|
2111
|
+
subscribe(element, subscriber) {
|
|
2112
|
+
const subscribers = subscribersCache.get(element) || [];
|
|
2113
|
+
let dispose = disposeCache.get(element);
|
|
2114
|
+
return subscribersCache.has(element) || (subscribersCache.set(element, subscribers), dispose = _createElementRectValueListener().subscribe(element, (elementRect) => {
|
|
2115
|
+
for (const sub of subscribers)
|
|
2116
|
+
sub(elementRect);
|
|
2117
|
+
})), subscribers.push(subscriber), () => {
|
|
2118
|
+
const idx = subscribers.indexOf(subscriber);
|
|
2119
|
+
idx > -1 && subscribers.splice(idx, 1), subscribers.length === 0 && dispose && dispose();
|
|
2120
|
+
};
|
|
2155
2121
|
}
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
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
|
-
}
|
|
2122
|
+
};
|
|
2123
|
+
}
|
|
2124
|
+
function useElementSize(element) {
|
|
2125
|
+
const [size2, setSize] = useState(null);
|
|
2126
|
+
return useEffect(() => {
|
|
2127
|
+
if (element)
|
|
2128
|
+
return _elementSizeObserver.subscribe(element, setSize);
|
|
2129
|
+
}, [element]), size2;
|
|
2130
|
+
}
|
|
2131
|
+
function useElementRect(element) {
|
|
2132
|
+
const elementSize = useElementSize(element);
|
|
2133
|
+
return (elementSize == null ? void 0 : elementSize._contentRect) || null;
|
|
2134
|
+
}
|
|
2135
|
+
function useGlobalKeyDown(onKeyDown) {
|
|
2136
|
+
return useEffect(() => (addEventListener("keydown", onKeyDown), () => removeEventListener("keydown", onKeyDown)), [onKeyDown]);
|
|
2137
|
+
}
|
|
2138
|
+
const MEDIA_STORE_CACHE = /* @__PURE__ */ new WeakMap();
|
|
2139
|
+
function _getMediaQuery(media, index) {
|
|
2140
|
+
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)`;
|
|
2141
|
+
}
|
|
2142
|
+
function _createMediaStore(media) {
|
|
2143
|
+
const mediaLen = media.length;
|
|
2144
|
+
let sizes;
|
|
2145
|
+
const getSizes = () => {
|
|
2146
|
+
if (!sizes) {
|
|
2147
|
+
sizes = [];
|
|
2148
|
+
for (let index = mediaLen; index > -1; index -= 1) {
|
|
2149
|
+
const mediaQuery = _getMediaQuery(media, index);
|
|
2150
|
+
sizes.push({ index, mq: window.matchMedia(mediaQuery) });
|
|
2191
2151
|
}
|
|
2192
2152
|
}
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
}
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
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
|
|
2153
|
+
return sizes;
|
|
2154
|
+
};
|
|
2155
|
+
return { getSnapshot: () => {
|
|
2156
|
+
for (const { index, mq } of getSizes())
|
|
2157
|
+
if (mq.matches) return index;
|
|
2158
|
+
return 0;
|
|
2159
|
+
}, subscribe: (onStoreChange) => {
|
|
2160
|
+
const disposeFns = [];
|
|
2161
|
+
for (const { mq } of getSizes()) {
|
|
2162
|
+
const handleChange = () => {
|
|
2163
|
+
mq.matches && onStoreChange();
|
|
2164
|
+
};
|
|
2165
|
+
mq.addEventListener("change", handleChange), disposeFns.push(() => mq.removeEventListener("change", handleChange));
|
|
2241
2166
|
}
|
|
2242
|
-
|
|
2243
|
-
|
|
2167
|
+
return () => {
|
|
2168
|
+
for (const disposeFn of disposeFns)
|
|
2169
|
+
disposeFn();
|
|
2170
|
+
};
|
|
2171
|
+
} };
|
|
2172
|
+
}
|
|
2173
|
+
function getServerSnapshot$2() {
|
|
2174
|
+
return 0;
|
|
2175
|
+
}
|
|
2176
|
+
function useMediaIndex() {
|
|
2177
|
+
const { media } = useTheme_v2();
|
|
2178
|
+
let store = MEDIA_STORE_CACHE.get(media);
|
|
2179
|
+
return store || (store = _createMediaStore(media), MEDIA_STORE_CACHE.set(media, store)), useSyncExternalStore(store.subscribe, store.getSnapshot, getServerSnapshot$2);
|
|
2180
|
+
}
|
|
2181
|
+
let MEDIA_QUERY_CACHE$1;
|
|
2182
|
+
function getMatchMedia$1() {
|
|
2183
|
+
return MEDIA_QUERY_CACHE$1 || (MEDIA_QUERY_CACHE$1 = window.matchMedia("(prefers-color-scheme: dark)")), MEDIA_QUERY_CACHE$1;
|
|
2184
|
+
}
|
|
2185
|
+
function subscribe$2(onStoreChange) {
|
|
2186
|
+
const matchMedia = getMatchMedia$1();
|
|
2187
|
+
return matchMedia.addEventListener("change", onStoreChange), () => matchMedia.removeEventListener("change", onStoreChange);
|
|
2188
|
+
}
|
|
2189
|
+
function getSnapshot$1() {
|
|
2190
|
+
return getMatchMedia$1().matches;
|
|
2191
|
+
}
|
|
2192
|
+
function getServerSnapshot$1() {
|
|
2193
|
+
return !1;
|
|
2194
|
+
}
|
|
2195
|
+
function usePrefersDark() {
|
|
2196
|
+
return useSyncExternalStore(subscribe$2, getSnapshot$1, getServerSnapshot$1);
|
|
2197
|
+
}
|
|
2198
|
+
let MEDIA_QUERY_CACHE;
|
|
2199
|
+
function getMatchMedia() {
|
|
2200
|
+
return MEDIA_QUERY_CACHE || (MEDIA_QUERY_CACHE = window.matchMedia("(prefers-reduced-motion: reduce)")), MEDIA_QUERY_CACHE;
|
|
2201
|
+
}
|
|
2202
|
+
function subscribe$1(onStoreChange) {
|
|
2203
|
+
const matchMedia = getMatchMedia();
|
|
2204
|
+
return matchMedia.addEventListener("change", onStoreChange), () => matchMedia.removeEventListener("change", onStoreChange);
|
|
2205
|
+
}
|
|
2206
|
+
function getSnapshot() {
|
|
2207
|
+
return getMatchMedia().matches;
|
|
2208
|
+
}
|
|
2209
|
+
function getServerSnapshot() {
|
|
2210
|
+
return !1;
|
|
2211
|
+
}
|
|
2212
|
+
function usePrefersReducedMotion() {
|
|
2213
|
+
return useSyncExternalStore(subscribe$1, getSnapshot, getServerSnapshot);
|
|
2214
|
+
}
|
|
2215
|
+
function useForwardedRef(ref) {
|
|
2216
|
+
const innerRef = useRef(null);
|
|
2217
|
+
return useImperativeHandle(ref, () => innerRef.current), innerRef;
|
|
2218
|
+
}
|
|
2219
|
+
function useCustomValidity(ref, customValidity) {
|
|
2220
|
+
useEffect(() => {
|
|
2221
|
+
var _a;
|
|
2222
|
+
(_a = ref.current) == null || _a.setCustomValidity(customValidity || "");
|
|
2223
|
+
}, [customValidity, ref]);
|
|
2224
|
+
}
|
|
2244
2225
|
function checkboxBaseStyles() {
|
|
2245
2226
|
return css`
|
|
2246
2227
|
position: relative;
|
|
@@ -2469,8 +2450,8 @@ function codeBaseStyle() {
|
|
|
2469
2450
|
`;
|
|
2470
2451
|
}
|
|
2471
2452
|
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
|
|
2453
|
+
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]);
|
|
2454
|
+
return /* @__PURE__ */ jsxs(Root$q, { "data-ui": "Code", ...restProps, $size, $weight: weight, ref, children: [
|
|
2474
2455
|
!(language && registered) && /* @__PURE__ */ jsx("code", { children }),
|
|
2475
2456
|
language && registered && /* @__PURE__ */ jsx(Refractor, { inline: !0, language, value: String(children) })
|
|
2476
2457
|
] });
|
|
@@ -2491,33 +2472,24 @@ const Root$p = styled(Box)(
|
|
|
2491
2472
|
containerBaseStyle,
|
|
2492
2473
|
responsiveContainerWidthStyle
|
|
2493
2474
|
), 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
|
-
);
|
|
2475
|
+
const { as, width = 2, ...restProps } = props, $width = useMemo(() => _getArrayProp(width), [width]);
|
|
2476
|
+
return /* @__PURE__ */ jsx(Root$p, { "data-ui": "Container", ...restProps, $width, forwardedAs: as, ref });
|
|
2505
2477
|
}), Root$o = styled(Box)(responsiveGridStyle), Grid = forwardRef(function(props, ref) {
|
|
2506
|
-
const { as, autoRows, autoCols, autoFlow, columns, gap, gapX, gapY, rows, children, ...restProps } = props;
|
|
2478
|
+
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
2479
|
return /* @__PURE__ */ jsx(
|
|
2508
2480
|
Root$o,
|
|
2509
2481
|
{
|
|
2510
2482
|
"data-as": typeof as == "string" ? as : void 0,
|
|
2511
2483
|
"data-ui": "Grid",
|
|
2512
2484
|
...restProps,
|
|
2513
|
-
$autoRows
|
|
2514
|
-
$autoCols
|
|
2515
|
-
$autoFlow
|
|
2516
|
-
$columns
|
|
2517
|
-
$gap
|
|
2518
|
-
$gapX
|
|
2519
|
-
$gapY
|
|
2520
|
-
$rows
|
|
2485
|
+
$autoRows,
|
|
2486
|
+
$autoCols,
|
|
2487
|
+
$autoFlow,
|
|
2488
|
+
$columns,
|
|
2489
|
+
$gap,
|
|
2490
|
+
$gapX,
|
|
2491
|
+
$gapY,
|
|
2492
|
+
$rows,
|
|
2521
2493
|
forwardedAs: as,
|
|
2522
2494
|
ref,
|
|
2523
2495
|
children
|
|
@@ -2594,7 +2566,7 @@ const Root$n = styled.div(headingBaseStyle, responsiveTextAlignStyle, responsive
|
|
|
2594
2566
|
textOverflow,
|
|
2595
2567
|
weight,
|
|
2596
2568
|
...restProps
|
|
2597
|
-
} = props;
|
|
2569
|
+
} = props, $size = useMemo(() => _getArrayProp(size2), [size2]), $align = useMemo(() => _getArrayProp(align), [align]);
|
|
2598
2570
|
let children = childrenProp;
|
|
2599
2571
|
return textOverflow === "ellipsis" && (children = /* @__PURE__ */ jsx(SpanWithTextOverflow, { children })), /* @__PURE__ */ jsx(
|
|
2600
2572
|
Root$n,
|
|
@@ -2602,9 +2574,9 @@ const Root$n = styled.div(headingBaseStyle, responsiveTextAlignStyle, responsive
|
|
|
2602
2574
|
"data-ui": "Heading",
|
|
2603
2575
|
...restProps,
|
|
2604
2576
|
$accent: accent,
|
|
2605
|
-
$align
|
|
2577
|
+
$align,
|
|
2578
|
+
$size,
|
|
2606
2579
|
$muted: muted,
|
|
2607
|
-
$size: useArrayProp(size2),
|
|
2608
2580
|
$weight: weight,
|
|
2609
2581
|
ref,
|
|
2610
2582
|
children: /* @__PURE__ */ jsx("span", { children })
|
|
@@ -2634,7 +2606,7 @@ function inlineSpaceStyle(props) {
|
|
|
2634
2606
|
});
|
|
2635
2607
|
}
|
|
2636
2608
|
const Root$m = styled(Box)(inlineBaseStyle, inlineSpaceStyle), Inline = forwardRef(function(props, ref) {
|
|
2637
|
-
const { as, children: childrenProp, space, ...restProps } = props, children = useMemo(
|
|
2609
|
+
const { as, children: childrenProp, space, ...restProps } = props, $space = useMemo(() => _getArrayProp(space), [space]), children = useMemo(
|
|
2638
2610
|
() => Children.map(childrenProp, (child) => child && /* @__PURE__ */ jsx("div", { children: child })),
|
|
2639
2611
|
[childrenProp]
|
|
2640
2612
|
);
|
|
@@ -2643,7 +2615,7 @@ const Root$m = styled(Box)(inlineBaseStyle, inlineSpaceStyle), Inline = forwardR
|
|
|
2643
2615
|
{
|
|
2644
2616
|
"data-ui": "Inline",
|
|
2645
2617
|
...restProps,
|
|
2646
|
-
$space
|
|
2618
|
+
$space,
|
|
2647
2619
|
forwardedAs: as,
|
|
2648
2620
|
ref,
|
|
2649
2621
|
children
|
|
@@ -2668,8 +2640,8 @@ function kbdStyle() {
|
|
|
2668
2640
|
`;
|
|
2669
2641
|
}
|
|
2670
2642
|
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
|
|
2643
|
+
const { children, fontSize: fontSize2 = 0, padding = 1, radius = 2, ...restProps } = props, $radius = useMemo(() => _getArrayProp(radius), [radius]);
|
|
2644
|
+
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
2645
|
}), origin = {
|
|
2674
2646
|
name: "@sanity/ui/origin",
|
|
2675
2647
|
fn({ middlewareData, placement, rects }) {
|
|
@@ -2852,10 +2824,10 @@ function findMinBreakpoints(media, width) {
|
|
|
2852
2824
|
return ret;
|
|
2853
2825
|
}
|
|
2854
2826
|
const ElementQuery = forwardRef(function(props, forwardedRef) {
|
|
2855
|
-
const theme = useTheme_v2(), { children, media
|
|
2827
|
+
const theme = useTheme_v2(), { children, media: _media, ...restProps } = props, media = _media != null ? _media : theme.media, ref = useRef(null), [element, setElement] = useState(null), elementSize = useElementSize(element), width = useMemo(() => {
|
|
2856
2828
|
var _a;
|
|
2857
2829
|
return (_a = elementSize == null ? void 0 : elementSize.border.width) != null ? _a : window.innerWidth;
|
|
2858
|
-
}, [elementSize]), max =
|
|
2830
|
+
}, [elementSize]), max = findMaxBreakpoints(media, width), min = findMinBreakpoints(media, width);
|
|
2859
2831
|
useImperativeHandle(forwardedRef, () => ref.current);
|
|
2860
2832
|
const setRef = useCallback((el) => {
|
|
2861
2833
|
ref.current = el, setElement(el);
|
|
@@ -2989,18 +2961,18 @@ function _isScrollable(el) {
|
|
|
2989
2961
|
}
|
|
2990
2962
|
function LayerProvider(props) {
|
|
2991
2963
|
var _a;
|
|
2992
|
-
const { children, zOffset: zOffsetProp = 0 } = props, parentContextValue = useContext(LayerContext), parent = parentContextValue && getLayerContext(parentContextValue),
|
|
2964
|
+
const { children, zOffset: zOffsetProp = 0 } = props, parentContextValue = useContext(LayerContext), parentRegisterChild = useContext(LayerContextRegisterChild), parent = parentContextValue && getLayerContext(parentContextValue), 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], [childLayers, setChildLayers] = useState({}), size2 = useMemo(() => Object.keys(childLayers).length, [childLayers]), isTopLayer = size2 === 0, registerChild = useCallback(
|
|
2993
2965
|
(childLevel) => {
|
|
2994
2966
|
const parentDispose = parentRegisterChild == null ? void 0 : parentRegisterChild(childLevel);
|
|
2995
|
-
return
|
|
2967
|
+
return setChildLayers((state) => {
|
|
2996
2968
|
var _a2;
|
|
2997
|
-
const prevLen = (_a2 = state[childLevel]) != null ? _a2 : 0
|
|
2998
|
-
return
|
|
2999
|
-
})
|
|
3000
|
-
|
|
2969
|
+
const prevLen = (_a2 = state[childLevel]) != null ? _a2 : 0;
|
|
2970
|
+
return { ...state, [childLevel]: prevLen + 1 };
|
|
2971
|
+
}), () => {
|
|
2972
|
+
setChildLayers((state) => {
|
|
3001
2973
|
const nextState = { ...state };
|
|
3002
|
-
return nextState[childLevel] === 1 ?
|
|
3003
|
-
})
|
|
2974
|
+
return nextState[childLevel] === 1 ? delete nextState[childLevel] : nextState[childLevel] -= 1, nextState;
|
|
2975
|
+
}), parentDispose == null || parentDispose();
|
|
3004
2976
|
};
|
|
3005
2977
|
},
|
|
3006
2978
|
[parentRegisterChild]
|
|
@@ -3011,15 +2983,14 @@ function LayerProvider(props) {
|
|
|
3011
2983
|
version: 0,
|
|
3012
2984
|
isTopLayer,
|
|
3013
2985
|
level,
|
|
3014
|
-
registerChild,
|
|
3015
2986
|
size: size2,
|
|
3016
2987
|
zIndex
|
|
3017
2988
|
}),
|
|
3018
|
-
[isTopLayer, level,
|
|
2989
|
+
[isTopLayer, level, size2, zIndex]
|
|
3019
2990
|
);
|
|
3020
|
-
return /* @__PURE__ */ jsx(LayerContext.Provider, { value, children });
|
|
2991
|
+
return /* @__PURE__ */ jsx(LayerContext.Provider, { value, children: /* @__PURE__ */ jsx(LayerContextRegisterChild.Provider, { value: registerChild, children }) });
|
|
3021
2992
|
}
|
|
3022
|
-
const Root$j = styled.div({ position: "relative" }), LayerChildren = forwardRef(function(props, forwardedRef) {
|
|
2993
|
+
const LayerContextRegisterChild = createContext(null), Root$j = styled.div({ position: "relative" }), LayerChildren = forwardRef(function(props, forwardedRef) {
|
|
3023
2994
|
const { children, onActivate, onFocus, style = EMPTY_RECORD, ...restProps } = props, { zIndex, isTopLayer } = useLayer(), lastFocusedRef = useRef(null), ref = useRef(null), isTopLayerRef = useRef(isTopLayer);
|
|
3024
2995
|
useImperativeHandle(forwardedRef, () => ref.current), useEffect(() => {
|
|
3025
2996
|
isTopLayerRef.current !== isTopLayer && isTopLayer && (onActivate == null || onActivate({ activeElement: lastFocusedRef.current })), isTopLayerRef.current = isTopLayer;
|
|
@@ -3287,19 +3258,19 @@ const MotionCard$1 = styled(motion(Card))`
|
|
|
3287
3258
|
PopoverCard.displayName = "PopoverCard";
|
|
3288
3259
|
const Popover = memo(
|
|
3289
3260
|
forwardRef(function(props, forwardedRef) {
|
|
3290
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i
|
|
3261
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
3291
3262
|
const { container, layer } = useTheme_v2(), boundaryElementContext = useBoundaryElement(), {
|
|
3292
3263
|
__unstable_margins: margins = DEFAULT_POPOVER_MARGINS,
|
|
3293
3264
|
animate: _animate = !1,
|
|
3294
3265
|
arrow: arrowProp = !1,
|
|
3295
|
-
boundaryElement
|
|
3296
|
-
children:
|
|
3266
|
+
boundaryElement: _boundaryElement,
|
|
3267
|
+
children: _children,
|
|
3297
3268
|
constrainSize = !1,
|
|
3298
3269
|
content,
|
|
3299
3270
|
disabled,
|
|
3300
|
-
fallbackPlacements
|
|
3271
|
+
fallbackPlacements: _fallbackPlacements,
|
|
3301
3272
|
matchReferenceWidth,
|
|
3302
|
-
floatingBoundary
|
|
3273
|
+
floatingBoundary: _floatingBoundary,
|
|
3303
3274
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3304
3275
|
onActivate,
|
|
3305
3276
|
open,
|
|
@@ -3309,16 +3280,16 @@ const Popover = memo(
|
|
|
3309
3280
|
portal,
|
|
3310
3281
|
preventOverflow = !0,
|
|
3311
3282
|
radius: radiusProp = 3,
|
|
3312
|
-
referenceBoundary
|
|
3283
|
+
referenceBoundary: _referenceBoundary,
|
|
3313
3284
|
referenceElement,
|
|
3314
3285
|
scheme,
|
|
3315
3286
|
shadow: shadowProp = 3,
|
|
3316
3287
|
tone = "inherit",
|
|
3317
3288
|
width: widthProp = "auto",
|
|
3318
|
-
zOffset:
|
|
3289
|
+
zOffset: _zOffset,
|
|
3319
3290
|
updateRef,
|
|
3320
3291
|
...restProps
|
|
3321
|
-
} = props, animate = usePrefersReducedMotion() ? !1 : _animate, boundarySize = (
|
|
3292
|
+
} = props, boundaryElement = _boundaryElement != null ? _boundaryElement : boundaryElementContext.element, referenceBoundary = (_a = _referenceBoundary != null ? _referenceBoundary : props.boundaryElement) != null ? _a : boundaryElementContext.element, floatingBoundary = (_b = _floatingBoundary != null ? _floatingBoundary : props.boundaryElement) != null ? _b : boundaryElementContext.element, fallbackPlacements = _fallbackPlacements != null ? _fallbackPlacements : DEFAULT_FALLBACK_PLACEMENTS$1[(_c = props.placement) != null ? _c : "bottom"], zOffsetProp = _zOffset != null ? _zOffset : layer.popover.zOffset, animate = usePrefersReducedMotion() ? !1 : _animate, boundarySize = (_d = useElementSize(boundaryElement)) == null ? void 0 : _d.border, padding = useMemo(() => _getArrayProp(paddingProp), [paddingProp]), radius = useMemo(() => _getArrayProp(radiusProp), [radiusProp]), shadow = useMemo(() => _getArrayProp(shadowProp), [shadowProp]), widthArrayProp = _getArrayProp(widthProp), zOffset = useMemo(() => _getArrayProp(zOffsetProp), [zOffsetProp]), ref = useRef(null), arrowRef = useRef(null), rootBoundary = "viewport";
|
|
3322
3293
|
useImperativeHandle(
|
|
3323
3294
|
forwardedRef,
|
|
3324
3295
|
() => ref.current
|
|
@@ -3399,27 +3370,24 @@ const Popover = memo(
|
|
|
3399
3370
|
middleware,
|
|
3400
3371
|
placement: placementProp,
|
|
3401
3372
|
whileElementsMounted: autoUpdate
|
|
3402
|
-
}), referenceHidden = (
|
|
3373
|
+
}), referenceHidden = (_e = middlewareData.hide) == null ? void 0 : _e.referenceHidden, arrowX = (_f = middlewareData.arrow) == null ? void 0 : _f.x, arrowY = (_g = middlewareData.arrow) == null ? void 0 : _g.y, originX = (_h = middlewareData["@sanity/ui/origin"]) == null ? void 0 : _h.originX, originY = (_i = middlewareData["@sanity/ui/origin"]) == null ? void 0 : _i.originY, setArrow = useCallback((arrowEl) => {
|
|
3403
3374
|
arrowRef.current = arrowEl;
|
|
3404
3375
|
}, []), setFloating = useCallback(
|
|
3405
3376
|
(node) => {
|
|
3406
3377
|
ref.current = node, refs.setFloating(node);
|
|
3407
3378
|
},
|
|
3408
3379
|
[refs]
|
|
3409
|
-
)
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
child || refs.setReference(referenceElement || null);
|
|
3421
|
-
}, [referenceElement, refs, child]), disabled)
|
|
3422
|
-
return childProp || /* @__PURE__ */ jsx(Fragment, {});
|
|
3380
|
+
);
|
|
3381
|
+
useImperativeHandle(updateRef, () => update, [update]), useEffect(() => {
|
|
3382
|
+
_children || refs.setReference(referenceElement || null);
|
|
3383
|
+
}, [_children, referenceElement, refs]);
|
|
3384
|
+
const children = useMemo(() => !_children || referenceElement ? null : cloneElement(_children, {
|
|
3385
|
+
ref: (node) => {
|
|
3386
|
+
logDeprecatedWarning(), refs.setReference(node);
|
|
3387
|
+
}
|
|
3388
|
+
}), [_children, referenceElement, refs]);
|
|
3389
|
+
if (disabled)
|
|
3390
|
+
return _children || /* @__PURE__ */ jsx(Fragment, {});
|
|
3423
3391
|
const popover = /* @__PURE__ */ jsx(LayerProvider, { zOffset, children: /* @__PURE__ */ jsx(
|
|
3424
3392
|
PopoverCard,
|
|
3425
3393
|
{
|
|
@@ -3453,22 +3421,26 @@ const Popover = memo(
|
|
|
3453
3421
|
ConditionalWrapper,
|
|
3454
3422
|
{
|
|
3455
3423
|
condition: animate,
|
|
3456
|
-
wrapper: (
|
|
3424
|
+
wrapper: (children2) => /* @__PURE__ */ jsx(AnimatePresence, { children: children2 }),
|
|
3457
3425
|
children: open && /* @__PURE__ */ jsx(
|
|
3458
3426
|
ConditionalWrapper,
|
|
3459
3427
|
{
|
|
3460
3428
|
condition: !!portal,
|
|
3461
|
-
wrapper: (
|
|
3429
|
+
wrapper: (children2) => /* @__PURE__ */ jsx(Portal, { __unstable_name: typeof portal == "string" ? portal : void 0, children: children2 }),
|
|
3462
3430
|
children: popover
|
|
3463
3431
|
}
|
|
3464
3432
|
)
|
|
3465
3433
|
}
|
|
3466
3434
|
),
|
|
3467
|
-
|
|
3435
|
+
children
|
|
3468
3436
|
] });
|
|
3469
3437
|
})
|
|
3470
3438
|
);
|
|
3471
3439
|
Popover.displayName = "Popover";
|
|
3440
|
+
let didWarn = !1;
|
|
3441
|
+
function logDeprecatedWarning() {
|
|
3442
|
+
didWarn || (console.warn("Popover: Please use the `referenceElement` prop instead of passing a children."), didWarn = !0);
|
|
3443
|
+
}
|
|
3472
3444
|
function radioBaseStyle() {
|
|
3473
3445
|
return css`
|
|
3474
3446
|
position: relative;
|
|
@@ -3744,20 +3716,22 @@ const selectStyle = {
|
|
|
3744
3716
|
space = 3,
|
|
3745
3717
|
...restProps
|
|
3746
3718
|
} = props, ref = useRef(null);
|
|
3747
|
-
|
|
3719
|
+
useImperativeHandle(
|
|
3748
3720
|
forwardedRef,
|
|
3749
3721
|
() => ref.current
|
|
3750
|
-
), useCustomValidity(ref, customValidity)
|
|
3722
|
+
), useCustomValidity(ref, customValidity);
|
|
3723
|
+
const $fontSize = useMemo(() => _getArrayProp(fontSize2), [fontSize2]), $padding = useMemo(() => _getArrayProp(padding), [padding]), $radius = useMemo(() => _getArrayProp(radius), [radius]), $space = useMemo(() => _getArrayProp(space), [space]);
|
|
3724
|
+
return /* @__PURE__ */ jsxs(Root$f, { "data-ui": "Select", children: [
|
|
3751
3725
|
/* @__PURE__ */ jsx(
|
|
3752
3726
|
Input$3,
|
|
3753
3727
|
{
|
|
3754
3728
|
"data-read-only": !disabled && readOnly ? "" : void 0,
|
|
3755
3729
|
"data-ui": "Select",
|
|
3756
3730
|
...restProps,
|
|
3757
|
-
$fontSize
|
|
3758
|
-
$padding
|
|
3759
|
-
$radius
|
|
3760
|
-
$space
|
|
3731
|
+
$fontSize,
|
|
3732
|
+
$padding,
|
|
3733
|
+
$radius,
|
|
3734
|
+
$space,
|
|
3761
3735
|
disabled: disabled || readOnly,
|
|
3762
3736
|
ref,
|
|
3763
3737
|
children
|
|
@@ -3785,14 +3759,14 @@ function responsiveStackSpaceStyle(props) {
|
|
|
3785
3759
|
}));
|
|
3786
3760
|
}
|
|
3787
3761
|
const Root$e = styled(Box)(stackBaseStyle, responsiveStackSpaceStyle), Stack = forwardRef(function(props, ref) {
|
|
3788
|
-
const { as, space, ...restProps } = props;
|
|
3762
|
+
const { as, space, ...restProps } = props, $space = useMemo(() => _getArrayProp(space), [space]);
|
|
3789
3763
|
return /* @__PURE__ */ jsx(
|
|
3790
3764
|
Root$e,
|
|
3791
3765
|
{
|
|
3792
3766
|
"data-as": typeof as == "string" ? as : void 0,
|
|
3793
3767
|
"data-ui": "Stack",
|
|
3794
3768
|
...restProps,
|
|
3795
|
-
$space
|
|
3769
|
+
$space,
|
|
3796
3770
|
forwardedAs: as,
|
|
3797
3771
|
ref
|
|
3798
3772
|
}
|
|
@@ -3987,10 +3961,12 @@ const Root$d = styled.span(switchBaseStyles), Input$2 = styled.input(switchInput
|
|
|
3987
3961
|
weight,
|
|
3988
3962
|
...restProps
|
|
3989
3963
|
} = props, ref = useRef(null), rootTheme = useRootTheme();
|
|
3990
|
-
|
|
3964
|
+
useImperativeHandle(
|
|
3991
3965
|
forwardedRef,
|
|
3992
3966
|
() => ref.current
|
|
3993
|
-
), useCustomValidity(ref, customValidity)
|
|
3967
|
+
), useCustomValidity(ref, customValidity);
|
|
3968
|
+
const $radius = useMemo(() => _getArrayProp(radius), [radius]), $fontSize = useMemo(() => _getArrayProp(fontSize2), [fontSize2]), $padding = useMemo(() => _getArrayProp(padding), [padding]), $space = useMemo(() => _getArrayProp(0), []);
|
|
3969
|
+
return /* @__PURE__ */ jsx(Root$c, { "data-ui": "TextArea", children: /* @__PURE__ */ jsxs(InputRoot$1, { children: [
|
|
3994
3970
|
/* @__PURE__ */ jsx(
|
|
3995
3971
|
Input$1,
|
|
3996
3972
|
{
|
|
@@ -3998,10 +3974,10 @@ const Root$d = styled.span(switchBaseStyles), Input$2 = styled.input(switchInput
|
|
|
3998
3974
|
"data-scheme": rootTheme.scheme,
|
|
3999
3975
|
"data-tone": rootTheme.tone,
|
|
4000
3976
|
...restProps,
|
|
4001
|
-
$fontSize
|
|
4002
|
-
$padding
|
|
3977
|
+
$fontSize,
|
|
3978
|
+
$padding,
|
|
3979
|
+
$space,
|
|
4003
3980
|
$scheme: rootTheme.scheme,
|
|
4004
|
-
$space: useArrayProp(0),
|
|
4005
3981
|
$tone: rootTheme.tone,
|
|
4006
3982
|
$weight: weight,
|
|
4007
3983
|
disabled,
|
|
@@ -4011,7 +3987,7 @@ const Root$d = styled.span(switchBaseStyles), Input$2 = styled.input(switchInput
|
|
|
4011
3987
|
/* @__PURE__ */ jsx(
|
|
4012
3988
|
Presentation$1,
|
|
4013
3989
|
{
|
|
4014
|
-
$radius
|
|
3990
|
+
$radius,
|
|
4015
3991
|
$scheme: rootTheme.scheme,
|
|
4016
3992
|
$tone: rootTheme.tone,
|
|
4017
3993
|
"data-border": border2 ? "" : void 0,
|
|
@@ -4085,7 +4061,7 @@ const Root$d = styled.span(switchBaseStyles), Input$2 = styled.input(switchInput
|
|
|
4085
4061
|
type = "text",
|
|
4086
4062
|
weight,
|
|
4087
4063
|
...restProps
|
|
4088
|
-
} = props, ref = useRef(null), rootTheme = useRootTheme(), fontSize2 =
|
|
4064
|
+
} = 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
4065
|
useImperativeHandle(
|
|
4090
4066
|
forwardedRef,
|
|
4091
4067
|
() => ref.current
|
|
@@ -4337,27 +4313,30 @@ const Root$a = styled(Layer)`
|
|
|
4337
4313
|
pointer-events: none;
|
|
4338
4314
|
max-width: ${({ $maxWidth }) => $maxWidth}px;
|
|
4339
4315
|
`, Tooltip = forwardRef(function(props, forwardedRef) {
|
|
4340
|
-
var _a, _b, _c, _d, _e, _f
|
|
4316
|
+
var _a, _b, _c, _d, _e, _f;
|
|
4341
4317
|
const boundaryElementContext = useBoundaryElement(), { layer } = useTheme_v2(), {
|
|
4342
4318
|
animate: _animate = !1,
|
|
4343
4319
|
arrow: arrowProp = !1,
|
|
4344
|
-
boundaryElement
|
|
4320
|
+
boundaryElement: _boundaryElement,
|
|
4345
4321
|
children: childProp,
|
|
4346
4322
|
content,
|
|
4347
4323
|
disabled,
|
|
4348
|
-
fallbackPlacements:
|
|
4324
|
+
fallbackPlacements: _fallbackPlacements,
|
|
4349
4325
|
padding = 2,
|
|
4350
4326
|
placement: placementProp = "bottom",
|
|
4351
4327
|
portal: portalProp,
|
|
4352
4328
|
radius = 2,
|
|
4353
4329
|
scheme,
|
|
4354
4330
|
shadow = 2,
|
|
4355
|
-
zOffset
|
|
4331
|
+
zOffset: _zOffset,
|
|
4356
4332
|
delay,
|
|
4357
4333
|
...restProps
|
|
4358
|
-
} = props,
|
|
4334
|
+
} = props, zOffset = _zOffset != null ? _zOffset : layer.tooltip.zOffset, fallbackPlacementsProp = _fallbackPlacements != null ? _fallbackPlacements : DEFAULT_FALLBACK_PLACEMENTS[(_a = props.placement) != null ? _a : "bottom"], boundaryElement = _boundaryElement != null ? _boundaryElement : boundaryElementContext == null ? void 0 : boundaryElementContext.element, animate = usePrefersReducedMotion() ? !1 : _animate, fallbackPlacements = useMemo(
|
|
4335
|
+
() => _getArrayProp(fallbackPlacementsProp),
|
|
4336
|
+
[fallbackPlacementsProp]
|
|
4337
|
+
), ref = useRef(null), [referenceElement, setReferenceElement] = useState(null), arrowRef = useRef(null), rootBoundary = "viewport";
|
|
4359
4338
|
useImperativeHandle(forwardedRef, () => ref.current);
|
|
4360
|
-
const portal = usePortal(), portalElement = typeof portalProp == "string" ? ((
|
|
4339
|
+
const portal = usePortal(), portalElement = typeof portalProp == "string" ? ((_b = portal.elements) == null ? void 0 : _b[portalProp]) || null : portal.element, documentBodyOffsetWidth = useSyncExternalStore(
|
|
4361
4340
|
emptySubscribe,
|
|
4362
4341
|
() => document.body.offsetWidth,
|
|
4363
4342
|
// We don't actually know what the width of the body is during SSR, so we'll just assume it's 800px or larger
|
|
@@ -4388,7 +4367,7 @@ const Root$a = styled(Layer)`
|
|
|
4388
4367
|
middleware,
|
|
4389
4368
|
placement: placementProp,
|
|
4390
4369
|
whileElementsMounted: autoUpdate
|
|
4391
|
-
}), arrowX = (
|
|
4370
|
+
}), arrowX = (_c = middlewareData.arrow) == null ? void 0 : _c.x, arrowY = (_d = middlewareData.arrow) == null ? void 0 : _d.y, originX = (_e = middlewareData["@sanity/ui/origin"]) == null ? void 0 : _e.originX, originY = (_f = middlewareData["@sanity/ui/origin"]) == null ? void 0 : _f.originY, tooltipId = useId(), [isOpen, setIsOpen] = useDelayedState(!1), delayGroupContext = useTooltipDelayGroup(), showTooltip = isOpen || (delayGroupContext == null ? void 0 : delayGroupContext.openTooltipId) === tooltipId, isInsideGroup = delayGroupContext !== null, openDelayProp = typeof delay == "number" ? delay : (delay == null ? void 0 : delay.open) || 0, closeDelayProp = typeof delay == "number" ? delay : (delay == null ? void 0 : delay.close) || 0, openDelay = isInsideGroup ? delayGroupContext.openDelay : openDelayProp, closeDelay = isInsideGroup ? delayGroupContext.closeDelay : closeDelayProp, handleIsOpenChange = useCallback(
|
|
4392
4371
|
(open, immediate) => {
|
|
4393
4372
|
if (isInsideGroup)
|
|
4394
4373
|
if (open) {
|
|
@@ -4441,9 +4420,9 @@ const Root$a = styled(Layer)`
|
|
|
4441
4420
|
);
|
|
4442
4421
|
useEffect(() => {
|
|
4443
4422
|
if (!showTooltip) return;
|
|
4444
|
-
|
|
4423
|
+
const handleWindowMouseMove = (event) => {
|
|
4445
4424
|
referenceElement && (referenceElement === event.target || event.target instanceof Node && referenceElement.contains(event.target) || (handleIsOpenChange(!1), window.removeEventListener("mousemove", handleWindowMouseMove)));
|
|
4446
|
-
}
|
|
4425
|
+
};
|
|
4447
4426
|
return window.addEventListener("mousemove", handleWindowMouseMove), () => {
|
|
4448
4427
|
window.removeEventListener("mousemove", handleWindowMouseMove);
|
|
4449
4428
|
};
|
|
@@ -4646,37 +4625,34 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = [
|
|
|
4646
4625
|
forwardedRef,
|
|
4647
4626
|
() => inputElementRef.current
|
|
4648
4627
|
);
|
|
4649
|
-
const listBoxId = `${id}-listbox`, options = Array.isArray(optionsProp) ? optionsProp : EMPTY_ARRAY, padding =
|
|
4628
|
+
const listBoxId = `${id}-listbox`, options = Array.isArray(optionsProp) ? optionsProp : EMPTY_ARRAY, padding = _getArrayProp(paddingProp), currentOption = useMemo(
|
|
4650
4629
|
() => value !== null ? options.find((o) => o.value === value) : void 0,
|
|
4651
4630
|
[options, value]
|
|
4652
4631
|
), filteredOptions = useMemo(
|
|
4653
4632
|
() => options.filter((option) => query ? filterOption(query, option) : !0),
|
|
4654
4633
|
[filterOption, options, query]
|
|
4655
|
-
), filteredOptionsLen = filteredOptions.length, activeItemId = activeValue ? `${id}-option-${activeValue}` : void 0, expanded = query !== null && loading || focused && query !== null, handleRootBlur =
|
|
4656
|
-
(
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
|
|
4661
|
-
|
|
4662
|
-
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
|
|
4666
|
-
|
|
4667
|
-
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
|
|
4672
|
-
|
|
4673
|
-
|
|
4674
|
-
},
|
|
4675
|
-
[onBlur, onQueryChange, relatedElements]
|
|
4676
|
-
), handleRootFocus = useCallback((event) => {
|
|
4634
|
+
), filteredOptionsLen = filteredOptions.length, activeItemId = activeValue ? `${id}-option-${activeValue}` : void 0, expanded = query !== null && loading || focused && query !== null, handleRootBlur = (event) => {
|
|
4635
|
+
setTimeout(() => {
|
|
4636
|
+
if (popoverMouseWithinRef.current)
|
|
4637
|
+
return;
|
|
4638
|
+
const elements = (relatedElements || []).concat(
|
|
4639
|
+
rootElementRef.current ? [rootElementRef.current] : [],
|
|
4640
|
+
resultsPopoverElementRef.current ? [resultsPopoverElementRef.current] : []
|
|
4641
|
+
);
|
|
4642
|
+
let focusInside = !1;
|
|
4643
|
+
if (document.activeElement) {
|
|
4644
|
+
for (const e of elements)
|
|
4645
|
+
if (e === document.activeElement || e.contains(document.activeElement)) {
|
|
4646
|
+
focusInside = !0;
|
|
4647
|
+
break;
|
|
4648
|
+
}
|
|
4649
|
+
}
|
|
4650
|
+
focusInside === !1 && (dispatch({ type: "root/blur" }), popoverMouseWithinRef.current = !1, onQueryChange && onQueryChange(null), onBlur && onBlur(event));
|
|
4651
|
+
}, 0);
|
|
4652
|
+
}, handleRootFocus = (event) => {
|
|
4677
4653
|
const listBoxElement = listBoxElementRef.current, focusedElement = event.target instanceof HTMLElement ? event.target : null, listFocused2 = (listBoxElement == null ? void 0 : listBoxElement.contains(focusedElement)) || !1;
|
|
4678
4654
|
listFocused2 !== listFocusedRef.current && (listFocusedRef.current = listFocused2, dispatch({ type: "root/setListFocused", listFocused: listFocused2 }));
|
|
4679
|
-
},
|
|
4655
|
+
}, handleOptionSelect = useCallback(
|
|
4680
4656
|
(v) => {
|
|
4681
4657
|
var _a;
|
|
4682
4658
|
dispatch({ type: "value/change", value: v }), popoverMouseWithinRef.current = !1, onSelect && onSelect(v), valueRef.current = v, onChange && onChange(v), onQueryChange && onQueryChange(null), (_a = inputElementRef.current) == null || _a.focus();
|
|
@@ -4952,7 +4928,7 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = [
|
|
|
4952
4928
|
appearance: none;
|
|
4953
4929
|
margin: -4px;
|
|
4954
4930
|
`, Breadcrumbs = forwardRef(function(props, ref) {
|
|
4955
|
-
const { children, maxLength, separator, space: spaceRaw = 2, ...restProps } = props, space =
|
|
4931
|
+
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), []);
|
|
4956
4932
|
useClickOutside(collapse, [expandElement, popoverElement]);
|
|
4957
4933
|
const rawItems = useMemo(() => Children.toArray(children).filter(isValidElement), [children]), items = useMemo(() => {
|
|
4958
4934
|
const len = rawItems.length;
|
|
@@ -5101,7 +5077,7 @@ const Root$7 = styled(Layer)(responsivePaddingStyle, dialogStyle, responsiveDial
|
|
|
5101
5077
|
scheme,
|
|
5102
5078
|
shadow: shadowProp,
|
|
5103
5079
|
width: widthProp
|
|
5104
|
-
} = props, portal = usePortal(), portalElement = portalProp ? ((_a = portal.elements) == null ? void 0 : _a[portalProp]) || null : portal.element, boundaryElement = useBoundaryElement().element, radius =
|
|
5080
|
+
} = 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;
|
|
5105
5081
|
useImperativeHandle(forwardedRef, () => ref.current), useImperativeHandle(
|
|
5106
5082
|
forwardedContentRef,
|
|
5107
5083
|
() => contentRef.current
|
|
@@ -5166,13 +5142,13 @@ const Root$7 = styled(Layer)(responsivePaddingStyle, dialogStyle, responsiveDial
|
|
|
5166
5142
|
onFocus,
|
|
5167
5143
|
padding: paddingProp = 3,
|
|
5168
5144
|
portal: portalProp,
|
|
5169
|
-
position:
|
|
5145
|
+
position: _position,
|
|
5170
5146
|
scheme,
|
|
5171
5147
|
width: widthProp = 0,
|
|
5172
|
-
zOffset:
|
|
5148
|
+
zOffset: _zOffset,
|
|
5173
5149
|
animate: _animate = !1,
|
|
5174
5150
|
...restProps
|
|
5175
|
-
} = props, animate = usePrefersReducedMotion() ? !1 : _animate, portal = usePortal(), portalElement = portalProp ? ((_a = portal.elements) == null ? void 0 : _a[portalProp]) || null : portal.element, boundaryElement = useBoundaryElement().element, cardRadius =
|
|
5151
|
+
} = props, positionProp = _position != null ? _position : dialog.position || "fixed", zOffsetProp = _zOffset != null ? _zOffset : dialog.zOffset || layer.dialog.zOffset, 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(
|
|
5176
5152
|
(event) => {
|
|
5177
5153
|
onFocus == null || onFocus(event);
|
|
5178
5154
|
const target = event.target, cardElement = cardRef.current;
|
|
@@ -5268,7 +5244,7 @@ const Root$6 = styled.kbd`
|
|
|
5268
5244
|
display: block;
|
|
5269
5245
|
}
|
|
5270
5246
|
`, Hotkeys = forwardRef(function(props, ref) {
|
|
5271
|
-
const { fontSize: fontSize2, keys, padding, radius, space: spaceProp = 0.5, ...restProps } = props, space =
|
|
5247
|
+
const { fontSize: fontSize2, keys, padding, radius, space: spaceProp = 0.5, ...restProps } = props, space = useMemo(() => _getArrayProp(spaceProp), [spaceProp]);
|
|
5272
5248
|
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)) }) });
|
|
5273
5249
|
}), key$2 = Symbol.for("@sanity/ui/context/menu"), MenuContext = createGlobalScopedContext(key$2, null);
|
|
5274
5250
|
function _isFocusable(element) {
|
|
@@ -5436,10 +5412,10 @@ const Root$5 = styled(Box)`
|
|
|
5436
5412
|
originElement,
|
|
5437
5413
|
padding = 1,
|
|
5438
5414
|
registerElement,
|
|
5439
|
-
shouldFocus
|
|
5415
|
+
shouldFocus: _shouldFocus,
|
|
5440
5416
|
space = 1,
|
|
5441
5417
|
...restProps
|
|
5442
|
-
} = props, ref = useRef(null);
|
|
5418
|
+
} = props, shouldFocus = _shouldFocus != null ? _shouldFocus : props.focusFirst && "first" || props.focusLast && "last" || null, ref = useRef(null);
|
|
5443
5419
|
useImperativeHandle(forwardedRef, () => ref.current);
|
|
5444
5420
|
const { isTopLayer } = useLayer(), {
|
|
5445
5421
|
activeElement,
|
|
@@ -5583,28 +5559,16 @@ const Root$5 = styled(Box)`
|
|
|
5583
5559
|
setOpen(!1), !disableRestoreFocusOnClose && buttonElement && buttonElement.focus();
|
|
5584
5560
|
}, [buttonElement, disableRestoreFocusOnClose]), registerElement = useCallback((el) => (setChildMenuElements((els) => els.concat([el])), () => {
|
|
5585
5561
|
setChildMenuElements((els) => els.filter((_el) => _el !== el));
|
|
5586
|
-
}), []),
|
|
5587
|
-
|
|
5588
|
-
|
|
5589
|
-
|
|
5590
|
-
|
|
5591
|
-
|
|
5592
|
-
|
|
5593
|
-
|
|
5594
|
-
|
|
5595
|
-
|
|
5596
|
-
}),
|
|
5597
|
-
[
|
|
5598
|
-
buttonElement,
|
|
5599
|
-
handleMenuClickOutside,
|
|
5600
|
-
handleMenuEscape,
|
|
5601
|
-
handleItemClick,
|
|
5602
|
-
id,
|
|
5603
|
-
handleBlur,
|
|
5604
|
-
registerElement,
|
|
5605
|
-
shouldFocus
|
|
5606
|
-
]
|
|
5607
|
-
), menu = menuProp && cloneElement(menuProp, menuProps), ref = useRef(null), button = useMemo(
|
|
5562
|
+
}), []), menu = menuProp && cloneElement(menuProp, {
|
|
5563
|
+
"aria-labelledby": id,
|
|
5564
|
+
onBlurCapture: handleBlur,
|
|
5565
|
+
onClickOutside: handleMenuClickOutside,
|
|
5566
|
+
onEscape: handleMenuEscape,
|
|
5567
|
+
onItemClick: handleItemClick,
|
|
5568
|
+
originElement: buttonElement,
|
|
5569
|
+
registerElement,
|
|
5570
|
+
shouldFocus
|
|
5571
|
+
}), button = useMemo(
|
|
5608
5572
|
() => {
|
|
5609
5573
|
var _a;
|
|
5610
5574
|
return buttonProp && cloneElement(buttonProp, {
|
|
@@ -5615,7 +5579,7 @@ const Root$5 = styled(Box)`
|
|
|
5615
5579
|
onMouseDown: handleMouseDown,
|
|
5616
5580
|
"aria-haspopup": !0,
|
|
5617
5581
|
"aria-expanded": open,
|
|
5618
|
-
ref,
|
|
5582
|
+
ref: setButtonElement,
|
|
5619
5583
|
selected: (_a = buttonProp.props.selected) != null ? _a : open
|
|
5620
5584
|
});
|
|
5621
5585
|
},
|
|
@@ -5623,11 +5587,9 @@ const Root$5 = styled(Box)`
|
|
|
5623
5587
|
);
|
|
5624
5588
|
useImperativeHandle(
|
|
5625
5589
|
forwardedRef,
|
|
5626
|
-
() =>
|
|
5627
|
-
|
|
5628
|
-
|
|
5629
|
-
return setButtonElement(ref.current), () => setButtonElement(null);
|
|
5630
|
-
}, [button]);
|
|
5590
|
+
() => buttonElement,
|
|
5591
|
+
[buttonElement]
|
|
5592
|
+
);
|
|
5631
5593
|
const popoverProps = useMemo(
|
|
5632
5594
|
() => ({
|
|
5633
5595
|
boundaryElement: deprecated_boundaryElement,
|
|
@@ -5649,7 +5611,19 @@ const Root$5 = styled(Box)`
|
|
|
5649
5611
|
popover
|
|
5650
5612
|
]
|
|
5651
5613
|
);
|
|
5652
|
-
return /* @__PURE__ */
|
|
5614
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5615
|
+
/* @__PURE__ */ jsx(
|
|
5616
|
+
Popover,
|
|
5617
|
+
{
|
|
5618
|
+
"data-ui": "MenuButton__popover",
|
|
5619
|
+
referenceElement: buttonElement,
|
|
5620
|
+
...popoverProps,
|
|
5621
|
+
content: menu,
|
|
5622
|
+
open
|
|
5623
|
+
}
|
|
5624
|
+
),
|
|
5625
|
+
button
|
|
5626
|
+
] });
|
|
5653
5627
|
}), MenuDivider = styled.hr`
|
|
5654
5628
|
height: 1px;
|
|
5655
5629
|
border: 0;
|
|
@@ -5774,7 +5748,7 @@ function MenuGroup(props) {
|
|
|
5774
5748
|
onClick,
|
|
5775
5749
|
padding = 3,
|
|
5776
5750
|
popover,
|
|
5777
|
-
radius = 2,
|
|
5751
|
+
radius: radiusProp = 2,
|
|
5778
5752
|
space = 3,
|
|
5779
5753
|
text,
|
|
5780
5754
|
tone = "default",
|
|
@@ -5785,9 +5759,9 @@ function MenuGroup(props) {
|
|
|
5785
5759
|
onClickOutside,
|
|
5786
5760
|
onEscape,
|
|
5787
5761
|
onItemClick,
|
|
5788
|
-
onItemMouseEnter
|
|
5762
|
+
onItemMouseEnter: _onItemMouseEnter,
|
|
5789
5763
|
registerElement
|
|
5790
|
-
} = menu, [rootElement, setRootElement] = useState(null), [open, setOpen] = useState(!1), shouldFocusRef = useRef(null), active = !!activeElement && activeElement === rootElement, [withinMenu, setWithinMenu] = useState(!1), handleMouseEnter = useCallback(
|
|
5764
|
+
} = menu, onItemMouseEnter = _onItemMouseEnter != null ? _onItemMouseEnter : menu.onMouseEnter, [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(
|
|
5791
5765
|
(event) => {
|
|
5792
5766
|
setWithinMenu(!1), onItemMouseEnter(event), setOpen(!0);
|
|
5793
5767
|
},
|
|
@@ -5845,7 +5819,7 @@ function MenuGroup(props) {
|
|
|
5845
5819
|
"aria-pressed": as === "button" ? withinMenu : void 0,
|
|
5846
5820
|
"data-pressed": as !== "button" ? withinMenu : void 0,
|
|
5847
5821
|
"data-selected": !withinMenu && active ? "" : void 0,
|
|
5848
|
-
$radius:
|
|
5822
|
+
$radius: radius,
|
|
5849
5823
|
$tone: tone,
|
|
5850
5824
|
$scheme: scheme,
|
|
5851
5825
|
onClick: handleClick,
|
|
@@ -5893,9 +5867,9 @@ const MenuItem = forwardRef(function(props, forwardedRef) {
|
|
|
5893
5867
|
activeElement,
|
|
5894
5868
|
mount,
|
|
5895
5869
|
onItemClick,
|
|
5896
|
-
onItemMouseEnter
|
|
5897
|
-
onItemMouseLeave
|
|
5898
|
-
} = menu, [rootElement, setRootElement] = useState(null), active = !!activeElement && activeElement === rootElement, ref = useRef(null);
|
|
5870
|
+
onItemMouseEnter: _onItemMouseEnter,
|
|
5871
|
+
onItemMouseLeave: _onItemMouseLeave
|
|
5872
|
+
} = menu, onItemMouseEnter = _onItemMouseEnter != null ? _onItemMouseEnter : menu.onMouseEnter, onItemMouseLeave = _onItemMouseLeave != null ? _onItemMouseLeave : menu.onMouseLeave, [rootElement, setRootElement] = useState(null), active = !!activeElement && activeElement === rootElement, ref = useRef(null);
|
|
5899
5873
|
useImperativeHandle(forwardedRef, () => ref.current), useEffect(() => mount(rootElement, selectedProp), [mount, rootElement, selectedProp]);
|
|
5900
5874
|
const handleClick = useCallback(
|
|
5901
5875
|
(event) => {
|
|
@@ -5913,7 +5887,7 @@ const MenuItem = forwardRef(function(props, forwardedRef) {
|
|
|
5913
5887
|
paddingLeft
|
|
5914
5888
|
}),
|
|
5915
5889
|
[padding, paddingX, paddingY, paddingTop, paddingRight, paddingBottom, paddingLeft]
|
|
5916
|
-
), hotkeysFontSize =
|
|
5890
|
+
), hotkeysFontSize = useMemo(() => _getArrayProp(fontSize2).map((s) => s - 1), [fontSize2]), $radius = useMemo(() => _getArrayProp(radius), [radius]), $padding = useMemo(() => _getArrayProp(0), []), setRef = useCallback((el) => {
|
|
5917
5891
|
ref.current = el, setRootElement(el);
|
|
5918
5892
|
}, []);
|
|
5919
5893
|
return /* @__PURE__ */ jsxs(
|
|
@@ -5926,8 +5900,8 @@ const MenuItem = forwardRef(function(props, forwardedRef) {
|
|
|
5926
5900
|
"data-selected": active ? "" : void 0,
|
|
5927
5901
|
"data-disabled": disabled ? "" : void 0,
|
|
5928
5902
|
forwardedAs: as,
|
|
5929
|
-
$radius
|
|
5930
|
-
$padding
|
|
5903
|
+
$radius,
|
|
5904
|
+
$padding,
|
|
5931
5905
|
$tone: disabled ? "default" : tone,
|
|
5932
5906
|
$scheme: scheme,
|
|
5933
5907
|
disabled,
|
|
@@ -6003,7 +5977,7 @@ const MenuItem = forwardRef(function(props, forwardedRef) {
|
|
|
6003
5977
|
skeletonStyle
|
|
6004
5978
|
), Skeleton = forwardRef(function(props, ref) {
|
|
6005
5979
|
const { animated = !1, delay, radius, ...restProps } = props, [visible, setVisible] = useState(!delay);
|
|
6006
|
-
|
|
5980
|
+
useEffect(() => {
|
|
6007
5981
|
if (!delay)
|
|
6008
5982
|
return setVisible(!0);
|
|
6009
5983
|
const timeout = setTimeout(() => {
|
|
@@ -6012,16 +5986,9 @@ const MenuItem = forwardRef(function(props, forwardedRef) {
|
|
|
6012
5986
|
return () => {
|
|
6013
5987
|
clearTimeout(timeout);
|
|
6014
5988
|
};
|
|
6015
|
-
}, [delay])
|
|
6016
|
-
|
|
6017
|
-
|
|
6018
|
-
...restProps,
|
|
6019
|
-
$animated: animated,
|
|
6020
|
-
$radius: useArrayProp(radius),
|
|
6021
|
-
$visible: visible,
|
|
6022
|
-
ref
|
|
6023
|
-
}
|
|
6024
|
-
);
|
|
5989
|
+
}, [delay]);
|
|
5990
|
+
const $radius = useMemo(() => _getArrayProp(radius), [radius]);
|
|
5991
|
+
return /* @__PURE__ */ jsx(Root$4, { ...restProps, $animated: animated, $radius, $visible: visible, ref });
|
|
6025
5992
|
}), Root$3 = styled(Skeleton)((props) => {
|
|
6026
5993
|
const { $size, $style } = props, { font, media } = getTheme_v2(props.theme), fontStyle = font[$style];
|
|
6027
5994
|
return _responsive(media, $size, (sizeIndex) => {
|
|
@@ -6029,16 +5996,16 @@ const MenuItem = forwardRef(function(props, forwardedRef) {
|
|
|
6029
5996
|
return { height: fontSize2.lineHeight - fontSize2.ascenderHeight - fontSize2.descenderHeight };
|
|
6030
5997
|
});
|
|
6031
5998
|
}), TextSkeleton = forwardRef(function(props, ref) {
|
|
6032
|
-
const { size: size2 = 2, ...restProps } = props, $size =
|
|
5999
|
+
const { size: size2 = 2, ...restProps } = props, $size = useMemo(() => _getArrayProp(size2), [size2]);
|
|
6033
6000
|
return /* @__PURE__ */ jsx(Root$3, { ...restProps, $size, ref, $style: "text" });
|
|
6034
6001
|
}), LabelSkeleton = forwardRef(function(props, ref) {
|
|
6035
|
-
const { size: size2 = 2, ...restProps } = props, $size =
|
|
6002
|
+
const { size: size2 = 2, ...restProps } = props, $size = useMemo(() => _getArrayProp(size2), [size2]);
|
|
6036
6003
|
return /* @__PURE__ */ jsx(Root$3, { ...restProps, $size, ref, $style: "label" });
|
|
6037
6004
|
}), HeadingSkeleton = forwardRef(function(props, ref) {
|
|
6038
|
-
const { size: size2 = 2, ...restProps } = props, $size =
|
|
6005
|
+
const { size: size2 = 2, ...restProps } = props, $size = useMemo(() => _getArrayProp(size2), [size2]);
|
|
6039
6006
|
return /* @__PURE__ */ jsx(Root$3, { ...restProps, $size, ref, $style: "heading" });
|
|
6040
6007
|
}), CodeSkeleton = forwardRef(function(props, ref) {
|
|
6041
|
-
const { size: size2 = 2, ...restProps } = props, $size =
|
|
6008
|
+
const { size: size2 = 2, ...restProps } = props, $size = useMemo(() => _getArrayProp(size2), [size2]);
|
|
6042
6009
|
return /* @__PURE__ */ jsx(Root$3, { ...restProps, $size, ref, $style: "code" });
|
|
6043
6010
|
}), CustomButton = styled(Button)`
|
|
6044
6011
|
max-width: 100%;
|
|
@@ -6222,33 +6189,12 @@ const subscribe = () => () => {
|
|
|
6222
6189
|
max-width: 420px;
|
|
6223
6190
|
width: 100%;
|
|
6224
6191
|
`;
|
|
6225
|
-
let toastId = 0;
|
|
6226
6192
|
function ToastProvider(props) {
|
|
6227
6193
|
const { children, padding = 4, paddingX, paddingY, zOffset } = props, [state, _setState] = useState([]), toastsRef = useRef({}), mounted = useMounted(), prefersReducedMotion = usePrefersReducedMotion(), variants = useMemo(
|
|
6228
|
-
() => (
|
|
6229
|
-
initial: {
|
|
6230
|
-
opacity: 0,
|
|
6231
|
-
[POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: 0,
|
|
6232
|
-
y: 32,
|
|
6233
|
-
scale: 0.25,
|
|
6234
|
-
willChange: "transform"
|
|
6235
|
-
},
|
|
6236
|
-
animate: {
|
|
6237
|
-
opacity: [0, 1, 1],
|
|
6238
|
-
[POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: [0, 0, 1],
|
|
6239
|
-
y: 0,
|
|
6240
|
-
scale: 1
|
|
6241
|
-
},
|
|
6242
|
-
exit: {
|
|
6243
|
-
opacity: [1, 1, 0],
|
|
6244
|
-
[POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: [1, 0, 0],
|
|
6245
|
-
scale: 0.5,
|
|
6246
|
-
transition: prefersReducedMotion ? { duration: 0 } : { duration: 0.2 }
|
|
6247
|
-
}
|
|
6248
|
-
}),
|
|
6194
|
+
() => getVariants(prefersReducedMotion),
|
|
6249
6195
|
[prefersReducedMotion]
|
|
6250
6196
|
), value = useMemo(() => ({ version: 0, push: (params) => {
|
|
6251
|
-
const setState = (state2) => startTransition(() => _setState(state2)), id = params.id ||
|
|
6197
|
+
const setState = (state2) => startTransition(() => _setState(state2)), id = params.id || crypto.randomUUID(), duration = params.duration || 5e3, dismiss = () => {
|
|
6252
6198
|
var _a;
|
|
6253
6199
|
const timeoutId = (_a = toastsRef.current[id]) == null ? void 0 : _a.timeoutId;
|
|
6254
6200
|
setState((prevState) => {
|
|
@@ -6301,6 +6247,29 @@ function ToastProvider(props) {
|
|
|
6301
6247
|
)) }) }) }) })
|
|
6302
6248
|
] });
|
|
6303
6249
|
}
|
|
6250
|
+
function getVariants(prefersReducedMotion) {
|
|
6251
|
+
return {
|
|
6252
|
+
initial: {
|
|
6253
|
+
opacity: 0,
|
|
6254
|
+
[POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: 0,
|
|
6255
|
+
y: 32,
|
|
6256
|
+
scale: 0.25,
|
|
6257
|
+
willChange: "transform"
|
|
6258
|
+
},
|
|
6259
|
+
animate: {
|
|
6260
|
+
opacity: [0, 1, 1],
|
|
6261
|
+
[POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: [0, 0, 1],
|
|
6262
|
+
y: 0,
|
|
6263
|
+
scale: 1
|
|
6264
|
+
},
|
|
6265
|
+
exit: {
|
|
6266
|
+
opacity: [1, 1, 0],
|
|
6267
|
+
[POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: [1, 0, 0],
|
|
6268
|
+
scale: 0.5,
|
|
6269
|
+
transition: { duration: prefersReducedMotion ? 0 : 0.2 }
|
|
6270
|
+
}
|
|
6271
|
+
};
|
|
6272
|
+
}
|
|
6304
6273
|
function useToast() {
|
|
6305
6274
|
const value = useContext(ToastContext);
|
|
6306
6275
|
if (!value)
|
|
@@ -6487,6 +6456,28 @@ const key = Symbol.for("@sanity/ui/context/tree"), TreeContext = createGlobalSco
|
|
|
6487
6456
|
})
|
|
6488
6457
|
);
|
|
6489
6458
|
Tree.displayName = "Tree";
|
|
6459
|
+
function useTree() {
|
|
6460
|
+
const tree = useContext(TreeContext);
|
|
6461
|
+
if (!tree)
|
|
6462
|
+
throw new Error("Tree: missing context value");
|
|
6463
|
+
return tree;
|
|
6464
|
+
}
|
|
6465
|
+
const TreeGroup = memo(function(props) {
|
|
6466
|
+
const { children, expanded = !1, ...restProps } = props, tree = useTree();
|
|
6467
|
+
return /* @__PURE__ */ jsx(
|
|
6468
|
+
Stack,
|
|
6469
|
+
{
|
|
6470
|
+
as: "ul",
|
|
6471
|
+
"data-ui": "TreeGroup",
|
|
6472
|
+
...restProps,
|
|
6473
|
+
hidden: !expanded,
|
|
6474
|
+
marginTop: tree.space,
|
|
6475
|
+
role: "group",
|
|
6476
|
+
space: tree.space,
|
|
6477
|
+
children
|
|
6478
|
+
}
|
|
6479
|
+
);
|
|
6480
|
+
});
|
|
6490
6481
|
function treeItemRootStyle() {
|
|
6491
6482
|
return css`
|
|
6492
6483
|
&[role='none'] > [role='treeitem'] {
|
|
@@ -6573,28 +6564,9 @@ function treeItemBoxStyle(props) {
|
|
|
6573
6564
|
}
|
|
6574
6565
|
`;
|
|
6575
6566
|
}
|
|
6576
|
-
|
|
6577
|
-
|
|
6578
|
-
|
|
6579
|
-
throw new Error("Tree: missing context value");
|
|
6580
|
-
return tree;
|
|
6581
|
-
}
|
|
6582
|
-
const TreeGroup = memo(function(props) {
|
|
6583
|
-
const { children, expanded = !1, ...restProps } = props, tree = useTree();
|
|
6584
|
-
return /* @__PURE__ */ jsx(
|
|
6585
|
-
Stack,
|
|
6586
|
-
{
|
|
6587
|
-
as: "ul",
|
|
6588
|
-
"data-ui": "TreeGroup",
|
|
6589
|
-
...restProps,
|
|
6590
|
-
hidden: !expanded,
|
|
6591
|
-
marginTop: tree.space,
|
|
6592
|
-
role: "group",
|
|
6593
|
-
space: tree.space,
|
|
6594
|
-
children
|
|
6595
|
-
}
|
|
6596
|
-
);
|
|
6597
|
-
}), Root = memo(styled.li(treeItemRootStyle, treeItemRootColorStyle)), TreeItemBox = styled(Box).attrs({ forwardedAs: "a" })(treeItemBoxStyle), ToggleArrowText = styled(Text)`
|
|
6567
|
+
const Root = memo(styled.li(treeItemRootStyle, treeItemRootColorStyle)), TreeItemBox = styled(Box).attrs({ forwardedAs: "a" })(
|
|
6568
|
+
treeItemBoxStyle
|
|
6569
|
+
), ToggleArrowText = styled(Text)`
|
|
6598
6570
|
& > svg {
|
|
6599
6571
|
transition: transform 100ms;
|
|
6600
6572
|
}
|
|
@@ -6615,12 +6587,12 @@ const TreeGroup = memo(function(props) {
|
|
|
6615
6587
|
text,
|
|
6616
6588
|
weight,
|
|
6617
6589
|
...restProps
|
|
6618
|
-
} = props, rootRef = useRef(null), treeitemRef = useRef(null), tree = useTree(), { path, registerItem, setExpanded, setFocusedElement } = tree, _id = useId(), id = idProp || _id, itemPath = useMemo(() => path
|
|
6590
|
+
} = props, rootRef = useRef(null), treeitemRef = useRef(null), tree = useTree(), { path, registerItem, setExpanded, setFocusedElement } = tree, _id = useId(), id = idProp || _id, itemPath = useMemo(() => [...path, id || ""], [id, path]), itemKey = itemPath.join("/"), itemState = tree.state[itemKey], focused = tree.focusedElement === rootRef.current, expanded = (itemState == null ? void 0 : itemState.expanded) === void 0 ? expandedProp : (itemState == null ? void 0 : itemState.expanded) || !1, tabIndex = tree.focusedElement && tree.focusedElement === rootRef.current ? 0 : -1, contextValue = useMemo(
|
|
6619
6591
|
() => ({ ...tree, level: tree.level + 1, path: itemPath }),
|
|
6620
6592
|
[itemPath, tree]
|
|
6621
6593
|
), handleClick = useCallback(
|
|
6622
6594
|
(event) => {
|
|
6623
|
-
onClick
|
|
6595
|
+
onClick == null || onClick(event);
|
|
6624
6596
|
const target = event.target;
|
|
6625
6597
|
target instanceof HTMLElement && (target.getAttribute("data-ui") === "TreeItem" || target.closest('[data-ui="TreeItem__box"]')) && (event.stopPropagation(), setExpanded(itemKey, !expanded), setFocusedElement(rootRef.current));
|
|
6626
6598
|
},
|
|
@@ -6638,23 +6610,26 @@ const TreeGroup = memo(function(props) {
|
|
|
6638
6610
|
if (rootRef.current)
|
|
6639
6611
|
return registerItem(rootRef.current, itemPath.join("/"), expanded, selected);
|
|
6640
6612
|
}, [expanded, itemPath, registerItem, selected]);
|
|
6641
|
-
const content =
|
|
6642
|
-
/* @__PURE__ */ jsxs(
|
|
6643
|
-
|
|
6644
|
-
|
|
6645
|
-
|
|
6646
|
-
|
|
6647
|
-
|
|
6648
|
-
|
|
6649
|
-
|
|
6650
|
-
|
|
6651
|
-
|
|
6652
|
-
|
|
6653
|
-
|
|
6654
|
-
|
|
6655
|
-
|
|
6656
|
-
|
|
6657
|
-
|
|
6613
|
+
const content = useMemo(
|
|
6614
|
+
() => /* @__PURE__ */ jsxs(Flex, { padding, children: [
|
|
6615
|
+
/* @__PURE__ */ jsxs(
|
|
6616
|
+
Box,
|
|
6617
|
+
{
|
|
6618
|
+
marginRight: space,
|
|
6619
|
+
style: {
|
|
6620
|
+
visibility: IconComponent || children ? "visible" : "hidden",
|
|
6621
|
+
pointerEvents: "none"
|
|
6622
|
+
},
|
|
6623
|
+
children: [
|
|
6624
|
+
IconComponent && /* @__PURE__ */ jsx(Text, { muted, size: fontSize2, weight, children: /* @__PURE__ */ jsx(IconComponent, {}) }),
|
|
6625
|
+
!IconComponent && /* @__PURE__ */ jsx(ToggleArrowText, { muted, size: fontSize2, weight, children: /* @__PURE__ */ jsx(ToggleArrowRightIcon, { style: { transform: expanded ? "rotate(90deg)" : void 0 } }) })
|
|
6626
|
+
]
|
|
6627
|
+
}
|
|
6628
|
+
),
|
|
6629
|
+
/* @__PURE__ */ jsx(Box, { flex: 1, children: /* @__PURE__ */ jsx(Text, { muted, size: fontSize2, textOverflow: "ellipsis", weight, children: text }) })
|
|
6630
|
+
] }),
|
|
6631
|
+
[IconComponent, children, expanded, fontSize2, muted, padding, space, text, weight]
|
|
6632
|
+
);
|
|
6658
6633
|
return href ? /* @__PURE__ */ jsxs(
|
|
6659
6634
|
Root,
|
|
6660
6635
|
{
|