@carbon/ibm-products 2.84.0 → 2.85.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/css/index-full-carbon.css +18 -13
- 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 +18 -13
- 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 +18 -13
- 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 +18 -13
- 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/Coachmark/next/Coachmark/ContentHeader.js +2 -1
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +12 -1
- package/es/components/CreateTearsheet/CreateTearsheet.d.ts +1 -0
- package/es/components/CreateTearsheet/CreateTearsheet.js +3 -0
- package/es/components/CreateTearsheet/CreateTearsheetStep.d.ts +4 -0
- package/es/components/CreateTearsheet/CreateTearsheetStep.js +7 -1
- package/es/components/EditInPlace/EditInPlace.d.ts +12 -1
- package/es/components/EditInPlace/EditInPlace.js +52 -31
- package/es/components/ImportModal/ImportModal.d.ts +5 -1
- package/es/components/ImportModal/ImportModal.js +12 -6
- package/es/components/PageHeader/next/PageHeader.d.ts +15 -238
- package/es/components/PageHeader/next/PageHeader.js +25 -637
- package/es/components/PageHeader/next/PageHeaderBreadcrumbBar.d.ts +41 -0
- package/es/components/PageHeader/next/PageHeaderBreadcrumbBar.js +74 -0
- package/es/components/PageHeader/next/PageHeaderBreadcrumbOverflow.d.ts +12 -0
- package/es/components/PageHeader/next/PageHeaderBreadcrumbOverflow.js +82 -0
- package/es/components/PageHeader/next/PageHeaderContent.d.ts +39 -0
- package/es/components/PageHeader/next/PageHeaderContent.js +129 -0
- package/es/components/PageHeader/next/PageHeaderContentPageActions.d.ts +52 -0
- package/es/components/PageHeader/next/PageHeaderContentPageActions.js +126 -0
- package/es/components/PageHeader/next/PageHeaderContentText.d.ts +44 -0
- package/es/components/PageHeader/next/PageHeaderContentText.js +54 -0
- package/es/components/PageHeader/next/PageHeaderHeroImage.d.ts +36 -0
- package/es/components/PageHeader/next/PageHeaderHeroImage.js +62 -0
- package/es/components/PageHeader/next/PageHeaderScrollButton.d.ts +13 -0
- package/es/components/PageHeader/next/PageHeaderScrollButton.js +73 -0
- package/es/components/PageHeader/next/PageHeaderTabBar.d.ts +19 -0
- package/es/components/PageHeader/next/PageHeaderTabBar.js +66 -0
- package/es/components/PageHeader/next/PageHeaderTagOverflow.d.ts +13 -0
- package/es/components/PageHeader/next/PageHeaderTagOverflow.js +68 -0
- package/es/components/PageHeader/next/PageHeaderTitleBreadcrumb.d.ts +9 -0
- package/es/components/PageHeader/next/PageHeaderTitleBreadcrumb.js +43 -0
- package/es/components/PageHeader/next/index.d.ts +3 -2
- package/es/components/PageHeader/next/index.js +11 -1
- package/es/global/js/hooks/useCreateComponentStepChange.d.ts +2 -1
- package/es/global/js/hooks/useCreateComponentStepChange.js +3 -2
- package/es/global/js/hooks/usePortalTarget.js +1 -1
- package/es/global/js/utils/makeDraggable/makeDraggable.js +22 -13
- package/lib/components/Coachmark/next/Coachmark/ContentHeader.js +2 -1
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +12 -1
- package/lib/components/CreateTearsheet/CreateTearsheet.d.ts +1 -0
- package/lib/components/CreateTearsheet/CreateTearsheet.js +3 -0
- package/lib/components/CreateTearsheet/CreateTearsheetStep.d.ts +4 -0
- package/lib/components/CreateTearsheet/CreateTearsheetStep.js +7 -1
- package/lib/components/EditInPlace/EditInPlace.d.ts +12 -1
- package/lib/components/EditInPlace/EditInPlace.js +50 -29
- package/lib/components/ImportModal/ImportModal.d.ts +5 -1
- package/lib/components/ImportModal/ImportModal.js +12 -6
- package/lib/components/PageHeader/next/PageHeader.d.ts +15 -238
- package/lib/components/PageHeader/next/PageHeader.js +42 -654
- package/lib/components/PageHeader/next/PageHeaderBreadcrumbBar.d.ts +41 -0
- package/lib/components/PageHeader/next/PageHeaderBreadcrumbBar.js +76 -0
- package/lib/components/PageHeader/next/PageHeaderBreadcrumbOverflow.d.ts +12 -0
- package/lib/components/PageHeader/next/PageHeaderBreadcrumbOverflow.js +84 -0
- package/lib/components/PageHeader/next/PageHeaderContent.d.ts +39 -0
- package/lib/components/PageHeader/next/PageHeaderContent.js +131 -0
- package/lib/components/PageHeader/next/PageHeaderContentPageActions.d.ts +52 -0
- package/lib/components/PageHeader/next/PageHeaderContentPageActions.js +128 -0
- package/lib/components/PageHeader/next/PageHeaderContentText.d.ts +44 -0
- package/lib/components/PageHeader/next/PageHeaderContentText.js +56 -0
- package/lib/components/PageHeader/next/PageHeaderHeroImage.d.ts +36 -0
- package/lib/components/PageHeader/next/PageHeaderHeroImage.js +64 -0
- package/lib/components/PageHeader/next/PageHeaderScrollButton.d.ts +13 -0
- package/lib/components/PageHeader/next/PageHeaderScrollButton.js +75 -0
- package/lib/components/PageHeader/next/PageHeaderTabBar.d.ts +19 -0
- package/lib/components/PageHeader/next/PageHeaderTabBar.js +68 -0
- package/lib/components/PageHeader/next/PageHeaderTagOverflow.d.ts +13 -0
- package/lib/components/PageHeader/next/PageHeaderTagOverflow.js +70 -0
- package/lib/components/PageHeader/next/PageHeaderTitleBreadcrumb.d.ts +9 -0
- package/lib/components/PageHeader/next/PageHeaderTitleBreadcrumb.js +45 -0
- package/lib/components/PageHeader/next/index.d.ts +3 -2
- package/lib/components/PageHeader/next/index.js +20 -10
- package/lib/global/js/hooks/useCreateComponentStepChange.d.ts +2 -1
- package/lib/global/js/hooks/useCreateComponentStepChange.js +3 -2
- package/lib/global/js/hooks/usePortalTarget.js +1 -1
- package/lib/global/js/utils/makeDraggable/makeDraggable.js +22 -13
- package/package.json +7 -7
- package/scss/components/Datagrid/_datagrid.scss +7 -10
- package/scss/components/EditInPlace/_edit-in-place.scss +11 -3
- package/scss/components/PageHeader/_page-header.scss +2 -1
- package/telemetry.yml +13 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2026
|
|
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, { type ComponentType, type FunctionComponent } from 'react';
|
|
8
|
+
/**
|
|
9
|
+
* -----------------------
|
|
10
|
+
* PageHeaderBreadcrumbBar
|
|
11
|
+
* -----------------------
|
|
12
|
+
*/
|
|
13
|
+
export interface PageHeaderBreadcrumbBarProps {
|
|
14
|
+
/**
|
|
15
|
+
* `true` by default to render BreadcrumbBar bottom border.
|
|
16
|
+
*/
|
|
17
|
+
border?: boolean;
|
|
18
|
+
children?: React.ReactNode;
|
|
19
|
+
className?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Provide an optional icon to render in front of the PageHeaderContent's title.
|
|
22
|
+
*/
|
|
23
|
+
renderIcon?: ComponentType | FunctionComponent;
|
|
24
|
+
/**
|
|
25
|
+
* The PageHeaderBreadcrumbBar's content actions
|
|
26
|
+
*/
|
|
27
|
+
contentActions?: React.ReactNode;
|
|
28
|
+
/**
|
|
29
|
+
* `true` to set content actions flush against page actions
|
|
30
|
+
*/
|
|
31
|
+
contentActionsFlush?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* The PageHeaderContent's page actions
|
|
34
|
+
*/
|
|
35
|
+
pageActions?: React.ReactNode;
|
|
36
|
+
/**
|
|
37
|
+
* `true` to set page actions flush with page
|
|
38
|
+
*/
|
|
39
|
+
pageActionsFlush?: boolean;
|
|
40
|
+
}
|
|
41
|
+
export declare const PageHeaderBreadcrumbBar: React.ForwardRefExoticComponent<PageHeaderBreadcrumbBarProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2020, 2026
|
|
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 cx from 'classnames';
|
|
11
|
+
import { Grid, Column } from '@carbon/react';
|
|
12
|
+
import { blockClass } from '../PageHeaderUtils.js';
|
|
13
|
+
import { usePageHeader, PageHeaderContext } from './context.js';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* -----------------------
|
|
17
|
+
* PageHeaderBreadcrumbBar
|
|
18
|
+
* -----------------------
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
const PageHeaderBreadcrumbBar = /*#__PURE__*/React__default.forwardRef(function PageHeaderBreadcrumbBar(_ref, ref) {
|
|
22
|
+
let {
|
|
23
|
+
border = true,
|
|
24
|
+
className,
|
|
25
|
+
children,
|
|
26
|
+
renderIcon: IconElement,
|
|
27
|
+
contentActions,
|
|
28
|
+
contentActionsFlush,
|
|
29
|
+
pageActions,
|
|
30
|
+
pageActionsFlush,
|
|
31
|
+
...other
|
|
32
|
+
} = _ref;
|
|
33
|
+
const context = usePageHeader();
|
|
34
|
+
const {
|
|
35
|
+
pageActionsInstance: globalActions,
|
|
36
|
+
contentActionsClipped
|
|
37
|
+
} = context;
|
|
38
|
+
const classNames = cx({
|
|
39
|
+
[`${blockClass}__breadcrumb-bar`]: true,
|
|
40
|
+
[`${blockClass}__breadcrumb-bar-border`]: border,
|
|
41
|
+
[`${blockClass}__breadcrumb__actions-flush`]: pageActionsFlush
|
|
42
|
+
}, className);
|
|
43
|
+
const contentActionsClasses = cx({
|
|
44
|
+
[`${blockClass}__breadcrumb__content-actions`]: !contentActionsFlush,
|
|
45
|
+
[`${blockClass}__breadcrumb__content-actions-with-global-actions`]: !!globalActions,
|
|
46
|
+
[`${blockClass}__breadcrumb__content-actions-with-global-actions--show`]: contentActionsClipped
|
|
47
|
+
});
|
|
48
|
+
return /*#__PURE__*/React__default.createElement(PageHeaderContext.Provider, {
|
|
49
|
+
value: {
|
|
50
|
+
...context,
|
|
51
|
+
isContentActionsInBreadcrumbBar: true
|
|
52
|
+
}
|
|
53
|
+
}, /*#__PURE__*/React__default.createElement("div", _extends({
|
|
54
|
+
className: classNames,
|
|
55
|
+
ref: ref
|
|
56
|
+
}, other), /*#__PURE__*/React__default.createElement(Grid, null, /*#__PURE__*/React__default.createElement(Column, {
|
|
57
|
+
lg: 16,
|
|
58
|
+
md: 8,
|
|
59
|
+
sm: 4
|
|
60
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
61
|
+
className: `${blockClass}__breadcrumb-container`
|
|
62
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
63
|
+
className: `${blockClass}__breadcrumb-wrapper`
|
|
64
|
+
}, IconElement && /*#__PURE__*/React__default.createElement("div", {
|
|
65
|
+
className: `${blockClass}__breadcrumb__icon`
|
|
66
|
+
}, /*#__PURE__*/React__default.createElement(IconElement, null)), children), /*#__PURE__*/React__default.createElement("div", {
|
|
67
|
+
className: `${blockClass}__breadcrumb__actions`
|
|
68
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
69
|
+
className: contentActionsClasses
|
|
70
|
+
}, contentActions), pageActions))))));
|
|
71
|
+
});
|
|
72
|
+
PageHeaderBreadcrumbBar.displayName = 'PageHeaderBreadcrumbBar';
|
|
73
|
+
|
|
74
|
+
export { PageHeaderBreadcrumbBar };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2026
|
|
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 { BreadcrumbItemProps, BreadcrumbProps } from '@carbon/react';
|
|
9
|
+
export interface PageHeaderBreadcrumbOverflowProps extends BreadcrumbProps {
|
|
10
|
+
renderOverflowBreadcrumb?: (hiddenBreadcrumbs: HTMLElement[]) => React.ReactElement<BreadcrumbItemProps>;
|
|
11
|
+
}
|
|
12
|
+
export declare const PageHeaderBreadcrumbOverflow: React.ForwardRefExoticComponent<PageHeaderBreadcrumbOverflowProps & React.RefAttributes<HTMLElement>>;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2020, 2026
|
|
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, useEffect } from 'react';
|
|
10
|
+
import cx from 'classnames';
|
|
11
|
+
import { usePrefix, Breadcrumb, BreadcrumbItem } from '@carbon/react';
|
|
12
|
+
import { createOverflowHandler } from './overflowHandler.js';
|
|
13
|
+
import { pkg } from '../../../settings.js';
|
|
14
|
+
import { PageHeaderTitleBreadcrumb } from './PageHeaderTitleBreadcrumb.js';
|
|
15
|
+
|
|
16
|
+
// This component is a wrapper for the Breadcrumb, and renders breadcrumb items as children
|
|
17
|
+
// including the overflow breadcrumb item. The overflowHandler determines what elements
|
|
18
|
+
// are visible and hidden and passes the hidden elements back to the render prop used
|
|
19
|
+
// to display the overflow breadcrumb
|
|
20
|
+
const PageHeaderBreadcrumbOverflow = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
21
|
+
let {
|
|
22
|
+
renderOverflowBreadcrumb,
|
|
23
|
+
className,
|
|
24
|
+
children,
|
|
25
|
+
...other
|
|
26
|
+
} = _ref;
|
|
27
|
+
const [hiddenBreadcrumbs, setHiddenBreadcrumbs] = React__default.useState([]);
|
|
28
|
+
const fallbackRef = useRef(null);
|
|
29
|
+
const componentRef = ref ?? fallbackRef;
|
|
30
|
+
|
|
31
|
+
// Initialize overflow resize handler
|
|
32
|
+
const carbonPrefix = usePrefix();
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
if (!componentRef) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
const breadcrumbList = componentRef?.current.querySelector(`.${carbonPrefix}--breadcrumb`);
|
|
38
|
+
createOverflowHandler({
|
|
39
|
+
container: breadcrumbList,
|
|
40
|
+
onChange: (_, hidden) => {
|
|
41
|
+
setHiddenBreadcrumbs(hidden);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
// Don't want ref or carbon prefix in dependency array
|
|
45
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
46
|
+
}, []);
|
|
47
|
+
const renderChildren = () => {
|
|
48
|
+
// Only BreadcrumbItems and TitleBreadcrumbs are valid children
|
|
49
|
+
const filteredBreadcrumbs = React__default.Children.toArray(children).filter(child => {
|
|
50
|
+
if (/*#__PURE__*/React__default.isValidElement(child)) {
|
|
51
|
+
return child.type === BreadcrumbItem || child.type === PageHeaderTitleBreadcrumb;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
// We need to clone the renderProp for the overflow breadcrumb item
|
|
55
|
+
// to place it before the title breadcrumb according to the design
|
|
56
|
+
if (filteredBreadcrumbs) {
|
|
57
|
+
const overflowBreadcrumb = renderOverflowBreadcrumb?.(hiddenBreadcrumbs);
|
|
58
|
+
// If no overflow breadcrumb provided, return here with the rest of the children
|
|
59
|
+
if (!overflowBreadcrumb) {
|
|
60
|
+
return children;
|
|
61
|
+
}
|
|
62
|
+
const clonedTitleBreadcrumb = /*#__PURE__*/React__default.cloneElement(overflowBreadcrumb, {
|
|
63
|
+
key: 'cloned overflow breadcrumb item',
|
|
64
|
+
'data-fixed': true,
|
|
65
|
+
className: cx(`${pkg.prefix}--page-header-breadcrumb-overflow-item`, {
|
|
66
|
+
[`${pkg.prefix}--page-header-overflow-breadcrumb-item-with-items`]: hiddenBreadcrumbs.length
|
|
67
|
+
})
|
|
68
|
+
});
|
|
69
|
+
const clonedChildren = [...filteredBreadcrumbs];
|
|
70
|
+
clonedChildren.splice(filteredBreadcrumbs.length - 1, 0, clonedTitleBreadcrumb); // second to last position
|
|
71
|
+
return clonedChildren;
|
|
72
|
+
}
|
|
73
|
+
return children;
|
|
74
|
+
};
|
|
75
|
+
return /*#__PURE__*/React__default.createElement(Breadcrumb, _extends({
|
|
76
|
+
className: cx(className, `${pkg.prefix}--page-header-breadcrumb-overflow`),
|
|
77
|
+
ref: componentRef
|
|
78
|
+
}, other), renderChildren());
|
|
79
|
+
});
|
|
80
|
+
PageHeaderBreadcrumbOverflow.displayName = 'PageHeaderBreadcrumbOverflow';
|
|
81
|
+
|
|
82
|
+
export { PageHeaderBreadcrumbOverflow };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2026
|
|
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, { type ComponentType, type FunctionComponent } from 'react';
|
|
8
|
+
/**
|
|
9
|
+
* -----------------
|
|
10
|
+
* PageHeaderContent
|
|
11
|
+
* -----------------
|
|
12
|
+
*/
|
|
13
|
+
export interface PageHeaderContentProps {
|
|
14
|
+
/**
|
|
15
|
+
* Provide child elements to be rendered inside PageHeaderContent.
|
|
16
|
+
*/
|
|
17
|
+
children?: React.ReactNode;
|
|
18
|
+
/**
|
|
19
|
+
* Specify an optional className to be added to your PageHeaderContent
|
|
20
|
+
*/
|
|
21
|
+
className?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Provide an optional icon to render in front of the PageHeaderContent's title.
|
|
24
|
+
*/
|
|
25
|
+
renderIcon?: ComponentType | FunctionComponent;
|
|
26
|
+
/**
|
|
27
|
+
* The PageHeaderContent's title
|
|
28
|
+
*/
|
|
29
|
+
title: string;
|
|
30
|
+
/**
|
|
31
|
+
* The PageHeaderContent's contextual actions
|
|
32
|
+
*/
|
|
33
|
+
contextualActions?: React.ReactNode;
|
|
34
|
+
/**
|
|
35
|
+
* The PageHeaderContent's page actions
|
|
36
|
+
*/
|
|
37
|
+
pageActions?: React.ReactNode;
|
|
38
|
+
}
|
|
39
|
+
export declare const PageHeaderContent: React.ForwardRefExoticComponent<PageHeaderContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2020, 2026
|
|
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, { useRef, useEffect, useState } from 'react';
|
|
10
|
+
import PropTypes from '../../../_virtual/index.js';
|
|
11
|
+
import cx from 'classnames';
|
|
12
|
+
import { Section, Grid, Column, DefinitionTooltip, unstable_Text, Heading } from '@carbon/react';
|
|
13
|
+
import { blockClass } from '../PageHeaderUtils.js';
|
|
14
|
+
import { usePageHeader } from './context.js';
|
|
15
|
+
import { useIsomorphicEffect } from '../../../global/js/hooks/useIsomorphicEffect.js';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* -----------------
|
|
19
|
+
* PageHeaderContent
|
|
20
|
+
* -----------------
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
const PageHeaderContent = /*#__PURE__*/React__default.forwardRef(function PageHeaderContent(_ref, ref) {
|
|
24
|
+
let {
|
|
25
|
+
className,
|
|
26
|
+
children,
|
|
27
|
+
title,
|
|
28
|
+
renderIcon: IconElement,
|
|
29
|
+
contextualActions,
|
|
30
|
+
pageActions,
|
|
31
|
+
...other
|
|
32
|
+
} = _ref;
|
|
33
|
+
const contentRef = useRef(null);
|
|
34
|
+
const componentRef = ref ?? contentRef;
|
|
35
|
+
const {
|
|
36
|
+
setRefs,
|
|
37
|
+
setPageActionsInstance
|
|
38
|
+
} = usePageHeader();
|
|
39
|
+
const classNames = cx({
|
|
40
|
+
[`${blockClass}__content`]: true
|
|
41
|
+
}, className);
|
|
42
|
+
const titleRef = useRef(null);
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
if (componentRef?.current) {
|
|
45
|
+
setRefs(prev => ({
|
|
46
|
+
...prev,
|
|
47
|
+
contentRef: componentRef,
|
|
48
|
+
titleRef
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
51
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
52
|
+
}, []);
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
if (pageActions) {
|
|
55
|
+
setPageActionsInstance(pageActions);
|
|
56
|
+
}
|
|
57
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
58
|
+
}, [pageActions]);
|
|
59
|
+
const [isEllipsisApplied, setIsEllipsisApplied] = useState(false);
|
|
60
|
+
const isEllipsisActive = element => {
|
|
61
|
+
setIsEllipsisApplied(element.offsetHeight < element.scrollHeight);
|
|
62
|
+
return element.offsetHeight < element.scrollHeight;
|
|
63
|
+
};
|
|
64
|
+
useIsomorphicEffect(() => {
|
|
65
|
+
titleRef.current && isEllipsisActive(titleRef.current);
|
|
66
|
+
}, [title]);
|
|
67
|
+
return /*#__PURE__*/React__default.createElement(Section, _extends({
|
|
68
|
+
as: "div",
|
|
69
|
+
className: classNames,
|
|
70
|
+
ref: componentRef
|
|
71
|
+
}, other), /*#__PURE__*/React__default.createElement(Grid, null, /*#__PURE__*/React__default.createElement(Column, {
|
|
72
|
+
lg: 16,
|
|
73
|
+
md: 8,
|
|
74
|
+
sm: 4
|
|
75
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
76
|
+
className: `${blockClass}__content__title-wrapper`
|
|
77
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
78
|
+
className: `${blockClass}__content__start`
|
|
79
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
80
|
+
className: `${blockClass}__content__title-container`
|
|
81
|
+
}, IconElement && /*#__PURE__*/React__default.createElement("div", {
|
|
82
|
+
className: `${blockClass}__content__icon`
|
|
83
|
+
}, /*#__PURE__*/React__default.createElement(IconElement, null)), isEllipsisApplied ? /*#__PURE__*/React__default.createElement(DefinitionTooltip, {
|
|
84
|
+
definition: title
|
|
85
|
+
}, /*#__PURE__*/React__default.createElement(unstable_Text, {
|
|
86
|
+
ref: titleRef,
|
|
87
|
+
as: Heading,
|
|
88
|
+
className: `${blockClass}__content__title`
|
|
89
|
+
}, title)) : /*#__PURE__*/React__default.createElement(unstable_Text, {
|
|
90
|
+
ref: titleRef,
|
|
91
|
+
as: Heading,
|
|
92
|
+
className: `${blockClass}__content__title`
|
|
93
|
+
}, title)), contextualActions && /*#__PURE__*/React__default.createElement("div", {
|
|
94
|
+
className: `${blockClass}__content__contextual-actions`
|
|
95
|
+
}, contextualActions)), pageActions), children)));
|
|
96
|
+
});
|
|
97
|
+
PageHeaderContent.displayName = 'PageHeaderContent';
|
|
98
|
+
PageHeaderContent.propTypes = {
|
|
99
|
+
/**
|
|
100
|
+
* Provide child elements to be rendered inside PageHeaderContent.
|
|
101
|
+
*/
|
|
102
|
+
children: PropTypes.node,
|
|
103
|
+
/**
|
|
104
|
+
* Specify an optional className to be added to your PageHeaderContent
|
|
105
|
+
*/
|
|
106
|
+
className: PropTypes.string,
|
|
107
|
+
/**
|
|
108
|
+
* The PageHeaderContent's contextual actions
|
|
109
|
+
*/
|
|
110
|
+
contextualActions: PropTypes.node,
|
|
111
|
+
/**
|
|
112
|
+
* The PageHeaderContent's page actions
|
|
113
|
+
*/
|
|
114
|
+
pageActions: PropTypes.node,
|
|
115
|
+
/**
|
|
116
|
+
* Provide an optional icon to render in front of the PageHeaderContent's title.
|
|
117
|
+
*/
|
|
118
|
+
renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
119
|
+
/**
|
|
120
|
+
* The PageHeaderContent's subtitle
|
|
121
|
+
*/
|
|
122
|
+
subtitle: PropTypes.string,
|
|
123
|
+
/**
|
|
124
|
+
* The PageHeaderContent's title
|
|
125
|
+
*/
|
|
126
|
+
title: PropTypes.string.isRequired
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
export { PageHeaderContent };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2026
|
|
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
|
+
/**
|
|
9
|
+
* ----------------
|
|
10
|
+
* PageHeaderContentPageActions
|
|
11
|
+
* ----------------
|
|
12
|
+
*/
|
|
13
|
+
export interface PageHeaderContentPageActionsProps {
|
|
14
|
+
/**
|
|
15
|
+
* Provide child elements to be rendered inside PageHeaderContentPageActions.
|
|
16
|
+
*/
|
|
17
|
+
children?: React.ReactNode;
|
|
18
|
+
/**
|
|
19
|
+
* Specify an optional className to be added to your PageHeaderContentPageActions
|
|
20
|
+
*/
|
|
21
|
+
className?: string;
|
|
22
|
+
/**
|
|
23
|
+
* The PageHeaderContent's page actions collapsible Menu button label
|
|
24
|
+
*/
|
|
25
|
+
menuButtonLabel?: string;
|
|
26
|
+
/**
|
|
27
|
+
* The PageHeaderContent's page actions
|
|
28
|
+
*/
|
|
29
|
+
actions?: React.ReactNode;
|
|
30
|
+
}
|
|
31
|
+
export declare const PageHeaderContentPageActions: {
|
|
32
|
+
({ className, children, menuButtonLabel, actions, ...other }: PageHeaderContentPageActionsProps): React.JSX.Element;
|
|
33
|
+
displayName: string;
|
|
34
|
+
propTypes: {
|
|
35
|
+
/**
|
|
36
|
+
* The PageHeaderContent's page actions
|
|
37
|
+
*/
|
|
38
|
+
actions: any;
|
|
39
|
+
/**
|
|
40
|
+
* Provide child elements to be rendered inside PageHeaderContentPageActions.
|
|
41
|
+
*/
|
|
42
|
+
children: any;
|
|
43
|
+
/**
|
|
44
|
+
* Specify an optional className to be added to your PageHeaderContentPageActions
|
|
45
|
+
*/
|
|
46
|
+
className: any;
|
|
47
|
+
/**
|
|
48
|
+
* The PageHeaderContent's collapsible Menu button label
|
|
49
|
+
*/
|
|
50
|
+
menuButtonLabel: any;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2020, 2026
|
|
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, { useRef, useState, useEffect } from 'react';
|
|
10
|
+
import PropTypes from '../../../_virtual/index.js';
|
|
11
|
+
import cx from 'classnames';
|
|
12
|
+
import { MenuButton, MenuItem } from '@carbon/react';
|
|
13
|
+
import { blockClass } from '../PageHeaderUtils.js';
|
|
14
|
+
import { createOverflowHandler } from '@carbon/utilities';
|
|
15
|
+
import { usePageHeader } from './context.js';
|
|
16
|
+
import { useIsomorphicEffect } from '../../../global/js/hooks/useIsomorphicEffect.js';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* ----------------
|
|
20
|
+
* PageHeaderContentPageActions
|
|
21
|
+
* ----------------
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
const PageHeaderContentPageActions = _ref => {
|
|
25
|
+
let {
|
|
26
|
+
className,
|
|
27
|
+
children,
|
|
28
|
+
menuButtonLabel = 'Actions',
|
|
29
|
+
actions,
|
|
30
|
+
...other
|
|
31
|
+
} = _ref;
|
|
32
|
+
const {
|
|
33
|
+
setRefs,
|
|
34
|
+
contentActionsClipped,
|
|
35
|
+
breadcrumbActionsClipped,
|
|
36
|
+
isContentActionsInBreadcrumbBar: isInBreadcrumbBar
|
|
37
|
+
} = usePageHeader();
|
|
38
|
+
const classNames = cx(`${blockClass}__content__page-actions`, {
|
|
39
|
+
// Revisit this:
|
|
40
|
+
// May want to only add this class if there are content actions in the breadcrumb bar as well
|
|
41
|
+
[`${blockClass}__content__page-actions--clipped`]: isInBreadcrumbBar ? breadcrumbActionsClipped : contentActionsClipped
|
|
42
|
+
}, className);
|
|
43
|
+
const containerRef = useRef(null);
|
|
44
|
+
const offsetRef = useRef(null);
|
|
45
|
+
const [menuButtonVisibility, setMenuButtonVisibility] = useState(false);
|
|
46
|
+
const [hiddenItems, setHiddenItems] = useState([]);
|
|
47
|
+
|
|
48
|
+
// need to set the grid columns width based on the menu button's width
|
|
49
|
+
// to avoid overlapping when resizing
|
|
50
|
+
useIsomorphicEffect(() => {
|
|
51
|
+
if (menuButtonVisibility && offsetRef.current) {
|
|
52
|
+
const width = offsetRef.current.offsetWidth;
|
|
53
|
+
document.documentElement.style.setProperty('--page-header-title-grid-width', `${width}px`);
|
|
54
|
+
}
|
|
55
|
+
}, [menuButtonVisibility]);
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
if (isInBreadcrumbBar) {
|
|
58
|
+
setRefs(prev => ({
|
|
59
|
+
...prev,
|
|
60
|
+
breadcrumbActions: containerRef
|
|
61
|
+
}));
|
|
62
|
+
} else {
|
|
63
|
+
setRefs(prev => ({
|
|
64
|
+
...prev,
|
|
65
|
+
contentActions: containerRef
|
|
66
|
+
}));
|
|
67
|
+
}
|
|
68
|
+
}, [isInBreadcrumbBar, setRefs]);
|
|
69
|
+
useEffect(() => {
|
|
70
|
+
if (!containerRef.current || !Array.isArray(actions)) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
createOverflowHandler({
|
|
74
|
+
container: containerRef.current,
|
|
75
|
+
// exclude the hidden menu button from children
|
|
76
|
+
maxVisibleItems: containerRef.current.children.length - 1,
|
|
77
|
+
onChange: (visible, hidden) => {
|
|
78
|
+
setHiddenItems(actions?.slice(visible.length));
|
|
79
|
+
if (hidden.length > 0) {
|
|
80
|
+
setMenuButtonVisibility(true);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}, [actions]);
|
|
85
|
+
return /*#__PURE__*/React__default.createElement("div", _extends({
|
|
86
|
+
className: classNames,
|
|
87
|
+
ref: containerRef
|
|
88
|
+
}, other), Array.isArray(actions) && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, actions.map(action => /*#__PURE__*/React__default.createElement("div", {
|
|
89
|
+
key: action.id
|
|
90
|
+
}, /*#__PURE__*/React__default.cloneElement(action.body, {
|
|
91
|
+
...action.body.props,
|
|
92
|
+
onClick: action.onClick
|
|
93
|
+
}))), /*#__PURE__*/React__default.createElement("span", {
|
|
94
|
+
"data-offset": true,
|
|
95
|
+
"data-hidden": true,
|
|
96
|
+
ref: offsetRef
|
|
97
|
+
}, /*#__PURE__*/React__default.createElement(MenuButton, {
|
|
98
|
+
menuAlignment: "bottom-end",
|
|
99
|
+
label: menuButtonLabel,
|
|
100
|
+
size: "md"
|
|
101
|
+
}, [...hiddenItems].reverse().map(item => /*#__PURE__*/React__default.createElement(MenuItem, _extends({
|
|
102
|
+
key: item.id,
|
|
103
|
+
onClick: item.onClick
|
|
104
|
+
}, item.menuItem)))))));
|
|
105
|
+
};
|
|
106
|
+
PageHeaderContentPageActions.displayName = 'PageHeaderContentPageActions';
|
|
107
|
+
PageHeaderContentPageActions.propTypes = {
|
|
108
|
+
/**
|
|
109
|
+
* The PageHeaderContent's page actions
|
|
110
|
+
*/
|
|
111
|
+
actions: PropTypes.oneOfType([PropTypes.node, PropTypes.array]),
|
|
112
|
+
/**
|
|
113
|
+
* Provide child elements to be rendered inside PageHeaderContentPageActions.
|
|
114
|
+
*/
|
|
115
|
+
children: PropTypes.node,
|
|
116
|
+
/**
|
|
117
|
+
* Specify an optional className to be added to your PageHeaderContentPageActions
|
|
118
|
+
*/
|
|
119
|
+
className: PropTypes.string,
|
|
120
|
+
/**
|
|
121
|
+
* The PageHeaderContent's collapsible Menu button label
|
|
122
|
+
*/
|
|
123
|
+
menuButtonLabel: PropTypes.string
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
export { PageHeaderContentPageActions };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2026
|
|
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
|
+
/**
|
|
9
|
+
* ----------------
|
|
10
|
+
* PageHeaderContentText
|
|
11
|
+
* ----------------
|
|
12
|
+
*/
|
|
13
|
+
export interface PageHeaderContentTextProps {
|
|
14
|
+
/**
|
|
15
|
+
* Provide child elements to be rendered inside PageHeaderContentText.
|
|
16
|
+
*/
|
|
17
|
+
children?: React.ReactNode;
|
|
18
|
+
/**
|
|
19
|
+
* Specify an optional className to be added to your PageHeaderContentText
|
|
20
|
+
*/
|
|
21
|
+
className?: string;
|
|
22
|
+
/**
|
|
23
|
+
* The PageHeaderContent's subtitle
|
|
24
|
+
*/
|
|
25
|
+
subtitle?: string;
|
|
26
|
+
}
|
|
27
|
+
export declare const PageHeaderContentText: {
|
|
28
|
+
({ className, children, subtitle, ...other }: PageHeaderContentTextProps): React.JSX.Element;
|
|
29
|
+
displayName: string;
|
|
30
|
+
propTypes: {
|
|
31
|
+
/**
|
|
32
|
+
* Provide child elements to be rendered inside PageHeaderContentText.
|
|
33
|
+
*/
|
|
34
|
+
children: any;
|
|
35
|
+
/**
|
|
36
|
+
* Specify an optional className to be added to your PageHeaderContentText
|
|
37
|
+
*/
|
|
38
|
+
className: any;
|
|
39
|
+
/**
|
|
40
|
+
* The PageHeaderContent's subtitle
|
|
41
|
+
*/
|
|
42
|
+
subtitle: any;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2020, 2026
|
|
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 cx from 'classnames';
|
|
12
|
+
import { unstable_Text } from '@carbon/react';
|
|
13
|
+
import { blockClass } from '../PageHeaderUtils.js';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* ----------------
|
|
17
|
+
* PageHeaderContentText
|
|
18
|
+
* ----------------
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
const PageHeaderContentText = _ref => {
|
|
22
|
+
let {
|
|
23
|
+
className,
|
|
24
|
+
children,
|
|
25
|
+
subtitle,
|
|
26
|
+
...other
|
|
27
|
+
} = _ref;
|
|
28
|
+
const classNames = cx({
|
|
29
|
+
[`${blockClass}__content__body`]: true
|
|
30
|
+
}, className);
|
|
31
|
+
return /*#__PURE__*/React__default.createElement("div", _extends({
|
|
32
|
+
className: classNames
|
|
33
|
+
}, other), subtitle && /*#__PURE__*/React__default.createElement(unstable_Text, {
|
|
34
|
+
as: "h3",
|
|
35
|
+
className: `${blockClass}__content__subtitle`
|
|
36
|
+
}, subtitle), children);
|
|
37
|
+
};
|
|
38
|
+
PageHeaderContentText.displayName = 'PageHeaderContentText';
|
|
39
|
+
PageHeaderContentText.propTypes = {
|
|
40
|
+
/**
|
|
41
|
+
* Provide child elements to be rendered inside PageHeaderContentText.
|
|
42
|
+
*/
|
|
43
|
+
children: PropTypes.node,
|
|
44
|
+
/**
|
|
45
|
+
* Specify an optional className to be added to your PageHeaderContentText
|
|
46
|
+
*/
|
|
47
|
+
className: PropTypes.string,
|
|
48
|
+
/**
|
|
49
|
+
* The PageHeaderContent's subtitle
|
|
50
|
+
*/
|
|
51
|
+
subtitle: PropTypes.string
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export { PageHeaderContentText };
|