@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,341 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _readOnlyError from "@babel/runtime/helpers/esm/readOnlyError";
3
+ import _inheritsLoose from "@babel/runtime/helpers/esm/inheritsLoose";
4
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
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, nonNegativeInteger, or } from 'airbnb-prop-types';
12
+ import { withStyles, withStylesPropTypes } from 'react-with-styles';
13
+ import moment from 'moment';
14
+ import raf from 'raf';
15
+ import { CalendarDayPhrases } from '../defaultPhrases';
16
+ import getPhrasePropTypes from '../utils/getPhrasePropTypes';
17
+ import getCalendarDaySettings from '../utils/getCalendarDaySettings';
18
+ import { DAY_SIZE } from '../constants';
19
+ import DefaultTheme from '../theme/DefaultTheme';
20
+ var color = DefaultTheme.reactDates.color;
21
+ function getStyles(stylesObj, isHovered) {
22
+ if (!stylesObj) return null;
23
+ var hover = stylesObj.hover;
24
+ if (isHovered && hover) {
25
+ return hover;
26
+ }
27
+ return stylesObj;
28
+ }
29
+ var DayStyleShape = process.env.NODE_ENV !== "production" ? PropTypes.shape({
30
+ background: PropTypes.string,
31
+ border: or([PropTypes.string, PropTypes.number]),
32
+ color: PropTypes.string,
33
+ hover: PropTypes.shape({
34
+ background: PropTypes.string,
35
+ border: or([PropTypes.string, PropTypes.number]),
36
+ color: PropTypes.string
37
+ })
38
+ }) : {};
39
+ var propTypes = process.env.NODE_ENV !== "production" ? forbidExtraProps(_objectSpread(_objectSpread({}, withStylesPropTypes), {}, {
40
+ day: momentPropTypes.momentObj,
41
+ daySize: nonNegativeInteger,
42
+ isOutsideDay: PropTypes.bool,
43
+ modifiers: PropTypes.instanceOf(Set),
44
+ isFocused: PropTypes.bool,
45
+ tabIndex: PropTypes.oneOf([0, -1]),
46
+ onDayClick: PropTypes.func,
47
+ onDayMouseEnter: PropTypes.func,
48
+ onDayMouseLeave: PropTypes.func,
49
+ renderDayContents: PropTypes.func,
50
+ ariaLabelFormat: PropTypes.string,
51
+ // style overrides
52
+ defaultStyles: DayStyleShape,
53
+ outsideStyles: DayStyleShape,
54
+ todayStyles: DayStyleShape,
55
+ firstDayOfWeekStyles: DayStyleShape,
56
+ lastDayOfWeekStyles: DayStyleShape,
57
+ highlightedCalendarStyles: DayStyleShape,
58
+ blockedMinNightsStyles: DayStyleShape,
59
+ blockedCalendarStyles: DayStyleShape,
60
+ blockedOutOfRangeStyles: DayStyleShape,
61
+ hoveredSpanStyles: DayStyleShape,
62
+ selectedSpanStyles: DayStyleShape,
63
+ lastInRangeStyles: DayStyleShape,
64
+ selectedStyles: DayStyleShape,
65
+ selectedStartStyles: DayStyleShape,
66
+ selectedEndStyles: DayStyleShape,
67
+ afterHoveredStartStyles: DayStyleShape,
68
+ hoveredStartFirstPossibleEndStyles: DayStyleShape,
69
+ hoveredStartBlockedMinNightsStyles: DayStyleShape,
70
+ // internationalization
71
+ phrases: PropTypes.shape(getPhrasePropTypes(CalendarDayPhrases))
72
+ })) : {};
73
+ export var defaultStyles = {
74
+ border: "1px solid ".concat(color.core.borderLight),
75
+ color: color.text,
76
+ background: color.background,
77
+ hover: {
78
+ background: color.core.borderLight,
79
+ border: "1px solid ".concat(color.core.borderLight),
80
+ color: 'inherit'
81
+ }
82
+ };
83
+ export var outsideStyles = {
84
+ background: color.outside.backgroundColor,
85
+ border: 0,
86
+ color: color.outside.color
87
+ };
88
+ export var highlightedCalendarStyles = {
89
+ background: color.highlighted.backgroundColor,
90
+ color: color.highlighted.color,
91
+ hover: {
92
+ background: color.highlighted.backgroundColor_hover,
93
+ color: color.highlighted.color_active
94
+ }
95
+ };
96
+ export var blockedMinNightsStyles = {
97
+ background: color.minimumNights.backgroundColor,
98
+ border: "1px solid ".concat(color.minimumNights.borderColor),
99
+ color: color.minimumNights.color,
100
+ hover: {
101
+ background: color.minimumNights.backgroundColor_hover,
102
+ color: color.minimumNights.color_active
103
+ }
104
+ };
105
+ export var blockedCalendarStyles = {
106
+ background: color.blocked_calendar.backgroundColor,
107
+ border: "1px solid ".concat(color.blocked_calendar.borderColor),
108
+ color: color.blocked_calendar.color,
109
+ hover: {
110
+ background: color.blocked_calendar.backgroundColor_hover,
111
+ border: "1px solid ".concat(color.blocked_calendar.borderColor),
112
+ color: color.blocked_calendar.color_active
113
+ }
114
+ };
115
+ export var blockedOutOfRangeStyles = {
116
+ background: color.blocked_out_of_range.backgroundColor,
117
+ border: "1px solid ".concat(color.blocked_out_of_range.borderColor),
118
+ color: color.blocked_out_of_range.color,
119
+ hover: {
120
+ background: color.blocked_out_of_range.backgroundColor_hover,
121
+ border: "1px solid ".concat(color.blocked_out_of_range.borderColor),
122
+ color: color.blocked_out_of_range.color_active
123
+ }
124
+ };
125
+ export var hoveredSpanStyles = {
126
+ background: color.hoveredSpan.backgroundColor,
127
+ border: "1px double ".concat(color.hoveredSpan.borderColor),
128
+ color: color.hoveredSpan.color,
129
+ hover: {
130
+ background: color.hoveredSpan.backgroundColor_hover,
131
+ border: "1px double ".concat(color.hoveredSpan.borderColor),
132
+ color: color.hoveredSpan.color_active
133
+ }
134
+ };
135
+ export var selectedSpanStyles = {
136
+ background: color.selectedSpan.backgroundColor,
137
+ border: "1px double ".concat(color.selectedSpan.borderColor),
138
+ color: color.selectedSpan.color,
139
+ hover: {
140
+ background: color.selectedSpan.backgroundColor_hover,
141
+ border: "1px double ".concat(color.selectedSpan.borderColor),
142
+ color: color.selectedSpan.color_active
143
+ }
144
+ };
145
+ export var lastInRangeStyles = {};
146
+ export var selectedStyles = {
147
+ background: color.selected.backgroundColor,
148
+ border: "1px double ".concat(color.selected.borderColor),
149
+ color: color.selected.color,
150
+ hover: {
151
+ background: color.selected.backgroundColor_hover,
152
+ border: "1px double ".concat(color.selected.borderColor),
153
+ color: color.selected.color_active
154
+ }
155
+ };
156
+ var defaultProps = {
157
+ day: moment(),
158
+ daySize: DAY_SIZE,
159
+ isOutsideDay: false,
160
+ modifiers: new Set(),
161
+ isFocused: false,
162
+ tabIndex: -1,
163
+ onDayClick: function onDayClick() {},
164
+ onDayMouseEnter: function onDayMouseEnter() {},
165
+ onDayMouseLeave: function onDayMouseLeave() {},
166
+ renderDayContents: null,
167
+ ariaLabelFormat: 'dddd, LL',
168
+ // style defaults
169
+ defaultStyles: defaultStyles,
170
+ outsideStyles: outsideStyles,
171
+ todayStyles: {},
172
+ highlightedCalendarStyles: highlightedCalendarStyles,
173
+ blockedMinNightsStyles: blockedMinNightsStyles,
174
+ blockedCalendarStyles: blockedCalendarStyles,
175
+ blockedOutOfRangeStyles: blockedOutOfRangeStyles,
176
+ hoveredSpanStyles: hoveredSpanStyles,
177
+ selectedSpanStyles: selectedSpanStyles,
178
+ lastInRangeStyles: lastInRangeStyles,
179
+ selectedStyles: selectedStyles,
180
+ selectedStartStyles: {},
181
+ selectedEndStyles: {},
182
+ afterHoveredStartStyles: {},
183
+ firstDayOfWeekStyles: {},
184
+ lastDayOfWeekStyles: {},
185
+ hoveredStartFirstPossibleEndStyles: {},
186
+ hoveredStartBlockedMinNightsStyles: {},
187
+ // internationalization
188
+ phrases: CalendarDayPhrases
189
+ };
190
+ var CustomizableCalendarDay = /*#__PURE__*/function (_ref2, _ref) {
191
+ function CustomizableCalendarDay() {
192
+ var _this;
193
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
194
+ args[_key] = arguments[_key];
195
+ }
196
+ _this = _ref2.call.apply(_ref2, [this].concat(args)) || this;
197
+ _this.state = {
198
+ isHovered: false
199
+ };
200
+ _this.setButtonRef = _this.setButtonRef.bind(_this);
201
+ return _this;
202
+ }
203
+ _inheritsLoose(CustomizableCalendarDay, _ref2);
204
+ var _proto = CustomizableCalendarDay.prototype;
205
+ _proto[_ref] = function (nextProps, nextState) {
206
+ return !shallowEqual(this.props, nextProps) || !shallowEqual(this.state, nextState);
207
+ };
208
+ _proto.componentDidUpdate = function componentDidUpdate(prevProps) {
209
+ var _this2 = this;
210
+ var _this$props = this.props,
211
+ isFocused = _this$props.isFocused,
212
+ tabIndex = _this$props.tabIndex;
213
+ if (tabIndex === 0) {
214
+ if (isFocused || tabIndex !== prevProps.tabIndex) {
215
+ raf(function () {
216
+ if (_this2.buttonRef) {
217
+ _this2.buttonRef.focus();
218
+ }
219
+ });
220
+ }
221
+ }
222
+ };
223
+ _proto.onDayClick = function onDayClick(day, e) {
224
+ var onDayClick = this.props.onDayClick;
225
+ onDayClick(day, e);
226
+ };
227
+ _proto.onDayMouseEnter = function onDayMouseEnter(day, e) {
228
+ var onDayMouseEnter = this.props.onDayMouseEnter;
229
+ this.setState({
230
+ isHovered: true
231
+ });
232
+ onDayMouseEnter(day, e);
233
+ };
234
+ _proto.onDayMouseLeave = function onDayMouseLeave(day, e) {
235
+ var onDayMouseLeave = this.props.onDayMouseLeave;
236
+ this.setState({
237
+ isHovered: false
238
+ });
239
+ onDayMouseLeave(day, e);
240
+ };
241
+ _proto.onKeyDown = function onKeyDown(day, e) {
242
+ var onDayClick = this.props.onDayClick;
243
+ var key = e.key;
244
+ if (key === 'Enter' || key === ' ') {
245
+ onDayClick(day, e);
246
+ }
247
+ };
248
+ _proto.setButtonRef = function setButtonRef(ref) {
249
+ this.buttonRef = ref;
250
+ };
251
+ _proto.render = function render() {
252
+ var _this3 = this;
253
+ var _this$props2 = this.props,
254
+ day = _this$props2.day,
255
+ ariaLabelFormat = _this$props2.ariaLabelFormat,
256
+ daySize = _this$props2.daySize,
257
+ isOutsideDay = _this$props2.isOutsideDay,
258
+ modifiers = _this$props2.modifiers,
259
+ tabIndex = _this$props2.tabIndex,
260
+ renderDayContents = _this$props2.renderDayContents,
261
+ css = _this$props2.css,
262
+ styles = _this$props2.styles,
263
+ phrases = _this$props2.phrases,
264
+ defaultStylesWithHover = _this$props2.defaultStyles,
265
+ outsideStylesWithHover = _this$props2.outsideStyles,
266
+ todayStylesWithHover = _this$props2.todayStyles,
267
+ firstDayOfWeekStylesWithHover = _this$props2.firstDayOfWeekStyles,
268
+ lastDayOfWeekStylesWithHover = _this$props2.lastDayOfWeekStyles,
269
+ highlightedCalendarStylesWithHover = _this$props2.highlightedCalendarStyles,
270
+ blockedMinNightsStylesWithHover = _this$props2.blockedMinNightsStyles,
271
+ blockedCalendarStylesWithHover = _this$props2.blockedCalendarStyles,
272
+ blockedOutOfRangeStylesWithHover = _this$props2.blockedOutOfRangeStyles,
273
+ hoveredSpanStylesWithHover = _this$props2.hoveredSpanStyles,
274
+ selectedSpanStylesWithHover = _this$props2.selectedSpanStyles,
275
+ lastInRangeStylesWithHover = _this$props2.lastInRangeStyles,
276
+ selectedStylesWithHover = _this$props2.selectedStyles,
277
+ selectedStartStylesWithHover = _this$props2.selectedStartStyles,
278
+ selectedEndStylesWithHover = _this$props2.selectedEndStyles,
279
+ afterHoveredStartStylesWithHover = _this$props2.afterHoveredStartStyles,
280
+ hoveredStartFirstPossibleEndStylesWithHover = _this$props2.hoveredStartFirstPossibleEndStyles,
281
+ hoveredStartBlockedMinNightsStylesWithHover = _this$props2.hoveredStartBlockedMinNightsStyles;
282
+ var isHovered = this.state.isHovered;
283
+
284
+ // empty placeholder cell (no day to render); nothing to label
285
+ // eslint-disable-next-line jsx-a11y/control-has-associated-label
286
+ if (!day) return /*#__PURE__*/React.createElement("td", null);
287
+ var _getCalendarDaySettin = getCalendarDaySettings(day, ariaLabelFormat, daySize, modifiers, phrases),
288
+ daySizeStyles = _getCalendarDaySettin.daySizeStyles,
289
+ useDefaultCursor = _getCalendarDaySettin.useDefaultCursor,
290
+ selected = _getCalendarDaySettin.selected,
291
+ hoveredSpan = _getCalendarDaySettin.hoveredSpan,
292
+ isOutsideRange = _getCalendarDaySettin.isOutsideRange,
293
+ ariaLabel = _getCalendarDaySettin.ariaLabel;
294
+ return /*#__PURE__*/React.createElement("td", _extends({}, css(styles.CalendarDay, useDefaultCursor && styles.CalendarDay__defaultCursor, daySizeStyles, getStyles(defaultStylesWithHover, isHovered), isOutsideDay && getStyles(outsideStylesWithHover, isHovered), modifiers.has('today') && getStyles(todayStylesWithHover, isHovered), modifiers.has('first-day-of-week') && getStyles(firstDayOfWeekStylesWithHover, isHovered), modifiers.has('last-day-of-week') && getStyles(lastDayOfWeekStylesWithHover, isHovered), modifiers.has('hovered-start-first-possible-end') && getStyles(hoveredStartFirstPossibleEndStylesWithHover, isHovered), modifiers.has('hovered-start-blocked-minimum-nights') && getStyles(hoveredStartBlockedMinNightsStylesWithHover, isHovered), modifiers.has('highlighted-calendar') && getStyles(highlightedCalendarStylesWithHover, isHovered), modifiers.has('blocked-minimum-nights') && getStyles(blockedMinNightsStylesWithHover, isHovered), modifiers.has('blocked-calendar') && getStyles(blockedCalendarStylesWithHover, isHovered), hoveredSpan && getStyles(hoveredSpanStylesWithHover, isHovered), modifiers.has('after-hovered-start') && getStyles(afterHoveredStartStylesWithHover, isHovered), modifiers.has('selected-span') && getStyles(selectedSpanStylesWithHover, isHovered), modifiers.has('last-in-range') && getStyles(lastInRangeStylesWithHover, isHovered), selected && getStyles(selectedStylesWithHover, isHovered), modifiers.has('selected-start') && getStyles(selectedStartStylesWithHover, isHovered), modifiers.has('selected-end') && getStyles(selectedEndStylesWithHover, isHovered), isOutsideRange && getStyles(blockedOutOfRangeStylesWithHover, isHovered)), {
295
+ role: "button" // eslint-disable-line jsx-a11y/no-noninteractive-element-to-interactive-role
296
+ ,
297
+ ref: this.setButtonRef,
298
+ "aria-disabled": modifiers.has('blocked'),
299
+ "aria-label": ariaLabel,
300
+ onMouseEnter: function onMouseEnter(e) {
301
+ _this3.onDayMouseEnter(day, e);
302
+ },
303
+ onMouseLeave: function onMouseLeave(e) {
304
+ _this3.onDayMouseLeave(day, e);
305
+ },
306
+ onMouseUp: function onMouseUp(e) {
307
+ e.currentTarget.blur();
308
+ },
309
+ onClick: function onClick(e) {
310
+ _this3.onDayClick(day, e);
311
+ },
312
+ onKeyDown: function onKeyDown(e) {
313
+ _this3.onKeyDown(day, e);
314
+ },
315
+ tabIndex: tabIndex
316
+ }), renderDayContents ? renderDayContents(day, modifiers) : day.format('D'));
317
+ };
318
+ return CustomizableCalendarDay;
319
+ }(React.PureComponent || React.Component, !React.PureComponent && "shouldComponentUpdate");
320
+ CustomizableCalendarDay.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
321
+ CustomizableCalendarDay.defaultProps = defaultProps;
322
+ export { CustomizableCalendarDay as PureCustomizableCalendarDay };
323
+ export default withStyles(function (_ref3) {
324
+ var font = _ref3.reactDates.font;
325
+ return {
326
+ CalendarDay: {
327
+ boxSizing: 'border-box',
328
+ cursor: 'pointer',
329
+ fontSize: font.size,
330
+ textAlign: 'center',
331
+ ':active': {
332
+ outline: 0
333
+ }
334
+ },
335
+ CalendarDay__defaultCursor: {
336
+ cursor: 'default'
337
+ }
338
+ };
339
+ }, {
340
+ pureComponent: typeof React.PureComponent !== 'undefined'
341
+ })(CustomizableCalendarDay);
@@ -0,0 +1,344 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _readOnlyError from "@babel/runtime/helpers/esm/readOnlyError";
3
+ import _inheritsLoose from "@babel/runtime/helpers/esm/inheritsLoose";
4
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
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 { forbidExtraProps, nonNegativeInteger } from 'airbnb-prop-types';
11
+ import { withStyles, withStylesPropTypes } from 'react-with-styles';
12
+ import throttle from 'lodash/throttle';
13
+ import isTouchDevice from 'is-touch-device';
14
+ import noflip from '../utils/noflip';
15
+ import getInputHeight from '../utils/getInputHeight';
16
+ import openDirectionShape from '../shapes/OpenDirectionShape';
17
+ import { OPEN_DOWN, OPEN_UP, FANG_HEIGHT_PX, FANG_WIDTH_PX, DEFAULT_VERTICAL_SPACING, MODIFIER_KEY_NAMES } from '../constants';
18
+ var FANG_PATH_TOP = "M0,".concat(FANG_HEIGHT_PX, " ").concat(FANG_WIDTH_PX, ",").concat(FANG_HEIGHT_PX, " ").concat(FANG_WIDTH_PX / 2, ",0z");
19
+ var FANG_STROKE_TOP = "M0,".concat(FANG_HEIGHT_PX, " ").concat(FANG_WIDTH_PX / 2, ",0 ").concat(FANG_WIDTH_PX, ",").concat(FANG_HEIGHT_PX);
20
+ var FANG_PATH_BOTTOM = "M0,0 ".concat(FANG_WIDTH_PX, ",0 ").concat(FANG_WIDTH_PX / 2, ",").concat(FANG_HEIGHT_PX, "z");
21
+ var FANG_STROKE_BOTTOM = "M0,0 ".concat(FANG_WIDTH_PX / 2, ",").concat(FANG_HEIGHT_PX, " ").concat(FANG_WIDTH_PX, ",0");
22
+ var propTypes = process.env.NODE_ENV !== "production" ? forbidExtraProps(_objectSpread(_objectSpread({}, withStylesPropTypes), {}, {
23
+ id: PropTypes.string.isRequired,
24
+ placeholder: PropTypes.string,
25
+ displayValue: PropTypes.string,
26
+ ariaLabel: PropTypes.string,
27
+ autoComplete: PropTypes.string,
28
+ titleText: PropTypes.string,
29
+ screenReaderMessage: PropTypes.string,
30
+ focused: PropTypes.bool,
31
+ disabled: PropTypes.bool,
32
+ required: PropTypes.bool,
33
+ readOnly: PropTypes.bool,
34
+ openDirection: openDirectionShape,
35
+ showCaret: PropTypes.bool,
36
+ verticalSpacing: nonNegativeInteger,
37
+ small: PropTypes.bool,
38
+ block: PropTypes.bool,
39
+ regular: PropTypes.bool,
40
+ onChange: PropTypes.func,
41
+ onFocus: PropTypes.func,
42
+ onKeyDownShiftTab: PropTypes.func,
43
+ onKeyDownTab: PropTypes.func,
44
+ onKeyDownArrowDown: PropTypes.func,
45
+ onKeyDownQuestionMark: PropTypes.func,
46
+ // accessibility
47
+ isFocused: PropTypes.bool // describes actual DOM focus
48
+ })) : {};
49
+ var defaultProps = {
50
+ placeholder: 'Select Date',
51
+ displayValue: '',
52
+ ariaLabel: undefined,
53
+ autoComplete: 'off',
54
+ titleText: undefined,
55
+ screenReaderMessage: '',
56
+ focused: false,
57
+ disabled: false,
58
+ required: false,
59
+ readOnly: null,
60
+ openDirection: OPEN_DOWN,
61
+ showCaret: false,
62
+ verticalSpacing: DEFAULT_VERTICAL_SPACING,
63
+ small: false,
64
+ block: false,
65
+ regular: false,
66
+ onChange: function onChange() {},
67
+ onFocus: function onFocus() {},
68
+ onKeyDownShiftTab: function onKeyDownShiftTab() {},
69
+ onKeyDownTab: function onKeyDownTab() {},
70
+ onKeyDownArrowDown: function onKeyDownArrowDown() {},
71
+ onKeyDownQuestionMark: function onKeyDownQuestionMark() {},
72
+ // accessibility
73
+ isFocused: false
74
+ };
75
+ var DateInput = /*#__PURE__*/function (_ref2, _ref) {
76
+ function DateInput(props) {
77
+ var _this;
78
+ _this = _ref2.call(this, props) || this;
79
+ _this.state = {
80
+ dateString: '',
81
+ isTouchDevice: false,
82
+ lastDisplayValue: props.displayValue
83
+ };
84
+ _this.onChange = _this.onChange.bind(_this);
85
+ _this.onKeyDown = _this.onKeyDown.bind(_this);
86
+ _this.setInputRef = _this.setInputRef.bind(_this);
87
+ _this.throttledKeyDown = throttle(_this.onFinalKeyDown, 300, {
88
+ trailing: false
89
+ });
90
+ return _this;
91
+ }
92
+ _inheritsLoose(DateInput, _ref2);
93
+ var _proto = DateInput.prototype;
94
+ _proto[_ref] = function (nextProps, nextState) {
95
+ return !shallowEqual(this.props, nextProps) || !shallowEqual(this.state, nextState);
96
+ };
97
+ _proto.componentDidMount = function componentDidMount() {
98
+ this.setState({
99
+ isTouchDevice: isTouchDevice()
100
+ });
101
+ };
102
+ DateInput.getDerivedStateFromProps = function getDerivedStateFromProps(props, state) {
103
+ var displayValue = props.displayValue;
104
+ // Only react to displayValue changes that arrive via props, not to our own
105
+ // state updates (e.g. the user typing), so a typed draft is never wiped mid-edit.
106
+ if (displayValue !== state.lastDisplayValue) {
107
+ var nextState = {
108
+ lastDisplayValue: displayValue
109
+ };
110
+ if (state.dateString && displayValue) {
111
+ nextState.dateString = '';
112
+ }
113
+ return nextState;
114
+ }
115
+ return null;
116
+ };
117
+ _proto.componentDidUpdate = function componentDidUpdate(prevProps) {
118
+ var _this$props = this.props,
119
+ focused = _this$props.focused,
120
+ isFocused = _this$props.isFocused;
121
+ if (prevProps.focused === focused && prevProps.isFocused === isFocused) return;
122
+ if (focused && isFocused) {
123
+ this.inputRef.focus();
124
+ }
125
+ };
126
+ _proto.onChange = function onChange(e) {
127
+ var _this$props2 = this.props,
128
+ onChange = _this$props2.onChange,
129
+ onKeyDownQuestionMark = _this$props2.onKeyDownQuestionMark;
130
+ var dateString = e.target.value;
131
+
132
+ // In Safari, onKeyDown does not consistently fire ahead of onChange. As a result, we need to
133
+ // special case the `?` key so that it always triggers the appropriate callback, instead of
134
+ // modifying the input value
135
+ if (dateString[dateString.length - 1] === '?') {
136
+ onKeyDownQuestionMark(e);
137
+ } else {
138
+ this.setState({
139
+ dateString: dateString
140
+ }, function () {
141
+ return onChange(dateString);
142
+ });
143
+ }
144
+ };
145
+ _proto.onKeyDown = function onKeyDown(e) {
146
+ e.stopPropagation();
147
+ if (!MODIFIER_KEY_NAMES.has(e.key)) {
148
+ this.throttledKeyDown(e);
149
+ }
150
+ };
151
+ _proto.onFinalKeyDown = function onFinalKeyDown(e) {
152
+ var _this$props3 = this.props,
153
+ onKeyDownShiftTab = _this$props3.onKeyDownShiftTab,
154
+ onKeyDownTab = _this$props3.onKeyDownTab,
155
+ onKeyDownArrowDown = _this$props3.onKeyDownArrowDown,
156
+ onKeyDownQuestionMark = _this$props3.onKeyDownQuestionMark;
157
+ var key = e.key;
158
+ if (key === 'Tab') {
159
+ if (e.shiftKey) {
160
+ onKeyDownShiftTab(e);
161
+ } else {
162
+ onKeyDownTab(e);
163
+ }
164
+ } else if (key === 'ArrowDown') {
165
+ onKeyDownArrowDown(e);
166
+ } else if (key === '?') {
167
+ e.preventDefault();
168
+ onKeyDownQuestionMark(e);
169
+ }
170
+ };
171
+ _proto.setInputRef = function setInputRef(ref) {
172
+ this.inputRef = ref;
173
+ };
174
+ _proto.render = function render() {
175
+ var _this$state = this.state,
176
+ dateString = _this$state.dateString,
177
+ isTouch = _this$state.isTouchDevice;
178
+ var _this$props4 = this.props,
179
+ id = _this$props4.id,
180
+ placeholder = _this$props4.placeholder,
181
+ ariaLabel = _this$props4.ariaLabel,
182
+ autoComplete = _this$props4.autoComplete,
183
+ titleText = _this$props4.titleText,
184
+ displayValue = _this$props4.displayValue,
185
+ screenReaderMessage = _this$props4.screenReaderMessage,
186
+ focused = _this$props4.focused,
187
+ showCaret = _this$props4.showCaret,
188
+ onFocus = _this$props4.onFocus,
189
+ disabled = _this$props4.disabled,
190
+ required = _this$props4.required,
191
+ readOnly = _this$props4.readOnly,
192
+ openDirection = _this$props4.openDirection,
193
+ verticalSpacing = _this$props4.verticalSpacing,
194
+ small = _this$props4.small,
195
+ regular = _this$props4.regular,
196
+ block = _this$props4.block,
197
+ css = _this$props4.css,
198
+ styles = _this$props4.styles,
199
+ reactDates = _this$props4.theme.reactDates;
200
+ var value = dateString || displayValue || '';
201
+ var screenReaderMessageId = "DateInput__screen-reader-message-".concat(id);
202
+ var withFang = showCaret && focused;
203
+ var inputHeight = getInputHeight(reactDates, small);
204
+ return /*#__PURE__*/React.createElement("div", css(styles.DateInput, small && styles.DateInput__small, block && styles.DateInput__block, withFang && styles.DateInput__withFang, disabled && styles.DateInput__disabled, withFang && openDirection === OPEN_DOWN && styles.DateInput__openDown, withFang && openDirection === OPEN_UP && styles.DateInput__openUp), /*#__PURE__*/React.createElement("input", _extends({}, css(styles.DateInput_input, small && styles.DateInput_input__small, regular && styles.DateInput_input__regular, readOnly && styles.DateInput_input__readOnly, focused && styles.DateInput_input__focused, disabled && styles.DateInput_input__disabled), {
205
+ "aria-label": ariaLabel === undefined ? placeholder : ariaLabel,
206
+ title: titleText,
207
+ type: "text",
208
+ id: id,
209
+ name: id,
210
+ ref: this.setInputRef,
211
+ value: value,
212
+ onChange: this.onChange,
213
+ onKeyDown: this.onKeyDown,
214
+ onFocus: onFocus,
215
+ placeholder: placeholder,
216
+ autoComplete: autoComplete,
217
+ disabled: disabled,
218
+ readOnly: typeof readOnly === 'boolean' ? readOnly : isTouch,
219
+ required: required,
220
+ "aria-describedby": screenReaderMessage && screenReaderMessageId
221
+ })), withFang && /*#__PURE__*/React.createElement("svg", _extends({
222
+ role: "presentation",
223
+ focusable: "false"
224
+ }, css(styles.DateInput_fang, openDirection === OPEN_DOWN && {
225
+ top: inputHeight + verticalSpacing - FANG_HEIGHT_PX - 1
226
+ }, openDirection === OPEN_UP && {
227
+ bottom: inputHeight + verticalSpacing - FANG_HEIGHT_PX - 1
228
+ })), /*#__PURE__*/React.createElement("path", _extends({}, css(styles.DateInput_fangShape), {
229
+ d: openDirection === OPEN_DOWN ? FANG_PATH_TOP : FANG_PATH_BOTTOM
230
+ })), /*#__PURE__*/React.createElement("path", _extends({}, css(styles.DateInput_fangStroke), {
231
+ d: openDirection === OPEN_DOWN ? FANG_STROKE_TOP : FANG_STROKE_BOTTOM
232
+ }))), screenReaderMessage && /*#__PURE__*/React.createElement("p", _extends({}, css(styles.DateInput_screenReaderMessage), {
233
+ id: screenReaderMessageId
234
+ }), screenReaderMessage));
235
+ };
236
+ return DateInput;
237
+ }(React.PureComponent || React.Component, !React.PureComponent && "shouldComponentUpdate");
238
+ DateInput.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
239
+ DateInput.defaultProps = defaultProps;
240
+ export default withStyles(function (_ref3) {
241
+ var _ref3$reactDates = _ref3.reactDates,
242
+ border = _ref3$reactDates.border,
243
+ color = _ref3$reactDates.color,
244
+ sizing = _ref3$reactDates.sizing,
245
+ spacing = _ref3$reactDates.spacing,
246
+ font = _ref3$reactDates.font,
247
+ zIndex = _ref3$reactDates.zIndex;
248
+ return {
249
+ DateInput: {
250
+ margin: 0,
251
+ padding: spacing.inputPadding,
252
+ background: color.background,
253
+ position: 'relative',
254
+ display: 'inline-block',
255
+ width: sizing.inputWidth,
256
+ verticalAlign: 'middle'
257
+ },
258
+ DateInput__small: {
259
+ width: sizing.inputWidth_small
260
+ },
261
+ DateInput__block: {
262
+ width: '100%'
263
+ },
264
+ DateInput__disabled: {
265
+ background: color.disabled,
266
+ color: color.textDisabled
267
+ },
268
+ DateInput_input: {
269
+ fontWeight: font.input.weight,
270
+ fontSize: font.input.size,
271
+ lineHeight: font.input.lineHeight,
272
+ color: color.text,
273
+ backgroundColor: color.background,
274
+ width: '100%',
275
+ padding: "".concat(spacing.displayTextPaddingVertical, "px ").concat(spacing.displayTextPaddingHorizontal, "px"),
276
+ paddingTop: spacing.displayTextPaddingTop,
277
+ paddingBottom: spacing.displayTextPaddingBottom,
278
+ paddingLeft: noflip(spacing.displayTextPaddingLeft),
279
+ paddingRight: noflip(spacing.displayTextPaddingRight),
280
+ border: border.input.border,
281
+ borderTop: border.input.borderTop,
282
+ borderRight: noflip(border.input.borderRight),
283
+ borderBottom: border.input.borderBottom,
284
+ borderLeft: noflip(border.input.borderLeft),
285
+ borderRadius: border.input.borderRadius
286
+ },
287
+ DateInput_input__small: {
288
+ fontSize: font.input.size_small,
289
+ lineHeight: font.input.lineHeight_small,
290
+ letterSpacing: font.input.letterSpacing_small,
291
+ padding: "".concat(spacing.displayTextPaddingVertical_small, "px ").concat(spacing.displayTextPaddingHorizontal_small, "px"),
292
+ paddingTop: spacing.displayTextPaddingTop_small,
293
+ paddingBottom: spacing.displayTextPaddingBottom_small,
294
+ paddingLeft: noflip(spacing.displayTextPaddingLeft_small),
295
+ paddingRight: noflip(spacing.displayTextPaddingRight_small)
296
+ },
297
+ DateInput_input__regular: {
298
+ fontWeight: 'inherit'
299
+ },
300
+ DateInput_input__readOnly: {
301
+ userSelect: 'none'
302
+ },
303
+ DateInput_input__focused: {
304
+ outline: border.input.outlineFocused,
305
+ background: color.backgroundFocused,
306
+ border: border.input.borderFocused,
307
+ borderTop: border.input.borderTopFocused,
308
+ borderRight: noflip(border.input.borderRightFocused),
309
+ borderBottom: border.input.borderBottomFocused,
310
+ borderLeft: noflip(border.input.borderLeftFocused)
311
+ },
312
+ DateInput_input__disabled: {
313
+ background: color.disabled,
314
+ fontStyle: font.input.styleDisabled
315
+ },
316
+ DateInput_screenReaderMessage: {
317
+ border: 0,
318
+ clip: 'rect(0, 0, 0, 0)',
319
+ height: 1,
320
+ margin: -1,
321
+ overflow: 'hidden',
322
+ padding: 0,
323
+ position: 'absolute',
324
+ width: 1
325
+ },
326
+ DateInput_fang: {
327
+ position: 'absolute',
328
+ width: FANG_WIDTH_PX,
329
+ height: FANG_HEIGHT_PX,
330
+ left: 22,
331
+ // TODO: should be noflip wrapped and handled by an isRTL prop
332
+ zIndex: zIndex + 2
333
+ },
334
+ DateInput_fangShape: {
335
+ fill: color.background
336
+ },
337
+ DateInput_fangStroke: {
338
+ stroke: color.core.border,
339
+ fill: 'transparent'
340
+ }
341
+ };
342
+ }, {
343
+ pureComponent: typeof React.PureComponent !== 'undefined'
344
+ })(DateInput);