UNPKG

@carbon/ibm-products

Version:
42 lines (40 loc) 1.82 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 { usePageHeader } from "./context.js"; import React, { forwardRef } from "react"; import { BreadcrumbItem } from "@carbon/react"; //#region src/components/PageHeader/next/PageHeaderTitleBreadcrumb.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 PageHeaderTitleBreadcrumb = forwardRef(({ className, children, ...other }, ref) => { const { observerState, refs } = usePageHeader(); const titleClipped = observerState.titleClipped; const hasContentElement = refs?.contentRef?.current; const shouldShow = !hasContentElement || titleClipped && !!refs?.titleRef; return /* @__PURE__ */ React.createElement(BreadcrumbItem, { ref, isCurrentPage: true, ...other, "aria-hidden": hasContentElement && !titleClipped ? true : void 0, className: (0, import_classnames.default)(className, `${pkg.prefix}--page-header-title-breadcrumb`, { [`${pkg.prefix}--page-header-title-breadcrumb-show`]: shouldShow, [`${pkg.prefix}--page-header-title-breadcrumb-show__with-content-element`]: hasContentElement, [`${pkg.prefix}--page-header-title-breadcrumb-show__without-content-element`]: !hasContentElement }) }, children); }); PageHeaderTitleBreadcrumb.displayName = "PageHeaderTitleBreadcrumb"; //#endregion export { PageHeaderTitleBreadcrumb };