@elliemae/ds-time-picker 2.3.1 → 3.0.0-alpha.3

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 (64) hide show
  1. package/dist/cjs/DSTimePicker.js +106 -0
  2. package/dist/cjs/DSTimePicker.js.map +7 -0
  3. package/dist/cjs/DSTimePickerMenu.js +60 -0
  4. package/dist/cjs/DSTimePickerMenu.js.map +7 -0
  5. package/dist/cjs/PickerPanel.js +313 -0
  6. package/dist/cjs/PickerPanel.js.map +7 -0
  7. package/dist/cjs/TimePickerDropdown.js +74 -0
  8. package/dist/cjs/TimePickerDropdown.js.map +7 -0
  9. package/dist/cjs/TimePickerImpl.js +210 -0
  10. package/dist/cjs/TimePickerImpl.js.map +7 -0
  11. package/dist/cjs/TimePickerMenu.js +258 -0
  12. package/dist/cjs/TimePickerMenu.js.map +7 -0
  13. package/dist/cjs/index.js +40 -0
  14. package/dist/cjs/index.js.map +7 -0
  15. package/dist/cjs/moveElementOnScroll.js +93 -0
  16. package/dist/cjs/moveElementOnScroll.js.map +7 -0
  17. package/dist/cjs/utils.js +71 -0
  18. package/dist/cjs/utils.js.map +7 -0
  19. package/dist/esm/DSTimePicker.js +77 -0
  20. package/dist/esm/DSTimePicker.js.map +7 -0
  21. package/dist/esm/DSTimePickerMenu.js +33 -0
  22. package/dist/esm/DSTimePickerMenu.js.map +7 -0
  23. package/dist/esm/PickerPanel.js +286 -0
  24. package/dist/esm/PickerPanel.js.map +7 -0
  25. package/dist/esm/TimePickerDropdown.js +45 -0
  26. package/dist/esm/TimePickerDropdown.js.map +7 -0
  27. package/dist/esm/TimePickerImpl.js +183 -0
  28. package/dist/esm/TimePickerImpl.js.map +7 -0
  29. package/dist/esm/TimePickerMenu.js +231 -0
  30. package/dist/esm/TimePickerMenu.js.map +7 -0
  31. package/dist/esm/index.js +11 -0
  32. package/dist/esm/index.js.map +7 -0
  33. package/dist/esm/moveElementOnScroll.js +64 -0
  34. package/dist/esm/moveElementOnScroll.js.map +7 -0
  35. package/dist/esm/utils.js +42 -0
  36. package/dist/esm/utils.js.map +7 -0
  37. package/package.json +46 -37
  38. package/cjs/DSTimePicker.js +0 -121
  39. package/cjs/DSTimePickerMenu.js +0 -35
  40. package/cjs/PickerPanel.js +0 -402
  41. package/cjs/TimePickerDropdown.js +0 -53
  42. package/cjs/TimePickerImpl.js +0 -175
  43. package/cjs/TimePickerMenu.js +0 -312
  44. package/cjs/index.js +0 -17
  45. package/cjs/moveElementOnScroll.js +0 -75
  46. package/cjs/utils.js +0 -38
  47. package/esm/DSTimePicker.js +0 -111
  48. package/esm/DSTimePickerMenu.js +0 -24
  49. package/esm/PickerPanel.js +0 -392
  50. package/esm/TimePickerDropdown.js +0 -45
  51. package/esm/TimePickerImpl.js +0 -165
  52. package/esm/TimePickerMenu.js +0 -301
  53. package/esm/index.js +0 -4
  54. package/esm/moveElementOnScroll.js +0 -70
  55. package/esm/utils.js +0 -31
  56. package/types/DSTimePicker.d.ts +0 -162
  57. package/types/DSTimePickerMenu.d.ts +0 -4
  58. package/types/PickerPanel.d.ts +0 -24
  59. package/types/TimePickerDropdown.d.ts +0 -25
  60. package/types/TimePickerImpl.d.ts +0 -35
  61. package/types/TimePickerMenu.d.ts +0 -19
  62. package/types/index.d.ts +0 -5
  63. package/types/moveElementOnScroll.d.ts +0 -13
  64. package/types/utils.d.ts +0 -8
@@ -1,111 +0,0 @@
1
- import 'react';
2
- import { PropTypes, describe } from 'react-desc';
3
- import moment from 'moment';
4
- import TimePickerImpl from './TimePickerImpl.js';
5
- import { jsx } from 'react/jsx-runtime';
6
-
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
- };
49
-
50
- DSTimePicker.defaultProps = {
51
- format: 'hh:mm:ss A'
52
- };
53
- const props = {
54
- /** a11y label */
55
- 'aria-label': PropTypes.string.description('a11y label'),
56
-
57
- /** inject props to time picker wrapper */
58
- containerProps: PropTypes.object.description('inject props to time picker wrapper'),
59
-
60
- /** Whether the time picker is disabled or not */
61
- disabled: PropTypes.bool.description('Whether the time picker is disabled or not'),
62
-
63
- /** Time picker value */
64
- value: PropTypes.instanceOf(moment).description('Time picker value'),
65
-
66
- /** Time format (hh:mm:ss, H:m:s) */
67
- format: PropTypes.string.description('Time format (hh:mm:ss, H:m:s)'),
68
-
69
- /** toggle header style */
70
- hasHeader: PropTypes.bool.description('toggle header style'),
71
-
72
- /** toggle header display */
73
- hasHeaderDisplay: PropTypes.bool.description('toggle header display'),
74
-
75
- /** Handler when time picker value changes */
76
- onChange: PropTypes.func.description('Handler when time picker value changes'),
77
-
78
- /** Handler when the time picker menu opens */
79
- onOpen: PropTypes.func.description('Handler when the time picker menu opens'),
80
-
81
- /** Whether the time picker menu is opened or not */
82
- isOpen: PropTypes.bool.description('Whether the time picker menu is opened or not'),
83
-
84
- /** ref for time picker input */
85
- innerRef: PropTypes.func.description('ref for time picker input'),
86
-
87
- /** Enable to clear the time picker value */
88
- clearable: PropTypes.bool.description('Enable to clear the time picker value'),
89
-
90
- /** class for time picker */
91
- className: PropTypes.string.description('class for time picker'),
92
-
93
- /** style object */
94
- style: PropTypes.object.description('style object'),
95
-
96
- /** z index for menu */
97
- zIndex: PropTypes.number.description('z index for menu'),
98
-
99
- /** DSPopper placement */
100
- placement: PropTypes.string.description('DSPopper placement'),
101
-
102
- /** disabled time */
103
- disabledTimes: PropTypes.object.description('disabled time'),
104
-
105
- /** steps for the picker */
106
- minutesInterval: PropTypes.number.description('steps for the picker')
107
- };
108
- const DSTimePickerWithSchema = describe(DSTimePicker);
109
- DSTimePickerWithSchema.propTypes = props;
110
-
111
- export { DSTimePicker, DSTimePickerWithSchema, DSTimePicker as default };
@@ -1,24 +0,0 @@
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 _jsx from '@babel/runtime/helpers/esm/jsx';
7
- import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
8
- import 'react';
9
- import styled from 'styled-components';
10
- import { TimePickerMenu } from './TimePickerMenu.js';
11
- import { jsx } from 'react/jsx-runtime';
12
-
13
- 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; }
14
-
15
- 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; }
16
- const DSTimePickerMenuWrapper = /*#__PURE__*/styled.div.withConfig({
17
- componentId: "sc-1lnruj5-0"
18
- })(["display:flex;height:18.6rem;"]);
19
-
20
- function DSTimePickerMenu(props) {
21
- return /*#__PURE__*/_jsx(DSTimePickerMenuWrapper, {}, void 0, /*#__PURE__*/jsx(TimePickerMenu, _objectSpread({}, props)));
22
- }
23
-
24
- export { DSTimePickerMenu, DSTimePickerMenu as default };
@@ -1,392 +0,0 @@
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);
58
- return validateIndex(index, options);
59
- };
60
-
61
- const arrowProps = {
62
- buttonType: 'text',
63
- fluidHeight: true,
64
- fluidWidth: true,
65
- size: 's'
66
- };
67
- class PickerPanel extends Component {
68
- constructor(props) {
69
- super(props);
70
- this.computeContainerTranslation = memoizeOne(index => {
71
- const {
72
- options,
73
- valueProperty
74
- } = this.props;
75
- const {
76
- selectedOption,
77
- scrolling
78
- } = this.state;
79
- const selectedOptionIndex = index || getOptionIndex(options, selectedOption, valueProperty);
80
- const listYPosition = this.minYListPosition - selectedOptionIndex * this.optionHeight;
81
- if (this.scrollHandler && !scrolling) this.scrollHandler.updatePosition(listYPosition);
82
- return listYPosition;
83
- });
84
-
85
- this.renderHeader = () => {
86
- const {
87
- header
88
- } = this.props;
89
- return /*#__PURE__*/_jsx(PickerHeader, {}, void 0, header);
90
- };
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();
96
- this.state = {
97
- selectedOption: props.selected,
98
- activeIndex: 0,
99
- // eslint-disable-next-line react/no-unused-state
100
- prevProps: {}
101
- };
102
- this.handleKeyDown = this.handleKeyDown.bind(this);
103
- this.handleStepMoveUp = this.handleStepMoveUp.bind(this);
104
- this.handleStepMoveDown = this.handleStepMoveDown.bind(this);
105
- }
106
-
107
- componentDidMount() {
108
- this.computeSizes();
109
- const pickerListContainerEl = this.pickerListContainerRef.current;
110
- const pickerListEl = this.pickerListRef.current;
111
- this.scrollHandler = new MoveElementOnScroll(pickerListEl, {
112
- container: pickerListContainerEl,
113
- min: -this.minYListPosition,
114
- max: this.maxYListPosition,
115
- onUpdate: (pos, delta) => {
116
- const {
117
- options
118
- } = this.props;
119
- const index = options.length - -Math.floor((pos - this.maxYListPosition) / this.optionHeight) + (delta > 0 ? 1 : -1);
120
- this.moveTo(index, true);
121
- },
122
- onEndScroll: () => {
123
- this.setState({
124
- scrolling: false
125
- });
126
- }
127
- });
128
- this.computeContainerTranslation();
129
- }
130
-
131
- componentWillUnmount() {
132
- this.scrollHandler.unsubscribe();
133
- }
134
-
135
- static getDerivedStateFromProps(nextProps, _ref3) {
136
- let {
137
- prevProps
138
- } = _ref3;
139
- const {
140
- selected,
141
- valueProperty,
142
- options
143
- } = nextProps;
144
-
145
- if (selected !== prevProps.selected) {
146
- return {
147
- selectedOption: selected,
148
- activeIndex: getOptionIndex(options, selected, valueProperty),
149
- prevProps: nextProps
150
- };
151
- }
152
-
153
- return null;
154
- }
155
-
156
- getOptionValue(option) {
157
- const {
158
- valueProperty
159
- } = this.props;
160
- return option[valueProperty];
161
- }
162
-
163
- getOptionLabel(option) {
164
- const {
165
- labelProperty
166
- } = this.props;
167
- return option[labelProperty];
168
- }
169
-
170
- computeSizes() {
171
- const {
172
- options,
173
- numberItemsOnScreen
174
- } = this.props;
175
- const {
176
- offsetHeight: optionHeight
177
- } = this.pickerItemRef.current;
178
- this.optionHeight = optionHeight;
179
- this.listHeight = this.optionHeight * numberItemsOnScreen;
180
- this.minYListPosition = this.listHeight / 2 - this.optionHeight / 2;
181
- this.maxYListPosition = this.optionHeight * (options.length - Math.ceil(numberItemsOnScreen / 2));
182
- }
183
-
184
- handleOptionSelect(optionValue, index, scrolling) {
185
- const {
186
- onChange
187
- } = this.props;
188
- this.setState(state => _objectSpread(_objectSpread({}, state), {}, {
189
- scrolling,
190
- selectedOption: optionValue,
191
- activeIndex: index
192
- }), () => {
193
- onChange(optionValue, index);
194
- });
195
- } // TODO: this needs a refactor from de FocusGroup
196
- // eslint-disable-next-line max-statements
197
-
198
-
199
- handleKeyDown(e) {
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');
207
- const [lastColumn] = restColumns.slice(-1);
208
- const [prev] = document.getElementsByClassName('DayPickerNavigation_button');
209
- const focusedElement = document.activeElement;
210
-
211
- switch (e.key) {
212
- case 'Home':
213
- this.moveTo(0);
214
- break;
215
-
216
- case 'End':
217
- this.moveTo(options.length - 1);
218
- break;
219
-
220
- case 'ArrowUp':
221
- this.moveTo(activeIndex - 1);
222
- break;
223
-
224
- case 'ArrowDown':
225
- this.moveTo(activeIndex + 1);
226
- break;
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;
242
- }
243
- }
244
- }
245
-
246
- moveTo(index, scrolling) {
247
- const {
248
- options
249
- } = this.props;
250
- const {
251
- selectedOption
252
- } = this.state;
253
- const validIndex = validateIndex(index, options);
254
- const option = options[validIndex];
255
- const optionValue = this.getOptionValue(option);
256
-
257
- if (selectedOption !== optionValue && option.disabled !== true) {
258
- this.handleOptionSelect(optionValue, validIndex, scrolling);
259
- } // TO-DO: if date disabled, add nextValidOption selection
260
-
261
- }
262
-
263
- handleStepMoveUp() {
264
- const {
265
- activeIndex
266
- } = this.state;
267
- const {
268
- arrowStep,
269
- options
270
- } = this.props;
271
- const supposedPos = activeIndex - arrowStep;
272
- const nextPos = supposedPos >= 0 ? supposedPos : activeIndex - 1;
273
- const nextValidOption = options.find(op => !op.disabled);
274
- this.moveTo(nextPos, true, nextValidOption);
275
- }
276
-
277
- handleStepMoveDown() {
278
- const {
279
- activeIndex
280
- } = this.state;
281
- const {
282
- arrowStep,
283
- options
284
- } = this.props;
285
- const supposedPos = activeIndex + arrowStep;
286
- const nextPos = supposedPos <= options.length ? supposedPos : activeIndex + 1;
287
- this.moveTo(nextPos);
288
- }
289
-
290
- render() {
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;
304
- const listYPosition = this.computeContainerTranslation(activeIndex);
305
- return /*#__PURE__*/_jsx(Wrapper, {}, void 0, hasHeader && this.renderHeader(), /*#__PURE__*/_jsx(Container, {
306
- classProps: {
307
- scrolling
308
- },
309
- onKeyDown: this.handleKeyDown,
310
- tabIndex: 0
311
- }, void 0, /*#__PURE__*/_jsx(PickerSelectedOptionSelected, {
312
- innerRef: this.selectedOptionRef
313
- }, void 0, _SelectedCircle || (_SelectedCircle = /*#__PURE__*/_jsx(SelectedCircle, {}))), /*#__PURE__*/_jsx(ArrowButtonContainer, {}, void 0, /*#__PURE__*/jsx(DSButton, _objectSpread(_objectSpread({}, arrowProps), {}, {
314
- "aria-label": "Chevron Up",
315
- "data-testid": "".concat(type, "-chevron-up"),
316
- disabled: activeIndex <= 0,
317
- icon: _ChevronSmallUp || (_ChevronSmallUp = /*#__PURE__*/_jsx(ChevronSmallUp, {})),
318
- onClick: this.handleStepMoveUp,
319
- tabIndex: -1
320
- }))), /*#__PURE__*/_jsx(PickerItemListContainer, {
321
- innerRef: this.pickerListContainerRef,
322
- style: {
323
- height: this.listHeight
324
- }
325
- }, void 0, /*#__PURE__*/_jsx(PickerItemList, {
326
- "data-testid": "".concat(type, "-list"),
327
- innerRef: this.pickerListRef,
328
- style: {
329
- transform: "translateY(".concat(listYPosition, "px)")
330
- }
331
- }, void 0, options.map((option, index) => {
332
- const value = this.getOptionValue(option);
333
- const label = this.getOptionLabel(option);
334
- let valueFormatted;
335
- if (meridiem === 'AM') valueFormatted = value;else if (meridiem === 'PM' && value === 12) valueFormatted = value;else if (meridiem === 'PM') valueFormatted = value + 12;
336
- let disabled = false;
337
-
338
- if (disabledTimes) {
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)) {
345
- disabled = true;
346
- }
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))) {
349
- disabled = false;
350
- }
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) {
353
- disabled = true;
354
- }
355
-
356
- if (label === 'pm' && (to === null || to === void 0 ? void 0 : to.hour) == 24) {
357
- disabled = true;
358
- }
359
- }
360
-
361
- option.disabled = disabled;
362
- return /*#__PURE__*/_jsx(PickerItemContainer, {
363
- classProps: {
364
- selected: selectedOption ? value === selectedOption : index === 0,
365
- disabled
366
- },
367
- innerRef: this.pickerItemRef,
368
- onClick: () => {
369
- if (!disabled) this.handleOptionSelect(value, index);
370
- }
371
- }, value, label);
372
- }))), /*#__PURE__*/_jsx(ArrowButtonContainer, {}, void 0, /*#__PURE__*/jsx(DSButton, _objectSpread(_objectSpread({}, arrowProps), {}, {
373
- "aria-label": "Chevron Down",
374
- "data-testid": "".concat(type, "-chevron-down"),
375
- disabled: activeIndex >= options.length - 1,
376
- icon: _ChevronSmallDown || (_ChevronSmallDown = /*#__PURE__*/_jsx(ChevronSmallDown, {})),
377
- onClick: this.handleStepMoveDown,
378
- tabIndex: -1
379
- })))));
380
- }
381
-
382
- }
383
- PickerPanel.defaultProps = {
384
- valueProperty: 'value',
385
- labelProperty: 'label',
386
- numberItemsOnScreen: 5,
387
- // this number should be impair
388
- options: [],
389
- arrowStep: 1
390
- };
391
-
392
- export { PickerPanel as default };
@@ -1,45 +0,0 @@
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
- });
43
- };
44
-
45
- export { TimePickerDropdown as default };