import React, { type ReactNode } from 'react'; type Context = { titleId: string; }; export const PanelContext = React.createContext({ titleId: '' }); type PanelProviderProps = { children: ReactNode; titleId: string; }; export function PanelProvider({ /** * The content of the PanelProvider. */ children, /** * The Id of the title element for accessibility. */ titleId, }: PanelProviderProps) { return ( {children} ); } export function usePanelContext() { const context = React.useContext(PanelContext); if (context === null) { throw new Error('usePanelContext should be within a PanelProvider'); } return context; }