import type { DateDetail, DateFrameworkType, ParserResult, Timezone } from "@salt-ds/date-adapters"; import { type ComponentPropsWithoutRef, type InputHTMLAttributes, type ReactNode, type Ref, type SyntheticEvent } from "react"; import type { SingleDateSelection } from "../calendar"; /** * Details of parsing the date */ export type DateInputSingleDetails = DateDetail; /** * Props for the DateInputSingle component. * @template TDate - The type of the date object. */ export interface DateInputSingleProps extends Omit, "defaultValue">, Pick, "disabled" | "value" | "defaultValue" | "placeholder"> { /** * The aria-label for accessibility. */ ariaLabel?: string; /** * Styling variant with full border. Defaults to false. */ bordered?: boolean; /** * The marker to use in an empty read-only DateInput. * Use `''` to disable this feature. Defaults to '—'. */ emptyReadOnlyMarker?: string; /** * End adornment component. */ endAdornment?: ReactNode; /** * Attributes applied to the `input` element. * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dateInput#Attributes */ inputProps?: InputHTMLAttributes; /** * If `true`, the component is read-only. */ readOnly?: boolean; /** * Start adornment component */ startAdornment?: ReactNode; /** * Validation status. */ validationStatus?: "error" | "warning" | "success"; /** * Styling variant. Defaults to "primary". */ variant?: "primary" | "secondary" | "tertiary"; /** * Format string for date. */ format?: string; /** * Reference for the input. */ inputRef?: Ref; /** * Parser callback, if not using the adapter's parser * @param value - date string to parse * @param format - format required */ parse?: (value: string, format: string) => ParserResult; /** * Input value. Use when the input value is controlled. */ value?: string; /** * The initial input value. Use when the component is uncontrolled. */ defaultValue?: string; /** * The date value. Use when the component is controlled. */ date?: TDate | null; /** * The initial selected date value. Use when the component is uncontrolled. */ defaultDate?: TDate | null; /** * Callback fired when the selected date changes. * @param event - The synthetic event. * @param date - the selected date, invalid date if not a valid date or undefined (uncontrolled) or null (controlled) if not defined * @param details - The details of date selection, either a valid date or error */ onDateChange?: (event: SyntheticEvent, date: SingleDateSelection | null | undefined, details: DateInputSingleDetails) => void; /** * Called when input value changes, either due to user interaction or programmatic formatting of valid dates. * @param event - The synthetic event or null if a programmatic change. * @param newValue - The new date input value. */ onDateValueChange?: (event: SyntheticEvent | null, newValue: string) => void; /** * Specifies the timezone behavior: * - If undefined, the timezone will be derived from the passed date, or from `defaultSelectedDate`/`selectedDate`. * - If set to "default", the default timezone of the date library will be used. * - If set to "system", the local system's timezone will be applied. * - If set to "UTC", the time will be returned in UTC. * - If set to a valid IANA timezone identifier, the time will be returned for that specific timezone. */ timezone?: Timezone; } export declare const DateInputSingle: import("react").ForwardRefExoticComponent & import("react").RefAttributes>;