export type FloatingSide = 'top' | 'bottom' | 'left' | 'right'; export type FloatingAlign = 'start' | 'center' | 'end'; /** An element, or a point of the viewport (the position of a pointer event) */ export type FloatingAnchor = HTMLElement | { x: number; y: number; }; export interface FloatingOptions { anchor: FloatingAnchor | null | undefined; /** false hides the element without removing it (default true) */ open?: boolean; side?: FloatingSide; align?: FloatingAlign; /** space between the anchor and the floating element, in px */ offset?: number; /** minimal space between the floating element and the edges of the viewport, in px */ padding?: number; /** moves to the opposite side when there is not enough space */ flip?: boolean; } export interface FloatingRect { top: number; right: number; bottom: number; left: number; width: number; height: number; } export interface FloatingPosition { x: number; y: number; side: FloatingSide; /** position of the center of the anchor along the floating element, for an arrow */ arrow: number; } /** * computeFloating - The position of a floating element next to an anchor (pure function). * @param anchor - The rect of the anchor, in the viewport. * @param size - The size of the floating element (offsetWidth / offsetHeight: not affected by a transform). * @param viewport - The size of the viewport, without the scrollbars. */ export declare function computeFloating(anchor: FloatingRect, size: { width: number; height: number; }, viewport: { width: number; height: number; }, { side, align, offset, padding, flip }?: Omit): FloatingPosition; /** * floating - Shows an element in the top layer (Popover API) next to its anchor, and keeps it there. * The element needs the popover attribute. It gets its position (left / top), its side (data-side) * and the position of the arrow (--kit-floating-arrow). * It follows the scroll of every ancestor, the resize of the viewport and the size of both elements. */ export declare function floating(node: HTMLElement, options: FloatingOptions): { update(next: FloatingOptions): void; destroy(): void; };