@elliemae/ds-time-picker 2.2.0-alpha.3 → 2.2.0-next.2
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 +115 -100
- package/cjs/DSTimePickerMenu.js +33 -46
- package/cjs/PickerPanel.js +254 -151
- package/cjs/TimePickerDropdown.js +52 -73
- package/cjs/TimePickerImpl.js +138 -146
- package/cjs/TimePickerMenu.js +209 -138
- package/cjs/index.js +17 -40
- package/cjs/moveElementOnScroll.js +39 -57
- package/cjs/utils.js +24 -57
- package/esm/DSTimePicker.js +105 -71
- package/esm/DSTimePickerMenu.js +22 -17
- package/esm/PickerPanel.js +242 -120
- package/esm/TimePickerDropdown.js +44 -44
- package/esm/TimePickerImpl.js +117 -106
- package/esm/TimePickerMenu.js +191 -102
- package/esm/index.js +4 -11
- package/esm/moveElementOnScroll.js +34 -28
- package/esm/utils.js +17 -28
- package/package.json +7 -7
- package/types/PickerPanel.d.ts +0 -1
- package/types/TimePickerDropdown.d.ts +0 -1
- package/types/TimePickerImpl.d.ts +0 -1
- package/cjs/DSTimePicker.js.map +0 -7
- package/cjs/DSTimePickerMenu.js.map +0 -7
- package/cjs/PickerPanel.js.map +0 -7
- package/cjs/TimePickerDropdown.js.map +0 -7
- package/cjs/TimePickerImpl.js.map +0 -7
- package/cjs/TimePickerMenu.js.map +0 -7
- package/cjs/index.js.map +0 -7
- package/cjs/moveElementOnScroll.js.map +0 -7
- package/cjs/utils.js.map +0 -7
- package/esm/DSTimePicker.js.map +0 -7
- package/esm/DSTimePickerMenu.js.map +0 -7
- package/esm/PickerPanel.js.map +0 -7
- package/esm/TimePickerDropdown.js.map +0 -7
- package/esm/TimePickerImpl.js.map +0 -7
- package/esm/TimePickerMenu.js.map +0 -7
- package/esm/index.js.map +0 -7
- package/esm/moveElementOnScroll.js.map +0 -7
- package/esm/utils.js.map +0 -7
package/esm/PickerPanel.js
CHANGED
|
@@ -1,61 +1,109 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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';
|
|
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';
|
|
13
|
+
import React, { Component } from 'react';
|
|
14
|
+
import { findIndex } from 'lodash';
|
|
15
|
+
import { aggregatedClasses } from '@elliemae/ds-classnames';
|
|
16
|
+
import memoizeOne from 'memoize-one';
|
|
17
|
+
import { ChevronSmallUp, ChevronSmallDown } from '@elliemae/ds-icons';
|
|
18
|
+
import DSButton from '@elliemae/ds-button';
|
|
19
|
+
import { MoveElementOnScroll } from './moveElementOnScroll.js';
|
|
20
|
+
import { validateIndex } from './utils.js';
|
|
21
|
+
import { jsx } from 'react/jsx-runtime';
|
|
22
|
+
|
|
23
|
+
var _SelectedCircle, _ChevronSmallUp, _ChevronSmallDown;
|
|
24
|
+
|
|
25
|
+
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; }
|
|
26
|
+
|
|
27
|
+
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; }
|
|
28
|
+
const blockName = 'time-picker-panel';
|
|
29
|
+
const Container = aggregatedClasses('div')(blockName, null, _ref => {
|
|
30
|
+
let {
|
|
31
|
+
scrolling
|
|
32
|
+
} = _ref;
|
|
33
|
+
return {
|
|
34
|
+
scrolling
|
|
35
|
+
};
|
|
36
|
+
});
|
|
37
|
+
const Wrapper = aggregatedClasses('div')(blockName, 'wrapper');
|
|
38
|
+
const PickerItemListContainer = aggregatedClasses('div')(blockName, 'item-list-container');
|
|
39
|
+
const PickerItemList = aggregatedClasses('div')(blockName, 'item-list');
|
|
40
|
+
const PickerHeader = aggregatedClasses('div')(blockName, 'header');
|
|
41
|
+
const PickerItemContainer = aggregatedClasses('div')(blockName, 'item', _ref2 => {
|
|
42
|
+
let {
|
|
43
|
+
selected,
|
|
44
|
+
disabled
|
|
45
|
+
} = _ref2;
|
|
46
|
+
return {
|
|
47
|
+
selected,
|
|
48
|
+
disabled
|
|
49
|
+
};
|
|
50
|
+
});
|
|
51
|
+
const PickerSelectedOptionSelected = aggregatedClasses('div')(blockName, 'selected-container');
|
|
52
|
+
const SelectedCircle = aggregatedClasses('div')(blockName, 'selected-circle');
|
|
53
|
+
const ArrowButtonContainer = aggregatedClasses('div')(blockName, 'arrow-container');
|
|
54
|
+
|
|
55
|
+
const getOptionIndex = function (options, selectedOption) {
|
|
56
|
+
let valueProperty = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'value';
|
|
57
|
+
const index = options.findIndex(option => option[valueProperty] === selectedOption);
|
|
25
58
|
return validateIndex(index, options);
|
|
26
59
|
};
|
|
60
|
+
|
|
27
61
|
const arrowProps = {
|
|
28
|
-
buttonType:
|
|
62
|
+
buttonType: 'text',
|
|
29
63
|
fluidHeight: true,
|
|
30
64
|
fluidWidth: true,
|
|
31
|
-
size:
|
|
65
|
+
size: 's'
|
|
32
66
|
};
|
|
33
67
|
class PickerPanel extends Component {
|
|
34
68
|
constructor(props) {
|
|
35
69
|
super(props);
|
|
36
|
-
this.computeContainerTranslation = memoizeOne(
|
|
37
|
-
const {
|
|
38
|
-
|
|
70
|
+
this.computeContainerTranslation = memoizeOne(index => {
|
|
71
|
+
const {
|
|
72
|
+
options,
|
|
73
|
+
valueProperty
|
|
74
|
+
} = this.props;
|
|
75
|
+
const {
|
|
76
|
+
selectedOption,
|
|
77
|
+
scrolling
|
|
78
|
+
} = this.state;
|
|
39
79
|
const selectedOptionIndex = index || getOptionIndex(options, selectedOption, valueProperty);
|
|
40
80
|
const listYPosition = this.minYListPosition - selectedOptionIndex * this.optionHeight;
|
|
41
|
-
if (this.scrollHandler && !scrolling)
|
|
42
|
-
this.scrollHandler.updatePosition(listYPosition);
|
|
81
|
+
if (this.scrollHandler && !scrolling) this.scrollHandler.updatePosition(listYPosition);
|
|
43
82
|
return listYPosition;
|
|
44
83
|
});
|
|
84
|
+
|
|
45
85
|
this.renderHeader = () => {
|
|
46
|
-
const {
|
|
47
|
-
|
|
86
|
+
const {
|
|
87
|
+
header
|
|
88
|
+
} = this.props;
|
|
89
|
+
return /*#__PURE__*/_jsx(PickerHeader, {}, void 0, header);
|
|
48
90
|
};
|
|
49
|
-
|
|
50
|
-
this.
|
|
51
|
-
this.
|
|
52
|
-
this.
|
|
91
|
+
|
|
92
|
+
this.pickerListContainerRef = /*#__PURE__*/React.createRef();
|
|
93
|
+
this.pickerListRef = /*#__PURE__*/React.createRef();
|
|
94
|
+
this.pickerItemRef = /*#__PURE__*/React.createRef();
|
|
95
|
+
this.selectedOptionRef = /*#__PURE__*/React.createRef();
|
|
53
96
|
this.state = {
|
|
54
97
|
selectedOption: props.selected,
|
|
55
98
|
activeIndex: 0,
|
|
99
|
+
// eslint-disable-next-line react/no-unused-state
|
|
56
100
|
prevProps: {}
|
|
57
101
|
};
|
|
102
|
+
this.handleKeyDown = this.handleKeyDown.bind(this);
|
|
103
|
+
this.handleStepMoveUp = this.handleStepMoveUp.bind(this);
|
|
104
|
+
this.handleStepMoveDown = this.handleStepMoveDown.bind(this);
|
|
58
105
|
}
|
|
106
|
+
|
|
59
107
|
componentDidMount() {
|
|
60
108
|
this.computeSizes();
|
|
61
109
|
const pickerListContainerEl = this.pickerListContainerRef.current;
|
|
@@ -65,21 +113,35 @@ class PickerPanel extends Component {
|
|
|
65
113
|
min: -this.minYListPosition,
|
|
66
114
|
max: this.maxYListPosition,
|
|
67
115
|
onUpdate: (pos, delta) => {
|
|
68
|
-
const {
|
|
116
|
+
const {
|
|
117
|
+
options
|
|
118
|
+
} = this.props;
|
|
69
119
|
const index = options.length - -Math.floor((pos - this.maxYListPosition) / this.optionHeight) + (delta > 0 ? 1 : -1);
|
|
70
120
|
this.moveTo(index, true);
|
|
71
121
|
},
|
|
72
122
|
onEndScroll: () => {
|
|
73
|
-
this.setState({
|
|
123
|
+
this.setState({
|
|
124
|
+
scrolling: false
|
|
125
|
+
});
|
|
74
126
|
}
|
|
75
127
|
});
|
|
76
128
|
this.computeContainerTranslation();
|
|
77
129
|
}
|
|
130
|
+
|
|
78
131
|
componentWillUnmount() {
|
|
79
132
|
this.scrollHandler.unsubscribe();
|
|
80
133
|
}
|
|
81
|
-
|
|
82
|
-
|
|
134
|
+
|
|
135
|
+
static getDerivedStateFromProps(nextProps, _ref3) {
|
|
136
|
+
let {
|
|
137
|
+
prevProps
|
|
138
|
+
} = _ref3;
|
|
139
|
+
const {
|
|
140
|
+
selected,
|
|
141
|
+
valueProperty,
|
|
142
|
+
options
|
|
143
|
+
} = nextProps;
|
|
144
|
+
|
|
83
145
|
if (selected !== prevProps.selected) {
|
|
84
146
|
return {
|
|
85
147
|
selectedOption: selected,
|
|
@@ -87,184 +149,244 @@ class PickerPanel extends Component {
|
|
|
87
149
|
prevProps: nextProps
|
|
88
150
|
};
|
|
89
151
|
}
|
|
152
|
+
|
|
90
153
|
return null;
|
|
91
154
|
}
|
|
155
|
+
|
|
92
156
|
getOptionValue(option) {
|
|
93
|
-
const {
|
|
157
|
+
const {
|
|
158
|
+
valueProperty
|
|
159
|
+
} = this.props;
|
|
94
160
|
return option[valueProperty];
|
|
95
161
|
}
|
|
162
|
+
|
|
96
163
|
getOptionLabel(option) {
|
|
97
|
-
const {
|
|
164
|
+
const {
|
|
165
|
+
labelProperty
|
|
166
|
+
} = this.props;
|
|
98
167
|
return option[labelProperty];
|
|
99
168
|
}
|
|
169
|
+
|
|
100
170
|
computeSizes() {
|
|
101
|
-
const {
|
|
102
|
-
|
|
171
|
+
const {
|
|
172
|
+
options,
|
|
173
|
+
numberItemsOnScreen
|
|
174
|
+
} = this.props;
|
|
175
|
+
const {
|
|
176
|
+
offsetHeight: optionHeight
|
|
177
|
+
} = this.pickerItemRef.current;
|
|
103
178
|
this.optionHeight = optionHeight;
|
|
104
179
|
this.listHeight = this.optionHeight * numberItemsOnScreen;
|
|
105
180
|
this.minYListPosition = this.listHeight / 2 - this.optionHeight / 2;
|
|
106
181
|
this.maxYListPosition = this.optionHeight * (options.length - Math.ceil(numberItemsOnScreen / 2));
|
|
107
182
|
}
|
|
183
|
+
|
|
108
184
|
handleOptionSelect(optionValue, index, scrolling) {
|
|
109
|
-
const {
|
|
110
|
-
|
|
111
|
-
|
|
185
|
+
const {
|
|
186
|
+
onChange
|
|
187
|
+
} = this.props;
|
|
188
|
+
this.setState(state => _objectSpread(_objectSpread({}, state), {}, {
|
|
112
189
|
scrolling,
|
|
113
190
|
selectedOption: optionValue,
|
|
114
191
|
activeIndex: index
|
|
115
192
|
}), () => {
|
|
116
193
|
onChange(optionValue, index);
|
|
117
194
|
});
|
|
118
|
-
}
|
|
195
|
+
} // TODO: this needs a refactor from de FocusGroup
|
|
196
|
+
// eslint-disable-next-line max-statements
|
|
197
|
+
|
|
198
|
+
|
|
119
199
|
handleKeyDown(e) {
|
|
120
|
-
const {
|
|
121
|
-
|
|
122
|
-
|
|
200
|
+
const {
|
|
201
|
+
activeIndex
|
|
202
|
+
} = this.state;
|
|
203
|
+
const {
|
|
204
|
+
options
|
|
205
|
+
} = this.props;
|
|
206
|
+
const [firstColumn, ...restColumns] = document.getElementsByClassName('em-ds-time-picker-panel');
|
|
123
207
|
const [lastColumn] = restColumns.slice(-1);
|
|
124
|
-
const [prev] = document.getElementsByClassName(
|
|
208
|
+
const [prev] = document.getElementsByClassName('DayPickerNavigation_button');
|
|
125
209
|
const focusedElement = document.activeElement;
|
|
210
|
+
|
|
126
211
|
switch (e.key) {
|
|
127
|
-
case
|
|
212
|
+
case 'Home':
|
|
128
213
|
this.moveTo(0);
|
|
129
214
|
break;
|
|
130
|
-
|
|
215
|
+
|
|
216
|
+
case 'End':
|
|
131
217
|
this.moveTo(options.length - 1);
|
|
132
218
|
break;
|
|
133
|
-
|
|
219
|
+
|
|
220
|
+
case 'ArrowUp':
|
|
134
221
|
this.moveTo(activeIndex - 1);
|
|
135
222
|
break;
|
|
136
|
-
|
|
223
|
+
|
|
224
|
+
case 'ArrowDown':
|
|
137
225
|
this.moveTo(activeIndex + 1);
|
|
138
226
|
break;
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
227
|
+
|
|
228
|
+
case 'Tab':
|
|
229
|
+
{
|
|
230
|
+
e.preventDefault(); // If it is DateTimePicker, move focus to prev arrow element
|
|
231
|
+
|
|
232
|
+
if (prev && focusedElement === lastColumn) {
|
|
233
|
+
prev.focus();
|
|
234
|
+
} else if (focusedElement === lastColumn) {
|
|
235
|
+
firstColumn.focus();
|
|
236
|
+
} else {
|
|
237
|
+
const position = findIndex(restColumns, focusedElement);
|
|
238
|
+
restColumns[position + 1].focus();
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
break;
|
|
148
242
|
}
|
|
149
|
-
break;
|
|
150
|
-
}
|
|
151
|
-
default:
|
|
152
|
-
break;
|
|
153
243
|
}
|
|
154
244
|
}
|
|
245
|
+
|
|
155
246
|
moveTo(index, scrolling) {
|
|
156
|
-
const {
|
|
157
|
-
|
|
247
|
+
const {
|
|
248
|
+
options
|
|
249
|
+
} = this.props;
|
|
250
|
+
const {
|
|
251
|
+
selectedOption
|
|
252
|
+
} = this.state;
|
|
158
253
|
const validIndex = validateIndex(index, options);
|
|
159
254
|
const option = options[validIndex];
|
|
160
255
|
const optionValue = this.getOptionValue(option);
|
|
256
|
+
|
|
161
257
|
if (selectedOption !== optionValue && option.disabled !== true) {
|
|
162
258
|
this.handleOptionSelect(optionValue, validIndex, scrolling);
|
|
163
|
-
}
|
|
259
|
+
} // TO-DO: if date disabled, add nextValidOption selection
|
|
260
|
+
|
|
164
261
|
}
|
|
262
|
+
|
|
165
263
|
handleStepMoveUp() {
|
|
166
|
-
const {
|
|
167
|
-
|
|
264
|
+
const {
|
|
265
|
+
activeIndex
|
|
266
|
+
} = this.state;
|
|
267
|
+
const {
|
|
268
|
+
arrowStep,
|
|
269
|
+
options
|
|
270
|
+
} = this.props;
|
|
168
271
|
const supposedPos = activeIndex - arrowStep;
|
|
169
272
|
const nextPos = supposedPos >= 0 ? supposedPos : activeIndex - 1;
|
|
170
|
-
const nextValidOption = options.find(
|
|
273
|
+
const nextValidOption = options.find(op => !op.disabled);
|
|
171
274
|
this.moveTo(nextPos, true, nextValidOption);
|
|
172
275
|
}
|
|
276
|
+
|
|
173
277
|
handleStepMoveDown() {
|
|
174
|
-
const {
|
|
175
|
-
|
|
278
|
+
const {
|
|
279
|
+
activeIndex
|
|
280
|
+
} = this.state;
|
|
281
|
+
const {
|
|
282
|
+
arrowStep,
|
|
283
|
+
options
|
|
284
|
+
} = this.props;
|
|
176
285
|
const supposedPos = activeIndex + arrowStep;
|
|
177
286
|
const nextPos = supposedPos <= options.length ? supposedPos : activeIndex + 1;
|
|
178
287
|
this.moveTo(nextPos);
|
|
179
288
|
}
|
|
289
|
+
|
|
180
290
|
render() {
|
|
181
|
-
const {
|
|
182
|
-
|
|
291
|
+
const {
|
|
292
|
+
options,
|
|
293
|
+
hasHeader,
|
|
294
|
+
type,
|
|
295
|
+
time,
|
|
296
|
+
meridiem,
|
|
297
|
+
disabledTimes
|
|
298
|
+
} = this.props;
|
|
299
|
+
const {
|
|
300
|
+
selectedOption,
|
|
301
|
+
activeIndex,
|
|
302
|
+
scrolling
|
|
303
|
+
} = this.state;
|
|
183
304
|
const listYPosition = this.computeContainerTranslation(activeIndex);
|
|
184
|
-
return
|
|
185
|
-
classProps: {
|
|
305
|
+
return /*#__PURE__*/_jsx(Wrapper, {}, void 0, hasHeader && this.renderHeader(), /*#__PURE__*/_jsx(Container, {
|
|
306
|
+
classProps: {
|
|
307
|
+
scrolling
|
|
308
|
+
},
|
|
186
309
|
onKeyDown: this.handleKeyDown,
|
|
187
310
|
tabIndex: 0
|
|
188
|
-
},
|
|
311
|
+
}, void 0, /*#__PURE__*/_jsx(PickerSelectedOptionSelected, {
|
|
189
312
|
innerRef: this.selectedOptionRef
|
|
190
|
-
},
|
|
191
|
-
...arrowProps,
|
|
313
|
+
}, void 0, _SelectedCircle || (_SelectedCircle = /*#__PURE__*/_jsx(SelectedCircle, {}))), /*#__PURE__*/_jsx(ArrowButtonContainer, {}, void 0, /*#__PURE__*/jsx(DSButton, _objectSpread(_objectSpread({}, arrowProps), {}, {
|
|
192
314
|
"aria-label": "Chevron Up",
|
|
193
|
-
"data-testid":
|
|
315
|
+
"data-testid": "".concat(type, "-chevron-up"),
|
|
194
316
|
disabled: activeIndex <= 0,
|
|
195
|
-
icon:
|
|
317
|
+
icon: _ChevronSmallUp || (_ChevronSmallUp = /*#__PURE__*/_jsx(ChevronSmallUp, {})),
|
|
196
318
|
onClick: this.handleStepMoveUp,
|
|
197
319
|
tabIndex: -1
|
|
198
|
-
})),
|
|
320
|
+
}))), /*#__PURE__*/_jsx(PickerItemListContainer, {
|
|
199
321
|
innerRef: this.pickerListContainerRef,
|
|
200
322
|
style: {
|
|
201
323
|
height: this.listHeight
|
|
202
324
|
}
|
|
203
|
-
},
|
|
204
|
-
"data-testid":
|
|
325
|
+
}, void 0, /*#__PURE__*/_jsx(PickerItemList, {
|
|
326
|
+
"data-testid": "".concat(type, "-list"),
|
|
205
327
|
innerRef: this.pickerListRef,
|
|
206
328
|
style: {
|
|
207
|
-
transform:
|
|
329
|
+
transform: "translateY(".concat(listYPosition, "px)")
|
|
208
330
|
}
|
|
209
|
-
}, options.map((option, index) => {
|
|
331
|
+
}, void 0, options.map((option, index) => {
|
|
210
332
|
const value = this.getOptionValue(option);
|
|
211
333
|
const label = this.getOptionLabel(option);
|
|
212
334
|
let valueFormatted;
|
|
213
|
-
if (meridiem ===
|
|
214
|
-
valueFormatted = value;
|
|
215
|
-
else if (meridiem === "PM" && value === 12)
|
|
216
|
-
valueFormatted = value;
|
|
217
|
-
else if (meridiem === "PM")
|
|
218
|
-
valueFormatted = value + 12;
|
|
335
|
+
if (meridiem === 'AM') valueFormatted = value;else if (meridiem === 'PM' && value === 12) valueFormatted = value;else if (meridiem === 'PM') valueFormatted = value + 12;
|
|
219
336
|
let disabled = false;
|
|
337
|
+
|
|
220
338
|
if (disabledTimes) {
|
|
221
|
-
const {
|
|
222
|
-
|
|
339
|
+
const {
|
|
340
|
+
from,
|
|
341
|
+
to
|
|
342
|
+
} = disabledTimes;
|
|
343
|
+
|
|
344
|
+
if (type === 'hour' && valueFormatted >= (from === null || from === void 0 ? void 0 : from.hour) && valueFormatted < (to === null || to === void 0 ? void 0 : to.hour) || type === 'minutes' && value >= (from === null || from === void 0 ? void 0 : from.min) && value < (to === null || to === void 0 ? void 0 : to.min)) {
|
|
223
345
|
disabled = true;
|
|
224
346
|
}
|
|
225
|
-
|
|
347
|
+
|
|
348
|
+
if (type === 'minutes' && ((time === null || time === void 0 ? void 0 : time.hour()) > (to === null || to === void 0 ? void 0 : to.hour) || (time === null || time === void 0 ? void 0 : time.hour()) < (from === null || from === void 0 ? void 0 : from.hour))) {
|
|
226
349
|
disabled = false;
|
|
227
350
|
}
|
|
228
|
-
|
|
351
|
+
|
|
352
|
+
if (label === 'am' && (from === null || from === void 0 ? void 0 : from.hour) == 0 && (to === null || to === void 0 ? void 0 : to.hour) >= 12) {
|
|
229
353
|
disabled = true;
|
|
230
354
|
}
|
|
231
|
-
|
|
355
|
+
|
|
356
|
+
if (label === 'pm' && (to === null || to === void 0 ? void 0 : to.hour) == 24) {
|
|
232
357
|
disabled = true;
|
|
233
358
|
}
|
|
234
359
|
}
|
|
360
|
+
|
|
235
361
|
option.disabled = disabled;
|
|
236
|
-
return
|
|
237
|
-
key: value,
|
|
362
|
+
return /*#__PURE__*/_jsx(PickerItemContainer, {
|
|
238
363
|
classProps: {
|
|
239
364
|
selected: selectedOption ? value === selectedOption : index === 0,
|
|
240
365
|
disabled
|
|
241
366
|
},
|
|
242
367
|
innerRef: this.pickerItemRef,
|
|
243
368
|
onClick: () => {
|
|
244
|
-
if (!disabled)
|
|
245
|
-
this.handleOptionSelect(value, index);
|
|
369
|
+
if (!disabled) this.handleOptionSelect(value, index);
|
|
246
370
|
}
|
|
247
|
-
}, label);
|
|
248
|
-
}))),
|
|
249
|
-
...arrowProps,
|
|
371
|
+
}, value, label);
|
|
372
|
+
}))), /*#__PURE__*/_jsx(ArrowButtonContainer, {}, void 0, /*#__PURE__*/jsx(DSButton, _objectSpread(_objectSpread({}, arrowProps), {}, {
|
|
250
373
|
"aria-label": "Chevron Down",
|
|
251
|
-
"data-testid":
|
|
374
|
+
"data-testid": "".concat(type, "-chevron-down"),
|
|
252
375
|
disabled: activeIndex >= options.length - 1,
|
|
253
|
-
icon:
|
|
376
|
+
icon: _ChevronSmallDown || (_ChevronSmallDown = /*#__PURE__*/_jsx(ChevronSmallDown, {})),
|
|
254
377
|
onClick: this.handleStepMoveDown,
|
|
255
378
|
tabIndex: -1
|
|
256
|
-
}))));
|
|
379
|
+
})))));
|
|
257
380
|
}
|
|
381
|
+
|
|
258
382
|
}
|
|
259
383
|
PickerPanel.defaultProps = {
|
|
260
|
-
valueProperty:
|
|
261
|
-
labelProperty:
|
|
384
|
+
valueProperty: 'value',
|
|
385
|
+
labelProperty: 'label',
|
|
262
386
|
numberItemsOnScreen: 5,
|
|
387
|
+
// this number should be impair
|
|
263
388
|
options: [],
|
|
264
389
|
arrowStep: 1
|
|
265
390
|
};
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
PickerPanel as default
|
|
269
|
-
};
|
|
270
|
-
//# sourceMappingURL=PickerPanel.js.map
|
|
391
|
+
|
|
392
|
+
export { PickerPanel as default };
|
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
|
|
1
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import 'react';
|
|
3
|
+
import { RecentDocuments } from '@elliemae/ds-icons';
|
|
4
|
+
import DSButton from '@elliemae/ds-button';
|
|
5
|
+
import DSPopper from '@elliemae/ds-popper';
|
|
6
|
+
|
|
7
|
+
var _RecentDocuments;
|
|
8
|
+
|
|
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
|
+
});
|
|
39
43
|
};
|
|
40
|
-
|
|
41
|
-
export {
|
|
42
|
-
TimePickerDropdown,
|
|
43
|
-
TimePickerDropdown_default as default
|
|
44
|
-
};
|
|
45
|
-
//# sourceMappingURL=TimePickerDropdown.js.map
|
|
44
|
+
|
|
45
|
+
export { TimePickerDropdown as default };
|