UNPKG

@metadev/lux

Version:

Lux: Library with User Interface components for Angular.

41 lines (40 loc) 1.48 kB
import { ComponentRef, ViewRef } from '@angular/core'; import { Observable } from 'rxjs'; export declare const FOCUS = "focus"; export declare enum Key { Tab = 9, Enter = 13, Escape = 27, Space = 32, PageUp = 33, PageDown = 34, End = 35, Home = 36, ArrowLeft = 37, ArrowUp = 38, ArrowRight = 39, ArrowDown = 40 } export declare const isDefined: (value: any) => boolean; export declare class ContentRef { nodes: any[]; viewRef?: ViewRef; componentRef?: ComponentRef<any>; constructor(nodes: any[], viewRef?: ViewRef, componentRef?: ComponentRef<any>); } /** * Returns first and last focusable elements inside of a given element based on specific CSS selector */ export declare const getFocusableBoundaryElements: (element: HTMLElement) => HTMLElement[]; /** * Function that enforces browser focus to be trapped inside a DOM element. * * Works only for clicks inside the element and navigation with 'Tab', ignoring clicks outside of the element * * @param element The element around which focus will be trapped inside * @param stopFocusTrap$ The observable stream. When completed the focus trap will clean up listeners * and free internal resources * @param refocusOnClick Put the focus back to the last focused element whenever a click occurs on element (default to * false) */ export declare const focusTrap: (element: HTMLElement, stopFocusTrap$: Observable<any>, refocusOnClick?: boolean) => void;