@elliemae/ds-date-picker 2.0.0-alpha.10 → 2.0.0-alpha.14
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/cjs/DSDatePicker.js +52 -48
- package/cjs/components/DSDatePickerImpl.js +38 -37
- package/cjs/components/DatePickerController/DatePickerController.js +28 -25
- package/cjs/components/DatePickerDay/DatePickerDay.js +13 -10
- package/cjs/components/DatePickerDropdown.js +17 -11
- package/cjs/components/DatePickerHeader/DatePickerHeader.js +9 -10
- package/cjs/components/DatePickerNavigation/DatePickerNavigation.js +18 -15
- package/cjs/components/DatePickerPicker/DatePickerPicker.js +1 -1
- package/cjs/components/DatePickerRange/DatePickerRange.js +28 -19
- package/cjs/components/DatePickerRangeHeader/DatePickerRangeHeader.js +23 -21
- package/cjs/components/DatePickerRenderMonth/DatePickerRenderMonth.js +32 -32
- package/cjs/components/DatePickerSingleDate/DatePickerSingleDate.js +10 -8
- package/cjs/components/SingleRangeDateSwitcher/SingleRangeDateSwitcher.js +22 -20
- package/cjs/defaultPhrases.js +42 -21
- package/esm/DSDatePicker.js +52 -48
- package/esm/components/DSDatePickerImpl.js +36 -33
- package/esm/components/DatePickerController/DatePickerController.js +26 -22
- package/esm/components/DatePickerDay/DatePickerDay.js +13 -10
- package/esm/components/DatePickerDropdown.js +17 -11
- package/esm/components/DatePickerHeader/DatePickerHeader.js +9 -8
- package/esm/components/DatePickerNavigation/DatePickerNavigation.js +18 -15
- package/esm/components/DatePickerPicker/DatePickerPicker.js +1 -1
- package/esm/components/DatePickerRange/DatePickerRange.js +26 -16
- package/esm/components/DatePickerRangeHeader/DatePickerRangeHeader.js +23 -19
- package/esm/components/DatePickerRenderMonth/DatePickerRenderMonth.js +32 -30
- package/esm/components/DatePickerSingleDate/DatePickerSingleDate.js +8 -5
- package/esm/components/SingleRangeDateSwitcher/SingleRangeDateSwitcher.js +19 -16
- package/esm/defaultPhrases.js +42 -21
- package/package.json +15 -5
- package/types/components/DatePickerDropdown.d.ts +1 -1
- package/types/components/DatePickerHeader/DatePickerHeader.d.ts +1 -1
- package/types/components/DatePickerPicker/DatePickerPicker.d.ts +2 -2
- package/types/components/DatePickerRange/DatePickerRange.d.ts +1 -1
- package/cjs/package.json +0 -7
- package/esm/package.json +0 -7
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
-
import
|
|
2
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import moment from 'moment';
|
|
5
|
-
import DSInputGroup from '@elliemae/ds-
|
|
6
|
-
import { DSDateInputV2 } from '@elliemae/ds-basic/form/DateInputV2';
|
|
5
|
+
import { DSInputGroup, DSDateInputV2 } from '@elliemae/ds-form';
|
|
7
6
|
import DSDatePickerController from './DatePickerController/DatePickerController.js';
|
|
8
7
|
import DatePickerDropdown from './DatePickerDropdown.js';
|
|
9
8
|
|
|
@@ -12,13 +11,13 @@ class DSdatePickerImpl extends React.Component {
|
|
|
12
11
|
constructor(props) {
|
|
13
12
|
super(props);
|
|
14
13
|
|
|
15
|
-
|
|
14
|
+
this.onClickPicker = () => {
|
|
16
15
|
this.setState({
|
|
17
16
|
inputFocused: true
|
|
18
17
|
});
|
|
19
|
-
}
|
|
18
|
+
};
|
|
20
19
|
|
|
21
|
-
|
|
20
|
+
this.getSafeValue = () => {
|
|
22
21
|
const {
|
|
23
22
|
value,
|
|
24
23
|
date,
|
|
@@ -45,9 +44,9 @@ class DSdatePickerImpl extends React.Component {
|
|
|
45
44
|
}
|
|
46
45
|
|
|
47
46
|
return null;
|
|
48
|
-
}
|
|
47
|
+
};
|
|
49
48
|
|
|
50
|
-
|
|
49
|
+
this.getSafeInputValue = () => {
|
|
51
50
|
const safeValue = this.getSafeValue();
|
|
52
51
|
|
|
53
52
|
if (safeValue && safeValue.isValid()) {
|
|
@@ -58,17 +57,17 @@ class DSdatePickerImpl extends React.Component {
|
|
|
58
57
|
dataInput
|
|
59
58
|
} = this.state;
|
|
60
59
|
return dataInput;
|
|
61
|
-
}
|
|
60
|
+
};
|
|
62
61
|
|
|
63
|
-
|
|
62
|
+
this.isControlled = () => {
|
|
64
63
|
const {
|
|
65
64
|
value,
|
|
66
65
|
date
|
|
67
66
|
} = this.props;
|
|
68
67
|
return Boolean(value) || Boolean(date);
|
|
69
|
-
}
|
|
68
|
+
};
|
|
70
69
|
|
|
71
|
-
|
|
70
|
+
this.handleDateChange = (date, event) => {
|
|
72
71
|
const {
|
|
73
72
|
readOnly,
|
|
74
73
|
onDateChange,
|
|
@@ -95,9 +94,9 @@ class DSdatePickerImpl extends React.Component {
|
|
|
95
94
|
onBlur(date.format(FORMAT), date);
|
|
96
95
|
}
|
|
97
96
|
}
|
|
98
|
-
}
|
|
97
|
+
};
|
|
99
98
|
|
|
100
|
-
|
|
99
|
+
this.handleInputChange = (dataInput, newDate) => {
|
|
101
100
|
const {
|
|
102
101
|
onChange
|
|
103
102
|
} = this.props;
|
|
@@ -107,9 +106,9 @@ class DSdatePickerImpl extends React.Component {
|
|
|
107
106
|
};
|
|
108
107
|
this.setState(() => newState);
|
|
109
108
|
onChange(dataInput, newDate);
|
|
110
|
-
}
|
|
109
|
+
};
|
|
111
110
|
|
|
112
|
-
|
|
111
|
+
this.handleChange = newDate => {
|
|
113
112
|
if (!newDate) return;
|
|
114
113
|
const {
|
|
115
114
|
onDateChange
|
|
@@ -120,17 +119,18 @@ class DSdatePickerImpl extends React.Component {
|
|
|
120
119
|
selectedDate: momentValue
|
|
121
120
|
});
|
|
122
121
|
onDateChange(momentValue);
|
|
123
|
-
}
|
|
122
|
+
};
|
|
124
123
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
124
|
+
this.handleFocus = _ref => {
|
|
125
|
+
let {
|
|
126
|
+
focused
|
|
127
|
+
} = _ref;
|
|
128
128
|
this.setState({
|
|
129
129
|
inputFocused: focused
|
|
130
130
|
});
|
|
131
|
-
}
|
|
131
|
+
};
|
|
132
132
|
|
|
133
|
-
|
|
133
|
+
this.handleCalendarClose = () => {
|
|
134
134
|
const {
|
|
135
135
|
onClose
|
|
136
136
|
} = this.props;
|
|
@@ -139,9 +139,9 @@ class DSdatePickerImpl extends React.Component {
|
|
|
139
139
|
});
|
|
140
140
|
this.handleOnBlur();
|
|
141
141
|
onClose();
|
|
142
|
-
}
|
|
142
|
+
};
|
|
143
143
|
|
|
144
|
-
|
|
144
|
+
this.handleClickEscape = () => {
|
|
145
145
|
const {
|
|
146
146
|
onClose
|
|
147
147
|
} = this.props;
|
|
@@ -150,9 +150,9 @@ class DSdatePickerImpl extends React.Component {
|
|
|
150
150
|
});
|
|
151
151
|
this.handleOnBlur();
|
|
152
152
|
onClose();
|
|
153
|
-
}
|
|
153
|
+
};
|
|
154
154
|
|
|
155
|
-
|
|
155
|
+
this.handleOnBlur = () => {
|
|
156
156
|
setTimeout(() => {
|
|
157
157
|
const {
|
|
158
158
|
onBlur,
|
|
@@ -175,14 +175,14 @@ class DSdatePickerImpl extends React.Component {
|
|
|
175
175
|
onBlur(dataInput, null);
|
|
176
176
|
}
|
|
177
177
|
});
|
|
178
|
-
}
|
|
178
|
+
};
|
|
179
179
|
|
|
180
|
-
|
|
180
|
+
this.handleInputFocus = dataInput => {
|
|
181
181
|
const {
|
|
182
182
|
onFocus
|
|
183
183
|
} = this.props;
|
|
184
184
|
onFocus(dataInput);
|
|
185
|
-
}
|
|
185
|
+
};
|
|
186
186
|
|
|
187
187
|
this.state = {
|
|
188
188
|
pickerRef: /*#__PURE__*/React.createRef(),
|
|
@@ -248,6 +248,8 @@ class DSdatePickerImpl extends React.Component {
|
|
|
248
248
|
}
|
|
249
249
|
|
|
250
250
|
render() {
|
|
251
|
+
var _this = this;
|
|
252
|
+
|
|
251
253
|
const {
|
|
252
254
|
inputFocused
|
|
253
255
|
} = this.state;
|
|
@@ -302,10 +304,11 @@ class DSdatePickerImpl extends React.Component {
|
|
|
302
304
|
keepOpenOnDateSelect: keepOpenOnDateSelect,
|
|
303
305
|
numberOfMonths: numberOfMonths,
|
|
304
306
|
onClickEscape: this.handleClickEscape,
|
|
305
|
-
onClose: (
|
|
306
|
-
if (
|
|
307
|
-
onClose(...
|
|
308
|
-
|
|
307
|
+
onClose: function () {
|
|
308
|
+
if (_this.state.pickerRef.current) _this.state.pickerRef.current.focus();
|
|
309
|
+
onClose(...arguments);
|
|
310
|
+
|
|
311
|
+
_this.setState({
|
|
309
312
|
inputFocused: false
|
|
310
313
|
});
|
|
311
314
|
},
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
1
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
3
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
4
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
6
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
7
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
8
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
3
9
|
import React from 'react';
|
|
4
10
|
import { debounce } from 'lodash';
|
|
5
11
|
import PropTypes from 'prop-types';
|
|
@@ -7,7 +13,7 @@ import moment from 'moment';
|
|
|
7
13
|
import 'react-dates/initialize';
|
|
8
14
|
import { DayPickerSingleDateController } from 'react-dates';
|
|
9
15
|
import { convertPropToCssClassName } from '@elliemae/ds-classnames';
|
|
10
|
-
import ChevronLeft from '@elliemae/ds-icons
|
|
16
|
+
import { ChevronLeft } from '@elliemae/ds-icons';
|
|
11
17
|
import { SingleDatePickerPhrases } from '../../defaultPhrases.js';
|
|
12
18
|
import { renderMonthElement } from '../DatePickerRenderMonth/DatePickerRenderMonth.js';
|
|
13
19
|
import Navigation from '../DatePickerNavigation/DatePickerNavigation.js';
|
|
@@ -43,14 +49,14 @@ class DSDatePickerController extends React.Component {
|
|
|
43
49
|
constructor(props) {
|
|
44
50
|
super(props);
|
|
45
51
|
|
|
46
|
-
|
|
52
|
+
this.handleMouseUp = () => {
|
|
47
53
|
var _focusedElement$blur;
|
|
48
54
|
|
|
49
55
|
const focusedElement = document.activeElement;
|
|
50
56
|
focusedElement === null || focusedElement === void 0 ? void 0 : (_focusedElement$blur = focusedElement.blur) === null || _focusedElement$blur === void 0 ? void 0 : _focusedElement$blur.call(focusedElement);
|
|
51
|
-
}
|
|
57
|
+
};
|
|
52
58
|
|
|
53
|
-
|
|
59
|
+
this.handleKeyDown = event => {
|
|
54
60
|
const [firstDay, ...restOfDays] = document.getElementsByClassName('CalendarMonthGrid_month__horizontal')[1].getElementsByClassName('CalendarDay');
|
|
55
61
|
const [lastDay] = restOfDays.slice(-1);
|
|
56
62
|
const {
|
|
@@ -70,9 +76,9 @@ class DSDatePickerController extends React.Component {
|
|
|
70
76
|
onClickEscape();
|
|
71
77
|
break;
|
|
72
78
|
}
|
|
73
|
-
}
|
|
79
|
+
};
|
|
74
80
|
|
|
75
|
-
|
|
81
|
+
this.getSafeValue = () => {
|
|
76
82
|
const {
|
|
77
83
|
value,
|
|
78
84
|
date,
|
|
@@ -86,17 +92,17 @@ class DSDatePickerController extends React.Component {
|
|
|
86
92
|
if (defaultValue) return moment(defaultValue);
|
|
87
93
|
if (selectedDate) return moment(selectedDate);
|
|
88
94
|
return null;
|
|
89
|
-
}
|
|
95
|
+
};
|
|
90
96
|
|
|
91
|
-
|
|
97
|
+
this.isControlled = () => {
|
|
92
98
|
const {
|
|
93
99
|
value,
|
|
94
100
|
date
|
|
95
101
|
} = this.props;
|
|
96
102
|
return Boolean(value) || Boolean(date);
|
|
97
|
-
}
|
|
103
|
+
};
|
|
98
104
|
|
|
99
|
-
|
|
105
|
+
this.handleDateChange = date => {
|
|
100
106
|
const {
|
|
101
107
|
readOnly,
|
|
102
108
|
onDateChange,
|
|
@@ -113,9 +119,9 @@ class DSDatePickerController extends React.Component {
|
|
|
113
119
|
onDateChange(date);
|
|
114
120
|
onChange(date);
|
|
115
121
|
}
|
|
116
|
-
}
|
|
122
|
+
};
|
|
117
123
|
|
|
118
|
-
|
|
124
|
+
this.handleChange = dataInput => {
|
|
119
125
|
const {
|
|
120
126
|
onDateChange,
|
|
121
127
|
onChange
|
|
@@ -126,9 +132,9 @@ class DSDatePickerController extends React.Component {
|
|
|
126
132
|
});
|
|
127
133
|
onDateChange(momentvalue);
|
|
128
134
|
onChange(momentvalue);
|
|
129
|
-
}
|
|
135
|
+
};
|
|
130
136
|
|
|
131
|
-
|
|
137
|
+
this.handleNavClick = (date, nav) => {
|
|
132
138
|
const [prev, next] = document.getElementsByClassName('DayPickerNavigation_button');
|
|
133
139
|
const {
|
|
134
140
|
onPrevMonthClick,
|
|
@@ -146,9 +152,9 @@ class DSDatePickerController extends React.Component {
|
|
|
146
152
|
next === null || next === void 0 ? void 0 : (_next$focus = next.focus) === null || _next$focus === void 0 ? void 0 : _next$focus.call(next);
|
|
147
153
|
onNextMonthClick(date);
|
|
148
154
|
}
|
|
149
|
-
}
|
|
155
|
+
};
|
|
150
156
|
|
|
151
|
-
|
|
157
|
+
this.insideBlur = event => {
|
|
152
158
|
const {
|
|
153
159
|
datePicker
|
|
154
160
|
} = this.state;
|
|
@@ -156,7 +162,7 @@ class DSDatePickerController extends React.Component {
|
|
|
156
162
|
if (!datePicker.current.contains(event.currentTarget)) {
|
|
157
163
|
this.props.onClose();
|
|
158
164
|
}
|
|
159
|
-
}
|
|
165
|
+
};
|
|
160
166
|
|
|
161
167
|
this.state = {
|
|
162
168
|
selectedDate: null,
|
|
@@ -263,8 +269,7 @@ class DSDatePickerController extends React.Component {
|
|
|
263
269
|
}
|
|
264
270
|
|
|
265
271
|
}
|
|
266
|
-
|
|
267
|
-
_defineProperty(DSDatePickerController, "defaultProps", {
|
|
272
|
+
DSDatePickerController.defaultProps = {
|
|
268
273
|
date: '',
|
|
269
274
|
value: '',
|
|
270
275
|
enableOutsideDays: false,
|
|
@@ -287,8 +292,7 @@ _defineProperty(DSDatePickerController, "defaultProps", {
|
|
|
287
292
|
isOutsideRange: () => false,
|
|
288
293
|
isDayHighlighted: () => false,
|
|
289
294
|
numberOfMonths: 1
|
|
290
|
-
}
|
|
291
|
-
|
|
295
|
+
};
|
|
292
296
|
DSDatePickerController.defaultProps = {
|
|
293
297
|
date: '',
|
|
294
298
|
value: '',
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
2
|
import 'react';
|
|
3
3
|
|
|
4
|
-
const Day =
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"
|
|
13
|
-
|
|
4
|
+
const Day = _ref => {
|
|
5
|
+
let {
|
|
6
|
+
className = 'date-picker-content-day',
|
|
7
|
+
date = ''
|
|
8
|
+
} = _ref;
|
|
9
|
+
return /*#__PURE__*/_jsx("div", {
|
|
10
|
+
className: className,
|
|
11
|
+
"data-testid": "datepicker-day-".concat(date)
|
|
12
|
+
}, void 0, /*#__PURE__*/_jsx("div", {
|
|
13
|
+
className: "".concat(className, "-half"),
|
|
14
|
+
"data-testid": "datepicker-day"
|
|
15
|
+
}, void 0, date));
|
|
16
|
+
};
|
|
14
17
|
|
|
15
18
|
export { Day as default };
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
1
6
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
7
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
3
8
|
import 'react';
|
|
4
9
|
import { convertPropToCssClassName } from '@elliemae/ds-classnames';
|
|
5
|
-
import DSPopper from '@elliemae/ds-
|
|
10
|
+
import DSPopper from '@elliemae/ds-popper';
|
|
6
11
|
import { Picker } from './DatePickerPicker/DatePickerPicker.js';
|
|
7
12
|
import { jsx } from 'react/jsx-runtime';
|
|
8
13
|
|
|
@@ -15,16 +20,17 @@ const {
|
|
|
15
20
|
|
|
16
21
|
const noop = () => null;
|
|
17
22
|
|
|
18
|
-
function DatePickerDropdown({
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
function DatePickerDropdown(_ref) {
|
|
24
|
+
let {
|
|
25
|
+
disabled = false,
|
|
26
|
+
readOnly,
|
|
27
|
+
onClick = noop,
|
|
28
|
+
isOpen,
|
|
29
|
+
menu,
|
|
30
|
+
zIndex = 1,
|
|
31
|
+
pickerProps,
|
|
32
|
+
pickerRef
|
|
33
|
+
} = _ref;
|
|
28
34
|
return /*#__PURE__*/_jsx(DSPopper, {
|
|
29
35
|
contentComponent: menu,
|
|
30
36
|
isOpen: isOpen,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
2
3
|
import { useState, useEffect } from 'react';
|
|
3
4
|
import moment from 'moment';
|
|
4
|
-
import
|
|
5
|
-
import DSInputGroup from '@elliemae/ds-basic/form/InputGroup';
|
|
5
|
+
import { DSInputGroup, DSDateInputV2 } from '@elliemae/ds-form';
|
|
6
6
|
import { aggregatedClasses } from '@elliemae/ds-classnames';
|
|
7
7
|
|
|
8
8
|
const DATE_FORMAT = 'MMDDYYYY';
|
|
@@ -11,11 +11,12 @@ const Header = aggregatedClasses('div')(blockname);
|
|
|
11
11
|
|
|
12
12
|
const isFn = variable => typeof variable === 'function';
|
|
13
13
|
|
|
14
|
-
const DatePickerHeader =
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
const DatePickerHeader = _ref => {
|
|
15
|
+
let {
|
|
16
|
+
onInputChange = () => null,
|
|
17
|
+
selectedDate,
|
|
18
|
+
updateKeyDate
|
|
19
|
+
} = _ref;
|
|
19
20
|
const [value, setValue] = useState(isFn(selectedDate === null || selectedDate === void 0 ? void 0 : selectedDate.format) ? selectedDate.format(DATE_FORMAT) : '');
|
|
20
21
|
useEffect(() => {
|
|
21
22
|
if (isFn(selectedDate === null || selectedDate === void 0 ? void 0 : selectedDate.format)) {
|
|
@@ -35,7 +36,7 @@ const DatePickerHeader = ({
|
|
|
35
36
|
}
|
|
36
37
|
};
|
|
37
38
|
|
|
38
|
-
return /*#__PURE__*/_jsx(Header, {}, void 0, /*#__PURE__*/_jsx(DSInputGroup, {}, void 0, /*#__PURE__*/_jsx(
|
|
39
|
+
return /*#__PURE__*/_jsx(Header, {}, void 0, /*#__PURE__*/_jsx(DSInputGroup, {}, void 0, /*#__PURE__*/_jsx(DSDateInputV2, {
|
|
39
40
|
onChange: handleOnChange,
|
|
40
41
|
onKeyDown: handleOnKeyDown,
|
|
41
42
|
value: value,
|
|
@@ -3,20 +3,23 @@ import 'react';
|
|
|
3
3
|
import ChevronRight from '@elliemae/ds-icons/ChevronRight';
|
|
4
4
|
import { DSIconColors, DSIconSizes } from '@elliemae/ds-basic/Icon';
|
|
5
5
|
|
|
6
|
-
const Navigation =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
6
|
+
const Navigation = _ref => {
|
|
7
|
+
let {
|
|
8
|
+
className = 'date-picker-navigation',
|
|
9
|
+
icon: Icon = ChevronRight,
|
|
10
|
+
color = DSIconColors.NEUTRAL,
|
|
11
|
+
size = DSIconSizes.S,
|
|
12
|
+
innerRef
|
|
13
|
+
} = _ref;
|
|
14
|
+
return /*#__PURE__*/_jsx("div", {
|
|
15
|
+
tabIndex: 0,
|
|
16
|
+
"data-testid": "date-picker-nav"
|
|
17
|
+
}, void 0, /*#__PURE__*/_jsx(Icon, {
|
|
18
|
+
className: className,
|
|
19
|
+
color: color,
|
|
20
|
+
innerRef: innerRef,
|
|
21
|
+
size: size
|
|
22
|
+
}));
|
|
23
|
+
};
|
|
21
24
|
|
|
22
25
|
export { Navigation as default };
|
|
@@ -4,7 +4,7 @@ import 'react';
|
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import { DSIconSizes, DSIconColors } from '@elliemae/ds-basic/Icon';
|
|
6
6
|
import DatePicker from '@elliemae/ds-icons/DatePicker';
|
|
7
|
-
import DSButton, { buttonTypes } from '@elliemae/ds-
|
|
7
|
+
import DSButton, { buttonTypes } from '@elliemae/ds-button';
|
|
8
8
|
import { iconSizes } from '@elliemae/ds-shared/prop-types';
|
|
9
9
|
|
|
10
10
|
var _DatePicker;
|
|
@@ -1,11 +1,19 @@
|
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
1
6
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
7
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
8
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
3
9
|
import { useState, useRef } from 'react';
|
|
4
10
|
import { DayPickerRangeController } from 'react-dates';
|
|
5
11
|
import moment from 'moment';
|
|
6
|
-
import { DatePickerRangeHeader, DatePickerNavigation, DatePickerDay } from '@elliemae/ds-date-picker';
|
|
7
|
-
import ChevronLeft from '@elliemae/ds-icons/ChevronLeft';
|
|
8
12
|
import { aggregatedClasses, convertPropToCssClassName } from '@elliemae/ds-classnames';
|
|
13
|
+
import { ChevronLeft } from '@elliemae/ds-icons';
|
|
14
|
+
import Day from '../DatePickerDay/DatePickerDay.js';
|
|
15
|
+
import Navigation from '../DatePickerNavigation/DatePickerNavigation.js';
|
|
16
|
+
import DatePickerRangeHeader from '../DatePickerRangeHeader/DatePickerRangeHeader.js';
|
|
9
17
|
import { jsx } from 'react/jsx-runtime';
|
|
10
18
|
|
|
11
19
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
@@ -20,13 +28,14 @@ const {
|
|
|
20
28
|
const START_DATE = 'startDate';
|
|
21
29
|
const END_DATE = 'endDate';
|
|
22
30
|
|
|
23
|
-
const DatePickerRangeDate =
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
31
|
+
const DatePickerRangeDate = _ref => {
|
|
32
|
+
let {
|
|
33
|
+
dateStart,
|
|
34
|
+
dateEnd,
|
|
35
|
+
displayFormatDay = 'D',
|
|
36
|
+
showHeader = true,
|
|
37
|
+
otherProps
|
|
38
|
+
} = _ref;
|
|
30
39
|
const [selectedDateStart, setSelectedDateStart] = useState(dateStart);
|
|
31
40
|
const [selectedDateEnd, setSelectedDateEnd] = useState(dateEnd);
|
|
32
41
|
const [focusedInput, setFocusedInput] = useState(START_DATE);
|
|
@@ -36,10 +45,11 @@ const DatePickerRangeDate = ({
|
|
|
36
45
|
setFocusedInput(focusedInput === START_DATE ? END_DATE : START_DATE);
|
|
37
46
|
};
|
|
38
47
|
|
|
39
|
-
const handleDatesChange =
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
48
|
+
const handleDatesChange = _ref2 => {
|
|
49
|
+
let {
|
|
50
|
+
startDate,
|
|
51
|
+
endDate
|
|
52
|
+
} = _ref2;
|
|
43
53
|
setSelectedDateStart(startDate);
|
|
44
54
|
setSelectedDateEnd(endDate);
|
|
45
55
|
};
|
|
@@ -80,16 +90,16 @@ const DatePickerRangeDate = ({
|
|
|
80
90
|
focused: true,
|
|
81
91
|
focusedInput: focusedInput,
|
|
82
92
|
hideKeyboardShortcutsPanel: true,
|
|
83
|
-
navNext: /*#__PURE__*/_jsx(
|
|
93
|
+
navNext: /*#__PURE__*/_jsx(Navigation, {
|
|
84
94
|
className: classNameElement('navigation-next')
|
|
85
95
|
}),
|
|
86
|
-
navPrev: /*#__PURE__*/_jsx(
|
|
96
|
+
navPrev: /*#__PURE__*/_jsx(Navigation, {
|
|
87
97
|
className: classNameElement('navigation-prev'),
|
|
88
98
|
icon: ChevronLeft
|
|
89
99
|
}),
|
|
90
100
|
onDatesChange: handleDatesChange,
|
|
91
101
|
onFocusChange: handleFocusChange,
|
|
92
|
-
renderDayContents: date => /*#__PURE__*/_jsx(
|
|
102
|
+
renderDayContents: date => /*#__PURE__*/_jsx(Day, {
|
|
93
103
|
className: classNameElement('day-contents'),
|
|
94
104
|
date: date.format(displayFormatDay)
|
|
95
105
|
}),
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
2
3
|
import { useState, useRef, useEffect } from 'react';
|
|
3
4
|
import moment from 'moment';
|
|
4
|
-
import
|
|
5
|
-
import DSInputGroup from '@elliemae/ds-basic/form/InputGroup';
|
|
5
|
+
import { DSInputGroup, DSDateInputV2 } from '@elliemae/ds-form';
|
|
6
6
|
import { aggregatedClasses } from '@elliemae/ds-classnames';
|
|
7
7
|
|
|
8
8
|
const blockname = 'date-range-picker';
|
|
@@ -11,21 +11,25 @@ const DATE_FORMAT = 'MMDDYYYY'; // When year is greater than 999 it means the us
|
|
|
11
11
|
// to be higher than 999
|
|
12
12
|
|
|
13
13
|
const MAGIC_NUMBER = 999;
|
|
14
|
-
const Header = aggregatedClasses('div')(blockname, 'header',
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
14
|
+
const Header = aggregatedClasses('div')(blockname, 'header', _ref => {
|
|
15
|
+
let {
|
|
16
|
+
invalidDate
|
|
17
|
+
} = _ref;
|
|
18
|
+
return {
|
|
19
|
+
invalidDate
|
|
20
|
+
};
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const DatePickerRangeHeader = _ref2 => {
|
|
24
|
+
let {
|
|
25
|
+
onStartInputChange = () => null,
|
|
26
|
+
onEndInputChange = () => null,
|
|
27
|
+
onFocusChange = () => null,
|
|
28
|
+
selectedStartDate,
|
|
29
|
+
selectedEndDate,
|
|
30
|
+
handleDatesChange,
|
|
31
|
+
autoJumpOnEdit = true
|
|
32
|
+
} = _ref2;
|
|
29
33
|
const [startValue, setStartValue] = useState(selectedStartDate);
|
|
30
34
|
const [endValue, setEndValue] = useState(selectedEndDate);
|
|
31
35
|
const startInputRef = useRef();
|
|
@@ -109,7 +113,7 @@ const DatePickerRangeHeader = ({
|
|
|
109
113
|
}
|
|
110
114
|
};
|
|
111
115
|
|
|
112
|
-
return /*#__PURE__*/_jsx(Header, {}, void 0, /*#__PURE__*/_jsx(DSInputGroup, {}, void 0, /*#__PURE__*/_jsx(
|
|
116
|
+
return /*#__PURE__*/_jsx(Header, {}, void 0, /*#__PURE__*/_jsx(DSInputGroup, {}, void 0, /*#__PURE__*/_jsx(DSDateInputV2, {
|
|
113
117
|
containerProps: {
|
|
114
118
|
'data-testid': 'start-date'
|
|
115
119
|
},
|
|
@@ -118,7 +122,7 @@ const DatePickerRangeHeader = ({
|
|
|
118
122
|
onFocus: () => handleOnFocus('startDate'),
|
|
119
123
|
onKeyDown: handleOnKeyDownStart,
|
|
120
124
|
value: startValue
|
|
121
|
-
}), /*#__PURE__*/_jsx(
|
|
125
|
+
}), /*#__PURE__*/_jsx(DSDateInputV2, {
|
|
122
126
|
containerProps: {
|
|
123
127
|
'data-testid': 'end-date'
|
|
124
128
|
},
|