export interface UseFocusWithinOptions { onFocus?: (event: FocusEvent) => void; onBlur?: (event: FocusEvent) => void; } export interface UseFocusWithinReturnValue { ref: React.RefObject; focused: boolean; } /** * Custom hook for tracking focus state within a DOM element. * * Features: * - Tracks whether any child element has focus * - Provides a ref object to attach to the target element * - Handles focus events with proper cleanup * - Supports custom onFocus and onBlur callbacks * - Prevents false blur events when focus moves between children * - Automatically cleans up event listeners on unmount * * @param options Configuration options for the hook * @param options.onFocus Optional callback when focus enters the element * @param options.onBlur Optional callback when focus leaves the element * @returns Object containing ref and focused state * * @example * const { ref, focused } = useFocusWithin({ * onFocus: () => console.log('Focus entered'), * onBlur: () => console.log('Focus left') * }); * * return
Content
; */ export declare function useFocusWithin({ onBlur, onFocus, }?: UseFocusWithinOptions): UseFocusWithinReturnValue;