A controlled, presentational React form component for the password reset flow, rendering two password fields, Cancel/Reset actions, and an optional "Back to Login" link. ## Key Components ### `PasswordResetForm` The main exported component. Fully controlled — the consumer owns field state, validation logic, and submission handling. ### `PasswordResetFormProps` TypeScript interface exposing: | Prop | Type | Description | |---|---|---| | `password` / `confirmPassword` | `string` | Controlled field values | | `onPasswordChange` / `onConfirmPasswordChange` | `(value: string) => void` | Field change handlers | | `onSubmit` | `() => void` | Primary submit action | | `onCancel` | `() => void` | Secondary cancel action | | `onBackToLogin` | `() => void` (optional) | Shown on tablet/mobile only; desktop uses shell footer | | `submitDisabled` | `boolean` | Disables submit without locking fields | | `loading` / `disabled` | `boolean` | Full form lockout states | | `errors` | `{ password?, confirmPassword? }` | Validation messages (deferred via `useDeferredError`) | All labels and placeholders are overridable via dedicated string props. ### `useDeferredError` Hook used internally to delay validation message display until blur or a pause in typing, reducing noise during active input. ## Usage Example ```typescript import { PasswordResetForm } from './password-reset-form' import { useState } from 'react' function ResetPage() { const [password, setPassword] = useState('') const [confirmPassword, setConfirmPassword] = useState('') const errors = { confirmPassword: password !== confirmPassword ? 'Passwords do not match' : undefined, } return ( console.log('Submitting reset')} onCancel={() => console.log('Cancelled')} onBackToLogin={() => console.log('Back to login')} errors={errors} submitDisabled={password !== confirmPassword} /> ) } ```