{"version":3,"file":"RadarChart.cjs","names":[],"sources":["../../src/charts/RadarChart.tsx"],"sourcesContent":["import {\n    Legend,\n    PolarAngleAxis,\n    PolarGrid,\n    PolarRadiusAxis,\n    RadarChart as RRadarChart,\n    Radar,\n    ResponsiveContainer,\n    Tooltip,\n} from \"recharts\";\nimport { cn } from \"@/utils/cn\";\nimport { useChartColors } from \"./use-chart-colors\";\nimport { toTooltipFormatter } from \"./types\";\nimport type { CartesianChartProps } from \"./types\";\n\n/**\n * RadarChart — themed wrapper over recharts `RadarChart`.\n *\n * Plots one radar polygon per entry in `categories`, colored from `colors`\n * (cycling the `--tempest-chart-*` theme tokens by default). `index` drives the angle\n * axis. When `width` is provided the chart renders at that fixed size without a\n * ResponsiveContainer; otherwise it fills its parent.\n */\nexport function RadarChart({\n    data,\n    index,\n    categories,\n    colors,\n    height = 300,\n    width,\n    showLegend = true,\n    showTooltip = true,\n    valueFormatter,\n    className,\n}: CartesianChartProps) {\n    const palette = useChartColors(colors);\n    const chart = (\n        <RRadarChart data={data} width={width} height={height}>\n            <PolarGrid />\n            <PolarAngleAxis dataKey={index} />\n            <PolarRadiusAxis />\n            {showTooltip ? <Tooltip formatter={toTooltipFormatter(valueFormatter)} /> : null}\n            {showLegend ? <Legend /> : null}\n            {categories.map((category, i) => {\n                const color = palette[i % palette.length];\n                return (\n                    <Radar\n                        key={category}\n                        dataKey={category}\n                        stroke={color}\n                        fill={color}\n                        fillOpacity={0.3}\n                    />\n                );\n            })}\n        </RRadarChart>\n    );\n\n    return (\n        <div className={cn(className)}>\n            {width !== undefined ? (\n                chart\n            ) : (\n                <ResponsiveContainer width=\"100%\" height={height}>\n                    {chart}\n                </ResponsiveContainer>\n            )}\n        </div>\n    );\n}\n"],"mappings":"yJAuBA,SAAgB,EAAW,CACvB,OACA,QACA,aACA,SACA,SAAS,IACT,QACA,aAAa,GACb,cAAc,GACd,iBACA,aACoB,CACpB,IAAM,EAAU,EAAA,eAAe,CAAM,EAC/B,GACF,EAAA,EAAA,KAAA,CAAC,EAAA,WAAD,CAAmB,OAAa,QAAe,SAA/C,SAAA,EACI,EAAA,EAAA,IAAA,CAAC,EAAA,UAAD,CAAY,CAAA,GACZ,EAAA,EAAA,IAAA,CAAC,EAAA,eAAD,CAAgB,QAAS,CAAQ,CAAA,GACjC,EAAA,EAAA,IAAA,CAAC,EAAA,gBAAD,CAAkB,CAAA,EACjB,GAAc,EAAA,EAAA,IAAA,CAAC,EAAA,QAAD,CAAS,UAAW,EAAA,mBAAmB,CAAc,CAAI,CAAA,EAAI,KAC3E,GAAa,EAAA,EAAA,IAAA,CAAC,EAAA,OAAD,CAAS,CAAA,EAAI,KAC1B,EAAW,KAAK,EAAU,IAAM,CAC7B,IAAM,EAAQ,EAAQ,EAAI,EAAQ,QAClC,OACI,EAAA,EAAA,IAAA,CAAC,EAAA,MAAD,CAEI,QAAS,EACT,OAAQ,EACR,KAAM,EACN,YAAa,EAChB,EALQ,CAKR,CAET,CAAC,CACQ,IAGjB,OACI,EAAA,EAAA,IAAA,CAAC,MAAD,CAAK,UAAW,EAAA,GAAG,CAAS,EACvB,SAAA,IAAU,IAAA,IAGP,EAAA,EAAA,IAAA,CAAC,EAAA,oBAAD,CAAqB,MAAM,OAAe,SACrC,SAAA,CACgB,CAAA,EAJrB,CAMH,CAAA,CAEb"}