UNPKG

@exadel/esl

Version:

Exadel Smart Library (ESL) is the lightweight custom elements library that provide a set of super-flexible components

42 lines (41 loc) 2.25 kB
import type { ESLToggleable } from './esl-toggleable'; import type { ESLToggleableManager } from './esl-toggleable-manager.types'; /** Focus manager for toggleable instances. Singleton. */ export declare class ESLToggleableManagerDefault implements ESLToggleableManager { /** Active toggleable */ protected active: Set<ESLToggleable>; /** Focus scopes stack. Manager observes only top level scope. */ protected stack: ESLToggleable[]; /** A delayed task for the focus management */ private _focusTaskMng; constructor(); /** Current focus scope */ get current(): ESLToggleable; /** Checks if the element is in the known focus scopes */ has(element: ESLToggleable): boolean; /** Finds the related toggleable element for the specified element */ findRelated(element: HTMLElement | null | undefined): ESLToggleable | undefined; /** Returns the stack of the toggleable elements for the specified element */ getChainFor(element: ESLToggleable | undefined): ESLToggleable[]; /** Checks if the element is related to the specified toggleable open chain */ isRelates(element: HTMLElement, related: ESLToggleable): boolean; /** Focuses on the first focusable element of the toggleable, if possible */ protected grabFocus(element: ESLToggleable, options?: FocusOptions): void; /** Changes focus scope to the specified element. Previous scope saved in the stack. */ attach(element: ESLToggleable): void; /** Removes the specified element from the known focus scopes. */ detach(element: ESLToggleable, fallback?: HTMLElement | null): void; /** Keyboard event handler for the focus management */ protected _onKeyDown(e: KeyboardEvent): void | boolean; /** Focus event handler for the focus management */ protected _onFocusIn(e: FocusEvent): void; /** Catch all user interactions to initiate outside interaction handling */ protected _onOutsideInteraction(e: Event): void; /** * Hides a toggleable element on outside interaction in case * it is an outside interaction and it is allowed */ protected onOutsideInteraction(e: Event, el: ESLToggleable): void; /** Queues delayed task of the focus management */ private queue; }