{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "empty-states",
  "title": "Empty states",
  "description": "Four illustrated empty states (no bookings, no results, offline, no access), each with a primary action that works.",
  "dependencies": [
    "lucide-react"
  ],
  "registryDependencies": [
    "avatar",
    "badge",
    "button",
    "input",
    "textarea"
  ],
  "files": [
    {
      "path": "registry/blocks/onboarding/empty-states.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { CalendarPlus, Check, Clock, Loader2, Lock, RefreshCw, Search, Send, WifiOff, X } from \"lucide-react\"\nimport { Avatar, AvatarFallback } from \"@/components/ui/avatar\"\nimport { Badge } from \"@/components/ui/badge\"\nimport { Button } from \"@/components/ui/button\"\nimport { Input } from \"@/components/ui/input\"\nimport { Textarea } from \"@/components/ui/textarea\"\nimport { cn } from \"@/lib/utils\"\n\nconst SAMPLE_BOOKINGS = [\n  { time: \"9:30 AM\", client: \"Grace Kim\", service: \"Haircut & blow-dry\", staff: \"Sofia\", color: \"var(--chart-1)\" },\n  { time: \"11:00 AM\", client: \"Daniel Ortiz\", service: \"Beard trim\", staff: \"Liam\", color: \"var(--chart-2)\" },\n  { time: \"2:15 PM\", client: \"Mia Rossi\", service: \"Balayage\", staff: \"Amara\", color: \"var(--chart-3)\" },\n]\n\nconst CLIENTS = [\n  { name: \"Grace Kim\", visits: 12, last: \"Haircut · 3 days ago\" },\n  { name: \"Daniel Ortiz\", visits: 4, last: \"Beard trim · 2 weeks ago\" },\n  { name: \"Mia Rossi\", visits: 7, last: \"Balayage · last month\" },\n  { name: \"Noah Fischer\", visits: 1, last: \"Consultation · yesterday\" },\n  { name: \"Aisha Rahman\", visits: 9, last: \"Gel manicure · 5 days ago\" },\n]\n\nexport default function EmptyStates() {\n  return (\n    <div className=\"p-4 md:p-6\">\n      <div className=\"mx-auto grid max-w-5xl gap-4 md:grid-cols-2\">\n        <NoBookings />\n        <NoResults />\n        <Offline />\n        <NoAccess />\n      </div>\n    </div>\n  )\n}\n\nfunction Panel({ label, children, className }: { label: string; children: React.ReactNode; className?: string }) {\n  return (\n    <section aria-label={label} className={cn(\"flex min-h-[340px] flex-col overflow-hidden rounded-2xl border bg-card\", className)}>\n      {children}\n    </section>\n  )\n}\n\n/* 1. No bookings yet */\nfunction NoBookings() {\n  const [bookings, setBookings] = React.useState<typeof SAMPLE_BOOKINGS>([])\n  const [loading, setLoading] = React.useState(false)\n\n  if (bookings.length) {\n    return (\n      <Panel label=\"Today's bookings\">\n        <div className=\"flex items-center justify-between border-b px-5 py-3\">\n          <div className=\"text-sm font-semibold\">Today · {bookings.length} bookings</div>\n          <Button variant=\"ghost\" size=\"sm\" onClick={() => setBookings([])}>Clear samples</Button>\n        </div>\n        <ul className=\"flex flex-1 flex-col gap-2 p-4\">\n          {bookings.map((b, i) => (\n            <li key={b.client} className=\"flex animate-in items-center gap-3 rounded-xl border p-3 fade-in slide-in-from-bottom-2\" style={{ animationDelay: `${i * 80}ms`, animationFillMode: \"both\" }}>\n              <span className=\"h-10 w-1 rounded-full\" style={{ background: b.color }} />\n              <div className=\"min-w-0 flex-1\">\n                <div className=\"truncate text-sm font-medium\">{b.client}</div>\n                <div className=\"truncate text-xs text-muted-foreground\">{b.service} · with {b.staff}</div>\n              </div>\n              <Badge variant=\"secondary\" className=\"tabular-nums\">{b.time}</Badge>\n            </li>\n          ))}\n        </ul>\n        <p className=\"px-5 pb-4 text-xs text-muted-foreground\">Sample data. Real bookings replace these automatically.</p>\n      </Panel>\n    )\n  }\n\n  return (\n    <Panel label=\"No bookings\" className=\"items-center justify-center p-8 text-center\">\n      <svg viewBox=\"0 0 160 120\" className=\"h-28 w-36\" aria-hidden>\n        <rect x=\"24\" y=\"22\" width=\"112\" height=\"86\" rx=\"12\" className=\"fill-muted stroke-border\" strokeWidth=\"2\" />\n        <path d=\"M24 46h112\" className=\"stroke-border\" strokeWidth=\"2\" />\n        <rect x=\"24\" y=\"22\" width=\"112\" height=\"24\" rx=\"12\" className=\"fill-primary/15\" />\n        <rect x=\"48\" y=\"12\" width=\"6\" height=\"20\" rx=\"3\" className=\"fill-primary\" />\n        <rect x=\"106\" y=\"12\" width=\"6\" height=\"20\" rx=\"3\" className=\"fill-primary\" />\n        {[0, 1, 2, 3].map((c) => [0, 1].map((r) => <rect key={`${c}${r}`} x={38 + c * 22} y={58 + r * 22} width=\"14\" height=\"12\" rx=\"3\" className=\"fill-background stroke-border\" strokeWidth=\"1.5\" />))}\n        <circle cx=\"128\" cy=\"96\" r=\"16\" className=\"fill-primary\" />\n        <path d=\"M128 89v14M121 96h14\" stroke=\"white\" strokeWidth=\"3\" strokeLinecap=\"round\" />\n      </svg>\n      <h3 className=\"mt-4 text-base font-semibold\">No bookings yet</h3>\n      <p className=\"mt-1 max-w-xs text-sm text-muted-foreground\">Share your booking page or add an appointment yourself. Want to see how it looks first?</p>\n      <Button className=\"mt-5\" disabled={loading} onClick={() => { setLoading(true); setTimeout(() => { setLoading(false); setBookings(SAMPLE_BOOKINGS) }, 600) }}>\n        {loading ? <Loader2 className=\"animate-spin\" /> : <CalendarPlus />} Add sample bookings\n      </Button>\n    </Panel>\n  )\n}\n\n/* 2. No search results */\nfunction NoResults() {\n  const [q, setQ] = React.useState(\"balayage tuesday\")\n  const results = CLIENTS.filter((c) => `${c.name} ${c.last}`.toLowerCase().includes(q.trim().toLowerCase()))\n\n  return (\n    <Panel label=\"Client search\">\n      <div className=\"border-b p-3\">\n        <div className=\"relative\">\n          <Search className=\"pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground\" />\n          <Input aria-label=\"Search clients\" className=\"h-9 px-9\" placeholder=\"Search clients or services\" value={q} onChange={(e) => setQ(e.target.value)} />\n          {q && <button type=\"button\" aria-label=\"Clear search\" onClick={() => setQ(\"\")} className=\"absolute top-1/2 right-2 flex size-6 -translate-y-1/2 items-center justify-center rounded-md text-muted-foreground hover:bg-muted\"><X className=\"size-3.5\" /></button>}\n        </div>\n      </div>\n      {results.length ? (\n        <ul className=\"flex-1 divide-y\">\n          {results.map((c) => (\n            <li key={c.name} className=\"flex items-center gap-3 px-4 py-2.5\">\n              <Avatar className=\"size-8\"><AvatarFallback className=\"text-xs\">{c.name.split(\" \").map((p) => p[0]).join(\"\")}</AvatarFallback></Avatar>\n              <div className=\"min-w-0 flex-1\">\n                <div className=\"text-sm font-medium\">{c.name}</div>\n                <div className=\"truncate text-xs text-muted-foreground\">{c.last}</div>\n              </div>\n              <span className=\"text-xs text-muted-foreground\">{c.visits} visits</span>\n            </li>\n          ))}\n        </ul>\n      ) : (\n        <div className=\"flex flex-1 flex-col items-center justify-center p-8 text-center\">\n          <svg viewBox=\"0 0 160 120\" className=\"h-28 w-36\" aria-hidden>\n            <rect x=\"20\" y=\"30\" width=\"84\" height=\"12\" rx=\"6\" className=\"fill-muted\" />\n            <rect x=\"20\" y=\"52\" width=\"64\" height=\"12\" rx=\"6\" className=\"fill-muted\" />\n            <rect x=\"20\" y=\"74\" width=\"74\" height=\"12\" rx=\"6\" className=\"fill-muted\" />\n            <circle cx=\"104\" cy=\"58\" r=\"26\" className=\"fill-background stroke-foreground/70\" strokeWidth=\"6\" />\n            <path d=\"M123 77l18 18\" className=\"stroke-foreground/70\" strokeWidth=\"9\" strokeLinecap=\"round\" />\n            <path d=\"M94 54q4-6 10 0t10 0\" className=\"stroke-[var(--chart-4)]\" strokeWidth=\"3\" fill=\"none\" strokeLinecap=\"round\" />\n            <circle cx=\"96\" cy=\"64\" r=\"2\" className=\"fill-foreground/70\" />\n            <circle cx=\"112\" cy=\"64\" r=\"2\" className=\"fill-foreground/70\" />\n          </svg>\n          <h3 className=\"mt-4 text-base font-semibold\">No matches for “{q}”</h3>\n          <p className=\"mt-1 max-w-xs text-sm text-muted-foreground\">Try a client's first name or a single service. Search doesn't look at dates.</p>\n          <div className=\"mt-5 flex flex-wrap justify-center gap-2\">\n            <Button onClick={() => setQ(\"\")}>Clear search</Button>\n            <Button variant=\"outline\" onClick={() => setQ(q.split(\" \")[0] ?? \"\")}>Search “{q.split(\" \")[0]}”</Button>\n          </div>\n        </div>\n      )}\n    </Panel>\n  )\n}\n\n/* 3. Offline */\nfunction Offline() {\n  const [state, setState] = React.useState<\"offline\" | \"retrying\" | \"online\">(\"offline\")\n  const [tries, setTries] = React.useState(0)\n\n  const retry = () => {\n    setState(\"retrying\")\n    setTimeout(() => {\n      setTries((t) => t + 1)\n      setState(tries >= 1 ? \"online\" : \"offline\")\n    }, 1400)\n  }\n\n  return (\n    <Panel label=\"Connection status\" className=\"relative items-center justify-center p-8 text-center\">\n      <div className={cn(\"pointer-events-none absolute inset-x-0 top-0 h-1 transition-colors\", state === \"online\" ? \"bg-emerald-500\" : state === \"retrying\" ? \"bg-amber-500\" : \"bg-destructive/70\")} />\n      {state === \"online\" ? (\n        <div className=\"flex animate-in flex-col items-center duration-300 fade-in zoom-in-95\">\n          <div className=\"flex size-16 items-center justify-center rounded-full bg-emerald-500/15 text-emerald-600 dark:text-emerald-400\"><Check className=\"size-8\" /></div>\n          <h3 className=\"mt-4 text-base font-semibold\">Back online</h3>\n          <p className=\"mt-1 max-w-xs text-sm text-muted-foreground\">Synced 12 changes made while you were offline. Nothing was lost.</p>\n          <Button variant=\"outline\" className=\"mt-5\" onClick={() => { setState(\"offline\"); setTries(0) }}><WifiOff /> Simulate going offline</Button>\n        </div>\n      ) : (\n        <>\n          <svg viewBox=\"0 0 160 120\" className=\"h-28 w-36\" aria-hidden>\n            <path d=\"M44 90a22 22 0 0 1 2-44 30 30 0 0 1 57-8 24 24 0 0 1 13 52z\" className=\"fill-muted stroke-border\" strokeWidth=\"2\" />\n            <path d=\"M58 72q22-18 44 0M68 82q12-9 24 0\" className=\"stroke-muted-foreground/60\" strokeWidth=\"4\" fill=\"none\" strokeLinecap=\"round\" />\n            <circle cx=\"80\" cy=\"92\" r=\"4\" className=\"fill-muted-foreground/60\" />\n            <path d=\"M40 28l80 72\" className=\"stroke-destructive\" strokeWidth=\"5\" strokeLinecap=\"round\" />\n          </svg>\n          <h3 className=\"mt-4 text-base font-semibold\">You're offline</h3>\n          <p className=\"mt-1 max-w-xs text-sm text-muted-foreground\">\n            {tries > 0 && state === \"offline\" ? \"Still can't reach Slotwise. Check your Wi-Fi, then try once more.\" : \"Changes are saved on this device and will sync when your connection is back.\"}\n          </p>\n          <Button className=\"mt-5\" disabled={state === \"retrying\"} onClick={retry}>\n            {state === \"retrying\" ? <><Loader2 className=\"animate-spin\" /> Reconnecting…</> : <><RefreshCw /> Try again</>}\n          </Button>\n          <span className=\"mt-3 inline-flex items-center gap-1.5 text-xs text-muted-foreground\"><Clock className=\"size-3\" /> 12 changes waiting to sync</span>\n        </>\n      )}\n    </Panel>\n  )\n}\n\n/* 4. No access */\nfunction NoAccess() {\n  const [state, setState] = React.useState<\"locked\" | \"form\" | \"pending\" | \"granted\">(\"locked\")\n  const [note, setNote] = React.useState(\"\")\n  const [sending, setSending] = React.useState(false)\n\n  return (\n    <Panel label=\"Payouts access\" className=\"items-center justify-center p-8 text-center\">\n      {state === \"granted\" ? (\n        <div className=\"flex w-full animate-in flex-col gap-3 text-left duration-300 fade-in\">\n          <div className=\"flex items-center justify-between\">\n            <h3 className=\"text-base font-semibold\">Payouts · October</h3>\n            <Badge variant=\"secondary\" className=\"bg-emerald-500/15 text-emerald-700 dark:text-emerald-400\">Access granted</Badge>\n          </div>\n          <div className=\"text-3xl font-bold tracking-tight tabular-nums\">$18,420.50</div>\n          {[{ d: \"Oct 28\", a: \"$4,210.00\" }, { d: \"Oct 21\", a: \"$5,380.25\" }, { d: \"Oct 14\", a: \"$4,105.75\" }, { d: \"Oct 7\", a: \"$4,724.50\" }].map((p) => (\n            <div key={p.d} className=\"flex justify-between border-b pb-2 text-sm last:border-b-0\"><span className=\"text-muted-foreground\">{p.d}</span><span className=\"font-medium tabular-nums\">{p.a}</span></div>\n          ))}\n          <Button variant=\"ghost\" size=\"sm\" className=\"self-start\" onClick={() => { setState(\"locked\"); setNote(\"\") }}>Reset demo</Button>\n        </div>\n      ) : (\n        <>\n          <svg viewBox=\"0 0 160 120\" className=\"h-28 w-36\" aria-hidden>\n            <rect x=\"34\" y=\"20\" width=\"92\" height=\"84\" rx=\"10\" className=\"fill-muted stroke-border\" strokeWidth=\"2\" />\n            <rect x=\"46\" y=\"34\" width=\"40\" height=\"6\" rx=\"3\" className=\"fill-muted-foreground/30\" />\n            <rect x=\"46\" y=\"48\" width=\"68\" height=\"6\" rx=\"3\" className=\"fill-muted-foreground/20\" />\n            <rect x=\"46\" y=\"60\" width=\"54\" height=\"6\" rx=\"3\" className=\"fill-muted-foreground/20\" />\n            <path d=\"M96 66v-8a12 12 0 0 1 24 0v8\" className=\"stroke-foreground/70\" strokeWidth=\"5\" fill=\"none\" />\n            <rect x=\"88\" y=\"64\" width=\"40\" height=\"32\" rx=\"7\" className={state === \"pending\" ? \"fill-amber-500\" : \"fill-primary\"} />\n            <circle cx=\"108\" cy=\"78\" r=\"4\" fill=\"white\" />\n            <path d=\"M108 80v7\" stroke=\"white\" strokeWidth=\"3\" strokeLinecap=\"round\" />\n          </svg>\n          {state === \"pending\" ? (\n            <div className=\"animate-in duration-300 fade-in\">\n              <h3 className=\"mt-4 text-base font-semibold\">Request sent</h3>\n              <p className=\"mt-1 max-w-xs text-sm text-muted-foreground\">Sofia Martinez (Owner) has been notified. You'll get an email when she responds.</p>\n              <Badge variant=\"outline\" className=\"mt-3 gap-1.5\"><span className=\"size-1.5 animate-pulse rounded-full bg-amber-500\" /> Pending approval</Badge>\n              <div className=\"mt-4 flex justify-center gap-2\">\n                <Button variant=\"outline\" size=\"sm\" onClick={() => setState(\"locked\")}>Cancel request</Button>\n                <Button variant=\"secondary\" size=\"sm\" onClick={() => setState(\"granted\")}>Simulate approval</Button>\n              </div>\n            </div>\n          ) : state === \"form\" ? (\n            <form className=\"mt-4 flex w-full max-w-xs animate-in flex-col gap-2 text-left duration-200 fade-in\" onSubmit={(e) => { e.preventDefault(); setSending(true); setTimeout(() => { setSending(false); setState(\"pending\") }, 800) }}>\n              <label htmlFor=\"es-note\" className=\"text-sm font-medium\">Why do you need access? <span className=\"font-normal text-muted-foreground\">(optional)</span></label>\n              <Textarea id=\"es-note\" rows={2} maxLength={140} placeholder=\"I reconcile weekly payouts for the Shoreditch studio.\" value={note} onChange={(e) => setNote(e.target.value)} />\n              <div className=\"flex justify-between text-xs text-muted-foreground\"><span>Goes to the workspace owner</span><span>{note.length}/140</span></div>\n              <div className=\"mt-1 flex gap-2\">\n                <Button type=\"button\" variant=\"ghost\" onClick={() => setState(\"locked\")}>Cancel</Button>\n                <Button type=\"submit\" className=\"flex-1\" disabled={sending}>{sending ? <Loader2 className=\"animate-spin\" /> : <Send />} Send request</Button>\n              </div>\n            </form>\n          ) : (\n            <>\n              <h3 className=\"mt-4 text-base font-semibold\">You don't have access to Payouts</h3>\n              <p className=\"mt-1 max-w-xs text-sm text-muted-foreground\">Only Owners and Admins can see payout amounts and bank details.</p>\n              <Button className=\"mt-5\" onClick={() => setState(\"form\")}><Lock /> Request access</Button>\n            </>\n          )}\n        </>\n      )}\n    </Panel>\n  )\n}\n",
      "type": "registry:component",
      "target": "components/goodui/empty-states.tsx"
    }
  ],
  "categories": [
    "onboarding"
  ],
  "type": "registry:block"
}