@sanity/ui 2.11.4 → 2.11.6

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
@@ -160,13 +160,9 @@ function _getElements(element, elementsArg) {
160
160
  Array.isArray(el) ? ret.push(...el) : ret.push(el);
161
161
  return ret.filter(Boolean);
162
162
  }
163
- function useClickOutside(listener, t0, boundaryElement) {
164
- const $ = reactCompilerRuntime.c(12), elementsArg = t0 === void 0 ? EMPTY_ARRAY : t0, [element, setElement] = react.useState(null);
165
- let t1;
166
- $[0] !== element || $[1] !== elementsArg ? (t1 = () => _getElements(element, elementsArg), $[0] = element, $[1] = elementsArg, $[2] = t1) : t1 = $[2];
167
- const [elements, setElements] = react.useState(t1), elementsRef = react.useRef(elements);
168
- let t2, t3;
169
- $[3] !== element || $[4] !== elementsArg ? (t2 = () => {
163
+ function useClickOutside(listener, elementsArg = EMPTY_ARRAY, boundaryElement) {
164
+ const [element, setElement] = react.useState(null), [elements, setElements] = react.useState(() => _getElements(element, elementsArg)), elementsRef = react.useRef(elements);
165
+ return react.useEffect(() => {
170
166
  const prevElements = elementsRef.current, nextElements = _getElements(element, elementsArg);
171
167
  if (prevElements.length !== nextElements.length) {
172
168
  setElements(nextElements), elementsRef.current = nextElements;
@@ -182,11 +178,8 @@ function useClickOutside(listener, t0, boundaryElement) {
182
178
  setElements(nextElements), elementsRef.current = nextElements;
183
179
  return;
184
180
  }
185
- }, t3 = [element, elementsArg], $[3] = element, $[4] = elementsArg, $[5] = t2, $[6] = t3) : (t2 = $[5], t3 = $[6]), react.useEffect(t2, t3);
186
- let t4, t5;
187
- return $[7] !== boundaryElement || $[8] !== elements || $[9] !== listener ? (t4 = () => {
188
- if (!listener)
189
- return;
181
+ }, [element, elementsArg]), react.useEffect(() => {
182
+ if (!listener) return;
190
183
  const handleWindowMouseDown = (evt) => {
191
184
  const target = evt.target;
192
185
  if (target instanceof Node && !(boundaryElement && !boundaryElement.contains(target))) {
@@ -199,10 +192,10 @@ function useClickOutside(listener, t0, boundaryElement) {
199
192
  return window.addEventListener("mousedown", handleWindowMouseDown), () => {
200
193
  window.removeEventListener("mousedown", handleWindowMouseDown);
201
194
  };
202
- }, t5 = [boundaryElement, listener, elements], $[7] = boundaryElement, $[8] = elements, $[9] = listener, $[10] = t4, $[11] = t5) : (t4 = $[10], t5 = $[11]), react.useEffect(t4, t5), setElement;
195
+ }, [boundaryElement, listener, elements]), setElement;
203
196
  }
204
197
  function useClickOutsideEvent(listener, t0, boundaryElement) {
205
- const $ = reactCompilerRuntime.c(8), elementsArg = t0 === void 0 ? _temp$b : t0;
198
+ const $ = reactCompilerRuntime.c(8), elementsArg = t0 === void 0 ? _temp$a : t0;
206
199
  let t1;
207
200
  $[0] !== boundaryElement || $[1] !== elementsArg || $[2] !== listener ? (t1 = (evt) => {
208
201
  if (!listener)
@@ -230,7 +223,7 @@ function useClickOutsideEvent(listener, t0, boundaryElement) {
230
223
  };
231
224
  }, t3 = [hasListener, onEvent], $[4] = hasListener, $[5] = onEvent, $[6] = t2, $[7] = t3) : (t2 = $[6], t3 = $[7]), react.useEffect(t2, t3), react.useDebugValue(listener ? "MouseDown On" : "MouseDown Off");
232
225
  }
233
- function _temp$b() {
226
+ function _temp$a() {
234
227
  return EMPTY_ARRAY;
235
228
  }
236
229
  function useCustomValidity(ref, customValidity) {
@@ -743,15 +736,15 @@ function useMediaIndex() {
743
736
  return react.useSyncExternalStore(store.subscribe, store.getSnapshot, getServerSnapshot);
744
737
  }
745
738
  function usePrefersDark(t0) {
746
- return useMatchMedia("(prefers-color-scheme: dark)", t0 === void 0 ? _temp$a : t0);
739
+ return useMatchMedia("(prefers-color-scheme: dark)", t0 === void 0 ? _temp$9 : t0);
747
740
  }
748
- function _temp$a() {
741
+ function _temp$9() {
749
742
  return !1;
750
743
  }
751
744
  function usePrefersReducedMotion(t0) {
752
- return useMatchMedia("(prefers-reduced-motion: reduce)", t0 === void 0 ? _temp$9 : t0);
745
+ return useMatchMedia("(prefers-reduced-motion: reduce)", t0 === void 0 ? _temp$8 : t0);
753
746
  }
754
- function _temp$9() {
747
+ function _temp$8() {
755
748
  return !1;
756
749
  }
757
750
  function responsiveBorderStyle() {
@@ -1696,7 +1689,7 @@ const StyledAvatar = /* @__PURE__ */ styledComponents.styled.div.withConfig({
1696
1689
  }, $[20] = onImageLoadError, $[21] = t7) : t7 = $[21];
1697
1690
  const handleImageError = t7;
1698
1691
  let t8, t9;
1699
- $[22] !== size2 ? (t9 = size2.map(_temp$8), $[22] = size2, $[23] = t9) : t9 = $[23], t8 = t9;
1692
+ $[22] !== size2 ? (t9 = size2.map(_temp$7), $[22] = size2, $[23] = t9) : t9 = $[23], t8 = t9;
1700
1693
  const initialsSize = t8, t10 = typeof as == "string" ? as : void 0;
1701
1694
  let t11;
1702
1695
  $[24] !== color ? (t11 = /* @__PURE__ */ jsxRuntime.jsx(Arrow$1, { children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "11", height: "7", viewBox: "0 0 11 7", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M6.67948 1.50115L11 7L0 7L4.32052 1.50115C4.92109 0.736796 6.07891 0.736795 6.67948 1.50115Z", fill: color }) }) }), $[24] = color, $[25] = t11) : t11 = $[25];
@@ -1717,7 +1710,7 @@ const StyledAvatar = /* @__PURE__ */ styledComponents.styled.div.withConfig({
1717
1710
  ] }), $[39] = arrowPosition, $[40] = as, $[41] = color, $[42] = ref, $[43] = restProps, $[44] = size2, $[45] = status, $[46] = t10, $[47] = t11, $[48] = t12, $[49] = t13, $[50] = title, $[51] = t14) : t14 = $[51], t14;
1718
1711
  });
1719
1712
  Avatar.displayName = "ForwardRef(Avatar)";
1720
- function _temp$8(s) {
1713
+ function _temp$7(s) {
1721
1714
  return s === 1 ? 1 : s === 2 ? 3 : s === 3 ? 5 : 0;
1722
1715
  }
1723
1716
  function _responsiveAvatarCounterSizeStyle(props) {
@@ -1765,7 +1758,7 @@ const StyledAvatarCounter = /* @__PURE__ */ styledComponents.styled.div.withConf
1765
1758
  size: t0
1766
1759
  } = props, size2 = useArrayProp(t0 === void 0 ? 1 : t0);
1767
1760
  let t1, t2;
1768
- $[0] !== size2 ? (t2 = size2.map(_temp$7), $[0] = size2, $[1] = t2) : t2 = $[1], t1 = t2;
1761
+ $[0] !== size2 ? (t2 = size2.map(_temp$6), $[0] = size2, $[1] = t2) : t2 = $[1], t1 = t2;
1769
1762
  const fontSize2 = t1;
1770
1763
  let t3;
1771
1764
  $[2] !== count || $[3] !== fontSize2 ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(Label, { as: "span", size: fontSize2, weight: "medium", children: count }), $[2] = count, $[3] = fontSize2, $[4] = t3) : t3 = $[4];
@@ -1773,7 +1766,7 @@ const StyledAvatarCounter = /* @__PURE__ */ styledComponents.styled.div.withConf
1773
1766
  return $[5] !== ref || $[6] !== size2 || $[7] !== t3 ? (t4 = /* @__PURE__ */ jsxRuntime.jsx(StyledAvatarCounter, { $size: size2, "data-ui": "AvatarCounter", ref, children: t3 }), $[5] = ref, $[6] = size2, $[7] = t3, $[8] = t4) : t4 = $[8], t4;
1774
1767
  });
1775
1768
  AvatarCounter.displayName = "ForwardRef(AvatarCounter)";
1776
- function _temp$7(s) {
1769
+ function _temp$6(s) {
1777
1770
  return s === 1 ? 1 : s === 2 ? 3 : s === 3 ? 5 : 0;
1778
1771
  }
1779
1772
  const BASE_STYLES = styledComponents.css`
@@ -3007,13 +3000,13 @@ const StyledInline = /* @__PURE__ */ styledComponents.styled(Box).withConfig({
3007
3000
  ...restProps
3008
3001
  } = props, $[0] = props, $[1] = as, $[2] = childrenProp, $[3] = restProps, $[4] = space) : (as = $[1], childrenProp = $[2], restProps = $[3], space = $[4]);
3009
3002
  let t0, t1;
3010
- $[5] !== childrenProp ? (t1 = react.Children.map(childrenProp, _temp$6), $[5] = childrenProp, $[6] = t1) : t1 = $[6], t0 = t1;
3003
+ $[5] !== childrenProp ? (t1 = react.Children.map(childrenProp, _temp$5), $[5] = childrenProp, $[6] = t1) : t1 = $[6], t0 = t1;
3011
3004
  const children = t0, t2 = useArrayProp(space);
3012
3005
  let t3;
3013
3006
  return $[7] !== as || $[8] !== children || $[9] !== restProps || $[10] !== t2 ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(StyledInline, { "data-ui": "Inline", ...restProps, $space: t2, forwardedAs: as, ref, children }), $[7] = as, $[8] = children, $[9] = restProps, $[10] = t2, $[11] = t3) : t3 = $[11], t3;
3014
3007
  });
3015
3008
  Inline.displayName = "ForwardRef(Inline)";
3016
- function _temp$6(child) {
3009
+ function _temp$5(child) {
3017
3010
  return child && /* @__PURE__ */ jsxRuntime.jsx("div", { children: child });
3018
3011
  }
3019
3012
  function kbdStyle() {
@@ -3452,7 +3445,7 @@ function LayerProvider(props) {
3452
3445
  [childLevel]: prevLen + 1
3453
3446
  };
3454
3447
  return setSize(Object.keys(nextState).length), nextState;
3455
- }) : setSize(_temp$5), () => {
3448
+ }) : setSize(_temp$4), () => {
3456
3449
  childLevel !== void 0 ? setChildLayers((state_0) => {
3457
3450
  const nextState_0 = {
3458
3451
  ...state_0
@@ -3480,7 +3473,7 @@ function LayerProvider(props) {
3480
3473
  function _temp2$3(v_0) {
3481
3474
  return v_0 - 1;
3482
3475
  }
3483
- function _temp$5(v) {
3476
+ function _temp$4(v) {
3484
3477
  return v + 1;
3485
3478
  }
3486
3479
  LayerProvider.displayName = "LayerProvider";
@@ -3574,7 +3567,7 @@ function PortalProvider(props) {
3574
3567
  children,
3575
3568
  element,
3576
3569
  __unstable_elements: elementsProp
3577
- } = props, elements = useUnique(elementsProp), fallbackElement = react.useSyncExternalStore(emptySubscribe, _temp$4, _temp2$2);
3570
+ } = props, elements = useUnique(elementsProp), fallbackElement = react.useSyncExternalStore(emptySubscribe, _temp$3, _temp2$2);
3578
3571
  let t0;
3579
3572
  const t1 = boundaryElement || null, t2 = element || fallbackElement;
3580
3573
  let t3;
@@ -3591,7 +3584,7 @@ function PortalProvider(props) {
3591
3584
  function _temp2$2() {
3592
3585
  return null;
3593
3586
  }
3594
- function _temp$4() {
3587
+ function _temp$3() {
3595
3588
  return document.body;
3596
3589
  }
3597
3590
  PortalProvider.displayName = "PortalProvider";
@@ -3658,11 +3651,8 @@ const StyledVirtualList = styledComponents.styled.div.withConfig({
3658
3651
  $[14] === Symbol.for("react.memo_cache_sentinel") ? (t7 = () => {
3659
3652
  if (!ref.current)
3660
3653
  return;
3661
- let _scrollEl = ref.current.parentNode;
3662
- for (; _scrollEl && !_isScrollable(_scrollEl); )
3663
- _scrollEl = _scrollEl.parentNode;
3664
- if (_scrollEl) {
3665
- const scrollEl = _scrollEl;
3654
+ const scrollEl = findScrollable(ref.current.parentNode);
3655
+ if (scrollEl) {
3666
3656
  if (!(scrollEl instanceof HTMLElement))
3667
3657
  return;
3668
3658
  const handleScroll = () => {
@@ -3740,6 +3730,12 @@ const StyledVirtualList = styledComponents.styled.div.withConfig({
3740
3730
  return $[52] !== as || $[53] !== restProps || $[54] !== t14 ? (t15 = /* @__PURE__ */ jsxRuntime.jsx(StyledVirtualList, { as, "data-ui": "VirtualList", ...restProps, ref, children: t14 }), $[52] = as, $[53] = restProps, $[54] = t14, $[55] = t15) : t15 = $[55], t15;
3741
3731
  });
3742
3732
  VirtualList.displayName = "ForwardRef(VirtualList)";
3733
+ function findScrollable(parentNode) {
3734
+ let _scrollEl = parentNode;
3735
+ for (; _scrollEl && !_isScrollable(_scrollEl); )
3736
+ _scrollEl = _scrollEl.parentNode;
3737
+ return _scrollEl;
3738
+ }
3743
3739
  const DEFAULT_POPOVER_DISTANCE = 4, DEFAULT_POPOVER_PADDING = 4, DEFAULT_POPOVER_ARROW_WIDTH = 19, DEFAULT_POPOVER_ARROW_HEIGHT = 8, DEFAULT_POPOVER_ARROW_RADIUS = 2, DEFAULT_POPOVER_MARGINS = [0, 0, 0, 0], DEFAULT_FALLBACK_PLACEMENTS$1 = {
3744
3740
  top: ["bottom", "left", "right"],
3745
3741
  "top-start": ["bottom-start", "left-start", "right-start"],
@@ -4705,7 +4701,7 @@ const CLEAR_BUTTON_BOX_STYLE = {
4705
4701
  const border2 = t0 === void 0 ? !0 : t0, disabled = t1 === void 0 ? !1 : t1, fontSizeProp = t2 === void 0 ? 2 : t2, paddingProp = t3 === void 0 ? 3 : t3, radiusProp = t4 === void 0 ? 2 : t4, spaceProp = t5 === void 0 ? 3 : t5, type = t6 === void 0 ? "text" : t6, ref = react.useRef(null), rootTheme = useRootTheme(), fontSize2 = useArrayProp(fontSizeProp), padding = useArrayProp(paddingProp), radius = useArrayProp(radiusProp), space = useArrayProp(spaceProp), $hasClearButton = !!clearButton, $hasIcon = !!IconComponent, $hasIconRight = !!IconRightComponent, $hasSuffix = !!suffix, $hasPrefix = !!prefix;
4706
4702
  let t7;
4707
4703
  $[19] === Symbol.for("react.memo_cache_sentinel") ? (t7 = () => ref.current, $[19] = t7) : t7 = $[19], react.useImperativeHandle(forwardedRef, t7), useCustomValidity(ref, customValidity);
4708
- const handleClearMouseDown = _temp$3;
4704
+ const handleClearMouseDown = _temp$2;
4709
4705
  let t8;
4710
4706
  $[20] !== onClear ? (t8 = (event_0) => {
4711
4707
  event_0.preventDefault(), event_0.stopPropagation(), onClear && onClear(), ref.current?.focus();
@@ -4763,7 +4759,7 @@ const CLEAR_BUTTON_BOX_STYLE = {
4763
4759
  ] }), $[79] = prefixNode, $[80] = rootTheme.tone, $[81] = suffixNode, $[82] = t27, $[83] = t28) : t28 = $[83], t28;
4764
4760
  });
4765
4761
  TextInput.displayName = "ForwardRef(TextInput)";
4766
- function _temp$3(event) {
4762
+ function _temp$2(event) {
4767
4763
  event.preventDefault(), event.stopPropagation();
4768
4764
  }
4769
4765
  function _temp2$1(v) {
@@ -5835,8 +5831,8 @@ const StyledMenu = styledComponents.styled(Box).withConfig({
5835
5831
  });
5836
5832
  Menu.displayName = "ForwardRef(Menu)";
5837
5833
  const MenuButton = react.forwardRef(function(props, forwardedRef) {
5838
- const $ = reactCompilerRuntime.c(62), {
5839
- __unstable_disableRestoreFocusOnClose: t0,
5834
+ const {
5835
+ __unstable_disableRestoreFocusOnClose: disableRestoreFocusOnClose = !1,
5840
5836
  boundaryElement: deprecated_boundaryElement,
5841
5837
  button: buttonProp,
5842
5838
  id,
@@ -5845,38 +5841,23 @@ const MenuButton = react.forwardRef(function(props, forwardedRef) {
5845
5841
  onOpen,
5846
5842
  placement: deprecated_placement,
5847
5843
  popoverScheme: deprecated_popoverScheme,
5848
- portal: t1,
5844
+ portal: deprecated_portal = !0,
5849
5845
  popover,
5850
5846
  popoverRadius: deprecated_popoverRadius,
5851
5847
  preventOverflow: deprecated_preventOverflow
5852
- } = 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);
5853
- let t2;
5854
- $[0] === Symbol.for("react.memo_cache_sentinel") ? (t2 = [], $[0] = t2) : t2 = $[0];
5855
- const [menuElements, setChildMenuElements] = react.useState(t2), openRef = react.useRef(open);
5856
- let t3, t4;
5857
- $[1] !== onOpen || $[2] !== open ? (t3 = () => {
5848
+ } = props, [open, setOpen] = react.useState(!1), [shouldFocus, setShouldFocus] = react.useState(null), [buttonElement, setButtonElement] = react.useState(null), [menuElements, setChildMenuElements] = react.useState([]), openRef = react.useRef(open);
5849
+ react.useEffect(() => {
5858
5850
  onOpen && open && !openRef.current && onOpen();
5859
- }, t4 = [onOpen, open], $[1] = onOpen, $[2] = open, $[3] = t3, $[4] = t4) : (t3 = $[3], t4 = $[4]), react.useEffect(t3, t4);
5860
- let t5, t6;
5861
- $[5] !== onClose || $[6] !== open ? (t5 = () => {
5851
+ }, [onOpen, open]), react.useEffect(() => {
5862
5852
  onClose && !open && openRef.current && onClose();
5863
- }, t6 = [onClose, open], $[5] = onClose, $[6] = open, $[7] = t5, $[8] = t6) : (t5 = $[7], t6 = $[8]), react.useEffect(t5, t6);
5864
- let t7, t8;
5865
- $[9] !== open ? (t7 = () => {
5853
+ }, [onClose, open]), react.useEffect(() => {
5866
5854
  openRef.current = open;
5867
- }, t8 = [open], $[9] = open, $[10] = t7, $[11] = t8) : (t7 = $[10], t8 = $[11]), react.useEffect(t7, t8);
5868
- let t9;
5869
- $[12] === Symbol.for("react.memo_cache_sentinel") ? (t9 = () => {
5870
- setOpen(_temp$2), setShouldFocus(null);
5871
- }, $[12] = t9) : t9 = $[12];
5872
- const handleButtonClick = t9;
5873
- let t10;
5874
- $[13] !== open ? (t10 = (event) => {
5855
+ }, [open]);
5856
+ const handleButtonClick = react.useCallback(() => {
5857
+ setOpen((v) => !v), setShouldFocus(null);
5858
+ }, []), handleMouseDown = react.useCallback((event) => {
5875
5859
  open && event.preventDefault();
5876
- }, $[13] = open, $[14] = t10) : t10 = $[14];
5877
- const handleMouseDown = t10;
5878
- let t11;
5879
- $[15] === Symbol.for("react.memo_cache_sentinel") ? (t11 = (event_0) => {
5860
+ }, [open]), handleButtonKeyDown = react.useCallback((event_0) => {
5880
5861
  if (event_0.key === "ArrowDown" || event_0.key === "Enter" || event_0.key === " ") {
5881
5862
  event_0.preventDefault(), setOpen(!0), setShouldFocus("first");
5882
5863
  return;
@@ -5885,10 +5866,7 @@ const MenuButton = react.forwardRef(function(props, forwardedRef) {
5885
5866
  event_0.preventDefault(), setOpen(!0), setShouldFocus("last");
5886
5867
  return;
5887
5868
  }
5888
- }, $[15] = t11) : t11 = $[15];
5889
- const handleButtonKeyDown = t11;
5890
- let t12;
5891
- $[16] !== buttonElement || $[17] !== menuElements ? (t12 = (event_1) => {
5869
+ }, []), handleMenuClickOutside = react.useCallback((event_1) => {
5892
5870
  const target = event_1.target;
5893
5871
  if (target instanceof Node && !(buttonElement && (target === buttonElement || buttonElement.contains(target)))) {
5894
5872
  for (const el of menuElements)
@@ -5896,15 +5874,9 @@ const MenuButton = react.forwardRef(function(props, forwardedRef) {
5896
5874
  return;
5897
5875
  setOpen(!1);
5898
5876
  }
5899
- }, $[16] = buttonElement, $[17] = menuElements, $[18] = t12) : t12 = $[18];
5900
- const handleMenuClickOutside = t12;
5901
- let t13;
5902
- $[19] !== buttonElement || $[20] !== disableRestoreFocusOnClose ? (t13 = () => {
5877
+ }, [buttonElement, menuElements]), handleMenuEscape = react.useCallback(() => {
5903
5878
  setOpen(!1), !disableRestoreFocusOnClose && buttonElement && buttonElement.focus();
5904
- }, $[19] = buttonElement, $[20] = disableRestoreFocusOnClose, $[21] = t13) : t13 = $[21];
5905
- const handleMenuEscape = t13;
5906
- let t14;
5907
- $[22] !== menuElements ? (t14 = (event_2) => {
5879
+ }, [buttonElement, disableRestoreFocusOnClose]), handleBlur = react.useCallback((event_2) => {
5908
5880
  const target_0 = event_2.relatedTarget;
5909
5881
  if (target_0 instanceof Node) {
5910
5882
  for (const el_0 of menuElements)
@@ -5912,18 +5884,9 @@ const MenuButton = react.forwardRef(function(props, forwardedRef) {
5912
5884
  return;
5913
5885
  setOpen(!1);
5914
5886
  }
5915
- }, $[22] = menuElements, $[23] = t14) : t14 = $[23];
5916
- const handleBlur = t14;
5917
- let t15;
5918
- $[24] !== buttonElement || $[25] !== disableRestoreFocusOnClose ? (t15 = () => {
5887
+ }, [menuElements]), handleItemClick = react.useCallback(() => {
5919
5888
  setOpen(!1), !disableRestoreFocusOnClose && buttonElement && buttonElement.focus();
5920
- }, $[24] = buttonElement, $[25] = disableRestoreFocusOnClose, $[26] = t15) : t15 = $[26];
5921
- const handleItemClick = t15;
5922
- let t16;
5923
- $[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];
5924
- const registerElement = t16;
5925
- let t17;
5926
- $[28] !== buttonElement || $[29] !== handleBlur || $[30] !== handleItemClick || $[31] !== handleMenuClickOutside || $[32] !== handleMenuEscape || $[33] !== id || $[34] !== menuProp || $[35] !== shouldFocus ? (t17 = menuProp && react.cloneElement(menuProp, {
5889
+ }, [buttonElement, disableRestoreFocusOnClose]), registerElement = react.useCallback((el_1) => (setChildMenuElements((els) => els.concat([el_1])), () => setChildMenuElements((els_0) => els_0.filter((_el) => _el !== el_1))), []), menu = menuProp && react.cloneElement(menuProp, {
5927
5890
  "aria-labelledby": id,
5928
5891
  onBlurCapture: handleBlur,
5929
5892
  onClickOutside: handleMenuClickOutside,
@@ -5932,10 +5895,7 @@ const MenuButton = react.forwardRef(function(props, forwardedRef) {
5932
5895
  originElement: buttonElement,
5933
5896
  registerElement,
5934
5897
  shouldFocus
5935
- }), $[28] = buttonElement, $[29] = handleBlur, $[30] = handleItemClick, $[31] = handleMenuClickOutside, $[32] = handleMenuEscape, $[33] = id, $[34] = menuProp, $[35] = shouldFocus, $[36] = t17) : t17 = $[36];
5936
- const menu = t17;
5937
- let t18, t19;
5938
- $[37] !== buttonProp || $[38] !== handleMouseDown || $[39] !== id || $[40] !== open ? (t19 = buttonProp && react.cloneElement(buttonProp, {
5898
+ }), button = react.useMemo(() => buttonProp && react.cloneElement(buttonProp, {
5939
5899
  "data-ui": "MenuButton",
5940
5900
  id,
5941
5901
  onClick: handleButtonClick,
@@ -5945,14 +5905,9 @@ const MenuButton = react.forwardRef(function(props, forwardedRef) {
5945
5905
  "aria-expanded": open,
5946
5906
  ref: setButtonElement,
5947
5907
  selected: buttonProp.props.selected ?? open
5948
- }), $[37] = buttonProp, $[38] = handleMouseDown, $[39] = id, $[40] = open, $[41] = t19) : t19 = $[41], t18 = t19;
5949
- const button = t18;
5950
- let t20, t21;
5951
- $[42] !== buttonElement ? (t20 = () => buttonElement, t21 = [buttonElement], $[42] = buttonElement, $[43] = t20, $[44] = t21) : (t20 = $[43], t21 = $[44]), react.useImperativeHandle(forwardedRef, t20, t21);
5952
- let t22, t23;
5953
- $[45] !== popover ? (t23 = popover || {}, $[45] = popover, $[46] = t23) : t23 = $[46];
5954
- let t24;
5955
- $[47] !== deprecated_boundaryElement || $[48] !== deprecated_placement || $[49] !== deprecated_popoverRadius || $[50] !== deprecated_popoverScheme || $[51] !== deprecated_portal || $[52] !== deprecated_preventOverflow || $[53] !== t23 ? (t24 = {
5908
+ }), [buttonProp, handleButtonClick, handleButtonKeyDown, handleMouseDown, id, open]);
5909
+ react.useImperativeHandle(forwardedRef, () => buttonElement, [buttonElement]);
5910
+ const popoverProps = react.useMemo(() => ({
5956
5911
  boundaryElement: deprecated_boundaryElement,
5957
5912
  overflow: "auto",
5958
5913
  placement: deprecated_placement,
@@ -5960,18 +5915,11 @@ const MenuButton = react.forwardRef(function(props, forwardedRef) {
5960
5915
  preventOverflow: deprecated_preventOverflow,
5961
5916
  radius: deprecated_popoverRadius,
5962
5917
  scheme: deprecated_popoverScheme,
5963
- ...t23
5964
- }, $[47] = deprecated_boundaryElement, $[48] = deprecated_placement, $[49] = deprecated_popoverRadius, $[50] = deprecated_popoverScheme, $[51] = deprecated_portal, $[52] = deprecated_preventOverflow, $[53] = t23, $[54] = t24) : t24 = $[54], t22 = t24;
5965
- const popoverProps = t22;
5966
- let t25;
5967
- $[55] !== button ? (t25 = button || /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {}), $[55] = button, $[56] = t25) : t25 = $[56];
5968
- let t26;
5969
- return $[57] !== menu || $[58] !== open || $[59] !== popoverProps || $[60] !== t25 ? (t26 = /* @__PURE__ */ jsxRuntime.jsx(Popover, { "data-ui": "MenuButton__popover", ...popoverProps, content: menu, open, children: t25 }), $[57] = menu, $[58] = open, $[59] = popoverProps, $[60] = t25, $[61] = t26) : t26 = $[61], t26;
5918
+ ...popover || {}
5919
+ }), [deprecated_boundaryElement, deprecated_placement, deprecated_popoverRadius, deprecated_popoverScheme, deprecated_portal, deprecated_preventOverflow, popover]);
5920
+ return /* @__PURE__ */ jsxRuntime.jsx(Popover, { "data-ui": "MenuButton__popover", ...popoverProps, content: menu, open, children: button || /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {}) });
5970
5921
  });
5971
5922
  MenuButton.displayName = "ForwardRef(MenuButton)";
5972
- function _temp$2(v) {
5973
- return !v;
5974
- }
5975
5923
  const MenuDivider = styledComponents.styled.hr.withConfig({
5976
5924
  displayName: "MenuDivider",
5977
5925
  componentId: "sc-uhoxwu-0"