{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "auth-page",
  "title": "Sign-in page",
  "description": "Centered 384px column, 30px title, stacked 40px pill choices, code field and code boxes, 'Signing in to <app>'.",
  "files": [
    {
      "path": "registry/dgit/blocks/auth-page.tsx",
      "content": "import type { ComponentProps, ReactNode, Ref } from \"react\";\nimport { cn } from \"@/lib/utils\";\n\n/**\n * Sign-in screens: no card, one centered 384px column, a 30px title, 40px pill choices stacked\n * (email, passkey, Google, GitHub), a code field or code boxes, and \"Signing in to <app>\" at the top\n * right when another app sent the person here. For the whole email → code / password / Google flow, use\n * the `auth-flow` block, which is built on these.\n *\n *   <AuthLayout brand={<Logo />} app=\"Claude\">\n *     <AuthTitle>Log into your account</AuthTitle>\n *     <AuthButton icon={<Mail />}>Continue with email</AuthButton>\n *     <AuthDivider />\n *     <AuthButton icon={<KeyRound />}>Continue with passkey</AuthButton>\n *   </AuthLayout>\n */\nexport function AuthLayout({ brand, app, footer, children, align = \"center\" }: { brand?: ReactNode; app?: string; footer?: ReactNode; children: ReactNode; align?: \"center\" | \"left\" }) {\n  return (\n    <div className=\"flex min-h-dvh flex-col bg-background text-foreground\">\n      <header className=\"flex items-center justify-between gap-3 px-4 py-[14px] sm:px-6 sm:py-[18px]\">\n        {brand ?? <span />}\n        {app ? (\n          <div className=\"flex min-w-0 items-center gap-2 text-sm whitespace-nowrap text-muted-foreground\">\n            <span className=\"hidden sm:inline\">Signing in to</span>\n            <b className=\"max-w-[220px] truncate rounded-full border px-3 py-[5px] font-medium text-foreground\">{app}</b>\n          </div>\n        ) : null}\n      </header>\n      <main className=\"flex flex-1 flex-col items-center justify-center px-4 pt-6 pb-14\">\n        <div className={cn(\"flex w-full max-w-[384px] flex-col gap-3\", align === \"left\" && \"[&_h1]:text-left [&>p.sub]:text-left\")}>{children}</div>\n      </main>\n      {footer ? <footer className=\"px-4 py-5 text-center text-xs text-muted-foreground [&_a]:text-inherit\">{footer}</footer> : null}\n    </div>\n  );\n}\n\nexport function AuthTitle({ children, sub }: { children: ReactNode; sub?: ReactNode }) {\n  return (\n    <>\n      <h1 className=\"mb-5 text-center text-heading-30 text-balance\">{children}</h1>\n      {sub ? <p className=\"sub -mt-4 mb-4 text-center text-muted-foreground text-balance [&_b]:font-medium [&_b]:text-foreground\">{sub}</p> : null}\n    </>\n  );\n}\n\nconst pill =\n  \"flex h-10 w-full cursor-pointer items-center justify-center gap-2.5 rounded-full border px-4 text-[15px] leading-none font-medium no-underline transition-[background,opacity] outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-foreground disabled:cursor-default disabled:opacity-50 [&_svg]:size-[18px]\";\n\n/** A full-width pill: outline by default, `primary` for the one main action. */\nexport function AuthButton({ icon, primary, className, children, ...props }: ComponentProps<\"button\"> & { icon?: ReactNode; primary?: boolean }) {\n  return (\n    <button className={cn(pill, primary ? \"border-primary bg-primary text-primary-foreground hover:opacity-88\" : \"bg-transparent text-foreground hover:bg-gray-100\", className)} {...props}>\n      {icon}\n      {children}\n    </button>\n  );\n}\n\n/** A pill text field (email and the like). */\nexport function AuthField({ className, ...props }: ComponentProps<\"input\">) {\n  return (\n    <input\n      className={cn(\n        \"h-10 w-full rounded-full border bg-transparent px-[18px] text-[15px] text-foreground outline-none placeholder:text-muted-foreground focus:border-foreground\",\n        className,\n      )}\n      {...props}\n    />\n  );\n}\n\n/** A one-time code field: 52px tall, monospace, spaced out. */\nexport function AuthCodeField({ className, ...props }: ComponentProps<\"input\">) {\n  return (\n    <AuthField\n      inputMode=\"numeric\"\n      autoComplete=\"one-time-code\"\n      className={cn(\"h-[52px] pl-[calc(18px+0.45em)] text-center font-mono text-[22px] font-medium tracking-[0.45em]\", className)}\n      {...props}\n    />\n  );\n}\n\n/**\n * A one-time code as boxes: two joined groups with a dash between (6 → 3·3, 8 → 4·4). One real input sits\n * over the boxes, so typing, paste (a full \"123 456\" replaces what's there), backspace and the phone's\n * `one-time-code` autofill all behave like a normal field. The box to type into gets the focus ring; `bad` turns the boxes red.\n * `fill` stretches the boxes so the row spans its container (e.g. as wide as the Continue button under it);\n * the dash between the groups keeps its size.\n *\n *   <AuthCodeBoxes value={code} onChange={setCode} label=\"6-digit code\" bad={Boolean(error)} />\n */\nexport function AuthCodeBoxes({\n  value,\n  onChange,\n  length = 6,\n  numeric = true,\n  bad = false,\n  fill = false,\n  label,\n  inputRef,\n  className,\n  ...props\n}: Omit<ComponentProps<\"input\">, \"value\" | \"onChange\" | \"ref\"> & {\n  value: string;\n  onChange: (value: string) => void;\n  length?: number;\n  /** Digits only (default). Off: letters and digits, upper-cased. */\n  numeric?: boolean;\n  bad?: boolean;\n  /** Stretch the boxes to the container's full width (height stays 36px). */\n  fill?: boolean;\n  /** The field's accessible name (\"6-digit code\"). */\n  label: string;\n  inputRef?: Ref<HTMLInputElement>;\n}) {\n  const clean = (raw: string) => (numeric ? raw.replace(/\\D/g, \"\") : raw.replace(/[^0-9a-z]/gi, \"\").toUpperCase()).slice(0, length);\n  const active = Math.min(value.length, length - 1);\n  const half = Math.ceil(length / 2);\n  const caretToEnd = (el: HTMLInputElement) => {\n    const end = el.value.length;\n    if (el.selectionStart !== end || el.selectionEnd !== end) el.setSelectionRange(end, end);\n  };\n  // `fill`: equal grid columns, so every box is the same width whatever its borders.\n  const cols = (n: number) => ({ gridTemplateColumns: `repeat(${n}, minmax(0, 1fr))` });\n  const box = (i: number) => (\n    <div\n      key={i}\n      className={cn(\n        \"relative flex h-9 items-center justify-center border-y border-r border-input bg-background-200 text-sm leading-5 text-foreground shadow-xs first:rounded-l-[8px] first:border-l last:rounded-r-[8px]\",\n        !fill && \"w-9\",\n        i === active && \"group-focus-within:z-10 group-focus-within:ring-2 group-focus-within:ring-ring\",\n        bad && \"border-destructive\",\n      )}\n    >\n      {value[i] ?? \"\"}\n    </div>\n  );\n  return (\n    <div className={cn(\"group relative items-center gap-2\", fill ? \"flex w-full\" : \"inline-flex\", className)}>\n      <div className={cn(\"flex\", fill && \"grid flex-1\")} style={fill ? cols(half) : undefined} aria-hidden=\"true\">\n        {Array.from({ length: half }, (_, i) => box(i))}\n      </div>\n      <div className=\"flex size-6 shrink-0 items-center justify-center\" aria-hidden=\"true\">\n        <span className=\"h-0.5 w-4 bg-foreground opacity-20\" />\n      </div>\n      <div className={cn(\"flex\", fill && \"grid flex-1\")} style={fill ? cols(length - half) : undefined} aria-hidden=\"true\">\n        {Array.from({ length: length - half }, (_, i) => box(half + i))}\n      </div>\n      <input\n        {...props}\n        ref={inputRef}\n        value={value}\n        onChange={(e) => onChange(clean(e.target.value))}\n        // The caret always sits at the end, so a paste would only append: a full code (\"123 456\") replaces\n        // the value, a shorter piece is added to it.\n        onPaste={(e) => {\n          e.preventDefault();\n          const pasted = clean(e.clipboardData.getData(\"text\"));\n          if (pasted) onChange(pasted.length >= length ? pasted : clean(value + pasted));\n        }}\n        onSelect={(e) => caretToEnd(e.currentTarget)}\n        onFocus={(e) => caretToEnd(e.currentTarget)}\n        inputMode={numeric ? \"numeric\" : \"text\"}\n        autoComplete=\"one-time-code\"\n        autoCapitalize={numeric ? \"off\" : \"characters\"}\n        autoCorrect=\"off\"\n        spellCheck={false}\n        aria-label={label}\n        aria-invalid={bad || undefined}\n        className=\"absolute inset-0 size-full cursor-text border-0 bg-transparent p-0 text-base text-transparent caret-transparent outline-none selection:bg-transparent\"\n      />\n    </div>\n  );\n}\n\nexport function AuthDivider({ children = \"or\", className }: { children?: ReactNode; className?: string }) {\n  return (\n    <div className={cn(\"my-1 flex items-center gap-3 text-[13px] text-muted-foreground before:h-px before:flex-1 before:bg-border after:h-px after:flex-1 after:bg-border\", className)}>\n      {children}\n    </div>\n  );\n}\n\n/** Small muted text under the form (\"The code expires in 5 minutes.\"). */\nexport function AuthNote({ children, className }: { children: ReactNode; className?: string }) {\n  return <p className={cn(\"mt-1 text-center text-[13px] text-muted-foreground [&_a]:text-foreground\", className)}>{children}</p>;\n}\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:block"
}