@sanity/ui 2.9.0-canary.2 → 2.9.0-canary.4
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.d.mts +12 -10
- package/dist/index.d.ts +12 -10
- package/dist/index.esm.js +332 -142
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +331 -141
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +332 -142
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/core/components/breadcrumbs/breadcrumbs.tsx +35 -47
- package/src/core/components/menu/menu.tsx +12 -10
- package/src/core/components/menu/menuButton.tsx +14 -36
- package/src/core/components/tab/tabList.tsx +3 -11
- package/src/core/components/toast/toastProvider.tsx +5 -6
- package/src/core/components/toast/toastState.ts +6 -0
- package/src/core/components/tree/treeItem.tsx +5 -2
- package/src/core/constants.ts +1 -1
- package/src/core/primitives/popover/popover.tsx +4 -7
- package/src/core/utils/elementQuery/elementQuery.tsx +14 -16
- package/src/core/utils/layer/layerProvider.tsx +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { buildTheme, createColorTheme as createColorTheme$1, hexToRgb as hexToRgb$1, hslToRgb as hslToRgb$1, multiply as multiply$1, parseColor as parseColor$1, rgbToHex as rgbToHex$1, rgbToHsl as rgbToHsl$1, rgba as rgba$1, screen as screen$1, getTheme_v2, getScopedTheme } from "@sanity/ui/theme";
|
|
2
2
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { c } from "react-compiler-runtime";
|
|
4
|
-
import { useState, useRef, useEffect, useDebugValue, useImperativeHandle, useSyncExternalStore, createContext, useContext, forwardRef, useId, Children, isValidElement, cloneElement,
|
|
4
|
+
import { useState, useRef, useEffect, useDebugValue, useImperativeHandle, useSyncExternalStore, createContext, useContext, forwardRef, useId, Children, isValidElement, cloneElement, Component, memo, useLayoutEffect, useMemo, useCallback, useReducer, Fragment as Fragment$1, startTransition } from "react";
|
|
5
5
|
import ReactIs, { isValidElementType } from "react-is";
|
|
6
6
|
import { ThemeProvider as ThemeProvider$1, useTheme as useTheme$1, css, styled, keyframes } from "styled-components";
|
|
7
7
|
import { SpinnerIcon, CheckmarkIcon, RemoveIcon, ChevronDownIcon, CloseIcon, ChevronRightIcon, ToggleArrowRightIcon } from "@sanity/icons";
|
|
@@ -3221,16 +3221,37 @@ function findMinBreakpoints(media, width) {
|
|
|
3221
3221
|
return ret;
|
|
3222
3222
|
}
|
|
3223
3223
|
const ElementQuery = forwardRef(function(props, forwardedRef) {
|
|
3224
|
-
const theme = useTheme_v2()
|
|
3224
|
+
const $ = c(18), theme = useTheme_v2();
|
|
3225
|
+
let _media, restProps, children;
|
|
3226
|
+
$[0] !== props ? ({
|
|
3225
3227
|
children,
|
|
3226
3228
|
media: _media,
|
|
3227
3229
|
...restProps
|
|
3228
|
-
} = props,
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3230
|
+
} = props, $[0] = props, $[1] = _media, $[2] = restProps, $[3] = children) : (_media = $[1], restProps = $[2], children = $[3]);
|
|
3231
|
+
const media = _media ?? theme.media, [element, setElement] = useState(null), elementSize = useElementSize(element);
|
|
3232
|
+
let t0;
|
|
3233
|
+
t0 = elementSize?.border.width ?? window.innerWidth;
|
|
3234
|
+
const width = t0;
|
|
3235
|
+
let t1, t2;
|
|
3236
|
+
if ($[4] !== media || $[5] !== width) {
|
|
3237
|
+
const eq = findMaxBreakpoints(media, width);
|
|
3238
|
+
t2 = eq.length ? eq.join(" ") : void 0, $[4] = media, $[5] = width, $[6] = t2;
|
|
3239
|
+
} else
|
|
3240
|
+
t2 = $[6];
|
|
3241
|
+
t1 = t2;
|
|
3242
|
+
const max = t1;
|
|
3243
|
+
let t3, t4;
|
|
3244
|
+
if ($[7] !== media || $[8] !== width) {
|
|
3245
|
+
const eq_0 = findMinBreakpoints(media, width);
|
|
3246
|
+
t4 = eq_0.length ? eq_0.join(" ") : void 0, $[7] = media, $[8] = width, $[9] = t4;
|
|
3247
|
+
} else
|
|
3248
|
+
t4 = $[9];
|
|
3249
|
+
t3 = t4;
|
|
3250
|
+
const min = t3;
|
|
3251
|
+
let t5, t6;
|
|
3252
|
+
$[10] !== element ? (t5 = () => element, t6 = [element], $[10] = element, $[11] = t5, $[12] = t6) : (t5 = $[11], t6 = $[12]), useImperativeHandle(forwardedRef, t5, t6);
|
|
3253
|
+
let t7;
|
|
3254
|
+
return $[13] !== restProps || $[14] !== max || $[15] !== min || $[16] !== children ? (t7 = /* @__PURE__ */ jsx("div", { "data-ui": "ElementQuery", ...restProps, "data-eq-max": max, "data-eq-min": min, ref: setElement, children }), $[13] = restProps, $[14] = max, $[15] = min, $[16] = children, $[17] = t7) : t7 = $[17], t7;
|
|
3234
3255
|
});
|
|
3235
3256
|
ElementQuery.displayName = "ForwardRef(ElementQuery)";
|
|
3236
3257
|
class ErrorBoundary extends Component {
|
|
@@ -3357,10 +3378,18 @@ function _isScrollable(el) {
|
|
|
3357
3378
|
return style.overflowX.includes("auto") || style.overflowX.includes("scroll") || style.overflowY.includes("auto") || style.overflowY.includes("scroll");
|
|
3358
3379
|
}
|
|
3359
3380
|
function LayerProvider(props) {
|
|
3360
|
-
const {
|
|
3381
|
+
const $ = c(19), {
|
|
3361
3382
|
children,
|
|
3362
|
-
zOffset:
|
|
3363
|
-
} = props,
|
|
3383
|
+
zOffset: t0
|
|
3384
|
+
} = props, zOffsetProp = t0 === void 0 ? 0 : t0, parentContextValue = useContext(LayerContext);
|
|
3385
|
+
let t1;
|
|
3386
|
+
$[0] !== parentContextValue ? (t1 = parentContextValue && getLayerContext(parentContextValue), $[0] = parentContextValue, $[1] = t1) : t1 = $[1];
|
|
3387
|
+
const parent = t1, parentRegisterChild = parent?.registerChild, level = (parent?.level ?? 0) + 1, zOffset = useArrayProp(zOffsetProp), maxMediaIndex = zOffset.length - 1, mediaIndex = Math.min(useMediaIndex(), maxMediaIndex), zIndex = parent ? parent.zIndex + zOffset[mediaIndex] : zOffset[mediaIndex];
|
|
3388
|
+
let t2;
|
|
3389
|
+
$[2] === Symbol.for("react.memo_cache_sentinel") ? (t2 = {}, $[2] = t2) : t2 = $[2];
|
|
3390
|
+
const [, setChildLayers] = useState(t2), [size2, setSize] = useState(0), isTopLayer = size2 === 0;
|
|
3391
|
+
let t3;
|
|
3392
|
+
$[3] !== parentRegisterChild || $[4] !== setChildLayers ? (t3 = (childLevel) => {
|
|
3364
3393
|
const parentDispose = parentRegisterChild?.(childLevel);
|
|
3365
3394
|
return childLevel !== void 0 ? setChildLayers((state) => {
|
|
3366
3395
|
const prevLen = state[childLevel] ?? 0, nextState = {
|
|
@@ -3373,20 +3402,25 @@ function LayerProvider(props) {
|
|
|
3373
3402
|
const nextState_0 = {
|
|
3374
3403
|
...state_0
|
|
3375
3404
|
};
|
|
3376
|
-
return nextState_0[childLevel] === 1 ? (delete nextState_0[childLevel], setSize(Object.keys(nextState_0).length)) : nextState_0[childLevel]
|
|
3405
|
+
return nextState_0[childLevel] === 1 ? (delete nextState_0[childLevel], setSize(Object.keys(nextState_0).length)) : nextState_0[childLevel] = nextState_0[childLevel] - 1, nextState_0;
|
|
3377
3406
|
}) : setSize((v_0) => v_0 - 1), parentDispose?.();
|
|
3378
3407
|
};
|
|
3379
|
-
}, [parentRegisterChild]);
|
|
3380
|
-
|
|
3381
|
-
|
|
3408
|
+
}, $[3] = parentRegisterChild, $[4] = setChildLayers, $[5] = t3) : t3 = $[5];
|
|
3409
|
+
const registerChild = t3;
|
|
3410
|
+
let t4, t5;
|
|
3411
|
+
$[6] !== parentRegisterChild || $[7] !== level ? (t4 = () => parentRegisterChild?.(level), t5 = [level, parentRegisterChild], $[6] = parentRegisterChild, $[7] = level, $[8] = t4, $[9] = t5) : (t4 = $[8], t5 = $[9]), useEffect(t4, t5);
|
|
3412
|
+
let t6, t7;
|
|
3413
|
+
$[10] !== isTopLayer || $[11] !== level || $[12] !== registerChild || $[13] !== size2 || $[14] !== zIndex ? (t7 = {
|
|
3382
3414
|
version: 0,
|
|
3383
3415
|
isTopLayer,
|
|
3384
3416
|
level,
|
|
3385
3417
|
registerChild,
|
|
3386
3418
|
size: size2,
|
|
3387
3419
|
zIndex
|
|
3388
|
-
}
|
|
3389
|
-
|
|
3420
|
+
}, $[10] = isTopLayer, $[11] = level, $[12] = registerChild, $[13] = size2, $[14] = zIndex, $[15] = t7) : t7 = $[15], t6 = t7;
|
|
3421
|
+
const value = t6;
|
|
3422
|
+
let t8;
|
|
3423
|
+
return $[16] !== value || $[17] !== children ? (t8 = /* @__PURE__ */ jsx(LayerContext.Provider, { value, children }), $[16] = value, $[17] = children, $[18] = t8) : t8 = $[18], t8;
|
|
3390
3424
|
}
|
|
3391
3425
|
LayerProvider.displayName = "LayerProvider";
|
|
3392
3426
|
const Root$j = styled.div({
|
|
@@ -3835,7 +3869,7 @@ const Popover = memo(forwardRef(function(props, forwardedRef) {
|
|
|
3835
3869
|
zOffset: _zOffsetProp,
|
|
3836
3870
|
updateRef,
|
|
3837
3871
|
...restProps
|
|
3838
|
-
} = props, boundaryElement = _boundaryElement ?? boundaryElementContext.element, fallbackPlacements = _fallbackPlacements ?? DEFAULT_FALLBACK_PLACEMENTS$1[props.placement ?? "bottom"], floatingBoundary = _floatingBoundary ?? boundaryElement ?? boundaryElementContext.element, referenceBoundary = _referenceBoundary ?? boundaryElement ?? boundaryElementContext.element, zOffsetProp = _zOffsetProp ?? layer.popover.zOffset, animate = usePrefersReducedMotion() ? !1 : _animate, boundarySize = useElementSize(boundaryElement)?.border, padding = useArrayProp(paddingProp), radius = useArrayProp(radiusProp), shadow = useArrayProp(shadowProp), widthArrayProp = useArrayProp(widthProp), zOffset = useArrayProp(zOffsetProp), ref = useRef(null),
|
|
3872
|
+
} = props, boundaryElement = _boundaryElement ?? boundaryElementContext.element, fallbackPlacements = _fallbackPlacements ?? DEFAULT_FALLBACK_PLACEMENTS$1[props.placement ?? "bottom"], floatingBoundary = _floatingBoundary ?? boundaryElement ?? boundaryElementContext.element, referenceBoundary = _referenceBoundary ?? boundaryElement ?? boundaryElementContext.element, zOffsetProp = _zOffsetProp ?? layer.popover.zOffset, animate = usePrefersReducedMotion() ? !1 : _animate, boundarySize = useElementSize(boundaryElement)?.border, padding = useArrayProp(paddingProp), radius = useArrayProp(radiusProp), shadow = useArrayProp(shadowProp), widthArrayProp = useArrayProp(widthProp), zOffset = useArrayProp(zOffsetProp), ref = useRef(null), [arrowElement, setArrowElement] = useState(null), rootBoundary = "viewport";
|
|
3839
3873
|
useImperativeHandle(forwardedRef, () => ref.current);
|
|
3840
3874
|
const mediaIndex = useMediaIndex(), boundaryWidth = constrainSize || preventOverflow ? boundarySize?.width : void 0, width = calcCurrentWidth({
|
|
3841
3875
|
container,
|
|
@@ -3889,14 +3923,14 @@ const Popover = memo(forwardRef(function(props, forwardedRef) {
|
|
|
3889
3923
|
rootBoundary,
|
|
3890
3924
|
padding: DEFAULT_POPOVER_PADDING
|
|
3891
3925
|
})), arrowProp && ret.push(arrow({
|
|
3892
|
-
element:
|
|
3926
|
+
element: arrowElement,
|
|
3893
3927
|
padding: DEFAULT_POPOVER_PADDING
|
|
3894
3928
|
})), animate && ret.push(origin), ret.push(hide({
|
|
3895
3929
|
boundary: referenceBoundary || void 0,
|
|
3896
3930
|
padding: DEFAULT_POPOVER_PADDING,
|
|
3897
3931
|
strategy: "referenceHidden"
|
|
3898
3932
|
})), ret;
|
|
3899
|
-
}, [animate, arrowProp, constrainSize, fallbackPlacements, floatingBoundary, margins, matchReferenceWidth, preventOverflow, referenceBoundary]), {
|
|
3933
|
+
}, [animate, arrowElement, arrowProp, constrainSize, fallbackPlacements, floatingBoundary, margins, matchReferenceWidth, preventOverflow, referenceBoundary]), {
|
|
3900
3934
|
x,
|
|
3901
3935
|
y,
|
|
3902
3936
|
middlewareData,
|
|
@@ -3908,9 +3942,7 @@ const Popover = memo(forwardRef(function(props, forwardedRef) {
|
|
|
3908
3942
|
middleware,
|
|
3909
3943
|
placement: placementProp,
|
|
3910
3944
|
whileElementsMounted: autoUpdate
|
|
3911
|
-
}), referenceHidden = middlewareData.hide?.referenceHidden, arrowX = middlewareData.arrow?.x, arrowY = middlewareData.arrow?.y, originX = middlewareData["@sanity/ui/origin"]?.originX, originY = middlewareData["@sanity/ui/origin"]?.originY,
|
|
3912
|
-
arrowRef.current = arrowEl;
|
|
3913
|
-
}, []), setFloating = useCallback((node) => {
|
|
3945
|
+
}), referenceHidden = middlewareData.hide?.referenceHidden, arrowX = middlewareData.arrow?.x, arrowY = middlewareData.arrow?.y, originX = middlewareData["@sanity/ui/origin"]?.originX, originY = middlewareData["@sanity/ui/origin"]?.originY, setFloating = useCallback((node) => {
|
|
3914
3946
|
ref.current = node, refs.setFloating(node);
|
|
3915
3947
|
}, [refs]), [childElement, setChildElement] = useState(null), setReference = useCallback((node_0) => {
|
|
3916
3948
|
refs.setReference(node_0), setChildElement(node_0);
|
|
@@ -3923,7 +3955,7 @@ const Popover = memo(forwardRef(function(props, forwardedRef) {
|
|
|
3923
3955
|
child || refs.setReference(referenceElement || null);
|
|
3924
3956
|
}, [referenceElement, refs, child]), disabled)
|
|
3925
3957
|
return childProp || /* @__PURE__ */ jsx(Fragment, {});
|
|
3926
|
-
const popover = /* @__PURE__ */ jsx(LayerProvider, { zOffset, children: /* @__PURE__ */ jsx(PopoverCard, { ...restProps, __unstable_margins: margins, animate, arrow: arrowProp, arrowRef:
|
|
3958
|
+
const popover = /* @__PURE__ */ jsx(LayerProvider, { zOffset, children: /* @__PURE__ */ jsx(PopoverCard, { ...restProps, __unstable_margins: margins, animate, arrow: arrowProp, arrowRef: setArrowElement, arrowX, arrowY, hidden: referenceHidden, overflow, padding, placement, radius, ref: setFloating, scheme, shadow, originX, originY, strategy, tone, width: matchReferenceWidth ? referenceWidthRef.current : width, x, y, children: content }) }), children = open && (portal ? /* @__PURE__ */ jsx(Portal, { __unstable_name: typeof portal == "string" ? portal : void 0, children: popover }) : popover);
|
|
3927
3959
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3928
3960
|
animate ? /* @__PURE__ */ jsx(AnimatePresence, { children }) : children,
|
|
3929
3961
|
child
|
|
@@ -5348,26 +5380,46 @@ const Autocomplete = InnerAutocomplete, Root$8 = styled.ol`
|
|
|
5348
5380
|
appearance: none;
|
|
5349
5381
|
margin: -4px;
|
|
5350
5382
|
`, Breadcrumbs = forwardRef(function(props, ref) {
|
|
5351
|
-
const
|
|
5383
|
+
const $ = c(37);
|
|
5384
|
+
let t0, children, maxLength, restProps, separator;
|
|
5385
|
+
$[0] !== props ? ({
|
|
5352
5386
|
children,
|
|
5353
5387
|
maxLength,
|
|
5354
5388
|
separator,
|
|
5355
|
-
space:
|
|
5389
|
+
space: t0,
|
|
5356
5390
|
...restProps
|
|
5357
|
-
} = props,
|
|
5358
|
-
|
|
5359
|
-
|
|
5391
|
+
} = props, $[0] = props, $[1] = t0, $[2] = children, $[3] = maxLength, $[4] = restProps, $[5] = separator) : (t0 = $[1], children = $[2], maxLength = $[3], restProps = $[4], separator = $[5]);
|
|
5392
|
+
const space = useArrayProp(t0 === void 0 ? 2 : t0), [open, setOpen] = useState(!1), expandElementRef = useRef(null), popoverElementRef = useRef(null);
|
|
5393
|
+
let t1;
|
|
5394
|
+
$[6] === Symbol.for("react.memo_cache_sentinel") ? (t1 = () => setOpen(!1), $[6] = t1) : t1 = $[6];
|
|
5395
|
+
const collapse = t1;
|
|
5396
|
+
let t2;
|
|
5397
|
+
$[7] === Symbol.for("react.memo_cache_sentinel") ? (t2 = () => setOpen(!0), $[7] = t2) : t2 = $[7];
|
|
5398
|
+
const expand = t2;
|
|
5399
|
+
let t3;
|
|
5400
|
+
$[8] === Symbol.for("react.memo_cache_sentinel") ? (t3 = () => [expandElementRef.current, popoverElementRef.current], $[8] = t3) : t3 = $[8], useClickOutsideEvent(collapse, t3);
|
|
5401
|
+
let T0, t4, t5, t6, t7;
|
|
5402
|
+
if ($[9] !== children || $[10] !== maxLength || $[11] !== space || $[12] !== open || $[13] !== restProps || $[14] !== ref || $[15] !== separator) {
|
|
5403
|
+
const rawItems = Children.toArray(children).filter(isValidElement);
|
|
5404
|
+
let items = rawItems;
|
|
5360
5405
|
const len = rawItems.length;
|
|
5361
|
-
if (maxLength &&
|
|
5362
|
-
const beforeLength = Math.ceil(maxLength / 2), afterLength = Math.floor(maxLength / 2);
|
|
5363
|
-
|
|
5364
|
-
|
|
5365
|
-
|
|
5366
|
-
|
|
5367
|
-
|
|
5368
|
-
|
|
5369
|
-
|
|
5370
|
-
|
|
5406
|
+
if (maxLength && rawItems.length > maxLength) {
|
|
5407
|
+
const beforeLength = Math.ceil(maxLength / 2), afterLength = Math.floor(maxLength / 2), t83 = /* @__PURE__ */ jsx(Stack, { as: "ol", overflow: "auto", padding: space, space, children: rawItems.slice(beforeLength - 1, len - afterLength) }), t9 = open ? collapse : expand;
|
|
5408
|
+
let t10;
|
|
5409
|
+
$[21] !== t9 || $[22] !== open ? (t10 = /* @__PURE__ */ jsx(ExpandButton, { fontSize: 1, mode: "bleed", onClick: t9, padding: 1, ref: expandElementRef, selected: open, text: "\u2026" }), $[21] = t9, $[22] = open, $[23] = t10) : t10 = $[23];
|
|
5410
|
+
let t11;
|
|
5411
|
+
$[24] !== t83 || $[25] !== open || $[26] !== t10 ? (t11 = /* @__PURE__ */ jsx(Popover, { constrainSize: !0, content: t83, open, placement: "top", portal: !0, ref: popoverElementRef, children: t10 }, "button"), $[24] = t83, $[25] = open, $[26] = t10, $[27] = t11) : t11 = $[27], items = [...rawItems.slice(0, beforeLength - 1), t11, ...rawItems.slice(len - afterLength)];
|
|
5412
|
+
}
|
|
5413
|
+
T0 = Root$8, t4 = "Breadcrumbs", t5 = restProps, t6 = ref;
|
|
5414
|
+
let t82;
|
|
5415
|
+
$[28] !== space || $[29] !== separator ? (t82 = (item, itemIndex) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
5416
|
+
itemIndex > 0 && /* @__PURE__ */ jsx(Box, { "aria-hidden": !0, as: "li", paddingX: space, children: separator || /* @__PURE__ */ jsx(Text, { muted: !0, children: "/" }) }),
|
|
5417
|
+
/* @__PURE__ */ jsx(Box, { as: "li", children: item })
|
|
5418
|
+
] }, itemIndex), $[28] = space, $[29] = separator, $[30] = t82) : t82 = $[30], t7 = items.map(t82), $[9] = children, $[10] = maxLength, $[11] = space, $[12] = open, $[13] = restProps, $[14] = ref, $[15] = separator, $[16] = T0, $[17] = t4, $[18] = t5, $[19] = t6, $[20] = t7;
|
|
5419
|
+
} else
|
|
5420
|
+
T0 = $[16], t4 = $[17], t5 = $[18], t6 = $[19], t7 = $[20];
|
|
5421
|
+
let t8;
|
|
5422
|
+
return $[31] !== T0 || $[32] !== t4 || $[33] !== t5 || $[34] !== t6 || $[35] !== t7 ? (t8 = /* @__PURE__ */ jsx(T0, { "data-ui": t4, ...t5, ref: t6, children: t7 }), $[31] = T0, $[32] = t4, $[33] = t5, $[34] = t6, $[35] = t7, $[36] = t8) : t8 = $[36], t8;
|
|
5371
5423
|
});
|
|
5372
5424
|
Breadcrumbs.displayName = "ForwardRef(Breadcrumbs)";
|
|
5373
5425
|
function dialogStyle({
|
|
@@ -5919,8 +5971,8 @@ const Root$5 = styled(Box)`
|
|
|
5919
5971
|
});
|
|
5920
5972
|
Menu.displayName = "ForwardRef(Menu)";
|
|
5921
5973
|
const MenuButton = forwardRef(function(props, forwardedRef) {
|
|
5922
|
-
const {
|
|
5923
|
-
__unstable_disableRestoreFocusOnClose:
|
|
5974
|
+
const $ = c(62), {
|
|
5975
|
+
__unstable_disableRestoreFocusOnClose: t0,
|
|
5924
5976
|
boundaryElement: deprecated_boundaryElement,
|
|
5925
5977
|
button: buttonProp,
|
|
5926
5978
|
id,
|
|
@@ -5929,23 +5981,38 @@ const MenuButton = forwardRef(function(props, forwardedRef) {
|
|
|
5929
5981
|
onOpen,
|
|
5930
5982
|
placement: deprecated_placement,
|
|
5931
5983
|
popoverScheme: deprecated_popoverScheme,
|
|
5932
|
-
portal:
|
|
5984
|
+
portal: t1,
|
|
5933
5985
|
popover,
|
|
5934
5986
|
popoverRadius: deprecated_popoverRadius,
|
|
5935
5987
|
preventOverflow: deprecated_preventOverflow
|
|
5936
|
-
} = props, [open, setOpen] = useState(!1), [shouldFocus, setShouldFocus] = useState(null), [buttonElement, setButtonElement] = useState(null)
|
|
5937
|
-
|
|
5988
|
+
} = props, disableRestoreFocusOnClose = t0 === void 0 ? !1 : t0, deprecated_portal = t1 === void 0 ? !0 : t1, [open, setOpen] = useState(!1), [shouldFocus, setShouldFocus] = useState(null), [buttonElement, setButtonElement] = useState(null);
|
|
5989
|
+
let t2;
|
|
5990
|
+
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t2 = [], $[0] = t2) : t2 = $[0];
|
|
5991
|
+
const [menuElements, setChildMenuElements] = useState(t2), openRef = useRef(open);
|
|
5992
|
+
let t3, t4;
|
|
5993
|
+
$[1] !== onOpen || $[2] !== open ? (t3 = () => {
|
|
5938
5994
|
onOpen && open && !openRef.current && onOpen();
|
|
5939
|
-
}, [onOpen, open]), useEffect(
|
|
5995
|
+
}, t4 = [onOpen, open], $[1] = onOpen, $[2] = open, $[3] = t3, $[4] = t4) : (t3 = $[3], t4 = $[4]), useEffect(t3, t4);
|
|
5996
|
+
let t5, t6;
|
|
5997
|
+
$[5] !== onClose || $[6] !== open ? (t5 = () => {
|
|
5940
5998
|
onClose && !open && openRef.current && onClose();
|
|
5941
|
-
}, [onClose, open]), useEffect(
|
|
5999
|
+
}, t6 = [onClose, open], $[5] = onClose, $[6] = open, $[7] = t5, $[8] = t6) : (t5 = $[7], t6 = $[8]), useEffect(t5, t6);
|
|
6000
|
+
let t7, t8;
|
|
6001
|
+
$[9] !== open ? (t7 = () => {
|
|
5942
6002
|
openRef.current = open;
|
|
5943
|
-
}, [open]);
|
|
5944
|
-
|
|
6003
|
+
}, t8 = [open], $[9] = open, $[10] = t7, $[11] = t8) : (t7 = $[10], t8 = $[11]), useEffect(t7, t8);
|
|
6004
|
+
let t9;
|
|
6005
|
+
$[12] === Symbol.for("react.memo_cache_sentinel") ? (t9 = () => {
|
|
5945
6006
|
setOpen((v) => !v), setShouldFocus(null);
|
|
5946
|
-
}, []
|
|
6007
|
+
}, $[12] = t9) : t9 = $[12];
|
|
6008
|
+
const handleButtonClick = t9;
|
|
6009
|
+
let t10;
|
|
6010
|
+
$[13] !== open ? (t10 = (event) => {
|
|
5947
6011
|
open && event.preventDefault();
|
|
5948
|
-
}, [open
|
|
6012
|
+
}, $[13] = open, $[14] = t10) : t10 = $[14];
|
|
6013
|
+
const handleMouseDown = t10;
|
|
6014
|
+
let t11;
|
|
6015
|
+
$[15] === Symbol.for("react.memo_cache_sentinel") ? (t11 = (event_0) => {
|
|
5949
6016
|
if (event_0.key === "ArrowDown" || event_0.key === "Enter" || event_0.key === " ") {
|
|
5950
6017
|
event_0.preventDefault(), setOpen(!0), setShouldFocus("first");
|
|
5951
6018
|
return;
|
|
@@ -5954,7 +6021,10 @@ const MenuButton = forwardRef(function(props, forwardedRef) {
|
|
|
5954
6021
|
event_0.preventDefault(), setOpen(!0), setShouldFocus("last");
|
|
5955
6022
|
return;
|
|
5956
6023
|
}
|
|
5957
|
-
}, []
|
|
6024
|
+
}, $[15] = t11) : t11 = $[15];
|
|
6025
|
+
const handleButtonKeyDown = t11;
|
|
6026
|
+
let t12;
|
|
6027
|
+
$[16] !== buttonElement || $[17] !== menuElements ? (t12 = (event_1) => {
|
|
5958
6028
|
const target = event_1.target;
|
|
5959
6029
|
if (target instanceof Node && !(buttonElement && (target === buttonElement || buttonElement.contains(target)))) {
|
|
5960
6030
|
for (const el of menuElements)
|
|
@@ -5962,9 +6032,15 @@ const MenuButton = forwardRef(function(props, forwardedRef) {
|
|
|
5962
6032
|
return;
|
|
5963
6033
|
setOpen(!1);
|
|
5964
6034
|
}
|
|
5965
|
-
}, [buttonElement, menuElements
|
|
6035
|
+
}, $[16] = buttonElement, $[17] = menuElements, $[18] = t12) : t12 = $[18];
|
|
6036
|
+
const handleMenuClickOutside = t12;
|
|
6037
|
+
let t13;
|
|
6038
|
+
$[19] !== disableRestoreFocusOnClose || $[20] !== buttonElement ? (t13 = () => {
|
|
5966
6039
|
setOpen(!1), !disableRestoreFocusOnClose && buttonElement && buttonElement.focus();
|
|
5967
|
-
}, [
|
|
6040
|
+
}, $[19] = disableRestoreFocusOnClose, $[20] = buttonElement, $[21] = t13) : t13 = $[21];
|
|
6041
|
+
const handleMenuEscape = t13;
|
|
6042
|
+
let t14;
|
|
6043
|
+
$[22] !== menuElements ? (t14 = (event_2) => {
|
|
5968
6044
|
const target_0 = event_2.relatedTarget;
|
|
5969
6045
|
if (target_0 instanceof Node) {
|
|
5970
6046
|
for (const el_0 of menuElements)
|
|
@@ -5972,9 +6048,18 @@ const MenuButton = forwardRef(function(props, forwardedRef) {
|
|
|
5972
6048
|
return;
|
|
5973
6049
|
setOpen(!1);
|
|
5974
6050
|
}
|
|
5975
|
-
}, [menuElements
|
|
6051
|
+
}, $[22] = menuElements, $[23] = t14) : t14 = $[23];
|
|
6052
|
+
const handleBlur = t14;
|
|
6053
|
+
let t15;
|
|
6054
|
+
$[24] !== disableRestoreFocusOnClose || $[25] !== buttonElement ? (t15 = () => {
|
|
5976
6055
|
setOpen(!1), !disableRestoreFocusOnClose && buttonElement && buttonElement.focus();
|
|
5977
|
-
}, [
|
|
6056
|
+
}, $[24] = disableRestoreFocusOnClose, $[25] = buttonElement, $[26] = t15) : t15 = $[26];
|
|
6057
|
+
const handleItemClick = t15;
|
|
6058
|
+
let t16;
|
|
6059
|
+
$[27] === Symbol.for("react.memo_cache_sentinel") ? (t16 = (el_1) => (setChildMenuElements((els) => els.concat([el_1])), () => setChildMenuElements((els_0) => els_0.filter((_el) => _el !== el_1))), $[27] = t16) : t16 = $[27];
|
|
6060
|
+
const registerElement = t16;
|
|
6061
|
+
let t17;
|
|
6062
|
+
$[28] !== id || $[29] !== handleBlur || $[30] !== handleMenuClickOutside || $[31] !== handleMenuEscape || $[32] !== handleItemClick || $[33] !== buttonElement || $[34] !== shouldFocus || $[35] !== menuProp ? (t17 = menuProp && cloneElement(menuProp, {
|
|
5978
6063
|
"aria-labelledby": id,
|
|
5979
6064
|
onBlurCapture: handleBlur,
|
|
5980
6065
|
onClickOutside: handleMenuClickOutside,
|
|
@@ -5983,7 +6068,10 @@ const MenuButton = forwardRef(function(props, forwardedRef) {
|
|
|
5983
6068
|
originElement: buttonElement,
|
|
5984
6069
|
registerElement,
|
|
5985
6070
|
shouldFocus
|
|
5986
|
-
}), [
|
|
6071
|
+
}), $[28] = id, $[29] = handleBlur, $[30] = handleMenuClickOutside, $[31] = handleMenuEscape, $[32] = handleItemClick, $[33] = buttonElement, $[34] = shouldFocus, $[35] = menuProp, $[36] = t17) : t17 = $[36];
|
|
6072
|
+
const menu = t17;
|
|
6073
|
+
let t18, t19;
|
|
6074
|
+
$[37] !== buttonProp || $[38] !== open || $[39] !== id || $[40] !== handleMouseDown ? (t19 = buttonProp && cloneElement(buttonProp, {
|
|
5987
6075
|
"data-ui": "MenuButton",
|
|
5988
6076
|
id,
|
|
5989
6077
|
onClick: handleButtonClick,
|
|
@@ -5991,14 +6079,16 @@ const MenuButton = forwardRef(function(props, forwardedRef) {
|
|
|
5991
6079
|
onMouseDown: handleMouseDown,
|
|
5992
6080
|
"aria-haspopup": !0,
|
|
5993
6081
|
"aria-expanded": open,
|
|
5994
|
-
ref,
|
|
6082
|
+
ref: setButtonElement,
|
|
5995
6083
|
selected: buttonProp.props.selected ?? open
|
|
5996
|
-
}), [buttonProp,
|
|
5997
|
-
|
|
5998
|
-
|
|
5999
|
-
|
|
6000
|
-
|
|
6001
|
-
|
|
6084
|
+
}), $[37] = buttonProp, $[38] = open, $[39] = id, $[40] = handleMouseDown, $[41] = t19) : t19 = $[41], t18 = t19;
|
|
6085
|
+
const button = t18;
|
|
6086
|
+
let t20, t21;
|
|
6087
|
+
$[42] !== buttonElement ? (t20 = () => buttonElement, t21 = [buttonElement], $[42] = buttonElement, $[43] = t20, $[44] = t21) : (t20 = $[43], t21 = $[44]), useImperativeHandle(forwardedRef, t20, t21);
|
|
6088
|
+
let t22, t23;
|
|
6089
|
+
$[45] !== popover ? (t23 = popover || {}, $[45] = popover, $[46] = t23) : t23 = $[46];
|
|
6090
|
+
let t24;
|
|
6091
|
+
$[47] !== deprecated_boundaryElement || $[48] !== deprecated_placement || $[49] !== deprecated_portal || $[50] !== deprecated_preventOverflow || $[51] !== deprecated_popoverRadius || $[52] !== deprecated_popoverScheme || $[53] !== t23 ? (t24 = {
|
|
6002
6092
|
boundaryElement: deprecated_boundaryElement,
|
|
6003
6093
|
overflow: "auto",
|
|
6004
6094
|
placement: deprecated_placement,
|
|
@@ -6006,9 +6096,13 @@ const MenuButton = forwardRef(function(props, forwardedRef) {
|
|
|
6006
6096
|
preventOverflow: deprecated_preventOverflow,
|
|
6007
6097
|
radius: deprecated_popoverRadius,
|
|
6008
6098
|
scheme: deprecated_popoverScheme,
|
|
6009
|
-
...
|
|
6010
|
-
}
|
|
6011
|
-
|
|
6099
|
+
...t23
|
|
6100
|
+
}, $[47] = deprecated_boundaryElement, $[48] = deprecated_placement, $[49] = deprecated_portal, $[50] = deprecated_preventOverflow, $[51] = deprecated_popoverRadius, $[52] = deprecated_popoverScheme, $[53] = t23, $[54] = t24) : t24 = $[54], t22 = t24;
|
|
6101
|
+
const popoverProps = t22;
|
|
6102
|
+
let t25;
|
|
6103
|
+
$[55] !== button ? (t25 = button || /* @__PURE__ */ jsx(Fragment, {}), $[55] = button, $[56] = t25) : t25 = $[56];
|
|
6104
|
+
let t26;
|
|
6105
|
+
return $[57] !== popoverProps || $[58] !== menu || $[59] !== open || $[60] !== t25 ? (t26 = /* @__PURE__ */ jsx(Popover, { "data-ui": "MenuButton__popover", ...popoverProps, content: menu, open, children: t25 }), $[57] = popoverProps, $[58] = menu, $[59] = open, $[60] = t25, $[61] = t26) : t26 = $[61], t26;
|
|
6012
6106
|
});
|
|
6013
6107
|
MenuButton.displayName = "ForwardRef(MenuButton)";
|
|
6014
6108
|
const MenuDivider = styled.hr`
|
|
@@ -6492,9 +6586,6 @@ const CustomButton = styled(Button)`
|
|
|
6492
6586
|
return $[18] !== restProps || $[19] !== t7 || $[20] !== fontSize2 || $[21] !== icon || $[22] !== id || $[23] !== onClick || $[24] !== handleFocus || $[25] !== padding || $[26] !== selected || $[27] !== t8 || $[28] !== label ? (t9 = /* @__PURE__ */ jsx(CustomButton, { "data-ui": "Tab", ...restProps, "aria-selected": t7, fontSize: fontSize2, icon, id, mode: "bleed", onClick, onBlur: handleBlur, onFocus: handleFocus, padding, ref, role: "tab", selected, tabIndex: t8, text: label, type: "button" }), $[18] = restProps, $[19] = t7, $[20] = fontSize2, $[21] = icon, $[22] = id, $[23] = onClick, $[24] = handleFocus, $[25] = padding, $[26] = selected, $[27] = t8, $[28] = label, $[29] = t9) : t9 = $[29], t9;
|
|
6493
6587
|
});
|
|
6494
6588
|
Tab.displayName = "ForwardRef(Tab)";
|
|
6495
|
-
function _isReactElement(node) {
|
|
6496
|
-
return !!node;
|
|
6497
|
-
}
|
|
6498
6589
|
const CustomInline = styled(Inline)`
|
|
6499
6590
|
& > div {
|
|
6500
6591
|
display: inline-block;
|
|
@@ -6503,19 +6594,32 @@ const CustomInline = styled(Inline)`
|
|
|
6503
6594
|
box-sizing: border-box;
|
|
6504
6595
|
}
|
|
6505
6596
|
`, TabList = forwardRef(function(props, ref) {
|
|
6506
|
-
const
|
|
6597
|
+
const $ = c(15);
|
|
6598
|
+
let childrenProp, restProps;
|
|
6599
|
+
$[0] !== props ? ({
|
|
6507
6600
|
children: childrenProp,
|
|
6508
6601
|
...restProps
|
|
6509
|
-
} = props, [
|
|
6510
|
-
|
|
6511
|
-
|
|
6512
|
-
|
|
6513
|
-
|
|
6514
|
-
|
|
6515
|
-
|
|
6602
|
+
} = props, $[0] = props, $[1] = childrenProp, $[2] = restProps) : (childrenProp = $[1], restProps = $[2]);
|
|
6603
|
+
const [focusedIndex, setFocusedIndex] = useState(-1);
|
|
6604
|
+
let t0;
|
|
6605
|
+
if ($[3] !== childrenProp || $[4] !== focusedIndex) {
|
|
6606
|
+
const children = Children.toArray(childrenProp).filter(isValidElement);
|
|
6607
|
+
let t12;
|
|
6608
|
+
$[6] !== focusedIndex ? (t12 = (child, childIndex) => cloneElement(child, {
|
|
6609
|
+
focused: focusedIndex === childIndex,
|
|
6610
|
+
key: childIndex,
|
|
6611
|
+
onFocus: () => setFocusedIndex(childIndex)
|
|
6612
|
+
}), $[6] = focusedIndex, $[7] = t12) : t12 = $[7], t0 = children.map(t12), $[3] = childrenProp, $[4] = focusedIndex, $[5] = t0;
|
|
6613
|
+
} else
|
|
6614
|
+
t0 = $[5];
|
|
6615
|
+
const tabs = t0, numTabs = tabs.length;
|
|
6616
|
+
let t1;
|
|
6617
|
+
$[8] !== numTabs ? (t1 = (event) => {
|
|
6516
6618
|
event.key === "ArrowLeft" && setFocusedIndex((prevIndex) => (prevIndex + numTabs - 1) % numTabs), event.key === "ArrowRight" && setFocusedIndex((prevIndex_0) => (prevIndex_0 + 1) % numTabs);
|
|
6517
|
-
}, [numTabs]);
|
|
6518
|
-
|
|
6619
|
+
}, $[8] = numTabs, $[9] = t1) : t1 = $[9];
|
|
6620
|
+
const handleKeyDown = t1;
|
|
6621
|
+
let t2;
|
|
6622
|
+
return $[10] !== restProps || $[11] !== handleKeyDown || $[12] !== ref || $[13] !== tabs ? (t2 = /* @__PURE__ */ jsx(CustomInline, { "data-ui": "TabList", ...restProps, onKeyDown: handleKeyDown, ref, role: "tablist", children: tabs }), $[10] = restProps, $[11] = handleKeyDown, $[12] = ref, $[13] = tabs, $[14] = t2) : t2 = $[14], t2;
|
|
6519
6623
|
});
|
|
6520
6624
|
TabList.displayName = "ForwardRef(TabList)";
|
|
6521
6625
|
const TabPanel = forwardRef(function(props, ref) {
|
|
@@ -6636,7 +6740,12 @@ function _temp() {
|
|
|
6636
6740
|
return !0;
|
|
6637
6741
|
}
|
|
6638
6742
|
const subscribe = () => () => {
|
|
6639
|
-
}, ToastContext = createGlobalScopedContext("@sanity/ui/context/toast", null)
|
|
6743
|
+
}, ToastContext = createGlobalScopedContext("@sanity/ui/context/toast", null);
|
|
6744
|
+
let toastId = 0;
|
|
6745
|
+
function generateToastId() {
|
|
6746
|
+
return String(toastId++);
|
|
6747
|
+
}
|
|
6748
|
+
const Root$1 = styled(Layer)`
|
|
6640
6749
|
position: fixed;
|
|
6641
6750
|
top: 0;
|
|
6642
6751
|
left: 0;
|
|
@@ -6651,31 +6760,44 @@ const subscribe = () => () => {
|
|
|
6651
6760
|
max-width: 420px;
|
|
6652
6761
|
width: 100%;
|
|
6653
6762
|
`;
|
|
6654
|
-
let toastId = 0;
|
|
6655
6763
|
function ToastProvider(props) {
|
|
6656
|
-
const {
|
|
6764
|
+
const $ = c(24), {
|
|
6657
6765
|
children,
|
|
6658
|
-
padding
|
|
6766
|
+
padding: t0,
|
|
6659
6767
|
paddingX,
|
|
6660
6768
|
paddingY,
|
|
6661
6769
|
zOffset
|
|
6662
|
-
} = props,
|
|
6663
|
-
|
|
6664
|
-
|
|
6665
|
-
|
|
6666
|
-
|
|
6667
|
-
|
|
6668
|
-
|
|
6669
|
-
|
|
6670
|
-
|
|
6671
|
-
|
|
6672
|
-
|
|
6673
|
-
|
|
6674
|
-
|
|
6675
|
-
|
|
6770
|
+
} = props, padding = t0 === void 0 ? 4 : t0;
|
|
6771
|
+
let t1;
|
|
6772
|
+
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t1 = [], $[0] = t1) : t1 = $[0];
|
|
6773
|
+
const [state, _setState] = useState(t1);
|
|
6774
|
+
let t2;
|
|
6775
|
+
$[1] === Symbol.for("react.memo_cache_sentinel") ? (t2 = {}, $[1] = t2) : t2 = $[1];
|
|
6776
|
+
const toastsRef = useRef(t2), mounted = useMounted(), prefersReducedMotion = usePrefersReducedMotion();
|
|
6777
|
+
let t3, t4, t5;
|
|
6778
|
+
$[2] === Symbol.for("react.memo_cache_sentinel") ? (t4 = {
|
|
6779
|
+
opacity: 0,
|
|
6780
|
+
[POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: 0,
|
|
6781
|
+
y: 32,
|
|
6782
|
+
scale: 0.25,
|
|
6783
|
+
willChange: "transform"
|
|
6784
|
+
}, t5 = [0, 1, 1], $[2] = t4, $[3] = t5) : (t4 = $[2], t5 = $[3]);
|
|
6785
|
+
let t6, t7;
|
|
6786
|
+
$[4] === Symbol.for("react.memo_cache_sentinel") ? (t6 = {
|
|
6787
|
+
opacity: t5,
|
|
6788
|
+
[POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: [0, 0, 1],
|
|
6789
|
+
y: 0,
|
|
6790
|
+
scale: 1
|
|
6791
|
+
}, t7 = [1, 1, 0], $[4] = t6, $[5] = t7) : (t6 = $[4], t7 = $[5]);
|
|
6792
|
+
let t8;
|
|
6793
|
+
$[6] === Symbol.for("react.memo_cache_sentinel") ? (t8 = [1, 0, 0], $[6] = t8) : t8 = $[6];
|
|
6794
|
+
let t9;
|
|
6795
|
+
$[7] !== prefersReducedMotion ? (t9 = {
|
|
6796
|
+
initial: t4,
|
|
6797
|
+
animate: t6,
|
|
6676
6798
|
exit: {
|
|
6677
|
-
opacity:
|
|
6678
|
-
[POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]:
|
|
6799
|
+
opacity: t7,
|
|
6800
|
+
[POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: t8,
|
|
6679
6801
|
scale: 0.5,
|
|
6680
6802
|
transition: prefersReducedMotion ? {
|
|
6681
6803
|
duration: 0
|
|
@@ -6683,10 +6805,13 @@ function ToastProvider(props) {
|
|
|
6683
6805
|
duration: 0.2
|
|
6684
6806
|
}
|
|
6685
6807
|
}
|
|
6686
|
-
}
|
|
6808
|
+
}, $[7] = prefersReducedMotion, $[8] = t9) : t9 = $[8], t3 = t9;
|
|
6809
|
+
const variants = t3;
|
|
6810
|
+
let t10, t11;
|
|
6811
|
+
$[9] === Symbol.for("react.memo_cache_sentinel") ? (t11 = {
|
|
6687
6812
|
version: 0,
|
|
6688
6813
|
push: (params) => {
|
|
6689
|
-
const setState = (state_0) => startTransition(() => _setState(state_0)), id = params.id ||
|
|
6814
|
+
const setState = (state_0) => startTransition(() => _setState(state_0)), id = params.id || generateToastId(), duration = params.duration || 5e3, dismiss = () => {
|
|
6690
6815
|
const timeoutId = toastsRef.current[id]?.timeoutId;
|
|
6691
6816
|
setState((prevState) => {
|
|
6692
6817
|
const idx = prevState.findIndex((t) => t.id === id);
|
|
@@ -6708,27 +6833,36 @@ function ToastProvider(props) {
|
|
|
6708
6833
|
timeoutId: setTimeout(dismiss, duration)
|
|
6709
6834
|
}, id;
|
|
6710
6835
|
}
|
|
6711
|
-
}
|
|
6712
|
-
|
|
6836
|
+
}, $[9] = t11) : t11 = $[9], t10 = t11;
|
|
6837
|
+
const value = t10;
|
|
6838
|
+
let t12, t13;
|
|
6839
|
+
$[10] === Symbol.for("react.memo_cache_sentinel") ? (t12 = () => () => {
|
|
6713
6840
|
for (const {
|
|
6714
6841
|
timeoutId: timeoutId_0
|
|
6715
6842
|
} of Object.values(toastsRef.current))
|
|
6716
6843
|
clearTimeout(timeoutId_0);
|
|
6717
6844
|
toastsRef.current = {};
|
|
6718
|
-
}, []
|
|
6719
|
-
|
|
6720
|
-
|
|
6845
|
+
}, t13 = [], $[10] = t12, $[11] = t13) : (t12 = $[10], t13 = $[11]), useEffect(t12, t13);
|
|
6846
|
+
let t14;
|
|
6847
|
+
$[12] !== mounted || $[13] !== variants || $[14] !== prefersReducedMotion || $[15] !== state || $[16] !== padding || $[17] !== paddingX || $[18] !== paddingY || $[19] !== zOffset ? (t14 = mounted && /* @__PURE__ */ jsx(Root$1, { "data-ui": "ToastProvider", zOffset, children: /* @__PURE__ */ jsx(ToastContainer, { children: /* @__PURE__ */ jsx(Box, { padding, paddingX, paddingY, children: /* @__PURE__ */ jsx(AnimatePresence, { initial: !1, children: state.map((t152) => {
|
|
6848
|
+
const {
|
|
6721
6849
|
dismiss: dismiss_0,
|
|
6722
6850
|
id: id_0,
|
|
6723
6851
|
params: params_0
|
|
6724
|
-
}
|
|
6852
|
+
} = t152;
|
|
6853
|
+
return /* @__PURE__ */ jsx(motion.div, { layout: "position", initial: "initial", animate: "animate", exit: "exit", variants, transition: prefersReducedMotion ? {
|
|
6725
6854
|
duration: 0
|
|
6726
6855
|
} : {
|
|
6727
6856
|
type: "spring",
|
|
6728
6857
|
damping: 30,
|
|
6729
6858
|
stiffness: 400
|
|
6730
|
-
}, children: /* @__PURE__ */ jsx(Toast, { closable: params_0.closable, description: params_0.description, onClose: dismiss_0, status: params_0.status, title: params_0.title, duration: params_0.duration }) }, id_0)
|
|
6731
|
-
|
|
6859
|
+
}, children: /* @__PURE__ */ jsx(Toast, { closable: params_0.closable, description: params_0.description, onClose: dismiss_0, status: params_0.status, title: params_0.title, duration: params_0.duration }) }, id_0);
|
|
6860
|
+
}) }) }) }) }), $[12] = mounted, $[13] = variants, $[14] = prefersReducedMotion, $[15] = state, $[16] = padding, $[17] = paddingX, $[18] = paddingY, $[19] = zOffset, $[20] = t14) : t14 = $[20];
|
|
6861
|
+
let t15;
|
|
6862
|
+
return $[21] !== children || $[22] !== t14 ? (t15 = /* @__PURE__ */ jsxs(ToastContext.Provider, { value, children: [
|
|
6863
|
+
children,
|
|
6864
|
+
t14
|
|
6865
|
+
] }), $[21] = children, $[22] = t14, $[23] = t15) : t15 = $[23], t15;
|
|
6732
6866
|
}
|
|
6733
6867
|
ToastProvider.displayName = "ToastProvider";
|
|
6734
6868
|
function useToast() {
|
|
@@ -7065,61 +7199,117 @@ const TreeGroup = memo(function(props) {
|
|
|
7065
7199
|
transition: transform 100ms;
|
|
7066
7200
|
}
|
|
7067
7201
|
`, TreeItem = memo(function(props) {
|
|
7068
|
-
const
|
|
7202
|
+
const $ = c(112);
|
|
7203
|
+
let t0, t1, t2, t3, t4, idProp, onClick, IconComponent, children, muted, weight, text, href, linkAs, restProps;
|
|
7204
|
+
$[0] !== props ? ({
|
|
7069
7205
|
children,
|
|
7070
|
-
expanded:
|
|
7071
|
-
fontSize:
|
|
7206
|
+
expanded: t0,
|
|
7207
|
+
fontSize: t1,
|
|
7072
7208
|
href,
|
|
7073
7209
|
icon: IconComponent,
|
|
7074
7210
|
id: idProp,
|
|
7075
7211
|
linkAs,
|
|
7076
7212
|
muted,
|
|
7077
7213
|
onClick,
|
|
7078
|
-
padding
|
|
7079
|
-
selected
|
|
7080
|
-
space
|
|
7214
|
+
padding: t2,
|
|
7215
|
+
selected: t3,
|
|
7216
|
+
space: t4,
|
|
7081
7217
|
text,
|
|
7082
7218
|
weight,
|
|
7083
7219
|
...restProps
|
|
7084
|
-
} = props, [
|
|
7220
|
+
} = props, $[0] = props, $[1] = t0, $[2] = t1, $[3] = t2, $[4] = t3, $[5] = t4, $[6] = idProp, $[7] = onClick, $[8] = IconComponent, $[9] = children, $[10] = muted, $[11] = weight, $[12] = text, $[13] = href, $[14] = linkAs, $[15] = restProps) : (t0 = $[1], t1 = $[2], t2 = $[3], t3 = $[4], t4 = $[5], idProp = $[6], onClick = $[7], IconComponent = $[8], children = $[9], muted = $[10], weight = $[11], text = $[12], href = $[13], linkAs = $[14], restProps = $[15]);
|
|
7221
|
+
const expandedProp = t0 === void 0 ? !1 : t0, fontSize2 = t1 === void 0 ? 1 : t1, padding = t2 === void 0 ? 2 : t2, selected = t3 === void 0 ? !1 : t3, space = t4 === void 0 ? 2 : t4, [rootElement, setRootElement] = useState(null), treeitemRef = useRef(null), tree = useTree(), {
|
|
7085
7222
|
path,
|
|
7086
7223
|
registerItem,
|
|
7087
7224
|
setExpanded,
|
|
7088
7225
|
setFocusedElement
|
|
7089
|
-
} = tree, _id = useId(), id = idProp || _id
|
|
7226
|
+
} = tree, _id = useId(), id = idProp || _id;
|
|
7227
|
+
let t5, t6, t7;
|
|
7228
|
+
if ($[16] !== id || $[17] !== path) {
|
|
7229
|
+
const result = path.concat([id || ""]);
|
|
7230
|
+
t6 = result, t7 = result.join("/"), $[16] = id, $[17] = path, $[18] = t6, $[19] = t7;
|
|
7231
|
+
} else
|
|
7232
|
+
t6 = $[18], t7 = $[19];
|
|
7233
|
+
let t8;
|
|
7234
|
+
$[20] !== t6 || $[21] !== t7 ? (t8 = [t6, t7], $[20] = t6, $[21] = t7, $[22] = t8) : t8 = $[22], t5 = t8;
|
|
7235
|
+
const [itemPath, itemKey] = t5, itemState = tree.state[itemKey], focused = tree.focusedElement === rootElement, expanded = itemState?.expanded === void 0 ? expandedProp : itemState?.expanded || !1, tabIndex = tree.focusedElement && tree.focusedElement === rootElement ? 0 : -1;
|
|
7236
|
+
let t9;
|
|
7237
|
+
const t10 = tree.level + 1;
|
|
7238
|
+
let t11;
|
|
7239
|
+
$[23] !== tree || $[24] !== t10 || $[25] !== itemPath ? (t11 = {
|
|
7090
7240
|
...tree,
|
|
7091
|
-
level:
|
|
7241
|
+
level: t10,
|
|
7092
7242
|
path: itemPath
|
|
7093
|
-
}
|
|
7243
|
+
}, $[23] = tree, $[24] = t10, $[25] = itemPath, $[26] = t11) : t11 = $[26], t9 = t11;
|
|
7244
|
+
const contextValue = t9;
|
|
7245
|
+
let t12;
|
|
7246
|
+
$[27] !== onClick || $[28] !== setExpanded || $[29] !== itemKey || $[30] !== expanded || $[31] !== setFocusedElement || $[32] !== rootElement ? (t12 = (event) => {
|
|
7094
7247
|
onClick && onClick(event);
|
|
7095
7248
|
const target = event.target;
|
|
7096
7249
|
target instanceof HTMLElement && (target.getAttribute("data-ui") === "TreeItem" || target.closest('[data-ui="TreeItem__box"]')) && (event.stopPropagation(), setExpanded(itemKey, !expanded), setFocusedElement(rootElement));
|
|
7097
|
-
}, [
|
|
7250
|
+
}, $[27] = onClick, $[28] = setExpanded, $[29] = itemKey, $[30] = expanded, $[31] = setFocusedElement, $[32] = rootElement, $[33] = t12) : t12 = $[33];
|
|
7251
|
+
const handleClick = t12;
|
|
7252
|
+
let t13;
|
|
7253
|
+
$[34] !== focused || $[35] !== rootElement ? (t13 = (event_0) => {
|
|
7098
7254
|
focused && event_0.key === "Enter" && (treeitemRef.current || rootElement)?.click();
|
|
7099
|
-
}, [focused, rootElement]);
|
|
7100
|
-
|
|
7255
|
+
}, $[34] = focused, $[35] = rootElement, $[36] = t13) : t13 = $[36];
|
|
7256
|
+
const handleKeyDown = t13;
|
|
7257
|
+
let t14, t15;
|
|
7258
|
+
$[37] !== rootElement || $[38] !== registerItem || $[39] !== itemPath || $[40] !== expanded || $[41] !== selected ? (t14 = () => {
|
|
7101
7259
|
if (rootElement)
|
|
7102
7260
|
return registerItem(rootElement, itemPath.join("/"), expanded, selected);
|
|
7103
|
-
}, [expanded, itemPath, registerItem, rootElement, selected]);
|
|
7104
|
-
const
|
|
7105
|
-
|
|
7106
|
-
|
|
7107
|
-
|
|
7108
|
-
|
|
7109
|
-
|
|
7110
|
-
|
|
7111
|
-
|
|
7112
|
-
|
|
7113
|
-
|
|
7114
|
-
|
|
7115
|
-
|
|
7116
|
-
|
|
7117
|
-
|
|
7118
|
-
|
|
7119
|
-
|
|
7120
|
-
|
|
7121
|
-
|
|
7122
|
-
] });
|
|
7261
|
+
}, t15 = [expanded, itemPath, registerItem, rootElement, selected], $[37] = rootElement, $[38] = registerItem, $[39] = itemPath, $[40] = expanded, $[41] = selected, $[42] = t14, $[43] = t15) : (t14 = $[42], t15 = $[43]), useEffect(t14, t15);
|
|
7262
|
+
const t16 = IconComponent || children ? "visible" : "hidden";
|
|
7263
|
+
let t17;
|
|
7264
|
+
$[44] !== t16 ? (t17 = {
|
|
7265
|
+
visibility: t16,
|
|
7266
|
+
pointerEvents: "none"
|
|
7267
|
+
}, $[44] = t16, $[45] = t17) : t17 = $[45];
|
|
7268
|
+
let t18;
|
|
7269
|
+
$[46] !== IconComponent || $[47] !== muted || $[48] !== fontSize2 || $[49] !== weight ? (t18 = IconComponent && /* @__PURE__ */ jsx(Text, { muted, size: fontSize2, weight, children: /* @__PURE__ */ jsx(IconComponent, {}) }), $[46] = IconComponent, $[47] = muted, $[48] = fontSize2, $[49] = weight, $[50] = t18) : t18 = $[50];
|
|
7270
|
+
let t19;
|
|
7271
|
+
$[51] !== IconComponent || $[52] !== expanded || $[53] !== muted || $[54] !== fontSize2 || $[55] !== weight ? (t19 = !IconComponent && /* @__PURE__ */ jsx(ToggleArrowText, { muted, size: fontSize2, weight, children: /* @__PURE__ */ jsx(ToggleArrowRightIcon, { style: {
|
|
7272
|
+
transform: expanded ? "rotate(90deg)" : void 0
|
|
7273
|
+
} }) }), $[51] = IconComponent, $[52] = expanded, $[53] = muted, $[54] = fontSize2, $[55] = weight, $[56] = t19) : t19 = $[56];
|
|
7274
|
+
let t20;
|
|
7275
|
+
$[57] !== space || $[58] !== t17 || $[59] !== t18 || $[60] !== t19 ? (t20 = /* @__PURE__ */ jsxs(Box, { marginRight: space, style: t17, children: [
|
|
7276
|
+
t18,
|
|
7277
|
+
t19
|
|
7278
|
+
] }), $[57] = space, $[58] = t17, $[59] = t18, $[60] = t19, $[61] = t20) : t20 = $[61];
|
|
7279
|
+
let t21;
|
|
7280
|
+
$[62] !== muted || $[63] !== fontSize2 || $[64] !== weight || $[65] !== text ? (t21 = /* @__PURE__ */ jsx(Box, { flex: 1, children: /* @__PURE__ */ jsx(Text, { muted, size: fontSize2, textOverflow: "ellipsis", weight, children: text }) }), $[62] = muted, $[63] = fontSize2, $[64] = weight, $[65] = text, $[66] = t21) : t21 = $[66];
|
|
7281
|
+
let t22;
|
|
7282
|
+
$[67] !== padding || $[68] !== t20 || $[69] !== t21 ? (t22 = /* @__PURE__ */ jsxs(Flex, { padding, children: [
|
|
7283
|
+
t20,
|
|
7284
|
+
t21
|
|
7285
|
+
] }), $[67] = padding, $[68] = t20, $[69] = t21, $[70] = t22) : t22 = $[70];
|
|
7286
|
+
const content = t22;
|
|
7287
|
+
if (href) {
|
|
7288
|
+
const t232 = selected ? "" : void 0;
|
|
7289
|
+
let t242;
|
|
7290
|
+
$[71] !== tree.level || $[72] !== expanded || $[73] !== linkAs || $[74] !== href || $[75] !== tabIndex || $[76] !== content ? (t242 = /* @__PURE__ */ jsx(TreeItemBox, { $level: tree.level, "aria-expanded": expanded, as: linkAs, "data-ui": "TreeItem__box", href, ref: treeitemRef, role: "treeitem", tabIndex, children: content }), $[71] = tree.level, $[72] = expanded, $[73] = linkAs, $[74] = href, $[75] = tabIndex, $[76] = content, $[77] = t242) : t242 = $[77];
|
|
7291
|
+
let t252;
|
|
7292
|
+
$[78] !== children || $[79] !== expanded ? (t252 = children && /* @__PURE__ */ jsx(TreeGroup, { hidden: !expanded, children }), $[78] = children, $[79] = expanded, $[80] = t252) : t252 = $[80];
|
|
7293
|
+
let t262;
|
|
7294
|
+
$[81] !== contextValue || $[82] !== t252 ? (t262 = /* @__PURE__ */ jsx(TreeContext.Provider, { value: contextValue, children: t252 }), $[81] = contextValue, $[82] = t252, $[83] = t262) : t262 = $[83];
|
|
7295
|
+
let t272;
|
|
7296
|
+
return $[84] !== t232 || $[85] !== id || $[86] !== itemKey || $[87] !== restProps || $[88] !== handleClick || $[89] !== t242 || $[90] !== t262 ? (t272 = /* @__PURE__ */ jsxs(Root, { "data-selected": t232, "data-tree-id": id, "data-tree-key": itemKey, "data-ui": "TreeItem", ...restProps, onClick: handleClick, ref: setRootElement, role: "none", children: [
|
|
7297
|
+
t242,
|
|
7298
|
+
t262
|
|
7299
|
+
] }), $[84] = t232, $[85] = id, $[86] = itemKey, $[87] = restProps, $[88] = handleClick, $[89] = t242, $[90] = t262, $[91] = t272) : t272 = $[91], t272;
|
|
7300
|
+
}
|
|
7301
|
+
const t23 = selected ? "" : void 0;
|
|
7302
|
+
let t24;
|
|
7303
|
+
$[92] !== tree.level || $[93] !== content ? (t24 = /* @__PURE__ */ jsx(TreeItemBox, { $level: tree.level, as: "div", "data-ui": "TreeItem__box", children: content }), $[92] = tree.level, $[93] = content, $[94] = t24) : t24 = $[94];
|
|
7304
|
+
let t25;
|
|
7305
|
+
$[95] !== children || $[96] !== expanded ? (t25 = children && /* @__PURE__ */ jsx(TreeGroup, { expanded, children }), $[95] = children, $[96] = expanded, $[97] = t25) : t25 = $[97];
|
|
7306
|
+
let t26;
|
|
7307
|
+
$[98] !== contextValue || $[99] !== t25 ? (t26 = /* @__PURE__ */ jsx(TreeContext.Provider, { value: contextValue, children: t25 }), $[98] = contextValue, $[99] = t25, $[100] = t26) : t26 = $[100];
|
|
7308
|
+
let t27;
|
|
7309
|
+
return $[101] !== t23 || $[102] !== id || $[103] !== itemKey || $[104] !== restProps || $[105] !== expanded || $[106] !== handleClick || $[107] !== handleKeyDown || $[108] !== tabIndex || $[109] !== t24 || $[110] !== t26 ? (t27 = /* @__PURE__ */ jsxs(Root, { "data-selected": t23, "data-ui": "TreeItem", "data-tree-id": id, "data-tree-key": itemKey, ...restProps, "aria-expanded": expanded, onClick: handleClick, onKeyDown: handleKeyDown, ref: setRootElement, role: "treeitem", tabIndex, children: [
|
|
7310
|
+
t24,
|
|
7311
|
+
t26
|
|
7312
|
+
] }), $[101] = t23, $[102] = id, $[103] = itemKey, $[104] = restProps, $[105] = expanded, $[106] = handleClick, $[107] = handleKeyDown, $[108] = tabIndex, $[109] = t24, $[110] = t26, $[111] = t27) : t27 = $[111], t27;
|
|
7123
7313
|
});
|
|
7124
7314
|
TreeItem.displayName = "Memo(TreeItem)";
|
|
7125
7315
|
export {
|