{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"not-found","type":"registry:block","title":"404 page","description":"Page not found, with a search across the pages people likely wanted, a way back and home, popular pages and a report link.","dependencies":["lucide-react"],"registryDependencies":["https://dashral.com/r/utils.json","https://dashral.com/r/button.json","https://dashral.com/r/input.json"],"files":[{"path":"registry/dashral/blocks/not-found.tsx","type":"registry:file","target":"components/dashral/blocks/not-found.tsx","content":"\"use client\"\n\nimport { useState } from \"react\"\nimport { ArrowLeft, BookOpen, Check, CornerDownLeft, CreditCard, FileSearch, Flag, House, LayoutDashboard, LifeBuoy, Search } from \"lucide-react\"\nimport { Button } from \"../button\"\nimport { Input } from \"../input\"\nimport { cn } from \"../lib/utils\"\n\n// The products named here are real ones, as examples: their names are their owners' trademarks, no affiliation implied. Put in the tools your product really works with.\nconst brands = { payments: \"Stripe\", store: \"Shopify\" }\n\n/** A page to search and jump to; the popular ones show as cards, with an icon. */\nexport type NotFoundPage = { title: string; description: string; href: string; icon?: React.ComponentType<{ className?: string; \"aria-hidden\"?: boolean }> }\n\n// The pages people look for most, to search and to jump to.\nconst samplePages: NotFoundPage[] = [\n  { title: \"Dashboard\", description: \"Your numbers at a glance\", href: \"#\", icon: LayoutDashboard },\n  { title: \"Documentation\", description: \"Guides and API reference\", href: \"#\", icon: BookOpen },\n  { title: \"Pricing\", description: \"Plans for every team size\", href: \"#\", icon: CreditCard },\n  { title: \"Help center\", description: \"Answers and contact\", href: \"#\", icon: LifeBuoy },\n]\n// The demo's report: nothing to send it to, so it just thanks you.\nconst sampleReport = () => {}\n\nconst sampleMore: NotFoundPage[] = [\n  { title: \"Getting started\", description: \"Set up your first dashboard\", href: \"#\" },\n  { title: \"Integrations\", description: `Connect ${brands.payments}, ${brands.store} and more`, href: \"#\" },\n  { title: \"Changelog\", description: \"What's new this month\", href: \"#\" },\n  { title: \"Account settings\", description: \"Profile, password and sessions\", href: \"#\" },\n]\n\n/**\n * A \"page not found\" page that helps people on: the code, what happened, a search across the pages they likely\n * wanted, a way back and home, the most visited pages, and a way to report a broken link. Use it as app/not-found.tsx;\n * every part comes from props.\n */\nexport function NotFound({\n  code = \"404\",\n  title = \"We can't find that page\",\n  description = \"It may have moved, or the link has a typo. Search for it, or pick up from one of the pages below.\",\n  pages = samplePages,\n  more = sampleMore,\n  homeHref = \"#\",\n  onOpen,\n  onReport = sampleReport,\n}: {\n  code?: string\n  title?: React.ReactNode\n  description?: React.ReactNode\n  /** The popular pages, as cards (and searched); none hides them. */\n  pages?: NotFoundPage[]\n  /** More pages, searched only. */\n  more?: NotFoundPage[]\n  homeHref?: string\n  /** Enter in the search, with the first match: go there with your router (it follows the link without it). */\n  onOpen?: (page: NotFoundPage) => void\n  /** \"Report a broken link\", with the address that wasn't found (a throw takes the thanks back); null hides it. */\n  onReport?: ((url: string) => Promise<void> | void) | null\n}) {\n  const [query, setQuery] = useState(\"\")\n  const [reported, setReported] = useState(false)\n\n  const q = query.trim().toLowerCase()\n  const results = q ? [...pages, ...more].filter((p) => `${p.title} ${p.description}`.toLowerCase().includes(q)) : []\n\n  return (\n    <main className=\"relative isolate overflow-hidden flex min-h-full flex-col items-center bg-background px-4 py-16 sm:px-6 sm:py-24\">\n      {/* A soft glow of the theme's gradient behind the code, and a fine grid fading out around it; decoration. */}\n      <div aria-hidden className=\"absolute top-16 left-1/2 -z-10 h-25 w-[30rem] max-w-[90%] -translate-x-1/2 rounded-full opacity-35 blur-3xl [background:linear-gradient(90deg,var(--gradient-from),var(--gradient-via),var(--gradient-to))] sm:top-24 dark:opacity-25\" />\n      <div\n        aria-hidden\n        className=\"absolute inset-0 -z-10 [background-image:linear-gradient(to_right,var(--border)_1px,transparent_1px),linear-gradient(to_bottom,var(--border)_1px,transparent_1px)] [background-size:48px_48px] opacity-60 [mask-image:radial-gradient(ellipse_50%_35%_at_50%_0%,black,transparent)]\"\n      />\n\n      <div className=\"w-full max-w-xl text-center\">\n        <p className=\"bg-linear-to-b from-foreground from-30% to-(--gradient-via) bg-clip-text text-7xl font-semibold tracking-tighter text-transparent tabular-nums sm:text-8xl\">\n          {code}\n        </p>\n        <h1 className=\"mt-4 text-2xl font-semibold tracking-tight text-balance sm:text-3xl\">{title}</h1>\n        {description && <p className=\"mx-auto mt-3 max-w-md text-pretty text-muted-foreground\">{description}</p>}\n\n        <form\n          role=\"search\"\n          className=\"relative mt-8 text-start\"\n          onSubmit={(event) => {\n            event.preventDefault()\n            // Enter opens the first match.\n            const first = results[0]\n            if (!first) return\n            if (onOpen) onOpen(first)\n            else window.location.assign(first.href)\n          }}\n        >\n          <Input\n            type=\"search\"\n            aria-label=\"Search pages\"\n            placeholder=\"Search pages\"\n            value={query}\n            onChange={(event) => setQuery(event.target.value)}\n            prefix={<Search aria-hidden />}\n            suffix={\n              results.length > 0 && (\n                <kbd className=\"hidden items-center gap-1 rounded-[calc(var(--radius)*2/7)] border bg-muted px-1.5 py-0.5 font-sans text-[11px] text-muted-foreground sm:inline-flex\">\n                  <CornerDownLeft aria-hidden className=\"size-3\" /> to open\n                </kbd>\n              )\n            }\n            classNames={{ input: \"h-11\" }}\n          />\n          {q && (\n            <div className=\"mt-2 overflow-hidden rounded-xl border bg-card text-card-foreground shadow-sm\" aria-live=\"polite\">\n              {results.length ? (\n                <ul className=\"divide-y\">\n                  {results.map((page, i) => (\n                    <li key={page.title}>\n                      <a\n                        href={page.href}\n                        className={cn(\n                          \"flex items-center justify-between gap-3 px-4 py-2.5 outline-none hover:bg-muted/60 focus-visible:bg-muted\",\n                          i === 0 && \"bg-muted/40\"\n                        )}\n                      >\n                        <span className=\"min-w-0\">\n                          <span className=\"block truncate text-sm font-medium\">{page.title}</span>\n                          <span className=\"block truncate text-xs text-muted-foreground\">{page.description}</span>\n                        </span>\n                        {i === 0 && <CornerDownLeft aria-hidden className=\"size-3.5 shrink-0 text-muted-foreground\" />}\n                      </a>\n                    </li>\n                  ))}\n                </ul>\n              ) : (\n                <p className=\"flex items-center gap-2.5 px-4 py-3 text-sm text-muted-foreground\">\n                  <FileSearch aria-hidden className=\"size-4 shrink-0\" />\n                  Nothing called “{query.trim()}”. Try a shorter word.\n                </p>\n              )}\n            </div>\n          )}\n        </form>\n\n        {/* Side by side, on a phone too: the way back, then the main action; each takes its share of the row. */}\n        <div className=\"mt-6 flex flex-wrap justify-center gap-3\">\n          <Button variant=\"outline\" className=\"flex-auto sm:flex-none\" onClick={() => history.back()}>\n            <ArrowLeft aria-hidden className=\"rtl:-scale-x-100\" /> Go back\n          </Button>\n          <Button className=\"flex-auto sm:flex-none\" asChild>\n            <a href={homeHref}>\n              <House aria-hidden /> Take me home\n            </a>\n          </Button>\n        </div>\n      </div>\n\n      <div className=\"mt-14 w-full max-w-3xl\">\n        {pages.length > 0 && (\n            <>\n            <h2 className=\"text-center text-xs font-medium tracking-wide text-muted-foreground uppercase\">Popular pages</h2>\n            <ul className=\"mt-4 grid gap-3 sm:grid-cols-2\">\n              {pages.map(({ title, description, href, icon: Icon }) => (\n                <li key={title}>\n                  <a\n                    href={href}\n                    className=\"group flex items-center gap-3 rounded-xl border bg-card p-4 text-card-foreground transition-[border-color,translate] outline-none hover:-translate-y-0.5 hover:border-ring/40 focus-visible:ring-2 focus-visible:ring-ring/50 motion-reduce:hover:translate-y-0\"\n                  >\n                    <span className=\"flex size-10 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary-text\">\n                      {Icon ? <Icon aria-hidden className=\"size-4.5\" /> : <FileSearch aria-hidden className=\"size-4.5\" />}\n                    </span>\n                    <span className=\"min-w-0\">\n                      <span className=\"block font-medium\">{title}</span>\n                      <span className=\"block text-sm text-muted-foreground\">{description}</span>\n                    </span>\n                  </a>\n                </li>\n              ))}\n            </ul>\n            </>\n        )}\n\n        {onReport && (\n          <p className=\"mt-8 text-center text-sm text-muted-foreground\" aria-live=\"polite\">\n            {reported ? (\n              <span className=\"inline-flex items-center gap-1.5 text-success-text\">\n                <Check aria-hidden className=\"size-4\" /> Thanks, we&apos;ll fix the link.\n              </span>\n            ) : (\n              <>\n                Followed a link from our site?{\" \"}\n                <button\n                  type=\"button\"\n                  onClick={async () => {\n                    setReported(true)\n                    await Promise.resolve()\n                    .then(() => onReport(window.location.href))\n                    .catch(() => setReported(false))\n                  }}\n                  className=\"inline-flex items-center gap-1 rounded-sm font-medium text-foreground underline-offset-4 outline-none hover:underline focus-visible:ring-2 focus-visible:ring-ring/50\"\n                >\n                  <Flag aria-hidden className=\"size-3.5\" /> Report a broken link\n                </button>\n              </>\n            )}\n          </p>\n        )}\n      </div>\n    </main>\n  )\n}\n"}],"cssVars":{"theme":{"color-primary-text":"var(--primary-text, var(--primary))","color-success":"var(--success)","color-success-foreground":"var(--success-foreground)","color-success-text":"var(--success-text)"},"light":{"success":"oklch(0.508 0.118 165.612)","success-foreground":"oklch(0.985 0 0)","success-text":"oklch(0.432 0.095 166.913)"},"dark":{"success":"oklch(0.696 0.17 162.48)","success-foreground":"oklch(0.2 0.04 160)","success-text":"oklch(0.765 0.177 163.223)"}}}