carbon-addons-iot-react 2.151.0-next.2 → 2.151.0-next.5
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/CHANGELOG.md +49 -0
- package/css/carbon-addons-iot-react.css +396 -0
- package/css/carbon-addons-iot-react.css.map +1 -1
- package/es/components/CardEditor/CardEditForm/CardEditFormItems/DataSeriesFormItemModal.js +26 -97
- package/es/components/CardEditor/CardEditForm/CardEditFormItems/DataSeriesFormItems/DataSeriesFormContent.js +4 -4
- package/es/components/CardEditor/CardEditForm/CardEditFormItems/TableCardFormItems/TableCardFormContent.js +4 -4
- package/es/components/CardEditor/CardEditForm/CommonCardEditFormFields.js +2 -1
- package/es/components/CardEditor/CardEditor.js +12 -29
- package/es/components/DashboardEditor/DashboardEditor.js +3 -1
- package/es/components/DashboardEditor/editorUtils.js +5 -19
- package/es/components/HotspotEditorModal/HotspotEditorDataSourceTab/HotspotEditorDataSourceTab.js +4 -4
- package/es/components/TimePicker/ListSpinner.js +537 -0
- package/es/components/TimePicker/TimePickerDropdown.js +847 -0
- package/es/index.js +1 -0
- package/lib/components/CardEditor/CardEditForm/CardEditFormItems/DataSeriesFormItemModal.js +26 -97
- package/lib/components/CardEditor/CardEditForm/CardEditFormItems/DataSeriesFormItems/DataSeriesFormContent.js +4 -4
- package/lib/components/CardEditor/CardEditForm/CardEditFormItems/TableCardFormItems/TableCardFormContent.js +4 -4
- package/lib/components/CardEditor/CardEditForm/CommonCardEditFormFields.js +2 -1
- package/lib/components/CardEditor/CardEditor.js +12 -29
- package/lib/components/DashboardEditor/DashboardEditor.js +3 -1
- package/lib/components/DashboardEditor/editorUtils.js +5 -19
- package/lib/components/HotspotEditorModal/HotspotEditorDataSourceTab/HotspotEditorDataSourceTab.js +4 -4
- package/lib/components/TimePicker/ListSpinner.js +550 -0
- package/lib/components/TimePicker/TimePickerDropdown.js +862 -0
- package/lib/css/carbon-addons-iot-react.css +396 -0
- package/lib/css/carbon-addons-iot-react.css.map +1 -1
- package/lib/index.js +2 -0
- package/lib/scss/components/TimePicker/_time-picker-dropdown.scss +285 -0
- package/lib/scss/components/TimePicker/list-spinner.scss +86 -0
- package/lib/scss/styles.scss +2 -0
- package/package.json +2 -2
- package/scss/components/TimePicker/_time-picker-dropdown.scss +285 -0
- package/scss/components/TimePicker/list-spinner.scss +86 -0
- package/scss/styles.scss +2 -0
- package/umd/carbon-addons-iot-react.js +2153 -907
|
@@ -0,0 +1,537 @@
|
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
|
+
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
3
|
+
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
4
|
+
import 'core-js/modules/es.array.splice.js';
|
|
5
|
+
import 'core-js/modules/es.array.find-index.js';
|
|
6
|
+
import 'core-js/modules/web.dom-collections.for-each.js';
|
|
7
|
+
import 'core-js/modules/es.array.map.js';
|
|
8
|
+
import 'core-js/modules/es.array.concat.js';
|
|
9
|
+
import React__default, { useRef, useState, useEffect, useCallback } from 'react';
|
|
10
|
+
import PropTypes from 'prop-types';
|
|
11
|
+
import { ChevronUp16, ChevronDown16 } from '@carbon/icons-react';
|
|
12
|
+
import classnames from 'classnames';
|
|
13
|
+
import { settings } from '../../constants/Settings.js';
|
|
14
|
+
import useMerged from '../../hooks/useMerged.js';
|
|
15
|
+
import Button from '../Button/Button.js';
|
|
16
|
+
|
|
17
|
+
var iotPrefix = settings.iotPrefix;
|
|
18
|
+
var propTypes = {
|
|
19
|
+
className: PropTypes.string,
|
|
20
|
+
testId: PropTypes.string,
|
|
21
|
+
i18n: PropTypes.shape({
|
|
22
|
+
previous: PropTypes.string,
|
|
23
|
+
next: PropTypes.string
|
|
24
|
+
}),
|
|
25
|
+
|
|
26
|
+
/** Optional default selected item */
|
|
27
|
+
defaultSelectedId: PropTypes.string,
|
|
28
|
+
|
|
29
|
+
/** Optional handler that is called whenever value is updated */
|
|
30
|
+
onChange: PropTypes.func,
|
|
31
|
+
|
|
32
|
+
/** Optional handler that is called whenever item is clicked */
|
|
33
|
+
onClick: PropTypes.func,
|
|
34
|
+
|
|
35
|
+
/** Array of items to render in the spinning list */
|
|
36
|
+
list: PropTypes.arrayOf(PropTypes.shape({
|
|
37
|
+
id: PropTypes.string,
|
|
38
|
+
value: PropTypes.string
|
|
39
|
+
})),
|
|
40
|
+
|
|
41
|
+
/** Optional tag name to use instead of ul */
|
|
42
|
+
containerElement: PropTypes.string
|
|
43
|
+
}; // istanbul ignore next
|
|
44
|
+
|
|
45
|
+
var defaultProps = {
|
|
46
|
+
className: undefined,
|
|
47
|
+
testId: 'list-spinner',
|
|
48
|
+
i18n: {
|
|
49
|
+
previous: 'Previous item',
|
|
50
|
+
next: 'Next item'
|
|
51
|
+
},
|
|
52
|
+
defaultSelectedId: undefined,
|
|
53
|
+
onChange: function onChange() {},
|
|
54
|
+
onClick: function onClick() {},
|
|
55
|
+
list: [],
|
|
56
|
+
containerElement: 'ul'
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
*
|
|
60
|
+
* @param {*} arr - the array to opperate on
|
|
61
|
+
* @param {*} index - the index of the item to move
|
|
62
|
+
* @returns array - new array with the chosen index as 3 item in array
|
|
63
|
+
*/
|
|
64
|
+
|
|
65
|
+
function moveToSecondIndex(arr, index) {
|
|
66
|
+
var newArr = _toConsumableArray(arr);
|
|
67
|
+
|
|
68
|
+
var removed;
|
|
69
|
+
|
|
70
|
+
if (index > 2) {
|
|
71
|
+
// 6 - 2
|
|
72
|
+
removed = newArr.splice(0, index - 2);
|
|
73
|
+
newArr.push.apply(newArr, _toConsumableArray(removed));
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (index < 2) {
|
|
77
|
+
var amnt = 2 - index; // 6 - 2
|
|
78
|
+
|
|
79
|
+
removed = newArr.splice(-amnt, amnt);
|
|
80
|
+
newArr.unshift.apply(newArr, _toConsumableArray(removed));
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return newArr;
|
|
84
|
+
}
|
|
85
|
+
var ListSpinner = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
86
|
+
var className = _ref.className,
|
|
87
|
+
testId = _ref.testId,
|
|
88
|
+
i18n = _ref.i18n,
|
|
89
|
+
defaultSelectedId = _ref.defaultSelectedId,
|
|
90
|
+
onChange = _ref.onChange,
|
|
91
|
+
onClick = _ref.onClick,
|
|
92
|
+
list = _ref.list,
|
|
93
|
+
ContainerElement = _ref.containerElement;
|
|
94
|
+
var containerRef = useRef();
|
|
95
|
+
var contentRef = useRef();
|
|
96
|
+
var touch = useRef(false);
|
|
97
|
+
var ticking = useRef(false);
|
|
98
|
+
var scrollEvent = useRef(false);
|
|
99
|
+
var scrollPosition = useRef();
|
|
100
|
+
var timer = useRef();
|
|
101
|
+
|
|
102
|
+
var _useState = useState(list),
|
|
103
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
104
|
+
listItems = _useState2[0],
|
|
105
|
+
setListItems = _useState2[1];
|
|
106
|
+
|
|
107
|
+
var _useState3 = useState(defaultSelectedId),
|
|
108
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
109
|
+
selectedId = _useState4[0],
|
|
110
|
+
setSelectedId = _useState4[1];
|
|
111
|
+
|
|
112
|
+
var _useMerged = useMerged(defaultProps.i18n, i18n),
|
|
113
|
+
previous = _useMerged.previous,
|
|
114
|
+
next = _useMerged.next;
|
|
115
|
+
|
|
116
|
+
useEffect(function () {
|
|
117
|
+
setSelectedId(defaultSelectedId);
|
|
118
|
+
}, [defaultSelectedId]);
|
|
119
|
+
useEffect(function () {
|
|
120
|
+
var index = list.findIndex(function (i) {
|
|
121
|
+
return i.id === selectedId;
|
|
122
|
+
});
|
|
123
|
+
var newList = moveToSecondIndex(list, index);
|
|
124
|
+
setListItems(newList);
|
|
125
|
+
onChange(selectedId);
|
|
126
|
+
/* eslint-disable-next-line react-hooks/exhaustive-deps */
|
|
127
|
+
}, [onChange, selectedId]);
|
|
128
|
+
var observerRef = React__default.useRef();
|
|
129
|
+
useEffect(function () {
|
|
130
|
+
var _window;
|
|
131
|
+
|
|
132
|
+
// Create a new observer
|
|
133
|
+
if ((_window = window) !== null && _window !== void 0 && _window.IntersectionObserver) {
|
|
134
|
+
observerRef.current = new IntersectionObserver(function (entries) {
|
|
135
|
+
entries.forEach(function (entry) {
|
|
136
|
+
if (entry.isIntersecting && scrollEvent.current) {
|
|
137
|
+
clearTimeout(timer.current);
|
|
138
|
+
timer.current = setTimeout(setSelectedId(entry.target.childNodes[0].id), 800);
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
}, {
|
|
142
|
+
root: containerRef.current,
|
|
143
|
+
rootMargin: '-50% 0% -50% 0%',
|
|
144
|
+
threshold: 0
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
return function () {
|
|
149
|
+
var _observerRef$current;
|
|
150
|
+
|
|
151
|
+
return (_observerRef$current = observerRef.current) === null || _observerRef$current === void 0 ? void 0 : _observerRef$current.disconnect();
|
|
152
|
+
};
|
|
153
|
+
}, []);
|
|
154
|
+
|
|
155
|
+
var handleWheel = function handleWheel(e) {
|
|
156
|
+
e.persist();
|
|
157
|
+
scrollEvent.current = true;
|
|
158
|
+
|
|
159
|
+
if (!ticking.current) {
|
|
160
|
+
/* eslint-disable func-names */
|
|
161
|
+
setTimeout(function () {
|
|
162
|
+
return setTimeout(function () {
|
|
163
|
+
if (e.deltaY < 0) {
|
|
164
|
+
setSelectedId(function (prev) {
|
|
165
|
+
var prevIndex = list.findIndex(function (i) {
|
|
166
|
+
return i.id === prev;
|
|
167
|
+
});
|
|
168
|
+
var val = prevIndex > 0 ? list[prevIndex - 1].id : list[list.length - 1].id;
|
|
169
|
+
setTimeout(function () {
|
|
170
|
+
return onClick(val);
|
|
171
|
+
});
|
|
172
|
+
return val;
|
|
173
|
+
});
|
|
174
|
+
} else {
|
|
175
|
+
setSelectedId(function (prev) {
|
|
176
|
+
var prevIndex = list.findIndex(function (i) {
|
|
177
|
+
return i.id === prev;
|
|
178
|
+
});
|
|
179
|
+
var val = prevIndex === list.indexOf(list[list.length - 1]) ? list[0].id : list[prevIndex + 1].id;
|
|
180
|
+
setTimeout(function () {
|
|
181
|
+
return onClick(val);
|
|
182
|
+
});
|
|
183
|
+
return val;
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
ticking.current = false;
|
|
188
|
+
});
|
|
189
|
+
}, 100);
|
|
190
|
+
ticking.current = true;
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
var handleTouchMove = function handleTouchMove(e) {
|
|
195
|
+
e.persist();
|
|
196
|
+
scrollEvent.current = true;
|
|
197
|
+
/* istanbul ignore else */
|
|
198
|
+
|
|
199
|
+
if (!ticking.current) {
|
|
200
|
+
/* eslint-disable func-names */
|
|
201
|
+
setTimeout(function () {
|
|
202
|
+
setTimeout(function () {
|
|
203
|
+
if (scrollPosition.current - e.touches[0].pageY < 0) {
|
|
204
|
+
setSelectedId(function (prev) {
|
|
205
|
+
var prevIndex = list.findIndex(function (i) {
|
|
206
|
+
return i.id === prev;
|
|
207
|
+
});
|
|
208
|
+
var val = prevIndex > 0 ? list[prevIndex - 1].id : list[list.length - 1].id;
|
|
209
|
+
setTimeout(function () {
|
|
210
|
+
return onClick(val);
|
|
211
|
+
});
|
|
212
|
+
return val;
|
|
213
|
+
});
|
|
214
|
+
} else {
|
|
215
|
+
setSelectedId(function (prev) {
|
|
216
|
+
var prevIndex = list.findIndex(function (i) {
|
|
217
|
+
return i.id === prev;
|
|
218
|
+
});
|
|
219
|
+
var val = prevIndex === list.indexOf(list[list.length - 1]) ? list[0].id : list[prevIndex + 1].id;
|
|
220
|
+
setTimeout(function () {
|
|
221
|
+
return onClick(val);
|
|
222
|
+
});
|
|
223
|
+
return val;
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
scrollPosition.current = e.touches[0].pageY;
|
|
228
|
+
ticking.current = false;
|
|
229
|
+
touch.current = false;
|
|
230
|
+
});
|
|
231
|
+
}, 100);
|
|
232
|
+
ticking.current = true;
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
var handleTouchStart = function handleTouchStart(e) {
|
|
237
|
+
e.persist();
|
|
238
|
+
scrollPosition.current = e.touches[0].pageY;
|
|
239
|
+
touch.current = true;
|
|
240
|
+
}; // eslint-disable-next-line consistent-return
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
var handleKeyPress = function handleKeyPress(e) {
|
|
244
|
+
e.persist(); // istanbul ignore else
|
|
245
|
+
|
|
246
|
+
if (e.target.id.length === 2) {
|
|
247
|
+
// istanbul ignore else
|
|
248
|
+
if (e.key === 'ArrowUp') {
|
|
249
|
+
e.preventDefault();
|
|
250
|
+
setSelectedId(function (prev) {
|
|
251
|
+
var prevIndex = list.findIndex(function (i) {
|
|
252
|
+
return i.id === prev;
|
|
253
|
+
});
|
|
254
|
+
var val = prevIndex > 0 ? list[prevIndex - 1].id : list[list.length - 1].id;
|
|
255
|
+
setTimeout(function () {
|
|
256
|
+
return onClick(val);
|
|
257
|
+
});
|
|
258
|
+
return val;
|
|
259
|
+
});
|
|
260
|
+
setTimeout(function () {
|
|
261
|
+
return contentRef.current.childNodes[0].focus();
|
|
262
|
+
});
|
|
263
|
+
return false;
|
|
264
|
+
} // istanbul ignore else
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
if (e.key === 'ArrowDown') {
|
|
268
|
+
e.preventDefault();
|
|
269
|
+
setSelectedId(function (prev) {
|
|
270
|
+
var prevIndex = list.findIndex(function (i) {
|
|
271
|
+
return i.id === prev;
|
|
272
|
+
});
|
|
273
|
+
var val = prevIndex === list.indexOf(list[list.length - 1]) ? list[0].id : list[prevIndex + 1].id;
|
|
274
|
+
setTimeout(function () {
|
|
275
|
+
return onClick(val);
|
|
276
|
+
});
|
|
277
|
+
return val;
|
|
278
|
+
});
|
|
279
|
+
setTimeout(function () {
|
|
280
|
+
return contentRef.current.childNodes[0].focus();
|
|
281
|
+
});
|
|
282
|
+
return false;
|
|
283
|
+
}
|
|
284
|
+
} // istanbul ignore else
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
if (/\s/.test(e.key) || e.key === 'Enter') {
|
|
288
|
+
// istanbul ignore else
|
|
289
|
+
if (e.currentTarget.id === "".concat(iotPrefix, "--list-spinner__btn--up")) {
|
|
290
|
+
setSelectedId(function (prev) {
|
|
291
|
+
var prevIndex = list.findIndex(function (i) {
|
|
292
|
+
return i.id === prev;
|
|
293
|
+
});
|
|
294
|
+
var val = prevIndex > 0 ? list[prevIndex - 1].id : list[list.length - 1].id;
|
|
295
|
+
setTimeout(function () {
|
|
296
|
+
return onClick(val);
|
|
297
|
+
});
|
|
298
|
+
return val;
|
|
299
|
+
});
|
|
300
|
+
} // istanbul ignore else
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
if (e.currentTarget.id === "".concat(iotPrefix, "--list-spinner__btn--down")) {
|
|
304
|
+
setSelectedId(function (prev) {
|
|
305
|
+
var prevIndex = list.findIndex(function (i) {
|
|
306
|
+
return i.id === prev;
|
|
307
|
+
});
|
|
308
|
+
var val = prevIndex === list.indexOf(list[list.length - 1]) ? list[0].id : list[prevIndex + 1].id;
|
|
309
|
+
setTimeout(function () {
|
|
310
|
+
return onClick(val);
|
|
311
|
+
});
|
|
312
|
+
return val;
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
};
|
|
317
|
+
|
|
318
|
+
var handleClick = useCallback(function (e) {
|
|
319
|
+
e.persist();
|
|
320
|
+
e.preventDefault();
|
|
321
|
+
scrollEvent.current = false;
|
|
322
|
+
|
|
323
|
+
if (e.currentTarget.id === "".concat(iotPrefix, "--list-spinner__btn--up")) {
|
|
324
|
+
setSelectedId(function (prev) {
|
|
325
|
+
var prevIndex = list.findIndex(function (i) {
|
|
326
|
+
return i.id === prev;
|
|
327
|
+
});
|
|
328
|
+
var val = prevIndex > 0 ? list[prevIndex - 1].id : list[list.length - 1].id;
|
|
329
|
+
setTimeout(function () {
|
|
330
|
+
return onClick(val);
|
|
331
|
+
});
|
|
332
|
+
return val;
|
|
333
|
+
});
|
|
334
|
+
} else if (e.currentTarget.id === "".concat(iotPrefix, "--list-spinner__btn--down")) {
|
|
335
|
+
setSelectedId(function (prev) {
|
|
336
|
+
var prevIndex = list.findIndex(function (i) {
|
|
337
|
+
return i.id === prev;
|
|
338
|
+
});
|
|
339
|
+
var val = prevIndex === list.indexOf(list[list.length - 1]) ? list[0].id : list[prevIndex + 1].id;
|
|
340
|
+
setTimeout(function () {
|
|
341
|
+
return onClick(val);
|
|
342
|
+
});
|
|
343
|
+
return val;
|
|
344
|
+
});
|
|
345
|
+
} else {
|
|
346
|
+
setSelectedId(e.currentTarget.id);
|
|
347
|
+
onClick(e.currentTarget.id);
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
e.currentTarget.focus();
|
|
351
|
+
}, [list, onClick]);
|
|
352
|
+
var renderItems = listItems.map(function (el) {
|
|
353
|
+
return /*#__PURE__*/React__default.createElement("li", {
|
|
354
|
+
"data-testid": "".concat(testId, "-list-item"),
|
|
355
|
+
ref: function ref(node) {
|
|
356
|
+
// Once component mounts tell our observer to observe it
|
|
357
|
+
if (node) {
|
|
358
|
+
if (el.value === selectedId) {
|
|
359
|
+
contentRef.current = node;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
setTimeout(function () {
|
|
363
|
+
var _observerRef$current2;
|
|
364
|
+
|
|
365
|
+
return (_observerRef$current2 = observerRef.current) === null || _observerRef$current2 === void 0 ? void 0 : _observerRef$current2.observe(node);
|
|
366
|
+
}, 0);
|
|
367
|
+
}
|
|
368
|
+
},
|
|
369
|
+
className: classnames("".concat(iotPrefix, "--list-spinner__list-item"), _defineProperty({}, "".concat(iotPrefix, "--list-spinner__list-item--selected"), el.id === selectedId)),
|
|
370
|
+
key: el.id,
|
|
371
|
+
id: "".concat(el.id, "-list-item"),
|
|
372
|
+
"data-selected": el.value === selectedId
|
|
373
|
+
}, /*#__PURE__*/React__default.createElement(Button, {
|
|
374
|
+
testId: el.id === selectedId ? "".concat(testId, "-selected-item") : el.id,
|
|
375
|
+
id: el.id,
|
|
376
|
+
tabIndex: el.id === selectedId ? 0 : -1,
|
|
377
|
+
kind: "ghost",
|
|
378
|
+
iconDescription: el.value,
|
|
379
|
+
onMouseDown: handleClick
|
|
380
|
+
}, el.value));
|
|
381
|
+
});
|
|
382
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
383
|
+
"data-testid": testId,
|
|
384
|
+
className: classnames("".concat(iotPrefix, "--list-spinner__section"), _defineProperty({}, className, className))
|
|
385
|
+
}, /*#__PURE__*/React__default.createElement(Button, {
|
|
386
|
+
ref: ref,
|
|
387
|
+
testId: "".concat(testId, "-prev-btn"),
|
|
388
|
+
id: "".concat(iotPrefix, "--list-spinner__btn--up"),
|
|
389
|
+
onMouseDown: handleClick,
|
|
390
|
+
iconDescription: previous,
|
|
391
|
+
className: "".concat(iotPrefix, "--list-spinner__btn ").concat(className, "-spinner__btn"),
|
|
392
|
+
renderIcon: ChevronUp16,
|
|
393
|
+
kind: "ghost",
|
|
394
|
+
onKeyDown: handleKeyPress
|
|
395
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
396
|
+
className: "".concat(iotPrefix, "--list-spinner__list-container ").concat(className, "-spinner__list-container")
|
|
397
|
+
}, /*#__PURE__*/React__default.createElement(ContainerElement, {
|
|
398
|
+
"data-testid": "".concat(testId, "-list"),
|
|
399
|
+
ref: containerRef,
|
|
400
|
+
className: "".concat(iotPrefix, "--list-spinner__list ").concat(className, "-spinner__list"),
|
|
401
|
+
onWheel: handleWheel,
|
|
402
|
+
onTouchStart: handleTouchStart,
|
|
403
|
+
onTouchMove: handleTouchMove,
|
|
404
|
+
onKeyDown: handleKeyPress
|
|
405
|
+
}, renderItems)), /*#__PURE__*/React__default.createElement(Button, {
|
|
406
|
+
testId: "".concat(testId, "-next-btn"),
|
|
407
|
+
id: "".concat(iotPrefix, "--list-spinner__btn--down"),
|
|
408
|
+
onMouseDown: handleClick,
|
|
409
|
+
className: "".concat(iotPrefix, "--list-spinner__btn ").concat(className, "-spinner__btn"),
|
|
410
|
+
iconDescription: next,
|
|
411
|
+
renderIcon: ChevronDown16,
|
|
412
|
+
kind: "ghost",
|
|
413
|
+
onKeyDown: handleKeyPress
|
|
414
|
+
}));
|
|
415
|
+
});
|
|
416
|
+
ListSpinner.propTypes = propTypes;
|
|
417
|
+
ListSpinner.defaultProps = defaultProps;
|
|
418
|
+
ListSpinner.__docgenInfo = {
|
|
419
|
+
"description": "",
|
|
420
|
+
"methods": [],
|
|
421
|
+
"props": {
|
|
422
|
+
"className": {
|
|
423
|
+
"defaultValue": {
|
|
424
|
+
"value": "undefined",
|
|
425
|
+
"computed": true
|
|
426
|
+
},
|
|
427
|
+
"type": {
|
|
428
|
+
"name": "string"
|
|
429
|
+
},
|
|
430
|
+
"required": false,
|
|
431
|
+
"description": ""
|
|
432
|
+
},
|
|
433
|
+
"testId": {
|
|
434
|
+
"defaultValue": {
|
|
435
|
+
"value": "'list-spinner'",
|
|
436
|
+
"computed": false
|
|
437
|
+
},
|
|
438
|
+
"type": {
|
|
439
|
+
"name": "string"
|
|
440
|
+
},
|
|
441
|
+
"required": false,
|
|
442
|
+
"description": ""
|
|
443
|
+
},
|
|
444
|
+
"i18n": {
|
|
445
|
+
"defaultValue": {
|
|
446
|
+
"value": "{\n previous: 'Previous item',\n next: 'Next item',\n}",
|
|
447
|
+
"computed": false
|
|
448
|
+
},
|
|
449
|
+
"type": {
|
|
450
|
+
"name": "shape",
|
|
451
|
+
"value": {
|
|
452
|
+
"previous": {
|
|
453
|
+
"name": "string",
|
|
454
|
+
"required": false
|
|
455
|
+
},
|
|
456
|
+
"next": {
|
|
457
|
+
"name": "string",
|
|
458
|
+
"required": false
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
},
|
|
462
|
+
"required": false,
|
|
463
|
+
"description": ""
|
|
464
|
+
},
|
|
465
|
+
"defaultSelectedId": {
|
|
466
|
+
"defaultValue": {
|
|
467
|
+
"value": "undefined",
|
|
468
|
+
"computed": true
|
|
469
|
+
},
|
|
470
|
+
"type": {
|
|
471
|
+
"name": "string"
|
|
472
|
+
},
|
|
473
|
+
"required": false,
|
|
474
|
+
"description": "Optional default selected item"
|
|
475
|
+
},
|
|
476
|
+
"onChange": {
|
|
477
|
+
"defaultValue": {
|
|
478
|
+
"value": "() => {}",
|
|
479
|
+
"computed": false
|
|
480
|
+
},
|
|
481
|
+
"type": {
|
|
482
|
+
"name": "func"
|
|
483
|
+
},
|
|
484
|
+
"required": false,
|
|
485
|
+
"description": "Optional handler that is called whenever value is updated"
|
|
486
|
+
},
|
|
487
|
+
"onClick": {
|
|
488
|
+
"defaultValue": {
|
|
489
|
+
"value": "() => {}",
|
|
490
|
+
"computed": false
|
|
491
|
+
},
|
|
492
|
+
"type": {
|
|
493
|
+
"name": "func"
|
|
494
|
+
},
|
|
495
|
+
"required": false,
|
|
496
|
+
"description": "Optional handler that is called whenever item is clicked"
|
|
497
|
+
},
|
|
498
|
+
"list": {
|
|
499
|
+
"defaultValue": {
|
|
500
|
+
"value": "[]",
|
|
501
|
+
"computed": false
|
|
502
|
+
},
|
|
503
|
+
"type": {
|
|
504
|
+
"name": "arrayOf",
|
|
505
|
+
"value": {
|
|
506
|
+
"name": "shape",
|
|
507
|
+
"value": {
|
|
508
|
+
"id": {
|
|
509
|
+
"name": "string",
|
|
510
|
+
"required": false
|
|
511
|
+
},
|
|
512
|
+
"value": {
|
|
513
|
+
"name": "string",
|
|
514
|
+
"required": false
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
},
|
|
519
|
+
"required": false,
|
|
520
|
+
"description": "Array of items to render in the spinning list"
|
|
521
|
+
},
|
|
522
|
+
"containerElement": {
|
|
523
|
+
"defaultValue": {
|
|
524
|
+
"value": "'ul'",
|
|
525
|
+
"computed": false
|
|
526
|
+
},
|
|
527
|
+
"type": {
|
|
528
|
+
"name": "string"
|
|
529
|
+
},
|
|
530
|
+
"required": false,
|
|
531
|
+
"description": "Optional tag name to use instead of ul"
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
};
|
|
535
|
+
|
|
536
|
+
export default ListSpinner;
|
|
537
|
+
export { moveToSecondIndex };
|