@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,695 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports["default"] = void 0;
8
+ var _enzymeShallowEqual = _interopRequireDefault(require("enzyme-shallow-equal"));
9
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
+ var _readOnlyError2 = _interopRequireDefault(require("@babel/runtime/helpers/readOnlyError"));
11
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
12
+ var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
13
+ var _react = _interopRequireDefault(require("react"));
14
+ var _propTypes = _interopRequireDefault(require("prop-types"));
15
+ var _reactMomentProptypes = _interopRequireDefault(require("react-moment-proptypes"));
16
+ var _airbnbPropTypes = require("airbnb-prop-types");
17
+ var _moment = _interopRequireDefault(require("moment"));
18
+ var _object = _interopRequireDefault(require("object.values"));
19
+ var _isTouchDevice = _interopRequireDefault(require("is-touch-device"));
20
+ var _defaultPhrases = require("../defaultPhrases");
21
+ var _getPhrasePropTypes = _interopRequireDefault(require("../utils/getPhrasePropTypes"));
22
+ var _isSameDay = _interopRequireDefault(require("../utils/isSameDay"));
23
+ var _isAfterDay = _interopRequireDefault(require("../utils/isAfterDay"));
24
+ var _isDayVisible = _interopRequireDefault(require("../utils/isDayVisible"));
25
+ var _getVisibleDays = _interopRequireDefault(require("../utils/getVisibleDays"));
26
+ var _toISODateString = _interopRequireDefault(require("../utils/toISODateString"));
27
+ var _modifiers = require("../utils/modifiers");
28
+ var _ScrollableOrientationShape = _interopRequireDefault(require("../shapes/ScrollableOrientationShape"));
29
+ var _DayOfWeekShape = _interopRequireDefault(require("../shapes/DayOfWeekShape"));
30
+ var _CalendarInfoPositionShape = _interopRequireDefault(require("../shapes/CalendarInfoPositionShape"));
31
+ var _NavPositionShape = _interopRequireDefault(require("../shapes/NavPositionShape"));
32
+ var _constants = require("../constants");
33
+ var _DayPicker = _interopRequireDefault(require("./DayPicker"));
34
+ var _getPooledMoment = _interopRequireDefault(require("../utils/getPooledMoment"));
35
+ 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; }
36
+ 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) { (0, _defineProperty2["default"])(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; }
37
+ // Default value of the date property. Represents the state
38
+ // when there is no date selected.
39
+ // TODO: use null
40
+ var DATE_UNSET_VALUE = undefined;
41
+ var propTypes = process.env.NODE_ENV !== "production" ? (0, _airbnbPropTypes.forbidExtraProps)({
42
+ date: _reactMomentProptypes["default"].momentObj,
43
+ minDate: _reactMomentProptypes["default"].momentObj,
44
+ maxDate: _reactMomentProptypes["default"].momentObj,
45
+ onDateChange: _propTypes["default"].func,
46
+ allowUnselect: _propTypes["default"].bool,
47
+ focused: _propTypes["default"].bool,
48
+ onFocusChange: _propTypes["default"].func,
49
+ onClose: _propTypes["default"].func,
50
+ keepOpenOnDateSelect: _propTypes["default"].bool,
51
+ isOutsideRange: _propTypes["default"].func,
52
+ isDayBlocked: _propTypes["default"].func,
53
+ isDayHighlighted: _propTypes["default"].func,
54
+ // DayPicker props
55
+ renderMonthText: (0, _airbnbPropTypes.mutuallyExclusiveProps)(_propTypes["default"].func, 'renderMonthText', 'renderMonthElement'),
56
+ renderMonthElement: (0, _airbnbPropTypes.mutuallyExclusiveProps)(_propTypes["default"].func, 'renderMonthText', 'renderMonthElement'),
57
+ renderWeekHeaderElement: _propTypes["default"].func,
58
+ enableOutsideDays: _propTypes["default"].bool,
59
+ numberOfMonths: _propTypes["default"].number,
60
+ orientation: _ScrollableOrientationShape["default"],
61
+ withPortal: _propTypes["default"].bool,
62
+ initialVisibleMonth: _propTypes["default"].func,
63
+ firstDayOfWeek: _DayOfWeekShape["default"],
64
+ hideKeyboardShortcutsPanel: _propTypes["default"].bool,
65
+ daySize: _airbnbPropTypes.nonNegativeInteger,
66
+ verticalHeight: _airbnbPropTypes.nonNegativeInteger,
67
+ noBorder: _propTypes["default"].bool,
68
+ verticalBorderSpacing: _airbnbPropTypes.nonNegativeInteger,
69
+ transitionDuration: _airbnbPropTypes.nonNegativeInteger,
70
+ horizontalMonthPadding: _airbnbPropTypes.nonNegativeInteger,
71
+ dayPickerNavigationInlineStyles: _propTypes["default"].object,
72
+ navPosition: _NavPositionShape["default"],
73
+ navPrev: _propTypes["default"].node,
74
+ navNext: _propTypes["default"].node,
75
+ renderNavPrevButton: _propTypes["default"].func,
76
+ renderNavNextButton: _propTypes["default"].func,
77
+ noNavButtons: _propTypes["default"].bool,
78
+ noNavNextButton: _propTypes["default"].bool,
79
+ noNavPrevButton: _propTypes["default"].bool,
80
+ onPrevMonthClick: _propTypes["default"].func,
81
+ onNextMonthClick: _propTypes["default"].func,
82
+ onOutsideClick: _propTypes["default"].func,
83
+ renderCalendarDay: _propTypes["default"].func,
84
+ renderDayContents: _propTypes["default"].func,
85
+ renderCalendarInfo: _propTypes["default"].func,
86
+ calendarInfoPosition: _CalendarInfoPositionShape["default"],
87
+ // accessibility
88
+ onBlur: _propTypes["default"].func,
89
+ isFocused: _propTypes["default"].bool,
90
+ showKeyboardShortcuts: _propTypes["default"].bool,
91
+ onTab: _propTypes["default"].func,
92
+ onShiftTab: _propTypes["default"].func,
93
+ // i18n
94
+ monthFormat: _propTypes["default"].string,
95
+ weekDayFormat: _propTypes["default"].string,
96
+ phrases: _propTypes["default"].shape((0, _getPhrasePropTypes["default"])(_defaultPhrases.DayPickerPhrases)),
97
+ dayAriaLabelFormat: _propTypes["default"].string,
98
+ isRTL: _propTypes["default"].bool
99
+ }) : {};
100
+ var defaultProps = {
101
+ date: DATE_UNSET_VALUE,
102
+ minDate: null,
103
+ maxDate: null,
104
+ onDateChange: function onDateChange() {},
105
+ allowUnselect: false,
106
+ focused: false,
107
+ onFocusChange: function onFocusChange() {},
108
+ onClose: function onClose() {},
109
+ keepOpenOnDateSelect: false,
110
+ isOutsideRange: function isOutsideRange() {},
111
+ isDayBlocked: function isDayBlocked() {},
112
+ isDayHighlighted: function isDayHighlighted() {},
113
+ // DayPicker props
114
+ renderMonthText: null,
115
+ renderWeekHeaderElement: null,
116
+ enableOutsideDays: false,
117
+ numberOfMonths: 1,
118
+ orientation: _constants.HORIZONTAL_ORIENTATION,
119
+ withPortal: false,
120
+ hideKeyboardShortcutsPanel: false,
121
+ initialVisibleMonth: null,
122
+ firstDayOfWeek: null,
123
+ daySize: _constants.DAY_SIZE,
124
+ verticalHeight: null,
125
+ noBorder: false,
126
+ verticalBorderSpacing: undefined,
127
+ transitionDuration: undefined,
128
+ horizontalMonthPadding: 13,
129
+ dayPickerNavigationInlineStyles: null,
130
+ navPosition: _constants.NAV_POSITION_TOP,
131
+ navPrev: null,
132
+ navNext: null,
133
+ renderNavPrevButton: null,
134
+ renderNavNextButton: null,
135
+ noNavButtons: false,
136
+ noNavNextButton: false,
137
+ noNavPrevButton: false,
138
+ onPrevMonthClick: function onPrevMonthClick() {},
139
+ onNextMonthClick: function onNextMonthClick() {},
140
+ onOutsideClick: function onOutsideClick() {},
141
+ renderCalendarDay: undefined,
142
+ renderDayContents: null,
143
+ renderCalendarInfo: null,
144
+ renderMonthElement: null,
145
+ calendarInfoPosition: _constants.INFO_POSITION_BOTTOM,
146
+ // accessibility
147
+ onBlur: function onBlur() {},
148
+ isFocused: false,
149
+ showKeyboardShortcuts: false,
150
+ onTab: function onTab() {},
151
+ onShiftTab: function onShiftTab() {},
152
+ // i18n
153
+ monthFormat: 'MMMM YYYY',
154
+ weekDayFormat: 'dd',
155
+ phrases: _defaultPhrases.DayPickerPhrases,
156
+ dayAriaLabelFormat: undefined,
157
+ isRTL: false
158
+ };
159
+ var DayPickerSingleDateController = exports["default"] = /*#__PURE__*/function (_ref2, _ref) {
160
+ function DayPickerSingleDateController(props) {
161
+ var _this;
162
+ _this = _ref2.call(this, props) || this;
163
+ _this.isTouchDevice = false;
164
+ _this.today = (0, _moment["default"])();
165
+ _this.modifiers = {
166
+ today: function today(day) {
167
+ return _this.isToday(day);
168
+ },
169
+ blocked: function blocked(day) {
170
+ return _this.isBlocked(day);
171
+ },
172
+ 'blocked-calendar': function blockedCalendar(day) {
173
+ return props.isDayBlocked(day);
174
+ },
175
+ 'blocked-out-of-range': function blockedOutOfRange(day) {
176
+ return props.isOutsideRange(day);
177
+ },
178
+ 'highlighted-calendar': function highlightedCalendar(day) {
179
+ return props.isDayHighlighted(day);
180
+ },
181
+ valid: function valid(day) {
182
+ return !_this.isBlocked(day);
183
+ },
184
+ hovered: function hovered(day) {
185
+ return _this.isHovered(day);
186
+ },
187
+ selected: function selected(day) {
188
+ return _this.isSelected(day);
189
+ },
190
+ 'first-day-of-week': function firstDayOfWeek(day) {
191
+ return _this.isFirstDayOfWeek(day);
192
+ },
193
+ 'last-day-of-week': function lastDayOfWeek(day) {
194
+ return _this.isLastDayOfWeek(day);
195
+ }
196
+ };
197
+ var _this$getStateForNewM = _this.getStateForNewMonth(props),
198
+ currentMonth = _this$getStateForNewM.currentMonth,
199
+ visibleDays = _this$getStateForNewM.visibleDays;
200
+ _this.state = {
201
+ hoverDate: null,
202
+ currentMonth: currentMonth,
203
+ visibleDays: visibleDays,
204
+ disablePrev: _this.shouldDisableMonthNavigation(props.minDate, currentMonth),
205
+ disableNext: _this.shouldDisableMonthNavigation(props.maxDate, currentMonth)
206
+ };
207
+ _this.onDayMouseEnter = _this.onDayMouseEnter.bind(_this);
208
+ _this.onDayMouseLeave = _this.onDayMouseLeave.bind(_this);
209
+ _this.onDayClick = _this.onDayClick.bind(_this);
210
+ _this.onPrevMonthClick = _this.onPrevMonthClick.bind(_this);
211
+ _this.onNextMonthClick = _this.onNextMonthClick.bind(_this);
212
+ _this.onMonthChange = _this.onMonthChange.bind(_this);
213
+ _this.onYearChange = _this.onYearChange.bind(_this);
214
+ _this.onGetNextScrollableMonths = _this.onGetNextScrollableMonths.bind(_this);
215
+ _this.onGetPrevScrollableMonths = _this.onGetPrevScrollableMonths.bind(_this);
216
+ _this.getFirstFocusableDay = _this.getFirstFocusableDay.bind(_this);
217
+ return _this;
218
+ }
219
+ (0, _inheritsLoose2["default"])(DayPickerSingleDateController, _ref2);
220
+ var _proto = DayPickerSingleDateController.prototype;
221
+ _proto[_ref] = function (nextProps, nextState) {
222
+ return !(0, _enzymeShallowEqual["default"])(this.props, nextProps) || !(0, _enzymeShallowEqual["default"])(this.state, nextState);
223
+ };
224
+ _proto.componentDidMount = function componentDidMount() {
225
+ this.isTouchDevice = (0, _isTouchDevice["default"])();
226
+ };
227
+ _proto.componentDidUpdate = function componentDidUpdate(prevProps) {
228
+ var _this2 = this;
229
+ var _this$props = this.props,
230
+ date = _this$props.date,
231
+ focused = _this$props.focused,
232
+ isOutsideRange = _this$props.isOutsideRange,
233
+ isDayBlocked = _this$props.isDayBlocked,
234
+ isDayHighlighted = _this$props.isDayHighlighted,
235
+ initialVisibleMonth = _this$props.initialVisibleMonth,
236
+ numberOfMonths = _this$props.numberOfMonths,
237
+ enableOutsideDays = _this$props.enableOutsideDays;
238
+ var prevIsOutsideRange = prevProps.isOutsideRange,
239
+ prevIsDayBlocked = prevProps.isDayBlocked,
240
+ prevIsDayHighlighted = prevProps.isDayHighlighted,
241
+ prevNumberOfMonths = prevProps.numberOfMonths,
242
+ prevEnableOutsideDays = prevProps.enableOutsideDays,
243
+ prevInitialVisibleMonth = prevProps.initialVisibleMonth,
244
+ prevFocused = prevProps.focused,
245
+ prevDate = prevProps.date;
246
+ var visibleDays = this.state.visibleDays;
247
+ var recomputeOutsideRange = false;
248
+ var recomputeDayBlocked = false;
249
+ var recomputeDayHighlighted = false;
250
+ if (isOutsideRange !== prevIsOutsideRange) {
251
+ this.modifiers['blocked-out-of-range'] = function (day) {
252
+ return isOutsideRange(day);
253
+ };
254
+ recomputeOutsideRange = true;
255
+ }
256
+ if (isDayBlocked !== prevIsDayBlocked) {
257
+ this.modifiers['blocked-calendar'] = function (day) {
258
+ return isDayBlocked(day);
259
+ };
260
+ recomputeDayBlocked = true;
261
+ }
262
+ if (isDayHighlighted !== prevIsDayHighlighted) {
263
+ this.modifiers['highlighted-calendar'] = function (day) {
264
+ return isDayHighlighted(day);
265
+ };
266
+ recomputeDayHighlighted = true;
267
+ }
268
+ var recomputePropModifiers = recomputeOutsideRange || recomputeDayBlocked || recomputeDayHighlighted;
269
+ var prevCurrentMonth = this.state.currentMonth;
270
+ if (numberOfMonths !== prevNumberOfMonths || enableOutsideDays !== prevEnableOutsideDays || initialVisibleMonth !== prevInitialVisibleMonth && !prevFocused && focused || prevDate && prevDate.diff(date) && !(0, _isDayVisible["default"])(date, prevCurrentMonth, numberOfMonths)) {
271
+ var newMonthState = this.getStateForNewMonth(this.props);
272
+ var currentMonth = newMonthState.currentMonth;
273
+ visibleDays = newMonthState.visibleDays;
274
+ this.setState({
275
+ currentMonth: currentMonth,
276
+ visibleDays: visibleDays
277
+ });
278
+ }
279
+ var didDateChange = date !== prevDate;
280
+ var didFocusChange = focused !== prevFocused;
281
+ var modifiers = {};
282
+ if (didDateChange) {
283
+ modifiers = this.deleteModifier(modifiers, prevDate, 'selected');
284
+ modifiers = this.addModifier(modifiers, date, 'selected');
285
+ }
286
+ if (didFocusChange || recomputePropModifiers) {
287
+ (0, _object["default"])(visibleDays).forEach(function (days) {
288
+ Object.keys(days).forEach(function (day) {
289
+ var momentObj = (0, _getPooledMoment["default"])(day);
290
+ if (_this2.isBlocked(momentObj)) {
291
+ modifiers = _this2.addModifier(modifiers, momentObj, 'blocked');
292
+ } else {
293
+ modifiers = _this2.deleteModifier(modifiers, momentObj, 'blocked');
294
+ }
295
+ if (didFocusChange || recomputeOutsideRange) {
296
+ if (isOutsideRange(momentObj)) {
297
+ modifiers = _this2.addModifier(modifiers, momentObj, 'blocked-out-of-range');
298
+ } else {
299
+ modifiers = _this2.deleteModifier(modifiers, momentObj, 'blocked-out-of-range');
300
+ }
301
+ }
302
+ if (didFocusChange || recomputeDayBlocked) {
303
+ if (isDayBlocked(momentObj)) {
304
+ modifiers = _this2.addModifier(modifiers, momentObj, 'blocked-calendar');
305
+ } else {
306
+ modifiers = _this2.deleteModifier(modifiers, momentObj, 'blocked-calendar');
307
+ }
308
+ }
309
+ if (didFocusChange || recomputeDayHighlighted) {
310
+ if (isDayHighlighted(momentObj)) {
311
+ modifiers = _this2.addModifier(modifiers, momentObj, 'highlighted-calendar');
312
+ } else {
313
+ modifiers = _this2.deleteModifier(modifiers, momentObj, 'highlighted-calendar');
314
+ }
315
+ }
316
+ });
317
+ });
318
+ }
319
+ var today = (0, _moment["default"])();
320
+ if (!(0, _isSameDay["default"])(this.today, today)) {
321
+ modifiers = this.deleteModifier(modifiers, this.today, 'today');
322
+ modifiers = this.addModifier(modifiers, today, 'today');
323
+ this.today = today;
324
+ }
325
+ if (Object.keys(modifiers).length > 0) {
326
+ this.setState({
327
+ visibleDays: _objectSpread(_objectSpread({}, visibleDays), modifiers)
328
+ });
329
+ }
330
+ };
331
+ _proto.onDayClick = function onDayClick(day, e) {
332
+ if (e) e.preventDefault();
333
+ if (this.isBlocked(day)) return;
334
+ var _this$props2 = this.props,
335
+ allowUnselect = _this$props2.allowUnselect,
336
+ onDateChange = _this$props2.onDateChange,
337
+ keepOpenOnDateSelect = _this$props2.keepOpenOnDateSelect,
338
+ onFocusChange = _this$props2.onFocusChange,
339
+ onClose = _this$props2.onClose;
340
+ var clickedDay = allowUnselect && this.isSelected(day) ? DATE_UNSET_VALUE : day;
341
+ onDateChange(clickedDay);
342
+ if (!keepOpenOnDateSelect) {
343
+ onFocusChange({
344
+ focused: false
345
+ });
346
+ onClose({
347
+ date: clickedDay
348
+ });
349
+ }
350
+ };
351
+ _proto.onDayMouseEnter = function onDayMouseEnter(day) {
352
+ if (this.isTouchDevice) return;
353
+ var _this$state = this.state,
354
+ hoverDate = _this$state.hoverDate,
355
+ visibleDays = _this$state.visibleDays;
356
+ var modifiers = this.deleteModifier({}, hoverDate, 'hovered');
357
+ modifiers = this.addModifier(modifiers, day, 'hovered');
358
+ this.setState({
359
+ hoverDate: day,
360
+ visibleDays: _objectSpread(_objectSpread({}, visibleDays), modifiers)
361
+ });
362
+ };
363
+ _proto.onDayMouseLeave = function onDayMouseLeave() {
364
+ var _this$state2 = this.state,
365
+ hoverDate = _this$state2.hoverDate,
366
+ visibleDays = _this$state2.visibleDays;
367
+ if (this.isTouchDevice || !hoverDate) return;
368
+ var modifiers = this.deleteModifier({}, hoverDate, 'hovered');
369
+ this.setState({
370
+ hoverDate: null,
371
+ visibleDays: _objectSpread(_objectSpread({}, visibleDays), modifiers)
372
+ });
373
+ };
374
+ _proto.onPrevMonthClick = function onPrevMonthClick() {
375
+ var _this$props3 = this.props,
376
+ enableOutsideDays = _this$props3.enableOutsideDays,
377
+ maxDate = _this$props3.maxDate,
378
+ minDate = _this$props3.minDate,
379
+ numberOfMonths = _this$props3.numberOfMonths,
380
+ onPrevMonthClick = _this$props3.onPrevMonthClick;
381
+ var _this$state3 = this.state,
382
+ currentMonth = _this$state3.currentMonth,
383
+ visibleDays = _this$state3.visibleDays;
384
+ var newVisibleDays = {};
385
+ Object.keys(visibleDays).sort().slice(0, numberOfMonths + 1).forEach(function (month) {
386
+ newVisibleDays[month] = visibleDays[month];
387
+ });
388
+ var prevMonth = currentMonth.clone().subtract(1, 'month');
389
+ var prevMonthVisibleDays = (0, _getVisibleDays["default"])(prevMonth, 1, enableOutsideDays);
390
+ var newCurrentMonth = currentMonth.clone().subtract(1, 'month');
391
+ this.setState({
392
+ currentMonth: prevMonth,
393
+ disablePrev: this.shouldDisableMonthNavigation(minDate, newCurrentMonth),
394
+ disableNext: this.shouldDisableMonthNavigation(maxDate, newCurrentMonth),
395
+ visibleDays: _objectSpread(_objectSpread({}, newVisibleDays), this.getModifiers(prevMonthVisibleDays))
396
+ }, function () {
397
+ onPrevMonthClick(prevMonth.clone());
398
+ });
399
+ };
400
+ _proto.onNextMonthClick = function onNextMonthClick() {
401
+ var _this$props4 = this.props,
402
+ enableOutsideDays = _this$props4.enableOutsideDays,
403
+ maxDate = _this$props4.maxDate,
404
+ minDate = _this$props4.minDate,
405
+ numberOfMonths = _this$props4.numberOfMonths,
406
+ onNextMonthClick = _this$props4.onNextMonthClick;
407
+ var _this$state4 = this.state,
408
+ currentMonth = _this$state4.currentMonth,
409
+ visibleDays = _this$state4.visibleDays;
410
+ var newVisibleDays = {};
411
+ Object.keys(visibleDays).sort().slice(1).forEach(function (month) {
412
+ newVisibleDays[month] = visibleDays[month];
413
+ });
414
+ var nextMonth = currentMonth.clone().add(numberOfMonths, 'month');
415
+ var nextMonthVisibleDays = (0, _getVisibleDays["default"])(nextMonth, 1, enableOutsideDays);
416
+ var newCurrentMonth = currentMonth.clone().add(1, 'month');
417
+ this.setState({
418
+ currentMonth: newCurrentMonth,
419
+ disablePrev: this.shouldDisableMonthNavigation(minDate, newCurrentMonth),
420
+ disableNext: this.shouldDisableMonthNavigation(maxDate, newCurrentMonth),
421
+ visibleDays: _objectSpread(_objectSpread({}, newVisibleDays), this.getModifiers(nextMonthVisibleDays))
422
+ }, function () {
423
+ onNextMonthClick(newCurrentMonth.clone());
424
+ });
425
+ };
426
+ _proto.onMonthChange = function onMonthChange(newMonth) {
427
+ var _this$props5 = this.props,
428
+ numberOfMonths = _this$props5.numberOfMonths,
429
+ enableOutsideDays = _this$props5.enableOutsideDays,
430
+ orientation = _this$props5.orientation;
431
+ var withoutTransitionMonths = orientation === _constants.VERTICAL_SCROLLABLE;
432
+ var newVisibleDays = (0, _getVisibleDays["default"])(newMonth, numberOfMonths, enableOutsideDays, withoutTransitionMonths);
433
+ this.setState({
434
+ currentMonth: newMonth.clone(),
435
+ visibleDays: this.getModifiers(newVisibleDays)
436
+ });
437
+ };
438
+ _proto.onYearChange = function onYearChange(newMonth) {
439
+ var _this$props6 = this.props,
440
+ numberOfMonths = _this$props6.numberOfMonths,
441
+ enableOutsideDays = _this$props6.enableOutsideDays,
442
+ orientation = _this$props6.orientation;
443
+ var withoutTransitionMonths = orientation === _constants.VERTICAL_SCROLLABLE;
444
+ var newVisibleDays = (0, _getVisibleDays["default"])(newMonth, numberOfMonths, enableOutsideDays, withoutTransitionMonths);
445
+ this.setState({
446
+ currentMonth: newMonth.clone(),
447
+ visibleDays: this.getModifiers(newVisibleDays)
448
+ });
449
+ };
450
+ _proto.onGetNextScrollableMonths = function onGetNextScrollableMonths() {
451
+ var _this$props7 = this.props,
452
+ numberOfMonths = _this$props7.numberOfMonths,
453
+ enableOutsideDays = _this$props7.enableOutsideDays;
454
+ var _this$state5 = this.state,
455
+ currentMonth = _this$state5.currentMonth,
456
+ visibleDays = _this$state5.visibleDays;
457
+ var numberOfVisibleMonths = Object.keys(visibleDays).length;
458
+ var nextMonth = currentMonth.clone().add(numberOfVisibleMonths, 'month');
459
+ var newVisibleDays = (0, _getVisibleDays["default"])(nextMonth, numberOfMonths, enableOutsideDays, true);
460
+ this.setState({
461
+ visibleDays: _objectSpread(_objectSpread({}, visibleDays), this.getModifiers(newVisibleDays))
462
+ });
463
+ };
464
+ _proto.onGetPrevScrollableMonths = function onGetPrevScrollableMonths() {
465
+ var _this$props8 = this.props,
466
+ numberOfMonths = _this$props8.numberOfMonths,
467
+ enableOutsideDays = _this$props8.enableOutsideDays;
468
+ var _this$state6 = this.state,
469
+ currentMonth = _this$state6.currentMonth,
470
+ visibleDays = _this$state6.visibleDays;
471
+ var firstPreviousMonth = currentMonth.clone().subtract(numberOfMonths, 'month');
472
+ var newVisibleDays = (0, _getVisibleDays["default"])(firstPreviousMonth, numberOfMonths, enableOutsideDays, true);
473
+ this.setState({
474
+ currentMonth: firstPreviousMonth.clone(),
475
+ visibleDays: _objectSpread(_objectSpread({}, visibleDays), this.getModifiers(newVisibleDays))
476
+ });
477
+ };
478
+ _proto.getFirstDayOfWeek = function getFirstDayOfWeek() {
479
+ var firstDayOfWeek = this.props.firstDayOfWeek;
480
+ if (firstDayOfWeek == null) {
481
+ return _moment["default"].localeData().firstDayOfWeek();
482
+ }
483
+ return firstDayOfWeek;
484
+ };
485
+ _proto.getFirstFocusableDay = function getFirstFocusableDay(newMonth) {
486
+ var _this3 = this;
487
+ var _this$props9 = this.props,
488
+ date = _this$props9.date,
489
+ numberOfMonths = _this$props9.numberOfMonths;
490
+ var focusedDate = newMonth.clone().startOf('month').hour(12);
491
+ if (date) {
492
+ focusedDate = date.clone();
493
+ }
494
+ if (this.isBlocked(focusedDate)) {
495
+ var days = [];
496
+ var lastVisibleDay = newMonth.clone().add(numberOfMonths - 1, 'months').endOf('month');
497
+ var currentDay = focusedDate.clone();
498
+ while (!(0, _isAfterDay["default"])(currentDay, lastVisibleDay)) {
499
+ currentDay = currentDay.clone().add(1, 'day');
500
+ days.push(currentDay);
501
+ }
502
+ var viableDays = days.filter(function (day) {
503
+ return !_this3.isBlocked(day) && (0, _isAfterDay["default"])(day, focusedDate);
504
+ });
505
+ if (viableDays.length > 0) {
506
+ var _viableDays = (0, _slicedToArray2["default"])(viableDays, 1);
507
+ focusedDate = _viableDays[0];
508
+ }
509
+ }
510
+ return focusedDate;
511
+ };
512
+ _proto.getModifiers = function getModifiers(visibleDays) {
513
+ var _this4 = this;
514
+ var modifiers = {};
515
+ Object.keys(visibleDays).forEach(function (month) {
516
+ modifiers[month] = {};
517
+ visibleDays[month].forEach(function (day) {
518
+ modifiers[month][(0, _toISODateString["default"])(day)] = _this4.getModifiersForDay(day);
519
+ });
520
+ });
521
+ return modifiers;
522
+ };
523
+ _proto.getModifiersForDay = function getModifiersForDay(day) {
524
+ var _this5 = this;
525
+ return new Set(Object.keys(this.modifiers).filter(function (modifier) {
526
+ return _this5.modifiers[modifier](day);
527
+ }));
528
+ };
529
+ _proto.getStateForNewMonth = function getStateForNewMonth(nextProps) {
530
+ var _this6 = this;
531
+ var initialVisibleMonth = nextProps.initialVisibleMonth,
532
+ date = nextProps.date,
533
+ numberOfMonths = nextProps.numberOfMonths,
534
+ orientation = nextProps.orientation,
535
+ enableOutsideDays = nextProps.enableOutsideDays;
536
+ var initialVisibleMonthThunk = initialVisibleMonth || (date ? function () {
537
+ return date;
538
+ } : function () {
539
+ return _this6.today;
540
+ });
541
+ var currentMonth = initialVisibleMonthThunk();
542
+ var withoutTransitionMonths = orientation === _constants.VERTICAL_SCROLLABLE;
543
+ var visibleDays = this.getModifiers((0, _getVisibleDays["default"])(currentMonth, numberOfMonths, enableOutsideDays, withoutTransitionMonths));
544
+ return {
545
+ currentMonth: currentMonth,
546
+ visibleDays: visibleDays
547
+ };
548
+ };
549
+ _proto.shouldDisableMonthNavigation = function shouldDisableMonthNavigation(date, visibleMonth) {
550
+ if (!date) return false;
551
+ var _this$props0 = this.props,
552
+ numberOfMonths = _this$props0.numberOfMonths,
553
+ enableOutsideDays = _this$props0.enableOutsideDays;
554
+ return (0, _isDayVisible["default"])(date, visibleMonth, numberOfMonths, enableOutsideDays);
555
+ };
556
+ _proto.addModifier = function addModifier(updatedDays, day, modifier) {
557
+ return (0, _modifiers.addModifier)(updatedDays, day, modifier, this.props, this.state);
558
+ };
559
+ _proto.deleteModifier = function deleteModifier(updatedDays, day, modifier) {
560
+ return (0, _modifiers.deleteModifier)(updatedDays, day, modifier, this.props, this.state);
561
+ };
562
+ _proto.isBlocked = function isBlocked(day) {
563
+ var _this$props1 = this.props,
564
+ isDayBlocked = _this$props1.isDayBlocked,
565
+ isOutsideRange = _this$props1.isOutsideRange;
566
+ return isDayBlocked(day) || isOutsideRange(day);
567
+ };
568
+ _proto.isHovered = function isHovered(day) {
569
+ var _ref3 = this.state || {},
570
+ hoverDate = _ref3.hoverDate;
571
+ return (0, _isSameDay["default"])(day, hoverDate);
572
+ };
573
+ _proto.isSelected = function isSelected(day) {
574
+ var date = this.props.date;
575
+ return (0, _isSameDay["default"])(day, date);
576
+ };
577
+ _proto.isToday = function isToday(day) {
578
+ return (0, _isSameDay["default"])(day, this.today);
579
+ };
580
+ _proto.isFirstDayOfWeek = function isFirstDayOfWeek(day) {
581
+ return day.day() === this.getFirstDayOfWeek();
582
+ };
583
+ _proto.isLastDayOfWeek = function isLastDayOfWeek(day) {
584
+ return day.day() === (this.getFirstDayOfWeek() + 6) % 7;
585
+ };
586
+ _proto.render = function render() {
587
+ var _this$props10 = this.props,
588
+ numberOfMonths = _this$props10.numberOfMonths,
589
+ orientation = _this$props10.orientation,
590
+ monthFormat = _this$props10.monthFormat,
591
+ renderMonthText = _this$props10.renderMonthText,
592
+ renderWeekHeaderElement = _this$props10.renderWeekHeaderElement,
593
+ dayPickerNavigationInlineStyles = _this$props10.dayPickerNavigationInlineStyles,
594
+ navPosition = _this$props10.navPosition,
595
+ navPrev = _this$props10.navPrev,
596
+ navNext = _this$props10.navNext,
597
+ renderNavPrevButton = _this$props10.renderNavPrevButton,
598
+ renderNavNextButton = _this$props10.renderNavNextButton,
599
+ noNavButtons = _this$props10.noNavButtons,
600
+ noNavPrevButton = _this$props10.noNavPrevButton,
601
+ noNavNextButton = _this$props10.noNavNextButton,
602
+ onOutsideClick = _this$props10.onOutsideClick,
603
+ onShiftTab = _this$props10.onShiftTab,
604
+ onTab = _this$props10.onTab,
605
+ withPortal = _this$props10.withPortal,
606
+ focused = _this$props10.focused,
607
+ enableOutsideDays = _this$props10.enableOutsideDays,
608
+ hideKeyboardShortcutsPanel = _this$props10.hideKeyboardShortcutsPanel,
609
+ daySize = _this$props10.daySize,
610
+ firstDayOfWeek = _this$props10.firstDayOfWeek,
611
+ renderCalendarDay = _this$props10.renderCalendarDay,
612
+ renderDayContents = _this$props10.renderDayContents,
613
+ renderCalendarInfo = _this$props10.renderCalendarInfo,
614
+ renderMonthElement = _this$props10.renderMonthElement,
615
+ calendarInfoPosition = _this$props10.calendarInfoPosition,
616
+ isFocused = _this$props10.isFocused,
617
+ isRTL = _this$props10.isRTL,
618
+ phrases = _this$props10.phrases,
619
+ dayAriaLabelFormat = _this$props10.dayAriaLabelFormat,
620
+ onBlur = _this$props10.onBlur,
621
+ showKeyboardShortcuts = _this$props10.showKeyboardShortcuts,
622
+ weekDayFormat = _this$props10.weekDayFormat,
623
+ verticalHeight = _this$props10.verticalHeight,
624
+ noBorder = _this$props10.noBorder,
625
+ transitionDuration = _this$props10.transitionDuration,
626
+ verticalBorderSpacing = _this$props10.verticalBorderSpacing,
627
+ horizontalMonthPadding = _this$props10.horizontalMonthPadding;
628
+ var _this$state7 = this.state,
629
+ currentMonth = _this$state7.currentMonth,
630
+ disableNext = _this$state7.disableNext,
631
+ disablePrev = _this$state7.disablePrev,
632
+ visibleDays = _this$state7.visibleDays;
633
+ return /*#__PURE__*/_react["default"].createElement(_DayPicker["default"], {
634
+ orientation: orientation,
635
+ enableOutsideDays: enableOutsideDays,
636
+ modifiers: visibleDays,
637
+ numberOfMonths: numberOfMonths,
638
+ onDayClick: this.onDayClick,
639
+ onDayMouseEnter: this.onDayMouseEnter,
640
+ onDayMouseLeave: this.onDayMouseLeave,
641
+ onPrevMonthClick: this.onPrevMonthClick,
642
+ onNextMonthClick: this.onNextMonthClick,
643
+ onMonthChange: this.onMonthChange,
644
+ onYearChange: this.onYearChange,
645
+ onGetNextScrollableMonths: this.onGetNextScrollableMonths,
646
+ onGetPrevScrollableMonths: this.onGetPrevScrollableMonths,
647
+ monthFormat: monthFormat,
648
+ withPortal: withPortal,
649
+ hidden: !focused,
650
+ hideKeyboardShortcutsPanel: hideKeyboardShortcutsPanel,
651
+ initialVisibleMonth: function initialVisibleMonth() {
652
+ return currentMonth;
653
+ },
654
+ firstDayOfWeek: firstDayOfWeek,
655
+ onOutsideClick: onOutsideClick,
656
+ dayPickerNavigationInlineStyles: dayPickerNavigationInlineStyles,
657
+ navPosition: navPosition,
658
+ disablePrev: disablePrev,
659
+ disableNext: disableNext,
660
+ navPrev: navPrev,
661
+ navNext: navNext,
662
+ renderNavPrevButton: renderNavPrevButton,
663
+ renderNavNextButton: renderNavNextButton,
664
+ noNavButtons: noNavButtons,
665
+ noNavNextButton: noNavNextButton,
666
+ noNavPrevButton: noNavPrevButton,
667
+ renderMonthText: renderMonthText,
668
+ renderWeekHeaderElement: renderWeekHeaderElement,
669
+ renderCalendarDay: renderCalendarDay,
670
+ renderDayContents: renderDayContents,
671
+ renderCalendarInfo: renderCalendarInfo,
672
+ renderMonthElement: renderMonthElement,
673
+ calendarInfoPosition: calendarInfoPosition,
674
+ isFocused: isFocused,
675
+ getFirstFocusableDay: this.getFirstFocusableDay,
676
+ onBlur: onBlur,
677
+ onTab: onTab,
678
+ onShiftTab: onShiftTab,
679
+ phrases: phrases,
680
+ daySize: daySize,
681
+ isRTL: isRTL,
682
+ showKeyboardShortcuts: showKeyboardShortcuts,
683
+ weekDayFormat: weekDayFormat,
684
+ dayAriaLabelFormat: dayAriaLabelFormat,
685
+ verticalHeight: verticalHeight,
686
+ noBorder: noBorder,
687
+ transitionDuration: transitionDuration,
688
+ verticalBorderSpacing: verticalBorderSpacing,
689
+ horizontalMonthPadding: horizontalMonthPadding
690
+ });
691
+ };
692
+ return DayPickerSingleDateController;
693
+ }(_react["default"].PureComponent || _react["default"].Component, !_react["default"].PureComponent && "shouldComponentUpdate");
694
+ DayPickerSingleDateController.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
695
+ DayPickerSingleDateController.defaultProps = defaultProps;