@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,365 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _inheritsLoose from "@babel/runtime/helpers/esm/inheritsLoose";
3
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
4
+ import shallowEqual from "enzyme-shallow-equal";
5
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
7
+ import React from 'react';
8
+ import PropTypes from 'prop-types';
9
+ import momentPropTypes from 'react-moment-proptypes';
10
+ import { forbidExtraProps, mutuallyExclusiveProps, nonNegativeInteger } from 'airbnb-prop-types';
11
+ import { withStyles, withStylesPropTypes } from 'react-with-styles';
12
+ import moment from 'moment';
13
+ import { addEventListener } from 'consolidated-events';
14
+ import { CalendarDayPhrases } from '../defaultPhrases';
15
+ import getPhrasePropTypes from '../utils/getPhrasePropTypes';
16
+ import noflip from '../utils/noflip';
17
+ import CalendarMonth from './CalendarMonth';
18
+ import isTransitionEndSupported from '../utils/isTransitionEndSupported';
19
+ import getTransformStyles from '../utils/getTransformStyles';
20
+ import getCalendarMonthWidth from '../utils/getCalendarMonthWidth';
21
+ import toISOMonthString from '../utils/toISOMonthString';
22
+ import isPrevMonth from '../utils/isPrevMonth';
23
+ import isNextMonth from '../utils/isNextMonth';
24
+ import ModifiersShape from '../shapes/ModifiersShape';
25
+ import ScrollableOrientationShape from '../shapes/ScrollableOrientationShape';
26
+ import DayOfWeekShape from '../shapes/DayOfWeekShape';
27
+ import { HORIZONTAL_ORIENTATION, VERTICAL_ORIENTATION, VERTICAL_SCROLLABLE, DAY_SIZE } from '../constants';
28
+ var propTypes = process.env.NODE_ENV !== "production" ? forbidExtraProps(_objectSpread(_objectSpread({}, withStylesPropTypes), {}, {
29
+ enableOutsideDays: PropTypes.bool,
30
+ firstVisibleMonthIndex: PropTypes.number,
31
+ horizontalMonthPadding: nonNegativeInteger,
32
+ initialMonth: momentPropTypes.momentObj,
33
+ isAnimating: PropTypes.bool,
34
+ numberOfMonths: PropTypes.number,
35
+ modifiers: PropTypes.objectOf(PropTypes.objectOf(ModifiersShape)),
36
+ orientation: ScrollableOrientationShape,
37
+ onDayClick: PropTypes.func,
38
+ onDayMouseEnter: PropTypes.func,
39
+ onDayMouseLeave: PropTypes.func,
40
+ onMonthTransitionEnd: PropTypes.func,
41
+ onMonthChange: PropTypes.func,
42
+ onYearChange: PropTypes.func,
43
+ renderMonthText: mutuallyExclusiveProps(PropTypes.func, 'renderMonthText', 'renderMonthElement'),
44
+ renderCalendarDay: PropTypes.func,
45
+ renderDayContents: PropTypes.func,
46
+ translationValue: PropTypes.number,
47
+ renderMonthElement: mutuallyExclusiveProps(PropTypes.func, 'renderMonthText', 'renderMonthElement'),
48
+ daySize: nonNegativeInteger,
49
+ focusedDate: momentPropTypes.momentObj,
50
+ // indicates focusable day
51
+ isFocused: PropTypes.bool,
52
+ // indicates whether or not to move focus to focusable day
53
+ firstDayOfWeek: DayOfWeekShape,
54
+ setMonthTitleHeight: PropTypes.func,
55
+ isRTL: PropTypes.bool,
56
+ transitionDuration: nonNegativeInteger,
57
+ verticalBorderSpacing: nonNegativeInteger,
58
+ // i18n
59
+ monthFormat: PropTypes.string,
60
+ phrases: PropTypes.shape(getPhrasePropTypes(CalendarDayPhrases)),
61
+ dayAriaLabelFormat: PropTypes.string
62
+ })) : {};
63
+ var defaultProps = {
64
+ enableOutsideDays: false,
65
+ firstVisibleMonthIndex: 0,
66
+ horizontalMonthPadding: 13,
67
+ initialMonth: moment(),
68
+ isAnimating: false,
69
+ numberOfMonths: 1,
70
+ modifiers: {},
71
+ orientation: HORIZONTAL_ORIENTATION,
72
+ onDayClick: function onDayClick() {},
73
+ onDayMouseEnter: function onDayMouseEnter() {},
74
+ onDayMouseLeave: function onDayMouseLeave() {},
75
+ onMonthChange: function onMonthChange() {},
76
+ onYearChange: function onYearChange() {},
77
+ onMonthTransitionEnd: function onMonthTransitionEnd() {},
78
+ renderMonthText: null,
79
+ renderCalendarDay: undefined,
80
+ renderDayContents: null,
81
+ translationValue: null,
82
+ renderMonthElement: null,
83
+ daySize: DAY_SIZE,
84
+ focusedDate: null,
85
+ isFocused: false,
86
+ firstDayOfWeek: null,
87
+ setMonthTitleHeight: null,
88
+ isRTL: false,
89
+ transitionDuration: 200,
90
+ verticalBorderSpacing: undefined,
91
+ // i18n
92
+ monthFormat: 'MMMM YYYY',
93
+ // english locale
94
+ phrases: CalendarDayPhrases,
95
+ dayAriaLabelFormat: undefined
96
+ };
97
+ function getMonths(initialMonth, numberOfMonths, withoutTransitionMonths) {
98
+ var month = initialMonth.clone();
99
+ if (!withoutTransitionMonths) month = month.subtract(1, 'month');
100
+ var months = [];
101
+ for (var i = 0; i < (withoutTransitionMonths ? numberOfMonths : numberOfMonths + 2); i += 1) {
102
+ months.push(month);
103
+ month = month.clone().add(1, 'month');
104
+ }
105
+ return months;
106
+ }
107
+ var CalendarMonthGrid = /*#__PURE__*/function (_ref2, _ref) {
108
+ function CalendarMonthGrid(props) {
109
+ var _this;
110
+ _this = _ref2.call(this, props) || this;
111
+ var withoutTransitionMonths = props.orientation === VERTICAL_SCROLLABLE;
112
+ _this.state = {
113
+ months: getMonths(props.initialMonth, props.numberOfMonths, withoutTransitionMonths),
114
+ initialMonth: props.initialMonth,
115
+ numberOfMonths: props.numberOfMonths,
116
+ locale: moment.locale()
117
+ };
118
+ _this.isTransitionEndSupported = isTransitionEndSupported();
119
+ _this.onTransitionEnd = _this.onTransitionEnd.bind(_this);
120
+ _this.setContainerRef = _this.setContainerRef.bind(_this);
121
+ _this.onMonthSelect = _this.onMonthSelect.bind(_this);
122
+ _this.onYearSelect = _this.onYearSelect.bind(_this);
123
+ return _this;
124
+ }
125
+ _inheritsLoose(CalendarMonthGrid, _ref2);
126
+ var _proto = CalendarMonthGrid.prototype;
127
+ _proto[_ref] = function (nextProps, nextState) {
128
+ return !shallowEqual(this.props, nextProps) || !shallowEqual(this.state, nextState);
129
+ };
130
+ _proto.componentDidMount = function componentDidMount() {
131
+ this.removeEventListener = addEventListener(this.container, 'transitionend', this.onTransitionEnd);
132
+ };
133
+ CalendarMonthGrid.getDerivedStateFromProps = function getDerivedStateFromProps(props, state) {
134
+ var initialMonth = props.initialMonth,
135
+ numberOfMonths = props.numberOfMonths,
136
+ orientation = props.orientation;
137
+ var months = state.months,
138
+ prevInitialMonth = state.initialMonth,
139
+ prevNumberOfMonths = state.numberOfMonths,
140
+ prevLocale = state.locale;
141
+ var hasMonthChanged = !prevInitialMonth.isSame(initialMonth, 'month');
142
+ var hasNumberOfMonthsChanged = prevNumberOfMonths !== numberOfMonths;
143
+ var newMonths = months;
144
+ if (hasMonthChanged || hasNumberOfMonthsChanged) {
145
+ if (hasMonthChanged && !hasNumberOfMonthsChanged) {
146
+ if (isNextMonth(prevInitialMonth, initialMonth)) {
147
+ newMonths = months.slice(1);
148
+ newMonths.push(months[months.length - 1].clone().add(1, 'month'));
149
+ } else if (isPrevMonth(prevInitialMonth, initialMonth)) {
150
+ newMonths = months.slice(0, months.length - 1);
151
+ newMonths.unshift(months[0].clone().subtract(1, 'month'));
152
+ } else {
153
+ var withoutTransitionMonths = orientation === VERTICAL_SCROLLABLE;
154
+ newMonths = getMonths(initialMonth, numberOfMonths, withoutTransitionMonths);
155
+ }
156
+ }
157
+ if (hasNumberOfMonthsChanged) {
158
+ var _withoutTransitionMonths = orientation === VERTICAL_SCROLLABLE;
159
+ newMonths = getMonths(initialMonth, numberOfMonths, _withoutTransitionMonths);
160
+ }
161
+ var momentLocale = moment.locale();
162
+ var locale = prevLocale;
163
+ if (locale !== momentLocale) {
164
+ locale = momentLocale;
165
+ newMonths = newMonths.map(function (m) {
166
+ return m.locale(locale);
167
+ });
168
+ }
169
+ return {
170
+ months: newMonths,
171
+ initialMonth: initialMonth,
172
+ numberOfMonths: numberOfMonths,
173
+ locale: locale
174
+ };
175
+ }
176
+ return null;
177
+ };
178
+ _proto.componentDidUpdate = function componentDidUpdate() {
179
+ var _this$props = this.props,
180
+ isAnimating = _this$props.isAnimating,
181
+ transitionDuration = _this$props.transitionDuration,
182
+ onMonthTransitionEnd = _this$props.onMonthTransitionEnd;
183
+
184
+ // For IE9, immediately call onMonthTransitionEnd instead of
185
+ // waiting for the animation to complete. Similarly, if transitionDuration
186
+ // is set to 0, also immediately invoke the onMonthTransitionEnd callback
187
+ if ((!this.isTransitionEndSupported || !transitionDuration) && isAnimating) {
188
+ onMonthTransitionEnd();
189
+ }
190
+ };
191
+ _proto.componentWillUnmount = function componentWillUnmount() {
192
+ if (this.removeEventListener) this.removeEventListener();
193
+ };
194
+ _proto.onTransitionEnd = function onTransitionEnd() {
195
+ var onMonthTransitionEnd = this.props.onMonthTransitionEnd;
196
+ onMonthTransitionEnd();
197
+ };
198
+ _proto.onMonthSelect = function onMonthSelect(currentMonth, newMonthVal) {
199
+ var newMonth = currentMonth.clone();
200
+ var _this$props2 = this.props,
201
+ onMonthChange = _this$props2.onMonthChange,
202
+ orientation = _this$props2.orientation;
203
+ var months = this.state.months;
204
+ var withoutTransitionMonths = orientation === VERTICAL_SCROLLABLE;
205
+ var initialMonthSubtraction = months.indexOf(currentMonth);
206
+ if (!withoutTransitionMonths) {
207
+ initialMonthSubtraction -= 1;
208
+ }
209
+ newMonth.set('month', newMonthVal).subtract(initialMonthSubtraction, 'months');
210
+ onMonthChange(newMonth);
211
+ };
212
+ _proto.onYearSelect = function onYearSelect(currentMonth, newYearVal) {
213
+ var newMonth = currentMonth.clone();
214
+ var _this$props3 = this.props,
215
+ onYearChange = _this$props3.onYearChange,
216
+ orientation = _this$props3.orientation;
217
+ var months = this.state.months;
218
+ var withoutTransitionMonths = orientation === VERTICAL_SCROLLABLE;
219
+ var initialMonthSubtraction = months.indexOf(currentMonth);
220
+ if (!withoutTransitionMonths) {
221
+ initialMonthSubtraction -= 1;
222
+ }
223
+ newMonth.set('year', newYearVal).subtract(initialMonthSubtraction, 'months');
224
+ onYearChange(newMonth);
225
+ };
226
+ _proto.setContainerRef = function setContainerRef(ref) {
227
+ this.container = ref;
228
+ };
229
+ _proto.render = function render() {
230
+ var _this2 = this;
231
+ var _this$props4 = this.props,
232
+ enableOutsideDays = _this$props4.enableOutsideDays,
233
+ firstVisibleMonthIndex = _this$props4.firstVisibleMonthIndex,
234
+ horizontalMonthPadding = _this$props4.horizontalMonthPadding,
235
+ isAnimating = _this$props4.isAnimating,
236
+ modifiers = _this$props4.modifiers,
237
+ numberOfMonths = _this$props4.numberOfMonths,
238
+ monthFormat = _this$props4.monthFormat,
239
+ orientation = _this$props4.orientation,
240
+ translationValue = _this$props4.translationValue,
241
+ daySize = _this$props4.daySize,
242
+ onDayMouseEnter = _this$props4.onDayMouseEnter,
243
+ onDayMouseLeave = _this$props4.onDayMouseLeave,
244
+ onDayClick = _this$props4.onDayClick,
245
+ renderMonthText = _this$props4.renderMonthText,
246
+ renderCalendarDay = _this$props4.renderCalendarDay,
247
+ renderDayContents = _this$props4.renderDayContents,
248
+ renderMonthElement = _this$props4.renderMonthElement,
249
+ onMonthTransitionEnd = _this$props4.onMonthTransitionEnd,
250
+ firstDayOfWeek = _this$props4.firstDayOfWeek,
251
+ focusedDate = _this$props4.focusedDate,
252
+ isFocused = _this$props4.isFocused,
253
+ isRTL = _this$props4.isRTL,
254
+ css = _this$props4.css,
255
+ styles = _this$props4.styles,
256
+ phrases = _this$props4.phrases,
257
+ dayAriaLabelFormat = _this$props4.dayAriaLabelFormat,
258
+ transitionDuration = _this$props4.transitionDuration,
259
+ verticalBorderSpacing = _this$props4.verticalBorderSpacing,
260
+ setMonthTitleHeight = _this$props4.setMonthTitleHeight;
261
+ var months = this.state.months;
262
+ var isVertical = orientation === VERTICAL_ORIENTATION;
263
+ var isVerticalScrollable = orientation === VERTICAL_SCROLLABLE;
264
+ var isHorizontal = orientation === HORIZONTAL_ORIENTATION;
265
+ var calendarMonthWidth = getCalendarMonthWidth(daySize, horizontalMonthPadding);
266
+ var width = isVertical || isVerticalScrollable ? calendarMonthWidth : (numberOfMonths + 2) * calendarMonthWidth;
267
+ var transformType = isVertical || isVerticalScrollable ? 'translateY' : 'translateX';
268
+ var transformValue = "".concat(transformType, "(").concat(translationValue, "px)");
269
+ return /*#__PURE__*/React.createElement("div", _extends({}, css(styles.CalendarMonthGrid, isHorizontal && styles.CalendarMonthGrid__horizontal, isVertical && styles.CalendarMonthGrid__vertical, isVerticalScrollable && styles.CalendarMonthGrid__vertical_scrollable, isAnimating && styles.CalendarMonthGrid__animating, isAnimating && transitionDuration && {
270
+ transition: "transform ".concat(transitionDuration, "ms ease-in-out 0.1s")
271
+ }, _objectSpread(_objectSpread({}, getTransformStyles(transformValue)), {}, {
272
+ width: width
273
+ })), {
274
+ ref: this.setContainerRef,
275
+ onTransitionEnd: onMonthTransitionEnd
276
+ }), months.map(function (month, i) {
277
+ var isVisible = i >= firstVisibleMonthIndex && i < firstVisibleMonthIndex + numberOfMonths;
278
+ var hideForAnimation = i === 0 && !isVisible;
279
+ var showForAnimation = i === 0 && isAnimating && isVisible;
280
+ var monthString = toISOMonthString(month);
281
+ return /*#__PURE__*/React.createElement("div", _extends({
282
+ key: monthString
283
+ }, css(isHorizontal && styles.CalendarMonthGrid_month__horizontal, hideForAnimation && styles.CalendarMonthGrid_month__hideForAnimation, showForAnimation && !isVertical && !isRTL && {
284
+ position: 'absolute',
285
+ left: -calendarMonthWidth
286
+ }, showForAnimation && !isVertical && isRTL && {
287
+ position: 'absolute',
288
+ right: 0
289
+ }, showForAnimation && isVertical && {
290
+ position: 'absolute',
291
+ top: -translationValue
292
+ }, !isVisible && !isAnimating && styles.CalendarMonthGrid_month__hidden)), /*#__PURE__*/React.createElement(CalendarMonth, {
293
+ month: month,
294
+ isVisible: isVisible,
295
+ enableOutsideDays: enableOutsideDays,
296
+ modifiers: modifiers[monthString],
297
+ monthFormat: monthFormat,
298
+ orientation: orientation,
299
+ onDayMouseEnter: onDayMouseEnter,
300
+ onDayMouseLeave: onDayMouseLeave,
301
+ onDayClick: onDayClick,
302
+ onMonthSelect: _this2.onMonthSelect,
303
+ onYearSelect: _this2.onYearSelect,
304
+ renderMonthText: renderMonthText,
305
+ renderCalendarDay: renderCalendarDay,
306
+ renderDayContents: renderDayContents,
307
+ renderMonthElement: renderMonthElement,
308
+ firstDayOfWeek: firstDayOfWeek,
309
+ daySize: daySize,
310
+ focusedDate: isVisible ? focusedDate : null,
311
+ isFocused: isFocused,
312
+ phrases: phrases,
313
+ setMonthTitleHeight: setMonthTitleHeight,
314
+ dayAriaLabelFormat: dayAriaLabelFormat,
315
+ verticalBorderSpacing: verticalBorderSpacing,
316
+ horizontalMonthPadding: horizontalMonthPadding
317
+ }));
318
+ }));
319
+ };
320
+ return CalendarMonthGrid;
321
+ }(React.PureComponent || React.Component, !React.PureComponent && "shouldComponentUpdate");
322
+ CalendarMonthGrid.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
323
+ CalendarMonthGrid.defaultProps = defaultProps;
324
+ export default withStyles(function (_ref3) {
325
+ var _ref3$reactDates = _ref3.reactDates,
326
+ color = _ref3$reactDates.color,
327
+ spacing = _ref3$reactDates.spacing,
328
+ zIndex = _ref3$reactDates.zIndex;
329
+ return {
330
+ CalendarMonthGrid: {
331
+ background: color.background,
332
+ textAlign: noflip('left'),
333
+ zIndex: zIndex
334
+ },
335
+ CalendarMonthGrid__animating: {
336
+ zIndex: zIndex + 1
337
+ },
338
+ CalendarMonthGrid__horizontal: {
339
+ position: 'absolute',
340
+ left: noflip(spacing.dayPickerHorizontalPadding)
341
+ },
342
+ CalendarMonthGrid__vertical: {
343
+ margin: '0 auto'
344
+ },
345
+ CalendarMonthGrid__vertical_scrollable: {
346
+ margin: '0 auto'
347
+ },
348
+ CalendarMonthGrid_month__horizontal: {
349
+ display: 'inline-block',
350
+ verticalAlign: 'top',
351
+ minHeight: '100%'
352
+ },
353
+ CalendarMonthGrid_month__hideForAnimation: {
354
+ position: 'absolute',
355
+ zIndex: zIndex - 1,
356
+ opacity: 0,
357
+ pointerEvents: 'none'
358
+ },
359
+ CalendarMonthGrid_month__hidden: {
360
+ visibility: 'hidden'
361
+ }
362
+ };
363
+ }, {
364
+ pureComponent: typeof React.PureComponent !== 'undefined'
365
+ })(CalendarMonthGrid);
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { forbidExtraProps } from 'airbnb-prop-types';
4
+ var propTypes = process.env.NODE_ENV !== "production" ? forbidExtraProps({
5
+ children: PropTypes.node.isRequired
6
+ }) : {};
7
+ export default function CalendarWeek(_ref) {
8
+ var children = _ref.children;
9
+ return /*#__PURE__*/React.createElement("tr", null, children);
10
+ }
11
+ CalendarWeek.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ var ChevronDown = function ChevronDown(props) {
3
+ return /*#__PURE__*/React.createElement("svg", props, /*#__PURE__*/React.createElement("path", {
4
+ 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"
5
+ }));
6
+ };
7
+ ChevronDown.defaultProps = {
8
+ focusable: "false",
9
+ viewBox: "0 0 1000 1000"
10
+ };
11
+ export default ChevronDown;
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ var ChevronUp = function ChevronUp(props) {
3
+ return /*#__PURE__*/React.createElement("svg", props, /*#__PURE__*/React.createElement("path", {
4
+ 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"
5
+ }));
6
+ };
7
+ ChevronUp.defaultProps = {
8
+ focusable: "false",
9
+ viewBox: "0 0 1000 1000"
10
+ };
11
+ export default ChevronUp;
@@ -0,0 +1,12 @@
1
+ import React from "react";
2
+ var CloseButton = function CloseButton(props) {
3
+ return /*#__PURE__*/React.createElement("svg", props, /*#__PURE__*/React.createElement("path", {
4
+ fillRule: "evenodd",
5
+ 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"
6
+ }));
7
+ };
8
+ CloseButton.defaultProps = {
9
+ focusable: "false",
10
+ viewBox: "0 0 12 12"
11
+ };
12
+ export default CloseButton;