{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "accordion-stack-cards",
  "type": "registry:ui",
  "title": "Accordion Stack Cards",
  "author": "Rishabh Bose <https://theb0se.vercel.app/>",
  "description": "Spatial 3D card deck that fans out into a vertical cascade on pointer hover or focus and cycles card order with spring layout projection.",
  "dependencies": [
    "framer-motion",
    "lucide-react",
    "clsx",
    "tailwind-merge"
  ],
  "files": [
    {
      "path": "components/ui/accordion-stack-cards.tsx",
      "content": "\"use client\";\n\nimport React, { useState } from \"react\";\nimport { motion, useReducedMotion } from \"framer-motion\";\nimport { Layers, ArrowUpRight, Sparkles, Terminal } from \"lucide-react\";\nimport { cn } from \"@/lib/utils\";\n\nexport interface StackCardItem {\n  id: string;\n  badge: string;\n  title: string;\n  metric: string;\n  subtitle: string;\n}\n\nexport interface AccordionStackCardsProps {\n  /** Array of stack card items. Defaults to a 3-card telemetry deck. */\n  items?: StackCardItem[];\n  /** Spring stiffness coefficient for deck expansion and rotation. Default: 300 */\n  stiffness?: number;\n  /** Spring damping coefficient for deck expansion and rotation. Default: 25 */\n  damping?: number;\n  className?: string;\n}\n\nconst DEFAULT_CARDS: StackCardItem[] = [\n  {\n    id: \"spring-core\",\n    badge: \"01 // PHYSICS ENGINE\",\n    title: \"Hooke's Law Solver\",\n    metric: \"120 Hz\",\n    subtitle: \"Continuous velocity-preserving spring interpolation\",\n  },\n  {\n    id: \"gpu-compositor\",\n    badge: \"02 // COMPOSITOR\",\n    title: \"Zero React Re-Renders\",\n    metric: \"0.0 ms\",\n    subtitle: \"Direct MotionValue & CSS mask-image projection\",\n  },\n  {\n    id: \"shadcn-cli\",\n    badge: \"03 // DISTRIBUTION\",\n    title: \"Shadcn Registry v2\",\n    metric: \"1-Click\",\n    subtitle: \"Copy-paste source ownership with strict TypeScript\",\n  },\n];\n\nexport function AccordionStackCards({\n  items = DEFAULT_CARDS,\n  stiffness = 300,\n  damping = 25,\n  className,\n}: AccordionStackCardsProps) {\n  const shouldReduceMotion = useReducedMotion() ?? false;\n  const [deck, setDeck] = useState<StackCardItem[]>(items);\n  const [isExpanded, setIsExpanded] = useState(false);\n\n  const cycleFrontCard = () => {\n    setDeck((prev) => {\n      if (prev.length <= 1) return prev;\n      const [first, ...rest] = prev;\n      return [...rest, first!];\n    });\n  };\n\n  return (\n    <div\n      onMouseEnter={() => setIsExpanded(true)}\n      onMouseLeave={() => setIsExpanded(false)}\n      className={cn(\n        \"relative flex min-h-[260px] w-full max-w-sm flex-col items-center justify-center py-4\",\n        className\n      )}\n    >\n      <div className=\"relative h-[200px] w-full\">\n        {deck.map((card, index) => {\n          const isFront = index === 0;\n          const yOffset = isExpanded ? index * 54 : index * 12;\n          const scale = isExpanded ? 1 : 1 - index * 0.05;\n          const opacity = isExpanded ? 1 : 1 - index * 0.22;\n\n          return (\n            <motion.div\n              key={card.id}\n              layout\n              role=\"button\"\n              tabIndex={0}\n              aria-label={`${card.title} — ${card.subtitle}. Click to cycle stack.`}\n              onFocus={() => setIsExpanded(true)}\n              onBlur={() => setIsExpanded(false)}\n              onClick={cycleFrontCard}\n              onKeyDown={(e) => {\n                if (e.key === \"Enter\" || e.key === \" \") {\n                  e.preventDefault();\n                  cycleFrontCard();\n                }\n              }}\n              animate={{\n                y: yOffset,\n                scale: shouldReduceMotion ? 1 : scale,\n                opacity,\n                zIndex: deck.length - index,\n              }}\n              transition={\n                shouldReduceMotion\n                  ? { duration: 0 }\n                  : { type: \"spring\", stiffness, damping }\n              }\n              className={cn(\n                \"absolute inset-x-0 top-0 cursor-pointer select-none rounded-2xl border p-5 shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-black dark:focus-visible:ring-white\",\n                isFront\n                  ? \"border-neutral-300 bg-white hover:border-black dark:border-[#2E2E2E] dark:bg-[#0D0D0D] dark:hover:border-white\"\n                  : \"border-neutral-200 bg-neutral-50/95 dark:border-[#222222] dark:bg-[#141414]/95\"\n              )}\n            >\n              <div className=\"flex items-center justify-between gap-2\">\n                <span className=\"inline-flex items-center gap-1.5 font-mono text-[10px] font-semibold uppercase tracking-wider text-neutral-500 dark:text-neutral-400\">\n                  {index === 0 ? (\n                    <Sparkles className=\"h-3 w-3 text-black dark:text-white\" />\n                  ) : index === 1 ? (\n                    <Layers className=\"h-3 w-3\" />\n                  ) : (\n                    <Terminal className=\"h-3 w-3\" />\n                  )}\n                  {card.badge}\n                </span>\n\n                <span className=\"inline-flex items-center gap-1 rounded-full border border-neutral-200 bg-neutral-100 px-2 py-0.5 font-mono text-[10px] font-bold text-black dark:border-[#262626] dark:bg-[#1B1B1B] dark:text-white\">\n                  {card.metric}\n                  <ArrowUpRight className=\"h-2.5 w-2.5\" />\n                </span>\n              </div>\n\n              <div className=\"mt-2.5 text-sm font-semibold text-black dark:text-white\">\n                {card.title}\n              </div>\n              <p className=\"mt-0.5 text-xs text-neutral-500 dark:text-neutral-400\">\n                {card.subtitle}\n              </p>\n            </motion.div>\n          );\n        })}\n      </div>\n\n      <div className=\"mt-4 text-center text-[11px] text-neutral-400 dark:text-neutral-500\">\n        Hover to fan out deck • Click any card to cycle stack\n      </div>\n    </div>\n  );\n}\n\nexport default AccordionStackCards;\n",
      "type": "registry:ui",
      "target": "components/ui/accordion-stack-cards.tsx"
    },
    {
      "path": "lib/utils.ts",
      "content": "import { type ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n  return twMerge(clsx(inputs));\n}\n\nexport async function copyToClipboard(text: string): Promise<boolean> {\n  if (typeof window === \"undefined\") return false;\n\n  try {\n    if (navigator.clipboard && window.isSecureContext) {\n      await navigator.clipboard.writeText(text);\n      return true;\n    }\n\n    const textArea = document.createElement(\"textarea\");\n    textArea.value = text;\n    textArea.style.position = \"fixed\";\n    textArea.style.left = \"-999999px\";\n    textArea.style.top = \"-999999px\";\n    document.body.appendChild(textArea);\n    textArea.focus();\n    textArea.select();\n    const succeeded = document.execCommand(\"copy\");\n    textArea.remove();\n    return succeeded;\n  } catch {\n    return false;\n  }\n}\n",
      "type": "registry:lib",
      "target": "lib/utils.ts"
    }
  ]
}
