@sanity/ui 2.3.4-canary.0 → 2.3.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.esm.js +21 -20
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +20 -19
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -20
- package/dist/index.mjs.map +1 -1
- package/package.json +33 -25
- package/src/core/components/breadcrumbs/breadcrumbs.tsx +1 -7
- 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/components/tree/tree.tsx +1 -1
- package/src/core/primitives/avatar/avatarStack.tsx +5 -4
- package/src/core/primitives/inline/inline.tsx +1 -1
package/dist/index.js
CHANGED
|
@@ -1556,8 +1556,9 @@ const Root$z = styledComponents.styled.div(responsiveAvatarStackSizeStyle, avata
|
|
|
1556
1556
|
maxLength: maxLengthProp = 4,
|
|
1557
1557
|
size: sizeProp = 1,
|
|
1558
1558
|
...restProps
|
|
1559
|
-
} = props, children = react.
|
|
1560
|
-
(
|
|
1559
|
+
} = props, children = react.useMemo(
|
|
1560
|
+
() => react.Children.toArray(childrenProp).filter(react.isValidElement),
|
|
1561
|
+
[childrenProp]
|
|
1561
1562
|
), 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
1563
|
return /* @__PURE__ */ jsxRuntime.jsxs(Root$z, { "data-ui": "AvatarStack", ...restProps, ref, $size: size2, children: [
|
|
1563
1564
|
len === 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(AvatarCounter, { count: len, size: size2 }) }),
|
|
@@ -2631,7 +2632,7 @@ function inlineSpaceStyle(props) {
|
|
|
2631
2632
|
}
|
|
2632
2633
|
const Root$m = styledComponents.styled(Box)(inlineBaseStyle, inlineSpaceStyle), Inline = react.forwardRef(function(props, ref) {
|
|
2633
2634
|
const { as, children: childrenProp, space, ...restProps } = props, children = react.useMemo(
|
|
2634
|
-
() => react.Children.map(childrenProp, (child) => /* @__PURE__ */ jsxRuntime.jsx("div", { children: child })),
|
|
2635
|
+
() => react.Children.map(childrenProp, (child) => child && /* @__PURE__ */ jsxRuntime.jsx("div", { children: child })),
|
|
2635
2636
|
[childrenProp]
|
|
2636
2637
|
);
|
|
2637
2638
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -4948,10 +4949,7 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = [
|
|
|
4948
4949
|
`, Breadcrumbs = react.forwardRef(function(props, ref) {
|
|
4949
4950
|
const { children, maxLength, separator, space: spaceRaw = 2, ...restProps } = props, space = useArrayProp(spaceRaw), [open, setOpen] = react.useState(!1), [expandElement, setExpandElement] = react.useState(null), [popoverElement, setPopoverElement] = react.useState(null), collapse = react.useCallback(() => setOpen(!1), []), expand = react.useCallback(() => setOpen(!0), []);
|
|
4950
4951
|
useClickOutside(collapse, [expandElement, popoverElement]);
|
|
4951
|
-
const rawItems = react.useMemo(
|
|
4952
|
-
() => react.Children.toArray(children).filter((child) => react.isValidElement(child)),
|
|
4953
|
-
[children]
|
|
4954
|
-
), items = react.useMemo(() => {
|
|
4952
|
+
const rawItems = react.useMemo(() => react.Children.toArray(children).filter(react.isValidElement), [children]), items = react.useMemo(() => {
|
|
4955
4953
|
const len = rawItems.length;
|
|
4956
4954
|
if (maxLength && len > maxLength) {
|
|
4957
4955
|
const beforeLength = Math.ceil(maxLength / 2), afterLength = Math.floor(maxLength / 2);
|
|
@@ -5602,17 +5600,20 @@ const Root$5 = styledComponents.styled(Box)`
|
|
|
5602
5600
|
shouldFocus
|
|
5603
5601
|
]
|
|
5604
5602
|
), menu = menuProp && react.cloneElement(menuProp, menuProps), ref = react.useRef(null), button = react.useMemo(
|
|
5605
|
-
() =>
|
|
5606
|
-
|
|
5607
|
-
|
|
5608
|
-
|
|
5609
|
-
|
|
5610
|
-
|
|
5611
|
-
|
|
5612
|
-
|
|
5613
|
-
|
|
5614
|
-
|
|
5615
|
-
|
|
5603
|
+
() => {
|
|
5604
|
+
var _a;
|
|
5605
|
+
return buttonProp && react.cloneElement(buttonProp, {
|
|
5606
|
+
"data-ui": "MenuButton",
|
|
5607
|
+
id,
|
|
5608
|
+
onClick: handleButtonClick,
|
|
5609
|
+
onKeyDown: handleButtonKeyDown,
|
|
5610
|
+
onMouseDown: handleMouseDown,
|
|
5611
|
+
"aria-haspopup": !0,
|
|
5612
|
+
"aria-expanded": open,
|
|
5613
|
+
ref,
|
|
5614
|
+
selected: (_a = buttonProp.props.selected) != null ? _a : open
|
|
5615
|
+
});
|
|
5616
|
+
},
|
|
5616
5617
|
[buttonProp, handleButtonClick, handleButtonKeyDown, handleMouseDown, id, open]
|
|
5617
5618
|
);
|
|
5618
5619
|
react.useImperativeHandle(
|
|
@@ -6464,7 +6465,7 @@ const key = Symbol.for("@sanity/ui/context/tree"), TreeContext = createGlobalSco
|
|
|
6464
6465
|
ref.current.querySelectorAll('[data-ui="TreeItem"]')
|
|
6465
6466
|
);
|
|
6466
6467
|
setItemElements(_itemElements);
|
|
6467
|
-
}, [children
|
|
6468
|
+
}, [children]), /* @__PURE__ */ jsxRuntime.jsx(TreeContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6468
6469
|
Stack,
|
|
6469
6470
|
{
|
|
6470
6471
|
as: "ul",
|