@sanity/ui 3.0.11 → 3.0.12-canary.0

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.
@@ -3213,26 +3213,42 @@ const StyledVirtualList = styledComponents.styled.div.withConfig({
3213
3213
  displayName: "ItemWrapper",
3214
3214
  componentId: "sc-dlqsj4-1"
3215
3215
  })`position:absolute;left:0;right:0;`, VirtualList = react.forwardRef(function(props, forwardedRef) {
3216
- const {
3217
- as = "div",
3218
- gap = 0,
3216
+ const $ = reactCompilerRuntime.c(44);
3217
+ let getItemKey, onChange, renderItem, restProps, t0, t1, t2;
3218
+ $[0] !== props ? ({
3219
+ as: t0,
3220
+ gap: t1,
3219
3221
  getItemKey,
3220
- items = [],
3222
+ items: t2,
3221
3223
  onChange,
3222
3224
  renderItem,
3223
3225
  ...restProps
3224
- } = props, {
3226
+ } = 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]);
3227
+ const as = t0 === void 0 ? "div" : t0, gap = t1 === void 0 ? 0 : t1;
3228
+ let t3;
3229
+ $[8] !== t2 ? (t3 = t2 === void 0 ? [] : t2, $[8] = t2, $[9] = t3) : t3 = $[9];
3230
+ const items = t3, {
3225
3231
  space
3226
3232
  } = 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);
3227
- react.useImperativeHandle(forwardedRef, () => ref.current), react.useEffect(() => {
3228
- if (!wrapperRef.current) return;
3233
+ let t4;
3234
+ $[10] === Symbol.for("react.memo_cache_sentinel") ? (t4 = () => ref.current, $[10] = t4) : t4 = $[10], react.useImperativeHandle(forwardedRef, t4);
3235
+ let t5;
3236
+ $[11] === Symbol.for("react.memo_cache_sentinel") ? (t5 = () => {
3237
+ if (!wrapperRef.current)
3238
+ return;
3229
3239
  const firstElement = wrapperRef.current.firstChild;
3230
3240
  firstElement instanceof HTMLElement && setItemHeight(firstElement.offsetHeight);
3231
- }, [renderItem]), react.useEffect(() => {
3232
- if (!ref.current) return;
3241
+ }, $[11] = t5) : t5 = $[11];
3242
+ let t6;
3243
+ $[12] !== renderItem ? (t6 = [renderItem], $[12] = renderItem, $[13] = t6) : t6 = $[13], react.useEffect(t5, t6);
3244
+ let t7, t8;
3245
+ $[14] === Symbol.for("react.memo_cache_sentinel") ? (t7 = () => {
3246
+ if (!ref.current)
3247
+ return;
3233
3248
  const scrollEl = findScrollable(ref.current.parentNode);
3234
3249
  if (scrollEl) {
3235
- if (!(scrollEl instanceof HTMLElement)) return;
3250
+ if (!(scrollEl instanceof HTMLElement))
3251
+ return;
3236
3252
  const handleScroll = () => {
3237
3253
  setScrollTop(scrollEl.scrollTop);
3238
3254
  };
@@ -3256,9 +3272,10 @@ const StyledVirtualList = styledComponents.styled.div.withConfig({
3256
3272
  }), window.addEventListener("resize", handleResize), setScrollHeight(window.innerHeight), handleScroll_0(), () => {
3257
3273
  window.removeEventListener("scroll", handleScroll_0), window.removeEventListener("resize", handleResize);
3258
3274
  };
3259
- }, []);
3275
+ }, t8 = [], $[14] = t7, $[15] = t8) : (t7 = $[14], t8 = $[15]), react.useEffect(t7, t8);
3260
3276
  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;
3261
- react.useEffect(() => {
3277
+ let t10, t9;
3278
+ $[16] !== fromIndex || $[17] !== gap || $[18] !== itemHeight || $[19] !== onChange || $[20] !== scrollHeight || $[21] !== scrollTop || $[22] !== space || $[23] !== toIndex ? (t9 = () => {
3262
3279
  onChange && onChange({
3263
3280
  fromIndex,
3264
3281
  gap: space[gap],
@@ -3267,18 +3284,61 @@ const StyledVirtualList = styledComponents.styled.div.withConfig({
3267
3284
  scrollTop,
3268
3285
  toIndex
3269
3286
  });
3270
- }, [fromIndex, gap, itemHeight, onChange, scrollHeight, scrollTop, space, toIndex]);
3271
- 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) => {
3272
- const itemIndex = fromIndex + _itemIndex, node = renderItem(item), key2 = getItemKey ? getItemKey(item, itemIndex) : itemIndex;
3273
- return /* @__PURE__ */ jsxRuntime.jsx(ItemWrapper, { style: {
3274
- top: itemIndex * (itemHeight + space[gap])
3275
- }, children: node }, key2);
3276
- }), [fromIndex, gap, getItemKey, itemHeight, items, renderItem, space, toIndex]), wrapperStyle = react.useMemo(() => ({
3287
+ }, 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);
3288
+ let t11;
3289
+ $[26] !== fromIndex || $[27] !== gap || $[28] !== getItemKey || $[29] !== itemHeight || $[30] !== items || $[31] !== renderItem || $[32] !== space || $[33] !== toIndex ? (t11 = {
3290
+ fromIndex,
3291
+ gap,
3292
+ itemHeight,
3293
+ space,
3294
+ toIndex,
3295
+ getItemKey,
3296
+ items,
3297
+ renderItem
3298
+ }, $[26] = fromIndex, $[27] = gap, $[28] = getItemKey, $[29] = itemHeight, $[30] = items, $[31] = renderItem, $[32] = space, $[33] = toIndex, $[34] = t11) : t11 = $[34];
3299
+ const children = useChildren(t11);
3300
+ let t12;
3301
+ $[35] !== height ? (t12 = {
3277
3302
  height
3278
- }), [height]);
3279
- return /* @__PURE__ */ jsxRuntime.jsx(StyledVirtualList, { as, "data-ui": "VirtualList", ...restProps, ref, children: /* @__PURE__ */ jsxRuntime.jsx("div", { ref: wrapperRef, style: wrapperStyle, children }) });
3303
+ }, $[35] = height, $[36] = t12) : t12 = $[36];
3304
+ let t13;
3305
+ $[37] !== children || $[38] !== t12 ? (t13 = /* @__PURE__ */ jsxRuntime.jsx("div", { ref: wrapperRef, style: t12, children }), $[37] = children, $[38] = t12, $[39] = t13) : t13 = $[39];
3306
+ let t14;
3307
+ return $[40] !== as || $[41] !== restProps || $[42] !== t13 ? (t14 = /* @__PURE__ */ jsxRuntime.jsx(StyledVirtualList, { as, "data-ui": "VirtualList", ...restProps, ref, children: t13 }), $[40] = as, $[41] = restProps, $[42] = t13, $[43] = t14) : t14 = $[43], t14;
3280
3308
  });
3281
3309
  VirtualList.displayName = "ForwardRef(VirtualList)";
3310
+ function useChildren(t0) {
3311
+ const $ = reactCompilerRuntime.c(21), {
3312
+ fromIndex,
3313
+ gap,
3314
+ getItemKey,
3315
+ itemHeight,
3316
+ items,
3317
+ renderItem,
3318
+ space,
3319
+ toIndex
3320
+ } = t0;
3321
+ if (!renderItem || items.length === 0)
3322
+ return null;
3323
+ if (itemHeight === -1) {
3324
+ let t12;
3325
+ $[0] !== items[0] || $[1] !== renderItem ? (t12 = renderItem(items[0]), $[0] = items[0], $[1] = renderItem, $[2] = t12) : t12 = $[2];
3326
+ let t2;
3327
+ return $[3] !== t12 ? (t2 = [/* @__PURE__ */ jsxRuntime.jsx(ItemWrapper, { children: t12 }, 0)], $[3] = t12, $[4] = t2) : t2 = $[4], t2;
3328
+ }
3329
+ let t1;
3330
+ if ($[5] !== fromIndex || $[6] !== gap || $[7] !== getItemKey || $[8] !== itemHeight || $[9] !== items || $[10] !== renderItem || $[11] !== space || $[12] !== toIndex) {
3331
+ let t2;
3332
+ $[14] !== fromIndex || $[15] !== gap || $[16] !== getItemKey || $[17] !== itemHeight || $[18] !== renderItem || $[19] !== space ? (t2 = (item, _itemIndex) => {
3333
+ const itemIndex = fromIndex + _itemIndex, node = renderItem(item), key2 = getItemKey ? getItemKey(item, itemIndex) : itemIndex;
3334
+ return /* @__PURE__ */ jsxRuntime.jsx(ItemWrapper, { style: {
3335
+ top: itemIndex * (itemHeight + space[gap])
3336
+ }, children: node }, key2);
3337
+ }, $[14] = fromIndex, $[15] = gap, $[16] = getItemKey, $[17] = itemHeight, $[18] = renderItem, $[19] = space, $[20] = t2) : t2 = $[20], t1 = items.slice(fromIndex, toIndex).map(t2), $[5] = fromIndex, $[6] = gap, $[7] = getItemKey, $[8] = itemHeight, $[9] = items, $[10] = renderItem, $[11] = space, $[12] = toIndex, $[13] = t1;
3338
+ } else
3339
+ t1 = $[13];
3340
+ return t1;
3341
+ }
3282
3342
  function findScrollable(parentNode) {
3283
3343
  let _scrollEl = parentNode;
3284
3344
  for (; _scrollEl && !_isScrollable(_scrollEl); )
@@ -3305,9 +3365,14 @@ const DEFAULT_POPOVER_DISTANCE = 4, DEFAULT_POPOVER_PADDING = 4, DEFAULT_POPOVER
3305
3365
  };
3306
3366
  function size(options) {
3307
3367
  const {
3308
- apply,
3368
+ constrainSize,
3309
3369
  margins,
3310
- padding = 0
3370
+ matchReferenceWidth,
3371
+ maxWidthRef,
3372
+ padding = 0,
3373
+ referenceWidthRef,
3374
+ setReferenceWidth,
3375
+ widthRef
3311
3376
  } = options;
3312
3377
  return {
3313
3378
  name: "@sanity/ui/size",
@@ -3329,12 +3394,9 @@ function size(options) {
3329
3394
  });
3330
3395
  let maxWidth = 1 / 0, maxHeight = 1 / 0;
3331
3396
  const floatingW = floating.width, floatingH = floating.height;
3332
- placement.includes("top") && (maxWidth = floatingW - (overflow.left + overflow.right), maxHeight = floatingH - overflow.top), placement.includes("right") && (maxWidth = floatingW - overflow.right, maxHeight = floatingH - (overflow.top + overflow.bottom)), placement.includes("bottom") && (maxWidth = floatingW - (overflow.left + overflow.right), maxHeight = floatingH - overflow.bottom), placement.includes("left") && (maxWidth = floatingW - overflow.left, maxHeight = floatingH - (overflow.top + overflow.bottom)), apply({
3333
- availableWidth: maxWidth - margins[1] - margins[3],
3334
- availableHeight: maxHeight - margins[0] - margins[2],
3335
- elements,
3336
- referenceWidth: reference.width - margins[1] - margins[3]
3337
- });
3397
+ placement.includes("top") && (maxWidth = floatingW - (overflow.left + overflow.right), maxHeight = floatingH - overflow.top), placement.includes("right") && (maxWidth = floatingW - overflow.right, maxHeight = floatingH - (overflow.top + overflow.bottom)), placement.includes("bottom") && (maxWidth = floatingW - (overflow.left + overflow.right), maxHeight = floatingH - overflow.bottom), placement.includes("left") && (maxWidth = floatingW - overflow.left, maxHeight = floatingH - (overflow.top + overflow.bottom));
3398
+ const availableWidth = maxWidth - margins[1] - margins[3], availableHeight = maxHeight - margins[0] - margins[2], referenceWidth = reference.width - margins[1] - margins[3];
3399
+ referenceWidthRef.current = referenceWidth, setReferenceWidth(referenceWidth), matchReferenceWidth ? elements.floating.style.width = `${referenceWidth}px` : widthRef.current !== void 0 && (elements.floating.style.width = `${widthRef.current}px`), constrainSize && (elements.floating.style.maxWidth = `${Math.min(availableWidth, maxWidthRef.current ?? 1 / 0)}px`, elements.floating.style.maxHeight = `${availableHeight}px`);
3338
3400
  const nextDimensions = await platform.getDimensions(elements.floating), targetH = nextDimensions.height, targetW = nextDimensions.width;
3339
3401
  return floatingW !== targetW || floatingH !== targetH ? {
3340
3402
  reset: {
@@ -3449,103 +3511,115 @@ const ViewportOverlay = () => {
3449
3511
  zIndex
3450
3512
  } }), $[0] = zIndex, $[1] = t0) : t0 = $[1], t0;
3451
3513
  }, Popover = react.memo(react.forwardRef(function(props, forwardedRef) {
3452
- const {
3514
+ const $ = reactCompilerRuntime.c(122), {
3453
3515
  container,
3454
3516
  layer
3455
- } = useTheme_v2(), boundaryElementContext = useBoundaryElement(), {
3456
- __unstable_margins: margins = DEFAULT_POPOVER_MARGINS,
3457
- animate: _animate = !1,
3458
- arrow: arrowProp = !1,
3459
- boundaryElement = boundaryElementContext.element,
3460
- children: childProp,
3461
- constrainSize = !1,
3462
- content,
3463
- disabled,
3464
- fallbackPlacements = props.fallbackPlacements ?? DEFAULT_FALLBACK_PLACEMENTS$1[props.placement ?? "bottom"],
3465
- matchReferenceWidth,
3466
- floatingBoundary = props.boundaryElement ?? boundaryElementContext.element,
3467
- modal,
3468
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
3469
- onActivate,
3470
- open,
3471
- overflow = "hidden",
3472
- padding: paddingProp,
3473
- placement: placementProp = "bottom",
3474
- placementStrategy = "flip",
3475
- portal,
3476
- preventOverflow = !0,
3477
- radius: radiusProp = 3,
3478
- referenceBoundary = props.boundaryElement ?? boundaryElementContext.element,
3479
- referenceElement,
3480
- scheme,
3481
- shadow: shadowProp = 3,
3482
- tone = "inherit",
3483
- width: widthProp = "auto",
3484
- zOffset: zOffsetProp = layer.popover.zOffset,
3485
- updateRef,
3486
- ...restProps
3487
- } = props, animate = usePrefersReducedMotion() ? !1 : _animate, boundarySize = useElementSize(boundaryElement)?.border, padding = useArrayProp(paddingProp), radius = useArrayProp(radiusProp), shadow = useArrayProp(shadowProp), widthArrayProp = useArrayProp(widthProp), zOffset = useArrayProp(zOffsetProp), ref = react.useRef(null), arrowRef = react.useRef(null), rootBoundary = "viewport";
3488
- react.useImperativeHandle(forwardedRef, () => ref.current);
3489
- const mediaIndex = useMediaIndex(), boundaryWidth = constrainSize || preventOverflow ? boundarySize?.width : void 0, width = calcCurrentWidth({
3517
+ } = useTheme_v2(), boundaryElementContext = useBoundaryElement();
3518
+ let _boundaryElement, _fallbackPlacements, _floatingBoundary, _referenceBoundary, _zOffsetProp, childProp, content, disabled, matchReferenceWidth, modal, open, paddingProp, portal, referenceElement, restProps, scheme, t0, t1, t10, t11, t2, t3, t4, t5, t6, t7, t8, t9, updateRef;
3519
+ if ($[0] !== props) {
3520
+ const {
3521
+ __unstable_margins: t122,
3522
+ animate: t132,
3523
+ arrow: t142,
3524
+ boundaryElement: t152,
3525
+ children: t162,
3526
+ constrainSize: t172,
3527
+ content: t182,
3528
+ disabled: t192,
3529
+ fallbackPlacements: t202,
3530
+ matchReferenceWidth: t212,
3531
+ floatingBoundary: t222,
3532
+ modal: t232,
3533
+ onActivate,
3534
+ open: t242,
3535
+ overflow: t252,
3536
+ padding: t262,
3537
+ placement: t272,
3538
+ placementStrategy: t282,
3539
+ portal: t292,
3540
+ preventOverflow: t302,
3541
+ radius: t312,
3542
+ referenceBoundary: t322,
3543
+ referenceElement: t332,
3544
+ scheme: t342,
3545
+ shadow: t352,
3546
+ tone: t362,
3547
+ width: t372,
3548
+ zOffset: t38,
3549
+ updateRef: t39,
3550
+ ...t40
3551
+ } = props;
3552
+ t0 = t122, t1 = t132, t2 = t142, _boundaryElement = t152, childProp = t162, t3 = t172, content = t182, disabled = t192, _fallbackPlacements = t202, matchReferenceWidth = t212, _floatingBoundary = t222, modal = t232, open = t242, t4 = t252, paddingProp = t262, t5 = t272, t6 = t282, portal = t292, t7 = t302, t8 = t312, _referenceBoundary = t322, referenceElement = t332, scheme = t342, t9 = t352, t10 = t362, t11 = t372, _zOffsetProp = t38, updateRef = t39, restProps = t40, $[0] = props, $[1] = _boundaryElement, $[2] = _fallbackPlacements, $[3] = _floatingBoundary, $[4] = _referenceBoundary, $[5] = _zOffsetProp, $[6] = childProp, $[7] = content, $[8] = disabled, $[9] = matchReferenceWidth, $[10] = modal, $[11] = open, $[12] = paddingProp, $[13] = portal, $[14] = referenceElement, $[15] = restProps, $[16] = scheme, $[17] = t0, $[18] = t1, $[19] = t10, $[20] = t11, $[21] = t2, $[22] = t3, $[23] = t4, $[24] = t5, $[25] = t6, $[26] = t7, $[27] = t8, $[28] = t9, $[29] = updateRef;
3553
+ } else
3554
+ _boundaryElement = $[1], _fallbackPlacements = $[2], _floatingBoundary = $[3], _referenceBoundary = $[4], _zOffsetProp = $[5], childProp = $[6], content = $[7], disabled = $[8], matchReferenceWidth = $[9], modal = $[10], open = $[11], paddingProp = $[12], portal = $[13], referenceElement = $[14], restProps = $[15], scheme = $[16], t0 = $[17], t1 = $[18], t10 = $[19], t11 = $[20], t2 = $[21], t3 = $[22], t4 = $[23], t5 = $[24], t6 = $[25], t7 = $[26], t8 = $[27], t9 = $[28], updateRef = $[29];
3555
+ const margins = t0 === void 0 ? DEFAULT_POPOVER_MARGINS : t0, _animate = t1 === void 0 ? !1 : t1, arrowProp = t2 === void 0 ? !1 : t2, constrainSize = t3 === void 0 ? !1 : t3, overflow = t4 === void 0 ? "hidden" : t4, placementProp = t5 === void 0 ? "bottom" : t5, placementStrategy = t6 === void 0 ? "flip" : t6, preventOverflow = t7 === void 0 ? !0 : t7, radiusProp = t8 === void 0 ? 3 : t8, shadowProp = t9 === void 0 ? 3 : t9, tone = t10 === void 0 ? "inherit" : t10, widthProp = t11 === void 0 ? "auto" : t11, boundaryElement = _boundaryElement ?? boundaryElementContext?.element, fallbackPlacements = _fallbackPlacements ?? DEFAULT_FALLBACK_PLACEMENTS$1[props.placement ?? "bottom"], floatingBoundary = _floatingBoundary ?? props.boundaryElement ?? boundaryElementContext.element, referenceBoundary = _referenceBoundary ?? props.boundaryElement ?? boundaryElementContext.element, zOffsetProp = _zOffsetProp ?? layer.popover.zOffset, animate = usePrefersReducedMotion() ? !1 : _animate, boundarySize = useElementSize(boundaryElement)?.border, padding = useArrayProp(paddingProp), radius = useArrayProp(radiusProp), shadow = useArrayProp(shadowProp), widthArrayProp = useArrayProp(widthProp), zOffset = useArrayProp(zOffsetProp), ref = react.useRef(null), arrowRef = react.useRef(null);
3556
+ let t12;
3557
+ $[30] === Symbol.for("react.memo_cache_sentinel") ? (t12 = () => ref.current, $[30] = t12) : t12 = $[30], react.useImperativeHandle(forwardedRef, t12);
3558
+ const mediaIndex = useMediaIndex(), boundaryWidth = constrainSize || preventOverflow ? boundarySize?.width : void 0;
3559
+ let t13;
3560
+ $[31] !== container || $[32] !== mediaIndex || $[33] !== widthArrayProp ? (t13 = calcCurrentWidth({
3490
3561
  container,
3491
3562
  mediaIndex,
3492
3563
  width: widthArrayProp
3493
- }), widthRef = react.useRef(width);
3494
- react.useEffect(() => {
3564
+ }), $[31] = container, $[32] = mediaIndex, $[33] = widthArrayProp, $[34] = t13) : t13 = $[34];
3565
+ const width = t13, widthRef = react.useRef(width);
3566
+ let t14, t15;
3567
+ $[35] !== width ? (t14 = () => {
3495
3568
  widthRef.current = width;
3496
- }, [width]);
3497
- const maxWidth = calcMaxWidth({
3569
+ }, t15 = [width], $[35] = width, $[36] = t14, $[37] = t15) : (t14 = $[36], t15 = $[37]), react.useEffect(t14, t15);
3570
+ let t16;
3571
+ $[38] !== boundaryWidth || $[39] !== width ? (t16 = calcMaxWidth({
3498
3572
  boundaryWidth,
3499
3573
  currentWidth: width
3500
- }), maxWidthRef = react.useRef(maxWidth);
3501
- react.useEffect(() => {
3574
+ }), $[38] = boundaryWidth, $[39] = width, $[40] = t16) : t16 = $[40];
3575
+ const maxWidth = t16, maxWidthRef = react.useRef(maxWidth);
3576
+ let t17, t18;
3577
+ $[41] !== maxWidth ? (t17 = () => {
3502
3578
  maxWidthRef.current = maxWidth;
3503
- }, [maxWidth]);
3579
+ }, t18 = [maxWidth], $[41] = maxWidth, $[42] = t17, $[43] = t18) : (t17 = $[42], t18 = $[43]), react.useEffect(t17, t18);
3504
3580
  const referenceWidthRef = react.useRef(void 0);
3505
- react.useEffect(() => {
3581
+ let t19, t20;
3582
+ $[44] !== matchReferenceWidth || $[45] !== maxWidth || $[46] !== open || $[47] !== width ? (t19 = () => {
3506
3583
  const floatingElement = ref.current;
3507
- if (!open || !floatingElement) return;
3584
+ if (!open || !floatingElement)
3585
+ return;
3508
3586
  const referenceWidth = referenceWidthRef.current;
3509
3587
  matchReferenceWidth ? referenceWidth !== void 0 && (floatingElement.style.width = `${referenceWidth}px`) : width !== void 0 && (floatingElement.style.width = `${width}px`), typeof maxWidth == "number" && (floatingElement.style.maxWidth = `${maxWidth}px`);
3510
- }, [width, matchReferenceWidth, maxWidth, open]);
3511
- const middleware = react.useMemo(() => {
3512
- const ret = [];
3513
- return (constrainSize || preventOverflow) && (placementStrategy === "autoPlacement" ? ret.push(reactDom$1.autoPlacement({
3514
- allowedPlacements: [placementProp].concat(fallbackPlacements)
3515
- })) : ret.push(reactDom$1.flip({
3516
- boundary: floatingBoundary || void 0,
3517
- fallbackPlacements,
3518
- padding: DEFAULT_POPOVER_PADDING,
3519
- rootBoundary
3520
- }))), ret.push(reactDom$1.offset({
3521
- mainAxis: DEFAULT_POPOVER_DISTANCE
3522
- })), (constrainSize || matchReferenceWidth) && ret.push(size({
3523
- apply({
3524
- availableWidth,
3525
- availableHeight,
3526
- elements,
3527
- referenceWidth: referenceWidth_0
3528
- }) {
3529
- referenceWidthRef.current = referenceWidth_0;
3530
- const _currentWidth = widthRef.current, _maxWidth = maxWidthRef.current;
3531
- matchReferenceWidth ? elements.floating.style.width = `${referenceWidth_0}px` : _currentWidth !== void 0 && (elements.floating.style.width = `${_currentWidth}px`), constrainSize && (elements.floating.style.maxWidth = `${Math.min(availableWidth, _maxWidth ?? 1 / 0)}px`, elements.floating.style.maxHeight = `${availableHeight}px`);
3532
- },
3533
- boundaryElement: floatingBoundary || void 0,
3534
- margins,
3535
- padding: DEFAULT_POPOVER_PADDING
3536
- })), preventOverflow && ret.push(reactDom$1.shift({
3537
- boundary: floatingBoundary || void 0,
3538
- rootBoundary,
3539
- padding: DEFAULT_POPOVER_PADDING
3540
- })), arrowProp && ret.push(reactDom$1.arrow({
3541
- element: arrowRef,
3542
- padding: DEFAULT_POPOVER_PADDING
3543
- })), animate && ret.push(origin), ret.push(reactDom$1.hide({
3544
- boundary: referenceBoundary || void 0,
3545
- padding: DEFAULT_POPOVER_PADDING,
3546
- strategy: "referenceHidden"
3547
- })), ret;
3548
- }, [animate, arrowProp, constrainSize, fallbackPlacements, placementProp, placementStrategy, floatingBoundary, margins, matchReferenceWidth, preventOverflow, referenceBoundary]), {
3588
+ }, t20 = [width, matchReferenceWidth, maxWidth, open], $[44] = matchReferenceWidth, $[45] = maxWidth, $[46] = open, $[47] = width, $[48] = t19, $[49] = t20) : (t19 = $[48], t20 = $[49]), react.useEffect(t19, t20);
3589
+ const [referenceWidth_0, setReferenceWidth] = react.useState(void 0);
3590
+ let t21;
3591
+ $[50] !== animate || $[51] !== arrowProp || $[52] !== constrainSize || $[53] !== fallbackPlacements || $[54] !== floatingBoundary || $[55] !== margins || $[56] !== matchReferenceWidth || $[57] !== placementProp || $[58] !== placementStrategy || $[59] !== preventOverflow || $[60] !== referenceBoundary ? (t21 = {
3592
+ animate,
3593
+ arrowProp,
3594
+ arrowRef,
3595
+ constrainSize,
3596
+ fallbackPlacements,
3597
+ floatingBoundary,
3598
+ margins,
3599
+ matchReferenceWidth,
3600
+ maxWidthRef,
3601
+ placementProp,
3602
+ placementStrategy,
3603
+ preventOverflow,
3604
+ referenceBoundary,
3605
+ referenceWidthRef,
3606
+ rootBoundary: "viewport",
3607
+ setReferenceWidth,
3608
+ widthRef
3609
+ }, $[50] = animate, $[51] = arrowProp, $[52] = constrainSize, $[53] = fallbackPlacements, $[54] = floatingBoundary, $[55] = margins, $[56] = matchReferenceWidth, $[57] = placementProp, $[58] = placementStrategy, $[59] = preventOverflow, $[60] = referenceBoundary, $[61] = t21) : t21 = $[61];
3610
+ const middleware = useMiddleware$1(t21);
3611
+ let t22;
3612
+ $[62] !== referenceElement ? (t22 = referenceElement ? {
3613
+ reference: referenceElement
3614
+ } : void 0, $[62] = referenceElement, $[63] = t22) : t22 = $[63];
3615
+ let t23;
3616
+ $[64] !== middleware || $[65] !== placementProp || $[66] !== t22 ? (t23 = {
3617
+ middleware,
3618
+ placement: placementProp,
3619
+ whileElementsMounted: reactDom$1.autoUpdate,
3620
+ elements: t22
3621
+ }, $[64] = middleware, $[65] = placementProp, $[66] = t22, $[67] = t23) : t23 = $[67];
3622
+ const {
3549
3623
  x,
3550
3624
  y,
3551
3625
  middlewareData,
@@ -3553,38 +3627,149 @@ const ViewportOverlay = () => {
3553
3627
  refs,
3554
3628
  strategy,
3555
3629
  update
3556
- } = reactDom$1.useFloating({
3557
- middleware,
3558
- placement: placementProp,
3559
- whileElementsMounted: reactDom$1.autoUpdate,
3560
- elements: referenceElement ? {
3561
- reference: referenceElement
3562
- } : void 0
3563
- }), referenceHidden = middlewareData.hide?.referenceHidden, arrowX = middlewareData.arrow?.x, arrowY = middlewareData.arrow?.y, originX = middlewareData["@sanity/ui/origin"]?.originX, originY = middlewareData["@sanity/ui/origin"]?.originY, setArrow = react.useCallback((arrowEl) => {
3630
+ } = reactDom$1.useFloating(t23), referenceHidden = middlewareData.hide?.referenceHidden, arrowX = middlewareData.arrow?.x, arrowY = middlewareData.arrow?.y, originX = middlewareData["@sanity/ui/origin"]?.originX, originY = middlewareData["@sanity/ui/origin"]?.originY;
3631
+ let t24;
3632
+ $[68] === Symbol.for("react.memo_cache_sentinel") ? (t24 = (arrowEl) => {
3564
3633
  arrowRef.current = arrowEl;
3565
- }, []), setFloating = react.useCallback((node) => {
3634
+ }, $[68] = t24) : t24 = $[68];
3635
+ const setArrow = t24;
3636
+ let t25;
3637
+ $[69] !== refs ? (t25 = (node) => {
3566
3638
  ref.current = node, refs.setFloating(node);
3567
- }, [refs]), setReference = react.useCallback((node_0) => {
3568
- refs.setReference(node_0);
3569
- const childRef = getElementRef(childProp);
3570
- typeof childRef == "function" ? childRef(node_0) : childRef && (childRef.current = node_0);
3571
- }, [childProp, refs]), child = react.useMemo(() => referenceElement ? childProp : childProp ? react.cloneElement(childProp, {
3572
- ref: setReference
3573
- }) : null, [childProp, referenceElement, setReference]);
3574
- if (react.useEffect(() => {
3575
- updateRef && (typeof updateRef == "function" ? updateRef(update) : updateRef && (updateRef.current = update));
3576
- }, [update, updateRef]), disabled)
3577
- return childProp || /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {});
3578
- const popover = /* @__PURE__ */ jsxRuntime.jsxs(LayerProvider, { zOffset, children: [
3579
- modal && /* @__PURE__ */ jsxRuntime.jsx(ViewportOverlay, {}),
3580
- /* @__PURE__ */ jsxRuntime.jsx(PopoverCard, { ...restProps, __unstable_margins: margins, animate, arrow: arrowProp, arrowRef: setArrow, arrowX, arrowY, hidden: referenceHidden, overflow, padding, placement, radius, ref: setFloating, scheme, shadow, originX, originY, strategy, tone, width: matchReferenceWidth ? referenceWidthRef.current : width, x, y, children: content })
3581
- ] }), children = open && (portal ? /* @__PURE__ */ jsxRuntime.jsx(Portal, { __unstable_name: typeof portal == "string" ? portal : void 0, children: popover }) : popover);
3582
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3583
- animate ? /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children }) : children,
3639
+ }, $[69] = refs, $[70] = t25) : t25 = $[70];
3640
+ const setFloating = t25;
3641
+ let t26;
3642
+ $[71] !== childProp ? (t26 = childProp ? getElementRef(childProp) : null, $[71] = childProp, $[72] = t26) : t26 = $[72];
3643
+ let t27;
3644
+ $[73] !== refs.reference.current ? (t27 = () => refs.reference.current, $[73] = refs.reference.current, $[74] = t27) : t27 = $[74], react.useImperativeHandle(t26, t27);
3645
+ let t28;
3646
+ bb0: {
3647
+ if (referenceElement) {
3648
+ t28 = childProp;
3649
+ break bb0;
3650
+ }
3651
+ if (!childProp) {
3652
+ t28 = null;
3653
+ break bb0;
3654
+ }
3655
+ let t292;
3656
+ $[75] !== childProp || $[76] !== refs.setReference ? (t292 = react.cloneElement(childProp, {
3657
+ ref: refs.setReference
3658
+ }), $[75] = childProp, $[76] = refs.setReference, $[77] = t292) : t292 = $[77], t28 = t292;
3659
+ }
3660
+ const child = t28;
3661
+ let t29, t30;
3662
+ if ($[78] !== update ? (t29 = () => update, t30 = [update], $[78] = update, $[79] = t29, $[80] = t30) : (t29 = $[79], t30 = $[80]), react.useImperativeHandle(updateRef, t29, t30), disabled) {
3663
+ let t312;
3664
+ return $[81] !== childProp ? (t312 = childProp || /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {}), $[81] = childProp, $[82] = t312) : t312 = $[82], t312;
3665
+ }
3666
+ let t31;
3667
+ $[83] !== modal ? (t31 = modal && /* @__PURE__ */ jsxRuntime.jsx(ViewportOverlay, {}), $[83] = modal, $[84] = t31) : t31 = $[84];
3668
+ const t32 = matchReferenceWidth ? referenceWidth_0 : width;
3669
+ let t33;
3670
+ $[85] !== animate || $[86] !== arrowProp || $[87] !== arrowX || $[88] !== arrowY || $[89] !== content || $[90] !== margins || $[91] !== originX || $[92] !== originY || $[93] !== overflow || $[94] !== padding || $[95] !== placement || $[96] !== radius || $[97] !== referenceHidden || $[98] !== restProps || $[99] !== scheme || $[100] !== setFloating || $[101] !== shadow || $[102] !== strategy || $[103] !== t32 || $[104] !== tone || $[105] !== x || $[106] !== y ? (t33 = /* @__PURE__ */ jsxRuntime.jsx(PopoverCard, { ...restProps, __unstable_margins: margins, animate, arrow: arrowProp, arrowRef: setArrow, arrowX, arrowY, hidden: referenceHidden, overflow, padding, placement, radius, ref: setFloating, scheme, shadow, originX, originY, strategy, tone, width: t32, x, y, children: content }), $[85] = animate, $[86] = arrowProp, $[87] = arrowX, $[88] = arrowY, $[89] = content, $[90] = margins, $[91] = originX, $[92] = originY, $[93] = overflow, $[94] = padding, $[95] = placement, $[96] = radius, $[97] = referenceHidden, $[98] = restProps, $[99] = scheme, $[100] = setFloating, $[101] = shadow, $[102] = strategy, $[103] = t32, $[104] = tone, $[105] = x, $[106] = y, $[107] = t33) : t33 = $[107];
3671
+ let t34;
3672
+ $[108] !== t31 || $[109] !== t33 || $[110] !== zOffset ? (t34 = /* @__PURE__ */ jsxRuntime.jsxs(LayerProvider, { zOffset, children: [
3673
+ t31,
3674
+ t33
3675
+ ] }), $[108] = t31, $[109] = t33, $[110] = zOffset, $[111] = t34) : t34 = $[111];
3676
+ const popover = t34;
3677
+ let t35;
3678
+ $[112] !== open || $[113] !== popover || $[114] !== portal ? (t35 = open && (portal ? /* @__PURE__ */ jsxRuntime.jsx(Portal, { __unstable_name: typeof portal == "string" ? portal : void 0, children: popover }) : popover), $[112] = open, $[113] = popover, $[114] = portal, $[115] = t35) : t35 = $[115];
3679
+ const children = t35;
3680
+ let t36;
3681
+ $[116] !== animate || $[117] !== children ? (t36 = animate ? /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children }) : children, $[116] = animate, $[117] = children, $[118] = t36) : t36 = $[118];
3682
+ let t37;
3683
+ return $[119] !== child || $[120] !== t36 ? (t37 = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3684
+ t36,
3584
3685
  child
3585
- ] });
3686
+ ] }), $[119] = child, $[120] = t36, $[121] = t37) : t37 = $[121], t37;
3586
3687
  }));
3587
3688
  Popover.displayName = "Memo(ForwardRef(Popover))";
3689
+ function useMiddleware$1(t0) {
3690
+ const $ = reactCompilerRuntime.c(42), {
3691
+ animate,
3692
+ arrowProp,
3693
+ arrowRef,
3694
+ constrainSize,
3695
+ fallbackPlacements,
3696
+ floatingBoundary,
3697
+ margins,
3698
+ matchReferenceWidth,
3699
+ maxWidthRef,
3700
+ placementProp,
3701
+ placementStrategy,
3702
+ preventOverflow,
3703
+ referenceBoundary,
3704
+ referenceWidthRef,
3705
+ rootBoundary,
3706
+ setReferenceWidth,
3707
+ widthRef
3708
+ } = t0;
3709
+ let ret;
3710
+ if ($[0] !== animate || $[1] !== arrowProp || $[2] !== arrowRef || $[3] !== constrainSize || $[4] !== fallbackPlacements || $[5] !== floatingBoundary || $[6] !== margins || $[7] !== matchReferenceWidth || $[8] !== maxWidthRef || $[9] !== placementProp || $[10] !== placementStrategy || $[11] !== preventOverflow || $[12] !== referenceBoundary || $[13] !== referenceWidthRef || $[14] !== rootBoundary || $[15] !== setReferenceWidth || $[16] !== widthRef) {
3711
+ if (ret = [], constrainSize || preventOverflow)
3712
+ if (placementStrategy === "autoPlacement") {
3713
+ let t12;
3714
+ $[18] !== fallbackPlacements || $[19] !== placementProp ? (t12 = reactDom$1.autoPlacement({
3715
+ allowedPlacements: [placementProp].concat(fallbackPlacements)
3716
+ }), $[18] = fallbackPlacements, $[19] = placementProp, $[20] = t12) : t12 = $[20], ret.push(t12);
3717
+ } else {
3718
+ const t12 = floatingBoundary || void 0;
3719
+ let t22;
3720
+ $[21] !== fallbackPlacements || $[22] !== rootBoundary || $[23] !== t12 ? (t22 = reactDom$1.flip({
3721
+ boundary: t12,
3722
+ fallbackPlacements,
3723
+ padding: DEFAULT_POPOVER_PADDING,
3724
+ rootBoundary
3725
+ }), $[21] = fallbackPlacements, $[22] = rootBoundary, $[23] = t12, $[24] = t22) : t22 = $[24], ret.push(t22);
3726
+ }
3727
+ let t1;
3728
+ if ($[25] === Symbol.for("react.memo_cache_sentinel") ? (t1 = reactDom$1.offset({
3729
+ mainAxis: DEFAULT_POPOVER_DISTANCE
3730
+ }), $[25] = t1) : t1 = $[25], ret.push(t1), constrainSize || matchReferenceWidth) {
3731
+ const t22 = floatingBoundary || void 0;
3732
+ let t32;
3733
+ $[26] !== constrainSize || $[27] !== margins || $[28] !== matchReferenceWidth || $[29] !== maxWidthRef || $[30] !== referenceWidthRef || $[31] !== setReferenceWidth || $[32] !== t22 || $[33] !== widthRef ? (t32 = size({
3734
+ boundaryElement: t22,
3735
+ constrainSize,
3736
+ margins,
3737
+ matchReferenceWidth,
3738
+ maxWidthRef,
3739
+ padding: DEFAULT_POPOVER_PADDING,
3740
+ referenceWidthRef,
3741
+ setReferenceWidth,
3742
+ widthRef
3743
+ }), $[26] = constrainSize, $[27] = margins, $[28] = matchReferenceWidth, $[29] = maxWidthRef, $[30] = referenceWidthRef, $[31] = setReferenceWidth, $[32] = t22, $[33] = widthRef, $[34] = t32) : t32 = $[34], ret.push(t32);
3744
+ }
3745
+ if (preventOverflow) {
3746
+ const t22 = floatingBoundary || void 0;
3747
+ let t32;
3748
+ $[35] !== rootBoundary || $[36] !== t22 ? (t32 = reactDom$1.shift({
3749
+ boundary: t22,
3750
+ rootBoundary,
3751
+ padding: DEFAULT_POPOVER_PADDING
3752
+ }), $[35] = rootBoundary, $[36] = t22, $[37] = t32) : t32 = $[37], ret.push(t32);
3753
+ }
3754
+ if (arrowProp) {
3755
+ let t22;
3756
+ $[38] !== arrowRef ? (t22 = reactDom$1.arrow({
3757
+ element: arrowRef,
3758
+ padding: DEFAULT_POPOVER_PADDING
3759
+ }), $[38] = arrowRef, $[39] = t22) : t22 = $[39], ret.push(t22);
3760
+ }
3761
+ animate && ret.push(origin);
3762
+ const t2 = referenceBoundary || void 0;
3763
+ let t3;
3764
+ $[40] !== t2 ? (t3 = reactDom$1.hide({
3765
+ boundary: t2,
3766
+ padding: DEFAULT_POPOVER_PADDING,
3767
+ strategy: "referenceHidden"
3768
+ }), $[40] = t2, $[41] = t3) : t3 = $[41], ret.push(t3), $[0] = animate, $[1] = arrowProp, $[2] = arrowRef, $[3] = constrainSize, $[4] = fallbackPlacements, $[5] = floatingBoundary, $[6] = margins, $[7] = matchReferenceWidth, $[8] = maxWidthRef, $[9] = placementProp, $[10] = placementStrategy, $[11] = preventOverflow, $[12] = referenceBoundary, $[13] = referenceWidthRef, $[14] = rootBoundary, $[15] = setReferenceWidth, $[16] = widthRef, $[17] = ret;
3769
+ } else
3770
+ ret = $[17];
3771
+ return ret;
3772
+ }
3588
3773
  function radioBaseStyle() {
3589
3774
  return styledComponents.css`
3590
3775
  position: relative;
@@ -4438,61 +4623,68 @@ const StyledTooltip = styledComponents.styled(Layer).withConfig({
4438
4623
  displayName: "StyledTooltip",
4439
4624
  componentId: "sc-13f2zvh-0"
4440
4625
  })`pointer-events:none;`, Tooltip = react.forwardRef(function(props, forwardedRef) {
4441
- const boundaryElementContext = useBoundaryElement(), {
4626
+ const $ = reactCompilerRuntime.c(135), boundaryElementContext = useBoundaryElement(), {
4442
4627
  layer
4443
- } = useTheme_v2(), {
4444
- animate: _animate = !1,
4445
- arrow: arrowProp = !1,
4446
- boundaryElement = boundaryElementContext?.element,
4628
+ } = useTheme_v2();
4629
+ let _boundaryElement, _fallbackPlacementsProp, _zOffset, childProp, content, delay, disabled, portalProp, restProps, scheme, t0, t1, t2, t3, t4, t5;
4630
+ $[0] !== props ? ({
4631
+ animate: t0,
4632
+ arrow: t1,
4633
+ boundaryElement: _boundaryElement,
4447
4634
  children: childProp,
4448
4635
  content,
4449
4636
  disabled,
4450
- fallbackPlacements: fallbackPlacementsProp = props.fallbackPlacements ?? DEFAULT_FALLBACK_PLACEMENTS[props.placement ?? "bottom"],
4451
- padding = 2,
4452
- placement: placementProp = "bottom",
4637
+ fallbackPlacements: _fallbackPlacementsProp,
4638
+ padding: t2,
4639
+ placement: t3,
4453
4640
  portal: portalProp,
4454
- radius = 2,
4641
+ radius: t4,
4455
4642
  scheme,
4456
- shadow = 2,
4457
- zOffset = layer.tooltip.zOffset,
4643
+ shadow: t5,
4644
+ zOffset: _zOffset,
4458
4645
  delay,
4459
4646
  ...restProps
4460
- } = props, animate = usePrefersReducedMotion() ? !1 : _animate, fallbackPlacements = useArrayProp(fallbackPlacementsProp), ref = react.useRef(null), [referenceElement, setReferenceElement] = react.useState(null), arrowRef = react.useRef(null), rootBoundary = "viewport", [tooltipMaxWidth, setTooltipMaxWidth] = react.useState(0);
4461
- react.useImperativeHandle(forwardedRef, () => ref.current);
4462
- const portal = usePortal(), portalElement = typeof portalProp == "string" ? portal.elements?.[portalProp] || null : portal.element, middleware = react.useMemo(() => {
4463
- const ret = [];
4464
- return ret.push(reactDom$1.flip({
4465
- boundary: boundaryElement || void 0,
4466
- fallbackPlacements,
4467
- padding: DEFAULT_TOOLTIP_PADDING,
4468
- rootBoundary
4469
- })), ret.push(reactDom$1.offset({
4470
- mainAxis: DEFAULT_TOOLTIP_DISTANCE
4471
- })), ret.push(reactDom$1.shift({
4472
- boundary: boundaryElement || void 0,
4473
- rootBoundary,
4474
- padding: DEFAULT_TOOLTIP_PADDING
4475
- })), arrowProp && ret.push(reactDom$1.arrow({
4476
- element: arrowRef,
4477
- padding: DEFAULT_TOOLTIP_PADDING
4478
- })), animate && ret.push(origin), ret;
4479
- }, [animate, arrowProp, boundaryElement, fallbackPlacements]), {
4647
+ } = props, $[0] = props, $[1] = _boundaryElement, $[2] = _fallbackPlacementsProp, $[3] = _zOffset, $[4] = childProp, $[5] = content, $[6] = delay, $[7] = disabled, $[8] = portalProp, $[9] = restProps, $[10] = scheme, $[11] = t0, $[12] = t1, $[13] = t2, $[14] = t3, $[15] = t4, $[16] = t5) : (_boundaryElement = $[1], _fallbackPlacementsProp = $[2], _zOffset = $[3], childProp = $[4], content = $[5], delay = $[6], disabled = $[7], portalProp = $[8], restProps = $[9], scheme = $[10], t0 = $[11], t1 = $[12], t2 = $[13], t3 = $[14], t4 = $[15], t5 = $[16]);
4648
+ const _animate = t0 === void 0 ? !1 : t0, arrowProp = t1 === void 0 ? !1 : t1, padding = t2 === void 0 ? 2 : t2, placementProp = t3 === void 0 ? "bottom" : t3, radius = t4 === void 0 ? 2 : t4, shadow = t5 === void 0 ? 2 : t5, boundaryElement = _boundaryElement ?? boundaryElementContext?.element, fallbackPlacementsProp = _fallbackPlacementsProp ?? DEFAULT_FALLBACK_PLACEMENTS[props.placement ?? "bottom"], zOffset = _zOffset ?? layer.tooltip.zOffset, animate = usePrefersReducedMotion() ? !1 : _animate, fallbackPlacements = useArrayProp(fallbackPlacementsProp), ref = react.useRef(null), [referenceElement, setReferenceElement] = react.useState(null), arrowRef = react.useRef(null), [tooltipMaxWidth, setTooltipMaxWidth] = react.useState(0);
4649
+ let t6;
4650
+ $[17] === Symbol.for("react.memo_cache_sentinel") ? (t6 = () => ref.current, $[17] = t6) : t6 = $[17], react.useImperativeHandle(forwardedRef, t6);
4651
+ const portal = usePortal(), portalElement = typeof portalProp == "string" ? portal.elements?.[portalProp] || null : portal.element;
4652
+ let t7;
4653
+ $[18] !== animate || $[19] !== arrowProp || $[20] !== boundaryElement || $[21] !== fallbackPlacements ? (t7 = {
4654
+ animate,
4655
+ arrowProp,
4656
+ arrowRef,
4657
+ boundaryElement,
4658
+ fallbackPlacements,
4659
+ rootBoundary: "viewport"
4660
+ }, $[18] = animate, $[19] = arrowProp, $[20] = boundaryElement, $[21] = fallbackPlacements, $[22] = t7) : t7 = $[22];
4661
+ const middleware = useMiddleware(t7);
4662
+ let t8;
4663
+ $[23] !== referenceElement ? (t8 = {
4664
+ reference: referenceElement
4665
+ }, $[23] = referenceElement, $[24] = t8) : t8 = $[24];
4666
+ let t9;
4667
+ $[25] !== middleware || $[26] !== placementProp || $[27] !== t8 ? (t9 = {
4668
+ middleware,
4669
+ placement: placementProp,
4670
+ whileElementsMounted: reactDom$1.autoUpdate,
4671
+ elements: t8
4672
+ }, $[25] = middleware, $[26] = placementProp, $[27] = t8, $[28] = t9) : t9 = $[28];
4673
+ const {
4480
4674
  floatingStyles,
4481
4675
  placement,
4482
4676
  middlewareData,
4483
4677
  refs,
4484
4678
  update
4485
- } = reactDom$1.useFloating({
4486
- middleware,
4487
- placement: placementProp,
4488
- whileElementsMounted: reactDom$1.autoUpdate,
4489
- elements: {
4490
- reference: referenceElement
4491
- }
4492
- }), arrowX = middlewareData.arrow?.x, arrowY = middlewareData.arrow?.y, originX = middlewareData["@sanity/ui/origin"]?.originX, originY = middlewareData["@sanity/ui/origin"]?.originY, tooltipId = react.useId(), [isOpen, setIsOpen] = useDelayedState(!1), delayGroupContext = useTooltipDelayGroup(), {
4679
+ } = reactDom$1.useFloating(t9), arrowX = middlewareData.arrow?.x, arrowY = middlewareData.arrow?.y, originX = middlewareData["@sanity/ui/origin"]?.originX, originY = middlewareData["@sanity/ui/origin"]?.originY, tooltipId = react.useId(), [isOpen, setIsOpen] = useDelayedState(!1), delayGroupContext = useTooltipDelayGroup();
4680
+ let t10;
4681
+ $[29] !== delayGroupContext ? (t10 = delayGroupContext || {}, $[29] = delayGroupContext, $[30] = t10) : t10 = $[30];
4682
+ const {
4493
4683
  setIsGroupActive,
4494
4684
  setOpenTooltipId
4495
- } = delayGroupContext || {}, showTooltip = isOpen || delayGroupContext?.openTooltipId === tooltipId, isInsideGroup = delayGroupContext !== null, openDelayProp = typeof delay == "number" ? delay : delay?.open || 0, closeDelayProp = typeof delay == "number" ? delay : delay?.close || 0, openDelay = isInsideGroup ? delayGroupContext.openDelay : openDelayProp, closeDelay = isInsideGroup ? delayGroupContext.closeDelay : closeDelayProp, handleIsOpenChange = react.useCallback((open, immediate) => {
4685
+ } = t10, showTooltip = isOpen || delayGroupContext?.openTooltipId === tooltipId, isInsideGroup = delayGroupContext !== null, openDelayProp = typeof delay == "number" ? delay : delay?.open || 0, closeDelayProp = typeof delay == "number" ? delay : delay?.close || 0, openDelay = isInsideGroup ? delayGroupContext.openDelay : openDelayProp, closeDelay = isInsideGroup ? delayGroupContext.closeDelay : closeDelayProp;
4686
+ let t11;
4687
+ $[31] !== closeDelay || $[32] !== isInsideGroup || $[33] !== openDelay || $[34] !== setIsGroupActive || $[35] !== setIsOpen || $[36] !== setOpenTooltipId || $[37] !== tooltipId ? (t11 = (open, immediate) => {
4496
4688
  if (isInsideGroup)
4497
4689
  if (open) {
4498
4690
  const groupedOpenDelay = immediate ? 0 : openDelay;
@@ -4503,65 +4695,173 @@ const StyledTooltip = styledComponents.styled(Layer).withConfig({
4503
4695
  }
4504
4696
  else
4505
4697
  setIsOpen(open, immediate ? 0 : open ? openDelay : closeDelay);
4506
- }, [isInsideGroup, openDelay, setIsGroupActive, setOpenTooltipId, tooltipId, closeDelay, setIsOpen]), handleBlur = react.useCallback((e) => {
4698
+ }, $[31] = closeDelay, $[32] = isInsideGroup, $[33] = openDelay, $[34] = setIsGroupActive, $[35] = setIsOpen, $[36] = setOpenTooltipId, $[37] = tooltipId, $[38] = t11) : t11 = $[38];
4699
+ const handleIsOpenChange = t11;
4700
+ let t12;
4701
+ $[39] !== childProp?.props || $[40] !== handleIsOpenChange ? (t12 = (e) => {
4507
4702
  handleIsOpenChange(!1), childProp?.props?.onBlur?.(e);
4508
- }, [childProp?.props, handleIsOpenChange]), handleClick = react.useCallback((e_0) => {
4703
+ }, $[39] = childProp?.props, $[40] = handleIsOpenChange, $[41] = t12) : t12 = $[41];
4704
+ const handleBlur = t12;
4705
+ let t13;
4706
+ $[42] !== childProp?.props || $[43] !== handleIsOpenChange ? (t13 = (e_0) => {
4509
4707
  handleIsOpenChange(!1, !0), childProp?.props.onClick?.(e_0);
4510
- }, [childProp?.props, handleIsOpenChange]), handleContextMenu = react.useCallback((e_1) => {
4708
+ }, $[42] = childProp?.props, $[43] = handleIsOpenChange, $[44] = t13) : t13 = $[44];
4709
+ const handleClick = t13;
4710
+ let t14;
4711
+ $[45] !== childProp?.props || $[46] !== handleIsOpenChange ? (t14 = (e_1) => {
4511
4712
  handleIsOpenChange(!1, !0), childProp?.props.onContextMenu?.(e_1);
4512
- }, [childProp?.props, handleIsOpenChange]), handleFocus = react.useCallback((e_2) => {
4713
+ }, $[45] = childProp?.props, $[46] = handleIsOpenChange, $[47] = t14) : t14 = $[47];
4714
+ const handleContextMenu = t14;
4715
+ let t15;
4716
+ $[48] !== childProp?.props || $[49] !== handleIsOpenChange ? (t15 = (e_2) => {
4513
4717
  handleIsOpenChange(!0), childProp?.props?.onFocus?.(e_2);
4514
- }, [childProp?.props, handleIsOpenChange]), handleMouseEnter = react.useCallback((e_3) => {
4718
+ }, $[48] = childProp?.props, $[49] = handleIsOpenChange, $[50] = t15) : t15 = $[50];
4719
+ const handleFocus = t15;
4720
+ let t16;
4721
+ $[51] !== childProp?.props || $[52] !== handleIsOpenChange ? (t16 = (e_3) => {
4515
4722
  handleIsOpenChange(!0), childProp?.props?.onMouseEnter?.(e_3);
4516
- }, [childProp?.props, handleIsOpenChange]), handleMouseLeave = react.useCallback((e_4) => {
4723
+ }, $[51] = childProp?.props, $[52] = handleIsOpenChange, $[53] = t16) : t16 = $[53];
4724
+ const handleMouseEnter = t16;
4725
+ let t17;
4726
+ $[54] !== childProp?.props || $[55] !== handleIsOpenChange ? (t17 = (e_4) => {
4517
4727
  handleIsOpenChange(!1), childProp?.props?.onMouseLeave?.(e_4);
4518
- }, [childProp?.props, handleIsOpenChange]);
4519
- useCloseOnMouseLeave({
4728
+ }, $[54] = childProp?.props, $[55] = handleIsOpenChange, $[56] = t17) : t17 = $[56];
4729
+ const handleMouseLeave = t17;
4730
+ let t18;
4731
+ $[57] !== handleIsOpenChange || $[58] !== isInsideGroup || $[59] !== referenceElement || $[60] !== showTooltip ? (t18 = {
4520
4732
  handleIsOpenChange,
4521
4733
  referenceElement,
4522
4734
  showTooltip,
4523
4735
  isInsideGroup
4524
- }), react.useEffect(() => {
4736
+ }, $[57] = handleIsOpenChange, $[58] = isInsideGroup, $[59] = referenceElement, $[60] = showTooltip, $[61] = t18) : t18 = $[61], useCloseOnMouseLeave(t18);
4737
+ let t19, t20;
4738
+ $[62] !== disabled || $[63] !== handleIsOpenChange || $[64] !== showTooltip ? (t19 = () => {
4525
4739
  disabled && showTooltip && handleIsOpenChange(!1);
4526
- }, [disabled, handleIsOpenChange, showTooltip]), react.useEffect(() => {
4740
+ }, t20 = [disabled, handleIsOpenChange, showTooltip], $[62] = disabled, $[63] = handleIsOpenChange, $[64] = showTooltip, $[65] = t19, $[66] = t20) : (t19 = $[65], t20 = $[66]), react.useEffect(t19, t20);
4741
+ let t21, t22;
4742
+ $[67] !== content || $[68] !== handleIsOpenChange || $[69] !== showTooltip ? (t21 = () => {
4527
4743
  !content && showTooltip && handleIsOpenChange(!1);
4528
- }, [content, handleIsOpenChange, showTooltip]), react.useEffect(() => {
4529
- if (!showTooltip) return;
4530
- function handleWindowKeyDown(event) {
4744
+ }, t22 = [content, handleIsOpenChange, showTooltip], $[67] = content, $[68] = handleIsOpenChange, $[69] = showTooltip, $[70] = t21, $[71] = t22) : (t21 = $[70], t22 = $[71]), react.useEffect(t21, t22);
4745
+ let t23, t24;
4746
+ $[72] !== handleIsOpenChange || $[73] !== showTooltip ? (t23 = () => {
4747
+ if (!showTooltip)
4748
+ return;
4749
+ const handleWindowKeyDown = function(event) {
4531
4750
  event.key === "Escape" && handleIsOpenChange(!1, !0);
4532
- }
4751
+ };
4533
4752
  return window.addEventListener("keydown", handleWindowKeyDown), () => {
4534
4753
  window.removeEventListener("keydown", handleWindowKeyDown);
4535
4754
  };
4536
- }, [handleIsOpenChange, showTooltip]), react.useLayoutEffect(() => {
4755
+ }, t24 = [handleIsOpenChange, showTooltip], $[72] = handleIsOpenChange, $[73] = showTooltip, $[74] = t23, $[75] = t24) : (t23 = $[74], t24 = $[75]), react.useEffect(t23, t24);
4756
+ let t25;
4757
+ $[76] !== boundaryElement || $[77] !== portalElement?.offsetWidth ? (t25 = () => {
4537
4758
  const availableWidths = [...boundaryElement ? [boundaryElement.offsetWidth] : [], portalElement?.offsetWidth || document.body.offsetWidth];
4538
4759
  setTooltipMaxWidth(Math.min(...availableWidths) - DEFAULT_TOOLTIP_PADDING * 2);
4539
- }, [boundaryElement, portalElement]);
4540
- const setArrow = react.useCallback((arrowEl) => {
4760
+ }, $[76] = boundaryElement, $[77] = portalElement?.offsetWidth, $[78] = t25) : t25 = $[78];
4761
+ let t26;
4762
+ $[79] !== boundaryElement || $[80] !== portalElement ? (t26 = [boundaryElement, portalElement], $[79] = boundaryElement, $[80] = portalElement, $[81] = t26) : t26 = $[81], react.useLayoutEffect(t25, t26);
4763
+ let t27;
4764
+ $[82] !== update ? (t27 = (arrowEl) => {
4541
4765
  arrowRef.current = arrowEl, update();
4542
- }, [update]), setFloating = react.useCallback((node) => {
4766
+ }, $[82] = update, $[83] = t27) : t27 = $[83];
4767
+ const setArrow = t27;
4768
+ let t28;
4769
+ $[84] !== refs ? (t28 = (node) => {
4543
4770
  ref.current = node, refs.setFloating(node);
4544
- }, [refs]), child = react.useMemo(() => childProp ? react.cloneElement(childProp, {
4545
- onBlur: handleBlur,
4546
- onFocus: handleFocus,
4547
- onMouseEnter: handleMouseEnter,
4548
- onMouseLeave: handleMouseLeave,
4549
- onClick: handleClick,
4550
- onContextMenu: handleContextMenu,
4551
- ref: setReferenceElement
4552
- }) : null, [childProp, handleBlur, handleClick, handleContextMenu, handleFocus, handleMouseEnter, handleMouseLeave]);
4553
- if (react.useImperativeHandle(childProp ? getElementRef(childProp) : null, () => referenceElement, [referenceElement]), !child) return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {});
4554
- if (disabled) return child;
4555
- const tooltip = /* @__PURE__ */ jsxRuntime.jsx(StyledTooltip, { "data-ui": "Tooltip", ...restProps, ref: setFloating, style: {
4771
+ }, $[84] = refs, $[85] = t28) : t28 = $[85];
4772
+ const setFloating = t28;
4773
+ let t29;
4774
+ bb0: {
4775
+ if (!childProp) {
4776
+ t29 = null;
4777
+ break bb0;
4778
+ }
4779
+ let t302;
4780
+ $[86] !== childProp || $[87] !== handleBlur || $[88] !== handleClick || $[89] !== handleContextMenu || $[90] !== handleFocus || $[91] !== handleMouseEnter || $[92] !== handleMouseLeave ? (t302 = react.cloneElement(childProp, {
4781
+ onBlur: handleBlur,
4782
+ onFocus: handleFocus,
4783
+ onMouseEnter: handleMouseEnter,
4784
+ onMouseLeave: handleMouseLeave,
4785
+ onClick: handleClick,
4786
+ onContextMenu: handleContextMenu,
4787
+ ref: setReferenceElement
4788
+ }), $[86] = childProp, $[87] = handleBlur, $[88] = handleClick, $[89] = handleContextMenu, $[90] = handleFocus, $[91] = handleMouseEnter, $[92] = handleMouseLeave, $[93] = t302) : t302 = $[93], t29 = t302;
4789
+ }
4790
+ const child = t29;
4791
+ let t30;
4792
+ $[94] !== childProp ? (t30 = childProp ? getElementRef(childProp) : null, $[94] = childProp, $[95] = t30) : t30 = $[95];
4793
+ let t31, t32;
4794
+ if ($[96] !== referenceElement ? (t31 = () => referenceElement, t32 = [referenceElement], $[96] = referenceElement, $[97] = t31, $[98] = t32) : (t31 = $[97], t32 = $[98]), react.useImperativeHandle(t30, t31, t32), !child) {
4795
+ let t332;
4796
+ return $[99] === Symbol.for("react.memo_cache_sentinel") ? (t332 = /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {}), $[99] = t332) : t332 = $[99], t332;
4797
+ }
4798
+ if (disabled)
4799
+ return child;
4800
+ const t33 = tooltipMaxWidth > 0 ? `${tooltipMaxWidth}px` : void 0;
4801
+ let t34;
4802
+ $[100] !== floatingStyles || $[101] !== t33 ? (t34 = {
4556
4803
  ...floatingStyles,
4557
- maxWidth: tooltipMaxWidth > 0 ? `${tooltipMaxWidth}px` : void 0
4558
- }, zOffset, children: /* @__PURE__ */ jsxRuntime.jsx(TooltipCard, { ...restProps, animate, arrow: arrowProp, arrowRef: setArrow, arrowX, arrowY, originX, originY, padding, placement, radius, ref: setFloating, scheme, shadow, children: content }) }), children = showTooltip && (portalProp ? /* @__PURE__ */ jsxRuntime.jsx(Portal, { __unstable_name: typeof portalProp == "string" ? portalProp : void 0, children: tooltip }) : tooltip);
4559
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4560
- animate ? /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children }) : children,
4804
+ maxWidth: t33
4805
+ }, $[100] = floatingStyles, $[101] = t33, $[102] = t34) : t34 = $[102];
4806
+ let t35;
4807
+ $[103] !== animate || $[104] !== arrowProp || $[105] !== arrowX || $[106] !== arrowY || $[107] !== content || $[108] !== originX || $[109] !== originY || $[110] !== padding || $[111] !== placement || $[112] !== radius || $[113] !== restProps || $[114] !== scheme || $[115] !== setArrow || $[116] !== setFloating || $[117] !== shadow ? (t35 = /* @__PURE__ */ jsxRuntime.jsx(TooltipCard, { ...restProps, animate, arrow: arrowProp, arrowRef: setArrow, arrowX, arrowY, originX, originY, padding, placement, radius, ref: setFloating, scheme, shadow, children: content }), $[103] = animate, $[104] = arrowProp, $[105] = arrowX, $[106] = arrowY, $[107] = content, $[108] = originX, $[109] = originY, $[110] = padding, $[111] = placement, $[112] = radius, $[113] = restProps, $[114] = scheme, $[115] = setArrow, $[116] = setFloating, $[117] = shadow, $[118] = t35) : t35 = $[118];
4808
+ let t36;
4809
+ $[119] !== restProps || $[120] !== setFloating || $[121] !== t34 || $[122] !== t35 || $[123] !== zOffset ? (t36 = /* @__PURE__ */ jsxRuntime.jsx(StyledTooltip, { "data-ui": "Tooltip", ...restProps, ref: setFloating, style: t34, zOffset, children: t35 }), $[119] = restProps, $[120] = setFloating, $[121] = t34, $[122] = t35, $[123] = zOffset, $[124] = t36) : t36 = $[124];
4810
+ const tooltip = t36;
4811
+ let t37;
4812
+ $[125] !== portalProp || $[126] !== showTooltip || $[127] !== tooltip ? (t37 = showTooltip && (portalProp ? /* @__PURE__ */ jsxRuntime.jsx(Portal, { __unstable_name: typeof portalProp == "string" ? portalProp : void 0, children: tooltip }) : tooltip), $[125] = portalProp, $[126] = showTooltip, $[127] = tooltip, $[128] = t37) : t37 = $[128];
4813
+ const children = t37;
4814
+ let t38;
4815
+ $[129] !== animate || $[130] !== children ? (t38 = animate ? /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children }) : children, $[129] = animate, $[130] = children, $[131] = t38) : t38 = $[131];
4816
+ let t39;
4817
+ return $[132] !== child || $[133] !== t38 ? (t39 = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4818
+ t38,
4561
4819
  child
4562
- ] });
4820
+ ] }), $[132] = child, $[133] = t38, $[134] = t39) : t39 = $[134], t39;
4563
4821
  });
4564
4822
  Tooltip.displayName = "ForwardRef(Tooltip)";
4823
+ function useMiddleware(t0) {
4824
+ const $ = reactCompilerRuntime.c(17), {
4825
+ animate,
4826
+ arrowProp,
4827
+ arrowRef,
4828
+ boundaryElement,
4829
+ fallbackPlacements,
4830
+ rootBoundary
4831
+ } = t0;
4832
+ let ret;
4833
+ if ($[0] !== animate || $[1] !== arrowProp || $[2] !== arrowRef || $[3] !== boundaryElement || $[4] !== fallbackPlacements || $[5] !== rootBoundary) {
4834
+ ret = [];
4835
+ const t1 = boundaryElement || void 0;
4836
+ let t2;
4837
+ $[7] !== fallbackPlacements || $[8] !== rootBoundary || $[9] !== t1 ? (t2 = reactDom$1.flip({
4838
+ boundary: t1,
4839
+ fallbackPlacements,
4840
+ padding: DEFAULT_TOOLTIP_PADDING,
4841
+ rootBoundary
4842
+ }), $[7] = fallbackPlacements, $[8] = rootBoundary, $[9] = t1, $[10] = t2) : t2 = $[10], ret.push(t2);
4843
+ let t3;
4844
+ $[11] === Symbol.for("react.memo_cache_sentinel") ? (t3 = reactDom$1.offset({
4845
+ mainAxis: DEFAULT_TOOLTIP_DISTANCE
4846
+ }), $[11] = t3) : t3 = $[11], ret.push(t3);
4847
+ const t4 = boundaryElement || void 0;
4848
+ let t5;
4849
+ if ($[12] !== rootBoundary || $[13] !== t4 ? (t5 = reactDom$1.shift({
4850
+ boundary: t4,
4851
+ rootBoundary,
4852
+ padding: DEFAULT_TOOLTIP_PADDING
4853
+ }), $[12] = rootBoundary, $[13] = t4, $[14] = t5) : t5 = $[14], ret.push(t5), arrowProp) {
4854
+ let t6;
4855
+ $[15] !== arrowRef ? (t6 = reactDom$1.arrow({
4856
+ element: arrowRef,
4857
+ padding: DEFAULT_TOOLTIP_PADDING
4858
+ }), $[15] = arrowRef, $[16] = t6) : t6 = $[16], ret.push(t6);
4859
+ }
4860
+ animate && ret.push(origin), $[0] = animate, $[1] = arrowProp, $[2] = arrowRef, $[3] = boundaryElement, $[4] = fallbackPlacements, $[5] = rootBoundary, $[6] = ret;
4861
+ } else
4862
+ ret = $[6];
4863
+ return ret;
4864
+ }
4565
4865
  function useCloseOnMouseLeave(t0) {
4566
4866
  const $ = reactCompilerRuntime.c(10), {
4567
4867
  handleIsOpenChange,