UNPKG

@carbon/ibm-products

Version:
34 lines (32 loc) 993 B
/** * 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/Card/next/CardContext.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. */ /** * Context for sharing Card state with child components */ const CardContext = (0, react.createContext)(void 0); /** * Hook to access Card context * @returns CardContextValue * @throws Error if used outside of Card component */ const useCardContext = () => { const context = (0, react.useContext)(CardContext); if (!context) throw new Error("Card subcomponents must be used within a Card component"); return context; }; //#endregion exports.CardContext = CardContext; exports.useCardContext = useCardContext;