import type { RadioProps } from "../Radio"; import type * as G from "../../types/global"; import type { Attributes, ClassName } from "@reshaped/headless"; import type React from "react"; type BaseProps = { /** Unique identifier for the radio group */ id?: string; /** Node for inserting children */ children?: React.ReactNode; /** Disable the form field from the form submission */ disabled?: boolean; /** Name of the input element */ name: string; /** Indicate that the form field has an error */ hasError?: boolean; /** Callback when the input value changes */ onChange?: G.ChangeHandler; /** Additional classname for the root element */ className?: ClassName; /** Additional attributes for the root element */ attributes?: Attributes<"div">; }; export type ControlledProps = BaseProps & { /** Value of the input element, enables controlled mode */ value: string | null; /** Default value of the input element, enables uncontrolled mode */ defaultValue?: never; }; export type UncontrolledProps = BaseProps & { /** Value of the input element, enables controlled mode */ value?: never; /** Default value of the input element, enables uncontrolled mode */ defaultValue?: string; }; export type Props = ControlledProps | UncontrolledProps; export type Context = { onChange: RadioProps["onChange"]; hasError?: boolean; disabled?: boolean; name: string; value?: string | null; }; export {};