@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) • 1.69 kB
TypeScript
import { ESLBaseElement } from '../../esl-base-element/core';
/** Relative targeting type definition */
export type GroupTarget = 'next' | 'prev' | 'current';
/**
* ESLA11yGroup component
* @author Julia Murashko
*
* ESLA11yGroup - helper custom element that adds a11y group behavior to targets.
*/
export declare class ESLA11yGroup extends ESLBaseElement {
static is: string;
/** Mapping of the keyboard keys to {@link GroupTarget} */
static KEY_MAP: Record<string, GroupTarget>;
/** Target elements multiple selector ({@link ESLTraversingQuery} syntax) */
targets: string;
/** Activates target (via click event) on selection */
activateSelected: boolean;
/** Prevents scroll when target receives focus */
preventScroll: boolean;
/** @returns HTMLElement root element of the group */
get $root(): HTMLElement | null;
/** @returns HTMLElement[] targets of the group */
get $targets(): HTMLElement[];
protected _onKeydown(e: KeyboardEvent): void;
/** Go to the target from the passed element or currently focused target by default */
goTo(target: GroupTarget, from?: HTMLElement | null): void;
/** @returns HTMLElement next target fot trigger */
next(trigger: HTMLElement): HTMLElement | undefined;
/** @returns HTMLElement previous target fot trigger */
prev(trigger: HTMLElement): HTMLElement | undefined;
/** @returns HTMLElement currently focused element from targets */
current(): HTMLElement | null;
}
declare global {
export interface ESLLibrary {
A11yGroup: typeof ESLA11yGroup;
}
export interface HTMLElementTagNameMap {
'esl-a11y-group': ESLA11yGroup;
}
}