@sanity/ui 2.8.2 → 2.8.3

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 CHANGED
@@ -4982,8 +4982,8 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = [
4982
4982
  appearance: none;
4983
4983
  margin: -4px;
4984
4984
  `, Breadcrumbs = forwardRef(function(props, ref) {
4985
- const { children, maxLength, separator, space: spaceRaw = 2, ...restProps } = props, space = useArrayProp(spaceRaw), [open, setOpen] = useState(!1), [expandElement, setExpandElement] = useState(null), [popoverElement, setPopoverElement] = useState(null), collapse = useCallback(() => setOpen(!1), []), expand = useCallback(() => setOpen(!0), []);
4986
- useClickOutside(collapse, [expandElement, popoverElement]);
4985
+ const { children, maxLength, separator, space: spaceRaw = 2, ...restProps } = props, space = useArrayProp(spaceRaw), [open, setOpen] = useState(!1), expandElementRef = useRef(null), popoverElementRef = useRef(null), collapse = useCallback(() => setOpen(!1), []), expand = useCallback(() => setOpen(!0), []);
4986
+ useClickOutsideEvent(collapse, () => [expandElementRef.current, popoverElementRef.current]);
4987
4987
  const rawItems = useMemo(() => Children.toArray(children).filter(isValidElement), [children]), items = useMemo(() => {
4988
4988
  const len = rawItems.length;
4989
4989
  if (maxLength && len > maxLength) {
@@ -4998,7 +4998,7 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = [
4998
4998
  open,
4999
4999
  placement: "top",
5000
5000
  portal: !0,
5001
- ref: setPopoverElement,
5001
+ ref: popoverElementRef,
5002
5002
  children: /* @__PURE__ */ jsx(
5003
5003
  ExpandButton,
5004
5004
  {
@@ -5006,7 +5006,7 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = [
5006
5006
  mode: "bleed",
5007
5007
  onClick: open ? collapse : expand,
5008
5008
  padding: 1,
5009
- ref: setExpandElement,
5009
+ ref: expandElementRef,
5010
5010
  selected: open,
5011
5011
  text: "\u2026"
5012
5012
  }