{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "signup-card",
  "type": "registry:block",
  "title": "Signup Card",
  "description": "A sign-up card: name, email and password with friendly errors on submit, a terms checkbox, and a celebration when it works.",
  "categories": [
    "blocks"
  ],
  "dependencies": [
    "@plop-ui/react",
    "@plop-ui/fonts"
  ],
  "registryDependencies": [
    "https://plopui.com/r/plop-setup.json"
  ],
  "files": [
    {
      "path": "registry/plopui/signup-card.tsx",
      "type": "registry:component",
      "target": "components/plop/signup-card.tsx",
      "content": "\"use client\";\n\nimport { useState, type CSSProperties, type FormEvent } from \"react\";\nimport { Button, Checkbox, Heading, Sheet, TextField, toast } from \"@plop-ui/react\";\n\ntype Errors = Partial<Record<\"name\" | \"email\" | \"password\" | \"terms\", string>>;\n\n/** A sign-up card: name, email and password with friendly errors on submit, a terms checkbox, and a celebration when it works. */\nexport function SignupCard() {\n  const [errors, setErrors] = useState<Errors>({});\n  const [terms, setTerms] = useState(false);\n  const [sending, setSending] = useState(false);\n\n  function submit(e: FormEvent<HTMLFormElement>) {\n    e.preventDefault();\n    const data = new FormData(e.currentTarget);\n    const name = String(data.get(\"name\") ?? \"\").trim();\n    const email = String(data.get(\"email\") ?? \"\").trim();\n    const password = String(data.get(\"password\") ?? \"\");\n    const next: Errors = {};\n    if (!name) next.name = \"What should we call you?\";\n    if (!email.includes(\"@\")) next.email = \"That doesn't look like an email.\";\n    if (password.length < 8) next.password = \"At least 8 characters, please.\";\n    if (!terms) next.terms = \"Please agree to the terms.\";\n    setErrors(next);\n    if (Object.keys(next).length) {\n      toast.error(\"A few things need fixing\", { buddy: true });\n      return;\n    }\n    setSending(true);\n    // Replace with your own sign-up call.\n    setTimeout(() => {\n      setSending(false);\n      toast.success(`Welcome, ${name}!`, { buddy: \"congrats\", burst: true });\n    }, 900);\n  }\n\n  return (\n    <Sheet tape=\"mint\">\n      <form onSubmit={submit} noValidate style={stack}>\n        <div>\n          <Heading level={2}>Join the sketchbook</Heading>\n          <p style={sub}>Free forever. Bring your own doodles.</p>\n        </div>\n        <TextField label=\"Name\" name=\"name\" autoComplete=\"name\" error={errors.name} />\n        <TextField label=\"Email\" name=\"email\" type=\"email\" autoComplete=\"email\" error={errors.email} />\n        <TextField\n          label=\"Password\"\n          name=\"password\"\n          type=\"password\"\n          autoComplete=\"new-password\"\n          hint=\"At least 8 characters.\"\n          error={errors.password}\n        />\n        <div>\n          <Checkbox checked={terms} onCheckedChange={setTerms}>\n            I agree to the terms\n          </Checkbox>\n          {errors.terms && (\n            <p role=\"alert\" style={error}>\n              {errors.terms}\n            </p>\n          )}\n        </div>\n        {/* The buddy peeks about 30px above the button, so it gets room of its own. */}\n        <div style={{ paddingTop: 34 }}>\n          <Button type=\"submit\" variant=\"ink\" size=\"lg\" buddy loading={sending} loadingLabel=\"Creating your account\">\n            Create account\n          </Button>\n        </div>\n      </form>\n    </Sheet>\n  );\n}\n\nconst stack: CSSProperties = { display: \"grid\", gap: 18, maxWidth: 400 };\nconst sub: CSSProperties = { margin: \"6px 0 0\", color: \"var(--plop-ink-soft)\" };\nconst error: CSSProperties = { margin: \"6px 0 0\", color: \"var(--plop-tomato-text)\", fontSize: 15 };\n"
    }
  ]
}
