@sanity/ui 2.8.20 → 2.8.22

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.js CHANGED
@@ -148,13 +148,11 @@ function responsiveTextFont(props) {
148
148
  return responsiveFont("text", props);
149
149
  }
150
150
  function useArrayProp(val, defaultVal) {
151
- const __perf_hash__ = react.useMemo(() => JSON.stringify(val ?? defaultVal), [defaultVal, val]);
152
- return react.useMemo(
153
- () => _getArrayProp(val, defaultVal),
154
- // Improve performance: Keep object identify for a given hash of the value
155
- // eslint-disable-next-line react-hooks/exhaustive-deps
156
- [__perf_hash__]
157
- );
151
+ const $ = reactCompilerRuntime.c(3);
152
+ let t0;
153
+ $[0] !== val || $[1] !== defaultVal ? (t0 = () => [_getArrayProp(val, defaultVal), JSON.stringify(val ?? defaultVal)], $[0] = val, $[1] = defaultVal, $[2] = t0) : t0 = $[2];
154
+ const [t1, setCache] = react.useState(t0), [cachedVal, cachedHash] = t1, hash = JSON.stringify(val ?? defaultVal);
155
+ return hash !== cachedHash && setCache([_getArrayProp(val, defaultVal), hash]), cachedVal;
158
156
  }
159
157
  function _getElements(element, elementsArg) {
160
158
  const ret = [element];
@@ -1780,19 +1778,26 @@ function responsiveAvatarStackSizeStyle(props) {
1780
1778
  });
1781
1779
  }
1782
1780
  const Root$z = styledComponents.styled.div(responsiveAvatarStackSizeStyle, avatarStackStyle), AvatarStack = react.forwardRef(function(props, ref) {
1783
- const {
1781
+ const $ = reactCompilerRuntime.c(15);
1782
+ let t0, t1, childrenProp, restProps;
1783
+ $[0] !== props ? ({
1784
1784
  children: childrenProp,
1785
- maxLength: maxLengthProp = 4,
1786
- size: sizeProp = 1,
1785
+ maxLength: t0,
1786
+ size: t1,
1787
1787
  ...restProps
1788
- } = props, children = react.useMemo(() => react.Children.toArray(childrenProp).filter(react.isValidElement), [childrenProp]), maxLength = Math.max(maxLengthProp, 0), size2 = useArrayProp(sizeProp), len = children.length, visibleCount = maxLength - 1, extraCount = len - visibleCount, visibleChildren = extraCount > 1 ? children.slice(extraCount, len) : children;
1789
- return /* @__PURE__ */ jsxRuntime.jsxs(Root$z, { "data-ui": "AvatarStack", ...restProps, ref, $size: size2, children: [
1790
- len === 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(AvatarCounter, { count: len, size: size2 }) }),
1791
- len !== 0 && extraCount > 1 && /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(AvatarCounter, { count: extraCount, size: size2 }) }),
1792
- visibleChildren.map((child, childIndex) => /* @__PURE__ */ jsxRuntime.jsx("div", { children: react.cloneElement(child, {
1793
- size: size2
1794
- }) }, String(childIndex)))
1795
- ] });
1788
+ } = props, $[0] = props, $[1] = t0, $[2] = t1, $[3] = childrenProp, $[4] = restProps) : (t0 = $[1], t1 = $[2], childrenProp = $[3], restProps = $[4]);
1789
+ const maxLengthProp = t0 === void 0 ? 4 : t0, sizeProp = t1 === void 0 ? 1 : t1, children = react.Children.toArray(childrenProp).filter(react.isValidElement), maxLength = Math.max(maxLengthProp, 0), size2 = useArrayProp(sizeProp), len = children.length, visibleCount = maxLength - 1, extraCount = len - visibleCount, visibleChildren = extraCount > 1 ? children.slice(extraCount, len) : children, T0 = Root$z, t2 = "AvatarStack", t3 = len === 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(AvatarCounter, { count: len, size: size2 }) }), t4 = len !== 0 && extraCount > 1 && /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(AvatarCounter, { count: extraCount, size: size2 }) });
1790
+ let t5;
1791
+ $[5] !== size2 ? (t5 = (child, childIndex) => /* @__PURE__ */ jsxRuntime.jsx("div", { children: react.cloneElement(child, {
1792
+ size: size2
1793
+ }) }, String(childIndex)), $[5] = size2, $[6] = t5) : t5 = $[6];
1794
+ const t6 = visibleChildren.map(t5);
1795
+ let t7;
1796
+ return $[7] !== T0 || $[8] !== restProps || $[9] !== ref || $[10] !== size2 || $[11] !== t3 || $[12] !== t4 || $[13] !== t6 ? (t7 = /* @__PURE__ */ jsxRuntime.jsxs(T0, { "data-ui": t2, ...restProps, ref, $size: size2, children: [
1797
+ t3,
1798
+ t4,
1799
+ t6
1800
+ ] }), $[7] = T0, $[8] = restProps, $[9] = ref, $[10] = size2, $[11] = t3, $[12] = t4, $[13] = t6, $[14] = t7) : t7 = $[14], t7;
1796
1801
  });
1797
1802
  AvatarStack.displayName = "ForwardRef(AvatarStack)";
1798
1803
  const Root$y = styledComponents.styled.div(boxStyle, flexItemStyle, responsiveBoxStyle, responsiveGridItemStyle, responsiveMarginStyle, responsivePaddingStyle), Box = react.forwardRef(function(props, ref) {
@@ -3211,16 +3216,37 @@ function findMinBreakpoints(media, width) {
3211
3216
  return ret;
3212
3217
  }
3213
3218
  const ElementQuery = react.forwardRef(function(props, forwardedRef) {
3214
- const theme2 = useTheme_v2(), {
3219
+ const $ = reactCompilerRuntime.c(18), theme2 = useTheme_v2();
3220
+ let _media, restProps, children;
3221
+ $[0] !== props ? ({
3215
3222
  children,
3216
- media = theme2.media,
3223
+ media: _media,
3217
3224
  ...restProps
3218
- } = props, ref = react.useRef(null), [element, setElement] = react.useState(null), elementSize = useElementSize(element), width = react.useMemo(() => elementSize?.border.width ?? window.innerWidth, [elementSize]), max = react.useMemo(() => findMaxBreakpoints(media, width), [media, width]), min = react.useMemo(() => findMinBreakpoints(media, width), [media, width]);
3219
- react.useImperativeHandle(forwardedRef, () => ref.current);
3220
- const setRef = react.useCallback((el) => {
3221
- ref.current = el, setElement(el);
3222
- }, []);
3223
- return /* @__PURE__ */ jsxRuntime.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 });
3225
+ } = props, $[0] = props, $[1] = _media, $[2] = restProps, $[3] = children) : (_media = $[1], restProps = $[2], children = $[3]);
3226
+ const media = _media ?? theme2.media, [element, setElement] = react.useState(null), elementSize = useElementSize(element);
3227
+ let t0;
3228
+ t0 = elementSize?.border.width ?? window.innerWidth;
3229
+ const width = t0;
3230
+ let t1, t2;
3231
+ if ($[4] !== media || $[5] !== width) {
3232
+ const eq = findMaxBreakpoints(media, width);
3233
+ t2 = eq.length ? eq.join(" ") : void 0, $[4] = media, $[5] = width, $[6] = t2;
3234
+ } else
3235
+ t2 = $[6];
3236
+ t1 = t2;
3237
+ const max = t1;
3238
+ let t3, t4;
3239
+ if ($[7] !== media || $[8] !== width) {
3240
+ const eq_0 = findMinBreakpoints(media, width);
3241
+ t4 = eq_0.length ? eq_0.join(" ") : void 0, $[7] = media, $[8] = width, $[9] = t4;
3242
+ } else
3243
+ t4 = $[9];
3244
+ t3 = t4;
3245
+ const min = t3;
3246
+ let t5, t6;
3247
+ $[10] !== element ? (t5 = () => element, t6 = [element], $[10] = element, $[11] = t5, $[12] = t6) : (t5 = $[11], t6 = $[12]), react.useImperativeHandle(forwardedRef, t5, t6);
3248
+ let t7;
3249
+ 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;
3224
3250
  });
3225
3251
  ElementQuery.displayName = "ForwardRef(ElementQuery)";
3226
3252
  class ErrorBoundary extends react.Component {
@@ -3347,10 +3373,18 @@ function _isScrollable(el) {
3347
3373
  return style.overflowX.includes("auto") || style.overflowX.includes("scroll") || style.overflowY.includes("auto") || style.overflowY.includes("scroll");
3348
3374
  }
3349
3375
  function LayerProvider(props) {
3350
- const {
3376
+ const $ = reactCompilerRuntime.c(19), {
3351
3377
  children,
3352
- zOffset: zOffsetProp = 0
3353
- } = props, parentContextValue = react.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] = react.useState({}), [size2, setSize] = react.useState(0), isTopLayer = size2 === 0, registerChild = react.useCallback((childLevel) => {
3378
+ zOffset: t0
3379
+ } = props, zOffsetProp = t0 === void 0 ? 0 : t0, parentContextValue = react.useContext(LayerContext);
3380
+ let t1;
3381
+ $[0] !== parentContextValue ? (t1 = parentContextValue && getLayerContext(parentContextValue), $[0] = parentContextValue, $[1] = t1) : t1 = $[1];
3382
+ 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];
3383
+ let t2;
3384
+ $[2] === Symbol.for("react.memo_cache_sentinel") ? (t2 = {}, $[2] = t2) : t2 = $[2];
3385
+ const [, setChildLayers] = react.useState(t2), [size2, setSize] = react.useState(0), isTopLayer = size2 === 0;
3386
+ let t3;
3387
+ $[3] !== parentRegisterChild || $[4] !== setChildLayers ? (t3 = (childLevel) => {
3354
3388
  const parentDispose = parentRegisterChild?.(childLevel);
3355
3389
  return childLevel !== void 0 ? setChildLayers((state) => {
3356
3390
  const prevLen = state[childLevel] ?? 0, nextState = {
@@ -3363,20 +3397,25 @@ function LayerProvider(props) {
3363
3397
  const nextState_0 = {
3364
3398
  ...state_0
3365
3399
  };
3366
- return nextState_0[childLevel] === 1 ? (delete nextState_0[childLevel], setSize(Object.keys(nextState_0).length)) : nextState_0[childLevel] -= 1, nextState_0;
3400
+ return nextState_0[childLevel] === 1 ? (delete nextState_0[childLevel], setSize(Object.keys(nextState_0).length)) : nextState_0[childLevel] = nextState_0[childLevel] - 1, nextState_0;
3367
3401
  }) : setSize((v_0) => v_0 - 1), parentDispose?.();
3368
3402
  };
3369
- }, [parentRegisterChild]);
3370
- react.useEffect(() => parentRegisterChild?.(level), [level, parentRegisterChild]);
3371
- const value = react.useMemo(() => ({
3403
+ }, $[3] = parentRegisterChild, $[4] = setChildLayers, $[5] = t3) : t3 = $[5];
3404
+ const registerChild = t3;
3405
+ let t4, t5;
3406
+ $[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);
3407
+ let t6, t7;
3408
+ $[10] !== isTopLayer || $[11] !== level || $[12] !== registerChild || $[13] !== size2 || $[14] !== zIndex ? (t7 = {
3372
3409
  version: 0,
3373
3410
  isTopLayer,
3374
3411
  level,
3375
3412
  registerChild,
3376
3413
  size: size2,
3377
3414
  zIndex
3378
- }), [isTopLayer, level, registerChild, size2, zIndex]);
3379
- return /* @__PURE__ */ jsxRuntime.jsx(LayerContext.Provider, { value, children });
3415
+ }, $[10] = isTopLayer, $[11] = level, $[12] = registerChild, $[13] = size2, $[14] = zIndex, $[15] = t7) : t7 = $[15], t6 = t7;
3416
+ const value = t6;
3417
+ let t8;
3418
+ return $[16] !== value || $[17] !== children ? (t8 = /* @__PURE__ */ jsxRuntime.jsx(LayerContext.Provider, { value, children }), $[16] = value, $[17] = children, $[18] = t8) : t8 = $[18], t8;
3380
3419
  }
3381
3420
  LayerProvider.displayName = "LayerProvider";
3382
3421
  const Root$j = styledComponents.styled.div({
@@ -5727,8 +5766,8 @@ const Root$5 = styledComponents.styled(Box)`
5727
5766
  });
5728
5767
  Menu.displayName = "ForwardRef(Menu)";
5729
5768
  const MenuButton = react.forwardRef(function(props, forwardedRef) {
5730
- const {
5731
- __unstable_disableRestoreFocusOnClose: disableRestoreFocusOnClose = !1,
5769
+ const $ = reactCompilerRuntime.c(62), {
5770
+ __unstable_disableRestoreFocusOnClose: t0,
5732
5771
  boundaryElement: deprecated_boundaryElement,
5733
5772
  button: buttonProp,
5734
5773
  id,
@@ -5737,23 +5776,38 @@ const MenuButton = react.forwardRef(function(props, forwardedRef) {
5737
5776
  onOpen,
5738
5777
  placement: deprecated_placement,
5739
5778
  popoverScheme: deprecated_popoverScheme,
5740
- portal: deprecated_portal = !0,
5779
+ portal: t1,
5741
5780
  popover,
5742
5781
  popoverRadius: deprecated_popoverRadius,
5743
5782
  preventOverflow: deprecated_preventOverflow
5744
- } = props, [open, setOpen] = react.useState(!1), [shouldFocus, setShouldFocus] = react.useState(null), [buttonElement, setButtonElement] = react.useState(null), [menuElements, setChildMenuElements] = react.useState([]), openRef = react.useRef(open);
5745
- react.useEffect(() => {
5783
+ } = 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);
5784
+ let t2;
5785
+ $[0] === Symbol.for("react.memo_cache_sentinel") ? (t2 = [], $[0] = t2) : t2 = $[0];
5786
+ const [menuElements, setChildMenuElements] = react.useState(t2), openRef = react.useRef(open);
5787
+ let t3, t4;
5788
+ $[1] !== onOpen || $[2] !== open ? (t3 = () => {
5746
5789
  onOpen && open && !openRef.current && onOpen();
5747
- }, [onOpen, open]), react.useEffect(() => {
5790
+ }, t4 = [onOpen, open], $[1] = onOpen, $[2] = open, $[3] = t3, $[4] = t4) : (t3 = $[3], t4 = $[4]), react.useEffect(t3, t4);
5791
+ let t5, t6;
5792
+ $[5] !== onClose || $[6] !== open ? (t5 = () => {
5748
5793
  onClose && !open && openRef.current && onClose();
5749
- }, [onClose, open]), react.useEffect(() => {
5794
+ }, t6 = [onClose, open], $[5] = onClose, $[6] = open, $[7] = t5, $[8] = t6) : (t5 = $[7], t6 = $[8]), react.useEffect(t5, t6);
5795
+ let t7, t8;
5796
+ $[9] !== open ? (t7 = () => {
5750
5797
  openRef.current = open;
5751
- }, [open]);
5752
- const handleButtonClick = react.useCallback(() => {
5798
+ }, t8 = [open], $[9] = open, $[10] = t7, $[11] = t8) : (t7 = $[10], t8 = $[11]), react.useEffect(t7, t8);
5799
+ let t9;
5800
+ $[12] === Symbol.for("react.memo_cache_sentinel") ? (t9 = () => {
5753
5801
  setOpen((v) => !v), setShouldFocus(null);
5754
- }, []), handleMouseDown = react.useCallback((event) => {
5802
+ }, $[12] = t9) : t9 = $[12];
5803
+ const handleButtonClick = t9;
5804
+ let t10;
5805
+ $[13] !== open ? (t10 = (event) => {
5755
5806
  open && event.preventDefault();
5756
- }, [open]), handleButtonKeyDown = react.useCallback((event_0) => {
5807
+ }, $[13] = open, $[14] = t10) : t10 = $[14];
5808
+ const handleMouseDown = t10;
5809
+ let t11;
5810
+ $[15] === Symbol.for("react.memo_cache_sentinel") ? (t11 = (event_0) => {
5757
5811
  if (event_0.key === "ArrowDown" || event_0.key === "Enter" || event_0.key === " ") {
5758
5812
  event_0.preventDefault(), setOpen(!0), setShouldFocus("first");
5759
5813
  return;
@@ -5762,7 +5816,10 @@ const MenuButton = react.forwardRef(function(props, forwardedRef) {
5762
5816
  event_0.preventDefault(), setOpen(!0), setShouldFocus("last");
5763
5817
  return;
5764
5818
  }
5765
- }, []), handleMenuClickOutside = react.useCallback((event_1) => {
5819
+ }, $[15] = t11) : t11 = $[15];
5820
+ const handleButtonKeyDown = t11;
5821
+ let t12;
5822
+ $[16] !== buttonElement || $[17] !== menuElements ? (t12 = (event_1) => {
5766
5823
  const target = event_1.target;
5767
5824
  if (target instanceof Node && !(buttonElement && (target === buttonElement || buttonElement.contains(target)))) {
5768
5825
  for (const el of menuElements)
@@ -5770,9 +5827,15 @@ const MenuButton = react.forwardRef(function(props, forwardedRef) {
5770
5827
  return;
5771
5828
  setOpen(!1);
5772
5829
  }
5773
- }, [buttonElement, menuElements]), handleMenuEscape = react.useCallback(() => {
5830
+ }, $[16] = buttonElement, $[17] = menuElements, $[18] = t12) : t12 = $[18];
5831
+ const handleMenuClickOutside = t12;
5832
+ let t13;
5833
+ $[19] !== disableRestoreFocusOnClose || $[20] !== buttonElement ? (t13 = () => {
5774
5834
  setOpen(!1), !disableRestoreFocusOnClose && buttonElement && buttonElement.focus();
5775
- }, [buttonElement, disableRestoreFocusOnClose]), handleBlur = react.useCallback((event_2) => {
5835
+ }, $[19] = disableRestoreFocusOnClose, $[20] = buttonElement, $[21] = t13) : t13 = $[21];
5836
+ const handleMenuEscape = t13;
5837
+ let t14;
5838
+ $[22] !== menuElements ? (t14 = (event_2) => {
5776
5839
  const target_0 = event_2.relatedTarget;
5777
5840
  if (target_0 instanceof Node) {
5778
5841
  for (const el_0 of menuElements)
@@ -5780,9 +5843,18 @@ const MenuButton = react.forwardRef(function(props, forwardedRef) {
5780
5843
  return;
5781
5844
  setOpen(!1);
5782
5845
  }
5783
- }, [menuElements]), handleItemClick = react.useCallback(() => {
5846
+ }, $[22] = menuElements, $[23] = t14) : t14 = $[23];
5847
+ const handleBlur = t14;
5848
+ let t15;
5849
+ $[24] !== disableRestoreFocusOnClose || $[25] !== buttonElement ? (t15 = () => {
5784
5850
  setOpen(!1), !disableRestoreFocusOnClose && buttonElement && buttonElement.focus();
5785
- }, [buttonElement, disableRestoreFocusOnClose]), registerElement = react.useCallback((el_1) => (setChildMenuElements((els) => els.concat([el_1])), () => setChildMenuElements((els_0) => els_0.filter((_el) => _el !== el_1))), []), menuProps = react.useMemo(() => ({
5851
+ }, $[24] = disableRestoreFocusOnClose, $[25] = buttonElement, $[26] = t15) : t15 = $[26];
5852
+ const handleItemClick = t15;
5853
+ let t16;
5854
+ $[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];
5855
+ const registerElement = t16;
5856
+ let t17;
5857
+ $[28] !== id || $[29] !== handleBlur || $[30] !== handleMenuClickOutside || $[31] !== handleMenuEscape || $[32] !== handleItemClick || $[33] !== buttonElement || $[34] !== shouldFocus || $[35] !== menuProp ? (t17 = menuProp && react.cloneElement(menuProp, {
5786
5858
  "aria-labelledby": id,
5787
5859
  onBlurCapture: handleBlur,
5788
5860
  onClickOutside: handleMenuClickOutside,
@@ -5791,7 +5863,10 @@ const MenuButton = react.forwardRef(function(props, forwardedRef) {
5791
5863
  originElement: buttonElement,
5792
5864
  registerElement,
5793
5865
  shouldFocus
5794
- }), [buttonElement, handleMenuClickOutside, handleMenuEscape, handleItemClick, id, handleBlur, registerElement, shouldFocus]), menu = menuProp && react.cloneElement(menuProp, menuProps), ref = react.useRef(null), button = react.useMemo(() => buttonProp && react.cloneElement(buttonProp, {
5866
+ }), $[28] = id, $[29] = handleBlur, $[30] = handleMenuClickOutside, $[31] = handleMenuEscape, $[32] = handleItemClick, $[33] = buttonElement, $[34] = shouldFocus, $[35] = menuProp, $[36] = t17) : t17 = $[36];
5867
+ const menu = t17;
5868
+ let t18, t19;
5869
+ $[37] !== buttonProp || $[38] !== open || $[39] !== id || $[40] !== handleMouseDown ? (t19 = buttonProp && react.cloneElement(buttonProp, {
5795
5870
  "data-ui": "MenuButton",
5796
5871
  id,
5797
5872
  onClick: handleButtonClick,
@@ -5799,14 +5874,16 @@ const MenuButton = react.forwardRef(function(props, forwardedRef) {
5799
5874
  onMouseDown: handleMouseDown,
5800
5875
  "aria-haspopup": !0,
5801
5876
  "aria-expanded": open,
5802
- ref,
5877
+ ref: setButtonElement,
5803
5878
  selected: buttonProp.props.selected ?? open
5804
- }), [buttonProp, handleButtonClick, handleButtonKeyDown, handleMouseDown, id, open]);
5805
- react.useImperativeHandle(forwardedRef, () => ref.current), react.useEffect(() => {
5806
- if (button)
5807
- return setButtonElement(ref.current), () => setButtonElement(null);
5808
- }, [button]);
5809
- const popoverProps = react.useMemo(() => ({
5879
+ }), $[37] = buttonProp, $[38] = open, $[39] = id, $[40] = handleMouseDown, $[41] = t19) : t19 = $[41], t18 = t19;
5880
+ const button = t18;
5881
+ let t20, t21;
5882
+ $[42] !== buttonElement ? (t20 = () => buttonElement, t21 = [buttonElement], $[42] = buttonElement, $[43] = t20, $[44] = t21) : (t20 = $[43], t21 = $[44]), react.useImperativeHandle(forwardedRef, t20, t21);
5883
+ let t22, t23;
5884
+ $[45] !== popover ? (t23 = popover || {}, $[45] = popover, $[46] = t23) : t23 = $[46];
5885
+ let t24;
5886
+ $[47] !== deprecated_boundaryElement || $[48] !== deprecated_placement || $[49] !== deprecated_portal || $[50] !== deprecated_preventOverflow || $[51] !== deprecated_popoverRadius || $[52] !== deprecated_popoverScheme || $[53] !== t23 ? (t24 = {
5810
5887
  boundaryElement: deprecated_boundaryElement,
5811
5888
  overflow: "auto",
5812
5889
  placement: deprecated_placement,
@@ -5814,9 +5891,13 @@ const MenuButton = react.forwardRef(function(props, forwardedRef) {
5814
5891
  preventOverflow: deprecated_preventOverflow,
5815
5892
  radius: deprecated_popoverRadius,
5816
5893
  scheme: deprecated_popoverScheme,
5817
- ...popover || {}
5818
- }), [deprecated_boundaryElement, deprecated_placement, deprecated_popoverRadius, deprecated_popoverScheme, deprecated_portal, deprecated_preventOverflow, popover]);
5819
- return /* @__PURE__ */ jsxRuntime.jsx(Popover, { "data-ui": "MenuButton__popover", ...popoverProps, content: menu, open, children: button || /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {}) });
5894
+ ...t23
5895
+ }, $[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;
5896
+ const popoverProps = t22;
5897
+ let t25;
5898
+ $[55] !== button ? (t25 = button || /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {}), $[55] = button, $[56] = t25) : t25 = $[56];
5899
+ let t26;
5900
+ 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;
5820
5901
  });
5821
5902
  MenuButton.displayName = "ForwardRef(MenuButton)";
5822
5903
  const MenuDivider = styledComponents.styled.hr`
@@ -6454,7 +6535,12 @@ function _temp() {
6454
6535
  return !0;
6455
6536
  }
6456
6537
  const subscribe = () => () => {
6457
- }, ToastContext = createGlobalScopedContext("@sanity/ui/context/toast", null), Root$1 = styledComponents.styled(Layer)`
6538
+ }, ToastContext = createGlobalScopedContext("@sanity/ui/context/toast", null);
6539
+ let toastId = 0;
6540
+ function generateToastId() {
6541
+ return String(toastId++);
6542
+ }
6543
+ const Root$1 = styledComponents.styled(Layer)`
6458
6544
  position: fixed;
6459
6545
  top: 0;
6460
6546
  left: 0;
@@ -6469,31 +6555,44 @@ const subscribe = () => () => {
6469
6555
  max-width: 420px;
6470
6556
  width: 100%;
6471
6557
  `;
6472
- let toastId = 0;
6473
6558
  function ToastProvider(props) {
6474
- const {
6559
+ const $ = reactCompilerRuntime.c(24), {
6475
6560
  children,
6476
- padding = 4,
6561
+ padding: t0,
6477
6562
  paddingX,
6478
6563
  paddingY,
6479
6564
  zOffset
6480
- } = props, [state, _setState] = react.useState([]), toastsRef = react.useRef({}), mounted = useMounted(), prefersReducedMotion = usePrefersReducedMotion(), variants = react.useMemo(() => ({
6481
- initial: {
6482
- opacity: 0,
6483
- [POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: 0,
6484
- y: 32,
6485
- scale: 0.25,
6486
- willChange: "transform"
6487
- },
6488
- animate: {
6489
- opacity: [0, 1, 1],
6490
- [POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: [0, 0, 1],
6491
- y: 0,
6492
- scale: 1
6493
- },
6565
+ } = props, padding = t0 === void 0 ? 4 : t0;
6566
+ let t1;
6567
+ $[0] === Symbol.for("react.memo_cache_sentinel") ? (t1 = [], $[0] = t1) : t1 = $[0];
6568
+ const [state, _setState] = react.useState(t1);
6569
+ let t2;
6570
+ $[1] === Symbol.for("react.memo_cache_sentinel") ? (t2 = {}, $[1] = t2) : t2 = $[1];
6571
+ const toastsRef = react.useRef(t2), mounted = useMounted(), prefersReducedMotion = usePrefersReducedMotion();
6572
+ let t3, t4, t5;
6573
+ $[2] === Symbol.for("react.memo_cache_sentinel") ? (t4 = {
6574
+ opacity: 0,
6575
+ [POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: 0,
6576
+ y: 32,
6577
+ scale: 0.25,
6578
+ willChange: "transform"
6579
+ }, t5 = [0, 1, 1], $[2] = t4, $[3] = t5) : (t4 = $[2], t5 = $[3]);
6580
+ let t6, t7;
6581
+ $[4] === Symbol.for("react.memo_cache_sentinel") ? (t6 = {
6582
+ opacity: t5,
6583
+ [POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: [0, 0, 1],
6584
+ y: 0,
6585
+ scale: 1
6586
+ }, t7 = [1, 1, 0], $[4] = t6, $[5] = t7) : (t6 = $[4], t7 = $[5]);
6587
+ let t8;
6588
+ $[6] === Symbol.for("react.memo_cache_sentinel") ? (t8 = [1, 0, 0], $[6] = t8) : t8 = $[6];
6589
+ let t9;
6590
+ $[7] !== prefersReducedMotion ? (t9 = {
6591
+ initial: t4,
6592
+ animate: t6,
6494
6593
  exit: {
6495
- opacity: [1, 1, 0],
6496
- [POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: [1, 0, 0],
6594
+ opacity: t7,
6595
+ [POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: t8,
6497
6596
  scale: 0.5,
6498
6597
  transition: prefersReducedMotion ? {
6499
6598
  duration: 0
@@ -6501,10 +6600,13 @@ function ToastProvider(props) {
6501
6600
  duration: 0.2
6502
6601
  }
6503
6602
  }
6504
- }), [prefersReducedMotion]), value = react.useMemo(() => ({
6603
+ }, $[7] = prefersReducedMotion, $[8] = t9) : t9 = $[8], t3 = t9;
6604
+ const variants = t3;
6605
+ let t10, t11;
6606
+ $[9] === Symbol.for("react.memo_cache_sentinel") ? (t11 = {
6505
6607
  version: 0,
6506
6608
  push: (params) => {
6507
- const setState = (state_0) => react.startTransition(() => _setState(state_0)), id = params.id || String(toastId++), duration = params.duration || 5e3, dismiss = () => {
6609
+ const setState = (state_0) => react.startTransition(() => _setState(state_0)), id = params.id || generateToastId(), duration = params.duration || 5e3, dismiss = () => {
6508
6610
  const timeoutId = toastsRef.current[id]?.timeoutId;
6509
6611
  setState((prevState) => {
6510
6612
  const idx = prevState.findIndex((t) => t.id === id);
@@ -6526,27 +6628,36 @@ function ToastProvider(props) {
6526
6628
  timeoutId: setTimeout(dismiss, duration)
6527
6629
  }, id;
6528
6630
  }
6529
- }), []);
6530
- return react.useEffect(() => () => {
6631
+ }, $[9] = t11) : t11 = $[9], t10 = t11;
6632
+ const value = t10;
6633
+ let t12, t13;
6634
+ $[10] === Symbol.for("react.memo_cache_sentinel") ? (t12 = () => () => {
6531
6635
  for (const {
6532
6636
  timeoutId: timeoutId_0
6533
6637
  } of Object.values(toastsRef.current))
6534
6638
  clearTimeout(timeoutId_0);
6535
6639
  toastsRef.current = {};
6536
- }, []), /* @__PURE__ */ jsxRuntime.jsxs(ToastContext.Provider, { value, children: [
6537
- children,
6538
- 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(({
6640
+ }, t13 = [], $[10] = t12, $[11] = t13) : (t12 = $[10], t13 = $[11]), react.useEffect(t12, t13);
6641
+ let t14;
6642
+ $[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) => {
6643
+ const {
6539
6644
  dismiss: dismiss_0,
6540
6645
  id: id_0,
6541
6646
  params: params_0
6542
- }) => /* @__PURE__ */ jsxRuntime.jsx(framerMotion.motion.div, { layout: "position", initial: "initial", animate: "animate", exit: "exit", variants, transition: prefersReducedMotion ? {
6647
+ } = t152;
6648
+ return /* @__PURE__ */ jsxRuntime.jsx(framerMotion.motion.div, { layout: "position", initial: "initial", animate: "animate", exit: "exit", variants, transition: prefersReducedMotion ? {
6543
6649
  duration: 0
6544
6650
  } : {
6545
6651
  type: "spring",
6546
6652
  damping: 30,
6547
6653
  stiffness: 400
6548
- }, 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)) }) }) }) })
6549
- ] });
6654
+ }, 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);
6655
+ }) }) }) }) }), $[12] = mounted, $[13] = variants, $[14] = prefersReducedMotion, $[15] = state, $[16] = padding, $[17] = paddingX, $[18] = paddingY, $[19] = zOffset, $[20] = t14) : t14 = $[20];
6656
+ let t15;
6657
+ return $[21] !== children || $[22] !== t14 ? (t15 = /* @__PURE__ */ jsxRuntime.jsxs(ToastContext.Provider, { value, children: [
6658
+ children,
6659
+ t14
6660
+ ] }), $[21] = children, $[22] = t14, $[23] = t15) : t15 = $[23], t15;
6550
6661
  }
6551
6662
  ToastProvider.displayName = "ToastProvider";
6552
6663
  function useToast() {