@carbon/ibm-products 2.78.0 → 2.79.0-rc.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/carbon.css +1762 -1036
- package/css/carbon.css.map +1 -1
- package/css/index-full-carbon.css +2342 -1239
- 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 +450 -98
- 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 +624 -247
- 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 +1759 -873
- 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/ConditionBuilder/ConditionBlock/ConditionBlock.js +111 -108
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +1 -1
- package/es/components/InterstitialScreen/InterstitialScreenBody.js +15 -8
- package/es/components/InterstitialScreen/InterstitialScreenFooter.js +6 -1
- package/es/components/InterstitialScreen/InterstitialScreenHeader.d.ts +1 -1
- package/es/components/InterstitialScreen/InterstitialScreenHeader.js +1 -1
- package/es/components/InterstitialScreen/{_story-assets/InterstitialScreenView/InterstitialScreenView.d.ts → InterstitialScreenView.d.ts} +2 -3
- package/es/components/InterstitialScreen/InterstitialScreenView.js +60 -0
- package/es/components/InterstitialScreen/index.d.ts +1 -0
- package/es/components/Tearsheet/next/Tearsheet.d.ts +85 -0
- package/es/components/Tearsheet/next/Tearsheet.js +129 -0
- package/es/components/Tearsheet/next/TearsheetBody.d.ts +67 -0
- package/es/components/Tearsheet/next/TearsheetBody.js +121 -0
- package/es/components/Tearsheet/next/TearsheetHeader.d.ts +65 -0
- package/es/components/Tearsheet/next/TearsheetHeader.js +121 -0
- package/es/components/Tearsheet/next/TearsheetHeaderActions.d.ts +54 -0
- package/es/components/Tearsheet/next/TearsheetHeaderActions.js +101 -0
- package/es/components/Tearsheet/next/TearsheetHeaderContent.d.ts +28 -0
- package/es/components/Tearsheet/next/TearsheetHeaderContent.js +67 -0
- package/es/components/Tearsheet/next/_story-assets/StepTearsheet.d.ts +22 -0
- package/es/components/Tearsheet/next/context.d.ts +26 -0
- package/es/components/Tearsheet/next/context.js +26 -0
- package/es/components/Tearsheet/next/index.d.ts +12 -0
- package/es/components/Tearsheet/next/index.js +8 -0
- package/es/components/Toolbar/Toolbar.js +1 -5
- package/es/components/TruncatedText/TruncatedText.d.ts +2 -3
- package/es/components/TruncatedText/TruncatedText.js +1 -2
- package/es/components/TruncatedText/index.d.ts +1 -0
- package/es/components/index.d.ts +2 -1
- package/es/global/js/hooks/useCollapsible.d.ts +19 -0
- package/es/global/js/hooks/useCollapsible.js +68 -0
- package/es/global/js/hooks/useMatchMedia.d.ts +13 -0
- package/es/global/js/hooks/useMatchMedia.js +33 -0
- package/es/index.js +4 -1
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-10.js +845 -805
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-3.js +476 -476
- package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +111 -108
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +1 -1
- package/lib/components/InterstitialScreen/InterstitialScreenBody.js +15 -8
- package/lib/components/InterstitialScreen/InterstitialScreenFooter.js +6 -1
- package/lib/components/InterstitialScreen/InterstitialScreenHeader.d.ts +1 -1
- package/lib/components/InterstitialScreen/InterstitialScreenHeader.js +1 -1
- package/lib/components/InterstitialScreen/{_story-assets/InterstitialScreenView/InterstitialScreenView.d.ts → InterstitialScreenView.d.ts} +2 -3
- package/lib/components/InterstitialScreen/InterstitialScreenView.js +62 -0
- package/lib/components/InterstitialScreen/index.d.ts +1 -0
- package/lib/components/Tearsheet/next/Tearsheet.d.ts +85 -0
- package/lib/components/Tearsheet/next/Tearsheet.js +131 -0
- package/lib/components/Tearsheet/next/TearsheetBody.d.ts +67 -0
- package/lib/components/Tearsheet/next/TearsheetBody.js +128 -0
- package/lib/components/Tearsheet/next/TearsheetHeader.d.ts +65 -0
- package/lib/components/Tearsheet/next/TearsheetHeader.js +127 -0
- package/lib/components/Tearsheet/next/TearsheetHeaderActions.d.ts +54 -0
- package/lib/components/Tearsheet/next/TearsheetHeaderActions.js +104 -0
- package/lib/components/Tearsheet/next/TearsheetHeaderContent.d.ts +28 -0
- package/lib/components/Tearsheet/next/TearsheetHeaderContent.js +71 -0
- package/lib/components/Tearsheet/next/_story-assets/StepTearsheet.d.ts +22 -0
- package/lib/components/Tearsheet/next/context.d.ts +26 -0
- package/lib/components/Tearsheet/next/context.js +29 -0
- package/lib/components/Tearsheet/next/index.d.ts +12 -0
- package/lib/components/Tearsheet/next/index.js +14 -0
- package/lib/components/Toolbar/Toolbar.js +1 -5
- package/lib/components/TruncatedText/TruncatedText.d.ts +2 -3
- package/lib/components/TruncatedText/TruncatedText.js +4 -3
- package/lib/components/TruncatedText/index.d.ts +1 -0
- package/lib/components/index.d.ts +2 -1
- package/lib/global/js/hooks/useCollapsible.d.ts +19 -0
- package/lib/global/js/hooks/useCollapsible.js +70 -0
- package/lib/global/js/hooks/useMatchMedia.d.ts +13 -0
- package/lib/global/js/hooks/useMatchMedia.js +35 -0
- package/lib/index.js +15 -14
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-10.js +863 -823
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-3.js +477 -477
- package/package.json +16 -15
- package/scss/components/FilterSummary/_filter-summary.scss +1 -1
- package/scss/components/PageHeader/_page-header.scss +4 -0
- package/scss/components/SidePanel/_side-panel.scss +5 -5
- package/scss/components/TagOverflow/_tag-overflow.scss +38 -38
- package/scss/components/TagSet/_tag-set.scss +28 -12
- package/scss/components/Tearsheet/_tearsheet.scss +8 -1
- package/scss/components/Tearsheet/_tearsheet_next.scss +408 -0
- package/telemetry.yml +32 -6
|
@@ -186,114 +186,117 @@ const ConditionBlock = props => {
|
|
|
186
186
|
group: group
|
|
187
187
|
});
|
|
188
188
|
};
|
|
189
|
-
return
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
"
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
189
|
+
return (
|
|
190
|
+
/*#__PURE__*/
|
|
191
|
+
// eslint-disable-next-line jsx-a11y/interactive-supports-focus
|
|
192
|
+
React.createElement("div", _rollupPluginBabelHelpers.extends({
|
|
193
|
+
className: cx(`${util.blockClass}__condition-block`, {
|
|
194
|
+
[`${util.blockClass}__condition__deletion-preview`]: showDeletionPreview
|
|
195
|
+
}, {
|
|
196
|
+
[`${util.blockClass}__gap-bottom`]: variant == util.HIERARCHICAL_VARIANT
|
|
197
|
+
}, {
|
|
198
|
+
[`${util.blockClass}__gap ${util.blockClass}__gap-bottom`]: variant == util.NON_HIERARCHICAL_VARIANT
|
|
199
|
+
}, {
|
|
200
|
+
[`${util.blockClass}__condition--interacting`]: showAllActions
|
|
201
|
+
}),
|
|
202
|
+
role: "row",
|
|
203
|
+
"aria-label": conditionRowText
|
|
204
|
+
}, getAriaAttributes(), {
|
|
205
|
+
onMouseEnter: showAllActionsHandler,
|
|
206
|
+
onMouseLeave: hideAllActionsHandler,
|
|
207
|
+
onBlur: hideAllActionsHandler
|
|
208
|
+
}), conjunction ? /*#__PURE__*/React.createElement(ConditionConnector.default, {
|
|
209
|
+
className: `${util.blockClass}__gap`,
|
|
210
|
+
operator: conjunction,
|
|
211
|
+
onChange: op => onConnectorOperatorChange?.(op)
|
|
212
|
+
}) : '', isStatement && /*#__PURE__*/React.createElement(ConditionBuilderItem.ConditionBuilderItem, {
|
|
213
|
+
label: group.statement,
|
|
214
|
+
title: conditionText,
|
|
215
|
+
"data-name": "connectorField",
|
|
216
|
+
popOverClassName: `${util.blockClass}__gap ${util.blockClass}__connector`,
|
|
217
|
+
className: `${util.blockClass}__statement-button`,
|
|
218
|
+
tabIndex: 0
|
|
219
|
+
}, /*#__PURE__*/React.createElement(ItemOption.ItemOption, {
|
|
220
|
+
conditionState: {
|
|
221
|
+
value: group.statement,
|
|
222
|
+
label: conditionText
|
|
223
|
+
},
|
|
224
|
+
onChange: onStatementChangeHandler,
|
|
225
|
+
config: {
|
|
226
|
+
options: statementConfig,
|
|
227
|
+
isStatement: true
|
|
228
|
+
}
|
|
229
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
230
|
+
className: `${util.blockClass}__condition-inner-block`
|
|
231
|
+
}, /*#__PURE__*/React.createElement(ConditionBuilderItem.ConditionBuilderItem, {
|
|
232
|
+
label: label ?? condition?.property,
|
|
233
|
+
title: propertyText,
|
|
234
|
+
renderIcon: icon ?? undefined,
|
|
235
|
+
className: `${util.blockClass}__property-field`,
|
|
236
|
+
"data-name": "propertyField",
|
|
237
|
+
condition: condition,
|
|
238
|
+
type: type,
|
|
239
|
+
description: description,
|
|
240
|
+
onChange: onPropertyChangeHandler,
|
|
241
|
+
renderChildren: renderItemOption
|
|
242
|
+
}), util.checkIsValid(property) && /*#__PURE__*/React.createElement(ConditionBuilderItem.ConditionBuilderItem, {
|
|
243
|
+
label: operator,
|
|
244
|
+
title: operatorText,
|
|
245
|
+
"data-name": "operatorField",
|
|
246
|
+
condition: condition,
|
|
247
|
+
type: type,
|
|
248
|
+
config: config,
|
|
249
|
+
onChange: onOperatorChangeHandler
|
|
250
|
+
}, /*#__PURE__*/React.createElement(ItemOption.ItemOption, {
|
|
251
|
+
config: {
|
|
252
|
+
options: getOperators()
|
|
253
|
+
},
|
|
254
|
+
conditionState: {
|
|
255
|
+
value: operator,
|
|
256
|
+
label: operatorText
|
|
257
|
+
},
|
|
258
|
+
onChange: onOperatorChangeHandler
|
|
259
|
+
})), util.checkIsValid(property) && util.checkIsValid(operator) && /*#__PURE__*/React.createElement(ConditionBuilderItem.ConditionBuilderItem, {
|
|
260
|
+
label: value,
|
|
261
|
+
type: type,
|
|
262
|
+
title: label,
|
|
263
|
+
showToolTip: true,
|
|
264
|
+
"data-name": "valueField",
|
|
265
|
+
condition: condition,
|
|
266
|
+
config: config,
|
|
267
|
+
onChange: onValueChangeHandler,
|
|
268
|
+
renderChildren: renderChildren
|
|
269
|
+
})), !readOnly && /*#__PURE__*/React.createElement("span", {
|
|
270
|
+
role: "gridcell",
|
|
271
|
+
"aria-label": removeConditionText
|
|
272
|
+
}, /*#__PURE__*/React.createElement(ConditionBuilderButton.ConditionBuilderButton, {
|
|
273
|
+
hideLabel: true,
|
|
274
|
+
label: removeConditionText,
|
|
275
|
+
onClick: onRemove,
|
|
276
|
+
onMouseEnter: handleShowDeletionPreview,
|
|
277
|
+
onMouseLeave: handleHideDeletionPreview,
|
|
278
|
+
onFocus: handleShowDeletionPreview,
|
|
279
|
+
onBlur: handleHideDeletionPreview,
|
|
280
|
+
renderIcon: icons.Close,
|
|
281
|
+
className: `${util.blockClass}__close-condition`,
|
|
282
|
+
"data-name": "closeCondition",
|
|
283
|
+
wrapperClassName: `${util.blockClass}__close-condition-wrapper`
|
|
284
|
+
})), !readOnly && manageActionButtons(conditionIndex, group.conditions) ? /*#__PURE__*/React.createElement(ConditionBuilderAdd.default, {
|
|
285
|
+
onClick: () => {
|
|
286
|
+
addConditionHandler?.(conditionIndex);
|
|
287
|
+
},
|
|
288
|
+
addConditionSubGroupHandler: () => {
|
|
289
|
+
addConditionSubGroupHandler?.(conditionIndex);
|
|
290
|
+
},
|
|
291
|
+
showConditionSubGroupPreviewHandler: showConditionSubGroupPreviewHandler,
|
|
292
|
+
hideConditionSubGroupPreviewHandler: hideConditionSubGroupPreviewHandler,
|
|
293
|
+
enableSubGroup: variant == util.HIERARCHICAL_VARIANT,
|
|
294
|
+
showConditionPreviewHandler: showConditionPreviewHandler,
|
|
295
|
+
hideConditionPreviewHandler: hideConditionPreviewHandler,
|
|
296
|
+
className: `${util.blockClass}__gap ${util.blockClass}__gap-left`,
|
|
297
|
+
group: group
|
|
298
|
+
}) : null)
|
|
299
|
+
);
|
|
297
300
|
};
|
|
298
301
|
ConditionBlock.propTypes = {
|
|
299
302
|
/**
|
|
@@ -134,7 +134,7 @@ const ConditionBuilderItem = _ref => {
|
|
|
134
134
|
if (!popoverEl) {
|
|
135
135
|
return;
|
|
136
136
|
}
|
|
137
|
-
const focusLeftPopover = !popoverEl.contains(relatedTarget);
|
|
137
|
+
const focusLeftPopover = relatedTarget && !popoverEl.contains(relatedTarget);
|
|
138
138
|
const targetInsidePopover = popoverEl.contains(focusEvent.target);
|
|
139
139
|
const targetEl = focusEvent.target;
|
|
140
140
|
const focusMovedToDatePicker = targetEl?.closest('.flatpickr-calendar');
|
|
@@ -41,26 +41,33 @@ const InterstitialScreenBody = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
41
41
|
} = React.useContext(context.InterstitialScreenContext);
|
|
42
42
|
const [scrollPercent, setScrollPercent] = React.useState(-1);
|
|
43
43
|
React.useEffect(() => {
|
|
44
|
+
// Get the content either from contentRenderer or fallback to props.children
|
|
44
45
|
const _bodyContent = contentRenderer?.({
|
|
45
46
|
handleGotoStep,
|
|
46
47
|
progStep,
|
|
47
48
|
disableActionButton
|
|
48
49
|
}) ?? props.children;
|
|
49
|
-
const isElement = /*#__PURE__*/React.isValidElement(_bodyContent);
|
|
50
|
-
const children = isElement ? _bodyContent.props.children : _bodyContent;
|
|
51
50
|
|
|
52
|
-
//
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
51
|
+
// If content is a valid React element and has children, use its children; otherwise use the content itself
|
|
52
|
+
const children = /*#__PURE__*/React.isValidElement(_bodyContent) && _bodyContent.props.children != null ? _bodyContent.props.children : _bodyContent;
|
|
53
|
+
|
|
54
|
+
// Convert to a valid array of React elements
|
|
55
|
+
const validChildren = React.Children.toArray(children).filter(React.isValidElement);
|
|
56
|
+
|
|
57
|
+
// Determine step type and count
|
|
58
|
+
if (validChildren.length > 1) {
|
|
56
59
|
setStepType('multi');
|
|
57
|
-
setStepCount?.(
|
|
60
|
+
setStepCount?.(validChildren.length);
|
|
61
|
+
// Store content for rendering
|
|
62
|
+
setBodyChildrenData?.(validChildren);
|
|
58
63
|
} else {
|
|
59
64
|
setStepType('single');
|
|
65
|
+
setStepCount?.(1);
|
|
66
|
+
setBodyChildrenData?.(_bodyContent);
|
|
60
67
|
}
|
|
61
68
|
|
|
62
69
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
63
|
-
}, [progStep]);
|
|
70
|
+
}, [props.children, contentRenderer, progStep]);
|
|
64
71
|
React.useEffect(() => {
|
|
65
72
|
if (scrollPercent !== -1) {
|
|
66
73
|
const stepSize = bodyChildrenData && bodyChildrenData.length > 1 ? parseFloat((1 / (bodyChildrenData.length - 1)).toFixed(2)) : 0;
|
|
@@ -54,13 +54,18 @@ const InterstitialScreenFooter = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
54
54
|
}, [progStep]);
|
|
55
55
|
const handleAction = async actionType => {
|
|
56
56
|
setLoadingAction(actionType);
|
|
57
|
-
await onAction?.(actionType, {
|
|
57
|
+
const abortContinue = await onAction?.(actionType, {
|
|
58
58
|
handleGotoStep,
|
|
59
59
|
progStep,
|
|
60
60
|
stepCount,
|
|
61
61
|
disableButtonConfig
|
|
62
62
|
});
|
|
63
63
|
setLoadingAction('');
|
|
64
|
+
|
|
65
|
+
// Skip navigation if onAction explicitly returns true
|
|
66
|
+
if (abortContinue) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
64
69
|
if (actionType === 'next' || actionType === 'back') {
|
|
65
70
|
const stepDelta = actionType === 'next' ? 1 : -1;
|
|
66
71
|
const targetStep = clamp.clamp(progStep + stepDelta, progStepFloor, progStepCeil);
|
|
@@ -34,7 +34,7 @@ export interface InterstitialScreenHeaderProps {
|
|
|
34
34
|
}
|
|
35
35
|
export type EnrichedChildren = {
|
|
36
36
|
children: React.ReactNode;
|
|
37
|
-
stepTitle
|
|
37
|
+
stepTitle?: string;
|
|
38
38
|
translateWithId?: (id: string) => string;
|
|
39
39
|
};
|
|
40
40
|
declare const InterstitialScreenHeader: React.ForwardRefExoticComponent<InterstitialScreenHeaderProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -52,7 +52,7 @@ const InterstitialScreenHeader = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
52
52
|
const stepKey = `${_useId}_${child.props?.stepTitle?.replace(/\s+/g, '') || idx}`;
|
|
53
53
|
return /*#__PURE__*/React.createElement(react.ProgressStep, {
|
|
54
54
|
key: stepKey,
|
|
55
|
-
label: child.props.stepTitle
|
|
55
|
+
label: child.props.stepTitle ?? `Step ${idx + 1}`,
|
|
56
56
|
translateWithId: child.props.translateWithId
|
|
57
57
|
});
|
|
58
58
|
}
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import React, { PropsWithChildren, ReactNode } from 'react';
|
|
8
|
-
import './_interstitial-screen-view.scss';
|
|
9
8
|
export interface InterstitialScreenViewProps extends PropsWithChildren {
|
|
10
9
|
/**
|
|
11
10
|
* Provide the contents of the InterstitialScreenView.
|
|
@@ -18,13 +17,13 @@ export interface InterstitialScreenViewProps extends PropsWithChildren {
|
|
|
18
17
|
/**
|
|
19
18
|
* The label to pass to the ProgressStep component.
|
|
20
19
|
*/
|
|
21
|
-
stepTitle
|
|
20
|
+
stepTitle?: string;
|
|
22
21
|
/**
|
|
23
22
|
* Optional method that takes in a message id and returns an internationalized string.
|
|
24
23
|
*/
|
|
25
24
|
translateWithId?: (id: string) => string;
|
|
26
25
|
}
|
|
27
26
|
/**
|
|
28
|
-
* An Onboarding component intended to be used as the child elements of the InterstitialScreen component.
|
|
27
|
+
* An Onboarding component intended to be used as the child elements of the InterstitialScreen body component.
|
|
29
28
|
*/
|
|
30
29
|
export declare const InterstitialScreenView: React.ForwardRefExoticComponent<InterstitialScreenViewProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,62 @@
|
|
|
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
|
+
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
|
11
|
+
var React = require('react');
|
|
12
|
+
var index = require('../../_virtual/index.js');
|
|
13
|
+
var settings = require('../../settings.js');
|
|
14
|
+
|
|
15
|
+
// The block part of our conventional BEM class names (blockClass__E--M).
|
|
16
|
+
const blockClass = `${settings.pkg.prefix}--interstitial-screen-view`;
|
|
17
|
+
const componentName = 'InterstitialScreenView';
|
|
18
|
+
/**
|
|
19
|
+
* An Onboarding component intended to be used as the child elements of the InterstitialScreen body component.
|
|
20
|
+
*/
|
|
21
|
+
const InterstitialScreenView = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
22
|
+
let {
|
|
23
|
+
children,
|
|
24
|
+
className,
|
|
25
|
+
stepTitle,
|
|
26
|
+
translateWithId,
|
|
27
|
+
// Collect any other property values passed in.
|
|
28
|
+
...rest
|
|
29
|
+
} = _ref;
|
|
30
|
+
return /*#__PURE__*/React.createElement("div", _rollupPluginBabelHelpers.extends({}, rest, {
|
|
31
|
+
className: `${blockClass} ${className}`,
|
|
32
|
+
ref: ref
|
|
33
|
+
}), children);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
// The display name of the component, used by React. Note that displayName
|
|
37
|
+
// is used in preference to relying on function.name.
|
|
38
|
+
InterstitialScreenView.displayName = componentName;
|
|
39
|
+
|
|
40
|
+
// The types and DocGen commentary for the component props,
|
|
41
|
+
// in alphabetical order (for consistency).
|
|
42
|
+
// See https://www.npmjs.com/package/prop-types#usage.
|
|
43
|
+
InterstitialScreenView.propTypes = {
|
|
44
|
+
/**
|
|
45
|
+
* Provide the contents of the InterstitialScreenView.
|
|
46
|
+
*/
|
|
47
|
+
children: index.default.node,
|
|
48
|
+
/**
|
|
49
|
+
* Optional class name for this component.
|
|
50
|
+
*/
|
|
51
|
+
className: index.default.string,
|
|
52
|
+
/**
|
|
53
|
+
* The label to pass to the ProgressStep component.
|
|
54
|
+
*/
|
|
55
|
+
stepTitle: index.default.string.isRequired,
|
|
56
|
+
/**
|
|
57
|
+
* Optional method that takes in a message id and returns an internationalized string.
|
|
58
|
+
*/
|
|
59
|
+
translateWithId: index.default.func
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
exports.InterstitialScreenView = InterstitialScreenView;
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
export { InterstitialScreen } from './InterstitialScreen';
|
|
8
|
+
export { InterstitialScreenView } from './InterstitialScreenView';
|
|
8
9
|
export type { InterstitialScreenProps, InterstitialScreenComponent, } from './InterstitialScreen';
|
|
9
10
|
export type { disableButtonConfigType, ActionType } from './context';
|
|
10
11
|
export type { InterstitialScreenBodyProps } from './InterstitialScreenBody';
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2025, 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, { ReactNode, FC } from 'react';
|
|
8
|
+
import PropTypes from 'prop-types';
|
|
9
|
+
import { ComposedModalProps } from '@carbon/react';
|
|
10
|
+
import { TearsheetHeaderProps, TearsheetNavigationBarProps, TearsheetScrollButtonProps } from './TearsheetHeader';
|
|
11
|
+
import { TearsheetHeaderContentProps } from './TearsheetHeaderContent';
|
|
12
|
+
import { InfluencerProps, MainContentProps, SummaryContentProps, TearsheetBodyProps } from './TearsheetBody';
|
|
13
|
+
import { TearsheetHeaderActionItemProps, TearsheetHeaderActionsProps } from './TearsheetHeaderActions';
|
|
14
|
+
/**
|
|
15
|
+
* ----------
|
|
16
|
+
* Tearsheet
|
|
17
|
+
* ----------
|
|
18
|
+
*/
|
|
19
|
+
export interface TearsheetProps {
|
|
20
|
+
children?: React.ReactNode;
|
|
21
|
+
/**
|
|
22
|
+
* Specifies whether the tearsheet is currently open.
|
|
23
|
+
*/
|
|
24
|
+
open?: boolean;
|
|
25
|
+
className?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Default influencer takes 256px, this allow to override eg: 300px , 20rem
|
|
28
|
+
*/
|
|
29
|
+
influencerWidth?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Default rightContent takes 256px, this allow to override eg: 300px , 20rem
|
|
32
|
+
*/
|
|
33
|
+
summaryContentWidth?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Default to wide variant. Pass in narrow for narrow tearsheet
|
|
36
|
+
*/
|
|
37
|
+
variant?: 'wide' | 'narrow';
|
|
38
|
+
/**
|
|
39
|
+
* Optional prop that allows you to pass any component.
|
|
40
|
+
*/
|
|
41
|
+
decorator?: ReactNode;
|
|
42
|
+
/**
|
|
43
|
+
* Specify the CSS selectors that match the floating menus.
|
|
44
|
+
*
|
|
45
|
+
* See https://react.carbondesignsystem.com/?path=/docs/components-composedmodal--overview#focus-management
|
|
46
|
+
*/
|
|
47
|
+
selectorsFloatingMenus?: string[];
|
|
48
|
+
/**
|
|
49
|
+
* The aria label applied to the tearsheet
|
|
50
|
+
*/
|
|
51
|
+
ariaLabel?: string;
|
|
52
|
+
/**
|
|
53
|
+
* An optional handler that is called when the user closes the tearsheet (by
|
|
54
|
+
* clicking the close button, if enabled, or clicking outside, if enabled).
|
|
55
|
+
* Returning `false` here prevents the modal from closing.
|
|
56
|
+
*/
|
|
57
|
+
onClose?: () => void;
|
|
58
|
+
/**
|
|
59
|
+
* Specify a CSS selector that matches the DOM element that should be
|
|
60
|
+
* focused when the Modal opens.
|
|
61
|
+
*/
|
|
62
|
+
selectorPrimaryFocus?: PropTypes.string;
|
|
63
|
+
/**
|
|
64
|
+
* The DOM element that the tearsheet should be rendered within. Defaults to document.body.
|
|
65
|
+
*/
|
|
66
|
+
portalTarget?: HTMLElement;
|
|
67
|
+
}
|
|
68
|
+
export type TearsheetComponentType = React.ForwardRefExoticComponent<TearsheetProps & React.RefAttributes<HTMLDivElement>> & {
|
|
69
|
+
Header: FC<TearsheetHeaderProps>;
|
|
70
|
+
HeaderContent: FC<TearsheetHeaderContentProps>;
|
|
71
|
+
Influencer: FC<InfluencerProps>;
|
|
72
|
+
NavigationBar: FC<TearsheetNavigationBarProps>;
|
|
73
|
+
ScrollButton: FC<TearsheetScrollButtonProps>;
|
|
74
|
+
HeaderActions: FC<TearsheetHeaderActionsProps>;
|
|
75
|
+
HeaderActionItem: FC<TearsheetHeaderActionItemProps>;
|
|
76
|
+
MainContent: FC<MainContentProps>;
|
|
77
|
+
SummaryContent: FC<SummaryContentProps>;
|
|
78
|
+
Body: FC<TearsheetBodyProps>;
|
|
79
|
+
Footer: FC<FooterProps>;
|
|
80
|
+
} & ComposedModalProps;
|
|
81
|
+
export declare const Tearsheet: TearsheetComponentType;
|
|
82
|
+
export interface FooterProps {
|
|
83
|
+
children: ReactNode;
|
|
84
|
+
className?: string;
|
|
85
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
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
|
+
var _rollupPluginBabelHelpers = require('../../../_virtual/_rollupPluginBabelHelpers.js');
|
|
11
|
+
var React = require('react');
|
|
12
|
+
var cx = require('classnames');
|
|
13
|
+
var react = require('@carbon/react');
|
|
14
|
+
var context = require('./context.js');
|
|
15
|
+
var TearsheetHeader = require('./TearsheetHeader.js');
|
|
16
|
+
var TearsheetHeaderContent = require('./TearsheetHeaderContent.js');
|
|
17
|
+
var TearsheetBody = require('./TearsheetBody.js');
|
|
18
|
+
var TearsheetHeaderActions = require('./TearsheetHeaderActions.js');
|
|
19
|
+
var layout = require('@carbon/layout');
|
|
20
|
+
var usePortalTarget = require('../../../global/js/hooks/usePortalTarget.js');
|
|
21
|
+
var useMatchMedia = require('../../../global/js/hooks/useMatchMedia.js');
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* ----------
|
|
25
|
+
* Tearsheet
|
|
26
|
+
* ----------
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
const Tearsheet = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
30
|
+
let {
|
|
31
|
+
children,
|
|
32
|
+
variant = 'wide',
|
|
33
|
+
selectorsFloatingMenus = [],
|
|
34
|
+
className,
|
|
35
|
+
influencerWidth,
|
|
36
|
+
summaryContentWidth,
|
|
37
|
+
ariaLabel,
|
|
38
|
+
onClose,
|
|
39
|
+
selectorPrimaryFocus,
|
|
40
|
+
open,
|
|
41
|
+
portalTarget,
|
|
42
|
+
...rest
|
|
43
|
+
} = _ref;
|
|
44
|
+
const carbonPrefix = react.usePrefix();
|
|
45
|
+
const localRef = React.useRef(undefined);
|
|
46
|
+
const bodyRef = React.useRef(undefined);
|
|
47
|
+
const modalRef = ref || localRef;
|
|
48
|
+
const smMediaQuery = `(max-width: ${layout.breakpoints.md.width})`;
|
|
49
|
+
const isSm = useMatchMedia.useMatchMedia(smMediaQuery) || variant === 'narrow';
|
|
50
|
+
const [hasCloseIcon, setHasCloseIcon] = React.useState(true);
|
|
51
|
+
const [fullyCollapsed, setFullyCollapsed] = React.useState(false);
|
|
52
|
+
const [disableHeaderCollapse, setDisableHeaderCollapse] = React.useState(false);
|
|
53
|
+
const arr = React.Children.toArray(children);
|
|
54
|
+
const header = arr.find(child => child.type === TearsheetHeader.default);
|
|
55
|
+
const influencer = arr.find(child => child.type === TearsheetBody.Influencer);
|
|
56
|
+
const body = arr.find(child => child.type === TearsheetBody.default);
|
|
57
|
+
const footer = arr.find(child => child.type === Footer);
|
|
58
|
+
const renderPortalUse = usePortalTarget.usePortalTarget(portalTarget);
|
|
59
|
+
React.useLayoutEffect(() => {
|
|
60
|
+
const AILabelWidth = modalRef.current?.querySelector(`.${carbonPrefix}--ai-label`)?.clientWidth ?? 0;
|
|
61
|
+
const headerActionMarginRight = AILabelWidth + 24 + (isSm ? 8 : 0); // 24 is to compeNsate for close button
|
|
62
|
+
document.documentElement.style.setProperty('--tearsheet-header-action-offset', `${headerActionMarginRight}px`);
|
|
63
|
+
if (influencerWidth) {
|
|
64
|
+
document.documentElement.style.setProperty('--tearsheet-influencer-width', `${influencerWidth}`);
|
|
65
|
+
}
|
|
66
|
+
if (summaryContentWidth) {
|
|
67
|
+
document.documentElement.style.setProperty('--tearsheet-summary-content-width', `${summaryContentWidth}`);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
71
|
+
}, [isSm]);
|
|
72
|
+
return renderPortalUse(/*#__PURE__*/React.createElement(context.TearsheetContext.Provider, {
|
|
73
|
+
value: {
|
|
74
|
+
hasCloseIcon,
|
|
75
|
+
setHasCloseIcon,
|
|
76
|
+
fullyCollapsed,
|
|
77
|
+
setFullyCollapsed,
|
|
78
|
+
onClose,
|
|
79
|
+
disableHeaderCollapse,
|
|
80
|
+
setDisableHeaderCollapse,
|
|
81
|
+
variant,
|
|
82
|
+
isSm
|
|
83
|
+
}
|
|
84
|
+
}, /*#__PURE__*/React.createElement(react.unstable_FeatureFlags, {
|
|
85
|
+
enableExperimentalFocusWrapWithoutSentinels: true
|
|
86
|
+
}, /*#__PURE__*/React.createElement(react.ComposedModal, _rollupPluginBabelHelpers.extends({}, rest, {
|
|
87
|
+
"aria-label": ariaLabel,
|
|
88
|
+
className: cx(context.blockClass, className, {
|
|
89
|
+
[`${context.blockClass}--wide`]: variant === 'wide',
|
|
90
|
+
[`${context.blockClass}--narrow`]: variant === 'narrow',
|
|
91
|
+
[`${context.blockClass}--has-ai-label`]: !!rest.decorator && rest.decorator['type']?.displayName === 'AILabel',
|
|
92
|
+
[`${context.blockClass}--has-decorator`]: !!rest.decorator && rest.decorator['type']?.displayName !== 'AILabel',
|
|
93
|
+
[`${context.blockClass}--has-close`]: hasCloseIcon
|
|
94
|
+
}),
|
|
95
|
+
containerClassName: cx(`${context.blockClass}__container`, {}),
|
|
96
|
+
onClose,
|
|
97
|
+
open,
|
|
98
|
+
selectorPrimaryFocus,
|
|
99
|
+
ref: modalRef,
|
|
100
|
+
selectorsFloatingMenus: [`.${carbonPrefix}--overflow-menu-options`, `.${carbonPrefix}--tooltip`, '.flatpickr-calendar', `.${context.blockClass}__container`, `.${carbonPrefix}--menu`, ...selectorsFloatingMenus],
|
|
101
|
+
isFullWidth: true,
|
|
102
|
+
size: variant === 'narrow' ? 'sm' : ''
|
|
103
|
+
}), header, /*#__PURE__*/React.createElement(react.ModalBody, {
|
|
104
|
+
className: `${context.blockClass}__body-layout`,
|
|
105
|
+
ref: bodyRef
|
|
106
|
+
}, influencer, body, footer)))));
|
|
107
|
+
});
|
|
108
|
+
const Footer = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
109
|
+
let {
|
|
110
|
+
children
|
|
111
|
+
} = _ref2;
|
|
112
|
+
return /*#__PURE__*/React.createElement(react.Layer, {
|
|
113
|
+
as: "footer",
|
|
114
|
+
withBackground: true,
|
|
115
|
+
className: `${context.blockClass}__footer`,
|
|
116
|
+
ref: ref
|
|
117
|
+
}, children);
|
|
118
|
+
});
|
|
119
|
+
Tearsheet.Header = TearsheetHeader.default;
|
|
120
|
+
Tearsheet.HeaderContent = TearsheetHeaderContent.default;
|
|
121
|
+
Tearsheet.Body = TearsheetBody.default;
|
|
122
|
+
Tearsheet.Influencer = TearsheetBody.Influencer;
|
|
123
|
+
Tearsheet.MainContent = TearsheetBody.MainContent;
|
|
124
|
+
Tearsheet.SummaryContent = TearsheetBody.SummaryContent;
|
|
125
|
+
Tearsheet.Footer = Footer;
|
|
126
|
+
Tearsheet.NavigationBar = TearsheetHeader.TearsheetNavigationBar;
|
|
127
|
+
Tearsheet.ScrollButton = TearsheetHeader.TearsheetScrollButton;
|
|
128
|
+
Tearsheet.HeaderActions = TearsheetHeaderActions.TearsheetHeaderActions;
|
|
129
|
+
Tearsheet.HeaderActionItem = TearsheetHeaderActions.TearsheetHeaderActionItem;
|
|
130
|
+
|
|
131
|
+
exports.Tearsheet = Tearsheet;
|