import * as i0 from '@angular/core'; import { InjectionToken, OnDestroy, AfterViewInit, TemplateRef, EventEmitter, ElementRef, OnInit, OnChanges, SimpleChanges } from '@angular/core'; import * as i1$1 from '@angular/cdk/a11y'; import { ConfigurableFocusTrapFactory, FocusOrigin } from '@angular/cdk/a11y'; import * as i2 from '@angular/cdk/overlay'; import { ScrollStrategy, Overlay, OverlayRef, ConnectedPosition } from '@angular/cdk/overlay'; import * as i1$2 from '@angular/cdk/portal'; import * as i1 from '@sbb-esta/angular/core'; import * as i3 from '@sbb-esta/angular/icon'; import { BooleanInput, NumberInput } from '@angular/cdk/coercion'; import { BreakpointState } from '@angular/cdk/layout'; import { Observable } from 'rxjs'; import * as i1$3 from '@angular/cdk/scrolling'; /** Possible positions for a tooltip. */ type TooltipPosition = 'left' | 'right' | 'above' | 'below'; /** * Options for how the tooltip trigger should handle touch gestures. * See `SbbTooltip.touchGestures` for more information. */ type TooltipTouchGestures = 'auto' | 'on' | 'off'; /** Possible visibility states of a tooltip. */ type TooltipVisibility = 'initial' | 'visible' | 'hidden'; /** Time in ms to throttle repositioning after scroll events. */ declare const SCROLL_THROTTLE_MS = 20; /** * Creates an error to be thrown if the user supplied an invalid tooltip position. * @docs-private */ declare function getSbbTooltipInvalidPositionError(position: string): Error; /** Injection token that determines the scroll handling while a tooltip is visible. */ declare const SBB_TOOLTIP_SCROLL_STRATEGY: InjectionToken<() => ScrollStrategy>; /** * @docs-private * @deprecated Will be removed in 22.0.0. * @breaking-change 22.0.0 */ declare function SBB_TOOLTIP_SCROLL_STRATEGY_FACTORY(overlay: Overlay): () => ScrollStrategy; /** * @docs-private * @deprecated Will be removed in 22.0.0. * @breaking-change 22.0.0 */ declare const SBB_TOOLTIP_SCROLL_STRATEGY_FACTORY_PROVIDER: { provide: InjectionToken<() => ScrollStrategy>; deps: (typeof Overlay)[]; useFactory: typeof SBB_TOOLTIP_SCROLL_STRATEGY_FACTORY; }; /** Default `sbbTooltip` options that can be overridden. */ interface SbbTooltipDefaultOptions { /** 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; /** Default touch gesture handling for tooltips. */ touchGestures?: TooltipTouchGestures; /** Whether the tooltip should focus the first focusable element on open. */ autoFocus?: boolean; /** * Whether the tooltip should restore focus to the * previously-focused element, after it's closed. */ restoreFocus?: boolean; /** Default position for tooltips. */ position?: TooltipPosition; /** Disables the ability for the user to interact with the tooltip element. */ disableTooltipInteractivity?: boolean; } /** Injection token to be used to override the default options for `sbbTooltip`. */ declare const SBB_TOOLTIP_DEFAULT_OPTIONS: InjectionToken; /** @docs-private */ declare function SBB_TOOLTIP_DEFAULT_OPTIONS_FACTORY(): SbbTooltipDefaultOptions; /** Tooltip event, which is emitted for certain events. */ declare class SbbTooltipChangeEvent { /** Instance of tooltip component. */ instance: SbbTooltip; constructor( /** Instance of tooltip component. */ instance: SbbTooltip); } /** * Directive that attaches a sbb design tooltip to the host element. Animates the showing and * hiding of a tooltip provided position (defaults to below the element). */ declare class SbbTooltip implements OnDestroy, AfterViewInit { private _overlay; private _elementRef; private _scrollDispatcher; private _injector; private _viewContainerRef; private _ngZone; private _platform; private _ariaDescriber; private _focusMonitor; private _defaultOptions; _overlayRef: OverlayRef | null; _tooltipInstance: TooltipComponent | null; private _portal; private _position; private _disabled; private _tooltipClass; private _scrollStrategy; private _viewInitialized; private _pointerExitEventsInitialized; private readonly _tooltipComponent; private _viewportMargin; private _currentPosition; private readonly _cssClassPrefix; private _ariaDescriptionPending; /** Allows the user to define the position of the tooltip relative to the parent element */ get position(): TooltipPosition; set position(value: TooltipPosition); /** * The trigger event, on which the tooltip opens. * This is primarily used for sbb-tooltip and should be used with care. */ trigger: 'click' | 'hover'; /** 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, sbb-angular 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 | TemplateRef; set message(value: string | TemplateRef); private _message; /** Classes to be passed to the tooltip. Supports the same syntax as `ngClass`. */ get tooltipClass(): string | string[] | Set | { [key: string]: any; }; set tooltipClass(value: string | string[] | Set | { [key: string]: any; }); /** Classes to be passed to the tooltip panel. Supports the same syntax as `ngClass`. */ tooltipPanelClass: 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; /** Whether ngOnDestroyed has been called. */ private _isDestroyed; /** Predefined tooltip positions. */ private readonly _tooltipPositions; /** Event emitted when the tooltip is opened. */ readonly opened: EventEmitter; /** Event emitted when the tooltip is closed. */ readonly dismissed: EventEmitter; constructor(...args: unknown[]); _preventClickBubbling(event: Event): 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; /** 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 overlay position and all fallback positions based on the user's preference. */ _getOverlayPositions(): ConnectedPosition[]; /** Updates the tooltip message and repositions the overlay according to the new message length */ private _updateTooltipMessage; /** Updates the tooltip class */ private _setTooltipClass; /** 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; } /** * Internal component that wraps the tooltip's content. * @docs-private */ declare class TooltipComponent implements OnDestroy { _elementRef: ElementRef; protected _focusTrapFactory: ConfigurableFocusTrapFactory; private _changeDetectorRef; private _focusMonitor; private _breakpointObserver; /** Stream that emits whether the user has a handset-sized display. */ _isHandset: Observable; /** Message to display in the tooltip */ message: string | TemplateRef; /** Classes to be added to the tooltip. Supports the same syntax as `ngClass`. */ tooltipClass: string | string[] | Set | { [key: string]: any; }; /** The timeout ID of any current timer set to show the tooltip */ _showTimeoutId: any; /** The timeout ID of any current timer set to hide the tooltip */ _hideTimeoutId: any; /** Element that caused the tooltip to open. */ _triggerElement: HTMLElement; /** Amount of milliseconds to delay the closing sequence. */ _mouseLeaveHideDelay: number; /** Reference to the internal tooltip element. */ _tooltip: ElementRef; get _templateRef(): TemplateRef | null; /** * Type of interaction that led to the tooltip being closed. This is used to determine * whether the focus style will be applied when returning focus to its original location * after the dialog is closed. */ _closeInteractionType: FocusOrigin | null; _config?: Pick; protected _document: Document; /** Whether animations are currently disabled. */ private _animationsDisabled; /** Whether interactions on the page should close the tooltip */ private _closeOnInteraction; /** The class that traps and manages focus within the tooltip. */ private _focusTrap; /** Element that was focused before the tooltip was opened. Save this to restore upon close. */ private _elementFocusedBeforeDialogWasOpened; /** Whether the tooltip is currently visible. */ private _isVisible; /** Subject for notifying that the tooltip has been shown in the view */ private readonly _onShow; /** Subject for notifying that the tooltip has been hidden from the view */ private readonly _onHide; /** Whether the tooltip component was triggered by click */ _triggeredByClick: boolean; /** Name of the show animation and the class that toggles it. */ private readonly _showAnimation; /** Name of the hide animation and the class that toggles it. */ private readonly _hideAnimation; constructor(...args: unknown[]); /** * Shows the tooltip with an animation 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 shown in the view. */ afterShown(): Observable; /** Returns an observable that notifies when the tooltip has been hidden from view. */ afterHidden(): Observable; /** Whether the tooltip is being displayed. */ isVisible(): boolean; ngOnDestroy(): void; /** * Interactions on the HTML body should close the tooltip immediately. */ _handleBodyInteraction(): void; /** Initializes the dialog container with the attached content. */ _initializeWithAttachedContent(): void; /** * Marks that the tooltip needs to be checked in the next change detection run. * Mainly used for rendering the initial text before positioning a tooltip, which * can be problematic in components with OnPush change detection. */ _markForCheck(): void; _handleMouseLeave({ relatedTarget }: MouseEvent): void; /** Event listener dispatched when an animation on the tooltip finishes. */ _handleAnimationEnd({ animationName }: AnimationEvent): void; /** Cancels any pending hiding sequences. */ _cancelPendingAnimations(): void; /** Handles the cleanup after an animation has finished. */ private _finalizeAnimation; /** Toggles the visibility of the tooltip element. */ private _toggleVisibility; /** Moves the focus inside the focus trap. */ protected _trapFocus(): void; /** Restores focus to the element that was focused before the dialog opened. */ protected _restoreFocus(): void; /** Sets up the focus trap. */ private _setupFocusTrap; /** Captures the element that was focused before the dialog was opened. */ private _capturePreviouslyFocusedElement; /** Focuses the dialog container. */ private _focusDialogContainer; /** Returns whether focus is inside the dialog. */ private _containsFocus; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare const _SbbTooltipWrapperMixinBase: i1.AbstractConstructor & { new (): {}; }; declare class SbbTooltipWrapper extends _SbbTooltipWrapperMixinBase implements OnInit, OnChanges, OnDestroy { /** Identifier of tooltip. */ id: string; /** The trigger event, on which the tooltip opens. */ trigger: 'click' | 'hover'; /** Customizations for show delay */ hoverShowDelay: number; /** Customizations for hide delay */ hoverHideDelay: number; position: TooltipPosition; private _destroyed; /** * The indicator icon, which will be shown as the tooltip indicator. * Must be a valid svgIcon input for sbb-icon. * * e.g. svgIcon="circle-question-mark-small" */ svgIcon: string; /** Whether the tooltip is disabled. */ disabled: boolean; /** Subject for the current icon. */ private _svgIconSubject; /** An observable of the current icon. */ _svgIcon: Observable; /** Classes to be passed to the tooltip. Supports the same syntax as `ngClass`. */ sbbTooltipClass: string | string[] | Set | { [key: string]: any; }; /** Classes to be passed to the tooltip panel. Supports the same syntax as `ngClass`. */ sbbTooltipPanelClass: string | string[] | Set | { [key: string]: any; }; _tooltip: SbbTooltip; /** Event emitted when the tooltip is opened. */ readonly opened: EventEmitter; /** Event emitted when the tooltip is closed. */ readonly dismissed: EventEmitter; ngOnInit(): void; ngOnChanges(changes: SimpleChanges): void; ngOnDestroy(): void; /** Shows the tooltip. */ show(): void; /** Hides the tooltip. */ hide(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; static ngAcceptInputType_hoverShowDelay: unknown; static ngAcceptInputType_hoverHideDelay: unknown; static ngAcceptInputType_disabled: unknown; } declare class SbbTooltipModule { static ɵfac: i0.ɵɵFactoryDeclaration; static ɵmod: i0.ɵɵNgModuleDeclaration; static ɵinj: i0.ɵɵInjectorDeclaration; } export { SBB_TOOLTIP_DEFAULT_OPTIONS, SBB_TOOLTIP_DEFAULT_OPTIONS_FACTORY, SBB_TOOLTIP_SCROLL_STRATEGY, SBB_TOOLTIP_SCROLL_STRATEGY_FACTORY, SBB_TOOLTIP_SCROLL_STRATEGY_FACTORY_PROVIDER, SCROLL_THROTTLE_MS, SbbTooltip, SbbTooltipChangeEvent, SbbTooltipModule, SbbTooltipWrapper, TooltipComponent, getSbbTooltipInvalidPositionError }; export type { SbbTooltipDefaultOptions, TooltipPosition, TooltipTouchGestures, TooltipVisibility };