@sanity/ui 3.4.5 → 3.5.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/_chunks/{theme.cjs → getScopedTheme.cjs} +3534 -3597
- package/dist/_chunks/getScopedTheme.cjs.map +1 -0
- package/dist/_chunks/{theme.js → getScopedTheme.js} +3477 -3525
- package/dist/_chunks/getScopedTheme.js.map +1 -0
- package/dist/_chunks/{tabList.cjs → portalProvider.cjs} +1561 -1554
- package/dist/_chunks/portalProvider.cjs.map +1 -0
- package/dist/_chunks/{useTheme.d.ts → portalProvider.d.cts} +307 -647
- package/dist/_chunks/portalProvider.d.cts.map +1 -0
- package/dist/_chunks/{useTheme.d.cts → portalProvider.d.ts} +307 -647
- package/dist/_chunks/portalProvider.d.ts.map +1 -0
- package/dist/_chunks/{tabList.js → portalProvider.js} +1359 -1352
- package/dist/_chunks/portalProvider.js.map +1 -0
- package/dist/_chunks/{theme.d.ts → rgba.d.cts} +178 -453
- package/dist/_chunks/rgba.d.cts.map +1 -0
- package/dist/_chunks/{theme.d.cts → rgba.d.ts} +178 -453
- package/dist/_chunks/rgba.d.ts.map +1 -0
- package/dist/_visual-editing.cjs +3 -2
- package/dist/_visual-editing.d.cts +1 -1
- package/dist/_visual-editing.d.ts +1 -1
- package/dist/_visual-editing.js +2 -1
- package/dist/index.cjs +2802 -2798
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +549 -203
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +549 -203
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2781 -2777
- package/dist/index.js.map +1 -1
- package/dist/theme.cjs +53 -2
- package/dist/theme.cjs.map +1 -0
- package/dist/theme.d.cts +278 -2
- package/dist/theme.d.cts.map +1 -0
- package/dist/theme.d.ts +278 -2
- package/dist/theme.d.ts.map +1 -0
- package/dist/theme.js +52 -1
- package/dist/theme.js.map +1 -0
- package/package.json +1 -1
- package/dist/_chunks/tabList.cjs.map +0 -1
- package/dist/_chunks/tabList.js.map +0 -1
- package/dist/_chunks/theme.cjs.map +0 -1
- package/dist/_chunks/theme.d.cts.map +0 -1
- package/dist/_chunks/theme.d.ts.map +0 -1
- package/dist/_chunks/theme.js.map +0 -1
- package/dist/_chunks/useTheme.d.cts.map +0 -1
- package/dist/_chunks/useTheme.d.ts.map +0 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as createColorTheme$1, c as multiply$1, d as hexToRgb$1, f as hslToRgb$1, i as getTheme_v2, l as rgba$1, m as rgbToHsl$1, o as buildTheme, p as rgbToHex$1, s as screen$1, t as getScopedTheme, u as parseColor$1 } from "./getScopedTheme.js";
|
|
2
2
|
import { c } from "react-compiler-runtime";
|
|
3
3
|
import { Children, cloneElement, createContext, forwardRef, isValidElement, useContext, useDebugValue, useEffect, useId, useImperativeHandle, useLayoutEffect, useRef, useState, useSyncExternalStore } from "react";
|
|
4
|
-
import { isValidElementType } from "react-is";
|
|
5
4
|
import { ThemeProvider, css, keyframes, styled, useTheme } from "styled-components";
|
|
6
5
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { isValidElementType } from "react-is";
|
|
7
7
|
import { SpinnerIcon } from "@sanity/icons/Spinner";
|
|
8
|
-
import { useEffectEvent } from "use-effect-event";
|
|
9
|
-
import { ResizeObserver } from "@juggle/resize-observer";
|
|
10
8
|
import { arrow, autoPlacement, autoUpdate, detectOverflow, flip, hide, offset, shift, useFloating } from "@floating-ui/react-dom";
|
|
11
9
|
import { AnimatePresence, motion } from "motion/react";
|
|
10
|
+
import { ResizeObserver } from "@juggle/resize-observer";
|
|
12
11
|
import { createPortal } from "react-dom";
|
|
13
12
|
import { CloseIcon } from "@sanity/icons/Close";
|
|
13
|
+
import { useEffectEvent } from "use-effect-event";
|
|
14
14
|
import { ChevronRightIcon } from "@sanity/icons/ChevronRight";
|
|
15
15
|
/**
|
|
16
16
|
* @public
|
|
@@ -124,217 +124,6 @@ function _getResponsiveSpace(theme, props, spaceIndexes = EMPTY_ARRAY) {
|
|
|
124
124
|
let { media, space } = getTheme_v2(theme);
|
|
125
125
|
return _responsive(media, spaceIndexes, (spaceIndex) => _fillCSSObject(props, rem(space[spaceIndex])));
|
|
126
126
|
}
|
|
127
|
-
/**
|
|
128
|
-
* A utility function getting responsive font styles.
|
|
129
|
-
* @internal
|
|
130
|
-
*/
|
|
131
|
-
function responsiveFont(fontKey, props) {
|
|
132
|
-
let { $size, $weight } = props, { font, media } = getTheme_v2(props.theme), { family, sizes, weights } = font[fontKey], fontWeight = $weight && weights[$weight] || weights.regular, defaultSize = sizes[2], base = {
|
|
133
|
-
position: "relative",
|
|
134
|
-
fontFamily: family,
|
|
135
|
-
fontWeight: `${fontWeight}`,
|
|
136
|
-
padding: "1px 0",
|
|
137
|
-
margin: 0,
|
|
138
|
-
"&:before": {
|
|
139
|
-
content: "\"\"",
|
|
140
|
-
display: "block",
|
|
141
|
-
height: 0
|
|
142
|
-
},
|
|
143
|
-
"&:after": {
|
|
144
|
-
content: "\"\"",
|
|
145
|
-
display: "block",
|
|
146
|
-
height: 0
|
|
147
|
-
},
|
|
148
|
-
"& > code, & > span": { display: "block" },
|
|
149
|
-
"&:not([hidden])": { display: "block" }
|
|
150
|
-
};
|
|
151
|
-
return $size ? [base, ..._responsive(media, $size, (sizeIndex) => fontSize(sizes[sizeIndex] || defaultSize))] : (responsiveFont.warned ||= (console.warn("No size specified for responsive font", {
|
|
152
|
-
fontKey,
|
|
153
|
-
$size,
|
|
154
|
-
props,
|
|
155
|
-
base
|
|
156
|
-
}), !0), [base]);
|
|
157
|
-
}
|
|
158
|
-
function fontSize(size) {
|
|
159
|
-
let { ascenderHeight, descenderHeight, fontSize, iconSize, letterSpacing, lineHeight } = size, negHeight = ascenderHeight + descenderHeight, capHeight = lineHeight - negHeight, iconOffset = (capHeight - iconSize) / 2, customIconSize = Math.floor(fontSize * 1.125 / 2) * 2 + 1, customIconOffset = (capHeight - customIconSize) / 2;
|
|
160
|
-
return {
|
|
161
|
-
fontSize: rem(fontSize),
|
|
162
|
-
lineHeight: `calc(${lineHeight} / ${fontSize})`,
|
|
163
|
-
letterSpacing: rem(letterSpacing),
|
|
164
|
-
transform: `translateY(${rem(descenderHeight)})`,
|
|
165
|
-
"&:before": { marginTop: `calc(${rem(0 - negHeight)} - 1px)` },
|
|
166
|
-
"&:after": { marginBottom: "-1px" },
|
|
167
|
-
"& svg:not([data-sanity-icon])": {
|
|
168
|
-
fontSize: `calc(${customIconSize} / 16 * 1rem)`,
|
|
169
|
-
margin: rem(customIconOffset)
|
|
170
|
-
},
|
|
171
|
-
"& [data-sanity-icon]": {
|
|
172
|
-
fontSize: `calc(${iconSize} / 16 * 1rem)`,
|
|
173
|
-
margin: rem(iconOffset)
|
|
174
|
-
}
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
/**
|
|
178
|
-
* Get responsive text align styles.
|
|
179
|
-
* @internal
|
|
180
|
-
*/
|
|
181
|
-
function responsiveTextAlignStyle(props) {
|
|
182
|
-
let { media } = getTheme_v2(props.theme);
|
|
183
|
-
return _responsive(media, props.$align, (textAlign) => ({ textAlign }));
|
|
184
|
-
}
|
|
185
|
-
/**
|
|
186
|
-
* Get responsive CSS for the `text` font style.
|
|
187
|
-
* @internal
|
|
188
|
-
*/
|
|
189
|
-
function responsiveTextFont(props) {
|
|
190
|
-
return responsiveFont("text", props);
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* Gets the global scope instance in a given environment.
|
|
194
|
-
*
|
|
195
|
-
* The strategy is to return the most modern, and if not, the most common:
|
|
196
|
-
* - The `globalThis` variable is the modern approach to accessing the global scope
|
|
197
|
-
* - The `window` variable is the global scope in a web browser
|
|
198
|
-
* - The `self` variable is the global scope in workers and others
|
|
199
|
-
* - The `global` variable is the global scope in Node.js
|
|
200
|
-
*/
|
|
201
|
-
function getGlobalScope() {
|
|
202
|
-
if (typeof globalThis < "u") return globalThis;
|
|
203
|
-
if (typeof window < "u") return window;
|
|
204
|
-
if (typeof self < "u") return self;
|
|
205
|
-
if (typeof global < "u") return global;
|
|
206
|
-
throw Error("@sanity/ui: could not locate global scope");
|
|
207
|
-
}
|
|
208
|
-
const globalScope = getGlobalScope();
|
|
209
|
-
/**
|
|
210
|
-
* As `@sanity/ui` is declared as a dependency, and may be duplicated, sometimes across major versions
|
|
211
|
-
* it's critical that vital react contexts are shared even when there is a duplicate.
|
|
212
|
-
* If we used a model similar to `sanity` itself, or `styled-components`, this would be unnecessary as
|
|
213
|
-
* those libraries enforce single instances.
|
|
214
|
-
* Since we don't enforce it we have to support a sanity plugin being able to call hooks like `useToast`, and then
|
|
215
|
-
* read the context setup by `sanity`, which calls `ToastProvider`, even if the provider and hook are different instances in memory.
|
|
216
|
-
* It's also why it's vital that all changes to globally scoped providers remain fully backwards compatible to v1.
|
|
217
|
-
*/
|
|
218
|
-
function createGlobalScopedContext(key, defaultValue) {
|
|
219
|
-
let symbol = Symbol.for(key);
|
|
220
|
-
/**
|
|
221
|
-
* Prevent errors about re-renders on React SSR on Next.js App Router
|
|
222
|
-
*/
|
|
223
|
-
if (typeof document > "u") {
|
|
224
|
-
let context = createContext(defaultValue);
|
|
225
|
-
return context.displayName = key, context;
|
|
226
|
-
}
|
|
227
|
-
return globalScope[symbol] = globalScope[symbol] || createContext(defaultValue), globalScope[symbol];
|
|
228
|
-
}
|
|
229
|
-
/**
|
|
230
|
-
* @internal
|
|
231
|
-
*/
|
|
232
|
-
const ThemeContext = createGlobalScopedContext("@sanity/ui/context/theme", null);
|
|
233
|
-
/**
|
|
234
|
-
* @public
|
|
235
|
-
*/
|
|
236
|
-
function ThemeProvider$1(props) {
|
|
237
|
-
let $ = c(15), parentTheme = useContext(ThemeContext), { children } = props, scheme = props.scheme ?? (parentTheme?.scheme || "light"), rootTheme = props.theme ?? (parentTheme?.theme || null), tone = props.tone ?? (parentTheme?.tone || "default"), t0;
|
|
238
|
-
bb0: {
|
|
239
|
-
if (!rootTheme) {
|
|
240
|
-
t0 = null;
|
|
241
|
-
break bb0;
|
|
242
|
-
}
|
|
243
|
-
let t1;
|
|
244
|
-
$[0] !== rootTheme || $[1] !== scheme || $[2] !== tone ? (t1 = {
|
|
245
|
-
version: 0,
|
|
246
|
-
theme: rootTheme,
|
|
247
|
-
scheme,
|
|
248
|
-
tone
|
|
249
|
-
}, $[0] = rootTheme, $[1] = scheme, $[2] = tone, $[3] = t1) : t1 = $[3], t0 = t1;
|
|
250
|
-
}
|
|
251
|
-
let themeContext = t0, t1;
|
|
252
|
-
bb1: {
|
|
253
|
-
if (!rootTheme) {
|
|
254
|
-
t1 = null;
|
|
255
|
-
break bb1;
|
|
256
|
-
}
|
|
257
|
-
let t2;
|
|
258
|
-
$[4] !== rootTheme || $[5] !== scheme || $[6] !== tone ? (t2 = getScopedTheme(rootTheme, scheme, tone), $[4] = rootTheme, $[5] = scheme, $[6] = tone, $[7] = t2) : t2 = $[7], t1 = t2;
|
|
259
|
-
}
|
|
260
|
-
let theme = t1;
|
|
261
|
-
if (!theme) {
|
|
262
|
-
let t2;
|
|
263
|
-
return $[8] === Symbol.for("react.memo_cache_sentinel") ? (t2 = /* @__PURE__ */ jsx("pre", { children: "ThemeProvider: no \"theme\" property provided" }), $[8] = t2) : t2 = $[8], t2;
|
|
264
|
-
}
|
|
265
|
-
let t2;
|
|
266
|
-
$[9] !== children || $[10] !== theme ? (t2 = /* @__PURE__ */ jsx(ThemeProvider, {
|
|
267
|
-
theme,
|
|
268
|
-
children
|
|
269
|
-
}), $[9] = children, $[10] = theme, $[11] = t2) : t2 = $[11];
|
|
270
|
-
let t3;
|
|
271
|
-
return $[12] !== t2 || $[13] !== themeContext ? (t3 = /* @__PURE__ */ jsx(ThemeContext.Provider, {
|
|
272
|
-
value: themeContext,
|
|
273
|
-
children: t2
|
|
274
|
-
}), $[12] = t2, $[13] = themeContext, $[14] = t3) : t3 = $[14], t3;
|
|
275
|
-
}
|
|
276
|
-
/**
|
|
277
|
-
* @public
|
|
278
|
-
*/
|
|
279
|
-
function useRootTheme() {
|
|
280
|
-
let value = useContext(ThemeContext);
|
|
281
|
-
if (!value) throw Error("useRootTheme(): missing context value");
|
|
282
|
-
return value;
|
|
283
|
-
}
|
|
284
|
-
/**
|
|
285
|
-
* @public
|
|
286
|
-
*/
|
|
287
|
-
function ThemeColorProvider(props) {
|
|
288
|
-
let $ = c(5), { children, scheme, tone } = props, root = useRootTheme(), t0 = scheme || root.scheme, t1;
|
|
289
|
-
return $[0] !== children || $[1] !== root.theme || $[2] !== t0 || $[3] !== tone ? (t1 = /* @__PURE__ */ jsx(ThemeProvider$1, {
|
|
290
|
-
scheme: t0,
|
|
291
|
-
theme: root.theme,
|
|
292
|
-
tone,
|
|
293
|
-
children
|
|
294
|
-
}), $[0] = children, $[1] = root.theme, $[2] = t0, $[3] = tone, $[4] = t1) : t1 = $[4], t1;
|
|
295
|
-
}
|
|
296
|
-
/**
|
|
297
|
-
* @public
|
|
298
|
-
*/
|
|
299
|
-
function useTheme$1() {
|
|
300
|
-
return useTheme();
|
|
301
|
-
}
|
|
302
|
-
/**
|
|
303
|
-
* @public
|
|
304
|
-
*/
|
|
305
|
-
function useTheme_v2() {
|
|
306
|
-
let $ = c(2), t0 = useTheme(), t1;
|
|
307
|
-
return $[0] === t0 ? t1 = $[1] : (t1 = getTheme_v2(t0), $[0] = t0, $[1] = t1), t1;
|
|
308
|
-
}
|
|
309
|
-
function responsiveBorderStyle() {
|
|
310
|
-
return [
|
|
311
|
-
border,
|
|
312
|
-
borderTop,
|
|
313
|
-
borderRight,
|
|
314
|
-
borderBottom,
|
|
315
|
-
borderLeft
|
|
316
|
-
];
|
|
317
|
-
}
|
|
318
|
-
function border(props) {
|
|
319
|
-
let { card, media } = getTheme_v2(props.theme), borderStyle = `${card.border?.width ?? 1}px solid var(--card-border-color)`;
|
|
320
|
-
return _responsive(media, props.$border, (value) => value ? { "&&": { border: borderStyle } } : { "&&": { border: 0 } });
|
|
321
|
-
}
|
|
322
|
-
function borderTop(props) {
|
|
323
|
-
let { card, media } = getTheme_v2(props.theme), borderStyle = `${card.border?.width ?? 1}px solid var(--card-border-color)`;
|
|
324
|
-
return _responsive(media, props.$borderTop, (value) => value ? { "&&": { borderTop: borderStyle } } : { "&&": { borderTop: 0 } });
|
|
325
|
-
}
|
|
326
|
-
function borderRight(props) {
|
|
327
|
-
let { card, media } = getTheme_v2(props.theme), borderStyle = `${card.border?.width ?? 1}px solid var(--card-border-color)`;
|
|
328
|
-
return _responsive(media, props.$borderRight, (value) => value ? { "&&": { borderRight: borderStyle } } : { "&&": { borderRight: 0 } });
|
|
329
|
-
}
|
|
330
|
-
function borderBottom(props) {
|
|
331
|
-
let { card, media } = getTheme_v2(props.theme), borderStyle = `${card.border?.width ?? 1}px solid var(--card-border-color)`;
|
|
332
|
-
return _responsive(media, props.$borderBottom, (value) => value ? { "&&": { borderBottom: borderStyle } } : { "&&": { borderBottom: 0 } });
|
|
333
|
-
}
|
|
334
|
-
function borderLeft(props) {
|
|
335
|
-
let { card, media } = getTheme_v2(props.theme), borderStyle = `${card.border?.width ?? 1}px solid var(--card-border-color)`;
|
|
336
|
-
return _responsive(media, props.$borderLeft, (value) => value ? { "&&": { borderLeft: borderStyle } } : { "&&": { borderLeft: 0 } });
|
|
337
|
-
}
|
|
338
127
|
const BASE_STYLE$3 = { "&[data-as=\"ul\"],&[data-as=\"ol\"]": { listStyle: "none" } }, BOX_SIZING = {
|
|
339
128
|
content: "content-box",
|
|
340
129
|
border: "border-box"
|
|
@@ -380,77 +169,34 @@ function responsiveFlexItemStyle(props) {
|
|
|
380
169
|
let { media } = getTheme_v2(props.theme);
|
|
381
170
|
return props.$flex ? _responsive(media, props.$flex, (flex) => ({ flex: `${flex}` })) : EMPTY_ARRAY;
|
|
382
171
|
}
|
|
383
|
-
|
|
384
|
-
function responsiveFlexStyle() {
|
|
172
|
+
function responsiveGridItemStyle() {
|
|
385
173
|
return [
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
174
|
+
responsiveGridItemRowStyle,
|
|
175
|
+
responsiveGridItemRowStartStyle,
|
|
176
|
+
responsiveGridItemRowEndStyle,
|
|
177
|
+
responsiveGridItemColumnStyle,
|
|
178
|
+
responsiveGridItemColumnStartStyle,
|
|
179
|
+
responsiveGridItemColumnEndStyle
|
|
392
180
|
];
|
|
393
181
|
}
|
|
394
|
-
|
|
182
|
+
const GRID_ITEM_ROW = {
|
|
183
|
+
auto: "auto",
|
|
184
|
+
full: "1 / -1"
|
|
185
|
+
}, GRID_ITEM_COLUMN = {
|
|
186
|
+
auto: "auto",
|
|
187
|
+
full: "1 / -1"
|
|
188
|
+
};
|
|
189
|
+
function responsiveGridItemRowStyle(props) {
|
|
395
190
|
let { media } = getTheme_v2(props.theme);
|
|
396
|
-
return _responsive(media, props.$
|
|
397
|
-
}
|
|
398
|
-
function responsiveFlexGapStyle(props) {
|
|
399
|
-
let { media, space } = getTheme_v2(props.theme);
|
|
400
|
-
return _responsive(media, props.$gap, (gap) => ({ gap: gap ? rem(space[gap]) : void 0 }));
|
|
191
|
+
return _responsive(media, props.$row, (row) => typeof row == "number" ? { gridRow: `span ${row} / span ${row}` } : { gridRow: GRID_ITEM_ROW[row] });
|
|
401
192
|
}
|
|
402
|
-
function
|
|
193
|
+
function responsiveGridItemRowStartStyle(props) {
|
|
403
194
|
let { media } = getTheme_v2(props.theme);
|
|
404
|
-
return _responsive(media, props.$
|
|
195
|
+
return _responsive(media, props.$rowStart, (rowStart) => ({ gridRowStart: `${rowStart}` }));
|
|
405
196
|
}
|
|
406
|
-
function
|
|
197
|
+
function responsiveGridItemRowEndStyle(props) {
|
|
407
198
|
let { media } = getTheme_v2(props.theme);
|
|
408
|
-
return _responsive(media, props.$
|
|
409
|
-
}
|
|
410
|
-
function responsiveFlexDirectionStyle(props) {
|
|
411
|
-
let { media } = getTheme_v2(props.theme);
|
|
412
|
-
return _responsive(media, props.$direction, (direction) => ({ flexDirection: direction }));
|
|
413
|
-
}
|
|
414
|
-
function focusRingBorderStyle(border) {
|
|
415
|
-
return `inset 0 0 0 ${border.width}px ${border.color}`;
|
|
416
|
-
}
|
|
417
|
-
function focusRingStyle(opts) {
|
|
418
|
-
let { base, border, focusRing } = opts, focusRingOutsetWidth = focusRing.offset + focusRing.width, focusRingInsetWidth = 0 - focusRing.offset, bgColor = base ? base.bg : "var(--card-bg-color)";
|
|
419
|
-
return [
|
|
420
|
-
focusRingInsetWidth > 0 && `inset 0 0 0 ${focusRingInsetWidth}px var(--card-focus-ring-color)`,
|
|
421
|
-
border && focusRingBorderStyle(border),
|
|
422
|
-
focusRingInsetWidth < 0 && `0 0 0 ${0 - focusRingInsetWidth}px ${bgColor}`,
|
|
423
|
-
focusRingOutsetWidth > 0 && `0 0 0 ${focusRingOutsetWidth}px var(--card-focus-ring-color)`
|
|
424
|
-
].filter(Boolean).join(",");
|
|
425
|
-
}
|
|
426
|
-
function responsiveGridItemStyle() {
|
|
427
|
-
return [
|
|
428
|
-
responsiveGridItemRowStyle,
|
|
429
|
-
responsiveGridItemRowStartStyle,
|
|
430
|
-
responsiveGridItemRowEndStyle,
|
|
431
|
-
responsiveGridItemColumnStyle,
|
|
432
|
-
responsiveGridItemColumnStartStyle,
|
|
433
|
-
responsiveGridItemColumnEndStyle
|
|
434
|
-
];
|
|
435
|
-
}
|
|
436
|
-
const GRID_ITEM_ROW = {
|
|
437
|
-
auto: "auto",
|
|
438
|
-
full: "1 / -1"
|
|
439
|
-
}, GRID_ITEM_COLUMN = {
|
|
440
|
-
auto: "auto",
|
|
441
|
-
full: "1 / -1"
|
|
442
|
-
};
|
|
443
|
-
function responsiveGridItemRowStyle(props) {
|
|
444
|
-
let { media } = getTheme_v2(props.theme);
|
|
445
|
-
return _responsive(media, props.$row, (row) => typeof row == "number" ? { gridRow: `span ${row} / span ${row}` } : { gridRow: GRID_ITEM_ROW[row] });
|
|
446
|
-
}
|
|
447
|
-
function responsiveGridItemRowStartStyle(props) {
|
|
448
|
-
let { media } = getTheme_v2(props.theme);
|
|
449
|
-
return _responsive(media, props.$rowStart, (rowStart) => ({ gridRowStart: `${rowStart}` }));
|
|
450
|
-
}
|
|
451
|
-
function responsiveGridItemRowEndStyle(props) {
|
|
452
|
-
let { media } = getTheme_v2(props.theme);
|
|
453
|
-
return _responsive(media, props.$rowEnd, (rowEnd) => ({ gridRowEnd: `${rowEnd}` }));
|
|
199
|
+
return _responsive(media, props.$rowEnd, (rowEnd) => ({ gridRowEnd: `${rowEnd}` }));
|
|
454
200
|
}
|
|
455
201
|
function responsiveGridItemColumnStyle(props) {
|
|
456
202
|
let { media } = getTheme_v2(props.theme);
|
|
@@ -464,130 +210,6 @@ function responsiveGridItemColumnEndStyle(props) {
|
|
|
464
210
|
let { media } = getTheme_v2(props.theme);
|
|
465
211
|
return _responsive(media, props.$columnEnd, (columnEnd) => ({ gridColumnEnd: `${columnEnd}` }));
|
|
466
212
|
}
|
|
467
|
-
const GRID_CSS = {
|
|
468
|
-
"&&:not([hidden])": { display: "grid" },
|
|
469
|
-
"&[data-as=\"ul\"],&[data-as=\"ol\"]": { listStyle: "none" }
|
|
470
|
-
}, GRID_AUTO_COLUMS = {
|
|
471
|
-
auto: "auto",
|
|
472
|
-
min: "min-content",
|
|
473
|
-
max: "max-content",
|
|
474
|
-
fr: "minmax(0, 1fr)"
|
|
475
|
-
}, GRID_AUTO_ROWS = {
|
|
476
|
-
auto: "auto",
|
|
477
|
-
min: "min-content",
|
|
478
|
-
max: "max-content",
|
|
479
|
-
fr: "minmax(0, 1fr)"
|
|
480
|
-
};
|
|
481
|
-
function responsiveGridStyle() {
|
|
482
|
-
return [
|
|
483
|
-
GRID_CSS,
|
|
484
|
-
responsiveGridAutoFlowStyle,
|
|
485
|
-
responsiveGridAutoRowsStyle,
|
|
486
|
-
responsiveGridAutoColsStyle,
|
|
487
|
-
responsiveGridColumnsStyle,
|
|
488
|
-
responsiveGridRowsStyle,
|
|
489
|
-
responsiveGridGapStyle,
|
|
490
|
-
responsiveGridGapXStyle,
|
|
491
|
-
responsiveGridGapYStyle
|
|
492
|
-
];
|
|
493
|
-
}
|
|
494
|
-
function responsiveGridAutoFlowStyle(props) {
|
|
495
|
-
let { media } = getTheme_v2(props.theme);
|
|
496
|
-
return _responsive(media, props.$autoFlow, (autoFlow) => ({ gridAutoFlow: autoFlow }));
|
|
497
|
-
}
|
|
498
|
-
function responsiveGridAutoRowsStyle(props) {
|
|
499
|
-
let { media } = getTheme_v2(props.theme);
|
|
500
|
-
return _responsive(media, props.$autoRows, (autoRows) => ({ gridAutoRows: autoRows && GRID_AUTO_ROWS[autoRows] }));
|
|
501
|
-
}
|
|
502
|
-
function responsiveGridAutoColsStyle(props) {
|
|
503
|
-
let { media } = getTheme_v2(props.theme);
|
|
504
|
-
return _responsive(media, props.$autoCols, (autoCols) => ({ gridAutoColumns: autoCols && GRID_AUTO_COLUMS[autoCols] }));
|
|
505
|
-
}
|
|
506
|
-
function responsiveGridColumnsStyle(props) {
|
|
507
|
-
let { media } = getTheme_v2(props.theme);
|
|
508
|
-
return _responsive(media, props.$columns, (columns) => ({ gridTemplateColumns: columns && `repeat(${columns},minmax(0,1fr));` }));
|
|
509
|
-
}
|
|
510
|
-
function responsiveGridRowsStyle(props) {
|
|
511
|
-
let { media } = getTheme_v2(props.theme);
|
|
512
|
-
return _responsive(media, props.$rows, (rows) => ({ gridTemplateRows: rows && `repeat(${rows},minmax(0,1fr));` }));
|
|
513
|
-
}
|
|
514
|
-
function responsiveGridGapStyle(props) {
|
|
515
|
-
let { media, space } = getTheme_v2(props.theme);
|
|
516
|
-
return _responsive(media, props.$gap, (gap) => ({ gridGap: gap ? rem(space[gap]) : void 0 }));
|
|
517
|
-
}
|
|
518
|
-
function responsiveGridGapXStyle(props) {
|
|
519
|
-
let { media, space } = getTheme_v2(props.theme);
|
|
520
|
-
return _responsive(media, props.$gapX, (gapX) => ({ columnGap: gapX ? rem(space[gapX]) : void 0 }));
|
|
521
|
-
}
|
|
522
|
-
function responsiveGridGapYStyle(props) {
|
|
523
|
-
let { media, space } = getTheme_v2(props.theme);
|
|
524
|
-
return _responsive(media, props.$gapY, (gapY) => ({ rowGap: gapY ? rem(space[gapY]) : void 0 }));
|
|
525
|
-
}
|
|
526
|
-
function responsiveInputPaddingStyle(props) {
|
|
527
|
-
let { $fontSize, $iconLeft, $iconRight, $padding, $space } = props, { font, media, space } = getTheme_v2(props.theme), len = Math.max($padding.length, $space.length, $fontSize.length), _padding = [], _space = [], _fontSize = [];
|
|
528
|
-
for (let i = 0; i < len; i += 1) _fontSize[i] = $fontSize[i] === void 0 ? _fontSize[i - 1] : $fontSize[i], _padding[i] = $padding[i] === void 0 ? _padding[i - 1] : $padding[i], _space[i] = $space[i] === void 0 ? _space[i - 1] : $space[i];
|
|
529
|
-
return _responsive(media, _padding, (_, i) => {
|
|
530
|
-
let size = font.text.sizes[_fontSize[i]] || font.text.sizes[2], emSize = size.lineHeight - size.ascenderHeight - size.descenderHeight, p = space[_padding[i]], s = space[_space[i]], styles = {
|
|
531
|
-
paddingTop: rem(p - size.ascenderHeight),
|
|
532
|
-
paddingRight: rem(p),
|
|
533
|
-
paddingBottom: rem(p - size.descenderHeight),
|
|
534
|
-
paddingLeft: rem(p)
|
|
535
|
-
};
|
|
536
|
-
return $iconRight && (styles.paddingRight = rem(p + emSize + s)), $iconLeft && (styles.paddingLeft = rem(p + emSize + s)), styles;
|
|
537
|
-
});
|
|
538
|
-
}
|
|
539
|
-
function responsiveInputPaddingIconRightStyle(props) {
|
|
540
|
-
return responsiveInputPaddingStyle({
|
|
541
|
-
...props,
|
|
542
|
-
$iconRight: !0
|
|
543
|
-
});
|
|
544
|
-
}
|
|
545
|
-
const ROOT_STYLE = css`&:not([hidden]){display:flex;}align-items:center;`;
|
|
546
|
-
function textInputRootStyle() {
|
|
547
|
-
return ROOT_STYLE;
|
|
548
|
-
}
|
|
549
|
-
function textInputBaseStyle(props) {
|
|
550
|
-
let { $scheme, $tone, $weight } = props, { color, font } = getTheme_v2(props.theme);
|
|
551
|
-
return css`appearance:none;background:none;border:0;border-radius:0;outline:none;width:100%;box-sizing:border-box;font-family:${font.text.family};font-weight:${$weight && font.text.weights[$weight] || font.text.weights.regular};margin:0;position:relative;z-index:1;display:block;&:-webkit-autofill,&:-webkit-autofill:hover,&:-webkit-autofill:focus,&:-webkit-autofill:active{-webkit-text-fill-color:var(--input-fg-color) !important;transition:background-color 5000s;transition-delay:86400s;}&[data-as='textarea']{resize:none;}color:var(--input-fg-color);&::placeholder{color:var(--input-placeholder-color);}&[data-scheme='${$scheme}'][data-tone='${$tone}']{--input-fg-color:${color.input.default.enabled.fg};--input-placeholder-color:${color.input.default.enabled.placeholder};&:not(:invalid):not(:disabled):not(:read-only){--input-fg-color:${color.input.default.enabled.fg};--input-placeholder-color:${color.input.default.enabled.placeholder};}&:not(:invalid):disabled{--input-fg-color:${color.input.default.disabled.fg};--input-placeholder-color:${color.input.default.disabled.placeholder};}&:invalid{--input-fg-color:${color.input.invalid.enabled.fg};--input-placeholder-color:${color.input.invalid.enabled.placeholder};}&:read-only{--input-fg-color:${color.input.default.readOnly.fg};--input-placeholder-color:${color.input.default.readOnly.placeholder};}}`;
|
|
552
|
-
}
|
|
553
|
-
function textInputFontSizeStyle(props) {
|
|
554
|
-
let { font, media } = getTheme_v2(props.theme);
|
|
555
|
-
return _responsive(media, props.$fontSize, (sizeIndex) => {
|
|
556
|
-
let size = font.text.sizes[sizeIndex] || font.text.sizes[2];
|
|
557
|
-
return {
|
|
558
|
-
fontSize: rem(size.fontSize),
|
|
559
|
-
lineHeight: `${size.lineHeight / size.fontSize}`
|
|
560
|
-
};
|
|
561
|
-
});
|
|
562
|
-
}
|
|
563
|
-
function textInputRepresentationStyle(props) {
|
|
564
|
-
let { $hasPrefix, $hasSuffix, $scheme, $tone, $unstableDisableFocusRing } = props, { color, input } = getTheme_v2(props.theme);
|
|
565
|
-
return css`--input-box-shadow:none;position:absolute;top:0;left:0;right:0;bottom:0;display:block;pointer-events:none;z-index:0;background-color:var(--card-bg-color);box-shadow:var(--input-box-shadow);border-top-left-radius:${$hasPrefix ? 0 : void 0};border-bottom-left-radius:${$hasPrefix ? 0 : void 0};border-top-right-radius:${$hasSuffix ? 0 : void 0};border-bottom-right-radius:${$hasSuffix ? 0 : void 0};&[data-scheme='${$scheme}'][data-tone='${$tone}']{--card-bg-color:${color.input.default.enabled.bg};--card-fg-color:${color.input.default.enabled.fg};*:not(:disabled) + &[data-border]{--input-box-shadow:${focusRingBorderStyle({
|
|
566
|
-
color: color.input.default.enabled.border,
|
|
567
|
-
width: input.border.width
|
|
568
|
-
})};}*:not(:disabled):invalid + &{--card-bg-color:${color.input.invalid.enabled.bg};--card-fg-color:${color.input.invalid.enabled.fg};&[data-border]{--input-box-shadow:${focusRingBorderStyle({
|
|
569
|
-
color: color.input.invalid.enabled.border,
|
|
570
|
-
width: input.border.width
|
|
571
|
-
})};}}*:not(:disabled):focus + &{&[data-border]{--input-box-shadow:${$unstableDisableFocusRing ? void 0 : focusRingStyle({
|
|
572
|
-
border: {
|
|
573
|
-
color: color.input.default.enabled.border,
|
|
574
|
-
width: input.border.width
|
|
575
|
-
},
|
|
576
|
-
focusRing: input.text.focusRing
|
|
577
|
-
})};}&:not([data-border]){--input-box-shadow:${$unstableDisableFocusRing ? void 0 : focusRingStyle({ focusRing: input.text.focusRing })};}}*:not(:invalid):disabled + &{--card-bg-color:${color.input.default.disabled.bg} !important;--card-fg-color:${color.input.default.disabled.fg} !important;--card-icon-color:${color.input.default.disabled.fg} !important;&[data-border]{--input-box-shadow:${focusRingBorderStyle({
|
|
578
|
-
color: color.input.default.disabled.border,
|
|
579
|
-
width: input.border.width
|
|
580
|
-
})};}}*:invalid:disabled + &{--card-bg-color:${color.input.invalid.disabled.bg} !important;--card-fg-color:${color.input.invalid.disabled.fg} !important;--card-icon-color:${color.input.invalid.disabled.fg} !important;&[data-border]{--input-box-shadow:${focusRingBorderStyle({
|
|
581
|
-
color: color.input.invalid.disabled.border,
|
|
582
|
-
width: input.border.width
|
|
583
|
-
})};}}*:not(:invalid):read-only + &{--card-bg-color:${color.input.default.readOnly.bg} !important;--card-fg-color:${color.input.default.readOnly.fg} !important;}*:invalid:read-only + &{--card-bg-color:${color.input.invalid.readOnly.bg} !important;--card-fg-color:${color.input.invalid.readOnly.fg} !important;}@media (hover:hover){*:not(:disabled):not(:read-only):not(:invalid):hover + &{--card-bg-color:${color.input.default.hovered.bg};--card-fg-color:${color.input.default.hovered.fg};}*:invalid:not(:disabled):not(:read-only):hover + &{--card-bg-color:${color.input.invalid.hovered.bg};--card-fg-color:${color.input.invalid.hovered.fg};}*:not(:disabled):not(:read-only):not(:invalid):not(:focus):hover + &[data-border]{--input-box-shadow:${focusRingBorderStyle({
|
|
584
|
-
color: color.input.default.hovered.border,
|
|
585
|
-
width: input.border.width
|
|
586
|
-
})};}*:invalid:not(:disabled):not(:read-only):not(:focus):hover + &[data-border]{--input-box-shadow:${focusRingBorderStyle({
|
|
587
|
-
color: color.input.invalid.hovered.border,
|
|
588
|
-
width: input.border.width
|
|
589
|
-
})};}}}`;
|
|
590
|
-
}
|
|
591
213
|
function responsiveMarginStyle(props) {
|
|
592
214
|
let { theme } = props;
|
|
593
215
|
return [
|
|
@@ -612,30 +234,9 @@ function responsivePaddingStyle(props) {
|
|
|
612
234
|
_getResponsiveSpace(theme, ["paddingLeft"], props.$paddingLeft)
|
|
613
235
|
].filter(Boolean);
|
|
614
236
|
}
|
|
615
|
-
|
|
616
|
-
let { media, radius } = getTheme_v2(props.theme);
|
|
617
|
-
return _responsive(media, props.$radius, (value) => {
|
|
618
|
-
let borderRadius = 0;
|
|
619
|
-
return typeof value == "number" && (borderRadius = rem(radius[value])), value === "full" && (borderRadius = "9999px"), { borderRadius };
|
|
620
|
-
});
|
|
621
|
-
}
|
|
622
|
-
function toBoxShadow(shadow, color) {
|
|
623
|
-
return `${shadow.map(rem).join(" ")} ${color}`;
|
|
624
|
-
}
|
|
625
|
-
function shadowStyle(shadow, outlineWidth = 1) {
|
|
626
|
-
return shadow ? { boxShadow: `${`0 0 0 ${rem(outlineWidth)} var(--card-shadow-outline-color)`}, ${toBoxShadow(shadow.umbra, "var(--card-shadow-umbra-color)")}, ${toBoxShadow(shadow.penumbra, "var(--card-shadow-penumbra-color)")}, ${toBoxShadow(shadow.ambient, "var(--card-shadow-ambient-color)")}` } : EMPTY_RECORD;
|
|
627
|
-
}
|
|
628
|
-
function responsiveShadowStyle(props) {
|
|
629
|
-
let { card, media, shadow } = getTheme_v2(props.theme);
|
|
630
|
-
return _responsive(media, props.$shadow, (index) => shadowStyle(shadow[index], card.shadow.outline));
|
|
631
|
-
}
|
|
632
|
-
/** @internal */
|
|
633
|
-
const SpanWithTextOverflow = styled.span.withConfig({
|
|
634
|
-
displayName: "SpanWithTextOverflow",
|
|
635
|
-
componentId: "sc-xkyu3h-0"
|
|
636
|
-
})`display:block;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;overflow:clip;`, StyledBox = /* @__PURE__ */ styled.div.withConfig({
|
|
237
|
+
const StyledBox = /* @__PURE__ */ styled.div.withConfig({
|
|
637
238
|
displayName: "StyledBox",
|
|
638
|
-
componentId: "sc-
|
|
239
|
+
componentId: "sc-p4sc7t-0"
|
|
639
240
|
})(boxStyle, flexItemStyle, responsiveBoxStyle, responsiveGridItemStyle, responsiveMarginStyle, responsivePaddingStyle), Box = forwardRef(function Box(props, ref) {
|
|
640
241
|
let $ = c(115), deprecated_column, deprecated_columnEnd, deprecated_columnStart, deprecated_row, deprecated_rowEnd, deprecated_rowStart, flex, gridColumn, gridColumnEnd, gridColumnStart, gridRow, gridRowEnd, gridRowStart, height, marginBottom, marginLeft, marginRight, marginTop, marginX, marginY, overflow, paddingBottom, paddingLeft, paddingRight, paddingTop, paddingX, paddingY, restProps, sizing, t0, t1, t2, t3;
|
|
641
242
|
$[0] === props ? (deprecated_column = $[1], deprecated_columnEnd = $[2], deprecated_columnStart = $[3], deprecated_row = $[4], deprecated_rowEnd = $[5], deprecated_rowStart = $[6], flex = $[7], gridColumn = $[8], gridColumnEnd = $[9], gridColumnStart = $[10], gridRow = $[11], gridRowEnd = $[12], gridRowStart = $[13], height = $[14], marginBottom = $[15], marginLeft = $[16], marginRight = $[17], marginTop = $[18], marginX = $[19], marginY = $[20], overflow = $[21], paddingBottom = $[22], paddingLeft = $[23], paddingRight = $[24], paddingTop = $[25], paddingX = $[26], paddingY = $[27], restProps = $[28], sizing = $[29], t0 = $[30], t1 = $[31], t2 = $[32], t3 = $[33]) : ({as: t0, gridColumn, column: deprecated_column, gridColumnStart, columnStart: deprecated_columnStart, gridColumnEnd, columnEnd: deprecated_columnEnd, display: t1, flex, height, margin: t2, marginX, marginY, marginTop, marginRight, marginBottom, marginLeft, overflow, padding: t3, paddingX, paddingY, paddingTop, paddingRight, paddingBottom, paddingLeft, gridRow, row: deprecated_row, gridRowStart, rowStart: deprecated_rowStart, gridRowEnd, rowEnd: deprecated_rowEnd, sizing, ...restProps} = props, $[0] = props, $[1] = deprecated_column, $[2] = deprecated_columnEnd, $[3] = deprecated_columnStart, $[4] = deprecated_row, $[5] = deprecated_rowEnd, $[6] = deprecated_rowStart, $[7] = flex, $[8] = gridColumn, $[9] = gridColumnEnd, $[10] = gridColumnStart, $[11] = gridRow, $[12] = gridRowEnd, $[13] = gridRowStart, $[14] = height, $[15] = marginBottom, $[16] = marginLeft, $[17] = marginRight, $[18] = marginTop, $[19] = marginX, $[20] = marginY, $[21] = overflow, $[22] = paddingBottom, $[23] = paddingLeft, $[24] = paddingRight, $[25] = paddingTop, $[26] = paddingX, $[27] = paddingY, $[28] = restProps, $[29] = sizing, $[30] = t0, $[31] = t1, $[32] = t2, $[33] = t3);
|
|
@@ -724,73 +325,195 @@ const SpanWithTextOverflow = styled.span.withConfig({
|
|
|
724
325
|
children: props.children
|
|
725
326
|
}), $[84] = asProp, $[85] = props.children, $[86] = ref, $[87] = restProps, $[88] = t10, $[89] = t11, $[90] = t12, $[91] = t13, $[92] = t14, $[93] = t15, $[94] = t16, $[95] = t17, $[96] = t18, $[97] = t19, $[98] = t20, $[99] = t21, $[100] = t22, $[101] = t23, $[102] = t24, $[103] = t25, $[104] = t26, $[105] = t27, $[106] = t28, $[107] = t29, $[108] = t4, $[109] = t5, $[110] = t6, $[111] = t7, $[112] = t8, $[113] = t9, $[114] = t30) : t30 = $[114], t30;
|
|
726
327
|
});
|
|
727
|
-
function
|
|
728
|
-
let {
|
|
729
|
-
return
|
|
328
|
+
function responsiveRadiusStyle(props) {
|
|
329
|
+
let { media, radius } = getTheme_v2(props.theme);
|
|
330
|
+
return _responsive(media, props.$radius, (value) => {
|
|
331
|
+
let borderRadius = 0;
|
|
332
|
+
return typeof value == "number" && (borderRadius = rem(radius[value])), value === "full" && (borderRadius = "9999px"), { borderRadius };
|
|
333
|
+
});
|
|
730
334
|
}
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
let
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
let
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
let
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
335
|
+
/**
|
|
336
|
+
* @public
|
|
337
|
+
*/
|
|
338
|
+
function useTheme$1() {
|
|
339
|
+
return useTheme();
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* @public
|
|
343
|
+
*/
|
|
344
|
+
function useTheme_v2() {
|
|
345
|
+
let $ = c(2), t0 = useTheme(), t1;
|
|
346
|
+
return $[0] === t0 ? t1 = $[1] : (t1 = getTheme_v2(t0), $[0] = t0, $[1] = t1), t1;
|
|
347
|
+
}
|
|
348
|
+
const BASE_STYLE$1 = { "&&:not([hidden])": { display: "flex" } };
|
|
349
|
+
function responsiveFlexStyle() {
|
|
350
|
+
return [
|
|
351
|
+
BASE_STYLE$1,
|
|
352
|
+
responsiveFlexAlignStyle,
|
|
353
|
+
responsiveFlexGapStyle,
|
|
354
|
+
responsiveFlexWrapStyle,
|
|
355
|
+
responsiveFlexJustifyStyle,
|
|
356
|
+
responsiveFlexDirectionStyle
|
|
357
|
+
];
|
|
358
|
+
}
|
|
359
|
+
function responsiveFlexAlignStyle(props) {
|
|
360
|
+
let { media } = getTheme_v2(props.theme);
|
|
361
|
+
return _responsive(media, props.$align, (align) => ({ alignItems: align }));
|
|
362
|
+
}
|
|
363
|
+
function responsiveFlexGapStyle(props) {
|
|
364
|
+
let { media, space } = getTheme_v2(props.theme);
|
|
365
|
+
return _responsive(media, props.$gap, (gap) => ({ gap: gap ? rem(space[gap]) : void 0 }));
|
|
366
|
+
}
|
|
367
|
+
function responsiveFlexWrapStyle(props) {
|
|
368
|
+
let { media } = getTheme_v2(props.theme);
|
|
369
|
+
return _responsive(media, props.$wrap, (wrap) => ({ flexWrap: wrap }));
|
|
370
|
+
}
|
|
371
|
+
function responsiveFlexJustifyStyle(props) {
|
|
372
|
+
let { media } = getTheme_v2(props.theme);
|
|
373
|
+
return _responsive(media, props.$justify, (justify) => ({ justifyContent: justify }));
|
|
374
|
+
}
|
|
375
|
+
function responsiveFlexDirectionStyle(props) {
|
|
376
|
+
let { media } = getTheme_v2(props.theme);
|
|
377
|
+
return _responsive(media, props.$direction, (direction) => ({ flexDirection: direction }));
|
|
378
|
+
}
|
|
379
|
+
const StyledFlex = /* @__PURE__ */ styled(Box).withConfig({
|
|
380
|
+
displayName: "StyledFlex",
|
|
381
|
+
componentId: "sc-5lzqa2-0"
|
|
382
|
+
})(flexItemStyle, responsiveFlexStyle), Flex = forwardRef(function Flex(props, ref) {
|
|
383
|
+
let $ = c(27), align, as, gap, justify, restProps, t0, wrap;
|
|
384
|
+
$[0] === props ? (align = $[1], as = $[2], gap = $[3], justify = $[4], restProps = $[5], t0 = $[6], wrap = $[7]) : ({align, as, direction: t0, gap, justify, wrap, ...restProps} = props, $[0] = props, $[1] = align, $[2] = as, $[3] = gap, $[4] = justify, $[5] = restProps, $[6] = t0, $[7] = wrap);
|
|
385
|
+
let direction = t0 === void 0 ? "row" : t0, t1;
|
|
386
|
+
$[8] === align ? t1 = $[9] : (t1 = _getArrayProp(align), $[8] = align, $[9] = t1);
|
|
387
|
+
let t2;
|
|
388
|
+
$[10] === direction ? t2 = $[11] : (t2 = _getArrayProp(direction), $[10] = direction, $[11] = t2);
|
|
389
|
+
let t3;
|
|
390
|
+
$[12] === gap ? t3 = $[13] : (t3 = _getArrayProp(gap), $[12] = gap, $[13] = t3);
|
|
391
|
+
let t4;
|
|
392
|
+
$[14] === justify ? t4 = $[15] : (t4 = _getArrayProp(justify), $[14] = justify, $[15] = t4);
|
|
393
|
+
let t5;
|
|
394
|
+
$[16] === wrap ? t5 = $[17] : (t5 = _getArrayProp(wrap), $[16] = wrap, $[17] = t5);
|
|
395
|
+
let t6;
|
|
396
|
+
return $[18] !== as || $[19] !== ref || $[20] !== restProps || $[21] !== t1 || $[22] !== t2 || $[23] !== t3 || $[24] !== t4 || $[25] !== t5 ? (t6 = /* @__PURE__ */ jsx(StyledFlex, {
|
|
397
|
+
"data-ui": "Flex",
|
|
398
|
+
...restProps,
|
|
399
|
+
$align: t1,
|
|
400
|
+
$direction: t2,
|
|
401
|
+
$gap: t3,
|
|
402
|
+
$justify: t4,
|
|
403
|
+
$wrap: t5,
|
|
404
|
+
forwardedAs: as,
|
|
405
|
+
ref
|
|
406
|
+
}), $[18] = as, $[19] = ref, $[20] = restProps, $[21] = t1, $[22] = t2, $[23] = t3, $[24] = t4, $[25] = t5, $[26] = t6) : t6 = $[26], t6;
|
|
407
|
+
});
|
|
408
|
+
/**
|
|
409
|
+
* Get responsive text align styles.
|
|
410
|
+
* @internal
|
|
411
|
+
*/
|
|
412
|
+
function responsiveTextAlignStyle(props) {
|
|
413
|
+
let { media } = getTheme_v2(props.theme);
|
|
414
|
+
return _responsive(media, props.$align, (textAlign) => ({ textAlign }));
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* A utility function getting responsive font styles.
|
|
418
|
+
* @internal
|
|
419
|
+
*/
|
|
420
|
+
function responsiveFont(fontKey, props) {
|
|
421
|
+
let { $size, $weight } = props, { font, media } = getTheme_v2(props.theme), { family, sizes, weights } = font[fontKey], fontWeight = $weight && weights[$weight] || weights.regular, defaultSize = sizes[2], base = {
|
|
422
|
+
position: "relative",
|
|
423
|
+
fontFamily: family,
|
|
424
|
+
fontWeight: `${fontWeight}`,
|
|
425
|
+
padding: "1px 0",
|
|
426
|
+
margin: 0,
|
|
427
|
+
"&:before": {
|
|
428
|
+
content: "\"\"",
|
|
429
|
+
display: "block",
|
|
430
|
+
height: 0
|
|
431
|
+
},
|
|
432
|
+
"&:after": {
|
|
433
|
+
content: "\"\"",
|
|
434
|
+
display: "block",
|
|
435
|
+
height: 0
|
|
436
|
+
},
|
|
437
|
+
"& > code, & > span": { display: "block" },
|
|
438
|
+
"&:not([hidden])": { display: "block" }
|
|
439
|
+
};
|
|
440
|
+
return $size ? [base, ..._responsive(media, $size, (sizeIndex) => fontSize(sizes[sizeIndex] || defaultSize))] : (responsiveFont.warned ||= (console.warn("No size specified for responsive font", {
|
|
441
|
+
fontKey,
|
|
442
|
+
$size,
|
|
443
|
+
props,
|
|
444
|
+
base
|
|
445
|
+
}), !0), [base]);
|
|
446
|
+
}
|
|
447
|
+
function fontSize(size) {
|
|
448
|
+
let { ascenderHeight, descenderHeight, fontSize, iconSize, letterSpacing, lineHeight } = size, negHeight = ascenderHeight + descenderHeight, capHeight = lineHeight - negHeight, iconOffset = (capHeight - iconSize) / 2, customIconSize = Math.floor(fontSize * 1.125 / 2) * 2 + 1, customIconOffset = (capHeight - customIconSize) / 2;
|
|
449
|
+
return {
|
|
450
|
+
fontSize: rem(fontSize),
|
|
451
|
+
lineHeight: `calc(${lineHeight} / ${fontSize})`,
|
|
452
|
+
letterSpacing: rem(letterSpacing),
|
|
453
|
+
transform: `translateY(${rem(descenderHeight)})`,
|
|
454
|
+
"&:before": { marginTop: `calc(${rem(0 - negHeight)} - 1px)` },
|
|
455
|
+
"&:after": { marginBottom: "-1px" },
|
|
456
|
+
"& svg:not([data-sanity-icon])": {
|
|
457
|
+
fontSize: `calc(${customIconSize} / 16 * 1rem)`,
|
|
458
|
+
margin: rem(customIconOffset)
|
|
459
|
+
},
|
|
460
|
+
"& [data-sanity-icon]": {
|
|
461
|
+
fontSize: `calc(${iconSize} / 16 * 1rem)`,
|
|
462
|
+
margin: rem(iconOffset)
|
|
463
|
+
}
|
|
464
|
+
};
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* Get responsive CSS for the `text` font style.
|
|
468
|
+
* @internal
|
|
469
|
+
*/
|
|
470
|
+
function responsiveTextFont(props) {
|
|
471
|
+
return responsiveFont("text", props);
|
|
472
|
+
}
|
|
473
|
+
/** @internal */
|
|
474
|
+
const SpanWithTextOverflow = styled.span.withConfig({
|
|
475
|
+
displayName: "SpanWithTextOverflow",
|
|
476
|
+
componentId: "sc-xkyu3h-0"
|
|
477
|
+
})`display:block;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;overflow:clip;`;
|
|
478
|
+
function textBaseStyle(props) {
|
|
479
|
+
let { $accent, $muted } = props, { font } = getTheme_v2(props.theme);
|
|
480
|
+
return css`color:var(--card-fg-color);${$accent && css`color:var(--card-accent-fg-color);`} ${$muted && css`color:var(--card-muted-fg-color);`} & code{font-family:${font.code.family};border-radius:1px;background-color:var(--card-code-bg-color);color:var(--card-code-fg-color);}& a{text-decoration:none;border-radius:1px;color:var(--card-link-color);outline:none;@media (hover:hover){&:hover{text-decoration:underline;}}&:focus{box-shadow:0 0 0 1px var(--card-bg-color),0 0 0 3px var(--card-focus-ring-color);}&:focus:not(:focus-visible){box-shadow:none;}}& strong{font-weight:${font.text.weights.bold};}& svg{display:inline;}& [data-sanity-icon]{vertical-align:baseline;color:var(--card-icon-color);& path{vector-effect:non-scaling-stroke !important;}}`;
|
|
481
|
+
}
|
|
482
|
+
const StyledText = /* @__PURE__ */ styled.div.withConfig({
|
|
483
|
+
displayName: "StyledText",
|
|
484
|
+
componentId: "sc-m7q2yn-0"
|
|
485
|
+
})(responsiveTextFont, responsiveTextAlignStyle, textBaseStyle), Text = forwardRef(function Text(props, ref) {
|
|
486
|
+
let $ = c(26), align, childrenProp, restProps, t0, t1, t2, textOverflow, weight;
|
|
487
|
+
$[0] === props ? (align = $[1], childrenProp = $[2], restProps = $[3], t0 = $[4], t1 = $[5], t2 = $[6], textOverflow = $[7], weight = $[8]) : ({accent: t0, align, children: childrenProp, muted: t1, size: t2, textOverflow, weight, ...restProps} = props, $[0] = props, $[1] = align, $[2] = childrenProp, $[3] = restProps, $[4] = t0, $[5] = t1, $[6] = t2, $[7] = textOverflow, $[8] = weight);
|
|
488
|
+
let accent = t0 !== void 0 && t0, muted = t1 !== void 0 && t1, size = t2 === void 0 ? 2 : t2, children = childrenProp;
|
|
489
|
+
if (textOverflow === "ellipsis") {
|
|
490
|
+
let t3;
|
|
491
|
+
$[9] === children ? t3 = $[10] : (t3 = /* @__PURE__ */ jsx(SpanWithTextOverflow, { children }), $[9] = children, $[10] = t3), children = t3;
|
|
492
|
+
}
|
|
493
|
+
let t3;
|
|
494
|
+
$[11] === align ? t3 = $[12] : (t3 = _getArrayProp(align), $[11] = align, $[12] = t3);
|
|
495
|
+
let t4;
|
|
496
|
+
$[13] === size ? t4 = $[14] : (t4 = _getArrayProp(size), $[13] = size, $[14] = t4);
|
|
497
|
+
let t5;
|
|
498
|
+
$[15] === children ? t5 = $[16] : (t5 = /* @__PURE__ */ jsx("span", { children }), $[15] = children, $[16] = t5);
|
|
499
|
+
let t6;
|
|
500
|
+
return $[17] !== accent || $[18] !== muted || $[19] !== ref || $[20] !== restProps || $[21] !== t3 || $[22] !== t4 || $[23] !== t5 || $[24] !== weight ? (t6 = /* @__PURE__ */ jsx(StyledText, {
|
|
501
|
+
"data-ui": "Text",
|
|
502
|
+
...restProps,
|
|
503
|
+
$accent: accent,
|
|
504
|
+
$align: t3,
|
|
505
|
+
$muted: muted,
|
|
506
|
+
ref,
|
|
507
|
+
$size: t4,
|
|
508
|
+
$weight: weight,
|
|
509
|
+
children: t5
|
|
510
|
+
}), $[17] = accent, $[18] = muted, $[19] = ref, $[20] = restProps, $[21] = t3, $[22] = t4, $[23] = t5, $[24] = weight, $[25] = t6) : t6 = $[25], t6;
|
|
511
|
+
}), rotate = keyframes`from{transform:rotate(0deg);}to{transform:rotate(360deg);}`, StyledSpinner = styled(Text).withConfig({
|
|
512
|
+
displayName: "StyledSpinner",
|
|
513
|
+
componentId: "sc-k51eu1-0"
|
|
514
|
+
})`& > span > svg{animation:${rotate} 500ms linear infinite;}`, Spinner = forwardRef(function Spinner(props, ref) {
|
|
515
|
+
let $ = c(4), t0;
|
|
516
|
+
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = /* @__PURE__ */ jsx(SpinnerIcon, {}), $[0] = t0) : t0 = $[0];
|
|
794
517
|
let t1;
|
|
795
518
|
return $[1] !== props || $[2] !== ref ? (t1 = /* @__PURE__ */ jsx(StyledSpinner, {
|
|
796
519
|
"data-ui": "Spinner",
|
|
@@ -878,6 +601,18 @@ function _cardColorStyle(base, color, checkered = !1) {
|
|
|
878
601
|
"--card-hairline-hard-color": color.border
|
|
879
602
|
};
|
|
880
603
|
}
|
|
604
|
+
function focusRingBorderStyle(border) {
|
|
605
|
+
return `inset 0 0 0 ${border.width}px ${border.color}`;
|
|
606
|
+
}
|
|
607
|
+
function focusRingStyle(opts) {
|
|
608
|
+
let { base, border, focusRing } = opts, focusRingOutsetWidth = focusRing.offset + focusRing.width, focusRingInsetWidth = 0 - focusRing.offset, bgColor = base ? base.bg : "var(--card-bg-color)";
|
|
609
|
+
return [
|
|
610
|
+
focusRingInsetWidth > 0 && `inset 0 0 0 ${focusRingInsetWidth}px var(--card-focus-ring-color)`,
|
|
611
|
+
border && focusRingBorderStyle(border),
|
|
612
|
+
focusRingInsetWidth < 0 && `0 0 0 ${0 - focusRingInsetWidth}px ${bgColor}`,
|
|
613
|
+
focusRingOutsetWidth > 0 && `0 0 0 ${focusRingOutsetWidth}px var(--card-focus-ring-color)`
|
|
614
|
+
].filter(Boolean).join(",");
|
|
615
|
+
}
|
|
881
616
|
/**
|
|
882
617
|
* @internal
|
|
883
618
|
*/
|
|
@@ -929,10 +664,10 @@ function buttonColorStyles(props) {
|
|
|
929
664
|
}
|
|
930
665
|
const StyledButton = /* @__PURE__ */ styled.button.withConfig({
|
|
931
666
|
displayName: "StyledButton",
|
|
932
|
-
componentId: "sc-
|
|
667
|
+
componentId: "sc-5eghxe-0"
|
|
933
668
|
})(responsiveRadiusStyle, buttonBaseStyles, buttonColorStyles), LoadingBox = styled.div.withConfig({
|
|
934
669
|
displayName: "LoadingBox",
|
|
935
|
-
componentId: "sc-
|
|
670
|
+
componentId: "sc-5eghxe-1"
|
|
936
671
|
})`position:absolute;top:0;left:0;right:0;bottom:0;display:flex;align-items:center;justify-content:center;background-color:var(--card-bg-color);border-radius:inherit;z-index:1;box-shadow:inherit;`, Button = forwardRef(function Button(props, ref) {
|
|
937
672
|
let $ = c(87), IconComponent, IconRightComponent, children, disabled, gap, loading, paddingBottomProp, paddingLeftProp, paddingRightProp, paddingTopProp, paddingXProp, paddingYProp, restProps, selected, t0, t1, t2, t3, t4, t5, t6, t7, t8, text, textAlign, textWeight, width;
|
|
938
673
|
$[0] === props ? (IconComponent = $[1], IconRightComponent = $[2], children = $[3], disabled = $[4], gap = $[5], loading = $[6], paddingBottomProp = $[7], paddingLeftProp = $[8], paddingRightProp = $[9], paddingTopProp = $[10], paddingXProp = $[11], paddingYProp = $[12], restProps = $[13], selected = $[14], t0 = $[15], t1 = $[16], t2 = $[17], t3 = $[18], t4 = $[19], t5 = $[20], t6 = $[21], t7 = $[22], t8 = $[23], text = $[24], textAlign = $[25], textWeight = $[26], width = $[27]) : ({children, disabled, fontSize: t0, icon: IconComponent, iconRight: IconRightComponent, justify: t1, loading, mode: t2, padding: t3, paddingX: paddingXProp, paddingY: paddingYProp, paddingTop: paddingTopProp, paddingBottom: paddingBottomProp, paddingLeft: paddingLeftProp, paddingRight: paddingRightProp, radius: t4, selected, gap, space: t5, text, textAlign, textWeight, tone: t6, type: t7, muted: t8, width, ...restProps} = props, $[0] = props, $[1] = IconComponent, $[2] = IconRightComponent, $[3] = children, $[4] = disabled, $[5] = gap, $[6] = loading, $[7] = paddingBottomProp, $[8] = paddingLeftProp, $[9] = paddingRightProp, $[10] = paddingTopProp, $[11] = paddingXProp, $[12] = paddingYProp, $[13] = restProps, $[14] = selected, $[15] = t0, $[16] = t1, $[17] = t2, $[18] = t3, $[19] = t4, $[20] = t5, $[21] = t6, $[22] = t7, $[23] = t8, $[24] = text, $[25] = textAlign, $[26] = textWeight, $[27] = width);
|
|
@@ -1022,63 +757,206 @@ const StyledButton = /* @__PURE__ */ styled.button.withConfig({
|
|
|
1022
757
|
]
|
|
1023
758
|
}), $[73] = mode, $[74] = radius, $[75] = ref, $[76] = restProps, $[77] = t21, $[78] = t22, $[79] = t23, $[80] = t24, $[81] = t25, $[82] = t26, $[83] = tone, $[84] = type, $[85] = width, $[86] = t27) : t27 = $[86], t27;
|
|
1024
759
|
});
|
|
1025
|
-
function
|
|
1026
|
-
return [
|
|
760
|
+
function responsiveBorderStyle() {
|
|
761
|
+
return [
|
|
762
|
+
border,
|
|
763
|
+
borderTop,
|
|
764
|
+
borderRight,
|
|
765
|
+
borderBottom,
|
|
766
|
+
borderLeft
|
|
767
|
+
];
|
|
1027
768
|
}
|
|
1028
|
-
function
|
|
1029
|
-
let {
|
|
1030
|
-
return
|
|
769
|
+
function border(props) {
|
|
770
|
+
let { card, media } = getTheme_v2(props.theme), borderStyle = `${card.border?.width ?? 1}px solid var(--card-border-color)`;
|
|
771
|
+
return _responsive(media, props.$border, (value) => value ? { "&&": { border: borderStyle } } : { "&&": { border: 0 } });
|
|
1031
772
|
}
|
|
1032
|
-
function
|
|
1033
|
-
let {
|
|
1034
|
-
|
|
1035
|
-
color: "var(--card-border-color)"
|
|
1036
|
-
};
|
|
1037
|
-
return css`color-scheme:${color._dark ? "dark" : "light"};${_cardColorStyle(color, color, $checkered)} background-color:${$muted ? "var(--card-muted-bg-color)" : "var(--card-bg-color)"};color:var(--card-fg-color);&[data-as='button']{--card-focus-ring-box-shadow:none;cursor:default;box-shadow:var(--card-focus-ring-box-shadow);&:disabled{${_cardColorStyle(color, color.selectable.default.disabled, $checkered)}}&:not(:disabled){&[data-pressed]{${_cardColorStyle(color, color.selectable.default.pressed, $checkered)}}&[data-selected]{${_cardColorStyle(color, color.selectable.default.selected, $checkered)}}@media (hover:hover){&:not([data-pressed]):not([data-selected]){&[data-hovered],&:hover{${_cardColorStyle(color, color.selectable.default.hovered, $checkered)}}&:active{${_cardColorStyle(color, color.selectable.default.pressed, $checkered)}}}}&:focus-visible{--card-focus-ring-box-shadow:${$focusRing ? focusRingStyle({
|
|
1038
|
-
base: color,
|
|
1039
|
-
border,
|
|
1040
|
-
focusRing: card.focusRing
|
|
1041
|
-
}) : void 0};}}}&[data-as='a']{cursor:pointer;box-shadow:var(--card-focus-ring-box-shadow);&[data-disabled]{${_cardColorStyle(color, color.selectable.default.disabled, $checkered)}}&:not([data-disabled]){&[data-pressed]{${_cardColorStyle(color, color.selectable.default.pressed, $checkered)}}&[data-selected]{${_cardColorStyle(color, color.selectable.default.selected, $checkered)}}@media (hover:hover){&:not([data-pressed]):not([data-selected]){&[data-hovered],&:hover{${_cardColorStyle(color, color.selectable.default.hovered, $checkered)}}&:active{${_cardColorStyle(color, color.selectable.default.pressed, $checkered)}}}}&:focus-visible{--card-focus-ring-box-shadow:${$focusRing ? focusRingStyle({
|
|
1042
|
-
base: color,
|
|
1043
|
-
border,
|
|
1044
|
-
focusRing: card.focusRing
|
|
1045
|
-
}) : void 0};}}}${style?.card?.root}`;
|
|
773
|
+
function borderTop(props) {
|
|
774
|
+
let { card, media } = getTheme_v2(props.theme), borderStyle = `${card.border?.width ?? 1}px solid var(--card-border-color)`;
|
|
775
|
+
return _responsive(media, props.$borderTop, (value) => value ? { "&&": { borderTop: borderStyle } } : { "&&": { borderTop: 0 } });
|
|
1046
776
|
}
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
}
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
777
|
+
function borderRight(props) {
|
|
778
|
+
let { card, media } = getTheme_v2(props.theme), borderStyle = `${card.border?.width ?? 1}px solid var(--card-border-color)`;
|
|
779
|
+
return _responsive(media, props.$borderRight, (value) => value ? { "&&": { borderRight: borderStyle } } : { "&&": { borderRight: 0 } });
|
|
780
|
+
}
|
|
781
|
+
function borderBottom(props) {
|
|
782
|
+
let { card, media } = getTheme_v2(props.theme), borderStyle = `${card.border?.width ?? 1}px solid var(--card-border-color)`;
|
|
783
|
+
return _responsive(media, props.$borderBottom, (value) => value ? { "&&": { borderBottom: borderStyle } } : { "&&": { borderBottom: 0 } });
|
|
784
|
+
}
|
|
785
|
+
function borderLeft(props) {
|
|
786
|
+
let { card, media } = getTheme_v2(props.theme), borderStyle = `${card.border?.width ?? 1}px solid var(--card-border-color)`;
|
|
787
|
+
return _responsive(media, props.$borderLeft, (value) => value ? { "&&": { borderLeft: borderStyle } } : { "&&": { borderLeft: 0 } });
|
|
788
|
+
}
|
|
789
|
+
function toBoxShadow(shadow, color) {
|
|
790
|
+
return `${shadow.map(rem).join(" ")} ${color}`;
|
|
791
|
+
}
|
|
792
|
+
function shadowStyle(shadow, outlineWidth = 1) {
|
|
793
|
+
return shadow ? { boxShadow: `${`0 0 0 ${rem(outlineWidth)} var(--card-shadow-outline-color)`}, ${toBoxShadow(shadow.umbra, "var(--card-shadow-umbra-color)")}, ${toBoxShadow(shadow.penumbra, "var(--card-shadow-penumbra-color)")}, ${toBoxShadow(shadow.ambient, "var(--card-shadow-ambient-color)")}` } : EMPTY_RECORD;
|
|
794
|
+
}
|
|
795
|
+
function responsiveShadowStyle(props) {
|
|
796
|
+
let { card, media, shadow } = getTheme_v2(props.theme);
|
|
797
|
+
return _responsive(media, props.$shadow, (index) => shadowStyle(shadow[index], card.shadow.outline));
|
|
798
|
+
}
|
|
799
|
+
/**
|
|
800
|
+
* Gets the global scope instance in a given environment.
|
|
801
|
+
*
|
|
802
|
+
* The strategy is to return the most modern, and if not, the most common:
|
|
803
|
+
* - The `globalThis` variable is the modern approach to accessing the global scope
|
|
804
|
+
* - The `window` variable is the global scope in a web browser
|
|
805
|
+
* - The `self` variable is the global scope in workers and others
|
|
806
|
+
* - The `global` variable is the global scope in Node.js
|
|
807
|
+
*/
|
|
808
|
+
function getGlobalScope() {
|
|
809
|
+
if (typeof globalThis < "u") return globalThis;
|
|
810
|
+
if (typeof window < "u") return window;
|
|
811
|
+
if (typeof self < "u") return self;
|
|
812
|
+
if (typeof global < "u") return global;
|
|
813
|
+
throw Error("@sanity/ui: could not locate global scope");
|
|
814
|
+
}
|
|
815
|
+
const globalScope = getGlobalScope();
|
|
816
|
+
/**
|
|
817
|
+
* As `@sanity/ui` is declared as a dependency, and may be duplicated, sometimes across major versions
|
|
818
|
+
* it's critical that vital react contexts are shared even when there is a duplicate.
|
|
819
|
+
* If we used a model similar to `sanity` itself, or `styled-components`, this would be unnecessary as
|
|
820
|
+
* those libraries enforce single instances.
|
|
821
|
+
* Since we don't enforce it we have to support a sanity plugin being able to call hooks like `useToast`, and then
|
|
822
|
+
* read the context setup by `sanity`, which calls `ToastProvider`, even if the provider and hook are different instances in memory.
|
|
823
|
+
* It's also why it's vital that all changes to globally scoped providers remain fully backwards compatible to v1.
|
|
824
|
+
*/
|
|
825
|
+
function createGlobalScopedContext(key, defaultValue) {
|
|
826
|
+
let symbol = Symbol.for(key);
|
|
827
|
+
/**
|
|
828
|
+
* Prevent errors about re-renders on React SSR on Next.js App Router
|
|
829
|
+
*/
|
|
830
|
+
if (typeof document > "u") {
|
|
831
|
+
let context = createContext(defaultValue);
|
|
832
|
+
return context.displayName = key, context;
|
|
833
|
+
}
|
|
834
|
+
return globalScope[symbol] = globalScope[symbol] || createContext(defaultValue), globalScope[symbol];
|
|
835
|
+
}
|
|
836
|
+
/**
|
|
837
|
+
* @internal
|
|
838
|
+
*/
|
|
839
|
+
const ThemeContext = createGlobalScopedContext("@sanity/ui/context/theme", null);
|
|
840
|
+
/**
|
|
841
|
+
* @public
|
|
842
|
+
*/
|
|
843
|
+
function ThemeProvider$1(props) {
|
|
844
|
+
let $ = c(15), parentTheme = useContext(ThemeContext), { children } = props, scheme = props.scheme ?? (parentTheme?.scheme || "light"), rootTheme = props.theme ?? (parentTheme?.theme || null), tone = props.tone ?? (parentTheme?.tone || "default"), t0;
|
|
845
|
+
bb0: {
|
|
846
|
+
if (!rootTheme) {
|
|
847
|
+
t0 = null;
|
|
848
|
+
break bb0;
|
|
849
|
+
}
|
|
850
|
+
let t1;
|
|
851
|
+
$[0] !== rootTheme || $[1] !== scheme || $[2] !== tone ? (t1 = {
|
|
852
|
+
version: 0,
|
|
853
|
+
theme: rootTheme,
|
|
854
|
+
scheme,
|
|
855
|
+
tone
|
|
856
|
+
}, $[0] = rootTheme, $[1] = scheme, $[2] = tone, $[3] = t1) : t1 = $[3], t0 = t1;
|
|
857
|
+
}
|
|
858
|
+
let themeContext = t0, t1;
|
|
859
|
+
bb1: {
|
|
860
|
+
if (!rootTheme) {
|
|
861
|
+
t1 = null;
|
|
862
|
+
break bb1;
|
|
863
|
+
}
|
|
864
|
+
let t2;
|
|
865
|
+
$[4] !== rootTheme || $[5] !== scheme || $[6] !== tone ? (t2 = getScopedTheme(rootTheme, scheme, tone), $[4] = rootTheme, $[5] = scheme, $[6] = tone, $[7] = t2) : t2 = $[7], t1 = t2;
|
|
866
|
+
}
|
|
867
|
+
let theme = t1;
|
|
868
|
+
if (!theme) {
|
|
869
|
+
let t2;
|
|
870
|
+
return $[8] === Symbol.for("react.memo_cache_sentinel") ? (t2 = /* @__PURE__ */ jsx("pre", { children: "ThemeProvider: no \"theme\" property provided" }), $[8] = t2) : t2 = $[8], t2;
|
|
871
|
+
}
|
|
872
|
+
let t2;
|
|
873
|
+
$[9] !== children || $[10] !== theme ? (t2 = /* @__PURE__ */ jsx(ThemeProvider, {
|
|
874
|
+
theme,
|
|
875
|
+
children
|
|
876
|
+
}), $[9] = children, $[10] = theme, $[11] = t2) : t2 = $[11];
|
|
877
|
+
let t3;
|
|
878
|
+
return $[12] !== t2 || $[13] !== themeContext ? (t3 = /* @__PURE__ */ jsx(ThemeContext.Provider, {
|
|
879
|
+
value: themeContext,
|
|
880
|
+
children: t2
|
|
881
|
+
}), $[12] = t2, $[13] = themeContext, $[14] = t3) : t3 = $[14], t3;
|
|
882
|
+
}
|
|
883
|
+
/**
|
|
884
|
+
* @public
|
|
885
|
+
*/
|
|
886
|
+
function useRootTheme() {
|
|
887
|
+
let value = useContext(ThemeContext);
|
|
888
|
+
if (!value) throw Error("useRootTheme(): missing context value");
|
|
889
|
+
return value;
|
|
890
|
+
}
|
|
891
|
+
/**
|
|
892
|
+
* @public
|
|
893
|
+
*/
|
|
894
|
+
function ThemeColorProvider(props) {
|
|
895
|
+
let $ = c(5), { children, scheme, tone } = props, root = useRootTheme(), t0 = scheme || root.scheme, t1;
|
|
896
|
+
return $[0] !== children || $[1] !== root.theme || $[2] !== t0 || $[3] !== tone ? (t1 = /* @__PURE__ */ jsx(ThemeProvider$1, {
|
|
897
|
+
scheme: t0,
|
|
898
|
+
theme: root.theme,
|
|
899
|
+
tone,
|
|
900
|
+
children
|
|
901
|
+
}), $[0] = children, $[1] = root.theme, $[2] = t0, $[3] = tone, $[4] = t1) : t1 = $[4], t1;
|
|
902
|
+
}
|
|
903
|
+
function cardStyle(props) {
|
|
904
|
+
return [cardBaseStyle(props), cardColorStyle(props)];
|
|
905
|
+
}
|
|
906
|
+
function cardBaseStyle(props) {
|
|
907
|
+
let { $checkered } = props, { space } = getTheme_v2(props.theme);
|
|
908
|
+
return css`${$checkered && css`background-size:${space[3]}px ${space[3]}px;background-position:50% 50%;background-image:var(--card-bg-image);`} &[data-as='button']{-webkit-font-smoothing:inherit;appearance:none;outline:none;font:inherit;text-align:inherit;border:0;width:-moz-available;width:-webkit-fill-available;width:stretch;}&[data-as='a']{outline:none;text-decoration:none;}&[data-as='pre']{font:inherit;}`;
|
|
909
|
+
}
|
|
910
|
+
function cardColorStyle(props) {
|
|
911
|
+
let { $checkered, $focusRing, $muted } = props, { card, color, style } = getTheme_v2(props.theme), border = {
|
|
912
|
+
width: card.border.width,
|
|
913
|
+
color: "var(--card-border-color)"
|
|
914
|
+
};
|
|
915
|
+
return css`color-scheme:${color._dark ? "dark" : "light"};${_cardColorStyle(color, color, $checkered)} background-color:${$muted ? "var(--card-muted-bg-color)" : "var(--card-bg-color)"};color:var(--card-fg-color);&[data-as='button']{--card-focus-ring-box-shadow:none;cursor:default;box-shadow:var(--card-focus-ring-box-shadow);&:disabled{${_cardColorStyle(color, color.selectable.default.disabled, $checkered)}}&:not(:disabled){&[data-pressed]{${_cardColorStyle(color, color.selectable.default.pressed, $checkered)}}&[data-selected]{${_cardColorStyle(color, color.selectable.default.selected, $checkered)}}@media (hover:hover){&:not([data-pressed]):not([data-selected]){&[data-hovered],&:hover{${_cardColorStyle(color, color.selectable.default.hovered, $checkered)}}&:active{${_cardColorStyle(color, color.selectable.default.pressed, $checkered)}}}}&:focus-visible{--card-focus-ring-box-shadow:${$focusRing ? focusRingStyle({
|
|
916
|
+
base: color,
|
|
917
|
+
border,
|
|
918
|
+
focusRing: card.focusRing
|
|
919
|
+
}) : void 0};}}}&[data-as='a']{cursor:pointer;box-shadow:var(--card-focus-ring-box-shadow);&[data-disabled]{${_cardColorStyle(color, color.selectable.default.disabled, $checkered)}}&:not([data-disabled]){&[data-pressed]{${_cardColorStyle(color, color.selectable.default.pressed, $checkered)}}&[data-selected]{${_cardColorStyle(color, color.selectable.default.selected, $checkered)}}@media (hover:hover){&:not([data-pressed]):not([data-selected]){&[data-hovered],&:hover{${_cardColorStyle(color, color.selectable.default.hovered, $checkered)}}&:active{${_cardColorStyle(color, color.selectable.default.pressed, $checkered)}}}}&:focus-visible{--card-focus-ring-box-shadow:${$focusRing ? focusRingStyle({
|
|
920
|
+
base: color,
|
|
921
|
+
border,
|
|
922
|
+
focusRing: card.focusRing
|
|
923
|
+
}) : void 0};}}}${style?.card?.root}`;
|
|
924
|
+
}
|
|
925
|
+
const StyledCard = /* @__PURE__ */ styled(Box).withConfig({
|
|
926
|
+
displayName: "StyledCard",
|
|
927
|
+
componentId: "sc-2ikw89-0"
|
|
928
|
+
})(responsiveBorderStyle, responsiveRadiusStyle, responsiveShadowStyle, cardStyle), Card = forwardRef(function Card(props, ref) {
|
|
929
|
+
let $ = c(56), asProp, border, borderBottom, borderLeft, borderRight, borderTop, muted, pressed, restProps, scheme, selected, shadow, t0, t1, t2, t3;
|
|
930
|
+
$[0] === props ? (asProp = $[1], border = $[2], borderBottom = $[3], borderLeft = $[4], borderRight = $[5], borderTop = $[6], muted = $[7], pressed = $[8], restProps = $[9], scheme = $[10], selected = $[11], shadow = $[12], t0 = $[13], t1 = $[14], t2 = $[15], t3 = $[16]) : ({__unstable_checkered: t0, __unstable_focusRing: t1, as: asProp, border, borderTop, borderRight, borderBottom, borderLeft, muted, pressed, radius: t2, scheme, selected, shadow, tone: t3, ...restProps} = props, $[0] = props, $[1] = asProp, $[2] = border, $[3] = borderBottom, $[4] = borderLeft, $[5] = borderRight, $[6] = borderTop, $[7] = muted, $[8] = pressed, $[9] = restProps, $[10] = scheme, $[11] = selected, $[12] = shadow, $[13] = t0, $[14] = t1, $[15] = t2, $[16] = t3);
|
|
931
|
+
let checkered = t0 !== void 0 && t0, focusRing = t1 !== void 0 && t1, radius = t2 === void 0 ? 0 : t2, toneProp = t3 === void 0 ? "default" : t3, as = isValidElementType(asProp) ? asProp : "div", rootTheme = useRootTheme(), tone = toneProp === "inherit" ? rootTheme.tone : toneProp, t4 = typeof as == "string" ? as : void 0, t5 = rootTheme.scheme, t6;
|
|
932
|
+
$[17] === border ? t6 = $[18] : (t6 = _getArrayProp(border), $[17] = border, $[18] = t6);
|
|
933
|
+
let t7;
|
|
934
|
+
$[19] === borderTop ? t7 = $[20] : (t7 = _getArrayProp(borderTop), $[19] = borderTop, $[20] = t7);
|
|
935
|
+
let t8;
|
|
936
|
+
$[21] === borderRight ? t8 = $[22] : (t8 = _getArrayProp(borderRight), $[21] = borderRight, $[22] = t8);
|
|
937
|
+
let t9;
|
|
938
|
+
$[23] === borderBottom ? t9 = $[24] : (t9 = _getArrayProp(borderBottom), $[23] = borderBottom, $[24] = t9);
|
|
939
|
+
let t10;
|
|
940
|
+
$[25] === borderLeft ? t10 = $[26] : (t10 = _getArrayProp(borderLeft), $[25] = borderLeft, $[26] = t10);
|
|
941
|
+
let t11;
|
|
942
|
+
$[27] === radius ? t11 = $[28] : (t11 = _getArrayProp(radius), $[27] = radius, $[28] = t11);
|
|
943
|
+
let t12;
|
|
944
|
+
$[29] === shadow ? t12 = $[30] : (t12 = _getArrayProp(shadow), $[29] = shadow, $[30] = t12);
|
|
945
|
+
let t13 = checkered ? "" : void 0, t14 = pressed ? "" : void 0, t15 = selected ? "" : void 0, t16;
|
|
946
|
+
$[31] !== as || $[32] !== checkered || $[33] !== focusRing || $[34] !== muted || $[35] !== ref || $[36] !== restProps || $[37] !== rootTheme.scheme || $[38] !== selected || $[39] !== t10 || $[40] !== t11 || $[41] !== t12 || $[42] !== t13 || $[43] !== t14 || $[44] !== t15 || $[45] !== t4 || $[46] !== t6 || $[47] !== t7 || $[48] !== t8 || $[49] !== t9 || $[50] !== tone ? (t16 = /* @__PURE__ */ jsx(StyledCard, {
|
|
947
|
+
"data-as": t4,
|
|
948
|
+
"data-scheme": t5,
|
|
949
|
+
"data-ui": "Card",
|
|
950
|
+
"data-tone": tone,
|
|
951
|
+
...restProps,
|
|
952
|
+
$border: t6,
|
|
953
|
+
$borderTop: t7,
|
|
954
|
+
$borderRight: t8,
|
|
955
|
+
$borderBottom: t9,
|
|
956
|
+
$borderLeft: t10,
|
|
957
|
+
$checkered: checkered,
|
|
958
|
+
$focusRing: focusRing,
|
|
959
|
+
$muted: muted,
|
|
1082
960
|
$radius: t11,
|
|
1083
961
|
$shadow: t12,
|
|
1084
962
|
$tone: tone,
|
|
@@ -1095,49 +973,7 @@ const StyledCard = /* @__PURE__ */ styled(Box).withConfig({
|
|
|
1095
973
|
tone,
|
|
1096
974
|
children: t16
|
|
1097
975
|
}), $[52] = scheme, $[53] = t16, $[54] = tone, $[55] = t17) : t17 = $[55], t17;
|
|
1098
|
-
});
|
|
1099
|
-
/**
|
|
1100
|
-
* @public
|
|
1101
|
-
*/
|
|
1102
|
-
function useClickOutsideEvent(listener, t0, boundaryElement) {
|
|
1103
|
-
let $ = c(9), elementsArg = t0 === void 0 ? _temp$8 : t0, t1;
|
|
1104
|
-
$[0] !== boundaryElement || $[1] !== elementsArg || $[2] !== listener ? (t1 = (evt) => {
|
|
1105
|
-
if (!listener) return;
|
|
1106
|
-
let target = evt.target;
|
|
1107
|
-
if (!(target instanceof Node)) return;
|
|
1108
|
-
let resolvedBoundaryElement = boundaryElement?.();
|
|
1109
|
-
if (resolvedBoundaryElement && !resolvedBoundaryElement.contains(target)) return;
|
|
1110
|
-
let elements = elementsArg().flat();
|
|
1111
|
-
for (let el of elements) if (el && (target === el || el.contains(target))) return;
|
|
1112
|
-
listener(evt);
|
|
1113
|
-
}, $[0] = boundaryElement, $[1] = elementsArg, $[2] = listener, $[3] = t1) : t1 = $[3];
|
|
1114
|
-
let onEvent = useEffectEvent(t1), hasListener = !!listener, t2;
|
|
1115
|
-
$[4] !== hasListener || $[5] !== onEvent ? (t2 = () => {
|
|
1116
|
-
if (!hasListener) return;
|
|
1117
|
-
let handleEvent = (evt_0) => onEvent(evt_0);
|
|
1118
|
-
return document.addEventListener("mousedown", handleEvent), () => {
|
|
1119
|
-
document.removeEventListener("mousedown", handleEvent);
|
|
1120
|
-
};
|
|
1121
|
-
}, $[4] = hasListener, $[5] = onEvent, $[6] = t2) : t2 = $[6];
|
|
1122
|
-
let t3;
|
|
1123
|
-
$[7] === hasListener ? t3 = $[8] : (t3 = [hasListener], $[7] = hasListener, $[8] = t3), useEffect(t2, t3), useDebugValue(listener ? "MouseDown On" : "MouseDown Off");
|
|
1124
|
-
}
|
|
1125
|
-
function _temp$8() {
|
|
1126
|
-
return EMPTY_ARRAY;
|
|
1127
|
-
}
|
|
1128
|
-
/**
|
|
1129
|
-
* @beta
|
|
1130
|
-
*/
|
|
1131
|
-
function useCustomValidity(ref, customValidity) {
|
|
1132
|
-
let $ = c(4), t0, t1;
|
|
1133
|
-
$[0] !== customValidity || $[1] !== ref ? (t0 = () => {
|
|
1134
|
-
ref.current?.setCustomValidity(customValidity || "");
|
|
1135
|
-
}, t1 = [customValidity, ref], $[0] = customValidity, $[1] = ref, $[2] = t0, $[3] = t1) : (t0 = $[2], t1 = $[3]), useEffect(t0, t1);
|
|
1136
|
-
}
|
|
1137
|
-
/**
|
|
1138
|
-
* @internal
|
|
1139
|
-
*/
|
|
1140
|
-
const _ResizeObserver = typeof document < "u" && typeof window < "u" && window.ResizeObserver ? window.ResizeObserver : ResizeObserver, _elementSizeObserver = _createElementSizeObserver();
|
|
976
|
+
}), _ResizeObserver = typeof document < "u" && typeof window < "u" && window.ResizeObserver ? window.ResizeObserver : ResizeObserver, _elementSizeObserver = _createElementSizeObserver();
|
|
1141
977
|
function _createElementRectValueListener() {
|
|
1142
978
|
return { subscribe(element, subscriber) {
|
|
1143
979
|
let resizeObserver = new _ResizeObserver(([entry]) => {
|
|
@@ -1180,44 +1016,8 @@ function useElementSize(element) {
|
|
|
1180
1016
|
if (element) return _elementSizeObserver.subscribe(element, setSize);
|
|
1181
1017
|
}, t1 = [element], $[0] = element, $[1] = t0, $[2] = t1), useEffect(t0, t1), size;
|
|
1182
1018
|
}
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
*
|
|
1186
|
-
* @param onKeyDown - The function to call when a keydown event is triggered.
|
|
1187
|
-
* @param options - The options to pass to the addEventListener function (example, capture: true)
|
|
1188
|
-
* @beta
|
|
1189
|
-
*/
|
|
1190
|
-
function useGlobalKeyDown(onKeyDown, options) {
|
|
1191
|
-
let $ = c(7), t0;
|
|
1192
|
-
$[0] === onKeyDown ? t0 = $[1] : (t0 = (event) => onKeyDown(event), $[0] = onKeyDown, $[1] = t0);
|
|
1193
|
-
let handleKeyDown = useEffectEvent(t0), t1;
|
|
1194
|
-
$[2] !== handleKeyDown || $[3] !== options ? (t1 = () => {
|
|
1195
|
-
let handler = (event_0) => handleKeyDown(event_0);
|
|
1196
|
-
return window.addEventListener("keydown", handler, options), () => window.removeEventListener("keydown", handler, options);
|
|
1197
|
-
}, $[2] = handleKeyDown, $[3] = options, $[4] = t1) : t1 = $[4];
|
|
1198
|
-
let t2;
|
|
1199
|
-
$[5] === options ? t2 = $[6] : (t2 = [options], $[5] = options, $[6] = t2), useEffect(t1, t2);
|
|
1200
|
-
}
|
|
1201
|
-
/**
|
|
1202
|
-
* Efficiently subscribes to `window.matchMedia` queries
|
|
1203
|
-
*
|
|
1204
|
-
* @param getServerSnapshot - Only called during server-side rendering, and hydration if using hydrateRoot. Required if the hook is called during SSR (https://react.dev/reference/react/useSyncExternalStore#adding-support-for-server-rendering)
|
|
1205
|
-
*
|
|
1206
|
-
* @public
|
|
1207
|
-
*/
|
|
1208
|
-
function useMatchMedia(mediaQueryString, getServerSnapshot) {
|
|
1209
|
-
let $ = c(4);
|
|
1210
|
-
useDebugValue(mediaQueryString);
|
|
1211
|
-
let t0;
|
|
1212
|
-
$[0] === mediaQueryString ? t0 = $[1] : (t0 = (onStoreChange) => {
|
|
1213
|
-
let media = window.matchMedia(mediaQueryString);
|
|
1214
|
-
return media.addEventListener("change", onStoreChange), () => media.removeEventListener("change", onStoreChange);
|
|
1215
|
-
}, $[0] = mediaQueryString, $[1] = t0);
|
|
1216
|
-
let t1;
|
|
1217
|
-
return $[2] === mediaQueryString ? t1 = $[3] : (t1 = () => window.matchMedia(mediaQueryString).matches, $[2] = mediaQueryString, $[3] = t1), useSyncExternalStore(t0, t1, getServerSnapshot);
|
|
1218
|
-
}
|
|
1219
|
-
function _getMediaQuery(media, index) {
|
|
1220
|
-
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)`;
|
|
1019
|
+
function _getMediaQuery(media, index) {
|
|
1020
|
+
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)`;
|
|
1221
1021
|
}
|
|
1222
1022
|
function _createMediaStore(media) {
|
|
1223
1023
|
let mediaLen = media.length, sizes, getSizes = () => {
|
|
@@ -1273,21 +1073,22 @@ function useMediaIndex() {
|
|
|
1273
1073
|
return useSyncExternalStore(store.subscribe, store.getSnapshot, getServerSnapshot);
|
|
1274
1074
|
}
|
|
1275
1075
|
/**
|
|
1276
|
-
*
|
|
1277
|
-
*
|
|
1278
|
-
* @param getServerSnapshot - Only called during server-side rendering, and hydration if using hydrateRoot. Since the server environment doesn't have access to the DOM, we can't determine the current value of the media query and we assume `(prefers-color-scheme: light)` since it's the most common scheme (https://react.dev/reference/react/useSyncExternalStore#adding-support-for-server-rendering)
|
|
1076
|
+
* Efficiently subscribes to `window.matchMedia` queries
|
|
1279
1077
|
*
|
|
1280
|
-
*
|
|
1281
|
-
* Chrome supports reading the `prefers-color-scheme` media query from a header if the server response: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Sec-CH-Prefers-Color-Scheme
|
|
1282
|
-
* @example https://gist.github.com/stipsan/13c0cccf8dfc34f4b44bb1b984baf7df
|
|
1078
|
+
* @param getServerSnapshot - Only called during server-side rendering, and hydration if using hydrateRoot. Required if the hook is called during SSR (https://react.dev/reference/react/useSyncExternalStore#adding-support-for-server-rendering)
|
|
1283
1079
|
*
|
|
1284
1080
|
* @public
|
|
1285
1081
|
*/
|
|
1286
|
-
function
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1082
|
+
function useMatchMedia(mediaQueryString, getServerSnapshot) {
|
|
1083
|
+
let $ = c(4);
|
|
1084
|
+
useDebugValue(mediaQueryString);
|
|
1085
|
+
let t0;
|
|
1086
|
+
$[0] === mediaQueryString ? t0 = $[1] : (t0 = (onStoreChange) => {
|
|
1087
|
+
let media = window.matchMedia(mediaQueryString);
|
|
1088
|
+
return media.addEventListener("change", onStoreChange), () => media.removeEventListener("change", onStoreChange);
|
|
1089
|
+
}, $[0] = mediaQueryString, $[1] = t0);
|
|
1090
|
+
let t1;
|
|
1091
|
+
return $[2] === mediaQueryString ? t1 = $[3] : (t1 = () => window.matchMedia(mediaQueryString).matches, $[2] = mediaQueryString, $[3] = t1), useSyncExternalStore(t0, t1, getServerSnapshot);
|
|
1291
1092
|
}
|
|
1292
1093
|
/**
|
|
1293
1094
|
* Returns true if motion should be reduced
|
|
@@ -1301,127 +1102,21 @@ function _temp$7() {
|
|
|
1301
1102
|
* @public
|
|
1302
1103
|
*/
|
|
1303
1104
|
function usePrefersReducedMotion(t0) {
|
|
1304
|
-
return useMatchMedia("(prefers-reduced-motion: reduce)", t0 === void 0 ? _temp$
|
|
1105
|
+
return useMatchMedia("(prefers-reduced-motion: reduce)", t0 === void 0 ? _temp$8 : t0);
|
|
1305
1106
|
}
|
|
1306
|
-
function _temp$
|
|
1107
|
+
function _temp$8() {
|
|
1307
1108
|
return !1;
|
|
1308
1109
|
}
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
let t3;
|
|
1320
|
-
$[18] === autoFlow ? t3 = $[19] : (t3 = _getArrayProp(autoFlow), $[18] = autoFlow, $[19] = t3);
|
|
1321
|
-
let t4 = gridTemplateColumns === void 0 ? columns : gridTemplateColumns, t5;
|
|
1322
|
-
$[20] === t4 ? t5 = $[21] : (t5 = _getArrayProp(t4), $[20] = t4, $[21] = t5);
|
|
1323
|
-
let t6;
|
|
1324
|
-
$[22] === gap ? t6 = $[23] : (t6 = _getArrayProp(gap), $[22] = gap, $[23] = t6);
|
|
1325
|
-
let t7;
|
|
1326
|
-
$[24] === gapX ? t7 = $[25] : (t7 = _getArrayProp(gapX), $[24] = gapX, $[25] = t7);
|
|
1327
|
-
let t8;
|
|
1328
|
-
$[26] === gapY ? t8 = $[27] : (t8 = _getArrayProp(gapY), $[26] = gapY, $[27] = t8);
|
|
1329
|
-
let t9 = gridTemplateRows === void 0 ? rows : gridTemplateRows, t10;
|
|
1330
|
-
$[28] === t9 ? t10 = $[29] : (t10 = _getArrayProp(t9), $[28] = t9, $[29] = t10);
|
|
1331
|
-
let t11;
|
|
1332
|
-
return $[30] !== as || $[31] !== children || $[32] !== ref || $[33] !== restProps || $[34] !== t0 || $[35] !== t1 || $[36] !== t10 || $[37] !== t2 || $[38] !== t3 || $[39] !== t5 || $[40] !== t6 || $[41] !== t7 || $[42] !== t8 ? (t11 = /* @__PURE__ */ jsx(StyledGrid, {
|
|
1333
|
-
"data-as": t0,
|
|
1334
|
-
"data-ui": "Grid",
|
|
1335
|
-
...restProps,
|
|
1336
|
-
$autoRows: t1,
|
|
1337
|
-
$autoCols: t2,
|
|
1338
|
-
$autoFlow: t3,
|
|
1339
|
-
$columns: t5,
|
|
1340
|
-
$gap: t6,
|
|
1341
|
-
$gapX: t7,
|
|
1342
|
-
$gapY: t8,
|
|
1343
|
-
$rows: t10,
|
|
1344
|
-
forwardedAs: as,
|
|
1345
|
-
ref,
|
|
1346
|
-
children
|
|
1347
|
-
}), $[30] = as, $[31] = children, $[32] = ref, $[33] = restProps, $[34] = t0, $[35] = t1, $[36] = t10, $[37] = t2, $[38] = t3, $[39] = t5, $[40] = t6, $[41] = t7, $[42] = t8, $[43] = t11) : t11 = $[43], t11;
|
|
1348
|
-
});
|
|
1349
|
-
function inlineBaseStyle() {
|
|
1350
|
-
return {
|
|
1351
|
-
lineHeight: "0",
|
|
1352
|
-
"&&:not([hidden])": { display: "block" },
|
|
1353
|
-
"& > div": {
|
|
1354
|
-
display: "inline-block",
|
|
1355
|
-
verticalAlign: "middle"
|
|
1356
|
-
}
|
|
1357
|
-
};
|
|
1358
|
-
}
|
|
1359
|
-
function inlineSpaceStyle(props) {
|
|
1360
|
-
let { media, space } = getTheme_v2(props.theme);
|
|
1361
|
-
return _responsive(media, props.$space, (spaceIndex) => {
|
|
1362
|
-
let _space = rem(spaceIndex === .5 ? space[1] / 2 : space[spaceIndex]);
|
|
1363
|
-
return {
|
|
1364
|
-
margin: `-${_space} 0 0 -${_space}`,
|
|
1365
|
-
"& > div": { padding: `${_space} 0 0 ${_space}` }
|
|
1366
|
-
};
|
|
1367
|
-
});
|
|
1368
|
-
}
|
|
1369
|
-
const StyledInline = /* @__PURE__ */ styled(Box).withConfig({
|
|
1370
|
-
displayName: "StyledInline",
|
|
1371
|
-
componentId: "sc-8j2qbm-0"
|
|
1372
|
-
})(inlineBaseStyle, inlineSpaceStyle), Inline = forwardRef(function Inline(props, ref) {
|
|
1373
|
-
let $ = c(16), as, childrenProp, deprecated_space, gap, restProps;
|
|
1374
|
-
$[0] === props ? (as = $[1], childrenProp = $[2], deprecated_space = $[3], gap = $[4], restProps = $[5]) : ({as, children: childrenProp, gap, space: deprecated_space, ...restProps} = props, $[0] = props, $[1] = as, $[2] = childrenProp, $[3] = deprecated_space, $[4] = gap, $[5] = restProps);
|
|
1375
|
-
let spacing = gap === void 0 ? deprecated_space : gap, t0;
|
|
1376
|
-
$[6] === childrenProp ? t0 = $[7] : (t0 = Children.map(childrenProp, _temp$5), $[6] = childrenProp, $[7] = t0);
|
|
1377
|
-
let children = t0, t1;
|
|
1378
|
-
$[8] === spacing ? t1 = $[9] : (t1 = _getArrayProp(spacing), $[8] = spacing, $[9] = t1);
|
|
1379
|
-
let t2 = ref, t3;
|
|
1380
|
-
return $[10] !== as || $[11] !== children || $[12] !== restProps || $[13] !== t1 || $[14] !== t2 ? (t3 = /* @__PURE__ */ jsx(StyledInline, {
|
|
1381
|
-
"data-ui": "Inline",
|
|
1382
|
-
...restProps,
|
|
1383
|
-
$space: t1,
|
|
1384
|
-
forwardedAs: as,
|
|
1385
|
-
ref: t2,
|
|
1386
|
-
children
|
|
1387
|
-
}), $[10] = as, $[11] = children, $[12] = restProps, $[13] = t1, $[14] = t2, $[15] = t3) : t3 = $[15], t3;
|
|
1388
|
-
});
|
|
1389
|
-
function _temp$5(child) {
|
|
1390
|
-
return child && /* @__PURE__ */ jsx("div", { children: child });
|
|
1391
|
-
}
|
|
1392
|
-
function kbdStyle() {
|
|
1393
|
-
return css`--card-bg-color:var(--card-kbd-bg-color);--card-border-color:var(--card-kbd-border-color);--card-fg-color:var(--card-kbd-fg-color);box-shadow:inset 0 0 0 1px var(--card-border-color);background:var(--card-bg-color);font:inherit;vertical-align:top;&:not([hidden]){display:inline-block;}`;
|
|
1394
|
-
}
|
|
1395
|
-
const StyledKBD = /* @__PURE__ */ styled.kbd.withConfig({
|
|
1396
|
-
displayName: "StyledKBD",
|
|
1397
|
-
componentId: "sc-pgjv2l-0"
|
|
1398
|
-
})(responsiveRadiusStyle, kbdStyle), KBD = forwardRef(function KBD(props, ref) {
|
|
1399
|
-
let $ = c(19), children, restProps, t0, t1, t2;
|
|
1400
|
-
$[0] === props ? (children = $[1], restProps = $[2], t0 = $[3], t1 = $[4], t2 = $[5]) : ({children, fontSize: t0, padding: t1, radius: t2, ...restProps} = props, $[0] = props, $[1] = children, $[2] = restProps, $[3] = t0, $[4] = t1, $[5] = t2);
|
|
1401
|
-
let fontSize = t0 === void 0 ? 0 : t0, padding = t1 === void 0 ? 1 : t1, radius = t2 === void 0 ? 2 : t2, t3;
|
|
1402
|
-
$[6] === radius ? t3 = $[7] : (t3 = _getArrayProp(radius), $[6] = radius, $[7] = t3);
|
|
1403
|
-
let t4;
|
|
1404
|
-
$[8] !== children || $[9] !== fontSize ? (t4 = /* @__PURE__ */ jsx(Text, {
|
|
1405
|
-
as: "span",
|
|
1406
|
-
size: fontSize,
|
|
1407
|
-
weight: "semibold",
|
|
1408
|
-
children
|
|
1409
|
-
}), $[8] = children, $[9] = fontSize, $[10] = t4) : t4 = $[10];
|
|
1410
|
-
let t5;
|
|
1411
|
-
$[11] !== padding || $[12] !== t4 ? (t5 = /* @__PURE__ */ jsx(Box, {
|
|
1412
|
-
as: "span",
|
|
1413
|
-
padding,
|
|
1414
|
-
children: t4
|
|
1415
|
-
}), $[11] = padding, $[12] = t4, $[13] = t5) : t5 = $[13];
|
|
1416
|
-
let t6;
|
|
1417
|
-
return $[14] !== ref || $[15] !== restProps || $[16] !== t3 || $[17] !== t5 ? (t6 = /* @__PURE__ */ jsx(StyledKBD, {
|
|
1418
|
-
"data-ui": "KBD",
|
|
1419
|
-
...restProps,
|
|
1420
|
-
$radius: t3,
|
|
1421
|
-
ref,
|
|
1422
|
-
children: t5
|
|
1423
|
-
}), $[14] = ref, $[15] = restProps, $[16] = t3, $[17] = t5, $[18] = t6) : t6 = $[18], t6;
|
|
1424
|
-
}), origin = {
|
|
1110
|
+
/**
|
|
1111
|
+
* Custom floating-ui middleware which calculates transform-origin X + Y offsets
|
|
1112
|
+
* based on the current floating rect's dimensions and shift offset.
|
|
1113
|
+
*
|
|
1114
|
+
* Scaling popovers with these transform-origin offsets will give the effect of
|
|
1115
|
+
* popvers slightly 'growing' from the origin/reference element.
|
|
1116
|
+
*
|
|
1117
|
+
* This middleware must be applied after both `@sanity/ui/size` and `shift` middlewares.
|
|
1118
|
+
*/
|
|
1119
|
+
const origin = {
|
|
1425
1120
|
name: "@sanity/ui/origin",
|
|
1426
1121
|
fn({ middlewareData, placement, rects }) {
|
|
1427
1122
|
let [side] = placement.split("-"), floatingWidth = rects.floating.width, floatingHeight = rects.floating.height, shiftX = middlewareData.shift?.x || 0, shiftY = middlewareData.shift?.y || 0;
|
|
@@ -1442,121 +1137,10 @@ const StyledKBD = /* @__PURE__ */ styled.kbd.withConfig({
|
|
|
1442
1137
|
function clamp(num, min, max) {
|
|
1443
1138
|
return Math.min(Math.max(num, min), max);
|
|
1444
1139
|
}
|
|
1445
|
-
function moveTowardsLength(movingPoint, targetPoint, amount) {
|
|
1446
|
-
let width = targetPoint.x - movingPoint.x, height = targetPoint.y - movingPoint.y, distance = Math.sqrt(width * width + height * height);
|
|
1447
|
-
return moveTowardsFractional(movingPoint, targetPoint, Math.min(1, amount / distance));
|
|
1448
|
-
}
|
|
1449
|
-
function moveTowardsFractional(movingPoint, targetPoint, fraction) {
|
|
1450
|
-
return {
|
|
1451
|
-
x: movingPoint.x + (targetPoint.x - movingPoint.x) * fraction,
|
|
1452
|
-
y: movingPoint.y + (targetPoint.y - movingPoint.y) * fraction
|
|
1453
|
-
};
|
|
1454
|
-
}
|
|
1455
|
-
function getRoundedCommands(points) {
|
|
1456
|
-
let len = points.length, cmds = [];
|
|
1457
|
-
for (let i = 0; i < len; i += 1) {
|
|
1458
|
-
let point = points[i], prevPoint = points[i - 1], nextPoint = points[i + 1];
|
|
1459
|
-
if (prevPoint && point.radius) {
|
|
1460
|
-
let curveStart = moveTowardsLength(point, prevPoint, point.radius), curveEnd = moveTowardsLength(point, nextPoint, point.radius), startControl = moveTowardsFractional(curveStart, point, .5), endControl = moveTowardsFractional(point, curveEnd, .5);
|
|
1461
|
-
cmds.push({
|
|
1462
|
-
type: "point",
|
|
1463
|
-
...curveStart
|
|
1464
|
-
}), cmds.push({
|
|
1465
|
-
type: "curve",
|
|
1466
|
-
curveEnd,
|
|
1467
|
-
startControl,
|
|
1468
|
-
endControl
|
|
1469
|
-
});
|
|
1470
|
-
} else cmds.push({
|
|
1471
|
-
type: "point",
|
|
1472
|
-
...point
|
|
1473
|
-
});
|
|
1474
|
-
}
|
|
1475
|
-
return cmds;
|
|
1476
|
-
}
|
|
1477
|
-
function compileCommands(cmds) {
|
|
1478
|
-
return cmds.map((n, idx) => n.type === "point" ? `${idx === 0 ? "M" : "L"} ${n.x} ${n.y}` : n.type === "curve" ? `C ${n.startControl.x} ${n.startControl.y} ${n.endControl.x} ${n.endControl.y} ${n.curveEnd.x} ${n.curveEnd.y}` : "").join(" ");
|
|
1479
|
-
}
|
|
1480
|
-
const StyledArrow = /* @__PURE__ */ styled.div.withConfig({
|
|
1481
|
-
displayName: "StyledArrow",
|
|
1482
|
-
componentId: "sc-1ev21f-0"
|
|
1483
|
-
})(({ $w: w }) => css`position:absolute;width:${w}px;height:${w}px;:empty + &{display:none;}& > svg{display:block;line-height:0;transform-origin:${w / 2}px ${w / 2}px;}[data-placement^='top'] > &{bottom:-${w}px;& > svg{transform:rotate(0);}}[data-placement^='right'] > &{left:-${w}px;& > svg{transform:rotate(90deg);}}[data-placement^='left'] > &{right:-${w}px;& > svg{transform:rotate(-90deg);}}[data-placement^='bottom'] > &{top:-${w}px;& > svg{transform:rotate(180deg);}}`), StrokePath = styled.path.withConfig({
|
|
1484
|
-
displayName: "StrokePath",
|
|
1485
|
-
componentId: "sc-1ev21f-1"
|
|
1486
|
-
})`stroke:var(--card-shadow-outline-color);`, ShapePath = styled.path.withConfig({
|
|
1487
|
-
displayName: "ShapePath",
|
|
1488
|
-
componentId: "sc-1ev21f-2"
|
|
1489
|
-
})`fill:var(--card-bg-color);`, Arrow = forwardRef(function Arrow(props, ref) {
|
|
1490
|
-
let $ = c(29), h, restProps, t0, w;
|
|
1491
|
-
$[0] === props ? (h = $[1], restProps = $[2], t0 = $[3], w = $[4]) : ({width: w, height: h, radius: t0, ...restProps} = props, $[0] = props, $[1] = h, $[2] = restProps, $[3] = t0, $[4] = w);
|
|
1492
|
-
let radius = t0 === void 0 ? 0 : t0, { card } = useTheme_v2(), strokeWidth = card.shadow.outline, center = w / 2, t1;
|
|
1493
|
-
$[5] !== center || $[6] !== h || $[7] !== radius || $[8] !== w ? (t1 = compileCommands(getRoundedCommands([
|
|
1494
|
-
{
|
|
1495
|
-
x: 0,
|
|
1496
|
-
y: 0
|
|
1497
|
-
},
|
|
1498
|
-
{
|
|
1499
|
-
x: radius,
|
|
1500
|
-
y: 0,
|
|
1501
|
-
radius
|
|
1502
|
-
},
|
|
1503
|
-
{
|
|
1504
|
-
x: center,
|
|
1505
|
-
y: h - 1,
|
|
1506
|
-
radius
|
|
1507
|
-
},
|
|
1508
|
-
{
|
|
1509
|
-
x: w - radius,
|
|
1510
|
-
y: 0,
|
|
1511
|
-
radius
|
|
1512
|
-
},
|
|
1513
|
-
{
|
|
1514
|
-
x: w,
|
|
1515
|
-
y: 0
|
|
1516
|
-
}
|
|
1517
|
-
])), $[5] = center, $[6] = h, $[7] = radius, $[8] = w, $[9] = t1) : t1 = $[9];
|
|
1518
|
-
let path = t1, strokePath = `${path}`, fillPath = `${path} M ${w} -1 M 0 -1 Z`, t2 = `0 0 ${w} ${w}`, t3;
|
|
1519
|
-
$[10] !== strokeWidth || $[11] !== w ? (t3 = /* @__PURE__ */ jsx("mask", {
|
|
1520
|
-
id: "stroke-mask",
|
|
1521
|
-
children: /* @__PURE__ */ jsx("rect", {
|
|
1522
|
-
x: 0,
|
|
1523
|
-
y: strokeWidth,
|
|
1524
|
-
width: w,
|
|
1525
|
-
height: w,
|
|
1526
|
-
fill: "white"
|
|
1527
|
-
})
|
|
1528
|
-
}), $[10] = strokeWidth, $[11] = w, $[12] = t3) : t3 = $[12];
|
|
1529
|
-
let t4 = strokeWidth * 2, t5;
|
|
1530
|
-
$[13] !== strokePath || $[14] !== t4 ? (t5 = /* @__PURE__ */ jsx(StrokePath, {
|
|
1531
|
-
d: strokePath,
|
|
1532
|
-
mask: "url(#stroke-mask)",
|
|
1533
|
-
strokeWidth: t4
|
|
1534
|
-
}), $[13] = strokePath, $[14] = t4, $[15] = t5) : t5 = $[15];
|
|
1535
|
-
let t6;
|
|
1536
|
-
$[16] === fillPath ? t6 = $[17] : (t6 = /* @__PURE__ */ jsx(ShapePath, { d: fillPath }), $[16] = fillPath, $[17] = t6);
|
|
1537
|
-
let t7;
|
|
1538
|
-
$[18] !== t2 || $[19] !== t3 || $[20] !== t5 || $[21] !== t6 || $[22] !== w ? (t7 = /* @__PURE__ */ jsxs("svg", {
|
|
1539
|
-
width: w,
|
|
1540
|
-
height: w,
|
|
1541
|
-
viewBox: t2,
|
|
1542
|
-
children: [
|
|
1543
|
-
t3,
|
|
1544
|
-
t5,
|
|
1545
|
-
t6
|
|
1546
|
-
]
|
|
1547
|
-
}), $[18] = t2, $[19] = t3, $[20] = t5, $[21] = t6, $[22] = w, $[23] = t7) : t7 = $[23];
|
|
1548
|
-
let t8;
|
|
1549
|
-
return $[24] !== ref || $[25] !== restProps || $[26] !== t7 || $[27] !== w ? (t8 = /* @__PURE__ */ jsx(StyledArrow, {
|
|
1550
|
-
...restProps,
|
|
1551
|
-
$w: w,
|
|
1552
|
-
ref,
|
|
1553
|
-
children: t7
|
|
1554
|
-
}), $[24] = ref, $[25] = restProps, $[26] = t7, $[27] = w, $[28] = t8) : t8 = $[28], t8;
|
|
1555
|
-
}), BoundaryElementContext = createGlobalScopedContext("@sanity/ui/context/boundaryElement", null);
|
|
1556
1140
|
function isRecord(value) {
|
|
1557
1141
|
return !!(value && typeof value == "object" && !Array.isArray(value));
|
|
1558
1142
|
}
|
|
1559
|
-
const DEFAULT_VALUE = {
|
|
1143
|
+
const BoundaryElementContext = createGlobalScopedContext("@sanity/ui/context/boundaryElement", null), DEFAULT_VALUE = {
|
|
1560
1144
|
version: 0,
|
|
1561
1145
|
element: null
|
|
1562
1146
|
};
|
|
@@ -1568,6 +1152,10 @@ function useBoundaryElement() {
|
|
|
1568
1152
|
if (value && (!isRecord(value) || value.version !== 0)) throw Error("useBoundaryElement(): the context value is not compatible");
|
|
1569
1153
|
return value || DEFAULT_VALUE;
|
|
1570
1154
|
}
|
|
1155
|
+
function getElementRef(element) {
|
|
1156
|
+
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get, mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
1157
|
+
return mayWarn ? element.ref : (getter = Object.getOwnPropertyDescriptor(element, "ref")?.get, mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning, mayWarn ? element.props.ref : element.props.ref || element.ref);
|
|
1158
|
+
}
|
|
1571
1159
|
function getLayerContext(contextValue) {
|
|
1572
1160
|
if (!isRecord(contextValue) || contextValue.version !== 0) throw Error("the context value is not compatible");
|
|
1573
1161
|
if (!contextValue) throw Error("components using `useLayer()` should be wrapped in a <LayerProvider>.");
|
|
@@ -1588,7 +1176,7 @@ function LayerProvider(props) {
|
|
|
1588
1176
|
let [, setChildLayers] = useState(t3), [size, setSize] = useState(0), isTopLayer = size === 0, t4;
|
|
1589
1177
|
$[5] !== parentRegisterChild || $[6] !== setChildLayers ? (t4 = (childLevel) => {
|
|
1590
1178
|
let parentDispose = parentRegisterChild?.(childLevel);
|
|
1591
|
-
return childLevel === void 0 ? setSize(_temp$
|
|
1179
|
+
return childLevel === void 0 ? setSize(_temp$7) : setChildLayers((state) => {
|
|
1592
1180
|
let prevLen = state[childLevel] ?? 0, nextState = {
|
|
1593
1181
|
...state,
|
|
1594
1182
|
[childLevel]: prevLen + 1
|
|
@@ -1621,7 +1209,7 @@ function LayerProvider(props) {
|
|
|
1621
1209
|
function _temp2$2(v_0) {
|
|
1622
1210
|
return v_0 - 1;
|
|
1623
1211
|
}
|
|
1624
|
-
function _temp$
|
|
1212
|
+
function _temp$7(v) {
|
|
1625
1213
|
return v + 1;
|
|
1626
1214
|
}
|
|
1627
1215
|
/**
|
|
@@ -1638,53 +1226,7 @@ function useLayer() {
|
|
|
1638
1226
|
throw err instanceof Error ? Error(`useLayer(): ${err.message}`) : Error(`useLayer(): ${err}`);
|
|
1639
1227
|
}
|
|
1640
1228
|
}
|
|
1641
|
-
const
|
|
1642
|
-
displayName: "StyledLayer",
|
|
1643
|
-
componentId: "sc-100e5i-0"
|
|
1644
|
-
})({ position: "relative" }), LayerChildren = forwardRef(function LayerChildren(props, forwardedRef) {
|
|
1645
|
-
let $ = c(22), children, onActivate, onFocus, restProps, t0;
|
|
1646
|
-
$[0] === props ? (children = $[1], onActivate = $[2], onFocus = $[3], restProps = $[4], t0 = $[5]) : ({children, onActivate, onFocus, style: t0, ...restProps} = props, $[0] = props, $[1] = children, $[2] = onActivate, $[3] = onFocus, $[4] = restProps, $[5] = t0);
|
|
1647
|
-
let style = t0 === void 0 ? EMPTY_RECORD : t0, { zIndex, isTopLayer } = useLayer(), lastFocusedRef = useRef(null), ref = useRef(null), isTopLayerRef = useRef(isTopLayer), t1;
|
|
1648
|
-
$[6] === Symbol.for("react.memo_cache_sentinel") ? (t1 = () => ref.current, $[6] = t1) : t1 = $[6], useImperativeHandle(forwardedRef, t1);
|
|
1649
|
-
let t2, t3;
|
|
1650
|
-
$[7] !== isTopLayer || $[8] !== onActivate ? (t2 = () => {
|
|
1651
|
-
isTopLayerRef.current !== isTopLayer && isTopLayer && onActivate?.({ activeElement: lastFocusedRef.current }), isTopLayerRef.current = isTopLayer;
|
|
1652
|
-
}, t3 = [isTopLayer, onActivate], $[7] = isTopLayer, $[8] = onActivate, $[9] = t2, $[10] = t3) : (t2 = $[9], t3 = $[10]), useEffect(t2, t3);
|
|
1653
|
-
let t4;
|
|
1654
|
-
$[11] !== isTopLayer || $[12] !== onFocus ? (t4 = (event) => {
|
|
1655
|
-
onFocus?.(event);
|
|
1656
|
-
let rootElement = ref.current, target = document.activeElement;
|
|
1657
|
-
!isTopLayer || !rootElement || !target || isHTMLElement(target) && containsOrEqualsElement(rootElement, target) && (lastFocusedRef.current = target);
|
|
1658
|
-
}, $[11] = isTopLayer, $[12] = onFocus, $[13] = t4) : t4 = $[13];
|
|
1659
|
-
let handleFocus = t4, t5;
|
|
1660
|
-
$[14] !== style || $[15] !== zIndex ? (t5 = {
|
|
1661
|
-
...style,
|
|
1662
|
-
zIndex
|
|
1663
|
-
}, $[14] = style, $[15] = zIndex, $[16] = t5) : t5 = $[16];
|
|
1664
|
-
let t6;
|
|
1665
|
-
return $[17] !== children || $[18] !== handleFocus || $[19] !== restProps || $[20] !== t5 ? (t6 = /* @__PURE__ */ jsx(StyledLayer, {
|
|
1666
|
-
...restProps,
|
|
1667
|
-
"data-ui": "Layer",
|
|
1668
|
-
onFocus: handleFocus,
|
|
1669
|
-
ref,
|
|
1670
|
-
style: t5,
|
|
1671
|
-
children
|
|
1672
|
-
}), $[17] = children, $[18] = handleFocus, $[19] = restProps, $[20] = t5, $[21] = t6) : t6 = $[21], t6;
|
|
1673
|
-
}), Layer = forwardRef(function Layer(props, ref) {
|
|
1674
|
-
let $ = c(11), children, restProps, t0;
|
|
1675
|
-
$[0] === props ? (children = $[1], restProps = $[2], t0 = $[3]) : ({children, zOffset: t0, ...restProps} = props, $[0] = props, $[1] = children, $[2] = restProps, $[3] = t0);
|
|
1676
|
-
let zOffset = t0 === void 0 ? 1 : t0, t1;
|
|
1677
|
-
$[4] !== children || $[5] !== ref || $[6] !== restProps ? (t1 = /* @__PURE__ */ jsx(LayerChildren, {
|
|
1678
|
-
...restProps,
|
|
1679
|
-
ref,
|
|
1680
|
-
children
|
|
1681
|
-
}), $[4] = children, $[5] = ref, $[6] = restProps, $[7] = t1) : t1 = $[7];
|
|
1682
|
-
let t2;
|
|
1683
|
-
return $[8] !== t1 || $[9] !== zOffset ? (t2 = /* @__PURE__ */ jsx(LayerProvider, {
|
|
1684
|
-
zOffset,
|
|
1685
|
-
children: t1
|
|
1686
|
-
}), $[8] = t1, $[9] = zOffset, $[10] = t2) : t2 = $[10], t2;
|
|
1687
|
-
}), key = "@sanity/ui/context/portal", elementKey = Symbol.for(`${key}/element`);
|
|
1229
|
+
const key = "@sanity/ui/context/portal", elementKey = Symbol.for(`${key}/element`);
|
|
1688
1230
|
globalScope[elementKey] = null;
|
|
1689
1231
|
const PortalContext = createGlobalScopedContext(key, {
|
|
1690
1232
|
version: 0,
|
|
@@ -1711,34 +1253,6 @@ function Portal(props) {
|
|
|
1711
1253
|
let t0;
|
|
1712
1254
|
return $[0] !== children || $[1] !== portalElement ? (t0 = createPortal(children, portalElement), $[0] = children, $[1] = portalElement, $[2] = t0) : t0 = $[2], t0;
|
|
1713
1255
|
}
|
|
1714
|
-
/**
|
|
1715
|
-
* @public
|
|
1716
|
-
*/
|
|
1717
|
-
function PortalProvider(props) {
|
|
1718
|
-
let $ = c(7), { boundaryElement, children, element, __unstable_elements: elements } = props, fallbackElement = useSyncExternalStore(emptySubscribe, _temp$3, _temp2$1), t0 = boundaryElement || null, t1 = element || fallbackElement, t2;
|
|
1719
|
-
$[0] !== elements || $[1] !== t0 || $[2] !== t1 ? (t2 = {
|
|
1720
|
-
version: 0,
|
|
1721
|
-
boundaryElement: t0,
|
|
1722
|
-
element: t1,
|
|
1723
|
-
elements
|
|
1724
|
-
}, $[0] = elements, $[1] = t0, $[2] = t1, $[3] = t2) : t2 = $[3];
|
|
1725
|
-
let value = t2, t3;
|
|
1726
|
-
return $[4] !== children || $[5] !== value ? (t3 = /* @__PURE__ */ jsx(PortalContext.Provider, {
|
|
1727
|
-
value,
|
|
1728
|
-
children
|
|
1729
|
-
}), $[4] = children, $[5] = value, $[6] = t3) : t3 = $[6], t3;
|
|
1730
|
-
}
|
|
1731
|
-
function _temp2$1() {
|
|
1732
|
-
return null;
|
|
1733
|
-
}
|
|
1734
|
-
function _temp$3() {
|
|
1735
|
-
return document.body;
|
|
1736
|
-
}
|
|
1737
|
-
const emptySubscribe = () => () => {};
|
|
1738
|
-
function getElementRef(element) {
|
|
1739
|
-
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get, mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
1740
|
-
return mayWarn ? element.ref : (getter = Object.getOwnPropertyDescriptor(element, "ref")?.get, mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning, mayWarn ? element.props.ref : element.props.ref || element.ref);
|
|
1741
|
-
}
|
|
1742
1256
|
const DEFAULT_POPOVER_MARGINS = [
|
|
1743
1257
|
0,
|
|
1744
1258
|
0,
|
|
@@ -1834,12 +1348,122 @@ function calcMaxWidth(params) {
|
|
|
1834
1348
|
let { boundaryWidth, currentWidth } = params;
|
|
1835
1349
|
if (currentWidth !== void 0 || boundaryWidth !== void 0) return Math.min(currentWidth ?? Infinity, (boundaryWidth || Infinity) - 8);
|
|
1836
1350
|
}
|
|
1837
|
-
|
|
1351
|
+
function moveTowardsLength(movingPoint, targetPoint, amount) {
|
|
1352
|
+
let width = targetPoint.x - movingPoint.x, height = targetPoint.y - movingPoint.y, distance = Math.sqrt(width * width + height * height);
|
|
1353
|
+
return moveTowardsFractional(movingPoint, targetPoint, Math.min(1, amount / distance));
|
|
1354
|
+
}
|
|
1355
|
+
function moveTowardsFractional(movingPoint, targetPoint, fraction) {
|
|
1356
|
+
return {
|
|
1357
|
+
x: movingPoint.x + (targetPoint.x - movingPoint.x) * fraction,
|
|
1358
|
+
y: movingPoint.y + (targetPoint.y - movingPoint.y) * fraction
|
|
1359
|
+
};
|
|
1360
|
+
}
|
|
1361
|
+
function getRoundedCommands(points) {
|
|
1362
|
+
let len = points.length, cmds = [];
|
|
1363
|
+
for (let i = 0; i < len; i += 1) {
|
|
1364
|
+
let point = points[i], prevPoint = points[i - 1], nextPoint = points[i + 1];
|
|
1365
|
+
if (prevPoint && point.radius) {
|
|
1366
|
+
let curveStart = moveTowardsLength(point, prevPoint, point.radius), curveEnd = moveTowardsLength(point, nextPoint, point.radius), startControl = moveTowardsFractional(curveStart, point, .5), endControl = moveTowardsFractional(point, curveEnd, .5);
|
|
1367
|
+
cmds.push({
|
|
1368
|
+
type: "point",
|
|
1369
|
+
...curveStart
|
|
1370
|
+
}), cmds.push({
|
|
1371
|
+
type: "curve",
|
|
1372
|
+
curveEnd,
|
|
1373
|
+
startControl,
|
|
1374
|
+
endControl
|
|
1375
|
+
});
|
|
1376
|
+
} else cmds.push({
|
|
1377
|
+
type: "point",
|
|
1378
|
+
...point
|
|
1379
|
+
});
|
|
1380
|
+
}
|
|
1381
|
+
return cmds;
|
|
1382
|
+
}
|
|
1383
|
+
function compileCommands(cmds) {
|
|
1384
|
+
return cmds.map((n, idx) => n.type === "point" ? `${idx === 0 ? "M" : "L"} ${n.x} ${n.y}` : n.type === "curve" ? `C ${n.startControl.x} ${n.startControl.y} ${n.endControl.x} ${n.endControl.y} ${n.curveEnd.x} ${n.curveEnd.y}` : "").join(" ");
|
|
1385
|
+
}
|
|
1386
|
+
const StyledArrow = /* @__PURE__ */ styled.div.withConfig({
|
|
1387
|
+
displayName: "StyledArrow",
|
|
1388
|
+
componentId: "sc-ivw6of-0"
|
|
1389
|
+
})(({ $w: w }) => css`position:absolute;width:${w}px;height:${w}px;:empty + &{display:none;}& > svg{display:block;line-height:0;transform-origin:${w / 2}px ${w / 2}px;}[data-placement^='top'] > &{bottom:-${w}px;& > svg{transform:rotate(0);}}[data-placement^='right'] > &{left:-${w}px;& > svg{transform:rotate(90deg);}}[data-placement^='left'] > &{right:-${w}px;& > svg{transform:rotate(-90deg);}}[data-placement^='bottom'] > &{top:-${w}px;& > svg{transform:rotate(180deg);}}`), StrokePath = styled.path.withConfig({
|
|
1390
|
+
displayName: "StrokePath",
|
|
1391
|
+
componentId: "sc-ivw6of-1"
|
|
1392
|
+
})`stroke:var(--card-shadow-outline-color);`, ShapePath = styled.path.withConfig({
|
|
1393
|
+
displayName: "ShapePath",
|
|
1394
|
+
componentId: "sc-ivw6of-2"
|
|
1395
|
+
})`fill:var(--card-bg-color);`, Arrow = forwardRef(function Arrow(props, ref) {
|
|
1396
|
+
let $ = c(29), h, restProps, t0, w;
|
|
1397
|
+
$[0] === props ? (h = $[1], restProps = $[2], t0 = $[3], w = $[4]) : ({width: w, height: h, radius: t0, ...restProps} = props, $[0] = props, $[1] = h, $[2] = restProps, $[3] = t0, $[4] = w);
|
|
1398
|
+
let radius = t0 === void 0 ? 0 : t0, { card } = useTheme_v2(), strokeWidth = card.shadow.outline, center = w / 2, t1;
|
|
1399
|
+
$[5] !== center || $[6] !== h || $[7] !== radius || $[8] !== w ? (t1 = compileCommands(getRoundedCommands([
|
|
1400
|
+
{
|
|
1401
|
+
x: 0,
|
|
1402
|
+
y: 0
|
|
1403
|
+
},
|
|
1404
|
+
{
|
|
1405
|
+
x: radius,
|
|
1406
|
+
y: 0,
|
|
1407
|
+
radius
|
|
1408
|
+
},
|
|
1409
|
+
{
|
|
1410
|
+
x: center,
|
|
1411
|
+
y: h - 1,
|
|
1412
|
+
radius
|
|
1413
|
+
},
|
|
1414
|
+
{
|
|
1415
|
+
x: w - radius,
|
|
1416
|
+
y: 0,
|
|
1417
|
+
radius
|
|
1418
|
+
},
|
|
1419
|
+
{
|
|
1420
|
+
x: w,
|
|
1421
|
+
y: 0
|
|
1422
|
+
}
|
|
1423
|
+
])), $[5] = center, $[6] = h, $[7] = radius, $[8] = w, $[9] = t1) : t1 = $[9];
|
|
1424
|
+
let path = t1, strokePath = `${path}`, fillPath = `${path} M ${w} -1 M 0 -1 Z`, t2 = `0 0 ${w} ${w}`, t3;
|
|
1425
|
+
$[10] !== strokeWidth || $[11] !== w ? (t3 = /* @__PURE__ */ jsx("mask", {
|
|
1426
|
+
id: "stroke-mask",
|
|
1427
|
+
children: /* @__PURE__ */ jsx("rect", {
|
|
1428
|
+
x: 0,
|
|
1429
|
+
y: strokeWidth,
|
|
1430
|
+
width: w,
|
|
1431
|
+
height: w,
|
|
1432
|
+
fill: "white"
|
|
1433
|
+
})
|
|
1434
|
+
}), $[10] = strokeWidth, $[11] = w, $[12] = t3) : t3 = $[12];
|
|
1435
|
+
let t4 = strokeWidth * 2, t5;
|
|
1436
|
+
$[13] !== strokePath || $[14] !== t4 ? (t5 = /* @__PURE__ */ jsx(StrokePath, {
|
|
1437
|
+
d: strokePath,
|
|
1438
|
+
mask: "url(#stroke-mask)",
|
|
1439
|
+
strokeWidth: t4
|
|
1440
|
+
}), $[13] = strokePath, $[14] = t4, $[15] = t5) : t5 = $[15];
|
|
1441
|
+
let t6;
|
|
1442
|
+
$[16] === fillPath ? t6 = $[17] : (t6 = /* @__PURE__ */ jsx(ShapePath, { d: fillPath }), $[16] = fillPath, $[17] = t6);
|
|
1443
|
+
let t7;
|
|
1444
|
+
$[18] !== t2 || $[19] !== t3 || $[20] !== t5 || $[21] !== t6 || $[22] !== w ? (t7 = /* @__PURE__ */ jsxs("svg", {
|
|
1445
|
+
width: w,
|
|
1446
|
+
height: w,
|
|
1447
|
+
viewBox: t2,
|
|
1448
|
+
children: [
|
|
1449
|
+
t3,
|
|
1450
|
+
t5,
|
|
1451
|
+
t6
|
|
1452
|
+
]
|
|
1453
|
+
}), $[18] = t2, $[19] = t3, $[20] = t5, $[21] = t6, $[22] = w, $[23] = t7) : t7 = $[23];
|
|
1454
|
+
let t8;
|
|
1455
|
+
return $[24] !== ref || $[25] !== restProps || $[26] !== t7 || $[27] !== w ? (t8 = /* @__PURE__ */ jsx(StyledArrow, {
|
|
1456
|
+
...restProps,
|
|
1457
|
+
$w: w,
|
|
1458
|
+
ref,
|
|
1459
|
+
children: t7
|
|
1460
|
+
}), $[24] = ref, $[25] = restProps, $[26] = t7, $[27] = w, $[28] = t8) : t8 = $[28], t8;
|
|
1461
|
+
}), MotionCard$1 = styled(motion.create(Card)).withConfig({
|
|
1838
1462
|
displayName: "MotionCard",
|
|
1839
|
-
componentId: "sc-
|
|
1463
|
+
componentId: "sc-tq6s8o-0"
|
|
1840
1464
|
})`&:not([hidden]){display:flex;}flex-direction:column;width:max-content;min-width:min-content;will-change:transform;`, MotionFlex = styled(motion.create(Flex)).withConfig({
|
|
1841
1465
|
displayName: "MotionFlex",
|
|
1842
|
-
componentId: "sc-
|
|
1466
|
+
componentId: "sc-tq6s8o-1"
|
|
1843
1467
|
})`will-change:opacity;`, PopoverCard = forwardRef(function PopoverCard(props, ref) {
|
|
1844
1468
|
let $ = c(66), animate, arrow, arrowRef, arrowX, arrowY, children, marginsProp, originX, originY, overflow, padding, placement, radius, restProps, scheme, shadow, strategy, style, tone, width, xProp, yProp;
|
|
1845
1469
|
$[0] === props ? (animate = $[1], arrow = $[2], arrowRef = $[3], arrowX = $[4], arrowY = $[5], children = $[6], marginsProp = $[7], originX = $[8], originY = $[9], overflow = $[10], padding = $[11], placement = $[12], radius = $[13], restProps = $[14], scheme = $[15], shadow = $[16], strategy = $[17], style = $[18], tone = $[19], width = $[20], xProp = $[21], yProp = $[22]) : ({__unstable_margins: marginsProp, animate, arrow, arrowRef, arrowX, arrowY, children, padding, placement, originX, originY, overflow, radius, scheme, shadow, strategy, style, tone, width, x: xProp, y: yProp, ...restProps} = props, $[0] = props, $[1] = animate, $[2] = arrow, $[3] = arrowRef, $[4] = arrowX, $[5] = arrowY, $[6] = children, $[7] = marginsProp, $[8] = originX, $[9] = originY, $[10] = overflow, $[11] = padding, $[12] = placement, $[13] = radius, $[14] = restProps, $[15] = scheme, $[16] = shadow, $[17] = strategy, $[18] = style, $[19] = tone, $[20] = width, $[21] = xProp, $[22] = yProp);
|
|
@@ -2138,7 +1762,7 @@ function responsiveStackSpaceStyle(props) {
|
|
|
2138
1762
|
}
|
|
2139
1763
|
const StyledStack = /* @__PURE__ */ styled(Box).withConfig({
|
|
2140
1764
|
displayName: "StyledStack",
|
|
2141
|
-
componentId: "sc-
|
|
1765
|
+
componentId: "sc-ux0lrj-0"
|
|
2142
1766
|
})(stackBaseStyle, responsiveStackSpaceStyle), Stack = forwardRef(function Stack(props, ref) {
|
|
2143
1767
|
let $ = c(13), as, deprecated_space, gap, restProps;
|
|
2144
1768
|
$[0] === props ? (as = $[1], deprecated_space = $[2], gap = $[3], restProps = $[4]) : ({as, gap, space: deprecated_space, ...restProps} = props, $[0] = props, $[1] = as, $[2] = deprecated_space, $[3] = gap, $[4] = restProps);
|
|
@@ -2153,36 +1777,111 @@ const StyledStack = /* @__PURE__ */ styled(Box).withConfig({
|
|
|
2153
1777
|
forwardedAs: as,
|
|
2154
1778
|
ref
|
|
2155
1779
|
}), $[7] = as, $[8] = ref, $[9] = restProps, $[10] = t0, $[11] = t1, $[12] = t2) : t2 = $[12], t2;
|
|
2156
|
-
})
|
|
1780
|
+
});
|
|
1781
|
+
/**
|
|
1782
|
+
* @beta
|
|
1783
|
+
*/
|
|
1784
|
+
function useCustomValidity(ref, customValidity) {
|
|
1785
|
+
let $ = c(4), t0, t1;
|
|
1786
|
+
$[0] !== customValidity || $[1] !== ref ? (t0 = () => {
|
|
1787
|
+
ref.current?.setCustomValidity(customValidity || "");
|
|
1788
|
+
}, t1 = [customValidity, ref], $[0] = customValidity, $[1] = ref, $[2] = t0, $[3] = t1) : (t0 = $[2], t1 = $[3]), useEffect(t0, t1);
|
|
1789
|
+
}
|
|
1790
|
+
function responsiveInputPaddingStyle(props) {
|
|
1791
|
+
let { $fontSize, $iconLeft, $iconRight, $padding, $space } = props, { font, media, space } = getTheme_v2(props.theme), len = Math.max($padding.length, $space.length, $fontSize.length), _padding = [], _space = [], _fontSize = [];
|
|
1792
|
+
for (let i = 0; i < len; i += 1) _fontSize[i] = $fontSize[i] === void 0 ? _fontSize[i - 1] : $fontSize[i], _padding[i] = $padding[i] === void 0 ? _padding[i - 1] : $padding[i], _space[i] = $space[i] === void 0 ? _space[i - 1] : $space[i];
|
|
1793
|
+
return _responsive(media, _padding, (_, i) => {
|
|
1794
|
+
let size = font.text.sizes[_fontSize[i]] || font.text.sizes[2], emSize = size.lineHeight - size.ascenderHeight - size.descenderHeight, p = space[_padding[i]], s = space[_space[i]], styles = {
|
|
1795
|
+
paddingTop: rem(p - size.ascenderHeight),
|
|
1796
|
+
paddingRight: rem(p),
|
|
1797
|
+
paddingBottom: rem(p - size.descenderHeight),
|
|
1798
|
+
paddingLeft: rem(p)
|
|
1799
|
+
};
|
|
1800
|
+
return $iconRight && (styles.paddingRight = rem(p + emSize + s)), $iconLeft && (styles.paddingLeft = rem(p + emSize + s)), styles;
|
|
1801
|
+
});
|
|
1802
|
+
}
|
|
1803
|
+
function responsiveInputPaddingIconRightStyle(props) {
|
|
1804
|
+
return responsiveInputPaddingStyle({
|
|
1805
|
+
...props,
|
|
1806
|
+
$iconRight: !0
|
|
1807
|
+
});
|
|
1808
|
+
}
|
|
1809
|
+
const ROOT_STYLE = css`&:not([hidden]){display:flex;}align-items:center;`;
|
|
1810
|
+
function textInputRootStyle() {
|
|
1811
|
+
return ROOT_STYLE;
|
|
1812
|
+
}
|
|
1813
|
+
function textInputBaseStyle(props) {
|
|
1814
|
+
let { $scheme, $tone, $weight } = props, { color, font } = getTheme_v2(props.theme);
|
|
1815
|
+
return css`appearance:none;background:none;border:0;border-radius:0;outline:none;width:100%;box-sizing:border-box;font-family:${font.text.family};font-weight:${$weight && font.text.weights[$weight] || font.text.weights.regular};margin:0;position:relative;z-index:1;display:block;&:-webkit-autofill,&:-webkit-autofill:hover,&:-webkit-autofill:focus,&:-webkit-autofill:active{-webkit-text-fill-color:var(--input-fg-color) !important;transition:background-color 5000s;transition-delay:86400s;}&[data-as='textarea']{resize:none;}color:var(--input-fg-color);&::placeholder{color:var(--input-placeholder-color);}&[data-scheme='${$scheme}'][data-tone='${$tone}']{--input-fg-color:${color.input.default.enabled.fg};--input-placeholder-color:${color.input.default.enabled.placeholder};&:not(:invalid):not(:disabled):not(:read-only){--input-fg-color:${color.input.default.enabled.fg};--input-placeholder-color:${color.input.default.enabled.placeholder};}&:not(:invalid):disabled{--input-fg-color:${color.input.default.disabled.fg};--input-placeholder-color:${color.input.default.disabled.placeholder};}&:invalid{--input-fg-color:${color.input.invalid.enabled.fg};--input-placeholder-color:${color.input.invalid.enabled.placeholder};}&:read-only{--input-fg-color:${color.input.default.readOnly.fg};--input-placeholder-color:${color.input.default.readOnly.placeholder};}}`;
|
|
1816
|
+
}
|
|
1817
|
+
function textInputFontSizeStyle(props) {
|
|
1818
|
+
let { font, media } = getTheme_v2(props.theme);
|
|
1819
|
+
return _responsive(media, props.$fontSize, (sizeIndex) => {
|
|
1820
|
+
let size = font.text.sizes[sizeIndex] || font.text.sizes[2];
|
|
1821
|
+
return {
|
|
1822
|
+
fontSize: rem(size.fontSize),
|
|
1823
|
+
lineHeight: `${size.lineHeight / size.fontSize}`
|
|
1824
|
+
};
|
|
1825
|
+
});
|
|
1826
|
+
}
|
|
1827
|
+
function textInputRepresentationStyle(props) {
|
|
1828
|
+
let { $hasPrefix, $hasSuffix, $scheme, $tone, $unstableDisableFocusRing } = props, { color, input } = getTheme_v2(props.theme);
|
|
1829
|
+
return css`--input-box-shadow:none;position:absolute;top:0;left:0;right:0;bottom:0;display:block;pointer-events:none;z-index:0;background-color:var(--card-bg-color);box-shadow:var(--input-box-shadow);border-top-left-radius:${$hasPrefix ? 0 : void 0};border-bottom-left-radius:${$hasPrefix ? 0 : void 0};border-top-right-radius:${$hasSuffix ? 0 : void 0};border-bottom-right-radius:${$hasSuffix ? 0 : void 0};&[data-scheme='${$scheme}'][data-tone='${$tone}']{--card-bg-color:${color.input.default.enabled.bg};--card-fg-color:${color.input.default.enabled.fg};*:not(:disabled) + &[data-border]{--input-box-shadow:${focusRingBorderStyle({
|
|
1830
|
+
color: color.input.default.enabled.border,
|
|
1831
|
+
width: input.border.width
|
|
1832
|
+
})};}*:not(:disabled):invalid + &{--card-bg-color:${color.input.invalid.enabled.bg};--card-fg-color:${color.input.invalid.enabled.fg};&[data-border]{--input-box-shadow:${focusRingBorderStyle({
|
|
1833
|
+
color: color.input.invalid.enabled.border,
|
|
1834
|
+
width: input.border.width
|
|
1835
|
+
})};}}*:not(:disabled):focus + &{&[data-border]{--input-box-shadow:${$unstableDisableFocusRing ? void 0 : focusRingStyle({
|
|
1836
|
+
border: {
|
|
1837
|
+
color: color.input.default.enabled.border,
|
|
1838
|
+
width: input.border.width
|
|
1839
|
+
},
|
|
1840
|
+
focusRing: input.text.focusRing
|
|
1841
|
+
})};}&:not([data-border]){--input-box-shadow:${$unstableDisableFocusRing ? void 0 : focusRingStyle({ focusRing: input.text.focusRing })};}}*:not(:invalid):disabled + &{--card-bg-color:${color.input.default.disabled.bg} !important;--card-fg-color:${color.input.default.disabled.fg} !important;--card-icon-color:${color.input.default.disabled.fg} !important;&[data-border]{--input-box-shadow:${focusRingBorderStyle({
|
|
1842
|
+
color: color.input.default.disabled.border,
|
|
1843
|
+
width: input.border.width
|
|
1844
|
+
})};}}*:invalid:disabled + &{--card-bg-color:${color.input.invalid.disabled.bg} !important;--card-fg-color:${color.input.invalid.disabled.fg} !important;--card-icon-color:${color.input.invalid.disabled.fg} !important;&[data-border]{--input-box-shadow:${focusRingBorderStyle({
|
|
1845
|
+
color: color.input.invalid.disabled.border,
|
|
1846
|
+
width: input.border.width
|
|
1847
|
+
})};}}*:not(:invalid):read-only + &{--card-bg-color:${color.input.default.readOnly.bg} !important;--card-fg-color:${color.input.default.readOnly.fg} !important;}*:invalid:read-only + &{--card-bg-color:${color.input.invalid.readOnly.bg} !important;--card-fg-color:${color.input.invalid.readOnly.fg} !important;}@media (hover:hover){*:not(:disabled):not(:read-only):not(:invalid):hover + &{--card-bg-color:${color.input.default.hovered.bg};--card-fg-color:${color.input.default.hovered.fg};}*:invalid:not(:disabled):not(:read-only):hover + &{--card-bg-color:${color.input.invalid.hovered.bg};--card-fg-color:${color.input.invalid.hovered.fg};}*:not(:disabled):not(:read-only):not(:invalid):not(:focus):hover + &[data-border]{--input-box-shadow:${focusRingBorderStyle({
|
|
1848
|
+
color: color.input.default.hovered.border,
|
|
1849
|
+
width: input.border.width
|
|
1850
|
+
})};}*:invalid:not(:disabled):not(:read-only):not(:focus):hover + &[data-border]{--input-box-shadow:${focusRingBorderStyle({
|
|
1851
|
+
color: color.input.invalid.hovered.border,
|
|
1852
|
+
width: input.border.width
|
|
1853
|
+
})};}}}`;
|
|
1854
|
+
}
|
|
1855
|
+
const CLEAR_BUTTON_BOX_STYLE = { zIndex: 2 }, StyledTextInput = /* @__PURE__ */ styled(Card).attrs({ forwardedAs: "span" }).withConfig({
|
|
2157
1856
|
displayName: "StyledTextInput",
|
|
2158
|
-
componentId: "sc-
|
|
1857
|
+
componentId: "sc-7gzsyi-0"
|
|
2159
1858
|
})(textInputRootStyle), InputRoot = styled.span.withConfig({
|
|
2160
1859
|
displayName: "InputRoot",
|
|
2161
|
-
componentId: "sc-
|
|
1860
|
+
componentId: "sc-7gzsyi-1"
|
|
2162
1861
|
})`flex:1;min-width:0;display:block;position:relative;`, Prefix = styled(Card).attrs({ forwardedAs: "span" }).withConfig({
|
|
2163
1862
|
displayName: "Prefix",
|
|
2164
|
-
componentId: "sc-
|
|
1863
|
+
componentId: "sc-7gzsyi-2"
|
|
2165
1864
|
})`border-top-right-radius:0;border-bottom-right-radius:0;& > span{display:block;margin:-1px;}`, Suffix = styled(Card).attrs({ forwardedAs: "span" }).withConfig({
|
|
2166
1865
|
displayName: "Suffix",
|
|
2167
|
-
componentId: "sc-
|
|
1866
|
+
componentId: "sc-7gzsyi-3"
|
|
2168
1867
|
})`border-top-left-radius:0;border-bottom-left-radius:0;& > span{display:block;margin:-1px;}`, Input = /* @__PURE__ */ styled.input.withConfig({
|
|
2169
1868
|
displayName: "Input",
|
|
2170
|
-
componentId: "sc-
|
|
1869
|
+
componentId: "sc-7gzsyi-4"
|
|
2171
1870
|
})(responsiveInputPaddingStyle, textInputBaseStyle, textInputFontSizeStyle), Presentation = /* @__PURE__ */ styled.span.withConfig({
|
|
2172
1871
|
displayName: "Presentation",
|
|
2173
|
-
componentId: "sc-
|
|
1872
|
+
componentId: "sc-7gzsyi-5"
|
|
2174
1873
|
})(responsiveRadiusStyle, textInputRepresentationStyle), LeftBox = styled(Box).withConfig({
|
|
2175
1874
|
displayName: "LeftBox",
|
|
2176
|
-
componentId: "sc-
|
|
1875
|
+
componentId: "sc-7gzsyi-6"
|
|
2177
1876
|
})`position:absolute;top:0;left:0;`, RightBox = styled(Box).withConfig({
|
|
2178
1877
|
displayName: "RightBox",
|
|
2179
|
-
componentId: "sc-
|
|
1878
|
+
componentId: "sc-7gzsyi-7"
|
|
2180
1879
|
})`position:absolute;top:0;right:0;`, RightCard = styled(Card).withConfig({
|
|
2181
1880
|
displayName: "RightCard",
|
|
2182
|
-
componentId: "sc-
|
|
1881
|
+
componentId: "sc-7gzsyi-8"
|
|
2183
1882
|
})`background-color:transparent;position:absolute;top:0;right:0;`, TextInputClearButton = /* @__PURE__ */ styled(Button).withConfig({
|
|
2184
1883
|
displayName: "TextInputClearButton",
|
|
2185
|
-
componentId: "sc-
|
|
1884
|
+
componentId: "sc-7gzsyi-9"
|
|
2186
1885
|
})({ "&:not([hidden])": { display: "block" } }), TextInput = forwardRef(function TextInput(props, forwardedRef) {
|
|
2187
1886
|
let $ = c(93), IconComponent, IconRightComponent, __unstable_disableFocusRing, clearButton, customValidity, gap, onClear, prefix, readOnly, restProps, suffix, t0, t1, t2, t3, t4, t5, t6, weight;
|
|
2188
1887
|
$[0] === props ? (IconComponent = $[1], IconRightComponent = $[2], __unstable_disableFocusRing = $[3], clearButton = $[4], customValidity = $[5], gap = $[6], onClear = $[7], prefix = $[8], readOnly = $[9], restProps = $[10], suffix = $[11], t0 = $[12], t1 = $[13], t2 = $[14], t3 = $[15], t4 = $[16], t5 = $[17], t6 = $[18], weight = $[19]) : ({__unstable_disableFocusRing, border: t0, clearButton, disabled: t1, fontSize: t2, gap, icon: IconComponent, iconRight: IconRightComponent, onClear, padding: t3, prefix, radius: t4, readOnly, space: t5, suffix, customValidity, type: t6, weight, ...restProps} = props, $[0] = props, $[1] = IconComponent, $[2] = IconRightComponent, $[3] = __unstable_disableFocusRing, $[4] = clearButton, $[5] = customValidity, $[6] = gap, $[7] = onClear, $[8] = prefix, $[9] = readOnly, $[10] = restProps, $[11] = suffix, $[12] = t0, $[13] = t1, $[14] = t2, $[15] = t3, $[16] = t4, $[17] = t5, $[18] = t6, $[19] = weight);
|
|
@@ -2196,7 +1895,7 @@ const StyledStack = /* @__PURE__ */ styled(Box).withConfig({
|
|
|
2196
1895
|
$[26] === t10 ? t11 = $[27] : (t11 = _getArrayProp(t10), $[26] = t10, $[27] = t11);
|
|
2197
1896
|
let space = t11, $hasClearButton = !!clearButton, $hasIcon = !!IconComponent, $hasIconRight = !!IconRightComponent, $hasSuffix = !!suffix, $hasPrefix = !!prefix, t12;
|
|
2198
1897
|
$[28] === Symbol.for("react.memo_cache_sentinel") ? (t12 = () => ref.current, $[28] = t12) : t12 = $[28], useImperativeHandle(forwardedRef, t12), useCustomValidity(ref, customValidity);
|
|
2199
|
-
let handleClearMouseDown = _temp$
|
|
1898
|
+
let handleClearMouseDown = _temp$6, t13;
|
|
2200
1899
|
$[29] === onClear ? t13 = $[30] : (t13 = (event_0) => {
|
|
2201
1900
|
event_0.preventDefault(), event_0.stopPropagation(), onClear && onClear(), ref.current?.focus();
|
|
2202
1901
|
}, $[29] = onClear, $[30] = t13);
|
|
@@ -2240,7 +1939,7 @@ const StyledStack = /* @__PURE__ */ styled(Box).withConfig({
|
|
|
2240
1939
|
children: [t16, t17]
|
|
2241
1940
|
}), $[43] = $hasPrefix, $[44] = $hasSuffix, $[45] = __unstable_disableFocusRing, $[46] = radius, $[47] = rootTheme.scheme, $[48] = rootTheme.tone, $[49] = t15, $[50] = t16, $[51] = t17, $[52] = t18) : t18 = $[52];
|
|
2242
1941
|
let presentationNode = t18, t19;
|
|
2243
|
-
$[53] === padding ? t19 = $[54] : (t19 = padding.map(_temp2), $[53] = padding, $[54] = t19);
|
|
1942
|
+
$[53] === padding ? t19 = $[54] : (t19 = padding.map(_temp2$1), $[53] = padding, $[54] = t19);
|
|
2244
1943
|
let clearButtonBoxPadding = t19, t20;
|
|
2245
1944
|
$[55] === padding ? t20 = $[56] : (t20 = padding.map(_temp3), $[55] = padding, $[56] = t20);
|
|
2246
1945
|
let clearButtonPadding = t20, clearButtonProps = typeof clearButton == "object" ? clearButton : EMPTY_RECORD, t21;
|
|
@@ -2308,410 +2007,190 @@ const StyledStack = /* @__PURE__ */ styled(Box).withConfig({
|
|
|
2308
2007
|
]
|
|
2309
2008
|
}), $[88] = prefixNode, $[89] = rootTheme.tone, $[90] = suffixNode, $[91] = t25, $[92] = t26) : t26 = $[92], t26;
|
|
2310
2009
|
});
|
|
2311
|
-
function _temp$
|
|
2010
|
+
function _temp$6(event) {
|
|
2312
2011
|
event.preventDefault(), event.stopPropagation();
|
|
2313
2012
|
}
|
|
2314
|
-
function _temp2(v) {
|
|
2013
|
+
function _temp2$1(v) {
|
|
2315
2014
|
return v === 0 ? 0 : v === 1 || v === 2 ? 1 : v - 2;
|
|
2316
2015
|
}
|
|
2317
2016
|
function _temp3(v_0) {
|
|
2318
2017
|
return v_0 === 0 || v_0 === 1 ? 0 : v_0 === 2 ? 1 : v_0 - 1;
|
|
2319
2018
|
}
|
|
2320
2019
|
/**
|
|
2321
|
-
* @
|
|
2020
|
+
* @public
|
|
2322
2021
|
*/
|
|
2323
|
-
function
|
|
2324
|
-
let $ = c(
|
|
2325
|
-
$[0]
|
|
2326
|
-
|
|
2327
|
-
|
|
2022
|
+
function useClickOutsideEvent(listener, t0, boundaryElement) {
|
|
2023
|
+
let $ = c(9), elementsArg = t0 === void 0 ? _temp$5 : t0, t1;
|
|
2024
|
+
$[0] !== boundaryElement || $[1] !== elementsArg || $[2] !== listener ? (t1 = (evt) => {
|
|
2025
|
+
if (!listener) return;
|
|
2026
|
+
let target = evt.target;
|
|
2027
|
+
if (!(target instanceof Node)) return;
|
|
2028
|
+
let resolvedBoundaryElement = boundaryElement?.();
|
|
2029
|
+
if (resolvedBoundaryElement && !resolvedBoundaryElement.contains(target)) return;
|
|
2030
|
+
let elements = elementsArg().flat();
|
|
2031
|
+
for (let el of elements) if (el && (target === el || el.contains(target))) return;
|
|
2032
|
+
listener(evt);
|
|
2033
|
+
}, $[0] = boundaryElement, $[1] = elementsArg, $[2] = listener, $[3] = t1) : t1 = $[3];
|
|
2034
|
+
let onEvent = useEffectEvent(t1), hasListener = !!listener, t2;
|
|
2035
|
+
$[4] !== hasListener || $[5] !== onEvent ? (t2 = () => {
|
|
2036
|
+
if (!hasListener) return;
|
|
2037
|
+
let handleEvent = (evt_0) => onEvent(evt_0);
|
|
2038
|
+
return document.addEventListener("mousedown", handleEvent), () => {
|
|
2039
|
+
document.removeEventListener("mousedown", handleEvent);
|
|
2328
2040
|
};
|
|
2329
|
-
|
|
2330
|
-
delayedAction.current = setTimeout(action, delay);
|
|
2331
|
-
}, $[0] = t0) : t0 = $[0];
|
|
2332
|
-
let onStateChange = t0, t1, t2;
|
|
2333
|
-
$[1] === Symbol.for("react.memo_cache_sentinel") ? (t1 = () => () => {
|
|
2334
|
-
delayedAction.current && clearTimeout(delayedAction.current);
|
|
2335
|
-
}, t2 = [], $[1] = t1, $[2] = t2) : (t1 = $[1], t2 = $[2]), useEffect(t1, t2);
|
|
2041
|
+
}, $[4] = hasListener, $[5] = onEvent, $[6] = t2) : t2 = $[6];
|
|
2336
2042
|
let t3;
|
|
2337
|
-
|
|
2043
|
+
$[7] === hasListener ? t3 = $[8] : (t3 = [hasListener], $[7] = hasListener, $[8] = t3), useEffect(t2, t3), useDebugValue(listener ? "MouseDown On" : "MouseDown Off");
|
|
2044
|
+
}
|
|
2045
|
+
function _temp$5() {
|
|
2046
|
+
return EMPTY_ARRAY;
|
|
2338
2047
|
}
|
|
2339
|
-
const DEFAULT_FALLBACK_PLACEMENTS = {
|
|
2340
|
-
top: [
|
|
2341
|
-
"top-end",
|
|
2342
|
-
"top-start",
|
|
2343
|
-
"bottom",
|
|
2344
|
-
"left",
|
|
2345
|
-
"right"
|
|
2346
|
-
],
|
|
2347
|
-
"top-start": [
|
|
2348
|
-
"top",
|
|
2349
|
-
"top-end",
|
|
2350
|
-
"bottom-start",
|
|
2351
|
-
"left-start",
|
|
2352
|
-
"right-start"
|
|
2353
|
-
],
|
|
2354
|
-
"top-end": [
|
|
2355
|
-
"top",
|
|
2356
|
-
"top-start",
|
|
2357
|
-
"bottom-end",
|
|
2358
|
-
"left-end",
|
|
2359
|
-
"right-end"
|
|
2360
|
-
],
|
|
2361
|
-
bottom: [
|
|
2362
|
-
"bottom-end",
|
|
2363
|
-
"bottom-start",
|
|
2364
|
-
"top",
|
|
2365
|
-
"left",
|
|
2366
|
-
"right"
|
|
2367
|
-
],
|
|
2368
|
-
"bottom-start": [
|
|
2369
|
-
"bottom",
|
|
2370
|
-
"bottom-end",
|
|
2371
|
-
"top-start",
|
|
2372
|
-
"left-start",
|
|
2373
|
-
"right-start"
|
|
2374
|
-
],
|
|
2375
|
-
"bottom-end": [
|
|
2376
|
-
"bottom",
|
|
2377
|
-
"bottom-start",
|
|
2378
|
-
"top-end",
|
|
2379
|
-
"left-end",
|
|
2380
|
-
"right-end"
|
|
2381
|
-
],
|
|
2382
|
-
left: [
|
|
2383
|
-
"left-end",
|
|
2384
|
-
"left-start",
|
|
2385
|
-
"right",
|
|
2386
|
-
"top",
|
|
2387
|
-
"bottom"
|
|
2388
|
-
],
|
|
2389
|
-
"left-start": [
|
|
2390
|
-
"left",
|
|
2391
|
-
"left-end",
|
|
2392
|
-
"right-start",
|
|
2393
|
-
"top-start",
|
|
2394
|
-
"bottom-start"
|
|
2395
|
-
],
|
|
2396
|
-
"left-end": [
|
|
2397
|
-
"left",
|
|
2398
|
-
"left-start",
|
|
2399
|
-
"right-end",
|
|
2400
|
-
"top-end",
|
|
2401
|
-
"bottom-end"
|
|
2402
|
-
],
|
|
2403
|
-
right: [
|
|
2404
|
-
"right-end",
|
|
2405
|
-
"right-start",
|
|
2406
|
-
"left",
|
|
2407
|
-
"top",
|
|
2408
|
-
"bottom"
|
|
2409
|
-
],
|
|
2410
|
-
"right-start": [
|
|
2411
|
-
"right",
|
|
2412
|
-
"right-end",
|
|
2413
|
-
"left-start",
|
|
2414
|
-
"top-start",
|
|
2415
|
-
"bottom-start"
|
|
2416
|
-
],
|
|
2417
|
-
"right-end": [
|
|
2418
|
-
"right",
|
|
2419
|
-
"right-start",
|
|
2420
|
-
"left-end",
|
|
2421
|
-
"top-end",
|
|
2422
|
-
"bottom-end"
|
|
2423
|
-
]
|
|
2424
|
-
}, MotionCard = styled(motion.create(Card)).withConfig({
|
|
2425
|
-
displayName: "MotionCard",
|
|
2426
|
-
componentId: "sc-d1w0oq-0"
|
|
2427
|
-
})`will-change:transform;`, TooltipCard = forwardRef(function TooltipCard(props, ref) {
|
|
2428
|
-
let $ = c(48), animate, arrow, arrowRef, arrowX, arrowY, children, originX, originY, padding, placement, radius, restProps, scheme, shadow, style;
|
|
2429
|
-
$[0] === props ? (animate = $[1], arrow = $[2], arrowRef = $[3], arrowX = $[4], arrowY = $[5], children = $[6], originX = $[7], originY = $[8], padding = $[9], placement = $[10], radius = $[11], restProps = $[12], scheme = $[13], shadow = $[14], style = $[15]) : ({animate, arrow, arrowRef, arrowX, arrowY, children, originX, originY, padding, placement, radius, scheme, shadow, style, ...restProps} = props, $[0] = props, $[1] = animate, $[2] = arrow, $[3] = arrowRef, $[4] = arrowX, $[5] = arrowY, $[6] = children, $[7] = originX, $[8] = originY, $[9] = padding, $[10] = placement, $[11] = radius, $[12] = restProps, $[13] = scheme, $[14] = shadow, $[15] = style);
|
|
2430
|
-
let t0 = animate ? "transform" : void 0, t1;
|
|
2431
|
-
$[16] !== originX || $[17] !== originY || $[18] !== style || $[19] !== t0 ? (t1 = {
|
|
2432
|
-
originX,
|
|
2433
|
-
originY,
|
|
2434
|
-
willChange: t0,
|
|
2435
|
-
...style
|
|
2436
|
-
}, $[16] = originX, $[17] = originY, $[18] = style, $[19] = t0, $[20] = t1) : t1 = $[20];
|
|
2437
|
-
let rootStyle = t1, t2 = arrowX === null ? void 0 : arrowX, t3 = arrowY === null ? void 0 : arrowY, t4;
|
|
2438
|
-
$[21] !== t2 || $[22] !== t3 ? (t4 = {
|
|
2439
|
-
left: t2,
|
|
2440
|
-
top: t3,
|
|
2441
|
-
right: void 0,
|
|
2442
|
-
bottom: void 0
|
|
2443
|
-
}, $[21] = t2, $[22] = t3, $[23] = t4) : t4 = $[23];
|
|
2444
|
-
let arrowStyle = t4, t5 = restProps, t6;
|
|
2445
|
-
$[24] === animate ? t6 = $[25] : (t6 = animate ? ["hidden", "initial"] : void 0, $[24] = animate, $[25] = t6);
|
|
2446
|
-
let t7;
|
|
2447
|
-
$[26] === animate ? t7 = $[27] : (t7 = animate ? ["visible", "scaleIn"] : void 0, $[26] = animate, $[27] = t7);
|
|
2448
|
-
let t8;
|
|
2449
|
-
$[28] === animate ? t8 = $[29] : (t8 = animate ? ["hidden", "scaleOut"] : void 0, $[28] = animate, $[29] = t8);
|
|
2450
|
-
let t9;
|
|
2451
|
-
$[30] !== arrow || $[31] !== arrowRef || $[32] !== arrowStyle ? (t9 = arrow && /* @__PURE__ */ jsx(Arrow, {
|
|
2452
|
-
ref: arrowRef,
|
|
2453
|
-
style: arrowStyle,
|
|
2454
|
-
width: 15,
|
|
2455
|
-
height: 6,
|
|
2456
|
-
radius: 2
|
|
2457
|
-
}), $[30] = arrow, $[31] = arrowRef, $[32] = arrowStyle, $[33] = t9) : t9 = $[33];
|
|
2458
|
-
let t10;
|
|
2459
|
-
return $[34] !== children || $[35] !== padding || $[36] !== placement || $[37] !== radius || $[38] !== ref || $[39] !== rootStyle || $[40] !== scheme || $[41] !== shadow || $[42] !== t5 || $[43] !== t6 || $[44] !== t7 || $[45] !== t8 || $[46] !== t9 ? (t10 = /* @__PURE__ */ jsxs(MotionCard, {
|
|
2460
|
-
"data-ui": "Tooltip__card",
|
|
2461
|
-
...t5,
|
|
2462
|
-
"data-placement": placement,
|
|
2463
|
-
padding,
|
|
2464
|
-
radius,
|
|
2465
|
-
ref,
|
|
2466
|
-
scheme,
|
|
2467
|
-
shadow,
|
|
2468
|
-
style: rootStyle,
|
|
2469
|
-
variants: POPOVER_MOTION_PROPS.card,
|
|
2470
|
-
transition: POPOVER_MOTION_PROPS.transition,
|
|
2471
|
-
initial: t6,
|
|
2472
|
-
animate: t7,
|
|
2473
|
-
exit: t8,
|
|
2474
|
-
children: [children, t9]
|
|
2475
|
-
}), $[34] = children, $[35] = padding, $[36] = placement, $[37] = radius, $[38] = ref, $[39] = rootStyle, $[40] = scheme, $[41] = shadow, $[42] = t5, $[43] = t6, $[44] = t7, $[45] = t8, $[46] = t9, $[47] = t10) : t10 = $[47], t10;
|
|
2476
|
-
}), TooltipDelayGroupContext = createGlobalScopedContext("@sanity/ui/context/tooltipDelayGroup", null);
|
|
2477
2048
|
/**
|
|
2049
|
+
* Adds global keydown event listener to the window.
|
|
2050
|
+
*
|
|
2051
|
+
* @param onKeyDown - The function to call when a keydown event is triggered.
|
|
2052
|
+
* @param options - The options to pass to the addEventListener function (example, capture: true)
|
|
2478
2053
|
* @beta
|
|
2479
2054
|
*/
|
|
2480
|
-
function
|
|
2481
|
-
|
|
2055
|
+
function useGlobalKeyDown(onKeyDown, options) {
|
|
2056
|
+
let $ = c(7), t0;
|
|
2057
|
+
$[0] === onKeyDown ? t0 = $[1] : (t0 = (event) => onKeyDown(event), $[0] = onKeyDown, $[1] = t0);
|
|
2058
|
+
let handleKeyDown = useEffectEvent(t0), t1;
|
|
2059
|
+
$[2] !== handleKeyDown || $[3] !== options ? (t1 = () => {
|
|
2060
|
+
let handler = (event_0) => handleKeyDown(event_0);
|
|
2061
|
+
return window.addEventListener("keydown", handler, options), () => window.removeEventListener("keydown", handler, options);
|
|
2062
|
+
}, $[2] = handleKeyDown, $[3] = options, $[4] = t1) : t1 = $[4];
|
|
2063
|
+
let t2;
|
|
2064
|
+
$[5] === options ? t2 = $[6] : (t2 = [options], $[5] = options, $[6] = t2), useEffect(t1, t2);
|
|
2482
2065
|
}
|
|
2483
|
-
const
|
|
2484
|
-
displayName: "
|
|
2485
|
-
componentId: "sc-
|
|
2486
|
-
})
|
|
2487
|
-
let $ = c(
|
|
2488
|
-
$[0] === props ? (
|
|
2489
|
-
let
|
|
2490
|
-
$[
|
|
2491
|
-
let
|
|
2492
|
-
$[
|
|
2493
|
-
|
|
2494
|
-
$[
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
$[
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
whileElementsMounted: autoUpdate,
|
|
2509
|
-
elements: t9
|
|
2510
|
-
}, $[27] = middleware, $[28] = placementProp, $[29] = t9, $[30] = t10) : t10 = $[30];
|
|
2511
|
-
let { floatingStyles, placement, middlewareData, refs, update } = useFloating(t10), arrowX = middlewareData.arrow?.x, arrowY = middlewareData.arrow?.y, originX = middlewareData["@sanity/ui/origin"]?.originX, originY = middlewareData["@sanity/ui/origin"]?.originY, tooltipId = useId(), [isOpen, setIsOpen] = useDelayedState(!1), delayGroupContext = useTooltipDelayGroup(), t11;
|
|
2512
|
-
$[31] === delayGroupContext ? t11 = $[32] : (t11 = delayGroupContext || {}, $[31] = delayGroupContext, $[32] = t11);
|
|
2513
|
-
let { setIsGroupActive, setOpenTooltipId } = t11, showTooltip = isOpen || delayGroupContext?.openTooltipId === tooltipId, isInsideGroup = delayGroupContext !== null, openDelayProp = typeof delay == "number" ? delay : delay?.open || 0, closeDelayProp = typeof delay == "number" ? delay : delay?.close || 0, openDelay = isInsideGroup ? delayGroupContext.openDelay : openDelayProp, closeDelay = isInsideGroup ? delayGroupContext.closeDelay : closeDelayProp, t12;
|
|
2514
|
-
$[33] !== closeDelay || $[34] !== isInsideGroup || $[35] !== openDelay || $[36] !== setIsGroupActive || $[37] !== setIsOpen || $[38] !== setOpenTooltipId || $[39] !== tooltipId ? (t12 = (open, immediate) => {
|
|
2515
|
-
if (isInsideGroup) if (open) {
|
|
2516
|
-
let groupedOpenDelay = immediate ? 0 : openDelay;
|
|
2517
|
-
setIsGroupActive?.(open, groupedOpenDelay), setOpenTooltipId?.(tooltipId, groupedOpenDelay);
|
|
2518
|
-
} else setIsGroupActive?.(open, closeDelay > 200 ? closeDelay : 200), setOpenTooltipId?.(null, immediate ? 0 : closeDelay);
|
|
2519
|
-
else setIsOpen(open, immediate ? 0 : open ? openDelay : closeDelay);
|
|
2520
|
-
}, $[33] = closeDelay, $[34] = isInsideGroup, $[35] = openDelay, $[36] = setIsGroupActive, $[37] = setIsOpen, $[38] = setOpenTooltipId, $[39] = tooltipId, $[40] = t12) : t12 = $[40];
|
|
2521
|
-
let handleIsOpenChange = t12, t13;
|
|
2522
|
-
$[41] !== childProp?.props || $[42] !== handleIsOpenChange ? (t13 = (e) => {
|
|
2523
|
-
handleIsOpenChange(!1), childProp?.props?.onBlur?.(e);
|
|
2524
|
-
}, $[41] = childProp?.props, $[42] = handleIsOpenChange, $[43] = t13) : t13 = $[43], childProp?.props;
|
|
2525
|
-
let handleBlur = t13, t14;
|
|
2526
|
-
$[44] !== childProp?.props || $[45] !== handleIsOpenChange ? (t14 = (e_0) => {
|
|
2527
|
-
handleIsOpenChange(!1, !0), childProp?.props.onClick?.(e_0);
|
|
2528
|
-
}, $[44] = childProp?.props, $[45] = handleIsOpenChange, $[46] = t14) : t14 = $[46], childProp?.props;
|
|
2529
|
-
let handleClick = t14, t15;
|
|
2530
|
-
$[47] !== childProp?.props || $[48] !== handleIsOpenChange ? (t15 = (e_1) => {
|
|
2531
|
-
handleIsOpenChange(!1, !0), childProp?.props.onContextMenu?.(e_1);
|
|
2532
|
-
}, $[47] = childProp?.props, $[48] = handleIsOpenChange, $[49] = t15) : t15 = $[49], childProp?.props;
|
|
2533
|
-
let handleContextMenu = t15, t16;
|
|
2534
|
-
$[50] !== childProp?.props || $[51] !== handleIsOpenChange ? (t16 = (e_2) => {
|
|
2535
|
-
handleIsOpenChange(!0), childProp?.props?.onFocus?.(e_2);
|
|
2536
|
-
}, $[50] = childProp?.props, $[51] = handleIsOpenChange, $[52] = t16) : t16 = $[52], childProp?.props;
|
|
2537
|
-
let handleFocus = t16, t17;
|
|
2538
|
-
$[53] !== childProp?.props || $[54] !== handleIsOpenChange ? (t17 = (e_3) => {
|
|
2539
|
-
handleIsOpenChange(!0), childProp?.props?.onMouseEnter?.(e_3);
|
|
2540
|
-
}, $[53] = childProp?.props, $[54] = handleIsOpenChange, $[55] = t17) : t17 = $[55], childProp?.props;
|
|
2541
|
-
let handleMouseEnter = t17, t18;
|
|
2542
|
-
$[56] !== childProp?.props || $[57] !== handleIsOpenChange ? (t18 = (e_4) => {
|
|
2543
|
-
handleIsOpenChange(!1), childProp?.props?.onMouseLeave?.(e_4);
|
|
2544
|
-
}, $[56] = childProp?.props, $[57] = handleIsOpenChange, $[58] = t18) : t18 = $[58], childProp?.props;
|
|
2545
|
-
let handleMouseLeave = t18, t19;
|
|
2546
|
-
$[59] !== handleIsOpenChange || $[60] !== isInsideGroup || $[61] !== referenceElement || $[62] !== showTooltip ? (t19 = {
|
|
2547
|
-
handleIsOpenChange,
|
|
2548
|
-
referenceElement,
|
|
2549
|
-
showTooltip,
|
|
2550
|
-
isInsideGroup
|
|
2551
|
-
}, $[59] = handleIsOpenChange, $[60] = isInsideGroup, $[61] = referenceElement, $[62] = showTooltip, $[63] = t19) : t19 = $[63], useCloseOnMouseLeave(t19);
|
|
2552
|
-
let t20, t21;
|
|
2553
|
-
$[64] !== disabled || $[65] !== handleIsOpenChange || $[66] !== showTooltip ? (t20 = () => {
|
|
2554
|
-
disabled && showTooltip && handleIsOpenChange(!1);
|
|
2555
|
-
}, t21 = [
|
|
2556
|
-
disabled,
|
|
2557
|
-
handleIsOpenChange,
|
|
2558
|
-
showTooltip
|
|
2559
|
-
], $[64] = disabled, $[65] = handleIsOpenChange, $[66] = showTooltip, $[67] = t20, $[68] = t21) : (t20 = $[67], t21 = $[68]), useEffect(t20, t21);
|
|
2560
|
-
let t22, t23;
|
|
2561
|
-
$[69] !== content || $[70] !== handleIsOpenChange || $[71] !== showTooltip ? (t22 = () => {
|
|
2562
|
-
!content && showTooltip && handleIsOpenChange(!1);
|
|
2563
|
-
}, t23 = [
|
|
2564
|
-
content,
|
|
2565
|
-
handleIsOpenChange,
|
|
2566
|
-
showTooltip
|
|
2567
|
-
], $[69] = content, $[70] = handleIsOpenChange, $[71] = showTooltip, $[72] = t22, $[73] = t23) : (t22 = $[72], t23 = $[73]), useEffect(t22, t23);
|
|
2568
|
-
let t24, t25;
|
|
2569
|
-
$[74] !== handleIsOpenChange || $[75] !== showTooltip ? (t24 = () => {
|
|
2570
|
-
if (!showTooltip) return;
|
|
2571
|
-
let handleWindowKeyDown = function handleWindowKeyDown(event) {
|
|
2572
|
-
event.key === "Escape" && handleIsOpenChange(!1, !0);
|
|
2573
|
-
};
|
|
2574
|
-
return window.addEventListener("keydown", handleWindowKeyDown), () => {
|
|
2575
|
-
window.removeEventListener("keydown", handleWindowKeyDown);
|
|
2576
|
-
};
|
|
2577
|
-
}, t25 = [handleIsOpenChange, showTooltip], $[74] = handleIsOpenChange, $[75] = showTooltip, $[76] = t24, $[77] = t25) : (t24 = $[76], t25 = $[77]), useEffect(t24, t25);
|
|
2578
|
-
let t26;
|
|
2579
|
-
$[78] !== boundaryElement || $[79] !== portalElement?.offsetWidth ? (t26 = () => {
|
|
2580
|
-
let availableWidths = [...boundaryElement ? [boundaryElement.offsetWidth] : [], portalElement?.offsetWidth || document.body.offsetWidth];
|
|
2581
|
-
setTooltipMaxWidth(Math.min(...availableWidths) - 8);
|
|
2582
|
-
}, $[78] = boundaryElement, $[79] = portalElement?.offsetWidth, $[80] = t26) : t26 = $[80];
|
|
2583
|
-
let t27;
|
|
2584
|
-
$[81] !== boundaryElement || $[82] !== portalElement ? (t27 = [boundaryElement, portalElement], $[81] = boundaryElement, $[82] = portalElement, $[83] = t27) : t27 = $[83], useLayoutEffect(t26, t27);
|
|
2585
|
-
let t28;
|
|
2586
|
-
$[84] === update ? t28 = $[85] : (t28 = (arrowEl) => {
|
|
2587
|
-
arrowRef.current = arrowEl, update();
|
|
2588
|
-
}, $[84] = update, $[85] = t28);
|
|
2589
|
-
let setArrow = t28, t29;
|
|
2590
|
-
$[86] === refs ? t29 = $[87] : (t29 = (node) => {
|
|
2591
|
-
ref.current = node, refs.setFloating(node);
|
|
2592
|
-
}, $[86] = refs, $[87] = t29);
|
|
2593
|
-
let setFloating = t29, t30;
|
|
2594
|
-
bb0: {
|
|
2595
|
-
if (!childProp) {
|
|
2596
|
-
t30 = null;
|
|
2597
|
-
break bb0;
|
|
2598
|
-
}
|
|
2599
|
-
let t31;
|
|
2600
|
-
$[88] !== childProp || $[89] !== handleBlur || $[90] !== handleClick || $[91] !== handleContextMenu || $[92] !== handleFocus || $[93] !== handleMouseEnter || $[94] !== handleMouseLeave ? (t31 = cloneElement(childProp, {
|
|
2601
|
-
onBlur: handleBlur,
|
|
2602
|
-
onFocus: handleFocus,
|
|
2603
|
-
onMouseEnter: handleMouseEnter,
|
|
2604
|
-
onMouseLeave: handleMouseLeave,
|
|
2605
|
-
onClick: handleClick,
|
|
2606
|
-
onContextMenu: handleContextMenu,
|
|
2607
|
-
ref: setReferenceElement
|
|
2608
|
-
}), $[88] = childProp, $[89] = handleBlur, $[90] = handleClick, $[91] = handleContextMenu, $[92] = handleFocus, $[93] = handleMouseEnter, $[94] = handleMouseLeave, $[95] = t31) : t31 = $[95], t30 = t31;
|
|
2609
|
-
}
|
|
2610
|
-
let child = t30, t31;
|
|
2611
|
-
$[96] === childProp ? t31 = $[97] : (t31 = childProp ? getElementRef(childProp) : null, $[96] = childProp, $[97] = t31);
|
|
2612
|
-
let t32, t33;
|
|
2613
|
-
if ($[98] === referenceElement ? (t32 = $[99], t33 = $[100]) : (t32 = () => referenceElement, t33 = [referenceElement], $[98] = referenceElement, $[99] = t32, $[100] = t33), useImperativeHandle(t31, t32, t33), !child) {
|
|
2614
|
-
let t34;
|
|
2615
|
-
return $[101] === Symbol.for("react.memo_cache_sentinel") ? (t34 = /* @__PURE__ */ jsx(Fragment$1, {}), $[101] = t34) : t34 = $[101], t34;
|
|
2616
|
-
}
|
|
2617
|
-
if (disabled) return child;
|
|
2618
|
-
let t34 = tooltipMaxWidth > 0 ? `${tooltipMaxWidth}px` : void 0, t35;
|
|
2619
|
-
$[102] !== floatingStyles || $[103] !== t34 ? (t35 = {
|
|
2620
|
-
...floatingStyles,
|
|
2621
|
-
maxWidth: t34
|
|
2622
|
-
}, $[102] = floatingStyles, $[103] = t34, $[104] = t35) : t35 = $[104];
|
|
2623
|
-
let t36;
|
|
2624
|
-
$[105] !== animate || $[106] !== arrowProp || $[107] !== arrowX || $[108] !== arrowY || $[109] !== content || $[110] !== originX || $[111] !== originY || $[112] !== padding || $[113] !== placement || $[114] !== radius || $[115] !== restProps || $[116] !== scheme || $[117] !== setArrow || $[118] !== setFloating || $[119] !== shadow ? (t36 = /* @__PURE__ */ jsx(TooltipCard, {
|
|
2066
|
+
const StyledLayer = /* @__PURE__ */ styled.div.withConfig({
|
|
2067
|
+
displayName: "StyledLayer",
|
|
2068
|
+
componentId: "sc-c59p9w-0"
|
|
2069
|
+
})({ position: "relative" }), LayerChildren = forwardRef(function LayerChildren(props, forwardedRef) {
|
|
2070
|
+
let $ = c(22), children, onActivate, onFocus, restProps, t0;
|
|
2071
|
+
$[0] === props ? (children = $[1], onActivate = $[2], onFocus = $[3], restProps = $[4], t0 = $[5]) : ({children, onActivate, onFocus, style: t0, ...restProps} = props, $[0] = props, $[1] = children, $[2] = onActivate, $[3] = onFocus, $[4] = restProps, $[5] = t0);
|
|
2072
|
+
let style = t0 === void 0 ? EMPTY_RECORD : t0, { zIndex, isTopLayer } = useLayer(), lastFocusedRef = useRef(null), ref = useRef(null), isTopLayerRef = useRef(isTopLayer), t1;
|
|
2073
|
+
$[6] === Symbol.for("react.memo_cache_sentinel") ? (t1 = () => ref.current, $[6] = t1) : t1 = $[6], useImperativeHandle(forwardedRef, t1);
|
|
2074
|
+
let t2, t3;
|
|
2075
|
+
$[7] !== isTopLayer || $[8] !== onActivate ? (t2 = () => {
|
|
2076
|
+
isTopLayerRef.current !== isTopLayer && isTopLayer && onActivate?.({ activeElement: lastFocusedRef.current }), isTopLayerRef.current = isTopLayer;
|
|
2077
|
+
}, t3 = [isTopLayer, onActivate], $[7] = isTopLayer, $[8] = onActivate, $[9] = t2, $[10] = t3) : (t2 = $[9], t3 = $[10]), useEffect(t2, t3);
|
|
2078
|
+
let t4;
|
|
2079
|
+
$[11] !== isTopLayer || $[12] !== onFocus ? (t4 = (event) => {
|
|
2080
|
+
onFocus?.(event);
|
|
2081
|
+
let rootElement = ref.current, target = document.activeElement;
|
|
2082
|
+
!isTopLayer || !rootElement || !target || isHTMLElement(target) && containsOrEqualsElement(rootElement, target) && (lastFocusedRef.current = target);
|
|
2083
|
+
}, $[11] = isTopLayer, $[12] = onFocus, $[13] = t4) : t4 = $[13];
|
|
2084
|
+
let handleFocus = t4, t5;
|
|
2085
|
+
$[14] !== style || $[15] !== zIndex ? (t5 = {
|
|
2086
|
+
...style,
|
|
2087
|
+
zIndex
|
|
2088
|
+
}, $[14] = style, $[15] = zIndex, $[16] = t5) : t5 = $[16];
|
|
2089
|
+
let t6;
|
|
2090
|
+
return $[17] !== children || $[18] !== handleFocus || $[19] !== restProps || $[20] !== t5 ? (t6 = /* @__PURE__ */ jsx(StyledLayer, {
|
|
2625
2091
|
...restProps,
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
scheme,
|
|
2638
|
-
shadow,
|
|
2639
|
-
children: content
|
|
2640
|
-
}), $[105] = animate, $[106] = arrowProp, $[107] = arrowX, $[108] = arrowY, $[109] = content, $[110] = originX, $[111] = originY, $[112] = padding, $[113] = placement, $[114] = radius, $[115] = restProps, $[116] = scheme, $[117] = setArrow, $[118] = setFloating, $[119] = shadow, $[120] = t36) : t36 = $[120];
|
|
2641
|
-
let t37;
|
|
2642
|
-
$[121] !== restProps || $[122] !== setFloating || $[123] !== t35 || $[124] !== t36 || $[125] !== zOffset ? (t37 = /* @__PURE__ */ jsx(StyledTooltip, {
|
|
2643
|
-
"data-ui": "Tooltip",
|
|
2092
|
+
"data-ui": "Layer",
|
|
2093
|
+
onFocus: handleFocus,
|
|
2094
|
+
ref,
|
|
2095
|
+
style: t5,
|
|
2096
|
+
children
|
|
2097
|
+
}), $[17] = children, $[18] = handleFocus, $[19] = restProps, $[20] = t5, $[21] = t6) : t6 = $[21], t6;
|
|
2098
|
+
}), Layer = forwardRef(function Layer(props, ref) {
|
|
2099
|
+
let $ = c(11), children, restProps, t0;
|
|
2100
|
+
$[0] === props ? (children = $[1], restProps = $[2], t0 = $[3]) : ({children, zOffset: t0, ...restProps} = props, $[0] = props, $[1] = children, $[2] = restProps, $[3] = t0);
|
|
2101
|
+
let zOffset = t0 === void 0 ? 1 : t0, t1;
|
|
2102
|
+
$[4] !== children || $[5] !== ref || $[6] !== restProps ? (t1 = /* @__PURE__ */ jsx(LayerChildren, {
|
|
2644
2103
|
...restProps,
|
|
2645
|
-
ref
|
|
2646
|
-
|
|
2104
|
+
ref,
|
|
2105
|
+
children
|
|
2106
|
+
}), $[4] = children, $[5] = ref, $[6] = restProps, $[7] = t1) : t1 = $[7];
|
|
2107
|
+
let t2;
|
|
2108
|
+
return $[8] !== t1 || $[9] !== zOffset ? (t2 = /* @__PURE__ */ jsx(LayerProvider, {
|
|
2647
2109
|
zOffset,
|
|
2648
|
-
children:
|
|
2649
|
-
}), $[
|
|
2650
|
-
let tooltip = t37, t38;
|
|
2651
|
-
$[127] !== portalProp || $[128] !== showTooltip || $[129] !== tooltip ? (t38 = showTooltip && (portalProp ? /* @__PURE__ */ jsx(Portal, {
|
|
2652
|
-
__unstable_name: typeof portalProp == "string" ? portalProp : void 0,
|
|
2653
|
-
children: tooltip
|
|
2654
|
-
}) : tooltip), $[127] = portalProp, $[128] = showTooltip, $[129] = tooltip, $[130] = t38) : t38 = $[130];
|
|
2655
|
-
let children = t38, t39;
|
|
2656
|
-
$[131] !== animate || $[132] !== children ? (t39 = animate ? /* @__PURE__ */ jsx(AnimatePresence, { children }) : children, $[131] = animate, $[132] = children, $[133] = t39) : t39 = $[133];
|
|
2657
|
-
let t40;
|
|
2658
|
-
return $[134] !== child || $[135] !== t39 ? (t40 = /* @__PURE__ */ jsxs(Fragment$1, { children: [t39, child] }), $[134] = child, $[135] = t39, $[136] = t40) : t40 = $[136], t40;
|
|
2110
|
+
children: t1
|
|
2111
|
+
}), $[8] = t1, $[9] = zOffset, $[10] = t2) : t2 = $[10], t2;
|
|
2659
2112
|
});
|
|
2660
|
-
function
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
fallbackPlacements,
|
|
2668
|
-
padding: 4,
|
|
2669
|
-
rootBoundary
|
|
2670
|
-
}), $[7] = fallbackPlacements, $[8] = rootBoundary, $[9] = t1, $[10] = t2) : t2 = $[10], ret.push(t2);
|
|
2671
|
-
let t3;
|
|
2672
|
-
$[11] === Symbol.for("react.memo_cache_sentinel") ? (t3 = offset({ mainAxis: 4 }), $[11] = t3) : t3 = $[11], ret.push(t3);
|
|
2673
|
-
let t4 = boundaryElement || void 0, t5;
|
|
2674
|
-
if ($[12] !== rootBoundary || $[13] !== t4 ? (t5 = shift({
|
|
2675
|
-
boundary: t4,
|
|
2676
|
-
rootBoundary,
|
|
2677
|
-
padding: 4
|
|
2678
|
-
}), $[12] = rootBoundary, $[13] = t4, $[14] = t5) : t5 = $[14], ret.push(t5), arrowProp) {
|
|
2679
|
-
let t6;
|
|
2680
|
-
$[15] === arrowRef ? t6 = $[16] : (t6 = arrow({
|
|
2681
|
-
element: arrowRef,
|
|
2682
|
-
padding: 4
|
|
2683
|
-
}), $[15] = arrowRef, $[16] = t6), ret.push(t6);
|
|
2113
|
+
function inlineBaseStyle() {
|
|
2114
|
+
return {
|
|
2115
|
+
lineHeight: "0",
|
|
2116
|
+
"&&:not([hidden])": { display: "block" },
|
|
2117
|
+
"& > div": {
|
|
2118
|
+
display: "inline-block",
|
|
2119
|
+
verticalAlign: "middle"
|
|
2684
2120
|
}
|
|
2685
|
-
|
|
2686
|
-
} else ret = $[6];
|
|
2687
|
-
return ret;
|
|
2121
|
+
};
|
|
2688
2122
|
}
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
referenceElement && (referenceElement === target || target instanceof Node && referenceElement.contains(target) || (handleIsOpenChange(!1), teardown()));
|
|
2697
|
-
}, $[0] = handleIsOpenChange, $[1] = referenceElement, $[2] = t1) : t1 = $[2];
|
|
2698
|
-
let onMouseMove = useEffectEvent(t1), t2;
|
|
2699
|
-
$[3] !== isInsideGroup || $[4] !== onMouseMove || $[5] !== showTooltip ? (t2 = () => {
|
|
2700
|
-
if (!showTooltip || isInsideGroup) return;
|
|
2701
|
-
let handleMouseMove = (event) => {
|
|
2702
|
-
onMouseMove(event.target, () => window.removeEventListener("mousemove", handleMouseMove));
|
|
2123
|
+
function inlineSpaceStyle(props) {
|
|
2124
|
+
let { media, space } = getTheme_v2(props.theme);
|
|
2125
|
+
return _responsive(media, props.$space, (spaceIndex) => {
|
|
2126
|
+
let _space = rem(spaceIndex === .5 ? space[1] / 2 : space[spaceIndex]);
|
|
2127
|
+
return {
|
|
2128
|
+
margin: `-${_space} 0 0 -${_space}`,
|
|
2129
|
+
"& > div": { padding: `${_space} 0 0 ${_space}` }
|
|
2703
2130
|
};
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2131
|
+
});
|
|
2132
|
+
}
|
|
2133
|
+
const StyledInline = /* @__PURE__ */ styled(Box).withConfig({
|
|
2134
|
+
displayName: "StyledInline",
|
|
2135
|
+
componentId: "sc-zsbqh7-0"
|
|
2136
|
+
})(inlineBaseStyle, inlineSpaceStyle), Inline = forwardRef(function Inline(props, ref) {
|
|
2137
|
+
let $ = c(16), as, childrenProp, deprecated_space, gap, restProps;
|
|
2138
|
+
$[0] === props ? (as = $[1], childrenProp = $[2], deprecated_space = $[3], gap = $[4], restProps = $[5]) : ({as, children: childrenProp, gap, space: deprecated_space, ...restProps} = props, $[0] = props, $[1] = as, $[2] = childrenProp, $[3] = deprecated_space, $[4] = gap, $[5] = restProps);
|
|
2139
|
+
let spacing = gap === void 0 ? deprecated_space : gap, t0;
|
|
2140
|
+
$[6] === childrenProp ? t0 = $[7] : (t0 = Children.map(childrenProp, _temp$4), $[6] = childrenProp, $[7] = t0);
|
|
2141
|
+
let children = t0, t1;
|
|
2142
|
+
$[8] === spacing ? t1 = $[9] : (t1 = _getArrayProp(spacing), $[8] = spacing, $[9] = t1);
|
|
2143
|
+
let t2 = ref, t3;
|
|
2144
|
+
return $[10] !== as || $[11] !== children || $[12] !== restProps || $[13] !== t1 || $[14] !== t2 ? (t3 = /* @__PURE__ */ jsx(StyledInline, {
|
|
2145
|
+
"data-ui": "Inline",
|
|
2146
|
+
...restProps,
|
|
2147
|
+
$space: t1,
|
|
2148
|
+
forwardedAs: as,
|
|
2149
|
+
ref: t2,
|
|
2150
|
+
children
|
|
2151
|
+
}), $[10] = as, $[11] = children, $[12] = restProps, $[13] = t1, $[14] = t2, $[15] = t3) : t3 = $[15], t3;
|
|
2152
|
+
});
|
|
2153
|
+
function _temp$4(child) {
|
|
2154
|
+
return child && /* @__PURE__ */ jsx("div", { children: child });
|
|
2155
|
+
}
|
|
2156
|
+
function kbdStyle() {
|
|
2157
|
+
return css`--card-bg-color:var(--card-kbd-bg-color);--card-border-color:var(--card-kbd-border-color);--card-fg-color:var(--card-kbd-fg-color);box-shadow:inset 0 0 0 1px var(--card-border-color);background:var(--card-bg-color);font:inherit;vertical-align:top;&:not([hidden]){display:inline-block;}`;
|
|
2708
2158
|
}
|
|
2709
|
-
const
|
|
2159
|
+
const StyledKBD = /* @__PURE__ */ styled.kbd.withConfig({
|
|
2160
|
+
displayName: "StyledKBD",
|
|
2161
|
+
componentId: "sc-xzhxcv-0"
|
|
2162
|
+
})(responsiveRadiusStyle, kbdStyle), KBD = forwardRef(function KBD(props, ref) {
|
|
2163
|
+
let $ = c(19), children, restProps, t0, t1, t2;
|
|
2164
|
+
$[0] === props ? (children = $[1], restProps = $[2], t0 = $[3], t1 = $[4], t2 = $[5]) : ({children, fontSize: t0, padding: t1, radius: t2, ...restProps} = props, $[0] = props, $[1] = children, $[2] = restProps, $[3] = t0, $[4] = t1, $[5] = t2);
|
|
2165
|
+
let fontSize = t0 === void 0 ? 0 : t0, padding = t1 === void 0 ? 1 : t1, radius = t2 === void 0 ? 2 : t2, t3;
|
|
2166
|
+
$[6] === radius ? t3 = $[7] : (t3 = _getArrayProp(radius), $[6] = radius, $[7] = t3);
|
|
2167
|
+
let t4;
|
|
2168
|
+
$[8] !== children || $[9] !== fontSize ? (t4 = /* @__PURE__ */ jsx(Text, {
|
|
2169
|
+
as: "span",
|
|
2170
|
+
size: fontSize,
|
|
2171
|
+
weight: "semibold",
|
|
2172
|
+
children
|
|
2173
|
+
}), $[8] = children, $[9] = fontSize, $[10] = t4) : t4 = $[10];
|
|
2174
|
+
let t5;
|
|
2175
|
+
$[11] !== padding || $[12] !== t4 ? (t5 = /* @__PURE__ */ jsx(Box, {
|
|
2176
|
+
as: "span",
|
|
2177
|
+
padding,
|
|
2178
|
+
children: t4
|
|
2179
|
+
}), $[11] = padding, $[12] = t4, $[13] = t5) : t5 = $[13];
|
|
2180
|
+
let t6;
|
|
2181
|
+
return $[14] !== ref || $[15] !== restProps || $[16] !== t3 || $[17] !== t5 ? (t6 = /* @__PURE__ */ jsx(StyledKBD, {
|
|
2182
|
+
"data-ui": "KBD",
|
|
2183
|
+
...restProps,
|
|
2184
|
+
$radius: t3,
|
|
2185
|
+
ref,
|
|
2186
|
+
children: t5
|
|
2187
|
+
}), $[14] = ref, $[15] = restProps, $[16] = t3, $[17] = t5, $[18] = t6) : t6 = $[18], t6;
|
|
2188
|
+
}), StyledHotkeys = styled.kbd.withConfig({
|
|
2710
2189
|
displayName: "StyledHotkeys",
|
|
2711
|
-
componentId: "sc-
|
|
2190
|
+
componentId: "sc-1soubc-0"
|
|
2712
2191
|
})`font:inherit;padding:1px;&:not([hidden]){display:block;}`, Key = styled(KBD).withConfig({
|
|
2713
2192
|
displayName: "Key",
|
|
2714
|
-
componentId: "sc-
|
|
2193
|
+
componentId: "sc-1soubc-1"
|
|
2715
2194
|
})`&:not([hidden]){display:block;}`, Hotkeys = forwardRef(function Hotkeys(props, ref) {
|
|
2716
2195
|
let $ = c(27), fontSize, gap, keys, padding, radius, restProps, t0;
|
|
2717
2196
|
$[0] === props ? (fontSize = $[1], gap = $[2], keys = $[3], padding = $[4], radius = $[5], restProps = $[6], t0 = $[7]) : ({fontSize, gap, keys, padding, radius, space: t0, ...restProps} = props, $[0] = props, $[1] = fontSize, $[2] = gap, $[3] = keys, $[4] = padding, $[5] = radius, $[6] = restProps, $[7] = t0);
|
|
@@ -2801,7 +2280,7 @@ function useMenuController(props) {
|
|
|
2801
2280
|
}, $[1] = t1) : t1 = $[1];
|
|
2802
2281
|
let setActiveIndex = t1, t2;
|
|
2803
2282
|
$[2] === rootElementRef ? t2 = $[3] : (t2 = (element, selected) => {
|
|
2804
|
-
if (!element) return _temp$
|
|
2283
|
+
if (!element) return _temp$3;
|
|
2805
2284
|
if (elementsRef.current.indexOf(element) === -1 && (elementsRef.current.push(element), _sortElements(rootElementRef.current, elementsRef.current)), selected) {
|
|
2806
2285
|
let selectedIndex = elementsRef.current.indexOf(element);
|
|
2807
2286
|
setActiveIndex(selectedIndex);
|
|
@@ -2904,10 +2383,10 @@ function useMenuController(props) {
|
|
|
2904
2383
|
mount
|
|
2905
2384
|
}, $[15] = activeElement, $[16] = activeIndex, $[17] = handleItemMouseLeave, $[18] = handleKeyDown, $[19] = mount, $[20] = t8) : t8 = $[20], t8;
|
|
2906
2385
|
}
|
|
2907
|
-
function _temp$
|
|
2386
|
+
function _temp$3() {}
|
|
2908
2387
|
const StyledMenu = styled(Box).withConfig({
|
|
2909
2388
|
displayName: "StyledMenu",
|
|
2910
|
-
componentId: "sc-
|
|
2389
|
+
componentId: "sc-xvs9y5-0"
|
|
2911
2390
|
})`outline:none;overflow:auto;`, Menu = forwardRef(function Menu(props, forwardedRef) {
|
|
2912
2391
|
let $ = c(50), _shouldFocus, children, gap, onClickOutside, onEscape, onItemClick, onItemSelect, onKeyDown, originElement, registerElement, restProps, t0, t1;
|
|
2913
2392
|
if ($[0] !== props) {
|
|
@@ -2972,7 +2451,7 @@ const StyledMenu = styled(Box).withConfig({
|
|
|
2972
2451
|
}), $[47] = t11, $[48] = value, $[49] = t12) : t12 = $[49], t12;
|
|
2973
2452
|
}), MenuDivider = styled.hr.withConfig({
|
|
2974
2453
|
displayName: "MenuDivider",
|
|
2975
|
-
componentId: "sc-
|
|
2454
|
+
componentId: "sc-sxuath-0"
|
|
2976
2455
|
})`height:1px;border:0;background:var(--card-hairline-soft-color);margin:0;`;
|
|
2977
2456
|
function selectableBaseStyle() {
|
|
2978
2457
|
return css`background-color:inherit;color:inherit;&[data-as='button']{-webkit-font-smoothing:inherit;appearance:none;outline:none;font:inherit;text-align:inherit;border:0;width:-moz-available;width:-webkit-fill-available;width:stretch;}&[data-as='a']{text-decoration:none;}`;
|
|
@@ -2986,7 +2465,7 @@ function selectableColorStyle(props) {
|
|
|
2986
2465
|
*/
|
|
2987
2466
|
const Selectable = /* @__PURE__ */ styled(Box).withConfig({
|
|
2988
2467
|
displayName: "Selectable",
|
|
2989
|
-
componentId: "sc-
|
|
2468
|
+
componentId: "sc-njdnrn-0"
|
|
2990
2469
|
})(responsiveRadiusStyle, selectableBaseStyle, selectableColorStyle);
|
|
2991
2470
|
function useMenu() {
|
|
2992
2471
|
let value = useContext(MenuContext);
|
|
@@ -3144,7 +2623,7 @@ const MenuGroup = function MenuGroup(props) {
|
|
|
3144
2623
|
paddingLeft
|
|
3145
2624
|
}, $[34] = padding, $[35] = paddingBottom, $[36] = paddingLeft, $[37] = paddingRight, $[38] = paddingTop, $[39] = paddingX, $[40] = paddingY, $[41] = t10) : t10 = $[41];
|
|
3146
2625
|
let paddingProps = t10, t11;
|
|
3147
|
-
$[42] === fontSize ? t11 = $[43] : (t11 = _getArrayProp(fontSize).map(_temp), $[42] = fontSize, $[43] = t11);
|
|
2626
|
+
$[42] === fontSize ? t11 = $[43] : (t11 = _getArrayProp(fontSize).map(_temp$2), $[42] = fontSize, $[43] = t11);
|
|
3148
2627
|
let hotkeysFontSize = t11, t12;
|
|
3149
2628
|
$[44] === Symbol.for("react.memo_cache_sentinel") ? (t12 = (el) => {
|
|
3150
2629
|
ref.current = el, setRootElement(el);
|
|
@@ -3216,12 +2695,12 @@ const MenuGroup = function MenuGroup(props) {
|
|
|
3216
2695
|
children: [t20, t21]
|
|
3217
2696
|
}), $[60] = as, $[61] = disabled, $[62] = handleClick, $[63] = onItemMouseEnter, $[64] = onItemMouseLeave, $[65] = restProps, $[66] = scheme, $[67] = t13, $[68] = t14, $[69] = t15, $[70] = t16, $[71] = t18, $[72] = t19, $[73] = t20, $[74] = t21, $[75] = t22) : t22 = $[75], t22;
|
|
3218
2697
|
});
|
|
3219
|
-
function _temp(s) {
|
|
2698
|
+
function _temp$2(s) {
|
|
3220
2699
|
return s - 1;
|
|
3221
2700
|
}
|
|
3222
2701
|
const CustomButton = styled(Button).withConfig({
|
|
3223
2702
|
displayName: "CustomButton",
|
|
3224
|
-
componentId: "sc-
|
|
2703
|
+
componentId: "sc-whlh6p-0"
|
|
3225
2704
|
})`max-width:100%;`, Tab = forwardRef(function Tab(props, forwardedRef) {
|
|
3226
2705
|
let $ = c(30), focused, icon, id, label, onClick, onFocus, restProps, selected, t0, t1;
|
|
3227
2706
|
$[0] === props ? (focused = $[1], icon = $[2], id = $[3], label = $[4], onClick = $[5], onFocus = $[6], restProps = $[7], selected = $[8], t0 = $[9], t1 = $[10]) : ({icon, id, focused, fontSize: t0, label, onClick, onFocus, padding: t1, selected, ...restProps} = props, $[0] = props, $[1] = focused, $[2] = icon, $[3] = id, $[4] = label, $[5] = onClick, $[6] = onFocus, $[7] = restProps, $[8] = selected, $[9] = t0, $[10] = t1);
|
|
@@ -3261,7 +2740,7 @@ const CustomButton = styled(Button).withConfig({
|
|
|
3261
2740
|
}), $[18] = fontSize, $[19] = handleFocus, $[20] = icon, $[21] = id, $[22] = label, $[23] = onClick, $[24] = padding, $[25] = restProps, $[26] = selected, $[27] = t7, $[28] = t8, $[29] = t9) : t9 = $[29], t9;
|
|
3262
2741
|
}), CustomInline = styled(Inline).withConfig({
|
|
3263
2742
|
displayName: "CustomInline",
|
|
3264
|
-
componentId: "sc-
|
|
2743
|
+
componentId: "sc-tlz8f1-0"
|
|
3265
2744
|
})`& > div{display:inline-block;vertical-align:middle;max-width:100%;box-sizing:border-box;}`, TabList = forwardRef(function TabList(props, ref) {
|
|
3266
2745
|
let $ = c(15), childrenProp, restProps;
|
|
3267
2746
|
$[0] === props ? (childrenProp = $[1], restProps = $[2]) : ({children: childrenProp, ...restProps} = props, $[0] = props, $[1] = childrenProp, $[2] = restProps);
|
|
@@ -3287,7 +2766,535 @@ const CustomButton = styled(Button).withConfig({
|
|
|
3287
2766
|
role: "tablist",
|
|
3288
2767
|
children: tabs
|
|
3289
2768
|
}), $[10] = handleKeyDown, $[11] = ref, $[12] = restProps, $[13] = tabs, $[14] = t2) : t2 = $[14], t2;
|
|
3290
|
-
})
|
|
3291
|
-
|
|
2769
|
+
}), GRID_CSS = {
|
|
2770
|
+
"&&:not([hidden])": { display: "grid" },
|
|
2771
|
+
"&[data-as=\"ul\"],&[data-as=\"ol\"]": { listStyle: "none" }
|
|
2772
|
+
}, GRID_AUTO_COLUMS = {
|
|
2773
|
+
auto: "auto",
|
|
2774
|
+
min: "min-content",
|
|
2775
|
+
max: "max-content",
|
|
2776
|
+
fr: "minmax(0, 1fr)"
|
|
2777
|
+
}, GRID_AUTO_ROWS = {
|
|
2778
|
+
auto: "auto",
|
|
2779
|
+
min: "min-content",
|
|
2780
|
+
max: "max-content",
|
|
2781
|
+
fr: "minmax(0, 1fr)"
|
|
2782
|
+
};
|
|
2783
|
+
function responsiveGridStyle() {
|
|
2784
|
+
return [
|
|
2785
|
+
GRID_CSS,
|
|
2786
|
+
responsiveGridAutoFlowStyle,
|
|
2787
|
+
responsiveGridAutoRowsStyle,
|
|
2788
|
+
responsiveGridAutoColsStyle,
|
|
2789
|
+
responsiveGridColumnsStyle,
|
|
2790
|
+
responsiveGridRowsStyle,
|
|
2791
|
+
responsiveGridGapStyle,
|
|
2792
|
+
responsiveGridGapXStyle,
|
|
2793
|
+
responsiveGridGapYStyle
|
|
2794
|
+
];
|
|
2795
|
+
}
|
|
2796
|
+
function responsiveGridAutoFlowStyle(props) {
|
|
2797
|
+
let { media } = getTheme_v2(props.theme);
|
|
2798
|
+
return _responsive(media, props.$autoFlow, (autoFlow) => ({ gridAutoFlow: autoFlow }));
|
|
2799
|
+
}
|
|
2800
|
+
function responsiveGridAutoRowsStyle(props) {
|
|
2801
|
+
let { media } = getTheme_v2(props.theme);
|
|
2802
|
+
return _responsive(media, props.$autoRows, (autoRows) => ({ gridAutoRows: autoRows && GRID_AUTO_ROWS[autoRows] }));
|
|
2803
|
+
}
|
|
2804
|
+
function responsiveGridAutoColsStyle(props) {
|
|
2805
|
+
let { media } = getTheme_v2(props.theme);
|
|
2806
|
+
return _responsive(media, props.$autoCols, (autoCols) => ({ gridAutoColumns: autoCols && GRID_AUTO_COLUMS[autoCols] }));
|
|
2807
|
+
}
|
|
2808
|
+
function responsiveGridColumnsStyle(props) {
|
|
2809
|
+
let { media } = getTheme_v2(props.theme);
|
|
2810
|
+
return _responsive(media, props.$columns, (columns) => ({ gridTemplateColumns: columns && `repeat(${columns},minmax(0,1fr));` }));
|
|
2811
|
+
}
|
|
2812
|
+
function responsiveGridRowsStyle(props) {
|
|
2813
|
+
let { media } = getTheme_v2(props.theme);
|
|
2814
|
+
return _responsive(media, props.$rows, (rows) => ({ gridTemplateRows: rows && `repeat(${rows},minmax(0,1fr));` }));
|
|
2815
|
+
}
|
|
2816
|
+
function responsiveGridGapStyle(props) {
|
|
2817
|
+
let { media, space } = getTheme_v2(props.theme);
|
|
2818
|
+
return _responsive(media, props.$gap, (gap) => ({ gridGap: gap ? rem(space[gap]) : void 0 }));
|
|
2819
|
+
}
|
|
2820
|
+
function responsiveGridGapXStyle(props) {
|
|
2821
|
+
let { media, space } = getTheme_v2(props.theme);
|
|
2822
|
+
return _responsive(media, props.$gapX, (gapX) => ({ columnGap: gapX ? rem(space[gapX]) : void 0 }));
|
|
2823
|
+
}
|
|
2824
|
+
function responsiveGridGapYStyle(props) {
|
|
2825
|
+
let { media, space } = getTheme_v2(props.theme);
|
|
2826
|
+
return _responsive(media, props.$gapY, (gapY) => ({ rowGap: gapY ? rem(space[gapY]) : void 0 }));
|
|
2827
|
+
}
|
|
2828
|
+
const StyledGrid = /* @__PURE__ */ styled(Box).withConfig({
|
|
2829
|
+
displayName: "StyledGrid",
|
|
2830
|
+
componentId: "sc-osmjhz-0"
|
|
2831
|
+
})(responsiveGridStyle), Grid = forwardRef(function Grid(props, ref) {
|
|
2832
|
+
let $ = c(44), as, autoCols, autoFlow, autoRows, children, columns, gap, gapX, gapY, gridTemplateColumns, gridTemplateRows, restProps, rows;
|
|
2833
|
+
$[0] === props ? (as = $[1], autoCols = $[2], autoFlow = $[3], autoRows = $[4], children = $[5], columns = $[6], gap = $[7], gapX = $[8], gapY = $[9], gridTemplateColumns = $[10], gridTemplateRows = $[11], restProps = $[12], rows = $[13]) : ({as, autoRows, autoCols, autoFlow, columns, gridTemplateColumns, gap, gapX, gapY, rows, gridTemplateRows, children, ...restProps} = props, $[0] = props, $[1] = as, $[2] = autoCols, $[3] = autoFlow, $[4] = autoRows, $[5] = children, $[6] = columns, $[7] = gap, $[8] = gapX, $[9] = gapY, $[10] = gridTemplateColumns, $[11] = gridTemplateRows, $[12] = restProps, $[13] = rows);
|
|
2834
|
+
let t0 = typeof as == "string" ? as : void 0, t1;
|
|
2835
|
+
$[14] === autoRows ? t1 = $[15] : (t1 = _getArrayProp(autoRows), $[14] = autoRows, $[15] = t1);
|
|
2836
|
+
let t2;
|
|
2837
|
+
$[16] === autoCols ? t2 = $[17] : (t2 = _getArrayProp(autoCols), $[16] = autoCols, $[17] = t2);
|
|
2838
|
+
let t3;
|
|
2839
|
+
$[18] === autoFlow ? t3 = $[19] : (t3 = _getArrayProp(autoFlow), $[18] = autoFlow, $[19] = t3);
|
|
2840
|
+
let t4 = gridTemplateColumns === void 0 ? columns : gridTemplateColumns, t5;
|
|
2841
|
+
$[20] === t4 ? t5 = $[21] : (t5 = _getArrayProp(t4), $[20] = t4, $[21] = t5);
|
|
2842
|
+
let t6;
|
|
2843
|
+
$[22] === gap ? t6 = $[23] : (t6 = _getArrayProp(gap), $[22] = gap, $[23] = t6);
|
|
2844
|
+
let t7;
|
|
2845
|
+
$[24] === gapX ? t7 = $[25] : (t7 = _getArrayProp(gapX), $[24] = gapX, $[25] = t7);
|
|
2846
|
+
let t8;
|
|
2847
|
+
$[26] === gapY ? t8 = $[27] : (t8 = _getArrayProp(gapY), $[26] = gapY, $[27] = t8);
|
|
2848
|
+
let t9 = gridTemplateRows === void 0 ? rows : gridTemplateRows, t10;
|
|
2849
|
+
$[28] === t9 ? t10 = $[29] : (t10 = _getArrayProp(t9), $[28] = t9, $[29] = t10);
|
|
2850
|
+
let t11;
|
|
2851
|
+
return $[30] !== as || $[31] !== children || $[32] !== ref || $[33] !== restProps || $[34] !== t0 || $[35] !== t1 || $[36] !== t10 || $[37] !== t2 || $[38] !== t3 || $[39] !== t5 || $[40] !== t6 || $[41] !== t7 || $[42] !== t8 ? (t11 = /* @__PURE__ */ jsx(StyledGrid, {
|
|
2852
|
+
"data-as": t0,
|
|
2853
|
+
"data-ui": "Grid",
|
|
2854
|
+
...restProps,
|
|
2855
|
+
$autoRows: t1,
|
|
2856
|
+
$autoCols: t2,
|
|
2857
|
+
$autoFlow: t3,
|
|
2858
|
+
$columns: t5,
|
|
2859
|
+
$gap: t6,
|
|
2860
|
+
$gapX: t7,
|
|
2861
|
+
$gapY: t8,
|
|
2862
|
+
$rows: t10,
|
|
2863
|
+
forwardedAs: as,
|
|
2864
|
+
ref,
|
|
2865
|
+
children
|
|
2866
|
+
}), $[30] = as, $[31] = children, $[32] = ref, $[33] = restProps, $[34] = t0, $[35] = t1, $[36] = t10, $[37] = t2, $[38] = t3, $[39] = t5, $[40] = t6, $[41] = t7, $[42] = t8, $[43] = t11) : t11 = $[43], t11;
|
|
2867
|
+
});
|
|
2868
|
+
/**
|
|
2869
|
+
* Returns true if a dark color scheme is preferred, false if a light color scheme is preferred or the preference is not known.
|
|
2870
|
+
*
|
|
2871
|
+
* @param getServerSnapshot - Only called during server-side rendering, and hydration if using hydrateRoot. Since the server environment doesn't have access to the DOM, we can't determine the current value of the media query and we assume `(prefers-color-scheme: light)` since it's the most common scheme (https://react.dev/reference/react/useSyncExternalStore#adding-support-for-server-rendering)
|
|
2872
|
+
*
|
|
2873
|
+
* If you persist the detected preference in a cookie or a header then you may implement your own server snapshot to read it.
|
|
2874
|
+
* Chrome supports reading the `prefers-color-scheme` media query from a header if the server response: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Sec-CH-Prefers-Color-Scheme
|
|
2875
|
+
* @example https://gist.github.com/stipsan/13c0cccf8dfc34f4b44bb1b984baf7df
|
|
2876
|
+
*
|
|
2877
|
+
* @public
|
|
2878
|
+
*/
|
|
2879
|
+
function usePrefersDark(t0) {
|
|
2880
|
+
return useMatchMedia("(prefers-color-scheme: dark)", t0 === void 0 ? _temp$1 : t0);
|
|
2881
|
+
}
|
|
2882
|
+
function _temp$1() {
|
|
2883
|
+
return !1;
|
|
2884
|
+
}
|
|
2885
|
+
/**
|
|
2886
|
+
* @beta
|
|
2887
|
+
*/
|
|
2888
|
+
function useDelayedState(initialState) {
|
|
2889
|
+
let $ = c(5), [state, setState] = useState(initialState), delayedAction = useRef(void 0), t0;
|
|
2890
|
+
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = (nextState, delay) => {
|
|
2891
|
+
let action = () => {
|
|
2892
|
+
setState(nextState);
|
|
2893
|
+
};
|
|
2894
|
+
if (delayedAction.current &&= (clearTimeout(delayedAction.current), void 0), !delay) return action();
|
|
2895
|
+
delayedAction.current = setTimeout(action, delay);
|
|
2896
|
+
}, $[0] = t0) : t0 = $[0];
|
|
2897
|
+
let onStateChange = t0, t1, t2;
|
|
2898
|
+
$[1] === Symbol.for("react.memo_cache_sentinel") ? (t1 = () => () => {
|
|
2899
|
+
delayedAction.current && clearTimeout(delayedAction.current);
|
|
2900
|
+
}, t2 = [], $[1] = t1, $[2] = t2) : (t1 = $[1], t2 = $[2]), useEffect(t1, t2);
|
|
2901
|
+
let t3;
|
|
2902
|
+
return $[3] === state ? t3 = $[4] : (t3 = [state, onStateChange], $[3] = state, $[4] = t3), t3;
|
|
2903
|
+
}
|
|
2904
|
+
const DEFAULT_FALLBACK_PLACEMENTS = {
|
|
2905
|
+
top: [
|
|
2906
|
+
"top-end",
|
|
2907
|
+
"top-start",
|
|
2908
|
+
"bottom",
|
|
2909
|
+
"left",
|
|
2910
|
+
"right"
|
|
2911
|
+
],
|
|
2912
|
+
"top-start": [
|
|
2913
|
+
"top",
|
|
2914
|
+
"top-end",
|
|
2915
|
+
"bottom-start",
|
|
2916
|
+
"left-start",
|
|
2917
|
+
"right-start"
|
|
2918
|
+
],
|
|
2919
|
+
"top-end": [
|
|
2920
|
+
"top",
|
|
2921
|
+
"top-start",
|
|
2922
|
+
"bottom-end",
|
|
2923
|
+
"left-end",
|
|
2924
|
+
"right-end"
|
|
2925
|
+
],
|
|
2926
|
+
bottom: [
|
|
2927
|
+
"bottom-end",
|
|
2928
|
+
"bottom-start",
|
|
2929
|
+
"top",
|
|
2930
|
+
"left",
|
|
2931
|
+
"right"
|
|
2932
|
+
],
|
|
2933
|
+
"bottom-start": [
|
|
2934
|
+
"bottom",
|
|
2935
|
+
"bottom-end",
|
|
2936
|
+
"top-start",
|
|
2937
|
+
"left-start",
|
|
2938
|
+
"right-start"
|
|
2939
|
+
],
|
|
2940
|
+
"bottom-end": [
|
|
2941
|
+
"bottom",
|
|
2942
|
+
"bottom-start",
|
|
2943
|
+
"top-end",
|
|
2944
|
+
"left-end",
|
|
2945
|
+
"right-end"
|
|
2946
|
+
],
|
|
2947
|
+
left: [
|
|
2948
|
+
"left-end",
|
|
2949
|
+
"left-start",
|
|
2950
|
+
"right",
|
|
2951
|
+
"top",
|
|
2952
|
+
"bottom"
|
|
2953
|
+
],
|
|
2954
|
+
"left-start": [
|
|
2955
|
+
"left",
|
|
2956
|
+
"left-end",
|
|
2957
|
+
"right-start",
|
|
2958
|
+
"top-start",
|
|
2959
|
+
"bottom-start"
|
|
2960
|
+
],
|
|
2961
|
+
"left-end": [
|
|
2962
|
+
"left",
|
|
2963
|
+
"left-start",
|
|
2964
|
+
"right-end",
|
|
2965
|
+
"top-end",
|
|
2966
|
+
"bottom-end"
|
|
2967
|
+
],
|
|
2968
|
+
right: [
|
|
2969
|
+
"right-end",
|
|
2970
|
+
"right-start",
|
|
2971
|
+
"left",
|
|
2972
|
+
"top",
|
|
2973
|
+
"bottom"
|
|
2974
|
+
],
|
|
2975
|
+
"right-start": [
|
|
2976
|
+
"right",
|
|
2977
|
+
"right-end",
|
|
2978
|
+
"left-start",
|
|
2979
|
+
"top-start",
|
|
2980
|
+
"bottom-start"
|
|
2981
|
+
],
|
|
2982
|
+
"right-end": [
|
|
2983
|
+
"right",
|
|
2984
|
+
"right-start",
|
|
2985
|
+
"left-end",
|
|
2986
|
+
"top-end",
|
|
2987
|
+
"bottom-end"
|
|
2988
|
+
]
|
|
2989
|
+
}, MotionCard = styled(motion.create(Card)).withConfig({
|
|
2990
|
+
displayName: "MotionCard",
|
|
2991
|
+
componentId: "sc-k6wgsf-0"
|
|
2992
|
+
})`will-change:transform;`, TooltipCard = forwardRef(function TooltipCard(props, ref) {
|
|
2993
|
+
let $ = c(48), animate, arrow, arrowRef, arrowX, arrowY, children, originX, originY, padding, placement, radius, restProps, scheme, shadow, style;
|
|
2994
|
+
$[0] === props ? (animate = $[1], arrow = $[2], arrowRef = $[3], arrowX = $[4], arrowY = $[5], children = $[6], originX = $[7], originY = $[8], padding = $[9], placement = $[10], radius = $[11], restProps = $[12], scheme = $[13], shadow = $[14], style = $[15]) : ({animate, arrow, arrowRef, arrowX, arrowY, children, originX, originY, padding, placement, radius, scheme, shadow, style, ...restProps} = props, $[0] = props, $[1] = animate, $[2] = arrow, $[3] = arrowRef, $[4] = arrowX, $[5] = arrowY, $[6] = children, $[7] = originX, $[8] = originY, $[9] = padding, $[10] = placement, $[11] = radius, $[12] = restProps, $[13] = scheme, $[14] = shadow, $[15] = style);
|
|
2995
|
+
let t0 = animate ? "transform" : void 0, t1;
|
|
2996
|
+
$[16] !== originX || $[17] !== originY || $[18] !== style || $[19] !== t0 ? (t1 = {
|
|
2997
|
+
originX,
|
|
2998
|
+
originY,
|
|
2999
|
+
willChange: t0,
|
|
3000
|
+
...style
|
|
3001
|
+
}, $[16] = originX, $[17] = originY, $[18] = style, $[19] = t0, $[20] = t1) : t1 = $[20];
|
|
3002
|
+
let rootStyle = t1, t2 = arrowX === null ? void 0 : arrowX, t3 = arrowY === null ? void 0 : arrowY, t4;
|
|
3003
|
+
$[21] !== t2 || $[22] !== t3 ? (t4 = {
|
|
3004
|
+
left: t2,
|
|
3005
|
+
top: t3,
|
|
3006
|
+
right: void 0,
|
|
3007
|
+
bottom: void 0
|
|
3008
|
+
}, $[21] = t2, $[22] = t3, $[23] = t4) : t4 = $[23];
|
|
3009
|
+
let arrowStyle = t4, t5 = restProps, t6;
|
|
3010
|
+
$[24] === animate ? t6 = $[25] : (t6 = animate ? ["hidden", "initial"] : void 0, $[24] = animate, $[25] = t6);
|
|
3011
|
+
let t7;
|
|
3012
|
+
$[26] === animate ? t7 = $[27] : (t7 = animate ? ["visible", "scaleIn"] : void 0, $[26] = animate, $[27] = t7);
|
|
3013
|
+
let t8;
|
|
3014
|
+
$[28] === animate ? t8 = $[29] : (t8 = animate ? ["hidden", "scaleOut"] : void 0, $[28] = animate, $[29] = t8);
|
|
3015
|
+
let t9;
|
|
3016
|
+
$[30] !== arrow || $[31] !== arrowRef || $[32] !== arrowStyle ? (t9 = arrow && /* @__PURE__ */ jsx(Arrow, {
|
|
3017
|
+
ref: arrowRef,
|
|
3018
|
+
style: arrowStyle,
|
|
3019
|
+
width: 15,
|
|
3020
|
+
height: 6,
|
|
3021
|
+
radius: 2
|
|
3022
|
+
}), $[30] = arrow, $[31] = arrowRef, $[32] = arrowStyle, $[33] = t9) : t9 = $[33];
|
|
3023
|
+
let t10;
|
|
3024
|
+
return $[34] !== children || $[35] !== padding || $[36] !== placement || $[37] !== radius || $[38] !== ref || $[39] !== rootStyle || $[40] !== scheme || $[41] !== shadow || $[42] !== t5 || $[43] !== t6 || $[44] !== t7 || $[45] !== t8 || $[46] !== t9 ? (t10 = /* @__PURE__ */ jsxs(MotionCard, {
|
|
3025
|
+
"data-ui": "Tooltip__card",
|
|
3026
|
+
...t5,
|
|
3027
|
+
"data-placement": placement,
|
|
3028
|
+
padding,
|
|
3029
|
+
radius,
|
|
3030
|
+
ref,
|
|
3031
|
+
scheme,
|
|
3032
|
+
shadow,
|
|
3033
|
+
style: rootStyle,
|
|
3034
|
+
variants: POPOVER_MOTION_PROPS.card,
|
|
3035
|
+
transition: POPOVER_MOTION_PROPS.transition,
|
|
3036
|
+
initial: t6,
|
|
3037
|
+
animate: t7,
|
|
3038
|
+
exit: t8,
|
|
3039
|
+
children: [children, t9]
|
|
3040
|
+
}), $[34] = children, $[35] = padding, $[36] = placement, $[37] = radius, $[38] = ref, $[39] = rootStyle, $[40] = scheme, $[41] = shadow, $[42] = t5, $[43] = t6, $[44] = t7, $[45] = t8, $[46] = t9, $[47] = t10) : t10 = $[47], t10;
|
|
3041
|
+
}), TooltipDelayGroupContext = createGlobalScopedContext("@sanity/ui/context/tooltipDelayGroup", null);
|
|
3042
|
+
/**
|
|
3043
|
+
* @beta
|
|
3044
|
+
*/
|
|
3045
|
+
function useTooltipDelayGroup() {
|
|
3046
|
+
return useContext(TooltipDelayGroupContext);
|
|
3047
|
+
}
|
|
3048
|
+
const StyledTooltip = styled(Layer).withConfig({
|
|
3049
|
+
displayName: "StyledTooltip",
|
|
3050
|
+
componentId: "sc-4nppkj-0"
|
|
3051
|
+
})`pointer-events:none;`, Tooltip = forwardRef(function Tooltip(props, forwardedRef) {
|
|
3052
|
+
let $ = c(137), boundaryElementContext = useBoundaryElement(), { layer } = useTheme_v2(), _boundaryElement, _fallbackPlacementsProp, _zOffset, childProp, content, delay, disabled, portalProp, restProps, scheme, t0, t1, t2, t3, t4, t5;
|
|
3053
|
+
$[0] === props ? (_boundaryElement = $[1], _fallbackPlacementsProp = $[2], _zOffset = $[3], childProp = $[4], content = $[5], delay = $[6], disabled = $[7], portalProp = $[8], restProps = $[9], scheme = $[10], t0 = $[11], t1 = $[12], t2 = $[13], t3 = $[14], t4 = $[15], t5 = $[16]) : ({animate: t0, arrow: t1, boundaryElement: _boundaryElement, children: childProp, content, disabled, fallbackPlacements: _fallbackPlacementsProp, padding: t2, placement: t3, portal: portalProp, radius: t4, scheme, shadow: t5, zOffset: _zOffset, delay, ...restProps} = props, $[0] = props, $[1] = _boundaryElement, $[2] = _fallbackPlacementsProp, $[3] = _zOffset, $[4] = childProp, $[5] = content, $[6] = delay, $[7] = disabled, $[8] = portalProp, $[9] = restProps, $[10] = scheme, $[11] = t0, $[12] = t1, $[13] = t2, $[14] = t3, $[15] = t4, $[16] = t5);
|
|
3054
|
+
let _animate = t0 !== void 0 && t0, arrowProp = t1 !== void 0 && t1, padding = t2 === void 0 ? 2 : t2, placementProp = t3 === void 0 ? "bottom" : t3, radius = t4 === void 0 ? 2 : t4, shadow = t5 === void 0 ? 2 : t5, boundaryElement = _boundaryElement ?? boundaryElementContext?.element, fallbackPlacementsProp = _fallbackPlacementsProp ?? DEFAULT_FALLBACK_PLACEMENTS[props.placement ?? "bottom"], zOffset = _zOffset ?? layer.tooltip.zOffset, animate = !usePrefersReducedMotion() && _animate, t6;
|
|
3055
|
+
$[17] === fallbackPlacementsProp ? t6 = $[18] : (t6 = _getArrayProp(fallbackPlacementsProp), $[17] = fallbackPlacementsProp, $[18] = t6);
|
|
3056
|
+
let fallbackPlacements = t6, ref = useRef(null), [referenceElement, setReferenceElement] = useState(null), arrowRef = useRef(null), [tooltipMaxWidth, setTooltipMaxWidth] = useState(0), t7;
|
|
3057
|
+
$[19] === Symbol.for("react.memo_cache_sentinel") ? (t7 = () => ref.current, $[19] = t7) : t7 = $[19], useImperativeHandle(forwardedRef, t7);
|
|
3058
|
+
let portal = usePortal(), portalElement = typeof portalProp == "string" ? portal.elements?.[portalProp] || null : portal.element, t8;
|
|
3059
|
+
$[20] !== animate || $[21] !== arrowProp || $[22] !== boundaryElement || $[23] !== fallbackPlacements ? (t8 = {
|
|
3060
|
+
animate,
|
|
3061
|
+
arrowProp,
|
|
3062
|
+
arrowRef,
|
|
3063
|
+
boundaryElement,
|
|
3064
|
+
fallbackPlacements,
|
|
3065
|
+
rootBoundary: "viewport"
|
|
3066
|
+
}, $[20] = animate, $[21] = arrowProp, $[22] = boundaryElement, $[23] = fallbackPlacements, $[24] = t8) : t8 = $[24];
|
|
3067
|
+
let middleware = useMiddleware(t8), t9;
|
|
3068
|
+
$[25] === referenceElement ? t9 = $[26] : (t9 = { reference: referenceElement }, $[25] = referenceElement, $[26] = t9);
|
|
3069
|
+
let t10;
|
|
3070
|
+
$[27] !== middleware || $[28] !== placementProp || $[29] !== t9 ? (t10 = {
|
|
3071
|
+
middleware,
|
|
3072
|
+
placement: placementProp,
|
|
3073
|
+
whileElementsMounted: autoUpdate,
|
|
3074
|
+
elements: t9
|
|
3075
|
+
}, $[27] = middleware, $[28] = placementProp, $[29] = t9, $[30] = t10) : t10 = $[30];
|
|
3076
|
+
let { floatingStyles, placement, middlewareData, refs, update } = useFloating(t10), arrowX = middlewareData.arrow?.x, arrowY = middlewareData.arrow?.y, originX = middlewareData["@sanity/ui/origin"]?.originX, originY = middlewareData["@sanity/ui/origin"]?.originY, tooltipId = useId(), [isOpen, setIsOpen] = useDelayedState(!1), delayGroupContext = useTooltipDelayGroup(), t11;
|
|
3077
|
+
$[31] === delayGroupContext ? t11 = $[32] : (t11 = delayGroupContext || {}, $[31] = delayGroupContext, $[32] = t11);
|
|
3078
|
+
let { setIsGroupActive, setOpenTooltipId } = t11, showTooltip = isOpen || delayGroupContext?.openTooltipId === tooltipId, isInsideGroup = delayGroupContext !== null, openDelayProp = typeof delay == "number" ? delay : delay?.open || 0, closeDelayProp = typeof delay == "number" ? delay : delay?.close || 0, openDelay = isInsideGroup ? delayGroupContext.openDelay : openDelayProp, closeDelay = isInsideGroup ? delayGroupContext.closeDelay : closeDelayProp, t12;
|
|
3079
|
+
$[33] !== closeDelay || $[34] !== isInsideGroup || $[35] !== openDelay || $[36] !== setIsGroupActive || $[37] !== setIsOpen || $[38] !== setOpenTooltipId || $[39] !== tooltipId ? (t12 = (open, immediate) => {
|
|
3080
|
+
if (isInsideGroup) if (open) {
|
|
3081
|
+
let groupedOpenDelay = immediate ? 0 : openDelay;
|
|
3082
|
+
setIsGroupActive?.(open, groupedOpenDelay), setOpenTooltipId?.(tooltipId, groupedOpenDelay);
|
|
3083
|
+
} else setIsGroupActive?.(open, closeDelay > 200 ? closeDelay : 200), setOpenTooltipId?.(null, immediate ? 0 : closeDelay);
|
|
3084
|
+
else setIsOpen(open, immediate ? 0 : open ? openDelay : closeDelay);
|
|
3085
|
+
}, $[33] = closeDelay, $[34] = isInsideGroup, $[35] = openDelay, $[36] = setIsGroupActive, $[37] = setIsOpen, $[38] = setOpenTooltipId, $[39] = tooltipId, $[40] = t12) : t12 = $[40];
|
|
3086
|
+
let handleIsOpenChange = t12, t13;
|
|
3087
|
+
$[41] !== childProp?.props || $[42] !== handleIsOpenChange ? (t13 = (e) => {
|
|
3088
|
+
handleIsOpenChange(!1), childProp?.props?.onBlur?.(e);
|
|
3089
|
+
}, $[41] = childProp?.props, $[42] = handleIsOpenChange, $[43] = t13) : t13 = $[43], childProp?.props;
|
|
3090
|
+
let handleBlur = t13, t14;
|
|
3091
|
+
$[44] !== childProp?.props || $[45] !== handleIsOpenChange ? (t14 = (e_0) => {
|
|
3092
|
+
handleIsOpenChange(!1, !0), childProp?.props.onClick?.(e_0);
|
|
3093
|
+
}, $[44] = childProp?.props, $[45] = handleIsOpenChange, $[46] = t14) : t14 = $[46], childProp?.props;
|
|
3094
|
+
let handleClick = t14, t15;
|
|
3095
|
+
$[47] !== childProp?.props || $[48] !== handleIsOpenChange ? (t15 = (e_1) => {
|
|
3096
|
+
handleIsOpenChange(!1, !0), childProp?.props.onContextMenu?.(e_1);
|
|
3097
|
+
}, $[47] = childProp?.props, $[48] = handleIsOpenChange, $[49] = t15) : t15 = $[49], childProp?.props;
|
|
3098
|
+
let handleContextMenu = t15, t16;
|
|
3099
|
+
$[50] !== childProp?.props || $[51] !== handleIsOpenChange ? (t16 = (e_2) => {
|
|
3100
|
+
handleIsOpenChange(!0), childProp?.props?.onFocus?.(e_2);
|
|
3101
|
+
}, $[50] = childProp?.props, $[51] = handleIsOpenChange, $[52] = t16) : t16 = $[52], childProp?.props;
|
|
3102
|
+
let handleFocus = t16, t17;
|
|
3103
|
+
$[53] !== childProp?.props || $[54] !== handleIsOpenChange ? (t17 = (e_3) => {
|
|
3104
|
+
handleIsOpenChange(!0), childProp?.props?.onMouseEnter?.(e_3);
|
|
3105
|
+
}, $[53] = childProp?.props, $[54] = handleIsOpenChange, $[55] = t17) : t17 = $[55], childProp?.props;
|
|
3106
|
+
let handleMouseEnter = t17, t18;
|
|
3107
|
+
$[56] !== childProp?.props || $[57] !== handleIsOpenChange ? (t18 = (e_4) => {
|
|
3108
|
+
handleIsOpenChange(!1), childProp?.props?.onMouseLeave?.(e_4);
|
|
3109
|
+
}, $[56] = childProp?.props, $[57] = handleIsOpenChange, $[58] = t18) : t18 = $[58], childProp?.props;
|
|
3110
|
+
let handleMouseLeave = t18, t19;
|
|
3111
|
+
$[59] !== handleIsOpenChange || $[60] !== isInsideGroup || $[61] !== referenceElement || $[62] !== showTooltip ? (t19 = {
|
|
3112
|
+
handleIsOpenChange,
|
|
3113
|
+
referenceElement,
|
|
3114
|
+
showTooltip,
|
|
3115
|
+
isInsideGroup
|
|
3116
|
+
}, $[59] = handleIsOpenChange, $[60] = isInsideGroup, $[61] = referenceElement, $[62] = showTooltip, $[63] = t19) : t19 = $[63], useCloseOnMouseLeave(t19);
|
|
3117
|
+
let t20, t21;
|
|
3118
|
+
$[64] !== disabled || $[65] !== handleIsOpenChange || $[66] !== showTooltip ? (t20 = () => {
|
|
3119
|
+
disabled && showTooltip && handleIsOpenChange(!1);
|
|
3120
|
+
}, t21 = [
|
|
3121
|
+
disabled,
|
|
3122
|
+
handleIsOpenChange,
|
|
3123
|
+
showTooltip
|
|
3124
|
+
], $[64] = disabled, $[65] = handleIsOpenChange, $[66] = showTooltip, $[67] = t20, $[68] = t21) : (t20 = $[67], t21 = $[68]), useEffect(t20, t21);
|
|
3125
|
+
let t22, t23;
|
|
3126
|
+
$[69] !== content || $[70] !== handleIsOpenChange || $[71] !== showTooltip ? (t22 = () => {
|
|
3127
|
+
!content && showTooltip && handleIsOpenChange(!1);
|
|
3128
|
+
}, t23 = [
|
|
3129
|
+
content,
|
|
3130
|
+
handleIsOpenChange,
|
|
3131
|
+
showTooltip
|
|
3132
|
+
], $[69] = content, $[70] = handleIsOpenChange, $[71] = showTooltip, $[72] = t22, $[73] = t23) : (t22 = $[72], t23 = $[73]), useEffect(t22, t23);
|
|
3133
|
+
let t24, t25;
|
|
3134
|
+
$[74] !== handleIsOpenChange || $[75] !== showTooltip ? (t24 = () => {
|
|
3135
|
+
if (!showTooltip) return;
|
|
3136
|
+
let handleWindowKeyDown = function handleWindowKeyDown(event) {
|
|
3137
|
+
event.key === "Escape" && handleIsOpenChange(!1, !0);
|
|
3138
|
+
};
|
|
3139
|
+
return window.addEventListener("keydown", handleWindowKeyDown), () => {
|
|
3140
|
+
window.removeEventListener("keydown", handleWindowKeyDown);
|
|
3141
|
+
};
|
|
3142
|
+
}, t25 = [handleIsOpenChange, showTooltip], $[74] = handleIsOpenChange, $[75] = showTooltip, $[76] = t24, $[77] = t25) : (t24 = $[76], t25 = $[77]), useEffect(t24, t25);
|
|
3143
|
+
let t26;
|
|
3144
|
+
$[78] !== boundaryElement || $[79] !== portalElement?.offsetWidth ? (t26 = () => {
|
|
3145
|
+
let availableWidths = [...boundaryElement ? [boundaryElement.offsetWidth] : [], portalElement?.offsetWidth || document.body.offsetWidth];
|
|
3146
|
+
setTooltipMaxWidth(Math.min(...availableWidths) - 8);
|
|
3147
|
+
}, $[78] = boundaryElement, $[79] = portalElement?.offsetWidth, $[80] = t26) : t26 = $[80];
|
|
3148
|
+
let t27;
|
|
3149
|
+
$[81] !== boundaryElement || $[82] !== portalElement ? (t27 = [boundaryElement, portalElement], $[81] = boundaryElement, $[82] = portalElement, $[83] = t27) : t27 = $[83], useLayoutEffect(t26, t27);
|
|
3150
|
+
let t28;
|
|
3151
|
+
$[84] === update ? t28 = $[85] : (t28 = (arrowEl) => {
|
|
3152
|
+
arrowRef.current = arrowEl, update();
|
|
3153
|
+
}, $[84] = update, $[85] = t28);
|
|
3154
|
+
let setArrow = t28, t29;
|
|
3155
|
+
$[86] === refs ? t29 = $[87] : (t29 = (node) => {
|
|
3156
|
+
ref.current = node, refs.setFloating(node);
|
|
3157
|
+
}, $[86] = refs, $[87] = t29);
|
|
3158
|
+
let setFloating = t29, t30;
|
|
3159
|
+
bb0: {
|
|
3160
|
+
if (!childProp) {
|
|
3161
|
+
t30 = null;
|
|
3162
|
+
break bb0;
|
|
3163
|
+
}
|
|
3164
|
+
let t31;
|
|
3165
|
+
$[88] !== childProp || $[89] !== handleBlur || $[90] !== handleClick || $[91] !== handleContextMenu || $[92] !== handleFocus || $[93] !== handleMouseEnter || $[94] !== handleMouseLeave ? (t31 = cloneElement(childProp, {
|
|
3166
|
+
onBlur: handleBlur,
|
|
3167
|
+
onFocus: handleFocus,
|
|
3168
|
+
onMouseEnter: handleMouseEnter,
|
|
3169
|
+
onMouseLeave: handleMouseLeave,
|
|
3170
|
+
onClick: handleClick,
|
|
3171
|
+
onContextMenu: handleContextMenu,
|
|
3172
|
+
ref: setReferenceElement
|
|
3173
|
+
}), $[88] = childProp, $[89] = handleBlur, $[90] = handleClick, $[91] = handleContextMenu, $[92] = handleFocus, $[93] = handleMouseEnter, $[94] = handleMouseLeave, $[95] = t31) : t31 = $[95], t30 = t31;
|
|
3174
|
+
}
|
|
3175
|
+
let child = t30, t31;
|
|
3176
|
+
$[96] === childProp ? t31 = $[97] : (t31 = childProp ? getElementRef(childProp) : null, $[96] = childProp, $[97] = t31);
|
|
3177
|
+
let t32, t33;
|
|
3178
|
+
if ($[98] === referenceElement ? (t32 = $[99], t33 = $[100]) : (t32 = () => referenceElement, t33 = [referenceElement], $[98] = referenceElement, $[99] = t32, $[100] = t33), useImperativeHandle(t31, t32, t33), !child) {
|
|
3179
|
+
let t34;
|
|
3180
|
+
return $[101] === Symbol.for("react.memo_cache_sentinel") ? (t34 = /* @__PURE__ */ jsx(Fragment$1, {}), $[101] = t34) : t34 = $[101], t34;
|
|
3181
|
+
}
|
|
3182
|
+
if (disabled) return child;
|
|
3183
|
+
let t34 = tooltipMaxWidth > 0 ? `${tooltipMaxWidth}px` : void 0, t35;
|
|
3184
|
+
$[102] !== floatingStyles || $[103] !== t34 ? (t35 = {
|
|
3185
|
+
...floatingStyles,
|
|
3186
|
+
maxWidth: t34
|
|
3187
|
+
}, $[102] = floatingStyles, $[103] = t34, $[104] = t35) : t35 = $[104];
|
|
3188
|
+
let t36;
|
|
3189
|
+
$[105] !== animate || $[106] !== arrowProp || $[107] !== arrowX || $[108] !== arrowY || $[109] !== content || $[110] !== originX || $[111] !== originY || $[112] !== padding || $[113] !== placement || $[114] !== radius || $[115] !== restProps || $[116] !== scheme || $[117] !== setArrow || $[118] !== setFloating || $[119] !== shadow ? (t36 = /* @__PURE__ */ jsx(TooltipCard, {
|
|
3190
|
+
...restProps,
|
|
3191
|
+
animate,
|
|
3192
|
+
arrow: arrowProp,
|
|
3193
|
+
arrowRef: setArrow,
|
|
3194
|
+
arrowX,
|
|
3195
|
+
arrowY,
|
|
3196
|
+
originX,
|
|
3197
|
+
originY,
|
|
3198
|
+
padding,
|
|
3199
|
+
placement,
|
|
3200
|
+
radius,
|
|
3201
|
+
ref: setFloating,
|
|
3202
|
+
scheme,
|
|
3203
|
+
shadow,
|
|
3204
|
+
children: content
|
|
3205
|
+
}), $[105] = animate, $[106] = arrowProp, $[107] = arrowX, $[108] = arrowY, $[109] = content, $[110] = originX, $[111] = originY, $[112] = padding, $[113] = placement, $[114] = radius, $[115] = restProps, $[116] = scheme, $[117] = setArrow, $[118] = setFloating, $[119] = shadow, $[120] = t36) : t36 = $[120];
|
|
3206
|
+
let t37;
|
|
3207
|
+
$[121] !== restProps || $[122] !== setFloating || $[123] !== t35 || $[124] !== t36 || $[125] !== zOffset ? (t37 = /* @__PURE__ */ jsx(StyledTooltip, {
|
|
3208
|
+
"data-ui": "Tooltip",
|
|
3209
|
+
...restProps,
|
|
3210
|
+
ref: setFloating,
|
|
3211
|
+
style: t35,
|
|
3212
|
+
zOffset,
|
|
3213
|
+
children: t36
|
|
3214
|
+
}), $[121] = restProps, $[122] = setFloating, $[123] = t35, $[124] = t36, $[125] = zOffset, $[126] = t37) : t37 = $[126];
|
|
3215
|
+
let tooltip = t37, t38;
|
|
3216
|
+
$[127] !== portalProp || $[128] !== showTooltip || $[129] !== tooltip ? (t38 = showTooltip && (portalProp ? /* @__PURE__ */ jsx(Portal, {
|
|
3217
|
+
__unstable_name: typeof portalProp == "string" ? portalProp : void 0,
|
|
3218
|
+
children: tooltip
|
|
3219
|
+
}) : tooltip), $[127] = portalProp, $[128] = showTooltip, $[129] = tooltip, $[130] = t38) : t38 = $[130];
|
|
3220
|
+
let children = t38, t39;
|
|
3221
|
+
$[131] !== animate || $[132] !== children ? (t39 = animate ? /* @__PURE__ */ jsx(AnimatePresence, { children }) : children, $[131] = animate, $[132] = children, $[133] = t39) : t39 = $[133];
|
|
3222
|
+
let t40;
|
|
3223
|
+
return $[134] !== child || $[135] !== t39 ? (t40 = /* @__PURE__ */ jsxs(Fragment$1, { children: [t39, child] }), $[134] = child, $[135] = t39, $[136] = t40) : t40 = $[136], t40;
|
|
3224
|
+
});
|
|
3225
|
+
function useMiddleware(t0) {
|
|
3226
|
+
let $ = c(17), { animate, arrowProp, arrowRef, boundaryElement, fallbackPlacements, rootBoundary } = t0, ret;
|
|
3227
|
+
if ($[0] !== animate || $[1] !== arrowProp || $[2] !== arrowRef || $[3] !== boundaryElement || $[4] !== fallbackPlacements || $[5] !== rootBoundary) {
|
|
3228
|
+
ret = [];
|
|
3229
|
+
let t1 = boundaryElement || void 0, t2;
|
|
3230
|
+
$[7] !== fallbackPlacements || $[8] !== rootBoundary || $[9] !== t1 ? (t2 = flip({
|
|
3231
|
+
boundary: t1,
|
|
3232
|
+
fallbackPlacements,
|
|
3233
|
+
padding: 4,
|
|
3234
|
+
rootBoundary
|
|
3235
|
+
}), $[7] = fallbackPlacements, $[8] = rootBoundary, $[9] = t1, $[10] = t2) : t2 = $[10], ret.push(t2);
|
|
3236
|
+
let t3;
|
|
3237
|
+
$[11] === Symbol.for("react.memo_cache_sentinel") ? (t3 = offset({ mainAxis: 4 }), $[11] = t3) : t3 = $[11], ret.push(t3);
|
|
3238
|
+
let t4 = boundaryElement || void 0, t5;
|
|
3239
|
+
if ($[12] !== rootBoundary || $[13] !== t4 ? (t5 = shift({
|
|
3240
|
+
boundary: t4,
|
|
3241
|
+
rootBoundary,
|
|
3242
|
+
padding: 4
|
|
3243
|
+
}), $[12] = rootBoundary, $[13] = t4, $[14] = t5) : t5 = $[14], ret.push(t5), arrowProp) {
|
|
3244
|
+
let t6;
|
|
3245
|
+
$[15] === arrowRef ? t6 = $[16] : (t6 = arrow({
|
|
3246
|
+
element: arrowRef,
|
|
3247
|
+
padding: 4
|
|
3248
|
+
}), $[15] = arrowRef, $[16] = t6), ret.push(t6);
|
|
3249
|
+
}
|
|
3250
|
+
animate && ret.push(origin), $[0] = animate, $[1] = arrowProp, $[2] = arrowRef, $[3] = boundaryElement, $[4] = fallbackPlacements, $[5] = rootBoundary, $[6] = ret;
|
|
3251
|
+
} else ret = $[6];
|
|
3252
|
+
return ret;
|
|
3253
|
+
}
|
|
3254
|
+
/**
|
|
3255
|
+
* As `useEffectEvent` should never be passed to other components or hooks, this custom hook groups together the `useEffectEvent` and the `useEffect` hook using it.
|
|
3256
|
+
* @see https://19.react.dev/learn/separating-events-from-effects#reading-latest-props-and-state-with-effect-events:~:text=Never%20pass%20them%20to%20other%20components%20or%20Hooks
|
|
3257
|
+
*/
|
|
3258
|
+
function useCloseOnMouseLeave(t0) {
|
|
3259
|
+
let $ = c(10), { handleIsOpenChange, referenceElement, showTooltip, isInsideGroup } = t0, t1;
|
|
3260
|
+
$[0] !== handleIsOpenChange || $[1] !== referenceElement ? (t1 = (target, teardown) => {
|
|
3261
|
+
referenceElement && (referenceElement === target || target instanceof Node && referenceElement.contains(target) || (handleIsOpenChange(!1), teardown()));
|
|
3262
|
+
}, $[0] = handleIsOpenChange, $[1] = referenceElement, $[2] = t1) : t1 = $[2];
|
|
3263
|
+
let onMouseMove = useEffectEvent(t1), t2;
|
|
3264
|
+
$[3] !== isInsideGroup || $[4] !== onMouseMove || $[5] !== showTooltip ? (t2 = () => {
|
|
3265
|
+
if (!showTooltip || isInsideGroup) return;
|
|
3266
|
+
let handleMouseMove = (event) => {
|
|
3267
|
+
onMouseMove(event.target, () => window.removeEventListener("mousemove", handleMouseMove));
|
|
3268
|
+
};
|
|
3269
|
+
return window.addEventListener("mousemove", handleMouseMove), () => window.removeEventListener("mousemove", handleMouseMove);
|
|
3270
|
+
}, $[3] = isInsideGroup, $[4] = onMouseMove, $[5] = showTooltip, $[6] = t2) : t2 = $[6];
|
|
3271
|
+
let t3;
|
|
3272
|
+
$[7] !== isInsideGroup || $[8] !== showTooltip ? (t3 = [isInsideGroup, showTooltip], $[7] = isInsideGroup, $[8] = showTooltip, $[9] = t3) : t3 = $[9], useEffect(t2, t3);
|
|
3273
|
+
}
|
|
3274
|
+
/**
|
|
3275
|
+
* @public
|
|
3276
|
+
*/
|
|
3277
|
+
function PortalProvider(props) {
|
|
3278
|
+
let $ = c(7), { boundaryElement, children, element, __unstable_elements: elements } = props, fallbackElement = useSyncExternalStore(emptySubscribe, _temp, _temp2), t0 = boundaryElement || null, t1 = element || fallbackElement, t2;
|
|
3279
|
+
$[0] !== elements || $[1] !== t0 || $[2] !== t1 ? (t2 = {
|
|
3280
|
+
version: 0,
|
|
3281
|
+
boundaryElement: t0,
|
|
3282
|
+
element: t1,
|
|
3283
|
+
elements
|
|
3284
|
+
}, $[0] = elements, $[1] = t0, $[2] = t1, $[3] = t2) : t2 = $[3];
|
|
3285
|
+
let value = t2, t3;
|
|
3286
|
+
return $[4] !== children || $[5] !== value ? (t3 = /* @__PURE__ */ jsx(PortalContext.Provider, {
|
|
3287
|
+
value,
|
|
3288
|
+
children
|
|
3289
|
+
}), $[4] = children, $[5] = value, $[6] = t3) : t3 = $[6], t3;
|
|
3290
|
+
}
|
|
3291
|
+
function _temp2() {
|
|
3292
|
+
return null;
|
|
3293
|
+
}
|
|
3294
|
+
function _temp() {
|
|
3295
|
+
return document.body;
|
|
3296
|
+
}
|
|
3297
|
+
const emptySubscribe = () => () => {};
|
|
3298
|
+
export { Spinner as $, Arrow as A, parseColor as At, useMediaIndex as B, textInputRepresentationStyle as C, isHTMLTextAreaElement as Ct, useCustomValidity as D, hexToRgb as Dt, responsiveInputPaddingStyle as E, createColorTheme as Et, useBoundaryElement as F, studioTheme as Ft, ThemeColorProvider as G, _elementSizeObserver as H, BoundaryElementContext as I, createGlobalScopedContext as J, useRootTheme as K, isRecord as L, usePortal as M, rgbToHsl as Mt, useLayer as N, rgba as Nt, Stack as O, hslToRgb as Ot, LayerProvider as P, screen as Pt, _cardColorStyle as Q, usePrefersReducedMotion as R, textInputFontSizeStyle as S, isHTMLSelectElement as St, responsiveInputPaddingIconRightStyle as T, EMPTY_RECORD as Tt, _ResizeObserver as U, useElementSize as V, Card as W, focusRingBorderStyle as X, Button as Y, focusRingStyle as Z, Layer as _, containsOrEqualsElement as _t, useDelayedState as a, Flex as at, TextInput as b, isHTMLElement as bt, TabList as c, responsiveRadiusStyle as ct, MenuGroup as d, _fillCSSObject as dt, Text as et, MenuDivider as f, _getArrayProp as ft, Inline as g, _isEnterToClickElement as gt, KBD as h, rem as ht, TooltipDelayGroupContext as i, responsiveTextAlignStyle as it, Portal as j, rgbToHex as jt, Popover as k, multiply as kt, Tab as l, Box as lt, Hotkeys as m, _responsive as mt, Tooltip as n, responsiveTextFont as nt, usePrefersDark as o, useTheme$1 as ot, Menu as p, _getResponsiveSpace as pt, ThemeProvider$1 as q, useTooltipDelayGroup as r, responsiveFont as rt, Grid as s, useTheme_v2 as st, PortalProvider as t, SpanWithTextOverflow as tt, MenuItem as u, responsivePaddingStyle as ut, useGlobalKeyDown as v, isHTMLAnchorElement as vt, textInputRootStyle as w, EMPTY_ARRAY as wt, textInputBaseStyle as x, isHTMLInputElement as xt, useClickOutsideEvent as y, isHTMLButtonElement as yt, useMatchMedia as z };
|
|
3292
3299
|
|
|
3293
|
-
//# sourceMappingURL=
|
|
3300
|
+
//# sourceMappingURL=portalProvider.js.map
|