import "./date_picker.css"; import type * as React from "react"; import { useRender } from "@base-ui/react/use-render"; import { SegmentLabels } from "./date_segments"; import type { Commit, Controlled, SelfCommitting } from "./commit_mode"; import { type StyleProps } from "./style_props"; import { DatePickerFormat } from "./date_picker_value"; /** The popover's quick actions and accessible names, plus the segmented field's * per-segment labels. Backs the `datePicker` locale slice. */ export interface DatePickerLabels extends SegmentLabels { /** Quick action, shown for the `date` format. */ today: string; /** Quick action, shown for `datetime`. */ now: string; clear: string; openCalendar: string; chooseTime: string; time: string; startTime: string; endTime: string; startDate: string; endDate: string; done: string; /** Inline error when a typed date is left incomplete/invalid (never committed). */ invalidDate: string; /** Quick action: add a time to a date-only value (`optionalTime`). */ addTime: string; /** Drop the time, keeping the date (`optionalTime`). */ removeTime: string; } interface DatePickerBase extends StyleProps { /** ISO: `"YYYY-MM-DD"`, `"YYYY-MM-DDTHH:mm"`, `"/"` for a range, and * a canonical 24-hour `"HH:mm"` under `format="time"`. EMPTY IS `null`, in and * out; `""` is accepted on the way in and never emitted. */ value: string | null; disabled?: boolean; testID?: string; /** Overrides; anything omitted resolves from the `datePicker` locale slice. */ labels?: Partial; /** BCP-47 locale for the segment order + the calendar's weekday/month names. */ locale?: string; placeholder?: string; /** Names the field's segment group (both, on a range). A visible label beside * the field is not programmatically associated, so it is still needed. */ accessibilityLabel?: string; /** The FIELD, which is what a caller measures and what the panel anchors to. */ ref?: React.Ref; render?: useRender.RenderProp; } /** What both date faces share — the segmented field and the calendar behind it. */ interface DateFieldBase extends DatePickerBase { /** Single `date` formats only: the value's SHAPE says whether a time is set. */ optionalTime?: boolean; /** Fires once focus leaves the whole field, after any typed value is committed. */ onBlur?: () => void; } /** A date, a datetime or a RANGE, with a form holding the value. */ export interface DatePickerDateProps extends DateFieldBase { format?: DatePickerFormat; } /** * The self-committing date face. **Ranges are refused**: a pair has no commit * semantics to resolve — "the draft" is two drafts, and `resolveDateCommit` * decides off ONE string against ONE stored value. A range belongs to a form, * which commits both halves in its footer. */ export interface DatePickerSelfDateProps extends DateFieldBase { format?: "date" | "datetime"; /** The reader may EMPTY this field: an emptied entry commits `null` instead of * reverting, and the panel's Clear unsets. */ clearable?: boolean; } /** * A TIME OF DAY, with no day attached: the value on a pressable field and an * hour / minute / period picker behind it. `value` is a canonical 24-hour * `"HH:mm"` whatever the locale shows; there is no text entry, and the segments, * the calendar and `optionalTime` are all absent. * * Reach for it only where the DAY is already fixed by the surface around it — * a bare time is ambiguous the moment the record crosses midnight. */ export interface DatePickerTimeProps extends DatePickerBase { format: "time"; } export type DatePickerProps = (DatePickerDateProps & Controlled) | (DatePickerSelfDateProps & SelfCommitting) | (DatePickerTimeProps & Commit); /** The calendar / time / quick-action surface, rendered inside the popover and * directly by grid cell editors that own their own overlay. */ export interface DatePickerPanelProps extends StyleProps { value?: string | null; onValueChange: (value: string) => void; format: DatePickerFormat; optionalTime?: boolean; labels?: Partial; locale?: string; onRequestClose?: () => void; ref?: React.Ref; render?: useRender.RenderProp; } export declare function DatePickerPanel(props: DatePickerPanelProps): React.ReactElement>; /** * Universal date / datetime / range / TIME picker — `format` decides which, and * `"time"` is the one that changes the trigger rather than the segments. * * ONE ELEMENT IN BOTH COMMIT MODES. Pass `onValueChange` and a form owns the * value; pass `onSave` and the field owns its own draft — Escape reverts, blur * or the calendar closing commits. The segmented editor is mounted at rest, so * nothing swaps and nothing resizes. * * For a date the field is a segmented, locale-aware editable control plus a * calendar mark; pressing it opens a popover with a calendar, quick actions and, * for datetime formats, a time field. See {@link DatePickerTimeProps}. */ export declare function DatePicker(props: DatePickerProps): React.JSX.Element; export {};