import { type FocusContainer, type FocusableElement, type FocusTarget, type HostRef } from './dom-boundary.js'; export interface FocusTrapKeyEvent { nativeEvent: { key: string; shiftKey?: boolean; target?: unknown; }; preventDefault(): void; stopPropagation?(): void; } export interface FocusTrapOptions { active: boolean; containerRef: HostRef; initialFocusRef?: HostRef | undefined; onEscape?: (() => void) | undefined; /** Whether to restore the opener. Defaults to true; false still allows `returnFocus`. */ restoreFocus?: (() => boolean) | undefined; /** Fallback when the opener is gone or `restoreFocus` returns false. */ returnFocus?: (() => FocusTarget | null) | undefined; } export interface FocusTrapProps { onKeyDown: (event: FocusTrapKeyEvent) => void; } export declare function focusableElements(container: FocusContainer): FocusableElement[]; /** Moves focus to the far end when Tab leaves the trap, reporting whether it wrapped. */ export declare function wrapFocusAtBoundary(focusable: readonly FocusTarget[], activeElement: unknown, movingBackward: boolean): boolean; /** Focuses the requested target, else the first focusable child, else the container. */ export declare function focusOverlayEntry(container: FocusContainer | null, requestedInitial: FocusTarget | null): void; /** * Applies one key press to a trapped container. Returns `escape` when the caller * should close, `wrapped` when focus moved, and `ignored` otherwise. */ export declare function applyFocusTrapKey(container: FocusContainer | null, event: FocusTrapKeyEvent): 'escape' | 'wrapped' | 'ignored'; /** Contains web Tab order inside an overlay and restores focus when needed on close. */ export declare function useFocusTrap({ active, containerRef, initialFocusRef, onEscape, restoreFocus, returnFocus, }: FocusTrapOptions): FocusTrapProps; //# sourceMappingURL=use-focus-trap.d.ts.map