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
@@ -134,7 +134,7 @@ export default class Calendar<T = Date> extends React.Component<
134
134
  return monthDelta >= 0 && monthDelta < (this.props.monthsShown || 1);
135
135
  }
136
136
 
137
- getSingleDate(value: ?T | Array<T>): ?T {
137
+ getSingleDate(value: ?T | $ReadOnlyArray<?T>): ?T {
138
138
  // need to check this.props.range but flow would complain
139
139
  // at the return value in the else clause
140
140
  if (Array.isArray(value)) {
@@ -337,23 +337,38 @@ export default class Calendar<T = Date> extends React.Component<
337
337
  this.props.onDayMouseLeave && this.props.onDayMouseLeave(data);
338
338
  };
339
339
 
340
- handleDateChange: ({ date: ?T | Array<T> }) => void = (data) => {
340
+ /** Responsible for merging time values into date values. Note: the 'Day' component
341
+ * determines how the days themselves change when a new day is selected. */
342
+ handleDateChange: ({ +date: ?T | Array<?T> }) => void = (data) => {
341
343
  const { onChange = (params) => {} } = this.props;
342
344
  let updatedDate = data.date;
343
- // We'll need to update the date in time values of internal state
344
- const newTimeState = [...this.state.time];
345
345
  // Apply the currently selected time values (saved in state) to the updated date
346
346
  if (Array.isArray(data.date)) {
347
- updatedDate = data.date.map((date, index) => {
348
- newTimeState[index] = this.dateHelpers.applyDateToTime(newTimeState[index], date);
349
- return newTimeState[index];
350
- });
347
+ // We'll need to update the date in time values of internal state
348
+ const newTimeState = [...this.state.time];
349
+ const start = data.date[0]
350
+ ? this.dateHelpers.applyDateToTime(newTimeState[0], data.date[0])
351
+ : null;
352
+ const end = data.date[1]
353
+ ? this.dateHelpers.applyDateToTime(newTimeState[1], data.date[1])
354
+ : null;
355
+ newTimeState[0] = start;
356
+ if (end) {
357
+ updatedDate = [start, end];
358
+ newTimeState[1] = end;
359
+ } else {
360
+ updatedDate = [start];
361
+ }
362
+ // Update the date in time values of internal state
363
+ this.setState({ time: newTimeState });
351
364
  } else if (!Array.isArray(this.props.value) && data.date) {
352
- newTimeState[0] = this.dateHelpers.applyDateToTime(newTimeState[0], data.date);
353
- updatedDate = newTimeState[0];
365
+ const newTimeState = this.dateHelpers.applyDateToTime(this.state.time[0], data.date);
366
+ updatedDate = newTimeState;
367
+
368
+ // Update the date in time values of internal state
369
+ this.setState({ time: [newTimeState] });
354
370
  }
355
- // Update the date in time values of internal state
356
- this.setState({ time: newTimeState });
371
+
357
372
  onChange({ date: updatedDate });
358
373
  };
359
374
 
@@ -367,12 +382,12 @@ export default class Calendar<T = Date> extends React.Component<
367
382
  // with the date value set to the date with updated time
368
383
  if (Array.isArray(this.props.value)) {
369
384
  const dates = this.props.value.map((date, i) => {
370
- if (index === i) {
385
+ if (date && index === i) {
371
386
  return this.dateHelpers.applyTimeToDate(date, time);
372
387
  }
373
388
  return date;
374
389
  });
375
- onChange({ date: dates });
390
+ onChange({ date: [dates[0], dates[1]] });
376
391
  } else {
377
392
  const date = this.dateHelpers.applyTimeToDate(this.props.value, time);
378
393
  onChange({ date });
@@ -452,6 +467,8 @@ export default class Calendar<T = Date> extends React.Component<
452
467
  value={this.props.value}
453
468
  peekNextMonth={this.props.peekNextMonth}
454
469
  fixedHeight={this.props.fixedHeight}
470
+ hasLockedBehavior={!!this.props.hasLockedBehavior}
471
+ selectedInput={this.props.selectedInput}
455
472
  />
456
473
  </CalendarContainer>
457
474
  );
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.DENSITY = exports.DEFAULT_MONTHS = exports.WEEKDAYS = exports.STATE_CHANGE_TYPE = exports.ORIENTATION = exports.ISO_MONTH_FORMAT = exports.ISO_FORMAT = exports.DISPLAY_FORMAT = void 0;
6
+ exports.RANGED_CALENDAR_BEHAVIOR = exports.INPUT_ROLE = exports.DENSITY = exports.DEFAULT_MONTHS = exports.WEEKDAYS = exports.STATE_CHANGE_TYPE = exports.ORIENTATION = exports.ISO_MONTH_FORMAT = exports.ISO_FORMAT = exports.DISPLAY_FORMAT = void 0;
7
7
 
8
8
  /*
9
9
  Copyright (c) Uber Technologies, Inc.
@@ -40,4 +40,14 @@ var DENSITY = {
40
40
  high: 'high',
41
41
  default: 'default'
42
42
  };
43
- exports.DENSITY = DENSITY;
43
+ exports.DENSITY = DENSITY;
44
+ var INPUT_ROLE = {
45
+ startDate: 'startDate',
46
+ endDate: 'endDate'
47
+ };
48
+ exports.INPUT_ROLE = INPUT_ROLE;
49
+ var RANGED_CALENDAR_BEHAVIOR = {
50
+ default: 'default',
51
+ locked: 'locked'
52
+ };
53
+ exports.RANGED_CALENDAR_BEHAVIOR = RANGED_CALENDAR_BEHAVIOR;
@@ -33,6 +33,16 @@ export const DENSITY = {
33
33
  default: 'default',
34
34
  };
35
35
 
36
+ export const INPUT_ROLE = {
37
+ startDate: 'startDate',
38
+ endDate: 'endDate',
39
+ };
40
+
41
+ export const RANGED_CALENDAR_BEHAVIOR = {
42
+ default: 'default',
43
+ locked: 'locked',
44
+ };
45
+
36
46
  declare var __DEV__: boolean;
37
47
  declare var __NODE__: boolean;
38
48
  declare var __BROWSER__: boolean;
@@ -27,6 +27,8 @@ var _dateHelpers = _interopRequireDefault(require("./utils/date-helpers.js"));
27
27
 
28
28
  var _dateFnsAdapter = _interopRequireDefault(require("./utils/date-fns-adapter.js"));
29
29
 
30
+ var _constants = require("./constants.js");
31
+
30
32
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
31
33
 
32
34
  function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
@@ -35,6 +37,10 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
35
37
 
36
38
  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); }
37
39
 
40
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
41
+
42
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
43
+
38
44
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
39
45
 
40
46
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -43,10 +49,6 @@ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.it
43
49
 
44
50
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
45
51
 
46
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
47
-
48
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
49
-
50
52
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
51
53
 
52
54
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
@@ -83,26 +85,26 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
83
85
 
84
86
  var DEFAULT_DATE_FORMAT = 'yyyy/MM/dd';
85
87
  exports.DEFAULT_DATE_FORMAT = DEFAULT_DATE_FORMAT;
86
- var INPUT_DELIMITER = ' ';
88
+ var INPUT_DELIMITER = '–';
87
89
 
88
90
  var combineSeparatedInputs = function combineSeparatedInputs(newInputValue) {
89
91
  var prevCombinedInputValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
90
- var separatedInput = arguments.length > 2 ? arguments[2] : undefined;
92
+ var inputRole = arguments.length > 2 ? arguments[2] : undefined;
91
93
  var inputValue = newInputValue;
92
94
 
93
- var _prevCombinedInputVal = prevCombinedInputValue.split(INPUT_DELIMITER),
95
+ var _prevCombinedInputVal = prevCombinedInputValue.split(" ".concat(INPUT_DELIMITER, " ")),
94
96
  _prevCombinedInputVal2 = _slicedToArray(_prevCombinedInputVal, 2),
95
97
  _prevCombinedInputVal3 = _prevCombinedInputVal2[0],
96
98
  prevStartDate = _prevCombinedInputVal3 === void 0 ? '' : _prevCombinedInputVal3,
97
99
  _prevCombinedInputVal4 = _prevCombinedInputVal2[1],
98
100
  prevEndDate = _prevCombinedInputVal4 === void 0 ? '' : _prevCombinedInputVal4;
99
101
 
100
- if (separatedInput === 'startDate' && prevEndDate) {
101
- inputValue = "".concat(inputValue, " \u2013 ").concat(prevEndDate);
102
+ if (inputRole === _constants.INPUT_ROLE.startDate && prevEndDate) {
103
+ inputValue = "".concat(inputValue, " ").concat(INPUT_DELIMITER, " ").concat(prevEndDate);
102
104
  }
103
105
 
104
- if (separatedInput === 'endDate') {
105
- inputValue = "".concat(prevStartDate, " \u2013 ").concat(inputValue);
106
+ if (inputRole === _constants.INPUT_ROLE.endDate) {
107
+ inputValue = "".concat(prevStartDate, " ").concat(INPUT_DELIMITER, " ").concat(inputValue);
106
108
  }
107
109
 
108
110
  return inputValue;
@@ -118,31 +120,72 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
118
120
 
119
121
  _classCallCheck(this, Datepicker);
120
122
 
121
- _this = _super.call(this, props); //$FlowFixMe
123
+ _this = _super.call(this, props); //$FlowFixMe[incompatible-call]
122
124
 
123
125
  _defineProperty(_assertThisInitialized(_this), "calendar", void 0);
124
126
 
125
127
  _defineProperty(_assertThisInitialized(_this), "dateHelpers", void 0);
126
128
 
127
- _defineProperty(_assertThisInitialized(_this), "onChange", function (data) {
129
+ _defineProperty(_assertThisInitialized(_this), "handleChange", function (date) {
130
+ var onChange = _this.props.onChange;
131
+ var onRangeChange = _this.props.onRangeChange;
132
+
133
+ if (Array.isArray(date)) {
134
+ if (onChange && date.every(Boolean)) {
135
+ // flowlint-next-line unclear-type:off
136
+ onChange({
137
+ date: date
138
+ });
139
+ }
140
+
141
+ if (onRangeChange) {
142
+ onRangeChange({
143
+ date: _toConsumableArray(date)
144
+ });
145
+ }
146
+ } else {
147
+ if (onChange) {
148
+ onChange({
149
+ date: date
150
+ });
151
+ }
152
+
153
+ if (onRangeChange) {
154
+ onRangeChange({
155
+ date: date
156
+ });
157
+ }
158
+ }
159
+ });
160
+
161
+ _defineProperty(_assertThisInitialized(_this), "onCalendarSelect", function (data) {
128
162
  var isOpen = false;
129
163
  var isPseudoFocused = false;
130
164
  var calendarFocused = false;
131
165
  var nextDate = data.date;
132
166
 
133
167
  if (Array.isArray(nextDate) && _this.props.range) {
134
- if (nextDate.length < 2) {
168
+ if (!nextDate[0] || !nextDate[1]) {
135
169
  isOpen = true;
136
170
  isPseudoFocused = true;
137
171
  calendarFocused = null;
138
- } else if (nextDate.length === 2) {
172
+ } else if (nextDate[0] && nextDate[1]) {
139
173
  var _nextDate = nextDate,
140
174
  _nextDate2 = _slicedToArray(_nextDate, 2),
141
175
  start = _nextDate2[0],
142
176
  end = _nextDate2[1];
143
177
 
144
178
  if (_this.dateHelpers.isAfter(start, end)) {
145
- nextDate = [start, start];
179
+ if (_this.hasLockedBehavior()) {
180
+ nextDate = _this.props.value;
181
+ isOpen = true;
182
+ } else {
183
+ nextDate = [start, start];
184
+ }
185
+ } 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]
186
+ nextDate, _this.props.excludeDates)) {
187
+ nextDate = _this.props.value;
188
+ isOpen = true;
146
189
  }
147
190
 
148
191
  if (_this.state.lastActiveElm) {
@@ -192,9 +235,7 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
192
235
  inputValue: _this.formatDisplayValue(nextDate)
193
236
  }));
194
237
 
195
- _this.props.onChange && _this.props.onChange({
196
- date: nextDate
197
- });
238
+ _this.handleChange(nextDate);
198
239
  });
199
240
 
200
241
  _defineProperty(_assertThisInitialized(_this), "formatDisplayValue", function (date) {
@@ -234,11 +275,12 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
234
275
  return _this.formatDate(date, formatString);
235
276
  });
236
277
 
237
- _defineProperty(_assertThisInitialized(_this), "open", function () {
278
+ _defineProperty(_assertThisInitialized(_this), "open", function (inputRole) {
238
279
  _this.setState({
239
280
  isOpen: true,
240
281
  isPseudoFocused: true,
241
- calendarFocused: false
282
+ calendarFocused: false,
283
+ selectedInput: inputRole
242
284
  }, _this.props.onOpen);
243
285
  });
244
286
 
@@ -247,6 +289,7 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
247
289
 
248
290
  _this.setState({
249
291
  isOpen: false,
292
+ selectedInput: null,
250
293
  isPseudoFocused: isPseudoFocused,
251
294
  calendarFocused: false
252
295
  }, _this.props.onClose);
@@ -282,30 +325,24 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
282
325
  }
283
326
 
284
327
  if (range && !separateRangeInputs) {
285
- return '9999/99/99 9999/99/99';
328
+ return "9999/99/99 ".concat(INPUT_DELIMITER, " 9999/99/99");
286
329
  }
287
330
 
288
331
  return '9999/99/99';
289
332
  });
290
333
 
291
- _defineProperty(_assertThisInitialized(_this), "handleInputChange", function (event, separatedInput) {
292
- var inputValue = _this.props.range && _this.props.separateRangeInputs ? combineSeparatedInputs(event.currentTarget.value, _this.state.inputValue, separatedInput) : event.currentTarget.value;
334
+ _defineProperty(_assertThisInitialized(_this), "handleInputChange", function (event, inputRole) {
335
+ var inputValue = _this.props.range && _this.props.separateRangeInputs ? combineSeparatedInputs(event.currentTarget.value, _this.state.inputValue, inputRole) : event.currentTarget.value;
293
336
 
294
337
  var mask = _this.getMask();
295
338
 
296
339
  var formatString = _this.normalizeDashes(_this.props.formatString);
297
340
 
298
341
  if (typeof mask === 'string' && inputValue === mask.replace(/9/g, ' ') || inputValue.length === 0) {
299
- if (_this.props.onChange) {
300
- if (_this.props.range) {
301
- _this.props.onChange({
302
- date: []
303
- });
304
- } else {
305
- _this.props.onChange({
306
- date: null
307
- });
308
- }
342
+ if (_this.props.range) {
343
+ _this.handleChange([]);
344
+ } else {
345
+ _this.handleChange(null);
309
346
  }
310
347
  }
311
348
 
@@ -322,7 +359,7 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
322
359
  };
323
360
 
324
361
  if (_this.props.range && typeof _this.props.displayValueAtRangeIndex !== 'number') {
325
- var _this$normalizeDashes = _this.normalizeDashes(inputValue).split(INPUT_DELIMITER),
362
+ var _this$normalizeDashes = _this.normalizeDashes(inputValue).split(" ".concat(INPUT_DELIMITER, " ")),
326
363
  _this$normalizeDashes2 = _slicedToArray(_this$normalizeDashes, 2),
327
364
  left = _this$normalizeDashes2[0],
328
365
  right = _this$normalizeDashes2[1];
@@ -336,19 +373,13 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
336
373
  endDate = parseDateString(right);
337
374
  }
338
375
 
339
- var onChange = _this.props.onChange;
340
-
341
- if (onChange) {
342
- var datesValid = _this.dateHelpers.isValid(startDate) && _this.dateHelpers.isValid(endDate); // added equal case so that times within the same day can be expressed
376
+ var datesValid = _this.dateHelpers.isValid(startDate) && _this.dateHelpers.isValid(endDate); // added equal case so that times within the same day can be expressed
343
377
 
344
378
 
345
- var rangeValid = _this.dateHelpers.isAfter(endDate, startDate) || _this.dateHelpers.isEqual(startDate, endDate);
379
+ var rangeValid = _this.dateHelpers.isAfter(endDate, startDate) || _this.dateHelpers.isEqual(startDate, endDate);
346
380
 
347
- if (datesValid && rangeValid) {
348
- onChange({
349
- date: [startDate, endDate]
350
- });
351
- }
381
+ if (datesValid && rangeValid) {
382
+ _this.handleChange([startDate, endDate]);
352
383
  }
353
384
  } else {
354
385
  var dateString = _this.normalizeDashes(inputValue);
@@ -366,11 +397,10 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
366
397
 
367
398
  var _this$props3 = _this.props,
368
399
  displayValueAtRangeIndex = _this$props3.displayValueAtRangeIndex,
369
- _onChange = _this$props3.onChange,
370
400
  range = _this$props3.range,
371
401
  value = _this$props3.value;
372
402
 
373
- if (date && _this.dateHelpers.isValid(date) && _onChange) {
403
+ if (date && _this.dateHelpers.isValid(date)) {
374
404
  if (range && Array.isArray(value) && typeof displayValueAtRangeIndex === 'number') {
375
405
  var _value = _slicedToArray(value, 2),
376
406
  _left = _value[0],
@@ -380,22 +410,16 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
380
410
  _left = date;
381
411
 
382
412
  if (!_right) {
383
- _onChange({
384
- date: [_left]
385
- });
413
+ _this.handleChange([_left]);
386
414
  } else {
387
415
  if (_this.dateHelpers.isAfter(_right, _left) || _this.dateHelpers.isEqual(_left, _right)) {
388
- _onChange({
389
- date: [_left, _right]
390
- });
416
+ _this.handleChange([_left, _right]);
391
417
  } else {
392
418
  // Is resetting back to previous value appropriate? Invalid range is not
393
419
  // communicated to the user, but if it was not reset the text value would
394
420
  // show one value and date value another. This seems a bit better but clearly
395
421
  // has a downside.
396
- _onChange({
397
- date: _toConsumableArray(value)
398
- });
422
+ _this.handleChange(_toConsumableArray(value));
399
423
  }
400
424
  }
401
425
  } else if (displayValueAtRangeIndex === 1) {
@@ -403,26 +427,18 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
403
427
 
404
428
  if (!_left) {
405
429
  // If start value is not defined, set start/end to the same day.
406
- _onChange({
407
- date: [_right, _right]
408
- });
430
+ _this.handleChange([_right, _right]);
409
431
  } else {
410
432
  if (_this.dateHelpers.isAfter(_right, _left) || _this.dateHelpers.isEqual(_left, _right)) {
411
- _onChange({
412
- date: [_left, _right]
413
- });
433
+ _this.handleChange([_left, _right]);
414
434
  } else {
415
435
  // See comment above about resetting dates on invalid range
416
- _onChange({
417
- date: _toConsumableArray(value)
418
- });
436
+ _this.handleChange(_toConsumableArray(value));
419
437
  }
420
438
  }
421
439
  }
422
440
  } else {
423
- _onChange({
424
- date: date
425
- });
441
+ _this.handleChange(date);
426
442
  }
427
443
  }
428
444
  }
@@ -454,13 +470,18 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
454
470
 
455
471
  _defineProperty(_assertThisInitialized(_this), "normalizeDashes", function (inputValue) {
456
472
  // replacing both hyphens and em-dashes with en-dashes
457
- return inputValue.replace(/-/g, '–').replace(/—/g, '–');
473
+ return inputValue.replace(/-/g, INPUT_DELIMITER).replace(/—/g, INPUT_DELIMITER);
474
+ });
475
+
476
+ _defineProperty(_assertThisInitialized(_this), "hasLockedBehavior", function () {
477
+ return _this.props.rangedCalendarBehavior === _constants.RANGED_CALENDAR_BEHAVIOR.locked && _this.props.range && _this.props.separateRangeInputs;
458
478
  });
459
479
 
460
480
  _this.dateHelpers = new _dateHelpers.default(props.adapter);
461
481
  _this.state = {
462
482
  calendarFocused: false,
463
483
  isOpen: false,
484
+ selectedInput: null,
464
485
  isPseudoFocused: false,
465
486
  lastActiveElm: null,
466
487
  inputValue: _this.formatDisplayValue(props.value) || ''
@@ -469,6 +490,11 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
469
490
  }
470
491
 
471
492
  _createClass(Datepicker, [{
493
+ key: "getNullDatePlaceholder",
494
+ value: function getNullDatePlaceholder(formatString) {
495
+ return (this.getMask() || formatString).split(INPUT_DELIMITER)[0].replace(/[0-9]|[a-z]/g, ' ');
496
+ }
497
+ }, {
472
498
  key: "formatDate",
473
499
  value: function formatDate(date, formatString) {
474
500
  var _this2 = this;
@@ -485,10 +511,14 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
485
511
  return '';
486
512
  } else if (Array.isArray(date) && !date[0] && !date[1]) {
487
513
  return '';
514
+ } else if (Array.isArray(date) && !date[0] && date[1]) {
515
+ var endDate = format(date[1]);
516
+ var startDate = this.getNullDatePlaceholder(formatString);
517
+ return [startDate, endDate].join(" ".concat(INPUT_DELIMITER, " "));
488
518
  } else if (Array.isArray(date)) {
489
519
  return date.map(function (day) {
490
- return format(day);
491
- }).join(INPUT_DELIMITER);
520
+ return day ? format(day) : '';
521
+ }).join(" ".concat(INPUT_DELIMITER, " "));
492
522
  } else {
493
523
  return format(date);
494
524
  }
@@ -504,7 +534,7 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
504
534
  }
505
535
  }, {
506
536
  key: "renderInputComponent",
507
- value: function renderInputComponent(locale, separatedInput) {
537
+ value: function renderInputComponent(locale, inputRole) {
508
538
  var _this3 = this;
509
539
 
510
540
  var _this$props$overrides = this.props.overrides,
@@ -515,21 +545,16 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
515
545
  InputComponent = _getOverrides2[0],
516
546
  inputProps = _getOverrides2[1];
517
547
 
518
- var 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';
548
+ var placeholder = this.props.placeholder || this.props.placeholder === '' ? this.props.placeholder : this.props.range && !this.props.separateRangeInputs ? "YYYY/MM/DD ".concat(INPUT_DELIMITER, " YYYY/MM/DD") : 'YYYY/MM/DD';
519
549
 
520
- var _split = (this.state.inputValue || '').split(INPUT_DELIMITER),
550
+ var _split = (this.state.inputValue || '').split(" ".concat(INPUT_DELIMITER, " ")),
521
551
  _split2 = _slicedToArray(_split, 2),
522
552
  _split2$ = _split2[0],
523
553
  startDate = _split2$ === void 0 ? '' : _split2$,
524
554
  _split2$2 = _split2[1],
525
555
  endDate = _split2$2 === void 0 ? '' : _split2$2;
526
556
 
527
- var value = separatedInput === 'startDate' ? startDate : separatedInput === 'endDate' ? endDate : this.state.inputValue;
528
-
529
- var onChange = function onChange(event) {
530
- return _this3.handleInputChange(event, separatedInput);
531
- };
532
-
557
+ var value = inputRole === _constants.INPUT_ROLE.startDate ? startDate : inputRole === _constants.INPUT_ROLE.endDate ? endDate : this.state.inputValue;
533
558
  return /*#__PURE__*/React.createElement(InputComponent, _extends({
534
559
  "aria-disabled": this.props.disabled,
535
560
  "aria-label": this.props['aria-label'] || (this.props.range ? locale.datepicker.ariaLabelRange : locale.datepicker.ariaLabel),
@@ -541,10 +566,14 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
541
566
  disabled: this.props.disabled,
542
567
  size: this.props.size,
543
568
  value: value,
544
- onFocus: this.open,
569
+ onFocus: function onFocus() {
570
+ return _this3.open(inputRole);
571
+ },
545
572
  onBlur: this.handleInputBlur,
546
573
  onKeyDown: this.handleKeyDown,
547
- onChange: onChange,
574
+ onChange: function onChange(event) {
575
+ return _this3.handleInputChange(event, inputRole);
576
+ },
548
577
  placeholder: placeholder,
549
578
  mask: this.getMask(),
550
579
  required: this.props.required,
@@ -604,11 +633,13 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
604
633
  trapTabbing: true,
605
634
  value: _this4.props.value
606
635
  }, _this4.props, {
607
- onChange: _this4.onChange
636
+ onChange: _this4.onCalendarSelect,
637
+ selectedInput: _this4.state.selectedInput,
638
+ hasLockedBehavior: _this4.hasLockedBehavior()
608
639
  }))
609
640
  }, popoverProps), /*#__PURE__*/React.createElement(InputWrapper, _extends({}, inputWrapperProps, {
610
641
  $separateRangeInputs: _this4.props.range && _this4.props.separateRangeInputs
611
- }), _this4.props.range && _this4.props.separateRangeInputs ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(StartDate, startDateProps, /*#__PURE__*/React.createElement(InputLabel, inputLabelProps, startDateLabel), _this4.renderInputComponent(locale, 'startDate')), /*#__PURE__*/React.createElement(EndDate, endDateProps, /*#__PURE__*/React.createElement(InputLabel, inputLabelProps, endDateLabel), _this4.renderInputComponent(locale, 'endDate'))) : /*#__PURE__*/React.createElement(React.Fragment, null, _this4.renderInputComponent(locale)))), /*#__PURE__*/React.createElement("p", {
642
+ }), _this4.props.range && _this4.props.separateRangeInputs ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(StartDate, startDateProps, /*#__PURE__*/React.createElement(InputLabel, inputLabelProps, startDateLabel), _this4.renderInputComponent(locale, _constants.INPUT_ROLE.startDate)), /*#__PURE__*/React.createElement(EndDate, endDateProps, /*#__PURE__*/React.createElement(InputLabel, inputLabelProps, endDateLabel), _this4.renderInputComponent(locale, _constants.INPUT_ROLE.endDate))) : /*#__PURE__*/React.createElement(React.Fragment, null, _this4.renderInputComponent(locale)))), /*#__PURE__*/React.createElement("p", {
612
643
  id: _this4.props['aria-describedby'],
613
644
  style: {
614
645
  position: 'fixed',
@@ -639,11 +670,11 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
639
670
  clipPath: 'inset(100%)'
640
671
  }
641
672
  }, // No date selected
642
- !_this4.props.value || Array.isArray(_this4.props.value) && !_this4.props.value.length ? '' : // Date selected in a non-range picker
673
+ !_this4.props.value || Array.isArray(_this4.props.value) && !_this4.props.value[0] && !_this4.props.value[1] ? '' : // Date selected in a non-range picker
643
674
  !Array.isArray(_this4.props.value) ? (0, _i18nInterpolation.default)(locale.datepicker.selectedDate, {
644
675
  date: _this4.state.inputValue || ''
645
676
  }) : // Start and end dates are selected in a range picker
646
- _this4.props.value.length > 1 ? (0, _i18nInterpolation.default)(locale.datepicker.selectedDateRange, {
677
+ _this4.props.value[0] && _this4.props.value[1] ? (0, _i18nInterpolation.default)(locale.datepicker.selectedDateRange, {
647
678
  startDate: _this4.formatDisplayValue(_this4.props.value[0]),
648
679
  endDate: _this4.formatDisplayValue( // $FlowFixMe
649
680
  _this4.props.value[1])