@carbon/ibm-products 2.22.0 → 2.24.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (205) hide show
  1. package/README.md +2 -1
  2. package/css/index-full-carbon.css +29490 -28295
  3. package/css/index-full-carbon.css.map +1 -1
  4. package/css/index-full-carbon.min.css +1 -1
  5. package/css/index-full-carbon.min.css.map +1 -1
  6. package/css/index-without-carbon-released-only.css +81 -104
  7. package/css/index-without-carbon-released-only.css.map +1 -1
  8. package/css/index-without-carbon-released-only.min.css +1 -1
  9. package/css/index-without-carbon-released-only.min.css.map +1 -1
  10. package/css/index-without-carbon.css +24399 -350
  11. package/css/index-without-carbon.css.map +1 -1
  12. package/css/index-without-carbon.min.css +1 -1
  13. package/css/index-without-carbon.min.css.map +1 -1
  14. package/css/index.css +17204 -123
  15. package/css/index.css.map +1 -1
  16. package/css/index.min.css +1 -1
  17. package/css/index.min.css.map +1 -1
  18. package/es/components/Card/Card.js +1 -2
  19. package/es/components/Card/CardHeader.js +2 -2
  20. package/es/components/Carousel/Carousel.js +5 -3
  21. package/es/components/Coachmark/Coachmark.js +255 -0
  22. package/es/components/Coachmark/CoachmarkDragbar.js +146 -0
  23. package/es/components/Coachmark/CoachmarkHeader.js +91 -0
  24. package/es/components/Coachmark/CoachmarkOverlay.js +235 -0
  25. package/es/components/Coachmark/CoachmarkTagline.js +97 -0
  26. package/es/components/Coachmark/index.js +10 -0
  27. package/es/components/Coachmark/utils/constants.js +76 -0
  28. package/es/components/Coachmark/utils/context.js +5 -0
  29. package/es/components/Coachmark/utils/enums.js +40 -0
  30. package/es/components/Coachmark/utils/helpers.js +11 -0
  31. package/es/components/Coachmark/utils/hooks.js +54 -0
  32. package/es/components/CoachmarkBeacon/CoachmarkBeacon.js +93 -0
  33. package/es/components/CoachmarkBeacon/index.js +8 -0
  34. package/es/components/CoachmarkButton/CoachmarkButton.js +90 -0
  35. package/es/components/CoachmarkButton/index.js +8 -0
  36. package/es/components/CoachmarkFixed/CoachmarkFixed.js +226 -0
  37. package/es/components/CoachmarkFixed/index.js +8 -0
  38. package/es/components/CoachmarkOverlayElement/CoachmarkOverlayElement.js +86 -0
  39. package/es/components/CoachmarkOverlayElement/index.js +8 -0
  40. package/es/components/CoachmarkOverlayElements/CoachmarkOverlayElements.js +216 -0
  41. package/es/components/CoachmarkOverlayElements/index.js +8 -0
  42. package/es/components/CoachmarkStack/CoachmarkStack.js +283 -0
  43. package/es/components/CoachmarkStack/CoachmarkStackHome.js +192 -0
  44. package/es/components/CoachmarkStack/index.js +8 -0
  45. package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +14 -4
  46. package/es/components/Datagrid/Datagrid/DatagridSelectAll.js +4 -1
  47. package/es/components/Datagrid/Datagrid/DraggableElement.js +1 -1
  48. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/ButtonWrapper.js +1 -1
  49. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +4 -1
  50. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js +1 -1
  51. package/es/components/Datagrid/Datagrid/addons/Slug/ColumnHeaderSlug.js +26 -0
  52. package/es/components/Datagrid/Datagrid.docs-page.js +2 -2
  53. package/es/components/Datagrid/useActionsColumn.js +16 -12
  54. package/es/components/Datagrid/useDefaultStringRenderer.js +3 -3
  55. package/es/components/Datagrid/useNestedRowExpander.js +2 -2
  56. package/es/components/Datagrid/useSortableColumns.js +15 -5
  57. package/es/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +7 -2
  58. package/es/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +8 -3
  59. package/es/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +7 -2
  60. package/es/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +7 -2
  61. package/es/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +7 -2
  62. package/es/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +7 -2
  63. package/es/components/EmptyStates/assets/ErrorIllustration.js +5 -5
  64. package/es/components/EmptyStates/assets/NoDataIllustration.js +5 -5
  65. package/es/components/EmptyStates/assets/NoTagsIllustration.js +5 -5
  66. package/es/components/EmptyStates/assets/NotFoundIllustration.js +5 -5
  67. package/es/components/EmptyStates/assets/NotificationsIllustration.js +5 -5
  68. package/es/components/EmptyStates/assets/UnauthorizedIllustration.js +5 -5
  69. package/es/components/FilterSummary/FilterSummary.js +100 -19
  70. package/es/components/InterstitialScreen/InterstitialScreen.js +427 -0
  71. package/es/components/InterstitialScreen/index.js +8 -0
  72. package/es/components/InterstitialScreenView/InterstitialScreenView.js +75 -0
  73. package/es/components/InterstitialScreenView/index.js +8 -0
  74. package/es/components/InterstitialScreenViewModule/InterstitialScreenViewModule.js +83 -0
  75. package/es/components/InterstitialScreenViewModule/index.js +8 -0
  76. package/es/components/PageHeader/PageHeaderUtils.js +2 -2
  77. package/es/components/SearchBar/SearchBar.js +227 -0
  78. package/es/components/SearchBar/index.js +8 -0
  79. package/es/components/TagSet/TagSet.js +11 -3
  80. package/es/components/index.js +12 -1
  81. package/es/global/js/hooks/useResizeObserver.js +2 -2
  82. package/es/global/js/package-settings.js +14 -0
  83. package/lib/components/Card/Card.js +3 -4
  84. package/lib/components/Card/CardHeader.js +2 -2
  85. package/lib/components/Carousel/Carousel.js +5 -3
  86. package/lib/components/Coachmark/Coachmark.js +264 -0
  87. package/lib/components/Coachmark/CoachmarkDragbar.js +151 -0
  88. package/lib/components/Coachmark/CoachmarkHeader.js +95 -0
  89. package/lib/components/Coachmark/CoachmarkOverlay.js +243 -0
  90. package/lib/components/Coachmark/CoachmarkTagline.js +101 -0
  91. package/lib/components/Coachmark/index.js +38 -0
  92. package/lib/components/Coachmark/utils/constants.js +81 -0
  93. package/lib/components/Coachmark/utils/context.js +11 -0
  94. package/lib/components/Coachmark/utils/enums.js +46 -0
  95. package/lib/components/Coachmark/utils/helpers.js +17 -0
  96. package/lib/components/Coachmark/utils/hooks.js +59 -0
  97. package/lib/components/CoachmarkBeacon/CoachmarkBeacon.js +97 -0
  98. package/lib/components/CoachmarkBeacon/index.js +12 -0
  99. package/lib/components/CoachmarkButton/CoachmarkButton.js +93 -0
  100. package/lib/components/CoachmarkButton/index.js +12 -0
  101. package/lib/components/CoachmarkFixed/CoachmarkFixed.js +232 -0
  102. package/lib/components/CoachmarkFixed/index.js +12 -0
  103. package/lib/components/CoachmarkOverlayElement/CoachmarkOverlayElement.js +90 -0
  104. package/lib/components/CoachmarkOverlayElement/index.js +12 -0
  105. package/lib/components/CoachmarkOverlayElements/CoachmarkOverlayElements.js +222 -0
  106. package/lib/components/CoachmarkOverlayElements/index.js +12 -0
  107. package/lib/components/CoachmarkStack/CoachmarkStack.js +288 -0
  108. package/lib/components/CoachmarkStack/CoachmarkStackHome.js +198 -0
  109. package/lib/components/CoachmarkStack/index.js +12 -0
  110. package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +14 -4
  111. package/lib/components/Datagrid/Datagrid/DatagridSelectAll.js +4 -1
  112. package/lib/components/Datagrid/Datagrid/DraggableElement.js +1 -1
  113. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/ButtonWrapper.js +1 -1
  114. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +4 -1
  115. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js +1 -1
  116. package/lib/components/Datagrid/Datagrid/addons/Slug/ColumnHeaderSlug.js +36 -0
  117. package/lib/components/Datagrid/Datagrid.docs-page.js +2 -2
  118. package/lib/components/Datagrid/useActionsColumn.js +15 -11
  119. package/lib/components/Datagrid/useDefaultStringRenderer.js +3 -3
  120. package/lib/components/Datagrid/useNestedRowExpander.js +2 -2
  121. package/lib/components/Datagrid/useSortableColumns.js +15 -5
  122. package/lib/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +7 -2
  123. package/lib/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +8 -3
  124. package/lib/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +7 -2
  125. package/lib/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +7 -2
  126. package/lib/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +7 -2
  127. package/lib/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +7 -2
  128. package/lib/components/EmptyStates/assets/ErrorIllustration.js +5 -5
  129. package/lib/components/EmptyStates/assets/NoDataIllustration.js +5 -5
  130. package/lib/components/EmptyStates/assets/NoTagsIllustration.js +5 -5
  131. package/lib/components/EmptyStates/assets/NotFoundIllustration.js +5 -5
  132. package/lib/components/EmptyStates/assets/NotificationsIllustration.js +5 -5
  133. package/lib/components/EmptyStates/assets/UnauthorizedIllustration.js +5 -5
  134. package/lib/components/FilterSummary/FilterSummary.js +103 -23
  135. package/lib/components/InterstitialScreen/InterstitialScreen.js +434 -0
  136. package/lib/components/InterstitialScreen/index.js +12 -0
  137. package/lib/components/InterstitialScreenView/InterstitialScreenView.js +77 -0
  138. package/lib/components/InterstitialScreenView/index.js +12 -0
  139. package/lib/components/InterstitialScreenViewModule/InterstitialScreenViewModule.js +85 -0
  140. package/lib/components/InterstitialScreenViewModule/index.js +12 -0
  141. package/lib/components/PageHeader/PageHeaderUtils.js +2 -2
  142. package/lib/components/SearchBar/SearchBar.js +233 -0
  143. package/lib/components/SearchBar/index.js +12 -0
  144. package/lib/components/TagSet/TagSet.js +11 -3
  145. package/lib/components/index.js +78 -1
  146. package/lib/global/js/hooks/useResizeObserver.js +2 -2
  147. package/lib/global/js/package-settings.js +14 -0
  148. package/package.json +5 -5
  149. package/scss/components/Card/_card.scss +6 -5
  150. package/scss/components/Coachmark/_carbon-imports.scss +10 -0
  151. package/scss/components/Coachmark/_coachmark-dragbar.scss +27 -0
  152. package/scss/components/Coachmark/_coachmark-header.scss +20 -0
  153. package/scss/components/Coachmark/_coachmark-overlay.scss +431 -0
  154. package/scss/components/Coachmark/_coachmark-tagline.scss +140 -0
  155. package/scss/components/Coachmark/_coachmark.scss +30 -0
  156. package/scss/components/Coachmark/_index-with-carbon.scss +9 -0
  157. package/scss/components/Coachmark/_index.scss +8 -0
  158. package/scss/components/CoachmarkBeacon/_carbon-imports.scss +9 -0
  159. package/scss/components/CoachmarkBeacon/_coachmark-beacon.scss +166 -0
  160. package/scss/components/CoachmarkBeacon/_index-with-carbon.scss +9 -0
  161. package/scss/components/CoachmarkBeacon/_index.scss +8 -0
  162. package/scss/components/CoachmarkButton/_carbon-imports.scss +9 -0
  163. package/scss/components/CoachmarkButton/_coachmark-button.scss +25 -0
  164. package/scss/components/CoachmarkButton/_index-with-carbon.scss +9 -0
  165. package/scss/components/CoachmarkButton/_index.scss +8 -0
  166. package/scss/components/CoachmarkFixed/_carbon-imports.scss +9 -0
  167. package/scss/components/CoachmarkFixed/_coachmark-fixed.scss +25 -0
  168. package/scss/components/CoachmarkFixed/_index-with-carbon.scss +9 -0
  169. package/scss/components/CoachmarkFixed/_index.scss +8 -0
  170. package/scss/components/CoachmarkOverlayElement/_carbon-imports.scss +9 -0
  171. package/scss/components/CoachmarkOverlayElement/_coachmark-overlay-element.scss +52 -0
  172. package/scss/components/CoachmarkOverlayElement/_index-with-carbon.scss +9 -0
  173. package/scss/components/CoachmarkOverlayElement/_index.scss +8 -0
  174. package/scss/components/CoachmarkOverlayElements/_carbon-imports.scss +9 -0
  175. package/scss/components/CoachmarkOverlayElements/_coachmark-overlay-elements.scss +47 -0
  176. package/scss/components/CoachmarkOverlayElements/_index-with-carbon.scss +9 -0
  177. package/scss/components/CoachmarkOverlayElements/_index.scss +8 -0
  178. package/scss/components/CoachmarkStack/_carbon-imports.scss +9 -0
  179. package/scss/components/CoachmarkStack/_coachmark-stack.scss +95 -0
  180. package/scss/components/CoachmarkStack/_index-with-carbon.scss +9 -0
  181. package/scss/components/CoachmarkStack/_index.scss +8 -0
  182. package/scss/components/CreateSidePanel/_create-side-panel.scss +1 -38
  183. package/scss/components/Datagrid/styles/_datagrid.scss +15 -0
  184. package/scss/components/EditSidePanel/_edit-side-panel.scss +0 -18
  185. package/scss/components/FilterSummary/_filter-summary.scss +22 -1
  186. package/scss/components/InterstitialScreen/_carbon-imports.scss +9 -0
  187. package/scss/components/InterstitialScreen/_index-with-carbon.scss +9 -0
  188. package/scss/components/InterstitialScreen/_index.scss +8 -0
  189. package/scss/components/InterstitialScreen/_interstitial-screen.scss +276 -0
  190. package/scss/components/InterstitialScreenView/_carbon-imports.scss +9 -0
  191. package/scss/components/InterstitialScreenView/_index-with-carbon.scss +9 -0
  192. package/scss/components/InterstitialScreenView/_index.scss +8 -0
  193. package/scss/components/InterstitialScreenView/_interstitial-screen-view.scss +25 -0
  194. package/scss/components/InterstitialScreenViewModule/_carbon-imports.scss +9 -0
  195. package/scss/components/InterstitialScreenViewModule/_index-with-carbon.scss +9 -0
  196. package/scss/components/InterstitialScreenViewModule/_index.scss +8 -0
  197. package/scss/components/InterstitialScreenViewModule/_interstitial-screen-view-module.scss +59 -0
  198. package/scss/components/PageHeader/_page-header.scss +0 -1
  199. package/scss/components/SearchBar/_carbon-imports.scss +9 -0
  200. package/scss/components/SearchBar/_index-with-carbon.scss +9 -0
  201. package/scss/components/SearchBar/_index.scss +8 -0
  202. package/scss/components/SearchBar/_search-bar.scss +26 -0
  203. package/scss/components/SidePanel/_side-panel.scss +12 -7
  204. package/scss/components/_index-with-carbon.scss +11 -0
  205. package/scss/components/_index.scss +11 -0
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.CoachmarkBeacon = 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 _Coachmark = require("../Coachmark");
14
+ var _devtools = require("../../global/js/utils/devtools");
15
+ var _settings = require("../../settings");
16
+ var _excluded = ["label", "className", "kind"];
17
+ /**
18
+ * Copyright IBM Corp. 2023, 2024
19
+ *
20
+ * This source code is licensed under the Apache-2.0 license found in the
21
+ * LICENSE file in the root directory of this source tree.
22
+ */
23
+ // Import portions of React that are needed.
24
+ // Other standard imports.
25
+ // The block part of our conventional BEM class names (blockClass__E--M).
26
+ var blockClass = "".concat(_settings.pkg.prefix, "--coachmark-beacon");
27
+ var componentName = 'CoachmarkBeacon';
28
+ var defaults = {
29
+ kind: 'default'
30
+ };
31
+
32
+ /**
33
+ * Use beacon for the target prop of a Coachmark component.
34
+ */
35
+ var CoachmarkBeacon = exports.CoachmarkBeacon = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
36
+ var _coachmark$positionTu, _coachmark$positionTu2, _coachmark$positionTu3, _coachmark$positionTu4;
37
+ var label = _ref.label,
38
+ className = _ref.className,
39
+ _ref$kind = _ref.kind,
40
+ kind = _ref$kind === void 0 ? defaults.kind : _ref$kind,
41
+ rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
42
+ var coachmark = (0, _Coachmark.useCoachmark)();
43
+ if (!coachmark) {
44
+ return /*#__PURE__*/_react.default.createElement("div", null, "CoachmarkBeacon is to be use exclusively within the target prop of Coachmark");
45
+ }
46
+ var overlayPositionStyle = {
47
+ top: (_coachmark$positionTu = (_coachmark$positionTu2 = coachmark.positionTune) === null || _coachmark$positionTu2 === void 0 ? void 0 : _coachmark$positionTu2.y) !== null && _coachmark$positionTu !== void 0 ? _coachmark$positionTu : 0,
48
+ left: (_coachmark$positionTu3 = (_coachmark$positionTu4 = coachmark.positionTune) === null || _coachmark$positionTu4 === void 0 ? void 0 : _coachmark$positionTu4.x) !== null && _coachmark$positionTu3 !== void 0 ? _coachmark$positionTu3 : 0
49
+ };
50
+ return /*#__PURE__*/_react.default.createElement("span", (0, _extends2.default)({}, rest, {
51
+ className: (0, _classnames.default)(blockClass, "".concat(blockClass, "-").concat(kind), className),
52
+ ref: ref,
53
+ style: overlayPositionStyle
54
+ }, (0, _devtools.getDevtoolsProps)(componentName), {
55
+ role: "tooltip"
56
+ }), /*#__PURE__*/_react.default.createElement("button", (0, _extends2.default)({
57
+ tabIndex: 0,
58
+ type: "button"
59
+ }, coachmark.buttonProps, {
60
+ "aria-label": label,
61
+ className: "".concat(blockClass, "__target")
62
+ }), /*#__PURE__*/_react.default.createElement("svg", {
63
+ className: "".concat(blockClass, "__center"),
64
+ alt: ""
65
+ }, /*#__PURE__*/_react.default.createElement("circle", {
66
+ r: 1,
67
+ cx: 38,
68
+ cy: 38
69
+ }))));
70
+ });
71
+
72
+ // Return a placeholder if not released and not enabled by feature flag
73
+ exports.CoachmarkBeacon = CoachmarkBeacon = _settings.pkg.checkComponentEnabled(CoachmarkBeacon, componentName);
74
+
75
+ // The display name of the component, used by React. Note that displayName
76
+ // is used in preference to relying on function.name.
77
+ CoachmarkBeacon.displayName = componentName;
78
+
79
+ // The types and DocGen commentary for the component props,
80
+ // in alphabetical order (for consistency).
81
+ // See https://www.npmjs.com/package/prop-types#usage.
82
+ CoachmarkBeacon.propTypes = {
83
+ /**
84
+ * Optional class name for this component.
85
+ */
86
+ className: _propTypes.default.string,
87
+ /**
88
+ * What style of beacon.
89
+ * BEACON_KIND is an exported enum from the Coachmark and can be used for this value.
90
+ * @see {@link BEACON_KIND}
91
+ */
92
+ kind: _propTypes.default.oneOf(['default']),
93
+ /**
94
+ * The aria label.
95
+ */
96
+ label: _propTypes.default.string.isRequired
97
+ };
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "CoachmarkBeacon", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _CoachmarkBeacon.CoachmarkBeacon;
10
+ }
11
+ });
12
+ var _CoachmarkBeacon = require("./CoachmarkBeacon");
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.CoachmarkButton = 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 _devtools = require("../../global/js/utils/devtools");
14
+ var _settings = require("../../settings");
15
+ var _react2 = require("@carbon/react");
16
+ var _Coachmark = require("../Coachmark");
17
+ var _excluded = ["className", "label"];
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
+ // Carbon and package components we use.
27
+ /* TODO: @import(s) of carbon components and other package components. */ // The block part of our conventional BEM class names (blockClass__E--M).
28
+ var blockClass = "".concat(_settings.pkg.prefix, "--coachmark-button");
29
+ var componentName = 'CoachmarkButton';
30
+
31
+ // NOTE: the component SCSS is not imported here: it is rolled up separately.
32
+
33
+ // Default values can be included here and then assigned to the prop params,
34
+ // e.g. prop = defaults.prop,
35
+ // This gathers default values together neatly and ensures non-primitive
36
+ // values are initialized early to avoid react making unnecessary re-renders.
37
+ // Note that default values are not required for props that are 'required',
38
+ // nor for props where the component can apply undefined values reasonably.
39
+ // Default values should be provided when the component needs to make a choice
40
+ // or assumption when a prop is not supplied.
41
+
42
+ // Default values for props
43
+ // const defaults = {
44
+ // /* TODO: add defaults for relevant props if needed */
45
+ // };
46
+
47
+ /**
48
+ * Use CoachmarkButton for the target prop of a Coachmark component.
49
+ */
50
+ var CoachmarkButton = exports.CoachmarkButton = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
51
+ var className = _ref.className,
52
+ label = _ref.label,
53
+ rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
54
+ var coachmark = (0, _Coachmark.useCoachmark)();
55
+ if (!coachmark) {
56
+ return /*#__PURE__*/_react.default.createElement("div", null, "CoachmarkButton is to be use exclusively within the target prop of Coachmark");
57
+ }
58
+ return /*#__PURE__*/_react.default.createElement(_react2.Button, (0, _extends2.default)({}, rest, {
59
+ className: (0, _classnames.default)(blockClass,
60
+ // Apply the block class to the main HTML element
61
+ className,
62
+ // Apply any supplied class names to the main HTML element.
63
+ // example: `${blockClass}__template-string-class-${kind}-n-${size}`,
64
+ {
65
+ // switched classes dependant on props or state
66
+ // example: [`${blockClass}__here-if-small`]: size === 'sm',
67
+ }),
68
+ ref: ref,
69
+ role: "button",
70
+ "aria-label": label
71
+ }, (0, _devtools.getDevtoolsProps)(componentName), coachmark.buttonProps), label);
72
+ });
73
+
74
+ // Return a placeholder if not released and not enabled by feature flag
75
+ exports.CoachmarkButton = CoachmarkButton = _settings.pkg.checkComponentEnabled(CoachmarkButton, 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
+ CoachmarkButton.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
+ CoachmarkButton.propTypes = {
85
+ /**
86
+ * Provide an optional class to be applied to the containing node.
87
+ */
88
+ className: _propTypes.default.string,
89
+ /**
90
+ * The aria label.
91
+ */
92
+ label: _propTypes.default.string.isRequired
93
+ };
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "CoachmarkButton", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _CoachmarkButton.CoachmarkButton;
10
+ }
11
+ });
12
+ var _CoachmarkButton = require("./CoachmarkButton");
@@ -0,0 +1,232 @@
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.CoachmarkFixed = 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 _devtools = require("../../global/js/utils/devtools");
16
+ var _settings = require("../../settings");
17
+ var _reactDom = require("react-dom");
18
+ var _CoachmarkOverlay = require("../Coachmark/CoachmarkOverlay");
19
+ var _CoachmarkTagline = require("../Coachmark/CoachmarkTagline");
20
+ var _context = require("../Coachmark/utils/context");
21
+ var _enums = require("../Coachmark/utils/enums");
22
+ var _excluded = ["children", "className", "onClose", "portalTarget", "tagline", "theme"];
23
+ /**
24
+ * Copyright IBM Corp. 2023, 2024
25
+ *
26
+ * This source code is licensed under the Apache-2.0 license found in the
27
+ * LICENSE file in the root directory of this source tree.
28
+ */
29
+ // Import portions of React that are needed.
30
+ // Other standard imports.
31
+ 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); }
32
+ 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; }
33
+ // Carbon and package components we use.
34
+ /* TODO: @import(s) of carbon components and other package components. */ // The block part of our conventional BEM class names (blockClass__E--M).
35
+ var coachmarkClass = "".concat(_settings.pkg.prefix, "--coachmark");
36
+ var blockClass = "".concat(coachmarkClass, "-fixed");
37
+ var overlayBlockClass = "".concat(coachmarkClass, "-overlay");
38
+ var componentName = 'CoachmarkFixed';
39
+ var defaults = {
40
+ onClose: function onClose() {},
41
+ theme: 'light',
42
+ tagline: ''
43
+ };
44
+
45
+ /**
46
+ * Fixed coachmarks are used to call out specific functionality or concepts
47
+ * within the UI that may not be intuitive but are important for the
48
+ * user to gain understanding of the product's main value and discover new use cases.
49
+ * This variant allows the a coachmark overlay to be displayed by interacting with the tagline.
50
+ */
51
+ var CoachmarkFixed = exports.CoachmarkFixed = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
52
+ var _document$querySelect;
53
+ var children = _ref.children,
54
+ className = _ref.className,
55
+ _ref$onClose = _ref.onClose,
56
+ onClose = _ref$onClose === void 0 ? defaults.onClose : _ref$onClose,
57
+ portalTarget = _ref.portalTarget,
58
+ _ref$tagline = _ref.tagline,
59
+ tagline = _ref$tagline === void 0 ? defaults.tagline : _ref$tagline,
60
+ _ref$theme = _ref.theme,
61
+ theme = _ref$theme === void 0 ? defaults.theme : _ref$theme,
62
+ rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
63
+ var overlayRef = (0, _react.useRef)();
64
+ var portalNode = portalTarget ? (_document$querySelect = document.querySelector(portalTarget)) !== null && _document$querySelect !== void 0 ? _document$querySelect : document.querySelector('body') : document.querySelector('body');
65
+ var _useState = (0, _react.useState)(false),
66
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
67
+ isOpen = _useState2[0],
68
+ setIsOpen = _useState2[1];
69
+ var _useState3 = (0, _react.useState)(false),
70
+ _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
71
+ shouldResetPosition = _useState4[0],
72
+ setShouldResetPosition = _useState4[1];
73
+ var _useState5 = (0, _react.useState)(),
74
+ _useState6 = (0, _slicedToArray2.default)(_useState5, 2),
75
+ targetRect = _useState6[0],
76
+ setTargetRect = _useState6[1];
77
+ var _useState7 = (0, _react.useState)({
78
+ x: 0,
79
+ y: 0
80
+ }),
81
+ _useState8 = (0, _slicedToArray2.default)(_useState7, 2),
82
+ targetOffset = _useState8[0],
83
+ setTargetOffset = _useState8[1];
84
+ var _useState9 = (0, _react.useState)(false),
85
+ _useState10 = (0, _slicedToArray2.default)(_useState9, 2),
86
+ fixedIsVisible = _useState10[0],
87
+ setFixedIsVisible = _useState10[1];
88
+ var prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)');
89
+ var handleClose = (0, _react.useCallback)(function () {
90
+ console.log('HANDLING CLOSE HERE...');
91
+ if (prefersReducedMotion.matches) {
92
+ setIsOpen(false);
93
+ } else {
94
+ setFixedIsVisible(false);
95
+ }
96
+ }, [prefersReducedMotion.matches]);
97
+ var handleTransitionEnd = function handleTransitionEnd(e) {
98
+ console.log('Hererrrrrreee at transition end... ', e.propertyName === 'transform' && !fixedIsVisible);
99
+ if (e.propertyName === 'transform' && !fixedIsVisible) {
100
+ setIsOpen(false);
101
+ onClose();
102
+ }
103
+ };
104
+ var handleTargetClick = function handleTargetClick(e) {
105
+ setTargetRect(e.target.getBoundingClientRect());
106
+ setTargetOffset({
107
+ x: e.target.offsetLeft,
108
+ y: e.target.offsetTop
109
+ });
110
+ // reset position for all other kinds
111
+ setIsOpen(false);
112
+ setShouldResetPosition(true);
113
+ };
114
+ var escFunction = (0, _react.useCallback)(function (event) {
115
+ if (event.key === 'Escape') {
116
+ handleClose();
117
+ }
118
+ }, [handleClose]);
119
+ (0, _react.useEffect)(function () {
120
+ document.addEventListener('keydown', escFunction, false);
121
+ return function () {
122
+ document.removeEventListener('keydown', escFunction, false);
123
+ };
124
+ }, [escFunction]);
125
+ var contextValue = {
126
+ buttonProps: {
127
+ 'aria-expanded': isOpen,
128
+ tabIndex: 0,
129
+ onClick: handleTargetClick,
130
+ // Compensate for accidental open/close on double-click.
131
+ // Only open on double-click.
132
+ onDoubleClick: handleTargetClick
133
+ },
134
+ closeButtonProps: {
135
+ onClick: handleClose
136
+ },
137
+ targetRect: targetRect,
138
+ targetOffset: targetOffset,
139
+ isOpen: isOpen,
140
+ tacos: 'tacos'
141
+ };
142
+
143
+ // instead of toggling on/off,
144
+ // keep open and reset to original position
145
+ (0, _react.useEffect)(function () {
146
+ if (shouldResetPosition) {
147
+ setShouldResetPosition(false);
148
+ setIsOpen(true);
149
+ }
150
+ }, [shouldResetPosition]);
151
+ (0, _react.useEffect)(function () {
152
+ setFixedIsVisible(isOpen);
153
+ }, [isOpen]);
154
+
155
+ // On unmount:
156
+ // - DO NOT "Close()" the coachmark.
157
+ // - This triggers a "signal" to close it forever.
158
+ // - "Closing" should only ever be a user-triggered event.
159
+ // - DO "hide" the coachmark.
160
+ // - The app is doing the action for the user.
161
+ // - The user will have the opportunity to open it again.
162
+ (0, _react.useEffect)(function () {
163
+ return function () {
164
+ return setIsOpen(false);
165
+ };
166
+ }, []);
167
+ return /*#__PURE__*/_react.default.createElement(_context.CoachmarkContext.Provider, {
168
+ value: contextValue
169
+ }, /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, rest, {
170
+ className: (0, _classnames.default)(blockClass, // Apply the block class to the main HTML element
171
+ "".concat(blockClass, "__").concat(theme), className // Apply any supplied class names to the main HTML element.
172
+ ),
173
+
174
+ ref: ref
175
+ }, (0, _devtools.getDevtoolsProps)(componentName)), /*#__PURE__*/_react.default.createElement(_CoachmarkTagline.CoachmarkTagline, {
176
+ title: tagline,
177
+ onClose: onClose
178
+ }), isOpen && /*#__PURE__*/(0, _reactDom.createPortal)( /*#__PURE__*/_react.default.createElement(_CoachmarkOverlay.CoachmarkOverlay, {
179
+ ref: overlayRef,
180
+ fixedIsVisible: fixedIsVisible,
181
+ kind: _enums.COACHMARK_OVERLAY_KIND.FIXED,
182
+ onClose: handleClose,
183
+ onTransitionEnd: handleTransitionEnd,
184
+ theme: theme,
185
+ className: (0, _classnames.default)(fixedIsVisible && "".concat(overlayBlockClass, "--is-visible"), overlayBlockClass)
186
+ }, children), portalNode)));
187
+ });
188
+
189
+ // Return a placeholder if not released and not enabled by feature flag
190
+ exports.CoachmarkFixed = CoachmarkFixed = _settings.pkg.checkComponentEnabled(CoachmarkFixed, componentName);
191
+
192
+ // The display name of the component, used by React. Note that displayName
193
+ // is used in preference to relying on function.name.
194
+ CoachmarkFixed.displayName = componentName;
195
+
196
+ // The types and DocGen commentary for the component props,
197
+ // in alphabetical order (for consistency).
198
+ // See https://www.npmjs.com/package/prop-types#usage.
199
+ CoachmarkFixed.propTypes = {
200
+ // TODO: Add this to MDX as will be done with Coachmark
201
+ /**
202
+ * CoachmarkFixed should use a single CoachmarkOverlayElements component as a child.
203
+ */
204
+ children: _propTypes.default.node.isRequired,
205
+ /**
206
+ * Optional class name for this component.
207
+ */
208
+ className: _propTypes.default.string,
209
+ /**
210
+ * Function to call when the Coachmark closes.
211
+ */
212
+ onClose: _propTypes.default.func,
213
+ /**
214
+ * By default, the Coachmark will be appended to the end of `document.body`.
215
+ * The Coachmark will remain persistent as the user navigates the app until
216
+ * the user closes the Coachmark.
217
+ *
218
+ * Alternatively, the app developer can tightly couple the Coachmark to a DOM
219
+ * element or other component by specifying a CSS selector. The Coachmark will
220
+ * remain visible as long as that element remains visible or mounted. When the
221
+ * element is hidden or component is unmounted, the Coachmark will disappear.
222
+ */
223
+ portalTarget: _propTypes.default.string,
224
+ /**
225
+ * The tagline title which will be fixed to the bottom right of the window and will serve as the display trigger.
226
+ */
227
+ tagline: _propTypes.default.string.isRequired,
228
+ /**
229
+ * Determines the theme of the component.
230
+ */
231
+ theme: _propTypes.default.oneOf(['light', 'dark'])
232
+ };
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "CoachmarkFixed", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _CoachmarkFixed.CoachmarkFixed;
10
+ }
11
+ });
12
+ var _CoachmarkFixed = require("./CoachmarkFixed");
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.CoachmarkOverlayElement = 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 _devtools = require("../../global/js/utils/devtools");
14
+ var _settings = require("../../settings");
15
+ var _excluded = ["button", "className", "description", "title"];
16
+ /**
17
+ * Copyright IBM Corp. 2023, 2024
18
+ *
19
+ * This source code is licensed under the Apache-2.0 license found in the
20
+ * LICENSE file in the root directory of this source tree.
21
+ */
22
+ // Import portions of React that are needed.
23
+ // Other standard imports.
24
+ // The block part of our conventional BEM class names (blockClass__E--M).
25
+ var blockClass = "".concat(_settings.pkg.prefix, "--coachmark-overlay-element");
26
+ var componentName = 'CoachmarkOverlayElement';
27
+
28
+ /**
29
+ * Component to be displayed within a CoachmarkOverlayElements container.
30
+ * Can be used 1 to N number, to display content in a Coachmark's overlay
31
+ * in a carousel fashion.
32
+ */
33
+ var CoachmarkOverlayElement = exports.CoachmarkOverlayElement = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
34
+ var button = _ref.button,
35
+ className = _ref.className,
36
+ description = _ref.description,
37
+ title = _ref.title,
38
+ rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
39
+ return /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, rest, {
40
+ className: (0, _classnames.default)(blockClass,
41
+ // Apply the block class to the main HTML element
42
+ className,
43
+ // Apply any supplied class names to the main HTML element.
44
+ // example: `${blockClass}__template-string-class-${kind}-n-${size}`,
45
+ {
46
+ // switched classes dependant on props or state
47
+ // example: [`${blockClass}__here-if-small`]: size === 'sm',
48
+ }),
49
+ ref: ref
50
+ // role="main"
51
+ }, (0, _devtools.getDevtoolsProps)(componentName)), /*#__PURE__*/_react.default.createElement("div", {
52
+ className: "".concat(blockClass, "__content")
53
+ }, title && /*#__PURE__*/_react.default.createElement("h2", {
54
+ className: "".concat(blockClass, "__title")
55
+ }, title), description && /*#__PURE__*/_react.default.createElement("p", {
56
+ className: "".concat(blockClass, "__body")
57
+ }, description)), button && /*#__PURE__*/_react.default.createElement("div", {
58
+ className: "".concat(blockClass, "__button")
59
+ }, button));
60
+ });
61
+
62
+ // Return a placeholder if not released and not enabled by feature flag
63
+ exports.CoachmarkOverlayElement = CoachmarkOverlayElement = _settings.pkg.checkComponentEnabled(CoachmarkOverlayElement, componentName);
64
+
65
+ // The display name of the component, used by React. Note that displayName
66
+ // is used in preference to relying on function.name.
67
+ CoachmarkOverlayElement.displayName = componentName;
68
+
69
+ // The types and DocGen commentary for the component props,
70
+ // in alphabetical order (for consistency).
71
+ // See https://www.npmjs.com/package/prop-types#usage.
72
+ CoachmarkOverlayElement.propTypes = {
73
+ /**
74
+ * An optional button can be rendered below the description.
75
+ * This can be a link, button, Coachmark button, etc.
76
+ */
77
+ button: _propTypes.default.node,
78
+ /**
79
+ * Optional class name for this component.
80
+ */
81
+ className: _propTypes.default.string,
82
+ /**
83
+ * The description of the Coachmark.
84
+ */
85
+ description: _propTypes.default.node.isRequired,
86
+ /**
87
+ * The title of the Coachmark.
88
+ */
89
+ title: _propTypes.default.string.isRequired
90
+ };
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "CoachmarkOverlayElement", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _CoachmarkOverlayElement.CoachmarkOverlayElement;
10
+ }
11
+ });
12
+ var _CoachmarkOverlayElement = require("./CoachmarkOverlayElement");