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,375 @@
|
|
|
1
|
+
import { Tag } from 'carbon-components-react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import React, { useState, useEffect, useMemo } from 'react';
|
|
4
|
+
import classnames from 'classnames';
|
|
5
|
+
import 'core-js/modules/es.symbol';
|
|
6
|
+
import 'core-js/modules/es.array.filter';
|
|
7
|
+
import 'core-js/modules/es.array.for-each';
|
|
8
|
+
import 'core-js/modules/es.object.get-own-property-descriptor';
|
|
9
|
+
import 'core-js/modules/es.object.get-own-property-descriptors';
|
|
10
|
+
import 'core-js/modules/es.object.keys';
|
|
11
|
+
import 'core-js/modules/web.dom-collections.for-each';
|
|
12
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
13
|
+
import { settings } from '../../constants/Settings.js';
|
|
14
|
+
import 'core-js/modules/es.array.concat';
|
|
15
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
16
|
+
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
17
|
+
import 'core-js/modules/es.array.map';
|
|
18
|
+
import 'core-js/modules/es.array.slice';
|
|
19
|
+
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
20
|
+
import 'core-js/modules/es.array.join';
|
|
21
|
+
import 'core-js/modules/es.array.reduce';
|
|
22
|
+
import 'core-js/modules/es.regexp.exec';
|
|
23
|
+
import deprecate from '../../internal/deprecate.js';
|
|
24
|
+
import 'core-js/modules/es.array.splice';
|
|
25
|
+
import 'core-js/modules/es.string.trim';
|
|
26
|
+
import 'core-js/modules/es.string.split';
|
|
27
|
+
import 'core-js/modules/es.array.index-of';
|
|
28
|
+
import 'core-js/modules/es.string.starts-with';
|
|
29
|
+
import ComboBox from './CarbonComboBox.jsx';
|
|
30
|
+
|
|
31
|
+
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; }
|
|
32
|
+
|
|
33
|
+
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; }
|
|
34
|
+
var iotPrefix = settings.iotPrefix;
|
|
35
|
+
|
|
36
|
+
var propTypes = _objectSpread({}, ComboBox.propTypes, {
|
|
37
|
+
loading: PropTypes.bool,
|
|
38
|
+
// Callback that is called with the value of the input on change
|
|
39
|
+
onChange: PropTypes.func.isRequired,
|
|
40
|
+
// OPtional classname to be applied to wrapper
|
|
41
|
+
wrapperClassName: PropTypes.string,
|
|
42
|
+
// String to pass to input field option
|
|
43
|
+
editOptionText: PropTypes.string,
|
|
44
|
+
// String to pass for tags close button aria-label. Will be prepended to value name
|
|
45
|
+
closeButtonText: PropTypes.string,
|
|
46
|
+
// Bit that will allow mult value and tag feature
|
|
47
|
+
hasMultiValue: deprecate(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.')
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
var defaultProps = _objectSpread({}, ComboBox.defaultProps, {
|
|
51
|
+
loading: false,
|
|
52
|
+
wrapperClassName: null,
|
|
53
|
+
closeButtonText: 'Close',
|
|
54
|
+
editOptionText: '-Create',
|
|
55
|
+
hasMultiValue: false,
|
|
56
|
+
items: []
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
var ComboBox$1 = function ComboBox$$1(_ref) {
|
|
60
|
+
var loading = _ref.loading,
|
|
61
|
+
wrapperClassName = _ref.wrapperClassName,
|
|
62
|
+
closeButtonText = _ref.closeButtonText,
|
|
63
|
+
editOptionText = _ref.editOptionText,
|
|
64
|
+
hasMultiValue = _ref.hasMultiValue,
|
|
65
|
+
onChange = _ref.onChange,
|
|
66
|
+
comboProps = _objectWithoutProperties(_ref, ["loading", "wrapperClassName", "closeButtonText", "editOptionText", "hasMultiValue", "onChange"]);
|
|
67
|
+
|
|
68
|
+
var items = comboProps.items,
|
|
69
|
+
ariaLabel = comboProps.ariaLabel,
|
|
70
|
+
className = comboProps.className,
|
|
71
|
+
disabled = comboProps.disabled,
|
|
72
|
+
id = comboProps.id,
|
|
73
|
+
initialSelectedItem = comboProps.initialSelectedItem,
|
|
74
|
+
downshiftProps = comboProps.downshiftProps,
|
|
75
|
+
itemToString = comboProps.itemToString,
|
|
76
|
+
itemToElement = comboProps.itemToElement,
|
|
77
|
+
placeholder = comboProps.placeholder,
|
|
78
|
+
shouldFilterItem = comboProps.shouldFilterItem,
|
|
79
|
+
type = comboProps.type,
|
|
80
|
+
invalid = comboProps.invalid,
|
|
81
|
+
invalidText = comboProps.invalidText,
|
|
82
|
+
translateWithId = comboProps.translateWithId,
|
|
83
|
+
size = comboProps.size,
|
|
84
|
+
onInputChange = comboProps.onInputChange,
|
|
85
|
+
light = comboProps.light,
|
|
86
|
+
direction = comboProps.direction; // Ref for the combobox input
|
|
87
|
+
|
|
88
|
+
var comboRef = /*#__PURE__*/React.createRef(); // Input value that is added to list
|
|
89
|
+
|
|
90
|
+
var _useState = useState(''),
|
|
91
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
92
|
+
inputValue = _useState2[0],
|
|
93
|
+
setInputValue = _useState2[1]; // Current selected item that shows in the input
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
var _useState3 = useState(null),
|
|
97
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
98
|
+
selectedItem = _useState4[0],
|
|
99
|
+
setSelectedItem = _useState4[1]; // Array that populates list
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
var _useState5 = useState(items),
|
|
103
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
104
|
+
listItems = _useState6[0],
|
|
105
|
+
setListItems = _useState6[1]; // Array that populates tags
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
var _useState7 = useState([]),
|
|
109
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
110
|
+
tagItems = _useState8[0],
|
|
111
|
+
setTagItems = _useState8[1]; // Highlighted index for list dropdown
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
var _useState9 = useState(-1),
|
|
115
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
116
|
+
highlightedIndex = _useState10[0],
|
|
117
|
+
setHighlightedIndex = _useState10[1];
|
|
118
|
+
|
|
119
|
+
useEffect(function () {
|
|
120
|
+
// If there are tags then clear and focus the input
|
|
121
|
+
if (hasMultiValue) {
|
|
122
|
+
setSelectedItem(null);
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
var handleOnClose = function handleOnClose(e) {
|
|
127
|
+
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;
|
|
128
|
+
|
|
129
|
+
// Get close target's text
|
|
130
|
+
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
|
|
131
|
+
|
|
132
|
+
tagItems.forEach(function (item, idx) {
|
|
133
|
+
if (itemToString(item) === closedValue) {
|
|
134
|
+
tagItems.splice(idx, 1);
|
|
135
|
+
setTagItems(_toConsumableArray(tagItems));
|
|
136
|
+
}
|
|
137
|
+
}); // Send new value to users onChange callback
|
|
138
|
+
|
|
139
|
+
onChange(_toConsumableArray(tagItems)); // eslint-disable-next-line no-unused-expressions
|
|
140
|
+
|
|
141
|
+
(_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();
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
var handleOnChange = function handleOnChange(_ref2) {
|
|
145
|
+
var downShiftSelectedItem = _ref2.selectedItem;
|
|
146
|
+
var newItem = downShiftSelectedItem && Object.keys(downShiftSelectedItem).reduce(function (acc, currentId) {
|
|
147
|
+
return _objectSpread({}, acc, _defineProperty({}, currentId, downShiftSelectedItem[currentId].trim()));
|
|
148
|
+
}, {});
|
|
149
|
+
var currentValue = itemToString(newItem); // Check that there is no existing tag
|
|
150
|
+
|
|
151
|
+
var hasNoExistingTag = tagItems.filter(function (x) {
|
|
152
|
+
return itemToString(x) === currentValue;
|
|
153
|
+
}).length < 1; // Check if value is part of items array
|
|
154
|
+
|
|
155
|
+
var matchedItem = listItems.filter(function (x) {
|
|
156
|
+
return itemToString(x).trim() === currentValue;
|
|
157
|
+
})[0];
|
|
158
|
+
|
|
159
|
+
if (hasMultiValue) {
|
|
160
|
+
// If tags array does not contain new value
|
|
161
|
+
if (newItem && hasNoExistingTag) {
|
|
162
|
+
// Add new value to tags array
|
|
163
|
+
setTagItems(function (inputValues) {
|
|
164
|
+
return [].concat(_toConsumableArray(inputValues), [newItem]);
|
|
165
|
+
}); // pass the combobox value to user's onChange callback
|
|
166
|
+
|
|
167
|
+
onChange([].concat(_toConsumableArray(tagItems), [newItem]));
|
|
168
|
+
}
|
|
169
|
+
} else {
|
|
170
|
+
onChange(newItem);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
if ((newItem === null || newItem === void 0 ? void 0 : newItem.id.startsWith("".concat(iotPrefix, "-input-"))) && !matchedItem) {
|
|
174
|
+
// Add new item to items array
|
|
175
|
+
setListItems(function (currentList) {
|
|
176
|
+
return [newItem].concat(_toConsumableArray(currentList));
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
setSelectedItem(newItem);
|
|
181
|
+
setInputValue(null);
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
var handleOnKeypress = function handleOnKeypress(evt) {
|
|
185
|
+
// Current value of input
|
|
186
|
+
var currentValue = comboRef.current.textInput.current.value.trim();
|
|
187
|
+
|
|
188
|
+
if (evt.key === 'Enter' && currentValue && highlightedIndex < 0) {
|
|
189
|
+
var newItem = {
|
|
190
|
+
id: "".concat(iotPrefix, "-input-").concat(currentValue.split(' ').join('-'), "-").concat(currentValue.length),
|
|
191
|
+
text: currentValue
|
|
192
|
+
};
|
|
193
|
+
handleOnChange({
|
|
194
|
+
selectedItem: newItem
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
var handleInputChange = function handleInputChange(e) {
|
|
200
|
+
var matchedItem = listItems.filter(function (x) {
|
|
201
|
+
return itemToString(x) === e;
|
|
202
|
+
})[0];
|
|
203
|
+
|
|
204
|
+
if (e !== '' && !matchedItem) {
|
|
205
|
+
setInputValue({
|
|
206
|
+
id: "".concat(iotPrefix, "-input-").concat(e.split(' ').join('-'), "-").concat(e.length),
|
|
207
|
+
text: e
|
|
208
|
+
});
|
|
209
|
+
} else {
|
|
210
|
+
setInputValue(null);
|
|
211
|
+
} // Pass on to user callback
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
onInputChange(e);
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
var findHighlightedIndex = function findHighlightedIndex(_ref3, carbonInputValue) {
|
|
218
|
+
var carbonItems = _ref3.items;
|
|
219
|
+
|
|
220
|
+
if (!carbonInputValue) {
|
|
221
|
+
return -1;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
var searchValue = carbonItems[0].id.startsWith("".concat(iotPrefix, "-input")) ? carbonInputValue.slice(0, -1).toLowerCase() : carbonInputValue.toLowerCase(); // eslint-disable-next-line no-plusplus
|
|
225
|
+
|
|
226
|
+
for (var i = 0; i < carbonItems.length; i++) {
|
|
227
|
+
var item = itemToString(carbonItems[i]).toLowerCase();
|
|
228
|
+
|
|
229
|
+
if (item.indexOf(searchValue) !== -1 && searchValue && searchValue.trim() === item.trim()) {
|
|
230
|
+
return i;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
return -1;
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
var combinedItems = useMemo(function () {
|
|
238
|
+
return inputValue ? [inputValue].concat(_toConsumableArray(listItems)) : listItems;
|
|
239
|
+
}, [inputValue, listItems]);
|
|
240
|
+
return (
|
|
241
|
+
/*#__PURE__*/
|
|
242
|
+
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
243
|
+
React.createElement("div", {
|
|
244
|
+
className: classnames("".concat(iotPrefix, "--combobox"), _defineProperty({}, wrapperClassName, wrapperClassName), _defineProperty({}, "".concat(iotPrefix, "--combobox-add"), inputValue)),
|
|
245
|
+
onKeyDown: function onKeyDown(evt) {
|
|
246
|
+
return handleOnKeypress(evt);
|
|
247
|
+
},
|
|
248
|
+
"data-testid": "combo-wrapper"
|
|
249
|
+
}, /*#__PURE__*/React.createElement(ComboBox, {
|
|
250
|
+
"data-testid": "combo-box",
|
|
251
|
+
ariaLabel: ariaLabel,
|
|
252
|
+
id: id,
|
|
253
|
+
type: type,
|
|
254
|
+
placeholder: placeholder,
|
|
255
|
+
shouldFilterItem: shouldFilterItem,
|
|
256
|
+
size: size,
|
|
257
|
+
invalid: invalid,
|
|
258
|
+
light: light,
|
|
259
|
+
direction: direction,
|
|
260
|
+
invalidText: invalidText,
|
|
261
|
+
translateWithId: translateWithId,
|
|
262
|
+
initialSelectedItem: initialSelectedItem,
|
|
263
|
+
downshiftProps: downshiftProps,
|
|
264
|
+
findHighlightedIndex: findHighlightedIndex,
|
|
265
|
+
onHighligtedIndexChange: setHighlightedIndex,
|
|
266
|
+
ref: comboRef,
|
|
267
|
+
selectedItem: comboProps.selectedItem || selectedItem,
|
|
268
|
+
items: combinedItems,
|
|
269
|
+
itemToString: itemToString,
|
|
270
|
+
itemToElement: itemToElement,
|
|
271
|
+
editOptionText: editOptionText,
|
|
272
|
+
onChange: handleOnChange,
|
|
273
|
+
onInputChange: handleInputChange,
|
|
274
|
+
className: classnames(className, "".concat(iotPrefix, "--combobox-input")),
|
|
275
|
+
disabled: disabled || loading !== undefined && loading !== false
|
|
276
|
+
}), /*#__PURE__*/React.createElement("ul", {
|
|
277
|
+
"data-testid": "combo-tags",
|
|
278
|
+
className: "".concat(iotPrefix, "--combobox-tags")
|
|
279
|
+
}, tagItems.map(function (item, idx) {
|
|
280
|
+
return /*#__PURE__*/React.createElement("li", {
|
|
281
|
+
key: "li-".concat(item === null || item === void 0 ? void 0 : item.id, "-").concat(idx)
|
|
282
|
+
}, /*#__PURE__*/React.createElement(Tag, {
|
|
283
|
+
key: "tag-".concat(item === null || item === void 0 ? void 0 : item.id, "-").concat(idx),
|
|
284
|
+
filter: true,
|
|
285
|
+
onClose: function onClose(e) {
|
|
286
|
+
return handleOnClose(e);
|
|
287
|
+
},
|
|
288
|
+
title: closeButtonText
|
|
289
|
+
}, itemToString(item)));
|
|
290
|
+
})))
|
|
291
|
+
);
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
ComboBox$1.propTypes = propTypes;
|
|
295
|
+
ComboBox$1.defaultProps = defaultProps;
|
|
296
|
+
ComboBox$1.__docgenInfo = {
|
|
297
|
+
"description": "",
|
|
298
|
+
"methods": [],
|
|
299
|
+
"displayName": "ComboBox",
|
|
300
|
+
"props": {
|
|
301
|
+
"loading": {
|
|
302
|
+
"defaultValue": {
|
|
303
|
+
"value": "false",
|
|
304
|
+
"computed": false
|
|
305
|
+
},
|
|
306
|
+
"type": {
|
|
307
|
+
"name": "bool"
|
|
308
|
+
},
|
|
309
|
+
"required": false,
|
|
310
|
+
"description": ""
|
|
311
|
+
},
|
|
312
|
+
"wrapperClassName": {
|
|
313
|
+
"defaultValue": {
|
|
314
|
+
"value": "null",
|
|
315
|
+
"computed": false
|
|
316
|
+
},
|
|
317
|
+
"type": {
|
|
318
|
+
"name": "string"
|
|
319
|
+
},
|
|
320
|
+
"required": false,
|
|
321
|
+
"description": ""
|
|
322
|
+
},
|
|
323
|
+
"closeButtonText": {
|
|
324
|
+
"defaultValue": {
|
|
325
|
+
"value": "'Close'",
|
|
326
|
+
"computed": false
|
|
327
|
+
},
|
|
328
|
+
"type": {
|
|
329
|
+
"name": "string"
|
|
330
|
+
},
|
|
331
|
+
"required": false,
|
|
332
|
+
"description": ""
|
|
333
|
+
},
|
|
334
|
+
"editOptionText": {
|
|
335
|
+
"defaultValue": {
|
|
336
|
+
"value": "'-Create'",
|
|
337
|
+
"computed": false
|
|
338
|
+
},
|
|
339
|
+
"type": {
|
|
340
|
+
"name": "string"
|
|
341
|
+
},
|
|
342
|
+
"required": false,
|
|
343
|
+
"description": ""
|
|
344
|
+
},
|
|
345
|
+
"hasMultiValue": {
|
|
346
|
+
"defaultValue": {
|
|
347
|
+
"value": "false",
|
|
348
|
+
"computed": false
|
|
349
|
+
},
|
|
350
|
+
"type": {
|
|
351
|
+
"name": "custom",
|
|
352
|
+
"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)"
|
|
353
|
+
},
|
|
354
|
+
"required": false,
|
|
355
|
+
"description": ""
|
|
356
|
+
},
|
|
357
|
+
"items": {
|
|
358
|
+
"defaultValue": {
|
|
359
|
+
"value": "[]",
|
|
360
|
+
"computed": false
|
|
361
|
+
},
|
|
362
|
+
"required": false
|
|
363
|
+
},
|
|
364
|
+
"onChange": {
|
|
365
|
+
"type": {
|
|
366
|
+
"name": "func"
|
|
367
|
+
},
|
|
368
|
+
"required": true,
|
|
369
|
+
"description": ""
|
|
370
|
+
}
|
|
371
|
+
},
|
|
372
|
+
"composes": ["./CarbonComboBox"]
|
|
373
|
+
};
|
|
374
|
+
|
|
375
|
+
export default ComboBox$1;
|
|
@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
import React, { Fragment } from 'react';
|
|
4
4
|
import classnames from 'classnames';
|
|
5
5
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
6
|
+
import { settings } from '../../constants/Settings.js';
|
|
6
7
|
import 'core-js/modules/es.array.concat';
|
|
7
8
|
import _extends from '@babel/runtime/helpers/extends';
|
|
8
9
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
@@ -49,6 +50,7 @@ function _templateObject() {
|
|
|
49
50
|
|
|
50
51
|
return data;
|
|
51
52
|
}
|
|
53
|
+
var iotPrefix = settings.iotPrefix;
|
|
52
54
|
var StyledModal = styled(ComposedModal)(_templateObject(), rem(515), rem(600), rem(800), rem(600), rem(1024), rem(1200), rem(200));
|
|
53
55
|
var StyledMessageBox = styled(InlineNotification)(_templateObject2(), PADDING.horizontalWrapPadding, PADDING.verticalPadding);
|
|
54
56
|
var StyledModalFooter = styled(ModalFooter)(_templateObject3());
|
|
@@ -225,7 +227,9 @@ var ComposedModal$1 = /*#__PURE__*/function (_React$Component) {
|
|
|
225
227
|
iconDescription: iconDescription
|
|
226
228
|
}, helpText ? /*#__PURE__*/React.createElement("p", {
|
|
227
229
|
className: "bx--modal-content__text"
|
|
228
|
-
}, helpText) : null), children ? /*#__PURE__*/React.createElement(ModalBody,
|
|
230
|
+
}, helpText) : null), children ? /*#__PURE__*/React.createElement(ModalBody, {
|
|
231
|
+
className: classnames(_defineProperty({}, "".concat(iotPrefix, "--composed-modal__body--small-margin-bottom"), error))
|
|
232
|
+
}, children) : null, error ? /*#__PURE__*/React.createElement(StyledMessageBox, {
|
|
229
233
|
title: error,
|
|
230
234
|
subtitle: "",
|
|
231
235
|
kind: "error",
|
package/es/src/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import withSize from 'react-sizeme';
|
|
2
|
-
export { BreadcrumbItem, BreadcrumbSkeleton, Accordion, AccordionItem, Checkbox, CodeSnippet,
|
|
2
|
+
export { BreadcrumbItem, BreadcrumbSkeleton, Accordion, AccordionItem, Checkbox, CodeSnippet, ModalHeader, ModalBody, ModalFooter, ContentSwitcher, Copy, CopyButton, DangerButton, DataTable, DatePicker, DatePickerInput, Dropdown, Filename, FileUploader, FileUploaderButton, FileUploaderDropContainer, FileUploaderItem, Form, FormGroup, FormItem, FormLabel, Icon, InlineLoading, Link, ListItem, Loading, Modal, ModalWrapper, MultiSelect, ToastNotification, InlineNotification, NotificationActionButton, NotificationButton, NotificationTextDetails, NumberInput, OrderedList, OverflowMenu, OverflowMenuItem, Pagination, PrimaryButton, ProgressStep, RadioButton, RadioButtonGroup, Search, SearchFilterButton, SearchLayoutButton, SecondaryButton, Select, SelectItem, SelectItemGroup, Switch, Slider, StructuredListWrapper, StructuredListHead, StructuredListBody, StructuredListRow, StructuredListInput, StructuredListCell, Tab, TabContent, Tabs, Tag, TextArea, TextInput, Tile, ClickableTile, SelectableTile, ExpandableTile, TileAboveTheFoldContent, TileBelowTheFoldContent, RadioTile, TileGroup, TimePicker, TimePickerSelect, Toggle, ToggleSmall, Toolbar, ToolbarItem, ToolbarTitle, ToolbarOption, ToolbarDivider, ToolbarSearch, Tooltip, TooltipDefinition, TooltipIcon, UnorderedList, SkeletonText, SkeletonPlaceholder, DataTableSkeleton, AccordionSkeleton, ButtonSkeleton, CheckboxSkeleton, CodeSnippetSkeleton, DropdownSkeleton, FileUploaderSkeleton, NumberInputSkeleton, ProgressIndicatorSkeleton, RadioButtonSkeleton, SearchSkeleton, SelectSkeleton, SliderSkeleton, StructuredListSkeleton, TabsSkeleton, TagSkeleton, TextAreaSkeleton, TextInputSkeleton, ToggleSkeleton, ToggleSmallSkeleton, IconSkeleton, DatePickerSkeleton, Content, HeaderContainer, HeaderGlobalAction, HeaderGlobalBar, HeaderMenu, HeaderMenuButton, HeaderMenuItem, HeaderName, HeaderNavigation, HeaderPanel, HeaderSideNavItems, Switcher, SwitcherItem, SwitcherDivider, SkipToContent, SideNavDetails, SideNavFooter, SideNavHeader, SideNavIcon, SideNavItem, SideNavItems, SideNavLink, SideNavLinkText, SideNavMenu, SideNavMenuItem, SideNavSwitcher } from 'carbon-components-react';
|
|
3
3
|
export { default as AddCard } from './components/AddCard/AddCard.jsx';
|
|
4
4
|
export { default as Button } from './components/Button/Button.jsx';
|
|
5
5
|
export { CARD_TYPES, CARD_SIZES, CARD_ACTIONS, DASHBOARD_BREAKPOINTS, DASHBOARD_SIZES, TIME_SERIES_TYPES, BAR_CHART_TYPES } from './constants/LayoutConstants.js';
|
|
@@ -71,6 +71,7 @@ export { default as StatefulTileGallery } from './components/TileGallery/Statefu
|
|
|
71
71
|
export { default as SimpleList } from './components/List/SimpleList/SimpleList.jsx';
|
|
72
72
|
export { default as IconSwitch, ICON_SWITCH_SIZES } from './components/IconSwitch/IconSwitch.jsx';
|
|
73
73
|
export { default as AccordionItemDefer } from './components/Accordion/AccordionItemDefer.jsx';
|
|
74
|
+
export { default as ComboBox } from './components/ComboBox/ComboBox.jsx';
|
|
74
75
|
|
|
75
76
|
// Needed so that any component that uses sizeme can be jest tested
|
|
76
77
|
withSize.noPlaceholders = true; // Components
|
|
@@ -2344,39 +2344,6 @@ html[dir='rtl'] .chart-holder .axis {
|
|
|
2344
2344
|
html[dir='rtl'] .chart-holder .axis .axis-title {
|
|
2345
2345
|
direction: ltr; }
|
|
2346
2346
|
|
|
2347
|
-
@font-face {
|
|
2348
|
-
font-family: 'IBM Plex Sans Condensed';
|
|
2349
|
-
font-style: italic;
|
|
2350
|
-
font-weight: 300;
|
|
2351
|
-
src: url(//unpkg.com/@ibm/plex/IBM-Plex-Sans-Condensed/fonts/complete/woff2/IBMPlexSansCondensed-LightItalic.woff2) format("woff2"); }
|
|
2352
|
-
|
|
2353
|
-
@font-face {
|
|
2354
|
-
font-family: 'IBM Plex Sans Condensed';
|
|
2355
|
-
font-style: italic;
|
|
2356
|
-
font-weight: 400;
|
|
2357
|
-
src: url(//unpkg.com/@ibm/plex/IBM-Plex-Sans-Condensed/fonts/complete/woff2/IBMPlexSansCondensed-Italic.woff2) format("woff2"); }
|
|
2358
|
-
|
|
2359
|
-
@font-face {
|
|
2360
|
-
font-family: 'IBM Plex Sans Condensed';
|
|
2361
|
-
font-style: italic;
|
|
2362
|
-
font-weight: 600;
|
|
2363
|
-
src: url(//unpkg.com/@ibm/plex/IBM-Plex-Sans-Condensed/fonts/complete/woff2/IBMPlexSansCondensed-SemiBoldItalic.woff2) format("woff2"); }
|
|
2364
|
-
|
|
2365
|
-
@font-face {
|
|
2366
|
-
font-family: 'IBM Plex Sans Condensed';
|
|
2367
|
-
font-weight: 300;
|
|
2368
|
-
src: url(//unpkg.com/@ibm/plex/IBM-Plex-Sans-Condensed/fonts/complete/woff2/IBMPlexSansCondensed-Light.woff2) format("woff2"); }
|
|
2369
|
-
|
|
2370
|
-
@font-face {
|
|
2371
|
-
font-family: 'IBM Plex Sans Condensed';
|
|
2372
|
-
font-weight: 400;
|
|
2373
|
-
src: url(//unpkg.com/@ibm/plex/IBM-Plex-Sans-Condensed/fonts/complete/woff2/IBMPlexSansCondensed-Regular.woff2) format("woff2"); }
|
|
2374
|
-
|
|
2375
|
-
@font-face {
|
|
2376
|
-
font-family: 'IBM Plex Sans Condensed';
|
|
2377
|
-
font-weight: 600;
|
|
2378
|
-
src: url(//unpkg.com/@ibm/plex/IBM-Plex-Sans-Condensed/fonts/complete/woff2/IBMPlexSansCondensed-SemiBold.woff2) format("woff2"); }
|
|
2379
|
-
|
|
2380
2347
|
.bx--btn-set {
|
|
2381
2348
|
display: flex; }
|
|
2382
2349
|
|
|
@@ -4282,6 +4249,35 @@ input:not(output):not([data-invalid]):-moz-ui-invalid {
|
|
|
4282
4249
|
.bx--list-box__field {
|
|
4283
4250
|
padding: 0; }
|
|
4284
4251
|
|
|
4252
|
+
.iot--combobox {
|
|
4253
|
+
display: flex;
|
|
4254
|
+
flex-flow: column-reverse;
|
|
4255
|
+
position: relative;
|
|
4256
|
+
padding-top: 2.5rem; }
|
|
4257
|
+
.iot--combobox .bx--form__helper-text,
|
|
4258
|
+
.iot--combobox .bx--label {
|
|
4259
|
+
bottom: 100%;
|
|
4260
|
+
position: absolute; }
|
|
4261
|
+
.iot--combobox .bx--label {
|
|
4262
|
+
-webkit-transform: translateY(25px);
|
|
4263
|
+
transform: translateY(25px); }
|
|
4264
|
+
.iot--combobox .bx--form__helper-text {
|
|
4265
|
+
-webkit-transform: translateY(40px);
|
|
4266
|
+
transform: translateY(40px); }
|
|
4267
|
+
.iot--combobox-tags {
|
|
4268
|
+
margin-bottom: 0.5rem; }
|
|
4269
|
+
.iot--combobox-tags li {
|
|
4270
|
+
display: inline-block;
|
|
4271
|
+
max-width: 100%; }
|
|
4272
|
+
.iot--combobox.iot--combobox-add .bx--list-box__menu-item:first-child::after {
|
|
4273
|
+
content: attr(data-text);
|
|
4274
|
+
color: #a8a8a8;
|
|
4275
|
+
position: absolute;
|
|
4276
|
+
right: 0.5rem;
|
|
4277
|
+
top: 50%;
|
|
4278
|
+
-webkit-transform: translateY(-50%);
|
|
4279
|
+
transform: translateY(-50%); }
|
|
4280
|
+
|
|
4285
4281
|
.bx--radio-button-group {
|
|
4286
4282
|
display: flex;
|
|
4287
4283
|
align-items: center;
|
|
@@ -12979,6 +12975,13 @@ a.bx--tabs__nav-link:active {
|
|
|
12979
12975
|
-webkit-animation: none;
|
|
12980
12976
|
animation: none; } }
|
|
12981
12977
|
|
|
12978
|
+
html[dir='rtl'] .bx--tag--filter {
|
|
12979
|
+
padding-right: 0.5rem;
|
|
12980
|
+
padding-left: 0.125rem; }
|
|
12981
|
+
|
|
12982
|
+
html[dir='rtl'] .bx--tag__close-icon {
|
|
12983
|
+
margin: 0 0.25rem 0 0; }
|
|
12984
|
+
|
|
12982
12985
|
.bx--data-table-container + .bx--pagination {
|
|
12983
12986
|
border-top: 0; }
|
|
12984
12987
|
|
|
@@ -15830,6 +15833,9 @@ html[dir='rtl'] .iot--card--header .iot--card--toolbar {
|
|
|
15830
15833
|
.iot--card .bx--chart-holder {
|
|
15831
15834
|
background-color: #ffffff; }
|
|
15832
15835
|
|
|
15836
|
+
.iot--composed-modal__body--small-margin-bottom {
|
|
15837
|
+
margin-bottom: 1rem; }
|
|
15838
|
+
|
|
15833
15839
|
.react-grid-layout {
|
|
15834
15840
|
position: relative;
|
|
15835
15841
|
transition: height 200ms ease; }
|