@sanity/ui 2.3.4 → 2.3.6-0
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 +12 -18
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +10 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -18
- package/dist/index.mjs.map +1 -1
- package/package.json +25 -33
- 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/tooltip/tooltip.tsx +4 -0
- 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(
|
|
@@ -4472,7 +4467,9 @@ const Root$a = styledComponents.styled(Layer)`
|
|
|
4472
4467
|
ref.current = node, refs.setFloating(node);
|
|
4473
4468
|
},
|
|
4474
4469
|
[refs]
|
|
4475
|
-
), childRef = react.useRef(null)
|
|
4470
|
+
), childRef = react.useRef(null);
|
|
4471
|
+
react.useImperativeHandle(childProp == null ? void 0 : childProp.ref, () => childRef.current);
|
|
4472
|
+
const child = react.useMemo(() => childProp ? react.cloneElement(childProp, {
|
|
4476
4473
|
onBlur: handleBlur,
|
|
4477
4474
|
onFocus: handleFocus,
|
|
4478
4475
|
onMouseEnter: handleMouseEnter,
|
|
@@ -4954,10 +4951,7 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = [
|
|
|
4954
4951
|
`, Breadcrumbs = react.forwardRef(function(props, ref) {
|
|
4955
4952
|
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
4953
|
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(() => {
|
|
4954
|
+
const rawItems = react.useMemo(() => react.Children.toArray(children).filter(react.isValidElement), [children]), items = react.useMemo(() => {
|
|
4961
4955
|
const len = rawItems.length;
|
|
4962
4956
|
if (maxLength && len > maxLength) {
|
|
4963
4957
|
const beforeLength = Math.ceil(maxLength / 2), afterLength = Math.floor(maxLength / 2);
|
|
@@ -6473,7 +6467,7 @@ const key = Symbol.for("@sanity/ui/context/tree"), TreeContext = createGlobalSco
|
|
|
6473
6467
|
ref.current.querySelectorAll('[data-ui="TreeItem"]')
|
|
6474
6468
|
);
|
|
6475
6469
|
setItemElements(_itemElements);
|
|
6476
|
-
}, [children
|
|
6470
|
+
}, [children]), /* @__PURE__ */ jsxRuntime.jsx(TreeContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6477
6471
|
Stack,
|
|
6478
6472
|
{
|
|
6479
6473
|
as: "ul",
|