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