@carbon/ibm-products 2.71.1 → 2.72.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 (226) hide show
  1. package/css/carbon.css +50 -0
  2. package/css/carbon.css.map +1 -1
  3. package/css/index-full-carbon.css +560 -185
  4. package/css/index-full-carbon.css.map +1 -1
  5. package/css/index-full-carbon.min.css +1 -1
  6. package/css/index-full-carbon.min.css.map +1 -1
  7. package/css/index-without-carbon-released-only.css +132 -1
  8. package/css/index-without-carbon-released-only.css.map +1 -1
  9. package/css/index-without-carbon-released-only.min.css +1 -1
  10. package/css/index-without-carbon-released-only.min.css.map +1 -1
  11. package/css/index-without-carbon.css +570 -245
  12. package/css/index-without-carbon.css.map +1 -1
  13. package/css/index-without-carbon.min.css +1 -1
  14. package/css/index-without-carbon.min.css.map +1 -1
  15. package/css/index.css +358 -33
  16. package/css/index.css.map +1 -1
  17. package/css/index.min.css +1 -1
  18. package/css/index.min.css.map +1 -1
  19. package/es/components/{BigNumbers/BigNumbers.d.ts → BigNumber/BigNumber.d.ts} +5 -5
  20. package/es/components/{BigNumbers/BigNumbers.js → BigNumber/BigNumber.js} +12 -12
  21. package/es/components/BigNumber/BigNumberSkeleton.d.ts +17 -0
  22. package/es/components/{BigNumbers/BigNumbersSkeleton.js → BigNumber/BigNumberSkeleton.js} +16 -16
  23. package/es/components/{BigNumbers → BigNumber}/constants.d.ts +3 -3
  24. package/es/components/{BigNumbers → BigNumber}/constants.js +6 -6
  25. package/es/components/{BigNumbers → BigNumber}/index.d.ts +2 -2
  26. package/es/components/Coachmark/next/Coachmark/Coachmark.d.ts +72 -0
  27. package/es/components/Coachmark/next/Coachmark/Coachmark.js +185 -0
  28. package/es/components/Coachmark/next/Coachmark/CoachmarkBeacon/CoachmarkBeacon.d.ts +44 -0
  29. package/es/components/Coachmark/next/Coachmark/CoachmarkBeacon/index.d.ts +8 -0
  30. package/es/components/Coachmark/next/Coachmark/CoachmarkBubble/CoachmarkBubble.d.ts +38 -0
  31. package/es/components/Coachmark/next/Coachmark/CoachmarkBubble/CoachmarkBubble.js +125 -0
  32. package/es/components/Coachmark/next/Coachmark/CoachmarkBubble/CoachmarkBubbleHeader.d.ts +24 -0
  33. package/es/components/Coachmark/next/Coachmark/CoachmarkBubble/CoachmarkBubbleHeader.js +25 -0
  34. package/es/components/Coachmark/next/Coachmark/CoachmarkBubble/index.d.ts +10 -0
  35. package/es/components/Coachmark/next/Coachmark/CoachmarkContent.d.ts +34 -0
  36. package/es/components/Coachmark/next/Coachmark/CoachmarkContent.js +118 -0
  37. package/es/components/Coachmark/next/Coachmark/ContentBody.d.ts +23 -0
  38. package/es/components/Coachmark/next/Coachmark/ContentBody.js +37 -0
  39. package/es/components/Coachmark/next/Coachmark/ContentHeader.d.ts +21 -0
  40. package/es/components/Coachmark/next/Coachmark/ContentHeader.js +89 -0
  41. package/{lib/components/BigNumbers → es/components/Coachmark/next/Coachmark}/index.d.ts +2 -2
  42. package/es/components/CoachmarkBeacon/CoachmarkBeacon.js +0 -1
  43. package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +2 -1
  44. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +30 -5
  45. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +1 -1
  46. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +11 -4
  47. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js +2 -2
  48. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.js +1 -1
  49. package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +42 -3
  50. package/es/components/ConditionBuilder/ConditionPreview/ConditionPreview.d.ts +3 -1
  51. package/es/components/ConditionBuilder/ConditionPreview/ConditionPreview.js +5 -3
  52. package/es/components/ConditionBuilder/utils/useEvent.d.ts +8 -0
  53. package/es/components/ConditionBuilder/utils/useEvent.js +32 -0
  54. package/es/components/ConditionBuilder/utils/useTranslations.js +1 -1
  55. package/es/components/EditInPlace/EditInPlace.js +0 -3
  56. package/es/components/EmptyStates/EmptyState.d.ts +2 -2
  57. package/es/components/EmptyStates/EmptyState.js +2 -8
  58. package/es/components/FilterPanel/FilterPanelGroup/index.d.ts +1 -0
  59. package/es/components/InterstitialScreen/InterstitialScreen.d.ts +1 -25
  60. package/es/components/InterstitialScreen/InterstitialScreen.js +3 -19
  61. package/es/components/InterstitialScreen/InterstitialScreenBody.d.ts +1 -1
  62. package/es/components/InterstitialScreen/InterstitialScreenBody.js +1 -1
  63. package/es/components/InterstitialScreen/InterstitialScreenFooter.d.ts +1 -1
  64. package/es/components/InterstitialScreen/InterstitialScreenFooter.js +1 -1
  65. package/es/components/InterstitialScreen/InterstitialScreenHeader.d.ts +6 -0
  66. package/es/components/InterstitialScreen/InterstitialScreenHeader.js +1 -1
  67. package/es/components/InterstitialScreen/_story-assets/InterstitialScreenViewModule/InterstitialScreenViewModule.d.ts +1 -1
  68. package/es/components/InterstitialScreen/context.d.ts +31 -0
  69. package/es/components/InterstitialScreen/context.js +18 -0
  70. package/es/components/InterstitialScreen/index.d.ts +3 -2
  71. package/es/components/NotificationsPanel/NotificationsPanel.js +36 -13
  72. package/es/components/PageHeader/PageHeader.d.ts +2 -1
  73. package/es/components/PageHeader/PageHeader.js +2 -1
  74. package/es/components/PageHeader/next/PageHeader.d.ts +18 -3
  75. package/es/components/PageHeader/next/PageHeader.js +260 -12
  76. package/es/components/PageHeader/next/context.d.ts +25 -0
  77. package/es/components/PageHeader/next/context.js +30 -0
  78. package/es/components/PageHeader/next/index.d.ts +3 -3
  79. package/es/components/PageHeader/next/overflowHandler.d.ts +95 -0
  80. package/es/components/PageHeader/next/overflowHandler.js +162 -0
  81. package/es/components/PageHeader/next/utils.d.ts +19 -0
  82. package/es/components/PageHeader/next/utils.js +68 -0
  83. package/es/components/ProductiveCard/ProductiveCard.js +2 -1
  84. package/es/components/ScrollGradient/ScrollGradient.js +1 -2
  85. package/es/components/SidePanel/SidePanel.d.ts +4 -0
  86. package/es/components/SidePanel/SidePanel.js +8 -2
  87. package/es/components/Tearsheet/TearsheetShell.js +8 -5
  88. package/es/components/TruncatedText/TruncatedText.d.ts +48 -0
  89. package/es/components/TruncatedText/TruncatedText.js +86 -0
  90. package/es/components/TruncatedText/index.d.ts +7 -0
  91. package/es/components/TruncatedText/useTruncatedText.d.ts +16 -0
  92. package/es/components/TruncatedText/useTruncatedText.js +41 -0
  93. package/es/components/index.d.ts +3 -1
  94. package/es/global/js/hooks/useOverflowString.d.ts +2 -2
  95. package/es/global/js/hooks/useResizeObserver.d.ts +1 -1
  96. package/es/global/js/package-settings.d.ts +2 -1
  97. package/es/global/js/package-settings.js +3 -2
  98. package/es/global/js/utils/checkForOverflow.js +21 -0
  99. package/es/global/js/utils/makeDraggable/index.d.ts +1 -0
  100. package/es/global/js/utils/makeDraggable/makeDraggable.d.ts +19 -0
  101. package/es/global/js/utils/makeDraggable/makeDraggable.js +91 -0
  102. package/es/global/js/utils/makeDraggable/makeDraggable.stories.d.ts +22 -0
  103. package/es/index.js +3 -1
  104. package/es/node_modules/@floating-ui/core/dist/floating-ui.core.js +592 -0
  105. package/es/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +713 -0
  106. package/es/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +95 -0
  107. package/es/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +161 -0
  108. package/es/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +142 -0
  109. package/es/settings.d.ts +2 -1
  110. package/lib/components/{BigNumbers/BigNumbers.d.ts → BigNumber/BigNumber.d.ts} +5 -5
  111. package/lib/components/{BigNumbers/BigNumbers.js → BigNumber/BigNumber.js} +11 -11
  112. package/lib/components/BigNumber/BigNumberSkeleton.d.ts +17 -0
  113. package/lib/components/{BigNumbers/BigNumbersSkeleton.js → BigNumber/BigNumberSkeleton.js} +15 -15
  114. package/lib/components/{BigNumbers → BigNumber}/constants.d.ts +3 -3
  115. package/lib/components/{BigNumbers → BigNumber}/constants.js +6 -6
  116. package/lib/components/BigNumber/index.d.ts +7 -0
  117. package/lib/components/Coachmark/Coachmark.js +2 -2
  118. package/lib/components/Coachmark/next/Coachmark/Coachmark.d.ts +72 -0
  119. package/lib/components/Coachmark/next/Coachmark/Coachmark.js +189 -0
  120. package/lib/components/Coachmark/next/Coachmark/CoachmarkBeacon/CoachmarkBeacon.d.ts +44 -0
  121. package/lib/components/Coachmark/next/Coachmark/CoachmarkBeacon/index.d.ts +8 -0
  122. package/lib/components/Coachmark/next/Coachmark/CoachmarkBubble/CoachmarkBubble.d.ts +38 -0
  123. package/lib/components/Coachmark/next/Coachmark/CoachmarkBubble/CoachmarkBubble.js +127 -0
  124. package/lib/components/Coachmark/next/Coachmark/CoachmarkBubble/CoachmarkBubbleHeader.d.ts +24 -0
  125. package/lib/components/Coachmark/next/Coachmark/CoachmarkBubble/CoachmarkBubbleHeader.js +27 -0
  126. package/lib/components/Coachmark/next/Coachmark/CoachmarkBubble/index.d.ts +10 -0
  127. package/lib/components/Coachmark/next/Coachmark/CoachmarkContent.d.ts +34 -0
  128. package/lib/components/Coachmark/next/Coachmark/CoachmarkContent.js +122 -0
  129. package/lib/components/Coachmark/next/Coachmark/ContentBody.d.ts +23 -0
  130. package/lib/components/Coachmark/next/Coachmark/ContentBody.js +41 -0
  131. package/lib/components/Coachmark/next/Coachmark/ContentHeader.d.ts +21 -0
  132. package/lib/components/Coachmark/next/Coachmark/ContentHeader.js +93 -0
  133. package/lib/components/Coachmark/next/Coachmark/index.d.ts +7 -0
  134. package/lib/components/CoachmarkBeacon/CoachmarkBeacon.js +0 -1
  135. package/lib/components/CoachmarkFixed/CoachmarkFixed.js +2 -2
  136. package/lib/components/CoachmarkStack/CoachmarkStack.js +2 -2
  137. package/lib/components/CoachmarkStack/CoachmarkStackHome.js +2 -2
  138. package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +2 -1
  139. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +30 -5
  140. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +1 -1
  141. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +11 -4
  142. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js +2 -2
  143. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.js +1 -1
  144. package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +41 -2
  145. package/lib/components/ConditionBuilder/ConditionPreview/ConditionPreview.d.ts +3 -1
  146. package/lib/components/ConditionBuilder/ConditionPreview/ConditionPreview.js +5 -3
  147. package/lib/components/ConditionBuilder/utils/useEvent.d.ts +8 -0
  148. package/lib/components/ConditionBuilder/utils/useEvent.js +34 -0
  149. package/lib/components/ConditionBuilder/utils/useTranslations.js +1 -1
  150. package/lib/components/EditInPlace/EditInPlace.js +0 -3
  151. package/lib/components/EmptyStates/EmptyState.d.ts +2 -2
  152. package/lib/components/EmptyStates/EmptyState.js +2 -8
  153. package/lib/components/FilterPanel/FilterPanelGroup/index.d.ts +1 -0
  154. package/lib/components/InterstitialScreen/InterstitialScreen.d.ts +1 -25
  155. package/lib/components/InterstitialScreen/InterstitialScreen.js +6 -25
  156. package/lib/components/InterstitialScreen/InterstitialScreenBody.d.ts +1 -1
  157. package/lib/components/InterstitialScreen/InterstitialScreenBody.js +6 -6
  158. package/lib/components/InterstitialScreen/InterstitialScreenFooter.d.ts +1 -1
  159. package/lib/components/InterstitialScreen/InterstitialScreenFooter.js +9 -9
  160. package/lib/components/InterstitialScreen/InterstitialScreenHeader.d.ts +6 -0
  161. package/lib/components/InterstitialScreen/InterstitialScreenHeader.js +5 -5
  162. package/lib/components/InterstitialScreen/_story-assets/InterstitialScreenViewModule/InterstitialScreenViewModule.d.ts +1 -1
  163. package/lib/components/InterstitialScreen/context.d.ts +31 -0
  164. package/lib/components/InterstitialScreen/context.js +21 -0
  165. package/lib/components/InterstitialScreen/index.d.ts +3 -2
  166. package/lib/components/NotificationsPanel/NotificationsPanel.js +36 -13
  167. package/lib/components/PageHeader/PageHeader.d.ts +2 -1
  168. package/lib/components/PageHeader/PageHeader.js +2 -1
  169. package/lib/components/PageHeader/next/PageHeader.d.ts +18 -3
  170. package/lib/components/PageHeader/next/PageHeader.js +261 -7
  171. package/lib/components/PageHeader/next/context.d.ts +25 -0
  172. package/lib/components/PageHeader/next/context.js +33 -0
  173. package/lib/components/PageHeader/next/index.d.ts +3 -3
  174. package/lib/components/PageHeader/next/overflowHandler.d.ts +95 -0
  175. package/lib/components/PageHeader/next/overflowHandler.js +166 -0
  176. package/lib/components/PageHeader/next/utils.d.ts +19 -0
  177. package/lib/components/PageHeader/next/utils.js +71 -0
  178. package/lib/components/ProductiveCard/ProductiveCard.js +2 -1
  179. package/lib/components/ScrollGradient/ScrollGradient.js +1 -2
  180. package/lib/components/SidePanel/SidePanel.d.ts +4 -0
  181. package/lib/components/SidePanel/SidePanel.js +8 -2
  182. package/lib/components/Tearsheet/TearsheetShell.js +8 -5
  183. package/lib/components/TruncatedText/TruncatedText.d.ts +48 -0
  184. package/lib/components/TruncatedText/TruncatedText.js +86 -0
  185. package/lib/components/TruncatedText/index.d.ts +7 -0
  186. package/lib/components/TruncatedText/useTruncatedText.d.ts +16 -0
  187. package/lib/components/TruncatedText/useTruncatedText.js +45 -0
  188. package/lib/components/index.d.ts +3 -1
  189. package/lib/global/js/hooks/useOverflowString.d.ts +2 -2
  190. package/lib/global/js/hooks/usePortalTarget.js +2 -2
  191. package/lib/global/js/hooks/useResizeObserver.d.ts +1 -1
  192. package/lib/global/js/package-settings.d.ts +2 -1
  193. package/lib/global/js/package-settings.js +3 -2
  194. package/lib/global/js/utils/checkForOverflow.js +23 -0
  195. package/lib/global/js/utils/makeDraggable/index.d.ts +1 -0
  196. package/lib/global/js/utils/makeDraggable/makeDraggable.d.ts +19 -0
  197. package/lib/global/js/utils/makeDraggable/makeDraggable.js +93 -0
  198. package/lib/global/js/utils/makeDraggable/makeDraggable.stories.d.ts +22 -0
  199. package/lib/index.js +10 -3
  200. package/lib/node_modules/@floating-ui/core/dist/floating-ui.core.js +600 -0
  201. package/lib/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +722 -0
  202. package/lib/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +102 -0
  203. package/lib/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +182 -0
  204. package/lib/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +164 -0
  205. package/lib/settings.d.ts +2 -1
  206. package/package.json +9 -10
  207. package/scss/components/{BigNumbers/_big-numbers.scss → BigNumber/_big-number.scss} +5 -5
  208. package/scss/components/{BigNumbers → BigNumber}/_carbon-imports.scss +3 -3
  209. package/scss/components/{BigNumbers → BigNumber}/_index-with-carbon.scss +2 -2
  210. package/scss/components/{BigNumbers → BigNumber}/_index.scss +2 -2
  211. package/scss/components/Card/_card.scss +2 -0
  212. package/scss/components/Coachmark/_bubble.scss +62 -0
  213. package/scss/components/Coachmark/_coachmark-beacon.scss +164 -0
  214. package/scss/components/Coachmark/_coachmark.scss +15 -0
  215. package/scss/components/ConditionBuilder/_condition-builder.scss +8 -0
  216. package/scss/components/PageHeader/_page-header.scss +144 -1
  217. package/scss/components/Tearsheet/_tearsheet.scss +6 -0
  218. package/scss/components/TruncatedText/_carbon-imports.scss +6 -0
  219. package/scss/components/TruncatedText/_index-with-carbon.scss +9 -0
  220. package/scss/components/TruncatedText/_index.scss +8 -0
  221. package/scss/components/TruncatedText/_truncated-text.scss +26 -0
  222. package/scss/components/_index-with-carbon.scss +3 -2
  223. package/scss/components/_index.scss +3 -2
  224. package/telemetry.yml +24 -5
  225. package/es/components/BigNumbers/BigNumbersSkeleton.d.ts +0 -17
  226. package/lib/components/BigNumbers/BigNumbersSkeleton.d.ts +0 -17
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Copyright IBM Corp. 2024, 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 React, { FC, ForwardRefExoticComponent, ReactNode, RefAttributes, RefObject } from 'react';
8
+ import { CoachmarkContentProps } from './CoachmarkContent';
9
+ import { NewPopoverAlignment } from '@carbon/react';
10
+ export declare const blockClass: string;
11
+ export interface CoachmarkProps {
12
+ /**
13
+ * Provide the contents of the Coachmark.
14
+ */
15
+ children: ReactNode;
16
+ /**
17
+ * Provide an optional class to be applied to the containing node.
18
+ */
19
+ className?: string;
20
+ /**
21
+ * The aria label applied to the Coachmark component
22
+ */
23
+ ariaLabel?: string;
24
+ /**
25
+ * Specifies whether the component is currently open.
26
+ */
27
+ open?: boolean;
28
+ /**
29
+ * Function to call when the close button is clicked.
30
+ */
31
+ onClose?: () => void;
32
+ /**
33
+ * Where to render the Coachmark relative to its target.
34
+ */
35
+ align?: NewPopoverAlignment;
36
+ /**
37
+ * Fine tune the position of the target in pixels.
38
+ */
39
+ position?: {
40
+ x: number;
41
+ y: number;
42
+ };
43
+ /**
44
+ * Specifies whether the component is floating or not.
45
+ */
46
+ floating?: boolean;
47
+ }
48
+ export type CoachmarkComponent = ForwardRefExoticComponent<CoachmarkProps & RefAttributes<HTMLDivElement>> & {
49
+ Content: FC<CoachmarkContentProps>;
50
+ };
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
+ /**
67
+ * Coachmarks are used to call out specific functionality or concepts
68
+ * within the UI that may not be intuitive but are important for the
69
+ * user to gain understanding of the product's main value and discover new use cases.
70
+ */
71
+ export declare const Coachmark: CoachmarkComponent;
72
+ export {};
@@ -0,0 +1,189 @@
1
+ /**
2
+ * Copyright IBM Corp. 2020, 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
+
8
+ 'use strict';
9
+
10
+ var _rollupPluginBabelHelpers = require('../../../../_virtual/_rollupPluginBabelHelpers.js');
11
+ var React = require('react');
12
+ var index = require('../../../../_virtual/index.js');
13
+ var cx = require('classnames');
14
+ var devtools = require('../../../../global/js/utils/devtools.js');
15
+ var settings = require('../../../../settings.js');
16
+ var CoachmarkContent = require('./CoachmarkContent.js');
17
+ var useIsomorphicEffect = require('../../../../global/js/hooks/useIsomorphicEffect.js');
18
+
19
+ // The block part of our conventional BEM class names (blockClass__E--M).
20
+ const blockClass = `${settings.pkg.prefix}--coachmark__next`;
21
+ const componentName = 'Coachmark';
22
+
23
+ // NOTE: the component SCSS is not imported here: it is rolled up separately.
24
+
25
+ // Default values can be included here and then assigned to the prop params,
26
+ // e.g. prop = defaults.prop,
27
+ // This gathers default values together neatly and ensures non-primitive
28
+ // values are initialized early to avoid react making unnecessary re-renders.
29
+ // Note that default values are not required for props that are 'required',
30
+ // nor for props where the component can apply undefined values reasonably.
31
+ // Default values should be provided when the component needs to make a choice
32
+ // or assumption when a prop is not supplied.
33
+
34
+ // Define the type for Coachmark, extending it to include Trigger and Content
35
+
36
+ const CoachmarkContext = /*#__PURE__*/React.createContext({
37
+ open: false,
38
+ setOpen: () => {},
39
+ align: 'bottom',
40
+ triggerRef: {
41
+ current: null
42
+ },
43
+ position: {
44
+ x: 0,
45
+ y: 0
46
+ },
47
+ contentRef: null,
48
+ setContentRef: value => {},
49
+ floating: false
50
+ });
51
+ /**
52
+ * Coachmarks are used to call out specific functionality or concepts
53
+ * within the UI that may not be intuitive but are important for the
54
+ * user to gain understanding of the product's main value and discover new use cases.
55
+ */
56
+ const Coachmark = /*#__PURE__*/React.forwardRef((props, ref) => {
57
+ const {
58
+ children,
59
+ className,
60
+ ariaLabel,
61
+ onClose,
62
+ align = 'bottom',
63
+ open,
64
+ position = {
65
+ x: 0,
66
+ y: 0
67
+ },
68
+ floating,
69
+ ...rest
70
+ } = props;
71
+ const triggerRef = React.useRef(null);
72
+ const internalRef = React.useRef(null);
73
+ const [contentRef, setContentRef] = React.useState(null);
74
+ const [openState, setOpenState] = React.useState(false);
75
+ const setOpen = value => {
76
+ if (!value) {
77
+ onClose?.();
78
+ }
79
+ if (open === undefined) {
80
+ setOpenState(value);
81
+ }
82
+ };
83
+ const currentOpen = open ?? openState;
84
+ React.useEffect(() => {
85
+ const container = internalRef.current;
86
+ if (!container) {
87
+ return;
88
+ }
89
+ const focusableElements = Array.from(container.querySelectorAll('*'));
90
+ const firstFocusable = focusableElements.find(el => el.tabIndex >= 0 && !el.hasAttribute('disabled'));
91
+ if (firstFocusable) {
92
+ triggerRef.current = firstFocusable;
93
+ }
94
+ }, [children]);
95
+ useIsomorphicEffect.useIsomorphicEffect(() => {
96
+ const {
97
+ x = 0,
98
+ y = 0
99
+ } = position ?? {};
100
+ const el = internalRef.current;
101
+ if (el && (x !== 0 || y !== 0)) {
102
+ el.style.transform = `translate(${x}px, ${y}px)`;
103
+ }
104
+ }, [position]);
105
+ const setRef = node => {
106
+ internalRef.current = node;
107
+ if (typeof ref === 'function') {
108
+ ref(node);
109
+ } else if (ref) {
110
+ ref.current = node;
111
+ }
112
+ };
113
+ return /*#__PURE__*/React.createElement(CoachmarkContext.Provider, {
114
+ value: {
115
+ onClose,
116
+ open: currentOpen,
117
+ setOpen,
118
+ align,
119
+ triggerRef,
120
+ position,
121
+ contentRef,
122
+ setContentRef,
123
+ floating
124
+ }
125
+ }, /*#__PURE__*/React.createElement("div", _rollupPluginBabelHelpers.extends({}, rest, {
126
+ className: cx(blockClass,
127
+ // Apply the block class to the main HTML element
128
+ className,
129
+ // Apply any supplied class names to the main HTML element.
130
+ {
131
+ [`${blockClass}--floating`]: floating
132
+ }),
133
+ "aria-label": ariaLabel,
134
+ ref: setRef
135
+ }, devtools.getDevtoolsProps(componentName)), /*#__PURE__*/React.createElement("div", {
136
+ className: `${blockClass}--container`
137
+ }, children)));
138
+ });
139
+ Coachmark.Content = CoachmarkContent.default;
140
+
141
+ // The display name of the component, used by React. Note that displayName
142
+ // is used in preference to relying on function.name.
143
+ Coachmark.displayName = componentName;
144
+
145
+ // The types and DocGen commentary for the component props,
146
+ // in alphabetical order (for consistency).
147
+ // See https://www.npmjs.com/package/prop-types#usage.
148
+ Coachmark.propTypes = {
149
+ /**
150
+ * Where to render the Coachmark relative to its target.
151
+ */
152
+ align: index.default.string,
153
+ /**
154
+ * The aria label applied to the Coachmark component
155
+ */
156
+ ariaLabel: index.default.string,
157
+ /**
158
+ * Provide the contents of the CoachmarkV2.
159
+ */
160
+ children: index.default.node.isRequired,
161
+ /**
162
+ * Provide an optional class to be applied to the containing node.
163
+ */
164
+ className: index.default.string,
165
+ /**
166
+ * Specifies whether the component is currently open.
167
+ */
168
+ defaultOpen: index.default.bool,
169
+ /**
170
+ * Specifies whether the component is floating or not.
171
+ */
172
+ floating: index.default.bool,
173
+ /**
174
+ * Function to call when the close button is clicked.
175
+ */
176
+ onClose: index.default.func,
177
+ /**
178
+ * Fine tune the position of the target in pixels. Applies only to Beacons.
179
+ */
180
+ // @ts-ignore
181
+ position: index.default.shape({
182
+ x: index.default.number,
183
+ y: index.default.number
184
+ })
185
+ };
186
+
187
+ exports.Coachmark = Coachmark;
188
+ exports.CoachmarkContext = CoachmarkContext;
189
+ exports.blockClass = blockClass;
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Copyright IBM Corp. 2024, 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 React, { ElementType } from 'react';
8
+ import { ButtonProps } from '@carbon/react';
9
+ /**
10
+ * Reserved for future expansion, i.e. "RING".
11
+ */
12
+ export declare enum BEACON_KIND {
13
+ DEFAULT = "default"
14
+ }
15
+ export interface CoachmarkButtonProps extends ButtonProps<ElementType> {
16
+ onClick?(): void;
17
+ onDoubleClick?(): void;
18
+ tabIndex?: number;
19
+ ['aria-expanded']?: boolean;
20
+ }
21
+ export interface CoachmarkBeaconProps {
22
+ /**
23
+ * Optional class name for this component.
24
+ */
25
+ className?: string;
26
+ /**
27
+ * What style of beacon.
28
+ * BEACON_KIND is an enum from the Coachmark and can be used for this value.
29
+ * @see {@link BEACON_KIND}
30
+ */
31
+ kind?: BEACON_KIND;
32
+ /**
33
+ * The aria label.
34
+ */
35
+ label: string;
36
+ /**
37
+ * button props
38
+ */
39
+ buttonProps?: CoachmarkButtonProps;
40
+ }
41
+ /**
42
+ * Use beacon for the target prop of a Coachmark component.
43
+ */
44
+ export declare const CoachmarkBeacon: React.ForwardRefExoticComponent<CoachmarkBeaconProps & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Copyright IBM Corp. 2024, 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
+ export { CoachmarkBeacon } from './CoachmarkBeacon';
8
+ export type { CoachmarkBeaconProps } from './CoachmarkBeacon';
@@ -0,0 +1,38 @@
1
+ /**
2
+ * @license
3
+ *
4
+ * Copyright IBM Corp. 2025
5
+ *
6
+ * This source code is licensed under the Apache-2.0 license found in the
7
+ * LICENSE file in the root directory of this source tree.
8
+ */
9
+ import { NewPopoverAlignment } from '@carbon/react';
10
+ import React, { HTMLProps, RefObject } from 'react';
11
+ interface BubbleProps extends Omit<HTMLProps<HTMLDivElement>, 'target'> {
12
+ /**
13
+ * 'top' | 'bottom' | 'left' | 'right' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end' | 'left-end' | 'left-start' | 'right-end' | 'right-start';
14
+ **/
15
+ align?: NewPopoverAlignment;
16
+ /**
17
+ * Values can range from an Element, a ref of an Element, a string which will use query selector to select an Element.
18
+ **/
19
+ target: Element | RefObject<Element> | string | null | undefined;
20
+ /**
21
+ * Specify whether the component should be rendered on high-contrast.
22
+ */
23
+ highContrast?: boolean;
24
+ /**
25
+ * Specify whether a drop shadow should be rendered on the popover.
26
+ */
27
+ dropShadow?: boolean;
28
+ /**
29
+ * Specifies whether the component is currently open.
30
+ */
31
+ open: boolean;
32
+ /**
33
+ * Specify whether a caret should be rendered.
34
+ */
35
+ caret?: boolean;
36
+ }
37
+ declare const CoachmarkBubble: React.ForwardRefExoticComponent<Omit<BubbleProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
38
+ export { CoachmarkBubble };
@@ -0,0 +1,127 @@
1
+ /**
2
+ * Copyright IBM Corp. 2020, 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
+
8
+ 'use strict';
9
+
10
+ var _rollupPluginBabelHelpers = require('../../../../../_virtual/_rollupPluginBabelHelpers.js');
11
+ var cx = require('classnames');
12
+ var react = require('@carbon/react');
13
+ var React = require('react');
14
+ var settings = require('../../../../../settings.js');
15
+ var floatingUi_reactDom = require('../../../../../node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js');
16
+ var floatingUi_dom = require('../../../../../node_modules/@floating-ui/dom/dist/floating-ui.dom.js');
17
+
18
+ const CoachmarkBubble = /*#__PURE__*/React.forwardRef(props => {
19
+ const {
20
+ children,
21
+ align,
22
+ target,
23
+ className,
24
+ dropShadow = true,
25
+ highContrast = false,
26
+ caret = false,
27
+ open,
28
+ ...rest
29
+ } = props;
30
+ const {
31
+ theme
32
+ } = react.useTheme();
33
+ const carbonPrefix = react.usePrefix();
34
+ const tooltipRef = React.useRef(null);
35
+ const arrowRef = React.useRef(null);
36
+ const targetRef = React.useRef(null);
37
+ React.useLayoutEffect(() => {
38
+ if (target) {
39
+ if (typeof target === 'string') {
40
+ targetRef.current = document.querySelector(target);
41
+ } else if ('current' in target) {
42
+ targetRef.current = target.current;
43
+ } else {
44
+ targetRef.current = target;
45
+ }
46
+ if (targetRef.current && tooltipRef.current && arrowRef.current && open) {
47
+ targetRef.current.scrollIntoView({
48
+ behavior: 'smooth',
49
+ block: 'center',
50
+ inline: 'center'
51
+ });
52
+ const middlewares = [floatingUi_reactDom.offset(10), floatingUi_reactDom.flip(), floatingUi_reactDom.shift({
53
+ padding: 5
54
+ }), floatingUi_reactDom.arrow({
55
+ element: arrowRef.current
56
+ })];
57
+ const cleanup = floatingUi_dom.autoUpdate(targetRef.current, tooltipRef.current, () => {
58
+ if (targetRef.current && tooltipRef.current) {
59
+ floatingUi_dom.computePosition(targetRef.current, tooltipRef.current, {
60
+ placement: align,
61
+ strategy: 'fixed',
62
+ middleware: middlewares
63
+ }).then(_ref => {
64
+ let {
65
+ x,
66
+ y,
67
+ placement,
68
+ middlewareData
69
+ } = _ref;
70
+ if (tooltipRef.current) {
71
+ Object.assign(tooltipRef.current.style, {
72
+ left: `${x}px`,
73
+ top: `${y}px`
74
+ });
75
+ }
76
+ const arrowX = middlewareData.arrow?.x;
77
+ const arrowY = middlewareData.arrow?.y;
78
+ const staticSide = {
79
+ top: 'bottom',
80
+ right: 'left',
81
+ bottom: 'top',
82
+ left: 'right'
83
+ }[placement.split('-')[0]];
84
+ if (staticSide && arrowRef.current) {
85
+ Object.assign(arrowRef.current.style, {
86
+ left: arrowX != null ? `${arrowX}px` : '',
87
+ top: arrowY != null ? `${arrowY}px` : '',
88
+ right: '',
89
+ bottom: '',
90
+ [staticSide]: '-4px'
91
+ });
92
+ }
93
+ });
94
+ }
95
+ }, {
96
+ animationFrame: true
97
+ });
98
+ return () => {
99
+ cleanup();
100
+ };
101
+ }
102
+ }
103
+ }, [target, open, align]);
104
+ if (!target) {
105
+ return null;
106
+ }
107
+ return /*#__PURE__*/React.createElement("div", _rollupPluginBabelHelpers.extends({}, rest, {
108
+ ref: tooltipRef,
109
+ className: cx({
110
+ [`${carbonPrefix}--g100`]: theme === 'white' && highContrast || theme === 'g100' && !highContrast,
111
+ [`${carbonPrefix}--g90`]: theme === 'g10' && highContrast || theme === 'g90' && !highContrast,
112
+ [`${carbonPrefix}--g10`]: theme === 'g90' && highContrast || theme === 'g10' && !highContrast,
113
+ [`${carbonPrefix}--white`]: theme === 'g100' && highContrast || theme === 'white' && !highContrast,
114
+ [`${settings.pkg.prefix}__bubble`]: true,
115
+ [`${settings.pkg.prefix}__bubble-open`]: open,
116
+ [`${settings.pkg.prefix}__bubble-drop-shadow`]: dropShadow,
117
+ [`${settings.pkg.prefix}__bubble-high-contrast`]: highContrast,
118
+ [`${settings.pkg.prefix}__bubble-hidden`]: !targetRef.current
119
+ }, className)
120
+ }), /*#__PURE__*/React.createElement("div", {
121
+ ref: arrowRef,
122
+ className: !caret ? `${settings.pkg.prefix}__bubble__arrow` : ''
123
+ }), children);
124
+ });
125
+ CoachmarkBubble.displayName = 'CoachmarkBubble';
126
+
127
+ exports.CoachmarkBubble = CoachmarkBubble;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @license
3
+ *
4
+ * Copyright IBM Corp. 2025
5
+ *
6
+ * This source code is licensed under the Apache-2.0 license found in the
7
+ * LICENSE file in the root directory of this source tree.
8
+ */
9
+ import React, { HTMLProps, ReactNode } from 'react';
10
+ interface BubbleHeaderProps extends HTMLProps<HTMLElement> {
11
+ /**
12
+ * Provide the contents of the Bubble header
13
+ */
14
+ children: ReactNode;
15
+ /**
16
+ * Provide an optional class to be applied to the containing node.
17
+ */
18
+ className?: string;
19
+ }
20
+ declare const CoachmarkBubbleHeader: {
21
+ ({ children, className, ...rest }: BubbleHeaderProps): React.JSX.Element;
22
+ displayName: string;
23
+ };
24
+ export { CoachmarkBubbleHeader };
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Copyright IBM Corp. 2020, 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
+
8
+ 'use strict';
9
+
10
+ var _rollupPluginBabelHelpers = require('../../../../../_virtual/_rollupPluginBabelHelpers.js');
11
+ var React = require('react');
12
+ var cx = require('classnames');
13
+ var settings = require('../../../../../settings.js');
14
+
15
+ const CoachmarkBubbleHeader = _ref => {
16
+ let {
17
+ children,
18
+ className,
19
+ ...rest
20
+ } = _ref;
21
+ return /*#__PURE__*/React.createElement("header", _rollupPluginBabelHelpers.extends({}, rest, {
22
+ className: cx(`${settings.pkg.prefix}__bubble__header`, className)
23
+ }), children);
24
+ };
25
+ CoachmarkBubbleHeader.displayName = 'CoachmarkBubbleHeader';
26
+
27
+ exports.CoachmarkBubbleHeader = CoachmarkBubbleHeader;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @license
3
+ *
4
+ * Copyright IBM Corp. 2025
5
+ *
6
+ * This source code is licensed under the Apache-2.0 license found in the
7
+ * LICENSE file in the root directory of this source tree.
8
+ */
9
+ export { CoachmarkBubble } from './CoachmarkBubble';
10
+ export { CoachmarkBubbleHeader } from './CoachmarkBubbleHeader';
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Copyright IBM Corp. 2024, 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 { FC, ForwardRefExoticComponent, ReactElement, ReactNode, RefAttributes } from 'react';
8
+ import { ContentHeaderProps } from './ContentHeader';
9
+ import { ContentBodyProps } from './ContentBody';
10
+ export interface CoachmarkContentProps {
11
+ /**
12
+ * Provide an optional class to be applied to the containing node.
13
+ */
14
+ className?: string;
15
+ /**
16
+ * This is a required callback that has to return the content to render in the body section.
17
+ * It can be a single child or an array of children depending on your need
18
+ */
19
+ children: ReactElement | ReactNode;
20
+ /**
21
+ * Specify whether the component should be rendered on high-contrast.
22
+ */
23
+ highContrast?: boolean;
24
+ /**
25
+ * Specify whether a drop shadow should be rendered on the popover.
26
+ */
27
+ dropShadow?: boolean;
28
+ }
29
+ export type CoachmarkContentComponent = ForwardRefExoticComponent<CoachmarkContentProps & RefAttributes<HTMLDivElement>> & {
30
+ Header: FC<ContentHeaderProps>;
31
+ Body: FC<ContentBodyProps>;
32
+ };
33
+ declare const CoachmarkContent: CoachmarkContentComponent;
34
+ export default CoachmarkContent;