@zendeskgarden/react-datepickers 9.12.3 → 9.12.4

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
@@ -63,7 +63,7 @@ const PLACEMENT = ['auto', ...reactTheming.PLACEMENT];
63
63
  const COMPONENT_ID$b = 'datepickers.menu';
64
64
  const StyledMenu = styled__default.default.div.attrs({
65
65
  'data-garden-id': COMPONENT_ID$b,
66
- 'data-garden-version': '9.12.3'
66
+ 'data-garden-version': '9.12.4'
67
67
  }).withConfig({
68
68
  displayName: "StyledMenu",
69
69
  componentId: "sc-1npbkk0-0"
@@ -72,7 +72,7 @@ const StyledMenu = styled__default.default.div.attrs({
72
72
  const COMPONENT_ID$a = 'datepickers.menu_wrapper';
73
73
  const StyledMenuWrapper = styled__default.default.div.attrs(props => ({
74
74
  'data-garden-id': COMPONENT_ID$a,
75
- 'data-garden-version': '9.12.3',
75
+ 'data-garden-version': '9.12.4',
76
76
  className: props.$isAnimated ? 'is-animated' : undefined
77
77
  })).withConfig({
78
78
  displayName: "StyledMenuWrapper",
@@ -86,18 +86,16 @@ const StyledMenuWrapper = styled__default.default.div.attrs(props => ({
86
86
  }), reactTheming.componentStyles);
87
87
 
88
88
  const COMPONENT_ID$9 = 'datepickers.datepicker';
89
- const sizeStyles$4 = _ref => {
90
- let {
91
- $isCompact,
92
- theme
93
- } = _ref;
89
+ const sizeStyles$4 = ({
90
+ $isCompact,
91
+ theme
92
+ }) => {
94
93
  const margin = theme.space.base * ($isCompact ? 4 : 5);
95
94
  return styled.css(["margin:", "px;"], margin);
96
95
  };
97
- const colorStyles$3 = _ref2 => {
98
- let {
99
- theme
100
- } = _ref2;
96
+ const colorStyles$3 = ({
97
+ theme
98
+ }) => {
101
99
  const foreground = reactTheming.getColor({
102
100
  variable: 'foreground.default',
103
101
  theme
@@ -106,7 +104,7 @@ const colorStyles$3 = _ref2 => {
106
104
  };
107
105
  const StyledDatePicker = styled__default.default.div.attrs({
108
106
  'data-garden-id': COMPONENT_ID$9,
109
- 'data-garden-version': '9.12.3'
107
+ 'data-garden-version': '9.12.4'
110
108
  }).withConfig({
111
109
  displayName: "StyledDatePicker",
112
110
  componentId: "sc-15hwqzh-0"
@@ -115,7 +113,7 @@ const StyledDatePicker = styled__default.default.div.attrs({
115
113
  const COMPONENT_ID$8 = 'datepickers.range_calendar';
116
114
  const StyledRangeCalendar = styled__default.default.div.attrs({
117
115
  'data-garden-id': COMPONENT_ID$8,
118
- 'data-garden-version': '9.12.3'
116
+ 'data-garden-version': '9.12.4'
119
117
  }).withConfig({
120
118
  displayName: "StyledRangeCalendar",
121
119
  componentId: "sc-1og46sy-0"
@@ -124,25 +122,23 @@ const StyledRangeCalendar = styled__default.default.div.attrs({
124
122
  const COMPONENT_ID$7 = 'datepickers.header';
125
123
  const StyledHeader = styled__default.default.div.attrs({
126
124
  'data-garden-id': COMPONENT_ID$7,
127
- 'data-garden-version': '9.12.3'
125
+ 'data-garden-version': '9.12.4'
128
126
  }).withConfig({
129
127
  displayName: "StyledHeader",
130
128
  componentId: "sc-upq318-0"
131
129
  })(["display:flex;width:", "px;", ";"], props => props.$isCompact ? props.theme.space.base * 56 : props.theme.space.base * 70, reactTheming.componentStyles);
132
130
 
133
- const sizeStyles$3 = _ref => {
134
- let {
135
- $isCompact,
136
- theme
137
- } = _ref;
131
+ const sizeStyles$3 = ({
132
+ $isCompact,
133
+ theme
134
+ }) => {
138
135
  const iconSize = theme.iconSizes.md;
139
136
  const size = theme.space.base * ($isCompact ? 8 : 10);
140
137
  return styled.css(["width:", "px;height:", "px;svg{width:", ";height:", ";}"], size, size, iconSize, iconSize);
141
138
  };
142
- const colorStyles$2 = _ref2 => {
143
- let {
144
- theme
145
- } = _ref2;
139
+ const colorStyles$2 = ({
140
+ theme
141
+ }) => {
146
142
  const foreground = reactTheming.getColor({
147
143
  variable: 'foreground.subtle',
148
144
  theme
@@ -182,7 +178,7 @@ const colorStyles$2 = _ref2 => {
182
178
  const COMPONENT_ID$6 = 'datepickers.header_paddle';
183
179
  const StyledHeaderPaddle = styled__default.default.div.attrs({
184
180
  'data-garden-id': COMPONENT_ID$6,
185
- 'data-garden-version': '9.12.3'
181
+ 'data-garden-version': '9.12.4'
186
182
  }).withConfig({
187
183
  displayName: "StyledHeaderPaddle",
188
184
  componentId: "sc-2oqh0g-0"
@@ -191,7 +187,7 @@ const StyledHeaderPaddle = styled__default.default.div.attrs({
191
187
  const COMPONENT_ID$5 = 'datepickers.header_label';
192
188
  const StyledHeaderLabel = styled__default.default.div.attrs({
193
189
  'data-garden-id': COMPONENT_ID$5,
194
- 'data-garden-version': '9.12.3'
190
+ 'data-garden-version': '9.12.4'
195
191
  }).withConfig({
196
192
  displayName: "StyledHeaderLabel",
197
193
  componentId: "sc-1ryf5ub-0"
@@ -200,18 +196,17 @@ const StyledHeaderLabel = styled__default.default.div.attrs({
200
196
  const COMPONENT_ID$4 = 'datepickers.calendar';
201
197
  const StyledCalendar = styled__default.default.div.attrs({
202
198
  'data-garden-id': COMPONENT_ID$4,
203
- 'data-garden-version': '9.12.3'
199
+ 'data-garden-version': '9.12.4'
204
200
  }).withConfig({
205
201
  displayName: "StyledCalendar",
206
202
  componentId: "sc-g5hoe8-0"
207
203
  })(["width:", "px;", ";"], props => props.$isCompact ? props.theme.space.base * 56 : props.theme.space.base * 70, reactTheming.componentStyles);
208
204
 
209
205
  const COMPONENT_ID$3 = 'datepickers.calendar_item';
210
- const sizeStyles$2 = _ref => {
211
- let {
212
- $isCompact,
213
- theme
214
- } = _ref;
206
+ const sizeStyles$2 = ({
207
+ $isCompact,
208
+ theme
209
+ }) => {
215
210
  let size;
216
211
  if ($isCompact) {
217
212
  size = `${theme.space.base * 8}px`;
@@ -222,7 +217,7 @@ const sizeStyles$2 = _ref => {
222
217
  };
223
218
  const StyledCalendarItem = styled__default.default.div.attrs({
224
219
  'data-garden-id': COMPONENT_ID$3,
225
- 'data-garden-version': '9.12.3'
220
+ 'data-garden-version': '9.12.4'
226
221
  }).withConfig({
227
222
  displayName: "StyledCalendarItem",
228
223
  componentId: "sc-143w8wb-0"
@@ -231,19 +226,18 @@ const StyledCalendarItem = styled__default.default.div.attrs({
231
226
  const COMPONENT_ID$2 = 'datepickers.day_label';
232
227
  const StyledDayLabel = styled__default.default.div.attrs({
233
228
  'data-garden-id': COMPONENT_ID$2,
234
- 'data-garden-version': '9.12.3'
229
+ 'data-garden-version': '9.12.4'
235
230
  }).withConfig({
236
231
  displayName: "StyledDayLabel",
237
232
  componentId: "sc-9bh1p7-0"
238
233
  })(["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, reactTheming.componentStyles);
239
234
 
240
235
  const COMPONENT_ID$1 = 'datepickers.highlight';
241
- const sizeStyles$1 = _ref => {
242
- let {
243
- theme,
244
- $isEnd,
245
- $isStart
246
- } = _ref;
236
+ const sizeStyles$1 = ({
237
+ theme,
238
+ $isEnd,
239
+ $isStart
240
+ }) => {
247
241
  let borderRadius;
248
242
  const startValue = '0 50% 50% 0;';
249
243
  const endValue = '50% 0 0 50%;';
@@ -261,11 +255,10 @@ const sizeStyles$1 = _ref => {
261
255
  }
262
256
  return styled.css(["border-radius:", ";width:100%;height:100%;"], borderRadius);
263
257
  };
264
- const colorStyles$1 = _ref2 => {
265
- let {
266
- $isHighlighted,
267
- theme
268
- } = _ref2;
258
+ const colorStyles$1 = ({
259
+ $isHighlighted,
260
+ theme
261
+ }) => {
269
262
  return styled.css(["background-color:", ";"], $isHighlighted && reactTheming.getColor({
270
263
  variable: 'background.primaryEmphasis',
271
264
  transparency: theme.opacity[100],
@@ -274,7 +267,7 @@ const colorStyles$1 = _ref2 => {
274
267
  };
275
268
  const StyledHighlight = styled__default.default.div.attrs({
276
269
  'data-garden-id': COMPONENT_ID$1,
277
- 'data-garden-version': '9.12.3'
270
+ 'data-garden-version': '9.12.4'
278
271
  }).withConfig({
279
272
  displayName: "StyledHighlight",
280
273
  componentId: "sc-16vr32x-0"
@@ -283,13 +276,12 @@ const StyledHighlight = styled__default.default.div.attrs({
283
276
  const sizeStyles = () => {
284
277
  return styled.css(["border-radius:50%;width:100%;height:100%;"]);
285
278
  };
286
- const colorStyles = _ref => {
287
- let {
288
- $isToday,
289
- $isPreviousMonth,
290
- theme,
291
- ...props
292
- } = _ref;
279
+ const colorStyles = ({
280
+ $isToday,
281
+ $isPreviousMonth,
282
+ theme,
283
+ ...props
284
+ }) => {
293
285
  const isSelected = props['aria-selected'];
294
286
  const isDisabled = props['aria-disabled'];
295
287
  let backgroundColor = 'inherit';
@@ -356,7 +348,7 @@ const colorStyles = _ref => {
356
348
  const COMPONENT_ID = 'datepickers.day';
357
349
  const StyledDay = styled__default.default.div.attrs({
358
350
  'data-garden-id': COMPONENT_ID,
359
- 'data-garden-version': '9.12.3'
351
+ 'data-garden-version': '9.12.4'
360
352
  }).withConfig({
361
353
  displayName: "StyledDay",
362
354
  componentId: "sc-v42uk5-0"
@@ -480,11 +472,10 @@ var SvgChevronRightStroke = function SvgChevronRightStroke(props) {
480
472
  })));
481
473
  };
482
474
 
483
- const MonthSelector = _ref => {
484
- let {
485
- locale,
486
- isCompact
487
- } = _ref;
475
+ const MonthSelector = ({
476
+ locale,
477
+ isCompact
478
+ }) => {
488
479
  const {
489
480
  state,
490
481
  dispatch
@@ -517,15 +508,14 @@ const MonthSelector = _ref => {
517
508
  }, React__namespace.default.createElement(SvgChevronRightStroke, null)));
518
509
  };
519
510
 
520
- const Calendar$1 = React.forwardRef((_ref, ref) => {
521
- let {
522
- value,
523
- minValue,
524
- maxValue,
525
- isCompact,
526
- locale,
527
- weekStartsOn
528
- } = _ref;
511
+ const Calendar$1 = React.forwardRef(({
512
+ value,
513
+ minValue,
514
+ maxValue,
515
+ isCompact,
516
+ locale,
517
+ weekStartsOn
518
+ }, ref) => {
529
519
  const {
530
520
  state,
531
521
  dispatch
@@ -606,11 +596,10 @@ const Calendar$1 = React.forwardRef((_ref, ref) => {
606
596
  });
607
597
  Calendar$1.displayName = 'Calendar';
608
598
 
609
- function parseInputValue$1(_ref) {
610
- let {
611
- inputValue,
612
- customParseDate
613
- } = _ref;
599
+ function parseInputValue$1({
600
+ inputValue,
601
+ customParseDate
602
+ }) {
614
603
  if (customParseDate) {
615
604
  return customParseDate(inputValue);
616
605
  }
@@ -629,12 +618,11 @@ function parseInputValue$1(_ref) {
629
618
  }
630
619
  return new Date(NaN);
631
620
  }
632
- function formatInputValue(_ref2) {
633
- let {
634
- date,
635
- locale,
636
- formatDate
637
- } = _ref2;
621
+ function formatInputValue({
622
+ date,
623
+ locale,
624
+ formatDate
625
+ }) {
638
626
  if (!date) {
639
627
  return '';
640
628
  }
@@ -647,113 +635,110 @@ function formatInputValue(_ref2) {
647
635
  year: 'numeric'
648
636
  }).format(date);
649
637
  }
650
- const datepickerReducer = _ref3 => {
651
- let {
652
- value,
653
- formatDate,
654
- locale,
655
- customParseDate,
656
- onChange
657
- } = _ref3;
658
- return (state, action) => {
659
- switch (action.type) {
660
- case 'OPEN':
638
+ const datepickerReducer = ({
639
+ value,
640
+ formatDate,
641
+ locale,
642
+ customParseDate,
643
+ onChange
644
+ }) => (state, action) => {
645
+ switch (action.type) {
646
+ case 'OPEN':
647
+ return {
648
+ ...state,
649
+ isOpen: true,
650
+ previewDate: value || new Date()
651
+ };
652
+ case 'CLOSE':
653
+ {
654
+ const inputValue = formatInputValue({
655
+ date: value,
656
+ locale,
657
+ formatDate
658
+ });
661
659
  return {
662
660
  ...state,
663
- isOpen: true,
664
- previewDate: value || new Date()
661
+ isOpen: false,
662
+ inputValue
665
663
  };
666
- case 'CLOSE':
667
- {
668
- const inputValue = formatInputValue({
669
- date: value,
670
- locale,
671
- formatDate
672
- });
673
- return {
674
- ...state,
675
- isOpen: false,
676
- inputValue
677
- };
678
- }
679
- case 'PREVIEW_NEXT_MONTH':
680
- {
681
- const previewDate = addMonths.addMonths(state.previewDate, 1);
682
- return {
683
- ...state,
684
- previewDate
685
- };
686
- }
687
- case 'PREVIEW_PREVIOUS_MONTH':
688
- {
689
- const previewDate = subMonths.subMonths(state.previewDate, 1);
690
- return {
691
- ...state,
692
- previewDate
693
- };
694
- }
695
- case 'MANUALLY_UPDATE_INPUT':
696
- {
697
- const inputValue = action.value;
698
- const currentDate = parseInputValue$1({
699
- inputValue,
700
- customParseDate
701
- });
702
- if (onChange && currentDate && isValid.isValid(currentDate) && !isSameDay.isSameDay(value, currentDate)) {
703
- onChange(currentDate);
704
- }
705
- return {
706
- ...state,
707
- isOpen: true,
708
- inputValue
709
- };
710
- }
711
- case 'CONTROLLED_VALUE_CHANGE':
712
- {
713
- const previewDate = action.value || new Date();
714
- const inputValue = formatInputValue({
715
- date: action.value,
716
- locale,
717
- formatDate
718
- });
719
- return {
720
- ...state,
721
- previewDate,
722
- inputValue
723
- };
724
- }
725
- case 'CONTROLLED_LOCALE_CHANGE':
726
- {
727
- const inputValue = formatInputValue({
728
- date: value,
729
- locale,
730
- formatDate
731
- });
732
- return {
733
- ...state,
734
- inputValue
735
- };
664
+ }
665
+ case 'PREVIEW_NEXT_MONTH':
666
+ {
667
+ const previewDate = addMonths.addMonths(state.previewDate, 1);
668
+ return {
669
+ ...state,
670
+ previewDate
671
+ };
672
+ }
673
+ case 'PREVIEW_PREVIOUS_MONTH':
674
+ {
675
+ const previewDate = subMonths.subMonths(state.previewDate, 1);
676
+ return {
677
+ ...state,
678
+ previewDate
679
+ };
680
+ }
681
+ case 'MANUALLY_UPDATE_INPUT':
682
+ {
683
+ const inputValue = action.value;
684
+ const currentDate = parseInputValue$1({
685
+ inputValue,
686
+ customParseDate
687
+ });
688
+ if (onChange && currentDate && isValid.isValid(currentDate) && !isSameDay.isSameDay(value, currentDate)) {
689
+ onChange(currentDate);
736
690
  }
737
- case 'SELECT_DATE':
738
- {
739
- const inputValue = formatInputValue({
740
- date: action.value,
741
- locale,
742
- formatDate
743
- });
744
- if (onChange && action.value && isValid.isValid(action.value) && !isSameDay.isSameDay(value, action.value)) {
745
- onChange(action.value);
746
- }
747
- return {
748
- ...state,
749
- isOpen: false,
750
- inputValue
751
- };
691
+ return {
692
+ ...state,
693
+ isOpen: true,
694
+ inputValue
695
+ };
696
+ }
697
+ case 'CONTROLLED_VALUE_CHANGE':
698
+ {
699
+ const previewDate = action.value || new Date();
700
+ const inputValue = formatInputValue({
701
+ date: action.value,
702
+ locale,
703
+ formatDate
704
+ });
705
+ return {
706
+ ...state,
707
+ previewDate,
708
+ inputValue
709
+ };
710
+ }
711
+ case 'CONTROLLED_LOCALE_CHANGE':
712
+ {
713
+ const inputValue = formatInputValue({
714
+ date: value,
715
+ locale,
716
+ formatDate
717
+ });
718
+ return {
719
+ ...state,
720
+ inputValue
721
+ };
722
+ }
723
+ case 'SELECT_DATE':
724
+ {
725
+ const inputValue = formatInputValue({
726
+ date: action.value,
727
+ locale,
728
+ formatDate
729
+ });
730
+ if (onChange && action.value && isValid.isValid(action.value) && !isSameDay.isSameDay(value, action.value)) {
731
+ onChange(action.value);
752
732
  }
753
- default:
754
- throw new Error();
755
- }
756
- };
733
+ return {
734
+ ...state,
735
+ isOpen: false,
736
+ inputValue
737
+ };
738
+ }
739
+ default:
740
+ throw new Error();
741
+ }
757
742
  };
758
743
  function retrieveInitialState$1(initialProps) {
759
744
  let previewDate = initialProps.value;
@@ -779,13 +764,12 @@ function retrieveInitialState$1(initialProps) {
779
764
  };
780
765
  }
781
766
 
782
- const Input = React.forwardRef((_ref, ref) => {
783
- let {
784
- element,
785
- dispatch,
786
- state,
787
- refKey
788
- } = _ref;
767
+ const Input = React.forwardRef(({
768
+ element,
769
+ dispatch,
770
+ state,
771
+ refKey
772
+ }, ref) => {
789
773
  const isInputMouseDownRef = React.useRef(false);
790
774
  const handleBlur = () => {
791
775
  dispatch({
@@ -978,12 +962,11 @@ DatePicker.propTypes = {
978
962
  zIndex: PropTypes__default.default.number
979
963
  };
980
964
 
981
- function formatValue(_ref) {
982
- let {
983
- value,
984
- locale,
985
- formatDate
986
- } = _ref;
965
+ function formatValue({
966
+ value,
967
+ locale,
968
+ formatDate
969
+ }) {
987
970
  let stringValue = '';
988
971
  if (value !== undefined && isValid.isValid(value)) {
989
972
  if (formatDate) {
@@ -998,10 +981,9 @@ function formatValue(_ref) {
998
981
  }
999
982
  return stringValue;
1000
983
  }
1001
- function parseInputValue(_ref2) {
1002
- let {
1003
- inputValue
1004
- } = _ref2;
984
+ function parseInputValue({
985
+ inputValue
986
+ }) {
1005
987
  const MINIMUM_DATE = new Date(1001, 0, 0);
1006
988
  let tryParseDate = parse.parse(inputValue || '', 'P', new Date());
1007
989
  if (isValid.isValid(tryParseDate) && !isBefore.isBefore(tryParseDate, MINIMUM_DATE)) {
@@ -1017,177 +999,184 @@ function parseInputValue(_ref2) {
1017
999
  }
1018
1000
  return new Date(NaN);
1019
1001
  }
1020
- const datepickerRangeReducer = _ref3 => {
1021
- let {
1022
- startValue,
1023
- endValue,
1024
- locale,
1025
- formatDate,
1026
- customParseDate
1027
- } = _ref3;
1028
- return (state, action) => {
1029
- switch (action.type) {
1030
- case 'START_FOCUS':
1031
- {
1032
- let previewDate = state.previewDate;
1033
- if (startValue) {
1034
- if (compareAsc.compareAsc(startValue, startOfMonth.startOfMonth(state.previewDate)) === 1 && compareAsc.compareAsc(startValue, addMonths.addMonths(endOfMonth.endOfMonth(state.previewDate), 1)) === -1) {
1035
- previewDate = state.previewDate;
1036
- } else {
1037
- previewDate = startOfMonth.startOfMonth(startValue);
1038
- }
1039
- }
1040
- return {
1041
- ...state,
1042
- previewDate,
1043
- isStartFocused: true,
1044
- isEndFocused: false
1045
- };
1046
- }
1047
- case 'END_FOCUS':
1048
- {
1049
- let previewDate = state.previewDate;
1050
- if (endValue) {
1051
- if (compareAsc.compareAsc(endValue, startOfMonth.startOfMonth(state.previewDate)) === 1 && compareAsc.compareAsc(endValue, addMonths.addMonths(endOfMonth.endOfMonth(state.previewDate), 1)) === -1) {
1052
- previewDate = state.previewDate;
1053
- } else {
1054
- previewDate = startOfMonth.startOfMonth(endValue);
1055
- }
1056
- }
1057
- return {
1058
- ...state,
1059
- previewDate,
1060
- isEndFocused: true,
1061
- isStartFocused: false
1062
- };
1063
- }
1064
- case 'START_BLUR':
1065
- {
1066
- let parsedDate;
1067
- if (customParseDate) {
1068
- parsedDate = customParseDate(state.startInputValue);
1002
+ const datepickerRangeReducer = ({
1003
+ startValue,
1004
+ endValue,
1005
+ locale,
1006
+ formatDate,
1007
+ customParseDate
1008
+ }) => (state, action) => {
1009
+ switch (action.type) {
1010
+ case 'START_FOCUS':
1011
+ {
1012
+ let previewDate = state.previewDate;
1013
+ if (startValue) {
1014
+ if (compareAsc.compareAsc(startValue, startOfMonth.startOfMonth(state.previewDate)) === 1 && compareAsc.compareAsc(startValue, addMonths.addMonths(endOfMonth.endOfMonth(state.previewDate), 1)) === -1) {
1015
+ previewDate = state.previewDate;
1069
1016
  } else {
1070
- parsedDate = parseInputValue({
1071
- inputValue: state.startInputValue
1072
- });
1017
+ previewDate = startOfMonth.startOfMonth(startValue);
1073
1018
  }
1074
- const startInputValue = formatValue({
1075
- value: parsedDate,
1076
- locale,
1077
- formatDate
1078
- });
1079
- return {
1080
- ...state,
1081
- startInputValue: startInputValue || formatValue({
1082
- value: startValue,
1083
- locale,
1084
- formatDate
1085
- }),
1086
- isStartFocused: false
1087
- };
1088
1019
  }
1089
- case 'END_BLUR':
1090
- {
1091
- let parsedDate;
1092
- if (customParseDate) {
1093
- parsedDate = customParseDate(state.endInputValue);
1020
+ return {
1021
+ ...state,
1022
+ previewDate,
1023
+ isStartFocused: true,
1024
+ isEndFocused: false
1025
+ };
1026
+ }
1027
+ case 'END_FOCUS':
1028
+ {
1029
+ let previewDate = state.previewDate;
1030
+ if (endValue) {
1031
+ if (compareAsc.compareAsc(endValue, startOfMonth.startOfMonth(state.previewDate)) === 1 && compareAsc.compareAsc(endValue, addMonths.addMonths(endOfMonth.endOfMonth(state.previewDate), 1)) === -1) {
1032
+ previewDate = state.previewDate;
1094
1033
  } else {
1095
- parsedDate = parseInputValue({
1096
- inputValue: state.endInputValue
1097
- });
1034
+ previewDate = startOfMonth.startOfMonth(endValue);
1098
1035
  }
1099
- const endInputValue = formatValue({
1100
- value: parsedDate,
1101
- locale,
1102
- formatDate
1103
- }) || formatValue({
1104
- value: endValue,
1105
- locale,
1106
- formatDate
1107
- });
1108
- return {
1109
- ...state,
1110
- endInputValue,
1111
- isEndFocused: false
1112
- };
1113
1036
  }
1114
- case 'CONTROLLED_START_VALUE_CHANGE':
1115
- {
1116
- const startInputValue = formatValue({
1117
- value: action.value,
1118
- locale,
1119
- formatDate
1037
+ return {
1038
+ ...state,
1039
+ previewDate,
1040
+ isEndFocused: true,
1041
+ isStartFocused: false
1042
+ };
1043
+ }
1044
+ case 'START_BLUR':
1045
+ {
1046
+ let parsedDate;
1047
+ if (customParseDate) {
1048
+ parsedDate = customParseDate(state.startInputValue);
1049
+ } else {
1050
+ parsedDate = parseInputValue({
1051
+ inputValue: state.startInputValue
1120
1052
  });
1121
- let previewDate = state.previewDate;
1122
- if (action.value) {
1123
- if (compareAsc.compareAsc(action.value, startOfMonth.startOfMonth(state.previewDate)) === 1 && compareAsc.compareAsc(action.value, addMonths.addMonths(endOfMonth.endOfMonth(state.previewDate), 1)) === -1) {
1124
- previewDate = state.previewDate;
1125
- } else {
1126
- previewDate = startOfMonth.startOfMonth(action.value);
1127
- }
1128
- }
1129
- return {
1130
- ...state,
1131
- startInputValue,
1132
- hoverDate: undefined,
1133
- previewDate
1134
- };
1135
1053
  }
1136
- case 'CONTROLLED_END_VALUE_CHANGE':
1137
- {
1138
- const endInputValue = formatValue({
1139
- value: action.value,
1054
+ const startInputValue = formatValue({
1055
+ value: parsedDate,
1056
+ locale,
1057
+ formatDate
1058
+ });
1059
+ return {
1060
+ ...state,
1061
+ startInputValue: startInputValue || formatValue({
1062
+ value: startValue,
1140
1063
  locale,
1141
1064
  formatDate
1065
+ }),
1066
+ isStartFocused: false
1067
+ };
1068
+ }
1069
+ case 'END_BLUR':
1070
+ {
1071
+ let parsedDate;
1072
+ if (customParseDate) {
1073
+ parsedDate = customParseDate(state.endInputValue);
1074
+ } else {
1075
+ parsedDate = parseInputValue({
1076
+ inputValue: state.endInputValue
1142
1077
  });
1143
- let previewDate = state.previewDate;
1144
- if (action.value) {
1145
- if (compareAsc.compareAsc(action.value, startOfMonth.startOfMonth(state.previewDate)) === 1 && compareAsc.compareAsc(action.value, addMonths.addMonths(endOfMonth.endOfMonth(state.previewDate), 1)) === -1) {
1146
- previewDate = state.previewDate;
1147
- } else {
1148
- previewDate = startOfMonth.startOfMonth(action.value);
1149
- }
1078
+ }
1079
+ const endInputValue = formatValue({
1080
+ value: parsedDate,
1081
+ locale,
1082
+ formatDate
1083
+ }) || formatValue({
1084
+ value: endValue,
1085
+ locale,
1086
+ formatDate
1087
+ });
1088
+ return {
1089
+ ...state,
1090
+ endInputValue,
1091
+ isEndFocused: false
1092
+ };
1093
+ }
1094
+ case 'CONTROLLED_START_VALUE_CHANGE':
1095
+ {
1096
+ const startInputValue = formatValue({
1097
+ value: action.value,
1098
+ locale,
1099
+ formatDate
1100
+ });
1101
+ let previewDate = state.previewDate;
1102
+ if (action.value) {
1103
+ if (compareAsc.compareAsc(action.value, startOfMonth.startOfMonth(state.previewDate)) === 1 && compareAsc.compareAsc(action.value, addMonths.addMonths(endOfMonth.endOfMonth(state.previewDate), 1)) === -1) {
1104
+ previewDate = state.previewDate;
1105
+ } else {
1106
+ previewDate = startOfMonth.startOfMonth(action.value);
1150
1107
  }
1151
- return {
1152
- ...state,
1153
- endInputValue,
1154
- hoverDate: undefined,
1155
- previewDate
1156
- };
1157
1108
  }
1158
- case 'CLICK_DATE':
1159
- if (state.isStartFocused) {
1160
- if (endValue !== undefined && (isBefore.isBefore(action.value, endValue) || isSameDay.isSameDay(action.value, endValue))) {
1161
- return {
1162
- ...state,
1163
- startInputValue: formatValue({
1164
- value: action.value
1165
- })
1166
- };
1109
+ return {
1110
+ ...state,
1111
+ startInputValue,
1112
+ hoverDate: undefined,
1113
+ previewDate
1114
+ };
1115
+ }
1116
+ case 'CONTROLLED_END_VALUE_CHANGE':
1117
+ {
1118
+ const endInputValue = formatValue({
1119
+ value: action.value,
1120
+ locale,
1121
+ formatDate
1122
+ });
1123
+ let previewDate = state.previewDate;
1124
+ if (action.value) {
1125
+ if (compareAsc.compareAsc(action.value, startOfMonth.startOfMonth(state.previewDate)) === 1 && compareAsc.compareAsc(action.value, addMonths.addMonths(endOfMonth.endOfMonth(state.previewDate), 1)) === -1) {
1126
+ previewDate = state.previewDate;
1127
+ } else {
1128
+ previewDate = startOfMonth.startOfMonth(action.value);
1167
1129
  }
1130
+ }
1131
+ return {
1132
+ ...state,
1133
+ endInputValue,
1134
+ hoverDate: undefined,
1135
+ previewDate
1136
+ };
1137
+ }
1138
+ case 'CLICK_DATE':
1139
+ if (state.isStartFocused) {
1140
+ if (endValue !== undefined && (isBefore.isBefore(action.value, endValue) || isSameDay.isSameDay(action.value, endValue))) {
1168
1141
  return {
1169
1142
  ...state,
1170
1143
  startInputValue: formatValue({
1171
1144
  value: action.value
1172
- }),
1173
- endInputValue: undefined
1145
+ })
1174
1146
  };
1175
- } else if (state.isEndFocused) {
1176
- if (startValue !== undefined && (isAfter.isAfter(action.value, startValue) || isSameDay.isSameDay(action.value, startValue))) {
1177
- return {
1178
- ...state,
1179
- endInputValue: formatValue({
1180
- value: action.value
1181
- })
1182
- };
1183
- }
1147
+ }
1148
+ return {
1149
+ ...state,
1150
+ startInputValue: formatValue({
1151
+ value: action.value
1152
+ }),
1153
+ endInputValue: undefined
1154
+ };
1155
+ } else if (state.isEndFocused) {
1156
+ if (startValue !== undefined && (isAfter.isAfter(action.value, startValue) || isSameDay.isSameDay(action.value, startValue))) {
1184
1157
  return {
1185
1158
  ...state,
1186
- startInputValue: formatValue({
1159
+ endInputValue: formatValue({
1187
1160
  value: action.value
1188
1161
  })
1189
1162
  };
1190
- } else if (startValue === undefined) {
1163
+ }
1164
+ return {
1165
+ ...state,
1166
+ startInputValue: formatValue({
1167
+ value: action.value
1168
+ })
1169
+ };
1170
+ } else if (startValue === undefined) {
1171
+ return {
1172
+ ...state,
1173
+ startInputValue: formatValue({
1174
+ value: action.value
1175
+ }),
1176
+ endInputValue: undefined
1177
+ };
1178
+ } else if (endValue === undefined) {
1179
+ if (isBefore.isBefore(action.value, startValue)) {
1191
1180
  return {
1192
1181
  ...state,
1193
1182
  startInputValue: formatValue({
@@ -1195,65 +1184,55 @@ const datepickerRangeReducer = _ref3 => {
1195
1184
  }),
1196
1185
  endInputValue: undefined
1197
1186
  };
1198
- } else if (endValue === undefined) {
1199
- if (isBefore.isBefore(action.value, startValue)) {
1200
- return {
1201
- ...state,
1202
- startInputValue: formatValue({
1203
- value: action.value
1204
- }),
1205
- endInputValue: undefined
1206
- };
1207
- }
1208
- return {
1209
- ...state,
1210
- endInputValue: formatValue({
1211
- value: action.value
1212
- })
1213
- };
1214
- }
1215
- return state;
1216
- case 'START_INPUT_ONCHANGE':
1217
- {
1218
- return {
1219
- ...state,
1220
- startInputValue: action.value
1221
- };
1222
- }
1223
- case 'END_INPUT_ONCHANGE':
1224
- {
1225
- return {
1226
- ...state,
1227
- endInputValue: action.value
1228
- };
1229
1187
  }
1230
- case 'HOVER_DATE':
1231
1188
  return {
1232
1189
  ...state,
1233
- hoverDate: action.value
1190
+ endInputValue: formatValue({
1191
+ value: action.value
1192
+ })
1234
1193
  };
1235
- case 'PREVIEW_NEXT_MONTH':
1236
- {
1237
- const previewDate = addMonths.addMonths(state.previewDate, 1);
1238
- return {
1239
- ...state,
1240
- previewDate,
1241
- hoverDate: undefined
1242
- };
1243
- }
1244
- case 'PREVIEW_PREVIOUS_MONTH':
1245
- {
1246
- const previewDate = subMonths.subMonths(state.previewDate, 1);
1247
- return {
1248
- ...state,
1249
- previewDate,
1250
- hoverDate: undefined
1251
- };
1252
- }
1253
- default:
1254
- throw new Error();
1255
- }
1256
- };
1194
+ }
1195
+ return state;
1196
+ case 'START_INPUT_ONCHANGE':
1197
+ {
1198
+ return {
1199
+ ...state,
1200
+ startInputValue: action.value
1201
+ };
1202
+ }
1203
+ case 'END_INPUT_ONCHANGE':
1204
+ {
1205
+ return {
1206
+ ...state,
1207
+ endInputValue: action.value
1208
+ };
1209
+ }
1210
+ case 'HOVER_DATE':
1211
+ return {
1212
+ ...state,
1213
+ hoverDate: action.value
1214
+ };
1215
+ case 'PREVIEW_NEXT_MONTH':
1216
+ {
1217
+ const previewDate = addMonths.addMonths(state.previewDate, 1);
1218
+ return {
1219
+ ...state,
1220
+ previewDate,
1221
+ hoverDate: undefined
1222
+ };
1223
+ }
1224
+ case 'PREVIEW_PREVIOUS_MONTH':
1225
+ {
1226
+ const previewDate = subMonths.subMonths(state.previewDate, 1);
1227
+ return {
1228
+ ...state,
1229
+ previewDate,
1230
+ hoverDate: undefined
1231
+ };
1232
+ }
1233
+ default:
1234
+ throw new Error();
1235
+ }
1257
1236
  };
1258
1237
  function retrieveInitialState(initialProps) {
1259
1238
  let previewDate = initialProps.startValue;
@@ -1414,12 +1393,11 @@ const End = props => {
1414
1393
  };
1415
1394
  End.displayName = 'DatePickerRange.End';
1416
1395
 
1417
- const Month = React.forwardRef((_ref, ref) => {
1418
- let {
1419
- displayDate,
1420
- isPreviousHidden,
1421
- isNextHidden
1422
- } = _ref;
1396
+ const Month = React.forwardRef(({
1397
+ displayDate,
1398
+ isPreviousHidden,
1399
+ isNextHidden
1400
+ }, ref) => {
1423
1401
  const {
1424
1402
  state,
1425
1403
  dispatch,
@@ -1653,7 +1631,7 @@ const Calendar = React.forwardRef((props, ref) => {
1653
1631
  return React__namespace.default.createElement(StyledRangeCalendar, Object.assign({
1654
1632
  ref: ref,
1655
1633
  "data-garden-id": "datepickers.range",
1656
- "data-garden-version": '9.12.3'
1634
+ "data-garden-version": '9.12.4'
1657
1635
  }, props), React__namespace.default.createElement(Month, {
1658
1636
  displayDate: state.previewDate,
1659
1637
  isNextHidden: true