@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.
- package/css/index-full-carbon.css +29484 -28211
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +1 -1
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon-released-only.css +49 -10
- package/css/index-without-carbon-released-only.css.map +1 -1
- package/css/index-without-carbon-released-only.min.css +1 -1
- package/css/index-without-carbon-released-only.min.css.map +1 -1
- package/css/index-without-carbon.css +24418 -291
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +1 -1
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +17172 -13
- package/css/index.css.map +1 -1
- package/css/index.min.css +1 -1
- package/css/index.min.css.map +1 -1
- package/es/components/Card/Card.js +1 -2
- package/es/components/Card/CardHeader.js +2 -2
- package/es/components/Carousel/Carousel.js +5 -3
- package/es/components/Coachmark/Coachmark.js +255 -0
- package/es/components/Coachmark/CoachmarkDragbar.js +146 -0
- package/es/components/Coachmark/CoachmarkHeader.js +91 -0
- package/es/components/Coachmark/CoachmarkOverlay.js +235 -0
- package/es/components/Coachmark/CoachmarkTagline.js +97 -0
- package/es/components/Coachmark/index.js +10 -0
- package/es/components/Coachmark/utils/constants.js +76 -0
- package/es/components/Coachmark/utils/context.js +5 -0
- package/es/components/Coachmark/utils/enums.js +40 -0
- package/es/components/Coachmark/utils/helpers.js +11 -0
- package/es/components/Coachmark/utils/hooks.js +54 -0
- package/es/components/CoachmarkBeacon/CoachmarkBeacon.js +93 -0
- package/es/components/CoachmarkBeacon/index.js +8 -0
- package/es/components/CoachmarkButton/CoachmarkButton.js +90 -0
- package/es/components/CoachmarkButton/index.js +8 -0
- package/es/components/CoachmarkFixed/CoachmarkFixed.js +226 -0
- package/es/components/CoachmarkFixed/index.js +8 -0
- package/es/components/CoachmarkOverlayElement/CoachmarkOverlayElement.js +86 -0
- package/es/components/CoachmarkOverlayElement/index.js +8 -0
- package/es/components/CoachmarkOverlayElements/CoachmarkOverlayElements.js +216 -0
- package/es/components/CoachmarkOverlayElements/index.js +8 -0
- package/es/components/CoachmarkStack/CoachmarkStack.js +283 -0
- package/es/components/CoachmarkStack/CoachmarkStackHome.js +192 -0
- package/es/components/CoachmarkStack/index.js +8 -0
- package/es/components/Datagrid/Datagrid/DatagridSelectAll.js +4 -1
- package/es/components/Datagrid/Datagrid/DraggableElement.js +1 -1
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/ButtonWrapper.js +1 -1
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +4 -1
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js +1 -1
- package/es/components/Datagrid/Datagrid.docs-page.js +2 -2
- package/es/components/Datagrid/useActionsColumn.js +16 -12
- package/es/components/Datagrid/useNestedRowExpander.js +2 -2
- package/es/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +7 -2
- package/es/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +8 -3
- package/es/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +7 -2
- package/es/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +7 -2
- package/es/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +7 -2
- package/es/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +7 -2
- package/es/components/EmptyStates/assets/ErrorIllustration.js +5 -5
- package/es/components/EmptyStates/assets/NoDataIllustration.js +5 -5
- package/es/components/EmptyStates/assets/NoTagsIllustration.js +5 -5
- package/es/components/EmptyStates/assets/NotFoundIllustration.js +5 -5
- package/es/components/EmptyStates/assets/NotificationsIllustration.js +5 -5
- package/es/components/EmptyStates/assets/UnauthorizedIllustration.js +5 -5
- package/es/components/InterstitialScreen/InterstitialScreen.js +427 -0
- package/es/components/InterstitialScreen/index.js +8 -0
- package/es/components/InterstitialScreenView/InterstitialScreenView.js +75 -0
- package/es/components/InterstitialScreenView/index.js +8 -0
- package/es/components/InterstitialScreenViewModule/InterstitialScreenViewModule.js +83 -0
- package/es/components/InterstitialScreenViewModule/index.js +8 -0
- package/es/components/PageHeader/PageHeaderUtils.js +2 -2
- package/es/components/SearchBar/SearchBar.js +227 -0
- package/es/components/SearchBar/index.js +8 -0
- package/es/components/index.js +12 -1
- package/es/global/js/package-settings.js +14 -0
- package/lib/components/Card/Card.js +3 -4
- package/lib/components/Card/CardHeader.js +2 -2
- package/lib/components/Carousel/Carousel.js +5 -3
- package/lib/components/Coachmark/Coachmark.js +264 -0
- package/lib/components/Coachmark/CoachmarkDragbar.js +151 -0
- package/lib/components/Coachmark/CoachmarkHeader.js +95 -0
- package/lib/components/Coachmark/CoachmarkOverlay.js +243 -0
- package/lib/components/Coachmark/CoachmarkTagline.js +101 -0
- package/lib/components/Coachmark/index.js +38 -0
- package/lib/components/Coachmark/utils/constants.js +81 -0
- package/lib/components/Coachmark/utils/context.js +11 -0
- package/lib/components/Coachmark/utils/enums.js +46 -0
- package/lib/components/Coachmark/utils/helpers.js +17 -0
- package/lib/components/Coachmark/utils/hooks.js +59 -0
- package/lib/components/CoachmarkBeacon/CoachmarkBeacon.js +97 -0
- package/lib/components/CoachmarkBeacon/index.js +12 -0
- package/lib/components/CoachmarkButton/CoachmarkButton.js +93 -0
- package/lib/components/CoachmarkButton/index.js +12 -0
- package/lib/components/CoachmarkFixed/CoachmarkFixed.js +232 -0
- package/lib/components/CoachmarkFixed/index.js +12 -0
- package/lib/components/CoachmarkOverlayElement/CoachmarkOverlayElement.js +90 -0
- package/lib/components/CoachmarkOverlayElement/index.js +12 -0
- package/lib/components/CoachmarkOverlayElements/CoachmarkOverlayElements.js +222 -0
- package/lib/components/CoachmarkOverlayElements/index.js +12 -0
- package/lib/components/CoachmarkStack/CoachmarkStack.js +288 -0
- package/lib/components/CoachmarkStack/CoachmarkStackHome.js +198 -0
- package/lib/components/CoachmarkStack/index.js +12 -0
- package/lib/components/Datagrid/Datagrid/DatagridSelectAll.js +4 -1
- package/lib/components/Datagrid/Datagrid/DraggableElement.js +1 -1
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/ButtonWrapper.js +1 -1
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +4 -1
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js +1 -1
- package/lib/components/Datagrid/Datagrid.docs-page.js +2 -2
- package/lib/components/Datagrid/useActionsColumn.js +15 -11
- package/lib/components/Datagrid/useNestedRowExpander.js +2 -2
- package/lib/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +7 -2
- package/lib/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +8 -3
- package/lib/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +7 -2
- package/lib/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +7 -2
- package/lib/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +7 -2
- package/lib/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +7 -2
- package/lib/components/EmptyStates/assets/ErrorIllustration.js +5 -5
- package/lib/components/EmptyStates/assets/NoDataIllustration.js +5 -5
- package/lib/components/EmptyStates/assets/NoTagsIllustration.js +5 -5
- package/lib/components/EmptyStates/assets/NotFoundIllustration.js +5 -5
- package/lib/components/EmptyStates/assets/NotificationsIllustration.js +5 -5
- package/lib/components/EmptyStates/assets/UnauthorizedIllustration.js +5 -5
- package/lib/components/InterstitialScreen/InterstitialScreen.js +434 -0
- package/lib/components/InterstitialScreen/index.js +12 -0
- package/lib/components/InterstitialScreenView/InterstitialScreenView.js +77 -0
- package/lib/components/InterstitialScreenView/index.js +12 -0
- package/lib/components/InterstitialScreenViewModule/InterstitialScreenViewModule.js +85 -0
- package/lib/components/InterstitialScreenViewModule/index.js +12 -0
- package/lib/components/PageHeader/PageHeaderUtils.js +2 -2
- package/lib/components/SearchBar/SearchBar.js +233 -0
- package/lib/components/SearchBar/index.js +12 -0
- package/lib/components/index.js +78 -1
- package/lib/global/js/package-settings.js +14 -0
- package/package.json +5 -5
- package/scss/components/Card/_card.scss +6 -5
- package/scss/components/Coachmark/_carbon-imports.scss +10 -0
- package/scss/components/Coachmark/_coachmark-dragbar.scss +27 -0
- package/scss/components/Coachmark/_coachmark-header.scss +20 -0
- package/scss/components/Coachmark/_coachmark-overlay.scss +431 -0
- package/scss/components/Coachmark/_coachmark-tagline.scss +140 -0
- package/scss/components/Coachmark/_coachmark.scss +30 -0
- package/scss/components/Coachmark/_index-with-carbon.scss +9 -0
- package/scss/components/Coachmark/_index.scss +8 -0
- package/scss/components/CoachmarkBeacon/_carbon-imports.scss +9 -0
- package/scss/components/CoachmarkBeacon/_coachmark-beacon.scss +166 -0
- package/scss/components/CoachmarkBeacon/_index-with-carbon.scss +9 -0
- package/scss/components/CoachmarkBeacon/_index.scss +8 -0
- package/scss/components/CoachmarkButton/_carbon-imports.scss +9 -0
- package/scss/components/CoachmarkButton/_coachmark-button.scss +25 -0
- package/scss/components/CoachmarkButton/_index-with-carbon.scss +9 -0
- package/scss/components/CoachmarkButton/_index.scss +8 -0
- package/scss/components/CoachmarkFixed/_carbon-imports.scss +9 -0
- package/scss/components/CoachmarkFixed/_coachmark-fixed.scss +25 -0
- package/scss/components/CoachmarkFixed/_index-with-carbon.scss +9 -0
- package/scss/components/CoachmarkFixed/_index.scss +8 -0
- package/scss/components/CoachmarkOverlayElement/_carbon-imports.scss +9 -0
- package/scss/components/CoachmarkOverlayElement/_coachmark-overlay-element.scss +52 -0
- package/scss/components/CoachmarkOverlayElement/_index-with-carbon.scss +9 -0
- package/scss/components/CoachmarkOverlayElement/_index.scss +8 -0
- package/scss/components/CoachmarkOverlayElements/_carbon-imports.scss +9 -0
- package/scss/components/CoachmarkOverlayElements/_coachmark-overlay-elements.scss +47 -0
- package/scss/components/CoachmarkOverlayElements/_index-with-carbon.scss +9 -0
- package/scss/components/CoachmarkOverlayElements/_index.scss +8 -0
- package/scss/components/CoachmarkStack/_carbon-imports.scss +9 -0
- package/scss/components/CoachmarkStack/_coachmark-stack.scss +95 -0
- package/scss/components/CoachmarkStack/_index-with-carbon.scss +9 -0
- package/scss/components/CoachmarkStack/_index.scss +8 -0
- package/scss/components/InterstitialScreen/_carbon-imports.scss +9 -0
- package/scss/components/InterstitialScreen/_index-with-carbon.scss +9 -0
- package/scss/components/InterstitialScreen/_index.scss +8 -0
- package/scss/components/InterstitialScreen/_interstitial-screen.scss +276 -0
- package/scss/components/InterstitialScreenView/_carbon-imports.scss +9 -0
- package/scss/components/InterstitialScreenView/_index-with-carbon.scss +9 -0
- package/scss/components/InterstitialScreenView/_index.scss +8 -0
- package/scss/components/InterstitialScreenView/_interstitial-screen-view.scss +25 -0
- package/scss/components/InterstitialScreenViewModule/_carbon-imports.scss +9 -0
- package/scss/components/InterstitialScreenViewModule/_index-with-carbon.scss +9 -0
- package/scss/components/InterstitialScreenViewModule/_index.scss +8 -0
- package/scss/components/InterstitialScreenViewModule/_interstitial-screen-view-module.scss +59 -0
- package/scss/components/PageHeader/_page-header.scss +0 -1
- package/scss/components/SearchBar/_carbon-imports.scss +9 -0
- package/scss/components/SearchBar/_index-with-carbon.scss +9 -0
- package/scss/components/SearchBar/_index.scss +8 -0
- package/scss/components/SearchBar/_search-bar.scss +26 -0
- package/scss/components/SidePanel/_side-panel.scss +12 -7
- package/scss/components/_index-with-carbon.scss +11 -0
- package/scss/components/_index.scss +11 -0
@@ -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");
|
@@ -0,0 +1,222 @@
|
|
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.CoachmarkOverlayElements = 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 _react2 = require("@carbon/react");
|
18
|
+
var _Coachmark = require("../Coachmark");
|
19
|
+
var _lodash = require("lodash");
|
20
|
+
var _pconsole = _interopRequireDefault(require("../../global/js/utils/pconsole"));
|
21
|
+
var _Carousel = require("../Carousel");
|
22
|
+
var _SteppedAnimatedMedia = require("../SteppedAnimatedMedia");
|
23
|
+
var _excluded = ["className", "children", "isVisible", "media", "nextButtonText", "previousButtonLabel", "closeButtonLabel"];
|
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
|
+
// Carbon and package components we use.
|
33
|
+
//TODO THIS PATH WILL NEED TO BE UPDATED ONCE IN IBM PRODUCTS
|
34
|
+
//TODO THIS PATH WILL NEED TO BE UPDATED ONCE IN IBM PRODUCTS
|
35
|
+
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); }
|
36
|
+
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; }
|
37
|
+
// The block part of our conventional BEM class names (blockClass__E--M).
|
38
|
+
var blockClass = "".concat(_settings.pkg.prefix, "--coachmark-overlay-elements");
|
39
|
+
var componentName = 'CoachmarkOverlayElements';
|
40
|
+
|
41
|
+
// NOTE: the component SCSS is not imported here: it is rolled up separately.
|
42
|
+
|
43
|
+
// Default values can be included here and then assigned to the prop params,
|
44
|
+
// e.g. prop = defaults.prop,
|
45
|
+
// This gathers default values together neatly and ensures non-primitive
|
46
|
+
// values are initialized early to avoid react making unnecessary re-renders.
|
47
|
+
// Note that default values are not required for props that are 'required',
|
48
|
+
// nor for props where the component can apply undefined values reasonably.
|
49
|
+
// Default values should be provided when the component needs to make a choice
|
50
|
+
// or assumption when a prop is not supplied.
|
51
|
+
|
52
|
+
// Default values for props
|
53
|
+
var defaults = {
|
54
|
+
isVisible: false,
|
55
|
+
nextButtonText: 'Next',
|
56
|
+
previousButtonLabel: 'Back',
|
57
|
+
closeButtonLabel: 'Got it'
|
58
|
+
};
|
59
|
+
/**
|
60
|
+
* Composable container to allow for the displaying of CoachmarkOverlayElement
|
61
|
+
* components in a carousel fashion.
|
62
|
+
*/
|
63
|
+
var CoachmarkOverlayElements = exports.CoachmarkOverlayElements = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
64
|
+
var className = _ref.className,
|
65
|
+
children = _ref.children,
|
66
|
+
_ref$isVisible = _ref.isVisible,
|
67
|
+
isVisible = _ref$isVisible === void 0 ? defaults.isVisible : _ref$isVisible,
|
68
|
+
media = _ref.media,
|
69
|
+
_ref$nextButtonText = _ref.nextButtonText,
|
70
|
+
nextButtonText = _ref$nextButtonText === void 0 ? defaults.nextButtonText : _ref$nextButtonText,
|
71
|
+
_ref$previousButtonLa = _ref.previousButtonLabel,
|
72
|
+
previousButtonLabel = _ref$previousButtonLa === void 0 ? defaults.previousButtonLabel : _ref$previousButtonLa,
|
73
|
+
_ref$closeButtonLabel = _ref.closeButtonLabel,
|
74
|
+
closeButtonLabel = _ref$closeButtonLabel === void 0 ? defaults.closeButtonLabel : _ref$closeButtonLabel,
|
75
|
+
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
76
|
+
var buttonFocusRef = (0, _react.useRef)();
|
77
|
+
var scrollRef = (0, _react.useRef)();
|
78
|
+
var _useState = (0, _react.useState)(0),
|
79
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
80
|
+
scrollPosition = _useState2[0],
|
81
|
+
setScrollPosition = _useState2[1];
|
82
|
+
var _useState3 = (0, _react.useState)(0),
|
83
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
84
|
+
currentProgStep = _useState4[0],
|
85
|
+
_setCurrentProgStep = _useState4[1];
|
86
|
+
var coachmark = (0, _Coachmark.useCoachmark)();
|
87
|
+
var setCurrentProgStep = function setCurrentProgStep(value) {
|
88
|
+
if (currentProgStep > 0 && value === 0 && buttonFocusRef.current) {
|
89
|
+
setTimeout(function () {
|
90
|
+
buttonFocusRef.current.focus();
|
91
|
+
}, 1000);
|
92
|
+
}
|
93
|
+
_setCurrentProgStep(value);
|
94
|
+
};
|
95
|
+
var numProgSteps = _react.Children.count(children);
|
96
|
+
var progStepFloor = 0;
|
97
|
+
var progStepCeil = numProgSteps - 1;
|
98
|
+
(0, _react.useEffect)(function () {
|
99
|
+
// On mount, one of the two primary buttons ("next" or "close")
|
100
|
+
// will be rendered and must have focus. (a11y)
|
101
|
+
if (buttonFocusRef.current) {
|
102
|
+
buttonFocusRef.current.focus();
|
103
|
+
}
|
104
|
+
}, []);
|
105
|
+
(0, _react.useEffect)(function () {
|
106
|
+
setTimeout(function () {
|
107
|
+
if (buttonFocusRef.current && isVisible) {
|
108
|
+
buttonFocusRef.current.focus();
|
109
|
+
}
|
110
|
+
}, 100);
|
111
|
+
}, [isVisible]);
|
112
|
+
if (!coachmark) {
|
113
|
+
return _pconsole.default.warn("The ".concat(componentName, " is a composable container element which should be used only within the scope of a Coachmark or a CoachmarkFixed component."));
|
114
|
+
}
|
115
|
+
return /*#__PURE__*/_react.default.createElement("section", (0, _extends2.default)({}, rest, {
|
116
|
+
className: (0, _classnames.default)(blockClass,
|
117
|
+
// Apply the block class to the main HTML element
|
118
|
+
className,
|
119
|
+
// Apply any supplied class names to the main HTML element.
|
120
|
+
// example: `${blockClass}__template-string-class-${kind}-n-${size}`,
|
121
|
+
{
|
122
|
+
// switched classes dependant on props or state
|
123
|
+
// example: [`${blockClass}__here-if-small`]: size === 'sm',
|
124
|
+
}),
|
125
|
+
ref: ref
|
126
|
+
// role="main"
|
127
|
+
}, (0, _devtools.getDevtoolsProps)(componentName)), media && (media.render ? media.render() : /*#__PURE__*/_react.default.createElement(_SteppedAnimatedMedia.SteppedAnimatedMedia, {
|
128
|
+
className: "".concat(blockClass, "__element-stepped-media"),
|
129
|
+
filePaths: media.filePaths,
|
130
|
+
playStep: currentProgStep
|
131
|
+
})), numProgSteps === 1 ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children, closeButtonLabel && /*#__PURE__*/_react.default.createElement("div", {
|
132
|
+
className: (0, _classnames.default)("".concat(blockClass, "__footer"), 'coachmark-carousel-controls')
|
133
|
+
}, /*#__PURE__*/_react.default.createElement(_react2.Button, (0, _extends2.default)({
|
134
|
+
size: "sm"
|
135
|
+
}, coachmark.closeButtonProps, {
|
136
|
+
ref: buttonFocusRef
|
137
|
+
}), closeButtonLabel))) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Carousel.Carousel, {
|
138
|
+
disableArrowScroll: true,
|
139
|
+
ref: scrollRef,
|
140
|
+
onScroll: function onScroll(scrollPercent) {
|
141
|
+
setScrollPosition(scrollPercent);
|
142
|
+
}
|
143
|
+
}, children), /*#__PURE__*/_react.default.createElement("div", {
|
144
|
+
className: (0, _classnames.default)("".concat(blockClass, "__footer"))
|
145
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
146
|
+
className: "".concat(blockClass, "--controls-progress")
|
147
|
+
}, "".concat(currentProgStep + 1, " / ").concat(numProgSteps)), scrollPosition > 0 && /*#__PURE__*/_react.default.createElement(_react2.Button, {
|
148
|
+
size: "sm",
|
149
|
+
kind: "ghost",
|
150
|
+
title: previousButtonLabel,
|
151
|
+
disabled: scrollPosition === 0,
|
152
|
+
onClick: function onClick() {
|
153
|
+
var targetStep = (0, _lodash.clamp)(currentProgStep - 1, progStepFloor, progStepCeil);
|
154
|
+
scrollRef.current.scrollToView(targetStep);
|
155
|
+
setCurrentProgStep(targetStep);
|
156
|
+
}
|
157
|
+
}, previousButtonLabel), currentProgStep < progStepCeil ? /*#__PURE__*/_react.default.createElement(_react2.Button, {
|
158
|
+
size: "sm",
|
159
|
+
ref: buttonFocusRef,
|
160
|
+
title: nextButtonText,
|
161
|
+
disabled: scrollPosition === 1,
|
162
|
+
onClick: function onClick() {
|
163
|
+
var targetStep = (0, _lodash.clamp)(currentProgStep + 1, progStepFloor, progStepCeil);
|
164
|
+
scrollRef.current.scrollToView(targetStep);
|
165
|
+
setCurrentProgStep(targetStep);
|
166
|
+
}
|
167
|
+
}, nextButtonText) : closeButtonLabel && /*#__PURE__*/_react.default.createElement(_react2.Button, (0, _extends2.default)({
|
168
|
+
size: "sm",
|
169
|
+
ref: buttonFocusRef
|
170
|
+
}, coachmark.closeButtonProps), closeButtonLabel))));
|
171
|
+
});
|
172
|
+
|
173
|
+
// Return a placeholder if not released and not enabled by feature flag
|
174
|
+
exports.CoachmarkOverlayElements = CoachmarkOverlayElements = _settings.pkg.checkComponentEnabled(CoachmarkOverlayElements, componentName);
|
175
|
+
|
176
|
+
// The display name of the component, used by React. Note that displayName
|
177
|
+
// is used in preference to relying on function.name.
|
178
|
+
CoachmarkOverlayElements.displayName = componentName;
|
179
|
+
|
180
|
+
// The types and DocGen commentary for the component props,
|
181
|
+
// in alphabetical order (for consistency).
|
182
|
+
// See https://www.npmjs.com/package/prop-types#usage.
|
183
|
+
CoachmarkOverlayElements.propTypes = {
|
184
|
+
// TODO: UPDATE COMMENT HERE - UPDATE MDX TO HAVE DIRECTION TO USE ONLY OVERLAY ELEMENTS>...CoachmarkOverlayElements will accept only one or more CoachmarkOverlayElement as child components.
|
185
|
+
|
186
|
+
/**
|
187
|
+
* CoachmarkOverlayElements should be used with one or many CoachmarkOverlayElement components as children.
|
188
|
+
* @see CoachmarkOverlayElement
|
189
|
+
*/
|
190
|
+
children: _propTypes.default.node.isRequired,
|
191
|
+
/**
|
192
|
+
* Optional class name for this component.
|
193
|
+
*/
|
194
|
+
className: _propTypes.default.string,
|
195
|
+
/**
|
196
|
+
* The label for the Close button.
|
197
|
+
*/
|
198
|
+
closeButtonLabel: _propTypes.default.string,
|
199
|
+
/**
|
200
|
+
* The visibility of CoachmarkOverlayElements is
|
201
|
+
* managed in the parent component.
|
202
|
+
*/
|
203
|
+
isVisible: _propTypes.default.bool,
|
204
|
+
/**
|
205
|
+
* The object describing an image in one of two shapes.
|
206
|
+
* If a single media element is required, use `{render}`.
|
207
|
+
* If a stepped animation is required, use `{filePaths}`.
|
208
|
+
*/
|
209
|
+
media: _propTypes.default.oneOfType([_propTypes.default.shape({
|
210
|
+
render: _propTypes.default.func
|
211
|
+
}), _propTypes.default.shape({
|
212
|
+
filePaths: _propTypes.default.arrayOf(_propTypes.default.string)
|
213
|
+
})]),
|
214
|
+
/**
|
215
|
+
* The label for the Next button.
|
216
|
+
*/
|
217
|
+
nextButtonText: _propTypes.default.string,
|
218
|
+
/**
|
219
|
+
* The label for the Previous button.
|
220
|
+
*/
|
221
|
+
previousButtonLabel: _propTypes.default.string
|
222
|
+
};
|
@@ -0,0 +1,12 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
Object.defineProperty(exports, "CoachmarkOverlayElements", {
|
7
|
+
enumerable: true,
|
8
|
+
get: function get() {
|
9
|
+
return _CoachmarkOverlayElements.CoachmarkOverlayElements;
|
10
|
+
}
|
11
|
+
});
|
12
|
+
var _CoachmarkOverlayElements = require("./CoachmarkOverlayElements");
|
@@ -0,0 +1,288 @@
|
|
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
|
+
/**
|
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
|
+
// Carbon and package components we use.
|
35
|
+
/* TODO: @import(s) of carbon components and other package components. */ // The block part of our conventional BEM class names (blockClass__E--M).
|
36
|
+
var blockClass = "".concat(_settings.pkg.prefix, "--coachmark-stack");
|
37
|
+
var componentName = 'CoachmarkStack';
|
38
|
+
var elementBlockClass = "".concat(_settings.pkg.prefix, "--coachmark-stack-element");
|
39
|
+
var defaults = {
|
40
|
+
onClose: function onClose() {},
|
41
|
+
// Pass through to CoachmarkStackHome
|
42
|
+
theme: 'light'
|
43
|
+
};
|
44
|
+
|
45
|
+
// NOTE
|
46
|
+
// The stack is limited to a depth of two Coachmarks:
|
47
|
+
// - a single parent CoachmarkStackHome
|
48
|
+
// - a single child Coachmark when stacked
|
49
|
+
// The parent will include links to all the children.
|
50
|
+
// No child Coachmark will include links to any other child Coachmarks.
|
51
|
+
|
52
|
+
/**
|
53
|
+
* Stacked coachmarks are used to call out specific functionality or concepts
|
54
|
+
* within the UI that may not be intuitive but are important for the
|
55
|
+
* user to gain understanding of the product's main value and discover new use cases.
|
56
|
+
* This variant allows the stacking of multiple coachmark overlays to be displayed by interacting with the tagline.
|
57
|
+
*/
|
58
|
+
var CoachmarkStack = exports.CoachmarkStack = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
59
|
+
var _document$querySelect;
|
60
|
+
var children = _ref.children,
|
61
|
+
className = _ref.className,
|
62
|
+
_ref$onClose = _ref.onClose,
|
63
|
+
onClose = _ref$onClose === void 0 ? defaults.onClose : _ref$onClose,
|
64
|
+
description = _ref.description,
|
65
|
+
media = _ref.media,
|
66
|
+
navLinkLabels = _ref.navLinkLabels,
|
67
|
+
_ref$portalTarget = _ref.portalTarget,
|
68
|
+
portalTarget = _ref$portalTarget === void 0 ? defaults.portalTarget : _ref$portalTarget,
|
69
|
+
closeButtonLabel = _ref.closeButtonLabel,
|
70
|
+
tagline = _ref.tagline,
|
71
|
+
_ref$theme = _ref.theme,
|
72
|
+
theme = _ref$theme === void 0 ? defaults.theme : _ref$theme,
|
73
|
+
title = _ref.title,
|
74
|
+
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
75
|
+
var portalNode = portalTarget ? (_document$querySelect = document.querySelector(portalTarget)) !== null && _document$querySelect !== void 0 ? _document$querySelect : document.querySelector('body') : document.querySelector('body');
|
76
|
+
var stackHomeRef = (0, _react.useRef)();
|
77
|
+
var stackedCoachmarkRefs = (0, _react.useRef)([]);
|
78
|
+
var _useState = (0, _react.useState)(false),
|
79
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
80
|
+
isOpen = _useState2[0],
|
81
|
+
setIsOpen = _useState2[1];
|
82
|
+
// selectedItemNumber -1 = parent close button was clicked, remove entire stack
|
83
|
+
// selectedItemNumber 0 = (default) the parent is visible, all children are hidden
|
84
|
+
// selectedItemNumber 1+ = a child is visible and stacked atop the parent
|
85
|
+
var _useState3 = (0, _react.useState)(0),
|
86
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
87
|
+
selectedItemNumber = _useState4[0],
|
88
|
+
setSelectedItemNumber = _useState4[1];
|
89
|
+
// // The parent height and width values to return to after unstacked
|
90
|
+
var _useState5 = (0, _react.useState)(null),
|
91
|
+
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
92
|
+
parentHeight = _useState6[0],
|
93
|
+
setParentHeight = _useState6[1];
|
94
|
+
// parent height = child height when stacked behind a child that is shorter
|
95
|
+
var childArray = _react.Children.toArray(children);
|
96
|
+
var mountedRef = (0, _react.useRef)();
|
97
|
+
// same value as CSS animation speed
|
98
|
+
var delayMs = 240;
|
99
|
+
|
100
|
+
// Unmount or unstack a child
|
101
|
+
var handleClickNavItem = function handleClickNavItem(itemNumber) {
|
102
|
+
setSelectedItemNumber(itemNumber);
|
103
|
+
};
|
104
|
+
var handleClose = (0, _react.useCallback)(function (isParentCloseButton) {
|
105
|
+
if (isParentCloseButton) {
|
106
|
+
// Trigger slide-out animation
|
107
|
+
setSelectedItemNumber(-1);
|
108
|
+
|
109
|
+
// Unmount after animation is complete
|
110
|
+
var timer = setTimeout(function () {
|
111
|
+
setIsOpen(false);
|
112
|
+
onClose();
|
113
|
+
}, delayMs);
|
114
|
+
return function () {
|
115
|
+
return clearTimeout(timer);
|
116
|
+
};
|
117
|
+
} else {
|
118
|
+
// Unstack child
|
119
|
+
setSelectedItemNumber(0);
|
120
|
+
}
|
121
|
+
}, [onClose]);
|
122
|
+
var escFunction = (0, _react.useCallback)(function (event) {
|
123
|
+
if (event.key === 'Escape') {
|
124
|
+
selectedItemNumber === 0 ? handleClose(true) : handleClose(false);
|
125
|
+
}
|
126
|
+
}, [handleClose, selectedItemNumber]);
|
127
|
+
(0, _react.useEffect)(function () {
|
128
|
+
document.addEventListener('keydown', escFunction, false);
|
129
|
+
return function () {
|
130
|
+
document.removeEventListener('keydown', escFunction, false);
|
131
|
+
};
|
132
|
+
}, [escFunction]);
|
133
|
+
var contextValue = {
|
134
|
+
buttonProps: {
|
135
|
+
tabIndex: 0,
|
136
|
+
'aria-expanded': isOpen,
|
137
|
+
onClick: function onClick() {
|
138
|
+
setIsOpen(true);
|
139
|
+
},
|
140
|
+
// Compensate for accidental open/close on double-click.
|
141
|
+
// Only open on double-click.
|
142
|
+
onDoubleClick: function onDoubleClick() {
|
143
|
+
setIsOpen(true);
|
144
|
+
}
|
145
|
+
},
|
146
|
+
closeButtonProps: {
|
147
|
+
onClick: function onClick() {
|
148
|
+
return handleClose(false);
|
149
|
+
}
|
150
|
+
},
|
151
|
+
isOpen: isOpen
|
152
|
+
};
|
153
|
+
(0, _react.useEffect)(function () {
|
154
|
+
mountedRef.current = true;
|
155
|
+
return function () {
|
156
|
+
mountedRef.current = false;
|
157
|
+
};
|
158
|
+
}, []);
|
159
|
+
(0, _react.useEffect)(function () {
|
160
|
+
setTimeout(function () {
|
161
|
+
if (stackHomeRef.current) {
|
162
|
+
setParentHeight(stackHomeRef.current.clientHeight + 16);
|
163
|
+
}
|
164
|
+
}, 0);
|
165
|
+
}, [stackHomeRef]);
|
166
|
+
(0, _react.useEffect)(function () {
|
167
|
+
var targetSelectedItem = selectedItemNumber - 1;
|
168
|
+
if (!parentHeight) {
|
169
|
+
return;
|
170
|
+
}
|
171
|
+
stackHomeRef.current.style.height = "".concat(parentHeight, "px");
|
172
|
+
if (!isOpen || targetSelectedItem < 0) {
|
173
|
+
stackHomeRef.current.focus();
|
174
|
+
return;
|
175
|
+
}
|
176
|
+
var targetHomeHeight = stackedCoachmarkRefs.current[targetSelectedItem].clientHeight;
|
177
|
+
stackHomeRef.current.style.height = "".concat(targetHomeHeight, "px");
|
178
|
+
stackedCoachmarkRefs.current[targetSelectedItem].focus();
|
179
|
+
}, [selectedItemNumber, isOpen, parentHeight]);
|
180
|
+
var wrappedChildren = _react.Children.map(childArray, function (child, idx) {
|
181
|
+
var mountedClass = mountedRef.current ? "".concat(elementBlockClass, "--is-mounted") : '';
|
182
|
+
return /*#__PURE__*/_react.default.createElement(_CoachmarkOverlay.CoachmarkOverlay, {
|
183
|
+
key: idx,
|
184
|
+
ref: function ref(_ref2) {
|
185
|
+
return stackedCoachmarkRefs.current[idx] = _ref2;
|
186
|
+
},
|
187
|
+
kind: _enums.COACHMARK_OVERLAY_KIND.STACKED,
|
188
|
+
onClose: function onClose() {
|
189
|
+
return handleClose(false);
|
190
|
+
},
|
191
|
+
theme: theme,
|
192
|
+
fixedIsVisible: false,
|
193
|
+
className: (0, _classnames.default)(elementBlockClass, mountedClass, idx === selectedItemNumber - 1 && "".concat(elementBlockClass, "--is-visible"), mountedRef.current && "".concat(elementBlockClass, "--is-mounted"))
|
194
|
+
}, child);
|
195
|
+
});
|
196
|
+
return /*#__PURE__*/_react.default.createElement(_context.CoachmarkContext.Provider, {
|
197
|
+
value: contextValue
|
198
|
+
}, /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, rest, {
|
199
|
+
className: (0, _classnames.default)(blockClass, "".concat(_settings.pkg.prefix, "--coachmark-overlay--stack"), className),
|
200
|
+
ref: ref
|
201
|
+
}, (0, _devtools.getDevtoolsProps)(componentName)), /*#__PURE__*/_react.default.createElement(_CoachmarkTagline.CoachmarkTagline, {
|
202
|
+
title: tagline,
|
203
|
+
onClose: onClose
|
204
|
+
}), /*#__PURE__*/_react.default.createElement(_CoachmarkStackHome.CoachmarkStackHome, {
|
205
|
+
ref: stackHomeRef,
|
206
|
+
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")),
|
207
|
+
isOpen: isOpen && selectedItemNumber < 1,
|
208
|
+
description: description,
|
209
|
+
media: media,
|
210
|
+
navLinkLabels: navLinkLabels,
|
211
|
+
onClickNavItem: handleClickNavItem,
|
212
|
+
onClose: function onClose() {
|
213
|
+
handleClose(true);
|
214
|
+
},
|
215
|
+
portalTarget: portalTarget,
|
216
|
+
closeButtonLabel: closeButtonLabel,
|
217
|
+
title: title
|
218
|
+
}), /*#__PURE__*/(0, _reactDom.createPortal)(wrappedChildren, portalNode)));
|
219
|
+
});
|
220
|
+
|
221
|
+
// Return a placeholder if not released and not enabled by feature flag
|
222
|
+
exports.CoachmarkStack = CoachmarkStack = _settings.pkg.checkComponentEnabled(CoachmarkStack, componentName);
|
223
|
+
|
224
|
+
// The display name of the component, used by React. Note that displayName
|
225
|
+
// is used in preference to relying on function.name.
|
226
|
+
CoachmarkStack.displayName = componentName;
|
227
|
+
|
228
|
+
// The types and DocGen commentary for the component props,
|
229
|
+
// in alphabetical order (for consistency).
|
230
|
+
// See https://www.npmjs.com/package/prop-types#usage.
|
231
|
+
CoachmarkStack.propTypes = {
|
232
|
+
/**
|
233
|
+
* CoachmarkStack should use a single CoachmarkOverlayElements component as a child.
|
234
|
+
*/
|
235
|
+
children: _propTypes.default.node.isRequired,
|
236
|
+
/**
|
237
|
+
* Provide an optional class to be applied to the containing node.
|
238
|
+
*/
|
239
|
+
className: _propTypes.default.string,
|
240
|
+
/**
|
241
|
+
* The label for the button that will close the Stack
|
242
|
+
*/
|
243
|
+
closeButtonLabel: _propTypes.default.string,
|
244
|
+
// Pass through to CoachmarkStackHome
|
245
|
+
/**
|
246
|
+
* The description of the Coachmark.
|
247
|
+
*/
|
248
|
+
description: _propTypes.default.node.isRequired,
|
249
|
+
/**
|
250
|
+
* The object describing an image in one of two shapes.
|
251
|
+
*
|
252
|
+
* If a single media element is required, use `{render}`.
|
253
|
+
*
|
254
|
+
* If a stepped animation is required, use `{filePaths}`.
|
255
|
+
*
|
256
|
+
* @see {@link MEDIA_PROP_TYPE}.
|
257
|
+
*/
|
258
|
+
media: _propTypes.default.oneOfType([_propTypes.default.shape({
|
259
|
+
render: _propTypes.default.func
|
260
|
+
}), _propTypes.default.shape({
|
261
|
+
filePaths: _propTypes.default.arrayOf(_propTypes.default.string)
|
262
|
+
})]),
|
263
|
+
/**
|
264
|
+
* The labels used to link to the stackable Coachmarks.
|
265
|
+
*/
|
266
|
+
navLinkLabels: _propTypes.default.arrayOf(_propTypes.default.string).isRequired,
|
267
|
+
/**
|
268
|
+
* Function to call when the CoachmarkStack closes.
|
269
|
+
*/
|
270
|
+
onClose: _propTypes.default.func,
|
271
|
+
/**
|
272
|
+
* Where in the DOM to render the stack.
|
273
|
+
* The default is `document.body`.
|
274
|
+
*/
|
275
|
+
portalTarget: _propTypes.default.string,
|
276
|
+
/**
|
277
|
+
* The tagline title which will be fixed to the bottom right of the window and will serve as the display trigger.
|
278
|
+
*/
|
279
|
+
tagline: _propTypes.default.string.isRequired,
|
280
|
+
/**
|
281
|
+
* Determines the theme of the component.
|
282
|
+
*/
|
283
|
+
theme: _propTypes.default.oneOf(['light', 'dark']),
|
284
|
+
/**
|
285
|
+
* The title of the Coachmark.
|
286
|
+
*/
|
287
|
+
title: _propTypes.default.string.isRequired
|
288
|
+
};
|