@sanity/ui 2.9.0-canary.4 → 2.9.0-canary.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -1,7 +1,7 @@
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, useRef, useEffect, useDebugValue, useImperativeHandle, useSyncExternalStore, createContext, useContext, forwardRef, useId, Children, isValidElement, cloneElement, Component, memo, useLayoutEffect, useMemo, useCallback, useReducer, Fragment as Fragment$1, startTransition } from "react";
4
+ import { useState, useRef, useEffect, useDebugValue, useImperativeHandle, useSyncExternalStore, createContext, useContext, forwardRef, useId, Children, isValidElement, cloneElement, Component, memo, useLayoutEffect, useReducer, Fragment as Fragment$1, startTransition } from "react";
5
5
  import ReactIs, { isValidElementType } from "react-is";
6
6
  import { ThemeProvider as ThemeProvider$1, useTheme as useTheme$1, css, styled, keyframes } from "styled-components";
7
7
  import { SpinnerIcon, CheckmarkIcon, RemoveIcon, ChevronDownIcon, CloseIcon, ChevronRightIcon, ToggleArrowRightIcon } from "@sanity/icons";
@@ -3763,8 +3763,8 @@ const MotionCard$1 = styled(motion(Card))`
3763
3763
  will-change: opacity;
3764
3764
  }
3765
3765
  `, PopoverCard = memo(forwardRef(function(props, ref) {
3766
- const $ = c(60);
3767
- let marginsProp, xProp, yProp, animate, originX, originY, strategy, style, width, arrowX, arrowY, restProps, padding, children, overflow, arrow2, arrowRef, placement, radius, scheme, shadow, tone;
3766
+ const $ = c(58);
3767
+ let marginsProp, xProp, yProp, animate, originX, originY, strategy, style, arrowX, arrowY, restProps, padding, children, overflow, arrow2, arrowRef, placement, radius, scheme, shadow, tone;
3768
3768
  $[0] !== props ? ({
3769
3769
  __unstable_margins: marginsProp,
3770
3770
  animate,
@@ -3784,11 +3784,10 @@ const MotionCard$1 = styled(motion(Card))`
3784
3784
  strategy,
3785
3785
  style,
3786
3786
  tone,
3787
- width,
3788
3787
  x: xProp,
3789
3788
  y: yProp,
3790
3789
  ...restProps
3791
- } = props, $[0] = props, $[1] = marginsProp, $[2] = xProp, $[3] = yProp, $[4] = animate, $[5] = originX, $[6] = originY, $[7] = strategy, $[8] = style, $[9] = width, $[10] = arrowX, $[11] = arrowY, $[12] = restProps, $[13] = padding, $[14] = children, $[15] = overflow, $[16] = arrow2, $[17] = arrowRef, $[18] = placement, $[19] = radius, $[20] = scheme, $[21] = shadow, $[22] = tone) : (marginsProp = $[1], xProp = $[2], yProp = $[3], animate = $[4], originX = $[5], originY = $[6], strategy = $[7], style = $[8], width = $[9], arrowX = $[10], arrowY = $[11], restProps = $[12], padding = $[13], children = $[14], overflow = $[15], arrow2 = $[16], arrowRef = $[17], placement = $[18], radius = $[19], scheme = $[20], shadow = $[21], tone = $[22]);
3790
+ } = props, $[0] = props, $[1] = marginsProp, $[2] = xProp, $[3] = yProp, $[4] = animate, $[5] = originX, $[6] = originY, $[7] = strategy, $[8] = style, $[9] = arrowX, $[10] = arrowY, $[11] = restProps, $[12] = padding, $[13] = children, $[14] = overflow, $[15] = arrow2, $[16] = arrowRef, $[17] = placement, $[18] = radius, $[19] = scheme, $[20] = shadow, $[21] = tone) : (marginsProp = $[1], xProp = $[2], yProp = $[3], animate = $[4], originX = $[5], originY = $[6], strategy = $[7], style = $[8], arrowX = $[9], arrowY = $[10], restProps = $[11], padding = $[12], children = $[13], overflow = $[14], arrow2 = $[15], arrowRef = $[16], placement = $[17], radius = $[18], scheme = $[19], shadow = $[20], tone = $[21]);
3792
3791
  const {
3793
3792
  zIndex
3794
3793
  } = useLayer();
@@ -3798,139 +3797,163 @@ const MotionCard$1 = styled(motion(Card))`
3798
3797
  let t1;
3799
3798
  const t2 = animate ? "transform" : void 0;
3800
3799
  let t3;
3801
- $[23] !== x || $[24] !== originX || $[25] !== originY || $[26] !== strategy || $[27] !== y || $[28] !== width || $[29] !== zIndex || $[30] !== t2 || $[31] !== style ? (t3 = {
3800
+ $[22] !== x || $[23] !== originX || $[24] !== originY || $[25] !== strategy || $[26] !== y || $[27] !== zIndex || $[28] !== t2 || $[29] !== style ? (t3 = {
3802
3801
  left: x,
3803
3802
  originX,
3804
3803
  originY,
3805
3804
  position: strategy,
3806
3805
  top: y,
3807
- width,
3808
3806
  zIndex,
3809
3807
  willChange: t2,
3810
3808
  ...style
3811
- }, $[23] = x, $[24] = originX, $[25] = originY, $[26] = strategy, $[27] = y, $[28] = width, $[29] = zIndex, $[30] = t2, $[31] = style, $[32] = t3) : t3 = $[32], t1 = t3;
3809
+ }, $[22] = x, $[23] = originX, $[24] = originY, $[25] = strategy, $[26] = y, $[27] = zIndex, $[28] = t2, $[29] = style, $[30] = t3) : t3 = $[30], t1 = t3;
3812
3810
  const rootStyle2 = t1;
3813
3811
  let t4;
3814
3812
  const t5 = arrowX !== null ? arrowX : void 0, t6 = arrowY !== null ? arrowY : void 0;
3815
3813
  let t7;
3816
- $[33] !== t5 || $[34] !== t6 ? (t7 = {
3814
+ $[31] !== t5 || $[32] !== t6 ? (t7 = {
3817
3815
  left: t5,
3818
3816
  top: t6,
3819
3817
  right: void 0,
3820
3818
  bottom: void 0
3821
- }, $[33] = t5, $[34] = t6, $[35] = t7) : t7 = $[35], t4 = t7;
3819
+ }, $[31] = t5, $[32] = t6, $[33] = t7) : t7 = $[33], t4 = t7;
3822
3820
  const arrowStyle = t4, t8 = restProps;
3823
3821
  let t9;
3824
- $[36] !== animate ? (t9 = animate ? POPOVER_MOTION_PROPS : {}, $[36] = animate, $[37] = t9) : t9 = $[37];
3822
+ $[34] !== animate ? (t9 = animate ? POPOVER_MOTION_PROPS : {}, $[34] = animate, $[35] = t9) : t9 = $[35];
3825
3823
  let t10;
3826
- $[38] !== padding || $[39] !== children ? (t10 = /* @__PURE__ */ jsx(Flex, { direction: "column", flex: 1, padding, children }), $[38] = padding, $[39] = children, $[40] = t10) : t10 = $[40];
3824
+ $[36] !== padding || $[37] !== children ? (t10 = /* @__PURE__ */ jsx(Flex, { direction: "column", flex: 1, padding, children }), $[36] = padding, $[37] = children, $[38] = t10) : t10 = $[38];
3827
3825
  let t11;
3828
- $[41] !== overflow || $[42] !== t10 ? (t11 = /* @__PURE__ */ jsx(Flex, { "data-ui": "Popover__wrapper", direction: "column", flex: 1, overflow, children: t10 }), $[41] = overflow, $[42] = t10, $[43] = t11) : t11 = $[43];
3826
+ $[39] !== overflow || $[40] !== t10 ? (t11 = /* @__PURE__ */ jsx(Flex, { "data-ui": "Popover__wrapper", direction: "column", flex: 1, overflow, children: t10 }), $[39] = overflow, $[40] = t10, $[41] = t11) : t11 = $[41];
3829
3827
  let t12;
3830
- $[44] !== arrow2 || $[45] !== arrowRef || $[46] !== arrowStyle ? (t12 = arrow2 && /* @__PURE__ */ jsx(Arrow, { ref: arrowRef, style: arrowStyle, width: DEFAULT_POPOVER_ARROW_WIDTH, height: DEFAULT_POPOVER_ARROW_HEIGHT, radius: DEFAULT_POPOVER_ARROW_RADIUS }), $[44] = arrow2, $[45] = arrowRef, $[46] = arrowStyle, $[47] = t12) : t12 = $[47];
3828
+ $[42] !== arrow2 || $[43] !== arrowRef || $[44] !== arrowStyle ? (t12 = arrow2 && /* @__PURE__ */ jsx(Arrow, { ref: arrowRef, style: arrowStyle, width: DEFAULT_POPOVER_ARROW_WIDTH, height: DEFAULT_POPOVER_ARROW_HEIGHT, radius: DEFAULT_POPOVER_ARROW_RADIUS }), $[42] = arrow2, $[43] = arrowRef, $[44] = arrowStyle, $[45] = t12) : t12 = $[45];
3831
3829
  let t13;
3832
- return $[48] !== t8 || $[49] !== placement || $[50] !== radius || $[51] !== ref || $[52] !== scheme || $[53] !== shadow || $[54] !== rootStyle2 || $[55] !== tone || $[56] !== t9 || $[57] !== t11 || $[58] !== t12 ? (t13 = /* @__PURE__ */ jsxs(MotionCard$1, { "data-ui": "Popover", ...t8, "data-placement": placement, radius, ref, scheme, shadow, sizing: "border", style: rootStyle2, tone, ...t9, children: [
3830
+ return $[46] !== t8 || $[47] !== placement || $[48] !== radius || $[49] !== ref || $[50] !== scheme || $[51] !== shadow || $[52] !== rootStyle2 || $[53] !== tone || $[54] !== t9 || $[55] !== t11 || $[56] !== t12 ? (t13 = /* @__PURE__ */ jsxs(MotionCard$1, { "data-ui": "Popover", ...t8, "data-placement": placement, radius, ref, scheme, shadow, sizing: "border", style: rootStyle2, tone, ...t9, children: [
3833
3831
  t11,
3834
3832
  t12
3835
- ] }), $[48] = t8, $[49] = placement, $[50] = radius, $[51] = ref, $[52] = scheme, $[53] = shadow, $[54] = rootStyle2, $[55] = tone, $[56] = t9, $[57] = t11, $[58] = t12, $[59] = t13) : t13 = $[59], t13;
3833
+ ] }), $[46] = t8, $[47] = placement, $[48] = radius, $[49] = ref, $[50] = scheme, $[51] = shadow, $[52] = rootStyle2, $[53] = tone, $[54] = t9, $[55] = t11, $[56] = t12, $[57] = t13) : t13 = $[57], t13;
3836
3834
  }));
3837
3835
  PopoverCard.displayName = "Memo(ForwardRef(PopoverCard))";
3838
3836
  const Popover = memo(forwardRef(function(props, forwardedRef) {
3839
- const {
3837
+ const $ = c(128), {
3840
3838
  container,
3841
3839
  layer
3842
- } = useTheme_v2(), boundaryElementContext = useBoundaryElement(), {
3843
- __unstable_margins: margins = DEFAULT_POPOVER_MARGINS,
3844
- animate: _animate = !1,
3845
- arrow: arrowProp = !1,
3846
- boundaryElement: _boundaryElement,
3847
- children: childProp,
3848
- constrainSize = !1,
3849
- content,
3850
- disabled,
3851
- fallbackPlacements: _fallbackPlacements,
3852
- matchReferenceWidth,
3853
- floatingBoundary: _floatingBoundary,
3854
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
3855
- onActivate,
3856
- open,
3857
- overflow = "hidden",
3858
- padding: paddingProp,
3859
- placement: placementProp = "bottom",
3860
- portal,
3861
- preventOverflow = !0,
3862
- radius: radiusProp = 3,
3863
- referenceBoundary: _referenceBoundary,
3864
- referenceElement,
3865
- scheme,
3866
- shadow: shadowProp = 3,
3867
- tone = "inherit",
3868
- width: widthProp = "auto",
3869
- zOffset: _zOffsetProp,
3870
- updateRef,
3871
- ...restProps
3872
- } = props, boundaryElement = _boundaryElement ?? boundaryElementContext.element, fallbackPlacements = _fallbackPlacements ?? DEFAULT_FALLBACK_PLACEMENTS$1[props.placement ?? "bottom"], floatingBoundary = _floatingBoundary ?? boundaryElement ?? boundaryElementContext.element, referenceBoundary = _referenceBoundary ?? 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), [arrowElement, setArrowElement] = useState(null), rootBoundary = "viewport";
3873
- useImperativeHandle(forwardedRef, () => ref.current);
3874
- const mediaIndex = useMediaIndex(), boundaryWidth = constrainSize || preventOverflow ? boundarySize?.width : void 0, width = calcCurrentWidth({
3875
- container,
3876
- mediaIndex,
3877
- width: widthArrayProp
3878
- }), widthRef = useRef(width);
3879
- useEffect(() => {
3880
- widthRef.current = width;
3881
- }, [width]);
3882
- const maxWidth = calcMaxWidth({
3883
- boundaryWidth,
3884
- currentWidth: width
3885
- }), maxWidthRef = useRef(maxWidth);
3886
- useEffect(() => {
3887
- maxWidthRef.current = maxWidth;
3888
- }, [maxWidth]);
3889
- const referenceWidthRef = useRef();
3890
- useLayoutEffect(() => {
3840
+ } = useTheme_v2(), boundaryElementContext = useBoundaryElement();
3841
+ let t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, _boundaryElement, _fallbackPlacements, _floatingBoundary, _referenceBoundary, _zOffsetProp, paddingProp, open, matchReferenceWidth, childProp, referenceElement, updateRef, disabled, restProps, scheme, content, portal;
3842
+ if ($[0] !== props) {
3843
+ const {
3844
+ __unstable_margins: t112,
3845
+ animate: t122,
3846
+ arrow: t132,
3847
+ boundaryElement: t142,
3848
+ children: t152,
3849
+ constrainSize: t162,
3850
+ content: t172,
3851
+ disabled: t182,
3852
+ fallbackPlacements: t192,
3853
+ matchReferenceWidth: t202,
3854
+ floatingBoundary: t212,
3855
+ onActivate,
3856
+ open: t222,
3857
+ overflow: t232,
3858
+ padding: t242,
3859
+ placement: t252,
3860
+ portal: t262,
3861
+ preventOverflow: t272,
3862
+ radius: t282,
3863
+ referenceBoundary: t292,
3864
+ referenceElement: t302,
3865
+ scheme: t312,
3866
+ shadow: t322,
3867
+ tone: t332,
3868
+ width: t342,
3869
+ zOffset: t352,
3870
+ updateRef: t362,
3871
+ ...t372
3872
+ } = props;
3873
+ t0 = t112, t1 = t122, t2 = t132, _boundaryElement = t142, childProp = t152, t3 = t162, content = t172, disabled = t182, _fallbackPlacements = t192, matchReferenceWidth = t202, _floatingBoundary = t212, open = t222, t4 = t232, paddingProp = t242, t5 = t252, portal = t262, t6 = t272, t7 = t282, _referenceBoundary = t292, referenceElement = t302, scheme = t312, t8 = t322, t9 = t332, t10 = t342, _zOffsetProp = t352, updateRef = t362, restProps = t372, $[0] = props, $[1] = t0, $[2] = t1, $[3] = t2, $[4] = t3, $[5] = t4, $[6] = t5, $[7] = t6, $[8] = t7, $[9] = t8, $[10] = t9, $[11] = t10, $[12] = _boundaryElement, $[13] = _fallbackPlacements, $[14] = _floatingBoundary, $[15] = _referenceBoundary, $[16] = _zOffsetProp, $[17] = paddingProp, $[18] = open, $[19] = matchReferenceWidth, $[20] = childProp, $[21] = referenceElement, $[22] = updateRef, $[23] = disabled, $[24] = restProps, $[25] = scheme, $[26] = content, $[27] = portal;
3874
+ } else
3875
+ t0 = $[1], t1 = $[2], t2 = $[3], t3 = $[4], t4 = $[5], t5 = $[6], t6 = $[7], t7 = $[8], t8 = $[9], t9 = $[10], t10 = $[11], _boundaryElement = $[12], _fallbackPlacements = $[13], _floatingBoundary = $[14], _referenceBoundary = $[15], _zOffsetProp = $[16], paddingProp = $[17], open = $[18], matchReferenceWidth = $[19], childProp = $[20], referenceElement = $[21], updateRef = $[22], disabled = $[23], restProps = $[24], scheme = $[25], content = $[26], portal = $[27];
3876
+ 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, preventOverflow = t6 === void 0 ? !0 : t6, radiusProp = t7 === void 0 ? 3 : t7, shadowProp = t8 === void 0 ? 3 : t8, tone = t9 === void 0 ? "inherit" : t9, widthProp = t10 === void 0 ? "auto" : t10, boundaryElement = _boundaryElement ?? boundaryElementContext.element, fallbackPlacements = _fallbackPlacements ?? DEFAULT_FALLBACK_PLACEMENTS$1[props.placement ?? "bottom"], floatingBoundary = _floatingBoundary ?? boundaryElement ?? boundaryElementContext.element, referenceBoundary = _referenceBoundary ?? 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), [arrowElement, setArrowElement] = useState(null);
3877
+ let t11;
3878
+ $[28] === Symbol.for("react.memo_cache_sentinel") ? (t11 = () => ref.current, $[28] = t11) : t11 = $[28], useImperativeHandle(forwardedRef, t11);
3879
+ const mediaIndex = useMediaIndex(), boundaryWidth = constrainSize || preventOverflow ? boundarySize?.width : void 0;
3880
+ let t12, t13;
3881
+ $[29] !== open || $[30] !== constrainSize || $[31] !== matchReferenceWidth || $[32] !== container || $[33] !== mediaIndex || $[34] !== widthArrayProp || $[35] !== boundaryWidth ? (t12 = () => {
3891
3882
  const floatingElement = ref.current;
3892
- if (!open || !floatingElement) return;
3893
- const referenceWidth = referenceWidthRef.current;
3894
- matchReferenceWidth ? referenceWidthRef.current !== void 0 && (floatingElement.style.width = `${referenceWidth}px`) : width !== void 0 && (floatingElement.style.width = `${width}px`), typeof maxWidth == "number" && (floatingElement.style.maxWidth = `${maxWidth}px`);
3895
- }, [width, matchReferenceWidth, maxWidth, open]);
3896
- const middleware = useMemo(() => {
3897
- const ret = [];
3898
- return (constrainSize || preventOverflow) && ret.push(flip({
3899
- boundary: floatingBoundary || void 0,
3900
- fallbackPlacements,
3901
- padding: DEFAULT_POPOVER_PADDING,
3902
- rootBoundary
3903
- })), ret.push(offset({
3904
- mainAxis: DEFAULT_POPOVER_DISTANCE
3905
- })), (constrainSize || matchReferenceWidth) && ret.push(size({
3906
- apply({
3883
+ if (!open || !floatingElement || constrainSize || matchReferenceWidth)
3884
+ return;
3885
+ const currentWidth = calcCurrentWidth({
3886
+ container,
3887
+ mediaIndex,
3888
+ width: widthArrayProp
3889
+ }), maxWidth = calcMaxWidth({
3890
+ boundaryWidth,
3891
+ currentWidth
3892
+ });
3893
+ currentWidth !== void 0 && (floatingElement.style.width = `${currentWidth}px`), typeof maxWidth == "number" && (floatingElement.style.maxWidth = `${maxWidth}px`);
3894
+ }, t13 = [boundaryWidth, constrainSize, container, matchReferenceWidth, mediaIndex, open, widthArrayProp], $[29] = open, $[30] = constrainSize, $[31] = matchReferenceWidth, $[32] = container, $[33] = mediaIndex, $[34] = widthArrayProp, $[35] = boundaryWidth, $[36] = t12, $[37] = t13) : (t12 = $[36], t13 = $[37]), useLayoutEffect(t12, t13);
3895
+ let t14;
3896
+ $[38] !== constrainSize || $[39] !== preventOverflow || $[40] !== floatingBoundary || $[41] !== fallbackPlacements ? (t14 = (constrainSize || preventOverflow) && flip({
3897
+ boundary: floatingBoundary || void 0,
3898
+ fallbackPlacements,
3899
+ padding: DEFAULT_POPOVER_PADDING,
3900
+ rootBoundary: "viewport"
3901
+ }), $[38] = constrainSize, $[39] = preventOverflow, $[40] = floatingBoundary, $[41] = fallbackPlacements, $[42] = t14) : t14 = $[42];
3902
+ let t15;
3903
+ $[43] === Symbol.for("react.memo_cache_sentinel") ? (t15 = offset({
3904
+ mainAxis: DEFAULT_POPOVER_DISTANCE
3905
+ }), $[43] = t15) : t15 = $[43];
3906
+ let t16;
3907
+ $[44] !== constrainSize || $[45] !== matchReferenceWidth || $[46] !== container || $[47] !== mediaIndex || $[48] !== widthArrayProp || $[49] !== boundaryWidth || $[50] !== floatingBoundary || $[51] !== margins ? (t16 = (constrainSize || matchReferenceWidth) && size({
3908
+ apply(t172) {
3909
+ const {
3907
3910
  availableWidth,
3908
3911
  availableHeight,
3909
3912
  elements,
3910
- referenceWidth: referenceWidth_0
3911
- }) {
3912
- referenceWidthRef.current = referenceWidth_0;
3913
- const _currentWidth = widthRef.current, _maxWidth = maxWidthRef.current;
3914
- 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`);
3915
- },
3916
- boundaryElement: floatingBoundary || void 0,
3917
- constrainSize,
3918
- margins,
3919
- matchReferenceWidth,
3920
- padding: DEFAULT_POPOVER_PADDING
3921
- })), preventOverflow && ret.push(shift({
3922
- boundary: floatingBoundary || void 0,
3923
- rootBoundary,
3924
- padding: DEFAULT_POPOVER_PADDING
3925
- })), arrowProp && ret.push(arrow({
3926
- element: arrowElement,
3927
- padding: DEFAULT_POPOVER_PADDING
3928
- })), animate && ret.push(origin), ret.push(hide({
3929
- boundary: referenceBoundary || void 0,
3930
- padding: DEFAULT_POPOVER_PADDING,
3931
- strategy: "referenceHidden"
3932
- })), ret;
3933
- }, [animate, arrowElement, arrowProp, constrainSize, fallbackPlacements, floatingBoundary, margins, matchReferenceWidth, preventOverflow, referenceBoundary]), {
3913
+ referenceWidth
3914
+ } = t172, currentWidth_0 = calcCurrentWidth({
3915
+ container,
3916
+ mediaIndex,
3917
+ width: widthArrayProp
3918
+ }), maxWidth_0 = calcMaxWidth({
3919
+ boundaryWidth,
3920
+ currentWidth: currentWidth_0
3921
+ });
3922
+ matchReferenceWidth ? elements.floating.style.width = `${referenceWidth}px` : currentWidth_0 !== void 0 && (elements.floating.style.width = `${currentWidth_0}px`), constrainSize && (elements.floating.style.maxWidth = `${Math.min(availableWidth, maxWidth_0 ?? 1 / 0)}px`, elements.floating.style.maxHeight = `${availableHeight}px`);
3923
+ },
3924
+ boundaryElement: floatingBoundary || void 0,
3925
+ constrainSize,
3926
+ margins,
3927
+ matchReferenceWidth,
3928
+ padding: DEFAULT_POPOVER_PADDING
3929
+ }), $[44] = constrainSize, $[45] = matchReferenceWidth, $[46] = container, $[47] = mediaIndex, $[48] = widthArrayProp, $[49] = boundaryWidth, $[50] = floatingBoundary, $[51] = margins, $[52] = t16) : t16 = $[52];
3930
+ let t17;
3931
+ $[53] !== preventOverflow || $[54] !== floatingBoundary ? (t17 = preventOverflow && shift({
3932
+ boundary: floatingBoundary || void 0,
3933
+ rootBoundary: "viewport",
3934
+ padding: DEFAULT_POPOVER_PADDING
3935
+ }), $[53] = preventOverflow, $[54] = floatingBoundary, $[55] = t17) : t17 = $[55];
3936
+ let t18;
3937
+ $[56] !== arrowProp || $[57] !== arrowElement ? (t18 = arrowProp && arrow({
3938
+ element: arrowElement,
3939
+ padding: DEFAULT_POPOVER_PADDING
3940
+ }), $[56] = arrowProp, $[57] = arrowElement, $[58] = t18) : t18 = $[58];
3941
+ const t19 = animate && origin, t20 = referenceBoundary || void 0;
3942
+ let t21;
3943
+ $[59] !== t20 ? (t21 = hide({
3944
+ boundary: t20,
3945
+ padding: DEFAULT_POPOVER_PADDING,
3946
+ strategy: "referenceHidden"
3947
+ }), $[59] = t20, $[60] = t21) : t21 = $[60];
3948
+ let t22;
3949
+ $[61] !== t14 || $[62] !== t16 || $[63] !== t17 || $[64] !== t18 || $[65] !== t19 || $[66] !== t21 ? (t22 = [t14, t15, t16, t17, t18, t19, t21], $[61] = t14, $[62] = t16, $[63] = t17, $[64] = t18, $[65] = t19, $[66] = t21, $[67] = t22) : t22 = $[67];
3950
+ let t23;
3951
+ $[68] !== t22 || $[69] !== placementProp ? (t23 = {
3952
+ middleware: t22,
3953
+ placement: placementProp,
3954
+ whileElementsMounted: autoUpdate
3955
+ }, $[68] = t22, $[69] = placementProp, $[70] = t23) : t23 = $[70];
3956
+ const {
3934
3957
  x,
3935
3958
  y,
3936
3959
  middlewareData,
@@ -3938,31 +3961,60 @@ const Popover = memo(forwardRef(function(props, forwardedRef) {
3938
3961
  refs,
3939
3962
  strategy,
3940
3963
  update
3941
- } = useFloating({
3942
- middleware,
3943
- placement: placementProp,
3944
- whileElementsMounted: autoUpdate
3945
- }), referenceHidden = middlewareData.hide?.referenceHidden, arrowX = middlewareData.arrow?.x, arrowY = middlewareData.arrow?.y, originX = middlewareData["@sanity/ui/origin"]?.originX, originY = middlewareData["@sanity/ui/origin"]?.originY, setFloating = useCallback((node) => {
3964
+ } = 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;
3965
+ let t24;
3966
+ $[71] !== refs ? (t24 = (node) => {
3946
3967
  ref.current = node, refs.setFloating(node);
3947
- }, [refs]), [childElement, setChildElement] = useState(null), setReference = useCallback((node_0) => {
3968
+ }, $[71] = refs, $[72] = t24) : t24 = $[72];
3969
+ const setFloating = t24, [childElement, setChildElement] = useState(null);
3970
+ let t25;
3971
+ $[73] !== refs ? (t25 = (node_0) => {
3948
3972
  refs.setReference(node_0), setChildElement(node_0);
3949
- }, [refs]);
3950
- useImperativeHandle(getElementRef(childProp), () => childElement, [childElement]);
3951
- const child = useMemo(() => !childProp || referenceElement ? null : cloneElement(childProp, {
3952
- ref: setReference
3953
- }), [childProp, referenceElement, setReference]);
3954
- if (useImperativeHandle(updateRef, () => update, [update]), useEffect(() => {
3973
+ }, $[73] = refs, $[74] = t25) : t25 = $[74];
3974
+ const setReference = t25, t26 = childProp;
3975
+ let t27;
3976
+ $[75] !== t26 ? (t27 = getElementRef$1(t26), $[75] = t26, $[76] = t27) : t27 = $[76];
3977
+ let t28, t29;
3978
+ $[77] !== childElement ? (t28 = () => childElement, t29 = [childElement], $[77] = childElement, $[78] = t28, $[79] = t29) : (t28 = $[78], t29 = $[79]), useImperativeHandle(t27, t28, t29);
3979
+ let t30;
3980
+ bb0: {
3981
+ if (!childProp || referenceElement) {
3982
+ t30 = null;
3983
+ break bb0;
3984
+ }
3985
+ let t312;
3986
+ $[80] !== setReference || $[81] !== childProp ? (t312 = cloneElement(childProp, {
3987
+ ref: setReference
3988
+ }), $[80] = setReference, $[81] = childProp, $[82] = t312) : t312 = $[82], t30 = t312;
3989
+ }
3990
+ const child = t30;
3991
+ let t31, t32;
3992
+ $[83] !== update ? (t31 = () => update, t32 = [update], $[83] = update, $[84] = t31, $[85] = t32) : (t31 = $[84], t32 = $[85]), useImperativeHandle(updateRef, t31, t32);
3993
+ let t33, t34;
3994
+ if ($[86] !== child || $[87] !== refs || $[88] !== referenceElement ? (t33 = () => {
3955
3995
  child || refs.setReference(referenceElement || null);
3956
- }, [referenceElement, refs, child]), disabled)
3957
- return childProp || /* @__PURE__ */ jsx(Fragment, {});
3958
- const popover = /* @__PURE__ */ jsx(LayerProvider, { zOffset, children: /* @__PURE__ */ jsx(PopoverCard, { ...restProps, __unstable_margins: margins, animate, arrow: arrowProp, arrowRef: setArrowElement, 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 }) }), children = open && (portal ? /* @__PURE__ */ jsx(Portal, { __unstable_name: typeof portal == "string" ? portal : void 0, children: popover }) : popover);
3959
- return /* @__PURE__ */ jsxs(Fragment, { children: [
3960
- animate ? /* @__PURE__ */ jsx(AnimatePresence, { children }) : children,
3996
+ }, t34 = [referenceElement, refs, child], $[86] = child, $[87] = refs, $[88] = referenceElement, $[89] = t33, $[90] = t34) : (t33 = $[89], t34 = $[90]), useEffect(t33, t34), disabled) {
3997
+ let t352;
3998
+ return $[91] !== childProp ? (t352 = childProp || /* @__PURE__ */ jsx(Fragment, {}), $[91] = childProp, $[92] = t352) : t352 = $[92], t352;
3999
+ }
4000
+ let t35;
4001
+ $[93] !== restProps || $[94] !== margins || $[95] !== animate || $[96] !== arrowProp || $[97] !== arrowX || $[98] !== arrowY || $[99] !== referenceHidden || $[100] !== overflow || $[101] !== padding || $[102] !== placement || $[103] !== radius || $[104] !== setFloating || $[105] !== scheme || $[106] !== shadow || $[107] !== originX || $[108] !== originY || $[109] !== strategy || $[110] !== tone || $[111] !== x || $[112] !== y || $[113] !== content ? (t35 = /* @__PURE__ */ jsx(PopoverCard, { ...restProps, __unstable_margins: margins, animate, arrow: arrowProp, arrowRef: setArrowElement, arrowX, arrowY, hidden: referenceHidden, overflow, padding, placement, radius, ref: setFloating, scheme, shadow, originX, originY, strategy, tone, x, y, children: content }), $[93] = restProps, $[94] = margins, $[95] = animate, $[96] = arrowProp, $[97] = arrowX, $[98] = arrowY, $[99] = referenceHidden, $[100] = overflow, $[101] = padding, $[102] = placement, $[103] = radius, $[104] = setFloating, $[105] = scheme, $[106] = shadow, $[107] = originX, $[108] = originY, $[109] = strategy, $[110] = tone, $[111] = x, $[112] = y, $[113] = content, $[114] = t35) : t35 = $[114];
4002
+ let t36;
4003
+ $[115] !== zOffset || $[116] !== t35 ? (t36 = /* @__PURE__ */ jsx(LayerProvider, { zOffset, children: t35 }), $[115] = zOffset, $[116] = t35, $[117] = t36) : t36 = $[117];
4004
+ const popover = t36;
4005
+ let t37;
4006
+ $[118] !== open || $[119] !== portal || $[120] !== popover ? (t37 = open && (portal ? /* @__PURE__ */ jsx(Portal, { __unstable_name: typeof portal == "string" ? portal : void 0, children: popover }) : popover), $[118] = open, $[119] = portal, $[120] = popover, $[121] = t37) : t37 = $[121];
4007
+ const children = t37;
4008
+ let t38;
4009
+ $[122] !== animate || $[123] !== children ? (t38 = animate ? /* @__PURE__ */ jsx(AnimatePresence, { children }) : children, $[122] = animate, $[123] = children, $[124] = t38) : t38 = $[124];
4010
+ let t39;
4011
+ return $[125] !== t38 || $[126] !== child ? (t39 = /* @__PURE__ */ jsxs(Fragment, { children: [
4012
+ t38,
3961
4013
  child
3962
- ] });
4014
+ ] }), $[125] = t38, $[126] = child, $[127] = t39) : t39 = $[127], t39;
3963
4015
  }));
3964
4016
  Popover.displayName = "Memo(ForwardRef(Popover))";
3965
- function getElementRef(element) {
4017
+ function getElementRef$1(element) {
3966
4018
  if (!element) return null;
3967
4019
  let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get, mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
3968
4020
  return mayWarn ? element.ref : (getter = Object.getOwnPropertyDescriptor(element, "ref")?.get, mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning, mayWarn ? element.props.ref : element.props.ref || element.ref);
@@ -4796,55 +4848,80 @@ TooltipDelayGroupProvider.displayName = "TooltipDelayGroupProvider";
4796
4848
  const Root$a = styled(Layer)`
4797
4849
  pointer-events: none;
4798
4850
  `, Tooltip = forwardRef(function(props, forwardedRef) {
4799
- const boundaryElementContext = useBoundaryElement(), {
4851
+ const $ = c(142), boundaryElementContext = useBoundaryElement(), {
4800
4852
  layer
4801
- } = useTheme_v2(), {
4802
- animate: _animate = !1,
4803
- arrow: arrowProp = !1,
4853
+ } = useTheme_v2();
4854
+ let t0, t1, t2, t3, t4, t5, _boundaryElement, _fallbackPlacementsProp, _zOffset, portalProp, delay, childProp, disabled, content, restProps, scheme;
4855
+ $[0] !== props ? ({
4856
+ animate: t0,
4857
+ arrow: t1,
4804
4858
  boundaryElement: _boundaryElement,
4805
4859
  children: childProp,
4806
4860
  content,
4807
4861
  disabled,
4808
4862
  fallbackPlacements: _fallbackPlacementsProp,
4809
- padding = 2,
4810
- placement: placementProp = "bottom",
4863
+ padding: t2,
4864
+ placement: t3,
4811
4865
  portal: portalProp,
4812
- radius = 2,
4866
+ radius: t4,
4813
4867
  scheme,
4814
- shadow = 2,
4868
+ shadow: t5,
4815
4869
  zOffset: _zOffset,
4816
4870
  delay,
4817
4871
  ...restProps
4818
- } = props, 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), rootBoundary = "viewport", [tooltipMaxWidth, setTooltipMaxWidth] = useState(0);
4819
- useImperativeHandle(forwardedRef, () => ref.current);
4820
- const portal = usePortal(), portalElement = typeof portalProp == "string" ? portal.elements?.[portalProp] || null : portal.element, middleware = useMemo(() => {
4821
- const ret = [];
4822
- return ret.push(flip({
4823
- boundary: boundaryElement || void 0,
4872
+ } = props, $[0] = props, $[1] = t0, $[2] = t1, $[3] = t2, $[4] = t3, $[5] = t4, $[6] = t5, $[7] = _boundaryElement, $[8] = _fallbackPlacementsProp, $[9] = _zOffset, $[10] = portalProp, $[11] = delay, $[12] = childProp, $[13] = disabled, $[14] = content, $[15] = restProps, $[16] = scheme) : (t0 = $[1], t1 = $[2], t2 = $[3], t3 = $[4], t4 = $[5], t5 = $[6], _boundaryElement = $[7], _fallbackPlacementsProp = $[8], _zOffset = $[9], portalProp = $[10], delay = $[11], childProp = $[12], disabled = $[13], content = $[14], restProps = $[15], scheme = $[16]);
4873
+ 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), [arrowElement, setArrowElement] = useState(null), [tooltipMaxWidth, setTooltipMaxWidth] = useState(0);
4874
+ let t6;
4875
+ $[17] === Symbol.for("react.memo_cache_sentinel") ? (t6 = () => ref.current, $[17] = t6) : t6 = $[17], useImperativeHandle(forwardedRef, t6);
4876
+ const portal = usePortal(), portalElement = typeof portalProp == "string" ? portal.elements?.[portalProp] || null : portal.element;
4877
+ let t7, ret;
4878
+ if ($[18] !== boundaryElement || $[19] !== fallbackPlacements || $[20] !== arrowProp || $[21] !== arrowElement || $[22] !== animate) {
4879
+ ret = [];
4880
+ const t82 = boundaryElement || void 0;
4881
+ let t92;
4882
+ $[24] !== t82 || $[25] !== fallbackPlacements ? (t92 = flip({
4883
+ boundary: t82,
4824
4884
  fallbackPlacements,
4825
4885
  padding: DEFAULT_TOOLTIP_PADDING,
4826
- rootBoundary
4827
- })), ret.push(offset({
4886
+ rootBoundary: "viewport"
4887
+ }), $[24] = t82, $[25] = fallbackPlacements, $[26] = t92) : t92 = $[26], ret.push(t92);
4888
+ let t102;
4889
+ $[27] === Symbol.for("react.memo_cache_sentinel") ? (t102 = offset({
4828
4890
  mainAxis: DEFAULT_TOOLTIP_DISTANCE
4829
- })), ret.push(shift({
4830
- boundary: boundaryElement || void 0,
4831
- rootBoundary,
4832
- padding: DEFAULT_TOOLTIP_PADDING
4833
- })), arrowProp && ret.push(arrow({
4834
- element: arrowRef,
4891
+ }), $[27] = t102) : t102 = $[27], ret.push(t102);
4892
+ const t112 = boundaryElement || void 0;
4893
+ let t122;
4894
+ if ($[28] !== t112 ? (t122 = shift({
4895
+ boundary: t112,
4896
+ rootBoundary: "viewport",
4835
4897
  padding: DEFAULT_TOOLTIP_PADDING
4836
- })), animate && ret.push(origin), ret;
4837
- }, [animate, arrowProp, boundaryElement, fallbackPlacements]), {
4898
+ }), $[28] = t112, $[29] = t122) : t122 = $[29], ret.push(t122), arrowProp) {
4899
+ let t132;
4900
+ $[30] !== arrowElement ? (t132 = arrow({
4901
+ element: arrowElement,
4902
+ padding: DEFAULT_TOOLTIP_PADDING
4903
+ }), $[30] = arrowElement, $[31] = t132) : t132 = $[31], ret.push(t132);
4904
+ }
4905
+ animate && ret.push(origin), $[18] = boundaryElement, $[19] = fallbackPlacements, $[20] = arrowProp, $[21] = arrowElement, $[22] = animate, $[23] = ret;
4906
+ } else
4907
+ ret = $[23];
4908
+ t7 = ret;
4909
+ const middleware = t7;
4910
+ let t8;
4911
+ $[32] !== middleware || $[33] !== placementProp ? (t8 = {
4912
+ middleware,
4913
+ placement: placementProp,
4914
+ whileElementsMounted: autoUpdate
4915
+ }, $[32] = middleware, $[33] = placementProp, $[34] = t8) : t8 = $[34];
4916
+ const {
4838
4917
  floatingStyles,
4839
4918
  placement,
4840
4919
  middlewareData,
4841
4920
  refs,
4842
4921
  update
4843
- } = useFloating({
4844
- middleware,
4845
- placement: placementProp,
4846
- whileElementsMounted: autoUpdate
4847
- }), 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(), 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) => {
4922
+ } = useFloating(t8), 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(), 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;
4923
+ let t9;
4924
+ $[35] !== isInsideGroup || $[36] !== openDelay || $[37] !== delayGroupContext || $[38] !== tooltipId || $[39] !== closeDelay || $[40] !== setIsOpen ? (t9 = (open, immediate) => {
4848
4925
  if (isInsideGroup)
4849
4926
  if (open) {
4850
4927
  const groupedOpenDelay = immediate ? 0 : openDelay;
@@ -4855,67 +4932,133 @@ const Root$a = styled(Layer)`
4855
4932
  }
4856
4933
  else
4857
4934
  setIsOpen(open, immediate ? 0 : open ? openDelay : closeDelay);
4858
- }, [isInsideGroup, delayGroupContext, openDelay, tooltipId, closeDelay, setIsOpen]), handleBlur = useCallback((e) => {
4935
+ }, $[35] = isInsideGroup, $[36] = openDelay, $[37] = delayGroupContext, $[38] = tooltipId, $[39] = closeDelay, $[40] = setIsOpen, $[41] = t9) : t9 = $[41];
4936
+ const handleIsOpenChange = t9;
4937
+ let t10;
4938
+ $[42] !== handleIsOpenChange || $[43] !== childProp ? (t10 = (e) => {
4859
4939
  handleIsOpenChange(!1), childProp?.props?.onBlur?.(e);
4860
- }, [childProp?.props, handleIsOpenChange]), handleClick = useCallback((e_0) => {
4940
+ }, $[42] = handleIsOpenChange, $[43] = childProp, $[44] = t10) : t10 = $[44];
4941
+ const handleBlur = t10;
4942
+ let t11;
4943
+ $[45] !== handleIsOpenChange || $[46] !== childProp ? (t11 = (e_0) => {
4861
4944
  handleIsOpenChange(!1, !0), childProp?.props.onClick?.(e_0);
4862
- }, [childProp?.props, handleIsOpenChange]), handleContextMenu = useCallback((e_1) => {
4945
+ }, $[45] = handleIsOpenChange, $[46] = childProp, $[47] = t11) : t11 = $[47];
4946
+ const handleClick = t11;
4947
+ let t12;
4948
+ $[48] !== handleIsOpenChange || $[49] !== childProp ? (t12 = (e_1) => {
4863
4949
  handleIsOpenChange(!1, !0), childProp?.props.onContextMenu?.(e_1);
4864
- }, [childProp?.props, handleIsOpenChange]), handleFocus = useCallback((e_2) => {
4950
+ }, $[48] = handleIsOpenChange, $[49] = childProp, $[50] = t12) : t12 = $[50];
4951
+ const handleContextMenu = t12;
4952
+ let t13;
4953
+ $[51] !== handleIsOpenChange || $[52] !== childProp ? (t13 = (e_2) => {
4865
4954
  handleIsOpenChange(!0), childProp?.props?.onFocus?.(e_2);
4866
- }, [childProp?.props, handleIsOpenChange]), handleMouseEnter = useCallback((e_3) => {
4955
+ }, $[51] = handleIsOpenChange, $[52] = childProp, $[53] = t13) : t13 = $[53];
4956
+ const handleFocus = t13;
4957
+ let t14;
4958
+ $[54] !== handleIsOpenChange || $[55] !== childProp ? (t14 = (e_3) => {
4867
4959
  handleIsOpenChange(!0), childProp?.props?.onMouseEnter?.(e_3);
4868
- }, [childProp?.props, handleIsOpenChange]), handleMouseLeave = useCallback((e_4) => {
4960
+ }, $[54] = handleIsOpenChange, $[55] = childProp, $[56] = t14) : t14 = $[56];
4961
+ const handleMouseEnter = t14;
4962
+ let t15;
4963
+ $[57] !== handleIsOpenChange || $[58] !== childProp ? (t15 = (e_4) => {
4869
4964
  handleIsOpenChange(!1), childProp?.props?.onMouseLeave?.(e_4);
4870
- }, [childProp?.props, handleIsOpenChange]);
4871
- useCloseOnMouseLeave({
4965
+ }, $[57] = handleIsOpenChange, $[58] = childProp, $[59] = t15) : t15 = $[59];
4966
+ const handleMouseLeave = t15;
4967
+ let t16;
4968
+ $[60] !== handleIsOpenChange || $[61] !== referenceElement || $[62] !== showTooltip ? (t16 = {
4872
4969
  handleIsOpenChange,
4873
4970
  referenceElement,
4874
4971
  showTooltip
4875
- }), useEffect(() => {
4972
+ }, $[60] = handleIsOpenChange, $[61] = referenceElement, $[62] = showTooltip, $[63] = t16) : t16 = $[63], useCloseOnMouseLeave(t16);
4973
+ let t17, t18;
4974
+ $[64] !== disabled || $[65] !== showTooltip || $[66] !== handleIsOpenChange ? (t17 = () => {
4876
4975
  disabled && showTooltip && handleIsOpenChange(!1);
4877
- }, [disabled, handleIsOpenChange, showTooltip]), useEffect(() => {
4976
+ }, t18 = [disabled, handleIsOpenChange, showTooltip], $[64] = disabled, $[65] = showTooltip, $[66] = handleIsOpenChange, $[67] = t17, $[68] = t18) : (t17 = $[67], t18 = $[68]), useEffect(t17, t18);
4977
+ let t19, t20;
4978
+ $[69] !== content || $[70] !== showTooltip || $[71] !== handleIsOpenChange ? (t19 = () => {
4878
4979
  !content && showTooltip && handleIsOpenChange(!1);
4879
- }, [content, handleIsOpenChange, showTooltip]), useEffect(() => refs.setReference(referenceElement), [referenceElement, refs]), useEffect(() => {
4880
- if (!showTooltip) return;
4881
- function handleWindowKeyDown(event) {
4980
+ }, t20 = [content, handleIsOpenChange, showTooltip], $[69] = content, $[70] = showTooltip, $[71] = handleIsOpenChange, $[72] = t19, $[73] = t20) : (t19 = $[72], t20 = $[73]), useEffect(t19, t20);
4981
+ let t21, t22;
4982
+ $[74] !== refs || $[75] !== referenceElement ? (t21 = () => refs.setReference(referenceElement), t22 = [referenceElement, refs], $[74] = refs, $[75] = referenceElement, $[76] = t21, $[77] = t22) : (t21 = $[76], t22 = $[77]), useEffect(t21, t22);
4983
+ let t23, t24;
4984
+ $[78] !== showTooltip || $[79] !== handleIsOpenChange ? (t23 = () => {
4985
+ if (!showTooltip)
4986
+ return;
4987
+ const handleWindowKeyDown = function(event) {
4882
4988
  event.key === "Escape" && handleIsOpenChange(!1, !0);
4883
- }
4989
+ };
4884
4990
  return window.addEventListener("keydown", handleWindowKeyDown), () => {
4885
4991
  window.removeEventListener("keydown", handleWindowKeyDown);
4886
4992
  };
4887
- }, [handleIsOpenChange, showTooltip]), useLayoutEffect(() => {
4993
+ }, t24 = [handleIsOpenChange, showTooltip], $[78] = showTooltip, $[79] = handleIsOpenChange, $[80] = t23, $[81] = t24) : (t23 = $[80], t24 = $[81]), useEffect(t23, t24);
4994
+ let t25, t26;
4995
+ $[82] !== boundaryElement || $[83] !== portalElement ? (t25 = () => {
4888
4996
  const availableWidths = [...boundaryElement ? [boundaryElement.offsetWidth] : [], portalElement?.offsetWidth || document.body.offsetWidth];
4889
4997
  setTooltipMaxWidth(Math.min(...availableWidths) - DEFAULT_TOOLTIP_PADDING * 2);
4890
- }, [boundaryElement, portalElement]);
4891
- const setArrow = useCallback((arrowEl) => {
4892
- arrowRef.current = arrowEl, update();
4893
- }, [update]), setFloating = useCallback((node) => {
4998
+ }, t26 = [boundaryElement, portalElement], $[82] = boundaryElement, $[83] = portalElement, $[84] = t25, $[85] = t26) : (t25 = $[84], t26 = $[85]), useLayoutEffect(t25, t26);
4999
+ let t27;
5000
+ $[86] !== update ? (t27 = (arrowEl) => {
5001
+ setArrowElement(arrowEl), update();
5002
+ }, $[86] = update, $[87] = t27) : t27 = $[87];
5003
+ const setArrow = t27;
5004
+ let t28;
5005
+ $[88] !== refs ? (t28 = (node) => {
4894
5006
  ref.current = node, refs.setFloating(node);
4895
- }, [refs]), childRef = useRef(null);
4896
- useImperativeHandle(childProp?.ref, () => childRef.current);
4897
- const child = useMemo(() => childProp ? cloneElement(childProp, {
4898
- onBlur: handleBlur,
4899
- onFocus: handleFocus,
4900
- onMouseEnter: handleMouseEnter,
4901
- onMouseLeave: handleMouseLeave,
4902
- onClick: handleClick,
4903
- onContextMenu: handleContextMenu,
4904
- ref: childRef
4905
- }) : null, [childProp, handleBlur, handleClick, handleContextMenu, handleFocus, handleMouseEnter, handleMouseLeave]);
4906
- if (useEffect(() => {
5007
+ }, $[88] = refs, $[89] = t28) : t28 = $[89];
5008
+ const setFloating = t28, childRef = useRef(null), [childElement, setChildElement] = useState(null), t29 = childProp;
5009
+ let t30;
5010
+ $[90] !== t29 ? (t30 = getElementRef(t29), $[90] = t29, $[91] = t30) : t30 = $[91];
5011
+ let t31, t32;
5012
+ $[92] !== childElement ? (t31 = () => childElement, t32 = [childElement], $[92] = childElement, $[93] = t31, $[94] = t32) : (t31 = $[93], t32 = $[94]), useImperativeHandle(t30, t31, t32);
5013
+ let t33;
5014
+ bb0: {
5015
+ if (!childProp) {
5016
+ t33 = null;
5017
+ break bb0;
5018
+ }
5019
+ let t342;
5020
+ $[95] !== handleBlur || $[96] !== handleFocus || $[97] !== handleMouseEnter || $[98] !== handleMouseLeave || $[99] !== handleClick || $[100] !== handleContextMenu || $[101] !== childProp ? (t342 = cloneElement(childProp, {
5021
+ onBlur: handleBlur,
5022
+ onFocus: handleFocus,
5023
+ onMouseEnter: handleMouseEnter,
5024
+ onMouseLeave: handleMouseLeave,
5025
+ onClick: handleClick,
5026
+ onContextMenu: handleContextMenu,
5027
+ ref: setChildElement
5028
+ }), $[95] = handleBlur, $[96] = handleFocus, $[97] = handleMouseEnter, $[98] = handleMouseLeave, $[99] = handleClick, $[100] = handleContextMenu, $[101] = childProp, $[102] = t342) : t342 = $[102], t33 = t342;
5029
+ }
5030
+ const child = t33;
5031
+ let t34, t35;
5032
+ if ($[103] !== child ? (t34 = () => {
4907
5033
  if (child)
4908
5034
  return setReferenceElement(childRef.current), () => setReferenceElement(null);
4909
- }, [child]), !child) return /* @__PURE__ */ jsx(Fragment, {});
4910
- if (disabled) return child;
4911
- const tooltip = /* @__PURE__ */ jsx(Root$a, { "data-ui": "Tooltip", ...restProps, ref: setFloating, style: {
5035
+ }, t35 = [child], $[103] = child, $[104] = t34, $[105] = t35) : (t34 = $[104], t35 = $[105]), useEffect(t34, t35), !child) {
5036
+ let t362;
5037
+ return $[106] === Symbol.for("react.memo_cache_sentinel") ? (t362 = /* @__PURE__ */ jsx(Fragment, {}), $[106] = t362) : t362 = $[106], t362;
5038
+ }
5039
+ if (disabled)
5040
+ return child;
5041
+ const t36 = tooltipMaxWidth > 0 ? `${tooltipMaxWidth}px` : void 0;
5042
+ let t37;
5043
+ $[107] !== floatingStyles || $[108] !== t36 ? (t37 = {
4912
5044
  ...floatingStyles,
4913
- maxWidth: tooltipMaxWidth > 0 ? `${tooltipMaxWidth}px` : void 0
4914
- }, 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);
4915
- return /* @__PURE__ */ jsxs(Fragment, { children: [
4916
- animate ? /* @__PURE__ */ jsx(AnimatePresence, { children }) : children,
5045
+ maxWidth: t36
5046
+ }, $[107] = floatingStyles, $[108] = t36, $[109] = t37) : t37 = $[109];
5047
+ let t38;
5048
+ $[110] !== restProps || $[111] !== animate || $[112] !== arrowProp || $[113] !== setArrow || $[114] !== arrowX || $[115] !== arrowY || $[116] !== originX || $[117] !== originY || $[118] !== padding || $[119] !== placement || $[120] !== radius || $[121] !== setFloating || $[122] !== scheme || $[123] !== shadow || $[124] !== content ? (t38 = /* @__PURE__ */ jsx(TooltipCard, { ...restProps, animate, arrow: arrowProp, arrowRef: setArrow, arrowX, arrowY, originX, originY, padding, placement, radius, ref: setFloating, scheme, shadow, children: content }), $[110] = restProps, $[111] = animate, $[112] = arrowProp, $[113] = setArrow, $[114] = arrowX, $[115] = arrowY, $[116] = originX, $[117] = originY, $[118] = padding, $[119] = placement, $[120] = radius, $[121] = setFloating, $[122] = scheme, $[123] = shadow, $[124] = content, $[125] = t38) : t38 = $[125];
5049
+ let t39;
5050
+ $[126] !== restProps || $[127] !== setFloating || $[128] !== t37 || $[129] !== zOffset || $[130] !== t38 ? (t39 = /* @__PURE__ */ jsx(Root$a, { "data-ui": "Tooltip", ...restProps, ref: setFloating, style: t37, zOffset, children: t38 }), $[126] = restProps, $[127] = setFloating, $[128] = t37, $[129] = zOffset, $[130] = t38, $[131] = t39) : t39 = $[131];
5051
+ const tooltip = t39;
5052
+ let t40;
5053
+ $[132] !== showTooltip || $[133] !== portalProp || $[134] !== tooltip ? (t40 = showTooltip && (portalProp ? /* @__PURE__ */ jsx(Portal, { __unstable_name: typeof portalProp == "string" ? portalProp : void 0, children: tooltip }) : tooltip), $[132] = showTooltip, $[133] = portalProp, $[134] = tooltip, $[135] = t40) : t40 = $[135];
5054
+ const children = t40;
5055
+ let t41;
5056
+ $[136] !== animate || $[137] !== children ? (t41 = animate ? /* @__PURE__ */ jsx(AnimatePresence, { children }) : children, $[136] = animate, $[137] = children, $[138] = t41) : t41 = $[138];
5057
+ let t42;
5058
+ return $[139] !== t41 || $[140] !== child ? (t42 = /* @__PURE__ */ jsxs(Fragment, { children: [
5059
+ t41,
4917
5060
  child
4918
- ] });
5061
+ ] }), $[139] = t41, $[140] = child, $[141] = t42) : t42 = $[141], t42;
4919
5062
  });
4920
5063
  Tooltip.displayName = "ForwardRef(Tooltip)";
4921
5064
  function useCloseOnMouseLeave(t0) {
@@ -4939,6 +5082,11 @@ function useCloseOnMouseLeave(t0) {
4939
5082
  return window.addEventListener("mousemove", handleMouseMove), () => window.removeEventListener("mousemove", handleMouseMove);
4940
5083
  }, t3 = [onMouseMove, showTooltip], $[3] = showTooltip, $[4] = onMouseMove, $[5] = t2, $[6] = t3) : (t2 = $[5], t3 = $[6]), useEffect(t2, t3);
4941
5084
  }
5085
+ function getElementRef(element) {
5086
+ if (!element) return null;
5087
+ let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get, mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
5088
+ return mayWarn ? element.ref : (getter = Object.getOwnPropertyDescriptor(element, "ref")?.get, mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning, mayWarn ? element.props.ref : element.props.ref || element.ref);
5089
+ }
4942
5090
  const Root$9 = styled.div`
4943
5091
  line-height: 0;
4944
5092
  `, ListBox = styled(Box)`