@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,81 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.getOffsetTune = void 0;
|
7
|
+
var _enums = require("./enums");
|
8
|
+
/**
|
9
|
+
* If the coachmark's target is a link, button, etc. (i.e. not a beacon),
|
10
|
+
* this adjusts the coachmark's position based on the position and size of the target.
|
11
|
+
* @param {object} coachmark target reference
|
12
|
+
* @param {string} kind type of coachmark
|
13
|
+
* @returns {object} {top:number, left:number}
|
14
|
+
*/
|
15
|
+
|
16
|
+
var getOffsetTune = exports.getOffsetTune = function getOffsetTune(coachmark, kind) {
|
17
|
+
// for future reference
|
18
|
+
// const coachmarkTarget = {
|
19
|
+
// x: coachmark.targetOffset.x,
|
20
|
+
// y: coachmark.targetOffset.y,
|
21
|
+
// width: coachmark.targetRect.width,
|
22
|
+
// height: coachmark.targetRect.height,
|
23
|
+
// };
|
24
|
+
|
25
|
+
var _coachmark$targetRect = coachmark.targetRect,
|
26
|
+
width = _coachmark$targetRect.width,
|
27
|
+
height = _coachmark$targetRect.height;
|
28
|
+
var distanceOffset = 24; // see also _coachmark-overlay.scss > $distance-offset
|
29
|
+
var top = 0;
|
30
|
+
var left = 0;
|
31
|
+
if (kind !== _enums.COACHMARK_OVERLAY_KIND.TOOLTIP) {
|
32
|
+
switch (coachmark.align) {
|
33
|
+
case _enums.COACHMARK_ALIGNMENT.TOP:
|
34
|
+
left = width / 2;
|
35
|
+
break;
|
36
|
+
case _enums.COACHMARK_ALIGNMENT.TOP_LEFT:
|
37
|
+
left = distanceOffset;
|
38
|
+
break;
|
39
|
+
case _enums.COACHMARK_ALIGNMENT.TOP_RIGHT:
|
40
|
+
left = width - distanceOffset;
|
41
|
+
break;
|
42
|
+
case _enums.COACHMARK_ALIGNMENT.BOTTOM:
|
43
|
+
top = height;
|
44
|
+
left = width / 2;
|
45
|
+
break;
|
46
|
+
case _enums.COACHMARK_ALIGNMENT.BOTTOM_LEFT:
|
47
|
+
top = height;
|
48
|
+
left = distanceOffset;
|
49
|
+
break;
|
50
|
+
case _enums.COACHMARK_ALIGNMENT.BOTTOM_RIGHT:
|
51
|
+
top = height;
|
52
|
+
left = width - distanceOffset;
|
53
|
+
break;
|
54
|
+
case _enums.COACHMARK_ALIGNMENT.LEFT:
|
55
|
+
top = height / 2;
|
56
|
+
break;
|
57
|
+
case _enums.COACHMARK_ALIGNMENT.LEFT_TOP:
|
58
|
+
top = distanceOffset;
|
59
|
+
break;
|
60
|
+
case _enums.COACHMARK_ALIGNMENT.LEFT_BOTTOM:
|
61
|
+
top = height - distanceOffset;
|
62
|
+
break;
|
63
|
+
case _enums.COACHMARK_ALIGNMENT.RIGHT:
|
64
|
+
top = height / 2;
|
65
|
+
left = width;
|
66
|
+
break;
|
67
|
+
case _enums.COACHMARK_ALIGNMENT.RIGHT_TOP:
|
68
|
+
top = distanceOffset;
|
69
|
+
left = width;
|
70
|
+
break;
|
71
|
+
case _enums.COACHMARK_ALIGNMENT.RIGHT_BOTTOM:
|
72
|
+
top = height - distanceOffset;
|
73
|
+
left = width;
|
74
|
+
break;
|
75
|
+
}
|
76
|
+
}
|
77
|
+
return {
|
78
|
+
top: top,
|
79
|
+
left: left
|
80
|
+
};
|
81
|
+
};
|
@@ -0,0 +1,11 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.useCoachmark = exports.CoachmarkContext = void 0;
|
7
|
+
var _react = require("react");
|
8
|
+
var CoachmarkContext = exports.CoachmarkContext = /*#__PURE__*/(0, _react.createContext)();
|
9
|
+
var useCoachmark = exports.useCoachmark = function useCoachmark() {
|
10
|
+
return (0, _react.useContext)(CoachmarkContext);
|
11
|
+
};
|
@@ -0,0 +1,46 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.COACHMARK_OVERLAY_KIND = exports.COACHMARK_ALIGNMENT = exports.BEACON_KIND = void 0;
|
7
|
+
/* eslint-disable max-len */
|
8
|
+
|
9
|
+
/**
|
10
|
+
* Reserved for future expansion, i.e. "RING".
|
11
|
+
*/
|
12
|
+
var BEACON_KIND = exports.BEACON_KIND = {
|
13
|
+
DEFAULT: 'default'
|
14
|
+
};
|
15
|
+
|
16
|
+
/**
|
17
|
+
* Describes the style and behavior of a Coachmark.
|
18
|
+
* @param TOOLTIP includes a caret pointing to the animated beacon.
|
19
|
+
* @param FLOATING includes a drag handle across the top.
|
20
|
+
* @param FIXED is fixed to the bottom-right of the viewport.
|
21
|
+
* @param STACKED is fixed to the bottom-right of the viewport, includes links to show more, stackable Coachmarks if included.
|
22
|
+
*/
|
23
|
+
var COACHMARK_OVERLAY_KIND = exports.COACHMARK_OVERLAY_KIND = {
|
24
|
+
TOOLTIP: 'tooltip',
|
25
|
+
FLOATING: 'floating',
|
26
|
+
FIXED: 'fixed',
|
27
|
+
STACKED: 'stacked'
|
28
|
+
};
|
29
|
+
/**
|
30
|
+
* Where to render the Coachmark relative to its target.
|
31
|
+
* Applies only to Floating and Tooltip Coachmarks.
|
32
|
+
*/
|
33
|
+
var COACHMARK_ALIGNMENT = exports.COACHMARK_ALIGNMENT = {
|
34
|
+
BOTTOM: 'bottom',
|
35
|
+
BOTTOM_LEFT: 'bottom-left',
|
36
|
+
BOTTOM_RIGHT: 'bottom-right',
|
37
|
+
LEFT: 'left',
|
38
|
+
LEFT_TOP: 'left-top',
|
39
|
+
LEFT_BOTTOM: 'left-bottom',
|
40
|
+
RIGHT: 'right',
|
41
|
+
RIGHT_TOP: 'right-top',
|
42
|
+
RIGHT_BOTTOM: 'right-bottom',
|
43
|
+
TOP: 'top',
|
44
|
+
TOP_LEFT: 'top-left',
|
45
|
+
TOP_RIGHT: 'top-right'
|
46
|
+
};
|
@@ -0,0 +1,17 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.clamp = clamp;
|
7
|
+
/* eslint-disable max-len */
|
8
|
+
|
9
|
+
/**
|
10
|
+
* Clamp the given value between the upper bound `max` and the lower bound `min`
|
11
|
+
* @param {number} max
|
12
|
+
* @param {number} min
|
13
|
+
* @param {number} value
|
14
|
+
*/
|
15
|
+
function clamp(max, min, value) {
|
16
|
+
return Math.min(max, Math.max(min, value));
|
17
|
+
}
|
@@ -0,0 +1,59 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.useClickOutsideElement = useClickOutsideElement;
|
7
|
+
exports.useWindowEvent = void 0;
|
8
|
+
var _react = require("react");
|
9
|
+
var _enums = require("./enums");
|
10
|
+
/**
|
11
|
+
* Detects when a user clicks outside of the element
|
12
|
+
* @param {object} coachmarkRef - The ref to the React element for the Coachmark to detect when the user clicks outside of its bounds.
|
13
|
+
* @param {object} overlayRef - The ref to the React element for the CoachmarkOverlay to detect when the user clicks outside of its bounds.
|
14
|
+
* @param {string} overlayKind - The overlayKind prop from the Coachmark. @see COACHMARK_OVERLAY_KIND
|
15
|
+
* @param {Function} callback The callback to call when the user mouses down.
|
16
|
+
*/
|
17
|
+
|
18
|
+
function useClickOutsideElement(coachmarkRef, overlayRef, overlayKind, callback) {
|
19
|
+
var cb = (0, _react.useRef)();
|
20
|
+
var isTooltip = overlayKind === _enums.COACHMARK_OVERLAY_KIND.TOOLTIP;
|
21
|
+
(0, _react.useLayoutEffect)(function () {
|
22
|
+
cb.current = callback;
|
23
|
+
}, [callback]);
|
24
|
+
(0, _react.useEffect)(function () {
|
25
|
+
function handleClickOutside(event) {
|
26
|
+
var isOverlayOutside = overlayRef.current && !overlayRef.current.contains(event.target);
|
27
|
+
var isOutsideCoachmark = coachmarkRef.current && !coachmarkRef.current.contains(event.target);
|
28
|
+
if (isOverlayOutside && isOutsideCoachmark) {
|
29
|
+
callCallback();
|
30
|
+
}
|
31
|
+
}
|
32
|
+
function callCallback() {
|
33
|
+
if (isTooltip) {
|
34
|
+
cb.current();
|
35
|
+
}
|
36
|
+
}
|
37
|
+
document.addEventListener('mousedown', handleClickOutside);
|
38
|
+
return function () {
|
39
|
+
document.removeEventListener('mousedown', handleClickOutside);
|
40
|
+
};
|
41
|
+
}, [coachmarkRef, overlayRef, isTooltip]);
|
42
|
+
}
|
43
|
+
var useWindowEvent = exports.useWindowEvent = function useWindowEvent(eventName, callback) {
|
44
|
+
var savedCallback = (0, _react.useRef)(null);
|
45
|
+
(0, _react.useEffect)(function () {
|
46
|
+
savedCallback.current = callback;
|
47
|
+
});
|
48
|
+
(0, _react.useEffect)(function () {
|
49
|
+
function handler(event) {
|
50
|
+
if (savedCallback.current) {
|
51
|
+
savedCallback.current(event);
|
52
|
+
}
|
53
|
+
}
|
54
|
+
window.addEventListener(eventName, handler);
|
55
|
+
return function () {
|
56
|
+
window.removeEventListener(eventName, handler);
|
57
|
+
};
|
58
|
+
}, [eventName]);
|
59
|
+
};
|
@@ -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");
|