@sanity/ui 2.3.6-canary.1 → 2.3.6-canary.3
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.compiled.mjs +760 -401
- package/dist/index.compiled.mjs.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +161 -167
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +161 -167
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +161 -167
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/core/components/autocomplete/autocomplete.tsx +30 -33
- package/src/core/components/dialog/dialog.tsx +4 -2
- package/src/core/components/menu/menu.tsx +3 -1
- package/src/core/components/menu/menuGroup.tsx +2 -1
- package/src/core/components/menu/menuItem.tsx +4 -2
- package/src/core/components/toast/toastProvider.tsx +26 -24
- package/src/core/components/tree/treeItem.styles.ts +21 -0
- package/src/core/components/tree/treeItem.tsx +31 -44
- package/src/core/primitives/avatar/avatar.tsx +8 -12
- package/src/core/primitives/avatar/avatarCounter.tsx +10 -15
- package/src/core/primitives/avatar/avatarStack.tsx +1 -4
- package/src/core/primitives/popover/popover.tsx +41 -44
- package/src/core/primitives/tooltip/tooltip.tsx +8 -5
- package/src/core/theme/themeProvider.tsx +3 -6
- package/src/core/utils/elementQuery/elementQuery.tsx +4 -3
- package/src/core/utils/layer/getLayerContext.test.ts +0 -4
- package/src/core/utils/layer/layer.test.tsx +0 -2
- package/src/core/utils/layer/layerProvider.tsx +32 -41
- package/src/core/utils/layer/types.ts +0 -1
package/dist/index.js
CHANGED
|
@@ -131,12 +131,7 @@ function createGlobalScopedContext(key2, defaultValue) {
|
|
|
131
131
|
const key$8 = Symbol.for("@sanity/ui/context/theme"), ThemeContext = createGlobalScopedContext(key$8, null);
|
|
132
132
|
function ThemeProvider(props) {
|
|
133
133
|
var _a;
|
|
134
|
-
const parentTheme = react.useContext(ThemeContext), {
|
|
135
|
-
children,
|
|
136
|
-
// scheme = parentTheme?.scheme || 'light',
|
|
137
|
-
theme: rootTheme = (parentTheme == null ? void 0 : parentTheme.theme) || null,
|
|
138
|
-
tone = (parentTheme == null ? void 0 : parentTheme.tone) || "default"
|
|
139
|
-
} = props, scheme = (_a = props.scheme) != null ? _a : (parentTheme == null ? void 0 : parentTheme.scheme) || "light", themeContext = react.useMemo(() => rootTheme ? {
|
|
134
|
+
const { children } = props, parentTheme = react.useContext(ThemeContext), scheme = (_a = props.scheme) != null ? _a : (parentTheme == null ? void 0 : parentTheme.scheme) || "light", rootTheme = (parentTheme == null ? void 0 : parentTheme.theme) || null, tone = (parentTheme == null ? void 0 : parentTheme.tone) || "default", themeContext = react.useMemo(() => rootTheme ? {
|
|
140
135
|
version: 0,
|
|
141
136
|
theme: rootTheme,
|
|
142
137
|
scheme,
|
|
@@ -939,7 +934,7 @@ const Root$B = styledComponents.styled.div(
|
|
|
939
934
|
status = "online",
|
|
940
935
|
size: sizeProp = 1,
|
|
941
936
|
...restProps
|
|
942
|
-
} = props, { avatar } = useTheme_v2(), as = reactIs.isValidElementType(asProp) ? asProp : "div", size2 =
|
|
937
|
+
} = props, { avatar } = useTheme_v2(), as = reactIs.isValidElementType(asProp) ? asProp : "div", size2 = _getArrayProp(sizeProp), _sizeRem = (avatar.sizes[size2[0]] || avatar.sizes[0]).size, _radius = _sizeRem / 2, elementId = react.useId(), [arrowPosition, setArrowPosition] = react.useState(
|
|
943
938
|
animateArrowFrom || arrowPositionProp || "inside"
|
|
944
939
|
), [imageFailed, setImageFailed] = react.useState(!1), imageId = `avatar-image-${elementId}`;
|
|
945
940
|
react.useEffect(() => {
|
|
@@ -951,10 +946,7 @@ const Root$B = styledComponents.styled.div(
|
|
|
951
946
|
}, [src]);
|
|
952
947
|
const handleImageError = react.useCallback(() => {
|
|
953
948
|
setImageFailed(!0), onImageLoadError && onImageLoadError(new Error("Avatar: the image failed to load"));
|
|
954
|
-
}, [onImageLoadError]), initialsSize =
|
|
955
|
-
() => size2.map((s) => s === 1 ? 1 : s === 2 ? 3 : s === 3 ? 5 : 0),
|
|
956
|
-
[size2]
|
|
957
|
-
);
|
|
949
|
+
}, [onImageLoadError]), initialsSize = size2.map((s) => s === 1 ? 1 : s === 2 ? 3 : s === 3 ? 5 : 0);
|
|
958
950
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
959
951
|
Root$B,
|
|
960
952
|
{
|
|
@@ -1049,11 +1041,8 @@ const Root$A = styledComponents.styled.div(
|
|
|
1049
1041
|
_responsiveAvatarCounterSizeStyle,
|
|
1050
1042
|
_avatarCounterBaseStyle
|
|
1051
1043
|
), AvatarCounter = react.forwardRef(function(props, ref) {
|
|
1052
|
-
const { count, size:
|
|
1053
|
-
|
|
1054
|
-
[size2]
|
|
1055
|
-
);
|
|
1056
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Root$A, { $size: size2, "data-ui": "AvatarCounter", ref, children: /* @__PURE__ */ jsxRuntime.jsx(Label, { as: "span", size: fontSize2, weight: "medium", children: count }) });
|
|
1044
|
+
const { count, size: size2 } = props, $size = _getArrayProp(size2 != null ? size2 : 1), fontSize2 = $size.map((s) => s === 1 ? 1 : s === 2 ? 3 : s === 3 ? 5 : 0);
|
|
1045
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Root$A, { $size, "data-ui": "AvatarCounter", ref, children: /* @__PURE__ */ jsxRuntime.jsx(Label, { as: "span", size: fontSize2, weight: "medium", children: count }) });
|
|
1057
1046
|
}), BASE_STYLES = styledComponents.css`
|
|
1058
1047
|
white-space: nowrap;
|
|
1059
1048
|
|
|
@@ -1085,10 +1074,7 @@ const Root$z = styledComponents.styled.div(responsiveAvatarStackSizeStyle, avata
|
|
|
1085
1074
|
maxLength: maxLengthProp = 4,
|
|
1086
1075
|
size: sizeProp = 1,
|
|
1087
1076
|
...restProps
|
|
1088
|
-
} = props, children = react.useMemo(
|
|
1089
|
-
() => react.Children.toArray(childrenProp).filter(react.isValidElement),
|
|
1090
|
-
[childrenProp]
|
|
1091
|
-
), maxLength = Math.max(maxLengthProp, 0), size2 = react.useMemo(() => _getArrayProp(sizeProp), [sizeProp]), len = children.length, visibleCount = maxLength - 1, extraCount = len - visibleCount, visibleChildren = extraCount > 1 ? children.slice(extraCount, len) : children;
|
|
1077
|
+
} = props, children = react.Children.toArray(childrenProp).filter(react.isValidElement), maxLength = Math.max(maxLengthProp, 0), size2 = react.useMemo(() => _getArrayProp(sizeProp), [sizeProp]), len = children.length, visibleCount = maxLength - 1, extraCount = len - visibleCount, visibleChildren = extraCount > 1 ? children.slice(extraCount, len) : children;
|
|
1092
1078
|
return /* @__PURE__ */ jsxRuntime.jsxs(Root$z, { "data-ui": "AvatarStack", ...restProps, ref, $size: size2, children: [
|
|
1093
1079
|
len === 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(AvatarCounter, { count: len, size: size2 }) }),
|
|
1094
1080
|
len !== 0 && extraCount > 1 && /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(AvatarCounter, { count: extraCount, size: size2 }) }),
|
|
@@ -2835,10 +2821,10 @@ function findMinBreakpoints(media, width) {
|
|
|
2835
2821
|
return ret;
|
|
2836
2822
|
}
|
|
2837
2823
|
const ElementQuery = react.forwardRef(function(props, forwardedRef) {
|
|
2838
|
-
const theme2 = useTheme_v2(), { children, media
|
|
2824
|
+
const theme2 = useTheme_v2(), { children, media: _media, ...restProps } = props, media = _media != null ? _media : theme2.media, ref = react.useRef(null), [element, setElement] = react.useState(null), elementSize = useElementSize(element), width = react.useMemo(() => {
|
|
2839
2825
|
var _a;
|
|
2840
2826
|
return (_a = elementSize == null ? void 0 : elementSize.border.width) != null ? _a : window.innerWidth;
|
|
2841
|
-
}, [elementSize]), max =
|
|
2827
|
+
}, [elementSize]), max = findMaxBreakpoints(media, width), min = findMinBreakpoints(media, width);
|
|
2842
2828
|
react.useImperativeHandle(forwardedRef, () => ref.current);
|
|
2843
2829
|
const setRef = react.useCallback((el) => {
|
|
2844
2830
|
ref.current = el, setElement(el);
|
|
@@ -2972,18 +2958,18 @@ function _isScrollable(el) {
|
|
|
2972
2958
|
}
|
|
2973
2959
|
function LayerProvider(props) {
|
|
2974
2960
|
var _a;
|
|
2975
|
-
const { children, zOffset: zOffsetProp = 0 } = props, parentContextValue = react.useContext(LayerContext), parent = parentContextValue && getLayerContext(parentContextValue),
|
|
2961
|
+
const { children, zOffset: zOffsetProp = 0 } = props, parentContextValue = react.useContext(LayerContext), parentRegisterChild = react.useContext(LayerContextRegisterChild), parent = parentContextValue && getLayerContext(parentContextValue), level = ((_a = parent == null ? void 0 : parent.level) != null ? _a : 0) + 1, zOffset = react.useMemo(() => _getArrayProp(zOffsetProp), [zOffsetProp]), maxMediaIndex = zOffset.length - 1, mediaIndex = Math.min(useMediaIndex(), maxMediaIndex), zIndex = parent ? parent.zIndex + zOffset[mediaIndex] : zOffset[mediaIndex], [childLayers, setChildLayers] = react.useState({}), size2 = react.useMemo(() => Object.keys(childLayers).length, [childLayers]), isTopLayer = size2 === 0, registerChild = react.useCallback(
|
|
2976
2962
|
(childLevel) => {
|
|
2977
2963
|
const parentDispose = parentRegisterChild == null ? void 0 : parentRegisterChild(childLevel);
|
|
2978
|
-
return
|
|
2964
|
+
return setChildLayers((state) => {
|
|
2979
2965
|
var _a2;
|
|
2980
|
-
const prevLen = (_a2 = state[childLevel]) != null ? _a2 : 0
|
|
2981
|
-
return
|
|
2982
|
-
})
|
|
2983
|
-
|
|
2966
|
+
const prevLen = (_a2 = state[childLevel]) != null ? _a2 : 0;
|
|
2967
|
+
return { ...state, [childLevel]: prevLen + 1 };
|
|
2968
|
+
}), () => {
|
|
2969
|
+
setChildLayers((state) => {
|
|
2984
2970
|
const nextState = { ...state };
|
|
2985
|
-
return nextState[childLevel] === 1 ?
|
|
2986
|
-
})
|
|
2971
|
+
return nextState[childLevel] === 1 ? delete nextState[childLevel] : nextState[childLevel] -= 1, nextState;
|
|
2972
|
+
}), parentDispose == null || parentDispose();
|
|
2987
2973
|
};
|
|
2988
2974
|
},
|
|
2989
2975
|
[parentRegisterChild]
|
|
@@ -2994,15 +2980,14 @@ function LayerProvider(props) {
|
|
|
2994
2980
|
version: 0,
|
|
2995
2981
|
isTopLayer,
|
|
2996
2982
|
level,
|
|
2997
|
-
registerChild,
|
|
2998
2983
|
size: size2,
|
|
2999
2984
|
zIndex
|
|
3000
2985
|
}),
|
|
3001
|
-
[isTopLayer, level,
|
|
2986
|
+
[isTopLayer, level, size2, zIndex]
|
|
3002
2987
|
);
|
|
3003
|
-
return /* @__PURE__ */ jsxRuntime.jsx(LayerContext.Provider, { value, children });
|
|
2988
|
+
return /* @__PURE__ */ jsxRuntime.jsx(LayerContext.Provider, { value, children: /* @__PURE__ */ jsxRuntime.jsx(LayerContextRegisterChild.Provider, { value: registerChild, children }) });
|
|
3004
2989
|
}
|
|
3005
|
-
const Root$j = styledComponents.styled.div({ position: "relative" }), LayerChildren = react.forwardRef(function(props, forwardedRef) {
|
|
2990
|
+
const LayerContextRegisterChild = react.createContext(null), Root$j = styledComponents.styled.div({ position: "relative" }), LayerChildren = react.forwardRef(function(props, forwardedRef) {
|
|
3006
2991
|
const { children, onActivate, onFocus, style = EMPTY_RECORD, ...restProps } = props, { zIndex, isTopLayer } = useLayer(), lastFocusedRef = react.useRef(null), ref = react.useRef(null), isTopLayerRef = react.useRef(isTopLayer);
|
|
3007
2992
|
react.useImperativeHandle(forwardedRef, () => ref.current), react.useEffect(() => {
|
|
3008
2993
|
isTopLayerRef.current !== isTopLayer && isTopLayer && (onActivate == null || onActivate({ activeElement: lastFocusedRef.current })), isTopLayerRef.current = isTopLayer;
|
|
@@ -3270,19 +3255,19 @@ const MotionCard$1 = styledComponents.styled(framerMotion.motion(Card))`
|
|
|
3270
3255
|
PopoverCard.displayName = "PopoverCard";
|
|
3271
3256
|
const Popover = react.memo(
|
|
3272
3257
|
react.forwardRef(function(props, forwardedRef) {
|
|
3273
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i
|
|
3258
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
3274
3259
|
const { container, layer } = useTheme_v2(), boundaryElementContext = useBoundaryElement(), {
|
|
3275
3260
|
__unstable_margins: margins = DEFAULT_POPOVER_MARGINS,
|
|
3276
3261
|
animate: _animate = !1,
|
|
3277
3262
|
arrow: arrowProp = !1,
|
|
3278
|
-
boundaryElement
|
|
3279
|
-
children
|
|
3263
|
+
boundaryElement: _boundaryElement,
|
|
3264
|
+
children,
|
|
3280
3265
|
constrainSize = !1,
|
|
3281
3266
|
content,
|
|
3282
3267
|
disabled,
|
|
3283
|
-
fallbackPlacements
|
|
3268
|
+
fallbackPlacements: _fallbackPlacements,
|
|
3284
3269
|
matchReferenceWidth,
|
|
3285
|
-
floatingBoundary
|
|
3270
|
+
floatingBoundary: _floatingBoundary,
|
|
3286
3271
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3287
3272
|
onActivate,
|
|
3288
3273
|
open,
|
|
@@ -3292,16 +3277,16 @@ const Popover = react.memo(
|
|
|
3292
3277
|
portal,
|
|
3293
3278
|
preventOverflow = !0,
|
|
3294
3279
|
radius: radiusProp = 3,
|
|
3295
|
-
referenceBoundary
|
|
3280
|
+
referenceBoundary: _referenceBoundary,
|
|
3296
3281
|
referenceElement,
|
|
3297
3282
|
scheme,
|
|
3298
3283
|
shadow: shadowProp = 3,
|
|
3299
3284
|
tone = "inherit",
|
|
3300
3285
|
width: widthProp = "auto",
|
|
3301
|
-
zOffset:
|
|
3286
|
+
zOffset: _zOffset,
|
|
3302
3287
|
updateRef,
|
|
3303
3288
|
...restProps
|
|
3304
|
-
} = props, animate = usePrefersReducedMotion() ? !1 : _animate, boundarySize = (
|
|
3289
|
+
} = props, boundaryElement = _boundaryElement != null ? _boundaryElement : boundaryElementContext.element, referenceBoundary = (_a = _referenceBoundary != null ? _referenceBoundary : props.boundaryElement) != null ? _a : boundaryElementContext.element, floatingBoundary = (_b = _floatingBoundary != null ? _floatingBoundary : props.boundaryElement) != null ? _b : boundaryElementContext.element, fallbackPlacements = _fallbackPlacements != null ? _fallbackPlacements : DEFAULT_FALLBACK_PLACEMENTS$1[(_c = props.placement) != null ? _c : "bottom"], zOffsetProp = _zOffset != null ? _zOffset : layer.popover.zOffset, animate = usePrefersReducedMotion() ? !1 : _animate, boundarySize = (_d = useElementSize(boundaryElement)) == null ? void 0 : _d.border, padding = react.useMemo(() => _getArrayProp(paddingProp), [paddingProp]), radius = react.useMemo(() => _getArrayProp(radiusProp), [radiusProp]), shadow = react.useMemo(() => _getArrayProp(shadowProp), [shadowProp]), widthArrayProp = _getArrayProp(widthProp), zOffset = react.useMemo(() => _getArrayProp(zOffsetProp), [zOffsetProp]), ref = react.useRef(null), arrowRef = react.useRef(null), rootBoundary = "viewport";
|
|
3305
3290
|
react.useImperativeHandle(
|
|
3306
3291
|
forwardedRef,
|
|
3307
3292
|
() => ref.current
|
|
@@ -3382,27 +3367,18 @@ const Popover = react.memo(
|
|
|
3382
3367
|
middleware,
|
|
3383
3368
|
placement: placementProp,
|
|
3384
3369
|
whileElementsMounted: reactDom$1.autoUpdate
|
|
3385
|
-
}), referenceHidden = (
|
|
3370
|
+
}), referenceHidden = (_e = middlewareData.hide) == null ? void 0 : _e.referenceHidden, arrowX = (_f = middlewareData.arrow) == null ? void 0 : _f.x, arrowY = (_g = middlewareData.arrow) == null ? void 0 : _g.y, originX = (_h = middlewareData["@sanity/ui/origin"]) == null ? void 0 : _h.originX, originY = (_i = middlewareData["@sanity/ui/origin"]) == null ? void 0 : _i.originY, setArrow = react.useCallback((arrowEl) => {
|
|
3386
3371
|
arrowRef.current = arrowEl;
|
|
3387
3372
|
}, []), setFloating = react.useCallback(
|
|
3388
3373
|
(node) => {
|
|
3389
3374
|
ref.current = node, refs.setFloating(node);
|
|
3390
3375
|
},
|
|
3391
3376
|
[refs]
|
|
3392
|
-
)
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
},
|
|
3398
|
-
[childProp, refs]
|
|
3399
|
-
), child = react.useMemo(() => !childProp || referenceElement ? null : react.cloneElement(childProp, { ref: setReference }), [childProp, referenceElement, setReference]);
|
|
3400
|
-
if (react.useEffect(() => {
|
|
3401
|
-
updateRef && (typeof updateRef == "function" ? updateRef(update) : updateRef && (updateRef.current = update));
|
|
3402
|
-
}, [update, updateRef]), react.useEffect(() => {
|
|
3403
|
-
child || refs.setReference(referenceElement || null);
|
|
3404
|
-
}, [referenceElement, refs, child]), disabled)
|
|
3405
|
-
return childProp || /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
3377
|
+
);
|
|
3378
|
+
if (react.useImperativeHandle(updateRef, () => update, [update]), react.useEffect(() => {
|
|
3379
|
+
children || refs.setReference(referenceElement || null);
|
|
3380
|
+
}, [children, referenceElement, refs]), disabled)
|
|
3381
|
+
return children || /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
3406
3382
|
const popover = /* @__PURE__ */ jsxRuntime.jsx(LayerProvider, { zOffset, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3407
3383
|
PopoverCard,
|
|
3408
3384
|
{
|
|
@@ -3436,22 +3412,35 @@ const Popover = react.memo(
|
|
|
3436
3412
|
ConditionalWrapper,
|
|
3437
3413
|
{
|
|
3438
3414
|
condition: animate,
|
|
3439
|
-
wrapper: (
|
|
3415
|
+
wrapper: (children2) => /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: children2 }),
|
|
3440
3416
|
children: open && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3441
3417
|
ConditionalWrapper,
|
|
3442
3418
|
{
|
|
3443
3419
|
condition: !!portal,
|
|
3444
|
-
wrapper: (
|
|
3420
|
+
wrapper: (children2) => /* @__PURE__ */ jsxRuntime.jsx(Portal, { __unstable_name: typeof portal == "string" ? portal : void 0, children: children2 }),
|
|
3445
3421
|
children: popover
|
|
3446
3422
|
}
|
|
3447
3423
|
)
|
|
3448
3424
|
}
|
|
3449
3425
|
),
|
|
3450
|
-
|
|
3426
|
+
children && !referenceElement && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3427
|
+
"div",
|
|
3428
|
+
{
|
|
3429
|
+
ref: (node) => {
|
|
3430
|
+
logDeprecatedWarning(), refs.setReference(node);
|
|
3431
|
+
},
|
|
3432
|
+
style: { display: "contents" },
|
|
3433
|
+
children
|
|
3434
|
+
}
|
|
3435
|
+
)
|
|
3451
3436
|
] });
|
|
3452
3437
|
})
|
|
3453
3438
|
);
|
|
3454
3439
|
Popover.displayName = "Popover";
|
|
3440
|
+
let didWarn = !1;
|
|
3441
|
+
function logDeprecatedWarning() {
|
|
3442
|
+
didWarn || (console.warn("Popover: Please use the `referenceElement` prop instead of passing a children."), didWarn = !0);
|
|
3443
|
+
}
|
|
3455
3444
|
function radioBaseStyle() {
|
|
3456
3445
|
return styledComponents.css`
|
|
3457
3446
|
position: relative;
|
|
@@ -4324,30 +4313,30 @@ const Root$a = styledComponents.styled(Layer)`
|
|
|
4324
4313
|
pointer-events: none;
|
|
4325
4314
|
max-width: ${({ $maxWidth }) => $maxWidth}px;
|
|
4326
4315
|
`, Tooltip = react.forwardRef(function(props, forwardedRef) {
|
|
4327
|
-
var _a, _b, _c, _d, _e, _f
|
|
4316
|
+
var _a, _b, _c, _d, _e, _f;
|
|
4328
4317
|
const boundaryElementContext = useBoundaryElement(), { layer } = useTheme_v2(), {
|
|
4329
4318
|
animate: _animate = !1,
|
|
4330
4319
|
arrow: arrowProp = !1,
|
|
4331
|
-
boundaryElement
|
|
4320
|
+
boundaryElement: _boundaryElement,
|
|
4332
4321
|
children: childProp,
|
|
4333
4322
|
content,
|
|
4334
4323
|
disabled,
|
|
4335
|
-
fallbackPlacements:
|
|
4324
|
+
fallbackPlacements: _fallbackPlacements,
|
|
4336
4325
|
padding = 2,
|
|
4337
4326
|
placement: placementProp = "bottom",
|
|
4338
4327
|
portal: portalProp,
|
|
4339
4328
|
radius = 2,
|
|
4340
4329
|
scheme,
|
|
4341
4330
|
shadow = 2,
|
|
4342
|
-
zOffset
|
|
4331
|
+
zOffset: _zOffset,
|
|
4343
4332
|
delay,
|
|
4344
4333
|
...restProps
|
|
4345
|
-
} = props, animate = usePrefersReducedMotion() ? !1 : _animate, fallbackPlacements = react.useMemo(
|
|
4334
|
+
} = props, zOffset = _zOffset != null ? _zOffset : layer.tooltip.zOffset, fallbackPlacementsProp = _fallbackPlacements != null ? _fallbackPlacements : DEFAULT_FALLBACK_PLACEMENTS[(_a = props.placement) != null ? _a : "bottom"], boundaryElement = _boundaryElement != null ? _boundaryElement : boundaryElementContext == null ? void 0 : boundaryElementContext.element, animate = usePrefersReducedMotion() ? !1 : _animate, fallbackPlacements = react.useMemo(
|
|
4346
4335
|
() => _getArrayProp(fallbackPlacementsProp),
|
|
4347
4336
|
[fallbackPlacementsProp]
|
|
4348
4337
|
), ref = react.useRef(null), [referenceElement, setReferenceElement] = react.useState(null), arrowRef = react.useRef(null), rootBoundary = "viewport";
|
|
4349
4338
|
react.useImperativeHandle(forwardedRef, () => ref.current);
|
|
4350
|
-
const portal = usePortal(), portalElement = typeof portalProp == "string" ? ((
|
|
4339
|
+
const portal = usePortal(), portalElement = typeof portalProp == "string" ? ((_b = portal.elements) == null ? void 0 : _b[portalProp]) || null : portal.element, documentBodyOffsetWidth = react.useSyncExternalStore(
|
|
4351
4340
|
emptySubscribe,
|
|
4352
4341
|
() => document.body.offsetWidth,
|
|
4353
4342
|
// We don't actually know what the width of the body is during SSR, so we'll just assume it's 800px or larger
|
|
@@ -4378,7 +4367,7 @@ const Root$a = styledComponents.styled(Layer)`
|
|
|
4378
4367
|
middleware,
|
|
4379
4368
|
placement: placementProp,
|
|
4380
4369
|
whileElementsMounted: reactDom$1.autoUpdate
|
|
4381
|
-
}), arrowX = (
|
|
4370
|
+
}), arrowX = (_c = middlewareData.arrow) == null ? void 0 : _c.x, arrowY = (_d = middlewareData.arrow) == null ? void 0 : _d.y, originX = (_e = middlewareData["@sanity/ui/origin"]) == null ? void 0 : _e.originX, originY = (_f = middlewareData["@sanity/ui/origin"]) == null ? void 0 : _f.originY, tooltipId = react.useId(), [isOpen, setIsOpen] = useDelayedState(!1), delayGroupContext = useTooltipDelayGroup(), showTooltip = isOpen || (delayGroupContext == null ? void 0 : delayGroupContext.openTooltipId) === tooltipId, isInsideGroup = delayGroupContext !== null, openDelayProp = typeof delay == "number" ? delay : (delay == null ? void 0 : delay.open) || 0, closeDelayProp = typeof delay == "number" ? delay : (delay == null ? void 0 : delay.close) || 0, openDelay = isInsideGroup ? delayGroupContext.openDelay : openDelayProp, closeDelay = isInsideGroup ? delayGroupContext.closeDelay : closeDelayProp, handleIsOpenChange = react.useCallback(
|
|
4382
4371
|
(open, immediate) => {
|
|
4383
4372
|
if (isInsideGroup)
|
|
4384
4373
|
if (open) {
|
|
@@ -4431,9 +4420,9 @@ const Root$a = styledComponents.styled(Layer)`
|
|
|
4431
4420
|
);
|
|
4432
4421
|
react.useEffect(() => {
|
|
4433
4422
|
if (!showTooltip) return;
|
|
4434
|
-
|
|
4423
|
+
const handleWindowMouseMove = (event) => {
|
|
4435
4424
|
referenceElement && (referenceElement === event.target || event.target instanceof Node && referenceElement.contains(event.target) || (handleIsOpenChange(!1), window.removeEventListener("mousemove", handleWindowMouseMove)));
|
|
4436
|
-
}
|
|
4425
|
+
};
|
|
4437
4426
|
return window.addEventListener("mousemove", handleWindowMouseMove), () => {
|
|
4438
4427
|
window.removeEventListener("mousemove", handleWindowMouseMove);
|
|
4439
4428
|
};
|
|
@@ -4634,37 +4623,34 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = [
|
|
|
4634
4623
|
forwardedRef,
|
|
4635
4624
|
() => inputElementRef.current
|
|
4636
4625
|
);
|
|
4637
|
-
const listBoxId = `${id}-listbox`, options = Array.isArray(optionsProp) ? optionsProp : EMPTY_ARRAY, padding =
|
|
4626
|
+
const listBoxId = `${id}-listbox`, options = Array.isArray(optionsProp) ? optionsProp : EMPTY_ARRAY, padding = _getArrayProp(paddingProp), currentOption = react.useMemo(
|
|
4638
4627
|
() => value !== null ? options.find((o) => o.value === value) : void 0,
|
|
4639
4628
|
[options, value]
|
|
4640
4629
|
), filteredOptions = react.useMemo(
|
|
4641
4630
|
() => options.filter((option) => query ? filterOption(query, option) : !0),
|
|
4642
4631
|
[filterOption, options, query]
|
|
4643
|
-
), filteredOptionsLen = filteredOptions.length, activeItemId = activeValue ? `${id}-option-${activeValue}` : void 0, expanded = query !== null && loading || focused && query !== null, handleRootBlur =
|
|
4644
|
-
(
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
|
|
4648
|
-
|
|
4649
|
-
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
|
|
4661
|
-
|
|
4662
|
-
},
|
|
4663
|
-
[onBlur, onQueryChange, relatedElements]
|
|
4664
|
-
), handleRootFocus = react.useCallback((event) => {
|
|
4632
|
+
), filteredOptionsLen = filteredOptions.length, activeItemId = activeValue ? `${id}-option-${activeValue}` : void 0, expanded = query !== null && loading || focused && query !== null, handleRootBlur = (event) => {
|
|
4633
|
+
setTimeout(() => {
|
|
4634
|
+
if (popoverMouseWithinRef.current)
|
|
4635
|
+
return;
|
|
4636
|
+
const elements = (relatedElements || []).concat(
|
|
4637
|
+
rootElementRef.current ? [rootElementRef.current] : [],
|
|
4638
|
+
resultsPopoverElementRef.current ? [resultsPopoverElementRef.current] : []
|
|
4639
|
+
);
|
|
4640
|
+
let focusInside = !1;
|
|
4641
|
+
if (document.activeElement) {
|
|
4642
|
+
for (const e of elements)
|
|
4643
|
+
if (e === document.activeElement || e.contains(document.activeElement)) {
|
|
4644
|
+
focusInside = !0;
|
|
4645
|
+
break;
|
|
4646
|
+
}
|
|
4647
|
+
}
|
|
4648
|
+
focusInside === !1 && (dispatch({ type: "root/blur" }), popoverMouseWithinRef.current = !1, onQueryChange && onQueryChange(null), onBlur && onBlur(event));
|
|
4649
|
+
}, 0);
|
|
4650
|
+
}, handleRootFocus = (event) => {
|
|
4665
4651
|
const listBoxElement = listBoxElementRef.current, focusedElement = event.target instanceof HTMLElement ? event.target : null, listFocused2 = (listBoxElement == null ? void 0 : listBoxElement.contains(focusedElement)) || !1;
|
|
4666
4652
|
listFocused2 !== listFocusedRef.current && (listFocusedRef.current = listFocused2, dispatch({ type: "root/setListFocused", listFocused: listFocused2 }));
|
|
4667
|
-
},
|
|
4653
|
+
}, handleOptionSelect = react.useCallback(
|
|
4668
4654
|
(v) => {
|
|
4669
4655
|
var _a;
|
|
4670
4656
|
dispatch({ type: "value/change", value: v }), popoverMouseWithinRef.current = !1, onSelect && onSelect(v), valueRef.current = v, onChange && onChange(v), onQueryChange && onQueryChange(null), (_a = inputElementRef.current) == null || _a.focus();
|
|
@@ -5154,13 +5140,13 @@ const Root$7 = styledComponents.styled(Layer)(responsivePaddingStyle, dialogStyl
|
|
|
5154
5140
|
onFocus,
|
|
5155
5141
|
padding: paddingProp = 3,
|
|
5156
5142
|
portal: portalProp,
|
|
5157
|
-
position:
|
|
5143
|
+
position: _position,
|
|
5158
5144
|
scheme,
|
|
5159
5145
|
width: widthProp = 0,
|
|
5160
|
-
zOffset:
|
|
5146
|
+
zOffset: _zOffset,
|
|
5161
5147
|
animate: _animate = !1,
|
|
5162
5148
|
...restProps
|
|
5163
|
-
} = props, animate = usePrefersReducedMotion() ? !1 : _animate, portal = usePortal(), portalElement = portalProp ? ((_a = portal.elements) == null ? void 0 : _a[portalProp]) || null : portal.element, boundaryElement = useBoundaryElement().element, cardRadius = react.useMemo(() => _getArrayProp(cardRadiusProp), [cardRadiusProp]), padding = react.useMemo(() => _getArrayProp(paddingProp), [paddingProp]), position = react.useMemo(() => _getArrayProp(positionProp), [positionProp]), width = react.useMemo(() => _getArrayProp(widthProp), [widthProp]), zOffset = react.useMemo(() => _getArrayProp(zOffsetProp), [zOffsetProp]), preDivRef = react.useRef(null), postDivRef = react.useRef(null), cardRef = react.useRef(null), focusedElementRef = react.useRef(null), handleFocus = react.useCallback(
|
|
5149
|
+
} = props, positionProp = _position != null ? _position : dialog.position || "fixed", zOffsetProp = _zOffset != null ? _zOffset : dialog.zOffset || layer.dialog.zOffset, animate = usePrefersReducedMotion() ? !1 : _animate, portal = usePortal(), portalElement = portalProp ? ((_a = portal.elements) == null ? void 0 : _a[portalProp]) || null : portal.element, boundaryElement = useBoundaryElement().element, cardRadius = react.useMemo(() => _getArrayProp(cardRadiusProp), [cardRadiusProp]), padding = react.useMemo(() => _getArrayProp(paddingProp), [paddingProp]), position = react.useMemo(() => _getArrayProp(positionProp), [positionProp]), width = react.useMemo(() => _getArrayProp(widthProp), [widthProp]), zOffset = react.useMemo(() => _getArrayProp(zOffsetProp), [zOffsetProp]), preDivRef = react.useRef(null), postDivRef = react.useRef(null), cardRef = react.useRef(null), focusedElementRef = react.useRef(null), handleFocus = react.useCallback(
|
|
5164
5150
|
(event) => {
|
|
5165
5151
|
onFocus == null || onFocus(event);
|
|
5166
5152
|
const target = event.target, cardElement = cardRef.current;
|
|
@@ -5424,10 +5410,10 @@ const Root$5 = styledComponents.styled(Box)`
|
|
|
5424
5410
|
originElement,
|
|
5425
5411
|
padding = 1,
|
|
5426
5412
|
registerElement,
|
|
5427
|
-
shouldFocus
|
|
5413
|
+
shouldFocus: _shouldFocus,
|
|
5428
5414
|
space = 1,
|
|
5429
5415
|
...restProps
|
|
5430
|
-
} = props, ref = react.useRef(null);
|
|
5416
|
+
} = props, shouldFocus = _shouldFocus != null ? _shouldFocus : props.focusFirst && "first" || props.focusLast && "last" || null, ref = react.useRef(null);
|
|
5431
5417
|
react.useImperativeHandle(forwardedRef, () => ref.current);
|
|
5432
5418
|
const { isTopLayer } = useLayer(), {
|
|
5433
5419
|
activeElement,
|
|
@@ -5773,9 +5759,9 @@ function MenuGroup(props) {
|
|
|
5773
5759
|
onClickOutside,
|
|
5774
5760
|
onEscape,
|
|
5775
5761
|
onItemClick,
|
|
5776
|
-
onItemMouseEnter
|
|
5762
|
+
onItemMouseEnter: _onItemMouseEnter,
|
|
5777
5763
|
registerElement
|
|
5778
|
-
} = menu, [rootElement, setRootElement] = react.useState(null), [open, setOpen] = react.useState(!1), shouldFocusRef = react.useRef(null), active = !!activeElement && activeElement === rootElement, [withinMenu, setWithinMenu] = react.useState(!1), radius = react.useMemo(() => _getArrayProp(radiusProp), [radiusProp]), handleMouseEnter = react.useCallback(
|
|
5764
|
+
} = menu, onItemMouseEnter = _onItemMouseEnter != null ? _onItemMouseEnter : menu.onMouseEnter, [rootElement, setRootElement] = react.useState(null), [open, setOpen] = react.useState(!1), shouldFocusRef = react.useRef(null), active = !!activeElement && activeElement === rootElement, [withinMenu, setWithinMenu] = react.useState(!1), radius = react.useMemo(() => _getArrayProp(radiusProp), [radiusProp]), handleMouseEnter = react.useCallback(
|
|
5779
5765
|
(event) => {
|
|
5780
5766
|
setWithinMenu(!1), onItemMouseEnter(event), setOpen(!0);
|
|
5781
5767
|
},
|
|
@@ -5881,9 +5867,9 @@ const MenuItem = react.forwardRef(function(props, forwardedRef) {
|
|
|
5881
5867
|
activeElement,
|
|
5882
5868
|
mount,
|
|
5883
5869
|
onItemClick,
|
|
5884
|
-
onItemMouseEnter
|
|
5885
|
-
onItemMouseLeave
|
|
5886
|
-
} = menu, [rootElement, setRootElement] = react.useState(null), active = !!activeElement && activeElement === rootElement, ref = react.useRef(null);
|
|
5870
|
+
onItemMouseEnter: _onItemMouseEnter,
|
|
5871
|
+
onItemMouseLeave: _onItemMouseLeave
|
|
5872
|
+
} = menu, onItemMouseEnter = _onItemMouseEnter != null ? _onItemMouseEnter : menu.onMouseEnter, onItemMouseLeave = _onItemMouseLeave != null ? _onItemMouseLeave : menu.onMouseLeave, [rootElement, setRootElement] = react.useState(null), active = !!activeElement && activeElement === rootElement, ref = react.useRef(null);
|
|
5887
5873
|
react.useImperativeHandle(forwardedRef, () => ref.current), react.useEffect(() => mount(rootElement, selectedProp), [mount, rootElement, selectedProp]);
|
|
5888
5874
|
const handleClick = react.useCallback(
|
|
5889
5875
|
(event) => {
|
|
@@ -6203,33 +6189,12 @@ const subscribe = () => () => {
|
|
|
6203
6189
|
max-width: 420px;
|
|
6204
6190
|
width: 100%;
|
|
6205
6191
|
`;
|
|
6206
|
-
let toastId = 0;
|
|
6207
6192
|
function ToastProvider(props) {
|
|
6208
6193
|
const { children, padding = 4, paddingX, paddingY, zOffset } = props, [state, _setState] = react.useState([]), toastsRef = react.useRef({}), mounted = useMounted(), prefersReducedMotion = usePrefersReducedMotion(), variants = react.useMemo(
|
|
6209
|
-
() => (
|
|
6210
|
-
initial: {
|
|
6211
|
-
opacity: 0,
|
|
6212
|
-
[POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: 0,
|
|
6213
|
-
y: 32,
|
|
6214
|
-
scale: 0.25,
|
|
6215
|
-
willChange: "transform"
|
|
6216
|
-
},
|
|
6217
|
-
animate: {
|
|
6218
|
-
opacity: [0, 1, 1],
|
|
6219
|
-
[POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: [0, 0, 1],
|
|
6220
|
-
y: 0,
|
|
6221
|
-
scale: 1
|
|
6222
|
-
},
|
|
6223
|
-
exit: {
|
|
6224
|
-
opacity: [1, 1, 0],
|
|
6225
|
-
[POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: [1, 0, 0],
|
|
6226
|
-
scale: 0.5,
|
|
6227
|
-
transition: prefersReducedMotion ? { duration: 0 } : { duration: 0.2 }
|
|
6228
|
-
}
|
|
6229
|
-
}),
|
|
6194
|
+
() => getVariants(prefersReducedMotion),
|
|
6230
6195
|
[prefersReducedMotion]
|
|
6231
6196
|
), value = react.useMemo(() => ({ version: 0, push: (params) => {
|
|
6232
|
-
const setState = (state2) => react.startTransition(() => _setState(state2)), id = params.id ||
|
|
6197
|
+
const setState = (state2) => react.startTransition(() => _setState(state2)), id = params.id || crypto.randomUUID(), duration = params.duration || 5e3, dismiss = () => {
|
|
6233
6198
|
var _a;
|
|
6234
6199
|
const timeoutId = (_a = toastsRef.current[id]) == null ? void 0 : _a.timeoutId;
|
|
6235
6200
|
setState((prevState) => {
|
|
@@ -6282,6 +6247,29 @@ function ToastProvider(props) {
|
|
|
6282
6247
|
)) }) }) }) })
|
|
6283
6248
|
] });
|
|
6284
6249
|
}
|
|
6250
|
+
function getVariants(prefersReducedMotion) {
|
|
6251
|
+
return {
|
|
6252
|
+
initial: {
|
|
6253
|
+
opacity: 0,
|
|
6254
|
+
[POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: 0,
|
|
6255
|
+
y: 32,
|
|
6256
|
+
scale: 0.25,
|
|
6257
|
+
willChange: "transform"
|
|
6258
|
+
},
|
|
6259
|
+
animate: {
|
|
6260
|
+
opacity: [0, 1, 1],
|
|
6261
|
+
[POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: [0, 0, 1],
|
|
6262
|
+
y: 0,
|
|
6263
|
+
scale: 1
|
|
6264
|
+
},
|
|
6265
|
+
exit: {
|
|
6266
|
+
opacity: [1, 1, 0],
|
|
6267
|
+
[POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: [1, 0, 0],
|
|
6268
|
+
scale: 0.5,
|
|
6269
|
+
transition: { duration: prefersReducedMotion ? 0 : 0.2 }
|
|
6270
|
+
}
|
|
6271
|
+
};
|
|
6272
|
+
}
|
|
6285
6273
|
function useToast() {
|
|
6286
6274
|
const value = react.useContext(ToastContext);
|
|
6287
6275
|
if (!value)
|
|
@@ -6468,6 +6456,28 @@ const key = Symbol.for("@sanity/ui/context/tree"), TreeContext = createGlobalSco
|
|
|
6468
6456
|
})
|
|
6469
6457
|
);
|
|
6470
6458
|
Tree.displayName = "Tree";
|
|
6459
|
+
function useTree() {
|
|
6460
|
+
const tree = react.useContext(TreeContext);
|
|
6461
|
+
if (!tree)
|
|
6462
|
+
throw new Error("Tree: missing context value");
|
|
6463
|
+
return tree;
|
|
6464
|
+
}
|
|
6465
|
+
const TreeGroup = react.memo(function(props) {
|
|
6466
|
+
const { children, expanded = !1, ...restProps } = props, tree = useTree();
|
|
6467
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6468
|
+
Stack,
|
|
6469
|
+
{
|
|
6470
|
+
as: "ul",
|
|
6471
|
+
"data-ui": "TreeGroup",
|
|
6472
|
+
...restProps,
|
|
6473
|
+
hidden: !expanded,
|
|
6474
|
+
marginTop: tree.space,
|
|
6475
|
+
role: "group",
|
|
6476
|
+
space: tree.space,
|
|
6477
|
+
children
|
|
6478
|
+
}
|
|
6479
|
+
);
|
|
6480
|
+
});
|
|
6471
6481
|
function treeItemRootStyle() {
|
|
6472
6482
|
return styledComponents.css`
|
|
6473
6483
|
&[role='none'] > [role='treeitem'] {
|
|
@@ -6554,28 +6564,9 @@ function treeItemBoxStyle(props) {
|
|
|
6554
6564
|
}
|
|
6555
6565
|
`;
|
|
6556
6566
|
}
|
|
6557
|
-
|
|
6558
|
-
|
|
6559
|
-
|
|
6560
|
-
throw new Error("Tree: missing context value");
|
|
6561
|
-
return tree;
|
|
6562
|
-
}
|
|
6563
|
-
const TreeGroup = react.memo(function(props) {
|
|
6564
|
-
const { children, expanded = !1, ...restProps } = props, tree = useTree();
|
|
6565
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6566
|
-
Stack,
|
|
6567
|
-
{
|
|
6568
|
-
as: "ul",
|
|
6569
|
-
"data-ui": "TreeGroup",
|
|
6570
|
-
...restProps,
|
|
6571
|
-
hidden: !expanded,
|
|
6572
|
-
marginTop: tree.space,
|
|
6573
|
-
role: "group",
|
|
6574
|
-
space: tree.space,
|
|
6575
|
-
children
|
|
6576
|
-
}
|
|
6577
|
-
);
|
|
6578
|
-
}), Root = react.memo(styledComponents.styled.li(treeItemRootStyle, treeItemRootColorStyle)), TreeItemBox = styledComponents.styled(Box).attrs({ forwardedAs: "a" })(treeItemBoxStyle), ToggleArrowText = styledComponents.styled(Text)`
|
|
6567
|
+
const Root = react.memo(styledComponents.styled.li(treeItemRootStyle, treeItemRootColorStyle)), TreeItemBox = styledComponents.styled(Box).attrs({ forwardedAs: "a" })(
|
|
6568
|
+
treeItemBoxStyle
|
|
6569
|
+
), ToggleArrowText = styledComponents.styled(Text)`
|
|
6579
6570
|
& > svg {
|
|
6580
6571
|
transition: transform 100ms;
|
|
6581
6572
|
}
|
|
@@ -6596,12 +6587,12 @@ const TreeGroup = react.memo(function(props) {
|
|
|
6596
6587
|
text,
|
|
6597
6588
|
weight,
|
|
6598
6589
|
...restProps
|
|
6599
|
-
} = props, rootRef = react.useRef(null), treeitemRef = react.useRef(null), tree = useTree(), { path, registerItem, setExpanded, setFocusedElement } = tree, _id = react.useId(), id = idProp || _id, itemPath = react.useMemo(() => path
|
|
6590
|
+
} = props, rootRef = react.useRef(null), treeitemRef = react.useRef(null), tree = useTree(), { path, registerItem, setExpanded, setFocusedElement } = tree, _id = react.useId(), id = idProp || _id, itemPath = react.useMemo(() => [...path, id || ""], [id, path]), itemKey = itemPath.join("/"), itemState = tree.state[itemKey], focused = tree.focusedElement === rootRef.current, expanded = (itemState == null ? void 0 : itemState.expanded) === void 0 ? expandedProp : (itemState == null ? void 0 : itemState.expanded) || !1, tabIndex = tree.focusedElement && tree.focusedElement === rootRef.current ? 0 : -1, contextValue = react.useMemo(
|
|
6600
6591
|
() => ({ ...tree, level: tree.level + 1, path: itemPath }),
|
|
6601
6592
|
[itemPath, tree]
|
|
6602
6593
|
), handleClick = react.useCallback(
|
|
6603
6594
|
(event) => {
|
|
6604
|
-
onClick
|
|
6595
|
+
onClick == null || onClick(event);
|
|
6605
6596
|
const target = event.target;
|
|
6606
6597
|
target instanceof HTMLElement && (target.getAttribute("data-ui") === "TreeItem" || target.closest('[data-ui="TreeItem__box"]')) && (event.stopPropagation(), setExpanded(itemKey, !expanded), setFocusedElement(rootRef.current));
|
|
6607
6598
|
},
|
|
@@ -6619,23 +6610,26 @@ const TreeGroup = react.memo(function(props) {
|
|
|
6619
6610
|
if (rootRef.current)
|
|
6620
6611
|
return registerItem(rootRef.current, itemPath.join("/"), expanded, selected);
|
|
6621
6612
|
}, [expanded, itemPath, registerItem, selected]);
|
|
6622
|
-
const content =
|
|
6623
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
6624
|
-
|
|
6625
|
-
|
|
6626
|
-
|
|
6627
|
-
|
|
6628
|
-
|
|
6629
|
-
|
|
6630
|
-
|
|
6631
|
-
|
|
6632
|
-
|
|
6633
|
-
|
|
6634
|
-
|
|
6635
|
-
|
|
6636
|
-
|
|
6637
|
-
|
|
6638
|
-
|
|
6613
|
+
const content = react.useMemo(
|
|
6614
|
+
() => /* @__PURE__ */ jsxRuntime.jsxs(Flex, { padding, children: [
|
|
6615
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
6616
|
+
Box,
|
|
6617
|
+
{
|
|
6618
|
+
marginRight: space,
|
|
6619
|
+
style: {
|
|
6620
|
+
visibility: IconComponent || children ? "visible" : "hidden",
|
|
6621
|
+
pointerEvents: "none"
|
|
6622
|
+
},
|
|
6623
|
+
children: [
|
|
6624
|
+
IconComponent && /* @__PURE__ */ jsxRuntime.jsx(Text, { muted, size: fontSize2, weight, children: /* @__PURE__ */ jsxRuntime.jsx(IconComponent, {}) }),
|
|
6625
|
+
!IconComponent && /* @__PURE__ */ jsxRuntime.jsx(ToggleArrowText, { muted, size: fontSize2, weight, children: /* @__PURE__ */ jsxRuntime.jsx(icons.ToggleArrowRightIcon, { style: { transform: expanded ? "rotate(90deg)" : void 0 } }) })
|
|
6626
|
+
]
|
|
6627
|
+
}
|
|
6628
|
+
),
|
|
6629
|
+
/* @__PURE__ */ jsxRuntime.jsx(Box, { flex: 1, children: /* @__PURE__ */ jsxRuntime.jsx(Text, { muted, size: fontSize2, textOverflow: "ellipsis", weight, children: text }) })
|
|
6630
|
+
] }),
|
|
6631
|
+
[IconComponent, children, expanded, fontSize2, muted, padding, space, text, weight]
|
|
6632
|
+
);
|
|
6639
6633
|
return href ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6640
6634
|
Root,
|
|
6641
6635
|
{
|