import type { ReactElement, ReactNode } from "react"; import type { AriaInputProps, FocusEvents, HTMLInputBaseProps, MouseEvents } from "../sharedHelpers/types"; /** * Shared checkbox-specific props used by both legacy and rebuilt versions */ export interface CheckboxCoreProps { /** * Determines if the checkbox is checked or not. */ readonly checked?: boolean; /** * Initial checked value of the checkbox. Only use this when you need to * pre-populate the checked attribute that is not controlled by the component's * state. If a state is controlling it, use the `checked` prop instead. */ readonly defaultChecked?: boolean; /** * When `true` the checkbox to appears in indeterminate. * * @default false */ readonly indeterminate?: boolean; /** * Value of the checkbox. */ readonly value?: string; } export type CheckboxProps = CheckboxCoreProps & AriaInputProps & FocusEvents & MouseEvents & Pick & { /** * Label that shows up beside the checkbox. * String will be rendered with the default markup. * ReactElement will be rendered with provided positionining. */ label?: string | ReactElement; /** * Additional description of the checkbox. * String will be rendered with the default markup. * ReactElement will be rendered with provided positioning. */ description?: ReactNode; /** * Whether the checkbox is invalid */ invalid?: boolean; /** * Called when the checkbox value changes. * Includes the change event as a second argument. * This is the recommended event handler to access the new value. */ onChange?(newValue: boolean, event: React.ChangeEvent): void; };