import { t as CalendarDate } from "./calendar-date-CNNsHVof.js"; import { n as SelectionUnit, t as SelectionMode } from "./selection-types-DhmKlruR.js"; import { t as CalendarTime } from "./calendar-time-BhGHLeqY.js"; import { r as DateRuleEngine, s as CalendarRange } from "./date-rule-engine-CNfIfs0F.js"; import { ReactNode } from "react"; //#region src/core/calendar-date-time.d.ts /** * CalendarDateTime — a calendar day plus a wall-clock time. * * This is the shape for selected values, range bounds with time, and pending * date-time drafts. The visual `viewDate` is NOT a CalendarDateTime: navigation * must never carry or reset a time. */ type CalendarDateTime = { readonly date: CalendarDate; readonly time: CalendarTime; }; //#endregion //#region src/core/labels.d.ts /** * Label registry — the single home for user-facing strings (mostly aria). * * Ported from the v2 `action-labels` set and adapted to a typed registry: * keys instead of loose constants, multi-placeholder interpolation, and one * resolver with the priority `module override → root override → English * default`. Modules never hard-code aria strings; they resolve through here so * every label is overridable and a11y works out of the box. */ declare const LABEL_DEFAULTS: { readonly announceCleared: "Selection cleared"; readonly announceSelected: "Selected: {value}"; readonly apply: "Apply"; readonly calendarNavigation: "Calendar navigation"; readonly changeMonth: "Change month, currently {month}"; readonly currentDay: "Current day, {day}"; readonly currentMonth: "Current month, {month}"; readonly currentYear: "Current year, {year}"; readonly changeTime: "Change time, currently {time}"; readonly changeYear: "Change year, currently {year}"; readonly clear: "Clear"; readonly confirm: "Confirm"; readonly dayTrack: "Day"; readonly home: "Go to current month"; readonly hours: "Hours"; readonly infoRanges: "{count} ranges"; readonly lunar: "Lunar phases"; readonly manualInput: "Date"; readonly minutes: "Minutes"; readonly monthGrid: "Select month, {year}"; readonly monthPicker: "Month picker"; readonly monthSelected: "{month}, selected"; readonly monthTrack: "Month"; readonly nextDay: "Next day"; readonly nextMonth: "Next month"; readonly nextYear: "Next year"; readonly nextYears: "Next years"; readonly noDate: "No date selected"; readonly previousDay: "Previous day"; readonly previousMonth: "Previous month"; readonly previousYear: "Previous year"; readonly previousYears: "Previous years"; readonly rangeFrom: "Start date"; readonly rangeTo: "End date"; readonly remove: "Remove"; readonly removeRangeEnd: "Remove range end"; readonly removeRangeStart: "Remove range start"; readonly removeSelectedDate: "Remove selected date"; readonly resetTime: "Reset to {time}"; readonly resetMonth: "Reset to {month}"; readonly resetYear: "Reset to {year}"; readonly saveSelectedDate: "Save selected date"; readonly seconds: "Seconds"; readonly selectMonth: "Select month"; readonly selectTime: "Select time"; readonly selectYear: "Select year"; readonly showMoreSelectedDates: "Show {count} more selected dates"; readonly themeSwitchToDark: "Switch to dark mode"; readonly themeSwitchToLight: "Switch to light mode"; readonly themeToggle: "Toggle theme"; readonly timePeriod: "Time period, currently {period}"; readonly timePicker: "Time picker"; readonly week: "Week"; readonly yearGrid: "Select year, showing {from} to {to}"; readonly yearPageNavigation: "Year page navigation"; readonly yearSelected: "{year}, selected"; readonly yearPicker: "Year picker"; readonly yearTrack: "Year"; }; type LabelKey = keyof typeof LABEL_DEFAULTS; /** User overrides at either the module or the root level. */ type LabelOverrides = Partial>; /** Named values for `{placeholder}` slots. */ type LabelParams = Record; //#endregion //#region src/core/validation.d.ts /** * Validation types — designed early, surfaced later. * * Two kinds of validation outcome (per the v3 plan): * - **transient rejections** (clicking a disabled day, exceeding maxDates) flow * out as effects in Phase E and are not stored here; * - **persistent field errors** (manual input parse error, time field error) * live in a `ValidationState`, scoped, and stay visible until the next edit, * clear, or successful commit. * * This module is pure types plus allocation-light immutable helpers. No UI is * forced — a composition with no error surface simply ignores the state. */ /** Why a value/action was rejected. Stable, telemetry-friendly strings. */ type ValidationReason = "disabled" | "before-min" | "after-max" | "range-too-short" | "range-too-long" | "range-crosses-disabled" | "max-dates-reached" | "max-ranges-reached" | "malformed-input" | "ambiguous-time" | "nonexistent-time" | "time-before-min" | "time-after-max" | "time-out-of-order" | "range-out-of-order" | "empty-after-exclude" | "read-only"; type ValidationResult = { ok: true; } | { ok: false; reason: ValidationReason; /** Optional label key for a user-facing message. */ messageKey?: LabelKey; /** Optional placeholder values for the message. */ params?: LabelParams; }; /** Built-in surfaces that can hold a persistent field error. */ type BuiltInValidationScope = "manualInput" | "time" | "time.from" | "time.to" | "date" | "range" | "range.from" | "range.to" | "presets"; /** Namespaced scope for custom modules — never invent unscoped strings. */ type CustomValidationScope = `custom:${string}`; type ValidationScope = BuiltInValidationScope | CustomValidationScope; /** Brand a custom scope id, keeping the serialized string debuggable. */ declare function customScope(id: string): CustomValidationScope; type ValidationState = { fields: Partial>; }; //#endregion //#region src/core/state.d.ts type CalendarConfig = { unit: SelectionUnit; mode: SelectionMode; timeZone?: string; locale?: string; /** Resolved week start (0=Sun..6=Sat), from locale or explicit prop. */ firstDayOfWeek: number; /** * Which weekdays count as the weekend for highlighting (`data-weekend` + * the Days weekend column tint). `0=Sun..6=Sat`. Defaults to `[0, 6]` * (Sat/Sun) — override for regions like Fri/Sat (`[5, 6]`) or a single-day * weekend. Purely presentational: it does NOT disable those days (use * `createDisabled({ weekdays })` for that). */ weekendDays?: readonly number[]; readOnly: boolean; /** * Clicking the already-selected day deselects it. Default behavior is `true` * (absent === enabled); set `false` to keep the selection on re-click. */ deselectOnReclick?: boolean; /** Whether selected values carry a time-of-day. */ withTime: boolean; /** * 12-hour clock with an AM/PM period. Root-level so the toolbar time trigger, * ManualInput and the TimeWheel can't desync (a 12h display over a 24h * picker). Default `false` (24h). Time modules read this unless overridden. */ hour12?: boolean; /** Time applied to a freshly picked day when `withTime` (default time). */ defaultTime: CalendarTime; /** * Earliest selectable time-of-day when `withTime`. An inclusive wall-clock * floor applied to EVERY day's time (it is not a date-time, so it gates the * time independent of which day is picked). A `setTime` below it is rejected * (`time-before-min`); the time modules also gate their steppers/drums to it. */ minTime?: CalendarTime; /** Latest selectable time-of-day when `withTime` (inclusive). See {@link minTime}. */ maxTime?: CalendarTime; /** * Localized AM/PM labels for `hour12` surfaces (toolbar time, wheels). Default * `{ am: "AM", pm: "PM" }`. Root-level so every time module reads the same. */ ampmLabels?: { am: string; pm: string; }; min?: CalendarDate; max?: CalendarDate; /** Min/max span length, expressed in `unit`s (range/multi-range). */ minSpan?: number; maxSpan?: number; /** Cap on point selections (multiple mode). */ maxDates?: number; /** Cap on logical spans (multi-range mode). */ maxRanges?: number; disabled: DateRuleEngine; exclude: DateRuleEngine; excludedEndpointPolicy: "snap-inward" | "reject"; }; /** * Selection storage collapses the unit × mode matrix into two shapes: * - **point** — discrete day selections (only `unit:"day"` + single/multiple); * - **span** — ranges (week/month units, and range / multi-range modes). * * The shape is derived from config once; the strategy enforces cardinality * (single = at most one) within the shape. */ type PointSelection = { shape: "point"; dates: readonly CalendarDateTime[]; }; type SpanSelection = { shape: "span"; /** Date-level spans — drive the grid; sorted, non-overlapping when committed. */ ranges: readonly CalendarRange[]; /** Pending anchor while drawing the current span. */ draftAnchor?: CalendarDate; /** Time bounds for the active range when `withTime` (range mode). */ fromTime?: CalendarTime; toTime?: CalendarTime; }; type SelectionState = PointSelection | SpanSelection; /** Visual navigation anchor — a `CalendarDate`, never a date-time. */ type ViewState = { viewDate: CalendarDate; }; /** Ephemeral interaction state — hover preview and roving focus target. */ type InteractionState = { hoverDate?: CalendarDate; focusDate?: CalendarDate; }; type CalendarState = { selection: SelectionState; view: ViewState; interaction: InteractionState; validation: ValidationState; }; //#endregion //#region src/react/ui-context.d.ts /** * Ephemeral UI state that is NOT selection — which transient popup is open and * what anchors it. Kept OUT of the reducer (per the v3 plan): popups are view * concerns, never serialized, never part of `onChange`. Lives in its own context * so opening a month picker doesn't churn selection subscribers. */ type PopupKind = "month" | "year" | "time"; /** Light/dark choice. `"auto"` follows the OS via `prefers-color-scheme`. */ type SchemeMode = "light" | "dark" | "auto"; type UIContextValue = { popup: PopupKind | null; anchor: HTMLElement | null; isOpen: (kind: PopupKind) => boolean; open: (kind: PopupKind, anchor: HTMLElement) => void; close: () => void; toggle: (kind: PopupKind, anchor: HTMLElement) => void; /** Active scheme on the root (`data-scheme`); `"auto"` defers to the OS. */ scheme: SchemeMode; /** Flip light↔dark, resolving `"auto"` against the OS at flip time. */ toggleScheme: () => void; }; /** Popup UI state for the nearest provider. Throws when used outside one. */ declare function useUI(): UIContextValue; //#endregion export { type LabelParams as _, type InteractionState as a, type SpanSelection as c, type ValidationReason as d, type ValidationResult as f, type LabelOverrides as g, type LabelKey as h, type CalendarState as i, type ViewState as l, customScope as m, useUI as n, type PointSelection as o, type ValidationScope as p, type CalendarConfig as r, type SelectionState as s, type SchemeMode as t, type BuiltInValidationScope as u };