react-roving-focus
Version:
Flexible roving focus for React with support for any fixed or responsive layout.
26 lines (25 loc) • 1.06 kB
TypeScript
import { Direction, ElementPosition, ElementWithPosition, FocusableElement } from './types.js';
/**
* Gets the current position of an element.
*/
export declare function getElementPosition(element: FocusableElement): ElementPosition;
/**
* Returns the top-left element.
*/
export declare function getFirstElement(elements: ElementWithPosition[]): FocusableElement | null;
/**
* Returns the bottom-right element.
*/
export declare function getLastElement(elements: ElementWithPosition[]): FocusableElement | null;
/**
* Returns the next element in a given direction relative to the current element's position.
*/
export declare function getNextElement(currentElement: FocusableElement, direction: Direction, elements: ElementWithPosition[]): FocusableElement | null;
/**
* Determines whether an element is active (i.e. not disabled).
*/
export declare function isElementActive(element: FocusableElement): boolean;
/**
* Determines whether an element is disabled.
*/
export declare function isElementDisabled(element: FocusableElement): boolean;