import * as i0 from '@angular/core'; import { OnInit, OnDestroy, ElementRef, EventEmitter, Renderer2 } from '@angular/core'; import { Placement, Strategy } from '@floating-ui/dom'; import * as i1 from '@kirbydesign/designsystem/shared/portal'; import { PortalDirective } from '@kirbydesign/designsystem/shared/portal'; type TriggerEvent = 'hover' | 'click' | 'focus'; declare enum FloatingOffset { none = 0, small = 4, medium = 8 } declare enum OutletSelector { tag = "tag", id = "id", class = "class", name = "name" } interface PortalOutletConfig { selector: OutletSelector; value: string; } /** * @summary FloatingDirective is a utility that lets you declarative anchor "popup" containers to another element. * * Uses floating-ui, with this directive wraps the functionality: https://floating-ui.com/docs/getting-started * * Uses PortalDirective to enable functionality for portaling the floated content. This should be used when needed * and not as the default option. */ declare class FloatingDirective implements OnInit, OnDestroy { private elementRef; private renderer; private portalDirective; /** * Reference to the element for which the host should anchor to * */ set reference(ref: ElementRef | undefined); get reference(): ElementRef | undefined; /** * How the host should be placed relative to the reference. Can be affected by middleware * */ set placement(placement: Placement); get placement(): Placement; /** * The strategy for how the host should be positioned. * */ set strategy(strategy: Strategy); get strategy(): Strategy; /** * Defines when the host should be displayed/hidden, i.e. click will attach a click listener to the reference * that makes the host toggle display. Supports multiple triggers, to provide functionality for combinations * like click/focus. * */ set triggers(eventTriggers: Array); get triggers(): Array; /** * The HTMLElement for which the content should portal into. * Providing an outlet enables the portal, if nothing is provided, the provided strategy is used. * This should be used when there's issues with the stacking context, and not as a default option. * */ set DOMPortalOutlet(outlet: HTMLElement | undefined); get DOMPortalOutlet(): HTMLElement | undefined; /** * Defines how to automatically find and assign DOMPortalOutlet if none is provided in DOMPortalOutlet. * If nothing is provided here and in DOMPortalOutlet, the provided strategy is used * */ set portalOutletConfig(config: PortalOutletConfig | undefined); get portalOutletConfig(): PortalOutletConfig | undefined; /** * Prevent host from being toggled if set. * */ isDisabled: boolean; /** * Displaces the floating element from its core placement along the specified axes. * */ offset: FloatingOffset; /** * Moves the floating element along the specified axes in order to keep it in view. * This does not always work as expected, so don't "just" set it. * */ shift: boolean; /** * Chooses the placement that has the most space available automatically. * */ autoPlacement: boolean; /** * Enables hiding the host by events. See variable names. * */ closeOnSelect: boolean; closeOnEscapeKey: boolean; closeOnBackdrop: boolean; /** * Enables the option to be notified when the host changes display. The new display value is provided. * */ displayChanged: EventEmitter; onEscapeKeyPressed(): void; private _placement; private _strategy; private _providedPortalOutlet; private _portalOutletConfig; private _triggers; private _reference; private autoUpdaterRef; private isShown; private disposeTriggerEventListeners; private disposeDocumentClickListener; private disposeHostClickListener; private triggerEventMap; private HTMLElements; constructor(elementRef: ElementRef, renderer: Renderer2, portalDirective: PortalDirective); ngOnInit(): void; show(): void; hide(): void; toggleShow(): void; private addFloatStylingToHostElement; private setDisplayStyling; private updateHostElementPosition; private getMiddlewareConfig; private autoUpdatePosition; private setPositionStylingOnHostElement; private setupEventHandling; private attachDocumentClickEventHandler; private attachHostClickEventHandler; private attachTriggerEventToReferenceElement; private handleClickInsideHostElement; private handleClickOutsideHostElement; private getOutletElement; private getHTMLElements; private tearDownReferenceElementEventHandling; private tearDownDocumentClickEventHandling; private removeAutoUpdaterRef; ngOnDestroy(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } export { FloatingDirective, FloatingOffset, OutletSelector }; export type { PortalOutletConfig, TriggerEvent }; //# sourceMappingURL=kirbydesign-designsystem-shared-floating.d.ts.map