import type { EnumFeatureStats } from '../../types'; interface StackedEnumChartProps { components: { label: string; stats: EnumFeatureStats }[]; valueOrder: string[]; valueColors: string[]; } /** Strip common suffixes to produce short row labels */ function shortenLabel(name: string): string { return name.replace(/ risk$/, ''); } export default function StackedEnumChart({ components, valueOrder, valueColors, }: StackedEnumChartProps) { const visibleRows = components.filter(({ stats }) => { const total = Object.values(stats.counts).reduce((a, b) => a + b, 0); if (total === 0) return false; const lowCount = stats.counts[valueOrder[0]] ?? 0; return total - lowCount > 0; }); if (visibleRows.length === 0) { return