import { type InputProps } from "@salt-ds/core"; import type { DateDetail, DateFrameworkType, ParserResult, Timezone } from "@salt-ds/date-adapters"; import { type ChangeEvent, type ComponentPropsWithoutRef, type InputHTMLAttributes, type ReactNode, type Ref, type SyntheticEvent } from "react"; import type { DateRangeSelection } from "../calendar"; /** * DateInputRange raw value or null if no date is defined. */ export type DateInputRangeValue = { startDate?: string | null; endDate?: string | null; }; /** * Details of parsing the date range */ export type DateInputRangeDetails = { /** Details of parsing the start date and applying any validation */ startDate?: DateDetail; /** Details of parsing the end date and applying any validation */ endDate?: DateDetail; }; /** * Enum to identify the field being parsed */ export declare enum DateParserField { START = "start", END = "end" } /** * Props for the DateInputRange component. * @template TDate - The type of the date object. */ export interface DateInputRangeProps extends Omit, "defaultValue" | "onChange">, Omit { /** * 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 start `input` element. * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dateInput#Attributes */ startInputProps?: InputHTMLAttributes; /** * Attributes applied to the end `input` element. * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dateInput#Attributes */ endInputProps?: InputHTMLAttributes; /** * If `true`, the component is read-only. */ readOnly?: boolean; /** * Validation status. */ validationStatus?: "error" | "warning" | "success"; /** * Styling variant. Defaults to "primary". */ variant?: "primary" | "secondary" | "tertiary"; /** * Format string for date. */ format?: string; /** * Optional ref for the start input component. */ startInputRef?: Ref; /** * Optional ref for the end input component. */ endInputRef?: Ref; /** * Parser callback, if not using the adapter's parser * @param value - date string to parse * @param field: DateParserField to identify value, * @param format - format required */ parse?: (value: string, field: DateParserField, format: string) => ParserResult; /** * Input value. Use when the input value is controlled. */ value?: DateInputRangeValue; /** * The initial input value. Use when the component is uncontrolled. */ defaultValue?: DateInputRangeValue; /** * The date value. Use when the component is controlled. */ date?: DateRangeSelection | null; /** * The initial selected date value. Use when the component is uncontrolled. */ defaultDate?: DateRangeSelection | null; /** * Callback fired when the input value changes. * @param event - The change event. * @param date - The new date input range value. */ onChange?: (event: ChangeEvent) => void; /** * 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: DateRangeSelection | null, details: DateInputRangeDetails) => void; /** * Called when input values change, 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 range value. */ onDateValueChange?: (event: SyntheticEvent | null, newValue: DateInputRangeValue) => 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 DateInputRange: import("react").ForwardRefExoticComponent & import("react").RefAttributes>;