@carbon/ibm-products 1.64.0 → 1.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 +224 -0
- 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.css +224 -0
- 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 +224 -0
- 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/Carousel/Carousel.js +5 -3
- package/es/components/InterstitialScreen/InterstitialScreen.js +419 -0
- package/es/components/InterstitialScreen/assets/index.js +5 -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/index.js +3 -0
- package/es/global/js/package-settings.js +4 -0
- package/lib/components/Carousel/Carousel.js +5 -3
- package/lib/components/InterstitialScreen/InterstitialScreen.js +420 -0
- package/lib/components/InterstitialScreen/assets/index.js +14 -0
- package/lib/components/InterstitialScreen/index.js +12 -0
- package/lib/components/InterstitialScreenView/InterstitialScreenView.js +72 -0
- package/lib/components/InterstitialScreenView/index.js +12 -0
- package/lib/components/InterstitialScreenViewModule/InterstitialScreenViewModule.js +80 -0
- package/lib/components/InterstitialScreenViewModule/index.js +12 -0
- package/lib/components/index.js +21 -0
- package/lib/global/js/package-settings.js +4 -0
- package/package.json +2 -2
- package/scss/components/InterstitialScreen/_index.scss +8 -0
- package/scss/components/InterstitialScreen/_interstitial-screen.scss +266 -0
- package/scss/components/InterstitialScreen/_storybook-styles.scss +59 -0
- package/scss/components/InterstitialScreenView/_index.scss +8 -0
- package/scss/components/InterstitialScreenView/_interstitial-screen-view.scss +25 -0
- package/scss/components/InterstitialScreenView/_storybook-styles.scss +10 -0
- package/scss/components/InterstitialScreenViewModule/_index.scss +8 -0
- package/scss/components/InterstitialScreenViewModule/_interstitial-screen-view-module.scss +54 -0
- package/scss/components/InterstitialScreenViewModule/_storybook-styles.scss +10 -0
- package/scss/components/_index.scss +3 -0
@@ -0,0 +1,419 @@
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
4
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
5
|
+
var _excluded = ["children", "className", "closeIconDescription", "domainName", "hideProgressIndicator", "interstitialAriaLabel", "isFullScreen", "isOpen", "media", "nextButtonLabel", "onClose", "previousButtonLabel", "productName", "headerClassName", "headerTitle", "startButtonLabel", "skipButtonLabel"];
|
6
|
+
/**
|
7
|
+
* Copyright IBM Corp. 2023, 2023
|
8
|
+
*
|
9
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
10
|
+
* LICENSE file in the root directory of this source tree.
|
11
|
+
*/
|
12
|
+
|
13
|
+
// Import portions of React that are needed.
|
14
|
+
import React, { Children, useCallback, useEffect, useRef, useState } from 'react';
|
15
|
+
import { clamp } from 'lodash';
|
16
|
+
// Other standard imports.
|
17
|
+
import PropTypes from 'prop-types';
|
18
|
+
import cx from 'classnames';
|
19
|
+
import { getDevtoolsProps } from '../../global/js/utils/devtools';
|
20
|
+
import { pkg } from '../../settings';
|
21
|
+
import { ArrowRight16 } from '@carbon/icons-react'; //Close16
|
22
|
+
import { Button, Column, ComposedModal, ModalBody, ModalHeader, ModalFooter, Grid, ProgressIndicator, ProgressStep, Row } from 'carbon-components-react';
|
23
|
+
import { Carousel } from '../Carousel';
|
24
|
+
import { SteppedAnimatedMedia } from '../SteppedAnimatedMedia';
|
25
|
+
|
26
|
+
// The block part of our conventional BEM class names (blockClass__E--M).
|
27
|
+
var blockClass = "".concat(pkg.prefix, "--interstitial-screen");
|
28
|
+
var headerBlockClass = "".concat(blockClass, "--internal-header");
|
29
|
+
var bodyBlockClass = "".concat(blockClass, "--internal-body");
|
30
|
+
var componentName = 'InterstitialScreen';
|
31
|
+
|
32
|
+
// NOTE: the component SCSS is not imported here: it is rolled up separately.
|
33
|
+
|
34
|
+
// Default values can be included here and then assigned to the prop params,
|
35
|
+
// e.g. prop = defaults.prop,
|
36
|
+
// This gathers default values together neatly and ensures non-primitive
|
37
|
+
// values are initialized early to avoid react making unnecessary re-renders.
|
38
|
+
// Note that default values are not required for props that are 'required',
|
39
|
+
// nor for props where the component can apply undefined values reasonably.
|
40
|
+
// Default values should be provided when the component needs to make a choice
|
41
|
+
// or assumption when a prop is not supplied.
|
42
|
+
|
43
|
+
// Default values for props
|
44
|
+
var defaults = {
|
45
|
+
closeIconDescription: 'Close',
|
46
|
+
domainName: '',
|
47
|
+
hideProgressIndicator: false,
|
48
|
+
interstitialAriaLabel: 'Interstitial screen',
|
49
|
+
isFullScreen: false,
|
50
|
+
isOpen: false,
|
51
|
+
nextButtonLabel: 'Next',
|
52
|
+
onClose: function onClose() {},
|
53
|
+
previousButtonLabel: 'Back',
|
54
|
+
productName: '',
|
55
|
+
skipButtonLabel: '',
|
56
|
+
startButtonLabel: 'Get started'
|
57
|
+
};
|
58
|
+
|
59
|
+
/**
|
60
|
+
* TODO: A description of the component.
|
61
|
+
*/
|
62
|
+
export var InterstitialScreen = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
63
|
+
var _media$breakpoints, _media$breakpoints2;
|
64
|
+
var children = _ref.children,
|
65
|
+
className = _ref.className,
|
66
|
+
_ref$closeIconDescrip = _ref.closeIconDescription,
|
67
|
+
closeIconDescription = _ref$closeIconDescrip === void 0 ? defaults.closeIconDescription : _ref$closeIconDescrip,
|
68
|
+
_ref$domainName = _ref.domainName,
|
69
|
+
domainName = _ref$domainName === void 0 ? defaults.domainName : _ref$domainName,
|
70
|
+
_ref$hideProgressIndi = _ref.hideProgressIndicator,
|
71
|
+
hideProgressIndicator = _ref$hideProgressIndi === void 0 ? defaults.hideProgressIndicator : _ref$hideProgressIndi,
|
72
|
+
_ref$interstitialAria = _ref.interstitialAriaLabel,
|
73
|
+
interstitialAriaLabel = _ref$interstitialAria === void 0 ? defaults.interstitialAriaLabel : _ref$interstitialAria,
|
74
|
+
_ref$isFullScreen = _ref.isFullScreen,
|
75
|
+
isFullScreen = _ref$isFullScreen === void 0 ? defaults.isFullScreen : _ref$isFullScreen,
|
76
|
+
_ref$isOpen = _ref.isOpen,
|
77
|
+
isOpen = _ref$isOpen === void 0 ? defaults.isOpen : _ref$isOpen,
|
78
|
+
media = _ref.media,
|
79
|
+
_ref$nextButtonLabel = _ref.nextButtonLabel,
|
80
|
+
nextButtonLabel = _ref$nextButtonLabel === void 0 ? defaults.nextButtonLabel : _ref$nextButtonLabel,
|
81
|
+
_ref$onClose = _ref.onClose,
|
82
|
+
onClose = _ref$onClose === void 0 ? defaults.onClose : _ref$onClose,
|
83
|
+
_ref$previousButtonLa = _ref.previousButtonLabel,
|
84
|
+
previousButtonLabel = _ref$previousButtonLa === void 0 ? defaults.previousButtonLabel : _ref$previousButtonLa,
|
85
|
+
_ref$productName = _ref.productName,
|
86
|
+
productName = _ref$productName === void 0 ? defaults.productName : _ref$productName,
|
87
|
+
headerClassName = _ref.headerClassName,
|
88
|
+
headerTitle = _ref.headerTitle,
|
89
|
+
_ref$startButtonLabel = _ref.startButtonLabel,
|
90
|
+
startButtonLabel = _ref$startButtonLabel === void 0 ? defaults.startButtonLabel : _ref$startButtonLabel,
|
91
|
+
_ref$skipButtonLabel = _ref.skipButtonLabel,
|
92
|
+
skipButtonLabel = _ref$skipButtonLabel === void 0 ? defaults.skipButtonLabel : _ref$skipButtonLabel,
|
93
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
94
|
+
var backupRef = useRef();
|
95
|
+
var _forwardedRef = ref || backupRef;
|
96
|
+
var scrollRef = useRef();
|
97
|
+
var startButtonRef = useRef();
|
98
|
+
var nextButtonRef = useRef();
|
99
|
+
var _useState = useState(null),
|
100
|
+
_useState2 = _slicedToArray(_useState, 2),
|
101
|
+
isVisibleClass = _useState2[0],
|
102
|
+
setIsVisibleClass = _useState2[1];
|
103
|
+
var _useState3 = useState(0),
|
104
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
105
|
+
progStep = _useState4[0],
|
106
|
+
setProgStep = _useState4[1];
|
107
|
+
var childArray = Children.toArray(children);
|
108
|
+
var isMultiStep = childArray.length > 1;
|
109
|
+
var mediaIsDefined = (media === null || media === void 0 ? void 0 : media.render) || (media === null || media === void 0 ? void 0 : media.filePaths);
|
110
|
+
var bodyScrollRef = useRef();
|
111
|
+
var mediaBreakpoints = {
|
112
|
+
xlg: (media === null || media === void 0 ? void 0 : (_media$breakpoints = media.breakpoints) === null || _media$breakpoints === void 0 ? void 0 : _media$breakpoints.xlg) || 0,
|
113
|
+
lg: (media === null || media === void 0 ? void 0 : (_media$breakpoints2 = media.breakpoints) === null || _media$breakpoints2 === void 0 ? void 0 : _media$breakpoints2.lg) || 0,
|
114
|
+
md: 0,
|
115
|
+
sm: 0
|
116
|
+
};
|
117
|
+
var contentBreakpoints = {
|
118
|
+
xlg: 16 - mediaBreakpoints.xlg,
|
119
|
+
lg: 16 - mediaBreakpoints.lg,
|
120
|
+
md: 8,
|
121
|
+
sm: 4
|
122
|
+
};
|
123
|
+
var variantClass = isFullScreen ? "".concat(blockClass, "--full-screen") : "".concat(blockClass, "--modal");
|
124
|
+
var progStepFloor = 0;
|
125
|
+
var progStepCeil = childArray.length - 1;
|
126
|
+
var handleClose = useCallback(function () {
|
127
|
+
setProgStep(0);
|
128
|
+
onClose();
|
129
|
+
}, [onClose]);
|
130
|
+
var scrollBodyToTop = function scrollBodyToTop() {
|
131
|
+
bodyScrollRef.current.scroll({
|
132
|
+
top: 0,
|
133
|
+
behavior: 'smooth'
|
134
|
+
});
|
135
|
+
};
|
136
|
+
var handleClickPrev = function handleClickPrev() {
|
137
|
+
var targetStep = clamp(progStep - 1, progStepFloor, progStepCeil);
|
138
|
+
scrollRef.current.scrollPrev();
|
139
|
+
scrollBodyToTop();
|
140
|
+
setProgStep(targetStep);
|
141
|
+
};
|
142
|
+
var handleClickNext = function handleClickNext() {
|
143
|
+
var targetStep = clamp(progStep + 1, progStepFloor, progStepCeil);
|
144
|
+
scrollRef.current.scrollNext();
|
145
|
+
scrollBodyToTop();
|
146
|
+
setProgStep(targetStep);
|
147
|
+
};
|
148
|
+
useEffect(function () {
|
149
|
+
var _startButtonRef$curre;
|
150
|
+
(_startButtonRef$curre = startButtonRef.current) === null || _startButtonRef$curre === void 0 ? void 0 : _startButtonRef$curre.focus();
|
151
|
+
}, [isOpen, progStep]);
|
152
|
+
useEffect(function () {
|
153
|
+
var _nextButtonRef$curren;
|
154
|
+
//for modal only, "is-visible" triggers animation
|
155
|
+
setIsVisibleClass(!isFullScreen && isOpen ? 'is-visible' : null);
|
156
|
+
nextButtonRef === null || nextButtonRef === void 0 ? void 0 : (_nextButtonRef$curren = nextButtonRef.current) === null || _nextButtonRef$curren === void 0 ? void 0 : _nextButtonRef$curren.focus();
|
157
|
+
}, [isFullScreen, isOpen]);
|
158
|
+
|
159
|
+
// hitting escape key also closes this component
|
160
|
+
useEffect(function () {
|
161
|
+
var close = function close(e) {
|
162
|
+
var key = e.key;
|
163
|
+
if (key === 'Escape') {
|
164
|
+
handleClose();
|
165
|
+
}
|
166
|
+
};
|
167
|
+
window.addEventListener('keydown', close);
|
168
|
+
return function () {
|
169
|
+
return window.removeEventListener('keydown', close);
|
170
|
+
};
|
171
|
+
}, [handleClose]);
|
172
|
+
if (!isOpen) {
|
173
|
+
return null;
|
174
|
+
}
|
175
|
+
var domainProductDelimiter = domainName !== '' && productName !== '' ? ' | ' : '';
|
176
|
+
var renderModal = function renderModal(childElements) {
|
177
|
+
return /*#__PURE__*/React.createElement(ComposedModal, _extends({}, rest, {
|
178
|
+
className: cx(
|
179
|
+
// blockClass, // Apply the block class to the main HTML element
|
180
|
+
className // Apply any supplied class names to the main HTML element.
|
181
|
+
// variantClass,
|
182
|
+
// isVisibleClass
|
183
|
+
),
|
184
|
+
|
185
|
+
size: "lg",
|
186
|
+
onClose: onClose,
|
187
|
+
open: isOpen,
|
188
|
+
forwardedRef: _forwardedRef,
|
189
|
+
"aria-label": interstitialAriaLabel
|
190
|
+
}, getDevtoolsProps(componentName)), /*#__PURE__*/React.createElement(ModalHeader, {
|
191
|
+
className: cx(headerBlockClass, headerTitle && "".concat(headerBlockClass, "--has-title"), headerClassName),
|
192
|
+
iconDescription: closeIconDescription,
|
193
|
+
buttonOnClick: handleClose
|
194
|
+
}, headerTitle && /*#__PURE__*/React.createElement("h2", null, headerTitle), !hideProgressIndicator && /*#__PURE__*/React.createElement("div", {
|
195
|
+
className: "".concat(blockClass, "--progress")
|
196
|
+
}, /*#__PURE__*/React.createElement(ProgressIndicator, {
|
197
|
+
vertical: false,
|
198
|
+
currentIndex: progStep
|
199
|
+
}, childArray.map(function (child, idx) {
|
200
|
+
return /*#__PURE__*/React.createElement(ProgressStep, {
|
201
|
+
key: idx,
|
202
|
+
label: child.props.stepTitle
|
203
|
+
});
|
204
|
+
})))), /*#__PURE__*/React.createElement(ModalBody, {
|
205
|
+
className: bodyBlockClass
|
206
|
+
}, childElements), /*#__PURE__*/React.createElement(ModalFooter, null, renderFooter()));
|
207
|
+
};
|
208
|
+
var renderFullScreen = function renderFullScreen(childElements) {
|
209
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
210
|
+
className: cx(blockClass,
|
211
|
+
// Apply the block class to the main HTML element
|
212
|
+
className,
|
213
|
+
// Apply any supplied class names to the main HTML element.
|
214
|
+
variantClass, isVisibleClass),
|
215
|
+
"aria-label": interstitialAriaLabel,
|
216
|
+
ref: ref
|
217
|
+
}, getDevtoolsProps(componentName)), /*#__PURE__*/React.createElement("div", {
|
218
|
+
className: cx([_defineProperty({}, "".concat(blockClass, "--container"), isFullScreen)])
|
219
|
+
}, /*#__PURE__*/React.createElement("div", {
|
220
|
+
className: "".concat(blockClass, "--header")
|
221
|
+
}, domainName, domainProductDelimiter, /*#__PURE__*/React.createElement("strong", null, productName)), /*#__PURE__*/React.createElement("header", {
|
222
|
+
className: cx(headerBlockClass, headerTitle && "".concat(headerBlockClass, "--has-title"), headerClassName)
|
223
|
+
}, headerTitle && /*#__PURE__*/React.createElement("h2", null, headerTitle), !hideProgressIndicator && /*#__PURE__*/React.createElement("div", {
|
224
|
+
className: "".concat(blockClass, "--progress")
|
225
|
+
}, /*#__PURE__*/React.createElement(ProgressIndicator, {
|
226
|
+
vertical: false,
|
227
|
+
currentIndex: progStep
|
228
|
+
}, childArray.map(function (child, idx) {
|
229
|
+
return /*#__PURE__*/React.createElement(ProgressStep, {
|
230
|
+
key: idx,
|
231
|
+
label: child.props.stepTitle
|
232
|
+
});
|
233
|
+
})))), childElements, renderFooter()));
|
234
|
+
};
|
235
|
+
var renderBody = function renderBody() {
|
236
|
+
return /*#__PURE__*/React.createElement("div", {
|
237
|
+
className: cx("".concat(blockClass, "--body")),
|
238
|
+
ref: bodyScrollRef
|
239
|
+
}, mediaIsDefined ? /*#__PURE__*/React.createElement(Grid, {
|
240
|
+
fullWidth: true,
|
241
|
+
className: cx("".concat(blockClass, "--body-grid"))
|
242
|
+
}, /*#__PURE__*/React.createElement(Row, {
|
243
|
+
className: cx("".concat(blockClass, "--body-row"))
|
244
|
+
}, /*#__PURE__*/React.createElement(Column, {
|
245
|
+
xlg: contentBreakpoints.xlg,
|
246
|
+
lg: contentBreakpoints.lg,
|
247
|
+
md: contentBreakpoints.md,
|
248
|
+
sm: contentBreakpoints.sm
|
249
|
+
}, /*#__PURE__*/React.createElement("div", {
|
250
|
+
className: cx("".concat(blockClass, "--content"))
|
251
|
+
}, isMultiStep ? /*#__PURE__*/React.createElement("div", {
|
252
|
+
className: "".concat(blockClass, "__carousel")
|
253
|
+
}, /*#__PURE__*/React.createElement(Carousel, {
|
254
|
+
disableArrowScroll: true,
|
255
|
+
ref: scrollRef
|
256
|
+
}, children)) : childArray[0])), mediaIsDefined && /*#__PURE__*/React.createElement(Column, {
|
257
|
+
xlg: mediaBreakpoints.xlg,
|
258
|
+
lg: mediaBreakpoints.lg,
|
259
|
+
md: mediaBreakpoints.md,
|
260
|
+
sm: mediaBreakpoints.sm,
|
261
|
+
className: cx("".concat(blockClass, "--media-container"))
|
262
|
+
}, /*#__PURE__*/React.createElement("div", {
|
263
|
+
className: "".concat(blockClass, "--media")
|
264
|
+
}, media.render ? media.render() : /*#__PURE__*/React.createElement(SteppedAnimatedMedia, {
|
265
|
+
className: "".concat(blockClass, "--stepped-animated-media"),
|
266
|
+
filePaths: media.filePaths,
|
267
|
+
playStep: progStep
|
268
|
+
}))))) : /*#__PURE__*/React.createElement("div", {
|
269
|
+
className: cx("".concat(blockClass, "--content"))
|
270
|
+
}, isMultiStep ? /*#__PURE__*/React.createElement("div", {
|
271
|
+
className: "".concat(blockClass, "__carousel")
|
272
|
+
}, /*#__PURE__*/React.createElement(Carousel, {
|
273
|
+
disableArrowScroll: true,
|
274
|
+
ref: scrollRef
|
275
|
+
}, children)) : /*#__PURE__*/React.createElement("div", null, childArray[0])));
|
276
|
+
};
|
277
|
+
var renderFooter = function renderFooter() {
|
278
|
+
return /*#__PURE__*/React.createElement("div", {
|
279
|
+
className: "".concat(blockClass, "--footer")
|
280
|
+
}, isMultiStep && skipButtonLabel !== '' && /*#__PURE__*/React.createElement(Button, {
|
281
|
+
className: "".concat(blockClass, "--skip-btn"),
|
282
|
+
kind: "ghost",
|
283
|
+
size: "lg",
|
284
|
+
title: skipButtonLabel,
|
285
|
+
onClick: handleClose
|
286
|
+
}, skipButtonLabel), /*#__PURE__*/React.createElement("div", {
|
287
|
+
className: "".concat(blockClass, "--footer-controls")
|
288
|
+
}, isMultiStep && progStep > 0 && /*#__PURE__*/React.createElement(Button, {
|
289
|
+
className: "".concat(blockClass, "--prev-btn"),
|
290
|
+
kind: "secondary",
|
291
|
+
size: "lg",
|
292
|
+
title: previousButtonLabel,
|
293
|
+
onClick: handleClickPrev
|
294
|
+
}, previousButtonLabel), isMultiStep && progStep < progStepCeil && /*#__PURE__*/React.createElement(Button, {
|
295
|
+
className: "".concat(blockClass, "--next-btn"),
|
296
|
+
renderIcon: ArrowRight16,
|
297
|
+
ref: nextButtonRef,
|
298
|
+
size: "lg",
|
299
|
+
title: nextButtonLabel,
|
300
|
+
onClick: handleClickNext
|
301
|
+
}, nextButtonLabel), isMultiStep && progStep === progStepCeil && /*#__PURE__*/React.createElement(Button, {
|
302
|
+
className: "".concat(blockClass, "--start-btn"),
|
303
|
+
ref: startButtonRef,
|
304
|
+
renderIcon: ArrowRight16,
|
305
|
+
size: "lg",
|
306
|
+
title: startButtonLabel,
|
307
|
+
onClick: handleClose
|
308
|
+
}, startButtonLabel), !isMultiStep && /*#__PURE__*/React.createElement(Button, {
|
309
|
+
className: "".concat(blockClass, "--start-btn"),
|
310
|
+
ref: startButtonRef,
|
311
|
+
size: "lg",
|
312
|
+
title: startButtonLabel,
|
313
|
+
onClick: handleClose
|
314
|
+
}, startButtonLabel)));
|
315
|
+
};
|
316
|
+
return isFullScreen ? renderFullScreen(renderBody()) : renderModal(renderBody());
|
317
|
+
});
|
318
|
+
|
319
|
+
// Return a placeholder if not released and not enabled by feature flag
|
320
|
+
InterstitialScreen = pkg.checkComponentEnabled(InterstitialScreen, componentName);
|
321
|
+
|
322
|
+
// The display name of the component, used by React. Note that displayName
|
323
|
+
// is used in preference to relying on function.name.
|
324
|
+
InterstitialScreen.displayName = componentName;
|
325
|
+
|
326
|
+
// The types and DocGen commentary for the component props,
|
327
|
+
// in alphabetical order (for consistency).
|
328
|
+
// See https://www.npmjs.com/package/prop-types#usage.
|
329
|
+
InterstitialScreen.propTypes = {
|
330
|
+
/**
|
331
|
+
* Provide the contents of the InterstitialScreen.
|
332
|
+
*/
|
333
|
+
children: PropTypes.node.isRequired,
|
334
|
+
/**
|
335
|
+
* Provide an optional class to be applied to the containing node.
|
336
|
+
*/
|
337
|
+
className: PropTypes.string,
|
338
|
+
/**
|
339
|
+
* Tooltip text and aria label for the Close button icon.
|
340
|
+
*/
|
341
|
+
closeIconDescription: PropTypes.string,
|
342
|
+
/**
|
343
|
+
* The domain this app belongs to, e.g. "IBM Cloud Pak".
|
344
|
+
*/
|
345
|
+
domainName: PropTypes.string,
|
346
|
+
/**
|
347
|
+
* Provide an optional class to be applied to the <header> element >.
|
348
|
+
*/
|
349
|
+
headerClassName: PropTypes.string,
|
350
|
+
/**
|
351
|
+
* Provide an optional class to be applied to the <header> element >.
|
352
|
+
*/
|
353
|
+
headerTitle: PropTypes.string,
|
354
|
+
/**
|
355
|
+
* Optional parameter to hide the progress indicator when multiple steps are used.
|
356
|
+
*/
|
357
|
+
hideProgressIndicator: PropTypes.bool,
|
358
|
+
/**
|
359
|
+
* The aria label applied to the Interstitial Screen component
|
360
|
+
*/
|
361
|
+
interstitialAriaLabel: PropTypes.string,
|
362
|
+
/**
|
363
|
+
* Specifies whether the component is shown as a full-screen
|
364
|
+
* experience, else it is shown as a modal by default.
|
365
|
+
*/
|
366
|
+
isFullScreen: PropTypes.bool,
|
367
|
+
/**
|
368
|
+
* Specifies whether the component is currently open.
|
369
|
+
*/
|
370
|
+
isOpen: PropTypes.bool,
|
371
|
+
/**
|
372
|
+
* The object describing an image in one of two shapes.
|
373
|
+
*
|
374
|
+
* If a single media element is required, use `{render}`.
|
375
|
+
*
|
376
|
+
* If a stepped animation is required, use `{filePaths}`.
|
377
|
+
*
|
378
|
+
* Breakpoints are used to set the media content column size as well as the remainder for the main content areas column size.
|
379
|
+
* Medium and small breakpoints will be set to 0 internally to focus on the main content area.
|
380
|
+
* @see {@link MEDIA_PROP_TYPE}.
|
381
|
+
*/
|
382
|
+
media: PropTypes.oneOfType([PropTypes.shape({
|
383
|
+
render: PropTypes.func,
|
384
|
+
breakpoints: PropTypes.shape({
|
385
|
+
xlg: PropTypes.number,
|
386
|
+
lg: PropTypes.number
|
387
|
+
})
|
388
|
+
}), PropTypes.shape({
|
389
|
+
filePaths: PropTypes.arrayOf(PropTypes.string),
|
390
|
+
breakpoints: PropTypes.shape({
|
391
|
+
xlg: PropTypes.number,
|
392
|
+
lg: PropTypes.number
|
393
|
+
})
|
394
|
+
})]),
|
395
|
+
/**
|
396
|
+
* The label for the Next button.
|
397
|
+
*/
|
398
|
+
nextButtonLabel: PropTypes.string,
|
399
|
+
/**
|
400
|
+
* Function to call when the close button is clicked.
|
401
|
+
*/
|
402
|
+
onClose: PropTypes.func,
|
403
|
+
/**
|
404
|
+
* The label for the Previous button.
|
405
|
+
*/
|
406
|
+
previousButtonLabel: PropTypes.string,
|
407
|
+
/**
|
408
|
+
* The name of this app, e.g. "QRadar".
|
409
|
+
*/
|
410
|
+
productName: PropTypes.string,
|
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
|
419
|
+
};
|
@@ -0,0 +1,5 @@
|
|
1
|
+
var HowACaseIsCreated1 = new URL('./illustrations/how-a-case-is-created-1', import.meta.url).pathname;
|
2
|
+
var HowACaseIsCreated2 = new URL('./illustrations/how-a-case-is-created-2', import.meta.url).pathname;
|
3
|
+
var HowACaseIsCreated3 = new URL('./illustrations/how-a-case-is-created-3', import.meta.url).pathname;
|
4
|
+
var InterstitialExampleImg = new URL('./illustrations/interstitial-ph.png', import.meta.url).pathname;
|
5
|
+
export { HowACaseIsCreated1, HowACaseIsCreated2, HowACaseIsCreated3, InterstitialExampleImg };
|
@@ -0,0 +1,75 @@
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
3
|
+
var _excluded = ["children", "className", "stepTitle"];
|
4
|
+
/**
|
5
|
+
* Copyright IBM Corp. 2023, 2023
|
6
|
+
*
|
7
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
9
|
+
*/
|
10
|
+
|
11
|
+
// Import portions of React that are needed.
|
12
|
+
import React from 'react';
|
13
|
+
|
14
|
+
// Other standard imports.
|
15
|
+
import PropTypes from 'prop-types';
|
16
|
+
import cx from 'classnames';
|
17
|
+
import { getDevtoolsProps } from '../../global/js/utils/devtools';
|
18
|
+
import { pkg /*, carbon */ } from '../../settings';
|
19
|
+
|
20
|
+
// Carbon and package components we use.
|
21
|
+
/* TODO: @import(s) of carbon components and other package components. */
|
22
|
+
|
23
|
+
// The block part of our conventional BEM class names (blockClass__E--M).
|
24
|
+
var blockClass = "".concat(pkg.prefix, "--interstitial-screen-view");
|
25
|
+
var componentName = 'InterstitialScreenView';
|
26
|
+
|
27
|
+
/**
|
28
|
+
* A Novice to Pro component intended to be used as the child elements of the InterstitialScreen component.
|
29
|
+
*/
|
30
|
+
export var InterstitialScreenView = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
31
|
+
var children = _ref.children,
|
32
|
+
className = _ref.className,
|
33
|
+
stepTitle = _ref.stepTitle,
|
34
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
35
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
36
|
+
role: "complementary",
|
37
|
+
"aria-label": stepTitle
|
38
|
+
}, rest, {
|
39
|
+
className: cx(blockClass,
|
40
|
+
// Apply the block class to the main HTML element
|
41
|
+
className,
|
42
|
+
// Apply any supplied class names to the main HTML element.
|
43
|
+
// example: `${blockClass}__template-string-class-${kind}-n-${size}`,
|
44
|
+
{
|
45
|
+
// switched classes dependant on props or state
|
46
|
+
// example: [`${blockClass}__here-if-small`]: size === 'sm',
|
47
|
+
}),
|
48
|
+
ref: ref
|
49
|
+
}, getDevtoolsProps(componentName)), children);
|
50
|
+
});
|
51
|
+
|
52
|
+
// Return a placeholder if not released and not enabled by feature flag
|
53
|
+
InterstitialScreenView = pkg.checkComponentEnabled(InterstitialScreenView, componentName);
|
54
|
+
|
55
|
+
// The display name of the component, used by React. Note that displayName
|
56
|
+
// is used in preference to relying on function.name.
|
57
|
+
InterstitialScreenView.displayName = componentName;
|
58
|
+
|
59
|
+
// The types and DocGen commentary for the component props,
|
60
|
+
// in alphabetical order (for consistency).
|
61
|
+
// See https://www.npmjs.com/package/prop-types#usage.
|
62
|
+
InterstitialScreenView.propTypes = {
|
63
|
+
/**
|
64
|
+
* Provide the contents of the InterstitialScreenView.
|
65
|
+
*/
|
66
|
+
children: PropTypes.node,
|
67
|
+
/**
|
68
|
+
* Optional class name for this component.
|
69
|
+
*/
|
70
|
+
className: PropTypes.string,
|
71
|
+
/**
|
72
|
+
* The label to pass to the ProgressStep component.
|
73
|
+
*/
|
74
|
+
stepTitle: PropTypes.string.isRequired
|
75
|
+
};
|
@@ -0,0 +1,83 @@
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
3
|
+
var _excluded = ["className", "title", "description"];
|
4
|
+
/**
|
5
|
+
* Copyright IBM Corp. 2023, 2023
|
6
|
+
*
|
7
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
9
|
+
*/
|
10
|
+
|
11
|
+
// Import portions of React that are needed.
|
12
|
+
import React from 'react';
|
13
|
+
|
14
|
+
// Other standard imports.
|
15
|
+
import PropTypes from 'prop-types';
|
16
|
+
import cx from 'classnames';
|
17
|
+
import { getDevtoolsProps } from '../../global/js/utils/devtools';
|
18
|
+
import { pkg /*, carbon */ } from '../../settings';
|
19
|
+
|
20
|
+
// Carbon and package components we use.
|
21
|
+
/* TODO: @import(s) of carbon components and other package components. */
|
22
|
+
|
23
|
+
// The block part of our conventional BEM class names (blockClass__E--M).
|
24
|
+
var blockClass = "".concat(pkg.prefix, "--interstitial-screen-view-module");
|
25
|
+
var componentName = 'InterstitialScreenViewModule';
|
26
|
+
|
27
|
+
// NOTE: the component SCSS is not imported here: it is rolled up separately.
|
28
|
+
|
29
|
+
// Default values can be included here and then assigned to the prop params,
|
30
|
+
// e.g. prop = defaults.prop,
|
31
|
+
// This gathers default values together neatly and ensures non-primitive
|
32
|
+
// values are initialized early to avoid react making unnecessary re-renders.
|
33
|
+
// Note that default values are not required for props that are 'required',
|
34
|
+
// nor for props where the component can apply undefined values reasonably.
|
35
|
+
// Default values should be provided when the component needs to make a choice
|
36
|
+
// or assumption when a prop is not supplied.
|
37
|
+
|
38
|
+
/**
|
39
|
+
* View module to help in building interstitial screen views.
|
40
|
+
*/
|
41
|
+
export var InterstitialScreenViewModule = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
42
|
+
var className = _ref.className,
|
43
|
+
title = _ref.title,
|
44
|
+
description = _ref.description,
|
45
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
46
|
+
return /*#__PURE__*/React.createElement("section", _extends({}, rest, {
|
47
|
+
className: cx(blockClass,
|
48
|
+
// Apply the block class to the main HTML element
|
49
|
+
className // Apply any supplied class names to the main HTML element.
|
50
|
+
),
|
51
|
+
|
52
|
+
ref: ref
|
53
|
+
}, getDevtoolsProps(componentName)), /*#__PURE__*/React.createElement("h1", {
|
54
|
+
className: "".concat(blockClass, "--heading")
|
55
|
+
}, title), /*#__PURE__*/React.createElement("p", {
|
56
|
+
className: "".concat(blockClass, "--body")
|
57
|
+
}, description));
|
58
|
+
});
|
59
|
+
|
60
|
+
// Return a placeholder if not released and not enabled by feature flag
|
61
|
+
InterstitialScreenViewModule = pkg.checkComponentEnabled(InterstitialScreenViewModule, componentName);
|
62
|
+
|
63
|
+
// The display name of the component, used by React. Note that displayName
|
64
|
+
// is used in preference to relying on function.name.
|
65
|
+
InterstitialScreenViewModule.displayName = componentName;
|
66
|
+
|
67
|
+
// The types and DocGen commentary for the component props,
|
68
|
+
// in alphabetical order (for consistency).
|
69
|
+
// See https://www.npmjs.com/package/prop-types#usage.
|
70
|
+
InterstitialScreenViewModule.propTypes = {
|
71
|
+
/**
|
72
|
+
* Provide an optional class to be applied to the containing node.
|
73
|
+
*/
|
74
|
+
className: PropTypes.string,
|
75
|
+
/**
|
76
|
+
* The description of this component.
|
77
|
+
*/
|
78
|
+
description: PropTypes.string.isRequired,
|
79
|
+
/**
|
80
|
+
* The title of this component.
|
81
|
+
*/
|
82
|
+
title: PropTypes.string.isRequired
|
83
|
+
};
|
package/es/components/index.js
CHANGED
@@ -54,4 +54,7 @@ export { CoachmarkOverlayElements } from './CoachmarkOverlayElements';
|
|
54
54
|
export { CoachmarkOverlayElement } from './CoachmarkOverlayElement';
|
55
55
|
export { CoachmarkStack } from './CoachmarkStack';
|
56
56
|
export { InlineTip, InlineTipButton, InlineTipLink } from './InlineTip';
|
57
|
+
export { InterstitialScreen } from './InterstitialScreen';
|
58
|
+
export { InterstitialScreenView } from './InterstitialScreenView';
|
59
|
+
export { InterstitialScreenViewModule } from './InterstitialScreenViewModule';
|
57
60
|
export { Checklist } from './Checklist';
|
@@ -80,6 +80,9 @@ var defaults = {
|
|
80
80
|
GuidebannerElementButton: false,
|
81
81
|
GuidebannerElementLink: false,
|
82
82
|
NonLinearReading: false,
|
83
|
+
InterstitialScreen: false,
|
84
|
+
InterstitialScreenView: false,
|
85
|
+
InterstitialScreenViewModule: false,
|
83
86
|
Checklist: false,
|
84
87
|
Coachmark: false,
|
85
88
|
CoachmarkBeacon: false,
|
@@ -88,6 +91,7 @@ var defaults = {
|
|
88
91
|
CoachmarkOverlayElement: false,
|
89
92
|
CoachmarkOverlayElements: false,
|
90
93
|
CoachmarkStack: false
|
94
|
+
|
91
95
|
/* new component flags here - comment used by generate CLI */
|
92
96
|
},
|
93
97
|
|
@@ -197,9 +197,11 @@ var Carousel = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
197
197
|
(0, _react.useEffect)(function () {
|
198
198
|
function handleWheel(event) {
|
199
199
|
// update the scroll position
|
200
|
-
event.
|
201
|
-
|
202
|
-
|
200
|
+
if (event.shiftKey) {
|
201
|
+
event.stopPropagation();
|
202
|
+
event.preventDefault();
|
203
|
+
event.cancelBubble = false;
|
204
|
+
}
|
203
205
|
}
|
204
206
|
var scrollDiv = scrollRef.current;
|
205
207
|
if (scrollDiv) {
|