@carbon/ibm-products 2.6.0 → 2.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. package/css/index-full-carbon.css +6291 -5856
  2. package/css/index-full-carbon.css.map +1 -1
  3. package/css/index-full-carbon.min.css +3 -3
  4. package/css/index-full-carbon.min.css.map +1 -1
  5. package/css/index-without-carbon-released-only.css +21 -21
  6. package/css/index-without-carbon-released-only.css.map +1 -1
  7. package/css/index-without-carbon-released-only.min.css +2 -2
  8. package/css/index-without-carbon-released-only.min.css.map +1 -1
  9. package/css/index-without-carbon.css +1259 -193
  10. package/css/index-without-carbon.css.map +1 -1
  11. package/css/index-without-carbon.min.css +3 -3
  12. package/css/index-without-carbon.min.css.map +1 -1
  13. package/css/index.css +3674 -3623
  14. package/css/index.css.map +1 -1
  15. package/css/index.min.css +3 -3
  16. package/css/index.min.css.map +1 -1
  17. package/es/components/CreateTearsheet/CreateTearsheet.js +30 -14
  18. package/es/components/CreateTearsheet/CreateTearsheetStep.js +10 -4
  19. package/es/components/CreateTearsheet/preview-components/MultiStepTearsheet.js +3 -0
  20. package/es/components/Datagrid/Datagrid/Datagrid.js +12 -7
  21. package/es/components/Datagrid/Datagrid/DatagridContent.js +18 -14
  22. package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +12 -1
  23. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +1 -4
  24. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js +2 -5
  25. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/DraggableItemsList.js +11 -17
  26. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/TearsheetWrapper.js +0 -1
  27. package/es/components/Datagrid/useDefaultStringRenderer.js +2 -1
  28. package/es/components/Datagrid/useSortableColumns.js +13 -5
  29. package/es/components/Datagrid/utils/getColTitle.js +25 -0
  30. package/es/components/NotificationsPanel/NotificationsPanel.js +5 -5
  31. package/es/components/OptionsTile/OptionsTile.js +2 -4
  32. package/es/global/js/hooks/useCreateComponentStepChange.js +98 -49
  33. package/es/global/js/hooks/useResizeObserver.js +15 -1
  34. package/es/global/js/hooks/useRetrieveStepData.js +1 -1
  35. package/es/global/js/utils/StoryDocsPage.js +0 -1
  36. package/lib/components/CreateTearsheet/CreateTearsheet.js +30 -14
  37. package/lib/components/CreateTearsheet/CreateTearsheetStep.js +10 -4
  38. package/lib/components/CreateTearsheet/preview-components/MultiStepTearsheet.js +3 -0
  39. package/lib/components/Datagrid/Datagrid/Datagrid.js +12 -7
  40. package/lib/components/Datagrid/Datagrid/DatagridContent.js +17 -13
  41. package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +12 -1
  42. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +1 -4
  43. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js +2 -5
  44. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/DraggableItemsList.js +11 -17
  45. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/TearsheetWrapper.js +0 -1
  46. package/lib/components/Datagrid/useDefaultStringRenderer.js +2 -1
  47. package/lib/components/Datagrid/useSortableColumns.js +13 -5
  48. package/lib/components/Datagrid/utils/getColTitle.js +32 -0
  49. package/lib/components/NotificationsPanel/NotificationsPanel.js +5 -5
  50. package/lib/components/OptionsTile/OptionsTile.js +2 -4
  51. package/lib/global/js/hooks/useCreateComponentStepChange.js +98 -49
  52. package/lib/global/js/hooks/useResizeObserver.js +15 -1
  53. package/lib/global/js/hooks/useRetrieveStepData.js +1 -1
  54. package/lib/global/js/utils/StoryDocsPage.js +0 -1
  55. package/package.json +9 -9
  56. package/scss/components/Datagrid/styles/_useColumnCenterAlign.scss +9 -9
@@ -9,7 +9,7 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"))
9
9
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
10
  var _react = require("react");
11
11
  /**
12
- * Copyright IBM Corp. 2021, 2022
12
+ * Copyright IBM Corp. 2021, 2023
13
13
  *
14
14
  * This source code is licensed under the Apache-2.0 license found in the
15
15
  * LICENSE file in the root directory of this source tree.
@@ -19,16 +19,19 @@ var useCreateComponentStepChange = function useCreateComponentStepChange(_ref) {
19
19
  var firstIncludedStep = _ref.firstIncludedStep,
20
20
  lastIncludedStep = _ref.lastIncludedStep,
21
21
  stepData = _ref.stepData,
22
+ onPrevious = _ref.onPrevious,
22
23
  onNext = _ref.onNext,
23
24
  isSubmitDisabled = _ref.isSubmitDisabled,
24
25
  setCurrentStep = _ref.setCurrentStep,
25
26
  setIsSubmitting = _ref.setIsSubmitting,
26
- setShouldViewAll = _ref.setShouldViewAll,
27
+ _ref$setLoadingPrevio = _ref.setLoadingPrevious,
28
+ setLoadingPrevious = _ref$setLoadingPrevio === void 0 ? null : _ref$setLoadingPrevio,
29
+ _ref$loadingPrevious = _ref.loadingPrevious,
30
+ loadingPrevious = _ref$loadingPrevious === void 0 ? false : _ref$loadingPrevious,
27
31
  onClose = _ref.onClose,
28
32
  onRequestSubmit = _ref.onRequestSubmit,
29
33
  componentName = _ref.componentName,
30
34
  currentStep = _ref.currentStep,
31
- shouldViewAll = _ref.shouldViewAll,
32
35
  backButtonText = _ref.backButtonText,
33
36
  cancelButtonText = _ref.cancelButtonText,
34
37
  submitButtonText = _ref.submitButtonText,
@@ -50,6 +53,21 @@ var useCreateComponentStepChange = function useCreateComponentStepChange(_ref) {
50
53
  return prev;
51
54
  });
52
55
  }, [setCurrentStep, setIsSubmitting, stepData]);
56
+ var moveToPreviousStep = (0, _react.useCallback)(function () {
57
+ if (componentName !== 'CreateFullPage') {
58
+ setLoadingPrevious(false);
59
+ }
60
+ setCurrentStep(function (prev) {
61
+ // Find previous included step to render
62
+ // There will always be a previous step otherwise we will
63
+ // have disabled the back button since we have reached the first visible step
64
+ do {
65
+ var _stepData2;
66
+ prev--;
67
+ } while (!((_stepData2 = stepData[prev - 1]) !== null && _stepData2 !== void 0 && _stepData2.shouldIncludeStep));
68
+ return prev;
69
+ });
70
+ }, [setCurrentStep, stepData, setLoadingPrevious, componentName]);
53
71
 
54
72
  // useEffect to handle multi step logic
55
73
  (0, _react.useEffect)(function () {
@@ -58,7 +76,6 @@ var useCreateComponentStepChange = function useCreateComponentStepChange(_ref) {
58
76
  setCurrentStep(0);
59
77
  }
60
78
  setIsSubmitting(false);
61
- setShouldViewAll(false);
62
79
  onClose();
63
80
  };
64
81
  var handleOnRequestSubmit = /*#__PURE__*/function () {
@@ -88,104 +105,136 @@ var useCreateComponentStepChange = function useCreateComponentStepChange(_ref) {
88
105
  return _ref2.apply(this, arguments);
89
106
  };
90
107
  }();
91
- var handleNext = /*#__PURE__*/function () {
108
+ var handlePrevious = /*#__PURE__*/function () {
92
109
  var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
93
110
  return _regenerator.default.wrap(function _callee2$(_context2) {
94
111
  while (1) switch (_context2.prev = _context2.next) {
112
+ case 0:
113
+ if (!(componentName === 'CreateFullPage')) {
114
+ _context2.next = 2;
115
+ break;
116
+ }
117
+ return _context2.abrupt("return");
118
+ case 2:
119
+ setLoadingPrevious(true);
120
+ if (!(typeof onPrevious === 'function')) {
121
+ _context2.next = 15;
122
+ break;
123
+ }
124
+ _context2.prev = 4;
125
+ _context2.next = 7;
126
+ return onPrevious();
127
+ case 7:
128
+ moveToPreviousStep();
129
+ _context2.next = 13;
130
+ break;
131
+ case 10:
132
+ _context2.prev = 10;
133
+ _context2.t0 = _context2["catch"](4);
134
+ console.warn("".concat(componentName, " onBack error: ").concat(_context2.t0));
135
+ case 13:
136
+ _context2.next = 16;
137
+ break;
138
+ case 15:
139
+ moveToPreviousStep();
140
+ case 16:
141
+ case "end":
142
+ return _context2.stop();
143
+ }
144
+ }, _callee2, null, [[4, 10]]);
145
+ }));
146
+ return function handlePrevious() {
147
+ return _ref3.apply(this, arguments);
148
+ };
149
+ }();
150
+ var handleNext = /*#__PURE__*/function () {
151
+ var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
152
+ return _regenerator.default.wrap(function _callee3$(_context3) {
153
+ while (1) switch (_context3.prev = _context3.next) {
95
154
  case 0:
96
155
  setIsSubmitting(true);
97
156
  if (!(typeof onNext === 'function')) {
98
- _context2.next = 14;
157
+ _context3.next = 14;
99
158
  break;
100
159
  }
101
- _context2.prev = 2;
102
- _context2.next = 5;
160
+ _context3.prev = 2;
161
+ _context3.next = 5;
103
162
  return onNext();
104
163
  case 5:
105
164
  continueToNextStep();
106
- _context2.next = 12;
165
+ _context3.next = 12;
107
166
  break;
108
167
  case 8:
109
- _context2.prev = 8;
110
- _context2.t0 = _context2["catch"](2);
168
+ _context3.prev = 8;
169
+ _context3.t0 = _context3["catch"](2);
111
170
  setIsSubmitting(false);
112
- console.warn("".concat(componentName, " onNext error: ").concat(_context2.t0));
171
+ console.warn("".concat(componentName, " onNext error: ").concat(_context3.t0));
113
172
  case 12:
114
- _context2.next = 15;
173
+ _context3.next = 15;
115
174
  break;
116
175
  case 14:
117
176
  continueToNextStep();
118
177
  case 15:
119
178
  case "end":
120
- return _context2.stop();
179
+ return _context3.stop();
121
180
  }
122
- }, _callee2, null, [[2, 8]]);
181
+ }, _callee3, null, [[2, 8]]);
123
182
  }));
124
183
  return function handleNext() {
125
- return _ref3.apply(this, arguments);
184
+ return _ref4.apply(this, arguments);
126
185
  };
127
186
  }();
128
187
  var handleSubmit = /*#__PURE__*/function () {
129
- var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
130
- return _regenerator.default.wrap(function _callee3$(_context3) {
131
- while (1) switch (_context3.prev = _context3.next) {
188
+ var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
189
+ return _regenerator.default.wrap(function _callee4$(_context4) {
190
+ while (1) switch (_context4.prev = _context4.next) {
132
191
  case 0:
133
192
  setIsSubmitting(true);
134
193
  // last step should have onNext as well
135
194
  if (!(typeof onNext === 'function')) {
136
- _context3.next = 15;
195
+ _context4.next = 15;
137
196
  break;
138
197
  }
139
- _context3.prev = 2;
140
- _context3.next = 5;
198
+ _context4.prev = 2;
199
+ _context4.next = 5;
141
200
  return onNext();
142
201
  case 5:
143
- _context3.next = 7;
202
+ _context4.next = 7;
144
203
  return handleOnRequestSubmit();
145
204
  case 7:
146
- _context3.next = 13;
205
+ _context4.next = 13;
147
206
  break;
148
207
  case 9:
149
- _context3.prev = 9;
150
- _context3.t0 = _context3["catch"](2);
208
+ _context4.prev = 9;
209
+ _context4.t0 = _context4["catch"](2);
151
210
  setIsSubmitting(false);
152
- console.warn("".concat(componentName, " onNext error: ").concat(_context3.t0));
211
+ console.warn("".concat(componentName, " onNext error: ").concat(_context4.t0));
153
212
  case 13:
154
- _context3.next = 17;
213
+ _context4.next = 17;
155
214
  break;
156
215
  case 15:
157
- _context3.next = 17;
216
+ _context4.next = 17;
158
217
  return handleOnRequestSubmit();
159
218
  case 17:
160
219
  case "end":
161
- return _context3.stop();
220
+ return _context4.stop();
162
221
  }
163
- }, _callee3, null, [[2, 9]]);
222
+ }, _callee4, null, [[2, 9]]);
164
223
  }));
165
224
  return function handleSubmit() {
166
- return _ref4.apply(this, arguments);
225
+ return _ref5.apply(this, arguments);
167
226
  };
168
227
  }();
169
228
  if ((stepData === null || stepData === void 0 ? void 0 : stepData.length) > 0) {
170
229
  var buttons = [];
171
- if ((stepData === null || stepData === void 0 ? void 0 : stepData.length) > 1 && !shouldViewAll) {
230
+ if ((stepData === null || stepData === void 0 ? void 0 : stepData.length) > 1) {
172
231
  buttons.push({
173
232
  key: 'create-action-button-back',
174
233
  label: backButtonText,
175
- onClick: function onClick() {
176
- return setCurrentStep(function (prev) {
177
- // Find previous included step to render
178
- // There will always be a previous step otherwise we will
179
- // have disabled the back button since we have reached the first visible step
180
- do {
181
- var _stepData2;
182
- prev--;
183
- } while (!((_stepData2 = stepData[prev - 1]) !== null && _stepData2 !== void 0 && _stepData2.shouldIncludeStep));
184
- return prev;
185
- });
186
- },
234
+ onClick: handlePrevious,
187
235
  kind: 'secondary',
188
- disabled: currentStep === firstIncludedStep
236
+ disabled: currentStep === firstIncludedStep,
237
+ loading: loadingPrevious
189
238
  });
190
239
  }
191
240
  buttons.push({
@@ -198,8 +247,8 @@ var useCreateComponentStepChange = function useCreateComponentStepChange(_ref) {
198
247
  });
199
248
  buttons.push({
200
249
  key: 'create-action-button-submit',
201
- label: shouldViewAll ? submitButtonText : currentStep < lastIncludedStep ? nextButtonText : submitButtonText,
202
- onClick: shouldViewAll ? handleSubmit : currentStep < lastIncludedStep ? handleNext : handleSubmit,
250
+ label: currentStep < lastIncludedStep ? nextButtonText : submitButtonText,
251
+ onClick: currentStep < lastIncludedStep ? handleNext : handleSubmit,
203
252
  disabled: isSubmitDisabled,
204
253
  kind: 'primary',
205
254
  loading: isSubmitting,
@@ -207,6 +256,6 @@ var useCreateComponentStepChange = function useCreateComponentStepChange(_ref) {
207
256
  });
208
257
  setCreateComponentActions(buttons);
209
258
  }
210
- }, [firstIncludedStep, lastIncludedStep, stepData, onNext, isSubmitDisabled, backButtonText, cancelButtonText, currentStep, onClose, nextButtonText, submitButtonText, onRequestSubmit, isSubmitting, shouldViewAll, componentBlockClass, componentName, continueToNextStep, setCurrentStep, setCreateComponentActions, setIsSubmitting, setShouldViewAll, setModalIsOpen]);
259
+ }, [firstIncludedStep, lastIncludedStep, stepData, onNext, isSubmitDisabled, backButtonText, cancelButtonText, currentStep, onClose, nextButtonText, submitButtonText, onRequestSubmit, isSubmitting, componentBlockClass, componentName, continueToNextStep, setCurrentStep, setCreateComponentActions, setIsSubmitting, setModalIsOpen, moveToPreviousStep, onPrevious, setLoadingPrevious, loadingPrevious]);
211
260
  };
212
261
  exports.useCreateComponentStepChange = useCreateComponentStepChange;
@@ -26,11 +26,25 @@ var useResizeObserver = function useResizeObserver(ref, callback) {
26
26
  var entriesToHandle = (0, _react.useRef)(null);
27
27
  var cb = (0, _react.useRef)(callback);
28
28
  (0, _react.useEffect)(function () {
29
- // ref for callback removes it as dependency fro useLayoutEffect
29
+ // ref for callback removes it as dependency from useLayoutEffect
30
30
  // This significantly reduces repeated calls if a function is redefined on every
31
31
  // render
32
32
  cb.current = callback;
33
33
  }, [callback]);
34
+ (0, _react.useEffect)(function () {
35
+ var getInitialSize = function getInitialSize() {
36
+ if (ref.current) {
37
+ var _ref$current;
38
+ var refComputedStyle = window.getComputedStyle(ref.current);
39
+ var initialWidth = (((_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.offsetWidth) || 0) - (parseFloat((refComputedStyle === null || refComputedStyle === void 0 ? void 0 : refComputedStyle.paddingLeft) || 0), parseFloat((refComputedStyle === null || refComputedStyle === void 0 ? void 0 : refComputedStyle.paddingRight) || 0));
40
+ setWidth(initialWidth);
41
+ }
42
+ };
43
+ if (!(ref !== null && ref !== void 0 && ref.current) && width !== 0) {
44
+ return;
45
+ }
46
+ getInitialSize();
47
+ }, [width, ref]);
34
48
  (0, _react.useLayoutEffect)(function () {
35
49
  if (!(ref !== null && ref !== void 0 && ref.current)) {
36
50
  return;
@@ -8,7 +8,7 @@ exports.useRetrieveStepData = void 0;
8
8
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
9
  var _react = require("react");
10
10
  /**
11
- * Copyright IBM Corp. 2022, 2022
11
+ * Copyright IBM Corp. 2022, 2023
12
12
  *
13
13
  * This source code is licensed under the Apache-2.0 license found in the
14
14
  * LICENSE file in the root directory of this source tree.
@@ -89,7 +89,6 @@ var StoryDocsPage = function StoryDocsPage(_ref2) {
89
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
- console.log(processBlocks);
93
92
  var storyCount = (_processedBlocks$filt = processedBlocks === null || processedBlocks === void 0 ? void 0 : processedBlocks.filter(function (block) {
94
93
  return !!block.story;
95
94
  }).length) !== null && _processedBlocks$filt !== void 0 ? _processedBlocks$filt : 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.6.0",
4
+ "version": "2.7.0",
5
5
  "license": "Apache-2.0",
6
6
  "main": "lib/index.js",
7
7
  "module": "es/index.js",
@@ -70,7 +70,7 @@
70
70
  "npm-check-updates": "^16.10.15",
71
71
  "npm-run-all": "^4.1.5",
72
72
  "rimraf": "^5.0.1",
73
- "sass": "^1.63.6",
73
+ "sass": "1.63.6",
74
74
  "yargs": "^17.7.2"
75
75
  },
76
76
  "dependencies": {
@@ -85,14 +85,14 @@
85
85
  "react-window": "^1.8.9"
86
86
  },
87
87
  "peerDependencies": {
88
- "@carbon/grid": "^11.16.1",
89
- "@carbon/layout": "^11.16.1",
90
- "@carbon/motion": "^11.13.1",
91
- "@carbon/react": "^1.33.2",
92
- "@carbon/themes": "^11.21.1",
93
- "@carbon/type": "^11.20.1",
88
+ "@carbon/grid": "^11.18.0",
89
+ "@carbon/layout": "^11.18.0",
90
+ "@carbon/motion": "^11.15.0",
91
+ "@carbon/react": "^1.35.0",
92
+ "@carbon/themes": "^11.23.0",
93
+ "@carbon/type": "^11.22.0",
94
94
  "react": "^16.8.6 || ^17.0.1",
95
95
  "react-dom": "^16.8.6 || ^17.0.1"
96
96
  },
97
- "gitHead": "f1e9562497e15c834c38b7b9bcd330102523d468"
97
+ "gitHead": "0aebc8b879fd99f6bd45745dd51e90d382a24182"
98
98
  }
@@ -1,20 +1,20 @@
1
- /*
2
- * Licensed Materials - Property of IBM
3
- * 5724-Q36
4
- * (c) Copyright IBM Corp. 2020
5
- * US Government Users Restricted Rights - Use, duplication or disclosure
6
- * restricted by GSA ADP Schedule Contract with IBM Corp.
7
- */
1
+ //
2
+ // Copyright IBM Corp. 2020, 2023
3
+ //
4
+ // This source code is licensed under the Apache-2.0 license found in the
5
+ // LICENSE file in the root directory of this source tree.
6
+ //
8
7
 
9
8
  @use '../../../global/styles/project-settings';
10
9
 
11
10
  $block-class: #{project-settings.$pkg-prefix}--datagrid;
12
- .#{$block-class}__center-align-header {
11
+ .#{$block-class}__center-align-header,
12
+ .#{$block-class}__center-align-header .#{$block-class}--table-sort {
13
13
  width: 100%;
14
14
  text-align: center;
15
15
  }
16
16
 
17
- .#{$block-class}__center-align-cell-renderer.sortDisabled {
17
+ .#{$block-class}__center-align-cell-renderer {
18
18
  margin-right: auto;
19
19
  margin-left: auto;
20
20
  }