{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "product-compare-table",
  "type": "registry:ui",
  "title": "Product Compare Table",
  "author": "Rishabh Bose <https://theb0se.vercel.app/>",
  "description": "Aligned multi-tier product comparison matrix with sticky frosted headers, check and dash indicators, highlighted tier column, and a live 'Show differences only' switch.",
  "dependencies": [
    "framer-motion",
    "lucide-react",
    "clsx",
    "tailwind-merge"
  ],
  "files": [
    {
      "path": "components/ui/product-compare-table.tsx",
      "content": "\"use client\";\n\nimport React, { useState, useMemo } from \"react\";\nimport { motion } from \"framer-motion\";\nimport { Check, Minus, Sparkles } from \"lucide-react\";\nimport { cn } from \"@/lib/utils\";\n\nexport interface CompareTier {\n  id: string;\n  name: string;\n  price: string;\n  badge?: string;\n  highlighted?: boolean;\n}\n\nexport interface CompareSpecRow {\n  feature: string;\n  category?: string;\n  values: Record<string, boolean | string>;\n}\n\nexport interface ProductCompareTableProps {\n  /** Columns / product tiers to compare */\n  tiers?: CompareTier[];\n  /** Specification rows with boolean (Check/Dash) or string values per tier id */\n  rows?: CompareSpecRow[];\n  /** Show toggle to filter only rows where tiers differ. Default: true */\n  allowDiffFilter?: boolean;\n  className?: string;\n}\n\nconst DEFAULT_TIERS: CompareTier[] = [\n  { id: \"core\", name: \"Core\", price: \"$0\" },\n  { id: \"pro\", name: \"Pro\", price: \"$29\", badge: \"Popular\", highlighted: true },\n  { id: \"enterprise\", name: \"Scale\", price: \"$99\" },\n];\n\nconst DEFAULT_ROWS: CompareSpecRow[] = [\n  {\n    feature: \"Framer Motion Spring Primitives\",\n    values: { core: true, pro: true, enterprise: true },\n  },\n  {\n    feature: \"CLI Registry Installation\",\n    values: { core: true, pro: true, enterprise: true },\n  },\n  {\n    feature: \"Dark & Light Theme Tokens\",\n    values: { core: true, pro: true, enterprise: true },\n  },\n  {\n    feature: \"Multi-Step Wizard & Command Menu\",\n    values: { core: false, pro: true, enterprise: true },\n  },\n  {\n    feature: \"Custom Figma Design Kit\",\n    values: { core: false, pro: true, enterprise: true },\n  },\n  {\n    feature: \"Dedicated SLA & Architecture Review\",\n    values: { core: false, pro: false, enterprise: true },\n  },\n  {\n    feature: \"Concurrent Team Seats\",\n    values: { core: \"1 seat\", pro: \"Up to 10\", enterprise: \"Unlimited\" },\n  },\n];\n\nexport function ProductCompareTable({\n  tiers = DEFAULT_TIERS,\n  rows = DEFAULT_ROWS,\n  allowDiffFilter = true,\n  className,\n}: ProductCompareTableProps) {\n  const [onlyDifferences, setOnlyDifferences] = useState(false);\n\n  const visibleRows = useMemo(() => {\n    if (!onlyDifferences) return rows;\n    return rows.filter((row) => {\n      const vals = tiers.map((t) => row.values[t.id]);\n      return new Set(vals).size > 1;\n    });\n  }, [rows, tiers, onlyDifferences]);\n\n  return (\n    <div\n      className={cn(\n        \"w-full max-w-2xl overflow-hidden rounded-3xl border border-neutral-200 bg-white shadow-sm dark:border-neutral-800 dark:bg-[#0A0A0A]\",\n        className\n      )}\n    >\n      {/* Top Filter Header */}\n      {allowDiffFilter && (\n        <div className=\"flex items-center justify-between border-b border-neutral-200 bg-neutral-50/70 px-5 py-3 dark:border-neutral-800 dark:bg-neutral-900/50\">\n          <span className=\"text-xs font-semibold text-neutral-900 dark:text-white\">\n            Compare Specifications\n          </span>\n\n          <button\n            type=\"button\"\n            role=\"switch\"\n            aria-checked={onlyDifferences}\n            onClick={() => setOnlyDifferences((v) => !v)}\n            className=\"inline-flex items-center gap-2 text-xs font-medium text-neutral-600 dark:text-neutral-300\"\n          >\n            <span>Show differences only</span>\n            <span\n              className={cn(\n                \"relative inline-flex h-5 w-9 items-center rounded-full p-0.5 transition-colors\",\n                onlyDifferences\n                  ? \"bg-neutral-900 dark:bg-white\"\n                  : \"bg-neutral-300 dark:bg-neutral-700\"\n              )}\n            >\n              <motion.span\n                layout\n                transition={{ type: \"spring\", stiffness: 500, damping: 32 }}\n                className={cn(\n                  \"h-4 w-4 rounded-full bg-white shadow-2xs dark:bg-black\",\n                  onlyDifferences ? \"ml-auto\" : \"ml-0\"\n                )}\n              />\n            </span>\n          </button>\n        </div>\n      )}\n\n      {/* Scrollable Table Container with Sticky Header */}\n      <div data-fullscreen-scroll className=\"max-h-[340px] overflow-auto\">\n        <table className=\"w-full border-collapse text-left text-xs\">\n          <thead className=\"sticky top-0 z-20 border-b border-neutral-200 bg-white/95 backdrop-blur-md dark:border-neutral-800 dark:bg-[#0A0A0A]/95\">\n            <tr>\n              <th className=\"min-w-[160px] px-5 py-4 font-mono text-[11px] font-semibold uppercase tracking-wider text-neutral-400\">\n                Feature\n              </th>\n              {tiers.map((tier) => (\n                <th\n                  key={tier.id}\n                  className={cn(\n                    \"min-w-[100px] px-4 py-3.5 text-center\",\n                    tier.highlighted &&\n                      \"bg-neutral-50/90 dark:bg-neutral-900/60\"\n                  )}\n                >\n                  <div className=\"flex flex-col items-center gap-0.5\">\n                    {tier.badge && (\n                      <span className=\"mb-0.5 inline-flex items-center gap-1 rounded-full bg-neutral-900 px-2 py-0.2 font-mono text-[9px] font-semibold uppercase text-white dark:bg-white dark:text-black\">\n                        <Sparkles className=\"h-2.5 w-2.5\" />\n                        {tier.badge}\n                      </span>\n                    )}\n                    <span className=\"text-xs font-bold text-neutral-950 dark:text-white\">\n                      {tier.name}\n                    </span>\n                    <span className=\"font-mono text-[11px] text-neutral-500 dark:text-neutral-400\">\n                      {tier.price}\n                    </span>\n                  </div>\n                </th>\n              ))}\n            </tr>\n          </thead>\n\n          <tbody className=\"divide-y divide-neutral-200/80 dark:divide-neutral-800/80\">\n            {visibleRows.map((row) => (\n              <tr\n                key={row.feature}\n                className=\"transition-colors hover:bg-neutral-50/60 dark:hover:bg-neutral-900/30\"\n              >\n                <td className=\"px-5 py-3.5 font-medium text-neutral-800 dark:text-neutral-200\">\n                  {row.feature}\n                </td>\n                {tiers.map((tier) => {\n                  const val = row.values[tier.id];\n                  return (\n                    <td\n                      key={tier.id}\n                      className={cn(\n                        \"px-4 py-3.5 text-center\",\n                        tier.highlighted &&\n                          \"bg-neutral-50/50 dark:bg-neutral-900/30\"\n                      )}\n                    >\n                      {typeof val === \"boolean\" ? (\n                        val ? (\n                          <span\n                            aria-label=\"Included\"\n                            className=\"mx-auto inline-flex h-5 w-5 items-center justify-center rounded-full bg-neutral-900 text-white dark:bg-white dark:text-black\"\n                          >\n                            <Check className=\"h-3 w-3 stroke-[2.5]\" />\n                          </span>\n                        ) : (\n                          <span\n                            aria-label=\"Not included\"\n                            className=\"mx-auto inline-flex h-5 w-5 items-center justify-center text-neutral-300 dark:text-neutral-700\"\n                          >\n                            <Minus className=\"h-3.5 w-3.5\" />\n                          </span>\n                        )\n                      ) : (\n                        <span className=\"font-mono text-[11px] font-semibold text-neutral-900 dark:text-white\">\n                          {val ?? \"—\"}\n                        </span>\n                      )}\n                    </td>\n                  );\n                })}\n              </tr>\n            ))}\n          </tbody>\n        </table>\n      </div>\n    </div>\n  );\n}\n\nexport default ProductCompareTable;\n",
      "type": "registry:ui",
      "target": "components/ui/product-compare-table.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"
    }
  ]
}
