@carbon/ibm-products 2.73.1 → 2.74.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 (154) hide show
  1. package/css/index-full-carbon.css +56 -6
  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 -1
  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 +56 -6
  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 +56 -6
  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/AboutModal/AboutModal.d.ts +17 -23
  18. package/es/components/AboutModal/AboutModal.js +17 -23
  19. package/es/components/AddSelect/AddSelectBody.js +1 -1
  20. package/es/components/Carousel/Carousel.js +1 -1
  21. package/es/components/Coachmark/Coachmark.d.ts +4 -0
  22. package/es/components/Coachmark/Coachmark.js +9 -2
  23. package/es/components/Coachmark/CoachmarkDragbar.d.ts +0 -4
  24. package/es/components/Coachmark/CoachmarkDragbar.js +2 -6
  25. package/es/components/Coachmark/CoachmarkHeader.d.ts +0 -4
  26. package/es/components/Coachmark/CoachmarkHeader.js +2 -2
  27. package/es/components/Coachmark/CoachmarkTagline.js +5 -3
  28. package/es/components/Coachmark/next/Coachmark/Coachmark.d.ts +1 -22
  29. package/es/components/Coachmark/next/Coachmark/Coachmark.js +14 -29
  30. package/es/components/Coachmark/next/Coachmark/CoachmarkBeacon/CoachmarkBeacon.d.ts +1 -0
  31. package/es/components/Coachmark/next/Coachmark/CoachmarkBubble/CoachmarkBubble.js +13 -2
  32. package/es/components/Coachmark/next/Coachmark/CoachmarkContent.js +2 -2
  33. package/es/components/Coachmark/next/Coachmark/ContentBody.js +1 -1
  34. package/es/components/Coachmark/next/Coachmark/ContentHeader.js +15 -1
  35. package/es/components/Coachmark/next/Coachmark/context.d.ts +25 -0
  36. package/es/components/Coachmark/next/Coachmark/context.js +28 -0
  37. package/es/components/Coachmark/utils/context.d.ts +2 -2
  38. package/es/components/CoachmarkFixed/CoachmarkFixed.d.ts +4 -0
  39. package/es/components/CoachmarkFixed/CoachmarkFixed.js +6 -1
  40. package/es/components/CoachmarkStack/CoachmarkStack.d.ts +4 -0
  41. package/es/components/CoachmarkStack/CoachmarkStack.js +7 -1
  42. package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +11 -7
  43. package/es/components/ConditionBuilder/ConditionBuilder.js +11 -2
  44. package/es/components/ConditionBuilder/ConditionBuilder.types.d.ts +10 -0
  45. package/es/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.js +10 -5
  46. package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +14 -3
  47. package/es/components/ConditionBuilder/ConditionBuilderConnector/ConditionConnector.js +2 -2
  48. package/es/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.js +1 -1
  49. package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +5 -4
  50. package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +2 -1
  51. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +8 -2
  52. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.d.ts +4 -3
  53. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js +20 -4
  54. package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +1 -1
  55. package/es/components/ConditionBuilder/index.d.ts +1 -0
  56. package/es/components/ConditionBuilder/utils/handleKeyboardEvents.js +12 -7
  57. package/es/components/ConditionBuilder/utils/useDataConfigs.d.ts +1 -1
  58. package/es/components/ConditionBuilder/utils/util.d.ts +1 -1
  59. package/es/components/ConditionBuilder/utils/util.js +2 -2
  60. package/es/components/Datagrid/Datagrid/DatagridEmptyBody.js +1 -1
  61. package/es/components/EmptyStates/EmptyState.js +1 -1
  62. package/es/components/EmptyStates/{EmptyStateV2.js → EmptyStateV2.deprecated.js} +1 -1
  63. package/es/components/EmptyStates/index.d.ts +2 -2
  64. package/es/components/NotificationsPanel/NotificationsPanel.js +1 -1
  65. package/es/components/SidePanel/SidePanel.d.ts +1 -0
  66. package/es/components/SidePanel/SidePanel.js +1 -0
  67. package/es/components/StepFlow/StepContext.d.ts +14 -0
  68. package/es/components/StepFlow/StepGroup.d.ts +10 -0
  69. package/es/components/StepFlow/index.d.ts +9 -0
  70. package/es/components/StepFlow/story-assets/SidePanel/Example.d.ts +8 -0
  71. package/es/components/StepFlow/story-assets/SidePanel/StepSidePanel.d.ts +20 -0
  72. package/es/components/StepFlow/story-assets/StepActions.d.ts +23 -0
  73. package/es/components/StepFlow/story-assets/Tearsheet/Example.d.ts +8 -0
  74. package/es/components/StepFlow/story-assets/Tearsheet/StepTearsheet.d.ts +20 -0
  75. package/es/components/StepFlow/types.d.ts +22 -0
  76. package/es/components/TruncatedText/TruncatedText.js +4 -2
  77. package/es/global/js/utils/makeDraggable/makeDraggable.js +28 -0
  78. package/es/index.js +1 -1
  79. package/lib/components/AboutModal/AboutModal.d.ts +17 -23
  80. package/lib/components/AboutModal/AboutModal.js +17 -23
  81. package/lib/components/AddSelect/AddSelectBody.js +1 -1
  82. package/lib/components/Carousel/Carousel.js +1 -1
  83. package/lib/components/Coachmark/Coachmark.d.ts +4 -0
  84. package/lib/components/Coachmark/Coachmark.js +9 -2
  85. package/lib/components/Coachmark/CoachmarkDragbar.d.ts +0 -4
  86. package/lib/components/Coachmark/CoachmarkDragbar.js +2 -6
  87. package/lib/components/Coachmark/CoachmarkHeader.d.ts +0 -4
  88. package/lib/components/Coachmark/CoachmarkHeader.js +2 -2
  89. package/lib/components/Coachmark/CoachmarkTagline.js +5 -3
  90. package/lib/components/Coachmark/next/Coachmark/Coachmark.d.ts +1 -22
  91. package/lib/components/Coachmark/next/Coachmark/Coachmark.js +16 -33
  92. package/lib/components/Coachmark/next/Coachmark/CoachmarkBeacon/CoachmarkBeacon.d.ts +1 -0
  93. package/lib/components/Coachmark/next/Coachmark/CoachmarkBubble/CoachmarkBubble.js +13 -2
  94. package/lib/components/Coachmark/next/Coachmark/CoachmarkContent.js +5 -5
  95. package/lib/components/Coachmark/next/Coachmark/ContentBody.js +2 -2
  96. package/lib/components/Coachmark/next/Coachmark/ContentHeader.js +17 -3
  97. package/lib/components/Coachmark/next/Coachmark/context.d.ts +25 -0
  98. package/lib/components/Coachmark/next/Coachmark/context.js +31 -0
  99. package/lib/components/Coachmark/utils/context.d.ts +2 -2
  100. package/lib/components/CoachmarkFixed/CoachmarkFixed.d.ts +4 -0
  101. package/lib/components/CoachmarkFixed/CoachmarkFixed.js +6 -1
  102. package/lib/components/CoachmarkStack/CoachmarkStack.d.ts +4 -0
  103. package/lib/components/CoachmarkStack/CoachmarkStack.js +7 -1
  104. package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +11 -7
  105. package/lib/components/ConditionBuilder/ConditionBuilder.js +11 -2
  106. package/lib/components/ConditionBuilder/ConditionBuilder.types.d.ts +10 -0
  107. package/lib/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.js +10 -5
  108. package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +13 -2
  109. package/lib/components/ConditionBuilder/ConditionBuilderConnector/ConditionConnector.js +2 -2
  110. package/lib/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.js +1 -1
  111. package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +5 -4
  112. package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +2 -1
  113. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +8 -2
  114. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.d.ts +4 -3
  115. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js +20 -4
  116. package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +1 -1
  117. package/lib/components/ConditionBuilder/index.d.ts +1 -0
  118. package/lib/components/ConditionBuilder/utils/handleKeyboardEvents.js +11 -6
  119. package/lib/components/ConditionBuilder/utils/useDataConfigs.d.ts +1 -1
  120. package/lib/components/ConditionBuilder/utils/util.d.ts +1 -1
  121. package/lib/components/ConditionBuilder/utils/util.js +2 -2
  122. package/lib/components/Datagrid/Datagrid/DatagridEmptyBody.js +1 -1
  123. package/lib/components/EmptyStates/EmptyState.js +2 -2
  124. package/lib/components/EmptyStates/{EmptyStateV2.js → EmptyStateV2.deprecated.js} +2 -2
  125. package/lib/components/EmptyStates/index.d.ts +2 -2
  126. package/lib/components/NotificationsPanel/NotificationsPanel.js +1 -1
  127. package/lib/components/SidePanel/SidePanel.d.ts +1 -0
  128. package/lib/components/SidePanel/SidePanel.js +1 -0
  129. package/lib/components/StepFlow/StepContext.d.ts +14 -0
  130. package/lib/components/StepFlow/StepGroup.d.ts +10 -0
  131. package/lib/components/StepFlow/index.d.ts +9 -0
  132. package/lib/components/StepFlow/story-assets/SidePanel/Example.d.ts +8 -0
  133. package/lib/components/StepFlow/story-assets/SidePanel/StepSidePanel.d.ts +20 -0
  134. package/lib/components/StepFlow/story-assets/StepActions.d.ts +23 -0
  135. package/lib/components/StepFlow/story-assets/Tearsheet/Example.d.ts +8 -0
  136. package/lib/components/StepFlow/story-assets/Tearsheet/StepTearsheet.d.ts +20 -0
  137. package/lib/components/StepFlow/types.d.ts +22 -0
  138. package/lib/components/TruncatedText/TruncatedText.js +4 -2
  139. package/lib/global/js/utils/makeDraggable/makeDraggable.js +28 -0
  140. package/lib/index.js +2 -2
  141. package/package.json +7 -7
  142. package/scss/components/Coachmark/_coachmark.scss +7 -0
  143. package/scss/components/ConditionBuilder/styles/_conditionBuilderCondition.scss +24 -0
  144. package/scss/components/ConditionBuilder/styles/_conditionBuilderItem.scss +26 -12
  145. package/scss/components/SidePanel/_side-panel.scss +6 -1
  146. package/scss/components/Tearsheet/_tearsheet.scss +1 -0
  147. package/scss/components/TruncatedText/_truncated-text.scss +1 -0
  148. package/telemetry.yml +1 -1
  149. /package/es/components/EmptyStates/{EmptyStateIllustration.d.ts → EmptyStateIllustration.deprecated.d.ts} +0 -0
  150. /package/es/components/EmptyStates/{EmptyStateIllustration.js → EmptyStateIllustration.deprecated.js} +0 -0
  151. /package/es/components/EmptyStates/{EmptyStateV2.d.ts → EmptyStateV2.deprecated.d.ts} +0 -0
  152. /package/lib/components/EmptyStates/{EmptyStateIllustration.d.ts → EmptyStateIllustration.deprecated.d.ts} +0 -0
  153. /package/lib/components/EmptyStates/{EmptyStateIllustration.js → EmptyStateIllustration.deprecated.js} +0 -0
  154. /package/lib/components/EmptyStates/{EmptyStateV2.d.ts → EmptyStateV2.deprecated.d.ts} +0 -0
@@ -7,65 +7,59 @@
7
7
  import React, { ReactNode } from 'react';
8
8
  export interface AboutModalProps {
9
9
  /**
10
- * If you are legally required to display logos of technologies used
11
- * to build your product you can provide this in the additionalInfo.
12
- * Additional information will be displayed in the footer.
10
+ * Provide additional detail for the modal footer, such as logos of
11
+ * technologies used in the product, legally required for some products
13
12
  */
14
13
  additionalInfo?: ReactNode;
15
14
  /**
16
- * Provide an optional class to be applied to the modal root node.
15
+ * Specify an optional className to be applied to the modal root node
17
16
  */
18
17
  className?: string;
19
18
  /**
20
- * The accessibility title for the close icon.
19
+ * Provide an accessible name for the close icon
21
20
  */
22
21
  closeIconDescription: string;
23
22
  /**
24
- * Subhead text providing any relevant product disclaimers including
25
- * legal information (optional)
23
+ * Provide any relevant product disclaimers or legal information
26
24
  */
27
25
  content?: ReactNode;
28
26
  /**
29
- * Trademark and copyright information. Displays first year of
30
- * product release to current year.
27
+ * Specify the first year of product release to the current year
31
28
  */
32
29
  copyrightText: string;
33
30
  /**
34
- * An array of Carbon `Link` component if there are additional information
35
- * to call out within the card. The about modal should be used to display
36
- * the product information and not where users go to find help (optional)
31
+ * Provide an array of Carbon `Link`s for additional detail about the
32
+ * product
37
33
  */
38
34
  links?: ReactNode[];
39
35
  /**
40
- * A visual symbol used to represent the product.
36
+ * Provide a visual representation of the product
41
37
  */
42
38
  logo: ReactNode;
43
39
  /**
44
- * Specifies aria label for AboutModal
40
+ * Specify an aria-label for the modal
45
41
  */
46
42
  modalAriaLabel?: string;
47
43
  /**
48
- * Specifies an optional handler which is called when the AboutModal
49
- * is closed. Returning `false` prevents the AboutModal from closing.
44
+ * Specify an optional handler for closing modal. Returning `false`
45
+ * prevents the modal from closing
50
46
  */
51
47
  onClose?: () => void | boolean;
52
48
  /**
53
- * Specifies whether the AboutModal is open or not.
49
+ * Specify whether the modal is currently open
54
50
  */
55
51
  open?: boolean;
56
52
  /**
57
- * The DOM node the tearsheet should be rendered within. Defaults to document.body.
53
+ * Provide the DOM node where the modal should be rendered.
54
+ * Defaults to `document.body`
58
55
  */
59
56
  portalTarget?: ReactNode;
60
57
  /**
61
- * Header text that provides the product name. The IBM Services logo
62
- * consists of two discrete, but required, elements: the iconic
63
- * IBM 8-bar logo represented alongside the IBM Services logotype.
64
- * Please follow these guidelines to ensure proper execution.
58
+ * Provide the product name for the modal header
65
59
  */
66
60
  title: ReactNode;
67
61
  /**
68
- * Text that provides information on the version number of your product.
62
+ * Provide the product’s version number
69
63
  */
70
64
  version: string;
71
65
  }
@@ -118,65 +118,59 @@ AboutModal.displayName = componentName;
118
118
  // See https://www.npmjs.com/package/prop-types#usage.
119
119
  AboutModal.propTypes = {
120
120
  /**
121
- * If you are legally required to display logos of technologies used
122
- * to build your product you can provide this in the additionalInfo.
123
- * Additional information will be displayed in the footer.
121
+ * Provide additional detail for the modal footer, such as logos of
122
+ * technologies used in the product, legally required for some products
124
123
  */
125
124
  additionalInfo: PropTypes.node,
126
125
  /**
127
- * Provide an optional class to be applied to the modal root node.
126
+ * Specify an optional className to be applied to the modal root node
128
127
  */
129
128
  className: PropTypes.string,
130
129
  /**
131
- * The accessibility title for the close icon.
130
+ * Provide an accessible name for the close icon
132
131
  */
133
132
  closeIconDescription: PropTypes.string.isRequired,
134
133
  /**
135
- * Subhead text providing any relevant product disclaimers including
136
- * legal information (optional)
134
+ * Provide any relevant product disclaimers or legal information
137
135
  */
138
136
  content: PropTypes.node,
139
137
  /**
140
- * Trademark and copyright information. Displays first year of
141
- * product release to current year.
138
+ * Specify the first year of product release to the current year
142
139
  */
143
140
  copyrightText: PropTypes.string.isRequired,
144
141
  /**
145
- * An array of Carbon `Link` component if there are additional information
146
- * to call out within the card. The about modal should be used to display
147
- * the product information and not where users go to find help (optional)
142
+ * Provide an array of Carbon `Link`s for additional detail about the
143
+ * product
148
144
  */
149
145
  links: PropTypes.arrayOf(PropTypes.element),
150
146
  /**
151
- * A visual symbol used to represent the product.
147
+ * Provide a visual representation of the product
152
148
  */
153
149
  logo: PropTypes.node.isRequired,
154
150
  /**
155
- * Specifies aria label for AboutModal
151
+ * Specify an aria-label for the modal
156
152
  */
157
153
  modalAriaLabel: PropTypes.string,
158
154
  /**
159
- * Specifies an optional handler which is called when the AboutModal
160
- * is closed. Returning `false` prevents the AboutModal from closing.
155
+ * Specify an optional handler for closing modal. Returning `false`
156
+ * prevents the modal from closing
161
157
  */
162
158
  onClose: PropTypes.func,
163
159
  /**
164
- * Specifies whether the AboutModal is open or not.
160
+ * Specify whether the modal is currently open
165
161
  */
166
162
  open: PropTypes.bool,
167
163
  /**
168
- * The DOM node the tearsheet should be rendered within. Defaults to document.body.
164
+ * Provide the DOM node where the modal should be rendered.
165
+ * Defaults to `document.body`
169
166
  */
170
167
  portalTarget: PropTypes.node,
171
168
  /**
172
- * Header text that provides the product name. The IBM Services logo
173
- * consists of two discrete, but required, elements: the iconic
174
- * IBM 8-bar logo represented alongside the IBM Services logotype.
175
- * Please follow these guidelines to ensure proper execution.
169
+ * Provide the product name for the modal header
176
170
  */
177
171
  title: PropTypes.node.isRequired,
178
172
  /**
179
- * Text that provides information on the version number of your product.
173
+ * Provide the product’s version number
180
174
  */
181
175
  version: PropTypes.string.isRequired
182
176
  };
@@ -13,7 +13,7 @@ import { Tag } from '@carbon/react';
13
13
  import { Tearsheet } from '../Tearsheet/Tearsheet.js';
14
14
  import { TearsheetNarrow } from '../Tearsheet/TearsheetNarrow.js';
15
15
  import '../EmptyStates/EmptyState.js';
16
- import '../EmptyStates/EmptyStateV2.js';
16
+ import '../EmptyStates/EmptyStateV2.deprecated.js';
17
17
  import '../EmptyStates/ErrorEmptyState/ErrorEmptyState.js';
18
18
  import '../EmptyStates/NoDataEmptyState/NoDataEmptyState.js';
19
19
  import '../EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js';
@@ -160,7 +160,7 @@ const Carousel = /*#__PURE__*/React__default.forwardRef((props, ref) => {
160
160
  }, [handleOnScroll]);
161
161
  const handleScrollToView = useCallback(itemNumber => {
162
162
  updateAriaHiddenTabIndex(itemNumber);
163
- childElementsRef.current[itemNumber].scrollIntoView();
163
+ childElementsRef.current[itemNumber]?.scrollIntoView();
164
164
  // eslint-disable-next-line react-hooks/exhaustive-deps
165
165
  }, []);
166
166
  const getFocusableElements = container => {
@@ -78,6 +78,10 @@ export interface CoachmarkProps {
78
78
  * Does nothing if `overlayKind=stacked`.
79
79
  */
80
80
  isOpenByDefault?: boolean;
81
+ /**
82
+ * Tooltip text and aria label for the Close button icon.
83
+ */
84
+ closeIconDescription?: string;
81
85
  }
82
86
  /**
83
87
  * Coachmarks are used to call out specific functionality or concepts
@@ -29,7 +29,8 @@ const defaults = {
29
29
  onClose: () => {},
30
30
  overlayKind: 'tooltip',
31
31
  theme: 'light',
32
- isOpenByDefault: false
32
+ isOpenByDefault: false,
33
+ closeIconDescription: ''
33
34
  };
34
35
  /**
35
36
  * Coachmarks are used to call out specific functionality or concepts
@@ -52,6 +53,7 @@ let Coachmark = /*#__PURE__*/forwardRef((_ref, ref) => {
52
53
  target,
53
54
  theme = defaults.theme,
54
55
  isOpenByDefault = defaults.isOpenByDefault,
56
+ closeIconDescription = defaults.closeIconDescription,
55
57
  // Collect any other property values passed in.
56
58
  ...rest
57
59
  } = _ref;
@@ -132,7 +134,8 @@ let Coachmark = /*#__PURE__*/forwardRef((_ref, ref) => {
132
134
  targetOffset: targetOffset,
133
135
  align: align,
134
136
  positionTune: positionTune,
135
- isOpen: isOpen
137
+ isOpen: isOpen,
138
+ closeIconDescription
136
139
  };
137
140
  const handleResize = throttle(() => {
138
141
  closeOverlay();
@@ -280,6 +283,10 @@ Coachmark.propTypes = {
280
283
  * Optional class name for this component.
281
284
  */
282
285
  className: PropTypes.string,
286
+ /**
287
+ * Tooltip text and aria label for the Close button icon.
288
+ */
289
+ closeIconDescription: PropTypes.string,
283
290
  /**
284
291
  * Determines if the coachmark is open by default.
285
292
  * Does nothing if `overlayKind=stacked`.
@@ -10,10 +10,6 @@ interface CoachmarkDragbarProps {
10
10
  * Handler to manage keyboard interactions with the dragbar.
11
11
  */
12
12
  a11yKeyboardHandler: (event: React.KeyboardEvent<HTMLButtonElement>) => void;
13
- /**
14
- * Tooltip text and aria label for the Close button icon.
15
- */
16
- closeIconDescription?: string;
17
13
  /**
18
14
  * Function to call when the close button is clicked.
19
15
  */
@@ -13,6 +13,7 @@ import { Draggable, Close } from '@carbon/react/icons';
13
13
  import { Button } from '@carbon/react';
14
14
  import { getDevtoolsProps } from '../../global/js/utils/devtools.js';
15
15
  import { pkg } from '../../settings.js';
16
+ import { useCoachmark } from './utils/context.js';
16
17
 
17
18
  var _Draggable;
18
19
 
@@ -24,7 +25,6 @@ const blockClass = `${pkg.prefix}--coachmark-dragbar`;
24
25
  const overlayBlockClass = `${pkg.prefix}--coachmark-overlay`;
25
26
  const componentName = 'CoachmarkDragbar';
26
27
  const defaults = {
27
- closeIconDescription: 'Close',
28
28
  onDrag: () => {},
29
29
  onClose: () => {},
30
30
  showCloseButton: true,
@@ -37,7 +37,6 @@ const defaults = {
37
37
  let CoachmarkDragbar = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
38
38
  let {
39
39
  a11yKeyboardHandler,
40
- closeIconDescription = defaults.closeIconDescription,
41
40
  onClose = defaults.onClose,
42
41
  onDrag = defaults.onDrag,
43
42
  showCloseButton = defaults.showCloseButton,
@@ -64,6 +63,7 @@ let CoachmarkDragbar = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
64
63
  };
65
64
  }, [isDragging, onDrag]);
66
65
  const handleDragStart = () => setIsDragging(true);
66
+ const closeIconDescription = useCoachmark()?.closeIconDescription;
67
67
  return /*#__PURE__*/React__default.createElement("header", _extends({}, rest, {
68
68
  className: cx(blockClass,
69
69
  // Apply the block class to the main HTML element
@@ -110,10 +110,6 @@ CoachmarkDragbar.propTypes = {
110
110
  * Handler to manage keyboard interactions with the dragbar.
111
111
  */
112
112
  a11yKeyboardHandler: PropTypes.func.isRequired,
113
- /**
114
- * Tooltip text and aria label for the Close button icon.
115
- */
116
- closeIconDescription: PropTypes.string,
117
113
  /**
118
114
  * Function to call when the close button is clicked.
119
115
  */
@@ -6,10 +6,6 @@
6
6
  */
7
7
  import React from 'react';
8
8
  interface CoachmarkHeaderProps {
9
- /**
10
- * Tooltip text and aria label for the Close button icon.
11
- */
12
- closeIconDescription?: string;
13
9
  /**
14
10
  * Function to call when the close button is clicked.
15
11
  */
@@ -13,13 +13,13 @@ import { Close } from '@carbon/react/icons';
13
13
  import { Button } from '@carbon/react';
14
14
  import { getDevtoolsProps } from '../../global/js/utils/devtools.js';
15
15
  import { pkg } from '../../settings.js';
16
+ import { useCoachmark } from './utils/context.js';
16
17
 
17
18
  // The block part of our conventional BEM class names (blockClass__E--M).
18
19
  const blockClass = `${pkg.prefix}--coachmark-header`;
19
20
  const overlayBlockClass = `${pkg.prefix}--coachmark-overlay`;
20
21
  const componentName = 'CoachmarkHeader';
21
22
  const defaults = {
22
- closeIconDescription: 'Close',
23
23
  onClose: () => {},
24
24
  showCloseButton: true,
25
25
  theme: 'light'
@@ -30,13 +30,13 @@ const defaults = {
30
30
  */
31
31
  let CoachmarkHeader = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
32
32
  let {
33
- closeIconDescription = defaults.closeIconDescription,
34
33
  onClose = defaults.onClose,
35
34
  showCloseButton = defaults.showCloseButton,
36
35
  theme = defaults.theme,
37
36
  // Collect any other property values passed in.
38
37
  ...rest
39
38
  } = _ref;
39
+ const closeIconDescription = useCoachmark()?.closeIconDescription;
40
40
  return /*#__PURE__*/React__default.createElement("header", _extends({}, rest, {
41
41
  className: cx(blockClass, `${blockClass}__${theme}`),
42
42
  ref: ref
@@ -21,9 +21,9 @@ var _Idea;
21
21
  const blockClass = `${pkg.prefix}--coachmark-tagline`;
22
22
  const componentName = 'CoachmarkTagline';
23
23
  const defaults = {
24
- closeIconDescription: 'Close',
25
24
  onClose: () => {},
26
- theme: 'light'
25
+ theme: 'light',
26
+ closeIconDescription: 'Close'
27
27
  };
28
28
  /**
29
29
  * DO NOT USE. This component is for the exclusive use
@@ -38,6 +38,8 @@ let CoachmarkTagline = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
38
38
  ...rest
39
39
  } = _ref;
40
40
  const coachmark = useCoachmark();
41
+ const contextCloseIconDescription = useCoachmark()?.closeIconDescription;
42
+ const closeIconDesc = closeIconDescription ?? contextCloseIconDescription;
41
43
  return /*#__PURE__*/React__default.createElement("div", _extends({}, rest, {
42
44
  className: cx(blockClass, `${blockClass}__${theme}`, coachmark?.isOpen && `${blockClass}--is-open`),
43
45
  ref: ref
@@ -55,7 +57,7 @@ let CoachmarkTagline = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
55
57
  kind: "ghost",
56
58
  size: "sm",
57
59
  renderIcon: Close,
58
- iconDescription: closeIconDescription,
60
+ iconDescription: closeIconDesc,
59
61
  hasIconOnly: true,
60
62
  className: `${blockClass}--close-btn`,
61
63
  onClick: onClose
@@ -4,10 +4,9 @@
4
4
  * This source code is licensed under the Apache-2.0 license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import React, { FC, ForwardRefExoticComponent, ReactNode, RefAttributes, RefObject } from 'react';
7
+ import { FC, ForwardRefExoticComponent, ReactNode, RefAttributes } from 'react';
8
8
  import { CoachmarkContentProps } from './CoachmarkContent';
9
9
  import { NewPopoverAlignment } from '@carbon/react';
10
- export declare const blockClass: string;
11
10
  export interface CoachmarkProps {
12
11
  /**
13
12
  * Provide the contents of the Coachmark.
@@ -17,10 +16,6 @@ export interface CoachmarkProps {
17
16
  * Provide an optional class to be applied to the containing node.
18
17
  */
19
18
  className?: string;
20
- /**
21
- * The aria label applied to the Coachmark component
22
- */
23
- ariaLabel?: string;
24
19
  /**
25
20
  * Specifies whether the component is currently open.
26
21
  */
@@ -48,25 +43,9 @@ export interface CoachmarkProps {
48
43
  export type CoachmarkComponent = ForwardRefExoticComponent<CoachmarkProps & RefAttributes<HTMLDivElement>> & {
49
44
  Content: FC<CoachmarkContentProps>;
50
45
  };
51
- interface CoachmarkContextType {
52
- onClose?: () => void;
53
- open?: boolean;
54
- setOpen: (value: boolean) => void;
55
- align?: NewPopoverAlignment;
56
- triggerRef: RefObject<HTMLElement | null>;
57
- position: {
58
- x: number;
59
- y: number;
60
- };
61
- contentRef: HTMLElement | null;
62
- setContentRef: (value: any) => void;
63
- floating?: boolean;
64
- }
65
- export declare const CoachmarkContext: React.Context<CoachmarkContextType>;
66
46
  /**
67
47
  * Coachmarks are used to call out specific functionality or concepts
68
48
  * within the UI that may not be intuitive but are important for the
69
49
  * user to gain understanding of the product's main value and discover new use cases.
70
50
  */
71
51
  export declare const Coachmark: CoachmarkComponent;
72
- export {};
@@ -6,16 +6,16 @@
6
6
  */
7
7
 
8
8
  import { extends as _extends } from '../../../../_virtual/_rollupPluginBabelHelpers.js';
9
- import React__default, { createContext, forwardRef, useRef, useState, useEffect } from 'react';
9
+ import React__default, { forwardRef, useRef, useState, useEffect } from 'react';
10
10
  import PropTypes from '../../../../_virtual/index.js';
11
11
  import cx from 'classnames';
12
12
  import { getDevtoolsProps } from '../../../../global/js/utils/devtools.js';
13
- import { pkg } from '../../../../settings.js';
13
+ import { CoachmarkContext, blockClass } from './context.js';
14
14
  import CoachmarkContent from './CoachmarkContent.js';
15
15
  import { useIsomorphicEffect } from '../../../../global/js/hooks/useIsomorphicEffect.js';
16
16
 
17
17
  // The block part of our conventional BEM class names (blockClass__E--M).
18
- const blockClass = `${pkg.prefix}--coachmark__next`;
18
+
19
19
  const componentName = 'Coachmark';
20
20
 
21
21
  // NOTE: the component SCSS is not imported here: it is rolled up separately.
@@ -31,21 +31,6 @@ const componentName = 'Coachmark';
31
31
 
32
32
  // Define the type for Coachmark, extending it to include Trigger and Content
33
33
 
34
- const CoachmarkContext = /*#__PURE__*/createContext({
35
- open: false,
36
- setOpen: () => {},
37
- align: 'bottom',
38
- triggerRef: {
39
- current: null
40
- },
41
- position: {
42
- x: 0,
43
- y: 0
44
- },
45
- contentRef: null,
46
- setContentRef: value => {},
47
- floating: false
48
- });
49
34
  /**
50
35
  * Coachmarks are used to call out specific functionality or concepts
51
36
  * within the UI that may not be intuitive but are important for the
@@ -55,7 +40,6 @@ const Coachmark = /*#__PURE__*/forwardRef((props, ref) => {
55
40
  const {
56
41
  children,
57
42
  className,
58
- ariaLabel,
59
43
  onClose,
60
44
  align = 'bottom',
61
45
  open,
@@ -90,6 +74,12 @@ const Coachmark = /*#__PURE__*/forwardRef((props, ref) => {
90
74
  triggerRef.current = firstFocusable;
91
75
  }
92
76
  }, [children]);
77
+ useEffect(() => {
78
+ const el = triggerRef.current;
79
+ if (el) {
80
+ el.setAttribute('aria-expanded', String(!!open));
81
+ }
82
+ }, [open]);
93
83
  useIsomorphicEffect(() => {
94
84
  const {
95
85
  x = 0,
@@ -128,7 +118,6 @@ const Coachmark = /*#__PURE__*/forwardRef((props, ref) => {
128
118
  {
129
119
  [`${blockClass}--floating`]: floating
130
120
  }),
131
- "aria-label": ariaLabel,
132
121
  ref: setRef
133
122
  }, getDevtoolsProps(componentName)), /*#__PURE__*/React__default.createElement("div", {
134
123
  className: `${blockClass}--container`
@@ -148,10 +137,6 @@ Coachmark.propTypes = {
148
137
  * Where to render the Coachmark relative to its target.
149
138
  */
150
139
  align: PropTypes.string,
151
- /**
152
- * The aria label applied to the Coachmark component
153
- */
154
- ariaLabel: PropTypes.string,
155
140
  /**
156
141
  * Provide the contents of the CoachmarkV2.
157
142
  */
@@ -160,10 +145,6 @@ Coachmark.propTypes = {
160
145
  * Provide an optional class to be applied to the containing node.
161
146
  */
162
147
  className: PropTypes.string,
163
- /**
164
- * Specifies whether the component is currently open.
165
- */
166
- defaultOpen: PropTypes.bool,
167
148
  /**
168
149
  * Specifies whether the component is floating or not.
169
150
  */
@@ -172,6 +153,10 @@ Coachmark.propTypes = {
172
153
  * Function to call when the close button is clicked.
173
154
  */
174
155
  onClose: PropTypes.func,
156
+ /**
157
+ * Specifies whether the component is currently open.
158
+ */
159
+ open: PropTypes.bool,
175
160
  /**
176
161
  * Fine tune the position of the target in pixels. Applies only to Beacons.
177
162
  */
@@ -182,4 +167,4 @@ Coachmark.propTypes = {
182
167
  })
183
168
  };
184
169
 
185
- export { Coachmark, CoachmarkContext, blockClass };
170
+ export { Coachmark };
@@ -17,6 +17,7 @@ export interface CoachmarkButtonProps extends ButtonProps<ElementType> {
17
17
  onDoubleClick?(): void;
18
18
  tabIndex?: number;
19
19
  ['aria-expanded']?: boolean;
20
+ id?: string;
20
21
  }
21
22
  export interface CoachmarkBeaconProps {
22
23
  /**
@@ -13,7 +13,7 @@ import { pkg } from '../../../../../settings.js';
13
13
  import { offset, flip, shift, arrow } from '../../../../../node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js';
14
14
  import { autoUpdate, computePosition } from '../../../../../node_modules/@floating-ui/dom/dist/floating-ui.dom.js';
15
15
 
16
- const CoachmarkBubble = /*#__PURE__*/forwardRef(props => {
16
+ const CoachmarkBubble = /*#__PURE__*/forwardRef((props, ref) => {
17
17
  const {
18
18
  children,
19
19
  align,
@@ -35,6 +35,9 @@ const CoachmarkBubble = /*#__PURE__*/forwardRef(props => {
35
35
  useLayoutEffect(() => {
36
36
  if (target) {
37
37
  if (typeof target === 'string') {
38
+ if (target === '#' || target.trim() === '') {
39
+ return;
40
+ }
38
41
  targetRef.current = document.querySelector(target);
39
42
  } else if ('current' in target) {
40
43
  targetRef.current = target.current;
@@ -102,8 +105,16 @@ const CoachmarkBubble = /*#__PURE__*/forwardRef(props => {
102
105
  if (!target) {
103
106
  return null;
104
107
  }
108
+ const mergedRefs = node => {
109
+ tooltipRef.current = node;
110
+ if (typeof ref === 'function') {
111
+ ref(node);
112
+ } else if (ref) {
113
+ ref.current = node;
114
+ }
115
+ };
105
116
  return /*#__PURE__*/React__default.createElement("div", _extends({}, rest, {
106
- ref: tooltipRef,
117
+ ref: mergedRefs,
107
118
  className: cx({
108
119
  [`${carbonPrefix}--g100`]: theme === 'white' && highContrast || theme === 'g100' && !highContrast,
109
120
  [`${carbonPrefix}--g90`]: theme === 'g10' && highContrast || theme === 'g90' && !highContrast,
@@ -9,7 +9,7 @@ import { extends as _extends } from '../../../../_virtual/_rollupPluginBabelHelp
9
9
  import React__default, { forwardRef, useContext, useRef, useEffect } from 'react';
10
10
  import PropTypes from '../../../../_virtual/index.js';
11
11
  import { pkg } from '../../../../settings.js';
12
- import { CoachmarkContext, blockClass } from './Coachmark.js';
12
+ import { CoachmarkContext, blockClass } from './context.js';
13
13
  import { CoachmarkBubble } from './CoachmarkBubble/CoachmarkBubble.js';
14
14
  import './CoachmarkBubble/CoachmarkBubbleHeader.js';
15
15
  import ContentHeader from './ContentHeader.js';
@@ -40,7 +40,7 @@ const CoachmarkContent = /*#__PURE__*/forwardRef((props, ref) => {
40
40
  useEffect(() => {
41
41
  if (open && bubbleRef.current) {
42
42
  requestAnimationFrame(() => {
43
- const contentBody = bubbleRef.current.querySelector(`.${contentBodyClass}`);
43
+ const contentBody = bubbleRef.current?.querySelector(`.${contentBodyClass}`);
44
44
  if (contentBody) {
45
45
  const firstFocusable = Array.from(contentBody.querySelectorAll('*')).find(el => el.tabIndex >= 0);
46
46
  firstFocusable?.focus();
@@ -8,7 +8,7 @@
8
8
  import React__default, { forwardRef } from 'react';
9
9
  import PropTypes from '../../../../_virtual/index.js';
10
10
  import cx from 'classnames';
11
- import { blockClass } from './Coachmark.js';
11
+ import { blockClass } from './context.js';
12
12
 
13
13
  const ContentBody = /*#__PURE__*/forwardRef((props, ref) => {
14
14
  const {
@@ -10,7 +10,7 @@ import { Button } from '@carbon/react';
10
10
  import React__default, { forwardRef, useContext, useRef, useEffect } from 'react';
11
11
  import PropTypes from '../../../../_virtual/index.js';
12
12
  import cx from 'classnames';
13
- import { CoachmarkContext, blockClass } from './Coachmark.js';
13
+ import { CoachmarkContext, blockClass } from './context.js';
14
14
  import './CoachmarkBubble/CoachmarkBubble.js';
15
15
  import { CoachmarkBubbleHeader } from './CoachmarkBubble/CoachmarkBubbleHeader.js';
16
16
  import { Draggable, Close } from '@carbon/react/icons';
@@ -45,6 +45,20 @@ const ContentHeader = /*#__PURE__*/forwardRef((props, ref) => {
45
45
  dragHandle: handleRef.current,
46
46
  focusableDragHandle: dragRef.current
47
47
  });
48
+ const onDragStart = () => {
49
+ if (contentRef) {
50
+ contentRef.classList.add(`${contentHeaderBlockClass}--is-dragging`);
51
+ contentRef.setAttribute('aria-label', 'Coachmark is being dragged');
52
+ }
53
+ };
54
+ const onDragEnd = () => {
55
+ if (contentRef) {
56
+ contentRef.classList.remove(`${contentHeaderBlockClass}--is-dragging`);
57
+ contentRef.removeAttribute('aria-label');
58
+ }
59
+ };
60
+ contentRef.addEventListener('dragstart', onDragStart);
61
+ contentRef.addEventListener('dragend', onDragEnd);
48
62
  }
49
63
  });
50
64
  return /*#__PURE__*/React__default.createElement(CoachmarkBubbleHeader, _extends({
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Copyright IBM Corp. 2025
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
+ import { RefObject } from 'react';
8
+ import { NewPopoverAlignment } from '@carbon/react';
9
+ interface CoachmarkContextType {
10
+ onClose?: () => void;
11
+ open?: boolean;
12
+ setOpen: (value: boolean) => void;
13
+ align?: NewPopoverAlignment;
14
+ triggerRef: RefObject<HTMLElement | null>;
15
+ position: {
16
+ x: number;
17
+ y: number;
18
+ };
19
+ contentRef: HTMLElement | null;
20
+ setContentRef: (value: any) => void;
21
+ floating?: boolean;
22
+ }
23
+ export declare const CoachmarkContext: import("react").Context<CoachmarkContextType>;
24
+ export declare const blockClass: string;
25
+ export {};