import clsx from 'clsx'; import { type LucideIcon, Check } from 'lucide-react'; import { Fragment } from 'react'; import { Icon } from '@/react/components/Icon'; import { BadgeIcon } from '@@/BadgeIcon'; import styles from './BoxSelectorItem.module.css'; import { BoxSelectorOption, Value } from './types'; import { BoxOption } from './BoxOption'; import { LogoIcon } from './LogoIcon'; type Props = { option: BoxSelectorOption; radioName: string; disabled?: boolean; tooltip?: string; onSelect(value: T): void; isSelected(value: T): boolean; type?: 'radio' | 'checkbox'; slim?: boolean; checkIcon?: LucideIcon; }; export function BoxSelectorItem({ radioName, option, onSelect = () => {}, disabled, tooltip, type = 'radio', isSelected, slim = false, checkIcon = Check, }: Props) { const ContentBox = slim ? 'div' : Fragment; return (
{renderIcon()}
{option.label}
{option.description}
); function isDisabled() { return disabled; } function renderIcon() { if (!option.icon) { return null; } if (option.iconType === 'badge') { return ; } if (option.iconType === 'raw') { return ( ); } return ; } }