import { Temporal } from '@vielzeug/tempo'; /** * Parses an ISO 8601 date string (`yyyy-MM-dd`) into a `Temporal.PlainDate`. * Returns `null` for any invalid / empty input — never throws. */ export declare function parseIso(iso: string | undefined | null): Temporal.PlainDate | null; /** * Serialises a `Temporal.PlainDate` (or `null`) to an ISO 8601 string (`yyyy-MM-dd`). * Returns `null` when the input is `null`. */ export declare function toIsoString(date: Temporal.PlainDate | null): string | null; /** * Formats a `Temporal.PlainDate` for display in a given locale. * e.g. "15 Jun 2025" (default medium pattern). */ export declare function formatDisplayDate(date: Temporal.PlainDate, locale: string): string; export type DatePickerView = 'day' | 'month' | 'year'; export type DateCell = { /** Day-of-month number (1–31) */ day: number; isDisabled: boolean; /** ISO date string yyyy-MM-dd — stable key for rendering */ iso: string; isOutsideMonth: boolean; isSelected: boolean; isToday: boolean; plain: Temporal.PlainDate; }; export type MonthCell = { isDisabled: boolean; isSelected: boolean; label: string; /** 1-based month number (Temporal convention: 1 = January … 12 = December) */ month: number; shortLabel: string; }; export type YearCell = { isDisabled: boolean; isSelected: boolean; year: number; }; export type DatePickerControlOptions = { /** Locale for day/month names, defaults to `navigator.language` or `'en'` */ locale?: string; /** Maximum selectable date (inclusive) */ max?: Temporal.PlainDate | null; /** Minimum selectable date (inclusive) */ min?: Temporal.PlainDate | null; /** Called when a date is committed by the user */ onChange: (date: Temporal.PlainDate | null) => void; /** Currently selected date */ value?: Temporal.PlainDate | null; /** * Which days of the week to disable (0 = Sunday … 6 = Saturday). * @example [0, 6] disables weekends */ weekendDays?: number[]; }; export type DatePickerControl = { /** Ordered day cells for the visible month grid (includes leading/trailing days) */ dayCells(): DateCell[]; /** Month currently shown in the header (1-indexed, Temporal convention) */ displayMonth(): number; /** Year currently shown in the header */ displayYear(): number; /** Jump to a specific display month/year without selecting */ goTo(year: number, month: number): void; /** All 12 month cells */ monthCells(): MonthCell[]; /** Move display month forward by one */ nextMonth(): void; /** Move display year forward by one */ nextYear(): void; /** Move display month backward by one */ prevMonth(): void; /** Move display year backward by one */ prevYear(): void; /** Select a date. Pass null to clear. */ select(date: Temporal.PlainDate | null): void; /** The currently selected date, or null */ selected(): Temporal.PlainDate | null; /** Switch the calendar view */ setView(view: DatePickerView): void; /** Currently rendered calendar view */ view(): DatePickerView; /** Short week-day labels in locale order e.g. ["Su","Mo",…] */ weekdayLabels(): string[]; /** Year cells for the visible decade window */ yearCells(): YearCell[]; }; /** * Pure, framework-agnostic date-picker state machine backed by `Temporal.PlainDate`. * * All state is held in plain mutable variables — suitable for wrapping in any * reactive layer (ore `signal`, Vue ref, etc.). The factory returns a stable * handle object; callers are responsible for reactivity. * * Options with getter-based live bindings (e.g. `get min() { ... }`) are read * on every call so the control always reflects the latest reactive state. * * @example * ```ts * const ctrl = createDatePickerControl({ * value: Temporal.PlainDate.from('2025-06-15'), * locale: 'en-US', * onChange: (date) => console.log(date?.toString()), * }); * * ctrl.nextMonth(); * ctrl.select(Temporal.PlainDate.from('2025-07-04')); * ``` */ export declare function createDatePickerControl(options: DatePickerControlOptions): DatePickerControl; //# sourceMappingURL=date-picker.d.ts.map