Skip to content
Block

Password login form

An email and password login form. The stage draws cover art by default; the picture and headline are yours to change.

  • #arc
  • #block
  • #login
  • #sign-in
  • #password
  • #email
  • #form
  • #auth
  • #validation

Install

One command installs the files and packages this item needs.

Terminalbash
npx shadcn@latest add https://dsui.vercel.app/r/login-password.json

login-password.module.csscss
/* Same card, spacing, and control heights as the sign in family, so login and signup read as one flow. */
.block { container: login / inline-size; width: min(100%, 432px); min-width: 0; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-surface); background: var(--surface); color: var(--foreground); font-family: var(--font-body); letter-spacing: var(--tracking-body); }
/* The page-top illustration runs edge to edge across the card top. */
.illustration { display: block; width: 100%; }
.layout { min-width: 0; }
.main { min-width: 0; }
.viewport { position: relative; overflow: hidden; }
.step { display: grid; min-width: 0; padding: var(--space-8); }

.heading { display: grid; gap: var(--space-2); margin-bottom: var(--space-6); }
.heading h2 { margin: 0; font-family: var(--font-display); font-size: var(--text-3xl); font-weight: 400; letter-spacing: var(--tracking-display); line-height: var(--leading-display); text-wrap: balance; outline: none; }
.heading p { margin: 0; color: var(--text-secondary); font-size: var(--text-sm); line-height: var(--leading-body); text-wrap: pretty; }
.address { color: var(--foreground); overflow-wrap: anywhere; }

.sso { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-2); }
.sso .ssoButton { min-width: 0; padding-inline: var(--space-2); }
.providerMark { flex: none; }
.divider { display: flex; align-items: center; gap: var(--space-3); margin: var(--space-5) 0; color: var(--text-muted); font-size: var(--text-xs); line-height: 1; }
.divider::before, .divider::after { flex: 1; height: 1px; background: var(--border); content: ""; }

.form { display: grid; gap: var(--space-4); }
.wide { width: 100%; }
.passwordGroup { display: grid; min-width: 0; }
.fieldError { margin: var(--space-2) 0 0; color: var(--danger); font-size: var(--text-xs); line-height: var(--leading-body); }

/* The checkbox keeps a full size hit area; pull it out so the square lines up with the fields. */
.options { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-1) var(--space-4); margin: calc(var(--space-2) * -1) 0 calc(var(--space-2) * -1) calc((var(--control-height-md) - 18px) / -2); }
.options .textButton { margin-inline-start: auto; padding-inline-start: var(--space-2); font-size: var(--text-xs); }
.row { overflow: hidden; }
.submitError { margin: 0; color: var(--danger); font-size: var(--text-xs); line-height: var(--leading-body); }
.textButton { border: 0; padding: 0; background: none; color: var(--text-secondary); font: inherit; text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; cursor: pointer; transition: color var(--duration-fast) var(--ease-standard), text-decoration-color var(--duration-fast) var(--ease-standard); }

.success { display: block; width: 48px; height: 48px; margin-bottom: var(--space-6); overflow: visible; color: var(--success); }
.details { display: grid; margin: 0 0 var(--space-6); border-top: 1px solid var(--border); padding: 0; }
.details div { display: flex; justify-content: space-between; gap: var(--space-4); border-bottom: 1px solid var(--border); padding: var(--space-3) 0; font-size: var(--text-sm); line-height: var(--leading-body); }
.details dt { color: var(--text-secondary); }
.details dd { margin: 0; text-align: right; }

.footer { display: flex; min-height: 48px; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-1) var(--space-4); border-top: 1px solid var(--border); padding: var(--space-3) var(--space-8); color: var(--text-muted); font-size: var(--text-xs); line-height: var(--leading-body); }
.status { position: relative; display: block; min-width: 0; flex: 1 1 12rem; }
.status > span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switch { color: var(--text-secondary); white-space: nowrap; }
.switch .textButton { color: var(--foreground); font-weight: 500; text-decoration-color: transparent; }
.srOnly { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (hover: hover) and (pointer: fine) {
  .textButton:hover { color: var(--foreground); text-decoration-color: currentColor; }
}
@container login (max-width: 380px) {
  .step { padding: var(--space-6) var(--space-5); }
  .heading h2 { font-size: var(--text-2xl); }
  .sso .ssoButton { gap: 6px; font-size: var(--text-xs); }
  .footer { padding-inline: var(--space-5); }
}
@media (max-width: 480px) { .block { border-radius: var(--radius-panel); } }
@media (prefers-reduced-motion: reduce) { .textButton { transition: none; } }
/* Press feedback: the same answer the hover gives, so touch and mouse both respond. */
.textButton:active { color: var(--accent-strong); text-decoration-color: currentColor; }

/* Split: a blue stage with the design and code artwork beside the form (above it when the block is narrow). */
.block[data-variant="split"] { width: min(100%, 64rem); }
.stage { position: relative; display: flex; min-height: 18rem; flex-direction: column; justify-content: space-between; gap: var(--space-4); overflow: hidden; padding: var(--space-8) var(--space-6); background: var(--accent); color: #fff; isolation: isolate; border-radius: 0 0 var(--radius-surface) var(--radius-surface); }
.grid { position: absolute; inset: 0; z-index: -1; background-image: radial-gradient(rgb(255 255 255 / .28) 1.2px, transparent 1.6px); background-size: 22px 22px; mask-image: radial-gradient(120% 90% at 50% 40%, #000 30%, transparent 85%); -webkit-mask-image: radial-gradient(120% 90% at 50% 40%, #000 30%, transparent 85%); animation: gridDrift 18s linear infinite; }
.compose { position: relative; width: min(100%, 26rem); margin-inline: auto; }
.art { display: block; width: 100%; height: auto; overflow: visible; animation: artIn 900ms var(--ease-spring) 200ms backwards, float 7s ease-in-out 1.6s infinite; }
.tagline { margin: 0; font-size: clamp(1.9rem, 6.5cqi, 2.6rem); font-weight: 300; line-height: 1.12; letter-spacing: -0.02em; word-break: keep-all; }
.tagline strong { font-weight: 900; }
.line { display: block; }
.word { display: inline-block; margin-inline-end: .28em; animation: rise 800ms var(--ease-spring) calc(500ms + var(--w) * 90ms) backwards; }
/* The headline reads on the accent ground in every theme: its second line takes the accent's own foreground, and the first is the same colour a little softer. */
.tagline { color: var(--accent-foreground, #fff); }
.line:nth-child(1) .word { opacity: .82; }

@container login (min-width: 44rem) {
  .block[data-variant="split"] .layout { display: grid; grid-template-columns: 1.15fr 1fr; }
  .block[data-variant="split"] .stage { min-height: 32rem; padding: var(--space-10); border-radius: var(--radius-surface); }
  .block[data-variant="split"] .compose { width: 100%; margin-block: auto; }
  .block[data-variant="split"] .tagline { font-size: clamp(2.2rem, 4.5cqi, 3rem); }
  .block[data-variant="split"] .main { display: flex; flex-direction: column; justify-content: center; }
}

@keyframes rise { from { opacity: 0; transform: translateY(14px); filter: blur(6px); } }
@keyframes float { 50% { transform: translateY(-7px); } }
@keyframes artIn { from { opacity: 0; transform: scale(.92); } }
@keyframes gridDrift { to { background-position: 22px 22px; } }
@media (prefers-reduced-motion: reduce) { .grid, .art, .word { animation: none; } }
login-password.tsxtsx
"use client";

import { useEffect, useId, useMemo, useRef, useState, type CSSProperties, type FormEvent, type ReactNode } from "react";
import { AnimatePresence, motion, type Transition } from "motion/react";
import { useReducedMotion } from "../../lib/use-reduced-motion";
import { Button } from "../../button/button";
import { Checkbox } from "../../checkbox/checkbox";
import { Illustration } from "../../illustration/illustration";
import { Input } from "../../input/input";
import { PasswordField } from "../../password-field/password-field";
import { compose, sceneMarkup, type ComposeInput, type Scene } from "../../lib/cover-scene";
import { motionTokens } from "../../lib/motion-tokens";
import { useDecor, useThemeAssets } from "../../theme/provider";
import { useDecorEnabled } from "../../decor/use-decor-enabled";
import { playUiSound } from "../../sound/play";
import styles from "./login-password.module.css";

export interface LoginDetails {
  email: string;
  password: string;
  remember: boolean;
}

type Provider = "Google" | "Apple" | "GitHub";

export interface LoginPasswordProps {
  /** "split" puts a blue stage with the design and code artwork beside the form (above it on a narrow container); "card" is the form alone under the login illustration. Default "split". */
  variant?: "split" | "card";
  /** The stage's picture. Pass your own node to replace the generated cover art entirely, or `false` for no picture. */
  art?: ReactNode;
  /** Steers the generated cover art: a `concept` (shapes), `mood` (palette), `seed` (another take) and `layout`, or a whole scene you edited by hand (see the cover-art skill). */
  cover?: ComposeInput | Scene;
  /** The stage's headline. A list of strings is one line each (the second is the highlight colour, and words animate in); any other node is shown as it is. */
  tagline?: ReactNode | readonly string[];
  /** Words of a string-list tagline that stay heavy; the rest is light. */
  taglineStrong?: readonly string[];
  /** Receives the details once both fields are valid. Throw to show a submit error. */
  onSubmit?: (details: LoginDetails) => void | Promise<void>;
  /** An error from your API, shown above the submit button. */
  serverError?: string | null;
  /** Show the single sign-on buttons above the form. Default true. */
  showProviders?: boolean;
  /** Called when someone picks a single sign-on provider. The preview simulates the redirect. */
  onProvider?: (provider: Provider) => void;
  /** Called from the "forgot password" link. Without it the link only announces itself. */
  onForgotPassword?: () => void;
  /** Called from the "sign up" link in the footer. Without it the link only announces itself. */
  onSignUp?: () => void;
}

type Field = "email" | "password";
type Step = "form" | "done";

const providers: Provider[] = ["Google", "Apple", "GitHub"];
/** The official four-colour Google "G"; Apple and GitHub ship monochrome marks, drawn in currentColor. */
function GoogleLogo() {
  return <svg className={styles.providerMark} width="16" height="16" viewBox="0 0 24 24" aria-hidden="true">
    <path fill="#4285F4" d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z" />
    <path fill="#34A853" d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z" />
    <path fill="#FBBC05" d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z" />
    <path fill="#EA4335" d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z" />
  </svg>;
}
const monoMarks: Record<Exclude<Provider, "Google">, string> = {
  Apple: "M12.152 6.896c-.948 0-2.415-1.078-3.96-1.04-2.04.027-3.91 1.183-4.961 3.014-2.117 3.675-.546 9.103 1.519 12.09 1.013 1.454 2.208 3.09 3.792 3.039 1.52-.065 2.09-.987 3.935-.987 1.831 0 2.35.987 3.96.948 1.637-.026 2.676-1.48 3.676-2.948 1.156-1.688 1.636-3.325 1.662-3.415-.039-.013-3.182-1.221-3.22-4.857-.026-3.04 2.48-4.494 2.597-4.559-1.429-2.09-3.623-2.324-4.39-2.376-2-.156-3.675 1.09-4.61 1.09zM15.53 3.83c.843-1.012 1.4-2.427 1.245-3.83-1.207.052-2.662.805-3.532 1.818-.78.896-1.454 2.338-1.273 3.714 1.338.104 2.715-.688 3.559-1.701",
  GitHub: "M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12",
};

function getErrors(email: string, password: string) {
  return {
    email: !/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(email.trim()) ? "name@example.com 같은 전체 주소를 입력해 주세요." : "",
    password: password ? "" : "비밀번호를 입력해 주세요.",
  };
}

/** The form and the confirmation cross over in place, out of a small blur. */
const stepMotion = (reduce: boolean) => ({
  initial: reduce ? { opacity: 0 } : { opacity: 0, y: 8, filter: `blur(${motionTokens.blur.soft}px)` },
  animate: { opacity: 1, y: 0, filter: "blur(0px)" },
  exit: reduce ? { opacity: 0, transition: { duration: 0 } } : { opacity: 0, y: -6, filter: `blur(${motionTokens.blur.subtle}px)`, transition: { duration: motionTokens.duration.exit } },
  transition: (reduce ? { duration: motionTokens.duration.instant } : { duration: motionTokens.duration.standard, ease: motionTokens.ease.enter }) as Transition,
});

/** The cover art `LoginPassword` draws when you give it nothing: a lock-and-shield flavoured scene in a calm palette. */
const defaultCover: ComposeInput = { title: "login", tags: ["auth", "security"], concept: "safety", mood: "calm", layout: "duo", seed: "login" };

/** The scene's fixed yellow and blue follow the theme's `--highlight` and `--accent`, so a season theme recolours the picture. */
function themedMarkup(scene: Scene): string {
  return sceneMarkup(scene)
    .replace(/^<rect width="\d+" height="\d+" fill="[^"]*"\/>/, "")
    .replaceAll("#FBBF24", "var(--highlight, #FBBF24)")
    .replaceAll("#2563EB", "var(--accent, #2563EB)");
}

/**
 * The season layer: a season theme's own particle shape (a bat, a snowflake, a leaf ...) drawn big and small around the picture, so a
 * season theme changes what the stage shows and not only its colours. Positions are fixed, so the server and the browser agree.
 */
const SEASON_SLOTS = [
  { x: 506, y: 92, size: 150, r: 14, o: 1, tone: "highlight" },
  { x: 84, y: 306, size: 78, r: -18, o: 0.95, tone: "light" },
  { x: 548, y: 318, size: 54, r: 20, o: 0.9, tone: "highlight" },
  { x: 66, y: 88, size: 46, r: 10, o: 0.85, tone: "light" },
  { x: 300, y: 40, size: 36, r: -8, o: 0.75, tone: "highlight" },
  { x: 318, y: 366, size: 32, r: 25, o: 0.7, tone: "light" },
] as const;

function seasonMarkup(glyph: string, filled: boolean): string {
  return SEASON_SLOTS.map(({ x, y, size, r, o, tone }) => {
    const color = tone === "highlight" ? "var(--highlight, #FBBF24)" : "var(--accent-foreground, #fff)";
    const paint = filled ? `fill="${color}"` : `fill="none" stroke="${color}" stroke-width="2" stroke-linejoin="round" stroke-linecap="round"`;
    return `<g transform="translate(${x} ${y}) rotate(${r}) scale(${size / 24}) translate(-12 -12)" opacity="${o}"><path d="${glyph}" ${paint}/></g>`;
  }).join("");
}

function isScene(value: ComposeInput | Scene): value is Scene {
  return Array.isArray((value as Scene).items);
}

/**
 * The stage of the split layout: a blue ground with a cover-art picture in the middle and a headline under it.
 * The picture is generated from `cover` (or your own `art`); everything is decorative SVG and CSS and still under prefers-reduced-motion.
 */
function LoginStage({ art, cover, tagline, strong }: { art: ReactNode; cover: ComposeInput | Scene | undefined; tagline: ReactNode | readonly string[]; strong: readonly string[] }) {
  const themeCover = useThemeAssets().cover;
  const particles = useDecor()?.particles;
  const season = useDecorEnabled() && particles ? { glyph: particles.glyph, filled: !!particles.fill } : null;
  const glyph = season?.glyph;
  const filled = season?.filled ?? false;
  const markup = useMemo(() => {
    if (art !== undefined) return null;
    const scene = cover && isScene(cover) ? cover : compose({ ...defaultCover, ...themeCover, ...cover, tone: "blue" });
    return `${glyph ? seasonMarkup(glyph, filled) : ""}${themedMarkup({ ...scene, tone: "blue" })}`;
  }, [art, cover, themeCover, glyph, filled]);
  const lines = Array.isArray(tagline) ? (tagline as readonly string[]) : null;
  return (
    <div className={styles.stage}>
      <div className={styles.grid} aria-hidden="true" />
      {art !== false && (
        <div className={styles.compose} aria-hidden="true">
          {markup !== null ? <svg viewBox="0 0 600 400" className={styles.art} focusable="false" dangerouslySetInnerHTML={{ __html: markup }} /> : art}
        </div>
      )}
      <p className={styles.tagline}>
        {lines ? lines.map((line, row) => (
          <span key={line} className={styles.line}>
            {line.split(" ").map((word, i) => {
              const key = strong.find(k => word.startsWith(k));
              return <span key={i} className={styles.word} style={{ "--w": row * 3 + i } as CSSProperties}>{key ? <><strong>{key}</strong>{word.slice(key.length)}</> : word}</span>;
            })}
          </span>
        )) : (tagline as ReactNode)}
      </p>
    </div>
  );
}

export function LoginPassword({ variant = "split", art, cover, tagline = ["다시 만나서", "반가워요"], taglineStrong = ["반가워요"], onSubmit, serverError, showProviders = true, onProvider, onForgotPassword, onSignUp }: LoginPasswordProps) {
  const reduce = !!useReducedMotion();
  const passwordErrorId = useId();
  const emailRef = useRef<HTMLInputElement>(null);
  const passwordRef = useRef<HTMLInputElement>(null);
  const doneRef = useRef<HTMLHeadingElement>(null);
  const timers = useRef<number[]>([]);
  const [step, setStep] = useState<Step>("form");
  const [email, setEmail] = useState("");
  const [password, setPassword] = useState("");
  const [remember, setRemember] = useState(true);
  const [touched, setTouched] = useState<Record<Field, boolean>>({ email: false, password: false });
  const [submitted, setSubmitted] = useState(false);
  const [busy, setBusy] = useState<null | "form" | Provider>(null);
  const [method, setMethod] = useState<"이메일" | Provider>("이메일");
  const [submitError, setSubmitError] = useState("");
  const [status, setStatus] = useState("");
  const errors = getErrors(email, password);
  const visibleError = (field: Field) => (touched[field] || submitted ? errors[field] : "");
  const shownError = submitError || serverError || "";
  const passwordError = visibleError("password");

  useEffect(() => { const pending = timers.current; return () => pending.forEach(window.clearTimeout); }, []);
  useEffect(() => { if (step === "done") doneRef.current?.focus(); }, [step]);

  function markTouched(field: Field) {
    setTouched(current => ({ ...current, [field]: true }));
  }

  function finish(how: "이메일" | Provider) {
    setBusy(null);
    setMethod(how);
    setStep("done");
    playUiSound("success");
    setStatus(`${how}로 로그인했어요`);
  }

  async function submit(event: FormEvent<HTMLFormElement>) {
    event.preventDefault();
    if (busy) return;
    setSubmitted(true);
    setSubmitError("");
    const next = getErrors(email, password);
    const firstInvalid = (Object.keys(next) as Field[]).find(field => next[field]);
    if (firstInvalid) {
      ({ email: emailRef, password: passwordRef })[firstInvalid].current?.focus();
      return;
    }
    setBusy("form");
    setStatus("로그인하는 중이에요");
    try {
      await Promise.all([onSubmit?.({ email: email.trim(), password, remember }), new Promise(resolve => window.setTimeout(resolve, 700))]);
      finish("이메일");
    } catch (error) {
      setBusy(null);
      setSubmitError(error instanceof Error && error.message ? error.message : "로그인하지 못했어요. 이메일과 비밀번호를 확인한 뒤 다시 시도해 주세요.");
      playUiSound("error");
      setStatus("로그인하지 못했어요");
    }
  }

  function continueWith(provider: Provider) {
    if (busy) return;
    setBusy(provider);
    setStatus(`${provider} 로그인 창을 여는 중이에요`);
    onProvider?.(provider);
    timers.current.push(window.setTimeout(() => {
      if (!email.trim()) setEmail("seoyeon@hanul.studio");
      finish(provider);
    }, 900));
  }

  function reset() {
    setPassword("");
    setTouched({ email: false, password: false });
    setSubmitted(false);
    setSubmitError("");
    setStep("form");
    setStatus("다시 로그인해요");
    timers.current.push(window.setTimeout(() => passwordRef.current?.focus(), 60));
  }

  return (
    <section className={styles.block} data-variant={variant} aria-label="devs7udio 로그인">
      <div className={styles.layout}>
      {variant === "split" ? <LoginStage art={art} cover={cover} tagline={tagline} strong={taglineStrong} /> : <Illustration name="page-login" animated className={styles.illustration} />}
      <div className={styles.main}>
      <div className={styles.viewport}>
        <AnimatePresence mode="popLayout" initial={false}>
          {step === "form" ? (
            <motion.div key="form" className={styles.step} {...stepMotion(reduce)}>
              <div className={styles.heading}><h2>로그인</h2><p>이메일과 비밀번호로 이어서 시작해요.</p></div>
              {showProviders && <>
                <div className={styles.sso} role="group" aria-label="간편 로그인">
                  {providers.map(provider => <Button key={provider} type="button" variant="secondary" className={styles.ssoButton} aria-label={`${provider}로 로그인하기`} loading={busy === provider} aria-disabled={(!!busy && busy !== provider) || undefined} onClick={() => continueWith(provider)}>
                    {provider === "Google" ? <GoogleLogo /> : <svg className={styles.providerMark} width="16" height="16" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d={monoMarks[provider]} /></svg>}{provider}
                  </Button>)}
                </div>
                <div className={styles.divider}>또는</div>
              </>}
              <form onSubmit={event => void submit(event)} noValidate className={styles.form}>
                <Input ref={emailRef} label="이메일" name="email" type="email" inputMode="email" autoComplete="username" autoCapitalize="none" spellCheck={false} placeholder="name@example.com" value={email} onChange={event => setEmail(event.target.value)} onBlur={() => { if (email) markTouched("email"); }} error={visibleError("email")} readOnly={!!busy} />
                <div className={styles.passwordGroup}>
                  <PasswordField ref={passwordRef} label="비밀번호" name="password" autoComplete="current-password" value={password} onChange={event => setPassword(event.target.value)} onBlur={() => { if (password) markTouched("password"); }} aria-invalid={passwordError ? true : undefined} aria-describedby={passwordError ? passwordErrorId : undefined} readOnly={!!busy} />
                  {passwordError && <p id={passwordErrorId} className={styles.fieldError} role="alert">{passwordError}</p>}
                </div>
                <div className={styles.options}>
                  <Checkbox label="로그인 상태 유지" checked={remember} onCheckedChange={checked => setRemember(checked === true)} disabled={!!busy} />
                  <button type="button" className={styles.textButton} onClick={() => { setStatus("비밀번호 재설정은 앱에서 열려요"); onForgotPassword?.(); }}>비밀번호를 잊었어요</button>
                </div>
                <AnimatePresence initial={false}>
                  {shownError && <motion.div key="error" className={styles.row} initial={{ height: 0, opacity: 0 }} animate={{ height: "auto", opacity: 1 }} exit={{ height: 0, opacity: 0 }} transition={reduce ? { duration: 0 } : { height: motionTokens.spring.smooth, opacity: { duration: motionTokens.duration.fast } }}>
                    <p className={styles.submitError} role="alert">{shownError}</p>
                  </motion.div>}
                </AnimatePresence>
                <Button className={styles.wide} type="submit" loading={busy === "form"}>로그인하기</Button>
              </form>
            </motion.div>
          ) : (
            <motion.div key="done" className={styles.step} {...stepMotion(reduce)}>
              <svg className={styles.success} viewBox="0 0 48 48" aria-hidden="true">
                <g transform="rotate(-90 24 24)"><motion.circle cx="24" cy="24" r="22.25" fill="none" stroke="currentColor" strokeWidth="1.5" initial={reduce ? false : { pathLength: 0, opacity: 0 }} animate={{ pathLength: 1, opacity: 1 }} transition={{ pathLength: { duration: motionTokens.duration.considered, ease: motionTokens.ease.inOut, delay: motionTokens.duration.fast }, opacity: { duration: motionTokens.duration.instant, delay: motionTokens.duration.fast } }} /></g>
                <motion.path d="M15.5 24.5l5.5 5.5 11.5-12" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" initial={reduce ? false : { pathLength: 0, opacity: 0 }} animate={{ pathLength: 1, opacity: 1 }} transition={{ pathLength: { duration: motionTokens.duration.standard + .08, ease: motionTokens.ease.enter, delay: .5 }, opacity: { duration: motionTokens.duration.instant, delay: .5 } }} />
              </svg>
              <div className={styles.heading}><h2 ref={doneRef} tabIndex={-1}>다시 만나서 반가워요</h2><p><span className={styles.address}>{email.trim()}</span> 계정으로 로그인했어요.</p></div>
              <dl className={styles.details}>
                <div><dt>로그인 방법</dt><dd>{method}</dd></div>
                <div><dt>로그인 상태</dt><dd>{remember ? "유지해요" : "유지하지 않아요"}</dd></div>
              </dl>
              <Button type="button" variant="secondary" className={styles.wide} onClick={reset}>다시 로그인하기</Button>
            </motion.div>
          )}
        </AnimatePresence>
      </div>

      <footer className={styles.footer}>
        <p className={styles.srOnly} role="status" aria-live="polite">{status}</p>
        <span className={styles.status} aria-hidden="true"><AnimatePresence mode="popLayout" initial={false}><motion.span key={status} {...stepMotion(reduce)}>{status}</motion.span></AnimatePresence></span>
        <span className={styles.switch}>계정이 없나요? <button type="button" className={styles.textButton} onClick={() => { setStatus("가입은 앱에서 열려요"); onSignUp?.(); }}>가입하기</button></span>
      </footer>
      </div>
      </div>
    </section>
  );
}

export default LoginPassword;

Used items