@carbon/ibm-products 1.27.0 → 1.32.0
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/index-full-carbon.css +570 -80
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +3 -3
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon-released-only.css +942 -23
- package/css/index-without-carbon-released-only.css.map +1 -1
- package/css/index-without-carbon-released-only.min.css +3 -3
- package/css/index-without-carbon-released-only.min.css.map +1 -1
- package/css/index-without-carbon.css +569 -79
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +3 -3
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +570 -80
- package/css/index.css.map +1 -1
- package/css/index.min.css +3 -3
- package/css/index.min.css.map +1 -1
- package/es/components/AddSelect/AddSelect.js +0 -3
- package/es/components/AddSelect/AddSelectBody.js +20 -3
- package/es/components/AddSelect/AddSelectBreadcrumbs.js +11 -3
- package/es/components/AddSelect/AddSelectColumn.js +4 -3
- package/es/components/AddSelect/AddSelectFilter.js +4 -3
- package/es/components/AddSelect/AddSelectList.js +40 -14
- package/es/components/Card/Card.js +16 -6
- package/es/components/Card/CardFooter.js +3 -1
- package/es/components/Card/CardHeader.js +20 -1
- package/es/components/DataSpreadsheet/DataSpreadsheet.js +63 -11
- package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +2 -1
- package/es/components/DataSpreadsheet/DataSpreadsheetHeader.js +7 -0
- package/es/components/DataSpreadsheet/utils/handleCellDeletion.js +31 -0
- package/es/components/DataSpreadsheet/utils/handleMultipleKeys.js +1 -1
- package/es/components/Datagrid/Datagrid/Datagrid.js +10 -38
- package/es/components/Datagrid/Datagrid/DatagridContent.js +127 -0
- package/es/components/Datagrid/Datagrid/DatagridExpandedRow.js +9 -1
- package/es/components/Datagrid/Datagrid/DatagridSelectAll.js +10 -3
- package/es/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +12 -3
- package/es/components/Datagrid/Datagrid/DraggableElement.js +5 -1
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/Actions.js +5 -40
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +35 -10
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsModal.js +61 -24
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/ModalWrapper.js +3 -2
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.js +60 -0
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/index.js +1 -0
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +467 -0
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/index.js +1 -0
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditContext/InlineEditContext.js +112 -0
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditContext/getCellIdAsObject.js +27 -0
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditContext/index.js +1 -0
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditContext/returnUpdatedActiveCell.js +39 -0
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/handleGridFocus.js +19 -0
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/handleGridKeyPress.js +263 -0
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/handleMultipleKeys.js +66 -0
- package/es/components/Datagrid/Datagrid/addons/RowSize/RowSizeDropdown.js +6 -5
- package/es/components/Datagrid/Datagrid/addons/RowSize/RowSizeRadioGroup.js +1 -2
- package/es/components/Datagrid/index.js +3 -1
- package/es/components/Datagrid/useActionsColumn.js +28 -12
- package/es/components/Datagrid/useColumnOrder.js +8 -0
- package/es/components/Datagrid/useCustomizeColumns.js +5 -0
- package/es/components/Datagrid/useDisableSelectRows.js +6 -2
- package/es/components/Datagrid/useExpandedRow.js +0 -1
- package/es/components/Datagrid/useInlineEdit.js +71 -0
- package/es/components/Datagrid/useNestedRowExpander.js +42 -0
- package/es/components/Datagrid/useNestedRows.js +2 -2
- package/es/components/Datagrid/useRowSize.js +17 -6
- package/es/components/Datagrid/useSelectAllToggle.js +17 -4
- package/es/components/Datagrid/useSelectRows.js +12 -2
- package/es/components/Datagrid/useStickyColumn.js +11 -0
- package/es/components/Datagrid/utils/DatagridActions.js +121 -0
- package/es/components/Datagrid/utils/DatagridPagination.js +33 -0
- package/es/components/Datagrid/utils/Wrapper.js +21 -0
- package/es/components/Datagrid/utils/getArgTypes.js +85 -0
- package/es/components/Datagrid/utils/getInlineEditColumns.js +121 -0
- package/es/components/Datagrid/utils/makeData.js +17 -1
- package/es/components/ImportModal/ImportModal.js +2 -2
- package/es/components/InlineEdit/InlineEdit.js +4 -2
- package/es/components/ProductiveCard/ProductiveCard.js +5 -0
- package/es/components/index.js +1 -1
- package/es/global/js/hooks/useClickOutside.js +1 -1
- package/es/global/js/package-settings.js +3 -3
- package/es/global/js/utils/rangeWithCallback.js +13 -0
- package/es/global/js/utils/story-helper.js +5 -1
- package/es/global/js/utils/uuidv4.spec.js +4 -0
- package/lib/components/AddSelect/AddSelect.js +0 -4
- package/lib/components/AddSelect/AddSelectBody.js +20 -3
- package/lib/components/AddSelect/AddSelectBreadcrumbs.js +14 -3
- package/lib/components/AddSelect/AddSelectColumn.js +3 -2
- package/lib/components/AddSelect/AddSelectFilter.js +3 -2
- package/lib/components/AddSelect/AddSelectList.js +39 -13
- package/lib/components/Card/Card.js +16 -6
- package/lib/components/Card/CardFooter.js +3 -1
- package/lib/components/Card/CardHeader.js +21 -1
- package/lib/components/DataSpreadsheet/DataSpreadsheet.js +63 -10
- package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +2 -1
- package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.js +7 -0
- package/lib/components/DataSpreadsheet/utils/handleCellDeletion.js +42 -0
- package/lib/components/DataSpreadsheet/utils/handleMultipleKeys.js +1 -1
- package/lib/components/Datagrid/Datagrid/Datagrid.js +12 -45
- package/lib/components/Datagrid/Datagrid/DatagridContent.js +160 -0
- package/lib/components/Datagrid/Datagrid/DatagridExpandedRow.js +9 -1
- package/lib/components/Datagrid/Datagrid/DatagridSelectAll.js +12 -3
- package/lib/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +14 -3
- package/lib/components/Datagrid/Datagrid/DraggableElement.js +5 -1
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/Actions.js +12 -41
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +47 -25
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsModal.js +59 -23
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/ModalWrapper.js +3 -2
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.js +76 -0
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/index.js +13 -0
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +491 -0
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/index.js +13 -0
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditContext/InlineEditContext.js +129 -0
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditContext/getCellIdAsObject.js +36 -0
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditContext/index.js +19 -0
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditContext/returnUpdatedActiveCell.js +45 -0
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/handleGridFocus.js +28 -0
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/handleGridKeyPress.js +272 -0
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/handleMultipleKeys.js +78 -0
- package/lib/components/Datagrid/Datagrid/addons/RowSize/RowSizeDropdown.js +6 -5
- package/lib/components/Datagrid/Datagrid/addons/RowSize/RowSizeRadioGroup.js +1 -2
- package/lib/components/Datagrid/index.js +17 -1
- package/lib/components/Datagrid/useActionsColumn.js +28 -13
- package/lib/components/Datagrid/useColumnOrder.js +17 -0
- package/lib/components/Datagrid/useCustomizeColumns.js +5 -0
- package/lib/components/Datagrid/useDisableSelectRows.js +6 -2
- package/lib/components/Datagrid/useExpandedRow.js +0 -1
- package/lib/components/Datagrid/useInlineEdit.js +85 -0
- package/lib/components/Datagrid/useNestedRowExpander.js +57 -0
- package/lib/components/Datagrid/useNestedRows.js +3 -3
- package/lib/components/Datagrid/useRowSize.js +18 -13
- package/lib/components/Datagrid/useSelectAllToggle.js +18 -4
- package/lib/components/Datagrid/useSelectRows.js +12 -2
- package/lib/components/Datagrid/useStickyColumn.js +11 -0
- package/lib/components/Datagrid/utils/DatagridActions.js +139 -0
- package/lib/components/Datagrid/utils/DatagridPagination.js +46 -0
- package/lib/components/Datagrid/utils/Wrapper.js +33 -0
- package/lib/components/Datagrid/utils/getArgTypes.js +93 -0
- package/lib/components/Datagrid/utils/getInlineEditColumns.js +133 -0
- package/lib/components/Datagrid/utils/makeData.js +17 -1
- package/lib/components/ImportModal/ImportModal.js +2 -2
- package/lib/components/InlineEdit/InlineEdit.js +4 -2
- package/lib/components/ProductiveCard/ProductiveCard.js +5 -0
- package/lib/components/index.js +12 -0
- package/lib/global/js/hooks/useClickOutside.js +1 -1
- package/lib/global/js/package-settings.js +3 -3
- package/lib/global/js/utils/rangeWithCallback.js +22 -0
- package/lib/global/js/utils/story-helper.js +5 -1
- package/lib/global/js/utils/uuidv4.spec.js +4 -0
- package/package.json +13 -13
- package/scss/components/AddSelect/_add-select.scss +126 -28
- package/scss/components/Card/_card.scss +1 -0
- package/scss/components/Cascade/_cascade.scss +1 -1
- package/scss/components/CreateTearsheet/_create-tearsheet.scss +1 -0
- package/scss/components/DataSpreadsheet/_data-spreadsheet.scss +18 -1
- package/scss/components/Datagrid/_storybook-styles.scss +1 -1
- package/scss/components/Datagrid/styles/_datagrid.scss +27 -4
- package/scss/components/Datagrid/styles/_draggableElement.scss +26 -9
- package/scss/components/Datagrid/styles/_index.scss +1 -0
- package/scss/components/Datagrid/styles/_useActionsColumn.scss +12 -0
- package/scss/components/Datagrid/styles/_useExpandedRow.scss +30 -0
- package/scss/components/Datagrid/styles/_useInlineEdit.scss +211 -0
- package/scss/components/Datagrid/styles/_useNestedRows.scss +15 -1
- package/scss/components/Datagrid/styles/_useStickyColumn.scss +30 -2
- package/scss/components/Datagrid/styles/addons/_CustomizeColumnsModal.scss +44 -6
- package/scss/components/NotificationsPanel/_notifications-panel.scss +5 -6
- package/scss/components/ProductiveCard/_productive-card.scss +39 -0
- package/scss/components/RemoveModal/_remove-modal.scss +0 -4
- package/scss/components/SidePanel/_side-panel.scss +4 -6
- package/scss/components/_index-released-only.scss +1 -0
|
@@ -8,7 +8,7 @@ import { useEffect } from 'react';
|
|
|
8
8
|
export var useClickOutside = function useClickOutside(ref, callback) {
|
|
9
9
|
var handleClick = function handleClick(event) {
|
|
10
10
|
if (ref.current && !ref.current.contains(event.target)) {
|
|
11
|
-
callback();
|
|
11
|
+
callback(event.target);
|
|
12
12
|
}
|
|
13
13
|
};
|
|
14
14
|
|
|
@@ -53,6 +53,9 @@ var defaults = {
|
|
|
53
53
|
TearsheetNarrow: true,
|
|
54
54
|
UnauthorizedEmptyState: true,
|
|
55
55
|
UserProfileImage: true,
|
|
56
|
+
WebTerminal: true,
|
|
57
|
+
WebTerminalContentWrapper: true,
|
|
58
|
+
WebTerminalProvider: true,
|
|
56
59
|
// other public components not yet reviewed and released:
|
|
57
60
|
MultiAddSelect: false,
|
|
58
61
|
SingleAddSelect: false,
|
|
@@ -60,9 +63,6 @@ var defaults = {
|
|
|
60
63
|
Toolbar: false,
|
|
61
64
|
ToolbarButton: false,
|
|
62
65
|
ToolbarGroup: false,
|
|
63
|
-
WebTerminal: false,
|
|
64
|
-
WebTerminalContentWrapper: false,
|
|
65
|
-
WebTerminalProvider: false,
|
|
66
66
|
EditSidePanel: false,
|
|
67
67
|
CancelableTextEdit: false,
|
|
68
68
|
DataSpreadsheet: false,
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2022, 2022
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
// Iterates through a numeric range and calls callback
|
|
8
|
+
// function for each iteration
|
|
9
|
+
export var rangeWithCallback = function rangeWithCallback(start, end, fn) {
|
|
10
|
+
for (var i = start; i <= end; i++) {
|
|
11
|
+
fn(i);
|
|
12
|
+
}
|
|
13
|
+
};
|
|
@@ -29,7 +29,11 @@ export var getStoryTitle = function getStoryTitle(componentName) {
|
|
|
29
29
|
* @returns The story id.
|
|
30
30
|
*/
|
|
31
31
|
|
|
32
|
-
export var getStoryId = function getStoryId(componentName, scenario) {
|
|
32
|
+
export var getStoryId = function getStoryId(componentName, scenario, subdirectory) {
|
|
33
|
+
if (subdirectory) {
|
|
34
|
+
return "".concat(sanitize(getStoryTitle(componentName)), "-").concat(sanitize(subdirectory), "--").concat(scenario);
|
|
35
|
+
}
|
|
36
|
+
|
|
33
37
|
return "".concat(sanitize(getStoryTitle(componentName)), "--").concat(scenario);
|
|
34
38
|
};
|
|
35
39
|
/**
|
|
@@ -4,11 +4,15 @@ describe('uuidv4', function () {
|
|
|
4
4
|
jest.resetAllMocks();
|
|
5
5
|
});
|
|
6
6
|
it('Uses Math.random when window is not defined', function () {
|
|
7
|
+
var _window = window,
|
|
8
|
+
crypto = _window.crypto;
|
|
9
|
+
delete window.crypto;
|
|
7
10
|
var mockMath = Object.create(global.Math);
|
|
8
11
|
var mockMathRandom = jest.fn().mockReturnValue(0.5);
|
|
9
12
|
mockMath.random = mockMathRandom;
|
|
10
13
|
global.Math = mockMath;
|
|
11
14
|
expect(uuidv4()).toEqual('98888888-9888-4888-a888-988888888888');
|
|
15
|
+
window.crypto = crypto;
|
|
12
16
|
});
|
|
13
17
|
it('Uses crypto from window when window is defined', function () {
|
|
14
18
|
var mGetRandomValues = jest.fn().mockReturnValue(new Uint32Array(10));
|
|
@@ -21,8 +21,6 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
21
21
|
|
|
22
22
|
var _AddSelectBody = require("./AddSelectBody");
|
|
23
23
|
|
|
24
|
-
var _settings = require("../../settings");
|
|
25
|
-
|
|
26
24
|
var _addSelectUtils = require("./add-select-utils");
|
|
27
25
|
|
|
28
26
|
var _excluded = ["items", "globalFilters"];
|
|
@@ -31,7 +29,6 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
31
29
|
|
|
32
30
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
33
31
|
|
|
34
|
-
var blockClass = "".concat(_settings.pkg.prefix, "--add-select");
|
|
35
32
|
var componentName = 'AddSelect';
|
|
36
33
|
var AddSelect = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
37
34
|
var items = _ref.items,
|
|
@@ -49,7 +46,6 @@ var AddSelect = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
49
46
|
}, modifierAttribute, item[modifierAttribute]);
|
|
50
47
|
}) : [];
|
|
51
48
|
return /*#__PURE__*/_react.default.createElement(_AddSelectBody.AddSelectBody, (0, _extends2.default)({}, props, {
|
|
52
|
-
className: blockClass,
|
|
53
49
|
ref: ref,
|
|
54
50
|
items: items,
|
|
55
51
|
normalizedItems: normalizedItems,
|
|
@@ -146,6 +146,19 @@ var AddSelectBody = function AddSelectBody(_ref) {
|
|
|
146
146
|
setPath = _usePath.setPath,
|
|
147
147
|
pathOnclick = _usePath.pathOnclick;
|
|
148
148
|
|
|
149
|
+
var resetState = function resetState() {
|
|
150
|
+
setSingleSelection('');
|
|
151
|
+
setMultiSelection([]);
|
|
152
|
+
setSearchTerm('');
|
|
153
|
+
setAppliedGlobalFilters({});
|
|
154
|
+
setDisplayMetaPanel({});
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
var onCloseHandler = function onCloseHandler() {
|
|
158
|
+
resetState();
|
|
159
|
+
onClose();
|
|
160
|
+
};
|
|
161
|
+
|
|
149
162
|
var classNames = (0, _classnames.default)(className, blockClass, (_cx = {}, (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__single"), !multi), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__multi"), multi), _cx));
|
|
150
163
|
var globalFilterKeys = Object.keys(appliedGlobalFilters);
|
|
151
164
|
var globalFiltersApplied = globalFilterKeys.length > 0; // handlers
|
|
@@ -171,6 +184,8 @@ var AddSelectBody = function AddSelectBody(_ref) {
|
|
|
171
184
|
} else {
|
|
172
185
|
onSubmit(singleSelection);
|
|
173
186
|
}
|
|
187
|
+
|
|
188
|
+
onCloseHandler();
|
|
174
189
|
};
|
|
175
190
|
|
|
176
191
|
var setShowBreadsCrumbs = function setShowBreadsCrumbs() {
|
|
@@ -205,6 +220,7 @@ var AddSelectBody = function AddSelectBody(_ref) {
|
|
|
205
220
|
var showSort = (searchTerm || globalFiltersApplied) && hasResults;
|
|
206
221
|
var showTags = setShowTags();
|
|
207
222
|
var commonListProps = {
|
|
223
|
+
displayMetalPanel: displayMetalPanel,
|
|
208
224
|
metaIconDescription: metaIconDescription,
|
|
209
225
|
multi: multi,
|
|
210
226
|
multiSelection: multiSelection,
|
|
@@ -226,7 +242,7 @@ var AddSelectBody = function AddSelectBody(_ref) {
|
|
|
226
242
|
actions: [{
|
|
227
243
|
label: onCloseButtonText,
|
|
228
244
|
kind: 'secondary',
|
|
229
|
-
onClick:
|
|
245
|
+
onClick: onCloseHandler
|
|
230
246
|
}, {
|
|
231
247
|
label: onSubmitButtonText,
|
|
232
248
|
kind: 'primary',
|
|
@@ -268,12 +284,13 @@ var AddSelectBody = function AddSelectBody(_ref) {
|
|
|
268
284
|
hasFiltersApplied: globalFiltersApplied,
|
|
269
285
|
clearFiltersText: clearFiltersText
|
|
270
286
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
271
|
-
className: "".concat(blockClass, "__sub-header")
|
|
287
|
+
className: (0, _classnames.default)("".concat(blockClass, "__sub-header"), (0, _defineProperty2.default)({}, "".concat(blockClass, "__sub-header-multi"), multi))
|
|
272
288
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
273
289
|
className: "".concat(blockClass, "__tag-container")
|
|
274
290
|
}, showBreadsCrumbs ? /*#__PURE__*/_react.default.createElement(_AddSelectBreadcrumbs.AddSelectBreadcrumbs, {
|
|
275
291
|
path: path,
|
|
276
|
-
onClick: pathOnclick
|
|
292
|
+
onClick: pathOnclick,
|
|
293
|
+
multi: multi
|
|
277
294
|
}) : /*#__PURE__*/_react.default.createElement("p", {
|
|
278
295
|
className: "".concat(blockClass, "__tag-container-label")
|
|
279
296
|
}, searchTerm ? searchResultsLabel : itemsLabel), showTags && /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Tag, {
|
|
@@ -7,30 +7,40 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.AddSelectBreadcrumbs = void 0;
|
|
9
9
|
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
|
|
10
12
|
var _react = _interopRequireDefault(require("react"));
|
|
11
13
|
|
|
12
14
|
var _carbonComponentsReact = require("carbon-components-react");
|
|
13
15
|
|
|
14
16
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
17
|
|
|
18
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
19
|
+
|
|
20
|
+
var _settings = require("../../settings");
|
|
21
|
+
|
|
16
22
|
//
|
|
17
23
|
// Copyright IBM Corp. 2022
|
|
18
24
|
//
|
|
19
25
|
// This source code is licensed under the Apache-2.0 license found in the
|
|
20
26
|
// LICENSE file in the root directory of this source tree.
|
|
21
27
|
//
|
|
28
|
+
var blockClass = "".concat(_settings.pkg.prefix, "--add-select__breadcrumbs");
|
|
22
29
|
var componentName = 'AddSelectBreadcrumbs';
|
|
23
30
|
|
|
24
31
|
var AddSelectBreadcrumbs = function AddSelectBreadcrumbs(_ref) {
|
|
25
|
-
var
|
|
26
|
-
onClick = _ref.onClick
|
|
32
|
+
var multi = _ref.multi,
|
|
33
|
+
onClick = _ref.onClick,
|
|
34
|
+
path = _ref.path;
|
|
27
35
|
|
|
28
36
|
var clickHandler = function clickHandler(idx) {
|
|
29
37
|
onClick(idx);
|
|
30
38
|
};
|
|
31
39
|
|
|
40
|
+
var classNames = (0, _classnames.default)(blockClass, (0, _defineProperty2.default)({}, "".concat(blockClass, "-multi"), multi));
|
|
32
41
|
return /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Breadcrumb, {
|
|
33
|
-
noTrailingSlash: true
|
|
42
|
+
noTrailingSlash: true,
|
|
43
|
+
className: classNames
|
|
34
44
|
}, path.map(function (entry, idx) {
|
|
35
45
|
var isCurrentPage = idx === path.length - 1;
|
|
36
46
|
return /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.BreadcrumbItem, {
|
|
@@ -45,6 +55,7 @@ var AddSelectBreadcrumbs = function AddSelectBreadcrumbs(_ref) {
|
|
|
45
55
|
|
|
46
56
|
exports.AddSelectBreadcrumbs = AddSelectBreadcrumbs;
|
|
47
57
|
AddSelectBreadcrumbs.propTypes = {
|
|
58
|
+
multi: _propTypes.default.bool,
|
|
48
59
|
onClick: _propTypes.default.func,
|
|
49
60
|
path: _propTypes.default.array
|
|
50
61
|
};
|
|
@@ -186,7 +186,7 @@ var AddSelectColumn = function AddSelectColumn(_ref) {
|
|
|
186
186
|
className: colClass
|
|
187
187
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
188
188
|
className: "".concat(colClass, "-search-bar")
|
|
189
|
-
}, /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.
|
|
189
|
+
}, /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Search, {
|
|
190
190
|
value: searchTerm,
|
|
191
191
|
onChange: function onChange(e) {
|
|
192
192
|
return setSearchTerm(e.target.value);
|
|
@@ -195,7 +195,8 @@ var AddSelectColumn = function AddSelectColumn(_ref) {
|
|
|
195
195
|
placeholder: columnInputPlaceholder,
|
|
196
196
|
className: "".concat(colClass, "-input"),
|
|
197
197
|
id: (0, _uuidv.default)(),
|
|
198
|
-
labelText: columnInputPlaceholder
|
|
198
|
+
labelText: columnInputPlaceholder,
|
|
199
|
+
size: "lg"
|
|
199
200
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
200
201
|
className: "".concat(colClass, "-sort-filter")
|
|
201
202
|
}, /*#__PURE__*/_react.default.createElement(_AddSelectSort.AddSelectSort, {
|
|
@@ -110,7 +110,7 @@ var AddSelectFilter = function AddSelectFilter(_ref) {
|
|
|
110
110
|
var dirtyInput = Object.keys(filters).length > 0;
|
|
111
111
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
112
112
|
className: "".concat(blockClass, "-search")
|
|
113
|
-
}, /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.
|
|
113
|
+
}, /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Search, {
|
|
114
114
|
id: "temp-id",
|
|
115
115
|
labelText: inputLabel,
|
|
116
116
|
placeholder: inputPlaceholder,
|
|
@@ -125,7 +125,8 @@ var AddSelectFilter = function AddSelectFilter(_ref) {
|
|
|
125
125
|
},
|
|
126
126
|
iconDescription: iconDescription,
|
|
127
127
|
className: filterBtnClassnames,
|
|
128
|
-
size: "
|
|
128
|
+
size: "lg",
|
|
129
|
+
tooltipPosition: "left"
|
|
129
130
|
}), open && /*#__PURE__*/_react.default.createElement("div", {
|
|
130
131
|
className: blockClass
|
|
131
132
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -38,6 +38,7 @@ var AddSelectList = function AddSelectList(_ref) {
|
|
|
38
38
|
var _modifiers$options;
|
|
39
39
|
|
|
40
40
|
var appliedModifiers = _ref.appliedModifiers,
|
|
41
|
+
displayMetalPanel = _ref.displayMetalPanel,
|
|
41
42
|
filteredItems = _ref.filteredItems,
|
|
42
43
|
metaIconDescription = _ref.metaIconDescription,
|
|
43
44
|
modifiers = _ref.modifiers,
|
|
@@ -57,8 +58,8 @@ var AddSelectList = function AddSelectList(_ref) {
|
|
|
57
58
|
setSingleSelection(value);
|
|
58
59
|
};
|
|
59
60
|
|
|
60
|
-
var handleMultiSelection = function handleMultiSelection(
|
|
61
|
-
if (
|
|
61
|
+
var handleMultiSelection = function handleMultiSelection(value, id) {
|
|
62
|
+
if (value) {
|
|
62
63
|
var newValues = [].concat((0, _toConsumableArray2.default)(multiSelection), [id]);
|
|
63
64
|
setMultiSelection(newValues);
|
|
64
65
|
} else {
|
|
@@ -77,7 +78,11 @@ var AddSelectList = function AddSelectList(_ref) {
|
|
|
77
78
|
};
|
|
78
79
|
|
|
79
80
|
var isSelected = function isSelected(id) {
|
|
80
|
-
|
|
81
|
+
if (multi) {
|
|
82
|
+
return multiSelection.includes(id);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return id === singleSelection;
|
|
81
86
|
};
|
|
82
87
|
|
|
83
88
|
var getAvatarProps = function getAvatarProps(_ref3) {
|
|
@@ -112,30 +117,53 @@ var AddSelectList = function AddSelectList(_ref) {
|
|
|
112
117
|
setAppliedModifiers(modifiersClone);
|
|
113
118
|
};
|
|
114
119
|
|
|
120
|
+
var metaPanelHandler = function metaPanelHandler(item) {
|
|
121
|
+
if (item.meta) {
|
|
122
|
+
setDisplayMetaPanel(item);
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
var isInMetaPanel = function isInMetaPanel(id) {
|
|
127
|
+
return id === (displayMetalPanel === null || displayMetalPanel === void 0 ? void 0 : displayMetalPanel.id);
|
|
128
|
+
};
|
|
129
|
+
|
|
115
130
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
116
|
-
className: "".concat(blockClass, "-wrapper")
|
|
131
|
+
className: (0, _classnames.default)("".concat(blockClass, "-wrapper"), (0, _defineProperty2.default)({}, "".concat(blockClass, "-wrapper-multi"), multi))
|
|
117
132
|
}, /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.StructuredListWrapper, {
|
|
118
133
|
selection: true,
|
|
119
134
|
className: "".concat(blockClass)
|
|
120
135
|
}, /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.StructuredListBody, null, filteredItems.map(function (item) {
|
|
136
|
+
var _cx2;
|
|
137
|
+
|
|
121
138
|
return /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.StructuredListRow, {
|
|
122
139
|
key: item.id,
|
|
123
|
-
className: (0, _classnames.default)("".concat(blockClass, "-row"), (0, _defineProperty2.default)(
|
|
124
|
-
|
|
140
|
+
className: (0, _classnames.default)("".concat(blockClass, "-row"), (_cx2 = {}, (0, _defineProperty2.default)(_cx2, "".concat(blockClass, "-row-selected"), isSelected(item.id)), (0, _defineProperty2.default)(_cx2, "".concat(blockClass, "-row-meta-selected"), isInMetaPanel(item.id)), _cx2)),
|
|
141
|
+
onClick: function onClick(evt) {
|
|
142
|
+
return metaPanelHandler(item, evt);
|
|
143
|
+
}
|
|
144
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
125
145
|
className: "".concat(blockClass, "-cell")
|
|
126
146
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
127
147
|
className: "".concat(blockClass, "-cell-wrapper")
|
|
128
148
|
}, multi ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
129
149
|
className: "".concat(blockClass, "-checkbox")
|
|
150
|
+
},
|
|
151
|
+
/*#__PURE__*/
|
|
152
|
+
// hacky way to prevent checkbox from triggering the meta onclick handler
|
|
153
|
+
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
|
|
154
|
+
_react.default.createElement("div", {
|
|
155
|
+
onClick: function onClick(event) {
|
|
156
|
+
return event.stopPropagation();
|
|
157
|
+
}
|
|
130
158
|
}, /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Checkbox, {
|
|
131
|
-
onChange: function onChange(
|
|
132
|
-
return handleMultiSelection(
|
|
159
|
+
onChange: function onChange(value, id) {
|
|
160
|
+
return handleMultiSelection(value, id);
|
|
133
161
|
},
|
|
134
162
|
labelText: item.title,
|
|
135
163
|
id: item.id,
|
|
136
164
|
checked: isSelected(item.id),
|
|
137
165
|
className: "".concat(blockClass, "-checkbox-wrapper")
|
|
138
|
-
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
166
|
+
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
139
167
|
className: "".concat(blockClass, "-checkbox-label-wrapper")
|
|
140
168
|
}, item.avatar && /*#__PURE__*/_react.default.createElement(_UserProfileImage.UserProfileImage, getAvatarProps(item.avatar)), item.icon && /*#__PURE__*/_react.default.createElement("div", {
|
|
141
169
|
className: "".concat(blockClass, "-cell-icon")
|
|
@@ -167,7 +195,7 @@ var AddSelectList = function AddSelectList(_ref) {
|
|
|
167
195
|
onChange: function onChange() {
|
|
168
196
|
return handleSingleSelection(item.id);
|
|
169
197
|
},
|
|
170
|
-
|
|
198
|
+
checked: isSelected(item.id)
|
|
171
199
|
}), item.children && /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, {
|
|
172
200
|
className: "".concat(blockClass, "-view-children"),
|
|
173
201
|
renderIcon: _iconsReact.ChevronRight16,
|
|
@@ -189,9 +217,6 @@ var AddSelectList = function AddSelectList(_ref) {
|
|
|
189
217
|
tooltipPosition: "left",
|
|
190
218
|
tooltipAlignment: "center",
|
|
191
219
|
hasIconOnly: true,
|
|
192
|
-
onClick: function onClick() {
|
|
193
|
-
return setDisplayMetaPanel(item);
|
|
194
|
-
},
|
|
195
220
|
kind: "ghost",
|
|
196
221
|
size: "sm"
|
|
197
222
|
})))));
|
|
@@ -201,6 +226,7 @@ var AddSelectList = function AddSelectList(_ref) {
|
|
|
201
226
|
exports.AddSelectList = AddSelectList;
|
|
202
227
|
AddSelectList.propTypes = {
|
|
203
228
|
appliedModifiers: _propTypes.default.array,
|
|
229
|
+
displayMetalPanel: _propTypes.default.object,
|
|
204
230
|
filteredItems: _propTypes.default.array,
|
|
205
231
|
metaIconDescription: _propTypes.default.string,
|
|
206
232
|
modifiers: _propTypes.default.object,
|
|
@@ -29,7 +29,7 @@ var _CardFooter = require("./CardFooter");
|
|
|
29
29
|
|
|
30
30
|
var _settings = require("../../settings");
|
|
31
31
|
|
|
32
|
-
var _excluded = ["actionIcons", "actionsPlacement", "children", "className", "clickZone", "description", "label", "media", "mediaPosition", "onClick", "onKeyDown", "onPrimaryButtonClick", "overflowActions", "onSecondaryButtonClick", "pictogram", "primaryButtonHref", "primaryButtonIcon", "primaryButtonKind", "primaryButtonText", "productive", "secondaryButtonHref", "secondaryButtonIcon", "secondaryButtonKind", "secondaryButtonText", "title", "titleSize"],
|
|
32
|
+
var _excluded = ["actionIcons", "actionsPlacement", "children", "className", "clickZone", "description", "label", "media", "mediaPosition", "onClick", "onKeyDown", "onPrimaryButtonClick", "overflowActions", "onSecondaryButtonClick", "pictogram", "primaryButtonHref", "primaryButtonIcon", "primaryButtonKind", "primaryButtonPlacement", "primaryButtonText", "productive", "secondaryButtonHref", "secondaryButtonIcon", "secondaryButtonKind", "secondaryButtonText", "title", "titleSize"],
|
|
33
33
|
_excluded2 = ["id"],
|
|
34
34
|
_excluded3 = ["id", "icon", "onClick", "iconDescription", "onKeyDown", "href"];
|
|
35
35
|
|
|
@@ -50,6 +50,7 @@ var defaults = {
|
|
|
50
50
|
mediaPosition: 'top',
|
|
51
51
|
overflowActions: Object.freeze([]),
|
|
52
52
|
primaryButtonKind: 'primary',
|
|
53
|
+
primaryButtonPlacement: 'bottom',
|
|
53
54
|
productive: false,
|
|
54
55
|
secondaryButtonKind: 'secondary',
|
|
55
56
|
titleSize: 'default'
|
|
@@ -79,6 +80,8 @@ var Card = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
79
80
|
primaryButtonIcon = _ref.primaryButtonIcon,
|
|
80
81
|
_ref$primaryButtonKin = _ref.primaryButtonKind,
|
|
81
82
|
primaryButtonKind = _ref$primaryButtonKin === void 0 ? defaults.primaryButtonKind : _ref$primaryButtonKin,
|
|
83
|
+
_ref$primaryButtonPla = _ref.primaryButtonPlacement,
|
|
84
|
+
primaryButtonPlacement = _ref$primaryButtonPla === void 0 ? defaults.primaryButtonPlacement : _ref$primaryButtonPla,
|
|
82
85
|
primaryButtonText = _ref.primaryButtonText,
|
|
83
86
|
_ref$productive = _ref.productive,
|
|
84
87
|
productive = _ref$productive === void 0 ? defaults.productive : _ref$productive,
|
|
@@ -92,9 +95,9 @@ var Card = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
92
95
|
titleSize = _ref$titleSize === void 0 ? defaults.titleSize : _ref$titleSize,
|
|
93
96
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
94
97
|
var blockClass = "".concat(_settings.pkg.prefix, "--card");
|
|
95
|
-
var hasActions = actionIcons.length > 0 || overflowActions.length > 0;
|
|
98
|
+
var hasActions = actionIcons.length > 0 || overflowActions.length > 0 || primaryButtonText && primaryButtonPlacement === 'top';
|
|
96
99
|
var hasFooterActions = hasActions && actionsPlacement === 'bottom';
|
|
97
|
-
var hasFooterButton = !!secondaryButtonText || !!primaryButtonText;
|
|
100
|
+
var hasFooterButton = !!secondaryButtonText || !!primaryButtonText && primaryButtonPlacement === 'bottom';
|
|
98
101
|
var hasBottomBar = hasFooterActions || hasFooterButton;
|
|
99
102
|
var hasClickEvent = !!onClick || !!onKeyDown;
|
|
100
103
|
var clickableProps = {
|
|
@@ -194,10 +197,15 @@ var Card = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
194
197
|
|
|
195
198
|
var getHeaderProps = function getHeaderProps() {
|
|
196
199
|
return {
|
|
197
|
-
actions: getActions(),
|
|
200
|
+
actions: actionsPlacement === 'top' ? getActions() : '',
|
|
201
|
+
noActionIcons: actionIcons.length > 0 && actionsPlacement === 'top' ? false : true,
|
|
198
202
|
actionsPlacement: actionsPlacement,
|
|
203
|
+
onPrimaryButtonClick: onPrimaryButtonClick,
|
|
204
|
+
primaryButtonIcon: primaryButtonIcon,
|
|
205
|
+
primaryButtonPlacement: primaryButtonPlacement,
|
|
206
|
+
primaryButtonText: primaryButtonText,
|
|
199
207
|
description: description,
|
|
200
|
-
hasActions: hasActions
|
|
208
|
+
hasActions: hasActions,
|
|
201
209
|
label: label,
|
|
202
210
|
title: title,
|
|
203
211
|
titleSize: titleSize
|
|
@@ -216,7 +224,7 @@ var Card = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
216
224
|
|
|
217
225
|
var getFooterProps = function getFooterProps() {
|
|
218
226
|
return {
|
|
219
|
-
actions: getActions(),
|
|
227
|
+
actions: actionsPlacement === 'bottom' ? getActions() : '',
|
|
220
228
|
actionsPlacement: actionsPlacement,
|
|
221
229
|
hasActions: hasFooterActions,
|
|
222
230
|
hasButton: hasFooterButton,
|
|
@@ -225,6 +233,7 @@ var Card = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
225
233
|
primaryButtonHref: primaryButtonHref,
|
|
226
234
|
primaryButtonIcon: primaryButtonIcon,
|
|
227
235
|
primaryButtonKind: primaryButtonKind,
|
|
236
|
+
primaryButtonPlacement: primaryButtonPlacement,
|
|
228
237
|
primaryButtonText: primaryButtonText,
|
|
229
238
|
productive: productive,
|
|
230
239
|
secondaryButtonHref: secondaryButtonHref,
|
|
@@ -274,6 +283,7 @@ Card.propTypes = {
|
|
|
274
283
|
primaryButtonHref: _propTypes.default.string,
|
|
275
284
|
primaryButtonIcon: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
|
276
285
|
primaryButtonKind: _propTypes.default.oneOf(['primary', 'ghost']),
|
|
286
|
+
primaryButtonPlacement: _propTypes.default.oneOf(['top', 'bottom']),
|
|
277
287
|
primaryButtonText: _propTypes.default.node,
|
|
278
288
|
productive: _propTypes.default.bool,
|
|
279
289
|
secondaryButtonHref: _propTypes.default.string,
|
|
@@ -44,6 +44,7 @@ var CardFooter = function CardFooter(_ref) {
|
|
|
44
44
|
primaryButtonIcon = _ref.primaryButtonIcon,
|
|
45
45
|
_ref$primaryButtonKin = _ref.primaryButtonKind,
|
|
46
46
|
primaryButtonKind = _ref$primaryButtonKin === void 0 ? defaults.primaryButtonKind : _ref$primaryButtonKin,
|
|
47
|
+
primaryButtonPlacement = _ref.primaryButtonPlacement,
|
|
47
48
|
primaryButtonText = _ref.primaryButtonText,
|
|
48
49
|
_ref$productive = _ref.productive,
|
|
49
50
|
productive = _ref$productive === void 0 ? defaults.productive : _ref$productive,
|
|
@@ -63,7 +64,7 @@ var CardFooter = function CardFooter(_ref) {
|
|
|
63
64
|
size: "field",
|
|
64
65
|
renderIcon: secondaryButtonIcon,
|
|
65
66
|
href: secondaryButtonHref
|
|
66
|
-
}, secondaryButtonText), primaryButtonText && /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, {
|
|
67
|
+
}, secondaryButtonText), primaryButtonText && primaryButtonPlacement === 'bottom' && /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, {
|
|
67
68
|
kind: productive ? 'ghost' : primaryButtonKind,
|
|
68
69
|
onClick: onPrimaryButtonClick,
|
|
69
70
|
size: "field",
|
|
@@ -84,6 +85,7 @@ CardFooter.propTypes = {
|
|
|
84
85
|
primaryButtonHref: _propTypes.default.string,
|
|
85
86
|
primaryButtonIcon: _propTypes.default.string,
|
|
86
87
|
primaryButtonKind: _propTypes.default.oneOf(['primary', 'ghost']),
|
|
88
|
+
primaryButtonPlacement: _propTypes.default.oneOf(['top', 'bottom']),
|
|
87
89
|
primaryButtonText: _propTypes.default.string,
|
|
88
90
|
productive: _propTypes.default.bool,
|
|
89
91
|
secondaryButtonHref: _propTypes.default.string,
|
|
@@ -17,6 +17,8 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
17
17
|
|
|
18
18
|
var _settings = require("../../settings");
|
|
19
19
|
|
|
20
|
+
var _carbonComponentsReact = require("carbon-components-react");
|
|
21
|
+
|
|
20
22
|
//
|
|
21
23
|
// Copyright IBM Corp. 2020, 2021
|
|
22
24
|
//
|
|
@@ -33,6 +35,11 @@ var CardHeader = function CardHeader(_ref) {
|
|
|
33
35
|
var _cx;
|
|
34
36
|
|
|
35
37
|
var actions = _ref.actions,
|
|
38
|
+
noActionIcons = _ref.noActionIcons,
|
|
39
|
+
onPrimaryButtonClick = _ref.onPrimaryButtonClick,
|
|
40
|
+
primaryButtonIcon = _ref.primaryButtonIcon,
|
|
41
|
+
primaryButtonPlacement = _ref.primaryButtonPlacement,
|
|
42
|
+
primaryButtonText = _ref.primaryButtonText,
|
|
36
43
|
description = _ref.description,
|
|
37
44
|
_ref$hasActions = _ref.hasActions,
|
|
38
45
|
hasActions = _ref$hasActions === void 0 ? defaults.hasActions : _ref$hasActions,
|
|
@@ -43,6 +50,8 @@ var CardHeader = function CardHeader(_ref) {
|
|
|
43
50
|
var blockClass = "".concat(_settings.pkg.prefix, "--card");
|
|
44
51
|
var headerClass = "".concat(blockClass, "__header");
|
|
45
52
|
var headerClasses = (0, _classnames.default)(headerClass, (_cx = {}, (0, _defineProperty2.default)(_cx, "".concat(headerClass, "-label-only"), label && !title && !description), (0, _defineProperty2.default)(_cx, "".concat(headerClass, "-has-label"), !!label), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__title-lg"), titleSize === 'large'), _cx));
|
|
53
|
+
var actionGhostButton = "".concat(blockClass, "__actions-header-ghost-button");
|
|
54
|
+
var actionGhostButtonClass = (0, _classnames.default)(actionGhostButton, (0, _defineProperty2.default)({}, "".concat(actionGhostButton, "--only"), noActionIcons));
|
|
46
55
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
47
56
|
className: headerClasses
|
|
48
57
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -57,7 +66,13 @@ var CardHeader = function CardHeader(_ref) {
|
|
|
57
66
|
className: "".concat(blockClass, "__description")
|
|
58
67
|
}, description)), hasActions && /*#__PURE__*/_react.default.createElement("div", {
|
|
59
68
|
className: "".concat(blockClass, "__actions ").concat(blockClass, "__actions-header")
|
|
60
|
-
}, actions
|
|
69
|
+
}, actions, primaryButtonText && primaryButtonPlacement === 'top' && /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, {
|
|
70
|
+
kind: "ghost",
|
|
71
|
+
size: "small",
|
|
72
|
+
renderIcon: primaryButtonIcon,
|
|
73
|
+
onClick: onPrimaryButtonClick,
|
|
74
|
+
className: actionGhostButtonClass
|
|
75
|
+
}, primaryButtonText))));
|
|
61
76
|
};
|
|
62
77
|
|
|
63
78
|
exports.CardHeader = CardHeader;
|
|
@@ -66,6 +81,11 @@ CardHeader.propTypes = {
|
|
|
66
81
|
description: _propTypes.default.string,
|
|
67
82
|
hasActions: _propTypes.default.bool,
|
|
68
83
|
label: _propTypes.default.string,
|
|
84
|
+
noActionIcons: _propTypes.default.bool,
|
|
85
|
+
onPrimaryButtonClick: _propTypes.default.func,
|
|
86
|
+
primaryButtonIcon: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
|
87
|
+
primaryButtonPlacement: _propTypes.default.oneOf(['top', 'bottom']),
|
|
88
|
+
primaryButtonText: _propTypes.default.string,
|
|
69
89
|
title: _propTypes.default.string,
|
|
70
90
|
titleSize: _propTypes.default.oneOf(['default', 'large'])
|
|
71
91
|
};
|