baseui 10.12.0 → 11.0.1

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 (291) 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 +15 -7
  40. package/datepicker/calendar.js.flow +23 -9
  41. package/datepicker/constants.js +12 -2
  42. package/datepicker/constants.js.flow +10 -0
  43. package/datepicker/datepicker.js +61 -30
  44. package/datepicker/datepicker.js.flow +77 -37
  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-container.js.flow +2 -1
  51. package/datepicker/styled-components.js +23 -1
  52. package/datepicker/styled-components.js.flow +12 -2
  53. package/datepicker/types.js.flow +35 -10
  54. package/datepicker/utils/date-helpers.js +30 -0
  55. package/datepicker/utils/date-helpers.js.flow +12 -0
  56. package/datepicker/week.js +3 -1
  57. package/datepicker/week.js.flow +2 -0
  58. package/es/accordion/accordion.js +52 -12
  59. package/es/accordion/panel.js +7 -5
  60. package/es/accordion/stateless-accordion.js +2 -4
  61. package/es/button/constants.js +1 -2
  62. package/es/button/styled-components.js +2 -29
  63. package/es/checkbox/checkbox.js +7 -32
  64. package/es/checkbox/constants.js +2 -1
  65. package/es/checkbox/index.js +1 -1
  66. package/es/checkbox/styled-components.js +51 -146
  67. package/es/data-table/column-categorical.js +1 -1
  68. package/es/data-table/column-datetime.js +1 -1
  69. package/es/data-table/column.js +6 -2
  70. package/es/data-table/data-table.js +6 -2
  71. package/es/data-table/header-cell.js +3 -0
  72. package/es/data-table/stateful-data-table.js +2 -1
  73. package/es/datepicker/calendar.js +15 -7
  74. package/es/datepicker/constants.js +8 -0
  75. package/es/datepicker/datepicker.js +56 -29
  76. package/es/datepicker/day.js +77 -34
  77. package/es/datepicker/month.js +3 -1
  78. package/es/datepicker/styled-components.js +8 -2
  79. package/es/datepicker/types.js +1 -1
  80. package/es/datepicker/utils/date-helpers.js +16 -0
  81. package/es/datepicker/week.js +3 -1
  82. package/es/file-uploader/file-uploader.js +4 -4
  83. package/es/form-control/styled-components.js +0 -1
  84. package/es/header-navigation/styled-components.js +3 -3
  85. package/es/helpers/overrides.js +1 -2
  86. package/es/input/styled-components.js +4 -4
  87. package/es/layer/layer.js +4 -4
  88. package/es/list/list-item.js +5 -1
  89. package/es/list/menu-adapter.js +4 -0
  90. package/es/locale/index.js +0 -7
  91. package/es/menu/stateful-container.js +0 -1
  92. package/es/menu/styled-components.js +1 -1
  93. package/es/modal/index.js +1 -1
  94. package/es/modal/modal.js +19 -65
  95. package/es/modal/styled-components.js +12 -48
  96. package/es/phone-input/default-props.js +1 -1
  97. package/es/phone-input/index.js +0 -4
  98. package/es/phone-input/phone-input-lite.js +55 -31
  99. package/es/radio/radio.js +1 -7
  100. package/es/radio/radiogroup.js +3 -28
  101. package/es/radio/styled-components.js +4 -5
  102. package/es/rating/styled-components.js +3 -3
  103. package/es/select/index.js +1 -2
  104. package/es/select/select-component.js +20 -20
  105. package/es/select/styled-components.js +21 -17
  106. package/es/snackbar/styled-components.js +2 -2
  107. package/es/spinner/index.js +3 -9
  108. package/es/spinner/styled-components.js +2 -32
  109. package/es/table/filter.js +3 -3
  110. package/es/tag/styled-components.js +1 -1
  111. package/es/themes/dark-theme/color-component-tokens.js +0 -38
  112. package/es/themes/dark-theme/color-tokens.js +0 -2
  113. package/es/themes/dark-theme/create-dark-theme.js +0 -2
  114. package/es/themes/dark-theme/dark-theme.js +0 -2
  115. package/es/themes/light-theme/color-component-tokens.js +0 -38
  116. package/es/themes/light-theme/color-tokens.js +0 -2
  117. package/es/themes/light-theme/create-light-theme.js +0 -2
  118. package/es/themes/light-theme/light-theme.js +0 -2
  119. package/es/timepicker/timepicker.js +1 -8
  120. package/es/typography/index.js +1 -31
  121. package/esm/accordion/accordion.js +60 -13
  122. package/esm/accordion/panel.js +7 -6
  123. package/esm/accordion/stateless-accordion.js +2 -4
  124. package/esm/button/constants.js +1 -2
  125. package/esm/button/styled-components.js +2 -29
  126. package/esm/checkbox/checkbox.js +7 -30
  127. package/esm/checkbox/constants.js +2 -1
  128. package/esm/checkbox/index.js +1 -1
  129. package/esm/checkbox/styled-components.js +52 -147
  130. package/esm/data-table/column-categorical.js +1 -1
  131. package/esm/data-table/column-datetime.js +1 -1
  132. package/esm/data-table/column.js +6 -2
  133. package/esm/data-table/data-table.js +10 -2
  134. package/esm/data-table/header-cell.js +3 -0
  135. package/esm/data-table/stateful-data-table.js +2 -1
  136. package/esm/datepicker/calendar.js +15 -7
  137. package/esm/datepicker/constants.js +8 -0
  138. package/esm/datepicker/datepicker.js +60 -30
  139. package/esm/datepicker/day.js +84 -34
  140. package/esm/datepicker/month.js +3 -1
  141. package/esm/datepicker/styled-components.js +24 -2
  142. package/esm/datepicker/types.js +1 -1
  143. package/esm/datepicker/utils/date-helpers.js +30 -0
  144. package/esm/datepicker/week.js +3 -1
  145. package/esm/file-uploader/file-uploader.js +4 -4
  146. package/esm/form-control/styled-components.js +0 -1
  147. package/esm/header-navigation/styled-components.js +3 -3
  148. package/esm/helpers/overrides.js +1 -2
  149. package/esm/input/styled-components.js +4 -4
  150. package/esm/layer/layer.js +4 -4
  151. package/esm/list/list-item.js +5 -1
  152. package/esm/list/menu-adapter.js +4 -0
  153. package/esm/locale/index.js +0 -7
  154. package/esm/menu/stateful-container.js +0 -1
  155. package/esm/menu/styled-components.js +1 -1
  156. package/esm/modal/index.js +1 -1
  157. package/esm/modal/modal.js +28 -71
  158. package/esm/modal/styled-components.js +6 -38
  159. package/esm/phone-input/default-props.js +1 -1
  160. package/esm/phone-input/index.js +0 -4
  161. package/esm/phone-input/phone-input-lite.js +60 -37
  162. package/esm/radio/radio.js +1 -7
  163. package/esm/radio/radiogroup.js +3 -28
  164. package/esm/radio/styled-components.js +4 -5
  165. package/esm/rating/styled-components.js +3 -3
  166. package/esm/select/index.js +1 -2
  167. package/esm/select/select-component.js +20 -20
  168. package/esm/select/styled-components.js +21 -14
  169. package/esm/snackbar/styled-components.js +2 -2
  170. package/esm/spinner/index.js +3 -9
  171. package/esm/spinner/styled-components.js +2 -40
  172. package/esm/table/filter.js +3 -3
  173. package/esm/tag/styled-components.js +1 -1
  174. package/esm/themes/dark-theme/color-component-tokens.js +0 -38
  175. package/esm/themes/dark-theme/color-tokens.js +0 -2
  176. package/esm/themes/dark-theme/create-dark-theme.js +1 -2
  177. package/esm/themes/dark-theme/dark-theme.js +1 -2
  178. package/esm/themes/light-theme/color-component-tokens.js +0 -38
  179. package/esm/themes/light-theme/color-tokens.js +0 -2
  180. package/esm/themes/light-theme/create-light-theme.js +1 -2
  181. package/esm/themes/light-theme/light-theme.js +1 -2
  182. package/esm/timepicker/timepicker.js +1 -8
  183. package/esm/typography/index.js +1 -35
  184. package/file-uploader/file-uploader.js +3 -3
  185. package/file-uploader/file-uploader.js.flow +4 -4
  186. package/form-control/index.d.ts +9 -0
  187. package/form-control/styled-components.js +0 -1
  188. package/form-control/styled-components.js.flow +0 -1
  189. package/header-navigation/styled-components.js +3 -3
  190. package/header-navigation/styled-components.js.flow +3 -3
  191. package/helpers/overrides.js +1 -2
  192. package/helpers/overrides.js.flow +1 -1
  193. package/input/index.d.ts +5 -9
  194. package/input/styled-components.js +4 -4
  195. package/input/styled-components.js.flow +4 -4
  196. package/layer/layer.js +4 -4
  197. package/layer/layer.js.flow +4 -3
  198. package/list/list-item.js +5 -1
  199. package/list/list-item.js.flow +4 -0
  200. package/list/menu-adapter.js +4 -0
  201. package/list/menu-adapter.js.flow +4 -0
  202. package/list/types.js.flow +4 -0
  203. package/locale/index.js +0 -7
  204. package/locale/index.js.flow +0 -7
  205. package/locale.ts +0 -1
  206. package/menu/index.d.ts +1 -3
  207. package/menu/stateful-container.js +0 -1
  208. package/menu/stateful-container.js.flow +0 -1
  209. package/menu/styled-components.js +1 -1
  210. package/menu/styled-components.js.flow +1 -1
  211. package/modal/index.d.ts +4 -6
  212. package/modal/index.js +0 -6
  213. package/modal/index.js.flow +0 -1
  214. package/modal/modal.js +27 -70
  215. package/modal/modal.js.flow +17 -83
  216. package/modal/styled-components.js +7 -40
  217. package/modal/styled-components.js.flow +12 -44
  218. package/modal/types.js.flow +1 -10
  219. package/package.json +3 -2
  220. package/phone-input/default-props.js +1 -1
  221. package/phone-input/default-props.js.flow +1 -1
  222. package/phone-input/index.d.ts +0 -1
  223. package/phone-input/index.js +0 -36
  224. package/phone-input/index.js.flow +0 -4
  225. package/phone-input/phone-input-lite.js +63 -38
  226. package/phone-input/phone-input-lite.js.flow +66 -44
  227. package/radio/index.d.ts +4 -9
  228. package/radio/radio.js +1 -7
  229. package/radio/radio.js.flow +1 -8
  230. package/radio/radiogroup.js +3 -28
  231. package/radio/radiogroup.js.flow +2 -26
  232. package/radio/styled-components.js +4 -5
  233. package/radio/styled-components.js.flow +3 -4
  234. package/radio/types.js.flow +4 -15
  235. package/rating/styled-components.js +3 -3
  236. package/rating/styled-components.js.flow +3 -3
  237. package/select/index.d.ts +0 -2
  238. package/select/index.js +0 -6
  239. package/select/index.js.flow +0 -2
  240. package/select/select-component.js +23 -24
  241. package/select/select-component.js.flow +25 -14
  242. package/select/styled-components.js +23 -17
  243. package/select/styled-components.js.flow +17 -12
  244. package/snackbar/styled-components.js +1 -1
  245. package/snackbar/styled-components.js.flow +11 -11
  246. package/spinner/index.d.ts +5 -18
  247. package/spinner/index.js +2 -68
  248. package/spinner/index.js.flow +2 -27
  249. package/spinner/styled-components.js +9 -45
  250. package/spinner/styled-components.js.flow +2 -34
  251. package/spinner/types.js.flow +1 -19
  252. package/styles/types.js.flow +0 -2
  253. package/table/filter.js +3 -3
  254. package/table/filter.js.flow +3 -3
  255. package/tag/styled-components.js +1 -1
  256. package/tag/styled-components.js.flow +1 -1
  257. package/theme.ts +0 -81
  258. package/themes/dark-theme/color-component-tokens.js +0 -38
  259. package/themes/dark-theme/color-component-tokens.js.flow +0 -42
  260. package/themes/dark-theme/color-tokens.js +0 -2
  261. package/themes/dark-theme/color-tokens.js.flow +0 -2
  262. package/themes/dark-theme/create-dark-theme.js +1 -3
  263. package/themes/dark-theme/create-dark-theme.js.flow +0 -2
  264. package/themes/dark-theme/dark-theme.js +1 -3
  265. package/themes/dark-theme/dark-theme.js.flow +0 -2
  266. package/themes/light-theme/color-component-tokens.js +0 -38
  267. package/themes/light-theme/color-component-tokens.js.flow +0 -43
  268. package/themes/light-theme/color-tokens.js +0 -2
  269. package/themes/light-theme/color-tokens.js.flow +0 -2
  270. package/themes/light-theme/create-light-theme.js +1 -3
  271. package/themes/light-theme/create-light-theme.js.flow +0 -2
  272. package/themes/light-theme/light-theme.js +1 -3
  273. package/themes/light-theme/light-theme.js.flow +0 -2
  274. package/themes/types.js.flow +0 -68
  275. package/timepicker/timepicker.js +1 -8
  276. package/timepicker/timepicker.js.flow +4 -10
  277. package/typography/index.d.ts +0 -23
  278. package/typography/index.js +2 -57
  279. package/typography/index.js.flow +0 -31
  280. package/es/spinner/spinner.js +0 -68
  281. package/es/themes/dark-theme/color-deprecated-semantic-tokens.js +0 -35
  282. package/es/themes/light-theme/color-deprecated-semantic-tokens.js +0 -35
  283. package/esm/spinner/spinner.js +0 -125
  284. package/esm/themes/dark-theme/color-deprecated-semantic-tokens.js +0 -38
  285. package/esm/themes/light-theme/color-deprecated-semantic-tokens.js +0 -38
  286. package/spinner/spinner.js +0 -136
  287. package/spinner/spinner.js.flow +0 -75
  288. package/themes/dark-theme/color-deprecated-semantic-tokens.js +0 -50
  289. package/themes/dark-theme/color-deprecated-semantic-tokens.js.flow +0 -42
  290. package/themes/light-theme/color-deprecated-semantic-tokens.js +0 -50
  291. package/themes/light-theme/color-deprecated-semantic-tokens.js.flow +0 -42
@@ -64,27 +64,28 @@ import { LocaleContext } from '../locale/index.js';
64
64
  import { StyledInputWrapper, StyledInputLabel, StyledStartDate, StyledEndDate } from './styled-components.js';
65
65
  import DateHelpers from './utils/date-helpers.js';
66
66
  import dateFnsAdapter from './utils/date-fns-adapter.js';
67
+ import { INPUT_ROLE, RANGED_CALENDAR_BEHAVIOR } from './constants.js';
67
68
  export var DEFAULT_DATE_FORMAT = 'yyyy/MM/dd';
68
- var INPUT_DELIMITER = ' ';
69
+ var INPUT_DELIMITER = '–';
69
70
 
70
71
  var combineSeparatedInputs = function combineSeparatedInputs(newInputValue) {
71
72
  var prevCombinedInputValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
72
- var separatedInput = arguments.length > 2 ? arguments[2] : undefined;
73
+ var inputRole = arguments.length > 2 ? arguments[2] : undefined;
73
74
  var inputValue = newInputValue;
74
75
 
75
- var _prevCombinedInputVal = prevCombinedInputValue.split(INPUT_DELIMITER),
76
+ var _prevCombinedInputVal = prevCombinedInputValue.split(" ".concat(INPUT_DELIMITER, " ")),
76
77
  _prevCombinedInputVal2 = _slicedToArray(_prevCombinedInputVal, 2),
77
78
  _prevCombinedInputVal3 = _prevCombinedInputVal2[0],
78
79
  prevStartDate = _prevCombinedInputVal3 === void 0 ? '' : _prevCombinedInputVal3,
79
80
  _prevCombinedInputVal4 = _prevCombinedInputVal2[1],
80
81
  prevEndDate = _prevCombinedInputVal4 === void 0 ? '' : _prevCombinedInputVal4;
81
82
 
82
- if (separatedInput === 'startDate' && prevEndDate) {
83
- inputValue = "".concat(inputValue, " \u2013 ").concat(prevEndDate);
83
+ if (inputRole === INPUT_ROLE.startDate && prevEndDate) {
84
+ inputValue = "".concat(inputValue, " ").concat(INPUT_DELIMITER, " ").concat(prevEndDate);
84
85
  }
85
86
 
86
- if (separatedInput === 'endDate') {
87
- inputValue = "".concat(prevStartDate, " \u2013 ").concat(inputValue);
87
+ if (inputRole === INPUT_ROLE.endDate) {
88
+ inputValue = "".concat(prevStartDate, " ").concat(INPUT_DELIMITER, " ").concat(inputValue);
88
89
  }
89
90
 
90
91
  return inputValue;
@@ -100,7 +101,7 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
100
101
 
101
102
  _classCallCheck(this, Datepicker);
102
103
 
103
- _this = _super.call(this, props); //$FlowFixMe
104
+ _this = _super.call(this, props); //$FlowFixMe[incompatible-call]
104
105
 
105
106
  _defineProperty(_assertThisInitialized(_this), "calendar", void 0);
106
107
 
@@ -113,18 +114,27 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
113
114
  var nextDate = data.date;
114
115
 
115
116
  if (Array.isArray(nextDate) && _this.props.range) {
116
- if (nextDate.length < 2) {
117
+ if (!nextDate[0] || !nextDate[1]) {
117
118
  isOpen = true;
118
119
  isPseudoFocused = true;
119
120
  calendarFocused = null;
120
- } else if (nextDate.length === 2) {
121
+ } else if (nextDate[0] && nextDate[1]) {
121
122
  var _nextDate = nextDate,
122
123
  _nextDate2 = _slicedToArray(_nextDate, 2),
123
124
  start = _nextDate2[0],
124
125
  end = _nextDate2[1];
125
126
 
126
127
  if (_this.dateHelpers.isAfter(start, end)) {
127
- nextDate = [start, start];
128
+ if (_this.hasLockedBehavior()) {
129
+ nextDate = _this.props.value;
130
+ isOpen = true;
131
+ } else {
132
+ nextDate = [start, start];
133
+ }
134
+ } 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]
135
+ nextDate, _this.props.excludeDates)) {
136
+ nextDate = _this.props.value;
137
+ isOpen = true;
128
138
  }
129
139
 
130
140
  if (_this.state.lastActiveElm) {
@@ -216,11 +226,12 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
216
226
  return _this.formatDate(date, formatString);
217
227
  });
218
228
 
219
- _defineProperty(_assertThisInitialized(_this), "open", function () {
229
+ _defineProperty(_assertThisInitialized(_this), "open", function (inputRole) {
220
230
  _this.setState({
221
231
  isOpen: true,
222
232
  isPseudoFocused: true,
223
- calendarFocused: false
233
+ calendarFocused: false,
234
+ selectedInput: inputRole
224
235
  }, _this.props.onOpen);
225
236
  });
226
237
 
@@ -229,6 +240,7 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
229
240
 
230
241
  _this.setState({
231
242
  isOpen: false,
243
+ selectedInput: null,
232
244
  isPseudoFocused: isPseudoFocused,
233
245
  calendarFocused: false
234
246
  }, _this.props.onClose);
@@ -264,14 +276,14 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
264
276
  }
265
277
 
266
278
  if (range && !separateRangeInputs) {
267
- return '9999/99/99 9999/99/99';
279
+ return "9999/99/99 ".concat(INPUT_DELIMITER, " 9999/99/99");
268
280
  }
269
281
 
270
282
  return '9999/99/99';
271
283
  });
272
284
 
273
- _defineProperty(_assertThisInitialized(_this), "handleInputChange", function (event, separatedInput) {
274
- var inputValue = _this.props.range && _this.props.separateRangeInputs ? combineSeparatedInputs(event.currentTarget.value, _this.state.inputValue, separatedInput) : event.currentTarget.value;
285
+ _defineProperty(_assertThisInitialized(_this), "handleInputChange", function (event, inputRole) {
286
+ var inputValue = _this.props.range && _this.props.separateRangeInputs ? combineSeparatedInputs(event.currentTarget.value, _this.state.inputValue, inputRole) : event.currentTarget.value;
275
287
 
276
288
  var mask = _this.getMask();
277
289
 
@@ -304,7 +316,7 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
304
316
  };
305
317
 
306
318
  if (_this.props.range && typeof _this.props.displayValueAtRangeIndex !== 'number') {
307
- var _this$normalizeDashes = _this.normalizeDashes(inputValue).split(INPUT_DELIMITER),
319
+ var _this$normalizeDashes = _this.normalizeDashes(inputValue).split(" ".concat(INPUT_DELIMITER, " ")),
308
320
  _this$normalizeDashes2 = _slicedToArray(_this$normalizeDashes, 2),
309
321
  left = _this$normalizeDashes2[0],
310
322
  right = _this$normalizeDashes2[1];
@@ -436,13 +448,18 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
436
448
 
437
449
  _defineProperty(_assertThisInitialized(_this), "normalizeDashes", function (inputValue) {
438
450
  // replacing both hyphens and em-dashes with en-dashes
439
- return inputValue.replace(/-/g, '–').replace(/—/g, '–');
451
+ return inputValue.replace(/-/g, INPUT_DELIMITER).replace(/—/g, INPUT_DELIMITER);
452
+ });
453
+
454
+ _defineProperty(_assertThisInitialized(_this), "hasLockedBehavior", function () {
455
+ return _this.props.rangedCalendarBehavior === RANGED_CALENDAR_BEHAVIOR.locked && _this.props.range && _this.props.separateRangeInputs;
440
456
  });
441
457
 
442
458
  _this.dateHelpers = new DateHelpers(props.adapter);
443
459
  _this.state = {
444
460
  calendarFocused: false,
445
461
  isOpen: false,
462
+ selectedInput: null,
446
463
  isPseudoFocused: false,
447
464
  lastActiveElm: null,
448
465
  inputValue: _this.formatDisplayValue(props.value) || ''
@@ -451,6 +468,11 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
451
468
  }
452
469
 
453
470
  _createClass(Datepicker, [{
471
+ key: "getNullDatePlaceholder",
472
+ value: function getNullDatePlaceholder(formatString) {
473
+ return (this.getMask() || formatString).split(INPUT_DELIMITER)[0].replace(/[0-9]|[a-z]/g, ' ');
474
+ }
475
+ }, {
454
476
  key: "formatDate",
455
477
  value: function formatDate(date, formatString) {
456
478
  var _this2 = this;
@@ -467,10 +489,14 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
467
489
  return '';
468
490
  } else if (Array.isArray(date) && !date[0] && !date[1]) {
469
491
  return '';
492
+ } else if (Array.isArray(date) && !date[0] && date[1]) {
493
+ var endDate = format(date[1]);
494
+ var startDate = this.getNullDatePlaceholder(formatString);
495
+ return [startDate, endDate].join(" ".concat(INPUT_DELIMITER, " "));
470
496
  } else if (Array.isArray(date)) {
471
497
  return date.map(function (day) {
472
- return format(day);
473
- }).join(INPUT_DELIMITER);
498
+ return day ? format(day) : '';
499
+ }).join(" ".concat(INPUT_DELIMITER, " "));
474
500
  } else {
475
501
  return format(date);
476
502
  }
@@ -486,7 +512,7 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
486
512
  }
487
513
  }, {
488
514
  key: "renderInputComponent",
489
- value: function renderInputComponent(locale, separatedInput) {
515
+ value: function renderInputComponent(locale, inputRole) {
490
516
  var _this3 = this;
491
517
 
492
518
  var _this$props$overrides = this.props.overrides,
@@ -497,19 +523,19 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
497
523
  InputComponent = _getOverrides2[0],
498
524
  inputProps = _getOverrides2[1];
499
525
 
500
- 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';
526
+ 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';
501
527
 
502
- var _split = (this.state.inputValue || '').split(INPUT_DELIMITER),
528
+ var _split = (this.state.inputValue || '').split(" ".concat(INPUT_DELIMITER, " ")),
503
529
  _split2 = _slicedToArray(_split, 2),
504
530
  _split2$ = _split2[0],
505
531
  startDate = _split2$ === void 0 ? '' : _split2$,
506
532
  _split2$2 = _split2[1],
507
533
  endDate = _split2$2 === void 0 ? '' : _split2$2;
508
534
 
509
- var value = separatedInput === 'startDate' ? startDate : separatedInput === 'endDate' ? endDate : this.state.inputValue;
535
+ var value = inputRole === INPUT_ROLE.startDate ? startDate : inputRole === INPUT_ROLE.endDate ? endDate : this.state.inputValue;
510
536
 
511
537
  var onChange = function onChange(event) {
512
- return _this3.handleInputChange(event, separatedInput);
538
+ return _this3.handleInputChange(event, inputRole);
513
539
  };
514
540
 
515
541
  return /*#__PURE__*/React.createElement(InputComponent, _extends({
@@ -523,7 +549,9 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
523
549
  disabled: this.props.disabled,
524
550
  size: this.props.size,
525
551
  value: value,
526
- onFocus: this.open,
552
+ onFocus: function onFocus() {
553
+ return _this3.open(inputRole);
554
+ },
527
555
  onBlur: this.handleInputBlur,
528
556
  onKeyDown: this.handleKeyDown,
529
557
  onChange: onChange,
@@ -586,11 +614,13 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
586
614
  trapTabbing: true,
587
615
  value: _this4.props.value
588
616
  }, _this4.props, {
589
- onChange: _this4.onChange
617
+ onChange: _this4.onChange,
618
+ selectedInput: _this4.state.selectedInput,
619
+ hasLockedBehavior: _this4.hasLockedBehavior()
590
620
  }))
591
621
  }, popoverProps), /*#__PURE__*/React.createElement(InputWrapper, _extends({}, inputWrapperProps, {
592
622
  $separateRangeInputs: _this4.props.range && _this4.props.separateRangeInputs
593
- }), _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", {
623
+ }), _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, INPUT_ROLE.startDate)), /*#__PURE__*/React.createElement(EndDate, endDateProps, /*#__PURE__*/React.createElement(InputLabel, inputLabelProps, endDateLabel), _this4.renderInputComponent(locale, INPUT_ROLE.endDate))) : /*#__PURE__*/React.createElement(React.Fragment, null, _this4.renderInputComponent(locale)))), /*#__PURE__*/React.createElement("p", {
594
624
  id: _this4.props['aria-describedby'],
595
625
  style: {
596
626
  position: 'fixed',
@@ -621,11 +651,11 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
621
651
  clipPath: 'inset(100%)'
622
652
  }
623
653
  }, // No date selected
624
- !_this4.props.value || Array.isArray(_this4.props.value) && !_this4.props.value.length ? '' : // Date selected in a non-range picker
654
+ !_this4.props.value || Array.isArray(_this4.props.value) && !_this4.props.value[0] && !_this4.props.value[1] ? '' : // Date selected in a non-range picker
625
655
  !Array.isArray(_this4.props.value) ? getInterpolatedString(locale.datepicker.selectedDate, {
626
656
  date: _this4.state.inputValue || ''
627
657
  }) : // Start and end dates are selected in a range picker
628
- _this4.props.value.length > 1 ? getInterpolatedString(locale.datepicker.selectedDateRange, {
658
+ _this4.props.value[0] && _this4.props.value[1] ? getInterpolatedString(locale.datepicker.selectedDateRange, {
629
659
  startDate: _this4.formatDisplayValue(_this4.props.value[0]),
630
660
  endDate: _this4.formatDisplayValue( // $FlowFixMe
631
661
  _this4.props.value[1])
@@ -49,6 +49,7 @@ import DateHelpers from './utils/date-helpers.js';
49
49
  import { getOverrides } from '../helpers/overrides.js';
50
50
  import { LocaleContext } from '../locale/index.js';
51
51
  import { isFocusVisible } from '../utils/focusVisible.js';
52
+ import { INPUT_ROLE } from './constants.js';
52
53
 
53
54
  var Day = /*#__PURE__*/function (_React$Component) {
54
55
  _inherits(Day, _React$Component);
@@ -83,22 +84,49 @@ var Day = /*#__PURE__*/function (_React$Component) {
83
84
  var _this$props = _this.props,
84
85
  range = _this$props.range,
85
86
  value = _this$props.value;
86
- var date;
87
+ var nextDate;
88
+
89
+ if (Array.isArray(value) && range && _this.props.hasLockedBehavior) {
90
+ var currentDate = _this.props.value;
91
+ var nextStartDate = null;
92
+ var nextEndDate = null;
93
+
94
+ if (_this.props.selectedInput === INPUT_ROLE.startDate) {
95
+ nextStartDate = selectedDate;
96
+ nextEndDate = Array.isArray(currentDate) && currentDate[1] ? currentDate[1] : null;
97
+ } else if (_this.props.selectedInput === INPUT_ROLE.endDate) {
98
+ nextStartDate = Array.isArray(currentDate) && currentDate[0] ? currentDate[0] : null;
99
+ nextEndDate = selectedDate;
100
+ }
101
+
102
+ nextDate = [nextStartDate];
87
103
 
88
- if (Array.isArray(value) && range) {
89
- if (!value.length || value.length > 1) {
90
- date = [selectedDate];
91
- } else if (_this.dateHelpers.isAfter(selectedDate, value[0])) {
92
- date = [value[0], selectedDate];
104
+ if (nextEndDate) {
105
+ nextDate.push(nextEndDate);
106
+ }
107
+ } else if (Array.isArray(value) && range && !_this.props.hasLockedBehavior) {
108
+ var _value = _slicedToArray(value, 2),
109
+ start = _value[0],
110
+ end = _value[1]; // Starting a new range
111
+
112
+
113
+ if (!start && !end || start && end) {
114
+ nextDate = [selectedDate, null]; // EndDate needs a StartDate, SelectedDate comes before EndDate
115
+ } else if (!start && end && _this.dateHelpers.isAfter(end, selectedDate)) {
116
+ nextDate = [selectedDate, end]; // EndDate needs a StartDate, but SelectedDate comes after EndDate
117
+ } else if (!start && end && _this.dateHelpers.isAfter(selectedDate, end)) {
118
+ nextDate = [end, selectedDate]; // StartDate needs an EndDate, SelectedDate comes after StartDate
119
+ } else if (start && !end && _this.dateHelpers.isAfter(selectedDate, start)) {
120
+ nextDate = [start, selectedDate];
93
121
  } else {
94
- date = [selectedDate, value[0]];
122
+ nextDate = [selectedDate, start];
95
123
  }
96
124
  } else {
97
- date = selectedDate;
125
+ nextDate = selectedDate;
98
126
  }
99
127
 
100
128
  _this.props.onSelect({
101
- date: date
129
+ date: nextDate
102
130
  });
103
131
  });
104
132
 
@@ -285,13 +313,18 @@ var Day = /*#__PURE__*/function (_React$Component) {
285
313
  var date = this.getDateProp();
286
314
  var value = this.props.value;
287
315
 
288
- if (Array.isArray(value) && !value[0] && !value[1]) {
289
- return false;
290
- } // fix flow by passing a specific arg type and remove 'Array.isArray(value)'
316
+ if (Array.isArray(value)) {
317
+ var _value2 = _slicedToArray(value, 2),
318
+ start = _value2[0],
319
+ end = _value2[1];
291
320
 
321
+ if (!start && !end) {
322
+ return false;
323
+ }
292
324
 
293
- if (Array.isArray(value) && value.length > 1) {
294
- return this.dateHelpers.isDayInRange(this.clampToDayStart(date), this.clampToDayStart(value[0]), this.clampToDayStart(value[1]));
325
+ if (start && end) {
326
+ return this.dateHelpers.isDayInRange(this.clampToDayStart(date), this.clampToDayStart(start), this.clampToDayStart(end));
327
+ }
295
328
  }
296
329
  } // calculated for range case only
297
330
 
@@ -303,16 +336,29 @@ var Day = /*#__PURE__*/function (_React$Component) {
303
336
  value = _this$props4.value,
304
337
  highlightedDate = _this$props4.highlightedDate;
305
338
 
306
- if (Array.isArray(value) && !value[0] && !value[1]) {
307
- return false;
308
- } // fix flow by passing a specific arg type and remove 'Array.isArray(value)'
339
+ if (Array.isArray(value)) {
340
+ var _value3 = _slicedToArray(value, 2),
341
+ start = _value3[0],
342
+ end = _value3[1];
343
+
344
+ if (!start && !end) {
345
+ return false;
346
+ }
309
347
 
348
+ if (highlightedDate && start && !end) {
349
+ if (this.dateHelpers.isAfter(highlightedDate, start)) {
350
+ return this.dateHelpers.isDayInRange(this.clampToDayStart(date), this.clampToDayStart(start), this.clampToDayStart(highlightedDate));
351
+ } else {
352
+ return this.dateHelpers.isDayInRange(this.clampToDayStart(date), this.clampToDayStart(highlightedDate), this.clampToDayStart(start));
353
+ }
354
+ }
310
355
 
311
- if (Array.isArray(value) && highlightedDate && value[0] && !value[1]) {
312
- if (this.dateHelpers.isAfter(highlightedDate, value[0])) {
313
- return this.dateHelpers.isDayInRange(this.clampToDayStart(date), this.clampToDayStart(value[0]), this.clampToDayStart(highlightedDate));
314
- } else {
315
- return this.dateHelpers.isDayInRange(this.clampToDayStart(date), this.clampToDayStart(highlightedDate), this.clampToDayStart(value[0]));
356
+ if (highlightedDate && !start && end) {
357
+ if (this.dateHelpers.isAfter(highlightedDate, end)) {
358
+ return this.dateHelpers.isDayInRange(this.clampToDayStart(date), this.clampToDayStart(end), this.clampToDayStart(highlightedDate));
359
+ } else {
360
+ return this.dateHelpers.isDayInRange(this.clampToDayStart(date), this.clampToDayStart(highlightedDate), this.clampToDayStart(end));
361
+ }
316
362
  }
317
363
  }
318
364
  }
@@ -324,21 +370,22 @@ var Day = /*#__PURE__*/function (_React$Component) {
324
370
  value = _this$props5.value,
325
371
  highlightedDate = _this$props5.highlightedDate,
326
372
  range = _this$props5.range,
327
- highlighted = _this$props5.highlighted;
373
+ highlighted = _this$props5.highlighted,
374
+ peekNextMonth = _this$props5.peekNextMonth;
328
375
  var $isHighlighted = highlighted;
329
376
  var $selected = this.isSelected();
330
- var $hasRangeHighlighted = !!(Array.isArray(value) && range && value.length === 1 && highlightedDate && !this.dateHelpers.isSameDay(value[0], highlightedDate));
331
- var $outsideMonth = !this.props.peekNextMonth && this.isOutsideMonth();
332
- var $outsideMonthWithinRange = !!(Array.isArray(value) && range && $outsideMonth && !this.props.peekNextMonth && this.isOutsideOfMonthButWithinRange());
377
+ var $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)));
378
+ var $outsideMonth = !peekNextMonth && this.isOutsideMonth();
379
+ var $outsideMonthWithinRange = !!(Array.isArray(value) && range && $outsideMonth && !peekNextMonth && this.isOutsideOfMonthButWithinRange());
333
380
  return {
334
381
  $date: date,
335
382
  $density: this.props.density,
336
383
  $disabled: this.props.disabled,
337
- $endDate: Array.isArray(value) && this.props.range && $selected && this.dateHelpers.isSameDay(date, value[1]) || false,
384
+ $endDate: Array.isArray(value) && !!(value[0] && value[1]) && range && $selected && this.dateHelpers.isSameDay(date, value[1]) || false,
338
385
  $hasDateLabel: !!this.props.dateLabel,
339
386
  $hasRangeHighlighted: $hasRangeHighlighted,
340
- $hasRangeOnRight: Array.isArray(value) && $hasRangeHighlighted && highlightedDate && value[0] && this.dateHelpers.isAfter(highlightedDate, value[0]),
341
- $hasRangeSelected: Array.isArray(value) ? value.length === 2 : false,
387
+ $hasRangeOnRight: Array.isArray(value) && $hasRangeHighlighted && highlightedDate && (value[0] && this.dateHelpers.isAfter(highlightedDate, value[0]) || value[1] && this.dateHelpers.isAfter(highlightedDate, value[1])),
388
+ $hasRangeSelected: Array.isArray(value) ? !!(value[0] && value[1]) : false,
342
389
  $highlightedDate: highlightedDate,
343
390
  $isHighlighted: $isHighlighted,
344
391
  $isHovered: this.state.isHovered,
@@ -348,12 +395,15 @@ var Day = /*#__PURE__*/function (_React$Component) {
348
395
  $month: this.getMonthProp(),
349
396
  $outsideMonth: $outsideMonth,
350
397
  $outsideMonthWithinRange: $outsideMonthWithinRange,
351
- $peekNextMonth: this.props.peekNextMonth,
352
- $pseudoHighlighted: this.props.range && !$isHighlighted && !$selected ? this.isPseudoHighlighted() : false,
353
- $pseudoSelected: this.props.range && !$selected ? this.isPseudoSelected() : false,
354
- $range: this.props.range,
398
+ $peekNextMonth: peekNextMonth,
399
+ $pseudoHighlighted: range && !$isHighlighted && !$selected ? this.isPseudoHighlighted() : false,
400
+ $pseudoSelected: range && !$selected ? this.isPseudoSelected() : false,
401
+ $range: range,
355
402
  $selected: $selected,
356
- $startDate: Array.isArray(this.props.value) && this.props.value.length > 1 && this.props.range && $selected ? this.dateHelpers.isSameDay(date, this.props.value[0]) : false
403
+ $startDate: Array.isArray(value) && value[0] && value[1] && range && $selected ? this.dateHelpers.isSameDay(date, value[0]) : false,
404
+ $hasLockedBehavior: this.props.hasLockedBehavior,
405
+ $selectedInput: this.props.selectedInput,
406
+ $value: this.props.value
357
407
  };
358
408
  }
359
409
  }, {
@@ -129,7 +129,9 @@ var CalendarMonth = /*#__PURE__*/function (_React$Component) {
129
129
  onChange: _this.props.onChange,
130
130
  overrides: _this.props.overrides,
131
131
  peekNextMonth: _this.props.peekNextMonth,
132
- value: _this.props.value
132
+ value: _this.props.value,
133
+ hasLockedBehavior: _this.props.hasLockedBehavior,
134
+ selectedInput: _this.props.selectedInput
133
135
  }));
134
136
  i++;
135
137
  currentWeekStart = _this.dateHelpers.addWeeks(currentWeekStart, 1); // It will break on the next week if the week is out of the month
@@ -1,3 +1,15 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+
3
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
+
5
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
6
+
7
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
8
+
9
+ function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
10
+
11
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
+
1
13
  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; }
2
14
 
3
15
  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; }
@@ -12,7 +24,7 @@ LICENSE file in the root directory of this source tree.
12
24
  */
13
25
  import { styled } from '../styles/index.js';
14
26
  import getDayStateCode from './utils/day-state.js';
15
- import { ORIENTATION, DENSITY } from './constants.js';
27
+ import { ORIENTATION, DENSITY, INPUT_ROLE } from './constants.js';
16
28
  /**
17
29
  * Main component container element
18
30
  */
@@ -427,6 +439,9 @@ export var StyledDay = styled('div', function (props) {
427
439
  $outsideMonthWithinRange = props.$outsideMonthWithinRange,
428
440
  $hasDateLabel = props.$hasDateLabel,
429
441
  $density = props.$density,
442
+ $hasLockedBehavior = props.$hasLockedBehavior,
443
+ $selectedInput = props.$selectedInput,
444
+ $value = props.$value,
430
445
  _props$$theme4 = props.$theme,
431
446
  colors = _props$$theme4.colors,
432
447
  typography = _props$$theme4.typography,
@@ -448,6 +463,13 @@ export var StyledDay = styled('div', function (props) {
448
463
  }
449
464
  }
450
465
 
466
+ var _ref9 = Array.isArray($value) ? $value : [$value, null],
467
+ _ref10 = _slicedToArray(_ref9, 2),
468
+ startDate = _ref10[0],
469
+ endDate = _ref10[1];
470
+
471
+ var oppositeInputIsPopulated = $selectedInput === INPUT_ROLE.startDate ? endDate !== null && typeof endDate !== 'undefined' : startDate !== null && typeof startDate !== 'undefined';
472
+ var shouldHighlightRange = $range && !($hasLockedBehavior && !oppositeInputIsPopulated);
451
473
  return _objectSpread(_objectSpread(_objectSpread({}, $density === DENSITY.high ? typography.ParagraphSmall : typography.ParagraphMedium), {}, {
452
474
  boxSizing: 'border-box',
453
475
  position: 'relative',
@@ -509,7 +531,7 @@ export var StyledDay = styled('div', function (props) {
509
531
  }, getDayStyles(code, props.$theme)[':after'] || {}), $outsideMonthWithinRange ? {
510
532
  content: null
511
533
  } : {})
512
- }, $range ? {
534
+ }, shouldHighlightRange ? {
513
535
  // :before pseudo element defines a grey background style that extends
514
536
  // the selected/highlighted day's circle and spans through a range
515
537
  ':before': _objectSpread(_objectSpread({
@@ -7,4 +7,4 @@ LICENSE file in the root directory of this source tree.
7
7
 
8
8
  /* eslint-disable flowtype/generic-spacing */
9
9
  import * as React from 'react';
10
- import { ORIENTATION, STATE_CHANGE_TYPE, DENSITY } from './constants.js';
10
+ import { INPUT_ROLE, ORIENTATION, RANGED_CALENDAR_BEHAVIOR, STATE_CHANGE_TYPE, DENSITY } from './constants.js';
@@ -1,3 +1,15 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+
3
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
+
5
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
6
+
7
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
8
+
9
+ function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
10
+
11
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
+
1
13
  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; }
2
14
 
3
15
  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; }
@@ -223,6 +235,24 @@ var DateHelpers = function DateHelpers(_adapter) {
223
235
  return false;
224
236
  });
225
237
 
238
+ _defineProperty(this, "dateRangeIncludesDates", function (dateRange, dates) {
239
+ var _dateRange = _slicedToArray(dateRange, 2),
240
+ startDate = _dateRange[0],
241
+ endDate = _dateRange[1];
242
+
243
+ if (startDate && endDate && Array.isArray(dates) && dates.length) {
244
+ for (var i = 0; i < dates.length; i++) {
245
+ var _day = dates[i];
246
+
247
+ if (_this.isDayInRange(_day, startDate, endDate)) {
248
+ return true;
249
+ }
250
+ }
251
+ }
252
+
253
+ return false;
254
+ });
255
+
226
256
  _defineProperty(this, "subDays", function (date, days) {
227
257
  return _this.adapter.addDays(date, days * -1);
228
258
  });
@@ -101,7 +101,9 @@ var Week = /*#__PURE__*/function (_React$Component) {
101
101
  onMouseLeave: _this.props.onDayMouseLeave,
102
102
  overrides: _this.props.overrides,
103
103
  peekNextMonth: _this.props.peekNextMonth,
104
- value: _this.props.value
104
+ value: _this.props.value,
105
+ hasLockedBehavior: _this.props.hasLockedBehavior,
106
+ selectedInput: _this.props.selectedInput
105
107
  })
106
108
  );
107
109
  }));
@@ -35,7 +35,7 @@ import { useStyletron } from '../styles/index.js';
35
35
  import { Button, KIND, SHAPE, SIZE as BUTTON_SIZE } from '../button/index.js';
36
36
  import { getOverrides } from '../helpers/overrides.js';
37
37
  import { ProgressBar } from '../progress-bar/index.js';
38
- import { StyledSpinnerNext, SIZE as SPINNER_SIZE } from '../spinner/index.js';
38
+ import { Spinner, SIZE as SPINNER_SIZE } from '../spinner/index.js';
39
39
  import { StyledRoot, StyledFileDragAndDrop, StyledContentMessage, StyledContentSeparator, StyledErrorMessage, StyledHiddenInput } from './styled-components.js';
40
40
 
41
41
  function prependStyleProps(styleProps) {
@@ -88,7 +88,7 @@ function FileUploader(props) {
88
88
  ButtonComponent = _getOverrides14[0],
89
89
  buttonProps = _getOverrides14[1];
90
90
 
91
- var _getOverrides15 = getOverrides(overrides.Spinner, StyledSpinnerNext),
91
+ var _getOverrides15 = getOverrides(overrides.Spinner, Spinner),
92
92
  _getOverrides16 = _slicedToArray(_getOverrides15, 2),
93
93
  SpinnerComponent = _getOverrides16[0],
94
94
  spinnerProps = _getOverrides16[1];
@@ -153,7 +153,7 @@ function FileUploader(props) {
153
153
  marginBottom: theme.sizing.scale300
154
154
  }
155
155
  }, spinnerProps)), (props.errorMessage || props.progressMessage) && props.errorMessage ? /*#__PURE__*/React.createElement(ErrorMessage, _extends({}, prefixedStyledProps, errorMessageProps), props.errorMessage) : /*#__PURE__*/React.createElement(ContentMessage, _extends({}, prefixedStyledProps, contentMessageProps), props.progressMessage), props.errorMessage ? /*#__PURE__*/React.createElement(ButtonComponent, {
156
- kind: KIND.minimal,
156
+ kind: KIND.tertiary,
157
157
  onClick: function onClick() {
158
158
  props.onRetry && props.onRetry();
159
159
  },
@@ -161,7 +161,7 @@ function FileUploader(props) {
161
161
  "aria-describedby": props['aria-describedby'],
162
162
  "aria-errormessage": props.errorMessage
163
163
  }, locale.fileuploader.retry) : /*#__PURE__*/React.createElement(ButtonComponent, {
164
- kind: KIND.minimal,
164
+ kind: KIND.tertiary,
165
165
  onClick: function onClick() {
166
166
  props.onCancel && props.onCancel();
167
167
  },
@@ -17,7 +17,6 @@ export var Label = styled('label', function (props) {
17
17
  colors = _props$$theme.colors,
18
18
  typography = _props$$theme.typography;
19
19
  return _objectSpread(_objectSpread({}, typography.font250), {}, {
20
- fontWeight: 500,
21
20
  width: '100%',
22
21
  color: $disabled ? colors.contentSecondary : colors.contentPrimary,
23
22
  display: 'block',
@@ -16,15 +16,15 @@ export var Root = styled('nav', function (props) {
16
16
  var $theme = props.$theme;
17
17
  var scale500 = $theme.sizing.scale500,
18
18
  font300 = $theme.typography.font300,
19
- border = $theme.colors.border;
19
+ borderOpaque = $theme.colors.borderOpaque;
20
20
  return _objectSpread(_objectSpread({}, font300), {}, {
21
21
  display: 'flex',
22
22
  paddingBottom: scale500,
23
23
  paddingTop: scale500,
24
24
  borderBottomWidth: '1px',
25
25
  borderBottomStyle: 'solid',
26
- borderBottomColor: "".concat(border),
27
- backgroundColor: $theme.colors.headerNavigationFill
26
+ borderBottomColor: "".concat(borderOpaque),
27
+ backgroundColor: $theme.colors.backgroundPrimary
28
28
  });
29
29
  });
30
30
  Root.displayName = "Root";
@@ -85,8 +85,7 @@ export function toObjectOverride(override) {
85
85
  /**
86
86
  * Get a convenient override array that will always have [component, props]
87
87
  */
88
-
89
- /* flowlint unclear-type:off */
88
+ // flowlint unclear-type:off
90
89
 
91
90
  export function getOverrides(override, defaultComponent) {
92
91
  var Component = getOverride(override) || defaultComponent;