@elliemae/ds-date-range-picker 1.55.0-next.7 → 2.0.0-alpha.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/DSDateRangePicker.js +111 -183
- package/cjs/components/DSDateRangePickerImpl.js +238 -305
- package/cjs/components/DatePickerLabel/DatePickerLabel.js +9 -12
- package/cjs/components/DatePickerRangeHeader/DatePickerRangeHeader.js +36 -54
- package/cjs/components/DayPickerRangeController.js +74 -132
- package/cjs/index.js +6 -31
- package/cjs/isMaxDiffSafe.js +5 -6
- package/cjs/package.json +7 -0
- package/esm/DSDateRangePicker.js +100 -172
- package/esm/components/DSDateRangePickerImpl.js +225 -286
- package/esm/components/DatePickerLabel/DatePickerLabel.js +8 -11
- package/esm/components/DatePickerRangeHeader/DatePickerRangeHeader.js +32 -49
- package/esm/components/DayPickerRangeController.js +72 -126
- package/esm/index.js +0 -25
- package/esm/isMaxDiffSafe.js +5 -6
- package/esm/package.json +7 -0
- package/package.json +52 -11
- package/types/DSDateRangePicker.d.ts +92 -0
- package/types/components/DSDateRangePickerImpl.d.ts +24 -0
- package/types/components/DatePickerLabel/DatePickerLabel.d.ts +6 -0
- package/types/components/DatePickerRangeHeader/DatePickerRangeHeader.d.ts +10 -0
- package/types/components/DayPickerRangeController.d.ts +36 -0
- package/types/index.d.ts +2 -0
- package/types/isMaxDiffSafe.d.ts +2 -0
- package/DSDateRangePicker/package.json +0 -10
- package/cjs/DSDateRangePicker.js.map +0 -1
- package/cjs/components/DSDateRangePickerImpl.js.map +0 -1
- package/cjs/components/DatePickerLabel/DatePickerLabel.js.map +0 -1
- package/cjs/components/DatePickerRangeHeader/DatePickerRangeHeader.js.map +0 -1
- package/cjs/components/DayPickerRangeController.js.map +0 -1
- package/cjs/index.js.map +0 -1
- package/cjs/isMaxDiffSafe.js.map +0 -1
- package/components/DSDateRangePickerImpl/package.json +0 -10
- package/components/DatePickerLabel/DatePickerLabel/package.json +0 -10
- package/components/DatePickerRangeHeader/DatePickerRangeHeader/package.json +0 -10
- package/components/DayPickerRangeController/package.json +0 -10
- package/esm/DSDateRangePicker.js.map +0 -1
- package/esm/components/DSDateRangePickerImpl.js.map +0 -1
- package/esm/components/DatePickerLabel/DatePickerLabel.js.map +0 -1
- package/esm/components/DatePickerRangeHeader/DatePickerRangeHeader.js.map +0 -1
- package/esm/components/DayPickerRangeController.js.map +0 -1
- package/esm/index.js.map +0 -1
- package/esm/isMaxDiffSafe.js.map +0 -1
- package/isMaxDiffSafe/package.json +0 -10
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import _createClass from '@babel/runtime/helpers/esm/createClass';
|
|
3
|
-
import _assertThisInitialized from '@babel/runtime/helpers/esm/assertThisInitialized';
|
|
4
|
-
import _inherits from '@babel/runtime/helpers/esm/inherits';
|
|
5
|
-
import _possibleConstructorReturn from '@babel/runtime/helpers/esm/possibleConstructorReturn';
|
|
6
|
-
import _getPrototypeOf from '@babel/runtime/helpers/esm/getPrototypeOf';
|
|
1
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
7
2
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
8
3
|
import React from 'react';
|
|
9
|
-
import PropTypes from 'prop-types';
|
|
10
4
|
import moment from 'moment';
|
|
11
5
|
import { convertPropToCssClassName } from '@elliemae/ds-classnames';
|
|
12
6
|
import DSInputMask, { MASK_TYPES, MASK_PIPES } from '@elliemae/ds-basic/form/InputMask';
|
|
@@ -15,199 +9,185 @@ import DSPopper from '@elliemae/ds-basic/Popper';
|
|
|
15
9
|
import { renderMonthElement, DatePickerPicker } from '@elliemae/ds-date-picker';
|
|
16
10
|
import DayPickerRangeController from './DayPickerRangeController.js';
|
|
17
11
|
import { isMaxDiffSafe } from '../isMaxDiffSafe.js';
|
|
18
|
-
import '@babel/runtime/helpers/esm/extends';
|
|
19
|
-
import '@babel/runtime/helpers/esm/slicedToArray';
|
|
20
|
-
import '@babel/runtime/helpers/esm/toArray';
|
|
21
|
-
import '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
22
|
-
import 'react-dates';
|
|
23
|
-
import '@elliemae/ds-icons/ChevronLeft';
|
|
24
12
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
_classCallCheck(this, DSDateRangePickerImpl);
|
|
44
|
-
|
|
45
|
-
_this = _super.call(this, props);
|
|
46
|
-
|
|
47
|
-
_defineProperty(_assertThisInitialized(_this), "onDatesChange", function (_ref) {
|
|
48
|
-
var startDate = _ref.startDate,
|
|
49
|
-
endDate = _ref.endDate;
|
|
50
|
-
var onDatesChange = _this.props.onDatesChange;
|
|
13
|
+
const START_DATE = 'startDate';
|
|
14
|
+
const END_DATE = 'endDate';
|
|
15
|
+
const {
|
|
16
|
+
classNameElement,
|
|
17
|
+
classNameBlock
|
|
18
|
+
} = convertPropToCssClassName('datepicker');
|
|
19
|
+
class DSDateRangePickerImpl extends React.Component {
|
|
20
|
+
constructor(props) {
|
|
21
|
+
super(props);
|
|
22
|
+
|
|
23
|
+
_defineProperty(this, "onDatesChange", ({
|
|
24
|
+
startDate,
|
|
25
|
+
endDate
|
|
26
|
+
}) => {
|
|
27
|
+
const {
|
|
28
|
+
onDatesChange
|
|
29
|
+
} = this.props;
|
|
51
30
|
onDatesChange(startDate, endDate);
|
|
52
|
-
|
|
31
|
+
const safe = isMaxDiffSafe(startDate, endDate, this.state.startDate, this.state.endDate);
|
|
53
32
|
|
|
54
33
|
if (!safe) {
|
|
55
|
-
|
|
34
|
+
this.setState({
|
|
56
35
|
showPicker: false
|
|
57
36
|
});
|
|
58
37
|
}
|
|
59
38
|
|
|
60
|
-
|
|
61
|
-
startDate
|
|
62
|
-
endDate
|
|
39
|
+
this.setState({
|
|
40
|
+
startDate,
|
|
41
|
+
endDate,
|
|
63
42
|
primaryStartInput: false,
|
|
64
43
|
primaryEndInput: false
|
|
65
44
|
});
|
|
66
45
|
});
|
|
67
46
|
|
|
68
|
-
_defineProperty(
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
});
|
|
47
|
+
_defineProperty(this, "onFocusChange", () => {
|
|
48
|
+
this.setState(({
|
|
49
|
+
focusedInput
|
|
50
|
+
}) => ({
|
|
51
|
+
focusedInput: focusedInput === START_DATE ? END_DATE : START_DATE
|
|
52
|
+
}));
|
|
75
53
|
});
|
|
76
54
|
|
|
77
|
-
_defineProperty(
|
|
78
|
-
if (event.key === 'Escape')
|
|
55
|
+
_defineProperty(this, "handleKeyDown", event => {
|
|
56
|
+
if (event.key === 'Escape') this.setState({
|
|
79
57
|
showPicker: false
|
|
80
58
|
});
|
|
81
59
|
});
|
|
82
60
|
|
|
83
|
-
_defineProperty(
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
61
|
+
_defineProperty(this, "getSafeStartInputValue", () => {
|
|
62
|
+
const {
|
|
63
|
+
startInput,
|
|
64
|
+
primaryStartInput,
|
|
65
|
+
startDate
|
|
66
|
+
} = this.state;
|
|
88
67
|
if (primaryStartInput && startInput) return startInput;
|
|
89
68
|
if (!startDate) return '';
|
|
90
69
|
return startDate.format('MMDDYYYY');
|
|
91
70
|
});
|
|
92
71
|
|
|
93
|
-
_defineProperty(
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
72
|
+
_defineProperty(this, "getSafeEndInputValue", () => {
|
|
73
|
+
const {
|
|
74
|
+
endInput,
|
|
75
|
+
primaryEndInput,
|
|
76
|
+
endDate
|
|
77
|
+
} = this.state;
|
|
98
78
|
if (primaryEndInput && endInput) return endInput;
|
|
99
79
|
if (!endDate) return '';
|
|
100
80
|
return endDate.format('MMDDYYYY');
|
|
101
81
|
});
|
|
102
82
|
|
|
103
|
-
_defineProperty(
|
|
104
|
-
|
|
83
|
+
_defineProperty(this, "changeFocus", () => {
|
|
84
|
+
const {
|
|
85
|
+
disabled
|
|
86
|
+
} = this.props;
|
|
105
87
|
|
|
106
88
|
if (!disabled) {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
};
|
|
111
|
-
});
|
|
89
|
+
this.setState(() => ({
|
|
90
|
+
focusedInput: 'startDate'
|
|
91
|
+
}));
|
|
112
92
|
}
|
|
113
93
|
});
|
|
114
94
|
|
|
115
|
-
_defineProperty(
|
|
95
|
+
_defineProperty(this, "handleChangeStart", e => {
|
|
116
96
|
var _momentValue;
|
|
117
97
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
98
|
+
const {
|
|
99
|
+
onChangeStartInput,
|
|
100
|
+
isDayBlocked,
|
|
101
|
+
minimumNights
|
|
102
|
+
} = this.props;
|
|
103
|
+
const {
|
|
104
|
+
endDate
|
|
105
|
+
} = this.state;
|
|
106
|
+
const startInputVal = e.target.value;
|
|
107
|
+
let momentValue = null;
|
|
125
108
|
|
|
126
109
|
if (startInputVal && moment(startInputVal, 'MM/DD/YYYY', true).isValid()) {
|
|
127
110
|
momentValue = moment(startInputVal);
|
|
128
111
|
}
|
|
129
112
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
113
|
+
const startDateBlocked = isDayBlocked(momentValue);
|
|
114
|
+
const isStartDateAcceptable = !startDateBlocked && momentValue && startInputVal !== '';
|
|
115
|
+
const areDatesValid = endDate && momentValue && (endDate === null || endDate === void 0 ? void 0 : endDate.isValid()) && ((_momentValue = momentValue) === null || _momentValue === void 0 ? void 0 : _momentValue.isValid());
|
|
116
|
+
const canEndBeSameAsStart = minimumNights === 0;
|
|
117
|
+
const isStartAcceptableWithSelectedEnd = !endDate || areDatesValid && (canEndBeSameAsStart && momentValue.diff(endDate, 'days') <= 0 || !canEndBeSameAsStart && momentValue.diff(endDate, 'days') < 0);
|
|
118
|
+
const invalidDate = !isStartDateAcceptable || !isStartAcceptableWithSelectedEnd;
|
|
136
119
|
if (startDateBlocked) momentValue = null;
|
|
137
120
|
onChangeStartInput(momentValue);
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
endDateError: !isStartDateAcceptable || !prevState.endDateError ? prevState.endDateError : !isStartAcceptableWithSelectedEnd
|
|
146
|
-
};
|
|
147
|
-
});
|
|
121
|
+
this.setState(prevState => ({
|
|
122
|
+
startDate: momentValue,
|
|
123
|
+
startInput: startInputVal,
|
|
124
|
+
primaryStartInput: true,
|
|
125
|
+
startDateError: invalidDate,
|
|
126
|
+
endDateError: !isStartDateAcceptable || !prevState.endDateError ? prevState.endDateError : !isStartAcceptableWithSelectedEnd
|
|
127
|
+
}));
|
|
148
128
|
});
|
|
149
129
|
|
|
150
|
-
_defineProperty(
|
|
130
|
+
_defineProperty(this, "handleChangeEnd", e => {
|
|
151
131
|
var _momentValue2;
|
|
152
132
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
133
|
+
const {
|
|
134
|
+
onChangeEndInput,
|
|
135
|
+
isDayBlocked,
|
|
136
|
+
minimumNights
|
|
137
|
+
} = this.props;
|
|
138
|
+
const {
|
|
139
|
+
startDate
|
|
140
|
+
} = this.state;
|
|
141
|
+
const endInputValue = e.target.value;
|
|
142
|
+
let momentValue = null;
|
|
160
143
|
|
|
161
144
|
if (endInputValue && moment(endInputValue, 'MM/DD/YYYY', true).isValid()) {
|
|
162
145
|
momentValue = moment(endInputValue);
|
|
163
146
|
}
|
|
164
147
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
148
|
+
const endDateBlocked = isDayBlocked(momentValue);
|
|
149
|
+
const isEndDateAcceptable = !endDateBlocked && momentValue && endInputValue !== '';
|
|
150
|
+
const areDatesValid = startDate && momentValue && (startDate === null || startDate === void 0 ? void 0 : startDate.isValid()) && ((_momentValue2 = momentValue) === null || _momentValue2 === void 0 ? void 0 : _momentValue2.isValid());
|
|
151
|
+
const canEndBeSameAsStart = minimumNights === 0;
|
|
152
|
+
const isEndAcceptableWithSelectedStart = !startDate || areDatesValid && (canEndBeSameAsStart && momentValue.diff(startDate, 'days') >= 0 || !canEndBeSameAsStart && momentValue.diff(startDate, 'days') > 0); // only > is valid
|
|
170
153
|
|
|
171
|
-
|
|
154
|
+
const invalidDate = !isEndDateAcceptable || !isEndAcceptableWithSelectedStart;
|
|
172
155
|
if (endDateBlocked) momentValue = null;
|
|
173
156
|
onChangeEndInput(momentValue);
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
endDateError: invalidDate
|
|
182
|
-
};
|
|
183
|
-
});
|
|
157
|
+
this.setState(prevState => ({
|
|
158
|
+
endDate: momentValue,
|
|
159
|
+
endInput: endInputValue,
|
|
160
|
+
primaryEndInput: true,
|
|
161
|
+
startDateError: !isEndDateAcceptable || !prevState.startDateError ? prevState.startDateError : !isEndAcceptableWithSelectedStart,
|
|
162
|
+
endDateError: invalidDate
|
|
163
|
+
}));
|
|
184
164
|
});
|
|
185
165
|
|
|
186
|
-
_defineProperty(
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
166
|
+
_defineProperty(this, "handleChangeDate", ({
|
|
167
|
+
startDate: _start,
|
|
168
|
+
endDate
|
|
169
|
+
}) => {
|
|
190
170
|
if (_start && endDate) {
|
|
191
|
-
|
|
171
|
+
this.setState({
|
|
192
172
|
startDate: moment(_start),
|
|
193
|
-
endDate
|
|
173
|
+
endDate,
|
|
194
174
|
primaryStartInput: false,
|
|
195
175
|
primaryEndInput: false
|
|
196
176
|
});
|
|
197
177
|
} else if (_start) {
|
|
198
|
-
|
|
178
|
+
this.setState({
|
|
199
179
|
startDate: moment(_start),
|
|
200
180
|
primaryStartInput: false
|
|
201
181
|
});
|
|
202
182
|
} else if (endDate) {
|
|
203
|
-
|
|
204
|
-
endDate
|
|
183
|
+
this.setState({
|
|
184
|
+
endDate,
|
|
205
185
|
primaryEndInput: false
|
|
206
186
|
});
|
|
207
187
|
}
|
|
208
188
|
});
|
|
209
189
|
|
|
210
|
-
|
|
190
|
+
this.state = {
|
|
211
191
|
startDate: props.startDate ? moment(props.startDate) : null,
|
|
212
192
|
endDate: props.endDate ? moment(props.endDate) : null,
|
|
213
193
|
focusedInput: START_DATE,
|
|
@@ -215,170 +195,129 @@ var DSDateRangePickerImpl = /*#__PURE__*/function (_React$Component) {
|
|
|
215
195
|
startDateError: false,
|
|
216
196
|
endDateError: false
|
|
217
197
|
};
|
|
218
|
-
return _this;
|
|
219
198
|
}
|
|
220
199
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
document.addEventListener('keydown', this.handleKeyDown, false);
|
|
225
|
-
}
|
|
226
|
-
}, {
|
|
227
|
-
key: "componentWillUnmount",
|
|
228
|
-
value: function componentWillUnmount() {
|
|
229
|
-
document.removeEventListener('keydown', this.handleKeyDown, false);
|
|
230
|
-
}
|
|
231
|
-
}, {
|
|
232
|
-
key: "render",
|
|
233
|
-
value: function render() {
|
|
234
|
-
var _this2 = this;
|
|
200
|
+
componentDidMount() {
|
|
201
|
+
document.addEventListener('keydown', this.handleKeyDown, false);
|
|
202
|
+
}
|
|
235
203
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
204
|
+
componentWillUnmount() {
|
|
205
|
+
document.removeEventListener('keydown', this.handleKeyDown, false);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
render() {
|
|
209
|
+
const {
|
|
210
|
+
startDate,
|
|
211
|
+
endDate,
|
|
212
|
+
focusedInput,
|
|
213
|
+
showPicker,
|
|
214
|
+
startDateError,
|
|
215
|
+
endDateError
|
|
216
|
+
} = this.state;
|
|
217
|
+
const {
|
|
218
|
+
disabled,
|
|
219
|
+
displayFormatDay,
|
|
220
|
+
minimumNights,
|
|
221
|
+
labelFrom,
|
|
222
|
+
labelTo,
|
|
223
|
+
isDayBlocked,
|
|
224
|
+
isDayHighlighted,
|
|
225
|
+
isOutsideRange,
|
|
226
|
+
enableOutsideDays,
|
|
227
|
+
startDateRequired,
|
|
228
|
+
endDateRequired,
|
|
229
|
+
onOutsideClick,
|
|
230
|
+
onNextMonthClick,
|
|
231
|
+
onPrevMonthClick,
|
|
232
|
+
onClose,
|
|
233
|
+
hasError,
|
|
234
|
+
validationMessage
|
|
235
|
+
} = this.props;
|
|
236
|
+
const inputClass = classNameBlock('inputs', 'range-picker');
|
|
237
|
+
const inputClassModifier = '';
|
|
238
|
+
const safeStartInputValue = this.getSafeStartInputValue();
|
|
239
|
+
const safeEndInputValue = this.getSafeEndInputValue();
|
|
240
|
+
return /*#__PURE__*/_jsx("div", {
|
|
241
|
+
className: `${inputClass} ${inputClassModifier}`
|
|
242
|
+
}, void 0, /*#__PURE__*/_jsx("div", {
|
|
243
|
+
className: classNameBlock('wrapper-input-date-range-picker-controller')
|
|
244
|
+
}, void 0, /*#__PURE__*/_jsx(DSFormItemLayout, {
|
|
245
|
+
floatingLabel: true,
|
|
246
|
+
inputComponent: DSInputMask,
|
|
247
|
+
labelText: labelFrom,
|
|
248
|
+
mask: MASK_TYPES.DATE,
|
|
249
|
+
onChange: this.handleChangeStart,
|
|
250
|
+
onFocus: () => this.setState({
|
|
251
|
+
showPicker: false
|
|
252
|
+
}),
|
|
253
|
+
pipe: MASK_PIPES.AUTO_CORRECT_DATE,
|
|
254
|
+
value: safeStartInputValue,
|
|
255
|
+
required: startDateRequired,
|
|
256
|
+
hasError: hasError || startDateError,
|
|
257
|
+
placeholder: "MM/DD/YYYY"
|
|
258
|
+
}), /*#__PURE__*/_jsx(DSFormItemLayout, {
|
|
259
|
+
floatingLabel: true,
|
|
260
|
+
inputComponent: DSInputMask,
|
|
261
|
+
labelText: labelTo,
|
|
262
|
+
mask: MASK_TYPES.DATE,
|
|
263
|
+
onChange: this.handleChangeEnd,
|
|
264
|
+
onFocus: () => this.setState({
|
|
265
|
+
showPicker: false
|
|
266
|
+
}),
|
|
267
|
+
pipe: MASK_PIPES.AUTO_CORRECT_DATE,
|
|
268
|
+
value: safeEndInputValue,
|
|
269
|
+
required: endDateRequired,
|
|
270
|
+
hasError: hasError || endDateError,
|
|
271
|
+
validationMessage: validationMessage,
|
|
272
|
+
placeholder: "MM/DD/YYYY"
|
|
273
|
+
})), /*#__PURE__*/_jsx("div", {
|
|
274
|
+
className: classNameBlock('wrapper-button-date-range-picker-controller')
|
|
275
|
+
}, void 0, /*#__PURE__*/_jsx(DSPopper, {
|
|
276
|
+
contentComponent: /*#__PURE__*/_jsx("div", {}, void 0, showPicker && /*#__PURE__*/_jsx(DayPickerRangeController, {
|
|
277
|
+
enableOutsideDays: enableOutsideDays,
|
|
278
|
+
isDayBlocked: isDayBlocked,
|
|
279
|
+
isDayHighlighted: isDayHighlighted,
|
|
280
|
+
isOutsideRange: isOutsideRange,
|
|
281
|
+
displayFormatDay: displayFormatDay,
|
|
282
|
+
endDate: endDate,
|
|
283
|
+
focusedInput: focusedInput,
|
|
284
|
+
hideKeyboardShortcutsPanel: true,
|
|
285
|
+
minimumNights: minimumNights,
|
|
286
|
+
onDatesChange: this.onDatesChange,
|
|
287
|
+
onFocusChange: this.onFocusChange,
|
|
288
|
+
onOutsideClick: e => {
|
|
289
|
+
onOutsideClick(e);
|
|
290
|
+
this.setState({
|
|
293
291
|
showPicker: false
|
|
294
292
|
});
|
|
295
293
|
},
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
});
|
|
323
|
-
},
|
|
324
|
-
onNextMonthClick: onNextMonthClick,
|
|
325
|
-
onPrevMonthClick: onPrevMonthClick,
|
|
326
|
-
startDate: startDate,
|
|
327
|
-
renderMonthElement: renderMonthElement
|
|
328
|
-
})),
|
|
329
|
-
isOpen: showPicker && !startDateError && !endDateError,
|
|
330
|
-
onClose: onClose,
|
|
331
|
-
placement: "bottom-end",
|
|
332
|
-
showArrow: false,
|
|
333
|
-
triggerComponent: /*#__PURE__*/React.createElement("div", {
|
|
334
|
-
onFocus: function onFocus() {
|
|
335
|
-
return _this2.setState({
|
|
336
|
-
showPicker: true
|
|
337
|
-
});
|
|
338
|
-
}
|
|
339
|
-
}, /*#__PURE__*/React.createElement(DatePickerPicker, {
|
|
340
|
-
className: classNameElement('picker'),
|
|
341
|
-
disabled: disabled,
|
|
342
|
-
onClick: function onClick() {
|
|
343
|
-
return _this2.setState({
|
|
344
|
-
showPicker: true
|
|
345
|
-
});
|
|
346
|
-
}
|
|
347
|
-
}), hasError && validationMessage && /*#__PURE__*/React.createElement("div", {
|
|
348
|
-
style: {
|
|
349
|
-
height: 15
|
|
350
|
-
}
|
|
351
|
-
}))
|
|
352
|
-
})));
|
|
353
|
-
}
|
|
354
|
-
}]);
|
|
294
|
+
onNextMonthClick: onNextMonthClick,
|
|
295
|
+
onPrevMonthClick: onPrevMonthClick,
|
|
296
|
+
startDate: startDate,
|
|
297
|
+
renderMonthElement: renderMonthElement
|
|
298
|
+
})),
|
|
299
|
+
isOpen: showPicker && !startDateError && !endDateError,
|
|
300
|
+
onClose: onClose,
|
|
301
|
+
placement: "bottom-end",
|
|
302
|
+
showArrow: false,
|
|
303
|
+
triggerComponent: /*#__PURE__*/_jsx("div", {
|
|
304
|
+
onFocus: () => this.setState({
|
|
305
|
+
showPicker: true
|
|
306
|
+
})
|
|
307
|
+
}, void 0, /*#__PURE__*/_jsx(DatePickerPicker, {
|
|
308
|
+
className: classNameElement('picker'),
|
|
309
|
+
disabled: disabled,
|
|
310
|
+
onClick: () => this.setState({
|
|
311
|
+
showPicker: true
|
|
312
|
+
})
|
|
313
|
+
}), hasError && validationMessage && /*#__PURE__*/_jsx("div", {
|
|
314
|
+
style: {
|
|
315
|
+
height: 15
|
|
316
|
+
}
|
|
317
|
+
}))
|
|
318
|
+
})));
|
|
319
|
+
}
|
|
355
320
|
|
|
356
|
-
|
|
357
|
-
}(React.Component);
|
|
358
|
-
DSDateRangePickerImpl.propTypes = {
|
|
359
|
-
startDate: PropTypes.instanceOf(Date, moment),
|
|
360
|
-
endDate: PropTypes.instanceOf(Date, moment),
|
|
361
|
-
onDatesChange: PropTypes.func,
|
|
362
|
-
onChangeStartInput: PropTypes.func,
|
|
363
|
-
onChangeEndInput: PropTypes.func,
|
|
364
|
-
onNextMonthClick: PropTypes.func,
|
|
365
|
-
onPrevMonthClick: PropTypes.func,
|
|
366
|
-
onClose: PropTypes.func,
|
|
367
|
-
onOutsideClick: PropTypes.func,
|
|
368
|
-
disabled: PropTypes.bool,
|
|
369
|
-
displayFormatDay: PropTypes.string,
|
|
370
|
-
minimumNights: PropTypes.number,
|
|
371
|
-
labelTo: PropTypes.string,
|
|
372
|
-
labelFrom: PropTypes.string,
|
|
373
|
-
isDayBlocked: PropTypes.func,
|
|
374
|
-
isDayHighlighted: PropTypes.func,
|
|
375
|
-
isOutsideRange: PropTypes.func,
|
|
376
|
-
enableOutsideDays: PropTypes.bool,
|
|
377
|
-
startDateRequired: PropTypes.bool,
|
|
378
|
-
endDateRequired: PropTypes.bool,
|
|
379
|
-
hasError: PropTypes.bool,
|
|
380
|
-
validationMessage: PropTypes.string
|
|
381
|
-
};
|
|
321
|
+
}
|
|
382
322
|
|
|
383
323
|
export { END_DATE, START_DATE, DSDateRangePickerImpl as default };
|
|
384
|
-
//# sourceMappingURL=DSDateRangePickerImpl.js.map
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import 'react';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
className: className
|
|
10
|
-
}, /*#__PURE__*/React.createElement("span", null, label));
|
|
11
|
-
};
|
|
4
|
+
const Label = ({
|
|
5
|
+
className = 'date-picker-label',
|
|
6
|
+
label = ''
|
|
7
|
+
}) => /*#__PURE__*/_jsx("div", {
|
|
8
|
+
className: className
|
|
9
|
+
}, void 0, /*#__PURE__*/_jsx("span", {}, void 0, label));
|
|
12
10
|
|
|
13
11
|
export { Label as default };
|
|
14
|
-
//# sourceMappingURL=DatePickerLabel.js.map
|