import { AnimationEvent, AnimationTriggerMetadata } from '@angular/animations'; import * as i0 from '@angular/core'; import { InjectionToken, OnDestroy, OnInit, AfterViewInit, ElementRef, ViewContainerRef, NgZone, ChangeDetectorRef } from '@angular/core'; import { Observable } from 'rxjs'; import * as i1 from '@angular/cdk/a11y'; import { AriaDescriber, FocusMonitor } from '@angular/cdk/a11y'; import { Directionality, Direction } from '@angular/cdk/bidi'; import { BooleanInput } from '@angular/cdk/coercion'; import * as i3 from '@angular/cdk/overlay'; import { ScrollStrategy, Overlay, OverlayRef, OriginConnectionPosition, OverlayConnectionPosition } from '@angular/cdk/overlay'; import { Platform } from '@angular/cdk/platform'; import { ScrollDispatcher } from '@angular/cdk/scrolling'; import * as i2 from '@angular/common'; /** * Possible positions of the tooltip. */ type TooltipPosition = TooltipVerticalPosition | TooltipHorizontalPosition; type TooltipHorizontalPosition = 'left' | 'right'; type TooltipVerticalPosition = 'top' | 'bottom'; /** Injection token that determines the scroll handling while a tooltip is open. */ declare const NX_TOOLTIP_SCROLL_STRATEGY: InjectionToken<() => ScrollStrategy>; /** * @docs-private * @deprecated No longer used. * @deletion-target 18.0.0 */ declare function NX_TOOLTIP_SCROLL_STRATEGY_PROVIDER_FACTORY(overlay: Overlay): () => ScrollStrategy; /** * @docs-private * @deprecated No longer used. * @deletion-target 18.0.0 */ declare const NX_TOOLTIP_SCROLL_STRATEGY_PROVIDER: { provide: InjectionToken<() => ScrollStrategy>; useFactory: typeof NX_TOOLTIP_SCROLL_STRATEGY_PROVIDER_FACTORY; deps: (typeof Overlay)[]; }; /** * CSS class that will be attached to the overlay panel. * @docs-private */ declare const NX_TOOLTIP_PANEL_CLASS = "nx-tooltip-panel"; /** * Creates an error to be thrown if the user provided an invalid tooltip position. * @docs-private */ declare function getNxTooltipInvalidPositionError(position: string): Error; /** Default `nxTooltip` options that can be overridden. */ interface NxTooltipDefaultOptions { /** The default delay in ms before showing the tooltip after show is called */ showDelay: number; /** The default delay in ms before hiding the tooltip after hide is called */ hideDelay: number; /** The default delay in ms before hiding the tooltip on touch devices */ touchendHideDelay: number; /** The default position of the tooltip */ position?: TooltipPosition; } /** Injection token to be used to override the default options for `nxTooltip`. */ declare const NX_TOOLTIP_DEFAULT_OPTIONS: InjectionToken; declare function NX_TOOLTIP_DEFAULT_OPTIONS_FACTORY(): NxTooltipDefaultOptions; /** * Directive that attaches a tooltip to the host element. * */ declare class NxTooltipDirective implements OnDestroy, OnInit, AfterViewInit { private readonly _overlay; private readonly _elementRef; private readonly _scrollDispatcher; private readonly _viewContainerRef; private readonly _ngZone; private readonly _ariaDescriber; private readonly _focusMonitor; private readonly _dir; private readonly _defaultOptions; private readonly _defaultScrollStrategyFactory; _overlayRef: OverlayRef | null; _tooltipInstance: NxTooltipComponent | null; private _injector; private _portal; private _embeddedViewRef; private readonly _possibleTooltipPositions; /** Allows the user to define the position of the tooltip relative to the parent element */ set position(value: TooltipPosition); get position(): TooltipPosition; private _position; /** Disables the display of the tooltip. */ set disabled(value: BooleanInput); get disabled(): boolean; private _disabled; /** * Allow selection of text within tooltip trigger. * * NOTE: inputs and textareas always remain selectable, ignoring this input. */ set selectable(value: BooleanInput); get selectable(): boolean; private _selectable; /** The default delay in ms before showing the tooltip after show is called */ showDelay: number; /** The default delay in ms before hiding the tooltip after hide is called */ hideDelay: number; /** The message to be displayed in the tooltip */ set message(value: string); get message(): string; private _message; /** Strategy factory that will be used to handle scrolling while the tooltip panel is open. */ private readonly _scrollStrategyFactory; private readonly _manualListeners; private readonly _destroyed; constructor(_overlay: Overlay, _elementRef: ElementRef, _scrollDispatcher: ScrollDispatcher, _viewContainerRef: ViewContainerRef, _ngZone: NgZone, platform: Platform, _ariaDescriber: AriaDescriber, _focusMonitor: FocusMonitor, _dir: Directionality | null, _defaultOptions: NxTooltipDefaultOptions | null, _defaultScrollStrategyFactory: () => ScrollStrategy); ngOnInit(): void; ngAfterViewInit(): void; /** * Dispose the tooltip when destroyed. */ ngOnDestroy(): void; /** Shows the tooltip after the delay in ms, defaults to tooltip-delay-show or 0ms if no input */ show(delay?: number): void; /** Hides the tooltip after the delay in ms, defaults to tooltip-delay-hide or 0ms if no input */ hide(delay?: number): void; /** Shows/hides the tooltip */ toggle(): void; /** Returns true if the tooltip is currently visible to the user */ _isTooltipVisible(): boolean; /** Handles the keydown events on the host element. */ _handleKeydown(e: KeyboardEvent): void; /** Handles the touchend events on the host element. */ _handleTouchend(): void; /** * Setup styling-specific things. */ _updateSelectabilityStyles(): void; /** Create the overlay config and position strategy */ private _createOverlay; /** Detaches the currently-attached tooltip. */ private _detach; /** Updates the position of the current tooltip. */ private _updatePosition; /** * Returns the origin position based on the user's position preference. */ _getOrigin(position: TooltipPosition): OriginConnectionPosition; /** Returns the overlay position based on the user's preference */ _getOverlayPosition(position: TooltipPosition): OverlayConnectionPosition; /** Returns the overlay offset required by the user's position preference */ private _getOffset; /** Returns the opposite position, using aquila tooltip position naming: top, right, bottom, left */ private _getInverseTooltipPosition; /** Returns the opposite position, using angular position naming: top, bottom, start, end, center */ private _getInversePosition; /** * Returns an array of fallback positions for tooltip, following the algoritm: * 1) Slightly alternate preferred position if applicable. I.e. for 'top' try 'top-start' and 'top-end' positioning. * 2) Try the opposite position, i.e. for 'top' try 'bottom'. * 3) Slightly alternate opposite position, i.e. 'bottom-start', 'bottom-end'. * 4) All remaining positions from positions list. */ private _getFallbackPositions; /** Calculates fallbacks for vertical tooltip positioning */ private _getVerticalFallbackPositionPairs; /** Calculates fallbacks for horizontal tooltip positioning */ private _getHorizontalFallbackPositionPairs; /** Updates the tooltip message and repositions the overlay according to the new message length */ private _updateTooltipMessage; private _positionArrow; _dirChangeHandler(value: Direction): void; get _isLtr(): boolean; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } type TooltipVisibility = 'initial' | 'visible' | 'hidden'; /** * Internal component that wraps the tooltip's content. * @docs-private */ declare class NxTooltipComponent implements OnDestroy { private readonly _cdr; readonly elementRef: ElementRef; private _liveAnnouncer; /** The timeout ID of any current timer set to show the tooltip */ private _showTimeoutId; /** The timeout ID of any current timer set to hide the tooltip */ private _hideTimeoutId; /** Message to display in the tooltip */ private _message; set message(value: string); get message(): string; private _visibility; /** Property watched by the animation framework to show or hide the tooltip */ get visibility(): TooltipVisibility; private _position; /** @docs-private */ set position(value: TooltipPosition); /** @docs-private */ get position(): TooltipPosition; _arrowStyle: { [key: string]: string; }; /** @docs-private */ set arrowStyle(value: { [key: string]: string; }); /** @docs-private */ get arrowStyle(): { [key: string]: string; }; /** @docs-private */ get arrowClass(): string; /** Whether interactions on the page should close the tooltip */ private _closeOnInteraction; /** Subject for notifying that the tooltip has been hidden from the view */ private readonly _onHide; constructor(_cdr: ChangeDetectorRef, elementRef: ElementRef); /** * Shows the tooltip with an aninxion originating from the provided origin * @param delay Amount of milliseconds to the delay showing the tooltip. */ show(delay: number): void; /** * Begins the animation to hide the tooltip after the provided delay in ms. * @param delay Amount of milliseconds to delay showing the tooltip. */ hide(delay: number): void; /** Returns an observable that notifies when the tooltip has been hidden from view. */ afterHidden(): Observable; /** Whether the tooltip is being displayed. */ isVisible(): boolean; /** Whether the tooltip started a delay to be shown/hidden */ isDelayed(): boolean; ngOnDestroy(): void; _animationStart(): void; _animationDone(event: AnimationEvent): void; /** * Interactions on the HTML body should close the tooltip immediately. */ _handleBodyInteraction(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class NxTooltipModule { static ɵfac: i0.ɵɵFactoryDeclaration; static ɵmod: i0.ɵɵNgModuleDeclaration; static ɵinj: i0.ɵɵInjectorDeclaration; } /** * Animations used by NxTooltip. * @docs-private */ declare const nxTooltipAnimations: { readonly tooltipState: AnimationTriggerMetadata; }; export { NX_TOOLTIP_DEFAULT_OPTIONS, NX_TOOLTIP_DEFAULT_OPTIONS_FACTORY, NX_TOOLTIP_PANEL_CLASS, NX_TOOLTIP_SCROLL_STRATEGY, NX_TOOLTIP_SCROLL_STRATEGY_PROVIDER, NX_TOOLTIP_SCROLL_STRATEGY_PROVIDER_FACTORY, NxTooltipComponent, NxTooltipDirective, NxTooltipModule, getNxTooltipInvalidPositionError, nxTooltipAnimations }; export type { NxTooltipDefaultOptions, TooltipHorizontalPosition, TooltipPosition, TooltipVerticalPosition };