{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "terminal-command",
  "title": "Terminal Command",
  "author": "STARCK",
  "description": "A copyable terminal command block with stable animated feedback.",
  "dependencies": [
    "framer-motion@^11.0.0"
  ],
  "files": [
    {
      "path": "registry/default/terminal-command.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { AnimatePresence, motion } from \"framer-motion\"\n\ntype TerminalCommandProps = {\n  lines: readonly string[]\n  shell?: string\n  className?: string\n}\n\nfunction CopyIcon({ checked = false }: { checked?: boolean }) {\n  return checked ? (\n    <svg viewBox=\"0 0 16 16\" fill=\"none\" className=\"size-3.5\" aria-hidden>\n      <path\n        d=\"m3 8.3 3.1 3.1L13 4.7\"\n        stroke=\"currentColor\"\n        strokeWidth=\"1.8\"\n        strokeLinecap=\"round\"\n        strokeLinejoin=\"round\"\n      />\n    </svg>\n  ) : (\n    <svg viewBox=\"0 0 16 16\" fill=\"none\" className=\"size-3.5\" aria-hidden>\n      <rect\n        x=\"5.2\"\n        y=\"5.2\"\n        width=\"7.3\"\n        height=\"7.3\"\n        rx=\"1.5\"\n        stroke=\"currentColor\"\n        strokeWidth=\"1.3\"\n      />\n      <path\n        d=\"M10.7 5.2V4.1c0-.9-.7-1.6-1.6-1.6h-5c-.9 0-1.6.7-1.6 1.6v5c0 .9.7 1.6 1.6 1.6h1.1\"\n        stroke=\"currentColor\"\n        strokeWidth=\"1.3\"\n      />\n    </svg>\n  )\n}\n\nfunction TerminalCommand({\n  lines,\n  shell = \"zsh\",\n  className = \"\",\n}: TerminalCommandProps) {\n  const [copied, setCopied] = React.useState(false)\n  const timerRef = React.useRef<ReturnType<typeof setTimeout> | null>(null)\n\n  React.useEffect(\n    () => () => {\n      if (timerRef.current) clearTimeout(timerRef.current)\n    },\n    []\n  )\n\n  const copy = async () => {\n    try {\n      await navigator.clipboard.writeText(lines.join(\"\\n\"))\n      setCopied(true)\n      if (timerRef.current) clearTimeout(timerRef.current)\n      timerRef.current = setTimeout(() => setCopied(false), 1800)\n    } catch {\n      setCopied(false)\n    }\n  }\n\n  return (\n    <div\n      className={`overflow-hidden rounded-xl bg-[#0d1117] text-left text-white shadow-xl ring-1 ring-black/30 ${className}`}\n    >\n      <div className=\"flex items-center gap-2 border-b border-white/10 bg-white/5 px-4 py-2.5\">\n        <span className=\"size-3 rounded-full bg-[#ff5f57]\" />\n        <span className=\"size-3 rounded-full bg-[#febc2e]\" />\n        <span className=\"size-3 rounded-full bg-[#28c840]\" />\n        <span className=\"ml-2 font-mono text-xs text-white/40\">{shell}</span>\n        <motion.button\n          type=\"button\"\n          onClick={copy}\n          whileTap={{ scale: 0.9 }}\n          aria-label=\"Copy commands\"\n          className=\"ml-auto grid h-7 w-[74px] cursor-pointer place-items-center rounded-md text-xs font-medium transition-colors hover:bg-white/8\"\n        >\n          <AnimatePresence mode=\"wait\" initial={false}>\n            <motion.span\n              key={copied ? \"copied\" : \"copy\"}\n              initial={{ opacity: 0, y: 4 }}\n              animate={{ opacity: 1, y: 0 }}\n              exit={{ opacity: 0, y: -4 }}\n              transition={{ duration: 0.12 }}\n              className={`inline-flex items-center gap-1.5 ${copied ? \"text-[#3ddc63]\" : \"text-white/60\"}`}\n            >\n              <CopyIcon checked={copied} />\n              {copied ? \"Copied\" : \"Copy\"}\n            </motion.span>\n          </AnimatePresence>\n        </motion.button>\n      </div>\n      <div className=\"overflow-x-auto px-4 py-4 font-mono text-[13px] leading-7 text-zinc-100\">\n        {lines.map((line) => (\n          <div key={line} className=\"whitespace-pre\">\n            <span className=\"text-[#28c840] select-none\">$ </span>\n            {line}\n          </div>\n        ))}\n      </div>\n    </div>\n  )\n}\n\nexport { TerminalCommand }\nexport type { TerminalCommandProps }\n",
      "type": "registry:component",
      "target": "components/terminal-command.tsx"
    }
  ],
  "type": "registry:component"
}