UNPKG

1.44 kBTypeScriptView Raw
1import { CalendarDay } from "./classes/CalendarDay.js";
2import { CalendarMonth } from "./classes/CalendarMonth.js";
3import type { DayPickerProps } from "./types/props.js";
4import type { SelectedValue, SelectHandler } from "./types/selection.js";
5import { Modifiers } from "./types/shared.js";
6/** @private */
7export declare const dayPickerContext: import("react").Context<DayPickerContext<DayPickerProps> | undefined>;
8export type DayPickerContext<T extends DayPickerProps> = {
9 /** The months displayed in the calendar. */
10 months: CalendarMonth[];
11 /** The next month to display. */
12 nextMonth: Date | undefined;
13 /** The previous month to display. */
14 previousMonth: Date | undefined;
15 /** Navigate to the specified month. Will fire the `onMonthChange` callback. */
16 goToMonth: (month: Date) => void;
17 /** Returns the modifiers for the given day. */
18 getModifiers: (day: CalendarDay) => Modifiers;
19 /** The selected date(s). */
20 selected: SelectedValue<T> | undefined;
21 /** Set a selection. */
22 select: SelectHandler<T> | undefined;
23 /** Whether the given date is selected. */
24 isSelected: ((date: Date) => boolean) | undefined;
25};
26/**
27 * Return the context to work with `<DayPicker />` inside custom components.
28 *
29 * @group Hooks
30 * @see https://daypicker.dev/guides/custom-components
31 */
32export declare function useDayPicker<T extends DayPickerProps>(props?: T): DayPickerContext<T>;
33
\No newline at end of file