import type { RefObject } from "react"; /** * useKeyboard handles activation of keyboard hotkeys on a given element. * @param {Record {}} config - A map of keyboardEvent code to function. * @param {RefObject} ref - The element which the keyboard config has to apply on. * @param {boolean} isActive - A flag to determine when the keyboard config has to be applied. * * Example: * useKeyboard({ * Escape: closeMenu, * ArrowUp: () => { doSomething() }, * KeyB: () => { console.log("bagi") }, * }, menuRef, menuOpen) * * This mean that these keyboard shortcuts will be applied on menuRef when the menu is opened. */ export type KeyboardConfig = Record void | boolean>; export declare function useKeyboard(config: KeyboardConfig, ref: RefObject, isActive: boolean, onlyRefIsActive?: boolean): void;