'use client'; import * as React from 'react'; import type { AccordionRoot, AccordionRootState, AccordionValue } from './AccordionRoot'; export interface AccordionRootContext { disabled: boolean; handleValueChange: ( newValue: Value, nextOpen: boolean, eventDetails: AccordionRoot.ChangeEventDetails, ) => void; keepMounted: boolean; state: AccordionRootState; value: AccordionValue; } export const AccordionRootContext = React.createContext | undefined>( undefined, ); export function useAccordionRootContext() { const context = React.useContext | undefined>(AccordionRootContext); if (context === undefined) { throw new Error( 'Zest: AccordionRootContext is missing. Accordion parts must be placed within .', ); } return context; }