import { Directionality } from '@angular/cdk/bidi'; import { BooleanInput, NumberInput } from '@angular/cdk/coercion'; import { ConnectedPosition, OriginConnectionPosition, Overlay, OverlayConnectionPosition, OverlayRef, ScrollStrategy } from '@angular/cdk/overlay'; import { AfterViewInit, InjectionToken, OnDestroy } from '@angular/core'; import { UiTooltipComponent } from './ui-tooltip.component'; import * as i0 from "@angular/core"; /** Possible positions for a tooltip. */ export type TooltipPosition = 'end' | 'start' | 'top' | 'bottom' | 'before' | 'after'; /** * Options for how the tooltip trigger should handle touch gestures. * See `MatTooltip.touchGestures` for more information. */ export type TooltipTouchGestures = 'auto' | 'on' | 'off'; /** Possible visibility states of a tooltip. */ export type TooltipVisibility = 'initial' | 'visible' | 'hidden'; /** Time in ms to throttle repositioning after scroll events. */ export declare const SCROLL_THROTTLE_MS = 20; /** Injection token that determines the scroll handling while a tooltip is visible. */ export declare const MAT_TOOLTIP_SCROLL_STRATEGY: InjectionToken<() => ScrollStrategy>; /** @docs-private */ export declare function MAT_TOOLTIP_SCROLL_STRATEGY_FACTORY(overlay: Overlay): () => ScrollStrategy; /** @docs-private */ export declare const MAT_TOOLTIP_SCROLL_STRATEGY_FACTORY_PROVIDER: { provide: InjectionToken<() => ScrollStrategy>; deps: (typeof Overlay)[]; useFactory: typeof MAT_TOOLTIP_SCROLL_STRATEGY_FACTORY; }; /** @docs-private */ export declare function MAT_TOOLTIP_DEFAULT_OPTIONS_FACTORY(): MatTooltipDefaultOptions; /** Injection token to be used to override the default options for `matTooltip`. */ export declare const MAT_TOOLTIP_DEFAULT_OPTIONS: InjectionToken; /** Default `matTooltip` options that can be overridden. */ export interface MatTooltipDefaultOptions { /** Default delay when the tooltip is shown. */ showDelay: number; /** Default delay when the tooltip is hidden. */ hideDelay: number; /** Default delay when hiding the tooltip on a touch device. */ touchendHideDelay: number; /** Time between the user putting the pointer on a tooltip trigger and the long press event being fired on a touch device. */ touchLongPressShowDelay?: number; /** Default touch gesture handling for tooltips. */ touchGestures?: TooltipTouchGestures; /** Default position for tooltips. */ position?: TooltipPosition; /** * Default value for whether tooltips should be positioned near the click or touch origin * instead of outside the element bounding box. */ positionAtOrigin?: boolean; /** Disables the ability for the user to interact with the tooltip element. */ disableTooltipInteractivity?: boolean; /** * Default classes to be applied to the tooltip. These default classes will not be applied if * `tooltipClass` is defined directly on the tooltip element, as it will override the default. */ tooltipClass?: string | string[]; } /** * CSS class that will be attached to the overlay panel. * @deprecated * @breaking-change 13.0.0 remove this variable */ export declare const TOOLTIP_PANEL_CLASS = "mat-mdc-tooltip-panel"; /** * Directive that attaches a material design tooltip to the host element. Animates the showing and * hiding of a tooltip provided position (defaults to below the element). * * https://material.io/design/components/tooltips.html */ export declare class TooltipDirective implements OnDestroy, AfterViewInit { private _overlay; private _elementRef; private _scrollDispatcher; private _viewContainerRef; private _ngZone; private _platform; private _ariaDescriber; private _focusMonitor; protected _dir: Directionality; private _injector; private _defaultOptions; _overlayRef: OverlayRef | null; _tooltipInstance: UiTooltipComponent | null; private _portal; private _position; private _positionAtOrigin; private _disabled; private _tooltipClass; private _scrollStrategy; private _viewInitialized; private _pointerExitEventsInitialized; private readonly _tooltipComponent; private _viewportMargin; private _currentPosition; private readonly _cssClassPrefix; private _ariaDescriptionPending; offsetX: number; inverseColor?: boolean; /** Allows the user to define the position of the tooltip relative to the parent element */ get position(): TooltipPosition; set position(value: TooltipPosition); /** * Whether tooltip should be relative to the click or touch origin * instead of outside the element bounding box. */ get positionAtOrigin(): boolean; set positionAtOrigin(value: BooleanInput); /** Disables the display of the tooltip. */ get disabled(): boolean; set disabled(value: BooleanInput); /** The default delay in ms before showing the tooltip after show is called */ get showDelay(): number; set showDelay(value: NumberInput); private _showDelay; /** The default delay in ms before hiding the tooltip after hide is called */ get hideDelay(): number; set hideDelay(value: NumberInput); private _hideDelay; /** * How touch gestures should be handled by the tooltip. On touch devices the tooltip directive * uses a long press gesture to show and hide, however it can conflict with the native browser * gestures. To work around the conflict, Angular Material disables native gestures on the * trigger, but that might not be desirable on particular elements (e.g. inputs and draggable * elements). The different values for this option configure the touch event handling as follows: * - `auto` - Enables touch gestures for all elements, but tries to avoid conflicts with native * browser gestures on particular elements. In particular, it allows text selection on inputs * and textareas, and preserves the native browser dragging on elements marked as `draggable`. * - `on` - Enables touch gestures for all elements and disables native * browser gestures with no exceptions. * - `off` - Disables touch gestures. Note that this will prevent the tooltip from * showing on touch devices. */ touchGestures: TooltipTouchGestures; /** The message to be displayed in the tooltip */ get message(): string; set message(value: string | null | undefined); private _message; /** Classes to be passed to the tooltip. Supports the same syntax as `ngClass`. */ get tooltipClass(): string | string[] | Set | { [key: string]: any; }; isError: boolean; set tooltipClass(value: string | string[] | Set | { [key: string]: any; }); /** Manually-bound passive event listeners. */ private readonly _passiveListeners; /** Reference to the current document. */ private _document; /** Timer started at the last `touchstart` event. */ private _touchstartTimeout; /** Emits when the component is destroyed. */ private readonly _destroyed; constructor(...args: unknown[]); 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, origin?: { x: number; y: 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(origin?: { x: number; y: number; }): void; /** Returns true if the tooltip is currently visible to the user */ _isTooltipVisible(): boolean; /** 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; /** Adds the configured offset to a position. Used as a hook for child classes. */ protected _addOffset(position: ConnectedPosition): ConnectedPosition; /** * Returns the origin position and a fallback position based on the user's position preference. * The fallback position is the inverse of the origin (e.g. `'below' -> 'above'`). */ _getOrigin(): { main: OriginConnectionPosition; fallback: OriginConnectionPosition; }; /** Returns the overlay position and a fallback position based on the user's preference */ _getOverlayPosition(): { main: OverlayConnectionPosition; fallback: OverlayConnectionPosition; }; /** Updates the tooltip message and repositions the overlay according to the new message length */ private _updateTooltipMessage; /** Updates the tooltip class */ private _setTooltipClass; /** Updates the tooltip error state */ private _setTooltipErrorState; /** Updates the tooltip color */ private _setTooltipInversState; /** Inverts an overlay position. */ private _invertPosition; /** Updates the class on the overlay panel based on the current position of the tooltip. */ private _updateCurrentPositionClass; /** Binds the pointer events to the tooltip trigger. */ private _setupPointerEnterEventsIfNeeded; private _setupPointerExitEventsIfNeeded; private _addListeners; private _platformSupportsMouseEvents; /** Listener for the `wheel` event on the element. */ private _wheelListener; /** Disables the native browser gestures, based on how the tooltip has been configured. */ private _disableNativeGesturesIfNecessary; /** Updates the tooltip's ARIA description based on it current state. */ private _syncAriaDescription; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; }