@elliemae/ds-time-picker 2.0.0-alpha.10 → 2.0.0-alpha.14
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/DSTimePicker.js +42 -39
- package/cjs/DSTimePickerMenu.js +5 -0
- package/cjs/PickerPanel.js +47 -33
- package/cjs/TimePickerDropdown.js +36 -34
- package/cjs/TimePickerImpl.js +40 -34
- package/cjs/TimePickerMenu.js +16 -10
- package/cjs/moveElementOnScroll.js +10 -9
- package/cjs/utils.js +2 -1
- package/esm/DSTimePicker.js +42 -39
- package/esm/DSTimePickerMenu.js +5 -0
- package/esm/PickerPanel.js +44 -28
- package/esm/TimePickerDropdown.js +36 -33
- package/esm/TimePickerImpl.js +36 -28
- package/esm/TimePickerMenu.js +11 -5
- package/esm/moveElementOnScroll.js +10 -9
- package/esm/utils.js +2 -1
- package/package.json +9 -9
- package/types/DSTimePicker.d.ts +133 -19
- package/types/TimePickerDropdown.d.ts +1 -1
- package/cjs/package.json +0 -7
- package/esm/package.json +0 -7
package/esm/DSTimePicker.js
CHANGED
|
@@ -4,45 +4,48 @@ import moment from 'moment';
|
|
|
4
4
|
import TimePickerImpl from './TimePickerImpl.js';
|
|
5
5
|
import { jsx } from 'react/jsx-runtime';
|
|
6
6
|
|
|
7
|
-
const DSTimePicker =
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
7
|
+
const DSTimePicker = _ref => {
|
|
8
|
+
let {
|
|
9
|
+
containerProps = {},
|
|
10
|
+
innerRef,
|
|
11
|
+
className = '',
|
|
12
|
+
disabled = false,
|
|
13
|
+
value = '',
|
|
14
|
+
format,
|
|
15
|
+
style = {},
|
|
16
|
+
onChange = () => null,
|
|
17
|
+
onOpen = () => null,
|
|
18
|
+
isOpen = undefined,
|
|
19
|
+
clearable = false,
|
|
20
|
+
hasHeader = true,
|
|
21
|
+
hasHeaderDisplay = false,
|
|
22
|
+
'aria-label': ariaLabel,
|
|
23
|
+
zIndex = 'auto',
|
|
24
|
+
placement = 'bottom',
|
|
25
|
+
disabledTimes,
|
|
26
|
+
minutesInterval = 1
|
|
27
|
+
} = _ref;
|
|
28
|
+
return /*#__PURE__*/jsx(TimePickerImpl, {
|
|
29
|
+
ref: innerRef,
|
|
30
|
+
"aria-label": ariaLabel,
|
|
31
|
+
className: className,
|
|
32
|
+
clearable: clearable,
|
|
33
|
+
containerProps: containerProps,
|
|
34
|
+
disabled: disabled,
|
|
35
|
+
format: format,
|
|
36
|
+
hasHeader: hasHeader,
|
|
37
|
+
hasHeaderDisplay: hasHeaderDisplay,
|
|
38
|
+
isOpen: isOpen,
|
|
39
|
+
onChange: onChange,
|
|
40
|
+
onOpen: onOpen,
|
|
41
|
+
placement: placement,
|
|
42
|
+
style: style,
|
|
43
|
+
value: value,
|
|
44
|
+
zIndex: zIndex,
|
|
45
|
+
minutesInterval: minutesInterval,
|
|
46
|
+
disabledTimes: disabledTimes
|
|
47
|
+
});
|
|
48
|
+
};
|
|
46
49
|
|
|
47
50
|
DSTimePicker.defaultProps = {
|
|
48
51
|
format: 'hh:mm:ss A'
|
package/esm/DSTimePickerMenu.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 _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
7
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
3
8
|
import 'react';
|
package/esm/PickerPanel.js
CHANGED
|
@@ -1,11 +1,20 @@
|
|
|
1
|
-
import
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
3
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
4
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
2
5
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
6
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
7
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
8
|
+
import 'core-js/modules/esnext.async-iterator.find.js';
|
|
9
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
10
|
+
import 'core-js/modules/esnext.iterator.find.js';
|
|
11
|
+
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
12
|
+
import 'core-js/modules/esnext.iterator.map.js';
|
|
3
13
|
import React, { Component } from 'react';
|
|
4
14
|
import { findIndex } from 'lodash';
|
|
5
15
|
import { aggregatedClasses } from '@elliemae/ds-classnames';
|
|
6
16
|
import memoizeOne from 'memoize-one';
|
|
7
|
-
import ChevronSmallUp from '@elliemae/ds-icons
|
|
8
|
-
import ChevronSmallDown from '@elliemae/ds-icons/ChevronSmallDown';
|
|
17
|
+
import { ChevronSmallUp, ChevronSmallDown } from '@elliemae/ds-icons';
|
|
9
18
|
import DSButton from '@elliemae/ds-button';
|
|
10
19
|
import { MoveElementOnScroll } from './moveElementOnScroll.js';
|
|
11
20
|
import { validateIndex } from './utils.js';
|
|
@@ -17,27 +26,34 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
17
26
|
|
|
18
27
|
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; }
|
|
19
28
|
const blockName = 'time-picker-panel';
|
|
20
|
-
const Container = aggregatedClasses('div')(blockName, null,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
29
|
+
const Container = aggregatedClasses('div')(blockName, null, _ref => {
|
|
30
|
+
let {
|
|
31
|
+
scrolling
|
|
32
|
+
} = _ref;
|
|
33
|
+
return {
|
|
34
|
+
scrolling
|
|
35
|
+
};
|
|
36
|
+
});
|
|
25
37
|
const Wrapper = aggregatedClasses('div')(blockName, 'wrapper');
|
|
26
38
|
const PickerItemListContainer = aggregatedClasses('div')(blockName, 'item-list-container');
|
|
27
39
|
const PickerItemList = aggregatedClasses('div')(blockName, 'item-list');
|
|
28
40
|
const PickerHeader = aggregatedClasses('div')(blockName, 'header');
|
|
29
|
-
const PickerItemContainer = aggregatedClasses('div')(blockName, 'item',
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
41
|
+
const PickerItemContainer = aggregatedClasses('div')(blockName, 'item', _ref2 => {
|
|
42
|
+
let {
|
|
43
|
+
selected,
|
|
44
|
+
disabled
|
|
45
|
+
} = _ref2;
|
|
46
|
+
return {
|
|
47
|
+
selected,
|
|
48
|
+
disabled
|
|
49
|
+
};
|
|
50
|
+
});
|
|
36
51
|
const PickerSelectedOptionSelected = aggregatedClasses('div')(blockName, 'selected-container');
|
|
37
52
|
const SelectedCircle = aggregatedClasses('div')(blockName, 'selected-circle');
|
|
38
53
|
const ArrowButtonContainer = aggregatedClasses('div')(blockName, 'arrow-container');
|
|
39
54
|
|
|
40
|
-
const getOptionIndex = (options, selectedOption
|
|
55
|
+
const getOptionIndex = function (options, selectedOption) {
|
|
56
|
+
let valueProperty = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'value';
|
|
41
57
|
const index = options.findIndex(option => option[valueProperty] === selectedOption);
|
|
42
58
|
return validateIndex(index, options);
|
|
43
59
|
};
|
|
@@ -51,8 +67,7 @@ const arrowProps = {
|
|
|
51
67
|
class PickerPanel extends Component {
|
|
52
68
|
constructor(props) {
|
|
53
69
|
super(props);
|
|
54
|
-
|
|
55
|
-
_defineProperty(this, "computeContainerTranslation", memoizeOne(index => {
|
|
70
|
+
this.computeContainerTranslation = memoizeOne(index => {
|
|
56
71
|
const {
|
|
57
72
|
options,
|
|
58
73
|
valueProperty
|
|
@@ -65,14 +80,14 @@ class PickerPanel extends Component {
|
|
|
65
80
|
const listYPosition = this.minYListPosition - selectedOptionIndex * this.optionHeight;
|
|
66
81
|
if (this.scrollHandler && !scrolling) this.scrollHandler.updatePosition(listYPosition);
|
|
67
82
|
return listYPosition;
|
|
68
|
-
})
|
|
83
|
+
});
|
|
69
84
|
|
|
70
|
-
|
|
85
|
+
this.renderHeader = () => {
|
|
71
86
|
const {
|
|
72
87
|
header
|
|
73
88
|
} = this.props;
|
|
74
89
|
return /*#__PURE__*/_jsx(PickerHeader, {}, void 0, header);
|
|
75
|
-
}
|
|
90
|
+
};
|
|
76
91
|
|
|
77
92
|
this.pickerListContainerRef = /*#__PURE__*/React.createRef();
|
|
78
93
|
this.pickerListRef = /*#__PURE__*/React.createRef();
|
|
@@ -117,9 +132,10 @@ class PickerPanel extends Component {
|
|
|
117
132
|
this.scrollHandler.unsubscribe();
|
|
118
133
|
}
|
|
119
134
|
|
|
120
|
-
static getDerivedStateFromProps(nextProps, {
|
|
121
|
-
|
|
122
|
-
|
|
135
|
+
static getDerivedStateFromProps(nextProps, _ref3) {
|
|
136
|
+
let {
|
|
137
|
+
prevProps
|
|
138
|
+
} = _ref3;
|
|
123
139
|
const {
|
|
124
140
|
selected,
|
|
125
141
|
valueProperty,
|
|
@@ -296,7 +312,7 @@ class PickerPanel extends Component {
|
|
|
296
312
|
innerRef: this.selectedOptionRef
|
|
297
313
|
}, void 0, _SelectedCircle || (_SelectedCircle = /*#__PURE__*/_jsx(SelectedCircle, {}))), /*#__PURE__*/_jsx(ArrowButtonContainer, {}, void 0, /*#__PURE__*/jsx(DSButton, _objectSpread(_objectSpread({}, arrowProps), {}, {
|
|
298
314
|
"aria-label": "Chevron Up",
|
|
299
|
-
"data-testid":
|
|
315
|
+
"data-testid": "".concat(type, "-chevron-up"),
|
|
300
316
|
disabled: activeIndex <= 0,
|
|
301
317
|
icon: _ChevronSmallUp || (_ChevronSmallUp = /*#__PURE__*/_jsx(ChevronSmallUp, {})),
|
|
302
318
|
onClick: this.handleStepMoveUp,
|
|
@@ -307,10 +323,10 @@ class PickerPanel extends Component {
|
|
|
307
323
|
height: this.listHeight
|
|
308
324
|
}
|
|
309
325
|
}, void 0, /*#__PURE__*/_jsx(PickerItemList, {
|
|
310
|
-
"data-testid":
|
|
326
|
+
"data-testid": "".concat(type, "-list"),
|
|
311
327
|
innerRef: this.pickerListRef,
|
|
312
328
|
style: {
|
|
313
|
-
transform:
|
|
329
|
+
transform: "translateY(".concat(listYPosition, "px)")
|
|
314
330
|
}
|
|
315
331
|
}, void 0, options.map((option, index) => {
|
|
316
332
|
const value = this.getOptionValue(option);
|
|
@@ -355,7 +371,7 @@ class PickerPanel extends Component {
|
|
|
355
371
|
}, value, label);
|
|
356
372
|
}))), /*#__PURE__*/_jsx(ArrowButtonContainer, {}, void 0, /*#__PURE__*/jsx(DSButton, _objectSpread(_objectSpread({}, arrowProps), {}, {
|
|
357
373
|
"aria-label": "Chevron Down",
|
|
358
|
-
"data-testid":
|
|
374
|
+
"data-testid": "".concat(type, "-chevron-down"),
|
|
359
375
|
disabled: activeIndex >= options.length - 1,
|
|
360
376
|
icon: _ChevronSmallDown || (_ChevronSmallDown = /*#__PURE__*/_jsx(ChevronSmallDown, {})),
|
|
361
377
|
onClick: this.handleStepMoveDown,
|
|
@@ -1,42 +1,45 @@
|
|
|
1
1
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
2
|
import 'react';
|
|
3
|
-
import RecentDocuments from '@elliemae/ds-icons
|
|
3
|
+
import { RecentDocuments } from '@elliemae/ds-icons';
|
|
4
4
|
import DSButton from '@elliemae/ds-button';
|
|
5
5
|
import DSPopper from '@elliemae/ds-popper';
|
|
6
6
|
|
|
7
7
|
var _RecentDocuments;
|
|
8
8
|
|
|
9
|
-
const TimePickerDropdown =
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
})
|
|
9
|
+
const TimePickerDropdown = _ref => {
|
|
10
|
+
let {
|
|
11
|
+
disabled = false,
|
|
12
|
+
onClick,
|
|
13
|
+
onOpen,
|
|
14
|
+
isOpen,
|
|
15
|
+
menu,
|
|
16
|
+
zIndex,
|
|
17
|
+
blockName,
|
|
18
|
+
placement
|
|
19
|
+
} = _ref;
|
|
20
|
+
return /*#__PURE__*/_jsx(DSPopper, {
|
|
21
|
+
blockName: blockName,
|
|
22
|
+
placement: placement,
|
|
23
|
+
contentComponent: menu,
|
|
24
|
+
isOpen: isOpen,
|
|
25
|
+
onOpen: onOpen,
|
|
26
|
+
modifiers: {
|
|
27
|
+
preventOverflow: {
|
|
28
|
+
enabled: true,
|
|
29
|
+
padding: 0,
|
|
30
|
+
boundariesElement: 'window'
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
showArrow: false,
|
|
34
|
+
triggerComponent: /*#__PURE__*/_jsx(DSButton, {
|
|
35
|
+
buttonType: "secondary",
|
|
36
|
+
disabled: disabled,
|
|
37
|
+
icon: _RecentDocuments || (_RecentDocuments = /*#__PURE__*/_jsx(RecentDocuments, {})),
|
|
38
|
+
iconSize: "s",
|
|
39
|
+
onClick: onClick
|
|
40
|
+
}),
|
|
41
|
+
zIndex: zIndex
|
|
42
|
+
});
|
|
43
|
+
};
|
|
41
44
|
|
|
42
45
|
export { TimePickerDropdown as default };
|
package/esm/TimePickerImpl.js
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
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 _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
3
8
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
9
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
4
10
|
import { useState, useRef, useEffect } from 'react';
|
|
5
11
|
import moment from 'moment';
|
|
6
12
|
import memoizeOne from 'memoize-one';
|
|
7
|
-
import { getVisibleTimeByFormat } from '@elliemae/ds-utilities
|
|
13
|
+
import { getVisibleTimeByFormat } from '@elliemae/ds-utilities';
|
|
8
14
|
import { aggregatedClasses, convertPropToCssClassName } from '@elliemae/ds-classnames';
|
|
9
|
-
import DSInputGroup from '@elliemae/ds-form
|
|
10
|
-
import { TimeInputImpl } from '@elliemae/ds-form/TimeInput';
|
|
11
|
-
import DSInput from '@elliemae/ds-form/Input';
|
|
15
|
+
import { DSInputGroup, DSInput, TimeInputImpl } from '@elliemae/ds-form';
|
|
12
16
|
import { TimePickerMenu } from './TimePickerMenu.js';
|
|
13
17
|
import TimePickerDropdown from './TimePickerDropdown.js';
|
|
14
18
|
import { convertTimeString } from './utils.js';
|
|
@@ -20,27 +24,31 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
20
24
|
|
|
21
25
|
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; }
|
|
22
26
|
const blockName = 'time-picker';
|
|
23
|
-
const TimePickerContainer = aggregatedClasses(DSInputGroup)(blockName, null,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
const TimePickerContainer = aggregatedClasses(DSInputGroup)(blockName, null, _ref => {
|
|
28
|
+
let {
|
|
29
|
+
isMenuOpened
|
|
30
|
+
} = _ref;
|
|
31
|
+
return {
|
|
32
|
+
isMenuOpened
|
|
33
|
+
};
|
|
34
|
+
});
|
|
28
35
|
|
|
29
|
-
const TimePickerImpl =
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
36
|
+
const TimePickerImpl = _ref2 => {
|
|
37
|
+
let {
|
|
38
|
+
value,
|
|
39
|
+
onChange,
|
|
40
|
+
onOpen,
|
|
41
|
+
format,
|
|
42
|
+
disabled,
|
|
43
|
+
hasHeader,
|
|
44
|
+
hasHeaderDisplay,
|
|
45
|
+
className,
|
|
46
|
+
containerProps,
|
|
47
|
+
placement,
|
|
48
|
+
zIndex,
|
|
49
|
+
disabledTimes,
|
|
50
|
+
minutesInterval
|
|
51
|
+
} = _ref2;
|
|
44
52
|
const [time, setTime] = useState();
|
|
45
53
|
const [isMenuOpened, setIsMenuOpened] = useState(false);
|
|
46
54
|
const [focusedColumn, setFocusedColumn] = useState(null);
|
|
@@ -105,7 +113,7 @@ const TimePickerImpl = ({
|
|
|
105
113
|
to: convertTimeString(disabledTimes.to)
|
|
106
114
|
};
|
|
107
115
|
return /*#__PURE__*/_jsx(TimePickerContainer, {
|
|
108
|
-
className:
|
|
116
|
+
className: "".concat(className, " variant-").concat(!disabled ? 'default' : 'disabled'),
|
|
109
117
|
containerProps: containerProps,
|
|
110
118
|
disabled: disabled,
|
|
111
119
|
rightAddon: /*#__PURE__*/_jsx(TimePickerDropdown, {
|
|
@@ -134,11 +142,11 @@ const TimePickerImpl = ({
|
|
|
134
142
|
})
|
|
135
143
|
})
|
|
136
144
|
}, void 0, /*#__PURE__*/_jsx(DSInput, {
|
|
137
|
-
customInputType:
|
|
145
|
+
customInputType: _ref3 => {
|
|
138
146
|
let {
|
|
139
147
|
onChange: handleChange
|
|
140
|
-
} =
|
|
141
|
-
restInputProps = _objectWithoutProperties(
|
|
148
|
+
} = _ref3,
|
|
149
|
+
restInputProps = _objectWithoutProperties(_ref3, _excluded);
|
|
142
150
|
|
|
143
151
|
return /*#__PURE__*/jsx(TimeInputImpl, _objectSpread({
|
|
144
152
|
clearable: true,
|
package/esm/TimePickerMenu.js
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
import
|
|
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';
|
|
2
6
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
7
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
8
|
+
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
9
|
+
import 'core-js/modules/esnext.iterator.map.js';
|
|
3
10
|
import { Component } from 'react';
|
|
4
|
-
import { range } from '@elliemae/ds-utilities/utils';
|
|
5
11
|
import { aggregatedClasses } from '@elliemae/ds-classnames';
|
|
6
12
|
import moment from 'moment';
|
|
7
|
-
import { addLeadingZeros } from '@elliemae/ds-utilities
|
|
13
|
+
import { range, addLeadingZeros } from '@elliemae/ds-utilities';
|
|
8
14
|
import { isAM } from './utils.js';
|
|
9
15
|
import PickerPanel from './PickerPanel.js';
|
|
10
16
|
|
|
@@ -25,12 +31,12 @@ class TimePickerMenu extends Component {
|
|
|
25
31
|
constructor(props) {
|
|
26
32
|
super(props);
|
|
27
33
|
|
|
28
|
-
|
|
34
|
+
this.renderHeader = () => {
|
|
29
35
|
const {
|
|
30
36
|
time
|
|
31
37
|
} = this.state;
|
|
32
38
|
return /*#__PURE__*/_jsx(TimePickerHeader, {}, void 0, time.format('hh:mma'));
|
|
33
|
-
}
|
|
39
|
+
};
|
|
34
40
|
|
|
35
41
|
this.state = {
|
|
36
42
|
time: moment(props.time || '', props.format) || moment()
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
function MoveElementOnScroll(element, {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
function MoveElementOnScroll(element, _ref) {
|
|
2
|
+
let {
|
|
3
|
+
container,
|
|
4
|
+
min = 0,
|
|
5
|
+
max = element.offsetHeight,
|
|
6
|
+
speed = 1,
|
|
7
|
+
smooth = 2,
|
|
8
|
+
onUpdate = () => null,
|
|
9
|
+
onEndScroll = () => null
|
|
10
|
+
} = _ref;
|
|
10
11
|
let moving = false;
|
|
11
12
|
let pos = min;
|
|
12
13
|
let lastPos = pos; // todo: move this to utils if we finally need it
|
package/esm/utils.js
CHANGED
|
@@ -3,7 +3,8 @@ const validateIndex = (index, options) => {
|
|
|
3
3
|
if (index >= options.length) return options.length - 1;
|
|
4
4
|
return index;
|
|
5
5
|
};
|
|
6
|
-
const getOptionIndex = (options, selectedOption
|
|
6
|
+
const getOptionIndex = function (options, selectedOption) {
|
|
7
|
+
let valueProperty = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'value';
|
|
7
8
|
const index = options.findIndex(option => option[valueProperty] === selectedOption);
|
|
8
9
|
return validateIndex(index, options);
|
|
9
10
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-time-picker",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.14",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Time Picker",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -64,25 +64,25 @@
|
|
|
64
64
|
"build": "node ../../scripts/build/build.js"
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@elliemae/ds-button": "2.0.0-alpha.
|
|
68
|
-
"@elliemae/ds-classnames": "2.0.0-alpha.
|
|
69
|
-
"@elliemae/ds-form": "2.0.0-alpha.
|
|
70
|
-
"@elliemae/ds-icons": "2.0.0-alpha.
|
|
71
|
-
"@elliemae/ds-popper": "2.0.0-alpha.
|
|
72
|
-
"@elliemae/ds-utilities": "2.0.0-alpha.
|
|
67
|
+
"@elliemae/ds-button": "2.0.0-alpha.14",
|
|
68
|
+
"@elliemae/ds-classnames": "2.0.0-alpha.14",
|
|
69
|
+
"@elliemae/ds-form": "2.0.0-alpha.14",
|
|
70
|
+
"@elliemae/ds-icons": "2.0.0-alpha.14",
|
|
71
|
+
"@elliemae/ds-popper": "2.0.0-alpha.14",
|
|
72
|
+
"@elliemae/ds-utilities": "2.0.0-alpha.14",
|
|
73
73
|
"memoize-one": "~5.1.1",
|
|
74
74
|
"moment": "~2.29.1",
|
|
75
75
|
"prop-types": "~15.7.2",
|
|
76
76
|
"react-desc": "~4.1.3"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
|
-
"styled-components": "~5.3.
|
|
79
|
+
"styled-components": "~5.3.3"
|
|
80
80
|
},
|
|
81
81
|
"peerDependencies": {
|
|
82
82
|
"lodash": "^4.17.21",
|
|
83
83
|
"react": "^17.0.2",
|
|
84
84
|
"react-dom": "^17.0.2",
|
|
85
|
-
"styled-components": "^5.3.
|
|
85
|
+
"styled-components": "^5.3.3"
|
|
86
86
|
},
|
|
87
87
|
"publishConfig": {
|
|
88
88
|
"access": "public",
|