@zendeskgarden/react-datepickers 9.15.7 → 9.16.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.
@@ -53,10 +53,8 @@ const DatePicker = forwardRef((props, calendarRef) => {
53
53
  const memoizedReducer = useCallback(datepickerReducer({
54
54
  value,
55
55
  formatDate,
56
- locale,
57
- customParseDate,
58
- onChange
59
- }), [value, formatDate, locale, onChange, customParseDate]);
56
+ locale
57
+ }), [value, formatDate, locale]);
60
58
  const [state, dispatch] = useReducer(memoizedReducer, retrieveInitialState(props));
61
59
  const triggerRef = useRef(null);
62
60
  const floatingRef = useRef(null);
@@ -133,13 +131,17 @@ const DatePicker = forwardRef((props, calendarRef) => {
133
131
  minValue: minValue,
134
132
  maxValue: maxValue,
135
133
  locale: locale,
136
- weekStartsOn: weekStartsOn
134
+ weekStartsOn: weekStartsOn,
135
+ onChange: onChange
137
136
  })));
138
137
  return React__default.createElement(React__default.Fragment, null, React__default.createElement(Input, {
139
138
  element: Child,
140
139
  dispatch: dispatch,
141
140
  state: state,
142
141
  refKey: refKey,
142
+ value: value,
143
+ onChange: onChange,
144
+ customParseDate: customParseDate,
143
145
  ref: mergeRefs([triggerRef, Child.ref ? Child.ref : null])
144
146
  }), React__default.createElement(DatePickerContext.Provider, {
145
147
  value: contextValue
@@ -39,7 +39,8 @@ const Calendar$1 = forwardRef(({
39
39
  maxValue,
40
40
  isCompact,
41
41
  locale,
42
- weekStartsOn
42
+ weekStartsOn,
43
+ onChange
43
44
  }, ref) => {
44
45
  const {
45
46
  state,
@@ -98,6 +99,9 @@ const Calendar$1 = forwardRef(({
98
99
  "aria-disabled": isDisabled || undefined,
99
100
  onClick: () => {
100
101
  if (!isDisabled) {
102
+ if (onChange && !isSameDay(value, date)) {
103
+ onChange(date);
104
+ }
101
105
  dispatch({
102
106
  type: 'SELECT_DATE',
103
107
  value: date
@@ -5,13 +5,19 @@
5
5
  * found at http://www.apache.org/licenses/LICENSE-2.0.
6
6
  */
7
7
  import { forwardRef, useRef, cloneElement } from 'react';
8
+ import { isValid } from 'date-fns/isValid';
9
+ import { isSameDay } from 'date-fns/isSameDay';
8
10
  import { composeEventHandlers, KEYS } from '@zendeskgarden/container-utilities';
11
+ import { parseInputValue } from '../utils/date-picker-reducer.js';
9
12
 
10
13
  const Input = forwardRef(({
11
14
  element,
12
15
  dispatch,
13
16
  state,
14
- refKey
17
+ refKey,
18
+ value,
19
+ onChange,
20
+ customParseDate
15
21
  }, ref) => {
16
22
  const isInputMouseDownRef = useRef(false);
17
23
  const handleBlur = () => {
@@ -20,9 +26,17 @@ const Input = forwardRef(({
20
26
  });
21
27
  };
22
28
  const handleChange = e => {
29
+ const inputValue = e.target.value;
30
+ const currentDate = parseInputValue({
31
+ inputValue,
32
+ customParseDate
33
+ });
34
+ if (onChange && currentDate && isValid(currentDate) && !isSameDay(value, currentDate)) {
35
+ onChange(currentDate);
36
+ }
23
37
  dispatch({
24
38
  type: 'MANUALLY_UPDATE_INPUT',
25
- value: e.target.value
39
+ value: inputValue
26
40
  });
27
41
  };
28
42
  const handleClick = () => {
@@ -9,7 +9,6 @@ import { subMonths } from 'date-fns/subMonths';
9
9
  import { isValid } from 'date-fns/isValid';
10
10
  import { parse } from 'date-fns/parse';
11
11
  import { isBefore } from 'date-fns/isBefore';
12
- import { isSameDay } from 'date-fns/isSameDay';
13
12
 
14
13
  function parseInputValue$1({
15
14
  inputValue,
@@ -53,9 +52,7 @@ function formatInputValue({
53
52
  const datepickerReducer = ({
54
53
  value,
55
54
  formatDate,
56
- locale,
57
- customParseDate,
58
- onChange
55
+ locale
59
56
  }) => (state, action) => {
60
57
  switch (action.type) {
61
58
  case 'OPEN':
@@ -96,13 +93,6 @@ const datepickerReducer = ({
96
93
  case 'MANUALLY_UPDATE_INPUT':
97
94
  {
98
95
  const inputValue = action.value;
99
- const currentDate = parseInputValue$1({
100
- inputValue,
101
- customParseDate
102
- });
103
- if (onChange && currentDate && isValid(currentDate) && !isSameDay(value, currentDate)) {
104
- onChange(currentDate);
105
- }
106
96
  return {
107
97
  ...state,
108
98
  isOpen: true,
@@ -142,9 +132,6 @@ const datepickerReducer = ({
142
132
  locale,
143
133
  formatDate
144
134
  });
145
- if (onChange && action.value && isValid(action.value) && !isSameDay(value, action.value)) {
146
- onChange(action.value);
147
- }
148
135
  return {
149
136
  ...state,
150
137
  isOpen: false,
@@ -179,4 +166,4 @@ function retrieveInitialState$1(initialProps) {
179
166
  };
180
167
  }
181
168
 
182
- export { datepickerReducer, retrieveInitialState$1 as retrieveInitialState };
169
+ export { datepickerReducer, parseInputValue$1 as parseInputValue, retrieveInitialState$1 as retrieveInitialState };
@@ -28,7 +28,7 @@ const Calendar = forwardRef((props, ref) => {
28
28
  return React__default.createElement(StyledRangeCalendar, Object.assign({
29
29
  ref: ref,
30
30
  "data-garden-id": "datepickers.range",
31
- "data-garden-version": '9.15.7'
31
+ "data-garden-version": '9.16.0'
32
32
  }, props), React__default.createElement(Month, {
33
33
  displayDate: state.previewDate,
34
34
  isNextHidden: true
@@ -10,7 +10,7 @@ import { componentStyles } from '@zendeskgarden/react-theming';
10
10
  const COMPONENT_ID$4 = 'datepickers.calendar';
11
11
  const StyledCalendar = styled.div.attrs({
12
12
  'data-garden-id': COMPONENT_ID$4,
13
- 'data-garden-version': '9.15.7'
13
+ 'data-garden-version': '9.16.0'
14
14
  }).withConfig({
15
15
  displayName: "StyledCalendar",
16
16
  componentId: "sc-g5hoe8-0"
@@ -22,7 +22,7 @@ const sizeStyles$2 = ({
22
22
  };
23
23
  const StyledCalendarItem = styled.div.attrs({
24
24
  'data-garden-id': COMPONENT_ID$3,
25
- 'data-garden-version': '9.15.7'
25
+ 'data-garden-version': '9.16.0'
26
26
  }).withConfig({
27
27
  displayName: "StyledCalendarItem",
28
28
  componentId: "sc-143w8wb-0"
@@ -26,7 +26,7 @@ const colorStyles$3 = ({
26
26
  };
27
27
  const StyledDatePicker = styled.div.attrs({
28
28
  'data-garden-id': COMPONENT_ID$9,
29
- 'data-garden-version': '9.15.7'
29
+ 'data-garden-version': '9.16.0'
30
30
  }).withConfig({
31
31
  displayName: "StyledDatePicker",
32
32
  componentId: "sc-15hwqzh-0"
@@ -82,7 +82,7 @@ const colorStyles = ({
82
82
  const COMPONENT_ID = 'datepickers.day';
83
83
  const StyledDay = styled.div.attrs({
84
84
  'data-garden-id': COMPONENT_ID,
85
- 'data-garden-version': '9.15.7'
85
+ 'data-garden-version': '9.16.0'
86
86
  }).withConfig({
87
87
  displayName: "StyledDay",
88
88
  componentId: "sc-v42uk5-0"
@@ -10,7 +10,7 @@ import { componentStyles } from '@zendeskgarden/react-theming';
10
10
  const COMPONENT_ID$2 = 'datepickers.day_label';
11
11
  const StyledDayLabel = styled.div.attrs({
12
12
  'data-garden-id': COMPONENT_ID$2,
13
- 'data-garden-version': '9.15.7'
13
+ 'data-garden-version': '9.16.0'
14
14
  }).withConfig({
15
15
  displayName: "StyledDayLabel",
16
16
  componentId: "sc-9bh1p7-0"
@@ -10,7 +10,7 @@ import { componentStyles } from '@zendeskgarden/react-theming';
10
10
  const COMPONENT_ID$7 = 'datepickers.header';
11
11
  const StyledHeader = styled.div.attrs({
12
12
  'data-garden-id': COMPONENT_ID$7,
13
- 'data-garden-version': '9.15.7'
13
+ 'data-garden-version': '9.16.0'
14
14
  }).withConfig({
15
15
  displayName: "StyledHeader",
16
16
  componentId: "sc-upq318-0"
@@ -10,7 +10,7 @@ import { componentStyles } from '@zendeskgarden/react-theming';
10
10
  const COMPONENT_ID$5 = 'datepickers.header_label';
11
11
  const StyledHeaderLabel = styled.div.attrs({
12
12
  'data-garden-id': COMPONENT_ID$5,
13
- 'data-garden-version': '9.15.7'
13
+ 'data-garden-version': '9.16.0'
14
14
  }).withConfig({
15
15
  displayName: "StyledHeaderLabel",
16
16
  componentId: "sc-1ryf5ub-0"
@@ -57,7 +57,7 @@ const colorStyles$2 = ({
57
57
  const COMPONENT_ID$6 = 'datepickers.header_paddle';
58
58
  const StyledHeaderPaddle = styled.div.attrs({
59
59
  'data-garden-id': COMPONENT_ID$6,
60
- 'data-garden-version': '9.15.7'
60
+ 'data-garden-version': '9.16.0'
61
61
  }).withConfig({
62
62
  displayName: "StyledHeaderPaddle",
63
63
  componentId: "sc-2oqh0g-0"
@@ -42,7 +42,7 @@ const colorStyles$1 = ({
42
42
  };
43
43
  const StyledHighlight = styled.div.attrs({
44
44
  'data-garden-id': COMPONENT_ID$1,
45
- 'data-garden-version': '9.15.7'
45
+ 'data-garden-version': '9.16.0'
46
46
  }).withConfig({
47
47
  displayName: "StyledHighlight",
48
48
  componentId: "sc-16vr32x-0"
@@ -10,7 +10,7 @@ import { componentStyles } from '@zendeskgarden/react-theming';
10
10
  const COMPONENT_ID$b = 'datepickers.menu';
11
11
  const StyledMenu = styled.div.attrs({
12
12
  'data-garden-id': COMPONENT_ID$b,
13
- 'data-garden-version': '9.15.7'
13
+ 'data-garden-version': '9.16.0'
14
14
  }).withConfig({
15
15
  displayName: "StyledMenu",
16
16
  componentId: "sc-1npbkk0-0"
@@ -10,7 +10,7 @@ import { menuStyles, getMenuPosition, componentStyles } from '@zendeskgarden/rea
10
10
  const COMPONENT_ID$a = 'datepickers.menu_wrapper';
11
11
  const StyledMenuWrapper = styled.div.attrs(props => ({
12
12
  'data-garden-id': COMPONENT_ID$a,
13
- 'data-garden-version': '9.15.7',
13
+ 'data-garden-version': '9.16.0',
14
14
  className: props.$isAnimated ? 'is-animated' : undefined
15
15
  })).withConfig({
16
16
  displayName: "StyledMenuWrapper",
@@ -11,7 +11,7 @@ import { componentStyles } from '@zendeskgarden/react-theming';
11
11
  const COMPONENT_ID$8 = 'datepickers.range_calendar';
12
12
  const StyledRangeCalendar = styled.div.attrs({
13
13
  'data-garden-id': COMPONENT_ID$8,
14
- 'data-garden-version': '9.15.7'
14
+ 'data-garden-version': '9.16.0'
15
15
  }).withConfig({
16
16
  displayName: "StyledRangeCalendar",
17
17
  componentId: "sc-1og46sy-0"
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.15.7'
66
+ 'data-garden-version': '9.16.0'
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.15.7',
75
+ 'data-garden-version': '9.16.0',
76
76
  className: props.$isAnimated ? 'is-animated' : undefined
77
77
  })).withConfig({
78
78
  displayName: "StyledMenuWrapper",
@@ -104,7 +104,7 @@ const colorStyles$3 = ({
104
104
  };
105
105
  const StyledDatePicker = styled__default.default.div.attrs({
106
106
  'data-garden-id': COMPONENT_ID$9,
107
- 'data-garden-version': '9.15.7'
107
+ 'data-garden-version': '9.16.0'
108
108
  }).withConfig({
109
109
  displayName: "StyledDatePicker",
110
110
  componentId: "sc-15hwqzh-0"
@@ -113,7 +113,7 @@ const StyledDatePicker = styled__default.default.div.attrs({
113
113
  const COMPONENT_ID$8 = 'datepickers.range_calendar';
114
114
  const StyledRangeCalendar = styled__default.default.div.attrs({
115
115
  'data-garden-id': COMPONENT_ID$8,
116
- 'data-garden-version': '9.15.7'
116
+ 'data-garden-version': '9.16.0'
117
117
  }).withConfig({
118
118
  displayName: "StyledRangeCalendar",
119
119
  componentId: "sc-1og46sy-0"
@@ -122,7 +122,7 @@ const StyledRangeCalendar = styled__default.default.div.attrs({
122
122
  const COMPONENT_ID$7 = 'datepickers.header';
123
123
  const StyledHeader = styled__default.default.div.attrs({
124
124
  'data-garden-id': COMPONENT_ID$7,
125
- 'data-garden-version': '9.15.7'
125
+ 'data-garden-version': '9.16.0'
126
126
  }).withConfig({
127
127
  displayName: "StyledHeader",
128
128
  componentId: "sc-upq318-0"
@@ -178,7 +178,7 @@ const colorStyles$2 = ({
178
178
  const COMPONENT_ID$6 = 'datepickers.header_paddle';
179
179
  const StyledHeaderPaddle = styled__default.default.div.attrs({
180
180
  'data-garden-id': COMPONENT_ID$6,
181
- 'data-garden-version': '9.15.7'
181
+ 'data-garden-version': '9.16.0'
182
182
  }).withConfig({
183
183
  displayName: "StyledHeaderPaddle",
184
184
  componentId: "sc-2oqh0g-0"
@@ -187,7 +187,7 @@ const StyledHeaderPaddle = styled__default.default.div.attrs({
187
187
  const COMPONENT_ID$5 = 'datepickers.header_label';
188
188
  const StyledHeaderLabel = styled__default.default.div.attrs({
189
189
  'data-garden-id': COMPONENT_ID$5,
190
- 'data-garden-version': '9.15.7'
190
+ 'data-garden-version': '9.16.0'
191
191
  }).withConfig({
192
192
  displayName: "StyledHeaderLabel",
193
193
  componentId: "sc-1ryf5ub-0"
@@ -196,7 +196,7 @@ const StyledHeaderLabel = styled__default.default.div.attrs({
196
196
  const COMPONENT_ID$4 = 'datepickers.calendar';
197
197
  const StyledCalendar = styled__default.default.div.attrs({
198
198
  'data-garden-id': COMPONENT_ID$4,
199
- 'data-garden-version': '9.15.7'
199
+ 'data-garden-version': '9.16.0'
200
200
  }).withConfig({
201
201
  displayName: "StyledCalendar",
202
202
  componentId: "sc-g5hoe8-0"
@@ -217,7 +217,7 @@ const sizeStyles$2 = ({
217
217
  };
218
218
  const StyledCalendarItem = styled__default.default.div.attrs({
219
219
  'data-garden-id': COMPONENT_ID$3,
220
- 'data-garden-version': '9.15.7'
220
+ 'data-garden-version': '9.16.0'
221
221
  }).withConfig({
222
222
  displayName: "StyledCalendarItem",
223
223
  componentId: "sc-143w8wb-0"
@@ -226,7 +226,7 @@ const StyledCalendarItem = styled__default.default.div.attrs({
226
226
  const COMPONENT_ID$2 = 'datepickers.day_label';
227
227
  const StyledDayLabel = styled__default.default.div.attrs({
228
228
  'data-garden-id': COMPONENT_ID$2,
229
- 'data-garden-version': '9.15.7'
229
+ 'data-garden-version': '9.16.0'
230
230
  }).withConfig({
231
231
  displayName: "StyledDayLabel",
232
232
  componentId: "sc-9bh1p7-0"
@@ -267,7 +267,7 @@ const colorStyles$1 = ({
267
267
  };
268
268
  const StyledHighlight = styled__default.default.div.attrs({
269
269
  'data-garden-id': COMPONENT_ID$1,
270
- 'data-garden-version': '9.15.7'
270
+ 'data-garden-version': '9.16.0'
271
271
  }).withConfig({
272
272
  displayName: "StyledHighlight",
273
273
  componentId: "sc-16vr32x-0"
@@ -348,7 +348,7 @@ const colorStyles = ({
348
348
  const COMPONENT_ID = 'datepickers.day';
349
349
  const StyledDay = styled__default.default.div.attrs({
350
350
  'data-garden-id': COMPONENT_ID,
351
- 'data-garden-version': '9.15.7'
351
+ 'data-garden-version': '9.16.0'
352
352
  }).withConfig({
353
353
  displayName: "StyledDay",
354
354
  componentId: "sc-v42uk5-0"
@@ -514,7 +514,8 @@ const Calendar$1 = React.forwardRef(({
514
514
  maxValue,
515
515
  isCompact,
516
516
  locale,
517
- weekStartsOn
517
+ weekStartsOn,
518
+ onChange
518
519
  }, ref) => {
519
520
  const {
520
521
  state,
@@ -573,6 +574,9 @@ const Calendar$1 = React.forwardRef(({
573
574
  "aria-disabled": isDisabled || undefined,
574
575
  onClick: () => {
575
576
  if (!isDisabled) {
577
+ if (onChange && !isSameDay.isSameDay(value, date)) {
578
+ onChange(date);
579
+ }
576
580
  dispatch({
577
581
  type: 'SELECT_DATE',
578
582
  value: date
@@ -638,9 +642,7 @@ function formatInputValue({
638
642
  const datepickerReducer = ({
639
643
  value,
640
644
  formatDate,
641
- locale,
642
- customParseDate,
643
- onChange
645
+ locale
644
646
  }) => (state, action) => {
645
647
  switch (action.type) {
646
648
  case 'OPEN':
@@ -681,13 +683,6 @@ const datepickerReducer = ({
681
683
  case 'MANUALLY_UPDATE_INPUT':
682
684
  {
683
685
  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);
690
- }
691
686
  return {
692
687
  ...state,
693
688
  isOpen: true,
@@ -727,9 +722,6 @@ const datepickerReducer = ({
727
722
  locale,
728
723
  formatDate
729
724
  });
730
- if (onChange && action.value && isValid.isValid(action.value) && !isSameDay.isSameDay(value, action.value)) {
731
- onChange(action.value);
732
- }
733
725
  return {
734
726
  ...state,
735
727
  isOpen: false,
@@ -768,7 +760,10 @@ const Input = React.forwardRef(({
768
760
  element,
769
761
  dispatch,
770
762
  state,
771
- refKey
763
+ refKey,
764
+ value,
765
+ onChange,
766
+ customParseDate
772
767
  }, ref) => {
773
768
  const isInputMouseDownRef = React.useRef(false);
774
769
  const handleBlur = () => {
@@ -777,9 +772,17 @@ const Input = React.forwardRef(({
777
772
  });
778
773
  };
779
774
  const handleChange = e => {
775
+ const inputValue = e.target.value;
776
+ const currentDate = parseInputValue$1({
777
+ inputValue,
778
+ customParseDate
779
+ });
780
+ if (onChange && currentDate && isValid.isValid(currentDate) && !isSameDay.isSameDay(value, currentDate)) {
781
+ onChange(currentDate);
782
+ }
780
783
  dispatch({
781
784
  type: 'MANUALLY_UPDATE_INPUT',
782
- value: e.target.value
785
+ value: inputValue
783
786
  });
784
787
  };
785
788
  const handleClick = () => {
@@ -852,10 +855,8 @@ const DatePicker = React.forwardRef((props, calendarRef) => {
852
855
  const memoizedReducer = React.useCallback(datepickerReducer({
853
856
  value,
854
857
  formatDate,
855
- locale,
856
- customParseDate,
857
- onChange
858
- }), [value, formatDate, locale, onChange, customParseDate]);
858
+ locale
859
+ }), [value, formatDate, locale]);
859
860
  const [state, dispatch] = React.useReducer(memoizedReducer, retrieveInitialState$1(props));
860
861
  const triggerRef = React.useRef(null);
861
862
  const floatingRef = React.useRef(null);
@@ -932,13 +933,17 @@ const DatePicker = React.forwardRef((props, calendarRef) => {
932
933
  minValue: minValue,
933
934
  maxValue: maxValue,
934
935
  locale: locale,
935
- weekStartsOn: weekStartsOn
936
+ weekStartsOn: weekStartsOn,
937
+ onChange: onChange
936
938
  })));
937
939
  return React__namespace.default.createElement(React__namespace.default.Fragment, null, React__namespace.default.createElement(Input, {
938
940
  element: Child,
939
941
  dispatch: dispatch,
940
942
  state: state,
941
943
  refKey: refKey,
944
+ value: value,
945
+ onChange: onChange,
946
+ customParseDate: customParseDate,
942
947
  ref: reactMergeRefs.mergeRefs([triggerRef, Child.ref ? Child.ref : null])
943
948
  }), React__namespace.default.createElement(DatePickerContext.Provider, {
944
949
  value: contextValue
@@ -1631,7 +1636,7 @@ const Calendar = React.forwardRef((props, ref) => {
1631
1636
  return React__namespace.default.createElement(StyledRangeCalendar, Object.assign({
1632
1637
  ref: ref,
1633
1638
  "data-garden-id": "datepickers.range",
1634
- "data-garden-version": '9.15.7'
1639
+ "data-garden-version": '9.16.0'
1635
1640
  }, props), React__namespace.default.createElement(Month, {
1636
1641
  displayDate: state.previewDate,
1637
1642
  isNextHidden: true
@@ -6,13 +6,14 @@
6
6
  */
7
7
  import React, { HTMLAttributes } from 'react';
8
8
  import { DateFnsIndex } from '../../../utils/calendar-utils';
9
- interface ICalendarProps extends HTMLAttributes<HTMLDivElement> {
9
+ interface ICalendarProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {
10
10
  value?: Date;
11
11
  minValue?: Date;
12
12
  maxValue?: Date;
13
13
  isCompact?: boolean;
14
14
  locale?: string;
15
15
  weekStartsOn?: DateFnsIndex;
16
+ onChange?: (date: Date) => void;
16
17
  }
17
18
  export declare const Calendar: React.ForwardRefExoticComponent<ICalendarProps & React.RefAttributes<HTMLDivElement>>;
18
19
  export {};
@@ -11,6 +11,9 @@ interface IInputProps {
11
11
  element: ReactElement & RefAttributes<HTMLInputElement>;
12
12
  refKey: string;
13
13
  state: IDatePickerState;
14
+ value?: Date;
15
+ onChange?: (date: Date) => void;
16
+ customParseDate?: (inputValue: string) => Date;
14
17
  }
15
18
  export declare const Input: import("react").ForwardRefExoticComponent<IInputProps & RefAttributes<HTMLInputElement>>;
16
19
  export {};
@@ -10,6 +10,13 @@ export interface IDatePickerState {
10
10
  previewDate: Date;
11
11
  inputValue: string;
12
12
  }
13
+ /**
14
+ * Parse string input value using current locale and date formats
15
+ */
16
+ export declare function parseInputValue({ inputValue, customParseDate }: {
17
+ inputValue: string;
18
+ customParseDate?: (value: string) => Date;
19
+ }): Date;
13
20
  export type DatePickerAction = {
14
21
  type: 'OPEN';
15
22
  } | {
@@ -30,12 +37,10 @@ export type DatePickerAction = {
30
37
  type: 'SELECT_DATE';
31
38
  value: Date;
32
39
  };
33
- export declare const datepickerReducer: ({ value, formatDate, locale, customParseDate, onChange }: {
40
+ export declare const datepickerReducer: ({ value, formatDate, locale }: {
34
41
  value?: Date;
35
42
  formatDate?: (date: Date) => string;
36
43
  locale: any;
37
- customParseDate?: (inputValue: string) => Date;
38
- onChange?: (date: Date) => void;
39
44
  }) => (state: IDatePickerState, action: DatePickerAction) => IDatePickerState;
40
45
  /**
41
46
  * Retrieve initial state for the DatePicker reducer
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zendeskgarden/react-datepickers",
3
- "version": "9.15.7",
3
+ "version": "9.16.0",
4
4
  "description": "Components relating to datepickers in the Garden Design System",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Zendesk Garden <garden@zendesk.com>",
@@ -34,7 +34,7 @@
34
34
  "styled-components": "^5.3.1 || ^6.0.0"
35
35
  },
36
36
  "devDependencies": {
37
- "@zendeskgarden/react-theming": "^9.15.7",
37
+ "@zendeskgarden/react-theming": "^9.16.0",
38
38
  "@zendeskgarden/svg-icons": "7.6.0"
39
39
  },
40
40
  "keywords": [
@@ -47,5 +47,5 @@
47
47
  "access": "public"
48
48
  },
49
49
  "zendeskgarden:src": "src/index.ts",
50
- "gitHead": "408ce50227122ec759bac18bca4dca6381755c31"
50
+ "gitHead": "26dc6a8cf9650e9214896d6994a4f3fba1e63541"
51
51
  }