1 | import { CalendarDay } from "./classes/CalendarDay.js";
|
2 | import { CalendarMonth } from "./classes/CalendarMonth.js";
|
3 | import { DayPickerProps } from "./types/props.js";
|
4 | import type { SelectedValue, SelectHandler } from "./types/selection.js";
|
5 | import { ClassNames, CustomComponents, Formatters, Labels, Mode, Modifiers, Styles } from "./types/shared.js";
|
6 |
|
7 | export declare const dayPickerContext: import("react").Context<DayPickerContext<{
|
8 | mode?: Mode | undefined;
|
9 | required?: boolean | undefined;
|
10 | }> | undefined>;
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 | export type DayPickerContext<T extends {
|
20 | mode?: Mode | undefined;
|
21 | required?: boolean | undefined;
|
22 | }> = {
|
23 |
|
24 | months: CalendarMonth[];
|
25 |
|
26 | nextMonth: Date | undefined;
|
27 |
|
28 | previousMonth: Date | undefined;
|
29 |
|
30 | goToMonth: (month: Date) => void;
|
31 |
|
32 | getModifiers: (day: CalendarDay) => Modifiers;
|
33 |
|
34 | selected: SelectedValue<T> | undefined;
|
35 |
|
36 | select: SelectHandler<T> | undefined;
|
37 |
|
38 | isSelected: ((date: Date) => boolean) | undefined;
|
39 | /** The components used internally by DayPicker. */
|
40 | components: CustomComponents;
|
41 | /** The class names for the UI elements. */
|
42 | classNames: ClassNames;
|
43 | /** The styles for the UI elements. */
|
44 | styles: Partial<Styles> | undefined;
|
45 | /** The labels used in the user interface. */
|
46 | labels: Labels;
|
47 | /** The formatters used to format the UI elements. */
|
48 | formatters: Formatters;
|
49 | /**
|
50 | * The props as passed to the DayPicker component.
|
51 | *
|
52 | * @since 9.3.0
|
53 | */
|
54 | dayPickerProps: DayPickerProps;
|
55 | };
|
56 | /**
|
57 | * Returns the context to work with `<DayPicker />` inside custom components.
|
58 | *
|
59 | * This hook provides access to the DayPicker context, which includes various
|
60 | * properties and methods to interact with the DayPicker component. It must be
|
61 | * used within a custom component.
|
62 | *
|
63 | * @template T - Use this type to refine the returned context type with a
|
64 | * specific selection mode.
|
65 | * @returns {DayPickerContext<T>} The context to work with DayPicker.
|
66 | * @throws {Error} If the hook is used outside of a DayPicker provider.
|
67 | * @group Hooks
|
68 | * @see https://daypicker.dev/guides/custom-components
|
69 | */
|
70 | export declare function useDayPicker<T extends {
|
71 | mode?: Mode | undefined;
|
72 | required?: boolean | undefined;
|
73 | }>(): DayPickerContext<T>;
|
74 |
|
\ | No newline at end of file |