import type React from 'react'; import type { ReadonlyDeep } from 'type-fest'; type KeyboardShortcut = { key: string; modifiers: KeyboardShortcutModifierKey[]; }; declare const KEYBOARD_SHORTCUT_MODIFIERS: readonly ["shift", "alt", "mod"]; /** * Represents a modifier key that can be used in keyboard shortcuts. * - 'shift': The Shift key * - 'alt': The Alt/Option key * - 'mod': The Command key on Apple platforms or Control key on all other platforms */ type KeyboardShortcutModifierKey = (typeof KEYBOARD_SHORTCUT_MODIFIERS)[number]; declare const getKeyboardShortcutString: ({ key, modifiers }: ReadonlyDeep) => string; /** * Creates a keyboard shortcut handler for a given element. * @param shortcut - The keyboard shortcut configuration * @param shortcut.key - The key to listen for * @param shortcut.modifiers - The modifiers to listen for * @param handler - The handler function to call when the keyboard shortcut is pressed * @returns A keyboard event handler that can be attached to an element * @example * ```tsx * const handleSave = createKeyboardShortcutHandler( * { key: 's', modifiers: ['mod'] }, * (e) => { * e.preventDefault(); * saveDocument(); * } * ); * ``` */ declare const createKeyboardShortcutHandler: ({ key, modifiers }: KeyboardShortcut, handler: (e: React.KeyboardEvent | KeyboardEvent) => void) => (e: React.KeyboardEvent | KeyboardEvent) => void; export { createKeyboardShortcutHandler, getKeyboardShortcutString, KEYBOARD_SHORTCUT_MODIFIERS }; export type { KeyboardShortcut, KeyboardShortcutModifierKey };