import { TextFieldProps } from '../../TextField'; /** * Time format options for the TimeField component. */ export type TimeFormat = 12 | 24; /** * Change event data for TimeField onChange callback. */ export interface TimeFieldChange { /** * The time in HH:mm format (24-hour) or hh:mm a format (12-hour). * @example "14:30" or "02:30 PM" */ time: string | null; /** * Whether the input is valid. That is, it matches the format and is not empty. * This does not mean that the time is valid according to the constraints. */ isInputValid: boolean; /** * Whether the input is empty. */ isInputEmpty: boolean; } /** * Callback function type for TimeField onChange events. */ export type TimeFieldChangeHandler = (change: TimeFieldChange) => void; /** * Props for the TimeField component. * @extends Omit */ export type TimeFieldProps = Omit & { /** * The current value of the time field. * @example "14:30" or "02:30 PM" */ value?: string | null; /** * The default value for uncontrolled mode. * @example "14:30" or "02:30 PM" */ defaultValue?: string | null; /** * Callback when the time value changes. */ onChange?: TimeFieldChangeHandler; /** * Time format to use. * @default 12 */ format?: TimeFormat; /** * Time increment in minutes. * @default 30 */ step?: number; /** * Whether to automatically round to the nearest step. * @default false */ autoround?: boolean; /** * Whether to disable the dropdown suggestions. * @default false */ disableSuggestions?: boolean; } & ({ /** * Minimum allowed time constraint. * @example "09:00 AM" or "09:00" */ min: string; /** * Maximum allowed time constraint. * @example "05:00 PM" or "17:00" */ max: string; } | { min?: never; max?: never; });