import { CSSObject } from '@codecademy/variance'; import { Alignments, PopoverPositionConfig, TargetRef } from './types'; export interface PopoverPositionResult { /** Edge insets pinning the popover to the container (`left` / `right` / `top` / `bottom`). */ styles: CSSObject; /** * Direction-neutral transforms/coords—semantic mirroring happens first via * {@link mirrorAlignment}; merged after `styles`. */ dirNeutralStyles?: CSSObject; } /** * Mirrors placement on the inline axis when the target is RTL so e.g. `bottom-left` * uses the same geometry as `bottom-right` in LTR. */ export declare const mirrorAlignment: (alignment: Alignments, isRtl: boolean) => Alignments; export declare const findResizingParent: (element: HTMLElement) => HTMLElement | null; /** * Finds all scrolling parents of an element. * This is useful for detecting scroll events on parents that may not be the direct parent. * Window scroll is handled separately by react-use's useWindowScroll. */ export declare const findAllAdditionalScrollingParents: (element: HTMLElement) => HTMLElement[]; /** * Determines if an element is out of view, checking both the window viewport * and all scrollable parent containers. Returns true if the element is completely * outside the visible area of any containing scrollable parent or the window viewport. * Used by closeOnViewportExit to detect when the target element has scrolled out of view. * @param rect - The DOMRect of the target element * @param target - The target element (optional) * @param cachedScrollingParents - Pre-computed list of scrolling parents to avoid expensive DOM traversals (optional) */ export declare const isOutOfView: (rect: DOMRect, target?: HTMLElement | null, cachedScrollingParents?: HTMLElement[]) => boolean; export declare const ALIGN: { readonly top: "bottom"; readonly right: "left"; readonly bottom: "top"; readonly left: "right"; }; /** * Computes the absolute position styles for a popover relative to a target element. * * When `isRtl` is true, {@link mirrorAlignment} maps the requested placement to the * mirrored corner/edge on the inline axis before computing offsets (same viewport math * as LTR). * * Returns two fragments that callers merge into inline `style` (they are not Gamut variance * props on the host, so nothing here is swapped to logical properties via `system.positioning`). * * - `styles`: corner/edge inset lengths (`left` / `right` / `top` / `bottom`). * - `dirNeutralStyles`: transforms/coords not further remapped for RTL/logical placement * after {@link mirrorAlignment}; merged after `styles`. */ export declare const getPosition: ({ alignment, container, offset, x, y, invertAxis, isRtl, }: PopoverPositionConfig & { isRtl?: boolean; }) => PopoverPositionResult; export declare const getContainers: (target: TargetRef, inline: boolean | undefined, scroll: { x: number; y: number; }) => { viewport: DOMRect; parent: { width: number; height: number; top: number; left: number; right: number; bottom: number; }; } | { parent: DOMRect; viewport: DOMRect; };