@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.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.Children.toArray(childrenProp).filter(
1560
- (child) => typeof child != "string"
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
- () => 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: open
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, ref]), /* @__PURE__ */ jsxRuntime.jsx(TreeContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(
6468
+ }, [children]), /* @__PURE__ */ jsxRuntime.jsx(TreeContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(
6468
6469
  Stack,
6469
6470
  {
6470
6471
  as: "ul",