import type { HTMLAttributes, ReactNode } from 'react';
import type { SxProp } from '../Layout/sx.cjs';
import type { WeekDay } from './dateUtils.cjs';
import type { DatePickerAllow, DatePickerColor, DatePickerSize } from './DatePicker.types.cjs';
/** A picked range: both ends are whole days and `from` is never after `to`. */
export interface DateRange {
from: Date;
to: Date;
}
export interface DateRangePickerProps extends Omit, 'onChange' | 'defaultValue' | 'children'> {
/** Controlled value. `null` means cleared. */
value?: {
from: Date | string;
to: Date | string;
} | null;
/** Uncontrolled initial value. */
defaultValue?: {
from: Date | string;
to: Date | string;
};
/** Fires once both ends are picked, and with `null` on clear. */
onChange?: (range: DateRange | null) => void;
/** Earliest selectable date (inclusive). */
min?: Date | string;
/** Latest selectable date (inclusive). */
max?: Date | string;
/** Declarative date-window constraint. Combines with `min`/`max` (stricter wins). */
allow?: DatePickerAllow;
/** Predicate to disable arbitrary dates (for either end). */
disabledDate?: (date: Date) => boolean;
/** Longest range allowed: once the start is picked, the end can be at most this many days from it. */
maxDays?: number;
/** Text shown when empty. */
placeholder?: string;
/** Trigger size. */
size?: DatePickerSize;
/** Validation color on the trigger. Flips to `'danger'` when `error` is set. */
color?: DatePickerColor;
/** Disable the trigger. */
disabled?: boolean;
/** Show a clear button when a range is selected. */
clearable?: boolean;
/** BCP-47 locale tag. Defaults to the browser's. */
locale?: string;
/** 0 = Sunday, 1 = Monday, …, 6 = Saturday. Defaults to 0. */
weekStartsOn?: WeekDay;
/** Custom display formatter for each end of the range. */
format?: (date: Date) => string;
/** Text between the two dates on the trigger. Default `' – '`. */
separator?: string;
/** Replace the trigger icon. */
icon?: ReactNode;
/** Explicit error message. When set, forces danger state and renders below the trigger. */
error?: ReactNode;
/** id forwarded to the trigger (for Field integration). */
id?: string;
/** aria-invalid forwarded to the trigger. */
'aria-invalid'?: boolean;
/** aria-describedby forwarded to the trigger. */
'aria-describedby'?: string;
/** Accessible label for the dialog. */
dialogLabel?: string;
/** Controlled open state. */
open?: boolean;
/** Called when open state changes. */
onOpenChange?: (open: boolean) => void;
/**
* One-off CSS, same as `Box`'s `sx`. Applied to the outer field wrapper (not the popover
* calendar).
*/
sx?: SxProp;
}