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