UNPKG

@carbon/ibm-products

Version:
52 lines (50 loc) 2.31 kB
/** * Copyright IBM Corp. 2020, 2026 * * This source code is licensed under the Apache-2.0 license found in the * LICENSE file in the root directory of this source tree. */ import { __toESM } from "../../../_virtual/_rolldown/runtime.js"; import { require_classnames } from "../../../node_modules/classnames/index.js"; import { pkg } from "../../../settings.js"; import { blockClass } from "../PageHeaderUtils.js"; import { usePageHeader } from "./context.js"; import React, { useEffect } from "react"; import { Column, Grid } from "@carbon/react"; //#region src/components/PageHeader/next/PageHeaderTabBar.tsx /** * Copyright IBM Corp. 2026 * * This source code is licensed under the Apache-2.0 license found in the * LICENSE file in the root directory of this source tree. */ var import_classnames = /* @__PURE__ */ __toESM(require_classnames()); const PageHeaderTabBar = React.forwardRef(function PageHeaderTabBar({ className, children, tags, scroller, disableStickyTabBar = false, ...other }, ref) { const { setDisableStickyTabBar } = usePageHeader(); useEffect(() => { setDisableStickyTabBar?.(disableStickyTabBar); }, [disableStickyTabBar, setDisableStickyTabBar]); const classNames = (0, import_classnames.default)({ [`${blockClass}__tab-bar`]: true }, className); const renderScroller = () => scroller && /* @__PURE__ */ React.createElement("div", { className: `${pkg.prefix}--page-header--scroller-button-container` }, scroller); if (!tags) return /* @__PURE__ */ React.createElement("div", { className: classNames, ref, ...other }, /* @__PURE__ */ React.createElement(Grid, { condensed: true }, /* @__PURE__ */ React.createElement(Column, { lg: 16, md: 8, sm: 4 }, children)), renderScroller()); return /* @__PURE__ */ React.createElement("div", { className: classNames, ref, ...other }, /* @__PURE__ */ React.createElement(Grid, { condensed: true }, /* @__PURE__ */ React.createElement(Column, { lg: 16, md: 8, sm: 4 }, /* @__PURE__ */ React.createElement("div", { className: (0, import_classnames.default)(`${blockClass}__tab-bar--tablist`, { [`${pkg.prefix}--page-header__tab-bar--with-scroller`]: !!scroller }) }, children, tags))), renderScroller()); }); PageHeaderTabBar.displayName = "PageHeaderTabBar"; //#endregion export { PageHeaderTabBar };