@carbon/ibm-products 2.4.0 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. package/css/index-full-carbon.css +27 -4
  2. package/css/index-full-carbon.css.map +1 -1
  3. package/css/index-full-carbon.min.css +2 -2
  4. package/css/index-full-carbon.min.css.map +1 -1
  5. package/css/index-without-carbon-released-only.css +16 -0
  6. package/css/index-without-carbon-released-only.css.map +1 -1
  7. package/css/index-without-carbon-released-only.min.css +1 -1
  8. package/css/index-without-carbon-released-only.min.css.map +1 -1
  9. package/css/index-without-carbon.css +27 -4
  10. package/css/index-without-carbon.css.map +1 -1
  11. package/css/index-without-carbon.min.css +2 -2
  12. package/css/index-without-carbon.min.css.map +1 -1
  13. package/css/index.css +23 -4
  14. package/css/index.css.map +1 -1
  15. package/css/index.min.css +2 -2
  16. package/css/index.min.css.map +1 -1
  17. package/es/components/AddSelect/AddSelectRow.js +1 -1
  18. package/es/components/AddSelect/AddSelectSidebar.js +1 -1
  19. package/es/components/AddSelect/add-select-utils.js +2 -2
  20. package/es/components/Card/Card.js +11 -1
  21. package/es/components/Card/CardFooter.js +4 -2
  22. package/es/components/Card/CardHeader.js +20 -2
  23. package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +2 -2
  24. package/es/components/DataSpreadsheet/DataSpreadsheetHeader.js +1 -1
  25. package/es/components/DataSpreadsheet/hooks/useSpreadsheetEdit.js +1 -1
  26. package/es/components/DataSpreadsheet/utils/checkSelectedHeaderCell.js +4 -4
  27. package/es/components/DataSpreadsheet/utils/handleCellDeletion.js +4 -4
  28. package/es/components/DataSpreadsheet/utils/handleHeaderCellSelection.js +2 -2
  29. package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +1 -1
  30. package/es/components/Datagrid/Datagrid/DatagridRow.js +3 -3
  31. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/DraggableItemsList.js +7 -7
  32. package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +6 -6
  33. package/es/components/Datagrid/useActionsColumn.js +13 -7
  34. package/es/components/Datagrid/useDisableSelectRows.js +4 -4
  35. package/es/components/Datagrid/useInlineEdit.js +2 -2
  36. package/es/components/Datagrid/useOnRowClick.js +20 -4
  37. package/es/components/Datagrid/useSortableColumns.js +35 -3
  38. package/es/components/Datagrid/useStickyColumn.js +1 -1
  39. package/es/components/EditUpdateCards/EditUpdateCards.js +66 -4
  40. package/es/components/ExportModal/ExportModal.js +1 -1
  41. package/es/components/NotificationsPanel/NotificationsPanel.js +6 -3
  42. package/es/components/ProductiveCard/ProductiveCard.js +21 -1
  43. package/es/components/SidePanel/SidePanel.js +3 -3
  44. package/es/components/TagSet/TagSetModal.js +3 -3
  45. package/es/global/js/utils/StoryDocsPage.js +2 -2
  46. package/es/global/js/utils/Wrap.js +1 -1
  47. package/es/global/js/utils/props-helper.js +1 -1
  48. package/es/global/js/utils/story-helper.js +3 -3
  49. package/lib/components/AddSelect/AddSelectRow.js +1 -1
  50. package/lib/components/AddSelect/AddSelectSidebar.js +1 -1
  51. package/lib/components/AddSelect/add-select-utils.js +2 -2
  52. package/lib/components/Card/Card.js +11 -1
  53. package/lib/components/Card/CardFooter.js +4 -2
  54. package/lib/components/Card/CardHeader.js +20 -2
  55. package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +2 -2
  56. package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.js +1 -1
  57. package/lib/components/DataSpreadsheet/hooks/useSpreadsheetEdit.js +1 -1
  58. package/lib/components/DataSpreadsheet/utils/checkSelectedHeaderCell.js +4 -4
  59. package/lib/components/DataSpreadsheet/utils/handleCellDeletion.js +4 -4
  60. package/lib/components/DataSpreadsheet/utils/handleHeaderCellSelection.js +2 -2
  61. package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +1 -1
  62. package/lib/components/Datagrid/Datagrid/DatagridRow.js +3 -3
  63. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/DraggableItemsList.js +7 -7
  64. package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +6 -6
  65. package/lib/components/Datagrid/useActionsColumn.js +13 -7
  66. package/lib/components/Datagrid/useDisableSelectRows.js +4 -4
  67. package/lib/components/Datagrid/useInlineEdit.js +2 -2
  68. package/lib/components/Datagrid/useOnRowClick.js +20 -4
  69. package/lib/components/Datagrid/useSortableColumns.js +35 -3
  70. package/lib/components/Datagrid/useStickyColumn.js +1 -1
  71. package/lib/components/EditUpdateCards/EditUpdateCards.js +66 -4
  72. package/lib/components/ExportModal/ExportModal.js +1 -1
  73. package/lib/components/NotificationsPanel/NotificationsPanel.js +6 -3
  74. package/lib/components/ProductiveCard/ProductiveCard.js +21 -1
  75. package/lib/components/SidePanel/SidePanel.js +3 -3
  76. package/lib/components/TagSet/TagSetModal.js +3 -3
  77. package/lib/global/js/utils/StoryDocsPage.js +2 -2
  78. package/lib/global/js/utils/Wrap.js +1 -1
  79. package/lib/global/js/utils/props-helper.js +1 -1
  80. package/lib/global/js/utils/story-helper.js +3 -3
  81. package/package.json +11 -11
  82. package/scss/components/Datagrid/_storybook-styles.scss +5 -0
  83. package/scss/components/Datagrid/styles/_datagrid.scss +0 -8
  84. package/scss/components/EditUpdateCards/_edit-update-cards.scss +10 -0
  85. package/scss/components/ProductiveCard/_productive-card.scss +15 -0
  86. package/scss/components/Tearsheet/_tearsheet.scss +6 -0
@@ -26,7 +26,7 @@ var useDisableSelectRows = function useDisableSelectRows(hooks) {
26
26
  };
27
27
  var updateSelectAll = function updateSelectAll(hooks) {
28
28
  var getToggleAllRowsSelectedProps = function getToggleAllRowsSelectedProps(props, _ref2) {
29
- var _instance$disableSele, _instance$disableSele2;
29
+ var _instance$disableSele;
30
30
  var instance = _ref2.instance;
31
31
  var selectableRows = instance.rows.filter(function (row) {
32
32
  return !(instance.shouldDisableSelectRow && instance.shouldDisableSelectRow(row));
@@ -46,7 +46,7 @@ var updateSelectAll = function updateSelectAll(hooks) {
46
46
  },
47
47
  checked: isAllRowsSelected,
48
48
  disabled: instance.disableSelectAll,
49
- title: (instance === null || instance === void 0 ? void 0 : (_instance$disableSele = instance.disableSelectRowsProps) === null || _instance$disableSele === void 0 ? void 0 : (_instance$disableSele2 = _instance$disableSele.labels) === null || _instance$disableSele2 === void 0 ? void 0 : _instance$disableSele2.toggleAllRowsLabel) || 'Toggle All Rows Selected',
49
+ title: (instance === null || instance === void 0 || (_instance$disableSele = instance.disableSelectRowsProps) === null || _instance$disableSele === void 0 || (_instance$disableSele = _instance$disableSele.labels) === null || _instance$disableSele === void 0 ? void 0 : _instance$disableSele.toggleAllRowsLabel) || 'Toggle All Rows Selected',
50
50
  indeterminate: Boolean(!isAllRowsSelected && Object.keys(instance.state.selectedRowIds).length)
51
51
  }];
52
52
  };
@@ -54,7 +54,7 @@ var updateSelectAll = function updateSelectAll(hooks) {
54
54
  };
55
55
  var updatePageSelectAll = function updatePageSelectAll(hooks) {
56
56
  var getToggleAllPageRowsSelectedProps = function getToggleAllPageRowsSelectedProps(props, _ref4) {
57
- var _instance$disableSele3, _instance$disableSele4;
57
+ var _instance$disableSele2;
58
58
  var instance = _ref4.instance;
59
59
  var selectableRows = instance.page.filter(function (row) {
60
60
  return !(instance.shouldDisableSelectRow && instance.shouldDisableSelectRow(row));
@@ -74,7 +74,7 @@ var updatePageSelectAll = function updatePageSelectAll(hooks) {
74
74
  },
75
75
  checked: isAllRowsSelected,
76
76
  disabled: instance.disableSelectAll,
77
- title: (instance === null || instance === void 0 ? void 0 : (_instance$disableSele3 = instance.disableSelectRowsProps) === null || _instance$disableSele3 === void 0 ? void 0 : (_instance$disableSele4 = _instance$disableSele3.labels) === null || _instance$disableSele4 === void 0 ? void 0 : _instance$disableSele4.toggleAllRowsLabel) || 'Toggle All Rows Selected',
77
+ title: (instance === null || instance === void 0 || (_instance$disableSele2 = instance.disableSelectRowsProps) === null || _instance$disableSele2 === void 0 || (_instance$disableSele2 = _instance$disableSele2.labels) === null || _instance$disableSele2 === void 0 ? void 0 : _instance$disableSele2.toggleAllRowsLabel) || 'Toggle All Rows Selected',
78
78
  indeterminate: Boolean(!isAllRowsSelected && instance.page.some(function (_ref6) {
79
79
  var id = _ref6.id;
80
80
  return instance.state.selectedRowIds[id];
@@ -31,11 +31,11 @@ var useInlineEdit = function useInlineEdit(hooks, usingEditableCell) {
31
31
  }
32
32
  }, [usingEditableCell]);
33
33
  var addInlineEdit = function addInlineEdit(props, _ref) {
34
- var _cell$column, _cell$column$inlineEd, _instance$columns$fil;
34
+ var _cell$column, _instance$columns$fil;
35
35
  var cell = _ref.cell,
36
36
  instance = _ref.instance;
37
37
  var columnInlineEditConfig = cell.column.inlineEdit;
38
- var inlineEditType = (_cell$column = cell.column) === null || _cell$column === void 0 ? void 0 : (_cell$column$inlineEd = _cell$column.inlineEdit) === null || _cell$column$inlineEd === void 0 ? void 0 : _cell$column$inlineEd.type;
38
+ var inlineEditType = (_cell$column = cell.column) === null || _cell$column === void 0 || (_cell$column = _cell$column.inlineEdit) === null || _cell$column === void 0 ? void 0 : _cell$column.type;
39
39
  var totalInlineEditColumns = (_instance$columns$fil = instance.columns.filter(function (item) {
40
40
  return item.inlineEdit;
41
41
  })) === null || _instance$columns$fil === void 0 ? void 0 : _instance$columns$fil.length;
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
+ var _settings = require("../../settings");
7
8
  /*
8
9
  * Licensed Materials - Property of IBM
9
10
  * 5724-Q36
@@ -21,13 +22,28 @@ var useOnRowClick = function useOnRowClick(hooks) {
21
22
  instance = datagridState.instance;
22
23
  var id = row.id,
23
24
  toggleRowSelected = row.toggleRowSelected;
25
+ var withSelectRows = instance.withSelectRows,
26
+ tableId = instance.tableId;
24
27
  var onClick = function onClick(event) {
25
28
  if (!isFetching && onRowClick) {
26
29
  onRowClick(row, event);
27
- instance.selectedFlatRows && instance.selectedFlatRows.map(function (toggleRow) {
28
- return toggleRow.toggleRowSelected(false);
29
- });
30
- toggleRowSelected(id, true);
30
+ // We do not want to change the list of selected rows if using the useSelectedRows hook, otherwise clicking on an entire row will mark the row as checked
31
+
32
+ // Remove selected class from all other clickable rows as only one clickable row can be selected at a time
33
+ var clickableSelectedRows = document.querySelectorAll("#".concat(tableId, ".").concat(_settings.pkg.prefix, "--datagrid .").concat(_settings.carbon.prefix, "--data-table--selected:not(.").concat(_settings.pkg.prefix, "--datagrid__active-row)"));
34
+ if (clickableSelectedRows.length) {
35
+ Array.from(clickableSelectedRows).forEach(function (row) {
36
+ row.classList.remove("".concat(_settings.carbon.prefix, "--data-table--selected"));
37
+ });
38
+ }
39
+ var closestRow = event.target.closest(".".concat(_settings.pkg.prefix, "--datagrid__carbon-row"));
40
+ closestRow.classList.add("".concat(_settings.carbon.prefix, "--data-table--selected"));
41
+ if (!withSelectRows) {
42
+ instance.selectedFlatRows && instance.selectedFlatRows.map(function (toggleRow) {
43
+ return toggleRow.toggleRowSelected(false);
44
+ });
45
+ toggleRowSelected(id, true);
46
+ }
31
47
  }
32
48
  };
33
49
  var onKeyDown = function onKeyDown(event) {
@@ -26,11 +26,37 @@ var ordering = {
26
26
  DESC: 'DESC',
27
27
  NONE: 'NONE'
28
28
  };
29
+ var getAriaSortValue = function getAriaSortValue(col, _ref) {
30
+ var ascendingSortableLabelText = _ref.ascendingSortableLabelText,
31
+ descendingSortableLabelText = _ref.descendingSortableLabelText,
32
+ defaultSortableLabelText = _ref.defaultSortableLabelText;
33
+ var isSorted = col.isSorted,
34
+ isSortedDesc = col.isSortedDesc;
35
+ if (!isSorted) {
36
+ return defaultSortableLabelText || 'none';
37
+ }
38
+ if (isSorted && !isSortedDesc) {
39
+ return ascendingSortableLabelText || 'ascending';
40
+ }
41
+ if (isSorted && isSortedDesc) {
42
+ return descendingSortableLabelText || 'descending';
43
+ }
44
+ };
45
+ var getAriaPressedValue = function getAriaPressedValue(col) {
46
+ var isSorted = col.isSorted;
47
+ if (isSorted) {
48
+ return 'true';
49
+ }
50
+ return 'false';
51
+ };
29
52
  var useSortableColumns = function useSortableColumns(hooks) {
30
- var sortableVisibleColumns = function sortableVisibleColumns(visibleColumns, _ref) {
53
+ var sortableVisibleColumns = function sortableVisibleColumns(visibleColumns, _ref2) {
31
54
  var _instance$customizeCo;
32
- var instance = _ref.instance;
33
- var onSort = instance.onSort;
55
+ var instance = _ref2.instance;
56
+ var onSort = instance.onSort,
57
+ ascendingSortableLabelText = instance.ascendingSortableLabelText,
58
+ descendingSortableLabelText = instance.descendingSortableLabelText,
59
+ defaultSortableLabelText = instance.defaultSortableLabelText;
34
60
  var onSortClick = function onSortClick(column) {
35
61
  var key = column.id;
36
62
  var sortDesc = column.isSortedDesc;
@@ -75,6 +101,12 @@ var useSortableColumns = function useSortableColumns(hooks) {
75
101
  var Header = function Header(headerProp) {
76
102
  var _cx;
77
103
  return column.disableSortBy === true ? column.Header : /*#__PURE__*/_react.default.createElement(_react2.Button, {
104
+ "aria-sort": getAriaSortValue(headerProp === null || headerProp === void 0 ? void 0 : headerProp.column, {
105
+ ascendingSortableLabelText: ascendingSortableLabelText,
106
+ descendingSortableLabelText: descendingSortableLabelText,
107
+ defaultSortableLabelText: defaultSortableLabelText
108
+ }),
109
+ "aria-pressed": getAriaPressedValue(headerProp === null || headerProp === void 0 ? void 0 : headerProp.column),
78
110
  onClick: function onClick() {
79
111
  return onSortClick(headerProp === null || headerProp === void 0 ? void 0 : headerProp.column);
80
112
  },
@@ -154,7 +154,7 @@ var changeProps = function changeProps(elementName, headerCellRef, windowSize, p
154
154
  if (column.sticky === 'left') {
155
155
  var _data$instance, _cx2;
156
156
  return [props, _objectSpread({
157
- className: (0, _classnames.default)((_cx2 = {}, (0, _defineProperty2.default)(_cx2, "".concat(leftStickyStyleClassPrefix, "-").concat(elementName), true && windowSize > 671), (0, _defineProperty2.default)(_cx2, "".concat(leftStickyStyleClassPrefix, "-").concat(elementName, "--with-extra-select-column"), (data === null || data === void 0 ? void 0 : (_data$instance = data.instance) === null || _data$instance === void 0 ? void 0 : _data$instance.withSelectRows) && windowSize > 671), _cx2))
157
+ className: (0, _classnames.default)((_cx2 = {}, (0, _defineProperty2.default)(_cx2, "".concat(leftStickyStyleClassPrefix, "-").concat(elementName), true && windowSize > 671), (0, _defineProperty2.default)(_cx2, "".concat(leftStickyStyleClassPrefix, "-").concat(elementName, "--with-extra-select-column"), (data === null || data === void 0 || (_data$instance = data.instance) === null || _data$instance === void 0 ? void 0 : _data$instance.withSelectRows) && windowSize > 671), _cx2))
158
158
  }, headerCellRef && {
159
159
  ref: headerCellRef
160
160
  })];
@@ -14,7 +14,7 @@ var _classnames = _interopRequireDefault(require("classnames"));
14
14
  var _devtools = require("../../global/js/utils/devtools");
15
15
  var _settings = require("../../settings");
16
16
  var _ProductiveCard = require("../ProductiveCard");
17
- var _excluded = ["actionIcons", "actionsPlacement", "className", "description", "editChildren", "editMode", "label", "previewChildren", "title", "titleSize"];
17
+ var _excluded = ["actionIcons", "actionsPlacement", "className", "description", "editChildren", "editMode", "label", "onPrimaryButtonClick", "onSecondaryButtonClick", "previewChildren", "title", "titleSize", "primaryButtonIcon", "primaryButtonText", "secondaryButtonIcon", "secondaryButtonText"];
18
18
  /**
19
19
  * Copyright IBM Corp. 2022, 2022
20
20
  *
@@ -59,12 +59,30 @@ var EditUpdateCards = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref
59
59
  editChildren = _ref.editChildren,
60
60
  editMode = _ref.editMode,
61
61
  label = _ref.label,
62
+ onPrimaryButtonClick = _ref.onPrimaryButtonClick,
63
+ onSecondaryButtonClick = _ref.onSecondaryButtonClick,
62
64
  previewChildren = _ref.previewChildren,
63
65
  title = _ref.title,
64
66
  titleSize = _ref.titleSize,
67
+ primaryButtonIcon = _ref.primaryButtonIcon,
68
+ primaryButtonText = _ref.primaryButtonText,
69
+ secondaryButtonIcon = _ref.secondaryButtonIcon,
70
+ secondaryButtonText = _ref.secondaryButtonText,
65
71
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
66
- // const [editMode, setEditMode] = useState(false);
72
+ // const [editCardMode, setEditCardMode] = useState(editMode);
67
73
 
74
+ var conditionalProps = {
75
+ onPrimaryButtonClick: onPrimaryButtonClick,
76
+ onSecondaryButtonClick: onSecondaryButtonClick,
77
+ primaryButtonIcon: primaryButtonIcon,
78
+ primaryButtonKind: 'ghost',
79
+ primaryButtonPlacement: 'top',
80
+ primaryButtonText: primaryButtonText,
81
+ secondaryButtonIcon: secondaryButtonIcon,
82
+ secondaryButtonKind: 'ghost',
83
+ secondaryButtonPlacement: 'top',
84
+ secondaryButtonText: secondaryButtonText
85
+ };
68
86
  return /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, rest, {
69
87
  className: (0, _classnames.default)(blockClass,
70
88
  // Apply the block class to the main HTML element
@@ -73,7 +91,7 @@ var EditUpdateCards = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref
73
91
  (0, _defineProperty2.default)({}, "".concat(blockClass, "__actions-bottom"), actionsPlacement === 'bottom')),
74
92
  ref: ref,
75
93
  role: "main"
76
- }, (0, _devtools.getDevtoolsProps)(componentName)), /*#__PURE__*/_react.default.createElement(_ProductiveCard.ProductiveCard, {
94
+ }, (0, _devtools.getDevtoolsProps)(componentName)), /*#__PURE__*/_react.default.createElement(_ProductiveCard.ProductiveCard, (0, _extends2.default)({
77
95
  actionIcons: actionIcons,
78
96
  actionsPlacement: actionsPlacement,
79
97
  className: className,
@@ -81,7 +99,7 @@ var EditUpdateCards = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref
81
99
  label: label,
82
100
  title: title,
83
101
  titleSize: titleSize
84
- }, editMode === false && /*#__PURE__*/_react.default.createElement("div", null, previewChildren), editMode && /*#__PURE__*/_react.default.createElement("div", null, editChildren)));
102
+ }, editMode && conditionalProps), editMode === false && /*#__PURE__*/_react.default.createElement("div", null, previewChildren), editMode && /*#__PURE__*/_react.default.createElement("div", null, editChildren)));
85
103
  });
86
104
 
87
105
  // Return a placeholder if not released and not enabled by feature flag
@@ -131,10 +149,54 @@ EditUpdateCards.propTypes = {
131
149
  * Optional label for the top of the card
132
150
  */
133
151
  label: _propTypes.default.string,
152
+ /**
153
+ * Function that's called from the primary button or action icon
154
+ */
155
+ onPrimaryButtonClick: _propTypes.default.func,
156
+ /**
157
+ * Function that's called from the secondary button or action icon
158
+ */
159
+ onSecondaryButtonClick: _propTypes.default.func,
134
160
  /**
135
161
  * Preview mode children
136
162
  */
137
163
  previewChildren: _propTypes.default.node,
164
+ /**
165
+ * Optional prop to allow overriding the icon rendering. Can be a React component class
166
+ */
167
+ primaryButtonIcon: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
168
+ /**
169
+ * Establishes the kind of button displayed for the primary button
170
+ */
171
+ primaryButtonKind: _propTypes.default.oneOf(['primary', 'ghost']),
172
+ /**
173
+ * Determines if the primary button is on the top or bottom of the card
174
+ */
175
+ primaryButtonPlacement: _propTypes.default.oneOf(['top', 'bottom']),
176
+ /**
177
+ * The text that's displayed in the primary button
178
+ */
179
+ primaryButtonText: _propTypes.default.string,
180
+ /**
181
+ * Optionally specify an href for your Button to become an <a> element
182
+ */
183
+ secondaryButtonHref: _propTypes.default.string,
184
+ /**
185
+ * Optional prop to allow overriding the icon rendering. Can be a React component class
186
+ */
187
+ secondaryButtonIcon: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
188
+ /**
189
+ * Establishes the kind of button displayed for the secondary button
190
+ */
191
+ secondaryButtonKind: _propTypes.default.oneOf(['secondary', 'ghost']),
192
+ /**
193
+ * Determines if the secondary button is on the top or bottom of the card
194
+ */
195
+ secondaryButtonPlacement: _propTypes.default.oneOf(['top', 'bottom']),
196
+ /**
197
+ * The text that's displayed in the secondary button
198
+ */
199
+ secondaryButtonText: _propTypes.default.string,
138
200
  /**
139
201
  * Title that's displayed at the top of the card
140
202
  */
@@ -84,7 +84,7 @@ var ExportModal = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
84
84
  (0, _react.useEffect)(function () {
85
85
  var _preformattedExtensio;
86
86
  setName(filename);
87
- setExtension(preformattedExtensions === null || preformattedExtensions === void 0 ? void 0 : (_preformattedExtensio = preformattedExtensions[0]) === null || _preformattedExtensio === void 0 ? void 0 : _preformattedExtensio.extension);
87
+ setExtension(preformattedExtensions === null || preformattedExtensions === void 0 || (_preformattedExtensio = preformattedExtensions[0]) === null || _preformattedExtensio === void 0 ? void 0 : _preformattedExtensio.extension);
88
88
  }, [filename, preformattedExtensions, open]);
89
89
  var onNameChangeHandler = function onNameChangeHandler(evt) {
90
90
  setName(evt.target.value);
@@ -302,10 +302,10 @@ var NotificationsPanel = /*#__PURE__*/_react.default.forwardRef(function (_ref,
302
302
  nowText: nowText
303
303
  })), /*#__PURE__*/_react.default.createElement("h6", {
304
304
  className: notificationHeaderClassName
305
- }, notification.title), notification.description && notification.description.length && renderDescription(notification.id), notification.link && notification.link.text && notification.link.url && /*#__PURE__*/_react.default.createElement(_react2.Link, {
305
+ }, notification.title), notification.description && notification.description.length && renderDescription(notification.id), notification.link && notification.link.text && notification.link.url && /*#__PURE__*/_react.default.createElement(_react2.Link, (0, _extends2.default)({
306
306
  href: notification.link.url,
307
307
  className: "".concat(blockClass, "__notifications-link")
308
- }, notification.link.text)), /*#__PURE__*/_react.default.createElement(_react2.IconButton, {
308
+ }, notification.link.optional), notification.link.text)), /*#__PURE__*/_react.default.createElement(_react2.IconButton, {
309
309
  align: "left",
310
310
  kind: "ghost",
311
311
  size: "sm",
@@ -426,7 +426,10 @@ NotificationsPanel.propTypes = {
426
426
  description: _propTypes.default.string,
427
427
  link: _propTypes.default.shape({
428
428
  url: _propTypes.default.string,
429
- text: _propTypes.default.string
429
+ text: _propTypes.default.string,
430
+ optional: _propTypes.default.shape({
431
+ // Add optional props here
432
+ })
430
433
  }),
431
434
  unread: _propTypes.default.bool,
432
435
  onNotificationClick: _propTypes.default.func
@@ -35,7 +35,7 @@ var ProductiveCard = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
35
35
  var _ref$actionsPlacement = _ref.actionsPlacement,
36
36
  actionsPlacement = _ref$actionsPlacement === void 0 ? defaults.actionsPlacement : _ref$actionsPlacement,
37
37
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
38
- var validProps = (0, _propsHelper.prepareProps)(rest, ['media', 'mediaPosition', 'onSecondaryButtonClick', 'pictogram', 'primaryButtonClick', 'productive', 'secondaryButtonKind', 'secondaryButtonText']);
38
+ var validProps = (0, _propsHelper.prepareProps)(rest, ['media', 'mediaPosition', 'pictogram', 'primaryButtonClick', 'productive', 'secondaryButtonKind']);
39
39
  return /*#__PURE__*/_react.default.createElement(_Card.Card, (0, _extends2.default)({}, _objectSpread(_objectSpread({}, validProps), {}, {
40
40
  actionsPlacement: actionsPlacement,
41
41
  ref: ref
@@ -91,6 +91,10 @@ ProductiveCard.propTypes = {
91
91
  * Function that's called from the primary button or action icon
92
92
  */
93
93
  onPrimaryButtonClick: _propTypes.default.func,
94
+ /**
95
+ * Function that's called from the secondary button or action icon
96
+ */
97
+ onSecondaryButtonClick: _propTypes.default.func,
94
98
  /**
95
99
  * Use an overflow menu instead of action icons. Refer to design documentation for implementation guidelines
96
100
  */
@@ -120,6 +124,22 @@ ProductiveCard.propTypes = {
120
124
  * The text that's displayed in the primary button
121
125
  */
122
126
  primaryButtonText: _propTypes.default.node,
127
+ /**
128
+ * Optionally specify an href for your Button to become an <a> element
129
+ */
130
+ secondaryButtonHref: _propTypes.default.string,
131
+ /**
132
+ * Optional prop to allow overriding the icon rendering. Can be a React component class
133
+ */
134
+ secondaryButtonIcon: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
135
+ /**
136
+ * Determines if the secondary button is on the top or bottom of the card
137
+ */
138
+ secondaryButtonPlacement: _propTypes.default.oneOf(['top', 'bottom']),
139
+ /**
140
+ * The text that's displayed in the secondary button
141
+ */
142
+ secondaryButtonText: _propTypes.default.node,
123
143
  /**
124
144
  * Title that's displayed at the top of the card
125
145
  */
@@ -128,7 +128,7 @@ var SidePanel = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
128
128
  if ((previousState === null || previousState === void 0 ? void 0 : previousState.size) !== size) {
129
129
  var _sidePanelOuter$style;
130
130
  scrollableSection.scrollTop = 0;
131
- sidePanelOuter === null || sidePanelOuter === void 0 ? void 0 : (_sidePanelOuter$style = sidePanelOuter.style) === null || _sidePanelOuter$style === void 0 ? void 0 : _sidePanelOuter$style.setProperty("--".concat(blockClass, "--title-container-height"), "".concat(Number(initialTitleHeight), "px"));
131
+ sidePanelOuter === null || sidePanelOuter === void 0 || (_sidePanelOuter$style = sidePanelOuter.style) === null || _sidePanelOuter$style === void 0 ? void 0 : _sidePanelOuter$style.setProperty("--".concat(blockClass, "--title-container-height"), "".concat(Number(initialTitleHeight), "px"));
132
132
  }
133
133
  }
134
134
  }, [currentStep, ref, size, previousState === null || previousState === void 0 ? void 0 : previousState.size]);
@@ -159,7 +159,7 @@ var SidePanel = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
159
159
  var actionsContainer = getActionsContainerElement();
160
160
  var actionsHeight = (actionsContainer === null || actionsContainer === void 0 ? void 0 : actionsContainer.offsetHeight) + 16; // add additional 1rem spacing to bottom padding
161
161
  actionsHeight = "".concat(Math.round(actionsHeight / 16), "rem");
162
- sidePanelOuter === null || sidePanelOuter === void 0 ? void 0 : (_sidePanelOuter$style2 = sidePanelOuter.style) === null || _sidePanelOuter$style2 === void 0 ? void 0 : _sidePanelOuter$style2.setProperty("--".concat(blockClass, "--content-bottom-padding"), actionsHeight);
162
+ sidePanelOuter === null || sidePanelOuter === void 0 || (_sidePanelOuter$style2 = sidePanelOuter.style) === null || _sidePanelOuter$style2 === void 0 ? void 0 : _sidePanelOuter$style2.setProperty("--".concat(blockClass, "--content-bottom-padding"), actionsHeight);
163
163
  }
164
164
  }, [actions, condensedActions, open, animationComplete]);
165
165
 
@@ -180,7 +180,7 @@ var SidePanel = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
180
180
  var actionsContainer = getActionsContainerElement();
181
181
  var actionsHeight = (actionsContainer === null || actionsContainer === void 0 ? void 0 : actionsContainer.offsetHeight) + 16; // add additional 1rem spacing to bottom padding
182
182
  actionsHeight = "".concat(Math.round(actionsHeight / 16), "rem");
183
- sidePanelOuter === null || sidePanelOuter === void 0 ? void 0 : (_sidePanelOuter$style3 = sidePanelOuter.style) === null || _sidePanelOuter$style3 === void 0 ? void 0 : _sidePanelOuter$style3.setProperty("--".concat(blockClass, "--content-bottom-padding"), actionsHeight);
183
+ sidePanelOuter === null || sidePanelOuter === void 0 || (_sidePanelOuter$style3 = sidePanelOuter.style) === null || _sidePanelOuter$style3 === void 0 ? void 0 : _sidePanelOuter$style3.setProperty("--".concat(blockClass, "--content-bottom-padding"), actionsHeight);
184
184
  };
185
185
  var getActionsContainerElement = function getActionsContainerElement() {
186
186
  var sidePanelOuter = document.querySelector("#".concat(blockClass, "-outer"));
@@ -61,9 +61,9 @@ var TagSetModal = function TagSetModal(_ref) {
61
61
  } else {
62
62
  var lCaseSearch = search.toLocaleLowerCase();
63
63
  allTags.forEach(function (tag) {
64
- var _tag$dataSearch, _tag$dataSearch$toLoc, _tag$label, _tag$label$toLocaleLo;
65
- var dataSearch = (_tag$dataSearch = tag['data-search']) === null || _tag$dataSearch === void 0 ? void 0 : (_tag$dataSearch$toLoc = _tag$dataSearch.toLocaleLowerCase()) === null || _tag$dataSearch$toLoc === void 0 ? void 0 : _tag$dataSearch$toLoc.indexOf(lCaseSearch);
66
- var labelSearch = (_tag$label = tag.label) === null || _tag$label === void 0 ? void 0 : (_tag$label$toLocaleLo = _tag$label.toLocaleLowerCase()) === null || _tag$label$toLocaleLo === void 0 ? void 0 : _tag$label$toLocaleLo.indexOf(lCaseSearch);
64
+ var _tag$dataSearch, _tag$label;
65
+ var dataSearch = (_tag$dataSearch = tag['data-search']) === null || _tag$dataSearch === void 0 || (_tag$dataSearch = _tag$dataSearch.toLocaleLowerCase()) === null || _tag$dataSearch === void 0 ? void 0 : _tag$dataSearch.indexOf(lCaseSearch);
66
+ var labelSearch = (_tag$label = tag.label) === null || _tag$label === void 0 || (_tag$label = _tag$label.toLocaleLowerCase()) === null || _tag$label === void 0 ? void 0 : _tag$label.indexOf(lCaseSearch);
67
67
  if (dataSearch > -1 || labelSearch > -1) {
68
68
  newFilteredModalTags.push(tag);
69
69
  }
@@ -75,7 +75,7 @@ var processBlocks = function processBlocks(blocks, stories, omitUnreferencedStor
75
75
  * @returns
76
76
  */
77
77
  var StoryDocsPage = function StoryDocsPage(_ref2) {
78
- var _csfFile$meta, _csfFile$meta$paramet, _processedBlocks$filt;
78
+ var _csfFile$meta, _processedBlocks$filt;
79
79
  var altTitle = _ref2.altTitle,
80
80
  altDescription = _ref2.altDescription,
81
81
  altGuidelinesHref = _ref2.altGuidelinesHref,
@@ -86,7 +86,7 @@ var StoryDocsPage = function StoryDocsPage(_ref2) {
86
86
  csfFile = _useOf.csfFile;
87
87
  var storyInfo = (0, _storyHelper.storyDocsPageInfo)(csfFile);
88
88
  var guidelinesHref = altGuidelinesHref !== null && altGuidelinesHref !== void 0 ? altGuidelinesHref : storyInfo.guidelinesHref;
89
- var isFullScreen = (csfFile === null || csfFile === void 0 ? void 0 : (_csfFile$meta = csfFile.meta) === null || _csfFile$meta === void 0 ? void 0 : (_csfFile$meta$paramet = _csfFile$meta.parameters) === null || _csfFile$meta$paramet === void 0 ? void 0 : _csfFile$meta$paramet.layout) === 'fullscreen' || false;
89
+ var isFullScreen = (csfFile === null || csfFile === void 0 || (_csfFile$meta = csfFile.meta) === null || _csfFile$meta === void 0 || (_csfFile$meta = _csfFile$meta.parameters) === null || _csfFile$meta === void 0 ? void 0 : _csfFile$meta.layout) === 'fullscreen' || false;
90
90
  var storyHelperClass = isFullScreen ? 'c4p--story-docs-page--fullscreen' : '';
91
91
  var processedBlocks = processBlocks(blocks, csfFile.stories, omitUnreferencedStories);
92
92
  console.log(processBlocks);
@@ -26,7 +26,7 @@ var isEmpty = function isEmpty(children) {
26
26
  _react.default.Children.forEach(children, function (child) {
27
27
  if (child) {
28
28
  var _child$type, _child$props;
29
- result && (result = (child === null || child === void 0 ? void 0 : (_child$type = child.type) === null || _child$type === void 0 ? void 0 : _child$type.displayName) === 'Wrap' && isEmpty(child === null || child === void 0 ? void 0 : (_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.children));
29
+ result && (result = (child === null || child === void 0 || (_child$type = child.type) === null || _child$type === void 0 ? void 0 : _child$type.displayName) === 'Wrap' && isEmpty(child === null || child === void 0 || (_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.children));
30
30
  }
31
31
  });
32
32
  return result;
@@ -159,7 +159,7 @@ exports.getDeprecatedArgTypes = getDeprecatedArgTypes;
159
159
  var extractShapesArray = function extractShapesArray(items) {
160
160
  var _items$, _items$2;
161
161
  // unwrap if items or the first index looks like a React element or fragment
162
- if (items && (items !== null && items !== void 0 && (_items$ = items[0]) !== null && _items$ !== void 0 && _items$.props || (items === null || items === void 0 ? void 0 : (_items$2 = items[0]) === null || _items$2 === void 0 ? void 0 : _items$2.type) === _react.default.Fragment || items.type === _react.default.Fragment)) {
162
+ if (items && (items !== null && items !== void 0 && (_items$ = items[0]) !== null && _items$ !== void 0 && _items$.props || (items === null || items === void 0 || (_items$2 = items[0]) === null || _items$2 === void 0 ? void 0 : _items$2.type) === _react.default.Fragment || items.type === _react.default.Fragment)) {
163
163
  var unwrappedItems = (0, _unwrapIfFragment.default)(items);
164
164
  return unwrappedItems.map(function (item) {
165
165
  return _objectSpread({
@@ -120,7 +120,7 @@ StackblitzLink.propTypes = {
120
120
  };
121
121
  var palUsageHref = function palUsageHref(csfFile) {
122
122
  var _csfFile$meta;
123
- var title = csfFile === null || csfFile === void 0 ? void 0 : (_csfFile$meta = csfFile.meta) === null || _csfFile$meta === void 0 ? void 0 : _csfFile$meta.title;
123
+ var title = csfFile === null || csfFile === void 0 || (_csfFile$meta = csfFile.meta) === null || _csfFile$meta === void 0 ? void 0 : _csfFile$meta.title;
124
124
  var _title$split = title.split('/'),
125
125
  _title$split2 = (0, _slicedToArray2.default)(_title$split, 3),
126
126
  _pkg = _title$split2[0],
@@ -133,7 +133,7 @@ var palUsageHref = function palUsageHref(csfFile) {
133
133
  exports.palUsageHref = palUsageHref;
134
134
  var storyDocsPageTitle = function storyDocsPageTitle(csfFile) {
135
135
  var _csfFile$meta2;
136
- var title = csfFile === null || csfFile === void 0 ? void 0 : (_csfFile$meta2 = csfFile.meta) === null || _csfFile$meta2 === void 0 ? void 0 : _csfFile$meta2.title;
136
+ var title = csfFile === null || csfFile === void 0 || (_csfFile$meta2 = csfFile.meta) === null || _csfFile$meta2 === void 0 ? void 0 : _csfFile$meta2.title;
137
137
  var _title$split3 = title.split('/'),
138
138
  _title$split4 = (0, _toArray2.default)(_title$split3),
139
139
  _pkg = _title$split4[0],
@@ -163,7 +163,7 @@ var storyDocsPageTitle = function storyDocsPageTitle(csfFile) {
163
163
  exports.storyDocsPageTitle = storyDocsPageTitle;
164
164
  var storyDocsPageInfo = function storyDocsPageInfo(csfFile) {
165
165
  var _csfFile$meta3;
166
- var title = csfFile === null || csfFile === void 0 ? void 0 : (_csfFile$meta3 = csfFile.meta) === null || _csfFile$meta3 === void 0 ? void 0 : _csfFile$meta3.title;
166
+ var title = csfFile === null || csfFile === void 0 || (_csfFile$meta3 = csfFile.meta) === null || _csfFile$meta3 === void 0 ? void 0 : _csfFile$meta3.title;
167
167
  var _title$split5 = title.split('/'),
168
168
  _title$split6 = (0, _toArray2.default)(_title$split5),
169
169
  pkg = _title$split6[0],
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@carbon/ibm-products",
3
3
  "description": "Carbon for IBM Products",
4
- "version": "2.4.0",
4
+ "version": "2.5.0",
5
5
  "license": "Apache-2.0",
6
6
  "main": "lib/index.js",
7
7
  "module": "es/index.js",
@@ -54,27 +54,27 @@
54
54
  "upgrade-dependencies": "npm-check-updates -u --dep dev,peer,prod --color --reject '/(carbon|^react$|^react-dom$|^chalk$|^react-dnd|^namor)/'"
55
55
  },
56
56
  "devDependencies": {
57
- "@babel/cli": "^7.22.5",
58
- "@babel/core": "^7.22.5",
59
- "babel-preset-ibm-cloud-cognitive": "^0.14.37",
57
+ "@babel/cli": "^7.22.9",
58
+ "@babel/core": "^7.22.9",
59
+ "babel-preset-ibm-cloud-cognitive": "^0.14.38",
60
60
  "chalk": "^4.1.2",
61
61
  "change-case": "^4.1.2",
62
62
  "copyfiles": "^2.4.1",
63
63
  "cross-env": "^7.0.3",
64
64
  "fs-extra": "^11.1.1",
65
- "glob": "^10.3.1",
66
- "jest": "^29.5.0",
67
- "jest-config-ibm-cloud-cognitive": "^0.24.24",
68
- "jest-environment-jsdom": "^29.5.0",
65
+ "glob": "^10.3.3",
66
+ "jest": "^29.6.1",
67
+ "jest-config-ibm-cloud-cognitive": "^0.24.25",
68
+ "jest-environment-jsdom": "^29.6.1",
69
69
  "namor": "^1.1.2",
70
- "npm-check-updates": "^16.10.13",
70
+ "npm-check-updates": "^16.10.15",
71
71
  "npm-run-all": "^4.1.5",
72
72
  "rimraf": "^5.0.1",
73
73
  "sass": "^1.63.6",
74
74
  "yargs": "^17.7.2"
75
75
  },
76
76
  "dependencies": {
77
- "@babel/runtime": "^7.22.5",
77
+ "@babel/runtime": "^7.22.6",
78
78
  "@carbon/telemetry": "^0.1.0",
79
79
  "framer-motion": "^6.5.1 < 7",
80
80
  "immutability-helper": "^3.1.1",
@@ -94,5 +94,5 @@
94
94
  "react": "^16.8.6 || ^17.0.1",
95
95
  "react-dom": "^16.8.6 || ^17.0.1"
96
96
  },
97
- "gitHead": "ce43460f28f908aeb8ec4bfb2c501dd457d11a58"
97
+ "gitHead": "40fe19b4ef32f97f01e8664bbe81fc1e459d0f3f"
98
98
  }
@@ -54,6 +54,11 @@ $block-class: #{c4p-settings.$pkg-prefix}--datagrid;
54
54
  padding-bottom: $spacing-06;
55
55
  }
56
56
 
57
+ .#{$block-class}__side-panel-link {
58
+ padding-top: $spacing-01;
59
+ padding-bottom: $spacing-06;
60
+ }
61
+
57
62
  .#{$block-class}__side-panel-section-inner {
58
63
  display: flex;
59
64
  padding: $spacing-01 0;
@@ -632,14 +632,6 @@
632
632
  padding: 0;
633
633
  }
634
634
 
635
- // TODO: Revisit batch action list button and button icon alignment after
636
- // https: //github.com/carbon-design-system/carbon/issues/14021 is fixed
637
- .#{$block-class}
638
- .#{c4p-settings.$carbon-prefix}--action-list
639
- .#{c4p-settings.$carbon-prefix}--btn {
640
- align-items: center;
641
- }
642
-
643
635
  .#{$block-class}
644
636
  .#{c4p-settings.$carbon-prefix}--action-list
645
637
  .#{c4p-settings.$carbon-prefix}--btn__icon {
@@ -31,6 +31,9 @@ $block-class: #{c4p-settings.$pkg-prefix}--edit-update-cards;
31
31
  .#{c4p-settings.$pkg-prefix}--card__header,
32
32
  .#{c4p-settings.$pkg-prefix}--card__footer {
33
33
  button {
34
+ // stylelint-disable-next-line carbon/theme-token-use
35
+ color: $white-0;
36
+
34
37
  &:hover {
35
38
  // stylelint-disable-next-line carbon/theme-token-use
36
39
  background-color: $blue-60-hover;
@@ -54,12 +57,14 @@ $block-class: #{c4p-settings.$pkg-prefix}--edit-update-cards;
54
57
  }
55
58
  }
56
59
  }
60
+
57
61
  .#{c4p-settings.$pkg-prefix}--card__footer {
58
62
  // stylelint-disable-next-line carbon/theme-token-use
59
63
  background-color: $blue-60;
60
64
  // stylelint-disable-next-line carbon/theme-token-use
61
65
  color: $white-0;
62
66
  }
67
+
63
68
  .#{c4p-settings.$pkg-prefix}--loading {
64
69
  animation-duration: $duration-slow-02;
65
70
  animation-fill-mode: forwards;
@@ -71,7 +76,12 @@ $block-class: #{c4p-settings.$pkg-prefix}--edit-update-cards;
71
76
  background-color: transparent;
72
77
  }
73
78
  }
79
+
80
+ .#{c4p-settings.$pkg-prefix}--card__header-container {
81
+ align-items: center;
82
+ }
74
83
  }
84
+
75
85
  &:not(.#{$block-class}__actions-bottom) {
76
86
  &##{$block-class}--edit {
77
87
  .#{c4p-settings.$pkg-prefix}--card__header {
@@ -77,6 +77,21 @@ $block-class: #{c4p-settings.$pkg-prefix}--card;
77
77
  &::before {
78
78
  opacity: 0;
79
79
  }
80
+
81
+ + .#{$block-class}__actions-header-ghost-button {
82
+ /* stylelint-disable-next-line max-nesting-depth */
83
+ &::before {
84
+ opacity: 0;
85
+ }
86
+ }
87
+ }
88
+
89
+ /* stylelint-disable-next-line max-nesting-depth */
90
+ &:first-child:not(:last-child) {
91
+ /* stylelint-disable-next-line max-nesting-depth */
92
+ &::before {
93
+ display: none;
94
+ }
80
95
  }
81
96
  }
82
97
 
@@ -127,6 +127,12 @@ $motion-duration: $duration-moderate-02;
127
127
  width: 100%;
128
128
  }
129
129
 
130
+ &.#{$block-class}--wide
131
+ .#{$pkg-prefix}--action-set
132
+ .#{$pkg-prefix}--action-set__action-button.#{$pkg-prefix}--action-set__action-button--expressive {
133
+ height: $spacing-11;
134
+ }
135
+
130
136
  @include breakpoint(md) {
131
137
  &.#{$block-class}--wide .#{$block-class}__container {
132
138
  width: calc(100% - (2 * #{$spacing-10}));