{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "pricing-section",
  "title": "Pricing Section",
  "author": "AlgorizeTech",
  "description": "A compact pricing section with monthly and annual toggle. Use it when pricing is one part of a longer landing page rather than its own page.",
  "dependencies": [
    "lucide-react"
  ],
  "registryDependencies": [],
  "files": [
    {
      "path": "src/components/custom/blocks/PricingSection.tsx",
      "content": "\"use client\";\n\nimport {\n  ArrowRight,\n  Check,\n  Shield,\n  Sparkles,\n  Star,\n  TrendingUp,\n  Zap,\n} from \"lucide-react\";\nimport { useEffect, useMemo, useRef, useState } from \"react\";\n\nconst ICON_POOL = [Zap, TrendingUp, Sparkles, Star, Shield];\nconst getIcon = (index: number) => ICON_POOL[index % ICON_POOL.length];\n\nconst FeatureItem = ({ text }: { text: string }) => (\n  <li className=\"flex items-start gap-3 text-sm text-muted-foreground\">\n    <div className=\"mt-0.5 flex-shrink-0 rounded-full bg-muted p-1\">\n      <Check className=\"h-3 w-3 text-foreground\" />\n    </div>\n    <span className=\"leading-relaxed\">{text}</span>\n  </li>\n);\n\nconst AnimatedPrice = ({\n  value,\n  counting = true,\n}: {\n  value: number | string;\n  counting?: boolean;\n}) => {\n  const cleanValue = String(value);\n  const numericValue = parseFloat(cleanValue.replace(/[^0-9.]/g, \"\"));\n  const [displayValue, setDisplayValue] = useState(counting ? 0 : numericValue);\n\n  useEffect(() => {\n    // Both cases render the value directly, without reading state.\n    if (!counting || isNaN(numericValue)) return;\n    let startTime: number;\n    const duration = 600;\n    const startValue = 0;\n\n    const animate = (time: number) => {\n      if (!startTime) startTime = time;\n      const progress = Math.min((time - startTime) / duration, 1);\n      const easeProgress = 1 - Math.pow(1 - progress, 5);\n      setDisplayValue(startValue + (numericValue - startValue) * easeProgress);\n      if (progress < 1) requestAnimationFrame(animate);\n      else setDisplayValue(numericValue);\n    };\n    requestAnimationFrame(animate);\n  }, [numericValue, value, counting]);\n\n  if (isNaN(numericValue)) return <span>{cleanValue}</span>;\n  if (!counting) return <span>{cleanValue.replace(/[^0-9.]/g, \"\")}</span>;\n\n  const isDecimal = cleanValue.includes(\".\");\n  return (\n    <span>\n      {isDecimal\n        ? displayValue.toFixed(2)\n        : Math.round(displayValue).toLocaleString()}\n    </span>\n  );\n};\n\nexport interface PricingSectionPlan {\n  id: string | number;\n  name: string;\n  price: string | number;\n  description?: string;\n  features?: string[];\n  isFeatured?: boolean;\n  /** Which toggle the plan belongs to. */\n  type?: \"Subscription Based\" | \"Product Based\" | string;\n}\n\nexport interface PricingSectionProps {\n  packages?: PricingSectionPlan[];\n  /** Animate prices up from zero on mount. */\n  counting?: boolean;\n  /** Swap in your router link, e.g. `linkComponent={Link}`. */\n  linkComponent?: React.ElementType;\n}\n\nconst PricingSection = ({\n  packages,\n  counting = true,\n  linkComponent: Link = \"a\",\n}: PricingSectionProps) => {\n  const [pricingMode, setPricingMode] = useState(\"subscription\");\n  const containerRef = useRef(null);\n\n  const visiblePlans = useMemo(() => {\n    return (\n      packages?.filter((plan: PricingSectionPlan) =>\n        pricingMode === \"subscription\"\n          ? plan.type === \"Subscription Based\"\n          : plan.type === \"Product Based\",\n      ) || []\n    );\n  }, [pricingMode, packages]);\n\n  return (\n    <section\n      ref={containerRef}\n      id=\"pricing\"\n      className=\"relative overflow-hidden bg-background py-6 md:py-12 transition-colors duration-300\"\n    >\n      <div className=\"relative mx-auto max-w-7xl px-6 lg:px-8\">\n        <header className=\"mx-auto max-w-2xl text-center mb-8\">\n          <h2 className=\"pricing-header-el mt-2 text-4xl font-semibold text-foreground sm:text-5xl\">\n            Choose your plan\n          </h2>\n          <p className=\"pricing-header-el mt-6 text-lg text-muted-foreground\">\n            Flexible options for businesses of all sizes.\n          </p>\n\n          <div className=\"pricing-header-el mt-8 flex justify-center\">\n            <div className=\"relative flex rounded-full bg-muted p-1 ring-1 ring-border\">\n              <button\n                onClick={() => setPricingMode(\"subscription\")}\n                className={`relative z-10 rounded-full px-6 py-2 text-sm font-semibold transition ${\n                  pricingMode === \"subscription\"\n                    ? \"text-primary-foreground\"\n                    : \"text-muted-foreground hover:text-foreground\"\n                }`}\n              >\n                Subscriptions\n              </button>\n              <button\n                onClick={() => setPricingMode(\"product\")}\n                className={`relative z-10 rounded-full px-6 py-2 text-sm font-semibold transition ${\n                  pricingMode === \"product\"\n                    ? \"text-primary-foreground\"\n                    : \"text-muted-foreground hover:text-foreground\"\n                }`}\n              >\n                Project Based\n              </button>\n              <div\n                className={`absolute inset-y-1 w-1/2 rounded-full bg-primary transition-transform duration-300 ${\n                  pricingMode === \"product\"\n                    ? \"translate-x-full\"\n                    : \"translate-x-0\"\n                }`}\n              />\n            </div>\n          </div>\n        </header>\n\n        <div\n          key={pricingMode}\n          className=\"grid max-w-lg grid-cols-1 gap-8 mx-auto lg:max-w-none lg:grid-cols-3 text-left\"\n        >\n          {visiblePlans.length > 0 ? (\n            visiblePlans.map((plan: PricingSectionPlan, index: number) => {\n              const Icon = getIcon(index);\n              const price = parseFloat(String(plan.price));\n\n              return (\n                <div\n                  key={plan.id}\n                  className={`pricing-card-anim flex flex-col justify-between rounded-3xl bg-card p-8 ring-1 ring-border transition-all duration-300 ${\n                    plan.isFeatured\n                      ? \"lg:z-10 lg:scale-[1.08] ring-2 ring-primary shadow-xl shadow-primary/20 dark:shadow-[0_0_60px_-15px_color-mix(in_oklab,var(--primary)_40%,transparent)] bg-gradient-to-b from-primary/10 to-card\"\n                      : \"\"\n                  }`}\n                >\n                  <div>\n                    <div className=\"flex items-center justify-between\">\n                      <div className=\"flex items-center gap-3\">\n                        <Icon\n                          className={`h-6 w-6 ${\n                            plan.isFeatured\n                              ? \"text-primary\"\n                              : \"text-muted-foreground\"\n                          }`}\n                        />\n                        <h3\n                          className={`text-lg font-semibold ${\n                            plan.isFeatured\n                              ? \"text-primary\"\n                              : \"text-foreground\"\n                          }`}\n                        >\n                          {plan.name}\n                        </h3>\n                      </div>\n                      {plan.isFeatured && (\n                        <span className=\"rounded-full bg-primary px-3 py-1 text-xs font-semibold text-primary-foreground uppercase\">\n                          Popular\n                        </span>\n                      )}\n                    </div>\n\n                    <p className=\"mt-4 text-sm text-muted-foreground min-h-[48px]\">\n                      {plan.description}\n                    </p>\n\n                    <div className=\"mt-6 flex items-baseline gap-1\">\n                      <span className=\"text-4xl font-semibold text-foreground\">\n                        {price === 0 ? (\n                          \"Free\"\n                        ) : (\n                          <>\n                            $\n                            <AnimatedPrice value={price} counting={counting} />\n                          </>\n                        )}\n                      </span>\n                      {price > 0 && (\n                        <span className=\"text-sm text-muted-foreground\">\n                          {pricingMode === \"subscription\" ? `/month` : \"\"}\n                        </span>\n                      )}\n                    </div>\n\n                    <Link\n                      href=\"#\"\n                      className={`group mt-6 flex w-full items-center justify-center gap-2 rounded-xl py-3 px-4 text-sm font-semibold transition ${\n                        plan.isFeatured\n                          ? \"bg-primary text-primary-foreground hover:bg-primary/90\"\n                          : \"bg-muted text-foreground hover:bg-muted/70\"\n                      }`}\n                    >\n                      {price === 0\n                        ? \"Start Free\"\n                        : pricingMode === \"subscription\"\n                          ? \"Subscribe Now\"\n                          : \"Buy Now\"}\n                      <ArrowRight className=\"h-4 w-4 transition-transform group-hover:translate-x-1\" />\n                    </Link>\n\n                    <div className=\"mt-8 h-px w-full bg-border\" />\n\n                    <ul className=\"mt-8 space-y-3\">\n                      {plan.features?.map((feature: string, i: number) => (\n                        <FeatureItem key={`${plan.id}-${i}`} text={feature} />\n                      ))}\n                    </ul>\n                  </div>\n                </div>\n              );\n            })\n          ) : (\n            <div className=\"col-span-full py-12 text-center text-muted-foreground\">\n              No plans available.\n            </div>\n          )}\n        </div>\n      </div>\n    </section>\n  );\n};\n\nexport default PricingSection;",
      "type": "registry:component",
      "target": "components/custom/blocks/PricingSection.tsx"
    }
  ],
  "docs": "Named export: PricingSection. Self-contained with hardcoded plans — copy and adapt. Uses next/link, so it needs edits outside Next.js. Installs standalone with no registry dependencies.",
  "categories": [
    "commerce",
    "marketing"
  ],
  "type": "registry:component"
}
