import { RefObject } from 'react'; import { PopoverPlacement, PopoverAlign } from './popover.types.js'; export declare function supportsAnchoring(): boolean; export interface UsePopoverPositionArgs { isOpen: boolean; placement: PopoverPlacement; align: PopoverAlign; offset: number; triggerRef: RefObject; /** `position: fixed` wrapper that receives top/left/visibility and the resolved-placement data attribute. */ floatingRef: RefObject; /** Visible panel, measured to decide flip and shift. */ panelRef: RefObject; /** Arrow element; gets `--arrow-x` / `--arrow-y` written to it. Pass a null ref when `withArrow` is false. */ arrowRef: RefObject; /** * Give the panel at least the trigger's width, for a list that lines up with * the field it belongs to. A minimum rather than a fixed width: a menu on a * narrow icon button still sizes to its own content. */ matchTriggerWidth?: boolean; /** * When the panel does not fit on the side its alignment puts it, narrow it * rather than sliding it away from the trigger. Sliding keeps the panel * on-screen but detaches it: an end-aligned bubble stops ending where its * trigger ends, and its arrow stops pointing at anything. Off by default, since * a panel whose width is its content, a menu or a list, would rather overhang * its trigger than wrap. * * Only down to `MIN_SHRINK_WIDTH`. Past that the panel is narrower than it is * readable, and a trigger that close to the screen edge is better served by a * panel that overhangs it. */ shrinkToFit?: boolean; /** * Called when a newly opened panel first becomes visible. Focus has to wait for it: a panel * still hidden, waiting out an ancestor's animation, takes none. */ onShown?: () => void; } /** * Positions a portaled, `position: fixed` popover on any of the four sides of its trigger with * start/center/end cross-axis alignment. Flips to the opposite side when the preferred one has no * room, shifts back on-screen along the cross axis, points the arrow at the trigger centre, and * hides (not closes) the panel once the trigger scrolls behind a clipping ancestor. * * `useAnchorTracking` supplies the lifecycle around this: mount wait, ancestor resolution, and * re-running on scroll, viewport resize and panel size changes. */ export declare function usePopoverPosition({ isOpen, placement, align, offset, triggerRef, floatingRef, panelRef, arrowRef, matchTriggerWidth, shrinkToFit, onShown, }: UsePopoverPositionArgs): void;