@sanity/ui 2.3.6-canary.4 → 2.3.6-canary.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.compiled.mjs +118 -64
- package/dist/index.compiled.mjs.map +1 -1
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.esm.js +39 -44
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +39 -44
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +39 -44
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/core/components/menu/menu.tsx +2 -0
- package/src/core/components/menu/menuButton.tsx +17 -32
- package/src/core/primitives/popover/popover.tsx +18 -16
package/dist/index.js
CHANGED
|
@@ -3261,7 +3261,7 @@ const Popover = react.memo(
|
|
|
3261
3261
|
animate: _animate = !1,
|
|
3262
3262
|
arrow: arrowProp = !1,
|
|
3263
3263
|
boundaryElement: _boundaryElement,
|
|
3264
|
-
children,
|
|
3264
|
+
children: _children,
|
|
3265
3265
|
constrainSize = !1,
|
|
3266
3266
|
content,
|
|
3267
3267
|
disabled,
|
|
@@ -3375,10 +3375,16 @@ const Popover = react.memo(
|
|
|
3375
3375
|
},
|
|
3376
3376
|
[refs]
|
|
3377
3377
|
);
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
}, [
|
|
3381
|
-
|
|
3378
|
+
react.useImperativeHandle(updateRef, () => update, [update]), react.useEffect(() => {
|
|
3379
|
+
_children || refs.setReference(referenceElement || null);
|
|
3380
|
+
}, [_children, referenceElement, refs]);
|
|
3381
|
+
const children = react.useMemo(() => !_children || referenceElement ? null : react.cloneElement(_children, {
|
|
3382
|
+
ref: (node) => {
|
|
3383
|
+
logDeprecatedWarning(), refs.setReference(node);
|
|
3384
|
+
}
|
|
3385
|
+
}), [_children, referenceElement, refs]);
|
|
3386
|
+
if (disabled)
|
|
3387
|
+
return _children || /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
3382
3388
|
const popover = /* @__PURE__ */ jsxRuntime.jsx(LayerProvider, { zOffset, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3383
3389
|
PopoverCard,
|
|
3384
3390
|
{
|
|
@@ -3423,16 +3429,7 @@ const Popover = react.memo(
|
|
|
3423
3429
|
)
|
|
3424
3430
|
}
|
|
3425
3431
|
),
|
|
3426
|
-
children
|
|
3427
|
-
"div",
|
|
3428
|
-
{
|
|
3429
|
-
ref: (node) => {
|
|
3430
|
-
logDeprecatedWarning(), refs.setReference(node);
|
|
3431
|
-
},
|
|
3432
|
-
style: { display: "contents" },
|
|
3433
|
-
children
|
|
3434
|
-
}
|
|
3435
|
-
)
|
|
3432
|
+
children
|
|
3436
3433
|
] });
|
|
3437
3434
|
})
|
|
3438
3435
|
);
|
|
@@ -5557,28 +5554,16 @@ const Root$5 = styledComponents.styled(Box)`
|
|
|
5557
5554
|
setOpen(!1), !disableRestoreFocusOnClose && buttonElement && buttonElement.focus();
|
|
5558
5555
|
}, [buttonElement, disableRestoreFocusOnClose]), registerElement = react.useCallback((el) => (setChildMenuElements((els) => els.concat([el])), () => {
|
|
5559
5556
|
setChildMenuElements((els) => els.filter((_el) => _el !== el));
|
|
5560
|
-
}), []),
|
|
5561
|
-
|
|
5562
|
-
|
|
5563
|
-
|
|
5564
|
-
|
|
5565
|
-
|
|
5566
|
-
|
|
5567
|
-
|
|
5568
|
-
|
|
5569
|
-
|
|
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(
|
|
5557
|
+
}), []), menu = menuProp && react.cloneElement(menuProp, {
|
|
5558
|
+
"aria-labelledby": id,
|
|
5559
|
+
onBlurCapture: handleBlur,
|
|
5560
|
+
onClickOutside: handleMenuClickOutside,
|
|
5561
|
+
onEscape: handleMenuEscape,
|
|
5562
|
+
onItemClick: handleItemClick,
|
|
5563
|
+
originElement: buttonElement,
|
|
5564
|
+
registerElement,
|
|
5565
|
+
shouldFocus
|
|
5566
|
+
}), button = react.useMemo(
|
|
5582
5567
|
() => {
|
|
5583
5568
|
var _a;
|
|
5584
5569
|
return buttonProp && react.cloneElement(buttonProp, {
|
|
@@ -5589,7 +5574,7 @@ const Root$5 = styledComponents.styled(Box)`
|
|
|
5589
5574
|
onMouseDown: handleMouseDown,
|
|
5590
5575
|
"aria-haspopup": !0,
|
|
5591
5576
|
"aria-expanded": open,
|
|
5592
|
-
ref,
|
|
5577
|
+
ref: setButtonElement,
|
|
5593
5578
|
selected: (_a = buttonProp.props.selected) != null ? _a : open
|
|
5594
5579
|
});
|
|
5595
5580
|
},
|
|
@@ -5597,11 +5582,9 @@ const Root$5 = styledComponents.styled(Box)`
|
|
|
5597
5582
|
);
|
|
5598
5583
|
react.useImperativeHandle(
|
|
5599
5584
|
forwardedRef,
|
|
5600
|
-
() =>
|
|
5601
|
-
|
|
5602
|
-
|
|
5603
|
-
return setButtonElement(ref.current), () => setButtonElement(null);
|
|
5604
|
-
}, [button]);
|
|
5585
|
+
() => buttonElement,
|
|
5586
|
+
[buttonElement]
|
|
5587
|
+
);
|
|
5605
5588
|
const popoverProps = react.useMemo(
|
|
5606
5589
|
() => ({
|
|
5607
5590
|
boundaryElement: deprecated_boundaryElement,
|
|
@@ -5623,7 +5606,19 @@ const Root$5 = styledComponents.styled(Box)`
|
|
|
5623
5606
|
popover
|
|
5624
5607
|
]
|
|
5625
5608
|
);
|
|
5626
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
5609
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5610
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5611
|
+
Popover,
|
|
5612
|
+
{
|
|
5613
|
+
"data-ui": "MenuButton__popover",
|
|
5614
|
+
referenceElement: buttonElement,
|
|
5615
|
+
...popoverProps,
|
|
5616
|
+
content: menu,
|
|
5617
|
+
open
|
|
5618
|
+
}
|
|
5619
|
+
),
|
|
5620
|
+
button
|
|
5621
|
+
] });
|
|
5627
5622
|
}), MenuDivider = styledComponents.styled.hr`
|
|
5628
5623
|
height: 1px;
|
|
5629
5624
|
border: 0;
|