@sanity/ui 4.0.0-next.0 → 4.0.0-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/refractor.cjs +1 -1
- package/dist/_chunks/refractor.js +1 -1
- package/dist/index.cjs +3721 -485
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1105 -48
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +1105 -48
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3579 -351
- package/dist/index.js.map +1 -1
- package/package.json +3 -11
- package/dist/_chunks/portalProvider.cjs +0 -3750
- package/dist/_chunks/portalProvider.cjs.map +0 -1
- package/dist/_chunks/portalProvider.d.cts +0 -1067
- package/dist/_chunks/portalProvider.d.cts.map +0 -1
- package/dist/_chunks/portalProvider.d.ts +0 -1067
- package/dist/_chunks/portalProvider.d.ts.map +0 -1
- package/dist/_chunks/portalProvider.js +0 -3300
- package/dist/_chunks/portalProvider.js.map +0 -1
- package/dist/_visual-editing.cjs +0 -4
- package/dist/_visual-editing.d.cts +0 -2
- package/dist/_visual-editing.d.ts +0 -2
- package/dist/_visual-editing.js +0 -3
package/dist/index.js
CHANGED
|
@@ -1,19 +1,54 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { i as getTheme_v2 } from "./_chunks/getScopedTheme.js";
|
|
3
|
-
import {
|
|
4
|
-
import { c } from "react-compiler-runtime";
|
|
2
|
+
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 "./_chunks/getScopedTheme.js";
|
|
3
|
+
import { c } from "react/compiler-runtime";
|
|
5
4
|
import { ChevronDownIcon } from "@sanity/icons/ChevronDown";
|
|
6
|
-
import { Children, Component, Fragment, Suspense, cloneElement, forwardRef, isValidElement, lazy, startTransition, useContext, useEffect, useId, useImperativeHandle, useReducer, useRef, useState, useSyncExternalStore } from "react";
|
|
7
|
-
import { css, keyframes, styled } from "styled-components";
|
|
5
|
+
import { Children, Component, Fragment, Suspense, cloneElement, createContext, forwardRef, isValidElement, lazy, startTransition, useContext, useDebugValue, useEffect, useId, useImperativeHandle, useLayoutEffect, useReducer, useRef, useState, useSyncExternalStore } from "react";
|
|
6
|
+
import { ThemeProvider as ThemeProvider$1, css, keyframes, styled, useTheme as useTheme$1 } from "styled-components";
|
|
8
7
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
-
import ReactIs from "react-is";
|
|
8
|
+
import ReactIs, { isValidElementType } from "react-is";
|
|
10
9
|
import { SpinnerIcon } from "@sanity/icons/Spinner";
|
|
10
|
+
import { arrow, autoPlacement, autoUpdate, detectOverflow, flip, hide, offset, shift, useFloating } from "@floating-ui/react-dom";
|
|
11
11
|
import { AnimatePresence, motion, stagger } from "motion/react";
|
|
12
|
+
import { ResizeObserver } from "@juggle/resize-observer";
|
|
13
|
+
import { createPortal } from "react-dom";
|
|
12
14
|
import { CloseIcon } from "@sanity/icons/Close";
|
|
15
|
+
import { useEffectEvent } from "use-effect-event";
|
|
16
|
+
import { ChevronRightIcon } from "@sanity/icons/ChevronRight";
|
|
13
17
|
import { ToggleArrowRightIcon } from "@sanity/icons/ToggleArrowRight";
|
|
14
18
|
import { CheckmarkIcon } from "@sanity/icons/Checkmark";
|
|
15
19
|
import { RemoveIcon } from "@sanity/icons/Remove";
|
|
16
20
|
/**
|
|
21
|
+
* @public
|
|
22
|
+
* @deprecated Use `createColorTheme` from `@sanity/ui/theme` instead.
|
|
23
|
+
*/
|
|
24
|
+
const createColorTheme = createColorTheme$1, hexToRgb = hexToRgb$1, hslToRgb = hslToRgb$1, multiply = multiply$1, parseColor = parseColor$1, rgbToHex = rgbToHex$1, rgbToHsl = rgbToHsl$1, rgba = rgba$1, screen = screen$1, studioTheme = buildTheme(), EMPTY_ARRAY = [], EMPTY_RECORD = {}, POPOVER_MOTION_DURATION = .2, POPOVER_MOTION_PROPS = {
|
|
25
|
+
card: {
|
|
26
|
+
initial: {
|
|
27
|
+
scale: .97,
|
|
28
|
+
willChange: "transform"
|
|
29
|
+
},
|
|
30
|
+
hidden: { opacity: 0 },
|
|
31
|
+
visible: {
|
|
32
|
+
opacity: 1,
|
|
33
|
+
transition: {
|
|
34
|
+
when: "beforeChildren",
|
|
35
|
+
duration: POPOVER_MOTION_DURATION / 2
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
scaleIn: { scale: 1 },
|
|
39
|
+
scaleOut: { scale: .97 }
|
|
40
|
+
},
|
|
41
|
+
children: {
|
|
42
|
+
hidden: { opacity: 0 },
|
|
43
|
+
visible: { opacity: 1 }
|
|
44
|
+
},
|
|
45
|
+
transition: {
|
|
46
|
+
type: "spring",
|
|
47
|
+
visualDuration: POPOVER_MOTION_DURATION,
|
|
48
|
+
bounce: .25
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
17
52
|
* @internal
|
|
18
53
|
*/
|
|
19
54
|
function _raf(fn) {
|
|
@@ -23,57 +58,2030 @@ function _raf(fn) {
|
|
|
23
58
|
};
|
|
24
59
|
}
|
|
25
60
|
/**
|
|
26
|
-
* @internal
|
|
61
|
+
* @internal
|
|
62
|
+
*/
|
|
63
|
+
function _raf2(fn) {
|
|
64
|
+
let innerDispose = null, outerDispose = _raf(() => {
|
|
65
|
+
innerDispose = _raf(fn);
|
|
66
|
+
});
|
|
67
|
+
return () => {
|
|
68
|
+
innerDispose && innerDispose(), outerDispose();
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* @internal
|
|
73
|
+
*/
|
|
74
|
+
function _isEnterToClickElement(element) {
|
|
75
|
+
return isHTMLAnchorElement(element) || isHTMLButtonElement(element);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* @internal
|
|
79
|
+
*/
|
|
80
|
+
function isHTMLElement(node) {
|
|
81
|
+
return node instanceof Node && node.nodeType === Node.ELEMENT_NODE;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* @internal
|
|
85
|
+
*/
|
|
86
|
+
function isHTMLAnchorElement(element) {
|
|
87
|
+
return isHTMLElement(element) && element.nodeName === "A";
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* @internal
|
|
91
|
+
*/
|
|
92
|
+
function isHTMLInputElement(element) {
|
|
93
|
+
return isHTMLElement(element) && element.nodeName === "INPUT";
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* @internal
|
|
97
|
+
*/
|
|
98
|
+
function isHTMLButtonElement(element) {
|
|
99
|
+
return isHTMLElement(element) && element.nodeName === "BUTTON";
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* @internal
|
|
103
|
+
*/
|
|
104
|
+
function isHTMLSelectElement(element) {
|
|
105
|
+
return isHTMLElement(element) && element.nodeName === "SELECT";
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* @internal
|
|
109
|
+
*/
|
|
110
|
+
function isHTMLTextAreaElement(element) {
|
|
111
|
+
return isHTMLElement(element) && element.nodeName === "TEXTAREA";
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* @internal
|
|
115
|
+
*/
|
|
116
|
+
function containsOrEqualsElement(element, node) {
|
|
117
|
+
return element.contains(node) || element === node;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* @internal
|
|
121
|
+
*/
|
|
122
|
+
function _hasFocus(element) {
|
|
123
|
+
return !!document.activeElement && element.contains(document.activeElement);
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* @internal
|
|
127
|
+
*/
|
|
128
|
+
function isFocusable(element) {
|
|
129
|
+
return element.tabIndex > 0 || element.tabIndex === 0 && element.getAttribute("tabIndex") !== null ? !0 : isHTMLAnchorElement(element) ? !!element.href && element.rel !== "ignore" : isHTMLInputElement(element) ? element.type !== "hidden" && element.type !== "file" && !element.disabled : isHTMLButtonElement(element) || isHTMLSelectElement(element) || isHTMLTextAreaElement(element) ? !element.disabled : !1;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* @internal
|
|
133
|
+
*/
|
|
134
|
+
function attemptFocus(element) {
|
|
135
|
+
if (!isFocusable(element)) return !1;
|
|
136
|
+
try {
|
|
137
|
+
element.focus();
|
|
138
|
+
} catch {}
|
|
139
|
+
return document.activeElement === element;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* @internal
|
|
143
|
+
*/
|
|
144
|
+
function focusFirstDescendant(element) {
|
|
145
|
+
for (let i = 0; i < element.childNodes.length; i++) {
|
|
146
|
+
let child = element.childNodes[i];
|
|
147
|
+
if (isHTMLElement(child) && (attemptFocus(child) || focusFirstDescendant(child))) return !0;
|
|
148
|
+
}
|
|
149
|
+
return !1;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* @internal
|
|
153
|
+
*/
|
|
154
|
+
function focusLastDescendant(element) {
|
|
155
|
+
for (let i = element.childNodes.length - 1; i >= 0; i--) {
|
|
156
|
+
let child = element.childNodes[i];
|
|
157
|
+
if (isHTMLElement(child) && (attemptFocus(child) || focusLastDescendant(child))) return !0;
|
|
158
|
+
}
|
|
159
|
+
return !1;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* @internal
|
|
163
|
+
*/
|
|
164
|
+
function _fillCSSObject(keys, value) {
|
|
165
|
+
return keys.reduce((style, key) => (style[key] = value, style), {});
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* @public
|
|
169
|
+
*/
|
|
170
|
+
function rem(pixelValue) {
|
|
171
|
+
return pixelValue === 0 ? 0 : `${pixelValue / 16}rem`;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* @internal
|
|
175
|
+
*/
|
|
176
|
+
function _responsive(media, values, callback) {
|
|
177
|
+
return (values?.map(callback) || []).map((statement, mediaIndex) => mediaIndex === 0 ? statement : { [`@media screen and (min-width: ${media[mediaIndex - 1]}px)`]: statement });
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* @internal
|
|
181
|
+
*/
|
|
182
|
+
function _getArrayProp(val, defaultVal) {
|
|
183
|
+
return val === void 0 ? defaultVal || EMPTY_ARRAY : Array.isArray(val) ? val : [val];
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* @internal
|
|
187
|
+
*/
|
|
188
|
+
function _getResponsiveSpace(theme, props, spaceIndexes = EMPTY_ARRAY) {
|
|
189
|
+
if (!Array.isArray(spaceIndexes)) throw Error("the property must be array of numbers");
|
|
190
|
+
if (spaceIndexes.length === 0) return null;
|
|
191
|
+
let { media, space } = getTheme_v2(theme);
|
|
192
|
+
return _responsive(media, spaceIndexes, (spaceIndex) => _fillCSSObject(props, rem(space[spaceIndex])));
|
|
193
|
+
}
|
|
194
|
+
const BASE_STYLE$4 = { "&[data-as=\"ul\"],&[data-as=\"ol\"]": { listStyle: "none" } }, BOX_SIZING = {
|
|
195
|
+
content: "content-box",
|
|
196
|
+
border: "border-box"
|
|
197
|
+
}, BOX_HEIGHT = {
|
|
198
|
+
stretch: "stretch",
|
|
199
|
+
fill: "100%"
|
|
200
|
+
};
|
|
201
|
+
function boxStyle() {
|
|
202
|
+
return BASE_STYLE$4;
|
|
203
|
+
}
|
|
204
|
+
function responsiveBoxStyle() {
|
|
205
|
+
return [
|
|
206
|
+
responsiveBoxSizingStyle,
|
|
207
|
+
responsiveBoxHeightStyle,
|
|
208
|
+
responsiveBoxOverflowStyle,
|
|
209
|
+
responsiveBoxDisplayStyle
|
|
210
|
+
];
|
|
211
|
+
}
|
|
212
|
+
function responsiveBoxDisplayStyle(props) {
|
|
213
|
+
let { media } = getTheme_v2(props.theme);
|
|
214
|
+
return _responsive(media, props.$display, (display) => ({ "&:not([hidden])": { display } }));
|
|
215
|
+
}
|
|
216
|
+
function responsiveBoxSizingStyle(props) {
|
|
217
|
+
let { media } = getTheme_v2(props.theme);
|
|
218
|
+
return _responsive(media, props.$sizing, (sizing) => ({ boxSizing: BOX_SIZING[sizing] }));
|
|
219
|
+
}
|
|
220
|
+
function responsiveBoxHeightStyle(props) {
|
|
221
|
+
let { media } = getTheme_v2(props.theme);
|
|
222
|
+
return _responsive(media, props.$height, (height) => ({ height: BOX_HEIGHT[height] }));
|
|
223
|
+
}
|
|
224
|
+
function responsiveBoxOverflowStyle(props) {
|
|
225
|
+
let { media } = getTheme_v2(props.theme);
|
|
226
|
+
return _responsive(media, props.$overflow, (overflow) => ({ overflow }));
|
|
227
|
+
}
|
|
228
|
+
const BASE_STYLE$3 = {
|
|
229
|
+
minWidth: 0,
|
|
230
|
+
minHeight: 0
|
|
231
|
+
};
|
|
232
|
+
function flexItemStyle() {
|
|
233
|
+
return [BASE_STYLE$3, responsiveFlexItemStyle];
|
|
234
|
+
}
|
|
235
|
+
function responsiveFlexItemStyle(props) {
|
|
236
|
+
let { media } = getTheme_v2(props.theme);
|
|
237
|
+
return props.$flex ? _responsive(media, props.$flex, (flex) => ({ flex: `${flex}` })) : EMPTY_ARRAY;
|
|
238
|
+
}
|
|
239
|
+
function responsiveGridItemStyle() {
|
|
240
|
+
return [
|
|
241
|
+
responsiveGridItemRowStyle,
|
|
242
|
+
responsiveGridItemRowStartStyle,
|
|
243
|
+
responsiveGridItemRowEndStyle,
|
|
244
|
+
responsiveGridItemColumnStyle,
|
|
245
|
+
responsiveGridItemColumnStartStyle,
|
|
246
|
+
responsiveGridItemColumnEndStyle
|
|
247
|
+
];
|
|
248
|
+
}
|
|
249
|
+
const GRID_ITEM_ROW = {
|
|
250
|
+
auto: "auto",
|
|
251
|
+
full: "1 / -1"
|
|
252
|
+
}, GRID_ITEM_COLUMN = {
|
|
253
|
+
auto: "auto",
|
|
254
|
+
full: "1 / -1"
|
|
255
|
+
};
|
|
256
|
+
function responsiveGridItemRowStyle(props) {
|
|
257
|
+
let { media } = getTheme_v2(props.theme);
|
|
258
|
+
return _responsive(media, props.$row, (row) => typeof row == "number" ? { gridRow: `span ${row} / span ${row}` } : { gridRow: GRID_ITEM_ROW[row] });
|
|
259
|
+
}
|
|
260
|
+
function responsiveGridItemRowStartStyle(props) {
|
|
261
|
+
let { media } = getTheme_v2(props.theme);
|
|
262
|
+
return _responsive(media, props.$rowStart, (rowStart) => ({ gridRowStart: `${rowStart}` }));
|
|
263
|
+
}
|
|
264
|
+
function responsiveGridItemRowEndStyle(props) {
|
|
265
|
+
let { media } = getTheme_v2(props.theme);
|
|
266
|
+
return _responsive(media, props.$rowEnd, (rowEnd) => ({ gridRowEnd: `${rowEnd}` }));
|
|
267
|
+
}
|
|
268
|
+
function responsiveGridItemColumnStyle(props) {
|
|
269
|
+
let { media } = getTheme_v2(props.theme);
|
|
270
|
+
return _responsive(media, props.$column, (column) => typeof column == "number" ? { gridColumn: `span ${column} / span ${column}` } : { gridColumn: GRID_ITEM_COLUMN[column] });
|
|
271
|
+
}
|
|
272
|
+
function responsiveGridItemColumnStartStyle(props) {
|
|
273
|
+
let { media } = getTheme_v2(props.theme);
|
|
274
|
+
return _responsive(media, props.$columnStart, (columnStart) => ({ gridColumnStart: `${columnStart}` }));
|
|
275
|
+
}
|
|
276
|
+
function responsiveGridItemColumnEndStyle(props) {
|
|
277
|
+
let { media } = getTheme_v2(props.theme);
|
|
278
|
+
return _responsive(media, props.$columnEnd, (columnEnd) => ({ gridColumnEnd: `${columnEnd}` }));
|
|
279
|
+
}
|
|
280
|
+
function responsiveMarginStyle(props) {
|
|
281
|
+
let { theme } = props;
|
|
282
|
+
return [
|
|
283
|
+
_getResponsiveSpace(theme, ["margin"], props.$margin),
|
|
284
|
+
_getResponsiveSpace(theme, ["marginLeft", "marginRight"], props.$marginX),
|
|
285
|
+
_getResponsiveSpace(theme, ["marginTop", "marginBottom"], props.$marginY),
|
|
286
|
+
_getResponsiveSpace(theme, ["marginTop"], props.$marginTop),
|
|
287
|
+
_getResponsiveSpace(theme, ["marginRight"], props.$marginRight),
|
|
288
|
+
_getResponsiveSpace(theme, ["marginBottom"], props.$marginBottom),
|
|
289
|
+
_getResponsiveSpace(theme, ["marginLeft"], props.$marginLeft)
|
|
290
|
+
].filter(Boolean);
|
|
291
|
+
}
|
|
292
|
+
function responsivePaddingStyle(props) {
|
|
293
|
+
let { theme } = props;
|
|
294
|
+
return [
|
|
295
|
+
_getResponsiveSpace(theme, ["padding"], props.$padding),
|
|
296
|
+
_getResponsiveSpace(theme, ["paddingLeft", "paddingRight"], props.$paddingX),
|
|
297
|
+
_getResponsiveSpace(theme, ["paddingTop", "paddingBottom"], props.$paddingY),
|
|
298
|
+
_getResponsiveSpace(theme, ["paddingTop"], props.$paddingTop),
|
|
299
|
+
_getResponsiveSpace(theme, ["paddingRight"], props.$paddingRight),
|
|
300
|
+
_getResponsiveSpace(theme, ["paddingBottom"], props.$paddingBottom),
|
|
301
|
+
_getResponsiveSpace(theme, ["paddingLeft"], props.$paddingLeft)
|
|
302
|
+
].filter(Boolean);
|
|
303
|
+
}
|
|
304
|
+
const StyledBox = /* @__PURE__ */ styled.div.withConfig({
|
|
305
|
+
displayName: "StyledBox",
|
|
306
|
+
componentId: "sc-v1slb8-0"
|
|
307
|
+
})(boxStyle, flexItemStyle, responsiveBoxStyle, responsiveGridItemStyle, responsiveMarginStyle, responsivePaddingStyle), Box = forwardRef(function Box(props, ref) {
|
|
308
|
+
let $ = c(109), 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;
|
|
309
|
+
$[0] === props ? (flex = $[1], gridColumn = $[2], gridColumnEnd = $[3], gridColumnStart = $[4], gridRow = $[5], gridRowEnd = $[6], gridRowStart = $[7], height = $[8], marginBottom = $[9], marginLeft = $[10], marginRight = $[11], marginTop = $[12], marginX = $[13], marginY = $[14], overflow = $[15], paddingBottom = $[16], paddingLeft = $[17], paddingRight = $[18], paddingTop = $[19], paddingX = $[20], paddingY = $[21], restProps = $[22], sizing = $[23], t0 = $[24], t1 = $[25], t2 = $[26], t3 = $[27]) : ({as: t0, gridColumn, gridColumnStart, gridColumnEnd, display: t1, flex, height, margin: t2, marginX, marginY, marginTop, marginRight, marginBottom, marginLeft, overflow, padding: t3, paddingX, paddingY, paddingTop, paddingRight, paddingBottom, paddingLeft, gridRow, gridRowStart, gridRowEnd, sizing, ...restProps} = props, $[0] = props, $[1] = flex, $[2] = gridColumn, $[3] = gridColumnEnd, $[4] = gridColumnStart, $[5] = gridRow, $[6] = gridRowEnd, $[7] = gridRowStart, $[8] = height, $[9] = marginBottom, $[10] = marginLeft, $[11] = marginRight, $[12] = marginTop, $[13] = marginX, $[14] = marginY, $[15] = overflow, $[16] = paddingBottom, $[17] = paddingLeft, $[18] = paddingRight, $[19] = paddingTop, $[20] = paddingX, $[21] = paddingY, $[22] = restProps, $[23] = sizing, $[24] = t0, $[25] = t1, $[26] = t2, $[27] = t3);
|
|
310
|
+
let asProp = t0 === void 0 ? "div" : t0, display = t1 === void 0 ? "block" : t1, margin = t2 === void 0 ? 0 : t2, padding = t3 === void 0 ? 0 : t3, t4 = typeof asProp == "string" ? asProp : void 0, t5;
|
|
311
|
+
$[28] === gridColumn ? t5 = $[29] : (t5 = _getArrayProp(gridColumn), $[28] = gridColumn, $[29] = t5);
|
|
312
|
+
let t6;
|
|
313
|
+
$[30] === gridColumnStart ? t6 = $[31] : (t6 = _getArrayProp(gridColumnStart), $[30] = gridColumnStart, $[31] = t6);
|
|
314
|
+
let t7;
|
|
315
|
+
$[32] === gridColumnEnd ? t7 = $[33] : (t7 = _getArrayProp(gridColumnEnd), $[32] = gridColumnEnd, $[33] = t7);
|
|
316
|
+
let t8;
|
|
317
|
+
$[34] === display ? t8 = $[35] : (t8 = _getArrayProp(display), $[34] = display, $[35] = t8);
|
|
318
|
+
let t9;
|
|
319
|
+
$[36] === flex ? t9 = $[37] : (t9 = _getArrayProp(flex), $[36] = flex, $[37] = t9);
|
|
320
|
+
let t10;
|
|
321
|
+
$[38] === height ? t10 = $[39] : (t10 = _getArrayProp(height), $[38] = height, $[39] = t10);
|
|
322
|
+
let t11;
|
|
323
|
+
$[40] === margin ? t11 = $[41] : (t11 = _getArrayProp(margin), $[40] = margin, $[41] = t11);
|
|
324
|
+
let t12;
|
|
325
|
+
$[42] === marginX ? t12 = $[43] : (t12 = _getArrayProp(marginX), $[42] = marginX, $[43] = t12);
|
|
326
|
+
let t13;
|
|
327
|
+
$[44] === marginY ? t13 = $[45] : (t13 = _getArrayProp(marginY), $[44] = marginY, $[45] = t13);
|
|
328
|
+
let t14;
|
|
329
|
+
$[46] === marginTop ? t14 = $[47] : (t14 = _getArrayProp(marginTop), $[46] = marginTop, $[47] = t14);
|
|
330
|
+
let t15;
|
|
331
|
+
$[48] === marginRight ? t15 = $[49] : (t15 = _getArrayProp(marginRight), $[48] = marginRight, $[49] = t15);
|
|
332
|
+
let t16;
|
|
333
|
+
$[50] === marginBottom ? t16 = $[51] : (t16 = _getArrayProp(marginBottom), $[50] = marginBottom, $[51] = t16);
|
|
334
|
+
let t17;
|
|
335
|
+
$[52] === marginLeft ? t17 = $[53] : (t17 = _getArrayProp(marginLeft), $[52] = marginLeft, $[53] = t17);
|
|
336
|
+
let t18;
|
|
337
|
+
$[54] === overflow ? t18 = $[55] : (t18 = _getArrayProp(overflow), $[54] = overflow, $[55] = t18);
|
|
338
|
+
let t19;
|
|
339
|
+
$[56] === padding ? t19 = $[57] : (t19 = _getArrayProp(padding), $[56] = padding, $[57] = t19);
|
|
340
|
+
let t20;
|
|
341
|
+
$[58] === paddingX ? t20 = $[59] : (t20 = _getArrayProp(paddingX), $[58] = paddingX, $[59] = t20);
|
|
342
|
+
let t21;
|
|
343
|
+
$[60] === paddingY ? t21 = $[61] : (t21 = _getArrayProp(paddingY), $[60] = paddingY, $[61] = t21);
|
|
344
|
+
let t22;
|
|
345
|
+
$[62] === paddingTop ? t22 = $[63] : (t22 = _getArrayProp(paddingTop), $[62] = paddingTop, $[63] = t22);
|
|
346
|
+
let t23;
|
|
347
|
+
$[64] === paddingRight ? t23 = $[65] : (t23 = _getArrayProp(paddingRight), $[64] = paddingRight, $[65] = t23);
|
|
348
|
+
let t24;
|
|
349
|
+
$[66] === paddingBottom ? t24 = $[67] : (t24 = _getArrayProp(paddingBottom), $[66] = paddingBottom, $[67] = t24);
|
|
350
|
+
let t25;
|
|
351
|
+
$[68] === paddingLeft ? t25 = $[69] : (t25 = _getArrayProp(paddingLeft), $[68] = paddingLeft, $[69] = t25);
|
|
352
|
+
let t26;
|
|
353
|
+
$[70] === gridRow ? t26 = $[71] : (t26 = _getArrayProp(gridRow), $[70] = gridRow, $[71] = t26);
|
|
354
|
+
let t27;
|
|
355
|
+
$[72] === gridRowStart ? t27 = $[73] : (t27 = _getArrayProp(gridRowStart), $[72] = gridRowStart, $[73] = t27);
|
|
356
|
+
let t28;
|
|
357
|
+
$[74] === gridRowEnd ? t28 = $[75] : (t28 = _getArrayProp(gridRowEnd), $[74] = gridRowEnd, $[75] = t28);
|
|
358
|
+
let t29;
|
|
359
|
+
$[76] === sizing ? t29 = $[77] : (t29 = _getArrayProp(sizing), $[76] = sizing, $[77] = t29);
|
|
360
|
+
let t30;
|
|
361
|
+
return $[78] !== asProp || $[79] !== props.children || $[80] !== ref || $[81] !== restProps || $[82] !== t10 || $[83] !== t11 || $[84] !== t12 || $[85] !== t13 || $[86] !== t14 || $[87] !== t15 || $[88] !== t16 || $[89] !== t17 || $[90] !== t18 || $[91] !== t19 || $[92] !== t20 || $[93] !== t21 || $[94] !== t22 || $[95] !== t23 || $[96] !== t24 || $[97] !== t25 || $[98] !== t26 || $[99] !== t27 || $[100] !== t28 || $[101] !== t29 || $[102] !== t4 || $[103] !== t5 || $[104] !== t6 || $[105] !== t7 || $[106] !== t8 || $[107] !== t9 ? (t30 = /* @__PURE__ */ jsx(StyledBox, {
|
|
362
|
+
"data-as": t4,
|
|
363
|
+
"data-ui": "Box",
|
|
364
|
+
...restProps,
|
|
365
|
+
$column: t5,
|
|
366
|
+
$columnStart: t6,
|
|
367
|
+
$columnEnd: t7,
|
|
368
|
+
$display: t8,
|
|
369
|
+
$flex: t9,
|
|
370
|
+
$height: t10,
|
|
371
|
+
$margin: t11,
|
|
372
|
+
$marginX: t12,
|
|
373
|
+
$marginY: t13,
|
|
374
|
+
$marginTop: t14,
|
|
375
|
+
$marginRight: t15,
|
|
376
|
+
$marginBottom: t16,
|
|
377
|
+
$marginLeft: t17,
|
|
378
|
+
$overflow: t18,
|
|
379
|
+
$padding: t19,
|
|
380
|
+
$paddingX: t20,
|
|
381
|
+
$paddingY: t21,
|
|
382
|
+
$paddingTop: t22,
|
|
383
|
+
$paddingRight: t23,
|
|
384
|
+
$paddingBottom: t24,
|
|
385
|
+
$paddingLeft: t25,
|
|
386
|
+
$row: t26,
|
|
387
|
+
$rowStart: t27,
|
|
388
|
+
$rowEnd: t28,
|
|
389
|
+
$sizing: t29,
|
|
390
|
+
as: asProp,
|
|
391
|
+
ref,
|
|
392
|
+
children: props.children
|
|
393
|
+
}), $[78] = asProp, $[79] = props.children, $[80] = ref, $[81] = restProps, $[82] = t10, $[83] = t11, $[84] = t12, $[85] = t13, $[86] = t14, $[87] = t15, $[88] = t16, $[89] = t17, $[90] = t18, $[91] = t19, $[92] = t20, $[93] = t21, $[94] = t22, $[95] = t23, $[96] = t24, $[97] = t25, $[98] = t26, $[99] = t27, $[100] = t28, $[101] = t29, $[102] = t4, $[103] = t5, $[104] = t6, $[105] = t7, $[106] = t8, $[107] = t9, $[108] = t30) : t30 = $[108], t30;
|
|
394
|
+
});
|
|
395
|
+
function responsiveRadiusStyle(props) {
|
|
396
|
+
let { media, radius } = getTheme_v2(props.theme);
|
|
397
|
+
return _responsive(media, props.$radius, (value) => {
|
|
398
|
+
let borderRadius = 0;
|
|
399
|
+
return typeof value == "number" && (borderRadius = rem(radius[value])), value === "full" && (borderRadius = "9999px"), { borderRadius };
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* @public
|
|
404
|
+
*/
|
|
405
|
+
function useTheme() {
|
|
406
|
+
return useTheme$1();
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* @public
|
|
410
|
+
*/
|
|
411
|
+
function useTheme_v2() {
|
|
412
|
+
let $ = c(2), t0 = useTheme$1(), t1;
|
|
413
|
+
return $[0] === t0 ? t1 = $[1] : (t1 = getTheme_v2(t0), $[0] = t0, $[1] = t1), t1;
|
|
414
|
+
}
|
|
415
|
+
const BASE_STYLE$2 = { "&&:not([hidden])": { display: "flex" } };
|
|
416
|
+
function responsiveFlexStyle() {
|
|
417
|
+
return [
|
|
418
|
+
BASE_STYLE$2,
|
|
419
|
+
responsiveFlexAlignStyle,
|
|
420
|
+
responsiveFlexGapStyle,
|
|
421
|
+
responsiveFlexWrapStyle,
|
|
422
|
+
responsiveFlexJustifyStyle,
|
|
423
|
+
responsiveFlexDirectionStyle
|
|
424
|
+
];
|
|
425
|
+
}
|
|
426
|
+
function responsiveFlexAlignStyle(props) {
|
|
427
|
+
let { media } = getTheme_v2(props.theme);
|
|
428
|
+
return _responsive(media, props.$align, (align) => ({ alignItems: align }));
|
|
429
|
+
}
|
|
430
|
+
function responsiveFlexGapStyle(props) {
|
|
431
|
+
let { media, space } = getTheme_v2(props.theme);
|
|
432
|
+
return _responsive(media, props.$gap, (gap) => ({ gap: gap ? rem(space[gap]) : void 0 }));
|
|
433
|
+
}
|
|
434
|
+
function responsiveFlexWrapStyle(props) {
|
|
435
|
+
let { media } = getTheme_v2(props.theme);
|
|
436
|
+
return _responsive(media, props.$wrap, (wrap) => ({ flexWrap: wrap }));
|
|
437
|
+
}
|
|
438
|
+
function responsiveFlexJustifyStyle(props) {
|
|
439
|
+
let { media } = getTheme_v2(props.theme);
|
|
440
|
+
return _responsive(media, props.$justify, (justify) => ({ justifyContent: justify }));
|
|
441
|
+
}
|
|
442
|
+
function responsiveFlexDirectionStyle(props) {
|
|
443
|
+
let { media } = getTheme_v2(props.theme);
|
|
444
|
+
return _responsive(media, props.$direction, (direction) => ({ flexDirection: direction }));
|
|
445
|
+
}
|
|
446
|
+
const StyledFlex = /* @__PURE__ */ styled(Box).withConfig({
|
|
447
|
+
displayName: "StyledFlex",
|
|
448
|
+
componentId: "sc-es1mm4-0"
|
|
449
|
+
})(flexItemStyle, responsiveFlexStyle), Flex = forwardRef(function Flex(props, ref) {
|
|
450
|
+
let $ = c(27), align, as, gap, justify, restProps, t0, wrap;
|
|
451
|
+
$[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);
|
|
452
|
+
let direction = t0 === void 0 ? "row" : t0, t1;
|
|
453
|
+
$[8] === align ? t1 = $[9] : (t1 = _getArrayProp(align), $[8] = align, $[9] = t1);
|
|
454
|
+
let t2;
|
|
455
|
+
$[10] === direction ? t2 = $[11] : (t2 = _getArrayProp(direction), $[10] = direction, $[11] = t2);
|
|
456
|
+
let t3;
|
|
457
|
+
$[12] === gap ? t3 = $[13] : (t3 = _getArrayProp(gap), $[12] = gap, $[13] = t3);
|
|
458
|
+
let t4;
|
|
459
|
+
$[14] === justify ? t4 = $[15] : (t4 = _getArrayProp(justify), $[14] = justify, $[15] = t4);
|
|
460
|
+
let t5;
|
|
461
|
+
$[16] === wrap ? t5 = $[17] : (t5 = _getArrayProp(wrap), $[16] = wrap, $[17] = t5);
|
|
462
|
+
let t6;
|
|
463
|
+
return $[18] !== as || $[19] !== ref || $[20] !== restProps || $[21] !== t1 || $[22] !== t2 || $[23] !== t3 || $[24] !== t4 || $[25] !== t5 ? (t6 = /* @__PURE__ */ jsx(StyledFlex, {
|
|
464
|
+
"data-ui": "Flex",
|
|
465
|
+
...restProps,
|
|
466
|
+
$align: t1,
|
|
467
|
+
$direction: t2,
|
|
468
|
+
$gap: t3,
|
|
469
|
+
$justify: t4,
|
|
470
|
+
$wrap: t5,
|
|
471
|
+
forwardedAs: as,
|
|
472
|
+
ref
|
|
473
|
+
}), $[18] = as, $[19] = ref, $[20] = restProps, $[21] = t1, $[22] = t2, $[23] = t3, $[24] = t4, $[25] = t5, $[26] = t6) : t6 = $[26], t6;
|
|
474
|
+
});
|
|
475
|
+
/**
|
|
476
|
+
* Get responsive text align styles.
|
|
477
|
+
* @internal
|
|
478
|
+
*/
|
|
479
|
+
function responsiveTextAlignStyle(props) {
|
|
480
|
+
let { media } = getTheme_v2(props.theme);
|
|
481
|
+
return _responsive(media, props.$align, (textAlign) => ({ textAlign }));
|
|
482
|
+
}
|
|
483
|
+
/**
|
|
484
|
+
* A utility function getting responsive font styles.
|
|
485
|
+
* @internal
|
|
486
|
+
*/
|
|
487
|
+
function responsiveFont(fontKey, props) {
|
|
488
|
+
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 = {
|
|
489
|
+
position: "relative",
|
|
490
|
+
fontFamily: family,
|
|
491
|
+
fontWeight: `${fontWeight}`,
|
|
492
|
+
padding: "1px 0",
|
|
493
|
+
margin: 0,
|
|
494
|
+
"&:before": {
|
|
495
|
+
content: "\"\"",
|
|
496
|
+
display: "block",
|
|
497
|
+
height: 0
|
|
498
|
+
},
|
|
499
|
+
"&:after": {
|
|
500
|
+
content: "\"\"",
|
|
501
|
+
display: "block",
|
|
502
|
+
height: 0
|
|
503
|
+
},
|
|
504
|
+
"& > code, & > span": { display: "block" },
|
|
505
|
+
"&:not([hidden])": { display: "block" }
|
|
506
|
+
};
|
|
507
|
+
return $size ? [base, ..._responsive(media, $size, (sizeIndex) => fontSize(sizes[sizeIndex] || defaultSize))] : (responsiveFont.warned ||= (console.warn("No size specified for responsive font", {
|
|
508
|
+
fontKey,
|
|
509
|
+
$size,
|
|
510
|
+
props,
|
|
511
|
+
base
|
|
512
|
+
}), !0), [base]);
|
|
513
|
+
}
|
|
514
|
+
function fontSize(size) {
|
|
515
|
+
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;
|
|
516
|
+
return {
|
|
517
|
+
fontSize: rem(fontSize),
|
|
518
|
+
lineHeight: `calc(${lineHeight} / ${fontSize})`,
|
|
519
|
+
letterSpacing: rem(letterSpacing),
|
|
520
|
+
transform: `translateY(${rem(descenderHeight)})`,
|
|
521
|
+
"&:before": { marginTop: `calc(${rem(0 - negHeight)} - 1px)` },
|
|
522
|
+
"&:after": { marginBottom: "-1px" },
|
|
523
|
+
"& svg:not([data-sanity-icon])": {
|
|
524
|
+
fontSize: `calc(${customIconSize} / 16 * 1rem)`,
|
|
525
|
+
margin: rem(customIconOffset)
|
|
526
|
+
},
|
|
527
|
+
"& [data-sanity-icon]": {
|
|
528
|
+
fontSize: `calc(${iconSize} / 16 * 1rem)`,
|
|
529
|
+
margin: rem(iconOffset)
|
|
530
|
+
}
|
|
531
|
+
};
|
|
532
|
+
}
|
|
533
|
+
/**
|
|
534
|
+
* Get responsive CSS for the `text` font style.
|
|
535
|
+
* @internal
|
|
536
|
+
*/
|
|
537
|
+
function responsiveTextFont(props) {
|
|
538
|
+
return responsiveFont("text", props);
|
|
539
|
+
}
|
|
540
|
+
/** @internal */
|
|
541
|
+
const SpanWithTextOverflow = styled.span.withConfig({
|
|
542
|
+
displayName: "SpanWithTextOverflow",
|
|
543
|
+
componentId: "sc-xkyu3h-0"
|
|
544
|
+
})`display:block;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;overflow:clip;`;
|
|
545
|
+
function textBaseStyle(props) {
|
|
546
|
+
let { $accent, $muted } = props, { font } = getTheme_v2(props.theme);
|
|
547
|
+
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;}}`;
|
|
548
|
+
}
|
|
549
|
+
const StyledText = /* @__PURE__ */ styled.div.withConfig({
|
|
550
|
+
displayName: "StyledText",
|
|
551
|
+
componentId: "sc-avdzi0-0"
|
|
552
|
+
})(responsiveTextFont, responsiveTextAlignStyle, textBaseStyle), Text = forwardRef(function Text(props, ref) {
|
|
553
|
+
let $ = c(26), align, childrenProp, restProps, t0, t1, t2, textOverflow, weight;
|
|
554
|
+
$[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);
|
|
555
|
+
let accent = t0 !== void 0 && t0, muted = t1 !== void 0 && t1, size = t2 === void 0 ? 2 : t2, children = childrenProp;
|
|
556
|
+
if (textOverflow === "ellipsis") {
|
|
557
|
+
let t3;
|
|
558
|
+
$[9] === children ? t3 = $[10] : (t3 = /* @__PURE__ */ jsx(SpanWithTextOverflow, { children }), $[9] = children, $[10] = t3), children = t3;
|
|
559
|
+
}
|
|
560
|
+
let t3;
|
|
561
|
+
$[11] === align ? t3 = $[12] : (t3 = _getArrayProp(align), $[11] = align, $[12] = t3);
|
|
562
|
+
let t4;
|
|
563
|
+
$[13] === size ? t4 = $[14] : (t4 = _getArrayProp(size), $[13] = size, $[14] = t4);
|
|
564
|
+
let t5;
|
|
565
|
+
$[15] === children ? t5 = $[16] : (t5 = /* @__PURE__ */ jsx("span", { children }), $[15] = children, $[16] = t5);
|
|
566
|
+
let t6;
|
|
567
|
+
return $[17] !== accent || $[18] !== muted || $[19] !== ref || $[20] !== restProps || $[21] !== t3 || $[22] !== t4 || $[23] !== t5 || $[24] !== weight ? (t6 = /* @__PURE__ */ jsx(StyledText, {
|
|
568
|
+
"data-ui": "Text",
|
|
569
|
+
...restProps,
|
|
570
|
+
$accent: accent,
|
|
571
|
+
$align: t3,
|
|
572
|
+
$muted: muted,
|
|
573
|
+
ref,
|
|
574
|
+
$size: t4,
|
|
575
|
+
$weight: weight,
|
|
576
|
+
children: t5
|
|
577
|
+
}), $[17] = accent, $[18] = muted, $[19] = ref, $[20] = restProps, $[21] = t3, $[22] = t4, $[23] = t5, $[24] = weight, $[25] = t6) : t6 = $[25], t6;
|
|
578
|
+
}), rotate$1 = keyframes`from{transform:rotate(0deg);}to{transform:rotate(360deg);}`, StyledSpinner = styled(Text).withConfig({
|
|
579
|
+
displayName: "StyledSpinner",
|
|
580
|
+
componentId: "sc-218fkp-0"
|
|
581
|
+
})`& > span > svg{animation:${rotate$1} 500ms linear infinite;}`, Spinner = forwardRef(function Spinner(props, ref) {
|
|
582
|
+
let $ = c(4), t0;
|
|
583
|
+
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = /* @__PURE__ */ jsx(SpinnerIcon, {}), $[0] = t0) : t0 = $[0];
|
|
584
|
+
let t1;
|
|
585
|
+
return $[1] !== props || $[2] !== ref ? (t1 = /* @__PURE__ */ jsx(StyledSpinner, {
|
|
586
|
+
"data-ui": "Spinner",
|
|
587
|
+
...props,
|
|
588
|
+
ref,
|
|
589
|
+
children: t0
|
|
590
|
+
}), $[1] = props, $[2] = ref, $[3] = t1) : t1 = $[3], t1;
|
|
591
|
+
});
|
|
592
|
+
/**
|
|
593
|
+
* @internal
|
|
594
|
+
*/
|
|
595
|
+
function _cardColorStyle(base, color, checkered = !1) {
|
|
596
|
+
return {
|
|
597
|
+
"--card-backdrop-color": base.backdrop,
|
|
598
|
+
"--card-focus-ring-color": base.focusRing,
|
|
599
|
+
"--card-shadow-outline-color": base.shadow.outline,
|
|
600
|
+
"--card-shadow-umbra-color": base.shadow.umbra,
|
|
601
|
+
"--card-shadow-penumbra-color": base.shadow.penumbra,
|
|
602
|
+
"--card-shadow-ambient-color": base.shadow.ambient,
|
|
603
|
+
"--card-accent-fg-color": color.accent.fg,
|
|
604
|
+
"--card-avatar-gray-bg-color": color.avatar.gray.bg,
|
|
605
|
+
"--card-avatar-gray-fg-color": color.avatar.gray.fg,
|
|
606
|
+
"--card-avatar-blue-bg-color": color.avatar.blue.bg,
|
|
607
|
+
"--card-avatar-blue-fg-color": color.avatar.blue.fg,
|
|
608
|
+
"--card-avatar-purple-bg-color": color.avatar.purple.bg,
|
|
609
|
+
"--card-avatar-purple-fg-color": color.avatar.purple.fg,
|
|
610
|
+
"--card-avatar-magenta-bg-color": color.avatar.magenta.bg,
|
|
611
|
+
"--card-avatar-magenta-fg-color": color.avatar.magenta.fg,
|
|
612
|
+
"--card-avatar-red-bg-color": color.avatar.red.bg,
|
|
613
|
+
"--card-avatar-red-fg-color": color.avatar.red.fg,
|
|
614
|
+
"--card-avatar-orange-bg-color": color.avatar.orange.bg,
|
|
615
|
+
"--card-avatar-orange-fg-color": color.avatar.orange.fg,
|
|
616
|
+
"--card-avatar-yellow-bg-color": color.avatar.yellow.bg,
|
|
617
|
+
"--card-avatar-yellow-fg-color": color.avatar.yellow.fg,
|
|
618
|
+
"--card-avatar-green-bg-color": color.avatar.green.bg,
|
|
619
|
+
"--card-avatar-green-fg-color": color.avatar.green.fg,
|
|
620
|
+
"--card-avatar-cyan-bg-color": color.avatar.cyan.bg,
|
|
621
|
+
"--card-avatar-cyan-fg-color": color.avatar.cyan.fg,
|
|
622
|
+
"--card-bg-color": color.bg,
|
|
623
|
+
"--card-bg-image": checkered ? `repeating-conic-gradient(${color.bg} 0% 25%, ${color.muted.bg} 0% 50%)` : void 0,
|
|
624
|
+
"--card-border-color": color.border,
|
|
625
|
+
"--card-badge-default-bg-color": color.badge.default.bg,
|
|
626
|
+
"--card-badge-default-dot-color": color.badge.default.dot,
|
|
627
|
+
"--card-badge-default-fg-color": color.badge.default.fg,
|
|
628
|
+
"--card-badge-default-icon-color": color.badge.default.icon,
|
|
629
|
+
"--card-badge-neutral-bg-color": color.badge.neutral?.bg,
|
|
630
|
+
"--card-badge-neutral-dot-color": color.badge.neutral?.dot,
|
|
631
|
+
"--card-badge-neutral-fg-color": color.badge.neutral?.fg,
|
|
632
|
+
"--card-badge-neutral-icon-color": color.badge.neutral?.icon,
|
|
633
|
+
"--card-badge-primary-bg-color": color.badge.primary.bg,
|
|
634
|
+
"--card-badge-primary-dot-color": color.badge.primary.dot,
|
|
635
|
+
"--card-badge-primary-fg-color": color.badge.primary.fg,
|
|
636
|
+
"--card-badge-primary-icon-color": color.badge.primary.icon,
|
|
637
|
+
"--card-badge-suggest-bg-color": color.badge.suggest?.bg,
|
|
638
|
+
"--card-badge-suggest-dot-color": color.badge.suggest?.dot,
|
|
639
|
+
"--card-badge-suggest-fg-color": color.badge.suggest?.fg,
|
|
640
|
+
"--card-badge-suggest-icon-color": color.badge.suggest?.icon,
|
|
641
|
+
"--card-badge-positive-bg-color": color.badge.positive.bg,
|
|
642
|
+
"--card-badge-positive-dot-color": color.badge.positive.dot,
|
|
643
|
+
"--card-badge-positive-fg-color": color.badge.positive.fg,
|
|
644
|
+
"--card-badge-positive-icon-color": color.badge.positive.icon,
|
|
645
|
+
"--card-badge-caution-bg-color": color.badge.caution.bg,
|
|
646
|
+
"--card-badge-caution-dot-color": color.badge.caution.dot,
|
|
647
|
+
"--card-badge-caution-fg-color": color.badge.caution.fg,
|
|
648
|
+
"--card-badge-caution-icon-color": color.badge.caution.icon,
|
|
649
|
+
"--card-badge-critical-bg-color": color.badge.critical.bg,
|
|
650
|
+
"--card-badge-critical-dot-color": color.badge.critical.dot,
|
|
651
|
+
"--card-badge-critical-fg-color": color.badge.critical.fg,
|
|
652
|
+
"--card-badge-critical-icon-color": color.badge.critical.icon,
|
|
653
|
+
"--card-code-bg-color": color.code.bg,
|
|
654
|
+
"--card-code-fg-color": color.code.fg,
|
|
655
|
+
"--card-fg-color": color.fg,
|
|
656
|
+
"--card-icon-color": color.icon,
|
|
657
|
+
"--card-kbd-bg-color": color.kbd.bg,
|
|
658
|
+
"--card-kbd-border-color": color.kbd.border,
|
|
659
|
+
"--card-kbd-fg-color": color.kbd.fg,
|
|
660
|
+
"--card-link-fg-color": color.link.fg,
|
|
661
|
+
"--card-muted-bg-color": color.muted.bg,
|
|
662
|
+
"--card-muted-fg-color": color.muted.fg,
|
|
663
|
+
"--card-skeleton-color-from": color.skeleton.from,
|
|
664
|
+
"--card-skeleton-color-to": color.skeleton.to,
|
|
665
|
+
"--card-bg2-color": color.muted.bg,
|
|
666
|
+
"--card-link-color": color.link.fg,
|
|
667
|
+
"--card-hairline-soft-color": color.border,
|
|
668
|
+
"--card-hairline-hard-color": color.border
|
|
669
|
+
};
|
|
670
|
+
}
|
|
671
|
+
function focusRingBorderStyle(border) {
|
|
672
|
+
return `inset 0 0 0 ${border.width}px ${border.color}`;
|
|
673
|
+
}
|
|
674
|
+
function focusRingStyle(opts) {
|
|
675
|
+
let { base, border, focusRing } = opts, focusRingOutsetWidth = focusRing.offset + focusRing.width, focusRingInsetWidth = 0 - focusRing.offset, bgColor = base ? base.bg : "var(--card-bg-color)";
|
|
676
|
+
return [
|
|
677
|
+
focusRingInsetWidth > 0 && `inset 0 0 0 ${focusRingInsetWidth}px var(--card-focus-ring-color)`,
|
|
678
|
+
border && focusRingBorderStyle(border),
|
|
679
|
+
focusRingInsetWidth < 0 && `0 0 0 ${0 - focusRingInsetWidth}px ${bgColor}`,
|
|
680
|
+
focusRingOutsetWidth > 0 && `0 0 0 ${focusRingOutsetWidth}px var(--card-focus-ring-color)`
|
|
681
|
+
].filter(Boolean).join(",");
|
|
682
|
+
}
|
|
683
|
+
/**
|
|
684
|
+
* @internal
|
|
685
|
+
*/
|
|
686
|
+
function buttonBaseStyles(props) {
|
|
687
|
+
let { $width } = props, { style } = getTheme_v2(props.theme);
|
|
688
|
+
return css`${style?.button};-webkit-font-smoothing:inherit;appearance:none;display:inline-flex;align-items:center;font:inherit;border:0;outline:none;user-select:none;text-decoration:none;border:0;box-sizing:border-box;padding:0;margin:0;white-space:nowrap;text-align:left;position:relative;vertical-align:top;${$width === "fill" && css`width:-moz-available;width:-webkit-fill-available;width:stretch;`} & > span{display:block;flex:1;min-width:0;border-radius:inherit;}&::-moz-focus-inner{border:0;padding:0;}`;
|
|
689
|
+
}
|
|
690
|
+
function combineBoxShadow(...boxShadows) {
|
|
691
|
+
return boxShadows.filter(Boolean).join(",");
|
|
692
|
+
}
|
|
693
|
+
/**
|
|
694
|
+
* @internal
|
|
695
|
+
*/
|
|
696
|
+
function buttonColorStyles(props) {
|
|
697
|
+
let { $mode } = props, { button, color: baseColor, style } = getTheme_v2(props.theme);
|
|
698
|
+
props.$mode;
|
|
699
|
+
let mode = baseColor.button[$mode] || baseColor.button.default, color = mode[props.$tone] || mode.default, border = {
|
|
700
|
+
width: button.border.width,
|
|
701
|
+
color: "var(--card-border-color)"
|
|
702
|
+
};
|
|
703
|
+
return [
|
|
704
|
+
_cardColorStyle(baseColor, color.enabled),
|
|
705
|
+
{
|
|
706
|
+
backgroundColor: "var(--card-bg-color)",
|
|
707
|
+
color: "var(--card-fg-color)",
|
|
708
|
+
boxShadow: focusRingBorderStyle(border),
|
|
709
|
+
"&:disabled, &[data-disabled=\"true\"]": _cardColorStyle(baseColor, color.disabled),
|
|
710
|
+
"&:not([data-disabled='true'])": {
|
|
711
|
+
boxShadow: combineBoxShadow(focusRingBorderStyle(border), void 0),
|
|
712
|
+
"&:focus": { boxShadow: focusRingStyle({
|
|
713
|
+
base: baseColor,
|
|
714
|
+
border: {
|
|
715
|
+
width: 2,
|
|
716
|
+
color: baseColor.bg
|
|
717
|
+
},
|
|
718
|
+
focusRing: button.focusRing
|
|
719
|
+
}) },
|
|
720
|
+
"&:focus:not(:focus-visible)": { boxShadow: combineBoxShadow(focusRingBorderStyle(border), void 0) },
|
|
721
|
+
"@media (hover: hover)": {
|
|
722
|
+
"&:hover": _cardColorStyle(baseColor, color.hovered),
|
|
723
|
+
"&:active": _cardColorStyle(baseColor, color.pressed),
|
|
724
|
+
"&[data-hovered]": _cardColorStyle(baseColor, color.hovered)
|
|
725
|
+
},
|
|
726
|
+
"&[data-selected]": _cardColorStyle(baseColor, color.pressed)
|
|
727
|
+
}
|
|
728
|
+
},
|
|
729
|
+
style?.button?.root
|
|
730
|
+
].filter(Boolean);
|
|
731
|
+
}
|
|
732
|
+
const StyledButton = /* @__PURE__ */ styled.button.withConfig({
|
|
733
|
+
displayName: "StyledButton",
|
|
734
|
+
componentId: "sc-yillgz-0"
|
|
735
|
+
})(responsiveRadiusStyle, buttonBaseStyles, buttonColorStyles), LoadingBox = styled.div.withConfig({
|
|
736
|
+
displayName: "LoadingBox",
|
|
737
|
+
componentId: "sc-yillgz-1"
|
|
738
|
+
})`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) {
|
|
739
|
+
let $ = c(86), IconComponent, IconRightComponent, children, disabled, loading, paddingBottomProp, paddingLeftProp, paddingRightProp, paddingTopProp, paddingXProp, paddingYProp, restProps, selected, t0, t1, t2, t3, t4, t5, t6, t7, t8, text, textAlign, textWeight, width;
|
|
740
|
+
$[0] === props ? (IconComponent = $[1], IconRightComponent = $[2], children = $[3], disabled = $[4], loading = $[5], paddingBottomProp = $[6], paddingLeftProp = $[7], paddingRightProp = $[8], paddingTopProp = $[9], paddingXProp = $[10], paddingYProp = $[11], restProps = $[12], selected = $[13], t0 = $[14], t1 = $[15], t2 = $[16], t3 = $[17], t4 = $[18], t5 = $[19], t6 = $[20], t7 = $[21], t8 = $[22], text = $[23], textAlign = $[24], textWeight = $[25], width = $[26]) : ({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: t5, text, textAlign, textWeight, tone: t6, type: t7, muted: t8, width, ...restProps} = props, $[0] = props, $[1] = IconComponent, $[2] = IconRightComponent, $[3] = children, $[4] = disabled, $[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);
|
|
741
|
+
let fontSize = t0 === void 0 ? 1 : t0, justifyProp = t1 === void 0 ? "center" : t1, mode = t2 === void 0 ? "default" : t2, paddingProp = t3 === void 0 ? 3 : t3, radiusProp = t4 === void 0 ? 2 : t4, gap = t5 === void 0 ? 3 : t5, tone = t6 === void 0 ? "default" : t6, type = t7 === void 0 ? "button" : t7, muted = t8 !== void 0 && t8, { button } = useTheme_v2(), t9;
|
|
742
|
+
$[27] === justifyProp ? t9 = $[28] : (t9 = _getArrayProp(justifyProp), $[27] = justifyProp, $[28] = t9);
|
|
743
|
+
let justify = t9, t10;
|
|
744
|
+
$[29] === paddingProp ? t10 = $[30] : (t10 = _getArrayProp(paddingProp), $[29] = paddingProp, $[30] = t10);
|
|
745
|
+
let padding = t10, t11;
|
|
746
|
+
$[31] === paddingXProp ? t11 = $[32] : (t11 = _getArrayProp(paddingXProp), $[31] = paddingXProp, $[32] = t11);
|
|
747
|
+
let paddingX = t11, t12;
|
|
748
|
+
$[33] === paddingYProp ? t12 = $[34] : (t12 = _getArrayProp(paddingYProp), $[33] = paddingYProp, $[34] = t12);
|
|
749
|
+
let paddingY = t12, t13;
|
|
750
|
+
$[35] === paddingTopProp ? t13 = $[36] : (t13 = _getArrayProp(paddingTopProp), $[35] = paddingTopProp, $[36] = t13);
|
|
751
|
+
let paddingTop = t13, t14;
|
|
752
|
+
$[37] === paddingBottomProp ? t14 = $[38] : (t14 = _getArrayProp(paddingBottomProp), $[37] = paddingBottomProp, $[38] = t14);
|
|
753
|
+
let paddingBottom = t14, t15;
|
|
754
|
+
$[39] === paddingLeftProp ? t15 = $[40] : (t15 = _getArrayProp(paddingLeftProp), $[39] = paddingLeftProp, $[40] = t15);
|
|
755
|
+
let paddingLeft = t15, t16;
|
|
756
|
+
$[41] === paddingRightProp ? t16 = $[42] : (t16 = _getArrayProp(paddingRightProp), $[41] = paddingRightProp, $[42] = t16);
|
|
757
|
+
let paddingRight = t16, t17;
|
|
758
|
+
$[43] === radiusProp ? t17 = $[44] : (t17 = _getArrayProp(radiusProp), $[43] = radiusProp, $[44] = t17);
|
|
759
|
+
let radius = t17, t18;
|
|
760
|
+
$[45] === gap ? t18 = $[46] : (t18 = _getArrayProp(gap), $[45] = gap, $[46] = t18);
|
|
761
|
+
let spacing = t18, t19;
|
|
762
|
+
$[47] !== padding || $[48] !== paddingBottom || $[49] !== paddingLeft || $[50] !== paddingRight || $[51] !== paddingTop || $[52] !== paddingX || $[53] !== paddingY ? (t19 = {
|
|
763
|
+
padding,
|
|
764
|
+
paddingX,
|
|
765
|
+
paddingY,
|
|
766
|
+
paddingTop,
|
|
767
|
+
paddingBottom,
|
|
768
|
+
paddingLeft,
|
|
769
|
+
paddingRight
|
|
770
|
+
}, $[47] = padding, $[48] = paddingBottom, $[49] = paddingLeft, $[50] = paddingRight, $[51] = paddingTop, $[52] = paddingX, $[53] = paddingY, $[54] = t19) : t19 = $[54];
|
|
771
|
+
let boxProps = t19, t20 = !!(loading || disabled), t21 = selected ? "" : void 0, t22 = !!(loading || disabled), t23;
|
|
772
|
+
$[55] === loading ? t23 = $[56] : (t23 = !!loading && /* @__PURE__ */ jsx(LoadingBox, { children: /* @__PURE__ */ jsx(Spinner, {}) }), $[55] = loading, $[56] = t23);
|
|
773
|
+
let t24;
|
|
774
|
+
$[57] !== IconComponent || $[58] !== IconRightComponent || $[59] !== boxProps || $[60] !== button || $[61] !== fontSize || $[62] !== justify || $[63] !== muted || $[64] !== spacing || $[65] !== text || $[66] !== textAlign || $[67] !== textWeight ? (t24 = (IconComponent || text || IconRightComponent) && /* @__PURE__ */ jsx(Box, {
|
|
775
|
+
as: "span",
|
|
776
|
+
...boxProps,
|
|
777
|
+
children: /* @__PURE__ */ jsxs(Flex, {
|
|
778
|
+
as: "span",
|
|
779
|
+
justify,
|
|
780
|
+
gap: spacing,
|
|
781
|
+
children: [
|
|
782
|
+
IconComponent && /* @__PURE__ */ jsxs(Text, {
|
|
783
|
+
size: fontSize,
|
|
784
|
+
children: [isValidElement(IconComponent) && IconComponent, isValidElementType(IconComponent) && /* @__PURE__ */ jsx(IconComponent, {})]
|
|
785
|
+
}),
|
|
786
|
+
text && /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Text, {
|
|
787
|
+
muted,
|
|
788
|
+
align: textAlign,
|
|
789
|
+
size: fontSize,
|
|
790
|
+
textOverflow: "ellipsis",
|
|
791
|
+
weight: textWeight ?? button.textWeight,
|
|
792
|
+
children: text
|
|
793
|
+
}) }),
|
|
794
|
+
IconRightComponent && /* @__PURE__ */ jsxs(Text, {
|
|
795
|
+
size: fontSize,
|
|
796
|
+
children: [isValidElement(IconRightComponent) && IconRightComponent, isValidElementType(IconRightComponent) && /* @__PURE__ */ jsx(IconRightComponent, {})]
|
|
797
|
+
})
|
|
798
|
+
]
|
|
799
|
+
})
|
|
800
|
+
}), $[57] = IconComponent, $[58] = IconRightComponent, $[59] = boxProps, $[60] = button, $[61] = fontSize, $[62] = justify, $[63] = muted, $[64] = spacing, $[65] = text, $[66] = textAlign, $[67] = textWeight, $[68] = t24) : t24 = $[68];
|
|
801
|
+
let t25;
|
|
802
|
+
$[69] !== boxProps || $[70] !== children ? (t25 = children && /* @__PURE__ */ jsx(Box, {
|
|
803
|
+
as: "span",
|
|
804
|
+
...boxProps,
|
|
805
|
+
children
|
|
806
|
+
}), $[69] = boxProps, $[70] = children, $[71] = t25) : t25 = $[71];
|
|
807
|
+
let t26;
|
|
808
|
+
return $[72] !== mode || $[73] !== radius || $[74] !== ref || $[75] !== restProps || $[76] !== t20 || $[77] !== t21 || $[78] !== t22 || $[79] !== t23 || $[80] !== t24 || $[81] !== t25 || $[82] !== tone || $[83] !== type || $[84] !== width ? (t26 = /* @__PURE__ */ jsxs(StyledButton, {
|
|
809
|
+
"data-ui": "Button",
|
|
810
|
+
...restProps,
|
|
811
|
+
$mode: mode,
|
|
812
|
+
$radius: radius,
|
|
813
|
+
$tone: tone,
|
|
814
|
+
"data-disabled": t20,
|
|
815
|
+
"data-selected": t21,
|
|
816
|
+
disabled: t22,
|
|
817
|
+
ref,
|
|
818
|
+
type,
|
|
819
|
+
$width: width,
|
|
820
|
+
children: [
|
|
821
|
+
t23,
|
|
822
|
+
t24,
|
|
823
|
+
t25
|
|
824
|
+
]
|
|
825
|
+
}), $[72] = mode, $[73] = radius, $[74] = ref, $[75] = restProps, $[76] = t20, $[77] = t21, $[78] = t22, $[79] = t23, $[80] = t24, $[81] = t25, $[82] = tone, $[83] = type, $[84] = width, $[85] = t26) : t26 = $[85], t26;
|
|
826
|
+
});
|
|
827
|
+
function responsiveBorderStyle() {
|
|
828
|
+
return [
|
|
829
|
+
border,
|
|
830
|
+
borderTop,
|
|
831
|
+
borderRight,
|
|
832
|
+
borderBottom,
|
|
833
|
+
borderLeft
|
|
834
|
+
];
|
|
835
|
+
}
|
|
836
|
+
function border(props) {
|
|
837
|
+
let { card, media } = getTheme_v2(props.theme), borderStyle = `${card.border?.width ?? 1}px solid var(--card-border-color)`;
|
|
838
|
+
return _responsive(media, props.$border, (value) => value ? { "&&": { border: borderStyle } } : { "&&": { border: 0 } });
|
|
839
|
+
}
|
|
840
|
+
function borderTop(props) {
|
|
841
|
+
let { card, media } = getTheme_v2(props.theme), borderStyle = `${card.border?.width ?? 1}px solid var(--card-border-color)`;
|
|
842
|
+
return _responsive(media, props.$borderTop, (value) => value ? { "&&": { borderTop: borderStyle } } : { "&&": { borderTop: 0 } });
|
|
843
|
+
}
|
|
844
|
+
function borderRight(props) {
|
|
845
|
+
let { card, media } = getTheme_v2(props.theme), borderStyle = `${card.border?.width ?? 1}px solid var(--card-border-color)`;
|
|
846
|
+
return _responsive(media, props.$borderRight, (value) => value ? { "&&": { borderRight: borderStyle } } : { "&&": { borderRight: 0 } });
|
|
847
|
+
}
|
|
848
|
+
function borderBottom(props) {
|
|
849
|
+
let { card, media } = getTheme_v2(props.theme), borderStyle = `${card.border?.width ?? 1}px solid var(--card-border-color)`;
|
|
850
|
+
return _responsive(media, props.$borderBottom, (value) => value ? { "&&": { borderBottom: borderStyle } } : { "&&": { borderBottom: 0 } });
|
|
851
|
+
}
|
|
852
|
+
function borderLeft(props) {
|
|
853
|
+
let { card, media } = getTheme_v2(props.theme), borderStyle = `${card.border?.width ?? 1}px solid var(--card-border-color)`;
|
|
854
|
+
return _responsive(media, props.$borderLeft, (value) => value ? { "&&": { borderLeft: borderStyle } } : { "&&": { borderLeft: 0 } });
|
|
855
|
+
}
|
|
856
|
+
function toBoxShadow(shadow, color) {
|
|
857
|
+
return `${shadow.map(rem).join(" ")} ${color}`;
|
|
858
|
+
}
|
|
859
|
+
function shadowStyle(shadow, outlineWidth = 1) {
|
|
860
|
+
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;
|
|
861
|
+
}
|
|
862
|
+
function responsiveShadowStyle(props) {
|
|
863
|
+
let { card, media, shadow } = getTheme_v2(props.theme);
|
|
864
|
+
return _responsive(media, props.$shadow, (index) => shadowStyle(shadow[index], card.shadow.outline));
|
|
865
|
+
}
|
|
866
|
+
/**
|
|
867
|
+
* Gets the global scope instance in a given environment.
|
|
868
|
+
*
|
|
869
|
+
* The strategy is to return the most modern, and if not, the most common:
|
|
870
|
+
* - The `globalThis` variable is the modern approach to accessing the global scope
|
|
871
|
+
* - The `window` variable is the global scope in a web browser
|
|
872
|
+
* - The `self` variable is the global scope in workers and others
|
|
873
|
+
* - The `global` variable is the global scope in Node.js
|
|
874
|
+
*/
|
|
875
|
+
function getGlobalScope() {
|
|
876
|
+
if (typeof globalThis < "u") return globalThis;
|
|
877
|
+
if (typeof window < "u") return window;
|
|
878
|
+
if (typeof self < "u") return self;
|
|
879
|
+
if (typeof global < "u") return global;
|
|
880
|
+
throw Error("@sanity/ui: could not locate global scope");
|
|
881
|
+
}
|
|
882
|
+
const globalScope = getGlobalScope();
|
|
883
|
+
/**
|
|
884
|
+
* As `@sanity/ui` is declared as a dependency, and may be duplicated, sometimes across major versions
|
|
885
|
+
* it's critical that vital react contexts are shared even when there is a duplicate.
|
|
886
|
+
* If we used a model similar to `sanity` itself, or `styled-components`, this would be unnecessary as
|
|
887
|
+
* those libraries enforce single instances.
|
|
888
|
+
* Since we don't enforce it we have to support a sanity plugin being able to call hooks like `useToast`, and then
|
|
889
|
+
* read the context setup by `sanity`, which calls `ToastProvider`, even if the provider and hook are different instances in memory.
|
|
890
|
+
* It's also why it's vital that all changes to globally scoped providers remain fully backwards compatible to v1.
|
|
891
|
+
*/
|
|
892
|
+
function createGlobalScopedContext(key, defaultValue) {
|
|
893
|
+
let symbol = Symbol.for(key);
|
|
894
|
+
/**
|
|
895
|
+
* Prevent errors about re-renders on React SSR on Next.js App Router
|
|
896
|
+
*/
|
|
897
|
+
if (typeof document > "u") {
|
|
898
|
+
let context = createContext(defaultValue);
|
|
899
|
+
return context.displayName = key, context;
|
|
900
|
+
}
|
|
901
|
+
return globalScope[symbol] = globalScope[symbol] || createContext(defaultValue), globalScope[symbol];
|
|
902
|
+
}
|
|
903
|
+
/**
|
|
904
|
+
* @internal
|
|
905
|
+
*/
|
|
906
|
+
const ThemeContext = createGlobalScopedContext("@sanity/ui/context/theme", null);
|
|
907
|
+
/**
|
|
908
|
+
* @public
|
|
909
|
+
*/
|
|
910
|
+
function ThemeProvider(props) {
|
|
911
|
+
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;
|
|
912
|
+
bb0: {
|
|
913
|
+
if (!rootTheme) {
|
|
914
|
+
t0 = null;
|
|
915
|
+
break bb0;
|
|
916
|
+
}
|
|
917
|
+
let t1;
|
|
918
|
+
$[0] !== rootTheme || $[1] !== scheme || $[2] !== tone ? (t1 = {
|
|
919
|
+
version: 0,
|
|
920
|
+
theme: rootTheme,
|
|
921
|
+
scheme,
|
|
922
|
+
tone
|
|
923
|
+
}, $[0] = rootTheme, $[1] = scheme, $[2] = tone, $[3] = t1) : t1 = $[3], t0 = t1;
|
|
924
|
+
}
|
|
925
|
+
let themeContext = t0, t1;
|
|
926
|
+
bb1: {
|
|
927
|
+
if (!rootTheme) {
|
|
928
|
+
t1 = null;
|
|
929
|
+
break bb1;
|
|
930
|
+
}
|
|
931
|
+
let t2;
|
|
932
|
+
$[4] !== rootTheme || $[5] !== scheme || $[6] !== tone ? (t2 = getScopedTheme(rootTheme, scheme, tone), $[4] = rootTheme, $[5] = scheme, $[6] = tone, $[7] = t2) : t2 = $[7], t1 = t2;
|
|
933
|
+
}
|
|
934
|
+
let theme = t1;
|
|
935
|
+
if (!theme) {
|
|
936
|
+
let t2;
|
|
937
|
+
return $[8] === Symbol.for("react.memo_cache_sentinel") ? (t2 = /* @__PURE__ */ jsx("pre", { children: "ThemeProvider: no \"theme\" property provided" }), $[8] = t2) : t2 = $[8], t2;
|
|
938
|
+
}
|
|
939
|
+
let t2;
|
|
940
|
+
$[9] !== children || $[10] !== theme ? (t2 = /* @__PURE__ */ jsx(ThemeProvider$1, {
|
|
941
|
+
theme,
|
|
942
|
+
children
|
|
943
|
+
}), $[9] = children, $[10] = theme, $[11] = t2) : t2 = $[11];
|
|
944
|
+
let t3;
|
|
945
|
+
return $[12] !== t2 || $[13] !== themeContext ? (t3 = /* @__PURE__ */ jsx(ThemeContext.Provider, {
|
|
946
|
+
value: themeContext,
|
|
947
|
+
children: t2
|
|
948
|
+
}), $[12] = t2, $[13] = themeContext, $[14] = t3) : t3 = $[14], t3;
|
|
949
|
+
}
|
|
950
|
+
/**
|
|
951
|
+
* @public
|
|
952
|
+
*/
|
|
953
|
+
function useRootTheme() {
|
|
954
|
+
let value = useContext(ThemeContext);
|
|
955
|
+
if (!value) throw Error("useRootTheme(): missing context value");
|
|
956
|
+
return value;
|
|
957
|
+
}
|
|
958
|
+
/**
|
|
959
|
+
* @public
|
|
960
|
+
*/
|
|
961
|
+
function ThemeColorProvider(props) {
|
|
962
|
+
let $ = c(5), { children, scheme, tone } = props, root = useRootTheme(), t0 = scheme || root.scheme, t1;
|
|
963
|
+
return $[0] !== children || $[1] !== root.theme || $[2] !== t0 || $[3] !== tone ? (t1 = /* @__PURE__ */ jsx(ThemeProvider, {
|
|
964
|
+
scheme: t0,
|
|
965
|
+
theme: root.theme,
|
|
966
|
+
tone,
|
|
967
|
+
children
|
|
968
|
+
}), $[0] = children, $[1] = root.theme, $[2] = t0, $[3] = tone, $[4] = t1) : t1 = $[4], t1;
|
|
969
|
+
}
|
|
970
|
+
function cardStyle(props) {
|
|
971
|
+
return [cardBaseStyle(props), cardColorStyle(props)];
|
|
972
|
+
}
|
|
973
|
+
function cardBaseStyle(props) {
|
|
974
|
+
let { $checkered } = props, { space } = getTheme_v2(props.theme);
|
|
975
|
+
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;}`;
|
|
976
|
+
}
|
|
977
|
+
function cardColorStyle(props) {
|
|
978
|
+
let { $checkered, $focusRing, $muted } = props, { card, color, style } = getTheme_v2(props.theme), border = {
|
|
979
|
+
width: card.border.width,
|
|
980
|
+
color: "var(--card-border-color)"
|
|
981
|
+
};
|
|
982
|
+
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({
|
|
983
|
+
base: color,
|
|
984
|
+
border,
|
|
985
|
+
focusRing: card.focusRing
|
|
986
|
+
}) : 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({
|
|
987
|
+
base: color,
|
|
988
|
+
border,
|
|
989
|
+
focusRing: card.focusRing
|
|
990
|
+
}) : void 0};}}}${style?.card?.root}`;
|
|
991
|
+
}
|
|
992
|
+
const StyledCard = /* @__PURE__ */ styled(Box).withConfig({
|
|
993
|
+
displayName: "StyledCard",
|
|
994
|
+
componentId: "sc-ddi1cr-0"
|
|
995
|
+
})(responsiveBorderStyle, responsiveRadiusStyle, responsiveShadowStyle, cardStyle), Card = forwardRef(function Card(props, ref) {
|
|
996
|
+
let $ = c(56), asProp, border, borderBottom, borderLeft, borderRight, borderTop, muted, pressed, restProps, scheme, selected, shadow, t0, t1, t2, t3;
|
|
997
|
+
$[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);
|
|
998
|
+
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;
|
|
999
|
+
$[17] === border ? t6 = $[18] : (t6 = _getArrayProp(border), $[17] = border, $[18] = t6);
|
|
1000
|
+
let t7;
|
|
1001
|
+
$[19] === borderTop ? t7 = $[20] : (t7 = _getArrayProp(borderTop), $[19] = borderTop, $[20] = t7);
|
|
1002
|
+
let t8;
|
|
1003
|
+
$[21] === borderRight ? t8 = $[22] : (t8 = _getArrayProp(borderRight), $[21] = borderRight, $[22] = t8);
|
|
1004
|
+
let t9;
|
|
1005
|
+
$[23] === borderBottom ? t9 = $[24] : (t9 = _getArrayProp(borderBottom), $[23] = borderBottom, $[24] = t9);
|
|
1006
|
+
let t10;
|
|
1007
|
+
$[25] === borderLeft ? t10 = $[26] : (t10 = _getArrayProp(borderLeft), $[25] = borderLeft, $[26] = t10);
|
|
1008
|
+
let t11;
|
|
1009
|
+
$[27] === radius ? t11 = $[28] : (t11 = _getArrayProp(radius), $[27] = radius, $[28] = t11);
|
|
1010
|
+
let t12;
|
|
1011
|
+
$[29] === shadow ? t12 = $[30] : (t12 = _getArrayProp(shadow), $[29] = shadow, $[30] = t12);
|
|
1012
|
+
let t13 = checkered ? "" : void 0, t14 = pressed ? "" : void 0, t15 = selected ? "" : void 0, t16;
|
|
1013
|
+
$[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, {
|
|
1014
|
+
"data-as": t4,
|
|
1015
|
+
"data-scheme": t5,
|
|
1016
|
+
"data-ui": "Card",
|
|
1017
|
+
"data-tone": tone,
|
|
1018
|
+
...restProps,
|
|
1019
|
+
$border: t6,
|
|
1020
|
+
$borderTop: t7,
|
|
1021
|
+
$borderRight: t8,
|
|
1022
|
+
$borderBottom: t9,
|
|
1023
|
+
$borderLeft: t10,
|
|
1024
|
+
$checkered: checkered,
|
|
1025
|
+
$focusRing: focusRing,
|
|
1026
|
+
$muted: muted,
|
|
1027
|
+
$radius: t11,
|
|
1028
|
+
$shadow: t12,
|
|
1029
|
+
$tone: tone,
|
|
1030
|
+
"data-checkered": t13,
|
|
1031
|
+
"data-pressed": t14,
|
|
1032
|
+
"data-selected": t15,
|
|
1033
|
+
forwardedAs: as,
|
|
1034
|
+
ref,
|
|
1035
|
+
selected
|
|
1036
|
+
}), $[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, $[51] = t16) : t16 = $[51];
|
|
1037
|
+
let t17;
|
|
1038
|
+
return $[52] !== scheme || $[53] !== t16 || $[54] !== tone ? (t17 = /* @__PURE__ */ jsx(ThemeColorProvider, {
|
|
1039
|
+
scheme,
|
|
1040
|
+
tone,
|
|
1041
|
+
children: t16
|
|
1042
|
+
}), $[52] = scheme, $[53] = t16, $[54] = tone, $[55] = t17) : t17 = $[55], t17;
|
|
1043
|
+
}), _ResizeObserver = typeof document < "u" && typeof window < "u" && window.ResizeObserver ? window.ResizeObserver : ResizeObserver, _elementSizeObserver = _createElementSizeObserver();
|
|
1044
|
+
function _createElementRectValueListener() {
|
|
1045
|
+
return { subscribe(element, subscriber) {
|
|
1046
|
+
let resizeObserver = new _ResizeObserver(([entry]) => {
|
|
1047
|
+
subscriber({
|
|
1048
|
+
_contentRect: entry.contentRect,
|
|
1049
|
+
border: {
|
|
1050
|
+
width: entry.borderBoxSize[0].inlineSize,
|
|
1051
|
+
height: entry.borderBoxSize[0].blockSize
|
|
1052
|
+
},
|
|
1053
|
+
content: {
|
|
1054
|
+
width: entry.contentRect.width,
|
|
1055
|
+
height: entry.contentRect.height
|
|
1056
|
+
}
|
|
1057
|
+
});
|
|
1058
|
+
});
|
|
1059
|
+
return resizeObserver.observe(element), () => {
|
|
1060
|
+
resizeObserver.unobserve(element), resizeObserver.disconnect();
|
|
1061
|
+
};
|
|
1062
|
+
} };
|
|
1063
|
+
}
|
|
1064
|
+
function _createElementSizeObserver() {
|
|
1065
|
+
let disposeCache = /* @__PURE__ */ new WeakMap(), subscribersCache = /* @__PURE__ */ new WeakMap();
|
|
1066
|
+
return { subscribe(element, subscriber) {
|
|
1067
|
+
let subscribers = subscribersCache.get(element) || [], dispose = disposeCache.get(element);
|
|
1068
|
+
return subscribersCache.has(element) || (subscribersCache.set(element, subscribers), dispose = _createElementRectValueListener().subscribe(element, (elementRect) => {
|
|
1069
|
+
for (let sub of subscribers) sub(elementRect);
|
|
1070
|
+
})), subscribers.push(subscriber), () => {
|
|
1071
|
+
let idx = subscribers.indexOf(subscriber);
|
|
1072
|
+
idx > -1 && subscribers.splice(idx, 1), subscribers.length === 0 && dispose && dispose();
|
|
1073
|
+
};
|
|
1074
|
+
} };
|
|
1075
|
+
}
|
|
1076
|
+
/**
|
|
1077
|
+
* Subscribe to the size of a DOM element.
|
|
1078
|
+
* @beta
|
|
1079
|
+
*/
|
|
1080
|
+
function useElementSize(element) {
|
|
1081
|
+
let $ = c(3), [size, setSize] = useState(null), t0, t1;
|
|
1082
|
+
return $[0] === element ? (t0 = $[1], t1 = $[2]) : (t0 = () => {
|
|
1083
|
+
if (element) return _elementSizeObserver.subscribe(element, setSize);
|
|
1084
|
+
}, t1 = [element], $[0] = element, $[1] = t0, $[2] = t1), useEffect(t0, t1), size;
|
|
1085
|
+
}
|
|
1086
|
+
function _getMediaQuery(media, index) {
|
|
1087
|
+
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)`;
|
|
1088
|
+
}
|
|
1089
|
+
function _createMediaStore(media) {
|
|
1090
|
+
let mediaLen = media.length, sizes, getSizes = () => {
|
|
1091
|
+
if (!sizes) {
|
|
1092
|
+
sizes = [];
|
|
1093
|
+
for (let index = mediaLen; index > -1; --index) {
|
|
1094
|
+
let mediaQuery = _getMediaQuery(media, index);
|
|
1095
|
+
sizes.push({
|
|
1096
|
+
index,
|
|
1097
|
+
mq: window.matchMedia(mediaQuery)
|
|
1098
|
+
});
|
|
1099
|
+
}
|
|
1100
|
+
}
|
|
1101
|
+
return sizes;
|
|
1102
|
+
}, getSnapshot = () => {
|
|
1103
|
+
for (let { index, mq } of getSizes()) if (mq.matches) return index;
|
|
1104
|
+
return 0;
|
|
1105
|
+
}, subscribe = (onStoreChange) => {
|
|
1106
|
+
let disposeFns = [];
|
|
1107
|
+
for (let { mq } of getSizes()) {
|
|
1108
|
+
let handleChange = () => {
|
|
1109
|
+
mq.matches && onStoreChange();
|
|
1110
|
+
};
|
|
1111
|
+
mq.addEventListener("change", handleChange), disposeFns.push(() => mq.removeEventListener("change", handleChange));
|
|
1112
|
+
}
|
|
1113
|
+
return () => {
|
|
1114
|
+
for (let disposeFn of disposeFns) disposeFn();
|
|
1115
|
+
};
|
|
1116
|
+
};
|
|
1117
|
+
return {
|
|
1118
|
+
getSnapshot,
|
|
1119
|
+
subscribe
|
|
1120
|
+
};
|
|
1121
|
+
}
|
|
1122
|
+
/**
|
|
1123
|
+
* Only called during server-side rendering, and hydration if using hydrateRoot
|
|
1124
|
+
* Since the server environment doesn't have access to the DOM, we can't determine the current value of the media query
|
|
1125
|
+
* and we assume `(prefers-color-scheme: light)` since it's the most common scheme
|
|
1126
|
+
*
|
|
1127
|
+
* @link https://beta.reactjs.org/apis/react/useSyncExternalStore#adding-support-for-server-rendering
|
|
1128
|
+
*/
|
|
1129
|
+
function getServerSnapshot() {
|
|
1130
|
+
return 0;
|
|
1131
|
+
}
|
|
1132
|
+
/**
|
|
1133
|
+
* This API might change. DO NOT USE IN PRODUCTION.
|
|
1134
|
+
* @beta
|
|
1135
|
+
*/
|
|
1136
|
+
function useMediaIndex() {
|
|
1137
|
+
let $ = c(2), { media } = useTheme_v2(), t0;
|
|
1138
|
+
$[0] === media ? t0 = $[1] : (t0 = _createMediaStore(media), $[0] = media, $[1] = t0);
|
|
1139
|
+
let store = t0;
|
|
1140
|
+
return useSyncExternalStore(store.subscribe, store.getSnapshot, getServerSnapshot);
|
|
1141
|
+
}
|
|
1142
|
+
/**
|
|
1143
|
+
* Efficiently subscribes to `window.matchMedia` queries
|
|
1144
|
+
*
|
|
1145
|
+
* @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)
|
|
1146
|
+
*
|
|
1147
|
+
* @public
|
|
1148
|
+
*/
|
|
1149
|
+
function useMatchMedia(mediaQueryString, getServerSnapshot) {
|
|
1150
|
+
let $ = c(4);
|
|
1151
|
+
useDebugValue(mediaQueryString);
|
|
1152
|
+
let t0;
|
|
1153
|
+
$[0] === mediaQueryString ? t0 = $[1] : (t0 = (onStoreChange) => {
|
|
1154
|
+
let media = window.matchMedia(mediaQueryString);
|
|
1155
|
+
return media.addEventListener("change", onStoreChange), () => media.removeEventListener("change", onStoreChange);
|
|
1156
|
+
}, $[0] = mediaQueryString, $[1] = t0);
|
|
1157
|
+
let t1;
|
|
1158
|
+
return $[2] === mediaQueryString ? t1 = $[3] : (t1 = () => window.matchMedia(mediaQueryString).matches, $[2] = mediaQueryString, $[3] = t1), useSyncExternalStore(t0, t1, getServerSnapshot);
|
|
1159
|
+
}
|
|
1160
|
+
/**
|
|
1161
|
+
* Returns true if motion should be reduced
|
|
1162
|
+
*
|
|
1163
|
+
* @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-reduced-motion: no-preference)` since it's the most common scheme (https://react.dev/reference/react/useSyncExternalStore#adding-support-for-server-rendering)
|
|
1164
|
+
*
|
|
1165
|
+
* If you persist the detected preference in a cookie or a header then you may implement your own server snapshot to read it.
|
|
1166
|
+
* Chrome supports reading the `prefers-reduced-motion` media query from a header if the server response: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Sec-CH-Prefers-Reduced-Motion
|
|
1167
|
+
* @example https://gist.github.com/stipsan/0c0f839a27842249cada893e9fb7767b
|
|
1168
|
+
*
|
|
1169
|
+
* @public
|
|
1170
|
+
*/
|
|
1171
|
+
function usePrefersReducedMotion(t0) {
|
|
1172
|
+
return useMatchMedia("(prefers-reduced-motion: reduce)", t0 === void 0 ? _temp$14 : t0);
|
|
1173
|
+
}
|
|
1174
|
+
function _temp$14() {
|
|
1175
|
+
return !1;
|
|
1176
|
+
}
|
|
1177
|
+
/**
|
|
1178
|
+
* Custom floating-ui middleware which calculates transform-origin X + Y offsets
|
|
1179
|
+
* based on the current floating rect's dimensions and shift offset.
|
|
1180
|
+
*
|
|
1181
|
+
* Scaling popovers with these transform-origin offsets will give the effect of
|
|
1182
|
+
* popvers slightly 'growing' from the origin/reference element.
|
|
1183
|
+
*
|
|
1184
|
+
* This middleware must be applied after both `@sanity/ui/size` and `shift` middlewares.
|
|
1185
|
+
*/
|
|
1186
|
+
const origin = {
|
|
1187
|
+
name: "@sanity/ui/origin",
|
|
1188
|
+
fn({ middlewareData, placement, rects }) {
|
|
1189
|
+
let [side] = placement.split("-"), floatingWidth = rects.floating.width, floatingHeight = rects.floating.height, shiftX = middlewareData.shift?.x || 0, shiftY = middlewareData.shift?.y || 0;
|
|
1190
|
+
if (floatingWidth <= 0 || floatingHeight <= 0) return {};
|
|
1191
|
+
let { originX, originY } = ["bottom", "top"].includes(side) ? {
|
|
1192
|
+
originX: clamp(.5 - shiftX / floatingWidth, 0, 1),
|
|
1193
|
+
originY: side === "bottom" ? 0 : 1
|
|
1194
|
+
} : {
|
|
1195
|
+
originX: +(side === "left"),
|
|
1196
|
+
originY: clamp(.5 - shiftY / floatingHeight, 0, 1)
|
|
1197
|
+
};
|
|
1198
|
+
return { data: {
|
|
1199
|
+
originX,
|
|
1200
|
+
originY
|
|
1201
|
+
} };
|
|
1202
|
+
}
|
|
1203
|
+
};
|
|
1204
|
+
function clamp(num, min, max) {
|
|
1205
|
+
return Math.min(Math.max(num, min), max);
|
|
1206
|
+
}
|
|
1207
|
+
function isRecord(value) {
|
|
1208
|
+
return !!(value && typeof value == "object" && !Array.isArray(value));
|
|
1209
|
+
}
|
|
1210
|
+
const BoundaryElementContext = createGlobalScopedContext("@sanity/ui/context/boundaryElement", null), DEFAULT_VALUE = {
|
|
1211
|
+
version: 0,
|
|
1212
|
+
element: null
|
|
1213
|
+
};
|
|
1214
|
+
/**
|
|
1215
|
+
* @public
|
|
1216
|
+
*/
|
|
1217
|
+
function useBoundaryElement() {
|
|
1218
|
+
let value = useContext(BoundaryElementContext);
|
|
1219
|
+
if (value && (!isRecord(value) || value.version !== 0)) throw Error("useBoundaryElement(): the context value is not compatible");
|
|
1220
|
+
return value || DEFAULT_VALUE;
|
|
1221
|
+
}
|
|
1222
|
+
function getElementRef(element) {
|
|
1223
|
+
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get, mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
1224
|
+
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);
|
|
1225
|
+
}
|
|
1226
|
+
function getLayerContext(contextValue) {
|
|
1227
|
+
if (!isRecord(contextValue) || contextValue.version !== 0) throw Error("the context value is not compatible");
|
|
1228
|
+
if (!contextValue) throw Error("components using `useLayer()` should be wrapped in a <LayerProvider>.");
|
|
1229
|
+
if (contextValue.version === 0) return contextValue;
|
|
1230
|
+
throw Error("could not get layer context");
|
|
1231
|
+
}
|
|
1232
|
+
const LayerContext = createGlobalScopedContext("@sanity/ui/context/layer", null);
|
|
1233
|
+
/**
|
|
1234
|
+
* @public
|
|
1235
|
+
*/
|
|
1236
|
+
function LayerProvider(props) {
|
|
1237
|
+
let $ = c(21), { children, zOffset: t0 } = props, zOffsetProp = t0 === void 0 ? 0 : t0, parentContextValue = useContext(LayerContext), t1;
|
|
1238
|
+
$[0] === parentContextValue ? t1 = $[1] : (t1 = parentContextValue && getLayerContext(parentContextValue), $[0] = parentContextValue, $[1] = t1);
|
|
1239
|
+
let parent = t1, parentRegisterChild = parent?.registerChild, level = (parent?.level ?? 0) + 1, t2;
|
|
1240
|
+
$[2] === zOffsetProp ? t2 = $[3] : (t2 = _getArrayProp(zOffsetProp), $[2] = zOffsetProp, $[3] = t2);
|
|
1241
|
+
let zOffset = t2, maxMediaIndex = zOffset.length - 1, mediaIndex = Math.min(useMediaIndex(), maxMediaIndex), zIndex = parent ? parent.zIndex + zOffset[mediaIndex] : zOffset[mediaIndex], t3;
|
|
1242
|
+
$[4] === Symbol.for("react.memo_cache_sentinel") ? (t3 = {}, $[4] = t3) : t3 = $[4];
|
|
1243
|
+
let [, setChildLayers] = useState(t3), [size, setSize] = useState(0), isTopLayer = size === 0, t4;
|
|
1244
|
+
$[5] !== parentRegisterChild || $[6] !== setChildLayers ? (t4 = (childLevel) => {
|
|
1245
|
+
let parentDispose = parentRegisterChild?.(childLevel);
|
|
1246
|
+
return childLevel === void 0 ? setSize(_temp$13) : setChildLayers((state) => {
|
|
1247
|
+
let prevLen = state[childLevel] ?? 0, nextState = {
|
|
1248
|
+
...state,
|
|
1249
|
+
[childLevel]: prevLen + 1
|
|
1250
|
+
};
|
|
1251
|
+
return setSize(Object.keys(nextState).length), nextState;
|
|
1252
|
+
}), () => {
|
|
1253
|
+
childLevel === void 0 ? setSize(_temp2$4) : setChildLayers((state_0) => {
|
|
1254
|
+
let nextState_0 = { ...state_0 };
|
|
1255
|
+
return nextState_0[childLevel] === 1 ? (delete nextState_0[childLevel], setSize(Object.keys(nextState_0).length)) : nextState_0[childLevel] = nextState_0[childLevel] - 1, nextState_0;
|
|
1256
|
+
}), parentDispose?.();
|
|
1257
|
+
};
|
|
1258
|
+
}, $[5] = parentRegisterChild, $[6] = setChildLayers, $[7] = t4) : t4 = $[7];
|
|
1259
|
+
let registerChild = t4, t5, t6;
|
|
1260
|
+
$[8] !== level || $[9] !== parentRegisterChild ? (t5 = () => parentRegisterChild?.(level), t6 = [level, parentRegisterChild], $[8] = level, $[9] = parentRegisterChild, $[10] = t5, $[11] = t6) : (t5 = $[10], t6 = $[11]), useEffect(t5, t6);
|
|
1261
|
+
let t7;
|
|
1262
|
+
$[12] !== isTopLayer || $[13] !== level || $[14] !== registerChild || $[15] !== size || $[16] !== zIndex ? (t7 = {
|
|
1263
|
+
version: 0,
|
|
1264
|
+
isTopLayer,
|
|
1265
|
+
level,
|
|
1266
|
+
registerChild,
|
|
1267
|
+
size,
|
|
1268
|
+
zIndex
|
|
1269
|
+
}, $[12] = isTopLayer, $[13] = level, $[14] = registerChild, $[15] = size, $[16] = zIndex, $[17] = t7) : t7 = $[17];
|
|
1270
|
+
let value = t7, t8;
|
|
1271
|
+
return $[18] !== children || $[19] !== value ? (t8 = /* @__PURE__ */ jsx(LayerContext.Provider, {
|
|
1272
|
+
value,
|
|
1273
|
+
children
|
|
1274
|
+
}), $[18] = children, $[19] = value, $[20] = t8) : t8 = $[20], t8;
|
|
1275
|
+
}
|
|
1276
|
+
function _temp2$4(v_0) {
|
|
1277
|
+
return v_0 - 1;
|
|
1278
|
+
}
|
|
1279
|
+
function _temp$13(v) {
|
|
1280
|
+
return v + 1;
|
|
1281
|
+
}
|
|
1282
|
+
/**
|
|
1283
|
+
* @public
|
|
1284
|
+
*/
|
|
1285
|
+
function useLayer() {
|
|
1286
|
+
let $ = c(2), value = useContext(LayerContext);
|
|
1287
|
+
if (!value) throw Error("useLayer(): missing context value");
|
|
1288
|
+
try {
|
|
1289
|
+
let t1;
|
|
1290
|
+
return $[0] === value ? t1 = $[1] : (t1 = getLayerContext(value), $[0] = value, $[1] = t1), t1;
|
|
1291
|
+
} catch (t0) {
|
|
1292
|
+
let err = t0;
|
|
1293
|
+
throw err instanceof Error ? Error(`useLayer(): ${err.message}`) : Error(`useLayer(): ${err}`);
|
|
1294
|
+
}
|
|
1295
|
+
}
|
|
1296
|
+
const key = "@sanity/ui/context/portal", elementKey = Symbol.for(`${key}/element`);
|
|
1297
|
+
globalScope[elementKey] = null;
|
|
1298
|
+
const PortalContext = createGlobalScopedContext(key, {
|
|
1299
|
+
version: 0,
|
|
1300
|
+
boundaryElement: null,
|
|
1301
|
+
get element() {
|
|
1302
|
+
return typeof document > "u" ? null : globalScope[elementKey] ? globalScope[elementKey] : (globalScope[elementKey] = document.createElement("div"), globalScope[elementKey].setAttribute("data-portal", ""), document.body.appendChild(globalScope[elementKey]), globalScope[elementKey]);
|
|
1303
|
+
}
|
|
1304
|
+
});
|
|
1305
|
+
/**
|
|
1306
|
+
* @public
|
|
1307
|
+
*/
|
|
1308
|
+
function usePortal() {
|
|
1309
|
+
let value = useContext(PortalContext);
|
|
1310
|
+
if (!value) throw Error("usePortal(): missing context value");
|
|
1311
|
+
if (!isRecord(value) || value.version !== 0) throw Error("usePortal(): the context value is not compatible");
|
|
1312
|
+
return value;
|
|
1313
|
+
}
|
|
1314
|
+
/**
|
|
1315
|
+
* @public
|
|
1316
|
+
*/
|
|
1317
|
+
function Portal(props) {
|
|
1318
|
+
let $ = c(3), { children, __unstable_name: name } = props, portal = usePortal(), portalElement = (name ? portal.elements && portal.elements[name] : portal.element) || portal.elements?.default;
|
|
1319
|
+
if (!portalElement) return null;
|
|
1320
|
+
let t0;
|
|
1321
|
+
return $[0] !== children || $[1] !== portalElement ? (t0 = createPortal(children, portalElement), $[0] = children, $[1] = portalElement, $[2] = t0) : t0 = $[2], t0;
|
|
1322
|
+
}
|
|
1323
|
+
const DEFAULT_POPOVER_MARGINS = [
|
|
1324
|
+
0,
|
|
1325
|
+
0,
|
|
1326
|
+
0,
|
|
1327
|
+
0
|
|
1328
|
+
], DEFAULT_FALLBACK_PLACEMENTS$1 = {
|
|
1329
|
+
top: [
|
|
1330
|
+
"bottom",
|
|
1331
|
+
"left",
|
|
1332
|
+
"right"
|
|
1333
|
+
],
|
|
1334
|
+
"top-start": [
|
|
1335
|
+
"bottom-start",
|
|
1336
|
+
"left-start",
|
|
1337
|
+
"right-start"
|
|
1338
|
+
],
|
|
1339
|
+
"top-end": [
|
|
1340
|
+
"bottom-end",
|
|
1341
|
+
"left-end",
|
|
1342
|
+
"right-end"
|
|
1343
|
+
],
|
|
1344
|
+
bottom: [
|
|
1345
|
+
"top",
|
|
1346
|
+
"left",
|
|
1347
|
+
"right"
|
|
1348
|
+
],
|
|
1349
|
+
"bottom-start": [
|
|
1350
|
+
"top-start",
|
|
1351
|
+
"left-start",
|
|
1352
|
+
"right-start"
|
|
1353
|
+
],
|
|
1354
|
+
"bottom-end": [
|
|
1355
|
+
"top-end",
|
|
1356
|
+
"left-end",
|
|
1357
|
+
"right-end"
|
|
1358
|
+
],
|
|
1359
|
+
left: [
|
|
1360
|
+
"right",
|
|
1361
|
+
"top",
|
|
1362
|
+
"bottom"
|
|
1363
|
+
],
|
|
1364
|
+
"left-start": [
|
|
1365
|
+
"right-start",
|
|
1366
|
+
"top-start",
|
|
1367
|
+
"bottom-start"
|
|
1368
|
+
],
|
|
1369
|
+
"left-end": [
|
|
1370
|
+
"right-end",
|
|
1371
|
+
"top-end",
|
|
1372
|
+
"bottom-end"
|
|
1373
|
+
],
|
|
1374
|
+
right: [
|
|
1375
|
+
"left",
|
|
1376
|
+
"top",
|
|
1377
|
+
"bottom"
|
|
1378
|
+
],
|
|
1379
|
+
"right-start": [
|
|
1380
|
+
"left-start",
|
|
1381
|
+
"top-start",
|
|
1382
|
+
"bottom-start"
|
|
1383
|
+
],
|
|
1384
|
+
"right-end": [
|
|
1385
|
+
"left-end",
|
|
1386
|
+
"top-end",
|
|
1387
|
+
"bottom-end"
|
|
1388
|
+
]
|
|
1389
|
+
};
|
|
1390
|
+
function size(options) {
|
|
1391
|
+
let { constrainSize, margins, matchReferenceWidth, maxWidthRef, padding = 0, referenceWidthRef, setReferenceWidth, widthRef } = options;
|
|
1392
|
+
return {
|
|
1393
|
+
name: "@sanity/ui/size",
|
|
1394
|
+
async fn(args) {
|
|
1395
|
+
let { elements, placement, platform, rects } = args, { floating, reference } = rects, overflow = await detectOverflow(args, {
|
|
1396
|
+
altBoundary: !0,
|
|
1397
|
+
boundary: options.boundaryElement || void 0,
|
|
1398
|
+
elementContext: "floating",
|
|
1399
|
+
padding,
|
|
1400
|
+
rootBoundary: "viewport"
|
|
1401
|
+
}), maxWidth = Infinity, maxHeight = Infinity, floatingW = floating.width, floatingH = floating.height;
|
|
1402
|
+
placement.includes("top") && (maxWidth = floatingW - (overflow.left + overflow.right), maxHeight = floatingH - overflow.top), placement.includes("right") && (maxWidth = floatingW - overflow.right, maxHeight = floatingH - (overflow.top + overflow.bottom)), placement.includes("bottom") && (maxWidth = floatingW - (overflow.left + overflow.right), maxHeight = floatingH - overflow.bottom), placement.includes("left") && (maxWidth = floatingW - overflow.left, maxHeight = floatingH - (overflow.top + overflow.bottom));
|
|
1403
|
+
let availableWidth = maxWidth - margins[1] - margins[3], availableHeight = maxHeight - margins[0] - margins[2], referenceWidth = reference.width - margins[1] - margins[3];
|
|
1404
|
+
referenceWidthRef.current = referenceWidth, setReferenceWidth(referenceWidth), matchReferenceWidth ? elements.floating.style.width = `${referenceWidth}px` : widthRef.current !== void 0 && (elements.floating.style.width = `${widthRef.current}px`), constrainSize && (elements.floating.style.maxWidth = `${Math.min(availableWidth, maxWidthRef.current ?? Infinity)}px`, elements.floating.style.maxHeight = `${availableHeight}px`);
|
|
1405
|
+
let nextDimensions = await platform.getDimensions(elements.floating), targetH = nextDimensions.height;
|
|
1406
|
+
return floatingW !== nextDimensions.width || floatingH !== targetH ? { reset: { rects: !0 } } : {};
|
|
1407
|
+
}
|
|
1408
|
+
};
|
|
1409
|
+
}
|
|
1410
|
+
function calcCurrentWidth(params) {
|
|
1411
|
+
let { container, mediaIndex, width } = params, w = width[mediaIndex], currentWidth = w === void 0 ? width[width.length - 1] : w;
|
|
1412
|
+
return typeof currentWidth == "number" ? container[currentWidth] : void 0;
|
|
1413
|
+
}
|
|
1414
|
+
function calcMaxWidth(params) {
|
|
1415
|
+
let { boundaryWidth, currentWidth } = params;
|
|
1416
|
+
if (currentWidth !== void 0 || boundaryWidth !== void 0) return Math.min(currentWidth ?? Infinity, (boundaryWidth || Infinity) - 8);
|
|
1417
|
+
}
|
|
1418
|
+
function moveTowardsLength(movingPoint, targetPoint, amount) {
|
|
1419
|
+
let width = targetPoint.x - movingPoint.x, height = targetPoint.y - movingPoint.y, distance = Math.sqrt(width * width + height * height);
|
|
1420
|
+
return moveTowardsFractional(movingPoint, targetPoint, Math.min(1, amount / distance));
|
|
1421
|
+
}
|
|
1422
|
+
function moveTowardsFractional(movingPoint, targetPoint, fraction) {
|
|
1423
|
+
return {
|
|
1424
|
+
x: movingPoint.x + (targetPoint.x - movingPoint.x) * fraction,
|
|
1425
|
+
y: movingPoint.y + (targetPoint.y - movingPoint.y) * fraction
|
|
1426
|
+
};
|
|
1427
|
+
}
|
|
1428
|
+
function getRoundedCommands(points) {
|
|
1429
|
+
let len = points.length, cmds = [];
|
|
1430
|
+
for (let i = 0; i < len; i += 1) {
|
|
1431
|
+
let point = points[i], prevPoint = points[i - 1], nextPoint = points[i + 1];
|
|
1432
|
+
if (prevPoint && point.radius) {
|
|
1433
|
+
let curveStart = moveTowardsLength(point, prevPoint, point.radius), curveEnd = moveTowardsLength(point, nextPoint, point.radius), startControl = moveTowardsFractional(curveStart, point, .5), endControl = moveTowardsFractional(point, curveEnd, .5);
|
|
1434
|
+
cmds.push({
|
|
1435
|
+
type: "point",
|
|
1436
|
+
...curveStart
|
|
1437
|
+
}), cmds.push({
|
|
1438
|
+
type: "curve",
|
|
1439
|
+
curveEnd,
|
|
1440
|
+
startControl,
|
|
1441
|
+
endControl
|
|
1442
|
+
});
|
|
1443
|
+
} else cmds.push({
|
|
1444
|
+
type: "point",
|
|
1445
|
+
...point
|
|
1446
|
+
});
|
|
1447
|
+
}
|
|
1448
|
+
return cmds;
|
|
1449
|
+
}
|
|
1450
|
+
function compileCommands(cmds) {
|
|
1451
|
+
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(" ");
|
|
1452
|
+
}
|
|
1453
|
+
const StyledArrow = /* @__PURE__ */ styled.div.withConfig({
|
|
1454
|
+
displayName: "StyledArrow",
|
|
1455
|
+
componentId: "sc-v1uolb-0"
|
|
1456
|
+
})(({ $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({
|
|
1457
|
+
displayName: "StrokePath",
|
|
1458
|
+
componentId: "sc-v1uolb-1"
|
|
1459
|
+
})`stroke:var(--card-shadow-outline-color);`, ShapePath = styled.path.withConfig({
|
|
1460
|
+
displayName: "ShapePath",
|
|
1461
|
+
componentId: "sc-v1uolb-2"
|
|
1462
|
+
})`fill:var(--card-bg-color);`, Arrow = forwardRef(function Arrow(props, ref) {
|
|
1463
|
+
let $ = c(29), h, restProps, t0, w;
|
|
1464
|
+
$[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);
|
|
1465
|
+
let radius = t0 === void 0 ? 0 : t0, { card } = useTheme_v2(), strokeWidth = card.shadow.outline, center = w / 2, t1;
|
|
1466
|
+
$[5] !== center || $[6] !== h || $[7] !== radius || $[8] !== w ? (t1 = compileCommands(getRoundedCommands([
|
|
1467
|
+
{
|
|
1468
|
+
x: 0,
|
|
1469
|
+
y: 0
|
|
1470
|
+
},
|
|
1471
|
+
{
|
|
1472
|
+
x: radius,
|
|
1473
|
+
y: 0,
|
|
1474
|
+
radius
|
|
1475
|
+
},
|
|
1476
|
+
{
|
|
1477
|
+
x: center,
|
|
1478
|
+
y: h - 1,
|
|
1479
|
+
radius
|
|
1480
|
+
},
|
|
1481
|
+
{
|
|
1482
|
+
x: w - radius,
|
|
1483
|
+
y: 0,
|
|
1484
|
+
radius
|
|
1485
|
+
},
|
|
1486
|
+
{
|
|
1487
|
+
x: w,
|
|
1488
|
+
y: 0
|
|
1489
|
+
}
|
|
1490
|
+
])), $[5] = center, $[6] = h, $[7] = radius, $[8] = w, $[9] = t1) : t1 = $[9];
|
|
1491
|
+
let path = t1, strokePath = `${path}`, fillPath = `${path} M ${w} -1 M 0 -1 Z`, t2 = `0 0 ${w} ${w}`, t3;
|
|
1492
|
+
$[10] !== strokeWidth || $[11] !== w ? (t3 = /* @__PURE__ */ jsx("mask", {
|
|
1493
|
+
id: "stroke-mask",
|
|
1494
|
+
children: /* @__PURE__ */ jsx("rect", {
|
|
1495
|
+
x: 0,
|
|
1496
|
+
y: strokeWidth,
|
|
1497
|
+
width: w,
|
|
1498
|
+
height: w,
|
|
1499
|
+
fill: "white"
|
|
1500
|
+
})
|
|
1501
|
+
}), $[10] = strokeWidth, $[11] = w, $[12] = t3) : t3 = $[12];
|
|
1502
|
+
let t4 = strokeWidth * 2, t5;
|
|
1503
|
+
$[13] !== strokePath || $[14] !== t4 ? (t5 = /* @__PURE__ */ jsx(StrokePath, {
|
|
1504
|
+
d: strokePath,
|
|
1505
|
+
mask: "url(#stroke-mask)",
|
|
1506
|
+
strokeWidth: t4
|
|
1507
|
+
}), $[13] = strokePath, $[14] = t4, $[15] = t5) : t5 = $[15];
|
|
1508
|
+
let t6;
|
|
1509
|
+
$[16] === fillPath ? t6 = $[17] : (t6 = /* @__PURE__ */ jsx(ShapePath, { d: fillPath }), $[16] = fillPath, $[17] = t6);
|
|
1510
|
+
let t7;
|
|
1511
|
+
$[18] !== t2 || $[19] !== t3 || $[20] !== t5 || $[21] !== t6 || $[22] !== w ? (t7 = /* @__PURE__ */ jsxs("svg", {
|
|
1512
|
+
width: w,
|
|
1513
|
+
height: w,
|
|
1514
|
+
viewBox: t2,
|
|
1515
|
+
children: [
|
|
1516
|
+
t3,
|
|
1517
|
+
t5,
|
|
1518
|
+
t6
|
|
1519
|
+
]
|
|
1520
|
+
}), $[18] = t2, $[19] = t3, $[20] = t5, $[21] = t6, $[22] = w, $[23] = t7) : t7 = $[23];
|
|
1521
|
+
let t8;
|
|
1522
|
+
return $[24] !== ref || $[25] !== restProps || $[26] !== t7 || $[27] !== w ? (t8 = /* @__PURE__ */ jsx(StyledArrow, {
|
|
1523
|
+
...restProps,
|
|
1524
|
+
$w: w,
|
|
1525
|
+
ref,
|
|
1526
|
+
children: t7
|
|
1527
|
+
}), $[24] = ref, $[25] = restProps, $[26] = t7, $[27] = w, $[28] = t8) : t8 = $[28], t8;
|
|
1528
|
+
}), MotionCard$1 = styled(motion.create(Card)).withConfig({
|
|
1529
|
+
displayName: "MotionCard",
|
|
1530
|
+
componentId: "sc-q9sjvh-0"
|
|
1531
|
+
})`&:not([hidden]){display:flex;}flex-direction:column;width:max-content;min-width:min-content;will-change:transform;`, MotionFlex$1 = styled(motion.create(Flex)).withConfig({
|
|
1532
|
+
displayName: "MotionFlex",
|
|
1533
|
+
componentId: "sc-q9sjvh-1"
|
|
1534
|
+
})`will-change:opacity;`, PopoverCard = forwardRef(function PopoverCard(props, ref) {
|
|
1535
|
+
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;
|
|
1536
|
+
$[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);
|
|
1537
|
+
let { zIndex } = useLayer(), margins = marginsProp || DEFAULT_POPOVER_MARGINS, x = (xProp ?? 0) + margins[3], y = (yProp ?? 0) + margins[0], t0 = animate ? "transform" : void 0, t1;
|
|
1538
|
+
$[23] !== originX || $[24] !== originY || $[25] !== strategy || $[26] !== style || $[27] !== t0 || $[28] !== width || $[29] !== x || $[30] !== y || $[31] !== zIndex ? (t1 = {
|
|
1539
|
+
left: x,
|
|
1540
|
+
originX,
|
|
1541
|
+
originY,
|
|
1542
|
+
position: strategy,
|
|
1543
|
+
top: y,
|
|
1544
|
+
width,
|
|
1545
|
+
zIndex,
|
|
1546
|
+
willChange: t0,
|
|
1547
|
+
...style
|
|
1548
|
+
}, $[23] = originX, $[24] = originY, $[25] = strategy, $[26] = style, $[27] = t0, $[28] = width, $[29] = x, $[30] = y, $[31] = zIndex, $[32] = t1) : t1 = $[32];
|
|
1549
|
+
let rootStyle = t1, t2 = arrowX === null ? void 0 : arrowX, t3 = arrowY === null ? void 0 : arrowY, t4;
|
|
1550
|
+
$[33] !== t2 || $[34] !== t3 ? (t4 = {
|
|
1551
|
+
left: t2,
|
|
1552
|
+
top: t3,
|
|
1553
|
+
right: void 0,
|
|
1554
|
+
bottom: void 0
|
|
1555
|
+
}, $[33] = t2, $[34] = t3, $[35] = t4) : t4 = $[35];
|
|
1556
|
+
let arrowStyle = t4, t5 = restProps, t6;
|
|
1557
|
+
$[36] === animate ? t6 = $[37] : (t6 = animate ? ["hidden", "initial"] : void 0, $[36] = animate, $[37] = t6);
|
|
1558
|
+
let t7;
|
|
1559
|
+
$[38] === animate ? t7 = $[39] : (t7 = animate ? ["visible", "scaleIn"] : void 0, $[38] = animate, $[39] = t7);
|
|
1560
|
+
let t8;
|
|
1561
|
+
$[40] === animate ? t8 = $[41] : (t8 = animate ? ["hidden", "scaleOut"] : void 0, $[40] = animate, $[41] = t8);
|
|
1562
|
+
let t9;
|
|
1563
|
+
$[42] !== children || $[43] !== padding ? (t9 = /* @__PURE__ */ jsx(Flex, {
|
|
1564
|
+
direction: "column",
|
|
1565
|
+
flex: 1,
|
|
1566
|
+
padding,
|
|
1567
|
+
children
|
|
1568
|
+
}), $[42] = children, $[43] = padding, $[44] = t9) : t9 = $[44];
|
|
1569
|
+
let t10;
|
|
1570
|
+
$[45] !== overflow || $[46] !== t9 ? (t10 = /* @__PURE__ */ jsx(MotionFlex$1, {
|
|
1571
|
+
"data-ui": "Popover__wrapper",
|
|
1572
|
+
direction: "column",
|
|
1573
|
+
flex: 1,
|
|
1574
|
+
overflow,
|
|
1575
|
+
variants: POPOVER_MOTION_PROPS.children,
|
|
1576
|
+
transition: POPOVER_MOTION_PROPS.transition,
|
|
1577
|
+
children: t9
|
|
1578
|
+
}), $[45] = overflow, $[46] = t9, $[47] = t10) : t10 = $[47];
|
|
1579
|
+
let t11;
|
|
1580
|
+
$[48] !== arrow || $[49] !== arrowRef || $[50] !== arrowStyle ? (t11 = arrow && /* @__PURE__ */ jsx(Arrow, {
|
|
1581
|
+
ref: arrowRef,
|
|
1582
|
+
style: arrowStyle,
|
|
1583
|
+
width: 19,
|
|
1584
|
+
height: 8,
|
|
1585
|
+
radius: 2
|
|
1586
|
+
}), $[48] = arrow, $[49] = arrowRef, $[50] = arrowStyle, $[51] = t11) : t11 = $[51];
|
|
1587
|
+
let t12;
|
|
1588
|
+
return $[52] !== placement || $[53] !== radius || $[54] !== ref || $[55] !== rootStyle || $[56] !== scheme || $[57] !== shadow || $[58] !== t10 || $[59] !== t11 || $[60] !== t5 || $[61] !== t6 || $[62] !== t7 || $[63] !== t8 || $[64] !== tone ? (t12 = /* @__PURE__ */ jsxs(MotionCard$1, {
|
|
1589
|
+
"data-ui": "Popover",
|
|
1590
|
+
...t5,
|
|
1591
|
+
"data-placement": placement,
|
|
1592
|
+
radius,
|
|
1593
|
+
ref,
|
|
1594
|
+
scheme,
|
|
1595
|
+
shadow,
|
|
1596
|
+
sizing: "border",
|
|
1597
|
+
style: rootStyle,
|
|
1598
|
+
tone,
|
|
1599
|
+
variants: POPOVER_MOTION_PROPS.card,
|
|
1600
|
+
transition: POPOVER_MOTION_PROPS.transition,
|
|
1601
|
+
initial: t6,
|
|
1602
|
+
animate: t7,
|
|
1603
|
+
exit: t8,
|
|
1604
|
+
children: [t10, t11]
|
|
1605
|
+
}), $[52] = placement, $[53] = radius, $[54] = ref, $[55] = rootStyle, $[56] = scheme, $[57] = shadow, $[58] = t10, $[59] = t11, $[60] = t5, $[61] = t6, $[62] = t7, $[63] = t8, $[64] = tone, $[65] = t12) : t12 = $[65], t12;
|
|
1606
|
+
}), ViewportOverlay = () => {
|
|
1607
|
+
let $ = c(2), { zIndex } = useLayer(), t0;
|
|
1608
|
+
return $[0] === zIndex ? t0 = $[1] : (t0 = /* @__PURE__ */ jsx("div", { style: {
|
|
1609
|
+
height: "100vh",
|
|
1610
|
+
inset: 0,
|
|
1611
|
+
position: "fixed",
|
|
1612
|
+
width: "100vw",
|
|
1613
|
+
zIndex
|
|
1614
|
+
} }), $[0] = zIndex, $[1] = t0), t0;
|
|
1615
|
+
}, Popover = forwardRef(function Popover(props, forwardedRef) {
|
|
1616
|
+
let $ = c(125), { container, layer } = useTheme_v2(), boundaryElementContext = useBoundaryElement(), _fallbackPlacements, _floatingBoundary, _referenceBoundary, _zOffsetProp, childProp, content, disabled, matchReferenceWidth, modal, open, paddingProp, portal, referenceElement, restProps, scheme, t0, t1, t10, t11, t2, t3, t4, t5, t6, t7, t8, t9, updateRef;
|
|
1617
|
+
if ($[0] !== props) {
|
|
1618
|
+
let { __unstable_margins: t12, animate: t13, arrow: t14, children: t15, constrainSize: t16, content: t17, disabled: t18, fallbackPlacements: t19, matchReferenceWidth: t20, floatingBoundary: t21, modal: t22, onActivate, open: t23, overflow: t24, padding: t25, placement: t26, placementStrategy: t27, portal: t28, preventOverflow: t29, radius: t30, referenceBoundary: t31, referenceElement: t32, scheme: t33, shadow: t34, tone: t35, width: t36, zOffset: t37, updateRef: t38, ...t39 } = props;
|
|
1619
|
+
t0 = t12, t1 = t13, t2 = t14, childProp = t15, t3 = t16, content = t17, disabled = t18, _fallbackPlacements = t19, matchReferenceWidth = t20, _floatingBoundary = t21, modal = t22, open = t23, t4 = t24, paddingProp = t25, t5 = t26, t6 = t27, portal = t28, t7 = t29, t8 = t30, _referenceBoundary = t31, referenceElement = t32, scheme = t33, t9 = t34, t10 = t35, t11 = t36, _zOffsetProp = t37, updateRef = t38, restProps = t39, $[0] = props, $[1] = _fallbackPlacements, $[2] = _floatingBoundary, $[3] = _referenceBoundary, $[4] = _zOffsetProp, $[5] = childProp, $[6] = content, $[7] = disabled, $[8] = matchReferenceWidth, $[9] = modal, $[10] = open, $[11] = paddingProp, $[12] = portal, $[13] = referenceElement, $[14] = restProps, $[15] = scheme, $[16] = t0, $[17] = t1, $[18] = t10, $[19] = t11, $[20] = t2, $[21] = t3, $[22] = t4, $[23] = t5, $[24] = t6, $[25] = t7, $[26] = t8, $[27] = t9, $[28] = updateRef;
|
|
1620
|
+
} else _fallbackPlacements = $[1], _floatingBoundary = $[2], _referenceBoundary = $[3], _zOffsetProp = $[4], childProp = $[5], content = $[6], disabled = $[7], matchReferenceWidth = $[8], modal = $[9], open = $[10], paddingProp = $[11], portal = $[12], referenceElement = $[13], restProps = $[14], scheme = $[15], t0 = $[16], t1 = $[17], t10 = $[18], t11 = $[19], t2 = $[20], t3 = $[21], t4 = $[22], t5 = $[23], t6 = $[24], t7 = $[25], t8 = $[26], t9 = $[27], updateRef = $[28];
|
|
1621
|
+
let margins = t0 === void 0 ? DEFAULT_POPOVER_MARGINS : t0, _animate = t1 !== void 0 && t1, arrowProp = t2 !== void 0 && t2, constrainSize = t3 !== void 0 && t3, overflow = t4 === void 0 ? "hidden" : t4, placementProp = t5 === void 0 ? "bottom" : t5, placementStrategy = t6 === void 0 ? "flip" : t6, preventOverflow = t7 === void 0 || t7, radiusProp = t8 === void 0 ? 3 : t8, shadowProp = t9 === void 0 ? 3 : t9, tone = t10 === void 0 ? "inherit" : t10, widthProp = t11 === void 0 ? "auto" : t11, fallbackPlacements = _fallbackPlacements ?? DEFAULT_FALLBACK_PLACEMENTS$1[props.placement ?? "bottom"], floatingBoundary = _floatingBoundary ?? boundaryElementContext.element, referenceBoundary = _referenceBoundary ?? boundaryElementContext.element, boundaryElement = boundaryElementContext.element ?? floatingBoundary, zOffsetProp = _zOffsetProp ?? layer.popover.zOffset, animate = !usePrefersReducedMotion() && _animate, boundarySize = useElementSize(boundaryElement)?.border, t12;
|
|
1622
|
+
$[29] === paddingProp ? t12 = $[30] : (t12 = _getArrayProp(paddingProp), $[29] = paddingProp, $[30] = t12);
|
|
1623
|
+
let padding = t12, t13;
|
|
1624
|
+
$[31] === radiusProp ? t13 = $[32] : (t13 = _getArrayProp(radiusProp), $[31] = radiusProp, $[32] = t13);
|
|
1625
|
+
let radius = t13, t14;
|
|
1626
|
+
$[33] === shadowProp ? t14 = $[34] : (t14 = _getArrayProp(shadowProp), $[33] = shadowProp, $[34] = t14);
|
|
1627
|
+
let shadow = t14, widthArrayProp = _getArrayProp(widthProp), t15;
|
|
1628
|
+
$[35] === zOffsetProp ? t15 = $[36] : (t15 = _getArrayProp(zOffsetProp), $[35] = zOffsetProp, $[36] = t15);
|
|
1629
|
+
let zOffset = t15, ref = useRef(null), arrowRef = useRef(null), t16;
|
|
1630
|
+
$[37] === Symbol.for("react.memo_cache_sentinel") ? (t16 = () => ref.current, $[37] = t16) : t16 = $[37], useImperativeHandle(forwardedRef, t16);
|
|
1631
|
+
let mediaIndex = useMediaIndex(), boundaryWidth = constrainSize || preventOverflow ? boundarySize?.width : void 0, width = calcCurrentWidth({
|
|
1632
|
+
container,
|
|
1633
|
+
mediaIndex,
|
|
1634
|
+
width: widthArrayProp
|
|
1635
|
+
}), widthRef = useRef(width), t17, t18;
|
|
1636
|
+
$[38] === width ? (t17 = $[39], t18 = $[40]) : (t17 = () => {
|
|
1637
|
+
widthRef.current = width;
|
|
1638
|
+
}, t18 = [width], $[38] = width, $[39] = t17, $[40] = t18), useEffect(t17, t18);
|
|
1639
|
+
let t19;
|
|
1640
|
+
$[41] !== boundaryWidth || $[42] !== width ? (t19 = calcMaxWidth({
|
|
1641
|
+
boundaryWidth,
|
|
1642
|
+
currentWidth: width
|
|
1643
|
+
}), $[41] = boundaryWidth, $[42] = width, $[43] = t19) : t19 = $[43];
|
|
1644
|
+
let maxWidth = t19, maxWidthRef = useRef(maxWidth), t20, t21;
|
|
1645
|
+
$[44] === maxWidth ? (t20 = $[45], t21 = $[46]) : (t20 = () => {
|
|
1646
|
+
maxWidthRef.current = maxWidth;
|
|
1647
|
+
}, t21 = [maxWidth], $[44] = maxWidth, $[45] = t20, $[46] = t21), useEffect(t20, t21);
|
|
1648
|
+
let referenceWidthRef = useRef(void 0), t22, t23;
|
|
1649
|
+
$[47] !== matchReferenceWidth || $[48] !== maxWidth || $[49] !== open || $[50] !== width ? (t22 = () => {
|
|
1650
|
+
let floatingElement = ref.current;
|
|
1651
|
+
if (!open || !floatingElement) return;
|
|
1652
|
+
let referenceWidth = referenceWidthRef.current;
|
|
1653
|
+
matchReferenceWidth ? referenceWidth !== void 0 && (floatingElement.style.width = `${referenceWidth}px`) : width !== void 0 && (floatingElement.style.width = `${width}px`), typeof maxWidth == "number" && (floatingElement.style.maxWidth = `${maxWidth}px`);
|
|
1654
|
+
}, t23 = [
|
|
1655
|
+
width,
|
|
1656
|
+
matchReferenceWidth,
|
|
1657
|
+
maxWidth,
|
|
1658
|
+
open
|
|
1659
|
+
], $[47] = matchReferenceWidth, $[48] = maxWidth, $[49] = open, $[50] = width, $[51] = t22, $[52] = t23) : (t22 = $[51], t23 = $[52]), useEffect(t22, t23);
|
|
1660
|
+
let [referenceWidth_0, setReferenceWidth] = useState(void 0), t24;
|
|
1661
|
+
$[53] !== animate || $[54] !== arrowProp || $[55] !== constrainSize || $[56] !== fallbackPlacements || $[57] !== floatingBoundary || $[58] !== margins || $[59] !== matchReferenceWidth || $[60] !== placementProp || $[61] !== placementStrategy || $[62] !== preventOverflow || $[63] !== referenceBoundary ? (t24 = {
|
|
1662
|
+
animate,
|
|
1663
|
+
arrowProp,
|
|
1664
|
+
arrowRef,
|
|
1665
|
+
constrainSize,
|
|
1666
|
+
fallbackPlacements,
|
|
1667
|
+
floatingBoundary,
|
|
1668
|
+
margins,
|
|
1669
|
+
matchReferenceWidth,
|
|
1670
|
+
maxWidthRef,
|
|
1671
|
+
placementProp,
|
|
1672
|
+
placementStrategy,
|
|
1673
|
+
preventOverflow,
|
|
1674
|
+
referenceBoundary,
|
|
1675
|
+
referenceWidthRef,
|
|
1676
|
+
rootBoundary: "viewport",
|
|
1677
|
+
setReferenceWidth,
|
|
1678
|
+
widthRef
|
|
1679
|
+
}, $[53] = animate, $[54] = arrowProp, $[55] = constrainSize, $[56] = fallbackPlacements, $[57] = floatingBoundary, $[58] = margins, $[59] = matchReferenceWidth, $[60] = placementProp, $[61] = placementStrategy, $[62] = preventOverflow, $[63] = referenceBoundary, $[64] = t24) : t24 = $[64];
|
|
1680
|
+
let middleware = useMiddleware$1(t24), t25;
|
|
1681
|
+
$[65] === referenceElement ? t25 = $[66] : (t25 = referenceElement ? { reference: referenceElement } : void 0, $[65] = referenceElement, $[66] = t25);
|
|
1682
|
+
let t26;
|
|
1683
|
+
$[67] !== middleware || $[68] !== placementProp || $[69] !== t25 ? (t26 = {
|
|
1684
|
+
middleware,
|
|
1685
|
+
placement: placementProp,
|
|
1686
|
+
whileElementsMounted: autoUpdate,
|
|
1687
|
+
elements: t25
|
|
1688
|
+
}, $[67] = middleware, $[68] = placementProp, $[69] = t25, $[70] = t26) : t26 = $[70];
|
|
1689
|
+
let { x, y, middlewareData, placement, refs, strategy, update } = useFloating(t26), referenceHidden = middlewareData.hide?.referenceHidden, arrowX = middlewareData.arrow?.x, arrowY = middlewareData.arrow?.y, originX = middlewareData["@sanity/ui/origin"]?.originX, originY = middlewareData["@sanity/ui/origin"]?.originY, t27;
|
|
1690
|
+
$[71] === Symbol.for("react.memo_cache_sentinel") ? (t27 = (arrowEl) => {
|
|
1691
|
+
arrowRef.current = arrowEl;
|
|
1692
|
+
}, $[71] = t27) : t27 = $[71];
|
|
1693
|
+
let setArrow = t27, t28;
|
|
1694
|
+
$[72] === refs ? t28 = $[73] : (t28 = (node) => {
|
|
1695
|
+
ref.current = node, refs.setFloating(node);
|
|
1696
|
+
}, $[72] = refs, $[73] = t28);
|
|
1697
|
+
let setFloating = t28, t29;
|
|
1698
|
+
$[74] === childProp ? t29 = $[75] : (t29 = childProp ? getElementRef(childProp) : null, $[74] = childProp, $[75] = t29);
|
|
1699
|
+
let t30;
|
|
1700
|
+
$[76] === refs.reference.current ? t30 = $[77] : (t30 = () => refs.reference.current, $[76] = refs.reference.current, $[77] = t30), useImperativeHandle(t29, t30);
|
|
1701
|
+
let t31;
|
|
1702
|
+
bb0: {
|
|
1703
|
+
if (referenceElement) {
|
|
1704
|
+
t31 = childProp;
|
|
1705
|
+
break bb0;
|
|
1706
|
+
}
|
|
1707
|
+
if (!childProp) {
|
|
1708
|
+
t31 = null;
|
|
1709
|
+
break bb0;
|
|
1710
|
+
}
|
|
1711
|
+
let t32;
|
|
1712
|
+
$[78] !== childProp || $[79] !== refs.setReference ? (t32 = cloneElement(childProp, { ref: refs.setReference }), $[78] = childProp, $[79] = refs.setReference, $[80] = t32) : t32 = $[80], t31 = t32;
|
|
1713
|
+
}
|
|
1714
|
+
let child = t31, t32, t33;
|
|
1715
|
+
if ($[81] === update ? (t32 = $[82], t33 = $[83]) : (t32 = () => update, t33 = [update], $[81] = update, $[82] = t32, $[83] = t33), useImperativeHandle(updateRef, t32, t33), disabled) {
|
|
1716
|
+
let t34;
|
|
1717
|
+
return $[84] === childProp ? t34 = $[85] : (t34 = childProp || /* @__PURE__ */ jsx(Fragment$1, {}), $[84] = childProp, $[85] = t34), t34;
|
|
1718
|
+
}
|
|
1719
|
+
let t34;
|
|
1720
|
+
$[86] === modal ? t34 = $[87] : (t34 = modal && /* @__PURE__ */ jsx(ViewportOverlay, {}), $[86] = modal, $[87] = t34);
|
|
1721
|
+
let t35 = matchReferenceWidth ? referenceWidth_0 : width, t36;
|
|
1722
|
+
$[88] !== animate || $[89] !== arrowProp || $[90] !== arrowX || $[91] !== arrowY || $[92] !== content || $[93] !== margins || $[94] !== originX || $[95] !== originY || $[96] !== overflow || $[97] !== padding || $[98] !== placement || $[99] !== radius || $[100] !== referenceHidden || $[101] !== restProps || $[102] !== scheme || $[103] !== setFloating || $[104] !== shadow || $[105] !== strategy || $[106] !== t35 || $[107] !== tone || $[108] !== x || $[109] !== y ? (t36 = /* @__PURE__ */ jsx(PopoverCard, {
|
|
1723
|
+
...restProps,
|
|
1724
|
+
__unstable_margins: margins,
|
|
1725
|
+
animate,
|
|
1726
|
+
arrow: arrowProp,
|
|
1727
|
+
arrowRef: setArrow,
|
|
1728
|
+
arrowX,
|
|
1729
|
+
arrowY,
|
|
1730
|
+
hidden: referenceHidden,
|
|
1731
|
+
overflow,
|
|
1732
|
+
padding,
|
|
1733
|
+
placement,
|
|
1734
|
+
radius,
|
|
1735
|
+
ref: setFloating,
|
|
1736
|
+
scheme,
|
|
1737
|
+
shadow,
|
|
1738
|
+
originX,
|
|
1739
|
+
originY,
|
|
1740
|
+
strategy,
|
|
1741
|
+
tone,
|
|
1742
|
+
width: t35,
|
|
1743
|
+
x,
|
|
1744
|
+
y,
|
|
1745
|
+
children: content
|
|
1746
|
+
}), $[88] = animate, $[89] = arrowProp, $[90] = arrowX, $[91] = arrowY, $[92] = content, $[93] = margins, $[94] = originX, $[95] = originY, $[96] = overflow, $[97] = padding, $[98] = placement, $[99] = radius, $[100] = referenceHidden, $[101] = restProps, $[102] = scheme, $[103] = setFloating, $[104] = shadow, $[105] = strategy, $[106] = t35, $[107] = tone, $[108] = x, $[109] = y, $[110] = t36) : t36 = $[110];
|
|
1747
|
+
let t37;
|
|
1748
|
+
$[111] !== t34 || $[112] !== t36 || $[113] !== zOffset ? (t37 = /* @__PURE__ */ jsxs(LayerProvider, {
|
|
1749
|
+
zOffset,
|
|
1750
|
+
children: [t34, t36]
|
|
1751
|
+
}), $[111] = t34, $[112] = t36, $[113] = zOffset, $[114] = t37) : t37 = $[114];
|
|
1752
|
+
let popover = t37, t38;
|
|
1753
|
+
$[115] !== open || $[116] !== popover || $[117] !== portal ? (t38 = open && (portal ? /* @__PURE__ */ jsx(Portal, {
|
|
1754
|
+
__unstable_name: typeof portal == "string" ? portal : void 0,
|
|
1755
|
+
children: popover
|
|
1756
|
+
}) : popover), $[115] = open, $[116] = popover, $[117] = portal, $[118] = t38) : t38 = $[118];
|
|
1757
|
+
let children = t38, t39;
|
|
1758
|
+
$[119] !== animate || $[120] !== children ? (t39 = animate ? /* @__PURE__ */ jsx(AnimatePresence, { children }) : children, $[119] = animate, $[120] = children, $[121] = t39) : t39 = $[121];
|
|
1759
|
+
let t40;
|
|
1760
|
+
return $[122] !== child || $[123] !== t39 ? (t40 = /* @__PURE__ */ jsxs(Fragment$1, { children: [t39, child] }), $[122] = child, $[123] = t39, $[124] = t40) : t40 = $[124], t40;
|
|
1761
|
+
});
|
|
1762
|
+
function useMiddleware$1(t0) {
|
|
1763
|
+
let $ = c(42), { animate, arrowProp, arrowRef, constrainSize, fallbackPlacements, floatingBoundary, margins, matchReferenceWidth, maxWidthRef, placementProp, placementStrategy, preventOverflow, referenceBoundary, referenceWidthRef, rootBoundary, setReferenceWidth, widthRef } = t0, ret;
|
|
1764
|
+
if ($[0] !== animate || $[1] !== arrowProp || $[2] !== arrowRef || $[3] !== constrainSize || $[4] !== fallbackPlacements || $[5] !== floatingBoundary || $[6] !== margins || $[7] !== matchReferenceWidth || $[8] !== maxWidthRef || $[9] !== placementProp || $[10] !== placementStrategy || $[11] !== preventOverflow || $[12] !== referenceBoundary || $[13] !== referenceWidthRef || $[14] !== rootBoundary || $[15] !== setReferenceWidth || $[16] !== widthRef) {
|
|
1765
|
+
if (ret = [], constrainSize || preventOverflow) if (placementStrategy === "autoPlacement") {
|
|
1766
|
+
let t1;
|
|
1767
|
+
$[18] !== fallbackPlacements || $[19] !== placementProp ? (t1 = autoPlacement({ allowedPlacements: [placementProp].concat(fallbackPlacements) }), $[18] = fallbackPlacements, $[19] = placementProp, $[20] = t1) : t1 = $[20], ret.push(t1);
|
|
1768
|
+
} else {
|
|
1769
|
+
let t1 = floatingBoundary || void 0, t2;
|
|
1770
|
+
$[21] !== fallbackPlacements || $[22] !== rootBoundary || $[23] !== t1 ? (t2 = flip({
|
|
1771
|
+
boundary: t1,
|
|
1772
|
+
fallbackPlacements,
|
|
1773
|
+
padding: 4,
|
|
1774
|
+
rootBoundary
|
|
1775
|
+
}), $[21] = fallbackPlacements, $[22] = rootBoundary, $[23] = t1, $[24] = t2) : t2 = $[24], ret.push(t2);
|
|
1776
|
+
}
|
|
1777
|
+
let t1;
|
|
1778
|
+
if ($[25] === Symbol.for("react.memo_cache_sentinel") ? (t1 = offset({ mainAxis: 4 }), $[25] = t1) : t1 = $[25], ret.push(t1), constrainSize || matchReferenceWidth) {
|
|
1779
|
+
let t2 = floatingBoundary || void 0, t3;
|
|
1780
|
+
$[26] !== constrainSize || $[27] !== margins || $[28] !== matchReferenceWidth || $[29] !== maxWidthRef || $[30] !== referenceWidthRef || $[31] !== setReferenceWidth || $[32] !== t2 || $[33] !== widthRef ? (t3 = size({
|
|
1781
|
+
boundaryElement: t2,
|
|
1782
|
+
constrainSize,
|
|
1783
|
+
margins,
|
|
1784
|
+
matchReferenceWidth,
|
|
1785
|
+
maxWidthRef,
|
|
1786
|
+
padding: 4,
|
|
1787
|
+
referenceWidthRef,
|
|
1788
|
+
setReferenceWidth,
|
|
1789
|
+
widthRef
|
|
1790
|
+
}), $[26] = constrainSize, $[27] = margins, $[28] = matchReferenceWidth, $[29] = maxWidthRef, $[30] = referenceWidthRef, $[31] = setReferenceWidth, $[32] = t2, $[33] = widthRef, $[34] = t3) : t3 = $[34], ret.push(t3);
|
|
1791
|
+
}
|
|
1792
|
+
if (preventOverflow) {
|
|
1793
|
+
let t2 = floatingBoundary || void 0, t3;
|
|
1794
|
+
$[35] !== rootBoundary || $[36] !== t2 ? (t3 = shift({
|
|
1795
|
+
boundary: t2,
|
|
1796
|
+
rootBoundary,
|
|
1797
|
+
padding: 4
|
|
1798
|
+
}), $[35] = rootBoundary, $[36] = t2, $[37] = t3) : t3 = $[37], ret.push(t3);
|
|
1799
|
+
}
|
|
1800
|
+
if (arrowProp) {
|
|
1801
|
+
let t2;
|
|
1802
|
+
$[38] === arrowRef ? t2 = $[39] : (t2 = arrow({
|
|
1803
|
+
element: arrowRef,
|
|
1804
|
+
padding: 4
|
|
1805
|
+
}), $[38] = arrowRef, $[39] = t2), ret.push(t2);
|
|
1806
|
+
}
|
|
1807
|
+
animate && ret.push(origin);
|
|
1808
|
+
let t2 = referenceBoundary || void 0, t3;
|
|
1809
|
+
$[40] === t2 ? t3 = $[41] : (t3 = hide({
|
|
1810
|
+
boundary: t2,
|
|
1811
|
+
padding: 4,
|
|
1812
|
+
strategy: "referenceHidden"
|
|
1813
|
+
}), $[40] = t2, $[41] = t3), ret.push(t3), $[0] = animate, $[1] = arrowProp, $[2] = arrowRef, $[3] = constrainSize, $[4] = fallbackPlacements, $[5] = floatingBoundary, $[6] = margins, $[7] = matchReferenceWidth, $[8] = maxWidthRef, $[9] = placementProp, $[10] = placementStrategy, $[11] = preventOverflow, $[12] = referenceBoundary, $[13] = referenceWidthRef, $[14] = rootBoundary, $[15] = setReferenceWidth, $[16] = widthRef, $[17] = ret;
|
|
1814
|
+
} else ret = $[17];
|
|
1815
|
+
return ret;
|
|
1816
|
+
}
|
|
1817
|
+
const BASE_STYLE$1 = {
|
|
1818
|
+
"&&:not([hidden])": { display: "grid" },
|
|
1819
|
+
"&[data-as=\"ul\"],&[data-as=\"ol\"]": { listStyle: "none" },
|
|
1820
|
+
gridTemplateColumns: "minmax(0, 1fr)",
|
|
1821
|
+
gridAutoRows: "min-content"
|
|
1822
|
+
};
|
|
1823
|
+
function stackBaseStyle() {
|
|
1824
|
+
return BASE_STYLE$1;
|
|
1825
|
+
}
|
|
1826
|
+
function responsiveStackSpaceStyle(props) {
|
|
1827
|
+
let { media, space } = getTheme_v2(props.theme);
|
|
1828
|
+
return _responsive(media, props.$space, (spaceIndex) => ({ gridGap: rem(space[spaceIndex]) }));
|
|
1829
|
+
}
|
|
1830
|
+
const StyledStack = /* @__PURE__ */ styled(Box).withConfig({
|
|
1831
|
+
displayName: "StyledStack",
|
|
1832
|
+
componentId: "sc-brp9eo-0"
|
|
1833
|
+
})(stackBaseStyle, responsiveStackSpaceStyle), Stack = forwardRef(function Stack(props, ref) {
|
|
1834
|
+
let $ = c(12), as, gap, restProps;
|
|
1835
|
+
$[0] === props ? (as = $[1], gap = $[2], restProps = $[3]) : ({as, gap, ...restProps} = props, $[0] = props, $[1] = as, $[2] = gap, $[3] = restProps);
|
|
1836
|
+
let t0 = typeof as == "string" ? as : void 0, t1;
|
|
1837
|
+
$[4] === gap ? t1 = $[5] : (t1 = _getArrayProp(gap), $[4] = gap, $[5] = t1);
|
|
1838
|
+
let t2;
|
|
1839
|
+
return $[6] !== as || $[7] !== ref || $[8] !== restProps || $[9] !== t0 || $[10] !== t1 ? (t2 = /* @__PURE__ */ jsx(StyledStack, {
|
|
1840
|
+
"data-as": t0,
|
|
1841
|
+
"data-ui": "Stack",
|
|
1842
|
+
...restProps,
|
|
1843
|
+
$space: t1,
|
|
1844
|
+
forwardedAs: as,
|
|
1845
|
+
ref
|
|
1846
|
+
}), $[6] = as, $[7] = ref, $[8] = restProps, $[9] = t0, $[10] = t1, $[11] = t2) : t2 = $[11], t2;
|
|
1847
|
+
});
|
|
1848
|
+
/**
|
|
1849
|
+
* @beta
|
|
27
1850
|
*/
|
|
28
|
-
function
|
|
29
|
-
let
|
|
30
|
-
|
|
1851
|
+
function useCustomValidity(ref, customValidity) {
|
|
1852
|
+
let $ = c(4), t0, t1;
|
|
1853
|
+
$[0] !== customValidity || $[1] !== ref ? (t0 = () => {
|
|
1854
|
+
ref.current?.setCustomValidity(customValidity || "");
|
|
1855
|
+
}, t1 = [customValidity, ref], $[0] = customValidity, $[1] = ref, $[2] = t0, $[3] = t1) : (t0 = $[2], t1 = $[3]), useEffect(t0, t1);
|
|
1856
|
+
}
|
|
1857
|
+
function responsiveInputPaddingStyle(props) {
|
|
1858
|
+
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 = [];
|
|
1859
|
+
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];
|
|
1860
|
+
return _responsive(media, _padding, (_, i) => {
|
|
1861
|
+
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 = {
|
|
1862
|
+
paddingTop: rem(p - size.ascenderHeight),
|
|
1863
|
+
paddingRight: rem(p),
|
|
1864
|
+
paddingBottom: rem(p - size.descenderHeight),
|
|
1865
|
+
paddingLeft: rem(p)
|
|
1866
|
+
};
|
|
1867
|
+
return $iconRight && (styles.paddingRight = rem(p + emSize + s)), $iconLeft && (styles.paddingLeft = rem(p + emSize + s)), styles;
|
|
31
1868
|
});
|
|
32
|
-
return () => {
|
|
33
|
-
innerDispose && innerDispose(), outerDispose();
|
|
34
|
-
};
|
|
35
1869
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
1870
|
+
function responsiveInputPaddingIconRightStyle(props) {
|
|
1871
|
+
return responsiveInputPaddingStyle({
|
|
1872
|
+
...props,
|
|
1873
|
+
$iconRight: !0
|
|
1874
|
+
});
|
|
41
1875
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
function isFocusable(element) {
|
|
46
|
-
return element.tabIndex > 0 || element.tabIndex === 0 && element.getAttribute("tabIndex") !== null ? !0 : isHTMLAnchorElement(element) ? !!element.href && element.rel !== "ignore" : isHTMLInputElement(element) ? element.type !== "hidden" && element.type !== "file" && !element.disabled : isHTMLButtonElement(element) || isHTMLSelectElement(element) || isHTMLTextAreaElement(element) ? !element.disabled : !1;
|
|
1876
|
+
const ROOT_STYLE = css`&:not([hidden]){display:flex;}align-items:center;`;
|
|
1877
|
+
function textInputRootStyle() {
|
|
1878
|
+
return ROOT_STYLE;
|
|
47
1879
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
function attemptFocus(element) {
|
|
52
|
-
if (!isFocusable(element)) return !1;
|
|
53
|
-
try {
|
|
54
|
-
element.focus();
|
|
55
|
-
} catch {}
|
|
56
|
-
return document.activeElement === element;
|
|
1880
|
+
function textInputBaseStyle(props) {
|
|
1881
|
+
let { $scheme, $tone, $weight } = props, { color, font } = getTheme_v2(props.theme);
|
|
1882
|
+
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};}}`;
|
|
57
1883
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
1884
|
+
function textInputFontSizeStyle(props) {
|
|
1885
|
+
let { font, media } = getTheme_v2(props.theme);
|
|
1886
|
+
return _responsive(media, props.$fontSize, (sizeIndex) => {
|
|
1887
|
+
let size = font.text.sizes[sizeIndex] || font.text.sizes[2];
|
|
1888
|
+
return {
|
|
1889
|
+
fontSize: rem(size.fontSize),
|
|
1890
|
+
lineHeight: `${size.lineHeight / size.fontSize}`
|
|
1891
|
+
};
|
|
1892
|
+
});
|
|
67
1893
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
1894
|
+
function textInputRepresentationStyle(props) {
|
|
1895
|
+
let { $hasPrefix, $hasSuffix, $scheme, $tone, $unstableDisableFocusRing } = props, { color, input } = getTheme_v2(props.theme);
|
|
1896
|
+
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({
|
|
1897
|
+
color: color.input.default.enabled.border,
|
|
1898
|
+
width: input.border.width
|
|
1899
|
+
})};}*: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({
|
|
1900
|
+
color: color.input.invalid.enabled.border,
|
|
1901
|
+
width: input.border.width
|
|
1902
|
+
})};}}*:not(:disabled):focus + &{&[data-border]{--input-box-shadow:${$unstableDisableFocusRing ? void 0 : focusRingStyle({
|
|
1903
|
+
border: {
|
|
1904
|
+
color: color.input.default.enabled.border,
|
|
1905
|
+
width: input.border.width
|
|
1906
|
+
},
|
|
1907
|
+
focusRing: input.text.focusRing
|
|
1908
|
+
})};}&: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({
|
|
1909
|
+
color: color.input.default.disabled.border,
|
|
1910
|
+
width: input.border.width
|
|
1911
|
+
})};}}*: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({
|
|
1912
|
+
color: color.input.invalid.disabled.border,
|
|
1913
|
+
width: input.border.width
|
|
1914
|
+
})};}}*: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({
|
|
1915
|
+
color: color.input.default.hovered.border,
|
|
1916
|
+
width: input.border.width
|
|
1917
|
+
})};}*:invalid:not(:disabled):not(:read-only):not(:focus):hover + &[data-border]{--input-box-shadow:${focusRingBorderStyle({
|
|
1918
|
+
color: color.input.invalid.hovered.border,
|
|
1919
|
+
width: input.border.width
|
|
1920
|
+
})};}}}`;
|
|
1921
|
+
}
|
|
1922
|
+
const CLEAR_BUTTON_BOX_STYLE = { zIndex: 2 }, StyledTextInput = /* @__PURE__ */ styled(Card).attrs({ forwardedAs: "span" }).withConfig({
|
|
1923
|
+
displayName: "StyledTextInput",
|
|
1924
|
+
componentId: "sc-1ik1ab-0"
|
|
1925
|
+
})(textInputRootStyle), InputRoot$1 = styled.span.withConfig({
|
|
1926
|
+
displayName: "InputRoot",
|
|
1927
|
+
componentId: "sc-1ik1ab-1"
|
|
1928
|
+
})`flex:1;min-width:0;display:block;position:relative;`, Prefix = styled(Card).attrs({ forwardedAs: "span" }).withConfig({
|
|
1929
|
+
displayName: "Prefix",
|
|
1930
|
+
componentId: "sc-1ik1ab-2"
|
|
1931
|
+
})`border-top-right-radius:0;border-bottom-right-radius:0;& > span{display:block;margin:-1px;}`, Suffix = styled(Card).attrs({ forwardedAs: "span" }).withConfig({
|
|
1932
|
+
displayName: "Suffix",
|
|
1933
|
+
componentId: "sc-1ik1ab-3"
|
|
1934
|
+
})`border-top-left-radius:0;border-bottom-left-radius:0;& > span{display:block;margin:-1px;}`, Input$5 = /* @__PURE__ */ styled.input.withConfig({
|
|
1935
|
+
displayName: "Input",
|
|
1936
|
+
componentId: "sc-1ik1ab-4"
|
|
1937
|
+
})(responsiveInputPaddingStyle, textInputBaseStyle, textInputFontSizeStyle), Presentation$1 = /* @__PURE__ */ styled.span.withConfig({
|
|
1938
|
+
displayName: "Presentation",
|
|
1939
|
+
componentId: "sc-1ik1ab-5"
|
|
1940
|
+
})(responsiveRadiusStyle, textInputRepresentationStyle), LeftBox = styled(Box).withConfig({
|
|
1941
|
+
displayName: "LeftBox",
|
|
1942
|
+
componentId: "sc-1ik1ab-6"
|
|
1943
|
+
})`position:absolute;top:0;left:0;`, RightBox = styled(Box).withConfig({
|
|
1944
|
+
displayName: "RightBox",
|
|
1945
|
+
componentId: "sc-1ik1ab-7"
|
|
1946
|
+
})`position:absolute;top:0;right:0;`, RightCard = styled(Card).withConfig({
|
|
1947
|
+
displayName: "RightCard",
|
|
1948
|
+
componentId: "sc-1ik1ab-8"
|
|
1949
|
+
})`background-color:transparent;position:absolute;top:0;right:0;`, TextInputClearButton = /* @__PURE__ */ styled(Button).withConfig({
|
|
1950
|
+
displayName: "TextInputClearButton",
|
|
1951
|
+
componentId: "sc-1ik1ab-9"
|
|
1952
|
+
})({ "&:not([hidden])": { display: "block" } }), TextInput = forwardRef(function TextInput(props, forwardedRef) {
|
|
1953
|
+
let $ = c(92), IconComponent, IconRightComponent, __unstable_disableFocusRing, clearButton, customValidity, onClear, prefix, readOnly, restProps, suffix, t0, t1, t2, t3, t4, t5, t6, weight;
|
|
1954
|
+
$[0] === props ? (IconComponent = $[1], IconRightComponent = $[2], __unstable_disableFocusRing = $[3], clearButton = $[4], customValidity = $[5], onClear = $[6], prefix = $[7], readOnly = $[8], restProps = $[9], suffix = $[10], t0 = $[11], t1 = $[12], t2 = $[13], t3 = $[14], t4 = $[15], t5 = $[16], t6 = $[17], weight = $[18]) : ({__unstable_disableFocusRing, border: t0, clearButton, disabled: t1, fontSize: t2, gap: t3, icon: IconComponent, iconRight: IconRightComponent, onClear, padding: t4, prefix, radius: t5, readOnly, suffix, customValidity, type: t6, weight, ...restProps} = props, $[0] = props, $[1] = IconComponent, $[2] = IconRightComponent, $[3] = __unstable_disableFocusRing, $[4] = clearButton, $[5] = customValidity, $[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);
|
|
1955
|
+
let border = t0 === void 0 || t0, disabled = t1 !== void 0 && t1, fontSizeProp = t2 === void 0 ? 2 : t2, gap = t3 === void 0 ? 3 : t3, paddingProp = t4 === void 0 ? 3 : t4, radiusProp = t5 === void 0 ? 2 : t5, type = t6 === void 0 ? "text" : t6, ref = useRef(null), rootTheme = useRootTheme(), t7;
|
|
1956
|
+
$[19] === fontSizeProp ? t7 = $[20] : (t7 = _getArrayProp(fontSizeProp), $[19] = fontSizeProp, $[20] = t7);
|
|
1957
|
+
let fontSize = t7, t8;
|
|
1958
|
+
$[21] === paddingProp ? t8 = $[22] : (t8 = _getArrayProp(paddingProp), $[21] = paddingProp, $[22] = t8);
|
|
1959
|
+
let padding = t8, t9;
|
|
1960
|
+
$[23] === radiusProp ? t9 = $[24] : (t9 = _getArrayProp(radiusProp), $[23] = radiusProp, $[24] = t9);
|
|
1961
|
+
let radius = t9, t10;
|
|
1962
|
+
$[25] === gap ? t10 = $[26] : (t10 = _getArrayProp(gap), $[25] = gap, $[26] = t10);
|
|
1963
|
+
let space = t10, $hasClearButton = !!clearButton, $hasIcon = !!IconComponent, $hasIconRight = !!IconRightComponent, $hasSuffix = !!suffix, $hasPrefix = !!prefix, t11;
|
|
1964
|
+
$[27] === Symbol.for("react.memo_cache_sentinel") ? (t11 = () => ref.current, $[27] = t11) : t11 = $[27], useImperativeHandle(forwardedRef, t11), useCustomValidity(ref, customValidity);
|
|
1965
|
+
let handleClearMouseDown = _temp$12, t12;
|
|
1966
|
+
$[28] === onClear ? t12 = $[29] : (t12 = (event_0) => {
|
|
1967
|
+
event_0.preventDefault(), event_0.stopPropagation(), onClear && onClear(), ref.current?.focus();
|
|
1968
|
+
}, $[28] = onClear, $[29] = t12);
|
|
1969
|
+
let handleClearClick = t12, t13;
|
|
1970
|
+
$[30] !== prefix || $[31] !== radius ? (t13 = prefix && /* @__PURE__ */ jsx(Prefix, {
|
|
1971
|
+
borderTop: !0,
|
|
1972
|
+
borderLeft: !0,
|
|
1973
|
+
borderBottom: !0,
|
|
1974
|
+
radius,
|
|
1975
|
+
sizing: "border",
|
|
1976
|
+
tone: "inherit",
|
|
1977
|
+
children: /* @__PURE__ */ jsx("span", { children: prefix })
|
|
1978
|
+
}), $[30] = prefix, $[31] = radius, $[32] = t13) : t13 = $[32];
|
|
1979
|
+
let prefixNode = t13, t14 = border ? "" : void 0, t15;
|
|
1980
|
+
$[33] !== IconComponent || $[34] !== fontSize || $[35] !== padding ? (t15 = IconComponent && /* @__PURE__ */ jsx(LeftBox, {
|
|
1981
|
+
padding,
|
|
1982
|
+
children: /* @__PURE__ */ jsxs(Text, {
|
|
1983
|
+
size: fontSize,
|
|
1984
|
+
children: [isValidElement(IconComponent) && IconComponent, isValidElementType(IconComponent) && /* @__PURE__ */ jsx(IconComponent, {})]
|
|
1985
|
+
})
|
|
1986
|
+
}), $[33] = IconComponent, $[34] = fontSize, $[35] = padding, $[36] = t15) : t15 = $[36];
|
|
1987
|
+
let t16;
|
|
1988
|
+
$[37] !== $hasClearButton || $[38] !== IconRightComponent || $[39] !== fontSize || $[40] !== padding ? (t16 = !$hasClearButton && IconRightComponent && /* @__PURE__ */ jsx(RightBox, {
|
|
1989
|
+
padding,
|
|
1990
|
+
children: /* @__PURE__ */ jsxs(Text, {
|
|
1991
|
+
size: fontSize,
|
|
1992
|
+
children: [isValidElement(IconRightComponent) && IconRightComponent, isValidElementType(IconRightComponent) && /* @__PURE__ */ jsx(IconRightComponent, {})]
|
|
1993
|
+
})
|
|
1994
|
+
}), $[37] = $hasClearButton, $[38] = IconRightComponent, $[39] = fontSize, $[40] = padding, $[41] = t16) : t16 = $[41];
|
|
1995
|
+
let t17;
|
|
1996
|
+
$[42] !== $hasPrefix || $[43] !== $hasSuffix || $[44] !== __unstable_disableFocusRing || $[45] !== radius || $[46] !== rootTheme.scheme || $[47] !== rootTheme.tone || $[48] !== t14 || $[49] !== t15 || $[50] !== t16 ? (t17 = /* @__PURE__ */ jsxs(Presentation$1, {
|
|
1997
|
+
$hasPrefix,
|
|
1998
|
+
$unstableDisableFocusRing: __unstable_disableFocusRing,
|
|
1999
|
+
$hasSuffix,
|
|
2000
|
+
$radius: radius,
|
|
2001
|
+
$scheme: rootTheme.scheme,
|
|
2002
|
+
$tone: rootTheme.tone,
|
|
2003
|
+
"data-border": t14,
|
|
2004
|
+
"data-scheme": rootTheme.scheme,
|
|
2005
|
+
"data-tone": rootTheme.tone,
|
|
2006
|
+
children: [t15, t16]
|
|
2007
|
+
}), $[42] = $hasPrefix, $[43] = $hasSuffix, $[44] = __unstable_disableFocusRing, $[45] = radius, $[46] = rootTheme.scheme, $[47] = rootTheme.tone, $[48] = t14, $[49] = t15, $[50] = t16, $[51] = t17) : t17 = $[51];
|
|
2008
|
+
let presentationNode = t17, t18;
|
|
2009
|
+
$[52] === padding ? t18 = $[53] : (t18 = padding.map(_temp2$3), $[52] = padding, $[53] = t18);
|
|
2010
|
+
let clearButtonBoxPadding = t18, t19;
|
|
2011
|
+
$[54] === padding ? t19 = $[55] : (t19 = padding.map(_temp3), $[54] = padding, $[55] = t19);
|
|
2012
|
+
let clearButtonPadding = t19, clearButtonProps = typeof clearButton == "object" ? clearButton : EMPTY_RECORD, t20;
|
|
2013
|
+
$[56] !== clearButton || $[57] !== clearButtonBoxPadding || $[58] !== clearButtonPadding || $[59] !== clearButtonProps || $[60] !== customValidity || $[61] !== disabled || $[62] !== fontSize || $[63] !== handleClearClick || $[64] !== radius || $[65] !== readOnly ? (t20 = !disabled && !readOnly && clearButton && /* @__PURE__ */ jsx(RightCard, {
|
|
2014
|
+
forwardedAs: "span",
|
|
2015
|
+
padding: clearButtonBoxPadding,
|
|
2016
|
+
style: CLEAR_BUTTON_BOX_STYLE,
|
|
2017
|
+
tone: customValidity ? "critical" : "inherit",
|
|
2018
|
+
children: /* @__PURE__ */ jsx(TextInputClearButton, {
|
|
2019
|
+
"aria-label": "Clear",
|
|
2020
|
+
"data-qa": "clear-button",
|
|
2021
|
+
fontSize,
|
|
2022
|
+
icon: CloseIcon,
|
|
2023
|
+
mode: "bleed",
|
|
2024
|
+
padding: clearButtonPadding,
|
|
2025
|
+
radius,
|
|
2026
|
+
...clearButtonProps,
|
|
2027
|
+
onClick: handleClearClick,
|
|
2028
|
+
onMouseDown: handleClearMouseDown
|
|
2029
|
+
})
|
|
2030
|
+
}), $[56] = clearButton, $[57] = clearButtonBoxPadding, $[58] = clearButtonPadding, $[59] = clearButtonProps, $[60] = customValidity, $[61] = disabled, $[62] = fontSize, $[63] = handleClearClick, $[64] = radius, $[65] = readOnly, $[66] = t20) : t20 = $[66];
|
|
2031
|
+
let clearButtonNode = t20, t21;
|
|
2032
|
+
$[67] !== radius || $[68] !== suffix ? (t21 = suffix && /* @__PURE__ */ jsx(Suffix, {
|
|
2033
|
+
borderTop: !0,
|
|
2034
|
+
borderRight: !0,
|
|
2035
|
+
borderBottom: !0,
|
|
2036
|
+
radius,
|
|
2037
|
+
sizing: "border",
|
|
2038
|
+
tone: "inherit",
|
|
2039
|
+
children: /* @__PURE__ */ jsx("span", { children: suffix })
|
|
2040
|
+
}), $[67] = radius, $[68] = suffix, $[69] = t21) : t21 = $[69];
|
|
2041
|
+
let suffixNode = t21, t22 = $hasIconRight || $hasClearButton, t23;
|
|
2042
|
+
$[70] !== $hasIcon || $[71] !== disabled || $[72] !== fontSize || $[73] !== padding || $[74] !== readOnly || $[75] !== restProps || $[76] !== rootTheme.scheme || $[77] !== rootTheme.tone || $[78] !== space || $[79] !== t22 || $[80] !== type || $[81] !== weight ? (t23 = /* @__PURE__ */ jsx(Input$5, {
|
|
2043
|
+
"data-as": "input",
|
|
2044
|
+
"data-scheme": rootTheme.scheme,
|
|
2045
|
+
"data-tone": rootTheme.tone,
|
|
2046
|
+
...restProps,
|
|
2047
|
+
$fontSize: fontSize,
|
|
2048
|
+
$iconLeft: $hasIcon,
|
|
2049
|
+
$iconRight: t22,
|
|
2050
|
+
$padding: padding,
|
|
2051
|
+
$scheme: rootTheme.scheme,
|
|
2052
|
+
$space: space,
|
|
2053
|
+
$tone: rootTheme.tone,
|
|
2054
|
+
$weight: weight,
|
|
2055
|
+
disabled,
|
|
2056
|
+
readOnly,
|
|
2057
|
+
ref,
|
|
2058
|
+
type
|
|
2059
|
+
}), $[70] = $hasIcon, $[71] = disabled, $[72] = fontSize, $[73] = padding, $[74] = readOnly, $[75] = restProps, $[76] = rootTheme.scheme, $[77] = rootTheme.tone, $[78] = space, $[79] = t22, $[80] = type, $[81] = weight, $[82] = t23) : t23 = $[82];
|
|
2060
|
+
let t24;
|
|
2061
|
+
$[83] !== clearButtonNode || $[84] !== presentationNode || $[85] !== t23 ? (t24 = /* @__PURE__ */ jsxs(InputRoot$1, { children: [
|
|
2062
|
+
t23,
|
|
2063
|
+
presentationNode,
|
|
2064
|
+
clearButtonNode
|
|
2065
|
+
] }), $[83] = clearButtonNode, $[84] = presentationNode, $[85] = t23, $[86] = t24) : t24 = $[86];
|
|
2066
|
+
let t25;
|
|
2067
|
+
return $[87] !== prefixNode || $[88] !== rootTheme.tone || $[89] !== suffixNode || $[90] !== t24 ? (t25 = /* @__PURE__ */ jsxs(StyledTextInput, {
|
|
2068
|
+
"data-ui": "TextInput",
|
|
2069
|
+
tone: rootTheme.tone,
|
|
2070
|
+
children: [
|
|
2071
|
+
prefixNode,
|
|
2072
|
+
t24,
|
|
2073
|
+
suffixNode
|
|
2074
|
+
]
|
|
2075
|
+
}), $[87] = prefixNode, $[88] = rootTheme.tone, $[89] = suffixNode, $[90] = t24, $[91] = t25) : t25 = $[91], t25;
|
|
2076
|
+
});
|
|
2077
|
+
function _temp$12(event) {
|
|
2078
|
+
event.preventDefault(), event.stopPropagation();
|
|
2079
|
+
}
|
|
2080
|
+
function _temp2$3(v) {
|
|
2081
|
+
return v === 0 ? 0 : v === 1 || v === 2 ? 1 : v - 2;
|
|
2082
|
+
}
|
|
2083
|
+
function _temp3(v_0) {
|
|
2084
|
+
return v_0 === 0 || v_0 === 1 ? 0 : v_0 === 2 ? 1 : v_0 - 1;
|
|
77
2085
|
}
|
|
78
2086
|
/**
|
|
79
2087
|
* @internal
|
|
@@ -350,7 +2358,7 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = [
|
|
|
350
2358
|
}
|
|
351
2359
|
t35 = void 0;
|
|
352
2360
|
}
|
|
353
|
-
let clearButton = t35, openButtonBoxPadding = padding.map(_temp$
|
|
2361
|
+
let clearButton = t35, openButtonBoxPadding = padding.map(_temp$11), openButtonPadding = padding.map(_temp2$2), openButtonProps = typeof openButton == "object" ? openButton : EMPTY_RECORD, t36;
|
|
354
2362
|
$[95] !== dispatchOpen || $[96] !== openButtonProps ? (t36 = (event_4) => {
|
|
355
2363
|
dispatchOpen(), openButtonProps.onClick && openButtonProps.onClick(event_4), _raf(() => inputElementRef.current?.focus());
|
|
356
2364
|
}, $[95] = dispatchOpen, $[96] = openButtonProps, $[97] = t36) : t36 = $[97];
|
|
@@ -527,12 +2535,41 @@ function RenderPopover({ renderPopover, content, hidden, inputElement, onMouseEn
|
|
|
527
2535
|
* @public
|
|
528
2536
|
*/
|
|
529
2537
|
const Autocomplete = InnerAutocomplete;
|
|
530
|
-
function _temp$
|
|
2538
|
+
function _temp$11(v_0) {
|
|
531
2539
|
return v_0 === 0 ? 0 : v_0 === 1 || v_0 === 2 ? 1 : v_0 - 2;
|
|
532
2540
|
}
|
|
533
|
-
function _temp2$
|
|
2541
|
+
function _temp2$2(v_1) {
|
|
534
2542
|
return Math.max(v_1 - 1, 0);
|
|
535
2543
|
}
|
|
2544
|
+
/**
|
|
2545
|
+
* @public
|
|
2546
|
+
*/
|
|
2547
|
+
function useClickOutsideEvent(listener, t0, boundaryElement) {
|
|
2548
|
+
let $ = c(9), elementsArg = t0 === void 0 ? _temp$10 : t0, t1;
|
|
2549
|
+
$[0] !== boundaryElement || $[1] !== elementsArg || $[2] !== listener ? (t1 = (evt) => {
|
|
2550
|
+
if (!listener) return;
|
|
2551
|
+
let target = evt.target;
|
|
2552
|
+
if (!(target instanceof Node)) return;
|
|
2553
|
+
let resolvedBoundaryElement = boundaryElement?.();
|
|
2554
|
+
if (resolvedBoundaryElement && !resolvedBoundaryElement.contains(target)) return;
|
|
2555
|
+
let elements = elementsArg().flat();
|
|
2556
|
+
for (let el of elements) if (el && (target === el || el.contains(target))) return;
|
|
2557
|
+
listener(evt);
|
|
2558
|
+
}, $[0] = boundaryElement, $[1] = elementsArg, $[2] = listener, $[3] = t1) : t1 = $[3];
|
|
2559
|
+
let onEvent = useEffectEvent(t1), hasListener = !!listener, t2;
|
|
2560
|
+
$[4] !== hasListener || $[5] !== onEvent ? (t2 = () => {
|
|
2561
|
+
if (!hasListener) return;
|
|
2562
|
+
let handleEvent = (evt_0) => onEvent(evt_0);
|
|
2563
|
+
return document.addEventListener("mousedown", handleEvent), () => {
|
|
2564
|
+
document.removeEventListener("mousedown", handleEvent);
|
|
2565
|
+
};
|
|
2566
|
+
}, $[4] = hasListener, $[5] = onEvent, $[6] = t2) : t2 = $[6];
|
|
2567
|
+
let t3;
|
|
2568
|
+
$[7] === hasListener ? t3 = $[8] : (t3 = [hasListener], $[7] = hasListener, $[8] = t3), useEffect(t2, t3), useDebugValue(listener ? "MouseDown On" : "MouseDown Off");
|
|
2569
|
+
}
|
|
2570
|
+
function _temp$10() {
|
|
2571
|
+
return EMPTY_ARRAY;
|
|
2572
|
+
}
|
|
536
2573
|
const StyledBreadcrumbs = styled.ol.withConfig({
|
|
537
2574
|
displayName: "StyledBreadcrumbs",
|
|
538
2575
|
componentId: "sc-s3y9xo-0"
|
|
@@ -540,20 +2577,20 @@ const StyledBreadcrumbs = styled.ol.withConfig({
|
|
|
540
2577
|
displayName: "ExpandButton",
|
|
541
2578
|
componentId: "sc-s3y9xo-1"
|
|
542
2579
|
})`appearance:none;margin:-4px;`, Breadcrumbs = forwardRef(function Breadcrumbs(props, ref) {
|
|
543
|
-
let $ = c(
|
|
544
|
-
$[0] === props ? (children = $[1],
|
|
545
|
-
let
|
|
546
|
-
$[
|
|
547
|
-
let space =
|
|
548
|
-
$[
|
|
549
|
-
let collapse =
|
|
550
|
-
$[
|
|
551
|
-
let expand =
|
|
552
|
-
$[
|
|
553
|
-
let
|
|
554
|
-
$[
|
|
555
|
-
let rawItems =
|
|
556
|
-
$[
|
|
2580
|
+
let $ = c(29), children, maxLength, restProps, separator, t0;
|
|
2581
|
+
$[0] === props ? (children = $[1], maxLength = $[2], restProps = $[3], separator = $[4], t0 = $[5]) : ({children, gap: t0, maxLength, separator, ...restProps} = props, $[0] = props, $[1] = children, $[2] = maxLength, $[3] = restProps, $[4] = separator, $[5] = t0);
|
|
2582
|
+
let gap = t0 === void 0 ? 2 : t0, t1;
|
|
2583
|
+
$[6] === gap ? t1 = $[7] : (t1 = _getArrayProp(gap), $[6] = gap, $[7] = t1);
|
|
2584
|
+
let space = t1, [open, setOpen] = useState(!1), expandElementRef = useRef(null), popoverElementRef = useRef(null), t2;
|
|
2585
|
+
$[8] === Symbol.for("react.memo_cache_sentinel") ? (t2 = () => setOpen(!1), $[8] = t2) : t2 = $[8];
|
|
2586
|
+
let collapse = t2, t3;
|
|
2587
|
+
$[9] === Symbol.for("react.memo_cache_sentinel") ? (t3 = () => setOpen(!0), $[9] = t3) : t3 = $[9];
|
|
2588
|
+
let expand = t3, t4;
|
|
2589
|
+
$[10] === Symbol.for("react.memo_cache_sentinel") ? (t4 = () => [expandElementRef.current, popoverElementRef.current], $[10] = t4) : t4 = $[10], useClickOutsideEvent(collapse, t4);
|
|
2590
|
+
let t5;
|
|
2591
|
+
$[11] === children ? t5 = $[12] : (t5 = Children.toArray(children).filter(isValidElement), $[11] = children, $[12] = t5);
|
|
2592
|
+
let rawItems = t5, t6;
|
|
2593
|
+
$[13] !== maxLength || $[14] !== open || $[15] !== rawItems || $[16] !== space ? (t6 = {
|
|
557
2594
|
collapse,
|
|
558
2595
|
expand,
|
|
559
2596
|
expandElementRef,
|
|
@@ -562,11 +2599,11 @@ const StyledBreadcrumbs = styled.ol.withConfig({
|
|
|
562
2599
|
popoverElementRef,
|
|
563
2600
|
rawItems,
|
|
564
2601
|
space
|
|
565
|
-
}, $[
|
|
566
|
-
let items = useItems(
|
|
567
|
-
if ($[
|
|
568
|
-
let
|
|
569
|
-
$[
|
|
2602
|
+
}, $[13] = maxLength, $[14] = open, $[15] = rawItems, $[16] = space, $[17] = t6) : t6 = $[17];
|
|
2603
|
+
let items = useItems(t6), t7;
|
|
2604
|
+
if ($[18] !== items || $[19] !== separator || $[20] !== space) {
|
|
2605
|
+
let t8;
|
|
2606
|
+
$[22] !== separator || $[23] !== space ? (t8 = (item, itemIndex) => /* @__PURE__ */ jsxs(Fragment, { children: [itemIndex > 0 && /* @__PURE__ */ jsx(Box, {
|
|
570
2607
|
"aria-hidden": !0,
|
|
571
2608
|
as: "li",
|
|
572
2609
|
paddingX: space,
|
|
@@ -577,15 +2614,15 @@ const StyledBreadcrumbs = styled.ol.withConfig({
|
|
|
577
2614
|
}), /* @__PURE__ */ jsx(Box, {
|
|
578
2615
|
as: "li",
|
|
579
2616
|
children: item
|
|
580
|
-
})] }, itemIndex), $[
|
|
581
|
-
} else
|
|
582
|
-
let
|
|
583
|
-
return $[
|
|
2617
|
+
})] }, itemIndex), $[22] = separator, $[23] = space, $[24] = t8) : t8 = $[24], t7 = items.map(t8), $[18] = items, $[19] = separator, $[20] = space, $[21] = t7;
|
|
2618
|
+
} else t7 = $[21];
|
|
2619
|
+
let t8;
|
|
2620
|
+
return $[25] !== ref || $[26] !== restProps || $[27] !== t7 ? (t8 = /* @__PURE__ */ jsx(StyledBreadcrumbs, {
|
|
584
2621
|
"data-ui": "Breadcrumbs",
|
|
585
2622
|
...restProps,
|
|
586
2623
|
ref,
|
|
587
|
-
children:
|
|
588
|
-
}), $[
|
|
2624
|
+
children: t7
|
|
2625
|
+
}), $[25] = ref, $[26] = restProps, $[27] = t7, $[28] = t8) : t8 = $[28], t8;
|
|
589
2626
|
});
|
|
590
2627
|
function useItems(t0) {
|
|
591
2628
|
let $ = c(28), { collapse, expand, expandElementRef, maxLength, open, popoverElementRef, rawItems, space } = t0, len = rawItems.length;
|
|
@@ -631,6 +2668,24 @@ function useItems(t0) {
|
|
|
631
2668
|
}
|
|
632
2669
|
return rawItems;
|
|
633
2670
|
}
|
|
2671
|
+
/**
|
|
2672
|
+
* Adds global keydown event listener to the window.
|
|
2673
|
+
*
|
|
2674
|
+
* @param onKeyDown - The function to call when a keydown event is triggered.
|
|
2675
|
+
* @param options - The options to pass to the addEventListener function (example, capture: true)
|
|
2676
|
+
* @beta
|
|
2677
|
+
*/
|
|
2678
|
+
function useGlobalKeyDown(onKeyDown, options) {
|
|
2679
|
+
let $ = c(7), t0;
|
|
2680
|
+
$[0] === onKeyDown ? t0 = $[1] : (t0 = (event) => onKeyDown(event), $[0] = onKeyDown, $[1] = t0);
|
|
2681
|
+
let handleKeyDown = useEffectEvent(t0), t1;
|
|
2682
|
+
$[2] !== handleKeyDown || $[3] !== options ? (t1 = () => {
|
|
2683
|
+
let handler = (event_0) => handleKeyDown(event_0);
|
|
2684
|
+
return window.addEventListener("keydown", handler, options), () => window.removeEventListener("keydown", handler, options);
|
|
2685
|
+
}, $[2] = handleKeyDown, $[3] = options, $[4] = t1) : t1 = $[4];
|
|
2686
|
+
let t2;
|
|
2687
|
+
$[5] === options ? t2 = $[6] : (t2 = [options], $[5] = options, $[6] = t2), useEffect(t1, t2);
|
|
2688
|
+
}
|
|
634
2689
|
const BASE_STYLE = {
|
|
635
2690
|
width: "100%",
|
|
636
2691
|
margin: "0 auto"
|
|
@@ -644,7 +2699,7 @@ function responsiveContainerWidthStyle(props) {
|
|
|
644
2699
|
}
|
|
645
2700
|
const StyledContainer = /* @__PURE__ */ styled(Box).withConfig({
|
|
646
2701
|
displayName: "StyledContainer",
|
|
647
|
-
componentId: "sc-
|
|
2702
|
+
componentId: "sc-20ldad-0"
|
|
648
2703
|
})(containerBaseStyle, responsiveContainerWidthStyle), Container = forwardRef(function Container(props, ref) {
|
|
649
2704
|
let $ = c(11), as, restProps, t0;
|
|
650
2705
|
$[0] === props ? (as = $[1], restProps = $[2], t0 = $[3]) : ({as, width: t0, ...restProps} = props, $[0] = props, $[1] = as, $[2] = restProps, $[3] = t0);
|
|
@@ -658,6 +2713,52 @@ const StyledContainer = /* @__PURE__ */ styled(Box).withConfig({
|
|
|
658
2713
|
forwardedAs: as,
|
|
659
2714
|
ref
|
|
660
2715
|
}), $[6] = as, $[7] = ref, $[8] = restProps, $[9] = t1, $[10] = t2) : t2 = $[10], t2;
|
|
2716
|
+
}), StyledLayer$1 = /* @__PURE__ */ styled.div.withConfig({
|
|
2717
|
+
displayName: "StyledLayer",
|
|
2718
|
+
componentId: "sc-7ryye5-0"
|
|
2719
|
+
})({ position: "relative" }), LayerChildren = forwardRef(function LayerChildren(props, forwardedRef) {
|
|
2720
|
+
let $ = c(22), children, onActivate, onFocus, restProps, t0;
|
|
2721
|
+
$[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);
|
|
2722
|
+
let style = t0 === void 0 ? EMPTY_RECORD : t0, { zIndex, isTopLayer } = useLayer(), lastFocusedRef = useRef(null), ref = useRef(null), isTopLayerRef = useRef(isTopLayer), t1;
|
|
2723
|
+
$[6] === Symbol.for("react.memo_cache_sentinel") ? (t1 = () => ref.current, $[6] = t1) : t1 = $[6], useImperativeHandle(forwardedRef, t1);
|
|
2724
|
+
let t2, t3;
|
|
2725
|
+
$[7] !== isTopLayer || $[8] !== onActivate ? (t2 = () => {
|
|
2726
|
+
isTopLayerRef.current !== isTopLayer && isTopLayer && onActivate?.({ activeElement: lastFocusedRef.current }), isTopLayerRef.current = isTopLayer;
|
|
2727
|
+
}, t3 = [isTopLayer, onActivate], $[7] = isTopLayer, $[8] = onActivate, $[9] = t2, $[10] = t3) : (t2 = $[9], t3 = $[10]), useEffect(t2, t3);
|
|
2728
|
+
let t4;
|
|
2729
|
+
$[11] !== isTopLayer || $[12] !== onFocus ? (t4 = (event) => {
|
|
2730
|
+
onFocus?.(event);
|
|
2731
|
+
let rootElement = ref.current, target = document.activeElement;
|
|
2732
|
+
!isTopLayer || !rootElement || !target || isHTMLElement(target) && containsOrEqualsElement(rootElement, target) && (lastFocusedRef.current = target);
|
|
2733
|
+
}, $[11] = isTopLayer, $[12] = onFocus, $[13] = t4) : t4 = $[13];
|
|
2734
|
+
let handleFocus = t4, t5;
|
|
2735
|
+
$[14] !== style || $[15] !== zIndex ? (t5 = {
|
|
2736
|
+
...style,
|
|
2737
|
+
zIndex
|
|
2738
|
+
}, $[14] = style, $[15] = zIndex, $[16] = t5) : t5 = $[16];
|
|
2739
|
+
let t6;
|
|
2740
|
+
return $[17] !== children || $[18] !== handleFocus || $[19] !== restProps || $[20] !== t5 ? (t6 = /* @__PURE__ */ jsx(StyledLayer$1, {
|
|
2741
|
+
...restProps,
|
|
2742
|
+
"data-ui": "Layer",
|
|
2743
|
+
onFocus: handleFocus,
|
|
2744
|
+
ref,
|
|
2745
|
+
style: t5,
|
|
2746
|
+
children
|
|
2747
|
+
}), $[17] = children, $[18] = handleFocus, $[19] = restProps, $[20] = t5, $[21] = t6) : t6 = $[21], t6;
|
|
2748
|
+
}), Layer = forwardRef(function Layer(props, ref) {
|
|
2749
|
+
let $ = c(11), children, restProps, t0;
|
|
2750
|
+
$[0] === props ? (children = $[1], restProps = $[2], t0 = $[3]) : ({children, zOffset: t0, ...restProps} = props, $[0] = props, $[1] = children, $[2] = restProps, $[3] = t0);
|
|
2751
|
+
let zOffset = t0 === void 0 ? 1 : t0, t1;
|
|
2752
|
+
$[4] !== children || $[5] !== ref || $[6] !== restProps ? (t1 = /* @__PURE__ */ jsx(LayerChildren, {
|
|
2753
|
+
...restProps,
|
|
2754
|
+
ref,
|
|
2755
|
+
children
|
|
2756
|
+
}), $[4] = children, $[5] = ref, $[6] = restProps, $[7] = t1) : t1 = $[7];
|
|
2757
|
+
let t2;
|
|
2758
|
+
return $[8] !== t1 || $[9] !== zOffset ? (t2 = /* @__PURE__ */ jsx(LayerProvider, {
|
|
2759
|
+
zOffset,
|
|
2760
|
+
children: t1
|
|
2761
|
+
}), $[8] = t1, $[9] = zOffset, $[10] = t2) : t2 = $[10], t2;
|
|
661
2762
|
});
|
|
662
2763
|
function dialogStyle({ theme }) {
|
|
663
2764
|
let { color } = getTheme_v2(theme);
|
|
@@ -696,25 +2797,25 @@ function isTargetWithinScope(boundaryElement, portalElement, target) {
|
|
|
696
2797
|
}
|
|
697
2798
|
const StyledDialog = /* @__PURE__ */ styled(Layer).withConfig({
|
|
698
2799
|
displayName: "StyledDialog",
|
|
699
|
-
componentId: "sc-
|
|
2800
|
+
componentId: "sc-1r51ei-0"
|
|
700
2801
|
})(responsivePaddingStyle, dialogStyle, responsiveDialogPositionStyle, animationDialogStyle), DialogContainer = styled(Container).withConfig({
|
|
701
2802
|
displayName: "DialogContainer",
|
|
702
|
-
componentId: "sc-
|
|
2803
|
+
componentId: "sc-1r51ei-1"
|
|
703
2804
|
})`&:not([hidden]){display:flex;}width:100%;height:100%;flex-direction:column;align-items:center;justify-content:center;`, DialogCardRoot = styled(Card).withConfig({
|
|
704
2805
|
displayName: "DialogCardRoot",
|
|
705
|
-
componentId: "sc-
|
|
2806
|
+
componentId: "sc-1r51ei-2"
|
|
706
2807
|
})`&:not([hidden]){display:flex;}width:100%;min-height:0;max-height:100%;overflow:hidden;overflow:clip;`, DialogLayout = styled(Flex).withConfig({
|
|
707
2808
|
displayName: "DialogLayout",
|
|
708
|
-
componentId: "sc-
|
|
2809
|
+
componentId: "sc-1r51ei-3"
|
|
709
2810
|
})`flex:1;min-height:0;width:100%;`, DialogHeader = styled(Box).withConfig({
|
|
710
2811
|
displayName: "DialogHeader",
|
|
711
|
-
componentId: "sc-
|
|
2812
|
+
componentId: "sc-1r51ei-4"
|
|
712
2813
|
})`position:relative;z-index:2;`, DialogContent = styled(Box).withConfig({
|
|
713
2814
|
displayName: "DialogContent",
|
|
714
|
-
componentId: "sc-
|
|
2815
|
+
componentId: "sc-1r51ei-5"
|
|
715
2816
|
})`position:relative;z-index:1;overflow:auto;outline:none;`, DialogFooter = styled(Box).withConfig({
|
|
716
2817
|
displayName: "DialogFooter",
|
|
717
|
-
componentId: "sc-
|
|
2818
|
+
componentId: "sc-1r51ei-6"
|
|
718
2819
|
})`position:relative;z-index:3;`, DialogCard = forwardRef(function DialogCard(props, forwardedRef) {
|
|
719
2820
|
let $ = c(44), { __unstable_autoFocus: autoFocus, __unstable_hideCloseButton: hideCloseButton, children, contentRef: forwardedContentRef, footer, header, id, onClickOutside, onClose, portal: portalProp, radius: radiusProp, scheme, shadow: shadowProp, width: widthProp } = props, portal = usePortal(), portalElement = portalProp ? portal.elements?.[portalProp] || null : portal.element, boundaryElement = useBoundaryElement().element, t0;
|
|
720
2821
|
$[0] === radiusProp ? t0 = $[1] : (t0 = _getArrayProp(radiusProp), $[0] = radiusProp, $[1] = t0);
|
|
@@ -915,36 +3016,367 @@ function DialogProvider(props) {
|
|
|
915
3016
|
children
|
|
916
3017
|
}), $[3] = children, $[4] = contextValue, $[5] = t1) : t1 = $[5], t1;
|
|
917
3018
|
}
|
|
3019
|
+
function inlineBaseStyle() {
|
|
3020
|
+
return {
|
|
3021
|
+
lineHeight: "0",
|
|
3022
|
+
"&&:not([hidden])": { display: "block" },
|
|
3023
|
+
"& > div": {
|
|
3024
|
+
display: "inline-block",
|
|
3025
|
+
verticalAlign: "middle"
|
|
3026
|
+
}
|
|
3027
|
+
};
|
|
3028
|
+
}
|
|
3029
|
+
function inlineSpaceStyle(props) {
|
|
3030
|
+
let { media, space } = getTheme_v2(props.theme);
|
|
3031
|
+
return _responsive(media, props.$space, (spaceIndex) => {
|
|
3032
|
+
let _space = rem(spaceIndex === .5 ? space[1] / 2 : space[spaceIndex]);
|
|
3033
|
+
return {
|
|
3034
|
+
margin: `-${_space} 0 0 -${_space}`,
|
|
3035
|
+
"& > div": { padding: `${_space} 0 0 ${_space}` }
|
|
3036
|
+
};
|
|
3037
|
+
});
|
|
3038
|
+
}
|
|
3039
|
+
const StyledInline = /* @__PURE__ */ styled(Box).withConfig({
|
|
3040
|
+
displayName: "StyledInline",
|
|
3041
|
+
componentId: "sc-per1bj-0"
|
|
3042
|
+
})(inlineBaseStyle, inlineSpaceStyle), Inline = forwardRef(function Inline(props, ref) {
|
|
3043
|
+
let $ = c(15), as, childrenProp, gap, restProps;
|
|
3044
|
+
$[0] === props ? (as = $[1], childrenProp = $[2], gap = $[3], restProps = $[4]) : ({as, children: childrenProp, gap, ...restProps} = props, $[0] = props, $[1] = as, $[2] = childrenProp, $[3] = gap, $[4] = restProps);
|
|
3045
|
+
let t0;
|
|
3046
|
+
$[5] === childrenProp ? t0 = $[6] : (t0 = Children.map(childrenProp, _temp$9), $[5] = childrenProp, $[6] = t0);
|
|
3047
|
+
let children = t0, t1;
|
|
3048
|
+
$[7] === gap ? t1 = $[8] : (t1 = _getArrayProp(gap), $[7] = gap, $[8] = t1);
|
|
3049
|
+
let t2 = ref, t3;
|
|
3050
|
+
return $[9] !== as || $[10] !== children || $[11] !== restProps || $[12] !== t1 || $[13] !== t2 ? (t3 = /* @__PURE__ */ jsx(StyledInline, {
|
|
3051
|
+
"data-ui": "Inline",
|
|
3052
|
+
...restProps,
|
|
3053
|
+
$space: t1,
|
|
3054
|
+
forwardedAs: as,
|
|
3055
|
+
ref: t2,
|
|
3056
|
+
children
|
|
3057
|
+
}), $[9] = as, $[10] = children, $[11] = restProps, $[12] = t1, $[13] = t2, $[14] = t3) : t3 = $[14], t3;
|
|
3058
|
+
});
|
|
3059
|
+
function _temp$9(child) {
|
|
3060
|
+
return child && /* @__PURE__ */ jsx("div", { children: child });
|
|
3061
|
+
}
|
|
3062
|
+
function kbdStyle() {
|
|
3063
|
+
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;}`;
|
|
3064
|
+
}
|
|
3065
|
+
const StyledKBD = /* @__PURE__ */ styled.kbd.withConfig({
|
|
3066
|
+
displayName: "StyledKBD",
|
|
3067
|
+
componentId: "sc-yh8ppe-0"
|
|
3068
|
+
})(responsiveRadiusStyle, kbdStyle), KBD = forwardRef(function KBD(props, ref) {
|
|
3069
|
+
let $ = c(19), children, restProps, t0, t1, t2;
|
|
3070
|
+
$[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);
|
|
3071
|
+
let fontSize = t0 === void 0 ? 0 : t0, padding = t1 === void 0 ? 1 : t1, radius = t2 === void 0 ? 2 : t2, t3;
|
|
3072
|
+
$[6] === radius ? t3 = $[7] : (t3 = _getArrayProp(radius), $[6] = radius, $[7] = t3);
|
|
3073
|
+
let t4;
|
|
3074
|
+
$[8] !== children || $[9] !== fontSize ? (t4 = /* @__PURE__ */ jsx(Text, {
|
|
3075
|
+
as: "span",
|
|
3076
|
+
size: fontSize,
|
|
3077
|
+
weight: "semibold",
|
|
3078
|
+
children
|
|
3079
|
+
}), $[8] = children, $[9] = fontSize, $[10] = t4) : t4 = $[10];
|
|
3080
|
+
let t5;
|
|
3081
|
+
$[11] !== padding || $[12] !== t4 ? (t5 = /* @__PURE__ */ jsx(Box, {
|
|
3082
|
+
as: "span",
|
|
3083
|
+
padding,
|
|
3084
|
+
children: t4
|
|
3085
|
+
}), $[11] = padding, $[12] = t4, $[13] = t5) : t5 = $[13];
|
|
3086
|
+
let t6;
|
|
3087
|
+
return $[14] !== ref || $[15] !== restProps || $[16] !== t3 || $[17] !== t5 ? (t6 = /* @__PURE__ */ jsx(StyledKBD, {
|
|
3088
|
+
"data-ui": "KBD",
|
|
3089
|
+
...restProps,
|
|
3090
|
+
$radius: t3,
|
|
3091
|
+
ref,
|
|
3092
|
+
children: t5
|
|
3093
|
+
}), $[14] = ref, $[15] = restProps, $[16] = t3, $[17] = t5, $[18] = t6) : t6 = $[18], t6;
|
|
3094
|
+
}), StyledHotkeys = styled.kbd.withConfig({
|
|
3095
|
+
displayName: "StyledHotkeys",
|
|
3096
|
+
componentId: "sc-vvvhw9-0"
|
|
3097
|
+
})`font:inherit;padding:1px;&:not([hidden]){display:block;}`, Key = styled(KBD).withConfig({
|
|
3098
|
+
displayName: "Key",
|
|
3099
|
+
componentId: "sc-vvvhw9-1"
|
|
3100
|
+
})`&:not([hidden]){display:block;}`, Hotkeys = forwardRef(function Hotkeys(props, ref) {
|
|
3101
|
+
let $ = c(26), fontSize, keys, padding, radius, restProps, t0;
|
|
3102
|
+
$[0] === props ? (fontSize = $[1], keys = $[2], padding = $[3], radius = $[4], restProps = $[5], t0 = $[6]) : ({fontSize, gap: t0, keys, padding, radius, ...restProps} = props, $[0] = props, $[1] = fontSize, $[2] = keys, $[3] = padding, $[4] = radius, $[5] = restProps, $[6] = t0);
|
|
3103
|
+
let gap = t0 === void 0 ? .5 : t0, t1;
|
|
3104
|
+
$[7] === gap ? t1 = $[8] : (t1 = _getArrayProp(gap), $[7] = gap, $[8] = t1);
|
|
3105
|
+
let spacing = t1;
|
|
3106
|
+
if (!keys || keys.length === 0) {
|
|
3107
|
+
let t2;
|
|
3108
|
+
return $[9] === Symbol.for("react.memo_cache_sentinel") ? (t2 = /* @__PURE__ */ jsx(Fragment$1, {}), $[9] = t2) : t2 = $[9], t2;
|
|
3109
|
+
}
|
|
3110
|
+
let t2;
|
|
3111
|
+
if ($[10] !== fontSize || $[11] !== keys || $[12] !== padding || $[13] !== radius) {
|
|
3112
|
+
let t3;
|
|
3113
|
+
$[15] !== fontSize || $[16] !== padding || $[17] !== radius ? (t3 = (key, i) => /* @__PURE__ */ jsx(Key, {
|
|
3114
|
+
fontSize,
|
|
3115
|
+
padding,
|
|
3116
|
+
radius,
|
|
3117
|
+
children: key
|
|
3118
|
+
}, i), $[15] = fontSize, $[16] = padding, $[17] = radius, $[18] = t3) : t3 = $[18], t2 = keys.map(t3), $[10] = fontSize, $[11] = keys, $[12] = padding, $[13] = radius, $[14] = t2;
|
|
3119
|
+
} else t2 = $[14];
|
|
3120
|
+
let t3;
|
|
3121
|
+
$[19] !== spacing || $[20] !== t2 ? (t3 = /* @__PURE__ */ jsx(Inline, {
|
|
3122
|
+
as: "span",
|
|
3123
|
+
gap: spacing,
|
|
3124
|
+
children: t2
|
|
3125
|
+
}), $[19] = spacing, $[20] = t2, $[21] = t3) : t3 = $[21];
|
|
3126
|
+
let t4;
|
|
3127
|
+
return $[22] !== ref || $[23] !== restProps || $[24] !== t3 ? (t4 = /* @__PURE__ */ jsx(StyledHotkeys, {
|
|
3128
|
+
"data-ui": "Hotkeys",
|
|
3129
|
+
...restProps,
|
|
3130
|
+
ref,
|
|
3131
|
+
children: t3
|
|
3132
|
+
}), $[22] = ref, $[23] = restProps, $[24] = t3, $[25] = t4) : t4 = $[25], t4;
|
|
3133
|
+
}), MenuContext = createGlobalScopedContext("@sanity/ui/context/menu", null);
|
|
3134
|
+
/**
|
|
3135
|
+
* @internal
|
|
3136
|
+
*/
|
|
3137
|
+
function _isFocusable(element) {
|
|
3138
|
+
return isHTMLAnchorElement(element) && element.getAttribute("data-disabled") !== "true" || isHTMLButtonElement(element) && !element.disabled;
|
|
3139
|
+
}
|
|
3140
|
+
/**
|
|
3141
|
+
* @internal
|
|
3142
|
+
*/
|
|
3143
|
+
function _getFocusableElements(elements) {
|
|
3144
|
+
return elements.filter(_isFocusable);
|
|
3145
|
+
}
|
|
3146
|
+
function _getDOMPath(rootElement, el) {
|
|
3147
|
+
let path = [], e = el;
|
|
3148
|
+
for (; e !== rootElement;) {
|
|
3149
|
+
let parentElement = e.parentElement;
|
|
3150
|
+
if (!parentElement) return path;
|
|
3151
|
+
let index = Array.from(parentElement.childNodes).indexOf(e);
|
|
3152
|
+
if (path.unshift(index), parentElement === rootElement) return path;
|
|
3153
|
+
e = parentElement;
|
|
3154
|
+
}
|
|
3155
|
+
return path;
|
|
3156
|
+
}
|
|
3157
|
+
const EMPTY_PATH = [];
|
|
3158
|
+
/**
|
|
3159
|
+
* @internal
|
|
3160
|
+
*/
|
|
3161
|
+
function _sortElements(rootElement, elements) {
|
|
3162
|
+
if (!rootElement) return;
|
|
3163
|
+
let map = /* @__PURE__ */ new WeakMap();
|
|
3164
|
+
for (let el of elements) map.set(el, _getDOMPath(rootElement, el));
|
|
3165
|
+
let _sort = (a, b) => {
|
|
3166
|
+
let _a = map.get(a) || EMPTY_PATH, _b = map.get(b) || EMPTY_PATH, len = Math.max(_a.length, _b.length);
|
|
3167
|
+
for (let i = 0; i < len; i += 1) {
|
|
3168
|
+
let aIndex = _a[i] || -1, bIndex = _b[i] || -1;
|
|
3169
|
+
if (aIndex !== bIndex) return aIndex - bIndex;
|
|
3170
|
+
}
|
|
3171
|
+
return 0;
|
|
3172
|
+
};
|
|
3173
|
+
elements.sort(_sort);
|
|
3174
|
+
}
|
|
918
3175
|
/**
|
|
919
|
-
*
|
|
3176
|
+
* This controller is responsible for controlling UI menu state.
|
|
920
3177
|
*
|
|
921
|
-
* @
|
|
3178
|
+
* @internal
|
|
922
3179
|
*/
|
|
923
|
-
|
|
924
|
-
let $ = c(
|
|
925
|
-
$[0] === Symbol.for("react.memo_cache_sentinel") ? (
|
|
926
|
-
let [
|
|
927
|
-
$[1]
|
|
3180
|
+
function useMenuController(props) {
|
|
3181
|
+
let $ = c(21), { onKeyDown, originElement, shouldFocus, rootElementRef } = props, t0;
|
|
3182
|
+
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = [], $[0] = t0) : t0 = $[0];
|
|
3183
|
+
let elementsRef = useRef(t0), [activeIndex, _setActiveIndex] = useState(-1), activeIndexRef = useRef(activeIndex), [activeElement, setActiveElement] = useState(null), t1;
|
|
3184
|
+
$[1] === Symbol.for("react.memo_cache_sentinel") ? (t1 = (nextActiveIndex) => {
|
|
3185
|
+
_setActiveIndex(nextActiveIndex), activeIndexRef.current = nextActiveIndex, setActiveElement(elementsRef.current[nextActiveIndex] || null);
|
|
3186
|
+
}, $[1] = t1) : t1 = $[1];
|
|
3187
|
+
let setActiveIndex = t1, t2;
|
|
3188
|
+
$[2] === rootElementRef ? t2 = $[3] : (t2 = (element, selected) => {
|
|
3189
|
+
if (!element) return _temp$8;
|
|
3190
|
+
if (elementsRef.current.indexOf(element) === -1 && (elementsRef.current.push(element), _sortElements(rootElementRef.current, elementsRef.current)), selected) {
|
|
3191
|
+
let selectedIndex = elementsRef.current.indexOf(element);
|
|
3192
|
+
setActiveIndex(selectedIndex);
|
|
3193
|
+
}
|
|
3194
|
+
return () => {
|
|
3195
|
+
let idx = elementsRef.current.indexOf(element);
|
|
3196
|
+
idx > -1 && elementsRef.current.splice(idx, 1);
|
|
3197
|
+
};
|
|
3198
|
+
}, $[2] = rootElementRef, $[3] = t2);
|
|
3199
|
+
let mount = t2, t3;
|
|
3200
|
+
$[4] !== onKeyDown || $[5] !== originElement ? (t3 = (event) => {
|
|
3201
|
+
if (event.key === "Tab") {
|
|
3202
|
+
originElement && originElement.focus();
|
|
3203
|
+
return;
|
|
3204
|
+
}
|
|
3205
|
+
if (event.key === "Home") {
|
|
3206
|
+
event.preventDefault(), event.stopPropagation();
|
|
3207
|
+
let el = _getFocusableElements(elementsRef.current)[0];
|
|
3208
|
+
if (!el) return;
|
|
3209
|
+
let currentIndex = elementsRef.current.indexOf(el);
|
|
3210
|
+
setActiveIndex(currentIndex);
|
|
3211
|
+
return;
|
|
3212
|
+
}
|
|
3213
|
+
if (event.key === "End") {
|
|
3214
|
+
event.preventDefault(), event.stopPropagation();
|
|
3215
|
+
let focusableElements_0 = _getFocusableElements(elementsRef.current), el_0 = focusableElements_0[focusableElements_0.length - 1];
|
|
3216
|
+
if (!el_0) return;
|
|
3217
|
+
let currentIndex_0 = elementsRef.current.indexOf(el_0);
|
|
3218
|
+
setActiveIndex(currentIndex_0);
|
|
3219
|
+
return;
|
|
3220
|
+
}
|
|
3221
|
+
if (event.key === "ArrowUp") {
|
|
3222
|
+
event.preventDefault(), event.stopPropagation();
|
|
3223
|
+
let focusableElements_1 = _getFocusableElements(elementsRef.current), focusableLen = focusableElements_1.length;
|
|
3224
|
+
if (focusableLen === 0) return;
|
|
3225
|
+
let focusedElement = elementsRef.current[activeIndexRef.current], focusedIndex = focusableElements_1.indexOf(focusedElement);
|
|
3226
|
+
focusedIndex = (focusedIndex - 1 + focusableLen) % focusableLen;
|
|
3227
|
+
let el_1 = focusableElements_1[focusedIndex], currentIndex_1 = elementsRef.current.indexOf(el_1);
|
|
3228
|
+
setActiveIndex(currentIndex_1);
|
|
3229
|
+
return;
|
|
3230
|
+
}
|
|
3231
|
+
if (event.key === "ArrowDown") {
|
|
3232
|
+
event.preventDefault(), event.stopPropagation();
|
|
3233
|
+
let focusableElements_2 = _getFocusableElements(elementsRef.current), focusableLen_0 = focusableElements_2.length;
|
|
3234
|
+
if (focusableLen_0 === 0) return;
|
|
3235
|
+
let focusedElement_0 = elementsRef.current[activeIndexRef.current], focusedIndex_0 = focusableElements_2.indexOf(focusedElement_0);
|
|
3236
|
+
focusedIndex_0 = (focusedIndex_0 + 1) % focusableLen_0;
|
|
3237
|
+
let el_2 = focusableElements_2[focusedIndex_0], currentIndex_2 = elementsRef.current.indexOf(el_2);
|
|
3238
|
+
setActiveIndex(currentIndex_2);
|
|
3239
|
+
return;
|
|
3240
|
+
}
|
|
3241
|
+
onKeyDown && onKeyDown(event);
|
|
3242
|
+
}, $[4] = onKeyDown, $[5] = originElement, $[6] = t3) : t3 = $[6];
|
|
3243
|
+
let handleKeyDown = t3, t4;
|
|
3244
|
+
$[7] === Symbol.for("react.memo_cache_sentinel") ? (t4 = (event_0) => {
|
|
3245
|
+
let element_0 = event_0.currentTarget, currentIndex_3 = elementsRef.current.indexOf(element_0);
|
|
3246
|
+
setActiveIndex(currentIndex_3);
|
|
3247
|
+
}, $[7] = t4) : t4 = $[7];
|
|
3248
|
+
let handleItemMouseEnter = t4, t5;
|
|
3249
|
+
$[8] === rootElementRef ? t5 = $[9] : (t5 = () => {
|
|
3250
|
+
setActiveIndex(-2), rootElementRef.current?.focus();
|
|
3251
|
+
}, $[8] = rootElementRef, $[9] = t5);
|
|
3252
|
+
let handleItemMouseLeave = t5, t6, t7;
|
|
3253
|
+
$[10] !== activeIndex || $[11] !== rootElementRef || $[12] !== shouldFocus ? (t6 = () => {
|
|
3254
|
+
if (!rootElementRef.current) return;
|
|
3255
|
+
let rafId = requestAnimationFrame(() => {
|
|
3256
|
+
if (activeIndex === -1) {
|
|
3257
|
+
if (shouldFocus === "first") {
|
|
3258
|
+
let el_3 = _getFocusableElements(elementsRef.current)[0];
|
|
3259
|
+
if (el_3) {
|
|
3260
|
+
let currentIndex_4 = elementsRef.current.indexOf(el_3);
|
|
3261
|
+
setActiveIndex(currentIndex_4);
|
|
3262
|
+
}
|
|
3263
|
+
}
|
|
3264
|
+
if (shouldFocus === "last") {
|
|
3265
|
+
let focusableElements_4 = _getFocusableElements(elementsRef.current), el_4 = focusableElements_4[focusableElements_4.length - 1];
|
|
3266
|
+
if (el_4) {
|
|
3267
|
+
let currentIndex_5 = elementsRef.current.indexOf(el_4);
|
|
3268
|
+
setActiveIndex(currentIndex_5);
|
|
3269
|
+
}
|
|
3270
|
+
}
|
|
3271
|
+
return;
|
|
3272
|
+
}
|
|
3273
|
+
(elementsRef.current[activeIndex] || null)?.focus();
|
|
3274
|
+
});
|
|
3275
|
+
return () => cancelAnimationFrame(rafId);
|
|
3276
|
+
}, t7 = [
|
|
3277
|
+
activeIndex,
|
|
3278
|
+
rootElementRef,
|
|
3279
|
+
setActiveIndex,
|
|
3280
|
+
shouldFocus
|
|
3281
|
+
], $[10] = activeIndex, $[11] = rootElementRef, $[12] = shouldFocus, $[13] = t6, $[14] = t7) : (t6 = $[13], t7 = $[14]), useEffect(t6, t7);
|
|
3282
|
+
let t8;
|
|
3283
|
+
return $[15] !== activeElement || $[16] !== activeIndex || $[17] !== handleItemMouseLeave || $[18] !== handleKeyDown || $[19] !== mount ? (t8 = {
|
|
3284
|
+
activeElement,
|
|
3285
|
+
activeIndex,
|
|
3286
|
+
handleItemMouseEnter,
|
|
3287
|
+
handleItemMouseLeave,
|
|
3288
|
+
handleKeyDown,
|
|
3289
|
+
mount
|
|
3290
|
+
}, $[15] = activeElement, $[16] = activeIndex, $[17] = handleItemMouseLeave, $[18] = handleKeyDown, $[19] = mount, $[20] = t8) : t8 = $[20], t8;
|
|
3291
|
+
}
|
|
3292
|
+
function _temp$8() {}
|
|
3293
|
+
const StyledMenu = styled(Box).withConfig({
|
|
3294
|
+
displayName: "StyledMenu",
|
|
3295
|
+
componentId: "sc-bt15ir-0"
|
|
3296
|
+
})`outline:none;overflow:auto;`, Menu = forwardRef(function Menu(props, forwardedRef) {
|
|
3297
|
+
let $ = c(49), children, onClickOutside, onEscape, onItemClick, onItemSelect, onKeyDown, originElement, registerElement, restProps, t0, t1, t2;
|
|
3298
|
+
$[0] === props ? (children = $[1], onClickOutside = $[2], onEscape = $[3], onItemClick = $[4], onItemSelect = $[5], onKeyDown = $[6], originElement = $[7], registerElement = $[8], restProps = $[9], t0 = $[10], t1 = $[11], t2 = $[12]) : ({children, onClickOutside, onEscape, onItemClick, onItemSelect, onKeyDown, originElement, padding: t0, registerElement, shouldFocus: t1, gap: t2, ...restProps} = props, $[0] = props, $[1] = children, $[2] = onClickOutside, $[3] = onEscape, $[4] = onItemClick, $[5] = onItemSelect, $[6] = onKeyDown, $[7] = originElement, $[8] = registerElement, $[9] = restProps, $[10] = t0, $[11] = t1, $[12] = t2);
|
|
3299
|
+
let padding = t0 === void 0 ? 1 : t0, shouldFocus = t1 === void 0 ? null : t1, gap = t2 === void 0 ? 1 : t2, ref = useRef(null), t3;
|
|
3300
|
+
$[13] === Symbol.for("react.memo_cache_sentinel") ? (t3 = () => ref.current, $[13] = t3) : t3 = $[13], useImperativeHandle(forwardedRef, t3);
|
|
3301
|
+
let { isTopLayer } = useLayer(), t4;
|
|
3302
|
+
$[14] !== onKeyDown || $[15] !== originElement || $[16] !== shouldFocus ? (t4 = {
|
|
3303
|
+
onKeyDown,
|
|
3304
|
+
originElement,
|
|
3305
|
+
shouldFocus,
|
|
3306
|
+
rootElementRef: ref
|
|
3307
|
+
}, $[14] = onKeyDown, $[15] = originElement, $[16] = shouldFocus, $[17] = t4) : t4 = $[17];
|
|
3308
|
+
let { activeElement, activeIndex, handleItemMouseEnter, handleItemMouseLeave, handleKeyDown, mount } = useMenuController(t4), unregisterElementRef = useRef(null), t5;
|
|
3309
|
+
$[18] === registerElement ? t5 = $[19] : (t5 = (el) => {
|
|
3310
|
+
unregisterElementRef.current &&= (unregisterElementRef.current(), null), ref.current = el, ref.current && registerElement && (unregisterElementRef.current = registerElement(ref.current));
|
|
3311
|
+
}, $[18] = registerElement, $[19] = t5);
|
|
3312
|
+
let handleRefChange = t5, t6, t7;
|
|
3313
|
+
$[20] !== activeIndex || $[21] !== onItemSelect ? (t6 = () => {
|
|
3314
|
+
onItemSelect && onItemSelect(activeIndex);
|
|
3315
|
+
}, t7 = [activeIndex, onItemSelect], $[20] = activeIndex, $[21] = onItemSelect, $[22] = t6, $[23] = t7) : (t6 = $[22], t7 = $[23]), useEffect(t6, t7);
|
|
3316
|
+
let t8;
|
|
3317
|
+
$[24] === Symbol.for("react.memo_cache_sentinel") ? (t8 = () => [ref.current], $[24] = t8) : t8 = $[24], useClickOutsideEvent(isTopLayer && onClickOutside, t8);
|
|
3318
|
+
let t9;
|
|
3319
|
+
$[25] !== isTopLayer || $[26] !== onEscape ? (t9 = (event) => {
|
|
3320
|
+
isTopLayer && event.key === "Escape" && (event.stopPropagation(), onEscape && onEscape());
|
|
3321
|
+
}, $[25] = isTopLayer, $[26] = onEscape, $[27] = t9) : t9 = $[27], useGlobalKeyDown(t9);
|
|
3322
|
+
let t10;
|
|
3323
|
+
$[28] !== activeElement || $[29] !== handleItemMouseEnter || $[30] !== handleItemMouseLeave || $[31] !== mount || $[32] !== onClickOutside || $[33] !== onEscape || $[34] !== onItemClick || $[35] !== registerElement ? (t10 = {
|
|
3324
|
+
version: 2,
|
|
3325
|
+
activeElement,
|
|
3326
|
+
mount,
|
|
3327
|
+
onClickOutside,
|
|
3328
|
+
onEscape,
|
|
3329
|
+
onItemClick,
|
|
3330
|
+
onItemMouseEnter: handleItemMouseEnter,
|
|
3331
|
+
onItemMouseLeave: handleItemMouseLeave,
|
|
3332
|
+
registerElement
|
|
3333
|
+
}, $[28] = activeElement, $[29] = handleItemMouseEnter, $[30] = handleItemMouseLeave, $[31] = mount, $[32] = onClickOutside, $[33] = onEscape, $[34] = onItemClick, $[35] = registerElement, $[36] = t10) : t10 = $[36];
|
|
3334
|
+
let value = t10, t11;
|
|
3335
|
+
$[37] !== children || $[38] !== gap ? (t11 = /* @__PURE__ */ jsx(Stack, {
|
|
3336
|
+
gap,
|
|
3337
|
+
children
|
|
3338
|
+
}), $[37] = children, $[38] = gap, $[39] = t11) : t11 = $[39];
|
|
3339
|
+
let t12;
|
|
3340
|
+
$[40] !== handleKeyDown || $[41] !== handleRefChange || $[42] !== padding || $[43] !== restProps || $[44] !== t11 ? (t12 = /* @__PURE__ */ jsx(StyledMenu, {
|
|
3341
|
+
"data-ui": "Menu",
|
|
3342
|
+
...restProps,
|
|
3343
|
+
onKeyDown: handleKeyDown,
|
|
3344
|
+
padding,
|
|
3345
|
+
ref: handleRefChange,
|
|
3346
|
+
role: "menu",
|
|
3347
|
+
tabIndex: -1,
|
|
3348
|
+
children: t11
|
|
3349
|
+
}), $[40] = handleKeyDown, $[41] = handleRefChange, $[42] = padding, $[43] = restProps, $[44] = t11, $[45] = t12) : t12 = $[45];
|
|
3350
|
+
let t13;
|
|
3351
|
+
return $[46] !== t12 || $[47] !== value ? (t13 = /* @__PURE__ */ jsx(MenuContext.Provider, {
|
|
3352
|
+
value,
|
|
3353
|
+
children: t12
|
|
3354
|
+
}), $[46] = t12, $[47] = value, $[48] = t13) : t13 = $[48], t13;
|
|
3355
|
+
}), MenuButton = forwardRef(function MenuButton(props, forwardedRef) {
|
|
3356
|
+
let $ = c(56), { __unstable_disableRestoreFocusOnClose: t0, button: buttonProp, id, menu: menuProp, onClose, onOpen, popover } = props, disableRestoreFocusOnClose = t0 !== void 0 && t0, [open, setOpen] = useState(!1), [shouldFocus, setShouldFocus] = useState(null), [buttonElement, setButtonElement] = useState(null), t1;
|
|
3357
|
+
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t1 = [], $[0] = t1) : t1 = $[0];
|
|
3358
|
+
let [menuElements, setChildMenuElements] = useState(t1), openRef = useRef(open), t2, t3;
|
|
3359
|
+
$[1] !== onOpen || $[2] !== open ? (t2 = () => {
|
|
928
3360
|
onOpen && open && !openRef.current && onOpen();
|
|
929
|
-
},
|
|
930
|
-
let
|
|
931
|
-
$[5] !== onClose || $[6] !== open ? (
|
|
3361
|
+
}, t3 = [onOpen, open], $[1] = onOpen, $[2] = open, $[3] = t2, $[4] = t3) : (t2 = $[3], t3 = $[4]), useEffect(t2, t3);
|
|
3362
|
+
let t4, t5;
|
|
3363
|
+
$[5] !== onClose || $[6] !== open ? (t4 = () => {
|
|
932
3364
|
onClose && !open && openRef.current && onClose();
|
|
933
|
-
},
|
|
934
|
-
let
|
|
935
|
-
$[9] === open ? (
|
|
3365
|
+
}, t5 = [onClose, open], $[5] = onClose, $[6] = open, $[7] = t4, $[8] = t5) : (t4 = $[7], t5 = $[8]), useEffect(t4, t5);
|
|
3366
|
+
let t6, t7;
|
|
3367
|
+
$[9] === open ? (t6 = $[10], t7 = $[11]) : (t6 = () => {
|
|
936
3368
|
openRef.current = open;
|
|
937
|
-
},
|
|
938
|
-
let
|
|
939
|
-
$[12] === Symbol.for("react.memo_cache_sentinel") ? (
|
|
940
|
-
setOpen(_temp$
|
|
941
|
-
}, $[12] =
|
|
942
|
-
let handleButtonClick =
|
|
943
|
-
$[13] === open ?
|
|
3369
|
+
}, t7 = [open], $[9] = open, $[10] = t6, $[11] = t7), useEffect(t6, t7);
|
|
3370
|
+
let t8;
|
|
3371
|
+
$[12] === Symbol.for("react.memo_cache_sentinel") ? (t8 = () => {
|
|
3372
|
+
setOpen(_temp$7), setShouldFocus(null);
|
|
3373
|
+
}, $[12] = t8) : t8 = $[12];
|
|
3374
|
+
let handleButtonClick = t8, t9;
|
|
3375
|
+
$[13] === open ? t9 = $[14] : (t9 = (event) => {
|
|
944
3376
|
open && event.preventDefault();
|
|
945
|
-
}, $[13] = open, $[14] =
|
|
946
|
-
let handleMouseDown =
|
|
947
|
-
$[15] === Symbol.for("react.memo_cache_sentinel") ? (
|
|
3377
|
+
}, $[13] = open, $[14] = t9);
|
|
3378
|
+
let handleMouseDown = t9, t10;
|
|
3379
|
+
$[15] === Symbol.for("react.memo_cache_sentinel") ? (t10 = (event_0) => {
|
|
948
3380
|
if (event_0.key === "ArrowDown" || event_0.key === "Enter" || event_0.key === " ") {
|
|
949
3381
|
event_0.preventDefault(), setOpen(!0), setShouldFocus("first");
|
|
950
3382
|
return;
|
|
@@ -953,35 +3385,35 @@ const MenuButton = forwardRef(function MenuButton(props, forwardedRef) {
|
|
|
953
3385
|
event_0.preventDefault(), setOpen(!0), setShouldFocus("last");
|
|
954
3386
|
return;
|
|
955
3387
|
}
|
|
956
|
-
}, $[15] =
|
|
957
|
-
let handleButtonKeyDown =
|
|
958
|
-
$[16] !== buttonElement || $[17] !== menuElements ? (
|
|
3388
|
+
}, $[15] = t10) : t10 = $[15];
|
|
3389
|
+
let handleButtonKeyDown = t10, t11;
|
|
3390
|
+
$[16] !== buttonElement || $[17] !== menuElements ? (t11 = (event_1) => {
|
|
959
3391
|
let target = event_1.target;
|
|
960
3392
|
if (target instanceof Node && !(buttonElement && (target === buttonElement || buttonElement.contains(target)))) {
|
|
961
3393
|
for (let el of menuElements) if (target === el || el.contains(target)) return;
|
|
962
3394
|
setOpen(!1);
|
|
963
3395
|
}
|
|
964
|
-
}, $[16] = buttonElement, $[17] = menuElements, $[18] =
|
|
965
|
-
let handleMenuClickOutside =
|
|
966
|
-
$[19] !== buttonElement || $[20] !== disableRestoreFocusOnClose ? (
|
|
3396
|
+
}, $[16] = buttonElement, $[17] = menuElements, $[18] = t11) : t11 = $[18];
|
|
3397
|
+
let handleMenuClickOutside = t11, t12;
|
|
3398
|
+
$[19] !== buttonElement || $[20] !== disableRestoreFocusOnClose ? (t12 = () => {
|
|
967
3399
|
setOpen(!1), !disableRestoreFocusOnClose && buttonElement && buttonElement.focus();
|
|
968
|
-
}, $[19] = buttonElement, $[20] = disableRestoreFocusOnClose, $[21] =
|
|
969
|
-
let handleMenuEscape =
|
|
970
|
-
$[22] === menuElements ?
|
|
3400
|
+
}, $[19] = buttonElement, $[20] = disableRestoreFocusOnClose, $[21] = t12) : t12 = $[21];
|
|
3401
|
+
let handleMenuEscape = t12, t13;
|
|
3402
|
+
$[22] === menuElements ? t13 = $[23] : (t13 = (event_2) => {
|
|
971
3403
|
let target_0 = event_2.relatedTarget;
|
|
972
3404
|
if (target_0 instanceof Node) {
|
|
973
3405
|
for (let el_0 of menuElements) if (el_0 === target_0 || el_0.contains(target_0)) return;
|
|
974
3406
|
setOpen(!1);
|
|
975
3407
|
}
|
|
976
|
-
}, $[22] = menuElements, $[23] =
|
|
977
|
-
let handleBlur =
|
|
978
|
-
$[24] !== buttonElement || $[25] !== disableRestoreFocusOnClose ? (
|
|
3408
|
+
}, $[22] = menuElements, $[23] = t13);
|
|
3409
|
+
let handleBlur = t13, t14;
|
|
3410
|
+
$[24] !== buttonElement || $[25] !== disableRestoreFocusOnClose ? (t14 = () => {
|
|
979
3411
|
setOpen(!1), !disableRestoreFocusOnClose && buttonElement && buttonElement.focus();
|
|
980
|
-
}, $[24] = buttonElement, $[25] = disableRestoreFocusOnClose, $[26] =
|
|
981
|
-
let handleItemClick =
|
|
982
|
-
$[27] === Symbol.for("react.memo_cache_sentinel") ? (
|
|
983
|
-
let registerElement =
|
|
984
|
-
$[28] !== buttonElement || $[29] !== handleBlur || $[30] !== handleItemClick || $[31] !== handleMenuClickOutside || $[32] !== handleMenuEscape || $[33] !== id || $[34] !== menuProp || $[35] !== shouldFocus ? (
|
|
3412
|
+
}, $[24] = buttonElement, $[25] = disableRestoreFocusOnClose, $[26] = t14) : t14 = $[26];
|
|
3413
|
+
let handleItemClick = t14, t15;
|
|
3414
|
+
$[27] === Symbol.for("react.memo_cache_sentinel") ? (t15 = (el_1) => (setChildMenuElements((els) => els.concat([el_1])), () => setChildMenuElements((els_0) => els_0.filter((_el) => _el !== el_1))), $[27] = t15) : t15 = $[27];
|
|
3415
|
+
let registerElement = t15, t16;
|
|
3416
|
+
$[28] !== buttonElement || $[29] !== handleBlur || $[30] !== handleItemClick || $[31] !== handleMenuClickOutside || $[32] !== handleMenuEscape || $[33] !== id || $[34] !== menuProp || $[35] !== shouldFocus ? (t16 = menuProp && cloneElement(menuProp, {
|
|
985
3417
|
"aria-labelledby": id,
|
|
986
3418
|
onBlurCapture: handleBlur,
|
|
987
3419
|
onClickOutside: handleMenuClickOutside,
|
|
@@ -990,9 +3422,9 @@ const MenuButton = forwardRef(function MenuButton(props, forwardedRef) {
|
|
|
990
3422
|
originElement: buttonElement,
|
|
991
3423
|
registerElement,
|
|
992
3424
|
shouldFocus
|
|
993
|
-
}), $[28] = buttonElement, $[29] = handleBlur, $[30] = handleItemClick, $[31] = handleMenuClickOutside, $[32] = handleMenuEscape, $[33] = id, $[34] = menuProp, $[35] = shouldFocus, $[36] =
|
|
994
|
-
let menu =
|
|
995
|
-
$[37] !== buttonProp || $[38] !== handleMouseDown || $[39] !== id || $[40] !== open ? (
|
|
3425
|
+
}), $[28] = buttonElement, $[29] = handleBlur, $[30] = handleItemClick, $[31] = handleMenuClickOutside, $[32] = handleMenuEscape, $[33] = id, $[34] = menuProp, $[35] = shouldFocus, $[36] = t16) : t16 = $[36];
|
|
3426
|
+
let menu = t16, t17;
|
|
3427
|
+
$[37] !== buttonProp || $[38] !== handleMouseDown || $[39] !== id || $[40] !== open ? (t17 = buttonProp && cloneElement(buttonProp, {
|
|
996
3428
|
"data-ui": "MenuButton",
|
|
997
3429
|
id,
|
|
998
3430
|
onClick: handleButtonClick,
|
|
@@ -1002,39 +3434,286 @@ const MenuButton = forwardRef(function MenuButton(props, forwardedRef) {
|
|
|
1002
3434
|
"aria-expanded": open,
|
|
1003
3435
|
ref: setButtonElement,
|
|
1004
3436
|
selected: buttonProp.props.selected ?? open
|
|
1005
|
-
}), $[37] = buttonProp, $[38] = handleMouseDown, $[39] = id, $[40] = open, $[41] =
|
|
1006
|
-
let button = t18, t19
|
|
1007
|
-
$[42] === buttonElement ? (
|
|
3437
|
+
}), $[37] = buttonProp, $[38] = handleMouseDown, $[39] = id, $[40] = open, $[41] = t17) : t17 = $[41];
|
|
3438
|
+
let button = t17, t18, t19;
|
|
3439
|
+
$[42] === buttonElement ? (t18 = $[43], t19 = $[44]) : (t18 = () => buttonElement, t19 = [buttonElement], $[42] = buttonElement, $[43] = t18, $[44] = t19), useImperativeHandle(forwardedRef, t18, t19);
|
|
3440
|
+
let t20;
|
|
3441
|
+
$[45] === popover ? t20 = $[46] : (t20 = popover || {}, $[45] = popover, $[46] = t20);
|
|
1008
3442
|
let t21;
|
|
1009
|
-
$[
|
|
1010
|
-
let t22;
|
|
1011
|
-
$[47] !== deprecated_boundaryElement || $[48] !== deprecated_placement || $[49] !== deprecated_popoverRadius || $[50] !== deprecated_popoverScheme || $[51] !== deprecated_portal || $[52] !== deprecated_preventOverflow || $[53] !== t21 ? (t22 = {
|
|
1012
|
-
boundaryElement: deprecated_boundaryElement,
|
|
3443
|
+
$[47] === t20 ? t21 = $[48] : (t21 = {
|
|
1013
3444
|
overflow: "auto",
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
let popoverProps = t22, t23;
|
|
1022
|
-
$[55] === button ? t23 = $[56] : (t23 = button || /* @__PURE__ */ jsx(Fragment$1, {}), $[55] = button, $[56] = t23);
|
|
1023
|
-
let t24;
|
|
1024
|
-
return $[57] !== menu || $[58] !== open || $[59] !== popoverProps || $[60] !== t23 ? (t24 = /* @__PURE__ */ jsx(Popover, {
|
|
3445
|
+
portal: !0,
|
|
3446
|
+
...t20
|
|
3447
|
+
}, $[47] = t20, $[48] = t21);
|
|
3448
|
+
let popoverProps = t21, t22;
|
|
3449
|
+
$[49] === button ? t22 = $[50] : (t22 = button || /* @__PURE__ */ jsx(Fragment$1, {}), $[49] = button, $[50] = t22);
|
|
3450
|
+
let t23;
|
|
3451
|
+
return $[51] !== menu || $[52] !== open || $[53] !== popoverProps || $[54] !== t22 ? (t23 = /* @__PURE__ */ jsx(Popover, {
|
|
1025
3452
|
"data-ui": "MenuButton__popover",
|
|
1026
3453
|
...popoverProps,
|
|
1027
3454
|
content: menu,
|
|
1028
3455
|
open,
|
|
1029
|
-
children:
|
|
1030
|
-
}), $[
|
|
3456
|
+
children: t22
|
|
3457
|
+
}), $[51] = menu, $[52] = open, $[53] = popoverProps, $[54] = t22, $[55] = t23) : t23 = $[55], t23;
|
|
1031
3458
|
});
|
|
1032
|
-
function _temp$
|
|
3459
|
+
function _temp$7(v) {
|
|
1033
3460
|
return !v;
|
|
1034
3461
|
}
|
|
3462
|
+
/**
|
|
3463
|
+
* @public
|
|
3464
|
+
*/
|
|
3465
|
+
const MenuDivider = styled.hr.withConfig({
|
|
3466
|
+
displayName: "MenuDivider",
|
|
3467
|
+
componentId: "sc-sxuath-0"
|
|
3468
|
+
})`height:1px;border:0;background:var(--card-hairline-soft-color);margin:0;`;
|
|
3469
|
+
function selectableBaseStyle() {
|
|
3470
|
+
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;}`;
|
|
3471
|
+
}
|
|
3472
|
+
function selectableColorStyle(props) {
|
|
3473
|
+
let { $tone } = props, { color, style } = getTheme_v2(props.theme), tone = color.selectable[$tone];
|
|
3474
|
+
return css`${_cardColorStyle(color, tone.enabled)} background-color:var(--card-bg-color);color:var(--card-fg-color);outline:none;&[data-as='button']{&:disabled{${_cardColorStyle(color, tone.disabled)}}&:not(:disabled){&[aria-pressed='true']{${_cardColorStyle(color, tone.pressed)}}&[data-selected],&[aria-selected='true'] > &{${_cardColorStyle(color, tone.selected)}}@media (hover:hover){&:not([data-selected]){&[data-hovered],&:hover{${_cardColorStyle(color, tone.hovered)}}&:active{${_cardColorStyle(color, tone.pressed)}}}}}}&[data-as='a']{&[data-disabled]{${_cardColorStyle(color, tone.disabled)}}&:not([data-disabled]){&[data-pressed]{${_cardColorStyle(color, tone.pressed)}}&[data-selected]{${_cardColorStyle(color, tone.selected)}}@media (hover:hover){&:not([data-selected]){&[data-hovered],&:hover{${_cardColorStyle(color, tone.hovered)}}&:active{${_cardColorStyle(color, tone.pressed)}}}}}}${style?.card?.root}`;
|
|
3475
|
+
}
|
|
3476
|
+
/**
|
|
3477
|
+
* @internal
|
|
3478
|
+
*/
|
|
3479
|
+
const Selectable = /* @__PURE__ */ styled(Box).withConfig({
|
|
3480
|
+
displayName: "Selectable",
|
|
3481
|
+
componentId: "sc-njdnrn-0"
|
|
3482
|
+
})(responsiveRadiusStyle, selectableBaseStyle, selectableColorStyle);
|
|
3483
|
+
function useMenu() {
|
|
3484
|
+
let value = useContext(MenuContext);
|
|
3485
|
+
if (!value) throw Error("useMenu(): missing context value");
|
|
3486
|
+
if (!isRecord(value) || value.version !== 2) throw Error("useMenu(): the context value is not compatible");
|
|
3487
|
+
return value;
|
|
3488
|
+
}
|
|
3489
|
+
/**
|
|
3490
|
+
* @public
|
|
3491
|
+
*/
|
|
3492
|
+
const MenuGroup = function MenuGroup(props) {
|
|
3493
|
+
let $ = c(81), IconComponent, children, menuProps, onClick, popover, restProps, t0, t1, t2, t3, t4, t5, text;
|
|
3494
|
+
$[0] === props ? (IconComponent = $[1], children = $[2], menuProps = $[3], onClick = $[4], popover = $[5], restProps = $[6], t0 = $[7], t1 = $[8], t2 = $[9], t3 = $[10], t4 = $[11], t5 = $[12], text = $[13]) : ({as: t0, children, fontSize: t1, icon: IconComponent, menu: menuProps, onClick, padding: t2, popover, radius: t3, gap: t4, text, tone: t5, ...restProps} = props, $[0] = props, $[1] = IconComponent, $[2] = children, $[3] = menuProps, $[4] = onClick, $[5] = popover, $[6] = restProps, $[7] = t0, $[8] = t1, $[9] = t2, $[10] = t3, $[11] = t4, $[12] = t5, $[13] = text);
|
|
3495
|
+
let as = t0 === void 0 ? "button" : t0, fontSize = t1 === void 0 ? 1 : t1, padding = t2 === void 0 ? 3 : t2, radius = t3 === void 0 ? 2 : t3, gap = t4 === void 0 ? 3 : t4, tone = t5 === void 0 ? "default" : t5, menu = useMenu(), { scheme } = useRootTheme(), { activeElement, mount, onClickOutside, onEscape, onItemClick, onItemMouseEnter: _onItemMouseEnter, registerElement } = menu, onItemMouseEnter = _onItemMouseEnter ?? menu.onItemMouseEnter, [rootElement, setRootElement] = useState(null), [open, setOpen] = useState(!1), [shouldFocus, setShouldFocus] = useState(null), active = !!activeElement && activeElement === rootElement, [withinMenu, setWithinMenu] = useState(!1), t6;
|
|
3496
|
+
$[14] === onItemMouseEnter ? t6 = $[15] : (t6 = (event) => {
|
|
3497
|
+
setWithinMenu(!1), onItemMouseEnter(event), setOpen(!0);
|
|
3498
|
+
}, $[14] = onItemMouseEnter, $[15] = t6);
|
|
3499
|
+
let handleMouseEnter = t6, t7;
|
|
3500
|
+
$[16] === rootElement ? t7 = $[17] : (t7 = (event_0) => {
|
|
3501
|
+
event_0.key === "ArrowLeft" && (event_0.stopPropagation(), setOpen(!1), requestAnimationFrame(() => {
|
|
3502
|
+
rootElement?.focus();
|
|
3503
|
+
}));
|
|
3504
|
+
}, $[16] = rootElement, $[17] = t7);
|
|
3505
|
+
let handleMenuKeyDown = t7, t8;
|
|
3506
|
+
$[18] === onClick ? t8 = $[19] : (t8 = (event_1) => {
|
|
3507
|
+
onClick?.(event_1), setShouldFocus("first"), setOpen(!0);
|
|
3508
|
+
}, $[18] = onClick, $[19] = t8);
|
|
3509
|
+
let handleClick = t8, t9;
|
|
3510
|
+
$[20] === onItemClick ? t9 = $[21] : (t9 = () => {
|
|
3511
|
+
setOpen(!1), onItemClick?.();
|
|
3512
|
+
}, $[20] = onItemClick, $[21] = t9);
|
|
3513
|
+
let handleChildItemClick = t9, t10;
|
|
3514
|
+
$[22] === Symbol.for("react.memo_cache_sentinel") ? (t10 = () => setWithinMenu(!0), $[22] = t10) : t10 = $[22];
|
|
3515
|
+
let handleMenuMouseEnter = t10, t11, t12;
|
|
3516
|
+
$[23] !== mount || $[24] !== rootElement ? (t11 = () => mount(rootElement), t12 = [mount, rootElement], $[23] = mount, $[24] = rootElement, $[25] = t11, $[26] = t12) : (t11 = $[25], t12 = $[26]), useEffect(t11, t12);
|
|
3517
|
+
let t13, t14;
|
|
3518
|
+
$[27] === active ? (t13 = $[28], t14 = $[29]) : (t13 = () => {
|
|
3519
|
+
active || setOpen(!1);
|
|
3520
|
+
}, t14 = [active], $[27] = active, $[28] = t13, $[29] = t14), useEffect(t13, t14);
|
|
3521
|
+
let t15, t16;
|
|
3522
|
+
$[30] === open ? (t15 = $[31], t16 = $[32]) : (t15 = () => {
|
|
3523
|
+
open || setWithinMenu(!1);
|
|
3524
|
+
}, t16 = [open], $[30] = open, $[31] = t15, $[32] = t16), useEffect(t15, t16);
|
|
3525
|
+
let t17, t18;
|
|
3526
|
+
$[33] === shouldFocus ? (t17 = $[34], t18 = $[35]) : (t17 = () => {
|
|
3527
|
+
if (!shouldFocus) return;
|
|
3528
|
+
let rafId = requestAnimationFrame(() => setShouldFocus(null));
|
|
3529
|
+
return () => cancelAnimationFrame(rafId);
|
|
3530
|
+
}, t18 = [shouldFocus], $[33] = shouldFocus, $[34] = t17, $[35] = t18), useEffect(t17, t18);
|
|
3531
|
+
let t19;
|
|
3532
|
+
$[36] !== children || $[37] !== handleChildItemClick || $[38] !== handleMenuKeyDown || $[39] !== menuProps || $[40] !== onClickOutside || $[41] !== onEscape || $[42] !== registerElement || $[43] !== shouldFocus ? (t19 = /* @__PURE__ */ jsx(Menu, {
|
|
3533
|
+
...menuProps,
|
|
3534
|
+
onClickOutside,
|
|
3535
|
+
onEscape,
|
|
3536
|
+
onItemClick: handleChildItemClick,
|
|
3537
|
+
onKeyDown: handleMenuKeyDown,
|
|
3538
|
+
onMouseEnter: handleMenuMouseEnter,
|
|
3539
|
+
registerElement,
|
|
3540
|
+
shouldFocus,
|
|
3541
|
+
children
|
|
3542
|
+
}), $[36] = children, $[37] = handleChildItemClick, $[38] = handleMenuKeyDown, $[39] = menuProps, $[40] = onClickOutside, $[41] = onEscape, $[42] = registerElement, $[43] = shouldFocus, $[44] = t19) : t19 = $[44];
|
|
3543
|
+
let childMenu = t19, t20;
|
|
3544
|
+
$[45] === Symbol.for("react.memo_cache_sentinel") ? (t20 = (event_2) => {
|
|
3545
|
+
let target = event_2.currentTarget;
|
|
3546
|
+
if (document.activeElement === target && event_2.key === "ArrowRight") {
|
|
3547
|
+
setShouldFocus("first"), setOpen(!0), setWithinMenu(!0);
|
|
3548
|
+
return;
|
|
3549
|
+
}
|
|
3550
|
+
}, $[45] = t20) : t20 = $[45];
|
|
3551
|
+
let handleKeyDown = t20, t21 = as === "button" ? withinMenu : void 0, t22 = as === "button" ? void 0 : withinMenu, t23 = !withinMenu && active ? "" : void 0, t24;
|
|
3552
|
+
$[46] === radius ? t24 = $[47] : (t24 = _getArrayProp(radius), $[46] = radius, $[47] = t24);
|
|
3553
|
+
let t25 = as === "button" ? "button" : void 0, t26;
|
|
3554
|
+
$[48] !== IconComponent || $[49] !== fontSize ? (t26 = IconComponent && /* @__PURE__ */ jsxs(Text, {
|
|
3555
|
+
size: fontSize,
|
|
3556
|
+
children: [isValidElement(IconComponent) && IconComponent, isValidElementType(IconComponent) && /* @__PURE__ */ jsx(IconComponent, {})]
|
|
3557
|
+
}), $[48] = IconComponent, $[49] = fontSize, $[50] = t26) : t26 = $[50];
|
|
3558
|
+
let t27;
|
|
3559
|
+
$[51] !== fontSize || $[52] !== text ? (t27 = /* @__PURE__ */ jsx(Box, {
|
|
3560
|
+
flex: 1,
|
|
3561
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
3562
|
+
size: fontSize,
|
|
3563
|
+
textOverflow: "ellipsis",
|
|
3564
|
+
weight: "medium",
|
|
3565
|
+
children: text
|
|
3566
|
+
})
|
|
3567
|
+
}), $[51] = fontSize, $[52] = text, $[53] = t27) : t27 = $[53];
|
|
3568
|
+
let t28;
|
|
3569
|
+
$[54] === Symbol.for("react.memo_cache_sentinel") ? (t28 = /* @__PURE__ */ jsx(ChevronRightIcon, {}), $[54] = t28) : t28 = $[54];
|
|
3570
|
+
let t29;
|
|
3571
|
+
$[55] === fontSize ? t29 = $[56] : (t29 = /* @__PURE__ */ jsx(Text, {
|
|
3572
|
+
size: fontSize,
|
|
3573
|
+
children: t28
|
|
3574
|
+
}), $[55] = fontSize, $[56] = t29);
|
|
3575
|
+
let t30;
|
|
3576
|
+
$[57] !== gap || $[58] !== padding || $[59] !== t26 || $[60] !== t27 || $[61] !== t29 ? (t30 = /* @__PURE__ */ jsxs(Flex, {
|
|
3577
|
+
gap,
|
|
3578
|
+
padding,
|
|
3579
|
+
children: [
|
|
3580
|
+
t26,
|
|
3581
|
+
t27,
|
|
3582
|
+
t29
|
|
3583
|
+
]
|
|
3584
|
+
}), $[57] = gap, $[58] = padding, $[59] = t26, $[60] = t27, $[61] = t29, $[62] = t30) : t30 = $[62];
|
|
3585
|
+
let t31;
|
|
3586
|
+
$[63] !== as || $[64] !== handleClick || $[65] !== handleMouseEnter || $[66] !== restProps || $[67] !== scheme || $[68] !== t21 || $[69] !== t22 || $[70] !== t23 || $[71] !== t24 || $[72] !== t25 || $[73] !== t30 || $[74] !== tone ? (t31 = /* @__PURE__ */ jsx(Selectable, {
|
|
3587
|
+
"data-as": as,
|
|
3588
|
+
"data-ui": "MenuGroup",
|
|
3589
|
+
forwardedAs: as,
|
|
3590
|
+
...restProps,
|
|
3591
|
+
"aria-pressed": t21,
|
|
3592
|
+
"data-pressed": t22,
|
|
3593
|
+
"data-selected": t23,
|
|
3594
|
+
$radius: t24,
|
|
3595
|
+
$tone: tone,
|
|
3596
|
+
$scheme: scheme,
|
|
3597
|
+
onClick: handleClick,
|
|
3598
|
+
onKeyDown: handleKeyDown,
|
|
3599
|
+
onMouseEnter: handleMouseEnter,
|
|
3600
|
+
ref: setRootElement,
|
|
3601
|
+
tabIndex: -1,
|
|
3602
|
+
type: t25,
|
|
3603
|
+
children: t30
|
|
3604
|
+
}), $[63] = as, $[64] = handleClick, $[65] = handleMouseEnter, $[66] = restProps, $[67] = scheme, $[68] = t21, $[69] = t22, $[70] = t23, $[71] = t24, $[72] = t25, $[73] = t30, $[74] = tone, $[75] = t31) : t31 = $[75];
|
|
3605
|
+
let t32;
|
|
3606
|
+
return $[76] !== childMenu || $[77] !== open || $[78] !== popover || $[79] !== t31 ? (t32 = /* @__PURE__ */ jsx(Popover, {
|
|
3607
|
+
...popover,
|
|
3608
|
+
content: childMenu,
|
|
3609
|
+
"data-ui": "MenuGroup__popover",
|
|
3610
|
+
open,
|
|
3611
|
+
children: t31
|
|
3612
|
+
}), $[76] = childMenu, $[77] = open, $[78] = popover, $[79] = t31, $[80] = t32) : t32 = $[80], t32;
|
|
3613
|
+
}, MenuItem = forwardRef(function MenuItem(props, forwardedRef) {
|
|
3614
|
+
let $ = c(75), IconComponent, IconRightComponent, children, disabled, hotkeys, onClick, paddingBottom, paddingLeft, paddingRight, paddingTop, paddingX, paddingY, pressed, restProps, selectedProp, t0, t1, t2, t3, t4, t5, text;
|
|
3615
|
+
$[0] === props ? (IconComponent = $[1], IconRightComponent = $[2], children = $[3], disabled = $[4], hotkeys = $[5], onClick = $[6], paddingBottom = $[7], paddingLeft = $[8], paddingRight = $[9], paddingTop = $[10], paddingX = $[11], paddingY = $[12], pressed = $[13], restProps = $[14], selectedProp = $[15], t0 = $[16], t1 = $[17], t2 = $[18], t3 = $[19], t4 = $[20], t5 = $[21], text = $[22]) : ({as: t0, children, disabled, fontSize: t1, hotkeys, icon: IconComponent, iconRight: IconRightComponent, onClick, padding: t2, paddingX, paddingY, paddingTop, paddingRight, paddingBottom, paddingLeft, pressed, radius: t3, selected: selectedProp, gap: t4, text, tone: t5, ...restProps} = props, $[0] = props, $[1] = IconComponent, $[2] = IconRightComponent, $[3] = children, $[4] = disabled, $[5] = hotkeys, $[6] = onClick, $[7] = paddingBottom, $[8] = paddingLeft, $[9] = paddingRight, $[10] = paddingTop, $[11] = paddingX, $[12] = paddingY, $[13] = pressed, $[14] = restProps, $[15] = selectedProp, $[16] = t0, $[17] = t1, $[18] = t2, $[19] = t3, $[20] = t4, $[21] = t5, $[22] = text);
|
|
3616
|
+
let as = t0 === void 0 ? "button" : t0, fontSize = t1 === void 0 ? 1 : t1, padding = t2 === void 0 ? 3 : t2, radius = t3 === void 0 ? 2 : t3, gap = t4 === void 0 ? 3 : t4, tone = t5 === void 0 ? "default" : t5, { scheme } = useRootTheme(), menu = useMenu(), { activeElement, mount, onItemClick, onItemMouseEnter: _onItemMouseEnter, onItemMouseLeave: _onItemMouseLeave } = menu, onItemMouseEnter = _onItemMouseEnter ?? menu.onItemMouseEnter, onItemMouseLeave = _onItemMouseLeave ?? menu.onItemMouseLeave, [rootElement, setRootElement] = useState(null), active = !!activeElement && activeElement === rootElement, ref = useRef(null), t6;
|
|
3617
|
+
$[23] === Symbol.for("react.memo_cache_sentinel") ? (t6 = () => ref.current, $[23] = t6) : t6 = $[23], useImperativeHandle(forwardedRef, t6);
|
|
3618
|
+
let t7, t8;
|
|
3619
|
+
$[24] !== mount || $[25] !== rootElement || $[26] !== selectedProp ? (t7 = () => mount(rootElement, selectedProp), t8 = [
|
|
3620
|
+
mount,
|
|
3621
|
+
rootElement,
|
|
3622
|
+
selectedProp
|
|
3623
|
+
], $[24] = mount, $[25] = rootElement, $[26] = selectedProp, $[27] = t7, $[28] = t8) : (t7 = $[27], t8 = $[28]), useEffect(t7, t8);
|
|
3624
|
+
let t9;
|
|
3625
|
+
$[29] !== disabled || $[30] !== onClick || $[31] !== onItemClick ? (t9 = (event) => {
|
|
3626
|
+
disabled || (onClick && onClick(event), onItemClick && onItemClick());
|
|
3627
|
+
}, $[29] = disabled, $[30] = onClick, $[31] = onItemClick, $[32] = t9) : t9 = $[32];
|
|
3628
|
+
let handleClick = t9, t10;
|
|
3629
|
+
$[33] !== padding || $[34] !== paddingBottom || $[35] !== paddingLeft || $[36] !== paddingRight || $[37] !== paddingTop || $[38] !== paddingX || $[39] !== paddingY ? (t10 = {
|
|
3630
|
+
padding,
|
|
3631
|
+
paddingX,
|
|
3632
|
+
paddingY,
|
|
3633
|
+
paddingTop,
|
|
3634
|
+
paddingRight,
|
|
3635
|
+
paddingBottom,
|
|
3636
|
+
paddingLeft
|
|
3637
|
+
}, $[33] = padding, $[34] = paddingBottom, $[35] = paddingLeft, $[36] = paddingRight, $[37] = paddingTop, $[38] = paddingX, $[39] = paddingY, $[40] = t10) : t10 = $[40];
|
|
3638
|
+
let paddingProps = t10, t11;
|
|
3639
|
+
$[41] === fontSize ? t11 = $[42] : (t11 = _getArrayProp(fontSize).map(_temp$6), $[41] = fontSize, $[42] = t11);
|
|
3640
|
+
let hotkeysFontSize = t11, t12;
|
|
3641
|
+
$[43] === Symbol.for("react.memo_cache_sentinel") ? (t12 = (el) => {
|
|
3642
|
+
ref.current = el, setRootElement(el);
|
|
3643
|
+
}, $[43] = t12) : t12 = $[43];
|
|
3644
|
+
let setRef = t12, t13 = as !== "button" && pressed ? "" : void 0, t14 = active ? "" : void 0, t15 = disabled ? "" : void 0, t16;
|
|
3645
|
+
$[44] === radius ? t16 = $[45] : (t16 = _getArrayProp(radius), $[44] = radius, $[45] = t16);
|
|
3646
|
+
let t17;
|
|
3647
|
+
$[46] === Symbol.for("react.memo_cache_sentinel") ? (t17 = _getArrayProp(0), $[46] = t17) : t17 = $[46];
|
|
3648
|
+
let t18 = disabled ? "default" : tone, t19 = as === "button" ? "button" : void 0, t20;
|
|
3649
|
+
$[47] !== IconComponent || $[48] !== IconRightComponent || $[49] !== fontSize || $[50] !== gap || $[51] !== hotkeys || $[52] !== hotkeysFontSize || $[53] !== paddingProps || $[54] !== text ? (t20 = (IconComponent || text || IconRightComponent) && /* @__PURE__ */ jsxs(Flex, {
|
|
3650
|
+
as: "span",
|
|
3651
|
+
gap,
|
|
3652
|
+
align: "center",
|
|
3653
|
+
...paddingProps,
|
|
3654
|
+
children: [
|
|
3655
|
+
IconComponent && /* @__PURE__ */ jsxs(Text, {
|
|
3656
|
+
size: fontSize,
|
|
3657
|
+
children: [isValidElement(IconComponent) && IconComponent, isValidElementType(IconComponent) && /* @__PURE__ */ jsx(IconComponent, {})]
|
|
3658
|
+
}),
|
|
3659
|
+
text && /* @__PURE__ */ jsx(Box, {
|
|
3660
|
+
flex: 1,
|
|
3661
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
3662
|
+
size: fontSize,
|
|
3663
|
+
textOverflow: "ellipsis",
|
|
3664
|
+
weight: "medium",
|
|
3665
|
+
children: text
|
|
3666
|
+
})
|
|
3667
|
+
}),
|
|
3668
|
+
hotkeys && /* @__PURE__ */ jsx(Hotkeys, {
|
|
3669
|
+
fontSize: hotkeysFontSize,
|
|
3670
|
+
keys: hotkeys,
|
|
3671
|
+
style: {
|
|
3672
|
+
marginTop: -4,
|
|
3673
|
+
marginBottom: -4
|
|
3674
|
+
}
|
|
3675
|
+
}),
|
|
3676
|
+
IconRightComponent && /* @__PURE__ */ jsxs(Text, {
|
|
3677
|
+
size: fontSize,
|
|
3678
|
+
children: [isValidElement(IconRightComponent) && IconRightComponent, isValidElementType(IconRightComponent) && /* @__PURE__ */ jsx(IconRightComponent, {})]
|
|
3679
|
+
})
|
|
3680
|
+
]
|
|
3681
|
+
}), $[47] = IconComponent, $[48] = IconRightComponent, $[49] = fontSize, $[50] = gap, $[51] = hotkeys, $[52] = hotkeysFontSize, $[53] = paddingProps, $[54] = text, $[55] = t20) : t20 = $[55];
|
|
3682
|
+
let t21;
|
|
3683
|
+
$[56] !== children || $[57] !== paddingProps ? (t21 = children && /* @__PURE__ */ jsx(Box, {
|
|
3684
|
+
as: "span",
|
|
3685
|
+
...paddingProps,
|
|
3686
|
+
children
|
|
3687
|
+
}), $[56] = children, $[57] = paddingProps, $[58] = t21) : t21 = $[58];
|
|
3688
|
+
let t22;
|
|
3689
|
+
return $[59] !== as || $[60] !== disabled || $[61] !== handleClick || $[62] !== onItemMouseEnter || $[63] !== onItemMouseLeave || $[64] !== restProps || $[65] !== scheme || $[66] !== t13 || $[67] !== t14 || $[68] !== t15 || $[69] !== t16 || $[70] !== t18 || $[71] !== t19 || $[72] !== t20 || $[73] !== t21 ? (t22 = /* @__PURE__ */ jsxs(Selectable, {
|
|
3690
|
+
"data-ui": "MenuItem",
|
|
3691
|
+
role: "menuitem",
|
|
3692
|
+
...restProps,
|
|
3693
|
+
"data-pressed": t13,
|
|
3694
|
+
"data-selected": t14,
|
|
3695
|
+
"data-disabled": t15,
|
|
3696
|
+
forwardedAs: as,
|
|
3697
|
+
$radius: t16,
|
|
3698
|
+
$padding: t17,
|
|
3699
|
+
$tone: t18,
|
|
3700
|
+
$scheme: scheme,
|
|
3701
|
+
disabled,
|
|
3702
|
+
onClick: handleClick,
|
|
3703
|
+
onMouseEnter: onItemMouseEnter,
|
|
3704
|
+
onMouseLeave: onItemMouseLeave,
|
|
3705
|
+
ref: setRef,
|
|
3706
|
+
tabIndex: -1,
|
|
3707
|
+
type: t19,
|
|
3708
|
+
children: [t20, t21]
|
|
3709
|
+
}), $[59] = as, $[60] = disabled, $[61] = handleClick, $[62] = onItemMouseEnter, $[63] = onItemMouseLeave, $[64] = restProps, $[65] = scheme, $[66] = t13, $[67] = t14, $[68] = t15, $[69] = t16, $[70] = t18, $[71] = t19, $[72] = t20, $[73] = t21, $[74] = t22) : t22 = $[74], t22;
|
|
3710
|
+
});
|
|
3711
|
+
function _temp$6(s) {
|
|
3712
|
+
return s - 1;
|
|
3713
|
+
}
|
|
1035
3714
|
const animation = css`background-image:linear-gradient( to right,var(--card-skeleton-color-from),var(--card-skeleton-color-to),var(--card-skeleton-color-from),var(--card-skeleton-color-from),var(--card-skeleton-color-from) );background-position:100%;background-size:200% 100%;background-attachment:fixed;animation-name:${keyframes`0%{background-position:100%;}100%{background-position:-100%;}`};animation-timing-function:ease-in-out;animation-iteration-count:infinite;animation-duration:2000ms;`, skeletonStyle = css`opacity:${({ $visible }) => +!!$visible};transition:opacity 200ms ease-in;@media screen and (prefers-reduced-motion:no-preference){${({ $animated }) => $animated ? animation : css`background-color:var(--card-skeleton-color-from);`}}@media screen and (prefers-reduced-motion:reduce){background-color:var(--card-skeleton-color-from);}`, StyledSkeleton$1 = /* @__PURE__ */ styled(Box).withConfig({
|
|
1036
3715
|
displayName: "StyledSkeleton",
|
|
1037
|
-
componentId: "sc-
|
|
3716
|
+
componentId: "sc-4e9p56-0"
|
|
1038
3717
|
})(responsiveRadiusStyle, skeletonStyle), Skeleton = forwardRef(function Skeleton(props, ref) {
|
|
1039
3718
|
let $ = c(16), delay, radius, restProps, t0;
|
|
1040
3719
|
$[0] === props ? (delay = $[1], radius = $[2], restProps = $[3], t0 = $[4]) : ({animated: t0, delay, radius, ...restProps} = props, $[0] = props, $[1] = delay, $[2] = radius, $[3] = restProps, $[4] = t0);
|
|
@@ -1060,7 +3739,7 @@ const animation = css`background-image:linear-gradient( to right,var(--card-skel
|
|
|
1060
3739
|
}), $[10] = animated, $[11] = ref, $[12] = restProps, $[13] = t3, $[14] = t4, $[15] = t5) : t5 = $[15], t5;
|
|
1061
3740
|
}), StyledSkeleton = /* @__PURE__ */ styled(Skeleton).withConfig({
|
|
1062
3741
|
displayName: "StyledSkeleton",
|
|
1063
|
-
componentId: "sc-
|
|
3742
|
+
componentId: "sc-krx4e5-0"
|
|
1064
3743
|
})((props) => {
|
|
1065
3744
|
let { $size, $style } = props, { font, media } = getTheme_v2(props.theme), fontStyle = font[$style];
|
|
1066
3745
|
return _responsive(media, $size, (sizeIndex) => {
|
|
@@ -1115,6 +3794,74 @@ const animation = css`background-image:linear-gradient( to right,var(--card-skel
|
|
|
1115
3794
|
ref,
|
|
1116
3795
|
$style: "code"
|
|
1117
3796
|
}), $[5] = $size, $[6] = ref, $[7] = restProps, $[8] = t2) : t2 = $[8], t2;
|
|
3797
|
+
}), CustomButton = styled(Button).withConfig({
|
|
3798
|
+
displayName: "CustomButton",
|
|
3799
|
+
componentId: "sc-4lu9jw-0"
|
|
3800
|
+
})`max-width:100%;`, Tab = forwardRef(function Tab(props, forwardedRef) {
|
|
3801
|
+
let $ = c(30), focused, icon, id, label, onClick, onFocus, restProps, selected, t0, t1;
|
|
3802
|
+
$[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);
|
|
3803
|
+
let fontSize = t0 === void 0 ? 1 : t0, padding = t1 === void 0 ? 2 : t1, ref = useRef(null), focusedRef = useRef(!1), t2;
|
|
3804
|
+
$[11] === Symbol.for("react.memo_cache_sentinel") ? (t2 = () => ref.current, $[11] = t2) : t2 = $[11], useImperativeHandle(forwardedRef, t2);
|
|
3805
|
+
let t3;
|
|
3806
|
+
$[12] === Symbol.for("react.memo_cache_sentinel") ? (t3 = () => {
|
|
3807
|
+
focusedRef.current = !1;
|
|
3808
|
+
}, $[12] = t3) : t3 = $[12];
|
|
3809
|
+
let handleBlur = t3, t4;
|
|
3810
|
+
$[13] === onFocus ? t4 = $[14] : (t4 = (event) => {
|
|
3811
|
+
focusedRef.current = !0, onFocus && onFocus(event);
|
|
3812
|
+
}, $[13] = onFocus, $[14] = t4);
|
|
3813
|
+
let handleFocus = t4, t5, t6;
|
|
3814
|
+
$[15] === focused ? (t5 = $[16], t6 = $[17]) : (t5 = () => {
|
|
3815
|
+
focused && !focusedRef.current && (ref.current && ref.current.focus(), focusedRef.current = !0);
|
|
3816
|
+
}, t6 = [focused], $[15] = focused, $[16] = t5, $[17] = t6), useEffect(t5, t6);
|
|
3817
|
+
let t7 = selected ? "true" : "false", t8 = selected ? 0 : -1, t9;
|
|
3818
|
+
return $[18] !== fontSize || $[19] !== handleFocus || $[20] !== icon || $[21] !== id || $[22] !== label || $[23] !== onClick || $[24] !== padding || $[25] !== restProps || $[26] !== selected || $[27] !== t7 || $[28] !== t8 ? (t9 = /* @__PURE__ */ jsx(CustomButton, {
|
|
3819
|
+
"data-ui": "Tab",
|
|
3820
|
+
...restProps,
|
|
3821
|
+
"aria-selected": t7,
|
|
3822
|
+
fontSize,
|
|
3823
|
+
icon,
|
|
3824
|
+
id,
|
|
3825
|
+
mode: "bleed",
|
|
3826
|
+
onClick,
|
|
3827
|
+
onBlur: handleBlur,
|
|
3828
|
+
onFocus: handleFocus,
|
|
3829
|
+
padding,
|
|
3830
|
+
ref,
|
|
3831
|
+
role: "tab",
|
|
3832
|
+
selected,
|
|
3833
|
+
tabIndex: t8,
|
|
3834
|
+
text: label,
|
|
3835
|
+
type: "button"
|
|
3836
|
+
}), $[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;
|
|
3837
|
+
}), CustomInline = styled(Inline).withConfig({
|
|
3838
|
+
displayName: "CustomInline",
|
|
3839
|
+
componentId: "sc-64f0jv-0"
|
|
3840
|
+
})`& > div{display:inline-block;vertical-align:middle;max-width:100%;box-sizing:border-box;}`, TabList = forwardRef(function TabList(props, ref) {
|
|
3841
|
+
let $ = c(15), childrenProp, restProps;
|
|
3842
|
+
$[0] === props ? (childrenProp = $[1], restProps = $[2]) : ({children: childrenProp, ...restProps} = props, $[0] = props, $[1] = childrenProp, $[2] = restProps);
|
|
3843
|
+
let [focusedIndex, setFocusedIndex] = useState(-1), t0;
|
|
3844
|
+
if ($[3] !== childrenProp || $[4] !== focusedIndex) {
|
|
3845
|
+
let children = Children.toArray(childrenProp).filter(isValidElement), t1;
|
|
3846
|
+
$[6] === focusedIndex ? t1 = $[7] : (t1 = (child, childIndex) => cloneElement(child, {
|
|
3847
|
+
focused: focusedIndex === childIndex,
|
|
3848
|
+
key: childIndex,
|
|
3849
|
+
onFocus: () => setFocusedIndex(childIndex)
|
|
3850
|
+
}), $[6] = focusedIndex, $[7] = t1), t0 = children.map(t1), $[3] = childrenProp, $[4] = focusedIndex, $[5] = t0;
|
|
3851
|
+
} else t0 = $[5];
|
|
3852
|
+
let tabs = t0, numTabs = tabs.length, t1;
|
|
3853
|
+
$[8] === numTabs ? t1 = $[9] : (t1 = (event) => {
|
|
3854
|
+
event.key === "ArrowLeft" && setFocusedIndex((prevIndex) => (prevIndex + numTabs - 1) % numTabs), event.key === "ArrowRight" && setFocusedIndex((prevIndex_0) => (prevIndex_0 + 1) % numTabs);
|
|
3855
|
+
}, $[8] = numTabs, $[9] = t1);
|
|
3856
|
+
let handleKeyDown = t1, t2;
|
|
3857
|
+
return $[10] !== handleKeyDown || $[11] !== ref || $[12] !== restProps || $[13] !== tabs ? (t2 = /* @__PURE__ */ jsx(CustomInline, {
|
|
3858
|
+
"data-ui": "TabList",
|
|
3859
|
+
...restProps,
|
|
3860
|
+
onKeyDown: handleKeyDown,
|
|
3861
|
+
ref,
|
|
3862
|
+
role: "tablist",
|
|
3863
|
+
children: tabs
|
|
3864
|
+
}), $[10] = handleKeyDown, $[11] = ref, $[12] = restProps, $[13] = tabs, $[14] = t2) : t2 = $[14], t2;
|
|
1118
3865
|
}), TabPanel = forwardRef(function TabPanel(props, ref) {
|
|
1119
3866
|
let $ = c(9), flex, restProps;
|
|
1120
3867
|
$[0] === props ? (flex = $[1], restProps = $[2]) : ({flex, ...restProps} = props, $[0] = props, $[1] = flex, $[2] = restProps);
|
|
@@ -1299,15 +4046,113 @@ const container = {
|
|
|
1299
4046
|
* @public
|
|
1300
4047
|
*/
|
|
1301
4048
|
function useMounted() {
|
|
1302
|
-
return useSyncExternalStore(subscribe, _temp$
|
|
4049
|
+
return useSyncExternalStore(subscribe, _temp$5, _temp2$1);
|
|
1303
4050
|
}
|
|
1304
|
-
function _temp2() {
|
|
4051
|
+
function _temp2$1() {
|
|
1305
4052
|
return !1;
|
|
1306
4053
|
}
|
|
1307
|
-
function _temp$
|
|
4054
|
+
function _temp$5() {
|
|
1308
4055
|
return !0;
|
|
1309
4056
|
}
|
|
1310
|
-
const subscribe = () => () => {}, ToastContext = createGlobalScopedContext("@sanity/ui/context/toast", null)
|
|
4057
|
+
const subscribe = () => () => {}, ToastContext = createGlobalScopedContext("@sanity/ui/context/toast", null), GRID_CSS = {
|
|
4058
|
+
"&&:not([hidden])": { display: "grid" },
|
|
4059
|
+
"&[data-as=\"ul\"],&[data-as=\"ol\"]": { listStyle: "none" }
|
|
4060
|
+
}, GRID_AUTO_COLUMS = {
|
|
4061
|
+
auto: "auto",
|
|
4062
|
+
min: "min-content",
|
|
4063
|
+
max: "max-content",
|
|
4064
|
+
fr: "minmax(0, 1fr)"
|
|
4065
|
+
}, GRID_AUTO_ROWS = {
|
|
4066
|
+
auto: "auto",
|
|
4067
|
+
min: "min-content",
|
|
4068
|
+
max: "max-content",
|
|
4069
|
+
fr: "minmax(0, 1fr)"
|
|
4070
|
+
};
|
|
4071
|
+
function responsiveGridStyle() {
|
|
4072
|
+
return [
|
|
4073
|
+
GRID_CSS,
|
|
4074
|
+
responsiveGridAutoFlowStyle,
|
|
4075
|
+
responsiveGridAutoRowsStyle,
|
|
4076
|
+
responsiveGridAutoColsStyle,
|
|
4077
|
+
responsiveGridColumnsStyle,
|
|
4078
|
+
responsiveGridRowsStyle,
|
|
4079
|
+
responsiveGridGapStyle,
|
|
4080
|
+
responsiveGridGapXStyle,
|
|
4081
|
+
responsiveGridGapYStyle
|
|
4082
|
+
];
|
|
4083
|
+
}
|
|
4084
|
+
function responsiveGridAutoFlowStyle(props) {
|
|
4085
|
+
let { media } = getTheme_v2(props.theme);
|
|
4086
|
+
return _responsive(media, props.$autoFlow, (autoFlow) => ({ gridAutoFlow: autoFlow }));
|
|
4087
|
+
}
|
|
4088
|
+
function responsiveGridAutoRowsStyle(props) {
|
|
4089
|
+
let { media } = getTheme_v2(props.theme);
|
|
4090
|
+
return _responsive(media, props.$autoRows, (autoRows) => ({ gridAutoRows: autoRows && GRID_AUTO_ROWS[autoRows] }));
|
|
4091
|
+
}
|
|
4092
|
+
function responsiveGridAutoColsStyle(props) {
|
|
4093
|
+
let { media } = getTheme_v2(props.theme);
|
|
4094
|
+
return _responsive(media, props.$autoCols, (autoCols) => ({ gridAutoColumns: autoCols && GRID_AUTO_COLUMS[autoCols] }));
|
|
4095
|
+
}
|
|
4096
|
+
function responsiveGridColumnsStyle(props) {
|
|
4097
|
+
let { media } = getTheme_v2(props.theme);
|
|
4098
|
+
return _responsive(media, props.$columns, (columns) => ({ gridTemplateColumns: columns && `repeat(${columns},minmax(0,1fr));` }));
|
|
4099
|
+
}
|
|
4100
|
+
function responsiveGridRowsStyle(props) {
|
|
4101
|
+
let { media } = getTheme_v2(props.theme);
|
|
4102
|
+
return _responsive(media, props.$rows, (rows) => ({ gridTemplateRows: rows && `repeat(${rows},minmax(0,1fr));` }));
|
|
4103
|
+
}
|
|
4104
|
+
function responsiveGridGapStyle(props) {
|
|
4105
|
+
let { media, space } = getTheme_v2(props.theme);
|
|
4106
|
+
return _responsive(media, props.$gap, (gap) => ({ gridGap: gap ? rem(space[gap]) : void 0 }));
|
|
4107
|
+
}
|
|
4108
|
+
function responsiveGridGapXStyle(props) {
|
|
4109
|
+
let { media, space } = getTheme_v2(props.theme);
|
|
4110
|
+
return _responsive(media, props.$gapX, (gapX) => ({ columnGap: gapX ? rem(space[gapX]) : void 0 }));
|
|
4111
|
+
}
|
|
4112
|
+
function responsiveGridGapYStyle(props) {
|
|
4113
|
+
let { media, space } = getTheme_v2(props.theme);
|
|
4114
|
+
return _responsive(media, props.$gapY, (gapY) => ({ rowGap: gapY ? rem(space[gapY]) : void 0 }));
|
|
4115
|
+
}
|
|
4116
|
+
const StyledGrid = /* @__PURE__ */ styled(Box).withConfig({
|
|
4117
|
+
displayName: "StyledGrid",
|
|
4118
|
+
componentId: "sc-y4ei9r-0"
|
|
4119
|
+
})(responsiveGridStyle), Grid = forwardRef(function Grid(props, ref) {
|
|
4120
|
+
let $ = c(42), as, autoCols, autoFlow, autoRows, children, gap, gapX, gapY, gridTemplateColumns, gridTemplateRows, restProps;
|
|
4121
|
+
$[0] === props ? (as = $[1], autoCols = $[2], autoFlow = $[3], autoRows = $[4], children = $[5], gap = $[6], gapX = $[7], gapY = $[8], gridTemplateColumns = $[9], gridTemplateRows = $[10], restProps = $[11]) : ({as, autoRows, autoCols, autoFlow, gridTemplateColumns, gap, gapX, gapY, gridTemplateRows, children, ...restProps} = props, $[0] = props, $[1] = as, $[2] = autoCols, $[3] = autoFlow, $[4] = autoRows, $[5] = children, $[6] = gap, $[7] = gapX, $[8] = gapY, $[9] = gridTemplateColumns, $[10] = gridTemplateRows, $[11] = restProps);
|
|
4122
|
+
let t0 = typeof as == "string" ? as : void 0, t1;
|
|
4123
|
+
$[12] === autoRows ? t1 = $[13] : (t1 = _getArrayProp(autoRows), $[12] = autoRows, $[13] = t1);
|
|
4124
|
+
let t2;
|
|
4125
|
+
$[14] === autoCols ? t2 = $[15] : (t2 = _getArrayProp(autoCols), $[14] = autoCols, $[15] = t2);
|
|
4126
|
+
let t3;
|
|
4127
|
+
$[16] === autoFlow ? t3 = $[17] : (t3 = _getArrayProp(autoFlow), $[16] = autoFlow, $[17] = t3);
|
|
4128
|
+
let t4;
|
|
4129
|
+
$[18] === gridTemplateColumns ? t4 = $[19] : (t4 = _getArrayProp(gridTemplateColumns), $[18] = gridTemplateColumns, $[19] = t4);
|
|
4130
|
+
let t5;
|
|
4131
|
+
$[20] === gap ? t5 = $[21] : (t5 = _getArrayProp(gap), $[20] = gap, $[21] = t5);
|
|
4132
|
+
let t6;
|
|
4133
|
+
$[22] === gapX ? t6 = $[23] : (t6 = _getArrayProp(gapX), $[22] = gapX, $[23] = t6);
|
|
4134
|
+
let t7;
|
|
4135
|
+
$[24] === gapY ? t7 = $[25] : (t7 = _getArrayProp(gapY), $[24] = gapY, $[25] = t7);
|
|
4136
|
+
let t8;
|
|
4137
|
+
$[26] === gridTemplateRows ? t8 = $[27] : (t8 = _getArrayProp(gridTemplateRows), $[26] = gridTemplateRows, $[27] = t8);
|
|
4138
|
+
let t9;
|
|
4139
|
+
return $[28] !== as || $[29] !== children || $[30] !== ref || $[31] !== restProps || $[32] !== t0 || $[33] !== t1 || $[34] !== t2 || $[35] !== t3 || $[36] !== t4 || $[37] !== t5 || $[38] !== t6 || $[39] !== t7 || $[40] !== t8 ? (t9 = /* @__PURE__ */ jsx(StyledGrid, {
|
|
4140
|
+
"data-as": t0,
|
|
4141
|
+
"data-ui": "Grid",
|
|
4142
|
+
...restProps,
|
|
4143
|
+
$autoRows: t1,
|
|
4144
|
+
$autoCols: t2,
|
|
4145
|
+
$autoFlow: t3,
|
|
4146
|
+
$columns: t4,
|
|
4147
|
+
$gap: t5,
|
|
4148
|
+
$gapX: t6,
|
|
4149
|
+
$gapY: t7,
|
|
4150
|
+
$rows: t8,
|
|
4151
|
+
forwardedAs: as,
|
|
4152
|
+
ref,
|
|
4153
|
+
children
|
|
4154
|
+
}), $[28] = as, $[29] = children, $[30] = ref, $[31] = restProps, $[32] = t0, $[33] = t1, $[34] = t2, $[35] = t3, $[36] = t4, $[37] = t5, $[38] = t6, $[39] = t7, $[40] = t8, $[41] = t9) : t9 = $[41], t9;
|
|
4155
|
+
});
|
|
1311
4156
|
/**
|
|
1312
4157
|
* @internal
|
|
1313
4158
|
*/
|
|
@@ -1322,14 +4167,14 @@ function ToastLayer(props) {
|
|
|
1322
4167
|
paddingX,
|
|
1323
4168
|
paddingY,
|
|
1324
4169
|
gap,
|
|
1325
|
-
|
|
4170
|
+
gridTemplateColumns: 1,
|
|
1326
4171
|
style: t2,
|
|
1327
4172
|
children
|
|
1328
4173
|
}), $[2] = children, $[3] = gap, $[4] = padding, $[5] = paddingX, $[6] = paddingY, $[7] = t2, $[8] = t3) : t3 = $[8], t3;
|
|
1329
4174
|
}
|
|
1330
4175
|
const StyledLayer = styled(Grid).withConfig({
|
|
1331
4176
|
displayName: "StyledLayer",
|
|
1332
|
-
componentId: "sc-
|
|
4177
|
+
componentId: "sc-kxgg1x-0"
|
|
1333
4178
|
})`box-sizing:border-box;position:fixed;right:0;bottom:0;list-style:none;pointer-events:none;max-width:420px;width:100%;`;
|
|
1334
4179
|
let toastId = 0;
|
|
1335
4180
|
/** @internal */
|
|
@@ -1378,7 +4223,7 @@ function ToastProvider(props) {
|
|
|
1378
4223
|
children: /* @__PURE__ */ jsx(AnimatePresence, {
|
|
1379
4224
|
initial: !1,
|
|
1380
4225
|
mode: "popLayout",
|
|
1381
|
-
children: state.map(_temp$
|
|
4226
|
+
children: state.map(_temp$4)
|
|
1382
4227
|
})
|
|
1383
4228
|
})
|
|
1384
4229
|
}), $[2] = gap, $[3] = mounted, $[4] = padding, $[5] = paddingX, $[6] = paddingY, $[7] = state, $[8] = zOffset, $[9] = t3) : t3 = $[9];
|
|
@@ -1388,7 +4233,7 @@ function ToastProvider(props) {
|
|
|
1388
4233
|
children: [children, t3]
|
|
1389
4234
|
}), $[10] = children, $[11] = t3, $[12] = t4) : t4 = $[12], t4;
|
|
1390
4235
|
}
|
|
1391
|
-
function _temp$
|
|
4236
|
+
function _temp$4(t0) {
|
|
1392
4237
|
let { dismiss: dismiss_0, id: id_0, params: params_0, updatedAt } = t0;
|
|
1393
4238
|
return /* @__PURE__ */ jsx(Toast, {
|
|
1394
4239
|
closable: params_0.closable,
|
|
@@ -1452,26 +4297,26 @@ function _focusItemElement(el) {
|
|
|
1452
4297
|
* @internal
|
|
1453
4298
|
*/
|
|
1454
4299
|
const TreeContext = createGlobalScopedContext("@sanity/ui/context/tree", null), Tree = forwardRef(function Tree(props, forwardedRef) {
|
|
1455
|
-
let $ = c(
|
|
1456
|
-
$[0] === props ? (children = $[1],
|
|
1457
|
-
let
|
|
1458
|
-
$[
|
|
4300
|
+
let $ = c(37), children, onFocus, restProps, t0;
|
|
4301
|
+
$[0] === props ? (children = $[1], onFocus = $[2], restProps = $[3], t0 = $[4]) : ({children, gap: t0, onFocus, ...restProps} = props, $[0] = props, $[1] = children, $[2] = onFocus, $[3] = restProps, $[4] = t0);
|
|
4302
|
+
let gap = t0 === void 0 ? 1 : t0, ref = useRef(null), [focusedElement, setFocusedElement] = useState(null), focusedElementRef = useRef(focusedElement), t1;
|
|
4303
|
+
$[5] === Symbol.for("react.memo_cache_sentinel") ? (t1 = [], $[5] = t1) : t1 = $[5];
|
|
1459
4304
|
let path = t1, t2;
|
|
1460
|
-
$[
|
|
4305
|
+
$[6] === Symbol.for("react.memo_cache_sentinel") ? (t2 = [], $[6] = t2) : t2 = $[6];
|
|
1461
4306
|
let [itemElements, setItemElements] = useState(t2), t3;
|
|
1462
|
-
$[
|
|
4307
|
+
$[7] === Symbol.for("react.memo_cache_sentinel") ? (t3 = {}, $[7] = t3) : t3 = $[7];
|
|
1463
4308
|
let [state, setState] = useState(t3), stateRef = useRef(state), t4;
|
|
1464
|
-
$[
|
|
4309
|
+
$[8] === Symbol.for("react.memo_cache_sentinel") ? (t4 = () => ref.current, $[8] = t4) : t4 = $[8], useImperativeHandle(forwardedRef, t4);
|
|
1465
4310
|
let t5, t6;
|
|
1466
|
-
$[
|
|
4311
|
+
$[9] === focusedElement ? (t5 = $[10], t6 = $[11]) : (t5 = () => {
|
|
1467
4312
|
focusedElementRef.current = focusedElement;
|
|
1468
|
-
}, t6 = [focusedElement], $[
|
|
4313
|
+
}, t6 = [focusedElement], $[9] = focusedElement, $[10] = t5, $[11] = t6), useEffect(t5, t6);
|
|
1469
4314
|
let t7, t8;
|
|
1470
|
-
$[
|
|
4315
|
+
$[12] === state ? (t7 = $[13], t8 = $[14]) : (t7 = () => {
|
|
1471
4316
|
stateRef.current = state;
|
|
1472
|
-
}, t8 = [state], $[
|
|
4317
|
+
}, t8 = [state], $[12] = state, $[13] = t7, $[14] = t8), useEffect(t7, t8);
|
|
1473
4318
|
let t9;
|
|
1474
|
-
$[
|
|
4319
|
+
$[15] === Symbol.for("react.memo_cache_sentinel") ? (t9 = (element, path_0, expanded, selected) => (setState((s) => ({
|
|
1475
4320
|
...s,
|
|
1476
4321
|
[path_0]: {
|
|
1477
4322
|
element,
|
|
@@ -1482,9 +4327,9 @@ const TreeContext = createGlobalScopedContext("@sanity/ui/context/tree", null),
|
|
|
1482
4327
|
let newState = { ...s_0 };
|
|
1483
4328
|
return delete newState[path_0], newState;
|
|
1484
4329
|
});
|
|
1485
|
-
}), $[
|
|
4330
|
+
}), $[15] = t9) : t9 = $[15];
|
|
1486
4331
|
let registerItem = t9, t10;
|
|
1487
|
-
$[
|
|
4332
|
+
$[16] === Symbol.for("react.memo_cache_sentinel") ? (t10 = (path_1, expanded_0) => {
|
|
1488
4333
|
setState((s_1) => {
|
|
1489
4334
|
let itemState = s_1[path_1];
|
|
1490
4335
|
return itemState ? {
|
|
@@ -1495,9 +4340,9 @@ const TreeContext = createGlobalScopedContext("@sanity/ui/context/tree", null),
|
|
|
1495
4340
|
}
|
|
1496
4341
|
} : s_1;
|
|
1497
4342
|
});
|
|
1498
|
-
}, $[
|
|
4343
|
+
}, $[16] = t10) : t10 = $[16];
|
|
1499
4344
|
let setExpanded = t10, t11 = focusedElement || itemElements[0] || null, t12;
|
|
1500
|
-
$[
|
|
4345
|
+
$[17] !== gap || $[18] !== state || $[19] !== t11 ? (t12 = {
|
|
1501
4346
|
version: 0,
|
|
1502
4347
|
focusedElement: t11,
|
|
1503
4348
|
level: 0,
|
|
@@ -1505,12 +4350,11 @@ const TreeContext = createGlobalScopedContext("@sanity/ui/context/tree", null),
|
|
|
1505
4350
|
registerItem,
|
|
1506
4351
|
setExpanded,
|
|
1507
4352
|
setFocusedElement,
|
|
1508
|
-
gap
|
|
1509
|
-
space: spacing,
|
|
4353
|
+
gap,
|
|
1510
4354
|
state
|
|
1511
|
-
}, $[
|
|
4355
|
+
}, $[17] = gap, $[18] = state, $[19] = t11, $[20] = t12) : t12 = $[20];
|
|
1512
4356
|
let contextValue = t12, t13;
|
|
1513
|
-
$[
|
|
4357
|
+
$[21] === itemElements ? t13 = $[22] : (t13 = (event) => {
|
|
1514
4358
|
if (focusedElementRef.current) {
|
|
1515
4359
|
if (event.key === "ArrowDown") {
|
|
1516
4360
|
event.preventDefault();
|
|
@@ -1565,21 +4409,21 @@ const TreeContext = createGlobalScopedContext("@sanity/ui/context/tree", null),
|
|
|
1565
4409
|
return;
|
|
1566
4410
|
}
|
|
1567
4411
|
}
|
|
1568
|
-
}, $[
|
|
4412
|
+
}, $[21] = itemElements, $[22] = t13);
|
|
1569
4413
|
let handleKeyDown = t13, t14;
|
|
1570
|
-
$[
|
|
4414
|
+
$[23] === onFocus ? t14 = $[24] : (t14 = (event_0) => {
|
|
1571
4415
|
setFocusedElement(event_0.target), onFocus?.(event_0);
|
|
1572
|
-
}, $[
|
|
4416
|
+
}, $[23] = onFocus, $[24] = t14);
|
|
1573
4417
|
let handleFocus = t14, t15;
|
|
1574
|
-
$[
|
|
4418
|
+
$[25] === Symbol.for("react.memo_cache_sentinel") ? (t15 = () => {
|
|
1575
4419
|
if (!ref.current) return;
|
|
1576
4420
|
let _itemElements = Array.from(ref.current.querySelectorAll("[data-ui=\"TreeItem\"]"));
|
|
1577
4421
|
setItemElements(_itemElements);
|
|
1578
|
-
}, $[
|
|
4422
|
+
}, $[25] = t15) : t15 = $[25];
|
|
1579
4423
|
let t16;
|
|
1580
|
-
$[
|
|
4424
|
+
$[26] === children ? t16 = $[27] : (t16 = [children], $[26] = children, $[27] = t16), useEffect(t15, t16);
|
|
1581
4425
|
let t17;
|
|
1582
|
-
$[
|
|
4426
|
+
$[28] !== children || $[29] !== gap || $[30] !== handleFocus || $[31] !== handleKeyDown || $[32] !== restProps ? (t17 = /* @__PURE__ */ jsx(Stack, {
|
|
1583
4427
|
as: "ul",
|
|
1584
4428
|
"data-ui": "Tree",
|
|
1585
4429
|
...restProps,
|
|
@@ -1587,14 +4431,14 @@ const TreeContext = createGlobalScopedContext("@sanity/ui/context/tree", null),
|
|
|
1587
4431
|
onKeyDown: handleKeyDown,
|
|
1588
4432
|
ref,
|
|
1589
4433
|
role: "tree",
|
|
1590
|
-
gap
|
|
4434
|
+
gap,
|
|
1591
4435
|
children
|
|
1592
|
-
}), $[
|
|
4436
|
+
}), $[28] = children, $[29] = gap, $[30] = handleFocus, $[31] = handleKeyDown, $[32] = restProps, $[33] = t17) : t17 = $[33];
|
|
1593
4437
|
let t18;
|
|
1594
|
-
return $[
|
|
4438
|
+
return $[34] !== contextValue || $[35] !== t17 ? (t18 = /* @__PURE__ */ jsx(TreeContext.Provider, {
|
|
1595
4439
|
value: contextValue,
|
|
1596
4440
|
children: t17
|
|
1597
|
-
}), $[
|
|
4441
|
+
}), $[34] = contextValue, $[35] = t17, $[36] = t18) : t18 = $[36], t18;
|
|
1598
4442
|
});
|
|
1599
4443
|
function treeItemRootStyle() {
|
|
1600
4444
|
return css`&[role='none'] > [role='treeitem']{outline:none;cursor:default;border-radius:3px;background-color:var(--card-bg-color);color:var(--treeitem-fg-color);&:focus{position:relative;}}&[role='treeitem']{outline:none;& > div{cursor:default;border-radius:3px;background-color:var(--card-bg-color);color:var(--treeitem-fg-color);}&:focus > div{position:relative;}}`;
|
|
@@ -1632,50 +4476,50 @@ function TreeGroup(props) {
|
|
|
1632
4476
|
}
|
|
1633
4477
|
const StyledTreeItem = /* @__PURE__ */ styled.li.withConfig({
|
|
1634
4478
|
displayName: "StyledTreeItem",
|
|
1635
|
-
componentId: "sc-
|
|
4479
|
+
componentId: "sc-d4xra6-0"
|
|
1636
4480
|
})(treeItemRootStyle, treeItemRootColorStyle), TreeItemBox = /* @__PURE__ */ styled.a.withConfig({
|
|
1637
4481
|
displayName: "TreeItemBox",
|
|
1638
|
-
componentId: "sc-
|
|
4482
|
+
componentId: "sc-d4xra6-1"
|
|
1639
4483
|
})(treeItemBoxStyle), ToggleArrowText = styled(Text).withConfig({
|
|
1640
4484
|
displayName: "ToggleArrowText",
|
|
1641
|
-
componentId: "sc-
|
|
4485
|
+
componentId: "sc-d4xra6-2"
|
|
1642
4486
|
})`& > svg{transition:transform 100ms;}`;
|
|
1643
4487
|
/**
|
|
1644
4488
|
* This API might change. DO NOT USE IN PRODUCTION.
|
|
1645
4489
|
* @beta
|
|
1646
4490
|
*/
|
|
1647
4491
|
function TreeItem(props) {
|
|
1648
|
-
let $ = c(
|
|
1649
|
-
$[0] === props ? (IconComponent = $[1], children = $[2],
|
|
1650
|
-
let expandedProp = t0 !== void 0 && t0, fontSize = t1 === void 0 ? 1 : t1, padding = t2 === void 0 ? 2 : t2, selected = t3 !== void 0 && t3,
|
|
1651
|
-
$[
|
|
4492
|
+
let $ = c(116), IconComponent, children, href, idProp, linkAs, linkProps, muted, onClick, restProps, t0, t1, t2, t3, t4, text, weight;
|
|
4493
|
+
$[0] === props ? (IconComponent = $[1], children = $[2], href = $[3], idProp = $[4], linkAs = $[5], linkProps = $[6], muted = $[7], onClick = $[8], restProps = $[9], t0 = $[10], t1 = $[11], t2 = $[12], t3 = $[13], t4 = $[14], text = $[15], weight = $[16]) : ({children, expanded: t0, fontSize: t1, href, icon: IconComponent, id: idProp, linkAs, linkProps, muted, onClick, padding: t2, selected: t3, gap: t4, text, weight, ...restProps} = props, $[0] = props, $[1] = IconComponent, $[2] = children, $[3] = href, $[4] = idProp, $[5] = linkAs, $[6] = linkProps, $[7] = muted, $[8] = onClick, $[9] = restProps, $[10] = t0, $[11] = t1, $[12] = t2, $[13] = t3, $[14] = t4, $[15] = text, $[16] = weight);
|
|
4494
|
+
let expandedProp = t0 !== void 0 && t0, fontSize = t1 === void 0 ? 1 : t1, padding = t2 === void 0 ? 2 : t2, selected = t3 !== void 0 && t3, gap = t4 === void 0 ? 2 : t4, [rootElement, _setRootElement] = useState(null), t5;
|
|
4495
|
+
$[17] === Symbol.for("react.memo_cache_sentinel") ? (t5 = (node) => {
|
|
1652
4496
|
startTransition(() => _setRootElement(node));
|
|
1653
|
-
}, $[
|
|
4497
|
+
}, $[17] = t5) : t5 = $[17];
|
|
1654
4498
|
let setRootElement = t5, treeitemRef = useRef(null), tree = useTree(), { path, registerItem, setExpanded, setFocusedElement } = tree, _id = useId(), id = idProp || _id, t6, t7;
|
|
1655
|
-
if ($[
|
|
4499
|
+
if ($[18] !== id || $[19] !== path) {
|
|
1656
4500
|
let itemPath = path.concat([id || ""]);
|
|
1657
|
-
t6 = itemPath, t7 = itemPath.join("/"), $[
|
|
1658
|
-
} else t6 = $[
|
|
4501
|
+
t6 = itemPath, t7 = itemPath.join("/"), $[18] = id, $[19] = path, $[20] = t6, $[21] = t7;
|
|
4502
|
+
} else t6 = $[20], t7 = $[21];
|
|
1659
4503
|
let t8;
|
|
1660
|
-
$[
|
|
4504
|
+
$[22] !== t6 || $[23] !== t7 ? (t8 = [t6, t7], $[22] = t6, $[23] = t7, $[24] = t8) : t8 = $[24];
|
|
1661
4505
|
let [itemPath_0, itemKey] = t8, itemState = tree.state[itemKey], focused = tree.focusedElement === rootElement, expanded = itemState?.expanded === void 0 ? expandedProp : itemState?.expanded || !1, tabIndex = tree.focusedElement && tree.focusedElement === rootElement ? 0 : -1, t9 = tree.level + 1, t10;
|
|
1662
|
-
$[
|
|
4506
|
+
$[25] !== itemPath_0 || $[26] !== t9 || $[27] !== tree ? (t10 = {
|
|
1663
4507
|
...tree,
|
|
1664
4508
|
level: t9,
|
|
1665
4509
|
path: itemPath_0
|
|
1666
|
-
}, $[
|
|
4510
|
+
}, $[25] = itemPath_0, $[26] = t9, $[27] = tree, $[28] = t10) : t10 = $[28];
|
|
1667
4511
|
let contextValue = t10, t11;
|
|
1668
|
-
$[
|
|
4512
|
+
$[29] !== expanded || $[30] !== itemKey || $[31] !== onClick || $[32] !== rootElement || $[33] !== setExpanded || $[34] !== setFocusedElement ? (t11 = (event) => {
|
|
1669
4513
|
onClick && onClick(event);
|
|
1670
4514
|
let target = event.target;
|
|
1671
4515
|
target instanceof HTMLElement && (target.getAttribute("data-ui") === "TreeItem" || target.closest("[data-ui=\"TreeItem__box\"]")) && (event.stopPropagation(), setExpanded(itemKey, !expanded), setFocusedElement(rootElement));
|
|
1672
|
-
}, $[
|
|
4516
|
+
}, $[29] = expanded, $[30] = itemKey, $[31] = onClick, $[32] = rootElement, $[33] = setExpanded, $[34] = setFocusedElement, $[35] = t11) : t11 = $[35];
|
|
1673
4517
|
let handleClick = t11, t12;
|
|
1674
|
-
$[
|
|
4518
|
+
$[36] !== focused || $[37] !== rootElement ? (t12 = (event_0) => {
|
|
1675
4519
|
focused && event_0.key === "Enter" && (treeitemRef.current || rootElement)?.click();
|
|
1676
|
-
}, $[
|
|
4520
|
+
}, $[36] = focused, $[37] = rootElement, $[38] = t12) : t12 = $[38];
|
|
1677
4521
|
let handleKeyDown = t12, t13, t14;
|
|
1678
|
-
$[
|
|
4522
|
+
$[39] !== expanded || $[40] !== itemKey || $[41] !== registerItem || $[42] !== rootElement || $[43] !== selected ? (t13 = () => {
|
|
1679
4523
|
if (rootElement) return registerItem(rootElement, itemKey, expanded, selected);
|
|
1680
4524
|
}, t14 = [
|
|
1681
4525
|
expanded,
|
|
@@ -1683,34 +4527,34 @@ function TreeItem(props) {
|
|
|
1683
4527
|
registerItem,
|
|
1684
4528
|
rootElement,
|
|
1685
4529
|
selected
|
|
1686
|
-
], $[
|
|
4530
|
+
], $[39] = expanded, $[40] = itemKey, $[41] = registerItem, $[42] = rootElement, $[43] = selected, $[44] = t13, $[45] = t14) : (t13 = $[44], t14 = $[45]), useEffect(t13, t14);
|
|
1687
4531
|
let t15 = IconComponent || children ? "visible" : "hidden", t16;
|
|
1688
|
-
$[
|
|
4532
|
+
$[46] === t15 ? t16 = $[47] : (t16 = {
|
|
1689
4533
|
visibility: t15,
|
|
1690
4534
|
pointerEvents: "none"
|
|
1691
|
-
}, $[
|
|
4535
|
+
}, $[46] = t15, $[47] = t16);
|
|
1692
4536
|
let t17;
|
|
1693
|
-
$[
|
|
4537
|
+
$[48] !== IconComponent || $[49] !== fontSize || $[50] !== muted || $[51] !== weight ? (t17 = IconComponent && /* @__PURE__ */ jsx(Text, {
|
|
1694
4538
|
muted,
|
|
1695
4539
|
size: fontSize,
|
|
1696
4540
|
weight,
|
|
1697
4541
|
children: /* @__PURE__ */ jsx(IconComponent, {})
|
|
1698
|
-
}), $[
|
|
4542
|
+
}), $[48] = IconComponent, $[49] = fontSize, $[50] = muted, $[51] = weight, $[52] = t17) : t17 = $[52];
|
|
1699
4543
|
let t18;
|
|
1700
|
-
$[
|
|
4544
|
+
$[53] !== IconComponent || $[54] !== expanded || $[55] !== fontSize || $[56] !== muted || $[57] !== weight ? (t18 = !IconComponent && /* @__PURE__ */ jsx(ToggleArrowText, {
|
|
1701
4545
|
muted,
|
|
1702
4546
|
size: fontSize,
|
|
1703
4547
|
weight,
|
|
1704
4548
|
children: /* @__PURE__ */ jsx(ToggleArrowRightIcon, { style: { transform: expanded ? "rotate(90deg)" : void 0 } })
|
|
1705
|
-
}), $[
|
|
4549
|
+
}), $[53] = IconComponent, $[54] = expanded, $[55] = fontSize, $[56] = muted, $[57] = weight, $[58] = t18) : t18 = $[58];
|
|
1706
4550
|
let t19;
|
|
1707
|
-
$[
|
|
1708
|
-
marginRight:
|
|
4551
|
+
$[59] !== gap || $[60] !== t16 || $[61] !== t17 || $[62] !== t18 ? (t19 = /* @__PURE__ */ jsxs(Box, {
|
|
4552
|
+
marginRight: gap,
|
|
1709
4553
|
style: t16,
|
|
1710
4554
|
children: [t17, t18]
|
|
1711
|
-
}), $[
|
|
4555
|
+
}), $[59] = gap, $[60] = t16, $[61] = t17, $[62] = t18, $[63] = t19) : t19 = $[63];
|
|
1712
4556
|
let t20;
|
|
1713
|
-
$[
|
|
4557
|
+
$[64] !== fontSize || $[65] !== muted || $[66] !== text || $[67] !== weight ? (t20 = /* @__PURE__ */ jsx(Box, {
|
|
1714
4558
|
flex: 1,
|
|
1715
4559
|
children: /* @__PURE__ */ jsx(Text, {
|
|
1716
4560
|
muted,
|
|
@@ -1719,16 +4563,16 @@ function TreeItem(props) {
|
|
|
1719
4563
|
weight,
|
|
1720
4564
|
children: text
|
|
1721
4565
|
})
|
|
1722
|
-
}), $[
|
|
4566
|
+
}), $[64] = fontSize, $[65] = muted, $[66] = text, $[67] = weight, $[68] = t20) : t20 = $[68];
|
|
1723
4567
|
let t21;
|
|
1724
|
-
$[
|
|
4568
|
+
$[69] !== padding || $[70] !== t19 || $[71] !== t20 ? (t21 = /* @__PURE__ */ jsxs(Flex, {
|
|
1725
4569
|
padding,
|
|
1726
4570
|
children: [t19, t20]
|
|
1727
|
-
}), $[
|
|
4571
|
+
}), $[69] = padding, $[70] = t19, $[71] = t20, $[72] = t21) : t21 = $[72];
|
|
1728
4572
|
let content = t21;
|
|
1729
4573
|
if (href) {
|
|
1730
4574
|
let t22 = selected ? "" : void 0, t23 = typeof linkAs == "string" ? linkAs : "a", t24;
|
|
1731
|
-
$[
|
|
4575
|
+
$[73] !== content || $[74] !== expanded || $[75] !== href || $[76] !== linkAs || $[77] !== linkProps || $[78] !== t23 || $[79] !== tabIndex || $[80] !== tree.level ? (t24 = /* @__PURE__ */ jsx(TreeItemBox, {
|
|
1732
4576
|
...linkProps,
|
|
1733
4577
|
$level: tree.level,
|
|
1734
4578
|
"aria-expanded": expanded,
|
|
@@ -1740,19 +4584,19 @@ function TreeItem(props) {
|
|
|
1740
4584
|
role: "treeitem",
|
|
1741
4585
|
tabIndex,
|
|
1742
4586
|
children: content
|
|
1743
|
-
}), $[
|
|
4587
|
+
}), $[73] = content, $[74] = expanded, $[75] = href, $[76] = linkAs, $[77] = linkProps, $[78] = t23, $[79] = tabIndex, $[80] = tree.level, $[81] = t24) : t24 = $[81];
|
|
1744
4588
|
let t25;
|
|
1745
|
-
$[
|
|
4589
|
+
$[82] !== children || $[83] !== expanded ? (t25 = children && /* @__PURE__ */ jsx(TreeGroup, {
|
|
1746
4590
|
hidden: !expanded,
|
|
1747
4591
|
children
|
|
1748
|
-
}), $[
|
|
4592
|
+
}), $[82] = children, $[83] = expanded, $[84] = t25) : t25 = $[84];
|
|
1749
4593
|
let t26;
|
|
1750
|
-
$[
|
|
4594
|
+
$[85] !== contextValue || $[86] !== t25 ? (t26 = /* @__PURE__ */ jsx(TreeContext.Provider, {
|
|
1751
4595
|
value: contextValue,
|
|
1752
4596
|
children: t25
|
|
1753
|
-
}), $[
|
|
4597
|
+
}), $[85] = contextValue, $[86] = t25, $[87] = t26) : t26 = $[87];
|
|
1754
4598
|
let t27;
|
|
1755
|
-
return $[
|
|
4599
|
+
return $[88] !== handleClick || $[89] !== id || $[90] !== itemKey || $[91] !== restProps || $[92] !== t22 || $[93] !== t24 || $[94] !== t26 ? (t27 = /* @__PURE__ */ jsxs(StyledTreeItem, {
|
|
1756
4600
|
"data-selected": t22,
|
|
1757
4601
|
"data-tree-id": id,
|
|
1758
4602
|
"data-tree-key": itemKey,
|
|
@@ -1762,27 +4606,27 @@ function TreeItem(props) {
|
|
|
1762
4606
|
ref: setRootElement,
|
|
1763
4607
|
role: "none",
|
|
1764
4608
|
children: [t24, t26]
|
|
1765
|
-
}), $[
|
|
4609
|
+
}), $[88] = handleClick, $[89] = id, $[90] = itemKey, $[91] = restProps, $[92] = t22, $[93] = t24, $[94] = t26, $[95] = t27) : t27 = $[95], t27;
|
|
1766
4610
|
}
|
|
1767
4611
|
let t22 = selected ? "" : void 0, t23;
|
|
1768
|
-
$[
|
|
4612
|
+
$[96] !== content || $[97] !== tree.level ? (t23 = /* @__PURE__ */ jsx(TreeItemBox, {
|
|
1769
4613
|
$level: tree.level,
|
|
1770
4614
|
as: "div",
|
|
1771
4615
|
"data-ui": "TreeItem__box",
|
|
1772
4616
|
children: content
|
|
1773
|
-
}), $[
|
|
4617
|
+
}), $[96] = content, $[97] = tree.level, $[98] = t23) : t23 = $[98];
|
|
1774
4618
|
let t24;
|
|
1775
|
-
$[
|
|
4619
|
+
$[99] !== children || $[100] !== expanded ? (t24 = children && /* @__PURE__ */ jsx(TreeGroup, {
|
|
1776
4620
|
expanded,
|
|
1777
4621
|
children
|
|
1778
|
-
}), $[
|
|
4622
|
+
}), $[99] = children, $[100] = expanded, $[101] = t24) : t24 = $[101];
|
|
1779
4623
|
let t25;
|
|
1780
|
-
$[
|
|
4624
|
+
$[102] !== contextValue || $[103] !== t24 ? (t25 = /* @__PURE__ */ jsx(TreeContext.Provider, {
|
|
1781
4625
|
value: contextValue,
|
|
1782
4626
|
children: t24
|
|
1783
|
-
}), $[
|
|
4627
|
+
}), $[102] = contextValue, $[103] = t24, $[104] = t25) : t25 = $[104];
|
|
1784
4628
|
let t26;
|
|
1785
|
-
return $[
|
|
4629
|
+
return $[105] !== expanded || $[106] !== handleClick || $[107] !== handleKeyDown || $[108] !== id || $[109] !== itemKey || $[110] !== restProps || $[111] !== t22 || $[112] !== t23 || $[113] !== t25 || $[114] !== tabIndex ? (t26 = /* @__PURE__ */ jsxs(StyledTreeItem, {
|
|
1786
4630
|
"data-selected": t22,
|
|
1787
4631
|
"data-ui": "TreeItem",
|
|
1788
4632
|
"data-tree-id": id,
|
|
@@ -1795,7 +4639,7 @@ function TreeItem(props) {
|
|
|
1795
4639
|
role: "treeitem",
|
|
1796
4640
|
tabIndex,
|
|
1797
4641
|
children: [t23, t25]
|
|
1798
|
-
}), $[
|
|
4642
|
+
}), $[105] = expanded, $[106] = handleClick, $[107] = handleKeyDown, $[108] = id, $[109] = itemKey, $[110] = restProps, $[111] = t22, $[112] = t23, $[113] = t25, $[114] = tabIndex, $[115] = t26) : t26 = $[115], t26;
|
|
1799
4643
|
}
|
|
1800
4644
|
/**
|
|
1801
4645
|
* @internal
|
|
@@ -1809,14 +4653,8 @@ function _isScrollable(el) {
|
|
|
1809
4653
|
* @deprecated instead of `useArrayProp(width)` use `Array.isArray(width) ? width : [width]` instead
|
|
1810
4654
|
* @beta
|
|
1811
4655
|
*/
|
|
1812
|
-
function useArrayProp(
|
|
1813
|
-
|
|
1814
|
-
return $[0] !== defaultVal || $[1] !== val ? (t0 = _getArrayProp(val, defaultVal), $[0] = defaultVal, $[1] = val, $[2] = t0) : t0 = $[2], t0;
|
|
1815
|
-
}
|
|
1816
|
-
function _getElements(element, elementsArg) {
|
|
1817
|
-
let ret = [element];
|
|
1818
|
-
for (let el of elementsArg) Array.isArray(el) ? ret.push(...el) : ret.push(el);
|
|
1819
|
-
return ret.filter(Boolean);
|
|
4656
|
+
function useArrayProp(_val, _defaultVal) {
|
|
4657
|
+
throw Error("`useArrayProp` was removed in @sanity/ui v4. Use `Array.isArray(value) ? value : [value]` instead.");
|
|
1820
4658
|
}
|
|
1821
4659
|
/**
|
|
1822
4660
|
* @public
|
|
@@ -1833,43 +4671,8 @@ function _getElements(element, elementsArg) {
|
|
|
1833
4671
|
* return <button ref={buttonRef} />
|
|
1834
4672
|
* ```
|
|
1835
4673
|
*/
|
|
1836
|
-
function useClickOutside(
|
|
1837
|
-
|
|
1838
|
-
$[0] !== element || $[1] !== elementsArg ? (t1 = () => _getElements(element, elementsArg), $[0] = element, $[1] = elementsArg, $[2] = t1) : t1 = $[2];
|
|
1839
|
-
let [elements, setElements] = useState(t1), elementsRef = useRef(elements), t2, t3;
|
|
1840
|
-
$[3] !== element || $[4] !== elementsArg ? (t2 = () => {
|
|
1841
|
-
let prevElements = elementsRef.current, nextElements = _getElements(element, elementsArg);
|
|
1842
|
-
if (prevElements.length !== nextElements.length) {
|
|
1843
|
-
setElements(nextElements), elementsRef.current = nextElements;
|
|
1844
|
-
return;
|
|
1845
|
-
}
|
|
1846
|
-
for (let el of prevElements) if (!nextElements.includes(el)) {
|
|
1847
|
-
setElements(nextElements), elementsRef.current = nextElements;
|
|
1848
|
-
return;
|
|
1849
|
-
}
|
|
1850
|
-
for (let el_0 of nextElements) if (!prevElements.includes(el_0)) {
|
|
1851
|
-
setElements(nextElements), elementsRef.current = nextElements;
|
|
1852
|
-
return;
|
|
1853
|
-
}
|
|
1854
|
-
}, t3 = [element, elementsArg], $[3] = element, $[4] = elementsArg, $[5] = t2, $[6] = t3) : (t2 = $[5], t3 = $[6]), useEffect(t2, t3);
|
|
1855
|
-
let t4, t5;
|
|
1856
|
-
return $[7] !== boundaryElement || $[8] !== elements || $[9] !== listener ? (t4 = () => {
|
|
1857
|
-
if (!listener) return;
|
|
1858
|
-
let handleWindowMouseDown = (evt) => {
|
|
1859
|
-
let target = evt.target;
|
|
1860
|
-
if (target instanceof Node && !(boundaryElement && !boundaryElement.contains(target))) {
|
|
1861
|
-
for (let el_1 of elements) if (target === el_1 || el_1.contains(target)) return;
|
|
1862
|
-
listener(evt);
|
|
1863
|
-
}
|
|
1864
|
-
};
|
|
1865
|
-
return window.addEventListener("mousedown", handleWindowMouseDown), () => {
|
|
1866
|
-
window.removeEventListener("mousedown", handleWindowMouseDown);
|
|
1867
|
-
};
|
|
1868
|
-
}, t5 = [
|
|
1869
|
-
boundaryElement,
|
|
1870
|
-
listener,
|
|
1871
|
-
elements
|
|
1872
|
-
], $[7] = boundaryElement, $[8] = elements, $[9] = listener, $[10] = t4, $[11] = t5) : (t4 = $[10], t5 = $[11]), useEffect(t4, t5), setElement;
|
|
4674
|
+
function useClickOutside(_listener, _elementsArg, _boundaryElement) {
|
|
4675
|
+
throw Error("`useClickOutside` was removed in @sanity/ui v4. Use `useClickOutsideEvent` instead.");
|
|
1873
4676
|
}
|
|
1874
4677
|
/**
|
|
1875
4678
|
* Subscribe to the rect of a DOM element.
|
|
@@ -1877,8 +4680,8 @@ function useClickOutside(listener, t0, boundaryElement) {
|
|
|
1877
4680
|
*
|
|
1878
4681
|
* @deprecated Use `useElementSize` instead
|
|
1879
4682
|
*/
|
|
1880
|
-
function useElementRect(
|
|
1881
|
-
|
|
4683
|
+
function useElementRect(_element) {
|
|
4684
|
+
throw Error("`useElementRect` was removed in @sanity/ui v4. Use `useElementSize` instead.");
|
|
1882
4685
|
}
|
|
1883
4686
|
/**
|
|
1884
4687
|
* @beta
|
|
@@ -1890,9 +4693,25 @@ function useElementRect(element) {
|
|
|
1890
4693
|
* +useImperativeHandle(forwardedRef, () => ref.current)
|
|
1891
4694
|
* ```
|
|
1892
4695
|
*/
|
|
1893
|
-
function useForwardedRef(
|
|
1894
|
-
|
|
1895
|
-
|
|
4696
|
+
function useForwardedRef(_ref) {
|
|
4697
|
+
throw Error("`useForwardedRef` was removed in @sanity/ui v4. Use `useRef` and `useImperativeHandle` instead.");
|
|
4698
|
+
}
|
|
4699
|
+
/**
|
|
4700
|
+
* Returns true if a dark color scheme is preferred, false if a light color scheme is preferred or the preference is not known.
|
|
4701
|
+
*
|
|
4702
|
+
* @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)
|
|
4703
|
+
*
|
|
4704
|
+
* If you persist the detected preference in a cookie or a header then you may implement your own server snapshot to read it.
|
|
4705
|
+
* 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
|
|
4706
|
+
* @example https://gist.github.com/stipsan/13c0cccf8dfc34f4b44bb1b984baf7df
|
|
4707
|
+
*
|
|
4708
|
+
* @public
|
|
4709
|
+
*/
|
|
4710
|
+
function usePrefersDark(t0) {
|
|
4711
|
+
return useMatchMedia("(prefers-color-scheme: dark)", t0 === void 0 ? _temp$3 : t0);
|
|
4712
|
+
}
|
|
4713
|
+
function _temp$3() {
|
|
4714
|
+
return !1;
|
|
1896
4715
|
}
|
|
1897
4716
|
/**
|
|
1898
4717
|
* Get responsive CSS for the `label` font style.
|
|
@@ -1907,7 +4726,7 @@ function labelBaseStyle(props) {
|
|
|
1907
4726
|
}
|
|
1908
4727
|
const StyledLabel = /* @__PURE__ */ styled.div.withConfig({
|
|
1909
4728
|
displayName: "StyledLabel",
|
|
1910
|
-
componentId: "sc-
|
|
4729
|
+
componentId: "sc-nnzm3g-0"
|
|
1911
4730
|
})(responsiveLabelFont, responsiveTextAlignStyle, labelBaseStyle), Label = forwardRef(function Label(props, ref) {
|
|
1912
4731
|
let $ = c(26), accent, align, childrenProp, restProps, t0, t1, textOverflow, weight;
|
|
1913
4732
|
$[0] === props ? (accent = $[1], align = $[2], childrenProp = $[3], restProps = $[4], t0 = $[5], t1 = $[6], textOverflow = $[7], weight = $[8]) : ({accent, align, children: childrenProp, muted: t0, size: t1, textOverflow, weight, ...restProps} = props, $[0] = props, $[1] = accent, $[2] = align, $[3] = childrenProp, $[4] = restProps, $[5] = t0, $[6] = t1, $[7] = textOverflow, $[8] = weight);
|
|
@@ -2054,25 +4873,25 @@ function avatarStrokeStyle() {
|
|
|
2054
4873
|
}
|
|
2055
4874
|
const StyledAvatar = /* @__PURE__ */ styled.div.withConfig({
|
|
2056
4875
|
displayName: "StyledAvatar",
|
|
2057
|
-
componentId: "sc-
|
|
4876
|
+
componentId: "sc-bp4wqj-0"
|
|
2058
4877
|
})(responsiveAvatarSizeStyle, avatarStyle.root), Arrow$1 = /* @__PURE__ */ styled.div.withConfig({
|
|
2059
4878
|
displayName: "Arrow",
|
|
2060
|
-
componentId: "sc-
|
|
4879
|
+
componentId: "sc-bp4wqj-1"
|
|
2061
4880
|
})(avatarStyle.arrow), BgStroke = /* @__PURE__ */ styled.ellipse.withConfig({
|
|
2062
4881
|
displayName: "BgStroke",
|
|
2063
|
-
componentId: "sc-
|
|
4882
|
+
componentId: "sc-bp4wqj-2"
|
|
2064
4883
|
})(avatarStyle.bgStroke), Stroke = /* @__PURE__ */ styled.ellipse.withConfig({
|
|
2065
4884
|
displayName: "Stroke",
|
|
2066
|
-
componentId: "sc-
|
|
4885
|
+
componentId: "sc-bp4wqj-3"
|
|
2067
4886
|
})(avatarStyle.stroke), Initials = /* @__PURE__ */ styled.div.withConfig({
|
|
2068
4887
|
displayName: "Initials",
|
|
2069
|
-
componentId: "sc-
|
|
4888
|
+
componentId: "sc-bp4wqj-4"
|
|
2070
4889
|
})(avatarStyle.initials), InitialsLabel = /* @__PURE__ */ styled(Label).withConfig({
|
|
2071
4890
|
displayName: "InitialsLabel",
|
|
2072
|
-
componentId: "sc-
|
|
4891
|
+
componentId: "sc-bp4wqj-5"
|
|
2073
4892
|
})({ color: "inherit" }), AvatarImage = /* @__PURE__ */ styled.svg.withConfig({
|
|
2074
4893
|
displayName: "AvatarImage",
|
|
2075
|
-
componentId: "sc-
|
|
4894
|
+
componentId: "sc-bp4wqj-6"
|
|
2076
4895
|
})(avatarStyle.image), Avatar = forwardRef(function Avatar(props, ref) {
|
|
2077
4896
|
let $ = c(46), __unstable_hideInnerStroke, animateArrowFrom, arrowPositionProp, asProp, initials, onImageLoadError, restProps, src, t0, t1, t2, title;
|
|
2078
4897
|
$[0] === props ? (__unstable_hideInnerStroke = $[1], animateArrowFrom = $[2], arrowPositionProp = $[3], asProp = $[4], initials = $[5], onImageLoadError = $[6], restProps = $[7], src = $[8], t0 = $[9], t1 = $[10], t2 = $[11], title = $[12]) : ({__unstable_hideInnerStroke, as: asProp, color: t0, src, title, initials, onImageLoadError, arrowPosition: arrowPositionProp, animateArrowFrom, status: t1, size: t2, ...restProps} = props, $[0] = props, $[1] = __unstable_hideInnerStroke, $[2] = animateArrowFrom, $[3] = arrowPositionProp, $[4] = asProp, $[5] = initials, $[6] = onImageLoadError, $[7] = restProps, $[8] = src, $[9] = t0, $[10] = t1, $[11] = t2, $[12] = title);
|
|
@@ -2142,7 +4961,7 @@ const StyledAvatar = /* @__PURE__ */ styled.div.withConfig({
|
|
|
2142
4961
|
}), $[24] = __unstable_hideInnerStroke, $[25] = _radius, $[26] = _sizeRem, $[27] = handleImageError, $[28] = imageFailed, $[29] = imageId, $[30] = src, $[31] = t11) : t11 = $[31];
|
|
2143
4962
|
let t12 = (imageFailed || !src) && initials && /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx(Initials, { children: /* @__PURE__ */ jsx(InitialsLabel, {
|
|
2144
4963
|
forwardedAs: "span",
|
|
2145
|
-
size: size.map(_temp$
|
|
4964
|
+
size: size.map(_temp$2),
|
|
2146
4965
|
weight: "medium",
|
|
2147
4966
|
children: initials
|
|
2148
4967
|
}) }) }), t13;
|
|
@@ -2165,7 +4984,7 @@ const StyledAvatar = /* @__PURE__ */ styled.div.withConfig({
|
|
|
2165
4984
|
]
|
|
2166
4985
|
}), $[32] = T0, $[33] = arrowPosition, $[34] = as, $[35] = color, $[36] = ref, $[37] = restProps, $[38] = size, $[39] = status, $[40] = t10, $[41] = t11, $[42] = t12, $[43] = t8, $[44] = title, $[45] = t13) : t13 = $[45], t13;
|
|
2167
4986
|
});
|
|
2168
|
-
function _temp$
|
|
4987
|
+
function _temp$2(s) {
|
|
2169
4988
|
return s === 1 ? 1 : s === 2 ? 3 : s === 3 ? 5 : 0;
|
|
2170
4989
|
}
|
|
2171
4990
|
function _responsiveAvatarCounterSizeStyle(props) {
|
|
@@ -2185,12 +5004,12 @@ function _avatarCounterBaseStyle(props) {
|
|
|
2185
5004
|
}
|
|
2186
5005
|
const StyledAvatarCounter = /* @__PURE__ */ styled.div.withConfig({
|
|
2187
5006
|
displayName: "StyledAvatarCounter",
|
|
2188
|
-
componentId: "sc-
|
|
5007
|
+
componentId: "sc-c4rsl0-0"
|
|
2189
5008
|
})(_responsiveAvatarCounterSizeStyle, _avatarCounterBaseStyle), AvatarCounter = forwardRef(function AvatarCounter(props, ref) {
|
|
2190
5009
|
let $ = c(20), { count, size: t0 } = props, sizeProp = t0 === void 0 ? 1 : t0, T0, T1, t1, t2, t3, t4, t5;
|
|
2191
5010
|
if ($[0] !== ref || $[1] !== sizeProp) {
|
|
2192
5011
|
let size = _getArrayProp(sizeProp);
|
|
2193
|
-
T1 = StyledAvatarCounter, t3 = size, t4 = "AvatarCounter", t5 = ref, T0 = Label, t1 = "span", t2 = size.map(_temp), $[0] = ref, $[1] = sizeProp, $[2] = T0, $[3] = T1, $[4] = t1, $[5] = t2, $[6] = t3, $[7] = t4, $[8] = t5;
|
|
5012
|
+
T1 = StyledAvatarCounter, t3 = size, t4 = "AvatarCounter", t5 = ref, T0 = Label, t1 = "span", t2 = size.map(_temp$1), $[0] = ref, $[1] = sizeProp, $[2] = T0, $[3] = T1, $[4] = t1, $[5] = t2, $[6] = t3, $[7] = t4, $[8] = t5;
|
|
2194
5013
|
} else T0 = $[2], T1 = $[3], t1 = $[4], t2 = $[5], t3 = $[6], t4 = $[7], t5 = $[8];
|
|
2195
5014
|
let t6;
|
|
2196
5015
|
$[9] !== T0 || $[10] !== count || $[11] !== t1 || $[12] !== t2 ? (t6 = /* @__PURE__ */ jsx(T0, {
|
|
@@ -2207,7 +5026,7 @@ const StyledAvatarCounter = /* @__PURE__ */ styled.div.withConfig({
|
|
|
2207
5026
|
children: t6
|
|
2208
5027
|
}), $[14] = T1, $[15] = t3, $[16] = t4, $[17] = t5, $[18] = t6, $[19] = t7) : t7 = $[19], t7;
|
|
2209
5028
|
});
|
|
2210
|
-
function _temp(s) {
|
|
5029
|
+
function _temp$1(s) {
|
|
2211
5030
|
return s === 1 ? 1 : s === 2 ? 3 : s === 3 ? 5 : 0;
|
|
2212
5031
|
}
|
|
2213
5032
|
const BASE_STYLES = css`white-space:nowrap;& > div{vertical-align:top;&:not([hidden]){display:inline-block;}}`;
|
|
@@ -2223,7 +5042,7 @@ function responsiveAvatarStackSizeStyle(props) {
|
|
|
2223
5042
|
}
|
|
2224
5043
|
const StyledAvatarStack = /* @__PURE__ */ styled.div.withConfig({
|
|
2225
5044
|
displayName: "StyledAvatarStack",
|
|
2226
|
-
componentId: "sc-
|
|
5045
|
+
componentId: "sc-sjx1d1-0"
|
|
2227
5046
|
})(responsiveAvatarStackSizeStyle, avatarStackStyle), AvatarStack = forwardRef(function AvatarStack(props, ref) {
|
|
2228
5047
|
let $ = c(38), childrenProp, restProps, t0, t1;
|
|
2229
5048
|
$[0] === props ? (childrenProp = $[1], restProps = $[2], t0 = $[3], t1 = $[4]) : ({children: childrenProp, maxLength: t0, size: t1, ...restProps} = props, $[0] = props, $[1] = childrenProp, $[2] = restProps, $[3] = t0, $[4] = t1);
|
|
@@ -2270,13 +5089,10 @@ function badgeStyle(props) {
|
|
|
2270
5089
|
}
|
|
2271
5090
|
const StyledBadge = /* @__PURE__ */ styled(Box).withConfig({
|
|
2272
5091
|
displayName: "StyledBadge",
|
|
2273
|
-
componentId: "sc-
|
|
5092
|
+
componentId: "sc-fdsjw9-0"
|
|
2274
5093
|
})(responsiveRadiusStyle, badgeStyle), Badge = forwardRef(function Badge(props, ref) {
|
|
2275
5094
|
let $ = c(21), children, restProps, t0, t1, t2, t3;
|
|
2276
|
-
|
|
2277
|
-
let { children: t4, fontSize: t5, mode: _deprecated_mode, padding: t6, radius: t7, tone: t8, ...t9 } = props;
|
|
2278
|
-
children = t4, t0 = t5, t1 = t6, t2 = t7, t3 = t8, restProps = t9, $[0] = props, $[1] = children, $[2] = restProps, $[3] = t0, $[4] = t1, $[5] = t2, $[6] = t3;
|
|
2279
|
-
} else children = $[1], restProps = $[2], t0 = $[3], t1 = $[4], t2 = $[5], t3 = $[6];
|
|
5095
|
+
$[0] === props ? (children = $[1], restProps = $[2], t0 = $[3], t1 = $[4], t2 = $[5], t3 = $[6]) : ({children, fontSize: t0, padding: t1, radius: t2, tone: t3, ...restProps} = props, $[0] = props, $[1] = children, $[2] = restProps, $[3] = t0, $[4] = t1, $[5] = t2, $[6] = t3);
|
|
2280
5096
|
let fontSize = t0 === void 0 ? 1 : t0, padding = t1 === void 0 ? 1 : t1, radius = t2 === void 0 ? "full" : t2, tone = t3 === void 0 ? "default" : t3, t4;
|
|
2281
5097
|
$[7] === radius ? t4 = $[8] : (t4 = _getArrayProp(radius), $[7] = radius, $[8] = t4);
|
|
2282
5098
|
let t5;
|
|
@@ -2333,10 +5149,10 @@ function inputElementStyles(props) {
|
|
|
2333
5149
|
}
|
|
2334
5150
|
const StyledCheckbox = /* @__PURE__ */ styled.div.withConfig({
|
|
2335
5151
|
displayName: "StyledCheckbox",
|
|
2336
|
-
componentId: "sc-
|
|
5152
|
+
componentId: "sc-q89jhk-0"
|
|
2337
5153
|
})(checkboxBaseStyles), Input$4 = /* @__PURE__ */ styled.input.withConfig({
|
|
2338
5154
|
displayName: "Input",
|
|
2339
|
-
componentId: "sc-
|
|
5155
|
+
componentId: "sc-q89jhk-1"
|
|
2340
5156
|
})(inputElementStyles), Checkbox = forwardRef(function Checkbox(props, forwardedRef) {
|
|
2341
5157
|
let $ = c(25), checked, className, customValidity, disabled, indeterminate, readOnly, restProps, style;
|
|
2342
5158
|
$[0] === props ? (checked = $[1], className = $[2], customValidity = $[3], disabled = $[4], indeterminate = $[5], readOnly = $[6], restProps = $[7], style = $[8]) : ({checked, className, disabled, indeterminate, customValidity, readOnly, style, ...restProps} = props, $[0] = props, $[1] = checked, $[2] = className, $[3] = customValidity, $[4] = disabled, $[5] = indeterminate, $[6] = readOnly, $[7] = restProps, $[8] = style);
|
|
@@ -2420,7 +5236,7 @@ function codeBaseStyle() {
|
|
|
2420
5236
|
}
|
|
2421
5237
|
const LazyRefractor = lazy(() => import("./_chunks/refractor.js")), StyledCode = /* @__PURE__ */ styled.pre.withConfig({
|
|
2422
5238
|
displayName: "StyledCode",
|
|
2423
|
-
componentId: "sc-
|
|
5239
|
+
componentId: "sc-t18qc-0"
|
|
2424
5240
|
})(codeBaseStyle, responsiveCodeFontStyle), Code = forwardRef(function Code(props, ref) {
|
|
2425
5241
|
let $ = c(22), children, language, restProps, t0, weight;
|
|
2426
5242
|
$[0] === props ? (children = $[1], language = $[2], restProps = $[3], t0 = $[4], weight = $[5]) : ({children, language, size: t0, weight, ...restProps} = props, $[0] = props, $[1] = children, $[2] = language, $[3] = restProps, $[4] = t0, $[5] = weight);
|
|
@@ -2461,7 +5277,7 @@ function headingBaseStyle(props) {
|
|
|
2461
5277
|
}
|
|
2462
5278
|
const StyledHeading = /* @__PURE__ */ styled.div.withConfig({
|
|
2463
5279
|
displayName: "StyledHeading",
|
|
2464
|
-
componentId: "sc-
|
|
5280
|
+
componentId: "sc-0zk01j-0"
|
|
2465
5281
|
})(headingBaseStyle, responsiveTextAlignStyle, responsiveHeadingFont), Heading = forwardRef(function Heading(props, ref) {
|
|
2466
5282
|
let $ = c(26), align, childrenProp, restProps, t0, t1, t2, textOverflow, weight;
|
|
2467
5283
|
$[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);
|
|
@@ -2513,10 +5329,10 @@ function inputElementStyle(props) {
|
|
|
2513
5329
|
}
|
|
2514
5330
|
const StyledRadio = /* @__PURE__ */ styled.div.withConfig({
|
|
2515
5331
|
displayName: "StyledRadio",
|
|
2516
|
-
componentId: "sc-
|
|
5332
|
+
componentId: "sc-9e1zy6-0"
|
|
2517
5333
|
})(radioBaseStyle), Input$3 = /* @__PURE__ */ styled.input.withConfig({
|
|
2518
5334
|
displayName: "Input",
|
|
2519
|
-
componentId: "sc-
|
|
5335
|
+
componentId: "sc-9e1zy6-1"
|
|
2520
5336
|
})(inputElementStyle), Radio = forwardRef(function Radio(props, forwardedRef) {
|
|
2521
5337
|
let $ = c(19), className, customValidity, disabled, readOnly, restProps, style;
|
|
2522
5338
|
$[0] === props ? (className = $[1], customValidity = $[2], disabled = $[3], readOnly = $[4], restProps = $[5], style = $[6]) : ({className, disabled, style, customValidity, readOnly, ...restProps} = props, $[0] = props, $[1] = className, $[2] = customValidity, $[3] = disabled, $[4] = readOnly, $[5] = restProps, $[6] = style);
|
|
@@ -2600,28 +5416,28 @@ const selectStyle = {
|
|
|
2600
5416
|
iconBox: iconBoxStyle
|
|
2601
5417
|
}, StyledSelect = /* @__PURE__ */ styled.div.withConfig({
|
|
2602
5418
|
displayName: "StyledSelect",
|
|
2603
|
-
componentId: "sc-
|
|
5419
|
+
componentId: "sc-fnrbcv-0"
|
|
2604
5420
|
})(selectStyle.root), Input$2 = /* @__PURE__ */ styled.select.withConfig({
|
|
2605
5421
|
displayName: "Input",
|
|
2606
|
-
componentId: "sc-
|
|
5422
|
+
componentId: "sc-fnrbcv-1"
|
|
2607
5423
|
})(selectStyle.input), IconBox = /* @__PURE__ */ styled(Box).withConfig({
|
|
2608
5424
|
displayName: "IconBox",
|
|
2609
|
-
componentId: "sc-
|
|
5425
|
+
componentId: "sc-fnrbcv-2"
|
|
2610
5426
|
})(selectStyle.iconBox), Select = forwardRef(function Select(props, forwardedRef) {
|
|
2611
|
-
let $ = c(
|
|
2612
|
-
$[0] === props ? (children = $[1], customValidity = $[2], disabled = $[3],
|
|
2613
|
-
let fontSize = t0 === void 0 ? 2 : t0,
|
|
2614
|
-
$[
|
|
5427
|
+
let $ = c(37), children, customValidity, disabled, readOnly, restProps, t0, t1, t2, t3;
|
|
5428
|
+
$[0] === props ? (children = $[1], customValidity = $[2], disabled = $[3], readOnly = $[4], restProps = $[5], t0 = $[6], t1 = $[7], t2 = $[8], t3 = $[9]) : ({children, customValidity, disabled, fontSize: t0, gap: t1, padding: t2, radius: t3, readOnly, ...restProps} = props, $[0] = props, $[1] = children, $[2] = customValidity, $[3] = disabled, $[4] = readOnly, $[5] = restProps, $[6] = t0, $[7] = t1, $[8] = t2, $[9] = t3);
|
|
5429
|
+
let fontSize = t0 === void 0 ? 2 : t0, gap = t1 === void 0 ? 3 : t1, padding = t2 === void 0 ? 3 : t2, radius = t3 === void 0 ? 2 : t3, ref = useRef(null), t4;
|
|
5430
|
+
$[10] === Symbol.for("react.memo_cache_sentinel") ? (t4 = () => ref.current, $[10] = t4) : t4 = $[10], useImperativeHandle(forwardedRef, t4), useCustomValidity(ref, customValidity);
|
|
2615
5431
|
let t5 = !disabled && readOnly ? "" : void 0, t6;
|
|
2616
|
-
$[
|
|
5432
|
+
$[11] === fontSize ? t6 = $[12] : (t6 = _getArrayProp(fontSize), $[11] = fontSize, $[12] = t6);
|
|
2617
5433
|
let t7;
|
|
2618
|
-
$[
|
|
5434
|
+
$[13] === padding ? t7 = $[14] : (t7 = _getArrayProp(padding), $[13] = padding, $[14] = t7);
|
|
2619
5435
|
let t8;
|
|
2620
|
-
$[
|
|
5436
|
+
$[15] === radius ? t8 = $[16] : (t8 = _getArrayProp(radius), $[15] = radius, $[16] = t8);
|
|
2621
5437
|
let t9;
|
|
2622
|
-
$[
|
|
5438
|
+
$[17] === gap ? t9 = $[18] : (t9 = _getArrayProp(gap), $[17] = gap, $[18] = t9);
|
|
2623
5439
|
let t10 = disabled || readOnly, t11;
|
|
2624
|
-
$[
|
|
5440
|
+
$[19] !== children || $[20] !== restProps || $[21] !== t10 || $[22] !== t5 || $[23] !== t6 || $[24] !== t7 || $[25] !== t8 || $[26] !== t9 ? (t11 = /* @__PURE__ */ jsx(Input$2, {
|
|
2625
5441
|
"data-read-only": t5,
|
|
2626
5442
|
"data-ui": "Select",
|
|
2627
5443
|
...restProps,
|
|
@@ -2632,24 +5448,24 @@ const selectStyle = {
|
|
|
2632
5448
|
disabled: t10,
|
|
2633
5449
|
ref,
|
|
2634
5450
|
children
|
|
2635
|
-
}), $[
|
|
5451
|
+
}), $[19] = children, $[20] = restProps, $[21] = t10, $[22] = t5, $[23] = t6, $[24] = t7, $[25] = t8, $[26] = t9, $[27] = t11) : t11 = $[27];
|
|
2636
5452
|
let t12;
|
|
2637
|
-
$[
|
|
5453
|
+
$[28] === Symbol.for("react.memo_cache_sentinel") ? (t12 = /* @__PURE__ */ jsx(ChevronDownIcon, {}), $[28] = t12) : t12 = $[28];
|
|
2638
5454
|
let t13;
|
|
2639
|
-
$[
|
|
5455
|
+
$[29] === fontSize ? t13 = $[30] : (t13 = /* @__PURE__ */ jsx(Text, {
|
|
2640
5456
|
size: fontSize,
|
|
2641
5457
|
children: t12
|
|
2642
|
-
}), $[
|
|
5458
|
+
}), $[29] = fontSize, $[30] = t13);
|
|
2643
5459
|
let t14;
|
|
2644
|
-
$[
|
|
5460
|
+
$[31] !== padding || $[32] !== t13 ? (t14 = /* @__PURE__ */ jsx(IconBox, {
|
|
2645
5461
|
padding,
|
|
2646
5462
|
children: t13
|
|
2647
|
-
}), $[
|
|
5463
|
+
}), $[31] = padding, $[32] = t13, $[33] = t14) : t14 = $[33];
|
|
2648
5464
|
let t15;
|
|
2649
|
-
return $[
|
|
5465
|
+
return $[34] !== t11 || $[35] !== t14 ? (t15 = /* @__PURE__ */ jsxs(StyledSelect, {
|
|
2650
5466
|
"data-ui": "Select",
|
|
2651
5467
|
children: [t11, t14]
|
|
2652
|
-
}), $[
|
|
5468
|
+
}), $[34] = t11, $[35] = t14, $[36] = t15) : t15 = $[36], t15;
|
|
2653
5469
|
});
|
|
2654
5470
|
function switchBaseStyles() {
|
|
2655
5471
|
return css`position:relative;&:not([hidden]){display:inline-block;}`;
|
|
@@ -2671,19 +5487,19 @@ function switchThumbStyles(props) {
|
|
|
2671
5487
|
}
|
|
2672
5488
|
const StyledSwitch = /* @__PURE__ */ styled.span.withConfig({
|
|
2673
5489
|
displayName: "StyledSwitch",
|
|
2674
|
-
componentId: "sc-
|
|
5490
|
+
componentId: "sc-gytoup-0"
|
|
2675
5491
|
})(switchBaseStyles), Input$1 = /* @__PURE__ */ styled.input.withConfig({
|
|
2676
5492
|
displayName: "Input",
|
|
2677
|
-
componentId: "sc-
|
|
5493
|
+
componentId: "sc-gytoup-1"
|
|
2678
5494
|
})(switchInputStyles), Representation = /* @__PURE__ */ styled.span.withConfig({
|
|
2679
5495
|
displayName: "Representation",
|
|
2680
|
-
componentId: "sc-
|
|
5496
|
+
componentId: "sc-gytoup-2"
|
|
2681
5497
|
})(switchRepresentationStyles), Track = /* @__PURE__ */ styled.span.withConfig({
|
|
2682
5498
|
displayName: "Track",
|
|
2683
|
-
componentId: "sc-
|
|
5499
|
+
componentId: "sc-gytoup-3"
|
|
2684
5500
|
})(switchTrackStyles), Thumb = /* @__PURE__ */ styled.span.withConfig({
|
|
2685
5501
|
displayName: "Thumb",
|
|
2686
|
-
componentId: "sc-
|
|
5502
|
+
componentId: "sc-gytoup-4"
|
|
2687
5503
|
})(switchThumbStyles), Switch = forwardRef(function Switch(props, forwardedRef) {
|
|
2688
5504
|
let $ = c(26), checked, className, disabled, indeterminate, readOnly, restProps, style;
|
|
2689
5505
|
$[0] === props ? (checked = $[1], className = $[2], disabled = $[3], indeterminate = $[4], readOnly = $[5], restProps = $[6], style = $[7]) : ({checked, className, disabled, indeterminate, readOnly, style, ...restProps} = props, $[0] = props, $[1] = checked, $[2] = className, $[3] = disabled, $[4] = indeterminate, $[5] = readOnly, $[6] = restProps, $[7] = style);
|
|
@@ -2722,16 +5538,16 @@ const StyledSwitch = /* @__PURE__ */ styled.span.withConfig({
|
|
|
2722
5538
|
}), $[21] = className, $[22] = style, $[23] = t6, $[24] = t8, $[25] = t9) : t9 = $[25], t9;
|
|
2723
5539
|
}), StyledTextArea = /* @__PURE__ */ styled.span.withConfig({
|
|
2724
5540
|
displayName: "StyledTextArea",
|
|
2725
|
-
componentId: "sc-
|
|
5541
|
+
componentId: "sc-1ucc5w-0"
|
|
2726
5542
|
})(textInputRootStyle), InputRoot = styled.span.withConfig({
|
|
2727
5543
|
displayName: "InputRoot",
|
|
2728
|
-
componentId: "sc-
|
|
5544
|
+
componentId: "sc-1ucc5w-1"
|
|
2729
5545
|
})`flex:1;min-width:0;display:block;position:relative;`, Input = /* @__PURE__ */ styled.textarea.withConfig({
|
|
2730
5546
|
displayName: "Input",
|
|
2731
|
-
componentId: "sc-
|
|
5547
|
+
componentId: "sc-1ucc5w-2"
|
|
2732
5548
|
})(responsiveInputPaddingStyle, textInputBaseStyle, textInputFontSizeStyle), Presentation = /* @__PURE__ */ styled.div.withConfig({
|
|
2733
5549
|
displayName: "Presentation",
|
|
2734
|
-
componentId: "sc-
|
|
5550
|
+
componentId: "sc-1ucc5w-3"
|
|
2735
5551
|
})(responsiveRadiusStyle, textInputRepresentationStyle), TextArea = forwardRef(function TextArea(props, forwardedRef) {
|
|
2736
5552
|
let $ = c(35), __unstable_disableFocusRing, customValidity, restProps, t0, t1, t2, t3, t4, weight;
|
|
2737
5553
|
$[0] === props ? (__unstable_disableFocusRing = $[1], customValidity = $[2], restProps = $[3], t0 = $[4], t1 = $[5], t2 = $[6], t3 = $[7], t4 = $[8], weight = $[9]) : ({border: t0, customValidity, disabled: t1, fontSize: t2, padding: t3, radius: t4, weight, __unstable_disableFocusRing, ...restProps} = props, $[0] = props, $[1] = __unstable_disableFocusRing, $[2] = customValidity, $[3] = restProps, $[4] = t0, $[5] = t1, $[6] = t2, $[7] = t3, $[8] = t4, $[9] = weight);
|
|
@@ -2777,6 +5593,395 @@ const StyledSwitch = /* @__PURE__ */ styled.span.withConfig({
|
|
|
2777
5593
|
}), $[32] = t12, $[33] = t15, $[34] = t16) : t16 = $[34], t16;
|
|
2778
5594
|
});
|
|
2779
5595
|
/**
|
|
5596
|
+
* @beta
|
|
5597
|
+
*/
|
|
5598
|
+
function useDelayedState(initialState) {
|
|
5599
|
+
let $ = c(5), [state, setState] = useState(initialState), delayedAction = useRef(void 0), t0;
|
|
5600
|
+
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = (nextState, delay) => {
|
|
5601
|
+
let action = () => {
|
|
5602
|
+
setState(nextState);
|
|
5603
|
+
};
|
|
5604
|
+
if (delayedAction.current &&= (clearTimeout(delayedAction.current), void 0), !delay) return action();
|
|
5605
|
+
delayedAction.current = setTimeout(action, delay);
|
|
5606
|
+
}, $[0] = t0) : t0 = $[0];
|
|
5607
|
+
let onStateChange = t0, t1, t2;
|
|
5608
|
+
$[1] === Symbol.for("react.memo_cache_sentinel") ? (t1 = () => () => {
|
|
5609
|
+
delayedAction.current && clearTimeout(delayedAction.current);
|
|
5610
|
+
}, t2 = [], $[1] = t1, $[2] = t2) : (t1 = $[1], t2 = $[2]), useEffect(t1, t2);
|
|
5611
|
+
let t3;
|
|
5612
|
+
return $[3] === state ? t3 = $[4] : (t3 = [state, onStateChange], $[3] = state, $[4] = t3), t3;
|
|
5613
|
+
}
|
|
5614
|
+
const DEFAULT_FALLBACK_PLACEMENTS = {
|
|
5615
|
+
top: [
|
|
5616
|
+
"top-end",
|
|
5617
|
+
"top-start",
|
|
5618
|
+
"bottom",
|
|
5619
|
+
"left",
|
|
5620
|
+
"right"
|
|
5621
|
+
],
|
|
5622
|
+
"top-start": [
|
|
5623
|
+
"top",
|
|
5624
|
+
"top-end",
|
|
5625
|
+
"bottom-start",
|
|
5626
|
+
"left-start",
|
|
5627
|
+
"right-start"
|
|
5628
|
+
],
|
|
5629
|
+
"top-end": [
|
|
5630
|
+
"top",
|
|
5631
|
+
"top-start",
|
|
5632
|
+
"bottom-end",
|
|
5633
|
+
"left-end",
|
|
5634
|
+
"right-end"
|
|
5635
|
+
],
|
|
5636
|
+
bottom: [
|
|
5637
|
+
"bottom-end",
|
|
5638
|
+
"bottom-start",
|
|
5639
|
+
"top",
|
|
5640
|
+
"left",
|
|
5641
|
+
"right"
|
|
5642
|
+
],
|
|
5643
|
+
"bottom-start": [
|
|
5644
|
+
"bottom",
|
|
5645
|
+
"bottom-end",
|
|
5646
|
+
"top-start",
|
|
5647
|
+
"left-start",
|
|
5648
|
+
"right-start"
|
|
5649
|
+
],
|
|
5650
|
+
"bottom-end": [
|
|
5651
|
+
"bottom",
|
|
5652
|
+
"bottom-start",
|
|
5653
|
+
"top-end",
|
|
5654
|
+
"left-end",
|
|
5655
|
+
"right-end"
|
|
5656
|
+
],
|
|
5657
|
+
left: [
|
|
5658
|
+
"left-end",
|
|
5659
|
+
"left-start",
|
|
5660
|
+
"right",
|
|
5661
|
+
"top",
|
|
5662
|
+
"bottom"
|
|
5663
|
+
],
|
|
5664
|
+
"left-start": [
|
|
5665
|
+
"left",
|
|
5666
|
+
"left-end",
|
|
5667
|
+
"right-start",
|
|
5668
|
+
"top-start",
|
|
5669
|
+
"bottom-start"
|
|
5670
|
+
],
|
|
5671
|
+
"left-end": [
|
|
5672
|
+
"left",
|
|
5673
|
+
"left-start",
|
|
5674
|
+
"right-end",
|
|
5675
|
+
"top-end",
|
|
5676
|
+
"bottom-end"
|
|
5677
|
+
],
|
|
5678
|
+
right: [
|
|
5679
|
+
"right-end",
|
|
5680
|
+
"right-start",
|
|
5681
|
+
"left",
|
|
5682
|
+
"top",
|
|
5683
|
+
"bottom"
|
|
5684
|
+
],
|
|
5685
|
+
"right-start": [
|
|
5686
|
+
"right",
|
|
5687
|
+
"right-end",
|
|
5688
|
+
"left-start",
|
|
5689
|
+
"top-start",
|
|
5690
|
+
"bottom-start"
|
|
5691
|
+
],
|
|
5692
|
+
"right-end": [
|
|
5693
|
+
"right",
|
|
5694
|
+
"right-start",
|
|
5695
|
+
"left-end",
|
|
5696
|
+
"top-end",
|
|
5697
|
+
"bottom-end"
|
|
5698
|
+
]
|
|
5699
|
+
}, MotionCard = styled(motion.create(Card)).withConfig({
|
|
5700
|
+
displayName: "MotionCard",
|
|
5701
|
+
componentId: "sc-d4pik2-0"
|
|
5702
|
+
})`will-change:transform;`, TooltipCard = forwardRef(function TooltipCard(props, ref) {
|
|
5703
|
+
let $ = c(48), animate, arrow, arrowRef, arrowX, arrowY, children, originX, originY, padding, placement, radius, restProps, scheme, shadow, style;
|
|
5704
|
+
$[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);
|
|
5705
|
+
let t0 = animate ? "transform" : void 0, t1;
|
|
5706
|
+
$[16] !== originX || $[17] !== originY || $[18] !== style || $[19] !== t0 ? (t1 = {
|
|
5707
|
+
originX,
|
|
5708
|
+
originY,
|
|
5709
|
+
willChange: t0,
|
|
5710
|
+
...style
|
|
5711
|
+
}, $[16] = originX, $[17] = originY, $[18] = style, $[19] = t0, $[20] = t1) : t1 = $[20];
|
|
5712
|
+
let rootStyle = t1, t2 = arrowX === null ? void 0 : arrowX, t3 = arrowY === null ? void 0 : arrowY, t4;
|
|
5713
|
+
$[21] !== t2 || $[22] !== t3 ? (t4 = {
|
|
5714
|
+
left: t2,
|
|
5715
|
+
top: t3,
|
|
5716
|
+
right: void 0,
|
|
5717
|
+
bottom: void 0
|
|
5718
|
+
}, $[21] = t2, $[22] = t3, $[23] = t4) : t4 = $[23];
|
|
5719
|
+
let arrowStyle = t4, t5 = restProps, t6;
|
|
5720
|
+
$[24] === animate ? t6 = $[25] : (t6 = animate ? ["hidden", "initial"] : void 0, $[24] = animate, $[25] = t6);
|
|
5721
|
+
let t7;
|
|
5722
|
+
$[26] === animate ? t7 = $[27] : (t7 = animate ? ["visible", "scaleIn"] : void 0, $[26] = animate, $[27] = t7);
|
|
5723
|
+
let t8;
|
|
5724
|
+
$[28] === animate ? t8 = $[29] : (t8 = animate ? ["hidden", "scaleOut"] : void 0, $[28] = animate, $[29] = t8);
|
|
5725
|
+
let t9;
|
|
5726
|
+
$[30] !== arrow || $[31] !== arrowRef || $[32] !== arrowStyle ? (t9 = arrow && /* @__PURE__ */ jsx(Arrow, {
|
|
5727
|
+
ref: arrowRef,
|
|
5728
|
+
style: arrowStyle,
|
|
5729
|
+
width: 15,
|
|
5730
|
+
height: 6,
|
|
5731
|
+
radius: 2
|
|
5732
|
+
}), $[30] = arrow, $[31] = arrowRef, $[32] = arrowStyle, $[33] = t9) : t9 = $[33];
|
|
5733
|
+
let t10;
|
|
5734
|
+
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, {
|
|
5735
|
+
"data-ui": "Tooltip__card",
|
|
5736
|
+
...t5,
|
|
5737
|
+
"data-placement": placement,
|
|
5738
|
+
padding,
|
|
5739
|
+
radius,
|
|
5740
|
+
ref,
|
|
5741
|
+
scheme,
|
|
5742
|
+
shadow,
|
|
5743
|
+
style: rootStyle,
|
|
5744
|
+
variants: POPOVER_MOTION_PROPS.card,
|
|
5745
|
+
transition: POPOVER_MOTION_PROPS.transition,
|
|
5746
|
+
initial: t6,
|
|
5747
|
+
animate: t7,
|
|
5748
|
+
exit: t8,
|
|
5749
|
+
children: [children, t9]
|
|
5750
|
+
}), $[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;
|
|
5751
|
+
}), TooltipDelayGroupContext = createGlobalScopedContext("@sanity/ui/context/tooltipDelayGroup", null);
|
|
5752
|
+
/**
|
|
5753
|
+
* @beta
|
|
5754
|
+
*/
|
|
5755
|
+
function useTooltipDelayGroup() {
|
|
5756
|
+
return useContext(TooltipDelayGroupContext);
|
|
5757
|
+
}
|
|
5758
|
+
const StyledTooltip = styled(Layer).withConfig({
|
|
5759
|
+
displayName: "StyledTooltip",
|
|
5760
|
+
componentId: "sc-jglbqo-0"
|
|
5761
|
+
})`pointer-events:none;`, Tooltip = forwardRef(function Tooltip(props, forwardedRef) {
|
|
5762
|
+
let $ = c(137), boundaryElementContext = useBoundaryElement(), { layer } = useTheme_v2(), _boundaryElement, _fallbackPlacementsProp, _zOffset, childProp, content, delay, disabled, portalProp, restProps, scheme, t0, t1, t2, t3, t4, t5;
|
|
5763
|
+
$[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);
|
|
5764
|
+
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;
|
|
5765
|
+
$[17] === fallbackPlacementsProp ? t6 = $[18] : (t6 = _getArrayProp(fallbackPlacementsProp), $[17] = fallbackPlacementsProp, $[18] = t6);
|
|
5766
|
+
let fallbackPlacements = t6, ref = useRef(null), [referenceElement, setReferenceElement] = useState(null), arrowRef = useRef(null), [tooltipMaxWidth, setTooltipMaxWidth] = useState(0), t7;
|
|
5767
|
+
$[19] === Symbol.for("react.memo_cache_sentinel") ? (t7 = () => ref.current, $[19] = t7) : t7 = $[19], useImperativeHandle(forwardedRef, t7);
|
|
5768
|
+
let portal = usePortal(), portalElement = typeof portalProp == "string" ? portal.elements?.[portalProp] || null : portal.element, t8;
|
|
5769
|
+
$[20] !== animate || $[21] !== arrowProp || $[22] !== boundaryElement || $[23] !== fallbackPlacements ? (t8 = {
|
|
5770
|
+
animate,
|
|
5771
|
+
arrowProp,
|
|
5772
|
+
arrowRef,
|
|
5773
|
+
boundaryElement,
|
|
5774
|
+
fallbackPlacements,
|
|
5775
|
+
rootBoundary: "viewport"
|
|
5776
|
+
}, $[20] = animate, $[21] = arrowProp, $[22] = boundaryElement, $[23] = fallbackPlacements, $[24] = t8) : t8 = $[24];
|
|
5777
|
+
let middleware = useMiddleware(t8), t9;
|
|
5778
|
+
$[25] === referenceElement ? t9 = $[26] : (t9 = { reference: referenceElement }, $[25] = referenceElement, $[26] = t9);
|
|
5779
|
+
let t10;
|
|
5780
|
+
$[27] !== middleware || $[28] !== placementProp || $[29] !== t9 ? (t10 = {
|
|
5781
|
+
middleware,
|
|
5782
|
+
placement: placementProp,
|
|
5783
|
+
whileElementsMounted: autoUpdate,
|
|
5784
|
+
elements: t9
|
|
5785
|
+
}, $[27] = middleware, $[28] = placementProp, $[29] = t9, $[30] = t10) : t10 = $[30];
|
|
5786
|
+
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;
|
|
5787
|
+
$[31] === delayGroupContext ? t11 = $[32] : (t11 = delayGroupContext || {}, $[31] = delayGroupContext, $[32] = t11);
|
|
5788
|
+
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;
|
|
5789
|
+
$[33] !== closeDelay || $[34] !== isInsideGroup || $[35] !== openDelay || $[36] !== setIsGroupActive || $[37] !== setIsOpen || $[38] !== setOpenTooltipId || $[39] !== tooltipId ? (t12 = (open, immediate) => {
|
|
5790
|
+
if (isInsideGroup) if (open) {
|
|
5791
|
+
let groupedOpenDelay = immediate ? 0 : openDelay;
|
|
5792
|
+
setIsGroupActive?.(open, groupedOpenDelay), setOpenTooltipId?.(tooltipId, groupedOpenDelay);
|
|
5793
|
+
} else setIsGroupActive?.(open, closeDelay > 200 ? closeDelay : 200), setOpenTooltipId?.(null, immediate ? 0 : closeDelay);
|
|
5794
|
+
else setIsOpen(open, immediate ? 0 : open ? openDelay : closeDelay);
|
|
5795
|
+
}, $[33] = closeDelay, $[34] = isInsideGroup, $[35] = openDelay, $[36] = setIsGroupActive, $[37] = setIsOpen, $[38] = setOpenTooltipId, $[39] = tooltipId, $[40] = t12) : t12 = $[40];
|
|
5796
|
+
let handleIsOpenChange = t12, t13;
|
|
5797
|
+
$[41] !== childProp?.props || $[42] !== handleIsOpenChange ? (t13 = (e) => {
|
|
5798
|
+
handleIsOpenChange(!1), childProp?.props?.onBlur?.(e);
|
|
5799
|
+
}, $[41] = childProp?.props, $[42] = handleIsOpenChange, $[43] = t13) : t13 = $[43], childProp?.props;
|
|
5800
|
+
let handleBlur = t13, t14;
|
|
5801
|
+
$[44] !== childProp?.props || $[45] !== handleIsOpenChange ? (t14 = (e_0) => {
|
|
5802
|
+
handleIsOpenChange(!1, !0), childProp?.props.onClick?.(e_0);
|
|
5803
|
+
}, $[44] = childProp?.props, $[45] = handleIsOpenChange, $[46] = t14) : t14 = $[46], childProp?.props;
|
|
5804
|
+
let handleClick = t14, t15;
|
|
5805
|
+
$[47] !== childProp?.props || $[48] !== handleIsOpenChange ? (t15 = (e_1) => {
|
|
5806
|
+
handleIsOpenChange(!1, !0), childProp?.props.onContextMenu?.(e_1);
|
|
5807
|
+
}, $[47] = childProp?.props, $[48] = handleIsOpenChange, $[49] = t15) : t15 = $[49], childProp?.props;
|
|
5808
|
+
let handleContextMenu = t15, t16;
|
|
5809
|
+
$[50] !== childProp?.props || $[51] !== handleIsOpenChange ? (t16 = (e_2) => {
|
|
5810
|
+
handleIsOpenChange(!0), childProp?.props?.onFocus?.(e_2);
|
|
5811
|
+
}, $[50] = childProp?.props, $[51] = handleIsOpenChange, $[52] = t16) : t16 = $[52], childProp?.props;
|
|
5812
|
+
let handleFocus = t16, t17;
|
|
5813
|
+
$[53] !== childProp?.props || $[54] !== handleIsOpenChange ? (t17 = (e_3) => {
|
|
5814
|
+
handleIsOpenChange(!0), childProp?.props?.onMouseEnter?.(e_3);
|
|
5815
|
+
}, $[53] = childProp?.props, $[54] = handleIsOpenChange, $[55] = t17) : t17 = $[55], childProp?.props;
|
|
5816
|
+
let handleMouseEnter = t17, t18;
|
|
5817
|
+
$[56] !== childProp?.props || $[57] !== handleIsOpenChange ? (t18 = (e_4) => {
|
|
5818
|
+
handleIsOpenChange(!1), childProp?.props?.onMouseLeave?.(e_4);
|
|
5819
|
+
}, $[56] = childProp?.props, $[57] = handleIsOpenChange, $[58] = t18) : t18 = $[58], childProp?.props;
|
|
5820
|
+
let handleMouseLeave = t18, t19;
|
|
5821
|
+
$[59] !== handleIsOpenChange || $[60] !== isInsideGroup || $[61] !== referenceElement || $[62] !== showTooltip ? (t19 = {
|
|
5822
|
+
handleIsOpenChange,
|
|
5823
|
+
referenceElement,
|
|
5824
|
+
showTooltip,
|
|
5825
|
+
isInsideGroup
|
|
5826
|
+
}, $[59] = handleIsOpenChange, $[60] = isInsideGroup, $[61] = referenceElement, $[62] = showTooltip, $[63] = t19) : t19 = $[63], useCloseOnMouseLeave(t19);
|
|
5827
|
+
let t20, t21;
|
|
5828
|
+
$[64] !== disabled || $[65] !== handleIsOpenChange || $[66] !== showTooltip ? (t20 = () => {
|
|
5829
|
+
disabled && showTooltip && handleIsOpenChange(!1);
|
|
5830
|
+
}, t21 = [
|
|
5831
|
+
disabled,
|
|
5832
|
+
handleIsOpenChange,
|
|
5833
|
+
showTooltip
|
|
5834
|
+
], $[64] = disabled, $[65] = handleIsOpenChange, $[66] = showTooltip, $[67] = t20, $[68] = t21) : (t20 = $[67], t21 = $[68]), useEffect(t20, t21);
|
|
5835
|
+
let t22, t23;
|
|
5836
|
+
$[69] !== content || $[70] !== handleIsOpenChange || $[71] !== showTooltip ? (t22 = () => {
|
|
5837
|
+
!content && showTooltip && handleIsOpenChange(!1);
|
|
5838
|
+
}, t23 = [
|
|
5839
|
+
content,
|
|
5840
|
+
handleIsOpenChange,
|
|
5841
|
+
showTooltip
|
|
5842
|
+
], $[69] = content, $[70] = handleIsOpenChange, $[71] = showTooltip, $[72] = t22, $[73] = t23) : (t22 = $[72], t23 = $[73]), useEffect(t22, t23);
|
|
5843
|
+
let t24, t25;
|
|
5844
|
+
$[74] !== handleIsOpenChange || $[75] !== showTooltip ? (t24 = () => {
|
|
5845
|
+
if (!showTooltip) return;
|
|
5846
|
+
let handleWindowKeyDown = function handleWindowKeyDown(event) {
|
|
5847
|
+
event.key === "Escape" && handleIsOpenChange(!1, !0);
|
|
5848
|
+
};
|
|
5849
|
+
return window.addEventListener("keydown", handleWindowKeyDown), () => {
|
|
5850
|
+
window.removeEventListener("keydown", handleWindowKeyDown);
|
|
5851
|
+
};
|
|
5852
|
+
}, t25 = [handleIsOpenChange, showTooltip], $[74] = handleIsOpenChange, $[75] = showTooltip, $[76] = t24, $[77] = t25) : (t24 = $[76], t25 = $[77]), useEffect(t24, t25);
|
|
5853
|
+
let t26;
|
|
5854
|
+
$[78] !== boundaryElement || $[79] !== portalElement?.offsetWidth ? (t26 = () => {
|
|
5855
|
+
let availableWidths = [...boundaryElement ? [boundaryElement.offsetWidth] : [], portalElement?.offsetWidth || document.body.offsetWidth];
|
|
5856
|
+
setTooltipMaxWidth(Math.min(...availableWidths) - 8);
|
|
5857
|
+
}, $[78] = boundaryElement, $[79] = portalElement?.offsetWidth, $[80] = t26) : t26 = $[80];
|
|
5858
|
+
let t27;
|
|
5859
|
+
$[81] !== boundaryElement || $[82] !== portalElement ? (t27 = [boundaryElement, portalElement], $[81] = boundaryElement, $[82] = portalElement, $[83] = t27) : t27 = $[83], useLayoutEffect(t26, t27);
|
|
5860
|
+
let t28;
|
|
5861
|
+
$[84] === update ? t28 = $[85] : (t28 = (arrowEl) => {
|
|
5862
|
+
arrowRef.current = arrowEl, update();
|
|
5863
|
+
}, $[84] = update, $[85] = t28);
|
|
5864
|
+
let setArrow = t28, t29;
|
|
5865
|
+
$[86] === refs ? t29 = $[87] : (t29 = (node) => {
|
|
5866
|
+
ref.current = node, refs.setFloating(node);
|
|
5867
|
+
}, $[86] = refs, $[87] = t29);
|
|
5868
|
+
let setFloating = t29, t30;
|
|
5869
|
+
bb0: {
|
|
5870
|
+
if (!childProp) {
|
|
5871
|
+
t30 = null;
|
|
5872
|
+
break bb0;
|
|
5873
|
+
}
|
|
5874
|
+
let t31;
|
|
5875
|
+
$[88] !== childProp || $[89] !== handleBlur || $[90] !== handleClick || $[91] !== handleContextMenu || $[92] !== handleFocus || $[93] !== handleMouseEnter || $[94] !== handleMouseLeave ? (t31 = cloneElement(childProp, {
|
|
5876
|
+
onBlur: handleBlur,
|
|
5877
|
+
onFocus: handleFocus,
|
|
5878
|
+
onMouseEnter: handleMouseEnter,
|
|
5879
|
+
onMouseLeave: handleMouseLeave,
|
|
5880
|
+
onClick: handleClick,
|
|
5881
|
+
onContextMenu: handleContextMenu,
|
|
5882
|
+
ref: setReferenceElement
|
|
5883
|
+
}), $[88] = childProp, $[89] = handleBlur, $[90] = handleClick, $[91] = handleContextMenu, $[92] = handleFocus, $[93] = handleMouseEnter, $[94] = handleMouseLeave, $[95] = t31) : t31 = $[95], t30 = t31;
|
|
5884
|
+
}
|
|
5885
|
+
let child = t30, t31;
|
|
5886
|
+
$[96] === childProp ? t31 = $[97] : (t31 = childProp ? getElementRef(childProp) : null, $[96] = childProp, $[97] = t31);
|
|
5887
|
+
let t32, t33;
|
|
5888
|
+
if ($[98] === referenceElement ? (t32 = $[99], t33 = $[100]) : (t32 = () => referenceElement, t33 = [referenceElement], $[98] = referenceElement, $[99] = t32, $[100] = t33), useImperativeHandle(t31, t32, t33), !child) {
|
|
5889
|
+
let t34;
|
|
5890
|
+
return $[101] === Symbol.for("react.memo_cache_sentinel") ? (t34 = /* @__PURE__ */ jsx(Fragment$1, {}), $[101] = t34) : t34 = $[101], t34;
|
|
5891
|
+
}
|
|
5892
|
+
if (disabled) return child;
|
|
5893
|
+
let t34 = tooltipMaxWidth > 0 ? `${tooltipMaxWidth}px` : void 0, t35;
|
|
5894
|
+
$[102] !== floatingStyles || $[103] !== t34 ? (t35 = {
|
|
5895
|
+
...floatingStyles,
|
|
5896
|
+
maxWidth: t34
|
|
5897
|
+
}, $[102] = floatingStyles, $[103] = t34, $[104] = t35) : t35 = $[104];
|
|
5898
|
+
let t36;
|
|
5899
|
+
$[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, {
|
|
5900
|
+
...restProps,
|
|
5901
|
+
animate,
|
|
5902
|
+
arrow: arrowProp,
|
|
5903
|
+
arrowRef: setArrow,
|
|
5904
|
+
arrowX,
|
|
5905
|
+
arrowY,
|
|
5906
|
+
originX,
|
|
5907
|
+
originY,
|
|
5908
|
+
padding,
|
|
5909
|
+
placement,
|
|
5910
|
+
radius,
|
|
5911
|
+
ref: setFloating,
|
|
5912
|
+
scheme,
|
|
5913
|
+
shadow,
|
|
5914
|
+
children: content
|
|
5915
|
+
}), $[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];
|
|
5916
|
+
let t37;
|
|
5917
|
+
$[121] !== restProps || $[122] !== setFloating || $[123] !== t35 || $[124] !== t36 || $[125] !== zOffset ? (t37 = /* @__PURE__ */ jsx(StyledTooltip, {
|
|
5918
|
+
"data-ui": "Tooltip",
|
|
5919
|
+
...restProps,
|
|
5920
|
+
ref: setFloating,
|
|
5921
|
+
style: t35,
|
|
5922
|
+
zOffset,
|
|
5923
|
+
children: t36
|
|
5924
|
+
}), $[121] = restProps, $[122] = setFloating, $[123] = t35, $[124] = t36, $[125] = zOffset, $[126] = t37) : t37 = $[126];
|
|
5925
|
+
let tooltip = t37, t38;
|
|
5926
|
+
$[127] !== portalProp || $[128] !== showTooltip || $[129] !== tooltip ? (t38 = showTooltip && (portalProp ? /* @__PURE__ */ jsx(Portal, {
|
|
5927
|
+
__unstable_name: typeof portalProp == "string" ? portalProp : void 0,
|
|
5928
|
+
children: tooltip
|
|
5929
|
+
}) : tooltip), $[127] = portalProp, $[128] = showTooltip, $[129] = tooltip, $[130] = t38) : t38 = $[130];
|
|
5930
|
+
let children = t38, t39;
|
|
5931
|
+
$[131] !== animate || $[132] !== children ? (t39 = animate ? /* @__PURE__ */ jsx(AnimatePresence, { children }) : children, $[131] = animate, $[132] = children, $[133] = t39) : t39 = $[133];
|
|
5932
|
+
let t40;
|
|
5933
|
+
return $[134] !== child || $[135] !== t39 ? (t40 = /* @__PURE__ */ jsxs(Fragment$1, { children: [t39, child] }), $[134] = child, $[135] = t39, $[136] = t40) : t40 = $[136], t40;
|
|
5934
|
+
});
|
|
5935
|
+
function useMiddleware(t0) {
|
|
5936
|
+
let $ = c(17), { animate, arrowProp, arrowRef, boundaryElement, fallbackPlacements, rootBoundary } = t0, ret;
|
|
5937
|
+
if ($[0] !== animate || $[1] !== arrowProp || $[2] !== arrowRef || $[3] !== boundaryElement || $[4] !== fallbackPlacements || $[5] !== rootBoundary) {
|
|
5938
|
+
ret = [];
|
|
5939
|
+
let t1 = boundaryElement || void 0, t2;
|
|
5940
|
+
$[7] !== fallbackPlacements || $[8] !== rootBoundary || $[9] !== t1 ? (t2 = flip({
|
|
5941
|
+
boundary: t1,
|
|
5942
|
+
fallbackPlacements,
|
|
5943
|
+
padding: 4,
|
|
5944
|
+
rootBoundary
|
|
5945
|
+
}), $[7] = fallbackPlacements, $[8] = rootBoundary, $[9] = t1, $[10] = t2) : t2 = $[10], ret.push(t2);
|
|
5946
|
+
let t3;
|
|
5947
|
+
$[11] === Symbol.for("react.memo_cache_sentinel") ? (t3 = offset({ mainAxis: 4 }), $[11] = t3) : t3 = $[11], ret.push(t3);
|
|
5948
|
+
let t4 = boundaryElement || void 0, t5;
|
|
5949
|
+
if ($[12] !== rootBoundary || $[13] !== t4 ? (t5 = shift({
|
|
5950
|
+
boundary: t4,
|
|
5951
|
+
rootBoundary,
|
|
5952
|
+
padding: 4
|
|
5953
|
+
}), $[12] = rootBoundary, $[13] = t4, $[14] = t5) : t5 = $[14], ret.push(t5), arrowProp) {
|
|
5954
|
+
let t6;
|
|
5955
|
+
$[15] === arrowRef ? t6 = $[16] : (t6 = arrow({
|
|
5956
|
+
element: arrowRef,
|
|
5957
|
+
padding: 4
|
|
5958
|
+
}), $[15] = arrowRef, $[16] = t6), ret.push(t6);
|
|
5959
|
+
}
|
|
5960
|
+
animate && ret.push(origin), $[0] = animate, $[1] = arrowProp, $[2] = arrowRef, $[3] = boundaryElement, $[4] = fallbackPlacements, $[5] = rootBoundary, $[6] = ret;
|
|
5961
|
+
} else ret = $[6];
|
|
5962
|
+
return ret;
|
|
5963
|
+
}
|
|
5964
|
+
/**
|
|
5965
|
+
* As `useEffectEvent` should never be passed to other components or hooks, this custom hook groups together the `useEffectEvent` and the `useEffect` hook using it.
|
|
5966
|
+
* @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
|
|
5967
|
+
*/
|
|
5968
|
+
function useCloseOnMouseLeave(t0) {
|
|
5969
|
+
let $ = c(10), { handleIsOpenChange, referenceElement, showTooltip, isInsideGroup } = t0, t1;
|
|
5970
|
+
$[0] !== handleIsOpenChange || $[1] !== referenceElement ? (t1 = (target, teardown) => {
|
|
5971
|
+
referenceElement && (referenceElement === target || target instanceof Node && referenceElement.contains(target) || (handleIsOpenChange(!1), teardown()));
|
|
5972
|
+
}, $[0] = handleIsOpenChange, $[1] = referenceElement, $[2] = t1) : t1 = $[2];
|
|
5973
|
+
let onMouseMove = useEffectEvent(t1), t2;
|
|
5974
|
+
$[3] !== isInsideGroup || $[4] !== onMouseMove || $[5] !== showTooltip ? (t2 = () => {
|
|
5975
|
+
if (!showTooltip || isInsideGroup) return;
|
|
5976
|
+
let handleMouseMove = (event) => {
|
|
5977
|
+
onMouseMove(event.target, () => window.removeEventListener("mousemove", handleMouseMove));
|
|
5978
|
+
};
|
|
5979
|
+
return window.addEventListener("mousemove", handleMouseMove), () => window.removeEventListener("mousemove", handleMouseMove);
|
|
5980
|
+
}, $[3] = isInsideGroup, $[4] = onMouseMove, $[5] = showTooltip, $[6] = t2) : t2 = $[6];
|
|
5981
|
+
let t3;
|
|
5982
|
+
$[7] !== isInsideGroup || $[8] !== showTooltip ? (t3 = [isInsideGroup, showTooltip], $[7] = isInsideGroup, $[8] = showTooltip, $[9] = t3) : t3 = $[9], useEffect(t2, t3);
|
|
5983
|
+
}
|
|
5984
|
+
/**
|
|
2780
5985
|
* @public
|
|
2781
5986
|
* Provides context for a group of tooltip elements that should share a delay
|
|
2782
5987
|
* which temporarily becomes 1 ms after the first floating element of the group opens.
|
|
@@ -2813,10 +6018,10 @@ function BoundaryElementProvider(props) {
|
|
|
2813
6018
|
}
|
|
2814
6019
|
/**
|
|
2815
6020
|
* @internal
|
|
2816
|
-
* @deprecated
|
|
6021
|
+
* @deprecated ConditionalWrapper was removed in @sanity/ui v4. Inline the conditional wrapping logic instead.
|
|
2817
6022
|
*/
|
|
2818
|
-
function ConditionalWrapper(
|
|
2819
|
-
|
|
6023
|
+
function ConditionalWrapper(_props) {
|
|
6024
|
+
throw Error("`ConditionalWrapper` was removed in @sanity/ui v4. Inline the conditional wrapping logic instead.");
|
|
2820
6025
|
}
|
|
2821
6026
|
function findMaxBreakpoints(media, width) {
|
|
2822
6027
|
let ret = [];
|
|
@@ -2877,9 +6082,32 @@ var ErrorBoundary = class extends Component {
|
|
|
2877
6082
|
return error ? /* @__PURE__ */ jsx(Code, { children: typeof error?.message == "string" ? error.message : "Error" }) : this.props.children;
|
|
2878
6083
|
}
|
|
2879
6084
|
};
|
|
2880
|
-
|
|
6085
|
+
/**
|
|
6086
|
+
* @public
|
|
6087
|
+
*/
|
|
6088
|
+
function PortalProvider(props) {
|
|
6089
|
+
let $ = c(7), { boundaryElement, children, element, __unstable_elements: elements } = props, fallbackElement = useSyncExternalStore(emptySubscribe, _temp, _temp2), t0 = boundaryElement || null, t1 = element || fallbackElement, t2;
|
|
6090
|
+
$[0] !== elements || $[1] !== t0 || $[2] !== t1 ? (t2 = {
|
|
6091
|
+
version: 0,
|
|
6092
|
+
boundaryElement: t0,
|
|
6093
|
+
element: t1,
|
|
6094
|
+
elements
|
|
6095
|
+
}, $[0] = elements, $[1] = t0, $[2] = t1, $[3] = t2) : t2 = $[3];
|
|
6096
|
+
let value = t2, t3;
|
|
6097
|
+
return $[4] !== children || $[5] !== value ? (t3 = /* @__PURE__ */ jsx(PortalContext.Provider, {
|
|
6098
|
+
value,
|
|
6099
|
+
children
|
|
6100
|
+
}), $[4] = children, $[5] = value, $[6] = t3) : t3 = $[6], t3;
|
|
6101
|
+
}
|
|
6102
|
+
function _temp2() {
|
|
6103
|
+
return null;
|
|
6104
|
+
}
|
|
6105
|
+
function _temp() {
|
|
6106
|
+
return document.body;
|
|
6107
|
+
}
|
|
6108
|
+
const emptySubscribe = () => () => {}, StyledSrOnly = styled.div.withConfig({
|
|
2881
6109
|
displayName: "StyledSrOnly",
|
|
2882
|
-
componentId: "sc-
|
|
6110
|
+
componentId: "sc-no4wr4-0"
|
|
2883
6111
|
})`display:block;width:0;height:0;position:absolute;overflow:hidden;overflow:clip;`, SrOnly = forwardRef(function SrOnly(props, ref) {
|
|
2884
6112
|
let $ = c(4), { as, children } = props, t0;
|
|
2885
6113
|
return $[0] !== as || $[1] !== children || $[2] !== ref ? (t0 = /* @__PURE__ */ jsx(StyledSrOnly, {
|
|
@@ -2891,10 +6119,10 @@ const StyledSrOnly = styled.div.withConfig({
|
|
|
2891
6119
|
}), $[0] = as, $[1] = children, $[2] = ref, $[3] = t0) : t0 = $[3], t0;
|
|
2892
6120
|
}), StyledVirtualList = styled.div.withConfig({
|
|
2893
6121
|
displayName: "StyledVirtualList",
|
|
2894
|
-
componentId: "sc-
|
|
6122
|
+
componentId: "sc-im7l4q-0"
|
|
2895
6123
|
})`position:relative;`, ItemWrapper = styled.div.withConfig({
|
|
2896
6124
|
displayName: "ItemWrapper",
|
|
2897
|
-
componentId: "sc-
|
|
6125
|
+
componentId: "sc-im7l4q-1"
|
|
2898
6126
|
})`position:absolute;left:0;right:0;`, VirtualList = forwardRef(function VirtualList(props, forwardedRef) {
|
|
2899
6127
|
let $ = c(44), getItemKey, onChange, renderItem, restProps, t0, t1, t2;
|
|
2900
6128
|
$[0] === props ? (getItemKey = $[1], onChange = $[2], renderItem = $[3], restProps = $[4], t0 = $[5], t1 = $[6], t2 = $[7]) : ({as: t0, gap: t1, getItemKey, items: t2, onChange, renderItem, ...restProps} = props, $[0] = props, $[1] = getItemKey, $[2] = onChange, $[3] = renderItem, $[4] = restProps, $[5] = t0, $[6] = t1, $[7] = t2);
|