@elliemae/ds-date-range-picker 2.2.0-alpha.2 → 2.2.0-beta.0

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 (30) hide show
  1. package/cjs/DSDateRangePicker.js +193 -199
  2. package/cjs/components/DSDateRangePickerImpl.js +222 -172
  3. package/cjs/components/DatePickerLabel/DatePickerLabel.js +19 -38
  4. package/cjs/components/DatePickerRangeHeader/DatePickerRangeHeader.js +62 -74
  5. package/cjs/components/DayPickerRangeController.js +109 -123
  6. package/cjs/index.js +15 -36
  7. package/cjs/isMaxDiffSafe.js +13 -39
  8. package/esm/DSDateRangePicker.js +150 -143
  9. package/esm/components/DSDateRangePickerImpl.js +197 -131
  10. package/esm/components/DatePickerLabel/DatePickerLabel.js +13 -9
  11. package/esm/components/DatePickerRangeHeader/DatePickerRangeHeader.js +45 -36
  12. package/esm/components/DayPickerRangeController.js +99 -92
  13. package/esm/index.js +3 -7
  14. package/esm/isMaxDiffSafe.js +8 -10
  15. package/package.json +6 -6
  16. package/types/DSDateRangePicker.d.ts +1 -41
  17. package/cjs/DSDateRangePicker.js.map +0 -7
  18. package/cjs/components/DSDateRangePickerImpl.js.map +0 -7
  19. package/cjs/components/DatePickerLabel/DatePickerLabel.js.map +0 -7
  20. package/cjs/components/DatePickerRangeHeader/DatePickerRangeHeader.js.map +0 -7
  21. package/cjs/components/DayPickerRangeController.js.map +0 -7
  22. package/cjs/index.js.map +0 -7
  23. package/cjs/isMaxDiffSafe.js.map +0 -7
  24. package/esm/DSDateRangePicker.js.map +0 -7
  25. package/esm/components/DSDateRangePickerImpl.js.map +0 -7
  26. package/esm/components/DatePickerLabel/DatePickerLabel.js.map +0 -7
  27. package/esm/components/DatePickerRangeHeader/DatePickerRangeHeader.js.map +0 -7
  28. package/esm/components/DayPickerRangeController.js.map +0 -7
  29. package/esm/index.js.map +0 -7
  30. package/esm/isMaxDiffSafe.js.map +0 -7
@@ -1,133 +1,148 @@
1
- import * as React from "react";
2
- import React2 from "react";
3
- import { PropTypes, describe } from "react-desc";
4
- import { convertPropToCssClassName } from "@elliemae/ds-classnames";
5
- import moment from "moment";
6
- import "react-dates/initialize";
7
- import { DateRangePickerPhrases } from "react-dates/lib/defaultPhrases";
8
- import DayPickerRangeController from "./components/DayPickerRangeController";
9
- import DSDateRangePickerImpl, {
10
- START_DATE,
11
- END_DATE
12
- } from "./components/DSDateRangePickerImpl";
13
- const DSDateRangePicker = ({
14
- containerProps = {},
15
- className = "",
16
- disabled = false,
17
- required = false,
18
- startDateRequired = false,
19
- endDateRequired = false,
20
- id,
21
- hasError = false,
22
- validationMessage = "",
23
- readOnly = false,
24
- screenReaderInputMessage = "Select date",
25
- initialVisibleMonth = moment(),
26
- firstDayOfWeek = 0,
27
- keepOpenOnDateSelect = true,
28
- reopenPickerOnClearDates = false,
29
- hideKeyboardShortcutsPanel = true,
30
- onPrevMonthClick = () => null,
31
- onNextMonthClick = () => null,
32
- onClose = () => null,
33
- onOutsideClick = () => null,
34
- transitionDuration = 0,
35
- verticalSpacing = 0,
36
- minimumNights = 0,
37
- isDayBlocked = () => false,
38
- isOutsideRange = () => false,
39
- isDayHighlighted = () => false,
40
- displayFormat = "L",
41
- displayFormatDay = "D",
42
- phrases = DateRangePickerPhrases,
43
- startDate,
44
- endDate,
45
- startDateId = "startDateId",
46
- endDateId = "endDateId",
47
- labelFrom = "From",
48
- labelTo = "To",
49
- enableOutsideDays = true,
50
- onChangeStartInput = () => null,
51
- onChangeEndInput = () => null,
52
- onDatesChange = () => null
53
- }) => {
54
- const { cssClassName, prefixBlockName } = convertPropToCssClassName("datepicker", className, {
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 _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
7
+ import _jsx from '@babel/runtime/helpers/esm/jsx';
8
+ import 'react';
9
+ import { PropTypes, describe } from 'react-desc';
10
+ import { convertPropToCssClassName } from '@elliemae/ds-classnames';
11
+ import moment from 'moment';
12
+ import 'react-dates/initialize';
13
+ import { DateRangePickerPhrases } from 'react-dates/lib/defaultPhrases';
14
+ export { default as DayPickerRangeController } from './components/DayPickerRangeController.js';
15
+ import DSDateRangePickerImpl from './components/DSDateRangePickerImpl.js';
16
+ export { END_DATE, START_DATE } from './components/DSDateRangePickerImpl.js';
17
+ import { jsx } from 'react/jsx-runtime';
18
+
19
+ 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; }
20
+
21
+ 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; }
22
+
23
+ const DSDateRangePicker = _ref => {
24
+ let {
25
+ containerProps = {},
26
+ className = '',
27
+ disabled = false,
28
+ required = false,
29
+ startDateRequired = false,
30
+ endDateRequired = false,
31
+ id,
32
+ hasError = false,
33
+ validationMessage = '',
34
+ readOnly = false,
35
+ screenReaderInputMessage = 'Select date',
36
+ initialVisibleMonth = moment(),
37
+ firstDayOfWeek = 0,
38
+ keepOpenOnDateSelect = true,
39
+ reopenPickerOnClearDates = false,
40
+ hideKeyboardShortcutsPanel = true,
41
+ onPrevMonthClick = () => null,
42
+ onNextMonthClick = () => null,
43
+ onClose = () => null,
44
+ onOutsideClick = () => null,
45
+ transitionDuration = 0,
46
+ verticalSpacing = 0,
47
+ minimumNights = 0,
48
+ isDayBlocked = () => false,
49
+ isOutsideRange = () => false,
50
+ isDayHighlighted = () => false,
51
+ displayFormat = 'L',
52
+ displayFormatDay = 'D',
53
+ phrases = DateRangePickerPhrases,
54
+ startDate,
55
+ endDate,
56
+ startDateId = 'startDateId',
57
+ endDateId = 'endDateId',
58
+ labelFrom = 'From',
59
+ labelTo = 'To',
60
+ enableOutsideDays = true,
61
+ onChangeStartInput = () => null,
62
+ onChangeEndInput = () => null,
63
+ onDatesChange = () => null
64
+ } = _ref;
65
+ const {
66
+ cssClassName,
67
+ prefixBlockName
68
+ } = convertPropToCssClassName('datepicker', className, {
55
69
  hasError,
56
70
  readOnly,
57
71
  disabled,
58
72
  id
59
73
  });
60
- return /* @__PURE__ */ React2.createElement("div", {
61
- ...containerProps,
62
- className: `${prefixBlockName}-range ${cssClassName} ${prefixBlockName}-range`
63
- }, /* @__PURE__ */ React2.createElement(DSDateRangePickerImpl, {
64
- appendToBody: true,
65
- disabled,
66
- displayFormat,
67
- displayFormatDay,
68
- enableOutsideDays,
69
- endDate,
70
- endDateId,
71
- firstDayOfWeek,
72
- hideKeyboardShortcutsPanel,
73
- initialVisibleMonth: () => initialVisibleMonth ? moment(initialVisibleMonth) : moment(startDate),
74
- isDayBlocked,
75
- isDayHighlighted,
76
- isOutsideRange: isOutsideRange === true || isOutsideRange === false ? () => isOutsideRange : isOutsideRange,
77
- keepOpenOnDateSelect,
78
- labelFrom,
79
- labelTo,
80
- minimumNights,
81
- onDatesChange,
82
- onChangeStartInput,
83
- onChangeEndInput,
84
- onClose,
85
- onNextMonthClick,
86
- onPrevMonthClick,
87
- onOutsideClick,
88
- phrases,
89
- readOnly,
90
- reopenPickerOnClearDates,
91
- required,
92
- startDateRequired,
93
- endDateRequired,
94
- screenReaderInputMessage,
95
- startDate,
96
- startDateId,
97
- transitionDuration,
98
- verticalSpacing,
99
- hasError,
100
- validationMessage
74
+ return /*#__PURE__*/jsx("div", _objectSpread(_objectSpread({}, containerProps), {}, {
75
+ className: "".concat(prefixBlockName, "-range ").concat(cssClassName, " ").concat(prefixBlockName, "-range"),
76
+ children: /*#__PURE__*/_jsx(DSDateRangePickerImpl, {
77
+ appendToBody: true,
78
+ disabled: disabled,
79
+ displayFormat: displayFormat,
80
+ displayFormatDay: displayFormatDay,
81
+ enableOutsideDays: enableOutsideDays,
82
+ endDate: endDate,
83
+ endDateId: endDateId,
84
+ firstDayOfWeek: firstDayOfWeek,
85
+ hideKeyboardShortcutsPanel: hideKeyboardShortcutsPanel,
86
+ initialVisibleMonth: () => initialVisibleMonth ? moment(initialVisibleMonth) : moment(startDate),
87
+ isDayBlocked: isDayBlocked,
88
+ isDayHighlighted: isDayHighlighted,
89
+ isOutsideRange: isOutsideRange === true || isOutsideRange === false ? () => isOutsideRange : isOutsideRange,
90
+ keepOpenOnDateSelect: keepOpenOnDateSelect,
91
+ labelFrom: labelFrom,
92
+ labelTo: labelTo,
93
+ minimumNights: minimumNights,
94
+ onDatesChange: onDatesChange,
95
+ onChangeStartInput: onChangeStartInput,
96
+ onChangeEndInput: onChangeEndInput,
97
+ onClose: onClose,
98
+ onNextMonthClick: onNextMonthClick,
99
+ onPrevMonthClick: onPrevMonthClick,
100
+ onOutsideClick: onOutsideClick,
101
+ phrases: phrases,
102
+ readOnly: readOnly,
103
+ reopenPickerOnClearDates: reopenPickerOnClearDates,
104
+ required: required,
105
+ startDateRequired: startDateRequired,
106
+ endDateRequired: endDateRequired,
107
+ screenReaderInputMessage: screenReaderInputMessage,
108
+ startDate: startDate,
109
+ startDateId: startDateId,
110
+ transitionDuration: transitionDuration,
111
+ verticalSpacing: verticalSpacing,
112
+ hasError: hasError,
113
+ validationMessage: validationMessage
114
+ })
101
115
  }));
102
116
  };
117
+
103
118
  const dateRangePickerProps = {
104
- containerProps: PropTypes.shape({}).description("Set of Properties attached to the main container"),
105
- className: PropTypes.string.description("html class attribute"),
106
- disabled: PropTypes.bool.description("disable component or not").defaultValue(false),
107
- required: PropTypes.bool.description("input is required or not").defaultValue(false),
108
- startDateRequired: PropTypes.bool.description("start date is required or not").defaultValue(false),
109
- endDateRequired: PropTypes.bool.description("end date is required or not").defaultValue(false),
110
- id: PropTypes.string.description("components id"),
111
- hasError: PropTypes.bool.description("set error state").defaultValue(false),
112
- validationMessage: PropTypes.string.description("validation message"),
113
- readOnly: PropTypes.bool.description("component is read only or not").description(false),
114
- screenReaderInputMessage: PropTypes.string.description("message to be anounced by screen reader").defaultValue("select date"),
115
- initialVisibleMonth: PropTypes.instanceOf(Date, moment).description("initial visible month"),
116
- firstDayOfWeek: PropTypes.number.description("first day of week").defaultValue(0),
117
- keepOpenOnDateSelect: PropTypes.bool.description("keep picker open when a date is selected").defaultValue(true),
118
- reopenPickerOnClearDates: PropTypes.bool.description("reopen picker when clearing dates").defaultValue(false),
119
- hideKeyboardShortcutsPanel: PropTypes.bool.description("hide keyabord shortcut panel or not"),
120
- onPrevMonthClick: PropTypes.func.description("function executed when clicking on prev month button"),
121
- onNextMonthClick: PropTypes.func.description("function executed when clicking on next month button"),
122
- onClose: PropTypes.func.description("function executed when component closes"),
123
- transitionDuration: PropTypes.number.description("transition duration").defaultValue(0),
124
- verticalSpacing: PropTypes.number.description("vertical spacing"),
125
- isDayBlocked: PropTypes.func.description("function that returns each day and disables desired dates"),
126
- isOutsideRange: PropTypes.func.description("function that returns each day and disables outisde range dates"),
127
- isDayHighlighted: PropTypes.func.description("function that returns each day and higlights desired dates"),
119
+ containerProps: PropTypes.shape({}).description('Set of Properties attached to the main container'),
120
+ className: PropTypes.string.description('html class attribute'),
121
+ disabled: PropTypes.bool.description('disable component or not').defaultValue(false),
122
+ required: PropTypes.bool.description('input is required or not').defaultValue(false),
123
+ startDateRequired: PropTypes.bool.description('start date is required or not').defaultValue(false),
124
+ endDateRequired: PropTypes.bool.description('end date is required or not').defaultValue(false),
125
+ id: PropTypes.string.description('components id'),
126
+ hasError: PropTypes.bool.description('set error state').defaultValue(false),
127
+ validationMessage: PropTypes.string.description('validation message'),
128
+ readOnly: PropTypes.bool.description('component is read only or not').description(false),
129
+ screenReaderInputMessage: PropTypes.string.description('message to be anounced by screen reader').defaultValue('select date'),
130
+ initialVisibleMonth: PropTypes.instanceOf(Date, moment).description('initial visible month'),
131
+ firstDayOfWeek: PropTypes.number.description('first day of week').defaultValue(0),
132
+ keepOpenOnDateSelect: PropTypes.bool.description('keep picker open when a date is selected').defaultValue(true),
133
+ reopenPickerOnClearDates: PropTypes.bool.description('reopen picker when clearing dates').defaultValue(false),
134
+ hideKeyboardShortcutsPanel: PropTypes.bool.description('hide keyabord shortcut panel or not'),
135
+ onPrevMonthClick: PropTypes.func.description('function executed when clicking on prev month button'),
136
+ onNextMonthClick: PropTypes.func.description('function executed when clicking on next month button'),
137
+ onClose: PropTypes.func.description('function executed when component closes'),
138
+ transitionDuration: PropTypes.number.description('transition duration').defaultValue(0),
139
+ verticalSpacing: PropTypes.number.description('vertical spacing'),
140
+ isDayBlocked: PropTypes.func.description('function that returns each day and disables desired dates'),
141
+ isOutsideRange: PropTypes.func.description('function that returns each day and disables outisde range dates'),
142
+ isDayHighlighted: PropTypes.func.description('function that returns each day and higlights desired dates'),
128
143
  minimumNights: 0,
129
- displayFormat: PropTypes.string.description("display format").defaultValue("L"),
130
- displayFormatDay: PropTypes.string.description("display format day").defaultValue("D"),
144
+ displayFormat: PropTypes.string.description('display format').defaultValue('L'),
145
+ displayFormatDay: PropTypes.string.description('display format day').defaultValue('D'),
131
146
  phrases: PropTypes.shape({
132
147
  calendarLabel: PropTypes.string,
133
148
  closeDatePicker: PropTypes.string,
@@ -157,28 +172,20 @@ const dateRangePickerProps = {
157
172
  chooseAvailableEndDate: PropTypes.func,
158
173
  dateIsUnavailable: PropTypes.func,
159
174
  dateIsSelected: PropTypes.func
160
- }).description("react-dates phrases"),
161
- startDate: PropTypes.instanceOf(Date, moment).description("start date value"),
162
- endDate: PropTypes.instanceOf(Date, moment).description("end date value"),
163
- startDateId: PropTypes.string.description("start date id"),
164
- endDateId: PropTypes.string.description("end date id"),
165
- labelFrom: PropTypes.string.description("label of start date input"),
166
- labelTo: PropTypes.string.description("label of end date input"),
167
- enableOutsideDays: PropTypes.bool.description("enable days outside current month").defaultValue("true"),
168
- onDatesChange: PropTypes.func.description("function executed when dates change"),
169
- onChangeStartInput: PropTypes.func.description("function executed when start date input changes"),
170
- onChangeEndInput: PropTypes.func.description("function executed when end date input changes"),
171
- onOutsideClick: PropTypes.func.description("function executed when clicking outside component")
175
+ }).description('react-dates phrases'),
176
+ startDate: PropTypes.instanceOf(Date, moment).description('start date value'),
177
+ endDate: PropTypes.instanceOf(Date, moment).description('end date value'),
178
+ startDateId: PropTypes.string.description('start date id'),
179
+ endDateId: PropTypes.string.description('end date id'),
180
+ labelFrom: PropTypes.string.description('label of start date input'),
181
+ labelTo: PropTypes.string.description('label of end date input'),
182
+ enableOutsideDays: PropTypes.bool.description('enable days outside current month').defaultValue('true'),
183
+ onDatesChange: PropTypes.func.description('function executed when dates change'),
184
+ onChangeStartInput: PropTypes.func.description('function executed when start date input changes'),
185
+ onChangeEndInput: PropTypes.func.description('function executed when end date input changes'),
186
+ onOutsideClick: PropTypes.func.description('function executed when clicking outside component')
172
187
  };
173
- DSDateRangePicker.propTypes = dateRangePickerProps;
174
188
  const DateRangePickerWithSchema = describe(DSDateRangePicker);
175
189
  DateRangePickerWithSchema.propTypes = dateRangePickerProps;
176
- var DSDateRangePicker_default = DSDateRangePicker;
177
- export {
178
- DateRangePickerWithSchema,
179
- DayPickerRangeController,
180
- END_DATE,
181
- START_DATE,
182
- DSDateRangePicker_default as default
183
- };
184
- //# sourceMappingURL=DSDateRangePicker.js.map
190
+
191
+ export { DateRangePickerWithSchema, DSDateRangePicker as default };