@carbon/ibm-products 1.6.1 → 1.9.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 +224 -143
- 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 +1 -2
- package/css/index-without-carbon-released-only.css.map +1 -1
- package/css/index-without-carbon-released-only.min.css +1 -1
- package/css/index-without-carbon-released-only.min.css.map +1 -1
- package/css/index-without-carbon.css +178 -142
- 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 +178 -142
- 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/APIKeyModal/APIKeyModal.js +10 -13
- package/es/components/ActionBar/ActionBar.js +0 -3
- package/es/components/ActionBar/ActionBarItem.js +2 -6
- package/es/components/ActionSet/ActionSet.js +11 -13
- package/es/components/AddSelect/AddSelect.js +121 -25
- package/es/components/AddSelect/AddSelectBreadcrumbs.js +5 -5
- package/es/components/AddSelect/AddSelectColumn.js +21 -0
- package/es/components/AddSelect/AddSelectList.js +68 -9
- package/es/components/AddSelect/AddSelectSidebar.js +43 -5
- package/es/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +0 -3
- package/es/components/ButtonMenu/ButtonMenu.js +6 -4
- package/es/components/ButtonMenu/ButtonMenuItem.js +1 -2
- package/es/components/Card/Card.js +31 -21
- package/es/components/Card/CardFooter.js +14 -10
- package/es/components/Card/CardHeader.js +8 -6
- package/es/components/Cascade/Cascade.js +5 -4
- package/es/components/ComboButton/ComboButton.js +0 -4
- package/es/components/ComboButton/ComboButtonItem/index.js +0 -5
- package/es/components/CreateFullPage/CreateFullPageStep.js +15 -8
- package/es/components/CreateModal/CreateModal.js +1 -4
- package/es/components/CreateTearsheet/CreateTearsheet.js +10 -11
- package/es/components/CreateTearsheet/CreateTearsheetStep.js +18 -14
- package/es/components/DataSpreadsheet/DataSpreadsheet.js +454 -0
- package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +322 -0
- package/es/components/DataSpreadsheet/DataSpreadsheetHeader.js +64 -0
- package/es/components/DataSpreadsheet/createActiveCellFn.js +45 -0
- package/es/components/DataSpreadsheet/createCellSelectionArea.js +45 -0
- package/es/components/DataSpreadsheet/generateData.js +47 -0
- package/es/components/DataSpreadsheet/getCellSize.js +30 -0
- package/es/components/{CancelableTextEdit → DataSpreadsheet}/index.js +2 -2
- package/es/components/EditSidePanel/EditSidePanel.js +9 -10
- package/es/components/EmptyStates/EmptyState.js +7 -6
- package/es/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +4 -8
- package/es/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +4 -8
- package/es/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +4 -8
- package/es/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +4 -8
- package/es/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +4 -8
- package/es/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +4 -8
- package/es/components/ExampleComponent/ExampleComponent.js +12 -13
- package/es/components/ExportModal/ExportModal.js +13 -9
- package/es/components/ExpressiveCard/ExpressiveCard.js +0 -8
- package/es/components/ImportModal/ImportModal.js +7 -5
- package/es/components/InlineEdit/InlineEdit.js +51 -46
- package/es/components/LoadingBar/LoadingBar.js +13 -17
- package/es/components/ModifiedTabs/ModifiedTabLabelNew.js +0 -4
- package/es/components/ModifiedTabs/ModifiedTabLabelWithClose.js +0 -5
- package/es/components/ModifiedTabs/ModifiedTabs.js +24 -18
- package/es/components/NotificationsPanel/NotificationsPanel.js +109 -86
- package/es/components/OptionsTile/OptionsTile.js +6 -9
- package/es/components/PageHeader/PageHeader.js +10 -7
- package/es/components/ProductiveCard/ProductiveCard.js +23 -12
- package/es/components/RemoveModal/RemoveModal.js +0 -3
- package/es/components/SidePanel/SidePanel.js +22 -17
- package/es/components/TagSet/TagSet.js +13 -9
- package/es/components/TagSet/TagSetModal.js +16 -12
- package/es/components/TagSet/TagSetOverflow.js +21 -13
- package/es/components/Tearsheet/Tearsheet.js +27 -18
- package/es/components/Tearsheet/TearsheetNarrow.js +18 -15
- package/es/components/Tearsheet/TearsheetShell.js +3 -4
- package/es/components/Toolbar/ToolbarButton.js +0 -3
- package/es/components/WebTerminal/WebTerminal.js +17 -18
- package/es/components/index.js +2 -2
- package/es/global/js/hooks/index.js +1 -0
- package/es/global/js/hooks/useActiveElement.js +27 -0
- package/es/global/js/package-settings.js +2 -1
- package/es/global/js/utils/DisplayBox.js +31 -0
- package/es/global/js/utils/Wrap.js +7 -5
- package/es/global/js/utils/deepCloneObject.js +26 -0
- package/es/global/js/utils/getScrollbarWidth.js +14 -0
- package/lib/components/APIKeyModal/APIKeyModal.js +10 -13
- package/lib/components/ActionBar/ActionBar.js +0 -3
- package/lib/components/ActionBar/ActionBarItem.js +2 -6
- package/lib/components/ActionSet/ActionSet.js +11 -13
- package/lib/components/AddSelect/AddSelect.js +119 -24
- package/lib/components/AddSelect/AddSelectBreadcrumbs.js +3 -4
- package/lib/components/AddSelect/AddSelectColumn.js +37 -0
- package/lib/components/AddSelect/AddSelectList.js +66 -9
- package/lib/components/AddSelect/AddSelectSidebar.js +43 -4
- package/lib/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +0 -3
- package/lib/components/ButtonMenu/ButtonMenu.js +6 -4
- package/lib/components/ButtonMenu/ButtonMenuItem.js +1 -2
- package/lib/components/Card/Card.js +31 -21
- package/lib/components/Card/CardFooter.js +14 -10
- package/lib/components/Card/CardHeader.js +8 -6
- package/lib/components/Cascade/Cascade.js +5 -4
- package/lib/components/ComboButton/ComboButton.js +0 -4
- package/lib/components/ComboButton/ComboButtonItem/index.js +0 -5
- package/lib/components/CreateFullPage/CreateFullPageStep.js +17 -14
- package/lib/components/CreateModal/CreateModal.js +1 -4
- package/lib/components/CreateTearsheet/CreateTearsheet.js +10 -11
- package/lib/components/CreateTearsheet/CreateTearsheetStep.js +20 -20
- package/lib/components/DataSpreadsheet/DataSpreadsheet.js +478 -0
- package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +349 -0
- package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.js +80 -0
- package/lib/components/DataSpreadsheet/createActiveCellFn.js +56 -0
- package/lib/components/DataSpreadsheet/createCellSelectionArea.js +56 -0
- package/lib/components/DataSpreadsheet/generateData.js +58 -0
- package/lib/components/DataSpreadsheet/getCellSize.js +39 -0
- package/lib/components/DataSpreadsheet/index.js +13 -0
- package/lib/components/EditSidePanel/EditSidePanel.js +9 -10
- package/lib/components/EmptyStates/EmptyState.js +9 -8
- package/lib/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +3 -7
- package/lib/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +3 -7
- package/lib/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +3 -7
- package/lib/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +3 -7
- package/lib/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +3 -7
- package/lib/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +3 -7
- package/lib/components/ExampleComponent/ExampleComponent.js +12 -13
- package/lib/components/ExportModal/ExportModal.js +13 -9
- package/lib/components/ExpressiveCard/ExpressiveCard.js +0 -8
- package/lib/components/ImportModal/ImportModal.js +7 -5
- package/lib/components/InlineEdit/InlineEdit.js +51 -46
- package/lib/components/LoadingBar/LoadingBar.js +13 -17
- package/lib/components/ModifiedTabs/ModifiedTabLabelNew.js +0 -4
- package/lib/components/ModifiedTabs/ModifiedTabLabelWithClose.js +0 -5
- package/lib/components/ModifiedTabs/ModifiedTabs.js +24 -18
- package/lib/components/NotificationsPanel/NotificationsPanel.js +109 -86
- package/lib/components/OptionsTile/OptionsTile.js +6 -9
- package/lib/components/PageHeader/PageHeader.js +9 -6
- package/lib/components/ProductiveCard/ProductiveCard.js +24 -18
- package/lib/components/RemoveModal/RemoveModal.js +0 -3
- package/lib/components/SidePanel/SidePanel.js +22 -17
- package/lib/components/TagSet/TagSet.js +13 -9
- package/lib/components/TagSet/TagSetModal.js +17 -13
- package/lib/components/TagSet/TagSetOverflow.js +24 -19
- package/lib/components/Tearsheet/Tearsheet.js +26 -17
- package/lib/components/Tearsheet/TearsheetNarrow.js +18 -15
- package/lib/components/Tearsheet/TearsheetShell.js +2 -3
- package/lib/components/Toolbar/ToolbarButton.js +0 -3
- package/lib/components/WebTerminal/WebTerminal.js +17 -18
- package/lib/components/index.js +8 -8
- package/lib/global/js/hooks/index.js +8 -0
- package/lib/global/js/hooks/useActiveElement.js +39 -0
- package/lib/global/js/package-settings.js +2 -1
- package/lib/global/js/utils/DisplayBox.js +46 -0
- package/lib/global/js/utils/Wrap.js +7 -5
- package/lib/global/js/utils/deepCloneObject.js +37 -0
- package/lib/global/js/utils/getScrollbarWidth.js +23 -0
- package/package.json +18 -16
- package/scss/components/{CancelableTextEdit → ActionBar}/_storybook-styles.scss +2 -2
- package/scss/components/ActionSet/_storybook-styles.scss +1 -3
- package/scss/components/AddSelect/_add-select.scss +77 -1
- package/scss/components/BreadcrumbWithOverflow/_storybook-styles.scss +8 -0
- package/scss/components/ButtonSetWithOverflow/_storybook-styles.scss +8 -0
- package/scss/components/DataSpreadsheet/_data-spreadsheet.scss +120 -0
- package/scss/components/{CancelableTextEdit → DataSpreadsheet}/_index.scss +2 -2
- package/scss/components/DataSpreadsheet/_storybook-styles.scss +6 -0
- package/scss/components/InlineEdit/_inline-edit.scss +22 -8
- package/scss/components/InlineEdit/_storybook-styles.scss +1 -0
- package/scss/components/TagSet/_storybook-styles.scss +8 -0
- package/scss/components/Tearsheet/_tearsheet.scss +1 -2
- package/scss/components/_index.scss +1 -1
- package/scss/global/styles/_display-box.scss +62 -0
- package/es/components/CancelableTextEdit/CancelableTextEdit.js +0 -245
- package/lib/components/CancelableTextEdit/CancelableTextEdit.js +0 -265
- package/lib/components/CancelableTextEdit/index.js +0 -13
- package/scss/components/CancelableTextEdit/_cancelable-text-edit.scss +0 -212
|
@@ -37,13 +37,24 @@ var _AddSelectBreadcrumbs = require("./AddSelectBreadcrumbs");
|
|
|
37
37
|
|
|
38
38
|
var _AddSelectList = require("./AddSelectList");
|
|
39
39
|
|
|
40
|
-
var
|
|
40
|
+
var _AddSelectColumn = require("./AddSelectColumn");
|
|
41
|
+
|
|
42
|
+
var _excluded = ["className", "description", "influencerTitle", "inputPlaceholder", "items", "itemsLabel", "multi", "noResultsDescription", "noResultsTitle", "noSelectionDescription", "noSelectionTitle", "onClose", "onCloseButtonText", "onSearchFilter", "onSubmit", "onSubmitButtonText", "open", "removeIconDescription", "textInputLabel", "title"],
|
|
43
|
+
_excluded2 = ["children"];
|
|
41
44
|
|
|
42
45
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
43
46
|
|
|
44
47
|
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; }
|
|
45
48
|
|
|
46
|
-
var
|
|
49
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
50
|
+
|
|
51
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
52
|
+
|
|
53
|
+
var componentName = 'AddSelect'; // Default values for props
|
|
54
|
+
|
|
55
|
+
var defaults = {
|
|
56
|
+
items: Object.freeze([])
|
|
57
|
+
};
|
|
47
58
|
var AddSelect = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
48
59
|
var _cx;
|
|
49
60
|
|
|
@@ -51,7 +62,8 @@ var AddSelect = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
51
62
|
description = _ref.description,
|
|
52
63
|
influencerTitle = _ref.influencerTitle,
|
|
53
64
|
inputPlaceholder = _ref.inputPlaceholder,
|
|
54
|
-
items = _ref.items,
|
|
65
|
+
_ref$items = _ref.items,
|
|
66
|
+
items = _ref$items === void 0 ? defaults.items : _ref$items,
|
|
55
67
|
itemsLabel = _ref.itemsLabel,
|
|
56
68
|
multi = _ref.multi,
|
|
57
69
|
noResultsDescription = _ref.noResultsDescription,
|
|
@@ -64,6 +76,8 @@ var AddSelect = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
64
76
|
onSubmit = _ref.onSubmit,
|
|
65
77
|
onSubmitButtonText = _ref.onSubmitButtonText,
|
|
66
78
|
open = _ref.open,
|
|
79
|
+
removeIconDescription = _ref.removeIconDescription,
|
|
80
|
+
textInputLabel = _ref.textInputLabel,
|
|
67
81
|
title = _ref.title,
|
|
68
82
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
69
83
|
var blockClass = "".concat(_settings.pkg.prefix, "--add-select"); // hooks
|
|
@@ -86,7 +100,78 @@ var AddSelect = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
86
100
|
var _useState7 = (0, _react.useState)(''),
|
|
87
101
|
_useState8 = (0, _slicedToArray2.default)(_useState7, 2),
|
|
88
102
|
searchTerm = _useState8[0],
|
|
89
|
-
setSearchTerm = _useState8[1];
|
|
103
|
+
setSearchTerm = _useState8[1];
|
|
104
|
+
|
|
105
|
+
var _useState9 = (0, _react.useState)({}),
|
|
106
|
+
_useState10 = (0, _slicedToArray2.default)(_useState9, 2),
|
|
107
|
+
normalizedItems = _useState10[0],
|
|
108
|
+
setNormalizedItems = _useState10[1];
|
|
109
|
+
|
|
110
|
+
var _useState11 = (0, _react.useState)(false),
|
|
111
|
+
_useState12 = (0, _slicedToArray2.default)(_useState11, 2),
|
|
112
|
+
useNormalizedItems = _useState12[0],
|
|
113
|
+
setUsedNormalizedItems = _useState12[1];
|
|
114
|
+
|
|
115
|
+
(0, _react.useEffect)(function () {
|
|
116
|
+
var normalize = function normalize(arr, parentId) {
|
|
117
|
+
return arr.reduce(function (acc, cur) {
|
|
118
|
+
var children = cur.children,
|
|
119
|
+
item = (0, _objectWithoutProperties2.default)(cur, _excluded2);
|
|
120
|
+
acc[cur.id] = _objectSpread({}, item);
|
|
121
|
+
|
|
122
|
+
if (parentId) {
|
|
123
|
+
acc[cur.id].parent = parentId;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
if (children) {
|
|
127
|
+
acc[cur.id].children = children.map(function (child) {
|
|
128
|
+
return child.id;
|
|
129
|
+
});
|
|
130
|
+
var child = normalize(children, cur.id);
|
|
131
|
+
return _objectSpread(_objectSpread({}, acc), child);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return acc;
|
|
135
|
+
}, {});
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
if (multi && items.find(function (item) {
|
|
139
|
+
return item.children;
|
|
140
|
+
})) {
|
|
141
|
+
var newItems = normalize(items);
|
|
142
|
+
setNormalizedItems(newItems);
|
|
143
|
+
setUsedNormalizedItems(true);
|
|
144
|
+
}
|
|
145
|
+
}, [items, multi]);
|
|
146
|
+
|
|
147
|
+
var getPages = function getPages() {
|
|
148
|
+
var results = [];
|
|
149
|
+
var itemIds = Object.keys(normalizedItems);
|
|
150
|
+
var topLevelItems = [];
|
|
151
|
+
itemIds.forEach(function (itemId) {
|
|
152
|
+
if (!normalizedItems[itemId].parent) {
|
|
153
|
+
topLevelItems.push(normalizedItems[itemId]);
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
results.push(topLevelItems);
|
|
157
|
+
|
|
158
|
+
if (path.length) {
|
|
159
|
+
var pathIds = path.map(function (p) {
|
|
160
|
+
return p.id;
|
|
161
|
+
});
|
|
162
|
+
pathIds.forEach(function (pathId) {
|
|
163
|
+
var childItems = [];
|
|
164
|
+
itemIds.forEach(function (itemId) {
|
|
165
|
+
if (normalizedItems[itemId].parent === pathId) {
|
|
166
|
+
childItems.push(normalizedItems[itemId]);
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
results.push(childItems);
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
return results;
|
|
174
|
+
}; // handlers
|
|
90
175
|
|
|
91
176
|
|
|
92
177
|
var handleSearch = function handleSearch(e) {
|
|
@@ -118,18 +203,27 @@ var AddSelect = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
118
203
|
} // otherwise use the default label filter
|
|
119
204
|
|
|
120
205
|
|
|
121
|
-
return item.
|
|
206
|
+
return item.title.toLowerCase().includes(searchTerm);
|
|
122
207
|
});
|
|
123
208
|
return results;
|
|
124
209
|
};
|
|
125
210
|
|
|
126
|
-
var
|
|
211
|
+
var itemsToDisplay = useNormalizedItems ? getPages() : getFilteredItems();
|
|
212
|
+
var commonListProps = {
|
|
213
|
+
multi: multi,
|
|
214
|
+
multiSelection: multiSelection,
|
|
215
|
+
path: path,
|
|
216
|
+
setMultiSelection: setMultiSelection,
|
|
217
|
+
setPath: setPath,
|
|
218
|
+
setSingleSelection: setSingleSelection,
|
|
219
|
+
singleSelection: singleSelection
|
|
220
|
+
}; // main content
|
|
127
221
|
|
|
128
222
|
var body = /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
129
223
|
className: "".concat(blockClass, "__header")
|
|
130
224
|
}, /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.TextInput, {
|
|
131
225
|
id: "temp-id",
|
|
132
|
-
labelText:
|
|
226
|
+
labelText: textInputLabel,
|
|
133
227
|
placeholder: inputPlaceholder,
|
|
134
228
|
value: searchTerm,
|
|
135
229
|
onChange: handleSearch
|
|
@@ -141,25 +235,25 @@ var AddSelect = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
141
235
|
setPath: setPath
|
|
142
236
|
}) : /*#__PURE__*/_react.default.createElement("p", {
|
|
143
237
|
className: "".concat(blockClass, "__items-label")
|
|
144
|
-
}, itemsLabel), /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Tag, {
|
|
238
|
+
}, itemsLabel), !useNormalizedItems && /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Tag, {
|
|
145
239
|
type: "gray",
|
|
146
240
|
size: "sm",
|
|
147
241
|
className: "".concat(blockClass, "__items-label-tag")
|
|
148
|
-
},
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
}) : /*#__PURE__*/_react.default.createElement("div", {
|
|
242
|
+
}, itemsToDisplay.length))), useNormalizedItems ? /*#__PURE__*/_react.default.createElement("div", {
|
|
243
|
+
className: "".concat(blockClass, "__columns")
|
|
244
|
+
}, itemsToDisplay.map(function (page, idx) {
|
|
245
|
+
return /*#__PURE__*/_react.default.createElement(_AddSelectColumn.AddSelectColumn, (0, _extends2.default)({}, commonListProps, {
|
|
246
|
+
key: idx,
|
|
247
|
+
filteredItems: page
|
|
248
|
+
}));
|
|
249
|
+
})) : /*#__PURE__*/_react.default.createElement("div", null, itemsToDisplay.length > 0 ? /*#__PURE__*/_react.default.createElement(_AddSelectList.AddSelectList, (0, _extends2.default)({}, commonListProps, {
|
|
250
|
+
filteredItems: itemsToDisplay
|
|
251
|
+
})) : /*#__PURE__*/_react.default.createElement("div", {
|
|
158
252
|
className: "".concat(blockClass, "__body")
|
|
159
253
|
}, /*#__PURE__*/_react.default.createElement(_NoDataEmptyState.NoDataEmptyState, {
|
|
160
254
|
subtitle: noResultsDescription,
|
|
161
255
|
title: noResultsTitle
|
|
162
|
-
})));
|
|
256
|
+
}))));
|
|
163
257
|
|
|
164
258
|
var commonTearsheetProps = {
|
|
165
259
|
open: open,
|
|
@@ -182,7 +276,9 @@ var AddSelect = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
182
276
|
items: items,
|
|
183
277
|
multiSelection: multiSelection,
|
|
184
278
|
noSelectionDescription: noSelectionDescription,
|
|
185
|
-
noSelectionTitle: noSelectionTitle
|
|
279
|
+
noSelectionTitle: noSelectionTitle,
|
|
280
|
+
removeIconDescription: removeIconDescription,
|
|
281
|
+
setMultiSelection: setMultiSelection
|
|
186
282
|
};
|
|
187
283
|
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));
|
|
188
284
|
return /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({
|
|
@@ -201,7 +297,7 @@ AddSelect.propTypes = {
|
|
|
201
297
|
inputPlaceholder: _propTypes.default.string,
|
|
202
298
|
items: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
203
299
|
id: _propTypes.default.string.isRequired,
|
|
204
|
-
|
|
300
|
+
title: _propTypes.default.string.isRequired,
|
|
205
301
|
value: _propTypes.default.string.isRequired
|
|
206
302
|
})),
|
|
207
303
|
itemsLabel: _propTypes.default.string,
|
|
@@ -216,9 +312,8 @@ AddSelect.propTypes = {
|
|
|
216
312
|
onSubmit: _propTypes.default.func,
|
|
217
313
|
onSubmitButtonText: _propTypes.default.string,
|
|
218
314
|
open: _propTypes.default.bool,
|
|
315
|
+
removeIconDescription: _propTypes.default.string,
|
|
316
|
+
textInputLabel: _propTypes.default.string,
|
|
219
317
|
title: _propTypes.default.string
|
|
220
318
|
};
|
|
221
|
-
AddSelect.defaultProps = {
|
|
222
|
-
items: []
|
|
223
|
-
};
|
|
224
319
|
AddSelect.displayName = componentName;
|
|
@@ -29,11 +29,10 @@ var AddSelectBreadcrumbs = function AddSelectBreadcrumbs(_ref) {
|
|
|
29
29
|
setPath = _ref.setPath;
|
|
30
30
|
|
|
31
31
|
var clickHandler = function clickHandler(id) {
|
|
32
|
-
var
|
|
33
|
-
var pathIdx = newPath.findIndex(function (entry) {
|
|
32
|
+
var pathIdx = path.findIndex(function (entry) {
|
|
34
33
|
return entry.id === id;
|
|
35
34
|
});
|
|
36
|
-
var finalPath =
|
|
35
|
+
var finalPath = (0, _toConsumableArray2.default)(path).splice(0, pathIdx + 1);
|
|
37
36
|
setPath(finalPath);
|
|
38
37
|
};
|
|
39
38
|
|
|
@@ -58,7 +57,7 @@ var AddSelectBreadcrumbs = function AddSelectBreadcrumbs(_ref) {
|
|
|
58
57
|
key: entry.id,
|
|
59
58
|
isCurrentPage: isCurrentPage,
|
|
60
59
|
onClick: crumbHandler
|
|
61
|
-
}, entry.
|
|
60
|
+
}, entry.title);
|
|
62
61
|
}));
|
|
63
62
|
};
|
|
64
63
|
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.AddSelectColumn = void 0;
|
|
9
|
+
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
|
|
12
|
+
var _react = _interopRequireDefault(require("react"));
|
|
13
|
+
|
|
14
|
+
var _settings = require("../../settings");
|
|
15
|
+
|
|
16
|
+
var _AddSelectList = require("./AddSelectList");
|
|
17
|
+
|
|
18
|
+
//
|
|
19
|
+
// Copyright IBM Corp. 2022
|
|
20
|
+
//
|
|
21
|
+
// This source code is licensed under the Apache-2.0 license found in the
|
|
22
|
+
// LICENSE file in the root directory of this source tree.
|
|
23
|
+
//
|
|
24
|
+
// import PropTypes from 'prop-types';
|
|
25
|
+
var componentName = 'AddSelect';
|
|
26
|
+
|
|
27
|
+
var AddSelectColumn = function AddSelectColumn(props) {
|
|
28
|
+
var blockClass = "".concat(_settings.pkg.prefix, "--add-select__col");
|
|
29
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
30
|
+
className: blockClass
|
|
31
|
+
}, /*#__PURE__*/_react.default.createElement(_AddSelectList.AddSelectList, (0, _extends2.default)({}, props, {
|
|
32
|
+
inColumn: true
|
|
33
|
+
})));
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
exports.AddSelectColumn = AddSelectColumn;
|
|
37
|
+
AddSelectColumn.displayName = componentName;
|
|
@@ -29,6 +29,7 @@ var componentName = 'AddSelectList';
|
|
|
29
29
|
|
|
30
30
|
var AddSelectList = function AddSelectList(_ref) {
|
|
31
31
|
var filteredItems = _ref.filteredItems,
|
|
32
|
+
inColumn = _ref.inColumn,
|
|
32
33
|
multi = _ref.multi,
|
|
33
34
|
multiSelection = _ref.multiSelection,
|
|
34
35
|
path = _ref.path,
|
|
@@ -57,11 +58,59 @@ var AddSelectList = function AddSelectList(_ref) {
|
|
|
57
58
|
|
|
58
59
|
var onNavigateItem = function onNavigateItem(_ref2) {
|
|
59
60
|
var id = _ref2.id,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
title = _ref2.title,
|
|
62
|
+
parent = _ref2.parent;
|
|
63
|
+
|
|
64
|
+
// if multi select
|
|
65
|
+
if (multi) {
|
|
66
|
+
// if top level reset the path
|
|
67
|
+
if (!parent) {
|
|
68
|
+
setPath([{
|
|
69
|
+
id: id,
|
|
70
|
+
title: title
|
|
71
|
+
}]);
|
|
72
|
+
} else {
|
|
73
|
+
var pathIds = path.map(function (p) {
|
|
74
|
+
return p.id;
|
|
75
|
+
}); // if item is already selected somewhere go back to that item
|
|
76
|
+
|
|
77
|
+
if (pathIds.includes(id)) {
|
|
78
|
+
var pathIdx = pathIds.findIndex(function (pathId) {
|
|
79
|
+
return pathId === id;
|
|
80
|
+
});
|
|
81
|
+
var newPath = (0, _toConsumableArray2.default)(path).splice(0, pathIdx + 1);
|
|
82
|
+
setPath((0, _toConsumableArray2.default)(newPath));
|
|
83
|
+
} else {
|
|
84
|
+
// if the item is on the same level as another selected item start from the parent level
|
|
85
|
+
if (path.find(function (p) {
|
|
86
|
+
return p.parent === parent;
|
|
87
|
+
})) {
|
|
88
|
+
var parentIdx = path.findIndex(function (p) {
|
|
89
|
+
return p.id === parent;
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
var _newPath = (0, _toConsumableArray2.default)(path).splice(0, parentIdx + 1);
|
|
93
|
+
|
|
94
|
+
setPath([].concat((0, _toConsumableArray2.default)(_newPath), [{
|
|
95
|
+
id: id,
|
|
96
|
+
title: title,
|
|
97
|
+
parent: parent
|
|
98
|
+
}]));
|
|
99
|
+
} else {
|
|
100
|
+
setPath([].concat((0, _toConsumableArray2.default)(path), [{
|
|
101
|
+
id: id,
|
|
102
|
+
title: title,
|
|
103
|
+
parent: parent
|
|
104
|
+
}]));
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
} else {
|
|
109
|
+
setPath([].concat((0, _toConsumableArray2.default)(path), [{
|
|
110
|
+
id: id,
|
|
111
|
+
title: title
|
|
112
|
+
}]));
|
|
113
|
+
}
|
|
65
114
|
};
|
|
66
115
|
|
|
67
116
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -71,15 +120,22 @@ var AddSelectList = function AddSelectList(_ref) {
|
|
|
71
120
|
className: "".concat(blockClass)
|
|
72
121
|
}, /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.StructuredListBody, null, filteredItems.map(function (item) {
|
|
73
122
|
return /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.StructuredListRow, {
|
|
74
|
-
key: item.id
|
|
75
|
-
|
|
123
|
+
key: item.id,
|
|
124
|
+
className: "".concat(blockClass, "-row")
|
|
125
|
+
}, /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.StructuredListCell, {
|
|
126
|
+
className: "".concat(blockClass, "-cell")
|
|
127
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
76
128
|
className: "".concat(blockClass, "-cell-wrapper")
|
|
77
129
|
}, multi ? /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Checkbox, {
|
|
78
130
|
className: "".concat(blockClass, "-checkbox"),
|
|
79
131
|
onChange: function onChange(value) {
|
|
80
132
|
return handleMultiSelection(item.id, value);
|
|
81
133
|
},
|
|
82
|
-
labelText:
|
|
134
|
+
labelText: !inColumn ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("span", {
|
|
135
|
+
className: "".concat(blockClass, "-cell-title")
|
|
136
|
+
}, item.title), /*#__PURE__*/_react.default.createElement("span", {
|
|
137
|
+
className: "".concat(blockClass, "-cell-subtitle")
|
|
138
|
+
}, item.subtitle)) : item.title,
|
|
83
139
|
id: item.id,
|
|
84
140
|
checked: multiSelection.includes(item.id)
|
|
85
141
|
}) : /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.RadioButton, {
|
|
@@ -87,7 +143,7 @@ var AddSelectList = function AddSelectList(_ref) {
|
|
|
87
143
|
name: "add-select-selections",
|
|
88
144
|
id: item.id,
|
|
89
145
|
value: item.value,
|
|
90
|
-
labelText: item.
|
|
146
|
+
labelText: item.title,
|
|
91
147
|
onChange: handleSingleSelection,
|
|
92
148
|
selected: item.value === singleSelection
|
|
93
149
|
}), item.children && /*#__PURE__*/_react.default.createElement(_iconsReact.ChevronRight16, {
|
|
@@ -101,6 +157,7 @@ var AddSelectList = function AddSelectList(_ref) {
|
|
|
101
157
|
exports.AddSelectList = AddSelectList;
|
|
102
158
|
AddSelectList.propTypes = {
|
|
103
159
|
filteredItems: _propTypes.default.array,
|
|
160
|
+
inColumn: _propTypes.default.bool,
|
|
104
161
|
multi: _propTypes.default.bool,
|
|
105
162
|
multiSelection: _propTypes.default.array,
|
|
106
163
|
path: _propTypes.default.array,
|
|
@@ -13,6 +13,8 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
13
13
|
|
|
14
14
|
var _carbonComponentsReact = require("carbon-components-react");
|
|
15
15
|
|
|
16
|
+
var _iconsReact = require("@carbon/icons-react");
|
|
17
|
+
|
|
16
18
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
17
19
|
|
|
18
20
|
var _NoDataEmptyState = require("../../components/EmptyStates/NoDataEmptyState");
|
|
@@ -27,8 +29,18 @@ var AddSelectSidebar = function AddSelectSidebar(_ref) {
|
|
|
27
29
|
items = _ref.items,
|
|
28
30
|
multiSelection = _ref.multiSelection,
|
|
29
31
|
noSelectionDescription = _ref.noSelectionDescription,
|
|
30
|
-
noSelectionTitle = _ref.noSelectionTitle
|
|
31
|
-
|
|
32
|
+
noSelectionTitle = _ref.noSelectionTitle,
|
|
33
|
+
removeIconDescription = _ref.removeIconDescription,
|
|
34
|
+
setMultiSelection = _ref.setMultiSelection;
|
|
35
|
+
var blockClass = "".concat(_settings.pkg.prefix, "--add-select__sidebar");
|
|
36
|
+
|
|
37
|
+
var handleItemRemove = function handleItemRemove(id) {
|
|
38
|
+
var newSelections = multiSelection.filter(function (v) {
|
|
39
|
+
return v !== id;
|
|
40
|
+
});
|
|
41
|
+
setMultiSelection(newSelections);
|
|
42
|
+
}; // utility to flatten the list of items and their children into a single searchable array
|
|
43
|
+
|
|
32
44
|
|
|
33
45
|
var flattenItems = function flattenItems(arr) {
|
|
34
46
|
return arr.reduce(function (prev, cur) {
|
|
@@ -44,6 +56,31 @@ var AddSelectSidebar = function AddSelectSidebar(_ref) {
|
|
|
44
56
|
return item.id === selectedId;
|
|
45
57
|
});
|
|
46
58
|
});
|
|
59
|
+
|
|
60
|
+
var getTitle = function getTitle(_ref2) {
|
|
61
|
+
var title = _ref2.title,
|
|
62
|
+
subtitle = _ref2.subtitle,
|
|
63
|
+
id = _ref2.id;
|
|
64
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
65
|
+
className: "".concat(blockClass, "-accordion-title")
|
|
66
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
67
|
+
className: "".concat(blockClass, "-selected-item")
|
|
68
|
+
}, /*#__PURE__*/_react.default.createElement("p", {
|
|
69
|
+
className: "".concat(blockClass, "-selected-item-title")
|
|
70
|
+
}, title), /*#__PURE__*/_react.default.createElement("p", {
|
|
71
|
+
className: "".concat(blockClass, "-selected-item-subtitle")
|
|
72
|
+
}, subtitle)), /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, {
|
|
73
|
+
renderIcon: _iconsReact.SubtractAlt32,
|
|
74
|
+
iconDescription: removeIconDescription,
|
|
75
|
+
hasIconOnly: true,
|
|
76
|
+
onClick: function onClick() {
|
|
77
|
+
return handleItemRemove(id);
|
|
78
|
+
},
|
|
79
|
+
kind: "ghost",
|
|
80
|
+
className: "".concat(blockClass, "-item-remove-button")
|
|
81
|
+
}));
|
|
82
|
+
};
|
|
83
|
+
|
|
47
84
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
48
85
|
className: blockClass
|
|
49
86
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -57,7 +94,7 @@ var AddSelectSidebar = function AddSelectSidebar(_ref) {
|
|
|
57
94
|
align: "start"
|
|
58
95
|
}, sidebarItems.map(function (item) {
|
|
59
96
|
return /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.AccordionItem, {
|
|
60
|
-
title: item
|
|
97
|
+
title: getTitle(item),
|
|
61
98
|
key: item.id
|
|
62
99
|
}, Object.keys(item).map(function (key) {
|
|
63
100
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -84,6 +121,8 @@ AddSelectSidebar.propTypes = {
|
|
|
84
121
|
items: _propTypes.default.array,
|
|
85
122
|
multiSelection: _propTypes.default.array,
|
|
86
123
|
noSelectionDescription: _propTypes.default.string,
|
|
87
|
-
noSelectionTitle: _propTypes.default.string
|
|
124
|
+
noSelectionTitle: _propTypes.default.string,
|
|
125
|
+
removeIconDescription: _propTypes.default.string,
|
|
126
|
+
setMultiSelection: _propTypes.default.func
|
|
88
127
|
};
|
|
89
128
|
AddSelectSidebar.displayName = componentName;
|
|
@@ -25,7 +25,11 @@ var _excluded = ["children", "className", "iconDescription", "label", "menuOptio
|
|
|
25
25
|
// The block part of our conventional BEM class names (blockClass__E--M).
|
|
26
26
|
var blockClass = "".concat(_settings.pkg.prefix, "--button-menu");
|
|
27
27
|
var componentName = 'ButtonMenu'; // NOTE: the component SCSS is not imported here: it is rolled up separately.
|
|
28
|
+
// Default values for props
|
|
28
29
|
|
|
30
|
+
var defaults = {
|
|
31
|
+
size: 'default'
|
|
32
|
+
};
|
|
29
33
|
/**
|
|
30
34
|
* Combining a standard button with an overflow menu, this component appears
|
|
31
35
|
* as a button and has all the usual carbon Button props and rendering, but
|
|
@@ -41,7 +45,8 @@ var ButtonMenu = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
41
45
|
label = _ref.label,
|
|
42
46
|
menuOptionsClass = _ref.menuOptionsClass,
|
|
43
47
|
Icon = _ref.renderIcon,
|
|
44
|
-
size = _ref.size,
|
|
48
|
+
_ref$size = _ref.size,
|
|
49
|
+
size = _ref$size === void 0 ? defaults.size : _ref$size,
|
|
45
50
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
46
51
|
return /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.OverflowMenu, (0, _extends2.default)({}, rest, {
|
|
47
52
|
className: (0, _classnames.default)(blockClass, // Apply the block class to the main HTML element
|
|
@@ -109,7 +114,4 @@ ButtonMenu.propTypes = {
|
|
|
109
114
|
* value for the carbon Button component 'size' prop.
|
|
110
115
|
*/
|
|
111
116
|
size: _carbonComponentsReact.Button.propTypes.size
|
|
112
|
-
};
|
|
113
|
-
ButtonMenu.defaultProps = {
|
|
114
|
-
size: _carbonComponentsReact.Button.defaultProps.size
|
|
115
117
|
};
|
|
@@ -40,5 +40,4 @@ var ButtonMenuItem = /*#__PURE__*/_react.default.forwardRef(function (props, ref
|
|
|
40
40
|
|
|
41
41
|
exports.ButtonMenuItem = ButtonMenuItem;
|
|
42
42
|
exports.ButtonMenuItem = ButtonMenuItem = _settings.pkg.checkComponentEnabled(ButtonMenuItem, componentName);
|
|
43
|
-
ButtonMenuItem.propTypes = _carbonComponentsReact.OverflowMenuItem.propTypes;
|
|
44
|
-
ButtonMenuItem.defaultProps = _carbonComponentsReact.OverflowMenuItem.defaultProps;
|
|
43
|
+
ButtonMenuItem.propTypes = _carbonComponentsReact.OverflowMenuItem.propTypes;
|
|
@@ -41,34 +41,55 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
41
41
|
|
|
42
42
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
43
43
|
|
|
44
|
-
var componentName = 'Card';
|
|
44
|
+
var componentName = 'Card'; // Default values for props
|
|
45
|
+
|
|
46
|
+
var defaults = {
|
|
47
|
+
actionIcons: Object.freeze([]),
|
|
48
|
+
actionsPlacement: 'bottom',
|
|
49
|
+
clickZone: 'one',
|
|
50
|
+
mediaPosition: 'top',
|
|
51
|
+
overflowActions: Object.freeze([]),
|
|
52
|
+
primaryButtonKind: 'primary',
|
|
53
|
+
productive: false,
|
|
54
|
+
secondaryButtonKind: 'secondary',
|
|
55
|
+
titleSize: 'default'
|
|
56
|
+
};
|
|
45
57
|
var Card = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
46
|
-
var actionIcons = _ref.actionIcons,
|
|
47
|
-
|
|
58
|
+
var _ref$actionIcons = _ref.actionIcons,
|
|
59
|
+
actionIcons = _ref$actionIcons === void 0 ? defaults.actionIcons : _ref$actionIcons,
|
|
60
|
+
_ref$actionsPlacement = _ref.actionsPlacement,
|
|
61
|
+
actionsPlacement = _ref$actionsPlacement === void 0 ? defaults.actionsPlacement : _ref$actionsPlacement,
|
|
48
62
|
children = _ref.children,
|
|
49
63
|
className = _ref.className,
|
|
50
|
-
clickZone = _ref.clickZone,
|
|
64
|
+
_ref$clickZone = _ref.clickZone,
|
|
65
|
+
clickZone = _ref$clickZone === void 0 ? defaults.clickZone : _ref$clickZone,
|
|
51
66
|
description = _ref.description,
|
|
52
67
|
label = _ref.label,
|
|
53
68
|
media = _ref.media,
|
|
54
|
-
mediaPosition = _ref.mediaPosition,
|
|
69
|
+
_ref$mediaPosition = _ref.mediaPosition,
|
|
70
|
+
mediaPosition = _ref$mediaPosition === void 0 ? defaults.mediaPosition : _ref$mediaPosition,
|
|
55
71
|
onClick = _ref.onClick,
|
|
56
72
|
onKeyDown = _ref.onKeyDown,
|
|
57
73
|
onPrimaryButtonClick = _ref.onPrimaryButtonClick,
|
|
58
|
-
overflowActions = _ref.overflowActions,
|
|
74
|
+
_ref$overflowActions = _ref.overflowActions,
|
|
75
|
+
overflowActions = _ref$overflowActions === void 0 ? defaults.overflowActions : _ref$overflowActions,
|
|
59
76
|
onSecondaryButtonClick = _ref.onSecondaryButtonClick,
|
|
60
77
|
Pictogram = _ref.pictogram,
|
|
61
78
|
primaryButtonHref = _ref.primaryButtonHref,
|
|
62
79
|
primaryButtonIcon = _ref.primaryButtonIcon,
|
|
63
|
-
|
|
80
|
+
_ref$primaryButtonKin = _ref.primaryButtonKind,
|
|
81
|
+
primaryButtonKind = _ref$primaryButtonKin === void 0 ? defaults.primaryButtonKind : _ref$primaryButtonKin,
|
|
64
82
|
primaryButtonText = _ref.primaryButtonText,
|
|
65
|
-
productive = _ref.productive,
|
|
83
|
+
_ref$productive = _ref.productive,
|
|
84
|
+
productive = _ref$productive === void 0 ? defaults.productive : _ref$productive,
|
|
66
85
|
secondaryButtonHref = _ref.secondaryButtonHref,
|
|
67
86
|
secondaryButtonIcon = _ref.secondaryButtonIcon,
|
|
68
|
-
|
|
87
|
+
_ref$secondaryButtonK = _ref.secondaryButtonKind,
|
|
88
|
+
secondaryButtonKind = _ref$secondaryButtonK === void 0 ? defaults.secondaryButtonKind : _ref$secondaryButtonK,
|
|
69
89
|
secondaryButtonText = _ref.secondaryButtonText,
|
|
70
90
|
title = _ref.title,
|
|
71
|
-
titleSize = _ref.titleSize,
|
|
91
|
+
_ref$titleSize = _ref.titleSize,
|
|
92
|
+
titleSize = _ref$titleSize === void 0 ? defaults.titleSize : _ref$titleSize,
|
|
72
93
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
73
94
|
var blockClass = "".concat(_settings.pkg.prefix, "--card");
|
|
74
95
|
var hasActions = actionIcons.length > 0 || overflowActions.length > 0;
|
|
@@ -262,15 +283,4 @@ Card.propTypes = {
|
|
|
262
283
|
title: _propTypes.default.string,
|
|
263
284
|
titleSize: _propTypes.default.oneOf(['default', 'large'])
|
|
264
285
|
};
|
|
265
|
-
Card.defaultProps = {
|
|
266
|
-
actionIcons: [],
|
|
267
|
-
actionsPlacement: 'bottom',
|
|
268
|
-
clickZone: 'one',
|
|
269
|
-
mediaPosition: 'top',
|
|
270
|
-
overflowActions: [],
|
|
271
|
-
primaryButtonKind: 'primary',
|
|
272
|
-
productive: false,
|
|
273
|
-
secondaryButtonKind: 'secondary',
|
|
274
|
-
titleSize: 'default'
|
|
275
|
-
};
|
|
276
286
|
Card.displayName = componentName;
|
|
@@ -26,21 +26,31 @@ var _settings = require("../../settings");
|
|
|
26
26
|
// LICENSE file in the root directory of this source tree.
|
|
27
27
|
//
|
|
28
28
|
var componentName = 'CardFooter';
|
|
29
|
+
var defaults = {
|
|
30
|
+
actions: Object.freeze([]),
|
|
31
|
+
primaryButtonKind: 'primary',
|
|
32
|
+
productive: false,
|
|
33
|
+
secondaryButtonKind: 'secondary'
|
|
34
|
+
};
|
|
29
35
|
|
|
30
36
|
var CardFooter = function CardFooter(_ref) {
|
|
31
|
-
var actions = _ref.actions,
|
|
37
|
+
var _ref$actions = _ref.actions,
|
|
38
|
+
actions = _ref$actions === void 0 ? defaults.actions : _ref$actions,
|
|
32
39
|
hasActions = _ref.hasActions,
|
|
33
40
|
hasButton = _ref.hasButton,
|
|
34
41
|
onPrimaryButtonClick = _ref.onPrimaryButtonClick,
|
|
35
42
|
onSecondaryButtonClick = _ref.onSecondaryButtonClick,
|
|
36
43
|
primaryButtonHref = _ref.primaryButtonHref,
|
|
37
44
|
primaryButtonIcon = _ref.primaryButtonIcon,
|
|
38
|
-
|
|
45
|
+
_ref$primaryButtonKin = _ref.primaryButtonKind,
|
|
46
|
+
primaryButtonKind = _ref$primaryButtonKin === void 0 ? defaults.primaryButtonKind : _ref$primaryButtonKin,
|
|
39
47
|
primaryButtonText = _ref.primaryButtonText,
|
|
40
|
-
productive = _ref.productive,
|
|
48
|
+
_ref$productive = _ref.productive,
|
|
49
|
+
productive = _ref$productive === void 0 ? defaults.productive : _ref$productive,
|
|
41
50
|
secondaryButtonHref = _ref.secondaryButtonHref,
|
|
42
51
|
secondaryButtonIcon = _ref.secondaryButtonIcon,
|
|
43
|
-
|
|
52
|
+
_ref$secondaryButtonK = _ref.secondaryButtonKind,
|
|
53
|
+
secondaryButtonKind = _ref$secondaryButtonK === void 0 ? defaults.secondaryButtonKind : _ref$secondaryButtonK,
|
|
44
54
|
secondaryButtonText = _ref.secondaryButtonText;
|
|
45
55
|
var blockClass = "".concat(_settings.pkg.prefix, "--card");
|
|
46
56
|
var footerClass = "".concat(_settings.pkg.prefix, "--card__footer");
|
|
@@ -81,10 +91,4 @@ CardFooter.propTypes = {
|
|
|
81
91
|
secondaryButtonKind: _propTypes.default.oneOf(['secondary', 'ghost']),
|
|
82
92
|
secondaryButtonText: _propTypes.default.string
|
|
83
93
|
};
|
|
84
|
-
CardFooter.defaultProps = {
|
|
85
|
-
actions: [],
|
|
86
|
-
primaryButtonKind: 'primary',
|
|
87
|
-
productive: false,
|
|
88
|
-
secondaryButtonKind: 'secondary'
|
|
89
|
-
};
|
|
90
94
|
CardFooter.displayName = componentName;
|