@sanity/ui 4.4.1 → 4.4.2

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"popover-CEDyHcBi.js","names":["size","getTransformOrigin(originX, originY)","{\n left: x,\n position: strategy,\n top: y,\n transformOrigin: getTransformOrigin(originX, originY),\n zIndex,\n willChange: animate ? 'transform' : undefined,\n ...style,\n // The `size` middleware writes these to the element while it owns them (React leaves a style\n // it keeps rendering as `undefined` alone), and `''` clears its write once React owns them\n maxHeight: constrainSize ? undefined : (style?.maxHeight ?? ''),\n maxWidth: constrainSize ? undefined : (maxWidth ?? style?.maxWidth ?? ''),\n width: matchReferenceWidth ? undefined : (width ?? style?.width ?? ''),\n }","animate ? 'transform' : undefined","constrainSize ? undefined : (style?.maxHeight ?? '')","constrainSize ? undefined : (maxWidth ?? style?.maxWidth ?? '')","matchReferenceWidth ? undefined : (width ?? style?.width ?? '')","useMemo(\n () => ({\n left: x,\n position: strategy,\n top: y,\n transformOrigin: getTransformOrigin(originX, originY),\n zIndex,\n willChange: animate ? 'transform' : undefined,\n ...style,\n // The `size` middleware writes these to the element while it owns them (React leaves a style\n // it keeps rendering as `undefined` alone), and `''` clears its write once React owns them\n maxHeight: constrainSize ? undefined : (style?.maxHeight ?? ''),\n maxWidth: constrainSize ? undefined : (maxWidth ?? style?.maxWidth ?? ''),\n width: matchReferenceWidth ? undefined : (width ?? style?.width ?? ''),\n }),\n [\n animate,\n constrainSize,\n matchReferenceWidth,\n maxWidth,\n originX,\n originY,\n strategy,\n style,\n width,\n x,\n y,\n zIndex,\n ],\n )","{\n left: arrowX !== null ? arrowX : undefined,\n top: arrowY !== null ? arrowY : undefined,\n right: undefined,\n bottom: undefined,\n }","arrowX !== null ? arrowX : undefined","arrowY !== null ? arrowY : undefined","useMemo(\n () => ({\n left: arrowX !== null ? arrowX : undefined,\n top: arrowY !== null ? arrowY : undefined,\n right: undefined,\n bottom: undefined,\n }),\n [arrowX, arrowY],\n )","<Flex direction=\"column\" flex={1} padding={padding}>\n {children}\n </Flex>","<Flex data-ui=\"Popover__wrapper\" direction=\"column\" flex={1} overflow={overflow}>\n <Flex direction=\"column\" flex={1} padding={padding}>\n {children}\n </Flex>\n </Flex>","arrow && (\n <Arrow\n ref={arrowRef}\n style={arrowStyle}\n width={DEFAULT_POPOVER_ARROW_WIDTH}\n height={DEFAULT_POPOVER_ARROW_HEIGHT}\n radius={DEFAULT_POPOVER_ARROW_RADIUS}\n />\n )","<MotionCard\n data-ui=\"Popover\"\n {...restProps}\n data-placement={placement}\n radius={radius}\n ref={ref}\n scheme={scheme}\n shadow={shadow}\n sizing=\"border\"\n style={rootStyle}\n tone={tone}\n {...(animate ? POPOVER_MOTION_PROPS : undefined)}\n >\n <Flex data-ui=\"Popover__wrapper\" direction=\"column\" flex={1} overflow={overflow}>\n <Flex direction=\"column\" flex={1} padding={padding}>\n {children}\n </Flex>\n </Flex>\n\n {arrow && (\n <Arrow\n ref={arrowRef}\n style={arrowStyle}\n width={DEFAULT_POPOVER_ARROW_WIDTH}\n height={DEFAULT_POPOVER_ARROW_HEIGHT}\n radius={DEFAULT_POPOVER_ARROW_RADIUS}\n />\n )}\n </MotionCard>","animate ? POPOVER_MOTION_PROPS : undefined","_c","() => {\n if (shouldRender) stopListening(stopRef)\n }","[shouldRender]","(node: HTMLElement) => {\n if (!shouldRenderRef.current) stopRef.current = listenForIntent(node, handleIntent)\n\n return () => stopListening(stopRef)\n }","shouldRenderRef.current","useCallback(\n (node: HTMLElement) => {\n if (!shouldRenderRef.current) stopRef.current = listenForIntent(node, handleIntent)\n\n return () => stopListening(stopRef)\n },\n [handleIntent, shouldRenderRef],\n )","<div\n data-ui=\"PopoverOverlay\"\n style={{height: '100vh', inset: 0, position: 'fixed', width: '100vw', zIndex}}\n />","margins = DEFAULT_POPOVER_MARGINS","_animate = false","tone = 'inherit'","widthProp = 'auto'","arrowProp = false","constrainSize = false","overflow = 'hidden'","placementProp = 'bottom'","placementStrategy = 'flip'","preventOverflow = true","radiusProp = 3","shadowProp = 3","childProp","_fallbackPlacements","_floatingBoundary","paddingProp","forwardedRef","_referenceBoundary","_zOffsetProp","...restProps","_getArrayProp(paddingProp)","_getArrayProp(radiusProp)","_getArrayProp(shadowProp)","_getArrayProp(zOffsetProp)","() => ref.current","{\n animate,\n arrowProp,\n arrowRef,\n constrainSize,\n fallbackPlacements,\n floatingBoundary,\n margins,\n matchReferenceWidth,\n maxWidth,\n placementProp,\n placementStrategy,\n preventOverflow,\n referenceBoundary,\n rootBoundary,\n }","referenceElement\n ? {\n reference: referenceElement,\n }\n : undefined","{\n middleware,\n placement: placementProp,\n whileElementsMounted: autoUpdate,\n elements: referenceElement\n ? {\n reference: referenceElement,\n }\n : undefined,\n }","() => startTransition(() => setHasRendered(true))","useCallback(() => startTransition(() => setHasRendered(true)), [])","() => {\n if (!intentReference) return undefined\n\n return listenForIntent(intentReference, handleIntent)\n }","[handleIntent, intentReference]","(arrowEl: HTMLDivElement | null) => {\n arrowRef.current = arrowEl\n }","useCallback((arrowEl: HTMLDivElement | null) => {\n arrowRef.current = arrowEl\n }, [])","childProp && !referenceElement ? getElementRef<HTMLElement>(childProp) : undefined","(node: HTMLDivElement | null) => {\n ref.current = node\n if (node) handOverReference()\n refs.setFloating(node)\n }","useCallback(\n (node: HTMLDivElement | null) => {\n ref.current = node\n if (node) handOverReference()\n refs.setFloating(node)\n },\n [handOverReference, refs],\n )","useMemo(() => {\n // If a reference element is defined, we don't need to clone the child\n if (referenceElement) return childProp\n\n if (!childProp) return null\n\n return cloneElement(childProp, {ref: setReference})\n }, [childProp, referenceElement, setReference])","cloneElement(childProp, {ref: setReference})","() => update","[update]","childProp || <></>","modal && <ViewportOverlay />","<PopoverCard\n {...restProps}\n __unstable_margins={margins}\n animate={animate}\n arrow={arrowProp}\n arrowRef={setArrow}\n arrowX={arrowX}\n arrowY={arrowY}\n constrainSize={constrainSize}\n hidden={referenceHidden}\n matchReferenceWidth={matchReferenceWidth}\n maxWidth={maxWidth}\n overflow={overflow}\n padding={padding}\n placement={placement}\n radius={radius}\n ref={setFloating}\n scheme={scheme}\n shadow={shadow}\n originX={originX}\n originY={originY}\n strategy={strategy}\n tone={tone}\n width={width}\n x={x}\n y={y}\n >\n {content}\n </PopoverCard>","<LayerProvider zOffset={zOffset}>\n {/* Optional transparent blocking overlay at the top-most z-index layer. Must be positioned before the below popover card. */}\n {modal && <ViewportOverlay />}\n\n <PopoverCard\n {...restProps}\n __unstable_margins={margins}\n animate={animate}\n arrow={arrowProp}\n arrowRef={setArrow}\n arrowX={arrowX}\n arrowY={arrowY}\n constrainSize={constrainSize}\n hidden={referenceHidden}\n matchReferenceWidth={matchReferenceWidth}\n maxWidth={maxWidth}\n overflow={overflow}\n padding={padding}\n placement={placement}\n radius={radius}\n ref={setFloating}\n scheme={scheme}\n shadow={shadow}\n originX={originX}\n originY={originY}\n strategy={strategy}\n tone={tone}\n width={width}\n x={x}\n y={y}\n >\n {content}\n </PopoverCard>\n </LayerProvider>","portal ? (\n <Portal __unstable_name={typeof portal === 'string' ? portal : undefined}>{popover}</Portal>\n ) : (\n popover\n )","animate ? (\n <AnimateActivity layoutMode=\"default\" mode={open ? 'visible' : 'hidden'}>\n {shouldRender ? popoverNode : null}\n </AnimateActivity>\n ) : (\n <Activity mode={open ? 'visible' : 'hidden'}>{shouldRender ? popoverNode : null}</Activity>\n )","<>\n {/* the popover (not rendered until it opens or is about to, see `hasRendered`) */}\n {animate ? (\n <AnimateActivity layoutMode=\"default\" mode={open ? 'visible' : 'hidden'}>\n {shouldRender ? popoverNode : null}\n </AnimateActivity>\n ) : (\n <Activity mode={open ? 'visible' : 'hidden'}>{shouldRender ? popoverNode : null}</Activity>\n )}\n\n {/* the referred element */}\n {child}\n </>","() => {\n if (!open || !element) return undefined\n\n // Measuring the boundary is what this effect is for: the DOM is only measurable after the\n // commit, and the result has to be in the next paint\n // oxlint-disable-next-line react/set-state-in-effect\n setSize((prev) => sameSize(prev, measureBorderBox(element)))\n\n return _elementSizeObserver.subscribe(element, ({border}) =>\n setSize((prev) =>\n sameSize(prev, {width: Math.round(border.width), height: Math.round(border.height)}),\n ),\n )\n }","[element, open]","{border}","prev","{\n animate,\n arrowProp,\n arrowRef,\n constrainSize,\n fallbackPlacements,\n floatingBoundary,\n margins,\n matchReferenceWidth,\n maxWidth,\n placementProp,\n placementStrategy,\n preventOverflow,\n referenceBoundary,\n rootBoundary,\n}: {\n animate: boolean\n arrowProp: boolean\n arrowRef: React.RefObject<HTMLDivElement | null>\n constrainSize: boolean\n fallbackPlacements: Placement[]\n floatingBoundary: HTMLElement | null\n margins: PopoverMargins\n matchReferenceWidth: boolean | undefined\n maxWidth: number | undefined\n placementProp: Placement\n placementStrategy: 'flip' | 'autoPlacement'\n preventOverflow: boolean\n referenceBoundary: HTMLElement | null\n rootBoundary: RootBoundary\n}","autoPlacement({\n allowedPlacements: [placementProp].concat(fallbackPlacements),\n })","flip({\n boundary: floatingBoundary || undefined,\n fallbackPlacements,\n padding: DEFAULT_POPOVER_PADDING,\n rootBoundary,\n })","floatingBoundary || undefined","offset({mainAxis: DEFAULT_POPOVER_DISTANCE})","size({\n boundaryElement: floatingBoundary || undefined,\n constrainSize,\n margins,\n matchReferenceWidth,\n // The card renders the cap unless `constrainSize`: no reason to change the middleware then\n maxWidth: constrainSize ? maxWidth : undefined,\n padding: DEFAULT_POPOVER_PADDING,\n })","constrainSize ? maxWidth : undefined","shift({\n boundary: floatingBoundary || undefined,\n rootBoundary,\n padding: DEFAULT_POPOVER_PADDING,\n })","arrow({\n element: arrowRef,\n padding: DEFAULT_POPOVER_PADDING,\n })","hide({\n boundary: referenceBoundary || undefined,\n padding: DEFAULT_POPOVER_PADDING,\n strategy: 'referenceHidden',\n })","referenceBoundary || undefined","useMemo(() => {\n const ret: Middleware[] = []\n\n // Flip the floating element when leaving the boundary box\n if (constrainSize || preventOverflow) {\n if (placementStrategy === 'autoPlacement') {\n ret.push(\n autoPlacement({\n allowedPlacements: [placementProp].concat(fallbackPlacements),\n }),\n )\n } else {\n ret.push(\n flip({\n boundary: floatingBoundary || undefined,\n fallbackPlacements,\n padding: DEFAULT_POPOVER_PADDING,\n rootBoundary,\n }),\n )\n }\n }\n\n // Define distance between reference and floating element\n ret.push(offset({mainAxis: DEFAULT_POPOVER_DISTANCE}))\n\n // Track sizes\n if (constrainSize || matchReferenceWidth) {\n ret.push(\n size({\n boundaryElement: floatingBoundary || undefined,\n constrainSize,\n margins,\n matchReferenceWidth,\n // The card renders the cap unless `constrainSize`: no reason to change the middleware then\n maxWidth: constrainSize ? maxWidth : undefined,\n padding: DEFAULT_POPOVER_PADDING,\n }),\n )\n }\n\n // Shift the popover so its sits within the boundary element\n if (preventOverflow) {\n ret.push(\n shift({\n boundary: floatingBoundary || undefined,\n rootBoundary,\n padding: DEFAULT_POPOVER_PADDING,\n }),\n )\n }\n\n // Place arrow\n if (arrowProp) {\n ret.push(\n arrow({\n element: arrowRef,\n padding: DEFAULT_POPOVER_PADDING,\n }),\n )\n }\n\n // Determine the origin to scale from.\n // Must be placed after `@sanity/ui/size` and `shift` middleware.\n if (animate) {\n ret.push(origin)\n }\n\n ret.push(\n hide({\n boundary: referenceBoundary || undefined,\n padding: DEFAULT_POPOVER_PADDING,\n strategy: 'referenceHidden',\n }),\n )\n\n return ret\n }, [\n animate,\n arrowProp,\n arrowRef,\n constrainSize,\n fallbackPlacements,\n floatingBoundary,\n margins,\n matchReferenceWidth,\n maxWidth,\n placementProp,\n placementStrategy,\n preventOverflow,\n referenceBoundary,\n rootBoundary,\n ])","_c","childRef","_Fragment","size","\"top\"","\"bottom\"","\"left\"","\"right\""],"sources":["../src/core/primitives/popover/constants.ts","../src/core/primitives/popover/floating-ui/size.ts","../src/core/primitives/popover/helpers.ts","../src/core/primitives/popover/popoverCard.tsx","../src/core/primitives/popover/popover.tsx"],"sourcesContent":["import {Placement} from '../../types/placement'\nimport {PopoverMargins} from '../../types/popover'\n\nexport const DEFAULT_POPOVER_DISTANCE = 4\nexport const DEFAULT_POPOVER_PADDING = 4\nexport const DEFAULT_POPOVER_ARROW_WIDTH = 19\nexport const DEFAULT_POPOVER_ARROW_HEIGHT = 8\nexport const DEFAULT_POPOVER_ARROW_RADIUS = 2\nexport const DEFAULT_POPOVER_MARGINS: PopoverMargins = [0, 0, 0, 0]\nexport const DEFAULT_FALLBACK_PLACEMENTS: Record<Placement, Placement[]> = {\n 'top': ['bottom', 'left', 'right'],\n 'top-start': ['bottom-start', 'left-start', 'right-start'],\n 'top-end': ['bottom-end', 'left-end', 'right-end'],\n 'bottom': ['top', 'left', 'right'],\n 'bottom-start': ['top-start', 'left-start', 'right-start'],\n 'bottom-end': ['top-end', 'left-end', 'right-end'],\n 'left': ['right', 'top', 'bottom'],\n 'left-start': ['right-start', 'top-start', 'bottom-start'],\n 'left-end': ['right-end', 'top-end', 'bottom-end'],\n 'right': ['left', 'top', 'bottom'],\n 'right-start': ['left-start', 'top-start', 'bottom-start'],\n 'right-end': ['left-end', 'top-end', 'bottom-end'],\n}\n","import {detectOverflow, Middleware} from '@floating-ui/react-dom'\n\nimport {PopoverMargins} from '../../../types/popover'\n\nexport function size(options: {\n boundaryElement?: HTMLElement | null\n constrainSize: boolean\n margins: PopoverMargins\n matchReferenceWidth?: boolean\n maxWidth: number | undefined\n padding?: number\n}): Middleware {\n const {constrainSize, margins, matchReferenceWidth, padding = 0} = options\n\n return {\n name: '@sanity/ui/size',\n // `useFloating` compares middleware deeply and functions by their source text, so without its\n // `options` it would keep running this middleware with outdated ones\n options,\n async fn(args) {\n const {elements, placement, platform, rects} = args\n const {floating, reference} = rects\n\n const overflow = await detectOverflow(args, {\n altBoundary: true,\n boundary: options.boundaryElement || undefined,\n elementContext: 'floating',\n padding,\n rootBoundary: 'viewport',\n })\n\n let maxWidth = Infinity\n let maxHeight = Infinity\n\n const floatingW = floating.width\n const floatingH = floating.height\n\n if (placement.includes('top')) {\n maxWidth = floatingW - (overflow.left + overflow.right)\n maxHeight = floatingH - overflow.top\n }\n\n if (placement.includes('right')) {\n maxWidth = floatingW - overflow.right\n maxHeight = floatingH - (overflow.top + overflow.bottom)\n }\n\n if (placement.includes('bottom')) {\n maxWidth = floatingW - (overflow.left + overflow.right)\n maxHeight = floatingH - overflow.bottom\n }\n\n if (placement.includes('left')) {\n maxWidth = floatingW - overflow.left\n maxHeight = floatingH - (overflow.top + overflow.bottom)\n }\n\n // IMPORTANT – APPLY ELEMENT STYLES HERE\n // Elements need to be resized BEFORE the `platform.getDimensions` call below, and never to a\n // negative size: CSS ignores a negative length, keeping the previous one\n const availableWidth = Math.max(0, maxWidth - margins[1] - margins[3])\n const availableHeight = Math.max(0, maxHeight - margins[0] - margins[2])\n const referenceWidth = Math.max(0, reference.width - margins[1] - margins[3])\n\n if (matchReferenceWidth) {\n elements.floating.style.width = `${referenceWidth}px`\n }\n\n if (constrainSize) {\n elements.floating.style.maxWidth = `${Math.min(availableWidth, options.maxWidth ?? Infinity)}px`\n\n elements.floating.style.maxHeight = `${availableHeight}px`\n }\n\n const nextDimensions = await platform.getDimensions(elements.floating)\n\n const targetH = nextDimensions.height\n const targetW = nextDimensions.width\n\n if (floatingW !== targetW || floatingH !== targetH) {\n return {reset: {rects: true}}\n }\n\n return {}\n },\n }\n}\n","import {DEFAULT_POPOVER_PADDING} from './constants'\nimport {PopoverWidth} from './types'\n\nexport function calcCurrentWidth(params: {\n mediaIndex: number\n container: number[]\n width: PopoverWidth[]\n}): number | undefined {\n const {container, mediaIndex, width} = params\n\n const w = width[mediaIndex]\n const currentWidth: PopoverWidth | undefined = w === undefined ? width[width.length - 1] : w\n\n return typeof currentWidth === 'number' ? container[currentWidth] : undefined\n}\n\nexport function calcMaxWidth(params: {\n boundaryWidth: number | undefined\n currentWidth: number | undefined\n}): number | undefined {\n const {boundaryWidth, currentWidth} = params\n\n const maxWidth = Math.min(\n currentWidth ?? Infinity,\n (boundaryWidth || Infinity) - DEFAULT_POPOVER_PADDING * 2,\n )\n\n // Also uncapped for a boundary of width `0` (collapsed, or `display: none`), and never negative\n // for one narrower than the padding: CSS ignores a negative length, keeping the previous cap\n return Number.isFinite(maxWidth) ? Math.max(0, maxWidth) : undefined\n}\n","import {Strategy} from '@floating-ui/react-dom'\nimport {motion} from 'motion/react'\nimport React, {CSSProperties, useMemo} from 'react'\nimport {styled} from 'styled-components'\n\nimport {ThemeColorSchemeKey} from '../../../theme/system/color/_system'\nimport {POPOVER_MOTION_PROPS} from '../../constants'\nimport {getTransformOrigin} from '../../middleware/origin'\nimport {BoxOverflow} from '../../types/box'\nimport {CardTone} from '../../types/card'\nimport {Placement} from '../../types/placement'\nimport {PopoverMargins} from '../../types/popover'\nimport {Radius} from '../../types/radius'\nimport {Arrow} from '../../utils/arrow/arrow'\nimport {useLayer} from '../../utils/layer/useLayer'\nimport {Card} from '../card/card'\nimport {Flex} from '../flex/flex'\nimport {\n DEFAULT_POPOVER_ARROW_HEIGHT,\n DEFAULT_POPOVER_ARROW_RADIUS,\n DEFAULT_POPOVER_ARROW_WIDTH,\n DEFAULT_POPOVER_MARGINS,\n} from './constants'\n\nconst MotionCard = styled(motion.create(Card))`\n &:not([hidden]) {\n display: flex;\n }\n flex-direction: column;\n width: max-content;\n min-width: min-content;\n will-change: transform;\n`\n\n/**\n * @internal\n */\nexport function PopoverCard(\n props: {\n /** @beta*/\n __unstable_margins?: PopoverMargins\n animate?: boolean\n arrow: boolean\n arrowRef: React.Ref<HTMLDivElement>\n arrowX?: number\n arrowY?: number\n constrainSize?: boolean\n matchReferenceWidth?: boolean\n maxWidth: number | undefined\n originX?: number\n originY?: number\n overflow?: BoxOverflow\n padding?: number | number[]\n placement: Placement\n radius?: Radius | Radius[]\n scheme?: ThemeColorSchemeKey\n shadow?: number | number[]\n strategy: Strategy\n tone: CardTone\n width: number | undefined\n x: number | null\n y: number | null\n } & Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'height' | 'width'>,\n) {\n const {\n __unstable_margins: marginsProp,\n animate,\n arrow,\n arrowRef,\n arrowX,\n arrowY,\n children,\n constrainSize,\n matchReferenceWidth,\n maxWidth,\n padding,\n placement,\n originX,\n originY,\n overflow,\n radius,\n ref,\n scheme,\n shadow,\n strategy,\n style,\n tone,\n width,\n x: xProp,\n y: yProp,\n ...restProps\n } = props\n\n const {zIndex} = useLayer()\n\n // Get margins: [top, right, bottom, left]\n const margins: PopoverMargins = useMemo(\n () => marginsProp || DEFAULT_POPOVER_MARGINS,\n [marginsProp],\n )\n\n // Translate according to margins\n const x = (xProp ?? 0) + margins[3]\n const y = (yProp ?? 0) + margins[0]\n\n const rootStyle: CSSProperties = useMemo(\n () => ({\n left: x,\n position: strategy,\n top: y,\n transformOrigin: getTransformOrigin(originX, originY),\n zIndex,\n willChange: animate ? 'transform' : undefined,\n ...style,\n // The `size` middleware writes these to the element while it owns them (React leaves a style\n // it keeps rendering as `undefined` alone), and `''` clears its write once React owns them\n maxHeight: constrainSize ? undefined : (style?.maxHeight ?? ''),\n maxWidth: constrainSize ? undefined : (maxWidth ?? style?.maxWidth ?? ''),\n width: matchReferenceWidth ? undefined : (width ?? style?.width ?? ''),\n }),\n [\n animate,\n constrainSize,\n matchReferenceWidth,\n maxWidth,\n originX,\n originY,\n strategy,\n style,\n width,\n x,\n y,\n zIndex,\n ],\n )\n\n const arrowStyle: CSSProperties = useMemo(\n () => ({\n left: arrowX !== null ? arrowX : undefined,\n top: arrowY !== null ? arrowY : undefined,\n right: undefined,\n bottom: undefined,\n }),\n [arrowX, arrowY],\n )\n\n return (\n <MotionCard\n data-ui=\"Popover\"\n {...restProps}\n data-placement={placement}\n radius={radius}\n ref={ref}\n scheme={scheme}\n shadow={shadow}\n sizing=\"border\"\n style={rootStyle}\n tone={tone}\n {...(animate ? POPOVER_MOTION_PROPS : undefined)}\n >\n <Flex data-ui=\"Popover__wrapper\" direction=\"column\" flex={1} overflow={overflow}>\n <Flex direction=\"column\" flex={1} padding={padding}>\n {children}\n </Flex>\n </Flex>\n\n {arrow && (\n <Arrow\n ref={arrowRef}\n style={arrowStyle}\n width={DEFAULT_POPOVER_ARROW_WIDTH}\n height={DEFAULT_POPOVER_ARROW_HEIGHT}\n radius={DEFAULT_POPOVER_ARROW_RADIUS}\n />\n )}\n </MotionCard>\n )\n}\n","import {\n arrow,\n autoPlacement,\n autoUpdate,\n flip,\n hide,\n Middleware,\n offset,\n RootBoundary,\n shift,\n useFloating,\n} from '@floating-ui/react-dom'\nimport {\n Activity,\n cloneElement,\n type Ref,\n startTransition,\n useCallback,\n useEffect,\n useImperativeHandle,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from 'react'\n\nimport {ThemeColorSchemeKey} from '../../../theme/system/color/_system'\nimport {useLatestRef} from '../../hooks/useLatestRef'\nimport {useMediaIndex} from '../../hooks/useMediaIndex/useMediaIndex'\nimport {usePrefersReducedMotion} from '../../hooks/usePrefersReducedMotion'\nimport {useReferenceElement} from '../../hooks/useReferenceElement'\nimport {origin} from '../../middleware/origin'\nimport {_elementSizeObserver, ElementRectValue} from '../../observers/elementSizeObserver'\nimport {_getArrayProp} from '../../styles/helpers'\nimport {useTheme_v2} from '../../theme/useTheme'\nimport {BoxOverflow} from '../../types/box'\nimport {CardTone} from '../../types/card'\nimport {Placement} from '../../types/placement'\nimport {PopoverMargins} from '../../types/popover'\nimport {AnimateActivity} from '../../utils/animateActivity'\nimport {useBoundaryElement} from '../../utils/boundaryElement/useBoundaryElement'\nimport {getElementRef} from '../../utils/getElementRef'\nimport {LayerProps} from '../../utils/layer/layer'\nimport {LayerProvider} from '../../utils/layer/layerProvider'\nimport {useLayer} from '../../utils/layer/useLayer'\nimport {Portal} from '../../utils/portal/portal'\nimport {ResponsiveRadiusProps, ResponsiveShadowProps} from '../types'\nimport {\n DEFAULT_FALLBACK_PLACEMENTS,\n DEFAULT_POPOVER_DISTANCE,\n DEFAULT_POPOVER_MARGINS,\n DEFAULT_POPOVER_PADDING,\n} from './constants'\nimport {size} from './floating-ui/size'\nimport {calcCurrentWidth, calcMaxWidth} from './helpers'\nimport {PopoverCard} from './popoverCard'\nimport {PopoverUpdateCallback, PopoverWidth} from './types'\n\n/** @public */\nexport interface PopoverProps\n extends Omit<LayerProps, 'as'>, ResponsiveRadiusProps, ResponsiveShadowProps {\n /** @beta */\n __unstable_margins?: PopoverMargins\n /**\n * Whether the popover should animate in and out.\n *\n * @beta\n * @defaultValue false\n */\n animate?: boolean\n arrow?: boolean\n /** @deprecated Use `floatingBoundary` and/or `referenceBoundary` instead */\n boundaryElement?: never\n children?: React.JSX.Element\n /**\n * When `true`, prevent overflow within the current boundary:\n * - by flipping on its side axis\n * - by resizing\n /*\n * Note that:\n * - setting `preventOverflow` to `true` also prevents overflow on its side axis\n * - setting `matchReferenceWidth` to `true` also causes the popover to resize\n *\n * @defaultValue false\n */\n constrainSize?: boolean\n content?: React.ReactNode\n disabled?: boolean\n fallbackPlacements?: Placement[]\n floatingBoundary?: HTMLElement | null\n /**\n * When `true`, set the maximum width to match the reference element, and also prevent overflow within\n * the current boundary by resizing.\n *\n * Note that setting `constrainSize` to `true` also causes the popover to resize\n *\n * @defaultValue false\n */\n matchReferenceWidth?: boolean\n /**\n * When true, blocks all pointer interaction with elements beneath the popover until closed.\n *\n * @beta\n * @defaultValue false\n */\n modal?: boolean\n /**\n * Whether the popover is open.\n *\n * Set it inside `startTransition`. A closed popover pre-renders its content hidden, in a\n * transition, once the reference element shows intent to open it (focus, a pointer entering or\n * pressing it). Opening in a transition too lets React keep rendering that content in the\n * background when the open comes before it is done, instead of rendering it synchronously in the\n * click. Content that was pre-rendered already shows in the first frame after the click either\n * way.\n *\n * ```tsx\n * const [open, setOpen] = useState(false)\n *\n * <Popover content={content} open={open}>\n * <Button onClick={() => startTransition(() => setOpen((isOpen) => !isOpen))} text=\"Toggle\" />\n * </Popover>\n * ```\n *\n * Wrap the state update itself: a `startTransition` around code that schedules the update for\n * later (a timeout) does not reach it.\n */\n open?: boolean\n overflow?: BoxOverflow\n padding?: number | number[]\n placement?: Placement\n /**\n * When 'flip' (default), the placement is determined from the initial placement and the\n * fallback placements in order. Whichever fits in the viewport first.\n *\n * When 'autoPlacement', the initial placement and all fallback placements are evaluated\n * and the placement with the most viewport space available.\n *\n * Option is only relevant if either `constrainSize` or `preventOverflow` is `true`\n */\n placementStrategy?: 'flip' | 'autoPlacement'\n /** Whether or not to render the popover in a portal element. */\n portal?: boolean | string\n preventOverflow?: boolean\n referenceBoundary?: HTMLElement | null\n /**\n * When defined, the popover will be positioned relative to this element.\n * The children of the popover won't be rendered.\n */\n referenceElement?: HTMLElement | null\n scheme?: ThemeColorSchemeKey\n tone?: CardTone\n /** @beta */\n updateRef?: Ref<PopoverUpdateCallback | undefined>\n width?: PopoverWidth | PopoverWidth[]\n}\n\n/**\n * The events on the reference element that count as intent to open the popover. Each precedes the\n * interaction that usually opens a popover: focus before a key press, the pointer entering before\n * a click or a tap.\n */\nconst INTENT_EVENT_TYPES = ['focusin', 'pointerenter', 'pointerdown'] as const\n\n/** Calls `handleIntent` on intent to open the popover, until the returned function is called */\nfunction listenForIntent(element: HTMLElement, handleIntent: () => void): () => void {\n const controller = new AbortController()\n const {signal} = controller\n\n // `focusin` rather than `focus` so that focus landing inside the reference element counts too.\n // `pointerdown` is a fallback for a pointer that was already over the element when it\n // rendered, which fires no `pointerenter`.\n for (const type of INTENT_EVENT_TYPES) {\n element.addEventListener(type, handleIntent, {signal})\n }\n\n // Focus that landed before the listeners did (an `autoFocus` reference, a `referenceElement`\n // that was focused already) fired its `focusin` unheard, so count it now\n const {activeElement} = element.ownerDocument\n\n if (activeElement && element.contains(activeElement)) handleIntent()\n\n return () => controller.abort()\n}\n\n/**\n * Listens for intent on the cloned child's element from the moment it attaches, until it detaches\n * or the popover has rendered. Returns the callback for `useReferenceElement` to attach with.\n */\nfunction useChildIntent(\n shouldRender: boolean,\n handleIntent: () => void,\n): (node: HTMLElement) => () => void {\n const shouldRenderRef = useLatestRef(shouldRender)\n const stopRef = useRef<(() => void) | null>(null)\n\n useEffect(() => {\n if (shouldRender) stopListening(stopRef)\n }, [shouldRender])\n\n return useCallback(\n (node: HTMLElement) => {\n if (!shouldRenderRef.current) stopRef.current = listenForIntent(node, handleIntent)\n\n return () => stopListening(stopRef)\n },\n [handleIntent, shouldRenderRef],\n )\n}\n\nfunction stopListening(stopRef: React.RefObject<(() => void) | null>) {\n stopRef.current?.()\n stopRef.current = null\n}\n\nconst ViewportOverlay = () => {\n const {zIndex} = useLayer()\n\n return (\n <div\n data-ui=\"PopoverOverlay\"\n style={{height: '100vh', inset: 0, position: 'fixed', width: '100vw', zIndex}}\n />\n )\n}\n\n/**\n * The `Popover` component is used to display some content on top of another.\n *\n * @public\n */\nexport function Popover(\n props: PopoverProps &\n Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'children' | 'content' | 'width'>,\n): React.JSX.Element {\n const {container, layer} = useTheme_v2()\n const boundaryElementContext = useBoundaryElement()\n\n const {\n __unstable_margins: margins = DEFAULT_POPOVER_MARGINS,\n animate: _animate = false,\n arrow: arrowProp = false,\n children: childProp,\n constrainSize = false,\n content,\n disabled,\n fallbackPlacements: _fallbackPlacements,\n matchReferenceWidth,\n floatingBoundary: _floatingBoundary,\n modal,\n // oxlint-disable-next-line no-unused-vars\n onActivate,\n open,\n overflow = 'hidden',\n padding: paddingProp,\n placement: placementProp = 'bottom',\n placementStrategy = 'flip',\n portal,\n preventOverflow = true,\n radius: radiusProp = 3,\n ref: forwardedRef,\n referenceBoundary: _referenceBoundary,\n referenceElement,\n scheme,\n shadow: shadowProp = 3,\n tone = 'inherit',\n width: widthProp = 'auto',\n zOffset: _zOffsetProp,\n updateRef,\n ...restProps\n } = props\n const fallbackPlacements =\n _fallbackPlacements ?? DEFAULT_FALLBACK_PLACEMENTS[props.placement ?? 'bottom']\n const floatingBoundary = _floatingBoundary ?? boundaryElementContext.element\n const referenceBoundary = _referenceBoundary ?? boundaryElementContext.element\n // Max-width uses BoundaryElementProvider when present; otherwise the floating\n // boundary (same element the old `boundaryElement` prop used for both).\n const boundaryElement = boundaryElementContext.element ?? floatingBoundary\n const zOffsetProp = _zOffsetProp ?? layer.popover.zOffset\n const prefersReducedMotion = usePrefersReducedMotion()\n const animate = prefersReducedMotion ? false : _animate\n\n // Opening renders the popover whether or not any intent preceded it. A `disabled` popover\n // renders only its child, so neither `open` nor intent counts while it is disabled: otherwise\n // enabling it later would render it hidden without it ever having opened or been about to.\n const isOpen = Boolean(open) && !disabled\n\n const boundarySize = useBoundarySize(boundaryElement, isOpen)\n const padding = _getArrayProp(paddingProp)\n const radius = _getArrayProp(radiusProp)\n const shadow = _getArrayProp(shadowProp)\n const widthArrayProp = _getArrayProp(widthProp)\n const zOffset = _getArrayProp(zOffsetProp)\n const ref = useRef<HTMLDivElement | null>(null)\n const arrowRef = useRef<HTMLDivElement | null>(null)\n const rootBoundary: RootBoundary = 'viewport'\n\n useImperativeHandle<HTMLDivElement | null, HTMLDivElement | null>(forwardedRef, () => ref.current)\n\n const mediaIndex = useMediaIndex()\n const boundaryWidth = constrainSize || preventOverflow ? boundarySize?.width : undefined\n\n // Update width when\n // - media index changes\n // - `width` property changes\n const width = calcCurrentWidth({\n container,\n mediaIndex,\n width: widthArrayProp,\n })\n\n // Update max width when\n // - boundary width changes\n // - `width` property changes\n const maxWidth = calcMaxWidth({boundaryWidth, currentWidth: width})\n\n const middleware = useMiddleware({\n animate,\n arrowProp,\n arrowRef,\n constrainSize,\n fallbackPlacements,\n floatingBoundary,\n margins,\n matchReferenceWidth,\n maxWidth,\n placementProp,\n placementStrategy,\n preventOverflow,\n referenceBoundary,\n rootBoundary,\n })\n\n const {x, y, middlewareData, placement, refs, strategy, update} = useFloating<HTMLElement>({\n middleware,\n placement: placementProp,\n whileElementsMounted: autoUpdate,\n elements: referenceElement\n ? {\n reference: referenceElement,\n }\n : undefined,\n })\n\n // Whether the popover (card, portal and `content`) has been rendered yet. Closed popovers\n // render inside a hidden `<Activity>`, so whatever is rendered while closed is pre-rendered DOM\n // that only pays off if the popover opens. Nothing is rendered until the popover opens or the\n // reference element shows intent to open it (see `INTENT_EVENT_TYPES`), and from then on it\n // stays rendered so the state of its `content` survives reopening. Consumers that do not want\n // a popover pre-rendered on intent can leave `content` empty until it opens.\n const [hasRendered, setHasRendered] = useState(false)\n\n if (isOpen && !hasRendered) setHasRendered(true)\n\n const shouldRender = isOpen || hasRendered\n // The element to listen to for intent to open the popover: none once the popover has rendered,\n // since there is nothing left to pre-render, and none while disabled, which also drops the\n // listeners of a popover that was enabled before. A cloned child is listened to from the moment\n // it attaches instead (see `useChildIntent`), and a disabled popover does not clone it.\n const intentReference = shouldRender || disabled ? null : referenceElement\n // In a transition, so that it never holds up an open that follows right away (a click), and so\n // that React pre-renders the hidden popover in the background\n const handleIntent = useCallback(() => startTransition(() => setHasRendered(true)), [])\n\n useEffect(() => {\n if (!intentReference) return undefined\n\n return listenForIntent(intentReference, handleIntent)\n }, [handleIntent, intentReference])\n\n const listenForChildIntent = useChildIntent(shouldRender, handleIntent)\n\n const referenceHidden = middlewareData.hide?.referenceHidden\n\n const arrowX = middlewareData.arrow?.x\n const arrowY = middlewareData.arrow?.y\n\n const originX = middlewareData['@sanity/ui/origin']?.originX\n const originY = middlewareData['@sanity/ui/origin']?.originY\n\n const setArrow = useCallback((arrowEl: HTMLDivElement | null) => {\n arrowRef.current = arrowEl\n }, [])\n\n // With a `referenceElement` the child is not cloned and keeps its ref to itself\n const childRef =\n childProp && !referenceElement ? getElementRef<HTMLElement>(childProp) : undefined\n const {handOverReference, setReference} = useReferenceElement(\n refs,\n childRef,\n listenForChildIntent,\n )\n\n const setFloating = useCallback(\n (node: HTMLDivElement | null) => {\n ref.current = node\n if (node) handOverReference()\n refs.setFloating(node)\n },\n [handOverReference, refs],\n )\n\n const child = useMemo(() => {\n // If a reference element is defined, we don't need to clone the child\n if (referenceElement) return childProp\n\n if (!childProp) return null\n\n return cloneElement(childProp, {ref: setReference})\n }, [childProp, referenceElement, setReference])\n\n useImperativeHandle(updateRef, () => update, [update])\n\n if (disabled) {\n return childProp || <></>\n }\n\n const popover = (\n <LayerProvider zOffset={zOffset}>\n {/* Optional transparent blocking overlay at the top-most z-index layer. Must be positioned before the below popover card. */}\n {modal && <ViewportOverlay />}\n\n <PopoverCard\n {...restProps}\n __unstable_margins={margins}\n animate={animate}\n arrow={arrowProp}\n arrowRef={setArrow}\n arrowX={arrowX}\n arrowY={arrowY}\n constrainSize={constrainSize}\n hidden={referenceHidden}\n matchReferenceWidth={matchReferenceWidth}\n maxWidth={maxWidth}\n overflow={overflow}\n padding={padding}\n placement={placement}\n radius={radius}\n ref={setFloating}\n scheme={scheme}\n shadow={shadow}\n originX={originX}\n originY={originY}\n strategy={strategy}\n tone={tone}\n width={width}\n x={x}\n y={y}\n >\n {content}\n </PopoverCard>\n </LayerProvider>\n )\n\n const popoverNode = portal ? (\n <Portal __unstable_name={typeof portal === 'string' ? portal : undefined}>{popover}</Portal>\n ) : (\n popover\n )\n\n return (\n <>\n {/* the popover (not rendered until it opens or is about to, see `hasRendered`) */}\n {animate ? (\n <AnimateActivity layoutMode=\"default\" mode={open ? 'visible' : 'hidden'}>\n {shouldRender ? popoverNode : null}\n </AnimateActivity>\n ) : (\n <Activity mode={open ? 'visible' : 'hidden'}>{shouldRender ? popoverNode : null}</Activity>\n )}\n\n {/* the referred element */}\n {child}\n </>\n )\n}\n\n/**\n * The border-box size of the boundary element in whole pixels, tracked only while the popover is\n * open.\n *\n * Closed popovers have nothing to size, so they hold no `ResizeObserver` subscription and do not\n * re-render when the boundary resizes (one subscription per popover, every closed popover\n * re-rendering on every boundary resize, is what this replaces). The boundary is measured\n * synchronously in a layout effect when the popover opens, so the max width is right in the first\n * painted frame instead of one `ResizeObserver` callback later; the shared observer takes over\n * from there. The last size is kept while closed.\n *\n * Both measurements are rounded to whole pixels so that they agree: the observer's first delivery\n * must not change the size the opening commit measured, or the max width would be corrected a\n * frame later after all. See `measureBorderBox`.\n */\nfunction useBoundarySize(element: HTMLElement | null, open: boolean): ElementRectValue | undefined {\n const [size, setSize] = useState<ElementRectValue | undefined>(undefined)\n\n useLayoutEffect(() => {\n if (!open || !element) return undefined\n\n // Measuring the boundary is what this effect is for: the DOM is only measurable after the\n // commit, and the result has to be in the next paint\n // oxlint-disable-next-line react/set-state-in-effect\n setSize((prev) => sameSize(prev, measureBorderBox(element)))\n\n return _elementSizeObserver.subscribe(element, ({border}) =>\n setSize((prev) =>\n sameSize(prev, {width: Math.round(border.width), height: Math.round(border.height)}),\n ),\n )\n }, [element, open])\n\n return size\n}\n\n/**\n * The border-box size of an element in whole pixels, the way `_elementSizeObserver` reports it:\n * from `ResizeObserverEntry.borderBoxSize`, which is the layout size with no CSS transform or\n * `zoom` applied, in the element's writing mode (`inlineSize` as `width`, `blockSize` as\n * `height`), rounded by `useBoundarySize`. `offsetWidth`/`offsetHeight` are that same untransformed\n * border box rounded to whole pixels. `getBoundingClientRect` would include transforms (a boundary\n * mid scale animation) and `zoom`, and `getComputedStyle` serializes lengths with limited\n * precision, so neither agrees with the observer for every element.\n *\n * Kept at module scope on purpose: reading the offset size forces a synchronous layout, and the\n * React Compiler (which the package build runs) lifts a member expression on an element captured\n * by a component callback into a memo dependency evaluated during render. A plain function call\n * on the element gives it nothing to lift.\n */\nfunction measureBorderBox(element: HTMLElement): ElementRectValue {\n const {offsetWidth, offsetHeight} = element\n\n if (getComputedStyle(element).writingMode.startsWith('horizontal')) {\n return {width: offsetWidth, height: offsetHeight}\n }\n\n // In a vertical writing mode the inline size is the physical height\n return {width: offsetHeight, height: offsetWidth}\n}\n\n/** Keeps the previous object when the size has not changed, so `setState` bails out */\nfunction sameSize(prev: ElementRectValue | undefined, next: ElementRectValue): ElementRectValue {\n return prev && prev.width === next.width && prev.height === next.height ? prev : next\n}\n\nfunction useMiddleware({\n animate,\n arrowProp,\n arrowRef,\n constrainSize,\n fallbackPlacements,\n floatingBoundary,\n margins,\n matchReferenceWidth,\n maxWidth,\n placementProp,\n placementStrategy,\n preventOverflow,\n referenceBoundary,\n rootBoundary,\n}: {\n animate: boolean\n arrowProp: boolean\n arrowRef: React.RefObject<HTMLDivElement | null>\n constrainSize: boolean\n fallbackPlacements: Placement[]\n floatingBoundary: HTMLElement | null\n margins: PopoverMargins\n matchReferenceWidth: boolean | undefined\n maxWidth: number | undefined\n placementProp: Placement\n placementStrategy: 'flip' | 'autoPlacement'\n preventOverflow: boolean\n referenceBoundary: HTMLElement | null\n rootBoundary: RootBoundary\n}) {\n return useMemo(() => {\n const ret: Middleware[] = []\n\n // Flip the floating element when leaving the boundary box\n if (constrainSize || preventOverflow) {\n if (placementStrategy === 'autoPlacement') {\n ret.push(\n autoPlacement({\n allowedPlacements: [placementProp].concat(fallbackPlacements),\n }),\n )\n } else {\n ret.push(\n flip({\n boundary: floatingBoundary || undefined,\n fallbackPlacements,\n padding: DEFAULT_POPOVER_PADDING,\n rootBoundary,\n }),\n )\n }\n }\n\n // Define distance between reference and floating element\n ret.push(offset({mainAxis: DEFAULT_POPOVER_DISTANCE}))\n\n // Track sizes\n if (constrainSize || matchReferenceWidth) {\n ret.push(\n size({\n boundaryElement: floatingBoundary || undefined,\n constrainSize,\n margins,\n matchReferenceWidth,\n // The card renders the cap unless `constrainSize`: no reason to change the middleware then\n maxWidth: constrainSize ? maxWidth : undefined,\n padding: DEFAULT_POPOVER_PADDING,\n }),\n )\n }\n\n // Shift the popover so its sits within the boundary element\n if (preventOverflow) {\n ret.push(\n shift({\n boundary: floatingBoundary || undefined,\n rootBoundary,\n padding: DEFAULT_POPOVER_PADDING,\n }),\n )\n }\n\n // Place arrow\n if (arrowProp) {\n ret.push(\n arrow({\n element: arrowRef,\n padding: DEFAULT_POPOVER_PADDING,\n }),\n )\n }\n\n // Determine the origin to scale from.\n // Must be placed after `@sanity/ui/size` and `shift` middleware.\n if (animate) {\n ret.push(origin)\n }\n\n ret.push(\n hide({\n boundary: referenceBoundary || undefined,\n padding: DEFAULT_POPOVER_PADDING,\n strategy: 'referenceHidden',\n }),\n )\n\n return ret\n }, [\n animate,\n arrowProp,\n arrowRef,\n constrainSize,\n fallbackPlacements,\n floatingBoundary,\n margins,\n matchReferenceWidth,\n maxWidth,\n placementProp,\n placementStrategy,\n preventOverflow,\n referenceBoundary,\n rootBoundary,\n ])\n}\n"],"mappings":";;;;;;;;;;;;AAQA,MAAa,0BAA0C;CAAC;CAAG;CAAG;CAAG;AAAC,GACrD,8BAA8D;CACzE4F,KAAO;EAAC;EAAU;EAAQ;CAAO;CACjC,aAAa;EAAC;EAAgB;EAAc;CAAa;CACzD,WAAW;EAAC;EAAc;EAAY;CAAW;CACjDC,QAAU;EAAC;EAAO;EAAQ;CAAO;CACjC,gBAAgB;EAAC;EAAa;EAAc;CAAa;CACzD,cAAc;EAAC;EAAW;EAAY;CAAW;CACjDC,MAAQ;EAAC;EAAS;EAAO;CAAQ;CACjC,cAAc;EAAC;EAAe;EAAa;CAAc;CACzD,YAAY;EAAC;EAAa;EAAW;CAAY;CACjDC,OAAS;EAAC;EAAQ;EAAO;CAAQ;CACjC,eAAe;EAAC;EAAc;EAAa;CAAc;CACzD,aAAa;EAAC;EAAY;EAAW;CAAY;AACnD;AClBA,SAAgB/F,OAAK,SAON;CACb,IAAM,EAAC,eAAe,SAAS,qBAAqB,UAAU,MAAK;CAEnE,OAAO;EACL,MAAM;EAGN;EACA,MAAM,GAAG,MAAM;GACb,IAAM,EAAC,UAAU,WAAW,UAAU,UAAS,MACzC,EAAC,UAAU,cAAa,OAExB,WAAW,MAAM,eAAe,MAAM;IAC1C,aAAa;IACb,UAAU,QAAQ,mBAAmB,KAAA;IACrC,gBAAgB;IAChB;IACA,cAAc;GAChB,CAAC,GAEG,WAAW,UACX,YAAY,UAEV,YAAY,SAAS,OACrB,YAAY,SAAS;GAiB3B,AAfI,UAAU,SAAS,KAAK,MAC1B,WAAW,aAAa,SAAS,OAAO,SAAS,QACjD,YAAY,YAAY,SAAS,MAG/B,UAAU,SAAS,OAAO,MAC5B,WAAW,YAAY,SAAS,OAChC,YAAY,aAAa,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AAA,QAAA,gBAAA,EAAA,QADUJ,MADZ,KAAA,MAAM;IACJ,UAAUA;IACV;IACA,SAAA;GACF,CAAC,GAFC,EAAA,MAAA,cADUA,EAAAA,MAAAA,8BAFd,IAAI,KACFI,EAKF;EACF;EAGA,IAAI,WAAW;GAEXC,IAAAA;GADF,AAEa,EAAA,QAAA,yBADX,KAAA,MAAM;IACJ,SAAS;IACT,SAAA;GACF,CAAC,GAFU,EAAA,MAAA,uBAFb,IAAI,KACFA,EAIF;EACF;EAIA,AAAI,WACF,IAAI,KAAK,MAAM;EAKH,IAAA,KAAA,qBAAqB,KAAA,GADjCC;EACYC,EAAAA,QAAAA,mBADZ,KAAA,KAAK;GACH,UAAUA;GACV,SAAA;GACA,UAAU;EACZ,CAAC,GAHWA,EAAAA,MAAAA,iBAFd,IAAI,KACFD,EAKF,GAVI,EAAA,KAAA,SAXA,EAAA,KAAA,WAGW,EAAA,KAAA,UApDX,EAAA,KAAA,eAI8C,EAAA,KAAA,oBAMhC,EAAA,KAAA,kBAkBZ,EAAA,KAAA,SALe,EAAA,KAAA,qBAQW,EAAA,KAAA,UA3BJ,EAAA,KAAA,eAHtB,EAAA,MAAA,mBADe,EAAA,MAAA,iBAkEP,EAAA,MAAA,mBArDN,EAAA,MAAA;;CAjBV,OAAOE;AA6FT"}
@@ -1 +1 @@
1
- {"version":3,"file":"popover-HDVgZg5e.d.ts","names":[],"sources":["../src/core/types/popover.ts","../src/core/primitives/popover/types.ts","../src/core/primitives/popover/popover.tsx"],"mappings":";;;;;;;KAGY;;KCFA;;KAIA;;UCoDK,qBACP,KAAK,mBAAmB,uBAAuB;;EAEvD,qBAAqB;;;;;;;EAOrB;EACA;;EAEA;EACA,WAAW,MAAM,IAAI;;;;;;;;;;;;EAYrB;EACA,UAAU,MAAM;EAChB;EACA,qBAAqB;EACrB,mBAAmB;;;;;;;;;EASnB;;;;;;;EAOA;;;;;;;;;;;;;;;;;;;;;;EAsBA;EACA,WAAW;EACX;EACA,YAAY;;;;;;;;;;EAUZ;;EAEA;EACA;EACA,oBAAoB;;;;;EAKpB,mBAAmB;EACnB,SAAS;EACT,OAAO;;EAEP,YAAY,IAAI;EAChB,QAAQ,eAAe;;;;;;;iBA0BT,QACd,OAAO,eACL,KAAK,MAAM,UAAU,4DACtB,MAAM,IAAI"}
1
+ {"version":3,"file":"popover-HDVgZg5e.d.ts","names":[],"sources":["../src/core/types/popover.ts","../src/core/primitives/popover/types.ts","../src/core/primitives/popover/popover.tsx"],"mappings":";;;;;;;KAGY;;KCFA;;KAIA;;UCsDK,qBACP,KAAK,mBAAmB,uBAAuB;;EAEvD,qBAAqB;;;;;;;EAOrB;EACA;;EAEA;EACA,WAAW,MAAM,IAAI;;;;;;;;;;;;EAYrB;EACA,UAAU,MAAM;EAChB;EACA,qBAAqB;EACrB,mBAAmB;;;;;;;;;EASnB;;;;;;;EAOA;;;;;;;;;;;;;;;;;;;;;;EAsBA;EACA,WAAW;EACX;EACA,YAAY;;;;;;;;;;EAUZ;;EAEA;EACA;EACA,oBAAoB;;;;;EAKpB,mBAAmB;EACnB,SAAS;EACT,OAAO;;EAEP,YAAY,IAAI;EAChB,QAAQ,eAAe;;;;;;;iBA6ET,QACd,OAAO,eACL,KAAK,MAAM,UAAU,4DACtB,MAAM,IAAI"}
package/dist/popover.js CHANGED
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- export { t as Popover } from "./popover-B0kvwaep.js";
2
+ export { t as Popover } from "./popover-CEDyHcBi.js";
package/dist/tooltip.js CHANGED
@@ -1,16 +1,16 @@
1
1
  "use client";
2
2
  import { l as POPOVER_MOTION_PROPS, n as _getArrayProp } from "./helpers-XThPpWje.js";
3
3
  import { _ as useTheme_v2, d as createGlobalScopedContext, i as usePrefersReducedMotion, s as Card } from "./useLayer-B0i19TTM.js";
4
- import { i as origin, n as AnimateActivity, r as getTransformOrigin, t as getElementRef } from "./getElementRef-Jw7gY0eV.js";
4
+ import { a as useReferenceElement, i as origin, n as AnimateActivity, r as getTransformOrigin, s as useLatestRef, t as getElementRef } from "./getElementRef-BLVMlHTn.js";
5
5
  import { a as resolvePortalElement, n as Portal, o as useBoundaryElement, r as usePortal, t as Arrow } from "./arrow-A3jQ7LS0.js";
6
6
  import { t as Layer } from "./layer-AWzYcY_j.js";
7
7
  import { c } from "react/compiler-runtime";
8
8
  import { clsx } from "clsx/lite";
9
- import { Activity, cloneElement, useContext, useEffect, useId, useImperativeHandle, useInsertionEffect, useLayoutEffect, useRef, useState } from "react";
9
+ import { Activity, cloneElement, useContext, useEffect, useId, useImperativeHandle, useLayoutEffect, useRef, useState } from "react";
10
+ import { useEffectEvent } from "use-effect-event";
10
11
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
11
12
  import { arrow, autoUpdate, detectOverflow, flip, offset, shift, size, useFloating } from "@floating-ui/react-dom";
12
13
  import { motion } from "motion/react";
13
- import { useEffectEvent } from "use-effect-event";
14
14
  /**
15
15
  * @beta
16
16
  */
@@ -181,9 +181,9 @@ function useTooltipDelayGroup() {
181
181
  * @public
182
182
  */
183
183
  function Tooltip(props) {
184
- let $ = c(122), boundaryElementContext = useBoundaryElement(), { layer } = useTheme_v2(), { animate: t0, arrow: t1, boundaryElement: _boundaryElement, children: childProp, content, disabled, fallbackPlacements: _fallbackPlacementsProp, padding: t2, placement: t3, portal: portalProp, radius: t4, ref: forwardedRef, scheme, shadow: t5, zOffset: _zOffset, delay, ...restProps } = props, _animate = t0 !== void 0 && t0, arrowProp = t1 !== void 0 && 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() && _animate, t6;
184
+ let $ = c(118), boundaryElementContext = useBoundaryElement(), { layer } = useTheme_v2(), { animate: t0, arrow: t1, boundaryElement: _boundaryElement, children: childProp, content, disabled, fallbackPlacements: _fallbackPlacementsProp, padding: t2, placement: t3, portal: portalProp, radius: t4, ref: forwardedRef, scheme, shadow: t5, zOffset: _zOffset, delay, ...restProps } = props, _animate = t0 !== void 0 && t0, arrowProp = t1 !== void 0 && 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() && _animate, t6;
185
185
  $[0] === fallbackPlacementsProp ? t6 = $[1] : (t6 = _getArrayProp(fallbackPlacementsProp), $[0] = fallbackPlacementsProp, $[1] = t6);
186
- let fallbackPlacements = t6, ref = useRef(null), [referenceElement, setReferenceElement] = useState(null), arrowRef = useRef(null), t7;
186
+ let fallbackPlacements = t6, ref = useRef(null), arrowRef = useRef(null), t7;
187
187
  $[2] === Symbol.for("react.memo_cache_sentinel") ? (t7 = () => ref.current, $[2] = t7) : t7 = $[2], useImperativeHandle(forwardedRef, t7);
188
188
  let portal = usePortal(), portalName = typeof portalProp == "string" ? portalProp : void 0, t8;
189
189
  $[3] !== portal || $[4] !== portalName ? (t8 = resolvePortalElement(portal, portalName), $[3] = portal, $[4] = portalName, $[5] = t8) : t8 = $[5];
@@ -198,68 +198,67 @@ function Tooltip(props) {
198
198
  rootBoundary: "viewport"
199
199
  }, $[6] = animate, $[7] = arrowProp, $[8] = boundaryElement, $[9] = fallbackPlacements, $[10] = portalElement, $[11] = t9) : t9 = $[11];
200
200
  let middleware = useMiddleware(t9), t10;
201
- $[12] === referenceElement ? t10 = $[13] : (t10 = { reference: referenceElement }, $[12] = referenceElement, $[13] = t10);
202
- let t11;
203
- $[14] !== middleware || $[15] !== placementProp || $[16] !== t10 ? (t11 = {
201
+ $[12] !== middleware || $[13] !== placementProp ? (t10 = {
204
202
  middleware,
205
203
  placement: placementProp,
206
- whileElementsMounted: autoUpdate,
207
- elements: t10
208
- }, $[14] = middleware, $[15] = placementProp, $[16] = t10, $[17] = t11) : t11 = $[17];
209
- let { floatingStyles, placement, middlewareData, refs, update } = useFloating(t11), t12;
210
- $[18] === update ? t12 = $[19] : (t12 = () => update(), $[18] = update, $[19] = t12);
204
+ whileElementsMounted: autoUpdate
205
+ }, $[12] = middleware, $[13] = placementProp, $[14] = t10) : t10 = $[14];
206
+ let { floatingStyles, placement, middlewareData, refs, update } = useFloating(t10), t11;
207
+ $[15] === childProp ? t11 = $[16] : (t11 = childProp ? getElementRef(childProp) : void 0, $[15] = childProp, $[16] = t11);
208
+ let { handOverReference, referenceRef, setReference } = useReferenceElement(refs, t11), t12;
209
+ $[17] === update ? t12 = $[18] : (t12 = () => update(), $[17] = update, $[18] = t12);
211
210
  let reposition = useEffectEvent(t12), t13;
212
- $[20] !== boundaryElement || $[21] !== portalElement || $[22] !== reposition ? (t13 = () => {
211
+ $[19] !== boundaryElement || $[20] !== portalElement || $[21] !== reposition ? (t13 = () => {
213
212
  (boundaryElement || portalElement) && reposition();
214
- }, $[20] = boundaryElement, $[21] = portalElement, $[22] = reposition, $[23] = t13) : t13 = $[23];
213
+ }, $[19] = boundaryElement, $[20] = portalElement, $[21] = reposition, $[22] = t13) : t13 = $[22];
215
214
  let t14;
216
- $[24] !== boundaryElement || $[25] !== portalElement ? (t14 = [boundaryElement, portalElement], $[24] = boundaryElement, $[25] = portalElement, $[26] = t14) : t14 = $[26], useLayoutEffect(t13, t14);
215
+ $[23] !== boundaryElement || $[24] !== portalElement ? (t14 = [boundaryElement, portalElement], $[23] = boundaryElement, $[24] = portalElement, $[25] = t14) : t14 = $[25], useLayoutEffect(t13, t14);
217
216
  let 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(), t15;
218
- $[27] === delayGroupContext ? t15 = $[28] : (t15 = delayGroupContext || {}, $[27] = delayGroupContext, $[28] = t15);
217
+ $[26] === delayGroupContext ? t15 = $[27] : (t15 = delayGroupContext || {}, $[26] = delayGroupContext, $[27] = t15);
219
218
  let { setIsGroupActive, setOpenTooltipId } = t15, suppressed = disabled || !content, showTooltip = !suppressed && (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, t16;
220
- $[29] !== closeDelay || $[30] !== isInsideGroup || $[31] !== openDelay || $[32] !== setIsGroupActive || $[33] !== setIsOpen || $[34] !== setOpenTooltipId || $[35] !== tooltipId ? (t16 = (open, immediate) => {
219
+ $[28] !== closeDelay || $[29] !== isInsideGroup || $[30] !== openDelay || $[31] !== setIsGroupActive || $[32] !== setIsOpen || $[33] !== setOpenTooltipId || $[34] !== tooltipId ? (t16 = (open, immediate) => {
221
220
  if (isInsideGroup) {
222
221
  if (open) {
223
222
  let groupedOpenDelay = immediate ? 0 : openDelay;
224
223
  setIsGroupActive?.(open, groupedOpenDelay), setOpenTooltipId?.(tooltipId, groupedOpenDelay);
225
224
  } else setIsGroupActive?.(open, closeDelay > 200 ? closeDelay : 200), setOpenTooltipId?.(null, immediate ? 0 : closeDelay);
226
225
  } else setIsOpen(open, immediate ? 0 : open ? openDelay : closeDelay);
227
- }, $[29] = closeDelay, $[30] = isInsideGroup, $[31] = openDelay, $[32] = setIsGroupActive, $[33] = setIsOpen, $[34] = setOpenTooltipId, $[35] = tooltipId, $[36] = t16) : t16 = $[36];
226
+ }, $[28] = closeDelay, $[29] = isInsideGroup, $[30] = openDelay, $[31] = setIsGroupActive, $[32] = setIsOpen, $[33] = setOpenTooltipId, $[34] = tooltipId, $[35] = t16) : t16 = $[35];
228
227
  let handleIsOpenChange = t16, t17;
229
- $[37] !== childProp?.props || $[38] !== handleIsOpenChange || $[39] !== suppressed ? (t17 = (e) => {
228
+ $[36] !== childProp?.props || $[37] !== handleIsOpenChange || $[38] !== suppressed ? (t17 = (e) => {
230
229
  handleIsOpenChange(!1, suppressed), childProp?.props?.onBlur?.(e);
231
- }, $[37] = childProp?.props, $[38] = handleIsOpenChange, $[39] = suppressed, $[40] = t17) : t17 = $[40], childProp?.props;
230
+ }, $[36] = childProp?.props, $[37] = handleIsOpenChange, $[38] = suppressed, $[39] = t17) : t17 = $[39], childProp?.props;
232
231
  let handleBlur = t17, t18;
233
- $[41] !== childProp?.props || $[42] !== handleIsOpenChange ? (t18 = (e_0) => {
232
+ $[40] !== childProp?.props || $[41] !== handleIsOpenChange ? (t18 = (e_0) => {
234
233
  handleIsOpenChange(!1, !0), childProp?.props.onClick?.(e_0);
235
- }, $[41] = childProp?.props, $[42] = handleIsOpenChange, $[43] = t18) : t18 = $[43], childProp?.props;
234
+ }, $[40] = childProp?.props, $[41] = handleIsOpenChange, $[42] = t18) : t18 = $[42], childProp?.props;
236
235
  let handleClick = t18, t19;
237
- $[44] !== childProp?.props || $[45] !== handleIsOpenChange ? (t19 = (e_1) => {
236
+ $[43] !== childProp?.props || $[44] !== handleIsOpenChange ? (t19 = (e_1) => {
238
237
  handleIsOpenChange(!1, !0), childProp?.props.onContextMenu?.(e_1);
239
- }, $[44] = childProp?.props, $[45] = handleIsOpenChange, $[46] = t19) : t19 = $[46], childProp?.props;
238
+ }, $[43] = childProp?.props, $[44] = handleIsOpenChange, $[45] = t19) : t19 = $[45], childProp?.props;
240
239
  let handleContextMenu = t19, t20;
241
- $[47] !== childProp?.props || $[48] !== handleIsOpenChange ? (t20 = (e_2) => {
240
+ $[46] !== childProp?.props || $[47] !== handleIsOpenChange ? (t20 = (e_2) => {
242
241
  handleIsOpenChange(!0), childProp?.props?.onFocus?.(e_2);
243
- }, $[47] = childProp?.props, $[48] = handleIsOpenChange, $[49] = t20) : t20 = $[49], childProp?.props;
242
+ }, $[46] = childProp?.props, $[47] = handleIsOpenChange, $[48] = t20) : t20 = $[48], childProp?.props;
244
243
  let handleFocus = t20, t21;
245
- $[50] !== childProp?.props || $[51] !== handleIsOpenChange ? (t21 = (e_3) => {
244
+ $[49] !== childProp?.props || $[50] !== handleIsOpenChange ? (t21 = (e_3) => {
246
245
  handleIsOpenChange(!0), childProp?.props?.onMouseEnter?.(e_3);
247
- }, $[50] = childProp?.props, $[51] = handleIsOpenChange, $[52] = t21) : t21 = $[52], childProp?.props;
246
+ }, $[49] = childProp?.props, $[50] = handleIsOpenChange, $[51] = t21) : t21 = $[51], childProp?.props;
248
247
  let handleMouseEnter = t21, t22;
249
- $[53] !== childProp?.props || $[54] !== handleIsOpenChange || $[55] !== suppressed ? (t22 = (e_4) => {
248
+ $[52] !== childProp?.props || $[53] !== handleIsOpenChange || $[54] !== suppressed ? (t22 = (e_4) => {
250
249
  handleIsOpenChange(!1, suppressed), childProp?.props?.onMouseLeave?.(e_4);
251
- }, $[53] = childProp?.props, $[54] = handleIsOpenChange, $[55] = suppressed, $[56] = t22) : t22 = $[56], childProp?.props;
250
+ }, $[52] = childProp?.props, $[53] = handleIsOpenChange, $[54] = suppressed, $[55] = t22) : t22 = $[55], childProp?.props;
252
251
  let handleMouseLeave = t22, t23;
253
- $[57] !== handleIsOpenChange || $[58] !== isInsideGroup || $[59] !== referenceElement || $[60] !== showTooltip ? (t23 = {
252
+ $[56] !== handleIsOpenChange || $[57] !== isInsideGroup || $[58] !== referenceRef || $[59] !== showTooltip ? (t23 = {
254
253
  handleIsOpenChange,
255
- referenceElement,
254
+ referenceRef,
256
255
  showTooltip,
257
256
  isInsideGroup
258
- }, $[57] = handleIsOpenChange, $[58] = isInsideGroup, $[59] = referenceElement, $[60] = showTooltip, $[61] = t23) : t23 = $[61], useCloseOnMouseLeave(t23);
257
+ }, $[56] = handleIsOpenChange, $[57] = isInsideGroup, $[58] = referenceRef, $[59] = showTooltip, $[60] = t23) : t23 = $[60], useCloseOnMouseLeave(t23);
259
258
  let t24;
260
- $[62] === handleIsOpenChange ? t24 = $[63] : (t24 = () => handleIsOpenChange(!1, !0), $[62] = handleIsOpenChange, $[63] = t24);
259
+ $[61] === handleIsOpenChange ? t24 = $[62] : (t24 = () => handleIsOpenChange(!1, !0), $[61] = handleIsOpenChange, $[62] = t24);
261
260
  let onWindowEscape = useEffectEvent(t24), t25;
262
- $[64] !== onWindowEscape || $[65] !== showTooltip ? (t25 = () => {
261
+ $[63] !== onWindowEscape || $[64] !== showTooltip ? (t25 = () => {
263
262
  if (!showTooltip) return;
264
263
  let handleWindowKeyDown = function handleWindowKeyDown(event) {
265
264
  event.key === "Escape" && onWindowEscape();
@@ -267,17 +266,17 @@ function Tooltip(props) {
267
266
  return window.addEventListener("keydown", handleWindowKeyDown), () => {
268
267
  window.removeEventListener("keydown", handleWindowKeyDown);
269
268
  };
270
- }, $[64] = onWindowEscape, $[65] = showTooltip, $[66] = t25) : t25 = $[66];
269
+ }, $[63] = onWindowEscape, $[64] = showTooltip, $[65] = t25) : t25 = $[65];
271
270
  let t26;
272
- $[67] === showTooltip ? t26 = $[68] : (t26 = [showTooltip], $[67] = showTooltip, $[68] = t26), useEffect(t25, t26);
271
+ $[66] === showTooltip ? t26 = $[67] : (t26 = [showTooltip], $[66] = showTooltip, $[67] = t26), useEffect(t25, t26);
273
272
  let t27;
274
- $[69] === update ? t27 = $[70] : (t27 = (arrowEl) => {
273
+ $[68] === update ? t27 = $[69] : (t27 = (arrowEl) => {
275
274
  arrowRef.current = arrowEl, update();
276
- }, $[69] = update, $[70] = t27);
275
+ }, $[68] = update, $[69] = t27);
277
276
  let setArrow = t27, t28;
278
- $[71] === refs ? t28 = $[72] : (t28 = (node) => {
279
- ref.current = node, refs.setFloating(node);
280
- }, $[71] = refs, $[72] = t28);
277
+ $[70] !== handOverReference || $[71] !== refs ? (t28 = (node) => {
278
+ ref.current = node, node && handOverReference(), refs.setFloating(node);
279
+ }, $[70] = handOverReference, $[71] = refs, $[72] = t28) : t28 = $[72];
281
280
  let setFloating = t28, t29;
282
281
  bb0: {
283
282
  if (!childProp) {
@@ -285,25 +284,23 @@ function Tooltip(props) {
285
284
  break bb0;
286
285
  }
287
286
  let t30;
288
- $[73] !== childProp || $[74] !== handleBlur || $[75] !== handleClick || $[76] !== handleContextMenu || $[77] !== handleFocus || $[78] !== handleMouseEnter || $[79] !== handleMouseLeave ? (t30 = cloneElement(childProp, {
287
+ $[73] !== childProp || $[74] !== handleBlur || $[75] !== handleClick || $[76] !== handleContextMenu || $[77] !== handleFocus || $[78] !== handleMouseEnter || $[79] !== handleMouseLeave || $[80] !== setReference ? (t30 = cloneElement(childProp, {
289
288
  onBlur: handleBlur,
290
289
  onFocus: handleFocus,
291
290
  onMouseEnter: handleMouseEnter,
292
291
  onMouseLeave: handleMouseLeave,
293
292
  onClick: handleClick,
294
293
  onContextMenu: handleContextMenu,
295
- ref: setReferenceElement
296
- }), $[73] = childProp, $[74] = handleBlur, $[75] = handleClick, $[76] = handleContextMenu, $[77] = handleFocus, $[78] = handleMouseEnter, $[79] = handleMouseLeave, $[80] = t30) : t30 = $[80], t29 = t30;
294
+ ref: setReference
295
+ }), $[73] = childProp, $[74] = handleBlur, $[75] = handleClick, $[76] = handleContextMenu, $[77] = handleFocus, $[78] = handleMouseEnter, $[79] = handleMouseLeave, $[80] = setReference, $[81] = t30) : t30 = $[81], t29 = t30;
297
296
  }
298
- let child = t29, t30;
299
- $[81] === childProp ? t30 = $[82] : (t30 = childProp ? getElementRef(childProp) : null, $[81] = childProp, $[82] = t30);
300
- let t31, t32;
301
- if ($[83] === referenceElement ? (t31 = $[84], t32 = $[85]) : (t31 = () => referenceElement, t32 = [referenceElement], $[83] = referenceElement, $[84] = t31, $[85] = t32), useImperativeHandle(t30, t31, t32), !child) {
302
- let t33;
303
- return $[86] === Symbol.for("react.memo_cache_sentinel") ? (t33 = /* @__PURE__ */ jsx(Fragment$1, {}), $[86] = t33) : t33 = $[86], t33;
297
+ let child = t29;
298
+ if (!child) {
299
+ let t30;
300
+ return $[82] === Symbol.for("react.memo_cache_sentinel") ? (t30 = /* @__PURE__ */ jsx(Fragment$1, {}), $[82] = t30) : t30 = $[82], t30;
304
301
  }
305
- let T0 = Layer, t34 = clsx(tooltipLayer, restProps.className), t35;
306
- $[87] !== animate || $[88] !== arrowProp || $[89] !== arrowX || $[90] !== arrowY || $[91] !== content || $[92] !== originX || $[93] !== originY || $[94] !== padding || $[95] !== placement || $[96] !== radius || $[97] !== restProps || $[98] !== scheme || $[99] !== setArrow || $[100] !== setFloating || $[101] !== shadow ? (t35 = /* @__PURE__ */ jsx(TooltipCard, {
302
+ let T0 = Layer, t31 = clsx(tooltipLayer, restProps.className), t32;
303
+ $[83] !== animate || $[84] !== arrowProp || $[85] !== arrowX || $[86] !== arrowY || $[87] !== content || $[88] !== originX || $[89] !== originY || $[90] !== padding || $[91] !== placement || $[92] !== radius || $[93] !== restProps || $[94] !== scheme || $[95] !== setArrow || $[96] !== setFloating || $[97] !== shadow ? (t32 = /* @__PURE__ */ jsx(TooltipCard, {
307
304
  ...restProps,
308
305
  animate,
309
306
  arrow: arrowProp,
@@ -319,43 +316,33 @@ function Tooltip(props) {
319
316
  scheme,
320
317
  shadow,
321
318
  children: content
322
- }), $[87] = animate, $[88] = arrowProp, $[89] = arrowX, $[90] = arrowY, $[91] = content, $[92] = originX, $[93] = originY, $[94] = padding, $[95] = placement, $[96] = radius, $[97] = restProps, $[98] = scheme, $[99] = setArrow, $[100] = setFloating, $[101] = shadow, $[102] = t35) : t35 = $[102];
323
- let t36;
324
- $[103] !== T0 || $[104] !== floatingStyles || $[105] !== restProps || $[106] !== setFloating || $[107] !== t34 || $[108] !== t35 || $[109] !== zOffset ? (t36 = /* @__PURE__ */ jsx(T0, {
319
+ }), $[83] = animate, $[84] = arrowProp, $[85] = arrowX, $[86] = arrowY, $[87] = content, $[88] = originX, $[89] = originY, $[90] = padding, $[91] = placement, $[92] = radius, $[93] = restProps, $[94] = scheme, $[95] = setArrow, $[96] = setFloating, $[97] = shadow, $[98] = t32) : t32 = $[98];
320
+ let t33;
321
+ $[99] !== T0 || $[100] !== floatingStyles || $[101] !== restProps || $[102] !== setFloating || $[103] !== t31 || $[104] !== t32 || $[105] !== zOffset ? (t33 = /* @__PURE__ */ jsx(T0, {
325
322
  "data-ui": "Tooltip",
326
323
  ...restProps,
327
- className: t34,
324
+ className: t31,
328
325
  ref: setFloating,
329
326
  style: floatingStyles,
330
327
  zOffset,
331
- children: t35
332
- }), $[103] = T0, $[104] = floatingStyles, $[105] = restProps, $[106] = setFloating, $[107] = t34, $[108] = t35, $[109] = zOffset, $[110] = t36) : t36 = $[110];
333
- let tooltip = t36, t37;
334
- $[111] !== portalName || $[112] !== portalProp || $[113] !== tooltip ? (t37 = portalProp ? /* @__PURE__ */ jsx(Portal, {
328
+ children: t32
329
+ }), $[99] = T0, $[100] = floatingStyles, $[101] = restProps, $[102] = setFloating, $[103] = t31, $[104] = t32, $[105] = zOffset, $[106] = t33) : t33 = $[106];
330
+ let tooltip = t33, t34;
331
+ $[107] !== portalName || $[108] !== portalProp || $[109] !== tooltip ? (t34 = portalProp ? /* @__PURE__ */ jsx(Portal, {
335
332
  __unstable_name: portalName,
336
333
  children: tooltip
337
- }) : tooltip, $[111] = portalName, $[112] = portalProp, $[113] = tooltip, $[114] = t37) : t37 = $[114];
338
- let tooltipNode = t37, t38;
339
- $[115] !== animate || $[116] !== showTooltip || $[117] !== tooltipNode ? (t38 = animate ? /* @__PURE__ */ jsx(AnimateActivity, {
334
+ }) : tooltip, $[107] = portalName, $[108] = portalProp, $[109] = tooltip, $[110] = t34) : t34 = $[110];
335
+ let tooltipNode = t34, t35;
336
+ $[111] !== animate || $[112] !== showTooltip || $[113] !== tooltipNode ? (t35 = animate ? /* @__PURE__ */ jsx(AnimateActivity, {
340
337
  layoutMode: "default",
341
338
  mode: showTooltip ? "visible" : "hidden",
342
339
  children: tooltipNode
343
340
  }) : /* @__PURE__ */ jsx(Activity, {
344
341
  mode: showTooltip ? "visible" : "hidden",
345
342
  children: tooltipNode
346
- }), $[115] = animate, $[116] = showTooltip, $[117] = tooltipNode, $[118] = t38) : t38 = $[118];
347
- let t39 = disabled ? null : t38, t40;
348
- return $[119] !== child || $[120] !== t39 ? (t40 = /* @__PURE__ */ jsxs(Fragment$1, { children: [t39, child] }), $[119] = child, $[120] = t39, $[121] = t40) : t40 = $[121], t40;
349
- }
350
- /**
351
- * A ref that always holds the latest `value`, updated before any layout effect of the same commit
352
- * runs (the same mechanism `use-effect-event` uses), for callbacks that run outside render.
353
- */
354
- function useLatestRef(value) {
355
- let $ = c(3), ref = useRef(value), t0, t1;
356
- return $[0] === value ? (t0 = $[1], t1 = $[2]) : (t0 = () => {
357
- ref.current = value;
358
- }, t1 = [value], $[0] = value, $[1] = t0, $[2] = t1), useInsertionEffect(t0, t1), ref;
343
+ }), $[111] = animate, $[112] = showTooltip, $[113] = tooltipNode, $[114] = t35) : t35 = $[114];
344
+ let t36 = disabled ? null : t35, t37;
345
+ return $[115] !== child || $[116] !== t36 ? (t37 = /* @__PURE__ */ jsxs(Fragment$1, { children: [t36, child] }), $[115] = child, $[116] = t36, $[117] = t37) : t37 = $[117], t37;
359
346
  }
360
347
  /**
361
348
  * Derivable middleware options that read the boundary element from a ref. Floating UI evaluates
@@ -436,10 +423,11 @@ function useMiddleware(t0) {
436
423
  * @see https://19.react.dev/learn/separating-events-from-effects#reading-latest-props-and-state-with-effect-events:~:text=Never%20pass%20them%20to%20other%20components%20or%20Hooks
437
424
  */
438
425
  function useCloseOnMouseLeave(t0) {
439
- let $ = c(10), { handleIsOpenChange, referenceElement, showTooltip, isInsideGroup } = t0, t1;
440
- $[0] !== handleIsOpenChange || $[1] !== referenceElement ? (t1 = (target, teardown) => {
426
+ let $ = c(10), { handleIsOpenChange, referenceRef, showTooltip, isInsideGroup } = t0, t1;
427
+ $[0] !== handleIsOpenChange || $[1] !== referenceRef ? (t1 = (target, teardown) => {
428
+ let referenceElement = referenceRef.current;
441
429
  referenceElement && (referenceElement === target || target instanceof Node && referenceElement.contains(target) || (handleIsOpenChange(!1), teardown()));
442
- }, $[0] = handleIsOpenChange, $[1] = referenceElement, $[2] = t1) : t1 = $[2];
430
+ }, $[0] = handleIsOpenChange, $[1] = referenceRef, $[2] = t1) : t1 = $[2];
443
431
  let onMouseMove = useEffectEvent(t1), t2;
444
432
  $[3] !== isInsideGroup || $[4] !== onMouseMove || $[5] !== showTooltip ? (t2 = () => {
445
433
  if (!showTooltip || isInsideGroup) return;