@sanity/ui 2.9.0-canary.3 → 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 +297 -127
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +296 -126
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +297 -127
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- 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/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.js
CHANGED
|
@@ -3215,16 +3215,37 @@ function findMinBreakpoints(media, width) {
|
|
|
3215
3215
|
return ret;
|
|
3216
3216
|
}
|
|
3217
3217
|
const ElementQuery = react.forwardRef(function(props, forwardedRef) {
|
|
3218
|
-
const theme2 = useTheme_v2()
|
|
3218
|
+
const $ = reactCompilerRuntime.c(18), theme2 = useTheme_v2();
|
|
3219
|
+
let _media, restProps, children;
|
|
3220
|
+
$[0] !== props ? ({
|
|
3219
3221
|
children,
|
|
3220
3222
|
media: _media,
|
|
3221
3223
|
...restProps
|
|
3222
|
-
} = props,
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3224
|
+
} = props, $[0] = props, $[1] = _media, $[2] = restProps, $[3] = children) : (_media = $[1], restProps = $[2], children = $[3]);
|
|
3225
|
+
const media = _media ?? theme2.media, [element, setElement] = react.useState(null), elementSize = useElementSize(element);
|
|
3226
|
+
let t0;
|
|
3227
|
+
t0 = elementSize?.border.width ?? window.innerWidth;
|
|
3228
|
+
const width = t0;
|
|
3229
|
+
let t1, t2;
|
|
3230
|
+
if ($[4] !== media || $[5] !== width) {
|
|
3231
|
+
const eq = findMaxBreakpoints(media, width);
|
|
3232
|
+
t2 = eq.length ? eq.join(" ") : void 0, $[4] = media, $[5] = width, $[6] = t2;
|
|
3233
|
+
} else
|
|
3234
|
+
t2 = $[6];
|
|
3235
|
+
t1 = t2;
|
|
3236
|
+
const max = t1;
|
|
3237
|
+
let t3, t4;
|
|
3238
|
+
if ($[7] !== media || $[8] !== width) {
|
|
3239
|
+
const eq_0 = findMinBreakpoints(media, width);
|
|
3240
|
+
t4 = eq_0.length ? eq_0.join(" ") : void 0, $[7] = media, $[8] = width, $[9] = t4;
|
|
3241
|
+
} else
|
|
3242
|
+
t4 = $[9];
|
|
3243
|
+
t3 = t4;
|
|
3244
|
+
const min = t3;
|
|
3245
|
+
let t5, t6;
|
|
3246
|
+
$[10] !== element ? (t5 = () => element, t6 = [element], $[10] = element, $[11] = t5, $[12] = t6) : (t5 = $[11], t6 = $[12]), react.useImperativeHandle(forwardedRef, t5, t6);
|
|
3247
|
+
let t7;
|
|
3248
|
+
return $[13] !== restProps || $[14] !== max || $[15] !== min || $[16] !== children ? (t7 = /* @__PURE__ */ jsxRuntime.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;
|
|
3228
3249
|
});
|
|
3229
3250
|
ElementQuery.displayName = "ForwardRef(ElementQuery)";
|
|
3230
3251
|
class ErrorBoundary extends react.Component {
|
|
@@ -3351,10 +3372,18 @@ function _isScrollable(el) {
|
|
|
3351
3372
|
return style.overflowX.includes("auto") || style.overflowX.includes("scroll") || style.overflowY.includes("auto") || style.overflowY.includes("scroll");
|
|
3352
3373
|
}
|
|
3353
3374
|
function LayerProvider(props) {
|
|
3354
|
-
const {
|
|
3375
|
+
const $ = reactCompilerRuntime.c(19), {
|
|
3355
3376
|
children,
|
|
3356
|
-
zOffset:
|
|
3357
|
-
} = props,
|
|
3377
|
+
zOffset: t0
|
|
3378
|
+
} = props, zOffsetProp = t0 === void 0 ? 0 : t0, parentContextValue = react.useContext(LayerContext);
|
|
3379
|
+
let t1;
|
|
3380
|
+
$[0] !== parentContextValue ? (t1 = parentContextValue && getLayerContext(parentContextValue), $[0] = parentContextValue, $[1] = t1) : t1 = $[1];
|
|
3381
|
+
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];
|
|
3382
|
+
let t2;
|
|
3383
|
+
$[2] === Symbol.for("react.memo_cache_sentinel") ? (t2 = {}, $[2] = t2) : t2 = $[2];
|
|
3384
|
+
const [, setChildLayers] = react.useState(t2), [size2, setSize] = react.useState(0), isTopLayer = size2 === 0;
|
|
3385
|
+
let t3;
|
|
3386
|
+
$[3] !== parentRegisterChild || $[4] !== setChildLayers ? (t3 = (childLevel) => {
|
|
3358
3387
|
const parentDispose = parentRegisterChild?.(childLevel);
|
|
3359
3388
|
return childLevel !== void 0 ? setChildLayers((state) => {
|
|
3360
3389
|
const prevLen = state[childLevel] ?? 0, nextState = {
|
|
@@ -3367,20 +3396,25 @@ function LayerProvider(props) {
|
|
|
3367
3396
|
const nextState_0 = {
|
|
3368
3397
|
...state_0
|
|
3369
3398
|
};
|
|
3370
|
-
return nextState_0[childLevel] === 1 ? (delete nextState_0[childLevel], setSize(Object.keys(nextState_0).length)) : nextState_0[childLevel]
|
|
3399
|
+
return nextState_0[childLevel] === 1 ? (delete nextState_0[childLevel], setSize(Object.keys(nextState_0).length)) : nextState_0[childLevel] = nextState_0[childLevel] - 1, nextState_0;
|
|
3371
3400
|
}) : setSize((v_0) => v_0 - 1), parentDispose?.();
|
|
3372
3401
|
};
|
|
3373
|
-
}, [parentRegisterChild]);
|
|
3374
|
-
|
|
3375
|
-
|
|
3402
|
+
}, $[3] = parentRegisterChild, $[4] = setChildLayers, $[5] = t3) : t3 = $[5];
|
|
3403
|
+
const registerChild = t3;
|
|
3404
|
+
let t4, t5;
|
|
3405
|
+
$[6] !== parentRegisterChild || $[7] !== level ? (t4 = () => parentRegisterChild?.(level), t5 = [level, parentRegisterChild], $[6] = parentRegisterChild, $[7] = level, $[8] = t4, $[9] = t5) : (t4 = $[8], t5 = $[9]), react.useEffect(t4, t5);
|
|
3406
|
+
let t6, t7;
|
|
3407
|
+
$[10] !== isTopLayer || $[11] !== level || $[12] !== registerChild || $[13] !== size2 || $[14] !== zIndex ? (t7 = {
|
|
3376
3408
|
version: 0,
|
|
3377
3409
|
isTopLayer,
|
|
3378
3410
|
level,
|
|
3379
3411
|
registerChild,
|
|
3380
3412
|
size: size2,
|
|
3381
3413
|
zIndex
|
|
3382
|
-
}
|
|
3383
|
-
|
|
3414
|
+
}, $[10] = isTopLayer, $[11] = level, $[12] = registerChild, $[13] = size2, $[14] = zIndex, $[15] = t7) : t7 = $[15], t6 = t7;
|
|
3415
|
+
const value = t6;
|
|
3416
|
+
let t8;
|
|
3417
|
+
return $[16] !== value || $[17] !== children ? (t8 = /* @__PURE__ */ jsxRuntime.jsx(LayerContext.Provider, { value, children }), $[16] = value, $[17] = children, $[18] = t8) : t8 = $[18], t8;
|
|
3384
3418
|
}
|
|
3385
3419
|
LayerProvider.displayName = "LayerProvider";
|
|
3386
3420
|
const Root$j = styledComponents.styled.div({
|
|
@@ -3829,7 +3863,7 @@ const Popover = react.memo(react.forwardRef(function(props, forwardedRef) {
|
|
|
3829
3863
|
zOffset: _zOffsetProp,
|
|
3830
3864
|
updateRef,
|
|
3831
3865
|
...restProps
|
|
3832
|
-
} = 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 = react.useRef(null),
|
|
3866
|
+
} = 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 = react.useRef(null), [arrowElement, setArrowElement] = react.useState(null), rootBoundary = "viewport";
|
|
3833
3867
|
react.useImperativeHandle(forwardedRef, () => ref.current);
|
|
3834
3868
|
const mediaIndex = useMediaIndex(), boundaryWidth = constrainSize || preventOverflow ? boundarySize?.width : void 0, width = calcCurrentWidth({
|
|
3835
3869
|
container,
|
|
@@ -3883,14 +3917,14 @@ const Popover = react.memo(react.forwardRef(function(props, forwardedRef) {
|
|
|
3883
3917
|
rootBoundary,
|
|
3884
3918
|
padding: DEFAULT_POPOVER_PADDING
|
|
3885
3919
|
})), arrowProp && ret.push(reactDom$1.arrow({
|
|
3886
|
-
element:
|
|
3920
|
+
element: arrowElement,
|
|
3887
3921
|
padding: DEFAULT_POPOVER_PADDING
|
|
3888
3922
|
})), animate && ret.push(origin), ret.push(reactDom$1.hide({
|
|
3889
3923
|
boundary: referenceBoundary || void 0,
|
|
3890
3924
|
padding: DEFAULT_POPOVER_PADDING,
|
|
3891
3925
|
strategy: "referenceHidden"
|
|
3892
3926
|
})), ret;
|
|
3893
|
-
}, [animate, arrowProp, constrainSize, fallbackPlacements, floatingBoundary, margins, matchReferenceWidth, preventOverflow, referenceBoundary]), {
|
|
3927
|
+
}, [animate, arrowElement, arrowProp, constrainSize, fallbackPlacements, floatingBoundary, margins, matchReferenceWidth, preventOverflow, referenceBoundary]), {
|
|
3894
3928
|
x,
|
|
3895
3929
|
y,
|
|
3896
3930
|
middlewareData,
|
|
@@ -3902,9 +3936,7 @@ const Popover = react.memo(react.forwardRef(function(props, forwardedRef) {
|
|
|
3902
3936
|
middleware,
|
|
3903
3937
|
placement: placementProp,
|
|
3904
3938
|
whileElementsMounted: reactDom$1.autoUpdate
|
|
3905
|
-
}), referenceHidden = middlewareData.hide?.referenceHidden, arrowX = middlewareData.arrow?.x, arrowY = middlewareData.arrow?.y, originX = middlewareData["@sanity/ui/origin"]?.originX, originY = middlewareData["@sanity/ui/origin"]?.originY,
|
|
3906
|
-
arrowRef.current = arrowEl;
|
|
3907
|
-
}, []), setFloating = react.useCallback((node) => {
|
|
3939
|
+
}), 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 = react.useCallback((node) => {
|
|
3908
3940
|
ref.current = node, refs.setFloating(node);
|
|
3909
3941
|
}, [refs]), [childElement, setChildElement] = react.useState(null), setReference = react.useCallback((node_0) => {
|
|
3910
3942
|
refs.setReference(node_0), setChildElement(node_0);
|
|
@@ -3917,7 +3949,7 @@ const Popover = react.memo(react.forwardRef(function(props, forwardedRef) {
|
|
|
3917
3949
|
child || refs.setReference(referenceElement || null);
|
|
3918
3950
|
}, [referenceElement, refs, child]), disabled)
|
|
3919
3951
|
return childProp || /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
3920
|
-
const popover = /* @__PURE__ */ jsxRuntime.jsx(LayerProvider, { zOffset, children: /* @__PURE__ */ jsxRuntime.jsx(PopoverCard, { ...restProps, __unstable_margins: margins, animate, arrow: arrowProp, arrowRef:
|
|
3952
|
+
const popover = /* @__PURE__ */ jsxRuntime.jsx(LayerProvider, { zOffset, children: /* @__PURE__ */ jsxRuntime.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__ */ jsxRuntime.jsx(Portal, { __unstable_name: typeof portal == "string" ? portal : void 0, children: popover }) : popover);
|
|
3921
3953
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3922
3954
|
animate ? /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children }) : children,
|
|
3923
3955
|
child
|
|
@@ -5933,8 +5965,8 @@ const Root$5 = styledComponents.styled(Box)`
|
|
|
5933
5965
|
});
|
|
5934
5966
|
Menu.displayName = "ForwardRef(Menu)";
|
|
5935
5967
|
const MenuButton = react.forwardRef(function(props, forwardedRef) {
|
|
5936
|
-
const {
|
|
5937
|
-
__unstable_disableRestoreFocusOnClose:
|
|
5968
|
+
const $ = reactCompilerRuntime.c(62), {
|
|
5969
|
+
__unstable_disableRestoreFocusOnClose: t0,
|
|
5938
5970
|
boundaryElement: deprecated_boundaryElement,
|
|
5939
5971
|
button: buttonProp,
|
|
5940
5972
|
id,
|
|
@@ -5943,23 +5975,38 @@ const MenuButton = react.forwardRef(function(props, forwardedRef) {
|
|
|
5943
5975
|
onOpen,
|
|
5944
5976
|
placement: deprecated_placement,
|
|
5945
5977
|
popoverScheme: deprecated_popoverScheme,
|
|
5946
|
-
portal:
|
|
5978
|
+
portal: t1,
|
|
5947
5979
|
popover,
|
|
5948
5980
|
popoverRadius: deprecated_popoverRadius,
|
|
5949
5981
|
preventOverflow: deprecated_preventOverflow
|
|
5950
|
-
} = props, [open, setOpen] = react.useState(!1), [shouldFocus, setShouldFocus] = react.useState(null), [buttonElement, setButtonElement] = react.useState(null)
|
|
5951
|
-
|
|
5982
|
+
} = props, disableRestoreFocusOnClose = t0 === void 0 ? !1 : t0, deprecated_portal = t1 === void 0 ? !0 : t1, [open, setOpen] = react.useState(!1), [shouldFocus, setShouldFocus] = react.useState(null), [buttonElement, setButtonElement] = react.useState(null);
|
|
5983
|
+
let t2;
|
|
5984
|
+
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t2 = [], $[0] = t2) : t2 = $[0];
|
|
5985
|
+
const [menuElements, setChildMenuElements] = react.useState(t2), openRef = react.useRef(open);
|
|
5986
|
+
let t3, t4;
|
|
5987
|
+
$[1] !== onOpen || $[2] !== open ? (t3 = () => {
|
|
5952
5988
|
onOpen && open && !openRef.current && onOpen();
|
|
5953
|
-
}, [onOpen, open]), react.useEffect(
|
|
5989
|
+
}, t4 = [onOpen, open], $[1] = onOpen, $[2] = open, $[3] = t3, $[4] = t4) : (t3 = $[3], t4 = $[4]), react.useEffect(t3, t4);
|
|
5990
|
+
let t5, t6;
|
|
5991
|
+
$[5] !== onClose || $[6] !== open ? (t5 = () => {
|
|
5954
5992
|
onClose && !open && openRef.current && onClose();
|
|
5955
|
-
}, [onClose, open]), react.useEffect(
|
|
5993
|
+
}, t6 = [onClose, open], $[5] = onClose, $[6] = open, $[7] = t5, $[8] = t6) : (t5 = $[7], t6 = $[8]), react.useEffect(t5, t6);
|
|
5994
|
+
let t7, t8;
|
|
5995
|
+
$[9] !== open ? (t7 = () => {
|
|
5956
5996
|
openRef.current = open;
|
|
5957
|
-
}, [open]);
|
|
5958
|
-
|
|
5997
|
+
}, t8 = [open], $[9] = open, $[10] = t7, $[11] = t8) : (t7 = $[10], t8 = $[11]), react.useEffect(t7, t8);
|
|
5998
|
+
let t9;
|
|
5999
|
+
$[12] === Symbol.for("react.memo_cache_sentinel") ? (t9 = () => {
|
|
5959
6000
|
setOpen((v) => !v), setShouldFocus(null);
|
|
5960
|
-
}, []
|
|
6001
|
+
}, $[12] = t9) : t9 = $[12];
|
|
6002
|
+
const handleButtonClick = t9;
|
|
6003
|
+
let t10;
|
|
6004
|
+
$[13] !== open ? (t10 = (event) => {
|
|
5961
6005
|
open && event.preventDefault();
|
|
5962
|
-
}, [open
|
|
6006
|
+
}, $[13] = open, $[14] = t10) : t10 = $[14];
|
|
6007
|
+
const handleMouseDown = t10;
|
|
6008
|
+
let t11;
|
|
6009
|
+
$[15] === Symbol.for("react.memo_cache_sentinel") ? (t11 = (event_0) => {
|
|
5963
6010
|
if (event_0.key === "ArrowDown" || event_0.key === "Enter" || event_0.key === " ") {
|
|
5964
6011
|
event_0.preventDefault(), setOpen(!0), setShouldFocus("first");
|
|
5965
6012
|
return;
|
|
@@ -5968,7 +6015,10 @@ const MenuButton = react.forwardRef(function(props, forwardedRef) {
|
|
|
5968
6015
|
event_0.preventDefault(), setOpen(!0), setShouldFocus("last");
|
|
5969
6016
|
return;
|
|
5970
6017
|
}
|
|
5971
|
-
}, []
|
|
6018
|
+
}, $[15] = t11) : t11 = $[15];
|
|
6019
|
+
const handleButtonKeyDown = t11;
|
|
6020
|
+
let t12;
|
|
6021
|
+
$[16] !== buttonElement || $[17] !== menuElements ? (t12 = (event_1) => {
|
|
5972
6022
|
const target = event_1.target;
|
|
5973
6023
|
if (target instanceof Node && !(buttonElement && (target === buttonElement || buttonElement.contains(target)))) {
|
|
5974
6024
|
for (const el of menuElements)
|
|
@@ -5976,9 +6026,15 @@ const MenuButton = react.forwardRef(function(props, forwardedRef) {
|
|
|
5976
6026
|
return;
|
|
5977
6027
|
setOpen(!1);
|
|
5978
6028
|
}
|
|
5979
|
-
}, [buttonElement, menuElements
|
|
6029
|
+
}, $[16] = buttonElement, $[17] = menuElements, $[18] = t12) : t12 = $[18];
|
|
6030
|
+
const handleMenuClickOutside = t12;
|
|
6031
|
+
let t13;
|
|
6032
|
+
$[19] !== disableRestoreFocusOnClose || $[20] !== buttonElement ? (t13 = () => {
|
|
5980
6033
|
setOpen(!1), !disableRestoreFocusOnClose && buttonElement && buttonElement.focus();
|
|
5981
|
-
}, [
|
|
6034
|
+
}, $[19] = disableRestoreFocusOnClose, $[20] = buttonElement, $[21] = t13) : t13 = $[21];
|
|
6035
|
+
const handleMenuEscape = t13;
|
|
6036
|
+
let t14;
|
|
6037
|
+
$[22] !== menuElements ? (t14 = (event_2) => {
|
|
5982
6038
|
const target_0 = event_2.relatedTarget;
|
|
5983
6039
|
if (target_0 instanceof Node) {
|
|
5984
6040
|
for (const el_0 of menuElements)
|
|
@@ -5986,9 +6042,18 @@ const MenuButton = react.forwardRef(function(props, forwardedRef) {
|
|
|
5986
6042
|
return;
|
|
5987
6043
|
setOpen(!1);
|
|
5988
6044
|
}
|
|
5989
|
-
}, [menuElements
|
|
6045
|
+
}, $[22] = menuElements, $[23] = t14) : t14 = $[23];
|
|
6046
|
+
const handleBlur = t14;
|
|
6047
|
+
let t15;
|
|
6048
|
+
$[24] !== disableRestoreFocusOnClose || $[25] !== buttonElement ? (t15 = () => {
|
|
5990
6049
|
setOpen(!1), !disableRestoreFocusOnClose && buttonElement && buttonElement.focus();
|
|
5991
|
-
}, [
|
|
6050
|
+
}, $[24] = disableRestoreFocusOnClose, $[25] = buttonElement, $[26] = t15) : t15 = $[26];
|
|
6051
|
+
const handleItemClick = t15;
|
|
6052
|
+
let t16;
|
|
6053
|
+
$[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];
|
|
6054
|
+
const registerElement = t16;
|
|
6055
|
+
let t17;
|
|
6056
|
+
$[28] !== id || $[29] !== handleBlur || $[30] !== handleMenuClickOutside || $[31] !== handleMenuEscape || $[32] !== handleItemClick || $[33] !== buttonElement || $[34] !== shouldFocus || $[35] !== menuProp ? (t17 = menuProp && react.cloneElement(menuProp, {
|
|
5992
6057
|
"aria-labelledby": id,
|
|
5993
6058
|
onBlurCapture: handleBlur,
|
|
5994
6059
|
onClickOutside: handleMenuClickOutside,
|
|
@@ -5997,7 +6062,10 @@ const MenuButton = react.forwardRef(function(props, forwardedRef) {
|
|
|
5997
6062
|
originElement: buttonElement,
|
|
5998
6063
|
registerElement,
|
|
5999
6064
|
shouldFocus
|
|
6000
|
-
}), [
|
|
6065
|
+
}), $[28] = id, $[29] = handleBlur, $[30] = handleMenuClickOutside, $[31] = handleMenuEscape, $[32] = handleItemClick, $[33] = buttonElement, $[34] = shouldFocus, $[35] = menuProp, $[36] = t17) : t17 = $[36];
|
|
6066
|
+
const menu = t17;
|
|
6067
|
+
let t18, t19;
|
|
6068
|
+
$[37] !== buttonProp || $[38] !== open || $[39] !== id || $[40] !== handleMouseDown ? (t19 = buttonProp && react.cloneElement(buttonProp, {
|
|
6001
6069
|
"data-ui": "MenuButton",
|
|
6002
6070
|
id,
|
|
6003
6071
|
onClick: handleButtonClick,
|
|
@@ -6005,14 +6073,16 @@ const MenuButton = react.forwardRef(function(props, forwardedRef) {
|
|
|
6005
6073
|
onMouseDown: handleMouseDown,
|
|
6006
6074
|
"aria-haspopup": !0,
|
|
6007
6075
|
"aria-expanded": open,
|
|
6008
|
-
ref,
|
|
6076
|
+
ref: setButtonElement,
|
|
6009
6077
|
selected: buttonProp.props.selected ?? open
|
|
6010
|
-
}), [buttonProp,
|
|
6011
|
-
|
|
6012
|
-
|
|
6013
|
-
|
|
6014
|
-
|
|
6015
|
-
|
|
6078
|
+
}), $[37] = buttonProp, $[38] = open, $[39] = id, $[40] = handleMouseDown, $[41] = t19) : t19 = $[41], t18 = t19;
|
|
6079
|
+
const button = t18;
|
|
6080
|
+
let t20, t21;
|
|
6081
|
+
$[42] !== buttonElement ? (t20 = () => buttonElement, t21 = [buttonElement], $[42] = buttonElement, $[43] = t20, $[44] = t21) : (t20 = $[43], t21 = $[44]), react.useImperativeHandle(forwardedRef, t20, t21);
|
|
6082
|
+
let t22, t23;
|
|
6083
|
+
$[45] !== popover ? (t23 = popover || {}, $[45] = popover, $[46] = t23) : t23 = $[46];
|
|
6084
|
+
let t24;
|
|
6085
|
+
$[47] !== deprecated_boundaryElement || $[48] !== deprecated_placement || $[49] !== deprecated_portal || $[50] !== deprecated_preventOverflow || $[51] !== deprecated_popoverRadius || $[52] !== deprecated_popoverScheme || $[53] !== t23 ? (t24 = {
|
|
6016
6086
|
boundaryElement: deprecated_boundaryElement,
|
|
6017
6087
|
overflow: "auto",
|
|
6018
6088
|
placement: deprecated_placement,
|
|
@@ -6020,9 +6090,13 @@ const MenuButton = react.forwardRef(function(props, forwardedRef) {
|
|
|
6020
6090
|
preventOverflow: deprecated_preventOverflow,
|
|
6021
6091
|
radius: deprecated_popoverRadius,
|
|
6022
6092
|
scheme: deprecated_popoverScheme,
|
|
6023
|
-
...
|
|
6024
|
-
}
|
|
6025
|
-
|
|
6093
|
+
...t23
|
|
6094
|
+
}, $[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;
|
|
6095
|
+
const popoverProps = t22;
|
|
6096
|
+
let t25;
|
|
6097
|
+
$[55] !== button ? (t25 = button || /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {}), $[55] = button, $[56] = t25) : t25 = $[56];
|
|
6098
|
+
let t26;
|
|
6099
|
+
return $[57] !== popoverProps || $[58] !== menu || $[59] !== open || $[60] !== t25 ? (t26 = /* @__PURE__ */ jsxRuntime.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;
|
|
6026
6100
|
});
|
|
6027
6101
|
MenuButton.displayName = "ForwardRef(MenuButton)";
|
|
6028
6102
|
const MenuDivider = styledComponents.styled.hr`
|
|
@@ -6506,9 +6580,6 @@ const CustomButton = styledComponents.styled(Button)`
|
|
|
6506
6580
|
return $[18] !== restProps || $[19] !== t7 || $[20] !== fontSize2 || $[21] !== icon || $[22] !== id || $[23] !== onClick || $[24] !== handleFocus || $[25] !== padding || $[26] !== selected || $[27] !== t8 || $[28] !== label ? (t9 = /* @__PURE__ */ jsxRuntime.jsx(CustomButton, { "data-ui": "Tab", ...restProps, "aria-selected": t7, fontSize: fontSize2, icon, id, mode: "bleed", onClick, onBlur: handleBlur, onFocus: handleFocus, padding, ref, role: "tab", selected, tabIndex: t8, text: label, type: "button" }), $[18] = restProps, $[19] = t7, $[20] = fontSize2, $[21] = icon, $[22] = id, $[23] = onClick, $[24] = handleFocus, $[25] = padding, $[26] = selected, $[27] = t8, $[28] = label, $[29] = t9) : t9 = $[29], t9;
|
|
6507
6581
|
});
|
|
6508
6582
|
Tab.displayName = "ForwardRef(Tab)";
|
|
6509
|
-
function _isReactElement(node) {
|
|
6510
|
-
return !!node;
|
|
6511
|
-
}
|
|
6512
6583
|
const CustomInline = styledComponents.styled(Inline)`
|
|
6513
6584
|
& > div {
|
|
6514
6585
|
display: inline-block;
|
|
@@ -6517,19 +6588,32 @@ const CustomInline = styledComponents.styled(Inline)`
|
|
|
6517
6588
|
box-sizing: border-box;
|
|
6518
6589
|
}
|
|
6519
6590
|
`, TabList = react.forwardRef(function(props, ref) {
|
|
6520
|
-
const
|
|
6591
|
+
const $ = reactCompilerRuntime.c(15);
|
|
6592
|
+
let childrenProp, restProps;
|
|
6593
|
+
$[0] !== props ? ({
|
|
6521
6594
|
children: childrenProp,
|
|
6522
6595
|
...restProps
|
|
6523
|
-
} = props, [
|
|
6524
|
-
|
|
6525
|
-
|
|
6526
|
-
|
|
6527
|
-
|
|
6528
|
-
|
|
6529
|
-
|
|
6596
|
+
} = props, $[0] = props, $[1] = childrenProp, $[2] = restProps) : (childrenProp = $[1], restProps = $[2]);
|
|
6597
|
+
const [focusedIndex, setFocusedIndex] = react.useState(-1);
|
|
6598
|
+
let t0;
|
|
6599
|
+
if ($[3] !== childrenProp || $[4] !== focusedIndex) {
|
|
6600
|
+
const children = react.Children.toArray(childrenProp).filter(react.isValidElement);
|
|
6601
|
+
let t12;
|
|
6602
|
+
$[6] !== focusedIndex ? (t12 = (child, childIndex) => react.cloneElement(child, {
|
|
6603
|
+
focused: focusedIndex === childIndex,
|
|
6604
|
+
key: childIndex,
|
|
6605
|
+
onFocus: () => setFocusedIndex(childIndex)
|
|
6606
|
+
}), $[6] = focusedIndex, $[7] = t12) : t12 = $[7], t0 = children.map(t12), $[3] = childrenProp, $[4] = focusedIndex, $[5] = t0;
|
|
6607
|
+
} else
|
|
6608
|
+
t0 = $[5];
|
|
6609
|
+
const tabs = t0, numTabs = tabs.length;
|
|
6610
|
+
let t1;
|
|
6611
|
+
$[8] !== numTabs ? (t1 = (event) => {
|
|
6530
6612
|
event.key === "ArrowLeft" && setFocusedIndex((prevIndex) => (prevIndex + numTabs - 1) % numTabs), event.key === "ArrowRight" && setFocusedIndex((prevIndex_0) => (prevIndex_0 + 1) % numTabs);
|
|
6531
|
-
}, [numTabs]);
|
|
6532
|
-
|
|
6613
|
+
}, $[8] = numTabs, $[9] = t1) : t1 = $[9];
|
|
6614
|
+
const handleKeyDown = t1;
|
|
6615
|
+
let t2;
|
|
6616
|
+
return $[10] !== restProps || $[11] !== handleKeyDown || $[12] !== ref || $[13] !== tabs ? (t2 = /* @__PURE__ */ jsxRuntime.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;
|
|
6533
6617
|
});
|
|
6534
6618
|
TabList.displayName = "ForwardRef(TabList)";
|
|
6535
6619
|
const TabPanel = react.forwardRef(function(props, ref) {
|
|
@@ -6650,7 +6734,12 @@ function _temp() {
|
|
|
6650
6734
|
return !0;
|
|
6651
6735
|
}
|
|
6652
6736
|
const subscribe = () => () => {
|
|
6653
|
-
}, ToastContext = createGlobalScopedContext("@sanity/ui/context/toast", null)
|
|
6737
|
+
}, ToastContext = createGlobalScopedContext("@sanity/ui/context/toast", null);
|
|
6738
|
+
let toastId = 0;
|
|
6739
|
+
function generateToastId() {
|
|
6740
|
+
return String(toastId++);
|
|
6741
|
+
}
|
|
6742
|
+
const Root$1 = styledComponents.styled(Layer)`
|
|
6654
6743
|
position: fixed;
|
|
6655
6744
|
top: 0;
|
|
6656
6745
|
left: 0;
|
|
@@ -6665,31 +6754,44 @@ const subscribe = () => () => {
|
|
|
6665
6754
|
max-width: 420px;
|
|
6666
6755
|
width: 100%;
|
|
6667
6756
|
`;
|
|
6668
|
-
let toastId = 0;
|
|
6669
6757
|
function ToastProvider(props) {
|
|
6670
|
-
const {
|
|
6758
|
+
const $ = reactCompilerRuntime.c(24), {
|
|
6671
6759
|
children,
|
|
6672
|
-
padding
|
|
6760
|
+
padding: t0,
|
|
6673
6761
|
paddingX,
|
|
6674
6762
|
paddingY,
|
|
6675
6763
|
zOffset
|
|
6676
|
-
} = props,
|
|
6677
|
-
|
|
6678
|
-
|
|
6679
|
-
|
|
6680
|
-
|
|
6681
|
-
|
|
6682
|
-
|
|
6683
|
-
|
|
6684
|
-
|
|
6685
|
-
|
|
6686
|
-
|
|
6687
|
-
|
|
6688
|
-
|
|
6689
|
-
|
|
6764
|
+
} = props, padding = t0 === void 0 ? 4 : t0;
|
|
6765
|
+
let t1;
|
|
6766
|
+
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t1 = [], $[0] = t1) : t1 = $[0];
|
|
6767
|
+
const [state, _setState] = react.useState(t1);
|
|
6768
|
+
let t2;
|
|
6769
|
+
$[1] === Symbol.for("react.memo_cache_sentinel") ? (t2 = {}, $[1] = t2) : t2 = $[1];
|
|
6770
|
+
const toastsRef = react.useRef(t2), mounted = useMounted(), prefersReducedMotion = usePrefersReducedMotion();
|
|
6771
|
+
let t3, t4, t5;
|
|
6772
|
+
$[2] === Symbol.for("react.memo_cache_sentinel") ? (t4 = {
|
|
6773
|
+
opacity: 0,
|
|
6774
|
+
[POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: 0,
|
|
6775
|
+
y: 32,
|
|
6776
|
+
scale: 0.25,
|
|
6777
|
+
willChange: "transform"
|
|
6778
|
+
}, t5 = [0, 1, 1], $[2] = t4, $[3] = t5) : (t4 = $[2], t5 = $[3]);
|
|
6779
|
+
let t6, t7;
|
|
6780
|
+
$[4] === Symbol.for("react.memo_cache_sentinel") ? (t6 = {
|
|
6781
|
+
opacity: t5,
|
|
6782
|
+
[POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: [0, 0, 1],
|
|
6783
|
+
y: 0,
|
|
6784
|
+
scale: 1
|
|
6785
|
+
}, t7 = [1, 1, 0], $[4] = t6, $[5] = t7) : (t6 = $[4], t7 = $[5]);
|
|
6786
|
+
let t8;
|
|
6787
|
+
$[6] === Symbol.for("react.memo_cache_sentinel") ? (t8 = [1, 0, 0], $[6] = t8) : t8 = $[6];
|
|
6788
|
+
let t9;
|
|
6789
|
+
$[7] !== prefersReducedMotion ? (t9 = {
|
|
6790
|
+
initial: t4,
|
|
6791
|
+
animate: t6,
|
|
6690
6792
|
exit: {
|
|
6691
|
-
opacity:
|
|
6692
|
-
[POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]:
|
|
6793
|
+
opacity: t7,
|
|
6794
|
+
[POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: t8,
|
|
6693
6795
|
scale: 0.5,
|
|
6694
6796
|
transition: prefersReducedMotion ? {
|
|
6695
6797
|
duration: 0
|
|
@@ -6697,10 +6799,13 @@ function ToastProvider(props) {
|
|
|
6697
6799
|
duration: 0.2
|
|
6698
6800
|
}
|
|
6699
6801
|
}
|
|
6700
|
-
}
|
|
6802
|
+
}, $[7] = prefersReducedMotion, $[8] = t9) : t9 = $[8], t3 = t9;
|
|
6803
|
+
const variants = t3;
|
|
6804
|
+
let t10, t11;
|
|
6805
|
+
$[9] === Symbol.for("react.memo_cache_sentinel") ? (t11 = {
|
|
6701
6806
|
version: 0,
|
|
6702
6807
|
push: (params) => {
|
|
6703
|
-
const setState = (state_0) => react.startTransition(() => _setState(state_0)), id = params.id ||
|
|
6808
|
+
const setState = (state_0) => react.startTransition(() => _setState(state_0)), id = params.id || generateToastId(), duration = params.duration || 5e3, dismiss = () => {
|
|
6704
6809
|
const timeoutId = toastsRef.current[id]?.timeoutId;
|
|
6705
6810
|
setState((prevState) => {
|
|
6706
6811
|
const idx = prevState.findIndex((t) => t.id === id);
|
|
@@ -6722,27 +6827,36 @@ function ToastProvider(props) {
|
|
|
6722
6827
|
timeoutId: setTimeout(dismiss, duration)
|
|
6723
6828
|
}, id;
|
|
6724
6829
|
}
|
|
6725
|
-
}
|
|
6726
|
-
|
|
6830
|
+
}, $[9] = t11) : t11 = $[9], t10 = t11;
|
|
6831
|
+
const value = t10;
|
|
6832
|
+
let t12, t13;
|
|
6833
|
+
$[10] === Symbol.for("react.memo_cache_sentinel") ? (t12 = () => () => {
|
|
6727
6834
|
for (const {
|
|
6728
6835
|
timeoutId: timeoutId_0
|
|
6729
6836
|
} of Object.values(toastsRef.current))
|
|
6730
6837
|
clearTimeout(timeoutId_0);
|
|
6731
6838
|
toastsRef.current = {};
|
|
6732
|
-
}, []
|
|
6733
|
-
|
|
6734
|
-
|
|
6839
|
+
}, t13 = [], $[10] = t12, $[11] = t13) : (t12 = $[10], t13 = $[11]), react.useEffect(t12, t13);
|
|
6840
|
+
let t14;
|
|
6841
|
+
$[12] !== mounted || $[13] !== variants || $[14] !== prefersReducedMotion || $[15] !== state || $[16] !== padding || $[17] !== paddingX || $[18] !== paddingY || $[19] !== zOffset ? (t14 = mounted && /* @__PURE__ */ jsxRuntime.jsx(Root$1, { "data-ui": "ToastProvider", zOffset, children: /* @__PURE__ */ jsxRuntime.jsx(ToastContainer, { children: /* @__PURE__ */ jsxRuntime.jsx(Box, { padding, paddingX, paddingY, children: /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { initial: !1, children: state.map((t152) => {
|
|
6842
|
+
const {
|
|
6735
6843
|
dismiss: dismiss_0,
|
|
6736
6844
|
id: id_0,
|
|
6737
6845
|
params: params_0
|
|
6738
|
-
}
|
|
6846
|
+
} = t152;
|
|
6847
|
+
return /* @__PURE__ */ jsxRuntime.jsx(framerMotion.motion.div, { layout: "position", initial: "initial", animate: "animate", exit: "exit", variants, transition: prefersReducedMotion ? {
|
|
6739
6848
|
duration: 0
|
|
6740
6849
|
} : {
|
|
6741
6850
|
type: "spring",
|
|
6742
6851
|
damping: 30,
|
|
6743
6852
|
stiffness: 400
|
|
6744
|
-
}, children: /* @__PURE__ */ jsxRuntime.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)
|
|
6745
|
-
|
|
6853
|
+
}, children: /* @__PURE__ */ jsxRuntime.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);
|
|
6854
|
+
}) }) }) }) }), $[12] = mounted, $[13] = variants, $[14] = prefersReducedMotion, $[15] = state, $[16] = padding, $[17] = paddingX, $[18] = paddingY, $[19] = zOffset, $[20] = t14) : t14 = $[20];
|
|
6855
|
+
let t15;
|
|
6856
|
+
return $[21] !== children || $[22] !== t14 ? (t15 = /* @__PURE__ */ jsxRuntime.jsxs(ToastContext.Provider, { value, children: [
|
|
6857
|
+
children,
|
|
6858
|
+
t14
|
|
6859
|
+
] }), $[21] = children, $[22] = t14, $[23] = t15) : t15 = $[23], t15;
|
|
6746
6860
|
}
|
|
6747
6861
|
ToastProvider.displayName = "ToastProvider";
|
|
6748
6862
|
function useToast() {
|
|
@@ -7079,61 +7193,117 @@ const TreeGroup = react.memo(function(props) {
|
|
|
7079
7193
|
transition: transform 100ms;
|
|
7080
7194
|
}
|
|
7081
7195
|
`, TreeItem = react.memo(function(props) {
|
|
7082
|
-
const
|
|
7196
|
+
const $ = reactCompilerRuntime.c(112);
|
|
7197
|
+
let t0, t1, t2, t3, t4, idProp, onClick, IconComponent, children, muted, weight, text, href, linkAs, restProps;
|
|
7198
|
+
$[0] !== props ? ({
|
|
7083
7199
|
children,
|
|
7084
|
-
expanded:
|
|
7085
|
-
fontSize:
|
|
7200
|
+
expanded: t0,
|
|
7201
|
+
fontSize: t1,
|
|
7086
7202
|
href,
|
|
7087
7203
|
icon: IconComponent,
|
|
7088
7204
|
id: idProp,
|
|
7089
7205
|
linkAs,
|
|
7090
7206
|
muted,
|
|
7091
7207
|
onClick,
|
|
7092
|
-
padding
|
|
7093
|
-
selected
|
|
7094
|
-
space
|
|
7208
|
+
padding: t2,
|
|
7209
|
+
selected: t3,
|
|
7210
|
+
space: t4,
|
|
7095
7211
|
text,
|
|
7096
7212
|
weight,
|
|
7097
7213
|
...restProps
|
|
7098
|
-
} = props, [
|
|
7214
|
+
} = 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]);
|
|
7215
|
+
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] = react.useState(null), treeitemRef = react.useRef(null), tree = useTree(), {
|
|
7099
7216
|
path,
|
|
7100
7217
|
registerItem,
|
|
7101
7218
|
setExpanded,
|
|
7102
7219
|
setFocusedElement
|
|
7103
|
-
} = tree, _id = react.useId(), id = idProp || _id
|
|
7220
|
+
} = tree, _id = react.useId(), id = idProp || _id;
|
|
7221
|
+
let t5, t6, t7;
|
|
7222
|
+
if ($[16] !== id || $[17] !== path) {
|
|
7223
|
+
const result = path.concat([id || ""]);
|
|
7224
|
+
t6 = result, t7 = result.join("/"), $[16] = id, $[17] = path, $[18] = t6, $[19] = t7;
|
|
7225
|
+
} else
|
|
7226
|
+
t6 = $[18], t7 = $[19];
|
|
7227
|
+
let t8;
|
|
7228
|
+
$[20] !== t6 || $[21] !== t7 ? (t8 = [t6, t7], $[20] = t6, $[21] = t7, $[22] = t8) : t8 = $[22], t5 = t8;
|
|
7229
|
+
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;
|
|
7230
|
+
let t9;
|
|
7231
|
+
const t10 = tree.level + 1;
|
|
7232
|
+
let t11;
|
|
7233
|
+
$[23] !== tree || $[24] !== t10 || $[25] !== itemPath ? (t11 = {
|
|
7104
7234
|
...tree,
|
|
7105
|
-
level:
|
|
7235
|
+
level: t10,
|
|
7106
7236
|
path: itemPath
|
|
7107
|
-
}
|
|
7237
|
+
}, $[23] = tree, $[24] = t10, $[25] = itemPath, $[26] = t11) : t11 = $[26], t9 = t11;
|
|
7238
|
+
const contextValue = t9;
|
|
7239
|
+
let t12;
|
|
7240
|
+
$[27] !== onClick || $[28] !== setExpanded || $[29] !== itemKey || $[30] !== expanded || $[31] !== setFocusedElement || $[32] !== rootElement ? (t12 = (event) => {
|
|
7108
7241
|
onClick && onClick(event);
|
|
7109
7242
|
const target = event.target;
|
|
7110
7243
|
target instanceof HTMLElement && (target.getAttribute("data-ui") === "TreeItem" || target.closest('[data-ui="TreeItem__box"]')) && (event.stopPropagation(), setExpanded(itemKey, !expanded), setFocusedElement(rootElement));
|
|
7111
|
-
}, [
|
|
7244
|
+
}, $[27] = onClick, $[28] = setExpanded, $[29] = itemKey, $[30] = expanded, $[31] = setFocusedElement, $[32] = rootElement, $[33] = t12) : t12 = $[33];
|
|
7245
|
+
const handleClick = t12;
|
|
7246
|
+
let t13;
|
|
7247
|
+
$[34] !== focused || $[35] !== rootElement ? (t13 = (event_0) => {
|
|
7112
7248
|
focused && event_0.key === "Enter" && (treeitemRef.current || rootElement)?.click();
|
|
7113
|
-
}, [focused, rootElement]);
|
|
7114
|
-
|
|
7249
|
+
}, $[34] = focused, $[35] = rootElement, $[36] = t13) : t13 = $[36];
|
|
7250
|
+
const handleKeyDown = t13;
|
|
7251
|
+
let t14, t15;
|
|
7252
|
+
$[37] !== rootElement || $[38] !== registerItem || $[39] !== itemPath || $[40] !== expanded || $[41] !== selected ? (t14 = () => {
|
|
7115
7253
|
if (rootElement)
|
|
7116
7254
|
return registerItem(rootElement, itemPath.join("/"), expanded, selected);
|
|
7117
|
-
}, [expanded, itemPath, registerItem, rootElement, selected]);
|
|
7118
|
-
const
|
|
7119
|
-
|
|
7120
|
-
|
|
7121
|
-
|
|
7122
|
-
|
|
7123
|
-
|
|
7124
|
-
|
|
7125
|
-
|
|
7126
|
-
|
|
7127
|
-
|
|
7128
|
-
|
|
7129
|
-
|
|
7130
|
-
|
|
7131
|
-
|
|
7132
|
-
|
|
7133
|
-
|
|
7134
|
-
|
|
7135
|
-
|
|
7136
|
-
] });
|
|
7255
|
+
}, t15 = [expanded, itemPath, registerItem, rootElement, selected], $[37] = rootElement, $[38] = registerItem, $[39] = itemPath, $[40] = expanded, $[41] = selected, $[42] = t14, $[43] = t15) : (t14 = $[42], t15 = $[43]), react.useEffect(t14, t15);
|
|
7256
|
+
const t16 = IconComponent || children ? "visible" : "hidden";
|
|
7257
|
+
let t17;
|
|
7258
|
+
$[44] !== t16 ? (t17 = {
|
|
7259
|
+
visibility: t16,
|
|
7260
|
+
pointerEvents: "none"
|
|
7261
|
+
}, $[44] = t16, $[45] = t17) : t17 = $[45];
|
|
7262
|
+
let t18;
|
|
7263
|
+
$[46] !== IconComponent || $[47] !== muted || $[48] !== fontSize2 || $[49] !== weight ? (t18 = IconComponent && /* @__PURE__ */ jsxRuntime.jsx(Text, { muted, size: fontSize2, weight, children: /* @__PURE__ */ jsxRuntime.jsx(IconComponent, {}) }), $[46] = IconComponent, $[47] = muted, $[48] = fontSize2, $[49] = weight, $[50] = t18) : t18 = $[50];
|
|
7264
|
+
let t19;
|
|
7265
|
+
$[51] !== IconComponent || $[52] !== expanded || $[53] !== muted || $[54] !== fontSize2 || $[55] !== weight ? (t19 = !IconComponent && /* @__PURE__ */ jsxRuntime.jsx(ToggleArrowText, { muted, size: fontSize2, weight, children: /* @__PURE__ */ jsxRuntime.jsx(icons.ToggleArrowRightIcon, { style: {
|
|
7266
|
+
transform: expanded ? "rotate(90deg)" : void 0
|
|
7267
|
+
} }) }), $[51] = IconComponent, $[52] = expanded, $[53] = muted, $[54] = fontSize2, $[55] = weight, $[56] = t19) : t19 = $[56];
|
|
7268
|
+
let t20;
|
|
7269
|
+
$[57] !== space || $[58] !== t17 || $[59] !== t18 || $[60] !== t19 ? (t20 = /* @__PURE__ */ jsxRuntime.jsxs(Box, { marginRight: space, style: t17, children: [
|
|
7270
|
+
t18,
|
|
7271
|
+
t19
|
|
7272
|
+
] }), $[57] = space, $[58] = t17, $[59] = t18, $[60] = t19, $[61] = t20) : t20 = $[61];
|
|
7273
|
+
let t21;
|
|
7274
|
+
$[62] !== muted || $[63] !== fontSize2 || $[64] !== weight || $[65] !== text ? (t21 = /* @__PURE__ */ jsxRuntime.jsx(Box, { flex: 1, children: /* @__PURE__ */ jsxRuntime.jsx(Text, { muted, size: fontSize2, textOverflow: "ellipsis", weight, children: text }) }), $[62] = muted, $[63] = fontSize2, $[64] = weight, $[65] = text, $[66] = t21) : t21 = $[66];
|
|
7275
|
+
let t22;
|
|
7276
|
+
$[67] !== padding || $[68] !== t20 || $[69] !== t21 ? (t22 = /* @__PURE__ */ jsxRuntime.jsxs(Flex, { padding, children: [
|
|
7277
|
+
t20,
|
|
7278
|
+
t21
|
|
7279
|
+
] }), $[67] = padding, $[68] = t20, $[69] = t21, $[70] = t22) : t22 = $[70];
|
|
7280
|
+
const content = t22;
|
|
7281
|
+
if (href) {
|
|
7282
|
+
const t232 = selected ? "" : void 0;
|
|
7283
|
+
let t242;
|
|
7284
|
+
$[71] !== tree.level || $[72] !== expanded || $[73] !== linkAs || $[74] !== href || $[75] !== tabIndex || $[76] !== content ? (t242 = /* @__PURE__ */ jsxRuntime.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];
|
|
7285
|
+
let t252;
|
|
7286
|
+
$[78] !== children || $[79] !== expanded ? (t252 = children && /* @__PURE__ */ jsxRuntime.jsx(TreeGroup, { hidden: !expanded, children }), $[78] = children, $[79] = expanded, $[80] = t252) : t252 = $[80];
|
|
7287
|
+
let t262;
|
|
7288
|
+
$[81] !== contextValue || $[82] !== t252 ? (t262 = /* @__PURE__ */ jsxRuntime.jsx(TreeContext.Provider, { value: contextValue, children: t252 }), $[81] = contextValue, $[82] = t252, $[83] = t262) : t262 = $[83];
|
|
7289
|
+
let t272;
|
|
7290
|
+
return $[84] !== t232 || $[85] !== id || $[86] !== itemKey || $[87] !== restProps || $[88] !== handleClick || $[89] !== t242 || $[90] !== t262 ? (t272 = /* @__PURE__ */ jsxRuntime.jsxs(Root, { "data-selected": t232, "data-tree-id": id, "data-tree-key": itemKey, "data-ui": "TreeItem", ...restProps, onClick: handleClick, ref: setRootElement, role: "none", children: [
|
|
7291
|
+
t242,
|
|
7292
|
+
t262
|
|
7293
|
+
] }), $[84] = t232, $[85] = id, $[86] = itemKey, $[87] = restProps, $[88] = handleClick, $[89] = t242, $[90] = t262, $[91] = t272) : t272 = $[91], t272;
|
|
7294
|
+
}
|
|
7295
|
+
const t23 = selected ? "" : void 0;
|
|
7296
|
+
let t24;
|
|
7297
|
+
$[92] !== tree.level || $[93] !== content ? (t24 = /* @__PURE__ */ jsxRuntime.jsx(TreeItemBox, { $level: tree.level, as: "div", "data-ui": "TreeItem__box", children: content }), $[92] = tree.level, $[93] = content, $[94] = t24) : t24 = $[94];
|
|
7298
|
+
let t25;
|
|
7299
|
+
$[95] !== children || $[96] !== expanded ? (t25 = children && /* @__PURE__ */ jsxRuntime.jsx(TreeGroup, { expanded, children }), $[95] = children, $[96] = expanded, $[97] = t25) : t25 = $[97];
|
|
7300
|
+
let t26;
|
|
7301
|
+
$[98] !== contextValue || $[99] !== t25 ? (t26 = /* @__PURE__ */ jsxRuntime.jsx(TreeContext.Provider, { value: contextValue, children: t25 }), $[98] = contextValue, $[99] = t25, $[100] = t26) : t26 = $[100];
|
|
7302
|
+
let t27;
|
|
7303
|
+
return $[101] !== t23 || $[102] !== id || $[103] !== itemKey || $[104] !== restProps || $[105] !== expanded || $[106] !== handleClick || $[107] !== handleKeyDown || $[108] !== tabIndex || $[109] !== t24 || $[110] !== t26 ? (t27 = /* @__PURE__ */ jsxRuntime.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: [
|
|
7304
|
+
t24,
|
|
7305
|
+
t26
|
|
7306
|
+
] }), $[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;
|
|
7137
7307
|
});
|
|
7138
7308
|
TreeItem.displayName = "Memo(TreeItem)";
|
|
7139
7309
|
exports.Arrow = Arrow;
|