React context and hook for managing composite list registrations and state.
// Source: https://github.com/mui/base-ui | License: MIT | Copyright 2019 Material-UI SAS
// Provided via justclaw.it.com; keep this notice with the code.
'use client';
import * as React from 'react';
export interface CompositeListRegistration<Metadata> {
metadata: Metadata | null;
index: number | null;
label: string | null | undefined;
textRef: React.RefObject<HTMLElement | null> | undefined;
}
export interface CompositeListContextValue<Metadata> {
register: (node: Element, registration: CompositeListRegistration<Metadata>) => void;
unregister: (node: Element) => void;
subscribeMapChange: (fn: (map: Map<Element, Metadata>) => void) => () => void;
nextIndexRef: React.RefObject<number>;
}
export const CompositeListContext = React.createContext<CompositeListContextValue<an
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key