@birdnet/advanced-react-dates 0.0.0-stage → 1.0.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 (267) hide show
  1. package/.babelrc +67 -0
  2. package/.eslintrc +66 -0
  3. package/.nvmrc +1 -0
  4. package/.nyc_output/4d8efcd220c2aec1f2b4ffd49d875001.json +1 -0
  5. package/.nyc_output/66d34779498a5d49bcf9d757dfc7fdb5.json +1 -0
  6. package/.nyc_output/8ca7e04140934515928bc7d4ae476b73.json +1 -0
  7. package/.nyc_output/afc270bb597bfc50e690436959c2ae54.json +1 -0
  8. package/.nycrc +19 -0
  9. package/.travis.yml +13 -0
  10. package/CHANGELOG.md +665 -0
  11. package/CLAUDE.md +56 -0
  12. package/INTHEWILD.md +9 -0
  13. package/LICENSE +21 -0
  14. package/README.md +421 -2
  15. package/constants.js +2 -0
  16. package/esm/components/CalendarDay.js +321 -0
  17. package/esm/components/CalendarIcon.js +11 -0
  18. package/esm/components/CalendarMonth.js +254 -0
  19. package/esm/components/CalendarMonthGrid.js +365 -0
  20. package/esm/components/CalendarWeek.js +11 -0
  21. package/esm/components/ChevronDown.js +11 -0
  22. package/esm/components/ChevronUp.js +11 -0
  23. package/esm/components/CloseButton.js +12 -0
  24. package/esm/components/CustomizableCalendarDay.js +341 -0
  25. package/esm/components/DateInput.js +344 -0
  26. package/esm/components/DateRangePicker.js +647 -0
  27. package/esm/components/DateRangePickerInput.js +341 -0
  28. package/esm/components/DateRangePickerInputController.js +348 -0
  29. package/esm/components/DayPicker.js +1167 -0
  30. package/esm/components/DayPickerKeyboardShortcuts.js +364 -0
  31. package/esm/components/DayPickerNavigation.js +314 -0
  32. package/esm/components/DayPickerRangeController.js +1202 -0
  33. package/esm/components/DayPickerSingleDateController.js +690 -0
  34. package/esm/components/KeyboardShortcutRow.js +69 -0
  35. package/esm/components/LeftArrow.js +11 -0
  36. package/esm/components/RightArrow.js +11 -0
  37. package/esm/components/SingleDatePicker.js +605 -0
  38. package/esm/components/SingleDatePickerInput.js +264 -0
  39. package/esm/components/SingleDatePickerInputController.js +260 -0
  40. package/esm/constants.js +28 -0
  41. package/esm/defaultPhrases.js +225 -0
  42. package/esm/index.js +20 -0
  43. package/esm/initialize.js +2 -0
  44. package/esm/shapes/AnchorDirectionShape.js +3 -0
  45. package/esm/shapes/CalendarInfoPositionShape.js +3 -0
  46. package/esm/shapes/DateRangePickerShape.js +101 -0
  47. package/esm/shapes/DayOfWeekShape.js +3 -0
  48. package/esm/shapes/DisabledShape.js +3 -0
  49. package/esm/shapes/FocusedInputShape.js +3 -0
  50. package/esm/shapes/IconPositionShape.js +3 -0
  51. package/esm/shapes/ModifiersShape.js +18 -0
  52. package/esm/shapes/NavPositionShape.js +3 -0
  53. package/esm/shapes/OpenDirectionShape.js +3 -0
  54. package/esm/shapes/OrientationShape.js +3 -0
  55. package/esm/shapes/ScrollableOrientationShape.js +3 -0
  56. package/esm/shapes/SingleDatePickerShape.js +90 -0
  57. package/esm/theme/DefaultTheme.js +176 -0
  58. package/esm/utils/calculateDimension.js +28 -0
  59. package/esm/utils/disableScroll.js +67 -0
  60. package/esm/utils/getActiveElement.js +3 -0
  61. package/esm/utils/getCalendarDaySettings.js +48 -0
  62. package/esm/utils/getCalendarMonthWeeks.js +37 -0
  63. package/esm/utils/getCalendarMonthWidth.js +4 -0
  64. package/esm/utils/getDetachedContainerStyles.js +36 -0
  65. package/esm/utils/getInputHeight.js +42 -0
  66. package/esm/utils/getNumberOfCalendarMonthWeeks.js +11 -0
  67. package/esm/utils/getPhrase.js +7 -0
  68. package/esm/utils/getPhrasePropTypes.js +9 -0
  69. package/esm/utils/getPooledMoment.js +8 -0
  70. package/esm/utils/getPreviousMonthMemoLast.js +9 -0
  71. package/esm/utils/getResponsiveContainerStyles.js +8 -0
  72. package/esm/utils/getSelectedDateOffset.js +8 -0
  73. package/esm/utils/getTransformStyles.js +8 -0
  74. package/esm/utils/getVisibleDays.js +42 -0
  75. package/esm/utils/isAfterDay.js +7 -0
  76. package/esm/utils/isBeforeDay.js +13 -0
  77. package/esm/utils/isDayVisible.js +38 -0
  78. package/esm/utils/isInclusivelyAfterDay.js +6 -0
  79. package/esm/utils/isInclusivelyBeforeDay.js +6 -0
  80. package/esm/utils/isNextDay.js +7 -0
  81. package/esm/utils/isNextMonth.js +6 -0
  82. package/esm/utils/isPrevMonth.js +6 -0
  83. package/esm/utils/isPreviousDay.js +7 -0
  84. package/esm/utils/isSameDay.js +7 -0
  85. package/esm/utils/isSameMonth.js +7 -0
  86. package/esm/utils/isTransitionEndSupported.js +3 -0
  87. package/esm/utils/modifiers.js +94 -0
  88. package/esm/utils/noflip.js +10 -0
  89. package/esm/utils/registerCSSInterfaceWithDefaultTheme.js +5 -0
  90. package/esm/utils/registerInterfaceWithDefaultTheme.js +6 -0
  91. package/esm/utils/toISODateString.js +12 -0
  92. package/esm/utils/toISOMonthString.js +12 -0
  93. package/esm/utils/toLocalizedDateString.js +8 -0
  94. package/esm/utils/toMomentObject.js +7 -0
  95. package/index.js +2 -0
  96. package/initialize.js +2 -0
  97. package/karma.conf.js +82 -0
  98. package/lib/components/CalendarDay.js +327 -0
  99. package/lib/components/CalendarIcon.js +18 -0
  100. package/lib/components/CalendarMonth.js +259 -0
  101. package/lib/components/CalendarMonthGrid.js +372 -0
  102. package/lib/components/CalendarWeek.js +18 -0
  103. package/lib/components/ChevronDown.js +18 -0
  104. package/lib/components/ChevronUp.js +18 -0
  105. package/lib/components/CloseButton.js +19 -0
  106. package/lib/components/CustomizableCalendarDay.js +347 -0
  107. package/lib/components/DateInput.js +351 -0
  108. package/lib/components/DateRangePicker.js +653 -0
  109. package/lib/components/DateRangePickerInput.js +348 -0
  110. package/lib/components/DateRangePickerInputController.js +354 -0
  111. package/lib/components/DayPicker.js +1175 -0
  112. package/lib/components/DayPickerKeyboardShortcuts.js +371 -0
  113. package/lib/components/DayPickerNavigation.js +321 -0
  114. package/lib/components/DayPickerRangeController.js +1208 -0
  115. package/lib/components/DayPickerSingleDateController.js +695 -0
  116. package/lib/components/KeyboardShortcutRow.js +76 -0
  117. package/lib/components/LeftArrow.js +18 -0
  118. package/lib/components/RightArrow.js +18 -0
  119. package/lib/components/SingleDatePicker.js +611 -0
  120. package/lib/components/SingleDatePickerInput.js +271 -0
  121. package/lib/components/SingleDatePickerInputController.js +266 -0
  122. package/lib/constants.js +34 -0
  123. package/lib/css/_datepicker.css +886 -0
  124. package/lib/defaultPhrases.js +231 -0
  125. package/lib/index.js +146 -0
  126. package/lib/initialize.js +5 -0
  127. package/lib/shapes/AnchorDirectionShape.js +10 -0
  128. package/lib/shapes/CalendarInfoPositionShape.js +10 -0
  129. package/lib/shapes/DateRangePickerShape.js +108 -0
  130. package/lib/shapes/DayOfWeekShape.js +10 -0
  131. package/lib/shapes/DisabledShape.js +10 -0
  132. package/lib/shapes/FocusedInputShape.js +10 -0
  133. package/lib/shapes/IconPositionShape.js +10 -0
  134. package/lib/shapes/ModifiersShape.js +25 -0
  135. package/lib/shapes/NavPositionShape.js +10 -0
  136. package/lib/shapes/OpenDirectionShape.js +10 -0
  137. package/lib/shapes/OrientationShape.js +10 -0
  138. package/lib/shapes/ScrollableOrientationShape.js +10 -0
  139. package/lib/shapes/SingleDatePickerShape.js +97 -0
  140. package/lib/theme/DefaultTheme.js +182 -0
  141. package/lib/utils/calculateDimension.js +34 -0
  142. package/lib/utils/disableScroll.js +75 -0
  143. package/lib/utils/getActiveElement.js +9 -0
  144. package/lib/utils/getCalendarDaySettings.js +55 -0
  145. package/lib/utils/getCalendarMonthWeeks.js +44 -0
  146. package/lib/utils/getCalendarMonthWidth.js +10 -0
  147. package/lib/utils/getDetachedContainerStyles.js +41 -0
  148. package/lib/utils/getInputHeight.js +48 -0
  149. package/lib/utils/getNumberOfCalendarMonthWeeks.js +18 -0
  150. package/lib/utils/getPhrase.js +13 -0
  151. package/lib/utils/getPhrasePropTypes.js +16 -0
  152. package/lib/utils/getPooledMoment.js +15 -0
  153. package/lib/utils/getPreviousMonthMemoLast.js +15 -0
  154. package/lib/utils/getResponsiveContainerStyles.js +15 -0
  155. package/lib/utils/getSelectedDateOffset.js +14 -0
  156. package/lib/utils/getTransformStyles.js +14 -0
  157. package/lib/utils/getVisibleDays.js +49 -0
  158. package/lib/utils/isAfterDay.js +14 -0
  159. package/lib/utils/isBeforeDay.js +20 -0
  160. package/lib/utils/isDayVisible.js +45 -0
  161. package/lib/utils/isInclusivelyAfterDay.js +13 -0
  162. package/lib/utils/isInclusivelyBeforeDay.js +13 -0
  163. package/lib/utils/isNextDay.js +14 -0
  164. package/lib/utils/isNextMonth.js +13 -0
  165. package/lib/utils/isPrevMonth.js +13 -0
  166. package/lib/utils/isPreviousDay.js +14 -0
  167. package/lib/utils/isSameDay.js +14 -0
  168. package/lib/utils/isSameMonth.js +14 -0
  169. package/lib/utils/isTransitionEndSupported.js +9 -0
  170. package/lib/utils/modifiers.js +102 -0
  171. package/lib/utils/noflip.js +16 -0
  172. package/lib/utils/registerCSSInterfaceWithDefaultTheme.js +12 -0
  173. package/lib/utils/registerInterfaceWithDefaultTheme.js +13 -0
  174. package/lib/utils/toISODateString.js +19 -0
  175. package/lib/utils/toISOMonthString.js +19 -0
  176. package/lib/utils/toLocalizedDateString.js +15 -0
  177. package/lib/utils/toMomentObject.js +14 -0
  178. package/package.json +141 -4
  179. package/scripts/.eslintrc +7 -0
  180. package/scripts/buildCSS.js +37 -0
  181. package/scripts/pure-component-fallback.js +70 -0
  182. package/scripts/renderAllComponents.jsx +25 -0
  183. package/src/components/CalendarDay.jsx +366 -0
  184. package/src/components/CalendarIcon.jsx +3 -0
  185. package/src/components/CalendarMonth.jsx +300 -0
  186. package/src/components/CalendarMonthGrid.jsx +427 -0
  187. package/src/components/CalendarWeek.jsx +17 -0
  188. package/src/components/ChevronDown.jsx +3 -0
  189. package/src/components/ChevronUp.jsx +3 -0
  190. package/src/components/CloseButton.jsx +3 -0
  191. package/src/components/CustomizableCalendarDay.jsx +382 -0
  192. package/src/components/DateInput.jsx +401 -0
  193. package/src/components/DateRangePicker.jsx +777 -0
  194. package/src/components/DateRangePickerInput.jsx +434 -0
  195. package/src/components/DateRangePickerInputController.jsx +379 -0
  196. package/src/components/DayPicker.jsx +1407 -0
  197. package/src/components/DayPickerKeyboardShortcuts.jsx +443 -0
  198. package/src/components/DayPickerNavigation.jsx +445 -0
  199. package/src/components/DayPickerRangeController.jsx +1409 -0
  200. package/src/components/DayPickerSingleDateController.jsx +769 -0
  201. package/src/components/KeyboardShortcutRow.jsx +93 -0
  202. package/src/components/LeftArrow.jsx +3 -0
  203. package/src/components/RightArrow.jsx +3 -0
  204. package/src/components/SingleDatePicker.jsx +731 -0
  205. package/src/components/SingleDatePickerInput.jsx +329 -0
  206. package/src/components/SingleDatePickerInputController.jsx +280 -0
  207. package/src/constants.js +37 -0
  208. package/src/defaultPhrases.js +215 -0
  209. package/src/index.js +20 -0
  210. package/src/initialize.js +3 -0
  211. package/src/shapes/AnchorDirectionShape.js +8 -0
  212. package/src/shapes/CalendarInfoPositionShape.js +15 -0
  213. package/src/shapes/DateRangePickerShape.js +111 -0
  214. package/src/shapes/DayOfWeekShape.js +5 -0
  215. package/src/shapes/DisabledShape.js +5 -0
  216. package/src/shapes/FocusedInputShape.js +8 -0
  217. package/src/shapes/IconPositionShape.js +8 -0
  218. package/src/shapes/ModifiersShape.js +20 -0
  219. package/src/shapes/NavPositionShape.js +8 -0
  220. package/src/shapes/OpenDirectionShape.js +8 -0
  221. package/src/shapes/OrientationShape.js +8 -0
  222. package/src/shapes/ScrollableOrientationShape.js +13 -0
  223. package/src/shapes/SingleDatePickerShape.js +100 -0
  224. package/src/svg/arrow-left.svg +1 -0
  225. package/src/svg/arrow-right.svg +1 -0
  226. package/src/svg/calendar.svg +1 -0
  227. package/src/svg/chevron-down.svg +1 -0
  228. package/src/svg/chevron-up.svg +1 -0
  229. package/src/svg/close.svg +1 -0
  230. package/src/theme/DefaultTheme.js +196 -0
  231. package/src/utils/calculateDimension.js +32 -0
  232. package/src/utils/disableScroll.js +65 -0
  233. package/src/utils/getActiveElement.js +3 -0
  234. package/src/utils/getCalendarDaySettings.js +61 -0
  235. package/src/utils/getCalendarMonthWeeks.js +49 -0
  236. package/src/utils/getCalendarMonthWidth.js +3 -0
  237. package/src/utils/getDetachedContainerStyles.js +39 -0
  238. package/src/utils/getInputHeight.js +67 -0
  239. package/src/utils/getNumberOfCalendarMonthWeeks.js +15 -0
  240. package/src/utils/getPhrase.jsx +9 -0
  241. package/src/utils/getPhrasePropTypes.js +9 -0
  242. package/src/utils/getPooledMoment.js +10 -0
  243. package/src/utils/getPreviousMonthMemoLast.js +11 -0
  244. package/src/utils/getResponsiveContainerStyles.js +18 -0
  245. package/src/utils/getSelectedDateOffset.js +6 -0
  246. package/src/utils/getTransformStyles.js +8 -0
  247. package/src/utils/getVisibleDays.js +54 -0
  248. package/src/utils/isAfterDay.js +9 -0
  249. package/src/utils/isBeforeDay.js +18 -0
  250. package/src/utils/isDayVisible.js +57 -0
  251. package/src/utils/isInclusivelyAfterDay.js +8 -0
  252. package/src/utils/isInclusivelyBeforeDay.js +8 -0
  253. package/src/utils/isNextDay.js +9 -0
  254. package/src/utils/isNextMonth.js +8 -0
  255. package/src/utils/isPrevMonth.js +8 -0
  256. package/src/utils/isPreviousDay.js +9 -0
  257. package/src/utils/isSameDay.js +10 -0
  258. package/src/utils/isSameMonth.js +9 -0
  259. package/src/utils/isTransitionEndSupported.js +3 -0
  260. package/src/utils/modifiers.js +116 -0
  261. package/src/utils/noflip.js +11 -0
  262. package/src/utils/registerCSSInterfaceWithDefaultTheme.js +7 -0
  263. package/src/utils/registerInterfaceWithDefaultTheme.js +7 -0
  264. package/src/utils/toISODateString.js +14 -0
  265. package/src/utils/toISOMonthString.js +14 -0
  266. package/src/utils/toLocalizedDateString.js +12 -0
  267. package/src/utils/toMomentObject.js +12 -0
@@ -0,0 +1,215 @@
1
+ const calendarLabel = 'Calendar';
2
+ const roleDescription = 'datepicker';
3
+ const closeDatePicker = 'Close';
4
+ const focusStartDate = 'Interact with the calendar and add the check-in date for your trip.';
5
+ const clearDate = 'Clear Date';
6
+ const clearDates = 'Clear Dates';
7
+ const jumpToPrevMonth = 'Move backward to switch to the previous month.';
8
+ const jumpToNextMonth = 'Move forward to switch to the next month.';
9
+ const keyboardShortcuts = 'Keyboard Shortcuts';
10
+ const showKeyboardShortcutsPanel = 'Open the keyboard shortcuts panel.';
11
+ const hideKeyboardShortcutsPanel = 'Close the shortcuts panel.';
12
+ const openThisPanel = 'Open this panel.';
13
+ const enterKey = 'Enter key';
14
+ const leftArrowRightArrow = 'Right and left arrow keys';
15
+ const upArrowDownArrow = 'up and down arrow keys';
16
+ const pageUpPageDown = 'page up and page down keys';
17
+ const homeEnd = 'Home and end keys';
18
+ const escape = 'Escape key';
19
+ const questionMark = 'Question mark';
20
+ const selectFocusedDate = 'Select the date in focus.';
21
+ const moveFocusByOneDay = 'Move backward (left) and forward (right) by one day.';
22
+ const moveFocusByOneWeek = 'Move backward (up) and forward (down) by one week.';
23
+ const moveFocusByOneMonth = 'Switch months.';
24
+ const moveFocustoStartAndEndOfWeek = 'Go to the first or last day of a week.';
25
+ const returnFocusToInput = 'Return to the date input field.';
26
+ const keyboardForwardNavigationInstructions = 'Navigate forward to interact with the calendar and select a date. Press the question mark key to get the keyboard shortcuts for changing dates.';
27
+ const keyboardBackwardNavigationInstructions = 'Navigate backward to interact with the calendar and select a date. Press the question mark key to get the keyboard shortcuts for changing dates.';
28
+
29
+ const chooseAvailableStartDate = ({ date }) => `Choose ${date} as your check-in date. It’s available.`;
30
+ const chooseAvailableEndDate = ({ date }) => `Choose ${date} as your check-out date. It’s available.`;
31
+ const chooseAvailableDate = ({ date }) => date;
32
+ const dateIsUnavailable = ({ date }) => `Not available. ${date}`;
33
+ const dateIsSelected = ({ date }) => `Selected. ${date}`;
34
+ const dateIsSelectedAsStartDate = ({ date }) => `Selected as start date. ${date}`;
35
+ const dateIsSelectedAsEndDate = ({ date }) => `Selected as end date. ${date}`;
36
+
37
+ export default {
38
+ calendarLabel,
39
+ roleDescription,
40
+ closeDatePicker,
41
+ focusStartDate,
42
+ clearDate,
43
+ clearDates,
44
+ jumpToPrevMonth,
45
+ jumpToNextMonth,
46
+ keyboardShortcuts,
47
+ showKeyboardShortcutsPanel,
48
+ hideKeyboardShortcutsPanel,
49
+ openThisPanel,
50
+ enterKey,
51
+ leftArrowRightArrow,
52
+ upArrowDownArrow,
53
+ pageUpPageDown,
54
+ homeEnd,
55
+ escape,
56
+ questionMark,
57
+ selectFocusedDate,
58
+ moveFocusByOneDay,
59
+ moveFocusByOneWeek,
60
+ moveFocusByOneMonth,
61
+ moveFocustoStartAndEndOfWeek,
62
+ returnFocusToInput,
63
+ keyboardForwardNavigationInstructions,
64
+ keyboardBackwardNavigationInstructions,
65
+
66
+ chooseAvailableStartDate,
67
+ chooseAvailableEndDate,
68
+ dateIsUnavailable,
69
+ dateIsSelected,
70
+ dateIsSelectedAsStartDate,
71
+ dateIsSelectedAsEndDate,
72
+ };
73
+
74
+ export const DateRangePickerPhrases = {
75
+ calendarLabel,
76
+ roleDescription,
77
+ closeDatePicker,
78
+ clearDates,
79
+ focusStartDate,
80
+ jumpToPrevMonth,
81
+ jumpToNextMonth,
82
+ keyboardShortcuts,
83
+ showKeyboardShortcutsPanel,
84
+ hideKeyboardShortcutsPanel,
85
+ openThisPanel,
86
+ enterKey,
87
+ leftArrowRightArrow,
88
+ upArrowDownArrow,
89
+ pageUpPageDown,
90
+ homeEnd,
91
+ escape,
92
+ questionMark,
93
+ selectFocusedDate,
94
+ moveFocusByOneDay,
95
+ moveFocusByOneWeek,
96
+ moveFocusByOneMonth,
97
+ moveFocustoStartAndEndOfWeek,
98
+ returnFocusToInput,
99
+ keyboardForwardNavigationInstructions,
100
+ keyboardBackwardNavigationInstructions,
101
+ chooseAvailableStartDate,
102
+ chooseAvailableEndDate,
103
+ dateIsUnavailable,
104
+ dateIsSelected,
105
+ dateIsSelectedAsStartDate,
106
+ dateIsSelectedAsEndDate,
107
+ };
108
+
109
+ export const DateRangePickerInputPhrases = {
110
+ focusStartDate,
111
+ clearDates,
112
+ keyboardForwardNavigationInstructions,
113
+ keyboardBackwardNavigationInstructions,
114
+ };
115
+
116
+ export const SingleDatePickerPhrases = {
117
+ calendarLabel,
118
+ roleDescription,
119
+ closeDatePicker,
120
+ clearDate,
121
+ jumpToPrevMonth,
122
+ jumpToNextMonth,
123
+ keyboardShortcuts,
124
+ showKeyboardShortcutsPanel,
125
+ hideKeyboardShortcutsPanel,
126
+ openThisPanel,
127
+ enterKey,
128
+ leftArrowRightArrow,
129
+ upArrowDownArrow,
130
+ pageUpPageDown,
131
+ homeEnd,
132
+ escape,
133
+ questionMark,
134
+ selectFocusedDate,
135
+ moveFocusByOneDay,
136
+ moveFocusByOneWeek,
137
+ moveFocusByOneMonth,
138
+ moveFocustoStartAndEndOfWeek,
139
+ returnFocusToInput,
140
+ keyboardForwardNavigationInstructions,
141
+ keyboardBackwardNavigationInstructions,
142
+ chooseAvailableDate,
143
+ dateIsUnavailable,
144
+ dateIsSelected,
145
+ };
146
+
147
+ export const SingleDatePickerInputPhrases = {
148
+ clearDate,
149
+ keyboardForwardNavigationInstructions,
150
+ keyboardBackwardNavigationInstructions,
151
+ };
152
+
153
+ export const DayPickerPhrases = {
154
+ calendarLabel,
155
+ roleDescription,
156
+ jumpToPrevMonth,
157
+ jumpToNextMonth,
158
+ keyboardShortcuts,
159
+ showKeyboardShortcutsPanel,
160
+ hideKeyboardShortcutsPanel,
161
+ openThisPanel,
162
+ enterKey,
163
+ leftArrowRightArrow,
164
+ upArrowDownArrow,
165
+ pageUpPageDown,
166
+ homeEnd,
167
+ escape,
168
+ questionMark,
169
+ selectFocusedDate,
170
+ moveFocusByOneDay,
171
+ moveFocusByOneWeek,
172
+ moveFocusByOneMonth,
173
+ moveFocustoStartAndEndOfWeek,
174
+ returnFocusToInput,
175
+ chooseAvailableStartDate,
176
+ chooseAvailableEndDate,
177
+ chooseAvailableDate,
178
+ dateIsUnavailable,
179
+ dateIsSelected,
180
+ dateIsSelectedAsStartDate,
181
+ dateIsSelectedAsEndDate,
182
+ };
183
+
184
+ export const DayPickerKeyboardShortcutsPhrases = {
185
+ keyboardShortcuts,
186
+ showKeyboardShortcutsPanel,
187
+ hideKeyboardShortcutsPanel,
188
+ openThisPanel,
189
+ enterKey,
190
+ leftArrowRightArrow,
191
+ upArrowDownArrow,
192
+ pageUpPageDown,
193
+ homeEnd,
194
+ escape,
195
+ questionMark,
196
+ selectFocusedDate,
197
+ moveFocusByOneDay,
198
+ moveFocusByOneWeek,
199
+ moveFocusByOneMonth,
200
+ moveFocustoStartAndEndOfWeek,
201
+ returnFocusToInput,
202
+ };
203
+
204
+ export const DayPickerNavigationPhrases = {
205
+ jumpToPrevMonth,
206
+ jumpToNextMonth,
207
+ };
208
+
209
+ export const CalendarDayPhrases = {
210
+ chooseAvailableDate,
211
+ dateIsUnavailable,
212
+ dateIsSelected,
213
+ dateIsSelectedAsStartDate,
214
+ dateIsSelectedAsEndDate,
215
+ };
package/src/index.js ADDED
@@ -0,0 +1,20 @@
1
+ export { default as CalendarDay } from './components/CalendarDay';
2
+ export { default as CalendarMonth } from './components/CalendarMonth';
3
+ export { default as CalendarMonthGrid } from './components/CalendarMonthGrid';
4
+ export { default as DateRangePicker } from './components/DateRangePicker';
5
+ export { default as DateRangePickerInput } from './components/DateRangePickerInput';
6
+ export { default as DateRangePickerInputController } from './components/DateRangePickerInputController';
7
+ export { default as DateRangePickerShape } from './shapes/DateRangePickerShape';
8
+ export { default as DayPicker } from './components/DayPicker';
9
+ export { default as DayPickerRangeController } from './components/DayPickerRangeController';
10
+ export { default as DayPickerSingleDateController } from './components/DayPickerSingleDateController';
11
+ export { default as SingleDatePicker } from './components/SingleDatePicker';
12
+ export { default as SingleDatePickerInput } from './components/SingleDatePickerInput';
13
+ export { default as SingleDatePickerShape } from './shapes/SingleDatePickerShape';
14
+ export { default as isInclusivelyAfterDay } from './utils/isInclusivelyAfterDay';
15
+ export { default as isInclusivelyBeforeDay } from './utils/isInclusivelyBeforeDay';
16
+ export { default as isNextDay } from './utils/isNextDay';
17
+ export { default as isSameDay } from './utils/isSameDay';
18
+ export { default as toISODateString } from './utils/toISODateString';
19
+ export { default as toLocalizedDateString } from './utils/toLocalizedDateString';
20
+ export { default as toMomentObject } from './utils/toMomentObject';
@@ -0,0 +1,3 @@
1
+ import registerCSSInterfaceWithDefaultTheme from './utils/registerCSSInterfaceWithDefaultTheme';
2
+
3
+ registerCSSInterfaceWithDefaultTheme();
@@ -0,0 +1,8 @@
1
+ import PropTypes from 'prop-types';
2
+
3
+ import {
4
+ ANCHOR_LEFT,
5
+ ANCHOR_RIGHT,
6
+ } from '../constants';
7
+
8
+ export default PropTypes.oneOf([ANCHOR_LEFT, ANCHOR_RIGHT]);
@@ -0,0 +1,15 @@
1
+ import PropTypes from 'prop-types';
2
+
3
+ import {
4
+ INFO_POSITION_TOP,
5
+ INFO_POSITION_BOTTOM,
6
+ INFO_POSITION_BEFORE,
7
+ INFO_POSITION_AFTER,
8
+ } from '../constants';
9
+
10
+ export default PropTypes.oneOf([
11
+ INFO_POSITION_TOP,
12
+ INFO_POSITION_BOTTOM,
13
+ INFO_POSITION_BEFORE,
14
+ INFO_POSITION_AFTER,
15
+ ]);
@@ -0,0 +1,111 @@
1
+ import PropTypes from 'prop-types';
2
+ import momentPropTypes from 'react-moment-proptypes';
3
+ import { mutuallyExclusiveProps, nonNegativeInteger } from 'airbnb-prop-types';
4
+
5
+ import { DateRangePickerPhrases } from '../defaultPhrases';
6
+ import getPhrasePropTypes from '../utils/getPhrasePropTypes';
7
+
8
+ import FocusedInputShape from './FocusedInputShape';
9
+ import IconPositionShape from './IconPositionShape';
10
+ import OrientationShape from './OrientationShape';
11
+ import DisabledShape from './DisabledShape';
12
+ import anchorDirectionShape from './AnchorDirectionShape';
13
+ import openDirectionShape from './OpenDirectionShape';
14
+ import DayOfWeekShape from './DayOfWeekShape';
15
+ import CalendarInfoPositionShape from './CalendarInfoPositionShape';
16
+ import NavPositionShape from './NavPositionShape';
17
+
18
+ export default {
19
+ // required props for a functional interactive DateRangePicker
20
+ startDate: momentPropTypes.momentObj,
21
+ endDate: momentPropTypes.momentObj,
22
+ onDatesChange: PropTypes.func.isRequired,
23
+
24
+ focusedInput: FocusedInputShape,
25
+ onFocusChange: PropTypes.func.isRequired,
26
+
27
+ onClose: PropTypes.func,
28
+
29
+ // input related props
30
+ startDateId: PropTypes.string.isRequired,
31
+ startDatePlaceholderText: PropTypes.string,
32
+ startDateOffset: PropTypes.func,
33
+ endDateOffset: PropTypes.func,
34
+ endDateId: PropTypes.string.isRequired,
35
+ endDatePlaceholderText: PropTypes.string,
36
+ startDateAriaLabel: PropTypes.string,
37
+ endDateAriaLabel: PropTypes.string,
38
+ startDateTitleText: PropTypes.string,
39
+ endDateTitleText: PropTypes.string,
40
+ disabled: DisabledShape,
41
+ required: PropTypes.bool,
42
+ readOnly: PropTypes.bool,
43
+ screenReaderInputMessage: PropTypes.string,
44
+ showClearDates: PropTypes.bool,
45
+ showDefaultInputIcon: PropTypes.bool,
46
+ inputIconPosition: IconPositionShape,
47
+ customInputIcon: PropTypes.node,
48
+ customArrowIcon: PropTypes.node,
49
+ customCloseIcon: PropTypes.node,
50
+ noBorder: PropTypes.bool,
51
+ block: PropTypes.bool,
52
+ small: PropTypes.bool,
53
+ regular: PropTypes.bool,
54
+ keepFocusOnInput: PropTypes.bool,
55
+ autoComplete: PropTypes.string,
56
+
57
+ // calendar presentation and interaction related props
58
+ renderMonthText: mutuallyExclusiveProps(PropTypes.func, 'renderMonthText', 'renderMonthElement'),
59
+ renderMonthElement: mutuallyExclusiveProps(PropTypes.func, 'renderMonthText', 'renderMonthElement'),
60
+ renderWeekHeaderElement: PropTypes.func,
61
+ orientation: OrientationShape,
62
+ anchorDirection: anchorDirectionShape,
63
+ openDirection: openDirectionShape,
64
+ horizontalMargin: PropTypes.number,
65
+ withPortal: PropTypes.bool,
66
+ withFullScreenPortal: PropTypes.bool,
67
+ appendToBody: PropTypes.bool,
68
+ disableScroll: PropTypes.bool,
69
+ daySize: nonNegativeInteger,
70
+ isRTL: PropTypes.bool,
71
+ firstDayOfWeek: DayOfWeekShape,
72
+ initialVisibleMonth: PropTypes.func,
73
+ numberOfMonths: PropTypes.number,
74
+ keepOpenOnDateSelect: PropTypes.bool,
75
+ reopenPickerOnClearDates: PropTypes.bool,
76
+ renderCalendarInfo: PropTypes.func,
77
+ calendarInfoPosition: CalendarInfoPositionShape,
78
+ hideKeyboardShortcutsPanel: PropTypes.bool,
79
+ verticalHeight: nonNegativeInteger,
80
+ transitionDuration: nonNegativeInteger,
81
+ verticalSpacing: nonNegativeInteger,
82
+ horizontalMonthPadding: nonNegativeInteger,
83
+
84
+ // navigation related props
85
+ dayPickerNavigationInlineStyles: PropTypes.object,
86
+ navPosition: NavPositionShape,
87
+ navPrev: PropTypes.node,
88
+ navNext: PropTypes.node,
89
+ renderNavPrevButton: PropTypes.func,
90
+ renderNavNextButton: PropTypes.func,
91
+ onPrevMonthClick: PropTypes.func,
92
+ onNextMonthClick: PropTypes.func,
93
+
94
+ // day presentation and interaction related props
95
+ renderCalendarDay: PropTypes.func,
96
+ renderDayContents: PropTypes.func,
97
+ minimumNights: PropTypes.number,
98
+ minDate: momentPropTypes.momentObj,
99
+ maxDate: momentPropTypes.momentObj,
100
+ enableOutsideDays: PropTypes.bool,
101
+ isDayBlocked: PropTypes.func,
102
+ isOutsideRange: PropTypes.func,
103
+ isDayHighlighted: PropTypes.func,
104
+
105
+ // internationalization props
106
+ displayFormat: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
107
+ monthFormat: PropTypes.string,
108
+ weekDayFormat: PropTypes.string,
109
+ phrases: PropTypes.shape(getPhrasePropTypes(DateRangePickerPhrases)),
110
+ dayAriaLabelFormat: PropTypes.string,
111
+ };
@@ -0,0 +1,5 @@
1
+ import PropTypes from 'prop-types';
2
+
3
+ import { WEEKDAYS } from '../constants';
4
+
5
+ export default PropTypes.oneOf(WEEKDAYS);
@@ -0,0 +1,5 @@
1
+ import PropTypes from 'prop-types';
2
+
3
+ import { START_DATE, END_DATE } from '../constants';
4
+
5
+ export default PropTypes.oneOfType([PropTypes.bool, PropTypes.oneOf([START_DATE, END_DATE])]);
@@ -0,0 +1,8 @@
1
+ import PropTypes from 'prop-types';
2
+
3
+ import {
4
+ START_DATE,
5
+ END_DATE,
6
+ } from '../constants';
7
+
8
+ export default PropTypes.oneOf([START_DATE, END_DATE]);
@@ -0,0 +1,8 @@
1
+ import PropTypes from 'prop-types';
2
+
3
+ import {
4
+ ICON_BEFORE_POSITION,
5
+ ICON_AFTER_POSITION,
6
+ } from '../constants';
7
+
8
+ export default PropTypes.oneOf([ICON_BEFORE_POSITION, ICON_AFTER_POSITION]);
@@ -0,0 +1,20 @@
1
+ import PropTypes from 'prop-types';
2
+ import { and } from 'airbnb-prop-types';
3
+
4
+ export default and([
5
+ PropTypes.instanceOf(Set),
6
+ function modifiers(props, propName, ...rest) {
7
+ const { [propName]: propValue } = props;
8
+ let firstError;
9
+ [...propValue].some((v, i) => {
10
+ const fakePropName = `${propName}: index ${i}`;
11
+ firstError = PropTypes.string.isRequired(
12
+ { [fakePropName]: v },
13
+ fakePropName,
14
+ ...rest,
15
+ );
16
+ return firstError != null;
17
+ });
18
+ return firstError == null ? null : firstError;
19
+ },
20
+ ], 'Modifiers (Set of Strings)');
@@ -0,0 +1,8 @@
1
+ import PropTypes from 'prop-types';
2
+
3
+ import {
4
+ NAV_POSITION_BOTTOM,
5
+ NAV_POSITION_TOP,
6
+ } from '../constants';
7
+
8
+ export default PropTypes.oneOf([NAV_POSITION_BOTTOM, NAV_POSITION_TOP]);
@@ -0,0 +1,8 @@
1
+ import PropTypes from 'prop-types';
2
+
3
+ import {
4
+ OPEN_DOWN,
5
+ OPEN_UP,
6
+ } from '../constants';
7
+
8
+ export default PropTypes.oneOf([OPEN_DOWN, OPEN_UP]);
@@ -0,0 +1,8 @@
1
+ import PropTypes from 'prop-types';
2
+
3
+ import {
4
+ HORIZONTAL_ORIENTATION,
5
+ VERTICAL_ORIENTATION,
6
+ } from '../constants';
7
+
8
+ export default PropTypes.oneOf([HORIZONTAL_ORIENTATION, VERTICAL_ORIENTATION]);
@@ -0,0 +1,13 @@
1
+ import PropTypes from 'prop-types';
2
+
3
+ import {
4
+ HORIZONTAL_ORIENTATION,
5
+ VERTICAL_ORIENTATION,
6
+ VERTICAL_SCROLLABLE,
7
+ } from '../constants';
8
+
9
+ export default PropTypes.oneOf([
10
+ HORIZONTAL_ORIENTATION,
11
+ VERTICAL_ORIENTATION,
12
+ VERTICAL_SCROLLABLE,
13
+ ]);
@@ -0,0 +1,100 @@
1
+ import PropTypes from 'prop-types';
2
+ import momentPropTypes from 'react-moment-proptypes';
3
+ import { mutuallyExclusiveProps, nonNegativeInteger } from 'airbnb-prop-types';
4
+
5
+ import { SingleDatePickerPhrases } from '../defaultPhrases';
6
+ import getPhrasePropTypes from '../utils/getPhrasePropTypes';
7
+
8
+ import IconPositionShape from './IconPositionShape';
9
+ import OrientationShape from './OrientationShape';
10
+ import anchorDirectionShape from './AnchorDirectionShape';
11
+ import openDirectionShape from './OpenDirectionShape';
12
+ import DayOfWeekShape from './DayOfWeekShape';
13
+ import CalendarInfoPositionShape from './CalendarInfoPositionShape';
14
+ import NavPositionShape from './NavPositionShape';
15
+
16
+ export default {
17
+ // required props for a functional interactive SingleDatePicker
18
+ date: momentPropTypes.momentObj,
19
+ onDateChange: PropTypes.func.isRequired,
20
+
21
+ focused: PropTypes.bool,
22
+ onFocusChange: PropTypes.func.isRequired,
23
+
24
+ // input related props
25
+ id: PropTypes.string.isRequired,
26
+ placeholder: PropTypes.string,
27
+ ariaLabel: PropTypes.string,
28
+ titleText: PropTypes.string,
29
+ disabled: PropTypes.bool,
30
+ required: PropTypes.bool,
31
+ readOnly: PropTypes.bool,
32
+ screenReaderInputMessage: PropTypes.string,
33
+ showClearDate: PropTypes.bool,
34
+ customCloseIcon: PropTypes.node,
35
+ showDefaultInputIcon: PropTypes.bool,
36
+ inputIconPosition: IconPositionShape,
37
+ customInputIcon: PropTypes.node,
38
+ noBorder: PropTypes.bool,
39
+ block: PropTypes.bool,
40
+ small: PropTypes.bool,
41
+ regular: PropTypes.bool,
42
+ verticalSpacing: nonNegativeInteger,
43
+ keepFocusOnInput: PropTypes.bool,
44
+ autoComplete: PropTypes.string,
45
+
46
+ // calendar presentation and interaction related props
47
+ renderMonthText: mutuallyExclusiveProps(PropTypes.func, 'renderMonthText', 'renderMonthElement'),
48
+ renderMonthElement: mutuallyExclusiveProps(PropTypes.func, 'renderMonthText', 'renderMonthElement'),
49
+ renderWeekHeaderElement: PropTypes.func,
50
+ orientation: OrientationShape,
51
+ anchorDirection: anchorDirectionShape,
52
+ openDirection: openDirectionShape,
53
+ horizontalMargin: PropTypes.number,
54
+ withPortal: PropTypes.bool,
55
+ withFullScreenPortal: PropTypes.bool,
56
+ appendToBody: PropTypes.bool,
57
+ disableScroll: PropTypes.bool,
58
+ initialVisibleMonth: PropTypes.func,
59
+ firstDayOfWeek: DayOfWeekShape,
60
+ numberOfMonths: PropTypes.number,
61
+ keepOpenOnDateSelect: PropTypes.bool,
62
+ reopenPickerOnClearDate: PropTypes.bool,
63
+ renderCalendarInfo: PropTypes.func,
64
+ calendarInfoPosition: CalendarInfoPositionShape,
65
+ hideKeyboardShortcutsPanel: PropTypes.bool,
66
+ daySize: nonNegativeInteger,
67
+ isRTL: PropTypes.bool,
68
+ verticalHeight: nonNegativeInteger,
69
+ transitionDuration: nonNegativeInteger,
70
+ horizontalMonthPadding: nonNegativeInteger,
71
+
72
+ // navigation related props
73
+ dayPickerNavigationInlineStyles: PropTypes.object,
74
+ navPosition: NavPositionShape,
75
+ navPrev: PropTypes.node,
76
+ navNext: PropTypes.node,
77
+ renderNavPrevButton: PropTypes.func,
78
+ renderNavNextButton: PropTypes.func,
79
+
80
+ onPrevMonthClick: PropTypes.func,
81
+ onNextMonthClick: PropTypes.func,
82
+ onClose: PropTypes.func,
83
+
84
+ // day presentation and interaction related props
85
+ renderCalendarDay: PropTypes.func,
86
+ renderDayContents: PropTypes.func,
87
+ enableOutsideDays: PropTypes.bool,
88
+ isDayBlocked: PropTypes.func,
89
+ isOutsideRange: PropTypes.func,
90
+ isDayHighlighted: PropTypes.func,
91
+ minDate: momentPropTypes.momentObj,
92
+ maxDate: momentPropTypes.momentObj,
93
+
94
+ // internationalization props
95
+ displayFormat: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
96
+ monthFormat: PropTypes.string,
97
+ weekDayFormat: PropTypes.string,
98
+ phrases: PropTypes.shape(getPhrasePropTypes(SingleDatePickerPhrases)),
99
+ dayAriaLabelFormat: PropTypes.string,
100
+ };
@@ -0,0 +1 @@
1
+ <svg focusable="false" viewBox="0 0 1000 1000"><path d="M336 275L126 485h806c13 0 23 10 23 23s-10 23-23 23H126l210 210c11 11 11 21 0 32-5 5-10 7-16 7s-11-2-16-7L55 524c-11-11-11-21 0-32l249-249c21-22 53 10 32 32z"/></svg>
@@ -0,0 +1 @@
1
+ <svg focusable="false" viewBox="0 0 1000 1000"><path d="M694 242l249 250c12 11 12 21 1 32L694 773c-5 5-10 7-16 7s-11-2-16-7c-11-11-11-21 0-32l210-210H68c-13 0-23-10-23-23s10-23 23-23h806L662 275c-21-22 11-54 32-33z"/></svg>
@@ -0,0 +1 @@
1
+ <svg focusable="false" viewBox="0 0 1393.1 1500"><path d="m107 1393h241v-241h-241zm295 0h268v-241h-268zm-295-295h241v-268h-241zm295 0h268v-268h-268zm-295-321h241v-241h-241zm616 616h268v-241h-268zm-321-616h268v-241h-268zm643 616h241v-241h-241zm-322-295h268v-268h-268zm-294-723v-241c0-7-3-14-8-19-6-5-12-8-19-8h-54c-7 0-13 3-19 8-5 5-8 12-8 19v241c0 7 3 14 8 19 6 5 12 8 19 8h54c7 0 13-3 19-8 5-5 8-12 8-19zm616 723h241v-268h-241zm-322-321h268v-241h-268zm322 0h241v-241h-241zm27-402v-241c0-7-3-14-8-19-6-5-12-8-19-8h-54c-7 0-13 3-19 8-5 5-8 12-8 19v241c0 7 3 14 8 19 6 5 12 8 19 8h54c7 0 13-3 19-8 5-5 8-12 8-19zm321-54v1072c0 29-11 54-32 75s-46 32-75 32h-1179c-29 0-54-11-75-32s-32-46-32-75v-1072c0-29 11-54 32-75s46-32 75-32h107v-80c0-37 13-68 40-95s57-39 94-39h54c37 0 68 13 95 39 26 26 39 58 39 95v80h321v-80c0-37 13-69 40-95 26-26 57-39 94-39h54c37 0 68 13 94 39s40 58 40 95v80h107c29 0 54 11 75 32s32 46 32 75z"/></svg>
@@ -0,0 +1 @@
1
+ <svg focusable="false" viewBox="0 0 1000 1000"><path d="M968 289L514 741c-11 11-21 11-32 0L29 289c-4-5-6-11-6-16 0-13 10-23 23-23 6 0 11 2 15 7l437 436 438-436c4-5 9-7 16-7 6 0 11 2 16 7 9 10 9 21 0 32z"/></svg>
@@ -0,0 +1 @@
1
+ <svg focusable="false" viewBox="0 0 1000 1000"><path d="M32 713l453-453c11-11 21-11 32 0l453 453c5 5 7 10 7 16 0 13-10 23-22 23-7 0-12-2-16-7L501 309 64 745c-4 5-9 7-15 7-7 0-12-2-17-7-9-11-9-21 0-32z"/></svg>
@@ -0,0 +1 @@
1
+ <svg focusable="false" viewBox="0 0 12 12"><path fill-rule="evenodd" d="M11.53.47a.75.75 0 0 0-1.061 0l-4.47 4.47L1.529.47A.75.75 0 1 0 .468 1.531l4.47 4.47-4.47 4.47a.75.75 0 1 0 1.061 1.061l4.47-4.47 4.47 4.47a.75.75 0 1 0 1.061-1.061l-4.47-4.47 4.47-4.47a.75.75 0 0 0 0-1.061z"/></svg>