react-day-picker 8.2.1 → 8.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (199) hide show
  1. package/dist/index.d.ts +1176 -40
  2. package/dist/index.esm.d.ts +1176 -0
  3. package/dist/index.esm.js +1473 -1496
  4. package/dist/index.esm.js.map +1 -1
  5. package/dist/index.js +1195 -1214
  6. package/dist/index.js.map +1 -1
  7. package/dist/react-day-picker.min.js +1 -1
  8. package/dist/style.css +9 -11
  9. package/dist/style.module.css +9 -11
  10. package/package.json +2 -2
  11. package/src/components/Caption/Caption.tsx +8 -8
  12. package/src/components/CaptionDropdowns/CaptionDropdowns.tsx +6 -4
  13. package/src/components/CaptionNavigation/CaptionNavigation.tsx +6 -8
  14. package/src/components/Dropdown/Dropdown.tsx +5 -5
  15. package/src/components/Head/Head.tsx +6 -4
  16. package/src/components/HeadRow/HeadRow.tsx +2 -1
  17. package/src/components/HeadRow/utils/getWeekdays.test.ts +10 -0
  18. package/src/components/HeadRow/utils/getWeekdays.ts +9 -3
  19. package/src/components/Month/Month.test.tsx +11 -0
  20. package/src/components/Month/Month.tsx +12 -6
  21. package/src/components/MonthsDropdown/MonthsDropdown.tsx +3 -6
  22. package/src/components/Navigation/Navigation.tsx +5 -15
  23. package/src/components/Row/Row.tsx +8 -8
  24. package/src/components/Table/Table.tsx +10 -12
  25. package/src/components/Table/utils/daysToMonthWeeks.ts +15 -3
  26. package/src/components/Table/utils/getMonthWeeks.test.ts +33 -1
  27. package/src/components/Table/utils/getMonthWeeks.ts +2 -3
  28. package/src/components/YearsDropdown/YearsDropdown.tsx +3 -6
  29. package/src/contexts/DayPicker/{useDayPicker.test.ts → DayPickerContext.test.ts} +13 -29
  30. package/src/contexts/DayPicker/DayPickerContext.tsx +41 -53
  31. package/src/contexts/DayPicker/defaultContextValues.ts +85 -0
  32. package/src/contexts/DayPicker/index.ts +0 -1
  33. package/src/contexts/Focus/{useFocusContext.test.ts → FocusContext.test.ts} +0 -0
  34. package/src/contexts/Focus/FocusContext.tsx +19 -6
  35. package/src/contexts/Focus/index.ts +0 -1
  36. package/src/contexts/Focus/utils/getInitialFocusTarget.test.tsx +37 -8
  37. package/src/contexts/Focus/utils/getInitialFocusTarget.tsx +0 -1
  38. package/src/contexts/Focus/utils/getNextFocus.test.tsx +75 -50
  39. package/src/contexts/Focus/utils/getNextFocus.tsx +54 -19
  40. package/src/contexts/Modifiers/{useModifiers.test.ts → ModifiersContext.test.ts} +0 -0
  41. package/src/contexts/Modifiers/ModifiersContext.tsx +16 -1
  42. package/src/contexts/Modifiers/index.ts +1 -1
  43. package/src/contexts/Modifiers/utils/getInternalModifiers.test.ts +3 -2
  44. package/src/contexts/Navigation/{useNavigation.test.ts → NavigationContext.test.ts} +1 -2
  45. package/src/contexts/Navigation/NavigationContext.tsx +15 -1
  46. package/src/contexts/Navigation/index.ts +0 -1
  47. package/src/contexts/SelectMultiple/{useSelectMultiple.test.ts → SelectMultipleContext.test.ts} +4 -2
  48. package/src/contexts/SelectMultiple/SelectMultipleContext.tsx +16 -1
  49. package/src/contexts/SelectMultiple/index.ts +0 -1
  50. package/src/contexts/SelectRange/{useSelectRange.test.ts → SelectRangeContext.test.ts} +4 -21
  51. package/src/contexts/SelectRange/SelectRangeContext.tsx +51 -36
  52. package/src/contexts/SelectRange/index.ts +0 -1
  53. package/src/contexts/SelectSingle/{useSelectSingle.test.ts → SelectSingleContext.test.ts} +1 -1
  54. package/src/contexts/SelectSingle/SelectSingleContext.tsx +16 -1
  55. package/src/contexts/SelectSingle/index.ts +0 -1
  56. package/src/hooks/useDayRender/useDayRender.tsx +5 -4
  57. package/src/style.css +9 -11
  58. package/src/types/DayPickerBase.ts +33 -6
  59. package/src/types/EventHandlers.ts +9 -11
  60. package/dist/DayPicker.d.ts +0 -93
  61. package/dist/components/Button/Button.d.ts +0 -7
  62. package/dist/components/Button/index.d.ts +0 -1
  63. package/dist/components/Caption/Caption.d.ts +0 -19
  64. package/dist/components/Caption/index.d.ts +0 -1
  65. package/dist/components/CaptionDropdowns/CaptionDropdowns.d.ts +0 -5
  66. package/dist/components/CaptionDropdowns/index.d.ts +0 -1
  67. package/dist/components/CaptionLabel/CaptionLabel.d.ts +0 -9
  68. package/dist/components/CaptionLabel/index.d.ts +0 -1
  69. package/dist/components/CaptionNavigation/CaptionNavigation.d.ts +0 -5
  70. package/dist/components/CaptionNavigation/index.d.ts +0 -1
  71. package/dist/components/Day/Day.d.ts +0 -12
  72. package/dist/components/Day/index.d.ts +0 -1
  73. package/dist/components/DayContent/DayContent.d.ts +0 -12
  74. package/dist/components/DayContent/index.d.ts +0 -1
  75. package/dist/components/Dropdown/Dropdown.d.ts +0 -20
  76. package/dist/components/Dropdown/index.d.ts +0 -1
  77. package/dist/components/Footer/Footer.d.ts +0 -2
  78. package/dist/components/Footer/index.d.ts +0 -1
  79. package/dist/components/Head/Head.d.ts +0 -2
  80. package/dist/components/Head/index.d.ts +0 -1
  81. package/dist/components/HeadRow/HeadRow.d.ts +0 -4
  82. package/dist/components/HeadRow/index.d.ts +0 -1
  83. package/dist/components/HeadRow/utils/getWeekdays.d.ts +0 -8
  84. package/dist/components/HeadRow/utils/index.d.ts +0 -1
  85. package/dist/components/IconDropdown/IconDropdown.d.ts +0 -5
  86. package/dist/components/IconDropdown/index.d.ts +0 -1
  87. package/dist/components/IconLeft/IconLeft.d.ts +0 -5
  88. package/dist/components/IconLeft/index.d.ts +0 -1
  89. package/dist/components/IconRight/IconRight.d.ts +0 -5
  90. package/dist/components/IconRight/index.d.ts +0 -1
  91. package/dist/components/Month/Month.d.ts +0 -7
  92. package/dist/components/Month/index.d.ts +0 -1
  93. package/dist/components/MonthsDropdown/MonthsDropdown.d.ts +0 -9
  94. package/dist/components/MonthsDropdown/index.d.ts +0 -1
  95. package/dist/components/Navigation/Navigation.d.ts +0 -20
  96. package/dist/components/Navigation/index.d.ts +0 -1
  97. package/dist/components/Root/Root.d.ts +0 -2
  98. package/dist/components/Root/index.d.ts +0 -1
  99. package/dist/components/Row/Row.d.ts +0 -13
  100. package/dist/components/Row/index.d.ts +0 -1
  101. package/dist/components/Table/Table.d.ts +0 -9
  102. package/dist/components/Table/index.d.ts +0 -1
  103. package/dist/components/Table/utils/daysToMonthWeeks.d.ts +0 -8
  104. package/dist/components/Table/utils/getMonthWeeks.d.ts +0 -21
  105. package/dist/components/WeekNumber/WeekNumber.d.ts +0 -14
  106. package/dist/components/WeekNumber/index.d.ts +0 -1
  107. package/dist/components/YearsDropdown/YearsDropdown.d.ts +0 -15
  108. package/dist/components/YearsDropdown/index.d.ts +0 -1
  109. package/dist/contexts/DayPicker/DayPickerContext.d.ts +0 -50
  110. package/dist/contexts/DayPicker/defaultClassNames.d.ts +0 -5
  111. package/dist/contexts/DayPicker/defaultContextValue.d.ts +0 -6
  112. package/dist/contexts/DayPicker/formatters/formatCaption.d.ts +0 -7
  113. package/dist/contexts/DayPicker/formatters/formatDay.d.ts +0 -7
  114. package/dist/contexts/DayPicker/formatters/formatMonthCaption.d.ts +0 -7
  115. package/dist/contexts/DayPicker/formatters/formatWeekNumber.d.ts +0 -4
  116. package/dist/contexts/DayPicker/formatters/formatWeekdayName.d.ts +0 -7
  117. package/dist/contexts/DayPicker/formatters/formatYearCaption.d.ts +0 -6
  118. package/dist/contexts/DayPicker/formatters/index.d.ts +0 -6
  119. package/dist/contexts/DayPicker/index.d.ts +0 -2
  120. package/dist/contexts/DayPicker/labels/index.d.ts +0 -7
  121. package/dist/contexts/DayPicker/labels/labelDay.d.ts +0 -5
  122. package/dist/contexts/DayPicker/labels/labelMonthDropdown.d.ts +0 -4
  123. package/dist/contexts/DayPicker/labels/labelNext.d.ts +0 -5
  124. package/dist/contexts/DayPicker/labels/labelPrevious.d.ts +0 -5
  125. package/dist/contexts/DayPicker/labels/labelWeekNumber.d.ts +0 -5
  126. package/dist/contexts/DayPicker/labels/labelWeekday.d.ts +0 -5
  127. package/dist/contexts/DayPicker/labels/labelYearDropdown.d.ts +0 -4
  128. package/dist/contexts/DayPicker/useDayPicker.d.ts +0 -8
  129. package/dist/contexts/DayPicker/utils/index.d.ts +0 -1
  130. package/dist/contexts/DayPicker/utils/parseFromToProps.d.ts +0 -6
  131. package/dist/contexts/Focus/FocusContext.d.ts +0 -36
  132. package/dist/contexts/Focus/index.d.ts +0 -2
  133. package/dist/contexts/Focus/useFocusContext.d.ts +0 -8
  134. package/dist/contexts/Focus/utils/getInitialFocusTarget.d.ts +0 -3
  135. package/dist/contexts/Focus/utils/getNextFocus.d.ts +0 -9
  136. package/dist/contexts/Modifiers/ModifiersContext.d.ts +0 -9
  137. package/dist/contexts/Modifiers/index.d.ts +0 -2
  138. package/dist/contexts/Modifiers/useModifiers.d.ts +0 -9
  139. package/dist/contexts/Modifiers/utils/getActiveModifiers.d.ts +0 -7
  140. package/dist/contexts/Modifiers/utils/getCustomModifiers.d.ts +0 -3
  141. package/dist/contexts/Modifiers/utils/getInternalModifiers.d.ts +0 -6
  142. package/dist/contexts/Modifiers/utils/isDateInRange.d.ts +0 -3
  143. package/dist/contexts/Modifiers/utils/isMatch.d.ts +0 -19
  144. package/dist/contexts/Modifiers/utils/matcherToArray.d.ts +0 -3
  145. package/dist/contexts/Navigation/NavigationContext.d.ts +0 -27
  146. package/dist/contexts/Navigation/index.d.ts +0 -2
  147. package/dist/contexts/Navigation/useNavigation.d.ts +0 -8
  148. package/dist/contexts/Navigation/useNavigationState.d.ts +0 -7
  149. package/dist/contexts/Navigation/utils/getDisplayMonths.d.ts +0 -8
  150. package/dist/contexts/Navigation/utils/getInitialMonth.d.ts +0 -3
  151. package/dist/contexts/Navigation/utils/getNextMonth.d.ts +0 -18
  152. package/dist/contexts/Navigation/utils/getPreviousMonth.d.ts +0 -19
  153. package/dist/contexts/RootProvider.d.ts +0 -8
  154. package/dist/contexts/SelectMultiple/SelectMultipleContext.d.ts +0 -35
  155. package/dist/contexts/SelectMultiple/index.d.ts +0 -2
  156. package/dist/contexts/SelectMultiple/useSelectMultiple.d.ts +0 -7
  157. package/dist/contexts/SelectRange/SelectRangeContext.d.ts +0 -36
  158. package/dist/contexts/SelectRange/index.d.ts +0 -2
  159. package/dist/contexts/SelectRange/useSelectRange.d.ts +0 -7
  160. package/dist/contexts/SelectRange/utils/addToRange.d.ts +0 -8
  161. package/dist/contexts/SelectSingle/SelectSingleContext.d.ts +0 -30
  162. package/dist/contexts/SelectSingle/index.d.ts +0 -2
  163. package/dist/contexts/SelectSingle/useSelectSingle.d.ts +0 -7
  164. package/dist/hooks/useActiveModifiers/index.d.ts +0 -1
  165. package/dist/hooks/useActiveModifiers/useActiveModifiers.d.ts +0 -15
  166. package/dist/hooks/useControlledValue/index.d.ts +0 -1
  167. package/dist/hooks/useControlledValue/useControlledValue.d.ts +0 -12
  168. package/dist/hooks/useDayEventHandlers/index.d.ts +0 -1
  169. package/dist/hooks/useDayEventHandlers/useDayEventHandlers.d.ts +0 -26
  170. package/dist/hooks/useDayRender/index.d.ts +0 -1
  171. package/dist/hooks/useDayRender/useDayRender.d.ts +0 -32
  172. package/dist/hooks/useDayRender/utils/getDayClassNames.d.ts +0 -10
  173. package/dist/hooks/useDayRender/utils/getDayStyle.d.ts +0 -5
  174. package/dist/hooks/useId/index.d.ts +0 -1
  175. package/dist/hooks/useId/useId.d.ts +0 -19
  176. package/dist/hooks/useInput/index.d.ts +0 -1
  177. package/dist/hooks/useInput/useInput.d.ts +0 -28
  178. package/dist/hooks/useInput/utils/isValidDate.d.ts +0 -2
  179. package/dist/hooks/useSelectedDays/index.d.ts +0 -1
  180. package/dist/hooks/useSelectedDays/useSelectedDays.d.ts +0 -10
  181. package/dist/types/DayPickerBase.d.ts +0 -255
  182. package/dist/types/DayPickerDefault.d.ts +0 -8
  183. package/dist/types/DayPickerMultiple.d.ts +0 -18
  184. package/dist/types/DayPickerRange.d.ts +0 -19
  185. package/dist/types/DayPickerSingle.d.ts +0 -16
  186. package/dist/types/EventHandlers.d.ts +0 -51
  187. package/dist/types/Formatters.d.ts +0 -24
  188. package/dist/types/Labels.d.ts +0 -28
  189. package/dist/types/Matchers.d.ts +0 -84
  190. package/dist/types/Modifiers.d.ts +0 -49
  191. package/dist/types/Styles.d.ts +0 -102
  192. package/src/contexts/DayPicker/defaultContextValue.ts +0 -37
  193. package/src/contexts/DayPicker/useDayPicker.ts +0 -17
  194. package/src/contexts/Focus/useFocusContext.ts +0 -17
  195. package/src/contexts/Modifiers/useModifiers.ts +0 -20
  196. package/src/contexts/Navigation/useNavigation.ts +0 -17
  197. package/src/contexts/SelectMultiple/useSelectMultiple.ts +0 -21
  198. package/src/contexts/SelectRange/useSelectRange.ts +0 -19
  199. package/src/contexts/SelectSingle/useSelectSingle.ts +0 -21
package/dist/index.d.ts CHANGED
@@ -1,40 +1,1176 @@
1
- export * from './DayPicker';
2
- export * from './components/Button';
3
- export * from './components/Caption';
4
- export * from './components/CaptionDropdowns';
5
- export * from './components/CaptionLabel';
6
- export * from './components/CaptionNavigation';
7
- export * from './components/Day';
8
- export * from './components/DayContent';
9
- export * from './components/Dropdown';
10
- export * from './components/Footer';
11
- export * from './components/Head';
12
- export * from './components/HeadRow';
13
- export * from './components/IconDropdown';
14
- export * from './components/IconRight';
15
- export * from './components/IconLeft';
16
- export * from './components/Row';
17
- export * from './components/WeekNumber';
18
- export * from './hooks/useInput';
19
- export * from './hooks/useDayRender';
20
- export * from './hooks/useActiveModifiers';
21
- export * from './contexts/DayPicker';
22
- export * from './contexts/Focus';
23
- export * from './contexts/Navigation';
24
- export * from './contexts/RootProvider';
25
- export * from './contexts/SelectMultiple';
26
- export * from './contexts/SelectRange';
27
- export * from './contexts/SelectSingle';
28
- export * from './types/DayPickerBase';
29
- export * from './types/DayPickerDefault';
30
- export * from './types/DayPickerMultiple';
31
- export * from './types/DayPickerRange';
32
- export * from './types/DayPickerSingle';
33
- export * from './types/EventHandlers';
34
- export * from './types/Formatters';
35
- export * from './types/Labels';
36
- export * from './types/Matchers';
37
- export * from './types/Modifiers';
38
- export * from './types/Styles';
39
- export * from './contexts/Modifiers/utils/isMatch';
40
- export * from './contexts/SelectRange/utils/addToRange';
1
+ /// <reference types="react" />
2
+ import { Locale } from "date-fns";
3
+ import React from "react";
4
+ import { ReactNode, HTMLProps } from "react";
5
+ /** Represent the props of the {@link Caption} component. */
6
+ interface CaptionProps {
7
+ /** The ID for the heading element. Must be the same as the labelled-by in Table. */
8
+ id?: string;
9
+ /** The month where the caption is displayed. */
10
+ displayMonth: Date;
11
+ }
12
+ /**
13
+ * The layout of the caption:
14
+ *
15
+ * - `dropdown`: display dropdowns for choosing the month and the year.
16
+ * - `buttons`: display previous month / next month buttons.
17
+ */
18
+ type CaptionLayout = "dropdown" | "buttons";
19
+ /**
20
+ * Render the caption of a month. The caption has a different layout when
21
+ * setting the {@link DayPickerBase.captionLayout} prop.
22
+ */
23
+ declare function Caption(props: CaptionProps): JSX.Element;
24
+ /** The props for the {@link CaptionLabel} component. */
25
+ interface CaptionLabelProps {
26
+ /** The ID for the heading element. Must be the same as the labelled-by in Table. */
27
+ id?: string;
28
+ /** The month where the caption is displayed. */
29
+ displayMonth: Date;
30
+ }
31
+ /** Render the caption for the displayed month. This component is used when `captionLayout="buttons"`. */
32
+ declare function CaptionLabel(props: CaptionLabelProps): JSX.Element;
33
+ /** Represent the props used by the {@link Day} component. */
34
+ interface DayProps {
35
+ /** The month where the date is displayed. */
36
+ displayMonth: Date;
37
+ /** The date to render. */
38
+ date: Date;
39
+ }
40
+ /**
41
+ * The content of a day cell – as a button or span element according to its
42
+ * modifiers.
43
+ */
44
+ declare function Day(props: DayProps): JSX.Element;
45
+ /**
46
+ * A value or a function that matches a specific day.
47
+ *
48
+ *
49
+ * Matchers are passed to DayPicker via {@link DayPickerBase.disabled},
50
+ * {@link DayPickerBase.hidden]] or [[DayPickerProps.selected} and are used to
51
+ * determine if a day should get a {@link Modifier}.
52
+ *
53
+ * Matchers can be of different types:
54
+ *
55
+ * ```
56
+ * // will always match the day
57
+ * const booleanMatcher: Matcher = true;
58
+ *
59
+ * // will match the today's date
60
+ * const dateMatcher: Matcher = new Date();
61
+ *
62
+ * // will match the days in the array
63
+ * const arrayMatcher: Matcher = [new Date(2019, 1, 2);, new Date(2019, 1, 4)];
64
+ *
65
+ * // will match days after the 2nd of February 2019
66
+ * const afterMatcher: DateAfter = { after: new Date(2019, 1, 2); };
67
+ * // will match days before the 2nd of February 2019 }
68
+ * const beforeMatcher: DateBefore = { before: : new Date(2019, 1, 2); };
69
+ *
70
+ * // will match Sundays
71
+ * const dayOfWeekMatcher: DayOfWeek = {
72
+ * dayOfWeek: 0
73
+ * };
74
+ *
75
+ * // will match the included days, except the two dates
76
+ * const intervalMatcher: DateInterval = {
77
+ * after: new Date(2019, 1, 2);,
78
+ * before: new Date(2019, 1, 5)
79
+ * };
80
+ *
81
+ * // will match the included days, including the two dates
82
+ * const rangeMatcher: DateRange = {
83
+ * from: new Date(2019, 1, 2);,
84
+ * to: new Date(2019, 1, 5)
85
+ * };
86
+ *
87
+ * // will match when the function return true
88
+ * const functionMatcher: Matcher = (day: Date) => {
89
+ * return day.getMonth() === 2 // match when month is March
90
+ * };
91
+ * ```
92
+ *
93
+ * @see {@link isMatch}
94
+ *
95
+ * */
96
+ type Matcher = boolean | ((date: Date) => boolean) | Date | Date[] | DateRange | DateBefore | DateAfter | DateInterval | DayOfWeek;
97
+ /** A matcher to match a day falling after the specified date, with the date not included. */
98
+ type DateAfter = {
99
+ after: Date;
100
+ };
101
+ /** A matcher to match a day falling before the specified date, with the date not included. */
102
+ type DateBefore = {
103
+ before: Date;
104
+ };
105
+ /** A matcher to match a day falling before and after two dates, where the dates are not included. */
106
+ type DateInterval = {
107
+ before: Date;
108
+ after: Date;
109
+ };
110
+ /** A matcher to match a range of dates. The range can be open. Differently from {@link DateInterval}, the dates here are included. */
111
+ type DateRange = {
112
+ from: Date | undefined;
113
+ to?: Date | undefined;
114
+ };
115
+ /** A matcher to match a date being one of the specified days of the week (`0-7`, where `0` is Sunday). */
116
+ type DayOfWeek = {
117
+ dayOfWeek: number[];
118
+ };
119
+ /** Returns true if `matcher` is of type {@link DateInterval}. */
120
+ declare function isDateInterval(matcher: unknown): matcher is DateInterval;
121
+ /** Returns true if `value` is a {@link DateRange} type. */
122
+ declare function isDateRange(value: unknown): value is DateRange;
123
+ /** Returns true if `value` is of type {@link DateAfter}. */
124
+ declare function isDateAfterType(value: unknown): value is DateAfter;
125
+ /** Returns true if `value` is of type {@link DateBefore}. */
126
+ declare function isDateBeforeType(value: unknown): value is DateBefore;
127
+ /** Returns true if `value` is a {@link DayOfWeek} type. */
128
+ declare function isDayOfWeekType(value: unknown): value is DayOfWeek;
129
+ /** A _modifier_ represents different styles or states of a day displayed in the calendar. */
130
+ type Modifier = string;
131
+ /** The modifiers used by DayPicker. */
132
+ type Modifiers = CustomModifiers & InternalModifiers;
133
+ /** The name of the modifiers that are used internally by DayPicker. */
134
+ declare enum InternalModifier {
135
+ Outside = "outside",
136
+ /** Name of the modifier applied to the disabled days, using the `disabled` prop. */
137
+ Disabled = "disabled",
138
+ /** Name of the modifier applied to the selected days using the `selected` prop). */
139
+ Selected = "selected",
140
+ /** Name of the modifier applied to the hidden days using the `hidden` prop). */
141
+ Hidden = "hidden",
142
+ /** Name of the modifier applied to the day specified using the `today` prop). */
143
+ Today = "today",
144
+ /** The modifier applied to the day starting a selected range, when in range selection mode. */
145
+ RangeStart = "range_start",
146
+ /** The modifier applied to the day ending a selected range, when in range selection mode. */
147
+ RangeEnd = "range_end",
148
+ /** The modifier applied to the days between the start and the end of a selected range, when in range selection mode. */
149
+ RangeMiddle = "range_middle"
150
+ }
151
+ /** Map of matchers used for the internal modifiers. */
152
+ type InternalModifiers = Record<InternalModifier, Matcher[]>;
153
+ /**
154
+ * The modifiers that are matching a day in the calendar. Use the {@link useActiveModifiers} hook to get the modifiers for a day.
155
+ *
156
+ * ```
157
+ * const activeModifiers: ActiveModifiers = {
158
+ * selected: true,
159
+ * customModifier: true
160
+ * }
161
+ * ```
162
+ *
163
+ * */
164
+ type ActiveModifiers = Record<Modifier, true> & Partial<Record<InternalModifier, true>>;
165
+ /** The style to apply to each day element matching a modifier. */
166
+ type ModifiersStyles = Record<Modifier, React.CSSProperties> & Partial<Record<InternalModifier, React.CSSProperties>>;
167
+ /** The classnames to assign to each day element matching a modifier. */
168
+ type ModifiersClassNames = Record<Modifier, string> & Partial<Record<InternalModifier, string>>;
169
+ /** The custom modifiers passed to the {@link DayPickerBase.modifiers}. */
170
+ type DayModifiers = Record<Modifier, Matcher | Matcher[]>;
171
+ /**
172
+ * A map of matchers used as custom modifiers by DayPicker component. This is
173
+ * the same as {@link DayModifiers]], but it accepts only array of [[Matcher}s.
174
+ */
175
+ type CustomModifiers = Record<Modifier, Matcher[]>;
176
+ /** Represent the props for the {@link DayContent} component. */
177
+ interface DayContentProps {
178
+ /** The date representing the day. */
179
+ date: Date;
180
+ /** The month where the day is displayed. */
181
+ displayMonth: Date;
182
+ /** The active modifiers for the given date. */
183
+ activeModifiers: ActiveModifiers;
184
+ }
185
+ /** Render the content of the day cell. */
186
+ declare function DayContent(props: DayContentProps): JSX.Element;
187
+ /** The props for the {@link Dropdown} component. */
188
+ interface DropdownProps {
189
+ /** The name attribute of the element. */
190
+ name?: string;
191
+ /** The caption displayed to replace the hidden select. */
192
+ caption?: React.ReactNode;
193
+ children?: React.SelectHTMLAttributes<HTMLSelectElement>["children"];
194
+ className?: string;
195
+ ["aria-label"]?: string;
196
+ style?: React.CSSProperties;
197
+ /** The selected value. */
198
+ value?: string | number;
199
+ onChange?: React.ChangeEventHandler<HTMLSelectElement>;
200
+ }
201
+ /**
202
+ * Render a styled select component – displaying a caption and a custom
203
+ * drop-down icon.
204
+ */
205
+ declare function Dropdown(props: DropdownProps): JSX.Element;
206
+ /**
207
+ * The props for the {@link Row} component.
208
+ */
209
+ interface RowProps {
210
+ /** The month where the row is displayed. */
211
+ displayMonth: Date;
212
+ /** The number of the week to render. */
213
+ weekNumber: number;
214
+ /** The days contained in the week. */
215
+ dates: Date[];
216
+ }
217
+ /** Render a row in the calendar, with the days and the week number. */
218
+ declare function Row(props: RowProps): JSX.Element;
219
+ /**
220
+ * The props for the {@link WeekNumber} component.
221
+ */
222
+ interface WeekNumberProps {
223
+ /** The number of the week. */
224
+ number: number;
225
+ /** The dates in the week. */
226
+ dates: Date[];
227
+ }
228
+ /**
229
+ * Render the week number element. If `onWeekNumberClick` is passed to DayPicker, it
230
+ * renders a button, otherwise a span element.
231
+ */
232
+ declare function WeekNumber(props: WeekNumberProps): JSX.Element;
233
+ /** The event handler when a day is clicked. */
234
+ type DayClickEventHandler = (day: Date, activeModifiers: ActiveModifiers, e: React.MouseEvent) => void;
235
+ /** The event handler when a day is focused. */
236
+ type DayFocusEventHandler = (day: Date, activeModifiers: ActiveModifiers, e: React.FocusEvent | React.KeyboardEvent) => void;
237
+ /** The event handler when a day gets a keyboard event. */
238
+ type DayKeyboardEventHandler = (day: Date, activeModifiers: ActiveModifiers, e: React.KeyboardEvent) => void;
239
+ /** The event handler when a day gets a mouse event. */
240
+ type DayMouseEventHandler = (day: Date, activeModifiers: ActiveModifiers, e: React.MouseEvent) => void;
241
+ /** The event handler when a month is changed in the calendar. */
242
+ type MonthChangeEventHandler = (month: Date) => void;
243
+ /** The event handler when selecting multiple days. */
244
+ type SelectMultipleEventHandler = (/** The selected days */
245
+ days: Date[] | undefined, /** The day that was clicked triggering the event. */
246
+ selectedDay: Date, /** The day that was clicked */
247
+ activeModifiers: ActiveModifiers, /** The mouse event that triggered this event. */
248
+ e: React.MouseEvent) => void;
249
+ /** The event handler when selecting a range of days. */
250
+ type SelectRangeEventHandler = (/** The current range of the selected days. */
251
+ range: DateRange | undefined, /** The day that was selected (or clicked) triggering the event. */
252
+ selectedDay: Date, /** The modifiers of the selected day. */
253
+ activeModifiers: ActiveModifiers, e: React.MouseEvent) => void;
254
+ /** The event handler when selecting a single day. */
255
+ type SelectSingleEventHandler = (/** The selected day, `undefined` when `required={false}` (default) and the day is clicked again. */
256
+ day: Date | undefined, /** The day that was selected (or clicked) triggering the event. */
257
+ selectedDay: Date, /** The modifiers of the selected day. */
258
+ activeModifiers: ActiveModifiers, e: React.MouseEvent) => void;
259
+ /**The event handler when the week number is clicked. */
260
+ type WeekNumberClickEventHandler = (/** The week number that has been clicked. */
261
+ weekNumber: number, /** The dates in the clicked week. */
262
+ dates: Date[], /** The mouse event that triggered this event. */
263
+ e: React.MouseEvent) => void;
264
+ /** The event handler when a day gets a touch event. */
265
+ type DayTouchEventHandler = (day: Date, activeModifiers: ActiveModifiers, e: React.TouchEvent) => void;
266
+ /** Represents a function to format a date. */
267
+ type DateFormatter = (date: Date, options?: {
268
+ locale?: Locale;
269
+ }) => React.ReactNode;
270
+ /** Represent a map of formatters used to render localized content. */
271
+ type Formatters = {
272
+ /** Format the month in the caption when `captionLayout` is `buttons`. */
273
+ formatCaption: DateFormatter;
274
+ /** Format the month in the navigation dropdown. */
275
+ formatMonthCaption: DateFormatter;
276
+ /** Format the year in the navigation dropdown. */
277
+ formatYearCaption: DateFormatter;
278
+ /** Format the day in the day cell. */
279
+ formatDay: DateFormatter;
280
+ /** Format the week number. */
281
+ formatWeekNumber: WeekNumberFormatter;
282
+ /** Format the week day name in the header */
283
+ formatWeekdayName: DateFormatter;
284
+ };
285
+ /** Represent a function to format the week number. */
286
+ type WeekNumberFormatter = (weekNumber: number, options?: {
287
+ locale?: Locale;
288
+ }) => React.ReactNode;
289
+ /** Map of functions to translate ARIA labels for the relative elements. */
290
+ type Labels = {
291
+ labelMonthDropdown: () => string;
292
+ labelYearDropdown: () => string;
293
+ labelNext: NavButtonLabel;
294
+ labelPrevious: NavButtonLabel;
295
+ labelDay: DayLabel;
296
+ labelWeekday: WeekdayLabel;
297
+ labelWeekNumber: WeekNumberLabel;
298
+ };
299
+ /** Return the ARIA label for the {@link Day} component. */
300
+ type DayLabel = (day: Date, activeModifiers: ActiveModifiers, options?: {
301
+ locale?: Locale;
302
+ }) => string;
303
+ /** Return the ARIA label for the "next month" / "prev month" buttons in the navigation.*/
304
+ type NavButtonLabel = (month?: Date, options?: {
305
+ locale?: Locale;
306
+ }) => string;
307
+ /** Return the ARIA label for the Head component.*/
308
+ type WeekdayLabel = (day: Date, options?: {
309
+ locale?: Locale;
310
+ }) => string;
311
+ /** Return the ARIA label of the week number.*/
312
+ type WeekNumberLabel = (n: number, options?: {
313
+ locale?: Locale;
314
+ }) => string;
315
+ /** The style (either via class names or via in-line styles) of an element. */
316
+ type StyledElement<T> = {
317
+ /** The root element. */
318
+ readonly root: T;
319
+ /** The root element when `numberOfMonths > 1`. */
320
+ readonly multiple_months: T;
321
+ /** The root element when `showWeekNumber={true}`. */
322
+ readonly with_weeknumber: T;
323
+ /** The style of an element visually hidden. */
324
+ readonly vhidden: T;
325
+ /** The style for resetting the buttons. */
326
+ readonly button_reset: T;
327
+ /** The buttons. */
328
+ readonly button: T;
329
+ /** The caption (showing the calendar heading and the navigation) */
330
+ readonly caption: T;
331
+ /** The caption when at the start of a series of months. */
332
+ readonly caption_start: T;
333
+ /** The caption when at the end of a series of months. */
334
+ readonly caption_end: T;
335
+ /** The caption when between two months (when `multipleMonths > 2`). */
336
+ readonly caption_between: T;
337
+ /** The caption label. */
338
+ readonly caption_label: T;
339
+ /** The drop-downs container. */
340
+ readonly caption_dropdowns: T;
341
+ /** The drop-down (select) element. */
342
+ readonly dropdown: T;
343
+ /** The drop-down to change the month. */
344
+ readonly dropdown_month: T;
345
+ /** The drop-down to change the year. */
346
+ readonly dropdown_year: T;
347
+ /** The drop-down icon. */
348
+ readonly dropdown_icon: T;
349
+ /** The months wrapper. */
350
+ readonly months: T;
351
+ /** The table wrapper. */
352
+ readonly month: T;
353
+ /** Table containing the monthly calendar. */
354
+ readonly table: T;
355
+ /** The table body. */
356
+ readonly tbody: T;
357
+ /** The table footer. */
358
+ readonly tfoot: T;
359
+ /** The table’s head. */
360
+ readonly head: T;
361
+ /** The row in the head. */
362
+ readonly head_row: T;
363
+ /** The head cell. */
364
+ readonly head_cell: T;
365
+ /** The navigation container. */
366
+ readonly nav: T;
367
+ /** The navigation button. */
368
+ readonly nav_button: T;
369
+ /** The "previous month" navigation button. */
370
+ readonly nav_button_previous: T;
371
+ /** The "next month" navigation button. */
372
+ readonly nav_button_next: T;
373
+ /** The icon for the navigation button. */
374
+ readonly nav_icon: T;
375
+ /** The table’s row. */
376
+ readonly row: T;
377
+ /** The weeknumber displayed in the column. */
378
+ readonly weeknumber: T;
379
+ /** The table cell containing the day element. */
380
+ readonly cell: T;
381
+ /** The day element: it is a `span` when not interactive, a `button` otherwise. */
382
+ readonly day: T;
383
+ /** The day when outside the month. */
384
+ readonly day_outside: T;
385
+ /** The day when selected. */
386
+ readonly day_selected: T;
387
+ /** The day when disabled. */
388
+ readonly day_disabled: T;
389
+ /** The day when hidden. */
390
+ readonly day_hidden: T;
391
+ /** The day when at the start of a selected range. */
392
+ readonly day_range_start: T;
393
+ /** The day when at the end of a selected range. */
394
+ readonly day_range_end: T;
395
+ /** The day in the middle of a selected range: it does not include the "from" and the "to" days. */
396
+ readonly day_range_middle: T;
397
+ /** The day when today. */
398
+ readonly day_today: T;
399
+ };
400
+ /** These elements must not be in the `styles` or `classNames` records as they are styled via the `modifiersStyles` or `modifiersClassNames` pop */
401
+ type InternalModifiersElement = "day_outside" | "day_selected" | "day_disabled" | "day_hidden" | "day_range_start" | "day_range_end" | "day_range_middle" | "day_today";
402
+ /** The class names of each element. */
403
+ type ClassNames = Partial<StyledElement<string>>;
404
+ /**
405
+ * The inline-styles of each styled element, to use with the `styles` prop. Day
406
+ * modifiers, such as `today` or `hidden`, should be styled using the
407
+ * `modifiersStyles` prop.
408
+ */
409
+ type Styles = Partial<Omit<StyledElement<React.CSSProperties>, InternalModifiersElement>>;
410
+ /** Props of a component that can be styled via classNames or inline-styles. */
411
+ type StyledComponent = {
412
+ className?: string;
413
+ style?: React.CSSProperties;
414
+ children?: React.ReactNode;
415
+ };
416
+ /**
417
+ * Selection modes supported by DayPicker.
418
+ *
419
+ * - `single`: use DayPicker to select single days.
420
+ * - `multiple`: allow selecting multiple days.
421
+ * - `range`: use DayPicker to select a range of days
422
+ * - `default`: disable the built-in selection behavior. Customize what is selected by using {@link DayPickerBase.onDayClick}.
423
+ */
424
+ type DaySelectionMode = "single" | "multiple" | "range" | "default";
425
+ /**
426
+ * The base props for the {@link DayPicker} component and the {@link DayPickerContext}.
427
+ */
428
+ interface DayPickerBase {
429
+ /** The CSS class to add to the container element. To change the name of the class instead, use `classNames.root`. */
430
+ className?: string;
431
+ /**
432
+ * Change the class names of the HTML elements.
433
+ *
434
+ * Use this prop when you need to change the default class names — for example
435
+ * when using CSS modules.
436
+ */
437
+ classNames?: ClassNames;
438
+ /**
439
+ * Change the class name for the day matching the {@link modifiers}.
440
+ */
441
+ modifiersClassNames?: ModifiersClassNames;
442
+ /**
443
+ * Style to apply to the container element.
444
+ */
445
+ style?: React.CSSProperties;
446
+ /**
447
+ * Change the inline styles for each UIElement.
448
+ */
449
+ styles?: Styles;
450
+ /**
451
+ * Change the inline style for the day matching the {@link modifiers}.
452
+ */
453
+ modifiersStyles?: ModifiersStyles;
454
+ /**
455
+ * An unique id to replace the random generated id, used by DayPicker for accessibility.
456
+ */
457
+ id?: string;
458
+ /**
459
+ * The initial month to show in the calendar. Default is the current month.
460
+ *
461
+ * Use this prop to let DayPicker control the current month. If you need to set the month programmatically, use {@link month]] and [[onMonthChange}.
462
+ */
463
+ defaultMonth?: Date;
464
+ /**
465
+ * The month displayed in the calendar.
466
+ *
467
+ * As opposed to {@link DayPickerBase.defaultMonth}, use this prop with {@link DayPickerBase.onMonthChange} to
468
+ * change the month programmatically.
469
+ */
470
+ month?: Date;
471
+ /**
472
+ * Event fired when the user navigates between months.
473
+ */
474
+ onMonthChange?: MonthChangeEventHandler;
475
+ /**
476
+ * The number of displayed months. Defaults to `1`.
477
+ */
478
+ numberOfMonths?: number;
479
+ /**
480
+ * The earliest day to start the month navigation.
481
+ */
482
+ fromDate?: Date;
483
+ /**
484
+ * The latest day to end the month navigation.
485
+ */
486
+ toDate?: Date;
487
+ /**
488
+ * The earliest month to start the month navigation.
489
+ */
490
+ fromMonth?: Date;
491
+ /**
492
+ * The latest month to end the month navigation.
493
+ */
494
+ toMonth?: Date;
495
+ /**
496
+ * The earliest year to start the month navigation.
497
+ */
498
+ fromYear?: number;
499
+ /**
500
+ * The latest year to end the month navigation.
501
+ */
502
+ toYear?: number;
503
+ /**
504
+ * Disable the navigation between months.
505
+ */
506
+ disableNavigation?: boolean;
507
+ /**
508
+ * Paginate the month navigation displaying the {@link numberOfMonths} at time.
509
+ */
510
+ pagedNavigation?: boolean;
511
+ /**
512
+ * Render the months in reversed order (when {@link numberOfMonths} is greater
513
+ * than `1`) to display the most recent month first.
514
+ */
515
+ reverseMonths?: boolean;
516
+ /**
517
+ * Change the layout of the caption:
518
+ *
519
+ * - `buttons` (default): display prev/right buttons
520
+ * - `dropdown`: display drop-downs to change the month and the year
521
+ *
522
+ * **Note:** the `dropdown` layout is available only when `fromDate`,
523
+ * `fromMonth` or`fromYear` and `toDate`, `toMonth` or `toYear` are set.
524
+ *
525
+ */
526
+ captionLayout?: CaptionLayout;
527
+ /**
528
+ * Display six weeks per months, regardless the month’s number of weeks.
529
+ * To use this prop, {@link showOutsideDays} must be set. Default to `false`.
530
+ */
531
+ fixedWeeks?: boolean;
532
+ /**
533
+ * Hide the month’s head displaying the weekday names.
534
+ */
535
+ hideHead?: boolean;
536
+ /**
537
+ * Show the outside days. An outside day is a day falling in the next or the
538
+ * previous month. Default is `false`.
539
+ */
540
+ showOutsideDays?: boolean;
541
+ /**
542
+ * Show the week numbers column. Weeks are numbered according to the local
543
+ * week index. To use ISO week numbering, use the {@link ISOWeek} prop.
544
+ *
545
+ * @defaultValue false
546
+ */
547
+ showWeekNumber?: boolean;
548
+ /**
549
+ * The index of the first day of the week (0 - Sunday). Overrides the locale's one.
550
+ */
551
+ weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
552
+ /**
553
+ * The day of January, which is always in the first week of the year. See also
554
+ * https://date-fns.org/docs/getWeek and
555
+ * https://en.wikipedia.org/wiki/Week#Numbering
556
+ */
557
+ firstWeekContainsDate?: 1 | 2 | 3 | 4 | 5 | 6 | 7;
558
+ /**
559
+ * Use ISO week dates instead of the locale setting. See also
560
+ * https://en.wikipedia.org/wiki/ISO_week_date.
561
+ *
562
+ * Setting this prop will ignore {@link weekStartsOn} and {@link firstWeekContainsDate}.
563
+ */
564
+ ISOWeek?: boolean;
565
+ /**
566
+ * Map of components used to create the layout. Look at the [components source](https://github.com/gpbl/react-day-picker/tree/master/packages/react-day-picker/src/components) to understand how internal components are built.
567
+ */
568
+ components?: CustomComponents;
569
+ /** Content to add to the `tfoot` element. */
570
+ footer?: React.ReactNode;
571
+ /**
572
+ * When a selection mode is set, DayPicker will focus the first selected day
573
+ * (if set) or the today's date (if not disabled).
574
+ *
575
+ * Use this prop when you need to focus DayPicker after a user actions, for
576
+ * improved accessibility.
577
+ */
578
+ initialFocus?: boolean;
579
+ /**
580
+ * Apply the `disabled` modifier to the matching days.
581
+ */
582
+ disabled?: Matcher | Matcher[] | undefined;
583
+ /**
584
+ * Apply the `hidden` modifier to the matching days. Will hide them from the
585
+ * calendar.
586
+ */
587
+ hidden?: Matcher | Matcher[] | undefined;
588
+ /** Apply the `selected` modifier to the matching days. */
589
+ selected?: Matcher | Matcher[] | undefined;
590
+ /**
591
+ * The today’s date. Default is the current date. This Date will get the
592
+ * `today` modifier to style the day.
593
+ */
594
+ today?: Date;
595
+ /**
596
+ * Add modifiers to the matching days.
597
+ */
598
+ modifiers?: DayModifiers;
599
+ /** The date-fns locale object used to localize dates. Defaults to* `en-US`. */
600
+ locale?: Locale;
601
+ /**
602
+ * Labels creators to override the defaults. Use this prop to customize the
603
+ * ARIA labels attributes.
604
+ */
605
+ labels?: Partial<Labels>;
606
+ /**
607
+ * The text direction of the calendar. Use `ltr` for left-to-right (default)
608
+ * or `rtl` for right-to-left.
609
+ */
610
+ dir?: string;
611
+ /**
612
+ * A map of formatters. Use the formatters to override the default formatting
613
+ * functions.
614
+ */
615
+ formatters?: Partial<Formatters>;
616
+ onDayClick?: DayClickEventHandler;
617
+ onDayFocus?: DayFocusEventHandler;
618
+ onDayBlur?: DayFocusEventHandler;
619
+ onDayMouseEnter?: DayMouseEventHandler;
620
+ onDayMouseLeave?: DayMouseEventHandler;
621
+ onDayKeyDown?: DayKeyboardEventHandler;
622
+ onDayKeyUp?: DayKeyboardEventHandler;
623
+ onDayKeyPress?: DayKeyboardEventHandler;
624
+ onDayTouchCancel?: DayTouchEventHandler;
625
+ onDayTouchEnd?: DayTouchEventHandler;
626
+ onDayTouchMove?: DayTouchEventHandler;
627
+ onDayTouchStart?: DayTouchEventHandler;
628
+ onNextClick?: MonthChangeEventHandler;
629
+ onPrevClick?: MonthChangeEventHandler;
630
+ onWeekNumberClick?: WeekNumberClickEventHandler;
631
+ }
632
+ /**
633
+ * Map of the components that can be changed using the `components` prop.
634
+ *
635
+ * Look at the [components
636
+ * source](https://github.com/gpbl/react-day-picker/tree/master/packages/react-day-picker/src/components)
637
+ * to understand how internal components are built.
638
+ */
639
+ interface CustomComponents {
640
+ /** The component for the caption element. */
641
+ Caption?: (props: CaptionProps) => JSX.Element | null;
642
+ /** The component for the caption element. */
643
+ CaptionLabel?: (props: CaptionLabelProps) => JSX.Element | null;
644
+ /**
645
+ * The component for the day element.
646
+ *
647
+ * Each `Day` in DayPicker should render one of the following, according to
648
+ * the return value of {@link useDayRender}.
649
+ *
650
+ * - an empty `React.Fragment`, to render if `isHidden` is true
651
+ * - a `button` element, when the day is interactive, e.g. is selectable
652
+ * - a `div` or a `span` element, when the day is not interactive
653
+ *
654
+ */
655
+ Day?: (props: DayProps) => JSX.Element | null;
656
+ /** The component for the content of the day element. */
657
+ DayContent?: (props: DayContentProps) => JSX.Element | null;
658
+ /** The component for the drop-down elements. */
659
+ Dropdown?: (props: DropdownProps) => JSX.Element | null;
660
+ /** The component for the table footer. */
661
+ Footer?: () => JSX.Element | null;
662
+ /** The component for the table’s head. */
663
+ Head?: () => JSX.Element | null;
664
+ /** The component for the table’s head row. */
665
+ HeadRow?: () => JSX.Element | null;
666
+ /** The component for the small icon in the drop-downs. */
667
+ IconDropdown?: (props: StyledComponent) => JSX.Element | null;
668
+ /** The arrow right icon (used for the Navigation buttons). */
669
+ IconRight?: (props: StyledComponent) => JSX.Element | null;
670
+ /** The arrow left icon (used for the Navigation buttons). */
671
+ IconLeft?: (props: StyledComponent) => JSX.Element | null;
672
+ /** The component for the table rows. */
673
+ Row?: (props: RowProps) => JSX.Element | null;
674
+ /** The component for the week number in the table rows. */
675
+ WeekNumber?: (props: WeekNumberProps) => JSX.Element | null;
676
+ }
677
+ /**
678
+ * All the components in use by DayPicker that can be customized via the {@link components} prop.
679
+ */
680
+ type Components = Required<CustomComponents>;
681
+ /** The props for the {@link DayPicker} component when using `mode="default"` or `undefined`. */
682
+ interface DayPickerDefaultProps extends DayPickerBase {
683
+ mode?: DaySelectionMode;
684
+ }
685
+ /** Returns true when the props are of type {@link DayPickerDefaultProps}. */
686
+ declare function isDayPickerDefault(props: DayPickerProps): props is DayPickerDefaultProps;
687
+ /** The props for the {@link DayPicker} component when using `mode="range"`. */
688
+ interface DayPickerRangeProps extends DayPickerBase {
689
+ mode: "range";
690
+ /** The selected range of days. */
691
+ selected?: DateRange | undefined;
692
+ /** Event fired when a range (or a part of the range) is selected. */
693
+ onSelect?: SelectRangeEventHandler;
694
+ /** The minimum amount of days that can be selected. */
695
+ min?: number;
696
+ /** The maximum amount of days that can be selected. */
697
+ max?: number;
698
+ }
699
+ /** Returns true when the props are of type {@link DayPickerRangeProps}. */
700
+ declare function isDayPickerRange(props: DayPickerProps | DayPickerContextValue): props is DayPickerRangeProps;
701
+ /** The props for the {@link DayPicker} component when using `mode="single"`. */
702
+ interface DayPickerSingleProps extends DayPickerBase {
703
+ mode: "single";
704
+ /** The selected day. */
705
+ selected?: Date | undefined;
706
+ /** Event fired when a day is selected. */
707
+ onSelect?: SelectSingleEventHandler;
708
+ /** Make the selection required. */
709
+ required?: boolean;
710
+ }
711
+ /** Returns true when the props are of type {@link DayPickerSingleProps}. */
712
+ declare function isDayPickerSingle(props: DayPickerProps | DayPickerContextValue): props is DayPickerSingleProps;
713
+ /**
714
+ * The value of the {@link DayPickerContext} extends the props from DayPicker
715
+ * with default and cleaned up values.
716
+ */
717
+ interface DayPickerContextValue extends DayPickerBase {
718
+ mode: DaySelectionMode;
719
+ onSelect?: DayPickerSingleProps["onSelect"] | DayPickerMultipleProps["onSelect"] | DayPickerRangeProps["onSelect"];
720
+ required?: boolean;
721
+ min?: number;
722
+ max?: number;
723
+ selected?: Matcher | Matcher[];
724
+ captionLayout: CaptionLayout;
725
+ components: Components;
726
+ classNames: Required<ClassNames>;
727
+ formatters: Formatters;
728
+ labels: Labels;
729
+ locale: Locale;
730
+ modifiersClassNames: ModifiersClassNames;
731
+ modifiers: DayModifiers;
732
+ numberOfMonths: number;
733
+ styles: Styles;
734
+ today: Date;
735
+ }
736
+ /**
737
+ * The DayPicker context shares the props passed to DayPicker within internal
738
+ * and custom components. It is used to set the default values and perform
739
+ * one-time calculations required to render the days.
740
+ *
741
+ * Access to this context from the {@link useDayPicker} hook.
742
+ */
743
+ declare const DayPickerContext: React.Context<DayPickerContextValue | undefined>;
744
+ /** The props for the {@link DayPickerProvider}. */
745
+ interface DayPickerProviderProps {
746
+ /** The initial props from the DayPicker component. */
747
+ initialProps: DayPickerProps;
748
+ children?: ReactNode;
749
+ }
750
+ /**
751
+ * The provider for the {@link DayPickerContext}, assigning the defaults from the
752
+ * initial DayPicker props.
753
+ */
754
+ declare function DayPickerProvider(props: DayPickerProviderProps): JSX.Element;
755
+ /**
756
+ * Hook to access the {@link DayPickerContextValue}.
757
+ *
758
+ * Use the DayPicker context to access to the props passed to DayPicker inside
759
+ * internal or custom components.
760
+ */
761
+ declare function useDayPicker(): DayPickerContextValue;
762
+ /** The props for the {@link DayPicker} component when using `mode="multiple"`. */
763
+ interface DayPickerMultipleProps extends DayPickerBase {
764
+ mode: "multiple";
765
+ /** The selected days. */
766
+ selected?: Date[] | undefined;
767
+ /** Event fired when a days added or removed to the selection. */
768
+ onSelect?: SelectMultipleEventHandler;
769
+ /** The minimum amount of days that can be selected. */
770
+ min?: number;
771
+ /** The maximum amount of days that can be selected. */
772
+ max?: number;
773
+ }
774
+ /** Returns true when the props are of type {@link DayPickerMultipleProps}. */
775
+ declare function isDayPickerMultiple(props: DayPickerProps | DayPickerContextValue): props is DayPickerMultipleProps;
776
+ type DayPickerProps = DayPickerDefaultProps | DayPickerSingleProps | DayPickerMultipleProps | DayPickerRangeProps;
777
+ /**
778
+ * DayPicker render a date picker component to let users pick dates from a
779
+ * calendar. See http://react-day-picker.js.org for updated documentation and
780
+ * examples.
781
+ *
782
+ * ### Customization
783
+ *
784
+ * DayPicker offers different customization props. For example,
785
+ *
786
+ * - show multiple months using `numberOfMonths`
787
+ * - display a dropdown to navigate the months via `captionLayout`
788
+ * - display the week numbers with `showWeekNumbers`
789
+ * - disable or hide days with `disabled` or `hidden`
790
+ *
791
+ * ### Controlling the months
792
+ *
793
+ * Change the initially displayed month using the `defaultMonth` prop. The
794
+ * displayed months are controlled by DayPicker and stored in its internal
795
+ * state. To control the months yourself, use `month` instead of `defaultMonth`
796
+ * and use the `onMonthChange` event to set it.
797
+ *
798
+ * To limit the months the user can navigate to, use
799
+ * `fromDate`/`fromMonth`/`fromYear` or `toDate`/`toMonth`/`toYear`.
800
+ *
801
+ * ### Selection modes
802
+ *
803
+ * DayPicker supports different selection mode that can be toggled using the
804
+ * `mode` prop:
805
+ *
806
+ * - `mode="single"`: only one day can be selected. Use `required` to make the
807
+ * selection required. Use the `onSelect` event handler to get the selected
808
+ * days.
809
+ * - `mode="multiple"`: users can select one or more days. Limit the amount of
810
+ * days that can be selected with the `min` or the `max` props.
811
+ * - `mode="range"`: users can select a range of days. Limit the amount of days
812
+ * in the range with the `min` or the `max` props.
813
+ * - `mode="default"` (default): the built-in selections are disabled. Implement
814
+ * your own selection mode with `onDayClick`.
815
+ *
816
+ * The selection modes should cover the most common use cases. In case you
817
+ * need a more refined way of selecting days, use `mode="default"`. Use the
818
+ * `selected` props and add the day event handlers to add/remove days from the
819
+ * selection.
820
+ *
821
+ * ### Modifiers
822
+ *
823
+ * A _modifier_ represents different styles or states for the days displayed in
824
+ * the calendar (like "selected" or "disabled"). Define custom modifiers using
825
+ * the `modifiers` prop.
826
+ *
827
+ * ### Formatters and custom component
828
+ *
829
+ * You can customize how the content is displayed in the date picker by using
830
+ * either the formatters or replacing the internal components.
831
+ *
832
+ * For the most common cases you want to use the `formatters` prop to change how
833
+ * the content is formatted in the calendar. Use the `components` prop to
834
+ * replace the internal components, like the navigation icons.
835
+ *
836
+ * ### Styling
837
+ *
838
+ * DayPicker comes with a default, basic style in `react-day-picker/style` – use
839
+ * it as template for your own style.
840
+ *
841
+ * If you are using CSS modules, pass the imported styles object the
842
+ * `classNames` props.
843
+ *
844
+ * You can also style the elements via inline-styles using the `styles` prop.
845
+ *
846
+ * ### Form fields
847
+ *
848
+ * If you need to bind the date picker to a form field, you can use the
849
+ * `useInput` hooks for a basic behavior. See the `useInput` source as an
850
+ * example to bind the date picker with form fields.
851
+ *
852
+ * ### Localization
853
+ *
854
+ * To localize DayPicker, import the locale from `date-fns` package and use the
855
+ * `locale` prop.
856
+ *
857
+ * For example, to use Spanish locale:
858
+ *
859
+ * ```
860
+ * import es from 'date-fns/locale/es';
861
+ * <DayPicker locale={es} />
862
+ * ```
863
+ */
864
+ declare function DayPicker(props: DayPickerDefaultProps | DayPickerSingleProps | DayPickerMultipleProps | DayPickerRangeProps): JSX.Element;
865
+ /** The props for the {@link Button} component. */
866
+ type ButtonProps = React.HTMLProps<HTMLButtonElement>;
867
+ /**
868
+ * Render a button HTML element applying the reset class name.
869
+ */
870
+ declare const Button: React.ForwardRefExoticComponent<Pick<ButtonProps, "multiple" | "default" | "cite" | "data" | "form" | "label" | "slot" | "span" | "style" | "summary" | "title" | "pattern" | "children" | "className" | "id" | "accept" | "acceptCharset" | "action" | "allowFullScreen" | "allowTransparency" | "alt" | "as" | "async" | "autoComplete" | "autoFocus" | "autoPlay" | "capture" | "cellPadding" | "cellSpacing" | "charSet" | "challenge" | "checked" | "classID" | "cols" | "colSpan" | "content" | "controls" | "coords" | "crossOrigin" | "dateTime" | "defer" | "disabled" | "download" | "encType" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "frameBorder" | "headers" | "height" | "high" | "href" | "hrefLang" | "htmlFor" | "httpEquiv" | "integrity" | "keyParams" | "keyType" | "kind" | "list" | "loop" | "low" | "manifest" | "marginHeight" | "marginWidth" | "max" | "maxLength" | "media" | "mediaGroup" | "method" | "min" | "minLength" | "muted" | "name" | "nonce" | "noValidate" | "open" | "optimum" | "placeholder" | "playsInline" | "poster" | "preload" | "readOnly" | "rel" | "required" | "reversed" | "rows" | "rowSpan" | "sandbox" | "scope" | "scoped" | "scrolling" | "seamless" | "selected" | "shape" | "size" | "sizes" | "src" | "srcDoc" | "srcLang" | "srcSet" | "start" | "step" | "target" | "type" | "useMap" | "value" | "width" | "wmode" | "wrap" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "lang" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key"> & React.RefAttributes<HTMLButtonElement>>;
871
+ /**
872
+ * Render a caption with the dropdowns to navigate between months and years.
873
+ */
874
+ declare function CaptionDropdowns(props: CaptionProps): JSX.Element;
875
+ /**
876
+ * Render a caption with a button-based navigation.
877
+ */
878
+ declare function CaptionNavigation(props: CaptionProps): JSX.Element;
879
+ /** Render the Footer component (empty as default).*/
880
+ declare function Footer(): JSX.Element;
881
+ /** Render the table head. */
882
+ declare function Head(): JSX.Element;
883
+ /**
884
+ * Render the HeadRow component - i.e. the table head row with the weekday names.
885
+ */
886
+ declare function HeadRow(): JSX.Element;
887
+ /**
888
+ * Render the icon in the styled drop-down.
889
+ */
890
+ declare function IconDropdown(props: StyledComponent): JSX.Element;
891
+ /**
892
+ * Render the "next month" button in the navigation.
893
+ */
894
+ declare function IconRight(props: StyledComponent): JSX.Element;
895
+ /**
896
+ * Render the "previous month" button in the navigation.
897
+ */
898
+ declare function IconLeft(props: StyledComponent): JSX.Element;
899
+ /** The props to attach to the input field when using {@link useInput}. */
900
+ type InputHTMLAttributes = Pick<React.InputHTMLAttributes<HTMLInputElement>, "onBlur" | "onChange" | "onFocus" | "value" | "placeholder">;
901
+ /** The props to attach to the DayPicker component when using {@link useInput}. */
902
+ type InputDayPickerProps = Pick<DayPickerSingleProps, "fromDate" | "toDate" | "locale" | "month" | "onDayClick" | "onMonthChange" | "selected" | "today">;
903
+ interface UseInputOptions extends Pick<DayPickerBase, "locale" | "fromDate" | "toDate" | "fromMonth" | "toMonth" | "fromYear" | "toYear" | "today"> {
904
+ /** The initially selected date */
905
+ defaultSelected?: Date;
906
+ /** The format string for formatting the input field. See https://date-fns.org/docs/format for a list of format strings. Default to `PP`. */
907
+ format?: string;
908
+ /** Make the selection required. */
909
+ required?: boolean;
910
+ }
911
+ /** Represent the value returned by {@link useInput}. */
912
+ interface UseInputValue {
913
+ /** The props to pass to a DayPicker component. */
914
+ dayPickerProps: InputDayPickerProps;
915
+ /** The props to pass to an input field. */
916
+ inputProps: InputHTMLAttributes;
917
+ /** A function to reset to the initial state. */
918
+ reset: () => void;
919
+ /** A function to set the selected day. */
920
+ setSelected: (day: Date | undefined) => void;
921
+ }
922
+ /** Return props and setters for binding an input field to DayPicker. */
923
+ declare function useInput(options?: UseInputOptions): UseInputValue;
924
+ type EventName = "onClick" | "onFocus" | "onBlur" | "onKeyDown" | "onKeyUp" | "onMouseEnter" | "onMouseLeave" | "onTouchCancel" | "onTouchEnd" | "onTouchMove" | "onTouchStart";
925
+ type DayEventHandlers = Pick<HTMLProps<HTMLButtonElement>, EventName>;
926
+ type SelectedDays = Date | Date[] | DateRange | undefined;
927
+ type DayRender = {
928
+ /** Whether the day should be rendered a `button` instead of a `div` */
929
+ isButton: boolean;
930
+ /** Whether the day should be hidden. */
931
+ isHidden: boolean;
932
+ /** The modifiers active for the given day. */
933
+ activeModifiers: ActiveModifiers;
934
+ /** The props to apply to the button element (when `isButton` is true). */
935
+ buttonProps: StyledComponent & Pick<ButtonProps, "disabled" | "aria-pressed" | "tabIndex"> & DayEventHandlers;
936
+ /** The props to apply to the div element (when `isButton` is false). */
937
+ divProps: StyledComponent;
938
+ selectedDays: SelectedDays;
939
+ };
940
+ /**
941
+ * Return props and data used to render the {@link Day} component.
942
+ *
943
+ * Use this hook when creating a component to replace the built-in `Day`
944
+ * component.
945
+ */
946
+ declare function useDayRender(/** The date to render. */
947
+ day: Date, /** The month where the date is displayed (if not the same as `date`, it means it is an "outside" day). */
948
+ displayMonth: Date, /** A ref to the button element that will be target of focus when rendered (if required). */
949
+ buttonRef: React.RefObject<HTMLButtonElement>): DayRender;
950
+ /**
951
+ * Return the active modifiers for the specified day.
952
+ *
953
+ * This hook is meant to be used inside internal or custom components.
954
+ *
955
+ * @param day
956
+ * @param displayMonth
957
+ */
958
+ declare function useActiveModifiers(day: Date, /**
959
+ * The month where the date is displayed. If not the same as `date`, the day
960
+ * is an "outside day".
961
+ */
962
+ displayMonth?: Date): ActiveModifiers;
963
+ /** Represents the value of the {@link FocusContext}. */
964
+ type FocusContextValue = {
965
+ /** The day currently focused. */
966
+ focusedDay: Date | undefined;
967
+ /** Day that will be focused. */
968
+ focusTarget: Date | undefined;
969
+ /** Focus a day. */
970
+ focus: (day: Date) => void;
971
+ /** Blur the focused day. */
972
+ blur: () => void;
973
+ /** Focus the day after the focused day. */
974
+ focusDayAfter: () => void;
975
+ /** Focus the day before the focused day. */
976
+ focusDayBefore: () => void;
977
+ /** Focus the day in the week before the focused day. */
978
+ focusWeekBefore: () => void;
979
+ /** Focus the day in the week after the focused day. */
980
+ focusWeekAfter: () => void;
981
+ /* Focus the day in the month before the focused day. */
982
+ focusMonthBefore: () => void;
983
+ /* Focus the day in the month after the focused day. */
984
+ focusMonthAfter: () => void;
985
+ /* Focus the day in the year before the focused day. */
986
+ focusYearBefore: () => void;
987
+ /* Focus the day in the year after the focused day. */
988
+ focusYearAfter: () => void;
989
+ /* Focus the day at the start of the week of the focused day. */
990
+ focusStartOfWeek: () => void;
991
+ /* Focus the day at the end of the week of focused day. */
992
+ focusEndOfWeek: () => void;
993
+ };
994
+ /**
995
+ * The Focus context shares details about the focused day for the keyboard
996
+ *
997
+ * Access this context from the {@link useFocusContext} hook.
998
+ */
999
+ declare const FocusContext: React.Context<FocusContextValue | undefined>;
1000
+ /** The provider for the {@link FocusContext}. */
1001
+ declare function FocusProvider(props: {
1002
+ children: ReactNode;
1003
+ }): JSX.Element;
1004
+ /**
1005
+ * Hook to access the {@link FocusContextValue}. Use this hook to handle the
1006
+ * focus state of the elements.
1007
+ *
1008
+ * This hook is meant to be used inside internal or custom components.
1009
+ */
1010
+ declare function useFocusContext(): FocusContextValue;
1011
+ /** Represents the value of the {@link NavigationContext}. */
1012
+ interface NavigationContextValue {
1013
+ /** The month to display in the calendar. When `numberOfMonths` is greater than one, is the first of the displayed months. */
1014
+ currentMonth: Date;
1015
+ /** The months rendered by DayPicker. DayPicker can render multiple months via `numberOfMonths`. */
1016
+ displayMonths: Date[];
1017
+ /** Navigate to the specified month. */
1018
+ goToMonth: (month: Date) => void;
1019
+ /** Navigate to the specified date. */
1020
+ goToDate: (date: Date, refDate?: Date) => void;
1021
+ /** The next month to display. */
1022
+ nextMonth?: Date;
1023
+ /** The previous month to display. */
1024
+ previousMonth?: Date;
1025
+ /** Whether the given day is included in the displayed months. */
1026
+ isDateDisplayed: (day: Date) => boolean;
1027
+ }
1028
+ /**
1029
+ * The Navigation context shares details and methods to navigate the months in DayPicker.
1030
+ * Access this context from the {@link useNavigation} hook.
1031
+ */
1032
+ declare const NavigationContext: React.Context<NavigationContextValue | undefined>;
1033
+ /** Provides the values for the {@link NavigationContext}. */
1034
+ declare function NavigationProvider(props: {
1035
+ children?: ReactNode;
1036
+ }): JSX.Element;
1037
+ /**
1038
+ * Hook to access the {@link NavigationContextValue}. Use this hook to navigate
1039
+ * between months or years in DayPicker.
1040
+ *
1041
+ * This hook is meant to be used inside internal or custom components.
1042
+ */
1043
+ declare function useNavigation(): NavigationContextValue;
1044
+ /** The props of {@link RootProvider}. */
1045
+ type RootContext = DayPickerBase & {
1046
+ children: React.ReactNode;
1047
+ };
1048
+ /** Provide the value for all the context providers. */
1049
+ declare function RootProvider(props: RootContext): JSX.Element;
1050
+ /** Represent the modifiers that are changed by the multiple selection. */
1051
+ type SelectMultipleModifiers = Pick<Modifiers, InternalModifier.Disabled>;
1052
+ /** Represents the value of a {@link SelectMultipleContext}. */
1053
+ interface SelectMultipleContextValue {
1054
+ /** The days that have been selected. */
1055
+ selected: Date[] | undefined;
1056
+ /** The modifiers for the corresponding selection. */
1057
+ modifiers: SelectMultipleModifiers;
1058
+ /** Event handler to attach to the day button to enable the multiple select. */
1059
+ onDayClick?: DayClickEventHandler;
1060
+ }
1061
+ /**
1062
+ * The SelectMultiple context shares details about the selected days when in
1063
+ * multiple selection mode.
1064
+ *
1065
+ * Access this context from the {@link useSelectMultiple} hook.
1066
+ */
1067
+ declare const SelectMultipleContext: React.Context<SelectMultipleContextValue | undefined>;
1068
+ type SelectMultipleProviderProps = {
1069
+ initialProps: DayPickerBase;
1070
+ children: ReactNode;
1071
+ };
1072
+ /** Provides the values for the {@link SelectMultipleContext}. */
1073
+ declare function SelectMultipleProvider(props: SelectMultipleProviderProps): JSX.Element;
1074
+ type SelectMultipleProviderInternalProps = {
1075
+ initialProps: DayPickerMultipleProps;
1076
+ children: ReactNode;
1077
+ };
1078
+ declare function SelectMultipleProviderInternal({ initialProps, children }: SelectMultipleProviderInternalProps): JSX.Element;
1079
+ /**
1080
+ * Hook to access the {@link SelectMultipleContextValue}.
1081
+ *
1082
+ * This hook is meant to be used inside internal or custom components.
1083
+ */
1084
+ declare function useSelectMultiple(): SelectMultipleContextValue;
1085
+ /** Represent the modifiers that are changed by the range selection. */
1086
+ type SelectRangeModifiers = Pick<Modifiers, InternalModifier.Disabled | InternalModifier.RangeEnd | InternalModifier.RangeMiddle | InternalModifier.RangeStart>;
1087
+ /** Represents the value of a {@link SelectRangeContext}. */
1088
+ interface SelectRangeContextValue {
1089
+ /** The range of days that has been selected. */
1090
+ selected: DateRange | undefined;
1091
+ /** The modifiers for the corresponding selection. */
1092
+ modifiers: SelectRangeModifiers;
1093
+ /** Event handler to attach to the day button to enable the range select. */
1094
+ onDayClick?: DayClickEventHandler;
1095
+ }
1096
+ /**
1097
+ * The SelectRange context shares details about the selected days when in
1098
+ * range selection mode.
1099
+ *
1100
+ * Access this context from the {@link useSelectRange} hook.
1101
+ */
1102
+ declare const SelectRangeContext: React.Context<SelectRangeContextValue | undefined>;
1103
+ type SelectRangeProviderProps = {
1104
+ initialProps: DayPickerBase;
1105
+ children: ReactNode;
1106
+ };
1107
+ /** Provides the values for the {@link SelectRangeProvider}. */
1108
+ declare function SelectRangeProvider(props: SelectRangeProviderProps): JSX.Element;
1109
+ type SelectRangeProviderInternalProps = {
1110
+ initialProps: DayPickerRangeProps;
1111
+ children: ReactNode;
1112
+ };
1113
+ declare function SelectRangeProviderInternal({ initialProps, children }: SelectRangeProviderInternalProps): JSX.Element;
1114
+ /**
1115
+ * Hook to access the {@link SelectRangeContextValue}.
1116
+ *
1117
+ * This hook is meant to be used inside internal or custom components.
1118
+ */
1119
+ declare function useSelectRange(): SelectRangeContextValue;
1120
+ /** Represents the value of a {@link SelectSingleContext}. */
1121
+ interface SelectSingleContextValue {
1122
+ /** The day that has been selected. */
1123
+ selected: Date | undefined;
1124
+ /** Event handler to attach to the day button to enable the single select. */
1125
+ onDayClick?: DayClickEventHandler;
1126
+ }
1127
+ /**
1128
+ * The SelectSingle context shares details about the selected days when in
1129
+ * single selection mode.
1130
+ *
1131
+ * Access this context from the {@link useSelectSingle} hook.
1132
+ */
1133
+ declare const SelectSingleContext: React.Context<SelectSingleContextValue | undefined>;
1134
+ type SelectSingleProviderProps = {
1135
+ initialProps: DayPickerBase;
1136
+ children: React.ReactNode;
1137
+ };
1138
+ /** Provides the values for the {@link SelectSingleProvider}. */
1139
+ declare function SelectSingleProvider(props: SelectSingleProviderProps): JSX.Element;
1140
+ type SelectSingleProviderInternal = {
1141
+ initialProps: DayPickerSingleProps;
1142
+ children: React.ReactNode;
1143
+ };
1144
+ declare function SelectSingleProviderInternal({ initialProps, children }: SelectSingleProviderInternal): JSX.Element;
1145
+ /**
1146
+ * Hook to access the {@link SelectSingleContextValue}.
1147
+ *
1148
+ * This hook is meant to be used inside internal or custom components.
1149
+ */
1150
+ declare function useSelectSingle(): SelectSingleContextValue;
1151
+ /**
1152
+ * Returns whether a day matches against at least one of the given Matchers.
1153
+ *
1154
+ * ```
1155
+ * const day = new Date(2022, 5, 19);
1156
+ * const matcher1: DateRange = {
1157
+ * from: new Date(2021, 12, 21),
1158
+ * to: new Date(2021, 12, 30)
1159
+ * }
1160
+ * const matcher2: DateRange = {
1161
+ * from: new Date(2022, 5, 1),
1162
+ * to: new Date(2022, 5, 23)
1163
+ * }
1164
+ *
1165
+ * const isMatch(day, [matcher1, matcher2]); // true, since day is in the matcher1 range.
1166
+ * ```
1167
+ * */
1168
+ declare function isMatch(day: Date, matchers: Matcher[]): boolean;
1169
+ /**
1170
+ * Add a day to an existing range.
1171
+ *
1172
+ * The returned range takes in account the `undefined` values and if the added
1173
+ * day is already present in the range.
1174
+ */
1175
+ declare function addToRange(day: Date, range?: DateRange): DateRange | undefined;
1176
+ export { DayPickerProps, DayPicker, ButtonProps, Button, CaptionProps, CaptionLayout, Caption, CaptionDropdowns, CaptionLabelProps, CaptionLabel, CaptionNavigation, DayProps, Day, DayContentProps, DayContent, DropdownProps, Dropdown, Footer, Head, HeadRow, IconDropdown, IconRight, IconLeft, RowProps, Row, WeekNumberProps, WeekNumber, InputHTMLAttributes, InputDayPickerProps, UseInputOptions, UseInputValue, useInput, DayRender, useDayRender, useActiveModifiers, DayPickerContextValue, DayPickerContext, DayPickerProviderProps, DayPickerProvider, useDayPicker, FocusContextValue, FocusContext, FocusProvider, useFocusContext, NavigationContextValue, NavigationContext, NavigationProvider, useNavigation, RootContext, RootProvider, SelectMultipleModifiers, SelectMultipleContextValue, SelectMultipleContext, SelectMultipleProviderProps, SelectMultipleProvider, SelectMultipleProviderInternal, useSelectMultiple, SelectRangeModifiers, SelectRangeContextValue, SelectRangeContext, SelectRangeProvider, SelectRangeProviderInternal, useSelectRange, SelectSingleContextValue, SelectSingleContext, SelectSingleProvider, SelectSingleProviderInternal, useSelectSingle, DaySelectionMode, DayPickerBase, CustomComponents, Components, DayPickerDefaultProps, isDayPickerDefault, DayPickerMultipleProps, isDayPickerMultiple, DayPickerRangeProps, isDayPickerRange, DayPickerSingleProps, isDayPickerSingle, DayClickEventHandler, DayFocusEventHandler, DayKeyboardEventHandler, DayMouseEventHandler, MonthChangeEventHandler, SelectMultipleEventHandler, SelectRangeEventHandler, SelectSingleEventHandler, WeekNumberClickEventHandler, DayTouchEventHandler, DateFormatter, Formatters, WeekNumberFormatter, Labels, DayLabel, NavButtonLabel, WeekdayLabel, WeekNumberLabel, Matcher, DateAfter, DateBefore, DateInterval, DateRange, DayOfWeek, isDateInterval, isDateRange, isDateAfterType, isDateBeforeType, isDayOfWeekType, Modifier, Modifiers, InternalModifier, InternalModifiers, ActiveModifiers, ModifiersStyles, ModifiersClassNames, DayModifiers, CustomModifiers, StyledElement, InternalModifiersElement, ClassNames, Styles, StyledComponent, isMatch, addToRange };