aura-glass
Version:
A comprehensive glassmorphism design system for React applications with 142+ production-ready components
69 lines • 1.97 kB
TypeScript
/**
* AuraGlass Focus Utilities
* Keyboard navigation and focus management helpers
*/
import { RefObject, KeyboardEvent } from 'react';
/**
* Focus trap configuration
*/
export interface FocusTrapOptions {
initialFocus?: RefObject<HTMLElement>;
returnFocus?: boolean;
allowOutsideClick?: boolean;
escapeDeactivates?: boolean;
}
/**
* Get all focusable elements within a container
*/
export declare function getFocusableElements(container: HTMLElement): HTMLElement[];
/**
* Trap focus within a container
*/
export declare function trapFocus(container: HTMLElement, options?: FocusTrapOptions): () => void;
/**
* Roving tabindex for lists and menus
*/
export declare class RovingTabIndex {
private elements;
private currentIndex;
constructor(container: HTMLElement, selector?: string);
private init;
private handleKeyDown;
private setFocus;
destroy(): void;
}
/**
* Focus ring styles for consistent appearance
*/
export declare function applyFocusRing(element: HTMLElement, color?: string): void;
/**
* Remove focus ring
*/
export declare function removeFocusRing(element: HTMLElement): void;
/**
* Check if element is focusable
*/
export declare function isFocusable(element: HTMLElement): boolean;
/**
* Focus the first focusable element in a container
*/
export declare function focusFirstElement(container: HTMLElement): boolean;
/**
* Handle keyboard navigation for button-like elements
*/
export declare function handleButtonKeyDown(e: KeyboardEvent<HTMLElement>, onClick?: (e: any) => void): void;
/**
* Create a focus scope that manages tab order
*/
export declare class FocusScope {
private container;
private scopeId;
constructor(container: HTMLElement);
private init;
release(): void;
}
/**
* Announce content to screen readers
*/
export declare function announceToScreenReader(message: string, priority?: 'polite' | 'assertive'): void;
//# sourceMappingURL=focus.d.ts.map