@sanity/ui 2.16.20 → 2.16.22

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.mjs CHANGED
@@ -6,7 +6,7 @@ import { useState, useRef, useEffect, useImperativeHandle, Component, forwardRef
6
6
  import { styled, keyframes, css } from "styled-components";
7
7
  import { c } from "react-compiler-runtime";
8
8
  import { getTheme_v2 } from "@sanity/ui/theme";
9
- import { motion, AnimatePresence } from "framer-motion";
9
+ import { motion, AnimatePresence } from "motion/react";
10
10
  function _raf(fn) {
11
11
  const frameId = requestAnimationFrame(fn);
12
12
  return () => {
@@ -441,26 +441,63 @@ const Autocomplete = InnerAutocomplete, StyledBreadcrumbs = styled.ol.withConfig
441
441
  displayName: "ExpandButton",
442
442
  componentId: "sc-1es8h8q-1"
443
443
  })`appearance:none;margin:-4px;`, Breadcrumbs = forwardRef(function(props, ref) {
444
- const {
444
+ const $ = c(44);
445
+ let children, maxLength, restProps, separator, t0;
446
+ $[0] !== props ? ({
445
447
  children,
446
448
  maxLength,
447
449
  separator,
448
- space: spaceRaw = 2,
450
+ space: t0,
449
451
  ...restProps
450
- } = props, space = useArrayProp(spaceRaw), [open, setOpen] = useState(!1), expandElementRef = useRef(null), popoverElementRef = useRef(null), collapse = useCallback(() => setOpen(!1), []), expand = useCallback(() => setOpen(!0), []);
451
- useClickOutsideEvent(collapse, () => [expandElementRef.current, popoverElementRef.current]);
452
- const rawItems = useMemo(() => Children.toArray(children).filter(isValidElement), [children]), items = useMemo(() => {
452
+ } = props, $[0] = props, $[1] = children, $[2] = maxLength, $[3] = restProps, $[4] = separator, $[5] = t0) : (children = $[1], maxLength = $[2], restProps = $[3], separator = $[4], t0 = $[5]);
453
+ const space = useArrayProp(t0 === void 0 ? 2 : t0), [open, setOpen] = useState(!1), expandElementRef = useRef(null), popoverElementRef = useRef(null);
454
+ let t1;
455
+ $[6] === Symbol.for("react.memo_cache_sentinel") ? (t1 = () => setOpen(!1), $[6] = t1) : t1 = $[6];
456
+ const collapse = t1;
457
+ let t2;
458
+ $[7] === Symbol.for("react.memo_cache_sentinel") ? (t2 = () => setOpen(!0), $[7] = t2) : t2 = $[7];
459
+ const expand = t2;
460
+ let t3;
461
+ $[8] === Symbol.for("react.memo_cache_sentinel") ? (t3 = () => [expandElementRef.current, popoverElementRef.current], $[8] = t3) : t3 = $[8], useClickOutsideEvent(collapse, t3);
462
+ let t4;
463
+ $[9] !== children ? (t4 = Children.toArray(children).filter(isValidElement), $[9] = children, $[10] = t4) : t4 = $[10];
464
+ const rawItems = t4;
465
+ let t5;
466
+ bb0: {
453
467
  const len = rawItems.length;
454
468
  if (maxLength && len > maxLength) {
455
469
  const beforeLength = Math.ceil(maxLength / 2), afterLength = Math.floor(maxLength / 2);
456
- 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)];
470
+ let t62;
471
+ if ($[11] !== afterLength || $[12] !== beforeLength || $[13] !== len || $[14] !== open || $[15] !== rawItems || $[16] !== space) {
472
+ const t72 = rawItems.slice(0, beforeLength - 1);
473
+ let t8;
474
+ $[18] !== afterLength || $[19] !== beforeLength || $[20] !== len || $[21] !== rawItems ? (t8 = rawItems.slice(beforeLength - 1, len - afterLength), $[18] = afterLength, $[19] = beforeLength, $[20] = len, $[21] = rawItems, $[22] = t8) : t8 = $[22];
475
+ let t9;
476
+ $[23] !== space || $[24] !== t8 ? (t9 = /* @__PURE__ */ jsx(Stack, { as: "ol", overflow: "auto", padding: space, space, children: t8 }), $[23] = space, $[24] = t8, $[25] = t9) : t9 = $[25];
477
+ const t10 = open ? collapse : expand;
478
+ let t11;
479
+ $[26] !== open || $[27] !== t10 ? (t11 = /* @__PURE__ */ jsx(ExpandButton, { fontSize: 1, mode: "bleed", onClick: t10, padding: 1, ref: expandElementRef, selected: open, text: "\u2026" }), $[26] = open, $[27] = t10, $[28] = t11) : t11 = $[28];
480
+ let t12;
481
+ $[29] !== open || $[30] !== t11 || $[31] !== t9 ? (t12 = /* @__PURE__ */ jsx(Popover, { constrainSize: !0, content: t9, open, placement: "top", portal: !0, ref: popoverElementRef, children: t11 }, "button"), $[29] = open, $[30] = t11, $[31] = t9, $[32] = t12) : t12 = $[32], t62 = [...t72, t12, ...rawItems.slice(len - afterLength)], $[11] = afterLength, $[12] = beforeLength, $[13] = len, $[14] = open, $[15] = rawItems, $[16] = space, $[17] = t62;
482
+ } else
483
+ t62 = $[17];
484
+ t5 = t62;
485
+ break bb0;
457
486
  }
458
- return rawItems;
459
- }, [collapse, expand, maxLength, open, rawItems, space]);
460
- return /* @__PURE__ */ jsx(StyledBreadcrumbs, { "data-ui": "Breadcrumbs", ...restProps, ref, children: items.map((item, itemIndex) => /* @__PURE__ */ jsxs(Fragment, { children: [
461
- itemIndex > 0 && /* @__PURE__ */ jsx(Box, { "aria-hidden": !0, as: "li", paddingX: space, children: separator || /* @__PURE__ */ jsx(Text, { muted: !0, children: "/" }) }),
462
- /* @__PURE__ */ jsx(Box, { as: "li", children: item })
463
- ] }, itemIndex)) });
487
+ t5 = rawItems;
488
+ }
489
+ const items = t5;
490
+ let t6;
491
+ if ($[33] !== items || $[34] !== separator || $[35] !== space) {
492
+ let t72;
493
+ $[37] !== separator || $[38] !== space ? (t72 = (item, itemIndex) => /* @__PURE__ */ jsxs(Fragment, { children: [
494
+ itemIndex > 0 && /* @__PURE__ */ jsx(Box, { "aria-hidden": !0, as: "li", paddingX: space, children: separator || /* @__PURE__ */ jsx(Text, { muted: !0, children: "/" }) }),
495
+ /* @__PURE__ */ jsx(Box, { as: "li", children: item })
496
+ ] }, itemIndex), $[37] = separator, $[38] = space, $[39] = t72) : t72 = $[39], t6 = items.map(t72), $[33] = items, $[34] = separator, $[35] = space, $[36] = t6;
497
+ } else
498
+ t6 = $[36];
499
+ let t7;
500
+ return $[40] !== ref || $[41] !== restProps || $[42] !== t6 ? (t7 = /* @__PURE__ */ jsx(StyledBreadcrumbs, { "data-ui": "Breadcrumbs", ...restProps, ref, children: t6 }), $[40] = ref, $[41] = restProps, $[42] = t6, $[43] = t7) : t7 = $[43], t7;
464
501
  });
465
502
  Breadcrumbs.displayName = "ForwardRef(Breadcrumbs)";
466
503
  function dialogStyle({