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, ControlledActing, SelfCommitting } from "./commit_mode"; import { type StyleProps } from "./style_props"; import { DatePickerFormat } from "./date_picker_value"; /** Backs the `datePicker` locale slice. */ export interface DatePickerLabels extends SegmentLabels { /** For the `date` format. */ today: string; /** For `datetime`. */ now: string; clear: string; openCalendar: string; chooseTime: string; time: string; startTime: string; endTime: string; startDate: string; endDate: string; done: string; /** A typed date left incomplete or invalid (never committed). */ invalidDate: string; /** Under `optionalTime`. */ addTime: string; /** Under `optionalTime`, keeping the date. */ removeTime: string; } interface DatePickerBase extends StyleProps { /** * ISO: `"YYYY-MM-DD"`, `"YYYY-MM-DDTHH:mm"`, `"/"` for a range, 24-hour `"HH:mm"` * under `format="time"`. Empty is `null`; `""` is accepted in, never emitted. */ value: string | null; disabled?: boolean; testID?: string; /** Omitted keys resolve from the `datePicker` slice. */ labels?: Partial; /** Segment order and the calendar's names. */ locale?: string; placeholder?: string; /** A visible label beside the field is not associated, so this is still needed. */ accessibilityLabel?: string; /** The field: what a caller measures and the panel anchors to. */ ref?: React.Ref; render?: useRender.RenderProp; } interface DateFieldBase extends DatePickerBase { /** Single `date` formats only; the value's shape says whether a time is set. */ optionalTime?: boolean; /** After any typed value is committed. */ onBlur?: () => void; } export interface DatePickerDateProps extends DateFieldBase { format?: DatePickerFormat; /** Default `true`: the panel offers Clear. `false` where the form refuses an empty date. */ clearable?: boolean; } /** * Ranges are refused: `resolveDateCommit` decides one string against one stored value, so a pair * belongs to a form. */ export interface DatePickerSelfDateProps extends DateFieldBase { format?: "date" | "datetime"; /** An emptied entry commits `null` instead of reverting, and the panel offers Clear. */ clearable?: boolean; } /** * A time of day with no date: 24-hour `"HH:mm"` whatever the locale shows, picked from columns with * no text entry. Only where the surface fixes the day: a bare time is ambiguous across midnight. */ export interface DatePickerTimeProps extends DatePickerBase { format: "time"; } export type DatePickerProps = (DatePickerDateProps & ControlledActing) | (DatePickerSelfDateProps & SelfCommitting) | (DatePickerTimeProps & Commit); /** Rendered in the popover, and directly by grid cell editors that own their overlay. */ export interface DatePickerPanelProps extends StyleProps { value?: string | null; onValueChange: (value: string) => void; format: DatePickerFormat; optionalTime?: boolean; /** Offers Clear, which emits the empty value; a value that may not be emptied offers nothing it would undo. */ clearable?: 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 by `format`; `"time"` changes the trigger instead * of the segments. One element in both commit modes: `onValueChange` for a form, `onSave` for a * self-held draft (Escape reverts, blur or calendar close commits). The segmented editor is mounted * at rest. See {@link DatePickerTimeProps}. */ export declare function DatePicker(props: DatePickerProps): React.JSX.Element; export {};