@carbon/ibm-products 2.78.0 → 2.79.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
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Copyright IBM Corp. 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 } from 'react';
8
+ /**
9
+ * ----------------
10
+ * TearsheetBody
11
+ * ----------------
12
+ */
13
+ export interface TearsheetBodyProps {
14
+ /**
15
+ * Optional static content for body
16
+ */
17
+ children?: ReactNode;
18
+ /**
19
+ * Provide an optional class to be applied to the containing node.
20
+ */
21
+ className?: string;
22
+ }
23
+ declare const TearsheetBody: React.ForwardRefExoticComponent<TearsheetBodyProps & React.RefAttributes<HTMLDivElement>>;
24
+ export interface MainContentProps {
25
+ children: ReactNode;
26
+ className?: string;
27
+ }
28
+ /**
29
+ * ----------------
30
+ * MainContent
31
+ * ----------------
32
+ */
33
+ export declare const MainContent: React.ForwardRefExoticComponent<MainContentProps & React.RefAttributes<HTMLDivElement>>;
34
+ /**
35
+ * ----------------
36
+ * SummaryContent
37
+ * ----------------
38
+ */
39
+ export interface SummaryContentProps {
40
+ children: ReactNode;
41
+ className?: string;
42
+ /**
43
+ * In mobile screens right side details section wont be visible by default. This prop can be toggled to open/close right panel in this case.
44
+ */
45
+ summaryPanelOpen?: boolean;
46
+ /**
47
+ * Specify a handler for closing the side panel.
48
+ * This handler closes the modal, e.g. changing `open` prop.
49
+ */
50
+ onSummaryPanelClose?(): void;
51
+ }
52
+ export declare const SummaryContent: React.ForwardRefExoticComponent<SummaryContentProps & React.RefAttributes<HTMLDivElement>>;
53
+ export interface InfluencerProps {
54
+ children: ReactNode;
55
+ className?: string;
56
+ /**
57
+ * In mobile screens right side details section wont be visible by default. This prop can be toggled to open/close right panel in this case.
58
+ */
59
+ influencerPanelOpen?: boolean;
60
+ /**
61
+ * Specify a handler for closing the side panel.
62
+ * This handler closes the modal, e.g. changing `open` prop.
63
+ */
64
+ onInfluencerPanelClose?(): void;
65
+ }
66
+ export declare const Influencer: React.ForwardRefExoticComponent<InfluencerProps & React.RefAttributes<HTMLDivElement>>;
67
+ export default TearsheetBody;
@@ -0,0 +1,121 @@
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, useContext, useRef } from 'react';
10
+ import { blockClass, TearsheetContext } from './context.js';
11
+ import { SidePanel } from '../../SidePanel/SidePanel.js';
12
+ import { Layer } from '@carbon/react';
13
+ import { useCollapsible } from '../../../global/js/hooks/useCollapsible.js';
14
+
15
+ /**
16
+ * ----------------
17
+ * TearsheetBody
18
+ * ----------------
19
+ */
20
+
21
+ const TearsheetBody = /*#__PURE__*/forwardRef((_ref, ref) => {
22
+ let {
23
+ children,
24
+ className
25
+ } = _ref;
26
+ return /*#__PURE__*/React__default.createElement("div", {
27
+ className: `${blockClass}__body ${className}`,
28
+ ref: ref
29
+ }, children);
30
+ });
31
+ /**
32
+ * ----------------
33
+ * MainContent
34
+ * ----------------
35
+ */
36
+ const MainContent = /*#__PURE__*/forwardRef((_ref2, ref) => {
37
+ let {
38
+ children,
39
+ className,
40
+ ...rest
41
+ } = _ref2;
42
+ const localRef = useRef(null);
43
+ const mainContentRef = ref || localRef;
44
+ const {
45
+ setFullyCollapsed,
46
+ disableHeaderCollapse
47
+ } = useContext(TearsheetContext);
48
+ const container = typeof mainContentRef === 'function' ? null : mainContentRef?.current ?? null;
49
+ const collapseHeader = collapse => {
50
+ if (container) {
51
+ if (collapse) {
52
+ const canScroll = container.scrollHeight > container.clientHeight; // collapse header only when there is scroll
53
+
54
+ if (canScroll) {
55
+ setFullyCollapsed?.(true);
56
+ }
57
+ } else if (container.scrollTop === 0) {
58
+ // expand header when scroll reaches top
59
+ setFullyCollapsed?.(false);
60
+ }
61
+ }
62
+ };
63
+ useCollapsible({
64
+ container,
65
+ triggerCollapse: collapseHeader,
66
+ disableHeaderCollapse
67
+ });
68
+ return /*#__PURE__*/React__default.createElement(Layer, _extends({
69
+ withBackground: true,
70
+ className: `${blockClass}__main-content ${className}`,
71
+ ref: mainContentRef
72
+ }, rest), children);
73
+ });
74
+
75
+ /**
76
+ * ----------------
77
+ * SummaryContent
78
+ * ----------------
79
+ */
80
+
81
+ const SummaryContent = /*#__PURE__*/forwardRef((_ref3, ref) => {
82
+ let {
83
+ children,
84
+ className,
85
+ summaryPanelOpen = false,
86
+ onSummaryPanelClose
87
+ } = _ref3;
88
+ const {
89
+ isSm
90
+ } = useContext(TearsheetContext);
91
+ return !isSm ? /*#__PURE__*/React__default.createElement("div", {
92
+ className: `${blockClass}__summary-content ${className}`,
93
+ ref: ref
94
+ }, /*#__PURE__*/React__default.createElement("aside", null, children)) : /*#__PURE__*/React__default.createElement(SidePanel, {
95
+ size: "sm",
96
+ open: summaryPanelOpen,
97
+ onRequestClose: onSummaryPanelClose
98
+ }, children);
99
+ });
100
+ const Influencer = /*#__PURE__*/forwardRef((_ref4, ref) => {
101
+ let {
102
+ children,
103
+ className,
104
+ influencerPanelOpen = false,
105
+ onInfluencerPanelClose
106
+ } = _ref4;
107
+ const {
108
+ isSm
109
+ } = useContext(TearsheetContext);
110
+ return !isSm ? /*#__PURE__*/React__default.createElement("aside", {
111
+ className: `${blockClass}__influencer ${className}`,
112
+ ref: ref
113
+ }, children) : /*#__PURE__*/React__default.createElement(SidePanel, {
114
+ size: "sm",
115
+ open: influencerPanelOpen,
116
+ onRequestClose: onInfluencerPanelClose,
117
+ placement: "left"
118
+ }, children);
119
+ });
120
+
121
+ export { Influencer, MainContent, SummaryContent, TearsheetBody as default };
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Copyright IBM Corp. 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 { IconButtonProps } from '@carbon/react';
8
+ import React, { ReactNode } from 'react';
9
+ /**
10
+ * ----------------
11
+ * TearsheetHeader
12
+ * ----------------
13
+ */
14
+ export interface TearsheetHeaderProps {
15
+ /**
16
+ * Provide the optional content for header section and will be render after header titles and before progress indicator.
17
+ * People can make use of this if they want to have custom header.
18
+ */
19
+ children?: React.ReactNode;
20
+ /**
21
+ * The accessibility title for the close icon (if shown).
22
+ *
23
+ * **Note:** This prop is only required if a close icon is shown, i.e. if
24
+ * there are a no navigation actions and/or hasCloseIcon is true.
25
+ */
26
+ closeIconDescription?: string;
27
+ /**
28
+ * Enable a close icon ('x') in the header area of the tearsheet. By default,
29
+ * (when this prop is omitted, or undefined or null) a tearsheet does not
30
+ * display a close icon if there are navigation actions ("transactional
31
+ * tearsheet") and displays one if there are no navigation actions ("passive
32
+ * tearsheet"), and that behavior can be overridden if required by setting
33
+ * this prop to either true or false.
34
+ */
35
+ hideCloseButton?: boolean;
36
+ className?: string;
37
+ /**
38
+ * Default header collapse/expand while scrolling the main content can bd disabled by setting this
39
+ */
40
+ disableHeaderCollapse?: boolean;
41
+ }
42
+ declare const TearsheetHeader: React.ForwardRefExoticComponent<TearsheetHeaderProps & React.RefAttributes<HTMLDivElement>>;
43
+ export default TearsheetHeader;
44
+ /**
45
+ * ----------------
46
+ * TearsheetNavigationBar
47
+ * ----------------
48
+ */
49
+ export interface TearsheetNavigationBarProps {
50
+ children: ReactNode;
51
+ scroller?: React.ReactNode;
52
+ className?: string;
53
+ }
54
+ export declare const TearsheetNavigationBar: React.ForwardRefExoticComponent<TearsheetNavigationBarProps & React.RefAttributes<HTMLDivElement>>;
55
+ /**
56
+ * ----------------
57
+ * TearsheetScrollButton
58
+ * ----------------
59
+ */
60
+ export interface TearsheetScrollButtonProps extends IconButtonProps {
61
+ collapseText?: string;
62
+ expandText?: string;
63
+ className?: string;
64
+ }
65
+ export declare const TearsheetScrollButton: React.ForwardRefExoticComponent<TearsheetScrollButtonProps & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,121 @@
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 { ModalHeader, IconButton } from '@carbon/react';
10
+ import React__default, { useContext, useRef, useEffect } from 'react';
11
+ import cx from 'classnames';
12
+ import { TearsheetContext, blockClass } from './context.js';
13
+ import { ChevronUp } from '@carbon/react/icons';
14
+
15
+ /**
16
+ * ----------------
17
+ * TearsheetHeader
18
+ * ----------------
19
+ */
20
+
21
+ const TearsheetHeader = /*#__PURE__*/React__default.forwardRef((props, ref) => {
22
+ const {
23
+ children,
24
+ closeIconDescription,
25
+ hideCloseButton = false,
26
+ className,
27
+ disableHeaderCollapse,
28
+ ...rest
29
+ } = props;
30
+ const {
31
+ setHasCloseIcon,
32
+ fullyCollapsed,
33
+ onClose,
34
+ setDisableHeaderCollapse
35
+ } = useContext(TearsheetContext);
36
+ const localRef = useRef(undefined);
37
+ const headerRef = ref || localRef;
38
+ useEffect(() => {
39
+ setHasCloseIcon?.(!!hideCloseButton);
40
+ }, [hideCloseButton, setHasCloseIcon]);
41
+ useEffect(() => {
42
+ setDisableHeaderCollapse?.(!!disableHeaderCollapse);
43
+ }, [disableHeaderCollapse, setDisableHeaderCollapse]);
44
+ return /*#__PURE__*/React__default.createElement(ModalHeader, _extends({
45
+ ref: headerRef,
46
+ className: cx(`${blockClass}__header`, {
47
+ [`${className}`]: true,
48
+ [`${blockClass}__header--with-close-icon`]: !!hideCloseButton,
49
+ [`${blockClass}__header-collapsed`]: fullyCollapsed
50
+ }),
51
+ closeClassName: cx({
52
+ [`${blockClass}__header--no-close-icon`]: hideCloseButton
53
+ }),
54
+ closeModal: onClose,
55
+ iconDescription: closeIconDescription
56
+ }, rest), children);
57
+ });
58
+
59
+ /**
60
+ * ----------------
61
+ * TearsheetNavigationBar
62
+ * ----------------
63
+ */
64
+
65
+ const TearsheetNavigationBar = /*#__PURE__*/React__default.forwardRef((props, ref) => {
66
+ const {
67
+ children,
68
+ scroller,
69
+ className,
70
+ ...rest
71
+ } = props;
72
+ return /*#__PURE__*/React__default.createElement("div", _extends({
73
+ className: `${blockClass}__navigation-bar ${className}`
74
+ }, rest), children, scroller);
75
+ });
76
+
77
+ /**
78
+ * ----------------
79
+ * TearsheetScrollButton
80
+ * ----------------
81
+ */
82
+
83
+ const TearsheetScrollButton = /*#__PURE__*/React__default.forwardRef(function PageHeaderExpander(_ref, ref) {
84
+ let {
85
+ className,
86
+ children,
87
+ label,
88
+ onClick,
89
+ collapseText = 'Collapse',
90
+ expandText = 'Expand',
91
+ ...other
92
+ } = _ref;
93
+ const {
94
+ fullyCollapsed,
95
+ setFullyCollapsed
96
+ } = React__default.useContext(TearsheetContext);
97
+ const handleScroller = isFullyCollapsed => {
98
+ setFullyCollapsed?.(!isFullyCollapsed);
99
+ };
100
+ return /*#__PURE__*/React__default.createElement("span", {
101
+ className: `${blockClass}__scroller-container ${className}`
102
+ }, /*#__PURE__*/React__default.createElement(IconButton, _extends({
103
+ ref: ref,
104
+ label: fullyCollapsed ? expandText : collapseText,
105
+ size: "md",
106
+ kind: "ghost",
107
+ autoAlign: true
108
+ }, other, {
109
+ onClick: event => {
110
+ onClick?.(event);
111
+ handleScroller(!!fullyCollapsed);
112
+ },
113
+ className: cx(className, `${blockClass}__scroller-button`)
114
+ }), /*#__PURE__*/React__default.createElement(ChevronUp, {
115
+ className: cx(`${blockClass}__scroller-button-icon`, {
116
+ [`${blockClass}__scroller-button-icon-collapsed`]: fullyCollapsed
117
+ })
118
+ })));
119
+ });
120
+
121
+ export { TearsheetNavigationBar, TearsheetScrollButton, TearsheetHeader as default };
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Copyright IBM Corp. 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 { MenuButtonProps } from '@carbon/react';
8
+ import React, { ReactNode } from 'react';
9
+ /**
10
+ * ----------------
11
+ * TearsheetHeaderActions
12
+ * ----------------
13
+ */
14
+ type EnhancedChild = React.ReactElement<{
15
+ id: string;
16
+ menuItemLabel: string;
17
+ }>;
18
+ export interface TearsheetHeaderActionsProps {
19
+ /**
20
+ * Provide child elements to be rendered inside TearsheetHeaderActions.
21
+ */
22
+ children: EnhancedChild[];
23
+ /**
24
+ * Specify an optional className to be added to your TearsheetHeaderActions
25
+ */
26
+ className?: string;
27
+ /**
28
+ * The PageHeaderContent's page actions collapsible Menu button label
29
+ */
30
+ menuButtonProps?: MenuButtonProps;
31
+ }
32
+ export declare const TearsheetHeaderActions: ({ className, children, menuButtonProps, }: TearsheetHeaderActionsProps) => React.JSX.Element;
33
+ /**
34
+ * ----------------
35
+ * TearsheetHeaderActionsItem
36
+ * ----------------
37
+ */
38
+ export interface TearsheetHeaderActionItemProps {
39
+ /**
40
+ * Provide child elements to be rendered inside TearsheetHeaderActions.
41
+ */
42
+ children: ReactNode;
43
+ /**
44
+ * Specify an optional className to be added to your TearsheetHeaderActions
45
+ */
46
+ className?: string;
47
+ /**
48
+ * The PageHeaderContent's page actions collapsible Menu button label
49
+ */
50
+ overflowItemLabel?: string;
51
+ id?: string;
52
+ }
53
+ export declare const TearsheetHeaderActionItem: ({ children, className, }: TearsheetHeaderActionItemProps) => React.JSX.Element;
54
+ export {};
@@ -0,0 +1,101 @@
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 { MenuButton, MenuItem } from '@carbon/react';
10
+ import React__default, { useRef, useState, useLayoutEffect } from 'react';
11
+ import { blockClass } from './context.js';
12
+ import { createOverflowHandler } from '@carbon/utilities';
13
+
14
+ /**
15
+ * ----------------
16
+ * TearsheetHeaderActions
17
+ * ----------------
18
+ */
19
+
20
+ const TearsheetHeaderActions = _ref => {
21
+ let {
22
+ className,
23
+ children,
24
+ menuButtonProps
25
+ } = _ref;
26
+ const containerRef = useRef(null);
27
+ const offsetRef = useRef(null);
28
+ const [menuButtonVisibility, setMenuButtonVisibility] = useState(false);
29
+ const [hiddenItems, setHiddenItems] = useState([]);
30
+ const hasOtherChildType = useRef(false);
31
+
32
+ // need to set the grid columns width based on the menu button's width
33
+ // to avoid overlapping when resizing
34
+ useLayoutEffect(() => {
35
+ if (menuButtonVisibility && offsetRef.current) {
36
+ const width = offsetRef.current.offsetWidth;
37
+ document.documentElement.style.setProperty('--tearsheet-header-title-grid-width', `${width}px`);
38
+ }
39
+ }, [menuButtonVisibility]);
40
+ const items = React__default.Children.toArray(children).filter(child => {
41
+ if (/*#__PURE__*/React__default.isValidElement(child) && child.type !== TearsheetHeaderActionItem) {
42
+ hasOtherChildType.current = true;
43
+ }
44
+ return /*#__PURE__*/React__default.isValidElement(child);
45
+ });
46
+ useLayoutEffect(() => {
47
+ //Menu button will be rendered only if they pass the items in TearsheetHeaderActionItem
48
+ if (!containerRef.current || hasOtherChildType.current) {
49
+ return;
50
+ }
51
+ createOverflowHandler({
52
+ container: containerRef.current,
53
+ onChange: (visible, hidden) => {
54
+ setHiddenItems(items?.slice(visible.length));
55
+ if (hidden.length > 0) {
56
+ setMenuButtonVisibility(true);
57
+ }
58
+ }
59
+ });
60
+ // eslint-disable-next-line react-hooks/exhaustive-deps
61
+ }, [containerRef.current]);
62
+ return /*#__PURE__*/React__default.createElement("div", {
63
+ className: `${blockClass}__content__header-actions ${className}`,
64
+ ref: containerRef
65
+ }, children, !hasOtherChildType.current && /*#__PURE__*/React__default.createElement("span", {
66
+ "data-offset": true,
67
+ "data-hidden": true,
68
+ ref: offsetRef
69
+ }, /*#__PURE__*/React__default.createElement(MenuButton, _extends({
70
+ size: "sm"
71
+ }, menuButtonProps), hiddenItems.map(item => {
72
+ if (! /*#__PURE__*/React__default.isValidElement(item)) {
73
+ return null;
74
+ }
75
+ const childProps = item.props;
76
+ return /*#__PURE__*/React__default.createElement(MenuItem, {
77
+ renderIcon: childProps?.children?.props?.renderIcon ?? undefined,
78
+ key: childProps.id,
79
+ onClick: childProps?.children?.props?.onClick,
80
+ label: childProps.overflowItemLabel
81
+ });
82
+ }))));
83
+ };
84
+
85
+ /**
86
+ * ----------------
87
+ * TearsheetHeaderActionsItem
88
+ * ----------------
89
+ */
90
+
91
+ const TearsheetHeaderActionItem = _ref2 => {
92
+ let {
93
+ children,
94
+ className
95
+ } = _ref2;
96
+ return /*#__PURE__*/React__default.createElement("div", {
97
+ className: `${blockClass}__header-action-item ${className}`
98
+ }, children);
99
+ };
100
+
101
+ export { TearsheetHeaderActionItem, TearsheetHeaderActions };
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Copyright IBM Corp. 2025
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import React from 'react';
8
+ import { CarbonIconType } from '@carbon/react/icons';
9
+ export interface TearsheetHeaderContentProps {
10
+ /**
11
+ * Provide the optional content for header section and will be render after header titles and before progress indicator.
12
+ * People can make use of this if they want to have custom header.
13
+ */
14
+ children?: React.ReactNode;
15
+ title: string;
16
+ label?: string;
17
+ description?: string;
18
+ descriptionExpandLabel?: string;
19
+ descriptionCollapseLabel?: string;
20
+ titleIcon?: CarbonIconType;
21
+ titleIconPosition?: 'leading' | 'trailing';
22
+ /**
23
+ * The PageHeaderContent's page actions
24
+ */
25
+ headerActions?: React.ReactNode;
26
+ }
27
+ declare const TearsheetHeaderContent: React.ForwardRefExoticComponent<TearsheetHeaderContentProps & React.RefAttributes<HTMLDivElement>>;
28
+ export default TearsheetHeaderContent;
@@ -0,0 +1,67 @@
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 React__default, { useContext } from 'react';
9
+ import cx from 'classnames';
10
+ import { TearsheetContext, blockClass } from './context.js';
11
+ import { TruncatedText } from '../../TruncatedText/TruncatedText.js';
12
+
13
+ const TearsheetHeaderContent = /*#__PURE__*/React__default.forwardRef((props, ref) => {
14
+ const {
15
+ children,
16
+ label,
17
+ title,
18
+ description,
19
+ descriptionExpandLabel = 'Read more',
20
+ descriptionCollapseLabel = 'Read less',
21
+ titleIcon: Icon,
22
+ titleIconPosition = 'leading',
23
+ headerActions,
24
+ ...rest
25
+ } = props;
26
+ const {
27
+ isSm
28
+ } = useContext(TearsheetContext);
29
+ return /*#__PURE__*/React__default.createElement("div", {
30
+ className: `${blockClass}__header-content-wrapper`,
31
+ ref: ref
32
+ }, /*#__PURE__*/React__default.createElement("div", {
33
+ className: `${blockClass}__header-content`
34
+ }, /*#__PURE__*/React__default.createElement("p", {
35
+ className: `${blockClass}__header-label`
36
+ }, label), /*#__PURE__*/React__default.createElement("div", {
37
+ className: `${blockClass}__content__title-wrapper`
38
+ }, /*#__PURE__*/React__default.createElement("h2", {
39
+ className: cx(`${blockClass}__header-title`, {
40
+ [`${blockClass}__leading-icon`]: Icon && titleIconPosition === 'leading'
41
+ }, {
42
+ [`${blockClass}__trailing-icon`]: Icon && titleIconPosition === 'trailing'
43
+ })
44
+ }, !isSm && Icon && /*#__PURE__*/React__default.createElement(Icon, {
45
+ size: 32
46
+ }), /*#__PURE__*/React__default.createElement(TruncatedText, {
47
+ id: `${blockClass}__header-title__truncatedText`,
48
+ className: `${blockClass}__content__title`,
49
+ align: "bottom",
50
+ autoAlign: true,
51
+ value: title
52
+ }))), /*#__PURE__*/React__default.createElement("div", {
53
+ className: `${blockClass}__header-description`
54
+ }, /*#__PURE__*/React__default.createElement(TruncatedText, {
55
+ id: `${blockClass}__header-description__truncatedText`,
56
+ expandLabel: descriptionExpandLabel,
57
+ collapseLabel: descriptionCollapseLabel,
58
+ value: description,
59
+ type: "expand"
60
+ })), children && /*#__PURE__*/React__default.createElement("div", {
61
+ className: `${blockClass}__header-content--extra`
62
+ }, children)), headerActions && /*#__PURE__*/React__default.createElement("div", {
63
+ className: `${blockClass}__header-actions`
64
+ }, headerActions));
65
+ });
66
+
67
+ export { TearsheetHeaderContent as default };
@@ -0,0 +1,22 @@
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 } from 'react';
8
+ import { StepState } from '../../../StepFlow';
9
+ interface Props {
10
+ children?: ReactNode;
11
+ influencer?: ((a: StepState) => ReactNode) | null;
12
+ open?: boolean;
13
+ onClose?: () => void;
14
+ title?: ReactNode;
15
+ hasCloseIcon?: boolean;
16
+ closeIconDescription?: string;
17
+ selectorPrimaryFocus?: string;
18
+ setOpen?: (open: boolean) => void;
19
+ progressIndicator?: 'vertical' | 'horizontal';
20
+ }
21
+ export declare const TearsheetWithSteps: ({ children, open, setOpen, onClose, influencer, title, hasCloseIcon, closeIconDescription, selectorPrimaryFocus, progressIndicator, ...rest }: Props) => React.JSX.Element;
22
+ export {};
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Copyright IBM Corp. 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
+ * -------------
9
+ * Context setup
10
+ * -------------
11
+ */
12
+ interface TearsheetContextType {
13
+ hasCloseIcon: boolean;
14
+ setHasCloseIcon?: (value: boolean) => void;
15
+ fullyCollapsed: boolean;
16
+ setFullyCollapsed?: (value: boolean) => void;
17
+ refs?: any;
18
+ onClose?: () => void;
19
+ disableHeaderCollapse?: boolean;
20
+ setDisableHeaderCollapse?: (value: boolean) => void;
21
+ variant: 'wide' | 'narrow';
22
+ isSm: boolean;
23
+ }
24
+ export declare const TearsheetContext: import("react").Context<TearsheetContextType>;
25
+ export declare const blockClass: string;
26
+ export {};