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