@carbon/ibm-products 1.11.1 → 1.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. package/README.md +0 -3
  2. package/css/index-full-carbon.css +1445 -369
  3. package/css/index-full-carbon.css.map +1 -1
  4. package/css/index-full-carbon.min.css +6 -6
  5. package/css/index-full-carbon.min.css.map +1 -1
  6. package/css/index-without-carbon-released-only.css +15 -6
  7. package/css/index-without-carbon-released-only.css.map +1 -1
  8. package/css/index-without-carbon-released-only.min.css +2 -2
  9. package/css/index-without-carbon-released-only.min.css.map +1 -1
  10. package/css/index-without-carbon.css +109 -16
  11. package/css/index-without-carbon.css.map +1 -1
  12. package/css/index-without-carbon.min.css +5 -5
  13. package/css/index-without-carbon.min.css.map +1 -1
  14. package/css/index.css +109 -16
  15. package/css/index.css.map +1 -1
  16. package/css/index.min.css +6 -6
  17. package/css/index.min.css.map +1 -1
  18. package/es/components/ActionBar/ActionBar.js +3 -1
  19. package/es/components/ActionBar/ActionBarOverflowItems.js +5 -3
  20. package/es/components/AddSelect/AddSelect.js +63 -12
  21. package/es/components/AddSelect/AddSelectColumn.js +0 -1
  22. package/es/components/AddSelect/AddSelectList.js +59 -13
  23. package/es/components/AddSelect/AddSelectSidebar.js +15 -5
  24. package/es/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +2 -0
  25. package/es/components/CreateFullPage/CreateFullPageStep.js +4 -4
  26. package/es/components/CreateTearsheet/CreateTearsheetStep.js +4 -4
  27. package/es/components/DataSpreadsheet/DataSpreadsheet.js +193 -119
  28. package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +178 -51
  29. package/es/components/DataSpreadsheet/DataSpreadsheetHeader.js +50 -2
  30. package/es/components/DataSpreadsheet/hooks/useSpreadsheetOutsideClick.js +6 -4
  31. package/es/components/DataSpreadsheet/utils/handleHeaderCellSelection.js +3 -1
  32. package/es/components/HTTPErrors/assets/HTTPErrorSvg403.js +2 -3
  33. package/es/components/HTTPErrors/assets/HTTPErrorSvg404.js +2 -3
  34. package/es/components/HTTPErrors/assets/HTTPErrorSvgOther.js +2 -3
  35. package/es/components/ImportModal/ImportModal.js +2 -2
  36. package/es/components/TagSet/TagSet.js +12 -3
  37. package/es/components/UserProfileImage/UserProfileImage.js +38 -10
  38. package/lib/components/ActionBar/ActionBar.js +3 -1
  39. package/lib/components/ActionBar/ActionBarOverflowItems.js +5 -3
  40. package/lib/components/AddSelect/AddSelect.js +63 -12
  41. package/lib/components/AddSelect/AddSelectColumn.js +0 -1
  42. package/lib/components/AddSelect/AddSelectList.js +61 -12
  43. package/lib/components/AddSelect/AddSelectSidebar.js +15 -11
  44. package/lib/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +2 -0
  45. package/lib/components/CreateFullPage/CreateFullPageStep.js +4 -4
  46. package/lib/components/CreateTearsheet/CreateTearsheetStep.js +4 -4
  47. package/lib/components/DataSpreadsheet/DataSpreadsheet.js +196 -120
  48. package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +178 -51
  49. package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.js +52 -7
  50. package/lib/components/DataSpreadsheet/hooks/useSpreadsheetOutsideClick.js +6 -3
  51. package/lib/components/DataSpreadsheet/utils/handleHeaderCellSelection.js +3 -1
  52. package/lib/components/HTTPErrors/assets/HTTPErrorSvg403.js +2 -3
  53. package/lib/components/HTTPErrors/assets/HTTPErrorSvg404.js +2 -3
  54. package/lib/components/HTTPErrors/assets/HTTPErrorSvgOther.js +2 -3
  55. package/lib/components/ImportModal/ImportModal.js +1 -1
  56. package/lib/components/TagSet/TagSet.js +12 -3
  57. package/lib/components/UserProfileImage/UserProfileImage.js +38 -10
  58. package/package.json +15 -15
  59. package/scss/components/AboutModal/_about-modal.scss +2 -2
  60. package/scss/components/ActionSet/_action-set.scss +3 -1
  61. package/scss/components/AddSelect/_add-select.scss +50 -3
  62. package/scss/components/CreateModal/_create-modal.scss +7 -5
  63. package/scss/components/CreateModal/_storybook-styles.scss +8 -7
  64. package/scss/components/DataSpreadsheet/_data-spreadsheet.scss +57 -7
  65. package/scss/components/ExportModal/_export-modal.scss +3 -3
  66. package/scss/components/HTTPErrors/_http-errors.scss +16 -16
  67. package/scss/components/InlineEdit/_inline-edit.scss +0 -1
  68. package/scss/components/ModifiedTabs/_modified-tabs.scss +0 -10
  69. package/scss/components/NotificationsPanel/_notifications-panel.scss +3 -3
  70. package/scss/components/OptionsTile/_options-tile.scss +0 -1
  71. package/scss/components/PageHeader/_page-header.scss +4 -0
  72. package/scss/components/RemoveModal/_remove-modal.scss +3 -3
  73. package/scss/components/TagSet/_tag-set.scss +2 -1
  74. package/scss/components/Tearsheet/_tearsheet.scss +1 -2
@@ -216,7 +216,6 @@ export var AddSelectColumn = function AddSelectColumn(_ref) {
216
216
  size: "sm"
217
217
  }, colItems.length))
218
218
  })), /*#__PURE__*/React.createElement(AddSelectList, _extends({}, props, {
219
- inColumn: true,
220
219
  filteredItems: colItems,
221
220
  setMultiSelection: setMultiSelection,
222
221
  multiSelection: multiSelection
@@ -1,3 +1,4 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
1
2
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
3
  //
3
4
  // Copyright IBM Corp. 2022
@@ -6,14 +7,16 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
6
7
  // LICENSE file in the root directory of this source tree.
7
8
  //
8
9
  import React from 'react';
9
- import { Checkbox, RadioButton, StructuredListRow, StructuredListWrapper, StructuredListBody, StructuredListCell } from 'carbon-components-react';
10
+ import { Checkbox, RadioButton, StructuredListRow, StructuredListWrapper, StructuredListBody, StructuredListCell, Dropdown } from 'carbon-components-react';
10
11
  import { ChevronRight16 } from '@carbon/icons-react';
11
12
  import PropTypes from 'prop-types';
13
+ import cx from 'classnames';
14
+ import { UserProfileImage } from '../UserProfileImage';
12
15
  import { pkg } from '../../settings';
13
16
  var componentName = 'AddSelectList';
14
17
  export var AddSelectList = function AddSelectList(_ref) {
15
18
  var filteredItems = _ref.filteredItems,
16
- inColumn = _ref.inColumn,
19
+ modifiers = _ref.modifiers,
17
20
  multi = _ref.multi,
18
21
  multiSelection = _ref.multiSelection,
19
22
  path = _ref.path,
@@ -99,32 +102,75 @@ export var AddSelectList = function AddSelectList(_ref) {
99
102
  }
100
103
  };
101
104
 
105
+ var isSelected = function isSelected(id) {
106
+ return multiSelection.includes(id);
107
+ };
108
+
109
+ var getAvatarProps = function getAvatarProps(_ref3) {
110
+ var src = _ref3.src,
111
+ alt = _ref3.alt,
112
+ icon = _ref3.icon,
113
+ backgroundColor = _ref3.backgroundColor;
114
+ return {
115
+ className: "".concat(blockClass, "-cell-avatar"),
116
+ size: 'lg',
117
+ theme: 'light',
118
+ image: src,
119
+ imageDescription: alt,
120
+ icon: icon,
121
+ backgroundColor: backgroundColor
122
+ };
123
+ };
124
+
125
+ var getItemIcon = function getItemIcon(_ref4) {
126
+ var Icon = _ref4.icon;
127
+ return /*#__PURE__*/React.createElement(Icon, null);
128
+ };
129
+
102
130
  return /*#__PURE__*/React.createElement("div", {
103
131
  className: "".concat(blockClass, "-wrapper")
104
132
  }, /*#__PURE__*/React.createElement(StructuredListWrapper, {
105
133
  selection: true,
106
134
  className: "".concat(blockClass)
107
135
  }, /*#__PURE__*/React.createElement(StructuredListBody, null, filteredItems.map(function (item) {
136
+ var _modifiers$options;
137
+
108
138
  return /*#__PURE__*/React.createElement(StructuredListRow, {
109
139
  key: item.id,
110
- className: "".concat(blockClass, "-row")
140
+ className: cx("".concat(blockClass, "-row"), _defineProperty({}, "".concat(blockClass, "-row-selected"), isSelected(item.id)))
111
141
  }, /*#__PURE__*/React.createElement(StructuredListCell, {
112
142
  className: "".concat(blockClass, "-cell")
113
143
  }, /*#__PURE__*/React.createElement("div", {
114
144
  className: "".concat(blockClass, "-cell-wrapper")
115
- }, multi ? /*#__PURE__*/React.createElement(Checkbox, {
116
- className: "".concat(blockClass, "-checkbox"),
145
+ }, multi ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
146
+ className: "".concat(blockClass, "-checkbox")
147
+ }, /*#__PURE__*/React.createElement(Checkbox, {
117
148
  onChange: function onChange(checked) {
118
149
  return handleMultiSelection(item.id, checked);
119
150
  },
120
- labelText: !inColumn ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
121
- className: "".concat(blockClass, "-cell-title")
122
- }, item.title), /*#__PURE__*/React.createElement("span", {
123
- className: "".concat(blockClass, "-cell-subtitle")
124
- }, item.subtitle)) : item.title,
151
+ labelText: item.title,
125
152
  id: item.id,
126
- checked: multiSelection.includes(item.id)
127
- }) : /*#__PURE__*/React.createElement(RadioButton, {
153
+ checked: isSelected(item.id),
154
+ className: "".concat(blockClass, "-checkbox-wrapper")
155
+ }), /*#__PURE__*/React.createElement("div", {
156
+ className: "".concat(blockClass, "-checkbox-label-wrapper")
157
+ }, item.avatar && /*#__PURE__*/React.createElement(UserProfileImage, getAvatarProps(item.avatar)), item.icon && /*#__PURE__*/React.createElement("div", {
158
+ className: "".concat(blockClass, "-cell-icon")
159
+ }, getItemIcon(item)), /*#__PURE__*/React.createElement("div", {
160
+ className: "".concat(blockClass, "-checkbox-label-text")
161
+ }, /*#__PURE__*/React.createElement("span", {
162
+ className: "".concat(blockClass, "-cell-title")
163
+ }, item.title), item.subtitle && /*#__PURE__*/React.createElement("span", {
164
+ className: "".concat(blockClass, "-cell-subtitle")
165
+ }, item.subtitle)))), (modifiers === null || modifiers === void 0 ? void 0 : (_modifiers$options = modifiers.options) === null || _modifiers$options === void 0 ? void 0 : _modifiers$options.length) && /*#__PURE__*/React.createElement(Dropdown, {
166
+ id: "".concat(item.id, "-modifier"),
167
+ type: "inline",
168
+ items: modifiers === null || modifiers === void 0 ? void 0 : modifiers.options,
169
+ light: true,
170
+ label: modifiers === null || modifiers === void 0 ? void 0 : modifiers.label,
171
+ disabled: !isSelected(item.id),
172
+ className: "".concat(blockClass, "-dropdown")
173
+ })) : /*#__PURE__*/React.createElement(RadioButton, {
128
174
  className: "".concat(blockClass, "-radio"),
129
175
  name: "add-select-selections",
130
176
  id: item.id,
@@ -141,7 +187,7 @@ export var AddSelectList = function AddSelectList(_ref) {
141
187
  };
142
188
  AddSelectList.propTypes = {
143
189
  filteredItems: PropTypes.array,
144
- inColumn: PropTypes.bool,
190
+ modifiers: PropTypes.object,
145
191
  multi: PropTypes.bool,
146
192
  multiSelection: PropTypes.array,
147
193
  path: PropTypes.array,
@@ -1,3 +1,5 @@
1
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
2
+ var _excluded = ["icon", "avatar"];
1
3
  //
2
4
  // Copyright IBM Corp. 2022
3
5
  //
@@ -28,11 +30,19 @@ export var AddSelectSidebar = function AddSelectSidebar(_ref) {
28
30
  setMultiSelection(newSelections);
29
31
  };
30
32
 
31
- var sidebarItems = multiSelection.map(function (selectedId) {
32
- return items.find(function (item) {
33
- return item.id === selectedId;
34
- });
35
- });
33
+ var sidebarItems = multiSelection.reduce(function (acc, cur) {
34
+ var selectedItem = items.find(function (item) {
35
+ return item.id === cur;
36
+ }); // certain properties should not be displayed in the sidebar
37
+ // eslint-disable-next-line no-unused-vars
38
+
39
+ var icon = selectedItem.icon,
40
+ avatar = selectedItem.avatar,
41
+ newItem = _objectWithoutProperties(selectedItem, _excluded);
42
+
43
+ acc.push(newItem);
44
+ return acc;
45
+ }, []);
36
46
 
37
47
  var getTitle = function getTitle(_ref2) {
38
48
  var title = _ref2.title,
@@ -76,6 +76,8 @@ export var BreadcrumbWithOverflow = function BreadcrumbWithOverflow(_ref) {
76
76
  key: "breadcrumb-overflow-".concat(internalId.current)
77
77
  }, /*#__PURE__*/React.createElement(OverflowMenu, {
78
78
  ariaLabel: overflowAriaLabel,
79
+ iconDescription: overflowAriaLabel // also needs setting to avoid a11y "Accessible name does not match or contain the visible label text"
80
+ ,
79
81
  renderIcon: OverflowMenuHorizontal32,
80
82
  className: "".concat(blockClass, "__overflow-menu"),
81
83
  menuOptionsClass: "".concat(blockClass, "__overflow-menu-options")
@@ -61,23 +61,23 @@ export var CreateFullPageStep = /*#__PURE__*/forwardRef(function (_ref, ref) {
61
61
  shouldIncludeStep: shouldIncludeStep,
62
62
  secondaryLabel: secondaryLabel,
63
63
  title: title
64
- }); // This useEffect reports back the onNext and onMount values so that they can be used
64
+ }); // This useEffect reports back the onMount value so that they can be used
65
65
  // in the appropriate custom hooks.
66
66
 
67
67
  useEffect(function () {
68
68
  if (stepNumber === (stepsContext === null || stepsContext === void 0 ? void 0 : stepsContext.currentStep) && (previousState === null || previousState === void 0 ? void 0 : previousState.currentStep) !== (stepsContext === null || stepsContext === void 0 ? void 0 : stepsContext.currentStep)) {
69
- stepsContext === null || stepsContext === void 0 ? void 0 : stepsContext.setOnNext(onNext);
70
69
  stepsContext === null || stepsContext === void 0 ? void 0 : stepsContext.setOnMount(onMount);
71
70
  }
72
- }, [onMount, onNext, stepsContext, stepNumber, previousState === null || previousState === void 0 ? void 0 : previousState.currentStep]);
71
+ }, [onMount, stepsContext, stepNumber, previousState === null || previousState === void 0 ? void 0 : previousState.currentStep]);
73
72
  useEffect(function () {
74
73
  setShouldIncludeStep(includeStep);
75
- }, [includeStep, stepsContext, title]); // Whenever we are the current step, supply our disableSubmit value to the
74
+ }, [includeStep, stepsContext, title]); // Whenever we are the current step, supply our disableSubmit and onNext values to the
76
75
  // steps container context so that it can manage the 'Next' button appropriately.
77
76
 
78
77
  useEffect(function () {
79
78
  if (stepNumber === (stepsContext === null || stepsContext === void 0 ? void 0 : stepsContext.currentStep)) {
80
79
  stepsContext.setIsDisabled(disableSubmit);
80
+ stepsContext === null || stepsContext === void 0 ? void 0 : stepsContext.setOnNext(onNext); // needs to be updated here otherwise there could be stale state values from only initially setting onNext
81
81
  }
82
82
  }, [stepsContext, stepNumber, disableSubmit, onNext]);
83
83
  return stepsContext ? /*#__PURE__*/React.createElement("section", _extends({}, rest, {
@@ -63,24 +63,24 @@ export var CreateTearsheetStep = /*#__PURE__*/forwardRef(function (_ref, ref) {
63
63
  shouldIncludeStep: shouldIncludeStep,
64
64
  secondaryLabel: secondaryLabel,
65
65
  title: title
66
- }); // This useEffect reports back the onNext and onMount values so that they can be used
66
+ }); // This useEffect reports back the onMount value so that they can be used
67
67
  // in the appropriate custom hooks.
68
68
 
69
69
  useEffect(function () {
70
70
  if (stepNumber === (stepsContext === null || stepsContext === void 0 ? void 0 : stepsContext.currentStep) && (previousState === null || previousState === void 0 ? void 0 : previousState.currentStep) !== (stepsContext === null || stepsContext === void 0 ? void 0 : stepsContext.currentStep)) {
71
- stepsContext === null || stepsContext === void 0 ? void 0 : stepsContext.setOnNext(onNext);
72
71
  stepsContext === null || stepsContext === void 0 ? void 0 : stepsContext.setOnMount(onMount);
73
72
  }
74
- }, [onMount, onNext, stepsContext, stepNumber, previousState === null || previousState === void 0 ? void 0 : previousState.currentStep]); // Used to take the `includeStep` prop and use it as a local state value
73
+ }, [onMount, stepsContext, stepNumber, previousState === null || previousState === void 0 ? void 0 : previousState.currentStep]); // Used to take the `includeStep` prop and use it as a local state value
75
74
 
76
75
  useEffect(function () {
77
76
  setShouldIncludeStep(includeStep);
78
- }, [includeStep, stepsContext, title]); // Whenever we are the current step, supply our disableSubmit value to the
77
+ }, [includeStep, stepsContext, title]); // Whenever we are the current step, supply our disableSubmit and onNext values to the
79
78
  // steps container context so that it can manage the 'Next' button appropriately.
80
79
 
81
80
  useEffect(function () {
82
81
  if (stepNumber === (stepsContext === null || stepsContext === void 0 ? void 0 : stepsContext.currentStep)) {
83
82
  stepsContext.setIsDisabled(disableSubmit);
83
+ stepsContext === null || stepsContext === void 0 ? void 0 : stepsContext.setOnNext(onNext); // needs to be updated here otherwise there could be stale state values from only initially setting onNext
84
84
  }
85
85
  }, [stepsContext, stepNumber, disableSubmit, onNext]);
86
86
  return stepsContext ? /*#__PURE__*/React.createElement("div", _extends({}, rest, {