import { ReactNode } from 'react'; import { RadioProps, RadioGroupProps } from '@chakra-ui/react'; /** A single radio; every other Chakra `Radio` prop (`name`, `id`, `aria-*`, `data-*`, `isInvalid`) is spread onto it. Joins a RadioButtonGroup (or a hand-built `ChakraRadioGroup`) via Chakra's own context — this package no longer exports Chakra's `RadioGroup`. */ export type ChakraRadioProps = Omit & { label: string; /** Muted second line under the label, for a description without a custom `content` node. */ description?: string; /** Escape hatch for arbitrary content under the label/description — a card layout, a badge, any node. */ content?: ReactNode; /** Defaults to "0.875rem" (14px). */ labelFontSize?: string; /** Clamps the label with an ellipsis; defaults to 2 lines. */ labelClampLines?: number; /** Defaults to true when `label` is longer than 18 characters. */ showLabelTooltip?: boolean; /** Tooltip text; defaults to `label`. */ labelTooltip?: string; }; /** One `options` entry; `content` may be a static node or a function of the option, for state that depends on the option itself. */ export type RadioOption = { label: string; id: string; /** Muted second line under the label. */ description?: string; /** Rich per-option content — a card layout, an icon, a badge — rendered under label/description. */ content?: ReactNode | ((option: { label: string; id: string; description?: string; }) => ReactNode); }; /** Unlike ChakraRadioProps, showLabelTooltip may be a per-option predicate `(item) => boolean`, evaluated once per rendered option. */ export type ChakraRadioGroupProps = Pick & { /** Each option's `id` is its radio value and React key. Optional when `children` is given instead. */ options?: RadioOption[]; /** Fully custom radios instead of `options`, for layouts an option list can't express; wins when both are given. */ children?: ReactNode; /** Fires with the selected option's `id`. */ onChange?: (value: string) => void; /** Visible group label; names the `role="radiogroup"` via aria-labelledby. Without it, pass `aria-label`. */ label?: string; /** Accessible name when there is no visible `label`. */ "aria-label"?: string; /** Native `name` shared by every radio, so the group submits with a form. */ name?: string; /** Base id for the group's label and message ids; generated when omitted. */ id?: string; /** Marks every radio invalid and shows `errorMessage` in place of `helperText`. */ error?: boolean; /** Shown under the group while `error` is true. */ errorMessage?: string; /** Shown under the group when there is no error; linked via aria-describedby. */ helperText?: string; /** Draws the label asterisk and sets `aria-required` on the group. */ isRequired?: boolean; /** Stack spacing between radios; defaults to "2". */ spacing?: string; /** Defaults to "row". */ direction?: "row" | "column"; /** Cross-axis alignment of the stack; "" (default) leaves it unset. */ align?: "start" | "center" | "end" | ""; /** Forwarded to every radio; defaults to "0.875rem". */ labelFontSize?: string; /** Forwarded to every radio; defaults to 2 lines. */ labelClampLines?: number; showLabelTooltip?: boolean | ((item: { label: string; id: string; }) => boolean); };