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

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
@@ -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,28 +3961,57 @@ 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(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
4017
  function getElementRef(element) {