@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
package/esm/DSDateRangePicker.js
CHANGED
|
@@ -1,185 +1,115 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
3
|
+
import 'react';
|
|
3
4
|
import { PropTypes, describe } from 'react-desc';
|
|
4
5
|
import { convertPropToCssClassName } from '@elliemae/ds-classnames';
|
|
5
6
|
import moment from 'moment';
|
|
6
7
|
import 'react-dates/initialize';
|
|
7
|
-
import { DateRangePickerPhrases } from 'react-dates';
|
|
8
|
+
import { DateRangePickerPhrases } from 'react-dates/lib/defaultPhrases';
|
|
8
9
|
export { default as DayPickerRangeController } from './components/DayPickerRangeController.js';
|
|
9
10
|
import DSDateRangePickerImpl from './components/DSDateRangePickerImpl.js';
|
|
10
11
|
export { END_DATE, START_DATE } from './components/DSDateRangePickerImpl.js';
|
|
11
|
-
import '
|
|
12
|
-
import '@babel/runtime/helpers/esm/toArray';
|
|
13
|
-
import '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
14
|
-
import 'prop-types';
|
|
15
|
-
import '@elliemae/ds-date-picker';
|
|
16
|
-
import '@elliemae/ds-icons/ChevronLeft';
|
|
17
|
-
import '@babel/runtime/helpers/esm/classCallCheck';
|
|
18
|
-
import '@babel/runtime/helpers/esm/createClass';
|
|
19
|
-
import '@babel/runtime/helpers/esm/assertThisInitialized';
|
|
20
|
-
import '@babel/runtime/helpers/esm/inherits';
|
|
21
|
-
import '@babel/runtime/helpers/esm/possibleConstructorReturn';
|
|
22
|
-
import '@babel/runtime/helpers/esm/getPrototypeOf';
|
|
23
|
-
import '@babel/runtime/helpers/esm/defineProperty';
|
|
24
|
-
import '@elliemae/ds-basic/form/InputMask';
|
|
25
|
-
import '@elliemae/ds-basic/form/FormItem';
|
|
26
|
-
import '@elliemae/ds-basic/Popper';
|
|
27
|
-
import './isMaxDiffSafe.js';
|
|
12
|
+
import { jsx } from 'react/jsx-runtime';
|
|
28
13
|
|
|
29
|
-
var
|
|
30
|
-
var _ref$containerProps = _ref.containerProps,
|
|
31
|
-
containerProps = _ref$containerProps === void 0 ? {} : _ref$containerProps,
|
|
32
|
-
_ref$className = _ref.className,
|
|
33
|
-
className = _ref$className === void 0 ? '' : _ref$className,
|
|
34
|
-
_ref$disabled = _ref.disabled,
|
|
35
|
-
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
36
|
-
_ref$required = _ref.required,
|
|
37
|
-
required = _ref$required === void 0 ? false : _ref$required,
|
|
38
|
-
_ref$startDateRequire = _ref.startDateRequired,
|
|
39
|
-
startDateRequired = _ref$startDateRequire === void 0 ? false : _ref$startDateRequire,
|
|
40
|
-
_ref$endDateRequired = _ref.endDateRequired,
|
|
41
|
-
endDateRequired = _ref$endDateRequired === void 0 ? false : _ref$endDateRequired,
|
|
42
|
-
id = _ref.id,
|
|
43
|
-
_ref$hasError = _ref.hasError,
|
|
44
|
-
hasError = _ref$hasError === void 0 ? false : _ref$hasError,
|
|
45
|
-
_ref$validationMessag = _ref.validationMessage,
|
|
46
|
-
validationMessage = _ref$validationMessag === void 0 ? '' : _ref$validationMessag,
|
|
47
|
-
_ref$readOnly = _ref.readOnly,
|
|
48
|
-
readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly,
|
|
49
|
-
_ref$screenReaderInpu = _ref.screenReaderInputMessage,
|
|
50
|
-
screenReaderInputMessage = _ref$screenReaderInpu === void 0 ? 'Select date' : _ref$screenReaderInpu,
|
|
51
|
-
_ref$initialVisibleMo = _ref.initialVisibleMonth,
|
|
52
|
-
_initialVisibleMonth = _ref$initialVisibleMo === void 0 ? moment() : _ref$initialVisibleMo,
|
|
53
|
-
_ref$firstDayOfWeek = _ref.firstDayOfWeek,
|
|
54
|
-
firstDayOfWeek = _ref$firstDayOfWeek === void 0 ? 0 : _ref$firstDayOfWeek,
|
|
55
|
-
_ref$keepOpenOnDateSe = _ref.keepOpenOnDateSelect,
|
|
56
|
-
keepOpenOnDateSelect = _ref$keepOpenOnDateSe === void 0 ? true : _ref$keepOpenOnDateSe,
|
|
57
|
-
_ref$reopenPickerOnCl = _ref.reopenPickerOnClearDates,
|
|
58
|
-
reopenPickerOnClearDates = _ref$reopenPickerOnCl === void 0 ? false : _ref$reopenPickerOnCl,
|
|
59
|
-
_ref$hideKeyboardShor = _ref.hideKeyboardShortcutsPanel,
|
|
60
|
-
hideKeyboardShortcutsPanel = _ref$hideKeyboardShor === void 0 ? true : _ref$hideKeyboardShor,
|
|
61
|
-
_ref$onPrevMonthClick = _ref.onPrevMonthClick,
|
|
62
|
-
onPrevMonthClick = _ref$onPrevMonthClick === void 0 ? function () {
|
|
63
|
-
return null;
|
|
64
|
-
} : _ref$onPrevMonthClick,
|
|
65
|
-
_ref$onNextMonthClick = _ref.onNextMonthClick,
|
|
66
|
-
onNextMonthClick = _ref$onNextMonthClick === void 0 ? function () {
|
|
67
|
-
return null;
|
|
68
|
-
} : _ref$onNextMonthClick,
|
|
69
|
-
_ref$onClose = _ref.onClose,
|
|
70
|
-
onClose = _ref$onClose === void 0 ? function () {
|
|
71
|
-
return null;
|
|
72
|
-
} : _ref$onClose,
|
|
73
|
-
_ref$onOutsideClick = _ref.onOutsideClick,
|
|
74
|
-
onOutsideClick = _ref$onOutsideClick === void 0 ? function () {
|
|
75
|
-
return null;
|
|
76
|
-
} : _ref$onOutsideClick,
|
|
77
|
-
_ref$transitionDurati = _ref.transitionDuration,
|
|
78
|
-
transitionDuration = _ref$transitionDurati === void 0 ? 0 : _ref$transitionDurati,
|
|
79
|
-
_ref$verticalSpacing = _ref.verticalSpacing,
|
|
80
|
-
verticalSpacing = _ref$verticalSpacing === void 0 ? 0 : _ref$verticalSpacing,
|
|
81
|
-
_ref$minimumNights = _ref.minimumNights,
|
|
82
|
-
minimumNights = _ref$minimumNights === void 0 ? 0 : _ref$minimumNights,
|
|
83
|
-
_ref$isDayBlocked = _ref.isDayBlocked,
|
|
84
|
-
isDayBlocked = _ref$isDayBlocked === void 0 ? function () {
|
|
85
|
-
return false;
|
|
86
|
-
} : _ref$isDayBlocked,
|
|
87
|
-
_ref$isOutsideRange = _ref.isOutsideRange,
|
|
88
|
-
isOutsideRange = _ref$isOutsideRange === void 0 ? function () {
|
|
89
|
-
return false;
|
|
90
|
-
} : _ref$isOutsideRange,
|
|
91
|
-
_ref$isDayHighlighted = _ref.isDayHighlighted,
|
|
92
|
-
isDayHighlighted = _ref$isDayHighlighted === void 0 ? function () {
|
|
93
|
-
return false;
|
|
94
|
-
} : _ref$isDayHighlighted,
|
|
95
|
-
_ref$displayFormat = _ref.displayFormat,
|
|
96
|
-
displayFormat = _ref$displayFormat === void 0 ? 'L' : _ref$displayFormat,
|
|
97
|
-
_ref$displayFormatDay = _ref.displayFormatDay,
|
|
98
|
-
displayFormatDay = _ref$displayFormatDay === void 0 ? 'D' : _ref$displayFormatDay,
|
|
99
|
-
_ref$phrases = _ref.phrases,
|
|
100
|
-
phrases = _ref$phrases === void 0 ? DateRangePickerPhrases : _ref$phrases,
|
|
101
|
-
startDate = _ref.startDate,
|
|
102
|
-
endDate = _ref.endDate,
|
|
103
|
-
_ref$startDateId = _ref.startDateId,
|
|
104
|
-
startDateId = _ref$startDateId === void 0 ? 'startDateId' : _ref$startDateId,
|
|
105
|
-
_ref$endDateId = _ref.endDateId,
|
|
106
|
-
endDateId = _ref$endDateId === void 0 ? 'endDateId' : _ref$endDateId,
|
|
107
|
-
_ref$labelFrom = _ref.labelFrom,
|
|
108
|
-
labelFrom = _ref$labelFrom === void 0 ? 'From' : _ref$labelFrom,
|
|
109
|
-
_ref$labelTo = _ref.labelTo,
|
|
110
|
-
labelTo = _ref$labelTo === void 0 ? 'To' : _ref$labelTo,
|
|
111
|
-
_ref$enableOutsideDay = _ref.enableOutsideDays,
|
|
112
|
-
enableOutsideDays = _ref$enableOutsideDay === void 0 ? true : _ref$enableOutsideDay,
|
|
113
|
-
_ref$onChangeStartInp = _ref.onChangeStartInput,
|
|
114
|
-
onChangeStartInput = _ref$onChangeStartInp === void 0 ? function () {
|
|
115
|
-
return null;
|
|
116
|
-
} : _ref$onChangeStartInp,
|
|
117
|
-
_ref$onChangeEndInput = _ref.onChangeEndInput,
|
|
118
|
-
onChangeEndInput = _ref$onChangeEndInput === void 0 ? function () {
|
|
119
|
-
return null;
|
|
120
|
-
} : _ref$onChangeEndInput,
|
|
121
|
-
_ref$onDatesChange = _ref.onDatesChange,
|
|
122
|
-
onDatesChange = _ref$onDatesChange === void 0 ? function () {
|
|
123
|
-
return null;
|
|
124
|
-
} : _ref$onDatesChange;
|
|
14
|
+
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; }
|
|
125
15
|
|
|
126
|
-
|
|
127
|
-
hasError: hasError,
|
|
128
|
-
readOnly: readOnly,
|
|
129
|
-
disabled: disabled,
|
|
130
|
-
id: id
|
|
131
|
-
}),
|
|
132
|
-
cssClassName = _convertPropToCssClas.cssClassName,
|
|
133
|
-
prefixBlockName = _convertPropToCssClas.prefixBlockName;
|
|
16
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
134
17
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
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
|
-
|
|
18
|
+
const DSDateRangePicker = ({
|
|
19
|
+
containerProps = {},
|
|
20
|
+
className = '',
|
|
21
|
+
disabled = false,
|
|
22
|
+
required = false,
|
|
23
|
+
startDateRequired = false,
|
|
24
|
+
endDateRequired = false,
|
|
25
|
+
id,
|
|
26
|
+
hasError = false,
|
|
27
|
+
validationMessage = '',
|
|
28
|
+
readOnly = false,
|
|
29
|
+
screenReaderInputMessage = 'Select date',
|
|
30
|
+
initialVisibleMonth = moment(),
|
|
31
|
+
firstDayOfWeek = 0,
|
|
32
|
+
keepOpenOnDateSelect = true,
|
|
33
|
+
reopenPickerOnClearDates = false,
|
|
34
|
+
hideKeyboardShortcutsPanel = true,
|
|
35
|
+
onPrevMonthClick = () => null,
|
|
36
|
+
onNextMonthClick = () => null,
|
|
37
|
+
onClose = () => null,
|
|
38
|
+
onOutsideClick = () => null,
|
|
39
|
+
transitionDuration = 0,
|
|
40
|
+
verticalSpacing = 0,
|
|
41
|
+
minimumNights = 0,
|
|
42
|
+
isDayBlocked = () => false,
|
|
43
|
+
isOutsideRange = () => false,
|
|
44
|
+
isDayHighlighted = () => false,
|
|
45
|
+
displayFormat = 'L',
|
|
46
|
+
displayFormatDay = 'D',
|
|
47
|
+
phrases = DateRangePickerPhrases,
|
|
48
|
+
startDate,
|
|
49
|
+
endDate,
|
|
50
|
+
startDateId = 'startDateId',
|
|
51
|
+
endDateId = 'endDateId',
|
|
52
|
+
labelFrom = 'From',
|
|
53
|
+
labelTo = 'To',
|
|
54
|
+
enableOutsideDays = true,
|
|
55
|
+
onChangeStartInput = () => null,
|
|
56
|
+
onChangeEndInput = () => null,
|
|
57
|
+
onDatesChange = () => null
|
|
58
|
+
}) => {
|
|
59
|
+
const {
|
|
60
|
+
cssClassName,
|
|
61
|
+
prefixBlockName
|
|
62
|
+
} = convertPropToCssClassName('datepicker', className, {
|
|
63
|
+
hasError,
|
|
64
|
+
readOnly,
|
|
65
|
+
disabled,
|
|
66
|
+
id
|
|
67
|
+
});
|
|
68
|
+
return /*#__PURE__*/jsx("div", _objectSpread(_objectSpread({}, containerProps), {}, {
|
|
69
|
+
className: `${prefixBlockName}-range ${cssClassName} ${prefixBlockName}-range`,
|
|
70
|
+
children: /*#__PURE__*/_jsx(DSDateRangePickerImpl, {
|
|
71
|
+
appendToBody: true,
|
|
72
|
+
disabled: disabled,
|
|
73
|
+
displayFormat: displayFormat,
|
|
74
|
+
displayFormatDay: displayFormatDay,
|
|
75
|
+
enableOutsideDays: enableOutsideDays,
|
|
76
|
+
endDate: endDate,
|
|
77
|
+
endDateId: endDateId,
|
|
78
|
+
firstDayOfWeek: firstDayOfWeek,
|
|
79
|
+
hideKeyboardShortcutsPanel: hideKeyboardShortcutsPanel,
|
|
80
|
+
initialVisibleMonth: () => initialVisibleMonth ? moment(initialVisibleMonth) : moment(startDate),
|
|
81
|
+
isDayBlocked: isDayBlocked,
|
|
82
|
+
isDayHighlighted: isDayHighlighted,
|
|
83
|
+
isOutsideRange: isOutsideRange === true || isOutsideRange === false ? () => isOutsideRange : isOutsideRange,
|
|
84
|
+
keepOpenOnDateSelect: keepOpenOnDateSelect,
|
|
85
|
+
labelFrom: labelFrom,
|
|
86
|
+
labelTo: labelTo,
|
|
87
|
+
minimumNights: minimumNights,
|
|
88
|
+
onDatesChange: onDatesChange,
|
|
89
|
+
onChangeStartInput: onChangeStartInput,
|
|
90
|
+
onChangeEndInput: onChangeEndInput,
|
|
91
|
+
onClose: onClose,
|
|
92
|
+
onNextMonthClick: onNextMonthClick,
|
|
93
|
+
onPrevMonthClick: onPrevMonthClick,
|
|
94
|
+
onOutsideClick: onOutsideClick,
|
|
95
|
+
phrases: phrases,
|
|
96
|
+
readOnly: readOnly,
|
|
97
|
+
reopenPickerOnClearDates: reopenPickerOnClearDates,
|
|
98
|
+
required: required,
|
|
99
|
+
startDateRequired: startDateRequired,
|
|
100
|
+
endDateRequired: endDateRequired,
|
|
101
|
+
screenReaderInputMessage: screenReaderInputMessage,
|
|
102
|
+
startDate: startDate,
|
|
103
|
+
startDateId: startDateId,
|
|
104
|
+
transitionDuration: transitionDuration,
|
|
105
|
+
verticalSpacing: verticalSpacing,
|
|
106
|
+
hasError: hasError,
|
|
107
|
+
validationMessage: validationMessage
|
|
108
|
+
})
|
|
179
109
|
}));
|
|
180
110
|
};
|
|
181
111
|
|
|
182
|
-
|
|
112
|
+
const dateRangePickerProps = {
|
|
183
113
|
containerProps: PropTypes.shape({}).description('Set of Properties attached to the main container'),
|
|
184
114
|
className: PropTypes.string.description('html class attribute'),
|
|
185
115
|
disabled: PropTypes.bool.description('disable component or not').defaultValue(false),
|
|
@@ -249,9 +179,7 @@ var dateRangePickerProps = {
|
|
|
249
179
|
onChangeEndInput: PropTypes.func.description('function executed when end date input changes'),
|
|
250
180
|
onOutsideClick: PropTypes.func.description('function executed when clicking outside component')
|
|
251
181
|
};
|
|
252
|
-
|
|
253
|
-
var DateRangePickerWithSchema = describe(DSDateRangePicker);
|
|
182
|
+
const DateRangePickerWithSchema = describe(DSDateRangePicker);
|
|
254
183
|
DateRangePickerWithSchema.propTypes = dateRangePickerProps;
|
|
255
184
|
|
|
256
185
|
export { DateRangePickerWithSchema, DSDateRangePicker as default };
|
|
257
|
-
//# sourceMappingURL=DSDateRangePicker.js.map
|