UNPKG

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