@synerise/ds-collector 0.4.0 → 0.4.4
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 +32 -0
- package/dist/Collector.js +33 -51
- package/dist/Collector.styles.js +2 -2
- package/dist/Elements/ButtonPanel/ButtonPanel.js +2 -2
- package/dist/Elements/NavigationHint/NavigationHint.js +2 -2
- package/dist/Elements/OptionsDropdown/OptionsDropdown.js +5 -18
- package/dist/Elements/Values/Values.js +1 -1
- package/dist/utils.js +15 -9
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,38 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [0.4.4](https://github.com/Synerise/synerise-design/compare/@synerise/ds-collector@0.4.3...@synerise/ds-collector@0.4.4) (2021-11-23)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @synerise/ds-collector
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [0.4.3](https://github.com/Synerise/synerise-design/compare/@synerise/ds-collector@0.4.2...@synerise/ds-collector@0.4.3) (2021-11-22)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @synerise/ds-collector
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [0.4.2](https://github.com/Synerise/synerise-design/compare/@synerise/ds-collector@0.4.1...@synerise/ds-collector@0.4.2) (2021-11-16)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @synerise/ds-collector
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## [0.4.1](https://github.com/Synerise/synerise-design/compare/@synerise/ds-collector@0.3.23...@synerise/ds-collector@0.4.1) (2021-11-09)
|
|
31
|
+
|
|
32
|
+
**Note:** Version bump only for package @synerise/ds-collector
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
6
38
|
# [0.4.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-collector@0.3.23...@synerise/ds-collector@0.4.0) (2021-11-09)
|
|
7
39
|
|
|
8
40
|
**Note:** Version bump only for package @synerise/ds-collector
|
package/dist/Collector.js
CHANGED
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
-
|
|
3
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
|
-
|
|
5
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
6
|
-
|
|
7
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
8
|
-
|
|
9
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
10
|
-
|
|
11
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
12
|
-
|
|
13
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
14
|
-
|
|
15
1
|
import * as React from 'react';
|
|
16
2
|
import classNames from 'classnames';
|
|
17
3
|
import { focusWithArrowKeys, useOnClickOutside } from '@synerise/ds-utils';
|
|
@@ -24,6 +10,8 @@ var DROPDOWN_PADDING = 2 * 8;
|
|
|
24
10
|
var COLLECTOR_CLASSNAME = 'ds-collector';
|
|
25
11
|
|
|
26
12
|
var Collector = function Collector(_ref) {
|
|
13
|
+
var _classNames;
|
|
14
|
+
|
|
27
15
|
var allowCustomValue = _ref.allowCustomValue,
|
|
28
16
|
allowMultipleValues = _ref.allowMultipleValues,
|
|
29
17
|
addButtonProps = _ref.addButtonProps,
|
|
@@ -59,46 +47,40 @@ var Collector = function Collector(_ref) {
|
|
|
59
47
|
var mainContentRef = React.useRef(null);
|
|
60
48
|
|
|
61
49
|
var _React$useState = React.useState(false),
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
setFocused = _React$useState2[1];
|
|
50
|
+
isFocused = _React$useState[0],
|
|
51
|
+
setFocused = _React$useState[1];
|
|
65
52
|
|
|
66
|
-
var _React$
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
setShowGradient = _React$useState4[1];
|
|
53
|
+
var _React$useState2 = React.useState(false),
|
|
54
|
+
showGradient = _React$useState2[0],
|
|
55
|
+
setShowGradient = _React$useState2[1];
|
|
70
56
|
|
|
71
|
-
var _React$
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
setScrollLeft = _React$useState6[1];
|
|
57
|
+
var _React$useState3 = React.useState(0),
|
|
58
|
+
scrollLeft = _React$useState3[0],
|
|
59
|
+
setScrollLeft = _React$useState3[1];
|
|
75
60
|
|
|
76
|
-
var _React$
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
setValue = _React$useState8[1];
|
|
61
|
+
var _React$useState4 = React.useState(searchValue || ''),
|
|
62
|
+
value = _React$useState4[0],
|
|
63
|
+
setValue = _React$useState4[1];
|
|
80
64
|
|
|
81
|
-
var _React$
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
setSelectedValues = _React$useState10[1];
|
|
65
|
+
var _React$useState5 = React.useState(selected && allowMultipleValues ? selected : []),
|
|
66
|
+
selectedValues = _React$useState5[0],
|
|
67
|
+
setSelectedValues = _React$useState5[1];
|
|
85
68
|
|
|
86
|
-
var _React$
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
setFilteredSuggestions = _React$useState12[1];
|
|
69
|
+
var _React$useState6 = React.useState(suggestions || []),
|
|
70
|
+
filteredSuggestions = _React$useState6[0],
|
|
71
|
+
setFilteredSuggestions = _React$useState6[1];
|
|
90
72
|
|
|
91
73
|
var filterLookupKey = React.useMemo(function () {
|
|
92
|
-
return (lookupConfig
|
|
74
|
+
return (lookupConfig == null ? void 0 : lookupConfig.filter) || 'text';
|
|
93
75
|
}, [lookupConfig]);
|
|
94
76
|
var displayLookupKey = React.useMemo(function () {
|
|
95
|
-
return (lookupConfig
|
|
77
|
+
return (lookupConfig == null ? void 0 : lookupConfig.display) || 'text';
|
|
96
78
|
}, [lookupConfig]);
|
|
97
79
|
var onFocusCallback = React.useCallback(function (e) {
|
|
98
80
|
e.preventDefault();
|
|
99
81
|
|
|
100
82
|
if (!e.target.classList.contains(COLLECTOR_CLASSNAME)) {
|
|
101
|
-
if (!!inputRef && !!(inputRef
|
|
83
|
+
if (!!inputRef && !!(inputRef != null && inputRef.current)) {
|
|
102
84
|
inputRef.current.focus({
|
|
103
85
|
preventScroll: true
|
|
104
86
|
});
|
|
@@ -135,7 +117,7 @@ var Collector = function Collector(_ref) {
|
|
|
135
117
|
setSelectedValues([]);
|
|
136
118
|
setValue('');
|
|
137
119
|
setFocused(false);
|
|
138
|
-
(inputRef
|
|
120
|
+
(inputRef == null ? void 0 : inputRef.current) && inputRef.current.blur();
|
|
139
121
|
}, []);
|
|
140
122
|
|
|
141
123
|
var handleKeyDown = function handleKeyDown(e) {
|
|
@@ -163,7 +145,7 @@ var Collector = function Collector(_ref) {
|
|
|
163
145
|
}
|
|
164
146
|
}
|
|
165
147
|
|
|
166
|
-
if (allowMultipleValues && e.key === 'Backspace' && !value && !!(selectedValues
|
|
148
|
+
if (allowMultipleValues && e.key === 'Backspace' && !value && !!(selectedValues != null && selectedValues.length)) {
|
|
167
149
|
var lastElement = selected.pop();
|
|
168
150
|
|
|
169
151
|
if (lastElement && onItemDeselect) {
|
|
@@ -186,7 +168,7 @@ var Collector = function Collector(_ref) {
|
|
|
186
168
|
var suggestionsIncludesCurrentValue = filteredSuggestions.some(function (suggestion) {
|
|
187
169
|
var _suggestion$filterLoo, _suggestion$filterLoo2;
|
|
188
170
|
|
|
189
|
-
return ((_suggestion$filterLoo = suggestion[filterLookupKey])
|
|
171
|
+
return ((_suggestion$filterLoo = suggestion[filterLookupKey]) == null ? void 0 : (_suggestion$filterLoo2 = _suggestion$filterLoo.trim()) == null ? void 0 : _suggestion$filterLoo2.toLowerCase()) === value.trim().toLowerCase();
|
|
190
172
|
});
|
|
191
173
|
|
|
192
174
|
if (allowCustomValue || suggestionsIncludesCurrentValue) {
|
|
@@ -198,10 +180,10 @@ var Collector = function Collector(_ref) {
|
|
|
198
180
|
var getContainerWidth = React.useCallback(function () {
|
|
199
181
|
var _containerRef$current;
|
|
200
182
|
|
|
201
|
-
return Number((_containerRef$current = containerRef.current)
|
|
183
|
+
return Number((_containerRef$current = containerRef.current) == null ? void 0 : _containerRef$current.offsetWidth) - DROPDOWN_PADDING;
|
|
202
184
|
}, [containerRef]);
|
|
203
185
|
var handleDropdownClick = React.useCallback(function () {
|
|
204
|
-
if (inputRef
|
|
186
|
+
if (inputRef != null && inputRef.current) {
|
|
205
187
|
inputRef.current.focus({
|
|
206
188
|
preventScroll: true
|
|
207
189
|
});
|
|
@@ -215,14 +197,14 @@ var Collector = function Collector(_ref) {
|
|
|
215
197
|
ref: containerRef,
|
|
216
198
|
onKeyDown: function onKeyDown(e) {
|
|
217
199
|
focusWithArrowKeys(e, 'ds-search-item', function () {
|
|
218
|
-
(inputRef
|
|
200
|
+
(inputRef == null ? void 0 : inputRef.current) && inputRef.current.focus({
|
|
219
201
|
preventScroll: true
|
|
220
202
|
});
|
|
221
203
|
});
|
|
222
204
|
!value && scrollWithHorizontalArrow(mainContentRef, e);
|
|
223
205
|
}
|
|
224
206
|
}, label && /*#__PURE__*/React.createElement(S.ContentAbove, null, /*#__PURE__*/React.createElement(S.Label, null, label)), /*#__PURE__*/React.createElement(S.CollectorInput, {
|
|
225
|
-
className: classNames(COLLECTOR_CLASSNAME,
|
|
207
|
+
className: classNames(COLLECTOR_CLASSNAME, (_classNames = {}, _classNames[className] = !!className, _classNames)),
|
|
226
208
|
tabIndex: 0,
|
|
227
209
|
focus: isFocused,
|
|
228
210
|
onFocus: onFocusCallback,
|
|
@@ -237,7 +219,7 @@ var Collector = function Collector(_ref) {
|
|
|
237
219
|
setScrollLeft(currentTarget.scrollLeft);
|
|
238
220
|
}
|
|
239
221
|
},
|
|
240
|
-
hasValues: !!(selectedValues
|
|
222
|
+
hasValues: !!(selectedValues != null && selectedValues.length),
|
|
241
223
|
ref: mainContentRef,
|
|
242
224
|
gradientOverlap: showGradient && scrollLeft > 0,
|
|
243
225
|
focus: isFocused
|
|
@@ -259,8 +241,8 @@ var Collector = function Collector(_ref) {
|
|
|
259
241
|
disabled: disabled,
|
|
260
242
|
transparent: !!disableSearch,
|
|
261
243
|
hidden: !!disableSearch && !!selectedValues.length,
|
|
262
|
-
placeholder: selectedValues && selectedValues.length ? undefined : texts
|
|
263
|
-
hasValues: !!(selectedValues
|
|
244
|
+
placeholder: selectedValues && selectedValues.length ? undefined : texts == null ? void 0 : texts.placeholder,
|
|
245
|
+
hasValues: !!(selectedValues != null && selectedValues.length)
|
|
264
246
|
})), !disableButtonPanel && /*#__PURE__*/React.createElement(S.RightSide, {
|
|
265
247
|
gradientOverlap: showGradient && !value,
|
|
266
248
|
focus: isFocused
|
|
@@ -268,7 +250,7 @@ var Collector = function Collector(_ref) {
|
|
|
268
250
|
onCancel: onCancelCallback,
|
|
269
251
|
onConfirm: onConfirmCallback,
|
|
270
252
|
disabled: !!disabled,
|
|
271
|
-
showCancel: !!value || !!(selectedValues
|
|
253
|
+
showCancel: !!value || !!(selectedValues != null && selectedValues.length),
|
|
272
254
|
texts: texts,
|
|
273
255
|
addButtonProps: addButtonProps,
|
|
274
256
|
cancelButtonProps: cancelButtonProps
|
package/dist/Collector.styles.js
CHANGED
|
@@ -27,7 +27,7 @@ export var MainContent = styled.div.withConfig({
|
|
|
27
27
|
}, function (props) {
|
|
28
28
|
return props.gradientOverlap ? "1" : '0';
|
|
29
29
|
}, gradientOverlayStyles(), function (props) {
|
|
30
|
-
return "-webkit-linear-gradient( left,\n "
|
|
30
|
+
return "-webkit-linear-gradient( left,\n " + (props.focus ? props.theme.palette['blue-050'] : props.theme.palette.white) + " 0%,\n rgba(255,255,255,0) 100%\n )";
|
|
31
31
|
});
|
|
32
32
|
export var RightSide = styled.div.withConfig({
|
|
33
33
|
displayName: "Collectorstyles__RightSide",
|
|
@@ -35,7 +35,7 @@ export var RightSide = styled.div.withConfig({
|
|
|
35
35
|
})(["display:flex;margin:0 4px;position:relative;.ds-button:not(:last-child){margin-right:8px;}&::before{content:", ";", " background-image:", ";position:absolute;left:-102px;}"], function (props) {
|
|
36
36
|
return props.gradientOverlap ? "''" : 'none';
|
|
37
37
|
}, gradientOverlayStyles(), function (props) {
|
|
38
|
-
return "-webkit-linear-gradient( right,\n "
|
|
38
|
+
return "-webkit-linear-gradient( right,\n " + (props.focus ? props.theme.palette['blue-050'] : props.theme.palette.white) + " 0%,\n rgba(255,255,255,0) 100%\n )";
|
|
39
39
|
});
|
|
40
40
|
export var Input = styled(BorderLessInput).withConfig({
|
|
41
41
|
displayName: "Collectorstyles__Input",
|
|
@@ -18,14 +18,14 @@ var ButtonPanel = function ButtonPanel(_ref) {
|
|
|
18
18
|
onFocus: function onFocus(e) {
|
|
19
19
|
return e.stopPropagation();
|
|
20
20
|
}
|
|
21
|
-
}, cancelButtonProps), texts
|
|
21
|
+
}, cancelButtonProps), texts == null ? void 0 : texts.cancel), /*#__PURE__*/React.createElement(Button, _extends({
|
|
22
22
|
type: "primary",
|
|
23
23
|
disabled: disabled,
|
|
24
24
|
onClick: onConfirm,
|
|
25
25
|
onFocus: function onFocus(e) {
|
|
26
26
|
return e.stopPropagation();
|
|
27
27
|
}
|
|
28
|
-
}, addButtonProps), texts
|
|
28
|
+
}, addButtonProps), texts == null ? void 0 : texts.add));
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
export default ButtonPanel;
|
|
@@ -6,9 +6,9 @@ var NavigationHint = function NavigationHint(_ref) {
|
|
|
6
6
|
var texts = _ref.texts;
|
|
7
7
|
return /*#__PURE__*/React.createElement(S.NavigationWrapper, null, /*#__PURE__*/React.createElement(Icon, {
|
|
8
8
|
component: /*#__PURE__*/React.createElement(KeyboardKeysM, null)
|
|
9
|
-
}), /*#__PURE__*/React.createElement("span", null, texts
|
|
9
|
+
}), /*#__PURE__*/React.createElement("span", null, texts == null ? void 0 : texts.toNavigate), /*#__PURE__*/React.createElement(Icon, {
|
|
10
10
|
component: /*#__PURE__*/React.createElement(KeyboardEnterM, null)
|
|
11
|
-
}), /*#__PURE__*/React.createElement("span", null, texts
|
|
11
|
+
}), /*#__PURE__*/React.createElement("span", null, texts == null ? void 0 : texts.toSelect));
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
export default NavigationHint;
|
|
@@ -1,15 +1,3 @@
|
|
|
1
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
-
|
|
3
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
-
|
|
5
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
|
-
|
|
7
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
8
|
-
|
|
9
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
10
|
-
|
|
11
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
-
|
|
13
1
|
import * as React from 'react';
|
|
14
2
|
import Scrollbar from '@synerise/ds-scrollbar';
|
|
15
3
|
import SearchItems from '@synerise/ds-search/dist/Elements/SearchItems/SearchItems';
|
|
@@ -41,9 +29,8 @@ var OptionsDropdown = function OptionsDropdown(_ref) {
|
|
|
41
29
|
dropdownItemHeight = _ref.dropdownItemHeight;
|
|
42
30
|
|
|
43
31
|
var _React$useState = React.useState(0),
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
setScrollTop = _React$useState2[1];
|
|
32
|
+
scrollTop = _React$useState[0],
|
|
33
|
+
setScrollTop = _React$useState[1];
|
|
47
34
|
|
|
48
35
|
React.useEffect(function () {
|
|
49
36
|
setScrollTop(0);
|
|
@@ -52,10 +39,10 @@ var OptionsDropdown = function OptionsDropdown(_ref) {
|
|
|
52
39
|
return renderItem ? renderItem(itemValue) : /*#__PURE__*/React.createElement(Menu.Item, {
|
|
53
40
|
tabIndex: -1,
|
|
54
41
|
size: dropdownItemHeight,
|
|
55
|
-
key: ""
|
|
42
|
+
key: "" + itemValue
|
|
56
43
|
}, itemValue[lookupKey]);
|
|
57
44
|
}, [lookupKey, renderItem, dropdownItemHeight]);
|
|
58
|
-
var shouldRenderList = !!(options
|
|
45
|
+
var shouldRenderList = !!(options != null && options.length);
|
|
59
46
|
return /*#__PURE__*/React.createElement(S.DropdownWrapper, {
|
|
60
47
|
onClick: onClick
|
|
61
48
|
}, visible && (customContent ? /*#__PURE__*/React.createElement(S.CustomContentWrapper, null, customContent) : /*#__PURE__*/React.createElement(S.DropdownContent, null, /*#__PURE__*/React.createElement(Scrollbar, {
|
|
@@ -72,7 +59,7 @@ var OptionsDropdown = function OptionsDropdown(_ref) {
|
|
|
72
59
|
mode: "icon-label"
|
|
73
60
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
74
61
|
component: /*#__PURE__*/React.createElement(Add3M, null)
|
|
75
|
-
}), /*#__PURE__*/React.createElement("span", null, texts
|
|
62
|
+
}), /*#__PURE__*/React.createElement("span", null, texts == null ? void 0 : texts.add), /*#__PURE__*/React.createElement("strong", null, value)), shouldRenderList && /*#__PURE__*/React.createElement(S.DividerContainer, null, /*#__PURE__*/React.createElement(Divider, {
|
|
76
63
|
dashed: true
|
|
77
64
|
}))), shouldRenderList && /*#__PURE__*/React.createElement(SearchItems, {
|
|
78
65
|
data: options,
|
|
@@ -10,7 +10,7 @@ var Values = function Values(_ref) {
|
|
|
10
10
|
return /*#__PURE__*/React.createElement(React.Fragment, null, values.map(function (val, index) {
|
|
11
11
|
return /*#__PURE__*/React.createElement(S.CollectorValue, {
|
|
12
12
|
// eslint-disable-next-line react/no-array-index-key
|
|
13
|
-
key:
|
|
13
|
+
key: val + "-" + index,
|
|
14
14
|
onRemoveClick: function onRemoveClick() {
|
|
15
15
|
onDeselect && onDeselect(val);
|
|
16
16
|
},
|
package/dist/utils.js
CHANGED
|
@@ -1,29 +1,35 @@
|
|
|
1
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly)
|
|
1
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
2
2
|
|
|
3
3
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
4
4
|
|
|
5
5
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
6
|
|
|
7
7
|
var INPUT_MIN_WIDTH = 150;
|
|
8
|
-
export var arrayToLowerCase = function arrayToLowerCase() {
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
export var arrayToLowerCase = function arrayToLowerCase(array, lookupKey) {
|
|
9
|
+
if (array === void 0) {
|
|
10
|
+
array = [];
|
|
11
|
+
}
|
|
12
|
+
|
|
11
13
|
return array.map(function (element) {
|
|
12
|
-
|
|
14
|
+
var _objectSpread2;
|
|
15
|
+
|
|
16
|
+
return _objectSpread({}, element, (_objectSpread2 = {}, _objectSpread2[lookupKey] = element[lookupKey] && element[lookupKey].toLowerCase(), _objectSpread2));
|
|
13
17
|
});
|
|
14
18
|
};
|
|
15
|
-
export var scrollWithHorizontalArrow = function scrollWithHorizontalArrow(ref, event) {
|
|
16
|
-
|
|
19
|
+
export var scrollWithHorizontalArrow = function scrollWithHorizontalArrow(ref, event, scrollStep) {
|
|
20
|
+
if (scrollStep === void 0) {
|
|
21
|
+
scrollStep = 200;
|
|
22
|
+
}
|
|
17
23
|
|
|
18
24
|
if (event.key === 'ArrowLeft') {
|
|
19
|
-
(ref
|
|
25
|
+
(ref == null ? void 0 : ref.current) && ref.current.scrollBy({
|
|
20
26
|
left: -scrollStep,
|
|
21
27
|
behavior: 'smooth'
|
|
22
28
|
});
|
|
23
29
|
}
|
|
24
30
|
|
|
25
31
|
if (event.key === 'ArrowRight') {
|
|
26
|
-
(ref
|
|
32
|
+
(ref == null ? void 0 : ref.current) && ref.current.scrollBy({
|
|
27
33
|
left: scrollStep,
|
|
28
34
|
behavior: 'smooth'
|
|
29
35
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-collector",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.4",
|
|
4
4
|
"description": "Collector UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -32,14 +32,14 @@
|
|
|
32
32
|
],
|
|
33
33
|
"types": "dist/index.d.ts",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@synerise/ds-button": "^0.16.
|
|
36
|
-
"@synerise/ds-input": "^0.18.
|
|
37
|
-
"@synerise/ds-search": "^0.6.
|
|
35
|
+
"@synerise/ds-button": "^0.16.2",
|
|
36
|
+
"@synerise/ds-input": "^0.18.2",
|
|
37
|
+
"@synerise/ds-search": "^0.6.4",
|
|
38
38
|
"classnames": "^2.2.6"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"@synerise/ds-core": "*",
|
|
42
42
|
"react": ">=16.9.0 < 17.0.0"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "3e5f807c3c9ce7bbcb707b1e229ad5d7ef50d830"
|
|
45
45
|
}
|