import React from "react"; import { cn } from "../lib/cn"; import { Button } from "./Button"; import { AuthInput } from "./AuthInput"; export interface AuthFormProps extends React.HTMLAttributes { /** Form title (e.g. "Sign in") */ title: string; /** Form subtitle/description */ subtitle?: string; /** Button label (e.g. "Sign in", "Create account") */ buttonLabel: string; /** Alternative action text (e.g. "Create an account") */ altAction?: string; /** Alt action link label (e.g. "Sign up") */ altLink?: string; /** Social login providers to show */ socialProviders?: ("google" | "github" | "apple")[]; /** Error message to display at form top */ error?: string; /** Children (form fields) */ children: React.ReactNode; } export const AuthForm = React.forwardRef( ( { title, subtitle, buttonLabel, altAction, altLink, socialProviders, error, className, children, ...props }, ref, ) => { return (
{error && (
{error}
)}

{title}

{subtitle && (

{subtitle}

)}
{socialProviders && socialProviders.length > 0 && (
Or continue with
{socialProviders.map((provider) => ( ))}
)} {children} {altAction && altLink && (

{altAction} {altLink}

)} ); }, ); AuthForm.displayName = "AuthForm";