UNPKG

1.06 kBTypeScriptView Raw
1import * as React from "react";
2import { HotkeyConfig, UseHotkeysOptions } from "../../hooks";
3/** Identical to the return type of `useHotkeys` hook. */
4export interface HotkeysTarget2RenderProps {
5 handleKeyDown: React.KeyboardEventHandler<HTMLElement>;
6 handleKeyUp: React.KeyboardEventHandler<HTMLElement>;
7}
8export interface HotkeysTarget2Props {
9 /**
10 * Render prop which receives the same callback handlers generated by the `useHotkeys` hook.
11 * If your hotkey definitions are all global, you may supply an element instead.
12 */
13 children: JSX.Element | ((props: HotkeysTarget2RenderProps) => JSX.Element);
14 /** Hotkey definitions. */
15 hotkeys: readonly HotkeyConfig[];
16 /** Hook customization options. */
17 options?: UseHotkeysOptions;
18}
19/**
20 * Utility component which allows consumers to use the new `useHotkeys` hook inside
21 * React component classes. The implementation simply passes through to the hook.
22 */
23export declare const HotkeysTarget2: ({ children, hotkeys, options }: HotkeysTarget2Props) => JSX.Element;