carbon-addons-iot-react 2.98.2 → 2.100.1
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/css/carbon-addons-iot-react.css +39 -33
- package/css/carbon-addons-iot-react.css.map +1 -1
- package/es/node_modules/carbon-components-react/es/components/ListBox/ListBox.js +98 -0
- package/es/node_modules/carbon-components-react/es/components/ListBox/ListBoxField.js +57 -0
- package/es/node_modules/carbon-components-react/es/components/ListBox/ListBoxMenu.js +43 -0
- package/es/node_modules/carbon-components-react/es/components/ListBox/ListBoxMenuIcon.js +55 -0
- package/es/node_modules/carbon-components-react/es/components/ListBox/ListBoxMenuItem.js +58 -0
- package/es/node_modules/carbon-components-react/es/components/ListBox/ListBoxPropTypes.js +12 -0
- package/es/node_modules/carbon-components-react/es/components/ListBox/ListBoxSelection.js +96 -0
- package/es/node_modules/carbon-components-react/es/components/ListBox/index.js +21 -0
- package/es/node_modules/carbon-components-react/es/prop-types/childrenOfType.js +36 -0
- package/es/node_modules/carbon-components-react/es/prop-types/tools/createChainableTypeChecker.js +38 -0
- package/es/node_modules/carbon-components-react/es/prop-types/tools/getDisplayName.js +37 -0
- package/es/src/components/ComboBox/CarbonComboBox.jsx +882 -0
- package/es/src/components/ComboBox/ComboBox.jsx +375 -0
- package/es/src/components/ComposedModal/ComposedModal.jsx +5 -1
- package/es/src/index.js +2 -1
- package/lib/css/carbon-addons-iot-react.css +39 -33
- package/lib/css/carbon-addons-iot-react.css.map +1 -1
- package/lib/node_modules/carbon-components-react/es/components/ListBox/ListBox.js +103 -0
- package/lib/node_modules/carbon-components-react/es/components/ListBox/ListBoxField.js +62 -0
- package/lib/node_modules/carbon-components-react/es/components/ListBox/ListBoxMenu.js +48 -0
- package/lib/node_modules/carbon-components-react/es/components/ListBox/ListBoxMenuIcon.js +60 -0
- package/lib/node_modules/carbon-components-react/es/components/ListBox/ListBoxMenuItem.js +63 -0
- package/lib/node_modules/carbon-components-react/es/components/ListBox/ListBoxPropTypes.js +17 -0
- package/lib/node_modules/carbon-components-react/es/components/ListBox/ListBoxSelection.js +101 -0
- package/lib/node_modules/carbon-components-react/es/components/ListBox/index.js +23 -0
- package/lib/node_modules/carbon-components-react/es/prop-types/childrenOfType.js +41 -0
- package/lib/node_modules/carbon-components-react/es/prop-types/tools/createChainableTypeChecker.js +40 -0
- package/lib/node_modules/carbon-components-react/es/prop-types/tools/getDisplayName.js +39 -0
- package/lib/scss/components/ComboBox/_combo-box.scss +43 -0
- package/lib/scss/components/ComposedModal/_composed-modal.scss +5 -0
- package/lib/scss/components/Tag/_tag.scss +11 -0
- package/lib/scss/styles.scss +1 -44
- package/lib/src/components/ComboBox/CarbonComboBox.jsx +889 -0
- package/lib/src/components/ComboBox/ComboBox.jsx +380 -0
- package/lib/src/components/ComposedModal/ComposedModal.jsx +5 -1
- package/lib/src/index.js +2 -1
- package/package.json +7 -5
- package/scss/components/ComboBox/_combo-box.scss +43 -0
- package/scss/components/ComposedModal/_composed-modal.scss +5 -0
- package/scss/components/Tag/_tag.scss +11 -0
- package/scss/styles.scss +1 -44
- package/umd/carbon-addons-iot-react.js +3327 -237
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
|
4
|
+
|
|
5
|
+
var carbonComponentsReact = require('carbon-components-react');
|
|
6
|
+
var PropTypes = _interopDefault(require('prop-types'));
|
|
7
|
+
var React = require('react');
|
|
8
|
+
var React__default = _interopDefault(React);
|
|
9
|
+
var classnames = _interopDefault(require('classnames'));
|
|
10
|
+
require('core-js/modules/es.symbol');
|
|
11
|
+
require('core-js/modules/es.array.filter');
|
|
12
|
+
require('core-js/modules/es.array.for-each');
|
|
13
|
+
require('core-js/modules/es.object.get-own-property-descriptor');
|
|
14
|
+
require('core-js/modules/es.object.get-own-property-descriptors');
|
|
15
|
+
require('core-js/modules/es.object.keys');
|
|
16
|
+
require('core-js/modules/web.dom-collections.for-each');
|
|
17
|
+
var _defineProperty = _interopDefault(require('@babel/runtime/helpers/defineProperty'));
|
|
18
|
+
var __chunk_1 = require('../../constants/Settings.js');
|
|
19
|
+
require('core-js/modules/es.array.concat');
|
|
20
|
+
var _objectWithoutProperties = _interopDefault(require('@babel/runtime/helpers/objectWithoutProperties'));
|
|
21
|
+
var _toConsumableArray = _interopDefault(require('@babel/runtime/helpers/toConsumableArray'));
|
|
22
|
+
require('core-js/modules/es.array.map');
|
|
23
|
+
require('core-js/modules/es.array.slice');
|
|
24
|
+
var _slicedToArray = _interopDefault(require('@babel/runtime/helpers/slicedToArray'));
|
|
25
|
+
require('core-js/modules/es.array.join');
|
|
26
|
+
require('core-js/modules/es.array.reduce');
|
|
27
|
+
require('core-js/modules/es.regexp.exec');
|
|
28
|
+
var __chunk_18 = require('../../internal/deprecate.js');
|
|
29
|
+
require('core-js/modules/es.array.splice');
|
|
30
|
+
require('core-js/modules/es.string.trim');
|
|
31
|
+
require('core-js/modules/es.string.split');
|
|
32
|
+
require('core-js/modules/es.array.index-of');
|
|
33
|
+
require('core-js/modules/es.string.starts-with');
|
|
34
|
+
var __chunk_198 = require('./CarbonComboBox.jsx');
|
|
35
|
+
|
|
36
|
+
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; }
|
|
37
|
+
|
|
38
|
+
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; }
|
|
39
|
+
var iotPrefix = __chunk_1.settings.iotPrefix;
|
|
40
|
+
|
|
41
|
+
var propTypes = _objectSpread({}, __chunk_198.default.propTypes, {
|
|
42
|
+
loading: PropTypes.bool,
|
|
43
|
+
// Callback that is called with the value of the input on change
|
|
44
|
+
onChange: PropTypes.func.isRequired,
|
|
45
|
+
// OPtional classname to be applied to wrapper
|
|
46
|
+
wrapperClassName: PropTypes.string,
|
|
47
|
+
// String to pass to input field option
|
|
48
|
+
editOptionText: PropTypes.string,
|
|
49
|
+
// String to pass for tags close button aria-label. Will be prepended to value name
|
|
50
|
+
closeButtonText: PropTypes.string,
|
|
51
|
+
// Bit that will allow mult value and tag feature
|
|
52
|
+
hasMultiValue: __chunk_18.default(PropTypes.bool, '\nThe prop `hasMultiValue` for Combobox is experimental. The functionality that is enabled by this prop is subject to change until Combobbox moves out of experimental.')
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
var defaultProps = _objectSpread({}, __chunk_198.default.defaultProps, {
|
|
56
|
+
loading: false,
|
|
57
|
+
wrapperClassName: null,
|
|
58
|
+
closeButtonText: 'Close',
|
|
59
|
+
editOptionText: '-Create',
|
|
60
|
+
hasMultiValue: false,
|
|
61
|
+
items: []
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
var ComboBox = function ComboBox(_ref) {
|
|
65
|
+
var loading = _ref.loading,
|
|
66
|
+
wrapperClassName = _ref.wrapperClassName,
|
|
67
|
+
closeButtonText = _ref.closeButtonText,
|
|
68
|
+
editOptionText = _ref.editOptionText,
|
|
69
|
+
hasMultiValue = _ref.hasMultiValue,
|
|
70
|
+
onChange = _ref.onChange,
|
|
71
|
+
comboProps = _objectWithoutProperties(_ref, ["loading", "wrapperClassName", "closeButtonText", "editOptionText", "hasMultiValue", "onChange"]);
|
|
72
|
+
|
|
73
|
+
var items = comboProps.items,
|
|
74
|
+
ariaLabel = comboProps.ariaLabel,
|
|
75
|
+
className = comboProps.className,
|
|
76
|
+
disabled = comboProps.disabled,
|
|
77
|
+
id = comboProps.id,
|
|
78
|
+
initialSelectedItem = comboProps.initialSelectedItem,
|
|
79
|
+
downshiftProps = comboProps.downshiftProps,
|
|
80
|
+
itemToString = comboProps.itemToString,
|
|
81
|
+
itemToElement = comboProps.itemToElement,
|
|
82
|
+
placeholder = comboProps.placeholder,
|
|
83
|
+
shouldFilterItem = comboProps.shouldFilterItem,
|
|
84
|
+
type = comboProps.type,
|
|
85
|
+
invalid = comboProps.invalid,
|
|
86
|
+
invalidText = comboProps.invalidText,
|
|
87
|
+
translateWithId = comboProps.translateWithId,
|
|
88
|
+
size = comboProps.size,
|
|
89
|
+
onInputChange = comboProps.onInputChange,
|
|
90
|
+
light = comboProps.light,
|
|
91
|
+
direction = comboProps.direction; // Ref for the combobox input
|
|
92
|
+
|
|
93
|
+
var comboRef = /*#__PURE__*/React__default.createRef(); // Input value that is added to list
|
|
94
|
+
|
|
95
|
+
var _useState = React.useState(''),
|
|
96
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
97
|
+
inputValue = _useState2[0],
|
|
98
|
+
setInputValue = _useState2[1]; // Current selected item that shows in the input
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
var _useState3 = React.useState(null),
|
|
102
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
103
|
+
selectedItem = _useState4[0],
|
|
104
|
+
setSelectedItem = _useState4[1]; // Array that populates list
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
var _useState5 = React.useState(items),
|
|
108
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
109
|
+
listItems = _useState6[0],
|
|
110
|
+
setListItems = _useState6[1]; // Array that populates tags
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
var _useState7 = React.useState([]),
|
|
114
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
115
|
+
tagItems = _useState8[0],
|
|
116
|
+
setTagItems = _useState8[1]; // Highlighted index for list dropdown
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
var _useState9 = React.useState(-1),
|
|
120
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
121
|
+
highlightedIndex = _useState10[0],
|
|
122
|
+
setHighlightedIndex = _useState10[1];
|
|
123
|
+
|
|
124
|
+
React.useEffect(function () {
|
|
125
|
+
// If there are tags then clear and focus the input
|
|
126
|
+
if (hasMultiValue) {
|
|
127
|
+
setSelectedItem(null);
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
var handleOnClose = function handleOnClose(e) {
|
|
132
|
+
var _e$currentTarget$pare, _e$currentTarget$pare2, _e$currentTarget$pare3, _e$currentTarget$pare4, _e$currentTarget$pare5, _e$currentTarget$pare6, _e$currentTarget$pare7, _e$currentTarget$pare8;
|
|
133
|
+
|
|
134
|
+
// Get close target's text
|
|
135
|
+
var closedValue = (_e$currentTarget$pare = e.currentTarget.parentNode) === null || _e$currentTarget$pare === void 0 ? void 0 : (_e$currentTarget$pare2 = _e$currentTarget$pare.children[0]) === null || _e$currentTarget$pare2 === void 0 ? void 0 : _e$currentTarget$pare2.textContent; // If there is a tag with the same value then remove from tag array
|
|
136
|
+
|
|
137
|
+
tagItems.forEach(function (item, idx) {
|
|
138
|
+
if (itemToString(item) === closedValue) {
|
|
139
|
+
tagItems.splice(idx, 1);
|
|
140
|
+
setTagItems(_toConsumableArray(tagItems));
|
|
141
|
+
}
|
|
142
|
+
}); // Send new value to users onChange callback
|
|
143
|
+
|
|
144
|
+
onChange(_toConsumableArray(tagItems)); // eslint-disable-next-line no-unused-expressions
|
|
145
|
+
|
|
146
|
+
(_e$currentTarget$pare3 = e.currentTarget.parentNode) === null || _e$currentTarget$pare3 === void 0 ? void 0 : (_e$currentTarget$pare4 = _e$currentTarget$pare3.parentNode) === null || _e$currentTarget$pare4 === void 0 ? void 0 : (_e$currentTarget$pare5 = _e$currentTarget$pare4.parentNode) === null || _e$currentTarget$pare5 === void 0 ? void 0 : (_e$currentTarget$pare6 = _e$currentTarget$pare5.firstChild) === null || _e$currentTarget$pare6 === void 0 ? void 0 : (_e$currentTarget$pare7 = _e$currentTarget$pare6.children[0]) === null || _e$currentTarget$pare7 === void 0 ? void 0 : (_e$currentTarget$pare8 = _e$currentTarget$pare7.children[1]) === null || _e$currentTarget$pare8 === void 0 ? void 0 : _e$currentTarget$pare8.focus();
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
var handleOnChange = function handleOnChange(_ref2) {
|
|
150
|
+
var downShiftSelectedItem = _ref2.selectedItem;
|
|
151
|
+
var newItem = downShiftSelectedItem && Object.keys(downShiftSelectedItem).reduce(function (acc, currentId) {
|
|
152
|
+
return _objectSpread({}, acc, _defineProperty({}, currentId, downShiftSelectedItem[currentId].trim()));
|
|
153
|
+
}, {});
|
|
154
|
+
var currentValue = itemToString(newItem); // Check that there is no existing tag
|
|
155
|
+
|
|
156
|
+
var hasNoExistingTag = tagItems.filter(function (x) {
|
|
157
|
+
return itemToString(x) === currentValue;
|
|
158
|
+
}).length < 1; // Check if value is part of items array
|
|
159
|
+
|
|
160
|
+
var matchedItem = listItems.filter(function (x) {
|
|
161
|
+
return itemToString(x).trim() === currentValue;
|
|
162
|
+
})[0];
|
|
163
|
+
|
|
164
|
+
if (hasMultiValue) {
|
|
165
|
+
// If tags array does not contain new value
|
|
166
|
+
if (newItem && hasNoExistingTag) {
|
|
167
|
+
// Add new value to tags array
|
|
168
|
+
setTagItems(function (inputValues) {
|
|
169
|
+
return [].concat(_toConsumableArray(inputValues), [newItem]);
|
|
170
|
+
}); // pass the combobox value to user's onChange callback
|
|
171
|
+
|
|
172
|
+
onChange([].concat(_toConsumableArray(tagItems), [newItem]));
|
|
173
|
+
}
|
|
174
|
+
} else {
|
|
175
|
+
onChange(newItem);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
if ((newItem === null || newItem === void 0 ? void 0 : newItem.id.startsWith("".concat(iotPrefix, "-input-"))) && !matchedItem) {
|
|
179
|
+
// Add new item to items array
|
|
180
|
+
setListItems(function (currentList) {
|
|
181
|
+
return [newItem].concat(_toConsumableArray(currentList));
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
setSelectedItem(newItem);
|
|
186
|
+
setInputValue(null);
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
var handleOnKeypress = function handleOnKeypress(evt) {
|
|
190
|
+
// Current value of input
|
|
191
|
+
var currentValue = comboRef.current.textInput.current.value.trim();
|
|
192
|
+
|
|
193
|
+
if (evt.key === 'Enter' && currentValue && highlightedIndex < 0) {
|
|
194
|
+
var newItem = {
|
|
195
|
+
id: "".concat(iotPrefix, "-input-").concat(currentValue.split(' ').join('-'), "-").concat(currentValue.length),
|
|
196
|
+
text: currentValue
|
|
197
|
+
};
|
|
198
|
+
handleOnChange({
|
|
199
|
+
selectedItem: newItem
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
var handleInputChange = function handleInputChange(e) {
|
|
205
|
+
var matchedItem = listItems.filter(function (x) {
|
|
206
|
+
return itemToString(x) === e;
|
|
207
|
+
})[0];
|
|
208
|
+
|
|
209
|
+
if (e !== '' && !matchedItem) {
|
|
210
|
+
setInputValue({
|
|
211
|
+
id: "".concat(iotPrefix, "-input-").concat(e.split(' ').join('-'), "-").concat(e.length),
|
|
212
|
+
text: e
|
|
213
|
+
});
|
|
214
|
+
} else {
|
|
215
|
+
setInputValue(null);
|
|
216
|
+
} // Pass on to user callback
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
onInputChange(e);
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
var findHighlightedIndex = function findHighlightedIndex(_ref3, carbonInputValue) {
|
|
223
|
+
var carbonItems = _ref3.items;
|
|
224
|
+
|
|
225
|
+
if (!carbonInputValue) {
|
|
226
|
+
return -1;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
var searchValue = carbonItems[0].id.startsWith("".concat(iotPrefix, "-input")) ? carbonInputValue.slice(0, -1).toLowerCase() : carbonInputValue.toLowerCase(); // eslint-disable-next-line no-plusplus
|
|
230
|
+
|
|
231
|
+
for (var i = 0; i < carbonItems.length; i++) {
|
|
232
|
+
var item = itemToString(carbonItems[i]).toLowerCase();
|
|
233
|
+
|
|
234
|
+
if (item.indexOf(searchValue) !== -1 && searchValue && searchValue.trim() === item.trim()) {
|
|
235
|
+
return i;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
return -1;
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
var combinedItems = React.useMemo(function () {
|
|
243
|
+
return inputValue ? [inputValue].concat(_toConsumableArray(listItems)) : listItems;
|
|
244
|
+
}, [inputValue, listItems]);
|
|
245
|
+
return (
|
|
246
|
+
/*#__PURE__*/
|
|
247
|
+
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
248
|
+
React__default.createElement("div", {
|
|
249
|
+
className: classnames("".concat(iotPrefix, "--combobox"), _defineProperty({}, wrapperClassName, wrapperClassName), _defineProperty({}, "".concat(iotPrefix, "--combobox-add"), inputValue)),
|
|
250
|
+
onKeyDown: function onKeyDown(evt) {
|
|
251
|
+
return handleOnKeypress(evt);
|
|
252
|
+
},
|
|
253
|
+
"data-testid": "combo-wrapper"
|
|
254
|
+
}, /*#__PURE__*/React__default.createElement(__chunk_198.default, {
|
|
255
|
+
"data-testid": "combo-box",
|
|
256
|
+
ariaLabel: ariaLabel,
|
|
257
|
+
id: id,
|
|
258
|
+
type: type,
|
|
259
|
+
placeholder: placeholder,
|
|
260
|
+
shouldFilterItem: shouldFilterItem,
|
|
261
|
+
size: size,
|
|
262
|
+
invalid: invalid,
|
|
263
|
+
light: light,
|
|
264
|
+
direction: direction,
|
|
265
|
+
invalidText: invalidText,
|
|
266
|
+
translateWithId: translateWithId,
|
|
267
|
+
initialSelectedItem: initialSelectedItem,
|
|
268
|
+
downshiftProps: downshiftProps,
|
|
269
|
+
findHighlightedIndex: findHighlightedIndex,
|
|
270
|
+
onHighligtedIndexChange: setHighlightedIndex,
|
|
271
|
+
ref: comboRef,
|
|
272
|
+
selectedItem: comboProps.selectedItem || selectedItem,
|
|
273
|
+
items: combinedItems,
|
|
274
|
+
itemToString: itemToString,
|
|
275
|
+
itemToElement: itemToElement,
|
|
276
|
+
editOptionText: editOptionText,
|
|
277
|
+
onChange: handleOnChange,
|
|
278
|
+
onInputChange: handleInputChange,
|
|
279
|
+
className: classnames(className, "".concat(iotPrefix, "--combobox-input")),
|
|
280
|
+
disabled: disabled || loading !== undefined && loading !== false
|
|
281
|
+
}), /*#__PURE__*/React__default.createElement("ul", {
|
|
282
|
+
"data-testid": "combo-tags",
|
|
283
|
+
className: "".concat(iotPrefix, "--combobox-tags")
|
|
284
|
+
}, tagItems.map(function (item, idx) {
|
|
285
|
+
return /*#__PURE__*/React__default.createElement("li", {
|
|
286
|
+
key: "li-".concat(item === null || item === void 0 ? void 0 : item.id, "-").concat(idx)
|
|
287
|
+
}, /*#__PURE__*/React__default.createElement(carbonComponentsReact.Tag, {
|
|
288
|
+
key: "tag-".concat(item === null || item === void 0 ? void 0 : item.id, "-").concat(idx),
|
|
289
|
+
filter: true,
|
|
290
|
+
onClose: function onClose(e) {
|
|
291
|
+
return handleOnClose(e);
|
|
292
|
+
},
|
|
293
|
+
title: closeButtonText
|
|
294
|
+
}, itemToString(item)));
|
|
295
|
+
})))
|
|
296
|
+
);
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
ComboBox.propTypes = propTypes;
|
|
300
|
+
ComboBox.defaultProps = defaultProps;
|
|
301
|
+
ComboBox.__docgenInfo = {
|
|
302
|
+
"description": "",
|
|
303
|
+
"methods": [],
|
|
304
|
+
"displayName": "ComboBox",
|
|
305
|
+
"props": {
|
|
306
|
+
"loading": {
|
|
307
|
+
"defaultValue": {
|
|
308
|
+
"value": "false",
|
|
309
|
+
"computed": false
|
|
310
|
+
},
|
|
311
|
+
"type": {
|
|
312
|
+
"name": "bool"
|
|
313
|
+
},
|
|
314
|
+
"required": false,
|
|
315
|
+
"description": ""
|
|
316
|
+
},
|
|
317
|
+
"wrapperClassName": {
|
|
318
|
+
"defaultValue": {
|
|
319
|
+
"value": "null",
|
|
320
|
+
"computed": false
|
|
321
|
+
},
|
|
322
|
+
"type": {
|
|
323
|
+
"name": "string"
|
|
324
|
+
},
|
|
325
|
+
"required": false,
|
|
326
|
+
"description": ""
|
|
327
|
+
},
|
|
328
|
+
"closeButtonText": {
|
|
329
|
+
"defaultValue": {
|
|
330
|
+
"value": "'Close'",
|
|
331
|
+
"computed": false
|
|
332
|
+
},
|
|
333
|
+
"type": {
|
|
334
|
+
"name": "string"
|
|
335
|
+
},
|
|
336
|
+
"required": false,
|
|
337
|
+
"description": ""
|
|
338
|
+
},
|
|
339
|
+
"editOptionText": {
|
|
340
|
+
"defaultValue": {
|
|
341
|
+
"value": "'-Create'",
|
|
342
|
+
"computed": false
|
|
343
|
+
},
|
|
344
|
+
"type": {
|
|
345
|
+
"name": "string"
|
|
346
|
+
},
|
|
347
|
+
"required": false,
|
|
348
|
+
"description": ""
|
|
349
|
+
},
|
|
350
|
+
"hasMultiValue": {
|
|
351
|
+
"defaultValue": {
|
|
352
|
+
"value": "false",
|
|
353
|
+
"computed": false
|
|
354
|
+
},
|
|
355
|
+
"type": {
|
|
356
|
+
"name": "custom",
|
|
357
|
+
"raw": "deprecate(\n PropTypes.bool,\n '\\nThe prop `hasMultiValue` for Combobox is experimental. The functionality that is enabled by this prop is subject to change until Combobbox moves out of experimental.'\n)"
|
|
358
|
+
},
|
|
359
|
+
"required": false,
|
|
360
|
+
"description": ""
|
|
361
|
+
},
|
|
362
|
+
"items": {
|
|
363
|
+
"defaultValue": {
|
|
364
|
+
"value": "[]",
|
|
365
|
+
"computed": false
|
|
366
|
+
},
|
|
367
|
+
"required": false
|
|
368
|
+
},
|
|
369
|
+
"onChange": {
|
|
370
|
+
"type": {
|
|
371
|
+
"name": "func"
|
|
372
|
+
},
|
|
373
|
+
"required": true,
|
|
374
|
+
"description": ""
|
|
375
|
+
}
|
|
376
|
+
},
|
|
377
|
+
"composes": ["./CarbonComboBox"]
|
|
378
|
+
};
|
|
379
|
+
|
|
380
|
+
exports.default = ComboBox;
|
|
@@ -8,6 +8,7 @@ var React = require('react');
|
|
|
8
8
|
var React__default = _interopDefault(React);
|
|
9
9
|
var classnames = _interopDefault(require('classnames'));
|
|
10
10
|
var _defineProperty = _interopDefault(require('@babel/runtime/helpers/defineProperty'));
|
|
11
|
+
var __chunk_1 = require('../../constants/Settings.js');
|
|
11
12
|
require('core-js/modules/es.array.concat');
|
|
12
13
|
var _extends = _interopDefault(require('@babel/runtime/helpers/extends'));
|
|
13
14
|
var _objectWithoutProperties = _interopDefault(require('@babel/runtime/helpers/objectWithoutProperties'));
|
|
@@ -54,6 +55,7 @@ function _templateObject() {
|
|
|
54
55
|
|
|
55
56
|
return data;
|
|
56
57
|
}
|
|
58
|
+
var iotPrefix = __chunk_1.settings.iotPrefix;
|
|
57
59
|
var StyledModal = styled(carbonComponentsReact.ComposedModal)(_templateObject(), polished.rem(515), polished.rem(600), polished.rem(800), polished.rem(600), polished.rem(1024), polished.rem(1200), polished.rem(200));
|
|
58
60
|
var StyledMessageBox = styled(carbonComponentsReact.InlineNotification)(_templateObject2(), __chunk_15.PADDING.horizontalWrapPadding, __chunk_15.PADDING.verticalPadding);
|
|
59
61
|
var StyledModalFooter = styled(carbonComponentsReact.ModalFooter)(_templateObject3());
|
|
@@ -230,7 +232,9 @@ var ComposedModal = /*#__PURE__*/function (_React$Component) {
|
|
|
230
232
|
iconDescription: iconDescription
|
|
231
233
|
}, helpText ? /*#__PURE__*/React__default.createElement("p", {
|
|
232
234
|
className: "bx--modal-content__text"
|
|
233
|
-
}, helpText) : null), children ? /*#__PURE__*/React__default.createElement(carbonComponentsReact.ModalBody,
|
|
235
|
+
}, helpText) : null), children ? /*#__PURE__*/React__default.createElement(carbonComponentsReact.ModalBody, {
|
|
236
|
+
className: classnames(_defineProperty({}, "".concat(iotPrefix, "--composed-modal__body--small-margin-bottom"), error))
|
|
237
|
+
}, children) : null, error ? /*#__PURE__*/React__default.createElement(StyledMessageBox, {
|
|
234
238
|
title: error,
|
|
235
239
|
subtitle: "",
|
|
236
240
|
kind: "error",
|
package/lib/src/index.js
CHANGED
|
@@ -76,6 +76,7 @@ var __chunk_183 = require('./components/TileGallery/StatefulTileGallery.jsx');
|
|
|
76
76
|
var __chunk_184 = require('./components/List/SimpleList/SimpleList.jsx');
|
|
77
77
|
var __chunk_185 = require('./components/IconSwitch/IconSwitch.jsx');
|
|
78
78
|
var __chunk_186 = require('./components/Accordion/AccordionItemDefer.jsx');
|
|
79
|
+
var __chunk_199 = require('./components/ComboBox/ComboBox.jsx');
|
|
79
80
|
|
|
80
81
|
// Needed so that any component that uses sizeme can be jest tested
|
|
81
82
|
withSize.noPlaceholders = true; // Components
|
|
@@ -86,7 +87,6 @@ exports.Accordion = carbonComponentsReact.Accordion;
|
|
|
86
87
|
exports.AccordionItem = carbonComponentsReact.AccordionItem;
|
|
87
88
|
exports.Checkbox = carbonComponentsReact.Checkbox;
|
|
88
89
|
exports.CodeSnippet = carbonComponentsReact.CodeSnippet;
|
|
89
|
-
exports.ComboBox = carbonComponentsReact.ComboBox;
|
|
90
90
|
exports.ModalHeader = carbonComponentsReact.ModalHeader;
|
|
91
91
|
exports.ModalBody = carbonComponentsReact.ModalBody;
|
|
92
92
|
exports.ModalFooter = carbonComponentsReact.ModalFooter;
|
|
@@ -303,3 +303,4 @@ exports.SimpleList = __chunk_184.default;
|
|
|
303
303
|
exports.IconSwitch = __chunk_185.default;
|
|
304
304
|
exports.ICON_SWITCH_SIZES = __chunk_185.ICON_SWITCH_SIZES;
|
|
305
305
|
exports.AccordionItemDefer = __chunk_186.default;
|
|
306
|
+
exports.ComboBox = __chunk_199.default;
|
package/package.json
CHANGED
|
@@ -32,7 +32,6 @@
|
|
|
32
32
|
"lint": "yarn lint:javascript && yarn lint:stylelint",
|
|
33
33
|
"lint:javascript": "eslint --ext .jsx --ext .js .",
|
|
34
34
|
"lint:stylelint": "stylelint './src/**/*.scss' --syntax scss --ignorePath .gitignore",
|
|
35
|
-
"prepare": "yarn build",
|
|
36
35
|
"publish-npm": "yarn semantic-release",
|
|
37
36
|
"start": "yarn test:engines && yarn storybook",
|
|
38
37
|
"storybook": "yarn test:engines && start-storybook -p 3000 -s public/development",
|
|
@@ -89,6 +88,7 @@
|
|
|
89
88
|
"carbon-icons": "^7.0.7",
|
|
90
89
|
"classnames": "^2.2.5",
|
|
91
90
|
"core-js": "3.6.5",
|
|
91
|
+
"downshift": "^1.31.14",
|
|
92
92
|
"immutability-helper": "^2.9.0",
|
|
93
93
|
"js-file-download": "^0.4.7",
|
|
94
94
|
"lodash": "^4.17.13",
|
|
@@ -147,9 +147,10 @@
|
|
|
147
147
|
"@storybook/addon-storyshots": "^5.3.17",
|
|
148
148
|
"@storybook/addons": "^5.3.17",
|
|
149
149
|
"@storybook/react": "^5.3.17",
|
|
150
|
-
"@testing-library/dom": "^7.
|
|
151
|
-
"@testing-library/jest-dom": "^5.
|
|
152
|
-
"@testing-library/react": "^10.
|
|
150
|
+
"@testing-library/dom": "^7.12.0",
|
|
151
|
+
"@testing-library/jest-dom": "^5.10.0",
|
|
152
|
+
"@testing-library/react": "^10.2.1",
|
|
153
|
+
"@testing-library/user-event": "^11.4.2",
|
|
153
154
|
"accessibility-checker": "^3.0.5",
|
|
154
155
|
"autoprefixer": "^9.4.4",
|
|
155
156
|
"babel-core": "^7.0.0-bridge.0",
|
|
@@ -181,6 +182,7 @@
|
|
|
181
182
|
"eslint-plugin-prettier": "^3.0.1",
|
|
182
183
|
"eslint-plugin-react": "^7.12.2",
|
|
183
184
|
"eslint-plugin-react-hooks": "^1.5.0",
|
|
185
|
+
"eslint-plugin-testing-library": "^3.3.1",
|
|
184
186
|
"eslint-plugin-unicorn": "^20.1.0",
|
|
185
187
|
"faker": "^4.1.0",
|
|
186
188
|
"fast-sass-loader": "^1.5.0",
|
|
@@ -228,5 +230,5 @@
|
|
|
228
230
|
"whatwg-fetch": "^3.0.0"
|
|
229
231
|
},
|
|
230
232
|
"sideEffects": false,
|
|
231
|
-
"version": "2.
|
|
233
|
+
"version": "2.100.1"
|
|
232
234
|
}
|
|
@@ -1 +1,44 @@
|
|
|
1
1
|
@import '~carbon-components/scss/components/combo-box/combo-box';
|
|
2
|
+
|
|
3
|
+
.#{$iot-prefix}--combobox {
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-flow: column-reverse;
|
|
6
|
+
position: relative;
|
|
7
|
+
padding-top: $spacing-08;
|
|
8
|
+
|
|
9
|
+
.#{$prefix}--form__helper-text,
|
|
10
|
+
.#{$prefix}--label {
|
|
11
|
+
bottom: 100%;
|
|
12
|
+
position: absolute;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.#{$prefix}--label {
|
|
16
|
+
transform: translateY(25px);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.#{$prefix}--form__helper-text {
|
|
20
|
+
transform: translateY(40px);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&-tags {
|
|
24
|
+
margin-bottom: $spacing-03;
|
|
25
|
+
|
|
26
|
+
li {
|
|
27
|
+
display: inline-block;
|
|
28
|
+
max-width: 100%;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&.#{$iot-prefix}--combobox-add {
|
|
33
|
+
.#{$prefix}--list-box__menu-item:first-child {
|
|
34
|
+
&::after {
|
|
35
|
+
content: attr(data-text);
|
|
36
|
+
color: $text-03;
|
|
37
|
+
position: absolute;
|
|
38
|
+
right: $spacing-03;
|
|
39
|
+
top: 50%;
|
|
40
|
+
transform: translateY(-50%);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
package/scss/styles.scss
CHANGED
|
@@ -104,50 +104,6 @@ $deprecations--reasons: ();
|
|
|
104
104
|
/// @group global-deprecate
|
|
105
105
|
$deprecations--message: 'Deprecated code was found, this code will be removed before the next release of Carbon.';
|
|
106
106
|
|
|
107
|
-
// Font families needed for Charts (not included by carbon by default) TODO: remove once @carbon/types is updated
|
|
108
|
-
@font-face {
|
|
109
|
-
font-family: 'IBM Plex Sans Condensed';
|
|
110
|
-
font-style: italic;
|
|
111
|
-
font-weight: 300;
|
|
112
|
-
src: url(//unpkg.com/@ibm/plex/IBM-Plex-Sans-Condensed/fonts/complete/woff2/IBMPlexSansCondensed-LightItalic.woff2)
|
|
113
|
-
format('woff2');
|
|
114
|
-
}
|
|
115
|
-
@font-face {
|
|
116
|
-
font-family: 'IBM Plex Sans Condensed';
|
|
117
|
-
font-style: italic;
|
|
118
|
-
font-weight: 400;
|
|
119
|
-
src: url(//unpkg.com/@ibm/plex/IBM-Plex-Sans-Condensed/fonts/complete/woff2/IBMPlexSansCondensed-Italic.woff2)
|
|
120
|
-
format('woff2');
|
|
121
|
-
}
|
|
122
|
-
@font-face {
|
|
123
|
-
font-family: 'IBM Plex Sans Condensed';
|
|
124
|
-
font-style: italic;
|
|
125
|
-
font-weight: 600;
|
|
126
|
-
src: url(//unpkg.com/@ibm/plex/IBM-Plex-Sans-Condensed/fonts/complete/woff2/IBMPlexSansCondensed-SemiBoldItalic.woff2)
|
|
127
|
-
format('woff2');
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
@font-face {
|
|
131
|
-
font-family: 'IBM Plex Sans Condensed';
|
|
132
|
-
font-weight: 300;
|
|
133
|
-
src: url(//unpkg.com/@ibm/plex/IBM-Plex-Sans-Condensed/fonts/complete/woff2/IBMPlexSansCondensed-Light.woff2)
|
|
134
|
-
format('woff2');
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
@font-face {
|
|
138
|
-
font-family: 'IBM Plex Sans Condensed';
|
|
139
|
-
font-weight: 400;
|
|
140
|
-
src: url(//unpkg.com/@ibm/plex/IBM-Plex-Sans-Condensed/fonts/complete/woff2/IBMPlexSansCondensed-Regular.woff2)
|
|
141
|
-
format('woff2');
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
@font-face {
|
|
145
|
-
font-family: 'IBM Plex Sans Condensed';
|
|
146
|
-
font-weight: 600;
|
|
147
|
-
src: url(//unpkg.com/@ibm/plex/IBM-Plex-Sans-Condensed/fonts/complete/woff2/IBMPlexSansCondensed-SemiBold.woff2)
|
|
148
|
-
format('woff2');
|
|
149
|
-
}
|
|
150
|
-
|
|
151
107
|
//-------------------------
|
|
152
108
|
// 🍕 Components
|
|
153
109
|
//-------------------------
|
|
@@ -220,6 +176,7 @@ $deprecations--message: 'Deprecated code was found, this code will be removed be
|
|
|
220
176
|
@import 'components/BarChartCard/bar-chart-card';
|
|
221
177
|
@import 'components/Button/button';
|
|
222
178
|
@import 'components/Card/card';
|
|
179
|
+
@import 'components/ComposedModal/composed-modal';
|
|
223
180
|
@import 'components/Dashboard/dashboard';
|
|
224
181
|
@import 'components/DateTimePicker/date-time-picker';
|
|
225
182
|
@import 'components/GaugeCard/gauge-card';
|