import { t as CalendarDate } from "./calendar-date-CNNsHVof.js"; import { t as CalendarTime } from "./calendar-time-BhGHLeqY.js"; import { f as ValidationResult, i as CalendarState, r as CalendarConfig, s as SelectionState } from "./ui-context--f27L7Ww.js"; import { n as CalendarChangeDetails, t as AnyCalendarValue } from "./public-value-B1i8vw8Z.js"; import { o as PresetResult } from "./preset-engine-B3wu3xXQ.js"; import { ReactNode } from "react"; //#region src/core/actions.d.ts /** * Every way state can change. A flat, serializable discriminated union — no * hidden mode branches. The reducer routes most of these through the active * selection strategy; `navigate*` and the ephemeral `hover`/`focus` are handled * directly. */ type CalendarAction = /** Pick a day (the meaning depends on unit × mode, decided by the strategy). */ { type: "selectDay"; date: CalendarDate; } | /** Edit time of the active selection or a range bound. */ { type: "setTime"; time: CalendarTime; bound?: "from" | "to"; } | /** Edit the date of one bound of a span selection (manual input, wheels). */ { type: "setBoundDate"; date: CalendarDate; bound: "from" | "to"; } | /** Move the view anchor to an explicit date. */ { type: "navigateTo"; date: CalendarDate; } | /** Step the view by whole days/months/years (prev/next controls). */ { type: "navigateBy"; step: "day" | "month" | "year"; amount: number; } | /** Hover preview target (range drawing). `undefined` clears it. */ { type: "hover"; date?: CalendarDate; } | /** Roving focus target. `undefined` clears it. */ { type: "focus"; date?: CalendarDate; } | /** Clear the whole selection. */ { type: "clear"; } | /** Apply a resolved preset value through the strategy. */ { type: "applyPreset"; result: PresetResult; } | /** Remove one point selection (multiple mode). */ { type: "removeDate"; date: CalendarDate; } | /** Remove one logical span by index (multi-range mode). */ { type: "removeRange"; index: number; } | /** * Replace the selection from a controlled `value` change. Updates state (so * subscribers re-render) but emits NO `notify` — the new value came from the * host, echoing `onChange` would loop. */ { type: "syncExternal"; selection: SelectionState; }; type CalendarActionType = CalendarAction["type"]; //#endregion //#region src/react/focus-manager.d.ts /** * Focus Manager (Phase F) — lean seam. * * Two focus concerns exist in v3: * * 1. **First focus** — should mounting the calendar move DOM focus into a day, * and which one? Owned here, resolved from the root `initialFocus` prop and * seeded into `interaction.focusDate` (the Days module DOM-focuses it). Seeding * state instead of firing a mount effect keeps this StrictMode-safe — no * effect-time module registration, which can double-invoke in dev and is * absent in SSR. * * 2. **Focus return** — popups restore focus to their trigger on close. Already * owned by `CalendarPopup` (Escape + outside-close paths). No central wiring * needed while popups are self-contained. * * DEFERRED (until a second focusable module competes for first focus, Phase I+): * the static per-module focus-priority registry. With Days as the only interactive * grid there is exactly one first-focus claimant, so a priority resolver would be * speculative infra. When Tracks/Wheels land, add ref-based priority claims here * (NOT effect-based registration) and resolve the highest priority. */ /** * Root `initialFocus` intent: * - `false` / omitted — do NOT steal focus on mount (default; a calendar * rendered inline must not grab focus or scroll the page); * - `"view"` — focus the day at the current view anchor; * - a specific `CalendarDate` — focus that day. */ type InitialFocus = CalendarDate | "view" | false; //#endregion //#region src/react/store.d.ts /** @internal */ type StoreListener = () => void; type CalendarStore = { /** Current state. Stable reference until a real change — safe as a snapshot. */ getState(): CalendarState; /** The static compiled config this store reduces against. */ getConfig(): CalendarConfig; /** Subscribe to state changes. Returns an unsubscribe function. */ subscribe(listener: StoreListener): () => void; /** Run an action through the reducer, notify on change, drain effects. */ dispatch(action: CalendarAction): void; }; //#endregion //#region src/react/provider.d.ts /** * Wires the pure store into the React tree and interprets the reducer's effects * as host side effects (the reducer itself never calls a user callback). The * store is created once and is referentially stable, so `useCalendarActions` * and every selector subscription stay stable across renders; user callbacks * are read through a latest-ref so changing `onChange` never rebuilds the store. */ type CalendarProviderProps = { /** Compiled, static config (engines compiled, locale resolved). */ config: CalendarConfig; /** * Controlled value. When provided (including `null` = empty), the host owns * the selection: changes are synced into the store and `onChange` reports the * host's intent. Omit (`undefined`) for uncontrolled use with `defaultSelection`. */ value?: AnyCalendarValue; /** * Uncontrolled initial selection in the public `Date`-based shape (same * shape as `value`). The ergonomic seed for uncontrolled use. */ defaultValue?: AnyCalendarValue; /** Uncontrolled seed as a raw internal `SelectionState`. @internal */ defaultSelection?: SelectionState; /** Initial view anchor. Defaults to today in the configured zone. */ initialView?: CalendarDate; /** * Whether mounting moves DOM focus into a day, and which (Focus Manager). * `false`/omitted = don't steal focus (default); `"view"` = the view anchor; * a `CalendarDate` = that day. */ initialFocus?: InitialFocus; /** * Committed selection changed. Receives the public `Date`-based value (logical * spans; shape fixed by `unit × mode`) and {@link CalendarChangeDetails} — * `segments` (business-day cut when `exclude`/`disabled` apply) and `reason`. */ onChange?: (value: AnyCalendarValue, details: CalendarChangeDetails) => void; /** View anchor moved (prev/next, navigateTo). */ onViewChange?: (viewDate: CalendarDate) => void; /** A transient action was rejected (disabled click, cap reached, crossing). */ onValidationReject?: (result: ValidationResult) => void; children: ReactNode; }; /** The store for the nearest `CalendarProvider`. Throws when used outside one. */ declare function useCalendarStore(): CalendarStore; type CalendarActions = { selectDay(date: CalendarDate): void; setTime(time: CalendarTime, bound?: "from" | "to"): void; setBoundDate(date: CalendarDate, bound: "from" | "to"): void; navigateTo(date: CalendarDate): void; navigateBy(step: "day" | "month" | "year", amount: number): void; hover(date?: CalendarDate): void; focus(date?: CalendarDate): void; clear(): void; applyPreset(result: PresetResult): void; removeDate(date: CalendarDate): void; removeRange(index: number): void; }; /** * Stable action dispatchers for the current store. The store is referentially * stable, so this object is built once and never changes identity — safe to * pass to memoized children without churn. */ declare function useCalendarActions(): CalendarActions; //#endregion export { type CalendarStore as a, useCalendarStore as i, type CalendarProviderProps as n, type CalendarAction as o, useCalendarActions as r, type CalendarActionType as s, type CalendarActions as t };