@carbon/ibm-products 1.55.2 → 1.56.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. package/css/index-full-carbon.css +579 -0
  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.css +579 -0
  6. package/css/index-without-carbon.css.map +1 -1
  7. package/css/index-without-carbon.min.css +1 -1
  8. package/css/index-without-carbon.min.css.map +1 -1
  9. package/css/index.css +579 -0
  10. package/css/index.css.map +1 -1
  11. package/css/index.min.css +1 -1
  12. package/css/index.min.css.map +1 -1
  13. package/es/components/Carousel/Carousel.js +15 -5
  14. package/es/components/Coachmark/Coachmark.js +243 -0
  15. package/es/components/Coachmark/CoachmarkDragbar.js +137 -0
  16. package/es/components/Coachmark/CoachmarkHeader.js +88 -0
  17. package/es/components/Coachmark/CoachmarkOverlay.js +139 -0
  18. package/es/components/Coachmark/CoachmarkTagline.js +93 -0
  19. package/es/components/Coachmark/index.js +10 -0
  20. package/es/components/Coachmark/utils/constants.js +76 -0
  21. package/es/components/Coachmark/utils/context.js +5 -0
  22. package/es/components/Coachmark/utils/enums.js +40 -0
  23. package/es/components/Coachmark/utils/helpers.js +11 -0
  24. package/es/components/Coachmark/utils/hooks.js +54 -0
  25. package/es/components/CoachmarkBeacon/CoachmarkBeacon.js +90 -0
  26. package/es/components/CoachmarkBeacon/index.js +8 -0
  27. package/es/components/CoachmarkButton/CoachmarkButton.js +72 -0
  28. package/es/components/CoachmarkButton/index.js +8 -0
  29. package/es/components/CoachmarkFixed/CoachmarkFixed.js +201 -0
  30. package/es/components/CoachmarkFixed/index.js +8 -0
  31. package/es/components/CoachmarkOverlayElement/CoachmarkOverlayElement.js +86 -0
  32. package/es/components/CoachmarkOverlayElement/index.js +8 -0
  33. package/es/components/CoachmarkOverlayElements/CoachmarkOverlayElements.js +175 -0
  34. package/es/components/CoachmarkOverlayElements/index.js +8 -0
  35. package/es/components/CoachmarkStack/CoachmarkStack.js +260 -0
  36. package/es/components/CoachmarkStack/CoachmarkStackHome.js +157 -0
  37. package/es/components/CoachmarkStack/index.js +8 -0
  38. package/es/components/NotificationsPanel/NotificationsPanel.js +3 -2
  39. package/es/components/index.js +7 -0
  40. package/es/global/js/package-settings.js +8 -1
  41. package/lib/components/Carousel/Carousel.js +15 -5
  42. package/lib/components/Coachmark/Coachmark.js +247 -0
  43. package/lib/components/Coachmark/CoachmarkDragbar.js +137 -0
  44. package/lib/components/Coachmark/CoachmarkHeader.js +85 -0
  45. package/lib/components/Coachmark/CoachmarkOverlay.js +139 -0
  46. package/lib/components/Coachmark/CoachmarkTagline.js +90 -0
  47. package/lib/components/Coachmark/index.js +38 -0
  48. package/lib/components/Coachmark/utils/constants.js +82 -0
  49. package/lib/components/Coachmark/utils/context.js +13 -0
  50. package/lib/components/Coachmark/utils/enums.js +49 -0
  51. package/lib/components/Coachmark/utils/helpers.js +17 -0
  52. package/lib/components/Coachmark/utils/hooks.js +60 -0
  53. package/lib/components/CoachmarkBeacon/CoachmarkBeacon.js +87 -0
  54. package/lib/components/CoachmarkBeacon/index.js +12 -0
  55. package/lib/components/CoachmarkButton/CoachmarkButton.js +69 -0
  56. package/lib/components/CoachmarkButton/index.js +12 -0
  57. package/lib/components/CoachmarkFixed/CoachmarkFixed.js +201 -0
  58. package/lib/components/CoachmarkFixed/index.js +12 -0
  59. package/lib/components/CoachmarkOverlayElement/CoachmarkOverlayElement.js +83 -0
  60. package/lib/components/CoachmarkOverlayElement/index.js +12 -0
  61. package/lib/components/CoachmarkOverlayElements/CoachmarkOverlayElements.js +176 -0
  62. package/lib/components/CoachmarkOverlayElements/index.js +12 -0
  63. package/lib/components/CoachmarkStack/CoachmarkStack.js +264 -0
  64. package/lib/components/CoachmarkStack/CoachmarkStackHome.js +160 -0
  65. package/lib/components/CoachmarkStack/index.js +12 -0
  66. package/lib/components/NotificationsPanel/NotificationsPanel.js +3 -2
  67. package/lib/components/index.js +49 -0
  68. package/lib/global/js/package-settings.js +8 -1
  69. package/package.json +2 -2
  70. package/scss/components/Carousel/_carousel.scss +3 -0
  71. package/scss/components/Coachmark/_index.scss +11 -0
  72. package/scss/components/Coachmark/_storybook-styles.scss +20 -0
  73. package/scss/components/Coachmark/styles/_coachmark-dragbar.scss +74 -0
  74. package/scss/components/Coachmark/styles/_coachmark-header.scss +58 -0
  75. package/scss/components/Coachmark/styles/_coachmark-overlay.scss +327 -0
  76. package/scss/components/Coachmark/styles/_coachmark-tagline.scss +118 -0
  77. package/scss/components/CoachmarkBeacon/_coachmark-beacon.scss +166 -0
  78. package/scss/components/CoachmarkBeacon/_index.scss +8 -0
  79. package/scss/components/CoachmarkBeacon/_storybook-styles.scss +19 -0
  80. package/scss/components/CoachmarkButton/_coachmark-button.scss +34 -0
  81. package/scss/components/CoachmarkButton/_index.scss +8 -0
  82. package/scss/components/CoachmarkButton/_storybook-styles.scss +19 -0
  83. package/scss/components/CoachmarkFixed/_coachmark-fixed.scss +34 -0
  84. package/scss/components/CoachmarkFixed/_index.scss +8 -0
  85. package/scss/components/CoachmarkFixed/_storybook-styles.scss +10 -0
  86. package/scss/components/CoachmarkOverlayElement/_coachmark-overlay-element.scss +50 -0
  87. package/scss/components/CoachmarkOverlayElement/_index.scss +8 -0
  88. package/scss/components/CoachmarkOverlayElement/_storybook-styles.scss +19 -0
  89. package/scss/components/CoachmarkOverlayElements/_coachmark-overlay-elements.scss +40 -0
  90. package/scss/components/CoachmarkOverlayElements/_index.scss +8 -0
  91. package/scss/components/CoachmarkOverlayElements/_storybook-styles.scss +19 -0
  92. package/scss/components/CoachmarkStack/_coachmark-stack.scss +85 -0
  93. package/scss/components/CoachmarkStack/_index.scss +8 -0
  94. package/scss/components/CoachmarkStack/_storybook-styles.scss +10 -0
  95. package/scss/components/_index.scss +7 -1
@@ -0,0 +1,264 @@
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.CoachmarkStack = 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 _reactDom = require("react-dom");
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 _CoachmarkOverlay = require("../Coachmark/CoachmarkOverlay");
19
+ var _CoachmarkStackHome = require("./CoachmarkStackHome");
20
+ var _CoachmarkTagline = require("../Coachmark/CoachmarkTagline");
21
+ var _context = require("../Coachmark/utils/context");
22
+ var _enums = require("../Coachmark/utils/enums");
23
+ var _excluded = ["children", "className", "onClose", "description", "media", "navLinkLabels", "portalTarget", "closeButtonLabel", "tagline", "theme", "title"];
24
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
25
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
26
+ var blockClass = "".concat(_settings.pkg.prefix, "--coachmark-stack");
27
+ var elementBlockClass = "".concat(_settings.pkg.prefix, "--coachmark-stack-element");
28
+ var componentName = 'CoachmarkStack';
29
+ var defaults = {
30
+ onClose: function onClose() {},
31
+ // Pass through to CoachmarkStackHome
32
+ theme: 'light'
33
+ };
34
+
35
+ // NOTE
36
+ // The stack is limited to a depth of two Coachmarks:
37
+ // - a single parent CoachmarkStackHome
38
+ // - a single child Coachmark when stacked
39
+ // The parent will include links to all the children.
40
+ // No child Coachmark will include links to any other child Coachmarks.
41
+
42
+ /**
43
+ * Stacked coachmarks are used to call out specific functionality or concepts
44
+ * within the UI that may not be intuitive but are important for the
45
+ * user to gain understanding of the product's main value and discover new use cases.
46
+ * This variant allows the stacking of multiple coachmark overlays to be displayed by interacting with the tagline.
47
+ */
48
+ var CoachmarkStack = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
49
+ var _document$querySelect;
50
+ var children = _ref.children,
51
+ className = _ref.className,
52
+ _ref$onClose = _ref.onClose,
53
+ onClose = _ref$onClose === void 0 ? defaults.onClose : _ref$onClose,
54
+ description = _ref.description,
55
+ media = _ref.media,
56
+ navLinkLabels = _ref.navLinkLabels,
57
+ _ref$portalTarget = _ref.portalTarget,
58
+ portalTarget = _ref$portalTarget === void 0 ? defaults.portalTarget : _ref$portalTarget,
59
+ closeButtonLabel = _ref.closeButtonLabel,
60
+ tagline = _ref.tagline,
61
+ _ref$theme = _ref.theme,
62
+ theme = _ref$theme === void 0 ? defaults.theme : _ref$theme,
63
+ title = _ref.title,
64
+ rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
65
+ var portalNode = portalTarget ? (_document$querySelect = document.querySelector(portalTarget)) !== null && _document$querySelect !== void 0 ? _document$querySelect : document.querySelector('body') : document.querySelector('body');
66
+ var stackHomeRef = (0, _react.useRef)();
67
+ var stackedCoachmarkRefs = (0, _react.useRef)([]);
68
+ var _useState = (0, _react.useState)(false),
69
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
70
+ isOpen = _useState2[0],
71
+ setIsOpen = _useState2[1];
72
+ // selectedItemNumber -1 = parent close button was clicked, remove entire stack
73
+ // selectedItemNumber 0 = (default) the parent is visible, all children are hidden
74
+ // selectedItemNumber 1+ = a child is visible and stacked atop the parent
75
+ var _useState3 = (0, _react.useState)(0),
76
+ _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
77
+ selectedItemNumber = _useState4[0],
78
+ setSelectedItemNumber = _useState4[1];
79
+ // // The parent height and width values to return to after unstacked
80
+ var _useState5 = (0, _react.useState)(null),
81
+ _useState6 = (0, _slicedToArray2.default)(_useState5, 2),
82
+ parentHeight = _useState6[0],
83
+ setParentHeight = _useState6[1];
84
+ // parent height = child height when stacked behind a child that is shorter
85
+ var childArray = _react.Children.toArray(children);
86
+ var mountedRef = (0, _react.useRef)();
87
+ // same value as CSS animation speed
88
+ var delayMs = 240;
89
+
90
+ // Unmount or unstack a child
91
+ var handleClickNavItem = function handleClickNavItem(itemNumber) {
92
+ setSelectedItemNumber(itemNumber);
93
+ };
94
+ var handleClose = function handleClose(isParentCloseButton) {
95
+ if (isParentCloseButton) {
96
+ // Trigger slide-out animation
97
+ setSelectedItemNumber(-1);
98
+
99
+ // Unmount after animation is complete
100
+ var timer = setTimeout(function () {
101
+ setIsOpen(false);
102
+ onClose();
103
+ }, delayMs);
104
+ return function () {
105
+ return clearTimeout(timer);
106
+ };
107
+ } else {
108
+ // Unstack child
109
+ setSelectedItemNumber(0);
110
+ }
111
+ };
112
+ var contextValue = {
113
+ buttonProps: {
114
+ 'aria-expanded': isOpen,
115
+ onClick: function onClick() {
116
+ setIsOpen(true);
117
+ },
118
+ // Compensate for accidental open/close on double-click.
119
+ // Only open on double-click.
120
+ onDoubleClick: function onDoubleClick() {
121
+ setIsOpen(true);
122
+ }
123
+ },
124
+ closeButtonProps: {
125
+ onClick: function onClick() {
126
+ return handleClose(false);
127
+ }
128
+ },
129
+ isOpen: isOpen
130
+ };
131
+ (0, _react.useEffect)(function () {
132
+ mountedRef.current = true;
133
+ return function () {
134
+ mountedRef.current = false;
135
+ };
136
+ }, []);
137
+ (0, _react.useEffect)(function () {
138
+ setTimeout(function () {
139
+ if (stackHomeRef.current) {
140
+ setParentHeight(stackHomeRef.current.clientHeight);
141
+ }
142
+ }, 0);
143
+ }, [stackHomeRef]);
144
+ (0, _react.useEffect)(function () {
145
+ var targetSelectedItem = selectedItemNumber - 1;
146
+ if (!parentHeight) {
147
+ return;
148
+ }
149
+ stackHomeRef.current.style.height = "".concat(parentHeight, "px");
150
+ if (!isOpen || targetSelectedItem < 0) {
151
+ return;
152
+ }
153
+ var targetHomeHeight = stackedCoachmarkRefs.current[targetSelectedItem].clientHeight;
154
+ stackHomeRef.current.style.height = "".concat(targetHomeHeight, "px");
155
+ }, [selectedItemNumber, isOpen, parentHeight]);
156
+ var wrappedChildren = _react.Children.map(childArray, function (child, idx) {
157
+ var mountedClass = mountedRef.current ? "".concat(elementBlockClass, "--is-mounted") : '';
158
+ return /*#__PURE__*/_react.default.createElement(_CoachmarkOverlay.CoachmarkOverlay, {
159
+ key: idx,
160
+ ref: function ref(_ref2) {
161
+ return stackedCoachmarkRefs.current[idx] = _ref2;
162
+ },
163
+ kind: _enums.COACHMARK_OVERLAY_KIND.STACKED,
164
+ onClose: function onClose() {
165
+ return handleClose(false);
166
+ },
167
+ theme: theme,
168
+ fixedIsVisible: false,
169
+ className: (0, _classnames.default)(elementBlockClass, mountedClass, idx === selectedItemNumber - 1 && "".concat(elementBlockClass, "--is-visible"), mountedRef.current && "".concat(elementBlockClass, "--is-mounted"))
170
+ }, child);
171
+ });
172
+ return /*#__PURE__*/_react.default.createElement(_context.CoachmarkContext.Provider, {
173
+ value: contextValue
174
+ }, /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, rest, {
175
+ className: (0, _classnames.default)(blockClass, "".concat(_settings.pkg.prefix, "--coachmark-overlay--stack"), className),
176
+ ref: ref
177
+ }, (0, _devtools.getDevtoolsProps)(componentName)), /*#__PURE__*/_react.default.createElement(_CoachmarkTagline.CoachmarkTagline, {
178
+ title: tagline,
179
+ onClose: onClose
180
+ }), /*#__PURE__*/_react.default.createElement(_CoachmarkStackHome.CoachmarkStackHome, {
181
+ ref: stackHomeRef,
182
+ className: (0, _classnames.default)("".concat(_settings.pkg.prefix, "--coachmark-overlay"), "".concat(_settings.pkg.prefix, "--coachmark-overlay__").concat(theme), elementBlockClass, selectedItemNumber > 0 && "".concat(elementBlockClass, "--is-stacked"), selectedItemNumber > 0 && "".concat(elementBlockClass, "--is-stacked__").concat(theme), isOpen && "".concat(elementBlockClass, "--is-visible"), mountedRef.current && "".concat(elementBlockClass, "--is-mounted")),
183
+ description: description,
184
+ media: media,
185
+ navLinkLabels: navLinkLabels,
186
+ onClickNavItem: handleClickNavItem,
187
+ onClose: function onClose() {
188
+ handleClose(true);
189
+ },
190
+ portalTarget: portalTarget,
191
+ closeButtonLabel: closeButtonLabel,
192
+ title: title
193
+ }), /*#__PURE__*/(0, _reactDom.createPortal)(wrappedChildren, portalNode)));
194
+ });
195
+
196
+ // Return a placeholder if not released and not enabled by feature flag
197
+ exports.CoachmarkStack = CoachmarkStack;
198
+ exports.CoachmarkStack = CoachmarkStack = _settings.pkg.checkComponentEnabled(CoachmarkStack, componentName);
199
+
200
+ // The display name of the component, used by React. Note that displayName
201
+ // is used in preference to relying on function.name.
202
+ CoachmarkStack.displayName = componentName;
203
+
204
+ // The types and DocGen commentary for the component props,
205
+ // in alphabetical order (for consistency).
206
+ // See https://www.npmjs.com/package/prop-types#usage.
207
+ CoachmarkStack.propTypes = {
208
+ /**
209
+ * CoachmarkStack should use a single CoachmarkOverlayElements component as a child.
210
+ */
211
+ children: _propTypes.default.node.isRequired,
212
+ /**
213
+ * Provide an optional class to be applied to the containing node.
214
+ */
215
+ className: _propTypes.default.string,
216
+ /**
217
+ * The label for the button that will close the Stack
218
+ */
219
+ closeButtonLabel: _propTypes.default.string,
220
+ // Pass through to CoachmarkStackHome
221
+ /**
222
+ * The description of the Coachmark.
223
+ */
224
+ description: _propTypes.default.node.isRequired,
225
+ /**
226
+ * The object describing an image in one of two shapes.
227
+ *
228
+ * If a single media element is required, use `{render}`.
229
+ *
230
+ * If a stepped animation is required, use `{filePaths}`.
231
+ *
232
+ * @see {@link MEDIA_PROP_TYPE}.
233
+ */
234
+ media: _propTypes.default.oneOfType([_propTypes.default.shape({
235
+ render: _propTypes.default.func
236
+ }), _propTypes.default.shape({
237
+ filePaths: _propTypes.default.arrayOf(_propTypes.default.string)
238
+ })]),
239
+ /**
240
+ * The labels used to link to the stackable Coachmarks.
241
+ */
242
+ navLinkLabels: _propTypes.default.arrayOf(_propTypes.default.string).isRequired,
243
+ /**
244
+ * Function to call when the CoachmarkStack closes.
245
+ */
246
+ onClose: _propTypes.default.func,
247
+ /**
248
+ * Where in the DOM to render the stack.
249
+ * The default is `document.body`.
250
+ */
251
+ portalTarget: _propTypes.default.string,
252
+ /**
253
+ * The tagline title which will be fixed to the bottom right of the window and will serve as the display trigger.
254
+ */
255
+ tagline: _propTypes.default.string.isRequired,
256
+ /**
257
+ * Determines the theme of the component.
258
+ */
259
+ theme: _propTypes.default.oneOf(['light', 'dark']),
260
+ /**
261
+ * The title of the Coachmark.
262
+ */
263
+ title: _propTypes.default.string.isRequired
264
+ };
@@ -0,0 +1,160 @@
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.CoachmarkStackHome = void 0;
9
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
+ var _react = _interopRequireWildcard(require("react"));
12
+ var _pconsole = _interopRequireDefault(require("../../global/js/utils/pconsole"));
13
+ var _propTypes = _interopRequireDefault(require("prop-types"));
14
+ var _classnames = _interopRequireDefault(require("classnames"));
15
+ var _iconsReact = require("@carbon/icons-react");
16
+ var _carbonComponentsReact = require("carbon-components-react");
17
+ var _devtools = require("../../global/js/utils/devtools");
18
+ var _settings = require("../../settings");
19
+ var _reactDom = require("react-dom");
20
+ var _CoachmarkHeader = require("../Coachmark/CoachmarkHeader");
21
+ var _SteppedAnimatedMedia = require("../SteppedAnimatedMedia");
22
+ var _excluded = ["className", "description", "media", "navLinkLabels", "onClickNavItem", "onClose", "portalTarget", "closeButtonLabel", "title"];
23
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
24
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
25
+ // Carbon and package components we use.
26
+ /* TODO: @import(s) of carbon components and other package components. */
27
+
28
+ // The block part of our conventional BEM class names (blockClass__E--M).
29
+ var blockClass = "".concat(_settings.pkg.prefix, "--coachmark-stacked-home");
30
+ var overlayClass = "".concat(_settings.pkg.prefix, "--coachmark-overlay");
31
+ var componentName = 'CoachmarkStackHome';
32
+
33
+ /**
34
+ * DO NOT USE. This component is for the exclusive use
35
+ * of other Novice to Pro components.
36
+ */
37
+ var CoachmarkStackHome = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
38
+ var _document$querySelect;
39
+ var className = _ref.className,
40
+ description = _ref.description,
41
+ media = _ref.media,
42
+ navLinkLabels = _ref.navLinkLabels,
43
+ onClickNavItem = _ref.onClickNavItem,
44
+ onClose = _ref.onClose,
45
+ portalTarget = _ref.portalTarget,
46
+ closeButtonLabel = _ref.closeButtonLabel,
47
+ title = _ref.title,
48
+ rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
49
+ if (!navLinkLabels) {
50
+ return _pconsole.default.warn("".concat(componentName, " is a Novice to Pro internal component and is not intended for general use."));
51
+ }
52
+ var portalNode = portalTarget ? (_document$querySelect = document.querySelector(portalTarget)) !== null && _document$querySelect !== void 0 ? _document$querySelect : document.querySelector('body') : document.querySelector('body');
53
+ return /*#__PURE__*/(0, _reactDom.createPortal)( /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, rest, {
54
+ className: (0, _classnames.default)(blockClass, className),
55
+ ref: ref,
56
+ role: "main"
57
+ }, (0, _devtools.getDevtoolsProps)(componentName)), /*#__PURE__*/_react.default.createElement(_CoachmarkHeader.CoachmarkHeader, {
58
+ onClose: onClose
59
+ }), /*#__PURE__*/_react.default.createElement("div", {
60
+ className: "".concat(overlayClass, "__body")
61
+ }, /*#__PURE__*/_react.default.createElement("div", {
62
+ className: "".concat(overlayClass, "-element")
63
+ }, !media && /*#__PURE__*/_react.default.createElement(_iconsReact.Idea20, {
64
+ className: "".concat(blockClass, "__icon-idea")
65
+ }), media && (media.render ? media.render() : /*#__PURE__*/_react.default.createElement(_SteppedAnimatedMedia.SteppedAnimatedMedia, {
66
+ className: "".concat(overlayClass, "__element-stepped-media"),
67
+ filePaths: media.filePaths,
68
+ playStep: 0
69
+ })), /*#__PURE__*/_react.default.createElement("div", {
70
+ className: "".concat(overlayClass, "-element__content")
71
+ }, title && /*#__PURE__*/_react.default.createElement("h2", {
72
+ className: "".concat(overlayClass, "-element__title")
73
+ }, title), description && /*#__PURE__*/_react.default.createElement("p", {
74
+ className: "".concat(overlayClass, "-element__body")
75
+ }, description)), /*#__PURE__*/_react.default.createElement("ul", {
76
+ className: "".concat(blockClass, "__nav-links")
77
+ }, navLinkLabels.map(function (label, index) {
78
+ return /*#__PURE__*/_react.default.createElement("li", {
79
+ key: index
80
+ }, /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, {
81
+ kind: "ghost",
82
+ size: "sm",
83
+ onClick: function onClick() {
84
+ onClickNavItem(index + 1);
85
+ }
86
+ }, label));
87
+ })), closeButtonLabel && /*#__PURE__*/_react.default.createElement("div", {
88
+ className: "".concat(overlayClass, "__footer")
89
+ }, /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, {
90
+ size: "sm",
91
+ onClick: onClose
92
+ }, closeButtonLabel))))), portalNode);
93
+ });
94
+
95
+ // Return a placeholder if not released and not enabled by feature flag
96
+ exports.CoachmarkStackHome = CoachmarkStackHome;
97
+ exports.CoachmarkStackHome = CoachmarkStackHome = _settings.pkg.checkComponentEnabled(CoachmarkStackHome, componentName);
98
+
99
+ // The display name of the component, used by React. Note that displayName
100
+ // is used in preference to relying on function.name.
101
+ CoachmarkStackHome.displayName = componentName;
102
+
103
+ // The types and DocGen commentary for the component props,
104
+ // in alphabetical order (for consistency).
105
+ // See https://www.npmjs.com/package/prop-types#usage.
106
+ CoachmarkStackHome.propTypes = {
107
+ /**
108
+ * Optional class name for this component.
109
+ */
110
+ className: _propTypes.default.string,
111
+ /**
112
+ * The label for the button that will close the stack
113
+ */
114
+ closeButtonLabel: _propTypes.default.string,
115
+ /**
116
+ * The description of the Coachmark.
117
+ */
118
+ description: _propTypes.default.node.isRequired,
119
+ /**
120
+ * The object describing an image in one of two shapes.
121
+ *
122
+ * If a single media element is required, use `{render}`.
123
+ *
124
+ * If a stepped animation is required, use `{filePaths}`.
125
+ *
126
+ * @see {@link MEDIA_PROP_TYPE}.
127
+ */
128
+ media: _propTypes.default.oneOfType([_propTypes.default.shape({
129
+ render: _propTypes.default.func
130
+ }), _propTypes.default.shape({
131
+ filePaths: _propTypes.default.arrayOf(_propTypes.default.string)
132
+ })]),
133
+ /**
134
+ * The labels used to link to the stackable Coachmarks.
135
+ */
136
+ navLinkLabels: _propTypes.default.arrayOf(_propTypes.default.string).isRequired,
137
+ /**
138
+ * For internal use only by CoachmarkStack and CoachmarkStackHome.
139
+ */
140
+ onClickNavItem: _propTypes.default.func.isRequired,
141
+ /**
142
+ * Function to call when the stack closes.
143
+ */
144
+ onClose: _propTypes.default.func.isRequired,
145
+ /**
146
+ * By default, the CoachmarkStackHome will be appended to the end of `document.body`.
147
+ * The CoachmarkStackHome will remain persistent as the user navigates the app until
148
+ * the user closes the CoachmarkStackHome.
149
+ *
150
+ * Alternatively, the app developer can tightly couple the CoachmarkStackHome to a DOM
151
+ * element or other component by specifying a CSS selector. The CoachmarkStackHome will
152
+ * remain visible as long as that element remains visible or mounted. When the
153
+ * element is hidden or component is unmounted, the CoachmarkStackHome will disappear.
154
+ */
155
+ portalTarget: _propTypes.default.string,
156
+ /**
157
+ * The title of the Coachmark.
158
+ */
159
+ title: _propTypes.default.string.isRequired
160
+ };
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "CoachmarkStack", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _CoachmarkStack.CoachmarkStack;
10
+ }
11
+ });
12
+ var _CoachmarkStack = require("./CoachmarkStack");
@@ -17,6 +17,7 @@ var _devtools = require("../../global/js/utils/devtools");
17
17
  var _hooks = require("../../global/js/hooks");
18
18
  var _settings = require("../../settings");
19
19
  var _utils = require("./utils");
20
+ var _propsHelper = require("../../global/js/utils/props-helper");
20
21
  var _NotificationsEmptyState = require("../EmptyStates/NotificationsEmptyState");
21
22
  var _carbonComponentsReact = require("carbon-components-react");
22
23
  var _iconsReact = require("@carbon/icons-react");
@@ -285,10 +286,10 @@ var NotificationsPanel = /*#__PURE__*/_react.default.forwardRef(function (_ref,
285
286
  nowText: nowText
286
287
  })), /*#__PURE__*/_react.default.createElement("h6", {
287
288
  className: notificationHeaderClassName
288
- }, notification.title), notification.description && notification.description.length && renderDescription(notification.id), notification.link && notification.link.text && notification.link.url && /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Link, {
289
+ }, notification.title), notification.description && notification.description.length && renderDescription(notification.id), notification.link && notification.link.text && notification.link.url && /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Link, (0, _extends2.default)({
289
290
  href: notification.link.url,
290
291
  className: "".concat(blockClass, "__notifications-link")
291
- }, notification.link.text)), /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, {
292
+ }, (0, _propsHelper.prepareProps)({}, notification.link, ['text', 'url'])), notification.link.text)), /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, {
292
293
  kind: "ghost",
293
294
  size: "small",
294
295
  renderIcon: _iconsReact.Close16,
@@ -21,6 +21,48 @@ Object.defineProperty(exports, "Cascade", {
21
21
  return _Cascade.Cascade;
22
22
  }
23
23
  });
24
+ Object.defineProperty(exports, "Coachmark", {
25
+ enumerable: true,
26
+ get: function get() {
27
+ return _Coachmark.Coachmark;
28
+ }
29
+ });
30
+ Object.defineProperty(exports, "CoachmarkBeacon", {
31
+ enumerable: true,
32
+ get: function get() {
33
+ return _CoachmarkBeacon.CoachmarkBeacon;
34
+ }
35
+ });
36
+ Object.defineProperty(exports, "CoachmarkButton", {
37
+ enumerable: true,
38
+ get: function get() {
39
+ return _CoachmarkButton.CoachmarkButton;
40
+ }
41
+ });
42
+ Object.defineProperty(exports, "CoachmarkFixed", {
43
+ enumerable: true,
44
+ get: function get() {
45
+ return _CoachmarkFixed.CoachmarkFixed;
46
+ }
47
+ });
48
+ Object.defineProperty(exports, "CoachmarkOverlayElement", {
49
+ enumerable: true,
50
+ get: function get() {
51
+ return _CoachmarkOverlayElement.CoachmarkOverlayElement;
52
+ }
53
+ });
54
+ Object.defineProperty(exports, "CoachmarkOverlayElements", {
55
+ enumerable: true,
56
+ get: function get() {
57
+ return _CoachmarkOverlayElements.CoachmarkOverlayElements;
58
+ }
59
+ });
60
+ Object.defineProperty(exports, "CoachmarkStack", {
61
+ enumerable: true,
62
+ get: function get() {
63
+ return _CoachmarkStack.CoachmarkStack;
64
+ }
65
+ });
24
66
  Object.defineProperty(exports, "ComboButton", {
25
67
  enumerable: true,
26
68
  get: function get() {
@@ -530,4 +572,11 @@ var _InlineEdit = require("./InlineEdit");
530
572
  var _EditInPlace = require("./EditInPlace");
531
573
  var _Guidebanner = require("./Guidebanner");
532
574
  var _NonLinearReading = require("./NonLinearReading");
575
+ var _Coachmark = require("./Coachmark");
576
+ var _CoachmarkFixed = require("./CoachmarkFixed");
577
+ var _CoachmarkBeacon = require("./CoachmarkBeacon");
578
+ var _CoachmarkButton = require("./CoachmarkButton");
579
+ var _CoachmarkOverlayElements = require("./CoachmarkOverlayElements");
580
+ var _CoachmarkOverlayElement = require("./CoachmarkOverlayElement");
581
+ var _CoachmarkStack = require("./CoachmarkStack");
533
582
  var _InlineTip = require("./InlineTip");
@@ -74,7 +74,14 @@ var defaults = {
74
74
  // Novice to pro components not yet reviewed and released:
75
75
  InlineTip: false,
76
76
  Guidebanner: false,
77
- NonLinearReading: false
77
+ NonLinearReading: false,
78
+ Coachmark: false,
79
+ CoachmarkBeacon: false,
80
+ CoachmarkButton: false,
81
+ CoachmarkFixed: false,
82
+ CoachmarkOverlayElement: false,
83
+ CoachmarkOverlayElements: false,
84
+ CoachmarkStack: false
78
85
  /* new component flags here - comment used by generate CLI */
79
86
  },
80
87
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@carbon/ibm-products",
3
3
  "description": "Carbon for IBM Products",
4
- "version": "1.55.2",
4
+ "version": "1.56.0",
5
5
  "license": "Apache-2.0",
6
6
  "main": "lib/index.js",
7
7
  "module": "es/index.js",
@@ -96,5 +96,5 @@
96
96
  "react": "^16.8.6 || ^17.0.1",
97
97
  "react-dom": "^16.8.6 || ^17.0.1"
98
98
  },
99
- "gitHead": "33f2fa8f015f9d04c83142badc07c9f0905130c8"
99
+ "gitHead": "9f4bc491efe9aa02b6e038c0d13ba4a0757395f1"
100
100
  }
@@ -71,6 +71,9 @@
71
71
  -moz-user-select: none;
72
72
  -ms-user-select: none;
73
73
  user-select: none;
74
+ @media (prefers-reduced-motion) {
75
+ scroll-behavior: auto;
76
+ }
74
77
  }
75
78
  }
76
79
  }
@@ -0,0 +1,11 @@
1
+ //
2
+ // Copyright IBM Corp. 2023, 2023
3
+ //
4
+ // This source code is licensed under the Apache-2.0 license found in the
5
+ // LICENSE file in the root directory of this source tree.
6
+ //
7
+
8
+ @import './styles/coachmark-dragbar';
9
+ @import './styles/coachmark-header';
10
+ @import './styles/coachmark-overlay';
11
+ @import './styles/coachmark-tagline';
@@ -0,0 +1,20 @@
1
+ //
2
+ // Copyright IBM Corp. 2023, 2023
3
+ //
4
+ // This source code is licensed under the Apache-2.0 license found in the
5
+ // LICENSE file in the root directory of this source tree.
6
+ //
7
+
8
+ @import '../../global/styles/project-settings';
9
+
10
+ .CoachmarkBaseExampleUsage {
11
+ position: relative;
12
+ display: inline-block;
13
+ max-height: 100%;
14
+ box-sizing: border-box;
15
+
16
+ /* stylelint-disable-next-line carbon/layout-token-use */
17
+ padding: 1rem;
18
+ margin-left: 50%;
19
+ transform: translateX(-50%);
20
+ }
@@ -0,0 +1,74 @@
1
+ //
2
+ // Copyright IBM Corp. 2023, 2023
3
+ //
4
+ // This source code is licensed under the Apache-2.0 license found in the
5
+ // LICENSE file in the root directory of this source tree.
6
+ //
7
+
8
+ /* stylelint-disable declaration-no-important */
9
+
10
+ // Standard imports.
11
+ @import '../../../global/styles/project-settings';
12
+ @import '../../../global/styles/mixins';
13
+
14
+ // Define all component styles in a mixin which is then exported using
15
+ // the Carbon import-once mechanism.
16
+ @mixin coachmark-dragbar {
17
+ // The block part of our conventional BEM class names (blockClass__E--M).
18
+ $block-class: #{$pkg-prefix}--coachmark-dragbar;
19
+
20
+ .#{$block-class} {
21
+ display: flex;
22
+
23
+ &__handle {
24
+ flex-grow: 1;
25
+ padding: $spacing-03 0 0 $spacing-03;
26
+ border: 0;
27
+ background-color: transparent;
28
+ text-align: left;
29
+
30
+ &:hover {
31
+ cursor: move;
32
+ }
33
+ }
34
+
35
+ &--close-btn {
36
+ width: $spacing-07;
37
+ height: $spacing-07;
38
+ margin-left: auto !important;
39
+
40
+ svg > path {
41
+ margin: 0;
42
+ fill: $inverse-01 !important;
43
+ }
44
+
45
+ &:hover {
46
+ background-color: $inverse-hover-ui !important;
47
+ }
48
+ }
49
+
50
+ &__light {
51
+ #{$block-class}--close-btn {
52
+ &:active {
53
+ background-color: $active-secondary;
54
+ }
55
+ }
56
+ }
57
+
58
+ &__dark {
59
+ #{$block-class}--close-btn {
60
+ &:active {
61
+ background-color: $button-tertiary-active;
62
+ }
63
+ }
64
+ }
65
+
66
+ svg {
67
+ color: $inverse-01;
68
+ }
69
+ }
70
+ }
71
+
72
+ @include exports('coachmark-dragbar') {
73
+ @include coachmark-dragbar;
74
+ }