@elliemae/ds-date-time-picker 2.0.0-next.7 → 2.0.0-rc.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/DSDateTimePicker.js +45 -39
- package/cjs/components/DateTimePickerImpl.js +58 -57
- package/esm/DSDateTimePicker.js +45 -39
- package/esm/components/DateTimePickerImpl.js +52 -49
- package/package.json +16 -9
- package/types/DSDateTimePicker.d.ts +139 -11
package/cjs/DSDateTimePicker.js
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
6
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
8
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
5
10
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
6
11
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
7
12
|
require('react');
|
|
@@ -28,45 +33,46 @@ const {
|
|
|
28
33
|
id: idDefault
|
|
29
34
|
} = english;
|
|
30
35
|
|
|
31
|
-
const DSDateTimePicker =
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
36
|
+
const DSDateTimePicker = _ref => {
|
|
37
|
+
let {
|
|
38
|
+
containerProps = {},
|
|
39
|
+
className = classNameDefault,
|
|
40
|
+
id = idDefault,
|
|
41
|
+
placeholder = placeholderDefault,
|
|
42
|
+
date,
|
|
43
|
+
clearable = false,
|
|
44
|
+
onBlur = () => null,
|
|
45
|
+
datePickerProps = {
|
|
46
|
+
disabled: false,
|
|
47
|
+
numberOfMonths: 1,
|
|
48
|
+
readOnly: false,
|
|
49
|
+
enableOutsideDays: false,
|
|
50
|
+
transitionDuration: 0,
|
|
51
|
+
firstDayOfWeek: 0,
|
|
52
|
+
keepOpenOnDateSelect: true,
|
|
53
|
+
hideKeyboardShortcutsPanel: true,
|
|
54
|
+
onPrevMonthClick: () => null,
|
|
55
|
+
onNextMonthClick: () => null,
|
|
56
|
+
onClose: () => null,
|
|
57
|
+
onchange: () => null,
|
|
58
|
+
onDateChange: () => null,
|
|
59
|
+
phrases: dsDatePicker.SingleDatePickerPhrases,
|
|
60
|
+
displayFormatDay: 'D',
|
|
61
|
+
isDayBlocked: () => false,
|
|
62
|
+
isOutsideRange: () => false,
|
|
63
|
+
isDayHighlighted: () => false,
|
|
64
|
+
zIndex: 11
|
|
65
|
+
},
|
|
66
|
+
timePickerProps = {
|
|
67
|
+
format: 'hh:mm A',
|
|
68
|
+
onChange: () => null,
|
|
69
|
+
disabledTimes: undefined,
|
|
70
|
+
minutesInterval: 1
|
|
71
|
+
},
|
|
72
|
+
dateInputProps = {
|
|
73
|
+
onDateInputDateChange: () => null
|
|
74
|
+
}
|
|
75
|
+
} = _ref;
|
|
70
76
|
const {
|
|
71
77
|
cssClassName
|
|
72
78
|
} = dsClassnames.convertPropToCssClassName('datetimepicker', className, {
|
|
@@ -4,16 +4,18 @@ var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProp
|
|
|
4
4
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
5
5
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
6
|
require('core-js/modules/web.dom-collections.iterator.js');
|
|
7
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
8
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
10
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
11
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
7
12
|
var react = require('react');
|
|
8
13
|
var moment = require('moment');
|
|
9
14
|
var dsClassnames = require('@elliemae/ds-classnames');
|
|
10
15
|
var dsDatePicker = require('@elliemae/ds-date-picker');
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
var
|
|
14
|
-
var TimeInput = require('@elliemae/ds-basic/form/TimeInput');
|
|
15
|
-
var timeUtils = require('@elliemae/ds-utilities/timeUtils');
|
|
16
|
-
var TimePicker$1 = require('@elliemae/ds-basic/TimePicker');
|
|
16
|
+
var dsForm = require('@elliemae/ds-form');
|
|
17
|
+
var dsUtilities = require('@elliemae/ds-utilities');
|
|
18
|
+
var dsTimePicker = require('@elliemae/ds-time-picker');
|
|
17
19
|
var utils = require('../utils.js');
|
|
18
20
|
var jsxRuntime = require('react/jsx-runtime');
|
|
19
21
|
|
|
@@ -23,8 +25,6 @@ var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_obje
|
|
|
23
25
|
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
24
26
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
25
27
|
var moment__default = /*#__PURE__*/_interopDefaultLegacy(moment);
|
|
26
|
-
var DSInputGroup__default = /*#__PURE__*/_interopDefaultLegacy(DSInputGroup);
|
|
27
|
-
var DSInput__default = /*#__PURE__*/_interopDefaultLegacy(DSInput);
|
|
28
28
|
|
|
29
29
|
const _excluded = ["onChange"];
|
|
30
30
|
|
|
@@ -33,55 +33,56 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
33
33
|
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__default["default"](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; }
|
|
34
34
|
const blockName = 'date-time-picker';
|
|
35
35
|
const DateTimePickerWrapper = dsClassnames.aggregatedClasses('div')(blockName, 'wrapper');
|
|
36
|
-
const TimePicker = dsClassnames.aggregatedClasses(
|
|
36
|
+
const TimePicker = dsClassnames.aggregatedClasses(dsTimePicker.DSTimePickerMenu)(blockName, 'time-picker');
|
|
37
37
|
const TimePickerWrapper = dsClassnames.aggregatedClasses('div')(blockName, 'time-picker-wrapper'); // const DateInput = aggregatedClasses(DateInputsV2Impl)(blockName, 'date-input');
|
|
38
38
|
|
|
39
39
|
const formatDate = 'MMDDYYYY';
|
|
40
40
|
|
|
41
|
-
const DSDateTimePickerImpl =
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
41
|
+
const DSDateTimePickerImpl = _ref => {
|
|
42
|
+
let {
|
|
43
|
+
onBlur = () => null,
|
|
44
|
+
placeholder,
|
|
45
|
+
date,
|
|
46
|
+
clearable,
|
|
47
|
+
datePickerProps: {
|
|
48
|
+
disabled = false,
|
|
49
|
+
numberOfMonths = 1,
|
|
50
|
+
readOnly = false,
|
|
51
|
+
enableOutsideDays = false,
|
|
52
|
+
transitionDuration = 0,
|
|
53
|
+
firstDayOfWeek = 0,
|
|
54
|
+
keepOpenOnDateSelect = true,
|
|
55
|
+
hideKeyboardShortcutsPanel = true,
|
|
56
|
+
onPrevMonthClick = () => null,
|
|
57
|
+
onNextMonthClick = () => null,
|
|
58
|
+
onClose = () => null,
|
|
59
|
+
onChange: onDatePickerChange = () => null,
|
|
60
|
+
onDateChange = () => null,
|
|
61
|
+
onError: onErrorDate = () => null,
|
|
62
|
+
phrases = dsDatePicker.SingleDatePickerPhrases,
|
|
63
|
+
displayFormatDay = 'D',
|
|
64
|
+
isDayBlocked = () => false,
|
|
65
|
+
isOutsideRange = () => false,
|
|
66
|
+
isDayHighlighted = () => false,
|
|
67
|
+
zIndex = 11
|
|
68
|
+
},
|
|
69
|
+
timePickerProps: {
|
|
70
|
+
format = 'hh:mm A',
|
|
71
|
+
onChange: onChangeTimePicker = () => null,
|
|
72
|
+
disabledTimes = undefined,
|
|
73
|
+
onError: onErrorTime = () => null,
|
|
74
|
+
minutesInterval = 1
|
|
75
|
+
},
|
|
76
|
+
dateInputProps: {
|
|
77
|
+
onDateInputDateChange = () => null
|
|
78
|
+
}
|
|
79
|
+
} = _ref;
|
|
79
80
|
const [selectedDate, setSelectedDate] = react.useState(undefined);
|
|
80
81
|
const [incompleteInput, setIncompleteInput] = react.useState(undefined);
|
|
81
82
|
const [isOpen, setIsOpen] = react.useState(false);
|
|
82
83
|
const disabledTimeRange = disabledTimes && {
|
|
83
|
-
from:
|
|
84
|
-
to:
|
|
84
|
+
from: dsTimePicker.convertTimeString(disabledTimes.from),
|
|
85
|
+
to: dsTimePicker.convertTimeString(disabledTimes.to)
|
|
85
86
|
};
|
|
86
87
|
const dateTimePickerWrapperRef = react.useRef();
|
|
87
88
|
const fullFormat = "".concat(formatDate, " ").concat(format);
|
|
@@ -90,7 +91,7 @@ const DSDateTimePickerImpl = ({
|
|
|
90
91
|
setSelectedDate(moment__default["default"](date));
|
|
91
92
|
} else if (date === null) setSelectedDate(undefined);
|
|
92
93
|
}, [date]);
|
|
93
|
-
const visiblePanels = react.useMemo(() =>
|
|
94
|
+
const visiblePanels = react.useMemo(() => dsUtilities.getVisibleTimeByFormat(format), []);
|
|
94
95
|
const currentYear = moment__default["default"]().year();
|
|
95
96
|
|
|
96
97
|
const handleDatePickerChange = dateSelected => {
|
|
@@ -198,7 +199,7 @@ const DSDateTimePickerImpl = ({
|
|
|
198
199
|
});
|
|
199
200
|
}, [isOpen]);
|
|
200
201
|
const hasSelectedDate = !!selectedDate;
|
|
201
|
-
return /*#__PURE__*/_jsx__default["default"](
|
|
202
|
+
return /*#__PURE__*/_jsx__default["default"](dsForm.DSInputGroup, {
|
|
202
203
|
containerProps: {
|
|
203
204
|
onBlur: handleContainerBlur
|
|
204
205
|
},
|
|
@@ -246,19 +247,19 @@ const DSDateTimePickerImpl = ({
|
|
|
246
247
|
onClick: handleOpen,
|
|
247
248
|
readOnly: readOnly
|
|
248
249
|
})
|
|
249
|
-
}, void 0, /*#__PURE__*/_jsx__default["default"](
|
|
250
|
-
customInputType:
|
|
250
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"](dsForm.DSInput, {
|
|
251
|
+
customInputType: _ref2 => {
|
|
251
252
|
let {
|
|
252
253
|
onChange: handleChange
|
|
253
|
-
} =
|
|
254
|
-
restInputProps = _objectWithoutProperties__default["default"](
|
|
254
|
+
} = _ref2,
|
|
255
|
+
restInputProps = _objectWithoutProperties__default["default"](_ref2, _excluded);
|
|
255
256
|
|
|
256
257
|
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
257
258
|
children: [/*#__PURE__*/_jsx__default["default"]("div", {
|
|
258
259
|
style: {
|
|
259
260
|
display: 'flex'
|
|
260
261
|
}
|
|
261
|
-
}, void 0, /*#__PURE__*/jsxRuntime.jsx(
|
|
262
|
+
}, void 0, /*#__PURE__*/jsxRuntime.jsx(dsForm.DateInputsV2Impl, _objectSpread(_objectSpread({
|
|
262
263
|
disabled: disabled,
|
|
263
264
|
onChange: input => handleChange(input, 'date')
|
|
264
265
|
}, restInputProps), {}, {
|
|
@@ -266,7 +267,7 @@ const DSDateTimePickerImpl = ({
|
|
|
266
267
|
yearMaxRange: currentYear + 100,
|
|
267
268
|
yearMinRange: currentYear - 100,
|
|
268
269
|
time: restInputProps.value && restInputProps.value.hour && restInputProps.value.isValid() ? restInputProps.value.format(formatDate) : restInputProps.value
|
|
269
|
-
}))), /*#__PURE__*/jsxRuntime.jsx(
|
|
270
|
+
}))), /*#__PURE__*/jsxRuntime.jsx(dsForm.TimeInputImpl, _objectSpread({
|
|
270
271
|
disabled: disabled,
|
|
271
272
|
format: format,
|
|
272
273
|
onChange: time => handleChange(time, 'time')
|
package/esm/DSDateTimePicker.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
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';
|
|
1
6
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
7
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
3
8
|
import 'react';
|
|
@@ -18,45 +23,46 @@ const {
|
|
|
18
23
|
id: idDefault
|
|
19
24
|
} = english;
|
|
20
25
|
|
|
21
|
-
const DSDateTimePicker =
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
26
|
+
const DSDateTimePicker = _ref => {
|
|
27
|
+
let {
|
|
28
|
+
containerProps = {},
|
|
29
|
+
className = classNameDefault,
|
|
30
|
+
id = idDefault,
|
|
31
|
+
placeholder = placeholderDefault,
|
|
32
|
+
date,
|
|
33
|
+
clearable = false,
|
|
34
|
+
onBlur = () => null,
|
|
35
|
+
datePickerProps = {
|
|
36
|
+
disabled: false,
|
|
37
|
+
numberOfMonths: 1,
|
|
38
|
+
readOnly: false,
|
|
39
|
+
enableOutsideDays: false,
|
|
40
|
+
transitionDuration: 0,
|
|
41
|
+
firstDayOfWeek: 0,
|
|
42
|
+
keepOpenOnDateSelect: true,
|
|
43
|
+
hideKeyboardShortcutsPanel: true,
|
|
44
|
+
onPrevMonthClick: () => null,
|
|
45
|
+
onNextMonthClick: () => null,
|
|
46
|
+
onClose: () => null,
|
|
47
|
+
onchange: () => null,
|
|
48
|
+
onDateChange: () => null,
|
|
49
|
+
phrases: SingleDatePickerPhrases,
|
|
50
|
+
displayFormatDay: 'D',
|
|
51
|
+
isDayBlocked: () => false,
|
|
52
|
+
isOutsideRange: () => false,
|
|
53
|
+
isDayHighlighted: () => false,
|
|
54
|
+
zIndex: 11
|
|
55
|
+
},
|
|
56
|
+
timePickerProps = {
|
|
57
|
+
format: 'hh:mm A',
|
|
58
|
+
onChange: () => null,
|
|
59
|
+
disabledTimes: undefined,
|
|
60
|
+
minutesInterval: 1
|
|
61
|
+
},
|
|
62
|
+
dateInputProps = {
|
|
63
|
+
onDateInputDateChange: () => null
|
|
64
|
+
}
|
|
65
|
+
} = _ref;
|
|
60
66
|
const {
|
|
61
67
|
cssClassName
|
|
62
68
|
} = convertPropToCssClassName('datetimepicker', className, {
|
|
@@ -1,3 +1,8 @@
|
|
|
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';
|
|
1
6
|
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
2
7
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
3
8
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
@@ -5,13 +10,10 @@ import 'core-js/modules/web.dom-collections.iterator.js';
|
|
|
5
10
|
import { useState, useRef, useEffect, useMemo } from 'react';
|
|
6
11
|
import moment from 'moment';
|
|
7
12
|
import { aggregatedClasses } from '@elliemae/ds-classnames';
|
|
8
|
-
import {
|
|
9
|
-
import DSInputGroup from '@elliemae/ds-
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import { TimeInputImpl } from '@elliemae/ds-basic/form/TimeInput';
|
|
13
|
-
import { getVisibleTimeByFormat } from '@elliemae/ds-utilities/timeUtils';
|
|
14
|
-
import { Menu, convertTimeString } from '@elliemae/ds-basic/TimePicker';
|
|
13
|
+
import { DatePickerDropdown, DSDatePickerController, SingleDatePickerPhrases } from '@elliemae/ds-date-picker';
|
|
14
|
+
import { DSInputGroup, DSInput, DateInputsV2Impl, TimeInputImpl } from '@elliemae/ds-form';
|
|
15
|
+
import { getVisibleTimeByFormat } from '@elliemae/ds-utilities';
|
|
16
|
+
import { DSTimePickerMenu, convertTimeString } from '@elliemae/ds-time-picker';
|
|
15
17
|
import { updateDateAndTime } from '../utils.js';
|
|
16
18
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
17
19
|
|
|
@@ -22,49 +24,50 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
22
24
|
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; }
|
|
23
25
|
const blockName = 'date-time-picker';
|
|
24
26
|
const DateTimePickerWrapper = aggregatedClasses('div')(blockName, 'wrapper');
|
|
25
|
-
const TimePicker = aggregatedClasses(
|
|
27
|
+
const TimePicker = aggregatedClasses(DSTimePickerMenu)(blockName, 'time-picker');
|
|
26
28
|
const TimePickerWrapper = aggregatedClasses('div')(blockName, 'time-picker-wrapper'); // const DateInput = aggregatedClasses(DateInputsV2Impl)(blockName, 'date-input');
|
|
27
29
|
|
|
28
30
|
const formatDate = 'MMDDYYYY';
|
|
29
31
|
|
|
30
|
-
const DSDateTimePickerImpl =
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}
|
|
32
|
+
const DSDateTimePickerImpl = _ref => {
|
|
33
|
+
let {
|
|
34
|
+
onBlur = () => null,
|
|
35
|
+
placeholder,
|
|
36
|
+
date,
|
|
37
|
+
clearable,
|
|
38
|
+
datePickerProps: {
|
|
39
|
+
disabled = false,
|
|
40
|
+
numberOfMonths = 1,
|
|
41
|
+
readOnly = false,
|
|
42
|
+
enableOutsideDays = false,
|
|
43
|
+
transitionDuration = 0,
|
|
44
|
+
firstDayOfWeek = 0,
|
|
45
|
+
keepOpenOnDateSelect = true,
|
|
46
|
+
hideKeyboardShortcutsPanel = true,
|
|
47
|
+
onPrevMonthClick = () => null,
|
|
48
|
+
onNextMonthClick = () => null,
|
|
49
|
+
onClose = () => null,
|
|
50
|
+
onChange: onDatePickerChange = () => null,
|
|
51
|
+
onDateChange = () => null,
|
|
52
|
+
onError: onErrorDate = () => null,
|
|
53
|
+
phrases = SingleDatePickerPhrases,
|
|
54
|
+
displayFormatDay = 'D',
|
|
55
|
+
isDayBlocked = () => false,
|
|
56
|
+
isOutsideRange = () => false,
|
|
57
|
+
isDayHighlighted = () => false,
|
|
58
|
+
zIndex = 11
|
|
59
|
+
},
|
|
60
|
+
timePickerProps: {
|
|
61
|
+
format = 'hh:mm A',
|
|
62
|
+
onChange: onChangeTimePicker = () => null,
|
|
63
|
+
disabledTimes = undefined,
|
|
64
|
+
onError: onErrorTime = () => null,
|
|
65
|
+
minutesInterval = 1
|
|
66
|
+
},
|
|
67
|
+
dateInputProps: {
|
|
68
|
+
onDateInputDateChange = () => null
|
|
69
|
+
}
|
|
70
|
+
} = _ref;
|
|
68
71
|
const [selectedDate, setSelectedDate] = useState(undefined);
|
|
69
72
|
const [incompleteInput, setIncompleteInput] = useState(undefined);
|
|
70
73
|
const [isOpen, setIsOpen] = useState(false);
|
|
@@ -236,11 +239,11 @@ const DSDateTimePickerImpl = ({
|
|
|
236
239
|
readOnly: readOnly
|
|
237
240
|
})
|
|
238
241
|
}, void 0, /*#__PURE__*/_jsx(DSInput, {
|
|
239
|
-
customInputType:
|
|
242
|
+
customInputType: _ref2 => {
|
|
240
243
|
let {
|
|
241
244
|
onChange: handleChange
|
|
242
|
-
} =
|
|
243
|
-
restInputProps = _objectWithoutProperties(
|
|
245
|
+
} = _ref2,
|
|
246
|
+
restInputProps = _objectWithoutProperties(_ref2, _excluded);
|
|
244
247
|
|
|
245
248
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
246
249
|
children: [/*#__PURE__*/_jsx("div", {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-date-time-picker",
|
|
3
|
-
"version": "2.0.0-
|
|
3
|
+
"version": "2.0.0-rc.10",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Date Time Picker",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -52,21 +52,28 @@
|
|
|
52
52
|
"build": "node ../../scripts/build/build.js"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@elliemae/ds-
|
|
56
|
-
"@elliemae/ds-
|
|
57
|
-
"@elliemae/ds-
|
|
58
|
-
"@elliemae/ds-
|
|
59
|
-
"@elliemae/ds-
|
|
55
|
+
"@elliemae/ds-classnames": "2.0.0-rc.10",
|
|
56
|
+
"@elliemae/ds-date-picker": "2.0.0-rc.10",
|
|
57
|
+
"@elliemae/ds-form": "2.0.0-rc.10",
|
|
58
|
+
"@elliemae/ds-system": "2.0.0-rc.10",
|
|
59
|
+
"@elliemae/ds-time-picker": "2.0.0-rc.10",
|
|
60
|
+
"@elliemae/ds-utilities": "2.0.0-rc.10",
|
|
60
61
|
"lodash": "~4.17.21",
|
|
61
62
|
"moment": "~2.29.1",
|
|
62
63
|
"prop-types": "~15.7.2",
|
|
63
|
-
"react-
|
|
64
|
-
|
|
64
|
+
"react-desc": "^4.1.3"
|
|
65
|
+
},
|
|
66
|
+
"devDependencies": {
|
|
67
|
+
"@testing-library/jest-dom": "~5.15.0",
|
|
68
|
+
"@testing-library/react": "~12.1.2",
|
|
69
|
+
"@testing-library/user-event": "~13.5.0",
|
|
70
|
+
"styled-components": "~5.3.3"
|
|
65
71
|
},
|
|
66
72
|
"peerDependencies": {
|
|
67
73
|
"lodash": "^4.17.21",
|
|
68
74
|
"react": "~17.0.2",
|
|
69
|
-
"react-dom": "^17.0.2"
|
|
75
|
+
"react-dom": "^17.0.2",
|
|
76
|
+
"styled-components": "^5.3.3"
|
|
70
77
|
},
|
|
71
78
|
"publishConfig": {
|
|
72
79
|
"access": "public",
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference path="../../../../shared/typings/react-desc.d.ts" />
|
|
1
2
|
/// <reference types="react" />
|
|
2
3
|
declare const DSDateTimePicker: {
|
|
3
4
|
({ containerProps, className, id, placeholder, date, clearable, onBlur, datePickerProps, timePickerProps, dateInputProps, }: {
|
|
@@ -75,36 +76,163 @@ declare const DSDateTimePicker: {
|
|
|
75
76
|
} | undefined;
|
|
76
77
|
}): JSX.Element;
|
|
77
78
|
propTypes: {
|
|
78
|
-
containerProps:
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
containerProps: {
|
|
80
|
+
defaultValue<T = unknown>(arg: T): {
|
|
81
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
82
|
+
};
|
|
83
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
84
|
+
};
|
|
85
|
+
className: {
|
|
86
|
+
defaultValue<T = unknown>(arg: T): {
|
|
87
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
88
|
+
};
|
|
89
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
90
|
+
};
|
|
91
|
+
id: {
|
|
92
|
+
defaultValue<T = unknown>(arg: T): {
|
|
93
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
94
|
+
};
|
|
95
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
96
|
+
};
|
|
81
97
|
/**
|
|
82
98
|
* on blur callback
|
|
83
99
|
*/
|
|
84
|
-
onBlur:
|
|
100
|
+
onBlur: {
|
|
101
|
+
defaultValue<T = unknown>(arg: T): {
|
|
102
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
103
|
+
};
|
|
104
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
105
|
+
};
|
|
85
106
|
/**
|
|
86
107
|
* Initial date, by default current date
|
|
87
108
|
*/
|
|
88
|
-
date:
|
|
109
|
+
date: {
|
|
110
|
+
defaultValue<T = unknown>(arg: T): {
|
|
111
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
112
|
+
};
|
|
113
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
114
|
+
};
|
|
89
115
|
/**
|
|
90
116
|
* Flag to trigger onDateChange on error
|
|
91
117
|
*/
|
|
92
|
-
clearable:
|
|
118
|
+
clearable: {
|
|
119
|
+
defaultValue<T = unknown>(arg: T): {
|
|
120
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
121
|
+
};
|
|
122
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
123
|
+
};
|
|
93
124
|
/**
|
|
94
125
|
* DatePicker properties
|
|
95
126
|
*/
|
|
96
|
-
datePickerProps:
|
|
127
|
+
datePickerProps: {
|
|
128
|
+
defaultValue<T = unknown>(arg: T): {
|
|
129
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
130
|
+
};
|
|
131
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
132
|
+
};
|
|
97
133
|
/**
|
|
98
134
|
* Input placeholder
|
|
99
135
|
*/
|
|
100
|
-
placeholder:
|
|
136
|
+
placeholder: {
|
|
137
|
+
defaultValue<T = unknown>(arg: T): {
|
|
138
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
139
|
+
};
|
|
140
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
141
|
+
};
|
|
101
142
|
/**
|
|
102
143
|
* TimePicker properties
|
|
103
144
|
*/
|
|
104
|
-
timePickerProps:
|
|
105
|
-
|
|
145
|
+
timePickerProps: {
|
|
146
|
+
defaultValue<T = unknown>(arg: T): {
|
|
147
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
148
|
+
};
|
|
149
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
150
|
+
};
|
|
151
|
+
dateInputProps: {
|
|
152
|
+
defaultValue<T = unknown>(arg: T): {
|
|
153
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
154
|
+
};
|
|
155
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
156
|
+
};
|
|
106
157
|
};
|
|
107
158
|
};
|
|
108
|
-
declare const DateTimePickerWithSchema:
|
|
159
|
+
declare const DateTimePickerWithSchema: {
|
|
160
|
+
(props?: {
|
|
161
|
+
containerProps?: {} | undefined;
|
|
162
|
+
className?: string | undefined;
|
|
163
|
+
id?: string | undefined;
|
|
164
|
+
placeholder?: string | undefined;
|
|
165
|
+
date: any;
|
|
166
|
+
clearable?: boolean | undefined;
|
|
167
|
+
onBlur?: (() => null) | undefined;
|
|
168
|
+
datePickerProps?: {
|
|
169
|
+
disabled: boolean;
|
|
170
|
+
numberOfMonths: number;
|
|
171
|
+
readOnly: boolean;
|
|
172
|
+
enableOutsideDays: boolean;
|
|
173
|
+
transitionDuration: number;
|
|
174
|
+
firstDayOfWeek: number;
|
|
175
|
+
keepOpenOnDateSelect: boolean;
|
|
176
|
+
hideKeyboardShortcutsPanel: boolean;
|
|
177
|
+
onPrevMonthClick: () => null;
|
|
178
|
+
onNextMonthClick: () => null;
|
|
179
|
+
onClose: () => null;
|
|
180
|
+
onchange: () => null;
|
|
181
|
+
onDateChange: () => null;
|
|
182
|
+
phrases: {
|
|
183
|
+
calendarLabel: string;
|
|
184
|
+
roleDescription: string;
|
|
185
|
+
closeDatePicker: string;
|
|
186
|
+
clearDate: string;
|
|
187
|
+
jumpToPrevMonth: string;
|
|
188
|
+
jumpToNextMonth: string;
|
|
189
|
+
keyboardShortcuts: string;
|
|
190
|
+
showKeyboardShortcutsPanel: string;
|
|
191
|
+
hideKeyboardShortcutsPanel: string;
|
|
192
|
+
openThisPanel: string;
|
|
193
|
+
enterKey: string;
|
|
194
|
+
leftArrowRightArrow: string;
|
|
195
|
+
upArrowDownArrow: string;
|
|
196
|
+
pageUpPageDown: string;
|
|
197
|
+
homeEnd: string;
|
|
198
|
+
escape: string;
|
|
199
|
+
questionMark: string;
|
|
200
|
+
selectFocusedDate: string;
|
|
201
|
+
moveFocusByOneDay: string;
|
|
202
|
+
moveFocusByOneWeek: string;
|
|
203
|
+
moveFocusByOneMonth: string;
|
|
204
|
+
moveFocustoStartAndEndOfWeek: string;
|
|
205
|
+
returnFocusToInput: string;
|
|
206
|
+
keyboardForwardNavigationInstructions: string;
|
|
207
|
+
keyboardBackwardNavigationInstructions: string;
|
|
208
|
+
chooseAvailableDate: ({ date }: {
|
|
209
|
+
date: any;
|
|
210
|
+
}) => any;
|
|
211
|
+
dateIsUnavailable: ({ date }: {
|
|
212
|
+
date: any;
|
|
213
|
+
}) => string;
|
|
214
|
+
dateIsSelected: ({ date }: {
|
|
215
|
+
date: any;
|
|
216
|
+
}) => string;
|
|
217
|
+
};
|
|
218
|
+
displayFormatDay: string;
|
|
219
|
+
isDayBlocked: () => boolean;
|
|
220
|
+
isOutsideRange: () => boolean;
|
|
221
|
+
isDayHighlighted: () => boolean;
|
|
222
|
+
zIndex: number;
|
|
223
|
+
} | undefined;
|
|
224
|
+
timePickerProps?: {
|
|
225
|
+
format: string;
|
|
226
|
+
onChange: () => null;
|
|
227
|
+
disabledTimes: undefined;
|
|
228
|
+
minutesInterval: number;
|
|
229
|
+
} | undefined;
|
|
230
|
+
dateInputProps?: {
|
|
231
|
+
onDateInputDateChange: () => null;
|
|
232
|
+
} | undefined;
|
|
233
|
+
} | undefined): JSX.Element;
|
|
234
|
+
propTypes: unknown;
|
|
235
|
+
toTypescript: () => import("react-desc").TypescriptSchema;
|
|
236
|
+
};
|
|
109
237
|
export { DateTimePickerWithSchema };
|
|
110
238
|
export default DSDateTimePicker;
|