{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "cta-ticket",
  "type": "registry:block",
  "title": "CTA Ticket",
  "description": "An event call to action styled as a printed ticket with a tear-off stub.",
  "files": [
    {
      "path": "src/registry/blocks/cta/cta-ticket.tsx",
      "type": "registry:block",
      "content": "import { useId, type ComponentProps, type CSSProperties } from \"react\";\nimport { Button } from \"@/components/ui/button\";\nimport { cn } from \"@/lib/utils\";\n\ntype Action = { label: string; href: string };\n\nexport type CtaTicketDetail = { label: string; value: string };\n\nexport type CtaTicketProps = {\n  eyebrow?: string;\n  /** Short intro beside the ticket. */\n  description?: string;\n  /** Availability line, e.g. \"214 of 600 left\". */\n  availability?: string;\n  eventName?: string;\n  edition?: string;\n  ticketNumber?: string;\n  /** Date, venue, city, seat and price rows, set in mono. */\n  details?: CtaTicketDetail[];\n  /** The stub: weekday, big day numeral, month + year. */\n  stub?: { weekday: string; day: string; monthYear: string; note?: string };\n  primaryAction?: Action;\n  /** Usually a link to an .ics file. */\n  calendarAction?: Action;\n  /** Stub ink. Defaults to Devsloka blue; a pale tint (#E8F0FF) works with accentForeground \"#0A0A0A\". */\n  accent?: string;\n  /** Text colour on the stub. Must pass contrast against `accent`. */\n  accentForeground?: string;\n} & ComponentProps<\"section\">;\n\nconst DEFAULTS = {\n  eyebrow: \"Tickets · On sale now\",\n  description:\n    \"Two days of risograph, letterpress and type in a riverside warehouse. Forty print studios, six talks, one long lunch. No livestream, no recordings.\",\n  availability: \"214 of 600 weekend passes left\",\n  eventName: \"Halftone Days\",\n  edition: \"Edition 03\",\n  ticketNumber: \"No. 0412\",\n  details: [\n    { label: \"Date\", value: \"Sat 21 – Sun 22 Nov 2026\" },\n    { label: \"Doors\", value: \"09:30, talks from 11:00\" },\n    { label: \"Venue\", value: \"Armazém 16, Rua da Cintura do Porto\" },\n    { label: \"City\", value: \"Lisbon, Portugal\" },\n    { label: \"Seat\", value: \"General admission, standing\" },\n    { label: \"Price\", value: \"€85 weekend · €50 one day\" },\n  ],\n  stub: { weekday: \"Sat\", day: \"21\", monthYear: \"Nov 2026\", note: \"Gate B · Keep this half\" },\n  primaryAction: { label: \"Get tickets\", href: \"#\" },\n  calendarAction: { label: \"Add to calendar\", href: \"#\" },\n  accent: \"#0A6EFF\",\n  accentForeground: \"#FFFFFF\",\n};\n\n// Deterministic bar widths for the printed barcode on the stub.\nconst BARCODE = [3, 1, 2, 1, 1, 3, 2, 1, 3, 1, 1, 2, 3, 1, 2, 2, 1, 3, 1, 1, 2, 1, 3, 2];\nconst BARCODE_WIDTH = BARCODE.reduce((sum, w) => sum + w, 0);\n// Even entries are ink bars, odd entries are gaps.\nconst BARS = BARCODE.flatMap((w, i) => {\n  const x = BARCODE.slice(0, i).reduce((sum, v) => sum + v, 0);\n  return i % 2 === 0 ? [{ x, w }] : [];\n});\n\nexport function CtaTicket({\n  eyebrow = DEFAULTS.eyebrow,\n  description = DEFAULTS.description,\n  availability = DEFAULTS.availability,\n  eventName = DEFAULTS.eventName,\n  edition = DEFAULTS.edition,\n  ticketNumber = DEFAULTS.ticketNumber,\n  details = DEFAULTS.details,\n  stub = DEFAULTS.stub,\n  primaryAction = DEFAULTS.primaryAction,\n  calendarAction = DEFAULTS.calendarAction,\n  accent = DEFAULTS.accent,\n  accentForeground = DEFAULTS.accentForeground,\n  className,\n  style,\n  ...props\n}: CtaTicketProps) {\n  const headingId = useId();\n\n  return (\n    <section\n      data-slot=\"cta-ticket\"\n      aria-labelledby={headingId}\n      style={{ \"--block-accent\": accent, \"--block-accent-fg\": accentForeground, ...style } as CSSProperties}\n      className={cn(\"w-full bg-background text-foreground\", className)}\n      {...props}\n    >\n      <div className=\"mx-auto grid max-w-6xl gap-12 px-6 py-20 md:py-28 lg:grid-cols-12 lg:gap-10\">\n        <div className=\"lg:col-span-4 lg:pt-2\">\n          <p className=\"font-mono text-xs uppercase tracking-wider text-muted-foreground\">{eyebrow}</p>\n          <p className=\"mt-6 max-w-sm text-base leading-relaxed\">{description}</p>\n          {availability && (\n            <p className=\"mt-6 flex items-center gap-2 font-mono text-xs tabular-nums text-muted-foreground\">\n              <span aria-hidden className=\"size-2 bg-[var(--block-accent)]\" />\n              {availability}\n            </p>\n          )}\n        </div>\n\n        <article className=\"flex flex-col md:flex-row lg:col-span-8\" aria-labelledby={headingId}>\n          {/* Main part of the ticket. */}\n          <div className=\"flex-1 bg-muted p-6 sm:p-8\">\n            <div className=\"flex justify-between gap-4 font-mono text-[11px] uppercase tracking-wider text-muted-foreground\">\n              <span>Admit one · {ticketNumber}</span>\n              <span>{edition}</span>\n            </div>\n            <h2\n              id={headingId}\n              className=\"mt-8 text-5xl font-semibold leading-[0.9] tracking-[-0.04em] sm:text-6xl\"\n            >\n              {eventName}\n            </h2>\n            <dl className=\"mt-8 grid gap-x-6 border-t border-foreground/15 sm:grid-cols-2\">\n              {details.map((d) => (\n                <div key={d.label} className=\"grid grid-cols-[4.5rem_1fr] gap-x-3 border-b border-foreground/15 py-2.5 font-mono text-xs\">\n                  <dt className=\"uppercase tracking-wider text-muted-foreground\">{d.label}</dt>\n                  <dd className=\"tabular-nums\">{d.value}</dd>\n                </div>\n              ))}\n            </dl>\n            <div className=\"mt-8 flex flex-wrap items-center gap-x-6 gap-y-3\">\n              <Button asChild size=\"lg\" className=\"rounded-none\">\n                <a href={primaryAction.href}>{primaryAction.label}</a>\n              </Button>\n              <a\n                href={calendarAction.href}\n                className=\"text-sm font-medium underline decoration-1 underline-offset-[6px] outline-none hover:text-muted-foreground focus-visible:ring-2 focus-visible:ring-ring\"\n              >\n                {calendarAction.label}\n              </a>\n            </div>\n          </div>\n\n          {/* Tear-off stub: perforated edge plus two notches punched out in the page colour. */}\n          <div className=\"relative flex flex-row items-end justify-between gap-6 border-t-2 border-dashed border-background bg-[var(--block-accent)] p-6 text-[var(--block-accent-fg)] sm:p-8 md:w-56 md:flex-col md:items-start md:border-t-0 md:border-l-2\">\n            <span aria-hidden className=\"absolute -top-3 -left-3 size-6 rounded-full bg-background\" />\n            <span\n              aria-hidden\n              className=\"absolute -top-3 -right-3 size-6 rounded-full bg-background md:top-auto md:right-auto md:-bottom-3 md:-left-3\"\n            />\n            <p className=\"sr-only\">\n              {stub.weekday} {stub.day} {stub.monthYear}\n            </p>\n            <div aria-hidden>\n              <p className=\"font-mono text-xs uppercase tracking-wider\">{stub.weekday}</p>\n              <p className=\"text-8xl font-semibold leading-[0.85] tracking-[-0.05em] tabular-nums md:text-9xl\">\n                {stub.day}\n              </p>\n              <p className=\"mt-2 font-mono text-xs uppercase tracking-wider\">{stub.monthYear}</p>\n            </div>\n            <div className=\"text-right md:text-left\">\n              <svg aria-hidden viewBox={`0 0 ${BARCODE_WIDTH} 20`} preserveAspectRatio=\"none\" className=\"ml-auto h-8 w-28 md:ml-0\">\n                {BARS.map((b) => (\n                  <rect key={b.x} x={b.x} y=\"0\" width={b.w} height=\"20\" fill=\"currentColor\" />\n                ))}\n              </svg>\n              {stub.note && <p className=\"mt-2 font-mono text-[10px] uppercase tracking-wider\">{stub.note}</p>}\n            </div>\n          </div>\n        </article>\n      </div>\n    </section>\n  );\n}\n"
    }
  ],
  "registryDependencies": [
    "button"
  ]
}
