@carbon/ibm-products
Version:
Carbon for IBM Products
38 lines (36 loc) • 1.13 kB
JavaScript
/**
* 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.
*/
require("../../../_virtual/_rolldown/runtime.js");
let react = require("react");
//#region src/components/PageHeader/next/context.ts
/**
* Copyright IBM Corp. 2025, 2025
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
const PageHeaderContext = (0, react.createContext)({
setRefs: () => {},
refs: {},
pageActionsInstance: null,
setPageActionsInstance: () => {},
observerState: {
fullyCollapsed: false,
titleClipped: false,
contentActionsClipped: false
},
disableStickyTabBar: false,
setDisableStickyTabBar: () => {}
});
function usePageHeader() {
const context = (0, react.useContext)(PageHeaderContext);
if (!context) throw new Error("Page header context was not provided or hook was used outside of the Page header component.");
return context;
}
//#endregion
exports.PageHeaderContext = PageHeaderContext;
exports.usePageHeader = usePageHeader;