{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "pricing-cards-section",
  "title": "Pricing Cards Section",
  "description": "A per-seat pricing section: a team size slider, monthly or yearly billing and a currency picker that recalculate every card's seat price and monthly total as they count, plans that grey out when the team is too big, and a compare all features table that opens below.",
  "dependencies": [
    "motion",
    "clsx",
    "tailwind-merge"
  ],
  "files": [
    {
      "path": "registry/new-york/pricing-cards-section/pricing-cards-section.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { AnimatePresence, animate, motion, useReducedMotion } from \"motion/react\";\nimport { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nfunction cn(...inputs: ClassValue[]) {\n  return twMerge(clsx(inputs));\n}\n\nexport type PricingBilling = \"monthly\" | \"yearly\";\n\nexport interface PricingCardPlan {\n  id: string;\n  name: string;\n  description?: string;\n  /** Price per seat per month in the base currency. null shows \"Custom\" (for enterprise). */\n  price: { monthly: number; yearly: number } | null;\n  /** Largest team the plan allows. Above it the card says so and its button is disabled. */\n  maxSeats?: number;\n  features: string[];\n  cta?: string;\n  href?: string;\n  highlighted?: boolean;\n  badge?: string;\n}\n\nexport interface PricingComparisonRow {\n  group?: string;\n  feature: string;\n  /** One value per plan, in plan order: true, false or a short text such as \"5 GB\". */\n  values: (boolean | string)[];\n}\n\nexport interface PricingCurrency {\n  code: string;\n  symbol: string;\n  /** Multiplier from the base currency. */\n  rate: number;\n}\n\nexport interface PricingSelection {\n  planId: string;\n  billing: PricingBilling;\n  seats: number;\n  currency: string;\n  /** Monthly total for all seats, or null for a custom plan. */\n  monthlyTotal: number | null;\n}\n\nexport interface PricingCardsSectionProps {\n  eyebrow?: string;\n  title?: string;\n  description?: string;\n  plans?: PricingCardPlan[];\n  comparison?: PricingComparisonRow[];\n  currencies?: PricingCurrency[];\n  defaultBilling?: PricingBilling;\n  defaultSeats?: number;\n  /** Highest value on the seat slider. */\n  seatLimit?: number;\n  /** Shown next to the Yearly option. */\n  yearlyNote?: string;\n  onSelect?: (selection: PricingSelection) => void;\n  theme?: \"dark\" | \"light\";\n  className?: string;\n}\n\nconst PALETTES = {\n  dark: {\n    bg: \"#0A0A0A\",\n    text: \"#F5F4F1\",\n    muted: \"rgba(245,244,241,0.6)\",\n    faint: \"rgba(245,244,241,0.38)\",\n    card: \"#111111\",\n    cardHi: \"#161616\",\n    border: \"rgba(255,255,255,0.1)\",\n    borderHi: \"rgba(255,255,255,0.32)\",\n    track: \"rgba(255,255,255,0.1)\",\n    primary: \"#F5F4F1\",\n    onPrimary: \"#0A0A0A\",\n    secondary: \"rgba(255,255,255,0.06)\",\n    ok: \"#4ADE80\",\n    ring: \"rgba(245,244,241,0.6)\",\n    row: \"rgba(255,255,255,0.03)\",\n  },\n  light: {\n    bg: \"#FAFAF8\",\n    text: \"#0A0A0A\",\n    muted: \"rgba(10,10,10,0.6)\",\n    faint: \"rgba(10,10,10,0.4)\",\n    card: \"#FFFFFF\",\n    cardHi: \"#FFFFFF\",\n    border: \"rgba(10,10,10,0.1)\",\n    borderHi: \"rgba(10,10,10,0.4)\",\n    track: \"rgba(10,10,10,0.1)\",\n    primary: \"#0A0A0A\",\n    onPrimary: \"#FAFAF8\",\n    secondary: \"rgba(10,10,10,0.05)\",\n    ok: \"#16A34A\",\n    ring: \"rgba(10,10,10,0.5)\",\n    row: \"rgba(10,10,10,0.025)\",\n  },\n};\n\nconst DEFAULT_PLANS: PricingCardPlan[] = [\n  { id: \"starter\", name: \"Starter\", description: \"For small teams getting organised.\", price: { monthly: 15, yearly: 12 }, maxSeats: 10, features: [\"Unlimited projects\", \"Docs and boards\", \"7-day history\", \"Email support\"], cta: \"Start free\" },\n  { id: \"pro\", name: \"Pro\", description: \"For teams that ship every week.\", price: { monthly: 35, yearly: 29 }, features: [\"Everything in Starter\", \"Roadmaps and timelines\", \"Git sync and automations\", \"Unlimited history\", \"Priority support\"], cta: \"Start a trial\", highlighted: true, badge: \"Most popular\" },\n  { id: \"enterprise\", name: \"Enterprise\", description: \"For companies with many teams.\", price: null, features: [\"Everything in Pro\", \"SSO and SCIM\", \"Audit log and data residency\", \"99.95% uptime SLA\", \"A named success manager\"], cta: \"Talk to sales\" },\n];\n\nconst DEFAULT_COMPARISON: PricingComparisonRow[] = [\n  { group: \"Workspace\", feature: \"Projects\", values: [\"Unlimited\", \"Unlimited\", \"Unlimited\"] },\n  { feature: \"Storage per seat\", values: [\"5 GB\", \"50 GB\", \"Custom\"] },\n  { feature: \"Version history\", values: [\"7 days\", \"Unlimited\", \"Unlimited\"] },\n  { group: \"Planning\", feature: \"Roadmaps and timelines\", values: [false, true, true] },\n  { feature: \"Automations\", values: [false, \"1,000 runs / mo\", \"Unlimited\"] },\n  { feature: \"Git sync\", values: [false, true, true] },\n  { group: \"Security\", feature: \"SSO and SCIM\", values: [false, false, true] },\n  { feature: \"Audit log\", values: [false, false, true] },\n  { feature: \"Uptime SLA\", values: [false, false, \"99.95%\"] },\n];\n\nconst DEFAULT_CURRENCIES: PricingCurrency[] = [\n  { code: \"USD\", symbol: \"$\", rate: 1 },\n  { code: \"EUR\", symbol: \"€\", rate: 0.92 },\n  { code: \"GBP\", symbol: \"£\", rate: 0.79 },\n];\n\nfunction money(n: number, symbol: string) {\n  const rounded = n >= 100 ? Math.round(n) : Math.round(n * 100) / 100;\n  return `${symbol}${rounded.toLocaleString(\"en-US\", { minimumFractionDigits: rounded % 1 ? 2 : 0, maximumFractionDigits: 2 })}`;\n}\n\n/* Tweens between values so prices count up and down instead of jumping. */\nfunction Rolling({ value, format, reduce }: { value: number; format: (n: number) => string; reduce: boolean }) {\n  const [shown, setShown] = React.useState(value);\n  const from = React.useRef(value);\n  React.useEffect(() => {\n    if (reduce) {\n      from.current = value;\n      const id = setTimeout(() => setShown(value), 0);\n      return () => clearTimeout(id);\n    }\n    const c = animate(from.current, value, { duration: 0.45, ease: [0.2, 0.7, 0.2, 1], onUpdate: (v) => setShown(v) });\n    from.current = value;\n    return () => c.stop();\n  }, [value, reduce]);\n  return <>{format(shown)}</>;\n}\n\nexport function PricingCardsSection({\n  eyebrow = \"Pricing\",\n  title = \"Pay for the seats you use\",\n  description = \"Every plan includes unlimited projects and guests. Change seats any time; we prorate the difference.\",\n  plans = DEFAULT_PLANS,\n  comparison = DEFAULT_COMPARISON,\n  currencies = DEFAULT_CURRENCIES,\n  defaultBilling = \"yearly\",\n  defaultSeats = 8,\n  seatLimit = 100,\n  yearlyNote = \"2 months free\",\n  onSelect,\n  theme = \"dark\",\n  className,\n}: PricingCardsSectionProps) {\n  const p = PALETTES[theme];\n  const reduce = !!useReducedMotion();\n  const uid = React.useId();\n  const [billing, setBilling] = React.useState<PricingBilling>(defaultBilling);\n  const [seats, setSeats] = React.useState(Math.min(seatLimit, Math.max(1, defaultSeats)));\n  const [code, setCode] = React.useState(currencies[0]?.code ?? \"USD\");\n  const [open, setOpen] = React.useState(false);\n  const cur = currencies.find((c) => c.code === code) ?? currencies[0] ?? DEFAULT_CURRENCIES[0];\n  const ring = { [\"--tw-ring-color\" as string]: p.ring, [\"--tw-ring-offset-color\" as string]: p.bg } as React.CSSProperties;\n  const focus = \"outline-none focus-visible:ring-2 focus-visible:ring-offset-2\";\n  const pct = ((seats - 1) / Math.max(1, seatLimit - 1)) * 100;\n\n  return (\n    <section className={cn(\"@container w-full\", className)} style={{ background: p.bg, color: p.text }}>\n      <div className=\"mx-auto max-w-6xl px-6 py-20 @[640px]:py-24\">\n        <div className=\"mx-auto max-w-2xl text-center\">\n          {eyebrow && <p className=\"m-0 text-[13px] font-medium tracking-[0.12em] uppercase\" style={{ color: p.faint }}>{eyebrow}</p>}\n          <h2 className=\"mt-3 mb-0 text-[34px] leading-[1.1] font-semibold tracking-[-0.03em] @[640px]:text-[46px]\">{title}</h2>\n          {description && <p className=\"mt-4 mb-0 text-[16px] leading-[1.6] @[640px]:text-[17px]\" style={{ color: p.muted }}>{description}</p>}\n        </div>\n\n        {/* Controls */}\n        <div className=\"mx-auto mt-10 grid max-w-3xl grid-cols-1 items-center gap-5 rounded-2xl border p-4 @[640px]:grid-cols-[auto_1fr_auto] @[640px]:gap-6 @[640px]:p-5\" style={{ borderColor: p.border, background: p.card }}>\n          <div role=\"radiogroup\" aria-label=\"Billing period\" className=\"inline-flex justify-self-start rounded-full p-1\" style={{ background: p.secondary }}>\n            {([\"monthly\", \"yearly\"] as const).map((b) => (\n              <button key={b} type=\"button\" role=\"radio\" aria-checked={billing === b} onClick={() => setBilling(b)} className={cn(\"relative flex h-8 cursor-pointer items-center gap-1.5 rounded-full border-0 bg-transparent px-3.5 text-[13px] font-medium\", focus)} style={{ color: billing === b ? p.onPrimary : p.muted, ...ring }}>\n                {billing === b && <motion.span layoutId={`${uid}-billing`} className=\"absolute inset-0 rounded-full\" style={{ background: p.primary }} transition={reduce ? { duration: 0 } : { type: \"spring\", stiffness: 420, damping: 34 }} />}\n                <span className=\"relative\">{b === \"monthly\" ? \"Monthly\" : \"Yearly\"}</span>\n                {b === \"yearly\" && yearlyNote && (\n                  <span className=\"relative rounded-full px-1.5 py-px text-[10.5px] font-semibold\" style={{ background: billing === b ? \"rgba(0,0,0,0.12)\" : p.secondary, color: billing === b ? p.onPrimary : p.ok }}>\n                    {yearlyNote}\n                  </span>\n                )}\n              </button>\n            ))}\n          </div>\n          <div className=\"min-w-0\">\n            <div className=\"flex items-baseline justify-between text-[13px]\">\n              <label htmlFor={`${uid}-seats`} style={{ color: p.muted }}>\n                Team size\n              </label>\n              <span className=\"font-semibold tabular-nums\">\n                {seats} {seats === 1 ? \"seat\" : \"seats\"}\n              </span>\n            </div>\n            <div className=\"relative mt-2 h-5\">\n              <div className=\"absolute top-1/2 right-0 left-0 h-1.5 -translate-y-1/2 rounded-full\" style={{ background: p.track }} />\n              <div className=\"absolute top-1/2 left-0 h-1.5 -translate-y-1/2 rounded-full\" style={{ width: `${pct}%`, background: p.primary }} />\n              <input\n                id={`${uid}-seats`}\n                type=\"range\"\n                min={1}\n                max={seatLimit}\n                value={seats}\n                onChange={(e) => setSeats(Number(e.target.value))}\n                aria-valuetext={`${seats} seats`}\n                className=\"peer absolute inset-0 z-10 w-full cursor-pointer appearance-none bg-transparent opacity-0\"\n              />\n              <span aria-hidden=\"true\" className=\"pointer-events-none absolute top-1/2 h-5 w-5 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 shadow peer-focus-visible:ring-2 peer-focus-visible:ring-offset-2\" style={{ left: `${pct}%`, background: p.bg, borderColor: p.primary, ...ring }} />\n            </div>\n          </div>\n          {currencies.length > 1 && (\n            <div className=\"justify-self-start @[640px]:justify-self-end\">\n              <label htmlFor={`${uid}-cur`} className=\"sr-only\">\n                Currency\n              </label>\n              <select id={`${uid}-cur`} value={code} onChange={(e) => setCode(e.target.value)} className={cn(\"h-9 cursor-pointer rounded-full border px-3 text-[13px] font-medium\", focus)} style={{ background: p.secondary, borderColor: p.border, color: p.text, ...ring }}>\n                {currencies.map((c) => (\n                  <option key={c.code} value={c.code} style={{ background: p.card, color: p.text }}>\n                    {c.symbol} {c.code}\n                  </option>\n                ))}\n              </select>\n            </div>\n          )}\n        </div>\n\n        {/* Cards */}\n        <div className={cn(\"mt-8 grid grid-cols-1 gap-4\", plans.length === 4 ? \"@[640px]:grid-cols-2 @[1100px]:grid-cols-4\" : plans.length >= 3 ? \"@[860px]:grid-cols-3\" : \"@[640px]:grid-cols-2\")}>\n          {plans.map((plan) => {\n            const unit = plan.price ? plan.price[billing] * cur.rate : null;\n            const total = unit === null ? null : unit * seats;\n            const tooBig = plan.maxSeats !== undefined && seats > plan.maxSeats;\n            return (\n              <motion.article\n                key={plan.id}\n                layout={!reduce}\n                className=\"relative flex flex-col rounded-2xl border p-6 transition-opacity\"\n                style={{ background: plan.highlighted ? p.cardHi : p.card, borderColor: plan.highlighted ? p.borderHi : p.border, opacity: tooBig ? 0.55 : 1 }}\n                aria-labelledby={`${uid}-${plan.id}`}\n              >\n                {plan.badge && (\n                  <span className=\"absolute top-5 right-5 rounded-full px-2.5 py-1 text-[11.5px] font-semibold\" style={{ background: p.primary, color: p.onPrimary }}>\n                    {plan.badge}\n                  </span>\n                )}\n                <h3 id={`${uid}-${plan.id}`} className=\"m-0 text-[18px] font-semibold\">\n                  {plan.name}\n                </h3>\n                {plan.description && <p className={cn(\"m-0 mt-1.5 text-[14px] leading-[1.5]\", plan.badge && \"pr-24\")} style={{ color: p.muted }}>{plan.description}</p>}\n                <div className=\"mt-6 flex items-baseline gap-1.5\" aria-live=\"polite\">\n                  <span className=\"text-[42px] leading-none font-semibold tracking-[-0.03em] tabular-nums\">{unit === null ? \"Custom\" : <Rolling value={unit} reduce={reduce} format={(n) => money(n, cur.symbol)} />}</span>\n                  {unit !== null && <span className=\"text-[13px]\" style={{ color: p.faint }}>per seat / month</span>}\n                </div>\n                <p className=\"m-0 mt-2 min-h-[20px] text-[13px] tabular-nums\" style={{ color: tooBig ? p.text : p.muted }}>\n                  {tooBig ? `Up to ${plan.maxSeats} seats. Pick a bigger plan for ${seats}.` : total === null ? `Volume pricing for ${seats}+ seats` : (\n                    <>\n                      <Rolling value={total} reduce={reduce} format={(n) => money(n, cur.symbol)} /> / month for {seats} {seats === 1 ? \"seat\" : \"seats\"}\n                      {billing === \"yearly\" ? \", billed yearly\" : \"\"}\n                    </>\n                  )}\n                </p>\n                <ul className=\"m-0 mt-6 flex flex-1 list-none flex-col gap-2.5 p-0\">\n                  {plan.features.map((f) => (\n                    <li key={f} className=\"flex gap-2.5 text-[14px] leading-[1.45]\" style={{ color: p.muted }}>\n                      <svg className=\"mt-[3px] shrink-0\" width=\"14\" height=\"14\" viewBox=\"0 0 16 16\" fill=\"none\" stroke={p.ok} strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n                        <path d=\"m3 8.5 3 3 7-7\" />\n                      </svg>\n                      <span style={{ color: p.text }}>{f}</span>\n                    </li>\n                  ))}\n                </ul>\n                {plan.href && !tooBig ? (\n                  <a href={plan.href} onClick={() => onSelect?.({ planId: plan.id, billing, seats, currency: cur.code, monthlyTotal: total })} className={cn(\"mt-7 inline-flex h-11 items-center justify-center rounded-full text-[14.5px] font-medium no-underline transition-opacity hover:opacity-90\", focus)} style={{ background: plan.highlighted ? p.primary : p.secondary, color: plan.highlighted ? p.onPrimary : p.text, border: plan.highlighted ? \"none\" : `1px solid ${p.border}`, ...ring }}>\n                    {plan.cta ?? \"Choose plan\"}\n                  </a>\n                ) : (\n                  <button type=\"button\" disabled={tooBig} onClick={() => onSelect?.({ planId: plan.id, billing, seats, currency: cur.code, monthlyTotal: total })} className={cn(\"mt-7 h-11 cursor-pointer rounded-full text-[14.5px] font-medium transition-opacity hover:opacity-90 disabled:cursor-not-allowed\", focus)} style={{ background: plan.highlighted ? p.primary : p.secondary, color: plan.highlighted ? p.onPrimary : p.text, border: plan.highlighted ? \"none\" : `1px solid ${p.border}`, ...ring }}>\n                    {plan.cta ?? \"Choose plan\"}\n                  </button>\n                )}\n              </motion.article>\n            );\n          })}\n        </div>\n\n        {/* Comparison */}\n        {comparison.length > 0 && (\n          <div className=\"mt-10\">\n            <div className=\"flex justify-center\">\n              <button type=\"button\" aria-expanded={open} aria-controls={`${uid}-compare`} onClick={() => setOpen((v) => !v)} className={cn(\"inline-flex h-10 cursor-pointer items-center gap-2 rounded-full border px-4 text-[14px] font-medium\", focus)} style={{ borderColor: p.border, background: \"transparent\", color: p.text, ...ring }}>\n                {open ? \"Hide the comparison\" : \"Compare all features\"}\n                <motion.svg width=\"14\" height=\"14\" viewBox=\"0 0 16 16\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.8\" strokeLinecap=\"round\" animate={{ rotate: open ? 180 : 0 }} transition={{ duration: reduce ? 0 : 0.2 }} aria-hidden=\"true\">\n                  <path d=\"m4 6 4 4 4-4\" />\n                </motion.svg>\n              </button>\n            </div>\n            <AnimatePresence initial={false}>\n              {open && (\n                <motion.div id={`${uid}-compare`} initial={reduce ? false : { height: 0, opacity: 0 }} animate={{ height: \"auto\", opacity: 1 }} exit={reduce ? undefined : { height: 0, opacity: 0 }} transition={{ duration: 0.3 }} className=\"overflow-hidden\">\n                  <div className=\"mt-6 overflow-x-auto rounded-2xl border\" style={{ borderColor: p.border }}>\n                    <table className=\"w-full min-w-[560px] border-collapse text-left text-[14px]\">\n                      <caption className=\"sr-only\">Features by plan</caption>\n                      <thead>\n                        <tr style={{ background: p.card }}>\n                          <th scope=\"col\" className=\"w-[34%] px-5 py-3.5 text-[12.5px] font-medium\" style={{ color: p.faint }}>\n                            Feature\n                          </th>\n                          {plans.map((pl) => (\n                            <th key={pl.id} scope=\"col\" className=\"px-5 py-3.5 text-[14px] font-semibold\">\n                              {pl.name}\n                            </th>\n                          ))}\n                        </tr>\n                      </thead>\n                      <tbody>\n                        {comparison.map((row, ri) => (\n                          <React.Fragment key={row.feature}>\n                            {row.group && (\n                              <tr>\n                                <th colSpan={plans.length + 1} scope=\"colgroup\" className=\"px-5 pt-5 pb-2 text-[11.5px] font-semibold tracking-[0.1em] uppercase\" style={{ color: p.faint, borderTop: ri ? `1px solid ${p.border}` : undefined }}>\n                                  {row.group}\n                                </th>\n                              </tr>\n                            )}\n                            <tr style={{ background: ri % 2 ? p.row : \"transparent\" }}>\n                              <th scope=\"row\" className=\"px-5 py-3 font-normal\" style={{ color: p.muted }}>\n                                {row.feature}\n                              </th>\n                              {plans.map((pl, pi) => {\n                                const v = row.values[pi];\n                                return (\n                                  <td key={pl.id} className=\"px-5 py-3 tabular-nums\">\n                                    {v === true ? (\n                                      <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" stroke={p.ok} strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" role=\"img\" aria-label=\"Included\">\n                                        <path d=\"m3 8.5 3 3 7-7\" />\n                                      </svg>\n                                    ) : v === false || v === undefined ? (\n                                      <span aria-label=\"Not included\" style={{ color: p.faint }}>\n                                        –\n                                      </span>\n                                    ) : (\n                                      v\n                                    )}\n                                  </td>\n                                );\n                              })}\n                            </tr>\n                          </React.Fragment>\n                        ))}\n                      </tbody>\n                    </table>\n                  </div>\n                </motion.div>\n              )}\n            </AnimatePresence>\n          </div>\n        )}\n      </div>\n    </section>\n  );\n}\n\nexport default PricingCardsSection;\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}