{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "sign-up",
  "type": "registry:block",
  "title": "Sign Up",
  "description": "A minimal centred sign-up: name, work email and a password whose length hint ticks green as you type, with inline errors and the terms in one quiet line.",
  "categories": [
    "screen",
    "Auth"
  ],
  "dependencies": [
    "lucide-react",
    "motion"
  ],
  "registryDependencies": [
    "utils",
    "https://coss.com/ui/r/button.json",
    "https://coss.com/ui/r/input.json",
    "https://coss.com/ui/r/input-group.json",
    "https://coss.com/ui/r/label.json"
  ],
  "files": [
    {
      "path": "registry/devl/sign-up.tsx",
      "type": "registry:component",
      "content": "\"use client\";\n\nimport { CheckIcon, EyeIcon, EyeOffIcon } from \"lucide-react\";\nimport { motion, useReducedMotion } from \"motion/react\";\nimport { type FormEvent, type ReactNode, useId, useState } from \"react\";\nimport { Button } from \"@/components/ui/button\";\nimport { Input } from \"@/components/ui/input\";\nimport { InputGroup, InputGroupAddon, InputGroupInput } from \"@/components/ui/input-group\";\nimport { Label } from \"@/components/ui/label\";\nimport { cn } from \"@/lib/utils\";\n\nexport type SignUpResult = { ok: true } | { ok: false; error: string };\n\nexport interface SignUpDetails {\n  name: string;\n  email: string;\n  password: string;\n}\n\nexport interface SignUpProps {\n  product?: string;\n  logo?: ReactNode;\n  minLength?: number;\n  onSignUp?: (details: SignUpDetails) => Promise<SignUpResult>;\n  onSignIn?: () => void;\n  onTerms?: () => void;\n  onPrivacy?: () => void;\n  className?: string;\n}\n\nconst EMAIL = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]{2,}$/;\n\nasync function demoSignUp(): Promise<SignUpResult> {\n  await new Promise((resolve) => setTimeout(resolve, 900));\n  return { ok: true };\n}\n\nfunction Mark() {\n  return (\n    <span className=\"flex size-10 items-center justify-center rounded-xl bg-primary text-primary-foreground shadow-xs/5\">\n      <svg aria-hidden className=\"size-6\" fill=\"none\" viewBox=\"0 0 28 28\">\n        <path d=\"M7 18.5 12 12l3.5 4.5 2-2.5 3.5 4.5\" stroke=\"currentColor\" strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth=\"2.2\" />\n      </svg>\n    </span>\n  );\n}\n\nconst linkClass =\n  \"cursor-pointer rounded-sm text-foreground underline underline-offset-4 outline-none decoration-border hover:decoration-foreground focus-visible:ring-2 focus-visible:ring-ring\";\n\nexport function SignUp({\n  product = \"Ridgeline\",\n  logo,\n  minLength = 8,\n  onSignUp = demoSignUp,\n  onSignIn,\n  onTerms,\n  onPrivacy,\n  className,\n}: SignUpProps) {\n  const id = useId();\n  const reduce = useReducedMotion();\n  const [name, setName] = useState(\"\");\n  const [email, setEmail] = useState(\"\");\n  const [password, setPassword] = useState(\"\");\n  const [reveal, setReveal] = useState(false);\n  const [busy, setBusy] = useState(false);\n  const [error, setError] = useState<string | null>(null);\n  const [tried, setTried] = useState(false);\n  const [done, setDone] = useState(false);\n\n  const longEnough = password.length >= minLength;\n  const emailValid = EMAIL.test(email.trim());\n  const emailError = tried && !emailValid ? \"Enter a valid email address.\" : null;\n  const passwordError = tried && !longEnough;\n\n  const submit = async (event: FormEvent) => {\n    event.preventDefault();\n    if (busy || done) return;\n    setTried(true);\n    setError(null);\n    if (!emailValid || !longEnough) return;\n    setBusy(true);\n    const result = await onSignUp({ name: name.trim(), email: email.trim(), password });\n    setBusy(false);\n    if (result.ok) setDone(true);\n    else setError(result.error);\n  };\n\n  return (\n    <div className={cn(\"flex h-[760px] w-full flex-col overflow-y-auto bg-background px-6 py-10 text-foreground\", className)}>\n      <div className=\"m-auto flex w-full max-w-[340px] flex-col items-center\">\n        {logo ?? <Mark />}\n        <h1 className=\"mt-6 text-balance text-center font-semibold text-xl tracking-tight\">Create your {product} account</h1>\n        <p className=\"mt-1.5 text-balance text-center text-muted-foreground text-sm\">Free for your first three projects. No card needed.</p>\n\n        <form className=\"mt-8 flex w-full flex-col gap-4\" noValidate onSubmit={submit}>\n          <div className=\"flex flex-col gap-2\">\n            <Label htmlFor={`${id}-name`}>Name</Label>\n            <Input autoComplete=\"name\" disabled={done} id={`${id}-name`} onChange={(e) => setName(e.target.value)} placeholder=\"Ada Lindqvist\" value={name} />\n          </div>\n          <div className=\"flex flex-col gap-2\">\n            <Label htmlFor={`${id}-email`}>Work email</Label>\n            <Input\n              aria-describedby={emailError ? `${id}-email-error` : undefined}\n              aria-invalid={emailError ? true : undefined}\n              autoComplete=\"email\"\n              disabled={done}\n              id={`${id}-email`}\n              onChange={(e) => setEmail(e.target.value)}\n              placeholder=\"you@company.com\"\n              type=\"email\"\n              value={email}\n            />\n            {emailError && (\n              <p className=\"text-destructive-foreground text-xs\" id={`${id}-email-error`}>\n                {emailError}\n              </p>\n            )}\n          </div>\n          <div className=\"flex flex-col gap-2\">\n            <Label htmlFor={`${id}-password`}>Password</Label>\n            <InputGroup>\n              <InputGroupInput\n                aria-describedby={`${id}-hint`}\n                aria-invalid={passwordError ? true : undefined}\n                autoComplete=\"new-password\"\n                disabled={done}\n                id={`${id}-password`}\n                onChange={(e) => setPassword(e.target.value)}\n                placeholder=\"Create a password\"\n                type={reveal ? \"text\" : \"password\"}\n                value={password}\n              />\n              <InputGroupAddon align=\"inline-end\">\n                <button\n                  aria-label={reveal ? \"Hide password\" : \"Show password\"}\n                  className=\"flex size-6 cursor-pointer items-center justify-center rounded-md text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring\"\n                  onClick={() => setReveal((value) => !value)}\n                  type=\"button\"\n                >\n                  {reveal ? <EyeOffIcon className=\"size-4\" /> : <EyeIcon className=\"size-4\" />}\n                </button>\n              </InputGroupAddon>\n            </InputGroup>\n            <p\n              className={cn(\n                \"flex items-center gap-1.5 text-xs transition-colors\",\n                longEnough ? \"text-success-foreground\" : passwordError ? \"text-destructive-foreground\" : \"text-muted-foreground\",\n              )}\n              id={`${id}-hint`}\n            >\n              <span\n                className={cn(\n                  \"flex size-3.5 items-center justify-center rounded-full border transition-colors\",\n                  longEnough ? \"border-success bg-success text-white\" : \"border-current/40\",\n                )}\n              >\n                {longEnough && (\n                  <motion.span animate={{ scale: 1 }} className=\"flex\" initial={reduce ? false : { scale: 0.4 }} transition={{ type: \"spring\", stiffness: 500, damping: 24 }}>\n                    <CheckIcon className=\"size-2.5\" strokeWidth={3} />\n                  </motion.span>\n                )}\n              </span>\n              At least {minLength} characters\n            </p>\n          </div>\n          {error && (\n            <p className=\"text-destructive-foreground text-xs\" role=\"alert\">\n              {error}\n            </p>\n          )}\n          <Button className={cn(\"mt-2 w-full\", done && \"pointer-events-none\")} loading={busy} type=\"submit\">\n            {done ? (\n              <motion.span animate={{ opacity: 1, scale: 1 }} className=\"flex items-center gap-2\" initial={reduce ? false : { opacity: 0, scale: 0.9 }}>\n                <CheckIcon />\n                Account created\n              </motion.span>\n            ) : (\n              \"Create account\"\n            )}\n          </Button>\n          <p className=\"text-balance text-center text-muted-foreground text-xs leading-relaxed\">\n            By continuing you agree to the{\" \"}\n            <button className={linkClass} onClick={onTerms} type=\"button\">\n              Terms\n            </button>{\" \"}\n            and{\" \"}\n            <button className={linkClass} onClick={onPrivacy} type=\"button\">\n              Privacy Policy\n            </button>\n            .\n          </p>\n        </form>\n\n        <p className=\"mt-8 text-center text-muted-foreground text-sm\">\n          Already have an account?{\" \"}\n          <button\n            className=\"cursor-pointer rounded-sm font-medium text-foreground underline-offset-4 outline-none hover:underline focus-visible:ring-2 focus-visible:ring-ring\"\n            onClick={onSignIn}\n            type=\"button\"\n          >\n            Sign in\n          </button>\n        </p>\n      </div>\n    </div>\n  );\n}\n"
    }
  ]
}