import { type RefObject } from 'react'; import type { AlertAnnounce } from '../../components/alert'; export interface UseErrorSummaryReturn { /** The fields the summary lists now, in the form's order. */ listed: readonly Field[]; /** True while the summary lists the field: its own message then stays * quiet (FormField's `announceError`). */ lists: (field: Field) => boolean; /** * Lists every field in error after this render and moves focus to the * summary. When no field has a message, calls `fallback` instead (a * message about the whole form, say). */ open: (fallback?: () => void) => void; /** For the `ErrorSummary`. */ ref: RefObject; } /** * @param order the fields the form shows, in order. * @param messageFor the message a field shows in this render, if any. * @param openAtMount open at once: the form arrived with messages from * the server (a page it rendered after a failed post). */ export declare function useErrorSummary(order: readonly Field[], messageFor: (field: Field) => string | undefined, openAtMount?: boolean): UseErrorSummaryReturn; /** * How the message about the whole form is announced, beside the summary. * While the summary lists a field it takes focus and reads that message * too (its `aria-describedby`), so an alert as well would be read over it: * the message stays quiet. It stays quiet until its text changes, because * a role="alert" added to text already on screen can be read out of turn. * Otherwise the Alert's own default applies. */ export declare function useFormMessageAnnounce(message: string | undefined, summaryOpen: boolean): AlertAnnounce | undefined; //# sourceMappingURL=use-error-summary.d.ts.map