import { AriaAttributes, type RefObject, type FormEvent as ReactFormEvent, type ChangeEvent, type FocusEvent } from 'react'; import { type IntlShape } from 'react-intl'; import { AriaLabelingProps } from '../../../core/types/a11y-props.js'; import type { ValidationState, ValidationTrigger } from '../../validation/types.js'; type FormFieldElement = HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement; /** * Getter function to read the error type form the validity state. * The validity state values are readonly and can't therefore not be iterated but need to accessed directly instead. * https://stackoverflow.com/questions/20891950/html-validation-api-returns-an-empty-object-in-firefox?rq=2 * @internal */ export declare function getErrorType(validityState?: ValidityState): "valueMissing" | "typeMismatch" | "patternMismatch" | "tooLong" | "tooShort" | "rangeUnderflow" | "rangeOverflow" | "stepMismatch" | "badInput" | null; /** * Internal getter function to return the matching formatted message for * each validityStateKey. * @internal */ export declare function getI18nErrorMessage(key: keyof ValidityState, ref?: FormFieldElement | null): import("react/jsx-runtime").JSX.Element | null; /** * Returns the translated plain-string validation message for a given validity * state key. Mirrors the JSX messages in {@link getI18nErrorMessage} using the * same descriptors so both the UI and `ValidationError.message` stay in sync. * * @internal */ export declare function getI18nValidationMessage(intl: IntlShape, key: keyof ValidityState, ref?: FormFieldElement | null): string; /** * Builds a ValidationState with an i18n message for the current validity of * `element`, bypassing the corrupted `element.validationMessage` that * `setCustomValidity` produces. * @internal */ export declare function getI18nValidationState(intl: IntlShape, element: FormFieldElement | null | undefined, trigger: ValidationTrigger): ValidationState; /** @internal */ interface FormFieldValidationProps { ariaProps: Pick; onInvalid: (event: ReactFormEvent) => void; onChange: (event?: ChangeEvent) => void; onBlur: (event?: FocusEvent) => void; } /** * Hook to generate ARIA props based on the form field messages * @param ariaLabelingProps - ARIA labeling properties * @returns ARIA props for the form field * @internal */ export declare function useFormFieldValidationAriaProps(ariaLabelingProps?: AriaLabelingProps): { 'aria-describedby': string | undefined; "aria-errormessage"?: string | undefined | undefined; "aria-invalid"?: boolean | "false" | "true" | "grammar" | "spelling" | undefined | undefined; 'aria-label'?: string; 'aria-labelledby'?: string; 'aria-details'?: string; }; /** * @param ref - Reference to the input element * @param validationDeps - Values that trigger re-validation when changed (e.g., [required, min, max, pattern]). * @param ariaLabelingProps - ARIA labeling properties * @param controlId - Optional control ID for message management * @internal */ export declare function useFormFieldValidation(ref: RefObject, validationDeps?: Record, ariaLabelingProps?: AriaLabelingProps, controlId?: string, emitValidationStateProp?: (state: ValidationState) => void): FormFieldValidationProps; export declare function getCombinedAriaProps(validationAriaProps: Pick, labelingProps: AriaLabelingProps): { 'aria-describedby': string | undefined; "aria-errormessage"?: string | undefined | undefined; "aria-invalid"?: boolean | "false" | "true" | "grammar" | "spelling" | undefined | undefined; 'aria-label'?: string; 'aria-labelledby'?: string; 'aria-details'?: string; }; export {};