@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,1202 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
+ import _readOnlyError from "@babel/runtime/helpers/esm/readOnlyError";
3
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
4
+ import _inheritsLoose from "@babel/runtime/helpers/esm/inheritsLoose";
5
+ import shallowEqual from "enzyme-shallow-equal";
6
+ 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; }
7
+ 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; }
8
+ import React from 'react';
9
+ import PropTypes from 'prop-types';
10
+ import momentPropTypes from 'react-moment-proptypes';
11
+ import { forbidExtraProps, mutuallyExclusiveProps, nonNegativeInteger } from 'airbnb-prop-types';
12
+ import moment from 'moment';
13
+ import values from 'object.values';
14
+ import isTouchDevice from 'is-touch-device';
15
+ import { DayPickerPhrases } from '../defaultPhrases';
16
+ import getPhrasePropTypes from '../utils/getPhrasePropTypes';
17
+ import isInclusivelyAfterDay from '../utils/isInclusivelyAfterDay';
18
+ import isNextDay from '../utils/isNextDay';
19
+ import isSameDay from '../utils/isSameDay';
20
+ import isAfterDay from '../utils/isAfterDay';
21
+ import isBeforeDay from '../utils/isBeforeDay';
22
+ import isPreviousDay from '../utils/isPreviousDay';
23
+ import getVisibleDays from '../utils/getVisibleDays';
24
+ import isDayVisible from '../utils/isDayVisible';
25
+ import getSelectedDateOffset from '../utils/getSelectedDateOffset';
26
+ import toISODateString from '../utils/toISODateString';
27
+ import { addModifier as _addModifier, deleteModifier as _deleteModifier } from '../utils/modifiers';
28
+ import DisabledShape from '../shapes/DisabledShape';
29
+ import FocusedInputShape from '../shapes/FocusedInputShape';
30
+ import ScrollableOrientationShape from '../shapes/ScrollableOrientationShape';
31
+ import DayOfWeekShape from '../shapes/DayOfWeekShape';
32
+ import CalendarInfoPositionShape from '../shapes/CalendarInfoPositionShape';
33
+ import NavPositionShape from '../shapes/NavPositionShape';
34
+ import { START_DATE, END_DATE, HORIZONTAL_ORIENTATION, VERTICAL_SCROLLABLE, DAY_SIZE, INFO_POSITION_BOTTOM, NAV_POSITION_TOP } from '../constants';
35
+ import DayPicker from './DayPicker';
36
+ import getPooledMoment from '../utils/getPooledMoment';
37
+ var propTypes = process.env.NODE_ENV !== "production" ? forbidExtraProps({
38
+ startDate: momentPropTypes.momentObj,
39
+ endDate: momentPropTypes.momentObj,
40
+ onDatesChange: PropTypes.func,
41
+ startDateOffset: PropTypes.func,
42
+ endDateOffset: PropTypes.func,
43
+ minDate: momentPropTypes.momentObj,
44
+ maxDate: momentPropTypes.momentObj,
45
+ focusedInput: FocusedInputShape,
46
+ onFocusChange: PropTypes.func,
47
+ onClose: PropTypes.func,
48
+ keepOpenOnDateSelect: PropTypes.bool,
49
+ minimumNights: PropTypes.number,
50
+ disabled: DisabledShape,
51
+ isOutsideRange: PropTypes.func,
52
+ isDayBlocked: PropTypes.func,
53
+ isDayHighlighted: PropTypes.func,
54
+ getMinNightsForHoverDate: PropTypes.func,
55
+ daysViolatingMinNightsCanBeClicked: PropTypes.bool,
56
+ // DayPicker props
57
+ renderMonthText: mutuallyExclusiveProps(PropTypes.func, 'renderMonthText', 'renderMonthElement'),
58
+ renderMonthElement: mutuallyExclusiveProps(PropTypes.func, 'renderMonthText', 'renderMonthElement'),
59
+ renderWeekHeaderElement: PropTypes.func,
60
+ enableOutsideDays: PropTypes.bool,
61
+ numberOfMonths: PropTypes.number,
62
+ orientation: ScrollableOrientationShape,
63
+ withPortal: PropTypes.bool,
64
+ initialVisibleMonth: PropTypes.func,
65
+ hideKeyboardShortcutsPanel: PropTypes.bool,
66
+ daySize: nonNegativeInteger,
67
+ noBorder: PropTypes.bool,
68
+ verticalBorderSpacing: nonNegativeInteger,
69
+ horizontalMonthPadding: nonNegativeInteger,
70
+ dayPickerNavigationInlineStyles: PropTypes.object,
71
+ navPosition: NavPositionShape,
72
+ navPrev: PropTypes.node,
73
+ navNext: PropTypes.node,
74
+ renderNavPrevButton: PropTypes.func,
75
+ renderNavNextButton: PropTypes.func,
76
+ noNavButtons: PropTypes.bool,
77
+ noNavNextButton: PropTypes.bool,
78
+ noNavPrevButton: PropTypes.bool,
79
+ onPrevMonthClick: PropTypes.func,
80
+ onNextMonthClick: PropTypes.func,
81
+ onOutsideClick: PropTypes.func,
82
+ renderCalendarDay: PropTypes.func,
83
+ renderDayContents: PropTypes.func,
84
+ renderCalendarInfo: PropTypes.func,
85
+ renderKeyboardShortcutsButton: PropTypes.func,
86
+ renderKeyboardShortcutsPanel: PropTypes.func,
87
+ calendarInfoPosition: CalendarInfoPositionShape,
88
+ firstDayOfWeek: DayOfWeekShape,
89
+ verticalHeight: nonNegativeInteger,
90
+ transitionDuration: nonNegativeInteger,
91
+ // accessibility
92
+ onBlur: PropTypes.func,
93
+ isFocused: PropTypes.bool,
94
+ showKeyboardShortcuts: PropTypes.bool,
95
+ onTab: PropTypes.func,
96
+ onShiftTab: PropTypes.func,
97
+ // i18n
98
+ monthFormat: PropTypes.string,
99
+ weekDayFormat: PropTypes.string,
100
+ phrases: PropTypes.shape(getPhrasePropTypes(DayPickerPhrases)),
101
+ dayAriaLabelFormat: PropTypes.string,
102
+ isRTL: PropTypes.bool
103
+ }) : {};
104
+ var defaultProps = {
105
+ startDate: undefined,
106
+ // TODO: use null
107
+ endDate: undefined,
108
+ // TODO: use null
109
+ minDate: null,
110
+ maxDate: null,
111
+ onDatesChange: function onDatesChange() {},
112
+ startDateOffset: undefined,
113
+ endDateOffset: undefined,
114
+ focusedInput: null,
115
+ onFocusChange: function onFocusChange() {},
116
+ onClose: function onClose() {},
117
+ keepOpenOnDateSelect: false,
118
+ minimumNights: 1,
119
+ disabled: false,
120
+ isOutsideRange: function isOutsideRange() {},
121
+ isDayBlocked: function isDayBlocked() {},
122
+ isDayHighlighted: function isDayHighlighted() {},
123
+ getMinNightsForHoverDate: function getMinNightsForHoverDate() {},
124
+ daysViolatingMinNightsCanBeClicked: false,
125
+ // DayPicker props
126
+ renderMonthText: null,
127
+ renderWeekHeaderElement: null,
128
+ enableOutsideDays: false,
129
+ numberOfMonths: 1,
130
+ orientation: HORIZONTAL_ORIENTATION,
131
+ withPortal: false,
132
+ hideKeyboardShortcutsPanel: false,
133
+ initialVisibleMonth: null,
134
+ daySize: DAY_SIZE,
135
+ dayPickerNavigationInlineStyles: null,
136
+ navPosition: NAV_POSITION_TOP,
137
+ navPrev: null,
138
+ navNext: null,
139
+ renderNavPrevButton: null,
140
+ renderNavNextButton: null,
141
+ noNavButtons: false,
142
+ noNavNextButton: false,
143
+ noNavPrevButton: false,
144
+ onPrevMonthClick: function onPrevMonthClick() {},
145
+ onNextMonthClick: function onNextMonthClick() {},
146
+ onOutsideClick: function onOutsideClick() {},
147
+ renderCalendarDay: undefined,
148
+ renderDayContents: null,
149
+ renderCalendarInfo: null,
150
+ renderMonthElement: null,
151
+ renderKeyboardShortcutsButton: undefined,
152
+ renderKeyboardShortcutsPanel: undefined,
153
+ calendarInfoPosition: INFO_POSITION_BOTTOM,
154
+ firstDayOfWeek: null,
155
+ verticalHeight: null,
156
+ noBorder: false,
157
+ transitionDuration: undefined,
158
+ verticalBorderSpacing: undefined,
159
+ horizontalMonthPadding: 13,
160
+ // accessibility
161
+ onBlur: function onBlur() {},
162
+ isFocused: false,
163
+ showKeyboardShortcuts: false,
164
+ onTab: function onTab() {},
165
+ onShiftTab: function onShiftTab() {},
166
+ // i18n
167
+ monthFormat: 'MMMM YYYY',
168
+ weekDayFormat: 'dd',
169
+ phrases: DayPickerPhrases,
170
+ dayAriaLabelFormat: undefined,
171
+ isRTL: false
172
+ };
173
+ var getChooseAvailableDatePhrase = function getChooseAvailableDatePhrase(phrases, focusedInput) {
174
+ if (focusedInput === START_DATE) {
175
+ return phrases.chooseAvailableStartDate;
176
+ }
177
+ if (focusedInput === END_DATE) {
178
+ return phrases.chooseAvailableEndDate;
179
+ }
180
+ return phrases.chooseAvailableDate;
181
+ };
182
+ var DayPickerRangeController = /*#__PURE__*/function (_ref2, _ref) {
183
+ function DayPickerRangeController(props) {
184
+ var _this;
185
+ _this = _ref2.call(this, props) || this;
186
+ _this.isTouchDevice = isTouchDevice();
187
+ _this.today = moment();
188
+ _this.modifiers = {
189
+ today: function today(day) {
190
+ return _this.isToday(day);
191
+ },
192
+ blocked: function blocked(day) {
193
+ return _this.isBlocked(day);
194
+ },
195
+ 'blocked-calendar': function blockedCalendar(day) {
196
+ return props.isDayBlocked(day);
197
+ },
198
+ 'blocked-out-of-range': function blockedOutOfRange(day) {
199
+ return props.isOutsideRange(day);
200
+ },
201
+ 'highlighted-calendar': function highlightedCalendar(day) {
202
+ return props.isDayHighlighted(day);
203
+ },
204
+ valid: function valid(day) {
205
+ return !_this.isBlocked(day);
206
+ },
207
+ 'selected-start': function selectedStart(day) {
208
+ return _this.isStartDate(day);
209
+ },
210
+ 'selected-end': function selectedEnd(day) {
211
+ return _this.isEndDate(day);
212
+ },
213
+ 'blocked-minimum-nights': function blockedMinimumNights(day) {
214
+ return _this.doesNotMeetMinimumNights(day);
215
+ },
216
+ 'selected-span': function selectedSpan(day) {
217
+ return _this.isInSelectedSpan(day);
218
+ },
219
+ 'last-in-range': function lastInRange(day) {
220
+ return _this.isLastInRange(day);
221
+ },
222
+ hovered: function hovered(day) {
223
+ return _this.isHovered(day);
224
+ },
225
+ 'hovered-span': function hoveredSpan(day) {
226
+ return _this.isInHoveredSpan(day);
227
+ },
228
+ 'hovered-offset': function hoveredOffset(day) {
229
+ return _this.isInHoveredSpan(day);
230
+ },
231
+ 'after-hovered-start': function afterHoveredStart(day) {
232
+ return _this.isDayAfterHoveredStartDate(day);
233
+ },
234
+ 'first-day-of-week': function firstDayOfWeek(day) {
235
+ return _this.isFirstDayOfWeek(day);
236
+ },
237
+ 'last-day-of-week': function lastDayOfWeek(day) {
238
+ return _this.isLastDayOfWeek(day);
239
+ },
240
+ 'hovered-start-first-possible-end': function hoveredStartFirstPossibleEnd(day, hoverDate) {
241
+ return _this.isFirstPossibleEndDateForHoveredStartDate(day, hoverDate);
242
+ },
243
+ 'hovered-start-blocked-minimum-nights': function hoveredStartBlockedMinimumNights(day, hoverDate) {
244
+ return _this.doesNotMeetMinNightsForHoveredStartDate(day, hoverDate);
245
+ },
246
+ 'before-hovered-end': function beforeHoveredEnd(day) {
247
+ return _this.isDayBeforeHoveredEndDate(day);
248
+ },
249
+ 'no-selected-start-before-selected-end': function noSelectedStartBeforeSelectedEnd(day) {
250
+ return _this.beforeSelectedEnd(day) && !props.startDate;
251
+ },
252
+ 'selected-start-in-hovered-span': function selectedStartInHoveredSpan(day, hoverDate) {
253
+ return _this.isStartDate(day) && isAfterDay(hoverDate, day);
254
+ },
255
+ 'selected-start-no-selected-end': function selectedStartNoSelectedEnd(day) {
256
+ return _this.isStartDate(day) && !props.endDate;
257
+ },
258
+ 'selected-end-no-selected-start': function selectedEndNoSelectedStart(day) {
259
+ return _this.isEndDate(day) && !props.startDate;
260
+ }
261
+ };
262
+ var _this$getStateForNewM = _this.getStateForNewMonth(props),
263
+ currentMonth = _this$getStateForNewM.currentMonth,
264
+ visibleDays = _this$getStateForNewM.visibleDays;
265
+
266
+ // initialize phrases
267
+ // set the appropriate CalendarDay phrase based on focusedInput
268
+ var chooseAvailableDate = getChooseAvailableDatePhrase(props.phrases, props.focusedInput);
269
+ _this.state = {
270
+ hoverDate: null,
271
+ currentMonth: currentMonth,
272
+ phrases: _objectSpread(_objectSpread({}, props.phrases), {}, {
273
+ chooseAvailableDate: chooseAvailableDate
274
+ }),
275
+ visibleDays: visibleDays,
276
+ disablePrev: _this.shouldDisableMonthNavigation(props.minDate, currentMonth),
277
+ disableNext: _this.shouldDisableMonthNavigation(props.maxDate, currentMonth)
278
+ };
279
+ _this.onDayClick = _this.onDayClick.bind(_this);
280
+ _this.onDayMouseEnter = _this.onDayMouseEnter.bind(_this);
281
+ _this.onDayMouseLeave = _this.onDayMouseLeave.bind(_this);
282
+ _this.onPrevMonthClick = _this.onPrevMonthClick.bind(_this);
283
+ _this.onNextMonthClick = _this.onNextMonthClick.bind(_this);
284
+ _this.onMonthChange = _this.onMonthChange.bind(_this);
285
+ _this.onYearChange = _this.onYearChange.bind(_this);
286
+ _this.onGetNextScrollableMonths = _this.onGetNextScrollableMonths.bind(_this);
287
+ _this.onGetPrevScrollableMonths = _this.onGetPrevScrollableMonths.bind(_this);
288
+ _this.getFirstFocusableDay = _this.getFirstFocusableDay.bind(_this);
289
+ return _this;
290
+ }
291
+ _inheritsLoose(DayPickerRangeController, _ref2);
292
+ var _proto = DayPickerRangeController.prototype;
293
+ _proto[_ref] = function (nextProps, nextState) {
294
+ return !shallowEqual(this.props, nextProps) || !shallowEqual(this.state, nextState);
295
+ };
296
+ _proto.componentDidUpdate = function componentDidUpdate(prevProps) {
297
+ var _this2 = this;
298
+ var _this$props = this.props,
299
+ startDate = _this$props.startDate,
300
+ endDate = _this$props.endDate,
301
+ focusedInput = _this$props.focusedInput,
302
+ getMinNightsForHoverDate = _this$props.getMinNightsForHoverDate,
303
+ minimumNights = _this$props.minimumNights,
304
+ isOutsideRange = _this$props.isOutsideRange,
305
+ isDayBlocked = _this$props.isDayBlocked,
306
+ isDayHighlighted = _this$props.isDayHighlighted,
307
+ phrases = _this$props.phrases,
308
+ initialVisibleMonth = _this$props.initialVisibleMonth,
309
+ numberOfMonths = _this$props.numberOfMonths,
310
+ enableOutsideDays = _this$props.enableOutsideDays;
311
+ var prevStartDate = prevProps.startDate,
312
+ prevEndDate = prevProps.endDate,
313
+ prevFocusedInput = prevProps.focusedInput,
314
+ prevMinimumNights = prevProps.minimumNights,
315
+ prevIsOutsideRange = prevProps.isOutsideRange,
316
+ prevIsDayBlocked = prevProps.isDayBlocked,
317
+ prevIsDayHighlighted = prevProps.isDayHighlighted,
318
+ prevPhrases = prevProps.phrases,
319
+ prevInitialVisibleMonth = prevProps.initialVisibleMonth,
320
+ prevNumberOfMonths = prevProps.numberOfMonths,
321
+ prevEnableOutsideDays = prevProps.enableOutsideDays;
322
+ var hoverDate = this.state.hoverDate;
323
+ var visibleDays = this.state.visibleDays;
324
+ var recomputeOutsideRange = false;
325
+ var recomputeDayBlocked = false;
326
+ var recomputeDayHighlighted = false;
327
+ if (isOutsideRange !== prevIsOutsideRange) {
328
+ this.modifiers['blocked-out-of-range'] = function (day) {
329
+ return isOutsideRange(day);
330
+ };
331
+ recomputeOutsideRange = true;
332
+ }
333
+ if (isDayBlocked !== prevIsDayBlocked) {
334
+ this.modifiers['blocked-calendar'] = function (day) {
335
+ return isDayBlocked(day);
336
+ };
337
+ recomputeDayBlocked = true;
338
+ }
339
+ if (isDayHighlighted !== prevIsDayHighlighted) {
340
+ this.modifiers['highlighted-calendar'] = function (day) {
341
+ return isDayHighlighted(day);
342
+ };
343
+ recomputeDayHighlighted = true;
344
+ }
345
+ var recomputePropModifiers = recomputeOutsideRange || recomputeDayBlocked || recomputeDayHighlighted;
346
+ var didStartDateChange = startDate !== prevStartDate;
347
+ var didEndDateChange = endDate !== prevEndDate;
348
+ var didFocusChange = focusedInput !== prevFocusedInput;
349
+ if (numberOfMonths !== prevNumberOfMonths || enableOutsideDays !== prevEnableOutsideDays || initialVisibleMonth !== prevInitialVisibleMonth && !prevFocusedInput && didFocusChange) {
350
+ var newMonthState = this.getStateForNewMonth(this.props);
351
+ var currentMonth = newMonthState.currentMonth;
352
+ visibleDays = newMonthState.visibleDays;
353
+ this.setState({
354
+ currentMonth: currentMonth,
355
+ visibleDays: visibleDays
356
+ });
357
+ }
358
+ var modifiers = {};
359
+ if (didStartDateChange) {
360
+ modifiers = this.deleteModifier(modifiers, prevStartDate, 'selected-start');
361
+ modifiers = this.addModifier(modifiers, startDate, 'selected-start');
362
+ if (prevStartDate) {
363
+ var startSpan = prevStartDate.clone().add(1, 'day');
364
+ var endSpan = prevStartDate.clone().add(prevMinimumNights + 1, 'days');
365
+ modifiers = this.deleteModifierFromRange(modifiers, startSpan, endSpan, 'after-hovered-start');
366
+ if (!endDate || !prevEndDate) {
367
+ modifiers = this.deleteModifier(modifiers, prevStartDate, 'selected-start-no-selected-end');
368
+ }
369
+ }
370
+ if (!prevStartDate && endDate && startDate) {
371
+ modifiers = this.deleteModifier(modifiers, endDate, 'selected-end-no-selected-start');
372
+ modifiers = this.deleteModifier(modifiers, endDate, 'selected-end-in-hovered-span');
373
+ values(visibleDays).forEach(function (days) {
374
+ Object.keys(days).forEach(function (day) {
375
+ var momentObj = moment(day);
376
+ modifiers = _this2.deleteModifier(modifiers, momentObj, 'no-selected-start-before-selected-end');
377
+ });
378
+ });
379
+ }
380
+ }
381
+ if (didEndDateChange) {
382
+ modifiers = this.deleteModifier(modifiers, prevEndDate, 'selected-end');
383
+ modifiers = this.addModifier(modifiers, endDate, 'selected-end');
384
+ if (prevEndDate && (!startDate || !prevStartDate)) {
385
+ modifiers = this.deleteModifier(modifiers, prevEndDate, 'selected-end-no-selected-start');
386
+ }
387
+ }
388
+ if (didStartDateChange || didEndDateChange) {
389
+ if (prevStartDate && prevEndDate) {
390
+ modifiers = this.deleteModifierFromRange(modifiers, prevStartDate, prevEndDate.clone().add(1, 'day'), 'selected-span');
391
+ }
392
+ if (startDate && endDate) {
393
+ modifiers = this.deleteModifierFromRange(modifiers, startDate, endDate.clone().add(1, 'day'), 'hovered-span');
394
+ modifiers = this.addModifierToRange(modifiers, startDate.clone().add(1, 'day'), endDate, 'selected-span');
395
+ }
396
+ if (startDate && !endDate) {
397
+ modifiers = this.addModifier(modifiers, startDate, 'selected-start-no-selected-end');
398
+ }
399
+ if (endDate && !startDate) {
400
+ modifiers = this.addModifier(modifiers, endDate, 'selected-end-no-selected-start');
401
+ }
402
+ if (!startDate && endDate) {
403
+ values(visibleDays).forEach(function (days) {
404
+ Object.keys(days).forEach(function (day) {
405
+ var momentObj = moment(day);
406
+ if (isBeforeDay(momentObj, endDate)) {
407
+ modifiers = _this2.addModifier(modifiers, momentObj, 'no-selected-start-before-selected-end');
408
+ }
409
+ });
410
+ });
411
+ }
412
+ }
413
+ if (!this.isTouchDevice && didStartDateChange && startDate && !endDate) {
414
+ var _startSpan = startDate.clone().add(1, 'day');
415
+ var _endSpan = startDate.clone().add(minimumNights + 1, 'days');
416
+ modifiers = this.addModifierToRange(modifiers, _startSpan, _endSpan, 'after-hovered-start');
417
+ }
418
+ if (!this.isTouchDevice && didEndDateChange && !startDate && endDate) {
419
+ var _startSpan2 = endDate.clone().subtract(minimumNights, 'days');
420
+ var _endSpan2 = endDate.clone();
421
+ modifiers = this.addModifierToRange(modifiers, _startSpan2, _endSpan2, 'before-hovered-end');
422
+ }
423
+ if (prevMinimumNights > 0) {
424
+ if (didFocusChange || didStartDateChange || minimumNights !== prevMinimumNights) {
425
+ var _startSpan3 = prevStartDate || this.today;
426
+ modifiers = this.deleteModifierFromRange(modifiers, _startSpan3, _startSpan3.clone().add(prevMinimumNights, 'days'), 'blocked-minimum-nights');
427
+ modifiers = this.deleteModifierFromRange(modifiers, _startSpan3, _startSpan3.clone().add(prevMinimumNights, 'days'), 'blocked');
428
+ }
429
+ }
430
+ if (didFocusChange || recomputePropModifiers) {
431
+ values(visibleDays).forEach(function (days) {
432
+ Object.keys(days).forEach(function (day) {
433
+ var momentObj = getPooledMoment(day);
434
+ var isBlocked = false;
435
+ if (didFocusChange || recomputeOutsideRange) {
436
+ if (isOutsideRange(momentObj)) {
437
+ modifiers = _this2.addModifier(modifiers, momentObj, 'blocked-out-of-range');
438
+ isBlocked = true;
439
+ } else {
440
+ modifiers = _this2.deleteModifier(modifiers, momentObj, 'blocked-out-of-range');
441
+ }
442
+ }
443
+ if (didFocusChange || recomputeDayBlocked) {
444
+ if (isDayBlocked(momentObj)) {
445
+ modifiers = _this2.addModifier(modifiers, momentObj, 'blocked-calendar');
446
+ isBlocked = true;
447
+ } else {
448
+ modifiers = _this2.deleteModifier(modifiers, momentObj, 'blocked-calendar');
449
+ }
450
+ }
451
+ if (isBlocked) {
452
+ modifiers = _this2.addModifier(modifiers, momentObj, 'blocked');
453
+ } else {
454
+ modifiers = _this2.deleteModifier(modifiers, momentObj, 'blocked');
455
+ }
456
+ if (didFocusChange || recomputeDayHighlighted) {
457
+ if (isDayHighlighted(momentObj)) {
458
+ modifiers = _this2.addModifier(modifiers, momentObj, 'highlighted-calendar');
459
+ } else {
460
+ modifiers = _this2.deleteModifier(modifiers, momentObj, 'highlighted-calendar');
461
+ }
462
+ }
463
+ });
464
+ });
465
+ }
466
+ if (!this.isTouchDevice && didFocusChange && hoverDate && !this.isBlocked(hoverDate)) {
467
+ var minNightsForHoverDate = getMinNightsForHoverDate(hoverDate);
468
+ if (minNightsForHoverDate > 0 && focusedInput === END_DATE) {
469
+ modifiers = this.deleteModifierFromRange(modifiers, hoverDate.clone().add(1, 'days'), hoverDate.clone().add(minNightsForHoverDate, 'days'), 'hovered-start-blocked-minimum-nights');
470
+ modifiers = this.deleteModifier(modifiers, hoverDate.clone().add(minNightsForHoverDate, 'days'), 'hovered-start-first-possible-end');
471
+ }
472
+ if (minNightsForHoverDate > 0 && focusedInput === START_DATE) {
473
+ modifiers = this.addModifierToRange(modifiers, hoverDate.clone().add(1, 'days'), hoverDate.clone().add(minNightsForHoverDate, 'days'), 'hovered-start-blocked-minimum-nights');
474
+ modifiers = this.addModifier(modifiers, hoverDate.clone().add(minNightsForHoverDate, 'days'), 'hovered-start-first-possible-end');
475
+ }
476
+ }
477
+ if (minimumNights > 0 && startDate && focusedInput === END_DATE) {
478
+ modifiers = this.addModifierToRange(modifiers, startDate, startDate.clone().add(minimumNights, 'days'), 'blocked-minimum-nights');
479
+ modifiers = this.addModifierToRange(modifiers, startDate, startDate.clone().add(minimumNights, 'days'), 'blocked');
480
+ }
481
+ var today = moment();
482
+ if (!isSameDay(this.today, today)) {
483
+ modifiers = this.deleteModifier(modifiers, this.today, 'today');
484
+ modifiers = this.addModifier(modifiers, today, 'today');
485
+ this.today = today;
486
+ }
487
+ if (Object.keys(modifiers).length > 0) {
488
+ this.setState({
489
+ visibleDays: _objectSpread(_objectSpread({}, visibleDays), modifiers)
490
+ });
491
+ }
492
+ if (didFocusChange || phrases !== prevPhrases) {
493
+ // set the appropriate CalendarDay phrase based on focusedInput
494
+ var chooseAvailableDate = getChooseAvailableDatePhrase(phrases, focusedInput);
495
+ this.setState({
496
+ phrases: _objectSpread(_objectSpread({}, phrases), {}, {
497
+ chooseAvailableDate: chooseAvailableDate
498
+ })
499
+ });
500
+ }
501
+ };
502
+ _proto.onDayClick = function onDayClick(day, e) {
503
+ var _this$props2 = this.props,
504
+ keepOpenOnDateSelect = _this$props2.keepOpenOnDateSelect,
505
+ minimumNights = _this$props2.minimumNights,
506
+ onBlur = _this$props2.onBlur,
507
+ focusedInput = _this$props2.focusedInput,
508
+ onFocusChange = _this$props2.onFocusChange,
509
+ onClose = _this$props2.onClose,
510
+ onDatesChange = _this$props2.onDatesChange,
511
+ startDateOffset = _this$props2.startDateOffset,
512
+ endDateOffset = _this$props2.endDateOffset,
513
+ disabled = _this$props2.disabled,
514
+ daysViolatingMinNightsCanBeClicked = _this$props2.daysViolatingMinNightsCanBeClicked;
515
+ if (e) e.preventDefault();
516
+ if (this.isBlocked(day, !daysViolatingMinNightsCanBeClicked)) return;
517
+ var _this$props3 = this.props,
518
+ startDate = _this$props3.startDate,
519
+ endDate = _this$props3.endDate;
520
+ if (startDateOffset || endDateOffset) {
521
+ startDate = getSelectedDateOffset(startDateOffset, day);
522
+ endDate = getSelectedDateOffset(endDateOffset, day);
523
+ if (this.isBlocked(startDate) || this.isBlocked(endDate)) {
524
+ return;
525
+ }
526
+ onDatesChange({
527
+ startDate: startDate,
528
+ endDate: endDate
529
+ });
530
+ if (!keepOpenOnDateSelect) {
531
+ onFocusChange(null);
532
+ onClose({
533
+ startDate: startDate,
534
+ endDate: endDate
535
+ });
536
+ }
537
+ } else if (focusedInput === START_DATE) {
538
+ var lastAllowedStartDate = endDate && endDate.clone().subtract(minimumNights, 'days');
539
+ var isStartDateAfterEndDate = isBeforeDay(lastAllowedStartDate, day) || isAfterDay(startDate, endDate);
540
+ var isEndDateDisabled = disabled === END_DATE;
541
+ if (!isEndDateDisabled || !isStartDateAfterEndDate) {
542
+ startDate = day;
543
+ if (isStartDateAfterEndDate) {
544
+ endDate = null;
545
+ }
546
+ }
547
+ onDatesChange({
548
+ startDate: startDate,
549
+ endDate: endDate
550
+ });
551
+ if (isEndDateDisabled && !isStartDateAfterEndDate) {
552
+ onFocusChange(null);
553
+ onClose({
554
+ startDate: startDate,
555
+ endDate: endDate
556
+ });
557
+ } else if (!isEndDateDisabled) {
558
+ onFocusChange(END_DATE);
559
+ }
560
+ } else if (focusedInput === END_DATE) {
561
+ var firstAllowedEndDate = startDate && startDate.clone().add(minimumNights, 'days');
562
+ if (!startDate) {
563
+ endDate = day;
564
+ onDatesChange({
565
+ startDate: startDate,
566
+ endDate: endDate
567
+ });
568
+ onFocusChange(START_DATE);
569
+ } else if (isInclusivelyAfterDay(day, firstAllowedEndDate)) {
570
+ endDate = day;
571
+ onDatesChange({
572
+ startDate: startDate,
573
+ endDate: endDate
574
+ });
575
+ if (!keepOpenOnDateSelect) {
576
+ onFocusChange(null);
577
+ onClose({
578
+ startDate: startDate,
579
+ endDate: endDate
580
+ });
581
+ }
582
+ } else if (daysViolatingMinNightsCanBeClicked && this.doesNotMeetMinimumNights(day)) {
583
+ endDate = day;
584
+ onDatesChange({
585
+ startDate: startDate,
586
+ endDate: endDate
587
+ });
588
+ } else if (disabled !== START_DATE) {
589
+ startDate = day;
590
+ endDate = null;
591
+ onDatesChange({
592
+ startDate: startDate,
593
+ endDate: endDate
594
+ });
595
+ } else {
596
+ onDatesChange({
597
+ startDate: startDate,
598
+ endDate: endDate
599
+ });
600
+ }
601
+ } else {
602
+ onDatesChange({
603
+ startDate: startDate,
604
+ endDate: endDate
605
+ });
606
+ }
607
+ onBlur();
608
+ };
609
+ _proto.onDayMouseEnter = function onDayMouseEnter(day) {
610
+ /* eslint react/destructuring-assignment: 1 */
611
+ if (this.isTouchDevice) return;
612
+ var _this$props4 = this.props,
613
+ startDate = _this$props4.startDate,
614
+ endDate = _this$props4.endDate,
615
+ focusedInput = _this$props4.focusedInput,
616
+ getMinNightsForHoverDate = _this$props4.getMinNightsForHoverDate,
617
+ minimumNights = _this$props4.minimumNights,
618
+ startDateOffset = _this$props4.startDateOffset,
619
+ endDateOffset = _this$props4.endDateOffset;
620
+ var _this$state = this.state,
621
+ hoverDate = _this$state.hoverDate,
622
+ visibleDays = _this$state.visibleDays,
623
+ dateOffset = _this$state.dateOffset;
624
+ var nextDateOffset = null;
625
+ if (focusedInput) {
626
+ var hasOffset = startDateOffset || endDateOffset;
627
+ var modifiers = {};
628
+ if (hasOffset) {
629
+ var start = getSelectedDateOffset(startDateOffset, day);
630
+ var end = getSelectedDateOffset(endDateOffset, day, function (rangeDay) {
631
+ return rangeDay.add(1, 'day');
632
+ });
633
+ nextDateOffset = {
634
+ start: start,
635
+ end: end
636
+ };
637
+
638
+ // eslint-disable-next-line react/destructuring-assignment
639
+ if (dateOffset && dateOffset.start && dateOffset.end) {
640
+ modifiers = this.deleteModifierFromRange(modifiers, dateOffset.start, dateOffset.end, 'hovered-offset');
641
+ }
642
+ modifiers = this.addModifierToRange(modifiers, start, end, 'hovered-offset');
643
+ }
644
+ if (!hasOffset) {
645
+ modifiers = this.deleteModifier(modifiers, hoverDate, 'hovered');
646
+ modifiers = this.addModifier(modifiers, day, 'hovered');
647
+ if (startDate && !endDate && focusedInput === END_DATE) {
648
+ if (isAfterDay(hoverDate, startDate)) {
649
+ var endSpan = hoverDate.clone().add(1, 'day');
650
+ modifiers = this.deleteModifierFromRange(modifiers, startDate, endSpan, 'hovered-span');
651
+ }
652
+ if (isBeforeDay(day, startDate) || isSameDay(day, startDate)) {
653
+ modifiers = this.deleteModifier(modifiers, startDate, 'selected-start-in-hovered-span');
654
+ }
655
+ if (!this.isBlocked(day) && isAfterDay(day, startDate)) {
656
+ var _endSpan3 = day.clone().add(1, 'day');
657
+ modifiers = this.addModifierToRange(modifiers, startDate, _endSpan3, 'hovered-span');
658
+ modifiers = this.addModifier(modifiers, startDate, 'selected-start-in-hovered-span');
659
+ }
660
+ }
661
+ if (!startDate && endDate && focusedInput === START_DATE) {
662
+ if (isBeforeDay(hoverDate, endDate)) {
663
+ modifiers = this.deleteModifierFromRange(modifiers, hoverDate, endDate, 'hovered-span');
664
+ }
665
+ if (isAfterDay(day, endDate) || isSameDay(day, endDate)) {
666
+ modifiers = this.deleteModifier(modifiers, endDate, 'selected-end-in-hovered-span');
667
+ }
668
+ if (!this.isBlocked(day) && isBeforeDay(day, endDate)) {
669
+ modifiers = this.addModifierToRange(modifiers, day, endDate, 'hovered-span');
670
+ modifiers = this.addModifier(modifiers, endDate, 'selected-end-in-hovered-span');
671
+ }
672
+ }
673
+ if (startDate) {
674
+ var startSpan = startDate.clone().add(1, 'day');
675
+ var _endSpan4 = startDate.clone().add(minimumNights + 1, 'days');
676
+ modifiers = this.deleteModifierFromRange(modifiers, startSpan, _endSpan4, 'after-hovered-start');
677
+ if (isSameDay(day, startDate)) {
678
+ var newStartSpan = startDate.clone().add(1, 'day');
679
+ var newEndSpan = startDate.clone().add(minimumNights + 1, 'days');
680
+ modifiers = this.addModifierToRange(modifiers, newStartSpan, newEndSpan, 'after-hovered-start');
681
+ }
682
+ }
683
+ if (endDate) {
684
+ var _startSpan4 = endDate.clone().subtract(minimumNights, 'days');
685
+ modifiers = this.deleteModifierFromRange(modifiers, _startSpan4, endDate, 'before-hovered-end');
686
+ if (isSameDay(day, endDate)) {
687
+ var _newStartSpan = endDate.clone().subtract(minimumNights, 'days');
688
+ modifiers = this.addModifierToRange(modifiers, _newStartSpan, endDate, 'before-hovered-end');
689
+ }
690
+ }
691
+ if (hoverDate && !this.isBlocked(hoverDate)) {
692
+ var minNightsForPrevHoverDate = getMinNightsForHoverDate(hoverDate);
693
+ if (minNightsForPrevHoverDate > 0 && focusedInput === START_DATE) {
694
+ modifiers = this.deleteModifierFromRange(modifiers, hoverDate.clone().add(1, 'days'), hoverDate.clone().add(minNightsForPrevHoverDate, 'days'), 'hovered-start-blocked-minimum-nights');
695
+ modifiers = this.deleteModifier(modifiers, hoverDate.clone().add(minNightsForPrevHoverDate, 'days'), 'hovered-start-first-possible-end');
696
+ }
697
+ }
698
+ if (!this.isBlocked(day)) {
699
+ var minNightsForHoverDate = getMinNightsForHoverDate(day);
700
+ if (minNightsForHoverDate > 0 && focusedInput === START_DATE) {
701
+ modifiers = this.addModifierToRange(modifiers, day.clone().add(1, 'days'), day.clone().add(minNightsForHoverDate, 'days'), 'hovered-start-blocked-minimum-nights');
702
+ modifiers = this.addModifier(modifiers, day.clone().add(minNightsForHoverDate, 'days'), 'hovered-start-first-possible-end');
703
+ }
704
+ }
705
+ }
706
+ this.setState({
707
+ hoverDate: day,
708
+ dateOffset: nextDateOffset,
709
+ visibleDays: _objectSpread(_objectSpread({}, visibleDays), modifiers)
710
+ });
711
+ }
712
+ };
713
+ _proto.onDayMouseLeave = function onDayMouseLeave(day) {
714
+ var _this$props5 = this.props,
715
+ startDate = _this$props5.startDate,
716
+ endDate = _this$props5.endDate,
717
+ focusedInput = _this$props5.focusedInput,
718
+ getMinNightsForHoverDate = _this$props5.getMinNightsForHoverDate,
719
+ minimumNights = _this$props5.minimumNights;
720
+ var _this$state2 = this.state,
721
+ hoverDate = _this$state2.hoverDate,
722
+ visibleDays = _this$state2.visibleDays,
723
+ dateOffset = _this$state2.dateOffset;
724
+ if (this.isTouchDevice || !hoverDate) return;
725
+ var modifiers = {};
726
+ modifiers = this.deleteModifier(modifiers, hoverDate, 'hovered');
727
+ if (dateOffset) {
728
+ modifiers = this.deleteModifierFromRange(modifiers, dateOffset.start, dateOffset.end, 'hovered-offset');
729
+ }
730
+ if (startDate && !endDate) {
731
+ if (isAfterDay(hoverDate, startDate)) {
732
+ var endSpan = hoverDate.clone().add(1, 'day');
733
+ modifiers = this.deleteModifierFromRange(modifiers, startDate, endSpan, 'hovered-span');
734
+ }
735
+ if (isAfterDay(day, startDate)) {
736
+ modifiers = this.deleteModifier(modifiers, startDate, 'selected-start-in-hovered-span');
737
+ }
738
+ }
739
+ if (!startDate && endDate) {
740
+ if (isAfterDay(endDate, hoverDate)) {
741
+ modifiers = this.deleteModifierFromRange(modifiers, hoverDate, endDate, 'hovered-span');
742
+ }
743
+ if (isBeforeDay(day, endDate)) {
744
+ modifiers = this.deleteModifier(modifiers, endDate, 'selected-end-in-hovered-span');
745
+ }
746
+ }
747
+ if (startDate && isSameDay(day, startDate)) {
748
+ var startSpan = startDate.clone().add(1, 'day');
749
+ var _endSpan5 = startDate.clone().add(minimumNights + 1, 'days');
750
+ modifiers = this.deleteModifierFromRange(modifiers, startSpan, _endSpan5, 'after-hovered-start');
751
+ }
752
+ if (endDate && isSameDay(day, endDate)) {
753
+ var _startSpan5 = endDate.clone().subtract(minimumNights, 'days');
754
+ modifiers = this.deleteModifierFromRange(modifiers, _startSpan5, endDate, 'before-hovered-end');
755
+ }
756
+ if (!this.isBlocked(hoverDate)) {
757
+ var minNightsForHoverDate = getMinNightsForHoverDate(hoverDate);
758
+ if (minNightsForHoverDate > 0 && focusedInput === START_DATE) {
759
+ modifiers = this.deleteModifierFromRange(modifiers, hoverDate.clone().add(1, 'days'), hoverDate.clone().add(minNightsForHoverDate, 'days'), 'hovered-start-blocked-minimum-nights');
760
+ modifiers = this.deleteModifier(modifiers, hoverDate.clone().add(minNightsForHoverDate, 'days'), 'hovered-start-first-possible-end');
761
+ }
762
+ }
763
+ this.setState({
764
+ hoverDate: null,
765
+ visibleDays: _objectSpread(_objectSpread({}, visibleDays), modifiers)
766
+ });
767
+ };
768
+ _proto.onPrevMonthClick = function onPrevMonthClick() {
769
+ var _this$props6 = this.props,
770
+ enableOutsideDays = _this$props6.enableOutsideDays,
771
+ maxDate = _this$props6.maxDate,
772
+ minDate = _this$props6.minDate,
773
+ numberOfMonths = _this$props6.numberOfMonths,
774
+ onPrevMonthClick = _this$props6.onPrevMonthClick;
775
+ var _this$state3 = this.state,
776
+ currentMonth = _this$state3.currentMonth,
777
+ visibleDays = _this$state3.visibleDays;
778
+ var newVisibleDays = {};
779
+ Object.keys(visibleDays).sort().slice(0, numberOfMonths + 1).forEach(function (month) {
780
+ newVisibleDays[month] = visibleDays[month];
781
+ });
782
+ var prevMonth = currentMonth.clone().subtract(2, 'months');
783
+ var prevMonthVisibleDays = getVisibleDays(prevMonth, 1, enableOutsideDays, true);
784
+ var newCurrentMonth = currentMonth.clone().subtract(1, 'month');
785
+ this.setState({
786
+ currentMonth: newCurrentMonth,
787
+ disablePrev: this.shouldDisableMonthNavigation(minDate, newCurrentMonth),
788
+ disableNext: this.shouldDisableMonthNavigation(maxDate, newCurrentMonth),
789
+ visibleDays: _objectSpread(_objectSpread({}, newVisibleDays), this.getModifiers(prevMonthVisibleDays))
790
+ }, function () {
791
+ onPrevMonthClick(newCurrentMonth.clone());
792
+ });
793
+ };
794
+ _proto.onNextMonthClick = function onNextMonthClick() {
795
+ var _this$props7 = this.props,
796
+ enableOutsideDays = _this$props7.enableOutsideDays,
797
+ maxDate = _this$props7.maxDate,
798
+ minDate = _this$props7.minDate,
799
+ numberOfMonths = _this$props7.numberOfMonths,
800
+ onNextMonthClick = _this$props7.onNextMonthClick;
801
+ var _this$state4 = this.state,
802
+ currentMonth = _this$state4.currentMonth,
803
+ visibleDays = _this$state4.visibleDays;
804
+ var newVisibleDays = {};
805
+ Object.keys(visibleDays).sort().slice(1).forEach(function (month) {
806
+ newVisibleDays[month] = visibleDays[month];
807
+ });
808
+ var nextMonth = currentMonth.clone().add(numberOfMonths + 1, 'month');
809
+ var nextMonthVisibleDays = getVisibleDays(nextMonth, 1, enableOutsideDays, true);
810
+ var newCurrentMonth = currentMonth.clone().add(1, 'month');
811
+ this.setState({
812
+ currentMonth: newCurrentMonth,
813
+ disablePrev: this.shouldDisableMonthNavigation(minDate, newCurrentMonth),
814
+ disableNext: this.shouldDisableMonthNavigation(maxDate, newCurrentMonth),
815
+ visibleDays: _objectSpread(_objectSpread({}, newVisibleDays), this.getModifiers(nextMonthVisibleDays))
816
+ }, function () {
817
+ onNextMonthClick(newCurrentMonth.clone());
818
+ });
819
+ };
820
+ _proto.onMonthChange = function onMonthChange(newMonth) {
821
+ var _this$props8 = this.props,
822
+ numberOfMonths = _this$props8.numberOfMonths,
823
+ enableOutsideDays = _this$props8.enableOutsideDays,
824
+ orientation = _this$props8.orientation;
825
+ var withoutTransitionMonths = orientation === VERTICAL_SCROLLABLE;
826
+ var newVisibleDays = getVisibleDays(newMonth, numberOfMonths, enableOutsideDays, withoutTransitionMonths);
827
+ this.setState({
828
+ currentMonth: newMonth.clone(),
829
+ visibleDays: this.getModifiers(newVisibleDays)
830
+ });
831
+ };
832
+ _proto.onYearChange = function onYearChange(newMonth) {
833
+ var _this$props9 = this.props,
834
+ numberOfMonths = _this$props9.numberOfMonths,
835
+ enableOutsideDays = _this$props9.enableOutsideDays,
836
+ orientation = _this$props9.orientation;
837
+ var withoutTransitionMonths = orientation === VERTICAL_SCROLLABLE;
838
+ var newVisibleDays = getVisibleDays(newMonth, numberOfMonths, enableOutsideDays, withoutTransitionMonths);
839
+ this.setState({
840
+ currentMonth: newMonth.clone(),
841
+ visibleDays: this.getModifiers(newVisibleDays)
842
+ });
843
+ };
844
+ _proto.onGetNextScrollableMonths = function onGetNextScrollableMonths() {
845
+ var _this$props0 = this.props,
846
+ numberOfMonths = _this$props0.numberOfMonths,
847
+ enableOutsideDays = _this$props0.enableOutsideDays;
848
+ var _this$state5 = this.state,
849
+ currentMonth = _this$state5.currentMonth,
850
+ visibleDays = _this$state5.visibleDays;
851
+ var numberOfVisibleMonths = Object.keys(visibleDays).length;
852
+ var nextMonth = currentMonth.clone().add(numberOfVisibleMonths, 'month');
853
+ var newVisibleDays = getVisibleDays(nextMonth, numberOfMonths, enableOutsideDays, true);
854
+ this.setState({
855
+ visibleDays: _objectSpread(_objectSpread({}, visibleDays), this.getModifiers(newVisibleDays))
856
+ });
857
+ };
858
+ _proto.onGetPrevScrollableMonths = function onGetPrevScrollableMonths() {
859
+ var _this$props1 = this.props,
860
+ numberOfMonths = _this$props1.numberOfMonths,
861
+ enableOutsideDays = _this$props1.enableOutsideDays;
862
+ var _this$state6 = this.state,
863
+ currentMonth = _this$state6.currentMonth,
864
+ visibleDays = _this$state6.visibleDays;
865
+ var firstPreviousMonth = currentMonth.clone().subtract(numberOfMonths, 'month');
866
+ var newVisibleDays = getVisibleDays(firstPreviousMonth, numberOfMonths, enableOutsideDays, true);
867
+ this.setState({
868
+ currentMonth: firstPreviousMonth.clone(),
869
+ visibleDays: _objectSpread(_objectSpread({}, visibleDays), this.getModifiers(newVisibleDays))
870
+ });
871
+ };
872
+ _proto.getFirstDayOfWeek = function getFirstDayOfWeek() {
873
+ var firstDayOfWeek = this.props.firstDayOfWeek;
874
+ if (firstDayOfWeek == null) {
875
+ return moment.localeData().firstDayOfWeek();
876
+ }
877
+ return firstDayOfWeek;
878
+ };
879
+ _proto.getFirstFocusableDay = function getFirstFocusableDay(newMonth) {
880
+ var _this3 = this;
881
+ var _this$props10 = this.props,
882
+ startDate = _this$props10.startDate,
883
+ endDate = _this$props10.endDate,
884
+ focusedInput = _this$props10.focusedInput,
885
+ minimumNights = _this$props10.minimumNights,
886
+ numberOfMonths = _this$props10.numberOfMonths;
887
+ var focusedDate = newMonth.clone().startOf('month').hour(12);
888
+ if (focusedInput === START_DATE && startDate) {
889
+ focusedDate = startDate.clone();
890
+ } else if (focusedInput === END_DATE && !endDate && startDate) {
891
+ focusedDate = startDate.clone().add(minimumNights, 'days');
892
+ } else if (focusedInput === END_DATE && endDate) {
893
+ focusedDate = endDate.clone();
894
+ }
895
+ if (this.isBlocked(focusedDate)) {
896
+ var days = [];
897
+ var lastVisibleDay = newMonth.clone().add(numberOfMonths - 1, 'months').endOf('month');
898
+ var currentDay = focusedDate.clone();
899
+ while (!isAfterDay(currentDay, lastVisibleDay)) {
900
+ currentDay = currentDay.clone().add(1, 'day');
901
+ days.push(currentDay);
902
+ }
903
+ var viableDays = days.filter(function (day) {
904
+ return !_this3.isBlocked(day);
905
+ });
906
+ if (viableDays.length > 0) {
907
+ var _viableDays = _slicedToArray(viableDays, 1);
908
+ focusedDate = _viableDays[0];
909
+ }
910
+ }
911
+ return focusedDate;
912
+ };
913
+ _proto.getModifiers = function getModifiers(visibleDays) {
914
+ var _this4 = this;
915
+ var modifiers = {};
916
+ Object.keys(visibleDays).forEach(function (month) {
917
+ modifiers[month] = {};
918
+ visibleDays[month].forEach(function (day) {
919
+ modifiers[month][toISODateString(day)] = _this4.getModifiersForDay(day);
920
+ });
921
+ });
922
+ return modifiers;
923
+ };
924
+ _proto.getModifiersForDay = function getModifiersForDay(day) {
925
+ var _this5 = this;
926
+ return new Set(Object.keys(this.modifiers).filter(function (modifier) {
927
+ return _this5.modifiers[modifier](day);
928
+ }));
929
+ };
930
+ _proto.getStateForNewMonth = function getStateForNewMonth(nextProps) {
931
+ var _this6 = this;
932
+ var initialVisibleMonth = nextProps.initialVisibleMonth,
933
+ numberOfMonths = nextProps.numberOfMonths,
934
+ enableOutsideDays = nextProps.enableOutsideDays,
935
+ orientation = nextProps.orientation,
936
+ startDate = nextProps.startDate;
937
+ var initialVisibleMonthThunk = initialVisibleMonth || (startDate ? function () {
938
+ return startDate;
939
+ } : function () {
940
+ return _this6.today;
941
+ });
942
+ var currentMonth = initialVisibleMonthThunk();
943
+ var withoutTransitionMonths = orientation === VERTICAL_SCROLLABLE;
944
+ var visibleDays = this.getModifiers(getVisibleDays(currentMonth, numberOfMonths, enableOutsideDays, withoutTransitionMonths));
945
+ return {
946
+ currentMonth: currentMonth,
947
+ visibleDays: visibleDays
948
+ };
949
+ };
950
+ _proto.shouldDisableMonthNavigation = function shouldDisableMonthNavigation(date, visibleMonth) {
951
+ if (!date) return false;
952
+ var _this$props11 = this.props,
953
+ numberOfMonths = _this$props11.numberOfMonths,
954
+ enableOutsideDays = _this$props11.enableOutsideDays;
955
+ return isDayVisible(date, visibleMonth, numberOfMonths, enableOutsideDays);
956
+ };
957
+ _proto.addModifier = function addModifier(updatedDays, day, modifier) {
958
+ return _addModifier(updatedDays, day, modifier, this.props, this.state);
959
+ };
960
+ _proto.addModifierToRange = function addModifierToRange(updatedDays, start, end, modifier) {
961
+ var days = updatedDays;
962
+ var spanStart = start.clone();
963
+ while (isBeforeDay(spanStart, end)) {
964
+ days = this.addModifier(days, spanStart, modifier);
965
+ spanStart = spanStart.clone().add(1, 'day');
966
+ }
967
+ return days;
968
+ };
969
+ _proto.deleteModifier = function deleteModifier(updatedDays, day, modifier) {
970
+ return _deleteModifier(updatedDays, day, modifier, this.props, this.state);
971
+ };
972
+ _proto.deleteModifierFromRange = function deleteModifierFromRange(updatedDays, start, end, modifier) {
973
+ var days = updatedDays;
974
+ var spanStart = start.clone();
975
+ while (isBeforeDay(spanStart, end)) {
976
+ days = this.deleteModifier(days, spanStart, modifier);
977
+ spanStart = spanStart.clone().add(1, 'day');
978
+ }
979
+ return days;
980
+ };
981
+ _proto.doesNotMeetMinimumNights = function doesNotMeetMinimumNights(day) {
982
+ var _this$props12 = this.props,
983
+ startDate = _this$props12.startDate,
984
+ isOutsideRange = _this$props12.isOutsideRange,
985
+ focusedInput = _this$props12.focusedInput,
986
+ minimumNights = _this$props12.minimumNights;
987
+ if (focusedInput !== END_DATE) return false;
988
+ if (startDate) {
989
+ var dayDiff = day.diff(startDate.clone().startOf('day').hour(12), 'days');
990
+ return dayDiff < minimumNights && dayDiff >= 0;
991
+ }
992
+ return isOutsideRange(moment(day).subtract(minimumNights, 'days'));
993
+ };
994
+ _proto.doesNotMeetMinNightsForHoveredStartDate = function doesNotMeetMinNightsForHoveredStartDate(day, hoverDate) {
995
+ var _this$props13 = this.props,
996
+ focusedInput = _this$props13.focusedInput,
997
+ getMinNightsForHoverDate = _this$props13.getMinNightsForHoverDate;
998
+ if (focusedInput !== END_DATE) return false;
999
+ if (hoverDate && !this.isBlocked(hoverDate)) {
1000
+ var minNights = getMinNightsForHoverDate(hoverDate);
1001
+ var dayDiff = day.diff(hoverDate.clone().startOf('day').hour(12), 'days');
1002
+ return dayDiff < minNights && dayDiff >= 0;
1003
+ }
1004
+ return false;
1005
+ };
1006
+ _proto.isDayAfterHoveredStartDate = function isDayAfterHoveredStartDate(day) {
1007
+ var _this$props14 = this.props,
1008
+ startDate = _this$props14.startDate,
1009
+ endDate = _this$props14.endDate,
1010
+ minimumNights = _this$props14.minimumNights;
1011
+ var _ref3 = this.state || {},
1012
+ hoverDate = _ref3.hoverDate;
1013
+ return !!startDate && !endDate && !this.isBlocked(day) && isNextDay(hoverDate, day) && minimumNights > 0 && isSameDay(hoverDate, startDate);
1014
+ };
1015
+ _proto.isEndDate = function isEndDate(day) {
1016
+ var endDate = this.props.endDate;
1017
+ return isSameDay(day, endDate);
1018
+ };
1019
+ _proto.isHovered = function isHovered(day) {
1020
+ var _ref4 = this.state || {},
1021
+ hoverDate = _ref4.hoverDate;
1022
+ var focusedInput = this.props.focusedInput;
1023
+ return !!focusedInput && isSameDay(day, hoverDate);
1024
+ };
1025
+ _proto.isInHoveredSpan = function isInHoveredSpan(day) {
1026
+ var _this$props15 = this.props,
1027
+ startDate = _this$props15.startDate,
1028
+ endDate = _this$props15.endDate;
1029
+ var _ref5 = this.state || {},
1030
+ hoverDate = _ref5.hoverDate;
1031
+ var isForwardRange = !!startDate && !endDate && (day.isBetween(startDate, hoverDate) || isSameDay(hoverDate, day));
1032
+ var isBackwardRange = !!endDate && !startDate && (day.isBetween(hoverDate, endDate) || isSameDay(hoverDate, day));
1033
+ var isValidDayHovered = hoverDate && !this.isBlocked(hoverDate);
1034
+ return (isForwardRange || isBackwardRange) && isValidDayHovered;
1035
+ };
1036
+ _proto.isInSelectedSpan = function isInSelectedSpan(day) {
1037
+ var _this$props16 = this.props,
1038
+ startDate = _this$props16.startDate,
1039
+ endDate = _this$props16.endDate;
1040
+ return day.isBetween(startDate, endDate, 'days');
1041
+ };
1042
+ _proto.isLastInRange = function isLastInRange(day) {
1043
+ var endDate = this.props.endDate;
1044
+ return this.isInSelectedSpan(day) && isNextDay(day, endDate);
1045
+ };
1046
+ _proto.isStartDate = function isStartDate(day) {
1047
+ var startDate = this.props.startDate;
1048
+ return isSameDay(day, startDate);
1049
+ };
1050
+ _proto.isBlocked = function isBlocked(day) {
1051
+ var blockDaysViolatingMinNights = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
1052
+ var _this$props17 = this.props,
1053
+ isDayBlocked = _this$props17.isDayBlocked,
1054
+ isOutsideRange = _this$props17.isOutsideRange;
1055
+ return isDayBlocked(day) || isOutsideRange(day) || blockDaysViolatingMinNights && this.doesNotMeetMinimumNights(day);
1056
+ };
1057
+ _proto.isToday = function isToday(day) {
1058
+ return isSameDay(day, this.today);
1059
+ };
1060
+ _proto.isFirstDayOfWeek = function isFirstDayOfWeek(day) {
1061
+ return day.day() === this.getFirstDayOfWeek();
1062
+ };
1063
+ _proto.isLastDayOfWeek = function isLastDayOfWeek(day) {
1064
+ return day.day() === (this.getFirstDayOfWeek() + 6) % 7;
1065
+ };
1066
+ _proto.isFirstPossibleEndDateForHoveredStartDate = function isFirstPossibleEndDateForHoveredStartDate(day, hoverDate) {
1067
+ var _this$props18 = this.props,
1068
+ focusedInput = _this$props18.focusedInput,
1069
+ getMinNightsForHoverDate = _this$props18.getMinNightsForHoverDate;
1070
+ if (focusedInput !== END_DATE || !hoverDate || this.isBlocked(hoverDate)) return false;
1071
+ var minNights = getMinNightsForHoverDate(hoverDate);
1072
+ var firstAvailableEndDate = hoverDate.clone().add(minNights, 'days');
1073
+ return isSameDay(day, firstAvailableEndDate);
1074
+ };
1075
+ _proto.beforeSelectedEnd = function beforeSelectedEnd(day) {
1076
+ var endDate = this.props.endDate;
1077
+ return isBeforeDay(day, endDate);
1078
+ };
1079
+ _proto.isDayBeforeHoveredEndDate = function isDayBeforeHoveredEndDate(day) {
1080
+ var _this$props19 = this.props,
1081
+ startDate = _this$props19.startDate,
1082
+ endDate = _this$props19.endDate,
1083
+ minimumNights = _this$props19.minimumNights;
1084
+ var _ref6 = this.state || {},
1085
+ hoverDate = _ref6.hoverDate;
1086
+ return !!endDate && !startDate && !this.isBlocked(day) && isPreviousDay(hoverDate, day) && minimumNights > 0 && isSameDay(hoverDate, endDate);
1087
+ };
1088
+ _proto.render = function render() {
1089
+ var _this$props20 = this.props,
1090
+ numberOfMonths = _this$props20.numberOfMonths,
1091
+ orientation = _this$props20.orientation,
1092
+ monthFormat = _this$props20.monthFormat,
1093
+ renderMonthText = _this$props20.renderMonthText,
1094
+ renderWeekHeaderElement = _this$props20.renderWeekHeaderElement,
1095
+ dayPickerNavigationInlineStyles = _this$props20.dayPickerNavigationInlineStyles,
1096
+ navPosition = _this$props20.navPosition,
1097
+ navPrev = _this$props20.navPrev,
1098
+ navNext = _this$props20.navNext,
1099
+ renderNavPrevButton = _this$props20.renderNavPrevButton,
1100
+ renderNavNextButton = _this$props20.renderNavNextButton,
1101
+ noNavButtons = _this$props20.noNavButtons,
1102
+ noNavNextButton = _this$props20.noNavNextButton,
1103
+ noNavPrevButton = _this$props20.noNavPrevButton,
1104
+ onOutsideClick = _this$props20.onOutsideClick,
1105
+ withPortal = _this$props20.withPortal,
1106
+ enableOutsideDays = _this$props20.enableOutsideDays,
1107
+ firstDayOfWeek = _this$props20.firstDayOfWeek,
1108
+ renderKeyboardShortcutsButton = _this$props20.renderKeyboardShortcutsButton,
1109
+ renderKeyboardShortcutsPanel = _this$props20.renderKeyboardShortcutsPanel,
1110
+ hideKeyboardShortcutsPanel = _this$props20.hideKeyboardShortcutsPanel,
1111
+ daySize = _this$props20.daySize,
1112
+ focusedInput = _this$props20.focusedInput,
1113
+ renderCalendarDay = _this$props20.renderCalendarDay,
1114
+ renderDayContents = _this$props20.renderDayContents,
1115
+ renderCalendarInfo = _this$props20.renderCalendarInfo,
1116
+ renderMonthElement = _this$props20.renderMonthElement,
1117
+ calendarInfoPosition = _this$props20.calendarInfoPosition,
1118
+ onBlur = _this$props20.onBlur,
1119
+ onShiftTab = _this$props20.onShiftTab,
1120
+ onTab = _this$props20.onTab,
1121
+ isFocused = _this$props20.isFocused,
1122
+ showKeyboardShortcuts = _this$props20.showKeyboardShortcuts,
1123
+ isRTL = _this$props20.isRTL,
1124
+ weekDayFormat = _this$props20.weekDayFormat,
1125
+ dayAriaLabelFormat = _this$props20.dayAriaLabelFormat,
1126
+ verticalHeight = _this$props20.verticalHeight,
1127
+ noBorder = _this$props20.noBorder,
1128
+ transitionDuration = _this$props20.transitionDuration,
1129
+ verticalBorderSpacing = _this$props20.verticalBorderSpacing,
1130
+ horizontalMonthPadding = _this$props20.horizontalMonthPadding;
1131
+ var _this$state7 = this.state,
1132
+ currentMonth = _this$state7.currentMonth,
1133
+ phrases = _this$state7.phrases,
1134
+ visibleDays = _this$state7.visibleDays,
1135
+ disablePrev = _this$state7.disablePrev,
1136
+ disableNext = _this$state7.disableNext;
1137
+ return /*#__PURE__*/React.createElement(DayPicker, {
1138
+ orientation: orientation,
1139
+ enableOutsideDays: enableOutsideDays,
1140
+ modifiers: visibleDays,
1141
+ numberOfMonths: numberOfMonths,
1142
+ onDayClick: this.onDayClick,
1143
+ onDayMouseEnter: this.onDayMouseEnter,
1144
+ onDayMouseLeave: this.onDayMouseLeave,
1145
+ onPrevMonthClick: this.onPrevMonthClick,
1146
+ onNextMonthClick: this.onNextMonthClick,
1147
+ onMonthChange: this.onMonthChange,
1148
+ onTab: onTab,
1149
+ onShiftTab: onShiftTab,
1150
+ onYearChange: this.onYearChange,
1151
+ onGetNextScrollableMonths: this.onGetNextScrollableMonths,
1152
+ onGetPrevScrollableMonths: this.onGetPrevScrollableMonths,
1153
+ monthFormat: monthFormat,
1154
+ renderMonthText: renderMonthText,
1155
+ renderWeekHeaderElement: renderWeekHeaderElement,
1156
+ withPortal: withPortal,
1157
+ hidden: !focusedInput,
1158
+ initialVisibleMonth: function initialVisibleMonth() {
1159
+ return currentMonth;
1160
+ },
1161
+ daySize: daySize,
1162
+ onOutsideClick: onOutsideClick,
1163
+ disablePrev: disablePrev,
1164
+ disableNext: disableNext,
1165
+ dayPickerNavigationInlineStyles: dayPickerNavigationInlineStyles,
1166
+ navPosition: navPosition,
1167
+ navPrev: navPrev,
1168
+ navNext: navNext,
1169
+ renderNavPrevButton: renderNavPrevButton,
1170
+ renderNavNextButton: renderNavNextButton,
1171
+ noNavButtons: noNavButtons,
1172
+ noNavPrevButton: noNavPrevButton,
1173
+ noNavNextButton: noNavNextButton,
1174
+ renderCalendarDay: renderCalendarDay,
1175
+ renderDayContents: renderDayContents,
1176
+ renderCalendarInfo: renderCalendarInfo,
1177
+ renderMonthElement: renderMonthElement,
1178
+ renderKeyboardShortcutsButton: renderKeyboardShortcutsButton,
1179
+ renderKeyboardShortcutsPanel: renderKeyboardShortcutsPanel,
1180
+ calendarInfoPosition: calendarInfoPosition,
1181
+ firstDayOfWeek: firstDayOfWeek,
1182
+ hideKeyboardShortcutsPanel: hideKeyboardShortcutsPanel,
1183
+ isFocused: isFocused,
1184
+ getFirstFocusableDay: this.getFirstFocusableDay,
1185
+ onBlur: onBlur,
1186
+ showKeyboardShortcuts: showKeyboardShortcuts,
1187
+ phrases: phrases,
1188
+ isRTL: isRTL,
1189
+ weekDayFormat: weekDayFormat,
1190
+ dayAriaLabelFormat: dayAriaLabelFormat,
1191
+ verticalHeight: verticalHeight,
1192
+ verticalBorderSpacing: verticalBorderSpacing,
1193
+ noBorder: noBorder,
1194
+ transitionDuration: transitionDuration,
1195
+ horizontalMonthPadding: horizontalMonthPadding
1196
+ });
1197
+ };
1198
+ return DayPickerRangeController;
1199
+ }(React.PureComponent || React.Component, !React.PureComponent && "shouldComponentUpdate");
1200
+ export { DayPickerRangeController as default };
1201
+ DayPickerRangeController.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
1202
+ DayPickerRangeController.defaultProps = defaultProps;