{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "kbd-shortcut",
  "type": "registry:ui",
  "title": "Kbd Shortcut",
  "description": "Labelled keyboard-shortcut hint (“Send ⌘↵”) that can also bind the shortcut and light its keys while pressed.",
  "dependencies": [],
  "registryDependencies": [
    "https://kuro.abstergo.fyi/r/kura-theme.json",
    "https://kuro.abstergo.fyi/r/kbd.json",
    "https://kuro.abstergo.fyi/r/kura-keys.json",
    "https://kuro.abstergo.fyi/r/use-hotkey.json",
    "utils"
  ],
  "files": [
    {
      "path": "registry/kura/kbd-shortcut/index.ts",
      "type": "registry:ui",
      "target": "components/kura/kbd-shortcut/index.ts",
      "content": "export { KbdShortcut, type KbdShortcutProps } from \"./kbd-shortcut\";\n"
    },
    {
      "path": "registry/kura/kbd-shortcut/kbd-shortcut.tsx",
      "type": "registry:ui",
      "target": "components/kura/kbd-shortcut/kbd-shortcut.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { useHotkey } from \"@/hooks/kura/use-hotkey\";\nimport { cn } from \"@/lib/utils\";\nimport type { KeyName } from \"@/lib/kura/keys\";\nimport { Kbd } from \"@/components/kura/kbd\";\n\nexport interface KbdShortcutProps extends Omit<React.ComponentProps<\"span\">, \"children\"> {\n  /** The combo, e.g. `[\"mod\", \"enter\"]`. `mod` = ⌘ on Apple, Ctrl elsewhere. */\n  keys: readonly KeyName[];\n  /** Short action label shown before the keys, e.g. \"Send\". Omit for keys only. */\n  label?: React.ReactNode;\n  /**\n   * Bind the combo globally and call this when pressed. Omit for a display-only hint.\n   * While the combo is held, the keys render pressed.\n   */\n  onTrigger?: (event: KeyboardEvent) => void;\n  /** Enable/disable the binding without hiding the hint. Default true. */\n  enabled?: boolean;\n  /** Fire while typing in inputs. Default: true when the combo has a modifier. */\n  allowInInputs?: boolean;\n  variant?: \"raised\" | \"ghost\";\n  size?: \"sm\" | \"md\";\n}\n\n/**\n * A labelled shortcut hint (\"Send ⌘↵\") that can also bind the shortcut and light up its keys\n * when pressed. Use it for the hints under composers, in empty states and in menus.\n */\nexport function KbdShortcut({\n  keys,\n  label,\n  onTrigger,\n  enabled = true,\n  allowInInputs,\n  variant = \"raised\",\n  size = \"sm\",\n  className,\n  ...props\n}: KbdShortcutProps) {\n  const [pressed, setPressed] = React.useState(false);\n  const timeout = React.useRef<ReturnType<typeof setTimeout> | null>(null);\n\n  useHotkey(\n    onTrigger ? keys : null,\n    (event) => {\n      setPressed(true);\n      if (timeout.current) clearTimeout(timeout.current);\n      // Fallback release in case keyup is swallowed (e.g. focus moved).\n      timeout.current = setTimeout(() => setPressed(false), 400);\n      onTrigger?.(event);\n    },\n    {\n      enabled,\n      allowInInputs,\n      onKeyUp: () => {\n        if (timeout.current) clearTimeout(timeout.current);\n        setPressed(false);\n      },\n    },\n  );\n\n  React.useEffect(\n    () => () => {\n      if (timeout.current) clearTimeout(timeout.current);\n    },\n    [],\n  );\n\n  return (\n    <span\n      data-slot=\"kbd-shortcut\"\n      data-pressed={pressed}\n      data-bound={!!onTrigger && enabled}\n      className={cn(\n        \"group inline-flex items-center gap-1.5 font-kura-sans text-kura-fg-subtle text-xs\",\n        !enabled && \"opacity-50\",\n        className,\n      )}\n      {...props}\n    >\n      {label != null && (\n        <span\n          data-slot=\"kbd-shortcut-label\"\n          className=\"transition-colors duration-(--kura-duration-fast) group-data-[pressed=true]:text-kura-fg\"\n        >\n          {label}\n        </span>\n      )}\n      <Kbd keys={keys} variant={variant} size={size} pressed={pressed} />\n    </span>\n  );\n}\n"
    }
  ],
  "categories": [
    "input",
    "keyboard",
    "shortcut",
    "hotkey",
    "hint"
  ],
  "docs": "Docs: https://kuro.abstergo.fyi/components/kbd-shortcut · Markdown for agents: https://kuro.abstergo.fyi/components/kbd-shortcut.md",
  "meta": {
    "kura": {
      "status": "beta",
      "whenToUse": [
        "Hints under or inside a prompt composer: “⌘↵ to send”, “Esc to stop”.",
        "Advertise and bind a global shortcut in one element (e.g. ⌘K for search, ⌘J to toggle a panel).",
        "Empty states and onboarding that teach shortcuts."
      ],
      "whenNotToUse": [
        "Showing a single key or combo without a label or binding — use kbd.",
        "A shortcut inside a tooltip — pass `shortcut` to tooltip or icon-button instead.",
        "Binding a shortcut with no visible hint — call the useHotkey hook directly."
      ]
    }
  }
}
