@carbon/ibm-products 2.56.1 → 2.57.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/css/index-full-carbon.css +66 -20
  2. package/css/index-full-carbon.css.map +1 -1
  3. package/css/index-full-carbon.min.css +1 -1
  4. package/css/index-full-carbon.min.css.map +1 -1
  5. package/css/index-without-carbon-released-only.css +28 -12
  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 +28 -12
  10. package/css/index-without-carbon.css.map +1 -1
  11. package/css/index-without-carbon.min.css +1 -1
  12. package/css/index-without-carbon.min.css.map +1 -1
  13. package/css/index.css +29 -12
  14. package/css/index.css.map +1 -1
  15. package/css/index.min.css +1 -1
  16. package/css/index.min.css.map +1 -1
  17. package/es/components/APIKeyModal/APIKeyDownloader.d.ts +1 -1
  18. package/es/components/APIKeyModal/APIKeyDownloader.js +1 -1
  19. package/es/components/APIKeyModal/APIKeyModal.d.ts +13 -0
  20. package/es/components/APIKeyModal/APIKeyModal.js +69 -25
  21. package/es/components/APIKeyModal/APIKeyModal.types.d.ts +16 -2
  22. package/es/components/Card/Card.js +3 -4
  23. package/es/components/Coachmark/CoachmarkOverlay.js +4 -0
  24. package/es/components/CoachmarkOverlayElements/CoachmarkOverlayElements.d.ts +12 -0
  25. package/es/components/CoachmarkOverlayElements/CoachmarkOverlayElements.js +39 -8
  26. package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +9 -5
  27. package/es/components/CreateTearsheet/CreateTearsheet.js +2 -1
  28. package/es/components/Datagrid/Datagrid/DatagridSelectAll.js +31 -2
  29. package/es/components/FilterSummary/FilterSummary.js +1 -1
  30. package/es/components/HTTPErrors/HTTPError403/HTTPError403.js +1 -1
  31. package/es/components/HTTPErrors/HTTPError404/HTTPError404.js +1 -1
  32. package/es/components/HTTPErrors/HTTPErrorOther/HTTPErrorOther.js +1 -1
  33. package/es/components/InterstitialScreen/InterstitialScreen.js +2 -3
  34. package/es/components/PageHeader/PageHeader.js +13 -3
  35. package/es/components/PageHeader/PageHeaderTitle.js +10 -29
  36. package/es/components/ProductiveCard/ProductiveCard.d.ts +6 -2
  37. package/es/components/ProductiveCard/ProductiveCard.js +7 -5
  38. package/es/components/SidePanel/SidePanel.d.ts +6 -1
  39. package/es/components/SidePanel/SidePanel.js +41 -26
  40. package/es/components/TagOverflow/TagOverflow.js +2 -5
  41. package/es/components/Tearsheet/TearsheetShell.d.ts +4 -0
  42. package/es/components/Tearsheet/TearsheetShell.js +5 -37
  43. package/es/global/js/hooks/useFocus.d.ts +1 -1
  44. package/es/global/js/hooks/useFocus.js +7 -4
  45. package/es/global/js/utils/checkForOverflow.d.ts +5 -0
  46. package/es/global/js/utils/checkForOverflow.js +31 -0
  47. package/lib/components/APIKeyModal/APIKeyDownloader.d.ts +1 -1
  48. package/lib/components/APIKeyModal/APIKeyDownloader.js +1 -1
  49. package/lib/components/APIKeyModal/APIKeyModal.d.ts +13 -0
  50. package/lib/components/APIKeyModal/APIKeyModal.js +68 -22
  51. package/lib/components/APIKeyModal/APIKeyModal.types.d.ts +16 -2
  52. package/lib/components/Card/Card.js +3 -4
  53. package/lib/components/Coachmark/CoachmarkOverlay.js +4 -0
  54. package/lib/components/CoachmarkOverlayElements/CoachmarkOverlayElements.d.ts +12 -0
  55. package/lib/components/CoachmarkOverlayElements/CoachmarkOverlayElements.js +39 -8
  56. package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +9 -5
  57. package/lib/components/CreateTearsheet/CreateTearsheet.js +2 -1
  58. package/lib/components/Datagrid/Datagrid/DatagridSelectAll.js +30 -1
  59. package/lib/components/FilterSummary/FilterSummary.js +1 -1
  60. package/lib/components/HTTPErrors/HTTPError403/HTTPError403.js +1 -1
  61. package/lib/components/HTTPErrors/HTTPError404/HTTPError404.js +1 -1
  62. package/lib/components/HTTPErrors/HTTPErrorOther/HTTPErrorOther.js +1 -1
  63. package/lib/components/InterstitialScreen/InterstitialScreen.js +2 -3
  64. package/lib/components/PageHeader/PageHeader.js +12 -2
  65. package/lib/components/PageHeader/PageHeaderTitle.js +8 -27
  66. package/lib/components/ProductiveCard/ProductiveCard.d.ts +6 -2
  67. package/lib/components/ProductiveCard/ProductiveCard.js +7 -5
  68. package/lib/components/SidePanel/SidePanel.d.ts +6 -1
  69. package/lib/components/SidePanel/SidePanel.js +41 -26
  70. package/lib/components/TagOverflow/TagOverflow.js +1 -4
  71. package/lib/components/Tearsheet/TearsheetShell.d.ts +4 -0
  72. package/lib/components/Tearsheet/TearsheetShell.js +5 -37
  73. package/lib/global/js/hooks/useFocus.d.ts +1 -1
  74. package/lib/global/js/hooks/useFocus.js +7 -4
  75. package/lib/global/js/utils/checkForOverflow.d.ts +5 -0
  76. package/lib/global/js/utils/checkForOverflow.js +34 -0
  77. package/package.json +8 -8
  78. package/scss/components/APIKeyModal/_api-key-modal.scss +4 -0
  79. package/scss/components/PageHeader/_page-header.scss +18 -6
  80. package/scss/components/SidePanel/_side-panel.scss +13 -6
  81. package/telemetry.yml +4 -0
@@ -6,7 +6,7 @@
6
6
  */
7
7
 
8
8
  import { objectSpread2 as _objectSpread2, objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, defineProperty as _defineProperty, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
- import { Button, Tooltip, Tag, usePrefix, FlexGrid, Row, Column } from '@carbon/react';
9
+ import { Button, Tooltip, Tag, usePrefix, FlexGrid, Row, Column, DefinitionTooltip } from '@carbon/react';
10
10
  import React__default, { useState, useRef, useEffect } from 'react';
11
11
  import { string_required_if_more_than_10_tags, TagSet } from '../TagSet/TagSet.js';
12
12
  import { spacing, baseFontSize, breakpoints } from '@carbon/layout';
@@ -19,6 +19,7 @@ import cx from 'classnames';
19
19
  import { getDevtoolsProps } from '../../global/js/utils/devtools.js';
20
20
  import { pkg } from '../../settings.js';
21
21
  import { useResizeObserver } from '../../global/js/hooks/useResizeObserver.js';
22
+ import { checkHeightOverflow } from '../../global/js/utils/checkForOverflow.js';
22
23
  import { useNearestScroll } from '../../global/js/hooks/useWindowScroll.js';
23
24
  import { useWindowResize } from '../../global/js/hooks/useWindowResize.js';
24
25
  import { BreadcrumbWithOverflow } from '../BreadcrumbWithOverflow/BreadcrumbWithOverflow.js';
@@ -361,6 +362,12 @@ var PageHeader = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
361
362
  }
362
363
  };
363
364
  var displayedBreadcrumbs = getBreadcrumbs();
365
+ var subtitleRef = useRef(null);
366
+ var isOverflowing = checkHeightOverflow(subtitleRef.current);
367
+ var subtitleContent = /*#__PURE__*/React__default.createElement("span", {
368
+ ref: subtitleRef,
369
+ className: "".concat(blockClass, "__subtitle-text")
370
+ }, subtitle);
364
371
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
365
372
  className: "".concat(blockClass, "--offset-top-measuring-element"),
366
373
  ref: offsetTopMeasuringRef
@@ -412,11 +419,14 @@ var PageHeader = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
412
419
  blockClass: blockClass,
413
420
  hasBreadcrumbRow: hasBreadcrumbRow,
414
421
  title: title
415
- }) : null), thePageActions(false, pageActionsInBreadcrumbRow)) : null, subtitle ? /*#__PURE__*/React__default.createElement(Row, {
422
+ }) : null), thePageActions(false, pageActionsInBreadcrumbRow)) : null, subtitle && /*#__PURE__*/React__default.createElement(Row, {
416
423
  className: "".concat(blockClass, "__subtitle-row")
417
424
  }, /*#__PURE__*/React__default.createElement(Column, {
418
425
  className: "".concat(blockClass, "__subtitle")
419
- }, subtitle)) : null, children ? /*#__PURE__*/React__default.createElement(Row, {
426
+ }, isOverflowing ? /*#__PURE__*/React__default.createElement(DefinitionTooltip, {
427
+ definition: subtitle,
428
+ className: "".concat(blockClass, "__subtitle-tooltip")
429
+ }, subtitleContent) : subtitleContent)), children ? /*#__PURE__*/React__default.createElement(Row, {
420
430
  className: "".concat(blockClass, "__available-row")
421
431
  }, /*#__PURE__*/React__default.createElement(Column, {
422
432
  className: "".concat(blockClass, "__available-column")
@@ -5,12 +5,13 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, extends as _extends, defineProperty as _defineProperty } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
- import React__default, { useState, useRef, useLayoutEffect } from 'react';
8
+ import { objectWithoutProperties as _objectWithoutProperties, extends as _extends, defineProperty as _defineProperty } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
+ import React__default, { useRef } from 'react';
10
10
  import PropTypes from '../../_virtual/index.js';
11
11
  import cx from 'classnames';
12
12
  import { SkeletonText, DefinitionTooltip } from '@carbon/react';
13
13
  import { EditInPlace } from '../EditInPlace/EditInPlace.js';
14
+ import { checkWidthOverflow } from '../../global/js/utils/checkForOverflow.js';
14
15
 
15
16
  var _excluded = ["text", "content", "loading", "icon", "asText", "onChange", "onSave", "editDescription", "editableLabel", "cancelDescription", "saveDescription", "tooltipAlignment"];
16
17
 
@@ -43,31 +44,18 @@ var PageHeaderTitle = function PageHeaderTitle(_ref) {
43
44
  rest = _objectWithoutProperties(title, _excluded);
44
45
  var titleText;
45
46
  var isEditable = !!onSave;
46
- var _useState = useState(),
47
- _useState2 = _slicedToArray(_useState, 2),
48
- isEllipsisApplied = _useState2[0],
49
- setIsEllipsisApplied = _useState2[1];
50
- var longTitleRef = useRef(undefined);
51
- var titleRef = useRef(undefined);
52
- useLayoutEffect(function () {
53
- setIsEllipsisApplied(isEllipsisActive());
54
- }, [longTitleRef, titleRef, title]);
55
- var isEllipsisActive = function isEllipsisActive() {
56
- if (longTitleRef.current) {
57
- var _longTitleRef$current, _longTitleRef$current2;
58
- return ((_longTitleRef$current = longTitleRef.current) === null || _longTitleRef$current === void 0 ? void 0 : _longTitleRef$current.offsetWidth) < ((_longTitleRef$current2 = longTitleRef.current) === null || _longTitleRef$current2 === void 0 ? void 0 : _longTitleRef$current2.scrollWidth);
59
- } else if (titleRef.current) {
60
- var _titleRef$current, _titleRef$current2;
61
- return ((_titleRef$current = titleRef.current) === null || _titleRef$current === void 0 ? void 0 : _titleRef$current.offsetWidth) < ((_titleRef$current2 = titleRef.current) === null || _titleRef$current2 === void 0 ? void 0 : _titleRef$current2.scrollWidth);
62
- }
63
- return false;
64
- };
47
+ var titleRef = useRef();
48
+ var isEllipsisApplied = checkWidthOverflow(titleRef.current);
65
49
  if (text || !content) {
66
50
  if (text === undefined && typeof title === 'string') {
67
51
  text = title;
68
52
  asText = title;
69
53
  }
70
54
  var TitleIcon = icon;
55
+ var titleContent = /*#__PURE__*/React__default.createElement("span", {
56
+ ref: titleRef,
57
+ className: "".concat(blockClass, "__titleText")
58
+ }, text);
71
59
  titleInnards = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, icon && !loading ? /*#__PURE__*/React__default.createElement("span", {
72
60
  className: "".concat(blockClass, "__title-icon-wrapper")
73
61
  }, /*#__PURE__*/React__default.createElement(TitleIcon, {
@@ -90,14 +78,7 @@ var PageHeaderTitle = function PageHeaderTitle(_ref) {
90
78
  align: tooltipAlignment,
91
79
  definition: text,
92
80
  className: "".concat(blockClass, "__tooltip")
93
- }, /*#__PURE__*/React__default.createElement("span", {
94
- ref: longTitleRef,
95
- className: "".concat(blockClass, "__titleText")
96
- }, text)) : /*#__PURE__*/React__default.createElement("span", {
97
- ref: titleRef,
98
- className: "".concat(blockClass, "__titleText"),
99
- title: !loading ? asText : null
100
- }, text));
81
+ }, titleContent) : titleContent);
101
82
  } else {
102
83
  titleInnards = content;
103
84
  titleText = asText;
@@ -66,7 +66,8 @@ export interface ProductiveCardProps extends PropsWithChildren {
66
66
  */
67
67
  overflowActions?: overflowAction[];
68
68
  /**
69
- * Aria label prop required for OverflowMenu
69
+ * Sets the text for the OverflowMenu aria label and the OverflowMenu trigger button tooltip.
70
+ * Overrides `iconDescription` prop.
70
71
  */
71
72
  overflowAriaLabel?: string;
72
73
  /**
@@ -120,7 +121,10 @@ export interface ProductiveCardProps extends PropsWithChildren {
120
121
  */
121
122
  titleSize?: 'default' | 'large';
122
123
  /**
123
- * Tooltip icon description
124
+ * Sets the text for the OverflowMenu trigger button tooltip and OverflowMenu aria label,
125
+ * gets overridden by the `overflowAriaLabel` prop.
126
+ *
127
+ * @deprecated Please use the `overflowAriaLabel` prop instead.
124
128
  */
125
129
  iconDescription?: string;
126
130
  }
@@ -13,16 +13,14 @@ import { pkg } from '../../settings.js';
13
13
  import { prepareProps } from '../../global/js/utils/props-helper.js';
14
14
  import { Card } from '../Card/Card.js';
15
15
 
16
- var _excluded = ["actionsPlacement", "iconDescription"];
16
+ var _excluded = ["actionsPlacement"];
17
17
  var componentName = 'ProductiveCard';
18
18
  var ProductiveCard = /*#__PURE__*/forwardRef(function (_ref, ref) {
19
19
  var _ref$actionsPlacement = _ref.actionsPlacement,
20
20
  actionsPlacement = _ref$actionsPlacement === void 0 ? 'top' : _ref$actionsPlacement,
21
- iconDescription = _ref.iconDescription,
22
21
  rest = _objectWithoutProperties(_ref, _excluded);
23
22
  var validProps = prepareProps(rest, ['media', 'mediaPosition', 'pictogram', 'primaryButtonClick', 'productive', 'secondaryButtonKind']);
24
23
  return /*#__PURE__*/React__default.createElement(Card, _extends({}, _objectSpread2(_objectSpread2({}, validProps), {}, {
25
- iconDescription: iconDescription,
26
24
  actionsPlacement: actionsPlacement,
27
25
  ref: ref,
28
26
  productive: true
@@ -69,7 +67,10 @@ ProductiveCard.propTypes = {
69
67
  */
70
68
  description: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.node]),
71
69
  /**
72
- * Tooltip icon description
70
+ * Sets the text for the OverflowMenu trigger button tooltip and OverflowMenu aria label,
71
+ * gets overridden by the `overflowAriaLabel` prop.
72
+ *
73
+ * @deprecated Please use the `overflowAriaLabel` prop instead.
73
74
  */
74
75
  iconDescription: PropTypes.string,
75
76
  /**
@@ -99,7 +100,8 @@ ProductiveCard.propTypes = {
99
100
  onKeyDown: PropTypes.func
100
101
  })),
101
102
  /**
102
- * Aria label prop required for OverflowMenu
103
+ * Sets the text for the OverflowMenu aria label and the OverflowMenu trigger button tooltip.
104
+ * Overrides `iconDescription` prop.
103
105
  */
104
106
  overflowAriaLabel: PropTypes.string,
105
107
  /**
@@ -110,14 +110,19 @@ type SidePanelBaseProps = {
110
110
  */
111
111
  slideIn?: boolean;
112
112
  /**
113
- * @deprecated please use the `aiLabel` prop
113
+ * @deprecated please use the `decorator` instead
114
114
  * **Experimental:** Provide a `Slug` component to be rendered inside the `SidePanel` component
115
115
  */
116
116
  slug?: ReactNode;
117
117
  /**
118
+ * @deprecated please use the `decorator` instead
118
119
  * Optional prop that is intended for any scenario where something is being generated by AI to reinforce AI transparency, accountability, and explainability at the UI level.
119
120
  */
120
121
  aiLabel?: ReactNode;
122
+ /**
123
+ * Provide a `decorator` component to be rendered inside the `SidePanel` component
124
+ */
125
+ decorator?: ReactNode;
121
126
  /**
122
127
  * Sets the subtitle text
123
128
  */
@@ -24,7 +24,7 @@ import usePrefersReducedMotion from '../../global/js/hooks/usePrefersReducedMoti
24
24
  import { useFocus, getSpecificElement } from '../../global/js/hooks/useFocus.js';
25
25
  import { usePreviousValue } from '../../global/js/hooks/usePreviousValue.js';
26
26
 
27
- var _excluded = ["actionToolbarButtons", "actions", "aiLabel", "animateTitle", "children", "className", "closeIconDescription", "condensedActions", "currentStep", "id", "includeOverlay", "labelText", "navigationBackIconDescription", "onNavigationBack", "onRequestClose", "onUnmount", "open", "placement", "preventCloseOnClickOutside", "selectorPageContent", "selectorPrimaryFocus", "size", "slideIn", "slug", "subtitle", "title", "launcherButtonRef"],
27
+ var _excluded = ["actionToolbarButtons", "actions", "aiLabel", "animateTitle", "children", "className", "closeIconDescription", "condensedActions", "currentStep", "decorator", "id", "includeOverlay", "labelText", "navigationBackIconDescription", "onNavigationBack", "onRequestClose", "onUnmount", "open", "placement", "preventCloseOnClickOutside", "selectorPageContent", "selectorPrimaryFocus", "size", "slideIn", "slug", "subtitle", "title", "launcherButtonRef"],
28
28
  _excluded2 = ["label", "kind", "hasIconOnly", "icon", "renderIcon", "tooltipPosition", "tooltipAlignment", "leading", "disabled", "className", "onClick"];
29
29
  var blockClass = "".concat(pkg.prefix, "--side-panel");
30
30
  var componentName = 'SidePanel';
@@ -57,6 +57,7 @@ var SidePanel = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
57
57
  condensedActions = _ref.condensedActions,
58
58
  _ref$currentStep = _ref.currentStep,
59
59
  currentStep = _ref$currentStep === void 0 ? defaults.currentStep : _ref$currentStep,
60
+ decorator = _ref.decorator,
60
61
  _ref$id = _ref.id,
61
62
  id = _ref$id === void 0 ? blockClass : _ref$id,
62
63
  includeOverlay = _ref.includeOverlay,
@@ -266,7 +267,7 @@ var SidePanel = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
266
267
  if (!open) {
267
268
  onUnmount === null || onUnmount === void 0 || onUnmount();
268
269
  }
269
- setAnimationComplete(true);
270
+ setAnimationComplete(!animationComplete);
270
271
  };
271
272
 
272
273
  // Set the internal state `animationComplete` to true if
@@ -320,22 +321,24 @@ var SidePanel = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
320
321
  }
321
322
  }, [slideIn, selectorPageContent, placement, size, shouldReduceMotion, open]);
322
323
  useEffect(function () {
323
- if (open) {
324
- setTimeout(function () {
325
- if (selectorPrimaryFocus && getSpecificElement(sidePanelRef === null || sidePanelRef === void 0 ? void 0 : sidePanelRef.current, selectorPrimaryFocus)) {
326
- var _window2;
327
- var primeFocusEl = getSpecificElement(sidePanelRef === null || sidePanelRef === void 0 ? void 0 : sidePanelRef.current, selectorPrimaryFocus);
328
- if (primeFocusEl && ((_window2 = window) === null || _window2 === void 0 || (_window2 = _window2.getComputedStyle(primeFocusEl)) === null || _window2 === void 0 ? void 0 : _window2.display) !== 'none') {
329
- primeFocusEl === null || primeFocusEl === void 0 || primeFocusEl.focus();
330
- }
331
- } else if (!slideIn) {
332
- firstElement === null || firstElement === void 0 || firstElement.focus();
324
+ if (open && animationComplete) {
325
+ if (selectorPrimaryFocus && getSpecificElement(sidePanelRef === null || sidePanelRef === void 0 ? void 0 : sidePanelRef.current, selectorPrimaryFocus)) {
326
+ var _window2;
327
+ var primeFocusEl = getSpecificElement(sidePanelRef === null || sidePanelRef === void 0 ? void 0 : sidePanelRef.current, selectorPrimaryFocus);
328
+ if (primeFocusEl && ((_window2 = window) === null || _window2 === void 0 || (_window2 = _window2.getComputedStyle(primeFocusEl)) === null || _window2 === void 0 ? void 0 : _window2.display) !== 'none') {
329
+ setTimeout(function () {
330
+ return primeFocusEl === null || primeFocusEl === void 0 ? void 0 : primeFocusEl.focus();
331
+ }, 0);
333
332
  }
334
- }, 0);
333
+ } else if (!slideIn) {
334
+ setTimeout(function () {
335
+ return firstElement === null || firstElement === void 0 ? void 0 : firstElement.focus();
336
+ }, 0);
337
+ }
335
338
  }
336
339
  }, [animationComplete, firstElement, open, selectorPrimaryFocus, sidePanelRef, slideIn]);
337
340
  var primaryActionContainerClassNames = cx(["".concat(blockClass, "__actions-container"), _defineProperty({}, "".concat(blockClass, "__actions-container--condensed"), condensedActions)]);
338
- var mainPanelClassNames = cx([blockClass, className, "".concat(blockClass), "".concat(blockClass, "--").concat(size), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(blockClass, "--right-placement"), placement === 'right'), "".concat(blockClass, "--left-placement"), placement === 'left'), "".concat(blockClass, "--slide-in"), slideIn), "".concat(blockClass, "--has-ai-label"), !!aiLabel || !!slug), "".concat(blockClass, "--condensed-actions"), condensedActions), "".concat(blockClass, "--has-overlay"), includeOverlay)]);
341
+ var mainPanelClassNames = cx([blockClass, className, "".concat(blockClass), "".concat(blockClass, "--").concat(size), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(blockClass, "--right-placement"), placement === 'right'), "".concat(blockClass, "--left-placement"), placement === 'left'), "".concat(blockClass, "--slide-in"), slideIn), "".concat(blockClass, "--has-decorator"), decorator), "".concat(blockClass, "--has-slug"), slug), "".concat(blockClass, "--has-ai-label"), aiLabel), "".concat(blockClass, "--condensed-actions"), condensedActions), "".concat(blockClass, "--has-overlay"), includeOverlay)]);
339
342
  var renderTitle = function renderTitle() {
340
343
  return /*#__PURE__*/React__default.createElement("div", {
341
344
  className: cx("".concat(blockClass, "__title"), _defineProperty({}, "".concat(blockClass, "__title--no-label"), !labelTextRef.current)),
@@ -351,23 +354,29 @@ var SidePanel = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
351
354
  }, title));
352
355
  };
353
356
  var renderHeader = function renderHeader() {
354
- var _slug$type, _aiLabel$type;
355
- var aiLabelCloseSize = actions && actions.length && /l/.test(size) ? 'md' : 'sm';
356
- var normalizedAILabel;
357
+ var _slug$type, _aiLabel$type, _decorator$type;
358
+ var closeSize = actions && actions.length && /l/.test(size) ? 'md' : 'sm';
359
+ var normalizedDecorator;
357
360
  /**
358
361
  * slug is deprecated
359
362
  * can remove this condition in future release
360
363
  */
361
- if (slug && ((_slug$type = slug['type']) === null || _slug$type === void 0 ? void 0 : _slug$type.displayName) === 'Slug') {
362
- normalizedAILabel = /*#__PURE__*/React__default.cloneElement(slug, {
364
+ if (slug && ((_slug$type = slug['type']) === null || _slug$type === void 0 ? void 0 : _slug$type.displayName) === 'AILabel') {
365
+ normalizedDecorator = /*#__PURE__*/React__default.cloneElement(slug, {
363
366
  // slug size is sm unless actions and size > md
364
- size: aiLabelCloseSize
367
+ size: closeSize
365
368
  });
366
369
  }
367
370
  if (aiLabel && ((_aiLabel$type = aiLabel['type']) === null || _aiLabel$type === void 0 ? void 0 : _aiLabel$type.displayName) === 'AILabel') {
368
- normalizedAILabel = /*#__PURE__*/React__default.cloneElement(aiLabel, {
371
+ normalizedDecorator = /*#__PURE__*/React__default.cloneElement(aiLabel, {
369
372
  // aiLabel size is sm unless actions and size > md
370
- size: aiLabelCloseSize
373
+ size: closeSize
374
+ });
375
+ }
376
+ if ((decorator === null || decorator === void 0 || (_decorator$type = decorator['type']) === null || _decorator$type === void 0 ? void 0 : _decorator$type.displayName) === 'AILabel') {
377
+ normalizedDecorator = /*#__PURE__*/React__default.cloneElement(decorator, {
378
+ // decorator size is sm unless actions and size > md
379
+ size: closeSize
371
380
  });
372
381
  }
373
382
  return /*#__PURE__*/React__default.createElement("div", {
@@ -375,7 +384,7 @@ var SidePanel = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
375
384
  ref: headerRef
376
385
  }, currentStep > 0 && /*#__PURE__*/React__default.createElement(Button, {
377
386
  kind: "ghost",
378
- size: aiLabelCloseSize,
387
+ size: closeSize,
379
388
  disabled: false,
380
389
  renderIcon: function renderIcon(props) {
381
390
  return /*#__PURE__*/React__default.createElement(ArrowLeft, _extends({
@@ -389,8 +398,8 @@ var SidePanel = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
389
398
  className: "".concat(blockClass, "__label-text"),
390
399
  ref: labelTextRef
391
400
  }, labelText), title && title.length && renderTitle(), /*#__PURE__*/React__default.createElement("div", {
392
- className: "".concat(blockClass, "__ai-label-and-close")
393
- }, normalizedAILabel, /*#__PURE__*/React__default.createElement(IconButton, {
401
+ className: "".concat(blockClass, "__decorator-and-close")
402
+ }, normalizedDecorator, /*#__PURE__*/React__default.createElement(IconButton, {
394
403
  className: "".concat(blockClass, "__close-button"),
395
404
  label: closeIconDescription,
396
405
  onClick: onRequestClose,
@@ -493,7 +502,13 @@ var deprecatedProps = {
493
502
  * **deprecated**
494
503
  * **Experimental:** Provide a `Slug` component to be rendered inside the `SidePanel` component
495
504
  */
496
- slug: PropTypes.node
505
+ slug: PropTypes.node,
506
+ /**
507
+ * **deprecated**
508
+ * Please use the `decorator` instead
509
+ * Optional prop that is intended for any scenario where something is being generated by AI to reinforce AI transparency, accountability, and explainability at the UI level.
510
+ */
511
+ aiLabel: PropTypes.node
497
512
  };
498
513
  SidePanel.propTypes = _objectSpread2({
499
514
  /**
@@ -7,7 +7,7 @@
7
7
 
8
8
  import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, objectSpread2 as _objectSpread2, extends as _extends, defineProperty as _defineProperty } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
9
  import React__default, { forwardRef, useRef, useState, useCallback, useEffect, createElement } from 'react';
10
- import { Tooltip, DismissibleTag, Tag } from '@carbon/react';
10
+ import { DismissibleTag, Tag } from '@carbon/react';
11
11
  import PropTypes from '../../_virtual/index.js';
12
12
  import { TYPES } from './constants.js';
13
13
  import { TagOverflowModal } from './TagOverflowModal.js';
@@ -189,9 +189,6 @@ var TagOverflow = /*#__PURE__*/forwardRef(function (props, ref) {
189
189
  return itemRefHandler(id, node);
190
190
  },
191
191
  key: id
192
- }, /*#__PURE__*/React__default.createElement(Tooltip, {
193
- align: overflowAlign,
194
- label: label
195
192
  }, typeof _onClose === 'function' || filter ? /*#__PURE__*/React__default.createElement(DismissibleTag, _extends({}, other, {
196
193
  className: "".concat(blockClass, "__item--tag"),
197
194
  type: tagType,
@@ -202,7 +199,7 @@ var TagOverflow = /*#__PURE__*/forwardRef(function (props, ref) {
202
199
  })) : /*#__PURE__*/React__default.createElement(Tag, _extends({}, other, {
203
200
  className: "".concat(blockClass, "__item--tag"),
204
201
  type: tagType
205
- }), label)));
202
+ }), label));
206
203
  }
207
204
  }), /*#__PURE__*/React__default.createElement("span", {
208
205
  className: "".concat(blockClass, "__indicator"),
@@ -19,6 +19,10 @@ interface TearsheetShellProps extends PropsWithChildren {
19
19
  * An optional class or classes to be added to the outermost element.
20
20
  */
21
21
  className?: string;
22
+ /**
23
+ * Used to track the current step on components which use `StepsContext` and `TearsheetShell`
24
+ */
25
+ currentStep?: number;
22
26
  /**
23
27
  * A description of the flow, displayed in the header area of the tearsheet.
24
28
  */
@@ -21,7 +21,7 @@ import { usePortalTarget } from '../../global/js/hooks/usePortalTarget.js';
21
21
  import { useFocus, claimFocus } from '../../global/js/hooks/useFocus.js';
22
22
  import { usePreviousValue } from '../../global/js/hooks/usePreviousValue.js';
23
23
 
24
- var _excluded = ["actions", "aiLabel", "ariaLabel", "children", "className", "closeIconDescription", "description", "hasCloseIcon", "headerActions", "influencer", "influencerPosition", "influencerWidth", "label", "navigation", "onClose", "open", "portalTarget", "selectorPrimaryFocus", "selectorsFloatingMenus", "size", "slug", "title", "verticalPosition", "launcherButtonRef"];
24
+ var _excluded = ["actions", "aiLabel", "ariaLabel", "children", "className", "closeIconDescription", "currentStep", "description", "hasCloseIcon", "headerActions", "influencer", "influencerPosition", "influencerWidth", "label", "navigation", "onClose", "open", "portalTarget", "selectorPrimaryFocus", "selectorsFloatingMenus", "size", "slug", "title", "verticalPosition", "launcherButtonRef"];
25
25
  // The block part of our conventional BEM class names (bc__E--M).
26
26
  var bc = "".concat(pkg.prefix, "--tearsheet");
27
27
  var componentName = 'TearsheetShell';
@@ -68,6 +68,7 @@ var TearsheetShell = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
68
68
  children = _ref.children,
69
69
  className = _ref.className,
70
70
  closeIconDescription = _ref.closeIconDescription,
71
+ currentStep = _ref.currentStep,
71
72
  description = _ref.description,
72
73
  hasCloseIcon = _ref.hasCloseIcon,
73
74
  headerActions = _ref.headerActions,
@@ -100,8 +101,7 @@ var TearsheetShell = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
100
101
  var prevOpen = usePreviousValue(open);
101
102
  var _useFocus = useFocus(modalRef, selectorPrimaryFocus),
102
103
  firstElement = _useFocus.firstElement,
103
- keyDownListener = _useFocus.keyDownListener,
104
- specifiedElement = _useFocus.specifiedElement;
104
+ keyDownListener = _useFocus.keyDownListener;
105
105
  var modalRefValue = modalRef.current;
106
106
 
107
107
  // Function to strip html tags out of a string.
@@ -137,23 +137,12 @@ var TearsheetShell = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
137
137
  setDepth(newDepth);
138
138
  setPosition(newPosition);
139
139
  }
140
- handleStackChange.checkFocus = function () {
141
- // if we are now the topmost tearsheet, ensure we have focus
142
- if (open && position === depth && modalRefValue && !modalRefValue.contains(document.activeElement)) {
143
- handleStackChange.claimFocus();
144
- }
145
- };
146
-
147
- // Callback to give the tearsheet the opportunity to claim focus
148
- handleStackChange.claimFocus = function () {
149
- claimFocus(firstElement, modalRef, selectorPrimaryFocus);
150
- };
151
140
  useEffect(function () {
152
- if (open) {
141
+ if (open && position === depth) {
153
142
  // Focusing the first element or selectorPrimaryFocus element
154
143
  claimFocus(firstElement, modalRef, selectorPrimaryFocus);
155
144
  }
156
- }, [firstElement, modalRef, open, selectorPrimaryFocus]);
145
+ }, [currentStep, depth, firstElement, modalRef, modalRefValue, open, position, selectorPrimaryFocus]);
157
146
  useEffect(function () {
158
147
  if (prevOpen && !open && launcherButtonRef) {
159
148
  setTimeout(function () {
@@ -161,22 +150,10 @@ var TearsheetShell = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
161
150
  }, 0);
162
151
  }
163
152
  }, [launcherButtonRef, open, prevOpen]);
164
- useEffect(function () {
165
- if (open && position !== depth) {
166
- setTimeout(function () {
167
- if (selectorPrimaryFocus) {
168
- return specifiedElement === null || specifiedElement === void 0 ? void 0 : specifiedElement.focus();
169
- }
170
- firstElement === null || firstElement === void 0 || firstElement.focus();
171
- }, 0);
172
- }
173
- }, [position, depth, firstElement, open, specifiedElement, selectorPrimaryFocus]);
174
153
  useEffect(function () {
175
154
  var notify = function notify() {
176
155
  return stack.all.forEach(function (handler) {
177
- var _handler$checkFocus;
178
156
  handler(Math.min(stack.open.length, maxDepth), stack.open.indexOf(handler) + 1);
179
- (_handler$checkFocus = handler.checkFocus) === null || _handler$checkFocus === void 0 || _handler$checkFocus.call(handler);
180
157
  });
181
158
  };
182
159
 
@@ -211,14 +188,6 @@ var TearsheetShell = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
211
188
  }
212
189
  };
213
190
  }, [open, size]);
214
- function handleFocus() {
215
- // If something within us is receiving focus but we are not the topmost
216
- // stacked tearsheet, transfer focus to the topmost tearsheet instead
217
- if (position < depth) {
218
- var _stack$open$claimFocu, _stack$open;
219
- (_stack$open$claimFocu = (_stack$open = stack.open[stack.open.length - 1]).claimFocus) === null || _stack$open$claimFocu === void 0 || _stack$open$claimFocu.call(_stack$open);
220
- }
221
- }
222
191
  if (position <= depth) {
223
192
  var _prevDepth$current;
224
193
  // Include a modal header if and only if one or more of these is given.
@@ -250,7 +219,6 @@ var TearsheetShell = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
250
219
  onClose: onClose,
251
220
  open: open,
252
221
  selectorPrimaryFocus: selectorPrimaryFocus,
253
- onFocus: handleFocus,
254
222
  onKeyDown: keyDownListener,
255
223
  preventCloseOnClickOutside: !isPassive,
256
224
  ref: modalRef,
@@ -12,4 +12,4 @@ export function useFocus(modalRef: any, selectorPrimaryFocus: any): {
12
12
  specified: any;
13
13
  };
14
14
  };
15
- export function claimFocus(firstElement: any, modalRef: any, selectorPrimaryFocus?: string | undefined): any;
15
+ export function claimFocus(firstElement: any, modalRef: any, selectorPrimaryFocus?: string | undefined): void;
@@ -116,12 +116,15 @@ var claimFocus = function claimFocus(firstElement, modalRef) {
116
116
  var _window2;
117
117
  var specifiedEl = getSpecificElement(modalRef === null || modalRef === void 0 ? void 0 : modalRef.current, selectorPrimaryFocus);
118
118
  if (specifiedEl && ((_window2 = window) === null || _window2 === void 0 || (_window2 = _window2.getComputedStyle(specifiedEl)) === null || _window2 === void 0 ? void 0 : _window2.display) !== 'none') {
119
- return specifiedEl.focus();
119
+ setTimeout(function () {
120
+ return specifiedEl.focus();
121
+ }, 0);
120
122
  }
123
+ } else {
124
+ setTimeout(function () {
125
+ return firstElement === null || firstElement === void 0 ? void 0 : firstElement.focus();
126
+ }, 0);
121
127
  }
122
- setTimeout(function () {
123
- return firstElement === null || firstElement === void 0 ? void 0 : firstElement.focus();
124
- }, 0);
125
128
  };
126
129
 
127
130
  export { claimFocus, getSpecificElement, useFocus };
@@ -0,0 +1,5 @@
1
+ /**
2
+ * used to calculate if a element is overflowing the width or height of an area
3
+ */
4
+ export declare const checkWidthOverflow: (el: HTMLElement | null) => boolean;
5
+ export declare const checkHeightOverflow: (el: HTMLElement | null) => boolean;
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Copyright IBM Corp. 2020, 2024
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
+ */
7
+
8
+ // Copyright IBM Corp. 2024, 2024
9
+ //
10
+ // This source code is licensed under the Apache-2.0 license found in the
11
+ // LICENSE file in the root directory of this source tree.
12
+ //
13
+
14
+ /**
15
+ * used to calculate if a element is overflowing the width or height of an area
16
+ */
17
+
18
+ var checkWidthOverflow = function checkWidthOverflow(el) {
19
+ if (el) {
20
+ return (el === null || el === void 0 ? void 0 : el.offsetWidth) < (el === null || el === void 0 ? void 0 : el.scrollWidth);
21
+ }
22
+ return false;
23
+ };
24
+ var checkHeightOverflow = function checkHeightOverflow(el) {
25
+ if (el) {
26
+ return (el === null || el === void 0 ? void 0 : el.offsetHeight) < (el === null || el === void 0 ? void 0 : el.scrollHeight);
27
+ }
28
+ return false;
29
+ };
30
+
31
+ export { checkHeightOverflow, checkWidthOverflow };
@@ -10,7 +10,7 @@ export namespace APIKeyDownloader {
10
10
  export { componentName as displayName };
11
11
  export namespace propTypes {
12
12
  let apiKey: PropTypes.Validator<string>;
13
- let body: PropTypes.Validator<string>;
13
+ let body: PropTypes.Requireable<string>;
14
14
  let downloadLinkLabel: PropTypes.Requireable<string>;
15
15
  let fileName: PropTypes.Validator<string>;
16
16
  let fileType: PropTypes.Validator<string>;
@@ -78,7 +78,7 @@ APIKeyDownloader.propTypes = {
78
78
  /**
79
79
  * body content for the downloader
80
80
  */
81
- body: index.default.string.isRequired,
81
+ body: index.default.string,
82
82
  /**
83
83
  * aria-label for the download link
84
84
  */
@@ -1,3 +1,16 @@
1
1
  import React from 'react';
2
+ import PropTypes from 'prop-types';
2
3
  import { APIKeyModalProps } from './APIKeyModal.types';
3
4
  export declare let APIKeyModal: React.FC<APIKeyModalProps>;
5
+ export declare const deprecatedProps: {
6
+ /**
7
+ * deprecated
8
+ * title for a successful edit
9
+ */
10
+ editSuccessTitle: PropTypes.Requireable<string>;
11
+ /**
12
+ * deprecated
13
+ * title for a successful key generation
14
+ */
15
+ generateSuccessTitle: PropTypes.Requireable<string>;
16
+ };