import type { ElementTarget } from "../use-target-element/index.cjs"; import type { Noop } from "../utils/basic.cjs"; export type KeyPredicate = (event: KeyboardEvent) => boolean; export type KeyFilter = true | string | string[] | KeyPredicate; export type KeyStrokeEventName = 'keydown' | 'keypress' | 'keyup'; export interface UseKeyStrokeOptions { /** * The event name to listen for. * * @defaultValue 'keydown' */ eventName?: KeyStrokeEventName; /** * The target to add the event listener to. * * @defaultValue window */ target?: ElementTarget | (() => Window) | (() => Document); /** * Set to `true` to use passive event listeners. * * @defaultValue false */ passive?: boolean; /** * Set to `true` to ignore repeated events when the key is being held down. * * @defaultValue false */ dedupe?: boolean; /** * Set to `true` to remove the event listener after the first event. * * @defaultValue false */ once?: boolean; } export type UseKeyStrokeHandler = (event: KeyboardEvent) => void; /** * A React Hook that helps to handle key strokes. */ export declare function useKeyStroke(key?: KeyFilter, handler?: UseKeyStrokeHandler, options?: UseKeyStrokeOptions): Noop; export declare function useKeyStroke(handler?: UseKeyStrokeHandler, options?: UseKeyStrokeOptions): Noop;