@sanity/ui 2.8.15 → 2.8.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +66 -254
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +324 -513
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +66 -254
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1,200 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
3
|
-
var theme = require("@sanity/ui/theme"), jsxRuntime = require("react/jsx-runtime"), require
|
|
3
|
+
var theme = require("@sanity/ui/theme"), jsxRuntime = require("react/jsx-runtime"), reactCompilerRuntime = require("react-compiler-runtime"), react = require("react"), ReactIs = require("react-is"), styledComponents = require("styled-components"), icons = require("@sanity/icons"), Refractor = require("react-refractor"), reactDom$1 = require("@floating-ui/react-dom"), framerMotion = require("framer-motion"), reactDom = require("react-dom"), useEffectEvent = require("use-effect-event"), getTheme_v2 = require("./_chunks-cjs/getTheme_v2.js");
|
|
4
4
|
function _interopDefaultCompat(e) {
|
|
5
5
|
return e && typeof e == "object" && "default" in e ? e : { default: e };
|
|
6
6
|
}
|
|
7
|
-
var
|
|
8
|
-
const createColorTheme = theme.createColorTheme, hexToRgb = theme.hexToRgb, hslToRgb = theme.hslToRgb, multiply = theme.multiply, parseColor = theme.parseColor, rgbToHex = theme.rgbToHex, rgbToHsl = theme.rgbToHsl, rgba = theme.rgba, screen = theme.screen, studioTheme = theme.buildTheme()
|
|
9
|
-
var dist = {};
|
|
10
|
-
/**
|
|
11
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
12
|
-
*
|
|
13
|
-
* This source code is licensed under the MIT license found in the
|
|
14
|
-
* LICENSE file in the root directory of this source tree.
|
|
15
|
-
*
|
|
16
|
-
* @lightSyntaxTransform
|
|
17
|
-
* @noflow
|
|
18
|
-
* @nolint
|
|
19
|
-
* @preventMunge
|
|
20
|
-
* @preserve-invariant-messages
|
|
21
|
-
*/
|
|
22
|
-
var hasRequiredDist;
|
|
23
|
-
function requireDist() {
|
|
24
|
-
if (hasRequiredDist) return dist;
|
|
25
|
-
hasRequiredDist = 1;
|
|
26
|
-
var React = require$$0__default.default;
|
|
27
|
-
function _interopNamespaceDefault(e) {
|
|
28
|
-
var n = /* @__PURE__ */ Object.create(null);
|
|
29
|
-
return e && Object.keys(e).forEach(function(k) {
|
|
30
|
-
if (k !== "default") {
|
|
31
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
32
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
33
|
-
enumerable: !0,
|
|
34
|
-
get: function() {
|
|
35
|
-
return e[k];
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
}), n.default = e, Object.freeze(n);
|
|
40
|
-
}
|
|
41
|
-
var React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React), _a, _b;
|
|
42
|
-
const {
|
|
43
|
-
useRef,
|
|
44
|
-
useEffect,
|
|
45
|
-
isValidElement
|
|
46
|
-
} = React__namespace, ReactSecretInternals = (_a = React__namespace.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE) !== null && _a !== void 0 ? _a : React__namespace.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, $empty = Symbol.for("react.memo_cache_sentinel"), c = typeof ((_b = React__namespace.__COMPILER_RUNTIME) === null || _b === void 0 ? void 0 : _b.c) == "function" ? React__namespace.__COMPILER_RUNTIME.c : function(size2) {
|
|
47
|
-
return React__namespace.useMemo(() => {
|
|
48
|
-
const $ = new Array(size2);
|
|
49
|
-
for (let ii = 0; ii < size2; ii++)
|
|
50
|
-
$[ii] = $empty;
|
|
51
|
-
return $[$empty] = !0, $;
|
|
52
|
-
}, []);
|
|
53
|
-
}, LazyGuardDispatcher = {};
|
|
54
|
-
["readContext", "useCallback", "useContext", "useEffect", "useImperativeHandle", "useInsertionEffect", "useLayoutEffect", "useMemo", "useReducer", "useRef", "useState", "useDebugValue", "useDeferredValue", "useTransition", "useMutableSource", "useSyncExternalStore", "useId", "unstable_isNewReconciler", "getCacheSignal", "getCacheForType", "useCacheRefresh"].forEach((name) => {
|
|
55
|
-
LazyGuardDispatcher[name] = () => {
|
|
56
|
-
throw new Error(`[React] Unexpected React hook call (${name}) from a React compiled function. Check that all hooks are called directly and named according to convention ('use[A-Z]') `);
|
|
57
|
-
};
|
|
58
|
-
});
|
|
59
|
-
let originalDispatcher = null;
|
|
60
|
-
LazyGuardDispatcher.useMemoCache = (count) => {
|
|
61
|
-
if (originalDispatcher == null)
|
|
62
|
-
throw new Error("React Compiler internal invariant violation: unexpected null dispatcher");
|
|
63
|
-
return originalDispatcher.useMemoCache(count);
|
|
64
|
-
};
|
|
65
|
-
var GuardKind;
|
|
66
|
-
(function(GuardKind2) {
|
|
67
|
-
GuardKind2[GuardKind2.PushGuardContext = 0] = "PushGuardContext", GuardKind2[GuardKind2.PopGuardContext = 1] = "PopGuardContext", GuardKind2[GuardKind2.PushExpectHook = 2] = "PushExpectHook", GuardKind2[GuardKind2.PopExpectHook = 3] = "PopExpectHook";
|
|
68
|
-
})(GuardKind || (GuardKind = {}));
|
|
69
|
-
function setCurrent(newDispatcher) {
|
|
70
|
-
return ReactSecretInternals.ReactCurrentDispatcher.current = newDispatcher, ReactSecretInternals.ReactCurrentDispatcher.current;
|
|
71
|
-
}
|
|
72
|
-
const guardFrames = [];
|
|
73
|
-
function $dispatcherGuard(kind) {
|
|
74
|
-
const curr = ReactSecretInternals.ReactCurrentDispatcher.current;
|
|
75
|
-
if (kind === GuardKind.PushGuardContext) {
|
|
76
|
-
if (guardFrames.push(curr), guardFrames.length === 1 && (originalDispatcher = curr), curr === LazyGuardDispatcher)
|
|
77
|
-
throw new Error("[React] Unexpected call to custom hook or component from a React compiled function. Check that (1) all hooks are called directly and named according to convention ('use[A-Z]') and (2) components are returned as JSX instead of being directly invoked.");
|
|
78
|
-
setCurrent(LazyGuardDispatcher);
|
|
79
|
-
} else if (kind === GuardKind.PopGuardContext) {
|
|
80
|
-
const lastFrame = guardFrames.pop();
|
|
81
|
-
if (lastFrame == null)
|
|
82
|
-
throw new Error("React Compiler internal error: unexpected null in guard stack");
|
|
83
|
-
guardFrames.length === 0 && (originalDispatcher = null), setCurrent(lastFrame);
|
|
84
|
-
} else if (kind === GuardKind.PushExpectHook)
|
|
85
|
-
guardFrames.push(curr), setCurrent(originalDispatcher);
|
|
86
|
-
else if (kind === GuardKind.PopExpectHook) {
|
|
87
|
-
const lastFrame = guardFrames.pop();
|
|
88
|
-
if (lastFrame == null)
|
|
89
|
-
throw new Error("React Compiler internal error: unexpected null in guard stack");
|
|
90
|
-
setCurrent(lastFrame);
|
|
91
|
-
} else
|
|
92
|
-
throw new Error("React Compiler internal error: unreachable block" + kind);
|
|
93
|
-
}
|
|
94
|
-
function $reset($) {
|
|
95
|
-
for (let ii = 0; ii < $.length; ii++)
|
|
96
|
-
$[ii] = $empty;
|
|
97
|
-
}
|
|
98
|
-
function $makeReadOnly() {
|
|
99
|
-
throw new Error("TODO: implement $makeReadOnly in react-compiler-runtime");
|
|
100
|
-
}
|
|
101
|
-
const renderCounterRegistry = /* @__PURE__ */ new Map();
|
|
102
|
-
function clearRenderCounterRegistry() {
|
|
103
|
-
for (const counters of renderCounterRegistry.values())
|
|
104
|
-
counters.forEach((counter) => {
|
|
105
|
-
counter.count = 0;
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
function registerRenderCounter(name, val) {
|
|
109
|
-
let counters = renderCounterRegistry.get(name);
|
|
110
|
-
counters == null && (counters = /* @__PURE__ */ new Set(), renderCounterRegistry.set(name, counters)), counters.add(val);
|
|
111
|
-
}
|
|
112
|
-
function removeRenderCounter(name, val) {
|
|
113
|
-
const counters = renderCounterRegistry.get(name);
|
|
114
|
-
counters?.delete(val);
|
|
115
|
-
}
|
|
116
|
-
function useRenderCounter(name) {
|
|
117
|
-
const val = useRef(null);
|
|
118
|
-
val.current != null && (val.current.count += 1), useEffect(() => {
|
|
119
|
-
if (val.current == null) {
|
|
120
|
-
const counter = {
|
|
121
|
-
count: 0
|
|
122
|
-
};
|
|
123
|
-
registerRenderCounter(name, counter), val.current = counter;
|
|
124
|
-
}
|
|
125
|
-
return () => {
|
|
126
|
-
val.current !== null && removeRenderCounter(name, val.current);
|
|
127
|
-
};
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
const seenErrors = /* @__PURE__ */ new Set();
|
|
131
|
-
function $structuralCheck(oldValue, newValue, variableName, fnName, kind, loc) {
|
|
132
|
-
function error(l, r, path, depth) {
|
|
133
|
-
const str = `${fnName}:${loc} [${kind}] ${variableName}${path} changed from ${l} to ${r} at depth ${depth}`;
|
|
134
|
-
seenErrors.has(str) || (seenErrors.add(str), console.error(str));
|
|
135
|
-
}
|
|
136
|
-
const depthLimit = 2;
|
|
137
|
-
function recur(oldValue2, newValue2, path, depth) {
|
|
138
|
-
if (!(depth > depthLimit)) {
|
|
139
|
-
if (oldValue2 === newValue2)
|
|
140
|
-
return;
|
|
141
|
-
if (typeof oldValue2 != typeof newValue2)
|
|
142
|
-
error(`type ${typeof oldValue2}`, `type ${typeof newValue2}`, path, depth);
|
|
143
|
-
else if (typeof oldValue2 == "object") {
|
|
144
|
-
const oldArray = Array.isArray(oldValue2), newArray = Array.isArray(newValue2);
|
|
145
|
-
if (oldValue2 === null && newValue2 !== null)
|
|
146
|
-
error("null", `type ${typeof newValue2}`, path, depth);
|
|
147
|
-
else if (newValue2 === null)
|
|
148
|
-
error(`type ${typeof oldValue2}`, "null", path, depth);
|
|
149
|
-
else if (oldValue2 instanceof Map)
|
|
150
|
-
if (!(newValue2 instanceof Map))
|
|
151
|
-
error("Map instance", "other value", path, depth);
|
|
152
|
-
else if (oldValue2.size !== newValue2.size)
|
|
153
|
-
error(`Map instance with size ${oldValue2.size}`, `Map instance with size ${newValue2.size}`, path, depth);
|
|
154
|
-
else
|
|
155
|
-
for (const [k, v] of oldValue2)
|
|
156
|
-
newValue2.has(k) ? recur(v, newValue2.get(k), `${path}.get(${k})`, depth + 1) : error(`Map instance with key ${k}`, `Map instance without key ${k}`, path, depth);
|
|
157
|
-
else if (newValue2 instanceof Map)
|
|
158
|
-
error("other value", "Map instance", path, depth);
|
|
159
|
-
else if (oldValue2 instanceof Set)
|
|
160
|
-
if (!(newValue2 instanceof Set))
|
|
161
|
-
error("Set instance", "other value", path, depth);
|
|
162
|
-
else if (oldValue2.size !== newValue2.size)
|
|
163
|
-
error(`Set instance with size ${oldValue2.size}`, `Set instance with size ${newValue2.size}`, path, depth);
|
|
164
|
-
else
|
|
165
|
-
for (const v of newValue2)
|
|
166
|
-
oldValue2.has(v) || error(`Set instance without element ${v}`, `Set instance with element ${v}`, path, depth);
|
|
167
|
-
else if (newValue2 instanceof Set)
|
|
168
|
-
error("other value", "Set instance", path, depth);
|
|
169
|
-
else if (oldArray || newArray)
|
|
170
|
-
if (oldArray !== newArray)
|
|
171
|
-
error(`type ${oldArray ? "array" : "object"}`, `type ${newArray ? "array" : "object"}`, path, depth);
|
|
172
|
-
else if (oldValue2.length !== newValue2.length)
|
|
173
|
-
error(`array with length ${oldValue2.length}`, `array with length ${newValue2.length}`, path, depth);
|
|
174
|
-
else
|
|
175
|
-
for (let ii = 0; ii < oldValue2.length; ii++)
|
|
176
|
-
recur(oldValue2[ii], newValue2[ii], `${path}[${ii}]`, depth + 1);
|
|
177
|
-
else if (isValidElement(oldValue2) || isValidElement(newValue2))
|
|
178
|
-
isValidElement(oldValue2) !== isValidElement(newValue2) ? error(`type ${isValidElement(oldValue2) ? "React element" : "object"}`, `type ${isValidElement(newValue2) ? "React element" : "object"}`, path, depth) : oldValue2.type !== newValue2.type ? error(`React element of type ${oldValue2.type}`, `React element of type ${newValue2.type}`, path, depth) : recur(oldValue2.props, newValue2.props, `[props of ${path}]`, depth + 1);
|
|
179
|
-
else {
|
|
180
|
-
for (const key2 in newValue2)
|
|
181
|
-
key2 in oldValue2 || error(`object without key ${key2}`, `object with key ${key2}`, path, depth);
|
|
182
|
-
for (const key2 in oldValue2)
|
|
183
|
-
key2 in newValue2 ? recur(oldValue2[key2], newValue2[key2], `${path}.${key2}`, depth + 1) : error(`object with key ${key2}`, `object without key ${key2}`, path, depth);
|
|
184
|
-
}
|
|
185
|
-
} else {
|
|
186
|
-
if (typeof oldValue2 == "function")
|
|
187
|
-
return;
|
|
188
|
-
isNaN(oldValue2) || isNaN(newValue2) ? isNaN(oldValue2) !== isNaN(newValue2) && error(`${isNaN(oldValue2) ? "NaN" : "non-NaN value"}`, `${isNaN(newValue2) ? "NaN" : "non-NaN value"}`, path, depth) : oldValue2 !== newValue2 && error(oldValue2, newValue2, path, depth);
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
recur(oldValue, newValue, "", 0);
|
|
193
|
-
}
|
|
194
|
-
return dist.$dispatcherGuard = $dispatcherGuard, dist.$makeReadOnly = $makeReadOnly, dist.$reset = $reset, dist.$structuralCheck = $structuralCheck, dist.c = c, dist.clearRenderCounterRegistry = clearRenderCounterRegistry, dist.renderCounterRegistry = renderCounterRegistry, dist.useRenderCounter = useRenderCounter, dist;
|
|
195
|
-
}
|
|
196
|
-
var distExports = requireDist();
|
|
197
|
-
const EMPTY_ARRAY = [], EMPTY_RECORD = {}, POPOVER_MOTION_CONTENT_OPACITY_PROPERTY = "--motion-content-opacity", POPOVER_MOTION_PROPS = {
|
|
7
|
+
var ReactIs__default = /* @__PURE__ */ _interopDefaultCompat(ReactIs), Refractor__default = /* @__PURE__ */ _interopDefaultCompat(Refractor);
|
|
8
|
+
const createColorTheme = theme.createColorTheme, hexToRgb = theme.hexToRgb, hslToRgb = theme.hslToRgb, multiply = theme.multiply, parseColor = theme.parseColor, rgbToHex = theme.rgbToHex, rgbToHsl = theme.rgbToHsl, rgba = theme.rgba, screen = theme.screen, studioTheme = theme.buildTheme(), EMPTY_ARRAY = [], EMPTY_RECORD = {}, POPOVER_MOTION_CONTENT_OPACITY_PROPERTY = "--motion-content-opacity", POPOVER_MOTION_PROPS = {
|
|
198
9
|
initial: {
|
|
199
10
|
opacity: 0.5,
|
|
200
11
|
[POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: 0,
|
|
@@ -337,8 +148,8 @@ function responsiveTextFont(props) {
|
|
|
337
148
|
return responsiveFont("text", props);
|
|
338
149
|
}
|
|
339
150
|
function useArrayProp(val, defaultVal) {
|
|
340
|
-
const __perf_hash__ =
|
|
341
|
-
return
|
|
151
|
+
const __perf_hash__ = react.useMemo(() => JSON.stringify(val ?? defaultVal), [defaultVal, val]);
|
|
152
|
+
return react.useMemo(
|
|
342
153
|
() => _getArrayProp(val, defaultVal),
|
|
343
154
|
// Improve performance: Keep object identify for a given hash of the value
|
|
344
155
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -352,10 +163,10 @@ function _getElements(element, elementsArg) {
|
|
|
352
163
|
return ret.filter(Boolean);
|
|
353
164
|
}
|
|
354
165
|
function useClickOutside(listener, t0, boundaryElement) {
|
|
355
|
-
const $ =
|
|
166
|
+
const $ = reactCompilerRuntime.c(12), elementsArg = t0 === void 0 ? EMPTY_ARRAY : t0, [element, setElement] = react.useState(null);
|
|
356
167
|
let t1;
|
|
357
168
|
$[0] !== element || $[1] !== elementsArg ? (t1 = () => _getElements(element, elementsArg), $[0] = element, $[1] = elementsArg, $[2] = t1) : t1 = $[2];
|
|
358
|
-
const [elements, setElements] =
|
|
169
|
+
const [elements, setElements] = react.useState(t1), elementsRef = react.useRef(elements);
|
|
359
170
|
let t2, t3;
|
|
360
171
|
$[3] !== element || $[4] !== elementsArg ? (t2 = () => {
|
|
361
172
|
const prevElements = elementsRef.current, nextElements = _getElements(element, elementsArg);
|
|
@@ -373,7 +184,7 @@ function useClickOutside(listener, t0, boundaryElement) {
|
|
|
373
184
|
setElements(nextElements), elementsRef.current = nextElements;
|
|
374
185
|
return;
|
|
375
186
|
}
|
|
376
|
-
}, t3 = [element, elementsArg], $[3] = element, $[4] = elementsArg, $[5] = t2, $[6] = t3) : (t2 = $[5], t3 = $[6]),
|
|
187
|
+
}, t3 = [element, elementsArg], $[3] = element, $[4] = elementsArg, $[5] = t2, $[6] = t3) : (t2 = $[5], t3 = $[6]), react.useEffect(t2, t3);
|
|
377
188
|
let t4, t5;
|
|
378
189
|
return $[7] !== listener || $[8] !== boundaryElement || $[9] !== elements ? (t4 = () => {
|
|
379
190
|
if (!listener)
|
|
@@ -390,10 +201,10 @@ function useClickOutside(listener, t0, boundaryElement) {
|
|
|
390
201
|
return window.addEventListener("mousedown", handleWindowMouseDown), () => {
|
|
391
202
|
window.removeEventListener("mousedown", handleWindowMouseDown);
|
|
392
203
|
};
|
|
393
|
-
}, t5 = [boundaryElement, listener, elements], $[7] = listener, $[8] = boundaryElement, $[9] = elements, $[10] = t4, $[11] = t5) : (t4 = $[10], t5 = $[11]),
|
|
204
|
+
}, t5 = [boundaryElement, listener, elements], $[7] = listener, $[8] = boundaryElement, $[9] = elements, $[10] = t4, $[11] = t5) : (t4 = $[10], t5 = $[11]), react.useEffect(t4, t5), setElement;
|
|
394
205
|
}
|
|
395
206
|
function useClickOutsideEvent(listener, t0, boundaryElement) {
|
|
396
|
-
const $ =
|
|
207
|
+
const $ = reactCompilerRuntime.c(8), elementsArg = t0 === void 0 ? _temp$5 : t0;
|
|
397
208
|
let t1;
|
|
398
209
|
$[0] !== listener || $[1] !== boundaryElement || $[2] !== elementsArg ? (t1 = (evt) => {
|
|
399
210
|
if (!listener)
|
|
@@ -419,19 +230,19 @@ function useClickOutsideEvent(listener, t0, boundaryElement) {
|
|
|
419
230
|
return document.addEventListener("mousedown", handleEvent), () => {
|
|
420
231
|
document.removeEventListener("mousedown", handleEvent);
|
|
421
232
|
};
|
|
422
|
-
}, t3 = [hasListener, onEvent], $[4] = hasListener, $[5] = onEvent, $[6] = t2, $[7] = t3) : (t2 = $[6], t3 = $[7]),
|
|
233
|
+
}, t3 = [hasListener, onEvent], $[4] = hasListener, $[5] = onEvent, $[6] = t2, $[7] = t3) : (t2 = $[6], t3 = $[7]), react.useEffect(t2, t3), react.useDebugValue(listener ? "MouseDown On" : "MouseDown Off");
|
|
423
234
|
}
|
|
424
235
|
function _temp$5() {
|
|
425
236
|
return EMPTY_ARRAY;
|
|
426
237
|
}
|
|
427
238
|
function useCustomValidity(ref, customValidity) {
|
|
428
|
-
const $ =
|
|
239
|
+
const $ = reactCompilerRuntime.c(6);
|
|
429
240
|
let t0;
|
|
430
241
|
$[0] !== ref.current || $[1] !== customValidity ? (t0 = () => {
|
|
431
242
|
ref.current?.setCustomValidity(customValidity || "");
|
|
432
243
|
}, $[0] = ref.current, $[1] = customValidity, $[2] = t0) : t0 = $[2];
|
|
433
244
|
let t1;
|
|
434
|
-
$[3] !== customValidity || $[4] !== ref ? (t1 = [customValidity, ref], $[3] = customValidity, $[4] = ref, $[5] = t1) : t1 = $[5],
|
|
245
|
+
$[3] !== customValidity || $[4] !== ref ? (t1 = [customValidity, ref], $[3] = customValidity, $[4] = ref, $[5] = t1) : t1 = $[5], react.useEffect(t0, t1);
|
|
435
246
|
}
|
|
436
247
|
var resizeObservers = [], hasActiveObservations = function() {
|
|
437
248
|
return resizeObservers.some(function(ro) {
|
|
@@ -757,31 +568,31 @@ function _createElementSizeObserver() {
|
|
|
757
568
|
};
|
|
758
569
|
}
|
|
759
570
|
function useElementSize(element) {
|
|
760
|
-
const $ =
|
|
571
|
+
const $ = reactCompilerRuntime.c(3), [size2, setSize] = react.useState(null);
|
|
761
572
|
let t0, t1;
|
|
762
573
|
return $[0] !== element ? (t0 = () => {
|
|
763
574
|
if (element)
|
|
764
575
|
return _elementSizeObserver.subscribe(element, setSize);
|
|
765
|
-
}, t1 = [element], $[0] = element, $[1] = t0, $[2] = t1) : (t0 = $[1], t1 = $[2]),
|
|
576
|
+
}, t1 = [element], $[0] = element, $[1] = t0, $[2] = t1) : (t0 = $[1], t1 = $[2]), react.useEffect(t0, t1), size2;
|
|
766
577
|
}
|
|
767
578
|
function useElementRect(element) {
|
|
768
579
|
return useElementSize(element)?._contentRect || null;
|
|
769
580
|
}
|
|
770
581
|
function useForwardedRef(ref) {
|
|
771
|
-
const $ =
|
|
582
|
+
const $ = reactCompilerRuntime.c(1), innerRef = react.useRef(null);
|
|
772
583
|
let t0;
|
|
773
|
-
return $[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = () => innerRef.current, $[0] = t0) : t0 = $[0],
|
|
584
|
+
return $[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = () => innerRef.current, $[0] = t0) : t0 = $[0], react.useImperativeHandle(ref, t0), innerRef;
|
|
774
585
|
}
|
|
775
586
|
function useGlobalKeyDown(onKeyDown) {
|
|
776
|
-
const $ =
|
|
587
|
+
const $ = reactCompilerRuntime.c(3);
|
|
777
588
|
let t0, t1;
|
|
778
|
-
return $[0] !== onKeyDown ? (t0 = () => (addEventListener("keydown", onKeyDown), () => removeEventListener("keydown", onKeyDown)), t1 = [onKeyDown], $[0] = onKeyDown, $[1] = t0, $[2] = t1) : (t0 = $[1], t1 = $[2]),
|
|
589
|
+
return $[0] !== onKeyDown ? (t0 = () => (addEventListener("keydown", onKeyDown), () => removeEventListener("keydown", onKeyDown)), t1 = [onKeyDown], $[0] = onKeyDown, $[1] = t0, $[2] = t1) : (t0 = $[1], t1 = $[2]), react.useEffect(t0, t1);
|
|
779
590
|
}
|
|
780
591
|
function useMatchMedia(mediaQueryString, getServerSnapshot2) {
|
|
781
592
|
const {
|
|
782
593
|
subscribe: subscribe2,
|
|
783
594
|
getSnapshot
|
|
784
|
-
} =
|
|
595
|
+
} = react.useMemo(() => {
|
|
785
596
|
let MEDIA_QUERY_CACHE;
|
|
786
597
|
const getMatchMedia = () => (MEDIA_QUERY_CACHE || (MEDIA_QUERY_CACHE = window.matchMedia(mediaQueryString)), MEDIA_QUERY_CACHE);
|
|
787
598
|
return {
|
|
@@ -792,7 +603,7 @@ function useMatchMedia(mediaQueryString, getServerSnapshot2) {
|
|
|
792
603
|
getSnapshot: () => getMatchMedia().matches
|
|
793
604
|
};
|
|
794
605
|
}, [mediaQueryString]);
|
|
795
|
-
return
|
|
606
|
+
return react.useDebugValue(mediaQueryString), react.useSyncExternalStore(subscribe2, getSnapshot, getServerSnapshot2);
|
|
796
607
|
}
|
|
797
608
|
function getGlobalScope() {
|
|
798
609
|
if (typeof globalThis < "u") return globalThis;
|
|
@@ -804,32 +615,32 @@ function getGlobalScope() {
|
|
|
804
615
|
const globalScope = getGlobalScope();
|
|
805
616
|
function createGlobalScopedContext(key2, defaultValue) {
|
|
806
617
|
const symbol = Symbol.for(key2);
|
|
807
|
-
return typeof document > "u" ?
|
|
618
|
+
return typeof document > "u" ? react.createContext(defaultValue) : (globalScope[symbol] = globalScope[symbol] || react.createContext(defaultValue), globalScope[symbol]);
|
|
808
619
|
}
|
|
809
620
|
const ThemeContext = createGlobalScopedContext("@sanity/ui/context/theme", null);
|
|
810
621
|
function ThemeProvider(props) {
|
|
811
|
-
const parentTheme =
|
|
622
|
+
const parentTheme = react.useContext(ThemeContext), {
|
|
812
623
|
children,
|
|
813
624
|
scheme = parentTheme?.scheme || "light",
|
|
814
625
|
theme: rootTheme = parentTheme?.theme || null,
|
|
815
626
|
tone = parentTheme?.tone || "default"
|
|
816
|
-
} = props, themeContext =
|
|
627
|
+
} = props, themeContext = react.useMemo(() => rootTheme ? {
|
|
817
628
|
version: 0,
|
|
818
629
|
theme: rootTheme,
|
|
819
630
|
scheme,
|
|
820
631
|
tone
|
|
821
|
-
} : null, [rootTheme, scheme, tone]), theme$1 =
|
|
632
|
+
} : null, [rootTheme, scheme, tone]), theme$1 = react.useMemo(() => rootTheme ? theme.getScopedTheme(rootTheme, scheme, tone) : null, [scheme, rootTheme, tone]);
|
|
822
633
|
return theme$1 ? /* @__PURE__ */ jsxRuntime.jsx(ThemeContext.Provider, { value: themeContext, children: /* @__PURE__ */ jsxRuntime.jsx(styledComponents.ThemeProvider, { theme: theme$1, children }) }) : /* @__PURE__ */ jsxRuntime.jsx("pre", { children: 'ThemeProvider: no "theme" property provided' });
|
|
823
634
|
}
|
|
824
635
|
ThemeProvider.displayName = "ThemeProvider";
|
|
825
636
|
function useRootTheme() {
|
|
826
|
-
const value =
|
|
637
|
+
const value = react.useContext(ThemeContext);
|
|
827
638
|
if (!value)
|
|
828
639
|
throw new Error("useRootTheme(): missing context value");
|
|
829
640
|
return value;
|
|
830
641
|
}
|
|
831
642
|
function ThemeColorProvider(props) {
|
|
832
|
-
const $ =
|
|
643
|
+
const $ = reactCompilerRuntime.c(5), {
|
|
833
644
|
children,
|
|
834
645
|
scheme,
|
|
835
646
|
tone
|
|
@@ -842,7 +653,7 @@ function useTheme() {
|
|
|
842
653
|
return styledComponents.useTheme();
|
|
843
654
|
}
|
|
844
655
|
function useTheme_v2() {
|
|
845
|
-
const $ =
|
|
656
|
+
const $ = reactCompilerRuntime.c(2), t0 = styledComponents.useTheme();
|
|
846
657
|
let t1;
|
|
847
658
|
return $[0] !== t0 ? (t1 = theme.getTheme_v2(t0), $[0] = t0, $[1] = t1) : t1 = $[1], t1;
|
|
848
659
|
}
|
|
@@ -895,13 +706,13 @@ function getServerSnapshot() {
|
|
|
895
706
|
return 0;
|
|
896
707
|
}
|
|
897
708
|
function useMediaIndex() {
|
|
898
|
-
const $ =
|
|
709
|
+
const $ = reactCompilerRuntime.c(2), {
|
|
899
710
|
media
|
|
900
711
|
} = useTheme_v2();
|
|
901
712
|
let t0, t1;
|
|
902
713
|
$[0] !== media ? (t1 = _createMediaStore(media), $[0] = media, $[1] = t1) : t1 = $[1], t0 = t1;
|
|
903
714
|
const store = t0;
|
|
904
|
-
return
|
|
715
|
+
return react.useSyncExternalStore(store.subscribe, store.getSnapshot, getServerSnapshot);
|
|
905
716
|
}
|
|
906
717
|
function usePrefersDark(t0) {
|
|
907
718
|
return useMatchMedia("(prefers-color-scheme: dark)", t0 === void 0 ? _temp$4 : t0);
|
|
@@ -1626,8 +1437,8 @@ const Root$C = styledComponents.styled.div(responsiveLabelFont, responsiveTextAl
|
|
|
1626
1437
|
text-overflow: ellipsis;
|
|
1627
1438
|
overflow: hidden;
|
|
1628
1439
|
overflow: clip;
|
|
1629
|
-
`, Label =
|
|
1630
|
-
const $ =
|
|
1440
|
+
`, Label = react.forwardRef(function(props, ref) {
|
|
1441
|
+
const $ = reactCompilerRuntime.c(22);
|
|
1631
1442
|
let t0, t1, childrenProp, textOverflow, align, restProps, accent, weight;
|
|
1632
1443
|
$[0] !== props ? ({
|
|
1633
1444
|
accent,
|
|
@@ -1798,8 +1609,8 @@ function avatarStrokeStyle() {
|
|
|
1798
1609
|
}
|
|
1799
1610
|
const Root$B = styledComponents.styled.div(responsiveAvatarSizeStyle, avatarStyle.root), Arrow$1 = styledComponents.styled.div(avatarStyle.arrow), BgStroke = styledComponents.styled.ellipse(avatarStyle.bgStroke), Stroke = styledComponents.styled.ellipse(avatarStyle.stroke), Initials = styledComponents.styled.div(avatarStyle.initials), InitialsLabel = styledComponents.styled(Label)({
|
|
1800
1611
|
color: "inherit"
|
|
1801
|
-
}), Image = styledComponents.styled.svg(avatarStyle.image), Avatar =
|
|
1802
|
-
const $ =
|
|
1612
|
+
}), Image = styledComponents.styled.svg(avatarStyle.image), Avatar = react.forwardRef(function(props, ref) {
|
|
1613
|
+
const $ = reactCompilerRuntime.c(53);
|
|
1803
1614
|
let t0, t1, t2, asProp, animateArrowFrom, arrowPositionProp, src, onImageLoadError, __unstable_hideInnerStroke, initials, restProps, title;
|
|
1804
1615
|
$[0] !== props ? ({
|
|
1805
1616
|
__unstable_hideInnerStroke,
|
|
@@ -1817,18 +1628,18 @@ const Root$B = styledComponents.styled.div(responsiveAvatarSizeStyle, avatarStyl
|
|
|
1817
1628
|
} = props, $[0] = props, $[1] = t0, $[2] = t1, $[3] = t2, $[4] = asProp, $[5] = animateArrowFrom, $[6] = arrowPositionProp, $[7] = src, $[8] = onImageLoadError, $[9] = __unstable_hideInnerStroke, $[10] = initials, $[11] = restProps, $[12] = title) : (t0 = $[1], t1 = $[2], t2 = $[3], asProp = $[4], animateArrowFrom = $[5], arrowPositionProp = $[6], src = $[7], onImageLoadError = $[8], __unstable_hideInnerStroke = $[9], initials = $[10], restProps = $[11], title = $[12]);
|
|
1818
1629
|
const color = t0 === void 0 ? "gray" : t0, status = t1 === void 0 ? "online" : t1, sizeProp = t2 === void 0 ? 1 : t2, {
|
|
1819
1630
|
avatar
|
|
1820
|
-
} = useTheme_v2(), as = ReactIs__default.default.isValidElementType(asProp) ? asProp : "div", size2 = useArrayProp(sizeProp), _sizeRem = (avatar.sizes[size2[0]] || avatar.sizes[0]).size, _radius = _sizeRem / 2, elementId =
|
|
1631
|
+
} = useTheme_v2(), as = ReactIs__default.default.isValidElementType(asProp) ? asProp : "div", size2 = useArrayProp(sizeProp), _sizeRem = (avatar.sizes[size2[0]] || avatar.sizes[0]).size, _radius = _sizeRem / 2, elementId = react.useId(), [arrowPosition, setArrowPosition] = react.useState(animateArrowFrom || arrowPositionProp || "inside"), [imageFailed, setImageFailed] = react.useState(!1), imageId = `avatar-image-${elementId}`;
|
|
1821
1632
|
let t3, t4;
|
|
1822
1633
|
$[13] !== arrowPosition || $[14] !== arrowPositionProp ? (t3 = () => {
|
|
1823
1634
|
if (arrowPosition === arrowPositionProp)
|
|
1824
1635
|
return;
|
|
1825
1636
|
const raf = requestAnimationFrame(() => setArrowPosition(arrowPositionProp));
|
|
1826
1637
|
return () => cancelAnimationFrame(raf);
|
|
1827
|
-
}, t4 = [arrowPosition, arrowPositionProp], $[13] = arrowPosition, $[14] = arrowPositionProp, $[15] = t3, $[16] = t4) : (t3 = $[15], t4 = $[16]),
|
|
1638
|
+
}, t4 = [arrowPosition, arrowPositionProp], $[13] = arrowPosition, $[14] = arrowPositionProp, $[15] = t3, $[16] = t4) : (t3 = $[15], t4 = $[16]), react.useEffect(t3, t4);
|
|
1828
1639
|
let t5, t6;
|
|
1829
1640
|
$[17] !== src ? (t5 = () => {
|
|
1830
1641
|
src && setImageFailed(!1);
|
|
1831
|
-
}, t6 = [src], $[17] = src, $[18] = t5, $[19] = t6) : (t5 = $[18], t6 = $[19]),
|
|
1642
|
+
}, t6 = [src], $[17] = src, $[18] = t5, $[19] = t6) : (t5 = $[18], t6 = $[19]), react.useEffect(t5, t6);
|
|
1832
1643
|
let t7;
|
|
1833
1644
|
$[20] !== onImageLoadError ? (t7 = () => {
|
|
1834
1645
|
setImageFailed(!0), onImageLoadError && onImageLoadError(new Error("Avatar: the image failed to load"));
|
|
@@ -1897,8 +1708,8 @@ function _avatarCounterBaseStyle(props) {
|
|
|
1897
1708
|
}
|
|
1898
1709
|
`;
|
|
1899
1710
|
}
|
|
1900
|
-
const Root$A = styledComponents.styled.div(_responsiveAvatarCounterSizeStyle, _avatarCounterBaseStyle), AvatarCounter =
|
|
1901
|
-
const $ =
|
|
1711
|
+
const Root$A = styledComponents.styled.div(_responsiveAvatarCounterSizeStyle, _avatarCounterBaseStyle), AvatarCounter = react.forwardRef(function(props, ref) {
|
|
1712
|
+
const $ = reactCompilerRuntime.c(10), {
|
|
1902
1713
|
count,
|
|
1903
1714
|
size: t0
|
|
1904
1715
|
} = props, size2 = useArrayProp(t0 === void 0 ? 1 : t0);
|
|
@@ -1944,24 +1755,24 @@ function responsiveAvatarStackSizeStyle(props) {
|
|
|
1944
1755
|
} : EMPTY_RECORD;
|
|
1945
1756
|
});
|
|
1946
1757
|
}
|
|
1947
|
-
const Root$z = styledComponents.styled.div(responsiveAvatarStackSizeStyle, avatarStackStyle), AvatarStack =
|
|
1758
|
+
const Root$z = styledComponents.styled.div(responsiveAvatarStackSizeStyle, avatarStackStyle), AvatarStack = react.forwardRef(function(props, ref) {
|
|
1948
1759
|
const {
|
|
1949
1760
|
children: childrenProp,
|
|
1950
1761
|
maxLength: maxLengthProp = 4,
|
|
1951
1762
|
size: sizeProp = 1,
|
|
1952
1763
|
...restProps
|
|
1953
|
-
} = props, children =
|
|
1764
|
+
} = props, children = react.useMemo(() => react.Children.toArray(childrenProp).filter(react.isValidElement), [childrenProp]), maxLength = Math.max(maxLengthProp, 0), size2 = useArrayProp(sizeProp), len = children.length, visibleCount = maxLength - 1, extraCount = len - visibleCount, visibleChildren = extraCount > 1 ? children.slice(extraCount, len) : children;
|
|
1954
1765
|
return /* @__PURE__ */ jsxRuntime.jsxs(Root$z, { "data-ui": "AvatarStack", ...restProps, ref, $size: size2, children: [
|
|
1955
1766
|
len === 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(AvatarCounter, { count: len, size: size2 }) }),
|
|
1956
1767
|
len !== 0 && extraCount > 1 && /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(AvatarCounter, { count: extraCount, size: size2 }) }),
|
|
1957
|
-
visibleChildren.map((child, childIndex) => /* @__PURE__ */ jsxRuntime.jsx("div", { children:
|
|
1768
|
+
visibleChildren.map((child, childIndex) => /* @__PURE__ */ jsxRuntime.jsx("div", { children: react.cloneElement(child, {
|
|
1958
1769
|
size: size2
|
|
1959
1770
|
}) }, String(childIndex)))
|
|
1960
1771
|
] });
|
|
1961
1772
|
});
|
|
1962
1773
|
AvatarStack.displayName = "ForwardRef(AvatarStack)";
|
|
1963
|
-
const Root$y = styledComponents.styled.div(boxStyle, flexItemStyle, responsiveBoxStyle, responsiveGridItemStyle, responsiveMarginStyle, responsivePaddingStyle), Box =
|
|
1964
|
-
const $ =
|
|
1774
|
+
const Root$y = styledComponents.styled.div(boxStyle, flexItemStyle, responsiveBoxStyle, responsiveGridItemStyle, responsiveMarginStyle, responsivePaddingStyle), Box = react.forwardRef(function(props, ref) {
|
|
1775
|
+
const $ = reactCompilerRuntime.c(59);
|
|
1965
1776
|
let t0, t1, t2, t3, column, columnStart, columnEnd, flex, height, marginX, marginY, marginTop, marginRight, marginBottom, marginLeft, overflow, paddingX, paddingY, paddingTop, paddingRight, paddingBottom, paddingLeft, row, rowStart, rowEnd, sizing, restProps;
|
|
1966
1777
|
$[0] !== props ? ({
|
|
1967
1778
|
as: t0,
|
|
@@ -2071,8 +1882,8 @@ const Root$x = styledComponents.styled.div(responsiveTextFont, responsiveTextAli
|
|
|
2071
1882
|
text-overflow: ellipsis;
|
|
2072
1883
|
overflow: hidden;
|
|
2073
1884
|
overflow: clip;
|
|
2074
|
-
`, Text =
|
|
2075
|
-
const $ =
|
|
1885
|
+
`, Text = react.forwardRef(function(props, ref) {
|
|
1886
|
+
const $ = reactCompilerRuntime.c(22);
|
|
2076
1887
|
let t0, t1, t2, childrenProp, textOverflow, align, restProps, weight;
|
|
2077
1888
|
$[0] !== props ? ({
|
|
2078
1889
|
accent: t0,
|
|
@@ -2112,8 +1923,8 @@ function badgeStyle(props) {
|
|
|
2112
1923
|
}
|
|
2113
1924
|
};
|
|
2114
1925
|
}
|
|
2115
|
-
const Root$w = styledComponents.styled(Box)(responsiveRadiusStyle, badgeStyle), Badge =
|
|
2116
|
-
const $ =
|
|
1926
|
+
const Root$w = styledComponents.styled(Box)(responsiveRadiusStyle, badgeStyle), Badge = react.forwardRef(function(props, ref) {
|
|
1927
|
+
const $ = reactCompilerRuntime.c(17);
|
|
2117
1928
|
let t0, t1, t2, t3, children, restProps;
|
|
2118
1929
|
if ($[0] !== props) {
|
|
2119
1930
|
const {
|
|
@@ -2135,8 +1946,8 @@ const Root$w = styledComponents.styled(Box)(responsiveRadiusStyle, badgeStyle),
|
|
|
2135
1946
|
return $[10] !== restProps || $[11] !== tone || $[12] !== t4 || $[13] !== t5 || $[14] !== ref || $[15] !== t6 ? (t7 = /* @__PURE__ */ jsxRuntime.jsx(Root$w, { "data-ui": "Badge", ...restProps, $tone: tone, $radius: t4, padding: t5, ref, children: t6 }), $[10] = restProps, $[11] = tone, $[12] = t4, $[13] = t5, $[14] = ref, $[15] = t6, $[16] = t7) : t7 = $[16], t7;
|
|
2136
1947
|
});
|
|
2137
1948
|
Badge.displayName = "ForwardRef(Badge)";
|
|
2138
|
-
const Root$v = styledComponents.styled(Box)(flexItemStyle, responsiveFlexStyle), Flex =
|
|
2139
|
-
const $ =
|
|
1949
|
+
const Root$v = styledComponents.styled(Box)(flexItemStyle, responsiveFlexStyle), Flex = react.forwardRef(function(props, ref) {
|
|
1950
|
+
const $ = reactCompilerRuntime.c(17);
|
|
2140
1951
|
let t0, align, gap, justify, wrap, restProps, as;
|
|
2141
1952
|
$[0] !== props ? ({
|
|
2142
1953
|
align,
|
|
@@ -2164,8 +1975,8 @@ const rotate$1 = styledComponents.keyframes`
|
|
|
2164
1975
|
& > span > svg {
|
|
2165
1976
|
animation: ${rotate$1} 500ms linear infinite;
|
|
2166
1977
|
}
|
|
2167
|
-
`, Spinner =
|
|
2168
|
-
const $ =
|
|
1978
|
+
`, Spinner = react.forwardRef(function(props, ref) {
|
|
1979
|
+
const $ = reactCompilerRuntime.c(4);
|
|
2169
1980
|
let t0;
|
|
2170
1981
|
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = /* @__PURE__ */ jsxRuntime.jsx(icons.SpinnerIcon, {}), $[0] = t0) : t0 = $[0];
|
|
2171
1982
|
let t1;
|
|
@@ -2345,8 +2156,8 @@ const Root$t = styledComponents.styled.button(responsiveRadiusStyle, buttonBaseS
|
|
|
2345
2156
|
border-radius: inherit;
|
|
2346
2157
|
z-index: 1;
|
|
2347
2158
|
box-shadow: inherit;
|
|
2348
|
-
`, Button =
|
|
2349
|
-
const $ =
|
|
2159
|
+
`, Button = react.forwardRef(function(props, ref) {
|
|
2160
|
+
const $ = reactCompilerRuntime.c(64);
|
|
2350
2161
|
let t0, t1, t2, t3, t4, t5, t6, t7, t8, paddingXProp, paddingYProp, paddingTopProp, paddingBottomProp, paddingLeftProp, paddingRightProp, loading, disabled, selected, IconComponent, text, IconRightComponent, textAlign, children, restProps, width;
|
|
2351
2162
|
$[0] !== props ? ({
|
|
2352
2163
|
children,
|
|
@@ -2394,12 +2205,12 @@ const Root$t = styledComponents.styled.button(responsiveRadiusStyle, buttonBaseS
|
|
|
2394
2205
|
let t15;
|
|
2395
2206
|
$[36] !== IconComponent || $[37] !== text || $[38] !== IconRightComponent || $[39] !== fontSize2 || $[40] !== muted || $[41] !== textAlign || $[42] !== button || $[43] !== justify || $[44] !== space || $[45] !== boxProps ? (t15 = (IconComponent || text || IconRightComponent) && /* @__PURE__ */ jsxRuntime.jsx(Box, { as: "span", ...boxProps, children: /* @__PURE__ */ jsxRuntime.jsxs(Flex, { as: "span", justify, gap: space, children: [
|
|
2396
2207
|
IconComponent && /* @__PURE__ */ jsxRuntime.jsxs(Text, { size: fontSize2, children: [
|
|
2397
|
-
|
|
2208
|
+
react.isValidElement(IconComponent) && IconComponent,
|
|
2398
2209
|
ReactIs.isValidElementType(IconComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconComponent, {})
|
|
2399
2210
|
] }),
|
|
2400
2211
|
text && /* @__PURE__ */ jsxRuntime.jsx(Box, { children: /* @__PURE__ */ jsxRuntime.jsx(Text, { muted, align: textAlign, size: fontSize2, textOverflow: "ellipsis", weight: button.textWeight, children: text }) }),
|
|
2401
2212
|
IconRightComponent && /* @__PURE__ */ jsxRuntime.jsxs(Text, { size: fontSize2, children: [
|
|
2402
|
-
|
|
2213
|
+
react.isValidElement(IconRightComponent) && IconRightComponent,
|
|
2403
2214
|
ReactIs.isValidElementType(IconRightComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconRightComponent, {})
|
|
2404
2215
|
] })
|
|
2405
2216
|
] }) }), $[36] = IconComponent, $[37] = text, $[38] = IconRightComponent, $[39] = fontSize2, $[40] = muted, $[41] = textAlign, $[42] = button, $[43] = justify, $[44] = space, $[45] = boxProps, $[46] = t15) : t15 = $[46];
|
|
@@ -2561,8 +2372,8 @@ function cardColorStyle(props) {
|
|
|
2561
2372
|
${style?.card?.root}
|
|
2562
2373
|
`;
|
|
2563
2374
|
}
|
|
2564
|
-
const Root$s = styledComponents.styled(Box)(responsiveBorderStyle, responsiveRadiusStyle, responsiveShadowStyle, cardStyle), Card =
|
|
2565
|
-
const $ =
|
|
2375
|
+
const Root$s = styledComponents.styled(Box)(responsiveBorderStyle, responsiveRadiusStyle, responsiveShadowStyle, cardStyle), Card = react.forwardRef(function(props, ref) {
|
|
2376
|
+
const $ = reactCompilerRuntime.c(42);
|
|
2566
2377
|
let t0, t1, t2, t3, asProp, border2, borderTop2, borderRight2, borderBottom2, borderLeft2, shadow, pressed, selected, restProps, muted, scheme;
|
|
2567
2378
|
$[0] !== props ? ({
|
|
2568
2379
|
__unstable_checkered: t0,
|
|
@@ -2727,8 +2538,8 @@ function inputElementStyles(props) {
|
|
|
2727
2538
|
}
|
|
2728
2539
|
`;
|
|
2729
2540
|
}
|
|
2730
|
-
const Root$r = styledComponents.styled.div(checkboxBaseStyles), Input$5 = styledComponents.styled.input(inputElementStyles), Checkbox =
|
|
2731
|
-
const $ =
|
|
2541
|
+
const Root$r = styledComponents.styled.div(checkboxBaseStyles), Input$5 = styledComponents.styled.input(inputElementStyles), Checkbox = react.forwardRef(function(props, forwardedRef) {
|
|
2542
|
+
const $ = reactCompilerRuntime.c(25);
|
|
2732
2543
|
let indeterminate, customValidity, disabled, readOnly, restProps, checked, className, style;
|
|
2733
2544
|
$[0] !== props ? ({
|
|
2734
2545
|
checked,
|
|
@@ -2740,13 +2551,13 @@ const Root$r = styledComponents.styled.div(checkboxBaseStyles), Input$5 = styled
|
|
|
2740
2551
|
style,
|
|
2741
2552
|
...restProps
|
|
2742
2553
|
} = props, $[0] = props, $[1] = indeterminate, $[2] = customValidity, $[3] = disabled, $[4] = readOnly, $[5] = restProps, $[6] = checked, $[7] = className, $[8] = style) : (indeterminate = $[1], customValidity = $[2], disabled = $[3], readOnly = $[4], restProps = $[5], checked = $[6], className = $[7], style = $[8]);
|
|
2743
|
-
const ref =
|
|
2554
|
+
const ref = react.useRef(null);
|
|
2744
2555
|
let t0;
|
|
2745
|
-
$[9] === Symbol.for("react.memo_cache_sentinel") ? (t0 = () => ref.current, $[9] = t0) : t0 = $[9],
|
|
2556
|
+
$[9] === Symbol.for("react.memo_cache_sentinel") ? (t0 = () => ref.current, $[9] = t0) : t0 = $[9], react.useImperativeHandle(forwardedRef, t0);
|
|
2746
2557
|
let t1, t2;
|
|
2747
2558
|
$[10] !== indeterminate ? (t1 = () => {
|
|
2748
2559
|
ref.current && (ref.current.indeterminate = indeterminate || !1);
|
|
2749
|
-
}, t2 = [indeterminate], $[10] = indeterminate, $[11] = t1, $[12] = t2) : (t1 = $[11], t2 = $[12]),
|
|
2560
|
+
}, t2 = [indeterminate], $[10] = indeterminate, $[11] = t1, $[12] = t2) : (t1 = $[11], t2 = $[12]), react.useEffect(t1, t2), useCustomValidity(ref, customValidity);
|
|
2750
2561
|
const t3 = !disabled && readOnly ? "" : void 0, t4 = customValidity ? "" : void 0, t5 = disabled || readOnly;
|
|
2751
2562
|
let t6;
|
|
2752
2563
|
$[13] !== t3 || $[14] !== t4 || $[15] !== restProps || $[16] !== checked || $[17] !== t5 || $[18] !== readOnly ? (t6 = /* @__PURE__ */ jsxRuntime.jsx(Input$5, { "data-read-only": t3, "data-error": t4, ...restProps, checked, disabled: t5, type: "checkbox", readOnly, ref }), $[13] = t3, $[14] = t4, $[15] = restProps, $[16] = checked, $[17] = t5, $[18] = readOnly, $[19] = t6) : t6 = $[19];
|
|
@@ -2910,8 +2721,8 @@ function codeBaseStyle() {
|
|
|
2910
2721
|
}
|
|
2911
2722
|
`;
|
|
2912
2723
|
}
|
|
2913
|
-
const Root$q = styledComponents.styled.pre(codeBaseStyle, responsiveCodeFontStyle), Code =
|
|
2914
|
-
const $ =
|
|
2724
|
+
const Root$q = styledComponents.styled.pre(codeBaseStyle, responsiveCodeFontStyle), Code = react.forwardRef(function(props, ref) {
|
|
2725
|
+
const $ = reactCompilerRuntime.c(23);
|
|
2915
2726
|
let t0, languageProp, children, restProps, weight;
|
|
2916
2727
|
$[0] !== props ? ({
|
|
2917
2728
|
children,
|
|
@@ -2951,8 +2762,8 @@ function responsiveContainerWidthStyle(props) {
|
|
|
2951
2762
|
maxWidth: val === "auto" ? "none" : rem(container[val])
|
|
2952
2763
|
}));
|
|
2953
2764
|
}
|
|
2954
|
-
const Root$p = styledComponents.styled(Box)(containerBaseStyle, responsiveContainerWidthStyle), Container =
|
|
2955
|
-
const $ =
|
|
2765
|
+
const Root$p = styledComponents.styled(Box)(containerBaseStyle, responsiveContainerWidthStyle), Container = react.forwardRef(function(props, ref) {
|
|
2766
|
+
const $ = reactCompilerRuntime.c(9);
|
|
2956
2767
|
let t0, restProps, as;
|
|
2957
2768
|
$[0] !== props ? ({
|
|
2958
2769
|
as,
|
|
@@ -2964,8 +2775,8 @@ const Root$p = styledComponents.styled(Box)(containerBaseStyle, responsiveContai
|
|
|
2964
2775
|
return $[4] !== restProps || $[5] !== t1 || $[6] !== as || $[7] !== ref ? (t2 = /* @__PURE__ */ jsxRuntime.jsx(Root$p, { "data-ui": "Container", ...restProps, $width: t1, forwardedAs: as, ref }), $[4] = restProps, $[5] = t1, $[6] = as, $[7] = ref, $[8] = t2) : t2 = $[8], t2;
|
|
2965
2776
|
});
|
|
2966
2777
|
Container.displayName = "ForwardRef(Container)";
|
|
2967
|
-
const Root$o = styledComponents.styled(Box)(responsiveGridStyle), Grid =
|
|
2968
|
-
const $ =
|
|
2778
|
+
const Root$o = styledComponents.styled(Box)(responsiveGridStyle), Grid = react.forwardRef(function(props, ref) {
|
|
2779
|
+
const $ = reactCompilerRuntime.c(26);
|
|
2969
2780
|
let as, autoRows, autoCols, autoFlow, columns, gap, gapX, gapY, rows, restProps, children;
|
|
2970
2781
|
$[0] !== props ? ({
|
|
2971
2782
|
as,
|
|
@@ -3050,8 +2861,8 @@ const Root$n = styledComponents.styled.div(headingBaseStyle, responsiveTextAlign
|
|
|
3050
2861
|
text-overflow: ellipsis;
|
|
3051
2862
|
overflow: hidden;
|
|
3052
2863
|
overflow: clip;
|
|
3053
|
-
`, Heading =
|
|
3054
|
-
const $ =
|
|
2864
|
+
`, Heading = react.forwardRef(function(props, ref) {
|
|
2865
|
+
const $ = reactCompilerRuntime.c(22);
|
|
3055
2866
|
let t0, t1, t2, childrenProp, textOverflow, align, restProps, weight;
|
|
3056
2867
|
$[0] !== props ? ({
|
|
3057
2868
|
accent: t0,
|
|
@@ -3103,8 +2914,8 @@ function inlineSpaceStyle(props) {
|
|
|
3103
2914
|
};
|
|
3104
2915
|
});
|
|
3105
2916
|
}
|
|
3106
|
-
const Root$m = styledComponents.styled(Box)(inlineBaseStyle, inlineSpaceStyle), Inline =
|
|
3107
|
-
const $ =
|
|
2917
|
+
const Root$m = styledComponents.styled(Box)(inlineBaseStyle, inlineSpaceStyle), Inline = react.forwardRef(function(props, ref) {
|
|
2918
|
+
const $ = reactCompilerRuntime.c(13);
|
|
3108
2919
|
let childrenProp, space, restProps, as;
|
|
3109
2920
|
$[0] !== props ? ({
|
|
3110
2921
|
as,
|
|
@@ -3115,7 +2926,7 @@ const Root$m = styledComponents.styled(Box)(inlineBaseStyle, inlineSpaceStyle),
|
|
|
3115
2926
|
let t0, t1;
|
|
3116
2927
|
if ($[5] !== childrenProp) {
|
|
3117
2928
|
let t22;
|
|
3118
|
-
$[7] === Symbol.for("react.memo_cache_sentinel") ? (t22 = (child) => child && /* @__PURE__ */ jsxRuntime.jsx("div", { children: child }), $[7] = t22) : t22 = $[7], t1 =
|
|
2929
|
+
$[7] === Symbol.for("react.memo_cache_sentinel") ? (t22 = (child) => child && /* @__PURE__ */ jsxRuntime.jsx("div", { children: child }), $[7] = t22) : t22 = $[7], t1 = react.Children.map(childrenProp, t22), $[5] = childrenProp, $[6] = t1;
|
|
3119
2930
|
} else
|
|
3120
2931
|
t1 = $[6];
|
|
3121
2932
|
t0 = t1;
|
|
@@ -3141,8 +2952,8 @@ function kbdStyle() {
|
|
|
3141
2952
|
}
|
|
3142
2953
|
`;
|
|
3143
2954
|
}
|
|
3144
|
-
const Root$l = styledComponents.styled.kbd(responsiveRadiusStyle, kbdStyle), KBD =
|
|
3145
|
-
const $ =
|
|
2955
|
+
const Root$l = styledComponents.styled.kbd(responsiveRadiusStyle, kbdStyle), KBD = react.forwardRef(function(props, ref) {
|
|
2956
|
+
const $ = reactCompilerRuntime.c(17);
|
|
3146
2957
|
let t0, t1, t2, children, restProps;
|
|
3147
2958
|
$[0] !== props ? ({
|
|
3148
2959
|
children,
|
|
@@ -3279,8 +3090,8 @@ const Root$k = styledComponents.styled.div(({
|
|
|
3279
3090
|
stroke: var(--card-shadow-outline-color);
|
|
3280
3091
|
`, ShapePath = styledComponents.styled.path`
|
|
3281
3092
|
fill: var(--card-bg-color);
|
|
3282
|
-
`, Arrow =
|
|
3283
|
-
const $ =
|
|
3093
|
+
`, Arrow = react.forwardRef(function(props, ref) {
|
|
3094
|
+
const $ = reactCompilerRuntime.c(24);
|
|
3284
3095
|
let t0, w, h, restProps;
|
|
3285
3096
|
$[0] !== props ? ({
|
|
3286
3097
|
width: w,
|
|
@@ -3328,7 +3139,7 @@ const Root$k = styledComponents.styled.div(({
|
|
|
3328
3139
|
Arrow.displayName = "ForwardRef(Arrow)";
|
|
3329
3140
|
const BoundaryElementContext = createGlobalScopedContext("@sanity/ui/context/boundaryElement", null);
|
|
3330
3141
|
function BoundaryElementProvider(props) {
|
|
3331
|
-
const $ =
|
|
3142
|
+
const $ = reactCompilerRuntime.c(5), {
|
|
3332
3143
|
children,
|
|
3333
3144
|
element
|
|
3334
3145
|
} = props;
|
|
@@ -3350,7 +3161,7 @@ const DEFAULT_VALUE = {
|
|
|
3350
3161
|
element: null
|
|
3351
3162
|
};
|
|
3352
3163
|
function useBoundaryElement() {
|
|
3353
|
-
const value =
|
|
3164
|
+
const value = react.useContext(BoundaryElementContext);
|
|
3354
3165
|
if (value && (!isRecord(value) || value.version !== 0))
|
|
3355
3166
|
throw new Error("useBoundaryElement(): the context value is not compatible");
|
|
3356
3167
|
return value || DEFAULT_VALUE;
|
|
@@ -3375,20 +3186,20 @@ function findMinBreakpoints(media, width) {
|
|
|
3375
3186
|
media[i] <= width && ret.push(i);
|
|
3376
3187
|
return ret;
|
|
3377
3188
|
}
|
|
3378
|
-
const ElementQuery =
|
|
3189
|
+
const ElementQuery = react.forwardRef(function(props, forwardedRef) {
|
|
3379
3190
|
const theme2 = useTheme_v2(), {
|
|
3380
3191
|
children,
|
|
3381
3192
|
media = theme2.media,
|
|
3382
3193
|
...restProps
|
|
3383
|
-
} = props, ref =
|
|
3384
|
-
|
|
3385
|
-
const setRef =
|
|
3194
|
+
} = props, ref = react.useRef(null), [element, setElement] = react.useState(null), elementSize = useElementSize(element), width = react.useMemo(() => elementSize?.border.width ?? window.innerWidth, [elementSize]), max = react.useMemo(() => findMaxBreakpoints(media, width), [media, width]), min = react.useMemo(() => findMinBreakpoints(media, width), [media, width]);
|
|
3195
|
+
react.useImperativeHandle(forwardedRef, () => ref.current);
|
|
3196
|
+
const setRef = react.useCallback((el) => {
|
|
3386
3197
|
ref.current = el, setElement(el);
|
|
3387
3198
|
}, []);
|
|
3388
3199
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-ui": "ElementQuery", ...restProps, "data-eq-max": max.length ? max.join(" ") : void 0, "data-eq-min": min.length ? min.join(" ") : void 0, ref: setRef, children });
|
|
3389
3200
|
});
|
|
3390
3201
|
ElementQuery.displayName = "ForwardRef(ElementQuery)";
|
|
3391
|
-
class ErrorBoundary extends
|
|
3202
|
+
class ErrorBoundary extends react.Component {
|
|
3392
3203
|
state = {
|
|
3393
3204
|
error: null
|
|
3394
3205
|
};
|
|
@@ -3425,7 +3236,7 @@ function getLayerContext(contextValue) {
|
|
|
3425
3236
|
}
|
|
3426
3237
|
const LayerContext = createGlobalScopedContext("@sanity/ui/context/layer", null);
|
|
3427
3238
|
function useLayer() {
|
|
3428
|
-
const $ =
|
|
3239
|
+
const $ = reactCompilerRuntime.c(2), value = react.useContext(LayerContext);
|
|
3429
3240
|
if (!value)
|
|
3430
3241
|
throw new Error("useLayer(): missing context value");
|
|
3431
3242
|
try {
|
|
@@ -3515,7 +3326,7 @@ function LayerProvider(props) {
|
|
|
3515
3326
|
const {
|
|
3516
3327
|
children,
|
|
3517
3328
|
zOffset: zOffsetProp = 0
|
|
3518
|
-
} = props, parentContextValue =
|
|
3329
|
+
} = props, parentContextValue = react.useContext(LayerContext), parent = parentContextValue && getLayerContext(parentContextValue), parentRegisterChild = parent?.registerChild, level = (parent?.level ?? 0) + 1, zOffset = useArrayProp(zOffsetProp), maxMediaIndex = zOffset.length - 1, mediaIndex = Math.min(useMediaIndex(), maxMediaIndex), zIndex = parent ? parent.zIndex + zOffset[mediaIndex] : zOffset[mediaIndex], [, setChildLayers] = react.useState({}), [size2, setSize] = react.useState(0), isTopLayer = size2 === 0, registerChild = react.useCallback((childLevel) => {
|
|
3519
3330
|
const parentDispose = parentRegisterChild?.(childLevel);
|
|
3520
3331
|
return childLevel !== void 0 ? setChildLayers((state) => {
|
|
3521
3332
|
const prevLen = state[childLevel] ?? 0, nextState = {
|
|
@@ -3532,8 +3343,8 @@ function LayerProvider(props) {
|
|
|
3532
3343
|
}) : setSize((v_0) => v_0 - 1), parentDispose?.();
|
|
3533
3344
|
};
|
|
3534
3345
|
}, [parentRegisterChild]);
|
|
3535
|
-
|
|
3536
|
-
const value =
|
|
3346
|
+
react.useEffect(() => parentRegisterChild?.(level), [level, parentRegisterChild]);
|
|
3347
|
+
const value = react.useMemo(() => ({
|
|
3537
3348
|
version: 0,
|
|
3538
3349
|
isTopLayer,
|
|
3539
3350
|
level,
|
|
@@ -3546,8 +3357,8 @@ function LayerProvider(props) {
|
|
|
3546
3357
|
LayerProvider.displayName = "LayerProvider";
|
|
3547
3358
|
const Root$j = styledComponents.styled.div({
|
|
3548
3359
|
position: "relative"
|
|
3549
|
-
}), LayerChildren =
|
|
3550
|
-
const $ =
|
|
3360
|
+
}), LayerChildren = react.forwardRef(function(props, forwardedRef) {
|
|
3361
|
+
const $ = reactCompilerRuntime.c(22);
|
|
3551
3362
|
let t0, onActivate, onFocus, restProps, children;
|
|
3552
3363
|
$[0] !== props ? ({
|
|
3553
3364
|
children,
|
|
@@ -3559,15 +3370,15 @@ const Root$j = styledComponents.styled.div({
|
|
|
3559
3370
|
const style = t0 === void 0 ? EMPTY_RECORD : t0, {
|
|
3560
3371
|
zIndex,
|
|
3561
3372
|
isTopLayer
|
|
3562
|
-
} = useLayer(), lastFocusedRef =
|
|
3373
|
+
} = useLayer(), lastFocusedRef = react.useRef(null), ref = react.useRef(null), isTopLayerRef = react.useRef(isTopLayer);
|
|
3563
3374
|
let t1;
|
|
3564
|
-
$[6] === Symbol.for("react.memo_cache_sentinel") ? (t1 = () => ref.current, $[6] = t1) : t1 = $[6],
|
|
3375
|
+
$[6] === Symbol.for("react.memo_cache_sentinel") ? (t1 = () => ref.current, $[6] = t1) : t1 = $[6], react.useImperativeHandle(forwardedRef, t1);
|
|
3565
3376
|
let t2, t3;
|
|
3566
3377
|
$[7] !== isTopLayer || $[8] !== onActivate ? (t2 = () => {
|
|
3567
3378
|
isTopLayerRef.current !== isTopLayer && isTopLayer && onActivate?.({
|
|
3568
3379
|
activeElement: lastFocusedRef.current
|
|
3569
3380
|
}), isTopLayerRef.current = isTopLayer;
|
|
3570
|
-
}, t3 = [isTopLayer, onActivate], $[7] = isTopLayer, $[8] = onActivate, $[9] = t2, $[10] = t3) : (t2 = $[9], t3 = $[10]),
|
|
3381
|
+
}, t3 = [isTopLayer, onActivate], $[7] = isTopLayer, $[8] = onActivate, $[9] = t2, $[10] = t3) : (t2 = $[9], t3 = $[10]), react.useEffect(t2, t3);
|
|
3571
3382
|
let t4;
|
|
3572
3383
|
$[11] !== onFocus || $[12] !== isTopLayer ? (t4 = (event) => {
|
|
3573
3384
|
onFocus?.(event);
|
|
@@ -3582,8 +3393,8 @@ const Root$j = styledComponents.styled.div({
|
|
|
3582
3393
|
}, $[14] = style, $[15] = zIndex, $[16] = t5) : t5 = $[16];
|
|
3583
3394
|
let t6;
|
|
3584
3395
|
return $[17] !== restProps || $[18] !== handleFocus || $[19] !== t5 || $[20] !== children ? (t6 = /* @__PURE__ */ jsxRuntime.jsx(Root$j, { ...restProps, "data-ui": "Layer", onFocus: handleFocus, ref, style: t5, children }), $[17] = restProps, $[18] = handleFocus, $[19] = t5, $[20] = children, $[21] = t6) : t6 = $[21], t6;
|
|
3585
|
-
}), Layer =
|
|
3586
|
-
const $ =
|
|
3396
|
+
}), Layer = react.forwardRef(function(props, ref) {
|
|
3397
|
+
const $ = reactCompilerRuntime.c(11);
|
|
3587
3398
|
let t0, restProps, children;
|
|
3588
3399
|
$[0] !== props ? ({
|
|
3589
3400
|
children,
|
|
@@ -3607,7 +3418,7 @@ const defaultContextValue = {
|
|
|
3607
3418
|
}
|
|
3608
3419
|
}, PortalContext = createGlobalScopedContext(key, defaultContextValue);
|
|
3609
3420
|
function usePortal() {
|
|
3610
|
-
const value =
|
|
3421
|
+
const value = react.useContext(PortalContext);
|
|
3611
3422
|
if (!value)
|
|
3612
3423
|
throw new Error("usePortal(): missing context value");
|
|
3613
3424
|
if (!isRecord(value) || value.version !== 0)
|
|
@@ -3615,7 +3426,7 @@ function usePortal() {
|
|
|
3615
3426
|
return value;
|
|
3616
3427
|
}
|
|
3617
3428
|
function Portal(props) {
|
|
3618
|
-
const $ =
|
|
3429
|
+
const $ = reactCompilerRuntime.c(3), {
|
|
3619
3430
|
children,
|
|
3620
3431
|
__unstable_name: name
|
|
3621
3432
|
} = props, portal = usePortal(), portalElement = (name ? portal.elements && portal.elements[name] : portal.element) || portal.elements?.default;
|
|
@@ -3626,12 +3437,12 @@ function Portal(props) {
|
|
|
3626
3437
|
}
|
|
3627
3438
|
Portal.displayName = "Portal";
|
|
3628
3439
|
function PortalProvider(props) {
|
|
3629
|
-
const $ =
|
|
3440
|
+
const $ = reactCompilerRuntime.c(7), {
|
|
3630
3441
|
boundaryElement,
|
|
3631
3442
|
children,
|
|
3632
3443
|
element,
|
|
3633
3444
|
__unstable_elements: elementsProp
|
|
3634
|
-
} = props, elements = useUnique(elementsProp), fallbackElement =
|
|
3445
|
+
} = props, elements = useUnique(elementsProp), fallbackElement = react.useSyncExternalStore(emptySubscribe, _temp$2, _temp2$1);
|
|
3635
3446
|
let t0;
|
|
3636
3447
|
const t1 = boundaryElement || null, t2 = element || fallbackElement;
|
|
3637
3448
|
let t3;
|
|
@@ -3655,7 +3466,7 @@ PortalProvider.displayName = "PortalProvider";
|
|
|
3655
3466
|
const emptySubscribe = () => () => {
|
|
3656
3467
|
};
|
|
3657
3468
|
function useUnique(value) {
|
|
3658
|
-
const valueRef =
|
|
3469
|
+
const valueRef = react.useRef(value);
|
|
3659
3470
|
return _isEqual(valueRef.current, value) || (valueRef.current = value), valueRef.current;
|
|
3660
3471
|
}
|
|
3661
3472
|
function _isEqual(objA, objB) {
|
|
@@ -3671,8 +3482,8 @@ const Root$i = styledComponents.styled.div`
|
|
|
3671
3482
|
position: absolute;
|
|
3672
3483
|
overflow: hidden;
|
|
3673
3484
|
overflow: clip;
|
|
3674
|
-
`, SrOnly =
|
|
3675
|
-
const $ =
|
|
3485
|
+
`, SrOnly = react.forwardRef(function(props, ref) {
|
|
3486
|
+
const $ = reactCompilerRuntime.c(4), {
|
|
3676
3487
|
as,
|
|
3677
3488
|
children
|
|
3678
3489
|
} = props;
|
|
@@ -3686,8 +3497,8 @@ const Root$h = styledComponents.styled.div`
|
|
|
3686
3497
|
position: absolute;
|
|
3687
3498
|
left: 0;
|
|
3688
3499
|
right: 0;
|
|
3689
|
-
`, VirtualList =
|
|
3690
|
-
const $ =
|
|
3500
|
+
`, VirtualList = react.forwardRef(function(props, forwardedRef) {
|
|
3501
|
+
const $ = reactCompilerRuntime.c(56);
|
|
3691
3502
|
let t0, t1, t2, renderItem, onChange, getItemKey, restProps;
|
|
3692
3503
|
$[0] !== props ? ({
|
|
3693
3504
|
as: t0,
|
|
@@ -3703,9 +3514,9 @@ const Root$h = styledComponents.styled.div`
|
|
|
3703
3514
|
$[8] !== t2 ? (t3 = t2 === void 0 ? [] : t2, $[8] = t2, $[9] = t3) : t3 = $[9];
|
|
3704
3515
|
const items = t3, {
|
|
3705
3516
|
space
|
|
3706
|
-
} = useTheme_v2(), ref =
|
|
3517
|
+
} = useTheme_v2(), ref = react.useRef(null), wrapperRef = react.useRef(null), [scrollTop, setScrollTop] = react.useState(0), [scrollHeight, setScrollHeight] = react.useState(0), [itemHeight, setItemHeight] = react.useState(-1);
|
|
3707
3518
|
let t4;
|
|
3708
|
-
$[10] === Symbol.for("react.memo_cache_sentinel") ? (t4 = () => ref.current, $[10] = t4) : t4 = $[10],
|
|
3519
|
+
$[10] === Symbol.for("react.memo_cache_sentinel") ? (t4 = () => ref.current, $[10] = t4) : t4 = $[10], react.useImperativeHandle(forwardedRef, t4);
|
|
3709
3520
|
let t5;
|
|
3710
3521
|
$[11] === Symbol.for("react.memo_cache_sentinel") ? (t5 = () => {
|
|
3711
3522
|
if (!wrapperRef.current)
|
|
@@ -3714,7 +3525,7 @@ const Root$h = styledComponents.styled.div`
|
|
|
3714
3525
|
firstElement instanceof HTMLElement && setItemHeight(firstElement.offsetHeight);
|
|
3715
3526
|
}, $[11] = t5) : t5 = $[11];
|
|
3716
3527
|
let t6;
|
|
3717
|
-
$[12] !== renderItem ? (t6 = [renderItem], $[12] = renderItem, $[13] = t6) : t6 = $[13],
|
|
3528
|
+
$[12] !== renderItem ? (t6 = [renderItem], $[12] = renderItem, $[13] = t6) : t6 = $[13], react.useEffect(t5, t6);
|
|
3718
3529
|
let t7, t8;
|
|
3719
3530
|
$[14] === Symbol.for("react.memo_cache_sentinel") ? (t7 = () => {
|
|
3720
3531
|
if (!ref.current)
|
|
@@ -3749,7 +3560,7 @@ const Root$h = styledComponents.styled.div`
|
|
|
3749
3560
|
}), window.addEventListener("resize", handleResize), setScrollHeight(window.innerHeight), handleScroll_0(), () => {
|
|
3750
3561
|
window.removeEventListener("scroll", handleScroll_0), window.removeEventListener("resize", handleResize);
|
|
3751
3562
|
};
|
|
3752
|
-
}, t8 = [], $[14] = t7, $[15] = t8) : (t7 = $[14], t8 = $[15]),
|
|
3563
|
+
}, t8 = [], $[14] = t7, $[15] = t8) : (t7 = $[14], t8 = $[15]), react.useEffect(t7, t8);
|
|
3753
3564
|
const len = items.length, height = itemHeight ? len * (itemHeight + space[gap]) - space[gap] : 0, fromIndex = height ? Math.max(Math.floor(scrollTop / height * len) - 2, 0) : 0, toIndex = height ? Math.ceil((scrollTop + scrollHeight) / height * len) + 1 : 0;
|
|
3754
3565
|
let t9, t10;
|
|
3755
3566
|
$[16] !== onChange || $[17] !== fromIndex || $[18] !== space || $[19] !== gap || $[20] !== itemHeight || $[21] !== scrollHeight || $[22] !== scrollTop || $[23] !== toIndex ? (t9 = () => {
|
|
@@ -3761,7 +3572,7 @@ const Root$h = styledComponents.styled.div`
|
|
|
3761
3572
|
scrollTop,
|
|
3762
3573
|
toIndex
|
|
3763
3574
|
});
|
|
3764
|
-
}, t10 = [fromIndex, gap, itemHeight, onChange, scrollHeight, scrollTop, space, toIndex], $[16] = onChange, $[17] = fromIndex, $[18] = space, $[19] = gap, $[20] = itemHeight, $[21] = scrollHeight, $[22] = scrollTop, $[23] = toIndex, $[24] = t9, $[25] = t10) : (t9 = $[24], t10 = $[25]),
|
|
3575
|
+
}, t10 = [fromIndex, gap, itemHeight, onChange, scrollHeight, scrollTop, space, toIndex], $[16] = onChange, $[17] = fromIndex, $[18] = space, $[19] = gap, $[20] = itemHeight, $[21] = scrollHeight, $[22] = scrollTop, $[23] = toIndex, $[24] = t9, $[25] = t10) : (t9 = $[24], t10 = $[25]), react.useEffect(t9, t10);
|
|
3765
3576
|
let t11;
|
|
3766
3577
|
bb0: {
|
|
3767
3578
|
if (!renderItem || items.length === 0) {
|
|
@@ -3883,8 +3694,8 @@ const MotionCard$1 = styledComponents.styled(framerMotion.motion(Card))`
|
|
|
3883
3694
|
opacity: var(${POPOVER_MOTION_CONTENT_OPACITY_PROPERTY}, 1);
|
|
3884
3695
|
will-change: opacity;
|
|
3885
3696
|
}
|
|
3886
|
-
`, PopoverCard =
|
|
3887
|
-
const $ =
|
|
3697
|
+
`, PopoverCard = react.memo(react.forwardRef(function(props, ref) {
|
|
3698
|
+
const $ = reactCompilerRuntime.c(60);
|
|
3888
3699
|
let marginsProp, xProp, yProp, animate, originX, originY, strategy, style, width, arrowX, arrowY, restProps, padding, children, overflow, arrow, arrowRef, placement, radius, scheme, shadow, tone;
|
|
3889
3700
|
$[0] !== props ? ({
|
|
3890
3701
|
__unstable_margins: marginsProp,
|
|
@@ -3956,7 +3767,7 @@ const MotionCard$1 = styledComponents.styled(framerMotion.motion(Card))`
|
|
|
3956
3767
|
] }), $[48] = t8, $[49] = placement, $[50] = radius, $[51] = ref, $[52] = scheme, $[53] = shadow, $[54] = rootStyle2, $[55] = tone, $[56] = t9, $[57] = t11, $[58] = t12, $[59] = t13) : t13 = $[59], t13;
|
|
3957
3768
|
}));
|
|
3958
3769
|
PopoverCard.displayName = "Memo(ForwardRef(PopoverCard))";
|
|
3959
|
-
const Popover =
|
|
3770
|
+
const Popover = react.memo(react.forwardRef(function(props, forwardedRef) {
|
|
3960
3771
|
const {
|
|
3961
3772
|
container,
|
|
3962
3773
|
layer
|
|
@@ -3990,31 +3801,31 @@ const Popover = require$$0.memo(require$$0.forwardRef(function(props, forwardedR
|
|
|
3990
3801
|
zOffset: zOffsetProp = layer.popover.zOffset,
|
|
3991
3802
|
updateRef,
|
|
3992
3803
|
...restProps
|
|
3993
|
-
} = props, animate = usePrefersReducedMotion() ? !1 : _animate, boundarySize = useElementSize(boundaryElement)?.border, padding = useArrayProp(paddingProp), radius = useArrayProp(radiusProp), shadow = useArrayProp(shadowProp), widthArrayProp = useArrayProp(widthProp), zOffset = useArrayProp(zOffsetProp), ref =
|
|
3994
|
-
|
|
3804
|
+
} = props, animate = usePrefersReducedMotion() ? !1 : _animate, boundarySize = useElementSize(boundaryElement)?.border, padding = useArrayProp(paddingProp), radius = useArrayProp(radiusProp), shadow = useArrayProp(shadowProp), widthArrayProp = useArrayProp(widthProp), zOffset = useArrayProp(zOffsetProp), ref = react.useRef(null), arrowRef = react.useRef(null), rootBoundary = "viewport";
|
|
3805
|
+
react.useImperativeHandle(forwardedRef, () => ref.current);
|
|
3995
3806
|
const mediaIndex = useMediaIndex(), boundaryWidth = constrainSize || preventOverflow ? boundarySize?.width : void 0, width = calcCurrentWidth({
|
|
3996
3807
|
container,
|
|
3997
3808
|
mediaIndex,
|
|
3998
3809
|
width: widthArrayProp
|
|
3999
|
-
}), widthRef =
|
|
4000
|
-
|
|
3810
|
+
}), widthRef = react.useRef(width);
|
|
3811
|
+
react.useEffect(() => {
|
|
4001
3812
|
widthRef.current = width;
|
|
4002
3813
|
}, [width]);
|
|
4003
3814
|
const maxWidth = calcMaxWidth({
|
|
4004
3815
|
boundaryWidth,
|
|
4005
3816
|
currentWidth: width
|
|
4006
|
-
}), maxWidthRef =
|
|
4007
|
-
|
|
3817
|
+
}), maxWidthRef = react.useRef(maxWidth);
|
|
3818
|
+
react.useEffect(() => {
|
|
4008
3819
|
maxWidthRef.current = maxWidth;
|
|
4009
3820
|
}, [maxWidth]);
|
|
4010
|
-
const referenceWidthRef =
|
|
4011
|
-
|
|
3821
|
+
const referenceWidthRef = react.useRef();
|
|
3822
|
+
react.useEffect(() => {
|
|
4012
3823
|
const floatingElement = ref.current;
|
|
4013
3824
|
if (!open || !floatingElement) return;
|
|
4014
3825
|
const referenceWidth = referenceWidthRef.current;
|
|
4015
3826
|
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`);
|
|
4016
3827
|
}, [width, matchReferenceWidth, maxWidth, open]);
|
|
4017
|
-
const middleware =
|
|
3828
|
+
const middleware = react.useMemo(() => {
|
|
4018
3829
|
const ret = [];
|
|
4019
3830
|
return (constrainSize || preventOverflow) && ret.push(reactDom$1.flip({
|
|
4020
3831
|
boundary: floatingBoundary || void 0,
|
|
@@ -4063,20 +3874,20 @@ const Popover = require$$0.memo(require$$0.forwardRef(function(props, forwardedR
|
|
|
4063
3874
|
middleware,
|
|
4064
3875
|
placement: placementProp,
|
|
4065
3876
|
whileElementsMounted: reactDom$1.autoUpdate
|
|
4066
|
-
}), referenceHidden = middlewareData.hide?.referenceHidden, arrowX = middlewareData.arrow?.x, arrowY = middlewareData.arrow?.y, originX = middlewareData["@sanity/ui/origin"]?.originX, originY = middlewareData["@sanity/ui/origin"]?.originY, setArrow =
|
|
3877
|
+
}), referenceHidden = middlewareData.hide?.referenceHidden, arrowX = middlewareData.arrow?.x, arrowY = middlewareData.arrow?.y, originX = middlewareData["@sanity/ui/origin"]?.originX, originY = middlewareData["@sanity/ui/origin"]?.originY, setArrow = react.useCallback((arrowEl) => {
|
|
4067
3878
|
arrowRef.current = arrowEl;
|
|
4068
|
-
}, []), setFloating =
|
|
3879
|
+
}, []), setFloating = react.useCallback((node) => {
|
|
4069
3880
|
ref.current = node, refs.setFloating(node);
|
|
4070
|
-
}, [refs]), setReference =
|
|
3881
|
+
}, [refs]), setReference = react.useCallback((node_0) => {
|
|
4071
3882
|
refs.setReference(node_0);
|
|
4072
3883
|
const childRef = getElementRef(childProp);
|
|
4073
3884
|
typeof childRef == "function" ? childRef(node_0) : childRef && (childRef.current = node_0);
|
|
4074
|
-
}, [childProp, refs]), child =
|
|
3885
|
+
}, [childProp, refs]), child = react.useMemo(() => !childProp || referenceElement ? null : react.cloneElement(childProp, {
|
|
4075
3886
|
ref: setReference
|
|
4076
3887
|
}), [childProp, referenceElement, setReference]);
|
|
4077
|
-
if (
|
|
3888
|
+
if (react.useEffect(() => {
|
|
4078
3889
|
updateRef && (typeof updateRef == "function" ? updateRef(update) : updateRef && (updateRef.current = update));
|
|
4079
|
-
}, [update, updateRef]),
|
|
3890
|
+
}, [update, updateRef]), react.useEffect(() => {
|
|
4080
3891
|
child || refs.setReference(referenceElement || null);
|
|
4081
3892
|
}, [referenceElement, refs, child]), disabled)
|
|
4082
3893
|
return childProp || /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
@@ -4108,7 +3919,7 @@ function inputElementStyle(props) {
|
|
|
4108
3919
|
const {
|
|
4109
3920
|
color,
|
|
4110
3921
|
input
|
|
4111
|
-
} = theme.getTheme_v2(props.theme),
|
|
3922
|
+
} = theme.getTheme_v2(props.theme), dist = (input.radio.size - input.radio.markSize) / 2;
|
|
4112
3923
|
return styledComponents.css`
|
|
4113
3924
|
appearance: none;
|
|
4114
3925
|
position: absolute;
|
|
@@ -4140,8 +3951,8 @@ function inputElementStyle(props) {
|
|
|
4140
3951
|
&::after {
|
|
4141
3952
|
content: '';
|
|
4142
3953
|
position: absolute;
|
|
4143
|
-
top: ${rem(
|
|
4144
|
-
left: ${rem(
|
|
3954
|
+
top: ${rem(dist)};
|
|
3955
|
+
left: ${rem(dist)};
|
|
4145
3956
|
height: ${rem(input.radio.markSize)};
|
|
4146
3957
|
width: ${rem(input.radio.markSize)};
|
|
4147
3958
|
border-radius: ${rem(input.radio.markSize / 2)};
|
|
@@ -4205,8 +4016,8 @@ function inputElementStyle(props) {
|
|
|
4205
4016
|
}
|
|
4206
4017
|
`;
|
|
4207
4018
|
}
|
|
4208
|
-
const Root$g = styledComponents.styled.div(radioBaseStyle), Input$4 = styledComponents.styled.input(inputElementStyle), Radio =
|
|
4209
|
-
const $ =
|
|
4019
|
+
const Root$g = styledComponents.styled.div(radioBaseStyle), Input$4 = styledComponents.styled.input(inputElementStyle), Radio = react.forwardRef(function(props, forwardedRef) {
|
|
4020
|
+
const $ = reactCompilerRuntime.c(19);
|
|
4210
4021
|
let customValidity, disabled, readOnly, restProps, className, style;
|
|
4211
4022
|
$[0] !== props ? ({
|
|
4212
4023
|
className,
|
|
@@ -4216,9 +4027,9 @@ const Root$g = styledComponents.styled.div(radioBaseStyle), Input$4 = styledComp
|
|
|
4216
4027
|
readOnly,
|
|
4217
4028
|
...restProps
|
|
4218
4029
|
} = props, $[0] = props, $[1] = customValidity, $[2] = disabled, $[3] = readOnly, $[4] = restProps, $[5] = className, $[6] = style) : (customValidity = $[1], disabled = $[2], readOnly = $[3], restProps = $[4], className = $[5], style = $[6]);
|
|
4219
|
-
const ref =
|
|
4030
|
+
const ref = react.useRef(null);
|
|
4220
4031
|
let t0;
|
|
4221
|
-
$[7] === Symbol.for("react.memo_cache_sentinel") ? (t0 = () => ref.current, $[7] = t0) : t0 = $[7],
|
|
4032
|
+
$[7] === Symbol.for("react.memo_cache_sentinel") ? (t0 = () => ref.current, $[7] = t0) : t0 = $[7], react.useImperativeHandle(forwardedRef, t0), useCustomValidity(ref, customValidity);
|
|
4222
4033
|
const t1 = !disabled && readOnly ? "" : void 0, t2 = customValidity ? "" : void 0, t3 = disabled || readOnly;
|
|
4223
4034
|
let t4;
|
|
4224
4035
|
$[8] !== t1 || $[9] !== t2 || $[10] !== restProps || $[11] !== t3 || $[12] !== readOnly ? (t4 = /* @__PURE__ */ jsxRuntime.jsx(Input$4, { "data-read-only": t1, "data-error": t2, ...restProps, disabled: t3, readOnly, ref, type: "radio" }), $[8] = t1, $[9] = t2, $[10] = restProps, $[11] = t3, $[12] = readOnly, $[13] = t4) : t4 = $[13];
|
|
@@ -4373,8 +4184,8 @@ const selectStyle = {
|
|
|
4373
4184
|
root: rootStyle,
|
|
4374
4185
|
input: inputStyle,
|
|
4375
4186
|
iconBox: iconBoxStyle
|
|
4376
|
-
}, Root$f = styledComponents.styled.div(selectStyle.root), Input$3 = styledComponents.styled.select(selectStyle.input), IconBox = styledComponents.styled(Box)(selectStyle.iconBox), Select =
|
|
4377
|
-
const $ =
|
|
4187
|
+
}, Root$f = styledComponents.styled.div(selectStyle.root), Input$3 = styledComponents.styled.select(selectStyle.input), IconBox = styledComponents.styled(Box)(selectStyle.iconBox), Select = react.forwardRef(function(props, forwardedRef) {
|
|
4188
|
+
const $ = reactCompilerRuntime.c(29);
|
|
4378
4189
|
let t0, t1, t2, t3, customValidity, disabled, readOnly, restProps, children;
|
|
4379
4190
|
$[0] !== props ? ({
|
|
4380
4191
|
children,
|
|
@@ -4387,9 +4198,9 @@ const selectStyle = {
|
|
|
4387
4198
|
space: t3,
|
|
4388
4199
|
...restProps
|
|
4389
4200
|
} = props, $[0] = props, $[1] = t0, $[2] = t1, $[3] = t2, $[4] = t3, $[5] = customValidity, $[6] = disabled, $[7] = readOnly, $[8] = restProps, $[9] = children) : (t0 = $[1], t1 = $[2], t2 = $[3], t3 = $[4], customValidity = $[5], disabled = $[6], readOnly = $[7], restProps = $[8], children = $[9]);
|
|
4390
|
-
const fontSize2 = t0 === void 0 ? 2 : t0, padding = t1 === void 0 ? 3 : t1, radius = t2 === void 0 ? 2 : t2, space = t3 === void 0 ? 3 : t3, ref =
|
|
4201
|
+
const fontSize2 = t0 === void 0 ? 2 : t0, padding = t1 === void 0 ? 3 : t1, radius = t2 === void 0 ? 2 : t2, space = t3 === void 0 ? 3 : t3, ref = react.useRef(null);
|
|
4391
4202
|
let t4;
|
|
4392
|
-
$[10] === Symbol.for("react.memo_cache_sentinel") ? (t4 = () => ref.current, $[10] = t4) : t4 = $[10],
|
|
4203
|
+
$[10] === Symbol.for("react.memo_cache_sentinel") ? (t4 = () => ref.current, $[10] = t4) : t4 = $[10], react.useImperativeHandle(forwardedRef, t4), useCustomValidity(ref, customValidity);
|
|
4393
4204
|
const t5 = !disabled && readOnly ? "" : void 0, t6 = useArrayProp(fontSize2), t7 = useArrayProp(padding), t8 = useArrayProp(radius), t9 = useArrayProp(space), t10 = disabled || readOnly;
|
|
4394
4205
|
let t11;
|
|
4395
4206
|
$[11] !== t5 || $[12] !== restProps || $[13] !== t6 || $[14] !== t7 || $[15] !== t8 || $[16] !== t9 || $[17] !== t10 || $[18] !== children ? (t11 = /* @__PURE__ */ jsxRuntime.jsx(Input$3, { "data-read-only": t5, "data-ui": "Select", ...restProps, $fontSize: t6, $padding: t7, $radius: t8, $space: t9, disabled: t10, ref, children }), $[11] = t5, $[12] = restProps, $[13] = t6, $[14] = t7, $[15] = t8, $[16] = t9, $[17] = t10, $[18] = children, $[19] = t11) : t11 = $[19];
|
|
@@ -4428,8 +4239,8 @@ function responsiveStackSpaceStyle(props) {
|
|
|
4428
4239
|
gridGap: rem(space[spaceIndex])
|
|
4429
4240
|
}));
|
|
4430
4241
|
}
|
|
4431
|
-
const Root$e = styledComponents.styled(Box)(stackBaseStyle, responsiveStackSpaceStyle), Stack =
|
|
4432
|
-
const $ =
|
|
4242
|
+
const Root$e = styledComponents.styled(Box)(stackBaseStyle, responsiveStackSpaceStyle), Stack = react.forwardRef(function(props, ref) {
|
|
4243
|
+
const $ = reactCompilerRuntime.c(10);
|
|
4433
4244
|
let as, space, restProps;
|
|
4434
4245
|
$[0] !== props ? ({
|
|
4435
4246
|
as,
|
|
@@ -4594,8 +4405,8 @@ function switchThumbStyles(props) {
|
|
|
4594
4405
|
`}
|
|
4595
4406
|
`;
|
|
4596
4407
|
}
|
|
4597
|
-
const Root$d = styledComponents.styled.span(switchBaseStyles), Input$2 = styledComponents.styled.input(switchInputStyles), Representation = styledComponents.styled.span(switchRepresentationStyles), Track = styledComponents.styled.span(switchTrackStyles), Thumb = styledComponents.styled.span(switchThumbStyles), Switch =
|
|
4598
|
-
const $ =
|
|
4408
|
+
const Root$d = styledComponents.styled.span(switchBaseStyles), Input$2 = styledComponents.styled.input(switchInputStyles), Representation = styledComponents.styled.span(switchRepresentationStyles), Track = styledComponents.styled.span(switchTrackStyles), Thumb = styledComponents.styled.span(switchThumbStyles), Switch = react.forwardRef(function(props, forwardedRef) {
|
|
4409
|
+
const $ = reactCompilerRuntime.c(26);
|
|
4599
4410
|
let indeterminate, disabled, readOnly, checked, restProps, className, style;
|
|
4600
4411
|
$[0] !== props ? ({
|
|
4601
4412
|
checked,
|
|
@@ -4606,13 +4417,13 @@ const Root$d = styledComponents.styled.span(switchBaseStyles), Input$2 = styledC
|
|
|
4606
4417
|
style,
|
|
4607
4418
|
...restProps
|
|
4608
4419
|
} = props, $[0] = props, $[1] = indeterminate, $[2] = disabled, $[3] = readOnly, $[4] = checked, $[5] = restProps, $[6] = className, $[7] = style) : (indeterminate = $[1], disabled = $[2], readOnly = $[3], checked = $[4], restProps = $[5], className = $[6], style = $[7]);
|
|
4609
|
-
const ref =
|
|
4420
|
+
const ref = react.useRef(null);
|
|
4610
4421
|
let t0;
|
|
4611
|
-
$[8] === Symbol.for("react.memo_cache_sentinel") ? (t0 = () => ref.current, $[8] = t0) : t0 = $[8],
|
|
4422
|
+
$[8] === Symbol.for("react.memo_cache_sentinel") ? (t0 = () => ref.current, $[8] = t0) : t0 = $[8], react.useImperativeHandle(forwardedRef, t0);
|
|
4612
4423
|
let t1, t2;
|
|
4613
4424
|
$[9] !== indeterminate ? (t1 = () => {
|
|
4614
4425
|
ref.current && (ref.current.indeterminate = indeterminate || !1);
|
|
4615
|
-
}, t2 = [indeterminate], $[9] = indeterminate, $[10] = t1, $[11] = t2) : (t1 = $[10], t2 = $[11]),
|
|
4426
|
+
}, t2 = [indeterminate], $[9] = indeterminate, $[10] = t1, $[11] = t2) : (t1 = $[10], t2 = $[11]), react.useEffect(t1, t2);
|
|
4616
4427
|
const t3 = !disabled && readOnly ? "" : void 0, t4 = indeterminate !== !0 && checked, t5 = disabled || readOnly;
|
|
4617
4428
|
let t6;
|
|
4618
4429
|
$[12] !== t3 || $[13] !== restProps || $[14] !== t4 || $[15] !== t5 ? (t6 = /* @__PURE__ */ jsxRuntime.jsx(Input$2, { "data-read-only": t3, ...restProps, checked: t4, disabled: t5, type: "checkbox", ref }), $[12] = t3, $[13] = restProps, $[14] = t4, $[15] = t5, $[16] = t6) : t6 = $[16];
|
|
@@ -4635,8 +4446,8 @@ const Root$c = styledComponents.styled.span(textInputRootStyle), InputRoot$1 = s
|
|
|
4635
4446
|
min-width: 0;
|
|
4636
4447
|
display: block;
|
|
4637
4448
|
position: relative;
|
|
4638
|
-
`, Input$1 = styledComponents.styled.textarea(responsiveInputPaddingStyle, textInputBaseStyle, textInputFontSizeStyle), Presentation$1 = styledComponents.styled.div(responsiveRadiusStyle, textInputRepresentationStyle), TextArea =
|
|
4639
|
-
const $ =
|
|
4449
|
+
`, Input$1 = styledComponents.styled.textarea(responsiveInputPaddingStyle, textInputBaseStyle, textInputFontSizeStyle), Presentation$1 = styledComponents.styled.div(responsiveRadiusStyle, textInputRepresentationStyle), TextArea = react.forwardRef(function(props, forwardedRef) {
|
|
4450
|
+
const $ = reactCompilerRuntime.c(29);
|
|
4640
4451
|
let t0, t1, t2, t3, t4, customValidity, restProps, weight, __unstable_disableFocusRing;
|
|
4641
4452
|
$[0] !== props ? ({
|
|
4642
4453
|
border: t0,
|
|
@@ -4649,9 +4460,9 @@ const Root$c = styledComponents.styled.span(textInputRootStyle), InputRoot$1 = s
|
|
|
4649
4460
|
__unstable_disableFocusRing,
|
|
4650
4461
|
...restProps
|
|
4651
4462
|
} = props, $[0] = props, $[1] = t0, $[2] = t1, $[3] = t2, $[4] = t3, $[5] = t4, $[6] = customValidity, $[7] = restProps, $[8] = weight, $[9] = __unstable_disableFocusRing) : (t0 = $[1], t1 = $[2], t2 = $[3], t3 = $[4], t4 = $[5], customValidity = $[6], restProps = $[7], weight = $[8], __unstable_disableFocusRing = $[9]);
|
|
4652
|
-
const border2 = t0 === void 0 ? !0 : t0, disabled = t1 === void 0 ? !1 : t1, fontSize2 = t2 === void 0 ? 2 : t2, padding = t3 === void 0 ? 3 : t3, radius = t4 === void 0 ? 2 : t4, ref =
|
|
4463
|
+
const border2 = t0 === void 0 ? !0 : t0, disabled = t1 === void 0 ? !1 : t1, fontSize2 = t2 === void 0 ? 2 : t2, padding = t3 === void 0 ? 3 : t3, radius = t4 === void 0 ? 2 : t4, ref = react.useRef(null), rootTheme = useRootTheme();
|
|
4653
4464
|
let t5;
|
|
4654
|
-
$[10] === Symbol.for("react.memo_cache_sentinel") ? (t5 = () => ref.current, $[10] = t5) : t5 = $[10],
|
|
4465
|
+
$[10] === Symbol.for("react.memo_cache_sentinel") ? (t5 = () => ref.current, $[10] = t5) : t5 = $[10], react.useImperativeHandle(forwardedRef, t5), useCustomValidity(ref, customValidity);
|
|
4655
4466
|
const t6 = rootTheme.scheme, t7 = rootTheme.tone, t8 = useArrayProp(fontSize2), t9 = useArrayProp(padding), t10 = rootTheme.scheme, t11 = useArrayProp(0);
|
|
4656
4467
|
let t12;
|
|
4657
4468
|
$[11] !== rootTheme.scheme || $[12] !== rootTheme.tone || $[13] !== restProps || $[14] !== t8 || $[15] !== t9 || $[16] !== t11 || $[17] !== weight || $[18] !== disabled ? (t12 = /* @__PURE__ */ jsxRuntime.jsx(Input$1, { "data-as": "textarea", "data-scheme": t6, "data-tone": t7, ...restProps, $fontSize: t8, $padding: t9, $scheme: t10, $space: t11, $tone: rootTheme.tone, $weight: weight, disabled, ref }), $[11] = rootTheme.scheme, $[12] = rootTheme.tone, $[13] = restProps, $[14] = t8, $[15] = t9, $[16] = t11, $[17] = weight, $[18] = disabled, $[19] = t12) : t12 = $[19];
|
|
@@ -4711,8 +4522,8 @@ const CLEAR_BUTTON_BOX_STYLE = {
|
|
|
4711
4522
|
"&:not([hidden])": {
|
|
4712
4523
|
display: "block"
|
|
4713
4524
|
}
|
|
4714
|
-
}), TextInput =
|
|
4715
|
-
const $ =
|
|
4525
|
+
}), TextInput = react.forwardRef(function(props, forwardedRef) {
|
|
4526
|
+
const $ = reactCompilerRuntime.c(86);
|
|
4716
4527
|
let t0, t1, t2, t3, t4, t5, t6, clearButton, IconComponent, IconRightComponent, suffix, prefix, customValidity, onClear, __unstable_disableFocusRing, readOnly, restProps, weight;
|
|
4717
4528
|
$[0] !== props ? ({
|
|
4718
4529
|
__unstable_disableFocusRing,
|
|
@@ -4734,9 +4545,9 @@ const CLEAR_BUTTON_BOX_STYLE = {
|
|
|
4734
4545
|
weight,
|
|
4735
4546
|
...restProps
|
|
4736
4547
|
} = props, $[0] = props, $[1] = t0, $[2] = t1, $[3] = t2, $[4] = t3, $[5] = t4, $[6] = t5, $[7] = t6, $[8] = clearButton, $[9] = IconComponent, $[10] = IconRightComponent, $[11] = suffix, $[12] = prefix, $[13] = customValidity, $[14] = onClear, $[15] = __unstable_disableFocusRing, $[16] = readOnly, $[17] = restProps, $[18] = weight) : (t0 = $[1], t1 = $[2], t2 = $[3], t3 = $[4], t4 = $[5], t5 = $[6], t6 = $[7], clearButton = $[8], IconComponent = $[9], IconRightComponent = $[10], suffix = $[11], prefix = $[12], customValidity = $[13], onClear = $[14], __unstable_disableFocusRing = $[15], readOnly = $[16], restProps = $[17], weight = $[18]);
|
|
4737
|
-
const border2 = t0 === void 0 ? !0 : t0, disabled = t1 === void 0 ? !1 : t1, fontSizeProp = t2 === void 0 ? 2 : t2, paddingProp = t3 === void 0 ? 3 : t3, radiusProp = t4 === void 0 ? 2 : t4, spaceProp = t5 === void 0 ? 3 : t5, type = t6 === void 0 ? "text" : t6, ref =
|
|
4548
|
+
const border2 = t0 === void 0 ? !0 : t0, disabled = t1 === void 0 ? !1 : t1, fontSizeProp = t2 === void 0 ? 2 : t2, paddingProp = t3 === void 0 ? 3 : t3, radiusProp = t4 === void 0 ? 2 : t4, spaceProp = t5 === void 0 ? 3 : t5, type = t6 === void 0 ? "text" : t6, ref = react.useRef(null), rootTheme = useRootTheme(), fontSize2 = useArrayProp(fontSizeProp), padding = useArrayProp(paddingProp), radius = useArrayProp(radiusProp), space = useArrayProp(spaceProp), $hasClearButton = !!clearButton, $hasIcon = !!IconComponent, $hasIconRight = !!IconRightComponent, $hasSuffix = !!suffix, $hasPrefix = !!prefix;
|
|
4738
4549
|
let t7;
|
|
4739
|
-
$[19] === Symbol.for("react.memo_cache_sentinel") ? (t7 = () => ref.current, $[19] = t7) : t7 = $[19],
|
|
4550
|
+
$[19] === Symbol.for("react.memo_cache_sentinel") ? (t7 = () => ref.current, $[19] = t7) : t7 = $[19], react.useImperativeHandle(forwardedRef, t7), useCustomValidity(ref, customValidity);
|
|
4740
4551
|
const handleClearMouseDown = _temp$1;
|
|
4741
4552
|
let t8;
|
|
4742
4553
|
$[20] !== onClear ? (t8 = (event_0) => {
|
|
@@ -4750,12 +4561,12 @@ const CLEAR_BUTTON_BOX_STYLE = {
|
|
|
4750
4561
|
const t12 = border2 ? "" : void 0;
|
|
4751
4562
|
let t13;
|
|
4752
4563
|
$[25] !== IconComponent || $[26] !== fontSize2 || $[27] !== padding ? (t13 = IconComponent && /* @__PURE__ */ jsxRuntime.jsx(LeftBox, { padding, children: /* @__PURE__ */ jsxRuntime.jsxs(Text, { size: fontSize2, children: [
|
|
4753
|
-
|
|
4564
|
+
react.isValidElement(IconComponent) && IconComponent,
|
|
4754
4565
|
ReactIs.isValidElementType(IconComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconComponent, {})
|
|
4755
4566
|
] }) }), $[25] = IconComponent, $[26] = fontSize2, $[27] = padding, $[28] = t13) : t13 = $[28];
|
|
4756
4567
|
let t14;
|
|
4757
4568
|
$[29] !== $hasClearButton || $[30] !== IconRightComponent || $[31] !== fontSize2 || $[32] !== padding ? (t14 = !$hasClearButton && IconRightComponent && /* @__PURE__ */ jsxRuntime.jsx(RightBox, { padding, children: /* @__PURE__ */ jsxRuntime.jsxs(Text, { size: fontSize2, children: [
|
|
4758
|
-
|
|
4569
|
+
react.isValidElement(IconRightComponent) && IconRightComponent,
|
|
4759
4570
|
ReactIs.isValidElementType(IconRightComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconRightComponent, {})
|
|
4760
4571
|
] }) }), $[29] = $hasClearButton, $[30] = IconRightComponent, $[31] = fontSize2, $[32] = padding, $[33] = t14) : t14 = $[33];
|
|
4761
4572
|
let t15;
|
|
@@ -4809,7 +4620,7 @@ function _temp$1(event) {
|
|
|
4809
4620
|
event.preventDefault(), event.stopPropagation();
|
|
4810
4621
|
}
|
|
4811
4622
|
function useDelayedState(initialState) {
|
|
4812
|
-
const $ =
|
|
4623
|
+
const $ = reactCompilerRuntime.c(3), [state, setState] = react.useState(initialState), delayedAction = react.useRef();
|
|
4813
4624
|
let t0;
|
|
4814
4625
|
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = (nextState, delay) => {
|
|
4815
4626
|
const action = () => {
|
|
@@ -4841,8 +4652,8 @@ const DEFAULT_TOOLTIP_ARROW_WIDTH = 15, DEFAULT_TOOLTIP_ARROW_HEIGHT = 6, DEFAUL
|
|
|
4841
4652
|
opacity: var(${POPOVER_MOTION_CONTENT_OPACITY_PROPERTY}, 1);
|
|
4842
4653
|
will-change: opacity;
|
|
4843
4654
|
}
|
|
4844
|
-
`, TooltipCard =
|
|
4845
|
-
const $ =
|
|
4655
|
+
`, TooltipCard = react.memo(react.forwardRef(function(props, ref) {
|
|
4656
|
+
const $ = reactCompilerRuntime.c(42);
|
|
4846
4657
|
let animate, originX, originY, style, arrowX, arrowY, restProps, arrow, arrowRef, placement, padding, radius, scheme, shadow, children;
|
|
4847
4658
|
$[0] !== props ? ({
|
|
4848
4659
|
animate,
|
|
@@ -4894,10 +4705,10 @@ const DEFAULT_TOOLTIP_ARROW_WIDTH = 15, DEFAULT_TOOLTIP_ARROW_HEIGHT = 6, DEFAUL
|
|
|
4894
4705
|
TooltipCard.displayName = "Memo(ForwardRef(TooltipCard))";
|
|
4895
4706
|
const TooltipDelayGroupContext = createGlobalScopedContext("@sanity/ui/context/tooltipDelayGroup", null);
|
|
4896
4707
|
function useTooltipDelayGroup() {
|
|
4897
|
-
return
|
|
4708
|
+
return react.useContext(TooltipDelayGroupContext);
|
|
4898
4709
|
}
|
|
4899
4710
|
function TooltipDelayGroupProvider(props) {
|
|
4900
|
-
const $ =
|
|
4711
|
+
const $ = reactCompilerRuntime.c(10), {
|
|
4901
4712
|
children,
|
|
4902
4713
|
delay
|
|
4903
4714
|
} = props, [isGroupActive, setIsGroupActive] = useDelayedState(!1), [openTooltipId, setOpenTooltipId] = useDelayedState(null), openDelay = typeof delay == "number" ? delay : delay?.open || 0, closeDelay = typeof delay == "number" ? delay : delay?.close || 0;
|
|
@@ -4919,7 +4730,7 @@ function TooltipDelayGroupProvider(props) {
|
|
|
4919
4730
|
TooltipDelayGroupProvider.displayName = "TooltipDelayGroupProvider";
|
|
4920
4731
|
const Root$a = styledComponents.styled(Layer)`
|
|
4921
4732
|
pointer-events: none;
|
|
4922
|
-
`, Tooltip =
|
|
4733
|
+
`, Tooltip = react.forwardRef(function(props, forwardedRef) {
|
|
4923
4734
|
const boundaryElementContext = useBoundaryElement(), {
|
|
4924
4735
|
layer
|
|
4925
4736
|
} = useTheme_v2(), {
|
|
@@ -4939,9 +4750,9 @@ const Root$a = styledComponents.styled(Layer)`
|
|
|
4939
4750
|
zOffset = layer.tooltip.zOffset,
|
|
4940
4751
|
delay,
|
|
4941
4752
|
...restProps
|
|
4942
|
-
} = props, animate = usePrefersReducedMotion() ? !1 : _animate, fallbackPlacements = useArrayProp(fallbackPlacementsProp), ref =
|
|
4943
|
-
|
|
4944
|
-
const portal = usePortal(), portalElement = typeof portalProp == "string" ? portal.elements?.[portalProp] || null : portal.element, middleware =
|
|
4753
|
+
} = props, animate = usePrefersReducedMotion() ? !1 : _animate, fallbackPlacements = useArrayProp(fallbackPlacementsProp), ref = react.useRef(null), [referenceElement, setReferenceElement] = react.useState(null), arrowRef = react.useRef(null), rootBoundary = "viewport", [tooltipMaxWidth, setTooltipMaxWidth] = react.useState(0);
|
|
4754
|
+
react.useImperativeHandle(forwardedRef, () => ref.current);
|
|
4755
|
+
const portal = usePortal(), portalElement = typeof portalProp == "string" ? portal.elements?.[portalProp] || null : portal.element, middleware = react.useMemo(() => {
|
|
4945
4756
|
const ret = [];
|
|
4946
4757
|
return ret.push(reactDom$1.flip({
|
|
4947
4758
|
boundary: boundaryElement || void 0,
|
|
@@ -4968,7 +4779,7 @@ const Root$a = styledComponents.styled(Layer)`
|
|
|
4968
4779
|
middleware,
|
|
4969
4780
|
placement: placementProp,
|
|
4970
4781
|
whileElementsMounted: reactDom$1.autoUpdate
|
|
4971
|
-
}), arrowX = middlewareData.arrow?.x, arrowY = middlewareData.arrow?.y, originX = middlewareData["@sanity/ui/origin"]?.originX, originY = middlewareData["@sanity/ui/origin"]?.originY, tooltipId =
|
|
4782
|
+
}), arrowX = middlewareData.arrow?.x, arrowY = middlewareData.arrow?.y, originX = middlewareData["@sanity/ui/origin"]?.originX, originY = middlewareData["@sanity/ui/origin"]?.originY, tooltipId = react.useId(), [isOpen, setIsOpen] = useDelayedState(!1), delayGroupContext = useTooltipDelayGroup(), 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, handleIsOpenChange = react.useCallback((open, immediate) => {
|
|
4972
4783
|
if (isInsideGroup)
|
|
4973
4784
|
if (open) {
|
|
4974
4785
|
const groupedOpenDelay = immediate ? 0 : openDelay;
|
|
@@ -4979,28 +4790,28 @@ const Root$a = styledComponents.styled(Layer)`
|
|
|
4979
4790
|
}
|
|
4980
4791
|
else
|
|
4981
4792
|
setIsOpen(open, immediate ? 0 : open ? openDelay : closeDelay);
|
|
4982
|
-
}, [isInsideGroup, delayGroupContext, openDelay, tooltipId, closeDelay, setIsOpen]), handleBlur =
|
|
4793
|
+
}, [isInsideGroup, delayGroupContext, openDelay, tooltipId, closeDelay, setIsOpen]), handleBlur = react.useCallback((e) => {
|
|
4983
4794
|
handleIsOpenChange(!1), childProp?.props?.onBlur?.(e);
|
|
4984
|
-
}, [childProp?.props, handleIsOpenChange]), handleClick =
|
|
4795
|
+
}, [childProp?.props, handleIsOpenChange]), handleClick = react.useCallback((e_0) => {
|
|
4985
4796
|
handleIsOpenChange(!1, !0), childProp?.props.onClick?.(e_0);
|
|
4986
|
-
}, [childProp?.props, handleIsOpenChange]), handleContextMenu =
|
|
4797
|
+
}, [childProp?.props, handleIsOpenChange]), handleContextMenu = react.useCallback((e_1) => {
|
|
4987
4798
|
handleIsOpenChange(!1, !0), childProp?.props.onContextMenu?.(e_1);
|
|
4988
|
-
}, [childProp?.props, handleIsOpenChange]), handleFocus =
|
|
4799
|
+
}, [childProp?.props, handleIsOpenChange]), handleFocus = react.useCallback((e_2) => {
|
|
4989
4800
|
handleIsOpenChange(!0), childProp?.props?.onFocus?.(e_2);
|
|
4990
|
-
}, [childProp?.props, handleIsOpenChange]), handleMouseEnter =
|
|
4801
|
+
}, [childProp?.props, handleIsOpenChange]), handleMouseEnter = react.useCallback((e_3) => {
|
|
4991
4802
|
handleIsOpenChange(!0), childProp?.props?.onMouseEnter?.(e_3);
|
|
4992
|
-
}, [childProp?.props, handleIsOpenChange]), handleMouseLeave =
|
|
4803
|
+
}, [childProp?.props, handleIsOpenChange]), handleMouseLeave = react.useCallback((e_4) => {
|
|
4993
4804
|
handleIsOpenChange(!1), childProp?.props?.onMouseLeave?.(e_4);
|
|
4994
4805
|
}, [childProp?.props, handleIsOpenChange]);
|
|
4995
4806
|
useCloseOnMouseLeave({
|
|
4996
4807
|
handleIsOpenChange,
|
|
4997
4808
|
referenceElement,
|
|
4998
4809
|
showTooltip
|
|
4999
|
-
}),
|
|
4810
|
+
}), react.useEffect(() => {
|
|
5000
4811
|
disabled && showTooltip && handleIsOpenChange(!1);
|
|
5001
|
-
}, [disabled, handleIsOpenChange, showTooltip]),
|
|
4812
|
+
}, [disabled, handleIsOpenChange, showTooltip]), react.useEffect(() => {
|
|
5002
4813
|
!content && showTooltip && handleIsOpenChange(!1);
|
|
5003
|
-
}, [content, handleIsOpenChange, showTooltip]),
|
|
4814
|
+
}, [content, handleIsOpenChange, showTooltip]), react.useEffect(() => refs.setReference(referenceElement), [referenceElement, refs]), react.useEffect(() => {
|
|
5004
4815
|
if (!showTooltip) return;
|
|
5005
4816
|
function handleWindowKeyDown(event) {
|
|
5006
4817
|
event.key === "Escape" && handleIsOpenChange(!1, !0);
|
|
@@ -5008,17 +4819,17 @@ const Root$a = styledComponents.styled(Layer)`
|
|
|
5008
4819
|
return window.addEventListener("keydown", handleWindowKeyDown), () => {
|
|
5009
4820
|
window.removeEventListener("keydown", handleWindowKeyDown);
|
|
5010
4821
|
};
|
|
5011
|
-
}, [handleIsOpenChange, showTooltip]),
|
|
4822
|
+
}, [handleIsOpenChange, showTooltip]), react.useLayoutEffect(() => {
|
|
5012
4823
|
const availableWidths = [...boundaryElement ? [boundaryElement.offsetWidth] : [], portalElement?.offsetWidth || document.body.offsetWidth];
|
|
5013
4824
|
setTooltipMaxWidth(Math.min(...availableWidths) - DEFAULT_TOOLTIP_PADDING * 2);
|
|
5014
4825
|
}, [boundaryElement, portalElement]);
|
|
5015
|
-
const setArrow =
|
|
4826
|
+
const setArrow = react.useCallback((arrowEl) => {
|
|
5016
4827
|
arrowRef.current = arrowEl, update();
|
|
5017
|
-
}, [update]), setFloating =
|
|
4828
|
+
}, [update]), setFloating = react.useCallback((node) => {
|
|
5018
4829
|
ref.current = node, refs.setFloating(node);
|
|
5019
|
-
}, [refs]), childRef =
|
|
5020
|
-
|
|
5021
|
-
const child =
|
|
4830
|
+
}, [refs]), childRef = react.useRef(null);
|
|
4831
|
+
react.useImperativeHandle(childProp?.ref, () => childRef.current);
|
|
4832
|
+
const child = react.useMemo(() => childProp ? react.cloneElement(childProp, {
|
|
5022
4833
|
onBlur: handleBlur,
|
|
5023
4834
|
onFocus: handleFocus,
|
|
5024
4835
|
onMouseEnter: handleMouseEnter,
|
|
@@ -5027,7 +4838,7 @@ const Root$a = styledComponents.styled(Layer)`
|
|
|
5027
4838
|
onContextMenu: handleContextMenu,
|
|
5028
4839
|
ref: childRef
|
|
5029
4840
|
}) : null, [childProp, handleBlur, handleClick, handleContextMenu, handleFocus, handleMouseEnter, handleMouseLeave]);
|
|
5030
|
-
if (
|
|
4841
|
+
if (react.useEffect(() => {
|
|
5031
4842
|
if (child)
|
|
5032
4843
|
return setReferenceElement(childRef.current), () => setReferenceElement(null);
|
|
5033
4844
|
}, [child]), !child) return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
@@ -5043,7 +4854,7 @@ const Root$a = styledComponents.styled(Layer)`
|
|
|
5043
4854
|
});
|
|
5044
4855
|
Tooltip.displayName = "ForwardRef(Tooltip)";
|
|
5045
4856
|
function useCloseOnMouseLeave(t0) {
|
|
5046
|
-
const $ =
|
|
4857
|
+
const $ = reactCompilerRuntime.c(7), {
|
|
5047
4858
|
handleIsOpenChange,
|
|
5048
4859
|
referenceElement,
|
|
5049
4860
|
showTooltip
|
|
@@ -5061,7 +4872,7 @@ function useCloseOnMouseLeave(t0) {
|
|
|
5061
4872
|
onMouseMove(event.target, () => window.removeEventListener("mousemove", handleMouseMove));
|
|
5062
4873
|
};
|
|
5063
4874
|
return window.addEventListener("mousemove", handleMouseMove), () => window.removeEventListener("mousemove", handleMouseMove);
|
|
5064
|
-
}, t3 = [onMouseMove, showTooltip], $[3] = showTooltip, $[4] = onMouseMove, $[5] = t2, $[6] = t3) : (t2 = $[5], t3 = $[6]),
|
|
4875
|
+
}, t3 = [onMouseMove, showTooltip], $[3] = showTooltip, $[4] = onMouseMove, $[5] = t2, $[6] = t3) : (t2 = $[5], t3 = $[6]), react.useEffect(t2, t3);
|
|
5065
4876
|
}
|
|
5066
4877
|
const Root$9 = styledComponents.styled.div`
|
|
5067
4878
|
line-height: 0;
|
|
@@ -5083,7 +4894,7 @@ const Root$9 = styledComponents.styled.div`
|
|
|
5083
4894
|
animation: ${rotate} 500ms linear infinite;
|
|
5084
4895
|
`;
|
|
5085
4896
|
function AutocompleteOption(props) {
|
|
5086
|
-
const $ =
|
|
4897
|
+
const $ = reactCompilerRuntime.c(11), {
|
|
5087
4898
|
children,
|
|
5088
4899
|
id,
|
|
5089
4900
|
onSelect,
|
|
@@ -5144,7 +4955,7 @@ function autocompleteReducer(state, msg2) {
|
|
|
5144
4955
|
value: msg2.value
|
|
5145
4956
|
} : state;
|
|
5146
4957
|
}
|
|
5147
|
-
const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = ["Control", "Shift", "Alt", "Enter", "Home", "End", "PageUp", "PageDown", "Meta", "Tab", "CapsLock"], AUTOCOMPLETE_POPOVER_PLACEMENT = "bottom-start", AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS = ["bottom-start", "top-start"], DEFAULT_RENDER_VALUE = (value, option) => option ? option.value : value, DEFAULT_FILTER_OPTION = (query, option) => option.value.toLowerCase().indexOf(query.toLowerCase()) > -1, InnerAutocomplete =
|
|
4958
|
+
const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = ["Control", "Shift", "Alt", "Enter", "Home", "End", "PageUp", "PageDown", "Meta", "Tab", "CapsLock"], AUTOCOMPLETE_POPOVER_PLACEMENT = "bottom-start", AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS = ["bottom-start", "top-start"], DEFAULT_RENDER_VALUE = (value, option) => option ? option.value : value, DEFAULT_FILTER_OPTION = (query, option) => option.value.toLowerCase().indexOf(query.toLowerCase()) > -1, InnerAutocomplete = react.forwardRef(function(props, forwardedRef) {
|
|
5148
4959
|
const {
|
|
5149
4960
|
border: border2 = !0,
|
|
5150
4961
|
customValidity,
|
|
@@ -5175,7 +4986,7 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = ["Control", "Shift", "Alt", "Enter", "H
|
|
|
5175
4986
|
suffix,
|
|
5176
4987
|
value: valueProp,
|
|
5177
4988
|
...restProps
|
|
5178
|
-
} = props, [state, dispatch] =
|
|
4989
|
+
} = props, [state, dispatch] = react.useReducer(autocompleteReducer, {
|
|
5179
4990
|
activeValue: valueProp || null,
|
|
5180
4991
|
focused: !1,
|
|
5181
4992
|
listFocused: !1,
|
|
@@ -5187,11 +4998,11 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = ["Control", "Shift", "Alt", "Enter", "H
|
|
|
5187
4998
|
listFocused,
|
|
5188
4999
|
query,
|
|
5189
5000
|
value
|
|
5190
|
-
} = state, defaultRenderOption =
|
|
5001
|
+
} = state, defaultRenderOption = react.useCallback(({
|
|
5191
5002
|
value: value_0
|
|
5192
|
-
}) => /* @__PURE__ */ jsxRuntime.jsx(Card, { "data-as": "button", padding: paddingProp, radius: 2, tone: "inherit", children: /* @__PURE__ */ jsxRuntime.jsx(Text, { size: fontSize2, textOverflow: "ellipsis", children: value_0 }) }), [fontSize2, paddingProp]), renderOption = typeof renderOptionProp == "function" ? renderOptionProp : defaultRenderOption, filterOption = typeof filterOptionProp == "function" ? filterOptionProp : DEFAULT_FILTER_OPTION, rootElementRef =
|
|
5193
|
-
|
|
5194
|
-
const listBoxId = `${id}-listbox`, options = Array.isArray(optionsProp) ? optionsProp : EMPTY_ARRAY, padding = useArrayProp(paddingProp), currentOption =
|
|
5003
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(Card, { "data-as": "button", padding: paddingProp, radius: 2, tone: "inherit", children: /* @__PURE__ */ jsxRuntime.jsx(Text, { size: fontSize2, textOverflow: "ellipsis", children: value_0 }) }), [fontSize2, paddingProp]), renderOption = typeof renderOptionProp == "function" ? renderOptionProp : defaultRenderOption, filterOption = typeof filterOptionProp == "function" ? filterOptionProp : DEFAULT_FILTER_OPTION, rootElementRef = react.useRef(null), resultsPopoverElementRef = react.useRef(null), inputElementRef = react.useRef(null), listBoxElementRef = react.useRef(null), listFocusedRef = react.useRef(!1), valueRef = react.useRef(value), valuePropRef = react.useRef(valueProp), popoverMouseWithinRef = react.useRef(!1);
|
|
5004
|
+
react.useImperativeHandle(forwardedRef, () => inputElementRef.current);
|
|
5005
|
+
const listBoxId = `${id}-listbox`, options = Array.isArray(optionsProp) ? optionsProp : EMPTY_ARRAY, padding = useArrayProp(paddingProp), currentOption = react.useMemo(() => value !== null ? options.find((o) => o.value === value) : void 0, [options, value]), filteredOptions = react.useMemo(() => options.filter((option) => query ? filterOption(query, option) : !0), [filterOption, options, query]), filteredOptionsLen = filteredOptions.length, activeItemId = activeValue ? `${id}-option-${activeValue}` : void 0, expanded = query !== null && loading || focused && query !== null, handleRootBlur = react.useCallback((event) => {
|
|
5195
5006
|
setTimeout(() => {
|
|
5196
5007
|
if (popoverMouseWithinRef.current)
|
|
5197
5008
|
return;
|
|
@@ -5208,18 +5019,18 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = ["Control", "Shift", "Alt", "Enter", "H
|
|
|
5208
5019
|
type: "root/blur"
|
|
5209
5020
|
}), popoverMouseWithinRef.current = !1, onQueryChange && onQueryChange(null), onBlur && onBlur(event));
|
|
5210
5021
|
}, 0);
|
|
5211
|
-
}, [onBlur, onQueryChange, relatedElements]), handleRootFocus =
|
|
5022
|
+
}, [onBlur, onQueryChange, relatedElements]), handleRootFocus = react.useCallback((event_0) => {
|
|
5212
5023
|
const listBoxElement = listBoxElementRef.current, focusedElement = event_0.target instanceof HTMLElement ? event_0.target : null, listFocused_0 = listBoxElement?.contains(focusedElement) || !1;
|
|
5213
5024
|
listFocused_0 !== listFocusedRef.current && (listFocusedRef.current = listFocused_0, dispatch({
|
|
5214
5025
|
type: "root/setListFocused",
|
|
5215
5026
|
listFocused: listFocused_0
|
|
5216
5027
|
}));
|
|
5217
|
-
}, []), handleOptionSelect =
|
|
5028
|
+
}, []), handleOptionSelect = react.useCallback((v) => {
|
|
5218
5029
|
dispatch({
|
|
5219
5030
|
type: "value/change",
|
|
5220
5031
|
value: v
|
|
5221
5032
|
}), popoverMouseWithinRef.current = !1, onSelect && onSelect(v), valueRef.current = v, onChange && onChange(v), onQueryChange && onQueryChange(null), inputElementRef.current?.focus();
|
|
5222
|
-
}, [onChange, onSelect, onQueryChange]), handleRootKeyDown =
|
|
5033
|
+
}, [onChange, onSelect, onQueryChange]), handleRootKeyDown = react.useCallback((event_1) => {
|
|
5223
5034
|
if (event_1.key === "ArrowDown") {
|
|
5224
5035
|
if (event_1.preventDefault(), !filteredOptionsLen) return;
|
|
5225
5036
|
const activeOption = filteredOptions.find((o_0) => o_0.value === activeValue), activeIndex = activeOption ? filteredOptions.indexOf(activeOption) : -1, nextActiveOption = filteredOptions[(activeIndex + 1) % filteredOptionsLen];
|
|
@@ -5251,35 +5062,35 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = ["Control", "Shift", "Alt", "Enter", "H
|
|
|
5251
5062
|
inputElementRef.current?.focus();
|
|
5252
5063
|
return;
|
|
5253
5064
|
}
|
|
5254
|
-
}, [activeValue, filteredOptions, filteredOptionsLen, onQueryChange]), handleInputChange =
|
|
5065
|
+
}, [activeValue, filteredOptions, filteredOptionsLen, onQueryChange]), handleInputChange = react.useCallback((event_2) => {
|
|
5255
5066
|
const nextQuery = event_2.currentTarget.value;
|
|
5256
5067
|
dispatch({
|
|
5257
5068
|
type: "input/change",
|
|
5258
5069
|
query: nextQuery
|
|
5259
5070
|
}), onQueryChange && onQueryChange(nextQuery);
|
|
5260
|
-
}, [onQueryChange]), dispatchOpen =
|
|
5071
|
+
}, [onQueryChange]), dispatchOpen = react.useCallback(() => {
|
|
5261
5072
|
dispatch({
|
|
5262
5073
|
type: "root/open",
|
|
5263
5074
|
query: value ? renderValue(value, currentOption) : ""
|
|
5264
5075
|
});
|
|
5265
|
-
}, [currentOption, renderValue, value]), handleInputFocus =
|
|
5076
|
+
}, [currentOption, renderValue, value]), handleInputFocus = react.useCallback((event_3) => {
|
|
5266
5077
|
focused || (dispatch({
|
|
5267
5078
|
type: "input/focus"
|
|
5268
5079
|
}), onFocus && onFocus(event_3), openOnFocus && dispatchOpen());
|
|
5269
|
-
}, [focused, onFocus, openOnFocus, dispatchOpen]), handlePopoverMouseEnter =
|
|
5080
|
+
}, [focused, onFocus, openOnFocus, dispatchOpen]), handlePopoverMouseEnter = react.useCallback(() => {
|
|
5270
5081
|
popoverMouseWithinRef.current = !0;
|
|
5271
|
-
}, []), handlePopoverMouseLeave =
|
|
5082
|
+
}, []), handlePopoverMouseLeave = react.useCallback(() => {
|
|
5272
5083
|
popoverMouseWithinRef.current = !1;
|
|
5273
|
-
}, []), handleClearButtonClick =
|
|
5084
|
+
}, []), handleClearButtonClick = react.useCallback(() => {
|
|
5274
5085
|
dispatch({
|
|
5275
5086
|
type: "root/clear"
|
|
5276
5087
|
}), valueRef.current = "", onChange && onChange(""), onQueryChange && onQueryChange(null), inputElementRef.current?.focus();
|
|
5277
|
-
}, [onChange, onQueryChange]), handleClearButtonFocus =
|
|
5088
|
+
}, [onChange, onQueryChange]), handleClearButtonFocus = react.useCallback(() => {
|
|
5278
5089
|
dispatch({
|
|
5279
5090
|
type: "input/focus"
|
|
5280
5091
|
});
|
|
5281
5092
|
}, []);
|
|
5282
|
-
|
|
5093
|
+
react.useEffect(() => {
|
|
5283
5094
|
if (valueProp !== valuePropRef.current) {
|
|
5284
5095
|
valuePropRef.current = valueProp, valueProp !== void 0 && (dispatch({
|
|
5285
5096
|
type: "value/change",
|
|
@@ -5291,12 +5102,12 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = ["Control", "Shift", "Alt", "Enter", "H
|
|
|
5291
5102
|
type: "value/change",
|
|
5292
5103
|
value: valueProp || null
|
|
5293
5104
|
}));
|
|
5294
|
-
}, [valueProp]),
|
|
5105
|
+
}, [valueProp]), react.useEffect(() => {
|
|
5295
5106
|
!focused && valueRef.current && dispatch({
|
|
5296
5107
|
type: "root/setActiveValue",
|
|
5297
5108
|
value: valueRef.current
|
|
5298
5109
|
});
|
|
5299
|
-
}, [focused]),
|
|
5110
|
+
}, [focused]), react.useEffect(() => {
|
|
5300
5111
|
const listElement = listBoxElementRef.current;
|
|
5301
5112
|
if (!listElement) return;
|
|
5302
5113
|
const activeOption_1 = filteredOptions.find((o_2) => o_2.value === activeValue);
|
|
@@ -5309,24 +5120,24 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = ["Control", "Shift", "Alt", "Enter", "H
|
|
|
5309
5120
|
}
|
|
5310
5121
|
}
|
|
5311
5122
|
}, [activeValue, filteredOptions]);
|
|
5312
|
-
const clearButton =
|
|
5123
|
+
const clearButton = react.useMemo(() => {
|
|
5313
5124
|
if (!loading && !disabled && value)
|
|
5314
5125
|
return {
|
|
5315
5126
|
"aria-label": "Clear",
|
|
5316
5127
|
onFocus: handleClearButtonFocus
|
|
5317
5128
|
};
|
|
5318
|
-
}, [disabled, handleClearButtonFocus, loading, value]), openButtonBoxPadding =
|
|
5129
|
+
}, [disabled, handleClearButtonFocus, loading, value]), openButtonBoxPadding = react.useMemo(() => padding.map((v_0) => v_0 === 0 ? 0 : v_0 === 1 || v_0 === 2 ? 1 : v_0 - 2), [padding]), openButtonPadding = react.useMemo(() => padding.map((v_1) => Math.max(v_1 - 1, 0)), [padding]), openButtonProps = react.useMemo(() => typeof openButton == "object" ? openButton : EMPTY_RECORD, [openButton]), handleOpenClick = react.useCallback((event_4) => {
|
|
5319
5130
|
dispatchOpen(), openButtonProps.onClick && openButtonProps.onClick(event_4), _raf(() => inputElementRef.current?.focus());
|
|
5320
|
-
}, [openButtonProps, dispatchOpen]), openButtonNode =
|
|
5131
|
+
}, [openButtonProps, dispatchOpen]), openButtonNode = react.useMemo(() => !disabled && !readOnly && openButton ? /* @__PURE__ */ jsxRuntime.jsx(Box, { "aria-hidden": expanded, padding: openButtonBoxPadding, children: /* @__PURE__ */ jsxRuntime.jsx(Button, { "aria-label": "Open", disabled: expanded, fontSize: fontSize2, icon: icons.ChevronDownIcon, mode: "bleed", padding: openButtonPadding, ...openButtonProps, onClick: handleOpenClick }) }) : void 0, [disabled, expanded, fontSize2, handleOpenClick, openButton, openButtonBoxPadding, openButtonPadding, openButtonProps, readOnly]), inputValue = react.useMemo(() => query === null ? value !== null ? renderValue(value, currentOption) : "" : query, [currentOption, query, renderValue, value]), input = /* @__PURE__ */ jsxRuntime.jsx(TextInput, { ...restProps, "aria-activedescendant": activeItemId, "aria-autocomplete": "list", "aria-expanded": expanded, "aria-owns": listBoxId, autoCapitalize: "off", autoComplete: "off", autoCorrect: "off", border: border2, clearButton, customValidity, disabled, fontSize: fontSize2, icon, iconRight: loading && AnimatedSpinnerIcon, id, inputMode: "search", onChange: handleInputChange, onClear: handleClearButtonClick, onFocus: handleInputFocus, padding, prefix, radius, readOnly, ref: inputElementRef, role: "combobox", spellCheck: !1, suffix: suffix || openButtonNode, value: inputValue }), handleListBoxKeyDown = react.useCallback((event_5) => {
|
|
5321
5132
|
event_5.key === "Tab" && listFocused && inputElementRef.current?.focus();
|
|
5322
|
-
}, [listFocused]), content =
|
|
5133
|
+
}, [listFocused]), content = react.useMemo(() => filteredOptions.length === 0 ? null : /* @__PURE__ */ jsxRuntime.jsx(ListBox, { "data-ui": "AutoComplete__results", onKeyDown: handleListBoxKeyDown, padding: 1, ...listBox, tabIndex: -1, children: /* @__PURE__ */ jsxRuntime.jsx(Stack, { as: "ul", "aria-multiselectable": !1, "data-ui": "AutoComplete__resultsList", id: listBoxId, ref: listBoxElementRef, role: "listbox", space: 1, children: filteredOptions.map((option_0) => {
|
|
5323
5134
|
const active = activeValue !== null ? option_0.value === activeValue : currentOption === option_0;
|
|
5324
|
-
return /* @__PURE__ */ jsxRuntime.jsx(AutocompleteOption, { id: `${id}-option-${option_0.value}`, onSelect: handleOptionSelect, selected: active, value: option_0.value, children:
|
|
5135
|
+
return /* @__PURE__ */ jsxRuntime.jsx(AutocompleteOption, { id: `${id}-option-${option_0.value}`, onSelect: handleOptionSelect, selected: active, value: option_0.value, children: react.cloneElement(renderOption(option_0), {
|
|
5325
5136
|
disabled: loading,
|
|
5326
5137
|
selected: active,
|
|
5327
5138
|
tabIndex: listFocused && active ? 0 : -1
|
|
5328
5139
|
}) }, option_0.value);
|
|
5329
|
-
}) }) }), [activeValue, currentOption, filteredOptions, handleOptionSelect, handleListBoxKeyDown, id, listBox, listBoxId, listFocused, loading, renderOption]), results =
|
|
5140
|
+
}) }) }), [activeValue, currentOption, filteredOptions, handleOptionSelect, handleListBoxKeyDown, id, listBox, listBoxId, listFocused, loading, renderOption]), results = react.useMemo(() => renderPopover ? renderPopover({
|
|
5330
5141
|
content,
|
|
5331
5142
|
hidden: !expanded,
|
|
5332
5143
|
inputElement: inputElementRef.current,
|
|
@@ -5350,16 +5161,16 @@ const Autocomplete = InnerAutocomplete, Root$8 = styledComponents.styled.ol`
|
|
|
5350
5161
|
`, ExpandButton = styledComponents.styled(Button)`
|
|
5351
5162
|
appearance: none;
|
|
5352
5163
|
margin: -4px;
|
|
5353
|
-
`, Breadcrumbs =
|
|
5164
|
+
`, Breadcrumbs = react.forwardRef(function(props, ref) {
|
|
5354
5165
|
const {
|
|
5355
5166
|
children,
|
|
5356
5167
|
maxLength,
|
|
5357
5168
|
separator,
|
|
5358
5169
|
space: spaceRaw = 2,
|
|
5359
5170
|
...restProps
|
|
5360
|
-
} = props, space = useArrayProp(spaceRaw), [open, setOpen] =
|
|
5171
|
+
} = props, space = useArrayProp(spaceRaw), [open, setOpen] = react.useState(!1), expandElementRef = react.useRef(null), popoverElementRef = react.useRef(null), collapse = react.useCallback(() => setOpen(!1), []), expand = react.useCallback(() => setOpen(!0), []);
|
|
5361
5172
|
useClickOutsideEvent(collapse, () => [expandElementRef.current, popoverElementRef.current]);
|
|
5362
|
-
const rawItems =
|
|
5173
|
+
const rawItems = react.useMemo(() => react.Children.toArray(children).filter(react.isValidElement), [children]), items = react.useMemo(() => {
|
|
5363
5174
|
const len = rawItems.length;
|
|
5364
5175
|
if (maxLength && len > maxLength) {
|
|
5365
5176
|
const beforeLength = Math.ceil(maxLength / 2), afterLength = Math.floor(maxLength / 2);
|
|
@@ -5367,7 +5178,7 @@ const Autocomplete = InnerAutocomplete, Root$8 = styledComponents.styled.ol`
|
|
|
5367
5178
|
}
|
|
5368
5179
|
return rawItems;
|
|
5369
5180
|
}, [collapse, expand, maxLength, open, rawItems, space]);
|
|
5370
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Root$8, { "data-ui": "Breadcrumbs", ...restProps, ref, children: items.map((item, itemIndex) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5181
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Root$8, { "data-ui": "Breadcrumbs", ...restProps, ref, children: items.map((item, itemIndex) => /* @__PURE__ */ jsxRuntime.jsxs(react.Fragment, { children: [
|
|
5371
5182
|
itemIndex > 0 && /* @__PURE__ */ jsxRuntime.jsx(Box, { "aria-hidden": !0, as: "li", paddingX: space, children: separator || /* @__PURE__ */ jsxRuntime.jsx(Text, { muted: !0, children: "/" }) }),
|
|
5372
5183
|
/* @__PURE__ */ jsxRuntime.jsx(Box, { as: "li", children: item })
|
|
5373
5184
|
] }, itemIndex)) });
|
|
@@ -5435,7 +5246,7 @@ const DialogContext = createGlobalScopedContext("@sanity/ui/context/dialog", {
|
|
|
5435
5246
|
version: 0
|
|
5436
5247
|
});
|
|
5437
5248
|
function useDialog() {
|
|
5438
|
-
return
|
|
5249
|
+
return react.useContext(DialogContext);
|
|
5439
5250
|
}
|
|
5440
5251
|
function isTargetWithinScope(boundaryElement, portalElement, target) {
|
|
5441
5252
|
return !boundaryElement || !portalElement ? !0 : containsOrEqualsElement(boundaryElement, target) || containsOrEqualsElement(portalElement, target);
|
|
@@ -5473,8 +5284,8 @@ const Root$7 = styledComponents.styled(Layer)(responsivePaddingStyle, dialogStyl
|
|
|
5473
5284
|
`, DialogFooter = styledComponents.styled(Box)`
|
|
5474
5285
|
position: relative;
|
|
5475
5286
|
z-index: 3;
|
|
5476
|
-
`, DialogCard =
|
|
5477
|
-
const $ =
|
|
5287
|
+
`, DialogCard = react.forwardRef(function(props, forwardedRef) {
|
|
5288
|
+
const $ = reactCompilerRuntime.c(38), {
|
|
5478
5289
|
__unstable_autoFocus: autoFocus,
|
|
5479
5290
|
__unstable_hideCloseButton: hideCloseButton,
|
|
5480
5291
|
children,
|
|
@@ -5489,17 +5300,17 @@ const Root$7 = styledComponents.styled(Layer)(responsivePaddingStyle, dialogStyl
|
|
|
5489
5300
|
scheme,
|
|
5490
5301
|
shadow: shadowProp,
|
|
5491
5302
|
width: widthProp
|
|
5492
|
-
} = props, portal = usePortal(), portalElement = portalProp ? portal.elements?.[portalProp] || null : portal.element, boundaryElement = useBoundaryElement().element, radius = useArrayProp(radiusProp), shadow = useArrayProp(shadowProp), width = useArrayProp(widthProp), ref =
|
|
5303
|
+
} = props, portal = usePortal(), portalElement = portalProp ? portal.elements?.[portalProp] || null : portal.element, boundaryElement = useBoundaryElement().element, radius = useArrayProp(radiusProp), shadow = useArrayProp(shadowProp), width = useArrayProp(widthProp), ref = react.useRef(null), contentRef = react.useRef(null), layer = useLayer(), {
|
|
5493
5304
|
isTopLayer
|
|
5494
5305
|
} = layer, labelId = `${id}_label`, showCloseButton = !!onClose && hideCloseButton === !1, showHeader = !!header || showCloseButton;
|
|
5495
5306
|
let t0;
|
|
5496
|
-
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = () => ref.current, $[0] = t0) : t0 = $[0],
|
|
5307
|
+
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = () => ref.current, $[0] = t0) : t0 = $[0], react.useImperativeHandle(forwardedRef, t0);
|
|
5497
5308
|
let t1;
|
|
5498
|
-
$[1] === Symbol.for("react.memo_cache_sentinel") ? (t1 = () => contentRef.current, $[1] = t1) : t1 = $[1],
|
|
5309
|
+
$[1] === Symbol.for("react.memo_cache_sentinel") ? (t1 = () => contentRef.current, $[1] = t1) : t1 = $[1], react.useImperativeHandle(forwardedContentRef, t1);
|
|
5499
5310
|
let t2, t3;
|
|
5500
5311
|
$[2] !== autoFocus ? (t2 = () => {
|
|
5501
5312
|
autoFocus && ref.current && focusFirstDescendant(ref.current);
|
|
5502
|
-
}, t3 = [autoFocus, ref], $[2] = autoFocus, $[3] = t2, $[4] = t3) : (t2 = $[3], t3 = $[4]),
|
|
5313
|
+
}, t3 = [autoFocus, ref], $[2] = autoFocus, $[3] = t2, $[4] = t3) : (t2 = $[3], t3 = $[4]), react.useEffect(t2, t3);
|
|
5503
5314
|
let t4;
|
|
5504
5315
|
$[5] !== isTopLayer || $[6] !== onClose || $[7] !== boundaryElement || $[8] !== portalElement ? (t4 = (event) => {
|
|
5505
5316
|
if (!isTopLayer || !onClose)
|
|
@@ -5535,7 +5346,7 @@ const Root$7 = styledComponents.styled(Layer)(responsivePaddingStyle, dialogStyl
|
|
|
5535
5346
|
return $[35] !== width || $[36] !== t11 ? (t12 = /* @__PURE__ */ jsxRuntime.jsx(DialogContainer, { "data-ui": "DialogCard", width, children: t11 }), $[35] = width, $[36] = t11, $[37] = t12) : t12 = $[37], t12;
|
|
5536
5347
|
});
|
|
5537
5348
|
DialogCard.displayName = "ForwardRef(DialogCard)";
|
|
5538
|
-
const Dialog =
|
|
5349
|
+
const Dialog = react.forwardRef(function(props, ref) {
|
|
5539
5350
|
const dialog = useDialog(), {
|
|
5540
5351
|
layer
|
|
5541
5352
|
} = useTheme_v2(), {
|
|
@@ -5560,7 +5371,7 @@ const Dialog = require$$0.forwardRef(function(props, ref) {
|
|
|
5560
5371
|
zOffset: zOffsetProp = dialog.zOffset || layer.dialog.zOffset,
|
|
5561
5372
|
animate: _animate = !1,
|
|
5562
5373
|
...restProps
|
|
5563
|
-
} = props, animate = usePrefersReducedMotion() ? !1 : _animate, portal = usePortal(), portalElement = portalProp ? portal.elements?.[portalProp] || null : portal.element, boundaryElement = useBoundaryElement().element, cardRadius = useArrayProp(cardRadiusProp), padding = useArrayProp(paddingProp), position = useArrayProp(positionProp), width = useArrayProp(widthProp), zOffset = useArrayProp(zOffsetProp), preDivRef =
|
|
5374
|
+
} = props, animate = usePrefersReducedMotion() ? !1 : _animate, portal = usePortal(), portalElement = portalProp ? portal.elements?.[portalProp] || null : portal.element, boundaryElement = useBoundaryElement().element, cardRadius = useArrayProp(cardRadiusProp), padding = useArrayProp(paddingProp), position = useArrayProp(positionProp), width = useArrayProp(widthProp), zOffset = useArrayProp(zOffsetProp), preDivRef = react.useRef(null), postDivRef = react.useRef(null), cardRef = react.useRef(null), focusedElementRef = react.useRef(null), handleFocus = react.useCallback((event) => {
|
|
5564
5375
|
onFocus?.(event);
|
|
5565
5376
|
const target = event.target, cardElement = cardRef.current;
|
|
5566
5377
|
if (cardElement && target === preDivRef.current) {
|
|
@@ -5572,7 +5383,7 @@ const Dialog = require$$0.forwardRef(function(props, ref) {
|
|
|
5572
5383
|
return;
|
|
5573
5384
|
}
|
|
5574
5385
|
isHTMLElement(event.target) && (focusedElementRef.current = event.target);
|
|
5575
|
-
}, [onFocus]), labelId = `${id}_label`, rootClickTimeoutRef =
|
|
5386
|
+
}, [onFocus]), labelId = `${id}_label`, rootClickTimeoutRef = react.useRef(), handleRootClick = react.useCallback(() => {
|
|
5576
5387
|
rootClickTimeoutRef.current && clearTimeout(rootClickTimeoutRef.current), rootClickTimeoutRef.current = setTimeout(() => {
|
|
5577
5388
|
const activeElement = document.activeElement;
|
|
5578
5389
|
if (activeElement && !isTargetWithinScope(boundaryElement, portalElement, activeElement)) {
|
|
@@ -5594,7 +5405,7 @@ const Dialog = require$$0.forwardRef(function(props, ref) {
|
|
|
5594
5405
|
});
|
|
5595
5406
|
Dialog.displayName = "ForwardRef(Dialog)";
|
|
5596
5407
|
function DialogProvider(props) {
|
|
5597
|
-
const $ =
|
|
5408
|
+
const $ = reactCompilerRuntime.c(6), {
|
|
5598
5409
|
children,
|
|
5599
5410
|
position,
|
|
5600
5411
|
zOffset
|
|
@@ -5621,8 +5432,8 @@ const Root$6 = styledComponents.styled.kbd`
|
|
|
5621
5432
|
&:not([hidden]) {
|
|
5622
5433
|
display: block;
|
|
5623
5434
|
}
|
|
5624
|
-
`, Hotkeys =
|
|
5625
|
-
const $ =
|
|
5435
|
+
`, Hotkeys = react.forwardRef(function(props, ref) {
|
|
5436
|
+
const $ = reactCompilerRuntime.c(24);
|
|
5626
5437
|
let t0, keys, fontSize2, padding, radius, restProps;
|
|
5627
5438
|
$[0] !== props ? ({
|
|
5628
5439
|
fontSize: fontSize2,
|
|
@@ -5692,9 +5503,9 @@ function useMenuController(props) {
|
|
|
5692
5503
|
originElement,
|
|
5693
5504
|
shouldFocus,
|
|
5694
5505
|
rootElementRef
|
|
5695
|
-
} = props, elementsRef =
|
|
5506
|
+
} = props, elementsRef = react.useRef([]), [activeIndex, _setActiveIndex] = react.useState(-1), activeIndexRef = react.useRef(activeIndex), activeElement = react.useMemo(() => elementsRef.current[activeIndex] || null, [activeIndex]), mounted = !!rootElementRef.current, setActiveIndex = react.useCallback((nextActiveIndex) => {
|
|
5696
5507
|
_setActiveIndex(nextActiveIndex), activeIndexRef.current = nextActiveIndex;
|
|
5697
|
-
}, []), mount =
|
|
5508
|
+
}, []), mount = react.useCallback((element, selected) => {
|
|
5698
5509
|
if (!element) return () => {
|
|
5699
5510
|
};
|
|
5700
5511
|
if (elementsRef.current.indexOf(element) === -1 && (elementsRef.current.push(element), _sortElements(rootElementRef.current, elementsRef.current)), selected) {
|
|
@@ -5705,7 +5516,7 @@ function useMenuController(props) {
|
|
|
5705
5516
|
const idx = elementsRef.current.indexOf(element);
|
|
5706
5517
|
idx > -1 && elementsRef.current.splice(idx, 1);
|
|
5707
5518
|
};
|
|
5708
|
-
}, [rootElementRef, setActiveIndex]), handleKeyDown =
|
|
5519
|
+
}, [rootElementRef, setActiveIndex]), handleKeyDown = react.useCallback((event) => {
|
|
5709
5520
|
if (event.key === "Tab") {
|
|
5710
5521
|
originElement && originElement.focus();
|
|
5711
5522
|
return;
|
|
@@ -5749,13 +5560,13 @@ function useMenuController(props) {
|
|
|
5749
5560
|
return;
|
|
5750
5561
|
}
|
|
5751
5562
|
onKeyDown && onKeyDown(event);
|
|
5752
|
-
}, [onKeyDown, originElement, setActiveIndex]), handleItemMouseEnter =
|
|
5563
|
+
}, [onKeyDown, originElement, setActiveIndex]), handleItemMouseEnter = react.useCallback((event_0) => {
|
|
5753
5564
|
const element_0 = event_0.currentTarget, currentIndex_3 = elementsRef.current.indexOf(element_0);
|
|
5754
5565
|
setActiveIndex(currentIndex_3);
|
|
5755
|
-
}, [setActiveIndex]), handleItemMouseLeave =
|
|
5566
|
+
}, [setActiveIndex]), handleItemMouseLeave = react.useCallback(() => {
|
|
5756
5567
|
setActiveIndex(-2), rootElementRef.current?.focus();
|
|
5757
5568
|
}, [rootElementRef, setActiveIndex]);
|
|
5758
|
-
return
|
|
5569
|
+
return react.useEffect(() => {
|
|
5759
5570
|
if (!mounted) return;
|
|
5760
5571
|
const rafId = requestAnimationFrame(() => {
|
|
5761
5572
|
if (activeIndex === -1) {
|
|
@@ -5790,7 +5601,7 @@ function useMenuController(props) {
|
|
|
5790
5601
|
const Root$5 = styledComponents.styled(Box)`
|
|
5791
5602
|
outline: none;
|
|
5792
5603
|
overflow: auto;
|
|
5793
|
-
`, Menu =
|
|
5604
|
+
`, Menu = react.forwardRef(function(props, forwardedRef) {
|
|
5794
5605
|
const {
|
|
5795
5606
|
children,
|
|
5796
5607
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -5808,8 +5619,8 @@ const Root$5 = styledComponents.styled(Box)`
|
|
|
5808
5619
|
shouldFocus = props.focusFirst && "first" || props.focusLast && "last" || null,
|
|
5809
5620
|
space = 1,
|
|
5810
5621
|
...restProps
|
|
5811
|
-
} = props, ref =
|
|
5812
|
-
|
|
5622
|
+
} = props, ref = react.useRef(null);
|
|
5623
|
+
react.useImperativeHandle(forwardedRef, () => ref.current);
|
|
5813
5624
|
const {
|
|
5814
5625
|
isTopLayer
|
|
5815
5626
|
} = useLayer(), {
|
|
@@ -5824,15 +5635,15 @@ const Root$5 = styledComponents.styled(Box)`
|
|
|
5824
5635
|
originElement,
|
|
5825
5636
|
shouldFocus,
|
|
5826
5637
|
rootElementRef: ref
|
|
5827
|
-
}), unregisterElementRef =
|
|
5638
|
+
}), unregisterElementRef = react.useRef(null), handleRefChange = react.useCallback((el) => {
|
|
5828
5639
|
unregisterElementRef.current && (unregisterElementRef.current(), unregisterElementRef.current = null), ref.current = el, ref.current && registerElement && (unregisterElementRef.current = registerElement(ref.current));
|
|
5829
5640
|
}, [registerElement]);
|
|
5830
|
-
|
|
5641
|
+
react.useEffect(() => {
|
|
5831
5642
|
onItemSelect && onItemSelect(activeIndex);
|
|
5832
|
-
}, [activeIndex, onItemSelect]), useClickOutsideEvent(isTopLayer && onClickOutside, () => [ref.current]), useGlobalKeyDown(
|
|
5643
|
+
}, [activeIndex, onItemSelect]), useClickOutsideEvent(isTopLayer && onClickOutside, () => [ref.current]), useGlobalKeyDown(react.useCallback((event) => {
|
|
5833
5644
|
isTopLayer && event.key === "Escape" && (event.stopPropagation(), onEscape && onEscape());
|
|
5834
5645
|
}, [isTopLayer, onEscape]));
|
|
5835
|
-
const value =
|
|
5646
|
+
const value = react.useMemo(() => ({
|
|
5836
5647
|
version: 0,
|
|
5837
5648
|
activeElement,
|
|
5838
5649
|
activeIndex,
|
|
@@ -5850,7 +5661,7 @@ const Root$5 = styledComponents.styled(Box)`
|
|
|
5850
5661
|
return /* @__PURE__ */ jsxRuntime.jsx(MenuContext.Provider, { value, children: /* @__PURE__ */ jsxRuntime.jsx(Root$5, { "data-ui": "Menu", ...restProps, onKeyDown: handleKeyDown, padding, ref: handleRefChange, role: "menu", tabIndex: -1, children: /* @__PURE__ */ jsxRuntime.jsx(Stack, { space, children }) }) });
|
|
5851
5662
|
});
|
|
5852
5663
|
Menu.displayName = "ForwardRef(Menu)";
|
|
5853
|
-
const MenuButton =
|
|
5664
|
+
const MenuButton = react.forwardRef(function(props, forwardedRef) {
|
|
5854
5665
|
const {
|
|
5855
5666
|
__unstable_disableRestoreFocusOnClose: disableRestoreFocusOnClose = !1,
|
|
5856
5667
|
boundaryElement: deprecated_boundaryElement,
|
|
@@ -5865,19 +5676,19 @@ const MenuButton = require$$0.forwardRef(function(props, forwardedRef) {
|
|
|
5865
5676
|
popover,
|
|
5866
5677
|
popoverRadius: deprecated_popoverRadius,
|
|
5867
5678
|
preventOverflow: deprecated_preventOverflow
|
|
5868
|
-
} = props, [open, setOpen] =
|
|
5869
|
-
|
|
5679
|
+
} = props, [open, setOpen] = react.useState(!1), [shouldFocus, setShouldFocus] = react.useState(null), [buttonElement, setButtonElement] = react.useState(null), [menuElements, setChildMenuElements] = react.useState([]), openRef = react.useRef(open);
|
|
5680
|
+
react.useEffect(() => {
|
|
5870
5681
|
onOpen && open && !openRef.current && onOpen();
|
|
5871
|
-
}, [onOpen, open]),
|
|
5682
|
+
}, [onOpen, open]), react.useEffect(() => {
|
|
5872
5683
|
onClose && !open && openRef.current && onClose();
|
|
5873
|
-
}, [onClose, open]),
|
|
5684
|
+
}, [onClose, open]), react.useEffect(() => {
|
|
5874
5685
|
openRef.current = open;
|
|
5875
5686
|
}, [open]);
|
|
5876
|
-
const handleButtonClick =
|
|
5687
|
+
const handleButtonClick = react.useCallback(() => {
|
|
5877
5688
|
setOpen((v) => !v), setShouldFocus(null);
|
|
5878
|
-
}, []), handleMouseDown =
|
|
5689
|
+
}, []), handleMouseDown = react.useCallback((event) => {
|
|
5879
5690
|
open && event.preventDefault();
|
|
5880
|
-
}, [open]), handleButtonKeyDown =
|
|
5691
|
+
}, [open]), handleButtonKeyDown = react.useCallback((event_0) => {
|
|
5881
5692
|
if (event_0.key === "ArrowDown" || event_0.key === "Enter" || event_0.key === " ") {
|
|
5882
5693
|
event_0.preventDefault(), setOpen(!0), setShouldFocus("first");
|
|
5883
5694
|
return;
|
|
@@ -5886,7 +5697,7 @@ const MenuButton = require$$0.forwardRef(function(props, forwardedRef) {
|
|
|
5886
5697
|
event_0.preventDefault(), setOpen(!0), setShouldFocus("last");
|
|
5887
5698
|
return;
|
|
5888
5699
|
}
|
|
5889
|
-
}, []), handleMenuClickOutside =
|
|
5700
|
+
}, []), handleMenuClickOutside = react.useCallback((event_1) => {
|
|
5890
5701
|
const target = event_1.target;
|
|
5891
5702
|
if (target instanceof Node && !(buttonElement && (target === buttonElement || buttonElement.contains(target)))) {
|
|
5892
5703
|
for (const el of menuElements)
|
|
@@ -5894,9 +5705,9 @@ const MenuButton = require$$0.forwardRef(function(props, forwardedRef) {
|
|
|
5894
5705
|
return;
|
|
5895
5706
|
setOpen(!1);
|
|
5896
5707
|
}
|
|
5897
|
-
}, [buttonElement, menuElements]), handleMenuEscape =
|
|
5708
|
+
}, [buttonElement, menuElements]), handleMenuEscape = react.useCallback(() => {
|
|
5898
5709
|
setOpen(!1), !disableRestoreFocusOnClose && buttonElement && buttonElement.focus();
|
|
5899
|
-
}, [buttonElement, disableRestoreFocusOnClose]), handleBlur =
|
|
5710
|
+
}, [buttonElement, disableRestoreFocusOnClose]), handleBlur = react.useCallback((event_2) => {
|
|
5900
5711
|
const target_0 = event_2.relatedTarget;
|
|
5901
5712
|
if (target_0 instanceof Node) {
|
|
5902
5713
|
for (const el_0 of menuElements)
|
|
@@ -5904,9 +5715,9 @@ const MenuButton = require$$0.forwardRef(function(props, forwardedRef) {
|
|
|
5904
5715
|
return;
|
|
5905
5716
|
setOpen(!1);
|
|
5906
5717
|
}
|
|
5907
|
-
}, [menuElements]), handleItemClick =
|
|
5718
|
+
}, [menuElements]), handleItemClick = react.useCallback(() => {
|
|
5908
5719
|
setOpen(!1), !disableRestoreFocusOnClose && buttonElement && buttonElement.focus();
|
|
5909
|
-
}, [buttonElement, disableRestoreFocusOnClose]), registerElement =
|
|
5720
|
+
}, [buttonElement, disableRestoreFocusOnClose]), registerElement = react.useCallback((el_1) => (setChildMenuElements((els) => els.concat([el_1])), () => setChildMenuElements((els_0) => els_0.filter((_el) => _el !== el_1))), []), menuProps = react.useMemo(() => ({
|
|
5910
5721
|
"aria-labelledby": id,
|
|
5911
5722
|
onBlurCapture: handleBlur,
|
|
5912
5723
|
onClickOutside: handleMenuClickOutside,
|
|
@@ -5915,7 +5726,7 @@ const MenuButton = require$$0.forwardRef(function(props, forwardedRef) {
|
|
|
5915
5726
|
originElement: buttonElement,
|
|
5916
5727
|
registerElement,
|
|
5917
5728
|
shouldFocus
|
|
5918
|
-
}), [buttonElement, handleMenuClickOutside, handleMenuEscape, handleItemClick, id, handleBlur, registerElement, shouldFocus]), menu = menuProp &&
|
|
5729
|
+
}), [buttonElement, handleMenuClickOutside, handleMenuEscape, handleItemClick, id, handleBlur, registerElement, shouldFocus]), menu = menuProp && react.cloneElement(menuProp, menuProps), ref = react.useRef(null), button = react.useMemo(() => buttonProp && react.cloneElement(buttonProp, {
|
|
5919
5730
|
"data-ui": "MenuButton",
|
|
5920
5731
|
id,
|
|
5921
5732
|
onClick: handleButtonClick,
|
|
@@ -5926,11 +5737,11 @@ const MenuButton = require$$0.forwardRef(function(props, forwardedRef) {
|
|
|
5926
5737
|
ref,
|
|
5927
5738
|
selected: buttonProp.props.selected ?? open
|
|
5928
5739
|
}), [buttonProp, handleButtonClick, handleButtonKeyDown, handleMouseDown, id, open]);
|
|
5929
|
-
|
|
5740
|
+
react.useImperativeHandle(forwardedRef, () => ref.current), react.useEffect(() => {
|
|
5930
5741
|
if (button)
|
|
5931
5742
|
return setButtonElement(ref.current), () => setButtonElement(null);
|
|
5932
5743
|
}, [button]);
|
|
5933
|
-
const popoverProps =
|
|
5744
|
+
const popoverProps = react.useMemo(() => ({
|
|
5934
5745
|
boundaryElement: deprecated_boundaryElement,
|
|
5935
5746
|
overflow: "auto",
|
|
5936
5747
|
placement: deprecated_placement,
|
|
@@ -6053,7 +5864,7 @@ function selectableColorStyle(props) {
|
|
|
6053
5864
|
const Selectable = styledComponents.styled(Box)(responsiveRadiusStyle, selectableBaseStyle, selectableColorStyle);
|
|
6054
5865
|
Selectable.displayName = "Selectable";
|
|
6055
5866
|
function useMenu() {
|
|
6056
|
-
const value =
|
|
5867
|
+
const value = react.useContext(MenuContext);
|
|
6057
5868
|
if (!value)
|
|
6058
5869
|
throw new Error("useMenu(): missing context value");
|
|
6059
5870
|
if (!isRecord(value) || value.version !== 0)
|
|
@@ -6084,27 +5895,27 @@ function MenuGroup(props) {
|
|
|
6084
5895
|
onItemClick,
|
|
6085
5896
|
onItemMouseEnter = menu.onMouseEnter,
|
|
6086
5897
|
registerElement
|
|
6087
|
-
} = menu, [rootElement, setRootElement] =
|
|
5898
|
+
} = menu, [rootElement, setRootElement] = react.useState(null), [open, setOpen] = react.useState(!1), [shouldFocus, setShouldFocus] = react.useState(null), active = !!activeElement && activeElement === rootElement, [withinMenu, setWithinMenu] = react.useState(!1), handleMouseEnter = react.useCallback((event) => {
|
|
6088
5899
|
setWithinMenu(!1), onItemMouseEnter(event), setOpen(!0);
|
|
6089
|
-
}, [onItemMouseEnter]), handleMenuKeyDown =
|
|
5900
|
+
}, [onItemMouseEnter]), handleMenuKeyDown = react.useCallback((event_0) => {
|
|
6090
5901
|
event_0.key === "ArrowLeft" && (event_0.stopPropagation(), setOpen(!1), requestAnimationFrame(() => {
|
|
6091
5902
|
rootElement?.focus();
|
|
6092
5903
|
}));
|
|
6093
|
-
}, [rootElement]), handleClick =
|
|
5904
|
+
}, [rootElement]), handleClick = react.useCallback((event_1) => {
|
|
6094
5905
|
onClick?.(event_1), setShouldFocus("first"), setOpen(!0);
|
|
6095
|
-
}, [onClick]), handleChildItemClick =
|
|
5906
|
+
}, [onClick]), handleChildItemClick = react.useCallback(() => {
|
|
6096
5907
|
setOpen(!1), onItemClick?.();
|
|
6097
|
-
}, [onItemClick]), handleMenuMouseEnter =
|
|
6098
|
-
|
|
5908
|
+
}, [onItemClick]), handleMenuMouseEnter = react.useCallback(() => setWithinMenu(!0), []);
|
|
5909
|
+
react.useEffect(() => mount(rootElement), [mount, rootElement]), react.useEffect(() => {
|
|
6099
5910
|
active || setOpen(!1);
|
|
6100
|
-
}, [active]),
|
|
5911
|
+
}, [active]), react.useEffect(() => {
|
|
6101
5912
|
open || setWithinMenu(!1);
|
|
6102
|
-
}, [open]),
|
|
5913
|
+
}, [open]), react.useEffect(() => {
|
|
6103
5914
|
if (!shouldFocus) return;
|
|
6104
5915
|
const rafId = requestAnimationFrame(() => setShouldFocus(null));
|
|
6105
5916
|
return () => cancelAnimationFrame(rafId);
|
|
6106
5917
|
}, [shouldFocus]);
|
|
6107
|
-
const childMenu = /* @__PURE__ */ jsxRuntime.jsx(Menu, { onClickOutside, onEscape, onItemClick: handleChildItemClick, onKeyDown: handleMenuKeyDown, onMouseEnter: handleMenuMouseEnter, registerElement, shouldFocus, children }), handleKeyDown =
|
|
5918
|
+
const childMenu = /* @__PURE__ */ jsxRuntime.jsx(Menu, { onClickOutside, onEscape, onItemClick: handleChildItemClick, onKeyDown: handleMenuKeyDown, onMouseEnter: handleMenuMouseEnter, registerElement, shouldFocus, children }), handleKeyDown = react.useCallback((event_2) => {
|
|
6108
5919
|
const target = event_2.currentTarget;
|
|
6109
5920
|
if (document.activeElement === target && event_2.key === "ArrowRight") {
|
|
6110
5921
|
setShouldFocus("first"), setOpen(!0), setWithinMenu(!0);
|
|
@@ -6113,7 +5924,7 @@ function MenuGroup(props) {
|
|
|
6113
5924
|
}, []);
|
|
6114
5925
|
return /* @__PURE__ */ jsxRuntime.jsx(Popover, { ...popover, content: childMenu, "data-ui": "MenuGroup__popover", open, children: /* @__PURE__ */ jsxRuntime.jsx(Selectable, { "data-as": as, "data-ui": "MenuGroup", forwardedAs: as, ...restProps, "aria-pressed": as === "button" ? withinMenu : void 0, "data-pressed": as !== "button" ? withinMenu : void 0, "data-selected": !withinMenu && active ? "" : void 0, $radius: useArrayProp(radius), $tone: tone, $scheme: scheme, onClick: handleClick, onKeyDown: handleKeyDown, onMouseEnter: handleMouseEnter, ref: setRootElement, tabIndex: -1, type: as === "button" ? "button" : void 0, children: /* @__PURE__ */ jsxRuntime.jsxs(Flex, { gap: space, padding, children: [
|
|
6115
5926
|
IconComponent && /* @__PURE__ */ jsxRuntime.jsxs(Text, { size: fontSize2, children: [
|
|
6116
|
-
|
|
5927
|
+
react.isValidElement(IconComponent) && IconComponent,
|
|
6117
5928
|
ReactIs.isValidElementType(IconComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconComponent, {})
|
|
6118
5929
|
] }),
|
|
6119
5930
|
/* @__PURE__ */ jsxRuntime.jsx(Box, { flex: 1, children: /* @__PURE__ */ jsxRuntime.jsx(Text, { size: fontSize2, textOverflow: "ellipsis", weight: "medium", children: text }) }),
|
|
@@ -6121,7 +5932,7 @@ function MenuGroup(props) {
|
|
|
6121
5932
|
] }) }) });
|
|
6122
5933
|
}
|
|
6123
5934
|
MenuGroup.displayName = "MenuGroup";
|
|
6124
|
-
const MenuItem =
|
|
5935
|
+
const MenuItem = react.forwardRef(function(props, forwardedRef) {
|
|
6125
5936
|
const {
|
|
6126
5937
|
as = "button",
|
|
6127
5938
|
children,
|
|
@@ -6153,11 +5964,11 @@ const MenuItem = require$$0.forwardRef(function(props, forwardedRef) {
|
|
|
6153
5964
|
onItemClick,
|
|
6154
5965
|
onItemMouseEnter = menu.onMouseEnter,
|
|
6155
5966
|
onItemMouseLeave = menu.onMouseLeave
|
|
6156
|
-
} = menu, [rootElement, setRootElement] =
|
|
6157
|
-
|
|
6158
|
-
const handleClick =
|
|
5967
|
+
} = menu, [rootElement, setRootElement] = react.useState(null), active = !!activeElement && activeElement === rootElement, ref = react.useRef(null);
|
|
5968
|
+
react.useImperativeHandle(forwardedRef, () => ref.current), react.useEffect(() => mount(rootElement, selectedProp), [mount, rootElement, selectedProp]);
|
|
5969
|
+
const handleClick = react.useCallback((event) => {
|
|
6159
5970
|
disabled || (onClick && onClick(event), onItemClick && onItemClick());
|
|
6160
|
-
}, [disabled, onClick, onItemClick]), paddingProps =
|
|
5971
|
+
}, [disabled, onClick, onItemClick]), paddingProps = react.useMemo(() => ({
|
|
6161
5972
|
padding,
|
|
6162
5973
|
paddingX,
|
|
6163
5974
|
paddingY,
|
|
@@ -6165,13 +5976,13 @@ const MenuItem = require$$0.forwardRef(function(props, forwardedRef) {
|
|
|
6165
5976
|
paddingRight,
|
|
6166
5977
|
paddingBottom,
|
|
6167
5978
|
paddingLeft
|
|
6168
|
-
}), [padding, paddingX, paddingY, paddingTop, paddingRight, paddingBottom, paddingLeft]), hotkeysFontSize = useArrayProp(fontSize2).map((s) => s - 1), setRef =
|
|
5979
|
+
}), [padding, paddingX, paddingY, paddingTop, paddingRight, paddingBottom, paddingLeft]), hotkeysFontSize = useArrayProp(fontSize2).map((s) => s - 1), setRef = react.useCallback((el) => {
|
|
6169
5980
|
ref.current = el, setRootElement(el);
|
|
6170
5981
|
}, []);
|
|
6171
5982
|
return /* @__PURE__ */ jsxRuntime.jsxs(Selectable, { "data-ui": "MenuItem", ...restProps, "aria-pressed": as === "button" && pressed, "data-pressed": as !== "button" && pressed ? "" : void 0, "data-selected": active ? "" : void 0, "data-disabled": disabled ? "" : void 0, forwardedAs: as, $radius: useArrayProp(radius), $padding: useArrayProp(0), $tone: disabled ? "default" : tone, $scheme: scheme, disabled, onClick: handleClick, onMouseEnter: onItemMouseEnter, onMouseLeave: onItemMouseLeave, ref: setRef, role: "menuitem", tabIndex: -1, type: as === "button" ? "button" : void 0, children: [
|
|
6172
5983
|
(IconComponent || text || IconRightComponent) && /* @__PURE__ */ jsxRuntime.jsxs(Flex, { as: "span", gap: space, align: "center", ...paddingProps, children: [
|
|
6173
5984
|
IconComponent && /* @__PURE__ */ jsxRuntime.jsxs(Text, { size: fontSize2, children: [
|
|
6174
|
-
|
|
5985
|
+
react.isValidElement(IconComponent) && IconComponent,
|
|
6175
5986
|
ReactIs.isValidElementType(IconComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconComponent, {})
|
|
6176
5987
|
] }),
|
|
6177
5988
|
text && /* @__PURE__ */ jsxRuntime.jsx(Box, { flex: 1, children: /* @__PURE__ */ jsxRuntime.jsx(Text, { size: fontSize2, textOverflow: "ellipsis", weight: "medium", children: text }) }),
|
|
@@ -6180,7 +5991,7 @@ const MenuItem = require$$0.forwardRef(function(props, forwardedRef) {
|
|
|
6180
5991
|
marginBottom: -4
|
|
6181
5992
|
} }),
|
|
6182
5993
|
IconRightComponent && /* @__PURE__ */ jsxRuntime.jsxs(Text, { size: fontSize2, children: [
|
|
6183
|
-
|
|
5994
|
+
react.isValidElement(IconRightComponent) && IconRightComponent,
|
|
6184
5995
|
ReactIs.isValidElementType(IconRightComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconRightComponent, {})
|
|
6185
5996
|
] })
|
|
6186
5997
|
] }),
|
|
@@ -6228,8 +6039,8 @@ const keyframe = styledComponents.keyframes`
|
|
|
6228
6039
|
@media screen and (prefers-reduced-motion: reduce) {
|
|
6229
6040
|
background-color: var(--card-skeleton-color-from);
|
|
6230
6041
|
}
|
|
6231
|
-
`, Root$4 = styledComponents.styled(Box)(responsiveRadiusStyle, skeletonStyle), Skeleton =
|
|
6232
|
-
const $ =
|
|
6042
|
+
`, Root$4 = styledComponents.styled(Box)(responsiveRadiusStyle, skeletonStyle), Skeleton = react.forwardRef(function(props, ref) {
|
|
6043
|
+
const $ = reactCompilerRuntime.c(14);
|
|
6233
6044
|
let t0, delay, radius, restProps;
|
|
6234
6045
|
$[0] !== props ? ({
|
|
6235
6046
|
animated: t0,
|
|
@@ -6237,7 +6048,7 @@ const keyframe = styledComponents.keyframes`
|
|
|
6237
6048
|
radius,
|
|
6238
6049
|
...restProps
|
|
6239
6050
|
} = props, $[0] = props, $[1] = t0, $[2] = delay, $[3] = radius, $[4] = restProps) : (t0 = $[1], delay = $[2], radius = $[3], restProps = $[4]);
|
|
6240
|
-
const animated = t0 === void 0 ? !1 : t0, [visible, setVisible] =
|
|
6051
|
+
const animated = t0 === void 0 ? !1 : t0, [visible, setVisible] = react.useState(!delay);
|
|
6241
6052
|
let t1, t2;
|
|
6242
6053
|
$[5] !== delay ? (t1 = () => {
|
|
6243
6054
|
if (!delay)
|
|
@@ -6248,7 +6059,7 @@ const keyframe = styledComponents.keyframes`
|
|
|
6248
6059
|
return () => {
|
|
6249
6060
|
clearTimeout(timeout);
|
|
6250
6061
|
};
|
|
6251
|
-
}, t2 = [delay], $[5] = delay, $[6] = t1, $[7] = t2) : (t1 = $[6], t2 = $[7]),
|
|
6062
|
+
}, t2 = [delay], $[5] = delay, $[6] = t1, $[7] = t2) : (t1 = $[6], t2 = $[7]), react.useEffect(t1, t2);
|
|
6252
6063
|
const t3 = useArrayProp(radius);
|
|
6253
6064
|
let t4;
|
|
6254
6065
|
return $[8] !== restProps || $[9] !== animated || $[10] !== t3 || $[11] !== visible || $[12] !== ref ? (t4 = /* @__PURE__ */ jsxRuntime.jsx(Root$4, { ...restProps, $animated: animated, $radius: t3, $visible: visible, ref }), $[8] = restProps, $[9] = animated, $[10] = t3, $[11] = visible, $[12] = ref, $[13] = t4) : t4 = $[13], t4;
|
|
@@ -6268,8 +6079,8 @@ const Root$3 = styledComponents.styled(Skeleton)((props) => {
|
|
|
6268
6079
|
height: fontSize2.lineHeight - fontSize2.ascenderHeight - fontSize2.descenderHeight
|
|
6269
6080
|
};
|
|
6270
6081
|
});
|
|
6271
|
-
}), TextSkeleton =
|
|
6272
|
-
const $ =
|
|
6082
|
+
}), TextSkeleton = react.forwardRef(function(props, ref) {
|
|
6083
|
+
const $ = reactCompilerRuntime.c(7);
|
|
6273
6084
|
let t0, restProps;
|
|
6274
6085
|
$[0] !== props ? ({
|
|
6275
6086
|
size: t0,
|
|
@@ -6280,8 +6091,8 @@ const Root$3 = styledComponents.styled(Skeleton)((props) => {
|
|
|
6280
6091
|
return $[3] !== restProps || $[4] !== $size || $[5] !== ref ? (t1 = /* @__PURE__ */ jsxRuntime.jsx(Root$3, { ...restProps, $size, ref, $style: "text" }), $[3] = restProps, $[4] = $size, $[5] = ref, $[6] = t1) : t1 = $[6], t1;
|
|
6281
6092
|
});
|
|
6282
6093
|
TextSkeleton.displayName = "ForwardRef(TextSkeleton)";
|
|
6283
|
-
const LabelSkeleton =
|
|
6284
|
-
const $ =
|
|
6094
|
+
const LabelSkeleton = react.forwardRef(function(props, ref) {
|
|
6095
|
+
const $ = reactCompilerRuntime.c(7);
|
|
6285
6096
|
let t0, restProps;
|
|
6286
6097
|
$[0] !== props ? ({
|
|
6287
6098
|
size: t0,
|
|
@@ -6292,8 +6103,8 @@ const LabelSkeleton = require$$0.forwardRef(function(props, ref) {
|
|
|
6292
6103
|
return $[3] !== restProps || $[4] !== $size || $[5] !== ref ? (t1 = /* @__PURE__ */ jsxRuntime.jsx(Root$3, { ...restProps, $size, ref, $style: "label" }), $[3] = restProps, $[4] = $size, $[5] = ref, $[6] = t1) : t1 = $[6], t1;
|
|
6293
6104
|
});
|
|
6294
6105
|
LabelSkeleton.displayName = "ForwardRef(LabelSkeleton)";
|
|
6295
|
-
const HeadingSkeleton =
|
|
6296
|
-
const $ =
|
|
6106
|
+
const HeadingSkeleton = react.forwardRef(function(props, ref) {
|
|
6107
|
+
const $ = reactCompilerRuntime.c(7);
|
|
6297
6108
|
let t0, restProps;
|
|
6298
6109
|
$[0] !== props ? ({
|
|
6299
6110
|
size: t0,
|
|
@@ -6304,8 +6115,8 @@ const HeadingSkeleton = require$$0.forwardRef(function(props, ref) {
|
|
|
6304
6115
|
return $[3] !== restProps || $[4] !== $size || $[5] !== ref ? (t1 = /* @__PURE__ */ jsxRuntime.jsx(Root$3, { ...restProps, $size, ref, $style: "heading" }), $[3] = restProps, $[4] = $size, $[5] = ref, $[6] = t1) : t1 = $[6], t1;
|
|
6305
6116
|
});
|
|
6306
6117
|
HeadingSkeleton.displayName = "ForwardRef(HeadingSkeleton)";
|
|
6307
|
-
const CodeSkeleton =
|
|
6308
|
-
const $ =
|
|
6118
|
+
const CodeSkeleton = react.forwardRef(function(props, ref) {
|
|
6119
|
+
const $ = reactCompilerRuntime.c(7);
|
|
6309
6120
|
let t0, restProps;
|
|
6310
6121
|
$[0] !== props ? ({
|
|
6311
6122
|
size: t0,
|
|
@@ -6318,8 +6129,8 @@ const CodeSkeleton = require$$0.forwardRef(function(props, ref) {
|
|
|
6318
6129
|
CodeSkeleton.displayName = "ForwardRef(CodeSkeleton)";
|
|
6319
6130
|
const CustomButton = styledComponents.styled(Button)`
|
|
6320
6131
|
max-width: 100%;
|
|
6321
|
-
`, Tab =
|
|
6322
|
-
const $ =
|
|
6132
|
+
`, Tab = react.forwardRef(function(props, forwardedRef) {
|
|
6133
|
+
const $ = reactCompilerRuntime.c(30);
|
|
6323
6134
|
let t0, t1, onFocus, focused, selected, restProps, icon, id, onClick, label;
|
|
6324
6135
|
$[0] !== props ? ({
|
|
6325
6136
|
icon,
|
|
@@ -6333,9 +6144,9 @@ const CustomButton = styledComponents.styled(Button)`
|
|
|
6333
6144
|
selected,
|
|
6334
6145
|
...restProps
|
|
6335
6146
|
} = props, $[0] = props, $[1] = t0, $[2] = t1, $[3] = onFocus, $[4] = focused, $[5] = selected, $[6] = restProps, $[7] = icon, $[8] = id, $[9] = onClick, $[10] = label) : (t0 = $[1], t1 = $[2], onFocus = $[3], focused = $[4], selected = $[5], restProps = $[6], icon = $[7], id = $[8], onClick = $[9], label = $[10]);
|
|
6336
|
-
const fontSize2 = t0 === void 0 ? 1 : t0, padding = t1 === void 0 ? 2 : t1, ref =
|
|
6147
|
+
const fontSize2 = t0 === void 0 ? 1 : t0, padding = t1 === void 0 ? 2 : t1, ref = react.useRef(null), focusedRef = react.useRef(!1);
|
|
6337
6148
|
let t2;
|
|
6338
|
-
$[11] === Symbol.for("react.memo_cache_sentinel") ? (t2 = () => ref.current, $[11] = t2) : t2 = $[11],
|
|
6149
|
+
$[11] === Symbol.for("react.memo_cache_sentinel") ? (t2 = () => ref.current, $[11] = t2) : t2 = $[11], react.useImperativeHandle(forwardedRef, t2);
|
|
6339
6150
|
let t3;
|
|
6340
6151
|
$[12] === Symbol.for("react.memo_cache_sentinel") ? (t3 = () => {
|
|
6341
6152
|
focusedRef.current = !1;
|
|
@@ -6349,7 +6160,7 @@ const CustomButton = styledComponents.styled(Button)`
|
|
|
6349
6160
|
let t5, t6;
|
|
6350
6161
|
$[15] !== focused ? (t5 = () => {
|
|
6351
6162
|
focused && !focusedRef.current && (ref.current && ref.current.focus(), focusedRef.current = !0);
|
|
6352
|
-
}, t6 = [focused], $[15] = focused, $[16] = t5, $[17] = t6) : (t5 = $[16], t6 = $[17]),
|
|
6163
|
+
}, t6 = [focused], $[15] = focused, $[16] = t5, $[17] = t6) : (t5 = $[16], t6 = $[17]), react.useEffect(t5, t6);
|
|
6353
6164
|
const t7 = selected ? "true" : "false", t8 = selected ? 0 : -1;
|
|
6354
6165
|
let t9;
|
|
6355
6166
|
return $[18] !== restProps || $[19] !== t7 || $[20] !== fontSize2 || $[21] !== icon || $[22] !== id || $[23] !== onClick || $[24] !== handleFocus || $[25] !== padding || $[26] !== selected || $[27] !== t8 || $[28] !== label ? (t9 = /* @__PURE__ */ jsxRuntime.jsx(CustomButton, { "data-ui": "Tab", ...restProps, "aria-selected": t7, fontSize: fontSize2, icon, id, mode: "bleed", onClick, onBlur: handleBlur, onFocus: handleFocus, padding, ref, role: "tab", selected, tabIndex: t8, text: label, type: "button" }), $[18] = restProps, $[19] = t7, $[20] = fontSize2, $[21] = icon, $[22] = id, $[23] = onClick, $[24] = handleFocus, $[25] = padding, $[26] = selected, $[27] = t8, $[28] = label, $[29] = t9) : t9 = $[29], t9;
|
|
@@ -6365,24 +6176,24 @@ const CustomInline = styledComponents.styled(Inline)`
|
|
|
6365
6176
|
max-width: 100%;
|
|
6366
6177
|
box-sizing: border-box;
|
|
6367
6178
|
}
|
|
6368
|
-
`, TabList =
|
|
6179
|
+
`, TabList = react.forwardRef(function(props, ref) {
|
|
6369
6180
|
const {
|
|
6370
6181
|
children: childrenProp,
|
|
6371
6182
|
...restProps
|
|
6372
|
-
} = props, [focusedIndex, setFocusedIndex] =
|
|
6183
|
+
} = props, [focusedIndex, setFocusedIndex] = react.useState(-1), tabs = react.useMemo(() => childrenProp.filter(_isReactElement), [childrenProp]).map((child, childIndex) => react.cloneElement(child, {
|
|
6373
6184
|
focused: focusedIndex === childIndex,
|
|
6374
6185
|
key: childIndex,
|
|
6375
6186
|
onFocus: () => handleTabFocus(childIndex)
|
|
6376
|
-
})), numTabs = tabs.length, handleTabFocus =
|
|
6187
|
+
})), numTabs = tabs.length, handleTabFocus = react.useCallback((tabIdx) => {
|
|
6377
6188
|
setFocusedIndex(tabIdx);
|
|
6378
|
-
}, []), handleKeyDown =
|
|
6189
|
+
}, []), handleKeyDown = react.useCallback((event) => {
|
|
6379
6190
|
event.key === "ArrowLeft" && setFocusedIndex((prevIndex) => (prevIndex + numTabs - 1) % numTabs), event.key === "ArrowRight" && setFocusedIndex((prevIndex_0) => (prevIndex_0 + 1) % numTabs);
|
|
6380
6191
|
}, [numTabs]);
|
|
6381
6192
|
return /* @__PURE__ */ jsxRuntime.jsx(CustomInline, { "data-ui": "TabList", ...restProps, onKeyDown: handleKeyDown, ref, role: "tablist", children: tabs });
|
|
6382
6193
|
});
|
|
6383
6194
|
TabList.displayName = "ForwardRef(TabList)";
|
|
6384
|
-
const TabPanel =
|
|
6385
|
-
const $ =
|
|
6195
|
+
const TabPanel = react.forwardRef(function(props, ref) {
|
|
6196
|
+
const $ = reactCompilerRuntime.c(9);
|
|
6386
6197
|
let restProps, flex;
|
|
6387
6198
|
$[0] !== props ? ({
|
|
6388
6199
|
flex,
|
|
@@ -6454,7 +6265,7 @@ const STATUS_CARD_TONE = {
|
|
|
6454
6265
|
info: "alert"
|
|
6455
6266
|
}, Root$2 = styledComponents.styled(Card)(rootStyles);
|
|
6456
6267
|
function Toast(props) {
|
|
6457
|
-
const $ =
|
|
6268
|
+
const $ = reactCompilerRuntime.c(30);
|
|
6458
6269
|
let t0, status, title, description, closable, onClose, restProps, duration;
|
|
6459
6270
|
$[0] !== props ? ({
|
|
6460
6271
|
closable,
|
|
@@ -6490,7 +6301,7 @@ function Toast(props) {
|
|
|
6490
6301
|
}
|
|
6491
6302
|
Toast.displayName = "Toast";
|
|
6492
6303
|
function useMounted() {
|
|
6493
|
-
return
|
|
6304
|
+
return react.useSyncExternalStore(subscribe, _temp, _temp2);
|
|
6494
6305
|
}
|
|
6495
6306
|
function _temp2() {
|
|
6496
6307
|
return !1;
|
|
@@ -6522,7 +6333,7 @@ function ToastProvider(props) {
|
|
|
6522
6333
|
paddingX,
|
|
6523
6334
|
paddingY,
|
|
6524
6335
|
zOffset
|
|
6525
|
-
} = props, [state, _setState] =
|
|
6336
|
+
} = props, [state, _setState] = react.useState([]), toastsRef = react.useRef({}), mounted = useMounted(), prefersReducedMotion = usePrefersReducedMotion(), variants = react.useMemo(() => ({
|
|
6526
6337
|
initial: {
|
|
6527
6338
|
opacity: 0,
|
|
6528
6339
|
[POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: 0,
|
|
@@ -6546,10 +6357,10 @@ function ToastProvider(props) {
|
|
|
6546
6357
|
duration: 0.2
|
|
6547
6358
|
}
|
|
6548
6359
|
}
|
|
6549
|
-
}), [prefersReducedMotion]), value =
|
|
6360
|
+
}), [prefersReducedMotion]), value = react.useMemo(() => ({
|
|
6550
6361
|
version: 0,
|
|
6551
6362
|
push: (params) => {
|
|
6552
|
-
const setState = (state_0) =>
|
|
6363
|
+
const setState = (state_0) => react.startTransition(() => _setState(state_0)), id = params.id || String(toastId++), duration = params.duration || 5e3, dismiss = () => {
|
|
6553
6364
|
const timeoutId = toastsRef.current[id]?.timeoutId;
|
|
6554
6365
|
setState((prevState) => {
|
|
6555
6366
|
const idx = prevState.findIndex((t) => t.id === id);
|
|
@@ -6572,7 +6383,7 @@ function ToastProvider(props) {
|
|
|
6572
6383
|
}, id;
|
|
6573
6384
|
}
|
|
6574
6385
|
}), []);
|
|
6575
|
-
return
|
|
6386
|
+
return react.useEffect(() => () => {
|
|
6576
6387
|
for (const {
|
|
6577
6388
|
timeoutId: timeoutId_0
|
|
6578
6389
|
} of Object.values(toastsRef.current))
|
|
@@ -6595,7 +6406,7 @@ function ToastProvider(props) {
|
|
|
6595
6406
|
}
|
|
6596
6407
|
ToastProvider.displayName = "ToastProvider";
|
|
6597
6408
|
function useToast() {
|
|
6598
|
-
const value =
|
|
6409
|
+
const value = react.useContext(ToastContext);
|
|
6599
6410
|
if (!value)
|
|
6600
6411
|
throw new Error("useToast(): missing context value");
|
|
6601
6412
|
if (!isRecord(value) || value.version !== 0)
|
|
@@ -6656,8 +6467,8 @@ function _focusItemElement(el) {
|
|
|
6656
6467
|
firstChild && firstChild instanceof HTMLElement && firstChild.focus();
|
|
6657
6468
|
}
|
|
6658
6469
|
}
|
|
6659
|
-
const TreeContext = createGlobalScopedContext("@sanity/ui/context/tree", null), Tree =
|
|
6660
|
-
const $ =
|
|
6470
|
+
const TreeContext = createGlobalScopedContext("@sanity/ui/context/tree", null), Tree = react.memo(react.forwardRef(function(props, forwardedRef) {
|
|
6471
|
+
const $ = reactCompilerRuntime.c(37);
|
|
6661
6472
|
let t0, onFocus, children, restProps;
|
|
6662
6473
|
$[0] !== props ? ({
|
|
6663
6474
|
children,
|
|
@@ -6665,26 +6476,26 @@ const TreeContext = createGlobalScopedContext("@sanity/ui/context/tree", null),
|
|
|
6665
6476
|
onFocus,
|
|
6666
6477
|
...restProps
|
|
6667
6478
|
} = props, $[0] = props, $[1] = t0, $[2] = onFocus, $[3] = children, $[4] = restProps) : (t0 = $[1], onFocus = $[2], children = $[3], restProps = $[4]);
|
|
6668
|
-
const space = t0 === void 0 ? 1 : t0, ref =
|
|
6479
|
+
const space = t0 === void 0 ? 1 : t0, ref = react.useRef(null), [focusedElement, setFocusedElement] = react.useState(null), focusedElementRef = react.useRef(focusedElement);
|
|
6669
6480
|
let t1, t2;
|
|
6670
6481
|
$[5] === Symbol.for("react.memo_cache_sentinel") ? (t2 = [], $[5] = t2) : t2 = $[5], t1 = t2;
|
|
6671
6482
|
const path = t1;
|
|
6672
6483
|
let t3;
|
|
6673
6484
|
$[6] === Symbol.for("react.memo_cache_sentinel") ? (t3 = [], $[6] = t3) : t3 = $[6];
|
|
6674
|
-
const [itemElements, setItemElements] =
|
|
6485
|
+
const [itemElements, setItemElements] = react.useState(t3);
|
|
6675
6486
|
let t4;
|
|
6676
6487
|
$[7] === Symbol.for("react.memo_cache_sentinel") ? (t4 = {}, $[7] = t4) : t4 = $[7];
|
|
6677
|
-
const [state, setState] =
|
|
6488
|
+
const [state, setState] = react.useState(t4), stateRef = react.useRef(state);
|
|
6678
6489
|
let t5;
|
|
6679
|
-
$[8] === Symbol.for("react.memo_cache_sentinel") ? (t5 = () => ref.current, $[8] = t5) : t5 = $[8],
|
|
6490
|
+
$[8] === Symbol.for("react.memo_cache_sentinel") ? (t5 = () => ref.current, $[8] = t5) : t5 = $[8], react.useImperativeHandle(forwardedRef, t5);
|
|
6680
6491
|
let t6, t7;
|
|
6681
6492
|
$[9] !== focusedElement ? (t6 = () => {
|
|
6682
6493
|
focusedElementRef.current = focusedElement;
|
|
6683
|
-
}, t7 = [focusedElement], $[9] = focusedElement, $[10] = t6, $[11] = t7) : (t6 = $[10], t7 = $[11]),
|
|
6494
|
+
}, t7 = [focusedElement], $[9] = focusedElement, $[10] = t6, $[11] = t7) : (t6 = $[10], t7 = $[11]), react.useEffect(t6, t7);
|
|
6684
6495
|
let t8, t9;
|
|
6685
6496
|
$[12] !== state ? (t8 = () => {
|
|
6686
6497
|
stateRef.current = state;
|
|
6687
|
-
}, t9 = [state], $[12] = state, $[13] = t8, $[14] = t9) : (t8 = $[13], t9 = $[14]),
|
|
6498
|
+
}, t9 = [state], $[12] = state, $[13] = t8, $[14] = t9) : (t8 = $[13], t9 = $[14]), react.useEffect(t8, t9);
|
|
6688
6499
|
let t10;
|
|
6689
6500
|
$[15] === Symbol.for("react.memo_cache_sentinel") ? (t10 = (element, path_0, expanded, selected) => (setState((s) => ({
|
|
6690
6501
|
...s,
|
|
@@ -6805,7 +6616,7 @@ const TreeContext = createGlobalScopedContext("@sanity/ui/context/tree", null),
|
|
|
6805
6616
|
setItemElements(_itemElements);
|
|
6806
6617
|
}, $[25] = t17) : t17 = $[25];
|
|
6807
6618
|
let t18;
|
|
6808
|
-
$[26] !== children ? (t18 = [children], $[26] = children, $[27] = t18) : t18 = $[27],
|
|
6619
|
+
$[26] !== children ? (t18 = [children], $[26] = children, $[27] = t18) : t18 = $[27], react.useEffect(t17, t18);
|
|
6809
6620
|
let t19;
|
|
6810
6621
|
$[28] !== restProps || $[29] !== handleFocus || $[30] !== handleKeyDown || $[31] !== space || $[32] !== children ? (t19 = /* @__PURE__ */ jsxRuntime.jsx(Stack, { as: "ul", "data-ui": "Tree", ...restProps, onFocus: handleFocus, onKeyDown: handleKeyDown, ref, role: "tree", space, children }), $[28] = restProps, $[29] = handleFocus, $[30] = handleKeyDown, $[31] = space, $[32] = children, $[33] = t19) : t19 = $[33];
|
|
6811
6622
|
let t20;
|
|
@@ -6905,13 +6716,13 @@ function treeItemBoxStyle(props) {
|
|
|
6905
6716
|
`;
|
|
6906
6717
|
}
|
|
6907
6718
|
function useTree() {
|
|
6908
|
-
const tree =
|
|
6719
|
+
const tree = react.useContext(TreeContext);
|
|
6909
6720
|
if (!tree)
|
|
6910
6721
|
throw new Error("Tree: missing context value");
|
|
6911
6722
|
return tree;
|
|
6912
6723
|
}
|
|
6913
|
-
const TreeGroup =
|
|
6914
|
-
const $ =
|
|
6724
|
+
const TreeGroup = react.memo(function(props) {
|
|
6725
|
+
const $ = reactCompilerRuntime.c(9);
|
|
6915
6726
|
let t0, restProps, children;
|
|
6916
6727
|
$[0] !== props ? ({
|
|
6917
6728
|
children,
|
|
@@ -6921,13 +6732,13 @@ const TreeGroup = require$$0.memo(function(props) {
|
|
|
6921
6732
|
const expanded = t0 === void 0 ? !1 : t0, tree = useTree(), t1 = !expanded;
|
|
6922
6733
|
let t2;
|
|
6923
6734
|
return $[4] !== restProps || $[5] !== t1 || $[6] !== tree.space || $[7] !== children ? (t2 = /* @__PURE__ */ jsxRuntime.jsx(Stack, { as: "ul", "data-ui": "TreeGroup", ...restProps, hidden: t1, marginTop: tree.space, role: "group", space: tree.space, children }), $[4] = restProps, $[5] = t1, $[6] = tree.space, $[7] = children, $[8] = t2) : t2 = $[8], t2;
|
|
6924
|
-
}), Root =
|
|
6735
|
+
}), Root = react.memo(styledComponents.styled.li(treeItemRootStyle, treeItemRootColorStyle)), TreeItemBox = styledComponents.styled(Box).attrs({
|
|
6925
6736
|
forwardedAs: "a"
|
|
6926
6737
|
})(treeItemBoxStyle), ToggleArrowText = styledComponents.styled(Text)`
|
|
6927
6738
|
& > svg {
|
|
6928
6739
|
transition: transform 100ms;
|
|
6929
6740
|
}
|
|
6930
|
-
`, TreeItem =
|
|
6741
|
+
`, TreeItem = react.memo(function(props) {
|
|
6931
6742
|
const {
|
|
6932
6743
|
children,
|
|
6933
6744
|
expanded: expandedProp = !1,
|
|
@@ -6944,23 +6755,23 @@ const TreeGroup = require$$0.memo(function(props) {
|
|
|
6944
6755
|
text,
|
|
6945
6756
|
weight,
|
|
6946
6757
|
...restProps
|
|
6947
|
-
} = props, rootRef =
|
|
6758
|
+
} = props, rootRef = react.useRef(null), treeitemRef = react.useRef(null), tree = useTree(), {
|
|
6948
6759
|
path,
|
|
6949
6760
|
registerItem,
|
|
6950
6761
|
setExpanded,
|
|
6951
6762
|
setFocusedElement
|
|
6952
|
-
} = tree, _id =
|
|
6763
|
+
} = tree, _id = react.useId(), id = idProp || _id, itemPath = react.useMemo(() => path.concat([id || ""]), [id, path]), itemKey = itemPath.join("/"), itemState = tree.state[itemKey], focused = tree.focusedElement === rootRef.current, expanded = itemState?.expanded === void 0 ? expandedProp : itemState?.expanded || !1, tabIndex = tree.focusedElement && tree.focusedElement === rootRef.current ? 0 : -1, contextValue = react.useMemo(() => ({
|
|
6953
6764
|
...tree,
|
|
6954
6765
|
level: tree.level + 1,
|
|
6955
6766
|
path: itemPath
|
|
6956
|
-
}), [itemPath, tree]), handleClick =
|
|
6767
|
+
}), [itemPath, tree]), handleClick = react.useCallback((event) => {
|
|
6957
6768
|
onClick && onClick(event);
|
|
6958
6769
|
const target = event.target;
|
|
6959
6770
|
target instanceof HTMLElement && (target.getAttribute("data-ui") === "TreeItem" || target.closest('[data-ui="TreeItem__box"]')) && (event.stopPropagation(), setExpanded(itemKey, !expanded), setFocusedElement(rootRef.current));
|
|
6960
|
-
}, [expanded, itemKey, onClick, setExpanded, setFocusedElement]), handleKeyDown =
|
|
6771
|
+
}, [expanded, itemKey, onClick, setExpanded, setFocusedElement]), handleKeyDown = react.useCallback((event_0) => {
|
|
6961
6772
|
focused && event_0.key === "Enter" && (treeitemRef.current || rootRef.current)?.click();
|
|
6962
6773
|
}, [focused]);
|
|
6963
|
-
|
|
6774
|
+
react.useEffect(() => {
|
|
6964
6775
|
if (rootRef.current)
|
|
6965
6776
|
return registerItem(rootRef.current, itemPath.join("/"), expanded, selected);
|
|
6966
6777
|
}, [expanded, itemPath, registerItem, selected]);
|