{"version":3,"file":"AreaChart.cjs","names":[],"sources":["../../src/charts/AreaChart.tsx"],"sourcesContent":["import {\n    Area,\n    AreaChart as RAreaChart,\n    CartesianGrid,\n    Legend,\n    ResponsiveContainer,\n    Tooltip,\n    XAxis,\n    YAxis,\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 * AreaChart — themed wrapper over recharts `AreaChart`.\n *\n * Plots one filled area per entry in `categories`, colored from `colors`\n * (cycling the `--tempest-chart-*` theme tokens by default). When `stack` is set, all\n * areas share a stackId. When `width` is provided the chart renders at that\n * fixed size without a ResponsiveContainer; otherwise it fills its parent.\n */\nexport function AreaChart({\n    data,\n    index,\n    categories,\n    colors,\n    height = 300,\n    width,\n    stack = false,\n    showLegend = true,\n    showGrid = true,\n    showTooltip = true,\n    valueFormatter,\n    className,\n}: CartesianChartProps) {\n    const palette = useChartColors(colors);\n    const stackId = stack ? \"stack\" : undefined;\n\n    const chart = (\n        <RAreaChart data={data} width={width} height={height}>\n            {showGrid ? <CartesianGrid strokeDasharray=\"3 3\" /> : null}\n            <XAxis dataKey={index} />\n            <YAxis tickFormatter={valueFormatter} />\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                    <Area\n                        key={category}\n                        type=\"monotone\"\n                        dataKey={category}\n                        stackId={stackId}\n                        stroke={color}\n                        fill={color}\n                        fillOpacity={0.3}\n                    />\n                );\n            })}\n        </RAreaChart>\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,EAAU,CACtB,OACA,QACA,aACA,SACA,SAAS,IACT,QACA,QAAQ,GACR,aAAa,GACb,WAAW,GACX,cAAc,GACd,iBACA,aACoB,CACpB,IAAM,EAAU,EAAA,eAAe,CAAM,EAC/B,EAAU,EAAQ,QAAU,IAAA,GAE5B,GACF,EAAA,EAAA,KAAA,CAAC,EAAA,UAAD,CAAkB,OAAa,QAAe,SAA9C,SAAA,CACK,GAAW,EAAA,EAAA,IAAA,CAAC,EAAA,cAAD,CAAe,gBAAgB,KAAO,CAAA,EAAI,MACtD,EAAA,EAAA,IAAA,CAAC,EAAA,MAAD,CAAO,QAAS,CAAQ,CAAA,GACxB,EAAA,EAAA,IAAA,CAAC,EAAA,MAAD,CAAO,cAAe,CAAiB,CAAA,EACtC,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,KAAD,CAEI,KAAK,WACL,QAAS,EACA,UACT,OAAQ,EACR,KAAM,EACN,YAAa,EAChB,EAPQ,CAOR,CAET,CAAC,CACO,IAGhB,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"}