{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "newsletter-signup",
  "title": "Newsletter signup",
  "description": "Split newsletter card with topic checkboxes, validation, a counting reader number, a success check with the chosen topics and a sidebar of recent issues you can open.",
  "dependencies": [
    "lucide-react"
  ],
  "registryDependencies": [
    "https://goodui.dev/r/avatar.json",
    "https://goodui.dev/r/button.json",
    "https://goodui.dev/r/checkbox.json",
    "https://goodui.dev/r/counter-up.json",
    "https://goodui.dev/r/input.json",
    "https://goodui.dev/r/success-check.json"
  ],
  "files": [
    {
      "path": "registry/blocks/marketing/newsletter-signup.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { ArrowRight, Check, Mail, Sparkles } from \"lucide-react\"\nimport { Avatar, AvatarGroup } from \"@/components/goodui/avatar\"\nimport { Button } from \"@/components/goodui/button\"\nimport { Checkbox } from \"@/components/goodui/checkbox\"\nimport { Input } from \"@/components/goodui/input\"\nimport { SuccessCheck } from \"@/components/goodui/success-check\"\nimport { CounterUp } from \"@/components/goodui/counter-up\"\nimport { cn } from \"@/lib/utils\"\n\n/* ---------- Demo data ---------- */\n\nconst TOPICS = [\n  { id: \"growth\", label: \"Growing a studio\", hint: \"Pricing, retention, reviews\" },\n  { id: \"product\", label: \"Product updates\", hint: \"What shipped this month\" },\n  { id: \"playbooks\", label: \"Playbooks\", hint: \"No-show, waitlist, deposits\" },\n]\nconst READERS = [\"Maya Patel\", \"Leo Park\", \"Priya Nair\", \"Sam Okafor\", \"Lena Fischer\"]\nconst PAST = [\n  { title: \"The 24-hour reminder is too early\", readers: \"12.4k\" },\n  { title: \"Deposits without the awkward conversation\", readers: \"9.8k\" },\n  { title: \"Why your Thursday is empty\", readers: \"8.1k\" },\n]\n\n/* ---------- Block ---------- */\n\nexport default function NewsletterSignup() {\n  const [email, setEmail] = React.useState(\"\")\n  const [topics, setTopics] = React.useState<string[]>([\"growth\", \"playbooks\"])\n  const [error, setError] = React.useState<string | null>(null)\n  const [done, setDone] = React.useState(false)\n  const [opened, setOpened] = React.useState<string | null>(null)\n\n  const submit = (e: React.FormEvent) => {\n    e.preventDefault()\n    if (!/^\\S+@\\S+\\.\\S+$/.test(email)) return setError(\"Enter a valid email\")\n    if (!topics.length) return setError(\"Pick at least one topic\")\n    setError(null)\n    setDone(true)\n  }\n\n  return (\n    <div className=\"p-4 md:p-6\">\n      <section className=\"mx-auto grid max-w-5xl overflow-hidden rounded-3xl border bg-card lg:grid-cols-[1.1fr_1fr]\">\n        <div className=\"relative p-6 sm:p-10\">\n          <div aria-hidden=\"true\" className=\"absolute -top-16 -left-16 size-56 rounded-full bg-primary/15 blur-3xl\" />\n          <div className=\"relative\">\n            <div className=\"inline-flex items-center gap-2 rounded-full border bg-background px-3 py-1 text-xs font-medium\">\n              <Mail className=\"size-3.5 text-primary\" /> The Front Desk · every other Tuesday\n            </div>\n            <h2 className=\"mt-4 font-heading text-3xl font-semibold tracking-tight sm:text-4xl\">One idea to fill your calendar, in your inbox</h2>\n            <p className=\"mt-3 text-muted-foreground\">Short, practical and written by people who ran studios before they built software. No fluff, unsubscribe in one click.</p>\n            {done ? (\n              <div className=\"mt-7 flex flex-col items-center gap-3 rounded-2xl border bg-background p-6 text-center\">\n                <SuccessCheck size={64} />\n                <div className=\"text-lg font-semibold\">You're in</div>\n                <p className=\"text-sm text-muted-foreground\">\n                  We sent a confirmation to <strong className=\"text-foreground\">{email}</strong>. Topics: {topics.map((t) => TOPICS.find((x) => x.id === t)?.label).join(\", \")}.\n                </p>\n                <Button size=\"sm\" variant=\"ghost\" tone=\"neutral\" onClick={() => { setDone(false); setEmail(\"\") }}>Use a different email</Button>\n              </div>\n            ) : (\n              <form onSubmit={submit} className=\"mt-7 flex flex-col gap-4\">\n                <div className=\"flex flex-col gap-2 sm:flex-row sm:items-start\">\n                  <Input aria-label=\"Email address\" type=\"email\" placeholder=\"you@studio.com\" value={email} onValueChange={setEmail} state={error && !topics.length === false && error.includes(\"email\") ? \"error\" : \"default\"} message={error?.includes(\"email\") ? error : undefined} shakeKey={error ?? undefined} size=\"lg\" fullWidth className=\"flex-1\" />\n                  <Button type=\"submit\" size=\"lg\" animation=\"arrow\" iconRight={<ArrowRight />} className=\"shrink-0\">Subscribe</Button>\n                </div>\n                <fieldset>\n                  <legend className=\"mb-2 text-xs font-medium text-muted-foreground\">What should we send?</legend>\n                  <div className=\"grid gap-2 sm:grid-cols-3\">\n                    {TOPICS.map((t) => (\n                      <Checkbox key={t.id} variant=\"card\" size=\"sm\" label={t.label} description={t.hint} checked={topics.includes(t.id)} onCheckedChange={(c) => setTopics((s) => (c ? [...s, t.id] : s.filter((x) => x !== t.id)))} />\n                    ))}\n                  </div>\n                  {error?.includes(\"topic\") && <p className=\"mt-2 text-xs text-destructive\">{error}</p>}\n                </fieldset>\n              </form>\n            )}\n            <div className=\"mt-6 flex items-center gap-3 text-sm text-muted-foreground\">\n              <AvatarGroup size=\"xs\" max={5}>\n                {READERS.map((n) => (\n                  <Avatar key={n} name={n} size=\"xs\" />\n                ))}\n              </AvatarGroup>\n              <span>\n                Read by <CounterUp value={18240} className=\"font-semibold text-foreground\" format={{ maximumFractionDigits: 0 }} /> owners\n              </span>\n            </div>\n          </div>\n        </div>\n        <div className=\"flex flex-col border-t bg-muted/40 p-6 sm:p-8 lg:border-t-0 lg:border-l\">\n          <div className=\"flex items-center justify-between\">\n            <div className=\"text-sm font-semibold\">Recent issues</div>\n            <span className=\"text-xs text-muted-foreground\">Open rate 61%</span>\n          </div>\n          <ul className=\"mt-4 flex flex-col gap-2\">\n            {PAST.map((p, i) => (\n              <li key={p.title}>\n                <button type=\"button\" onClick={() => setOpened(p.title)} aria-pressed={opened === p.title} className={cn(\"flex w-full items-start gap-3 rounded-xl border bg-card p-3 text-start transition-colors outline-none hover:border-foreground/30 focus-visible:ring-3 focus-visible:ring-ring/40\", opened === p.title && \"border-foreground/40\")}>\n                  <span className=\"flex size-8 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-xs font-semibold text-primary\">#{42 - i}</span>\n                  <span className=\"min-w-0 flex-1\">\n                    <span className=\"block text-sm font-medium\">{p.title}</span>\n                    <span className=\"block text-xs text-muted-foreground\">{p.readers} readers · 4 min</span>\n                  </span>\n                  {opened === p.title && <Check className=\"mt-1 size-4 text-emerald-600 dark:text-emerald-400\" />}\n                </button>\n              </li>\n            ))}\n          </ul>\n          <div className=\"mt-auto pt-6\">\n            <div className=\"rounded-xl border border-dashed p-3 text-xs text-muted-foreground\">\n              <div className=\"flex items-center gap-1.5 font-medium text-foreground\"><Sparkles className=\"size-3.5 text-amber-500\" /> From the last issue</div>\n              <p className=\"mt-1\">“Moving the reminder from 24 to 3 hours before cut our no-shows by another 9%. Nobody confirms a day early.”</p>\n            </div>\n          </div>\n        </div>\n      </section>\n    </div>\n  )\n}\n",
      "type": "registry:component",
      "target": "components/goodui/newsletter-signup.tsx"
    }
  ],
  "categories": [
    "marketing"
  ],
  "type": "registry:block"
}
