{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "sign-up-split",
  "type": "registry:block",
  "title": "Sign Up Split",
  "description": "Split sign-up with live password requirements and a plan summary panel.",
  "files": [
    {
      "path": "src/registry/blocks/auth/sign-up-split.tsx",
      "type": "registry:block",
      "content": "\"use client\";\n\nimport {\n  useId,\n  useState,\n  type ChangeEvent,\n  type ComponentProps,\n  type CSSProperties,\n  type FormEvent,\n} from \"react\";\nimport { Check, 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 SignUpSplitValues = {\n  name: string;\n  email: string;\n  password: string;\n  acceptedTerms: true;\n};\n\nexport type SignUpSplitProvider = { id: string; label: string };\n\nexport type SignUpSplitPlan = {\n  eyebrow: string;\n  title: string;\n  items: { title: string; detail: string }[];\n  footnote?: string;\n};\n\nexport type SignUpSplitProps = {\n  eyebrow?: string;\n  title?: string;\n  description?: string;\n  plan?: SignUpSplitPlan;\n  providers?: SignUpSplitProvider[];\n  onProviderClick?: (id: string) => void;\n  onSubmit?: (values: SignUpSplitValues) => void | Promise<void>;\n  signInHref?: string;\n  termsHref?: string;\n  privacyHref?: string;\n  /** Panel field. Defaults to a pale blue tint. */\n  surface?: string;\n  /** Text colour on `surface`. Must pass contrast against it. */\n  surfaceForeground?: string;\n  /** Wordmark square, ticks, shapes and primary button. Defaults to Devsloka blue. */\n  accent?: string;\n  /** Text colour on `accent`. Defaults to white. */\n  accentForeground?: string;\n} & Omit<ComponentProps<\"section\">, \"onSubmit\">;\n\nconst DEFAULTS = {\n  eyebrow: \"Create an account\",\n  title: \"Start a notebook for your next round of interviews.\",\n  description: \"Free for teams of up to three. Set-up takes about two minutes.\",\n  plan: {\n    eyebrow: \"Free plan · No card\",\n    title: \"What you get on the free plan\",\n    items: [\n      {\n        title: \"Three seats, unlimited notebooks\",\n        detail: \"Invite two colleagues and keep every study in its own notebook.\",\n      },\n      {\n        title: \"10 hours of transcription a month\",\n        detail: \"Upload interview audio in 14 languages; speakers are labelled for you.\",\n      },\n      {\n        title: \"Tags, highlights and exports\",\n        detail: \"Tag quotes across studies and export them to CSV or Markdown.\",\n      },\n    ],\n    footnote:\n      \"A fourth seat moves you to Studio at €9 per person a month. We ask before charging anything.\",\n  },\n  providers: [\n    { id: \"google\", label: \"Continue with Google\" },\n    { id: \"sso\", label: \"Continue with SSO\" },\n  ],\n  surface: \"#E8F0FF\",\n  surfaceForeground: \"#0A0A0A\",\n  accent: \"#0A6EFF\",\n  accentForeground: \"#FFFFFF\",\n};\n\ntype Field = \"name\" | \"email\" | \"password\" | \"terms\";\ntype Errors = Partial<Record<Field, string>>;\ntype Status = \"idle\" | \"submitting\" | \"success\" | \"error\";\ntype Values = { name: string; email: string; password: string; terms: boolean };\n\nconst EMAIL_PATTERN = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;\n\nfunction passwordRequirements(password: string, email: string) {\n  const lowerPassword = password.toLowerCase();\n  const lowerEmail = email.trim().toLowerCase();\n  const localPart = lowerEmail.split(\"@\")[0] ?? \"\";\n  const containsEmail =\n    lowerEmail.length > 0 &&\n    (lowerPassword.includes(lowerEmail) ||\n      (localPart.length >= 3 && lowerPassword.includes(localPart)));\n  return [\n    { id: \"length\", label: \"At least 12 characters\", met: password.length >= 12 },\n    { id: \"number\", label: \"Includes a number\", met: /\\d/.test(password) },\n    {\n      id: \"email\",\n      label: \"Doesn't contain your email\",\n      met: password.length > 0 && !containsEmail,\n    },\n  ];\n}\n\nfunction validate(values: Values): Errors {\n  const errors: Errors = {};\n  if (!values.name.trim()) errors.name = \"Add your name so teammates know who's who.\";\n  const email = values.email.trim();\n  if (!email) errors.email = \"Enter your work email.\";\n  else if (!EMAIL_PATTERN.test(email))\n    errors.email = \"That email looks incomplete. Check for a typo.\";\n  if (!values.password) errors.password = \"Choose a password.\";\n  else {\n    const missing = passwordRequirements(values.password, values.email).filter((r) => !r.met);\n    if (missing.length > 0)\n      errors.password = `Almost there. Still needed: ${missing\n        .map((r) => r.label.toLowerCase())\n        .join(\", \")}.`;\n  }\n  if (!values.terms) errors.terms = \"Accept the terms to create your account.\";\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\nconst pad = (n: number) => String(n).padStart(2, \"0\");\n\nexport function SignUpSplit({\n  eyebrow = DEFAULTS.eyebrow,\n  title = DEFAULTS.title,\n  description = DEFAULTS.description,\n  plan = DEFAULTS.plan,\n  providers = DEFAULTS.providers,\n  onProviderClick,\n  onSubmit = defaultSubmit,\n  signInHref = \"#\",\n  termsHref = \"#\",\n  privacyHref = \"#\",\n  surface = DEFAULTS.surface,\n  surfaceForeground = DEFAULTS.surfaceForeground,\n  accent = DEFAULTS.accent,\n  accentForeground = DEFAULTS.accentForeground,\n  className,\n  style,\n  ...props\n}: SignUpSplitProps) {\n  const id = useId();\n  const [values, setValues] = useState<Values>({\n    name: \"\",\n    email: \"\",\n    password: \"\",\n    terms: false,\n  });\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 requirementsId = `${id}-requirements`;\n  const submitting = status === \"submitting\";\n  const requirements = passwordRequirements(values.password, values.email);\n  const metCount = requirements.filter((r) => r.met).length;\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({\n        name: values.name.trim(),\n        email: values.email.trim(),\n        password: values.password,\n        acceptedTerms: true,\n      });\n      setStatus(\"success\");\n      setMessage(\n        `Account created. We sent a confirmation to ${values.email.trim()}; open it to finish setting up.`\n      );\n    } catch (error) {\n      setStatus(\"error\");\n      setMessage(\n        error instanceof Error && error.message\n          ? error.message\n          : \"We couldn't create the account just now. Your details are still here, so try again in a moment.\"\n      );\n    }\n  };\n\n  const revalidate = (name: Field, next: Values = values) => {\n    if (attempted) setErrors((current) => ({ ...current, [name]: validate(next)[name] }));\n  };\n\n  const fieldProps = (name: Exclude<Field, \"terms\">) => ({\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: () => revalidate(name),\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-up-split\"\n      aria-labelledby={`${id}-title`}\n      style={\n        {\n          \"--block-surface\": surface,\n          \"--block-surface-fg\": surfaceForeground,\n          \"--block-accent\": accent,\n          \"--block-accent-fg\": accentForeground,\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          <div className=\"px-6 py-10 sm:px-10 md:py-14 lg:col-span-7 lg:px-14\">\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-accent)]\" />\n              Larch\n            </span>\n            <p className=\"mt-10 font-mono text-xs tracking-wider text-muted-foreground uppercase\">\n              {eyebrow}\n            </p>\n            <h2\n              id={`${id}-title`}\n              className=\"mt-4 max-w-lg text-3xl font-semibold tracking-[-0.03em] text-balance md:text-4xl\"\n            >\n              {title}\n            </h2>\n            <p className=\"mt-3 max-w-md text-sm leading-relaxed text-muted-foreground\">\n              {description}\n            </p>\n\n            <form\n              noValidate\n              onSubmit={handleSubmit}\n              aria-busy={submitting}\n              className=\"mt-10 grid max-w-md gap-6\"\n            >\n              <div className=\"grid gap-2\">\n                <Label htmlFor={fieldId(\"name\")}>Full name</Label>\n                <Input {...fieldProps(\"name\")} autoComplete=\"name\" required />\n                {errorText(\"name\")}\n              </div>\n\n              <div className=\"grid gap-2\">\n                <Label htmlFor={fieldId(\"email\")}>Work 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                <Label htmlFor={fieldId(\"password\")}>Password</Label>\n                <div className=\"relative\">\n                  <Input\n                    {...fieldProps(\"password\")}\n                    aria-describedby={cn(requirementsId, errors.password && errorId(\"password\"))}\n                    type={showPassword ? \"text\" : \"password\"}\n                    autoComplete=\"new-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                <ul id={requirementsId} className=\"mt-1 grid gap-1.5 text-xs\">\n                  {requirements.map((requirement) => (\n                    <li\n                      key={requirement.id}\n                      className={cn(\n                        \"flex items-center gap-2\",\n                        requirement.met ? \"text-foreground\" : \"text-muted-foreground\"\n                      )}\n                    >\n                      <span\n                        aria-hidden=\"true\"\n                        className={cn(\n                          \"flex size-3.5 items-center justify-center border\",\n                          requirement.met\n                            ? \"border-[var(--block-accent)] bg-[var(--block-accent)] text-[var(--block-accent-fg)]\"\n                            : \"border-current\"\n                        )}\n                      >\n                        {requirement.met ? <Check className=\"size-2.5\" strokeWidth={3} /> : null}\n                      </span>\n                      {requirement.label}\n                      <span className=\"sr-only\">{requirement.met ? \"(met)\" : \"(not met yet)\"}</span>\n                    </li>\n                  ))}\n                </ul>\n                <p aria-live=\"polite\" className=\"sr-only\">\n                  {values.password\n                    ? `${metCount} of ${requirements.length} password requirements met.`\n                    : \"\"}\n                </p>\n                {errorText(\"password\")}\n              </div>\n\n              <div className=\"grid gap-2\">\n                <div className=\"flex items-start gap-3\">\n                  <Checkbox\n                    id={fieldId(\"terms\")}\n                    checked={values.terms}\n                    required\n                    aria-required=\"true\"\n                    aria-invalid={errors.terms ? true : undefined}\n                    aria-describedby={errors.terms ? errorId(\"terms\") : undefined}\n                    onCheckedChange={(checked) => {\n                      const next = { ...values, terms: checked === true };\n                      setValues(next);\n                      revalidate(\"terms\", next);\n                    }}\n                    className=\"mt-0.5\"\n                  />\n                  <Label htmlFor={fieldId(\"terms\")} className=\"block leading-relaxed font-normal\">\n                    I agree to the{\" \"}\n                    <a href={termsHref} className={linkClass}>\n                      Terms of service\n                    </a>{\" \"}\n                    and the{\" \"}\n                    <a href={privacyHref} className={linkClass}>\n                      Privacy policy\n                    </a>\n                    .\n                  </Label>\n                </div>\n                {errorText(\"terms\")}\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                    Creating account…\n                  </>\n                ) : (\n                  \"Create account\"\n                )}\n              </Button>\n\n              <p\n                role=\"status\"\n                aria-live=\"polite\"\n                className={cn(\n                  \"text-sm leading-relaxed empty:hidden\",\n                  status === \"error\" && \"border-l-2 border-destructive pl-3 text-destructive\",\n                  status === \"success\" && \"border-l-2 border-[var(--block-accent)] pl-3\"\n                )}\n              >\n                {message}\n              </p>\n            </form>\n\n            {providers.length > 0 ? (\n              <div className=\"mt-8 max-w-md\">\n                <div className=\"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=\"mt-6 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              </div>\n            ) : null}\n\n            <p className=\"mt-10 max-w-md border-t pt-6 text-sm text-muted-foreground\">\n              Already have an account?{\" \"}\n              <a href={signInHref} className={cn(linkClass, \"text-foreground\")}>\n                Sign in\n              </a>\n            </p>\n          </div>\n\n          <div className=\"flex flex-col bg-[var(--block-surface)] px-6 py-10 text-[var(--block-surface-fg)] sm:px-10 md:py-14 lg:col-span-5\">\n            <p className=\"font-mono text-xs tracking-wider uppercase\">{plan.eyebrow}</p>\n            <h3 className=\"mt-4 max-w-xs text-2xl font-semibold tracking-[-0.02em] text-balance\">\n              {plan.title}\n            </h3>\n\n            <ol className=\"mt-8 divide-y divide-[var(--block-surface-fg)]/25 border-y border-[var(--block-surface-fg)]/25\">\n              {plan.items.map((item, index) => (\n                <li key={item.title} className=\"grid grid-cols-[2.5rem_1fr] gap-x-2 py-4\">\n                  <span aria-hidden=\"true\" className=\"font-mono text-xs leading-6 font-semibold tabular-nums\">\n                    {pad(index + 1)}\n                  </span>\n                  <div>\n                    <p className=\"font-medium leading-6\">{item.title}</p>\n                    <p className=\"mt-1 text-sm leading-relaxed\">{item.detail}</p>\n                  </div>\n                </li>\n              ))}\n            </ol>\n\n            <svg\n              aria-hidden=\"true\"\n              viewBox=\"0 0 240 64\"\n              className=\"mt-10 w-full max-w-[15rem] lg:mt-auto lg:pt-10\"\n            >\n              {[0, 1, 2].map((i) => (\n                <rect\n                  key={i}\n                  x={i * 56}\n                  y={8}\n                  width={48}\n                  height={48}\n                  className=\"fill-[var(--block-accent)]\"\n                />\n              ))}\n              <rect\n                x={169}\n                y={9}\n                width={46}\n                height={46}\n                strokeWidth={2}\n                strokeDasharray=\"4 4\"\n                className=\"fill-none stroke-[var(--block-accent)]\"\n              />\n            </svg>\n\n            {plan.footnote ? (\n              <p className=\"mt-4 max-w-xs text-xs leading-relaxed\">{plan.footnote}</p>\n            ) : null}\n          </div>\n        </div>\n      </div>\n    </section>\n  );\n}\n"
    }
  ],
  "dependencies": [
    "lucide-react"
  ],
  "registryDependencies": [
    "button",
    "checkbox",
    "input",
    "label"
  ]
}
