{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "polar-pricing-card",
  "title": "Polar Pricing Card",
  "description": "Product pricing card with features list, price display, and checkout CTA. Supports monthly/yearly/one-time pricing.",
  "dependencies": [
    "@polar-sh/sdk"
  ],
  "registryDependencies": [],
  "files": [
    {
      "path": "registry/default/blocks/polar/polar-pricing-card/components/elements/polar-pricing-card.tsx",
      "content": "\"use client\";\n\nimport { useCallback, useState } from \"react\";\n\nfunction cn(...classes: (string | boolean | undefined)[]) {\n  return classes.filter(Boolean).join(\" \");\n}\n\nfunction CheckIcon({ className }: { className?: string }) {\n  return (\n    <svg\n      className={className}\n      xmlns=\"http://www.w3.org/2000/svg\"\n      width=\"16\"\n      height=\"16\"\n      viewBox=\"0 0 24 24\"\n      fill=\"none\"\n      stroke=\"currentColor\"\n      strokeWidth=\"2\"\n      strokeLinecap=\"round\"\n      strokeLinejoin=\"round\"\n    >\n      <polyline points=\"20 6 9 17 4 12\" />\n    </svg>\n  );\n}\n\nfunction SparklesIcon({ className }: { className?: string }) {\n  return (\n    <svg\n      className={className}\n      xmlns=\"http://www.w3.org/2000/svg\"\n      width=\"16\"\n      height=\"16\"\n      viewBox=\"0 0 24 24\"\n      fill=\"none\"\n      stroke=\"currentColor\"\n      strokeWidth=\"2\"\n      strokeLinecap=\"round\"\n      strokeLinejoin=\"round\"\n    >\n      <path d=\"m12 3-1.912 5.813a2 2 0 0 1-1.275 1.275L3 12l5.813 1.912a2 2 0 0 1 1.275 1.275L12 21l1.912-5.813a2 2 0 0 1 1.275-1.275L21 12l-5.813-1.912a2 2 0 0 1-1.275-1.275L12 3Z\" />\n      <path d=\"M5 3v4\" />\n      <path d=\"M19 17v4\" />\n      <path d=\"M3 5h4\" />\n      <path d=\"M17 19h4\" />\n    </svg>\n  );\n}\n\nexport interface PricingFeature {\n  text: string;\n  included?: boolean;\n}\n\nexport interface PolarPricingCardProps {\n  name: string;\n  description?: string;\n  price: number;\n  currency?: string;\n  interval?: \"month\" | \"year\" | \"one_time\";\n  features: (string | PricingFeature)[];\n  popular?: boolean;\n  highlighted?: boolean;\n  ctaText?: string;\n  ctaUrl?: string;\n  onCheckout?: () => void;\n  disabled?: boolean;\n  className?: string;\n}\n\nexport function PolarPricingCard({\n  name,\n  description,\n  price,\n  currency = \"$\",\n  interval = \"month\",\n  features,\n  popular = false,\n  highlighted = false,\n  ctaText = \"Get Started\",\n  ctaUrl,\n  onCheckout,\n  disabled = false,\n  className,\n}: PolarPricingCardProps) {\n  const [isHovered, setIsHovered] = useState(false);\n\n  const handleClick = useCallback(() => {\n    if (disabled) return;\n    if (onCheckout) {\n      onCheckout();\n    } else if (ctaUrl) {\n      window.location.href = ctaUrl;\n    }\n  }, [disabled, onCheckout, ctaUrl]);\n\n  const formatPrice = (price: number) => {\n    if (price === 0) return \"Free\";\n    return `${currency}${price}`;\n  };\n\n  const getIntervalText = () => {\n    if (price === 0) return \"\";\n    switch (interval) {\n      case \"month\":\n        return \"/mo\";\n      case \"year\":\n        return \"/yr\";\n      case \"one_time\":\n        return \"\";\n      default:\n        return \"/mo\";\n    }\n  };\n\n  return (\n    <div\n      data-slot=\"polar-pricing-card\"\n      className={cn(\n        \"relative flex flex-col rounded-2xl border bg-card p-6 shadow-sm transition-all duration-300\",\n        highlighted && \"border-primary bg-primary/5 shadow-lg shadow-primary/10\",\n        !highlighted && \"border-border hover:border-primary/50\",\n        isHovered && !highlighted && \"shadow-md\",\n        className\n      )}\n      onMouseEnter={() => setIsHovered(true)}\n      onMouseLeave={() => setIsHovered(false)}\n    >\n      {popular && (\n        <div\n          data-slot=\"popular-badge\"\n          className=\"absolute -top-3 left-1/2 -translate-x-1/2\"\n        >\n          <span className=\"inline-flex items-center gap-1 rounded-full bg-primary px-3 py-1 text-xs font-medium text-primary-foreground\">\n            <SparklesIcon className=\"h-3 w-3\" />\n            Most Popular\n          </span>\n        </div>\n      )}\n\n      <div data-slot=\"header\" className=\"mb-6\">\n        <h3\n          data-slot=\"name\"\n          className=\"text-lg font-semibold text-foreground\"\n        >\n          {name}\n        </h3>\n        {description && (\n          <p\n            data-slot=\"description\"\n            className=\"mt-1 text-sm text-muted-foreground\"\n          >\n            {description}\n          </p>\n        )}\n      </div>\n\n      <div data-slot=\"price\" className=\"mb-6\">\n        <span className=\"text-4xl font-bold text-foreground\">\n          {formatPrice(price)}\n        </span>\n        <span className=\"text-muted-foreground\">{getIntervalText()}</span>\n      </div>\n\n      <ul data-slot=\"features\" className=\"mb-8 flex-1 space-y-3\">\n        {features.map((feature, index) => {\n          const isString = typeof feature === \"string\";\n          const text = isString ? feature : feature.text;\n          const included = isString ? true : feature.included !== false;\n\n          return (\n            <li\n              key={index}\n              data-slot=\"feature\"\n              className={cn(\n                \"flex items-start gap-2 text-sm\",\n                included ? \"text-foreground\" : \"text-muted-foreground line-through\"\n              )}\n            >\n              <CheckIcon\n                className={cn(\n                  \"mt-0.5 h-4 w-4 shrink-0\",\n                  included ? \"text-primary\" : \"text-muted-foreground/50\"\n                )}\n              />\n              {text}\n            </li>\n          );\n        })}\n      </ul>\n\n      <button\n        data-slot=\"cta\"\n        type=\"button\"\n        onClick={handleClick}\n        disabled={disabled}\n        className={cn(\n          \"w-full rounded-lg px-4 py-2.5 text-sm font-medium transition-colors\",\n          highlighted\n            ? \"bg-primary text-primary-foreground hover:bg-primary/90\"\n            : \"bg-secondary text-secondary-foreground hover:bg-secondary/80\",\n          disabled && \"cursor-not-allowed opacity-50\"\n        )}\n      >\n        {ctaText}\n      </button>\n    </div>\n  );\n}\n",
      "type": "registry:component"
    }
  ],
  "docs": "A beautiful pricing card component for displaying product tiers. Supports popular badge, highlighted variant, and disabled states.",
  "categories": [
    "polar"
  ],
  "type": "registry:block"
}