import { type Accessor } from "solid-js"; import type { FieldRootState } from "../internals/field-constants.js"; /** * Shape of the state surface exposed by `` to its compound parts * (currently just ``). Mirrors Base UI React's * `SwitchRootState` — it extends the shared `FieldRootState` (valid / touched * / dirty / filled / focused / disabled) with the switch-specific flags. */ export interface SwitchRootState extends FieldRootState { /** Whether the switch is currently active. */ checked: boolean; /** Whether the component should ignore user interaction. */ disabled: boolean; /** Whether the user should be unable to activate or deactivate the switch. */ readOnly: boolean; /** Whether the user must activate the switch before submitting a form. */ required: boolean; } /** * The value handed down by `` to its descendants. * * Solid 2 adaptations vs. React: * * - Reactive reads are exposed as `Accessor` so descendants never perform a * top-level reactive read on the context object itself (RFC 01). * - `state` is also an accessor so `` can drive its own * `data-*` projection through `renderElement` without re-deriving. */ export interface SwitchRootContextValue { /** Current checked state. */ checked: Accessor; /** Whether the switch ignores user interaction. */ disabled: Accessor; /** Whether the switch is read-only (focusable but not activatable). */ readOnly: Accessor; /** Whether the switch is required for form submission. */ required: Accessor; /** Composite state snapshot — drives compound-part `data-*` projection. */ state: Accessor; } /** * Switch root context. `createContext(null)` + `== null` sentinel * — Solid 2's `useContext` throws `ContextNotFoundError` when * the default is `undefined`, which would shadow the intended Base UI error * message below. */ export declare const SwitchRootContext: import("solid-js").Context; /** * Read the `` context. Throws when the caller forgot to wrap * the subtree in ``. */ export declare function useSwitchRootContext(): SwitchRootContextValue; //# sourceMappingURL=switch-root-context.d.ts.map