{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "sign-in-split",
  "type": "registry:block",
  "title": "Sign In Split",
  "description": "Split sign-in with an ink panel, researcher quote and SSO options.",
  "files": [
    {
      "path": "src/registry/blocks/auth/sign-in-split.tsx",
      "type": "registry:block",
      "content": "\"use client\";\n\nimport {\n  useId,\n  useState,\n  type ComponentProps,\n  type ChangeEvent,\n  type CSSProperties,\n  type FormEvent,\n} from \"react\";\nimport { Eye, EyeOff, Loader2 } from \"lucide-react\";\n\nimport { Button } from \"@/components/ui/button\";\nimport { Checkbox } from \"@/components/ui/checkbox\";\nimport { Input } from \"@/components/ui/input\";\nimport { Label } from \"@/components/ui/label\";\nimport { cn } from \"@/lib/utils\";\n\nexport type SignInSplitValues = {\n  email: string;\n  password: string;\n  remember: boolean;\n};\n\nexport type SignInSplitProvider = { id: string; label: string };\n\nexport type SignInSplitQuote = {\n  text: string;\n  name: string;\n  role: string;\n  organization: string;\n};\n\nexport type SignInSplitProps = {\n  eyebrow?: string;\n  title?: string;\n  description?: string;\n  /** Short line shown next to the wordmark on the collapsed mobile strip. */\n  tagline?: string;\n  quote?: SignInSplitQuote;\n  providers?: SignInSplitProvider[];\n  onProviderClick?: (id: string) => void;\n  onSubmit?: (values: SignInSplitValues) => void | Promise<void>;\n  forgotPasswordHref?: string;\n  signUpHref?: string;\n  /** Panel field and primary button. Defaults to Devsloka blue. */\n  accent?: string;\n  /** Text colour on `accent`. Defaults to white. */\n  accentForeground?: string;\n  /** Second ink used for the wordmark square and the shapes on the panel. Defaults to near-black. */\n  highlight?: string;\n} & Omit<ComponentProps<\"section\">, \"onSubmit\">;\n\nconst DEFAULTS = {\n  eyebrow: \"Sign in\",\n  title: \"Pick up where your team left off.\",\n  description:\n    \"Your notebooks, transcripts and tags are where you left them on Friday.\",\n  tagline: \"Notebooks for research teams\",\n  quote: {\n    text: \"We used to lose interview notes in someone's Downloads folder. Now four of us tag the same transcript on the same afternoon, and the synthesis meeting takes forty minutes instead of three hours.\",\n    name: \"Imke Vos\",\n    role: \"Lead researcher\",\n    organization: \"Hollis Field Lab\",\n  },\n  providers: [\n    { id: \"google\", label: \"Continue with Google\" },\n    { id: \"sso\", label: \"Continue with SSO\" },\n  ],\n  accent: \"#0A6EFF\",\n  accentForeground: \"#FFFFFF\",\n  highlight: \"#0A0A0A\",\n};\n\ntype Field = \"email\" | \"password\";\ntype Errors = Partial<Record<Field, string>>;\ntype Status = \"idle\" | \"submitting\" | \"success\" | \"error\";\n\nconst EMAIL_PATTERN = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;\n\nfunction validate(values: Record<Field, string>): Errors {\n  const errors: Errors = {};\n  const email = values.email.trim();\n  if (!email) errors.email = \"Enter the email you use for Larch.\";\n  else if (!EMAIL_PATTERN.test(email))\n    errors.email = \"That email looks incomplete. Check for a typo.\";\n  if (!values.password) errors.password = \"Enter your password.\";\n  return errors;\n}\n\nconst defaultSubmit = () =>\n  new Promise<void>((resolve) => setTimeout(resolve, 900));\n\nconst linkClass =\n  \"rounded-sm font-medium underline decoration-1 underline-offset-4 outline-none hover:decoration-2 focus-visible:ring-2 focus-visible:ring-ring\";\n\nexport function SignInSplit({\n  eyebrow = DEFAULTS.eyebrow,\n  title = DEFAULTS.title,\n  description = DEFAULTS.description,\n  tagline = DEFAULTS.tagline,\n  quote = DEFAULTS.quote,\n  providers = DEFAULTS.providers,\n  onProviderClick,\n  onSubmit = defaultSubmit,\n  forgotPasswordHref = \"#\",\n  signUpHref = \"#\",\n  accent = DEFAULTS.accent,\n  accentForeground = DEFAULTS.accentForeground,\n  highlight = DEFAULTS.highlight,\n  className,\n  style,\n  ...props\n}: SignInSplitProps) {\n  const id = useId();\n  const [values, setValues] = useState<Record<Field, string>>({\n    email: \"\",\n    password: \"\",\n  });\n  const [remember, setRemember] = useState(true);\n  const [showPassword, setShowPassword] = useState(false);\n  const [errors, setErrors] = useState<Errors>({});\n  const [attempted, setAttempted] = useState(false);\n  const [status, setStatus] = useState<Status>(\"idle\");\n  const [message, setMessage] = useState(\"\");\n\n  const fieldId = (name: Field) => `${id}-${name}`;\n  const errorId = (name: Field) => `${id}-${name}-error`;\n  const submitting = status === \"submitting\";\n\n  const handleSubmit = async (event: FormEvent<HTMLFormElement>) => {\n    event.preventDefault();\n    setAttempted(true);\n    const nextErrors = validate(values);\n    setErrors(nextErrors);\n    const firstInvalid = (Object.keys(nextErrors) as Field[])[0];\n    if (firstInvalid) {\n      document.getElementById(fieldId(firstInvalid))?.focus();\n      return;\n    }\n\n    setStatus(\"submitting\");\n    setMessage(\"\");\n    try {\n      await onSubmit({ email: values.email.trim(), password: values.password, remember });\n      setStatus(\"success\");\n      setMessage(\"Signed in. Opening your notebooks…\");\n    } catch (error) {\n      setStatus(\"error\");\n      setMessage(\n        error instanceof Error && error.message\n          ? error.message\n          : \"We couldn't sign you in with that email and password. Check both and try again.\"\n      );\n    }\n  };\n\n  const fieldProps = (name: Field) => ({\n    id: fieldId(name),\n    name,\n    value: values[name],\n    \"aria-invalid\": errors[name] ? true : undefined,\n    \"aria-describedby\": errors[name] ? errorId(name) : undefined,\n    onChange: (event: ChangeEvent<HTMLInputElement>) =>\n      setValues((current) => ({ ...current, [name]: event.target.value })),\n    onBlur: () => {\n      if (attempted)\n        setErrors((current) => ({ ...current, [name]: validate(values)[name] }));\n    },\n  });\n\n  const errorText = (name: Field) =>\n    errors[name] ? (\n      <p id={errorId(name)} className=\"text-xs text-destructive\">\n        {errors[name]}\n      </p>\n    ) : null;\n\n  return (\n    <section\n      data-slot=\"sign-in-split\"\n      aria-labelledby={`${id}-title`}\n      style={\n        {\n          \"--block-accent\": accent,\n          \"--block-accent-fg\": accentForeground,\n          \"--block-highlight\": highlight,\n          ...style,\n        } as CSSProperties\n      }\n      className={cn(\"w-full bg-background text-foreground\", className)}\n      {...props}\n    >\n      <div className=\"mx-auto max-w-6xl px-6 py-16 md:py-24\">\n        <div className=\"grid border lg:grid-cols-12\">\n          {/* Ink panel: a top strip on small screens, a full column from lg. */}\n          <div className=\"flex flex-col bg-[var(--block-accent)] px-6 py-4 text-[var(--block-accent-fg)] lg:col-span-5 lg:justify-between lg:p-10\">\n            <div className=\"flex items-center justify-between gap-4\">\n              <span className=\"inline-flex items-center gap-2 text-lg font-semibold tracking-tight\">\n                <span aria-hidden=\"true\" className=\"size-2.5 bg-[var(--block-highlight)]\" />\n                Larch\n              </span>\n              <span className=\"font-mono text-[11px] tracking-wider uppercase lg:hidden\">\n                {tagline}\n              </span>\n            </div>\n\n            <svg\n              aria-hidden=\"true\"\n              viewBox=\"0 0 320 220\"\n              className=\"mt-12 hidden w-full max-w-sm lg:block\"\n            >\n              {Array.from({ length: 24 }, (_, i) => (\n                <circle\n                  key={i}\n                  cx={12 + (i % 6) * 18}\n                  cy={12 + Math.floor(i / 6) * 18}\n                  r={2.5}\n                  className=\"fill-current\"\n                />\n              ))}\n              <path d=\"M 20 220 A 100 100 0 0 1 220 220 Z\" className=\"fill-current\" />\n              <circle cx={258} cy={70} r={40} className=\"fill-[var(--block-highlight)]\" />\n              <rect x={244} y={130} width={28} height={90} className=\"fill-[var(--block-highlight)]\" />\n            </svg>\n\n            {quote ? (\n              <figure className=\"mt-12 hidden border-t border-current/30 pt-6 lg:block\">\n                <blockquote className=\"text-lg leading-snug tracking-tight text-pretty\">\n                  &ldquo;{quote.text}&rdquo;\n                </blockquote>\n                <figcaption className=\"mt-6 text-sm\">\n                  <span className=\"font-semibold\">{quote.name}</span>, {quote.role}\n                  <span className=\"mt-1 block font-mono text-[11px] tracking-wider uppercase\">\n                    {quote.organization}\n                  </span>\n                </figcaption>\n              </figure>\n            ) : null}\n          </div>\n\n          <div className=\"px-6 py-10 sm:px-10 md:py-14 lg:col-span-7 lg:px-16\">\n            <div className=\"max-w-md\">\n              <p className=\"font-mono text-xs tracking-wider text-muted-foreground uppercase\">\n                {eyebrow}\n              </p>\n              <h2\n                id={`${id}-title`}\n                className=\"mt-4 text-3xl font-semibold tracking-[-0.03em] text-balance md:text-4xl\"\n              >\n                {title}\n              </h2>\n              <p className=\"mt-3 text-sm leading-relaxed text-muted-foreground\">{description}</p>\n\n              <form\n                noValidate\n                onSubmit={handleSubmit}\n                aria-busy={submitting}\n                className=\"mt-10 grid gap-6\"\n              >\n                <div className=\"grid gap-2\">\n                  <Label htmlFor={fieldId(\"email\")}>Email</Label>\n                  <Input\n                    {...fieldProps(\"email\")}\n                    type=\"email\"\n                    autoComplete=\"email\"\n                    inputMode=\"email\"\n                    required\n                  />\n                  {errorText(\"email\")}\n                </div>\n\n                <div className=\"grid gap-2\">\n                  <div className=\"flex items-baseline justify-between gap-4\">\n                    <Label htmlFor={fieldId(\"password\")}>Password</Label>\n                    <a href={forgotPasswordHref} className={cn(linkClass, \"text-xs font-normal text-muted-foreground hover:text-foreground\")}>\n                      Forgot password?\n                    </a>\n                  </div>\n                  <div className=\"relative\">\n                    <Input\n                      {...fieldProps(\"password\")}\n                      type={showPassword ? \"text\" : \"password\"}\n                      autoComplete=\"current-password\"\n                      required\n                      className=\"pr-10\"\n                    />\n                    <button\n                      type=\"button\"\n                      aria-label={showPassword ? \"Hide password\" : \"Show password\"}\n                      onClick={() => setShowPassword((current) => !current)}\n                      className=\"absolute inset-y-0 right-0 flex w-10 items-center justify-center rounded-r-md text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring\"\n                    >\n                      {showPassword ? (\n                        <EyeOff aria-hidden=\"true\" className=\"size-4\" />\n                      ) : (\n                        <Eye aria-hidden=\"true\" className=\"size-4\" />\n                      )}\n                    </button>\n                  </div>\n                  {errorText(\"password\")}\n                </div>\n\n                <div className=\"flex items-center gap-2\">\n                  <Checkbox\n                    id={`${id}-remember`}\n                    checked={remember}\n                    onCheckedChange={(checked) => setRemember(checked === true)}\n                  />\n                  <Label htmlFor={`${id}-remember`} className=\"font-normal\">\n                    Keep me signed in\n                  </Label>\n                </div>\n\n                <Button\n                  type=\"submit\"\n                  size=\"lg\"\n                  disabled={submitting}\n                  className=\"w-full rounded-none bg-[var(--block-accent)] text-[var(--block-accent-fg)] shadow-none hover:bg-[var(--block-accent)] hover:underline hover:underline-offset-4\"\n                >\n                  {submitting ? (\n                    <>\n                      <Loader2 aria-hidden=\"true\" className=\"animate-spin motion-reduce:animate-none\" />\n                      Signing in…\n                    </>\n                  ) : (\n                    \"Sign in\"\n                  )}\n                </Button>\n\n                <p\n                  role=\"status\"\n                  aria-live=\"polite\"\n                  className={cn(\n                    \"text-sm empty:hidden\",\n                    status === \"error\" ? \"border-l-2 border-destructive pl-3 text-destructive\" : \"flex items-center gap-2\"\n                  )}\n                >\n                  {status === \"success\" ? (\n                    <span aria-hidden=\"true\" className=\"size-1.5 bg-[var(--block-accent)]\" />\n                  ) : null}\n                  {message}\n                </p>\n              </form>\n\n              {providers.length > 0 ? (\n                <>\n                  <div className=\"my-8 flex items-center gap-4\" aria-hidden=\"true\">\n                    <span className=\"h-px flex-1 bg-border\" />\n                    <span className=\"font-mono text-[11px] tracking-wider text-muted-foreground uppercase\">\n                      or\n                    </span>\n                    <span className=\"h-px flex-1 bg-border\" />\n                  </div>\n                  <div className=\"grid gap-3 sm:grid-cols-2\">\n                    {providers.map((provider) => (\n                      <Button\n                        key={provider.id}\n                        type=\"button\"\n                        variant=\"outline\"\n                        className=\"rounded-none shadow-none\"\n                        onClick={() => onProviderClick?.(provider.id)}\n                      >\n                        {provider.label}\n                      </Button>\n                    ))}\n                  </div>\n                </>\n              ) : null}\n\n              <p className=\"mt-10 border-t pt-6 text-sm text-muted-foreground\">\n                New to Larch?{\" \"}\n                <a href={signUpHref} className={cn(linkClass, \"text-foreground\")}>\n                  Create an account\n                </a>\n              </p>\n            </div>\n          </div>\n        </div>\n      </div>\n    </section>\n  );\n}\n"
    }
  ],
  "dependencies": [
    "lucide-react"
  ],
  "registryDependencies": [
    "button",
    "checkbox",
    "input",
    "label"
  ]
}
