import { EventEmitter } from '../../stencil-public-runtime'; import { HeaderMenuToggleDetail } from '../ontario-header/ontario-header.interface'; import { MenuItem } from '../../utils/common/common.interface'; import { Language } from '../../utils/common/language-types'; /** * Ontario Header Menu Tabs provides mobile and tablet tabbed navigation for header menus. * * - Displays two tabs (Topics and Sign In) with overflow menu content. * - Manages keyboard navigation, focus trapping, and accessibility. * * For component guidance, see: * - https://designsystem.ontario.ca/components/detail/ontario-header.html * - https://designsystem.ontario.ca/components/detail/application-header.html * - https://designsystem.ontario.ca/components/detail/service-ontario-header.html * - https://designsystem.ontario.ca/developer-docs/components/ontario-header-menu-tabs/ */ export declare class OntarioHeaderMenuTabs { el: HTMLElement; /** * Menu items for the "Topics" tab. * Can be passed as a MenuItem array or JSON string. */ topicsMenuItems: MenuItem[] | string; /** * Menu items for the "Sign In" tab. * Can be passed as a MenuItem array or JSON string. */ signInMenuItems: MenuItem[] | string; /** * Enable auto-detect handoff mode. */ autoDetectMode?: boolean; /** * Whether focus should move to the active tab when the menu opens. * This should only be true for keyboard-triggered opens. */ focusActiveTabOnOpen: boolean; /** * The language of the component. * This is used for translations, and is by default set through event listeners checking for a language property from the header. If none is passed, it will default to English. */ language?: Language; /** * The currently active tab index (0 = Topics, 1 = Sign In). */ private activeTab; /** * Whether the menu dropdown is currently open. */ private menuIsOpen; /** * Parsed topics menu items. */ private topicsMenuItemsState; /** * Parsed sign-in menu items. */ private signInMenuItemsState; /** * Reference to the ARIA live region for screen reader announcements. */ private ariaLiveRegion; /** * Cleanup function for the focus trap event listener. */ private focusTrapCleanup; /** * Whether the focus trap has been installed for the current panel. */ private trapInstalled; private hasInitializedOpenFocus; /** * Whether the active tab should receive focus when the menu opens. */ private shouldFocusTabOnOpen; /** * Event emitted when ownership handoff is triggered in auto-detect mode. */ takeOwnership: EventEmitter<{ panelId: string | null; }>; /** * Event emitted to request overflow menu to focus its first item. */ focusFirstItem: EventEmitter; /** * Event emitted to request header to focus the menu button. * Triggered when Shift+Tab is pressed on the first tab. */ focusMenuButton: EventEmitter; componentWillLoad(): void; /** * Watch for changes to topicsMenuItems prop and re-parse. */ parseTopicsMenuItems(): void; /** * Watch for changes to signInMenuItems prop and re-parse. */ parseSignInMenuItems(): void; /** * Generic parser for menu items with error handling. */ private parseMenuItemsData; /** * After each render, try to install the focus trap if menu is open. */ componentDidRender(): void; /** * Listen for menu button toggle events. */ handleMenuButtonToggled(event: CustomEvent): void; /** * Handle keyboard navigation within the tabbed menu. */ handleKeyDown(event: KeyboardEvent): void; /** * Listen for end of menu reached event from overflow menus. * When Tab is pressed on last item, loop focus back to active tab. */ handleEndOfMenu(event: CustomEvent): void; /** * Listen for menuReady event from overflow menus. * Triggers ownership handoff in auto-detect mode. */ handleMenuReady(event: CustomEvent): Promise; /** * Prevent menu from closing when focus moves within the trap. */ handleFocusOut(event: FocusEvent): void; /** * This listens for the `setAppLanguage` event sent from the language toggle when it is is connected to the DOM. * It is used for the initial language when the component loads. */ handleSetAppLanguage(event: CustomEvent | Language): void; /** * This listens for the `headerLanguageToggled` event sent from the language toggle when it is is connected to the DOM. * It is used for changing the component language after the language toggle has been activated. */ handleLanguageToggle(event: CustomEvent<{ oldLanguage: Language; newLanguage: Language; }>): void; /** * Handle tab switching with Arrow Left/Right. */ private handleTabSwitching; /** * Switch to a specific tab (called by click events). */ private switchTab; /** * Focus a specific tab by index. * Uses requestAnimationFrame to ensure DOM is ready. */ private focusTab; /** * Set up initial focus when menu opens. * Uses requestAnimationFrame to ensure DOM is ready after render. */ private setupInitialFocus; /** * Try to install the focus trap if DOM is ready. */ private tryInstallTrap; /** * Reset state when menu closes. */ private resetState; /** * Check if focus is currently on a tab button. */ private isFocusOnTab; /** * Move focus from tab button to first menu item. * Emits event for overflow menu to handle focus. */ private moveToFirstMenuItem; /** * Set up focus trap for Tab/Shift+Tab looping. */ private setupFocusTrap; /** * Clear the active focus trap. */ private clearFocusTrap; /** * Get the currently active tab panel. */ private getActiveTabPanel; /** * Get the menu container element for focus trapping. */ private getMenuContainer; /** * Get the currently focused element (checks shadow roots). */ private getActiveElement; render(): any; }