@sanity/ui 1.0.1 → 1.1.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{index.esm.js → index.cjs} +936 -808
- package/dist/index.cjs.map +1 -0
- package/dist/index.js +809 -933
- package/dist/index.js.map +1 -1
- package/package.json +30 -28
- package/dist/index.esm.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
1
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21, _templateObject22, _templateObject23, _templateObject24, _templateObject25, _templateObject26, _templateObject27, _templateObject28, _templateObject29, _templateObject30, _templateObject31, _templateObject32, _templateObject33, _templateObject34, _templateObject35, _templateObject36, _templateObject37, _templateObject38, _templateObject39, _templateObject40, _templateObject41, _templateObject42, _templateObject43, _templateObject44, _templateObject45, _templateObject46, _templateObject47, _templateObject48, _templateObject49, _templateObject50, _templateObject51, _templateObject52, _templateObject53, _templateObject54, _templateObject55, _templateObject56, _templateObject57, _templateObject58, _templateObject59, _templateObject60, _templateObject61, _templateObject62, _templateObject63, _templateObject64, _templateObject65, _templateObject66, _templateObject67, _templateObject68, _templateObject69, _templateObject70, _templateObject71, _templateObject72, _templateObject73, _templateObject74, _templateObject75, _templateObject76, _templateObject77, _templateObject78, _templateObject79, _templateObject80, _templateObject81, _templateObject82, _templateObject83, _templateObject84, _templateObject85, _templateObject86, _templateObject87, _templateObject88, _templateObject89, _templateObject90;
|
|
4
2
|
const _excluded = ["color", "layer"],
|
|
5
3
|
_excluded2 = ["accent", "align", "children", "muted", "size", "textOverflow", "weight"],
|
|
@@ -57,28 +55,19 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
57
55
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
58
56
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
59
57
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
60
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
var framerMotion = require('framer-motion');
|
|
74
|
-
function _interopDefaultLegacy(e) {
|
|
75
|
-
return e && typeof e === 'object' && 'default' in e ? e : {
|
|
76
|
-
'default': e
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
var ReactIs__default = /*#__PURE__*/_interopDefaultLegacy(ReactIs);
|
|
80
|
-
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
81
|
-
var Refractor__default = /*#__PURE__*/_interopDefaultLegacy(Refractor);
|
|
58
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
59
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
60
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
61
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
62
|
+
import { useMemo, useState, useRef, useEffect, createContext, useContext, useLayoutEffect, forwardRef, useId, useCallback, cloneElement, isValidElement, createElement, Component, memo, useReducer, Children, Fragment as Fragment$1 } from 'react';
|
|
63
|
+
import ReactIs, { isElement as isElement$1, isFragment, isValidElementType } from 'react-is';
|
|
64
|
+
import styled, { ThemeProvider as ThemeProvider$1, useTheme as useTheme$1, css, keyframes } from 'styled-components';
|
|
65
|
+
import { white as white$1, black as black$1, hues } from '@sanity/color';
|
|
66
|
+
import { SpinnerIcon, CheckmarkIcon, RemoveIcon, SelectIcon, CloseIcon, ChevronDownIcon, ChevronRightIcon, ToggleArrowRightIcon } from '@sanity/icons';
|
|
67
|
+
import Refractor from 'react-refractor';
|
|
68
|
+
import { detectOverflow, flip, offset, shift, arrow, hide, autoUpdate, useFloating } from '@floating-ui/react-dom';
|
|
69
|
+
import { createPortal } from 'react-dom';
|
|
70
|
+
import { AnimatePresence, motion } from 'framer-motion';
|
|
82
71
|
const EMPTY_ARRAY = [];
|
|
83
72
|
const EMPTY_RECORD = {};
|
|
84
73
|
const FLOATING_STATIC_SIDES = {
|
|
@@ -234,7 +223,7 @@ function responsiveTextFont(props) {
|
|
|
234
223
|
}
|
|
235
224
|
function useArrayProp(val, defaultVal) {
|
|
236
225
|
const __perf_hash__ = JSON.stringify(val != null ? val : defaultVal);
|
|
237
|
-
return
|
|
226
|
+
return useMemo(() => _getArrayProp(val, defaultVal), [__perf_hash__]);
|
|
238
227
|
}
|
|
239
228
|
function _getElements(element, elementsArg) {
|
|
240
229
|
const ret = [element];
|
|
@@ -250,10 +239,10 @@ function _getElements(element, elementsArg) {
|
|
|
250
239
|
function useClickOutside(listener) {
|
|
251
240
|
let elementsArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : EMPTY_ARRAY;
|
|
252
241
|
let boundaryElement = arguments.length > 2 ? arguments[2] : undefined;
|
|
253
|
-
const [element, setElement] =
|
|
254
|
-
const [elements, setElements] =
|
|
255
|
-
const elementsRef =
|
|
256
|
-
|
|
242
|
+
const [element, setElement] = useState(null);
|
|
243
|
+
const [elements, setElements] = useState(() => _getElements(element, elementsArg));
|
|
244
|
+
const elementsRef = useRef(elements);
|
|
245
|
+
useEffect(() => {
|
|
257
246
|
const prevElements = elementsRef.current;
|
|
258
247
|
const nextElements = _getElements(element, elementsArg);
|
|
259
248
|
if (prevElements.length !== nextElements.length) {
|
|
@@ -276,7 +265,7 @@ function useClickOutside(listener) {
|
|
|
276
265
|
}
|
|
277
266
|
}
|
|
278
267
|
}, [element, elementsArg]);
|
|
279
|
-
|
|
268
|
+
useEffect(() => {
|
|
280
269
|
if (!listener) return void 0;
|
|
281
270
|
const handleWindowMouseDown = evt => {
|
|
282
271
|
const target = evt.target;
|
|
@@ -882,8 +871,8 @@ function _createElementSizeObserver() {
|
|
|
882
871
|
};
|
|
883
872
|
}
|
|
884
873
|
function useElementSize(element) {
|
|
885
|
-
const [size, setSize] =
|
|
886
|
-
|
|
874
|
+
const [size, setSize] = useState(null);
|
|
875
|
+
useEffect(() => {
|
|
887
876
|
if (!element) return void 0;
|
|
888
877
|
return _elementSizeObserver.subscribe(element, setSize);
|
|
889
878
|
}, [element]);
|
|
@@ -894,7 +883,7 @@ function useElementRect(element) {
|
|
|
894
883
|
return (elementSize == null ? void 0 : elementSize._contentRect) || null;
|
|
895
884
|
}
|
|
896
885
|
function useGlobalKeyDown(onKeyDown) {
|
|
897
|
-
return
|
|
886
|
+
return useEffect(() => {
|
|
898
887
|
addEventListener("keydown", onKeyDown);
|
|
899
888
|
return () => removeEventListener("keydown", onKeyDown);
|
|
900
889
|
}, [onKeyDown]);
|
|
@@ -2221,12 +2210,12 @@ function screen(bg, fg) {
|
|
|
2221
2210
|
return hex;
|
|
2222
2211
|
}
|
|
2223
2212
|
const tones = {
|
|
2224
|
-
default:
|
|
2225
|
-
transparent:
|
|
2226
|
-
primary:
|
|
2227
|
-
positive:
|
|
2228
|
-
caution:
|
|
2229
|
-
critical:
|
|
2213
|
+
default: hues.gray,
|
|
2214
|
+
transparent: hues.gray,
|
|
2215
|
+
primary: hues.blue,
|
|
2216
|
+
positive: hues.green,
|
|
2217
|
+
caution: hues.yellow,
|
|
2218
|
+
critical: hues.red
|
|
2230
2219
|
};
|
|
2231
2220
|
const NEUTRAL_TONES = ["default", "transparent"];
|
|
2232
2221
|
const color = createColorTheme({
|
|
@@ -2236,13 +2225,13 @@ const color = createColorTheme({
|
|
|
2236
2225
|
name
|
|
2237
2226
|
} = _ref11;
|
|
2238
2227
|
if (name === "default") {
|
|
2239
|
-
const tints2 =
|
|
2228
|
+
const tints2 = hues.gray;
|
|
2240
2229
|
const skeletonFrom2 = dark ? tints2[900].hex : tints2[100].hex;
|
|
2241
2230
|
return {
|
|
2242
|
-
fg: dark ?
|
|
2243
|
-
bg: dark ?
|
|
2231
|
+
fg: dark ? white$1.hex : black$1.hex,
|
|
2232
|
+
bg: dark ? black$1.hex : white$1.hex,
|
|
2244
2233
|
border: tints2[dark ? 800 : 200].hex,
|
|
2245
|
-
focusRing:
|
|
2234
|
+
focusRing: hues.blue[dark ? 500 : 500].hex,
|
|
2246
2235
|
shadow: {
|
|
2247
2236
|
outline: rgba(tints2[500].hex, 0.4),
|
|
2248
2237
|
umbra: dark ? rgba(tints2[950].hex, 0.4) : rgba(tints2[500].hex, 0.2),
|
|
@@ -2262,7 +2251,7 @@ const color = createColorTheme({
|
|
|
2262
2251
|
fg: tints2[dark ? 100 : 900].hex,
|
|
2263
2252
|
bg: tints2[dark ? 950 : 50].hex,
|
|
2264
2253
|
border: tints2[dark ? 800 : 300].hex,
|
|
2265
|
-
focusRing:
|
|
2254
|
+
focusRing: hues.blue[500].hex,
|
|
2266
2255
|
shadow: {
|
|
2267
2256
|
outline: rgba(tints2[500].hex, 0.4),
|
|
2268
2257
|
umbra: dark ? rgba(tints2[900].hex, 0.4) : rgba(tints2[500].hex, 0.2),
|
|
@@ -2315,7 +2304,7 @@ const color = createColorTheme({
|
|
|
2315
2304
|
bg: bg2,
|
|
2316
2305
|
bg2: mix2(bg2, tints[dark ? 50 : 950].hex),
|
|
2317
2306
|
border: mix(base.bg, tints[dark ? 800 : 200].hex),
|
|
2318
|
-
fg: mix(base.bg, dark ?
|
|
2307
|
+
fg: mix(base.bg, dark ? black$1.hex : white$1.hex),
|
|
2319
2308
|
muted: {
|
|
2320
2309
|
fg: mix(base.bg, tints[dark ? 950 : 50].hex)
|
|
2321
2310
|
},
|
|
@@ -2342,15 +2331,15 @@ const color = createColorTheme({
|
|
|
2342
2331
|
bg: bg2,
|
|
2343
2332
|
bg2: mix2(bg2, tints[dark ? 50 : 950].hex),
|
|
2344
2333
|
border: mix(base.bg, tints[dark ? 300 : 600].hex),
|
|
2345
|
-
fg: mix(base.bg, dark ?
|
|
2334
|
+
fg: mix(base.bg, dark ? black$1.hex : white$1.hex),
|
|
2346
2335
|
muted: {
|
|
2347
2336
|
fg: mix(base.bg, tints[dark ? 800 : 200].hex)
|
|
2348
2337
|
},
|
|
2349
2338
|
accent: {
|
|
2350
|
-
fg: mix2(bg2,
|
|
2339
|
+
fg: mix2(bg2, hues.red[dark ? 800 : 200].hex)
|
|
2351
2340
|
},
|
|
2352
2341
|
link: {
|
|
2353
|
-
fg: mix2(bg2,
|
|
2342
|
+
fg: mix2(bg2, hues.blue[dark ? 800 : 200].hex)
|
|
2354
2343
|
},
|
|
2355
2344
|
code: {
|
|
2356
2345
|
bg: mix(bg2, tints[dark ? 950 : 50].hex),
|
|
@@ -2369,15 +2358,15 @@ const color = createColorTheme({
|
|
|
2369
2358
|
bg: mix(base.bg, tints[dark ? 200 : 800].hex),
|
|
2370
2359
|
bg2: mix2(bg2, tints[dark ? 50 : 950].hex),
|
|
2371
2360
|
border: mix(base.bg, tints[dark ? 200 : 800].hex),
|
|
2372
|
-
fg: mix(base.bg, dark ?
|
|
2361
|
+
fg: mix(base.bg, dark ? black$1.hex : white$1.hex),
|
|
2373
2362
|
muted: {
|
|
2374
2363
|
fg: mix(base.bg, tints[dark ? 800 : 200].hex)
|
|
2375
2364
|
},
|
|
2376
2365
|
accent: {
|
|
2377
|
-
fg: mix2(bg2,
|
|
2366
|
+
fg: mix2(bg2, hues.red[dark ? 800 : 200].hex)
|
|
2378
2367
|
},
|
|
2379
2368
|
link: {
|
|
2380
|
-
fg: mix2(bg2,
|
|
2369
|
+
fg: mix2(bg2, hues.blue[dark ? 800 : 200].hex)
|
|
2381
2370
|
},
|
|
2382
2371
|
code: {
|
|
2383
2372
|
bg: mix(bg2, tints[dark ? 950 : 50].hex),
|
|
@@ -2399,15 +2388,15 @@ const color = createColorTheme({
|
|
|
2399
2388
|
bg: bg2,
|
|
2400
2389
|
bg2: mix2(bg2, tints[dark ? 50 : 950].hex),
|
|
2401
2390
|
border: mix(base.bg, tints[dark ? 200 : 800].hex),
|
|
2402
|
-
fg: mix(base.bg, dark ?
|
|
2391
|
+
fg: mix(base.bg, dark ? black$1.hex : white$1.hex),
|
|
2403
2392
|
muted: {
|
|
2404
2393
|
fg: mix(base.bg, tints[dark ? 800 : 200].hex)
|
|
2405
2394
|
},
|
|
2406
2395
|
accent: {
|
|
2407
|
-
fg: mix2(bg2,
|
|
2396
|
+
fg: mix2(bg2, hues.red[dark ? 800 : 200].hex)
|
|
2408
2397
|
},
|
|
2409
2398
|
link: {
|
|
2410
|
-
fg: mix2(bg2,
|
|
2399
|
+
fg: mix2(bg2, hues.blue[dark ? 800 : 200].hex)
|
|
2411
2400
|
},
|
|
2412
2401
|
code: {
|
|
2413
2402
|
bg: mix(bg2, tints[dark ? 950 : 50].hex),
|
|
@@ -2425,15 +2414,15 @@ const color = createColorTheme({
|
|
|
2425
2414
|
bg,
|
|
2426
2415
|
bg2: mix2(bg, tints[dark ? 50 : 950].hex),
|
|
2427
2416
|
border: mix(base.bg, tints[dark ? 400 : 500].hex),
|
|
2428
|
-
fg: mix(base.bg, dark ?
|
|
2417
|
+
fg: mix(base.bg, dark ? black$1.hex : white$1.hex),
|
|
2429
2418
|
muted: {
|
|
2430
2419
|
fg: mix(base.bg, tints[dark ? 900 : 100].hex)
|
|
2431
2420
|
},
|
|
2432
2421
|
accent: {
|
|
2433
|
-
fg: mix2(bg,
|
|
2422
|
+
fg: mix2(bg, hues.red[dark ? 900 : 100].hex)
|
|
2434
2423
|
},
|
|
2435
2424
|
link: {
|
|
2436
|
-
fg: mix2(bg,
|
|
2425
|
+
fg: mix2(bg, hues.blue[dark ? 900 : 100].hex)
|
|
2437
2426
|
},
|
|
2438
2427
|
code: {
|
|
2439
2428
|
bg: mix(bg, tints[dark ? 950 : 50].hex),
|
|
@@ -2497,10 +2486,10 @@ const color = createColorTheme({
|
|
|
2497
2486
|
fg: mix(base.bg, tints[dark ? 400 : 600].hex)
|
|
2498
2487
|
},
|
|
2499
2488
|
accent: {
|
|
2500
|
-
fg: mix(base.bg,
|
|
2489
|
+
fg: mix(base.bg, hues.red[dark ? 400 : 500].hex)
|
|
2501
2490
|
},
|
|
2502
2491
|
link: {
|
|
2503
|
-
fg: mix(base.bg,
|
|
2492
|
+
fg: mix(base.bg, hues.blue[dark ? 400 : 600].hex)
|
|
2504
2493
|
},
|
|
2505
2494
|
code: {
|
|
2506
2495
|
bg: mix(bg2, tints[dark ? 950 : 50].hex),
|
|
@@ -2527,10 +2516,10 @@ const color = createColorTheme({
|
|
|
2527
2516
|
fg: mix(base.bg, tints[dark ? 400 : 600].hex)
|
|
2528
2517
|
},
|
|
2529
2518
|
accent: {
|
|
2530
|
-
fg: mix(bg2,
|
|
2519
|
+
fg: mix(bg2, hues.red[dark ? 400 : 500].hex)
|
|
2531
2520
|
},
|
|
2532
2521
|
link: {
|
|
2533
|
-
fg: mix(bg2,
|
|
2522
|
+
fg: mix(bg2, hues.blue[dark ? 400 : 600].hex)
|
|
2534
2523
|
},
|
|
2535
2524
|
code: {
|
|
2536
2525
|
bg: mix(bg2, tints[dark ? 950 : 50].hex),
|
|
@@ -2557,10 +2546,10 @@ const color = createColorTheme({
|
|
|
2557
2546
|
fg: mix(base.bg, tints[dark ? 400 : 600].hex)
|
|
2558
2547
|
},
|
|
2559
2548
|
accent: {
|
|
2560
|
-
fg: mix(bg2,
|
|
2549
|
+
fg: mix(bg2, hues.red[dark ? 400 : 500].hex)
|
|
2561
2550
|
},
|
|
2562
2551
|
link: {
|
|
2563
|
-
fg: mix(bg2,
|
|
2552
|
+
fg: mix(bg2, hues.blue[dark ? 400 : 600].hex)
|
|
2564
2553
|
},
|
|
2565
2554
|
code: {
|
|
2566
2555
|
bg: mix(bg2, tints[dark ? 950 : 50].hex),
|
|
@@ -2583,10 +2572,10 @@ const color = createColorTheme({
|
|
|
2583
2572
|
fg: mix(base.bg, tints[dark ? 400 : 600].hex)
|
|
2584
2573
|
},
|
|
2585
2574
|
accent: {
|
|
2586
|
-
fg: mix(base.bg,
|
|
2575
|
+
fg: mix(base.bg, hues.red[dark ? 400 : 500].hex)
|
|
2587
2576
|
},
|
|
2588
2577
|
link: {
|
|
2589
|
-
fg: mix(base.bg,
|
|
2578
|
+
fg: mix(base.bg, hues.blue[dark ? 400 : 600].hex)
|
|
2590
2579
|
},
|
|
2591
2580
|
code: {
|
|
2592
2581
|
bg: mix(base.bg, tints[dark ? 950 : 50].hex),
|
|
@@ -2675,10 +2664,10 @@ const color = createColorTheme({
|
|
|
2675
2664
|
fg: mix(base.bg, tints[dark ? 400 : 600].hex)
|
|
2676
2665
|
},
|
|
2677
2666
|
accent: {
|
|
2678
|
-
fg: mix(base.bg,
|
|
2667
|
+
fg: mix(base.bg, hues.red[dark ? 400 : 500].hex)
|
|
2679
2668
|
},
|
|
2680
2669
|
link: {
|
|
2681
|
-
fg: mix(base.bg,
|
|
2670
|
+
fg: mix(base.bg, hues.blue[dark ? 400 : 600].hex)
|
|
2682
2671
|
},
|
|
2683
2672
|
code: {
|
|
2684
2673
|
bg: mix(base.bg, tints[dark ? 950 : 50].hex),
|
|
@@ -2711,31 +2700,31 @@ const color = createColorTheme({
|
|
|
2711
2700
|
return {
|
|
2712
2701
|
bg: base.bg,
|
|
2713
2702
|
fg: base.fg,
|
|
2714
|
-
border: mix(base.bg,
|
|
2715
|
-
placeholder: mix(base.bg,
|
|
2703
|
+
border: mix(base.bg, hues.gray[dark ? 700 : 300].hex),
|
|
2704
|
+
placeholder: mix(base.bg, hues.gray[dark ? 600 : 400].hex)
|
|
2716
2705
|
};
|
|
2717
2706
|
}
|
|
2718
2707
|
if (state === "disabled") {
|
|
2719
2708
|
return {
|
|
2720
|
-
bg: mix(base.bg,
|
|
2721
|
-
fg: mix(base.bg,
|
|
2722
|
-
border: mix(base.bg,
|
|
2723
|
-
placeholder: mix(base.bg,
|
|
2709
|
+
bg: mix(base.bg, hues.gray[dark ? 950 : 50].hex),
|
|
2710
|
+
fg: mix(base.bg, hues.gray[dark ? 700 : 300].hex),
|
|
2711
|
+
border: mix(base.bg, hues.gray[dark ? 900 : 100].hex),
|
|
2712
|
+
placeholder: mix(base.bg, hues.gray[dark ? 800 : 200].hex)
|
|
2724
2713
|
};
|
|
2725
2714
|
}
|
|
2726
2715
|
if (state === "readOnly") {
|
|
2727
2716
|
return {
|
|
2728
|
-
bg: mix(base.bg,
|
|
2729
|
-
fg: mix(base.bg,
|
|
2730
|
-
border: mix(base.bg,
|
|
2731
|
-
placeholder: mix(base.bg,
|
|
2717
|
+
bg: mix(base.bg, hues.gray[dark ? 950 : 50].hex),
|
|
2718
|
+
fg: mix(base.bg, hues.gray[dark ? 200 : 800].hex),
|
|
2719
|
+
border: mix(base.bg, hues.gray[dark ? 800 : 200].hex),
|
|
2720
|
+
placeholder: mix(base.bg, hues.gray[dark ? 600 : 400].hex)
|
|
2732
2721
|
};
|
|
2733
2722
|
}
|
|
2734
2723
|
return {
|
|
2735
2724
|
bg: base.bg,
|
|
2736
2725
|
fg: base.fg,
|
|
2737
2726
|
border: base.border,
|
|
2738
|
-
placeholder: mix(base.bg,
|
|
2727
|
+
placeholder: mix(base.bg, hues.gray[dark ? 600 : 400].hex)
|
|
2739
2728
|
};
|
|
2740
2729
|
},
|
|
2741
2730
|
selectable: _ref17 => {
|
|
@@ -2777,7 +2766,7 @@ const color = createColorTheme({
|
|
|
2777
2766
|
key
|
|
2778
2767
|
} = _ref18;
|
|
2779
2768
|
const mix = dark ? screen : multiply;
|
|
2780
|
-
return mix(base.bg,
|
|
2769
|
+
return mix(base.bg, hues[key][dark ? 400 : 500].hex);
|
|
2781
2770
|
},
|
|
2782
2771
|
syntax: _ref19 => {
|
|
2783
2772
|
let {
|
|
@@ -2788,42 +2777,42 @@ const color = createColorTheme({
|
|
|
2788
2777
|
const mainShade = dark ? 400 : 600;
|
|
2789
2778
|
const secondaryShade = dark ? 600 : 400;
|
|
2790
2779
|
return {
|
|
2791
|
-
atrule: mix(base.bg,
|
|
2792
|
-
attrName: mix(base.bg,
|
|
2793
|
-
attrValue: mix(base.bg,
|
|
2794
|
-
attribute: mix(base.bg,
|
|
2795
|
-
boolean: mix(base.bg,
|
|
2796
|
-
builtin: mix(base.bg,
|
|
2797
|
-
cdata: mix(base.bg,
|
|
2798
|
-
char: mix(base.bg,
|
|
2799
|
-
class: mix(base.bg,
|
|
2800
|
-
className: mix(base.bg,
|
|
2801
|
-
comment: mix(base.bg,
|
|
2802
|
-
constant: mix(base.bg,
|
|
2803
|
-
deleted: mix(base.bg,
|
|
2804
|
-
doctype: mix(base.bg,
|
|
2805
|
-
entity: mix(base.bg,
|
|
2806
|
-
function: mix(base.bg,
|
|
2807
|
-
hexcode: mix(base.bg,
|
|
2808
|
-
id: mix(base.bg,
|
|
2809
|
-
important: mix(base.bg,
|
|
2810
|
-
inserted: mix(base.bg,
|
|
2811
|
-
keyword: mix(base.bg,
|
|
2812
|
-
number: mix(base.bg,
|
|
2813
|
-
operator: mix(base.bg,
|
|
2814
|
-
prolog: mix(base.bg,
|
|
2815
|
-
property: mix(base.bg,
|
|
2816
|
-
pseudoClass: mix(base.bg,
|
|
2817
|
-
pseudoElement: mix(base.bg,
|
|
2818
|
-
punctuation: mix(base.bg,
|
|
2819
|
-
regex: mix(base.bg,
|
|
2820
|
-
selector: mix(base.bg,
|
|
2821
|
-
string: mix(base.bg,
|
|
2822
|
-
symbol: mix(base.bg,
|
|
2823
|
-
tag: mix(base.bg,
|
|
2824
|
-
unit: mix(base.bg,
|
|
2825
|
-
url: mix(base.bg,
|
|
2826
|
-
variable: mix(base.bg,
|
|
2780
|
+
atrule: mix(base.bg, hues.purple[mainShade].hex),
|
|
2781
|
+
attrName: mix(base.bg, hues.green[mainShade].hex),
|
|
2782
|
+
attrValue: mix(base.bg, hues.yellow[mainShade].hex),
|
|
2783
|
+
attribute: mix(base.bg, hues.yellow[mainShade].hex),
|
|
2784
|
+
boolean: mix(base.bg, hues.purple[mainShade].hex),
|
|
2785
|
+
builtin: mix(base.bg, hues.purple[mainShade].hex),
|
|
2786
|
+
cdata: mix(base.bg, hues.yellow[mainShade].hex),
|
|
2787
|
+
char: mix(base.bg, hues.yellow[mainShade].hex),
|
|
2788
|
+
class: mix(base.bg, hues.orange[mainShade].hex),
|
|
2789
|
+
className: mix(base.bg, hues.cyan[mainShade].hex),
|
|
2790
|
+
comment: mix(base.bg, hues.gray[secondaryShade].hex),
|
|
2791
|
+
constant: mix(base.bg, hues.purple[mainShade].hex),
|
|
2792
|
+
deleted: mix(base.bg, hues.red[mainShade].hex),
|
|
2793
|
+
doctype: mix(base.bg, hues.gray[secondaryShade].hex),
|
|
2794
|
+
entity: mix(base.bg, hues.red[mainShade].hex),
|
|
2795
|
+
function: mix(base.bg, hues.green[mainShade].hex),
|
|
2796
|
+
hexcode: mix(base.bg, hues.blue[mainShade].hex),
|
|
2797
|
+
id: mix(base.bg, hues.purple[mainShade].hex),
|
|
2798
|
+
important: mix(base.bg, hues.purple[mainShade].hex),
|
|
2799
|
+
inserted: mix(base.bg, hues.yellow[mainShade].hex),
|
|
2800
|
+
keyword: mix(base.bg, hues.magenta[mainShade].hex),
|
|
2801
|
+
number: mix(base.bg, hues.purple[mainShade].hex),
|
|
2802
|
+
operator: mix(base.bg, hues.magenta[mainShade].hex),
|
|
2803
|
+
prolog: mix(base.bg, hues.gray[secondaryShade].hex),
|
|
2804
|
+
property: mix(base.bg, hues.blue[mainShade].hex),
|
|
2805
|
+
pseudoClass: mix(base.bg, hues.yellow[mainShade].hex),
|
|
2806
|
+
pseudoElement: mix(base.bg, hues.yellow[mainShade].hex),
|
|
2807
|
+
punctuation: mix(base.bg, hues.gray[mainShade].hex),
|
|
2808
|
+
regex: mix(base.bg, hues.blue[mainShade].hex),
|
|
2809
|
+
selector: mix(base.bg, hues.red[mainShade].hex),
|
|
2810
|
+
string: mix(base.bg, hues.yellow[mainShade].hex),
|
|
2811
|
+
symbol: mix(base.bg, hues.purple[mainShade].hex),
|
|
2812
|
+
tag: mix(base.bg, hues.red[mainShade].hex),
|
|
2813
|
+
unit: mix(base.bg, hues.orange[mainShade].hex),
|
|
2814
|
+
url: mix(base.bg, hues.red[mainShade].hex),
|
|
2815
|
+
variable: mix(base.bg, hues.red[mainShade].hex)
|
|
2827
2816
|
};
|
|
2828
2817
|
}
|
|
2829
2818
|
});
|
|
@@ -3103,17 +3092,17 @@ function getGlobalScope() {
|
|
|
3103
3092
|
}
|
|
3104
3093
|
const globalScope = getGlobalScope();
|
|
3105
3094
|
const key$7 = Symbol.for("@sanity/ui/context/theme");
|
|
3106
|
-
globalScope[key$7] = globalScope[key$7] ||
|
|
3095
|
+
globalScope[key$7] = globalScope[key$7] || createContext(null);
|
|
3107
3096
|
const ThemeContext = globalScope[key$7];
|
|
3108
3097
|
function ThemeProvider(props) {
|
|
3109
|
-
const parentTheme =
|
|
3098
|
+
const parentTheme = useContext(ThemeContext);
|
|
3110
3099
|
const {
|
|
3111
3100
|
children,
|
|
3112
3101
|
scheme = (parentTheme == null ? void 0 : parentTheme.scheme) || "light",
|
|
3113
3102
|
theme: themeProp = (parentTheme == null ? void 0 : parentTheme.theme) || null,
|
|
3114
3103
|
tone = (parentTheme == null ? void 0 : parentTheme.tone) || "default"
|
|
3115
3104
|
} = props;
|
|
3116
|
-
const theme =
|
|
3105
|
+
const theme = useMemo(() => {
|
|
3117
3106
|
if (!themeProp) return null;
|
|
3118
3107
|
const {
|
|
3119
3108
|
color: rootColor,
|
|
@@ -3130,20 +3119,20 @@ function ThemeProvider(props) {
|
|
|
3130
3119
|
})
|
|
3131
3120
|
};
|
|
3132
3121
|
}, [scheme, themeProp, tone]);
|
|
3133
|
-
const value =
|
|
3122
|
+
const value = useMemo(() => themeProp && {
|
|
3134
3123
|
version: 0,
|
|
3135
3124
|
theme: themeProp,
|
|
3136
3125
|
scheme,
|
|
3137
3126
|
tone
|
|
3138
3127
|
}, [themeProp, scheme, tone]);
|
|
3139
3128
|
if (!theme) {
|
|
3140
|
-
return /* @__PURE__ */
|
|
3129
|
+
return /* @__PURE__ */jsx("pre", {
|
|
3141
3130
|
children: 'ThemeProvider: no "theme" property provided'
|
|
3142
3131
|
});
|
|
3143
3132
|
}
|
|
3144
|
-
return /* @__PURE__ */
|
|
3133
|
+
return /* @__PURE__ */jsx(ThemeContext.Provider, {
|
|
3145
3134
|
value,
|
|
3146
|
-
children: /* @__PURE__ */
|
|
3135
|
+
children: /* @__PURE__ */jsx(ThemeProvider$1, {
|
|
3147
3136
|
theme,
|
|
3148
3137
|
children
|
|
3149
3138
|
})
|
|
@@ -3153,7 +3142,7 @@ function isRecord(value) {
|
|
|
3153
3142
|
return Boolean(value && typeof value === "object");
|
|
3154
3143
|
}
|
|
3155
3144
|
function useRootTheme() {
|
|
3156
|
-
const value =
|
|
3145
|
+
const value = useContext(ThemeContext);
|
|
3157
3146
|
if (!value) {
|
|
3158
3147
|
throw new Error("useRootTheme(): missing context value");
|
|
3159
3148
|
}
|
|
@@ -3169,7 +3158,7 @@ function ThemeColorProvider(props) {
|
|
|
3169
3158
|
tone
|
|
3170
3159
|
} = props;
|
|
3171
3160
|
const root = useRootTheme();
|
|
3172
|
-
return /* @__PURE__ */
|
|
3161
|
+
return /* @__PURE__ */jsx(ThemeProvider, {
|
|
3173
3162
|
scheme: scheme || root.scheme,
|
|
3174
3163
|
theme: root.theme,
|
|
3175
3164
|
tone,
|
|
@@ -3177,7 +3166,7 @@ function ThemeColorProvider(props) {
|
|
|
3177
3166
|
});
|
|
3178
3167
|
}
|
|
3179
3168
|
function useTheme() {
|
|
3180
|
-
return
|
|
3169
|
+
return useTheme$1();
|
|
3181
3170
|
}
|
|
3182
3171
|
const MEDIA_MANAGER_CACHE = /* @__PURE__ */new WeakMap();
|
|
3183
3172
|
function _getMediaQuery(media, index) {
|
|
@@ -3256,18 +3245,18 @@ function useMediaIndex() {
|
|
|
3256
3245
|
const {
|
|
3257
3246
|
media
|
|
3258
3247
|
} = theme.sanity;
|
|
3259
|
-
const manager =
|
|
3260
|
-
const [index, setIndex] =
|
|
3261
|
-
|
|
3248
|
+
const manager = useMemo(() => _getMediaManager(media), [media]);
|
|
3249
|
+
const [index, setIndex] = useState(manager.getCurrentIndex);
|
|
3250
|
+
useEffect(() => manager.subscribe(setIndex), [manager]);
|
|
3262
3251
|
return index;
|
|
3263
3252
|
}
|
|
3264
3253
|
function usePrefersDark() {
|
|
3265
|
-
const mq =
|
|
3254
|
+
const mq = useMemo(() => {
|
|
3266
3255
|
if (typeof window === "undefined") return void 0;
|
|
3267
3256
|
return window.matchMedia("(prefers-color-scheme: dark)");
|
|
3268
3257
|
}, []);
|
|
3269
|
-
const [dark, setDark] =
|
|
3270
|
-
|
|
3258
|
+
const [dark, setDark] = useState((mq == null ? void 0 : mq.matches) || false);
|
|
3259
|
+
useEffect(() => {
|
|
3271
3260
|
if (!mq) return void 0;
|
|
3272
3261
|
setDark(mq.matches);
|
|
3273
3262
|
const handleChange = () => setDark(mq.matches);
|
|
@@ -3276,9 +3265,9 @@ function usePrefersDark() {
|
|
|
3276
3265
|
}, [mq]);
|
|
3277
3266
|
return dark;
|
|
3278
3267
|
}
|
|
3279
|
-
const useIsomorphicEffect = typeof window !== "undefined" ?
|
|
3268
|
+
const useIsomorphicEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect;
|
|
3280
3269
|
function useForwardedRef(ref) {
|
|
3281
|
-
const innerRef =
|
|
3270
|
+
const innerRef = useRef(null);
|
|
3282
3271
|
useIsomorphicEffect(() => {
|
|
3283
3272
|
if (!ref) return;
|
|
3284
3273
|
if (typeof ref === "function") {
|
|
@@ -3290,7 +3279,7 @@ function useForwardedRef(ref) {
|
|
|
3290
3279
|
return innerRef;
|
|
3291
3280
|
}
|
|
3292
3281
|
function useCustomValidity(ref, customValidity) {
|
|
3293
|
-
|
|
3282
|
+
useEffect(() => {
|
|
3294
3283
|
if (ref.current) {
|
|
3295
3284
|
ref.current.setCustomValidity(customValidity || "");
|
|
3296
3285
|
}
|
|
@@ -3804,7 +3793,7 @@ function responsiveInputPaddingIconRightStyle(props) {
|
|
|
3804
3793
|
$iconRight: true
|
|
3805
3794
|
}));
|
|
3806
3795
|
}
|
|
3807
|
-
const ROOT_STYLE =
|
|
3796
|
+
const ROOT_STYLE = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n &:not([hidden]) {\n display: flex;\n }\n\n align-items: center;\n"])));
|
|
3808
3797
|
function textInputRootStyle() {
|
|
3809
3798
|
return ROOT_STYLE;
|
|
3810
3799
|
}
|
|
@@ -3817,7 +3806,7 @@ function textInputBaseStyle(props) {
|
|
|
3817
3806
|
} = props;
|
|
3818
3807
|
const font = theme.sanity.fonts.text;
|
|
3819
3808
|
const color = theme.sanity.color.input;
|
|
3820
|
-
return
|
|
3809
|
+
return css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n appearance: none;\n background: none;\n border: 0;\n border-radius: 0;\n outline: none;\n width: 100%;\n box-sizing: border-box;\n font-family: ", ";\n font-weight: ", ";\n margin: 0;\n position: relative;\n z-index: 1;\n display: block;\n\n /* NOTE: This is a hack to disable Chrome\u2019s autofill styles */\n &:-webkit-autofill,\n &:-webkit-autofill:hover,\n &:-webkit-autofill:focus,\n &:-webkit-autofill:active {\n -webkit-text-fill-color: var(--input-fg-color) !important;\n transition: background-color 5000s;\n transition-delay: 86400s /* 24h */;\n }\n\n /* &:is(textarea) */\n &[data-as='textarea'] {\n resize: none;\n }\n\n color: var(--input-fg-color);\n\n &::placeholder {\n color: var(--input-placeholder-color);\n }\n\n &[data-scheme='", "'][data-tone='", "'] {\n --input-fg-color: ", ";\n --input-placeholder-color: ", ";\n\n /* enabled */\n &:not(:invalid):not(:disabled):not(:read-only) {\n --input-fg-color: ", ";\n --input-placeholder-color: ", ";\n }\n\n /* disabled */\n &:not(:invalid):disabled {\n --input-fg-color: ", ";\n --input-placeholder-color: ", ";\n }\n\n /* invalid */\n &:invalid {\n --input-fg-color: ", ";\n --input-placeholder-color: ", ";\n }\n\n /* readOnly */\n &:read-only {\n --input-fg-color: ", ";\n --input-placeholder-color: ", ";\n }\n }\n "])), font.family, $weight && font.weights[$weight] || font.weights.regular, $scheme, $tone, color.default.enabled.fg, color.default.enabled.placeholder, color.default.enabled.fg, color.default.enabled.placeholder, color.default.disabled.fg, color.default.disabled.placeholder, color.invalid.enabled.fg, color.invalid.enabled.placeholder, color.default.readOnly.fg, color.default.readOnly.placeholder);
|
|
3821
3810
|
}
|
|
3822
3811
|
function textInputFontSizeStyle(props) {
|
|
3823
3812
|
const {
|
|
@@ -3848,7 +3837,7 @@ function textInputRepresentationStyle(props) {
|
|
|
3848
3837
|
input
|
|
3849
3838
|
} = theme.sanity;
|
|
3850
3839
|
const color = theme.sanity.color.input;
|
|
3851
|
-
return
|
|
3840
|
+
return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n --input-box-shadow: none;\n\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: block;\n pointer-events: none;\n z-index: 0;\n\n background-color: var(--card-bg-color);\n box-shadow: var(--input-box-shadow);\n\n border-top-left-radius: ", ";\n border-bottom-left-radius: ", ";\n border-top-right-radius: ", ";\n border-bottom-right-radius: ", ";\n\n &[data-scheme='", "'][data-tone='", "'] {\n --card-bg-color: ", ";\n --card-fg-color: ", ";\n\n /* enabled */\n *:not(:disabled) + &[data-border] {\n --input-box-shadow: ", ";\n }\n\n /* invalid */\n *:not(:disabled):invalid + & {\n --card-bg-color: ", ";\n --card-fg-color: ", ";\n\n &[data-border] {\n --input-box-shadow: ", ";\n }\n }\n\n /* focused */\n *:not(:disabled):focus + & {\n &[data-border] {\n --input-box-shadow: ", ";\n }\n\n &:not([data-border]) {\n --input-box-shadow: ", ";\n }\n }\n\n /* disabled */\n *:disabled + & {\n --card-bg-color: ", " !important;\n --card-fg-color: ", " !important;\n\n &[data-border] {\n --input-box-shadow: ", ";\n }\n }\n\n /* readOnly */\n *:read-only + & {\n --card-bg-color: ", " !important;\n --card-fg-color: ", " !important;\n }\n\n /* hovered */\n @media (hover: hover) {\n *:not(:disabled):not(:read-only):not(:invalid):hover + & {\n --card-bg-color: ", ";\n --card-fg-color: ", ";\n }\n\n *:not(:disabled):not(:read-only):not(:invalid):not(:focus):hover + &[data-border] {\n --input-box-shadow: ", ";\n }\n }\n }\n "])), $hasPrefix ? 0 : void 0, $hasPrefix ? 0 : void 0, $hasSuffix ? 0 : void 0, $hasSuffix ? 0 : void 0, $scheme, $tone, color.default.enabled.bg, color.default.enabled.fg, focusRingBorderStyle({
|
|
3852
3841
|
color: color.default.enabled.border,
|
|
3853
3842
|
width: input.border.width
|
|
3854
3843
|
}), color.invalid.enabled.bg, color.invalid.enabled.fg, focusRingBorderStyle({
|
|
@@ -3926,11 +3915,11 @@ function textBaseStyle(props) {
|
|
|
3926
3915
|
const {
|
|
3927
3916
|
weights
|
|
3928
3917
|
} = theme.sanity.fonts.text;
|
|
3929
|
-
return
|
|
3918
|
+
return css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n color: var(--card-fg-color);\n\n ", "\n\n ", "\n\n & code {\n font-family: ", ";\n border-radius: 1px;\n background-color: var(--card-code-bg-color);\n color: var(--card-code-fg-color);\n }\n\n & a {\n text-decoration: none;\n border-radius: 1px;\n color: var(--card-link-color);\n outline: none;\n\n @media (hover: hover) {\n &:hover {\n text-decoration: underline;\n }\n }\n\n &:focus {\n box-shadow: 0 0 0 1px var(--card-bg-color), 0 0 0 3px var(--card-focus-ring-color);\n }\n\n &:focus:not(:focus-visible) {\n box-shadow: none;\n }\n }\n\n & strong {\n font-weight: ", ";\n }\n\n & [data-sanity-icon] {\n vertical-align: baseline;\n }\n "])), $accent && css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n color: var(--card-accent-fg-color);\n "]))), $muted && css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n color: var(--card-muted-fg-color);\n "]))), theme.sanity.fonts.code.family, weights.bold);
|
|
3930
3919
|
}
|
|
3931
|
-
const Root$E =
|
|
3932
|
-
const SpanWithTextOverflow$2 =
|
|
3933
|
-
const Text =
|
|
3920
|
+
const Root$E = styled.div(responsiveTextFont, responsiveTextAlignStyle, textBaseStyle);
|
|
3921
|
+
const SpanWithTextOverflow$2 = styled.span(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n display: block;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n"])));
|
|
3922
|
+
const Text = forwardRef(function Text2(props, ref) {
|
|
3934
3923
|
const {
|
|
3935
3924
|
accent = false,
|
|
3936
3925
|
align,
|
|
@@ -3943,11 +3932,11 @@ const Text = react.forwardRef(function Text2(props, ref) {
|
|
|
3943
3932
|
restProps = _objectWithoutProperties(props, _excluded2);
|
|
3944
3933
|
let children = childrenProp;
|
|
3945
3934
|
if (textOverflow === "ellipsis") {
|
|
3946
|
-
children = /* @__PURE__ */
|
|
3935
|
+
children = /* @__PURE__ */jsx(SpanWithTextOverflow$2, {
|
|
3947
3936
|
children
|
|
3948
3937
|
});
|
|
3949
3938
|
}
|
|
3950
|
-
return /* @__PURE__ */
|
|
3939
|
+
return /* @__PURE__ */jsx(Root$E, _objectSpread(_objectSpread({
|
|
3951
3940
|
"data-ui": "Text"
|
|
3952
3941
|
}, restProps), {}, {
|
|
3953
3942
|
$accent: accent,
|
|
@@ -3956,7 +3945,7 @@ const Text = react.forwardRef(function Text2(props, ref) {
|
|
|
3956
3945
|
ref,
|
|
3957
3946
|
$size: useArrayProp(size),
|
|
3958
3947
|
$weight: weight,
|
|
3959
|
-
children: /* @__PURE__ */
|
|
3948
|
+
children: /* @__PURE__ */jsx("span", {
|
|
3960
3949
|
children
|
|
3961
3950
|
})
|
|
3962
3951
|
}));
|
|
@@ -4105,12 +4094,12 @@ function avatarStrokeStyle() {
|
|
|
4105
4094
|
}
|
|
4106
4095
|
};
|
|
4107
4096
|
}
|
|
4108
|
-
const Root$D =
|
|
4109
|
-
const Arrow =
|
|
4110
|
-
const BgStroke =
|
|
4111
|
-
const Stroke =
|
|
4112
|
-
const Initials =
|
|
4113
|
-
const Avatar =
|
|
4097
|
+
const Root$D = styled.div(responsiveAvatarSizeStyle, avatarStyle.root);
|
|
4098
|
+
const Arrow = styled.div(avatarStyle.arrow);
|
|
4099
|
+
const BgStroke = styled.ellipse(avatarStyle.bgStroke);
|
|
4100
|
+
const Stroke = styled.ellipse(avatarStyle.stroke);
|
|
4101
|
+
const Initials = styled.div(avatarStyle.initials);
|
|
4102
|
+
const Avatar = forwardRef(function Avatar2(props, ref) {
|
|
4114
4103
|
const {
|
|
4115
4104
|
as: asProp,
|
|
4116
4105
|
color: colorKey = "gray",
|
|
@@ -4124,33 +4113,33 @@ const Avatar = react.forwardRef(function Avatar2(props, ref) {
|
|
|
4124
4113
|
size: sizeProp = 0
|
|
4125
4114
|
} = props,
|
|
4126
4115
|
restProps = _objectWithoutProperties(props, _excluded3);
|
|
4127
|
-
const as =
|
|
4116
|
+
const as = ReactIs.isValidElementType(asProp) ? asProp : "div";
|
|
4128
4117
|
const size = useArrayProp(sizeProp);
|
|
4129
4118
|
const theme = useTheme();
|
|
4130
4119
|
const color = theme.sanity.color.spot[colorKey] || theme.sanity.color.spot.gray;
|
|
4131
4120
|
const avatarSize = theme.sanity.avatar.sizes[size[0]] || theme.sanity.avatar.sizes[0];
|
|
4132
4121
|
const _sizeRem = avatarSize.size;
|
|
4133
4122
|
const _radius = _sizeRem / 2;
|
|
4134
|
-
const elementId =
|
|
4135
|
-
const [arrowPosition, setArrowPosition] =
|
|
4136
|
-
const [imageFailed, setImageFailed] =
|
|
4123
|
+
const elementId = useId();
|
|
4124
|
+
const [arrowPosition, setArrowPosition] = useState(animateArrowFrom || arrowPositionProp || "inside");
|
|
4125
|
+
const [imageFailed, setImageFailed] = useState(false);
|
|
4137
4126
|
const imageId = "avatar-image-".concat(elementId);
|
|
4138
|
-
|
|
4127
|
+
useEffect(() => {
|
|
4139
4128
|
if (arrowPosition === arrowPositionProp) return void 0;
|
|
4140
4129
|
const raf = requestAnimationFrame(() => setArrowPosition(arrowPositionProp));
|
|
4141
4130
|
return () => cancelAnimationFrame(raf);
|
|
4142
4131
|
}, [arrowPosition, arrowPositionProp]);
|
|
4143
|
-
|
|
4132
|
+
useEffect(() => {
|
|
4144
4133
|
if (src) setImageFailed(false);
|
|
4145
4134
|
}, [src]);
|
|
4146
|
-
const handleImageError =
|
|
4135
|
+
const handleImageError = useCallback(() => {
|
|
4147
4136
|
setImageFailed(true);
|
|
4148
4137
|
if (onImageLoadError) {
|
|
4149
4138
|
onImageLoadError(new Error("Avatar: the image failed to load"));
|
|
4150
4139
|
}
|
|
4151
4140
|
}, [onImageLoadError]);
|
|
4152
|
-
const initialsSize =
|
|
4153
|
-
return /* @__PURE__ */
|
|
4141
|
+
const initialsSize = useMemo(() => size.map(s => s === 0 ? 0 : s + 1), [size]);
|
|
4142
|
+
return /* @__PURE__ */jsxs(Root$D, _objectSpread(_objectSpread({
|
|
4154
4143
|
as,
|
|
4155
4144
|
"data-as": typeof as === "string" ? as : void 0,
|
|
4156
4145
|
"data-ui": "Avatar"
|
|
@@ -4162,45 +4151,45 @@ const Avatar = react.forwardRef(function Avatar2(props, ref) {
|
|
|
4162
4151
|
"data-status": status,
|
|
4163
4152
|
ref,
|
|
4164
4153
|
title,
|
|
4165
|
-
children: [/* @__PURE__ */
|
|
4166
|
-
children: /* @__PURE__ */
|
|
4154
|
+
children: [/* @__PURE__ */jsx(Arrow, {
|
|
4155
|
+
children: /* @__PURE__ */jsx("svg", {
|
|
4167
4156
|
width: "11",
|
|
4168
4157
|
height: "7",
|
|
4169
4158
|
viewBox: "0 0 11 7",
|
|
4170
4159
|
fill: "none",
|
|
4171
|
-
children: /* @__PURE__ */
|
|
4160
|
+
children: /* @__PURE__ */jsx("path", {
|
|
4172
4161
|
d: "M6.67948 1.50115L11 7L0 7L4.32052 1.50115C4.92109 0.736796 6.07891 0.736795 6.67948 1.50115Z",
|
|
4173
4162
|
fill: color
|
|
4174
4163
|
})
|
|
4175
4164
|
})
|
|
4176
|
-
}), !imageFailed && src && /* @__PURE__ */
|
|
4165
|
+
}), !imageFailed && src && /* @__PURE__ */jsxs("svg", {
|
|
4177
4166
|
viewBox: "0 0 ".concat(_sizeRem, " ").concat(_sizeRem),
|
|
4178
4167
|
fill: "none",
|
|
4179
|
-
children: [/* @__PURE__ */
|
|
4180
|
-
children: /* @__PURE__ */
|
|
4168
|
+
children: [/* @__PURE__ */jsx("defs", {
|
|
4169
|
+
children: /* @__PURE__ */jsx("pattern", {
|
|
4181
4170
|
id: imageId,
|
|
4182
4171
|
patternContentUnits: "objectBoundingBox",
|
|
4183
4172
|
width: "1",
|
|
4184
4173
|
height: "1",
|
|
4185
|
-
children: /* @__PURE__ */
|
|
4174
|
+
children: /* @__PURE__ */jsx("image", {
|
|
4186
4175
|
href: src,
|
|
4187
4176
|
width: "1",
|
|
4188
4177
|
height: "1",
|
|
4189
4178
|
onError: handleImageError
|
|
4190
4179
|
})
|
|
4191
4180
|
})
|
|
4192
|
-
}), /* @__PURE__ */
|
|
4181
|
+
}), /* @__PURE__ */jsx("circle", {
|
|
4193
4182
|
cx: _radius,
|
|
4194
4183
|
cy: _radius,
|
|
4195
4184
|
r: _radius,
|
|
4196
4185
|
fill: "url(#".concat(imageId, ")")
|
|
4197
|
-
}), /* @__PURE__ */
|
|
4186
|
+
}), /* @__PURE__ */jsx(BgStroke, {
|
|
4198
4187
|
cx: _radius,
|
|
4199
4188
|
cy: _radius,
|
|
4200
4189
|
rx: _radius,
|
|
4201
4190
|
ry: _radius,
|
|
4202
4191
|
vectorEffect: "non-scaling-stroke"
|
|
4203
|
-
}), /* @__PURE__ */
|
|
4192
|
+
}), /* @__PURE__ */jsx(Stroke, {
|
|
4204
4193
|
cx: _radius,
|
|
4205
4194
|
cy: _radius,
|
|
4206
4195
|
rx: _radius,
|
|
@@ -4208,12 +4197,12 @@ const Avatar = react.forwardRef(function Avatar2(props, ref) {
|
|
|
4208
4197
|
stroke: color,
|
|
4209
4198
|
vectorEffect: "non-scaling-stroke"
|
|
4210
4199
|
})]
|
|
4211
|
-
}), (imageFailed || !src) && initials && /* @__PURE__ */
|
|
4212
|
-
children: /* @__PURE__ */
|
|
4213
|
-
children: /* @__PURE__ */
|
|
4200
|
+
}), (imageFailed || !src) && initials && /* @__PURE__ */jsx(Fragment, {
|
|
4201
|
+
children: /* @__PURE__ */jsx(Initials, {
|
|
4202
|
+
children: /* @__PURE__ */jsx(Text, {
|
|
4214
4203
|
as: "span",
|
|
4215
4204
|
size: initialsSize,
|
|
4216
|
-
children: /* @__PURE__ */
|
|
4205
|
+
children: /* @__PURE__ */jsx("strong", {
|
|
4217
4206
|
children: initials
|
|
4218
4207
|
})
|
|
4219
4208
|
})
|
|
@@ -4243,24 +4232,24 @@ function _avatarCounterBaseStyle(props) {
|
|
|
4243
4232
|
const {
|
|
4244
4233
|
theme
|
|
4245
4234
|
} = props;
|
|
4246
|
-
return
|
|
4235
|
+
return css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n user-select: none;\n color: inherit;\n color: var(--card-fg-color);\n background: var(--card-bg-color);\n box-shadow: 0 0 0 1px var(--card-bg-color), inset 0 0 0 1.5px var(--card-hairline-hard-color);\n padding: 0 ", ";\n\n &:not([hidden]) {\n display: flex;\n }\n "])), rem(theme.sanity.space[2]));
|
|
4247
4236
|
}
|
|
4248
|
-
const Root$C =
|
|
4249
|
-
const AvatarCounter =
|
|
4237
|
+
const Root$C = styled.div(_responsiveAvatarCounterSizeStyle, _avatarCounterBaseStyle);
|
|
4238
|
+
const AvatarCounter = forwardRef(function AvatarCounter2(props, ref) {
|
|
4250
4239
|
const {
|
|
4251
4240
|
count,
|
|
4252
4241
|
size: sizeProp = 0
|
|
4253
4242
|
} = props;
|
|
4254
4243
|
const size = useArrayProp(sizeProp);
|
|
4255
|
-
const counterSize =
|
|
4256
|
-
return /* @__PURE__ */
|
|
4244
|
+
const counterSize = useMemo(() => size.map(s => s === 0 ? 0 : s + 1), [size]);
|
|
4245
|
+
return /* @__PURE__ */jsx(Root$C, {
|
|
4257
4246
|
$size: size,
|
|
4258
4247
|
"data-ui": "AvatarCounter",
|
|
4259
4248
|
ref,
|
|
4260
|
-
children: /* @__PURE__ */
|
|
4249
|
+
children: /* @__PURE__ */jsx(Text, {
|
|
4261
4250
|
as: "span",
|
|
4262
4251
|
size: counterSize,
|
|
4263
|
-
children: /* @__PURE__ */
|
|
4252
|
+
children: /* @__PURE__ */jsx("strong", {
|
|
4264
4253
|
children: count
|
|
4265
4254
|
})
|
|
4266
4255
|
})
|
|
@@ -4268,9 +4257,9 @@ const AvatarCounter = react.forwardRef(function AvatarCounter2(props, ref) {
|
|
|
4268
4257
|
});
|
|
4269
4258
|
function childrenToElementArray(children) {
|
|
4270
4259
|
const childrenArray = Array.isArray(children) ? children : [children];
|
|
4271
|
-
return childrenArray.filter(node =>
|
|
4260
|
+
return childrenArray.filter(node => isElement$1(node) || isFragment(node) || typeof node === "string");
|
|
4272
4261
|
}
|
|
4273
|
-
const BASE_STYLES =
|
|
4262
|
+
const BASE_STYLES = css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n white-space: nowrap;\n\n & > div {\n vertical-align: top;\n\n &:not([hidden]) {\n display: inline-block;\n }\n }\n"])));
|
|
4274
4263
|
function avatarStackStyle() {
|
|
4275
4264
|
return BASE_STYLES;
|
|
4276
4265
|
}
|
|
@@ -4292,8 +4281,8 @@ function responsiveAvatarStackSizeStyle(props) {
|
|
|
4292
4281
|
};
|
|
4293
4282
|
});
|
|
4294
4283
|
}
|
|
4295
|
-
const Root$B =
|
|
4296
|
-
const AvatarStack =
|
|
4284
|
+
const Root$B = styled.div(responsiveAvatarStackSizeStyle, avatarStackStyle);
|
|
4285
|
+
const AvatarStack = forwardRef(function AvatarStack2(props, ref) {
|
|
4297
4286
|
const {
|
|
4298
4287
|
children: childrenProp,
|
|
4299
4288
|
maxLength: maxLengthProp = 4,
|
|
@@ -4307,29 +4296,29 @@ const AvatarStack = react.forwardRef(function AvatarStack2(props, ref) {
|
|
|
4307
4296
|
const visibleCount = maxLength - 1;
|
|
4308
4297
|
const extraCount = len - visibleCount;
|
|
4309
4298
|
const visibleChildren = extraCount > 1 ? children.slice(extraCount, len) : children;
|
|
4310
|
-
return /* @__PURE__ */
|
|
4299
|
+
return /* @__PURE__ */jsxs(Root$B, _objectSpread(_objectSpread({
|
|
4311
4300
|
"data-ui": "AvatarStack"
|
|
4312
4301
|
}, restProps), {}, {
|
|
4313
4302
|
ref,
|
|
4314
4303
|
$size: size,
|
|
4315
|
-
children: [len === 0 && /* @__PURE__ */
|
|
4316
|
-
children: /* @__PURE__ */
|
|
4304
|
+
children: [len === 0 && /* @__PURE__ */jsx("div", {
|
|
4305
|
+
children: /* @__PURE__ */jsx(AvatarCounter, {
|
|
4317
4306
|
count: len
|
|
4318
4307
|
})
|
|
4319
|
-
}), len !== 0 && extraCount > 1 && /* @__PURE__ */
|
|
4320
|
-
children: /* @__PURE__ */
|
|
4308
|
+
}), len !== 0 && extraCount > 1 && /* @__PURE__ */jsx("div", {
|
|
4309
|
+
children: /* @__PURE__ */jsx(AvatarCounter, {
|
|
4321
4310
|
count: extraCount,
|
|
4322
4311
|
size
|
|
4323
4312
|
})
|
|
4324
|
-
}), visibleChildren.map((child, childIndex) => /* @__PURE__ */
|
|
4325
|
-
children:
|
|
4313
|
+
}), visibleChildren.map((child, childIndex) => /* @__PURE__ */jsx("div", {
|
|
4314
|
+
children: cloneElement(child, {
|
|
4326
4315
|
size
|
|
4327
4316
|
})
|
|
4328
4317
|
}, String(childIndex)))]
|
|
4329
4318
|
}));
|
|
4330
4319
|
});
|
|
4331
|
-
const Root$A =
|
|
4332
|
-
const Box =
|
|
4320
|
+
const Root$A = styled.div(boxStyle, flexItemStyle, responsiveBoxStyle, responsiveGridItemStyle, responsiveMarginStyle, responsivePaddingStyle);
|
|
4321
|
+
const Box = forwardRef(function Box2(props, ref) {
|
|
4333
4322
|
const {
|
|
4334
4323
|
as: asProp = "div",
|
|
4335
4324
|
column,
|
|
@@ -4359,7 +4348,7 @@ const Box = react.forwardRef(function Box2(props, ref) {
|
|
|
4359
4348
|
sizing
|
|
4360
4349
|
} = props,
|
|
4361
4350
|
restProps = _objectWithoutProperties(props, _excluded5);
|
|
4362
|
-
return /* @__PURE__ */
|
|
4351
|
+
return /* @__PURE__ */jsx(Root$A, _objectSpread(_objectSpread({
|
|
4363
4352
|
"data-as": typeof asProp === "string" ? asProp : void 0,
|
|
4364
4353
|
"data-ui": "Box"
|
|
4365
4354
|
}, restProps), {}, {
|
|
@@ -4402,11 +4391,11 @@ function labelBaseStyle(props) {
|
|
|
4402
4391
|
const {
|
|
4403
4392
|
fonts
|
|
4404
4393
|
} = theme.sanity;
|
|
4405
|
-
return
|
|
4394
|
+
return css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n text-transform: uppercase;\n\n ", "\n\n ", "\n\n & code {\n font-family: ", ";\n border-radius: 1px;\n }\n\n & a {\n text-decoration: none;\n border-radius: 1px;\n }\n\n & [data-sanity-icon] {\n vertical-align: baseline;\n }\n "])), $accent && css(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n color: var(--card-accent-fg-color);\n "]))), $muted && css(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n color: var(--card-muted-fg-color);\n "]))), fonts.code.family);
|
|
4406
4395
|
}
|
|
4407
|
-
const Root$z =
|
|
4408
|
-
const SpanWithTextOverflow$1 =
|
|
4409
|
-
const Label =
|
|
4396
|
+
const Root$z = styled.div(responsiveLabelFont, responsiveTextAlignStyle, labelBaseStyle);
|
|
4397
|
+
const SpanWithTextOverflow$1 = styled.span(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n display: block;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n"])));
|
|
4398
|
+
const Label = forwardRef(function Label2(props, ref) {
|
|
4410
4399
|
const {
|
|
4411
4400
|
accent,
|
|
4412
4401
|
align,
|
|
@@ -4419,15 +4408,15 @@ const Label = react.forwardRef(function Label2(props, ref) {
|
|
|
4419
4408
|
restProps = _objectWithoutProperties(props, _excluded6);
|
|
4420
4409
|
let children = childrenProp;
|
|
4421
4410
|
if (textOverflow === "ellipsis") {
|
|
4422
|
-
children = /* @__PURE__ */
|
|
4411
|
+
children = /* @__PURE__ */jsx(SpanWithTextOverflow$1, {
|
|
4423
4412
|
children
|
|
4424
4413
|
});
|
|
4425
4414
|
} else {
|
|
4426
|
-
children = /* @__PURE__ */
|
|
4415
|
+
children = /* @__PURE__ */jsx("span", {
|
|
4427
4416
|
children
|
|
4428
4417
|
});
|
|
4429
4418
|
}
|
|
4430
|
-
return /* @__PURE__ */
|
|
4419
|
+
return /* @__PURE__ */jsx(Root$z, _objectSpread(_objectSpread({
|
|
4431
4420
|
"data-ui": "Label"
|
|
4432
4421
|
}, restProps), {}, {
|
|
4433
4422
|
$accent: accent,
|
|
@@ -4457,8 +4446,8 @@ function badgeStyle(props) {
|
|
|
4457
4446
|
}
|
|
4458
4447
|
};
|
|
4459
4448
|
}
|
|
4460
|
-
const Root$y =
|
|
4461
|
-
const Badge =
|
|
4449
|
+
const Root$y = styled(Box)(responsiveRadiusStyle, badgeStyle);
|
|
4450
|
+
const Badge = forwardRef(function Badge2(props, ref) {
|
|
4462
4451
|
const {
|
|
4463
4452
|
children,
|
|
4464
4453
|
fontSize,
|
|
@@ -4468,7 +4457,7 @@ const Badge = react.forwardRef(function Badge2(props, ref) {
|
|
|
4468
4457
|
tone = "default"
|
|
4469
4458
|
} = props,
|
|
4470
4459
|
restProps = _objectWithoutProperties(props, _excluded7);
|
|
4471
|
-
return /* @__PURE__ */
|
|
4460
|
+
return /* @__PURE__ */jsx(Root$y, _objectSpread(_objectSpread({
|
|
4472
4461
|
"data-ui": "Badge"
|
|
4473
4462
|
}, restProps), {}, {
|
|
4474
4463
|
$mode: mode,
|
|
@@ -4476,14 +4465,14 @@ const Badge = react.forwardRef(function Badge2(props, ref) {
|
|
|
4476
4465
|
$radius: useArrayProp(radius),
|
|
4477
4466
|
padding: useArrayProp(padding),
|
|
4478
4467
|
ref,
|
|
4479
|
-
children: /* @__PURE__ */
|
|
4468
|
+
children: /* @__PURE__ */jsx(Label, {
|
|
4480
4469
|
size: fontSize,
|
|
4481
4470
|
children
|
|
4482
4471
|
})
|
|
4483
4472
|
}));
|
|
4484
4473
|
});
|
|
4485
|
-
const Root$x =
|
|
4486
|
-
const Flex =
|
|
4474
|
+
const Root$x = styled(Box)(flexItemStyle, responsiveFlexStyle);
|
|
4475
|
+
const Flex = forwardRef(function Flex2(props, ref) {
|
|
4487
4476
|
const {
|
|
4488
4477
|
align,
|
|
4489
4478
|
as,
|
|
@@ -4493,7 +4482,7 @@ const Flex = react.forwardRef(function Flex2(props, ref) {
|
|
|
4493
4482
|
wrap
|
|
4494
4483
|
} = props,
|
|
4495
4484
|
restProps = _objectWithoutProperties(props, _excluded8);
|
|
4496
|
-
return /* @__PURE__ */
|
|
4485
|
+
return /* @__PURE__ */jsx(Root$x, _objectSpread(_objectSpread({
|
|
4497
4486
|
"data-ui": "Flex"
|
|
4498
4487
|
}, restProps), {}, {
|
|
4499
4488
|
$align: useArrayProp(align),
|
|
@@ -4505,14 +4494,14 @@ const Flex = react.forwardRef(function Flex2(props, ref) {
|
|
|
4505
4494
|
ref
|
|
4506
4495
|
}));
|
|
4507
4496
|
});
|
|
4508
|
-
const rotate$1 =
|
|
4509
|
-
const Root$w =
|
|
4510
|
-
const Spinner =
|
|
4511
|
-
return /* @__PURE__ */
|
|
4497
|
+
const rotate$1 = keyframes(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n from {\n transform: rotate(0deg);\n }\n\n to {\n transform: rotate(360deg);\n }\n"])));
|
|
4498
|
+
const Root$w = styled(Text)(_templateObject15 || (_templateObject15 = _taggedTemplateLiteral(["\n & > span > svg {\n animation: ", " 500ms linear infinite;\n }\n"])), rotate$1);
|
|
4499
|
+
const Spinner = forwardRef(function Spinner2(props, ref) {
|
|
4500
|
+
return /* @__PURE__ */jsx(Root$w, _objectSpread(_objectSpread({
|
|
4512
4501
|
"data-ui": "Spinner"
|
|
4513
4502
|
}, props), {}, {
|
|
4514
4503
|
ref,
|
|
4515
|
-
children: /* @__PURE__ */
|
|
4504
|
+
children: /* @__PURE__ */jsx(SpinnerIcon, {})
|
|
4516
4505
|
}));
|
|
4517
4506
|
});
|
|
4518
4507
|
function _colorVarsStyle(base, color) {
|
|
@@ -4541,7 +4530,7 @@ function _colorVarsStyle(base, color) {
|
|
|
4541
4530
|
};
|
|
4542
4531
|
}
|
|
4543
4532
|
function buttonBaseStyles() {
|
|
4544
|
-
return
|
|
4533
|
+
return css(_templateObject16 || (_templateObject16 = _taggedTemplateLiteral(["\n -webkit-font-smoothing: inherit;\n appearance: none;\n display: inline-flex;\n align-items: center;\n font: inherit;\n border: 0;\n outline: none;\n user-select: none;\n text-decoration: none;\n border: 0;\n box-sizing: border-box;\n padding: 0;\n margin: 0;\n white-space: nowrap;\n text-align: left;\n position: relative;\n\n & > span {\n display: block;\n flex: 1;\n min-width: 0;\n border-radius: inherit;\n }\n\n &::-moz-focus-inner {\n border: 0;\n padding: 0;\n }\n "])));
|
|
4545
4534
|
}
|
|
4546
4535
|
const buttonTheme = {
|
|
4547
4536
|
border: {
|
|
@@ -4588,9 +4577,9 @@ function buttonColorStyles(props) {
|
|
|
4588
4577
|
}
|
|
4589
4578
|
}, (_b = (_a = theme.sanity.styles) == null ? void 0 : _a.button) == null ? void 0 : _b.root].filter(Boolean);
|
|
4590
4579
|
}
|
|
4591
|
-
const Root$v =
|
|
4592
|
-
const LoadingBox =
|
|
4593
|
-
const Button =
|
|
4580
|
+
const Root$v = styled.button(responsiveRadiusStyle, buttonBaseStyles, buttonColorStyles);
|
|
4581
|
+
const LoadingBox = styled.div(_templateObject17 || (_templateObject17 = _taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: var(--card-bg-color);\n border-radius: inherit;\n z-index: 1;\n box-shadow: inherit;\n"])));
|
|
4582
|
+
const Button = forwardRef(function Button2(props, ref) {
|
|
4594
4583
|
const {
|
|
4595
4584
|
children,
|
|
4596
4585
|
disabled,
|
|
@@ -4627,7 +4616,7 @@ const Button = react.forwardRef(function Button2(props, ref) {
|
|
|
4627
4616
|
const radius = useArrayProp(radiusProp);
|
|
4628
4617
|
const space = useArrayProp(spaceProp);
|
|
4629
4618
|
const theme = useTheme();
|
|
4630
|
-
const boxProps =
|
|
4619
|
+
const boxProps = useMemo(() => ({
|
|
4631
4620
|
padding,
|
|
4632
4621
|
paddingX,
|
|
4633
4622
|
paddingY,
|
|
@@ -4636,7 +4625,7 @@ const Button = react.forwardRef(function Button2(props, ref) {
|
|
|
4636
4625
|
paddingLeft,
|
|
4637
4626
|
paddingRight
|
|
4638
4627
|
}), [padding, paddingX, paddingY, paddingTop, paddingBottom, paddingLeft, paddingRight]);
|
|
4639
|
-
return /* @__PURE__ */
|
|
4628
|
+
return /* @__PURE__ */jsxs(Root$v, _objectSpread(_objectSpread({
|
|
4640
4629
|
"data-ui": "Button"
|
|
4641
4630
|
}, restProps), {}, {
|
|
4642
4631
|
$mode: mode,
|
|
@@ -4647,34 +4636,34 @@ const Button = react.forwardRef(function Button2(props, ref) {
|
|
|
4647
4636
|
disabled: Boolean(loading || disabled),
|
|
4648
4637
|
ref,
|
|
4649
4638
|
type,
|
|
4650
|
-
children: [Boolean(loading) && /* @__PURE__ */
|
|
4651
|
-
children: /* @__PURE__ */
|
|
4652
|
-
}), (icon || text || iconRight) && /* @__PURE__ */
|
|
4639
|
+
children: [Boolean(loading) && /* @__PURE__ */jsx(LoadingBox, {
|
|
4640
|
+
children: /* @__PURE__ */jsx(Spinner, {})
|
|
4641
|
+
}), (icon || text || iconRight) && /* @__PURE__ */jsx(Box, _objectSpread(_objectSpread({
|
|
4653
4642
|
as: "span"
|
|
4654
4643
|
}, boxProps), {}, {
|
|
4655
|
-
children: /* @__PURE__ */
|
|
4644
|
+
children: /* @__PURE__ */jsxs(Flex, {
|
|
4656
4645
|
as: "span",
|
|
4657
4646
|
justify,
|
|
4658
|
-
children: [icon && /* @__PURE__ */
|
|
4647
|
+
children: [icon && /* @__PURE__ */jsxs(Text, {
|
|
4659
4648
|
size: fontSize,
|
|
4660
|
-
children: [
|
|
4661
|
-
}), text && /* @__PURE__ */
|
|
4649
|
+
children: [isValidElement(icon) && icon, isValidElementType(icon) && createElement(icon)]
|
|
4650
|
+
}), text && /* @__PURE__ */jsx(Box, {
|
|
4662
4651
|
flex: iconRight ? 1 : void 0,
|
|
4663
4652
|
marginLeft: icon ? space : void 0,
|
|
4664
4653
|
marginRight: iconRight ? space : void 0,
|
|
4665
|
-
children: /* @__PURE__ */
|
|
4654
|
+
children: /* @__PURE__ */jsx(Text, {
|
|
4666
4655
|
align: textAlign,
|
|
4667
4656
|
size: fontSize,
|
|
4668
4657
|
textOverflow: "ellipsis",
|
|
4669
4658
|
weight: theme.sanity.button.textWeight,
|
|
4670
4659
|
children: text
|
|
4671
4660
|
})
|
|
4672
|
-
}), iconRight && /* @__PURE__ */
|
|
4661
|
+
}), iconRight && /* @__PURE__ */jsxs(Text, {
|
|
4673
4662
|
size: fontSize,
|
|
4674
|
-
children: [
|
|
4663
|
+
children: [isValidElement(iconRight) && iconRight, isValidElementType(iconRight) && createElement(iconRight)]
|
|
4675
4664
|
})]
|
|
4676
4665
|
})
|
|
4677
|
-
})), children && /* @__PURE__ */
|
|
4666
|
+
})), children && /* @__PURE__ */jsx(Box, _objectSpread(_objectSpread({
|
|
4678
4667
|
as: "span"
|
|
4679
4668
|
}, boxProps), {}, {
|
|
4680
4669
|
children
|
|
@@ -4690,7 +4679,7 @@ function cardBaseStyle(props) {
|
|
|
4690
4679
|
theme
|
|
4691
4680
|
} = props;
|
|
4692
4681
|
const space = theme.sanity.space;
|
|
4693
|
-
return
|
|
4682
|
+
return css(_templateObject18 || (_templateObject18 = _taggedTemplateLiteral(["\n ", "\n\n &[data-as='button'] {\n -webkit-font-smoothing: inherit;\n appearance: none;\n outline: none;\n font: inherit;\n text-align: inherit;\n border: 0;\n width: stretch;\n }\n\n /* &:is(a) */\n &[data-as='a'] {\n outline: none;\n text-decoration: none;\n }\n\n /* &:is(pre) */\n &[data-as='pre'] {\n font: inherit;\n }\n "])), $checkered && css(_templateObject19 || (_templateObject19 = _taggedTemplateLiteral(["\n background-size: ", "px ", "px;\n background-position: 50% 50%;\n background-image: var(--card-bg-image);\n "])), space[3], space[3]));
|
|
4694
4683
|
}
|
|
4695
4684
|
function cardColorStyle(props) {
|
|
4696
4685
|
var _a, _b;
|
|
@@ -4711,7 +4700,7 @@ function cardColorStyle(props) {
|
|
|
4711
4700
|
width: 0,
|
|
4712
4701
|
color: "var(--card-border-color)"
|
|
4713
4702
|
};
|
|
4714
|
-
return
|
|
4703
|
+
return css(_templateObject20 || (_templateObject20 = _taggedTemplateLiteral(["\n color-scheme: ", ";\n\n ", "\n\n background-color: var(--card-bg-color);\n color: var(--card-fg-color);\n\n /* &:is(button) */\n &[data-as='button'] {\n --card-focus-ring-box-shadow: none;\n\n cursor: default;\n box-shadow: var(--card-focus-ring-box-shadow);\n\n &:disabled {\n ", "\n }\n\n &:not(:disabled) {\n &[data-pressed] {\n ", "\n }\n\n &[data-selected] {\n ", "\n }\n\n @media (hover: hover) {\n &:not([data-pressed]):not([data-selected]) {\n &:hover {\n ", "\n }\n\n &:active {\n ", "\n }\n }\n }\n\n &:focus {\n --card-focus-ring-box-shadow: ", ";\n }\n\n &:focus:not(:focus-visible) {\n --card-focus-ring-box-shadow: ", ";\n }\n }\n }\n\n /* &:is(a) */\n &[data-as='a'] {\n cursor: pointer;\n box-shadow: var(--card-focus-ring-box-shadow);\n\n &[data-disabled] {\n ", "\n }\n\n &:not([data-disabled]) {\n &[data-pressed] {\n ", "\n }\n\n &[data-selected] {\n ", "\n }\n\n @media (hover: hover) {\n &:not([data-pressed]):not([data-selected]) {\n &:hover {\n ", "\n }\n\n &:active {\n ", "\n }\n }\n }\n\n &:focus {\n --card-focus-ring-box-shadow: ", ";\n }\n\n &:focus:not(:focus-visible) {\n --card-focus-ring-box-shadow: ", ";\n }\n }\n }\n\n ", "\n "])), dark ? "dark" : "light", _colorVarsStyle(base, card.enabled, $checkered), _colorVarsStyle(base, card.disabled, $checkered), _colorVarsStyle(base, card.pressed, $checkered), _colorVarsStyle(base, card.selected, $checkered), _colorVarsStyle(base, card.hovered, $checkered), _colorVarsStyle(base, card.pressed, $checkered), $focusRing ? focusRingStyle({
|
|
4715
4704
|
base,
|
|
4716
4705
|
border,
|
|
4717
4706
|
focusRing
|
|
@@ -4721,8 +4710,8 @@ function cardColorStyle(props) {
|
|
|
4721
4710
|
focusRing
|
|
4722
4711
|
}) : void 0, $focusRing ? focusRingBorderStyle(border) : void 0, (_b = (_a = theme.sanity.styles) == null ? void 0 : _a.card) == null ? void 0 : _b.root);
|
|
4723
4712
|
}
|
|
4724
|
-
const Root$u =
|
|
4725
|
-
const Card =
|
|
4713
|
+
const Root$u = styled(Box)(responsiveBorderStyle, responsiveRadiusStyle, responsiveShadowStyle, cardStyle);
|
|
4714
|
+
const Card = forwardRef(function Card2(props, ref) {
|
|
4726
4715
|
const {
|
|
4727
4716
|
__unstable_checkered: checkered = false,
|
|
4728
4717
|
__unstable_focusRing: focusRing = false,
|
|
@@ -4740,13 +4729,13 @@ const Card = react.forwardRef(function Card2(props, ref) {
|
|
|
4740
4729
|
tone: toneProp = "default"
|
|
4741
4730
|
} = props,
|
|
4742
4731
|
restProps = _objectWithoutProperties(props, _excluded10);
|
|
4743
|
-
const as =
|
|
4732
|
+
const as = isValidElementType(asProp) ? asProp : "div";
|
|
4744
4733
|
const rootTheme = useRootTheme();
|
|
4745
4734
|
const tone = toneProp === "inherit" ? rootTheme.tone : toneProp;
|
|
4746
|
-
return /* @__PURE__ */
|
|
4735
|
+
return /* @__PURE__ */jsx(ThemeColorProvider, {
|
|
4747
4736
|
scheme,
|
|
4748
4737
|
tone,
|
|
4749
|
-
children: /* @__PURE__ */
|
|
4738
|
+
children: /* @__PURE__ */jsx(Root$u, _objectSpread(_objectSpread({
|
|
4750
4739
|
"data-as": typeof as === "string" ? as : void 0,
|
|
4751
4740
|
"data-scheme": rootTheme.scheme,
|
|
4752
4741
|
"data-ui": "Card",
|
|
@@ -4772,7 +4761,7 @@ const Card = react.forwardRef(function Card2(props, ref) {
|
|
|
4772
4761
|
});
|
|
4773
4762
|
});
|
|
4774
4763
|
function checkboxBaseStyles() {
|
|
4775
|
-
return
|
|
4764
|
+
return css(_templateObject21 || (_templateObject21 = _taggedTemplateLiteral(["\n position: relative;\n display: inline-block;\n "])));
|
|
4776
4765
|
}
|
|
4777
4766
|
function inputElementStyles(props) {
|
|
4778
4767
|
const {
|
|
@@ -4784,7 +4773,7 @@ function inputElementStyles(props) {
|
|
|
4784
4773
|
input,
|
|
4785
4774
|
radius
|
|
4786
4775
|
} = theme.sanity;
|
|
4787
|
-
return
|
|
4776
|
+
return css(_templateObject22 || (_templateObject22 = _taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n outline: none;\n opacity: 0;\n z-index: 1;\n padding: 0;\n margin: 0;\n\n & + span {\n position: relative;\n display: block;\n height: ", ";\n width: ", ";\n box-sizing: border-box;\n box-shadow: ", ";\n border-radius: ", ";\n line-height: 1;\n background-color: ", ";\n\n & > svg {\n display: block;\n position: absolute;\n opacity: 0;\n height: 100%;\n width: 100%;\n\n & > path {\n vector-effect: non-scaling-stroke;\n stroke-width: 2 !important;\n }\n }\n }\n\n &:not(:disabled):focus + span {\n box-shadow: ", ";\n }\n\n &:not(:disabled):focus:not(:focus-visible) + span {\n box-shadow: ", ";\n }\n\n &:checked + span > svg:first-child {\n opacity: 1;\n }\n\n &[data-read-only] + span {\n background-color: ", ";\n box-shadow: ", ";\n color: ", ";\n }\n\n &:not([data-read-only]):disabled + span {\n background-color: ", ";\n box-shadow: ", ";\n color: ", ";\n }\n\n &:indeterminate + span > svg:last-child {\n opacity: 1;\n }\n "])), rem(input.checkbox.size), rem(input.checkbox.size), focusRingBorderStyle({
|
|
4788
4777
|
color: color.default.enabled.border,
|
|
4789
4778
|
width: input.border.width
|
|
4790
4779
|
}), rem(radius[2]), color.default.enabled.bg, focusRingStyle({
|
|
@@ -4804,9 +4793,9 @@ function inputElementStyles(props) {
|
|
|
4804
4793
|
color: color.default.disabled.border
|
|
4805
4794
|
}), color.default.disabled.fg);
|
|
4806
4795
|
}
|
|
4807
|
-
const Root$t =
|
|
4808
|
-
const Input$5 =
|
|
4809
|
-
const Checkbox =
|
|
4796
|
+
const Root$t = styled.div(checkboxBaseStyles);
|
|
4797
|
+
const Input$5 = styled.input(inputElementStyles);
|
|
4798
|
+
const Checkbox = forwardRef(function Checkbox2(props, forwardedRef) {
|
|
4810
4799
|
const {
|
|
4811
4800
|
checked,
|
|
4812
4801
|
className,
|
|
@@ -4819,16 +4808,16 @@ const Checkbox = react.forwardRef(function Checkbox2(props, forwardedRef) {
|
|
|
4819
4808
|
restProps = _objectWithoutProperties(props, _excluded11);
|
|
4820
4809
|
const ref = useForwardedRef(forwardedRef);
|
|
4821
4810
|
useCustomValidity(ref, customValidity);
|
|
4822
|
-
|
|
4811
|
+
useEffect(() => {
|
|
4823
4812
|
if (ref.current) {
|
|
4824
4813
|
ref.current.indeterminate = indeterminate || false;
|
|
4825
4814
|
}
|
|
4826
4815
|
}, [indeterminate, ref]);
|
|
4827
|
-
return /* @__PURE__ */
|
|
4816
|
+
return /* @__PURE__ */jsxs(Root$t, {
|
|
4828
4817
|
className,
|
|
4829
4818
|
"data-ui": "Checkbox",
|
|
4830
4819
|
style,
|
|
4831
|
-
children: [/* @__PURE__ */
|
|
4820
|
+
children: [/* @__PURE__ */jsx(Input$5, _objectSpread(_objectSpread({
|
|
4832
4821
|
"data-read-only": !disabled && readOnly ? "" : void 0
|
|
4833
4822
|
}, restProps), {}, {
|
|
4834
4823
|
checked,
|
|
@@ -4836,8 +4825,8 @@ const Checkbox = react.forwardRef(function Checkbox2(props, forwardedRef) {
|
|
|
4836
4825
|
type: "checkbox",
|
|
4837
4826
|
readOnly,
|
|
4838
4827
|
ref
|
|
4839
|
-
})), /* @__PURE__ */
|
|
4840
|
-
children: [/* @__PURE__ */
|
|
4828
|
+
})), /* @__PURE__ */jsxs("span", {
|
|
4829
|
+
children: [/* @__PURE__ */jsx(CheckmarkIcon, {}), /* @__PURE__ */jsx(RemoveIcon, {})]
|
|
4841
4830
|
})]
|
|
4842
4831
|
});
|
|
4843
4832
|
});
|
|
@@ -4958,10 +4947,10 @@ function codeSyntaxHighlightingStyle(_ref20) {
|
|
|
4958
4947
|
};
|
|
4959
4948
|
}
|
|
4960
4949
|
function codeBaseStyle() {
|
|
4961
|
-
return
|
|
4950
|
+
return css(_templateObject23 || (_templateObject23 = _taggedTemplateLiteral(["\n color: var(--card-code-fg-color);\n\n & code {\n font-family: inherit;\n\n &.refractor .token {\n ", "\n }\n }\n\n & a {\n color: inherit;\n text-decoration: underline;\n border-radius: 1px;\n }\n\n & [data-sanity-icon] {\n vertical-align: baseline;\n }\n "])), codeSyntaxHighlightingStyle);
|
|
4962
4951
|
}
|
|
4963
|
-
const Root$s =
|
|
4964
|
-
const Code =
|
|
4952
|
+
const Root$s = styled.pre(codeBaseStyle, responsiveCodeFontStyle);
|
|
4953
|
+
const Code = forwardRef(function Code2(props, ref) {
|
|
4965
4954
|
const {
|
|
4966
4955
|
children,
|
|
4967
4956
|
language: languageProp,
|
|
@@ -4970,16 +4959,16 @@ const Code = react.forwardRef(function Code2(props, ref) {
|
|
|
4970
4959
|
} = props,
|
|
4971
4960
|
restProps = _objectWithoutProperties(props, _excluded12);
|
|
4972
4961
|
const language = typeof languageProp === "string" ? languageProp : void 0;
|
|
4973
|
-
const registered = language ?
|
|
4974
|
-
return /* @__PURE__ */
|
|
4962
|
+
const registered = language ? Refractor.hasLanguage(language) : false;
|
|
4963
|
+
return /* @__PURE__ */jsxs(Root$s, _objectSpread(_objectSpread({
|
|
4975
4964
|
"data-ui": "Code"
|
|
4976
4965
|
}, restProps), {}, {
|
|
4977
4966
|
$size: useArrayProp(size),
|
|
4978
4967
|
$weight: weight,
|
|
4979
4968
|
ref,
|
|
4980
|
-
children: [!(language && registered) && /* @__PURE__ */
|
|
4969
|
+
children: [!(language && registered) && /* @__PURE__ */jsx("code", {
|
|
4981
4970
|
children
|
|
4982
|
-
}), language && registered && /* @__PURE__ */
|
|
4971
|
+
}), language && registered && /* @__PURE__ */jsx(Refractor, {
|
|
4983
4972
|
inline: true,
|
|
4984
4973
|
language,
|
|
4985
4974
|
value: String(children)
|
|
@@ -5005,14 +4994,14 @@ function responsiveContainerWidthStyle(props) {
|
|
|
5005
4994
|
maxWidth: val === "auto" ? "none" : rem(container[val])
|
|
5006
4995
|
}));
|
|
5007
4996
|
}
|
|
5008
|
-
const Root$r =
|
|
5009
|
-
const Container =
|
|
4997
|
+
const Root$r = styled(Box)(containerBaseStyle, responsiveContainerWidthStyle);
|
|
4998
|
+
const Container = forwardRef(function Container2(props, ref) {
|
|
5010
4999
|
const {
|
|
5011
5000
|
as,
|
|
5012
5001
|
width = 2
|
|
5013
5002
|
} = props,
|
|
5014
5003
|
restProps = _objectWithoutProperties(props, _excluded13);
|
|
5015
|
-
return /* @__PURE__ */
|
|
5004
|
+
return /* @__PURE__ */jsx(Root$r, _objectSpread(_objectSpread({
|
|
5016
5005
|
"data-ui": "Container"
|
|
5017
5006
|
}, restProps), {}, {
|
|
5018
5007
|
$width: useArrayProp(width),
|
|
@@ -5020,8 +5009,8 @@ const Container = react.forwardRef(function Container2(props, ref) {
|
|
|
5020
5009
|
ref
|
|
5021
5010
|
}));
|
|
5022
5011
|
});
|
|
5023
|
-
const Root$q =
|
|
5024
|
-
const Grid =
|
|
5012
|
+
const Root$q = styled(Box)(responsiveGridStyle);
|
|
5013
|
+
const Grid = forwardRef(function Grid2(props, ref) {
|
|
5025
5014
|
const {
|
|
5026
5015
|
as,
|
|
5027
5016
|
autoRows,
|
|
@@ -5035,7 +5024,7 @@ const Grid = react.forwardRef(function Grid2(props, ref) {
|
|
|
5035
5024
|
children
|
|
5036
5025
|
} = props,
|
|
5037
5026
|
restProps = _objectWithoutProperties(props, _excluded14);
|
|
5038
|
-
return /* @__PURE__ */
|
|
5027
|
+
return /* @__PURE__ */jsx(Root$q, _objectSpread(_objectSpread({
|
|
5039
5028
|
"data-as": typeof as === "string" ? as : void 0,
|
|
5040
5029
|
"data-ui": "Grid"
|
|
5041
5030
|
}, restProps), {}, {
|
|
@@ -5058,11 +5047,11 @@ function headingBaseStyle(props) {
|
|
|
5058
5047
|
$muted,
|
|
5059
5048
|
theme
|
|
5060
5049
|
} = props;
|
|
5061
|
-
return
|
|
5050
|
+
return css(_templateObject24 || (_templateObject24 = _taggedTemplateLiteral(["\n ", "\n\n ", "\n\n & code {\n font-family: ", ";\n border-radius: 1px;\n }\n\n & a {\n text-decoration: none;\n border-radius: 1px;\n color: var(--card-link-color);\n outline: none;\n\n @media (hover: hover) {\n &:hover {\n text-decoration: underline;\n }\n }\n\n &:focus {\n box-shadow: 0 0 0 1px var(--card-bg-color), 0 0 0 3px var(--card-focus-ring-color);\n }\n\n &:focus:not(:focus-visible) {\n box-shadow: none;\n }\n }\n\n & [data-sanity-icon] {\n vertical-align: baseline;\n }\n "])), $accent && css(_templateObject25 || (_templateObject25 = _taggedTemplateLiteral(["\n color: var(--card-accent-fg-color);\n "]))), $muted && css(_templateObject26 || (_templateObject26 = _taggedTemplateLiteral(["\n color: var(--card-muted-fg-color);\n "]))), theme.sanity.fonts.code.family);
|
|
5062
5051
|
}
|
|
5063
|
-
const Root$p =
|
|
5064
|
-
const SpanWithTextOverflow =
|
|
5065
|
-
const Heading =
|
|
5052
|
+
const Root$p = styled.div(headingBaseStyle, responsiveTextAlignStyle, responsiveHeadingFont);
|
|
5053
|
+
const SpanWithTextOverflow = styled.span(_templateObject27 || (_templateObject27 = _taggedTemplateLiteral(["\n display: block;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n"])));
|
|
5054
|
+
const Heading = forwardRef(function Heading2(props, ref) {
|
|
5066
5055
|
const {
|
|
5067
5056
|
accent = false,
|
|
5068
5057
|
align,
|
|
@@ -5075,11 +5064,11 @@ const Heading = react.forwardRef(function Heading2(props, ref) {
|
|
|
5075
5064
|
restProps = _objectWithoutProperties(props, _excluded15);
|
|
5076
5065
|
let children = childrenProp;
|
|
5077
5066
|
if (textOverflow === "ellipsis") {
|
|
5078
|
-
children = /* @__PURE__ */
|
|
5067
|
+
children = /* @__PURE__ */jsx(SpanWithTextOverflow, {
|
|
5079
5068
|
children
|
|
5080
5069
|
});
|
|
5081
5070
|
}
|
|
5082
|
-
return /* @__PURE__ */
|
|
5071
|
+
return /* @__PURE__ */jsx(Root$p, _objectSpread(_objectSpread({
|
|
5083
5072
|
"data-ui": "Heading"
|
|
5084
5073
|
}, restProps), {}, {
|
|
5085
5074
|
$accent: accent,
|
|
@@ -5088,7 +5077,7 @@ const Heading = react.forwardRef(function Heading2(props, ref) {
|
|
|
5088
5077
|
$size: useArrayProp(size),
|
|
5089
5078
|
$weight: weight,
|
|
5090
5079
|
ref,
|
|
5091
|
-
children: /* @__PURE__ */
|
|
5080
|
+
children: /* @__PURE__ */jsx("span", {
|
|
5092
5081
|
children
|
|
5093
5082
|
})
|
|
5094
5083
|
}));
|
|
@@ -5119,18 +5108,18 @@ function inlineSpaceStyle(props) {
|
|
|
5119
5108
|
};
|
|
5120
5109
|
});
|
|
5121
5110
|
}
|
|
5122
|
-
const Root$o =
|
|
5123
|
-
const Inline =
|
|
5111
|
+
const Root$o = styled(Box)(inlineBaseStyle, inlineSpaceStyle);
|
|
5112
|
+
const Inline = forwardRef(function Inline2(props, ref) {
|
|
5124
5113
|
const {
|
|
5125
5114
|
as,
|
|
5126
5115
|
children: childrenProp,
|
|
5127
5116
|
space
|
|
5128
5117
|
} = props,
|
|
5129
5118
|
restProps = _objectWithoutProperties(props, _excluded16);
|
|
5130
|
-
const children =
|
|
5119
|
+
const children = useMemo(() => childrenToElementArray(childrenProp).filter(Boolean).map((child, idx) => /* @__PURE__ */jsx("div", {
|
|
5131
5120
|
children: child
|
|
5132
5121
|
}, idx)), [childrenProp]);
|
|
5133
|
-
return /* @__PURE__ */
|
|
5122
|
+
return /* @__PURE__ */jsx(Root$o, _objectSpread(_objectSpread({
|
|
5134
5123
|
"data-ui": "Inline"
|
|
5135
5124
|
}, restProps), {}, {
|
|
5136
5125
|
$space: useArrayProp(space),
|
|
@@ -5140,10 +5129,10 @@ const Inline = react.forwardRef(function Inline2(props, ref) {
|
|
|
5140
5129
|
}));
|
|
5141
5130
|
});
|
|
5142
5131
|
function kbdStyle() {
|
|
5143
|
-
return
|
|
5132
|
+
return css(_templateObject28 || (_templateObject28 = _taggedTemplateLiteral(["\n background: var(--card-bg-color);\n font: inherit;\n box-shadow: inset 0 0 0 1px var(--card-hairline-hard-color);\n\n &:not([hidden]) {\n display: inline-block;\n }\n "])));
|
|
5144
5133
|
}
|
|
5145
|
-
const Root$n =
|
|
5146
|
-
const KBD =
|
|
5134
|
+
const Root$n = styled.kbd(responsiveRadiusStyle, kbdStyle);
|
|
5135
|
+
const KBD = forwardRef(function KBD2(props, ref) {
|
|
5147
5136
|
const {
|
|
5148
5137
|
children,
|
|
5149
5138
|
fontSize = 1,
|
|
@@ -5151,15 +5140,15 @@ const KBD = react.forwardRef(function KBD2(props, ref) {
|
|
|
5151
5140
|
radius = 2
|
|
5152
5141
|
} = props,
|
|
5153
5142
|
restProps = _objectWithoutProperties(props, _excluded17);
|
|
5154
|
-
return /* @__PURE__ */
|
|
5143
|
+
return /* @__PURE__ */jsx(Root$n, _objectSpread(_objectSpread({
|
|
5155
5144
|
"data-ui": "KBD"
|
|
5156
5145
|
}, restProps), {}, {
|
|
5157
5146
|
$radius: useArrayProp(radius),
|
|
5158
5147
|
ref,
|
|
5159
|
-
children: /* @__PURE__ */
|
|
5148
|
+
children: /* @__PURE__ */jsx(Box, {
|
|
5160
5149
|
as: "span",
|
|
5161
5150
|
padding,
|
|
5162
|
-
children: /* @__PURE__ */
|
|
5151
|
+
children: /* @__PURE__ */jsx(Code, {
|
|
5163
5152
|
as: "span",
|
|
5164
5153
|
muted: true,
|
|
5165
5154
|
size: fontSize,
|
|
@@ -5169,18 +5158,18 @@ const KBD = react.forwardRef(function KBD2(props, ref) {
|
|
|
5169
5158
|
}));
|
|
5170
5159
|
});
|
|
5171
5160
|
const key$6 = Symbol.for("@sanity/ui/context/boundaryElement");
|
|
5172
|
-
globalScope[key$6] = globalScope[key$6] ||
|
|
5161
|
+
globalScope[key$6] = globalScope[key$6] || createContext(null);
|
|
5173
5162
|
const BoundaryElementContext = globalScope[key$6];
|
|
5174
5163
|
function BoundaryElementProvider(props) {
|
|
5175
5164
|
const {
|
|
5176
5165
|
children,
|
|
5177
5166
|
element
|
|
5178
5167
|
} = props;
|
|
5179
|
-
const value =
|
|
5168
|
+
const value = useMemo(() => ({
|
|
5180
5169
|
version: 0,
|
|
5181
5170
|
element
|
|
5182
5171
|
}), [element]);
|
|
5183
|
-
return /* @__PURE__ */
|
|
5172
|
+
return /* @__PURE__ */jsx(BoundaryElementContext.Provider, {
|
|
5184
5173
|
value,
|
|
5185
5174
|
children
|
|
5186
5175
|
});
|
|
@@ -5190,7 +5179,7 @@ const DEFAULT_VALUE = {
|
|
|
5190
5179
|
element: null
|
|
5191
5180
|
};
|
|
5192
5181
|
function useBoundaryElement() {
|
|
5193
|
-
const value =
|
|
5182
|
+
const value = useContext(BoundaryElementContext);
|
|
5194
5183
|
if (value && (!isRecord(value) || value.version !== 0)) {
|
|
5195
5184
|
throw new Error("useBoundaryElement(): the context value is not compatible");
|
|
5196
5185
|
}
|
|
@@ -5216,7 +5205,7 @@ function findMinBreakpoints(media, width) {
|
|
|
5216
5205
|
}
|
|
5217
5206
|
return ret;
|
|
5218
5207
|
}
|
|
5219
|
-
const ElementQuery =
|
|
5208
|
+
const ElementQuery = forwardRef(function ElementQuery2(props, ref) {
|
|
5220
5209
|
const theme = useTheme();
|
|
5221
5210
|
const {
|
|
5222
5211
|
children,
|
|
@@ -5224,19 +5213,19 @@ const ElementQuery = react.forwardRef(function ElementQuery2(props, ref) {
|
|
|
5224
5213
|
} = props,
|
|
5225
5214
|
restProps = _objectWithoutProperties(props, _excluded18);
|
|
5226
5215
|
const forwardedRef = useForwardedRef(ref);
|
|
5227
|
-
const [element, setElement] =
|
|
5216
|
+
const [element, setElement] = useState(null);
|
|
5228
5217
|
const elementSize = useElementSize(element);
|
|
5229
|
-
const width =
|
|
5218
|
+
const width = useMemo(() => {
|
|
5230
5219
|
var _a;
|
|
5231
5220
|
return (_a = elementSize == null ? void 0 : elementSize.border.width) != null ? _a : window.innerWidth;
|
|
5232
5221
|
}, [elementSize]);
|
|
5233
|
-
const max =
|
|
5234
|
-
const min =
|
|
5235
|
-
const setRef =
|
|
5222
|
+
const max = useMemo(() => findMaxBreakpoints(media, width), [media, width]);
|
|
5223
|
+
const min = useMemo(() => findMinBreakpoints(media, width), [media, width]);
|
|
5224
|
+
const setRef = useCallback(el => {
|
|
5236
5225
|
forwardedRef.current = el;
|
|
5237
5226
|
setElement(el);
|
|
5238
5227
|
}, [forwardedRef]);
|
|
5239
|
-
return /* @__PURE__ */
|
|
5228
|
+
return /* @__PURE__ */jsx("div", _objectSpread(_objectSpread({
|
|
5240
5229
|
"data-ui": "ElementQuery"
|
|
5241
5230
|
}, restProps), {}, {
|
|
5242
5231
|
"data-eq-max": max.length ? max.join(" ") : void 0,
|
|
@@ -5245,7 +5234,7 @@ const ElementQuery = react.forwardRef(function ElementQuery2(props, ref) {
|
|
|
5245
5234
|
children
|
|
5246
5235
|
}));
|
|
5247
5236
|
});
|
|
5248
|
-
class ErrorBoundary extends
|
|
5237
|
+
class ErrorBoundary extends Component {
|
|
5249
5238
|
constructor() {
|
|
5250
5239
|
super(...arguments);
|
|
5251
5240
|
this.state = {
|
|
@@ -5269,7 +5258,7 @@ class ErrorBoundary extends react.Component {
|
|
|
5269
5258
|
} = this.state;
|
|
5270
5259
|
if (error) {
|
|
5271
5260
|
const message = typeof (error == null ? void 0 : error.message) === "string" ? error.message : "Error";
|
|
5272
|
-
return /* @__PURE__ */
|
|
5261
|
+
return /* @__PURE__ */jsx(Code, {
|
|
5273
5262
|
children: message
|
|
5274
5263
|
});
|
|
5275
5264
|
}
|
|
@@ -5277,10 +5266,10 @@ class ErrorBoundary extends react.Component {
|
|
|
5277
5266
|
}
|
|
5278
5267
|
}
|
|
5279
5268
|
const key$5 = Symbol.for("@sanity/ui/context/layer");
|
|
5280
|
-
globalScope[key$5] = globalScope[key$5] ||
|
|
5269
|
+
globalScope[key$5] = globalScope[key$5] || createContext(null);
|
|
5281
5270
|
const LayerContext = globalScope[key$5];
|
|
5282
5271
|
function useLayer() {
|
|
5283
|
-
const value =
|
|
5272
|
+
const value = useContext(LayerContext);
|
|
5284
5273
|
if (!value) {
|
|
5285
5274
|
throw new Error("useLayer(): missing context value");
|
|
5286
5275
|
}
|
|
@@ -5294,35 +5283,35 @@ function LayerProvider(props) {
|
|
|
5294
5283
|
children,
|
|
5295
5284
|
zOffset: zOffsetProp = 0
|
|
5296
5285
|
} = props;
|
|
5297
|
-
const parent =
|
|
5286
|
+
const parent = useContext(LayerContext);
|
|
5298
5287
|
const zOffset = useArrayProp(zOffsetProp);
|
|
5299
5288
|
const maxMediaIndex = zOffset.length - 1;
|
|
5300
5289
|
const mediaIndex = Math.min(useMediaIndex(), maxMediaIndex);
|
|
5301
5290
|
const zIndex = parent ? parent.zIndex + zOffset[mediaIndex] : zOffset[mediaIndex];
|
|
5302
|
-
const [size, setSize] =
|
|
5303
|
-
const registerChild =
|
|
5291
|
+
const [size, setSize] = useState(0);
|
|
5292
|
+
const registerChild = useCallback(() => {
|
|
5304
5293
|
setSize(v => v + 1);
|
|
5305
5294
|
return () => setSize(v => v - 1);
|
|
5306
5295
|
}, []);
|
|
5307
5296
|
const parentRegisterChild = parent == null ? void 0 : parent.registerChild;
|
|
5308
|
-
|
|
5297
|
+
useEffect(() => {
|
|
5309
5298
|
if (!parentRegisterChild) return;
|
|
5310
5299
|
return parentRegisterChild();
|
|
5311
5300
|
}, [parentRegisterChild]);
|
|
5312
|
-
const value =
|
|
5301
|
+
const value = useMemo(() => ({
|
|
5313
5302
|
version: 0,
|
|
5314
5303
|
isTopLayer: size === 0,
|
|
5315
5304
|
registerChild,
|
|
5316
5305
|
size,
|
|
5317
5306
|
zIndex
|
|
5318
5307
|
}), [size, registerChild, zIndex]);
|
|
5319
|
-
return /* @__PURE__ */
|
|
5308
|
+
return /* @__PURE__ */jsx(LayerContext.Provider, {
|
|
5320
5309
|
value,
|
|
5321
5310
|
children
|
|
5322
5311
|
});
|
|
5323
5312
|
}
|
|
5324
|
-
const Root$m =
|
|
5325
|
-
const LayerChildren =
|
|
5313
|
+
const Root$m = styled.div(_templateObject29 || (_templateObject29 = _taggedTemplateLiteral(["\n position: relative;\n"])));
|
|
5314
|
+
const LayerChildren = forwardRef(function LayerChildren2(props, ref) {
|
|
5326
5315
|
const {
|
|
5327
5316
|
children,
|
|
5328
5317
|
style = EMPTY_RECORD
|
|
@@ -5331,7 +5320,7 @@ const LayerChildren = react.forwardRef(function LayerChildren2(props, ref) {
|
|
|
5331
5320
|
const {
|
|
5332
5321
|
zIndex
|
|
5333
5322
|
} = useLayer();
|
|
5334
|
-
return /* @__PURE__ */
|
|
5323
|
+
return /* @__PURE__ */jsx(Root$m, _objectSpread(_objectSpread({}, restProps), {}, {
|
|
5335
5324
|
"data-ui": "Layer",
|
|
5336
5325
|
ref,
|
|
5337
5326
|
style: _objectSpread(_objectSpread({}, style), {}, {
|
|
@@ -5340,15 +5329,15 @@ const LayerChildren = react.forwardRef(function LayerChildren2(props, ref) {
|
|
|
5340
5329
|
children
|
|
5341
5330
|
}));
|
|
5342
5331
|
});
|
|
5343
|
-
const Layer =
|
|
5332
|
+
const Layer = forwardRef(function Layer2(props, ref) {
|
|
5344
5333
|
const {
|
|
5345
5334
|
children,
|
|
5346
5335
|
zOffset = 1
|
|
5347
5336
|
} = props,
|
|
5348
5337
|
restProps = _objectWithoutProperties(props, _excluded20);
|
|
5349
|
-
return /* @__PURE__ */
|
|
5338
|
+
return /* @__PURE__ */jsx(LayerProvider, {
|
|
5350
5339
|
zOffset,
|
|
5351
|
-
children: /* @__PURE__ */
|
|
5340
|
+
children: /* @__PURE__ */jsx(LayerChildren, _objectSpread(_objectSpread({}, restProps), {}, {
|
|
5352
5341
|
ref,
|
|
5353
5342
|
children
|
|
5354
5343
|
}))
|
|
@@ -5373,10 +5362,10 @@ const defaultContextValue = {
|
|
|
5373
5362
|
return globalScope[elementKey];
|
|
5374
5363
|
}
|
|
5375
5364
|
};
|
|
5376
|
-
globalScope[key$4] = globalScope[key$4] ||
|
|
5365
|
+
globalScope[key$4] = globalScope[key$4] || createContext(defaultContextValue);
|
|
5377
5366
|
const PortalContext = globalScope[key$4];
|
|
5378
5367
|
function usePortal() {
|
|
5379
|
-
const value =
|
|
5368
|
+
const value = useContext(PortalContext);
|
|
5380
5369
|
if (!value) {
|
|
5381
5370
|
throw new Error("usePortal(): missing context value");
|
|
5382
5371
|
}
|
|
@@ -5396,10 +5385,10 @@ function Portal(props) {
|
|
|
5396
5385
|
if (!portalElement) {
|
|
5397
5386
|
return null;
|
|
5398
5387
|
}
|
|
5399
|
-
return
|
|
5388
|
+
return createPortal(children, portalElement);
|
|
5400
5389
|
}
|
|
5401
5390
|
function useUnique(value) {
|
|
5402
|
-
const valueRef =
|
|
5391
|
+
const valueRef = useRef(value);
|
|
5403
5392
|
if (!_isEqual(valueRef.current, value)) {
|
|
5404
5393
|
valueRef.current = value;
|
|
5405
5394
|
}
|
|
@@ -5425,7 +5414,7 @@ function PortalProvider(props) {
|
|
|
5425
5414
|
__unstable_elements: elementsProp
|
|
5426
5415
|
} = props;
|
|
5427
5416
|
const elements = useUnique(elementsProp);
|
|
5428
|
-
const value =
|
|
5417
|
+
const value = useMemo(() => {
|
|
5429
5418
|
return {
|
|
5430
5419
|
version: 0,
|
|
5431
5420
|
boundaryElement: boundaryElement || null,
|
|
@@ -5433,18 +5422,18 @@ function PortalProvider(props) {
|
|
|
5433
5422
|
elements
|
|
5434
5423
|
};
|
|
5435
5424
|
}, [boundaryElement, element, elements]);
|
|
5436
|
-
return /* @__PURE__ */
|
|
5425
|
+
return /* @__PURE__ */jsx(PortalContext.Provider, {
|
|
5437
5426
|
value,
|
|
5438
5427
|
children
|
|
5439
5428
|
});
|
|
5440
5429
|
}
|
|
5441
|
-
const Root$l =
|
|
5442
|
-
const SrOnly =
|
|
5430
|
+
const Root$l = styled.div(_templateObject30 || (_templateObject30 = _taggedTemplateLiteral(["\n display: block;\n width: 0;\n height: 0;\n position: absolute;\n overflow: hidden;\n"])));
|
|
5431
|
+
const SrOnly = forwardRef(function SrOnly2(props, ref) {
|
|
5443
5432
|
const {
|
|
5444
5433
|
as,
|
|
5445
5434
|
children
|
|
5446
5435
|
} = props;
|
|
5447
|
-
return /* @__PURE__ */
|
|
5436
|
+
return /* @__PURE__ */jsx(Root$l, {
|
|
5448
5437
|
"aria-hidden": true,
|
|
5449
5438
|
as,
|
|
5450
5439
|
"data-ui": "SrOnly",
|
|
@@ -5539,9 +5528,9 @@ function _isScrollable(el) {
|
|
|
5539
5528
|
const style = window.getComputedStyle(el);
|
|
5540
5529
|
return style.overflowX.includes("auto") || style.overflowX.includes("scroll") || style.overflowY.includes("auto") || style.overflowY.includes("scroll");
|
|
5541
5530
|
}
|
|
5542
|
-
const Root$k =
|
|
5543
|
-
const ItemWrapper =
|
|
5544
|
-
const VirtualList =
|
|
5531
|
+
const Root$k = styled.div(_templateObject31 || (_templateObject31 = _taggedTemplateLiteral(["\n position: relative;\n"])));
|
|
5532
|
+
const ItemWrapper = styled.div(_templateObject32 || (_templateObject32 = _taggedTemplateLiteral(["\n position: absolute;\n left: 0;\n right: 0;\n"])));
|
|
5533
|
+
const VirtualList = forwardRef(function VirtualList2(props, ref) {
|
|
5545
5534
|
const {
|
|
5546
5535
|
as = "div",
|
|
5547
5536
|
gap = 0,
|
|
@@ -5555,18 +5544,18 @@ const VirtualList = react.forwardRef(function VirtualList2(props, ref) {
|
|
|
5555
5544
|
space
|
|
5556
5545
|
} = useTheme().sanity;
|
|
5557
5546
|
const forwardedRef = useForwardedRef(ref);
|
|
5558
|
-
const wrapperRef =
|
|
5559
|
-
const [scrollTop, setScrollTop] =
|
|
5560
|
-
const [scrollHeight, setScrollHeight] =
|
|
5561
|
-
const [itemHeight, setItemHeight] =
|
|
5562
|
-
|
|
5547
|
+
const wrapperRef = useRef(null);
|
|
5548
|
+
const [scrollTop, setScrollTop] = useState(0);
|
|
5549
|
+
const [scrollHeight, setScrollHeight] = useState(0);
|
|
5550
|
+
const [itemHeight, setItemHeight] = useState(-1);
|
|
5551
|
+
useEffect(() => {
|
|
5563
5552
|
if (!wrapperRef.current) return;
|
|
5564
5553
|
const firstElement = wrapperRef.current.firstChild;
|
|
5565
5554
|
if (firstElement instanceof HTMLElement) {
|
|
5566
5555
|
setItemHeight(firstElement.offsetHeight);
|
|
5567
5556
|
}
|
|
5568
5557
|
}, [renderItem]);
|
|
5569
|
-
|
|
5558
|
+
useEffect(() => {
|
|
5570
5559
|
if (!forwardedRef.current) return;
|
|
5571
5560
|
let _scrollEl = forwardedRef.current.parentNode;
|
|
5572
5561
|
while (_scrollEl && !_isScrollable(_scrollEl)) {
|
|
@@ -5613,7 +5602,7 @@ const VirtualList = react.forwardRef(function VirtualList2(props, ref) {
|
|
|
5613
5602
|
const height = itemHeight ? len * (itemHeight + space[gap]) - space[gap] : 0;
|
|
5614
5603
|
const fromIndex = height ? Math.max(Math.floor(scrollTop / height * len) - 2, 0) : 0;
|
|
5615
5604
|
const toIndex = height ? Math.ceil((scrollTop + scrollHeight) / height * len) + 1 : 0;
|
|
5616
|
-
|
|
5605
|
+
useEffect(() => {
|
|
5617
5606
|
if (!onChange) return;
|
|
5618
5607
|
onChange({
|
|
5619
5608
|
fromIndex,
|
|
@@ -5624,10 +5613,10 @@ const VirtualList = react.forwardRef(function VirtualList2(props, ref) {
|
|
|
5624
5613
|
toIndex
|
|
5625
5614
|
});
|
|
5626
5615
|
}, [fromIndex, gap, itemHeight, onChange, scrollHeight, scrollTop, space, toIndex]);
|
|
5627
|
-
const children =
|
|
5616
|
+
const children = useMemo(() => {
|
|
5628
5617
|
if (!renderItem || items.length === 0) return null;
|
|
5629
5618
|
if (itemHeight === -1) {
|
|
5630
|
-
return [/* @__PURE__ */
|
|
5619
|
+
return [/* @__PURE__ */jsx(ItemWrapper, {
|
|
5631
5620
|
children: renderItem(items[0])
|
|
5632
5621
|
}, 0)];
|
|
5633
5622
|
}
|
|
@@ -5635,7 +5624,7 @@ const VirtualList = react.forwardRef(function VirtualList2(props, ref) {
|
|
|
5635
5624
|
const itemIndex = fromIndex + _itemIndex;
|
|
5636
5625
|
const node = renderItem(item);
|
|
5637
5626
|
const key = getItemKey ? getItemKey(item, itemIndex) : itemIndex;
|
|
5638
|
-
return /* @__PURE__ */
|
|
5627
|
+
return /* @__PURE__ */jsx(ItemWrapper, {
|
|
5639
5628
|
style: {
|
|
5640
5629
|
top: itemIndex * (itemHeight + space[gap])
|
|
5641
5630
|
},
|
|
@@ -5643,15 +5632,15 @@ const VirtualList = react.forwardRef(function VirtualList2(props, ref) {
|
|
|
5643
5632
|
}, key);
|
|
5644
5633
|
});
|
|
5645
5634
|
}, [fromIndex, gap, getItemKey, itemHeight, items, renderItem, space, toIndex]);
|
|
5646
|
-
const wrapperStyle =
|
|
5635
|
+
const wrapperStyle = useMemo(() => ({
|
|
5647
5636
|
height
|
|
5648
5637
|
}), [height]);
|
|
5649
|
-
return /* @__PURE__ */
|
|
5638
|
+
return /* @__PURE__ */jsx(Root$k, _objectSpread(_objectSpread({
|
|
5650
5639
|
as,
|
|
5651
5640
|
"data-ui": "VirtualList"
|
|
5652
5641
|
}, restProps), {}, {
|
|
5653
5642
|
ref: forwardedRef,
|
|
5654
|
-
children: /* @__PURE__ */
|
|
5643
|
+
children: /* @__PURE__ */jsx("div", {
|
|
5655
5644
|
ref: wrapperRef,
|
|
5656
5645
|
style: wrapperStyle,
|
|
5657
5646
|
children
|
|
@@ -5682,7 +5671,7 @@ function size(options) {
|
|
|
5682
5671
|
floating,
|
|
5683
5672
|
reference
|
|
5684
5673
|
} = rects;
|
|
5685
|
-
const overflow = await
|
|
5674
|
+
const overflow = await detectOverflow(args, {
|
|
5686
5675
|
altBoundary: true,
|
|
5687
5676
|
boundary: options.boundaryElement || void 0,
|
|
5688
5677
|
elementContext: "floating",
|
|
@@ -5729,23 +5718,23 @@ function size(options) {
|
|
|
5729
5718
|
}
|
|
5730
5719
|
};
|
|
5731
5720
|
}
|
|
5732
|
-
const Root$j =
|
|
5733
|
-
const BorderPath =
|
|
5734
|
-
const ShapePath =
|
|
5735
|
-
const PopoverArrow =
|
|
5736
|
-
return /* @__PURE__ */
|
|
5721
|
+
const Root$j = styled.div(_templateObject33 || (_templateObject33 = _taggedTemplateLiteral(["\n position: absolute;\n pointer-events: none;\n width: ", "px;\n height: ", "px;\n fill: none;\n\n :empty + & {\n display: none;\n }\n\n & > svg {\n display: block;\n transform-origin: ", "px ", "px;\n }\n\n [data-placement^='top'] > & {\n bottom: -", "px;\n }\n\n [data-placement^='right'] > & {\n left: -", "px;\n\n & > svg {\n transform: rotate(90deg);\n }\n }\n\n [data-placement^='left'] > & {\n right: -", "px;\n\n & > svg {\n transform: rotate(-90deg);\n }\n }\n\n [data-placement^='bottom'] > & {\n top: -", "px;\n\n & > svg {\n transform: rotate(180deg);\n }\n }\n"])), DEFAULT_POPOVER_ARROW_WIDTH, DEFAULT_POPOVER_ARROW_WIDTH, DEFAULT_POPOVER_ARROW_WIDTH / 2, DEFAULT_POPOVER_ARROW_WIDTH / 2, DEFAULT_POPOVER_ARROW_WIDTH, DEFAULT_POPOVER_ARROW_WIDTH, DEFAULT_POPOVER_ARROW_WIDTH, DEFAULT_POPOVER_ARROW_WIDTH);
|
|
5722
|
+
const BorderPath = styled.path(_templateObject34 || (_templateObject34 = _taggedTemplateLiteral(["\n fill: var(--card-shadow-outline-color);\n"])));
|
|
5723
|
+
const ShapePath = styled.path(_templateObject35 || (_templateObject35 = _taggedTemplateLiteral(["\n fill: var(--card-bg-color);\n"])));
|
|
5724
|
+
const PopoverArrow = forwardRef(function PopoverArrow2(props, ref) {
|
|
5725
|
+
return /* @__PURE__ */jsx(Root$j, _objectSpread(_objectSpread({
|
|
5737
5726
|
"data-ui": "Popover__arrow"
|
|
5738
5727
|
}, props), {}, {
|
|
5739
5728
|
ref,
|
|
5740
|
-
children: /* @__PURE__ */
|
|
5729
|
+
children: /* @__PURE__ */jsxs("svg", {
|
|
5741
5730
|
width: DEFAULT_POPOVER_ARROW_WIDTH,
|
|
5742
5731
|
height: DEFAULT_POPOVER_ARROW_HEIGHT,
|
|
5743
5732
|
viewBox: "0 0 27 11",
|
|
5744
5733
|
fill: "none",
|
|
5745
5734
|
xmlns: "http://www.w3.org/2000/svg",
|
|
5746
|
-
children: [/* @__PURE__ */
|
|
5735
|
+
children: [/* @__PURE__ */jsx(BorderPath, {
|
|
5747
5736
|
d: "M1.18708 1C3.29803 1.0011 5.29585 1.95479 6.62414 3.59561L11.1683 9.20895C12.369 10.6922 14.631 10.6922 15.8317 9.20894L20.3759 3.59561C21.7042 1.95478 23.702 1.0011 25.8129 1H21.9436C21.0533 1.49255 20.2545 2.15618 19.5986 2.96641L15.0545 8.57975C14.254 9.56855 12.746 9.56855 11.9455 8.57975L7.40139 2.96642C6.74548 2.15618 5.94673 1.49255 5.05643 1H1.18708Z"
|
|
5748
|
-
}), /* @__PURE__ */
|
|
5737
|
+
}), /* @__PURE__ */jsx(ShapePath, {
|
|
5749
5738
|
d: "M1.18342 0C3.59749 0 5.88246 1.0901 7.40138 2.96642L11.9455 8.57975C12.746 9.56855 14.254 9.56855 15.0545 8.57975L19.5986 2.96641C21.1175 1.0901 23.4025 0 25.8166 0H27H0H1.18342Z"
|
|
5750
5739
|
})]
|
|
5751
5740
|
})
|
|
@@ -5765,9 +5754,9 @@ function popoverCardStyle(props) {
|
|
|
5765
5754
|
maxWidth: typeof $boundaryWidth === "number" ? "".concat($boundaryWidth - DEFAULT_POPOVER_PADDING * 2, "px") : void 0
|
|
5766
5755
|
};
|
|
5767
5756
|
}
|
|
5768
|
-
const Root$i =
|
|
5769
|
-
const PopoverContainer =
|
|
5770
|
-
const PopoverCard =
|
|
5757
|
+
const Root$i = memo(styled(Card)(popoverCardStyle));
|
|
5758
|
+
const PopoverContainer = memo(styled(Container)(_templateObject36 || (_templateObject36 = _taggedTemplateLiteral(["\n max-height: inherit;\n max-width: inherit;\n"]))));
|
|
5759
|
+
const PopoverCard = memo(forwardRef(function PopoverCard2(props, ref) {
|
|
5771
5760
|
const {
|
|
5772
5761
|
__unstable_margins: marginsProp,
|
|
5773
5762
|
arrow,
|
|
@@ -5793,17 +5782,17 @@ const PopoverCard = react.memo(react.forwardRef(function PopoverCard2(props, ref
|
|
|
5793
5782
|
const {
|
|
5794
5783
|
zIndex
|
|
5795
5784
|
} = useLayer();
|
|
5796
|
-
const margins =
|
|
5785
|
+
const margins = useMemo(() => marginsProp || DEFAULT_POPOVER_MARGINS, [marginsProp]);
|
|
5797
5786
|
const x = (xProp != null ? xProp : 0) + margins[3];
|
|
5798
5787
|
const y = (yProp != null ? yProp : 0) + margins[0];
|
|
5799
|
-
const rootStyle =
|
|
5788
|
+
const rootStyle = useMemo(() => _objectSpread({
|
|
5800
5789
|
position: strategy,
|
|
5801
5790
|
top: y,
|
|
5802
5791
|
left: x,
|
|
5803
5792
|
zIndex
|
|
5804
5793
|
}, style), [strategy, style, x, y, zIndex]);
|
|
5805
5794
|
const staticSide = placement && FLOATING_STATIC_SIDES[placement.split("-")[0]];
|
|
5806
|
-
const arrowStyle =
|
|
5795
|
+
const arrowStyle = useMemo(() => {
|
|
5807
5796
|
const style2 = {
|
|
5808
5797
|
left: arrowX !== null ? arrowX : void 0,
|
|
5809
5798
|
top: arrowY !== null ? arrowY : void 0,
|
|
@@ -5813,7 +5802,7 @@ const PopoverCard = react.memo(react.forwardRef(function PopoverCard2(props, ref
|
|
|
5813
5802
|
if (staticSide) style2[staticSide] = 0 - DEFAULT_POPOVER_ARROW_WIDTH;
|
|
5814
5803
|
return style2;
|
|
5815
5804
|
}, [arrowX, arrowY, staticSide]);
|
|
5816
|
-
return /* @__PURE__ */
|
|
5805
|
+
return /* @__PURE__ */jsxs(Root$i, _objectSpread(_objectSpread({}, restProps), {}, {
|
|
5817
5806
|
$boundaryWidth: boundaryWidth,
|
|
5818
5807
|
"data-placement": placement,
|
|
5819
5808
|
"data-ui": "Popover",
|
|
@@ -5824,7 +5813,7 @@ const PopoverCard = react.memo(react.forwardRef(function PopoverCard2(props, ref
|
|
|
5824
5813
|
sizing: "border",
|
|
5825
5814
|
style: rootStyle,
|
|
5826
5815
|
tone,
|
|
5827
|
-
children: [/* @__PURE__ */
|
|
5816
|
+
children: [/* @__PURE__ */jsx(PopoverContainer, {
|
|
5828
5817
|
"data-ui": "Popover__wrapper",
|
|
5829
5818
|
flex: 1,
|
|
5830
5819
|
overflow,
|
|
@@ -5832,14 +5821,14 @@ const PopoverCard = react.memo(react.forwardRef(function PopoverCard2(props, ref
|
|
|
5832
5821
|
sizing: "border",
|
|
5833
5822
|
width,
|
|
5834
5823
|
children
|
|
5835
|
-
}), arrow && /* @__PURE__ */
|
|
5824
|
+
}), arrow && /* @__PURE__ */jsx(PopoverArrow, {
|
|
5836
5825
|
ref: arrowRef,
|
|
5837
5826
|
style: arrowStyle
|
|
5838
5827
|
})]
|
|
5839
5828
|
}));
|
|
5840
5829
|
}));
|
|
5841
5830
|
PopoverCard.displayName = "PopoverCard";
|
|
5842
|
-
const Popover =
|
|
5831
|
+
const Popover = memo(forwardRef(function Popover2(props, ref) {
|
|
5843
5832
|
var _a, _b, _c, _d, _e;
|
|
5844
5833
|
const theme = useTheme();
|
|
5845
5834
|
const boundaryElementContext = useBoundaryElement();
|
|
@@ -5875,19 +5864,19 @@ const Popover = react.memo(react.forwardRef(function Popover2(props, ref) {
|
|
|
5875
5864
|
const width = useArrayProp(widthProp);
|
|
5876
5865
|
const zOffset = useArrayProp(zOffsetProp);
|
|
5877
5866
|
const forwardedRef = useForwardedRef(ref);
|
|
5878
|
-
const arrowRef =
|
|
5867
|
+
const arrowRef = useRef(null);
|
|
5879
5868
|
const rootBoundary = "viewport";
|
|
5880
|
-
const middleware =
|
|
5869
|
+
const middleware = useMemo(() => {
|
|
5881
5870
|
const ret = [];
|
|
5882
5871
|
if (constrainSize || preventOverflow) {
|
|
5883
|
-
ret.push(
|
|
5872
|
+
ret.push(flip({
|
|
5884
5873
|
boundary: boundaryElement || void 0,
|
|
5885
5874
|
fallbackPlacements,
|
|
5886
5875
|
padding: DEFAULT_POPOVER_PADDING,
|
|
5887
5876
|
rootBoundary
|
|
5888
5877
|
}));
|
|
5889
5878
|
}
|
|
5890
|
-
ret.push(
|
|
5879
|
+
ret.push(offset({
|
|
5891
5880
|
mainAxis: arrowProp ? DEFAULT_POPOVER_DISTANCE : 0
|
|
5892
5881
|
}));
|
|
5893
5882
|
if (constrainSize || matchReferenceWidthProp) {
|
|
@@ -5915,29 +5904,29 @@ const Popover = react.memo(react.forwardRef(function Popover2(props, ref) {
|
|
|
5915
5904
|
}));
|
|
5916
5905
|
}
|
|
5917
5906
|
if (preventOverflow) {
|
|
5918
|
-
ret.push(
|
|
5907
|
+
ret.push(shift({
|
|
5919
5908
|
boundary: boundaryElement || void 0,
|
|
5920
5909
|
rootBoundary,
|
|
5921
5910
|
padding: DEFAULT_POPOVER_PADDING
|
|
5922
5911
|
}));
|
|
5923
5912
|
}
|
|
5924
5913
|
if (arrowProp) {
|
|
5925
|
-
ret.push(
|
|
5914
|
+
ret.push(arrow({
|
|
5926
5915
|
element: arrowRef,
|
|
5927
5916
|
padding: DEFAULT_POPOVER_PADDING
|
|
5928
5917
|
}));
|
|
5929
5918
|
}
|
|
5930
|
-
ret.push(
|
|
5919
|
+
ret.push(hide({
|
|
5931
5920
|
boundary: boundaryElement || void 0,
|
|
5932
5921
|
padding: DEFAULT_POPOVER_PADDING,
|
|
5933
5922
|
strategy: "referenceHidden"
|
|
5934
5923
|
}));
|
|
5935
5924
|
return ret;
|
|
5936
5925
|
}, [arrowProp, boundaryElement, constrainSize, fallbackPlacements, margins, matchReferenceWidthProp, preventOverflow]);
|
|
5937
|
-
const floatingProps =
|
|
5926
|
+
const floatingProps = useMemo(() => ({
|
|
5938
5927
|
middleware,
|
|
5939
5928
|
placement: placementProp,
|
|
5940
|
-
whileElementsMounted:
|
|
5929
|
+
whileElementsMounted: autoUpdate
|
|
5941
5930
|
}), [middleware, placementProp]);
|
|
5942
5931
|
const {
|
|
5943
5932
|
x,
|
|
@@ -5947,18 +5936,18 @@ const Popover = react.memo(react.forwardRef(function Popover2(props, ref) {
|
|
|
5947
5936
|
floating: floatingRef,
|
|
5948
5937
|
middlewareData,
|
|
5949
5938
|
strategy
|
|
5950
|
-
} =
|
|
5939
|
+
} = useFloating(floatingProps);
|
|
5951
5940
|
const referenceHidden = (_c = middlewareData.hide) == null ? void 0 : _c.referenceHidden;
|
|
5952
5941
|
const arrowX = (_d = middlewareData.arrow) == null ? void 0 : _d.x;
|
|
5953
5942
|
const arrowY = (_e = middlewareData.arrow) == null ? void 0 : _e.y;
|
|
5954
|
-
const setArrow =
|
|
5943
|
+
const setArrow = useCallback(arrowEl => {
|
|
5955
5944
|
arrowRef.current = arrowEl;
|
|
5956
5945
|
}, []);
|
|
5957
|
-
const setFloating =
|
|
5946
|
+
const setFloating = useCallback(node => {
|
|
5958
5947
|
forwardedRef.current = node;
|
|
5959
5948
|
floatingRef(node);
|
|
5960
5949
|
}, [floatingRef, forwardedRef]);
|
|
5961
|
-
const setReference =
|
|
5950
|
+
const setReference = useCallback(node => {
|
|
5962
5951
|
referenceRef(node);
|
|
5963
5952
|
const childRef = childProp == null ? void 0 : childProp.ref;
|
|
5964
5953
|
if (typeof childRef === "function") {
|
|
@@ -5967,21 +5956,21 @@ const Popover = react.memo(react.forwardRef(function Popover2(props, ref) {
|
|
|
5967
5956
|
childRef.current = node;
|
|
5968
5957
|
}
|
|
5969
5958
|
}, [childProp, referenceRef]);
|
|
5970
|
-
const child =
|
|
5959
|
+
const child = useMemo(() => {
|
|
5971
5960
|
if (!childProp || referenceElement) return null;
|
|
5972
|
-
return
|
|
5961
|
+
return cloneElement(childProp, {
|
|
5973
5962
|
ref: setReference
|
|
5974
5963
|
});
|
|
5975
5964
|
}, [childProp, referenceElement, setReference]);
|
|
5976
|
-
|
|
5965
|
+
useEffect(() => {
|
|
5977
5966
|
referenceRef(referenceElement || null);
|
|
5978
5967
|
}, [referenceRef, referenceElement]);
|
|
5979
5968
|
if (disabled) {
|
|
5980
|
-
return childProp || /* @__PURE__ */
|
|
5969
|
+
return childProp || /* @__PURE__ */jsx(Fragment, {});
|
|
5981
5970
|
}
|
|
5982
|
-
const popover = /* @__PURE__ */
|
|
5971
|
+
const popover = /* @__PURE__ */jsx(LayerProvider, {
|
|
5983
5972
|
zOffset,
|
|
5984
|
-
children: /* @__PURE__ */
|
|
5973
|
+
children: /* @__PURE__ */jsx(PopoverCard, _objectSpread(_objectSpread({}, restProps), {}, {
|
|
5985
5974
|
__unstable_margins: margins,
|
|
5986
5975
|
arrow: arrowProp,
|
|
5987
5976
|
arrowRef: setArrow,
|
|
@@ -6004,9 +5993,9 @@ const Popover = react.memo(react.forwardRef(function Popover2(props, ref) {
|
|
|
6004
5993
|
children: content
|
|
6005
5994
|
}))
|
|
6006
5995
|
});
|
|
6007
|
-
return /* @__PURE__ */
|
|
6008
|
-
children: [open && /* @__PURE__ */
|
|
6009
|
-
children: portal ? /* @__PURE__ */
|
|
5996
|
+
return /* @__PURE__ */jsxs(Fragment, {
|
|
5997
|
+
children: [open && /* @__PURE__ */jsx(Fragment, {
|
|
5998
|
+
children: portal ? /* @__PURE__ */jsx(Portal, {
|
|
6010
5999
|
__unstable_name: typeof portal === "string" ? portal : void 0,
|
|
6011
6000
|
children: popover
|
|
6012
6001
|
}) : popover
|
|
@@ -6015,7 +6004,7 @@ const Popover = react.memo(react.forwardRef(function Popover2(props, ref) {
|
|
|
6015
6004
|
}));
|
|
6016
6005
|
Popover.displayName = "Popover";
|
|
6017
6006
|
function radioBaseStyle() {
|
|
6018
|
-
return
|
|
6007
|
+
return css(_templateObject37 || (_templateObject37 = _taggedTemplateLiteral(["\n position: relative;\n\n &:not([hidden]) {\n display: inline-block;\n }\n\n &[data-read-only] {\n outline: 1px solid red;\n }\n "])));
|
|
6019
6008
|
}
|
|
6020
6009
|
function inputElementStyle(props) {
|
|
6021
6010
|
const {
|
|
@@ -6027,7 +6016,7 @@ function inputElementStyle(props) {
|
|
|
6027
6016
|
} = theme.sanity;
|
|
6028
6017
|
const color = theme.sanity.color.input;
|
|
6029
6018
|
const dist = (input.radio.size - input.radio.markSize) / 2;
|
|
6030
|
-
return
|
|
6019
|
+
return css(_templateObject38 || (_templateObject38 = _taggedTemplateLiteral(["\n appearance: none;\n position: absolute;\n top: 0;\n left: 0;\n opacity: 0;\n height: 100%;\n width: 100%;\n outline: none;\n z-index: 1;\n padding: 0;\n margin: 0;\n border-radius: ", ";\n border: none;\n\n /* enabled */\n & + span {\n display: block;\n position: relative;\n height: ", ";\n width: ", ";\n border-radius: ", ";\n background: ", ";\n box-shadow: ", ";\n\n &::after {\n content: '';\n position: absolute;\n top: ", ";\n left: ", ";\n height: ", ";\n width: ", ";\n border-radius: ", ";\n background: ", ";\n opacity: 0;\n }\n }\n\n /* focused */\n &:not(:disabled):focus + span {\n box-shadow: ", ";\n }\n\n &:not(:disabled):focus:not(:focus-visible) + span {\n box-shadow: ", ";\n }\n\n &:checked + span::after {\n opacity: 1;\n }\n\n /* read only */\n &[data-read-only] + span {\n box-shadow: 0 0 0 1px ", ";\n background: ", ";\n\n &::after {\n background: ", ";\n }\n }\n\n /* disabled */\n &:not([data-read-only]):disabled + span {\n box-shadow: 0 0 0 1px ", ";\n background: ", ";\n\n &::after {\n background: ", ";\n }\n }\n "])), rem(input.radio.size / 2), rem(input.radio.size), rem(input.radio.size), rem(input.radio.size / 2), color.default.enabled.bg, focusRingBorderStyle({
|
|
6031
6020
|
color: color.default.enabled.border,
|
|
6032
6021
|
width: input.border.width
|
|
6033
6022
|
}), rem(dist), rem(dist), rem(input.radio.markSize), rem(input.radio.markSize), rem(input.radio.markSize / 2), color.default.enabled.fg, focusRingStyle({
|
|
@@ -6041,9 +6030,9 @@ function inputElementStyle(props) {
|
|
|
6041
6030
|
width: input.border.width
|
|
6042
6031
|
}), color.default.readOnly.border, color.default.readOnly.bg, color.default.readOnly.fg, color.default.disabled.border, color.default.disabled.bg, color.default.disabled.fg);
|
|
6043
6032
|
}
|
|
6044
|
-
const Root$h =
|
|
6045
|
-
const Input$4 =
|
|
6046
|
-
const Radio =
|
|
6033
|
+
const Root$h = styled.div(radioBaseStyle);
|
|
6034
|
+
const Input$4 = styled.input(inputElementStyle);
|
|
6035
|
+
const Radio = forwardRef(function Radio2(props, forwardedRef) {
|
|
6047
6036
|
const {
|
|
6048
6037
|
className,
|
|
6049
6038
|
disabled,
|
|
@@ -6054,29 +6043,29 @@ const Radio = react.forwardRef(function Radio2(props, forwardedRef) {
|
|
|
6054
6043
|
restProps = _objectWithoutProperties(props, _excluded24);
|
|
6055
6044
|
const ref = useForwardedRef(forwardedRef);
|
|
6056
6045
|
useCustomValidity(ref, customValidity);
|
|
6057
|
-
return /* @__PURE__ */
|
|
6046
|
+
return /* @__PURE__ */jsxs(Root$h, {
|
|
6058
6047
|
className,
|
|
6059
6048
|
"data-ui": "Radio",
|
|
6060
6049
|
style,
|
|
6061
|
-
children: [/* @__PURE__ */
|
|
6050
|
+
children: [/* @__PURE__ */jsx(Input$4, _objectSpread(_objectSpread({
|
|
6062
6051
|
"data-read-only": !disabled && readOnly ? "" : void 0
|
|
6063
6052
|
}, restProps), {}, {
|
|
6064
6053
|
disabled: disabled || readOnly,
|
|
6065
6054
|
readOnly,
|
|
6066
6055
|
ref,
|
|
6067
6056
|
type: "radio"
|
|
6068
|
-
})), /* @__PURE__ */
|
|
6057
|
+
})), /* @__PURE__ */jsx("span", {})]
|
|
6069
6058
|
});
|
|
6070
6059
|
});
|
|
6071
6060
|
function rootStyle() {
|
|
6072
|
-
return
|
|
6061
|
+
return css(_templateObject39 || (_templateObject39 = _taggedTemplateLiteral(["\n position: relative;\n width: stretch;\n\n &:not([hidden]) {\n display: inline-block;\n }\n "])));
|
|
6073
6062
|
}
|
|
6074
6063
|
function inputBaseStyle(props) {
|
|
6075
6064
|
const {
|
|
6076
6065
|
theme
|
|
6077
6066
|
} = props;
|
|
6078
6067
|
const font = theme.sanity.fonts.text;
|
|
6079
|
-
return
|
|
6068
|
+
return css(_templateObject40 || (_templateObject40 = _taggedTemplateLiteral(["\n -webkit-font-smoothing: antialiased;\n appearance: none;\n border: 0;\n font-family: ", ";\n color: inherit;\n width: 100%;\n outline: none;\n margin: 0;\n\n &:disabled {\n opacity: 1;\n }\n "])), font.family);
|
|
6080
6069
|
}
|
|
6081
6070
|
function inputColorStyle(props) {
|
|
6082
6071
|
const {
|
|
@@ -6087,7 +6076,7 @@ function inputColorStyle(props) {
|
|
|
6087
6076
|
input
|
|
6088
6077
|
} = theme.sanity;
|
|
6089
6078
|
const color = theme.sanity.color.input;
|
|
6090
|
-
return
|
|
6079
|
+
return css(_templateObject41 || (_templateObject41 = _taggedTemplateLiteral(["\n /* enabled */\n background-color: ", ";\n color: ", ";\n box-shadow: ", ";\n\n /* hovered */\n @media (hover: hover) {\n &:not(:disabled):hover {\n background-color: ", ";\n color: ", ";\n box-shadow: ", ";\n }\n }\n\n /* focused */\n &:not(:disabled):focus {\n box-shadow: ", ";\n }\n\n /* read-only */\n &[data-read-only] {\n background-color: ", ";\n color: ", ";\n box-shadow: ", ";\n }\n\n /* disabled */\n &:not([data-read-only]):disabled {\n background-color: ", ";\n color: ", ";\n box-shadow: ", ";\n }\n "])), color.default.enabled.bg, color.default.enabled.fg, focusRingBorderStyle({
|
|
6091
6080
|
color: color.default.enabled.border,
|
|
6092
6081
|
width: input.border.width
|
|
6093
6082
|
}), color.default.hovered.bg, color.default.hovered.fg, focusRingBorderStyle({
|
|
@@ -6131,17 +6120,17 @@ function iconBoxStyle(props) {
|
|
|
6131
6120
|
theme
|
|
6132
6121
|
} = props;
|
|
6133
6122
|
const color = theme.sanity.color.input;
|
|
6134
|
-
return
|
|
6123
|
+
return css(_templateObject42 || (_templateObject42 = _taggedTemplateLiteral(["\n pointer-events: none;\n position: absolute;\n top: 0;\n right: 0;\n\n /* enabled */\n --card-fg-color: ", ";\n\n /* hover */\n @media (hover: hover) {\n select:not(disabled):not(:read-only):hover + && {\n --card-fg-color: ", ";\n }\n }\n\n /* disabled */\n select:disabled + && {\n --card-fg-color: ", ";\n }\n\n /* read-only */\n select[data-read-only] + && {\n --card-fg-color: ", ";\n }\n "])), color.default.enabled.fg, color.default.hovered.fg, color.default.disabled.fg, color.default.readOnly.fg);
|
|
6135
6124
|
}
|
|
6136
6125
|
const selectStyle = {
|
|
6137
6126
|
root: rootStyle,
|
|
6138
6127
|
input: inputStyle,
|
|
6139
6128
|
iconBox: iconBoxStyle
|
|
6140
6129
|
};
|
|
6141
|
-
const Root$g =
|
|
6142
|
-
const Input$3 =
|
|
6143
|
-
const IconBox =
|
|
6144
|
-
const Select =
|
|
6130
|
+
const Root$g = styled.div(selectStyle.root);
|
|
6131
|
+
const Input$3 = styled.select(selectStyle.input);
|
|
6132
|
+
const IconBox = styled(Box)(selectStyle.iconBox);
|
|
6133
|
+
const Select = forwardRef(function Select2(props, forwardedRef) {
|
|
6145
6134
|
const {
|
|
6146
6135
|
children,
|
|
6147
6136
|
customValidity,
|
|
@@ -6155,9 +6144,9 @@ const Select = react.forwardRef(function Select2(props, forwardedRef) {
|
|
|
6155
6144
|
restProps = _objectWithoutProperties(props, _excluded25);
|
|
6156
6145
|
const ref = useForwardedRef(forwardedRef);
|
|
6157
6146
|
useCustomValidity(ref, customValidity);
|
|
6158
|
-
return /* @__PURE__ */
|
|
6147
|
+
return /* @__PURE__ */jsxs(Root$g, {
|
|
6159
6148
|
"data-ui": "Select",
|
|
6160
|
-
children: [/* @__PURE__ */
|
|
6149
|
+
children: [/* @__PURE__ */jsx(Input$3, _objectSpread(_objectSpread({
|
|
6161
6150
|
"data-read-only": !disabled && readOnly ? "" : void 0,
|
|
6162
6151
|
"data-ui": "Select"
|
|
6163
6152
|
}, restProps), {}, {
|
|
@@ -6168,11 +6157,11 @@ const Select = react.forwardRef(function Select2(props, forwardedRef) {
|
|
|
6168
6157
|
disabled: disabled || readOnly,
|
|
6169
6158
|
ref,
|
|
6170
6159
|
children
|
|
6171
|
-
})), /* @__PURE__ */
|
|
6160
|
+
})), /* @__PURE__ */jsx(IconBox, {
|
|
6172
6161
|
padding,
|
|
6173
|
-
children: /* @__PURE__ */
|
|
6162
|
+
children: /* @__PURE__ */jsx(Text, {
|
|
6174
6163
|
size: fontSize,
|
|
6175
|
-
children: /* @__PURE__ */
|
|
6164
|
+
children: /* @__PURE__ */jsx(SelectIcon, {})
|
|
6176
6165
|
})
|
|
6177
6166
|
})]
|
|
6178
6167
|
});
|
|
@@ -6202,14 +6191,14 @@ function responsiveStackSpaceStyle(props) {
|
|
|
6202
6191
|
gridGap: rem(space[spaceIndex])
|
|
6203
6192
|
}));
|
|
6204
6193
|
}
|
|
6205
|
-
const Root$f =
|
|
6206
|
-
const Stack =
|
|
6194
|
+
const Root$f = styled(Box)(stackBaseStyle, responsiveStackSpaceStyle);
|
|
6195
|
+
const Stack = forwardRef(function Stack2(props, ref) {
|
|
6207
6196
|
const {
|
|
6208
6197
|
as,
|
|
6209
6198
|
space
|
|
6210
6199
|
} = props,
|
|
6211
6200
|
restProps = _objectWithoutProperties(props, _excluded26);
|
|
6212
|
-
return /* @__PURE__ */
|
|
6201
|
+
return /* @__PURE__ */jsx(Root$f, _objectSpread(_objectSpread({
|
|
6213
6202
|
"data-as": typeof as === "string" ? as : void 0,
|
|
6214
6203
|
"data-ui": "Stack"
|
|
6215
6204
|
}, restProps), {}, {
|
|
@@ -6219,10 +6208,10 @@ const Stack = react.forwardRef(function Stack2(props, ref) {
|
|
|
6219
6208
|
}));
|
|
6220
6209
|
});
|
|
6221
6210
|
function switchBaseStyles() {
|
|
6222
|
-
return
|
|
6211
|
+
return css(_templateObject43 || (_templateObject43 = _taggedTemplateLiteral(["\n position: relative;\n &:not([hidden]) {\n display: inline-block;\n }\n "])));
|
|
6223
6212
|
}
|
|
6224
6213
|
function switchInputStyles() {
|
|
6225
|
-
return
|
|
6214
|
+
return css(_templateObject44 || (_templateObject44 = _taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n opacity: 0;\n height: 100%;\n width: 100%;\n outline: none;\n padding: 0;\n margin: 0;\n\n /* Place the input element above the representation element */\n z-index: 1;\n "])));
|
|
6226
6215
|
}
|
|
6227
6216
|
function switchRepresentationStyles(props) {
|
|
6228
6217
|
const {
|
|
@@ -6233,7 +6222,7 @@ function switchRepresentationStyles(props) {
|
|
|
6233
6222
|
input
|
|
6234
6223
|
} = theme.sanity;
|
|
6235
6224
|
const color = theme.sanity.color.button.default;
|
|
6236
|
-
return
|
|
6225
|
+
return css(_templateObject45 || (_templateObject45 = _taggedTemplateLiteral(["\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n --switch-box-shadow: none;\n\n &:not([hidden]) {\n display: block;\n }\n position: relative;\n width: ", ";\n height: ", ";\n border-radius: ", ";\n\n /* Make sure it\u2019s not possible to interact with the wrapper element */\n pointer-events: none;\n\n &:after {\n content: '';\n display: block;\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 1;\n box-shadow: var(--switch-box-shadow);\n border-radius: inherit;\n }\n\n /* Focus styles */\n input:focus + && {\n --switch-box-shadow: ", ";\n }\n\n input:focus:not(:focus-visible) + && {\n --switch-box-shadow: none;\n }\n\n input:checked + && {\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n }\n\n @media (hover: hover) {\n input:not(:disabled):hover + && {\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n }\n\n input:not(:disabled):checked:hover + && {\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n }\n }\n\n input:not([data-read-only]):disabled + && {\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n }\n "])), color.default.enabled.bg, color.default.enabled.fg, rem(input.switch.width), rem(input.switch.height), rem(input.switch.height / 2), focusRingStyle({
|
|
6237
6226
|
focusRing
|
|
6238
6227
|
}), color.positive.enabled.bg, color.positive.enabled.fg, color.default.hovered.bg, color.default.hovered.fg, color.positive.hovered.bg, color.positive.hovered.fg, color.default.disabled.bg, color.default.disabled.fg);
|
|
6239
6228
|
}
|
|
@@ -6244,7 +6233,7 @@ function switchTrackStyles(props) {
|
|
|
6244
6233
|
const {
|
|
6245
6234
|
input
|
|
6246
6235
|
} = theme.sanity;
|
|
6247
|
-
return
|
|
6236
|
+
return css(_templateObject46 || (_templateObject46 = _taggedTemplateLiteral(["\n &:not([hidden]) {\n display: block;\n }\n background-color: var(--switch-bg-color);\n position: absolute;\n left: 0;\n top: 0;\n width: ", ";\n height: ", ";\n border-radius: ", ";\n "])), rem(input.switch.width), rem(input.switch.height), rem(input.switch.height / 2));
|
|
6248
6237
|
}
|
|
6249
6238
|
function switchThumbStyles(props) {
|
|
6250
6239
|
const {
|
|
@@ -6261,14 +6250,14 @@ function switchThumbStyles(props) {
|
|
|
6261
6250
|
const checkedOffset = trackWidth - trackPadding * 2 - size;
|
|
6262
6251
|
const indeterminateOffset = trackWidth / 2 - size / 2 - trackPadding;
|
|
6263
6252
|
const checked = $indeterminate !== true && props.$checked === true;
|
|
6264
|
-
return
|
|
6253
|
+
return css(_templateObject47 || (_templateObject47 = _taggedTemplateLiteral(["\n &:not([hidden]) {\n display: block;\n }\n position: absolute;\n left: ", ";\n top: ", ";\n height: ", ";\n width: ", ";\n border-radius: ", ";\n transition-property: transform;\n transition-duration: ", "ms;\n transition-timing-function: ", ";\n background: var(--switch-fg-color);\n transform: translate3d(0, 0, 0);\n\n ", "\n\n ", "\n "])), rem(trackPadding), rem(trackPadding), rem(size), rem(size), rem(size / 2), input.switch.transitionDurationMs, input.switch.transitionTimingFunction, checked && css(_templateObject48 || (_templateObject48 = _taggedTemplateLiteral(["\n transform: translate3d(", "px, 0, 0);\n "])), checkedOffset), $indeterminate && css(_templateObject49 || (_templateObject49 = _taggedTemplateLiteral(["\n transform: translate3d(", "px, 0, 0);\n "])), indeterminateOffset));
|
|
6265
6254
|
}
|
|
6266
|
-
const Root$e =
|
|
6267
|
-
const Input$2 =
|
|
6268
|
-
const Representation =
|
|
6269
|
-
const Track =
|
|
6270
|
-
const Thumb =
|
|
6271
|
-
const Switch =
|
|
6255
|
+
const Root$e = styled.span(switchBaseStyles);
|
|
6256
|
+
const Input$2 = styled.input(switchInputStyles);
|
|
6257
|
+
const Representation = styled.span(switchRepresentationStyles);
|
|
6258
|
+
const Track = styled.span(switchTrackStyles);
|
|
6259
|
+
const Thumb = styled.span(switchThumbStyles);
|
|
6260
|
+
const Switch = forwardRef(function Switch2(props, forwardedRef) {
|
|
6272
6261
|
const {
|
|
6273
6262
|
checked,
|
|
6274
6263
|
className,
|
|
@@ -6279,37 +6268,37 @@ const Switch = react.forwardRef(function Switch2(props, forwardedRef) {
|
|
|
6279
6268
|
} = props,
|
|
6280
6269
|
restProps = _objectWithoutProperties(props, _excluded27);
|
|
6281
6270
|
const ref = useForwardedRef(forwardedRef);
|
|
6282
|
-
|
|
6271
|
+
useEffect(() => {
|
|
6283
6272
|
if (ref.current) {
|
|
6284
6273
|
ref.current.indeterminate = indeterminate || false;
|
|
6285
6274
|
}
|
|
6286
6275
|
}, [indeterminate, ref]);
|
|
6287
|
-
return /* @__PURE__ */
|
|
6276
|
+
return /* @__PURE__ */jsxs(Root$e, {
|
|
6288
6277
|
className,
|
|
6289
6278
|
"data-ui": "Switch",
|
|
6290
6279
|
style,
|
|
6291
|
-
children: [/* @__PURE__ */
|
|
6280
|
+
children: [/* @__PURE__ */jsx(Input$2, _objectSpread(_objectSpread({
|
|
6292
6281
|
"data-read-only": !disabled && readOnly ? "" : void 0
|
|
6293
6282
|
}, restProps), {}, {
|
|
6294
6283
|
checked: indeterminate !== true && checked,
|
|
6295
6284
|
disabled: disabled || readOnly,
|
|
6296
6285
|
type: "checkbox",
|
|
6297
6286
|
ref
|
|
6298
|
-
})), /* @__PURE__ */
|
|
6287
|
+
})), /* @__PURE__ */jsxs(Representation, {
|
|
6299
6288
|
"aria-hidden": true,
|
|
6300
6289
|
"data-name": "representation",
|
|
6301
|
-
children: [/* @__PURE__ */
|
|
6290
|
+
children: [/* @__PURE__ */jsx(Track, {}), /* @__PURE__ */jsx(Thumb, {
|
|
6302
6291
|
$checked: checked,
|
|
6303
6292
|
$indeterminate: indeterminate
|
|
6304
6293
|
})]
|
|
6305
6294
|
})]
|
|
6306
6295
|
});
|
|
6307
6296
|
});
|
|
6308
|
-
const Root$d =
|
|
6309
|
-
const InputRoot$1 =
|
|
6310
|
-
const Input$1 =
|
|
6311
|
-
const Presentation$1 =
|
|
6312
|
-
const TextArea =
|
|
6297
|
+
const Root$d = styled.span(textInputRootStyle);
|
|
6298
|
+
const InputRoot$1 = styled.span(_templateObject50 || (_templateObject50 = _taggedTemplateLiteral(["\n flex: 1;\n min-width: 0;\n display: block;\n position: relative;\n"])));
|
|
6299
|
+
const Input$1 = styled.textarea(responsiveInputPaddingStyle, textInputBaseStyle, textInputFontSizeStyle);
|
|
6300
|
+
const Presentation$1 = styled.div(responsiveRadiusStyle, textInputRepresentationStyle);
|
|
6301
|
+
const TextArea = forwardRef(function TextArea2(props, forwardedRef) {
|
|
6313
6302
|
const {
|
|
6314
6303
|
border = true,
|
|
6315
6304
|
customValidity,
|
|
@@ -6323,10 +6312,10 @@ const TextArea = react.forwardRef(function TextArea2(props, forwardedRef) {
|
|
|
6323
6312
|
const ref = useForwardedRef(forwardedRef);
|
|
6324
6313
|
const rootTheme = useRootTheme();
|
|
6325
6314
|
useCustomValidity(ref, customValidity);
|
|
6326
|
-
return /* @__PURE__ */
|
|
6315
|
+
return /* @__PURE__ */jsx(Root$d, {
|
|
6327
6316
|
"data-ui": "TextArea",
|
|
6328
|
-
children: /* @__PURE__ */
|
|
6329
|
-
children: [/* @__PURE__ */
|
|
6317
|
+
children: /* @__PURE__ */jsxs(InputRoot$1, {
|
|
6318
|
+
children: [/* @__PURE__ */jsx(Input$1, _objectSpread(_objectSpread({
|
|
6330
6319
|
"data-as": "textarea",
|
|
6331
6320
|
"data-scheme": rootTheme.scheme,
|
|
6332
6321
|
"data-tone": rootTheme.tone
|
|
@@ -6339,7 +6328,7 @@ const TextArea = react.forwardRef(function TextArea2(props, forwardedRef) {
|
|
|
6339
6328
|
$weight: weight,
|
|
6340
6329
|
disabled,
|
|
6341
6330
|
ref
|
|
6342
|
-
})), /* @__PURE__ */
|
|
6331
|
+
})), /* @__PURE__ */jsx(Presentation$1, {
|
|
6343
6332
|
$radius: useArrayProp(radius),
|
|
6344
6333
|
$scheme: rootTheme.scheme,
|
|
6345
6334
|
$tone: rootTheme.tone,
|
|
@@ -6353,22 +6342,22 @@ const TextArea = react.forwardRef(function TextArea2(props, forwardedRef) {
|
|
|
6353
6342
|
const CLEAR_BUTTON_BOX_STYLE = {
|
|
6354
6343
|
zIndex: 2
|
|
6355
6344
|
};
|
|
6356
|
-
const Root$c =
|
|
6345
|
+
const Root$c = styled(Card).attrs({
|
|
6357
6346
|
forwardedAs: "span"
|
|
6358
6347
|
})(textInputRootStyle);
|
|
6359
|
-
const InputRoot =
|
|
6360
|
-
const Prefix =
|
|
6348
|
+
const InputRoot = styled.span(_templateObject51 || (_templateObject51 = _taggedTemplateLiteral(["\n flex: 1;\n min-width: 0;\n display: block;\n position: relative;\n"])));
|
|
6349
|
+
const Prefix = styled(Card).attrs({
|
|
6361
6350
|
forwardedAs: "span"
|
|
6362
6351
|
})(_templateObject52 || (_templateObject52 = _taggedTemplateLiteral(["\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n\n & > span {\n display: block;\n margin: -1px;\n }\n"])));
|
|
6363
|
-
const Suffix =
|
|
6352
|
+
const Suffix = styled(Card).attrs({
|
|
6364
6353
|
forwardedAs: "span"
|
|
6365
6354
|
})(_templateObject53 || (_templateObject53 = _taggedTemplateLiteral(["\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n\n & > span {\n display: block;\n margin: -1px;\n }\n"])));
|
|
6366
|
-
const Input =
|
|
6367
|
-
const Presentation =
|
|
6368
|
-
const LeftBox =
|
|
6369
|
-
const RightBox =
|
|
6370
|
-
const RightCard =
|
|
6371
|
-
const TextInput =
|
|
6355
|
+
const Input = styled.input(responsiveInputPaddingStyle, textInputBaseStyle, textInputFontSizeStyle);
|
|
6356
|
+
const Presentation = styled.span(responsiveRadiusStyle, textInputRepresentationStyle);
|
|
6357
|
+
const LeftBox = styled(Box)(_templateObject54 || (_templateObject54 = _taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n left: 0;\n"])));
|
|
6358
|
+
const RightBox = styled(Box)(_templateObject55 || (_templateObject55 = _taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n right: 0;\n"])));
|
|
6359
|
+
const RightCard = styled(Card)(_templateObject56 || (_templateObject56 = _taggedTemplateLiteral(["\n background-color: transparent;\n position: absolute;\n top: 0;\n right: 0;\n"])));
|
|
6360
|
+
const TextInput = forwardRef(function TextInput2(props, forwardedRef) {
|
|
6372
6361
|
const {
|
|
6373
6362
|
border = true,
|
|
6374
6363
|
clearButton,
|
|
@@ -6400,29 +6389,29 @@ const TextInput = react.forwardRef(function TextInput2(props, forwardedRef) {
|
|
|
6400
6389
|
const $hasSuffix = Boolean(suffix);
|
|
6401
6390
|
const $hasPrefix = Boolean(prefix);
|
|
6402
6391
|
useCustomValidity(ref, customValidity);
|
|
6403
|
-
const handleClearMouseDown =
|
|
6392
|
+
const handleClearMouseDown = useCallback(event => {
|
|
6404
6393
|
event.preventDefault();
|
|
6405
6394
|
event.stopPropagation();
|
|
6406
6395
|
}, []);
|
|
6407
|
-
const handleClearClick =
|
|
6396
|
+
const handleClearClick = useCallback(event => {
|
|
6408
6397
|
var _a;
|
|
6409
6398
|
event.preventDefault();
|
|
6410
6399
|
event.stopPropagation();
|
|
6411
6400
|
if (onClear) onClear();
|
|
6412
6401
|
(_a = ref.current) == null ? void 0 : _a.focus();
|
|
6413
6402
|
}, [onClear, ref]);
|
|
6414
|
-
const prefixNode =
|
|
6403
|
+
const prefixNode = useMemo(() => prefix && /* @__PURE__ */jsx(Prefix, {
|
|
6415
6404
|
borderTop: true,
|
|
6416
6405
|
borderLeft: true,
|
|
6417
6406
|
borderBottom: true,
|
|
6418
6407
|
radius,
|
|
6419
6408
|
sizing: "border",
|
|
6420
6409
|
tone: "inherit",
|
|
6421
|
-
children: /* @__PURE__ */
|
|
6410
|
+
children: /* @__PURE__ */jsx("span", {
|
|
6422
6411
|
children: prefix
|
|
6423
6412
|
})
|
|
6424
6413
|
}), [prefix, radius]);
|
|
6425
|
-
const presentationNode =
|
|
6414
|
+
const presentationNode = useMemo(() => /* @__PURE__ */jsxs(Presentation, {
|
|
6426
6415
|
$hasPrefix,
|
|
6427
6416
|
$hasSuffix,
|
|
6428
6417
|
$radius: radius,
|
|
@@ -6431,43 +6420,43 @@ const TextInput = react.forwardRef(function TextInput2(props, forwardedRef) {
|
|
|
6431
6420
|
"data-border": border ? "" : void 0,
|
|
6432
6421
|
"data-scheme": rootTheme.scheme,
|
|
6433
6422
|
"data-tone": rootTheme.tone,
|
|
6434
|
-
children: [icon && /* @__PURE__ */
|
|
6423
|
+
children: [icon && /* @__PURE__ */jsx(LeftBox, {
|
|
6435
6424
|
padding,
|
|
6436
|
-
children: /* @__PURE__ */
|
|
6425
|
+
children: /* @__PURE__ */jsxs(Text, {
|
|
6437
6426
|
size: fontSize,
|
|
6438
|
-
children: [
|
|
6427
|
+
children: [isValidElement(icon) && icon, isValidElementType(icon) && createElement(icon)]
|
|
6439
6428
|
})
|
|
6440
|
-
}), !$hasClearButton && iconRight && /* @__PURE__ */
|
|
6429
|
+
}), !$hasClearButton && iconRight && /* @__PURE__ */jsx(RightBox, {
|
|
6441
6430
|
padding,
|
|
6442
|
-
children: /* @__PURE__ */
|
|
6431
|
+
children: /* @__PURE__ */jsxs(Text, {
|
|
6443
6432
|
size: fontSize,
|
|
6444
|
-
children: [
|
|
6433
|
+
children: [isValidElement(iconRight) && iconRight, isValidElementType(iconRight) && createElement(iconRight)]
|
|
6445
6434
|
})
|
|
6446
6435
|
})]
|
|
6447
6436
|
}), [border, fontSize, icon, iconRight, padding, radius, rootTheme, $hasClearButton, $hasPrefix, $hasSuffix]);
|
|
6448
|
-
const clearButtonBoxPadding =
|
|
6437
|
+
const clearButtonBoxPadding = useMemo(() => padding.map(v => {
|
|
6449
6438
|
if (v === 0) return 0;
|
|
6450
6439
|
if (v === 1) return 1;
|
|
6451
6440
|
if (v === 2) return 1;
|
|
6452
6441
|
return v - 2;
|
|
6453
6442
|
}), [padding]);
|
|
6454
|
-
const clearButtonPadding =
|
|
6443
|
+
const clearButtonPadding = useMemo(() => padding.map(v => {
|
|
6455
6444
|
if (v === 0) return 0;
|
|
6456
6445
|
if (v === 1) return 0;
|
|
6457
6446
|
if (v === 2) return 1;
|
|
6458
6447
|
return v - 1;
|
|
6459
6448
|
}), [padding]);
|
|
6460
|
-
const clearButtonProps =
|
|
6461
|
-
const clearButtonNode =
|
|
6449
|
+
const clearButtonProps = useMemo(() => typeof clearButton === "object" ? clearButton : EMPTY_RECORD, [clearButton]);
|
|
6450
|
+
const clearButtonNode = useMemo(() => !disabled && !readOnly && clearButton && /* @__PURE__ */jsx(RightCard, {
|
|
6462
6451
|
forwardedAs: "span",
|
|
6463
6452
|
padding: clearButtonBoxPadding,
|
|
6464
6453
|
style: CLEAR_BUTTON_BOX_STYLE,
|
|
6465
6454
|
tone: customValidity ? "critical" : "inherit",
|
|
6466
|
-
children: /* @__PURE__ */
|
|
6455
|
+
children: /* @__PURE__ */jsx(Button, _objectSpread(_objectSpread({
|
|
6467
6456
|
"aria-label": "Clear",
|
|
6468
6457
|
"data-qa": "clear-button",
|
|
6469
6458
|
fontSize,
|
|
6470
|
-
icon:
|
|
6459
|
+
icon: CloseIcon,
|
|
6471
6460
|
mode: "bleed",
|
|
6472
6461
|
padding: clearButtonPadding,
|
|
6473
6462
|
radius
|
|
@@ -6476,22 +6465,22 @@ const TextInput = react.forwardRef(function TextInput2(props, forwardedRef) {
|
|
|
6476
6465
|
onMouseDown: handleClearMouseDown
|
|
6477
6466
|
}))
|
|
6478
6467
|
}), [clearButton, clearButtonBoxPadding, clearButtonPadding, clearButtonProps, customValidity, disabled, fontSize, handleClearClick, handleClearMouseDown, radius, readOnly]);
|
|
6479
|
-
const suffixNode =
|
|
6468
|
+
const suffixNode = useMemo(() => suffix && /* @__PURE__ */jsx(Suffix, {
|
|
6480
6469
|
borderTop: true,
|
|
6481
6470
|
borderRight: true,
|
|
6482
6471
|
borderBottom: true,
|
|
6483
6472
|
radius,
|
|
6484
6473
|
sizing: "border",
|
|
6485
6474
|
tone: "inherit",
|
|
6486
|
-
children: /* @__PURE__ */
|
|
6475
|
+
children: /* @__PURE__ */jsx("span", {
|
|
6487
6476
|
children: suffix
|
|
6488
6477
|
})
|
|
6489
6478
|
}), [radius, suffix]);
|
|
6490
|
-
return /* @__PURE__ */
|
|
6479
|
+
return /* @__PURE__ */jsxs(Root$c, {
|
|
6491
6480
|
"data-ui": "TextInput",
|
|
6492
6481
|
tone: rootTheme.tone,
|
|
6493
|
-
children: [prefixNode, /* @__PURE__ */
|
|
6494
|
-
children: [/* @__PURE__ */
|
|
6482
|
+
children: [prefixNode, /* @__PURE__ */jsxs(InputRoot, {
|
|
6483
|
+
children: [/* @__PURE__ */jsx(Input, _objectSpread(_objectSpread({
|
|
6495
6484
|
"data-as": "input",
|
|
6496
6485
|
"data-scheme": rootTheme.scheme,
|
|
6497
6486
|
"data-tone": rootTheme.tone
|
|
@@ -6512,29 +6501,29 @@ const TextInput = react.forwardRef(function TextInput2(props, forwardedRef) {
|
|
|
6512
6501
|
}), suffixNode]
|
|
6513
6502
|
});
|
|
6514
6503
|
});
|
|
6515
|
-
const Root$b =
|
|
6516
|
-
const Border =
|
|
6517
|
-
const Shape =
|
|
6518
|
-
const TooltipArrow =
|
|
6504
|
+
const Root$b = styled.div(_templateObject57 || (_templateObject57 = _taggedTemplateLiteral(["\n position: absolute;\n pointer-events: none;\n width: 15px;\n height: 15px;\n fill: none;\n\n :empty + & {\n display: none;\n }\n\n & > svg {\n display: block;\n transform-origin: 7.5px 7.5px;\n }\n\n /* position: absolute;\n width: 15px;\n height: 15px;\n fill: none;\n\n :empty + & {\n display: none;\n }\n\n & > svg {\n &:not([hidden]) {\n display: block;\n }\n transform-origin: 7.5px 7.5px;\n } */\n\n [data-placement^='top'] > & {\n bottom: -27px;\n }\n\n [data-placement^='right'] > & {\n left: -27px;\n\n & > svg {\n transform: rotate(90deg);\n }\n }\n\n [data-placement^='left'] > & {\n right: -27px;\n\n & > svg {\n transform: rotate(-90deg);\n }\n }\n\n [data-placement^='bottom'] > & {\n top: -27px;\n\n & > svg {\n transform: rotate(180deg);\n }\n }\n"])));
|
|
6505
|
+
const Border = styled.path(_templateObject58 || (_templateObject58 = _taggedTemplateLiteral(["\n fill: var(--card-shadow-outline-color);\n"])));
|
|
6506
|
+
const Shape = styled.path(_templateObject59 || (_templateObject59 = _taggedTemplateLiteral(["\n fill: var(--card-bg-color);\n"])));
|
|
6507
|
+
const TooltipArrow = forwardRef(function TooltipArrow2(props, ref) {
|
|
6519
6508
|
const restProps = _extends({}, (_objectDestructuringEmpty(props), props));
|
|
6520
|
-
return /* @__PURE__ */
|
|
6509
|
+
return /* @__PURE__ */jsx(Root$b, _objectSpread(_objectSpread({
|
|
6521
6510
|
"data-ui": "Tooltip__arrow"
|
|
6522
6511
|
}, restProps), {}, {
|
|
6523
6512
|
ref,
|
|
6524
|
-
children: /* @__PURE__ */
|
|
6513
|
+
children: /* @__PURE__ */jsxs("svg", {
|
|
6525
6514
|
width: "15",
|
|
6526
6515
|
height: "15",
|
|
6527
6516
|
viewBox: "0 0 15 15",
|
|
6528
|
-
children: [/* @__PURE__ */
|
|
6517
|
+
children: [/* @__PURE__ */jsx(Border, {
|
|
6529
6518
|
d: "M11.5266 1C11.032 1.32802 10.5837 1.73105 10.1995 2.20057L9.04792 3.6081C8.24771 4.58614 6.7523 4.58614 5.95209 3.6081L4.80047 2.20057C4.41632 1.73105 3.96796 1.32802 3.47341 1H0.156727C1.65639 1 3.07687 1.67313 4.02651 2.83381L5.17813 4.24134C6.37844 5.70839 8.62156 5.70839 9.82187 4.24134L10.9735 2.83381C11.9231 1.67313 13.3436 1 14.8433 1H11.5266Z"
|
|
6530
|
-
}), /* @__PURE__ */
|
|
6519
|
+
}), /* @__PURE__ */jsx(Shape, {
|
|
6531
6520
|
d: "M0.156725 0C1.95632 0 3.66089 0.80776 4.80047 2.20057L5.95209 3.6081C6.75229 4.58614 8.24771 4.58614 9.04791 3.6081L10.1995 2.20057C11.3391 0.80776 13.0437 0 14.8433 0H15H0H0.156725Z"
|
|
6532
6521
|
})]
|
|
6533
6522
|
})
|
|
6534
6523
|
}));
|
|
6535
6524
|
});
|
|
6536
|
-
const Root$a =
|
|
6537
|
-
const Tooltip =
|
|
6525
|
+
const Root$a = styled(Layer)(_templateObject60 || (_templateObject60 = _taggedTemplateLiteral(["\n pointer-events: none;\n"])));
|
|
6526
|
+
const Tooltip = forwardRef(function Tooltip2(props, ref) {
|
|
6538
6527
|
var _a, _b, _c;
|
|
6539
6528
|
const boundaryElementContext = useBoundaryElement();
|
|
6540
6529
|
const theme = useTheme();
|
|
@@ -6554,26 +6543,26 @@ const Tooltip = react.forwardRef(function Tooltip2(props, ref) {
|
|
|
6554
6543
|
restProps = _objectWithoutProperties(props, _excluded30);
|
|
6555
6544
|
const fallbackPlacements = useArrayProp(fallbackPlacementsProp);
|
|
6556
6545
|
const forwardedRef = useForwardedRef(ref);
|
|
6557
|
-
const [referenceElement, setReferenceElement] =
|
|
6558
|
-
const arrowRef =
|
|
6546
|
+
const [referenceElement, setReferenceElement] = useState(null);
|
|
6547
|
+
const arrowRef = useRef(null);
|
|
6559
6548
|
const rootBoundary = "viewport";
|
|
6560
|
-
const middleware =
|
|
6549
|
+
const middleware = useMemo(() => {
|
|
6561
6550
|
const ret = [];
|
|
6562
|
-
ret.push(
|
|
6551
|
+
ret.push(flip({
|
|
6563
6552
|
boundary: boundaryElement || void 0,
|
|
6564
6553
|
fallbackPlacements,
|
|
6565
6554
|
padding: 4,
|
|
6566
6555
|
rootBoundary
|
|
6567
6556
|
}));
|
|
6568
|
-
ret.push(
|
|
6557
|
+
ret.push(offset({
|
|
6569
6558
|
mainAxis: 3
|
|
6570
6559
|
}));
|
|
6571
|
-
ret.push(
|
|
6560
|
+
ret.push(shift({
|
|
6572
6561
|
boundary: boundaryElement || void 0,
|
|
6573
6562
|
rootBoundary,
|
|
6574
6563
|
padding: 4
|
|
6575
6564
|
}));
|
|
6576
|
-
ret.push(
|
|
6565
|
+
ret.push(arrow({
|
|
6577
6566
|
element: arrowRef,
|
|
6578
6567
|
padding: 2
|
|
6579
6568
|
}));
|
|
@@ -6588,12 +6577,12 @@ const Tooltip = react.forwardRef(function Tooltip2(props, ref) {
|
|
|
6588
6577
|
middlewareData,
|
|
6589
6578
|
update,
|
|
6590
6579
|
strategy
|
|
6591
|
-
} =
|
|
6580
|
+
} = useFloating({
|
|
6592
6581
|
middleware,
|
|
6593
6582
|
placement: placementProp,
|
|
6594
|
-
whileElementsMounted:
|
|
6583
|
+
whileElementsMounted: autoUpdate
|
|
6595
6584
|
});
|
|
6596
|
-
const rootStyle =
|
|
6585
|
+
const rootStyle = useMemo(() => ({
|
|
6597
6586
|
position: strategy,
|
|
6598
6587
|
top: y != null ? y : 0,
|
|
6599
6588
|
left: x != null ? x : 0
|
|
@@ -6601,7 +6590,7 @@ const Tooltip = react.forwardRef(function Tooltip2(props, ref) {
|
|
|
6601
6590
|
const staticSide = placement && FLOATING_STATIC_SIDES[placement.split("-")[0]];
|
|
6602
6591
|
const arrowX = (_b = middlewareData.arrow) == null ? void 0 : _b.x;
|
|
6603
6592
|
const arrowY = (_c = middlewareData.arrow) == null ? void 0 : _c.y;
|
|
6604
|
-
const arrowStyle =
|
|
6593
|
+
const arrowStyle = useMemo(() => {
|
|
6605
6594
|
const style = {
|
|
6606
6595
|
left: arrowX !== null ? arrowX : void 0,
|
|
6607
6596
|
top: arrowY !== null ? arrowY : void 0,
|
|
@@ -6611,12 +6600,12 @@ const Tooltip = react.forwardRef(function Tooltip2(props, ref) {
|
|
|
6611
6600
|
if (staticSide) style[staticSide] = -15;
|
|
6612
6601
|
return style;
|
|
6613
6602
|
}, [arrowX, arrowY, staticSide]);
|
|
6614
|
-
const [isOpen, setIsOpen] =
|
|
6615
|
-
const handleBlur =
|
|
6616
|
-
const handleFocus =
|
|
6617
|
-
const handleMouseEnter =
|
|
6618
|
-
const handleMouseLeave =
|
|
6619
|
-
|
|
6603
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
6604
|
+
const handleBlur = useCallback(() => setIsOpen(false), []);
|
|
6605
|
+
const handleFocus = useCallback(() => setIsOpen(true), []);
|
|
6606
|
+
const handleMouseEnter = useCallback(() => setIsOpen(true), []);
|
|
6607
|
+
const handleMouseLeave = useCallback(() => setIsOpen(false), []);
|
|
6608
|
+
useEffect(() => {
|
|
6620
6609
|
if (!isOpen) return;
|
|
6621
6610
|
function handleWindowMouseMove(event) {
|
|
6622
6611
|
if (!referenceElement) return;
|
|
@@ -6631,23 +6620,23 @@ const Tooltip = react.forwardRef(function Tooltip2(props, ref) {
|
|
|
6631
6620
|
window.removeEventListener("mousemove", handleWindowMouseMove);
|
|
6632
6621
|
};
|
|
6633
6622
|
}, [isOpen, referenceElement]);
|
|
6634
|
-
|
|
6623
|
+
useEffect(() => {
|
|
6635
6624
|
if (disabled) setIsOpen(false);
|
|
6636
6625
|
}, [disabled]);
|
|
6637
|
-
|
|
6626
|
+
useEffect(() => {
|
|
6638
6627
|
if (!content) setIsOpen(false);
|
|
6639
6628
|
}, [content]);
|
|
6640
|
-
|
|
6641
|
-
const setArrow =
|
|
6629
|
+
useEffect(() => reference(referenceElement), [reference, referenceElement]);
|
|
6630
|
+
const setArrow = useCallback(arrowEl => {
|
|
6642
6631
|
arrowRef.current = arrowEl;
|
|
6643
6632
|
update();
|
|
6644
6633
|
}, [update]);
|
|
6645
|
-
const setFloating =
|
|
6634
|
+
const setFloating = useCallback(node => {
|
|
6646
6635
|
forwardedRef.current = node;
|
|
6647
6636
|
floating(node);
|
|
6648
6637
|
}, [floating, forwardedRef]);
|
|
6649
6638
|
const childRef = childProp == null ? void 0 : childProp.ref;
|
|
6650
|
-
const setReference =
|
|
6639
|
+
const setReference = useCallback(node => {
|
|
6651
6640
|
if (typeof childRef === "function") {
|
|
6652
6641
|
childRef(node);
|
|
6653
6642
|
} else if (childRef) {
|
|
@@ -6655,9 +6644,9 @@ const Tooltip = react.forwardRef(function Tooltip2(props, ref) {
|
|
|
6655
6644
|
}
|
|
6656
6645
|
setReferenceElement(node);
|
|
6657
6646
|
}, [childRef]);
|
|
6658
|
-
const child =
|
|
6647
|
+
const child = useMemo(() => {
|
|
6659
6648
|
if (!childProp) return null;
|
|
6660
|
-
return
|
|
6649
|
+
return cloneElement(childProp, {
|
|
6661
6650
|
onBlur: handleBlur,
|
|
6662
6651
|
onFocus: handleFocus,
|
|
6663
6652
|
onMouseEnter: handleMouseEnter,
|
|
@@ -6665,40 +6654,40 @@ const Tooltip = react.forwardRef(function Tooltip2(props, ref) {
|
|
|
6665
6654
|
ref: setReference
|
|
6666
6655
|
});
|
|
6667
6656
|
}, [childProp, handleBlur, handleFocus, handleMouseEnter, handleMouseLeave, setReference]);
|
|
6668
|
-
if (!child) return /* @__PURE__ */
|
|
6657
|
+
if (!child) return /* @__PURE__ */jsx(Fragment, {});
|
|
6669
6658
|
if (disabled) return child;
|
|
6670
|
-
const root = /* @__PURE__ */
|
|
6659
|
+
const root = /* @__PURE__ */jsx(Root$a, _objectSpread(_objectSpread({
|
|
6671
6660
|
"data-ui": "Tooltip"
|
|
6672
6661
|
}, restProps), {}, {
|
|
6673
6662
|
ref: setFloating,
|
|
6674
6663
|
style: rootStyle,
|
|
6675
6664
|
zOffset,
|
|
6676
|
-
children: /* @__PURE__ */
|
|
6665
|
+
children: /* @__PURE__ */jsxs(Card, {
|
|
6677
6666
|
"data-ui": "Tooltip__card",
|
|
6678
6667
|
"data-placement": placement,
|
|
6679
6668
|
padding,
|
|
6680
6669
|
radius: 2,
|
|
6681
6670
|
scheme,
|
|
6682
6671
|
shadow,
|
|
6683
|
-
children: [content, /* @__PURE__ */
|
|
6672
|
+
children: [content, /* @__PURE__ */jsx(TooltipArrow, {
|
|
6684
6673
|
ref: setArrow,
|
|
6685
6674
|
style: arrowStyle
|
|
6686
6675
|
})]
|
|
6687
6676
|
})
|
|
6688
6677
|
}));
|
|
6689
|
-
return /* @__PURE__ */
|
|
6690
|
-
children: [child, isOpen && /* @__PURE__ */
|
|
6691
|
-
children: portal ? /* @__PURE__ */
|
|
6678
|
+
return /* @__PURE__ */jsxs(Fragment, {
|
|
6679
|
+
children: [child, isOpen && /* @__PURE__ */jsx(Fragment, {
|
|
6680
|
+
children: portal ? /* @__PURE__ */jsx(Portal, {
|
|
6692
6681
|
__unstable_name: typeof portal === "string" ? portal : void 0,
|
|
6693
6682
|
children: root
|
|
6694
6683
|
}) : root
|
|
6695
6684
|
})]
|
|
6696
6685
|
});
|
|
6697
6686
|
});
|
|
6698
|
-
const Root$9 =
|
|
6699
|
-
const ListBox =
|
|
6700
|
-
const rotate =
|
|
6701
|
-
const AnimatedSpinnerIcon =
|
|
6687
|
+
const Root$9 = styled.div(_templateObject61 || (_templateObject61 = _taggedTemplateLiteral(["\n line-height: 0;\n"])));
|
|
6688
|
+
const ListBox = styled(Box)(_templateObject62 || (_templateObject62 = _taggedTemplateLiteral(["\n & > ul {\n list-style: none;\n padding: 0;\n margin: 0;\n }\n"])));
|
|
6689
|
+
const rotate = keyframes(_templateObject63 || (_templateObject63 = _taggedTemplateLiteral(["\n from {\n transform: rotate(0deg);\n }\n\n to {\n transform: rotate(360deg);\n }\n"])));
|
|
6690
|
+
const AnimatedSpinnerIcon = styled(SpinnerIcon)(_templateObject64 || (_templateObject64 = _taggedTemplateLiteral(["\n animation: ", " 500ms linear infinite;\n"])), rotate);
|
|
6702
6691
|
function AutocompleteOption(props) {
|
|
6703
6692
|
const {
|
|
6704
6693
|
children,
|
|
@@ -6707,17 +6696,17 @@ function AutocompleteOption(props) {
|
|
|
6707
6696
|
selected,
|
|
6708
6697
|
value
|
|
6709
6698
|
} = props;
|
|
6710
|
-
const handleClick =
|
|
6699
|
+
const handleClick = useCallback(() => {
|
|
6711
6700
|
setTimeout(() => {
|
|
6712
6701
|
onSelect(value);
|
|
6713
6702
|
}, 0);
|
|
6714
6703
|
}, [onSelect, value]);
|
|
6715
|
-
const handleKeyDown =
|
|
6704
|
+
const handleKeyDown = useCallback(event => {
|
|
6716
6705
|
if (event.key === "Enter" && !_isEnterToClickElement(event.currentTarget)) {
|
|
6717
6706
|
handleClick();
|
|
6718
6707
|
}
|
|
6719
6708
|
}, [handleClick]);
|
|
6720
|
-
return /* @__PURE__ */
|
|
6709
|
+
return /* @__PURE__ */jsx("li", {
|
|
6721
6710
|
"aria-selected": selected,
|
|
6722
6711
|
"data-ui": "AutocompleteOption",
|
|
6723
6712
|
id,
|
|
@@ -6789,7 +6778,7 @@ const AUTOCOMPLETE_POPOVER_PLACEMENT = "bottom-start";
|
|
|
6789
6778
|
const AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS = ["bottom-start", "top-start"];
|
|
6790
6779
|
const DEFAULT_RENDER_VALUE = (value, option) => option ? option.value : value;
|
|
6791
6780
|
const DEFAULT_FILTER_OPTION = (query, option) => option.value.toLowerCase().indexOf(query.toLowerCase()) > -1;
|
|
6792
|
-
const InnerAutocomplete =
|
|
6781
|
+
const InnerAutocomplete = forwardRef(function InnerAutocomplete2(props, ref) {
|
|
6793
6782
|
const {
|
|
6794
6783
|
border = true,
|
|
6795
6784
|
customValidity,
|
|
@@ -6820,7 +6809,7 @@ const InnerAutocomplete = react.forwardRef(function InnerAutocomplete2(props, re
|
|
|
6820
6809
|
value: valueProp
|
|
6821
6810
|
} = props,
|
|
6822
6811
|
restProps = _objectWithoutProperties(props, _excluded31);
|
|
6823
|
-
const [state, dispatch] =
|
|
6812
|
+
const [state, dispatch] = useReducer(autocompleteReducer, {
|
|
6824
6813
|
activeValue: valueProp || null,
|
|
6825
6814
|
focused: false,
|
|
6826
6815
|
listFocused: false,
|
|
@@ -6834,16 +6823,16 @@ const InnerAutocomplete = react.forwardRef(function InnerAutocomplete2(props, re
|
|
|
6834
6823
|
query,
|
|
6835
6824
|
value
|
|
6836
6825
|
} = state;
|
|
6837
|
-
const defaultRenderOption =
|
|
6826
|
+
const defaultRenderOption = useCallback(_ref22 => {
|
|
6838
6827
|
let {
|
|
6839
6828
|
value: value2
|
|
6840
6829
|
} = _ref22;
|
|
6841
|
-
return /* @__PURE__ */
|
|
6830
|
+
return /* @__PURE__ */jsx(Card, {
|
|
6842
6831
|
"data-as": "button",
|
|
6843
6832
|
padding: paddingProp,
|
|
6844
6833
|
radius: 2,
|
|
6845
6834
|
tone: "inherit",
|
|
6846
|
-
children: /* @__PURE__ */
|
|
6835
|
+
children: /* @__PURE__ */jsx(Text, {
|
|
6847
6836
|
size: fontSize,
|
|
6848
6837
|
textOverflow: "ellipsis",
|
|
6849
6838
|
children: value2
|
|
@@ -6852,24 +6841,24 @@ const InnerAutocomplete = react.forwardRef(function InnerAutocomplete2(props, re
|
|
|
6852
6841
|
}, [fontSize, paddingProp]);
|
|
6853
6842
|
const renderOption = typeof renderOptionProp === "function" ? renderOptionProp : defaultRenderOption;
|
|
6854
6843
|
const filterOption = typeof filterOptionProp === "function" ? filterOptionProp : DEFAULT_FILTER_OPTION;
|
|
6855
|
-
const rootElementRef =
|
|
6856
|
-
const resultsPopoverElementRef =
|
|
6857
|
-
const inputElementRef =
|
|
6858
|
-
const listBoxElementRef =
|
|
6859
|
-
const listFocusedRef =
|
|
6860
|
-
const valueRef =
|
|
6861
|
-
const valuePropRef =
|
|
6862
|
-
const popoverMouseWithinRef =
|
|
6844
|
+
const rootElementRef = useRef(null);
|
|
6845
|
+
const resultsPopoverElementRef = useRef(null);
|
|
6846
|
+
const inputElementRef = useRef(null);
|
|
6847
|
+
const listBoxElementRef = useRef(null);
|
|
6848
|
+
const listFocusedRef = useRef(false);
|
|
6849
|
+
const valueRef = useRef(value);
|
|
6850
|
+
const valuePropRef = useRef(valueProp);
|
|
6851
|
+
const popoverMouseWithinRef = useRef(false);
|
|
6863
6852
|
const forwardedRef = useForwardedRef(ref);
|
|
6864
6853
|
const listBoxId = "".concat(id, "-listbox");
|
|
6865
6854
|
const options = Array.isArray(optionsProp) ? optionsProp : EMPTY_ARRAY;
|
|
6866
6855
|
const padding = useArrayProp(paddingProp);
|
|
6867
|
-
const currentOption =
|
|
6868
|
-
const filteredOptions =
|
|
6856
|
+
const currentOption = useMemo(() => value !== null ? options.find(o => o.value === value) : void 0, [options, value]);
|
|
6857
|
+
const filteredOptions = useMemo(() => options.filter(option => query ? filterOption(query, option) : true), [filterOption, options, query]);
|
|
6869
6858
|
const filteredOptionsLen = filteredOptions.length;
|
|
6870
6859
|
const activeItemId = activeValue ? "".concat(id, "-option-").concat(activeValue) : void 0;
|
|
6871
6860
|
const expanded = query !== null && loading || focused && query !== null;
|
|
6872
|
-
const handleRootBlur =
|
|
6861
|
+
const handleRootBlur = useCallback(event => {
|
|
6873
6862
|
setTimeout(() => {
|
|
6874
6863
|
if (popoverMouseWithinRef.current) {
|
|
6875
6864
|
return;
|
|
@@ -6894,7 +6883,7 @@ const InnerAutocomplete = react.forwardRef(function InnerAutocomplete2(props, re
|
|
|
6894
6883
|
}
|
|
6895
6884
|
}, 0);
|
|
6896
6885
|
}, [onBlur, onQueryChange, relatedElements]);
|
|
6897
|
-
const handleRootFocus =
|
|
6886
|
+
const handleRootFocus = useCallback(event => {
|
|
6898
6887
|
const listBoxElement = listBoxElementRef.current;
|
|
6899
6888
|
const focusedElement = event.target instanceof HTMLElement ? event.target : null;
|
|
6900
6889
|
const listFocused2 = (listBoxElement == null ? void 0 : listBoxElement.contains(focusedElement)) || false;
|
|
@@ -6906,7 +6895,7 @@ const InnerAutocomplete = react.forwardRef(function InnerAutocomplete2(props, re
|
|
|
6906
6895
|
});
|
|
6907
6896
|
}
|
|
6908
6897
|
}, []);
|
|
6909
|
-
const handleOptionSelect =
|
|
6898
|
+
const handleOptionSelect = useCallback(v => {
|
|
6910
6899
|
var _a;
|
|
6911
6900
|
dispatch({
|
|
6912
6901
|
type: "value/change",
|
|
@@ -6919,7 +6908,7 @@ const InnerAutocomplete = react.forwardRef(function InnerAutocomplete2(props, re
|
|
|
6919
6908
|
if (onQueryChange) onQueryChange(null);
|
|
6920
6909
|
(_a = inputElementRef.current) == null ? void 0 : _a.focus();
|
|
6921
6910
|
}, [onChange, onSelect, onQueryChange]);
|
|
6922
|
-
const handleRootKeyDown =
|
|
6911
|
+
const handleRootKeyDown = useCallback(event => {
|
|
6923
6912
|
var _a, _b;
|
|
6924
6913
|
if (event.key === "ArrowDown") {
|
|
6925
6914
|
event.preventDefault();
|
|
@@ -6967,7 +6956,7 @@ const InnerAutocomplete = react.forwardRef(function InnerAutocomplete2(props, re
|
|
|
6967
6956
|
return;
|
|
6968
6957
|
}
|
|
6969
6958
|
}, [activeValue, filteredOptions, filteredOptionsLen, onQueryChange]);
|
|
6970
|
-
const handleInputChange =
|
|
6959
|
+
const handleInputChange = useCallback(event => {
|
|
6971
6960
|
const nextQuery = event.currentTarget.value;
|
|
6972
6961
|
dispatch({
|
|
6973
6962
|
type: "input/change",
|
|
@@ -6975,7 +6964,7 @@ const InnerAutocomplete = react.forwardRef(function InnerAutocomplete2(props, re
|
|
|
6975
6964
|
});
|
|
6976
6965
|
if (onQueryChange) onQueryChange(nextQuery);
|
|
6977
6966
|
}, [onQueryChange]);
|
|
6978
|
-
const handleInputFocus =
|
|
6967
|
+
const handleInputFocus = useCallback(event => {
|
|
6979
6968
|
if (!focused) {
|
|
6980
6969
|
dispatch({
|
|
6981
6970
|
type: "input/focus"
|
|
@@ -6983,13 +6972,13 @@ const InnerAutocomplete = react.forwardRef(function InnerAutocomplete2(props, re
|
|
|
6983
6972
|
if (onFocus) onFocus(event);
|
|
6984
6973
|
}
|
|
6985
6974
|
}, [focused, onFocus]);
|
|
6986
|
-
const handlePopoverMouseEnter =
|
|
6975
|
+
const handlePopoverMouseEnter = useCallback(() => {
|
|
6987
6976
|
popoverMouseWithinRef.current = true;
|
|
6988
6977
|
}, []);
|
|
6989
|
-
const handlePopoverMouseLeave =
|
|
6978
|
+
const handlePopoverMouseLeave = useCallback(() => {
|
|
6990
6979
|
popoverMouseWithinRef.current = false;
|
|
6991
6980
|
}, []);
|
|
6992
|
-
const handleClearButtonClick =
|
|
6981
|
+
const handleClearButtonClick = useCallback(() => {
|
|
6993
6982
|
var _a;
|
|
6994
6983
|
dispatch({
|
|
6995
6984
|
type: "root/clear"
|
|
@@ -6999,12 +6988,12 @@ const InnerAutocomplete = react.forwardRef(function InnerAutocomplete2(props, re
|
|
|
6999
6988
|
if (onQueryChange) onQueryChange(null);
|
|
7000
6989
|
(_a = inputElementRef.current) == null ? void 0 : _a.focus();
|
|
7001
6990
|
}, [onChange, onQueryChange]);
|
|
7002
|
-
const handleClearButtonFocus =
|
|
6991
|
+
const handleClearButtonFocus = useCallback(() => {
|
|
7003
6992
|
dispatch({
|
|
7004
6993
|
type: "input/focus"
|
|
7005
6994
|
});
|
|
7006
6995
|
}, []);
|
|
7007
|
-
|
|
6996
|
+
useEffect(() => {
|
|
7008
6997
|
if (valueProp !== valuePropRef.current) {
|
|
7009
6998
|
valuePropRef.current = valueProp;
|
|
7010
6999
|
if (valueProp !== void 0) {
|
|
@@ -7024,7 +7013,7 @@ const InnerAutocomplete = react.forwardRef(function InnerAutocomplete2(props, re
|
|
|
7024
7013
|
});
|
|
7025
7014
|
}
|
|
7026
7015
|
}, [valueProp]);
|
|
7027
|
-
|
|
7016
|
+
useEffect(() => {
|
|
7028
7017
|
if (!focused && valueRef.current) {
|
|
7029
7018
|
dispatch({
|
|
7030
7019
|
type: "root/setActiveValue",
|
|
@@ -7032,7 +7021,7 @@ const InnerAutocomplete = react.forwardRef(function InnerAutocomplete2(props, re
|
|
|
7032
7021
|
});
|
|
7033
7022
|
}
|
|
7034
7023
|
}, [focused]);
|
|
7035
|
-
|
|
7024
|
+
useEffect(() => {
|
|
7036
7025
|
const listElement = listBoxElementRef.current;
|
|
7037
7026
|
if (!listElement) return;
|
|
7038
7027
|
const activeOption = filteredOptions.find(o => o.value === activeValue);
|
|
@@ -7047,11 +7036,11 @@ const InnerAutocomplete = react.forwardRef(function InnerAutocomplete2(props, re
|
|
|
7047
7036
|
}
|
|
7048
7037
|
}
|
|
7049
7038
|
}, [activeValue, filteredOptions]);
|
|
7050
|
-
const setRef =
|
|
7039
|
+
const setRef = useCallback(el => {
|
|
7051
7040
|
inputElementRef.current = el;
|
|
7052
7041
|
forwardedRef.current = el;
|
|
7053
7042
|
}, [forwardedRef]);
|
|
7054
|
-
const clearButton =
|
|
7043
|
+
const clearButton = useMemo(() => {
|
|
7055
7044
|
if (!loading && !disabled && value) {
|
|
7056
7045
|
return {
|
|
7057
7046
|
"aria-label": "Clear",
|
|
@@ -7060,15 +7049,15 @@ const InnerAutocomplete = react.forwardRef(function InnerAutocomplete2(props, re
|
|
|
7060
7049
|
}
|
|
7061
7050
|
return void 0;
|
|
7062
7051
|
}, [disabled, handleClearButtonFocus, loading, value]);
|
|
7063
|
-
const openButtonBoxPadding =
|
|
7052
|
+
const openButtonBoxPadding = useMemo(() => padding.map(v => {
|
|
7064
7053
|
if (v === 0) return 0;
|
|
7065
7054
|
if (v === 1) return 1;
|
|
7066
7055
|
if (v === 2) return 1;
|
|
7067
7056
|
return v - 2;
|
|
7068
7057
|
}), [padding]);
|
|
7069
|
-
const openButtonPadding =
|
|
7070
|
-
const openButtonProps =
|
|
7071
|
-
const handleOpenClick =
|
|
7058
|
+
const openButtonPadding = useMemo(() => padding.map(v => Math.max(v - 1, 0)), [padding]);
|
|
7059
|
+
const openButtonProps = useMemo(() => typeof openButton === "object" ? openButton : EMPTY_RECORD, [openButton]);
|
|
7060
|
+
const handleOpenClick = useCallback(event => {
|
|
7072
7061
|
dispatch({
|
|
7073
7062
|
type: "root/open",
|
|
7074
7063
|
query: value ? renderValue(value, currentOption) : ""
|
|
@@ -7079,21 +7068,21 @@ const InnerAutocomplete = react.forwardRef(function InnerAutocomplete2(props, re
|
|
|
7079
7068
|
return (_a = inputElementRef.current) == null ? void 0 : _a.focus();
|
|
7080
7069
|
});
|
|
7081
7070
|
}, [currentOption, openButtonProps, renderValue, value]);
|
|
7082
|
-
const openButtonNode =
|
|
7071
|
+
const openButtonNode = useMemo(() => !disabled && !readOnly && openButton ? /* @__PURE__ */jsx(Box, {
|
|
7083
7072
|
"aria-hidden": expanded,
|
|
7084
7073
|
padding: openButtonBoxPadding,
|
|
7085
|
-
children: /* @__PURE__ */
|
|
7074
|
+
children: /* @__PURE__ */jsx(Button, _objectSpread(_objectSpread({
|
|
7086
7075
|
"aria-label": "Open",
|
|
7087
7076
|
disabled: expanded,
|
|
7088
7077
|
fontSize,
|
|
7089
|
-
icon:
|
|
7078
|
+
icon: ChevronDownIcon,
|
|
7090
7079
|
mode: "bleed",
|
|
7091
7080
|
padding: openButtonPadding
|
|
7092
7081
|
}, openButtonProps), {}, {
|
|
7093
7082
|
onClick: handleOpenClick
|
|
7094
7083
|
}))
|
|
7095
7084
|
}) : void 0, [disabled, expanded, fontSize, handleOpenClick, openButton, openButtonBoxPadding, openButtonPadding, openButtonProps, readOnly]);
|
|
7096
|
-
const inputValue =
|
|
7085
|
+
const inputValue = useMemo(() => {
|
|
7097
7086
|
if (query === null) {
|
|
7098
7087
|
if (value !== null) {
|
|
7099
7088
|
return renderValue(value, currentOption);
|
|
@@ -7102,7 +7091,7 @@ const InnerAutocomplete = react.forwardRef(function InnerAutocomplete2(props, re
|
|
|
7102
7091
|
}
|
|
7103
7092
|
return query;
|
|
7104
7093
|
}, [currentOption, query, renderValue, value]);
|
|
7105
|
-
const input = /* @__PURE__ */
|
|
7094
|
+
const input = /* @__PURE__ */jsx(TextInput, _objectSpread(_objectSpread({}, restProps), {}, {
|
|
7106
7095
|
"aria-activedescendant": activeItemId,
|
|
7107
7096
|
"aria-autocomplete": "list",
|
|
7108
7097
|
"aria-expanded": expanded,
|
|
@@ -7132,21 +7121,21 @@ const InnerAutocomplete = react.forwardRef(function InnerAutocomplete2(props, re
|
|
|
7132
7121
|
suffix: suffix || openButtonNode,
|
|
7133
7122
|
value: inputValue
|
|
7134
7123
|
}));
|
|
7135
|
-
const handleListBoxKeyDown =
|
|
7124
|
+
const handleListBoxKeyDown = useCallback(event => {
|
|
7136
7125
|
var _a;
|
|
7137
7126
|
if (event.key === "Tab") {
|
|
7138
7127
|
if (listFocused) (_a = inputElementRef.current) == null ? void 0 : _a.focus();
|
|
7139
7128
|
}
|
|
7140
7129
|
}, [listFocused]);
|
|
7141
|
-
const content =
|
|
7130
|
+
const content = useMemo(() => {
|
|
7142
7131
|
if (filteredOptions.length === 0) return null;
|
|
7143
|
-
return /* @__PURE__ */
|
|
7132
|
+
return /* @__PURE__ */jsx(ListBox, _objectSpread(_objectSpread({
|
|
7144
7133
|
"data-ui": "AutoComplete__results",
|
|
7145
7134
|
onKeyDown: handleListBoxKeyDown,
|
|
7146
7135
|
padding: 1
|
|
7147
7136
|
}, listBox), {}, {
|
|
7148
7137
|
tabIndex: -1,
|
|
7149
|
-
children: /* @__PURE__ */
|
|
7138
|
+
children: /* @__PURE__ */jsx(Stack, {
|
|
7150
7139
|
as: "ul",
|
|
7151
7140
|
"aria-multiselectable": false,
|
|
7152
7141
|
"data-ui": "AutoComplete__resultsList",
|
|
@@ -7156,12 +7145,12 @@ const InnerAutocomplete = react.forwardRef(function InnerAutocomplete2(props, re
|
|
|
7156
7145
|
space: 1,
|
|
7157
7146
|
children: filteredOptions.map(option => {
|
|
7158
7147
|
const active = activeValue !== null ? option.value === activeValue : currentOption === option;
|
|
7159
|
-
return /* @__PURE__ */
|
|
7148
|
+
return /* @__PURE__ */jsx(AutocompleteOption, {
|
|
7160
7149
|
id: "".concat(id, "-option-").concat(option.value),
|
|
7161
7150
|
onSelect: handleOptionSelect,
|
|
7162
7151
|
selected: active,
|
|
7163
7152
|
value: option.value,
|
|
7164
|
-
children:
|
|
7153
|
+
children: cloneElement(renderOption(option), {
|
|
7165
7154
|
disabled: loading,
|
|
7166
7155
|
selected: active,
|
|
7167
7156
|
tabIndex: listFocused && active ? 0 : -1
|
|
@@ -7171,7 +7160,7 @@ const InnerAutocomplete = react.forwardRef(function InnerAutocomplete2(props, re
|
|
|
7171
7160
|
})
|
|
7172
7161
|
}));
|
|
7173
7162
|
}, [activeValue, currentOption, filteredOptions, handleOptionSelect, handleListBoxKeyDown, id, listBox, listBoxId, listFocused, loading, renderOption]);
|
|
7174
|
-
const results =
|
|
7163
|
+
const results = useMemo(() => {
|
|
7175
7164
|
if (renderPopover) {
|
|
7176
7165
|
return renderPopover({
|
|
7177
7166
|
content,
|
|
@@ -7184,7 +7173,7 @@ const InnerAutocomplete = react.forwardRef(function InnerAutocomplete2(props, re
|
|
|
7184
7173
|
if (filteredOptionsLen === 0) {
|
|
7185
7174
|
return null;
|
|
7186
7175
|
}
|
|
7187
|
-
return /* @__PURE__ */
|
|
7176
|
+
return /* @__PURE__ */jsx(Popover, _objectSpread({
|
|
7188
7177
|
arrow: false,
|
|
7189
7178
|
constrainSize: true,
|
|
7190
7179
|
content,
|
|
@@ -7201,7 +7190,7 @@ const InnerAutocomplete = react.forwardRef(function InnerAutocomplete2(props, re
|
|
|
7201
7190
|
referenceElement: inputElementRef.current
|
|
7202
7191
|
}, popover));
|
|
7203
7192
|
}, [content, expanded, filteredOptionsLen, handlePopoverMouseEnter, handlePopoverMouseLeave, popover, radius, renderPopover]);
|
|
7204
|
-
return /* @__PURE__ */
|
|
7193
|
+
return /* @__PURE__ */jsxs(Root$9, {
|
|
7205
7194
|
"data-ui": "Autocomplete",
|
|
7206
7195
|
onBlur: handleRootBlur,
|
|
7207
7196
|
onFocus: handleRootFocus,
|
|
@@ -7211,9 +7200,9 @@ const InnerAutocomplete = react.forwardRef(function InnerAutocomplete2(props, re
|
|
|
7211
7200
|
});
|
|
7212
7201
|
});
|
|
7213
7202
|
const Autocomplete = InnerAutocomplete;
|
|
7214
|
-
const Root$8 =
|
|
7215
|
-
const ExpandButton =
|
|
7216
|
-
const Breadcrumbs =
|
|
7203
|
+
const Root$8 = styled.ol(_templateObject65 || (_templateObject65 = _taggedTemplateLiteral(["\n margin: 0;\n padding: 0;\n display: flex;\n list-style: none;\n align-items: center;\n white-space: nowrap;\n line-height: 0;\n"])));
|
|
7204
|
+
const ExpandButton = styled(Button)(_templateObject66 || (_templateObject66 = _taggedTemplateLiteral(["\n appearance: none;\n margin: -4px;\n"])));
|
|
7205
|
+
const Breadcrumbs = forwardRef(function Breadcrumbs2(props, ref) {
|
|
7217
7206
|
const {
|
|
7218
7207
|
children,
|
|
7219
7208
|
maxLength,
|
|
@@ -7222,23 +7211,23 @@ const Breadcrumbs = react.forwardRef(function Breadcrumbs2(props, ref) {
|
|
|
7222
7211
|
} = props,
|
|
7223
7212
|
restProps = _objectWithoutProperties(props, _excluded32);
|
|
7224
7213
|
const space = useArrayProp(spaceRaw);
|
|
7225
|
-
const [open, setOpen] =
|
|
7226
|
-
const [expandElement, setExpandElement] =
|
|
7227
|
-
const [popoverElement, setPopoverElement] =
|
|
7228
|
-
const collapse =
|
|
7229
|
-
const expand =
|
|
7214
|
+
const [open, setOpen] = useState(false);
|
|
7215
|
+
const [expandElement, setExpandElement] = useState(null);
|
|
7216
|
+
const [popoverElement, setPopoverElement] = useState(null);
|
|
7217
|
+
const collapse = useCallback(() => setOpen(false), []);
|
|
7218
|
+
const expand = useCallback(() => setOpen(true), []);
|
|
7230
7219
|
useClickOutside(collapse, [expandElement, popoverElement]);
|
|
7231
|
-
const rawItems =
|
|
7232
|
-
return
|
|
7220
|
+
const rawItems = useMemo(() => Children.toArray(children).filter(child => {
|
|
7221
|
+
return isValidElement(child);
|
|
7233
7222
|
}), [children]);
|
|
7234
|
-
const items =
|
|
7223
|
+
const items = useMemo(() => {
|
|
7235
7224
|
const len = rawItems.length;
|
|
7236
7225
|
if (maxLength && len > maxLength) {
|
|
7237
7226
|
const beforeLength = Math.ceil(maxLength / 2);
|
|
7238
7227
|
const afterLength = Math.floor(maxLength / 2);
|
|
7239
|
-
return [...rawItems.slice(0, beforeLength - 1), /* @__PURE__ */
|
|
7228
|
+
return [...rawItems.slice(0, beforeLength - 1), /* @__PURE__ */jsx(Popover, {
|
|
7240
7229
|
constrainSize: true,
|
|
7241
|
-
content: /* @__PURE__ */
|
|
7230
|
+
content: /* @__PURE__ */jsx(Stack, {
|
|
7242
7231
|
as: "ol",
|
|
7243
7232
|
overflow: "auto",
|
|
7244
7233
|
padding: space,
|
|
@@ -7249,7 +7238,7 @@ const Breadcrumbs = react.forwardRef(function Breadcrumbs2(props, ref) {
|
|
|
7249
7238
|
placement: "top",
|
|
7250
7239
|
portal: true,
|
|
7251
7240
|
ref: setPopoverElement,
|
|
7252
|
-
children: /* @__PURE__ */
|
|
7241
|
+
children: /* @__PURE__ */jsx(ExpandButton, {
|
|
7253
7242
|
fontSize: 1,
|
|
7254
7243
|
mode: "bleed",
|
|
7255
7244
|
onClick: open ? collapse : expand,
|
|
@@ -7262,20 +7251,20 @@ const Breadcrumbs = react.forwardRef(function Breadcrumbs2(props, ref) {
|
|
|
7262
7251
|
}
|
|
7263
7252
|
return rawItems;
|
|
7264
7253
|
}, [collapse, expand, maxLength, open, rawItems, space]);
|
|
7265
|
-
return /* @__PURE__ */
|
|
7254
|
+
return /* @__PURE__ */jsx(Root$8, _objectSpread(_objectSpread({
|
|
7266
7255
|
"data-ui": "Breadcrumbs"
|
|
7267
7256
|
}, restProps), {}, {
|
|
7268
7257
|
ref,
|
|
7269
|
-
children: items.map((item, itemIndex) => /* @__PURE__ */
|
|
7270
|
-
children: [itemIndex > 0 && /* @__PURE__ */
|
|
7258
|
+
children: items.map((item, itemIndex) => /* @__PURE__ */jsxs(Fragment$1, {
|
|
7259
|
+
children: [itemIndex > 0 && /* @__PURE__ */jsx(Box, {
|
|
7271
7260
|
"aria-hidden": true,
|
|
7272
7261
|
as: "li",
|
|
7273
7262
|
paddingX: space,
|
|
7274
|
-
children: separator || /* @__PURE__ */
|
|
7263
|
+
children: separator || /* @__PURE__ */jsx(Text, {
|
|
7275
7264
|
muted: true,
|
|
7276
7265
|
children: "/"
|
|
7277
7266
|
})
|
|
7278
|
-
}), /* @__PURE__ */
|
|
7267
|
+
}), /* @__PURE__ */jsx(Box, {
|
|
7279
7268
|
as: "li",
|
|
7280
7269
|
children: item
|
|
7281
7270
|
})]
|
|
@@ -7315,21 +7304,21 @@ function responsiveDialogPositionStyle(props) {
|
|
|
7315
7304
|
}));
|
|
7316
7305
|
}
|
|
7317
7306
|
const key$3 = Symbol.for("@sanity/ui/context/dialog");
|
|
7318
|
-
globalScope[key$3] = globalScope[key$3] ||
|
|
7307
|
+
globalScope[key$3] = globalScope[key$3] || createContext({
|
|
7319
7308
|
version: 0
|
|
7320
7309
|
});
|
|
7321
7310
|
const DialogContext = globalScope[key$3];
|
|
7322
7311
|
function useDialog() {
|
|
7323
|
-
return
|
|
7312
|
+
return useContext(DialogContext);
|
|
7324
7313
|
}
|
|
7325
|
-
const Root$7 =
|
|
7326
|
-
const DialogContainer =
|
|
7327
|
-
const DialogCardRoot =
|
|
7328
|
-
const DialogLayout =
|
|
7329
|
-
const DialogHeader =
|
|
7330
|
-
const DialogContent =
|
|
7331
|
-
const DialogFooter =
|
|
7332
|
-
const DialogCard =
|
|
7314
|
+
const Root$7 = styled(Layer)(responsivePaddingStyle, dialogStyle, responsiveDialogPositionStyle);
|
|
7315
|
+
const DialogContainer = styled(Container)(_templateObject67 || (_templateObject67 = _taggedTemplateLiteral(["\n &:not([hidden]) {\n display: flex;\n }\n width: 100%;\n height: 100%;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n"])));
|
|
7316
|
+
const DialogCardRoot = styled(Card)(_templateObject68 || (_templateObject68 = _taggedTemplateLiteral(["\n &:not([hidden]) {\n display: flex;\n }\n width: 100%;\n min-height: 0;\n max-height: 100%;\n overflow: hidden;\n"])));
|
|
7317
|
+
const DialogLayout = styled(Flex)(_templateObject69 || (_templateObject69 = _taggedTemplateLiteral(["\n flex: 1;\n min-height: 0;\n width: 100%;\n"])));
|
|
7318
|
+
const DialogHeader = styled(Card)(_templateObject70 || (_templateObject70 = _taggedTemplateLiteral(["\n position: relative;\n z-index: 2;\n\n &:after {\n content: '';\n display: block;\n position: absolute;\n left: 0;\n right: 0;\n bottom: -1px;\n border-bottom: 1px solid var(--card-hairline-soft-color);\n }\n"])));
|
|
7319
|
+
const DialogContent = styled(Box)(_templateObject71 || (_templateObject71 = _taggedTemplateLiteral(["\n position: relative;\n z-index: 1;\n overflow: auto;\n outline: none;\n"])));
|
|
7320
|
+
const DialogFooter = styled(Box)(_templateObject72 || (_templateObject72 = _taggedTemplateLiteral(["\n position: relative;\n z-index: 3;\n border-top: 1px solid var(--card-hairline-soft-color);\n"])));
|
|
7321
|
+
const DialogCard = forwardRef(function DialogCard2(props, ref) {
|
|
7333
7322
|
const {
|
|
7334
7323
|
__unstable_autoFocus: autoFocus,
|
|
7335
7324
|
__unstable_hideCloseButton: hideCloseButton,
|
|
@@ -7349,8 +7338,8 @@ const DialogCard = react.forwardRef(function DialogCard2(props, ref) {
|
|
|
7349
7338
|
const shadow = useArrayProp(shadowProp);
|
|
7350
7339
|
const width = useArrayProp(widthProp);
|
|
7351
7340
|
const forwardedRef = useForwardedRef(ref);
|
|
7352
|
-
const [rootElement, setRootElement] =
|
|
7353
|
-
const localContentRef =
|
|
7341
|
+
const [rootElement, setRootElement] = useState(null);
|
|
7342
|
+
const localContentRef = useRef(null);
|
|
7354
7343
|
const layer = useLayer();
|
|
7355
7344
|
const {
|
|
7356
7345
|
isTopLayer
|
|
@@ -7358,13 +7347,13 @@ const DialogCard = react.forwardRef(function DialogCard2(props, ref) {
|
|
|
7358
7347
|
const labelId = "".concat(id, "_label");
|
|
7359
7348
|
const showCloseButton = Boolean(onClose) && hideCloseButton === false;
|
|
7360
7349
|
const showHeader = Boolean(header) || showCloseButton;
|
|
7361
|
-
|
|
7350
|
+
useEffect(() => {
|
|
7362
7351
|
if (!autoFocus) return;
|
|
7363
7352
|
if (forwardedRef.current) {
|
|
7364
7353
|
focusFirstDescendant(forwardedRef.current);
|
|
7365
7354
|
}
|
|
7366
7355
|
}, [autoFocus, forwardedRef]);
|
|
7367
|
-
useGlobalKeyDown(
|
|
7356
|
+
useGlobalKeyDown(useCallback(event => {
|
|
7368
7357
|
if (!isTopLayer || !onClose) return;
|
|
7369
7358
|
if (event.key === "Escape") {
|
|
7370
7359
|
event.preventDefault();
|
|
@@ -7372,63 +7361,63 @@ const DialogCard = react.forwardRef(function DialogCard2(props, ref) {
|
|
|
7372
7361
|
onClose();
|
|
7373
7362
|
}
|
|
7374
7363
|
}, [isTopLayer, onClose]));
|
|
7375
|
-
useClickOutside(
|
|
7364
|
+
useClickOutside(useCallback(() => {
|
|
7376
7365
|
if (!isTopLayer || !onClickOutside) return;
|
|
7377
7366
|
onClickOutside();
|
|
7378
7367
|
}, [isTopLayer, onClickOutside]), [rootElement]);
|
|
7379
|
-
const setRef =
|
|
7368
|
+
const setRef = useCallback(el => {
|
|
7380
7369
|
setRootElement(el);
|
|
7381
7370
|
forwardedRef.current = el;
|
|
7382
7371
|
}, [forwardedRef]);
|
|
7383
|
-
const setContentRef =
|
|
7372
|
+
const setContentRef = useCallback(el => {
|
|
7384
7373
|
localContentRef.current = el;
|
|
7385
7374
|
if (typeof contentRef === "function") contentRef(el);else if (contentRef) contentRef.current = el;
|
|
7386
7375
|
}, [contentRef]);
|
|
7387
|
-
return /* @__PURE__ */
|
|
7376
|
+
return /* @__PURE__ */jsx(DialogContainer, {
|
|
7388
7377
|
"data-ui": "DialogCard",
|
|
7389
7378
|
width,
|
|
7390
|
-
children: /* @__PURE__ */
|
|
7379
|
+
children: /* @__PURE__ */jsx(DialogCardRoot, {
|
|
7391
7380
|
radius,
|
|
7392
7381
|
ref: setRef,
|
|
7393
7382
|
scheme,
|
|
7394
7383
|
shadow,
|
|
7395
|
-
children: /* @__PURE__ */
|
|
7384
|
+
children: /* @__PURE__ */jsxs(DialogLayout, {
|
|
7396
7385
|
direction: "column",
|
|
7397
|
-
children: [showHeader && /* @__PURE__ */
|
|
7398
|
-
children: /* @__PURE__ */
|
|
7399
|
-
children: [/* @__PURE__ */
|
|
7386
|
+
children: [showHeader && /* @__PURE__ */jsx(DialogHeader, {
|
|
7387
|
+
children: /* @__PURE__ */jsxs(Flex, {
|
|
7388
|
+
children: [/* @__PURE__ */jsx(Box, {
|
|
7400
7389
|
flex: 1,
|
|
7401
7390
|
padding: 4,
|
|
7402
|
-
children: header && /* @__PURE__ */
|
|
7391
|
+
children: header && /* @__PURE__ */jsx(Text, {
|
|
7403
7392
|
id: labelId,
|
|
7404
7393
|
weight: "semibold",
|
|
7405
7394
|
children: header
|
|
7406
7395
|
})
|
|
7407
|
-
}), showCloseButton && /* @__PURE__ */
|
|
7396
|
+
}), showCloseButton && /* @__PURE__ */jsx(Box, {
|
|
7408
7397
|
padding: 2,
|
|
7409
|
-
children: /* @__PURE__ */
|
|
7398
|
+
children: /* @__PURE__ */jsx(Button, {
|
|
7410
7399
|
"aria-label": "Close dialog",
|
|
7411
7400
|
disabled: !onClose,
|
|
7412
|
-
icon:
|
|
7401
|
+
icon: CloseIcon,
|
|
7413
7402
|
mode: "bleed",
|
|
7414
7403
|
onClick: onClose,
|
|
7415
7404
|
padding: 3
|
|
7416
7405
|
})
|
|
7417
7406
|
})]
|
|
7418
7407
|
})
|
|
7419
|
-
}), /* @__PURE__ */
|
|
7408
|
+
}), /* @__PURE__ */jsx(DialogContent, {
|
|
7420
7409
|
flex: 1,
|
|
7421
7410
|
ref: setContentRef,
|
|
7422
7411
|
tabIndex: -1,
|
|
7423
7412
|
children
|
|
7424
|
-
}), footer && /* @__PURE__ */
|
|
7413
|
+
}), footer && /* @__PURE__ */jsx(DialogFooter, {
|
|
7425
7414
|
children: footer
|
|
7426
7415
|
})]
|
|
7427
7416
|
})
|
|
7428
7417
|
})
|
|
7429
7418
|
});
|
|
7430
7419
|
});
|
|
7431
|
-
const Dialog =
|
|
7420
|
+
const Dialog = forwardRef(function Dialog2(props, ref) {
|
|
7432
7421
|
var _a;
|
|
7433
7422
|
const dialog = useDialog();
|
|
7434
7423
|
const theme = useTheme();
|
|
@@ -7457,10 +7446,10 @@ const Dialog = react.forwardRef(function Dialog2(props, ref) {
|
|
|
7457
7446
|
const position = useArrayProp(positionProp);
|
|
7458
7447
|
const width = useArrayProp(widthProp);
|
|
7459
7448
|
const zOffset = useArrayProp(zOffsetProp);
|
|
7460
|
-
const preDivRef =
|
|
7461
|
-
const postDivRef =
|
|
7462
|
-
const cardRef =
|
|
7463
|
-
const handleFocus =
|
|
7449
|
+
const preDivRef = useRef(null);
|
|
7450
|
+
const postDivRef = useRef(null);
|
|
7451
|
+
const cardRef = useRef(null);
|
|
7452
|
+
const handleFocus = useCallback(event => {
|
|
7464
7453
|
const target = event.target;
|
|
7465
7454
|
const cardElement = cardRef.current;
|
|
7466
7455
|
if (!cardElement) {
|
|
@@ -7476,9 +7465,9 @@ const Dialog = react.forwardRef(function Dialog2(props, ref) {
|
|
|
7476
7465
|
}
|
|
7477
7466
|
}, []);
|
|
7478
7467
|
const labelId = "".concat(id, "_label");
|
|
7479
|
-
return /* @__PURE__ */
|
|
7468
|
+
return /* @__PURE__ */jsx(Portal, {
|
|
7480
7469
|
__unstable_name: portal,
|
|
7481
|
-
children: /* @__PURE__ */
|
|
7470
|
+
children: /* @__PURE__ */jsxs(Root$7, _objectSpread(_objectSpread({}, restProps), {}, {
|
|
7482
7471
|
$padding: padding,
|
|
7483
7472
|
$position: position,
|
|
7484
7473
|
"aria-labelledby": labelId,
|
|
@@ -7489,10 +7478,10 @@ const Dialog = react.forwardRef(function Dialog2(props, ref) {
|
|
|
7489
7478
|
ref,
|
|
7490
7479
|
role: "dialog",
|
|
7491
7480
|
zOffset,
|
|
7492
|
-
children: [/* @__PURE__ */
|
|
7481
|
+
children: [/* @__PURE__ */jsx("div", {
|
|
7493
7482
|
ref: preDivRef,
|
|
7494
7483
|
tabIndex: 0
|
|
7495
|
-
}), /* @__PURE__ */
|
|
7484
|
+
}), /* @__PURE__ */jsx(DialogCard, {
|
|
7496
7485
|
__unstable_autoFocus: autoFocus,
|
|
7497
7486
|
__unstable_hideCloseButton: hideCloseButton,
|
|
7498
7487
|
contentRef,
|
|
@@ -7507,7 +7496,7 @@ const Dialog = react.forwardRef(function Dialog2(props, ref) {
|
|
|
7507
7496
|
shadow: cardShadow,
|
|
7508
7497
|
width,
|
|
7509
7498
|
children
|
|
7510
|
-
}), /* @__PURE__ */
|
|
7499
|
+
}), /* @__PURE__ */jsx("div", {
|
|
7511
7500
|
ref: postDivRef,
|
|
7512
7501
|
tabIndex: 0
|
|
7513
7502
|
})]
|
|
@@ -7520,19 +7509,19 @@ function DialogProvider(props) {
|
|
|
7520
7509
|
position,
|
|
7521
7510
|
zOffset
|
|
7522
7511
|
} = props;
|
|
7523
|
-
const contextValue =
|
|
7512
|
+
const contextValue = useMemo(() => ({
|
|
7524
7513
|
version: 0,
|
|
7525
7514
|
position,
|
|
7526
7515
|
zOffset
|
|
7527
7516
|
}), [position, zOffset]);
|
|
7528
|
-
return /* @__PURE__ */
|
|
7517
|
+
return /* @__PURE__ */jsx(DialogContext.Provider, {
|
|
7529
7518
|
value: contextValue,
|
|
7530
7519
|
children
|
|
7531
7520
|
});
|
|
7532
7521
|
}
|
|
7533
|
-
const Root$6 =
|
|
7534
|
-
const Key =
|
|
7535
|
-
const Hotkeys =
|
|
7522
|
+
const Root$6 = styled.kbd(_templateObject73 || (_templateObject73 = _taggedTemplateLiteral(["\n &:not([hidden]) {\n display: block;\n }\n font: inherit;\n"])));
|
|
7523
|
+
const Key = styled(KBD)(_templateObject74 || (_templateObject74 = _taggedTemplateLiteral(["\n &:not([hidden]) {\n display: block;\n }\n"])));
|
|
7524
|
+
const Hotkeys = forwardRef(function Hotkeys2(props, ref) {
|
|
7536
7525
|
const {
|
|
7537
7526
|
fontSize,
|
|
7538
7527
|
keys,
|
|
@@ -7543,16 +7532,16 @@ const Hotkeys = react.forwardRef(function Hotkeys2(props, ref) {
|
|
|
7543
7532
|
restProps = _objectWithoutProperties(props, _excluded34);
|
|
7544
7533
|
const space = useArrayProp(spaceProp);
|
|
7545
7534
|
if (!keys || keys.length === 0) {
|
|
7546
|
-
return /* @__PURE__ */
|
|
7535
|
+
return /* @__PURE__ */jsx(Fragment, {});
|
|
7547
7536
|
}
|
|
7548
|
-
return /* @__PURE__ */
|
|
7537
|
+
return /* @__PURE__ */jsx(Root$6, _objectSpread(_objectSpread({
|
|
7549
7538
|
"data-ui": "Hotkeys"
|
|
7550
7539
|
}, restProps), {}, {
|
|
7551
7540
|
ref,
|
|
7552
|
-
children: /* @__PURE__ */
|
|
7541
|
+
children: /* @__PURE__ */jsx(Inline, {
|
|
7553
7542
|
as: "span",
|
|
7554
7543
|
space,
|
|
7555
|
-
children: keys.map((key, i) => /* @__PURE__ */
|
|
7544
|
+
children: keys.map((key, i) => /* @__PURE__ */jsx(Key, {
|
|
7556
7545
|
fontSize,
|
|
7557
7546
|
padding,
|
|
7558
7547
|
radius,
|
|
@@ -7562,7 +7551,7 @@ const Hotkeys = react.forwardRef(function Hotkeys2(props, ref) {
|
|
|
7562
7551
|
}));
|
|
7563
7552
|
});
|
|
7564
7553
|
const key$2 = Symbol.for("@sanity/ui/context/menu");
|
|
7565
|
-
globalScope[key$2] = globalScope[key$2] ||
|
|
7554
|
+
globalScope[key$2] = globalScope[key$2] || createContext(null);
|
|
7566
7555
|
const MenuContext = globalScope[key$2];
|
|
7567
7556
|
function _isFocusable(element) {
|
|
7568
7557
|
return isHTMLAnchorElement(element) && element.getAttribute("data-disabled") !== "true" || isHTMLButtonElement(element) && !element.disabled;
|
|
@@ -7614,17 +7603,17 @@ function useMenuController(props) {
|
|
|
7614
7603
|
originElement,
|
|
7615
7604
|
shouldFocus
|
|
7616
7605
|
} = props;
|
|
7617
|
-
const elementsRef =
|
|
7618
|
-
const [rootElement, setRootElement] =
|
|
7619
|
-
const [activeIndex, _setActiveIndex] =
|
|
7620
|
-
const activeIndexRef =
|
|
7606
|
+
const elementsRef = useRef([]);
|
|
7607
|
+
const [rootElement, setRootElement] = useState(null);
|
|
7608
|
+
const [activeIndex, _setActiveIndex] = useState(-1);
|
|
7609
|
+
const activeIndexRef = useRef(activeIndex);
|
|
7621
7610
|
const activeElement = elementsRef.current[activeIndex] || null;
|
|
7622
7611
|
const mounted = Boolean(rootElement);
|
|
7623
|
-
const setActiveIndex =
|
|
7612
|
+
const setActiveIndex = useCallback(nextActiveIndex => {
|
|
7624
7613
|
_setActiveIndex(nextActiveIndex);
|
|
7625
7614
|
activeIndexRef.current = nextActiveIndex;
|
|
7626
7615
|
}, []);
|
|
7627
|
-
const mount =
|
|
7616
|
+
const mount = useCallback((element, selected) => {
|
|
7628
7617
|
if (!element) return () => void 0;
|
|
7629
7618
|
if (elementsRef.current.indexOf(element) === -1) {
|
|
7630
7619
|
elementsRef.current.push(element);
|
|
@@ -7641,7 +7630,7 @@ function useMenuController(props) {
|
|
|
7641
7630
|
}
|
|
7642
7631
|
};
|
|
7643
7632
|
}, [rootElement, setActiveIndex]);
|
|
7644
|
-
const handleKeyDown =
|
|
7633
|
+
const handleKeyDown = useCallback(event => {
|
|
7645
7634
|
if (event.key === "Tab") {
|
|
7646
7635
|
if (originElement) {
|
|
7647
7636
|
originElement.focus();
|
|
@@ -7700,16 +7689,16 @@ function useMenuController(props) {
|
|
|
7700
7689
|
onKeyDown(event);
|
|
7701
7690
|
}
|
|
7702
7691
|
}, [onKeyDown, originElement, setActiveIndex]);
|
|
7703
|
-
const handleItemMouseEnter =
|
|
7692
|
+
const handleItemMouseEnter = useCallback(event => {
|
|
7704
7693
|
const element = event.currentTarget;
|
|
7705
7694
|
const currentIndex = elementsRef.current.indexOf(element);
|
|
7706
7695
|
setActiveIndex(currentIndex);
|
|
7707
7696
|
}, [setActiveIndex]);
|
|
7708
|
-
const handleItemMouseLeave =
|
|
7697
|
+
const handleItemMouseLeave = useCallback(() => {
|
|
7709
7698
|
rootElement == null ? void 0 : rootElement.focus();
|
|
7710
7699
|
setActiveIndex(-1);
|
|
7711
7700
|
}, [rootElement, setActiveIndex]);
|
|
7712
|
-
|
|
7701
|
+
useEffect(() => {
|
|
7713
7702
|
if (!mounted) return;
|
|
7714
7703
|
const rafId = window.requestAnimationFrame(() => {
|
|
7715
7704
|
const _activeIndex = activeIndexRef.current;
|
|
@@ -7752,8 +7741,8 @@ function useMenuController(props) {
|
|
|
7752
7741
|
setRootElement
|
|
7753
7742
|
};
|
|
7754
7743
|
}
|
|
7755
|
-
const Root$5 =
|
|
7756
|
-
const Menu =
|
|
7744
|
+
const Root$5 = styled(Box)(_templateObject75 || (_templateObject75 = _taggedTemplateLiteral(["\n outline: none;\n overflow: auto;\n"])));
|
|
7745
|
+
const Menu = forwardRef(function Menu2(props, ref) {
|
|
7757
7746
|
const {
|
|
7758
7747
|
children,
|
|
7759
7748
|
focusFirst,
|
|
@@ -7788,26 +7777,26 @@ const Menu = react.forwardRef(function Menu2(props, ref) {
|
|
|
7788
7777
|
originElement,
|
|
7789
7778
|
shouldFocus
|
|
7790
7779
|
});
|
|
7791
|
-
const handleRefChange =
|
|
7780
|
+
const handleRefChange = useCallback(el => {
|
|
7792
7781
|
setRootElement(el);
|
|
7793
7782
|
forwardedRef.current = el;
|
|
7794
7783
|
}, [forwardedRef, setRootElement]);
|
|
7795
|
-
|
|
7784
|
+
useEffect(() => {
|
|
7796
7785
|
if (onItemSelect) onItemSelect(activeIndex);
|
|
7797
7786
|
}, [activeIndex, onItemSelect]);
|
|
7798
|
-
useClickOutside(
|
|
7799
|
-
useGlobalKeyDown(
|
|
7787
|
+
useClickOutside(useCallback(event => isTopLayer && onClickOutside && onClickOutside(event), [isTopLayer, onClickOutside]), [rootElement]);
|
|
7788
|
+
useGlobalKeyDown(useCallback(event => {
|
|
7800
7789
|
if (!isTopLayer) return;
|
|
7801
7790
|
if (event.key === "Escape") {
|
|
7802
7791
|
event.stopPropagation();
|
|
7803
7792
|
if (onEscape) onEscape();
|
|
7804
7793
|
}
|
|
7805
7794
|
}, [isTopLayer, onEscape]));
|
|
7806
|
-
|
|
7795
|
+
useEffect(() => {
|
|
7807
7796
|
if (!rootElement || !registerElement) return;
|
|
7808
7797
|
return registerElement(rootElement);
|
|
7809
7798
|
}, [registerElement, rootElement]);
|
|
7810
|
-
const value =
|
|
7799
|
+
const value = useMemo(() => ({
|
|
7811
7800
|
version: 0,
|
|
7812
7801
|
activeElement,
|
|
7813
7802
|
activeIndex,
|
|
@@ -7821,9 +7810,9 @@ const Menu = react.forwardRef(function Menu2(props, ref) {
|
|
|
7821
7810
|
onMouseEnter: handleItemMouseEnter,
|
|
7822
7811
|
onMouseLeave: handleItemMouseLeave
|
|
7823
7812
|
}), [activeElement, activeIndex, mount, handleItemMouseEnter, handleItemMouseLeave, onClickOutside, onEscape, onItemClick, registerElement]);
|
|
7824
|
-
return /* @__PURE__ */
|
|
7813
|
+
return /* @__PURE__ */jsx(MenuContext.Provider, {
|
|
7825
7814
|
value,
|
|
7826
|
-
children: /* @__PURE__ */
|
|
7815
|
+
children: /* @__PURE__ */jsx(Root$5, _objectSpread(_objectSpread({
|
|
7827
7816
|
"data-ui": "Menu"
|
|
7828
7817
|
}, restProps), {}, {
|
|
7829
7818
|
onKeyDown: handleKeyDown,
|
|
@@ -7831,14 +7820,14 @@ const Menu = react.forwardRef(function Menu2(props, ref) {
|
|
|
7831
7820
|
ref: handleRefChange,
|
|
7832
7821
|
role: "menu",
|
|
7833
7822
|
tabIndex: -1,
|
|
7834
|
-
children: /* @__PURE__ */
|
|
7823
|
+
children: /* @__PURE__ */jsx(Stack, {
|
|
7835
7824
|
space,
|
|
7836
7825
|
children
|
|
7837
7826
|
})
|
|
7838
7827
|
}))
|
|
7839
7828
|
});
|
|
7840
7829
|
});
|
|
7841
|
-
const MenuButton =
|
|
7830
|
+
const MenuButton = forwardRef(function MenuButton2(props, ref) {
|
|
7842
7831
|
const {
|
|
7843
7832
|
__unstable_disableRestoreFocusOnClose: disableRestoreFocusOnClose = false,
|
|
7844
7833
|
boundaryElement: deprecated_boundaryElement,
|
|
@@ -7853,24 +7842,24 @@ const MenuButton = react.forwardRef(function MenuButton2(props, ref) {
|
|
|
7853
7842
|
popoverRadius: deprecated_popoverRadius,
|
|
7854
7843
|
preventOverflow: deprecated_preventOverflow
|
|
7855
7844
|
} = props;
|
|
7856
|
-
const [open, setOpen] =
|
|
7857
|
-
const [shouldFocus, setShouldFocus] =
|
|
7858
|
-
const [buttonElement, setButtonElement] =
|
|
7859
|
-
const [menuElements, setChildMenuElements] =
|
|
7860
|
-
const openRef =
|
|
7861
|
-
|
|
7845
|
+
const [open, setOpen] = useState(false);
|
|
7846
|
+
const [shouldFocus, setShouldFocus] = useState(null);
|
|
7847
|
+
const [buttonElement, setButtonElement] = useState(null);
|
|
7848
|
+
const [menuElements, setChildMenuElements] = useState([]);
|
|
7849
|
+
const openRef = useRef(open);
|
|
7850
|
+
useEffect(() => {
|
|
7862
7851
|
if (onClose && !open && openRef.current) {
|
|
7863
7852
|
onClose();
|
|
7864
7853
|
}
|
|
7865
7854
|
}, [onClose, open]);
|
|
7866
|
-
|
|
7855
|
+
useEffect(() => {
|
|
7867
7856
|
openRef.current = open;
|
|
7868
7857
|
}, [open]);
|
|
7869
|
-
const handleButtonClick =
|
|
7858
|
+
const handleButtonClick = useCallback(() => {
|
|
7870
7859
|
setOpen(v => !v);
|
|
7871
7860
|
setShouldFocus(null);
|
|
7872
7861
|
}, []);
|
|
7873
|
-
const handleButtonKeyDown =
|
|
7862
|
+
const handleButtonKeyDown = useCallback(event => {
|
|
7874
7863
|
if (event.key === "ArrowDown" || event.key === "Enter" || event.key === " ") {
|
|
7875
7864
|
event.preventDefault();
|
|
7876
7865
|
setOpen(true);
|
|
@@ -7884,7 +7873,7 @@ const MenuButton = react.forwardRef(function MenuButton2(props, ref) {
|
|
|
7884
7873
|
return;
|
|
7885
7874
|
}
|
|
7886
7875
|
}, []);
|
|
7887
|
-
const handleMenuClickOutside =
|
|
7876
|
+
const handleMenuClickOutside = useCallback(event => {
|
|
7888
7877
|
const target = event.target;
|
|
7889
7878
|
if (!(target instanceof Node)) {
|
|
7890
7879
|
return;
|
|
@@ -7899,12 +7888,12 @@ const MenuButton = react.forwardRef(function MenuButton2(props, ref) {
|
|
|
7899
7888
|
}
|
|
7900
7889
|
setOpen(false);
|
|
7901
7890
|
}, [buttonElement, menuElements]);
|
|
7902
|
-
const handleMenuEscape =
|
|
7891
|
+
const handleMenuEscape = useCallback(() => {
|
|
7903
7892
|
setOpen(false);
|
|
7904
7893
|
if (disableRestoreFocusOnClose) return;
|
|
7905
7894
|
if (buttonElement) buttonElement.focus();
|
|
7906
7895
|
}, [buttonElement, disableRestoreFocusOnClose]);
|
|
7907
|
-
const handleBlur =
|
|
7896
|
+
const handleBlur = useCallback(event => {
|
|
7908
7897
|
const target = event.relatedTarget;
|
|
7909
7898
|
if (!(target instanceof Node)) {
|
|
7910
7899
|
return;
|
|
@@ -7916,12 +7905,12 @@ const MenuButton = react.forwardRef(function MenuButton2(props, ref) {
|
|
|
7916
7905
|
}
|
|
7917
7906
|
setOpen(false);
|
|
7918
7907
|
}, [menuElements]);
|
|
7919
|
-
const handleItemClick =
|
|
7908
|
+
const handleItemClick = useCallback(() => {
|
|
7920
7909
|
setOpen(false);
|
|
7921
7910
|
if (disableRestoreFocusOnClose) return;
|
|
7922
7911
|
if (buttonElement) buttonElement.focus();
|
|
7923
7912
|
}, [buttonElement, disableRestoreFocusOnClose]);
|
|
7924
|
-
const registerElement =
|
|
7913
|
+
const registerElement = useCallback(el => {
|
|
7925
7914
|
setChildMenuElements(els => els.concat([el]));
|
|
7926
7915
|
return () => {
|
|
7927
7916
|
setChildMenuElements(els => {
|
|
@@ -7929,7 +7918,7 @@ const MenuButton = react.forwardRef(function MenuButton2(props, ref) {
|
|
|
7929
7918
|
});
|
|
7930
7919
|
};
|
|
7931
7920
|
}, []);
|
|
7932
|
-
const menuProps =
|
|
7921
|
+
const menuProps = useMemo(() => ({
|
|
7933
7922
|
"aria-labelledby": id,
|
|
7934
7923
|
onBlurCapture: handleBlur,
|
|
7935
7924
|
onClickOutside: handleMenuClickOutside,
|
|
@@ -7939,8 +7928,8 @@ const MenuButton = react.forwardRef(function MenuButton2(props, ref) {
|
|
|
7939
7928
|
registerElement,
|
|
7940
7929
|
shouldFocus
|
|
7941
7930
|
}), [buttonElement, handleMenuClickOutside, handleMenuEscape, handleItemClick, id, handleBlur, registerElement, shouldFocus]);
|
|
7942
|
-
const menu =
|
|
7943
|
-
const setButtonRef =
|
|
7931
|
+
const menu = isElement$1(menuProp) ? cloneElement(menuProp, menuProps) : null;
|
|
7932
|
+
const setButtonRef = useCallback(el => {
|
|
7944
7933
|
if (typeof ref === "function") {
|
|
7945
7934
|
ref(el);
|
|
7946
7935
|
} else if (ref) {
|
|
@@ -7948,7 +7937,7 @@ const MenuButton = react.forwardRef(function MenuButton2(props, ref) {
|
|
|
7948
7937
|
}
|
|
7949
7938
|
setButtonElement(el);
|
|
7950
7939
|
}, [ref]);
|
|
7951
|
-
const button =
|
|
7940
|
+
const button = useMemo(() => isElement$1(buttonProp) ? cloneElement(buttonProp, {
|
|
7952
7941
|
"data-ui": "MenuButton",
|
|
7953
7942
|
id,
|
|
7954
7943
|
onClick: handleButtonClick,
|
|
@@ -7958,7 +7947,7 @@ const MenuButton = react.forwardRef(function MenuButton2(props, ref) {
|
|
|
7958
7947
|
ref: setButtonRef,
|
|
7959
7948
|
selected: open
|
|
7960
7949
|
}) : null, [buttonProp, handleButtonClick, handleButtonKeyDown, id, open, setButtonRef]);
|
|
7961
|
-
const popoverProps =
|
|
7950
|
+
const popoverProps = useMemo(() => _objectSpread({
|
|
7962
7951
|
boundaryElement: deprecated_boundaryElement,
|
|
7963
7952
|
overflow: "auto",
|
|
7964
7953
|
placement: deprecated_placement,
|
|
@@ -7967,17 +7956,17 @@ const MenuButton = react.forwardRef(function MenuButton2(props, ref) {
|
|
|
7967
7956
|
radius: deprecated_popoverRadius,
|
|
7968
7957
|
scheme: deprecated_popoverScheme
|
|
7969
7958
|
}, popover || {}), [deprecated_boundaryElement, deprecated_placement, deprecated_popoverRadius, deprecated_popoverScheme, deprecated_portal, deprecated_preventOverflow, popover]);
|
|
7970
|
-
return /* @__PURE__ */
|
|
7959
|
+
return /* @__PURE__ */jsx(Popover, _objectSpread(_objectSpread({
|
|
7971
7960
|
"data-ui": "MenuButton__popover"
|
|
7972
7961
|
}, popoverProps), {}, {
|
|
7973
7962
|
content: menu,
|
|
7974
7963
|
open,
|
|
7975
|
-
children: button || /* @__PURE__ */
|
|
7964
|
+
children: button || /* @__PURE__ */jsx(Fragment, {})
|
|
7976
7965
|
}));
|
|
7977
7966
|
});
|
|
7978
|
-
const MenuDivider =
|
|
7967
|
+
const MenuDivider = styled.hr(_templateObject76 || (_templateObject76 = _taggedTemplateLiteral(["\n height: 1px;\n border: 0;\n background: var(--card-hairline-soft-color);\n margin: 0;\n"])));
|
|
7979
7968
|
function selectableBaseStyle() {
|
|
7980
|
-
return
|
|
7969
|
+
return css(_templateObject77 || (_templateObject77 = _taggedTemplateLiteral(["\n background-color: inherit;\n color: inherit;\n\n &[data-as='button'] {\n -webkit-font-smoothing: inherit;\n appearance: none;\n outline: none;\n font: inherit;\n text-align: inherit;\n border: 0;\n width: stretch;\n }\n\n /* &:is(a) */\n &[data-as='a'] {\n text-decoration: none;\n }\n "])));
|
|
7981
7970
|
}
|
|
7982
7971
|
function selectableColorStyle(props) {
|
|
7983
7972
|
var _a, _b;
|
|
@@ -7991,11 +7980,11 @@ function selectableColorStyle(props) {
|
|
|
7991
7980
|
selectable
|
|
7992
7981
|
} = theme.sanity.color;
|
|
7993
7982
|
const tone = selectable ? selectable[$tone] || selectable.default : muted[$tone] || muted.default;
|
|
7994
|
-
return
|
|
7983
|
+
return css(_templateObject78 || (_templateObject78 = _taggedTemplateLiteral(["\n ", "\n\n background-color: var(--card-bg-color);\n color: var(--card-fg-color);\n outline: none;\n\n /* &:is(button) */\n &[data-as='button'] {\n &:disabled {\n ", "\n }\n\n &:not(:disabled) {\n &[aria-pressed='true'] {\n ", "\n }\n\n &[data-selected],\n &[aria-selected='true'] > & {\n ", "\n }\n\n @media (hover: hover) {\n &:not([data-selected]) {\n &:hover {\n ", "\n }\n\n &:active {\n ", "\n }\n }\n }\n }\n }\n\n /* &:is(a) */\n &[data-as='a'] {\n &[data-disabled] {\n ", "\n }\n\n &:not([data-disabled]) {\n &[data-pressed] {\n ", "\n }\n\n &[data-selected] {\n ", "\n }\n\n @media (hover: hover) {\n &:not([data-selected]) {\n &:hover {\n ", "\n }\n\n &:active {\n ", "\n }\n }\n }\n }\n }\n\n ", "\n "])), _colorVarsStyle(base, tone.enabled), _colorVarsStyle(base, tone.disabled), _colorVarsStyle(base, tone.pressed), _colorVarsStyle(base, tone.selected), _colorVarsStyle(base, tone.hovered), _colorVarsStyle(base, tone.pressed), _colorVarsStyle(base, tone.disabled), _colorVarsStyle(base, tone.pressed), _colorVarsStyle(base, tone.selected), _colorVarsStyle(base, tone.hovered), _colorVarsStyle(base, tone.pressed), (_b = (_a = theme.sanity.styles) == null ? void 0 : _a.card) == null ? void 0 : _b.root);
|
|
7995
7984
|
}
|
|
7996
|
-
const Selectable =
|
|
7985
|
+
const Selectable = styled(Box)(responsiveRadiusStyle, selectableBaseStyle, selectableColorStyle);
|
|
7997
7986
|
function useMenu() {
|
|
7998
|
-
const value =
|
|
7987
|
+
const value = useContext(MenuContext);
|
|
7999
7988
|
if (!value) {
|
|
8000
7989
|
throw new Error("useMenu(): missing context value");
|
|
8001
7990
|
}
|
|
@@ -8029,17 +8018,17 @@ function MenuGroup(props) {
|
|
|
8029
8018
|
onItemMouseEnter = menu.onMouseEnter,
|
|
8030
8019
|
registerElement
|
|
8031
8020
|
} = menu;
|
|
8032
|
-
const [rootElement, setRootElement] =
|
|
8033
|
-
const [open, setOpen] =
|
|
8034
|
-
const shouldFocusRef =
|
|
8021
|
+
const [rootElement, setRootElement] = useState(null);
|
|
8022
|
+
const [open, setOpen] = useState(false);
|
|
8023
|
+
const shouldFocusRef = useRef(null);
|
|
8035
8024
|
const active = Boolean(activeElement) && activeElement === rootElement;
|
|
8036
|
-
const [withinMenu, setWithinMenu] =
|
|
8037
|
-
const handleMouseEnter =
|
|
8025
|
+
const [withinMenu, setWithinMenu] = useState(false);
|
|
8026
|
+
const handleMouseEnter = useCallback(event => {
|
|
8038
8027
|
setWithinMenu(false);
|
|
8039
8028
|
onItemMouseEnter(event);
|
|
8040
8029
|
setOpen(true);
|
|
8041
8030
|
}, [onItemMouseEnter]);
|
|
8042
|
-
const handleMenuKeyDown =
|
|
8031
|
+
const handleMenuKeyDown = useCallback(event => {
|
|
8043
8032
|
if (event.key === "ArrowLeft") {
|
|
8044
8033
|
event.stopPropagation();
|
|
8045
8034
|
setOpen(false);
|
|
@@ -8048,7 +8037,7 @@ function MenuGroup(props) {
|
|
|
8048
8037
|
});
|
|
8049
8038
|
}
|
|
8050
8039
|
}, [rootElement]);
|
|
8051
|
-
const handleClick =
|
|
8040
|
+
const handleClick = useCallback(event => {
|
|
8052
8041
|
if (onClick) onClick(event);
|
|
8053
8042
|
shouldFocusRef.current = "first";
|
|
8054
8043
|
setOpen(true);
|
|
@@ -8056,19 +8045,19 @@ function MenuGroup(props) {
|
|
|
8056
8045
|
shouldFocusRef.current = null;
|
|
8057
8046
|
});
|
|
8058
8047
|
}, [onClick]);
|
|
8059
|
-
const handleChildItemClick =
|
|
8048
|
+
const handleChildItemClick = useCallback(() => {
|
|
8060
8049
|
setOpen(false);
|
|
8061
8050
|
if (onItemClick) onItemClick();
|
|
8062
8051
|
}, [onItemClick]);
|
|
8063
|
-
const handleMenuMouseEnter =
|
|
8064
|
-
|
|
8065
|
-
|
|
8052
|
+
const handleMenuMouseEnter = useCallback(() => setWithinMenu(true), []);
|
|
8053
|
+
useEffect(() => mount(rootElement), [mount, rootElement]);
|
|
8054
|
+
useEffect(() => {
|
|
8066
8055
|
if (!active) setOpen(false);
|
|
8067
8056
|
}, [active]);
|
|
8068
|
-
|
|
8057
|
+
useEffect(() => {
|
|
8069
8058
|
if (!open) setWithinMenu(false);
|
|
8070
8059
|
}, [open]);
|
|
8071
|
-
const childMenu = /* @__PURE__ */
|
|
8060
|
+
const childMenu = /* @__PURE__ */jsx(Menu, {
|
|
8072
8061
|
onClickOutside,
|
|
8073
8062
|
onEscape,
|
|
8074
8063
|
onItemClick: handleChildItemClick,
|
|
@@ -8078,7 +8067,7 @@ function MenuGroup(props) {
|
|
|
8078
8067
|
shouldFocus: shouldFocusRef.current,
|
|
8079
8068
|
children
|
|
8080
8069
|
});
|
|
8081
|
-
const handleKeyDown =
|
|
8070
|
+
const handleKeyDown = useCallback(event => {
|
|
8082
8071
|
const target = event.currentTarget;
|
|
8083
8072
|
if (document.activeElement !== target) {
|
|
8084
8073
|
return;
|
|
@@ -8093,11 +8082,11 @@ function MenuGroup(props) {
|
|
|
8093
8082
|
return;
|
|
8094
8083
|
}
|
|
8095
8084
|
}, []);
|
|
8096
|
-
return /* @__PURE__ */
|
|
8085
|
+
return /* @__PURE__ */jsx(Popover, _objectSpread(_objectSpread({}, popover), {}, {
|
|
8097
8086
|
content: childMenu,
|
|
8098
8087
|
"data-ui": "MenuGroup__popover",
|
|
8099
8088
|
open,
|
|
8100
|
-
children: /* @__PURE__ */
|
|
8089
|
+
children: /* @__PURE__ */jsx(Selectable, _objectSpread(_objectSpread({
|
|
8101
8090
|
"data-as": as,
|
|
8102
8091
|
"data-ui": "MenuGroup",
|
|
8103
8092
|
forwardedAs: as
|
|
@@ -8113,25 +8102,25 @@ function MenuGroup(props) {
|
|
|
8113
8102
|
ref: setRootElement,
|
|
8114
8103
|
tabIndex: -1,
|
|
8115
8104
|
type: as === "button" ? "button" : void 0,
|
|
8116
|
-
children: /* @__PURE__ */
|
|
8105
|
+
children: /* @__PURE__ */jsx(Box, {
|
|
8117
8106
|
padding,
|
|
8118
|
-
children: /* @__PURE__ */
|
|
8119
|
-
children: [icon && /* @__PURE__ */
|
|
8107
|
+
children: /* @__PURE__ */jsxs(Flex, {
|
|
8108
|
+
children: [icon && /* @__PURE__ */jsxs(Text, {
|
|
8120
8109
|
size: fontSize,
|
|
8121
|
-
children: [
|
|
8122
|
-
}), /* @__PURE__ */
|
|
8110
|
+
children: [isValidElement(icon) && icon, isValidElementType(icon) && createElement(icon)]
|
|
8111
|
+
}), /* @__PURE__ */jsx(Box, {
|
|
8123
8112
|
flex: 1,
|
|
8124
8113
|
marginLeft: icon ? space : void 0,
|
|
8125
|
-
children: /* @__PURE__ */
|
|
8114
|
+
children: /* @__PURE__ */jsx(Text, {
|
|
8126
8115
|
size: fontSize,
|
|
8127
8116
|
textOverflow: "ellipsis",
|
|
8128
8117
|
children: text
|
|
8129
8118
|
})
|
|
8130
|
-
}), /* @__PURE__ */
|
|
8119
|
+
}), /* @__PURE__ */jsx(Box, {
|
|
8131
8120
|
marginLeft: space,
|
|
8132
|
-
children: /* @__PURE__ */
|
|
8121
|
+
children: /* @__PURE__ */jsx(Text, {
|
|
8133
8122
|
size: fontSize,
|
|
8134
|
-
children: /* @__PURE__ */
|
|
8123
|
+
children: /* @__PURE__ */jsx(ChevronRightIcon, {})
|
|
8135
8124
|
})
|
|
8136
8125
|
})]
|
|
8137
8126
|
})
|
|
@@ -8139,7 +8128,7 @@ function MenuGroup(props) {
|
|
|
8139
8128
|
}))
|
|
8140
8129
|
}));
|
|
8141
8130
|
}
|
|
8142
|
-
const MenuItem =
|
|
8131
|
+
const MenuItem = forwardRef(function MenuItem2(props, forwardedRef) {
|
|
8143
8132
|
const {
|
|
8144
8133
|
as = "button",
|
|
8145
8134
|
children,
|
|
@@ -8172,16 +8161,16 @@ const MenuItem = react.forwardRef(function MenuItem2(props, forwardedRef) {
|
|
|
8172
8161
|
onItemMouseEnter = menu.onMouseEnter,
|
|
8173
8162
|
onItemMouseLeave = menu.onMouseLeave
|
|
8174
8163
|
} = menu;
|
|
8175
|
-
const [rootElement, setRootElement] =
|
|
8164
|
+
const [rootElement, setRootElement] = useState(null);
|
|
8176
8165
|
const active = Boolean(activeElement) && activeElement === rootElement;
|
|
8177
|
-
|
|
8166
|
+
useEffect(() => mount(rootElement, selectedProp), [mount, rootElement, selectedProp]);
|
|
8178
8167
|
const ref = useForwardedRef(forwardedRef);
|
|
8179
|
-
const handleClick =
|
|
8168
|
+
const handleClick = useCallback(event => {
|
|
8180
8169
|
if (disabled) return;
|
|
8181
8170
|
if (onClick) onClick(event);
|
|
8182
8171
|
if (onItemClick) onItemClick();
|
|
8183
8172
|
}, [disabled, onClick, onItemClick]);
|
|
8184
|
-
const paddingProps =
|
|
8173
|
+
const paddingProps = useMemo(() => ({
|
|
8185
8174
|
padding,
|
|
8186
8175
|
paddingX,
|
|
8187
8176
|
paddingY,
|
|
@@ -8190,11 +8179,11 @@ const MenuItem = react.forwardRef(function MenuItem2(props, forwardedRef) {
|
|
|
8190
8179
|
paddingBottom,
|
|
8191
8180
|
paddingLeft
|
|
8192
8181
|
}), [padding, paddingX, paddingY, paddingTop, paddingRight, paddingBottom, paddingLeft]);
|
|
8193
|
-
const setRef =
|
|
8182
|
+
const setRef = useCallback(el => {
|
|
8194
8183
|
ref.current = el;
|
|
8195
8184
|
setRootElement(el);
|
|
8196
8185
|
}, [ref]);
|
|
8197
|
-
return /* @__PURE__ */
|
|
8186
|
+
return /* @__PURE__ */jsxs(Selectable, _objectSpread(_objectSpread({
|
|
8198
8187
|
"data-ui": "MenuItem"
|
|
8199
8188
|
}, restProps), {}, {
|
|
8200
8189
|
"aria-pressed": as === "button" && pressed,
|
|
@@ -8213,48 +8202,48 @@ const MenuItem = react.forwardRef(function MenuItem2(props, forwardedRef) {
|
|
|
8213
8202
|
role: "menuitem",
|
|
8214
8203
|
tabIndex: -1,
|
|
8215
8204
|
type: as === "button" ? "button" : void 0,
|
|
8216
|
-
children: [(icon || text || iconRight) && /* @__PURE__ */
|
|
8205
|
+
children: [(icon || text || iconRight) && /* @__PURE__ */jsx(Box, _objectSpread(_objectSpread({
|
|
8217
8206
|
as: "span"
|
|
8218
8207
|
}, paddingProps), {}, {
|
|
8219
|
-
children: /* @__PURE__ */
|
|
8208
|
+
children: /* @__PURE__ */jsxs(Flex, {
|
|
8220
8209
|
as: "span",
|
|
8221
|
-
children: [icon && /* @__PURE__ */
|
|
8210
|
+
children: [icon && /* @__PURE__ */jsxs(Text, {
|
|
8222
8211
|
size: fontSize,
|
|
8223
|
-
children: [
|
|
8224
|
-
}), text && /* @__PURE__ */
|
|
8212
|
+
children: [isValidElement(icon) && icon, isValidElementType(icon) && createElement(icon)]
|
|
8213
|
+
}), text && /* @__PURE__ */jsx(Box, {
|
|
8225
8214
|
flex: 1,
|
|
8226
8215
|
marginLeft: icon ? space : void 0,
|
|
8227
8216
|
marginRight: iconRight ? space : void 0,
|
|
8228
|
-
children: /* @__PURE__ */
|
|
8217
|
+
children: /* @__PURE__ */jsx(Text, {
|
|
8229
8218
|
size: fontSize,
|
|
8230
8219
|
textOverflow: "ellipsis",
|
|
8231
8220
|
children: text
|
|
8232
8221
|
})
|
|
8233
|
-
}), hotkeys && /* @__PURE__ */
|
|
8222
|
+
}), hotkeys && /* @__PURE__ */jsx(Box, {
|
|
8234
8223
|
marginLeft: space,
|
|
8235
8224
|
style: {
|
|
8236
8225
|
marginTop: -4,
|
|
8237
8226
|
marginBottom: -4
|
|
8238
8227
|
},
|
|
8239
|
-
children: /* @__PURE__ */
|
|
8228
|
+
children: /* @__PURE__ */jsx(Hotkeys, {
|
|
8240
8229
|
fontSize,
|
|
8241
8230
|
keys: hotkeys
|
|
8242
8231
|
})
|
|
8243
|
-
}), iconRight && /* @__PURE__ */
|
|
8232
|
+
}), iconRight && /* @__PURE__ */jsxs(Text, {
|
|
8244
8233
|
size: fontSize,
|
|
8245
|
-
children: [
|
|
8234
|
+
children: [isValidElement(iconRight) && iconRight, isValidElementType(iconRight) && createElement(iconRight)]
|
|
8246
8235
|
})]
|
|
8247
8236
|
})
|
|
8248
|
-
})), children && /* @__PURE__ */
|
|
8237
|
+
})), children && /* @__PURE__ */jsx(Box, _objectSpread(_objectSpread({
|
|
8249
8238
|
as: "span"
|
|
8250
8239
|
}, paddingProps), {}, {
|
|
8251
8240
|
children
|
|
8252
8241
|
}))]
|
|
8253
8242
|
}));
|
|
8254
8243
|
});
|
|
8255
|
-
const keyframe =
|
|
8256
|
-
const animation =
|
|
8257
|
-
const skeletonStyle =
|
|
8244
|
+
const keyframe = keyframes(_templateObject79 || (_templateObject79 = _taggedTemplateLiteral(["\n 0% {\n background-position: 100%;\n }\n 100% {\n background-position: -100%;\n }\n"])));
|
|
8245
|
+
const animation = css(_templateObject80 || (_templateObject80 = _taggedTemplateLiteral(["\n background-image: linear-gradient(\n to right,\n var(--card-skeleton-color-from),\n var(--card-skeleton-color-to),\n var(--card-skeleton-color-from),\n var(--card-skeleton-color-from),\n var(--card-skeleton-color-from)\n );\n background-position: 100%;\n background-size: 200% 100%;\n background-attachment: fixed;\n animation-name: ", ";\n animation-timing-function: ease-in-out;\n animation-iteration-count: infinite;\n animation-duration: 2000ms;\n"])), keyframe);
|
|
8246
|
+
const skeletonStyle = css(_templateObject81 || (_templateObject81 = _taggedTemplateLiteral(["\n opacity: ", ";\n transition: opacity 200ms ease-in;\n\n @media screen and (prefers-reduced-motion: no-preference) {\n ", "\n }\n\n @media screen and (prefers-reduced-motion: reduce) {\n background-color: var(--card-skeleton-color-from);\n }\n"])), _ref24 => {
|
|
8258
8247
|
let {
|
|
8259
8248
|
$visible
|
|
8260
8249
|
} = _ref24;
|
|
@@ -8263,18 +8252,18 @@ const skeletonStyle = styled.css(_templateObject81 || (_templateObject81 = _tagg
|
|
|
8263
8252
|
let {
|
|
8264
8253
|
$animated
|
|
8265
8254
|
} = _ref25;
|
|
8266
|
-
return $animated ? animation :
|
|
8255
|
+
return $animated ? animation : css(_templateObject82 || (_templateObject82 = _taggedTemplateLiteral(["\n background-color: var(--card-skeleton-color-from);\n "])));
|
|
8267
8256
|
});
|
|
8268
|
-
const Root$4 =
|
|
8269
|
-
const Skeleton =
|
|
8257
|
+
const Root$4 = styled(Box)(responsiveRadiusStyle, skeletonStyle);
|
|
8258
|
+
const Skeleton = forwardRef(function Skeleton2(props, ref) {
|
|
8270
8259
|
const {
|
|
8271
8260
|
animated = false,
|
|
8272
8261
|
delay,
|
|
8273
8262
|
radius
|
|
8274
8263
|
} = props,
|
|
8275
8264
|
restProps = _objectWithoutProperties(props, _excluded38);
|
|
8276
|
-
const [visible, setVisible] =
|
|
8277
|
-
|
|
8265
|
+
const [visible, setVisible] = useState(delay ? false : true);
|
|
8266
|
+
useEffect(() => {
|
|
8278
8267
|
if (!delay) {
|
|
8279
8268
|
return setVisible(true);
|
|
8280
8269
|
}
|
|
@@ -8285,14 +8274,14 @@ const Skeleton = react.forwardRef(function Skeleton2(props, ref) {
|
|
|
8285
8274
|
clearTimeout(timeout);
|
|
8286
8275
|
};
|
|
8287
8276
|
}, [delay]);
|
|
8288
|
-
return /* @__PURE__ */
|
|
8277
|
+
return /* @__PURE__ */jsx(Root$4, _objectSpread(_objectSpread({}, restProps), {}, {
|
|
8289
8278
|
$animated: animated,
|
|
8290
8279
|
$radius: useArrayProp(radius),
|
|
8291
8280
|
$visible: visible,
|
|
8292
8281
|
ref
|
|
8293
8282
|
}));
|
|
8294
8283
|
});
|
|
8295
|
-
const Root$3 =
|
|
8284
|
+
const Root$3 = styled(Skeleton)(_ref26 => {
|
|
8296
8285
|
let {
|
|
8297
8286
|
$size,
|
|
8298
8287
|
$style,
|
|
@@ -8311,55 +8300,55 @@ const Root$3 = styled__default["default"](Skeleton)(_ref26 => {
|
|
|
8311
8300
|
});
|
|
8312
8301
|
return styles;
|
|
8313
8302
|
});
|
|
8314
|
-
const TextSkeleton =
|
|
8303
|
+
const TextSkeleton = forwardRef(function TextSkeleton2(props, ref) {
|
|
8315
8304
|
const {
|
|
8316
8305
|
size = 2
|
|
8317
8306
|
} = props,
|
|
8318
8307
|
restProps = _objectWithoutProperties(props, _excluded39);
|
|
8319
8308
|
const $size = useArrayProp(size);
|
|
8320
|
-
return /* @__PURE__ */
|
|
8309
|
+
return /* @__PURE__ */jsx(Root$3, _objectSpread(_objectSpread({}, restProps), {}, {
|
|
8321
8310
|
$size,
|
|
8322
8311
|
ref,
|
|
8323
8312
|
$style: "text"
|
|
8324
8313
|
}));
|
|
8325
8314
|
});
|
|
8326
|
-
const LabelSkeleton =
|
|
8315
|
+
const LabelSkeleton = forwardRef(function TextSkeleton3(props, ref) {
|
|
8327
8316
|
const {
|
|
8328
8317
|
size = 2
|
|
8329
8318
|
} = props,
|
|
8330
8319
|
restProps = _objectWithoutProperties(props, _excluded40);
|
|
8331
8320
|
const $size = useArrayProp(size);
|
|
8332
|
-
return /* @__PURE__ */
|
|
8321
|
+
return /* @__PURE__ */jsx(Root$3, _objectSpread(_objectSpread({}, restProps), {}, {
|
|
8333
8322
|
$size,
|
|
8334
8323
|
ref,
|
|
8335
8324
|
$style: "label"
|
|
8336
8325
|
}));
|
|
8337
8326
|
});
|
|
8338
|
-
const HeadingSkeleton =
|
|
8327
|
+
const HeadingSkeleton = forwardRef(function TextSkeleton4(props, ref) {
|
|
8339
8328
|
const {
|
|
8340
8329
|
size = 2
|
|
8341
8330
|
} = props,
|
|
8342
8331
|
restProps = _objectWithoutProperties(props, _excluded41);
|
|
8343
8332
|
const $size = useArrayProp(size);
|
|
8344
|
-
return /* @__PURE__ */
|
|
8333
|
+
return /* @__PURE__ */jsx(Root$3, _objectSpread(_objectSpread({}, restProps), {}, {
|
|
8345
8334
|
$size,
|
|
8346
8335
|
ref,
|
|
8347
8336
|
$style: "heading"
|
|
8348
8337
|
}));
|
|
8349
8338
|
});
|
|
8350
|
-
const CodeSkeleton =
|
|
8339
|
+
const CodeSkeleton = forwardRef(function TextSkeleton5(props, ref) {
|
|
8351
8340
|
const {
|
|
8352
8341
|
size = 2
|
|
8353
8342
|
} = props,
|
|
8354
8343
|
restProps = _objectWithoutProperties(props, _excluded42);
|
|
8355
8344
|
const $size = useArrayProp(size);
|
|
8356
|
-
return /* @__PURE__ */
|
|
8345
|
+
return /* @__PURE__ */jsx(Root$3, _objectSpread(_objectSpread({}, restProps), {}, {
|
|
8357
8346
|
$size,
|
|
8358
8347
|
ref,
|
|
8359
8348
|
$style: "code"
|
|
8360
8349
|
}));
|
|
8361
8350
|
});
|
|
8362
|
-
const Tab =
|
|
8351
|
+
const Tab = forwardRef(function Tab2(props, forwardedRef) {
|
|
8363
8352
|
const {
|
|
8364
8353
|
icon,
|
|
8365
8354
|
id,
|
|
@@ -8372,17 +8361,17 @@ const Tab = react.forwardRef(function Tab2(props, forwardedRef) {
|
|
|
8372
8361
|
selected
|
|
8373
8362
|
} = props,
|
|
8374
8363
|
restProps = _objectWithoutProperties(props, _excluded43);
|
|
8375
|
-
const elementRef =
|
|
8376
|
-
const focusedRef =
|
|
8377
|
-
const handleBlur =
|
|
8364
|
+
const elementRef = useRef(null);
|
|
8365
|
+
const focusedRef = useRef(false);
|
|
8366
|
+
const handleBlur = useCallback(() => {
|
|
8378
8367
|
focusedRef.current = false;
|
|
8379
8368
|
}, []);
|
|
8380
|
-
const handleFocus =
|
|
8369
|
+
const handleFocus = useCallback(event => {
|
|
8381
8370
|
focusedRef.current = true;
|
|
8382
8371
|
if (onFocus) onFocus(event);
|
|
8383
8372
|
}, [onFocus]);
|
|
8384
8373
|
const ref = useForwardedRef(forwardedRef);
|
|
8385
|
-
|
|
8374
|
+
useEffect(() => {
|
|
8386
8375
|
if (focused && !focusedRef.current) {
|
|
8387
8376
|
if (elementRef.current) elementRef.current.focus();
|
|
8388
8377
|
focusedRef.current = true;
|
|
@@ -8392,7 +8381,7 @@ const Tab = react.forwardRef(function Tab2(props, forwardedRef) {
|
|
|
8392
8381
|
elementRef.current = el;
|
|
8393
8382
|
ref.current = el;
|
|
8394
8383
|
};
|
|
8395
|
-
return /* @__PURE__ */
|
|
8384
|
+
return /* @__PURE__ */jsx(Button, _objectSpread(_objectSpread({
|
|
8396
8385
|
"data-ui": "Tab"
|
|
8397
8386
|
}, restProps), {}, {
|
|
8398
8387
|
"aria-selected": selected ? "true" : "false",
|
|
@@ -8415,23 +8404,23 @@ const Tab = react.forwardRef(function Tab2(props, forwardedRef) {
|
|
|
8415
8404
|
function _isReactElement(node) {
|
|
8416
8405
|
return Boolean(node);
|
|
8417
8406
|
}
|
|
8418
|
-
const TabList =
|
|
8407
|
+
const TabList = forwardRef(function TabList2(props, ref) {
|
|
8419
8408
|
const {
|
|
8420
8409
|
children: childrenProp
|
|
8421
8410
|
} = props,
|
|
8422
8411
|
restProps = _objectWithoutProperties(props, _excluded44);
|
|
8423
|
-
const [focusedIndex, setFocusedIndex] =
|
|
8424
|
-
const children =
|
|
8425
|
-
const tabs = children.map((child, childIndex) =>
|
|
8412
|
+
const [focusedIndex, setFocusedIndex] = useState(-1);
|
|
8413
|
+
const children = useMemo(() => childrenProp.filter(_isReactElement), [childrenProp]);
|
|
8414
|
+
const tabs = children.map((child, childIndex) => cloneElement(child, {
|
|
8426
8415
|
focused: focusedIndex === childIndex,
|
|
8427
8416
|
key: childIndex,
|
|
8428
8417
|
onFocus: () => handleTabFocus(childIndex)
|
|
8429
8418
|
}));
|
|
8430
8419
|
const numTabs = tabs.length;
|
|
8431
|
-
const handleTabFocus =
|
|
8420
|
+
const handleTabFocus = useCallback(tabIdx => {
|
|
8432
8421
|
setFocusedIndex(tabIdx);
|
|
8433
8422
|
}, []);
|
|
8434
|
-
const handleKeyDown =
|
|
8423
|
+
const handleKeyDown = useCallback(event => {
|
|
8435
8424
|
if (event.key === "ArrowLeft") {
|
|
8436
8425
|
setFocusedIndex(prevIndex => (prevIndex + numTabs - 1) % numTabs);
|
|
8437
8426
|
}
|
|
@@ -8439,7 +8428,7 @@ const TabList = react.forwardRef(function TabList2(props, ref) {
|
|
|
8439
8428
|
setFocusedIndex(prevIndex => (prevIndex + 1) % numTabs);
|
|
8440
8429
|
}
|
|
8441
8430
|
}, [numTabs]);
|
|
8442
|
-
return /* @__PURE__ */
|
|
8431
|
+
return /* @__PURE__ */jsx(Inline, _objectSpread(_objectSpread({
|
|
8443
8432
|
"data-ui": "TabList"
|
|
8444
8433
|
}, restProps), {}, {
|
|
8445
8434
|
onKeyDown: handleKeyDown,
|
|
@@ -8448,12 +8437,12 @@ const TabList = react.forwardRef(function TabList2(props, ref) {
|
|
|
8448
8437
|
children: tabs
|
|
8449
8438
|
}));
|
|
8450
8439
|
});
|
|
8451
|
-
const TabPanel =
|
|
8440
|
+
const TabPanel = forwardRef(function TabPanel2(props, ref) {
|
|
8452
8441
|
const {
|
|
8453
8442
|
flex
|
|
8454
8443
|
} = props,
|
|
8455
8444
|
restProps = _objectWithoutProperties(props, _excluded45);
|
|
8456
|
-
return /* @__PURE__ */
|
|
8445
|
+
return /* @__PURE__ */jsx(Box, _objectSpread(_objectSpread({
|
|
8457
8446
|
"data-ui": "TabPanel"
|
|
8458
8447
|
}, restProps), {}, {
|
|
8459
8448
|
flex,
|
|
@@ -8475,8 +8464,8 @@ const ROLES = {
|
|
|
8475
8464
|
success: "alert",
|
|
8476
8465
|
info: "alert"
|
|
8477
8466
|
};
|
|
8478
|
-
const Root$2 =
|
|
8479
|
-
const TextBox =
|
|
8467
|
+
const Root$2 = styled(Card)(_templateObject83 || (_templateObject83 = _taggedTemplateLiteral(["\n pointer-events: all;\n"])));
|
|
8468
|
+
const TextBox = styled(Flex)(_templateObject84 || (_templateObject84 = _taggedTemplateLiteral(["\n overflow-x: auto;\n"])));
|
|
8480
8469
|
function Toast(props) {
|
|
8481
8470
|
const {
|
|
8482
8471
|
closable,
|
|
@@ -8488,7 +8477,7 @@ function Toast(props) {
|
|
|
8488
8477
|
restProps = _objectWithoutProperties(props, _excluded46);
|
|
8489
8478
|
const cardTone = status ? STATUS_CARD_TONE[status] : "default";
|
|
8490
8479
|
const role = status ? ROLES[status] : "status";
|
|
8491
|
-
return /* @__PURE__ */
|
|
8480
|
+
return /* @__PURE__ */jsx(Root$2, _objectSpread(_objectSpread({
|
|
8492
8481
|
"data-ui": "Toast",
|
|
8493
8482
|
role
|
|
8494
8483
|
}, restProps), {}, {
|
|
@@ -8496,27 +8485,27 @@ function Toast(props) {
|
|
|
8496
8485
|
radius: 2,
|
|
8497
8486
|
shadow: 2,
|
|
8498
8487
|
tone: cardTone,
|
|
8499
|
-
children: /* @__PURE__ */
|
|
8488
|
+
children: /* @__PURE__ */jsxs(Flex, {
|
|
8500
8489
|
align: "flex-start",
|
|
8501
|
-
children: [/* @__PURE__ */
|
|
8490
|
+
children: [/* @__PURE__ */jsx(TextBox, {
|
|
8502
8491
|
flex: 1,
|
|
8503
8492
|
padding: 3,
|
|
8504
|
-
children: /* @__PURE__ */
|
|
8493
|
+
children: /* @__PURE__ */jsxs(Stack, {
|
|
8505
8494
|
space: 3,
|
|
8506
|
-
children: [title && /* @__PURE__ */
|
|
8495
|
+
children: [title && /* @__PURE__ */jsx(Text, {
|
|
8507
8496
|
weight: "semibold",
|
|
8508
8497
|
children: title
|
|
8509
|
-
}), description && /* @__PURE__ */
|
|
8498
|
+
}), description && /* @__PURE__ */jsx(Text, {
|
|
8510
8499
|
muted: true,
|
|
8511
8500
|
size: 1,
|
|
8512
8501
|
children: description
|
|
8513
8502
|
})]
|
|
8514
8503
|
})
|
|
8515
|
-
}), closable && /* @__PURE__ */
|
|
8504
|
+
}), closable && /* @__PURE__ */jsx(Box, {
|
|
8516
8505
|
padding: 1,
|
|
8517
|
-
children: /* @__PURE__ */
|
|
8506
|
+
children: /* @__PURE__ */jsx(Button, {
|
|
8518
8507
|
as: "button",
|
|
8519
|
-
icon:
|
|
8508
|
+
icon: CloseIcon,
|
|
8520
8509
|
mode: "bleed",
|
|
8521
8510
|
padding: 2,
|
|
8522
8511
|
onClick: onClose,
|
|
@@ -8529,10 +8518,10 @@ function Toast(props) {
|
|
|
8529
8518
|
}));
|
|
8530
8519
|
}
|
|
8531
8520
|
const key$1 = Symbol.for("@sanity/ui/context/toast");
|
|
8532
|
-
globalScope[key$1] = globalScope[key$1] ||
|
|
8521
|
+
globalScope[key$1] = globalScope[key$1] || createContext(null);
|
|
8533
8522
|
const ToastContext = globalScope[key$1];
|
|
8534
|
-
const Root$1 =
|
|
8535
|
-
const ToastContainer =
|
|
8523
|
+
const Root$1 = styled(Layer)(_templateObject85 || (_templateObject85 = _taggedTemplateLiteral(["\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n pointer-events: none;\n"])));
|
|
8524
|
+
const ToastContainer = styled.div(_templateObject86 || (_templateObject86 = _taggedTemplateLiteral(["\n box-sizing: border-box;\n position: absolute;\n right: 0;\n bottom: 0;\n max-width: 420px;\n width: 100%;\n"])));
|
|
8536
8525
|
let toastId = 0;
|
|
8537
8526
|
function ToastProvider(props) {
|
|
8538
8527
|
const {
|
|
@@ -8542,11 +8531,11 @@ function ToastProvider(props) {
|
|
|
8542
8531
|
paddingY,
|
|
8543
8532
|
zOffset
|
|
8544
8533
|
} = props;
|
|
8545
|
-
const [state, setState] =
|
|
8534
|
+
const [state, setState] = useState({
|
|
8546
8535
|
toasts: []
|
|
8547
8536
|
});
|
|
8548
|
-
const toastsRef =
|
|
8549
|
-
const push =
|
|
8537
|
+
const toastsRef = useRef({});
|
|
8538
|
+
const push = useCallback(params => {
|
|
8550
8539
|
const id = params.id || String(toastId++);
|
|
8551
8540
|
const duration = params.duration || 5e3;
|
|
8552
8541
|
const dismiss = () => {
|
|
@@ -8588,7 +8577,7 @@ function ToastProvider(props) {
|
|
|
8588
8577
|
};
|
|
8589
8578
|
return id;
|
|
8590
8579
|
}, []);
|
|
8591
|
-
|
|
8580
|
+
useEffect(() => () => {
|
|
8592
8581
|
for (const {
|
|
8593
8582
|
timeoutId
|
|
8594
8583
|
} of Object.values(toastsRef.current)) {
|
|
@@ -8596,21 +8585,21 @@ function ToastProvider(props) {
|
|
|
8596
8585
|
}
|
|
8597
8586
|
toastsRef.current = {};
|
|
8598
8587
|
}, []);
|
|
8599
|
-
const value =
|
|
8588
|
+
const value = useMemo(() => ({
|
|
8600
8589
|
version: 0,
|
|
8601
8590
|
push
|
|
8602
8591
|
}), [push]);
|
|
8603
|
-
return /* @__PURE__ */
|
|
8592
|
+
return /* @__PURE__ */jsxs(ToastContext.Provider, {
|
|
8604
8593
|
value,
|
|
8605
|
-
children: [children, /* @__PURE__ */
|
|
8594
|
+
children: [children, /* @__PURE__ */jsx(Root$1, {
|
|
8606
8595
|
"data-ui": "ToastProvider",
|
|
8607
8596
|
zOffset,
|
|
8608
|
-
children: /* @__PURE__ */
|
|
8609
|
-
children: /* @__PURE__ */
|
|
8597
|
+
children: /* @__PURE__ */jsx(ToastContainer, {
|
|
8598
|
+
children: /* @__PURE__ */jsx(Box, {
|
|
8610
8599
|
padding,
|
|
8611
8600
|
paddingX,
|
|
8612
8601
|
paddingY,
|
|
8613
|
-
children: /* @__PURE__ */
|
|
8602
|
+
children: /* @__PURE__ */jsx(AnimatePresence, {
|
|
8614
8603
|
initial: false,
|
|
8615
8604
|
children: state.toasts.map(_ref27 => {
|
|
8616
8605
|
let {
|
|
@@ -8618,7 +8607,7 @@ function ToastProvider(props) {
|
|
|
8618
8607
|
id,
|
|
8619
8608
|
params
|
|
8620
8609
|
} = _ref27;
|
|
8621
|
-
return /* @__PURE__ */
|
|
8610
|
+
return /* @__PURE__ */jsx(motion.div, {
|
|
8622
8611
|
animate: {
|
|
8623
8612
|
opacity: 1,
|
|
8624
8613
|
y: 0,
|
|
@@ -8642,7 +8631,7 @@ function ToastProvider(props) {
|
|
|
8642
8631
|
damping: 30,
|
|
8643
8632
|
stiffness: 400
|
|
8644
8633
|
},
|
|
8645
|
-
children: /* @__PURE__ */
|
|
8634
|
+
children: /* @__PURE__ */jsx(Toast, {
|
|
8646
8635
|
closable: params.closable,
|
|
8647
8636
|
description: params.description,
|
|
8648
8637
|
onClose: dismiss,
|
|
@@ -8658,7 +8647,7 @@ function ToastProvider(props) {
|
|
|
8658
8647
|
});
|
|
8659
8648
|
}
|
|
8660
8649
|
function useToast() {
|
|
8661
|
-
const value =
|
|
8650
|
+
const value = useContext(ToastContext);
|
|
8662
8651
|
if (!value) {
|
|
8663
8652
|
throw new Error("useToast(): missing context value");
|
|
8664
8653
|
}
|
|
@@ -8738,28 +8727,28 @@ function _focusItemElement(el) {
|
|
|
8738
8727
|
}
|
|
8739
8728
|
}
|
|
8740
8729
|
const key = Symbol.for("@sanity/ui/context/tree");
|
|
8741
|
-
globalScope[key] = globalScope[key] ||
|
|
8730
|
+
globalScope[key] = globalScope[key] || createContext(null);
|
|
8742
8731
|
const TreeContext = globalScope[key];
|
|
8743
|
-
const Tree =
|
|
8732
|
+
const Tree = memo(forwardRef(function Tree2(props, ref) {
|
|
8744
8733
|
const {
|
|
8745
8734
|
children,
|
|
8746
8735
|
space = 1
|
|
8747
8736
|
} = props,
|
|
8748
8737
|
restProps = _objectWithoutProperties(props, _excluded47);
|
|
8749
8738
|
const forwardedRef = useForwardedRef(ref);
|
|
8750
|
-
const [focusedElement, setFocusedElement] =
|
|
8751
|
-
const focusedElementRef =
|
|
8752
|
-
const path =
|
|
8753
|
-
const [itemElements, setItemElements] =
|
|
8754
|
-
const [state, setState] =
|
|
8755
|
-
const stateRef =
|
|
8756
|
-
|
|
8739
|
+
const [focusedElement, setFocusedElement] = useState(null);
|
|
8740
|
+
const focusedElementRef = useRef(focusedElement);
|
|
8741
|
+
const path = useMemo(() => [], []);
|
|
8742
|
+
const [itemElements, setItemElements] = useState([]);
|
|
8743
|
+
const [state, setState] = useState({});
|
|
8744
|
+
const stateRef = useRef(state);
|
|
8745
|
+
useEffect(() => {
|
|
8757
8746
|
focusedElementRef.current = focusedElement;
|
|
8758
8747
|
}, [focusedElement]);
|
|
8759
|
-
|
|
8748
|
+
useEffect(() => {
|
|
8760
8749
|
stateRef.current = state;
|
|
8761
8750
|
}, [state]);
|
|
8762
|
-
const registerItem =
|
|
8751
|
+
const registerItem = useCallback((element, path2, expanded, selected) => {
|
|
8763
8752
|
setState(s => _objectSpread(_objectSpread({}, s), {}, {
|
|
8764
8753
|
[path2]: {
|
|
8765
8754
|
element,
|
|
@@ -8777,7 +8766,7 @@ const Tree = react.memo(react.forwardRef(function Tree2(props, ref) {
|
|
|
8777
8766
|
});
|
|
8778
8767
|
};
|
|
8779
8768
|
}, []);
|
|
8780
|
-
const setExpanded =
|
|
8769
|
+
const setExpanded = useCallback((path2, expanded) => {
|
|
8781
8770
|
setState(s => {
|
|
8782
8771
|
const itemState = s[path2];
|
|
8783
8772
|
if (!itemState) return s;
|
|
@@ -8788,7 +8777,7 @@ const Tree = react.memo(react.forwardRef(function Tree2(props, ref) {
|
|
|
8788
8777
|
});
|
|
8789
8778
|
});
|
|
8790
8779
|
}, []);
|
|
8791
|
-
const contextValue =
|
|
8780
|
+
const contextValue = useMemo(() => ({
|
|
8792
8781
|
version: 0,
|
|
8793
8782
|
focusedElement: focusedElement || itemElements[0] || null,
|
|
8794
8783
|
level: 0,
|
|
@@ -8799,7 +8788,7 @@ const Tree = react.memo(react.forwardRef(function Tree2(props, ref) {
|
|
|
8799
8788
|
space,
|
|
8800
8789
|
state
|
|
8801
8790
|
}), [focusedElement, itemElements, path, registerItem, setExpanded, space, state]);
|
|
8802
|
-
const handleKeyDown =
|
|
8791
|
+
const handleKeyDown = useCallback(event => {
|
|
8803
8792
|
var _a;
|
|
8804
8793
|
if (!focusedElementRef.current) return;
|
|
8805
8794
|
if (event.key === "ArrowDown") {
|
|
@@ -8866,14 +8855,14 @@ const Tree = react.memo(react.forwardRef(function Tree2(props, ref) {
|
|
|
8866
8855
|
return;
|
|
8867
8856
|
}
|
|
8868
8857
|
}, [itemElements]);
|
|
8869
|
-
|
|
8858
|
+
useEffect(() => {
|
|
8870
8859
|
if (!forwardedRef.current) return;
|
|
8871
8860
|
const _itemElements = Array.from(forwardedRef.current.querySelectorAll('[data-ui="TreeItem"]'));
|
|
8872
8861
|
setItemElements(_itemElements);
|
|
8873
8862
|
}, [children, forwardedRef]);
|
|
8874
|
-
return /* @__PURE__ */
|
|
8863
|
+
return /* @__PURE__ */jsx(TreeContext.Provider, {
|
|
8875
8864
|
value: contextValue,
|
|
8876
|
-
children: /* @__PURE__ */
|
|
8865
|
+
children: /* @__PURE__ */jsx(Stack, _objectSpread(_objectSpread({
|
|
8877
8866
|
as: "ul",
|
|
8878
8867
|
"data-ui": "Tree"
|
|
8879
8868
|
}, restProps), {}, {
|
|
@@ -8887,7 +8876,7 @@ const Tree = react.memo(react.forwardRef(function Tree2(props, ref) {
|
|
|
8887
8876
|
}));
|
|
8888
8877
|
Tree.displayName = "Tree";
|
|
8889
8878
|
function treeItemRootStyle() {
|
|
8890
|
-
return
|
|
8879
|
+
return css(_templateObject87 || (_templateObject87 = _taggedTemplateLiteral(["\n &[role='none'] > [role='treeitem'] {\n outline: none;\n cursor: default;\n border-radius: 3px;\n\n &:focus {\n position: relative;\n }\n }\n\n &[role='treeitem'] {\n outline: none;\n\n & > div {\n cursor: default;\n border-radius: 3px;\n }\n\n &:focus > div {\n position: relative;\n }\n }\n "])));
|
|
8891
8880
|
}
|
|
8892
8881
|
function treeItemRootColorStyle(props) {
|
|
8893
8882
|
const {
|
|
@@ -8900,7 +8889,7 @@ function treeItemRootColorStyle(props) {
|
|
|
8900
8889
|
selectable
|
|
8901
8890
|
} = theme.sanity.color;
|
|
8902
8891
|
const tone = selectable ? selectable[$tone] || selectable.default : muted[$tone] || muted.default;
|
|
8903
|
-
return
|
|
8892
|
+
return css(_templateObject88 || (_templateObject88 = _taggedTemplateLiteral(["\n /* <div role=\"none\"><a data-ui=\"TreeItem__box\" role=\"treeitem\" tabIndex=\"0\"></div> */\n &[role='none'] {\n & > [role='treeitem'] {\n ", "\n\n background-color: var(--card-bg-color);\n color: var(--treeitem-fg-color);\n }\n\n &[data-selected] > [role='treeitem'] {\n ", "\n }\n\n @media (hover: hover) {\n &:not([data-selected]) > [role='treeitem']:not(:focus):hover {\n ", "\n }\n\n & > [role='treeitem']:focus {\n ", "\n }\n }\n }\n\n /* <div role=\"treeitem\" tabIndex=\"0\"><div data-ui=\"TreeItem__box\"></div> */\n &[role='treeitem'] {\n & > [data-ui='TreeItem__box'] {\n ", "\n\n background-color: var(--card-bg-color);\n color: var(--card-fg-color);\n }\n\n &[data-selected] > [data-ui='TreeItem__box'] {\n ", "\n }\n\n @media (hover: hover) {\n &:not([data-selected]):not(:focus) > [data-ui='TreeItem__box']:hover {\n ", "\n }\n\n &:focus > [data-ui='TreeItem__box'] {\n ", "\n }\n }\n }\n "])), _colorVarsStyle(base, tone.enabled), _colorVarsStyle(base, tone.pressed), _colorVarsStyle(base, tone.hovered), _colorVarsStyle(base, tone.selected), _colorVarsStyle(base, tone.enabled), _colorVarsStyle(base, tone.pressed), _colorVarsStyle(base, tone.hovered), _colorVarsStyle(base, tone.selected));
|
|
8904
8893
|
}
|
|
8905
8894
|
function treeItemBoxStyle(props) {
|
|
8906
8895
|
const {
|
|
@@ -8910,23 +8899,23 @@ function treeItemBoxStyle(props) {
|
|
|
8910
8899
|
const {
|
|
8911
8900
|
space
|
|
8912
8901
|
} = theme.sanity;
|
|
8913
|
-
return
|
|
8902
|
+
return css(_templateObject89 || (_templateObject89 = _taggedTemplateLiteral(["\n padding-left: ", ";\n\n &[data-as='a'] {\n text-decoration: none;\n }\n "])), rem(space[2] * $level));
|
|
8914
8903
|
}
|
|
8915
8904
|
function useTree() {
|
|
8916
|
-
const tree =
|
|
8905
|
+
const tree = useContext(TreeContext);
|
|
8917
8906
|
if (!tree) {
|
|
8918
8907
|
throw new Error("Tree: missing context value");
|
|
8919
8908
|
}
|
|
8920
8909
|
return tree;
|
|
8921
8910
|
}
|
|
8922
|
-
const TreeGroup =
|
|
8911
|
+
const TreeGroup = memo(function TreeGroup2(props) {
|
|
8923
8912
|
const {
|
|
8924
8913
|
children,
|
|
8925
8914
|
expanded = false
|
|
8926
8915
|
} = props,
|
|
8927
8916
|
restProps = _objectWithoutProperties(props, _excluded48);
|
|
8928
8917
|
const tree = useTree();
|
|
8929
|
-
return /* @__PURE__ */
|
|
8918
|
+
return /* @__PURE__ */jsx(Stack, _objectSpread(_objectSpread({
|
|
8930
8919
|
as: "ul",
|
|
8931
8920
|
"data-ui": "TreeGroup"
|
|
8932
8921
|
}, restProps), {}, {
|
|
@@ -8937,12 +8926,12 @@ const TreeGroup = react.memo(function TreeGroup2(props) {
|
|
|
8937
8926
|
children
|
|
8938
8927
|
}));
|
|
8939
8928
|
});
|
|
8940
|
-
const Root =
|
|
8941
|
-
const TreeItemBox =
|
|
8929
|
+
const Root = memo(styled.li(treeItemRootStyle, treeItemRootColorStyle));
|
|
8930
|
+
const TreeItemBox = styled(Box).attrs({
|
|
8942
8931
|
forwardedAs: "a"
|
|
8943
8932
|
})(treeItemBoxStyle);
|
|
8944
|
-
const ToggleArrowText =
|
|
8945
|
-
const TreeItem =
|
|
8933
|
+
const ToggleArrowText = styled(Text)(_templateObject90 || (_templateObject90 = _taggedTemplateLiteral(["\n & > svg {\n transition: transform 100ms;\n }\n"])));
|
|
8934
|
+
const TreeItem = memo(function TreeItem2(props) {
|
|
8946
8935
|
const {
|
|
8947
8936
|
children,
|
|
8948
8937
|
expanded: expandedProp = false,
|
|
@@ -8959,8 +8948,8 @@ const TreeItem = react.memo(function TreeItem2(props) {
|
|
|
8959
8948
|
weight
|
|
8960
8949
|
} = props,
|
|
8961
8950
|
restProps = _objectWithoutProperties(props, _excluded49);
|
|
8962
|
-
const rootRef =
|
|
8963
|
-
const treeitemRef =
|
|
8951
|
+
const rootRef = useRef(null);
|
|
8952
|
+
const treeitemRef = useRef(null);
|
|
8964
8953
|
const tree = useTree();
|
|
8965
8954
|
const {
|
|
8966
8955
|
path,
|
|
@@ -8968,19 +8957,19 @@ const TreeItem = react.memo(function TreeItem2(props) {
|
|
|
8968
8957
|
setExpanded,
|
|
8969
8958
|
setFocusedElement
|
|
8970
8959
|
} = tree;
|
|
8971
|
-
const _id =
|
|
8960
|
+
const _id = useId();
|
|
8972
8961
|
const id = idProp || _id;
|
|
8973
|
-
const itemPath =
|
|
8962
|
+
const itemPath = useMemo(() => path.concat([id || ""]), [id, path]);
|
|
8974
8963
|
const itemKey = itemPath.join("/");
|
|
8975
8964
|
const itemState = tree.state[itemKey];
|
|
8976
8965
|
const focused = tree.focusedElement === rootRef.current;
|
|
8977
8966
|
const expanded = (itemState == null ? void 0 : itemState.expanded) === void 0 ? expandedProp : (itemState == null ? void 0 : itemState.expanded) || false;
|
|
8978
8967
|
const tabIndex = tree.focusedElement && tree.focusedElement === rootRef.current ? 0 : -1;
|
|
8979
|
-
const contextValue =
|
|
8968
|
+
const contextValue = useMemo(() => _objectSpread(_objectSpread({}, tree), {}, {
|
|
8980
8969
|
level: tree.level + 1,
|
|
8981
8970
|
path: itemPath
|
|
8982
8971
|
}), [itemPath, tree]);
|
|
8983
|
-
const handleClick =
|
|
8972
|
+
const handleClick = useCallback(event => {
|
|
8984
8973
|
if (onClick) onClick(event);
|
|
8985
8974
|
const target = event.target;
|
|
8986
8975
|
if (target instanceof HTMLElement && (target.getAttribute("data-ui") === "TreeItem__box" || target.closest('[data-ui="TreeItem__box"]'))) {
|
|
@@ -8989,42 +8978,42 @@ const TreeItem = react.memo(function TreeItem2(props) {
|
|
|
8989
8978
|
setFocusedElement(rootRef.current);
|
|
8990
8979
|
}
|
|
8991
8980
|
}, [expanded, itemKey, onClick, setExpanded, setFocusedElement]);
|
|
8992
|
-
const handleKeyDown =
|
|
8981
|
+
const handleKeyDown = useCallback(event => {
|
|
8993
8982
|
if (focused && event.key === "Enter") {
|
|
8994
8983
|
const el = treeitemRef.current || rootRef.current;
|
|
8995
8984
|
el == null ? void 0 : el.click();
|
|
8996
8985
|
}
|
|
8997
8986
|
}, [focused]);
|
|
8998
|
-
|
|
8987
|
+
useEffect(() => {
|
|
8999
8988
|
if (!rootRef.current) return;
|
|
9000
8989
|
return registerItem(rootRef.current, itemPath.join("/"), expanded, selected);
|
|
9001
8990
|
}, [expanded, itemPath, registerItem, selected]);
|
|
9002
|
-
const content = /* @__PURE__ */
|
|
8991
|
+
const content = /* @__PURE__ */jsxs(Flex, {
|
|
9003
8992
|
padding,
|
|
9004
|
-
children: [/* @__PURE__ */
|
|
8993
|
+
children: [/* @__PURE__ */jsxs(Box, {
|
|
9005
8994
|
marginRight: space,
|
|
9006
8995
|
style: {
|
|
9007
8996
|
visibility: icon || children ? "visible" : "hidden",
|
|
9008
8997
|
pointerEvents: "none"
|
|
9009
8998
|
},
|
|
9010
|
-
children: [icon && /* @__PURE__ */
|
|
8999
|
+
children: [icon && /* @__PURE__ */jsx(Text, {
|
|
9011
9000
|
muted,
|
|
9012
9001
|
size: fontSize,
|
|
9013
9002
|
weight,
|
|
9014
|
-
children:
|
|
9015
|
-
}), !icon && /* @__PURE__ */
|
|
9003
|
+
children: createElement(icon)
|
|
9004
|
+
}), !icon && /* @__PURE__ */jsx(ToggleArrowText, {
|
|
9016
9005
|
muted,
|
|
9017
9006
|
size: fontSize,
|
|
9018
9007
|
weight,
|
|
9019
|
-
children: /* @__PURE__ */
|
|
9008
|
+
children: /* @__PURE__ */jsx(ToggleArrowRightIcon, {
|
|
9020
9009
|
style: {
|
|
9021
9010
|
transform: expanded ? "rotate(90deg)" : void 0
|
|
9022
9011
|
}
|
|
9023
9012
|
})
|
|
9024
9013
|
})]
|
|
9025
|
-
}), /* @__PURE__ */
|
|
9014
|
+
}), /* @__PURE__ */jsx(Box, {
|
|
9026
9015
|
flex: 1,
|
|
9027
|
-
children: /* @__PURE__ */
|
|
9016
|
+
children: /* @__PURE__ */jsx(Text, {
|
|
9028
9017
|
muted,
|
|
9029
9018
|
size: fontSize,
|
|
9030
9019
|
textOverflow: "ellipsis",
|
|
@@ -9034,7 +9023,7 @@ const TreeItem = react.memo(function TreeItem2(props) {
|
|
|
9034
9023
|
})]
|
|
9035
9024
|
});
|
|
9036
9025
|
if (href) {
|
|
9037
|
-
return /* @__PURE__ */
|
|
9026
|
+
return /* @__PURE__ */jsxs(Root, _objectSpread(_objectSpread({
|
|
9038
9027
|
"data-selected": selected ? "" : void 0,
|
|
9039
9028
|
"data-tree-id": id,
|
|
9040
9029
|
"data-tree-key": itemKey,
|
|
@@ -9043,7 +9032,7 @@ const TreeItem = react.memo(function TreeItem2(props) {
|
|
|
9043
9032
|
onClick: handleClick,
|
|
9044
9033
|
ref: rootRef,
|
|
9045
9034
|
role: "none",
|
|
9046
|
-
children: [/* @__PURE__ */
|
|
9035
|
+
children: [/* @__PURE__ */jsx(TreeItemBox, {
|
|
9047
9036
|
$level: tree.level,
|
|
9048
9037
|
"aria-expanded": expanded,
|
|
9049
9038
|
"data-ui": "TreeItem__box",
|
|
@@ -9052,16 +9041,16 @@ const TreeItem = react.memo(function TreeItem2(props) {
|
|
|
9052
9041
|
role: "treeitem",
|
|
9053
9042
|
tabIndex,
|
|
9054
9043
|
children: content
|
|
9055
|
-
}), /* @__PURE__ */
|
|
9044
|
+
}), /* @__PURE__ */jsx(TreeContext.Provider, {
|
|
9056
9045
|
value: contextValue,
|
|
9057
|
-
children: children && /* @__PURE__ */
|
|
9046
|
+
children: children && /* @__PURE__ */jsx(TreeGroup, {
|
|
9058
9047
|
hidden: !expanded,
|
|
9059
9048
|
children
|
|
9060
9049
|
})
|
|
9061
9050
|
})]
|
|
9062
9051
|
}));
|
|
9063
9052
|
}
|
|
9064
|
-
return /* @__PURE__ */
|
|
9053
|
+
return /* @__PURE__ */jsxs(Root, _objectSpread(_objectSpread({
|
|
9065
9054
|
"data-selected": selected ? "" : void 0,
|
|
9066
9055
|
"data-ui": "TreeItem",
|
|
9067
9056
|
"data-tree-id": id,
|
|
@@ -9073,132 +9062,19 @@ const TreeItem = react.memo(function TreeItem2(props) {
|
|
|
9073
9062
|
ref: rootRef,
|
|
9074
9063
|
role: "treeitem",
|
|
9075
9064
|
tabIndex,
|
|
9076
|
-
children: [/* @__PURE__ */
|
|
9065
|
+
children: [/* @__PURE__ */jsx(TreeItemBox, {
|
|
9077
9066
|
$level: tree.level,
|
|
9078
9067
|
as: "div",
|
|
9079
9068
|
"data-ui": "TreeItem__box",
|
|
9080
9069
|
children: content
|
|
9081
|
-
}), /* @__PURE__ */
|
|
9070
|
+
}), /* @__PURE__ */jsx(TreeContext.Provider, {
|
|
9082
9071
|
value: contextValue,
|
|
9083
|
-
children: children && /* @__PURE__ */
|
|
9072
|
+
children: children && /* @__PURE__ */jsx(TreeGroup, {
|
|
9084
9073
|
expanded,
|
|
9085
9074
|
children
|
|
9086
9075
|
})
|
|
9087
9076
|
})]
|
|
9088
9077
|
}));
|
|
9089
9078
|
});
|
|
9090
|
-
|
|
9091
|
-
exports.Avatar = Avatar;
|
|
9092
|
-
exports.AvatarCounter = AvatarCounter;
|
|
9093
|
-
exports.AvatarStack = AvatarStack;
|
|
9094
|
-
exports.Badge = Badge;
|
|
9095
|
-
exports.BoundaryElementProvider = BoundaryElementProvider;
|
|
9096
|
-
exports.Box = Box;
|
|
9097
|
-
exports.Breadcrumbs = Breadcrumbs;
|
|
9098
|
-
exports.Button = Button;
|
|
9099
|
-
exports.Card = Card;
|
|
9100
|
-
exports.Checkbox = Checkbox;
|
|
9101
|
-
exports.Code = Code;
|
|
9102
|
-
exports.CodeSkeleton = CodeSkeleton;
|
|
9103
|
-
exports.Container = Container;
|
|
9104
|
-
exports.Dialog = Dialog;
|
|
9105
|
-
exports.DialogContext = DialogContext;
|
|
9106
|
-
exports.DialogProvider = DialogProvider;
|
|
9107
|
-
exports.ElementQuery = ElementQuery;
|
|
9108
|
-
exports.ErrorBoundary = ErrorBoundary;
|
|
9109
|
-
exports.Flex = Flex;
|
|
9110
|
-
exports.Grid = Grid;
|
|
9111
|
-
exports.Heading = Heading;
|
|
9112
|
-
exports.HeadingSkeleton = HeadingSkeleton;
|
|
9113
|
-
exports.Hotkeys = Hotkeys;
|
|
9114
|
-
exports.Inline = Inline;
|
|
9115
|
-
exports.KBD = KBD;
|
|
9116
|
-
exports.Label = Label;
|
|
9117
|
-
exports.LabelSkeleton = LabelSkeleton;
|
|
9118
|
-
exports.Layer = Layer;
|
|
9119
|
-
exports.LayerProvider = LayerProvider;
|
|
9120
|
-
exports.Menu = Menu;
|
|
9121
|
-
exports.MenuButton = MenuButton;
|
|
9122
|
-
exports.MenuDivider = MenuDivider;
|
|
9123
|
-
exports.MenuGroup = MenuGroup;
|
|
9124
|
-
exports.MenuItem = MenuItem;
|
|
9125
|
-
exports.Popover = Popover;
|
|
9126
|
-
exports.Portal = Portal;
|
|
9127
|
-
exports.PortalProvider = PortalProvider;
|
|
9128
|
-
exports.Radio = Radio;
|
|
9129
|
-
exports.Select = Select;
|
|
9130
|
-
exports.Skeleton = Skeleton;
|
|
9131
|
-
exports.Spinner = Spinner;
|
|
9132
|
-
exports.SrOnly = SrOnly;
|
|
9133
|
-
exports.Stack = Stack;
|
|
9134
|
-
exports.Switch = Switch;
|
|
9135
|
-
exports.Tab = Tab;
|
|
9136
|
-
exports.TabList = TabList;
|
|
9137
|
-
exports.TabPanel = TabPanel;
|
|
9138
|
-
exports.Text = Text;
|
|
9139
|
-
exports.TextArea = TextArea;
|
|
9140
|
-
exports.TextInput = TextInput;
|
|
9141
|
-
exports.TextSkeleton = TextSkeleton;
|
|
9142
|
-
exports.ThemeColorProvider = ThemeColorProvider;
|
|
9143
|
-
exports.ThemeProvider = ThemeProvider;
|
|
9144
|
-
exports.Toast = Toast;
|
|
9145
|
-
exports.ToastProvider = ToastProvider;
|
|
9146
|
-
exports.Tooltip = Tooltip;
|
|
9147
|
-
exports.Tree = Tree;
|
|
9148
|
-
exports.TreeItem = TreeItem;
|
|
9149
|
-
exports.VirtualList = VirtualList;
|
|
9150
|
-
exports._ResizeObserver = _ResizeObserver;
|
|
9151
|
-
exports._elementSizeObserver = _elementSizeObserver;
|
|
9152
|
-
exports._fillCSSObject = _fillCSSObject;
|
|
9153
|
-
exports._getArrayProp = _getArrayProp;
|
|
9154
|
-
exports._getResponsiveSpace = _getResponsiveSpace;
|
|
9155
|
-
exports._hasFocus = _hasFocus;
|
|
9156
|
-
exports._isEnterToClickElement = _isEnterToClickElement;
|
|
9157
|
-
exports._isScrollable = _isScrollable;
|
|
9158
|
-
exports._raf = _raf;
|
|
9159
|
-
exports._raf2 = _raf2;
|
|
9160
|
-
exports._responsive = _responsive;
|
|
9161
|
-
exports.attemptFocus = attemptFocus;
|
|
9162
|
-
exports.createColorTheme = createColorTheme;
|
|
9163
|
-
exports.focusFirstDescendant = focusFirstDescendant;
|
|
9164
|
-
exports.focusLastDescendant = focusLastDescendant;
|
|
9165
|
-
exports.hexToRgb = hexToRgb;
|
|
9166
|
-
exports.hslToRgb = hslToRgb;
|
|
9167
|
-
exports.isFocusable = isFocusable;
|
|
9168
|
-
exports.isHTMLAnchorElement = isHTMLAnchorElement;
|
|
9169
|
-
exports.isHTMLButtonElement = isHTMLButtonElement;
|
|
9170
|
-
exports.isHTMLElement = isHTMLElement;
|
|
9171
|
-
exports.isHTMLInputElement = isHTMLInputElement;
|
|
9172
|
-
exports.isHTMLSelectElement = isHTMLSelectElement;
|
|
9173
|
-
exports.isHTMLTextAreaElement = isHTMLTextAreaElement;
|
|
9174
|
-
exports.multiply = multiply$1;
|
|
9175
|
-
exports.parseColor = parseColor;
|
|
9176
|
-
exports.rem = rem;
|
|
9177
|
-
exports.responsiveCodeFontStyle = responsiveCodeFontStyle;
|
|
9178
|
-
exports.responsiveHeadingFont = responsiveHeadingFont;
|
|
9179
|
-
exports.responsiveLabelFont = responsiveLabelFont;
|
|
9180
|
-
exports.responsiveTextAlignStyle = responsiveTextAlignStyle;
|
|
9181
|
-
exports.responsiveTextFont = responsiveTextFont;
|
|
9182
|
-
exports.rgbToHex = rgbToHex;
|
|
9183
|
-
exports.rgbToHsl = rgbToHsl;
|
|
9184
|
-
exports.rgba = rgba;
|
|
9185
|
-
exports.screen = screen$1;
|
|
9186
|
-
exports.studioTheme = studioTheme;
|
|
9187
|
-
exports.useArrayProp = useArrayProp;
|
|
9188
|
-
exports.useBoundaryElement = useBoundaryElement;
|
|
9189
|
-
exports.useClickOutside = useClickOutside;
|
|
9190
|
-
exports.useCustomValidity = useCustomValidity;
|
|
9191
|
-
exports.useDialog = useDialog;
|
|
9192
|
-
exports.useElementRect = useElementRect;
|
|
9193
|
-
exports.useElementSize = useElementSize;
|
|
9194
|
-
exports.useForwardedRef = useForwardedRef;
|
|
9195
|
-
exports.useGlobalKeyDown = useGlobalKeyDown;
|
|
9196
|
-
exports.useLayer = useLayer;
|
|
9197
|
-
exports.useMediaIndex = useMediaIndex;
|
|
9198
|
-
exports.usePortal = usePortal;
|
|
9199
|
-
exports.usePrefersDark = usePrefersDark;
|
|
9200
|
-
exports.useRootTheme = useRootTheme;
|
|
9201
|
-
exports.useTheme = useTheme;
|
|
9202
|
-
exports.useToast = useToast;
|
|
9203
|
-
exports.useTree = useTree;
|
|
9079
|
+
export { Autocomplete, Avatar, AvatarCounter, AvatarStack, Badge, BoundaryElementProvider, Box, Breadcrumbs, Button, Card, Checkbox, Code, CodeSkeleton, Container, Dialog, DialogContext, DialogProvider, ElementQuery, ErrorBoundary, Flex, Grid, Heading, HeadingSkeleton, Hotkeys, Inline, KBD, Label, LabelSkeleton, Layer, LayerProvider, Menu, MenuButton, MenuDivider, MenuGroup, MenuItem, Popover, Portal, PortalProvider, Radio, Select, Skeleton, Spinner, SrOnly, Stack, Switch, Tab, TabList, TabPanel, Text, TextArea, TextInput, TextSkeleton, ThemeColorProvider, ThemeProvider, Toast, ToastProvider, Tooltip, Tree, TreeItem, VirtualList, _ResizeObserver, _elementSizeObserver, _fillCSSObject, _getArrayProp, _getResponsiveSpace, _hasFocus, _isEnterToClickElement, _isScrollable, _raf, _raf2, _responsive, attemptFocus, createColorTheme, focusFirstDescendant, focusLastDescendant, hexToRgb, hslToRgb, isFocusable, isHTMLAnchorElement, isHTMLButtonElement, isHTMLElement, isHTMLInputElement, isHTMLSelectElement, isHTMLTextAreaElement, multiply$1 as multiply, parseColor, rem, responsiveCodeFontStyle, responsiveHeadingFont, responsiveLabelFont, responsiveTextAlignStyle, responsiveTextFont, rgbToHex, rgbToHsl, rgba, screen$1 as screen, studioTheme, useArrayProp, useBoundaryElement, useClickOutside, useCustomValidity, useDialog, useElementRect, useElementSize, useForwardedRef, useGlobalKeyDown, useLayer, useMediaIndex, usePortal, usePrefersDark, useRootTheme, useTheme, useToast, useTree };
|
|
9204
9080
|
//# sourceMappingURL=index.js.map
|