{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "block-checkout",
  "type": "registry:block",
  "title": "Checkout",
  "description": "Paying for a plan change on a raised page: the plan with seats and add-ons, the billing period, payment method and billing details as tiles, beside a summary with a promo code that reprices as the order changes.",
  "dependencies": [
    "@remixicon/react@^4.9.0"
  ],
  "registryDependencies": [
    "https://wideset.co/r/app-shell.json",
    "https://wideset.co/r/avatar.json",
    "https://wideset.co/r/block-styles.json",
    "https://wideset.co/r/breadcrumbs.json",
    "https://wideset.co/r/button.json",
    "https://wideset.co/r/card.json",
    "https://wideset.co/r/chip.json",
    "https://wideset.co/r/divider.json",
    "https://wideset.co/r/dropdown-menu.json",
    "https://wideset.co/r/form-field.json",
    "https://wideset.co/r/icon-button.json",
    "https://wideset.co/r/inline-alert.json",
    "https://wideset.co/r/list-item.json",
    "https://wideset.co/r/select.json",
    "https://wideset.co/r/sidebar.json",
    "https://wideset.co/r/text-input.json",
    "https://wideset.co/r/tile.json",
    "https://wideset.co/r/utils.json"
  ],
  "files": [
    {
      "path": "src/blocks/checkout/billing-details.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/checkout/billing-details.tsx",
      "content": "'use client';\n\nimport { Button } from '@/components/ui/wideset/button/Button';\nimport { FormField } from '@/components/ui/wideset/form-field/FormField';\nimport { Select } from '@/components/ui/wideset/select/Select';\nimport { TextInput } from '@/components/ui/wideset/text-input/TextInput';\nimport { Tile } from '@/components/ui/wideset/tile/Tile';\nimport { type FormEvent, useEffect, useId, useRef, useState } from 'react';\n\nimport { type BillingDetails as Details, countries, countryName } from './data';\n\ntype Field = keyof Details;\n\n/** What a field's error says when it is left empty. */\nconst REQUIRED: Partial<Record<Field, string>> = {\n  company: 'Enter the company name.',\n  vatNumber: 'Enter the VAT number.',\n  address: 'Enter the street address.',\n  city: 'Enter the city.',\n  postalCode: 'Enter the postal code.',\n};\n\ntype BillingDetailsProps = {\n  details: Details;\n  onChange: (details: Details) => void;\n};\n\n/**\n * Who the invoice is made out to: read back on one tile, with Edit opening the fields in its\n * place. The fields work on a copy, so Cancel leaves the saved details alone; Save checks the\n * required ones and moves focus to the first that is empty.\n */\nexport function BillingDetails({ details, onChange }: BillingDetailsProps) {\n  const id = useId();\n  const [draft, setDraft] = useState<Details | null>(null);\n  const editButton = useRef<HTMLButtonElement>(null);\n  const firstField = useRef<HTMLInputElement>(null);\n  const wasEditing = useRef(false);\n  const editing = draft !== null;\n\n  // Focus follows the switch: into the first field when the fields open, back to Edit when they\n  // close, so a keyboard user is never dropped at the top of the page.\n  useEffect(() => {\n    if (editing) firstField.current?.focus();\n    else if (wasEditing.current) editButton.current?.focus();\n    wasEditing.current = editing;\n  }, [editing]);\n  const [errors, setErrors] = useState<Partial<Record<Field, string>>>({});\n\n  if (!draft) {\n    return (\n      <Tile\n        title={details.company}\n        description={`${details.address}, ${details.city} ${details.postalCode}, ${countryName(details.country)}. VAT ${details.vatNumber}.`}\n      >\n        <Button\n          size=\"sm\"\n          variant=\"secondary\"\n          preset=\"border\"\n          ref={editButton}\n          aria-label=\"Edit billing details\"\n          onClick={() => setDraft(details)}\n        >\n          Edit\n        </Button>\n      </Tile>\n    );\n  }\n\n  const close = () => {\n    setDraft(null);\n    setErrors({});\n  };\n\n  const save = (event: FormEvent<HTMLFormElement>) => {\n    event.preventDefault();\n    const empty = (Object.keys(REQUIRED) as Field[]).filter((field) => !draft[field].trim());\n    setErrors(Object.fromEntries(empty.map((field) => [field, REQUIRED[field]])));\n    if (empty.length) return document.getElementById(`${id}-${empty[0]}`)?.focus();\n    onChange(draft);\n    close();\n  };\n\n  /** What every text field shares: its id, value, change handler and error look. */\n  const text = (field: Field) => ({\n    id: `${id}-${field}`,\n    name: field,\n    size: 'sm' as const,\n    required: field in REQUIRED,\n    value: draft[field],\n    variant: errors[field] ? ('danger' as const) : ('primary' as const),\n    onChange: (event: { target: { value: string } }) => {\n      setDraft({ ...draft, [field]: event.target.value });\n      setErrors({ ...errors, [field]: undefined });\n    },\n  });\n\n  return (\n    <form noValidate onSubmit={save} className=\"gap-ws-11 flex flex-col\">\n      <div className=\"gap-ws-9 grid grid-cols-2 items-start\">\n        <FormField label=\"Company\" htmlFor={`${id}-company`} errorText={errors.company}>\n          <TextInput {...text('company')} ref={firstField} autoComplete=\"organization\" />\n        </FormField>\n        <FormField label=\"VAT number\" htmlFor={`${id}-vatNumber`} errorText={errors.vatNumber}>\n          <TextInput {...text('vatNumber')} autoComplete=\"off\" placeholder=\"GB 123 4567 89\" />\n        </FormField>\n      </div>\n      <FormField label=\"Address\" htmlFor={`${id}-address`} errorText={errors.address}>\n        <TextInput {...text('address')} autoComplete=\"street-address\" />\n      </FormField>\n      <div className=\"gap-ws-9 grid grid-cols-[minmax(0,2fr)_minmax(0,1fr)_minmax(0,2fr)] items-start\">\n        <FormField label=\"City\" htmlFor={`${id}-city`} errorText={errors.city}>\n          <TextInput {...text('city')} autoComplete=\"address-level2\" />\n        </FormField>\n        <FormField label=\"Postal code\" htmlFor={`${id}-postalCode`} errorText={errors.postalCode}>\n          <TextInput {...text('postalCode')} autoComplete=\"postal-code\" />\n        </FormField>\n        <FormField label=\"Country\" htmlFor={`${id}-country`}>\n          <Select\n            id={`${id}-country`}\n            name=\"country\"\n            size=\"sm\"\n            className=\"w-full\"\n            options={countries}\n            value={draft.country}\n            onValueChange={(country) => setDraft({ ...draft, country })}\n          />\n        </FormField>\n      </div>\n      <div className=\"gap-ws-5 flex justify-end\">\n        <Button size=\"sm\" variant=\"secondary\" preset=\"ghost\" onClick={close}>\n          Cancel\n        </Button>\n        <Button type=\"submit\" size=\"sm\" variant=\"secondary\" preset=\"border\">\n          Save details\n        </Button>\n      </div>\n    </form>\n  );\n}\n"
    },
    {
      "path": "src/blocks/checkout/billing-period.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/checkout/billing-period.tsx",
      "content": "'use client';\n\nimport { Tile } from '@/components/ui/wideset/tile/Tile';\n\nimport { type Interval, plan } from './data';\nimport { formatUsd } from './format';\n\ntype BillingPeriodProps = {\n  interval: Interval;\n  seats: number;\n  onChange: (interval: Interval) => void;\n};\n\n/**\n * How often the plan is billed. Each choice states the price of a seat; yearly also says what it\n * saves over a year for the seats in the order, which is the reason to pick it.\n */\nexport function BillingPeriod({ interval, seats, onChange }: BillingPeriodProps) {\n  const { monthly, yearly } = plan.seatPrice;\n  const saving = (monthly - yearly) * seats * 12;\n\n  return (\n    <Tile.RadioGroup\n      aria-label=\"Billing period\"\n      orientation=\"horizontal\"\n      value={interval}\n      onValueChange={(value) => onChange(value as Interval)}\n    >\n      <Tile.Radio\n        value=\"monthly\"\n        title=\"Monthly\"\n        description={`${formatUsd(monthly)} a seat a month`}\n      />\n      <Tile.Radio\n        value=\"yearly\"\n        title=\"Yearly\"\n        description={`${formatUsd(yearly)} a seat a month, ${formatUsd(saving)} less a year`}\n      />\n    </Tile.RadioGroup>\n  );\n}\n"
    },
    {
      "path": "src/blocks/checkout/brand-mark.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/checkout/brand-mark.tsx",
      "content": "'use client';\n\nimport { cn } from '@/lib/wideset/utils';\n\nconst TILE =\n  'M0 16C0 8.45753 0 4.68629 2.34315 2.34315C4.68629 0 8.45753 0 16 0C23.5425 0 27.3137 0 29.6569 2.34315C32 4.68629 32 8.45753 32 16C32 23.5425 32 27.3137 29.6569 29.6569C27.3137 32 23.5425 32 16 32C8.45753 32 4.68629 32 2.34315 29.6569C0 27.3137 0 23.5425 0 16Z';\n\n/**\n * Orbit's mark: a planet and its ring on the inverse tile, so it inverts in dark mode. It takes\n * the size of its place (32px in a sidebar, 36px in a larger switcher). Decorative beside the\n * product's name; give it a `label` when it stands alone.\n */\nexport function BrandMark({ className, label }: { className?: string; label?: string }) {\n  return (\n    <svg\n      viewBox=\"0 0 32 32\"\n      role={label ? 'img' : undefined}\n      aria-label={label}\n      aria-hidden={label ? undefined : true}\n      className={cn('size-ws-14 shrink-0', className)}\n    >\n      <path d={TILE} className=\"fill-(--ws-static-fill-inverse-background)\" />\n      <ellipse\n        cx=\"16\"\n        cy=\"16\"\n        rx=\"10.5\"\n        ry=\"4\"\n        transform=\"rotate(-28 16 16)\"\n        strokeWidth=\"1.75\"\n        className=\"fill-none stroke-(--ws-static-text-inverse-strong)\"\n      />\n      <circle cx=\"16\" cy=\"16\" r=\"4.75\" className=\"fill-(--ws-static-text-inverse-strong)\" />\n    </svg>\n  );\n}\n"
    },
    {
      "path": "src/blocks/checkout/card-fields.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/checkout/card-fields.tsx",
      "content": "'use client';\n\nimport {\n  type RemixiconComponentType,\n  RiBankCardLine,\n  RiMastercardLine,\n  RiVisaLine,\n} from '@remixicon/react';\nimport { FormField } from '@/components/ui/wideset/form-field/FormField';\nimport { TextInput } from '@/components/ui/wideset/text-input/TextInput';\n\nimport {\n  type CardBrand,\n  cardBrand,\n  type CardErrors,\n  type CardValues,\n  formatCardCvc,\n  formatCardExpiry,\n  formatCardNumber,\n} from './card';\n\nconst BRAND_ICON: Record<CardBrand, RemixiconComponentType> = {\n  visa: RiVisaLine,\n  mastercard: RiMastercardLine,\n  card: RiBankCardLine,\n};\n\ntype CardFieldsProps = {\n  /** Prefix of the fields' ids (`<id>-number`), so the screen can focus the first one in error. */\n  id: string;\n  values: CardValues;\n  errors: CardErrors;\n  onChange: (values: CardValues) => void;\n};\n\n/**\n * A card typed in by hand: its number, expiry and security code, each shaped as it is typed. The\n * number's suffix shows the brand it starts as. The screen holds the values and the errors, which\n * it sets when paying. Nothing here talks to a payment provider.\n */\nexport function CardFields({ id, values, errors, onChange }: CardFieldsProps) {\n  return (\n    <div className=\"gap-ws-9 grid grid-cols-[minmax(0,2fr)_minmax(0,1fr)_minmax(0,1fr)] items-start\">\n      <FormField label=\"Card number\" htmlFor={`${id}-number`} errorText={errors.number}>\n        <TextInput\n          id={`${id}-number`}\n          size=\"sm\"\n          required\n          inputMode=\"numeric\"\n          autoComplete=\"cc-number\"\n          placeholder=\"1234 1234 1234 1234\"\n          variant={errors.number ? 'danger' : 'primary'}\n          value={values.number}\n          onChange={(event) =>\n            onChange({ ...values, number: formatCardNumber(event.target.value) })\n          }\n        >\n          <TextInput.Input />\n          <TextInput.Suffix inner>\n            <TextInput.Icon icon={BRAND_ICON[cardBrand(values.number)]} />\n          </TextInput.Suffix>\n        </TextInput>\n      </FormField>\n      <FormField label=\"Expiry date\" htmlFor={`${id}-expiry`} errorText={errors.expiry}>\n        <TextInput\n          id={`${id}-expiry`}\n          size=\"sm\"\n          required\n          inputMode=\"numeric\"\n          autoComplete=\"cc-exp\"\n          placeholder=\"MM / YY\"\n          variant={errors.expiry ? 'danger' : 'primary'}\n          value={values.expiry}\n          onChange={(event) =>\n            onChange({ ...values, expiry: formatCardExpiry(event.target.value) })\n          }\n        />\n      </FormField>\n      <FormField label=\"Security code\" htmlFor={`${id}-cvc`} errorText={errors.cvc}>\n        <TextInput\n          id={`${id}-cvc`}\n          size=\"sm\"\n          required\n          inputMode=\"numeric\"\n          autoComplete=\"cc-csc\"\n          placeholder=\"CVC\"\n          variant={errors.cvc ? 'danger' : 'primary'}\n          value={values.cvc}\n          onChange={(event) => onChange({ ...values, cvc: formatCardCvc(event.target.value) })}\n        />\n      </FormField>\n    </div>\n  );\n}\n"
    },
    {
      "path": "src/blocks/checkout/card.ts",
      "type": "registry:file",
      "target": "blocks/wideset/checkout/card.ts",
      "content": "import { today } from './data';\n\n/** A card typed in by hand. Every value is the text in its field. */\nexport type CardValues = { number: string; expiry: string; cvc: string };\nexport type CardErrors = Partial<Record<keyof CardValues, string>>;\n\nexport const emptyCard: CardValues = { number: '', expiry: '', cvc: '' };\n\nconst digits = (text: string) => text.replace(/\\D/g, '');\n\n/** `4242424242424242` → `4242 4242 4242 4242`, as it is typed. */\nexport const formatCardNumber = (text: string) =>\n  digits(text)\n    .slice(0, 19)\n    .replace(/(.{4})(?=.)/g, '$1 ');\n\n/** `1228` → `12 / 28`, as it is typed. */\nexport const formatCardExpiry = (text: string) => {\n  const value = digits(text).slice(0, 4);\n  return value.length > 2 ? `${value.slice(0, 2)} / ${value.slice(2)}` : value;\n};\n\nexport const formatCardCvc = (text: string) => digits(text).slice(0, 4);\n\nexport type CardBrand = 'visa' | 'mastercard' | 'card';\n\n/** The brand a number starts as: enough to show the mark, not to accept the card. */\nexport const cardBrand = (number: string): CardBrand =>\n  /^4/.test(number) ? 'visa' : /^(5[1-5]|2[2-7])/.test(number) ? 'mastercard' : 'card';\n\n/** The Luhn check every card number passes: it catches a mistyped digit before the bank does. */\nconst passesLuhn = (number: string) =>\n  [...number].reverse().reduce((sum, digit, index) => {\n    const value = Number(digit) * (index % 2 ? 2 : 1);\n    return sum + (value > 9 ? value - 9 : value);\n  }, 0) %\n    10 ===\n  0;\n\n/**\n * What is wrong with a card, by field; empty when it can be charged. Checked when paying, never\n * while typing. Swap this (and the fields) for your payment provider's own when you connect one.\n */\nexport function validateCard(card: CardValues): CardErrors {\n  const errors: CardErrors = {};\n  const number = digits(card.number);\n  const expiry = digits(card.expiry);\n  const [year, month] = today.split('-').map(Number);\n\n  if (!number) errors.number = 'Enter the card number.';\n  else if (number.length < 13 || !passesLuhn(number))\n    errors.number = 'Check the card number, a digit looks wrong.';\n\n  if (expiry.length < 4) errors.expiry = 'Enter the expiry date.';\n  else {\n    const expiryMonth = Number(expiry.slice(0, 2));\n    const expiryYear = 2000 + Number(expiry.slice(2));\n    if (expiryMonth < 1 || expiryMonth > 12) errors.expiry = 'Month is 01 to 12.';\n    else if (expiryYear < year || (expiryYear === year && expiryMonth < month))\n      errors.expiry = 'This card has expired.';\n  }\n\n  if (card.cvc.length < 3) errors.cvc = 'Enter 3 or 4 digits.';\n\n  return errors;\n}\n"
    },
    {
      "path": "src/blocks/checkout/data.ts",
      "type": "registry:file",
      "target": "blocks/wideset/checkout/data.ts",
      "content": "import {\n  type RemixiconComponentType,\n  RiBankCardFill,\n  RiBankCardLine,\n  RiContactsBook3Line,\n  RiCustomerService2Line,\n  RiHandCoinLine,\n  RiHardDrive3Line,\n  RiHome5Line,\n  RiInbox2Line,\n  RiKey2Line,\n  RiLineChartLine,\n  RiPieChart2Line,\n  RiPlugLine,\n  RiQuestionLine,\n  RiSettings3Line,\n  RiStackLine,\n  RiTeamLine,\n} from '@remixicon/react';\n\n// Example checkout for Lumen Studio's plan change. Display amounts are in cents.\n\n/** The product is Orbit; the workspace paying for it is Lumen Studio. */\nexport const product = { name: 'Orbit' };\nexport const workspace = { name: 'Lumen Studio', initials: 'LS' };\nexport const account = { name: 'Maya Okafor', email: 'maya@lumenstudio.co', initials: 'MO' };\n\n/** The day the screen shows; the new billing period starts on it. */\nexport const today = '2026-11-10';\n\n/** Where the links lead: replace with your routes. */\nexport const ROUTES = { terms: '#terms', receipt: '#order-confirmation' };\n\nexport type NavLink = {\n  id: string;\n  label: string;\n  icon: RemixiconComponentType;\n  /** The icon while the page is open (a line icon swaps for its fill). */\n  activeIcon?: RemixiconComponentType;\n};\n\nexport const mainLinks: NavLink[] = [\n  { id: 'home', label: 'Home', icon: RiHome5Line },\n  { id: 'inbox', label: 'Inbox', icon: RiInbox2Line },\n  { id: 'customers', label: 'Customers', icon: RiContactsBook3Line },\n  { id: 'deals', label: 'Deals', icon: RiHandCoinLine },\n  { id: 'revenue', label: 'Revenue', icon: RiLineChartLine },\n  { id: 'reports', label: 'Reports', icon: RiPieChart2Line },\n];\n\nexport const settingsLinks: NavLink[] = [\n  { id: 'general', label: 'General', icon: RiSettings3Line },\n  { id: 'members', label: 'Members', icon: RiTeamLine },\n  { id: 'billing', label: 'Billing', icon: RiBankCardLine, activeIcon: RiBankCardFill },\n  { id: 'integrations', label: 'Integrations', icon: RiPlugLine },\n  { id: 'api-keys', label: 'API keys', icon: RiKey2Line },\n];\n\nexport const helpLink: NavLink = { id: 'help', label: 'Help and support', icon: RiQuestionLine };\n\nexport type Interval = 'monthly' | 'yearly';\n\nexport const subscription = {\n  plan: 'Growth',\n  seats: 40,\n  seatsInUse: 38,\n  periodEnd: '2026-11-30',\n};\n\n/**\n * The plan it moves to: the price of a seat for a month, by how often it is billed. Each line of\n * the order carries an icon for its thumbnail.\n */\nexport const plan = {\n  name: 'Scale',\n  icon: RiStackLine,\n  seatPrice: { monthly: 69_00, yearly: 57_00 } satisfies Record<Interval, number>,\n};\n\nexport const MAX_SEATS = 500;\n\nexport type AddOn = {\n  id: string;\n  name: string;\n  description: string;\n  monthlyPrice: number;\n  icon: RemixiconComponentType;\n};\n\n/** Extras bought on top of the plan, priced by the month whatever the billing period. */\nexport const addOns: AddOn[] = [\n  {\n    id: 'priority-support',\n    name: 'Priority support',\n    description: 'A first reply within one hour, every day of the week.',\n    monthlyPrice: 199_00,\n    icon: RiCustomerService2Line,\n  },\n  {\n    id: 'extra-storage',\n    name: 'Extra storage',\n    description: 'One more terabyte for files and call recordings.',\n    monthlyPrice: 49_00,\n    icon: RiHardDrive3Line,\n  },\n];\n\n/** The card on file. */\nexport const savedCard = { brand: 'Mastercard', last4: '8812', expires: '2026-12' };\n\n/** Where receipts and invoices go. */\nexport const receiptEmail = 'finance@lumenstudio.co';\n\nexport type BillingDetails = {\n  company: string;\n  address: string;\n  city: string;\n  postalCode: string;\n  /** A `countries` value. */\n  country: string;\n  vatNumber: string;\n};\n\nexport const billingDetails: BillingDetails = {\n  company: 'Lumen Studio Ltd',\n  address: '21 Hoxton Square',\n  city: 'London',\n  postalCode: 'N1 6NN',\n  country: 'gb',\n  vatNumber: 'GB 318 4471 26',\n};\n\nexport const countries = [\n  { value: 'de', label: 'Germany' },\n  { value: 'ie', label: 'Ireland' },\n  { value: 'nl', label: 'Netherlands' },\n  { value: 'pl', label: 'Poland' },\n  { value: 'gb', label: 'United Kingdom' },\n  { value: 'us', label: 'United States' },\n];\n\nexport const countryName = (value: string) =>\n  countries.find((country) => country.value === value)?.label ?? value;\n\n/** Example invoice adjustments and dates supplied with the demo. */\nexport const sampleInvoice = {\n  credit: 1_092_00,\n  tax: { label: 'VAT 0%, reverse charge', amount: 0 },\n  nextChargeDate: { monthly: '2026-12-10', yearly: '2027-11-10' },\n};\n\nexport const samplePromo = { code: 'ORBIT20', amount: { monthly: 552_00, yearly: 5_472_00 } };\n\ntype OrderSelection = {\n  seats: number;\n  addOnIds: string[];\n  interval: Interval;\n  showDiscount: boolean;\n};\n\n/** Assemble the display lines for the selected items using the sample invoice amounts. */\nexport function demoSummary({ seats, addOnIds, interval, showDiscount }: OrderSelection) {\n  const months = interval === 'yearly' ? 12 : 1;\n  const seatPrice = plan.seatPrice[interval];\n  const lines: { id: string; label: string; detail?: string; amount: number }[] = [\n    {\n      id: 'plan',\n      label: `${plan.name} plan`,\n      detail: `${seats} seats`,\n      amount: seats * seatPrice * months,\n    },\n    ...addOns\n      .filter((addOn) => addOnIds.includes(addOn.id))\n      .map((addOn) => ({\n        id: addOn.id,\n        label: addOn.name,\n        amount: addOn.monthlyPrice * months,\n      })),\n  ];\n  const subtotal = lines.reduce((sum, line) => sum + line.amount, 0);\n  const discount = showDiscount ? samplePromo.amount[interval] : 0;\n  const { credit, tax, nextChargeDate } = sampleInvoice;\n\n  return {\n    months,\n    seatPrice,\n    lines,\n    subtotal,\n    discount,\n    credit,\n    tax,\n    total: subtotal - discount - credit + tax.amount,\n    nextCharge: { date: nextChargeDate[interval], amount: subtotal },\n  };\n}\n\nexport type OrderTotals = ReturnType<typeof demoSummary>;\n"
    },
    {
      "path": "src/blocks/checkout/format.ts",
      "type": "registry:file",
      "target": "blocks/wideset/checkout/format.ts",
      "content": "// One locale for the whole screen; swap it for the user's.\nconst LOCALE = 'en-US';\n\nconst usd = new Intl.NumberFormat(LOCALE, { style: 'currency', currency: 'USD' });\n// Dates are calendar days (`2026-11-10`), parsed as UTC midnight: format them in UTC too.\nconst date = new Intl.DateTimeFormat(LOCALE, {\n  day: 'numeric',\n  month: 'short',\n  year: 'numeric',\n  timeZone: 'UTC',\n});\nconst monthYear = new Intl.DateTimeFormat(LOCALE, {\n  month: '2-digit',\n  year: 'numeric',\n  timeZone: 'UTC',\n});\n\n/** Money is kept in whole cents: 276000 → $2,760.00. */\nexport const formatUsd = (cents: number) => usd.format(cents / 100);\nexport const formatDate = (iso: string) => date.format(new Date(iso));\n/** Nov 10 – 30, 2026. */\nexport const formatPeriod = (from: string, to: string) =>\n  date.formatRange(new Date(from), new Date(to));\n/** A card's expiry, `2026-12` → 12/2026. */\nexport const formatExpiry = (yearMonth: string) => monthYear.format(new Date(`${yearMonth}-01`));\n"
    },
    {
      "path": "src/blocks/checkout/index.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/checkout/index.tsx",
      "content": "'use client';\n\nimport '@/styles/wideset-blocks.css';\n\nimport { RiSideBarLine } from '@remixicon/react';\nimport { AppShell } from '@/components/ui/wideset/app-shell/AppShell';\nimport { Breadcrumbs } from '@/components/ui/wideset/breadcrumbs/Breadcrumbs';\nimport { cn } from '@/lib/wideset/utils';\nimport { IconButton } from '@/components/ui/wideset/button/IconButton';\nimport { useEffect, useId, useRef, useState } from 'react';\n\nimport { BillingDetails } from './billing-details';\nimport { BillingPeriod } from './billing-period';\nimport { type CardErrors, emptyCard, validateCard } from './card';\nimport { billingDetails, demoSummary, type Interval, plan, subscription, workspace } from './data';\nimport { OrderItems } from './order-items';\nimport { OrderSummary, type PaymentState } from './order-summary';\nimport { type Method, PaymentMethod } from './payment-method';\nimport { Section } from './section';\nimport { CheckoutSidebar } from './sidebar';\n\n/** One column of the page: the header and the body share its edges. */\nconst COLUMN = 'px-ws-14 mx-auto w-full max-w-[80rem]';\n\n/**\n * Checkout (Inset direction): paying for a plan change on the raised page beside the workspace\n * sidebar. The order is the wide column, in the order it is decided: what is bought, how often it\n * is billed, how it is paid, who is invoiced. The summary stays in view beside it and holds the\n * page's one filled button. The screen holds the whole order, so every change reprices it.\n */\nexport default function Checkout() {\n  const cardId = useId();\n  const sidebarId = useId();\n  const [collapsed, setCollapsed] = useState(false);\n\n  const [seats, setSeats] = useState(subscription.seats);\n  const [addOnIds, setAddOnIds] = useState<string[]>([]);\n  const [interval, setInterval] = useState<Interval>('monthly');\n  const [showDiscount, setShowDiscount] = useState(false);\n  const [details, setDetails] = useState(billingDetails);\n  const [method, setMethod] = useState<Method>('saved');\n  const [card, setCard] = useState(emptyCard);\n  const [cardErrors, setCardErrors] = useState<CardErrors>({});\n  const [payment, setPayment] = useState<PaymentState>('idle');\n\n  const totals = demoSummary({ seats, addOnIds, interval, showDiscount });\n\n  // Cleared on unmount, so the stand-in request never lands on a closed screen.\n  const timer = useRef<number>(undefined);\n  useEffect(() => () => window.clearTimeout(timer.current), []);\n\n  // A timeout stands in for the charge; a real screen awaits it and, when the bank declines,\n  // says why at the card and leaves the order as it was.\n  function pay() {\n    if (method === 'new') {\n      const errors = validateCard(card);\n      setCardErrors(errors);\n      const [first] = Object.keys(errors);\n      if (first) return document.getElementById(`${cardId}-${first}`)?.focus();\n    }\n    setPayment('paying');\n    timer.current = window.setTimeout(() => setPayment('paid'), 1200);\n  }\n\n  return (\n    <AppShell className=\"ws-block-utility\" direction=\"inset\">\n      <CheckoutSidebar id={sidebarId} collapsed={collapsed} onCollapsedChange={setCollapsed} />\n      <AppShell.Main>\n        <div className=\"h-ws-18 border-ws-static-base flex shrink-0 items-center border-b\">\n          {/* The bar belongs to the surround: it runs edge to edge. The sidebar's toggle is pulled\n              left so its glyph, not its box, sits 20px from the edge; the crumbs follow it. */}\n          <div className=\"gap-ws-5 px-ws-11 flex w-full items-center\">\n            <IconButton\n              icon={RiSideBarLine}\n              variant=\"secondary\"\n              preset=\"ghost\"\n              size=\"sm\"\n              iconClassName=\"text-ws-static-subtle size-ws-9\"\n              aria-label={collapsed ? 'Expand sidebar' : 'Collapse sidebar'}\n              aria-expanded={!collapsed}\n              aria-controls={sidebarId}\n              onClick={() => setCollapsed(!collapsed)}\n              className=\"-ml-ws-5\"\n            />\n            <Breadcrumbs separator=\"arrow\">\n              <Breadcrumbs.Item asChild>\n                <a href=\"#settings\">Settings</a>\n              </Breadcrumbs.Item>\n              <Breadcrumbs.Item asChild>\n                <a href=\"#billing\">Billing</a>\n              </Breadcrumbs.Item>\n              <Breadcrumbs.Item>Checkout</Breadcrumbs.Item>\n            </Breadcrumbs>\n          </div>\n        </div>\n\n        {/* The page scrolls inside the card, so the card's corners stay put. */}\n        <div className=\"ws-scrollbar min-h-0 flex-1 overflow-y-auto\">\n          <div className={cn(COLUMN, 'gap-ws-14 pt-ws-14 pb-ws-16 flex flex-col')}>\n            <header className=\"gap-ws-2 flex flex-col\">\n              <h1 className=\"typography-title-md text-ws-static-strong\">Upgrade to {plan.name}</h1>\n              <p className=\"typography-body-md text-ws-static-subtle\">\n                {payment === 'paid'\n                  ? `${workspace.name} moved from ${subscription.plan} to ${plan.name} today.`\n                  : `${workspace.name} moves from ${subscription.plan} to ${plan.name} today. Review the order, then pay.`}\n              </p>\n            </header>\n\n            <div className=\"gap-ws-16 grid grid-cols-1 items-start lg:grid-cols-[minmax(0,1fr)_22rem]\">\n              {/* Once paid, the order is a record: it stays readable but no longer changes. */}\n              <div inert={payment !== 'idle'} className=\"gap-ws-14 flex flex-col\">\n                <Section title=\"Plan and add-ons\">\n                  <OrderItems\n                    seats={seats}\n                    onSeatsChange={setSeats}\n                    addOnIds={addOnIds}\n                    onAddOnsChange={setAddOnIds}\n                    interval={interval}\n                  />\n                </Section>\n                <Section title=\"Billing period\">\n                  <BillingPeriod interval={interval} seats={seats} onChange={setInterval} />\n                </Section>\n                <Section title=\"Payment method\">\n                  <PaymentMethod\n                    id={cardId}\n                    method={method}\n                    onMethodChange={setMethod}\n                    card={card}\n                    cardErrors={cardErrors}\n                    onCardChange={(next) => {\n                      setCard(next);\n                      setCardErrors({});\n                    }}\n                  />\n                </Section>\n                <Section title=\"Billing details\">\n                  <BillingDetails details={details} onChange={setDetails} />\n                </Section>\n              </div>\n\n              <div className=\"lg:top-ws-14 lg:sticky\">\n                <OrderSummary\n                  totals={totals}\n                  interval={interval}\n                  showDiscount={showDiscount}\n                  onDiscountChange={setShowDiscount}\n                  payment={payment}\n                  onPay={pay}\n                />\n              </div>\n            </div>\n          </div>\n        </div>\n      </AppShell.Main>\n    </AppShell>\n  );\n}\n"
    },
    {
      "path": "src/blocks/checkout/order-items.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/checkout/order-items.tsx",
      "content": "'use client';\n\nimport type { RemixiconComponentType } from '@remixicon/react';\nimport { Avatar } from '@/components/ui/wideset/avatar/Avatar';\nimport { Tile } from '@/components/ui/wideset/tile/Tile';\n\nimport { addOns, type Interval, MAX_SEATS, plan, subscription } from './data';\nimport { formatUsd } from './format';\nimport { SeatStepper } from './seat-stepper';\n\n/**\n * A line of the order: a thumbnail, the item's icon on a square `Avatar` (the library's neutral\n * icon tile), beside its name and the one fact that sets it apart. Decorative: the name says it.\n */\nfunction ItemBody({\n  icon: Icon,\n  title,\n  description,\n}: {\n  icon: RemixiconComponentType;\n  title: string;\n  description: string;\n}) {\n  return (\n    <div className=\"gap-ws-7 flex min-w-0 flex-1 items-center\">\n      <Avatar shape=\"square\" icon={<Icon />} aria-hidden />\n      <div className=\"gap-ws-3 flex min-w-0 flex-1 flex-col\">\n        <Tile.Title>{title}</Tile.Title>\n        <Tile.Description>{description}</Tile.Description>\n      </div>\n    </div>\n  );\n}\n\ntype OrderItemsProps = {\n  seats: number;\n  onSeatsChange: (seats: number) => void;\n  addOnIds: string[];\n  onAddOnsChange: (addOnIds: string[]) => void;\n  interval: Interval;\n};\n\n/**\n * What is being bought, the cart: the plan with its seats, then the add-ons to tick. Each is a\n * tile led by a thumbnail, with its control on the right edge; an add-on's whole tile is the\n * checkbox. Seats cannot go under the ones in use, and the plan's line says how many those are.\n */\nexport function OrderItems({\n  seats,\n  onSeatsChange,\n  addOnIds,\n  onAddOnsChange,\n  interval,\n}: OrderItemsProps) {\n  return (\n    <div role=\"group\" aria-label=\"Plan and add-ons\" className=\"gap-ws-5 flex flex-col\">\n      <Tile>\n        <ItemBody\n          icon={plan.icon}\n          title={`${plan.name} plan`}\n          description={`${formatUsd(plan.seatPrice[interval])} a seat a month. ${subscription.seatsInUse} seats are in use.`}\n        />\n        <span className=\"typography-label-sm text-ws-static-subtle\">Seats</span>\n        <SeatStepper\n          value={seats}\n          min={subscription.seatsInUse}\n          max={MAX_SEATS}\n          onChange={onSeatsChange}\n        />\n      </Tile>\n      {addOns.map((addOn) => (\n        <Tile.Checkbox\n          key={addOn.id}\n          checked={addOnIds.includes(addOn.id)}\n          onCheckedChange={(checked) =>\n            onAddOnsChange(\n              checked === true ? [...addOnIds, addOn.id] : addOnIds.filter((id) => id !== addOn.id),\n            )\n          }\n        >\n          <ItemBody icon={addOn.icon} title={addOn.name} description={addOn.description} />\n          <span className=\"typography-label-sm text-ws-static-base whitespace-nowrap tabular-nums\">\n            {formatUsd(addOn.monthlyPrice)} a month\n          </span>\n          <Tile.Indicator />\n        </Tile.Checkbox>\n      ))}\n    </div>\n  );\n}\n"
    },
    {
      "path": "src/blocks/checkout/order-summary.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/checkout/order-summary.tsx",
      "content": "'use client';\n\nimport { Button } from '@/components/ui/wideset/button/Button';\nimport { Card } from '@/components/ui/wideset/card/Card';\nimport { Chip } from '@/components/ui/wideset/chip/Chip';\nimport { InlineAlert } from '@/components/ui/wideset/inline-alert/InlineAlert';\nimport { useEffect, useId, useRef } from 'react';\n\nimport {\n  type Interval,\n  type OrderTotals,\n  plan,\n  product,\n  receiptEmail,\n  ROUTES,\n  samplePromo,\n  subscription,\n  today,\n  workspace,\n} from './data';\nimport { formatDate, formatPeriod, formatUsd } from './format';\nimport { PromoCode } from './promo-code';\nimport { SummaryRow } from './summary-row';\nimport { TextLink } from './text-link';\n\n/** Rows of one group, 12px apart. */\nconst ROWS = 'gap-ws-7 flex flex-col';\n/** A group that opens under a line. */\nconst RULED = 'border-ws-static-base pt-ws-11 border-t';\n\nexport type PaymentState = 'idle' | 'paying' | 'paid';\n\ntype OrderSummaryProps = {\n  totals: OrderTotals;\n  interval: Interval;\n  showDiscount: boolean;\n  onDiscountChange: (show: boolean) => void;\n  payment: PaymentState;\n  onPay: () => void;\n};\n\n/**\n * What the order comes to, beside the order and always in view: every line with its amount, the\n * promo code, what the unused time on the old plan takes off, the VAT, the total due today and\n * the next charge. It ends in the page's one filled button, which carries the amount. Paying\n * keeps the button in place, busy, then swaps it for the confirmation and the way to the receipt.\n */\nexport function OrderSummary({\n  totals,\n  interval,\n  showDiscount,\n  onDiscountChange,\n  payment,\n  onPay,\n}: OrderSummaryProps) {\n  const titleId = useId();\n  const receiptLink = useRef<HTMLAnchorElement>(null);\n  const period = interval === 'yearly' ? 'year' : 'month';\n  const total = formatUsd(totals.total);\n\n  // The button a keyboard user pressed is gone once the payment is in: hand focus to what follows.\n  useEffect(() => {\n    if (payment === 'paid') receiptLink.current?.focus();\n  }, [payment]);\n\n  return (\n    <Card role=\"region\" aria-labelledby={titleId}>\n      <Card.Header>\n        <h2 id={titleId} className=\"typography-label-strong-md text-ws-static-strong\">\n          Summary\n        </h2>\n      </Card.Header>\n      {/* Card.Content keeps 10px free on the right for a scrollbar; the padding gives it back, so\n          the amounts end on the button's edge. */}\n      <Card.Content contentClassName=\"pr-ws-6\">\n        <div className=\"gap-ws-11 flex flex-col\">\n          <dl className={ROWS}>\n            {totals.lines.map((line) => (\n              <SummaryRow\n                key={line.id}\n                label={line.label}\n                detail={\n                  line.id === 'plan'\n                    ? `${line.detail} × ${formatUsd(totals.seatPrice)}${totals.months > 1 ? ` × ${totals.months} months` : ''}`\n                    : totals.months > 1\n                      ? `${totals.months} months`\n                      : undefined\n                }\n                amount={formatUsd(line.amount)}\n              />\n            ))}\n          </dl>\n\n          <div className={`${RULED} ${ROWS}`}>\n            <dl className={ROWS}>\n              <SummaryRow label=\"Subtotal\" amount={formatUsd(totals.subtotal)} />\n            </dl>\n            {/* The field and the line it turns into share one place, so applying a code changes\n                nothing around it. */}\n            {!showDiscount && payment !== 'paid' && (\n              <PromoCode onApply={() => onDiscountChange(true)} />\n            )}\n            <dl className={ROWS}>\n              {showDiscount && (\n                <SummaryRow\n                  label={\n                    <>\n                      Promo code\n                      <Chip\n                        size=\"sm\"\n                        variant=\"secondary\"\n                        style=\"border\"\n                        disabled={payment !== 'idle'}\n                      >\n                        <Chip.Label>{samplePromo.code}</Chip.Label>\n                        <Chip.IconButton\n                          aria-label={`Remove promo code ${samplePromo.code}`}\n                          onClick={() => onDiscountChange(false)}\n                        />\n                      </Chip>\n                    </>\n                  }\n                  detail={`Sample discount for the first ${period}`}\n                  amount={formatUsd(-totals.discount)}\n                />\n              )}\n              <SummaryRow\n                label={`Unused time on ${subscription.plan}`}\n                detail={formatPeriod(today, subscription.periodEnd)}\n                amount={formatUsd(-totals.credit)}\n              />\n              <SummaryRow label={totals.tax.label} amount={formatUsd(totals.tax.amount)} />\n            </dl>\n          </div>\n\n          <div className={`${RULED} gap-ws-3 flex flex-col`}>\n            <dl>\n              <SummaryRow\n                strong\n                label={payment === 'paid' ? 'Paid today' : 'Total due today'}\n                amount={total}\n              />\n            </dl>\n            <p className=\"typography-caption-md text-ws-static-subtle tabular-nums\">\n              Then {formatUsd(totals.nextCharge.amount)} a {period} from{' '}\n              {formatDate(totals.nextCharge.date)}.\n            </p>\n          </div>\n        </div>\n      </Card.Content>\n      <Card.Footer>\n        {payment === 'paid' ? (\n          <InlineAlert\n            status=\"success\"\n            orientation=\"vertical\"\n            persistent\n            title=\"Payment received\"\n            message={`${workspace.name} is on ${plan.name} now. The receipt is on its way to ${receiptEmail}.`}\n          >\n            <InlineAlert.Action asChild>\n              <a ref={receiptLink} href={ROUTES.receipt}>\n                View receipt\n              </a>\n            </InlineAlert.Action>\n          </InlineAlert>\n        ) : (\n          <div className=\"gap-ws-7 flex w-full flex-col\">\n            {/* The point of the screen: default height, a step above the page's 32px controls. */}\n            <Button className=\"w-full\" disabled={payment === 'paying'} onClick={onPay}>\n              {payment === 'paying' ? 'Paying…' : `Pay ${total}`}\n            </Button>\n            <p className=\"typography-caption-md text-ws-static-subtle text-center\">\n              Cancel any time. By paying you agree to {product.name}’s{' '}\n              <TextLink href={ROUTES.terms}>terms</TextLink>.\n            </p>\n          </div>\n        )}\n      </Card.Footer>\n    </Card>\n  );\n}\n"
    },
    {
      "path": "src/blocks/checkout/payment-method.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/checkout/payment-method.tsx",
      "content": "'use client';\n\nimport { RiBankCardLine, RiMastercardLine } from '@remixicon/react';\nimport { Tile } from '@/components/ui/wideset/tile/Tile';\n\nimport type { CardErrors, CardValues } from './card';\nimport { CardFields } from './card-fields';\nimport { savedCard } from './data';\nimport { formatExpiry } from './format';\n\nexport type Method = 'saved' | 'new';\n\ntype PaymentMethodProps = {\n  /** Prefix of the card fields' ids. */\n  id: string;\n  method: Method;\n  onMethodChange: (method: Method) => void;\n  card: CardValues;\n  cardErrors: CardErrors;\n  onCardChange: (card: CardValues) => void;\n};\n\n/**\n * How the order is paid: the card on file, chosen to start with, or another one. Picking the\n * other opens its fields under the choice, in place, so the order stays in view.\n */\nexport function PaymentMethod({\n  id,\n  method,\n  onMethodChange,\n  card,\n  cardErrors,\n  onCardChange,\n}: PaymentMethodProps) {\n  return (\n    <div className=\"gap-ws-9 flex flex-col\">\n      <Tile.RadioGroup\n        aria-label=\"Payment method\"\n        orientation=\"horizontal\"\n        value={method}\n        onValueChange={(value) => onMethodChange(value as Method)}\n      >\n        <Tile.Radio\n          value=\"saved\"\n          icon={RiMastercardLine}\n          title={`${savedCard.brand} ending ${savedCard.last4}`}\n          description={`Expires ${formatExpiry(savedCard.expires)}`}\n        />\n        <Tile.Radio\n          value=\"new\"\n          icon={RiBankCardLine}\n          title=\"Use another card\"\n          description=\"Visa, Mastercard or American Express\"\n        />\n      </Tile.RadioGroup>\n      {method === 'new' && (\n        <CardFields id={id} values={card} errors={cardErrors} onChange={onCardChange} />\n      )}\n    </div>\n  );\n}\n"
    },
    {
      "path": "src/blocks/checkout/people.assets.ts",
      "type": "registry:file",
      "target": "blocks/wideset/checkout/people.assets.ts",
      "content": "// Portraits of the sample people as small JPEG data URLs (a block ships only .ts and .tsx).\n// Exported from the Wideset Core Figma file by people.cjs: do not edit by hand.\n\n/** A person’s photo by name. People who are not here show their initials. */\nexport const PHOTOS: Record<string, string | undefined> = {\n  'Maya Okafor':\n    'data:image/jpeg;base64,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',\n};\n"
    },
    {
      "path": "src/blocks/checkout/person-avatar.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/checkout/person-avatar.tsx",
      "content": "'use client';\n\nimport { Avatar } from '@/components/ui/wideset/avatar/Avatar';\nimport { type AvatarColor } from '@/components/ui/wideset/avatar/Avatar.colors';\nimport { type AvatarProps } from '@/components/ui/wideset/avatar/Avatar.types';\n\nimport { PHOTOS } from './people.assets';\n\ntype PersonAvatarProps = Pick<\n  AvatarProps,\n  'size' | 'shape' | 'status' | 'className' | 'style' | 'title' | 'aria-hidden' | 'aria-label'\n> & {\n  /** The person's full name: the key their photo is filed under. */\n  name: string;\n  initials: string;\n  /** The colour of the initials. A photo takes none. */\n  color?: AvatarColor;\n  /** Empty beside the person's name (the default); their name when the avatar stands alone. */\n  alt?: string;\n};\n\n/**\n * A person's avatar: their photo when they have one, their initials when not. The choice lives\n * here so every place the block draws a person mixes the two the same way. The rest of the props\n * go to the `Avatar`, so it also sits in an `Avatar.Group`.\n */\nexport function PersonAvatar({ name, initials, color, alt = '', ...avatar }: PersonAvatarProps) {\n  const photo = PHOTOS[name];\n  return photo ? (\n    <Avatar src={photo} alt={alt} initials={initials} {...avatar} />\n  ) : (\n    <Avatar initials={initials} color={color} {...avatar} />\n  );\n}\n"
    },
    {
      "path": "src/blocks/checkout/promo-code.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/checkout/promo-code.tsx",
      "content": "'use client';\n\nimport { FormField } from '@/components/ui/wideset/form-field/FormField';\nimport { TextInput } from '@/components/ui/wideset/text-input/TextInput';\nimport { type FormEvent, useId, useState } from 'react';\n\nimport { samplePromo } from './data';\n\n/**\n * The promo code field demonstrates an applied discount and a field error using one sample\n * code. Apply sits in the field's suffix so Enter works too.\n */\nexport function PromoCode({ onApply }: { onApply: () => void }) {\n  const id = useId();\n  const [code, setCode] = useState('');\n  const [error, setError] = useState<string>();\n\n  const apply = (event: FormEvent<HTMLFormElement>) => {\n    event.preventDefault();\n    const typed = code.trim();\n    if (typed.toUpperCase() === samplePromo.code) onApply();\n    else setError(typed ? `Try the sample code ${samplePromo.code}.` : 'Enter a promo code first.');\n  };\n\n  return (\n    <form noValidate onSubmit={apply}>\n      <FormField\n        label=\"Promo code\"\n        htmlFor={id}\n        helperText={`Sample code: ${samplePromo.code}`}\n        errorText={error}\n      >\n        <TextInput\n          id={id}\n          name=\"promo\"\n          size=\"sm\"\n          autoComplete=\"off\"\n          autoCapitalize=\"characters\"\n          spellCheck={false}\n          variant={error ? 'danger' : 'primary'}\n          value={code}\n          onChange={(event) => {\n            setCode(event.target.value);\n            setError(undefined);\n          }}\n        >\n          <TextInput.Input />\n          <TextInput.Suffix>\n            <TextInput.Button type=\"submit\">Apply</TextInput.Button>\n          </TextInput.Suffix>\n        </TextInput>\n      </FormField>\n    </form>\n  );\n}\n"
    },
    {
      "path": "src/blocks/checkout/seat-stepper.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/checkout/seat-stepper.tsx",
      "content": "'use client';\n\n// TODO(custom): quantity stepper (minus, a number field, plus); Wideset has no NumberInput, so it is a TextInput with an icon button in each boxed affix.\nimport { RiAddLine, RiSubtractLine } from '@remixicon/react';\nimport { TextInput } from '@/components/ui/wideset/text-input/TextInput';\nimport { useState } from 'react';\n\ntype SeatStepperProps = {\n  value: number;\n  min: number;\n  max: number;\n  onChange: (value: number) => void;\n};\n\n/**\n * How many seats to buy. A native number field does the work (the arrow keys step it, a screen\n * reader hears a spin button with its limits) and the two buttons step it by one. A number typed\n * outside the limits is held back until the field is left, then pulled to the nearest limit.\n */\nexport function SeatStepper({ value, min, max, onChange }: SeatStepperProps) {\n  // What is being typed, while it differs from the value: \"4\" on the way to \"45\".\n  const [draft, setDraft] = useState<string | null>(null);\n\n  const type = (text: string) => {\n    setDraft(text);\n    const seats = Number(text);\n    if (text !== '' && Number.isInteger(seats) && seats >= min && seats <= max) onChange(seats);\n  };\n\n  const settle = () => {\n    if (draft === null) return;\n    const seats = draft === '' ? value : Math.round(Number(draft));\n    onChange(Math.min(max, Math.max(min, seats)));\n    setDraft(null);\n  };\n\n  const step = (by: number) => {\n    setDraft(null);\n    onChange(Math.min(max, Math.max(min, value + by)));\n  };\n\n  return (\n    <TextInput\n      size=\"sm\"\n      type=\"number\"\n      min={min}\n      max={max}\n      step={1}\n      inputMode=\"numeric\"\n      aria-label=\"Seats\"\n      value={draft ?? String(value)}\n      onChange={(event) => type(event.target.value)}\n      onBlur={settle}\n      className=\"w-[7.5rem] shrink-0\"\n    >\n      <TextInput.Prefix>\n        <TextInput.IconButton\n          icon={RiSubtractLine}\n          aria-label=\"Remove a seat\"\n          disabled={value <= min}\n          onClick={() => step(-1)}\n        />\n      </TextInput.Prefix>\n      {/* The browser's own spin arrows are hidden: the two buttons stand in for them. */}\n      <TextInput.Input className=\"[appearance:textfield] text-center tabular-nums [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none\" />\n      <TextInput.Suffix>\n        <TextInput.IconButton\n          icon={RiAddLine}\n          aria-label=\"Add a seat\"\n          disabled={value >= max}\n          onClick={() => step(1)}\n        />\n      </TextInput.Suffix>\n    </TextInput>\n  );\n}\n"
    },
    {
      "path": "src/blocks/checkout/section.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/checkout/section.tsx",
      "content": "'use client';\n\n// TODO(custom): section title above its content; Wideset has no Section or PageSection.\nimport { type ReactNode, useId } from 'react';\n\n/** One part of the order: a 16px title, then what it holds. The title names the region. */\nexport function Section({ title, children }: { title: string; children: ReactNode }) {\n  const id = useId();\n\n  return (\n    <section aria-labelledby={id} className=\"gap-ws-7 flex flex-col\">\n      <h2 id={id} className=\"typography-label-strong-md text-ws-static-strong\">\n        {title}\n      </h2>\n      {children}\n    </section>\n  );\n}\n"
    },
    {
      "path": "src/blocks/checkout/sidebar.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/checkout/sidebar.tsx",
      "content": "'use client';\n\n// TODO(custom): workspace switcher and account menu are composed by hand.\nimport {\n  RiAddLine,\n  RiArrowDownSLine,\n  RiLogoutBoxRLine,\n  RiSearchLine,\n  RiSettingsLine,\n} from '@remixicon/react';\nimport { Divider } from '@/components/ui/wideset/divider/Divider';\nimport { DropdownMenu } from '@/components/ui/wideset/dropdown/DropdownMenu';\nimport { IconButton } from '@/components/ui/wideset/button/IconButton';\nimport { ListItem } from '@/components/ui/wideset/list-item/ListItem';\nimport { Sidebar } from '@/components/ui/wideset/sidebar/Sidebar';\nimport { type SidebarProps } from '@/components/ui/wideset/sidebar/Sidebar.types';\nimport { TextInput } from '@/components/ui/wideset/text-input/TextInput';\nimport { useState } from 'react';\n\nimport { BrandMark } from './brand-mark';\nimport {\n  account,\n  helpLink,\n  mainLinks,\n  type NavLink,\n  product,\n  settingsLinks,\n  workspace,\n} from './data';\nimport { PersonAvatar } from './person-avatar';\n\n/**\n * The workspace sidebar: switcher, search, the app's pages, settings and the signed-in account.\n * Its toggle sits in the page bar, so the screen holds `collapsed` and passes it down; collapsed,\n * it keeps the mark, the page icons and the avatar.\n */\nexport function CheckoutSidebar(\n  props: Pick<SidebarProps, 'id' | 'collapsed' | 'onCollapsedChange'>,\n) {\n  const [active, setActive] = useState('billing');\n\n  const link = ({ id, label, icon, activeIcon }: NavLink) => (\n    <Sidebar.Item\n      key={id}\n      href={`#${id}`}\n      icon={active === id ? (activeIcon ?? icon) : icon}\n      label={label}\n      active={active === id}\n      onClick={() => setActive(id)}\n    />\n  );\n\n  const nav = (\n    <nav aria-label=\"Workspace\" className=\"gap-ws-9 flex flex-col\">\n      <div className=\"flex flex-col\">{mainLinks.map(link)}</div>\n      <Divider weight=\"thin\" />\n      <div role=\"group\" aria-labelledby=\"sidebar-settings\" className=\"gap-ws-2 flex flex-col\">\n        <Sidebar.SectionHeader id=\"sidebar-settings\">Settings</Sidebar.SectionHeader>\n        {settingsLinks.map(link)}\n      </div>\n    </nav>\n  );\n\n  return (\n    <Sidebar {...props}>\n      <Sidebar.Header>\n        <Sidebar.Expanded>\n          <div className=\"gap-ws-9 flex flex-col\">\n            <div className=\"gap-ws-7 pt-ws-3 pb-ws-7 flex items-center\">\n              <BrandMark className=\"size-ws-15\" />\n              <div className=\"flex min-w-0 flex-1 flex-col\">\n                <span className=\"typography-label-strong-sm text-ws-static-strong truncate\">\n                  {workspace.name}\n                </span>\n                <span className=\"typography-caption-md text-ws-static-subtle truncate\">\n                  {product.name}\n                </span>\n              </div>\n              <DropdownMenu>\n                <DropdownMenu.Trigger asChild>\n                  <IconButton\n                    icon={RiArrowDownSLine}\n                    variant=\"secondary\"\n                    preset=\"ghost\"\n                    size=\"xs\"\n                    aria-label=\"Switch workspace\"\n                    className=\"mr-ws-3\"\n                  />\n                </DropdownMenu.Trigger>\n                <DropdownMenu.Content className=\"ws-block-utility\" align=\"end\">\n                  <DropdownMenu.Item data-state=\"checked\">\n                    <ListItem.Content>\n                      <ListItem.Label>{workspace.name}</ListItem.Label>\n                    </ListItem.Content>\n                  </DropdownMenu.Item>\n                  <DropdownMenu.Separator />\n                  <DropdownMenu.Item>\n                    <ListItem.Prefix>\n                      <RiAddLine className=\"size-ws-9\" />\n                    </ListItem.Prefix>\n                    <ListItem.Content>\n                      <ListItem.Label>New workspace</ListItem.Label>\n                    </ListItem.Content>\n                  </DropdownMenu.Item>\n                </DropdownMenu.Content>\n              </DropdownMenu>\n            </div>\n            <TextInput size=\"sm\">\n              <TextInput.Prefix inner>\n                <TextInput.Icon icon={RiSearchLine} />\n              </TextInput.Prefix>\n              <TextInput.Input type=\"search\" placeholder=\"Search\" aria-label=\"Search\" />\n            </TextInput>\n          </div>\n        </Sidebar.Expanded>\n        <Sidebar.Collapsed>\n          <div className=\"pt-ws-3 pb-ws-7 flex justify-center\">\n            <BrandMark className=\"size-ws-15\" />\n          </div>\n        </Sidebar.Collapsed>\n      </Sidebar.Header>\n\n      {/* A section draws only the slot for the state it is in, so the pages go in both. */}\n      <Sidebar.Section scrollable>{nav}</Sidebar.Section>\n\n      <Sidebar.Footer>\n        <div className=\"gap-ws-9 flex flex-col\">\n          <div className=\"flex flex-col\">{link(helpLink)}</div>\n          {/* On the grey ground the line keeps the nav's inset: run edge to edge, it would stop\n              short of the page and read as broken. */}\n          <div className=\"border-ws-static-base pt-ws-5 border-t\">\n            <Sidebar.Expanded>\n              <DropdownMenu>\n                <DropdownMenu.Trigger asChild>\n                  <button\n                    type=\"button\"\n                    className=\"gap-ws-5 px-ws-5 py-ws-3 rounded-ws-control-lg hover:bg-ws-dynamic-tertiary-alpha-strong-default focus-visible:wds-focus-visible outline-ws-dynamic-primary-strong-default flex w-full items-center text-left\"\n                  >\n                    <PersonAvatar name={account.name} initials={account.initials} color=\"orange\" />\n                    <span className=\"flex min-w-0 flex-1 flex-col\">\n                      <span className=\"typography-label-strong-sm text-ws-static-base truncate\">\n                        {account.name}\n                      </span>\n                      <span className=\"typography-caption-md text-ws-static-subtle truncate\">\n                        {account.email}\n                      </span>\n                    </span>\n                    <RiArrowDownSLine\n                      aria-hidden=\"true\"\n                      className=\"size-ws-9 text-ws-static-strong\"\n                    />\n                  </button>\n                </DropdownMenu.Trigger>\n                <DropdownMenu.Content side=\"top\" align=\"start\" className=\"ws-block-utility w-[14rem]\">\n                  <DropdownMenu.Item>\n                    <ListItem.Prefix>\n                      <RiSettingsLine className=\"size-ws-9\" />\n                    </ListItem.Prefix>\n                    <ListItem.Content>\n                      <ListItem.Label>Account settings</ListItem.Label>\n                    </ListItem.Content>\n                  </DropdownMenu.Item>\n                  <DropdownMenu.Separator />\n                  <DropdownMenu.Item variant=\"danger\">\n                    <ListItem.Prefix>\n                      <RiLogoutBoxRLine className=\"size-ws-9\" />\n                    </ListItem.Prefix>\n                    <ListItem.Content>\n                      <ListItem.Label>Log out</ListItem.Label>\n                    </ListItem.Content>\n                  </DropdownMenu.Item>\n                </DropdownMenu.Content>\n              </DropdownMenu>\n            </Sidebar.Expanded>\n            <Sidebar.Collapsed>\n              <div className=\"flex justify-center\">\n                <PersonAvatar\n                  name={account.name}\n                  initials={account.initials}\n                  color=\"orange\"\n                  title={account.name}\n                  alt={account.name}\n                />\n              </div>\n            </Sidebar.Collapsed>\n          </div>\n        </div>\n      </Sidebar.Footer>\n    </Sidebar>\n  );\n}\n"
    },
    {
      "path": "src/blocks/checkout/summary-row.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/checkout/summary-row.tsx",
      "content": "'use client';\n\n// TODO(custom): summary row (label, a detail under it, the amount on the right); no DescriptionList in Wideset.\nimport { cn } from '@/lib/wideset/utils';\nimport type { ReactNode } from 'react';\n\ntype SummaryRowProps = {\n  label: ReactNode;\n  /** What the amount is made of, under the label. */\n  detail?: string;\n  amount: string;\n  /** The figure the reader is after: the total. */\n  strong?: boolean;\n};\n\n/**\n * A label and its amount on one row of the summary, with room for a line of detail. Label and\n * amount share a baseline, so a column of rows reads as a column of figures. Render inside a `dl`.\n */\nexport function SummaryRow({ label, detail, amount, strong }: SummaryRowProps) {\n  return (\n    <div className=\"gap-ws-9 flex items-baseline justify-between\">\n      <dt className=\"flex min-w-0 flex-col\">\n        <span\n          className={cn(\n            'gap-ws-5 flex flex-wrap items-center',\n            strong\n              ? 'typography-label-strong-md text-ws-static-strong'\n              : 'typography-body-md text-ws-static-base',\n          )}\n        >\n          {label}\n        </span>\n        {detail && (\n          <span className=\"typography-caption-md text-ws-static-subtle tabular-nums\">{detail}</span>\n        )}\n      </dt>\n      <dd\n        className={cn(\n          'shrink-0 tabular-nums',\n          strong\n            ? 'typography-title-sm text-ws-static-strong'\n            : 'typography-body-md text-ws-static-base',\n        )}\n      >\n        {amount}\n      </dd>\n    </div>\n  );\n}\n"
    },
    {
      "path": "src/blocks/checkout/text-link.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/checkout/text-link.tsx",
      "content": "'use client';\n\n// TODO(custom): a link inside a sentence; Wideset has no inline text link (LinkButton is a control with its own padding and height).\nimport { cn } from '@/lib/wideset/utils';\nimport type { AnchorHTMLAttributes } from 'react';\n\n/**\n * A link inside a sentence, as Figma draws the terms link: the sentence's own type in the primary\n * colour. The underline comes on hover and focus.\n */\nexport function TextLink({\n  className,\n  children,\n  ...props\n}: AnchorHTMLAttributes<HTMLAnchorElement>) {\n  return (\n    <a\n      className={cn(\n        'text-ws-dynamic-primary-default hover:text-ws-dynamic-primary-hover active:text-ws-dynamic-primary-pressed rounded-ws-control-sm focus-visible:wds-focus-visible outline-ws-dynamic-primary-strong-default decoration-from-font hover:underline focus-visible:underline',\n        className,\n      )}\n      {...props}\n    >\n      {children}\n    </a>\n  );\n}\n"
    }
  ],
  "meta": {
    "version": "1.1.0",
    "commit": "a734f9f0"
  }
}
