{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "smoke-ring-waitlist",
  "title": "Smoke Ring Waitlist",
  "description": "A full-screen coming soon page with a smoke ring, a launch countdown and a waitlist signup.",
  "dependencies": [
    "@paper-design/shaders-react",
    "lucide-react"
  ],
  "registryDependencies": [
    "button",
    "input"
  ],
  "files": [
    {
      "path": "registry/shaders/smoke-ring-waitlist/smoke-ring-waitlist.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { SmokeRing } from \"@paper-design/shaders-react\"\nimport { CheckIcon } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Button } from \"@/components/ui/button\"\nimport { Input } from \"@/components/ui/input\"\n\ntype SmokeRingWaitlistProps = React.ComponentProps<\"section\"> & {\n  brand?: string\n  eyebrow?: string\n  title?: string\n  description?: string\n  /** Social proof shown under the form. */\n  note?: string\n  /** Shows a live countdown until this date. Hidden once it has passed. */\n  launchDate?: string | Date\n  /**\n   * Called with the email when someone joins. Throw to show an error. Works\n   * with server actions.\n   */\n  onJoin?: (email: string) => void | Promise<void>\n  colors?: string[]\n  colorBack?: string\n  speed?: number\n}\n\nfunction SmokeRingWaitlist({\n  brand = \"Acme\",\n  eyebrow = \"Launching soon\",\n  title = \"Something new is on its way\",\n  description = \"We're putting the finishing touches on it. Join the waitlist and be the first to get access.\",\n  note = \"Join 2,400+ people already on the list.\",\n  launchDate,\n  onJoin,\n  colors = [\"#c4b5fd\", \"#818cf8\", \"#4f46e5\"],\n  colorBack = \"#000000\",\n  speed = 0.5,\n  className,\n  style,\n  ...props\n}: SmokeRingWaitlistProps) {\n  const [state, setState] = React.useState<\n    \"idle\" | \"pending\" | \"joined\" | \"error\"\n  >(\"idle\")\n  const [email, setEmail] = React.useState(\"\")\n\n  return (\n    <section\n      data-slot=\"smoke-ring-waitlist\"\n      className={cn(\n        \"dark relative isolate flex min-h-svh w-full flex-col items-center justify-center overflow-hidden px-6 py-32 text-center text-white\",\n        className\n      )}\n      style={{ backgroundColor: colorBack, ...style }}\n      {...props}\n    >\n      <SmokeRing\n        aria-hidden\n        className=\"absolute inset-0 -z-10 size-full\"\n        colors={colors}\n        colorBack={colorBack}\n        noiseScale={2.5}\n        noiseIterations={6}\n        radius={0.62}\n        thickness={0.35}\n        innerShape={1.2}\n        scale={1}\n        speed={speed}\n      />\n      {/* Darkens the inside of the ring so the copy stays readable. */}\n      <div\n        aria-hidden\n        className=\"absolute inset-0 -z-10\"\n        style={{\n          background: `radial-gradient(closest-side, ${colorBack} 45%, transparent)`,\n        }}\n      />\n      <span className=\"absolute top-8 left-1/2 -translate-x-1/2 font-heading text-lg tracking-tight\">\n        {brand}\n      </span>\n      <div className=\"flex w-full max-w-lg flex-col items-center gap-6\">\n        <span className=\"border border-white/20 bg-white/5 px-3 py-1 font-mono text-[11px] tracking-widest text-white/80 uppercase backdrop-blur\">\n          {eyebrow}\n        </span>\n        <h1 className=\"font-heading text-4xl leading-[1.05] tracking-tight text-balance sm:text-6xl\">\n          {title}\n        </h1>\n        <p className=\"max-w-md text-base text-pretty text-white/70\">\n          {description}\n        </p>\n        {launchDate && <Countdown to={launchDate} />}\n        {state === \"joined\" ? (\n          <p\n            role=\"status\"\n            className=\"flex items-center gap-2 border border-white/15 bg-white/5 px-4 py-3 text-sm backdrop-blur\"\n          >\n            <CheckIcon className=\"size-4 shrink-0\" />\n            You&apos;re on the list. We&apos;ll email {email} when we launch.\n          </p>\n        ) : (\n          <form\n            className=\"flex w-full max-w-sm flex-col gap-2 sm:flex-row\"\n            onSubmit={async (event) => {\n              event.preventDefault()\n              setState(\"pending\")\n              try {\n                await onJoin?.(email)\n                setState(\"joined\")\n              } catch {\n                setState(\"error\")\n              }\n            }}\n          >\n            <Input\n              type=\"email\"\n              name=\"email\"\n              autoComplete=\"email\"\n              aria-label=\"Email\"\n              placeholder=\"you@example.com\"\n              required\n              value={email}\n              onChange={(event) => setEmail(event.target.value)}\n              className=\"h-10 bg-black/40 text-sm backdrop-blur md:text-sm\"\n            />\n            <Button\n              type=\"submit\"\n              size=\"lg\"\n              disabled={state === \"pending\"}\n              className=\"h-10 bg-white px-4 text-black hover:bg-white/80\"\n            >\n              {state === \"pending\" ? \"Joining…\" : \"Join the waitlist\"}\n            </Button>\n          </form>\n        )}\n        {state === \"error\" ? (\n          <p role=\"alert\" className=\"text-xs text-red-400\">\n            Something went wrong. Please try again.\n          </p>\n        ) : (\n          state !== \"joined\" &&\n          note && <p className=\"text-xs text-white/50\">{note}</p>\n        )}\n      </div>\n    </section>\n  )\n}\n\nconst UNITS = [\n  [\"Days\", 86_400_000],\n  [\"Hours\", 3_600_000],\n  [\"Min\", 60_000],\n  [\"Sec\", 1_000],\n] as const\n\nfunction Countdown({ to }: { to: string | Date }) {\n  const target = new Date(to).getTime()\n  // Unknown until mounted, so the server and the first client render match.\n  const [now, setNow] = React.useState<number | null>(null)\n\n  React.useEffect(() => {\n    const tick = () => setNow(Date.now())\n    tick()\n    const interval = setInterval(tick, 1000)\n    return () => clearInterval(interval)\n  }, [])\n\n  if (now !== null && now >= target) return null\n\n  const remaining = now === null ? 0 : target - now\n  // Each unit only counts what the larger units above it don't, e.g. 0–23 hours.\n  const parts = UNITS.map(([label, ms], i) => ({\n    label,\n    value: Math.floor((i ? remaining % UNITS[i - 1][1] : remaining) / ms),\n  }))\n\n  return (\n    <time\n      dateTime={new Date(target).toISOString()}\n      className=\"grid grid-cols-4 gap-px border border-white/10 bg-white/10 font-mono\"\n    >\n      {parts.map(({ label, value }) => (\n        <span\n          key={label}\n          className=\"flex min-w-16 flex-col gap-1 bg-black/60 px-3 py-2 backdrop-blur\"\n        >\n          <span className=\"text-xl text-white tabular-nums\">\n            {now === null ? \"--\" : String(value).padStart(2, \"0\")}\n          </span>\n          <span className=\"text-[10px] tracking-widest text-white/50 uppercase\">\n            {label}\n          </span>\n        </span>\n      ))}\n    </time>\n  )\n}\n\nexport { SmokeRingWaitlist }\n",
      "type": "registry:component"
    }
  ],
  "categories": [
    "sections",
    "waitlist"
  ],
  "type": "registry:block"
}