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