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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/cjs/DSTimePicker.js +115 -100
  2. package/cjs/DSTimePickerMenu.js +33 -46
  3. package/cjs/PickerPanel.js +254 -151
  4. package/cjs/TimePickerDropdown.js +52 -73
  5. package/cjs/TimePickerImpl.js +138 -146
  6. package/cjs/TimePickerMenu.js +209 -138
  7. package/cjs/index.js +17 -40
  8. package/cjs/moveElementOnScroll.js +39 -57
  9. package/cjs/utils.js +24 -57
  10. package/esm/DSTimePicker.js +105 -71
  11. package/esm/DSTimePickerMenu.js +22 -17
  12. package/esm/PickerPanel.js +242 -120
  13. package/esm/TimePickerDropdown.js +44 -44
  14. package/esm/TimePickerImpl.js +117 -106
  15. package/esm/TimePickerMenu.js +191 -102
  16. package/esm/index.js +4 -11
  17. package/esm/moveElementOnScroll.js +34 -28
  18. package/esm/utils.js +17 -28
  19. package/package.json +7 -7
  20. package/types/DSTimePicker.d.ts +1 -20
  21. package/types/PickerPanel.d.ts +0 -1
  22. package/types/TimePickerDropdown.d.ts +0 -1
  23. package/types/TimePickerImpl.d.ts +0 -1
  24. package/cjs/DSTimePicker.js.map +0 -7
  25. package/cjs/DSTimePickerMenu.js.map +0 -7
  26. package/cjs/PickerPanel.js.map +0 -7
  27. package/cjs/TimePickerDropdown.js.map +0 -7
  28. package/cjs/TimePickerImpl.js.map +0 -7
  29. package/cjs/TimePickerMenu.js.map +0 -7
  30. package/cjs/index.js.map +0 -7
  31. package/cjs/moveElementOnScroll.js.map +0 -7
  32. package/cjs/utils.js.map +0 -7
  33. package/esm/DSTimePicker.js.map +0 -7
  34. package/esm/DSTimePickerMenu.js.map +0 -7
  35. package/esm/PickerPanel.js.map +0 -7
  36. package/esm/TimePickerDropdown.js.map +0 -7
  37. package/esm/TimePickerImpl.js.map +0 -7
  38. package/esm/TimePickerMenu.js.map +0 -7
  39. package/esm/index.js.map +0 -7
  40. package/esm/moveElementOnScroll.js.map +0 -7
  41. package/esm/utils.js.map +0 -7
@@ -1,61 +1,109 @@
1
- import * as React from "react";
2
- import React2, { Component } from "react";
3
- import { findIndex } from "lodash";
4
- import { aggregatedClasses } from "@elliemae/ds-classnames";
5
- import memoizeOne from "memoize-one";
6
- import { ChevronSmallUp, ChevronSmallDown } from "@elliemae/ds-icons";
7
- import { DSButton } from "@elliemae/ds-button";
8
- import { MoveElementOnScroll } from "./moveElementOnScroll";
9
- import { validateIndex } from "./utils";
10
- const blockName = "time-picker-panel";
11
- const Container = aggregatedClasses("div")(blockName, null, ({ scrolling }) => ({ scrolling }));
12
- const Wrapper = aggregatedClasses("div")(blockName, "wrapper");
13
- const PickerItemListContainer = aggregatedClasses("div")(blockName, "item-list-container");
14
- const PickerItemList = aggregatedClasses("div")(blockName, "item-list");
15
- const PickerHeader = aggregatedClasses("div")(blockName, "header");
16
- const PickerItemContainer = aggregatedClasses("div")(blockName, "item", ({ selected, disabled }) => ({
17
- selected,
18
- disabled
19
- }));
20
- const PickerSelectedOptionSelected = aggregatedClasses("div")(blockName, "selected-container");
21
- const SelectedCircle = aggregatedClasses("div")(blockName, "selected-circle");
22
- const ArrowButtonContainer = aggregatedClasses("div")(blockName, "arrow-container");
23
- const getOptionIndex = (options, selectedOption, valueProperty = "value") => {
24
- const index = options.findIndex((option) => option[valueProperty] === selectedOption);
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: "text",
62
+ buttonType: 'text',
29
63
  fluidHeight: true,
30
64
  fluidWidth: true,
31
- size: "s"
65
+ size: 's'
32
66
  };
33
67
  class PickerPanel extends Component {
34
68
  constructor(props) {
35
69
  super(props);
36
- this.computeContainerTranslation = memoizeOne((index) => {
37
- const { options, valueProperty } = this.props;
38
- const { selectedOption, scrolling } = this.state;
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 { header } = this.props;
47
- return /* @__PURE__ */ React2.createElement(PickerHeader, null, header);
86
+ const {
87
+ header
88
+ } = this.props;
89
+ return /*#__PURE__*/_jsx(PickerHeader, {}, void 0, header);
48
90
  };
49
- this.pickerListContainerRef = React2.createRef();
50
- this.pickerListRef = React2.createRef();
51
- this.pickerItemRef = React2.createRef();
52
- this.selectedOptionRef = React2.createRef();
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 { options } = this.props;
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({ scrolling: false });
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
- static getDerivedStateFromProps(nextProps, { prevProps }) {
82
- const { selected, valueProperty, options } = nextProps;
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 { valueProperty } = this.props;
157
+ const {
158
+ valueProperty
159
+ } = this.props;
94
160
  return option[valueProperty];
95
161
  }
162
+
96
163
  getOptionLabel(option) {
97
- const { labelProperty } = this.props;
164
+ const {
165
+ labelProperty
166
+ } = this.props;
98
167
  return option[labelProperty];
99
168
  }
169
+
100
170
  computeSizes() {
101
- const { options, numberItemsOnScreen } = this.props;
102
- const { offsetHeight: optionHeight } = this.pickerItemRef.current;
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 { onChange } = this.props;
110
- this.setState((state) => ({
111
- ...state,
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 { activeIndex } = this.state;
121
- const { options } = this.props;
122
- const [firstColumn, ...restColumns] = document.getElementsByClassName("em-ds-time-picker-panel");
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("DayPickerNavigation_button");
208
+ const [prev] = document.getElementsByClassName('DayPickerNavigation_button');
125
209
  const focusedElement = document.activeElement;
210
+
126
211
  switch (e.key) {
127
- case "Home":
212
+ case 'Home':
128
213
  this.moveTo(0);
129
214
  break;
130
- case "End":
215
+
216
+ case 'End':
131
217
  this.moveTo(options.length - 1);
132
218
  break;
133
- case "ArrowUp":
219
+
220
+ case 'ArrowUp':
134
221
  this.moveTo(activeIndex - 1);
135
222
  break;
136
- case "ArrowDown":
223
+
224
+ case 'ArrowDown':
137
225
  this.moveTo(activeIndex + 1);
138
226
  break;
139
- case "Tab": {
140
- e.preventDefault();
141
- if (prev && focusedElement === lastColumn) {
142
- prev.focus();
143
- } else if (focusedElement === lastColumn) {
144
- firstColumn.focus();
145
- } else {
146
- const position = findIndex(restColumns, focusedElement);
147
- restColumns[position + 1].focus();
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 { options } = this.props;
157
- const { selectedOption } = this.state;
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 { activeIndex } = this.state;
167
- const { arrowStep, options } = this.props;
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((op) => !op.disabled);
273
+ const nextValidOption = options.find(op => !op.disabled);
171
274
  this.moveTo(nextPos, true, nextValidOption);
172
275
  }
276
+
173
277
  handleStepMoveDown() {
174
- const { activeIndex } = this.state;
175
- const { arrowStep, options } = this.props;
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 { options, hasHeader, type, time, meridiem, disabledTimes } = this.props;
182
- const { selectedOption, activeIndex, scrolling } = this.state;
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 /* @__PURE__ */ React2.createElement(Wrapper, null, hasHeader && this.renderHeader(), /* @__PURE__ */ React2.createElement(Container, {
185
- classProps: { scrolling },
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
- }, /* @__PURE__ */ React2.createElement(PickerSelectedOptionSelected, {
311
+ }, void 0, /*#__PURE__*/_jsx(PickerSelectedOptionSelected, {
189
312
  innerRef: this.selectedOptionRef
190
- }, /* @__PURE__ */ React2.createElement(SelectedCircle, null)), /* @__PURE__ */ React2.createElement(ArrowButtonContainer, null, /* @__PURE__ */ React2.createElement(DSButton, {
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": `${type}-chevron-up`,
315
+ "data-testid": "".concat(type, "-chevron-up"),
194
316
  disabled: activeIndex <= 0,
195
- icon: /* @__PURE__ */ React2.createElement(ChevronSmallUp, null),
317
+ icon: _ChevronSmallUp || (_ChevronSmallUp = /*#__PURE__*/_jsx(ChevronSmallUp, {})),
196
318
  onClick: this.handleStepMoveUp,
197
319
  tabIndex: -1
198
- })), /* @__PURE__ */ React2.createElement(PickerItemListContainer, {
320
+ }))), /*#__PURE__*/_jsx(PickerItemListContainer, {
199
321
  innerRef: this.pickerListContainerRef,
200
322
  style: {
201
323
  height: this.listHeight
202
324
  }
203
- }, /* @__PURE__ */ React2.createElement(PickerItemList, {
204
- "data-testid": `${type}-list`,
325
+ }, void 0, /*#__PURE__*/_jsx(PickerItemList, {
326
+ "data-testid": "".concat(type, "-list"),
205
327
  innerRef: this.pickerListRef,
206
328
  style: {
207
- transform: `translateY(${listYPosition}px)`
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 === "AM")
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 { from, to } = disabledTimes;
222
- if (type === "hour" && valueFormatted >= from?.hour && valueFormatted < to?.hour || type === "minutes" && value >= from?.min && value < to?.min) {
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
- if (type === "minutes" && (time?.hour() > to?.hour || time?.hour() < from?.hour)) {
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
- if (label === "am" && from?.hour == 0 && to?.hour >= 12) {
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
- if (label === "pm" && to?.hour == 24) {
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 /* @__PURE__ */ React2.createElement(PickerItemContainer, {
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
- }))), /* @__PURE__ */ React2.createElement(ArrowButtonContainer, null, /* @__PURE__ */ React2.createElement(DSButton, {
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": `${type}-chevron-down`,
374
+ "data-testid": "".concat(type, "-chevron-down"),
252
375
  disabled: activeIndex >= options.length - 1,
253
- icon: /* @__PURE__ */ React2.createElement(ChevronSmallDown, null),
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: "value",
261
- labelProperty: "label",
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
- export {
267
- PickerPanel,
268
- PickerPanel as default
269
- };
270
- //# sourceMappingURL=PickerPanel.js.map
391
+
392
+ export { PickerPanel as default };
@@ -1,45 +1,45 @@
1
- import * as React from "react";
2
- import React2 from "react";
3
- import PropTypes from "prop-types";
4
- import { RecentDocuments } from "@elliemae/ds-icons";
5
- import { DSButton } from "@elliemae/ds-button";
6
- import { DSPopper } from "@elliemae/ds-popper";
7
- const TimePickerDropdown = ({ disabled = false, onClick, onOpen, isOpen, menu, zIndex, blockName, placement }) => /* @__PURE__ */ React2.createElement(DSPopper, {
8
- blockName,
9
- placement,
10
- contentComponent: menu,
11
- isOpen,
12
- onOpen,
13
- modifiers: {
14
- preventOverflow: {
15
- enabled: true,
16
- padding: 0,
17
- boundariesElement: "window"
18
- }
19
- },
20
- showArrow: false,
21
- triggerComponent: /* @__PURE__ */ React2.createElement(DSButton, {
22
- buttonType: "secondary",
23
- disabled,
24
- icon: /* @__PURE__ */ React2.createElement(RecentDocuments, null),
25
- iconSize: "s",
26
- onClick
27
- }),
28
- zIndex
29
- });
30
- TimePickerDropdown.propTypes = {
31
- onClick: PropTypes.func,
32
- onOpen: PropTypes.func,
33
- disabled: PropTypes.bool,
34
- isOpen: PropTypes.bool,
35
- menu: PropTypes.element,
36
- blockName: PropTypes.string,
37
- placement: PropTypes.string,
38
- zIndex: PropTypes.number
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
- var TimePickerDropdown_default = TimePickerDropdown;
41
- export {
42
- TimePickerDropdown,
43
- TimePickerDropdown_default as default
44
- };
45
- //# sourceMappingURL=TimePickerDropdown.js.map
44
+
45
+ export { TimePickerDropdown as default };