import clsx from 'clsx'; import { PropsWithChildren } from 'react'; import ReactTooltip from 'react-tooltip'; import './BoxSelectorItem.css'; import { BoxSelectorOption } from './types'; interface Props { radioName: string; option: BoxSelectorOption; onChange?(value: T): void; selectedValue: T; disabled?: boolean; tooltip?: string; className?: string; type?: 'radio' | 'checkbox'; } export function BoxOption({ radioName, option, onChange = () => {}, selectedValue, disabled, tooltip, className, type = 'radio', children, }: PropsWithChildren>) { const tooltipId = `box-option-${radioName}-${option.id}`; return (
onChange(option.value)} /> {tooltip && ( {tooltip} )}
); }