baseui 10.12.1 → 11.0.2

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 (307) hide show
  1. package/README.md +3 -3
  2. package/accordion/accordion.js +60 -13
  3. package/accordion/accordion.js.flow +49 -12
  4. package/accordion/index.d.ts +0 -3
  5. package/accordion/panel.js +7 -6
  6. package/accordion/panel.js.flow +20 -20
  7. package/accordion/stateless-accordion.js +2 -4
  8. package/accordion/stateless-accordion.js.flow +0 -2
  9. package/accordion/types.js.flow +0 -5
  10. package/button/constants.js +1 -2
  11. package/button/constants.js.flow +0 -1
  12. package/button/index.d.ts +0 -1
  13. package/button/styled-components.js +2 -29
  14. package/button/styled-components.js.flow +2 -30
  15. package/checkbox/checkbox.js +6 -30
  16. package/checkbox/checkbox.js.flow +7 -38
  17. package/checkbox/constants.js +2 -1
  18. package/checkbox/constants.js.flow +2 -1
  19. package/checkbox/index.d.ts +4 -6
  20. package/checkbox/index.js +0 -6
  21. package/checkbox/index.js.flow +0 -1
  22. package/checkbox/styled-components.js +52 -149
  23. package/checkbox/styled-components.js.flow +59 -165
  24. package/checkbox/types.js.flow +0 -5
  25. package/data-table/column-categorical.js +1 -1
  26. package/data-table/column-categorical.js.flow +1 -1
  27. package/data-table/column-datetime.js +1 -1
  28. package/data-table/column-datetime.js.flow +3 -1
  29. package/data-table/column.js +6 -2
  30. package/data-table/column.js.flow +9 -7
  31. package/data-table/data-table.js +10 -2
  32. package/data-table/data-table.js.flow +4 -1
  33. package/data-table/header-cell.js +3 -0
  34. package/data-table/header-cell.js.flow +1 -1
  35. package/data-table/index.d.ts +7 -8
  36. package/data-table/stateful-data-table.js +2 -1
  37. package/data-table/stateful-data-table.js.flow +1 -0
  38. package/data-table/types.js.flow +8 -0
  39. package/datepicker/calendar.js +28 -15
  40. package/datepicker/calendar.js.flow +31 -14
  41. package/datepicker/constants.js +12 -2
  42. package/datepicker/constants.js.flow +10 -0
  43. package/datepicker/datepicker.js +117 -86
  44. package/datepicker/datepicker.js.flow +123 -66
  45. package/datepicker/day.js +85 -34
  46. package/datepicker/day.js.flow +118 -54
  47. package/datepicker/locale.js.flow +0 -1
  48. package/datepicker/month.js +3 -1
  49. package/datepicker/month.js.flow +2 -0
  50. package/datepicker/stateful-calendar.js +6 -1
  51. package/datepicker/stateful-calendar.js.flow +8 -1
  52. package/datepicker/stateful-container.js +23 -2
  53. package/datepicker/stateful-container.js.flow +17 -3
  54. package/datepicker/stateful-datepicker.js +6 -1
  55. package/datepicker/stateful-datepicker.js.flow +7 -1
  56. package/datepicker/styled-components.js +23 -1
  57. package/datepicker/styled-components.js.flow +12 -2
  58. package/datepicker/types.js.flow +46 -43
  59. package/datepicker/utils/date-helpers.js +30 -0
  60. package/datepicker/utils/date-helpers.js.flow +12 -0
  61. package/datepicker/week.js +3 -1
  62. package/datepicker/week.js.flow +2 -0
  63. package/es/accordion/accordion.js +52 -12
  64. package/es/accordion/panel.js +7 -5
  65. package/es/accordion/stateless-accordion.js +2 -4
  66. package/es/button/constants.js +1 -2
  67. package/es/button/styled-components.js +2 -29
  68. package/es/checkbox/checkbox.js +7 -32
  69. package/es/checkbox/constants.js +2 -1
  70. package/es/checkbox/index.js +1 -1
  71. package/es/checkbox/styled-components.js +51 -146
  72. package/es/data-table/column-categorical.js +1 -1
  73. package/es/data-table/column-datetime.js +1 -1
  74. package/es/data-table/column.js +6 -2
  75. package/es/data-table/data-table.js +6 -2
  76. package/es/data-table/header-cell.js +3 -0
  77. package/es/data-table/stateful-data-table.js +2 -1
  78. package/es/datepicker/calendar.js +28 -15
  79. package/es/datepicker/constants.js +8 -0
  80. package/es/datepicker/datepicker.js +106 -79
  81. package/es/datepicker/day.js +77 -34
  82. package/es/datepicker/month.js +3 -1
  83. package/es/datepicker/stateful-calendar.js +6 -1
  84. package/es/datepicker/stateful-container.js +22 -2
  85. package/es/datepicker/stateful-datepicker.js +6 -1
  86. package/es/datepicker/styled-components.js +8 -2
  87. package/es/datepicker/types.js +1 -1
  88. package/es/datepicker/utils/date-helpers.js +16 -0
  89. package/es/datepicker/week.js +3 -1
  90. package/es/file-uploader/file-uploader.js +4 -4
  91. package/es/form-control/styled-components.js +0 -1
  92. package/es/header-navigation/styled-components.js +3 -3
  93. package/es/helpers/overrides.js +1 -2
  94. package/es/input/styled-components.js +4 -4
  95. package/es/layer/layer.js +4 -4
  96. package/es/list/list-item.js +5 -1
  97. package/es/list/menu-adapter.js +4 -0
  98. package/es/locale/index.js +0 -7
  99. package/es/menu/stateful-container.js +0 -1
  100. package/es/menu/styled-components.js +1 -1
  101. package/es/modal/index.js +1 -1
  102. package/es/modal/modal.js +19 -65
  103. package/es/modal/styled-components.js +12 -48
  104. package/es/phone-input/default-props.js +1 -1
  105. package/es/phone-input/index.js +0 -4
  106. package/es/phone-input/phone-input-lite.js +55 -31
  107. package/es/radio/radio.js +1 -7
  108. package/es/radio/radiogroup.js +3 -28
  109. package/es/radio/styled-components.js +4 -5
  110. package/es/rating/styled-components.js +3 -3
  111. package/es/select/index.js +1 -2
  112. package/es/select/select-component.js +20 -20
  113. package/es/select/styled-components.js +21 -17
  114. package/es/snackbar/snackbar-context.js +1 -1
  115. package/es/snackbar/styled-components.js +2 -2
  116. package/es/spinner/index.js +3 -9
  117. package/es/spinner/styled-components.js +2 -32
  118. package/es/table/filter.js +3 -3
  119. package/es/tag/styled-components.js +1 -1
  120. package/es/themes/dark-theme/color-component-tokens.js +0 -38
  121. package/es/themes/dark-theme/color-tokens.js +0 -2
  122. package/es/themes/dark-theme/create-dark-theme.js +0 -2
  123. package/es/themes/dark-theme/dark-theme.js +0 -2
  124. package/es/themes/light-theme/color-component-tokens.js +0 -38
  125. package/es/themes/light-theme/color-tokens.js +0 -2
  126. package/es/themes/light-theme/create-light-theme.js +0 -2
  127. package/es/themes/light-theme/light-theme.js +0 -2
  128. package/es/timepicker/timepicker.js +1 -8
  129. package/es/typography/index.js +1 -31
  130. package/esm/accordion/accordion.js +60 -13
  131. package/esm/accordion/panel.js +7 -6
  132. package/esm/accordion/stateless-accordion.js +2 -4
  133. package/esm/button/constants.js +1 -2
  134. package/esm/button/styled-components.js +2 -29
  135. package/esm/checkbox/checkbox.js +7 -30
  136. package/esm/checkbox/constants.js +2 -1
  137. package/esm/checkbox/index.js +1 -1
  138. package/esm/checkbox/styled-components.js +52 -147
  139. package/esm/data-table/column-categorical.js +1 -1
  140. package/esm/data-table/column-datetime.js +1 -1
  141. package/esm/data-table/column.js +6 -2
  142. package/esm/data-table/data-table.js +10 -2
  143. package/esm/data-table/header-cell.js +3 -0
  144. package/esm/data-table/stateful-data-table.js +2 -1
  145. package/esm/datepicker/calendar.js +28 -15
  146. package/esm/datepicker/constants.js +8 -0
  147. package/esm/datepicker/datepicker.js +116 -86
  148. package/esm/datepicker/day.js +84 -34
  149. package/esm/datepicker/month.js +3 -1
  150. package/esm/datepicker/stateful-calendar.js +6 -1
  151. package/esm/datepicker/stateful-container.js +23 -2
  152. package/esm/datepicker/stateful-datepicker.js +6 -1
  153. package/esm/datepicker/styled-components.js +24 -2
  154. package/esm/datepicker/types.js +1 -1
  155. package/esm/datepicker/utils/date-helpers.js +30 -0
  156. package/esm/datepicker/week.js +3 -1
  157. package/esm/file-uploader/file-uploader.js +4 -4
  158. package/esm/form-control/styled-components.js +0 -1
  159. package/esm/header-navigation/styled-components.js +3 -3
  160. package/esm/helpers/overrides.js +1 -2
  161. package/esm/input/styled-components.js +4 -4
  162. package/esm/layer/layer.js +4 -4
  163. package/esm/list/list-item.js +5 -1
  164. package/esm/list/menu-adapter.js +4 -0
  165. package/esm/locale/index.js +0 -7
  166. package/esm/menu/stateful-container.js +0 -1
  167. package/esm/menu/styled-components.js +1 -1
  168. package/esm/modal/index.js +1 -1
  169. package/esm/modal/modal.js +28 -71
  170. package/esm/modal/styled-components.js +6 -38
  171. package/esm/phone-input/default-props.js +1 -1
  172. package/esm/phone-input/index.js +0 -4
  173. package/esm/phone-input/phone-input-lite.js +60 -37
  174. package/esm/radio/radio.js +1 -7
  175. package/esm/radio/radiogroup.js +3 -28
  176. package/esm/radio/styled-components.js +4 -5
  177. package/esm/rating/styled-components.js +3 -3
  178. package/esm/select/index.js +1 -2
  179. package/esm/select/select-component.js +20 -20
  180. package/esm/select/styled-components.js +21 -14
  181. package/esm/snackbar/snackbar-context.js +1 -1
  182. package/esm/snackbar/styled-components.js +2 -2
  183. package/esm/spinner/index.js +3 -9
  184. package/esm/spinner/styled-components.js +2 -40
  185. package/esm/table/filter.js +3 -3
  186. package/esm/tag/styled-components.js +1 -1
  187. package/esm/themes/dark-theme/color-component-tokens.js +0 -38
  188. package/esm/themes/dark-theme/color-tokens.js +0 -2
  189. package/esm/themes/dark-theme/create-dark-theme.js +1 -2
  190. package/esm/themes/dark-theme/dark-theme.js +1 -2
  191. package/esm/themes/light-theme/color-component-tokens.js +0 -38
  192. package/esm/themes/light-theme/color-tokens.js +0 -2
  193. package/esm/themes/light-theme/create-light-theme.js +1 -2
  194. package/esm/themes/light-theme/light-theme.js +1 -2
  195. package/esm/timepicker/timepicker.js +1 -8
  196. package/esm/typography/index.js +1 -35
  197. package/file-uploader/file-uploader.js +3 -3
  198. package/file-uploader/file-uploader.js.flow +4 -4
  199. package/form-control/index.d.ts +9 -0
  200. package/form-control/styled-components.js +0 -1
  201. package/form-control/styled-components.js.flow +0 -1
  202. package/header-navigation/styled-components.js +3 -3
  203. package/header-navigation/styled-components.js.flow +3 -3
  204. package/helpers/overrides.js +1 -2
  205. package/helpers/overrides.js.flow +1 -1
  206. package/input/index.d.ts +5 -9
  207. package/input/styled-components.js +4 -4
  208. package/input/styled-components.js.flow +4 -4
  209. package/layer/layer.js +4 -4
  210. package/layer/layer.js.flow +4 -3
  211. package/list/list-item.js +5 -1
  212. package/list/list-item.js.flow +4 -0
  213. package/list/menu-adapter.js +4 -0
  214. package/list/menu-adapter.js.flow +4 -0
  215. package/list/types.js.flow +4 -0
  216. package/locale/index.js +0 -7
  217. package/locale/index.js.flow +0 -7
  218. package/locale.ts +0 -1
  219. package/menu/index.d.ts +1 -3
  220. package/menu/stateful-container.js +0 -1
  221. package/menu/stateful-container.js.flow +0 -1
  222. package/menu/styled-components.js +1 -1
  223. package/menu/styled-components.js.flow +1 -1
  224. package/modal/index.d.ts +4 -6
  225. package/modal/index.js +0 -6
  226. package/modal/index.js.flow +0 -1
  227. package/modal/modal.js +27 -70
  228. package/modal/modal.js.flow +17 -83
  229. package/modal/styled-components.js +7 -40
  230. package/modal/styled-components.js.flow +12 -44
  231. package/modal/types.js.flow +1 -10
  232. package/package.json +3 -2
  233. package/phone-input/default-props.js +1 -1
  234. package/phone-input/default-props.js.flow +1 -1
  235. package/phone-input/index.d.ts +0 -1
  236. package/phone-input/index.js +0 -36
  237. package/phone-input/index.js.flow +0 -4
  238. package/phone-input/phone-input-lite.js +63 -38
  239. package/phone-input/phone-input-lite.js.flow +66 -44
  240. package/radio/index.d.ts +4 -9
  241. package/radio/radio.js +1 -7
  242. package/radio/radio.js.flow +1 -8
  243. package/radio/radiogroup.js +3 -28
  244. package/radio/radiogroup.js.flow +2 -26
  245. package/radio/styled-components.js +4 -5
  246. package/radio/styled-components.js.flow +3 -4
  247. package/radio/types.js.flow +4 -15
  248. package/rating/styled-components.js +3 -3
  249. package/rating/styled-components.js.flow +3 -3
  250. package/select/index.d.ts +0 -2
  251. package/select/index.js +0 -6
  252. package/select/index.js.flow +0 -2
  253. package/select/select-component.js +23 -24
  254. package/select/select-component.js.flow +25 -14
  255. package/select/styled-components.js +23 -17
  256. package/select/styled-components.js.flow +17 -12
  257. package/snackbar/snackbar-context.js +1 -1
  258. package/snackbar/snackbar-context.js.flow +1 -1
  259. package/snackbar/styled-components.js +1 -1
  260. package/snackbar/styled-components.js.flow +11 -11
  261. package/spinner/index.d.ts +5 -18
  262. package/spinner/index.js +2 -68
  263. package/spinner/index.js.flow +2 -27
  264. package/spinner/styled-components.js +9 -45
  265. package/spinner/styled-components.js.flow +2 -34
  266. package/spinner/types.js.flow +1 -19
  267. package/styles/types.js.flow +0 -2
  268. package/table/filter.js +3 -3
  269. package/table/filter.js.flow +3 -3
  270. package/tag/styled-components.js +1 -1
  271. package/tag/styled-components.js.flow +1 -1
  272. package/tag/types.js.flow +1 -1
  273. package/theme.ts +0 -81
  274. package/themes/dark-theme/color-component-tokens.js +0 -38
  275. package/themes/dark-theme/color-component-tokens.js.flow +0 -42
  276. package/themes/dark-theme/color-tokens.js +0 -2
  277. package/themes/dark-theme/color-tokens.js.flow +0 -2
  278. package/themes/dark-theme/create-dark-theme.js +1 -3
  279. package/themes/dark-theme/create-dark-theme.js.flow +0 -2
  280. package/themes/dark-theme/dark-theme.js +1 -3
  281. package/themes/dark-theme/dark-theme.js.flow +0 -2
  282. package/themes/light-theme/color-component-tokens.js +0 -38
  283. package/themes/light-theme/color-component-tokens.js.flow +0 -43
  284. package/themes/light-theme/color-tokens.js +0 -2
  285. package/themes/light-theme/color-tokens.js.flow +0 -2
  286. package/themes/light-theme/create-light-theme.js +1 -3
  287. package/themes/light-theme/create-light-theme.js.flow +0 -2
  288. package/themes/light-theme/light-theme.js +1 -3
  289. package/themes/light-theme/light-theme.js.flow +0 -2
  290. package/themes/types.js.flow +0 -68
  291. package/timepicker/timepicker.js +1 -8
  292. package/timepicker/timepicker.js.flow +4 -10
  293. package/typography/index.d.ts +0 -23
  294. package/typography/index.js +2 -57
  295. package/typography/index.js.flow +0 -31
  296. package/es/spinner/spinner.js +0 -68
  297. package/es/themes/dark-theme/color-deprecated-semantic-tokens.js +0 -35
  298. package/es/themes/light-theme/color-deprecated-semantic-tokens.js +0 -35
  299. package/esm/spinner/spinner.js +0 -125
  300. package/esm/themes/dark-theme/color-deprecated-semantic-tokens.js +0 -38
  301. package/esm/themes/light-theme/color-deprecated-semantic-tokens.js +0 -38
  302. package/spinner/spinner.js +0 -136
  303. package/spinner/spinner.js.flow +0 -75
  304. package/themes/dark-theme/color-deprecated-semantic-tokens.js +0 -50
  305. package/themes/dark-theme/color-deprecated-semantic-tokens.js.flow +0 -42
  306. package/themes/light-theme/color-deprecated-semantic-tokens.js +0 -50
  307. package/themes/light-theme/color-deprecated-semantic-tokens.js.flow +0 -42
@@ -18,19 +18,20 @@ import { LocaleContext } from '../locale/index.js';
18
18
  import { StyledInputWrapper, StyledInputLabel, StyledStartDate, StyledEndDate } from './styled-components.js';
19
19
  import DateHelpers from './utils/date-helpers.js';
20
20
  import dateFnsAdapter from './utils/date-fns-adapter.js';
21
+ import { INPUT_ROLE, RANGED_CALENDAR_BEHAVIOR } from './constants.js';
21
22
  export const DEFAULT_DATE_FORMAT = 'yyyy/MM/dd';
22
- const INPUT_DELIMITER = ' ';
23
+ const INPUT_DELIMITER = '–';
23
24
 
24
- const combineSeparatedInputs = (newInputValue, prevCombinedInputValue = '', separatedInput) => {
25
+ const combineSeparatedInputs = (newInputValue, prevCombinedInputValue = '', inputRole) => {
25
26
  let inputValue = newInputValue;
26
- const [prevStartDate = '', prevEndDate = ''] = prevCombinedInputValue.split(INPUT_DELIMITER);
27
+ const [prevStartDate = '', prevEndDate = ''] = prevCombinedInputValue.split(` ${INPUT_DELIMITER} `);
27
28
 
28
- if (separatedInput === 'startDate' && prevEndDate) {
29
- inputValue = `${inputValue} ${prevEndDate}`;
29
+ if (inputRole === INPUT_ROLE.startDate && prevEndDate) {
30
+ inputValue = `${inputValue} ${INPUT_DELIMITER} ${prevEndDate}`;
30
31
  }
31
32
 
32
- if (separatedInput === 'endDate') {
33
- inputValue = `${prevStartDate} ${inputValue}`;
33
+ if (inputRole === INPUT_ROLE.endDate) {
34
+ inputValue = `${prevStartDate} ${INPUT_DELIMITER} ${inputValue}`;
34
35
  }
35
36
 
36
37
  return inputValue;
@@ -38,28 +39,69 @@ const combineSeparatedInputs = (newInputValue, prevCombinedInputValue = '', sepa
38
39
 
39
40
  export default class Datepicker extends React.Component {
40
41
  constructor(props) {
41
- super(props); //$FlowFixMe
42
+ super(props); //$FlowFixMe[incompatible-call]
42
43
 
43
44
  _defineProperty(this, "calendar", void 0);
44
45
 
45
46
  _defineProperty(this, "dateHelpers", void 0);
46
47
 
47
- _defineProperty(this, "onChange", data => {
48
+ _defineProperty(this, "handleChange", date => {
49
+ const onChange = this.props.onChange;
50
+ const onRangeChange = this.props.onRangeChange;
51
+
52
+ if (Array.isArray(date)) {
53
+ if (onChange && date.every(Boolean)) {
54
+ // flowlint-next-line unclear-type:off
55
+ onChange({
56
+ date: date
57
+ });
58
+ }
59
+
60
+ if (onRangeChange) {
61
+ onRangeChange({
62
+ date: [...date]
63
+ });
64
+ }
65
+ } else {
66
+ if (onChange) {
67
+ onChange({
68
+ date
69
+ });
70
+ }
71
+
72
+ if (onRangeChange) {
73
+ onRangeChange({
74
+ date
75
+ });
76
+ }
77
+ }
78
+ });
79
+
80
+ _defineProperty(this, "onCalendarSelect", data => {
48
81
  let isOpen = false;
49
82
  let isPseudoFocused = false;
50
83
  let calendarFocused = false;
51
84
  let nextDate = data.date;
52
85
 
53
86
  if (Array.isArray(nextDate) && this.props.range) {
54
- if (nextDate.length < 2) {
87
+ if (!nextDate[0] || !nextDate[1]) {
55
88
  isOpen = true;
56
89
  isPseudoFocused = true;
57
90
  calendarFocused = null;
58
- } else if (nextDate.length === 2) {
91
+ } else if (nextDate[0] && nextDate[1]) {
59
92
  const [start, end] = nextDate;
60
93
 
61
94
  if (this.dateHelpers.isAfter(start, end)) {
62
- nextDate = [start, start];
95
+ if (this.hasLockedBehavior()) {
96
+ nextDate = this.props.value;
97
+ isOpen = true;
98
+ } else {
99
+ nextDate = [start, start];
100
+ }
101
+ } else if (this.dateHelpers.dateRangeIncludesDates( // $FlowFixMe Cannot call `this.dateHelpers.dateRangeIncludesDates` with `nextDate` bound to the first parameter because read-only array type [1] is incompatible with array type [2]
102
+ nextDate, this.props.excludeDates)) {
103
+ nextDate = this.props.value;
104
+ isOpen = true;
63
105
  }
64
106
 
65
107
  if (this.state.lastActiveElm) {
@@ -104,9 +146,7 @@ export default class Datepicker extends React.Component {
104
146
  }),
105
147
  inputValue: this.formatDisplayValue(nextDate)
106
148
  });
107
- this.props.onChange && this.props.onChange({
108
- date: nextDate
109
- });
149
+ this.handleChange(nextDate);
110
150
  });
111
151
 
112
152
  _defineProperty(this, "formatDisplayValue", date => {
@@ -146,11 +186,12 @@ export default class Datepicker extends React.Component {
146
186
  return this.formatDate(date, formatString);
147
187
  });
148
188
 
149
- _defineProperty(this, "open", () => {
189
+ _defineProperty(this, "open", inputRole => {
150
190
  this.setState({
151
191
  isOpen: true,
152
192
  isPseudoFocused: true,
153
- calendarFocused: false
193
+ calendarFocused: false,
194
+ selectedInput: inputRole
154
195
  }, this.props.onOpen);
155
196
  });
156
197
 
@@ -158,6 +199,7 @@ export default class Datepicker extends React.Component {
158
199
  const isPseudoFocused = false;
159
200
  this.setState({
160
201
  isOpen: false,
202
+ selectedInput: null,
161
203
  isPseudoFocused,
162
204
  calendarFocused: false
163
205
  }, this.props.onClose);
@@ -194,28 +236,22 @@ export default class Datepicker extends React.Component {
194
236
  }
195
237
 
196
238
  if (range && !separateRangeInputs) {
197
- return '9999/99/99 9999/99/99';
239
+ return `9999/99/99 ${INPUT_DELIMITER} 9999/99/99`;
198
240
  }
199
241
 
200
242
  return '9999/99/99';
201
243
  });
202
244
 
203
- _defineProperty(this, "handleInputChange", (event, separatedInput) => {
204
- const inputValue = this.props.range && this.props.separateRangeInputs ? combineSeparatedInputs(event.currentTarget.value, this.state.inputValue, separatedInput) : event.currentTarget.value;
245
+ _defineProperty(this, "handleInputChange", (event, inputRole) => {
246
+ const inputValue = this.props.range && this.props.separateRangeInputs ? combineSeparatedInputs(event.currentTarget.value, this.state.inputValue, inputRole) : event.currentTarget.value;
205
247
  const mask = this.getMask();
206
248
  const formatString = this.normalizeDashes(this.props.formatString);
207
249
 
208
250
  if (typeof mask === 'string' && inputValue === mask.replace(/9/g, ' ') || inputValue.length === 0) {
209
- if (this.props.onChange) {
210
- if (this.props.range) {
211
- this.props.onChange({
212
- date: []
213
- });
214
- } else {
215
- this.props.onChange({
216
- date: null
217
- });
218
- }
251
+ if (this.props.range) {
252
+ this.handleChange([]);
253
+ } else {
254
+ this.handleChange(null);
219
255
  }
220
256
  }
221
257
 
@@ -232,7 +268,7 @@ export default class Datepicker extends React.Component {
232
268
  };
233
269
 
234
270
  if (this.props.range && typeof this.props.displayValueAtRangeIndex !== 'number') {
235
- const [left, right] = this.normalizeDashes(inputValue).split(INPUT_DELIMITER);
271
+ const [left, right] = this.normalizeDashes(inputValue).split(` ${INPUT_DELIMITER} `);
236
272
  let startDate = this.dateHelpers.date(left);
237
273
  let endDate = this.dateHelpers.date(right);
238
274
 
@@ -241,18 +277,12 @@ export default class Datepicker extends React.Component {
241
277
  endDate = parseDateString(right);
242
278
  }
243
279
 
244
- const onChange = this.props.onChange;
280
+ const datesValid = this.dateHelpers.isValid(startDate) && this.dateHelpers.isValid(endDate); // added equal case so that times within the same day can be expressed
245
281
 
246
- if (onChange) {
247
- const datesValid = this.dateHelpers.isValid(startDate) && this.dateHelpers.isValid(endDate); // added equal case so that times within the same day can be expressed
248
-
249
- const rangeValid = this.dateHelpers.isAfter(endDate, startDate) || this.dateHelpers.isEqual(startDate, endDate);
282
+ const rangeValid = this.dateHelpers.isAfter(endDate, startDate) || this.dateHelpers.isEqual(startDate, endDate);
250
283
 
251
- if (datesValid && rangeValid) {
252
- onChange({
253
- date: [startDate, endDate]
254
- });
255
- }
284
+ if (datesValid && rangeValid) {
285
+ this.handleChange([startDate, endDate]);
256
286
  }
257
287
  } else {
258
288
  const dateString = this.normalizeDashes(inputValue);
@@ -268,12 +298,11 @@ export default class Datepicker extends React.Component {
268
298
 
269
299
  const {
270
300
  displayValueAtRangeIndex,
271
- onChange,
272
301
  range,
273
302
  value
274
303
  } = this.props;
275
304
 
276
- if (date && this.dateHelpers.isValid(date) && onChange) {
305
+ if (date && this.dateHelpers.isValid(date)) {
277
306
  if (range && Array.isArray(value) && typeof displayValueAtRangeIndex === 'number') {
278
307
  let [left, right] = value;
279
308
 
@@ -281,22 +310,16 @@ export default class Datepicker extends React.Component {
281
310
  left = date;
282
311
 
283
312
  if (!right) {
284
- onChange({
285
- date: [left]
286
- });
313
+ this.handleChange([left]);
287
314
  } else {
288
315
  if (this.dateHelpers.isAfter(right, left) || this.dateHelpers.isEqual(left, right)) {
289
- onChange({
290
- date: [left, right]
291
- });
316
+ this.handleChange([left, right]);
292
317
  } else {
293
318
  // Is resetting back to previous value appropriate? Invalid range is not
294
319
  // communicated to the user, but if it was not reset the text value would
295
320
  // show one value and date value another. This seems a bit better but clearly
296
321
  // has a downside.
297
- onChange({
298
- date: [...value]
299
- });
322
+ this.handleChange([...value]);
300
323
  }
301
324
  }
302
325
  } else if (displayValueAtRangeIndex === 1) {
@@ -304,26 +327,18 @@ export default class Datepicker extends React.Component {
304
327
 
305
328
  if (!left) {
306
329
  // If start value is not defined, set start/end to the same day.
307
- onChange({
308
- date: [right, right]
309
- });
330
+ this.handleChange([right, right]);
310
331
  } else {
311
332
  if (this.dateHelpers.isAfter(right, left) || this.dateHelpers.isEqual(left, right)) {
312
- onChange({
313
- date: [left, right]
314
- });
333
+ this.handleChange([left, right]);
315
334
  } else {
316
335
  // See comment above about resetting dates on invalid range
317
- onChange({
318
- date: [...value]
319
- });
336
+ this.handleChange([...value]);
320
337
  }
321
338
  }
322
339
  }
323
340
  } else {
324
- onChange({
325
- date
326
- });
341
+ this.handleChange(date);
327
342
  }
328
343
  }
329
344
  }
@@ -353,19 +368,28 @@ export default class Datepicker extends React.Component {
353
368
 
354
369
  _defineProperty(this, "normalizeDashes", inputValue => {
355
370
  // replacing both hyphens and em-dashes with en-dashes
356
- return inputValue.replace(/-/g, '–').replace(/—/g, '–');
371
+ return inputValue.replace(/-/g, INPUT_DELIMITER).replace(/—/g, INPUT_DELIMITER);
372
+ });
373
+
374
+ _defineProperty(this, "hasLockedBehavior", () => {
375
+ return this.props.rangedCalendarBehavior === RANGED_CALENDAR_BEHAVIOR.locked && this.props.range && this.props.separateRangeInputs;
357
376
  });
358
377
 
359
378
  this.dateHelpers = new DateHelpers(props.adapter);
360
379
  this.state = {
361
380
  calendarFocused: false,
362
381
  isOpen: false,
382
+ selectedInput: null,
363
383
  isPseudoFocused: false,
364
384
  lastActiveElm: null,
365
385
  inputValue: this.formatDisplayValue(props.value) || ''
366
386
  };
367
387
  }
368
388
 
389
+ getNullDatePlaceholder(formatString) {
390
+ return (this.getMask() || formatString).split(INPUT_DELIMITER)[0].replace(/[0-9]|[a-z]/g, ' ');
391
+ }
392
+
369
393
  formatDate(date, formatString) {
370
394
  const format = date => {
371
395
  if (formatString === DEFAULT_DATE_FORMAT) {
@@ -379,8 +403,12 @@ export default class Datepicker extends React.Component {
379
403
  return '';
380
404
  } else if (Array.isArray(date) && !date[0] && !date[1]) {
381
405
  return '';
406
+ } else if (Array.isArray(date) && !date[0] && date[1]) {
407
+ const endDate = format(date[1]);
408
+ const startDate = this.getNullDatePlaceholder(formatString);
409
+ return [startDate, endDate].join(` ${INPUT_DELIMITER} `);
382
410
  } else if (Array.isArray(date)) {
383
- return date.map(day => format(day)).join(INPUT_DELIMITER);
411
+ return date.map(day => day ? format(day) : '').join(` ${INPUT_DELIMITER} `);
384
412
  } else {
385
413
  return format(date);
386
414
  }
@@ -394,17 +422,14 @@ export default class Datepicker extends React.Component {
394
422
  }
395
423
  }
396
424
 
397
- renderInputComponent(locale, separatedInput) {
425
+ renderInputComponent(locale, inputRole) {
398
426
  const {
399
427
  overrides = {}
400
428
  } = this.props;
401
429
  const [InputComponent, inputProps] = getOverrides(overrides.Input, MaskedInput);
402
- const placeholder = this.props.placeholder || this.props.placeholder === '' ? this.props.placeholder : this.props.range && !this.props.separateRangeInputs ? 'YYYY/MM/DD YYYY/MM/DD' : 'YYYY/MM/DD';
403
- const [startDate = '', endDate = ''] = (this.state.inputValue || '').split(INPUT_DELIMITER);
404
- const value = separatedInput === 'startDate' ? startDate : separatedInput === 'endDate' ? endDate : this.state.inputValue;
405
-
406
- const onChange = event => this.handleInputChange(event, separatedInput);
407
-
430
+ const placeholder = this.props.placeholder || this.props.placeholder === '' ? this.props.placeholder : this.props.range && !this.props.separateRangeInputs ? `YYYY/MM/DD ${INPUT_DELIMITER} YYYY/MM/DD` : 'YYYY/MM/DD';
431
+ const [startDate = '', endDate = ''] = (this.state.inputValue || '').split(` ${INPUT_DELIMITER} `);
432
+ const value = inputRole === INPUT_ROLE.startDate ? startDate : inputRole === INPUT_ROLE.endDate ? endDate : this.state.inputValue;
408
433
  return /*#__PURE__*/React.createElement(InputComponent, _extends({
409
434
  "aria-disabled": this.props.disabled,
410
435
  "aria-label": this.props['aria-label'] || (this.props.range ? locale.datepicker.ariaLabelRange : locale.datepicker.ariaLabel),
@@ -416,10 +441,10 @@ export default class Datepicker extends React.Component {
416
441
  disabled: this.props.disabled,
417
442
  size: this.props.size,
418
443
  value: value,
419
- onFocus: this.open,
444
+ onFocus: () => this.open(inputRole),
420
445
  onBlur: this.handleInputBlur,
421
446
  onKeyDown: this.handleKeyDown,
422
- onChange: onChange,
447
+ onChange: event => this.handleInputChange(event, inputRole),
423
448
  placeholder: placeholder,
424
449
  mask: this.getMask(),
425
450
  required: this.props.required,
@@ -452,11 +477,13 @@ export default class Datepicker extends React.Component {
452
477
  trapTabbing: true,
453
478
  value: this.props.value
454
479
  }, this.props, {
455
- onChange: this.onChange
480
+ onChange: this.onCalendarSelect,
481
+ selectedInput: this.state.selectedInput,
482
+ hasLockedBehavior: this.hasLockedBehavior()
456
483
  }))
457
484
  }, popoverProps), /*#__PURE__*/React.createElement(InputWrapper, _extends({}, inputWrapperProps, {
458
485
  $separateRangeInputs: this.props.range && this.props.separateRangeInputs
459
- }), this.props.range && this.props.separateRangeInputs ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(StartDate, startDateProps, /*#__PURE__*/React.createElement(InputLabel, inputLabelProps, startDateLabel), this.renderInputComponent(locale, 'startDate')), /*#__PURE__*/React.createElement(EndDate, endDateProps, /*#__PURE__*/React.createElement(InputLabel, inputLabelProps, endDateLabel), this.renderInputComponent(locale, 'endDate'))) : /*#__PURE__*/React.createElement(React.Fragment, null, this.renderInputComponent(locale)))), /*#__PURE__*/React.createElement("p", {
486
+ }), this.props.range && this.props.separateRangeInputs ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(StartDate, startDateProps, /*#__PURE__*/React.createElement(InputLabel, inputLabelProps, startDateLabel), this.renderInputComponent(locale, INPUT_ROLE.startDate)), /*#__PURE__*/React.createElement(EndDate, endDateProps, /*#__PURE__*/React.createElement(InputLabel, inputLabelProps, endDateLabel), this.renderInputComponent(locale, INPUT_ROLE.endDate))) : /*#__PURE__*/React.createElement(React.Fragment, null, this.renderInputComponent(locale)))), /*#__PURE__*/React.createElement("p", {
460
487
  id: this.props['aria-describedby'],
461
488
  style: {
462
489
  position: 'fixed',
@@ -487,11 +514,11 @@ export default class Datepicker extends React.Component {
487
514
  clipPath: 'inset(100%)'
488
515
  }
489
516
  }, // No date selected
490
- !this.props.value || Array.isArray(this.props.value) && !this.props.value.length ? '' : // Date selected in a non-range picker
517
+ !this.props.value || Array.isArray(this.props.value) && !this.props.value[0] && !this.props.value[1] ? '' : // Date selected in a non-range picker
491
518
  !Array.isArray(this.props.value) ? getInterpolatedString(locale.datepicker.selectedDate, {
492
519
  date: this.state.inputValue || ''
493
520
  }) : // Start and end dates are selected in a range picker
494
- this.props.value.length > 1 ? getInterpolatedString(locale.datepicker.selectedDateRange, {
521
+ this.props.value[0] && this.props.value[1] ? getInterpolatedString(locale.datepicker.selectedDateRange, {
495
522
  startDate: this.formatDisplayValue(this.props.value[0]),
496
523
  endDate: this.formatDisplayValue( // $FlowFixMe
497
524
  this.props.value[1])
@@ -15,6 +15,7 @@ import DateHelpers from './utils/date-helpers.js';
15
15
  import { getOverrides } from '../helpers/overrides.js';
16
16
  import { LocaleContext } from '../locale/index.js';
17
17
  import { isFocusVisible } from '../utils/focusVisible.js';
18
+ import { INPUT_ROLE } from './constants.js';
18
19
  export default class Day extends React.Component {
19
20
  constructor(props) {
20
21
  super(props);
@@ -41,22 +42,46 @@ export default class Day extends React.Component {
41
42
  range,
42
43
  value
43
44
  } = this.props;
44
- let date;
45
+ let nextDate;
46
+
47
+ if (Array.isArray(value) && range && this.props.hasLockedBehavior) {
48
+ const currentDate = this.props.value;
49
+ let nextStartDate = null;
50
+ let nextEndDate = null;
51
+
52
+ if (this.props.selectedInput === INPUT_ROLE.startDate) {
53
+ nextStartDate = selectedDate;
54
+ nextEndDate = Array.isArray(currentDate) && currentDate[1] ? currentDate[1] : null;
55
+ } else if (this.props.selectedInput === INPUT_ROLE.endDate) {
56
+ nextStartDate = Array.isArray(currentDate) && currentDate[0] ? currentDate[0] : null;
57
+ nextEndDate = selectedDate;
58
+ }
59
+
60
+ nextDate = [nextStartDate];
45
61
 
46
- if (Array.isArray(value) && range) {
47
- if (!value.length || value.length > 1) {
48
- date = [selectedDate];
49
- } else if (this.dateHelpers.isAfter(selectedDate, value[0])) {
50
- date = [value[0], selectedDate];
62
+ if (nextEndDate) {
63
+ nextDate.push(nextEndDate);
64
+ }
65
+ } else if (Array.isArray(value) && range && !this.props.hasLockedBehavior) {
66
+ const [start, end] = value; // Starting a new range
67
+
68
+ if (!start && !end || start && end) {
69
+ nextDate = [selectedDate, null]; // EndDate needs a StartDate, SelectedDate comes before EndDate
70
+ } else if (!start && end && this.dateHelpers.isAfter(end, selectedDate)) {
71
+ nextDate = [selectedDate, end]; // EndDate needs a StartDate, but SelectedDate comes after EndDate
72
+ } else if (!start && end && this.dateHelpers.isAfter(selectedDate, end)) {
73
+ nextDate = [end, selectedDate]; // StartDate needs an EndDate, SelectedDate comes after StartDate
74
+ } else if (start && !end && this.dateHelpers.isAfter(selectedDate, start)) {
75
+ nextDate = [start, selectedDate];
51
76
  } else {
52
- date = [selectedDate, value[0]];
77
+ nextDate = [selectedDate, start];
53
78
  }
54
79
  } else {
55
- date = selectedDate;
80
+ nextDate = selectedDate;
56
81
  }
57
82
 
58
83
  this.props.onSelect({
59
- date
84
+ date: nextDate
60
85
  });
61
86
  });
62
87
 
@@ -233,13 +258,16 @@ export default class Day extends React.Component {
233
258
  value
234
259
  } = this.props;
235
260
 
236
- if (Array.isArray(value) && !value[0] && !value[1]) {
237
- return false;
238
- } // fix flow by passing a specific arg type and remove 'Array.isArray(value)'
261
+ if (Array.isArray(value)) {
262
+ const [start, end] = value;
239
263
 
264
+ if (!start && !end) {
265
+ return false;
266
+ }
240
267
 
241
- if (Array.isArray(value) && value.length > 1) {
242
- return this.dateHelpers.isDayInRange(this.clampToDayStart(date), this.clampToDayStart(value[0]), this.clampToDayStart(value[1]));
268
+ if (start && end) {
269
+ return this.dateHelpers.isDayInRange(this.clampToDayStart(date), this.clampToDayStart(start), this.clampToDayStart(end));
270
+ }
243
271
  }
244
272
  } // calculated for range case only
245
273
 
@@ -251,16 +279,27 @@ export default class Day extends React.Component {
251
279
  highlightedDate
252
280
  } = this.props;
253
281
 
254
- if (Array.isArray(value) && !value[0] && !value[1]) {
255
- return false;
256
- } // fix flow by passing a specific arg type and remove 'Array.isArray(value)'
282
+ if (Array.isArray(value)) {
283
+ const [start, end] = value;
257
284
 
285
+ if (!start && !end) {
286
+ return false;
287
+ }
258
288
 
259
- if (Array.isArray(value) && highlightedDate && value[0] && !value[1]) {
260
- if (this.dateHelpers.isAfter(highlightedDate, value[0])) {
261
- return this.dateHelpers.isDayInRange(this.clampToDayStart(date), this.clampToDayStart(value[0]), this.clampToDayStart(highlightedDate));
262
- } else {
263
- return this.dateHelpers.isDayInRange(this.clampToDayStart(date), this.clampToDayStart(highlightedDate), this.clampToDayStart(value[0]));
289
+ if (highlightedDate && start && !end) {
290
+ if (this.dateHelpers.isAfter(highlightedDate, start)) {
291
+ return this.dateHelpers.isDayInRange(this.clampToDayStart(date), this.clampToDayStart(start), this.clampToDayStart(highlightedDate));
292
+ } else {
293
+ return this.dateHelpers.isDayInRange(this.clampToDayStart(date), this.clampToDayStart(highlightedDate), this.clampToDayStart(start));
294
+ }
295
+ }
296
+
297
+ if (highlightedDate && !start && end) {
298
+ if (this.dateHelpers.isAfter(highlightedDate, end)) {
299
+ return this.dateHelpers.isDayInRange(this.clampToDayStart(date), this.clampToDayStart(end), this.clampToDayStart(highlightedDate));
300
+ } else {
301
+ return this.dateHelpers.isDayInRange(this.clampToDayStart(date), this.clampToDayStart(highlightedDate), this.clampToDayStart(end));
302
+ }
264
303
  }
265
304
  }
266
305
  }
@@ -271,22 +310,23 @@ export default class Day extends React.Component {
271
310
  value,
272
311
  highlightedDate,
273
312
  range,
274
- highlighted
313
+ highlighted,
314
+ peekNextMonth
275
315
  } = this.props;
276
316
  const $isHighlighted = highlighted;
277
317
  const $selected = this.isSelected();
278
- const $hasRangeHighlighted = !!(Array.isArray(value) && range && value.length === 1 && highlightedDate && !this.dateHelpers.isSameDay(value[0], highlightedDate));
279
- const $outsideMonth = !this.props.peekNextMonth && this.isOutsideMonth();
280
- const $outsideMonthWithinRange = !!(Array.isArray(value) && range && $outsideMonth && !this.props.peekNextMonth && this.isOutsideOfMonthButWithinRange());
318
+ const $hasRangeHighlighted = !!(Array.isArray(value) && range && highlightedDate && (value[0] && !value[1] && !this.dateHelpers.isSameDay(value[0], highlightedDate) || !value[0] && value[1] && !this.dateHelpers.isSameDay(value[1], highlightedDate)));
319
+ const $outsideMonth = !peekNextMonth && this.isOutsideMonth();
320
+ const $outsideMonthWithinRange = !!(Array.isArray(value) && range && $outsideMonth && !peekNextMonth && this.isOutsideOfMonthButWithinRange());
281
321
  return {
282
322
  $date: date,
283
323
  $density: this.props.density,
284
324
  $disabled: this.props.disabled,
285
- $endDate: Array.isArray(value) && this.props.range && $selected && this.dateHelpers.isSameDay(date, value[1]) || false,
325
+ $endDate: Array.isArray(value) && !!(value[0] && value[1]) && range && $selected && this.dateHelpers.isSameDay(date, value[1]) || false,
286
326
  $hasDateLabel: !!this.props.dateLabel,
287
327
  $hasRangeHighlighted,
288
- $hasRangeOnRight: Array.isArray(value) && $hasRangeHighlighted && highlightedDate && value[0] && this.dateHelpers.isAfter(highlightedDate, value[0]),
289
- $hasRangeSelected: Array.isArray(value) ? value.length === 2 : false,
328
+ $hasRangeOnRight: Array.isArray(value) && $hasRangeHighlighted && highlightedDate && (value[0] && this.dateHelpers.isAfter(highlightedDate, value[0]) || value[1] && this.dateHelpers.isAfter(highlightedDate, value[1])),
329
+ $hasRangeSelected: Array.isArray(value) ? !!(value[0] && value[1]) : false,
290
330
  $highlightedDate: highlightedDate,
291
331
  $isHighlighted,
292
332
  $isHovered: this.state.isHovered,
@@ -296,12 +336,15 @@ export default class Day extends React.Component {
296
336
  $month: this.getMonthProp(),
297
337
  $outsideMonth,
298
338
  $outsideMonthWithinRange,
299
- $peekNextMonth: this.props.peekNextMonth,
300
- $pseudoHighlighted: this.props.range && !$isHighlighted && !$selected ? this.isPseudoHighlighted() : false,
301
- $pseudoSelected: this.props.range && !$selected ? this.isPseudoSelected() : false,
302
- $range: this.props.range,
339
+ $peekNextMonth: peekNextMonth,
340
+ $pseudoHighlighted: range && !$isHighlighted && !$selected ? this.isPseudoHighlighted() : false,
341
+ $pseudoSelected: range && !$selected ? this.isPseudoSelected() : false,
342
+ $range: range,
303
343
  $selected,
304
- $startDate: Array.isArray(this.props.value) && this.props.value.length > 1 && this.props.range && $selected ? this.dateHelpers.isSameDay(date, this.props.value[0]) : false
344
+ $startDate: Array.isArray(value) && value[0] && value[1] && range && $selected ? this.dateHelpers.isSameDay(date, value[0]) : false,
345
+ $hasLockedBehavior: this.props.hasLockedBehavior,
346
+ $selectedInput: this.props.selectedInput,
347
+ $value: this.props.value
305
348
  };
306
349
  }
307
350
 
@@ -82,7 +82,9 @@ export default class CalendarMonth extends React.Component {
82
82
  onChange: this.props.onChange,
83
83
  overrides: this.props.overrides,
84
84
  peekNextMonth: this.props.peekNextMonth,
85
- value: this.props.value
85
+ value: this.props.value,
86
+ hasLockedBehavior: this.props.hasLockedBehavior,
87
+ selectedInput: this.props.selectedInput
86
88
  }));
87
89
  i++;
88
90
  currentWeekStart = this.dateHelpers.addWeeks(currentWeekStart, 1); // It will break on the next week if the week is out of the month
@@ -1,3 +1,5 @@
1
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+
1
3
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
4
 
3
5
  /*
@@ -12,7 +14,10 @@ import Calendar from './calendar.js';
12
14
 
13
15
  class StatefulComponent extends React.Component {
14
16
  render() {
15
- return /*#__PURE__*/React.createElement(StatefulContainer, this.props, extendedProps => /*#__PURE__*/React.createElement(Calendar, extendedProps));
17
+ return /*#__PURE__*/React.createElement(StatefulContainer, this.props, extendedProps => /*#__PURE__*/React.createElement(Calendar, _extends({}, extendedProps, {
18
+ // flowlint-next-line unclear-type:off
19
+ onChange: extendedProps.onChange
20
+ })));
16
21
  }
17
22
 
18
23
  }
@@ -20,9 +20,29 @@ class StatefulContainer extends React.Component {
20
20
  this.internalSetState(STATE_CHANGE_TYPE.change, {
21
21
  value: date
22
22
  });
23
+ const onChange = this.props.onChange;
23
24
 
24
- if (typeof this.props.onChange === 'function') {
25
- this.props.onChange(data);
25
+ if (onChange) {
26
+ if (Array.isArray(date)) {
27
+ if (date.every(Boolean)) {
28
+ // flowlint-next-line unclear-type:off
29
+ onChange({
30
+ date: date
31
+ });
32
+ }
33
+ } else {
34
+ onChange({
35
+ date
36
+ });
37
+ }
38
+ }
39
+
40
+ const onRangeChange = this.props.onRangeChange;
41
+
42
+ if (onRangeChange) {
43
+ onRangeChange({
44
+ date
45
+ });
26
46
  }
27
47
  });
28
48
 
@@ -1,3 +1,5 @@
1
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+
1
3
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
4
 
3
5
  /*
@@ -12,7 +14,10 @@ import Datepicker from './datepicker.js';
12
14
 
13
15
  class StatefulComponent extends React.Component {
14
16
  render() {
15
- return /*#__PURE__*/React.createElement(StatefulContainer, this.props, extendedProps => /*#__PURE__*/React.createElement(Datepicker, extendedProps));
17
+ return /*#__PURE__*/React.createElement(StatefulContainer, this.props, extendedProps => /*#__PURE__*/React.createElement(Datepicker, _extends({}, extendedProps, {
18
+ // flowlint-next-line unclear-type:off
19
+ onChange: extendedProps.onChange
20
+ })));
16
21
  }
17
22
 
18
23
  }