import type { JSX, ValidComponent } from "@solidjs/web"; import { type BaseUIChangeEventDetails, REASONS } from "../../internals/change-event-details.js"; import { type MaybeAccessor } from "../../internals/maybe-accessor.js"; import type { BaseUIComponentProps, NativeButtonProps } from "../../internals/types.js"; import { type SwitchRootState } from "../switch-root-context.js"; /** The reason carried on every `onCheckedChange` event details bag. */ export type SwitchRootChangeEventReason = typeof REASONS.none; /** Shape of the `onCheckedChange` event details bag. */ export type SwitchRootChangeEventDetails = BaseUIChangeEventDetails; export interface SwitchRootProps extends NativeButtonProps, Omit, "onChange"> { /** * Tag/component to render. Defaults to `"button"`. Replaces the * pre-spike `render` prop (axis G). */ as?: ValidComponent; /** * Controlled checked state. When provided (resolved value not * `undefined`), the consumer owns the state — pair with * {@link onCheckedChange}. When omitted, the switch manages its own * checked state (seeded from {@link defaultChecked}). */ checked?: MaybeAccessor; /** * Initial checked state when uncontrolled. Read once at mount. * @default false */ defaultChecked?: MaybeAccessor; /** @default false */ disabled?: boolean | undefined; name?: string | undefined; form?: string | undefined; onCheckedChange?: ((checked: boolean, eventDetails: SwitchRootChangeEventDetails) => void) | undefined; /** @default false */ readOnly?: MaybeAccessor; /** @default false */ required?: MaybeAccessor; value?: string | undefined; uncheckedValue?: string | undefined; } export type { SwitchRootState }; /** * Represents the switch itself. Renders a `