@carbon/ibm-products 2.39.0 → 2.40.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (119) hide show
  1. package/css/index-full-carbon.css +9 -3
  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 +5 -0
  6. package/css/index-without-carbon-released-only.css.map +1 -1
  7. package/css/index-without-carbon-released-only.min.css +1 -1
  8. package/css/index-without-carbon-released-only.min.css.map +1 -1
  9. package/css/index-without-carbon.css +9 -3
  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 +9 -3
  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/AddSelect/AddSelect.d.ts +44 -2
  18. package/es/components/AddSelect/AddSelect.js +8 -4
  19. package/es/components/AddSelect/AddSelectBody.d.ts +44 -2
  20. package/es/components/AddSelect/AddSelectBody.js +10 -12
  21. package/es/components/AddSelect/AddSelectSort.d.ts +16 -17
  22. package/es/components/AddSelect/AddSelectSort.js +5 -5
  23. package/es/components/AddSelect/types/index.d.ts +44 -0
  24. package/es/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.d.ts +5 -1
  25. package/es/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +12 -6
  26. package/es/components/Card/Card.js +1 -1
  27. package/es/components/CreateInfluencer/CreateInfluencer.js +1 -1
  28. package/es/components/CreateTearsheet/CreateTearsheetStep.d.ts +95 -2
  29. package/es/components/CreateTearsheet/CreateTearsheetStep.js +7 -5
  30. package/es/components/DataSpreadsheet/DataSpreadsheet.js +4 -3
  31. package/es/components/DataSpreadsheet/DataSpreadsheetHeader.js +5 -0
  32. package/es/components/Datagrid/Datagrid/DatagridVirtualBody.js +5 -1
  33. package/es/components/ExpressiveCard/ExpressiveCard.d.ts +2 -1
  34. package/es/components/Guidebanner/Guidebanner.d.ts +62 -2
  35. package/es/components/Guidebanner/Guidebanner.js +8 -7
  36. package/es/components/Guidebanner/GuidebannerElement.d.ts +30 -17
  37. package/es/components/Guidebanner/GuidebannerElement.js +4 -4
  38. package/es/components/Guidebanner/GuidebannerElementButton.d.ts +29 -15
  39. package/es/components/Guidebanner/GuidebannerElementButton.js +10 -4
  40. package/es/components/Guidebanner/GuidebannerElementLink.d.ts +20 -13
  41. package/es/components/Guidebanner/GuidebannerElementLink.js +3 -3
  42. package/es/components/InterstitialScreen/InterstitialScreen.js +3 -1
  43. package/es/components/MultiAddSelect/MultiAddSelect.d.ts +134 -2
  44. package/es/components/MultiAddSelect/MultiAddSelect.js +2 -1
  45. package/es/components/NotificationsPanel/NotificationsPanel.js +0 -1
  46. package/es/components/PageHeader/PageHeader.d.ts +298 -5
  47. package/es/components/PageHeader/PageHeader.js +98 -47
  48. package/es/components/PageHeader/PageHeaderUtils.d.ts +1 -1
  49. package/es/components/PageHeader/PageHeaderUtils.js +4 -1
  50. package/es/components/SidePanel/SidePanel.d.ts +6 -2
  51. package/es/components/SidePanel/SidePanel.js +17 -2
  52. package/es/components/SidePanel/constants.d.ts +1 -0
  53. package/es/components/SidePanel/constants.js +1 -0
  54. package/es/components/SingleAddSelect/SingleAddSelect.d.ts +69 -2
  55. package/es/components/SingleAddSelect/SingleAddSelect.js +2 -1
  56. package/es/components/Tearsheet/Tearsheet.d.ts +132 -6
  57. package/es/components/Tearsheet/Tearsheet.js +25 -13
  58. package/es/components/Tearsheet/TearsheetShell.d.ts +5 -1
  59. package/es/components/Tearsheet/TearsheetShell.js +26 -4
  60. package/es/components/WebTerminal/WebTerminal.d.ts +4 -0
  61. package/es/components/WebTerminal/WebTerminal.js +11 -3
  62. package/es/global/js/hooks/useFocus.d.ts +3 -1
  63. package/es/global/js/hooks/useFocus.js +6 -3
  64. package/es/global/js/hooks/useRetrieveStepData.d.ts +1 -1
  65. package/es/global/js/hooks/useRetrieveStepData.js +1 -1
  66. package/lib/components/AddSelect/AddSelect.d.ts +44 -2
  67. package/lib/components/AddSelect/AddSelect.js +7 -3
  68. package/lib/components/AddSelect/AddSelectBody.d.ts +44 -2
  69. package/lib/components/AddSelect/AddSelectBody.js +10 -12
  70. package/lib/components/AddSelect/AddSelectSort.d.ts +16 -17
  71. package/lib/components/AddSelect/AddSelectSort.js +5 -5
  72. package/lib/components/AddSelect/types/index.d.ts +44 -0
  73. package/lib/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.d.ts +5 -1
  74. package/lib/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +12 -6
  75. package/lib/components/Card/Card.js +1 -1
  76. package/lib/components/CreateInfluencer/CreateInfluencer.js +1 -1
  77. package/lib/components/CreateTearsheet/CreateTearsheetStep.d.ts +95 -2
  78. package/lib/components/CreateTearsheet/CreateTearsheetStep.js +7 -5
  79. package/lib/components/DataSpreadsheet/DataSpreadsheet.js +4 -3
  80. package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.js +5 -0
  81. package/lib/components/Datagrid/Datagrid/DatagridVirtualBody.js +5 -1
  82. package/lib/components/ExpressiveCard/ExpressiveCard.d.ts +2 -1
  83. package/lib/components/Guidebanner/Guidebanner.d.ts +62 -2
  84. package/lib/components/Guidebanner/Guidebanner.js +8 -7
  85. package/lib/components/Guidebanner/GuidebannerElement.d.ts +30 -17
  86. package/lib/components/Guidebanner/GuidebannerElement.js +4 -4
  87. package/lib/components/Guidebanner/GuidebannerElementButton.d.ts +29 -15
  88. package/lib/components/Guidebanner/GuidebannerElementButton.js +10 -4
  89. package/lib/components/Guidebanner/GuidebannerElementLink.d.ts +20 -13
  90. package/lib/components/Guidebanner/GuidebannerElementLink.js +3 -3
  91. package/lib/components/InterstitialScreen/InterstitialScreen.js +3 -1
  92. package/lib/components/MultiAddSelect/MultiAddSelect.d.ts +134 -2
  93. package/lib/components/MultiAddSelect/MultiAddSelect.js +2 -1
  94. package/lib/components/NotificationsPanel/NotificationsPanel.js +0 -1
  95. package/lib/components/PageHeader/PageHeader.d.ts +298 -5
  96. package/lib/components/PageHeader/PageHeader.js +98 -47
  97. package/lib/components/PageHeader/PageHeaderUtils.d.ts +1 -1
  98. package/lib/components/PageHeader/PageHeaderUtils.js +4 -1
  99. package/lib/components/SidePanel/SidePanel.d.ts +6 -2
  100. package/lib/components/SidePanel/SidePanel.js +17 -2
  101. package/lib/components/SidePanel/constants.d.ts +1 -0
  102. package/lib/components/SidePanel/constants.js +1 -0
  103. package/lib/components/SingleAddSelect/SingleAddSelect.d.ts +69 -2
  104. package/lib/components/SingleAddSelect/SingleAddSelect.js +2 -1
  105. package/lib/components/Tearsheet/Tearsheet.d.ts +132 -6
  106. package/lib/components/Tearsheet/Tearsheet.js +25 -13
  107. package/lib/components/Tearsheet/TearsheetShell.d.ts +5 -1
  108. package/lib/components/Tearsheet/TearsheetShell.js +26 -4
  109. package/lib/components/WebTerminal/WebTerminal.d.ts +4 -0
  110. package/lib/components/WebTerminal/WebTerminal.js +11 -3
  111. package/lib/global/js/hooks/useFocus.d.ts +3 -1
  112. package/lib/global/js/hooks/useFocus.js +6 -3
  113. package/lib/global/js/hooks/useRetrieveStepData.d.ts +1 -1
  114. package/lib/global/js/hooks/useRetrieveStepData.js +1 -1
  115. package/package.json +3 -3
  116. package/scss/components/CoachmarkStack/_coachmark-stack.scss +4 -2
  117. package/scss/components/SidePanel/_side-panel-variables.scss +1 -0
  118. package/scss/components/StringFormatter/_string-formatter.scss +1 -1
  119. package/telemetry.yml +2 -0
@@ -1,3 +1,121 @@
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
+ */
7
+ /// <reference path="../../../src/custom-typings/index.d.ts" />
8
+ import React, { PropsWithChildren, ReactNode } from 'react';
9
+ import PropTypes from 'prop-types';
10
+ import { ButtonProps } from '@carbon/react';
11
+ /**
12
+ * The accessibility title for the close icon (if shown).
13
+ *
14
+ * **Note:** This prop is only required if a close icon is shown, i.e. if
15
+ * there are a no navigation actions and/or hasCloseIcon is true.
16
+ */
17
+ export type CloseIconDescriptionTypes = {
18
+ hasCloseIcon?: false;
19
+ closeIconDescription?: string;
20
+ } | {
21
+ hasCloseIcon: true;
22
+ closeIconDescription: string;
23
+ };
24
+ interface TearsheetProps extends PropsWithChildren {
25
+ /**
26
+ * The navigation actions to be shown as buttons in the action area at the
27
+ * bottom of the tearsheet. Each action is specified as an object with
28
+ * optional fields: 'label' to supply the button label, 'kind' to select the
29
+ * button kind (must be 'primary', 'secondary' or 'ghost'), 'loading' to
30
+ * display a loading indicator, and 'onClick' to receive notifications when
31
+ * the button is clicked. Additional fields in the object will be passed to
32
+ * the Button component, and these can include 'disabled', 'ref', 'className',
33
+ * and any other Button props, except 'size'. Any other fields in the object will
34
+ * be passed through to the button element as HTML attributes.
35
+ *
36
+ * See https://react.carbondesignsystem.com/?path=/docs/components-button--default#component-api
37
+ */
38
+ actions: ButtonProps[];
39
+ /**
40
+ * The aria-label for the tearsheet, which is optional.
41
+ * if it is not passed, the title will be used as the aria-label.
42
+ */
43
+ ariaLabel?: string;
44
+ /**
45
+ * An optional class or classes to be added to the outermost element.
46
+ */
47
+ className?: string;
48
+ /**
49
+ * A description of the flow, displayed in the header area of the tearsheet.
50
+ */
51
+ description?: ReactNode;
52
+ /**
53
+ * Enable a close icon ('x') in the header area of the tearsheet. By default,
54
+ * (when this prop is omitted, or undefined or null) a tearsheet does not
55
+ * display a close icon if there are navigation actions ("transactional
56
+ * tearsheet") and displays one if there are no navigation actions ("passive
57
+ * tearsheet"), and that behavior can be overridden if required by setting
58
+ * this prop to either true or false.
59
+ */
60
+ hasCloseIcon?: boolean;
61
+ /**
62
+ * The content for the influencer section of the tearsheet, displayed
63
+ * alongside the main content. This is typically a menu, or filter, or
64
+ * progress indicator, or similar.
65
+ */
66
+ influencer?: ReactNode;
67
+ /**
68
+ * The position of the influencer section, 'left' or 'right'.
69
+ */
70
+ influencerPosition?: 'left' | 'right';
71
+ /**
72
+ * The width of the influencer: 'narrow' (the default) is 256px, and 'wide'
73
+ * is 320px.
74
+ */
75
+ influencerWidth?: 'narrow' | 'wide';
76
+ /**
77
+ * A label for the tearsheet, displayed in the header area of the tearsheet
78
+ * to maintain context for the tearsheet (e.g. as the title changes from page
79
+ * to page of a multi-page task).
80
+ */
81
+ label?: ReactNode;
82
+ /**
83
+ * Navigation content, such as a set of tabs, to be displayed at the bottom
84
+ * of the header area of the tearsheet.
85
+ */
86
+ navigation?: ReactNode;
87
+ /**
88
+ * An optional handler that is called when the user closes the tearsheet (by
89
+ * clicking the close button, if enabled, or clicking outside, if enabled).
90
+ * Returning `false` here prevents the modal from closing.
91
+ */
92
+ onClose?: () => void;
93
+ /**
94
+ * Specifies whether the tearsheet is currently open.
95
+ */
96
+ open?: boolean;
97
+ /**
98
+ * The DOM element that the tearsheet should be rendered within. Defaults to document.body.
99
+ */
100
+ portalTarget: ReactNode;
101
+ /**
102
+ * Specify a CSS selector that matches the DOM element that should be focused when the Modal opens
103
+ */
104
+ selectorPrimaryFocus?: string;
105
+ /**
106
+ * The main title of the tearsheet, displayed in the header area.
107
+ */
108
+ title?: ReactNode;
109
+ /** @deprecated */
110
+ /**
111
+ * The position of the top of tearsheet in the viewport. The 'normal'
112
+ * position is a short distance down from the top of the
113
+ * viewport, leaving room at the top for a global header bar to show through
114
+ * from below. The 'lower' position (the default) provides a little extra room at the top
115
+ * to allow an action bar navigation or breadcrumbs to also show through.
116
+ */
117
+ verticalPosition?: 'normal' | 'lower';
118
+ }
1
119
  /**
2
120
  * A tearsheet is a mostly full-screen type of dialog that keeps users
3
121
  * in-context and focused by bringing actionable content front and center while
@@ -10,9 +128,17 @@
10
128
  * panel on either the left or right side, the main content area, and a set of
11
129
  * action buttons.
12
130
  */
13
- export let Tearsheet: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
14
- export namespace deprecatedProps {
15
- let verticalPosition: PropTypes.Requireable<string>;
16
- }
17
- import React from 'react';
18
- import PropTypes from 'prop-types';
131
+ export declare let Tearsheet: React.ForwardRefExoticComponent<(TearsheetProps & CloseIconDescriptionTypes) & React.RefAttributes<HTMLDivElement>>;
132
+ export declare const deprecatedProps: {
133
+ /**
134
+ * **Deprecated**
135
+ *
136
+ * The position of the top of tearsheet in the viewport. The 'normal'
137
+ * position is a short distance down from the top of the
138
+ * viewport, leaving room at the top for a global header bar to show through
139
+ * from below. The 'lower' position (the default) provides a little extra room at the top
140
+ * to allow an action bar navigation or breadcrumbs to also show through.
141
+ */
142
+ verticalPosition: PropTypes.Requireable<string>;
143
+ };
144
+ export {};
@@ -23,17 +23,24 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
23
23
 
24
24
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
25
25
 
26
- var _excluded = ["influencerPosition", "influencerWidth", "verticalPosition"];
26
+ var _excluded = ["influencerPosition", "influencerWidth"];
27
27
  var componentName = 'Tearsheet';
28
28
 
29
29
  // NOTE: the component SCSS is not imported here: it is rolled up separately.
30
30
 
31
- // Default values for props
32
- var defaults = {
33
- influencerPosition: 'left',
34
- influencerWidth: 'narrow',
35
- verticalPosition: 'lower'
36
- };
31
+ /**
32
+ * The accessibility title for the close icon (if shown).
33
+ *
34
+ * **Note:** This prop is only required if a close icon is shown, i.e. if
35
+ * there are a no navigation actions and/or hasCloseIcon is true.
36
+ */
37
+
38
+ // The types and DocGen commentary for the component props,
39
+ // in alphabetical order (for consistency).
40
+ // See https://www.npmjs.com/package/prop-types#usage.
41
+
42
+ // Note that the descriptions here should be kept in sync with those for the
43
+ // corresponding props for TearsheetNarrow and TearsheetShell components.
37
44
 
38
45
  /**
39
46
  * A tearsheet is a mostly full-screen type of dialog that keeps users
@@ -49,16 +56,13 @@ var defaults = {
49
56
  */
50
57
  exports.Tearsheet = /*#__PURE__*/React__default["default"].forwardRef(function (_ref, ref) {
51
58
  var _ref$influencerPositi = _ref.influencerPosition,
52
- influencerPosition = _ref$influencerPositi === void 0 ? defaults.influencerPosition : _ref$influencerPositi,
59
+ influencerPosition = _ref$influencerPositi === void 0 ? 'left' : _ref$influencerPositi,
53
60
  _ref$influencerWidth = _ref.influencerWidth,
54
- influencerWidth = _ref$influencerWidth === void 0 ? defaults.influencerWidth : _ref$influencerWidth,
55
- _ref$verticalPosition = _ref.verticalPosition,
56
- verticalPosition = _ref$verticalPosition === void 0 ? defaults.verticalPosition : _ref$verticalPosition,
61
+ influencerWidth = _ref$influencerWidth === void 0 ? 'narrow' : _ref$influencerWidth,
57
62
  rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
58
63
  return /*#__PURE__*/React__default["default"].createElement(TearsheetShell.TearsheetShell, _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, devtools.getDevtoolsProps(componentName)), rest), {}, {
59
64
  influencerPosition: influencerPosition,
60
65
  influencerWidth: influencerWidth,
61
- verticalPosition: verticalPosition,
62
66
  ref: ref,
63
67
  size: 'wide'
64
68
  }));
@@ -103,7 +107,8 @@ exports.Tearsheet.propTypes = _rollupPluginBabelHelpers.objectSpread2({
103
107
  *
104
108
  * See https://react.carbondesignsystem.com/?path=/docs/components-button--default#component-api
105
109
  */
106
- actions: propsHelper.allPropTypes([ActionSet.ActionSet.validateActions(function () {
110
+ actions: propsHelper.allPropTypes([/**@ts-ignore */
111
+ ActionSet.ActionSet.validateActions(function () {
107
112
  return '2xl';
108
113
  }), index["default"].arrayOf(index["default"].shape(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, react.Button.propTypes), {}, {
109
114
  kind: index["default"].oneOf(['ghost', 'danger--ghost', 'secondary', 'danger', 'primary']),
@@ -127,6 +132,7 @@ exports.Tearsheet.propTypes = _rollupPluginBabelHelpers.objectSpread2({
127
132
  * **Note:** This prop is only required if a close icon is shown, i.e. if
128
133
  * there are a no navigation actions and/or hasCloseIcon is true.
129
134
  */
135
+ /**@ts-ignore */
130
136
  closeIconDescription: index["default"].string.isRequired.if(function (_ref2) {
131
137
  var actions = _ref2.actions,
132
138
  hasCloseIcon = _ref2.hasCloseIcon;
@@ -144,6 +150,7 @@ exports.Tearsheet.propTypes = _rollupPluginBabelHelpers.objectSpread2({
144
150
  * tearsheet"), and that behavior can be overridden if required by setting
145
151
  * this prop to either true or false.
146
152
  */
153
+ /**@ts-ignore */
147
154
  hasCloseIcon: index["default"].bool,
148
155
  /**
149
156
  * The content for the influencer section of the tearsheet, displayed
@@ -166,6 +173,10 @@ exports.Tearsheet.propTypes = _rollupPluginBabelHelpers.objectSpread2({
166
173
  * to page of a multi-page task).
167
174
  */
168
175
  label: index["default"].node,
176
+ /**
177
+ * Provide a ref to return focus to once the tearsheet is closed.
178
+ */
179
+ launcherButtonRef: index["default"].any,
169
180
  /**
170
181
  * Navigation content, such as a set of tabs, to be displayed at the bottom
171
182
  * of the header area of the tearsheet.
@@ -184,6 +195,7 @@ exports.Tearsheet.propTypes = _rollupPluginBabelHelpers.objectSpread2({
184
195
  /**
185
196
  * The DOM element that the tearsheet should be rendered within. Defaults to document.body.
186
197
  */
198
+ /**@ts-ignore */
187
199
  portalTarget: TearsheetShell.portalType,
188
200
  /**
189
201
  * Specify a CSS selector that matches the DOM element that should be focused when the Modal opens
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  /// <reference path="../../../src/custom-typings/index.d.ts" />
8
- import React, { PropsWithChildren, ReactNode } from 'react';
8
+ import React, { PropsWithChildren, ReactNode, RefObject } from 'react';
9
9
  import PropTypes from 'prop-types';
10
10
  import { type ButtonProps } from '@carbon/react';
11
11
  interface TearsheetShellProps extends PropsWithChildren {
@@ -57,6 +57,10 @@ interface TearsheetShellProps extends PropsWithChildren {
57
57
  * to page of a multi-page task).
58
58
  */
59
59
  label?: ReactNode;
60
+ /**
61
+ * Provide a ref to return focus to once the tearsheet is closed.
62
+ */
63
+ launcherButtonRef?: RefObject<any>;
60
64
  /**
61
65
  * Navigation content, such as a set of tabs, to be displayed at the bottom
62
66
  * of the header area of the tearsheet. NB the navigation is only applicable
@@ -21,6 +21,7 @@ var react = require('@carbon/react');
21
21
  var Wrap = require('../../global/js/utils/Wrap.js');
22
22
  var usePortalTarget = require('../../global/js/hooks/usePortalTarget.js');
23
23
  var useFocus = require('../../global/js/hooks/useFocus.js');
24
+ var usePreviousValue = require('../../global/js/hooks/usePreviousValue.js');
24
25
  var ActionSet = require('../ActionSet/ActionSet.js');
25
26
 
26
27
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
@@ -28,7 +29,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
28
29
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
29
30
  var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
30
31
 
31
- var _excluded = ["actions", "ariaLabel", "children", "className", "closeIconDescription", "description", "hasCloseIcon", "headerActions", "influencer", "influencerPosition", "influencerWidth", "label", "navigation", "onClose", "open", "portalTarget", "selectorPrimaryFocus", "size", "slug", "title", "verticalPosition"];
32
+ var _excluded = ["actions", "ariaLabel", "children", "className", "closeIconDescription", "description", "hasCloseIcon", "headerActions", "influencer", "influencerPosition", "influencerWidth", "label", "navigation", "onClose", "open", "portalTarget", "selectorPrimaryFocus", "size", "slug", "title", "verticalPosition", "launcherButtonRef"];
32
33
 
33
34
  // The block part of our conventional BEM class names (bc__E--M).
34
35
  var bc = "".concat(settings.pkg.prefix, "--tearsheet");
@@ -91,6 +92,7 @@ var TearsheetShell = /*#__PURE__*/React__default["default"].forwardRef(function
91
92
  slug = _ref.slug,
92
93
  title = _ref.title,
93
94
  verticalPosition = _ref.verticalPosition,
95
+ launcherButtonRef = _ref.launcherButtonRef,
94
96
  rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
95
97
  var carbonPrefix = react.usePrefix();
96
98
  var bcModalHeader = "".concat(carbonPrefix, "--modal-header");
@@ -101,9 +103,11 @@ var TearsheetShell = /*#__PURE__*/React__default["default"].forwardRef(function
101
103
  var modalRef = ref || localRef;
102
104
  var _useResizeObserver = useResizeObserver.useResizeObserver(resizer),
103
105
  width = _useResizeObserver.width;
104
- var _useFocus = useFocus.useFocus(modalRef),
106
+ var prevOpen = usePreviousValue.usePreviousValue(open);
107
+ var _useFocus = useFocus.useFocus(modalRef, selectorPrimaryFocus),
105
108
  firstElement = _useFocus.firstElement,
106
- keyDownListener = _useFocus.keyDownListener;
109
+ keyDownListener = _useFocus.keyDownListener,
110
+ specifiedElement = _useFocus.specifiedElement;
107
111
  var modalRefValue = modalRef.current;
108
112
  var wide = size === 'wide';
109
113
 
@@ -142,17 +146,30 @@ var TearsheetShell = /*#__PURE__*/React__default["default"].forwardRef(function
142
146
 
143
147
  // Callback to give the tearsheet the opportunity to claim focus
144
148
  handleStackChange.claimFocus = function () {
149
+ if (selectorPrimaryFocus) {
150
+ return specifiedElement === null || specifiedElement === void 0 ? void 0 : specifiedElement.focus();
151
+ }
145
152
  firstElement === null || firstElement === void 0 || firstElement.focus();
146
153
  };
147
154
  React.useEffect(function () {
148
155
  if (open) {
149
- // Focusing the first element
156
+ // Focusing the first element or selectorPrimaryFocus element
150
157
  setTimeout(function () {
158
+ if (selectorPrimaryFocus) {
159
+ return specifiedElement === null || specifiedElement === void 0 ? void 0 : specifiedElement.focus();
160
+ }
151
161
  firstElement === null || firstElement === void 0 || firstElement.focus();
152
162
  }, 0);
153
163
  }
154
164
  // eslint-disable-next-line react-hooks/exhaustive-deps
155
165
  }, [open]);
166
+ React.useEffect(function () {
167
+ if (prevOpen && !open && launcherButtonRef) {
168
+ setTimeout(function () {
169
+ launcherButtonRef.current.focus();
170
+ }, 0);
171
+ }
172
+ }, [launcherButtonRef, open, prevOpen]);
156
173
  React.useEffect(function () {
157
174
  if (open && position !== depth) {
158
175
  setTimeout(function () {
@@ -411,6 +428,11 @@ TearsheetShell.propTypes = _rollupPluginBabelHelpers.objectSpread2({
411
428
  * to page of a multi-page task).
412
429
  */
413
430
  label: index["default"].node,
431
+ /**
432
+ * Provide a ref to return focus to once the tearsheet is closed.
433
+ */
434
+ /**@ts-ignore */
435
+ launcherButtonRef: index["default"].any,
414
436
  /**
415
437
  * Navigation content, such as a set of tabs, to be displayed at the bottom
416
438
  * of the header area of the tearsheet. NB the navigation is only applicable
@@ -41,6 +41,10 @@ interface WebTerminalProps extends PropsWithChildren {
41
41
  * Optionally pass if the web terminal should be open by default
42
42
  */
43
43
  isInitiallyOpen?: boolean;
44
+ /**
45
+ * Specifies aria label for Web terminal
46
+ */
47
+ webTerminalAriaLabel?: string;
44
48
  }
45
49
  /**
46
50
  * The `WebTerminal` is prompted by the user and is persistent until dismissed. The purpose of a web terminal is to provide users with the ability to type commands manually instead of using the GUI.
@@ -25,7 +25,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
25
25
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
26
26
  var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
27
27
 
28
- var _excluded = ["actions", "children", "className", "closeIconDescription", "documentationLinks", "documentationLinksIconDescription", "isInitiallyOpen"];
28
+ var _excluded = ["actions", "children", "className", "closeIconDescription", "documentationLinks", "documentationLinksIconDescription", "isInitiallyOpen", "webTerminalAriaLabel"];
29
29
 
30
30
  // The block part of our conventional BEM class names (blockClass__E--M).
31
31
  var componentName = 'WebTerminal';
@@ -36,7 +36,8 @@ var defaults = {
36
36
  actions: Object.freeze([]),
37
37
  documentationLinks: Object.freeze([]),
38
38
  documentationLinksIconDescription: 'Show documentation links',
39
- isInitiallyOpen: false
39
+ isInitiallyOpen: false,
40
+ webTerminalAriaLabel: 'Web terminal header'
40
41
  };
41
42
  /**
42
43
  * The `WebTerminal` is prompted by the user and is persistent until dismissed. The purpose of a web terminal is to provide users with the ability to type commands manually instead of using the GUI.
@@ -53,6 +54,8 @@ exports.WebTerminal = /*#__PURE__*/React__default["default"].forwardRef(function
53
54
  documentationLinksIconDescription = _ref$documentationLin2 === void 0 ? defaults.documentationLinksIconDescription : _ref$documentationLin2,
54
55
  _ref$isInitiallyOpen = _ref.isInitiallyOpen,
55
56
  isInitiallyOpen = _ref$isInitiallyOpen === void 0 ? defaults.isInitiallyOpen : _ref$isInitiallyOpen,
57
+ _ref$webTerminalAriaL = _ref.webTerminalAriaLabel,
58
+ webTerminalAriaLabel = _ref$webTerminalAriaL === void 0 ? defaults.webTerminalAriaLabel : _ref$webTerminalAriaL,
56
59
  rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
57
60
  var _useWebTerminal = index.useWebTerminal(),
58
61
  open = _useWebTerminal.open,
@@ -111,6 +114,7 @@ exports.WebTerminal = /*#__PURE__*/React__default["default"].forwardRef(function
111
114
  },
112
115
  onAnimationEnd: onAnimationEnd
113
116
  }), /*#__PURE__*/React__default["default"].createElement("header", {
117
+ "aria-label": webTerminalAriaLabel,
114
118
  className: "".concat(blockClass, "__bar")
115
119
  }, /*#__PURE__*/React__default["default"].createElement("div", {
116
120
  className: "".concat(blockClass, "__actions")
@@ -205,5 +209,9 @@ exports.WebTerminal.propTypes = {
205
209
  /**
206
210
  * Optionally pass if the web terminal should be open by default
207
211
  */
208
- isInitiallyOpen: index$1["default"].bool
212
+ isInitiallyOpen: index$1["default"].bool,
213
+ /**
214
+ * Specifies aria label for Web terminal
215
+ */
216
+ webTerminalAriaLabel: index$1["default"].string
209
217
  };
@@ -1,11 +1,13 @@
1
- export function useFocus(modalRef: any): {
1
+ export function useFocus(modalRef: any, selectorPrimaryFocus: any): {
2
2
  firstElement: any;
3
3
  lastElement: any;
4
4
  allElements: any;
5
+ specifiedElement: any;
5
6
  keyDownListener: (event: any) => void;
6
7
  getFocusable: () => {
7
8
  first: any;
8
9
  last: any;
9
10
  all: any;
11
+ specifiedElement: any;
10
12
  };
11
13
  };
@@ -13,7 +13,7 @@ var react = require('@carbon/react');
13
13
  var settings = require('../../../settings.js');
14
14
  var React = require('react');
15
15
 
16
- var useFocus = function useFocus(modalRef) {
16
+ var useFocus = function useFocus(modalRef, selectorPrimaryFocus) {
17
17
  var carbonPrefix = react.usePrefix();
18
18
  var tearsheetBaseClass = "".concat(settings.pkg.prefix, "--tearsheet");
19
19
  // Querying focusable element in the modal
@@ -43,12 +43,14 @@ var useFocus = function useFocus(modalRef) {
43
43
  var first = (_focusableElements2 = focusableElements) === null || _focusableElements2 === void 0 ? void 0 : _focusableElements2[0];
44
44
  var last = (_focusableElements3 = focusableElements) === null || _focusableElements3 === void 0 ? void 0 : _focusableElements3[((_focusableElements4 = focusableElements) === null || _focusableElements4 === void 0 ? void 0 : _focusableElements4.length) - 1];
45
45
  var all = focusableElements;
46
+ var specifiedElement = selectorPrimaryFocus ? modalEl === null || modalEl === void 0 ? void 0 : modalEl.querySelector(selectorPrimaryFocus) : null;
46
47
  return {
47
48
  first: first,
48
49
  last: last,
49
- all: all
50
+ all: all,
51
+ specifiedElement: specifiedElement
50
52
  };
51
- }, [modalEl, query]);
53
+ }, [modalEl, query, selectorPrimaryFocus]);
52
54
  React.useEffect(function () {
53
55
  getFocusable();
54
56
  }, [getFocusable]);
@@ -80,6 +82,7 @@ var useFocus = function useFocus(modalRef) {
80
82
  firstElement: getFocusable().first,
81
83
  lastElement: getFocusable().last,
82
84
  allElements: getFocusable().all,
85
+ specifiedElement: getFocusable().specified,
83
86
  keyDownListener: handleKeyDown,
84
87
  getFocusable: getFocusable
85
88
  };
@@ -5,5 +5,5 @@ export function useRetrieveStepData({ stepsContext, stepNumber, introStep, inval
5
5
  invalid: boolean;
6
6
  shouldIncludeStep: boolean;
7
7
  secondaryLabel: string;
8
- title: string;
8
+ title: React.ReactNode;
9
9
  }): void;
@@ -22,7 +22,7 @@ var React = require('react');
22
22
  * @param {boolean} useResetCreateComponent.invalid
23
23
  * @param {boolean} useResetCreateComponent.shouldIncludeStep
24
24
  * @param {string} useResetCreateComponent.secondaryLabel
25
- * @param {string} useResetCreateComponent.title
25
+ * @param {React.ReactNode} useResetCreateComponent.title
26
26
  */
27
27
  var useRetrieveStepData = function useRetrieveStepData(_ref) {
28
28
  var stepsContext = _ref.stepsContext,
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.39.0",
4
+ "version": "2.40.0",
5
5
  "license": "Apache-2.0",
6
6
  "main": "lib/index.js",
7
7
  "module": "es/index.js",
@@ -92,7 +92,7 @@
92
92
  },
93
93
  "dependencies": {
94
94
  "@babel/runtime": "^7.23.9",
95
- "@carbon/ibm-products-styles": "^2.37.0",
95
+ "@carbon/ibm-products-styles": "^2.37.1",
96
96
  "@carbon/telemetry": "^0.1.0",
97
97
  "@dnd-kit/core": "^6.0.8",
98
98
  "@dnd-kit/modifiers": "^7.0.0",
@@ -116,5 +116,5 @@
116
116
  "react": "^16.8.6 || ^17.0.1 || ^18.2.0",
117
117
  "react-dom": "^16.8.6 || ^17.0.1 || ^18.2.0"
118
118
  },
119
- "gitHead": "90e3441d8fdfc65023988bd734089c72fba0799b"
119
+ "gitHead": "2fbbfdc269add9b97a3eac30e5570b91ec80fd82"
120
120
  }
@@ -14,6 +14,7 @@
14
14
  @use '@carbon/react/scss/motion' as *;
15
15
  @use '@carbon/react/scss/colors' as *;
16
16
  @use '@carbon/react/scss/theme' as *;
17
+ @use '@carbon/layout/scss/convert';
17
18
  @use '@carbon/styles/scss/components/button/tokens' as *;
18
19
  // Other Carbon settings if needed
19
20
  // TODO: @use '@carbon/styles/scss/grid';
@@ -43,7 +44,7 @@ $stack-home-class: #{c4p-settings.$pkg-prefix}--coachmark-stacked-home;
43
44
  &--is-mounted {
44
45
  bottom: 0;
45
46
  /* stylelint-disable-next-line carbon/motion-easing-use, carbon/motion-duration-use */
46
- transition: transform $duration-moderate-02 motion(exit, productive);
47
+ transition: $duration-moderate-02 motion(exit, productive);
47
48
  @media (prefers-reduced-motion) {
48
49
  transition: none;
49
50
  }
@@ -60,7 +61,8 @@ $stack-home-class: #{c4p-settings.$pkg-prefix}--coachmark-stacked-home;
60
61
  bottom: 0;
61
62
  overflow: hidden;
62
63
  pointer-events: none;
63
- transform: perspective(carbon--mini-units(18))
64
+ /* stylelint-disable-next-line function-no-unknown -- to-rem carbon replacement for rem */
65
+ transform: perspective(convert.to-rem(144px))
64
66
  translate3d(0, calc($spacing-09 * -1), calc($spacing-05 * -1));
65
67
  transform-origin: top center;
66
68
  visibility: visible;
@@ -14,5 +14,6 @@ $side-panel-sizes: (
14
14
  sm: 20rem,
15
15
  md: 30rem,
16
16
  lg: 40rem,
17
+ xl: 65rem,
17
18
  2xl: 40rem 75%,
18
19
  );
@@ -48,7 +48,7 @@ $popover-block-class: #{c4p-settings.$carbon-prefix}--popover;
48
48
  line-height: inherit;
49
49
  }
50
50
 
51
- .#{$popover-block-class} {
51
+ .#{$block-class} .#{$popover-block-class} {
52
52
  max-width: $spacing-05;
53
53
  margin: 0 auto;
54
54
  }
package/telemetry.yml CHANGED
@@ -132,6 +132,7 @@ collect:
132
132
  - kind
133
133
  - label
134
134
  - labelText
135
+ - launcherButtonRef
135
136
  - legendText
136
137
  - link
137
138
  - links
@@ -795,6 +796,7 @@ collect:
795
796
  - documentationLinks
796
797
  - documentationLinksIconDescription
797
798
  - isInitiallyOpen
799
+ - webTerminalAriaLabel
798
800
  # React
799
801
  - key
800
802
  - ref