{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "pricing-table",
  "title": "Pricing Table",
  "description": "Pricing with an honest yearly anchor, in three forms: three plans with one raised, a side-by-side feature matrix with a sticky plan header, or one plan priced by the seat.",
  "dependencies": [
    "lucide-react",
    "motion"
  ],
  "registryDependencies": [
    "utils",
    "https://miseui.junsu4621.workers.dev/r/motion.json",
    "https://miseui.junsu4621.workers.dev/r/badge.json",
    "https://miseui.junsu4621.workers.dev/r/button.json",
    "https://miseui.junsu4621.workers.dev/r/card.json",
    "https://miseui.junsu4621.workers.dev/r/label.json",
    "https://miseui.junsu4621.workers.dev/r/number-input.json",
    "https://miseui.junsu4621.workers.dev/r/scroll-shadow.json",
    "https://miseui.junsu4621.workers.dev/r/switch.json"
  ],
  "files": [
    {
      "path": "registry/miseui/blocks/pricing-table.tsx",
      "content": "import { PricingCards } from \"./pricing-table-cards\"\nimport { PricingComparison } from \"./pricing-table-comparison\"\nimport type { PricingCommonProps } from \"./pricing-table-billing\"\nimport type { PricingBilling, PricingFeature, PricingPlan } from \"./pricing-table-parts\"\nimport type { PricingSeatProps } from \"./pricing-table-seats\"\nimport { PricingSingle } from \"./pricing-table-single\"\n\ntype PricingTableVariant = \"cards\" | \"comparison\" | \"single\"\n\ninterface PricingTableProps extends PricingCommonProps, PricingSeatProps {\n  /** `cards` three plans with one raised, `comparison` every row side by side, `single` one plan priced by the seat. */\n  variant?: PricingTableVariant\n  /** Sends a beam around the recommended plan instead of its still accent border, on `cards`. */\n  beam?: boolean\n  /** On `comparison`, how far below the top of the page the plan header sticks: the height of your fixed site header, in px. */\n  stickyTop?: number\n}\n\nfunction PricingTable({ variant, beam, stickyTop, seats, defaultSeats, minSeats, maxSeats, onSeatsChange, ...props }: PricingTableProps) {\n  switch (variant) {\n    case \"comparison\":\n      return <PricingComparison stickyTop={stickyTop} {...props} />\n    case \"single\":\n      return <PricingSingle seat={{ seats, defaultSeats, minSeats, maxSeats, onSeatsChange }} {...props} />\n    default:\n      return <PricingCards beam={beam} {...props} />\n  }\n}\n\nexport { PricingTable, type PricingBilling, type PricingFeature, type PricingPlan, type PricingTableProps, type PricingTableVariant }\n",
      "type": "registry:component"
    },
    {
      "path": "registry/miseui/blocks/pricing-table-parts.tsx",
      "content": "import { Check, Loader2, Minus } from \"lucide-react\"\nimport { motion, useReducedMotion } from \"motion/react\"\nimport { SPRING_DEFAULT } from \"@/registry/miseui/lib/motion\"\nimport { cn } from \"@/registry/miseui/lib/utils\"\nimport { Badge } from \"@/registry/miseui/ui/badge\"\nimport { Button } from \"@/registry/miseui/ui/button\"\nimport { Card } from \"@/registry/miseui/ui/card\"\n\ntype PricingBilling = \"monthly\" | \"yearly\"\n\ninterface PricingFeature {\n  label: string\n  /** Text such as \"Unlimited\", or a plain yes or no. */\n  value: string | boolean\n  /** A heading the row sits under on `comparison`. Rows with the same group stay together. */\n  group?: string\n}\n\ninterface PricingPlan {\n  id: string\n  name: string\n  description: string\n  /** Price per month on the monthly plan. */\n  monthly: number\n  /** Price per month when billed yearly. Keep it true: this is what the crossed-out anchor is compared with. */\n  yearly: number\n  cta: string\n  /** The plan that carries the visual weight. Mark one. */\n  recommended?: boolean\n  /** Same rows in the same order on every plan, so the eye can read straight across. */\n  features: readonly PricingFeature[]\n}\n\nconst MONTHS_IN_YEAR = 12\nconst PRICE_START = { opacity: 0, y: 8 }\nconst PRICE_END = { opacity: 1, y: 0 }\n\n/** What a plan's price means in words, so a yearly number never hides what actually gets charged. */\nfunction billingNote(plan: PricingPlan, billing: PricingBilling, currency: string) {\n  if (plan.monthly === 0) return \"No card needed\"\n  return billing === \"yearly\" ? `${formatMoney(plan.yearly * MONTHS_IN_YEAR, currency)} billed yearly` : \"Billed monthly\"\n}\n\nfunction formatMoney(amount: number, currency: string) {\n  return new Intl.NumberFormat(\"en-US\", {\n    style: \"currency\",\n    currency,\n    minimumFractionDigits: Number.isInteger(amount) ? 0 : 2,\n    maximumFractionDigits: 2,\n  }).format(amount)\n}\n\ninterface PlanPriceProps {\n  plan: PricingPlan\n  billing: PricingBilling\n  currency: string\n}\n\nfunction PlanPrice({ plan, billing, currency }: PlanPriceProps) {\n  const reduceMotion = useReducedMotion()\n  const yearly = billing === \"yearly\"\n  const amount = yearly ? plan.yearly : plan.monthly\n  const anchored = yearly && plan.monthly > plan.yearly\n  return (\n    <div className=\"flex flex-col gap-1 px-6\">\n      <div className=\"flex flex-wrap items-baseline gap-x-2\">\n        {anchored ? (\n          <s data-testid=\"anchor-price\" className=\"text-[15px] text-muted-foreground tabular-nums\">\n            <span className=\"sr-only\">Monthly price </span>\n            {formatMoney(plan.monthly, currency)}\n          </s>\n        ) : null}\n        <motion.span\n          key={billing}\n          className={cn(\"text-display tabular-nums\", plan.recommended ? \"text-4xl\" : \"text-3xl\")}\n          initial={reduceMotion ? false : PRICE_START}\n          animate={PRICE_END}\n          transition={SPRING_DEFAULT}\n        >\n          {formatMoney(amount, currency)}\n        </motion.span>\n        <span className=\"text-[13px] text-muted-foreground\">/ month</span>\n      </div>\n      <p className=\"text-[13px] text-muted-foreground\">{billingNote(plan, billing, currency)}</p>\n    </div>\n  )\n}\n\nfunction FeatureValue({ value }: { value: string | boolean }) {\n  if (typeof value === \"string\") return <span className=\"text-right\">{value}</span>\n  const Icon = value ? Check : Minus\n  return (\n    <span className=\"grid size-4 shrink-0 place-items-center\">\n      <span className=\"sr-only\">{value ? \"Included\" : \"Not included\"}</span>\n      <Icon aria-hidden=\"true\" className={cn(\"size-4\", !value && \"text-muted-foreground\")} />\n    </span>\n  )\n}\n\ninterface PlanCardProps {\n  plan: PricingPlan\n  billing: PricingBilling\n  currency: string\n  /** Let the light travel around the recommended plan. Off by default: a loop on a page people read is decoration. */\n  beam: boolean\n  pending: boolean\n  current: boolean\n  disabled: boolean\n  onSelect?: (planId: string, billing: PricingBilling) => void\n}\n\n/** A subgrid row per region, so prices, buttons and feature rows line up across plans whatever the copy length. */\nfunction PlanCard({ plan, billing, currency, beam, pending, current, disabled, onSelect }: PlanCardProps) {\n  const emphasized = Boolean(plan.recommended)\n  return (\n    <Card\n      effect={emphasized && beam ? \"beam\" : undefined}\n      data-recommended={emphasized ? \"true\" : undefined}\n      className={cn(\n        \"row-span-4 grid grid-rows-subgrid rounded-2xl\",\n        emphasized\n          ? \"z-10 order-first bg-popover shadow-[0_24px_48px_-24px_color-mix(in_oklab,var(--mise)_32%,oklch(0_0_0/40%))] @3xl:order-none @3xl:-my-6 @3xl:py-12\"\n          : \"bg-card shadow-none\",\n        emphasized && !beam && \"border-mise/60\",\n      )}\n    >\n      <div className=\"flex flex-col gap-2 px-6\">\n        <div className=\"flex items-center justify-between gap-2\">\n          <h3 className=\"text-[15px] font-medium\">{plan.name}</h3>\n          {emphasized ? <Badge variant=\"mise\">Recommended</Badge> : null}\n        </div>\n        <p className=\"text-[13px] leading-relaxed text-pretty text-muted-foreground\">{plan.description}</p>\n      </div>\n      <PlanPrice plan={plan} billing={billing} currency={currency} />\n      <div className=\"px-6\">\n        <Button\n          variant={emphasized ? \"mise\" : \"outline\"}\n          disabled={disabled || current}\n          aria-busy={pending || undefined}\n          onClick={() => onSelect?.(plan.id, billing)}\n          className=\"w-full\"\n        >\n          {pending ? <Loader2 aria-hidden=\"true\" className=\"animate-spin motion-reduce:animate-none\" /> : null}\n          {current ? \"Current plan\" : plan.cta}\n        </Button>\n      </div>\n      <ul aria-label={`${plan.name} features`} className=\"flex flex-col px-6 text-[13px] leading-relaxed\">\n        {plan.features.map((feature) => (\n          <li key={feature.label} className=\"flex items-center justify-between gap-3 border-t py-2\">\n            <span className=\"min-w-0 text-muted-foreground\">{feature.label}</span>\n            <FeatureValue value={feature.value} />\n          </li>\n        ))}\n      </ul>\n    </Card>\n  )\n}\n\nexport { FeatureValue, MONTHS_IN_YEAR, PlanCard, billingNote, formatMoney, type PricingBilling, type PricingFeature, type PricingPlan }\n",
      "type": "registry:component"
    },
    {
      "path": "registry/miseui/blocks/pricing-table-billing.tsx",
      "content": "import type * as React from \"react\"\nimport { useId, useState } from \"react\"\nimport { Label } from \"@/registry/miseui/ui/label\"\nimport { Switch } from \"@/registry/miseui/ui/switch\"\nimport type { PricingBilling, PricingPlan } from \"./pricing-table-parts\"\n\nconst PERCENT = 100\n\n/** Props every design takes, so switching `variant` never means rewiring the page. */\ninterface PricingCommonProps extends Omit<React.ComponentProps<\"section\">, \"title\" | \"onSelect\"> {\n  plans?: readonly PricingPlan[]\n  /** Control the toggle yourself. Leave it out and the block keeps its own state, starting from `defaultBilling`. */\n  billing?: PricingBilling\n  defaultBilling?: PricingBilling\n  onBillingChange?: (billing: PricingBilling) => void\n  /** `seats` is only passed on the `single` design, where the seat count is chosen here. */\n  onSelect?: (planId: string, billing: PricingBilling, seats?: number) => void\n  title?: string\n  /** The muted second sentence of the heading. */\n  description?: string\n  /** ISO 4217 code. */\n  currency?: string\n  /** The plan whose checkout is opening. Every button waits meanwhile. */\n  pendingPlanId?: string\n  /** The plan this customer is already on. */\n  currentPlanId?: string\n  /** Checkout failed. Shown under the plans. */\n  error?: string\n}\n\n/** The biggest saving real prices allow. Computed, never typed in, so the claim cannot drift from the numbers. */\nfunction bestYearlySaving(plans: readonly PricingPlan[]) {\n  const savings = plans\n    .filter((plan) => plan.monthly > 0)\n    .map((plan) => Math.round(((plan.monthly - plan.yearly) / plan.monthly) * PERCENT))\n  return Math.max(0, ...savings)\n}\n\nfunction useBilling(billing: PricingBilling | undefined, defaultBilling: PricingBilling, onBillingChange?: (billing: PricingBilling) => void) {\n  const [uncontrolled, setUncontrolled] = useState(defaultBilling)\n  const change = (next: PricingBilling) => {\n    setUncontrolled(next)\n    onBillingChange?.(next)\n  }\n  return [billing ?? uncontrolled, change] as const\n}\n\ninterface BillingToggleProps {\n  billing: PricingBilling\n  saving: number\n  /** One plan has one saving, so \"up to\" would be untrue. */\n  exact?: boolean\n  /** Grows the switch's hit area to 40 px on touch with an invisible layer, without changing how it looks. */\n  roomyTouch?: boolean\n  onChange: (billing: PricingBilling) => void\n}\n\n/** Only the colour marks the active side. A weight change would widen the label and shove the switch sideways. */\nfunction BillingToggle({ billing, saving, exact = false, roomyTouch = false, onChange }: BillingToggleProps) {\n  const id = useId()\n  return (\n    <div className=\"flex flex-wrap items-center gap-3\">\n      <Label htmlFor={id} className={billing === \"monthly\" ? \"text-foreground\" : \"text-muted-foreground\"}>\n        Monthly\n      </Label>\n      <Switch\n        id={id}\n        aria-label=\"Bill yearly\"\n        checked={billing === \"yearly\"}\n        onCheckedChange={(yearly) => onChange(yearly ? \"yearly\" : \"monthly\")}\n        className={roomyTouch ? \"relative pointer-coarse:after:absolute pointer-coarse:after:-inset-3\" : undefined}\n      />\n      <Label htmlFor={id} className={billing === \"yearly\" ? \"text-foreground\" : \"text-muted-foreground\"}>\n        Yearly\n      </Label>\n      {saving > 0 ? <span className=\"text-[13px] text-muted-foreground\">{exact ? `Save ${saving}%` : `Save up to ${saving}%`}</span> : null}\n    </div>\n  )\n}\n\nfunction PricingHeader({ title, description, children }: { title: string; description: string; children?: React.ReactNode }) {\n  return (\n    <header className=\"flex flex-col gap-6 @2xl:flex-row @2xl:items-end @2xl:justify-between\">\n      <h2 className=\"text-display max-w-lg text-3xl leading-[1.12]! text-balance @2xl:text-4xl\">\n        {title} <span className=\"text-muted-foreground\">{description}</span>\n      </h2>\n      {children}\n    </header>\n  )\n}\n\nfunction NoPlans() {\n  return <p className=\"text-[15px] text-muted-foreground\">Plans are not available right now. Check back soon.</p>\n}\n\nfunction PricingError({ message }: { message?: string }) {\n  if (!message) return null\n  return (\n    <p role=\"alert\" className=\"text-[13px] text-pretty text-destructive\">\n      {message}\n    </p>\n  )\n}\n\nexport { BillingToggle, NoPlans, PricingError, PricingHeader, bestYearlySaving, useBilling, type PricingCommonProps }\n",
      "type": "registry:component"
    },
    {
      "path": "registry/miseui/blocks/pricing-table-cards.tsx",
      "content": "import { cn } from \"@/registry/miseui/lib/utils\"\nimport {\n  BillingToggle,\n  NoPlans,\n  PricingError,\n  PricingHeader,\n  bestYearlySaving,\n  useBilling,\n  type PricingCommonProps,\n} from \"./pricing-table-billing\"\nimport { PlanCard } from \"./pricing-table-parts\"\nimport { DEFAULT_PLANS } from \"./pricing-table-sample\"\n\ninterface PricingCardsProps extends PricingCommonProps {\n  /** Sends a beam around the recommended plan instead of its still accent border. */\n  beam?: boolean\n}\n\nfunction PricingCards({\n  plans = DEFAULT_PLANS,\n  billing,\n  defaultBilling = \"yearly\",\n  onBillingChange,\n  onSelect,\n  title = \"Pay for the team you have today.\",\n  description = \"Move up or down whenever you like.\",\n  currency = \"USD\",\n  beam = false,\n  pendingPlanId,\n  currentPlanId,\n  error,\n  className,\n  ...props\n}: PricingCardsProps) {\n  const [active, change] = useBilling(billing, defaultBilling, onBillingChange)\n\n  return (\n    <section data-slot=\"pricing-table\" data-variant=\"cards\" className={cn(\"@container w-full bg-muted/40 dark:bg-background px-6 py-12\", className)} {...props}>\n      <div className=\"mx-auto flex w-full max-w-5xl flex-col gap-8\">\n        <PricingHeader title={title} description={description}>\n          {plans.length > 0 ? <BillingToggle billing={active} saving={bestYearlySaving(plans)} onChange={change} /> : null}\n        </PricingHeader>\n        {plans.length > 0 ? (\n          <div className=\"grid grid-cols-1 gap-4 @3xl:grid-cols-3 @3xl:gap-y-0 @3xl:py-6\">\n            {plans.map((plan) => (\n              <PlanCard\n                key={plan.id}\n                plan={plan}\n                billing={active}\n                currency={currency}\n                beam={beam}\n                pending={plan.id === pendingPlanId}\n                current={plan.id === currentPlanId}\n                disabled={pendingPlanId !== undefined}\n                onSelect={onSelect}\n              />\n            ))}\n          </div>\n        ) : (\n          <NoPlans />\n        )}\n        <PricingError message={error} />\n      </div>\n    </section>\n  )\n}\n\nexport { PricingCards }\n",
      "type": "registry:component"
    },
    {
      "path": "registry/miseui/blocks/pricing-table-comparison.tsx",
      "content": "import type * as React from \"react\"\nimport { Loader2 } from \"lucide-react\"\nimport { motion, useReducedMotion } from \"motion/react\"\nimport { SPRING_DEFAULT } from \"@/registry/miseui/lib/motion\"\nimport { cn } from \"@/registry/miseui/lib/utils\"\nimport { Button } from \"@/registry/miseui/ui/button\"\nimport { ScrollShadow } from \"@/registry/miseui/ui/scroll-shadow\"\nimport {\n  BillingToggle,\n  NoPlans,\n  PricingError,\n  PricingHeader,\n  bestYearlySaving,\n  useBilling,\n  type PricingCommonProps,\n} from \"./pricing-table-billing\"\nimport { matrixGroups, matrixValue, type MatrixGroup } from \"./pricing-table-matrix\"\nimport { FeatureValue, billingNote, formatMoney, type PricingBilling, type PricingPlan } from \"./pricing-table-parts\"\nimport { COMPARISON_PLANS } from \"./pricing-table-sample\"\n\nconst FEATURE_COLUMN_PX = 128\nconst PLAN_COLUMN_PX = 160\nconst PRICE_START = { opacity: 0, y: 8 }\nconst PRICE_END = { opacity: 1, y: 0 }\n\n/** Opaque, because rows slide underneath. Each surface below must be the same one the cell sits on. */\nconst planSurface = (plan: PricingPlan) => (plan.recommended ? \"bg-muted\" : \"bg-background\")\n/** A wide table sticks to the page, a narrow one to its own scroller, so only the wide one honours the site header's height. */\nconst STICKY_HEAD_CLASS = \"sticky top-0 @3xl:top-(--pricing-sticky-top) border-b align-top\"\n/** z-11: above the scroller's edge shadows (z-10), which would otherwise paint across the pinned column. */\nconst FEATURE_CELL_CLASS = \"sticky left-0 z-11 border-r bg-background pr-2 pl-6 text-start @3xl:border-r-0 @3xl:pl-0\"\n\ninterface HeadProps {\n  plan: PricingPlan\n  billing: PricingBilling\n  currency: string\n  pendingPlanId?: string\n  currentPlanId?: string\n  onSelect?: PricingCommonProps[\"onSelect\"]\n}\n\nfunction PlanHead({ plan, billing, currency, pendingPlanId, currentPlanId, onSelect }: HeadProps) {\n  const reduceMotion = useReducedMotion()\n  const yearly = billing === \"yearly\"\n  const current = plan.id === currentPlanId\n  const pending = plan.id === pendingPlanId\n  return (\n    // abbr is what a screen reader repeats on every cell of the column: the plan's name, not its price and button too.\n    <th scope=\"col\" abbr={plan.name} className={cn(STICKY_HEAD_CLASS, \"z-20 p-3 text-start font-normal @3xl:p-4\", planSurface(plan))}>\n      <div className=\"flex flex-col gap-3\">\n        <div className=\"flex flex-wrap items-baseline gap-x-2\">\n          <span className=\"text-[15px] font-medium\">{plan.name}</span>\n          {plan.recommended ? <span className=\"text-[13px] text-muted-foreground\">Recommended</span> : null}\n        </div>\n        <div className=\"flex flex-col gap-1\">\n          <div className=\"flex flex-wrap items-baseline gap-x-2\">\n            {yearly && plan.monthly > plan.yearly ? (\n              <s data-testid=\"anchor-price\" className=\"text-[13px] text-muted-foreground tabular-nums\">\n                <span className=\"sr-only\">Monthly price </span>\n                {formatMoney(plan.monthly, currency)}\n              </s>\n            ) : null}\n            <motion.span\n              key={billing}\n              className=\"text-display text-2xl tabular-nums\"\n              initial={reduceMotion ? false : PRICE_START}\n              animate={PRICE_END}\n              transition={SPRING_DEFAULT}\n            >\n              {formatMoney(yearly ? plan.yearly : plan.monthly, currency)}\n            </motion.span>\n            <span className=\"text-[13px] text-muted-foreground\">/ month</span>\n          </div>\n          <p className=\"text-[13px] text-muted-foreground\">{billingNote(plan, billing, currency)}</p>\n        </div>\n        <Button\n          variant={plan.recommended ? \"mise\" : \"outline\"}\n          disabled={pendingPlanId !== undefined || current}\n          aria-busy={pending || undefined}\n          onClick={() => onSelect?.(plan.id, billing)}\n          className=\"h-auto min-h-9 w-full px-2 py-1.5 whitespace-normal pointer-coarse:min-h-10\"\n        >\n          {pending ? <Loader2 aria-hidden=\"true\" className=\"animate-spin motion-reduce:animate-none\" /> : null}\n          {current ? \"Current plan\" : plan.cta}\n        </Button>\n      </div>\n    </th>\n  )\n}\n\nfunction GroupRows({ group, plans }: { group: MatrixGroup; plans: readonly PricingPlan[] }) {\n  return (\n    <tbody>\n      {group.name ? (\n        <tr>\n          <th scope=\"rowgroup\" className={cn(FEATURE_CELL_CLASS, \"pt-6 pb-2 text-[15px] font-medium\")}>\n            {group.name}\n          </th>\n          {plans.map((plan) => (\n            <td key={plan.id} className={cn(plan.recommended && \"bg-muted\")} />\n          ))}\n        </tr>\n      ) : null}\n      {group.rows.map((label) => (\n        <tr key={label}>\n          <th scope=\"row\" className={cn(FEATURE_CELL_CLASS, \"border-b py-3 font-normal text-muted-foreground\")}>\n            {label}\n          </th>\n          {plans.map((plan) => (\n            <td key={plan.id} className={cn(\"border-b px-3 py-3 @3xl:px-4\", plan.recommended && \"bg-muted\")}>\n              <span className=\"flex\">\n                <FeatureValue value={matrixValue(plan, label)} />\n              </span>\n            </td>\n          ))}\n        </tr>\n      ))}\n    </tbody>\n  )\n}\n\ninterface MatrixProps extends Omit<HeadProps, \"plan\"> {\n  plans: readonly PricingPlan[]\n}\n\n/** Overflow is on only while narrow: on a wide table it would capture the sticky header, which would stop following the page. */\nfunction Matrix({ plans, ...head }: MatrixProps) {\n  return (\n    <ScrollShadow\n      axis=\"both\"\n      aria-label=\"Plans compared feature by feature\"\n      className=\"-mx-6 @3xl:mx-0\"\n      scrollerClassName=\"relative max-h-[560px] @3xl:max-h-none @3xl:overflow-visible\"\n    >\n      {/* Only while narrow: once overflow is off, a table wider than the page would widen the page. relative on the scroller keeps the absolute sr-only text in the cells inside its clip. */}\n      <table\n        className=\"w-full min-w-(--matrix-min-width) table-fixed border-separate border-spacing-0 text-[13px] leading-relaxed @3xl:min-w-0\"\n        style={{ \"--matrix-min-width\": `${FEATURE_COLUMN_PX + plans.length * PLAN_COLUMN_PX}px` } as React.CSSProperties}\n      >\n        <colgroup>\n          <col className=\"w-32 @3xl:w-1/4\" />\n        </colgroup>\n        <thead>\n          <tr>\n            <th scope=\"col\" className={cn(STICKY_HEAD_CLASS, FEATURE_CELL_CLASS, \"z-30 pt-3 font-normal @3xl:pt-4\")}>\n              <span className=\"sr-only\">Feature</span>\n            </th>\n            {plans.map((plan) => (\n              <PlanHead key={plan.id} plan={plan} {...head} />\n            ))}\n          </tr>\n        </thead>\n        {matrixGroups(plans).map((group) => (\n          <GroupRows key={group.name} group={group} plans={plans} />\n        ))}\n      </table>\n    </ScrollShadow>\n  )\n}\n\nfunction PricingComparison({\n  plans = COMPARISON_PLANS,\n  billing,\n  defaultBilling = \"yearly\",\n  onBillingChange,\n  onSelect,\n  title = \"Every line, side by side.\",\n  description = \"Move up or down whenever you like.\",\n  currency = \"USD\",\n  stickyTop = 0,\n  pendingPlanId,\n  currentPlanId,\n  error,\n  className,\n  style,\n  ...props\n}: PricingCommonProps & { stickyTop?: number }) {\n  const [active, change] = useBilling(billing, defaultBilling, onBillingChange)\n  const rootStyle = { \"--pricing-sticky-top\": `${stickyTop}px`, ...style } as React.CSSProperties\n  return (\n    <section data-slot=\"pricing-table\" data-variant=\"comparison\" className={cn(\"@container w-full bg-background\", className)} style={rootStyle} {...props}>\n      <div className=\"px-6 py-12 @2xl:py-16\">\n        <div className=\"mx-auto flex w-full max-w-5xl flex-col gap-8\">\n          <PricingHeader title={title} description={description}>\n            {plans.length > 0 ? <BillingToggle billing={active} saving={bestYearlySaving(plans)} roomyTouch onChange={change} /> : null}\n          </PricingHeader>\n          {plans.length > 0 ? (\n            <Matrix plans={plans} billing={active} currency={currency} pendingPlanId={pendingPlanId} currentPlanId={currentPlanId} onSelect={onSelect} />\n          ) : (\n            <NoPlans />\n          )}\n          <PricingError message={error} />\n        </div>\n      </div>\n    </section>\n  )\n}\n\nexport { PricingComparison }\n",
      "type": "registry:component"
    },
    {
      "path": "registry/miseui/blocks/pricing-table-matrix.ts",
      "content": "import type { PricingFeature, PricingPlan } from \"./pricing-table-parts\"\n\ninterface MatrixGroup {\n  /** Empty for rows that were given no group. */\n  name: string\n  rows: readonly string[]\n}\n\nfunction withRow(groups: readonly MatrixGroup[], feature: PricingFeature): readonly MatrixGroup[] {\n  const name = feature.group ?? \"\"\n  const existing = groups.find((group) => group.name === name)\n  if (!existing) return [...groups, { name, rows: [feature.label] }]\n  if (existing.rows.includes(feature.label)) return groups\n  return groups.map((group) => (group === existing ? { ...group, rows: [...group.rows, feature.label] } : group))\n}\n\n/** Every row any plan mentions, in first-seen order, so a plan with an extra feature still gets its line. */\nfunction matrixGroups(plans: readonly PricingPlan[]) {\n  return plans.flatMap((plan) => plan.features).reduce<readonly MatrixGroup[]>(withRow, [])\n}\n\n/** A plan that never mentions a row does not have it. */\nfunction matrixValue(plan: PricingPlan, label: string) {\n  return plan.features.find((feature) => feature.label === label)?.value ?? false\n}\n\nexport { matrixGroups, matrixValue, type MatrixGroup }\n",
      "type": "registry:component"
    },
    {
      "path": "registry/miseui/blocks/pricing-table-sample.ts",
      "content": "import type { PricingFeature, PricingPlan } from \"./pricing-table-parts\"\n\nfunction rows(invoices: string, seats: string, exports: boolean, saml: boolean): readonly PricingFeature[] {\n  return [\n    { label: \"Invoices a month\", value: invoices },\n    { label: \"Team seats\", value: seats },\n    { label: \"Payment reminders\", value: true },\n    { label: \"Accounting export\", value: exports },\n    { label: \"SAML sign-in\", value: saml },\n  ]\n}\n\nconst DEFAULT_PLANS: readonly PricingPlan[] = [\n  {\n    id: \"solo\",\n    name: \"Solo\",\n    description: \"For freelancers sending a few invoices.\",\n    monthly: 0,\n    yearly: 0,\n    cta: \"Start free\",\n    features: rows(\"20\", \"1\", false, false),\n  },\n  {\n    id: \"team\",\n    name: \"Team\",\n    description: \"For small teams that bill every week.\",\n    monthly: 29,\n    yearly: 24,\n    cta: \"Start 14-day trial\",\n    recommended: true,\n    features: rows(\"Unlimited\", \"5\", true, false),\n  },\n  {\n    id: \"business\",\n    name: \"Business\",\n    description: \"For finance teams with approval steps.\",\n    monthly: 79,\n    yearly: 66,\n    cta: \"Choose Business\",\n    features: rows(\"Unlimited\", \"25\", true, true),\n  },\n]\n\ninterface MatrixValues {\n  invoices: string\n  recurring: boolean\n  exports: boolean\n  seats: string\n  approvals: boolean\n  saml: boolean\n  priority: boolean\n}\n\nfunction matrixRows(values: MatrixValues): readonly PricingFeature[] {\n  return [\n    { group: \"Billing\", label: \"Invoices a month\", value: values.invoices },\n    { group: \"Billing\", label: \"Payment reminders\", value: true },\n    { group: \"Billing\", label: \"Recurring invoices\", value: values.recurring },\n    { group: \"Billing\", label: \"Accounting export\", value: values.exports },\n    { group: \"Team\", label: \"Team seats\", value: values.seats },\n    { group: \"Team\", label: \"Approval steps\", value: values.approvals },\n    { group: \"Team\", label: \"SAML sign-in\", value: values.saml },\n    { group: \"Support\", label: \"Email support\", value: true },\n    { group: \"Support\", label: \"Reply within a day\", value: values.priority },\n  ]\n}\n\nconst MATRIX_BY_PLAN: Readonly<Record<string, readonly PricingFeature[]>> = {\n  solo: matrixRows({ invoices: \"20\", recurring: false, exports: false, seats: \"1\", approvals: false, saml: false, priority: false }),\n  team: matrixRows({ invoices: \"Unlimited\", recurring: true, exports: true, seats: \"5\", approvals: false, saml: false, priority: true }),\n  business: matrixRows({ invoices: \"Unlimited\", recurring: true, exports: true, seats: \"25\", approvals: true, saml: true, priority: true }),\n}\n\n/** The same plans at the same prices, with enough rows that a side-by-side is worth reading. */\nconst COMPARISON_PLANS: readonly PricingPlan[] = DEFAULT_PLANS.map((plan) => ({ ...plan, features: MATRIX_BY_PLAN[plan.id] }))\n\n/** A false row is left off the list on `single`: with one plan there is nothing to compare it against. */\nconst SINGLE_PLANS: readonly PricingPlan[] = [\n  {\n    id: \"paperline\",\n    name: \"Paperline\",\n    description: \"Everything is included, for every person on the team.\",\n    monthly: 12,\n    yearly: 10,\n    cta: \"Start 14-day trial\",\n    features: [\n      { label: \"Unlimited invoices\", value: true },\n      { label: \"Payment reminders\", value: true },\n      { label: \"Recurring invoices\", value: true },\n      { label: \"Accounting export\", value: true },\n      { label: \"Approval steps\", value: true },\n      { label: \"SAML sign-in\", value: true },\n    ],\n  },\n]\n\nexport { COMPARISON_PLANS, DEFAULT_PLANS, SINGLE_PLANS }\n",
      "type": "registry:component"
    },
    {
      "path": "registry/miseui/blocks/pricing-table-seats.ts",
      "content": "import { useState } from \"react\"\nimport { MONTHS_IN_YEAR, type PricingBilling, type PricingPlan } from \"./pricing-table-parts\"\n\nconst DEFAULT_SEATS = 5\n\ninterface PricingSeatProps {\n  /** Control the seat count yourself. Leave it out and the block keeps its own, starting from `defaultSeats`. */\n  seats?: number\n  defaultSeats?: number\n  minSeats?: number\n  maxSeats?: number\n  onSeatsChange?: (seats: number) => void\n}\n\n/** Prices per seat on the plan. Everything shown is worked out from these, so no sum on screen can disagree with another. */\nfunction seatTotals(plan: PricingPlan, billing: PricingBilling, seats: number) {\n  const perSeat = billing === \"yearly\" ? plan.yearly : plan.monthly\n  const yearlySaving = billing === \"yearly\" ? (plan.monthly - plan.yearly) * seats * MONTHS_IN_YEAR : 0\n  return {\n    perSeat,\n    perMonth: perSeat * seats,\n    anchor: yearlySaving > 0 ? plan.monthly * seats : undefined,\n    billedYearly: plan.yearly * seats * MONTHS_IN_YEAR,\n    yearlySaving,\n  }\n}\n\nfunction seatSummary(billing: PricingBilling, seats: number, perSeat: string, billedYearly: string) {\n  const people = `${seats} ${seats === 1 ? \"seat\" : \"seats\"} at ${perSeat}`\n  return billing === \"yearly\" ? `${people}, ${billedYearly} billed yearly` : `${people}, billed monthly`\n}\n\nfunction useSeats({ seats, defaultSeats = DEFAULT_SEATS, onSeatsChange }: PricingSeatProps) {\n  const [uncontrolled, setUncontrolled] = useState(defaultSeats)\n  // A cleared field is someone halfway through typing. The last good count stays until they settle on a new one.\n  const change = (next: number | null) => {\n    if (next === null) return\n    setUncontrolled(next)\n    onSeatsChange?.(next)\n  }\n  return [seats ?? uncontrolled, change] as const\n}\n\nexport { seatSummary, seatTotals, useSeats, type PricingSeatProps }\n",
      "type": "registry:component"
    },
    {
      "path": "registry/miseui/blocks/pricing-table-single.tsx",
      "content": "import { useId } from \"react\"\nimport { Check, Loader2 } from \"lucide-react\"\nimport { motion, useReducedMotion } from \"motion/react\"\nimport { SPRING_DEFAULT } from \"@/registry/miseui/lib/motion\"\nimport { cn } from \"@/registry/miseui/lib/utils\"\nimport { Button } from \"@/registry/miseui/ui/button\"\nimport { Label } from \"@/registry/miseui/ui/label\"\nimport { NumberInput } from \"@/registry/miseui/ui/number-input\"\nimport { BillingToggle, NoPlans, PricingError, bestYearlySaving, useBilling, type PricingCommonProps } from \"./pricing-table-billing\"\nimport { formatMoney, type PricingBilling, type PricingPlan } from \"./pricing-table-parts\"\nimport { SINGLE_PLANS } from \"./pricing-table-sample\"\nimport { seatSummary, seatTotals, useSeats, type PricingSeatProps } from \"./pricing-table-seats\"\n\nconst DEFAULT_MIN_SEATS = 1\nconst DEFAULT_MAX_SEATS = 500\nconst PRICE_START = { opacity: 0, y: 8 }\nconst PRICE_END = { opacity: 1, y: 0 }\nconst PLATE_SHADOW_CLASS = \"shadow-[0_16px_40px_-24px_color-mix(in_oklab,var(--foreground)_24%,transparent)] dark:shadow-none\"\n\ninterface TotalProps {\n  plan: PricingPlan\n  billing: PricingBilling\n  seats: number\n  currency: string\n}\n\n/** Keyed on billing only: a total that re-enters on every seat would judder while someone holds the plus button. */\nfunction SeatTotal({ plan, billing, seats, currency }: TotalProps) {\n  const reduceMotion = useReducedMotion()\n  const { perSeat, perMonth, anchor, billedYearly, yearlySaving } = seatTotals(plan, billing, seats)\n  return (\n    <div className=\"flex flex-col gap-1\">\n      <div className=\"flex flex-wrap items-baseline gap-x-2\">\n        {anchor ? (\n          <s data-testid=\"anchor-price\" className=\"text-[15px] text-muted-foreground tabular-nums\">\n            <span className=\"sr-only\">Monthly price </span>\n            {formatMoney(anchor, currency)}\n          </s>\n        ) : null}\n        <motion.span\n          key={billing}\n          data-testid=\"seat-total\"\n          className=\"text-display text-4xl tabular-nums @md:text-5xl\"\n          initial={reduceMotion ? false : PRICE_START}\n          animate={PRICE_END}\n          transition={SPRING_DEFAULT}\n        >\n          {formatMoney(perMonth, currency)}\n        </motion.span>\n        <span className=\"text-[13px] text-muted-foreground\">/ month</span>\n      </div>\n      <p className=\"text-[13px] leading-relaxed text-pretty text-muted-foreground\">\n        {seatSummary(billing, seats, formatMoney(perSeat, currency), formatMoney(billedYearly, currency))}\n      </p>\n      {yearlySaving > 0 ? <p className=\"text-[13px] leading-relaxed text-muted-foreground\">You save {formatMoney(yearlySaving, currency)} a year.</p> : null}\n    </div>\n  )\n}\n\nfunction IncludedList({ plan }: { plan: PricingPlan }) {\n  const included = plan.features.filter((feature) => feature.value !== false)\n  return (\n    <ul aria-label={`${plan.name} includes`} className=\"grid grid-cols-1 gap-x-6 gap-y-3 text-[15px] leading-relaxed @lg:grid-cols-2\">\n      {included.map((feature) => (\n        <li key={feature.label} className=\"flex min-w-0 items-start gap-3\">\n          <Check aria-hidden=\"true\" className=\"mt-1 size-4 shrink-0 text-muted-foreground\" />\n          <span className=\"min-w-0 text-pretty\">\n            {feature.label}\n            {typeof feature.value === \"string\" ? <span className=\"text-muted-foreground\"> {feature.value}</span> : null}\n          </span>\n        </li>\n      ))}\n    </ul>\n  )\n}\n\ninterface PlateProps extends PricingSeatProps {\n  plan: PricingPlan\n  billing: PricingBilling\n  onBillingChange: (billing: PricingBilling) => void\n  currency: string\n  pending: boolean\n  current: boolean\n  disabled: boolean\n  onSelect?: PricingCommonProps[\"onSelect\"]\n}\n\nfunction SeatPlate({ plan, billing, onBillingChange, currency, pending, current, disabled, onSelect, minSeats = DEFAULT_MIN_SEATS, maxSeats = DEFAULT_MAX_SEATS, ...seatProps }: PlateProps) {\n  const seatFieldId = useId()\n  const [count, setCount] = useSeats(seatProps)\n  return (\n    <div className={cn(\"flex min-w-0 flex-col gap-6 rounded-2xl border bg-background p-6 @md:p-8 dark:bg-card\", PLATE_SHADOW_CLASS)}>\n      <BillingToggle billing={billing} saving={bestYearlySaving([plan])} exact roomyTouch onChange={onBillingChange} />\n      <div className=\"flex items-center justify-between gap-4\">\n        <Label htmlFor={seatFieldId}>Seats</Label>\n        <NumberInput\n          id={seatFieldId}\n          variant=\"split\"\n          value={count}\n          min={minSeats}\n          max={maxSeats}\n          onValueChange={setCount}\n          incrementLabel=\"Add a seat\"\n          decrementLabel=\"Remove a seat\"\n          className=\"w-36\"\n        />\n      </div>\n      <SeatTotal plan={plan} billing={billing} seats={count} currency={currency} />\n      <Button\n        size=\"lg\"\n        variant=\"mise\"\n        disabled={disabled || current}\n        aria-busy={pending || undefined}\n        onClick={() => onSelect?.(plan.id, billing, count)}\n        className=\"w-full\"\n      >\n        {pending ? <Loader2 aria-hidden=\"true\" className=\"animate-spin motion-reduce:animate-none\" /> : null}\n        {current ? \"Current plan\" : plan.cta}\n      </Button>\n    </div>\n  )\n}\n\nfunction PricingSingle({\n  plans = SINGLE_PLANS,\n  billing,\n  defaultBilling = \"yearly\",\n  onBillingChange,\n  onSelect,\n  title = \"One plan, priced by the seat.\",\n  description = \"Add people when they start, remove them when they leave.\",\n  currency = \"USD\",\n  pendingPlanId,\n  currentPlanId,\n  error,\n  seat,\n  className,\n  ...props\n}: PricingCommonProps & { seat?: PricingSeatProps }) {\n  const [active, change] = useBilling(billing, defaultBilling, onBillingChange)\n  const plan = plans.find((candidate) => candidate.recommended) ?? plans[0]\n  return (\n    <section data-slot=\"pricing-table\" data-variant=\"single\" className={cn(\"@container w-full bg-muted/40 dark:bg-background\", className)} {...props}>\n      <div className=\"px-6 py-12 @2xl:py-16\">\n        <div className=\"mx-auto grid w-full max-w-5xl grid-cols-[minmax(0,1fr)] items-center gap-8 @3xl:grid-cols-[minmax(0,7fr)_minmax(0,5fr)] @3xl:gap-12\">\n          <div className=\"flex min-w-0 flex-col gap-8\">\n            <h2 className=\"text-display text-3xl leading-[1.12]! text-balance @2xl:text-4xl\">\n              {title} <span className=\"text-muted-foreground\">{description}</span>\n            </h2>\n            {plan ? <IncludedList plan={plan} /> : <NoPlans />}\n          </div>\n          {plan ? (\n            <SeatPlate\n              plan={plan}\n              billing={active}\n              onBillingChange={change}\n              currency={currency}\n              pending={plan.id === pendingPlanId}\n              current={plan.id === currentPlanId}\n              disabled={pendingPlanId !== undefined}\n              onSelect={onSelect}\n              {...seat}\n            />\n          ) : null}\n          <div className=\"@3xl:col-span-2 empty:hidden\">\n            <PricingError message={error} />\n          </div>\n        </div>\n      </div>\n    </section>\n  )\n}\n\nexport { PricingSingle }\n",
      "type": "registry:component"
    }
  ],
  "categories": [
    "blocks"
  ],
  "type": "registry:block"
}