import clsx from 'clsx'; import { PropsWithChildren } from 'react'; import type { Icon } from 'lucide-react'; import { TooltipWithChildren } from '@@/Tip/TooltipWithChildren'; import styles from './BoxOption.module.css'; import { BoxSelectorOption, Value } from './types'; interface Props { radioName: string; option: BoxSelectorOption; onSelect?(value: T): void; isSelected(value: T): boolean; disabled?: boolean; tooltip?: string; className?: string; type?: 'radio' | 'checkbox'; checkIcon: Icon; } export function BoxOption({ radioName, option, onSelect = () => {}, isSelected, disabled, tooltip, className, type = 'radio', children, checkIcon: Check, }: PropsWithChildren>) { const selected = isSelected(option.value); const item = (
onSelect(option.value)} />
); if (tooltip) { return {item}; } return item; }