@carbon/ibm-products 2.23.0 → 2.24.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (186) hide show
  1. package/css/index-full-carbon.css +29484 -28211
  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 +49 -10
  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 +24418 -291
  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 +17172 -13
  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/Card/Card.js +1 -2
  18. package/es/components/Card/CardHeader.js +2 -2
  19. package/es/components/Carousel/Carousel.js +5 -3
  20. package/es/components/Coachmark/Coachmark.js +255 -0
  21. package/es/components/Coachmark/CoachmarkDragbar.js +146 -0
  22. package/es/components/Coachmark/CoachmarkHeader.js +91 -0
  23. package/es/components/Coachmark/CoachmarkOverlay.js +235 -0
  24. package/es/components/Coachmark/CoachmarkTagline.js +97 -0
  25. package/es/components/Coachmark/index.js +10 -0
  26. package/es/components/Coachmark/utils/constants.js +76 -0
  27. package/es/components/Coachmark/utils/context.js +5 -0
  28. package/es/components/Coachmark/utils/enums.js +40 -0
  29. package/es/components/Coachmark/utils/helpers.js +11 -0
  30. package/es/components/Coachmark/utils/hooks.js +54 -0
  31. package/es/components/CoachmarkBeacon/CoachmarkBeacon.js +93 -0
  32. package/es/components/CoachmarkBeacon/index.js +8 -0
  33. package/es/components/CoachmarkButton/CoachmarkButton.js +90 -0
  34. package/es/components/CoachmarkButton/index.js +8 -0
  35. package/es/components/CoachmarkFixed/CoachmarkFixed.js +226 -0
  36. package/es/components/CoachmarkFixed/index.js +8 -0
  37. package/es/components/CoachmarkOverlayElement/CoachmarkOverlayElement.js +86 -0
  38. package/es/components/CoachmarkOverlayElement/index.js +8 -0
  39. package/es/components/CoachmarkOverlayElements/CoachmarkOverlayElements.js +216 -0
  40. package/es/components/CoachmarkOverlayElements/index.js +8 -0
  41. package/es/components/CoachmarkStack/CoachmarkStack.js +283 -0
  42. package/es/components/CoachmarkStack/CoachmarkStackHome.js +192 -0
  43. package/es/components/CoachmarkStack/index.js +8 -0
  44. package/es/components/Datagrid/Datagrid/DatagridSelectAll.js +4 -1
  45. package/es/components/Datagrid/Datagrid/DraggableElement.js +1 -1
  46. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/ButtonWrapper.js +1 -1
  47. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +4 -1
  48. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js +1 -1
  49. package/es/components/Datagrid/Datagrid.docs-page.js +2 -2
  50. package/es/components/Datagrid/useActionsColumn.js +16 -12
  51. package/es/components/Datagrid/useNestedRowExpander.js +2 -2
  52. package/es/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +7 -2
  53. package/es/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +8 -3
  54. package/es/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +7 -2
  55. package/es/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +7 -2
  56. package/es/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +7 -2
  57. package/es/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +7 -2
  58. package/es/components/EmptyStates/assets/ErrorIllustration.js +5 -5
  59. package/es/components/EmptyStates/assets/NoDataIllustration.js +5 -5
  60. package/es/components/EmptyStates/assets/NoTagsIllustration.js +5 -5
  61. package/es/components/EmptyStates/assets/NotFoundIllustration.js +5 -5
  62. package/es/components/EmptyStates/assets/NotificationsIllustration.js +5 -5
  63. package/es/components/EmptyStates/assets/UnauthorizedIllustration.js +5 -5
  64. package/es/components/InterstitialScreen/InterstitialScreen.js +427 -0
  65. package/es/components/InterstitialScreen/index.js +8 -0
  66. package/es/components/InterstitialScreenView/InterstitialScreenView.js +75 -0
  67. package/es/components/InterstitialScreenView/index.js +8 -0
  68. package/es/components/InterstitialScreenViewModule/InterstitialScreenViewModule.js +83 -0
  69. package/es/components/InterstitialScreenViewModule/index.js +8 -0
  70. package/es/components/PageHeader/PageHeaderUtils.js +2 -2
  71. package/es/components/SearchBar/SearchBar.js +227 -0
  72. package/es/components/SearchBar/index.js +8 -0
  73. package/es/components/index.js +12 -1
  74. package/es/global/js/package-settings.js +14 -0
  75. package/lib/components/Card/Card.js +3 -4
  76. package/lib/components/Card/CardHeader.js +2 -2
  77. package/lib/components/Carousel/Carousel.js +5 -3
  78. package/lib/components/Coachmark/Coachmark.js +264 -0
  79. package/lib/components/Coachmark/CoachmarkDragbar.js +151 -0
  80. package/lib/components/Coachmark/CoachmarkHeader.js +95 -0
  81. package/lib/components/Coachmark/CoachmarkOverlay.js +243 -0
  82. package/lib/components/Coachmark/CoachmarkTagline.js +101 -0
  83. package/lib/components/Coachmark/index.js +38 -0
  84. package/lib/components/Coachmark/utils/constants.js +81 -0
  85. package/lib/components/Coachmark/utils/context.js +11 -0
  86. package/lib/components/Coachmark/utils/enums.js +46 -0
  87. package/lib/components/Coachmark/utils/helpers.js +17 -0
  88. package/lib/components/Coachmark/utils/hooks.js +59 -0
  89. package/lib/components/CoachmarkBeacon/CoachmarkBeacon.js +97 -0
  90. package/lib/components/CoachmarkBeacon/index.js +12 -0
  91. package/lib/components/CoachmarkButton/CoachmarkButton.js +93 -0
  92. package/lib/components/CoachmarkButton/index.js +12 -0
  93. package/lib/components/CoachmarkFixed/CoachmarkFixed.js +232 -0
  94. package/lib/components/CoachmarkFixed/index.js +12 -0
  95. package/lib/components/CoachmarkOverlayElement/CoachmarkOverlayElement.js +90 -0
  96. package/lib/components/CoachmarkOverlayElement/index.js +12 -0
  97. package/lib/components/CoachmarkOverlayElements/CoachmarkOverlayElements.js +222 -0
  98. package/lib/components/CoachmarkOverlayElements/index.js +12 -0
  99. package/lib/components/CoachmarkStack/CoachmarkStack.js +288 -0
  100. package/lib/components/CoachmarkStack/CoachmarkStackHome.js +198 -0
  101. package/lib/components/CoachmarkStack/index.js +12 -0
  102. package/lib/components/Datagrid/Datagrid/DatagridSelectAll.js +4 -1
  103. package/lib/components/Datagrid/Datagrid/DraggableElement.js +1 -1
  104. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/ButtonWrapper.js +1 -1
  105. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +4 -1
  106. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js +1 -1
  107. package/lib/components/Datagrid/Datagrid.docs-page.js +2 -2
  108. package/lib/components/Datagrid/useActionsColumn.js +15 -11
  109. package/lib/components/Datagrid/useNestedRowExpander.js +2 -2
  110. package/lib/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +7 -2
  111. package/lib/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +8 -3
  112. package/lib/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +7 -2
  113. package/lib/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +7 -2
  114. package/lib/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +7 -2
  115. package/lib/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +7 -2
  116. package/lib/components/EmptyStates/assets/ErrorIllustration.js +5 -5
  117. package/lib/components/EmptyStates/assets/NoDataIllustration.js +5 -5
  118. package/lib/components/EmptyStates/assets/NoTagsIllustration.js +5 -5
  119. package/lib/components/EmptyStates/assets/NotFoundIllustration.js +5 -5
  120. package/lib/components/EmptyStates/assets/NotificationsIllustration.js +5 -5
  121. package/lib/components/EmptyStates/assets/UnauthorizedIllustration.js +5 -5
  122. package/lib/components/InterstitialScreen/InterstitialScreen.js +434 -0
  123. package/lib/components/InterstitialScreen/index.js +12 -0
  124. package/lib/components/InterstitialScreenView/InterstitialScreenView.js +77 -0
  125. package/lib/components/InterstitialScreenView/index.js +12 -0
  126. package/lib/components/InterstitialScreenViewModule/InterstitialScreenViewModule.js +85 -0
  127. package/lib/components/InterstitialScreenViewModule/index.js +12 -0
  128. package/lib/components/PageHeader/PageHeaderUtils.js +2 -2
  129. package/lib/components/SearchBar/SearchBar.js +233 -0
  130. package/lib/components/SearchBar/index.js +12 -0
  131. package/lib/components/index.js +78 -1
  132. package/lib/global/js/package-settings.js +14 -0
  133. package/package.json +5 -5
  134. package/scss/components/Card/_card.scss +6 -5
  135. package/scss/components/Coachmark/_carbon-imports.scss +10 -0
  136. package/scss/components/Coachmark/_coachmark-dragbar.scss +27 -0
  137. package/scss/components/Coachmark/_coachmark-header.scss +20 -0
  138. package/scss/components/Coachmark/_coachmark-overlay.scss +431 -0
  139. package/scss/components/Coachmark/_coachmark-tagline.scss +140 -0
  140. package/scss/components/Coachmark/_coachmark.scss +30 -0
  141. package/scss/components/Coachmark/_index-with-carbon.scss +9 -0
  142. package/scss/components/Coachmark/_index.scss +8 -0
  143. package/scss/components/CoachmarkBeacon/_carbon-imports.scss +9 -0
  144. package/scss/components/CoachmarkBeacon/_coachmark-beacon.scss +166 -0
  145. package/scss/components/CoachmarkBeacon/_index-with-carbon.scss +9 -0
  146. package/scss/components/CoachmarkBeacon/_index.scss +8 -0
  147. package/scss/components/CoachmarkButton/_carbon-imports.scss +9 -0
  148. package/scss/components/CoachmarkButton/_coachmark-button.scss +25 -0
  149. package/scss/components/CoachmarkButton/_index-with-carbon.scss +9 -0
  150. package/scss/components/CoachmarkButton/_index.scss +8 -0
  151. package/scss/components/CoachmarkFixed/_carbon-imports.scss +9 -0
  152. package/scss/components/CoachmarkFixed/_coachmark-fixed.scss +25 -0
  153. package/scss/components/CoachmarkFixed/_index-with-carbon.scss +9 -0
  154. package/scss/components/CoachmarkFixed/_index.scss +8 -0
  155. package/scss/components/CoachmarkOverlayElement/_carbon-imports.scss +9 -0
  156. package/scss/components/CoachmarkOverlayElement/_coachmark-overlay-element.scss +52 -0
  157. package/scss/components/CoachmarkOverlayElement/_index-with-carbon.scss +9 -0
  158. package/scss/components/CoachmarkOverlayElement/_index.scss +8 -0
  159. package/scss/components/CoachmarkOverlayElements/_carbon-imports.scss +9 -0
  160. package/scss/components/CoachmarkOverlayElements/_coachmark-overlay-elements.scss +47 -0
  161. package/scss/components/CoachmarkOverlayElements/_index-with-carbon.scss +9 -0
  162. package/scss/components/CoachmarkOverlayElements/_index.scss +8 -0
  163. package/scss/components/CoachmarkStack/_carbon-imports.scss +9 -0
  164. package/scss/components/CoachmarkStack/_coachmark-stack.scss +95 -0
  165. package/scss/components/CoachmarkStack/_index-with-carbon.scss +9 -0
  166. package/scss/components/CoachmarkStack/_index.scss +8 -0
  167. package/scss/components/InterstitialScreen/_carbon-imports.scss +9 -0
  168. package/scss/components/InterstitialScreen/_index-with-carbon.scss +9 -0
  169. package/scss/components/InterstitialScreen/_index.scss +8 -0
  170. package/scss/components/InterstitialScreen/_interstitial-screen.scss +276 -0
  171. package/scss/components/InterstitialScreenView/_carbon-imports.scss +9 -0
  172. package/scss/components/InterstitialScreenView/_index-with-carbon.scss +9 -0
  173. package/scss/components/InterstitialScreenView/_index.scss +8 -0
  174. package/scss/components/InterstitialScreenView/_interstitial-screen-view.scss +25 -0
  175. package/scss/components/InterstitialScreenViewModule/_carbon-imports.scss +9 -0
  176. package/scss/components/InterstitialScreenViewModule/_index-with-carbon.scss +9 -0
  177. package/scss/components/InterstitialScreenViewModule/_index.scss +8 -0
  178. package/scss/components/InterstitialScreenViewModule/_interstitial-screen-view-module.scss +59 -0
  179. package/scss/components/PageHeader/_page-header.scss +0 -1
  180. package/scss/components/SearchBar/_carbon-imports.scss +9 -0
  181. package/scss/components/SearchBar/_index-with-carbon.scss +9 -0
  182. package/scss/components/SearchBar/_index.scss +8 -0
  183. package/scss/components/SearchBar/_search-bar.scss +26 -0
  184. package/scss/components/SidePanel/_side-panel.scss +12 -7
  185. package/scss/components/_index-with-carbon.scss +11 -0
  186. package/scss/components/_index.scss +11 -0
@@ -0,0 +1,151 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.CoachmarkDragbar = void 0;
9
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
12
+ var _react = _interopRequireWildcard(require("react"));
13
+ var _propTypes = _interopRequireDefault(require("prop-types"));
14
+ var _classnames = _interopRequireDefault(require("classnames"));
15
+ var _icons = require("@carbon/react/icons");
16
+ var _react2 = require("@carbon/react");
17
+ var _devtools = require("../../global/js/utils/devtools");
18
+ var _settings = require("../../settings");
19
+ var _excluded = ["a11yKeyboardHandler", "closeIconDescription", "onClose", "onDrag", "showCloseButton", "theme"];
20
+ /**
21
+ * Copyright IBM Corp. 2023, 2024
22
+ *
23
+ * This source code is licensed under the Apache-2.0 license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */
26
+ // Import portions of React that are needed.
27
+ // Other standard imports.
28
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
29
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
30
+ // Carbon and package components we use.
31
+ /* TODO: @import(s) of carbon components and other package components. */ // The block part of our conventional BEM class names (blockClass__E--M).
32
+ var blockClass = "".concat(_settings.pkg.prefix, "--coachmark-dragbar");
33
+ var overlayBlockClass = "".concat(_settings.pkg.prefix, "--coachmark-overlay");
34
+ var componentName = 'CoachmarkDragbar';
35
+ var defaults = {
36
+ closeIconDescription: 'Close',
37
+ onDrag: function onDrag() {},
38
+ onClose: function onClose() {},
39
+ showCloseButton: true,
40
+ theme: 'light'
41
+ };
42
+
43
+ /**
44
+ * DO NOT USE. This component is for the exclusive use
45
+ * of other Novice to Pro components.
46
+ */
47
+ var CoachmarkDragbar = exports.CoachmarkDragbar = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
48
+ var a11yKeyboardHandler = _ref.a11yKeyboardHandler,
49
+ _ref$closeIconDescrip = _ref.closeIconDescription,
50
+ closeIconDescription = _ref$closeIconDescrip === void 0 ? defaults.closeIconDescription : _ref$closeIconDescrip,
51
+ _ref$onClose = _ref.onClose,
52
+ onClose = _ref$onClose === void 0 ? defaults.onClose : _ref$onClose,
53
+ _ref$onDrag = _ref.onDrag,
54
+ onDrag = _ref$onDrag === void 0 ? defaults.onDrag : _ref$onDrag,
55
+ _ref$showCloseButton = _ref.showCloseButton,
56
+ showCloseButton = _ref$showCloseButton === void 0 ? defaults.showCloseButton : _ref$showCloseButton,
57
+ _ref$theme = _ref.theme,
58
+ theme = _ref$theme === void 0 ? defaults.theme : _ref$theme,
59
+ rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
60
+ var _useState = (0, _react.useState)(false),
61
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
62
+ isDragging = _useState2[0],
63
+ setIsDragging = _useState2[1];
64
+ (0, _react.useEffect)(function () {
65
+ var handleDragStop = function handleDragStop() {
66
+ return setIsDragging(false);
67
+ };
68
+ window.addEventListener('mouseup', handleDragStop);
69
+ return function () {
70
+ window.removeEventListener('mouseup', handleDragStop);
71
+ };
72
+ }, []);
73
+ (0, _react.useEffect)(function () {
74
+ var handleDrag = function handleDrag(event) {
75
+ onDrag(event.movementX, event.movementY);
76
+ };
77
+ if (isDragging) {
78
+ window.addEventListener('mousemove', handleDrag);
79
+ }
80
+ return function () {
81
+ window.removeEventListener('mousemove', handleDrag);
82
+ };
83
+ }, [isDragging, onDrag]);
84
+ var handleDragStart = function handleDragStart() {
85
+ return setIsDragging(true);
86
+ };
87
+ return /*#__PURE__*/_react.default.createElement("header", (0, _extends2.default)({}, rest, {
88
+ className: (0, _classnames.default)(blockClass, // Apply the block class to the main HTML element
89
+ "".concat(blockClass, "__").concat(theme),
90
+ // example: `${blockClass}__template-string-class-${kind}-n-${size}`,
91
+ {
92
+ // switched classes dependant on props or state
93
+ // example: [`${blockClass}__here-if-small`]: size === 'sm',
94
+ }),
95
+ ref: ref
96
+ // role="main"
97
+ }, (0, _devtools.getDevtoolsProps)(componentName)), /*#__PURE__*/_react.default.createElement("button", {
98
+ type: "button",
99
+ className: "".concat(overlayBlockClass, "__handle"),
100
+ onMouseDown: handleDragStart,
101
+ onKeyDown: a11yKeyboardHandler
102
+ }, /*#__PURE__*/_react.default.createElement(_icons.Draggable, {
103
+ size: "16"
104
+ })), showCloseButton && /*#__PURE__*/_react.default.createElement(_react2.Button, {
105
+ kind: "ghost",
106
+ size: "sm",
107
+ renderIcon: _icons.Close,
108
+ iconDescription: closeIconDescription,
109
+ hasIconOnly: true,
110
+ className: "".concat(overlayBlockClass, "--close-btn"),
111
+ onClick: onClose
112
+ }));
113
+ });
114
+
115
+ // Return a placeholder if not released and not enabled by feature flag
116
+ exports.CoachmarkDragbar = CoachmarkDragbar = _settings.pkg.checkComponentEnabled(CoachmarkDragbar, componentName);
117
+
118
+ // The display name of the component, used by React. Note that displayName
119
+ // is used in preference to relying on function.name.
120
+ CoachmarkDragbar.displayName = componentName;
121
+
122
+ // The types and DocGen commentary for the component props,
123
+ // in alphabetical order (for consistency).
124
+ // See https://www.npmjs.com/package/prop-types#usage.
125
+ CoachmarkDragbar.propTypes = {
126
+ /**
127
+ * Handler to manage keyboard interactions with the dragbar.
128
+ */
129
+ a11yKeyboardHandler: _propTypes.default.func.isRequired,
130
+ /**
131
+ * Tooltip text and aria label for the Close button icon.
132
+ */
133
+ closeIconDescription: _propTypes.default.string,
134
+ /**
135
+ * Function to call when the close button is clicked.
136
+ */
137
+ onClose: _propTypes.default.func,
138
+ /**
139
+ * Function to call when the user clicks and drags the Coachmark.
140
+ * For internal use only by the parent CoachmarkOverlay.
141
+ */
142
+ onDrag: _propTypes.default.func,
143
+ /**
144
+ * Show/hide the "X" close button.
145
+ */
146
+ showCloseButton: _propTypes.default.bool,
147
+ /**
148
+ * Determines the theme of the component.
149
+ */
150
+ theme: _propTypes.default.oneOf(['light', 'dark'])
151
+ };
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.CoachmarkHeader = void 0;
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
10
+ var _react = _interopRequireDefault(require("react"));
11
+ var _propTypes = _interopRequireDefault(require("prop-types"));
12
+ var _classnames = _interopRequireDefault(require("classnames"));
13
+ var _icons = require("@carbon/react/icons");
14
+ var _react2 = require("@carbon/react");
15
+ var _devtools = require("../../global/js/utils/devtools");
16
+ var _settings = require("../../settings");
17
+ var _excluded = ["closeIconDescription", "onClose", "showCloseButton", "theme"];
18
+ /**
19
+ * Copyright IBM Corp. 2023, 2024
20
+ *
21
+ * This source code is licensed under the Apache-2.0 license found in the
22
+ * LICENSE file in the root directory of this source tree.
23
+ */
24
+ // Import portions of React that are needed.
25
+ // Other standard imports.
26
+ // The block part of our conventional BEM class names (blockClass__E--M).
27
+ var blockClass = "".concat(_settings.pkg.prefix, "--coachmark-header");
28
+ var overlayBlockClass = "".concat(_settings.pkg.prefix, "--coachmark-overlay");
29
+ var componentName = 'CoachmarkHeader';
30
+ var defaults = {
31
+ closeIconDescription: 'Close',
32
+ onClose: function onClose() {},
33
+ showCloseButton: true,
34
+ theme: 'light'
35
+ };
36
+
37
+ /**
38
+ * DO NOT USE. This component is for the exclusive use
39
+ * of other Novice to Pro components.
40
+ */
41
+ var CoachmarkHeader = exports.CoachmarkHeader = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
42
+ var _ref$closeIconDescrip = _ref.closeIconDescription,
43
+ closeIconDescription = _ref$closeIconDescrip === void 0 ? defaults.closeIconDescription : _ref$closeIconDescrip,
44
+ _ref$onClose = _ref.onClose,
45
+ onClose = _ref$onClose === void 0 ? defaults.onClose : _ref$onClose,
46
+ _ref$showCloseButton = _ref.showCloseButton,
47
+ showCloseButton = _ref$showCloseButton === void 0 ? defaults.showCloseButton : _ref$showCloseButton,
48
+ _ref$theme = _ref.theme,
49
+ theme = _ref$theme === void 0 ? defaults.theme : _ref$theme,
50
+ rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
51
+ return /*#__PURE__*/_react.default.createElement("header", (0, _extends2.default)({}, rest, {
52
+ className: (0, _classnames.default)(blockClass, "".concat(blockClass, "__").concat(theme)),
53
+ ref: ref
54
+ // role="main"
55
+ }, (0, _devtools.getDevtoolsProps)(componentName)), showCloseButton && /*#__PURE__*/_react.default.createElement("div", {
56
+ className: "".concat(overlayBlockClass, "--close-btn-container")
57
+ }, /*#__PURE__*/_react.default.createElement(_react2.Button, {
58
+ kind: "ghost",
59
+ size: "sm",
60
+ renderIcon: _icons.Close,
61
+ iconDescription: closeIconDescription,
62
+ hasIconOnly: true,
63
+ className: "".concat(overlayBlockClass, "--close-btn"),
64
+ onClick: onClose
65
+ })));
66
+ });
67
+
68
+ // Return a placeholder if not released and not enabled by feature flag
69
+ exports.CoachmarkHeader = CoachmarkHeader = _settings.pkg.checkComponentEnabled(CoachmarkHeader, componentName);
70
+
71
+ // The display name of the component, used by React. Note that displayName
72
+ // is used in preference to relying on function.name.
73
+ CoachmarkHeader.displayName = componentName;
74
+
75
+ // The types and DocGen commentary for the component props,
76
+ // in alphabetical order (for consistency).
77
+ // See https://www.npmjs.com/package/prop-types#usage.
78
+ CoachmarkHeader.propTypes = {
79
+ /**
80
+ * Tooltip text and aria label for the Close button icon.
81
+ */
82
+ closeIconDescription: _propTypes.default.string,
83
+ /**
84
+ * Function to call when the close button is clicked.
85
+ */
86
+ onClose: _propTypes.default.func,
87
+ /**
88
+ * Show/hide the "X" close button.
89
+ */
90
+ showCloseButton: _propTypes.default.bool,
91
+ /**
92
+ * Determines the theme of the component.
93
+ */
94
+ theme: _propTypes.default.oneOf(['light', 'dark'])
95
+ };
@@ -0,0 +1,243 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.CoachmarkOverlay = void 0;
9
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
12
+ var _react = _interopRequireWildcard(require("react"));
13
+ var _uuidv = _interopRequireDefault(require("../../global/js/utils/uuidv4"));
14
+ var _propTypes = _interopRequireDefault(require("prop-types"));
15
+ var _classnames = _interopRequireDefault(require("classnames"));
16
+ var _devtools = require("../../global/js/utils/devtools");
17
+ var _settings = require("../../settings");
18
+ var _CoachmarkDragbar = require("./CoachmarkDragbar");
19
+ var _CoachmarkHeader = require("./CoachmarkHeader");
20
+ var _constants = require("./utils/constants");
21
+ var _context = require("./utils/context");
22
+ var _enums = require("./utils/enums");
23
+ var _excluded = ["children", "onClose", "fixedIsVisible", "className", "kind", "theme"];
24
+ /**
25
+ * Copyright IBM Corp. 2023, 2024
26
+ *
27
+ * This source code is licensed under the Apache-2.0 license found in the
28
+ * LICENSE file in the root directory of this source tree.
29
+ */
30
+ // Import portions of React that are needed.
31
+ // Other standard imports.
32
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
33
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
34
+ // The block part of our conventional BEM class names (blockClass__E--M).
35
+ var blockClass = "".concat(_settings.pkg.prefix, "--coachmark-overlay");
36
+ var componentName = 'CoachmarkOverlay';
37
+
38
+ // NOTE: the component SCSS is not imported here: it is rolled up separately.
39
+
40
+ var defaults = {
41
+ kind: _enums.COACHMARK_OVERLAY_KIND.FLOATING,
42
+ theme: 'light'
43
+ };
44
+
45
+ /**
46
+ * DO NOT USE. This component is for the exclusive use
47
+ * of other Novice to Pro components.
48
+ */
49
+ var CoachmarkOverlay = exports.CoachmarkOverlay = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
50
+ var children = _ref.children,
51
+ onClose = _ref.onClose,
52
+ fixedIsVisible = _ref.fixedIsVisible,
53
+ className = _ref.className,
54
+ _ref$kind = _ref.kind,
55
+ kind = _ref$kind === void 0 ? defaults.kind : _ref$kind,
56
+ _ref$theme = _ref.theme,
57
+ theme = _ref$theme === void 0 ? defaults.theme : _ref$theme,
58
+ rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
59
+ var _useWindowDimensions = useWindowDimensions(),
60
+ winHeight = _useWindowDimensions.winHeight,
61
+ winWidth = _useWindowDimensions.winWidth;
62
+ var _useState = (0, _react.useState)(false),
63
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
64
+ a11yDragMode = _useState2[0],
65
+ setA11yDragMode = _useState2[1];
66
+ var overlayRef = (0, _react.useRef)();
67
+ var coachmark = (0, _context.useCoachmark)();
68
+ var isBeacon = kind === _enums.COACHMARK_OVERLAY_KIND.TOOLTIP;
69
+ var isDraggable = kind === _enums.COACHMARK_OVERLAY_KIND.FLOATING;
70
+ var isVisible = className && className.includes('is-visible');
71
+ var handleKeyPress = function handleKeyPress(event) {
72
+ var shiftKey = event.shiftKey,
73
+ key = event.key;
74
+ if (key === 'Enter' || key === ' ') {
75
+ setA11yDragMode(function (prevVal) {
76
+ return !prevVal;
77
+ });
78
+ } else if (a11yDragMode) {
79
+ var distanceToMove = shiftKey ? 128 : 32;
80
+ switch (key) {
81
+ case 'ArrowLeft':
82
+ handleDrag(distanceToMove * -1, 0);
83
+ break;
84
+ case 'ArrowRight':
85
+ handleDrag(distanceToMove, 0);
86
+ break;
87
+ case 'ArrowUp':
88
+ handleDrag(0, distanceToMove * -1);
89
+ break;
90
+ case 'ArrowDown':
91
+ handleDrag(0, distanceToMove);
92
+ break;
93
+ default:
94
+ break;
95
+ }
96
+ }
97
+ };
98
+ var styledTune = {};
99
+ if (isBeacon || isDraggable) {
100
+ if (coachmark.targetRect) {
101
+ styledTune = {
102
+ left: coachmark.targetRect.x + window.scrollX,
103
+ top: coachmark.targetRect.y + window.scrollY
104
+ };
105
+ }
106
+ if (isBeacon) {
107
+ // Compensate for radius of beacon
108
+ styledTune.left += 16;
109
+ styledTune.top += 16;
110
+ } else if (isDraggable) {
111
+ // Compensate for width and height of target element
112
+ var offsetTune = (0, _constants.getOffsetTune)(coachmark, kind);
113
+ styledTune.left += offsetTune.left;
114
+ styledTune.top += offsetTune.top;
115
+ }
116
+ }
117
+ function handleDragBounds(x, y) {
118
+ var xRes = x;
119
+ var yRes = y;
120
+ var xMax = winWidth - 288;
121
+ var yMax = winHeight - 150;
122
+ if (xRes < 0) {
123
+ xRes = 0;
124
+ } else if (xRes > xMax) {
125
+ xRes = xMax;
126
+ }
127
+ if (yRes < 0) {
128
+ yRes = 0;
129
+ } else if (yRes > yMax) {
130
+ yRes = yMax;
131
+ }
132
+ return {
133
+ targetX: xRes,
134
+ targetY: yRes
135
+ };
136
+ }
137
+ function handleDrag(movementX, movementY) {
138
+ var overlay = overlayRef.current;
139
+ var _overlay$getBoundingC = overlay.getBoundingClientRect(),
140
+ x = _overlay$getBoundingC.x,
141
+ y = _overlay$getBoundingC.y;
142
+ var _handleDragBounds = handleDragBounds(x + movementX, y + movementY),
143
+ targetX = _handleDragBounds.targetX,
144
+ targetY = _handleDragBounds.targetY;
145
+ overlay.style.transform = 'none';
146
+ overlay.style.position = 'fixed';
147
+ overlay.style.left = "".concat(targetX, "px");
148
+ overlay.style.top = "".concat(targetY, "px");
149
+ overlay.style.bottom = 'auto';
150
+ }
151
+ var contentId = (0, _uuidv.default)();
152
+ return /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, rest, {
153
+ className: (0, _classnames.default)(blockClass, "".concat(blockClass, "--").concat(kind), "".concat(blockClass, "__").concat(theme), (isBeacon || isDraggable) && "".concat(blockClass, "--").concat(coachmark.align), fixedIsVisible && "".concat(blockClass, "--is-visible"), a11yDragMode && "".concat(blockClass, "--is-dragmode"), className),
154
+ ref: overlayRef,
155
+ style: styledTune,
156
+ "aria-labelledby": contentId,
157
+ tabIndex: -1
158
+ }, (0, _devtools.getDevtoolsProps)(componentName)), isDraggable ? /*#__PURE__*/_react.default.createElement(_CoachmarkDragbar.CoachmarkDragbar, {
159
+ a11yKeyboardHandler: handleKeyPress,
160
+ onBlur: function onBlur() {
161
+ return setA11yDragMode(false);
162
+ },
163
+ onDrag: handleDrag,
164
+ theme: theme,
165
+ onClose: onClose
166
+ }) : /*#__PURE__*/_react.default.createElement(_CoachmarkHeader.CoachmarkHeader, {
167
+ onClose: onClose
168
+ }), /*#__PURE__*/_react.default.createElement("div", {
169
+ className: "".concat(blockClass, "__body"),
170
+ ref: ref,
171
+ id: contentId
172
+ }, _react.default.Children.map(children, function (child) {
173
+ return /*#__PURE__*/_react.default.cloneElement(child, {
174
+ isVisible: isVisible
175
+ });
176
+ })), isBeacon && /*#__PURE__*/_react.default.createElement("span", {
177
+ className: "".concat(blockClass, "__caret")
178
+ }));
179
+ });
180
+ function getWindowDimensions() {
181
+ var _window = window,
182
+ winWidth = _window.innerWidth,
183
+ winHeight = _window.innerHeight;
184
+ return {
185
+ winWidth: winWidth,
186
+ winHeight: winHeight
187
+ };
188
+ }
189
+ var useWindowDimensions = function useWindowDimensions() {
190
+ var _useState3 = (0, _react.useState)(getWindowDimensions()),
191
+ _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
192
+ windowDimensions = _useState4[0],
193
+ setWindowDimensions = _useState4[1];
194
+ (0, _react.useEffect)(function () {
195
+ function handleResize() {
196
+ setWindowDimensions(getWindowDimensions());
197
+ }
198
+ window.addEventListener('resize', handleResize);
199
+ return function () {
200
+ return window.removeEventListener('resize', handleResize);
201
+ };
202
+ }, []);
203
+ return windowDimensions;
204
+ };
205
+
206
+ // Return a placeholder if not released and not enabled by feature flag
207
+ exports.CoachmarkOverlay = CoachmarkOverlay = _settings.pkg.checkComponentEnabled(CoachmarkOverlay, componentName);
208
+
209
+ // The display name of the component, used by React. Note that displayName
210
+ // is used in preference to relying on function.name.
211
+ CoachmarkOverlay.displayName = componentName;
212
+
213
+ // The types and DocGen commentary for the component props,
214
+ // in alphabetical order (for consistency).
215
+ // See https://www.npmjs.com/package/prop-types#usage.
216
+ CoachmarkOverlay.propTypes = {
217
+ /**
218
+ * The CoachmarkOverlayElements child components.
219
+ * Validation is handled in the parent Coachmark component.
220
+ */
221
+ children: _propTypes.default.node.isRequired,
222
+ /**
223
+ * Optional class name for this component.
224
+ */
225
+ className: _propTypes.default.string,
226
+ /**
227
+ * The visibility of CoachmarkOverlay is
228
+ * managed in the parent Coachmark component.
229
+ */
230
+ fixedIsVisible: _propTypes.default.bool.isRequired,
231
+ /**
232
+ * What kind or style of Coachmark to render.
233
+ */
234
+ kind: _propTypes.default.oneOf(Object.values(_enums.COACHMARK_OVERLAY_KIND)),
235
+ /**
236
+ * Function to call when the Coachmark closes.
237
+ */
238
+ onClose: _propTypes.default.func.isRequired,
239
+ /**
240
+ * Determines the theme of the component.
241
+ */
242
+ theme: _propTypes.default.oneOf(['light', 'dark'])
243
+ };
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.CoachmarkTagline = void 0;
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
10
+ var _react = _interopRequireDefault(require("react"));
11
+ var _propTypes = _interopRequireDefault(require("prop-types"));
12
+ var _classnames = _interopRequireDefault(require("classnames"));
13
+ var _iconsReact = require("@carbon/icons-react");
14
+ var _react2 = require("@carbon/react");
15
+ var _context = require("./utils/context");
16
+ var _devtools = require("../../global/js/utils/devtools");
17
+ var _settings = require("../../settings");
18
+ var _excluded = ["closeIconDescription", "onClose", "theme", "title"];
19
+ /**
20
+ * Copyright IBM Corp. 2023, 2024
21
+ *
22
+ * This source code is licensed under the Apache-2.0 license found in the
23
+ * LICENSE file in the root directory of this source tree.
24
+ */
25
+ // Import portions of React that are needed.
26
+ // Other standard imports.
27
+ // The block part of our conventional BEM class names (blockClass__E--M).
28
+ var blockClass = "".concat(_settings.pkg.prefix, "--coachmark-tagline");
29
+ var componentName = 'CoachmarkTagline';
30
+ var defaults = {
31
+ closeIconDescription: 'Close',
32
+ onClose: function onClose() {},
33
+ theme: 'light'
34
+ };
35
+
36
+ /**
37
+ * DO NOT USE. This component is for the exclusive use
38
+ * of other Novice to Pro components.
39
+ */
40
+ var CoachmarkTagline = exports.CoachmarkTagline = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
41
+ var _ref$closeIconDescrip = _ref.closeIconDescription,
42
+ closeIconDescription = _ref$closeIconDescrip === void 0 ? defaults.closeIconDescription : _ref$closeIconDescrip,
43
+ _ref$onClose = _ref.onClose,
44
+ onClose = _ref$onClose === void 0 ? defaults.onClose : _ref$onClose,
45
+ _ref$theme = _ref.theme,
46
+ theme = _ref$theme === void 0 ? defaults.theme : _ref$theme,
47
+ title = _ref.title,
48
+ rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
49
+ var coachmark = (0, _context.useCoachmark)();
50
+ return /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, rest, {
51
+ className: (0, _classnames.default)(blockClass, "".concat(blockClass, "__").concat(theme), coachmark.isOpen && "".concat(blockClass, "--is-open")),
52
+ ref: ref
53
+ }, (0, _devtools.getDevtoolsProps)(componentName)), /*#__PURE__*/_react.default.createElement("button", (0, _extends2.default)({
54
+ // {...rest}
55
+ className: "".concat(blockClass, "__cta"),
56
+ type: "button"
57
+ }, coachmark.buttonProps), /*#__PURE__*/_react.default.createElement("div", {
58
+ className: "".concat(blockClass, "__idea")
59
+ }, /*#__PURE__*/_react.default.createElement(_iconsReact.Idea, {
60
+ size: 16
61
+ })), /*#__PURE__*/_react.default.createElement("div", null, title)), /*#__PURE__*/_react.default.createElement("div", {
62
+ className: "".concat(blockClass, "--close-btn-container")
63
+ }, /*#__PURE__*/_react.default.createElement(_react2.Button, {
64
+ kind: "ghost",
65
+ size: "sm",
66
+ renderIcon: _iconsReact.Close,
67
+ iconDescription: closeIconDescription,
68
+ hasIconOnly: true,
69
+ className: "".concat(blockClass, "--close-btn"),
70
+ onClick: onClose
71
+ })));
72
+ });
73
+
74
+ // Return a placeholder if not released and not enabled by feature flag
75
+ exports.CoachmarkTagline = CoachmarkTagline = _settings.pkg.checkComponentEnabled(CoachmarkTagline, componentName);
76
+
77
+ // The display name of the component, used by React. Note that displayName
78
+ // is used in preference to relying on function.name.
79
+ CoachmarkTagline.displayName = componentName;
80
+
81
+ // The types and DocGen commentary for the component props,
82
+ // in alphabetical order (for consistency).
83
+ // See https://www.npmjs.com/package/prop-types#usage.
84
+ CoachmarkTagline.propTypes = {
85
+ /**
86
+ * Tooltip text and aria label for the Close button icon.
87
+ */
88
+ closeIconDescription: _propTypes.default.string,
89
+ /**
90
+ * Function to call when the close button is clicked.
91
+ */
92
+ onClose: _propTypes.default.func,
93
+ /**
94
+ * Determines the theme of the component.
95
+ */
96
+ theme: _propTypes.default.oneOf(['light', 'dark']),
97
+ /**
98
+ * The title of the tagline.
99
+ */
100
+ title: _propTypes.default.string.isRequired
101
+ };
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "BEACON_KIND", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _enums.BEACON_KIND;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "COACHMARK_ALIGNMENT", {
13
+ enumerable: true,
14
+ get: function get() {
15
+ return _enums.COACHMARK_ALIGNMENT;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "COACHMARK_OVERLAY_KIND", {
19
+ enumerable: true,
20
+ get: function get() {
21
+ return _enums.COACHMARK_OVERLAY_KIND;
22
+ }
23
+ });
24
+ Object.defineProperty(exports, "Coachmark", {
25
+ enumerable: true,
26
+ get: function get() {
27
+ return _Coachmark.Coachmark;
28
+ }
29
+ });
30
+ Object.defineProperty(exports, "useCoachmark", {
31
+ enumerable: true,
32
+ get: function get() {
33
+ return _context.useCoachmark;
34
+ }
35
+ });
36
+ var _Coachmark = require("./Coachmark");
37
+ var _enums = require("./utils/enums");
38
+ var _context = require("./utils/context");