{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "ds-signup-form",
  "title": "SignUpForm",
  "description": "Bloco completo de cadastro de novos usuários com medidor de força de senha em tempo real.",
  "dependencies": [
    "class-variance-authority",
    "lucide-react"
  ],
  "registryDependencies": [
    "@lema-ds/ds-social-auth-group",
    "@lema-ds/ds-auth-separator",
    "@lema-ds/ds-password-strength-meter",
    "@lema-ds/input",
    "@lema-ds/button",
    "@lema-ds/checkbox",
    "@lema-ds/label",
    "@lema-ds/ui-i18n",
    "@lema-ds/ds-locale-provider"
  ],
  "files": [
    {
      "path": "components/ds/ds-signup-form.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport {\n  UserIcon,\n  MailIcon,\n  LockIcon,\n  EyeIcon,\n  EyeOffIcon,\n  Loader2Icon,\n  AlertCircleIcon,\n} from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Input } from \"@/components/ui/input\"\nimport { Button } from \"@/components/ui/button\"\nimport { Checkbox } from \"@/components/ui/checkbox\"\nimport { Label } from \"@/components/ui/label\"\nimport { SocialAuthGroup, type SocialProvider } from \"./ds-social-auth-group\"\nimport { AuthSeparator } from \"./ds-auth-separator\"\nimport { PasswordStrengthMeter } from \"./ds-password-strength-meter\"\nimport { UI_I18N, type UILocale } from \"@/lib/ui-i18n\"\nimport { useUILocale } from \"@/components/ui/ds-locale-provider\"\n\n// ── Types ──\n\nexport interface SignUpFormData {\n  name: string\n  email: string\n  password: string\n  terms: boolean\n}\n\nexport interface SignUpFormProps\n  extends\n    Omit<React.HTMLAttributes<HTMLDivElement>, \"onSubmit\">,\n    VariantProps<typeof signUpFormVariants> {\n  onSubmit?: (data: SignUpFormData) => Promise<boolean | void> | void\n  onSocialSignUp?: (provider: SocialProvider) => Promise<void> | void\n  onLogin?: () => void\n  socialProviders?: SocialProvider[]\n  termsUrl?: string\n  privacyUrl?: string\n  loading?: boolean\n  errorMessage?: string\n  locale?: UILocale\n}\n\n// ── Variants ──\n\nexport const signUpFormVariants = cva(\n  \"flex w-full max-w-md flex-col gap-4 rounded-2xl border border-border/80 bg-card p-6 text-card-foreground shadow-lg sm:p-8\",\n  {\n    variants: {\n      variant: {\n        default: \"\",\n        flat: \"border-0 bg-transparent p-0 shadow-none sm:p-0\",\n      },\n    },\n    defaultVariants: {\n      variant: \"default\",\n    },\n  }\n)\n\n// ── Component ──\n\nexport const SignUpForm = React.forwardRef<HTMLDivElement, SignUpFormProps>(\n  (\n    {\n      className,\n      variant = \"default\",\n      onSubmit,\n      onSocialSignUp,\n      onLogin,\n      socialProviders = [\"google\", \"github\", \"govbr\"],\n      termsUrl = \"#\",\n      privacyUrl = \"#\",\n      loading: controlledLoading = false,\n      errorMessage,\n      locale: localeProp,\n      ...props\n    },\n    ref\n  ) => {\n    const locale = useUILocale(localeProp)\n    const [name, setName] = React.useState(\"\")\n    const [email, setEmail] = React.useState(\"\")\n    const [password, setPassword] = React.useState(\"\")\n    const [showPassword, setShowPassword] = React.useState(false)\n    const [terms, setTerms] = React.useState(false)\n    const [internalLoading, setInternalLoading] = React.useState(false)\n    const [loadingProvider, setLoadingProvider] =\n      React.useState<SocialProvider | null>(null)\n\n    const t = UI_I18N[locale]?.auth ?? UI_I18N[\"en-US\"].auth\n    const isLoading = controlledLoading || internalLoading\n\n    const handleSubmit = async (e: React.FormEvent) => {\n      e.preventDefault()\n      if (!name || !email || !password || !terms || isLoading || !onSubmit)\n        return\n\n      try {\n        setInternalLoading(true)\n        await onSubmit({ name, email, password, terms })\n      } finally {\n        setInternalLoading(false)\n      }\n    }\n\n    const handleSocialSelect = async (provider: SocialProvider) => {\n      if (isLoading || loadingProvider || !onSocialSignUp) return\n\n      try {\n        setLoadingProvider(provider)\n        await onSocialSignUp(provider)\n      } finally {\n        setLoadingProvider(null)\n      }\n    }\n\n    return (\n      <div\n        ref={ref}\n        className={cn(signUpFormVariants({ variant }), className)}\n        {...props}\n      >\n        {/* Header */}\n        <div className=\"flex flex-col gap-1.5 text-center sm:text-left\">\n          <h2 className=\"text-2xl font-bold tracking-tight text-foreground\">\n            {t.signUp}\n          </h2>\n          <p className=\"text-xs text-muted-foreground\">\n            Create your account to access the entire ecosystem and integrated\n            services.\n          </p>\n        </div>\n\n        {/* Error Alert */}\n        {errorMessage && (\n          <div\n            role=\"alert\"\n            aria-live=\"assertive\"\n            className=\"flex items-center gap-2 rounded-lg border border-destructive/30 bg-destructive/10 p-3 text-xs text-destructive\"\n          >\n            <AlertCircleIcon className=\"size-4 shrink-0\" aria-hidden=\"true\" />\n            <span>{errorMessage}</span>\n          </div>\n        )}\n\n        {/* Social Sign Up */}\n        {socialProviders.length > 0 && (\n          <SocialAuthGroup\n            providers={socialProviders}\n            layout={socialProviders.length > 2 ? \"grid\" : \"stacked\"}\n            size=\"md\"\n            loadingProvider={loadingProvider}\n            disabled={isLoading}\n            onSelect={handleSocialSelect}\n            locale={locale}\n          />\n        )}\n\n        {/* Separator */}\n        {socialProviders.length > 0 && (\n          <AuthSeparator variant=\"default\">{t.orContinueWith}</AuthSeparator>\n        )}\n\n        {/* Main Form */}\n        <form onSubmit={handleSubmit} className=\"flex flex-col gap-3.5\">\n          <div className=\"flex flex-col gap-1.5\">\n            <Label htmlFor=\"signup-name\" className=\"text-xs font-medium\">\n              {t.name}\n            </Label>\n            <div className=\"relative\">\n              <div className=\"pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3 text-muted-foreground\">\n                <UserIcon className=\"size-4\" aria-hidden=\"true\" />\n              </div>\n              <Input\n                id=\"signup-name\"\n                type=\"text\"\n                required\n                disabled={isLoading}\n                value={name}\n                onChange={(e) => setName(e.target.value)}\n                placeholder={t.namePlaceholder}\n                className=\"h-10 pl-9 text-sm placeholder:text-muted-foreground\"\n              />\n            </div>\n          </div>\n\n          <div className=\"flex flex-col gap-1.5\">\n            <Label htmlFor=\"signup-email\" className=\"text-xs font-medium\">\n              {t.email}\n            </Label>\n            <div className=\"relative\">\n              <div className=\"pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3 text-muted-foreground\">\n                <MailIcon className=\"size-4\" aria-hidden=\"true\" />\n              </div>\n              <Input\n                id=\"signup-email\"\n                type=\"email\"\n                required\n                disabled={isLoading}\n                value={email}\n                onChange={(e) => setEmail(e.target.value)}\n                placeholder={t.emailPlaceholder}\n                className=\"h-10 pl-9 text-sm placeholder:text-muted-foreground\"\n              />\n            </div>\n          </div>\n\n          <div className=\"flex flex-col gap-1.5\">\n            <Label htmlFor=\"signup-password\" className=\"text-xs font-medium\">\n              {t.password}\n            </Label>\n            <div className=\"relative\">\n              <div className=\"pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3 text-muted-foreground\">\n                <LockIcon className=\"size-4\" aria-hidden=\"true\" />\n              </div>\n              <Input\n                id=\"signup-password\"\n                type={showPassword ? \"text\" : \"password\"}\n                required\n                disabled={isLoading}\n                value={password}\n                onChange={(e) => setPassword(e.target.value)}\n                placeholder={t.passwordPlaceholder}\n                className=\"h-10 pr-9 pl-9 text-sm placeholder:text-muted-foreground\"\n              />\n              <button\n                type=\"button\"\n                aria-label={showPassword ? \"Hide password\" : \"Show password\"}\n                onClick={() => setShowPassword(!showPassword)}\n                className=\"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground focus-visible:outline-none\"\n              >\n                {showPassword ? (\n                  <EyeOffIcon className=\"size-4\" aria-hidden=\"true\" />\n                ) : (\n                  <EyeIcon className=\"size-4\" aria-hidden=\"true\" />\n                )}\n              </button>\n            </div>\n\n            {/* Embedded Password Strength Meter */}\n            {password.length > 0 && (\n              <div className=\"pt-1\">\n                <PasswordStrengthMeter\n                  password={password}\n                  size=\"sm\"\n                  locale={locale}\n                />\n              </div>\n            )}\n          </div>\n\n          {/* Terms Checkbox */}\n          <div className=\"flex items-start gap-2 pt-1\">\n            <Checkbox\n              id=\"signup-terms\"\n              checked={terms}\n              onCheckedChange={(checked) => setTerms(!!checked)}\n              className=\"mt-0.5\"\n            />\n            <Label\n              htmlFor=\"signup-terms\"\n              className=\"cursor-pointer text-xs leading-snug font-normal text-muted-foreground\"\n            >\n              {t.termsAgreement}{\" \"}\n              <a\n                href={termsUrl}\n                target=\"_blank\"\n                rel=\"noreferrer\"\n                className=\"font-medium text-foreground underline underline-offset-2 hover:text-primary\"\n              >\n                {t.termsOfService}\n              </a>{\" \"}\n              {t.and}{\" \"}\n              <a\n                href={privacyUrl}\n                target=\"_blank\"\n                rel=\"noreferrer\"\n                className=\"font-medium text-foreground underline underline-offset-2 hover:text-primary\"\n              >\n                {t.privacyPolicy}\n              </a>\n              .\n            </Label>\n          </div>\n\n          <Button\n            type=\"submit\"\n            disabled={!terms || isLoading}\n            className=\"mt-2 h-10 w-full\"\n          >\n            {isLoading && (\n              <Loader2Icon\n                className=\"mr-2 size-4 animate-spin\"\n                aria-hidden=\"true\"\n              />\n            )}\n            {t.createAccount}\n          </Button>\n        </form>\n\n        {/* Footer / Login link */}\n        {onLogin && (\n          <div className=\"flex items-center justify-center gap-1 border-t border-border/50 pt-2 text-xs text-muted-foreground\">\n            <span>{t.alreadyHaveAccount}</span>\n            <button\n              type=\"button\"\n              onClick={onLogin}\n              className=\"font-semibold text-primary hover:underline focus-visible:outline-none\"\n            >\n              {t.login}\n            </button>\n          </div>\n        )}\n      </div>\n    )\n  }\n)\nSignUpForm.displayName = \"SignUpForm\"\n",
      "type": "registry:ui"
    }
  ],
  "type": "registry:ui"
}
