import { type Dispatch, type RefObject } from 'react'; import { type IntlShape, type MessageDescriptor } from 'react-intl'; import type { Precision, TimeErrorKey } from './shared.types.js'; import { type FormFieldMessagesReducerAction } from '../../forms/forms-core/state/formfield-messages-state-reducer.js'; import { ValidityStateKey } from '../../forms/validation/types.js'; import { type TimeValue } from '../types/time.js'; type TimeBoundaryErrorKey = Extract; type TimeBoundaryMessageValues = { min: string; max: string; term: string; }; type TimeBoundaryMessageData = { errorKey: TimeBoundaryErrorKey; values: TimeBoundaryMessageValues; }; /** @internal */ export type ValidateOptions = { formMessageDispatch?: Dispatch; formerError?: TimeErrorKey; precision?: Precision; showError?: boolean; checkOrder?: boolean; ref?: RefObject; expectedFormat?: string; valueMode?: 'single' | 'timeframeSelector' | 'dateTimePicker'; required?: boolean; /** Optional per-key message overrides. Falls back to built-in defaults for any omitted keys. @internal */ errorMessages?: Partial>; }; /** * Checks if a date is outside the given min and/or max bounds. * @internal */ export declare function isOutOfBounds(date?: string | Date, min?: TimeValue | null, max?: TimeValue | null): TimeErrorKey | undefined; /** * Gets the timeframe boundary message data while hiding default Grail limits * unless the current value actually exceeds the Grail range. * @internal */ export declare function getTimeBoundaryMessageData(value: { from: TimeValue | null; to: TimeValue | null; } | TimeValue | null, min?: TimeValue | string | null, max?: TimeValue | string | null, precision?: Precision, onlyWhenOutOfBounds?: boolean, term?: string): TimeBoundaryMessageData | undefined; /** * Returns the {@link ValidityStateKey} for a {@link TimeErrorKey} for use in * `ValidationState` emitted to consumers. Applies native-key aliases so that * e.g. `singleValueMissing` surfaces as the native `valueMissing` key. * @internal */ export declare function getValidityStateKeyForTimeError(errorKey: TimeErrorKey): ValidityStateKey; export declare function validate(value: { from: TimeValue | null; to: TimeValue | null; } | TimeValue | null, min?: TimeValue | null, max?: TimeValue | null, options?: ValidateOptions): TimeErrorKey | undefined; /** * Formats the human-readable message for a time validation error key. * * Handles interpolation for boundary errors (`{min}`, `{max}`) and format * errors (`{expectedFormat}`). Falls back to the error key string when no * message descriptor is found. * * @internal */ export declare function formatTimeValidationMessage(errorKey: TimeErrorKey, intl: IntlShape, options?: { value?: { from: TimeValue | null; to: TimeValue | null; } | TimeValue | null; min?: TimeValue | null; max?: TimeValue | null; precision?: Precision; expectedFormat?: string; errorMessages?: Partial>; }): string; export {};