@carbon/ibm-products 1.4.0 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (142) hide show
  1. package/css/index-full-carbon.css +527 -90
  2. package/css/index-full-carbon.css.map +1 -1
  3. package/css/index-full-carbon.min.css +9 -3
  4. package/css/index-full-carbon.min.css.map +1 -0
  5. package/css/index-without-carbon-released-only.css +157 -67
  6. package/css/index-without-carbon-released-only.css.map +1 -1
  7. package/css/index-without-carbon-released-only.min.css +3 -3
  8. package/css/index-without-carbon-released-only.min.css.map +1 -0
  9. package/css/index-without-carbon.css +468 -84
  10. package/css/index-without-carbon.css.map +1 -1
  11. package/css/index-without-carbon.min.css +9 -3
  12. package/css/index-without-carbon.min.css.map +1 -0
  13. package/css/index.css +470 -86
  14. package/css/index.css.map +1 -1
  15. package/css/index.min.css +9 -3
  16. package/css/index.min.css.map +1 -0
  17. package/es/components/ActionSet/ActionSet.js +23 -11
  18. package/es/components/ActionSet/actions.js +25 -17
  19. package/es/components/AddSelect/AddSelect.js +115 -67
  20. package/es/components/AddSelect/AddSelectBreadcrumbs.js +56 -0
  21. package/es/components/AddSelect/AddSelectList.js +94 -0
  22. package/es/components/AddSelect/AddSelectSidebar.js +110 -0
  23. package/es/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +5 -2
  24. package/es/components/ButtonMenu/ButtonMenu.js +1 -1
  25. package/es/components/CancelableTextEdit/CancelableTextEdit.js +2 -2
  26. package/es/components/Card/Card.js +6 -4
  27. package/es/components/CreateFullPage/CreateFullPage.js +30 -5
  28. package/es/components/CreateFullPage/CreateFullPageStep.js +40 -32
  29. package/es/components/CreateInfluencer/CreateInfluencer.js +25 -3
  30. package/es/components/CreateTearsheet/CreateTearsheet.js +32 -6
  31. package/es/components/CreateTearsheet/CreateTearsheetStep.js +45 -38
  32. package/es/components/CreateTearsheet/preview-components/MultiStepTearsheet.js +24 -4
  33. package/es/components/CreateTearsheet/preview-components/MultiStepWithIntro.js +8 -6
  34. package/es/components/DataSpreadsheet/DataSpreadsheet.js +154 -0
  35. package/es/components/DataSpreadsheet/generateData.js +47 -0
  36. package/es/components/DataSpreadsheet/index.js +7 -0
  37. package/es/components/EmptyStates/EmptyState.js +1 -1
  38. package/es/components/EmptyStates/EmptyStateContent.js +2 -2
  39. package/es/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +1 -1
  40. package/es/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +1 -1
  41. package/es/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +1 -1
  42. package/es/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +1 -1
  43. package/es/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +1 -1
  44. package/es/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +1 -1
  45. package/es/components/ExportModal/ExportModal.js +39 -12
  46. package/es/components/InlineEdit/InlineEdit.js +250 -80
  47. package/es/components/NotificationsPanel/NotificationsPanel.js +16 -3
  48. package/es/components/PageHeader/PageHeader.js +9 -6
  49. package/es/components/PageHeader/PageHeaderTitle.js +10 -6
  50. package/es/components/SidePanel/SidePanel.js +33 -16
  51. package/es/components/Tearsheet/Tearsheet.js +1 -1
  52. package/es/components/Tearsheet/TearsheetNarrow.js +1 -1
  53. package/es/components/Tearsheet/TearsheetShell.js +4 -5
  54. package/es/components/WebTerminal/WebTerminal.js +1 -1
  55. package/es/components/index.js +2 -1
  56. package/es/global/js/hooks/index.js +1 -0
  57. package/es/global/js/hooks/useCreateComponentStepChange.js +31 -11
  58. package/es/global/js/hooks/useResetCreateComponent.js +7 -4
  59. package/es/global/js/hooks/useRetrieveStepData.js +51 -0
  60. package/es/global/js/package-settings.js +2 -1
  61. package/es/global/js/utils/getScrollbarWidth.js +14 -0
  62. package/es/global/js/utils/lastIndexInArray.js +26 -0
  63. package/es/settings.js +0 -5
  64. package/lib/components/ActionSet/ActionSet.js +23 -11
  65. package/lib/components/ActionSet/actions.js +25 -17
  66. package/lib/components/AddSelect/AddSelect.js +119 -67
  67. package/lib/components/AddSelect/AddSelectBreadcrumbs.js +71 -0
  68. package/lib/components/AddSelect/AddSelectList.js +112 -0
  69. package/lib/components/AddSelect/AddSelectSidebar.js +122 -0
  70. package/lib/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +5 -2
  71. package/lib/components/ButtonMenu/ButtonMenu.js +1 -1
  72. package/lib/components/CancelableTextEdit/CancelableTextEdit.js +1 -1
  73. package/lib/components/Card/Card.js +6 -4
  74. package/lib/components/CreateFullPage/CreateFullPage.js +29 -4
  75. package/lib/components/CreateFullPage/CreateFullPageStep.js +38 -30
  76. package/lib/components/CreateInfluencer/CreateInfluencer.js +25 -3
  77. package/lib/components/CreateTearsheet/CreateTearsheet.js +31 -5
  78. package/lib/components/CreateTearsheet/CreateTearsheetStep.js +43 -36
  79. package/lib/components/CreateTearsheet/preview-components/MultiStepTearsheet.js +22 -2
  80. package/lib/components/CreateTearsheet/preview-components/MultiStepWithIntro.js +8 -6
  81. package/lib/components/DataSpreadsheet/DataSpreadsheet.js +171 -0
  82. package/lib/components/DataSpreadsheet/generateData.js +58 -0
  83. package/lib/components/DataSpreadsheet/index.js +13 -0
  84. package/lib/components/EmptyStates/EmptyState.js +1 -1
  85. package/lib/components/EmptyStates/EmptyStateContent.js +2 -2
  86. package/lib/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +1 -1
  87. package/lib/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +1 -1
  88. package/lib/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +1 -1
  89. package/lib/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +1 -1
  90. package/lib/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +1 -1
  91. package/lib/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +1 -1
  92. package/lib/components/ExportModal/ExportModal.js +36 -11
  93. package/lib/components/InlineEdit/InlineEdit.js +247 -79
  94. package/lib/components/NotificationsPanel/NotificationsPanel.js +13 -1
  95. package/lib/components/PageHeader/PageHeader.js +9 -6
  96. package/lib/components/PageHeader/PageHeaderTitle.js +10 -6
  97. package/lib/components/SidePanel/SidePanel.js +33 -16
  98. package/lib/components/Tearsheet/Tearsheet.js +1 -1
  99. package/lib/components/Tearsheet/TearsheetNarrow.js +1 -1
  100. package/lib/components/Tearsheet/TearsheetShell.js +3 -4
  101. package/lib/components/WebTerminal/WebTerminal.js +1 -1
  102. package/lib/components/index.js +9 -1
  103. package/lib/global/js/hooks/index.js +8 -0
  104. package/lib/global/js/hooks/useCreateComponentStepChange.js +31 -11
  105. package/lib/global/js/hooks/useResetCreateComponent.js +7 -4
  106. package/lib/global/js/hooks/useRetrieveStepData.js +62 -0
  107. package/lib/global/js/package-settings.js +2 -1
  108. package/lib/global/js/utils/getScrollbarWidth.js +23 -0
  109. package/lib/global/js/utils/lastIndexInArray.js +35 -0
  110. package/lib/settings.js +0 -6
  111. package/package.json +27 -25
  112. package/scss/components/AddSelect/_add-select.scss +59 -5
  113. package/scss/components/BreadcrumbWithOverflow/_index.scss +1 -1
  114. package/scss/components/CancelableTextEdit/_cancelable-text-edit.scss +1 -0
  115. package/scss/components/CancelableTextEdit/_storybook-styles.scss +0 -7
  116. package/scss/components/CreateInfluencer/_create-influencer.scss +4 -4
  117. package/scss/components/CreateTearsheet/_create-tearsheet.scss +2 -2
  118. package/scss/components/CreateTearsheetNarrow/_storybook-styles.scss +0 -6
  119. package/scss/components/DataSpreadsheet/_data-spreadsheet.scss +79 -0
  120. package/scss/components/DataSpreadsheet/_index.scss +8 -0
  121. package/scss/components/DataSpreadsheet/_storybook-styles.scss +6 -0
  122. package/scss/components/EditSidePanel/_storybook-styles.scss +0 -8
  123. package/scss/components/InlineEdit/_inline-edit.scss +288 -10
  124. package/scss/components/InlineEdit/_storybook-styles.scss +12 -6
  125. package/scss/components/LoadingBar/_storybook-styles.scss +0 -5
  126. package/scss/components/NotificationsPanel/_notifications-panel.scss +2 -2
  127. package/scss/components/OptionsTile/_storybook-styles.scss +0 -7
  128. package/scss/components/PageHeader/_index.scss +1 -1
  129. package/scss/components/PageHeader/_page-header.scss +4 -1
  130. package/scss/components/ProductiveCard/_productive-card.scss +0 -4
  131. package/scss/components/SidePanel/_side-panel.scss +15 -6
  132. package/scss/components/StatusIcon/_index.scss +1 -1
  133. package/scss/components/StatusIcon/_status-icon.scss +6 -4
  134. package/scss/components/TagSet/_index.scss +1 -1
  135. package/scss/components/UserProfileImage/_index.scss +1 -1
  136. package/scss/components/UserProfileImage/_user-profile-image.scss +2 -2
  137. package/scss/components/WebTerminal/_web-terminal.scss +2 -2
  138. package/scss/components/_index.scss +1 -0
  139. package/scss/global/styles/_project-settings.scss +5 -1
  140. package/es/generated/feature-flags/feature-flags.js +0 -15
  141. package/lib/generated/feature-flags/feature-flags.js +0 -22
  142. package/scss/generated/feature-flags/_feature-flags.scss +0 -19
@@ -113,8 +113,12 @@ var SidePanel = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
113
113
  var sidePanelInnerRef = (0, _react.useRef)();
114
114
  var sidePanelCloseRef = (0, _react.useRef)();
115
115
  var previousState = (0, _hooks.usePreviousValue)({
116
- size: size
117
- }); // scroll panel to top going between steps
116
+ size: size,
117
+ open: open
118
+ });
119
+ var reducedMotion = window && window.matchMedia ? window.matchMedia('(prefers-reduced-motion: reduce)') : {
120
+ matches: true
121
+ }; // scroll panel to top going between steps
118
122
 
119
123
  (0, _react.useEffect)(function () {
120
124
  var panelRef = ref || sidePanelRef;
@@ -193,7 +197,7 @@ var SidePanel = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
193
197
 
194
198
 
195
199
  (0, _react.useEffect)(function () {
196
- if (open && animateTitle && animationComplete && title && title.length) {
200
+ if (open && animateTitle && animationComplete && title && title.length && !reducedMotion.matches) {
197
201
  var _document$querySelect2, _document$querySelect3, _document$querySelect4;
198
202
 
199
203
  var sidePanelOuter = document.querySelector("#".concat(blockClass, "-outer"));
@@ -285,7 +289,7 @@ var SidePanel = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
285
289
  _sidePanelOuter === null || _sidePanelOuter === void 0 ? void 0 : _sidePanelOuter.style.setProperty("--".concat(blockClass, "--subtitle-container-height"), "".concat(_sidePanelSubtitleElementHeight, "px"));
286
290
  _sidePanelOuter === null || _sidePanelOuter === void 0 ? void 0 : _sidePanelOuter.style.setProperty("--".concat(blockClass, "--action-bar-container-height"), "".concat(sidePanelActionBarElementHeight, "px"));
287
291
  }
288
- }, [open, animateTitle, animationComplete, shouldRender, panelHeight, title, size]); // click outside functionality if `includeOverlay` prop is set
292
+ }, [open, animateTitle, animationComplete, shouldRender, panelHeight, title, size, reducedMotion.matches]); // click outside functionality if `includeOverlay` prop is set
289
293
 
290
294
  (0, _react.useEffect)(function () {
291
295
  var handleOutsideClick = function handleOutsideClick(event) {
@@ -311,7 +315,7 @@ var SidePanel = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
311
315
  return function () {
312
316
  document.removeEventListener('click', handleOutsideClick);
313
317
  };
314
- }, [includeOverlay, onRequestClose, open, preventCloseOnClickOutside, ref]); // initialize the side panel to open
318
+ }, [includeOverlay, onRequestClose, open, preventCloseOnClickOutside, ref, onUnmount]); // initialize the side panel to open
315
319
 
316
320
  (0, _react.useEffect)(function () {
317
321
  if (open) {
@@ -321,14 +325,21 @@ var SidePanel = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
321
325
 
322
326
  var onAnimationEnd = function onAnimationEnd() {
323
327
  if (!open) {
324
- onUnmount && onUnmount();
328
+ onUnmount === null || onUnmount === void 0 ? void 0 : onUnmount();
325
329
  setRender(false);
326
330
  }
327
331
 
328
332
  setAnimationComplete(true);
329
- }; // initializes the side panel to open
333
+ }; // Set the internal state `animationComplete` to true if
334
+ // prefers reduced motion is true
330
335
 
331
336
 
337
+ (0, _react.useEffect)(function () {
338
+ if (reducedMotion.matches) {
339
+ setAnimationComplete(true);
340
+ }
341
+ }, [reducedMotion.matches]); // initializes the side panel to open
342
+
332
343
  var _onAnimationStart = function onAnimationStart(event) {
333
344
  event.persist();
334
345
  var isPanelTarget = event.target.id === "".concat(blockClass, "-outer");
@@ -349,7 +360,13 @@ var SidePanel = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
349
360
  pageContentElement.style.marginLeft = 0;
350
361
  }
351
362
  }
352
- }, [open, placement, selectorPageContent, slideIn]); // used to set margins of content for slide in panel version
363
+ }, [open, placement, selectorPageContent, slideIn]);
364
+ (0, _react.useEffect)(function () {
365
+ if (!open && previousState !== null && previousState !== void 0 && previousState.open && reducedMotion.matches) {
366
+ setRender(false);
367
+ onUnmount === null || onUnmount === void 0 ? void 0 : onUnmount();
368
+ }
369
+ }, [open, onUnmount, reducedMotion.matches, previousState === null || previousState === void 0 ? void 0 : previousState.open]); // used to set margins of content for slide in panel version
353
370
 
354
371
  (0, _react.useEffect)(function () {
355
372
  if (shouldRender && slideIn) {
@@ -357,15 +374,15 @@ var SidePanel = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
357
374
 
358
375
  if (placement && placement === 'right' && pageContentElement) {
359
376
  pageContentElement.style.marginRight = 0;
360
- pageContentElement.style.transition = "margin-right ".concat(_motion.moderate02);
377
+ pageContentElement.style.transition = !reducedMotion.matches ? "margin-right ".concat(_motion.moderate02) : null;
361
378
  pageContentElement.style.marginRight = _constants.SIDE_PANEL_SIZES[size];
362
379
  } else if (pageContentElement) {
363
380
  pageContentElement.style.marginLeft = 0;
364
- pageContentElement.style.transition = "margin-left ".concat(_motion.moderate02);
381
+ pageContentElement.style.transition = !reducedMotion.matches ? "margin-left ".concat(_motion.moderate02) : null;
365
382
  pageContentElement.style.marginLeft = _constants.SIDE_PANEL_SIZES[size];
366
383
  }
367
384
  }
368
- }, [slideIn, selectorPageContent, placement, shouldRender, size]); // adds focus trap functionality
385
+ }, [slideIn, selectorPageContent, placement, shouldRender, size, reducedMotion.matches]); // adds focus trap functionality
369
386
 
370
387
  /* istanbul ignore next */
371
388
 
@@ -392,7 +409,7 @@ var SidePanel = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
392
409
  var _cx, _cx2;
393
410
 
394
411
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
395
- className: (0, _classnames.default)("".concat(blockClass, "__title-container"), (_cx = {}, (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__on-detail-step"), currentStep > 0), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__on-detail-step-without-title"), currentStep > 0 && !title), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__title-container--no-title-animation"), !animateTitle), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__title-container-is-animating"), !animationComplete || !open), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__title-container-without-title"), !title), _cx))
412
+ className: (0, _classnames.default)("".concat(blockClass, "__title-container"), (_cx = {}, (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__on-detail-step"), currentStep > 0), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__on-detail-step-without-title"), currentStep > 0 && !title), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__title-container--no-title-animation"), !animateTitle), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__title-container-is-animating"), !animationComplete || !open), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__title-container-without-title"), !title), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__title-container--reduced-motion"), reducedMotion.matches), _cx))
396
413
  }, currentStep > 0 && /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, {
397
414
  "aria-label": navigationBackIconDescription,
398
415
  kind: "ghost",
@@ -449,7 +466,7 @@ var SidePanel = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
449
466
  className: "".concat(blockClass, "__title-text"),
450
467
  title: title,
451
468
  "aria-hidden": false
452
- }, title), animateTitle && title && title.length && /*#__PURE__*/_react.default.createElement("h2", {
469
+ }, title), animateTitle && title && title.length && !reducedMotion.matches && /*#__PURE__*/_react.default.createElement("h2", {
453
470
  className: "".concat(blockClass, "__collapsed-title-text"),
454
471
  title: title,
455
472
  "aria-hidden": true
@@ -466,7 +483,7 @@ var SidePanel = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
466
483
  id: "".concat(blockClass, "-outer"),
467
484
  className: mainPanelClassNames,
468
485
  style: {
469
- animation: "".concat(open ? placement === 'right' ? "sidePanelEntranceRight ".concat(_motion.moderate02) : "sidePanelEntranceLeft ".concat(_motion.moderate02) : placement === 'right' ? "sidePanelExitRight ".concat(_motion.moderate02) : "sidePanelExitLeft ".concat(_motion.moderate02))
486
+ animation: !reducedMotion.matches ? "".concat(open ? placement === 'right' ? "side-panel-entrance-right ".concat(_motion.moderate02) : "side-panel-entrance-left ".concat(_motion.moderate02) : placement === 'right' ? "side-panel-exit-right ".concat(_motion.moderate02) : "side-panel-exit-left ".concat(_motion.moderate02)) : null
470
487
  },
471
488
  onAnimationEnd: onAnimationEnd,
472
489
  onAnimationStart: function onAnimationStart(event) {
@@ -499,7 +516,7 @@ var SidePanel = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
499
516
  ref: sidePanelOverlayRef,
500
517
  className: "".concat(blockClass, "__overlay"),
501
518
  style: {
502
- animation: "".concat(open ? "sidePanelOverlayEntrance ".concat(_motion.moderate02) : "sidePanelOverlayExit ".concat(_motion.moderate02))
519
+ animation: !reducedMotion.matches ? "".concat(open ? "side-panel-overlay-entrance ".concat(_motion.moderate02) : "side-panel-overlay-exit ".concat(_motion.moderate02)) : null
503
520
  }
504
521
  }));
505
522
  }); // Return a placeholder if not released and not enabled by feature flag
@@ -533,7 +550,7 @@ SidePanel.propTypes = {
533
550
  * See https://react.carbondesignsystem.com/?path=/docs/components-button--default#component-api
534
551
  */
535
552
  actions: (0, _propsHelper.allPropTypes)([_ActionSet.ActionSet.validateActions(), _propTypes.default.arrayOf(_propTypes.default.shape(_objectSpread(_objectSpread({}, _carbonComponentsReact.Button.propTypes), {}, {
536
- kind: _propTypes.default.oneOf(['ghost', 'secondary', 'primary']),
553
+ kind: _propTypes.default.oneOf(['ghost', 'danger--ghost', 'secondary', 'danger', 'primary']),
537
554
  label: _propTypes.default.string,
538
555
  loading: _propTypes.default.bool,
539
556
  // we duplicate this Button prop to improve the DocGen here
@@ -94,7 +94,7 @@ Tearsheet.propTypes = _objectSpread({
94
94
  actions: (0, _propsHelper.allPropTypes)([_ActionSet.ActionSet.validateActions(function () {
95
95
  return 'max';
96
96
  }), _propTypes.default.arrayOf(_propTypes.default.shape(_objectSpread(_objectSpread({}, _carbonComponentsReact.Button.propTypes), {}, {
97
- kind: _propTypes.default.oneOf(['ghost', 'secondary', 'primary']),
97
+ kind: _propTypes.default.oneOf(['ghost', 'danger--ghost', 'secondary', 'danger', 'primary']),
98
98
  label: _propTypes.default.string,
99
99
  loading: _propTypes.default.bool,
100
100
  // we duplicate this Button prop to improve the DocGen here
@@ -90,7 +90,7 @@ TearsheetNarrow.propTypes = _objectSpread({
90
90
  actions: (0, _propsHelper.allPropTypes)([_ActionSet.ActionSet.validateActions(function () {
91
91
  return 'lg';
92
92
  }), _propTypes.default.arrayOf(_propTypes.default.shape(_objectSpread(_objectSpread({}, _carbonComponentsReact.Button.propTypes), {}, {
93
- kind: _propTypes.default.oneOf(['ghost', 'secondary', 'primary']),
93
+ kind: _propTypes.default.oneOf(['ghost', 'danger--ghost', 'secondary', 'danger', 'primary']),
94
94
  label: _propTypes.default.string,
95
95
  loading: _propTypes.default.bool,
96
96
  // we duplicate this Button prop to improve the DocGen here
@@ -146,10 +146,9 @@ var TearsheetShell = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref)
146
146
  setTimeout(function () {
147
147
  return element.focus();
148
148
  }, 1);
149
- }; // Hook called whenever the tearsheet mounts, unmounts, or 'open' changes.
149
+ };
150
150
 
151
-
152
- (0, _react.useLayoutEffect)(function () {
151
+ (0, _react.useEffect)(function () {
153
152
  var notify = function notify() {
154
153
  return stack.all.forEach(function (handler) {
155
154
  handler(Math.min(stack.open.length, maxDepth), stack.open.indexOf(handler) + 1);
@@ -311,7 +310,7 @@ TearsheetShell.propTypes = _objectSpread({
311
310
  actions: _propTypes.default.arrayOf( // NB we don't include the validator here, as the component wrapping this
312
311
  // one should ensure appropriate validation is done.
313
312
  _propTypes.default.shape(_objectSpread(_objectSpread({}, _carbonComponentsReact.Button.propTypes), {}, {
314
- kind: _propTypes.default.oneOf(['ghost', 'secondary', 'primary']),
313
+ kind: _propTypes.default.oneOf(['ghost', 'danger--ghost', 'secondary', 'danger', 'primary']),
315
314
  label: _propTypes.default.string,
316
315
  loading: _propTypes.default.bool,
317
316
  // we duplicate this Button prop to improve the DocGen here
@@ -80,7 +80,7 @@ var WebTerminal = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
80
80
  ref: ref,
81
81
  className: (0, _classnames.default)([blockClass, (_ref2 = {}, (0, _defineProperty2.default)(_ref2, "".concat(blockClass, "--open"), open), (0, _defineProperty2.default)(_ref2, "".concat(blockClass, "--closed"), !open), (0, _defineProperty2.default)(_ref2, className, className), _ref2)]),
82
82
  style: {
83
- animation: "".concat(open ? 'webTerminalEntrance 250ms' : 'webTerminalExit 250ms')
83
+ animation: "".concat(open ? 'web-terminal-entrance 250ms' : 'web-terminal-exit 250ms')
84
84
  },
85
85
  onAnimationEnd: onAnimationEnd
86
86
  }), /*#__PURE__*/_react.default.createElement("header", {
@@ -87,6 +87,12 @@ Object.defineProperty(exports, "CreateTearsheetStep", {
87
87
  return _CreateTearsheet.CreateTearsheetStep;
88
88
  }
89
89
  });
90
+ Object.defineProperty(exports, "DataSpreadsheet", {
91
+ enumerable: true,
92
+ get: function get() {
93
+ return _DataSpreadsheet.DataSpreadsheet;
94
+ }
95
+ });
90
96
  Object.defineProperty(exports, "EditSidePanel", {
91
97
  enumerable: true,
92
98
  get: function get() {
@@ -364,4 +370,6 @@ var _OptionsTile = require("./OptionsTile");
364
370
 
365
371
  var _CancelableTextEdit = require("./CancelableTextEdit");
366
372
 
367
- var _InlineEdit = require("./InlineEdit");
373
+ var _InlineEdit = require("./InlineEdit");
374
+
375
+ var _DataSpreadsheet = require("./DataSpreadsheet");
@@ -39,6 +39,12 @@ Object.defineProperty(exports, "useResetCreateComponent", {
39
39
  return _useResetCreateComponent.useResetCreateComponent;
40
40
  }
41
41
  });
42
+ Object.defineProperty(exports, "useRetrieveStepData", {
43
+ enumerable: true,
44
+ get: function get() {
45
+ return _useRetrieveStepData.useRetrieveStepData;
46
+ }
47
+ });
42
48
  Object.defineProperty(exports, "useValidCreateStepCount", {
43
49
  enumerable: true,
44
50
  get: function get() {
@@ -72,4 +78,6 @@ var _usePreviousValue = require("./usePreviousValue");
72
78
 
73
79
  var _useResetCreateComponent = require("./useResetCreateComponent");
74
80
 
81
+ var _useRetrieveStepData = require("./useRetrieveStepData");
82
+
75
83
  var _useValidCreateStepCount = require("./useValidCreateStepCount");
@@ -14,13 +14,15 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
14
14
  var _react = require("react");
15
15
 
16
16
  /**
17
- * Copyright IBM Corp. 2021, 2021
17
+ * Copyright IBM Corp. 2021, 2022
18
18
  *
19
19
  * This source code is licensed under the Apache-2.0 license found in the
20
20
  * LICENSE file in the root directory of this source tree.
21
21
  */
22
22
  var useCreateComponentStepChange = function useCreateComponentStepChange(_ref) {
23
- var totalStepCount = _ref.totalStepCount,
23
+ var firstIncludedStep = _ref.firstIncludedStep,
24
+ lastIncludedStep = _ref.lastIncludedStep,
25
+ stepData = _ref.stepData,
24
26
  onNext = _ref.onNext,
25
27
  isSubmitDisabled = _ref.isSubmitDisabled,
26
28
  setCurrentStep = _ref.setCurrentStep,
@@ -185,20 +187,29 @@ var useCreateComponentStepChange = function useCreateComponentStepChange(_ref) {
185
187
  };
186
188
  }();
187
189
 
188
- if (totalStepCount > 0) {
190
+ if ((stepData === null || stepData === void 0 ? void 0 : stepData.length) > 0) {
189
191
  var buttons = [];
190
192
 
191
- if (totalStepCount > 1 && !shouldViewAll) {
193
+ if ((stepData === null || stepData === void 0 ? void 0 : stepData.length) > 1 && !shouldViewAll) {
192
194
  buttons.push({
193
195
  key: 'create-action-button-back',
194
196
  label: backButtonText,
195
197
  onClick: function onClick() {
196
198
  return setCurrentStep(function (prev) {
197
- return prev - 1;
199
+ // Find previous included step to render
200
+ // There will always be a previous step otherwise we will
201
+ // have disabled the back button since we have reached the first visible step
202
+ do {
203
+ var _stepData;
204
+
205
+ prev--;
206
+ } while (!((_stepData = stepData[prev - 1]) !== null && _stepData !== void 0 && _stepData.shouldIncludeStep));
207
+
208
+ return prev;
198
209
  });
199
210
  },
200
211
  kind: 'secondary',
201
- disabled: currentStep === 1
212
+ disabled: currentStep === firstIncludedStep
202
213
  });
203
214
  }
204
215
 
@@ -212,8 +223,8 @@ var useCreateComponentStepChange = function useCreateComponentStepChange(_ref) {
212
223
  });
213
224
  buttons.push({
214
225
  key: 'create-action-button-submit',
215
- label: shouldViewAll ? submitButtonText : currentStep < totalStepCount ? nextButtonText : submitButtonText,
216
- onClick: shouldViewAll ? handleSubmit : currentStep < totalStepCount ? handleNext : handleSubmit,
226
+ label: shouldViewAll ? submitButtonText : currentStep < lastIncludedStep ? nextButtonText : submitButtonText,
227
+ onClick: shouldViewAll ? handleSubmit : currentStep < lastIncludedStep ? handleNext : handleSubmit,
217
228
  disabled: isSubmitDisabled,
218
229
  kind: 'primary',
219
230
  loading: isSubmitting,
@@ -221,13 +232,22 @@ var useCreateComponentStepChange = function useCreateComponentStepChange(_ref) {
221
232
  });
222
233
  setCreateComponentActions(buttons);
223
234
  }
224
- }, [totalStepCount, onNext, isSubmitDisabled, backButtonText, cancelButtonText, currentStep, onClose, nextButtonText, submitButtonText, onRequestSubmit, isSubmitting, shouldViewAll, componentBlockClass, componentName, continueToNextStep, setCurrentStep, setCreateComponentActions, setIsSubmitting, setShouldViewAll, setModalIsOpen]);
235
+ }, [firstIncludedStep, lastIncludedStep, stepData, onNext, isSubmitDisabled, backButtonText, cancelButtonText, currentStep, onClose, nextButtonText, submitButtonText, onRequestSubmit, isSubmitting, shouldViewAll, componentBlockClass, componentName, continueToNextStep, setCurrentStep, setCreateComponentActions, setIsSubmitting, setShouldViewAll, setModalIsOpen]);
225
236
  var continueToNextStep = (0, _react.useCallback)(function () {
226
237
  setIsSubmitting(false);
227
238
  setCurrentStep(function (prev) {
228
- return prev + 1;
239
+ // Find next included step to render
240
+ // There will always be a next step otherwise we will
241
+ // have reach the onSubmit
242
+ do {
243
+ var _stepData2;
244
+
245
+ prev++;
246
+ } while (!((_stepData2 = stepData[prev - 1]) !== null && _stepData2 !== void 0 && _stepData2.shouldIncludeStep));
247
+
248
+ return prev;
229
249
  });
230
- }, [setCurrentStep, setIsSubmitting]);
250
+ }, [setCurrentStep, setIsSubmitting, stepData]);
231
251
  };
232
252
 
233
253
  exports.useCreateComponentStepChange = useCreateComponentStepChange;
@@ -8,7 +8,7 @@ exports.useResetCreateComponent = void 0;
8
8
  var _react = require("react");
9
9
 
10
10
  /**
11
- * Copyright IBM Corp. 2021, 2021
11
+ * Copyright IBM Corp. 2021, 2022
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.
@@ -17,6 +17,7 @@ var _react = require("react");
17
17
  /**
18
18
  * Resets the current step of the create component if it has been closed.
19
19
  * @param {object} useResetCreateComponent - Create component that uses this custom hook
20
+ * @param {object} useResetCreateComponent.firstIncludedStep
20
21
  * @param {object} useResetCreateComponent.previousState
21
22
  * @param {boolean} useResetCreateComponent.open
22
23
  * @param {Function} useResetCreateComponent.setCurrentStep
@@ -25,7 +26,8 @@ var _react = require("react");
25
26
  * @param {string} useResetCreateComponent.componentName
26
27
  */
27
28
  var useResetCreateComponent = function useResetCreateComponent(_ref) {
28
- var previousState = _ref.previousState,
29
+ var firstIncludedStep = _ref.firstIncludedStep,
30
+ previousState = _ref.previousState,
29
31
  open = _ref.open,
30
32
  setCurrentStep = _ref.setCurrentStep,
31
33
  initialStep = _ref.initialStep,
@@ -36,7 +38,8 @@ var useResetCreateComponent = function useResetCreateComponent(_ref) {
36
38
  if (initialStep && totalSteps && Number(initialStep) <= Number(totalSteps) && Number(initialStep) > 0) {
37
39
  setCurrentStep(Number(initialStep));
38
40
  } else {
39
- setCurrentStep(1);
41
+ // default should be fist includedStep instead of just 1
42
+ setCurrentStep(firstIncludedStep);
40
43
  } // An invalid initialStep value was provided, we'll default to rendering the first step in this scenario
41
44
 
42
45
 
@@ -44,7 +47,7 @@ var useResetCreateComponent = function useResetCreateComponent(_ref) {
44
47
  console.warn("".concat(componentName, ": An invalid `initialStep` prop was supplied. The `initialStep` prop should be a number that is greater than 0 or less than or equal to the number of steps your ").concat(componentName, " has."));
45
48
  }
46
49
  }
47
- }, [open, previousState, setCurrentStep, initialStep, totalSteps, componentName]);
50
+ }, [firstIncludedStep, open, previousState, setCurrentStep, initialStep, totalSteps, componentName]);
48
51
  };
49
52
 
50
53
  exports.useResetCreateComponent = useResetCreateComponent;
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.useRetrieveStepData = void 0;
9
+
10
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
11
+
12
+ var _react = require("react");
13
+
14
+ /**
15
+ * Copyright IBM Corp. 2022, 2022
16
+ *
17
+ * This source code is licensed under the Apache-2.0 license found in the
18
+ * LICENSE file in the root directory of this source tree.
19
+ */
20
+
21
+ /**
22
+ * This useEffect makes sure that every CreateTearsheetStep/CreateFullPageStep reports back it's
23
+ * title, secondaryLabel, introStep, and shouldIncludeStep data so that it can be sent to the CreateInfluencer.
24
+ * @param {object} useResetCreateComponent
25
+ * @param {object} useResetCreateComponent.stepsContext
26
+ * @param {number} useResetCreateComponent.stepNumber
27
+ * @param {boolean} useResetCreateComponent.introStep
28
+ * @param {boolean} useResetCreateComponent.shouldIncludeStep
29
+ * @param {string} useResetCreateComponent.secondaryLabel
30
+ * @param {string} useResetCreateComponent.title
31
+ */
32
+ var useRetrieveStepData = function useRetrieveStepData(_ref) {
33
+ var stepsContext = _ref.stepsContext,
34
+ stepNumber = _ref.stepNumber,
35
+ introStep = _ref.introStep,
36
+ shouldIncludeStep = _ref.shouldIncludeStep,
37
+ secondaryLabel = _ref.secondaryLabel,
38
+ title = _ref.title;
39
+ (0, _react.useEffect)(function () {
40
+ if (stepsContext) {
41
+ stepsContext.setStepData(function (prev) {
42
+ var stepItem = {
43
+ title: title,
44
+ secondaryLabel: secondaryLabel,
45
+ introStep: introStep,
46
+ shouldIncludeStep: shouldIncludeStep
47
+ };
48
+ var previousItem = prev[stepNumber - 1];
49
+
50
+ if ((previousItem === null || previousItem === void 0 ? void 0 : previousItem.title) !== stepItem.title || (previousItem === null || previousItem === void 0 ? void 0 : previousItem.secondaryLabel) !== stepItem.secondaryLabel || (previousItem === null || previousItem === void 0 ? void 0 : previousItem.introStep) !== stepItem.introStep || (previousItem === null || previousItem === void 0 ? void 0 : previousItem.shouldIncludeStep) !== stepItem.shouldIncludeStep) {
51
+ var clone = (0, _toConsumableArray2.default)(prev);
52
+ clone[stepNumber - 1] = stepItem;
53
+ return clone;
54
+ }
55
+
56
+ return prev;
57
+ });
58
+ }
59
+ }, [shouldIncludeStep, title, secondaryLabel, introStep, stepsContext, stepNumber]);
60
+ };
61
+
62
+ exports.useRetrieveStepData = useRetrieveStepData;
@@ -67,7 +67,8 @@ var defaults = {
67
67
  EditSidePanel: false,
68
68
  OptionsTile: false,
69
69
  CancelableTextEdit: false,
70
- InlineEdit: false
70
+ InlineEdit: false,
71
+ DataSpreadsheet: false
71
72
  /* new component flags here - comment used by generate CLI */
72
73
 
73
74
  },
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getScrollbarWidth = void 0;
7
+
8
+ /**
9
+ * Copyright IBM Corp. 2022, 2022
10
+ *
11
+ * This source code is licensed under the Apache-2.0 license found in the
12
+ * LICENSE file in the root directory of this source tree.
13
+ */
14
+ var getScrollbarWidth = function getScrollbarWidth() {
15
+ var scrollDiv = document.createElement('div');
16
+ scrollDiv.setAttribute('style', 'width: 100px; height: 100px; overflow: scroll; position:absolute; top:-9999px;');
17
+ document.body.appendChild(scrollDiv);
18
+ var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth;
19
+ document.body.removeChild(scrollDiv);
20
+ return scrollbarWidth;
21
+ };
22
+
23
+ exports.getScrollbarWidth = getScrollbarWidth;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.lastIndexInArray = void 0;
7
+
8
+ /**
9
+ * Copyright IBM Corp. 2022, 2022
10
+ *
11
+ * This source code is licensed under the Apache-2.0 license found in the
12
+ * LICENSE file in the root directory of this source tree.
13
+ */
14
+
15
+ /**
16
+ * This utility will return the index of the last instance of an
17
+ * item in the given array of objects whose key is equal to the value
18
+ * parameter. If there are no matches, -1 is returned as similar to findIndex
19
+ * @param {Array<Object.*>} array
20
+ * @param {string} key
21
+ * @param {string|boolean|number} value
22
+ */
23
+ var lastIndexInArray = function lastIndexInArray(array, key, value) {
24
+ for (var i = array.length - 1; i >= 0; i--) {
25
+ var _array$i;
26
+
27
+ if (((_array$i = array[i]) === null || _array$i === void 0 ? void 0 : _array$i[key]) === value) {
28
+ return i + 1;
29
+ }
30
+ }
31
+
32
+ return -1;
33
+ };
34
+
35
+ exports.lastIndexInArray = lastIndexInArray;
package/lib/settings.js CHANGED
@@ -9,8 +9,6 @@ exports.pkg = exports.carbon = void 0;
9
9
 
10
10
  var _Canary = require("./components/_Canary");
11
11
 
12
- var _featureFlags = _interopRequireDefault(require("./generated/feature-flags/feature-flags"));
13
-
14
12
  var _packageSettings = _interopRequireDefault(require("./global/js/package-settings"));
15
13
 
16
14
  var _carbonComponents = require("carbon-components");
@@ -28,10 +26,6 @@ var carbon = {
28
26
  _carbonComponents.settings.prefix = val;
29
27
  },
30
28
 
31
- get flags() {
32
- return _featureFlags.default;
33
- },
34
-
35
29
  get themes() {
36
30
  return _themes.themes;
37
31
  }
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": "1.4.0",
4
+ "version": "1.7.0",
5
5
  "license": "Apache-2.0",
6
6
  "main": "lib/index.js",
7
7
  "module": "es/index.js",
@@ -33,58 +33,60 @@
33
33
  "access": "public"
34
34
  },
35
35
  "scripts": {
36
- "build": "run-s clean build-all",
36
+ "build": "run-s clean build-first build-all",
37
37
  "build-all": "run-p build:*",
38
- "build:css-dev": "sass --style=expanded --load-path node_modules --load-path ../../node_modules src:css",
39
- "build:css-min": "sass --style=compressed --no-source-map --load-path node_modules --load-path ../../node_modules src/index.scss:css/index.min.css src/index-full-carbon.scss:css/index-full-carbon.min.css src/index-without-carbon.scss:css/index-without-carbon.min.css src/index-without-carbon-released-only.scss:css/index-without-carbon-released-only.min.css",
38
+ "build-first": "copyfiles 'src/**/*.scss' scss -u 1",
39
+ "build:css-dev": "sass --style=expanded --load-path node_modules --load-path ../../node_modules scss:css",
40
+ "build:css-min": "sass --style=compressed --load-path node_modules --load-path ../../node_modules scss/index.scss:css/index.min.css scss/index-full-carbon.scss:css/index-full-carbon.min.css scss/index-without-carbon.scss:css/index-without-carbon.min.css scss/index-without-carbon-released-only.scss:css/index-without-carbon-released-only.min.css",
40
41
  "build:js-esm": "cross-env BABEL_ENV=esm yarn build:js:modules -d es",
41
42
  "build:js-cjs": "cross-env BABEL_ENV=cjs yarn build:js:modules -d lib",
42
43
  "build:js:modules": "babel src --ignore '**/__tests__','**/*.test.js','**/*.stories.js','src/utils/**/*'",
43
- "build:scss": "copyfiles 'src/**/*.scss' scss -u 1",
44
44
  "ci-check": "node scripts/import",
45
45
  "clean": "rimraf es lib css scss",
46
46
  "generate": "cross-env FORCE_COLOR=1 node scripts/generate",
47
47
  "postinstall": "carbon-telemetry collect --install",
48
48
  "test": "jest --colors",
49
- "//upgrade-dependencies": "# don't upgrade carbon (done globally), react/react-dom (explicit range peer dependency) or chalk (until we can load it as ESM)",
50
- "upgrade-dependencies": "npm-check-updates -u --color --reject '/(carbon|^react$|^react-dom$|^chalk$)/'"
49
+ "//upgrade-dependencies": "# don't upgrade carbon (done globally), react/react-dom (explicit range peer dependency), chalk (issue #1596)",
50
+ "upgrade-dependencies": "npm-check-updates -u --dep dev,peer,prod --color --reject '/(carbon|^react$|^react-dom$|^chalk$)/'"
51
51
  },
52
52
  "devDependencies": {
53
- "@babel/cli": "^7.16.8",
54
- "@babel/core": "^7.16.10",
55
- "babel-preset-ibm-cloud-cognitive": "^0.14.4",
53
+ "@babel/cli": "^7.17.0",
54
+ "@babel/core": "^7.17.2",
55
+ "babel-preset-ibm-cloud-cognitive": "^0.14.7",
56
56
  "chalk": "^4.1.2",
57
57
  "change-case": "^4.1.2",
58
58
  "copyfiles": "^2.4.1",
59
59
  "cross-env": "^7.0.3",
60
60
  "fs-extra": "^10.0.0",
61
61
  "glob": "^7.2.0",
62
- "jest": "^27.4.7",
63
- "jest-config-ibm-cloud-cognitive": "^0.23.5",
64
- "npm-check-updates": "^12.2.0",
62
+ "jest": "^27.5.1",
63
+ "jest-config-ibm-cloud-cognitive": "^0.23.8",
64
+ "npm-check-updates": "^12.3.0",
65
65
  "npm-run-all": "^4.1.5",
66
66
  "rimraf": "^3.0.2",
67
- "sass": "^1.49.0",
67
+ "sass": "^1.49.7",
68
68
  "yargs": "^17.3.1"
69
69
  },
70
70
  "dependencies": {
71
- "@babel/runtime": "^7.16.7",
71
+ "@babel/runtime": "^7.17.2",
72
72
  "@carbon/telemetry": "^0.0.0-alpha.6",
73
- "react-resize-detector": "^7.0.0"
73
+ "react-resize-detector": "^7.0.0",
74
+ "react-table": "^7.7.0",
75
+ "react-window": "^1.8.6"
74
76
  },
75
77
  "peerDependencies": {
76
- "@carbon/colors": "^10.34.0",
77
- "@carbon/icons-react": "^10.42.0",
78
+ "@carbon/colors": "^10.36.0",
79
+ "@carbon/icons-react": "^10.46.0",
78
80
  "@carbon/import-once": "^10.5.0",
79
- "@carbon/layout": "^10.34.0",
80
- "@carbon/motion": "^10.26.0",
81
- "@carbon/themes": "^10.46.0",
82
- "@carbon/type": "^10.38.0",
83
- "carbon-components": "^10.47.1",
84
- "carbon-components-react": "^7.47.2",
81
+ "@carbon/layout": "^10.36.0",
82
+ "@carbon/motion": "^10.28.0",
83
+ "@carbon/themes": "^10.50.0",
84
+ "@carbon/type": "^10.40.0",
85
+ "carbon-components": "^10.53.0",
86
+ "carbon-components-react": "^7.53.0",
85
87
  "carbon-icons": "^7.0.7",
86
88
  "react": "^16.8.6 || ^17.0.1",
87
89
  "react-dom": "^16.8.6 || ^17.0.1"
88
90
  },
89
- "gitHead": "64c7f310e4d344bce77216750d5989485d28a11c"
91
+ "gitHead": "f4a8ee412f5ddb54722b47478e35d469f49ac411"
90
92
  }