@sanity/ui 2.3.4-canary.0 → 2.3.4
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.esm.js +25 -16
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +23 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -16
- package/dist/index.mjs.map +1 -1
- package/package.json +33 -25
- package/src/core/components/menu/__workshop__/customSelectedState.tsx +38 -0
- package/src/core/components/menu/__workshop__/index.ts +5 -0
- package/src/core/components/menu/menuButton.tsx +1 -1
- package/src/core/primitives/avatar/avatarStack.tsx +3 -2
- package/src/core/primitives/helpers.ts +11 -0
- package/src/core/primitives/inline/inline.tsx +6 -2
package/dist/index.js
CHANGED
|
@@ -1525,7 +1525,13 @@ const Root$A = styledComponents.styled.div(
|
|
|
1525
1525
|
[size2]
|
|
1526
1526
|
);
|
|
1527
1527
|
return /* @__PURE__ */ jsxRuntime.jsx(Root$A, { $size: size2, "data-ui": "AvatarCounter", ref, children: /* @__PURE__ */ jsxRuntime.jsx(Label, { as: "span", size: fontSize2, weight: "medium", children: count }) });
|
|
1528
|
-
})
|
|
1528
|
+
});
|
|
1529
|
+
function childrenToElementArray(children) {
|
|
1530
|
+
return (Array.isArray(children) ? children : [children]).filter(
|
|
1531
|
+
(node) => ReactIs.isElement(node) || ReactIs.isFragment(node) || typeof node == "string"
|
|
1532
|
+
);
|
|
1533
|
+
}
|
|
1534
|
+
const BASE_STYLES = styledComponents.css`
|
|
1529
1535
|
white-space: nowrap;
|
|
1530
1536
|
|
|
1531
1537
|
& > div {
|
|
@@ -1556,7 +1562,7 @@ const Root$z = styledComponents.styled.div(responsiveAvatarStackSizeStyle, avata
|
|
|
1556
1562
|
maxLength: maxLengthProp = 4,
|
|
1557
1563
|
size: sizeProp = 1,
|
|
1558
1564
|
...restProps
|
|
1559
|
-
} = props, children =
|
|
1565
|
+
} = props, children = childrenToElementArray(childrenProp).filter(
|
|
1560
1566
|
(child) => typeof child != "string"
|
|
1561
1567
|
), 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;
|
|
1562
1568
|
return /* @__PURE__ */ jsxRuntime.jsxs(Root$z, { "data-ui": "AvatarStack", ...restProps, ref, $size: size2, children: [
|
|
@@ -2631,7 +2637,7 @@ function inlineSpaceStyle(props) {
|
|
|
2631
2637
|
}
|
|
2632
2638
|
const Root$m = styledComponents.styled(Box)(inlineBaseStyle, inlineSpaceStyle), Inline = react.forwardRef(function(props, ref) {
|
|
2633
2639
|
const { as, children: childrenProp, space, ...restProps } = props, children = react.useMemo(
|
|
2634
|
-
() =>
|
|
2640
|
+
() => childrenToElementArray(childrenProp).filter(Boolean).map((child, idx) => /* @__PURE__ */ jsxRuntime.jsx("div", { children: child }, idx)),
|
|
2635
2641
|
[childrenProp]
|
|
2636
2642
|
);
|
|
2637
2643
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -5602,17 +5608,20 @@ const Root$5 = styledComponents.styled(Box)`
|
|
|
5602
5608
|
shouldFocus
|
|
5603
5609
|
]
|
|
5604
5610
|
), menu = menuProp && react.cloneElement(menuProp, menuProps), ref = react.useRef(null), button = react.useMemo(
|
|
5605
|
-
() =>
|
|
5606
|
-
|
|
5607
|
-
|
|
5608
|
-
|
|
5609
|
-
|
|
5610
|
-
|
|
5611
|
-
|
|
5612
|
-
|
|
5613
|
-
|
|
5614
|
-
|
|
5615
|
-
|
|
5611
|
+
() => {
|
|
5612
|
+
var _a;
|
|
5613
|
+
return buttonProp && react.cloneElement(buttonProp, {
|
|
5614
|
+
"data-ui": "MenuButton",
|
|
5615
|
+
id,
|
|
5616
|
+
onClick: handleButtonClick,
|
|
5617
|
+
onKeyDown: handleButtonKeyDown,
|
|
5618
|
+
onMouseDown: handleMouseDown,
|
|
5619
|
+
"aria-haspopup": !0,
|
|
5620
|
+
"aria-expanded": open,
|
|
5621
|
+
ref,
|
|
5622
|
+
selected: (_a = buttonProp.props.selected) != null ? _a : open
|
|
5623
|
+
});
|
|
5624
|
+
},
|
|
5616
5625
|
[buttonProp, handleButtonClick, handleButtonKeyDown, handleMouseDown, id, open]
|
|
5617
5626
|
);
|
|
5618
5627
|
react.useImperativeHandle(
|