@zendeskgarden/react-datepickers 8.57.0 → 8.58.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.
package/dist/index.cjs.js CHANGED
@@ -41,161 +41,8 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
41
41
  var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
42
42
  var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
43
43
 
44
- function ownKeys(object, enumerableOnly) {
45
- var keys = Object.keys(object);
46
-
47
- if (Object.getOwnPropertySymbols) {
48
- var symbols = Object.getOwnPropertySymbols(object);
49
- enumerableOnly && (symbols = symbols.filter(function (sym) {
50
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
51
- })), keys.push.apply(keys, symbols);
52
- }
53
-
54
- return keys;
55
- }
56
-
57
- function _objectSpread2(target) {
58
- for (var i = 1; i < arguments.length; i++) {
59
- var source = null != arguments[i] ? arguments[i] : {};
60
- i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
61
- _defineProperty(target, key, source[key]);
62
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
63
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
64
- });
65
- }
66
-
67
- return target;
68
- }
69
-
70
- function _defineProperty(obj, key, value) {
71
- if (key in obj) {
72
- Object.defineProperty(obj, key, {
73
- value: value,
74
- enumerable: true,
75
- configurable: true,
76
- writable: true
77
- });
78
- } else {
79
- obj[key] = value;
80
- }
81
-
82
- return obj;
83
- }
84
-
85
- function _extends$2() {
86
- _extends$2 = Object.assign ? Object.assign.bind() : function (target) {
87
- for (var i = 1; i < arguments.length; i++) {
88
- var source = arguments[i];
89
-
90
- for (var key in source) {
91
- if (Object.prototype.hasOwnProperty.call(source, key)) {
92
- target[key] = source[key];
93
- }
94
- }
95
- }
96
-
97
- return target;
98
- };
99
- return _extends$2.apply(this, arguments);
100
- }
101
-
102
- function _objectWithoutPropertiesLoose(source, excluded) {
103
- if (source == null) return {};
104
- var target = {};
105
- var sourceKeys = Object.keys(source);
106
- var key, i;
107
-
108
- for (i = 0; i < sourceKeys.length; i++) {
109
- key = sourceKeys[i];
110
- if (excluded.indexOf(key) >= 0) continue;
111
- target[key] = source[key];
112
- }
113
-
114
- return target;
115
- }
116
-
117
- function _objectWithoutProperties(source, excluded) {
118
- if (source == null) return {};
119
-
120
- var target = _objectWithoutPropertiesLoose(source, excluded);
121
-
122
- var key, i;
123
-
124
- if (Object.getOwnPropertySymbols) {
125
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
126
-
127
- for (i = 0; i < sourceSymbolKeys.length; i++) {
128
- key = sourceSymbolKeys[i];
129
- if (excluded.indexOf(key) >= 0) continue;
130
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
131
- target[key] = source[key];
132
- }
133
- }
134
-
135
- return target;
136
- }
137
-
138
- function _slicedToArray(arr, i) {
139
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
140
- }
141
-
142
- function _arrayWithHoles(arr) {
143
- if (Array.isArray(arr)) return arr;
144
- }
145
-
146
- function _iterableToArrayLimit(arr, i) {
147
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
148
-
149
- if (_i == null) return;
150
- var _arr = [];
151
- var _n = true;
152
- var _d = false;
153
-
154
- var _s, _e;
155
-
156
- try {
157
- for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
158
- _arr.push(_s.value);
159
-
160
- if (i && _arr.length === i) break;
161
- }
162
- } catch (err) {
163
- _d = true;
164
- _e = err;
165
- } finally {
166
- try {
167
- if (!_n && _i["return"] != null) _i["return"]();
168
- } finally {
169
- if (_d) throw _e;
170
- }
171
- }
172
-
173
- return _arr;
174
- }
175
-
176
- function _unsupportedIterableToArray(o, minLen) {
177
- if (!o) return;
178
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
179
- var n = Object.prototype.toString.call(o).slice(8, -1);
180
- if (n === "Object" && o.constructor) n = o.constructor.name;
181
- if (n === "Map" || n === "Set") return Array.from(o);
182
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
183
- }
184
-
185
- function _arrayLikeToArray(arr, len) {
186
- if (len == null || len > arr.length) len = arr.length;
187
-
188
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
189
-
190
- return arr2;
191
- }
192
-
193
- function _nonIterableRest() {
194
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
195
- }
196
-
197
- var SHARED_PLACEMENT = ['auto', 'top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end'];
198
- var PLACEMENT = [].concat(SHARED_PLACEMENT, ['end', 'end-top', 'end-bottom', 'start', 'start-top', 'start-bottom']);
44
+ const SHARED_PLACEMENT = ['auto', 'top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end'];
45
+ const PLACEMENT = [...SHARED_PLACEMENT, 'end', 'end-top', 'end-bottom', 'start', 'start-top', 'start-bottom'];
199
46
 
200
47
  function getPopperPlacement(gardenPlacement) {
201
48
  switch (gardenPlacement) {
@@ -216,7 +63,7 @@ function getPopperPlacement(gardenPlacement) {
216
63
  }
217
64
  }
218
65
  function getRtlPopperPlacement(gardenPlacement) {
219
- var popperPlacement = getPopperPlacement(gardenPlacement);
66
+ const popperPlacement = getPopperPlacement(gardenPlacement);
220
67
  switch (popperPlacement) {
221
68
  case 'left':
222
69
  return 'right';
@@ -415,216 +262,173 @@ function getDate(dirtyDate) {
415
262
  return dayOfMonth;
416
263
  }
417
264
 
418
- var COMPONENT_ID$b = 'datepickers.menu';
419
- var StyledMenu = styled__default["default"].div.attrs({
265
+ const COMPONENT_ID$b = 'datepickers.menu';
266
+ const StyledMenu = styled__default["default"].div.attrs({
420
267
  'data-garden-id': COMPONENT_ID$b,
421
- 'data-garden-version': '8.57.0'
268
+ 'data-garden-version': '8.58.0'
422
269
  }).withConfig({
423
270
  displayName: "StyledMenu",
424
271
  componentId: "sc-1npbkk0-0"
425
- })(["", ";"], function (props) {
426
- return reactTheming.retrieveComponentStyles(COMPONENT_ID$b, props);
427
- });
272
+ })(["", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$b, props));
428
273
  StyledMenu.defaultProps = {
429
274
  theme: reactTheming.DEFAULT_THEME
430
275
  };
431
276
 
432
- var COMPONENT_ID$a = 'datepickers.menu_wrapper';
433
- var StyledMenuWrapper = styled__default["default"].div.attrs(function (props) {
434
- return {
435
- className: props.isAnimated && 'is-animated'
436
- };
437
- }).withConfig({
277
+ const COMPONENT_ID$a = 'datepickers.menu_wrapper';
278
+ const StyledMenuWrapper = styled__default["default"].div.attrs(props => ({
279
+ className: props.isAnimated && 'is-animated'
280
+ })).withConfig({
438
281
  displayName: "StyledMenuWrapper",
439
282
  componentId: "sc-6fowoz-0"
440
- })(["", ";", ";"], function (props) {
441
- return reactTheming.menuStyles(getMenuPosition(props.placement), {
442
- theme: props.theme,
443
- hidden: props.isHidden,
444
- margin: "".concat(props.theme.space.base, "px"),
445
- zIndex: props.zIndex,
446
- animationModifier: props.isAnimated ? '.is-animated' : undefined
447
- });
448
- }, function (props) {
449
- return reactTheming.retrieveComponentStyles(COMPONENT_ID$a, props);
450
- });
283
+ })(["", ";", ";"], props => reactTheming.menuStyles(getMenuPosition(props.placement), {
284
+ theme: props.theme,
285
+ hidden: props.isHidden,
286
+ margin: `${props.theme.space.base}px`,
287
+ zIndex: props.zIndex,
288
+ animationModifier: props.isAnimated ? '.is-animated' : undefined
289
+ }), props => reactTheming.retrieveComponentStyles(COMPONENT_ID$a, props));
451
290
  StyledMenuWrapper.defaultProps = {
452
291
  theme: reactTheming.DEFAULT_THEME
453
292
  };
454
293
 
455
- var COMPONENT_ID$9 = 'datepickers.datepicker';
456
- var retrievePadding = function retrievePadding(_ref) {
457
- var isCompact = _ref.isCompact,
458
- theme = _ref.theme;
459
- var value = theme.space.base * 5;
294
+ const COMPONENT_ID$9 = 'datepickers.datepicker';
295
+ const retrievePadding = _ref => {
296
+ let {
297
+ isCompact,
298
+ theme
299
+ } = _ref;
300
+ let value = theme.space.base * 5;
460
301
  if (isCompact) {
461
302
  value = theme.space.base * 4;
462
303
  }
463
- return "margin: ".concat(value, "px;");
304
+ return `margin: ${value}px;`;
464
305
  };
465
- var StyledDatepicker = styled__default["default"].div.attrs({
306
+ const StyledDatepicker = styled__default["default"].div.attrs({
466
307
  'data-garden-id': COMPONENT_ID$9
467
308
  }).withConfig({
468
309
  displayName: "StyledDatepicker",
469
310
  componentId: "sc-w3zqsp-0"
470
- })(["direction:", ";", " background-color:", ";color:", ";", ";"], function (props) {
471
- return props.theme.rtl && 'rtl';
472
- }, retrievePadding, function (props) {
473
- return props.theme.colors.background;
474
- }, function (props) {
475
- return props.theme.colors.foreground;
476
- }, function (props) {
477
- return reactTheming.retrieveComponentStyles(COMPONENT_ID$9, props);
478
- });
311
+ })(["direction:", ";", " background-color:", ";color:", ";", ";"], props => props.theme.rtl && 'rtl', retrievePadding, props => props.theme.colors.background, props => props.theme.colors.foreground, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$9, props));
479
312
  StyledDatepicker.defaultProps = {
480
313
  theme: reactTheming.DEFAULT_THEME
481
314
  };
482
315
 
483
- var COMPONENT_ID$8 = 'datepickers.range_calendar';
484
- var StyledRangeCalendar = styled__default["default"].div.attrs({
316
+ const COMPONENT_ID$8 = 'datepickers.range_calendar';
317
+ const StyledRangeCalendar = styled__default["default"].div.attrs({
485
318
  'data-garden-id': COMPONENT_ID$8
486
319
  }).withConfig({
487
320
  displayName: "StyledRangeCalendar",
488
321
  componentId: "sc-1og46sy-0"
489
- })(["display:flex;overflow:auto;", "{margin:0;", "}", ";"], StyledDatepicker, function (props) {
490
- return props.theme.rtl ? "&:last-of-type {margin-right: ".concat(props.theme.space.base * 5, "px}") : "&:first-of-type {margin-right: ".concat(props.theme.space.base * 5, "px}");
491
- }, function (props) {
492
- return reactTheming.retrieveComponentStyles(COMPONENT_ID$8, props);
493
- });
322
+ })(["display:flex;overflow:auto;", "{margin:0;", "}", ";"], StyledDatepicker, props => props.theme.rtl ? `&:last-of-type {margin-right: ${props.theme.space.base * 5}px}` : `&:first-of-type {margin-right: ${props.theme.space.base * 5}px}`, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$8, props));
494
323
  StyledRangeCalendar.defaultProps = {
495
324
  theme: reactTheming.DEFAULT_THEME
496
325
  };
497
326
 
498
- var COMPONENT_ID$7 = 'datepickers.header';
499
- var StyledHeader = styled__default["default"].div.attrs({
327
+ const COMPONENT_ID$7 = 'datepickers.header';
328
+ const StyledHeader = styled__default["default"].div.attrs({
500
329
  'data-garden-id': COMPONENT_ID$7
501
330
  }).withConfig({
502
331
  displayName: "StyledHeader",
503
332
  componentId: "sc-upq318-0"
504
- })(["display:flex;width:", "px;", ";"], function (props) {
505
- return props.isCompact ? props.theme.space.base * 56 : props.theme.space.base * 70;
506
- }, function (props) {
507
- return reactTheming.retrieveComponentStyles(COMPONENT_ID$7, props);
508
- });
333
+ })(["display:flex;width:", "px;", ";"], props => props.isCompact ? props.theme.space.base * 56 : props.theme.space.base * 70, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$7, props));
509
334
  StyledHeader.defaultProps = {
510
335
  theme: reactTheming.DEFAULT_THEME
511
336
  };
512
337
 
513
- var retrieveSizing = function retrieveSizing(_ref) {
514
- var isCompact = _ref.isCompact,
515
- theme = _ref.theme;
516
- var size = theme.space.base * 10;
338
+ const retrieveSizing = _ref => {
339
+ let {
340
+ isCompact,
341
+ theme
342
+ } = _ref;
343
+ let size = theme.space.base * 10;
517
344
  if (isCompact) {
518
345
  size = theme.space.base * 8;
519
346
  }
520
347
  return styled.css(["width:", "px;height:", "px;"], size, size);
521
348
  };
522
- var retrieveColor$1 = function retrieveColor(_ref2) {
523
- var theme = _ref2.theme;
349
+ const retrieveColor$1 = _ref2 => {
350
+ let {
351
+ theme
352
+ } = _ref2;
524
353
  return styled.css([":hover{background-color:", ";color:", ";}:active{background-color:", ";color:", ";}color:", ";"], reactTheming.getColor('primaryHue', 600, theme, 0.08), theme.colors.foreground, reactTheming.getColor('primaryHue', 600, theme, 0.2), theme.colors.foreground, reactTheming.getColor('neutralHue', 600, theme));
525
354
  };
526
- var COMPONENT_ID$6 = 'datepickers.header_paddle';
527
- var StyledHeaderPaddle = styled__default["default"].div.attrs({
355
+ const COMPONENT_ID$6 = 'datepickers.header_paddle';
356
+ const StyledHeaderPaddle = styled__default["default"].div.attrs({
528
357
  'data-garden-id': COMPONENT_ID$6
529
358
  }).withConfig({
530
359
  displayName: "StyledHeaderPaddle",
531
360
  componentId: "sc-2oqh0g-0"
532
- })(["display:flex;align-items:center;justify-content:center;transform:", ";visibility:", ";border-radius:50%;cursor:pointer;", " ", " svg{width:", ";height:", ";}", ";"], function (props) {
533
- return props.theme.rtl && 'rotate(180deg)';
534
- }, function (props) {
535
- return props.isHidden && 'hidden';
536
- },
537
- retrieveSizing, retrieveColor$1, function (props) {
538
- return "".concat(props.theme.iconSizes.md);
539
- }, function (props) {
540
- return "".concat(props.theme.iconSizes.md);
541
- }, function (props) {
542
- return reactTheming.retrieveComponentStyles(COMPONENT_ID$6, props);
543
- });
361
+ })(["display:flex;align-items:center;justify-content:center;transform:", ";visibility:", ";border-radius:50%;cursor:pointer;", " ", " svg{width:", ";height:", ";}", ";"], props => props.theme.rtl && 'rotate(180deg)', props => props.isHidden && 'hidden', retrieveSizing, retrieveColor$1, props => `${props.theme.iconSizes.md}`, props => `${props.theme.iconSizes.md}`, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$6, props));
544
362
  StyledHeaderPaddle.defaultProps = {
545
363
  theme: reactTheming.DEFAULT_THEME
546
364
  };
547
365
 
548
- var COMPONENT_ID$5 = 'datepickers.header_label';
549
- var StyledHeaderLabel = styled__default["default"].div.attrs({
366
+ const COMPONENT_ID$5 = 'datepickers.header_label';
367
+ const StyledHeaderLabel = styled__default["default"].div.attrs({
550
368
  'data-garden-id': COMPONENT_ID$5
551
369
  }).withConfig({
552
370
  displayName: "StyledHeaderLabel",
553
371
  componentId: "sc-1ryf5ub-0"
554
- })(["display:flex;flex-grow:1;align-items:center;justify-content:center;font-size:", ";font-weight:", ";", ";"], function (props) {
555
- return props.isCompact ? props.theme.fontSizes.sm : props.theme.fontSizes.md;
556
- }, function (props) {
557
- return props.theme.fontWeights.semibold;
558
- }, function (props) {
559
- return reactTheming.retrieveComponentStyles(COMPONENT_ID$5, props);
560
- });
372
+ })(["display:flex;flex-grow:1;align-items:center;justify-content:center;font-size:", ";font-weight:", ";", ";"], props => props.isCompact ? props.theme.fontSizes.sm : props.theme.fontSizes.md, props => props.theme.fontWeights.semibold, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$5, props));
561
373
  StyledHeaderLabel.defaultProps = {
562
374
  theme: reactTheming.DEFAULT_THEME
563
375
  };
564
376
 
565
- var COMPONENT_ID$4 = 'datepickers.calendar';
566
- var StyledCalendar = styled__default["default"].div.attrs({
377
+ const COMPONENT_ID$4 = 'datepickers.calendar';
378
+ const StyledCalendar = styled__default["default"].div.attrs({
567
379
  'data-garden-id': COMPONENT_ID$4
568
380
  }).withConfig({
569
381
  displayName: "StyledCalendar",
570
382
  componentId: "sc-g5hoe8-0"
571
- })(["width:", "px;", ";"], function (props) {
572
- return props.isCompact ? props.theme.space.base * 56 : props.theme.space.base * 70;
573
- }, function (props) {
574
- return reactTheming.retrieveComponentStyles(COMPONENT_ID$4, props);
575
- });
383
+ })(["width:", "px;", ";"], props => props.isCompact ? props.theme.space.base * 56 : props.theme.space.base * 70, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$4, props));
576
384
  StyledCalendar.defaultProps = {
577
385
  theme: reactTheming.DEFAULT_THEME
578
386
  };
579
387
 
580
- var COMPONENT_ID$3 = 'datepickers.calendar_item';
581
- var retrieveSize = function retrieveSize(_ref) {
582
- var isCompact = _ref.isCompact,
583
- theme = _ref.theme;
584
- var size;
388
+ const COMPONENT_ID$3 = 'datepickers.calendar_item';
389
+ const retrieveSize = _ref => {
390
+ let {
391
+ isCompact,
392
+ theme
393
+ } = _ref;
394
+ let size;
585
395
  if (isCompact) {
586
- size = "".concat(theme.space.base * 8, "px");
396
+ size = `${theme.space.base * 8}px`;
587
397
  } else {
588
- size = "".concat(theme.space.base * 10, "px");
398
+ size = `${theme.space.base * 10}px`;
589
399
  }
590
400
  return styled.css(["width:", ";height:", ";"], size, size);
591
401
  };
592
- var StyledCalendarItem = styled__default["default"].div.attrs({
402
+ const StyledCalendarItem = styled__default["default"].div.attrs({
593
403
  'data-garden-id': COMPONENT_ID$3
594
404
  }).withConfig({
595
405
  displayName: "StyledCalendarItem",
596
406
  componentId: "sc-143w8wb-0"
597
- })(["display:inline-block;position:relative;vertical-align:top;", " ", ";"], retrieveSize, function (props) {
598
- return reactTheming.retrieveComponentStyles(COMPONENT_ID$3, props);
599
- });
407
+ })(["display:inline-block;position:relative;vertical-align:top;", " ", ";"], retrieveSize, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$3, props));
600
408
  StyledCalendarItem.defaultProps = {
601
409
  theme: reactTheming.DEFAULT_THEME
602
410
  };
603
411
 
604
- var COMPONENT_ID$2 = 'datepickers.day_label';
605
- var StyledDayLabel = styled__default["default"].div.attrs({
412
+ const COMPONENT_ID$2 = 'datepickers.day_label';
413
+ const StyledDayLabel = styled__default["default"].div.attrs({
606
414
  'data-garden-id': COMPONENT_ID$2
607
415
  }).withConfig({
608
416
  displayName: "StyledDayLabel",
609
417
  componentId: "sc-9bh1p7-0"
610
- })(["display:flex;align-items:center;justify-content:center;width:100%;height:100%;font-size:", ";font-weight:", ";", ";"], function (props) {
611
- return props.isCompact ? props.theme.fontSizes.sm : props.theme.fontSizes.md;
612
- }, function (props) {
613
- return props.theme.fontWeights.semibold;
614
- }, function (props) {
615
- return reactTheming.retrieveComponentStyles(COMPONENT_ID$2, props);
616
- });
418
+ })(["display:flex;align-items:center;justify-content:center;width:100%;height:100%;font-size:", ";font-weight:", ";", ";"], props => props.isCompact ? props.theme.fontSizes.sm : props.theme.fontSizes.md, props => props.theme.fontWeights.semibold, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$2, props));
617
419
  StyledDayLabel.defaultProps = {
618
420
  theme: reactTheming.DEFAULT_THEME
619
421
  };
620
422
 
621
- var COMPONENT_ID$1 = 'datepickers.highlight';
622
- var retrieveBorderRadius = function retrieveBorderRadius(_ref) {
623
- var theme = _ref.theme,
624
- isEnd = _ref.isEnd,
625
- isStart = _ref.isStart;
626
- var startValue = 'border-radius: 0 50% 50% 0;';
627
- var endValue = 'border-radius: 50% 0 0 50%;';
423
+ const COMPONENT_ID$1 = 'datepickers.highlight';
424
+ const retrieveBorderRadius = _ref => {
425
+ let {
426
+ theme,
427
+ isEnd,
428
+ isStart
429
+ } = _ref;
430
+ const startValue = 'border-radius: 0 50% 50% 0;';
431
+ const endValue = 'border-radius: 50% 0 0 50%;';
628
432
  if (theme.rtl) {
629
433
  if (isStart) {
630
434
  return startValue;
@@ -639,34 +443,36 @@ var retrieveBorderRadius = function retrieveBorderRadius(_ref) {
639
443
  }
640
444
  return '';
641
445
  };
642
- var retrieveColor = function retrieveColor(_ref2) {
643
- var isHighlighted = _ref2.isHighlighted,
644
- theme = _ref2.theme;
446
+ const retrieveColor = _ref2 => {
447
+ let {
448
+ isHighlighted,
449
+ theme
450
+ } = _ref2;
645
451
  if (isHighlighted) {
646
452
  return styled.css(["background-color:", ";"], reactTheming.getColor('primaryHue', 600, theme, 0.08));
647
453
  }
648
454
  return styled.css([""]);
649
455
  };
650
- var StyledHighlight = styled__default["default"].div.attrs({
456
+ const StyledHighlight = styled__default["default"].div.attrs({
651
457
  'data-garden-id': COMPONENT_ID$1
652
458
  }).withConfig({
653
459
  displayName: "StyledHighlight",
654
460
  componentId: "sc-16vr32x-0"
655
- })(["position:absolute;top:0;left:0;width:100%;height:100%;", " ", " ", ";"], retrieveBorderRadius, retrieveColor, function (props) {
656
- return reactTheming.retrieveComponentStyles(COMPONENT_ID$1, props);
657
- });
461
+ })(["position:absolute;top:0;left:0;width:100%;height:100%;", " ", " ", ";"], retrieveBorderRadius, retrieveColor, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$1, props));
658
462
  StyledHighlight.defaultProps = {
659
463
  theme: reactTheming.DEFAULT_THEME
660
464
  };
661
465
 
662
- var retrieveStyledDayColors = function retrieveStyledDayColors(_ref) {
663
- var isSelected = _ref.isSelected,
664
- isDisabled = _ref.isDisabled,
665
- isToday = _ref.isToday,
666
- isPreviousMonth = _ref.isPreviousMonth,
667
- theme = _ref.theme;
668
- var backgroundColor = 'inherit';
669
- var color = reactTheming.getColor('primaryHue', 600, theme);
466
+ const retrieveStyledDayColors = _ref => {
467
+ let {
468
+ isSelected,
469
+ isDisabled,
470
+ isToday,
471
+ isPreviousMonth,
472
+ theme
473
+ } = _ref;
474
+ let backgroundColor = 'inherit';
475
+ let color = reactTheming.getColor('primaryHue', 600, theme);
670
476
  if (isSelected && !isDisabled) {
671
477
  backgroundColor = reactTheming.getColor('primaryHue', 600, theme);
672
478
  color = theme.colors.background;
@@ -677,36 +483,36 @@ var retrieveStyledDayColors = function retrieveStyledDayColors(_ref) {
677
483
  } else if (isPreviousMonth) {
678
484
  color = reactTheming.getColor('neutralHue', 600, theme);
679
485
  }
680
- return styled.css(["background-color:", ";color:", ";", ""], backgroundColor, color, !isSelected && !isDisabled && "\n :hover {\n background-color: ".concat(reactTheming.getColor('primaryHue', 600, theme, 0.08), ";\n color: ").concat(reactTheming.getColor('primaryHue', 800, theme), ";\n }\n\n :active {\n background-color: ").concat(reactTheming.getColor('primaryHue', 600, theme, 0.2), ";\n color: ").concat(reactTheming.getColor('primaryHue', 800, theme), ";\n }\n "));
486
+ return styled.css(["background-color:", ";color:", ";", ""], backgroundColor, color, !isSelected && !isDisabled && `
487
+ :hover {
488
+ background-color: ${reactTheming.getColor('primaryHue', 600, theme, 0.08)};
489
+ color: ${reactTheming.getColor('primaryHue', 800, theme)};
490
+ }
491
+
492
+ :active {
493
+ background-color: ${reactTheming.getColor('primaryHue', 600, theme, 0.2)};
494
+ color: ${reactTheming.getColor('primaryHue', 800, theme)};
495
+ }
496
+ `);
681
497
  };
682
- var COMPONENT_ID = 'datepickers.day';
683
- var StyledDay = styled__default["default"].div.attrs(function (props) {
684
- return {
685
- 'data-garden-id': COMPONENT_ID,
686
- 'aria-disabled': props.isDisabled ? 'true' : 'false'
687
- };
688
- }).withConfig({
498
+ const COMPONENT_ID = 'datepickers.day';
499
+ const StyledDay = styled__default["default"].div.attrs(props => ({
500
+ 'data-garden-id': COMPONENT_ID,
501
+ 'aria-disabled': props.isDisabled ? 'true' : 'false'
502
+ })).withConfig({
689
503
  displayName: "StyledDay",
690
504
  componentId: "sc-v42uk5-0"
691
- })(["display:flex;position:absolute;align-items:center;justify-content:center;border-radius:50%;cursor:", ";width:100%;height:100%;font-size:", ";font-weight:", ";", " ", ";"], function (props) {
692
- return props.isDisabled ? 'inherit' : 'pointer';
693
- }, function (props) {
694
- return props.isCompact ? props.theme.fontSizes.sm : props.theme.fontSizes.md;
695
- }, function (props) {
696
- return props.isToday && !props.isDisabled ? props.theme.fontWeights.semibold : 'inherit';
697
- }, retrieveStyledDayColors, function (props) {
698
- return reactTheming.retrieveComponentStyles(COMPONENT_ID, props);
699
- });
505
+ })(["display:flex;position:absolute;align-items:center;justify-content:center;border-radius:50%;cursor:", ";width:100%;height:100%;font-size:", ";font-weight:", ";", " ", ";"], props => props.isDisabled ? 'inherit' : 'pointer', props => props.isCompact ? props.theme.fontSizes.sm : props.theme.fontSizes.md, props => props.isToday && !props.isDisabled ? props.theme.fontWeights.semibold : 'inherit', retrieveStyledDayColors, props => reactTheming.retrieveComponentStyles(COMPONENT_ID, props));
700
506
  StyledDay.defaultProps = {
701
507
  theme: reactTheming.DEFAULT_THEME
702
508
  };
703
509
 
704
- var DatepickerContext = React.createContext(undefined);
705
- var useDatepickerContext$1 = function useDatepickerContext() {
510
+ const DatepickerContext = React.createContext(undefined);
511
+ const useDatepickerContext$1 = () => {
706
512
  return React.useContext(DatepickerContext);
707
513
  };
708
514
 
709
- var REGION_MAPPINGS = {
515
+ const REGION_MAPPINGS = {
710
516
  'ar-DZ': 0,
711
517
  'ar-SA': 0,
712
518
  'en-CA': 0,
@@ -719,7 +525,7 @@ var REGION_MAPPINGS = {
719
525
  'zh-CN': 1,
720
526
  'zh-TW': 1
721
527
  };
722
- var LANGUAGE_MAPPINGS = {
528
+ const LANGUAGE_MAPPINGS = {
723
529
  af: 0,
724
530
  ar: 6,
725
531
  be: 1,
@@ -774,12 +580,12 @@ function getStartOfWeek(locale) {
774
580
  if (!locale) {
775
581
  return 0;
776
582
  }
777
- for (var region in REGION_MAPPINGS) {
583
+ for (const region in REGION_MAPPINGS) {
778
584
  if (locale.startsWith(region)) {
779
585
  return REGION_MAPPINGS[region];
780
586
  }
781
587
  }
782
- for (var language in LANGUAGE_MAPPINGS) {
588
+ for (const language in LANGUAGE_MAPPINGS) {
783
589
  if (locale.startsWith(language)) {
784
590
  return LANGUAGE_MAPPINGS[language];
785
591
  }
@@ -789,16 +595,17 @@ function getStartOfWeek(locale) {
789
595
 
790
596
  var _path$1;
791
597
 
792
- function _extends$1() { _extends$1 = Object.assign ? Object.assign.bind() : 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$1.apply(this, arguments); }
598
+ function _extends$2() { _extends$2 = Object.assign ? Object.assign.bind() : 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$2.apply(this, arguments); }
793
599
 
794
600
  var SvgChevronLeftStroke = function SvgChevronLeftStroke(props) {
795
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$1({
601
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$2({
796
602
  xmlns: "http://www.w3.org/2000/svg",
797
603
  width: 16,
798
604
  height: 16,
799
605
  focusable: "false",
800
606
  viewBox: "0 0 16 16",
801
- "aria-hidden": "true"
607
+ "aria-hidden": "true",
608
+ role: "img"
802
609
  }, props), _path$1 || (_path$1 = /*#__PURE__*/React__namespace.createElement("path", {
803
610
  fill: "currentColor",
804
611
  d: "M10.39 12.688a.5.5 0 01-.718.69l-.062-.066-4-5a.5.5 0 01-.054-.542l.054-.082 4-5a.5.5 0 01.83.55l-.05.074L6.641 8l3.75 4.688z"
@@ -807,30 +614,34 @@ var SvgChevronLeftStroke = function SvgChevronLeftStroke(props) {
807
614
 
808
615
  var _path;
809
616
 
810
- function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
617
+ function _extends$1() { _extends$1 = Object.assign ? Object.assign.bind() : 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$1.apply(this, arguments); }
811
618
 
812
619
  var SvgChevronRightStroke = function SvgChevronRightStroke(props) {
813
- return /*#__PURE__*/React__namespace.createElement("svg", _extends({
620
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$1({
814
621
  xmlns: "http://www.w3.org/2000/svg",
815
622
  width: 16,
816
623
  height: 16,
817
624
  focusable: "false",
818
625
  viewBox: "0 0 16 16",
819
- "aria-hidden": "true"
626
+ "aria-hidden": "true",
627
+ role: "img"
820
628
  }, props), _path || (_path = /*#__PURE__*/React__namespace.createElement("path", {
821
629
  fill: "currentColor",
822
630
  d: "M5.61 3.312a.5.5 0 01.718-.69l.062.066 4 5a.5.5 0 01.054.542l-.054.082-4 5a.5.5 0 01-.83-.55l.05-.074L9.359 8l-3.75-4.688z"
823
631
  })));
824
632
  };
825
633
 
826
- var MonthSelector = function MonthSelector(_ref) {
827
- var locale = _ref.locale,
828
- isCompact = _ref.isCompact;
829
- var _useDatepickerContext = useDatepickerContext$1(),
830
- state = _useDatepickerContext.state,
831
- dispatch = _useDatepickerContext.dispatch;
832
- var headerLabelFormatter = React.useCallback(function (date) {
833
- var formatter = new Intl.DateTimeFormat(locale, {
634
+ const MonthSelector = _ref => {
635
+ let {
636
+ locale,
637
+ isCompact
638
+ } = _ref;
639
+ const {
640
+ state,
641
+ dispatch
642
+ } = useDatepickerContext$1();
643
+ const headerLabelFormatter = React.useCallback(date => {
644
+ const formatter = new Intl.DateTimeFormat(locale, {
834
645
  month: 'long',
835
646
  year: 'numeric'
836
647
  });
@@ -840,7 +651,7 @@ var MonthSelector = function MonthSelector(_ref) {
840
651
  isCompact: isCompact
841
652
  }, React__default["default"].createElement(StyledHeaderPaddle, {
842
653
  isCompact: isCompact,
843
- onClick: function onClick() {
654
+ onClick: () => {
844
655
  dispatch({
845
656
  type: 'PREVIEW_PREVIOUS_MONTH'
846
657
  });
@@ -849,7 +660,7 @@ var MonthSelector = function MonthSelector(_ref) {
849
660
  isCompact: isCompact
850
661
  }, headerLabelFormatter(state.previewDate)), React__default["default"].createElement(StyledHeaderPaddle, {
851
662
  isCompact: isCompact,
852
- onClick: function onClick() {
663
+ onClick: () => {
853
664
  dispatch({
854
665
  type: 'PREVIEW_NEXT_MONTH'
855
666
  });
@@ -857,52 +668,55 @@ var MonthSelector = function MonthSelector(_ref) {
857
668
  }, React__default["default"].createElement(SvgChevronRightStroke, null)));
858
669
  };
859
670
 
860
- var Calendar$1 = React.forwardRef(function (_ref, ref) {
861
- var value = _ref.value,
862
- minValue = _ref.minValue,
863
- maxValue = _ref.maxValue,
864
- isCompact = _ref.isCompact,
865
- locale = _ref.locale,
866
- weekStartsOn = _ref.weekStartsOn;
867
- var _useDatepickerContext = useDatepickerContext$1(),
868
- state = _useDatepickerContext.state,
869
- dispatch = _useDatepickerContext.dispatch;
870
- var preferredWeekStartsOn = weekStartsOn || getStartOfWeek(locale);
871
- var monthStartDate = startOfMonth(state.previewDate);
872
- var monthEndDate = endOfMonth(monthStartDate);
873
- var startDate = startOfWeek(monthStartDate, {
671
+ const Calendar$1 = React.forwardRef((_ref, ref) => {
672
+ let {
673
+ value,
674
+ minValue,
675
+ maxValue,
676
+ isCompact,
677
+ locale,
678
+ weekStartsOn
679
+ } = _ref;
680
+ const {
681
+ state,
682
+ dispatch
683
+ } = useDatepickerContext$1();
684
+ const preferredWeekStartsOn = weekStartsOn || getStartOfWeek(locale);
685
+ const monthStartDate = startOfMonth(state.previewDate);
686
+ const monthEndDate = endOfMonth(monthStartDate);
687
+ const startDate = startOfWeek(monthStartDate, {
874
688
  weekStartsOn: preferredWeekStartsOn
875
689
  });
876
- var endDate = endOfWeek(monthEndDate, {
690
+ const endDate = endOfWeek(monthEndDate, {
877
691
  weekStartsOn: preferredWeekStartsOn
878
692
  });
879
- var dayLabelFormatter = React.useCallback(function (date) {
880
- var formatter = new Intl.DateTimeFormat(locale, {
693
+ const dayLabelFormatter = React.useCallback(date => {
694
+ const formatter = new Intl.DateTimeFormat(locale, {
881
695
  weekday: 'short'
882
696
  });
883
697
  return formatter.format(date);
884
698
  }, [locale]);
885
- var dayLabels = eachDayOfInterval({
699
+ const dayLabels = eachDayOfInterval({
886
700
  start: startDate,
887
701
  end: addDays(startDate, 6)
888
- }).map(function (date) {
889
- var formattedDayLabel = dayLabelFormatter(date);
702
+ }).map(date => {
703
+ const formattedDayLabel = dayLabelFormatter(date);
890
704
  return React__default["default"].createElement(StyledCalendarItem, {
891
- key: "day-label-".concat(formattedDayLabel),
705
+ key: `day-label-${formattedDayLabel}`,
892
706
  isCompact: isCompact
893
707
  }, React__default["default"].createElement(StyledDayLabel, {
894
708
  isCompact: isCompact
895
709
  }, formattedDayLabel));
896
710
  });
897
- var items = eachDayOfInterval({
711
+ const items = eachDayOfInterval({
898
712
  start: startDate,
899
713
  end: endDate
900
- }).map(function (date, itemsIndex) {
901
- var formattedDayLabel = getDate(date);
902
- var isCurrentDate = isToday(date);
903
- var isPreviousMonth = !isSameMonth(date, state.previewDate);
904
- var isSelected = value && isSameDay(date, value);
905
- var isDisabled = false;
714
+ }).map((date, itemsIndex) => {
715
+ const formattedDayLabel = getDate(date);
716
+ const isCurrentDate = isToday(date);
717
+ const isPreviousMonth = !isSameMonth(date, state.previewDate);
718
+ const isSelected = value && isSameDay(date, value);
719
+ let isDisabled = false;
906
720
  if (minValue !== undefined) {
907
721
  isDisabled = isBefore(date, minValue) && !isSameDay(date, minValue);
908
722
  }
@@ -910,7 +724,7 @@ var Calendar$1 = React.forwardRef(function (_ref, ref) {
910
724
  isDisabled = isDisabled || isAfter(date, maxValue) && !isSameDay(date, maxValue);
911
725
  }
912
726
  return React__default["default"].createElement(StyledCalendarItem, {
913
- key: "day-".concat(itemsIndex),
727
+ key: `day-${itemsIndex}`,
914
728
  isCompact: isCompact
915
729
  }, React__default["default"].createElement(StyledDay, {
916
730
  isToday: isCurrentDate,
@@ -918,7 +732,7 @@ var Calendar$1 = React.forwardRef(function (_ref, ref) {
918
732
  isSelected: isSelected,
919
733
  isDisabled: isDisabled,
920
734
  isCompact: isCompact,
921
- onClick: function onClick() {
735
+ onClick: () => {
922
736
  if (!isDisabled) {
923
737
  dispatch({
924
738
  type: 'SELECT_DATE',
@@ -931,7 +745,7 @@ var Calendar$1 = React.forwardRef(function (_ref, ref) {
931
745
  return React__default["default"].createElement(StyledDatepicker, {
932
746
  ref: ref,
933
747
  isCompact: isCompact,
934
- onMouseDown: function onMouseDown(e) {
748
+ onMouseDown: e => {
935
749
  e.preventDefault();
936
750
  }
937
751
  }, React__default["default"].createElement(MonthSelector, {
@@ -1101,6 +915,7 @@ var formatLong = {
1101
915
  defaultWidth: 'full'
1102
916
  })
1103
917
  };
918
+ var formatLong$1 = formatLong;
1104
919
 
1105
920
  var formatRelativeLocale = {
1106
921
  lastWeek: "'last' eeee 'at' p",
@@ -1261,6 +1076,7 @@ var localize = {
1261
1076
  defaultFormattingWidth: 'wide'
1262
1077
  })
1263
1078
  };
1079
+ var localize$1 = localize;
1264
1080
 
1265
1081
  function buildMatchPatternFn(args) {
1266
1082
  return function (string) {
@@ -1418,20 +1234,22 @@ var match = {
1418
1234
  defaultParseWidth: 'any'
1419
1235
  })
1420
1236
  };
1237
+ var match$1 = match;
1421
1238
 
1422
1239
  var locale = {
1423
1240
  code: 'en-US',
1424
1241
  formatDistance: formatDistance,
1425
- formatLong: formatLong,
1242
+ formatLong: formatLong$1,
1426
1243
  formatRelative: formatRelative,
1427
- localize: localize,
1428
- match: match,
1244
+ localize: localize$1,
1245
+ match: match$1,
1429
1246
  options: {
1430
1247
  weekStartsOn: 0
1431
1248
  ,
1432
1249
  firstWeekContainsDate: 1
1433
1250
  }
1434
1251
  };
1252
+ var defaultLocale = locale;
1435
1253
 
1436
1254
  function addMilliseconds(dirtyDate, dirtyAmount) {
1437
1255
  requiredArgs(2, arguments);
@@ -1538,6 +1356,7 @@ var longFormatters = {
1538
1356
  p: timeLongFormatter,
1539
1357
  P: dateTimeLongFormatter
1540
1358
  };
1359
+ var longFormatters$1 = longFormatters;
1541
1360
 
1542
1361
  function getTimezoneOffsetInMilliseconds(date) {
1543
1362
  var utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));
@@ -2949,6 +2768,7 @@ var parsers = {
2949
2768
  incompatibleTokens: '*'
2950
2769
  }
2951
2770
  };
2771
+ var parsers$1 = parsers;
2952
2772
 
2953
2773
  var TIMEZONE_UNIT_PRIORITY = 10;
2954
2774
  var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
@@ -2962,17 +2782,17 @@ function parse(dirtyDateString, dirtyFormatString, dirtyReferenceDate, dirtyOpti
2962
2782
  var dateString = String(dirtyDateString);
2963
2783
  var formatString = String(dirtyFormatString);
2964
2784
  var options = dirtyOptions || {};
2965
- var locale$1 = options.locale || locale;
2966
- if (!locale$1.match) {
2785
+ var locale = options.locale || defaultLocale;
2786
+ if (!locale.match) {
2967
2787
  throw new RangeError('locale must contain match property');
2968
2788
  }
2969
- var localeFirstWeekContainsDate = locale$1.options && locale$1.options.firstWeekContainsDate;
2789
+ var localeFirstWeekContainsDate = locale.options && locale.options.firstWeekContainsDate;
2970
2790
  var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : toInteger(localeFirstWeekContainsDate);
2971
2791
  var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : toInteger(options.firstWeekContainsDate);
2972
2792
  if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
2973
2793
  throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
2974
2794
  }
2975
- var localeWeekStartsOn = locale$1.options && locale$1.options.weekStartsOn;
2795
+ var localeWeekStartsOn = locale.options && locale.options.weekStartsOn;
2976
2796
  var defaultWeekStartsOn = localeWeekStartsOn == null ? 0 : toInteger(localeWeekStartsOn);
2977
2797
  var weekStartsOn = options.weekStartsOn == null ? defaultWeekStartsOn : toInteger(options.weekStartsOn);
2978
2798
  if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
@@ -2988,7 +2808,7 @@ function parse(dirtyDateString, dirtyFormatString, dirtyReferenceDate, dirtyOpti
2988
2808
  var subFnOptions = {
2989
2809
  firstWeekContainsDate: firstWeekContainsDate,
2990
2810
  weekStartsOn: weekStartsOn,
2991
- locale: locale$1
2811
+ locale: locale
2992
2812
  };
2993
2813
  var setters = [{
2994
2814
  priority: TIMEZONE_UNIT_PRIORITY,
@@ -3000,8 +2820,8 @@ function parse(dirtyDateString, dirtyFormatString, dirtyReferenceDate, dirtyOpti
3000
2820
  var tokens = formatString.match(longFormattingTokensRegExp).map(function (substring) {
3001
2821
  var firstCharacter = substring[0];
3002
2822
  if (firstCharacter === 'p' || firstCharacter === 'P') {
3003
- var longFormatter = longFormatters[firstCharacter];
3004
- return longFormatter(substring, locale$1.formatLong, subFnOptions);
2823
+ var longFormatter = longFormatters$1[firstCharacter];
2824
+ return longFormatter(substring, locale.formatLong, subFnOptions);
3005
2825
  }
3006
2826
  return substring;
3007
2827
  }).join('').match(formattingTokensRegExp);
@@ -3015,7 +2835,7 @@ function parse(dirtyDateString, dirtyFormatString, dirtyReferenceDate, dirtyOpti
3015
2835
  throwProtectedError(token, formatString, dirtyDateString);
3016
2836
  }
3017
2837
  var firstCharacter = token[0];
3018
- var parser = parsers[firstCharacter];
2838
+ var parser = parsers$1[firstCharacter];
3019
2839
  if (parser) {
3020
2840
  var incompatibleTokens = parser.incompatibleTokens;
3021
2841
  if (Array.isArray(incompatibleTokens)) {
@@ -3037,7 +2857,7 @@ function parse(dirtyDateString, dirtyFormatString, dirtyReferenceDate, dirtyOpti
3037
2857
  token: firstCharacter,
3038
2858
  fullToken: token
3039
2859
  });
3040
- var parseResult = parser.parse(dateString, token, locale$1.match, subFnOptions);
2860
+ var parseResult = parser.parse(dateString, token, locale.match, subFnOptions);
3041
2861
  if (!parseResult) {
3042
2862
  return new Date(NaN);
3043
2863
  }
@@ -3119,13 +2939,15 @@ function cleanEscapedString(input) {
3119
2939
  }
3120
2940
 
3121
2941
  function parseInputValue$1(_ref) {
3122
- var inputValue = _ref.inputValue,
3123
- customParseDate = _ref.customParseDate;
2942
+ let {
2943
+ inputValue,
2944
+ customParseDate
2945
+ } = _ref;
3124
2946
  if (customParseDate) {
3125
2947
  return customParseDate(inputValue);
3126
2948
  }
3127
- var MINIMUM_DATE = new Date(1001, 0, 0);
3128
- var tryParseDate = parse(inputValue, 'P', new Date());
2949
+ const MINIMUM_DATE = new Date(1001, 0, 0);
2950
+ let tryParseDate = parse(inputValue, 'P', new Date());
3129
2951
  if (isValid(tryParseDate) && !isBefore(tryParseDate, MINIMUM_DATE)) {
3130
2952
  return tryParseDate;
3131
2953
  }
@@ -3140,9 +2962,11 @@ function parseInputValue$1(_ref) {
3140
2962
  return new Date(NaN);
3141
2963
  }
3142
2964
  function formatInputValue(_ref2) {
3143
- var date = _ref2.date,
3144
- locale = _ref2.locale,
3145
- formatDate = _ref2.formatDate;
2965
+ let {
2966
+ date,
2967
+ locale,
2968
+ formatDate
2969
+ } = _ref2;
3146
2970
  if (!date) {
3147
2971
  return '';
3148
2972
  }
@@ -3155,98 +2979,108 @@ function formatInputValue(_ref2) {
3155
2979
  year: 'numeric'
3156
2980
  }).format(date);
3157
2981
  }
3158
- var datepickerReducer = function datepickerReducer(_ref3) {
3159
- var value = _ref3.value,
3160
- formatDate = _ref3.formatDate,
3161
- locale = _ref3.locale,
3162
- customParseDate = _ref3.customParseDate,
3163
- onChange = _ref3.onChange;
3164
- return function (state, action) {
2982
+ const datepickerReducer = _ref3 => {
2983
+ let {
2984
+ value,
2985
+ formatDate,
2986
+ locale,
2987
+ customParseDate,
2988
+ onChange
2989
+ } = _ref3;
2990
+ return (state, action) => {
3165
2991
  switch (action.type) {
3166
2992
  case 'OPEN':
3167
- return _objectSpread2(_objectSpread2({}, state), {}, {
2993
+ return {
2994
+ ...state,
3168
2995
  isOpen: true,
3169
2996
  previewDate: value || new Date()
3170
- });
2997
+ };
3171
2998
  case 'CLOSE':
3172
2999
  {
3173
- var inputValue = formatInputValue({
3000
+ const inputValue = formatInputValue({
3174
3001
  date: value,
3175
- locale: locale,
3176
- formatDate: formatDate
3002
+ locale,
3003
+ formatDate
3177
3004
  });
3178
- return _objectSpread2(_objectSpread2({}, state), {}, {
3005
+ return {
3006
+ ...state,
3179
3007
  isOpen: false,
3180
- inputValue: inputValue
3181
- });
3008
+ inputValue
3009
+ };
3182
3010
  }
3183
3011
  case 'PREVIEW_NEXT_MONTH':
3184
3012
  {
3185
- var previewDate = addMonths(state.previewDate, 1);
3186
- return _objectSpread2(_objectSpread2({}, state), {}, {
3187
- previewDate: previewDate
3188
- });
3013
+ const previewDate = addMonths(state.previewDate, 1);
3014
+ return {
3015
+ ...state,
3016
+ previewDate
3017
+ };
3189
3018
  }
3190
3019
  case 'PREVIEW_PREVIOUS_MONTH':
3191
3020
  {
3192
- var _previewDate = subMonths(state.previewDate, 1);
3193
- return _objectSpread2(_objectSpread2({}, state), {}, {
3194
- previewDate: _previewDate
3195
- });
3021
+ const previewDate = subMonths(state.previewDate, 1);
3022
+ return {
3023
+ ...state,
3024
+ previewDate
3025
+ };
3196
3026
  }
3197
3027
  case 'MANUALLY_UPDATE_INPUT':
3198
3028
  {
3199
- var _inputValue = action.value;
3200
- var currentDate = parseInputValue$1({
3201
- inputValue: _inputValue,
3202
- customParseDate: customParseDate
3029
+ const inputValue = action.value;
3030
+ const currentDate = parseInputValue$1({
3031
+ inputValue,
3032
+ customParseDate
3203
3033
  });
3204
3034
  if (onChange && currentDate && isValid(currentDate) && !isSameDay(value, currentDate)) {
3205
3035
  onChange(currentDate);
3206
3036
  }
3207
- return _objectSpread2(_objectSpread2({}, state), {}, {
3037
+ return {
3038
+ ...state,
3208
3039
  isOpen: true,
3209
- inputValue: _inputValue
3210
- });
3040
+ inputValue
3041
+ };
3211
3042
  }
3212
3043
  case 'CONTROLLED_VALUE_CHANGE':
3213
3044
  {
3214
- var _previewDate2 = action.value || new Date();
3215
- var _inputValue2 = formatInputValue({
3045
+ const previewDate = action.value || new Date();
3046
+ const inputValue = formatInputValue({
3216
3047
  date: action.value,
3217
- locale: locale,
3218
- formatDate: formatDate
3219
- });
3220
- return _objectSpread2(_objectSpread2({}, state), {}, {
3221
- previewDate: _previewDate2,
3222
- inputValue: _inputValue2
3048
+ locale,
3049
+ formatDate
3223
3050
  });
3051
+ return {
3052
+ ...state,
3053
+ previewDate,
3054
+ inputValue
3055
+ };
3224
3056
  }
3225
3057
  case 'CONTROLLED_LOCALE_CHANGE':
3226
3058
  {
3227
- var _inputValue3 = formatInputValue({
3059
+ const inputValue = formatInputValue({
3228
3060
  date: value,
3229
- locale: locale,
3230
- formatDate: formatDate
3231
- });
3232
- return _objectSpread2(_objectSpread2({}, state), {}, {
3233
- inputValue: _inputValue3
3061
+ locale,
3062
+ formatDate
3234
3063
  });
3064
+ return {
3065
+ ...state,
3066
+ inputValue
3067
+ };
3235
3068
  }
3236
3069
  case 'SELECT_DATE':
3237
3070
  {
3238
- var _inputValue4 = formatInputValue({
3071
+ const inputValue = formatInputValue({
3239
3072
  date: action.value,
3240
- locale: locale,
3241
- formatDate: formatDate
3073
+ locale,
3074
+ formatDate
3242
3075
  });
3243
3076
  if (onChange && action.value && isValid(action.value) && !isSameDay(value, action.value)) {
3244
3077
  onChange(action.value);
3245
3078
  }
3246
- return _objectSpread2(_objectSpread2({}, state), {}, {
3079
+ return {
3080
+ ...state,
3247
3081
  isOpen: false,
3248
- inputValue: _inputValue4
3249
- });
3082
+ inputValue
3083
+ };
3250
3084
  }
3251
3085
  default:
3252
3086
  throw new Error();
@@ -3254,11 +3088,11 @@ var datepickerReducer = function datepickerReducer(_ref3) {
3254
3088
  };
3255
3089
  };
3256
3090
  function retrieveInitialState$1(initialProps) {
3257
- var previewDate = initialProps.value;
3091
+ let previewDate = initialProps.value;
3258
3092
  if (previewDate === undefined || !isValid(previewDate)) {
3259
3093
  previewDate = new Date();
3260
3094
  }
3261
- var inputValue = '';
3095
+ let inputValue = '';
3262
3096
  if (initialProps.value !== undefined) {
3263
3097
  if (initialProps.formatDate) {
3264
3098
  inputValue = initialProps.formatDate(initialProps.value);
@@ -3272,144 +3106,146 @@ function retrieveInitialState$1(initialProps) {
3272
3106
  }
3273
3107
  return {
3274
3108
  isOpen: false,
3275
- previewDate: previewDate,
3276
- inputValue: inputValue
3109
+ previewDate,
3110
+ inputValue
3277
3111
  };
3278
3112
  }
3279
3113
 
3280
- var _excluded = ["children", "placement", "popperModifiers", "eventsEnabled", "zIndex", "isAnimated", "refKey", "value", "isCompact", "onChange", "formatDate", "minValue", "maxValue", "locale", "weekStartsOn", "customParseDate"];
3281
- var Datepicker = React.forwardRef(function (props, calendarRef) {
3282
- var children = props.children,
3283
- placement = props.placement,
3284
- popperModifiers = props.popperModifiers,
3285
- eventsEnabled = props.eventsEnabled,
3286
- zIndex = props.zIndex,
3287
- isAnimated = props.isAnimated,
3288
- refKey = props.refKey,
3289
- value = props.value,
3290
- isCompact = props.isCompact,
3291
- onChange = props.onChange,
3292
- formatDate = props.formatDate,
3293
- minValue = props.minValue,
3294
- maxValue = props.maxValue,
3295
- locale = props.locale,
3296
- weekStartsOn = props.weekStartsOn,
3297
- customParseDate = props.customParseDate,
3298
- menuProps = _objectWithoutProperties(props, _excluded);
3299
- var theme = React.useContext(styled.ThemeContext);
3300
- var memoizedReducer = React.useCallback(datepickerReducer({
3301
- value: value,
3302
- formatDate: formatDate,
3303
- locale: locale,
3304
- customParseDate: customParseDate,
3305
- onChange: onChange
3114
+ const Datepicker = React.forwardRef((props, calendarRef) => {
3115
+ const {
3116
+ children,
3117
+ placement,
3118
+ popperModifiers,
3119
+ eventsEnabled,
3120
+ zIndex,
3121
+ isAnimated,
3122
+ refKey,
3123
+ value,
3124
+ isCompact,
3125
+ onChange,
3126
+ formatDate,
3127
+ minValue,
3128
+ maxValue,
3129
+ locale,
3130
+ weekStartsOn,
3131
+ customParseDate,
3132
+ ...menuProps
3133
+ } = props;
3134
+ const theme = React.useContext(styled.ThemeContext);
3135
+ const memoizedReducer = React.useCallback(datepickerReducer({
3136
+ value,
3137
+ formatDate,
3138
+ locale,
3139
+ customParseDate,
3140
+ onChange
3306
3141
  }), [value, formatDate, locale, onChange, customParseDate]);
3307
- var _useReducer = React.useReducer(memoizedReducer, retrieveInitialState$1(props)),
3308
- _useReducer2 = _slicedToArray(_useReducer, 2),
3309
- state = _useReducer2[0],
3310
- dispatch = _useReducer2[1];
3311
- var scheduleUpdateRef = React.useRef(undefined);
3312
- var inputRef = React.useRef(null);
3313
- var isInputMouseDownRef = React.useRef(false);
3314
- React.useEffect(function () {
3142
+ const [state, dispatch] = React.useReducer(memoizedReducer, retrieveInitialState$1(props));
3143
+ const scheduleUpdateRef = React.useRef(undefined);
3144
+ const inputRef = React.useRef(null);
3145
+ const isInputMouseDownRef = React.useRef(false);
3146
+ React.useEffect(() => {
3315
3147
  if (state.isOpen && scheduleUpdateRef.current) {
3316
3148
  scheduleUpdateRef.current();
3317
3149
  }
3318
3150
  });
3319
- var _useState = React.useState(state.isOpen),
3320
- _useState2 = _slicedToArray(_useState, 2),
3321
- isVisible = _useState2[0],
3322
- setIsVisible = _useState2[1];
3323
- React.useEffect(function () {
3324
- var timeout;
3151
+ const [isVisible, setIsVisible] = React.useState(state.isOpen);
3152
+ React.useEffect(() => {
3153
+ let timeout;
3325
3154
  if (state.isOpen) {
3326
3155
  setIsVisible(true);
3327
3156
  } else if (isAnimated) {
3328
- timeout = setTimeout(function () {
3329
- return setIsVisible(false);
3330
- }, 200);
3157
+ timeout = setTimeout(() => setIsVisible(false), 200);
3331
3158
  } else {
3332
3159
  setIsVisible(false);
3333
3160
  }
3334
- return function () {
3335
- return clearTimeout(timeout);
3336
- };
3161
+ return () => clearTimeout(timeout);
3337
3162
  }, [state.isOpen, isAnimated]);
3338
- React.useEffect(function () {
3163
+ React.useEffect(() => {
3339
3164
  dispatch({
3340
3165
  type: 'CONTROLLED_VALUE_CHANGE',
3341
- value: value
3166
+ value
3342
3167
  });
3343
3168
  }, [value]);
3344
- React.useEffect(function () {
3169
+ React.useEffect(() => {
3345
3170
  dispatch({
3346
3171
  type: 'CONTROLLED_LOCALE_CHANGE'
3347
3172
  });
3348
3173
  }, [locale]);
3349
- var popperPlacement = theme.rtl ? getRtlPopperPlacement(placement) : getPopperPlacement(placement);
3350
- var contextValue = React.useMemo(function () {
3351
- return {
3352
- state: state,
3353
- dispatch: dispatch
3354
- };
3355
- }, [state, dispatch]);
3174
+ const popperPlacement = theme.rtl ? getRtlPopperPlacement(placement) : getPopperPlacement(placement);
3175
+ const contextValue = React.useMemo(() => ({
3176
+ state,
3177
+ dispatch
3178
+ }), [state, dispatch]);
3356
3179
  return React__default["default"].createElement(DatepickerContext.Provider, {
3357
3180
  value: contextValue
3358
- }, React__default["default"].createElement(reactPopper.Manager, null, React__default["default"].createElement(reactPopper.Reference, null, function (_ref) {
3359
- var _React$cloneElement;
3360
- var ref = _ref.ref;
3361
- var childElement = React__default["default"].Children.only(children);
3362
- return React__default["default"].cloneElement(childElement, (_React$cloneElement = {}, _defineProperty(_React$cloneElement, refKey, function (refValue) {
3363
- ref(refValue);
3364
- inputRef.current = refValue;
3365
- }), _defineProperty(_React$cloneElement, "onMouseDown", containerUtilities.composeEventHandlers(childElement.props.onMouseDown, function () {
3366
- isInputMouseDownRef.current = true;
3367
- })), _defineProperty(_React$cloneElement, "onMouseUp", containerUtilities.composeEventHandlers(childElement.props.onMouseUp, function () {
3368
- setTimeout(function () {
3369
- isInputMouseDownRef.current = false;
3370
- }, 0);
3371
- })), _defineProperty(_React$cloneElement, "onClick", containerUtilities.composeEventHandlers(childElement.props.onClick, function () {
3372
- if (isInputMouseDownRef.current && !state.isOpen) {
3373
- dispatch({
3374
- type: 'OPEN'
3375
- });
3376
- }
3377
- })), _defineProperty(_React$cloneElement, "onBlur", containerUtilities.composeEventHandlers(childElement.props.onBlur, function () {
3378
- dispatch({
3379
- type: 'CLOSE'
3380
- });
3381
- })), _defineProperty(_React$cloneElement, "onChange", containerUtilities.composeEventHandlers(childElement.props.onChange, function (e) {
3382
- dispatch({
3383
- type: 'MANUALLY_UPDATE_INPUT',
3384
- value: e.target.value
3385
- });
3386
- })), _defineProperty(_React$cloneElement, "onKeyDown", containerUtilities.composeEventHandlers(childElement.props.onKeyDown, function (e) {
3387
- switch (e.keyCode) {
3388
- case containerUtilities.KEY_CODES.ESCAPE:
3389
- case containerUtilities.KEY_CODES.ENTER:
3390
- dispatch({
3391
- type: 'CLOSE'
3392
- });
3393
- break;
3394
- case containerUtilities.KEY_CODES.UP:
3395
- case containerUtilities.KEY_CODES.DOWN:
3396
- case containerUtilities.KEY_CODES.SPACE:
3181
+ }, React__default["default"].createElement(reactPopper.Manager, null, React__default["default"].createElement(reactPopper.Reference, null, _ref => {
3182
+ let {
3183
+ ref
3184
+ } = _ref;
3185
+ const childElement = React__default["default"].Children.only(children);
3186
+ return React__default["default"].cloneElement(childElement, {
3187
+ [refKey]: refValue => {
3188
+ ref(refValue);
3189
+ inputRef.current = refValue;
3190
+ },
3191
+ onMouseDown: containerUtilities.composeEventHandlers(childElement.props.onMouseDown, () => {
3192
+ isInputMouseDownRef.current = true;
3193
+ }),
3194
+ onMouseUp: containerUtilities.composeEventHandlers(childElement.props.onMouseUp, () => {
3195
+ setTimeout(() => {
3196
+ isInputMouseDownRef.current = false;
3197
+ }, 0);
3198
+ }),
3199
+ onClick: containerUtilities.composeEventHandlers(childElement.props.onClick, () => {
3200
+ if (isInputMouseDownRef.current && !state.isOpen) {
3397
3201
  dispatch({
3398
3202
  type: 'OPEN'
3399
3203
  });
3400
- break;
3401
- }
3402
- })), _defineProperty(_React$cloneElement, "autoComplete", 'off'), _defineProperty(_React$cloneElement, "value", state.inputValue), _React$cloneElement));
3204
+ }
3205
+ }),
3206
+ onBlur: containerUtilities.composeEventHandlers(childElement.props.onBlur, () => {
3207
+ dispatch({
3208
+ type: 'CLOSE'
3209
+ });
3210
+ }),
3211
+ onChange: containerUtilities.composeEventHandlers(childElement.props.onChange, e => {
3212
+ dispatch({
3213
+ type: 'MANUALLY_UPDATE_INPUT',
3214
+ value: e.target.value
3215
+ });
3216
+ }),
3217
+ onKeyDown: containerUtilities.composeEventHandlers(childElement.props.onKeyDown, e => {
3218
+ switch (e.keyCode) {
3219
+ case containerUtilities.KEY_CODES.ESCAPE:
3220
+ case containerUtilities.KEY_CODES.ENTER:
3221
+ dispatch({
3222
+ type: 'CLOSE'
3223
+ });
3224
+ break;
3225
+ case containerUtilities.KEY_CODES.UP:
3226
+ case containerUtilities.KEY_CODES.DOWN:
3227
+ case containerUtilities.KEY_CODES.SPACE:
3228
+ dispatch({
3229
+ type: 'OPEN'
3230
+ });
3231
+ break;
3232
+ }
3233
+ }),
3234
+ autoComplete: 'off',
3235
+ value: state.inputValue
3236
+ });
3403
3237
  }), React__default["default"].createElement(reactPopper.Popper, {
3404
3238
  placement: popperPlacement,
3405
3239
  modifiers: popperModifiers
3406
3240
  ,
3407
3241
  eventsEnabled: state.isOpen && eventsEnabled
3408
- }, function (_ref2) {
3409
- var ref = _ref2.ref,
3410
- style = _ref2.style,
3411
- scheduleUpdate = _ref2.scheduleUpdate,
3412
- currentPlacement = _ref2.placement;
3242
+ }, _ref2 => {
3243
+ let {
3244
+ ref,
3245
+ style,
3246
+ scheduleUpdate,
3247
+ placement: currentPlacement
3248
+ } = _ref2;
3413
3249
  scheduleUpdateRef.current = scheduleUpdate;
3414
3250
  return React__default["default"].createElement(StyledMenuWrapper, {
3415
3251
  ref: ref,
@@ -3471,10 +3307,12 @@ function compareAsc(dirtyDateLeft, dirtyDateRight) {
3471
3307
  }
3472
3308
 
3473
3309
  function formatValue(_ref) {
3474
- var value = _ref.value,
3475
- locale = _ref.locale,
3476
- formatDate = _ref.formatDate;
3477
- var stringValue = '';
3310
+ let {
3311
+ value,
3312
+ locale,
3313
+ formatDate
3314
+ } = _ref;
3315
+ let stringValue = '';
3478
3316
  if (value !== undefined && isValid(value)) {
3479
3317
  if (formatDate) {
3480
3318
  stringValue = formatDate(value);
@@ -3489,9 +3327,11 @@ function formatValue(_ref) {
3489
3327
  return stringValue;
3490
3328
  }
3491
3329
  function parseInputValue(_ref2) {
3492
- var inputValue = _ref2.inputValue;
3493
- var MINIMUM_DATE = new Date(1001, 0, 0);
3494
- var tryParseDate = parse(inputValue || '', 'P', new Date());
3330
+ let {
3331
+ inputValue
3332
+ } = _ref2;
3333
+ const MINIMUM_DATE = new Date(1001, 0, 0);
3334
+ let tryParseDate = parse(inputValue || '', 'P', new Date());
3495
3335
  if (isValid(tryParseDate) && !isBefore(tryParseDate, MINIMUM_DATE)) {
3496
3336
  return tryParseDate;
3497
3337
  }
@@ -3505,17 +3345,19 @@ function parseInputValue(_ref2) {
3505
3345
  }
3506
3346
  return new Date(NaN);
3507
3347
  }
3508
- var datepickerRangeReducer = function datepickerRangeReducer(_ref3) {
3509
- var startValue = _ref3.startValue,
3510
- endValue = _ref3.endValue,
3511
- locale = _ref3.locale,
3512
- formatDate = _ref3.formatDate,
3513
- customParseDate = _ref3.customParseDate;
3514
- return function (state, action) {
3348
+ const datepickerRangeReducer = _ref3 => {
3349
+ let {
3350
+ startValue,
3351
+ endValue,
3352
+ locale,
3353
+ formatDate,
3354
+ customParseDate
3355
+ } = _ref3;
3356
+ return (state, action) => {
3515
3357
  switch (action.type) {
3516
3358
  case 'START_FOCUS':
3517
3359
  {
3518
- var previewDate = state.previewDate;
3360
+ let previewDate = state.previewDate;
3519
3361
  if (startValue) {
3520
3362
  if (compareAsc(startValue, startOfMonth(state.previewDate)) === 1 && compareAsc(startValue, addMonths(endOfMonth(state.previewDate), 1)) === -1) {
3521
3363
  previewDate = state.previewDate;
@@ -3523,31 +3365,33 @@ var datepickerRangeReducer = function datepickerRangeReducer(_ref3) {
3523
3365
  previewDate = startOfMonth(startValue);
3524
3366
  }
3525
3367
  }
3526
- return _objectSpread2(_objectSpread2({}, state), {}, {
3527
- previewDate: previewDate,
3368
+ return {
3369
+ ...state,
3370
+ previewDate,
3528
3371
  isStartFocused: true,
3529
3372
  isEndFocused: false
3530
- });
3373
+ };
3531
3374
  }
3532
3375
  case 'END_FOCUS':
3533
3376
  {
3534
- var _previewDate = state.previewDate;
3377
+ let previewDate = state.previewDate;
3535
3378
  if (endValue) {
3536
3379
  if (compareAsc(endValue, startOfMonth(state.previewDate)) === 1 && compareAsc(endValue, addMonths(endOfMonth(state.previewDate), 1)) === -1) {
3537
- _previewDate = state.previewDate;
3380
+ previewDate = state.previewDate;
3538
3381
  } else {
3539
- _previewDate = startOfMonth(endValue);
3382
+ previewDate = startOfMonth(endValue);
3540
3383
  }
3541
3384
  }
3542
- return _objectSpread2(_objectSpread2({}, state), {}, {
3543
- previewDate: _previewDate,
3385
+ return {
3386
+ ...state,
3387
+ previewDate,
3544
3388
  isEndFocused: true,
3545
3389
  isStartFocused: false
3546
- });
3390
+ };
3547
3391
  }
3548
3392
  case 'START_BLUR':
3549
3393
  {
3550
- var parsedDate;
3394
+ let parsedDate;
3551
3395
  if (customParseDate) {
3552
3396
  parsedDate = customParseDate(state.startInputValue);
3553
3397
  } else {
@@ -3555,168 +3399,184 @@ var datepickerRangeReducer = function datepickerRangeReducer(_ref3) {
3555
3399
  inputValue: state.startInputValue
3556
3400
  });
3557
3401
  }
3558
- var startInputValue = formatValue({
3402
+ const startInputValue = formatValue({
3559
3403
  value: parsedDate,
3560
- locale: locale,
3561
- formatDate: formatDate
3404
+ locale,
3405
+ formatDate
3562
3406
  });
3563
- return _objectSpread2(_objectSpread2({}, state), {}, {
3407
+ return {
3408
+ ...state,
3564
3409
  startInputValue: startInputValue || formatValue({
3565
3410
  value: startValue,
3566
- locale: locale,
3567
- formatDate: formatDate
3411
+ locale,
3412
+ formatDate
3568
3413
  }),
3569
3414
  isStartFocused: false
3570
- });
3415
+ };
3571
3416
  }
3572
3417
  case 'END_BLUR':
3573
3418
  {
3574
- var _parsedDate;
3419
+ let parsedDate;
3575
3420
  if (customParseDate) {
3576
- _parsedDate = customParseDate(state.endInputValue);
3421
+ parsedDate = customParseDate(state.endInputValue);
3577
3422
  } else {
3578
- _parsedDate = parseInputValue({
3423
+ parsedDate = parseInputValue({
3579
3424
  inputValue: state.endInputValue
3580
3425
  });
3581
3426
  }
3582
- var endInputValue = formatValue({
3583
- value: _parsedDate,
3584
- locale: locale,
3585
- formatDate: formatDate
3427
+ const endInputValue = formatValue({
3428
+ value: parsedDate,
3429
+ locale,
3430
+ formatDate
3586
3431
  }) || formatValue({
3587
3432
  value: endValue,
3588
- locale: locale,
3589
- formatDate: formatDate
3433
+ locale,
3434
+ formatDate
3590
3435
  });
3591
- return _objectSpread2(_objectSpread2({}, state), {}, {
3592
- endInputValue: endInputValue,
3436
+ return {
3437
+ ...state,
3438
+ endInputValue,
3593
3439
  isEndFocused: false
3594
- });
3440
+ };
3595
3441
  }
3596
3442
  case 'CONTROLLED_START_VALUE_CHANGE':
3597
3443
  {
3598
- var _startInputValue = formatValue({
3444
+ const startInputValue = formatValue({
3599
3445
  value: action.value,
3600
- locale: locale,
3601
- formatDate: formatDate
3446
+ locale,
3447
+ formatDate
3602
3448
  });
3603
- var _previewDate2 = state.previewDate;
3449
+ let previewDate = state.previewDate;
3604
3450
  if (action.value) {
3605
3451
  if (compareAsc(action.value, startOfMonth(state.previewDate)) === 1 && compareAsc(action.value, addMonths(endOfMonth(state.previewDate), 1)) === -1) {
3606
- _previewDate2 = state.previewDate;
3452
+ previewDate = state.previewDate;
3607
3453
  } else {
3608
- _previewDate2 = startOfMonth(action.value);
3454
+ previewDate = startOfMonth(action.value);
3609
3455
  }
3610
3456
  }
3611
- return _objectSpread2(_objectSpread2({}, state), {}, {
3612
- startInputValue: _startInputValue,
3457
+ return {
3458
+ ...state,
3459
+ startInputValue,
3613
3460
  hoverDate: undefined,
3614
- previewDate: _previewDate2
3615
- });
3461
+ previewDate
3462
+ };
3616
3463
  }
3617
3464
  case 'CONTROLLED_END_VALUE_CHANGE':
3618
3465
  {
3619
- var _endInputValue = formatValue({
3466
+ const endInputValue = formatValue({
3620
3467
  value: action.value,
3621
- locale: locale,
3622
- formatDate: formatDate
3468
+ locale,
3469
+ formatDate
3623
3470
  });
3624
- var _previewDate3 = state.previewDate;
3471
+ let previewDate = state.previewDate;
3625
3472
  if (action.value) {
3626
3473
  if (compareAsc(action.value, startOfMonth(state.previewDate)) === 1 && compareAsc(action.value, addMonths(endOfMonth(state.previewDate), 1)) === -1) {
3627
- _previewDate3 = state.previewDate;
3474
+ previewDate = state.previewDate;
3628
3475
  } else {
3629
- _previewDate3 = startOfMonth(action.value);
3476
+ previewDate = startOfMonth(action.value);
3630
3477
  }
3631
3478
  }
3632
- return _objectSpread2(_objectSpread2({}, state), {}, {
3633
- endInputValue: _endInputValue,
3479
+ return {
3480
+ ...state,
3481
+ endInputValue,
3634
3482
  hoverDate: undefined,
3635
- previewDate: _previewDate3
3636
- });
3483
+ previewDate
3484
+ };
3637
3485
  }
3638
3486
  case 'CLICK_DATE':
3639
3487
  if (state.isStartFocused) {
3640
3488
  if (endValue !== undefined && (isBefore(action.value, endValue) || isSameDay(action.value, endValue))) {
3641
- return _objectSpread2(_objectSpread2({}, state), {}, {
3489
+ return {
3490
+ ...state,
3642
3491
  startInputValue: formatValue({
3643
3492
  value: action.value
3644
3493
  })
3645
- });
3494
+ };
3646
3495
  }
3647
- return _objectSpread2(_objectSpread2({}, state), {}, {
3496
+ return {
3497
+ ...state,
3648
3498
  startInputValue: formatValue({
3649
3499
  value: action.value
3650
3500
  }),
3651
3501
  endInputValue: undefined
3652
- });
3502
+ };
3653
3503
  } else if (state.isEndFocused) {
3654
3504
  if (startValue !== undefined && (isAfter(action.value, startValue) || isSameDay(action.value, startValue))) {
3655
- return _objectSpread2(_objectSpread2({}, state), {}, {
3505
+ return {
3506
+ ...state,
3656
3507
  endInputValue: formatValue({
3657
3508
  value: action.value
3658
3509
  })
3659
- });
3510
+ };
3660
3511
  }
3661
- return _objectSpread2(_objectSpread2({}, state), {}, {
3512
+ return {
3513
+ ...state,
3662
3514
  startInputValue: formatValue({
3663
3515
  value: action.value
3664
3516
  })
3665
- });
3517
+ };
3666
3518
  } else if (startValue === undefined) {
3667
- return _objectSpread2(_objectSpread2({}, state), {}, {
3519
+ return {
3520
+ ...state,
3668
3521
  startInputValue: formatValue({
3669
3522
  value: action.value
3670
3523
  }),
3671
3524
  endInputValue: undefined
3672
- });
3525
+ };
3673
3526
  } else if (endValue === undefined) {
3674
3527
  if (isBefore(action.value, startValue)) {
3675
- return _objectSpread2(_objectSpread2({}, state), {}, {
3528
+ return {
3529
+ ...state,
3676
3530
  startInputValue: formatValue({
3677
3531
  value: action.value
3678
3532
  }),
3679
3533
  endInputValue: undefined
3680
- });
3534
+ };
3681
3535
  }
3682
- return _objectSpread2(_objectSpread2({}, state), {}, {
3536
+ return {
3537
+ ...state,
3683
3538
  endInputValue: formatValue({
3684
3539
  value: action.value
3685
3540
  })
3686
- });
3541
+ };
3687
3542
  }
3688
3543
  return state;
3689
3544
  case 'START_INPUT_ONCHANGE':
3690
3545
  {
3691
- return _objectSpread2(_objectSpread2({}, state), {}, {
3546
+ return {
3547
+ ...state,
3692
3548
  startInputValue: action.value
3693
- });
3549
+ };
3694
3550
  }
3695
3551
  case 'END_INPUT_ONCHANGE':
3696
3552
  {
3697
- return _objectSpread2(_objectSpread2({}, state), {}, {
3553
+ return {
3554
+ ...state,
3698
3555
  endInputValue: action.value
3699
- });
3556
+ };
3700
3557
  }
3701
3558
  case 'HOVER_DATE':
3702
- return _objectSpread2(_objectSpread2({}, state), {}, {
3559
+ return {
3560
+ ...state,
3703
3561
  hoverDate: action.value
3704
- });
3562
+ };
3705
3563
  case 'PREVIEW_NEXT_MONTH':
3706
3564
  {
3707
- var _previewDate4 = addMonths(state.previewDate, 1);
3708
- return _objectSpread2(_objectSpread2({}, state), {}, {
3709
- previewDate: _previewDate4,
3565
+ const previewDate = addMonths(state.previewDate, 1);
3566
+ return {
3567
+ ...state,
3568
+ previewDate,
3710
3569
  hoverDate: undefined
3711
- });
3570
+ };
3712
3571
  }
3713
3572
  case 'PREVIEW_PREVIOUS_MONTH':
3714
3573
  {
3715
- var _previewDate5 = subMonths(state.previewDate, 1);
3716
- return _objectSpread2(_objectSpread2({}, state), {}, {
3717
- previewDate: _previewDate5,
3574
+ const previewDate = subMonths(state.previewDate, 1);
3575
+ return {
3576
+ ...state,
3577
+ previewDate,
3718
3578
  hoverDate: undefined
3719
- });
3579
+ };
3720
3580
  }
3721
3581
  default:
3722
3582
  throw new Error();
@@ -3724,58 +3584,59 @@ var datepickerRangeReducer = function datepickerRangeReducer(_ref3) {
3724
3584
  };
3725
3585
  };
3726
3586
  function retrieveInitialState(initialProps) {
3727
- var previewDate = initialProps.startValue;
3587
+ let previewDate = initialProps.startValue;
3728
3588
  if (previewDate === undefined || !isValid(previewDate)) {
3729
3589
  previewDate = new Date();
3730
3590
  }
3731
- var startInputValue = formatValue({
3591
+ const startInputValue = formatValue({
3732
3592
  value: initialProps.startValue,
3733
3593
  locale: initialProps.locale,
3734
3594
  formatDate: initialProps.formatDate
3735
3595
  });
3736
- var endInputValue = formatValue({
3596
+ const endInputValue = formatValue({
3737
3597
  value: initialProps.endValue,
3738
3598
  locale: initialProps.locale,
3739
3599
  formatDate: initialProps.formatDate
3740
3600
  });
3741
3601
  return {
3742
- previewDate: previewDate,
3743
- startInputValue: startInputValue,
3744
- endInputValue: endInputValue,
3602
+ previewDate,
3603
+ startInputValue,
3604
+ endInputValue,
3745
3605
  isStartFocused: false,
3746
3606
  isEndFocused: false
3747
3607
  };
3748
3608
  }
3749
3609
 
3750
- var DatepickerRangeContext = React.createContext(undefined);
3751
- var useDatepickerContext = function useDatepickerContext() {
3610
+ const DatepickerRangeContext = React.createContext(undefined);
3611
+ const useDatepickerContext = () => {
3752
3612
  return React.useContext(DatepickerRangeContext);
3753
3613
  };
3754
3614
 
3755
- var Start = function Start(props) {
3756
- var _useDatepickerRangeCo = useDatepickerContext(),
3757
- state = _useDatepickerRangeCo.state,
3758
- dispatch = _useDatepickerRangeCo.dispatch,
3759
- onChange = _useDatepickerRangeCo.onChange,
3760
- startValue = _useDatepickerRangeCo.startValue,
3761
- endValue = _useDatepickerRangeCo.endValue,
3762
- startInputRef = _useDatepickerRangeCo.startInputRef,
3763
- customParseDate = _useDatepickerRangeCo.customParseDate;
3764
- var onChangeCallback = React.useCallback(function (e) {
3615
+ const Start = props => {
3616
+ const {
3617
+ state,
3618
+ dispatch,
3619
+ onChange,
3620
+ startValue,
3621
+ endValue,
3622
+ startInputRef,
3623
+ customParseDate
3624
+ } = useDatepickerContext();
3625
+ const onChangeCallback = React.useCallback(e => {
3765
3626
  dispatch({
3766
3627
  type: 'START_INPUT_ONCHANGE',
3767
3628
  value: e.target.value
3768
3629
  });
3769
3630
  props.children.props.onChange && props.children.props.onChange(e);
3770
3631
  }, [dispatch, props.children]);
3771
- var onFocusCallback = React.useCallback(function (e) {
3632
+ const onFocusCallback = React.useCallback(e => {
3772
3633
  dispatch({
3773
3634
  type: 'START_FOCUS'
3774
3635
  });
3775
3636
  props.children.props.onFocus && props.children.props.onFocus(e);
3776
3637
  }, [dispatch, props.children]);
3777
- var handleBlur = React.useCallback(function () {
3778
- var parsedDate;
3638
+ const handleBlur = React.useCallback(() => {
3639
+ let parsedDate;
3779
3640
  if (customParseDate) {
3780
3641
  parsedDate = customParseDate(state.startInputValue);
3781
3642
  } else {
@@ -3789,22 +3650,22 @@ var Start = function Start(props) {
3789
3650
  if (parsedDate && isValid(parsedDate) && !isSameDay(parsedDate, startValue)) {
3790
3651
  onChange && onChange({
3791
3652
  startValue: parsedDate,
3792
- endValue: endValue
3653
+ endValue
3793
3654
  });
3794
3655
  }
3795
3656
  }, [dispatch, onChange, startValue, endValue, customParseDate, state.startInputValue]);
3796
- var onKeyDownCallback = React.useCallback(function (e) {
3657
+ const onKeyDownCallback = React.useCallback(e => {
3797
3658
  if (e.keyCode === containerUtilities.KEY_CODES.ENTER) {
3798
3659
  e.preventDefault();
3799
3660
  handleBlur();
3800
3661
  }
3801
3662
  props.children.props.onKeyDown && props.children.props.onKeyDown(e);
3802
3663
  }, [handleBlur, props.children]);
3803
- var onBlurCallback = React.useCallback(function (e) {
3664
+ const onBlurCallback = React.useCallback(e => {
3804
3665
  handleBlur();
3805
3666
  props.children.props.onBlur && props.children.props.onBlur(e);
3806
3667
  }, [handleBlur, props.children]);
3807
- var childElement = React__default["default"].Children.only(props.children);
3668
+ const childElement = React__default["default"].Children.only(props.children);
3808
3669
  return React__default["default"].cloneElement(childElement, {
3809
3670
  value: state.startInputValue || '',
3810
3671
  ref: startInputRef,
@@ -3816,33 +3677,34 @@ var Start = function Start(props) {
3816
3677
  };
3817
3678
  Start.displayName = 'DatepickerRange.Start';
3818
3679
 
3819
- var End = function End(props) {
3820
- var _useDatepickerRangeCo = useDatepickerContext(),
3821
- state = _useDatepickerRangeCo.state,
3822
- dispatch = _useDatepickerRangeCo.dispatch,
3823
- onChange = _useDatepickerRangeCo.onChange,
3824
- startValue = _useDatepickerRangeCo.startValue,
3825
- endValue = _useDatepickerRangeCo.endValue,
3826
- endInputRef = _useDatepickerRangeCo.endInputRef,
3827
- customParseDate = _useDatepickerRangeCo.customParseDate;
3828
- var onChangeCallback = React.useCallback(function (e) {
3680
+ const End = props => {
3681
+ const {
3682
+ state,
3683
+ dispatch,
3684
+ onChange,
3685
+ startValue,
3686
+ endValue,
3687
+ endInputRef,
3688
+ customParseDate
3689
+ } = useDatepickerContext();
3690
+ const onChangeCallback = React.useCallback(e => {
3829
3691
  dispatch({
3830
3692
  type: 'END_INPUT_ONCHANGE',
3831
3693
  value: e.target.value
3832
3694
  });
3833
3695
  props.children.props.onChange && props.children.props.onChange(e);
3834
3696
  }, [dispatch, props.children]);
3835
- var onFocusCallback = React.useCallback(function (e) {
3697
+ const onFocusCallback = React.useCallback(e => {
3836
3698
  dispatch({
3837
3699
  type: 'END_FOCUS'
3838
3700
  });
3839
3701
  props.children.props.onFocus && props.children.props.onFocus(e);
3840
3702
  }, [dispatch, props.children]);
3841
- var handleBlur = React.useCallback(function () {
3703
+ const handleBlur = React.useCallback(() => {
3842
3704
  dispatch({
3843
3705
  type: 'END_BLUR'
3844
3706
  });
3845
- var parsedDate;
3707
+ let parsedDate;
3846
3708
  if (customParseDate) {
3847
3709
  parsedDate = customParseDate(state.endInputValue);
3848
3710
  } else {
@@ -3852,23 +3714,23 @@ var End = function End(props) {
3852
3714
  }
3853
3715
  if (onChange && parsedDate && isValid(parsedDate) && !isSameDay(parsedDate, endValue)) {
3854
3716
  onChange && onChange({
3855
- startValue: startValue,
3717
+ startValue,
3856
3718
  endValue: parsedDate
3857
3719
  });
3858
3720
  }
3859
3721
  }, [dispatch, onChange, startValue, endValue, customParseDate, state.endInputValue]);
3860
- var onKeydownCallback = React.useCallback(function (e) {
3722
+ const onKeydownCallback = React.useCallback(e => {
3861
3723
  if (e.keyCode === containerUtilities.KEY_CODES.ENTER) {
3862
3724
  handleBlur();
3863
3725
  e.preventDefault();
3864
3726
  }
3865
3727
  props.children.props.onKeyDown && props.children.props.onKeyDown(e);
3866
3728
  }, [handleBlur, props.children]);
3867
- var onBlurCallback = React.useCallback(function (e) {
3729
+ const onBlurCallback = React.useCallback(e => {
3868
3730
  handleBlur();
3869
3731
  props.children.props.onBlur && props.children.props.onBlur(e);
3870
3732
  }, [handleBlur, props.children]);
3871
- var childElement = React__default["default"].Children.only(props.children);
3733
+ const childElement = React__default["default"].Children.only(props.children);
3872
3734
  return React__default["default"].cloneElement(childElement, {
3873
3735
  value: state.endInputValue || '',
3874
3736
  ref: endInputRef,
@@ -3880,77 +3742,95 @@ var End = function End(props) {
3880
3742
  };
3881
3743
  End.displayName = 'DatepickerRange.End';
3882
3744
 
3745
+ function _extends() {
3746
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
3747
+ for (var i = 1; i < arguments.length; i++) {
3748
+ var source = arguments[i];
3749
+ for (var key in source) {
3750
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
3751
+ target[key] = source[key];
3752
+ }
3753
+ }
3754
+ }
3755
+ return target;
3756
+ };
3757
+ return _extends.apply(this, arguments);
3758
+ }
3759
+
3883
3760
  function subDays(dirtyDate, dirtyAmount) {
3884
3761
  requiredArgs(2, arguments);
3885
3762
  var amount = toInteger(dirtyAmount);
3886
3763
  return addDays(dirtyDate, -amount);
3887
3764
  }
3888
3765
 
3889
- var Month = React.forwardRef(function (_ref, ref) {
3890
- var displayDate = _ref.displayDate,
3891
- isPreviousHidden = _ref.isPreviousHidden,
3892
- isNextHidden = _ref.isNextHidden;
3893
- var _useDatepickerRangeCo = useDatepickerContext(),
3894
- state = _useDatepickerRangeCo.state,
3895
- dispatch = _useDatepickerRangeCo.dispatch,
3896
- locale = _useDatepickerRangeCo.locale,
3897
- weekStartsOn = _useDatepickerRangeCo.weekStartsOn,
3898
- isCompact = _useDatepickerRangeCo.isCompact,
3899
- minValue = _useDatepickerRangeCo.minValue,
3900
- maxValue = _useDatepickerRangeCo.maxValue,
3901
- startValue = _useDatepickerRangeCo.startValue,
3902
- endValue = _useDatepickerRangeCo.endValue,
3903
- onChange = _useDatepickerRangeCo.onChange;
3904
- var headerLabelFormatter = React.useCallback(function (date) {
3905
- var formatter = new Intl.DateTimeFormat(locale, {
3766
+ const Month = React.forwardRef((_ref, ref) => {
3767
+ let {
3768
+ displayDate,
3769
+ isPreviousHidden,
3770
+ isNextHidden
3771
+ } = _ref;
3772
+ const {
3773
+ state,
3774
+ dispatch,
3775
+ locale,
3776
+ weekStartsOn,
3777
+ isCompact,
3778
+ minValue,
3779
+ maxValue,
3780
+ startValue,
3781
+ endValue,
3782
+ onChange
3783
+ } = useDatepickerContext();
3784
+ const headerLabelFormatter = React.useCallback(date => {
3785
+ const formatter = new Intl.DateTimeFormat(locale, {
3906
3786
  month: 'long',
3907
3787
  year: 'numeric'
3908
3788
  });
3909
3789
  return formatter.format(date);
3910
3790
  }, [locale]);
3911
- var dayLabelFormatter = React.useCallback(function (date) {
3912
- var formatter = new Intl.DateTimeFormat(locale, {
3791
+ const dayLabelFormatter = React.useCallback(date => {
3792
+ const formatter = new Intl.DateTimeFormat(locale, {
3913
3793
  weekday: 'short'
3914
3794
  });
3915
3795
  return formatter.format(date);
3916
3796
  }, [locale]);
3917
- var dayFormatter = React.useCallback(function (date) {
3918
- var formatter = new Intl.DateTimeFormat(locale, {
3797
+ const dayFormatter = React.useCallback(date => {
3798
+ const formatter = new Intl.DateTimeFormat(locale, {
3919
3799
  day: 'numeric'
3920
3800
  });
3921
3801
  return formatter.format(date);
3922
3802
  }, [locale]);
3923
- var preferredWeekStartsOn = weekStartsOn || getStartOfWeek(locale);
3924
- var monthStartDate = startOfMonth(displayDate);
3925
- var monthEndDate = endOfMonth(monthStartDate);
3926
- var startDate = startOfWeek(monthStartDate, {
3803
+ const preferredWeekStartsOn = weekStartsOn || getStartOfWeek(locale);
3804
+ const monthStartDate = startOfMonth(displayDate);
3805
+ const monthEndDate = endOfMonth(monthStartDate);
3806
+ const startDate = startOfWeek(monthStartDate, {
3927
3807
  weekStartsOn: preferredWeekStartsOn
3928
3808
  });
3929
- var endDate = endOfWeek(monthEndDate, {
3809
+ const endDate = endOfWeek(monthEndDate, {
3930
3810
  weekStartsOn: preferredWeekStartsOn
3931
3811
  });
3932
- var dayLabels = eachDayOfInterval({
3812
+ const dayLabels = eachDayOfInterval({
3933
3813
  start: startDate,
3934
3814
  end: addDays(startDate, 6)
3935
- }).map(function (date) {
3936
- var formattedDayLabel = dayLabelFormatter(date);
3815
+ }).map(date => {
3816
+ const formattedDayLabel = dayLabelFormatter(date);
3937
3817
  return React__default["default"].createElement(StyledCalendarItem, {
3938
- key: "day-label-".concat(formattedDayLabel),
3818
+ key: `day-label-${formattedDayLabel}`,
3939
3819
  isCompact: isCompact
3940
3820
  }, React__default["default"].createElement(StyledDayLabel, {
3941
3821
  isCompact: isCompact
3942
3822
  }, formattedDayLabel));
3943
3823
  });
3944
- var items = eachDayOfInterval({
3824
+ const items = eachDayOfInterval({
3945
3825
  start: startDate,
3946
3826
  end: endDate
3947
- }).map(function (date, itemsIndex) {
3948
- var formattedDayLabel = dayFormatter(date);
3949
- var isCurrentDate = isToday(date);
3950
- var isPreviousMonth = !isSameMonth(date, displayDate);
3827
+ }).map((date, itemsIndex) => {
3828
+ const formattedDayLabel = dayFormatter(date);
3829
+ const isCurrentDate = isToday(date);
3830
+ const isPreviousMonth = !isSameMonth(date, displayDate);
3951
3831
  if (isPreviousMonth) {
3952
3832
  return React__default["default"].createElement(StyledCalendarItem, {
3953
- key: "day-".concat(itemsIndex),
3833
+ key: `day-${itemsIndex}`,
3954
3834
  isCompact: isCompact
3955
3835
  }, React__default["default"].createElement(StyledDay, {
3956
3836
  isCompact: isCompact,
@@ -3958,29 +3838,29 @@ var Month = React.forwardRef(function (_ref, ref) {
3958
3838
  isDisabled: true
3959
3839
  }, "\xA0"));
3960
3840
  }
3961
- var isSelected = false;
3841
+ let isSelected = false;
3962
3842
  if (startValue !== undefined) {
3963
3843
  isSelected = isSameDay(date, startValue);
3964
3844
  }
3965
3845
  if (endValue !== undefined) {
3966
3846
  isSelected = isSelected || isSameDay(date, endValue);
3967
3847
  }
3968
- var isDisabled = false;
3848
+ let isDisabled = false;
3969
3849
  if (minValue !== undefined) {
3970
3850
  isDisabled = isBefore(date, minValue) && !isSameDay(date, minValue);
3971
3851
  }
3972
3852
  if (maxValue !== undefined) {
3973
3853
  isDisabled = isDisabled || isAfter(date, maxValue) && !isSameDay(date, maxValue);
3974
3854
  }
3975
- var isHighlighted = false;
3855
+ let isHighlighted = false;
3976
3856
  if (startValue !== undefined && endValue !== undefined) {
3977
3857
  isHighlighted = (isAfter(date, startValue) || isSameDay(date, startValue)) && (isBefore(date, endValue) || isSameDay(date, endValue)) && !isSameDay(startValue, endValue);
3978
3858
  } else if (startValue !== undefined && state.hoverDate !== undefined) {
3979
3859
  isHighlighted = (isAfter(date, startValue) || isSameDay(date, startValue)) && (isBefore(date, state.hoverDate) || isSameDay(date, state.hoverDate));
3980
3860
  }
3981
- var isHighlightStart = isHighlighted && startValue && isSameDay(date, startValue) || false;
3982
- var isHighlightEnd = isHighlighted && endValue && isSameDay(date, endValue) || state.hoverDate && isSameDay(date, state.hoverDate) && !isBefore(date, endValue) || false;
3983
- var isInvalidDateRange = endValue && startValue && compareAsc(endValue, startValue) === -1 || false;
3861
+ const isHighlightStart = isHighlighted && startValue && isSameDay(date, startValue) || false;
3862
+ const isHighlightEnd = isHighlighted && endValue && isSameDay(date, endValue) || state.hoverDate && isSameDay(date, state.hoverDate) && !isBefore(date, endValue) || false;
3863
+ let isInvalidDateRange = endValue && startValue && compareAsc(endValue, startValue) === -1 || false;
3984
3864
  if (minValue) {
3985
3865
  if (startValue) {
3986
3866
  isInvalidDateRange = isInvalidDateRange || compareAsc(startValue, subDays(minValue, 1)) === -1;
@@ -3998,7 +3878,7 @@ var Month = React.forwardRef(function (_ref, ref) {
3998
3878
  }
3999
3879
  }
4000
3880
  return React__default["default"].createElement(StyledCalendarItem, {
4001
- key: "day-".concat(itemsIndex),
3881
+ key: `day-${itemsIndex}`,
4002
3882
  isCompact: isCompact
4003
3883
  }, React__default["default"].createElement(StyledHighlight, {
4004
3884
  isHighlighted: !isInvalidDateRange && isHighlighted && !isDisabled,
@@ -4010,7 +3890,7 @@ var Month = React.forwardRef(function (_ref, ref) {
4010
3890
  isSelected: !isInvalidDateRange && isSelected,
4011
3891
  isDisabled: isDisabled,
4012
3892
  isCompact: isCompact,
4013
- onClick: function onClick() {
3893
+ onClick: () => {
4014
3894
  if (!isDisabled) {
4015
3895
  dispatch({
4016
3896
  type: 'CLICK_DATE',
@@ -4021,7 +3901,7 @@ var Month = React.forwardRef(function (_ref, ref) {
4021
3901
  if (endValue !== undefined && (isBefore(date, endValue) || isSameDay(date, endValue))) {
4022
3902
  onChange({
4023
3903
  startValue: date,
4024
- endValue: endValue
3904
+ endValue
4025
3905
  });
4026
3906
  } else {
4027
3907
  onChange({
@@ -4032,7 +3912,7 @@ var Month = React.forwardRef(function (_ref, ref) {
4032
3912
  } else if (state.isEndFocused) {
4033
3913
  if (startValue !== undefined && (isAfter(date, startValue) || isSameDay(date, startValue))) {
4034
3914
  onChange({
4035
- startValue: startValue,
3915
+ startValue,
4036
3916
  endValue: date
4037
3917
  });
4038
3918
  } else {
@@ -4054,7 +3934,7 @@ var Month = React.forwardRef(function (_ref, ref) {
4054
3934
  });
4055
3935
  } else {
4056
3936
  onChange({
4057
- startValue: startValue,
3937
+ startValue,
4058
3938
  endValue: date
4059
3939
  });
4060
3940
  }
@@ -4067,7 +3947,7 @@ var Month = React.forwardRef(function (_ref, ref) {
4067
3947
  }
4068
3948
  }
4069
3949
  },
4070
- onMouseEnter: function onMouseEnter() {
3950
+ onMouseEnter: () => {
4071
3951
  if (!isSelected) {
4072
3952
  dispatch({
4073
3953
  type: 'HOVER_DATE',
@@ -4080,14 +3960,14 @@ var Month = React.forwardRef(function (_ref, ref) {
4080
3960
  return React__default["default"].createElement(StyledDatepicker, {
4081
3961
  ref: ref,
4082
3962
  isCompact: isCompact,
4083
- onMouseDown: function onMouseDown(e) {
3963
+ onMouseDown: e => {
4084
3964
  e.preventDefault();
4085
3965
  }
4086
3966
  }, React__default["default"].createElement(StyledHeader, {
4087
3967
  isCompact: isCompact
4088
3968
  }, React__default["default"].createElement(StyledHeaderPaddle, {
4089
3969
  isCompact: isCompact,
4090
- onClick: function onClick() {
3970
+ onClick: () => {
4091
3971
  dispatch({
4092
3972
  type: 'PREVIEW_PREVIOUS_MONTH'
4093
3973
  });
@@ -4098,14 +3978,14 @@ var Month = React.forwardRef(function (_ref, ref) {
4098
3978
  }, headerLabelFormatter(displayDate)), React__default["default"].createElement(StyledHeaderPaddle, {
4099
3979
  isCompact: isCompact,
4100
3980
  isHidden: isNextHidden,
4101
- onClick: function onClick() {
3981
+ onClick: () => {
4102
3982
  dispatch({
4103
3983
  type: 'PREVIEW_NEXT_MONTH'
4104
3984
  });
4105
3985
  }
4106
3986
  }, React__default["default"].createElement(SvgChevronRightStroke, null))), React__default["default"].createElement(StyledCalendar, {
4107
3987
  isCompact: isCompact,
4108
- onMouseLeave: function onMouseLeave() {
3988
+ onMouseLeave: () => {
4109
3989
  dispatch({
4110
3990
  type: 'HOVER_DATE',
4111
3991
  value: undefined
@@ -4115,13 +3995,14 @@ var Month = React.forwardRef(function (_ref, ref) {
4115
3995
  });
4116
3996
  Month.displayName = 'Month';
4117
3997
 
4118
- var Calendar = React.forwardRef(function (props, ref) {
4119
- var _useDatepickerRangeCo = useDatepickerContext(),
4120
- state = _useDatepickerRangeCo.state;
4121
- return React__default["default"].createElement(StyledRangeCalendar, _extends$2({
3998
+ const Calendar = React.forwardRef((props, ref) => {
3999
+ const {
4000
+ state
4001
+ } = useDatepickerContext();
4002
+ return React__default["default"].createElement(StyledRangeCalendar, _extends({
4122
4003
  ref: ref,
4123
4004
  "data-garden-id": "datepickers.range",
4124
- "data-garden-version": '8.57.0'
4005
+ "data-garden-version": '8.58.0'
4125
4006
  }, props), React__default["default"].createElement(Month, {
4126
4007
  displayDate: state.previewDate,
4127
4008
  isNextHidden: true
@@ -4132,34 +4013,33 @@ var Calendar = React.forwardRef(function (props, ref) {
4132
4013
  });
4133
4014
  Calendar.displayName = 'DatepickerRange.Calendar';
4134
4015
 
4135
- var DatepickerRangeComponent = function DatepickerRangeComponent(props) {
4136
- var startValue = props.startValue,
4137
- locale = props.locale,
4138
- weekStartsOn = props.weekStartsOn,
4139
- formatDate = props.formatDate,
4140
- endValue = props.endValue,
4141
- onChange = props.onChange,
4142
- customParseDate = props.customParseDate,
4143
- isCompact = props.isCompact,
4144
- minValue = props.minValue,
4145
- maxValue = props.maxValue,
4146
- children = props.children;
4147
- var reducer = React.useCallback(datepickerRangeReducer({
4148
- startValue: startValue,
4149
- locale: locale,
4150
- formatDate: formatDate,
4151
- endValue: endValue,
4152
- customParseDate: customParseDate
4016
+ const DatepickerRangeComponent = props => {
4017
+ const {
4018
+ startValue,
4019
+ locale,
4020
+ weekStartsOn,
4021
+ formatDate,
4022
+ endValue,
4023
+ onChange,
4024
+ customParseDate,
4025
+ isCompact,
4026
+ minValue,
4027
+ maxValue,
4028
+ children
4029
+ } = props;
4030
+ const reducer = React.useCallback(datepickerRangeReducer({
4031
+ startValue,
4032
+ locale,
4033
+ formatDate,
4034
+ endValue,
4035
+ customParseDate
4153
4036
  }), [startValue, endValue, locale, formatDate, onChange, customParseDate]);
4154
- var _useReducer = React.useReducer(reducer, retrieveInitialState(props)),
4155
- _useReducer2 = _slicedToArray(_useReducer, 2),
4156
- state = _useReducer2[0],
4157
- dispatch = _useReducer2[1];
4158
- var previousStartValue = React.useRef(startValue);
4159
- var previousEndValue = React.useRef(endValue);
4160
- var startInputRef = React.useRef();
4161
- var endInputRef = React.useRef();
4162
- React.useEffect(function () {
4037
+ const [state, dispatch] = React.useReducer(reducer, retrieveInitialState(props));
4038
+ const previousStartValue = React.useRef(startValue);
4039
+ const previousEndValue = React.useRef(endValue);
4040
+ const startInputRef = React.useRef();
4041
+ const endInputRef = React.useRef();
4042
+ React.useEffect(() => {
4163
4043
  dispatch({
4164
4044
  type: 'CONTROLLED_START_VALUE_CHANGE',
4165
4045
  value: startValue
@@ -4169,7 +4049,7 @@ var DatepickerRangeComponent = function DatepickerRangeComponent(props) {
4169
4049
  }
4170
4050
  previousStartValue.current = startValue;
4171
4051
  }, [props, startValue]);
4172
- React.useEffect(function () {
4052
+ React.useEffect(() => {
4173
4053
  dispatch({
4174
4054
  type: 'CONTROLLED_END_VALUE_CHANGE',
4175
4055
  value: endValue
@@ -4179,23 +4059,21 @@ var DatepickerRangeComponent = function DatepickerRangeComponent(props) {
4179
4059
  }
4180
4060
  previousEndValue.current = endValue;
4181
4061
  }, [props, endValue]);
4182
- var value = React.useMemo(function () {
4183
- return {
4184
- state: state,
4185
- dispatch: dispatch,
4186
- isCompact: isCompact,
4187
- locale: locale,
4188
- weekStartsOn: weekStartsOn,
4189
- minValue: minValue,
4190
- maxValue: maxValue,
4191
- startValue: startValue,
4192
- endValue: endValue,
4193
- onChange: onChange,
4194
- startInputRef: startInputRef,
4195
- endInputRef: endInputRef,
4196
- customParseDate: customParseDate
4197
- };
4198
- }, [state, dispatch, isCompact, locale, weekStartsOn, minValue, maxValue, startValue, endValue, onChange, startInputRef, endInputRef, customParseDate]);
4062
+ const value = React.useMemo(() => ({
4063
+ state,
4064
+ dispatch,
4065
+ isCompact,
4066
+ locale,
4067
+ weekStartsOn,
4068
+ minValue,
4069
+ maxValue,
4070
+ startValue,
4071
+ endValue,
4072
+ onChange,
4073
+ startInputRef,
4074
+ endInputRef,
4075
+ customParseDate
4076
+ }), [state, dispatch, isCompact, locale, weekStartsOn, minValue, maxValue, startValue, endValue, onChange, startInputRef, endInputRef, customParseDate]);
4199
4077
  return React__default["default"].createElement(DatepickerRangeContext.Provider, {
4200
4078
  value: value
4201
4079
  }, children);
@@ -4216,7 +4094,7 @@ DatepickerRangeComponent.defaultProps = {
4216
4094
  locale: 'en-US',
4217
4095
  isCompact: false
4218
4096
  };
4219
- var DatepickerRange = DatepickerRangeComponent;
4097
+ const DatepickerRange = DatepickerRangeComponent;
4220
4098
  DatepickerRange.Calendar = Calendar;
4221
4099
  DatepickerRange.End = End;
4222
4100
  DatepickerRange.Start = Start;