@commercetools-uikit/date-range-input 15.15.0 → 16.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,3 @@
1
1
  export * from "./declarations/src/index";
2
2
  export { default } from "./declarations/src/index";
3
+ //# sourceMappingURL=commercetools-uikit-date-range-input.cjs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commercetools-uikit-date-range-input.cjs.d.ts","sourceRoot":"","sources":["./declarations/src/index.d.ts"],"names":[],"mappings":"AAAA"}
@@ -11,7 +11,6 @@ var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-
11
11
  var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
12
12
  var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
13
13
  var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
14
- var _toConsumableArray = require('@babel/runtime-corejs3/helpers/toConsumableArray');
15
14
  var _classCallCheck = require('@babel/runtime-corejs3/helpers/classCallCheck');
16
15
  var _createClass = require('@babel/runtime-corejs3/helpers/createClass');
17
16
  var _inherits = require('@babel/runtime-corejs3/helpers/inherits');
@@ -21,9 +20,9 @@ var _pt = require('prop-types');
21
20
  var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
22
21
  var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
23
22
  var _trimInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/trim');
24
- var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
25
23
  var _sortInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/sort');
26
24
  var _fillInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/fill');
25
+ var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
27
26
  var react = require('react');
28
27
  var Downshift = require('downshift');
29
28
  var reactIntl = require('react-intl');
@@ -47,52 +46,52 @@ var _pt__default = /*#__PURE__*/_interopDefault(_pt);
47
46
  var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInstanceProperty);
48
47
  var _mapInstanceProperty__default = /*#__PURE__*/_interopDefault(_mapInstanceProperty);
49
48
  var _trimInstanceProperty__default = /*#__PURE__*/_interopDefault(_trimInstanceProperty);
50
- var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
51
49
  var _sortInstanceProperty__default = /*#__PURE__*/_interopDefault(_sortInstanceProperty);
52
50
  var _fillInstanceProperty__default = /*#__PURE__*/_interopDefault(_fillInstanceProperty);
51
+ var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
53
52
  var Downshift__default = /*#__PURE__*/_interopDefault(Downshift);
54
53
  var Constraints__default = /*#__PURE__*/_interopDefault(Constraints);
55
54
 
56
55
  function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); enumerableOnly && (symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
57
56
 
58
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context7, _context8; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context7 = ownKeys(Object(source), !0)).call(_context7, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context8 = ownKeys(Object(source))).call(_context8, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
57
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context5, _context6; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context5 = ownKeys(Object(source), !0)).call(_context5, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context6 = ownKeys(Object(source))).call(_context6, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
59
58
 
60
59
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct__default["default"](Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
61
60
 
62
61
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct__default["default"]) return false; if (_Reflect$construct__default["default"].sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); return true; } catch (e) { return false; } }
63
62
 
64
- var preventDownshiftDefault = function preventDownshiftDefault(event) {
63
+ const preventDownshiftDefault = event => {
65
64
  event.nativeEvent.preventDownshiftDefault = true;
66
65
  };
67
66
 
68
- var parseRangeText = function parseRangeText(text, locale) {
67
+ const parseRangeText = (text, locale) => {
69
68
  var _context, _context2;
70
69
 
71
- var parts = _filterInstanceProperty__default["default"](_context = _mapInstanceProperty__default["default"](_context2 = text.split(' - ')).call(_context2, function (part) {
72
- var parsedDate = calendarUtils.parseInputToDate(_trimInstanceProperty__default["default"](part).call(part), locale);
70
+ const parts = _filterInstanceProperty__default["default"](_context = _mapInstanceProperty__default["default"](_context2 = text.split(' - ')).call(_context2, part => {
71
+ const parsedDate = calendarUtils.parseInputToDate(_trimInstanceProperty__default["default"](part).call(part), locale);
73
72
  return parsedDate === '' ? null : parsedDate;
74
73
  })).call(_context, Boolean);
75
74
 
76
75
  return parts;
77
76
  };
78
77
 
79
- var isSameRange = function isSameRange(a, b) {
78
+ const isSameRange = (a, b) => {
80
79
  if (a.length !== b.length) return false;
81
80
  if (a.length === 0) return true;
82
81
  if (a[0] === b[0] && a[1] === b[1]) return true;
83
82
  return false;
84
83
  };
85
84
 
86
- var getRange = function getRange(_ref) {
87
- var item = _ref.item,
85
+ const getRange = _ref => {
86
+ let item = _ref.item,
88
87
  value = _ref.value,
89
88
  startDate = _ref.startDate,
90
89
  highlightedItem = _ref.highlightedItem;
91
- var isRangeSelectionInProgress = startDate;
92
- var hasSelection = value.length === 2;
93
- var isStartDate = calendarUtils.isSameDay(item, startDate);
94
- var isBetween = highlightedItem && calendarUtils.isBetween(item, startDate, highlightedItem);
95
- var isRangeStart = false;
90
+ const isRangeSelectionInProgress = startDate;
91
+ const hasSelection = value.length === 2;
92
+ const isStartDate = calendarUtils.isSameDay(item, startDate);
93
+ const isBetween = highlightedItem && calendarUtils.isBetween(item, startDate, highlightedItem);
94
+ let isRangeStart = false;
96
95
 
97
96
  if (isRangeSelectionInProgress) {
98
97
  isRangeStart = isStartDate;
@@ -100,7 +99,7 @@ var getRange = function getRange(_ref) {
100
99
  isRangeStart = value[0] === item;
101
100
  }
102
101
 
103
- var isRangeBetween = false;
102
+ let isRangeBetween = false;
104
103
 
105
104
  if (isRangeSelectionInProgress) {
106
105
  isRangeBetween = isBetween;
@@ -108,7 +107,7 @@ var getRange = function getRange(_ref) {
108
107
  isRangeBetween = calendarUtils.isBetween(item, value[0], value[1]);
109
108
  }
110
109
 
111
- var isRangeEnd = false;
110
+ let isRangeEnd = false;
112
111
 
113
112
  if (isRangeSelectionInProgress) {
114
113
  isRangeEnd = item === highlightedItem;
@@ -117,20 +116,18 @@ var getRange = function getRange(_ref) {
117
116
  }
118
117
 
119
118
  return {
120
- isRangeStart: isRangeStart,
121
- isRangeBetween: isRangeBetween,
122
- isRangeEnd: isRangeEnd
119
+ isRangeStart,
120
+ isRangeBetween,
121
+ isRangeEnd
123
122
  };
124
123
  };
125
124
 
126
- var DateRangeInput = /*#__PURE__*/function (_Component) {
125
+ let DateRangeInput = /*#__PURE__*/function (_Component) {
127
126
  _inherits(DateRangeInput, _Component);
128
127
 
129
128
  var _super = _createSuper(DateRangeInput);
130
129
 
131
130
  function DateRangeInput() {
132
- var _context3;
133
-
134
131
  var _this;
135
132
 
136
133
  _classCallCheck(this, DateRangeInput);
@@ -139,7 +136,7 @@ var DateRangeInput = /*#__PURE__*/function (_Component) {
139
136
  args[_key] = arguments[_key];
140
137
  }
141
138
 
142
- _this = _super.call.apply(_super, _concatInstanceProperty__default["default"](_context3 = [this]).call(_context3, args));
139
+ _this = _super.call(this, ...args);
143
140
  _this.inputRef = /*#__PURE__*/react.createRef();
144
141
  _this.state = {
145
142
  calendarDate: _this.props.value.length === 2 ? _this.props.value[0] : calendarUtils.getToday(),
@@ -153,10 +150,10 @@ var DateRangeInput = /*#__PURE__*/function (_Component) {
153
150
  };
154
151
 
155
152
  _this.jumpMonth = function (amount) {
156
- var dayToHighlight = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
153
+ let dayToHighlight = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
157
154
 
158
- _this.setState(function (prevState) {
159
- var nextDate = calendarUtils.changeMonth(prevState.calendarDate, amount);
155
+ _this.setState(prevState => {
156
+ const nextDate = calendarUtils.changeMonth(prevState.calendarDate, amount);
160
157
  return {
161
158
  calendarDate: nextDate,
162
159
  highlightedIndex: dayToHighlight
@@ -164,22 +161,20 @@ var DateRangeInput = /*#__PURE__*/function (_Component) {
164
161
  });
165
162
  };
166
163
 
167
- _this.showToday = function () {
168
- var today = calendarUtils.getToday();
164
+ _this.showToday = () => {
165
+ const today = calendarUtils.getToday();
169
166
 
170
- _this.setState(function (prevState) {
171
- return {
172
- calendarDate: today,
173
- highlightedIndex: prevState.suggestedItems.length + calendarUtils.getDateInMonth(today) - 1
174
- };
175
- }, function () {
167
+ _this.setState(prevState => ({
168
+ calendarDate: today,
169
+ highlightedIndex: prevState.suggestedItems.length + calendarUtils.getDateInMonth(today) - 1
170
+ }), () => {
176
171
  var _this$inputRef$curren;
177
172
 
178
173
  return (_this$inputRef$curren = _this.inputRef.current) === null || _this$inputRef$curren === void 0 ? void 0 : _this$inputRef$curren.focus();
179
174
  });
180
175
  };
181
176
 
182
- _this.handleBlur = function () {
177
+ _this.handleBlur = () => {
183
178
  if (_this.props.onBlur) _this.props.onBlur({
184
179
  target: {
185
180
  id: _this.props.id,
@@ -188,7 +183,7 @@ var DateRangeInput = /*#__PURE__*/function (_Component) {
188
183
  });
189
184
  };
190
185
 
191
- _this.emit = function (unsortedRange) {
186
+ _this.emit = unsortedRange => {
192
187
  var _this$props$onChange, _this$props;
193
188
 
194
189
  (_this$props$onChange = (_this$props = _this.props).onChange) === null || _this$props$onChange === void 0 ? void 0 : _this$props$onChange.call(_this$props, {
@@ -206,8 +201,6 @@ var DateRangeInput = /*#__PURE__*/function (_Component) {
206
201
  _createClass(DateRangeInput, [{
207
202
  key: "render",
208
203
  value: function render() {
209
- var _this2 = this;
210
-
211
204
  return jsxRuntime.jsx(Constraints__default["default"].Horizontal, {
212
205
  max: this.props.horizontalConstraint,
213
206
  children: jsxRuntime.jsx(Downshift__default["default"], {
@@ -216,75 +209,74 @@ var DateRangeInput = /*#__PURE__*/function (_Component) {
216
209
  inputValue: this.state.inputValue,
217
210
  selectedItem: null,
218
211
  highlightedIndex: this.state.highlightedIndex,
219
- onInputValueChange: function onInputValueChange(inputValue, changes) {
212
+ onInputValueChange: (inputValue, changes) => {
220
213
  // only attempt to parse input when the user typed into the input
221
214
  // field
222
215
  // @ts-ignore
223
216
  if (changes.type !== Downshift__default["default"].stateChangeTypes.changeInput) return;
224
-
225
- _this2.setState(function () {
226
- var parsedRange = parseRangeText(inputValue, _this2.props.intl.locale);
217
+ this.setState(() => {
218
+ const parsedRange = parseRangeText(inputValue, this.props.intl.locale);
227
219
  if (parsedRange.length === 0) return {
228
220
  suggestedItems: [],
229
221
  highlightedIndex: null,
230
- inputValue: inputValue,
222
+ inputValue,
231
223
  startDate: null
232
224
  };
233
225
 
234
226
  if (parsedRange.length === 1) {
235
- var calendarDate = parsedRange[0];
227
+ const calendarDate = parsedRange[0];
236
228
  return {
237
229
  suggestedItems: [],
238
230
  highlightedIndex: calendarUtils.getDateInMonth(calendarDate) - 1,
239
- inputValue: inputValue,
231
+ inputValue,
240
232
  startDate: parsedRange[0],
241
- calendarDate: calendarDate
233
+ calendarDate
242
234
  };
243
235
  }
244
236
 
245
237
  if (parsedRange.length === 2) {
246
- var _calendarDate = parsedRange[1];
238
+ const calendarDate = parsedRange[1];
247
239
  return {
248
240
  suggestedItems: [],
249
- highlightedIndex: calendarUtils.getDateInMonth(_calendarDate) - 1,
250
- inputValue: inputValue,
241
+ highlightedIndex: calendarUtils.getDateInMonth(calendarDate) - 1,
242
+ inputValue,
251
243
  startDate: parsedRange[0],
252
- calendarDate: _calendarDate
244
+ calendarDate
253
245
  };
254
246
  }
255
247
 
256
248
  return null;
257
249
  });
258
250
  },
259
- onStateChange: function onStateChange(changes) {
260
- _this2.setState(function (prevState) {
251
+ onStateChange: changes => {
252
+ this.setState(prevState => {
261
253
  if (changes.type === Downshift__default["default"].stateChangeTypes.mouseUp || changes.type === Downshift__default["default"].stateChangeTypes.blurInput) {
262
254
  return {
263
255
  highlightedIndex: null,
264
256
  isOpen: false,
265
- inputValue: calendarUtils.formatRange(_this2.props.value, _this2.props.intl.locale)
257
+ inputValue: calendarUtils.formatRange(this.props.value, this.props.intl.locale)
266
258
  };
267
259
  }
268
260
 
269
261
  if (changes.hasOwnProperty('selectedItem')) {
270
- var hasStartedRangeSelection = Boolean(!prevState.startDate && changes.selectedItem);
271
- var hasFinishedRangeSelection = Boolean(prevState.startDate && changes.selectedItem);
262
+ const hasStartedRangeSelection = Boolean(!prevState.startDate && changes.selectedItem);
263
+ const hasFinishedRangeSelection = Boolean(prevState.startDate && changes.selectedItem);
272
264
  return {
273
265
  highlightedIndex: prevState.highlightedIndex,
274
266
  startDate: prevState.startDate ? null : changes.selectedItem,
275
267
  calendarDate: changes.selectedItem,
276
268
  isOpen: !hasFinishedRangeSelection,
277
- inputValue: function () {
269
+ inputValue: (() => {
278
270
  if (hasFinishedRangeSelection) {
279
- return calendarUtils.formatRange([prevState.startDate, changes.selectedItem], _this2.props.intl.locale);
271
+ return calendarUtils.formatRange([prevState.startDate, changes.selectedItem], this.props.intl.locale);
280
272
  }
281
273
 
282
274
  if (hasStartedRangeSelection) {
283
- return calendarUtils.formatRange([changes.selectedItem], _this2.props.intl.locale);
275
+ return calendarUtils.formatRange([changes.selectedItem], this.props.intl.locale);
284
276
  }
285
277
 
286
278
  return '';
287
- }()
279
+ })()
288
280
  };
289
281
  }
290
282
 
@@ -297,7 +289,7 @@ var DateRangeInput = /*#__PURE__*/function (_Component) {
297
289
  startDate: null,
298
290
  // Ensure calendar opens on selected date.
299
291
  // Open on the current day as a fallback.
300
- calendarDate: _this2.props.value.length === 2 ? _this2.props.value[0] : calendarUtils.getToday()
292
+ calendarDate: this.props.value.length === 2 ? this.props.value[0] : calendarUtils.getToday()
301
293
  };
302
294
  }
303
295
 
@@ -310,18 +302,18 @@ var DateRangeInput = /*#__PURE__*/function (_Component) {
310
302
  return null;
311
303
  });
312
304
  },
313
- onChange: function onChange(selectedItem) {
314
- if (_this2.state.startDate && selectedItem) {
315
- _this2.emit([_this2.state.startDate, selectedItem]);
305
+ onChange: selectedItem => {
306
+ if (this.state.startDate && selectedItem) {
307
+ this.emit([this.state.startDate, selectedItem]);
316
308
  } else {
317
- _this2.emit([]);
309
+ this.emit([]);
318
310
  }
319
311
  },
320
312
  isOpen: this.state.isOpen,
321
- children: function children(_ref2) {
322
- var _context4, _context5, _context6;
313
+ children: _ref2 => {
314
+ var _context3, _context4;
323
315
 
324
- var getInputProps = _ref2.getInputProps,
316
+ let getInputProps = _ref2.getInputProps,
325
317
  getMenuProps = _ref2.getMenuProps,
326
318
  getItemProps = _ref2.getItemProps,
327
319
  getToggleButtonProps = _ref2.getToggleButtonProps,
@@ -331,38 +323,36 @@ var DateRangeInput = /*#__PURE__*/function (_Component) {
331
323
  setHighlightedIndex = _ref2.setHighlightedIndex,
332
324
  isOpen = _ref2.isOpen,
333
325
  inputValue = _ref2.inputValue;
334
- var calendarItems = calendarUtils.createCalendarItems(_this2.state.calendarDate);
326
+ const calendarItems = calendarUtils.createCalendarItems(this.state.calendarDate);
327
+ const allItems = [...this.state.suggestedItems, ...calendarItems];
328
+ const paddingDayCount = calendarUtils.getPaddingDayCount(this.state.calendarDate, this.props.intl.locale);
335
329
 
336
- var allItems = _concatInstanceProperty__default["default"](_context4 = []).call(_context4, _toConsumableArray(_this2.state.suggestedItems), _toConsumableArray(calendarItems));
330
+ const paddingDays = _fillInstanceProperty__default["default"](_context3 = Array(paddingDayCount)).call(_context3, undefined);
337
331
 
338
- var paddingDayCount = calendarUtils.getPaddingDayCount(_this2.state.calendarDate, _this2.props.intl.locale);
339
-
340
- var paddingDays = _fillInstanceProperty__default["default"](_context5 = Array(paddingDayCount)).call(_context5, undefined);
341
-
342
- var weekdays = calendarUtils.getWeekdayNames(_this2.props.intl.locale);
343
- var today = calendarUtils.getToday();
332
+ const weekdays = calendarUtils.getWeekdayNames(this.props.intl.locale);
333
+ const today = calendarUtils.getToday();
344
334
  return jsxRuntime.jsxs("div", {
345
- onFocus: _this2.props.onFocus,
346
- onBlur: _this2.handleBlur,
335
+ onFocus: this.props.onFocus,
336
+ onBlur: this.handleBlur,
347
337
  children: [jsxRuntime.jsx(calendarUtils.CalendarBody, {
348
- inputRef: _this2.inputRef,
338
+ inputRef: this.inputRef,
349
339
  inputProps: getInputProps(_objectSpread({
350
340
  /* ARIA */
351
- 'aria-invalid': _this2.props['aria-invalid'],
352
- 'aria-errormessage': _this2.props['aria-errormessage'],
341
+ 'aria-invalid': this.props['aria-invalid'],
342
+ 'aria-errormessage': this.props['aria-errormessage'],
353
343
  // Unset the aria-labelledby as it interfers with the link
354
344
  // between the <label for> and the <input id>.
355
345
  'aria-labelledby': undefined,
356
- name: _this2.props.name,
357
- placeholder: typeof _this2.props.placeholder === 'string' ? _this2.props.placeholder : _concatInstanceProperty__default["default"](_context6 = "".concat(calendarTimeUtils.getLocalizedDateTimeFormatPattern(_this2.props.intl.locale), " - ")).call(_context6, calendarTimeUtils.getLocalizedDateTimeFormatPattern(_this2.props.intl.locale)),
358
- onMouseEnter: function onMouseEnter() {
346
+ name: this.props.name,
347
+ placeholder: typeof this.props.placeholder === 'string' ? this.props.placeholder : _concatInstanceProperty__default["default"](_context4 = "".concat(calendarTimeUtils.getLocalizedDateTimeFormatPattern(this.props.intl.locale), " - ")).call(_context4, calendarTimeUtils.getLocalizedDateTimeFormatPattern(this.props.intl.locale)),
348
+ onMouseEnter: () => {
359
349
  // we remove the highlight so that the user can use the
360
350
  // arrow keys to move the cursor when hovering
361
351
  // @ts-ignore
362
352
  if (isOpen) setHighlightedIndex(null);
363
353
  },
364
- onKeyDown: function onKeyDown(event) {
365
- if (_this2.props.isReadOnly) {
354
+ onKeyDown: event => {
355
+ if (this.props.isReadOnly) {
366
356
  preventDownshiftDefault(event);
367
357
  return;
368
358
  }
@@ -370,10 +360,9 @@ var DateRangeInput = /*#__PURE__*/function (_Component) {
370
360
  if (event.key === 'Enter' && (inputValue === null || inputValue === void 0 ? void 0 : _trimInstanceProperty__default["default"](inputValue).call(inputValue)) === '' && // do not clear value when user presses Enter to
371
361
  // select the end date (so only clear when there is no
372
362
  // startDate)
373
- !_this2.state.startDate && _this2.props.isClearable) {
363
+ !this.state.startDate && this.props.isClearable) {
374
364
  clearSelection();
375
-
376
- _this2.emit([]);
365
+ this.emit([]);
377
366
  } // ArrowDown
378
367
 
379
368
 
@@ -383,93 +372,79 @@ var DateRangeInput = /*#__PURE__*/function (_Component) {
383
372
  // then bypass normal arrow navigation
384
373
  preventDownshiftDefault(event); // then jump to start of next month
385
374
 
386
- _this2.jumpMonth(1, 0);
375
+ this.jumpMonth(1, 0);
387
376
  }
388
377
  } // ArrowUp
389
378
 
390
379
 
391
380
  if (event.key === 'ArrowUp') {
392
- var previousDay = calendarUtils.getPreviousDay(calendarItems[highlightedIndex]);
381
+ const previousDay = calendarUtils.getPreviousDay(calendarItems[highlightedIndex]);
393
382
 
394
383
  if (highlightedIndex <= 0) {
395
384
  // if it's the start of the month
396
385
  // then bypass normal arrow navigation
397
386
  preventDownshiftDefault(event);
398
- var numberOfDaysOfPrevMonth = calendarUtils.getDaysInMonth(previousDay); // then jump to the last day of the previous month
387
+ const numberOfDaysOfPrevMonth = calendarUtils.getDaysInMonth(previousDay); // then jump to the last day of the previous month
399
388
 
400
- _this2.jumpMonth(-1, numberOfDaysOfPrevMonth - 1);
389
+ this.jumpMonth(-1, numberOfDaysOfPrevMonth - 1);
401
390
  }
402
391
  }
403
392
  },
404
393
  // we only do this for readOnly because the input
405
394
  // doesn't ignore these events, unlike when its disabled
406
- onClick: _this2.props.isReadOnly ? undefined : openMenu
407
- }, utils.filterDataAttributes(_this2.props))),
408
- hasSelection: _this2.props.value.length === 2,
409
- isClearable: _this2.props.isClearable,
410
- onClear: function onClear() {
411
- _this2.setState({
395
+ onClick: this.props.isReadOnly ? undefined : openMenu
396
+ }, utils.filterDataAttributes(this.props))),
397
+ hasSelection: this.props.value.length === 2,
398
+ isClearable: this.props.isClearable,
399
+ onClear: () => {
400
+ this.setState({
412
401
  startDate: null
413
402
  });
414
-
415
- _this2.emit([]);
416
-
403
+ this.emit([]);
417
404
  clearSelection();
418
405
  },
419
406
  isOpen: isOpen,
420
- isDisabled: _this2.props.isDisabled,
421
- isReadOnly: _this2.props.isReadOnly,
407
+ isDisabled: this.props.isDisabled,
408
+ isReadOnly: this.props.isReadOnly,
422
409
  toggleButtonProps: getToggleButtonProps(),
423
- hasError: _this2.props.hasError,
424
- hasWarning: _this2.props.hasWarning
425
- }), isOpen && !_this2.props.isDisabled && jsxRuntime.jsxs(calendarUtils.CalendarMenu, _objectSpread(_objectSpread({}, getMenuProps()), {}, {
426
- hasError: _this2.props.hasError,
427
- hasWarning: _this2.props.hasWarning,
410
+ hasError: this.props.hasError,
411
+ hasWarning: this.props.hasWarning
412
+ }), isOpen && !this.props.isDisabled && jsxRuntime.jsxs(calendarUtils.CalendarMenu, _objectSpread(_objectSpread({}, getMenuProps()), {}, {
413
+ hasError: this.props.hasError,
414
+ hasWarning: this.props.hasWarning,
428
415
  children: [jsxRuntime.jsx(calendarUtils.CalendarHeader, {
429
- monthLabel: calendarUtils.getMonthCalendarLabel(_this2.state.calendarDate, _this2.props.intl.locale),
430
- yearLabel: calendarUtils.getYearCalendarLabel(_this2.state.calendarDate, _this2.props.intl.locale),
431
- onPrevMonthClick: function onPrevMonthClick() {
432
- return _this2.jumpMonth(-1);
433
- },
434
- onTodayClick: _this2.showToday,
435
- onNextMonthClick: function onNextMonthClick() {
436
- return _this2.jumpMonth(1);
437
- },
438
- onPrevYearClick: function onPrevYearClick() {
439
- return _this2.jumpMonth(-12);
440
- },
441
- onNextYearClick: function onNextYearClick() {
442
- return _this2.jumpMonth(12);
443
- }
416
+ monthLabel: calendarUtils.getMonthCalendarLabel(this.state.calendarDate, this.props.intl.locale),
417
+ yearLabel: calendarUtils.getYearCalendarLabel(this.state.calendarDate, this.props.intl.locale),
418
+ onPrevMonthClick: () => this.jumpMonth(-1),
419
+ onTodayClick: this.showToday,
420
+ onNextMonthClick: () => this.jumpMonth(1),
421
+ onPrevYearClick: () => this.jumpMonth(-12),
422
+ onNextYearClick: () => this.jumpMonth(12)
444
423
  }), jsxRuntime.jsxs(calendarUtils.CalendarContent, {
445
- children: [_mapInstanceProperty__default["default"](weekdays).call(weekdays, function (weekday) {
446
- return jsxRuntime.jsx(calendarUtils.CalendarDay, {
447
- type: "heading",
448
- children: weekday
449
- }, weekday);
450
- }), _mapInstanceProperty__default["default"](paddingDays).call(paddingDays, function (_, index) {
451
- return jsxRuntime.jsx(calendarUtils.CalendarDay, {
452
- type: "spacing"
453
- }, index);
454
- }), _mapInstanceProperty__default["default"](calendarItems).call(calendarItems, function (item, index) {
455
- var isHighlighted = _this2.state.suggestedItems.length + index === highlightedIndex;
456
-
457
- var _getRange = getRange({
458
- item: item,
459
- value: _this2.props.value,
460
- startDate: _this2.state.startDate,
461
- highlightedItem: allItems[_this2.state.highlightedIndex || 0]
424
+ children: [_mapInstanceProperty__default["default"](weekdays).call(weekdays, weekday => jsxRuntime.jsx(calendarUtils.CalendarDay, {
425
+ type: "heading",
426
+ children: weekday
427
+ }, weekday)), _mapInstanceProperty__default["default"](paddingDays).call(paddingDays, (_, index) => jsxRuntime.jsx(calendarUtils.CalendarDay, {
428
+ type: "spacing"
429
+ }, index)), _mapInstanceProperty__default["default"](calendarItems).call(calendarItems, (item, index) => {
430
+ const isHighlighted = this.state.suggestedItems.length + index === highlightedIndex;
431
+
432
+ const _getRange = getRange({
433
+ item,
434
+ value: this.props.value,
435
+ startDate: this.state.startDate,
436
+ highlightedItem: allItems[this.state.highlightedIndex || 0]
462
437
  }),
463
- isRangeStart = _getRange.isRangeStart,
464
- isRangeBetween = _getRange.isRangeBetween,
465
- isRangeEnd = _getRange.isRangeEnd;
438
+ isRangeStart = _getRange.isRangeStart,
439
+ isRangeBetween = _getRange.isRangeBetween,
440
+ isRangeEnd = _getRange.isRangeEnd;
466
441
 
467
442
  return jsxRuntime.jsx(calendarUtils.CalendarDay, _objectSpread(_objectSpread({
468
443
  isToday: calendarUtils.isSameDay(today, item)
469
444
  }, getItemProps({
470
- disabled: _this2.props.isDisabled,
471
- item: item,
472
- onMouseOut: function onMouseOut() {
445
+ disabled: this.props.isDisabled,
446
+ item,
447
+ onMouseOut: () => {
473
448
  // @ts-ignore
474
449
  setHighlightedIndex(null);
475
450
  }
@@ -494,7 +469,7 @@ var DateRangeInput = /*#__PURE__*/function (_Component) {
494
469
  // We need to update the input value string in case so that is is formatted
495
470
  // according to the locale and holds the current value in case the value
496
471
  // changes or when the locale changes
497
- var shouldUpdateInputValue = !isSameRange(props.value, state.prevValue) || props.intl.locale !== state.prevLocale;
472
+ const shouldUpdateInputValue = !isSameRange(props.value, state.prevValue) || props.intl.locale !== state.prevLocale;
498
473
  if (!shouldUpdateInputValue) return null;
499
474
  return {
500
475
  prevLocale: props.intl.locale,
@@ -514,9 +489,7 @@ DateRangeInput.defaultProps = {
514
489
  isClearable: true
515
490
  };
516
491
 
517
- DateRangeInput.isEmpty = function (range) {
518
- return range.length === 0;
519
- };
492
+ DateRangeInput.isEmpty = range => range.length === 0;
520
493
 
521
494
  DateRangeInput.propTypes = process.env.NODE_ENV !== "production" ? {
522
495
  horizontalConstraint: _pt__default["default"].oneOf([6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto']),
@@ -538,7 +511,7 @@ DateRangeInput.propTypes = process.env.NODE_ENV !== "production" ? {
538
511
  var dateRangeInput = reactIntl.injectIntl(DateRangeInput);
539
512
 
540
513
  // NOTE: This string will be replaced on build time with the package version.
541
- var version = "15.15.0";
514
+ var version = "16.0.0";
542
515
 
543
516
  exports["default"] = dateRangeInput;
544
517
  exports.version = version;