import React from 'react'; import classNames from 'classnames'; import { RadioGroup as CoreRadioGroup } from '@shoptet/ui-core-web'; import { IconButton } from '../../IconButton/IconButton'; import { Tooltip } from '../../Tooltip/Tooltip'; import type { SelectKey } from './RadioGroup'; import type { RenderRadioGroupOptionProps } from './types'; /** @inheritdoc */ export interface RadioGroupOptionInheritedRenderRadioOptionProps< V extends SelectKey = SelectKey, > extends RenderRadioGroupOptionProps {} export interface RadioGroupOptionOwnProps { /** * Slot for rendering additional action elements next to the radio option (e.g., buttons). */ actionSlot?: React.ReactNode; } export type RadioGroupOptionProps = RadioGroupOptionInheritedRenderRadioOptionProps & RadioGroupOptionOwnProps; export function RadioGroupOption({ value, checked, disabled, required, textLabel, description, validity, onChange, actionSlot, ref, ...rest }: RadioGroupOptionProps) { rest satisfies Record; return (
label={textLabel} value={value} checked={checked} onChange={onChange} required={required} disabled={disabled} invalid={validity === 'error'} > {textLabel} {description && ( )} {actionSlot}
); }