@sanity/ui 2.9.0-canary.1 → 2.9.0-canary.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
@@ -3931,6 +3931,7 @@ const Popover = memo(forwardRef(function(props, forwardedRef) {
3931
3931
  }));
3932
3932
  Popover.displayName = "Memo(ForwardRef(Popover))";
3933
3933
  function getElementRef(element) {
3934
+ if (!element) return null;
3934
3935
  let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get, mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
3935
3936
  return mayWarn ? element.ref : (getter = Object.getOwnPropertyDescriptor(element, "ref")?.get, mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning, mayWarn ? element.props.ref : element.props.ref || element.ref);
3936
3937
  }
@@ -5347,26 +5348,46 @@ const Autocomplete = InnerAutocomplete, Root$8 = styled.ol`
5347
5348
  appearance: none;
5348
5349
  margin: -4px;
5349
5350
  `, Breadcrumbs = forwardRef(function(props, ref) {
5350
- const {
5351
+ const $ = c(37);
5352
+ let t0, children, maxLength, restProps, separator;
5353
+ $[0] !== props ? ({
5351
5354
  children,
5352
5355
  maxLength,
5353
5356
  separator,
5354
- space: spaceRaw = 2,
5357
+ space: t0,
5355
5358
  ...restProps
5356
- } = props, space = useArrayProp(spaceRaw), [open, setOpen] = useState(!1), expandElementRef = useRef(null), popoverElementRef = useRef(null), collapse = useCallback(() => setOpen(!1), []), expand = useCallback(() => setOpen(!0), []);
5357
- useClickOutsideEvent(collapse, () => [expandElementRef.current, popoverElementRef.current]);
5358
- const rawItems = useMemo(() => Children.toArray(children).filter(isValidElement), [children]), items = useMemo(() => {
5359
+ } = props, $[0] = props, $[1] = t0, $[2] = children, $[3] = maxLength, $[4] = restProps, $[5] = separator) : (t0 = $[1], children = $[2], maxLength = $[3], restProps = $[4], separator = $[5]);
5360
+ const space = useArrayProp(t0 === void 0 ? 2 : t0), [open, setOpen] = useState(!1), expandElementRef = useRef(null), popoverElementRef = useRef(null);
5361
+ let t1;
5362
+ $[6] === Symbol.for("react.memo_cache_sentinel") ? (t1 = () => setOpen(!1), $[6] = t1) : t1 = $[6];
5363
+ const collapse = t1;
5364
+ let t2;
5365
+ $[7] === Symbol.for("react.memo_cache_sentinel") ? (t2 = () => setOpen(!0), $[7] = t2) : t2 = $[7];
5366
+ const expand = t2;
5367
+ let t3;
5368
+ $[8] === Symbol.for("react.memo_cache_sentinel") ? (t3 = () => [expandElementRef.current, popoverElementRef.current], $[8] = t3) : t3 = $[8], useClickOutsideEvent(collapse, t3);
5369
+ let T0, t4, t5, t6, t7;
5370
+ if ($[9] !== children || $[10] !== maxLength || $[11] !== space || $[12] !== open || $[13] !== restProps || $[14] !== ref || $[15] !== separator) {
5371
+ const rawItems = Children.toArray(children).filter(isValidElement);
5372
+ let items = rawItems;
5359
5373
  const len = rawItems.length;
5360
- if (maxLength && len > maxLength) {
5361
- const beforeLength = Math.ceil(maxLength / 2), afterLength = Math.floor(maxLength / 2);
5362
- return [...rawItems.slice(0, beforeLength - 1), /* @__PURE__ */ jsx(Popover, { constrainSize: !0, content: /* @__PURE__ */ jsx(Stack, { as: "ol", overflow: "auto", padding: space, space, children: rawItems.slice(beforeLength - 1, len - afterLength) }), open, placement: "top", portal: !0, ref: popoverElementRef, children: /* @__PURE__ */ jsx(ExpandButton, { fontSize: 1, mode: "bleed", onClick: open ? collapse : expand, padding: 1, ref: expandElementRef, selected: open, text: "\u2026" }) }, "button"), ...rawItems.slice(len - afterLength)];
5363
- }
5364
- return rawItems;
5365
- }, [collapse, expand, maxLength, open, rawItems, space]);
5366
- return /* @__PURE__ */ jsx(Root$8, { "data-ui": "Breadcrumbs", ...restProps, ref, children: items.map((item, itemIndex) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
5367
- itemIndex > 0 && /* @__PURE__ */ jsx(Box, { "aria-hidden": !0, as: "li", paddingX: space, children: separator || /* @__PURE__ */ jsx(Text, { muted: !0, children: "/" }) }),
5368
- /* @__PURE__ */ jsx(Box, { as: "li", children: item })
5369
- ] }, itemIndex)) });
5374
+ if (maxLength && rawItems.length > maxLength) {
5375
+ const beforeLength = Math.ceil(maxLength / 2), afterLength = Math.floor(maxLength / 2), t83 = /* @__PURE__ */ jsx(Stack, { as: "ol", overflow: "auto", padding: space, space, children: rawItems.slice(beforeLength - 1, len - afterLength) }), t9 = open ? collapse : expand;
5376
+ let t10;
5377
+ $[21] !== t9 || $[22] !== open ? (t10 = /* @__PURE__ */ jsx(ExpandButton, { fontSize: 1, mode: "bleed", onClick: t9, padding: 1, ref: expandElementRef, selected: open, text: "\u2026" }), $[21] = t9, $[22] = open, $[23] = t10) : t10 = $[23];
5378
+ let t11;
5379
+ $[24] !== t83 || $[25] !== open || $[26] !== t10 ? (t11 = /* @__PURE__ */ jsx(Popover, { constrainSize: !0, content: t83, open, placement: "top", portal: !0, ref: popoverElementRef, children: t10 }, "button"), $[24] = t83, $[25] = open, $[26] = t10, $[27] = t11) : t11 = $[27], items = [...rawItems.slice(0, beforeLength - 1), t11, ...rawItems.slice(len - afterLength)];
5380
+ }
5381
+ T0 = Root$8, t4 = "Breadcrumbs", t5 = restProps, t6 = ref;
5382
+ let t82;
5383
+ $[28] !== space || $[29] !== separator ? (t82 = (item, itemIndex) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
5384
+ itemIndex > 0 && /* @__PURE__ */ jsx(Box, { "aria-hidden": !0, as: "li", paddingX: space, children: separator || /* @__PURE__ */ jsx(Text, { muted: !0, children: "/" }) }),
5385
+ /* @__PURE__ */ jsx(Box, { as: "li", children: item })
5386
+ ] }, itemIndex), $[28] = space, $[29] = separator, $[30] = t82) : t82 = $[30], t7 = items.map(t82), $[9] = children, $[10] = maxLength, $[11] = space, $[12] = open, $[13] = restProps, $[14] = ref, $[15] = separator, $[16] = T0, $[17] = t4, $[18] = t5, $[19] = t6, $[20] = t7;
5387
+ } else
5388
+ T0 = $[16], t4 = $[17], t5 = $[18], t6 = $[19], t7 = $[20];
5389
+ let t8;
5390
+ return $[31] !== T0 || $[32] !== t4 || $[33] !== t5 || $[34] !== t6 || $[35] !== t7 ? (t8 = /* @__PURE__ */ jsx(T0, { "data-ui": t4, ...t5, ref: t6, children: t7 }), $[31] = T0, $[32] = t4, $[33] = t5, $[34] = t6, $[35] = t7, $[36] = t8) : t8 = $[36], t8;
5370
5391
  });
5371
5392
  Breadcrumbs.displayName = "ForwardRef(Breadcrumbs)";
5372
5393
  function dialogStyle({