@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.
Files changed (44) hide show
  1. package/cjs/DSDateRangePicker.js +111 -183
  2. package/cjs/components/DSDateRangePickerImpl.js +238 -305
  3. package/cjs/components/DatePickerLabel/DatePickerLabel.js +9 -12
  4. package/cjs/components/DatePickerRangeHeader/DatePickerRangeHeader.js +36 -54
  5. package/cjs/components/DayPickerRangeController.js +74 -132
  6. package/cjs/index.js +6 -31
  7. package/cjs/isMaxDiffSafe.js +5 -6
  8. package/cjs/package.json +7 -0
  9. package/esm/DSDateRangePicker.js +100 -172
  10. package/esm/components/DSDateRangePickerImpl.js +225 -286
  11. package/esm/components/DatePickerLabel/DatePickerLabel.js +8 -11
  12. package/esm/components/DatePickerRangeHeader/DatePickerRangeHeader.js +32 -49
  13. package/esm/components/DayPickerRangeController.js +72 -126
  14. package/esm/index.js +0 -25
  15. package/esm/isMaxDiffSafe.js +5 -6
  16. package/esm/package.json +7 -0
  17. package/package.json +52 -11
  18. package/types/DSDateRangePicker.d.ts +92 -0
  19. package/types/components/DSDateRangePickerImpl.d.ts +24 -0
  20. package/types/components/DatePickerLabel/DatePickerLabel.d.ts +6 -0
  21. package/types/components/DatePickerRangeHeader/DatePickerRangeHeader.d.ts +10 -0
  22. package/types/components/DayPickerRangeController.d.ts +36 -0
  23. package/types/index.d.ts +2 -0
  24. package/types/isMaxDiffSafe.d.ts +2 -0
  25. package/DSDateRangePicker/package.json +0 -10
  26. package/cjs/DSDateRangePicker.js.map +0 -1
  27. package/cjs/components/DSDateRangePickerImpl.js.map +0 -1
  28. package/cjs/components/DatePickerLabel/DatePickerLabel.js.map +0 -1
  29. package/cjs/components/DatePickerRangeHeader/DatePickerRangeHeader.js.map +0 -1
  30. package/cjs/components/DayPickerRangeController.js.map +0 -1
  31. package/cjs/index.js.map +0 -1
  32. package/cjs/isMaxDiffSafe.js.map +0 -1
  33. package/components/DSDateRangePickerImpl/package.json +0 -10
  34. package/components/DatePickerLabel/DatePickerLabel/package.json +0 -10
  35. package/components/DatePickerRangeHeader/DatePickerRangeHeader/package.json +0 -10
  36. package/components/DayPickerRangeController/package.json +0 -10
  37. package/esm/DSDateRangePicker.js.map +0 -1
  38. package/esm/components/DSDateRangePickerImpl.js.map +0 -1
  39. package/esm/components/DatePickerLabel/DatePickerLabel.js.map +0 -1
  40. package/esm/components/DatePickerRangeHeader/DatePickerRangeHeader.js.map +0 -1
  41. package/esm/components/DayPickerRangeController.js.map +0 -1
  42. package/esm/index.js.map +0 -1
  43. package/esm/isMaxDiffSafe.js.map +0 -1
  44. package/isMaxDiffSafe/package.json +0 -10
@@ -1,12 +1,6 @@
1
- import _classCallCheck from '@babel/runtime/helpers/esm/classCallCheck';
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
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
26
-
27
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
28
- var START_DATE = 'startDate';
29
- var END_DATE = 'endDate';
30
-
31
- var _convertPropToCssClas = convertPropToCssClassName('datepicker'),
32
- classNameElement = _convertPropToCssClas.classNameElement,
33
- classNameBlock = _convertPropToCssClas.classNameBlock;
34
-
35
- var DSDateRangePickerImpl = /*#__PURE__*/function (_React$Component) {
36
- _inherits(DSDateRangePickerImpl, _React$Component);
37
-
38
- var _super = _createSuper(DSDateRangePickerImpl);
39
-
40
- function DSDateRangePickerImpl(props) {
41
- var _this;
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
- var safe = isMaxDiffSafe(startDate, endDate, _this.state.startDate, _this.state.endDate);
31
+ const safe = isMaxDiffSafe(startDate, endDate, this.state.startDate, this.state.endDate);
53
32
 
54
33
  if (!safe) {
55
- _this.setState({
34
+ this.setState({
56
35
  showPicker: false
57
36
  });
58
37
  }
59
38
 
60
- _this.setState({
61
- startDate: startDate,
62
- endDate: endDate,
39
+ this.setState({
40
+ startDate,
41
+ endDate,
63
42
  primaryStartInput: false,
64
43
  primaryEndInput: false
65
44
  });
66
45
  });
67
46
 
68
- _defineProperty(_assertThisInitialized(_this), "onFocusChange", function () {
69
- _this.setState(function (_ref2) {
70
- var focusedInput = _ref2.focusedInput;
71
- return {
72
- focusedInput: focusedInput === START_DATE ? END_DATE : START_DATE
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(_assertThisInitialized(_this), "handleKeyDown", function (event) {
78
- if (event.key === 'Escape') _this.setState({
55
+ _defineProperty(this, "handleKeyDown", event => {
56
+ if (event.key === 'Escape') this.setState({
79
57
  showPicker: false
80
58
  });
81
59
  });
82
60
 
83
- _defineProperty(_assertThisInitialized(_this), "getSafeStartInputValue", function () {
84
- var _this$state = _this.state,
85
- startInput = _this$state.startInput,
86
- primaryStartInput = _this$state.primaryStartInput,
87
- startDate = _this$state.startDate;
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(_assertThisInitialized(_this), "getSafeEndInputValue", function () {
94
- var _this$state2 = _this.state,
95
- endInput = _this$state2.endInput,
96
- primaryEndInput = _this$state2.primaryEndInput,
97
- endDate = _this$state2.endDate;
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(_assertThisInitialized(_this), "changeFocus", function () {
104
- var disabled = _this.props.disabled;
83
+ _defineProperty(this, "changeFocus", () => {
84
+ const {
85
+ disabled
86
+ } = this.props;
105
87
 
106
88
  if (!disabled) {
107
- _this.setState(function () {
108
- return {
109
- focusedInput: 'startDate'
110
- };
111
- });
89
+ this.setState(() => ({
90
+ focusedInput: 'startDate'
91
+ }));
112
92
  }
113
93
  });
114
94
 
115
- _defineProperty(_assertThisInitialized(_this), "handleChangeStart", function (e) {
95
+ _defineProperty(this, "handleChangeStart", e => {
116
96
  var _momentValue;
117
97
 
118
- var _this$props = _this.props,
119
- onChangeStartInput = _this$props.onChangeStartInput,
120
- isDayBlocked = _this$props.isDayBlocked,
121
- minimumNights = _this$props.minimumNights;
122
- var endDate = _this.state.endDate;
123
- var startInputVal = e.target.value;
124
- var momentValue = null;
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
- var startDateBlocked = isDayBlocked(momentValue);
131
- var isStartDateAcceptable = !startDateBlocked && momentValue && startInputVal !== '';
132
- var areDatesValid = endDate && momentValue && (endDate === null || endDate === void 0 ? void 0 : endDate.isValid()) && ((_momentValue = momentValue) === null || _momentValue === void 0 ? void 0 : _momentValue.isValid());
133
- var canEndBeSameAsStart = minimumNights === 0;
134
- var isStartAcceptableWithSelectedEnd = !endDate || areDatesValid && (canEndBeSameAsStart && momentValue.diff(endDate, 'days') <= 0 || !canEndBeSameAsStart && momentValue.diff(endDate, 'days') < 0);
135
- var invalidDate = !isStartDateAcceptable || !isStartAcceptableWithSelectedEnd;
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
- _this.setState(function (prevState) {
140
- return {
141
- startDate: momentValue,
142
- startInput: startInputVal,
143
- primaryStartInput: true,
144
- startDateError: invalidDate,
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(_assertThisInitialized(_this), "handleChangeEnd", function (e) {
130
+ _defineProperty(this, "handleChangeEnd", e => {
151
131
  var _momentValue2;
152
132
 
153
- var _this$props2 = _this.props,
154
- onChangeEndInput = _this$props2.onChangeEndInput,
155
- isDayBlocked = _this$props2.isDayBlocked,
156
- minimumNights = _this$props2.minimumNights;
157
- var startDate = _this.state.startDate;
158
- var endInputValue = e.target.value;
159
- var momentValue = null;
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
- var endDateBlocked = isDayBlocked(momentValue);
166
- var isEndDateAcceptable = !endDateBlocked && momentValue && endInputValue !== '';
167
- var areDatesValid = startDate && momentValue && (startDate === null || startDate === void 0 ? void 0 : startDate.isValid()) && ((_momentValue2 = momentValue) === null || _momentValue2 === void 0 ? void 0 : _momentValue2.isValid());
168
- var canEndBeSameAsStart = minimumNights === 0;
169
- var isEndAcceptableWithSelectedStart = !startDate || areDatesValid && (canEndBeSameAsStart && momentValue.diff(startDate, 'days') >= 0 || !canEndBeSameAsStart && momentValue.diff(startDate, 'days') > 0); // only > is valid
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
- var invalidDate = !isEndDateAcceptable || !isEndAcceptableWithSelectedStart;
154
+ const invalidDate = !isEndDateAcceptable || !isEndAcceptableWithSelectedStart;
172
155
  if (endDateBlocked) momentValue = null;
173
156
  onChangeEndInput(momentValue);
174
-
175
- _this.setState(function (prevState) {
176
- return {
177
- endDate: momentValue,
178
- endInput: endInputValue,
179
- primaryEndInput: true,
180
- startDateError: !isEndDateAcceptable || !prevState.startDateError ? prevState.startDateError : !isEndAcceptableWithSelectedStart,
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(_assertThisInitialized(_this), "handleChangeDate", function (_ref3) {
187
- var _start = _ref3.startDate,
188
- endDate = _ref3.endDate;
189
-
166
+ _defineProperty(this, "handleChangeDate", ({
167
+ startDate: _start,
168
+ endDate
169
+ }) => {
190
170
  if (_start && endDate) {
191
- _this.setState({
171
+ this.setState({
192
172
  startDate: moment(_start),
193
- endDate: endDate,
173
+ endDate,
194
174
  primaryStartInput: false,
195
175
  primaryEndInput: false
196
176
  });
197
177
  } else if (_start) {
198
- _this.setState({
178
+ this.setState({
199
179
  startDate: moment(_start),
200
180
  primaryStartInput: false
201
181
  });
202
182
  } else if (endDate) {
203
- _this.setState({
204
- endDate: endDate,
183
+ this.setState({
184
+ endDate,
205
185
  primaryEndInput: false
206
186
  });
207
187
  }
208
188
  });
209
189
 
210
- _this.state = {
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
- _createClass(DSDateRangePickerImpl, [{
222
- key: "componentDidMount",
223
- value: function componentDidMount() {
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
- var _this$state3 = this.state,
237
- startDate = _this$state3.startDate,
238
- endDate = _this$state3.endDate,
239
- focusedInput = _this$state3.focusedInput,
240
- showPicker = _this$state3.showPicker,
241
- startDateError = _this$state3.startDateError,
242
- endDateError = _this$state3.endDateError;
243
- var _this$props3 = this.props,
244
- disabled = _this$props3.disabled,
245
- displayFormatDay = _this$props3.displayFormatDay,
246
- minimumNights = _this$props3.minimumNights,
247
- labelFrom = _this$props3.labelFrom,
248
- labelTo = _this$props3.labelTo,
249
- isDayBlocked = _this$props3.isDayBlocked,
250
- isDayHighlighted = _this$props3.isDayHighlighted,
251
- isOutsideRange = _this$props3.isOutsideRange,
252
- enableOutsideDays = _this$props3.enableOutsideDays,
253
- startDateRequired = _this$props3.startDateRequired,
254
- endDateRequired = _this$props3.endDateRequired,
255
- _onOutsideClick = _this$props3.onOutsideClick,
256
- onNextMonthClick = _this$props3.onNextMonthClick,
257
- onPrevMonthClick = _this$props3.onPrevMonthClick,
258
- onClose = _this$props3.onClose,
259
- hasError = _this$props3.hasError,
260
- validationMessage = _this$props3.validationMessage;
261
- var inputClass = classNameBlock('inputs', 'range-picker');
262
- var inputClassModifier = '';
263
- var safeStartInputValue = this.getSafeStartInputValue();
264
- var safeEndInputValue = this.getSafeEndInputValue();
265
- return /*#__PURE__*/React.createElement("div", {
266
- className: "".concat(inputClass, " ").concat(inputClassModifier)
267
- }, /*#__PURE__*/React.createElement("div", {
268
- className: classNameBlock('wrapper-input-date-range-picker-controller')
269
- }, /*#__PURE__*/React.createElement(DSFormItemLayout, {
270
- floatingLabel: true,
271
- inputComponent: DSInputMask,
272
- labelText: labelFrom,
273
- mask: MASK_TYPES.DATE,
274
- onChange: this.handleChangeStart,
275
- onFocus: function onFocus() {
276
- return _this2.setState({
277
- showPicker: false
278
- });
279
- },
280
- pipe: MASK_PIPES.AUTO_CORRECT_DATE,
281
- value: safeStartInputValue,
282
- required: startDateRequired,
283
- hasError: hasError || startDateError,
284
- placeholder: "MM/DD/YYYY"
285
- }), /*#__PURE__*/React.createElement(DSFormItemLayout, {
286
- floatingLabel: true,
287
- inputComponent: DSInputMask,
288
- labelText: labelTo,
289
- mask: MASK_TYPES.DATE,
290
- onChange: this.handleChangeEnd,
291
- onFocus: function onFocus() {
292
- return _this2.setState({
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
- pipe: MASK_PIPES.AUTO_CORRECT_DATE,
297
- value: safeEndInputValue,
298
- required: endDateRequired,
299
- hasError: hasError || endDateError,
300
- validationMessage: validationMessage,
301
- placeholder: "MM/DD/YYYY"
302
- })), /*#__PURE__*/React.createElement("div", {
303
- className: classNameBlock('wrapper-button-date-range-picker-controller')
304
- }, /*#__PURE__*/React.createElement(DSPopper, {
305
- contentComponent: /*#__PURE__*/React.createElement("div", null, showPicker && /*#__PURE__*/React.createElement(DayPickerRangeController, {
306
- enableOutsideDays: enableOutsideDays,
307
- isDayBlocked: isDayBlocked,
308
- isDayHighlighted: isDayHighlighted,
309
- isOutsideRange: isOutsideRange,
310
- displayFormatDay: displayFormatDay,
311
- endDate: endDate,
312
- focusedInput: focusedInput,
313
- hideKeyboardShortcutsPanel: true,
314
- minimumNights: minimumNights,
315
- onDatesChange: this.onDatesChange,
316
- onFocusChange: this.onFocusChange,
317
- onOutsideClick: function onOutsideClick(e) {
318
- _onOutsideClick(e);
319
-
320
- _this2.setState({
321
- showPicker: false
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
- return DSDateRangePickerImpl;
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 React from 'react';
1
+ import _jsx from '@babel/runtime/helpers/esm/jsx';
2
+ import 'react';
2
3
 
3
- var Label = function Label(_ref) {
4
- var _ref$className = _ref.className,
5
- className = _ref$className === void 0 ? 'date-picker-label' : _ref$className,
6
- _ref$label = _ref.label,
7
- label = _ref$label === void 0 ? '' : _ref$label;
8
- return /*#__PURE__*/React.createElement("div", {
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