@sanity/ui 2.3.6-canary.4 → 2.3.6-canary.5

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
@@ -5557,28 +5557,16 @@ const Root$5 = styledComponents.styled(Box)`
5557
5557
  setOpen(!1), !disableRestoreFocusOnClose && buttonElement && buttonElement.focus();
5558
5558
  }, [buttonElement, disableRestoreFocusOnClose]), registerElement = react.useCallback((el) => (setChildMenuElements((els) => els.concat([el])), () => {
5559
5559
  setChildMenuElements((els) => els.filter((_el) => _el !== el));
5560
- }), []), menuProps = react.useMemo(
5561
- () => ({
5562
- "aria-labelledby": id,
5563
- onBlurCapture: handleBlur,
5564
- onClickOutside: handleMenuClickOutside,
5565
- onEscape: handleMenuEscape,
5566
- onItemClick: handleItemClick,
5567
- originElement: buttonElement,
5568
- registerElement,
5569
- shouldFocus
5570
- }),
5571
- [
5572
- buttonElement,
5573
- handleMenuClickOutside,
5574
- handleMenuEscape,
5575
- handleItemClick,
5576
- id,
5577
- handleBlur,
5578
- registerElement,
5579
- shouldFocus
5580
- ]
5581
- ), menu = menuProp && react.cloneElement(menuProp, menuProps), ref = react.useRef(null), button = react.useMemo(
5560
+ }), []), menu = menuProp && react.cloneElement(menuProp, {
5561
+ "aria-labelledby": id,
5562
+ onBlurCapture: handleBlur,
5563
+ onClickOutside: handleMenuClickOutside,
5564
+ onEscape: handleMenuEscape,
5565
+ onItemClick: handleItemClick,
5566
+ originElement: buttonElement,
5567
+ registerElement,
5568
+ shouldFocus
5569
+ }), button = react.useMemo(
5582
5570
  () => {
5583
5571
  var _a;
5584
5572
  return buttonProp && react.cloneElement(buttonProp, {
@@ -5589,7 +5577,7 @@ const Root$5 = styledComponents.styled(Box)`
5589
5577
  onMouseDown: handleMouseDown,
5590
5578
  "aria-haspopup": !0,
5591
5579
  "aria-expanded": open,
5592
- ref,
5580
+ ref: setButtonElement,
5593
5581
  selected: (_a = buttonProp.props.selected) != null ? _a : open
5594
5582
  });
5595
5583
  },
@@ -5597,11 +5585,9 @@ const Root$5 = styledComponents.styled(Box)`
5597
5585
  );
5598
5586
  react.useImperativeHandle(
5599
5587
  forwardedRef,
5600
- () => ref.current
5601
- ), react.useEffect(() => {
5602
- if (button)
5603
- return setButtonElement(ref.current), () => setButtonElement(null);
5604
- }, [button]);
5588
+ () => buttonElement,
5589
+ [buttonElement]
5590
+ );
5605
5591
  const popoverProps = react.useMemo(
5606
5592
  () => ({
5607
5593
  boundaryElement: deprecated_boundaryElement,
@@ -5623,7 +5609,19 @@ const Root$5 = styledComponents.styled(Box)`
5623
5609
  popover
5624
5610
  ]
5625
5611
  );
5626
- return /* @__PURE__ */ jsxRuntime.jsx(Popover, { "data-ui": "MenuButton__popover", ...popoverProps, content: menu, open, children: button || /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {}) });
5612
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5613
+ /* @__PURE__ */ jsxRuntime.jsx(
5614
+ Popover,
5615
+ {
5616
+ "data-ui": "MenuButton__popover",
5617
+ referenceElement: buttonElement,
5618
+ ...popoverProps,
5619
+ content: menu,
5620
+ open
5621
+ }
5622
+ ),
5623
+ button
5624
+ ] });
5627
5625
  }), MenuDivider = styledComponents.styled.hr`
5628
5626
  height: 1px;
5629
5627
  border: 0;