@sanity/ui 2.3.4 → 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 +9 -17
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +7 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -17
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/core/components/breadcrumbs/breadcrumbs.tsx +1 -7
- package/src/core/components/tree/tree.tsx +1 -1
- package/src/core/primitives/avatar/avatarStack.tsx +5 -5
- package/src/core/primitives/inline/inline.tsx +2 -6
- package/src/core/primitives/helpers.ts +0 -11
package/dist/index.js
CHANGED
|
@@ -1525,13 +1525,7 @@ 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
|
-
})
|
|
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`
|
|
1528
|
+
}), BASE_STYLES = styledComponents.css`
|
|
1535
1529
|
white-space: nowrap;
|
|
1536
1530
|
|
|
1537
1531
|
& > div {
|
|
@@ -1562,8 +1556,9 @@ const Root$z = styledComponents.styled.div(responsiveAvatarStackSizeStyle, avata
|
|
|
1562
1556
|
maxLength: maxLengthProp = 4,
|
|
1563
1557
|
size: sizeProp = 1,
|
|
1564
1558
|
...restProps
|
|
1565
|
-
} = props, children =
|
|
1566
|
-
(
|
|
1559
|
+
} = props, children = react.useMemo(
|
|
1560
|
+
() => react.Children.toArray(childrenProp).filter(react.isValidElement),
|
|
1561
|
+
[childrenProp]
|
|
1567
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;
|
|
1568
1563
|
return /* @__PURE__ */ jsxRuntime.jsxs(Root$z, { "data-ui": "AvatarStack", ...restProps, ref, $size: size2, children: [
|
|
1569
1564
|
len === 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(AvatarCounter, { count: len, size: size2 }) }),
|
|
@@ -2637,7 +2632,7 @@ function inlineSpaceStyle(props) {
|
|
|
2637
2632
|
}
|
|
2638
2633
|
const Root$m = styledComponents.styled(Box)(inlineBaseStyle, inlineSpaceStyle), Inline = react.forwardRef(function(props, ref) {
|
|
2639
2634
|
const { as, children: childrenProp, space, ...restProps } = props, children = react.useMemo(
|
|
2640
|
-
() =>
|
|
2635
|
+
() => react.Children.map(childrenProp, (child) => child && /* @__PURE__ */ jsxRuntime.jsx("div", { children: child })),
|
|
2641
2636
|
[childrenProp]
|
|
2642
2637
|
);
|
|
2643
2638
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -4954,10 +4949,7 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = [
|
|
|
4954
4949
|
`, Breadcrumbs = react.forwardRef(function(props, ref) {
|
|
4955
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), []);
|
|
4956
4951
|
useClickOutside(collapse, [expandElement, popoverElement]);
|
|
4957
|
-
const rawItems = react.useMemo(
|
|
4958
|
-
() => react.Children.toArray(children).filter((child) => react.isValidElement(child)),
|
|
4959
|
-
[children]
|
|
4960
|
-
), items = react.useMemo(() => {
|
|
4952
|
+
const rawItems = react.useMemo(() => react.Children.toArray(children).filter(react.isValidElement), [children]), items = react.useMemo(() => {
|
|
4961
4953
|
const len = rawItems.length;
|
|
4962
4954
|
if (maxLength && len > maxLength) {
|
|
4963
4955
|
const beforeLength = Math.ceil(maxLength / 2), afterLength = Math.floor(maxLength / 2);
|
|
@@ -6473,7 +6465,7 @@ const key = Symbol.for("@sanity/ui/context/tree"), TreeContext = createGlobalSco
|
|
|
6473
6465
|
ref.current.querySelectorAll('[data-ui="TreeItem"]')
|
|
6474
6466
|
);
|
|
6475
6467
|
setItemElements(_itemElements);
|
|
6476
|
-
}, [children
|
|
6468
|
+
}, [children]), /* @__PURE__ */ jsxRuntime.jsx(TreeContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6477
6469
|
Stack,
|
|
6478
6470
|
{
|
|
6479
6471
|
as: "ul",
|