@elliemae/ds-date-picker 2.2.0-alpha.4 → 3.0.0-next.2
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 +221 -219
- package/cjs/components/DSDatePickerImpl.js +208 -128
- package/cjs/components/DatePickerController/DatePickerController.js +242 -204
- package/cjs/components/DatePickerDay/DatePickerDay.js +23 -48
- package/cjs/components/DatePickerDropdown.js +54 -74
- package/cjs/components/DatePickerHeader/DatePickerHeader.js +44 -62
- package/cjs/components/DatePickerNavigation/DatePickerNavigation.js +31 -62
- package/cjs/components/DatePickerPicker/DatePickerPicker.js +71 -82
- package/cjs/components/DatePickerRange/DatePickerRange.js +93 -84
- package/cjs/components/DatePickerRangeHeader/DatePickerRangeHeader.js +97 -91
- package/cjs/components/DatePickerRenderMonth/DatePickerRenderMonth.js +45 -60
- package/cjs/components/DatePickerSingleDate/DatePickerSingleDate.js +77 -88
- package/cjs/components/SingleRangeDateSwitcher/SingleRangeDateSwitcher.js +48 -69
- package/cjs/components/index.js +27 -53
- package/cjs/defaultPhrases.js +92 -77
- package/cjs/index.js +35 -38
- package/esm/DSDatePicker.js +169 -171
- package/esm/components/DSDatePickerImpl.js +189 -88
- package/esm/components/DatePickerController/DatePickerController.js +198 -141
- package/esm/components/DatePickerDay/DatePickerDay.js +17 -19
- package/esm/components/DatePickerDropdown.js +46 -45
- package/esm/components/DatePickerHeader/DatePickerHeader.js +35 -31
- package/esm/components/DatePickerNavigation/DatePickerNavigation.js +24 -36
- package/esm/components/DatePickerPicker/DatePickerPicker.js +48 -44
- package/esm/components/DatePickerRange/DatePickerRange.js +79 -49
- package/esm/components/DatePickerRangeHeader/DatePickerRangeHeader.js +78 -50
- package/esm/components/DatePickerRenderMonth/DatePickerRenderMonth.js +37 -31
- package/esm/components/DatePickerSingleDate/DatePickerSingleDate.js +66 -56
- package/esm/components/SingleRangeDateSwitcher/SingleRangeDateSwitcher.js +42 -40
- package/esm/components/index.js +10 -24
- package/esm/defaultPhrases.js +80 -48
- package/esm/index.js +13 -9
- package/package.json +10 -10
- package/types/components/DSDatePickerImpl.d.ts +1 -2
- package/types/components/DatePickerController/DatePickerController.d.ts +1 -1
- package/types/components/DatePickerDay/DatePickerDay.d.ts +0 -1
- package/types/components/DatePickerDropdown.d.ts +0 -1
- package/types/components/DatePickerHeader/DatePickerHeader.d.ts +0 -1
- package/types/components/DatePickerNavigation/DatePickerNavigation.d.ts +3 -4
- package/types/components/DatePickerPicker/DatePickerPicker.d.ts +1 -2
- package/types/components/DatePickerRange/DatePickerRange.d.ts +0 -1
- package/types/components/DatePickerRangeHeader/DatePickerRangeHeader.d.ts +0 -1
- package/types/components/DatePickerSingleDate/DatePickerSingleDate.d.ts +0 -1
- package/types/components/SingleRangeDateSwitcher/SingleRangeDateSwitcher.d.ts +0 -1
- package/cjs/DSDatePicker.js.map +0 -7
- package/cjs/components/DSDatePickerImpl.js.map +0 -7
- package/cjs/components/DatePickerController/DatePickerController.js.map +0 -7
- package/cjs/components/DatePickerDay/DatePickerDay.js.map +0 -7
- package/cjs/components/DatePickerDropdown.js.map +0 -7
- package/cjs/components/DatePickerHeader/DatePickerHeader.js.map +0 -7
- package/cjs/components/DatePickerNavigation/DatePickerNavigation.js.map +0 -7
- package/cjs/components/DatePickerPicker/DatePickerPicker.js.map +0 -7
- package/cjs/components/DatePickerRange/DatePickerRange.js.map +0 -7
- package/cjs/components/DatePickerRangeHeader/DatePickerRangeHeader.js.map +0 -7
- package/cjs/components/DatePickerRenderMonth/DatePickerRenderMonth.js.map +0 -7
- package/cjs/components/DatePickerSingleDate/DatePickerSingleDate.js.map +0 -7
- package/cjs/components/SingleRangeDateSwitcher/SingleRangeDateSwitcher.js.map +0 -7
- package/cjs/components/index.js.map +0 -7
- package/cjs/defaultPhrases.js.map +0 -7
- package/cjs/index.js.map +0 -7
- package/esm/DSDatePicker.js.map +0 -7
- package/esm/components/DSDatePickerImpl.js.map +0 -7
- package/esm/components/DatePickerController/DatePickerController.js.map +0 -7
- package/esm/components/DatePickerDay/DatePickerDay.js.map +0 -7
- package/esm/components/DatePickerDropdown.js.map +0 -7
- package/esm/components/DatePickerHeader/DatePickerHeader.js.map +0 -7
- package/esm/components/DatePickerNavigation/DatePickerNavigation.js.map +0 -7
- package/esm/components/DatePickerPicker/DatePickerPicker.js.map +0 -7
- package/esm/components/DatePickerRange/DatePickerRange.js.map +0 -7
- package/esm/components/DatePickerRangeHeader/DatePickerRangeHeader.js.map +0 -7
- package/esm/components/DatePickerRenderMonth/DatePickerRenderMonth.js.map +0 -7
- package/esm/components/DatePickerSingleDate/DatePickerSingleDate.js.map +0 -7
- package/esm/components/SingleRangeDateSwitcher/SingleRangeDateSwitcher.js.map +0 -7
- package/esm/components/index.js.map +0 -7
- package/esm/defaultPhrases.js.map +0 -7
- package/esm/index.js.map +0 -7
|
@@ -1,126 +1,196 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
|
|
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';
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import { debounce } from 'lodash';
|
|
11
|
+
import PropTypes from 'prop-types';
|
|
12
|
+
import moment from 'moment';
|
|
13
|
+
import 'react-dates/initialize';
|
|
14
|
+
import { DayPickerSingleDateController } from 'react-dates';
|
|
15
|
+
import { convertPropToCssClassName } from '@elliemae/ds-classnames';
|
|
16
|
+
import { ChevronLeft } from '@elliemae/ds-icons';
|
|
17
|
+
import { SingleDatePickerPhrases } from '../../defaultPhrases.js';
|
|
18
|
+
import { renderMonthElement } from '../DatePickerRenderMonth/DatePickerRenderMonth.js';
|
|
19
|
+
import Navigation from '../DatePickerNavigation/DatePickerNavigation.js';
|
|
20
|
+
import Day from '../DatePickerDay/DatePickerDay.js';
|
|
21
|
+
import { jsx } from 'react/jsx-runtime';
|
|
22
|
+
|
|
23
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
24
|
+
|
|
25
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
26
|
+
const {
|
|
27
|
+
classNameElement,
|
|
28
|
+
classNameBlock
|
|
29
|
+
} = convertPropToCssClassName('datepicker-range');
|
|
15
30
|
const focusElementOnOpen = debounce((datePickerDom, firstFocusableItemDom, focusCurrentDate) => {
|
|
16
31
|
if (datePickerDom) {
|
|
17
|
-
const currentDay = Array.from(datePickerDom
|
|
18
|
-
const [calendarDaySelected] = datePickerDom
|
|
32
|
+
const currentDay = Array.from(datePickerDom === null || datePickerDom === void 0 ? void 0 : datePickerDom.getElementsByClassName('CalendarDay__today')).filter(el => !el.className.includes('CalendarDay__outside'))[0];
|
|
33
|
+
const [calendarDaySelected] = datePickerDom === null || datePickerDom === void 0 ? void 0 : datePickerDom.getElementsByClassName('CalendarDay__selected');
|
|
34
|
+
|
|
19
35
|
if (calendarDaySelected) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
else {
|
|
24
|
-
|
|
25
|
-
|
|
36
|
+
var _calendarDaySelected$;
|
|
37
|
+
|
|
38
|
+
calendarDaySelected === null || calendarDaySelected === void 0 ? void 0 : (_calendarDaySelected$ = calendarDaySelected.focus) === null || _calendarDaySelected$ === void 0 ? void 0 : _calendarDaySelected$.call(calendarDaySelected);
|
|
39
|
+
} else if (focusCurrentDate && !calendarDaySelected) currentDay.focus();else {
|
|
40
|
+
var _navButton$focus;
|
|
41
|
+
|
|
42
|
+
const navButton = firstFocusableItemDom === null || firstFocusableItemDom === void 0 ? void 0 : firstFocusableItemDom.closest('.DayPickerNavigation_button>div');
|
|
43
|
+
navButton === null || navButton === void 0 ? void 0 : (_navButton$focus = navButton.focus) === null || _navButton$focus === void 0 ? void 0 : _navButton$focus.call(navButton);
|
|
26
44
|
}
|
|
27
45
|
}
|
|
28
46
|
}, 100);
|
|
29
|
-
class DSDatePickerController extends
|
|
47
|
+
class DSDatePickerController extends React.Component {
|
|
48
|
+
// eslint-disable-next-line react/static-property-placement
|
|
30
49
|
constructor(props) {
|
|
31
50
|
super(props);
|
|
51
|
+
|
|
32
52
|
this.handleMouseUp = () => {
|
|
53
|
+
var _focusedElement$blur;
|
|
54
|
+
|
|
33
55
|
const focusedElement = document.activeElement;
|
|
34
|
-
focusedElement
|
|
56
|
+
focusedElement === null || focusedElement === void 0 ? void 0 : (_focusedElement$blur = focusedElement.blur) === null || _focusedElement$blur === void 0 ? void 0 : _focusedElement$blur.call(focusedElement);
|
|
35
57
|
};
|
|
36
|
-
|
|
37
|
-
|
|
58
|
+
|
|
59
|
+
this.handleKeyDown = event => {
|
|
60
|
+
const [firstDay, ...restOfDays] = document.getElementsByClassName('CalendarMonthGrid_month__horizontal')[1].getElementsByClassName('CalendarDay');
|
|
38
61
|
const [lastDay] = restOfDays.slice(-1);
|
|
39
|
-
const {
|
|
62
|
+
const {
|
|
63
|
+
onClickEscape
|
|
64
|
+
} = this.props;
|
|
65
|
+
|
|
40
66
|
switch (event.key) {
|
|
41
|
-
case
|
|
67
|
+
case 'Home':
|
|
42
68
|
firstDay.focus();
|
|
43
69
|
break;
|
|
44
|
-
|
|
70
|
+
|
|
71
|
+
case 'End':
|
|
45
72
|
lastDay.focus();
|
|
46
73
|
break;
|
|
47
|
-
|
|
74
|
+
|
|
75
|
+
case 'Escape':
|
|
48
76
|
onClickEscape();
|
|
49
77
|
break;
|
|
50
|
-
default:
|
|
51
|
-
break;
|
|
52
78
|
}
|
|
53
79
|
};
|
|
80
|
+
|
|
54
81
|
this.getSafeValue = () => {
|
|
55
|
-
const {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
if (
|
|
64
|
-
|
|
82
|
+
const {
|
|
83
|
+
value,
|
|
84
|
+
date,
|
|
85
|
+
defaultValue
|
|
86
|
+
} = this.props;
|
|
87
|
+
const {
|
|
88
|
+
selectedDate
|
|
89
|
+
} = this.state;
|
|
90
|
+
if (value) return moment(value);
|
|
91
|
+
if (date) return moment(date);
|
|
92
|
+
if (defaultValue) return moment(defaultValue);
|
|
93
|
+
if (selectedDate) return moment(selectedDate);
|
|
65
94
|
return null;
|
|
66
95
|
};
|
|
96
|
+
|
|
67
97
|
this.isControlled = () => {
|
|
68
|
-
const {
|
|
98
|
+
const {
|
|
99
|
+
value,
|
|
100
|
+
date
|
|
101
|
+
} = this.props;
|
|
69
102
|
return Boolean(value) || Boolean(date);
|
|
70
103
|
};
|
|
71
|
-
|
|
72
|
-
|
|
104
|
+
|
|
105
|
+
this.handleDateChange = date => {
|
|
106
|
+
const {
|
|
107
|
+
readOnly,
|
|
108
|
+
onDateChange,
|
|
109
|
+
onChange
|
|
110
|
+
} = this.props;
|
|
111
|
+
|
|
73
112
|
if (!readOnly) {
|
|
74
113
|
if (!this.isControlled()) {
|
|
75
|
-
this.setState({
|
|
114
|
+
this.setState({
|
|
115
|
+
selectedDate: date
|
|
116
|
+
});
|
|
76
117
|
}
|
|
118
|
+
|
|
77
119
|
onDateChange(date);
|
|
78
120
|
onChange(date);
|
|
79
121
|
}
|
|
80
122
|
};
|
|
81
|
-
|
|
82
|
-
|
|
123
|
+
|
|
124
|
+
this.handleChange = dataInput => {
|
|
125
|
+
const {
|
|
126
|
+
onDateChange,
|
|
127
|
+
onChange
|
|
128
|
+
} = this.props;
|
|
83
129
|
const momentvalue = moment(dataInput.target.value);
|
|
84
|
-
this.setState({
|
|
130
|
+
this.setState({
|
|
131
|
+
selectedDate: momentvalue
|
|
132
|
+
});
|
|
85
133
|
onDateChange(momentvalue);
|
|
86
134
|
onChange(momentvalue);
|
|
87
135
|
};
|
|
136
|
+
|
|
88
137
|
this.handleNavClick = (date, nav) => {
|
|
89
|
-
const [prev, next] = document.getElementsByClassName(
|
|
90
|
-
const {
|
|
91
|
-
|
|
92
|
-
|
|
138
|
+
const [prev, next] = document.getElementsByClassName('DayPickerNavigation_button');
|
|
139
|
+
const {
|
|
140
|
+
onPrevMonthClick,
|
|
141
|
+
onNextMonthClick
|
|
142
|
+
} = this.props;
|
|
143
|
+
|
|
144
|
+
if (nav === 'prev') {
|
|
145
|
+
var _prev$focus;
|
|
146
|
+
|
|
147
|
+
prev === null || prev === void 0 ? void 0 : (_prev$focus = prev.focus) === null || _prev$focus === void 0 ? void 0 : _prev$focus.call(prev);
|
|
93
148
|
onPrevMonthClick(date);
|
|
94
149
|
} else {
|
|
95
|
-
|
|
150
|
+
var _next$focus;
|
|
151
|
+
|
|
152
|
+
next === null || next === void 0 ? void 0 : (_next$focus = next.focus) === null || _next$focus === void 0 ? void 0 : _next$focus.call(next);
|
|
96
153
|
onNextMonthClick(date);
|
|
97
154
|
}
|
|
98
155
|
};
|
|
99
|
-
|
|
100
|
-
|
|
156
|
+
|
|
157
|
+
this.insideBlur = event => {
|
|
158
|
+
const {
|
|
159
|
+
datePicker
|
|
160
|
+
} = this.state;
|
|
161
|
+
|
|
101
162
|
if (!datePicker.current.contains(event.currentTarget)) {
|
|
102
163
|
this.props.onClose();
|
|
103
164
|
}
|
|
104
165
|
};
|
|
166
|
+
|
|
105
167
|
this.state = {
|
|
106
168
|
selectedDate: null,
|
|
107
|
-
firstFocusableItem:
|
|
108
|
-
datePicker:
|
|
169
|
+
firstFocusableItem: /*#__PURE__*/React.createRef(),
|
|
170
|
+
datePicker: /*#__PURE__*/React.createRef()
|
|
109
171
|
};
|
|
110
172
|
}
|
|
173
|
+
|
|
111
174
|
componentDidMount() {
|
|
112
|
-
const {
|
|
113
|
-
|
|
114
|
-
|
|
175
|
+
const {
|
|
176
|
+
datePicker,
|
|
177
|
+
firstFocusableItem
|
|
178
|
+
} = this.state;
|
|
179
|
+
datePicker.current.addEventListener('mouseup', this.handleMouseUp, false);
|
|
180
|
+
document.addEventListener('keydown', this.handleKeyDown, false);
|
|
115
181
|
setTimeout(() => {
|
|
116
|
-
focusElementOnOpen(datePicker
|
|
182
|
+
focusElementOnOpen(datePicker === null || datePicker === void 0 ? void 0 : datePicker.current, firstFocusableItem === null || firstFocusableItem === void 0 ? void 0 : firstFocusableItem.current, this.props.focusCurrentDate);
|
|
117
183
|
}, 400);
|
|
118
184
|
}
|
|
185
|
+
|
|
119
186
|
componentWillUnmount() {
|
|
120
|
-
const {
|
|
121
|
-
|
|
122
|
-
|
|
187
|
+
const {
|
|
188
|
+
datePicker
|
|
189
|
+
} = this.state;
|
|
190
|
+
datePicker.current.removeEventListener('mouseup', this.handleMouseUp, false);
|
|
191
|
+
document.removeEventListener('keydown', this.handleKeyDown, false);
|
|
123
192
|
}
|
|
193
|
+
|
|
124
194
|
render() {
|
|
125
195
|
const {
|
|
126
196
|
numberOfMonths,
|
|
@@ -140,60 +210,68 @@ class DSDatePickerController extends React2.Component {
|
|
|
140
210
|
key,
|
|
141
211
|
calendarProps
|
|
142
212
|
} = this.props;
|
|
143
|
-
const {
|
|
213
|
+
const {
|
|
214
|
+
datePicker,
|
|
215
|
+
firstFocusableItem
|
|
216
|
+
} = this.state;
|
|
144
217
|
const safedate = this.getSafeValue();
|
|
145
218
|
const safeinitialMonth = safedate && safedate.isValid() ? () => safedate : () => initialVisibleMonth;
|
|
146
|
-
return
|
|
219
|
+
return /*#__PURE__*/_jsx("div", {}, void 0, /*#__PURE__*/jsx("div", _objectSpread(_objectSpread({
|
|
147
220
|
onBlur: this.insideBlur,
|
|
148
221
|
ref: datePicker,
|
|
149
|
-
className: classNameBlock(
|
|
150
|
-
"data-testid": "calendar-wrapper"
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
222
|
+
className: classNameBlock('wrapper-day-picker-single-date-controller'),
|
|
223
|
+
"data-testid": "calendar-wrapper"
|
|
224
|
+
}, calendarProps), {}, {
|
|
225
|
+
children: /*#__PURE__*/_jsx(DayPickerSingleDateController, {
|
|
226
|
+
date: safedate,
|
|
227
|
+
enableOutsideDays: enableOutsideDays,
|
|
228
|
+
firstDayOfWeek: firstDayOfWeek,
|
|
229
|
+
focused: true,
|
|
230
|
+
hideKeyboardShortcutsPanel: hideKeyboardShortcutsPanel,
|
|
231
|
+
initialVisibleMonth: safeinitialMonth,
|
|
232
|
+
isDayBlocked: isDayBlocked,
|
|
233
|
+
isDayHighlighted: isDayHighlighted,
|
|
234
|
+
isOutsideRange: isOutsideRange,
|
|
235
|
+
keepOpenOnDateSelect: keepOpenOnDateSelect,
|
|
236
|
+
navNext: /*#__PURE__*/_jsx(Navigation, {
|
|
237
|
+
className: classNameElement('navigation-next')
|
|
238
|
+
}),
|
|
239
|
+
navPrev: /*#__PURE__*/_jsx(Navigation, {
|
|
240
|
+
className: classNameElement('navigation-prev'),
|
|
241
|
+
icon: ChevronLeft,
|
|
242
|
+
innerRef: firstFocusableItem
|
|
243
|
+
}),
|
|
244
|
+
renderMonthElement: renderMonthElement,
|
|
245
|
+
numberOfMonths: numberOfMonths,
|
|
246
|
+
onClose: onClose,
|
|
247
|
+
onDateChange: this.handleDateChange,
|
|
248
|
+
onNextMonthClick: e => {
|
|
249
|
+
this.handleNavClick(e, 'next');
|
|
250
|
+
},
|
|
251
|
+
onOutsideClick: onOutsideClick,
|
|
252
|
+
onPrevMonthClick: e => {
|
|
253
|
+
this.handleNavClick(e, 'prev');
|
|
254
|
+
},
|
|
255
|
+
phrases: phrases,
|
|
256
|
+
renderDayContents: date => /*#__PURE__*/_jsx(Day, {
|
|
257
|
+
className: classNameElement('day-contents'),
|
|
258
|
+
date: date.format(displayFormatDay)
|
|
259
|
+
}),
|
|
260
|
+
transitionDuration: transitionDuration,
|
|
261
|
+
onTab: e => {
|
|
262
|
+
if (e.target.classList.contains('CalendarDay')) {
|
|
263
|
+
e.preventDefault();
|
|
264
|
+
onClose();
|
|
265
|
+
}
|
|
189
266
|
}
|
|
190
|
-
}
|
|
267
|
+
}, key)
|
|
191
268
|
})));
|
|
192
269
|
}
|
|
270
|
+
|
|
193
271
|
}
|
|
194
272
|
DSDatePickerController.defaultProps = {
|
|
195
|
-
date:
|
|
196
|
-
value:
|
|
273
|
+
date: '',
|
|
274
|
+
value: '',
|
|
197
275
|
enableOutsideDays: false,
|
|
198
276
|
initialVisibleMonth: moment(),
|
|
199
277
|
firstDayOfWeek: 0,
|
|
@@ -206,38 +284,18 @@ DSDatePickerController.defaultProps = {
|
|
|
206
284
|
onClickEscape: () => null,
|
|
207
285
|
onDateChange: () => null,
|
|
208
286
|
phrases: SingleDatePickerPhrases,
|
|
209
|
-
|
|
287
|
+
// displayFormat: 'L',
|
|
288
|
+
displayFormatDay: 'D',
|
|
210
289
|
transitionDuration: 0,
|
|
290
|
+
// verticalSpacing: 0,
|
|
211
291
|
isDayBlocked: () => false,
|
|
212
292
|
isOutsideRange: () => false,
|
|
213
293
|
isDayHighlighted: () => false,
|
|
214
294
|
numberOfMonths: 1
|
|
215
295
|
};
|
|
216
|
-
DSDatePickerController.propTypes = {
|
|
217
|
-
date: PropTypes.instanceOf(Date, moment),
|
|
218
|
-
value: PropTypes.oneOf(PropTypes.instanceOf(Date), PropTypes.instanceOf(moment)),
|
|
219
|
-
enableOutsideDays: PropTypes.bool,
|
|
220
|
-
initialVisibleMonth: PropTypes.instanceOf(Date, moment),
|
|
221
|
-
firstDayOfWeek: PropTypes.number,
|
|
222
|
-
keepOpenOnDateSelect: PropTypes.bool,
|
|
223
|
-
hideKeyboardShortcutsPanel: PropTypes.bool,
|
|
224
|
-
onPrevMonthClick: PropTypes.func,
|
|
225
|
-
onNextMonthClick: PropTypes.func,
|
|
226
|
-
onClose: PropTypes.func,
|
|
227
|
-
onClickEscape: PropTypes.func,
|
|
228
|
-
onChange: PropTypes.func,
|
|
229
|
-
onDateChange: PropTypes.func,
|
|
230
|
-
phrases: SingleDatePickerPhrases,
|
|
231
|
-
displayFormatDay: PropTypes.string,
|
|
232
|
-
transitionDuration: PropTypes.number,
|
|
233
|
-
isDayBlocked: PropTypes.func,
|
|
234
|
-
isOutsideRange: PropTypes.func,
|
|
235
|
-
isDayHighlighted: PropTypes.func,
|
|
236
|
-
numberOfMonths: PropTypes.number
|
|
237
|
-
};
|
|
238
296
|
DSDatePickerController.defaultProps = {
|
|
239
|
-
date:
|
|
240
|
-
value:
|
|
297
|
+
date: '',
|
|
298
|
+
value: '',
|
|
241
299
|
enableOutsideDays: false,
|
|
242
300
|
initialVisibleMonth: moment(),
|
|
243
301
|
firstDayOfWeek: 0,
|
|
@@ -279,15 +337,14 @@ DSDatePickerController.defaultProps = {
|
|
|
279
337
|
dateIsUnavailable: PropTypes.func,
|
|
280
338
|
dateIsSelected: PropTypes.func
|
|
281
339
|
}),
|
|
282
|
-
|
|
340
|
+
// displayFormat: 'L',
|
|
341
|
+
displayFormatDay: 'D',
|
|
283
342
|
transitionDuration: 0,
|
|
343
|
+
// verticalSpacing: 0,
|
|
284
344
|
isDayBlocked: () => false,
|
|
285
345
|
isOutsideRange: () => false,
|
|
286
346
|
isDayHighlighted: () => false,
|
|
287
347
|
numberOfMonths: 1
|
|
288
348
|
};
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
DSDatePickerController as default
|
|
292
|
-
};
|
|
293
|
-
//# sourceMappingURL=DatePickerController.js.map
|
|
349
|
+
|
|
350
|
+
export { DSDatePickerController as default };
|
|
@@ -1,20 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
const Day =
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import 'react';
|
|
3
|
+
|
|
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));
|
|
14
16
|
};
|
|
15
|
-
|
|
16
|
-
export {
|
|
17
|
-
Day as DatePickerDay,
|
|
18
|
-
DatePickerDay_default as default
|
|
19
|
-
};
|
|
20
|
-
//# sourceMappingURL=DatePickerDay.js.map
|
|
17
|
+
|
|
18
|
+
export { Day as default };
|
|
@@ -1,56 +1,57 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
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';
|
|
6
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
7
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
8
|
+
import 'react';
|
|
9
|
+
import { convertPropToCssClassName } from '@elliemae/ds-classnames';
|
|
10
|
+
import DSPopper from '@elliemae/ds-popper';
|
|
11
|
+
import { Picker } from './DatePickerPicker/DatePickerPicker.js';
|
|
12
|
+
import { jsx } from 'react/jsx-runtime';
|
|
13
|
+
|
|
14
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
15
|
+
|
|
16
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
17
|
+
const {
|
|
18
|
+
classNameElement
|
|
19
|
+
} = convertPropToCssClassName('datepicker-range');
|
|
20
|
+
|
|
8
21
|
const noop = () => null;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
zIndex = 1,
|
|
16
|
-
pickerProps,
|
|
17
|
-
pickerRef
|
|
18
|
-
}) {
|
|
19
|
-
return /* @__PURE__ */ React2.createElement(DSPopper, {
|
|
20
|
-
contentComponent: menu,
|
|
22
|
+
|
|
23
|
+
function DatePickerDropdown(_ref) {
|
|
24
|
+
let {
|
|
25
|
+
disabled = false,
|
|
26
|
+
readOnly,
|
|
27
|
+
onClick = noop,
|
|
21
28
|
isOpen,
|
|
29
|
+
menu,
|
|
30
|
+
zIndex = 1,
|
|
31
|
+
pickerProps,
|
|
32
|
+
pickerRef
|
|
33
|
+
} = _ref;
|
|
34
|
+
return /*#__PURE__*/_jsx(DSPopper, {
|
|
35
|
+
contentComponent: menu,
|
|
36
|
+
isOpen: isOpen,
|
|
22
37
|
modifiers: {
|
|
23
38
|
preventOverflow: {
|
|
24
39
|
enabled: true,
|
|
25
40
|
padding: 0,
|
|
26
|
-
boundariesElement:
|
|
41
|
+
boundariesElement: 'window'
|
|
27
42
|
}
|
|
28
43
|
},
|
|
29
44
|
showArrow: false,
|
|
30
|
-
triggerComponent:
|
|
31
|
-
innerRef: pickerRef
|
|
32
|
-
|
|
33
|
-
className: classNameElement(
|
|
34
|
-
disabled,
|
|
35
|
-
onClick,
|
|
36
|
-
readOnly
|
|
37
|
-
})),
|
|
38
|
-
zIndex
|
|
45
|
+
triggerComponent: /*#__PURE__*/_jsx("div", {}, void 0, /*#__PURE__*/jsx(Picker, _objectSpread(_objectSpread({
|
|
46
|
+
innerRef: pickerRef
|
|
47
|
+
}, pickerProps), {}, {
|
|
48
|
+
className: classNameElement('picker'),
|
|
49
|
+
disabled: disabled,
|
|
50
|
+
onClick: onClick,
|
|
51
|
+
readOnly: readOnly
|
|
52
|
+
}))),
|
|
53
|
+
zIndex: zIndex
|
|
39
54
|
});
|
|
40
55
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
disabled: PropTypes.bool,
|
|
44
|
-
readOnly: PropTypes.bool,
|
|
45
|
-
onClick: PropTypes.func,
|
|
46
|
-
isOpen: PropTypes.bool,
|
|
47
|
-
menu: PropTypes.element,
|
|
48
|
-
zIndex: PropTypes.number,
|
|
49
|
-
pickerProps: PropTypes.shape(PickerPropsTypes)
|
|
50
|
-
};
|
|
51
|
-
var DatePickerDropdown_default = DatePickerDropdown;
|
|
52
|
-
export {
|
|
53
|
-
DatePickerDropdown,
|
|
54
|
-
DatePickerDropdown_default as default
|
|
55
|
-
};
|
|
56
|
-
//# sourceMappingURL=DatePickerDropdown.js.map
|
|
56
|
+
|
|
57
|
+
export { DatePickerDropdown as default };
|