import type { ViewProps } from 'react-native'; import type { AnimatedProps, WithTimingConfig } from 'react-native-reanimated'; import type { Animation, AnimationRootDisableAll, AnimationValue, } from '../../helpers/types/animation'; import type { ItemProps, RootProps } from '../../primitives/radio-group'; import type { ErrorViewRootProps } from '../error-view/error-view.types'; import type { FormFieldDescriptionProps, FormFieldLabelProps, } from '../form-field'; /** * Props for RadioGroup root component */ export interface RadioGroupProps extends Omit { /** Radio group content */ children?: React.ReactNode; /** Custom class name */ className?: string; /** * Animation configuration for radio group * - `"disable-all"`: Disable all animations including children * - `undefined`: Use default animations */ animation?: AnimationRootDisableAll; } /** * Context values shared between RadioGroupItem compound components */ export interface RadioGroupItemContextValue { /** Whether the radio item is selected */ isSelected: boolean; /** Whether the radio item is disabled */ isDisabled?: boolean; /** Whether the radio item is invalid */ isInvalid?: boolean; /** Whether the radio item is on surface */ isOnSurface?: boolean; } /** * Render function props for RadioGroupItem children */ export interface RadioGroupItemRenderProps { /** Whether the radio item is selected */ isSelected: boolean; /** Whether the radio item is disabled */ isDisabled: boolean; /** Whether the radio item is invalid */ isInvalid: boolean; } /** * Props for the RadioGroupItem component */ export interface RadioGroupItemProps extends Omit { /** Radio item content, or a render function */ children?: | React.ReactNode | ((props: RadioGroupItemRenderProps) => React.ReactNode); /** Whether the radio item is invalid @default false */ isInvalid?: boolean; /** Whether the radio item is on surface */ isOnSurface?: boolean; /** Custom class name */ className?: string; } /** * Props for RadioGroup.Indicator component */ export interface RadioGroupIndicatorProps extends AnimatedProps { /** Indicator content */ children?: React.ReactNode; /** Custom class name */ className?: string; } /** * Animation configuration for RadioGroupIndicatorThumb component */ export type RadioGroupIndicatorThumbAnimation = Animation<{ scale?: AnimationValue<{ /** * Scale values [unselected, selected] * @default [1.5, 1] */ value?: [number, number]; /** * Animation timing configuration * @default { duration: 300, easing: Easing.out(Easing.ease) } */ timingConfig?: WithTimingConfig; }>; }>; /** * Props for RadioGroup.IndicatorThumb component */ export interface RadioGroupIndicatorThumbProps extends Omit, 'children'> { /** Custom class name * * @note The following style properties are occupied by animations and cannot be set via className: * - `transform` (specifically `scale`) - Animated for selection transitions (unselected: 1.5, selected: 1) * * To customize this property, use the `animation` prop: * ```tsx * * ``` * * To completely disable animated styles and use your own via className or style prop, set `isAnimatedStyleActive={false}`. */ className?: string; /** * Animation configuration * - `false` or `"disabled"`: Disable all animations * - `true` or `undefined`: Use default animations * - `object`: Custom animation configuration */ animation?: RadioGroupIndicatorThumbAnimation; /** * Whether animated styles (react-native-reanimated) are active * When `false`, the animated style is removed and you can implement custom logic * This prop should only be used when you want to write custom styling logic instead of the default animated styles * @default true */ isAnimatedStyleActive?: boolean; } /** * Props for RadioGroup.Label component */ export interface RadioGroupLabelProps extends FormFieldLabelProps {} /** * Props for RadioGroup.Description component */ export interface RadioGroupDescriptionProps extends FormFieldDescriptionProps {} /** * Props for RadioGroup.ErrorMessage component */ export interface RadioGroupErrorMessageProps extends ErrorViewRootProps {}