import { HotkeySequence } from '@tanstack/react-hotkeys' import { Fragment, useState, type ReactNode } from 'react' import { KeyboardShortcut, Tooltip, TooltipContent, TooltipContentProps, TooltipTrigger } from 'ui' import { hotkeyToKeys } from '@/state/shortcuts/formatShortcut' import { SHORTCUT_DEFINITIONS, type ShortcutId } from '@/state/shortcuts/registry' interface ShortcutTooltipProps { shortcutId: ShortcutId children: ReactNode side?: TooltipContentProps['side'] align?: TooltipContentProps['align'] sideOffset?: number delayDuration?: number /** * Override the label from the registry. Use when the wrapped element's * action is a narrower/contextual variant of the registered shortcut. */ label?: string /** * Override the tooltip's open state. Pass `false` to force the tooltip closed * (e.g. while a popover or dialog opened by the wrapped element is visible). * Leave `undefined` to let hover/focus drive it. The tooltip is always * controlled internally so toggling this prop won't trigger Radix's * controlled/uncontrolled warning. */ open?: boolean } /** * Wraps any element to show its bound keyboard shortcut on hover/focus, in the * style of Linear's shortcut tooltips: `"