import { n as SelectionUnit, t as SelectionMode } from "./selection-types-DhmKlruR.js"; //#region src/core/public-value.d.ts /** * The public boundary value — what `onChange` emits and `value` accepts. * * Internally selection is `CalendarDate`/`CalendarDateTime`; the public surface * is plain JS `Date`, matching the rest of the React ecosystem (react-day-picker, * MUI, react-aria all hand back the host date object). The shape narrows by the * configured `unit × mode`, like react-day-picker's `mode`-discriminated * `onSelect`: a single point is `Date | null`, a span is `{ start, end }`, and * the "many" cardinalities are arrays of those. Empty is `null`, never an empty * span. */ type PublicRange = { start: Date; end: Date; }; /** * Value type for a given unit × mode. The shape is derived from `(unit, mode)` * ALONE — `exclude`/`disabled`/`maxRanges` never change it (the §2d invariant): * a consumer can type its `onChange` handler from the props it passes, with no * conditional types over optional flags. * * `value` always carries the LOGICAL spans (the user's anchor→end intent), never * the segmented result. Excluded-day segments are derived data and ride along in * {@link CalendarChangeDetails.segments}, not in `value`. * * - `day` single → `Date | null`, multiple → `Date[]` (point cardinalities); * - any single-cardinality span (range, or week/month single) → `PublicRange | null`; * - any "many" span (multi-range, or week/month multiple) → `PublicRange[]`. */ type CalendarValue = U extends "day" ? M extends "single" ? Date | null : M extends "multiple" ? Date[] : M extends "range" ? PublicRange | null : PublicRange[] : M extends "single" | "range" ? PublicRange | null : PublicRange[]; /** The runtime union of every possible emitted value (callers narrow by config). */ type AnyCalendarValue = Date | null | Date[] | PublicRange | PublicRange[]; /** Why a committed change fired — mapped from the action that caused it (§2d). */ type ChangeReason = "select" | "clear" | "preset" | "time" | "remove" | "external-sync"; /** * The second argument to `onChange` (§2d). `value` carries logical spans; * derived/segmented data travels here so the value's static type never shifts. * * `segments` is present only when `exclude`/`disabled` are configured AND the * selection is span-shaped: it is every span's surviving business-day segments, * flattened and ordered. Consumers whose real value IS the segment list * (booking, business days) read this instead of `value`. */ type CalendarChangeDetails = { segments?: PublicRange[]; reason: ChangeReason; }; //#endregion export { type ChangeReason as i, type CalendarChangeDetails as n, type CalendarValue as r, type AnyCalendarValue as t };