@sanity/ui 2.16.20 → 2.16.21

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.
@@ -2882,7 +2882,7 @@ const StyledArrow = /* @__PURE__ */ styledComponents.styled.div.withConfig({
2882
2882
  displayName: "ShapePath",
2883
2883
  componentId: "sc-12vzy6c-2"
2884
2884
  })`fill:var(--card-bg-color);`, Arrow = react.forwardRef(function(props, ref) {
2885
- const $ = reactCompilerRuntime.c(24);
2885
+ const $ = reactCompilerRuntime.c(29);
2886
2886
  let h, restProps, t0, w;
2887
2887
  $[0] !== props ? ({
2888
2888
  width: w,
@@ -2892,40 +2892,47 @@ const StyledArrow = /* @__PURE__ */ styledComponents.styled.div.withConfig({
2892
2892
  } = props, $[0] = props, $[1] = h, $[2] = restProps, $[3] = t0, $[4] = w) : (h = $[1], restProps = $[2], t0 = $[3], w = $[4]);
2893
2893
  const radius = t0 === void 0 ? 0 : t0, {
2894
2894
  card
2895
- } = useTheme_v2(), strokeWidth = card.shadow.outline, center = w / 2, points = [{
2896
- x: 0,
2897
- y: 0
2898
- }, {
2899
- x: radius,
2900
- y: 0,
2901
- radius
2902
- }, {
2903
- x: center,
2904
- y: h - 1,
2905
- radius
2906
- }, {
2907
- x: w - radius,
2908
- y: 0,
2909
- radius
2910
- }, {
2911
- x: w,
2912
- y: 0
2913
- }], cmds = getRoundedCommands(points), path = compileCommands(cmds), strokePath = `${path}`, fillPath = `${path} M ${w} -1 M 0 -1 Z`, t1 = `0 0 ${w} ${w}`;
2914
- let t2;
2915
- $[5] !== strokeWidth || $[6] !== w ? (t2 = /* @__PURE__ */ jsxRuntime.jsx("mask", { id: "stroke-mask", children: /* @__PURE__ */ jsxRuntime.jsx("rect", { x: 0, y: strokeWidth, width: w, height: w, fill: "white" }) }), $[5] = strokeWidth, $[6] = w, $[7] = t2) : t2 = $[7];
2916
- const t3 = strokeWidth * 2;
2917
- let t4;
2918
- $[8] !== strokePath || $[9] !== t3 ? (t4 = /* @__PURE__ */ jsxRuntime.jsx(StrokePath, { d: strokePath, mask: "url(#stroke-mask)", strokeWidth: t3 }), $[8] = strokePath, $[9] = t3, $[10] = t4) : t4 = $[10];
2895
+ } = useTheme_v2(), strokeWidth = card.shadow.outline, center = w / 2;
2896
+ let t1;
2897
+ if ($[5] !== center || $[6] !== h || $[7] !== radius || $[8] !== w) {
2898
+ const points = [{
2899
+ x: 0,
2900
+ y: 0
2901
+ }, {
2902
+ x: radius,
2903
+ y: 0,
2904
+ radius
2905
+ }, {
2906
+ x: center,
2907
+ y: h - 1,
2908
+ radius
2909
+ }, {
2910
+ x: w - radius,
2911
+ y: 0,
2912
+ radius
2913
+ }, {
2914
+ x: w,
2915
+ y: 0
2916
+ }], cmds = getRoundedCommands(points);
2917
+ t1 = compileCommands(cmds), $[5] = center, $[6] = h, $[7] = radius, $[8] = w, $[9] = t1;
2918
+ } else
2919
+ t1 = $[9];
2920
+ const path = t1, strokePath = `${path}`, fillPath = `${path} M ${w} -1 M 0 -1 Z`, t2 = `0 0 ${w} ${w}`;
2921
+ let t3;
2922
+ $[10] !== strokeWidth || $[11] !== w ? (t3 = /* @__PURE__ */ jsxRuntime.jsx("mask", { id: "stroke-mask", children: /* @__PURE__ */ jsxRuntime.jsx("rect", { x: 0, y: strokeWidth, width: w, height: w, fill: "white" }) }), $[10] = strokeWidth, $[11] = w, $[12] = t3) : t3 = $[12];
2923
+ const t4 = strokeWidth * 2;
2919
2924
  let t5;
2920
- $[11] !== fillPath ? (t5 = /* @__PURE__ */ jsxRuntime.jsx(ShapePath, { d: fillPath }), $[11] = fillPath, $[12] = t5) : t5 = $[12];
2925
+ $[13] !== strokePath || $[14] !== t4 ? (t5 = /* @__PURE__ */ jsxRuntime.jsx(StrokePath, { d: strokePath, mask: "url(#stroke-mask)", strokeWidth: t4 }), $[13] = strokePath, $[14] = t4, $[15] = t5) : t5 = $[15];
2921
2926
  let t6;
2922
- $[13] !== t1 || $[14] !== t2 || $[15] !== t4 || $[16] !== t5 || $[17] !== w ? (t6 = /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: w, height: w, viewBox: t1, children: [
2923
- t2,
2924
- t4,
2925
- t5
2926
- ] }), $[13] = t1, $[14] = t2, $[15] = t4, $[16] = t5, $[17] = w, $[18] = t6) : t6 = $[18];
2927
+ $[16] !== fillPath ? (t6 = /* @__PURE__ */ jsxRuntime.jsx(ShapePath, { d: fillPath }), $[16] = fillPath, $[17] = t6) : t6 = $[17];
2927
2928
  let t7;
2928
- return $[19] !== ref || $[20] !== restProps || $[21] !== t6 || $[22] !== w ? (t7 = /* @__PURE__ */ jsxRuntime.jsx(StyledArrow, { ...restProps, $w: w, ref, children: t6 }), $[19] = ref, $[20] = restProps, $[21] = t6, $[22] = w, $[23] = t7) : t7 = $[23], t7;
2929
+ $[18] !== t2 || $[19] !== t3 || $[20] !== t5 || $[21] !== t6 || $[22] !== w ? (t7 = /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: w, height: w, viewBox: t2, children: [
2930
+ t3,
2931
+ t5,
2932
+ t6
2933
+ ] }), $[18] = t2, $[19] = t3, $[20] = t5, $[21] = t6, $[22] = w, $[23] = t7) : t7 = $[23];
2934
+ let t8;
2935
+ return $[24] !== ref || $[25] !== restProps || $[26] !== t7 || $[27] !== w ? (t8 = /* @__PURE__ */ jsxRuntime.jsx(StyledArrow, { ...restProps, $w: w, ref, children: t7 }), $[24] = ref, $[25] = restProps, $[26] = t7, $[27] = w, $[28] = t8) : t8 = $[28], t8;
2929
2936
  });
2930
2937
  Arrow.displayName = "ForwardRef(Arrow)";
2931
2938
  const BoundaryElementContext = createGlobalScopedContext("@sanity/ui/context/boundaryElement", null);
@@ -3220,26 +3227,42 @@ const StyledVirtualList = styledComponents.styled.div.withConfig({
3220
3227
  displayName: "ItemWrapper",
3221
3228
  componentId: "sc-dlqsj4-1"
3222
3229
  })`position:absolute;left:0;right:0;`, VirtualList = react.forwardRef(function(props, forwardedRef) {
3223
- const {
3224
- as = "div",
3225
- gap = 0,
3230
+ const $ = reactCompilerRuntime.c(56);
3231
+ let getItemKey, onChange, renderItem, restProps, t0, t1, t2;
3232
+ $[0] !== props ? ({
3233
+ as: t0,
3234
+ gap: t1,
3226
3235
  getItemKey,
3227
- items = [],
3236
+ items: t2,
3228
3237
  onChange,
3229
3238
  renderItem,
3230
3239
  ...restProps
3231
- } = props, {
3240
+ } = props, $[0] = props, $[1] = getItemKey, $[2] = onChange, $[3] = renderItem, $[4] = restProps, $[5] = t0, $[6] = t1, $[7] = t2) : (getItemKey = $[1], onChange = $[2], renderItem = $[3], restProps = $[4], t0 = $[5], t1 = $[6], t2 = $[7]);
3241
+ const as = t0 === void 0 ? "div" : t0, gap = t1 === void 0 ? 0 : t1;
3242
+ let t3;
3243
+ $[8] !== t2 ? (t3 = t2 === void 0 ? [] : t2, $[8] = t2, $[9] = t3) : t3 = $[9];
3244
+ const items = t3, {
3232
3245
  space
3233
3246
  } = useTheme_v2(), ref = react.useRef(null), wrapperRef = react.useRef(null), [scrollTop, setScrollTop] = react.useState(0), [scrollHeight, setScrollHeight] = react.useState(0), [itemHeight, setItemHeight] = react.useState(-1);
3234
- react.useImperativeHandle(forwardedRef, () => ref.current), react.useEffect(() => {
3235
- if (!wrapperRef.current) return;
3247
+ let t4;
3248
+ $[10] === Symbol.for("react.memo_cache_sentinel") ? (t4 = () => ref.current, $[10] = t4) : t4 = $[10], react.useImperativeHandle(forwardedRef, t4);
3249
+ let t5;
3250
+ $[11] === Symbol.for("react.memo_cache_sentinel") ? (t5 = () => {
3251
+ if (!wrapperRef.current)
3252
+ return;
3236
3253
  const firstElement = wrapperRef.current.firstChild;
3237
3254
  firstElement instanceof HTMLElement && setItemHeight(firstElement.offsetHeight);
3238
- }, [renderItem]), react.useEffect(() => {
3239
- if (!ref.current) return;
3255
+ }, $[11] = t5) : t5 = $[11];
3256
+ let t6;
3257
+ $[12] !== renderItem ? (t6 = [renderItem], $[12] = renderItem, $[13] = t6) : t6 = $[13], react.useEffect(t5, t6);
3258
+ let t7, t8;
3259
+ $[14] === Symbol.for("react.memo_cache_sentinel") ? (t7 = () => {
3260
+ if (!ref.current)
3261
+ return;
3240
3262
  const scrollEl = findScrollable(ref.current.parentNode);
3241
3263
  if (scrollEl) {
3242
- if (!(scrollEl instanceof HTMLElement)) return;
3264
+ if (!(scrollEl instanceof HTMLElement))
3265
+ return;
3243
3266
  const handleScroll = () => {
3244
3267
  setScrollTop(scrollEl.scrollTop);
3245
3268
  };
@@ -3263,9 +3286,10 @@ const StyledVirtualList = styledComponents.styled.div.withConfig({
3263
3286
  }), window.addEventListener("resize", handleResize), setScrollHeight(window.innerHeight), handleScroll_0(), () => {
3264
3287
  window.removeEventListener("scroll", handleScroll_0), window.removeEventListener("resize", handleResize);
3265
3288
  };
3266
- }, []);
3289
+ }, t8 = [], $[14] = t7, $[15] = t8) : (t7 = $[14], t8 = $[15]), react.useEffect(t7, t8);
3267
3290
  const len = items.length, height = itemHeight ? len * (itemHeight + space[gap]) - space[gap] : 0, fromIndex = height ? Math.max(Math.floor(scrollTop / height * len) - 2, 0) : 0, toIndex = height ? Math.ceil((scrollTop + scrollHeight) / height * len) + 1 : 0;
3268
- react.useEffect(() => {
3291
+ let t10, t9;
3292
+ $[16] !== fromIndex || $[17] !== gap || $[18] !== itemHeight || $[19] !== onChange || $[20] !== scrollHeight || $[21] !== scrollTop || $[22] !== space || $[23] !== toIndex ? (t9 = () => {
3269
3293
  onChange && onChange({
3270
3294
  fromIndex,
3271
3295
  gap: space[gap],
@@ -3274,16 +3298,43 @@ const StyledVirtualList = styledComponents.styled.div.withConfig({
3274
3298
  scrollTop,
3275
3299
  toIndex
3276
3300
  });
3277
- }, [fromIndex, gap, itemHeight, onChange, scrollHeight, scrollTop, space, toIndex]);
3278
- const children = react.useMemo(() => !renderItem || items.length === 0 ? null : itemHeight === -1 ? [/* @__PURE__ */ jsxRuntime.jsx(ItemWrapper, { children: renderItem(items[0]) }, 0)] : items.slice(fromIndex, toIndex).map((item, _itemIndex) => {
3279
- const itemIndex = fromIndex + _itemIndex, node = renderItem(item), key2 = getItemKey ? getItemKey(item, itemIndex) : itemIndex;
3280
- return /* @__PURE__ */ jsxRuntime.jsx(ItemWrapper, { style: {
3281
- top: itemIndex * (itemHeight + space[gap])
3282
- }, children: node }, key2);
3283
- }), [fromIndex, gap, getItemKey, itemHeight, items, renderItem, space, toIndex]), wrapperStyle = react.useMemo(() => ({
3301
+ }, t10 = [fromIndex, gap, itemHeight, onChange, scrollHeight, scrollTop, space, toIndex], $[16] = fromIndex, $[17] = gap, $[18] = itemHeight, $[19] = onChange, $[20] = scrollHeight, $[21] = scrollTop, $[22] = space, $[23] = toIndex, $[24] = t10, $[25] = t9) : (t10 = $[24], t9 = $[25]), react.useEffect(t9, t10);
3302
+ let t11;
3303
+ bb0: {
3304
+ if (!renderItem || items.length === 0) {
3305
+ t11 = null;
3306
+ break bb0;
3307
+ }
3308
+ if (itemHeight === -1) {
3309
+ let t123;
3310
+ $[26] !== items[0] || $[27] !== renderItem ? (t123 = renderItem(items[0]), $[26] = items[0], $[27] = renderItem, $[28] = t123) : t123 = $[28];
3311
+ let t132;
3312
+ $[29] !== t123 ? (t132 = [/* @__PURE__ */ jsxRuntime.jsx(ItemWrapper, { children: t123 }, 0)], $[29] = t123, $[30] = t132) : t132 = $[30], t11 = t132;
3313
+ break bb0;
3314
+ }
3315
+ let t122;
3316
+ if ($[31] !== fromIndex || $[32] !== gap || $[33] !== getItemKey || $[34] !== itemHeight || $[35] !== items || $[36] !== renderItem || $[37] !== space || $[38] !== toIndex) {
3317
+ let t132;
3318
+ $[40] !== fromIndex || $[41] !== gap || $[42] !== getItemKey || $[43] !== itemHeight || $[44] !== renderItem || $[45] !== space ? (t132 = (item, _itemIndex) => {
3319
+ const itemIndex = fromIndex + _itemIndex, node = renderItem(item), key2 = getItemKey ? getItemKey(item, itemIndex) : itemIndex;
3320
+ return /* @__PURE__ */ jsxRuntime.jsx(ItemWrapper, { style: {
3321
+ top: itemIndex * (itemHeight + space[gap])
3322
+ }, children: node }, key2);
3323
+ }, $[40] = fromIndex, $[41] = gap, $[42] = getItemKey, $[43] = itemHeight, $[44] = renderItem, $[45] = space, $[46] = t132) : t132 = $[46], t122 = items.slice(fromIndex, toIndex).map(t132), $[31] = fromIndex, $[32] = gap, $[33] = getItemKey, $[34] = itemHeight, $[35] = items, $[36] = renderItem, $[37] = space, $[38] = toIndex, $[39] = t122;
3324
+ } else
3325
+ t122 = $[39];
3326
+ t11 = t122;
3327
+ }
3328
+ const children = t11;
3329
+ let t12;
3330
+ $[47] !== height ? (t12 = {
3284
3331
  height
3285
- }), [height]);
3286
- return /* @__PURE__ */ jsxRuntime.jsx(StyledVirtualList, { as, "data-ui": "VirtualList", ...restProps, ref, children: /* @__PURE__ */ jsxRuntime.jsx("div", { ref: wrapperRef, style: wrapperStyle, children }) });
3332
+ }, $[47] = height, $[48] = t12) : t12 = $[48];
3333
+ const wrapperStyle = t12;
3334
+ let t13;
3335
+ $[49] !== children || $[50] !== wrapperStyle ? (t13 = /* @__PURE__ */ jsxRuntime.jsx("div", { ref: wrapperRef, style: wrapperStyle, children }), $[49] = children, $[50] = wrapperStyle, $[51] = t13) : t13 = $[51];
3336
+ let t14;
3337
+ return $[52] !== as || $[53] !== restProps || $[54] !== t13 ? (t14 = /* @__PURE__ */ jsxRuntime.jsx(StyledVirtualList, { as, "data-ui": "VirtualList", ...restProps, ref, children: t13 }), $[52] = as, $[53] = restProps, $[54] = t13, $[55] = t14) : t14 = $[55], t14;
3287
3338
  });
3288
3339
  VirtualList.displayName = "ForwardRef(VirtualList)";
3289
3340
  function findScrollable(parentNode) {