import { type HTMLAttributes, type ReactNode } from 'react'; import type { BrandMarkMotion } from '../_shared/brand-mark'; /** The form's two fields. */ export declare const RESET_PASSWORD_FORM_FIELDS: readonly ["password", "passwordConfirm"]; export type ResetPasswordFormField = (typeof RESET_PASSWORD_FORM_FIELDS)[number]; /** What the card shows: the form, the result after a good change, or the * result for a link that no longer works. */ export type ResetPasswordFormState = 'form' | 'done' | 'expired'; /** What `onSubmit` receives once both passwords have passed their checks. */ export interface ResetPasswordFormValues { password: string; passwordConfirm: string; } /** Messages from the server, already translated: one for each field, plus * `form` for a message about the whole form. */ export type ResetPasswordFormErrors = Partial>; /** The host's own form field names, for a native form post. They are * needed: a field without a name is not posted. */ export type ResetPasswordFormFieldNames = Record; export interface ResetPasswordFormProps extends Omit, 'title' | 'onSubmit'> { /** * What the card shows. Default `form`. `done` and `expired` replace the * form and take focus when they appear. */ state?: ResetPasswordFormState; /** Replaces the form's heading "Choose a new password". Pass it * translated. The result states have their own heading. */ title?: string; /** Replaces the line under the form's heading ("Enter a new password * for your account."). Pass it translated. */ description?: string; /** * The heading's level. Default 1: this page usually has no other * heading. Pass 2 on a page that has its own `h1`. */ headingLevel?: 1 | 2 | 3; /** Shows the Alfadocs mark above the heading. Default true. */ showLogo?: boolean; /** How the mark arrives when the card opens. Default `assemble`. */ logoMotion?: BrandMarkMotion; /** * Host content between the heading and the fields, such as a notice. It * sits outside the form, so nothing in it is posted. */ children?: ReactNode; /** * The address the password is for. In the form it shows read-only, and * is the username a password manager saves the new password under. In * the `done` state it is named in the line under the result. */ email?: string; /** * The `done` state's action, "Sign in". A path on the same site, or an * address written in full. Anything else shows no button. */ loginHref?: string; /** * The `expired` state's action, "Ask for a new link". A path on the * same site, or an address written in full. Anything else shows no * button. */ requestHref?: string; /** * Messages from the server, already translated. A field's message shows * on the field until the user changes it; `form` shows above the * fields. When messages arrive, focus moves to the error summary when a * field has one, or to the message above the fields when only that * says something. Passwords the server refused are emptied. */ errors?: ResetPasswordFormErrors; /** Replaces the button's "Change password". Pass it translated. */ submitLabel?: string; /** * True while the host sends the passwords: the button shows a spinner * and a second submit is ignored. Set it inside `onSubmit`, before * anything is awaited. */ submitting?: boolean; /** For React hosts: called with both passwords once they have passed * their checks. Not called when `fieldNames` is set. */ onSubmit?: (values: ResetPasswordFormValues) => void; /** * For a native form post: the host's own field names, e.g. * `{ password: 'lost_password_reset[password1]', passwordConfirm: * 'lost_password_reset[password2]' }`. When set, the inputs carry those * names and the browser posts the form. */ fieldNames?: ResetPasswordFormFieldNames; /** * Where a native form post goes. Default: the current address. Only a * path, or an address on the page's own origin, is accepted: another * origin is never sent what the user typed. Does nothing without * `fieldNames`. */ action?: string; /** * Extra hidden inputs posted with a native form, by name: a CSRF token, * e.g. `{ 'lost_password_reset[_token]': token }`. Not used with * `onSubmit`. A name that is also in `fieldNames` is left out. */ hiddenFields?: Readonly>; } /** * The card for the page the reset email opens. Mount it on the * reset-password page, inside `SignedOutFrame` or the host's own chrome. */ export declare const ResetPasswordForm: import("react").ForwardRefExoticComponent>; //# sourceMappingURL=reset-password-form.d.ts.map