import { AXComponentOptions, AXComponentContent } from '@acorex/core/components'; import { AXPlacementType, AXPlacement, AXConnectedPosition } from '@acorex/cdk/common'; import { AXZToken } from '@acorex/core/z-index'; import * as i0 from '@angular/core'; import { ElementRef, EmbeddedViewRef, ComponentRef } from '@angular/core'; interface AXOverlayRef { instance: EmbeddedViewRef | ComponentRef; /** Updates the overlay position relative to the anchor */ updatePosition: () => void; /** Destroys the overlay and removes it from the DOM */ dispose: () => void; /** The overlay container element */ overlayElement: HTMLElement | null; /** The z-index token for this overlay */ zToken: AXZToken | null; /** Brings this overlay to the front of all other overlays */ bringToFront: () => void; } interface AXOverlayAnchorOptions { /** The anchor element to position relative to */ anchor: HTMLElement | ElementRef; /** Placement of the overlay relative to the anchor */ placement?: AXPlacementType; /** Horizontal offset in pixels */ offsetX?: number; /** Vertical offset in pixels */ offsetY?: number; /** Whether to flip the overlay when it overflows the viewport */ autoFlip?: boolean; } interface AXOverlayOptions extends AXComponentOptions { backdrop?: { enabled?: boolean; background?: boolean; backdropClass?: string; closeOnClick?: boolean; }; position?: AXPlacement; /** Anchor-based positioning options for tooltips, popovers, etc. */ anchorOptions?: AXOverlayAnchorOptions; /** Custom CSS class for the overlay panel */ panelClass?: string | string[]; /** Whether to close when clicking outside */ closeOnOutsideClick?: boolean; /** Whether to close when pressing Escape */ closeOnEscape?: boolean; /** Width of the overlay container (e.g., 'auto', '200px', '100%') */ width?: string; /** Callback when the overlay is disposed (e.g., due to scroll) */ onDispose?: () => void; /** Whether to use centered container (default: true). Set to false for positioned overlays like toasts */ centered?: boolean; actionSheetStyle?: boolean; } /** * Calculates the position of an overlay element relative to an anchor element. */ declare function calculateAnchorPosition(anchorRect: DOMRect, overlayRect: DOMRect, position: AXConnectedPosition): { top: number; left: number; }; /** * Checks if the overlay position fits within the viewport. */ declare function fitsInViewport(position: { top: number; left: number; }, overlayRect: DOMRect, viewportWidth: number, viewportHeight: number): boolean; /** * Clamps a position to ensure the overlay stays within viewport bounds. */ declare function clampToViewport(coords: { top: number; left: number; }, overlayRect: DOMRect, viewportWidth: number, viewportHeight: number, margin?: number): { top: number; left: number; }; /** * Finds the best position for an overlay that fits in the viewport. */ declare function findBestPosition(anchorRect: DOMRect, overlayRect: DOMRect, positions: AXConnectedPosition[], viewportWidth: number, viewportHeight: number): { position: AXConnectedPosition; coords: { top: number; left: number; }; }; declare class AXOverlayService { private componentService; private document; private zIndexService; private _platform; /** * Creates an overlay with optional anchor-based positioning. * @param content - Component or template to display * @param options - Configuration options for the overlay * @returns Promise - Reference to the created overlay */ create(content: AXComponentContent, options?: AXOverlayOptions): Promise>; /** * Creates a backdrop element. */ private createBackdrop; /** * Creates a centered overlay container (for modals/popups). */ private createCenteredOverlayContainer; /** * Gets the host element from a ComponentRef or EmbeddedViewRef. */ private getHostElement; /** * Creates an overlay container element and appends the content to it. */ private createOverlayContainer; /** * Positions the overlay container relative to the anchor element. */ private positionOverlay; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } export { AXOverlayService, calculateAnchorPosition, clampToViewport, findBestPosition, fitsInViewport }; export type { AXOverlayAnchorOptions, AXOverlayOptions, AXOverlayRef };