import * as i0 from '@angular/core'; import { OnInit, OnChanges, OnDestroy, Injector, ElementRef } from '@angular/core'; import { Strategy, VirtualElement } from '@floating-ui/dom'; import { Position, Side, NgChanges } from '@odx/angular/utils'; import { Observable, Subject } from 'rxjs'; import { DynamicContent, DynamicViewRef, DynamicViewRenderingOptions } from '@odx/angular/cdk/dynamic-view'; interface ConnectedOverlayOptions { content?: DynamicContent | null; context?: Record; containerClass?: string | null; hiddenClass: string | null; enableFallback: boolean; fallbackAxisSideDirection: 'start' | 'end'; matchReferenceWidth: boolean; minHeight?: number | null; offset: number; outerPadding: number; position: Position; strategy: Strategy; showArrow?: boolean; updateOnAnimationFrame?: boolean; nonInteractive?: boolean; hooks?: { beforeOpen?: () => void; afterOpen?: () => void; beforeClose?: () => void; afterClose?: () => void; }; } declare const DefaultConnectedOverlayOptions: ConnectedOverlayOptions; /** * A reference to a connected overlay created by the `ConnectedOverlayService`. This class provides methods to interact * with the overlay, such as updating its options or closing it. It encapsulates the `DynamicViewRef` for the overlay's instance, * allowing for direct manipulation of the overlay's state and behavior. * * This example demonstrates how to use a `ConnectedOverlayRef` to update and close a connected overlay in response * to user interactions. * * @example * ```ts * class MyComponent { * private overlayRef?: ConnectedOverlayRef; * * constructor(private overlayService: ConnectedOverlayService) {} * * openOverlay() { * this.overlayRef = this.overlayService.createOverlay(this.someElementRef.nativeElement, { position: 'bottom' }); * } * * updateOverlayPosition() { * if (this.overlayRef) { * this.overlayRef.update({ position: 'top' }); * } * } * * closeOverlay() { * this.overlayRef?.close(); * } * } * ``` * * In this example, `MyComponent` uses the `ConnectedOverlayService` to create an overlay. It stores a reference to * the created overlay in `overlayRef`, allowing it to update the overlay's position or close it when necessary. */ declare class ConnectedOverlayRef { private readonly dynamicViewRef; readonly element: Element; /** * An Observable that emits when the overlay is closed. * * @emits {void} - Emits when the overlay is closed. * */ readonly onClose$: Observable; constructor(dynamicViewRef: DynamicViewRef); /** * Updates the connected overlay with new options. * * @param options {Partial} - The new options to be applied to the connected overlay. */ update(options: Partial): void; /** * Closes the connected overlay. * * @returns {void} */ close(force?: boolean): Promise; } declare class ConnectedOverlayComponent implements OnInit, OnChanges, OnDestroy { private readonly zone; private positionUpdater; protected readonly injector: Injector; protected overlaySide?: Side; protected contentElement: ElementRef; protected arrowElement: ElementRef; readonly element: ElementRef; referenceElement: VirtualElement; options: ConnectedOverlayOptions; closed: Subject; ngOnInit(): void; ngOnChanges(changes: NgChanges): void; ngOnDestroy(): void; private startPositionUpdater; private stopPositionUpdater; private updatePosition; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } /** * Service for creating and managing connected overlays. These overlays are UI elements such as popovers, tooltips, * or dropdown menus that are positioned relative to a reference element in the DOM. This service leverages the `DynamicViewService` * for dynamic component rendering and provides a streamlined API for creating overlays with custom positioning and options. * * Use the `ConnectedOverlayService` to dynamically create an overlay next to a specific element in your Angular application. * This example demonstrates creating a connected overlay next to a button element when the button is clicked. * * @example * ```ts * import { Component, ElementRef, ViewChild } from '@angular/core'; * import { ConnectedOverlayService, ConnectedOverlayOptions } from '@odx/angular/cdk/connected-overlay'; * * @Component({ * selector: 'app-example', * template: ``, * }) * class AppComponent { * @ViewChild('triggerElement') triggerElementRef!: ElementRef; * * constructor(private connectedOverlayService: ConnectedOverlayService) {} * * showOverlay(): void { * const options: Partial = { * position: 'bottom-start', * showArrow: true, * content: 'Hello, world!', * }; * * this.connectedOverlayService.createOverlay(this.triggerElementRef.nativeElement, options); * } * } * ``` * * This service simplifies the process of creating dynamic, positionally aware overlays that enhance the interactivity * and visual appeal of Angular applications. */ declare class ConnectedOverlayService { private readonly dynamicViewService; /** * Creates a connected overlay. * @param referenceElement - The reference element to which the overlay will be connected. * @param options - Optional configuration for the connected overlay. * @param renderingOptions - Optional rendering options for the connected overlay. * @returns {ConnectedOverlayRef} The created Connected Overlay reference instance. */ createOverlay(referenceElement: VirtualElement, options?: Partial, renderingOptions?: Partial): ConnectedOverlayRef; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } export { ConnectedOverlayComponent, ConnectedOverlayRef, ConnectedOverlayService, DefaultConnectedOverlayOptions }; export type { ConnectedOverlayOptions };