import type { Orientation } from "@kobalte/utils"; import { type Accessor, createContext, useContext } from "solid-js"; import type { ListState } from "../list"; export interface ToggleGroupContextValue { isMultiple: Accessor; isDisabled: Accessor; listState: Accessor; generateId: (part: string) => string; orientation: Accessor; } export const ToggleGroupContext = createContext(); export function useToggleGroupContext() { const context = useContext(ToggleGroupContext); if (context === undefined) { throw new Error( "[kobalte]: `useToggleGroupContext` must be used within a `ToggleGroup` component", ); } return context; }