/** * @license * Copyright 2023 Nuraly, Laabidi Aymen * SPDX-License-Identifier: MIT */ import { FocusController } from '../interfaces/focus-controller.interface.js'; /** * Controller that manages focus state and focus handling for radio groups * Implements proper focus management with accessibility compliance * * Features: * - Tracks focused radio option index * - Manages focus state transitions * - Provides focus/blur methods for programmatic control * - Handles roving tabindex for accessibility * * @example * ```typescript * const controller = new RadioFocusController(hostElement); * controller.setFocusedOption(1); // Focus second option * controller.focus(); // Programmatically focus the group * ``` */ export declare class RadioFocusController implements FocusController { private host; private _focusedIndex; private _hasFocus; private boundFocusInHandler; private boundFocusOutHandler; /** * Creates a new RadioFocusController instance * Sets up event handlers for focus management * * @param host - The host radio element */ constructor(host: any); /** * Called when the host element is connected to the DOM * Sets up focus event listeners for the radio group */ hostConnected(): void; /** * Called when the host element is disconnected from the DOM * Removes focus event listeners to prevent memory leaks */ hostDisconnected(): void; /** * Gets the index of the currently focused radio option * * @returns The focused option index, -1 if none focused * * @example * ```typescript * const index = controller.focusedIndex; * console.log(`Option ${index} is focused`); * ``` */ get focusedIndex(): number; /** * Checks if the radio group currently has focus * * @returns True if any option in the group has focus, false otherwise * * @example * ```typescript * if (controller.hasFocus) { * console.log('Radio group is focused'); * } * ``` */ get hasFocus(): boolean; /** * Sets the focused option by index * Updates internal state and triggers re-render if needed * * @param index - The index of the option to focus * * @example * ```typescript * controller.setFocusedOption(2); // Focus third option * ``` */ setFocusedOption(index: number): void; /** * Get the currently focused option index (method version for interface compliance) * @returns The focused option index or -1 if none focused */ getFocusedIndex(): number; clearFocus(): void; private handleFocusIn; private handleFocusOut; focus(): void; blur(): void; private focusOptionAtIndex; updateTabIndices(focusedIndex?: number): void; hostUpdated(): void; } //# sourceMappingURL=focus.controller.d.ts.map