import * as React from 'react'; import {ReactFocusLockProps, AutoFocusProps, FreeFocusProps, InFocusGuardProps} from "../interfaces"; /** * Traps Focus inside a Lock */ declare const ReactFocusLock: React.FC }>; export default ReactFocusLock; /** * Autofocus on children on Lock activation */ export class AutoFocusInside extends React.Component { } /** * Autofocus on children */ export class MoveFocusInside extends React.Component { } /** * Allow free focus inside on children */ export class FreeFocusInside extends React.Component { } /** * Secures the focus around the node */ export class InFocusGuard extends React.Component { } /** * Moves focus inside a given node */ export function useFocusInside(node: React.RefObject): void; export type FocusOptions = { /** * enables focus cycle * @default true */ cycle?: boolean; /** * limits focusables to tabbables (tabindex>=0) elements only * @default true */ onlyTabbable?:boolean } export type FocusControl = { /** * moves focus to the current scope, can be considered as autofocus */ autoFocus():Promise; /** * focuses the next element in the scope. * If active element is not in the scope, autofocus will be triggered first */ focusNext(options?:FocusOptions):Promise; /** * focuses the prev element in the scope. * If active element is not in the scope, autofocus will be triggered first */ focusPrev(options?:FocusOptions):Promise; /** * focused the first element in the scope */ focusFirst(options?: Pick):Promise; /** * focused the last element in the scope */ focusLast(options?: Pick):Promise; } /** * returns FocusControl over the union given elements, one or many * - can be used outside of FocusLock * @see {@link useFocusScope} for use cases inside of FocusLock */ export function useFocusController(...shards: ReadonlyArray):FocusControl; /** * returns FocusControl over the current FocusLock * - can be used only within FocusLock * - can be used by disabled FocusLock * @see {@link useFocusController} for use cases outside of FocusLock */ export function useFocusScope():FocusControl export type FocusCallbacks = { onFocus():void; onBlur():void; } /** * returns information about FocusState of a given node * @example * ```tsx * const {active, ref, onFocus} = useFocusState(); * return
{active ? 'is focused' : 'not focused'}
* ``` */ export function useFocusState(callbacks?: FocusCallbacks ):{ /** * is currently focused, or is focus is inside */ active: boolean; /** * focus handled. SHALL be passed to the node down */ onFocus: React.FocusEventHandler; /** * reference to the node * only required to capture current status of the node */ ref: React.RefObject; }