import { FocusMonitor, FocusOrigin } from '@angular/cdk/a11y'; import { BreakpointObserver } from '@angular/cdk/layout'; import { Overlay, ScrollStrategy } from '@angular/cdk/overlay'; import { AfterContentInit, ElementRef, EventEmitter, InjectionToken, OnDestroy } from '@angular/core'; import { Router } from '@angular/router'; import { TypeRef } from '@sbb-esta/angular-core/common-behaviors'; import { SbbHeaderMenu } from '../header-menu/header-menu.component'; import type { SbbHeader } from '../header/header.component'; /** Injection token that determines the scroll handling while the menu is open. */ export declare const SBB_HEADER_MENU_SCROLL_STRATEGY: InjectionToken<() => ScrollStrategy>; /** @docs-private */ export declare function SBB_HEADER_MENU_SCROLL_STRATEGY_FACTORY(overlay: Overlay): () => ScrollStrategy; /** @docs-private */ export declare const SBB_HEADER_MENU_SCROLL_STRATEGY_FACTORY_PROVIDER: { provide: InjectionToken<() => ScrollStrategy>; deps: (typeof Overlay)[]; useFactory: typeof SBB_HEADER_MENU_SCROLL_STRATEGY_FACTORY; }; export declare class SbbHeaderMenuTrigger implements AfterContentInit, OnDestroy { private _overlay; private _element; private _focusMonitor; private _breakpointObserver; private _router; private _header; _openedBy: 'mouse' | 'touch' | null; /** References the menu instance that the trigger is associated with. */ get menu(): SbbHeaderMenu; set menu(menu: SbbHeaderMenu); private _menu; /** * Whether focus should be restored when the menu is closed. * Note that disabling this option can have accessibility implications * and it's up to you to manage focus, if you decide to turn it off. */ restoreFocus: boolean; /** Event emitted when the associated menu is opened. */ readonly menuOpened: EventEmitter; /** Event emitted when the associated menu is closed. */ readonly menuClosed: EventEmitter; _panelTarget: ElementRef; /** Whether the menu is open. */ get menuOpen(): boolean; private _overlayRef; private _menuOpen; private _closingActionsSubscription; private _menuCloseSubscription; private _destroyed; private _scrollStrategy; /** * Handles touch start events on the trigger. * Needs to be an arrow function so we can easily use addEventListener and removeEventListener. */ private _handleTouchStart; constructor(_overlay: Overlay, _element: ElementRef, _focusMonitor: FocusMonitor, _breakpointObserver: BreakpointObserver, _router: Router, scrollStrategy: any, _header: TypeRef); ngAfterContentInit(): void; ngOnDestroy(): void; /** Toggles the menu between the open and closed states. */ toggleMenu(): void; /** Opens the menu. */ openMenu(): void; /** Closes the menu. */ closeMenu(): void; /** * Focuses the menu trigger. * @param origin Source of the menu trigger's focus. */ focus(origin?: FocusOrigin, options?: FocusOptions): void; /** Handles mouse presses on the trigger. */ _handleMousedown(event: TypeRef): void; /** Handles click events on the trigger. */ _handleClick(): void; /** Closes the menu and does the necessary cleanup. */ private _destroyMenu; /** * This method sets the menu state to open and focuses the first item if * the menu was opened via the keyboard. */ private _initMenu; /** Restores focus to the element that was focused before the menu was open. */ private _restoreFocus; private _setIsMenuOpen; /** * This method checks that a valid instance of HeaderMenu has been passed into * sbbHeaderMenu. If not, an exception is thrown. */ private _checkMenu; /** * This method creates the overlay from the provided menu's template and saves its * OverlayRef so that it can be attached to the DOM when openMenu is called. */ private _createOverlay; /** * This method builds the configuration object needed to create the overlay, the OverlayState. * @returns OverlayConfig */ private _getOverlayConfig; /** * Sets the appropriate positions on a position strategy * so the overlay connects with the trigger correctly. * @param positionStrategy Strategy whose position to update. */ private _setPosition; /** Returns the width of the input element, so the panel width can match it. */ protected _getHostWidth(): number; /** Returns a stream that emits whenever an action that should close the menu occurs. */ private _menuClosingActions; }