import * as React from 'react'; import type { CalendarContextValue, CalendarDay, CalendarGridContextValue, CalendarProps, CalendarSelectionMode, CalendarValue, CalendarView, DateRange, RangePosition } from './types.cjs'; /** @internal Number of days in the given zero-based `month` of `year`. */ export declare function getDaysInMonth(year: number, month: number): number; /** @internal Midnight on the first day of `date`'s month, in local time. */ export declare function startOfMonth(date: Date): Date; /** * Adds `amount` calendar months to `date`, clamping the day so it never * overflows into the next month — e.g. Jan 31 + 1 month → Feb 28/29. * * @param date - Base date; not mutated. * @param amount - Months to add; may be negative. * @returns A new {@link Date} `amount` months from `date`. */ export declare function addMonths(date: Date, amount: number): Date; /** @internal Adds `amount` years to `date` via {@link addMonths} (so Feb 29 clamps to Feb 28 in non-leap years). */ export declare function addYears(date: Date, amount: number): Date; /** * Adds `amount` days to `date`, rolling over month and year boundaries naturally. * * @param date - Base date; not mutated. * @param amount - Days to add; may be negative. * @returns A new {@link Date} `amount` days from `date`. */ export declare function addDays(date: Date, amount: number): Date; /** Whether `a` and `b` fall on the same calendar day, ignoring time of day; `false` if either is nullish. */ export declare function isSameDay(a: Date | null | undefined, b: Date | null | undefined): boolean; /** Whether `a` and `b` fall in the same calendar month of the same year. */ export declare function isSameMonth(a: Date, b: Date): boolean; /** @internal Midnight on the first day of the week containing `date`, where `weekStartsOn` is 0 (Sunday)–6 (Saturday). */ export declare function startOfWeek(date: Date, weekStartsOn: number): Date; /** @internal Midnight on the last day of the week containing `date`, given the same `weekStartsOn` as {@link startOfWeek}. */ export declare function endOfWeek(date: Date, weekStartsOn: number): Date; /** @internal Copy of `date` with the time component zeroed to local midnight. */ export declare function stripTime(date: Date): Date; /** @internal Whether `date` is out of range: before `minDate`, after `maxDate` (both compared date-only), or rejected by `disabledFn`. */ export declare function isDateDisabled(date: Date, minDate: Date | undefined, maxDate: Date | undefined, disabledFn: ((date: Date) => boolean) | undefined): boolean; /** * @internal Clamps `date` into `[minDate, maxDate]` (compared date-only), the * same convention Slider and NumberField use for an out-of-bounds step — * never a silent no-op, never a jump onto a natively `disabled` cell the * roving tab stop could then get stuck on. */ export declare function clampToDateRange(date: Date, minDate: Date | undefined, maxDate: Date | undefined): Date; /** The two disabled-ness inputs a Calendar resolves. */ export interface ResolvedCalendarDisabled { /** Whether the *whole* calendar is disabled. */ disabled: boolean; /** The per-date predicate to use. */ isDateDisabled?: ((date: Date) => boolean) | undefined; } /** @internal Resolves disabled and isDateDisabled props. */ export declare function resolveCalendarDisabled(disabled: boolean | undefined, isDateDisabled: ((date: Date) => boolean) | undefined): ResolvedCalendarDisabled; /** @internal Puts {@link warnInstantDate} back to "not yet warned". */ export declare function resetInstantDateWarning(): void; /** * Warns once per process when a bare `YYYY-MM-DD` string was handed to `new Date()`, which reads it as UTC midnight — a different day west of Greenwich. * * @param date - Date supplied or null/undefined * @param source - Prop name for the message */ export declare function warnInstantDate(date: Date | null | undefined, source: string): void; /** * ISO-8601 week number (1–53) of `date`, independent of `weekStartsOn` and using local wall-clock time. * * @param date - Any day of the week to number; not mutated * @returns The ISO week number, 1–53 */ export declare function getISOWeek(date: Date): number; /** @internal Formats `date` as a local-time `YYYY-MM-DD` string (no timezone conversion, unlike `Date.toISOString`). */ export declare function toISODateString(date: Date): string; /** @internal Projects `date`'s day-of-month onto `targetMonth`, clamping to that month's last day; returns `date` unchanged if already in `targetMonth`. */ export declare function clampToMonth(date: Date, targetMonth: Date): Date; /** The three calendar views, most granular first — every `minView`/`maxView` clamp is an index move along this array. */ export declare const CALENDAR_VIEWS: readonly ["day", "month", "year"]; /** How many years one page of {@link CalendarYearGrid} shows, and what its start is aligned to. */ export declare const CALENDAR_YEAR_PAGE = 20; /** @internal Clamps `view` into the `[minView, maxView]` window, raising `maxView` to `minView` if a consumer inverted them. */ export declare function clampView(view: CalendarView, minView: CalendarView, maxView: CalendarView): CalendarView; /** @internal First year of the twenty-year page containing `year` — 2026 falls on the 2020–2039 page. */ export declare function yearPageStart(year: number): number; /** Whether any day from `from` to `to` inclusive is selectable — what makes a whole month or year cell refusable. */ export declare function hasAvailableDate(from: Date, to: Date, minDate: Date | undefined, maxDate: Date | undefined, disabledFn: ((date: Date) => boolean) | undefined): boolean; /** * The label for whatever page `view` shows around `date` — month, year, or * year-page — so the heading, grid name, and paging announcement never disagree. */ export declare function formatViewPageLabel(date: Date, view: CalendarView, locale?: string): string; /** Always returns a 6x7 (weeks x weekdays) grid, including adjacent-month filler days. */ export declare function getVisibleWeeks(month: Date, weekStartsOn?: number): CalendarDay[][]; /** Whether `value` is a {@link DateRange} rather than a single date, a date array, or nothing. */ export declare function isDateRange(value: CalendarValue): value is DateRange; /** The empty selection for `mode`: `[]` for `multiple`, `null` for `single` and `range`. */ export declare function emptySelection(mode: CalendarSelectionMode): CalendarValue; /** Whether `date` is part of `value` — the selected day, a member of the array, or within `start`–`end` for a range. */ export declare function isDateSelected(value: CalendarValue, date: Date): boolean; /** Where `date` sits in `range`: `'start'`, `'end'`, `'middle'`, or `undefined` outside it; an unclosed range only reports `'start'`. */ export declare function rangePositionOf(range: DateRange, date: Date): RangePosition | undefined; /** The selection that results from choosing `date` while `current` is selected: replaces for `single`, toggles for `multiple`, and anchors or closes a range for `range`. */ export declare function nextSelection(mode: CalendarSelectionMode, current: CalendarValue, date: Date): CalendarValue; /** @internal The live-region message for a selection change, or `''` when there is nothing worth announcing. */ export declare function selectionAnnouncement(value: CalendarValue, locale: string | undefined): string; export declare const CalendarProvider: React.FC, useCalendarContextInternal: (consumerName: string) => CalendarContextValue; /** Read the Calendar's current selection/displayed-month state (e.g. to render a heading label). */ export declare function useCalendarContext(): CalendarContextValue; /** @internal Which month a `CalendarGrid` renders; absent for a single-month calendar, where every part reads the root's `month`. */ export declare const CalendarGridContext: React.Context; /** The month of the enclosing `CalendarGrid`, falling back to the root's displayed month. */ export declare function useCalendarGridMonth(fallback: Date): Date; /** @internal This Calendar instance's own root element, scoping keyboard focus restoration's cell lookup to it. */ export declare const CalendarRootContext: React.Context | null>; /** @internal The date a fresh calendar should focus and display, given whatever `value` holds. */ export declare function anchorOf(value: CalendarValue): Date | null; /** * Root of a month-grid date picker that owns selection, displayed month(s), and roving focus, handing them to every `Calendar*` part via context. * * @example * ```tsx * * * ‹ * * › * * * * * {getVisibleWeeks(month).map((week, i) => ( * * {week.map(({ date }) => ( * * ))} * * ))} * * * * ``` */ export declare const Calendar: { ({ selectionMode, value: valueInput, defaultValue: defaultValueInput, onValueChange, month: monthInput, defaultMonth: defaultMonthInput, onMonthChange, focusedDate: focusedDateInput, defaultFocusedDate: defaultFocusedDateInput, onFocusChange, view: viewProp, defaultView, minView, maxView, onViewChange, numberOfMonths, locale, minDate: minDateInput, maxDate: maxDateInput, weekStartsOn: weekStartsOnProp, pageBehavior, weekNumbers, today: todayInput, readOnly, disabled, outsideDaySelectable, isDateDisabled: isDateDisabledProp, isDateUnavailable, getSelectionAnnouncement, getMonthAnnouncement, children, ref: forwardedRef, ...props }: CalendarProps): React.ReactNode; displayName: string; };