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