{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "site-footer",
  "title": "Site Footer",
  "description": "The end of every page, in three decisions: a full map of the site, one quiet line, or a newsletter field above the links.",
  "dependencies": [
    "lucide-react"
  ],
  "registryDependencies": [
    "utils",
    "https://miseui.junsu4621.workers.dev/r/button.json",
    "https://miseui.junsu4621.workers.dev/r/input.json",
    "https://miseui.junsu4621.workers.dev/r/label.json"
  ],
  "files": [
    {
      "path": "registry/miseui/blocks/site-footer.tsx",
      "content": "import { cn } from \"@/registry/miseui/lib/utils\"\nimport {\n  CopyrightLine,\n  DEFAULT_BRAND,\n  DEFAULT_COLUMNS,\n  DEFAULT_LEGAL,\n  FooterColumns,\n  FooterLinkRow,\n  INNER_CLASS,\n  LegalRow,\n  ROOT_CLASS,\n  type SiteFooterColumn,\n  type SiteFooterLink,\n  type SiteFooterSharedProps,\n} from \"./site-footer-parts\"\nimport { SiteFooterSignup, type SiteFooterSignupOptions } from \"./site-footer-signup\"\n\ntype SiteFooterVariant = \"columns\" | \"minimal\" | \"signup\"\n\nconst DEFAULT_LINKS: readonly SiteFooterLink[] = [\n  { label: \"Privacy\", href: \"#privacy\" },\n  { label: \"Terms\", href: \"#terms\" },\n  { label: \"Status\", href: \"#status\" },\n  { label: \"Contact\", href: \"#contact\" },\n]\n\ninterface SiteFooterProps extends SiteFooterSharedProps, SiteFooterSignupOptions {\n  /** `columns` a full map of the site, `minimal` one line for an app or a short site, `signup` a newsletter field above the links. Anything else is `columns`. */\n  variant?: SiteFooterVariant\n  /** One sentence beside the links on `columns`. */\n  tagline?: string\n  /** The link groups on `columns` and `signup`. An empty list leaves only the legal line. */\n  columns?: readonly SiteFooterColumn[]\n  /** The small links beside the copyright on `columns` and `signup`. */\n  legal?: readonly SiteFooterLink[]\n  /** The whole list on `minimal`. */\n  links?: readonly SiteFooterLink[]\n}\n\nfunction SiteFooterColumns({\n  brand = DEFAULT_BRAND,\n  tagline = \"Calls that end in a plan, written before you leave.\",\n  columns = DEFAULT_COLUMNS,\n  legal = DEFAULT_LEGAL,\n  copyright,\n  className,\n  ...props\n}: Omit<SiteFooterProps, \"variant\" | \"links\" | keyof SiteFooterSignupOptions>) {\n  return (\n    <footer data-slot=\"site-footer\" data-variant=\"columns\" className={cn(ROOT_CLASS, \"border-t bg-muted dark:bg-background\", className)} {...props}>\n      <div className={cn(INNER_CLASS, \"flex flex-col gap-12 py-12\")}>\n        <div className=\"grid grid-cols-[minmax(0,1fr)] gap-8 @3xl:grid-cols-[minmax(0,2fr)_minmax(0,3fr)] @3xl:gap-12\">\n          <div className=\"flex max-w-xs flex-col gap-2\">\n            <p className=\"text-title text-lg\">{brand}</p>\n            <p className=\"text-sm leading-relaxed text-pretty text-muted-foreground\">{tagline}</p>\n          </div>\n          <FooterColumns columns={columns} />\n        </div>\n        <LegalRow brand={brand} copyright={copyright} legal={legal} />\n      </div>\n    </footer>\n  )\n}\n\nfunction SiteFooterMinimal({\n  brand = DEFAULT_BRAND,\n  links = DEFAULT_LINKS,\n  copyright,\n  className,\n  ...props\n}: Omit<SiteFooterProps, \"variant\" | \"tagline\" | \"columns\" | \"legal\" | keyof SiteFooterSignupOptions>) {\n  return (\n    <footer data-slot=\"site-footer\" data-variant=\"minimal\" className={cn(ROOT_CLASS, \"border-t bg-background\", className)} {...props}>\n      <div className={cn(INNER_CLASS, \"flex flex-col gap-3 py-6 @xl:flex-row @xl:items-center @xl:justify-between @xl:gap-6\")}>\n        <CopyrightLine brand={brand} copyright={copyright} />\n        <FooterLinkRow links={links} label=\"Footer\" />\n      </div>\n    </footer>\n  )\n}\n\nfunction SiteFooter({ variant, tagline, columns, legal, links, onSubscribe, signupTitle, signupQuiet, signupNote, doneMessage, ...props }: SiteFooterProps) {\n  switch (variant) {\n    case \"minimal\":\n      return <SiteFooterMinimal links={links} {...props} />\n    case \"signup\":\n      return (\n        <SiteFooterSignup\n          columns={columns}\n          legal={legal}\n          onSubscribe={onSubscribe}\n          signupTitle={signupTitle}\n          signupQuiet={signupQuiet}\n          signupNote={signupNote}\n          doneMessage={doneMessage}\n          {...props}\n        />\n      )\n    default:\n      return <SiteFooterColumns tagline={tagline} columns={columns} legal={legal} {...props} />\n  }\n}\n\nexport { SiteFooter, type SiteFooterColumn, type SiteFooterLink, type SiteFooterProps, type SiteFooterVariant }\n",
      "type": "registry:component"
    },
    {
      "path": "registry/miseui/blocks/site-footer-parts.tsx",
      "content": "import type * as React from \"react\"\nimport { useId } from \"react\"\nimport { cn } from \"@/registry/miseui/lib/utils\"\n\ninterface SiteFooterLink {\n  label: string\n  href: string\n}\n\ninterface SiteFooterColumn {\n  title: string\n  links: readonly SiteFooterLink[]\n}\n\ninterface SiteFooterSharedProps extends React.ComponentProps<\"footer\"> {\n  /** Your product name, used in the copyright line and beside the tagline on `columns`. */\n  brand?: string\n  /** Replaces the line built from the current year and `brand`. */\n  copyright?: string\n}\n\nconst DEFAULT_BRAND = \"Paperline\"\n\nconst DEFAULT_COLUMNS: readonly SiteFooterColumn[] = [\n  {\n    title: \"Product\",\n    links: [\n      { label: \"Summaries\", href: \"#summaries\" },\n      { label: \"Action items\", href: \"#action-items\" },\n      { label: \"Integrations\", href: \"#integrations\" },\n      { label: \"Pricing\", href: \"#pricing\" },\n    ],\n  },\n  {\n    title: \"Resources\",\n    links: [\n      { label: \"Guides\", href: \"#guides\" },\n      { label: \"Changelog\", href: \"#changelog\" },\n      { label: \"Status\", href: \"#status\" },\n    ],\n  },\n  {\n    title: \"Company\",\n    links: [\n      { label: \"About\", href: \"#about\" },\n      { label: \"Careers\", href: \"#careers\" },\n      { label: \"Contact\", href: \"#contact\" },\n    ],\n  },\n]\n\nconst DEFAULT_LEGAL: readonly SiteFooterLink[] = [\n  { label: \"Privacy\", href: \"#privacy\" },\n  { label: \"Terms\", href: \"#terms\" },\n]\n\nconst ROOT_CLASS = \"@container flex w-full flex-col justify-center\"\nconst INNER_CLASS = \"mx-auto w-full max-w-6xl px-4 @2xl:px-8\"\n\n/**\n * A 20 px line plus 10 px above and below makes the 40 px touch target, without moving a single word on a desktop.\n * The stacks and rows below open their gaps by the same amount on touch, so two targets never overlap.\n */\nconst LINK_CLASS =\n  \"relative inline-block rounded-sm text-sm leading-5 text-muted-foreground outline-none transition-colors duration-(--duration-fast) ease-(--ease-mise) hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 pointer-coarse:after:absolute pointer-coarse:after:-inset-x-2 pointer-coarse:after:-inset-y-2.5\"\n\nfunction FooterLinkRow({ links, label, className }: { links: readonly SiteFooterLink[]; label: string; className?: string }) {\n  if (links.length === 0) return null\n  return (\n    <nav aria-label={label} className={className}>\n      <ul className=\"flex flex-wrap gap-x-4 gap-y-2 pointer-coarse:gap-y-5\">\n        {links.map((link) => (\n          <li key={link.href}>\n            <a href={link.href} className={LINK_CLASS}>\n              {link.label}\n            </a>\n          </li>\n        ))}\n      </ul>\n    </nav>\n  )\n}\n\nfunction FooterColumn({ column }: { column: SiteFooterColumn }) {\n  const titleId = useId()\n  return (\n    <div className=\"flex min-w-0 flex-col gap-3 pointer-coarse:gap-5\">\n      <p id={titleId} className=\"text-[13px] leading-5 font-medium\">\n        {column.title}\n      </p>\n      <ul aria-labelledby={titleId} className=\"flex flex-col items-start gap-2 pointer-coarse:gap-5\">\n        {column.links.map((link) => (\n          <li key={link.href}>\n            <a href={link.href} className={LINK_CLASS}>\n              {link.label}\n            </a>\n          </li>\n        ))}\n      </ul>\n    </div>\n  )\n}\n\nfunction FooterColumns({ columns, className }: { columns: readonly SiteFooterColumn[]; className?: string }) {\n  if (columns.length === 0) return null\n  return (\n    <nav aria-label=\"Footer\" data-slot=\"site-footer-columns\" className={cn(\"grid grid-cols-2 gap-x-6 gap-y-8 @lg:grid-cols-3\", className)}>\n      {columns.map((column) => (\n        <FooterColumn key={column.title} column={column} />\n      ))}\n    </nav>\n  )\n}\n\n/** Reads the clock so a copied footer never ships last year. The server and a browser can disagree for a moment at New Year, which is harmless. */\nfunction CopyrightLine({ brand, copyright }: { brand: string; copyright?: string }) {\n  return (\n    <p className=\"text-[13px] leading-5 text-muted-foreground\" suppressHydrationWarning>\n      {copyright ?? `© ${new Date().getFullYear()} ${brand}`}\n    </p>\n  )\n}\n\nfunction LegalRow({ brand, copyright, legal }: { brand: string; copyright?: string; legal: readonly SiteFooterLink[] }) {\n  return (\n    <div className=\"flex flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t pt-6\">\n      <CopyrightLine brand={brand} copyright={copyright} />\n      <FooterLinkRow links={legal} label=\"Legal\" />\n    </div>\n  )\n}\n\nexport {\n  CopyrightLine,\n  DEFAULT_BRAND,\n  DEFAULT_COLUMNS,\n  DEFAULT_LEGAL,\n  FooterColumns,\n  FooterLinkRow,\n  INNER_CLASS,\n  LegalRow,\n  ROOT_CLASS,\n  type SiteFooterColumn,\n  type SiteFooterLink,\n  type SiteFooterSharedProps,\n}\n",
      "type": "registry:component"
    },
    {
      "path": "registry/miseui/blocks/site-footer-signup.tsx",
      "content": "import type * as React from \"react\"\nimport { useEffect, useId, useRef, useState } from \"react\"\nimport { Check, Loader2 } from \"lucide-react\"\nimport { cn } from \"@/registry/miseui/lib/utils\"\nimport { Button } from \"@/registry/miseui/ui/button\"\nimport { Input } from \"@/registry/miseui/ui/input\"\nimport { Label } from \"@/registry/miseui/ui/label\"\nimport { DEFAULT_BRAND, DEFAULT_COLUMNS, DEFAULT_LEGAL, FooterColumns, INNER_CLASS, LegalRow, ROOT_CLASS, type SiteFooterColumn, type SiteFooterLink, type SiteFooterSharedProps } from \"./site-footer-parts\"\n\nconst PREVIEW_DELAY_MS = 600\nconst INVALID_MESSAGE = \"Enter an email address, such as name@example.com.\"\nconst FAILED_MESSAGE = \"That did not go through. Your address is still here, so try again.\"\n\n/** Catches typos, not fake addresses: only a confirmation email can prove one is real. */\nfunction looksLikeEmail(value: string) {\n  return /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(value)\n}\n\n/** Stands in until you pass onSubscribe, so the preview reaches the done state. Replace it. */\nfunction previewSubscribe() {\n  return new Promise<void>((resolve) => {\n    window.setTimeout(resolve, PREVIEW_DELAY_MS)\n  })\n}\n\ntype SubscribeHandler = (email: string) => void | Promise<void>\n\nfunction useSignup(onSubscribe: SubscribeHandler) {\n  const [email, setEmail] = useState(\"\")\n  const [error, setError] = useState<string | null>(null)\n  const [sending, setSending] = useState(false)\n  const [doneFor, setDoneFor] = useState<string | null>(null)\n  const change = (next: string) => {\n    setEmail(next)\n    setError(null)\n  }\n  /** Resolves to whether the address was taken, so the form knows where focus belongs. */\n  const submit = async () => {\n    const value = email.trim()\n    if (!looksLikeEmail(value)) {\n      setError(INVALID_MESSAGE)\n      return false\n    }\n    setError(null)\n    setSending(true)\n    try {\n      await onSubscribe(value)\n      setDoneFor(value)\n      return true\n    } catch {\n      // A fixed sentence: a raw network error says nothing useful in a footer.\n      setError(FAILED_MESSAGE)\n      return false\n    } finally {\n      setSending(false)\n    }\n  }\n  return { email, error, sending, doneFor, change, submit }\n}\n\nfunction SignupDone({ email, doneMessage }: { email: string; doneMessage: (email: string) => React.ReactNode }) {\n  const ref = useRef<HTMLParagraphElement>(null)\n  // The form the person was in has just gone, and focus would fall back to the top of the page with it.\n  useEffect(() => ref.current?.focus(), [])\n  return (\n    <p ref={ref} tabIndex={-1} role=\"status\" data-slot=\"site-footer-done\" className=\"flex min-w-0 items-start gap-2 text-[15px] leading-relaxed text-pretty [overflow-wrap:anywhere] outline-none\">\n      <Check aria-hidden=\"true\" className=\"mt-1 size-4 shrink-0 text-emerald-600 dark:text-emerald-400\" />\n      <span>{doneMessage(email)}</span>\n    </p>\n  )\n}\n\ninterface SignupFormProps {\n  onSubscribe: SubscribeHandler\n  note: string\n  doneMessage: (email: string) => React.ReactNode\n}\n\nfunction SignupForm({ onSubscribe, note, doneMessage }: SignupFormProps) {\n  const fieldId = useId()\n  const messageId = useId()\n  const fieldRef = useRef<HTMLInputElement>(null)\n  const signup = useSignup(onSubscribe)\n  if (signup.doneFor !== null) return <SignupDone email={signup.doneFor} doneMessage={doneMessage} />\n  const submit = async (event: React.FormEvent<HTMLFormElement>) => {\n    event.preventDefault()\n    if (signup.sending) return\n    if (!(await signup.submit())) fieldRef.current?.focus()\n  }\n  return (\n    <form noValidate onSubmit={submit} className=\"flex min-w-0 flex-col gap-2\">\n      <Label htmlFor={fieldId} className=\"sr-only\">\n        Email address\n      </Label>\n      <div className=\"flex flex-col gap-2 @md:flex-row\">\n        <Input\n          ref={fieldRef}\n          id={fieldId}\n          type=\"email\"\n          autoComplete=\"email\"\n          placeholder=\"name@example.com\"\n          value={signup.email}\n          readOnly={signup.sending}\n          aria-invalid={signup.error ? true : undefined}\n          aria-describedby={messageId}\n          onChange={(event) => signup.change(event.target.value)}\n          className=\"h-10 @md:flex-1\"\n        />\n        {/* Not disabled: a disabled button drops keyboard focus for the whole send. */}\n        <Button type=\"submit\" variant=\"mise\" aria-disabled={signup.sending || undefined} aria-busy={signup.sending || undefined} className=\"h-10\">\n          {signup.sending ? <Loader2 aria-hidden=\"true\" className=\"animate-spin motion-reduce:animate-none\" /> : null}\n          {signup.sending ? \"Subscribing\" : \"Subscribe\"}\n        </Button>\n      </div>\n      {/* One line for both, so an error takes the place of the note and nothing below moves. */}\n      <p id={messageId} role={signup.error ? \"alert\" : undefined} className={cn(\"text-[13px] leading-5 text-pretty\", signup.error ? \"text-destructive\" : \"text-muted-foreground\")}>\n        {signup.error ?? note}\n      </p>\n    </form>\n  )\n}\n\ninterface SiteFooterSignupOptions {\n  /** Save the address here. Return a promise to get the sending state; a rejection offers another try. */\n  onSubscribe?: SubscribeHandler\n  signupTitle?: string\n  /** Continues the title in the same size, one tone quieter. */\n  signupQuiet?: string\n  /** Under the field. Say how often you really write. */\n  signupNote?: string\n  /** What replaces the form when it worked. */\n  doneMessage?: (email: string) => React.ReactNode\n}\n\ninterface SiteFooterSignupProps extends SiteFooterSharedProps, SiteFooterSignupOptions {\n  columns?: readonly SiteFooterColumn[]\n  legal?: readonly SiteFooterLink[]\n}\n\nconst defaultDoneMessage = (email: string) => `You are on the list. We will write to ${email}.`\n\nfunction SiteFooterSignup({\n  brand = DEFAULT_BRAND,\n  copyright,\n  columns = DEFAULT_COLUMNS,\n  legal = DEFAULT_LEGAL,\n  onSubscribe = previewSubscribe,\n  signupTitle = \"One useful email a month.\",\n  signupQuiet = \"What changed, and nothing else.\",\n  signupNote = \"Unsubscribe from any email, with one click.\",\n  doneMessage = defaultDoneMessage,\n  className,\n  ...props\n}: SiteFooterSignupProps) {\n  return (\n    <footer data-slot=\"site-footer\" data-variant=\"signup\" className={cn(ROOT_CLASS, \"bg-muted dark:bg-background\", className)} {...props}>\n      <div className={cn(INNER_CLASS, \"flex flex-col gap-12 py-12\")}>\n        <div data-slot=\"site-footer-signup\" className=\"grid grid-cols-[minmax(0,1fr)] items-start gap-6 rounded-2xl border bg-background p-6 dark:bg-card @3xl:grid-cols-[minmax(0,1fr)_minmax(0,1fr)] @3xl:gap-12 @3xl:p-8\">\n          <h2 className=\"text-title text-2xl text-balance\">\n            {signupTitle} <span className=\"text-muted-foreground\">{signupQuiet}</span>\n          </h2>\n          <SignupForm onSubscribe={onSubscribe} note={signupNote} doneMessage={doneMessage} />\n        </div>\n        <FooterColumns columns={columns} />\n        <LegalRow brand={brand} copyright={copyright} legal={legal} />\n      </div>\n    </footer>\n  )\n}\n\nexport { SiteFooterSignup, looksLikeEmail, type SiteFooterSignupOptions }\n",
      "type": "registry:component"
    }
  ],
  "categories": [
    "blocks"
  ],
  "type": "registry:block"
}