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