@carbon/ibm-products 2.87.1 → 2.88.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 +58 -17
- 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 +58 -17
- 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 +58 -17
- 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 +58 -17
- 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/BreadcrumbWithOverflow/BreadcrumbWithOverflow.d.ts.map +1 -1
- package/es/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +6 -4
- package/es/components/InterstitialScreen/InterstitialScreenFooter.d.ts.map +1 -1
- package/es/components/InterstitialScreen/InterstitialScreenFooter.js +13 -12
- package/es/components/InterstitialScreen/InterstitialScreenHeader.d.ts.map +1 -1
- package/es/components/InterstitialScreen/InterstitialScreenHeader.js +1 -3
- package/es/components/PageHeader/next/PageHeader.d.ts +31 -2
- package/es/components/PageHeader/next/PageHeader.d.ts.map +1 -1
- package/es/components/PageHeader/next/PageHeader.js +49 -32
- package/es/components/PageHeader/next/PageHeaderBreadcrumbBar.d.ts +7 -4
- package/es/components/PageHeader/next/PageHeaderBreadcrumbBar.d.ts.map +1 -1
- package/es/components/PageHeader/next/PageHeaderBreadcrumbBar.js +8 -4
- package/es/components/PageHeader/next/PageHeaderBreadcrumbPageActions.d.ts +85 -0
- package/es/components/PageHeader/next/PageHeaderBreadcrumbPageActions.d.ts.map +1 -0
- package/es/components/PageHeader/next/PageHeaderBreadcrumbPageActions.js +100 -0
- package/es/components/PageHeader/next/PageHeaderContent.d.ts +4 -2
- package/es/components/PageHeader/next/PageHeaderContent.d.ts.map +1 -1
- package/es/components/PageHeader/next/PageHeaderContent.js +6 -5
- package/es/components/PageHeader/next/PageHeaderContentPageActions.d.ts.map +1 -1
- package/es/components/PageHeader/next/PageHeaderContentPageActions.js +2 -2
- package/es/components/PageHeader/next/PageHeaderScrollButton.d.ts.map +1 -1
- package/es/components/PageHeader/next/PageHeaderScrollButton.js +2 -1
- package/es/components/PageHeader/next/PageHeaderTitleBreadcrumb.d.ts.map +1 -1
- package/es/components/PageHeader/next/PageHeaderTitleBreadcrumb.js +2 -1
- package/es/components/PageHeader/next/context.d.ts +7 -4
- package/es/components/PageHeader/next/context.d.ts.map +1 -1
- package/es/components/PageHeader/next/context.js +6 -4
- package/es/components/PageHeader/next/index.d.ts +2 -2
- package/es/components/PageHeader/next/index.d.ts.map +1 -1
- package/es/components/PageHeader/next/index.js +4 -1
- package/lib/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.d.ts.map +1 -1
- package/lib/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +6 -4
- package/lib/components/InterstitialScreen/InterstitialScreenFooter.d.ts.map +1 -1
- package/lib/components/InterstitialScreen/InterstitialScreenFooter.js +12 -11
- package/lib/components/InterstitialScreen/InterstitialScreenHeader.d.ts.map +1 -1
- package/lib/components/InterstitialScreen/InterstitialScreenHeader.js +1 -3
- package/lib/components/PageHeader/next/PageHeader.d.ts +31 -2
- package/lib/components/PageHeader/next/PageHeader.d.ts.map +1 -1
- package/lib/components/PageHeader/next/PageHeader.js +48 -30
- package/lib/components/PageHeader/next/PageHeaderBreadcrumbBar.d.ts +7 -4
- package/lib/components/PageHeader/next/PageHeaderBreadcrumbBar.d.ts.map +1 -1
- package/lib/components/PageHeader/next/PageHeaderBreadcrumbBar.js +8 -4
- package/lib/components/PageHeader/next/PageHeaderBreadcrumbPageActions.d.ts +85 -0
- package/lib/components/PageHeader/next/PageHeaderBreadcrumbPageActions.d.ts.map +1 -0
- package/lib/components/PageHeader/next/PageHeaderBreadcrumbPageActions.js +102 -0
- package/lib/components/PageHeader/next/PageHeaderContent.d.ts +4 -2
- package/lib/components/PageHeader/next/PageHeaderContent.d.ts.map +1 -1
- package/lib/components/PageHeader/next/PageHeaderContent.js +5 -4
- package/lib/components/PageHeader/next/PageHeaderContentPageActions.d.ts.map +1 -1
- package/lib/components/PageHeader/next/PageHeaderContentPageActions.js +2 -2
- package/lib/components/PageHeader/next/PageHeaderScrollButton.d.ts.map +1 -1
- package/lib/components/PageHeader/next/PageHeaderScrollButton.js +2 -1
- package/lib/components/PageHeader/next/PageHeaderTitleBreadcrumb.d.ts.map +1 -1
- package/lib/components/PageHeader/next/PageHeaderTitleBreadcrumb.js +2 -1
- package/lib/components/PageHeader/next/context.d.ts +7 -4
- package/lib/components/PageHeader/next/context.d.ts.map +1 -1
- package/lib/components/PageHeader/next/context.js +6 -4
- package/lib/components/PageHeader/next/index.d.ts +2 -2
- package/lib/components/PageHeader/next/index.d.ts.map +1 -1
- package/lib/components/PageHeader/next/index.js +3 -0
- package/package.json +5 -5
- package/scss/components/InterstitialScreen/_interstitial-screen.scss +43 -16
- package/scss/components/PageHeader/_page-header.scss +25 -1
- package/telemetry.yml +18 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BreadcrumbWithOverflow.d.ts","sourceRoot":"","sources":["../../../src/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.jsx"],"names":[],"mappings":"AA0CO;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"BreadcrumbWithOverflow.d.ts","sourceRoot":"","sources":["../../../src/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.jsx"],"names":[],"mappings":"AA0CO;;;;;;;;;sBAwTN;;;;YAWK;;eAEG;;YAGH;;eAEG;;YAGH;;eAEG;;YAGH;;eAEG;;YAGH;;eAEG;;YAGH;;eAEG;;;;;;;;;;;;kBAhY0C,OAAO;sBAGpC,YAAY;AAwBlC,6BAAsB,wBAAwB,CAAC"}
|
|
@@ -124,10 +124,12 @@ let BreadcrumbWithOverflow = ({ breadcrumbs, className, label, maxVisible, noTra
|
|
|
124
124
|
willFit += 1;
|
|
125
125
|
} else break;
|
|
126
126
|
}
|
|
127
|
-
if (willFit < breadcrumbWidthsIncludingMargin.length - 1)
|
|
128
|
-
willFit
|
|
129
|
-
|
|
130
|
-
|
|
127
|
+
if (willFit < breadcrumbWidthsIncludingMargin.length - 1) {
|
|
128
|
+
if (spaceAvailable < overflowWidth) while (willFit > 0 && spaceAvailable < overflowWidth) {
|
|
129
|
+
willFit -= 1;
|
|
130
|
+
const itemToRemove = displayItemIndex(breadcrumbWidthsIncludingMargin.length, willFit);
|
|
131
|
+
spaceAvailable += breadcrumbWidthsIncludingMargin[itemToRemove];
|
|
132
|
+
}
|
|
131
133
|
}
|
|
132
134
|
}
|
|
133
135
|
if (willFit <= 1) setDisplayCount(1);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InterstitialScreenFooter.d.ts","sourceRoot":"","sources":["../../../src/components/InterstitialScreen/InterstitialScreenFooter.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAA2D,MAAM,OAAO,CAAC;AAIhF,OAAO,EAGL,UAAU,EACV,uBAAuB,EACxB,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"InterstitialScreenFooter.d.ts","sourceRoot":"","sources":["../../../src/components/InterstitialScreen/InterstitialScreenFooter.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAA2D,MAAM,OAAO,CAAC;AAIhF,OAAO,EAGL,UAAU,EACV,uBAAuB,EACxB,MAAM,WAAW,CAAC;AAYnB,KAAK,wBAAwB,GAAG;IAC9B,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mBAAmB,CAAC,EAAE,uBAAuB,CAAC;CAC/C,CAAC;AAEF,MAAM,WAAW,6BAA6B;IAC5C;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAE7B;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,oBAAoB,CAAC,EAAE,CAAC,MAAM,EAAE,wBAAwB,KAAK,KAAK,CAAC,SAAS,CAAC;IAE7E;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,wBAAwB,KAAK,IAAI,CAAC;CAC/E;AACD,QAAA,MAAM,wBAAwB,sGA2K5B,CAAC;AAEH,eAAe,wBAAwB,CAAC"}
|
|
@@ -10,7 +10,7 @@ import { clamp } from "../../global/js/utils/clamp.js";
|
|
|
10
10
|
import { InterstitialScreenContext, blockClass } from "./context.js";
|
|
11
11
|
import React, { useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
12
12
|
import PropTypes from "prop-types";
|
|
13
|
-
import { Button, InlineLoading, ModalFooter } from "@carbon/react";
|
|
13
|
+
import { Button, ButtonSet, InlineLoading, ModalFooter, usePrefix } from "@carbon/react";
|
|
14
14
|
import { ArrowRight } from "@carbon/react/icons";
|
|
15
15
|
|
|
16
16
|
//#region src/components/InterstitialScreen/InterstitialScreenFooter.tsx
|
|
@@ -27,7 +27,8 @@ const InterstitialScreenFooter = React.forwardRef((props, ref) => {
|
|
|
27
27
|
const startButtonRef = useRef(null);
|
|
28
28
|
const nextButtonRef = useRef(null);
|
|
29
29
|
const [loadingAction, setLoadingAction] = useState("");
|
|
30
|
-
const
|
|
30
|
+
const carbonPrefix = usePrefix();
|
|
31
|
+
const isMultiStep = !!stepCount && stepCount > 1;
|
|
31
32
|
const progStepFloor = 0;
|
|
32
33
|
const progStepCeil = stepCount - 1;
|
|
33
34
|
useEffect(() => {
|
|
@@ -61,14 +62,14 @@ const InterstitialScreenFooter = React.forwardRef((props, ref) => {
|
|
|
61
62
|
progStep,
|
|
62
63
|
progStepCeil
|
|
63
64
|
]);
|
|
64
|
-
const getFooterContent = () => /* @__PURE__ */ React.createElement(
|
|
65
|
+
const getFooterContent = () => /* @__PURE__ */ React.createElement(ButtonSet, null, isMultiStep && skipButtonLabel !== "" && /* @__PURE__ */ React.createElement(Button, {
|
|
65
66
|
className: `${blockClass}--skip-btn`,
|
|
66
67
|
kind: "ghost",
|
|
67
68
|
size: "lg",
|
|
68
69
|
title: skipButtonLabel,
|
|
69
70
|
onClick: handleSkip,
|
|
70
71
|
disabled: disableButtonConfig?.skip
|
|
71
|
-
}, skipButtonLabel, loadingAction === "skip" && /* @__PURE__ */ React.createElement(InlineLoading, null)),
|
|
72
|
+
}, skipButtonLabel, loadingAction === "skip" && /* @__PURE__ */ React.createElement(InlineLoading, null)), isMultiStep && progStep > 0 && /* @__PURE__ */ React.createElement(Button, {
|
|
72
73
|
className: `${blockClass}--prev-btn`,
|
|
73
74
|
kind: "secondary",
|
|
74
75
|
size: "lg",
|
|
@@ -91,23 +92,23 @@ const InterstitialScreenFooter = React.forwardRef((props, ref) => {
|
|
|
91
92
|
disabled: disableButtonConfig?.start,
|
|
92
93
|
onClick: handleStart,
|
|
93
94
|
...getRenderIcon
|
|
94
|
-
}, startButtonLabel, loadingAction === "start" && /* @__PURE__ */ React.createElement(InlineLoading, null)))
|
|
95
|
-
|
|
95
|
+
}, startButtonLabel, loadingAction === "start" && /* @__PURE__ */ React.createElement(InlineLoading, null)));
|
|
96
|
+
const footerContent = actionButtonRenderer ? actionButtonRenderer({
|
|
96
97
|
handleGotoStep,
|
|
97
98
|
progStep,
|
|
98
99
|
stepCount,
|
|
99
100
|
disableButtonConfig
|
|
100
|
-
}));
|
|
101
|
+
}) : getFooterContent();
|
|
101
102
|
return isFullScreen ? /* @__PURE__ */ React.createElement("div", {
|
|
102
103
|
ref,
|
|
103
|
-
className: `${footerBlockClass} ${className}`,
|
|
104
|
+
className: `${footerBlockClass} ${className} ${carbonPrefix}--modal-footer`,
|
|
104
105
|
...getDevtoolsProps("InterstitialScreenFooter"),
|
|
105
|
-
...
|
|
106
|
-
},
|
|
107
|
-
className: footerBlockClass
|
|
106
|
+
...rest
|
|
107
|
+
}, footerContent) : /* @__PURE__ */ React.createElement(ModalFooter, {
|
|
108
|
+
className: `${footerBlockClass} ${className}`,
|
|
108
109
|
ref,
|
|
109
110
|
...rest
|
|
110
|
-
},
|
|
111
|
+
}, footerContent);
|
|
111
112
|
});
|
|
112
113
|
InterstitialScreenFooter.propTypes = {
|
|
113
114
|
actionButtonRenderer: PropTypes.func,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InterstitialScreenHeader.d.ts","sourceRoot":"","sources":["../../../src/components/InterstitialScreen/InterstitialScreenHeader.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAQH,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"InterstitialScreenHeader.d.ts","sourceRoot":"","sources":["../../../src/components/InterstitialScreen/InterstitialScreenHeader.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAQH,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,MAAM,WAAW,6BAA6B;IAC5C;;;OAGG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B;;OAEG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,MAAM,CAAC;CAC1C,CAAC;AAEF,QAAA,MAAM,wBAAwB,sGA8F5B,CAAC;AAEH,eAAe,wBAAwB,CAAC"}
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
import { __toESM } from "../../_virtual/_rolldown/runtime.js";
|
|
9
9
|
import { require_classnames } from "../../node_modules/classnames/index.js";
|
|
10
10
|
import { getDevtoolsProps } from "../../global/js/utils/devtools.js";
|
|
11
|
-
import { useId } from "../../global/js/utils/useId.js";
|
|
12
11
|
import { InterstitialScreenContext, blockClass } from "./context.js";
|
|
13
12
|
import React from "react";
|
|
14
13
|
import PropTypes from "prop-types";
|
|
@@ -26,7 +25,6 @@ const InterstitialScreenHeader = React.forwardRef((props, ref) => {
|
|
|
26
25
|
const { className = "", headerTitle, headerSubTitle, closeIconDescription, hideProgressIndicator, children, ...rest } = props;
|
|
27
26
|
const { bodyChildrenData, isFullScreen, progStep, handleClose, stepCount } = React.useContext(InterstitialScreenContext);
|
|
28
27
|
const headerBlockClass = `${blockClass}--internal-header`;
|
|
29
|
-
const _useId = useId();
|
|
30
28
|
const carbonPrefix = usePrefix();
|
|
31
29
|
const headerContent = () => {
|
|
32
30
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, (headerTitle || headerSubTitle) && /* @__PURE__ */ React.createElement("div", { className: `${blockClass}--titleContainer` }, headerTitle && /* @__PURE__ */ React.createElement("h1", null, headerTitle), headerSubTitle && /* @__PURE__ */ React.createElement("h2", null, headerSubTitle)), children, !hideProgressIndicator && bodyChildrenData && Array.isArray(bodyChildrenData) && /* @__PURE__ */ React.createElement("div", { className: `${blockClass}--progress` }, /* @__PURE__ */ React.createElement(ProgressIndicator, {
|
|
@@ -34,7 +32,7 @@ const InterstitialScreenHeader = React.forwardRef((props, ref) => {
|
|
|
34
32
|
currentIndex: progStep
|
|
35
33
|
}, bodyChildrenData?.map((child, idx) => {
|
|
36
34
|
if (React.isValidElement(child)) {
|
|
37
|
-
const stepKey = `${
|
|
35
|
+
const stepKey = `${child.props?.stepTitle?.replace(/\s+/g, "") || "step"}-${idx}`;
|
|
38
36
|
return /* @__PURE__ */ React.createElement(ProgressStep, {
|
|
39
37
|
key: stepKey,
|
|
40
38
|
label: child.props.stepTitle ?? `Step ${idx + 1}`,
|
|
@@ -15,6 +15,7 @@ import { PageHeaderTagOverflow, type PageHeaderTagOverflowProps } from './PageHe
|
|
|
15
15
|
import { PageHeaderScrollButton, type PageHeaderScrollButtonProps } from './PageHeaderScrollButton';
|
|
16
16
|
import { PageHeaderTitleBreadcrumb } from './PageHeaderTitleBreadcrumb';
|
|
17
17
|
import { PageHeaderBreadcrumbOverflow, type PageHeaderBreadcrumbOverflowProps } from './PageHeaderBreadcrumbOverflow';
|
|
18
|
+
import { PageHeaderBreadcrumbPageActions, type PageHeaderBreadcrumbPageActionsProps, type PageHeaderBreadcrumbPageActionItem } from './PageHeaderBreadcrumbPageActions';
|
|
18
19
|
/**
|
|
19
20
|
* ----------
|
|
20
21
|
* PageHeader
|
|
@@ -23,6 +24,18 @@ import { PageHeaderBreadcrumbOverflow, type PageHeaderBreadcrumbOverflowProps }
|
|
|
23
24
|
export interface PageHeaderProps {
|
|
24
25
|
children?: React.ReactNode;
|
|
25
26
|
className?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Callback fired when the content area becomes fully collapsed
|
|
29
|
+
*/
|
|
30
|
+
onContentFullyCollapsed?: (collapsed: boolean) => void;
|
|
31
|
+
/**
|
|
32
|
+
* Callback fired when the title becomes clipped
|
|
33
|
+
*/
|
|
34
|
+
onTitleClipped?: (clipped: boolean) => void;
|
|
35
|
+
/**
|
|
36
|
+
* Callback fired when the content actions become clipped
|
|
37
|
+
*/
|
|
38
|
+
onContentActionsClipped?: (clipped: boolean) => void;
|
|
26
39
|
}
|
|
27
40
|
declare const PageHeader: React.ForwardRefExoticComponent<PageHeaderProps & React.RefAttributes<HTMLDivElement>>;
|
|
28
41
|
/**
|
|
@@ -65,6 +78,22 @@ declare const ScrollButton: React.ForwardRefExoticComponent<PageHeaderScrollButt
|
|
|
65
78
|
declare const TitleBreadcrumb: React.ForwardRefExoticComponent<import("@carbon/react").BreadcrumbItemProps & React.RefAttributes<HTMLLIElement>>;
|
|
66
79
|
declare const BreadcrumbOverflow: React.ForwardRefExoticComponent<PageHeaderBreadcrumbOverflowProps & React.RefAttributes<HTMLElement>>;
|
|
67
80
|
declare const TagOverflow: React.ForwardRefExoticComponent<PageHeaderTagOverflowProps & React.RefAttributes<HTMLDivElement>>;
|
|
68
|
-
|
|
69
|
-
|
|
81
|
+
declare const BreadcrumbPageActions: {
|
|
82
|
+
({ actions, className, overflowMenuLabel, buttonSize, buttonKind, ...other }: PageHeaderBreadcrumbPageActionsProps): React.JSX.Element;
|
|
83
|
+
displayName: string;
|
|
84
|
+
propTypes: {
|
|
85
|
+
actions: import("prop-types").Validator<NonNullable<import("prop-types").InferProps<{
|
|
86
|
+
id: import("prop-types").Validator<string>;
|
|
87
|
+
label: import("prop-types").Validator<string>;
|
|
88
|
+
renderIcon: import("prop-types").Validator<NonNullable<import("prop-types").ReactComponentLike>>;
|
|
89
|
+
onClick: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
90
|
+
}>>[]>;
|
|
91
|
+
buttonKind: import("prop-types").Requireable<string>;
|
|
92
|
+
buttonSize: import("prop-types").Requireable<string>;
|
|
93
|
+
className: import("prop-types").Requireable<string>;
|
|
94
|
+
overflowMenuLabel: import("prop-types").Requireable<string>;
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
export { PageHeader, PageHeaderBreadcrumbBar, PageHeaderContent, PageHeaderContentPageActions, PageHeaderContentText, PageHeaderHeroImage, PageHeaderTabBar, PageHeaderScrollButton, PageHeaderTitleBreadcrumb, PageHeaderBreadcrumbOverflow, PageHeaderTagOverflow, PageHeaderBreadcrumbPageActions, Root, BreadcrumbBar, Content, ContentPageActions, ContentText, HeroImage, TabBar, ScrollButton, TitleBreadcrumb, BreadcrumbOverflow, TagOverflow, BreadcrumbPageActions, };
|
|
98
|
+
export type { PageHeaderBreadcrumbBarProps, PageHeaderContentProps, PageHeaderContentPageActionsProps, PageHeaderContentTextProps, PageHeaderHeroImageProps, PageHeaderTabBarProps, PageHeaderScrollButtonProps, PageHeaderTagOverflowProps, PageHeaderBreadcrumbOverflowProps, PageHeaderBreadcrumbPageActionsProps, PageHeaderBreadcrumbPageActionItem, };
|
|
70
99
|
//# sourceMappingURL=PageHeader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageHeader.d.ts","sourceRoot":"","sources":["../../../../src/components/PageHeader/next/PageHeader.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,
|
|
1
|
+
{"version":3,"file":"PageHeader.d.ts","sourceRoot":"","sources":["../../../../src/components/PageHeader/next/PageHeader.tsx"],"names":[],"mappings":"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"}
|
|
@@ -22,7 +22,8 @@ import { PageHeaderTagOverflow } from "./PageHeaderTagOverflow.js";
|
|
|
22
22
|
import { PageHeaderScrollButton } from "./PageHeaderScrollButton.js";
|
|
23
23
|
import { PageHeaderTitleBreadcrumb } from "./PageHeaderTitleBreadcrumb.js";
|
|
24
24
|
import { PageHeaderBreadcrumbOverflow } from "./PageHeaderBreadcrumbOverflow.js";
|
|
25
|
-
import
|
|
25
|
+
import { PageHeaderBreadcrumbPageActions } from "./PageHeaderBreadcrumbPageActions.js";
|
|
26
|
+
import React, { useEffect, useMemo, useRef, useState } from "react";
|
|
26
27
|
|
|
27
28
|
//#region src/components/PageHeader/next/PageHeader.tsx
|
|
28
29
|
/**
|
|
@@ -32,7 +33,7 @@ import React, { useEffect, useRef, useState } from "react";
|
|
|
32
33
|
* LICENSE file in the root directory of this source tree.
|
|
33
34
|
*/
|
|
34
35
|
var import_classnames = /* @__PURE__ */ __toESM(require_classnames());
|
|
35
|
-
const PageHeader = React.forwardRef(function PageHeader({ className, children, ...other }, ref) {
|
|
36
|
+
const PageHeader = React.forwardRef(function PageHeader({ className, children, onContentFullyCollapsed, onTitleClipped, onContentActionsClipped, ...other }, ref) {
|
|
36
37
|
const [refs, setRefs] = useState({});
|
|
37
38
|
const [pageActionsInstance, setPageActionsInstance] = useState(null);
|
|
38
39
|
const tempRef = useRef(null);
|
|
@@ -52,67 +53,81 @@ const PageHeader = React.forwardRef(function PageHeader({ className, children, .
|
|
|
52
53
|
const [fullyCollapsed, setFullyCollapsed] = useState(false);
|
|
53
54
|
const [titleClipped, setTitleClipped] = useState(false);
|
|
54
55
|
const [contentActionsClipped, setContentActionsClipped] = useState(false);
|
|
55
|
-
const [breadcrumbActionsClipped, setBreadcrumbActionsClipped] = useState(false);
|
|
56
56
|
useEffect(() => {
|
|
57
|
-
if (!
|
|
57
|
+
if (!componentRef?.current) return;
|
|
58
58
|
const totalHeaderOffset = getHeaderOffset(componentRef?.current);
|
|
59
59
|
const predefinedContentPadding = 24;
|
|
60
|
-
const contentObserver = new IntersectionObserver((entries) => {
|
|
60
|
+
const contentObserver = refs?.contentRef?.current ? new IntersectionObserver((entries) => {
|
|
61
61
|
entries.forEach((entry) => {
|
|
62
|
-
if (entry.target === refs?.contentRef.current)
|
|
62
|
+
if (entry.target === refs?.contentRef.current) {
|
|
63
|
+
const collapsed = !entry.isIntersecting;
|
|
64
|
+
setFullyCollapsed(collapsed);
|
|
65
|
+
onContentFullyCollapsed?.(collapsed);
|
|
66
|
+
}
|
|
63
67
|
});
|
|
64
68
|
}, {
|
|
65
69
|
root: null,
|
|
66
|
-
rootMargin: `${(predefinedContentPadding + totalHeaderOffset +
|
|
70
|
+
rootMargin: `${(predefinedContentPadding + (refs?.contentRef?.current?.offsetHeight || 0) + totalHeaderOffset + 24) * -1}px 0px 0px 0px`,
|
|
67
71
|
threshold: .1
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
const totalTitleHeight = refs?.titleRef.current.offsetHeight;
|
|
71
|
-
const titleObserver = new IntersectionObserver((entries) => {
|
|
72
|
+
}) : null;
|
|
73
|
+
const titleObserver = refs?.titleRef?.current ? new IntersectionObserver((entries) => {
|
|
72
74
|
entries.forEach((entry) => {
|
|
73
|
-
if (entry.target === refs?.titleRef.current)
|
|
75
|
+
if (entry.target === refs?.titleRef.current) {
|
|
76
|
+
const clipped = !entry.isIntersecting;
|
|
77
|
+
setTitleClipped(clipped);
|
|
78
|
+
onTitleClipped?.(clipped);
|
|
79
|
+
}
|
|
74
80
|
});
|
|
75
81
|
}, {
|
|
76
82
|
root: null,
|
|
77
|
-
rootMargin: `${(predefinedContentPadding +
|
|
83
|
+
rootMargin: `${(predefinedContentPadding + (refs?.titleRef.current.offsetHeight || 0) + totalHeaderOffset + 24) * -1}px 0px 0px 0px`,
|
|
78
84
|
threshold: .1
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
const contentActionsObserver = new IntersectionObserver((entries) => {
|
|
85
|
+
}) : null;
|
|
86
|
+
const contentActionsObserver = refs?.contentActions?.current ? new IntersectionObserver((entries) => {
|
|
82
87
|
entries.forEach((entry) => {
|
|
83
88
|
if (entry.target === refs?.contentActions.current) {
|
|
84
|
-
|
|
85
|
-
|
|
89
|
+
const clipped = !entry.isIntersecting;
|
|
90
|
+
setContentActionsClipped(clipped);
|
|
91
|
+
onContentActionsClipped?.(clipped);
|
|
86
92
|
}
|
|
87
93
|
});
|
|
88
94
|
}, {
|
|
89
95
|
root: null,
|
|
90
|
-
rootMargin: `${(predefinedContentPadding + totalHeaderOffset + 24) * -1}px 0px 0px 0px`,
|
|
96
|
+
rootMargin: `${(predefinedContentPadding + (refs?.contentActions?.current?.offsetHeight || 0) + totalHeaderOffset + 24) * -1}px 0px 0px 0px`,
|
|
91
97
|
threshold: .1
|
|
92
|
-
});
|
|
93
|
-
if (refs?.contentRef?.current) contentObserver.observe(refs.contentRef.current);
|
|
94
|
-
if (refs?.titleRef?.current) titleObserver.observe(refs.titleRef.current);
|
|
95
|
-
if (refs?.contentActions?.current) contentActionsObserver.observe(refs.contentActions.current);
|
|
98
|
+
}) : null;
|
|
99
|
+
if (refs?.contentRef?.current && contentObserver) contentObserver.observe(refs.contentRef.current);
|
|
100
|
+
if (refs?.titleRef?.current && titleObserver) titleObserver.observe(refs.titleRef.current);
|
|
101
|
+
if (refs?.contentActions?.current && contentActionsObserver) contentActionsObserver.observe(refs.contentActions.current);
|
|
96
102
|
return () => {
|
|
97
|
-
contentObserver
|
|
98
|
-
titleObserver
|
|
99
|
-
contentActionsObserver
|
|
103
|
+
contentObserver?.disconnect();
|
|
104
|
+
titleObserver?.disconnect();
|
|
105
|
+
contentActionsObserver?.disconnect();
|
|
100
106
|
};
|
|
101
107
|
}, [
|
|
102
108
|
refs?.contentRef,
|
|
103
109
|
refs?.titleRef,
|
|
104
110
|
refs?.contentActions,
|
|
105
|
-
componentRef
|
|
111
|
+
componentRef,
|
|
112
|
+
onContentFullyCollapsed,
|
|
113
|
+
onTitleClipped,
|
|
114
|
+
onContentActionsClipped
|
|
115
|
+
]);
|
|
116
|
+
const observerState = useMemo(() => ({
|
|
117
|
+
fullyCollapsed,
|
|
118
|
+
titleClipped,
|
|
119
|
+
contentActionsClipped
|
|
120
|
+
}), [
|
|
121
|
+
fullyCollapsed,
|
|
122
|
+
titleClipped,
|
|
123
|
+
contentActionsClipped
|
|
106
124
|
]);
|
|
107
125
|
return /* @__PURE__ */ React.createElement(PageHeaderContext.Provider, { value: {
|
|
108
126
|
refs,
|
|
109
127
|
setRefs,
|
|
110
128
|
pageActionsInstance,
|
|
111
129
|
setPageActionsInstance,
|
|
112
|
-
|
|
113
|
-
titleClipped,
|
|
114
|
-
contentActionsClipped,
|
|
115
|
-
breadcrumbActionsClipped
|
|
130
|
+
observerState
|
|
116
131
|
} }, /* @__PURE__ */ React.createElement("div", {
|
|
117
132
|
className: classNames,
|
|
118
133
|
ref: componentRef,
|
|
@@ -147,6 +162,8 @@ const BreadcrumbOverflow = PageHeaderBreadcrumbOverflow;
|
|
|
147
162
|
BreadcrumbOverflow.displayName = "PageHeaderBreadcrumbOverflow";
|
|
148
163
|
const TagOverflow = PageHeaderTagOverflow;
|
|
149
164
|
TagOverflow.displayName = "PageHeaderTagOverflow";
|
|
165
|
+
const BreadcrumbPageActions = PageHeaderBreadcrumbPageActions;
|
|
166
|
+
BreadcrumbPageActions.displayName = "PageHeaderBreadcrumbPageActions";
|
|
150
167
|
|
|
151
168
|
//#endregion
|
|
152
|
-
export { BreadcrumbBar, BreadcrumbOverflow, Content, ContentPageActions, ContentText, HeroImage, PageHeader, Root, ScrollButton, TabBar, TagOverflow, TitleBreadcrumb };
|
|
169
|
+
export { BreadcrumbBar, BreadcrumbOverflow, BreadcrumbPageActions, Content, ContentPageActions, ContentText, HeroImage, PageHeader, Root, ScrollButton, TabBar, TagOverflow, TitleBreadcrumb };
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import React, { type ComponentType, type FunctionComponent } from 'react';
|
|
8
|
+
import { type PageHeaderObserverState } from './context';
|
|
8
9
|
/**
|
|
9
10
|
* -----------------------
|
|
10
11
|
* PageHeaderBreadcrumbBar
|
|
@@ -22,17 +23,19 @@ export interface PageHeaderBreadcrumbBarProps {
|
|
|
22
23
|
*/
|
|
23
24
|
renderIcon?: ComponentType | FunctionComponent;
|
|
24
25
|
/**
|
|
25
|
-
* The PageHeaderBreadcrumbBar's content actions
|
|
26
|
+
* The PageHeaderBreadcrumbBar's content actions.
|
|
27
|
+
* Can be a ReactNode or a function that receives observer state.
|
|
26
28
|
*/
|
|
27
|
-
contentActions?: React.ReactNode;
|
|
29
|
+
contentActions?: React.ReactNode | ((state: PageHeaderObserverState) => React.ReactNode);
|
|
28
30
|
/**
|
|
29
31
|
* `true` to set content actions flush against page actions
|
|
30
32
|
*/
|
|
31
33
|
contentActionsFlush?: boolean;
|
|
32
34
|
/**
|
|
33
|
-
* The PageHeaderContent's page actions
|
|
35
|
+
* The PageHeaderContent's page actions.
|
|
36
|
+
* Can be a ReactNode or a function that receives observer state.
|
|
34
37
|
*/
|
|
35
|
-
pageActions?: React.ReactNode;
|
|
38
|
+
pageActions?: React.ReactNode | ((state: PageHeaderObserverState) => React.ReactNode);
|
|
36
39
|
/**
|
|
37
40
|
* `true` to set page actions flush with page
|
|
38
41
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageHeaderBreadcrumbBar.d.ts","sourceRoot":"","sources":["../../../../src/components/PageHeader/next/PageHeaderBreadcrumbBar.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,EAAE,KAAK,aAAa,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"PageHeaderBreadcrumbBar.d.ts","sourceRoot":"","sources":["../../../../src/components/PageHeader/next/PageHeaderBreadcrumbBar.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,EAAE,KAAK,aAAa,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAI1E,OAAO,EAGL,KAAK,uBAAuB,EAC7B,MAAM,WAAW,CAAC;AAEnB;;;;GAIG;AACH,MAAM,WAAW,4BAA4B;IAC3C;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,UAAU,CAAC,EAAE,aAAa,GAAG,iBAAiB,CAAC;IAC/C;;;OAGG;IACH,cAAc,CAAC,EACX,KAAK,CAAC,SAAS,GACf,CAAC,CAAC,KAAK,EAAE,uBAAuB,KAAK,KAAK,CAAC,SAAS,CAAC,CAAC;IAC1D;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;;OAGG;IACH,WAAW,CAAC,EACR,KAAK,CAAC,SAAS,GACf,CAAC,CAAC,KAAK,EAAE,uBAAuB,KAAK,KAAK,CAAC,SAAS,CAAC,CAAC;IAC1D;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,eAAO,MAAM,uBAAuB,qGAmFlC,CAAC"}
|
|
@@ -22,20 +22,24 @@ import { Column, Grid } from "@carbon/react";
|
|
|
22
22
|
var import_classnames = /* @__PURE__ */ __toESM(require_classnames());
|
|
23
23
|
const PageHeaderBreadcrumbBar = React.forwardRef(function PageHeaderBreadcrumbBar({ border = true, className, children, renderIcon: IconElement, contentActions, contentActionsFlush, pageActions, pageActionsFlush, ...other }, ref) {
|
|
24
24
|
const context = usePageHeader();
|
|
25
|
-
const { pageActionsInstance: globalActions,
|
|
25
|
+
const { pageActionsInstance: globalActions, observerState } = context;
|
|
26
26
|
const classNames = (0, import_classnames.default)({
|
|
27
27
|
[`${blockClass}__breadcrumb-bar`]: true,
|
|
28
28
|
[`${blockClass}__breadcrumb-bar-border`]: border,
|
|
29
29
|
[`${blockClass}__breadcrumb__actions-flush`]: pageActionsFlush
|
|
30
30
|
}, className);
|
|
31
|
+
const resolvedContentActions = typeof contentActions === "function" ? contentActions(observerState) : contentActions;
|
|
32
|
+
const isFunctionalContentActions = typeof contentActions === "function";
|
|
31
33
|
const contentActionsClasses = (0, import_classnames.default)({
|
|
32
34
|
[`${blockClass}__breadcrumb__content-actions`]: !contentActionsFlush,
|
|
33
35
|
[`${blockClass}__breadcrumb__content-actions-with-global-actions`]: !!globalActions,
|
|
34
|
-
[`${blockClass}__breadcrumb__content-actions-with-global-actions--show`]: contentActionsClipped
|
|
36
|
+
[`${blockClass}__breadcrumb__content-actions-with-global-actions--show`]: observerState.contentActionsClipped || isFunctionalContentActions
|
|
35
37
|
});
|
|
38
|
+
const resolvedPageActions = typeof pageActions === "function" ? pageActions(observerState) : pageActions;
|
|
36
39
|
return /* @__PURE__ */ React.createElement(PageHeaderContext.Provider, { value: {
|
|
37
40
|
...context,
|
|
38
|
-
isContentActionsInBreadcrumbBar: true
|
|
41
|
+
isContentActionsInBreadcrumbBar: true,
|
|
42
|
+
isFunctionalContentActions
|
|
39
43
|
} }, /* @__PURE__ */ React.createElement("div", {
|
|
40
44
|
className: classNames,
|
|
41
45
|
ref,
|
|
@@ -44,7 +48,7 @@ const PageHeaderBreadcrumbBar = React.forwardRef(function PageHeaderBreadcrumbBa
|
|
|
44
48
|
lg: 16,
|
|
45
49
|
md: 8,
|
|
46
50
|
sm: 4
|
|
47
|
-
}, /* @__PURE__ */ React.createElement("div", { className: `${blockClass}__breadcrumb-container` }, /* @__PURE__ */ React.createElement("div", { className: `${blockClass}__breadcrumb-wrapper` }, IconElement && /* @__PURE__ */ React.createElement("div", { className: `${blockClass}__breadcrumb__icon` }, /* @__PURE__ */ React.createElement(IconElement, null)), children), /* @__PURE__ */ React.createElement("div", { className: `${blockClass}__breadcrumb__actions` }, /* @__PURE__ */ React.createElement("div", { className: contentActionsClasses },
|
|
51
|
+
}, /* @__PURE__ */ React.createElement("div", { className: `${blockClass}__breadcrumb-container` }, /* @__PURE__ */ React.createElement("div", { className: `${blockClass}__breadcrumb-wrapper` }, IconElement && /* @__PURE__ */ React.createElement("div", { className: `${blockClass}__breadcrumb__icon` }, /* @__PURE__ */ React.createElement(IconElement, null)), children), /* @__PURE__ */ React.createElement("div", { className: `${blockClass}__breadcrumb__actions` }, /* @__PURE__ */ React.createElement("div", { className: contentActionsClasses }, resolvedContentActions), resolvedPageActions))))));
|
|
48
52
|
});
|
|
49
53
|
PageHeaderBreadcrumbBar.displayName = "PageHeaderBreadcrumbBar";
|
|
50
54
|
|
|
@@ -0,0 +1,85 @@
|
|
|
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 PropTypes from 'prop-types';
|
|
9
|
+
/**
|
|
10
|
+
* --------------------------------
|
|
11
|
+
* PageHeaderBreadcrumbPageActions
|
|
12
|
+
* --------------------------------
|
|
13
|
+
*/
|
|
14
|
+
export interface PageHeaderBreadcrumbPageActionItem {
|
|
15
|
+
/**
|
|
16
|
+
* Unique identifier for the action item
|
|
17
|
+
*/
|
|
18
|
+
id: string;
|
|
19
|
+
/**
|
|
20
|
+
* Label for the action (used for icon description and overflow menu item text)
|
|
21
|
+
*/
|
|
22
|
+
label: string;
|
|
23
|
+
/**
|
|
24
|
+
* Icon component to render for the action button
|
|
25
|
+
*/
|
|
26
|
+
renderIcon: React.ComponentType;
|
|
27
|
+
/**
|
|
28
|
+
* Click handler for the action
|
|
29
|
+
*/
|
|
30
|
+
onClick?: () => void;
|
|
31
|
+
}
|
|
32
|
+
export interface PageHeaderBreadcrumbPageActionsProps {
|
|
33
|
+
/**
|
|
34
|
+
* Array of action items to display
|
|
35
|
+
*/
|
|
36
|
+
actions: PageHeaderBreadcrumbPageActionItem[];
|
|
37
|
+
/**
|
|
38
|
+
* Specify an optional className to be added to the component
|
|
39
|
+
*/
|
|
40
|
+
className?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Aria label for the overflow menu
|
|
43
|
+
*/
|
|
44
|
+
overflowMenuLabel?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Size of the action buttons
|
|
47
|
+
*/
|
|
48
|
+
buttonSize?: 'sm' | 'md' | 'lg';
|
|
49
|
+
/**
|
|
50
|
+
* Kind of the action buttons
|
|
51
|
+
*/
|
|
52
|
+
buttonKind?: 'primary' | 'secondary' | 'tertiary' | 'ghost' | 'danger' | 'danger--tertiary' | 'danger--ghost';
|
|
53
|
+
}
|
|
54
|
+
export declare const PageHeaderBreadcrumbPageActions: {
|
|
55
|
+
({ actions, className, overflowMenuLabel, buttonSize, buttonKind, ...other }: PageHeaderBreadcrumbPageActionsProps): React.JSX.Element;
|
|
56
|
+
displayName: string;
|
|
57
|
+
propTypes: {
|
|
58
|
+
/**
|
|
59
|
+
* Array of action items to display
|
|
60
|
+
*/
|
|
61
|
+
actions: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
62
|
+
id: PropTypes.Validator<string>;
|
|
63
|
+
label: PropTypes.Validator<string>;
|
|
64
|
+
renderIcon: PropTypes.Validator<NonNullable<PropTypes.ReactComponentLike>>;
|
|
65
|
+
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
66
|
+
}>>[]>;
|
|
67
|
+
/**
|
|
68
|
+
* Kind of the action buttons
|
|
69
|
+
*/
|
|
70
|
+
buttonKind: PropTypes.Requireable<string>;
|
|
71
|
+
/**
|
|
72
|
+
* Size of the action buttons
|
|
73
|
+
*/
|
|
74
|
+
buttonSize: PropTypes.Requireable<string>;
|
|
75
|
+
/**
|
|
76
|
+
* Specify an optional className to be added to the component
|
|
77
|
+
*/
|
|
78
|
+
className: PropTypes.Requireable<string>;
|
|
79
|
+
/**
|
|
80
|
+
* Aria label for the overflow menu
|
|
81
|
+
*/
|
|
82
|
+
overflowMenuLabel: PropTypes.Requireable<string>;
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
//# sourceMappingURL=PageHeaderBreadcrumbPageActions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PageHeaderBreadcrumbPageActions.d.ts","sourceRoot":"","sources":["../../../../src/components/PageHeader/next/PageHeaderBreadcrumbPageActions.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAsC,MAAM,OAAO,CAAC;AAC3D,OAAO,SAAS,MAAM,YAAY,CAAC;AAWnC;;;;GAIG;AAEH,MAAM,WAAW,kCAAkC;IACjD;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,UAAU,EAAE,KAAK,CAAC,aAAa,CAAC;IAChC;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,MAAM,WAAW,oCAAoC;IACnD;;OAEG;IACH,OAAO,EAAE,kCAAkC,EAAE,CAAC;IAC9C;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;OAEG;IACH,UAAU,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAChC;;OAEG;IACH,UAAU,CAAC,EACP,SAAS,GACT,WAAW,GACX,UAAU,GACV,OAAO,GACP,QAAQ,GACR,kBAAkB,GAClB,eAAe,CAAC;CACrB;AAED,eAAO,MAAM,+BAA+B;kFAOzC,oCAAoC;;;QA4ErC;;WAEG;;;;;;;QASH;;WAEG;;QAUH;;WAEG;;QAEH;;WAEG;;QAEH;;WAEG;;;CAtCJ,CAAC"}
|
|
@@ -0,0 +1,100 @@
|
|
|
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 { __toESM } from "../../../_virtual/_rolldown/runtime.js";
|
|
9
|
+
import { require_classnames } from "../../../node_modules/classnames/index.js";
|
|
10
|
+
import { blockClass } from "../PageHeaderUtils.js";
|
|
11
|
+
import React, { useEffect, useRef, useState } from "react";
|
|
12
|
+
import PropTypes from "prop-types";
|
|
13
|
+
import { Button, FeatureFlags, OverflowMenu, OverflowMenuItem } from "@carbon/react";
|
|
14
|
+
import { createOverflowHandler } from "@carbon/utilities";
|
|
15
|
+
|
|
16
|
+
//#region src/components/PageHeader/next/PageHeaderBreadcrumbPageActions.tsx
|
|
17
|
+
/**
|
|
18
|
+
* Copyright IBM Corp. 2026
|
|
19
|
+
*
|
|
20
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
21
|
+
* LICENSE file in the root directory of this source tree.
|
|
22
|
+
*/
|
|
23
|
+
var import_classnames = /* @__PURE__ */ __toESM(require_classnames());
|
|
24
|
+
const PageHeaderBreadcrumbPageActions = ({ actions, className, overflowMenuLabel = "More page actions", buttonSize = "md", buttonKind = "ghost", ...other }) => {
|
|
25
|
+
const containerRef = useRef(null);
|
|
26
|
+
const [hiddenItems, setHiddenItems] = useState([]);
|
|
27
|
+
const classNames = (0, import_classnames.default)(`${blockClass}__breadcrumb-page-actions`, className);
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
if (!containerRef.current) return;
|
|
30
|
+
const handler = createOverflowHandler({
|
|
31
|
+
container: containerRef.current,
|
|
32
|
+
onChange: (_visible, hidden) => {
|
|
33
|
+
const hiddenIds = hidden.map((el) => el.dataset.id);
|
|
34
|
+
setHiddenItems(actions.filter((item) => hiddenIds.includes(item.id)));
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
return () => handler.disconnect();
|
|
38
|
+
}, [actions]);
|
|
39
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
40
|
+
ref: containerRef,
|
|
41
|
+
className: classNames,
|
|
42
|
+
style: {
|
|
43
|
+
display: "inline-flex",
|
|
44
|
+
alignItems: "center",
|
|
45
|
+
justifyContent: "flex-end",
|
|
46
|
+
inlineSize: "50%"
|
|
47
|
+
},
|
|
48
|
+
...other
|
|
49
|
+
}, actions.map((item) => /* @__PURE__ */ React.createElement("div", {
|
|
50
|
+
key: item.id,
|
|
51
|
+
"data-id": item.id
|
|
52
|
+
}, /* @__PURE__ */ React.createElement(Button, {
|
|
53
|
+
renderIcon: item.renderIcon,
|
|
54
|
+
iconDescription: item.label,
|
|
55
|
+
hasIconOnly: true,
|
|
56
|
+
size: buttonSize,
|
|
57
|
+
kind: buttonKind,
|
|
58
|
+
onClick: item.onClick
|
|
59
|
+
}))), /* @__PURE__ */ React.createElement("div", {
|
|
60
|
+
"data-offset": true,
|
|
61
|
+
"data-hidden": true,
|
|
62
|
+
"data-floating-menu-container": true,
|
|
63
|
+
style: { position: "relative" }
|
|
64
|
+
}, /* @__PURE__ */ React.createElement(FeatureFlags, { enableV12Overflowmenu: true }, /* @__PURE__ */ React.createElement(OverflowMenu, {
|
|
65
|
+
size: buttonSize,
|
|
66
|
+
"aria-label": overflowMenuLabel
|
|
67
|
+
}, hiddenItems.map((item) => /* @__PURE__ */ React.createElement(OverflowMenuItem, {
|
|
68
|
+
key: item.id,
|
|
69
|
+
itemText: item.label,
|
|
70
|
+
onClick: item.onClick
|
|
71
|
+
}))))));
|
|
72
|
+
};
|
|
73
|
+
PageHeaderBreadcrumbPageActions.displayName = "PageHeaderBreadcrumbPageActions";
|
|
74
|
+
PageHeaderBreadcrumbPageActions.propTypes = {
|
|
75
|
+
actions: PropTypes.arrayOf(PropTypes.shape({
|
|
76
|
+
id: PropTypes.string.isRequired,
|
|
77
|
+
label: PropTypes.string.isRequired,
|
|
78
|
+
renderIcon: PropTypes.elementType.isRequired,
|
|
79
|
+
onClick: PropTypes.func
|
|
80
|
+
}).isRequired).isRequired,
|
|
81
|
+
buttonKind: PropTypes.oneOf([
|
|
82
|
+
"primary",
|
|
83
|
+
"secondary",
|
|
84
|
+
"tertiary",
|
|
85
|
+
"ghost",
|
|
86
|
+
"danger",
|
|
87
|
+
"danger--tertiary",
|
|
88
|
+
"danger--ghost"
|
|
89
|
+
]),
|
|
90
|
+
buttonSize: PropTypes.oneOf([
|
|
91
|
+
"sm",
|
|
92
|
+
"md",
|
|
93
|
+
"lg"
|
|
94
|
+
]),
|
|
95
|
+
className: PropTypes.string,
|
|
96
|
+
overflowMenuLabel: PropTypes.string
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
//#endregion
|
|
100
|
+
export { PageHeaderBreadcrumbPageActions };
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import React, { type ComponentType, type FunctionComponent } from 'react';
|
|
8
|
+
import { type PageHeaderObserverState } from './context';
|
|
8
9
|
/**
|
|
9
10
|
* -----------------
|
|
10
11
|
* PageHeaderContent
|
|
@@ -32,9 +33,10 @@ export interface PageHeaderContentProps {
|
|
|
32
33
|
*/
|
|
33
34
|
contextualActions?: React.ReactNode;
|
|
34
35
|
/**
|
|
35
|
-
* The PageHeaderContent's page actions
|
|
36
|
+
* The PageHeaderContent's page actions.
|
|
37
|
+
* Can be a ReactNode or a function that receives observer state.
|
|
36
38
|
*/
|
|
37
|
-
pageActions?: React.ReactNode;
|
|
39
|
+
pageActions?: React.ReactNode | ((state: PageHeaderObserverState) => React.ReactNode);
|
|
38
40
|
}
|
|
39
41
|
export declare const PageHeaderContent: React.ForwardRefExoticComponent<PageHeaderContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
40
42
|
//# sourceMappingURL=PageHeaderContent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageHeaderContent.d.ts","sourceRoot":"","sources":["../../../../src/components/PageHeader/next/PageHeaderContent.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,EACZ,KAAK,aAAa,EAClB,KAAK,iBAAiB,
|
|
1
|
+
{"version":3,"file":"PageHeaderContent.d.ts","sourceRoot":"","sources":["../../../../src/components/PageHeader/next/PageHeaderContent.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,EACZ,KAAK,aAAa,EAClB,KAAK,iBAAiB,EAMvB,MAAM,OAAO,CAAC;AAaf,OAAO,EAAiB,KAAK,uBAAuB,EAAE,MAAM,WAAW,CAAC;AAExE;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,UAAU,CAAC,EAAE,aAAa,GAAG,iBAAiB,CAAC;IAC/C;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,iBAAiB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACpC;;;OAGG;IACH,WAAW,CAAC,EACR,KAAK,CAAC,SAAS,GACf,CAAC,CAAC,KAAK,EAAE,uBAAuB,KAAK,KAAK,CAAC,SAAS,CAAC,CAAC;CAC3D;AAED,eAAO,MAAM,iBAAiB,+FA2G5B,CAAC"}
|