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