import { Chip } from '@mui/material' import type { PickDeep } from 'type-fest' import { LASSO_TOOLS_LABELS } from './const' import { styles } from './styles' import type { LassoToolsComponentProps, LassoToolsData } from './types' import { Tooltip } from '../tooltip/tooltip' export function LassoToolsUIChip({ chipProps, value, labels, onChipToggle, onDelete, }: Pick & { value: LassoToolsData labels?: PickDeep['chip'] }) { const chipState = value.visible ? 'active' : 'inactive' const chipLabel = labels?.tooltip?.[chipState] ?? LASSO_TOOLS_LABELS.chip.tooltip[chipState] return ( onDelete(value.id)} label={value.label} onClick={() => onChipToggle(value.id, !value.visible)} {...chipProps?.ChipsProps} /> ) }