@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.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, useMemo, useCallback, Component, memo, useLayoutEffect, useReducer, Fragment as Fragment$1, startTransition } from "react";
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, media = _media ?? theme.media, ref = useRef(null), [element, setElement] = useState(null), elementSize = useElementSize(element), width = useMemo(() => elementSize?.border.width ?? window.innerWidth, [elementSize]), max = useMemo(() => findMaxBreakpoints(media, width), [media, width]), min = useMemo(() => findMinBreakpoints(media, width), [media, width]);
3229
- useImperativeHandle(forwardedRef, () => ref.current);
3230
- const setRef = useCallback((el) => {
3231
- ref.current = el, setElement(el);
3232
- }, []);
3233
- return /* @__PURE__ */ jsx("div", { "data-ui": "ElementQuery", ...restProps, "data-eq-max": max.length ? max.join(" ") : void 0, "data-eq-min": min.length ? min.join(" ") : void 0, ref: setRef, children });
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: zOffsetProp = 0
3363
- } = props, parentContextValue = useContext(LayerContext), parent = parentContextValue && getLayerContext(parentContextValue), 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], [, setChildLayers] = useState({}), [size2, setSize] = useState(0), isTopLayer = size2 === 0, registerChild = useCallback((childLevel) => {
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] -= 1, nextState_0;
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
- useEffect(() => parentRegisterChild?.(level), [level, parentRegisterChild]);
3381
- const value = useMemo(() => ({
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
- }), [isTopLayer, level, registerChild, size2, zIndex]);
3389
- return /* @__PURE__ */ jsx(LayerContext.Provider, { value, children });
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), arrowRef = useRef(null), rootBoundary = "viewport";
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: arrowRef,
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, setArrow = useCallback((arrowEl) => {
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: setArrow, 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);
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
@@ -5939,8 +5971,8 @@ const Root$5 = styled(Box)`
5939
5971
  });
5940
5972
  Menu.displayName = "ForwardRef(Menu)";
5941
5973
  const MenuButton = forwardRef(function(props, forwardedRef) {
5942
- const {
5943
- __unstable_disableRestoreFocusOnClose: disableRestoreFocusOnClose = !1,
5974
+ const $ = c(62), {
5975
+ __unstable_disableRestoreFocusOnClose: t0,
5944
5976
  boundaryElement: deprecated_boundaryElement,
5945
5977
  button: buttonProp,
5946
5978
  id,
@@ -5949,23 +5981,38 @@ const MenuButton = forwardRef(function(props, forwardedRef) {
5949
5981
  onOpen,
5950
5982
  placement: deprecated_placement,
5951
5983
  popoverScheme: deprecated_popoverScheme,
5952
- portal: deprecated_portal = !0,
5984
+ portal: t1,
5953
5985
  popover,
5954
5986
  popoverRadius: deprecated_popoverRadius,
5955
5987
  preventOverflow: deprecated_preventOverflow
5956
- } = props, [open, setOpen] = useState(!1), [shouldFocus, setShouldFocus] = useState(null), [buttonElement, setButtonElement] = useState(null), [menuElements, setChildMenuElements] = useState([]), openRef = useRef(open);
5957
- useEffect(() => {
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 = () => {
5958
5994
  onOpen && open && !openRef.current && onOpen();
5959
- }, [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 = () => {
5960
5998
  onClose && !open && openRef.current && onClose();
5961
- }, [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 = () => {
5962
6002
  openRef.current = open;
5963
- }, [open]);
5964
- const handleButtonClick = useCallback(() => {
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 = () => {
5965
6006
  setOpen((v) => !v), setShouldFocus(null);
5966
- }, []), handleMouseDown = useCallback((event) => {
6007
+ }, $[12] = t9) : t9 = $[12];
6008
+ const handleButtonClick = t9;
6009
+ let t10;
6010
+ $[13] !== open ? (t10 = (event) => {
5967
6011
  open && event.preventDefault();
5968
- }, [open]), handleButtonKeyDown = useCallback((event_0) => {
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) => {
5969
6016
  if (event_0.key === "ArrowDown" || event_0.key === "Enter" || event_0.key === " ") {
5970
6017
  event_0.preventDefault(), setOpen(!0), setShouldFocus("first");
5971
6018
  return;
@@ -5974,7 +6021,10 @@ const MenuButton = forwardRef(function(props, forwardedRef) {
5974
6021
  event_0.preventDefault(), setOpen(!0), setShouldFocus("last");
5975
6022
  return;
5976
6023
  }
5977
- }, []), handleMenuClickOutside = useCallback((event_1) => {
6024
+ }, $[15] = t11) : t11 = $[15];
6025
+ const handleButtonKeyDown = t11;
6026
+ let t12;
6027
+ $[16] !== buttonElement || $[17] !== menuElements ? (t12 = (event_1) => {
5978
6028
  const target = event_1.target;
5979
6029
  if (target instanceof Node && !(buttonElement && (target === buttonElement || buttonElement.contains(target)))) {
5980
6030
  for (const el of menuElements)
@@ -5982,9 +6032,15 @@ const MenuButton = forwardRef(function(props, forwardedRef) {
5982
6032
  return;
5983
6033
  setOpen(!1);
5984
6034
  }
5985
- }, [buttonElement, menuElements]), handleMenuEscape = useCallback(() => {
6035
+ }, $[16] = buttonElement, $[17] = menuElements, $[18] = t12) : t12 = $[18];
6036
+ const handleMenuClickOutside = t12;
6037
+ let t13;
6038
+ $[19] !== disableRestoreFocusOnClose || $[20] !== buttonElement ? (t13 = () => {
5986
6039
  setOpen(!1), !disableRestoreFocusOnClose && buttonElement && buttonElement.focus();
5987
- }, [buttonElement, disableRestoreFocusOnClose]), handleBlur = useCallback((event_2) => {
6040
+ }, $[19] = disableRestoreFocusOnClose, $[20] = buttonElement, $[21] = t13) : t13 = $[21];
6041
+ const handleMenuEscape = t13;
6042
+ let t14;
6043
+ $[22] !== menuElements ? (t14 = (event_2) => {
5988
6044
  const target_0 = event_2.relatedTarget;
5989
6045
  if (target_0 instanceof Node) {
5990
6046
  for (const el_0 of menuElements)
@@ -5992,9 +6048,18 @@ const MenuButton = forwardRef(function(props, forwardedRef) {
5992
6048
  return;
5993
6049
  setOpen(!1);
5994
6050
  }
5995
- }, [menuElements]), handleItemClick = useCallback(() => {
6051
+ }, $[22] = menuElements, $[23] = t14) : t14 = $[23];
6052
+ const handleBlur = t14;
6053
+ let t15;
6054
+ $[24] !== disableRestoreFocusOnClose || $[25] !== buttonElement ? (t15 = () => {
5996
6055
  setOpen(!1), !disableRestoreFocusOnClose && buttonElement && buttonElement.focus();
5997
- }, [buttonElement, disableRestoreFocusOnClose]), registerElement = useCallback((el_1) => (setChildMenuElements((els) => els.concat([el_1])), () => setChildMenuElements((els_0) => els_0.filter((_el) => _el !== el_1))), []), menuProps = useMemo(() => ({
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, {
5998
6063
  "aria-labelledby": id,
5999
6064
  onBlurCapture: handleBlur,
6000
6065
  onClickOutside: handleMenuClickOutside,
@@ -6003,7 +6068,10 @@ const MenuButton = forwardRef(function(props, forwardedRef) {
6003
6068
  originElement: buttonElement,
6004
6069
  registerElement,
6005
6070
  shouldFocus
6006
- }), [buttonElement, handleMenuClickOutside, handleMenuEscape, handleItemClick, id, handleBlur, registerElement, shouldFocus]), menu = menuProp && cloneElement(menuProp, menuProps), ref = useRef(null), button = useMemo(() => buttonProp && cloneElement(buttonProp, {
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, {
6007
6075
  "data-ui": "MenuButton",
6008
6076
  id,
6009
6077
  onClick: handleButtonClick,
@@ -6011,14 +6079,16 @@ const MenuButton = forwardRef(function(props, forwardedRef) {
6011
6079
  onMouseDown: handleMouseDown,
6012
6080
  "aria-haspopup": !0,
6013
6081
  "aria-expanded": open,
6014
- ref,
6082
+ ref: setButtonElement,
6015
6083
  selected: buttonProp.props.selected ?? open
6016
- }), [buttonProp, handleButtonClick, handleButtonKeyDown, handleMouseDown, id, open]);
6017
- useImperativeHandle(forwardedRef, () => ref.current), useEffect(() => {
6018
- if (button)
6019
- return setButtonElement(ref.current), () => setButtonElement(null);
6020
- }, [button]);
6021
- const popoverProps = useMemo(() => ({
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 = {
6022
6092
  boundaryElement: deprecated_boundaryElement,
6023
6093
  overflow: "auto",
6024
6094
  placement: deprecated_placement,
@@ -6026,9 +6096,13 @@ const MenuButton = forwardRef(function(props, forwardedRef) {
6026
6096
  preventOverflow: deprecated_preventOverflow,
6027
6097
  radius: deprecated_popoverRadius,
6028
6098
  scheme: deprecated_popoverScheme,
6029
- ...popover || {}
6030
- }), [deprecated_boundaryElement, deprecated_placement, deprecated_popoverRadius, deprecated_popoverScheme, deprecated_portal, deprecated_preventOverflow, popover]);
6031
- return /* @__PURE__ */ jsx(Popover, { "data-ui": "MenuButton__popover", ...popoverProps, content: menu, open, children: button || /* @__PURE__ */ jsx(Fragment, {}) });
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;
6032
6106
  });
6033
6107
  MenuButton.displayName = "ForwardRef(MenuButton)";
6034
6108
  const MenuDivider = styled.hr`
@@ -6512,9 +6586,6 @@ const CustomButton = styled(Button)`
6512
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;
6513
6587
  });
6514
6588
  Tab.displayName = "ForwardRef(Tab)";
6515
- function _isReactElement(node) {
6516
- return !!node;
6517
- }
6518
6589
  const CustomInline = styled(Inline)`
6519
6590
  & > div {
6520
6591
  display: inline-block;
@@ -6523,19 +6594,32 @@ const CustomInline = styled(Inline)`
6523
6594
  box-sizing: border-box;
6524
6595
  }
6525
6596
  `, TabList = forwardRef(function(props, ref) {
6526
- const {
6597
+ const $ = c(15);
6598
+ let childrenProp, restProps;
6599
+ $[0] !== props ? ({
6527
6600
  children: childrenProp,
6528
6601
  ...restProps
6529
- } = props, [focusedIndex, setFocusedIndex] = useState(-1), tabs = useMemo(() => childrenProp.filter(_isReactElement), [childrenProp]).map((child, childIndex) => cloneElement(child, {
6530
- focused: focusedIndex === childIndex,
6531
- key: childIndex,
6532
- onFocus: () => handleTabFocus(childIndex)
6533
- })), numTabs = tabs.length, handleTabFocus = useCallback((tabIdx) => {
6534
- setFocusedIndex(tabIdx);
6535
- }, []), handleKeyDown = useCallback((event) => {
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) => {
6536
6618
  event.key === "ArrowLeft" && setFocusedIndex((prevIndex) => (prevIndex + numTabs - 1) % numTabs), event.key === "ArrowRight" && setFocusedIndex((prevIndex_0) => (prevIndex_0 + 1) % numTabs);
6537
- }, [numTabs]);
6538
- return /* @__PURE__ */ jsx(CustomInline, { "data-ui": "TabList", ...restProps, onKeyDown: handleKeyDown, ref, role: "tablist", children: tabs });
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;
6539
6623
  });
6540
6624
  TabList.displayName = "ForwardRef(TabList)";
6541
6625
  const TabPanel = forwardRef(function(props, ref) {
@@ -6656,7 +6740,12 @@ function _temp() {
6656
6740
  return !0;
6657
6741
  }
6658
6742
  const subscribe = () => () => {
6659
- }, ToastContext = createGlobalScopedContext("@sanity/ui/context/toast", null), Root$1 = styled(Layer)`
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)`
6660
6749
  position: fixed;
6661
6750
  top: 0;
6662
6751
  left: 0;
@@ -6671,31 +6760,44 @@ const subscribe = () => () => {
6671
6760
  max-width: 420px;
6672
6761
  width: 100%;
6673
6762
  `;
6674
- let toastId = 0;
6675
6763
  function ToastProvider(props) {
6676
- const {
6764
+ const $ = c(24), {
6677
6765
  children,
6678
- padding = 4,
6766
+ padding: t0,
6679
6767
  paddingX,
6680
6768
  paddingY,
6681
6769
  zOffset
6682
- } = props, [state, _setState] = useState([]), toastsRef = useRef({}), mounted = useMounted(), prefersReducedMotion = usePrefersReducedMotion(), variants = useMemo(() => ({
6683
- initial: {
6684
- opacity: 0,
6685
- [POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: 0,
6686
- y: 32,
6687
- scale: 0.25,
6688
- willChange: "transform"
6689
- },
6690
- animate: {
6691
- opacity: [0, 1, 1],
6692
- [POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: [0, 0, 1],
6693
- y: 0,
6694
- scale: 1
6695
- },
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,
6696
6798
  exit: {
6697
- opacity: [1, 1, 0],
6698
- [POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: [1, 0, 0],
6799
+ opacity: t7,
6800
+ [POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: t8,
6699
6801
  scale: 0.5,
6700
6802
  transition: prefersReducedMotion ? {
6701
6803
  duration: 0
@@ -6703,10 +6805,13 @@ function ToastProvider(props) {
6703
6805
  duration: 0.2
6704
6806
  }
6705
6807
  }
6706
- }), [prefersReducedMotion]), value = useMemo(() => ({
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 = {
6707
6812
  version: 0,
6708
6813
  push: (params) => {
6709
- const setState = (state_0) => startTransition(() => _setState(state_0)), id = params.id || String(toastId++), duration = params.duration || 5e3, dismiss = () => {
6814
+ const setState = (state_0) => startTransition(() => _setState(state_0)), id = params.id || generateToastId(), duration = params.duration || 5e3, dismiss = () => {
6710
6815
  const timeoutId = toastsRef.current[id]?.timeoutId;
6711
6816
  setState((prevState) => {
6712
6817
  const idx = prevState.findIndex((t) => t.id === id);
@@ -6728,27 +6833,36 @@ function ToastProvider(props) {
6728
6833
  timeoutId: setTimeout(dismiss, duration)
6729
6834
  }, id;
6730
6835
  }
6731
- }), []);
6732
- return useEffect(() => () => {
6836
+ }, $[9] = t11) : t11 = $[9], t10 = t11;
6837
+ const value = t10;
6838
+ let t12, t13;
6839
+ $[10] === Symbol.for("react.memo_cache_sentinel") ? (t12 = () => () => {
6733
6840
  for (const {
6734
6841
  timeoutId: timeoutId_0
6735
6842
  } of Object.values(toastsRef.current))
6736
6843
  clearTimeout(timeoutId_0);
6737
6844
  toastsRef.current = {};
6738
- }, []), /* @__PURE__ */ jsxs(ToastContext.Provider, { value, children: [
6739
- children,
6740
- 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(({
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 {
6741
6849
  dismiss: dismiss_0,
6742
6850
  id: id_0,
6743
6851
  params: params_0
6744
- }) => /* @__PURE__ */ jsx(motion.div, { layout: "position", initial: "initial", animate: "animate", exit: "exit", variants, transition: prefersReducedMotion ? {
6852
+ } = t152;
6853
+ return /* @__PURE__ */ jsx(motion.div, { layout: "position", initial: "initial", animate: "animate", exit: "exit", variants, transition: prefersReducedMotion ? {
6745
6854
  duration: 0
6746
6855
  } : {
6747
6856
  type: "spring",
6748
6857
  damping: 30,
6749
6858
  stiffness: 400
6750
- }, 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)) }) }) }) })
6751
- ] });
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;
6752
6866
  }
6753
6867
  ToastProvider.displayName = "ToastProvider";
6754
6868
  function useToast() {
@@ -7085,61 +7199,117 @@ const TreeGroup = memo(function(props) {
7085
7199
  transition: transform 100ms;
7086
7200
  }
7087
7201
  `, TreeItem = memo(function(props) {
7088
- 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 ? ({
7089
7205
  children,
7090
- expanded: expandedProp = !1,
7091
- fontSize: fontSize2 = 1,
7206
+ expanded: t0,
7207
+ fontSize: t1,
7092
7208
  href,
7093
7209
  icon: IconComponent,
7094
7210
  id: idProp,
7095
7211
  linkAs,
7096
7212
  muted,
7097
7213
  onClick,
7098
- padding = 2,
7099
- selected = !1,
7100
- space = 2,
7214
+ padding: t2,
7215
+ selected: t3,
7216
+ space: t4,
7101
7217
  text,
7102
7218
  weight,
7103
7219
  ...restProps
7104
- } = props, [rootElement, setRootElement] = useState(null), treeitemRef = useRef(null), tree = useTree(), {
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(), {
7105
7222
  path,
7106
7223
  registerItem,
7107
7224
  setExpanded,
7108
7225
  setFocusedElement
7109
- } = tree, _id = useId(), id = idProp || _id, itemPath = useMemo(() => path.concat([id || ""]), [id, path]), itemKey = itemPath.join("/"), 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, contextValue = useMemo(() => ({
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 = {
7110
7240
  ...tree,
7111
- level: tree.level + 1,
7241
+ level: t10,
7112
7242
  path: itemPath
7113
- }), [itemPath, tree]), handleClick = useCallback((event) => {
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) => {
7114
7247
  onClick && onClick(event);
7115
7248
  const target = event.target;
7116
7249
  target instanceof HTMLElement && (target.getAttribute("data-ui") === "TreeItem" || target.closest('[data-ui="TreeItem__box"]')) && (event.stopPropagation(), setExpanded(itemKey, !expanded), setFocusedElement(rootElement));
7117
- }, [expanded, itemKey, onClick, rootElement, setExpanded, setFocusedElement]), handleKeyDown = useCallback((event_0) => {
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) => {
7118
7254
  focused && event_0.key === "Enter" && (treeitemRef.current || rootElement)?.click();
7119
- }, [focused, rootElement]);
7120
- useEffect(() => {
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 = () => {
7121
7259
  if (rootElement)
7122
7260
  return registerItem(rootElement, itemPath.join("/"), expanded, selected);
7123
- }, [expanded, itemPath, registerItem, rootElement, selected]);
7124
- const content = /* @__PURE__ */ jsxs(Flex, { padding, children: [
7125
- /* @__PURE__ */ jsxs(Box, { marginRight: space, style: {
7126
- visibility: IconComponent || children ? "visible" : "hidden",
7127
- pointerEvents: "none"
7128
- }, children: [
7129
- IconComponent && /* @__PURE__ */ jsx(Text, { muted, size: fontSize2, weight, children: /* @__PURE__ */ jsx(IconComponent, {}) }),
7130
- !IconComponent && /* @__PURE__ */ jsx(ToggleArrowText, { muted, size: fontSize2, weight, children: /* @__PURE__ */ jsx(ToggleArrowRightIcon, { style: {
7131
- transform: expanded ? "rotate(90deg)" : void 0
7132
- } }) })
7133
- ] }),
7134
- /* @__PURE__ */ jsx(Box, { flex: 1, children: /* @__PURE__ */ jsx(Text, { muted, size: fontSize2, textOverflow: "ellipsis", weight, children: text }) })
7135
- ] });
7136
- return href ? /* @__PURE__ */ jsxs(Root, { "data-selected": selected ? "" : void 0, "data-tree-id": id, "data-tree-key": itemKey, "data-ui": "TreeItem", ...restProps, onClick: handleClick, ref: setRootElement, role: "none", children: [
7137
- /* @__PURE__ */ jsx(TreeItemBox, { $level: tree.level, "aria-expanded": expanded, as: linkAs, "data-ui": "TreeItem__box", href, ref: treeitemRef, role: "treeitem", tabIndex, children: content }),
7138
- /* @__PURE__ */ jsx(TreeContext.Provider, { value: contextValue, children: children && /* @__PURE__ */ jsx(TreeGroup, { hidden: !expanded, children }) })
7139
- ] }) : /* @__PURE__ */ jsxs(Root, { "data-selected": selected ? "" : void 0, "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: [
7140
- /* @__PURE__ */ jsx(TreeItemBox, { $level: tree.level, as: "div", "data-ui": "TreeItem__box", children: content }),
7141
- /* @__PURE__ */ jsx(TreeContext.Provider, { value: contextValue, children: children && /* @__PURE__ */ jsx(TreeGroup, { expanded, children }) })
7142
- ] });
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;
7143
7313
  });
7144
7314
  TreeItem.displayName = "Memo(TreeItem)";
7145
7315
  export {