{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "ds-keyboard-shortcut",
  "dependencies": [
    "class-variance-authority"
  ],
  "files": [
    {
      "path": "components/ds/ds-keyboard-shortcut.tsx",
      "content": "\"use client\"\n\nimport React, { useEffect, useState } from \"react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { cn } from \"@/lib/utils\"\n\n// ── Types ──\n\nexport const keyboardShortcutVariants = cva(\n  \"inline-flex items-center justify-center rounded border border-b-2 border-border bg-muted font-sans font-medium text-muted-foreground transition-all\",\n  {\n    variants: {\n      size: {\n        sm: \"h-5 min-w-5 px-1 text-xs\",\n        md: \"h-6 min-w-6 px-1.5 text-xs\",\n        lg: \"h-8 min-w-8 px-2 text-sm\",\n      },\n    },\n    defaultVariants: {\n      size: \"sm\",\n    },\n  }\n)\n\nexport interface KeyboardShortcutProps\n  extends\n    React.HTMLAttributes<HTMLSpanElement>,\n    VariantProps<typeof keyboardShortcutVariants> {\n  /**\n   * Array de teclas. Ex: [\"command\", \"k\"], [\"ctrl\", \"shift\", \"p\"]\n   */\n  keys: string[]\n}\n\n// ── Component ──\n\nconst iconMap: Record<string, string> = {\n  command: \"⌘\",\n  cmd: \"⌘\",\n  shift: \"⇧\",\n  option: \"⌥\",\n  opt: \"⌥\",\n  alt: \"⌥\", // On Mac, alt is usually rendered as option\n  ctrl: \"⌃\",\n  control: \"⌃\",\n  enter: \"↵\",\n  return: \"↵\",\n  esc: \"⎋\",\n  escape: \"⎋\",\n  delete: \"⌫\",\n  backspace: \"⌫\",\n  up: \"↑\",\n  down: \"↓\",\n  left: \"←\",\n  right: \"→\",\n  tab: \"⇥\",\n}\n\nexport const KeyboardShortcut = React.forwardRef<\n  HTMLSpanElement,\n  KeyboardShortcutProps\n>(({ keys, size, className, ...props }, ref) => {\n  const [isMac, setIsMac] = useState(true)\n\n  // Detect OS on the client to adjust Alt/Ctrl vs Option/Command if needed\n  useEffect(() => {\n    const platform = navigator?.userAgent || navigator?.platform || \"unknown\"\n    setIsMac(/Mac|iPod|iPhone|iPad/.test(platform))\n  }, [])\n\n  return (\n    <span\n      ref={ref}\n      className={cn(\"inline-flex items-center gap-1\", className)}\n      {...props}\n    >\n      {keys.map((keyStr, idx) => {\n        const lowerKey = keyStr.toLowerCase()\n\n        // If Windows/Linux and it is \"command\", we swap to \"ctrl\" for display\n        let resolvedKey = lowerKey\n        if (!isMac) {\n          if (lowerKey === \"command\" || lowerKey === \"cmd\") resolvedKey = \"ctrl\"\n          if (lowerKey === \"option\" || lowerKey === \"opt\") resolvedKey = \"alt\"\n        }\n\n        const displayStr = iconMap[resolvedKey] || keyStr.toUpperCase()\n\n        return (\n          <kbd\n            key={`${keyStr}-${idx}`}\n            className={cn(keyboardShortcutVariants({ size }))}\n            title={keyStr}\n            aria-label={keyStr}\n          >\n            {displayStr}\n          </kbd>\n        )\n      })}\n    </span>\n  )\n})\n\nKeyboardShortcut.displayName = \"KeyboardShortcut\"\n",
      "type": "registry:ui"
    }
  ],
  "type": "registry:ui"
}
