@carbon/ibm-products 2.64.0 → 2.65.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/css/index-full-carbon.css +59 -143
- 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 +8 -0
- 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 +59 -143
- 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 +59 -143
- 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/Checklist/Checklist.js +8 -7
- package/es/components/CoachmarkStack/CoachmarkStack.d.ts +5 -0
- package/es/components/CoachmarkStack/CoachmarkStack.js +9 -3
- package/es/components/CoachmarkStack/CoachmarkStackHome.d.ts +5 -0
- package/es/components/CoachmarkStack/CoachmarkStackHome.js +39 -6
- package/es/components/CreateFullPage/CreateFullPage.d.ts +1 -1
- package/es/components/CreateFullPage/CreateFullPage.js +23 -18
- package/es/components/Datagrid/Datagrid/DraggableElement.d.ts +3 -1
- package/es/components/Datagrid/Datagrid/DraggableElement.js +3 -1
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/DraggableItemsList.js +3 -0
- package/es/components/InlineTip/InlineTip.js +3 -3
- package/es/components/InterstitialScreen/InterstitialScreen.d.ts +36 -59
- package/es/components/InterstitialScreen/InterstitialScreen.js +75 -271
- package/es/components/InterstitialScreen/InterstitialScreenBody.d.ts +27 -0
- package/es/components/InterstitialScreen/InterstitialScreenBody.js +110 -0
- package/es/components/InterstitialScreen/InterstitialScreenFooter.d.ts +47 -0
- package/es/components/InterstitialScreen/InterstitialScreenFooter.js +184 -0
- package/es/components/InterstitialScreen/InterstitialScreenHeader.d.ts +35 -0
- package/es/components/InterstitialScreen/InterstitialScreenHeader.js +90 -0
- package/es/components/{InterstitialScreenView → InterstitialScreen/_story-assets/InterstitialScreenView}/InterstitialScreenView.d.ts +1 -0
- package/{lib/components → es/components/InterstitialScreen/_story-assets}/InterstitialScreenViewModule/InterstitialScreenViewModule.d.ts +8 -0
- package/es/components/NotificationsPanel/NotificationsPanel.js +15 -10
- package/es/components/PageHeader/PageHeader.js +1 -1
- package/es/components/SidePanel/SidePanel.js +3 -2
- package/es/components/Tearsheet/Tearsheet.js +3 -2
- package/es/components/index.d.ts +0 -2
- package/es/global/js/hooks/useOverflowItems/useOverflowItems.d.ts +2 -2
- package/es/global/js/package-settings.d.ts +0 -2
- package/es/global/js/package-settings.js +0 -2
- package/es/index.js +0 -2
- package/es/settings.d.ts +0 -2
- package/lib/components/Checklist/Checklist.js +7 -6
- package/lib/components/CoachmarkStack/CoachmarkStack.d.ts +5 -0
- package/lib/components/CoachmarkStack/CoachmarkStack.js +9 -3
- package/lib/components/CoachmarkStack/CoachmarkStackHome.d.ts +5 -0
- package/lib/components/CoachmarkStack/CoachmarkStackHome.js +37 -4
- package/lib/components/CreateFullPage/CreateFullPage.d.ts +1 -1
- package/lib/components/CreateFullPage/CreateFullPage.js +22 -17
- package/lib/components/Datagrid/Datagrid/DraggableElement.d.ts +3 -1
- package/lib/components/Datagrid/Datagrid/DraggableElement.js +3 -1
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/DraggableItemsList.js +3 -0
- package/lib/components/InlineTip/InlineTip.js +2 -2
- package/lib/components/InterstitialScreen/InterstitialScreen.d.ts +36 -59
- package/lib/components/InterstitialScreen/InterstitialScreen.js +73 -267
- package/lib/components/InterstitialScreen/InterstitialScreenBody.d.ts +27 -0
- package/lib/components/InterstitialScreen/InterstitialScreenBody.js +114 -0
- package/lib/components/InterstitialScreen/InterstitialScreenFooter.d.ts +47 -0
- package/lib/components/InterstitialScreen/InterstitialScreenFooter.js +188 -0
- package/lib/components/InterstitialScreen/InterstitialScreenHeader.d.ts +35 -0
- package/lib/components/InterstitialScreen/InterstitialScreenHeader.js +94 -0
- package/lib/components/{InterstitialScreenView → InterstitialScreen/_story-assets/InterstitialScreenView}/InterstitialScreenView.d.ts +1 -0
- package/{es/components → lib/components/InterstitialScreen/_story-assets}/InterstitialScreenViewModule/InterstitialScreenViewModule.d.ts +8 -0
- package/lib/components/NotificationsPanel/NotificationsPanel.js +14 -9
- package/lib/components/PageHeader/PageHeader.js +1 -1
- package/lib/components/SidePanel/SidePanel.js +3 -2
- package/lib/components/Tearsheet/Tearsheet.js +3 -2
- package/lib/components/index.d.ts +0 -2
- package/lib/global/js/hooks/useOverflowItems/useOverflowItems.d.ts +2 -2
- package/lib/global/js/package-settings.d.ts +0 -2
- package/lib/global/js/package-settings.js +0 -2
- package/lib/index.js +0 -10
- package/lib/settings.d.ts +0 -2
- package/package.json +7 -7
- package/scss/components/Coachmark/_coachmark-overlay.scss +2 -0
- package/scss/components/CoachmarkOverlayElements/_coachmark-overlay-elements.scss +1 -0
- package/scss/components/CoachmarkStack/_coachmark-stack.scss +25 -0
- package/scss/components/InterstitialScreen/_interstitial-screen.scss +29 -137
- package/scss/components/NotificationsPanel/_notifications-panel.scss +2 -0
- package/scss/components/PageHeader/_page-header.scss +5 -0
- package/scss/components/_index-with-carbon.scss +0 -2
- package/scss/components/_index.scss +0 -2
- package/telemetry.yml +17 -8
- package/es/components/InterstitialScreenView/InterstitialScreenView.js +0 -78
- package/es/components/InterstitialScreenView/index.d.ts +0 -8
- package/es/components/InterstitialScreenViewModule/InterstitialScreenViewModule.js +0 -81
- package/es/components/InterstitialScreenViewModule/index.d.ts +0 -8
- package/lib/components/InterstitialScreenView/InterstitialScreenView.js +0 -78
- package/lib/components/InterstitialScreenView/index.d.ts +0 -8
- package/lib/components/InterstitialScreenViewModule/InterstitialScreenViewModule.js +0 -81
- package/lib/components/InterstitialScreenViewModule/index.d.ts +0 -8
- package/scss/components/InterstitialScreenView/_carbon-imports.scss +0 -9
- package/scss/components/InterstitialScreenView/_index-with-carbon.scss +0 -9
- package/scss/components/InterstitialScreenView/_index.scss +0 -8
- package/scss/components/InterstitialScreenView/_interstitial-screen-view.scss +0 -25
- package/scss/components/InterstitialScreenViewModule/_carbon-imports.scss +0 -9
- package/scss/components/InterstitialScreenViewModule/_index-with-carbon.scss +0 -9
- package/scss/components/InterstitialScreenViewModule/_index.scss +0 -8
- package/scss/components/InterstitialScreenViewModule/_interstitial-screen-view-module.scss +0 -59
@@ -5,24 +5,21 @@
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*/
|
7
7
|
|
8
|
-
import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, extends as _extends
|
9
|
-
import {
|
10
|
-
import React__default, { useRef, useState,
|
11
|
-
import { ArrowRight } from '@carbon/react/icons';
|
12
|
-
import { Carousel } from '../Carousel/Carousel.js';
|
13
|
-
import '../Carousel/CarouselItem.js';
|
8
|
+
import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
9
|
+
import { ComposedModal } from '@carbon/react';
|
10
|
+
import React__default, { createContext, useRef, useState, useCallback, useEffect } from 'react';
|
14
11
|
import PropTypes from '../../_virtual/index.js';
|
15
12
|
import cx from 'classnames';
|
16
|
-
import { clamp } from '../../global/js/utils/clamp.js';
|
17
13
|
import { getDevtoolsProps } from '../../global/js/utils/devtools.js';
|
18
14
|
import { pkg } from '../../settings.js';
|
15
|
+
import InterstitialScreenHeader from './InterstitialScreenHeader.js';
|
16
|
+
import InterstitialScreenBody from './InterstitialScreenBody.js';
|
17
|
+
import InterstitialScreenFooter from './InterstitialScreenFooter.js';
|
19
18
|
|
20
|
-
var _excluded = ["children", "className", "
|
19
|
+
var _excluded = ["children", "className", "interstitialAriaLabel", "isFullScreen", "isOpen", "onClose"];
|
21
20
|
|
22
21
|
// The block part of our conventional BEM class names (blockClass__E--M).
|
23
22
|
var blockClass = "".concat(pkg.prefix, "--interstitial-screen");
|
24
|
-
var headerBlockClass = "".concat(blockClass, "--internal-header");
|
25
|
-
var bodyBlockClass = "".concat(blockClass, "--internal-body");
|
26
23
|
var componentName = 'InterstitialScreen';
|
27
24
|
|
28
25
|
// NOTE: the component SCSS is not imported here: it is rolled up separately.
|
@@ -36,21 +33,12 @@ var componentName = 'InterstitialScreen';
|
|
36
33
|
// Default values should be provided when the component needs to make a choice
|
37
34
|
// or assumption when a prop is not supplied.
|
38
35
|
|
39
|
-
//
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
isFullScreen: false,
|
46
|
-
isOpen: false,
|
47
|
-
nextButtonLabel: 'Next',
|
48
|
-
onClose: function onClose() {},
|
49
|
-
previousButtonLabel: 'Back',
|
50
|
-
productName: '',
|
51
|
-
skipButtonLabel: '',
|
52
|
-
startButtonLabel: 'Get started'
|
53
|
-
};
|
36
|
+
// Define the type for InterstitialScreen, extending it to include Header
|
37
|
+
|
38
|
+
var InterstitialScreenContext = /*#__PURE__*/createContext({
|
39
|
+
progStep: 0,
|
40
|
+
stepCount: 0
|
41
|
+
});
|
54
42
|
/**
|
55
43
|
* InterstitialScreen can be a full page or an overlay, and are
|
56
44
|
* shown on the first time a user accesses a new experience
|
@@ -58,37 +46,15 @@ var defaults = {
|
|
58
46
|
* newly purchased capability is presented).
|
59
47
|
*/
|
60
48
|
var InterstitialScreen = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
61
|
-
var _h, _strong, _h2;
|
62
49
|
var children = props.children,
|
63
50
|
className = props.className,
|
64
|
-
_props$closeIconDescr = props.closeIconDescription,
|
65
|
-
closeIconDescription = _props$closeIconDescr === void 0 ? defaults.closeIconDescription : _props$closeIconDescr,
|
66
|
-
_props$domainName = props.domainName,
|
67
|
-
domainName = _props$domainName === void 0 ? defaults.domainName : _props$domainName,
|
68
|
-
_props$hideProgressIn = props.hideProgressIndicator,
|
69
|
-
hideProgressIndicator = _props$hideProgressIn === void 0 ? defaults.hideProgressIndicator : _props$hideProgressIn,
|
70
51
|
_props$interstitialAr = props.interstitialAriaLabel,
|
71
|
-
interstitialAriaLabel = _props$interstitialAr === void 0 ?
|
52
|
+
interstitialAriaLabel = _props$interstitialAr === void 0 ? 'Interstitial screen' : _props$interstitialAr,
|
72
53
|
_props$isFullScreen = props.isFullScreen,
|
73
|
-
isFullScreen = _props$isFullScreen === void 0 ?
|
54
|
+
isFullScreen = _props$isFullScreen === void 0 ? false : _props$isFullScreen,
|
74
55
|
_props$isOpen = props.isOpen,
|
75
|
-
isOpen = _props$isOpen === void 0 ?
|
76
|
-
|
77
|
-
breakpointsWithMedia = props.breakpointsWithMedia,
|
78
|
-
_props$nextButtonLabe = props.nextButtonLabel,
|
79
|
-
nextButtonLabel = _props$nextButtonLabe === void 0 ? defaults.nextButtonLabel : _props$nextButtonLabe,
|
80
|
-
_props$onClose = props.onClose,
|
81
|
-
onClose = _props$onClose === void 0 ? defaults.onClose : _props$onClose,
|
82
|
-
_props$previousButton = props.previousButtonLabel,
|
83
|
-
previousButtonLabel = _props$previousButton === void 0 ? defaults.previousButtonLabel : _props$previousButton,
|
84
|
-
_props$productName = props.productName,
|
85
|
-
productName = _props$productName === void 0 ? defaults.productName : _props$productName,
|
86
|
-
headerClassName = props.headerClassName,
|
87
|
-
headerTitle = props.headerTitle,
|
88
|
-
_props$startButtonLab = props.startButtonLabel,
|
89
|
-
startButtonLabel = _props$startButtonLab === void 0 ? defaults.startButtonLabel : _props$startButtonLab,
|
90
|
-
_props$skipButtonLabe = props.skipButtonLabel,
|
91
|
-
skipButtonLabel = _props$skipButtonLabe === void 0 ? defaults.skipButtonLabel : _props$skipButtonLabe,
|
56
|
+
isOpen = _props$isOpen === void 0 ? false : _props$isOpen,
|
57
|
+
onClose = props.onClose,
|
92
58
|
rest = _objectWithoutProperties(props, _excluded);
|
93
59
|
var backupRef = useRef(null);
|
94
60
|
var _forwardedRef = ref || backupRef;
|
@@ -103,47 +69,29 @@ var InterstitialScreen = /*#__PURE__*/React__default.forwardRef(function (props,
|
|
103
69
|
_useState4 = _slicedToArray(_useState3, 2),
|
104
70
|
progStep = _useState4[0],
|
105
71
|
setProgStep = _useState4[1];
|
106
|
-
var childArray = Children.toArray(children);
|
107
|
-
var isMultiStep = childArray.length > 1;
|
108
72
|
var bodyScrollRef = useRef(null);
|
109
|
-
var
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
73
|
+
var _useState5 = useState(0),
|
74
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
75
|
+
stepCount = _useState6[0],
|
76
|
+
setStepCount = _useState6[1];
|
77
|
+
var _useState7 = useState({
|
78
|
+
skip: false,
|
79
|
+
back: false,
|
80
|
+
next: false,
|
81
|
+
start: false
|
82
|
+
}),
|
83
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
84
|
+
disableButtonConfig = _useState8[0],
|
85
|
+
setDisableButtonConfig = _useState8[1];
|
121
86
|
var variantClass = isFullScreen ? "".concat(blockClass, "--full-screen") : "".concat(blockClass, "--modal");
|
122
|
-
var
|
123
|
-
|
124
|
-
|
87
|
+
var _useState9 = useState(null),
|
88
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
89
|
+
bodyChildrenData = _useState10[0],
|
90
|
+
setBodyChildrenData = _useState10[1];
|
91
|
+
var handleClose = useCallback(function (actionName) {
|
125
92
|
setProgStep(0);
|
126
|
-
onClose();
|
93
|
+
onClose === null || onClose === void 0 || onClose(actionName !== null && actionName !== void 0 ? actionName : 'close');
|
127
94
|
}, [onClose]);
|
128
|
-
var scrollBodyToTop = function scrollBodyToTop() {
|
129
|
-
var _bodyScrollRef$curren, _bodyScrollRef$curren2;
|
130
|
-
(_bodyScrollRef$curren = bodyScrollRef.current) === null || _bodyScrollRef$curren === void 0 || (_bodyScrollRef$curren2 = _bodyScrollRef$curren.scroll) === null || _bodyScrollRef$curren2 === void 0 || _bodyScrollRef$curren2.call(_bodyScrollRef$curren, {
|
131
|
-
top: 0,
|
132
|
-
behavior: 'smooth'
|
133
|
-
});
|
134
|
-
};
|
135
|
-
var handleClickPrev = function handleClickPrev() {
|
136
|
-
var targetStep = clamp(progStep - 1, progStepFloor, progStepCeil);
|
137
|
-
scrollRef.current.scrollPrev();
|
138
|
-
scrollBodyToTop();
|
139
|
-
setProgStep(targetStep);
|
140
|
-
};
|
141
|
-
var handleClickNext = function handleClickNext() {
|
142
|
-
var targetStep = clamp(progStep + 1, progStepFloor, progStepCeil);
|
143
|
-
scrollRef.current.scrollNext();
|
144
|
-
scrollBodyToTop();
|
145
|
-
setProgStep(targetStep);
|
146
|
-
};
|
147
95
|
useEffect(function () {
|
148
96
|
var _startButtonRef$curre;
|
149
97
|
if (!isOpen) {
|
@@ -163,7 +111,7 @@ var InterstitialScreen = /*#__PURE__*/React__default.forwardRef(function (props,
|
|
163
111
|
var close = function close(e) {
|
164
112
|
var key = e.key;
|
165
113
|
if (key === 'Escape') {
|
166
|
-
handleClose();
|
114
|
+
handleClose('close');
|
167
115
|
}
|
168
116
|
};
|
169
117
|
window.addEventListener('keydown', close);
|
@@ -171,14 +119,10 @@ var InterstitialScreen = /*#__PURE__*/React__default.forwardRef(function (props,
|
|
171
119
|
return window.removeEventListener('keydown', close);
|
172
120
|
};
|
173
121
|
}, [handleClose]);
|
174
|
-
var stepSize = useMemo(function () {
|
175
|
-
return children && Children.count(children) > 1 ? parseFloat((1 / (Children.count(children) - 1)).toFixed(2)) : 0;
|
176
|
-
}, [children]);
|
177
122
|
if (!isOpen) {
|
178
123
|
return null;
|
179
124
|
}
|
180
|
-
var
|
181
|
-
var renderModal = function renderModal(childElements) {
|
125
|
+
var renderModal = function renderModal() {
|
182
126
|
return /*#__PURE__*/React__default.createElement(ComposedModal, _extends({}, rest, {
|
183
127
|
preventCloseOnClickOutside: true,
|
184
128
|
className: cx(blockClass,
|
@@ -190,27 +134,9 @@ var InterstitialScreen = /*#__PURE__*/React__default.forwardRef(function (props,
|
|
190
134
|
open: isOpen,
|
191
135
|
ref: _forwardedRef,
|
192
136
|
"aria-label": interstitialAriaLabel
|
193
|
-
}, getDevtoolsProps(componentName)),
|
194
|
-
className: cx(headerBlockClass, headerTitle && "".concat(headerBlockClass, "--has-title"), headerClassName),
|
195
|
-
iconDescription: closeIconDescription
|
196
|
-
}, headerTitle && (_h || (_h = /*#__PURE__*/React__default.createElement("h2", null, headerTitle))), !hideProgressIndicator && /*#__PURE__*/React__default.createElement("div", {
|
197
|
-
className: "".concat(blockClass, "--progress")
|
198
|
-
}, /*#__PURE__*/React__default.createElement(ProgressIndicator, {
|
199
|
-
vertical: false,
|
200
|
-
currentIndex: progStep
|
201
|
-
}, childArray.map(function (child, idx) {
|
202
|
-
if (/*#__PURE__*/isValidElement(child)) {
|
203
|
-
return /*#__PURE__*/React__default.createElement(ProgressStep, {
|
204
|
-
key: idx,
|
205
|
-
label: child.props.stepTitle || '',
|
206
|
-
translateWithId: child.props.translateWithId
|
207
|
-
});
|
208
|
-
}
|
209
|
-
})))), /*#__PURE__*/React__default.createElement(ModalBody, {
|
210
|
-
className: bodyBlockClass
|
211
|
-
}, childElements), /*#__PURE__*/React__default.createElement(ModalFooter, null, renderFooter()));
|
137
|
+
}, getDevtoolsProps(componentName)), children);
|
212
138
|
};
|
213
|
-
var renderFullScreen = function renderFullScreen(
|
139
|
+
var renderFullScreen = function renderFullScreen() {
|
214
140
|
return /*#__PURE__*/React__default.createElement("div", _extends({}, rest, {
|
215
141
|
className: cx(blockClass,
|
216
142
|
// Apply the block class to the main HTML element
|
@@ -221,117 +147,42 @@ var InterstitialScreen = /*#__PURE__*/React__default.forwardRef(function (props,
|
|
221
147
|
"aria-label": interstitialAriaLabel,
|
222
148
|
ref: ref
|
223
149
|
}, getDevtoolsProps(componentName)), /*#__PURE__*/React__default.createElement("div", {
|
224
|
-
className:
|
225
|
-
},
|
226
|
-
className: "".concat(blockClass, "--header")
|
227
|
-
}, domainName, domainProductDelimiter, _strong || (_strong = /*#__PURE__*/React__default.createElement("strong", null, productName))), /*#__PURE__*/React__default.createElement("header", {
|
228
|
-
className: cx(headerBlockClass, headerTitle && "".concat(headerBlockClass, "--has-title"), headerClassName)
|
229
|
-
}, headerTitle && (_h2 || (_h2 = /*#__PURE__*/React__default.createElement("h2", null, headerTitle))), !hideProgressIndicator && /*#__PURE__*/React__default.createElement("div", {
|
230
|
-
className: "".concat(blockClass, "--progress")
|
231
|
-
}, /*#__PURE__*/React__default.createElement(ProgressIndicator, {
|
232
|
-
vertical: false,
|
233
|
-
currentIndex: progStep
|
234
|
-
}, childArray.map(function (child, idx) {
|
235
|
-
if (/*#__PURE__*/isValidElement(child)) {
|
236
|
-
return /*#__PURE__*/React__default.createElement(ProgressStep, {
|
237
|
-
key: idx,
|
238
|
-
label: child.props.stepTitle || '',
|
239
|
-
translateWithId: child.props.translateWithId
|
240
|
-
});
|
241
|
-
}
|
242
|
-
})))), childElements, renderFooter()));
|
243
|
-
};
|
244
|
-
var scrollToCurrentStep = function scrollToCurrentStep(scrollPercent) {
|
245
|
-
var currentStep = scrollPercent / stepSize;
|
246
|
-
setProgStep(Math.ceil(currentStep));
|
150
|
+
className: "".concat(blockClass, "--container")
|
151
|
+
}, children));
|
247
152
|
};
|
248
|
-
var
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
tabIndex: 0
|
253
|
-
}, renderMedia ? /*#__PURE__*/React__default.createElement(FlexGrid, {
|
254
|
-
fullWidth: true,
|
255
|
-
className: cx("".concat(blockClass, "--body-grid"))
|
256
|
-
}, /*#__PURE__*/React__default.createElement(Row, {
|
257
|
-
className: cx("".concat(blockClass, "--body-row"))
|
258
|
-
}, /*#__PURE__*/React__default.createElement(Column, {
|
259
|
-
xlg: contentBreakpoints.xlg,
|
260
|
-
lg: contentBreakpoints.lg,
|
261
|
-
md: contentBreakpoints.md,
|
262
|
-
sm: contentBreakpoints.sm
|
263
|
-
}, /*#__PURE__*/React__default.createElement("div", {
|
264
|
-
className: cx("".concat(blockClass, "--content"))
|
265
|
-
}, isMultiStep ? /*#__PURE__*/React__default.createElement("div", {
|
266
|
-
className: "".concat(blockClass, "__carousel")
|
267
|
-
}, /*#__PURE__*/React__default.createElement(Carousel, {
|
268
|
-
disableArrowScroll: true,
|
269
|
-
ref: scrollRef,
|
270
|
-
onScroll: scrollToCurrentStep
|
271
|
-
}, children)) : childArray[0])), renderMedia && /*#__PURE__*/React__default.createElement(Column, {
|
272
|
-
xlg: mediaBreakpoints.xlg,
|
273
|
-
lg: mediaBreakpoints.lg,
|
274
|
-
md: mediaBreakpoints.md,
|
275
|
-
sm: mediaBreakpoints.sm,
|
276
|
-
className: cx("".concat(blockClass, "--media-container"))
|
277
|
-
}, /*#__PURE__*/React__default.createElement("div", {
|
278
|
-
className: "".concat(blockClass, "--media")
|
279
|
-
}, renderMedia && /*#__PURE__*/React__default.createElement("div", {
|
280
|
-
className: "".concat(blockClass, "--stepped-animated-media")
|
281
|
-
}, renderMedia({
|
282
|
-
playStep: progStep
|
283
|
-
})))))) : /*#__PURE__*/React__default.createElement("div", {
|
284
|
-
className: cx("".concat(blockClass, "--content"))
|
285
|
-
}, isMultiStep ? /*#__PURE__*/React__default.createElement("div", {
|
286
|
-
className: "".concat(blockClass, "__carousel")
|
287
|
-
}, /*#__PURE__*/React__default.createElement(Carousel, {
|
288
|
-
disableArrowScroll: true,
|
289
|
-
ref: scrollRef,
|
290
|
-
onScroll: scrollToCurrentStep
|
291
|
-
}, children)) : /*#__PURE__*/React__default.createElement("div", null, childArray[0])));
|
153
|
+
var handleGotoStep = function handleGotoStep(targetStep) {
|
154
|
+
setProgStep(targetStep);
|
155
|
+
scrollRef.current.scrollToView(targetStep);
|
156
|
+
scrollBodyToTop();
|
292
157
|
};
|
293
|
-
var
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
size: "lg",
|
300
|
-
title: skipButtonLabel,
|
301
|
-
onClick: handleClose
|
302
|
-
}, skipButtonLabel), /*#__PURE__*/React__default.createElement("div", {
|
303
|
-
className: "".concat(blockClass, "--footer-controls")
|
304
|
-
}, isMultiStep && progStep > 0 && /*#__PURE__*/React__default.createElement(Button, {
|
305
|
-
className: "".concat(blockClass, "--prev-btn"),
|
306
|
-
kind: "secondary",
|
307
|
-
size: "lg",
|
308
|
-
title: previousButtonLabel,
|
309
|
-
onClick: handleClickPrev
|
310
|
-
}, previousButtonLabel), isMultiStep && progStep < progStepCeil && /*#__PURE__*/React__default.createElement(Button, {
|
311
|
-
className: "".concat(blockClass, "--next-btn"),
|
312
|
-
renderIcon: ArrowRight,
|
313
|
-
ref: nextButtonRef,
|
314
|
-
size: "lg",
|
315
|
-
title: nextButtonLabel,
|
316
|
-
onClick: handleClickNext
|
317
|
-
}, nextButtonLabel), isMultiStep && progStep === progStepCeil && /*#__PURE__*/React__default.createElement(Button, {
|
318
|
-
className: "".concat(blockClass, "--start-btn"),
|
319
|
-
ref: startButtonRef,
|
320
|
-
renderIcon: ArrowRight,
|
321
|
-
size: "lg",
|
322
|
-
title: startButtonLabel,
|
323
|
-
onClick: handleClose
|
324
|
-
}, startButtonLabel), !isMultiStep && /*#__PURE__*/React__default.createElement(Button, {
|
325
|
-
className: "".concat(blockClass, "--start-btn"),
|
326
|
-
ref: startButtonRef,
|
327
|
-
size: "lg",
|
328
|
-
title: startButtonLabel,
|
329
|
-
onClick: handleClose
|
330
|
-
}, startButtonLabel)));
|
158
|
+
var scrollBodyToTop = function scrollBodyToTop() {
|
159
|
+
var _bodyScrollRef$curren, _bodyScrollRef$curren2;
|
160
|
+
(_bodyScrollRef$curren = bodyScrollRef.current) === null || _bodyScrollRef$curren === void 0 || (_bodyScrollRef$curren2 = _bodyScrollRef$curren.scroll) === null || _bodyScrollRef$curren2 === void 0 || _bodyScrollRef$curren2.call(_bodyScrollRef$curren, {
|
161
|
+
top: 0,
|
162
|
+
behavior: 'smooth'
|
163
|
+
});
|
331
164
|
};
|
332
|
-
return
|
165
|
+
return /*#__PURE__*/React__default.createElement(InterstitialScreenContext.Provider, {
|
166
|
+
value: {
|
167
|
+
bodyChildrenData: bodyChildrenData,
|
168
|
+
setBodyChildrenData: setBodyChildrenData,
|
169
|
+
isFullScreen: isFullScreen,
|
170
|
+
handleClose: handleClose,
|
171
|
+
progStep: progStep,
|
172
|
+
setProgStep: setProgStep,
|
173
|
+
bodyScrollRef: bodyScrollRef,
|
174
|
+
scrollRef: scrollRef,
|
175
|
+
handleGotoStep: handleGotoStep,
|
176
|
+
stepCount: stepCount,
|
177
|
+
setStepCount: setStepCount,
|
178
|
+
disableButtonConfig: disableButtonConfig,
|
179
|
+
setDisableButtonConfig: setDisableButtonConfig
|
180
|
+
}
|
181
|
+
}, isFullScreen ? renderFullScreen() : renderModal());
|
333
182
|
});
|
334
|
-
|
183
|
+
InterstitialScreen.Header = InterstitialScreenHeader;
|
184
|
+
InterstitialScreen.Body = InterstitialScreenBody;
|
185
|
+
InterstitialScreen.Footer = InterstitialScreenFooter;
|
335
186
|
// Return a placeholder if not released and not enabled by feature flag
|
336
187
|
InterstitialScreen = pkg.checkComponentEnabled(InterstitialScreen, componentName);
|
337
188
|
|
@@ -343,14 +194,7 @@ InterstitialScreen.displayName = componentName;
|
|
343
194
|
// in alphabetical order (for consistency).
|
344
195
|
// See https://www.npmjs.com/package/prop-types#usage.
|
345
196
|
InterstitialScreen.propTypes = {
|
346
|
-
|
347
|
-
* Breakpoints are used to set the media content column size as well as the remainder for the main content areas column size. Medium and small breakpoints will be set to 0 internally to focus on the main content area.
|
348
|
-
*/
|
349
|
-
breakpointsWithMedia: PropTypes.object,
|
350
|
-
/**
|
351
|
-
* Provide the contents of the InterstitialScreen.
|
352
|
-
*/
|
353
|
-
children: PropTypes.node.isRequired,
|
197
|
+
children: PropTypes.node,
|
354
198
|
/**
|
355
199
|
* Provide an optional class to be applied to the containing node.
|
356
200
|
*/
|
@@ -359,22 +203,6 @@ InterstitialScreen.propTypes = {
|
|
359
203
|
* Tooltip text and aria label for the Close button icon.
|
360
204
|
*/
|
361
205
|
closeIconDescription: PropTypes.string,
|
362
|
-
/**
|
363
|
-
* The domain this app belongs to, e.g. "IBM Cloud Pak".
|
364
|
-
*/
|
365
|
-
domainName: PropTypes.string,
|
366
|
-
/**
|
367
|
-
* Provide an optional class to be applied to the <header> element >.
|
368
|
-
*/
|
369
|
-
headerClassName: PropTypes.string,
|
370
|
-
/**
|
371
|
-
* Provide an optional class to be applied to the <header> element >.
|
372
|
-
*/
|
373
|
-
headerTitle: PropTypes.string,
|
374
|
-
/**
|
375
|
-
* Optional parameter to hide the progress indicator when multiple steps are used.
|
376
|
-
*/
|
377
|
-
hideProgressIndicator: PropTypes.bool,
|
378
206
|
/**
|
379
207
|
* The aria label applied to the Interstitial Screen component
|
380
208
|
*/
|
@@ -388,34 +216,10 @@ InterstitialScreen.propTypes = {
|
|
388
216
|
* Specifies whether the component is currently open.
|
389
217
|
*/
|
390
218
|
isOpen: PropTypes.bool,
|
391
|
-
/**
|
392
|
-
* The label for the Next button.
|
393
|
-
*/
|
394
|
-
nextButtonLabel: PropTypes.string,
|
395
219
|
/**
|
396
220
|
* Function to call when the close button is clicked.
|
397
221
|
*/
|
398
|
-
onClose: PropTypes.func
|
399
|
-
/**
|
400
|
-
* The label for the Previous button.
|
401
|
-
*/
|
402
|
-
previousButtonLabel: PropTypes.string,
|
403
|
-
/**
|
404
|
-
* The name of this app, e.g. "QRadar".
|
405
|
-
*/
|
406
|
-
productName: PropTypes.string,
|
407
|
-
/**
|
408
|
-
* Optional prop to render any media like images or animated media.
|
409
|
-
*/
|
410
|
-
renderMedia: PropTypes.func,
|
411
|
-
/**
|
412
|
-
* The label for the skip button.
|
413
|
-
*/
|
414
|
-
skipButtonLabel: PropTypes.string,
|
415
|
-
/**
|
416
|
-
* The label for the start button.
|
417
|
-
*/
|
418
|
-
startButtonLabel: PropTypes.string
|
222
|
+
onClose: PropTypes.func
|
419
223
|
};
|
420
224
|
|
421
|
-
export { InterstitialScreen };
|
225
|
+
export { InterstitialScreen, InterstitialScreenContext };
|
@@ -0,0 +1,27 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2024, 2025
|
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
|
+
import React, { ReactElement, ReactNode } from 'react';
|
8
|
+
import { disableButtonConfigType } from './InterstitialScreen';
|
9
|
+
import { EnrichedChildren } from './InterstitialScreenHeader';
|
10
|
+
type contentRendererArgs = {
|
11
|
+
handleGotoStep?: (value: number) => void;
|
12
|
+
progStep?: number;
|
13
|
+
disableActionButton: (value: disableButtonConfigType) => void;
|
14
|
+
};
|
15
|
+
export interface InterstitialScreenBodyProps {
|
16
|
+
/**
|
17
|
+
* Provide an optional class to be applied to the containing node.
|
18
|
+
*/
|
19
|
+
className?: string;
|
20
|
+
/**
|
21
|
+
* This is a required callback that has to return the content to render in the body section.
|
22
|
+
* It can be a single child or an array of children depending on your need
|
23
|
+
*/
|
24
|
+
contentRenderer: (config: contentRendererArgs) => ReactElement<EnrichedChildren> | ReactNode;
|
25
|
+
}
|
26
|
+
declare const InterstitialScreenBody: React.ForwardRefExoticComponent<InterstitialScreenBodyProps & React.RefAttributes<HTMLDivElement>>;
|
27
|
+
export default InterstitialScreenBody;
|
@@ -0,0 +1,110 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2020, 2025
|
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 { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, objectSpread2 as _objectSpread2, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
9
|
+
import React__default, { useState, useContext, useEffect, isValidElement } from 'react';
|
10
|
+
import PropTypes from '../../_virtual/index.js';
|
11
|
+
import { InterstitialScreenContext } from './InterstitialScreen.js';
|
12
|
+
import { ModalBody } from '@carbon/react';
|
13
|
+
import { pkg } from '../../settings.js';
|
14
|
+
import { Carousel } from '../Carousel/Carousel.js';
|
15
|
+
import '../Carousel/CarouselItem.js';
|
16
|
+
|
17
|
+
var _excluded = ["className", "contentRenderer"];
|
18
|
+
var InterstitialScreenBody = /*#__PURE__*/React__default.forwardRef(function (props) {
|
19
|
+
var _props$className = props.className,
|
20
|
+
className = _props$className === void 0 ? '' : _props$className,
|
21
|
+
contentRenderer = props.contentRenderer,
|
22
|
+
rest = _objectWithoutProperties(props, _excluded);
|
23
|
+
var blockClass = "".concat(pkg.prefix, "--interstitial-screen");
|
24
|
+
var bodyBlockClass = "".concat(blockClass, "--internal-body");
|
25
|
+
var _useState = useState(false),
|
26
|
+
_useState2 = _slicedToArray(_useState, 2),
|
27
|
+
isMultiStep = _useState2[0],
|
28
|
+
setIsMultiStep = _useState2[1];
|
29
|
+
var _useContext = useContext(InterstitialScreenContext),
|
30
|
+
setBodyChildrenData = _useContext.setBodyChildrenData,
|
31
|
+
bodyChildrenData = _useContext.bodyChildrenData,
|
32
|
+
isFullScreen = _useContext.isFullScreen,
|
33
|
+
setProgStep = _useContext.setProgStep,
|
34
|
+
bodyScrollRef = _useContext.bodyScrollRef,
|
35
|
+
scrollRef = _useContext.scrollRef,
|
36
|
+
handleGotoStep = _useContext.handleGotoStep,
|
37
|
+
progStep = _useContext.progStep,
|
38
|
+
setStepCount = _useContext.setStepCount,
|
39
|
+
disableButtonConfig = _useContext.disableButtonConfig,
|
40
|
+
setDisableButtonConfig = _useContext.setDisableButtonConfig;
|
41
|
+
var _useState3 = useState(-1),
|
42
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
43
|
+
scrollPercent = _useState4[0],
|
44
|
+
setScrollPercent = _useState4[1];
|
45
|
+
useEffect(function () {
|
46
|
+
var _bodyContent = contentRenderer({
|
47
|
+
handleGotoStep: handleGotoStep,
|
48
|
+
progStep: progStep,
|
49
|
+
disableActionButton: disableActionButton
|
50
|
+
});
|
51
|
+
var isElement = /*#__PURE__*/isValidElement(_bodyContent);
|
52
|
+
var children = isElement ? _bodyContent.props.children : _bodyContent;
|
53
|
+
|
54
|
+
// Set body children data
|
55
|
+
setBodyChildrenData === null || setBodyChildrenData === void 0 || setBodyChildrenData(children);
|
56
|
+
|
57
|
+
// If the children is an array, treat it as a multiStep
|
58
|
+
if (isElement && Array.isArray(children)) {
|
59
|
+
var stepLength = children.length;
|
60
|
+
setIsMultiStep(!!stepLength);
|
61
|
+
setStepCount === null || setStepCount === void 0 || setStepCount(stepLength);
|
62
|
+
}
|
63
|
+
|
64
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
65
|
+
}, [progStep]);
|
66
|
+
useEffect(function () {
|
67
|
+
if (scrollPercent !== -1) {
|
68
|
+
var stepSize = bodyChildrenData && bodyChildrenData.length > 1 ? parseFloat((1 / (bodyChildrenData.length - 1)).toFixed(2)) : 0;
|
69
|
+
var currentStep = scrollPercent / stepSize;
|
70
|
+
setProgStep === null || setProgStep === void 0 || setProgStep(Math.ceil(currentStep));
|
71
|
+
}
|
72
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
73
|
+
}, [scrollPercent]);
|
74
|
+
var disableActionButton = function disableActionButton(config) {
|
75
|
+
setDisableButtonConfig === null || setDisableButtonConfig === void 0 || setDisableButtonConfig(_objectSpread2(_objectSpread2({}, disableButtonConfig), config));
|
76
|
+
};
|
77
|
+
var onScrollHandler = function onScrollHandler(scrollPercent) {
|
78
|
+
return setScrollPercent(scrollPercent);
|
79
|
+
};
|
80
|
+
var renderBody = function renderBody() {
|
81
|
+
return /*#__PURE__*/React__default.createElement("div", _extends({
|
82
|
+
className: "".concat(blockClass, "--body ").concat(className),
|
83
|
+
ref: bodyScrollRef
|
84
|
+
}, rest), /*#__PURE__*/React__default.createElement("div", {
|
85
|
+
className: "".concat(blockClass, "--content")
|
86
|
+
}, isMultiStep ? /*#__PURE__*/React__default.createElement("div", {
|
87
|
+
className: "".concat(blockClass, "__carousel")
|
88
|
+
}, /*#__PURE__*/React__default.createElement(Carousel, {
|
89
|
+
disableArrowScroll: true,
|
90
|
+
ref: scrollRef,
|
91
|
+
onScroll: onScrollHandler
|
92
|
+
}, bodyChildrenData)) : bodyChildrenData));
|
93
|
+
};
|
94
|
+
return isFullScreen ? renderBody() : /*#__PURE__*/React__default.createElement(ModalBody, {
|
95
|
+
className: bodyBlockClass
|
96
|
+
}, renderBody());
|
97
|
+
});
|
98
|
+
InterstitialScreenBody.propTypes = {
|
99
|
+
/**
|
100
|
+
* Provide an optional class to be applied to the containing node.
|
101
|
+
*/
|
102
|
+
className: PropTypes.string,
|
103
|
+
/**
|
104
|
+
* This is a required callback that has to return the content to render in the body section.
|
105
|
+
* It can be a single child or an array of children depending on your need
|
106
|
+
*/
|
107
|
+
contentRenderer: PropTypes.func.isRequired
|
108
|
+
};
|
109
|
+
|
110
|
+
export { InterstitialScreenBody as default };
|
@@ -0,0 +1,47 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2024, 2025
|
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
|
+
import React from 'react';
|
8
|
+
import { ActionType, disableButtonConfigType } from './InterstitialScreen';
|
9
|
+
type actionButtonRendererArgs = {
|
10
|
+
handleGotoStep?: (value: number) => void;
|
11
|
+
progStep?: number;
|
12
|
+
stepCount?: number;
|
13
|
+
disableButtonConfig?: disableButtonConfigType;
|
14
|
+
};
|
15
|
+
export interface InterstitialScreenFooterProps {
|
16
|
+
/**
|
17
|
+
* Provide an optional class to be applied to the containing node.
|
18
|
+
*/
|
19
|
+
className?: string;
|
20
|
+
/**
|
21
|
+
* The label for the Previous button.
|
22
|
+
*/
|
23
|
+
previousButtonLabel?: string;
|
24
|
+
/**
|
25
|
+
* The label for the skip button.
|
26
|
+
*/
|
27
|
+
skipButtonLabel?: string;
|
28
|
+
/**
|
29
|
+
* The label for the start button.
|
30
|
+
*/
|
31
|
+
startButtonLabel?: string;
|
32
|
+
/**
|
33
|
+
* The label for the Next button.
|
34
|
+
*/
|
35
|
+
nextButtonLabel?: string;
|
36
|
+
/**
|
37
|
+
* This is an optional callback prop that allows to render your custom footer action buttons.
|
38
|
+
* note: this is applicable when not using custom actionButtonRenderer
|
39
|
+
*/
|
40
|
+
actionButtonRenderer?: (config: actionButtonRendererArgs) => React.ReactNode;
|
41
|
+
/**
|
42
|
+
* optional asynchronous callback on action button click
|
43
|
+
*/
|
44
|
+
onAction?: (actionName: ActionType, config: actionButtonRendererArgs) => void;
|
45
|
+
}
|
46
|
+
declare const InterstitialScreenFooter: React.ForwardRefExoticComponent<InterstitialScreenFooterProps & React.RefAttributes<HTMLDivElement>>;
|
47
|
+
export default InterstitialScreenFooter;
|