import { type Accessor, createContext, useContext } from "solid-js"; import type { ListState } from "../list"; export interface ListboxContextValue { listState: Accessor; generateId: (part: string) => string; shouldUseVirtualFocus: Accessor; shouldSelectOnPressUp: Accessor; shouldFocusOnHover: Accessor; isVirtualized: Accessor; } export const ListboxContext = createContext(); export function useListboxContext() { const context = useContext(ListboxContext); if (context === undefined) { throw new Error( "[kobalte]: `useListboxContext` must be used within a `Listbox` component", ); } return context; }