UNPKG

3.47 kBTypeScriptView Raw
1/// <reference types="react" />
2import type { DayPickerProps, LocaleUtils } from "react-day-picker";
3import type { TimePickerProps } from "./timePickerProps";
4import type { TimePrecision } from "./timePrecision";
5/**
6 * Collection of functions that determine which modifier classes get applied to which days.
7 * See the [**react-day-picker** documentation](https://react-day-picker-v7.netlify.app/api/ModifiersUtils)
8 * to learn more.
9 */
10export interface DatePickerModifiers {
11 [name: string]: (date: Date) => boolean;
12}
13export interface DatePickerBaseProps {
14 /**
15 * Props to pass to ReactDayPicker. See API documentation
16 * [here](https://react-day-picker-v7.netlify.app/api/DayPicker).
17 *
18 * The following props are managed by the component and cannot be configured:
19 * `canChangeMonth`, `captionElement`, `fromMonth` (use `minDate`), `month` (use
20 * `initialMonth`), `toMonth` (use `maxDate`).
21 *
22 * In case of supplying your owner `renderDay` function, make sure to apply the appropriate
23 * CSS wrapper class to obtain default Blueprint styling.
24 * eg.
25 * `<div className={Classes.DATEPICKER_DAY_WRAPPER}>{CONTENT_HERE}</div>`
26 *
27 */
28 dayPickerProps?: DayPickerProps;
29 /**
30 * An additional element to show below the date picker.
31 */
32 footerElement?: React.JSX.Element;
33 /**
34 * Whether the current day should be highlighted in the calendar.
35 *
36 * @default false
37 */
38 highlightCurrentDay?: boolean;
39 /**
40 * The initial month the calendar displays.
41 */
42 initialMonth?: Date;
43 /**
44 * The locale name, which is passed to the functions in `localeUtils`
45 * (and `formatDate` and `parseDate` if supported).
46 */
47 locale?: string;
48 /**
49 * Collection of functions that provide internationalization support.
50 */
51 localeUtils?: typeof LocaleUtils;
52 /**
53 * The latest date the user can select.
54 *
55 * @default 6 months from now.
56 */
57 maxDate?: Date;
58 /**
59 * The earliest date the user can select.
60 *
61 * @default Jan. 1st, 20 years in the past.
62 */
63 minDate?: Date;
64 /**
65 * Collection of functions that determine which modifier classes get applied to which days.
66 * Each function should accept a `Date` and return a boolean.
67 * See the [**react-day-picker** documentation](https://react-day-picker-v7.netlify.app/api/ModifiersUtils)
68 * to learn more.
69 */
70 modifiers?: DatePickerModifiers;
71 /**
72 * If `true`, the month menu will appear to the left of the year menu.
73 * Otherwise, the month menu will apear to the right of the year menu.
74 *
75 * @default false
76 */
77 reverseMonthAndYearMenus?: boolean;
78 /**
79 * The precision of time selection that accompanies the calendar. Passing a
80 * `TimePrecision` value (or providing `timePickerProps`) shows a
81 * `TimePicker` below the calendar. Time is preserved across date changes.
82 *
83 * This is shorthand for `timePickerProps.precision` and is a quick way to
84 * enable time selection.
85 */
86 timePrecision?: TimePrecision;
87 /**
88 * Further configure the `TimePicker` that appears beneath the calendar.
89 * `onChange` and `value` are ignored in favor of the corresponding
90 * top-level props on this component.
91 *
92 * Passing any non-empty object to this prop will cause the `TimePicker` to appear.
93 */
94 timePickerProps?: TimePickerProps;
95}