@blueprintjs/core
Version:
Core styles & components
32 lines (31 loc) • 1.41 kB
TypeScript
import * as React from "react";
import { HotkeysDialog2Props } from "../../components/hotkeys/hotkeysDialog2";
import { HotkeyConfig } from "../../hooks";
interface HotkeysContextState {
/** List of hotkeys accessible in the current scope, registered by currently mounted components, can be global or local. */
hotkeys: HotkeyConfig[];
/** Whether the global hotkeys dialog is open. */
isDialogOpen: boolean;
}
declare type HotkeysAction = {
type: "ADD_HOTKEYS" | "REMOVE_HOTKEYS";
payload: HotkeyConfig[];
} | {
type: "CLOSE_DIALOG" | "OPEN_DIALOG";
};
export declare const HotkeysContext: React.Context<[HotkeysContextState, React.Dispatch<HotkeysAction>]>;
export interface HotkeysProviderProps {
/** The component subtree which will have access to this hotkeys context. */
children: React.ReactChild;
/** Optional props to customize the rendered hotkeys dialog. */
dialogProps?: Partial<Omit<HotkeysDialog2Props, "hotkeys">>;
/** If provided, this dialog render function will be used in place of the default implementation. */
renderDialog?: (state: HotkeysContextState, contextActions: {
handleDialogClose: () => void;
}) => JSX.Element;
}
/**
* Hotkeys context provider, necessary for the `useHotkeys` hook.
*/
export declare const HotkeysProvider: ({ children, dialogProps, renderDialog }: HotkeysProviderProps) => JSX.Element;
export {};