import React from 'react'; import { type IsoTime } from './iso-time.js'; export type TimeFieldSize = 'sm' | 'md' | 'lg'; /** The smallest unit the field edits. */ export type TimeFieldGranularity = 'hour' | 'minute' | 'second'; export interface TimeFieldProps { /** Field label. Required for a usable control — see `a11y.requires`. */ label?: React.ReactNode; /** Names the field when there is no visible `label`. */ 'aria-label'?: string; /** Helper text below the field — "In the workspace's timezone". */ description?: React.ReactNode; /** Replaces the helper text while the field is invalid — `isInvalid`, or its own bounds check. */ errorMessage?: React.ReactNode; isInvalid?: boolean; isDisabled?: boolean; isReadOnly?: boolean; isRequired?: boolean; /** Matches Input's `Size` variant: Small, Medium, Large. */ size?: TimeFieldSize; /** * The time as `HH:MM` (or `HH:MM:SS`), 24-hour, whatever the reader sees. * `null` means no time is chosen. A wall-clock reading — no date, no * timezone. A malformed value throws rather than rendering an empty field. */ value?: IsoTime | null; /** The initial time, for an uncontrolled field. */ defaultValue?: IsoTime; /** Fires with `HH:MM` (`HH:MM:SS` at second granularity), or `null` when cleared. */ onChange?: (value: IsoTime | null) => void; /** Earliest allowed time, `HH:MM`. Later is not wrapped past midnight. */ minValue?: IsoTime; /** Latest allowed time, `HH:MM`. */ maxValue?: IsoTime; /** Defaults to `minute`. `second` adds a seconds segment and value. */ granularity?: TimeFieldGranularity; /** * 12 or 24-hour display. Leave it out: the reader's locale already knows, * and forcing 12-hour on a 24-hour reader is the misreading this field * exists to prevent. The value is 24-hour either way. */ hourCycle?: 12 | 24; /** Posts the value under this name, for an uncontrolled form. */ name?: string; className?: string; wrapperClassName?: string; id?: string; } /** * TimeField — a time of day, typed into segments. * * DatePicker's text half, for times: hour, minute and, where the locale uses * one, AM/PM — each a spinbutton that takes digits or arrow keys. The order, * the separator and the 12 or 24-hour clock come from the reader's locale, so * "2:30 PM" and "14:30" are the same field and the same value. * * WHY NOT A TEXT INPUT OR `` * * Free text means guessing whether "2:30" is afternoon. The native control * cannot be styled to match the other fields, and Safari's has no picker at * all. Segments cannot hold a time that does not exist, and every browser * draws them the same. * * No dropdown of times. A list of 96 quarter-hours is slower to scan than two * digits are to type, and it makes 09:07 impossible. Where only a few times * are allowed, that is a Select, not a TimeField. */ export declare function TimeField({ label, 'aria-label': ariaLabel, description, errorMessage, isInvalid, isDisabled, isReadOnly, isRequired, size, value, defaultValue, onChange, minValue, maxValue, granularity, hourCycle, name, className, wrapperClassName, id, }: TimeFieldProps): React.JSX.Element; export declare namespace TimeField { var displayName: string; } //# sourceMappingURL=TimeField.d.ts.map