@misael703/ui 1.62.2 → 1.64.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-5SYT7KZX.js → chunk-CP6DXFGZ.js} +32 -16
- package/dist/chunk-CP6DXFGZ.js.map +1 -0
- package/dist/{chunk-4K26DN5F.mjs → chunk-JTSSM4NE.mjs} +32 -16
- package/dist/chunk-JTSSM4NE.mjs.map +1 -0
- package/dist/components/Charts.d.mts +29 -6
- package/dist/components/Charts.d.ts +29 -6
- package/dist/components/Charts.js +6 -6
- package/dist/components/Charts.mjs +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -6
- package/dist/index.mjs +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/dist/chunk-4K26DN5F.mjs.map +0 -1
- package/dist/chunk-5SYT7KZX.js.map +0 -1
|
@@ -30,6 +30,13 @@ function valueAxisProps(valueFormatter, allowDecimals) {
|
|
|
30
30
|
if (valueFormatter) props.tickFormatter = (v) => valueFormatter(Number(v));
|
|
31
31
|
return props;
|
|
32
32
|
}
|
|
33
|
+
var TOOLTIP_BASE_STYLE = { background: "var(--bg-surface)", border: "1px solid var(--border-default)", borderRadius: 8, fontSize: 12 };
|
|
34
|
+
function tooltipContentStyle(tooltip) {
|
|
35
|
+
return { ...TOOLTIP_BASE_STYLE, maxWidth: tooltip?.maxWidth ?? "min(220px, 90vw)", whiteSpace: "normal" };
|
|
36
|
+
}
|
|
37
|
+
function tooltipChrome(tooltip) {
|
|
38
|
+
return tooltip?.allowEscapeViewBox ? { allowEscapeViewBox: tooltip.allowEscapeViewBox } : {};
|
|
39
|
+
}
|
|
33
40
|
function tooltipProps(valueFormatter, tooltipLabelFormatter, xTickFormatter) {
|
|
34
41
|
const props = {};
|
|
35
42
|
if (valueFormatter) props.formatter = (v) => valueFormatter(Number(v));
|
|
@@ -63,15 +70,17 @@ function LineChart({
|
|
|
63
70
|
xTickAngle,
|
|
64
71
|
valueFormatter,
|
|
65
72
|
allowDecimals,
|
|
66
|
-
tooltipLabelFormatter
|
|
73
|
+
tooltipLabelFormatter,
|
|
74
|
+
tooltip,
|
|
75
|
+
accessibilityLayer = true
|
|
67
76
|
}) {
|
|
68
77
|
const lineType = curve ?? (smooth ? "monotone" : "linear");
|
|
69
78
|
const allowDec = allowDecimals ?? !allIntegerValues(data, series.map((s) => s.key));
|
|
70
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunkPASF6T4H_js.cx("chart", className), role: "img", "aria-label": ariaLabel, children: /* @__PURE__ */ jsxRuntime.jsx(R.ResponsiveContainer, { width: "100%", height, children: /* @__PURE__ */ jsxRuntime.jsxs(R.LineChart, { data, margin: { top: 8, right: 16, bottom: 0, left: 0 }, children: [
|
|
79
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunkPASF6T4H_js.cx("chart", className), role: "img", "aria-label": ariaLabel, children: /* @__PURE__ */ jsxRuntime.jsx(R.ResponsiveContainer, { width: "100%", height, children: /* @__PURE__ */ jsxRuntime.jsxs(R.LineChart, { data, accessibilityLayer, margin: { top: 8, right: 16, bottom: 0, left: 0 }, children: [
|
|
71
80
|
showGrid && /* @__PURE__ */ jsxRuntime.jsx(R.CartesianGrid, { stroke: "var(--border-default)", strokeDasharray: "3 3", vertical: false }),
|
|
72
81
|
/* @__PURE__ */ jsxRuntime.jsx(R.XAxis, { dataKey: categoryKey, stroke: "var(--fg-subtle)", fontSize: 12, tickLine: false, axisLine: false, ...categoryTickProps({ xTickFormatter, xTickInterval, xTickAngle }) }),
|
|
73
82
|
/* @__PURE__ */ jsxRuntime.jsx(R.YAxis, { stroke: "var(--fg-subtle)", fontSize: 12, tickLine: false, axisLine: false, ...valueAxisProps(valueFormatter, allowDec) }),
|
|
74
|
-
/* @__PURE__ */ jsxRuntime.jsx(R.Tooltip, { contentStyle:
|
|
83
|
+
/* @__PURE__ */ jsxRuntime.jsx(R.Tooltip, { contentStyle: tooltipContentStyle(tooltip), ...tooltipChrome(tooltip), ...tooltipProps(valueFormatter, tooltipLabelFormatter, xTickFormatter) }),
|
|
75
84
|
showLegend && /* @__PURE__ */ jsxRuntime.jsx(R.Legend, { wrapperStyle: { fontSize: 12 } }),
|
|
76
85
|
series.map((s, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
77
86
|
R.Line,
|
|
@@ -106,15 +115,17 @@ function AreaChart({
|
|
|
106
115
|
xTickAngle,
|
|
107
116
|
valueFormatter,
|
|
108
117
|
allowDecimals,
|
|
109
|
-
tooltipLabelFormatter
|
|
118
|
+
tooltipLabelFormatter,
|
|
119
|
+
tooltip,
|
|
120
|
+
accessibilityLayer = true
|
|
110
121
|
}) {
|
|
111
122
|
const lineType = curve ?? (smooth ? "monotone" : "linear");
|
|
112
123
|
const allowDec = allowDecimals ?? !allIntegerValues(data, series.map((s) => s.key));
|
|
113
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunkPASF6T4H_js.cx("chart", className), role: "img", "aria-label": ariaLabel, children: /* @__PURE__ */ jsxRuntime.jsx(R.ResponsiveContainer, { width: "100%", height, children: /* @__PURE__ */ jsxRuntime.jsxs(R.AreaChart, { data, margin: { top: 8, right: 16, bottom: 0, left: 0 }, children: [
|
|
124
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunkPASF6T4H_js.cx("chart", className), role: "img", "aria-label": ariaLabel, children: /* @__PURE__ */ jsxRuntime.jsx(R.ResponsiveContainer, { width: "100%", height, children: /* @__PURE__ */ jsxRuntime.jsxs(R.AreaChart, { data, accessibilityLayer, margin: { top: 8, right: 16, bottom: 0, left: 0 }, children: [
|
|
114
125
|
showGrid && /* @__PURE__ */ jsxRuntime.jsx(R.CartesianGrid, { stroke: "var(--border-default)", strokeDasharray: "3 3", vertical: false }),
|
|
115
126
|
/* @__PURE__ */ jsxRuntime.jsx(R.XAxis, { dataKey: categoryKey, stroke: "var(--fg-subtle)", fontSize: 12, tickLine: false, axisLine: false, ...categoryTickProps({ xTickFormatter, xTickInterval, xTickAngle }) }),
|
|
116
127
|
/* @__PURE__ */ jsxRuntime.jsx(R.YAxis, { stroke: "var(--fg-subtle)", fontSize: 12, tickLine: false, axisLine: false, ...valueAxisProps(valueFormatter, allowDec) }),
|
|
117
|
-
/* @__PURE__ */ jsxRuntime.jsx(R.Tooltip, { contentStyle:
|
|
128
|
+
/* @__PURE__ */ jsxRuntime.jsx(R.Tooltip, { contentStyle: tooltipContentStyle(tooltip), ...tooltipChrome(tooltip), ...tooltipProps(valueFormatter, tooltipLabelFormatter, xTickFormatter) }),
|
|
118
129
|
showLegend && /* @__PURE__ */ jsxRuntime.jsx(R.Legend, { wrapperStyle: { fontSize: 12 } }),
|
|
119
130
|
series.map((s, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
120
131
|
R.Area,
|
|
@@ -150,7 +161,9 @@ function BarChart({
|
|
|
150
161
|
xTickAngle,
|
|
151
162
|
valueFormatter,
|
|
152
163
|
allowDecimals,
|
|
153
|
-
tooltipLabelFormatter
|
|
164
|
+
tooltipLabelFormatter,
|
|
165
|
+
tooltip,
|
|
166
|
+
accessibilityLayer = true
|
|
154
167
|
}) {
|
|
155
168
|
const isHorizontal = layout === "horizontal";
|
|
156
169
|
const allowDec = allowDecimals ?? !allIntegerValues(data, series.map((s) => s.key));
|
|
@@ -158,7 +171,7 @@ function BarChart({
|
|
|
158
171
|
const lastIdx = series.length - 1;
|
|
159
172
|
const catTicks = categoryTickProps({ xTickFormatter, xTickInterval, xTickAngle });
|
|
160
173
|
const catTicksNoRotate = categoryTickProps({ xTickFormatter, xTickInterval, xTickAngle }, false);
|
|
161
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunkPASF6T4H_js.cx("chart", className), role: "img", "aria-label": ariaLabel, children: /* @__PURE__ */ jsxRuntime.jsx(R.ResponsiveContainer, { width: "100%", height, children: /* @__PURE__ */ jsxRuntime.jsxs(R.BarChart, { data, layout: isHorizontal ? "vertical" : "horizontal", margin: { top: 8, right: 16, bottom: 0, left: 0 }, children: [
|
|
174
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunkPASF6T4H_js.cx("chart", className), role: "img", "aria-label": ariaLabel, children: /* @__PURE__ */ jsxRuntime.jsx(R.ResponsiveContainer, { width: "100%", height, children: /* @__PURE__ */ jsxRuntime.jsxs(R.BarChart, { data, accessibilityLayer, layout: isHorizontal ? "vertical" : "horizontal", margin: { top: 8, right: 16, bottom: 0, left: 0 }, children: [
|
|
162
175
|
showGrid && /* @__PURE__ */ jsxRuntime.jsx(R.CartesianGrid, { stroke: "var(--border-default)", strokeDasharray: "3 3", vertical: isHorizontal, horizontal: !isHorizontal }),
|
|
163
176
|
isHorizontal ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
164
177
|
/* @__PURE__ */ jsxRuntime.jsx(R.XAxis, { type: "number", stroke: "var(--fg-subtle)", fontSize: 12, tickLine: false, axisLine: false, ...valueAxisProps(valueFormatter, allowDec) }),
|
|
@@ -167,7 +180,7 @@ function BarChart({
|
|
|
167
180
|
/* @__PURE__ */ jsxRuntime.jsx(R.XAxis, { dataKey: categoryKey, stroke: "var(--fg-subtle)", fontSize: 12, tickLine: false, axisLine: false, ...catTicks }),
|
|
168
181
|
/* @__PURE__ */ jsxRuntime.jsx(R.YAxis, { stroke: "var(--fg-subtle)", fontSize: 12, tickLine: false, axisLine: false, ...valueAxisProps(valueFormatter, allowDec) })
|
|
169
182
|
] }),
|
|
170
|
-
/* @__PURE__ */ jsxRuntime.jsx(R.Tooltip, { contentStyle:
|
|
183
|
+
/* @__PURE__ */ jsxRuntime.jsx(R.Tooltip, { contentStyle: tooltipContentStyle(tooltip), ...tooltipChrome(tooltip), cursor: { fill: "var(--bg-subtle)" }, ...tooltipProps(valueFormatter, tooltipLabelFormatter, xTickFormatter) }),
|
|
171
184
|
showLegend && /* @__PURE__ */ jsxRuntime.jsx(R.Legend, { wrapperStyle: { fontSize: 12 } }),
|
|
172
185
|
series.map((s, i) => {
|
|
173
186
|
const barRadius = stacked ? i === lastIdx ? endRadius : [0, 0, 0, 0] : endRadius;
|
|
@@ -197,13 +210,15 @@ function DonutChart({
|
|
|
197
210
|
innerRadius = 60,
|
|
198
211
|
outerRadius = 88,
|
|
199
212
|
nameFormatter,
|
|
200
|
-
valueFormatter
|
|
213
|
+
valueFormatter,
|
|
214
|
+
tooltip,
|
|
215
|
+
accessibilityLayer = true
|
|
201
216
|
}) {
|
|
202
217
|
const tooltipProps2 = nameFormatter || valueFormatter ? { formatter: (v, n) => [valueFormatter ? valueFormatter(Number(v)) : v, nameFormatter ? nameFormatter(String(n)) : n] } : {};
|
|
203
218
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunkPASF6T4H_js.cx("chart chart--donut", className), role: "img", "aria-label": ariaLabel, children: [
|
|
204
219
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chart__donut-area", style: { height }, children: [
|
|
205
|
-
/* @__PURE__ */ jsxRuntime.jsx(R.ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxRuntime.jsxs(R.PieChart, { children: [
|
|
206
|
-
/* @__PURE__ */ jsxRuntime.jsx(R.Tooltip, { contentStyle:
|
|
220
|
+
/* @__PURE__ */ jsxRuntime.jsx(R.ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxRuntime.jsxs(R.PieChart, { accessibilityLayer, children: [
|
|
221
|
+
/* @__PURE__ */ jsxRuntime.jsx(R.Tooltip, { contentStyle: tooltipContentStyle(tooltip), ...tooltipChrome(tooltip), ...tooltipProps2 }),
|
|
207
222
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
208
223
|
R.Pie,
|
|
209
224
|
{
|
|
@@ -241,12 +256,13 @@ function Sparkline({
|
|
|
241
256
|
color = "var(--color-primary)",
|
|
242
257
|
fill = true,
|
|
243
258
|
interactive = false,
|
|
259
|
+
tooltip,
|
|
244
260
|
className,
|
|
245
261
|
ariaLabel
|
|
246
262
|
}) {
|
|
247
263
|
const margin = interactive ? { top: 4, right: 4, bottom: 4, left: 4 } : { top: 2, right: 0, bottom: 2, left: 0 };
|
|
248
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunkPASF6T4H_js.cx("sparkline", interactive && "sparkline--interactive", className), role: "img", "aria-label": ariaLabel, style: { width, height }, children: /* @__PURE__ */ jsxRuntime.jsx(R.ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxRuntime.jsxs(R.AreaChart, { data, margin, children: [
|
|
249
|
-
interactive && /* @__PURE__ */ jsxRuntime.jsx(R.Tooltip, { contentStyle:
|
|
264
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunkPASF6T4H_js.cx("sparkline", interactive && "sparkline--interactive", className), role: "img", "aria-label": ariaLabel, style: { width, height }, children: /* @__PURE__ */ jsxRuntime.jsx(R.ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxRuntime.jsxs(R.AreaChart, { data, accessibilityLayer: interactive, margin, children: [
|
|
265
|
+
interactive && /* @__PURE__ */ jsxRuntime.jsx(R.Tooltip, { contentStyle: tooltipContentStyle(tooltip), ...tooltipChrome(tooltip) }),
|
|
250
266
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
251
267
|
R.Area,
|
|
252
268
|
{
|
|
@@ -268,5 +284,5 @@ exports.BarChart = BarChart;
|
|
|
268
284
|
exports.DonutChart = DonutChart;
|
|
269
285
|
exports.LineChart = LineChart;
|
|
270
286
|
exports.Sparkline = Sparkline;
|
|
271
|
-
//# sourceMappingURL=chunk-
|
|
272
|
-
//# sourceMappingURL=chunk-
|
|
287
|
+
//# sourceMappingURL=chunk-CP6DXFGZ.js.map
|
|
288
|
+
//# sourceMappingURL=chunk-CP6DXFGZ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/Charts.tsx"],"names":["jsx","cx","jsxs","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EAAa,OAAO,IAAA,GAAO,CAAA;AAAA,QAC3B,iBAAA,EAAmB,KAAA;AAAA,QACnB,SAAA,EAAW,cAAc,EAAE,CAAA,EAAG,KAAK,WAAA,EAAa,CAAA,EAAG,IAAA,EAAM,KAAA,EAAM,GAAI;AAAA;AAAA;AACrE,GAAA,EACF,GACF,CAAA,EACF,CAAA;AAEJ","file":"chunk-CP6DXFGZ.js","sourcesContent":["'use client';\nimport * as React from 'react';\nimport { cx } from '../utils/cx';\n\n/**\n * Lightweight chart wrappers. We do NOT bundle Recharts — the host app provides it\n * and passes the modules in via the `recharts` prop so consumers only pay for what they use.\n *\n * Recharts is treated as an implicit peer dependency: install it in the host\n * app if you use any chart component. Use **recharts ≥ 3** — earlier versions use\n * `defaultProps` on function components, which logs a deprecation warning under\n * React 19. recharts 3 removed them; these wrappers use default parameters, so on\n * recharts 3.8+ the console stays clean (verified).\n *\n * Usage in a Next.js client component:\n *\n * import * as Recharts from 'recharts';\n * import { LineChart } from '@misael703/elalba-ui';\n * <LineChart recharts={Recharts} data={...} dataKey=\"value\" categoryKey=\"month\" />\n */\n\n// Structural mirror of the Recharts public API. `any` is intentional here:\n// each Recharts component has a different prop shape, and typing them\n// exhaustively would mean depending on `recharts` types — which would force\n// consumers to install recharts even when they don't use any chart.\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype RechartsComp = React.ComponentType<any>;\n\nexport type RechartsLike = {\n ResponsiveContainer: RechartsComp;\n LineChart: RechartsComp;\n AreaChart: RechartsComp;\n BarChart: RechartsComp;\n PieChart: RechartsComp;\n Line: RechartsComp;\n Area: RechartsComp;\n Bar: RechartsComp;\n Pie: RechartsComp;\n Cell: RechartsComp;\n CartesianGrid: RechartsComp;\n XAxis: RechartsComp;\n YAxis: RechartsComp;\n Tooltip: RechartsComp;\n Legend: RechartsComp;\n};\n\nconst PALETTE = [\n 'var(--color-primary)',\n 'var(--color-secondary)',\n 'var(--color-primary-900)',\n 'var(--color-success)',\n 'var(--color-warning)',\n 'var(--color-danger)',\n '#6b7e95',\n '#d4a574',\n];\n\n/** Tooltip chrome shared by every chart. */\nexport interface ChartTooltipConfig {\n /**\n * Cap the tooltip width so long content wraps instead of overflowing a narrow\n * (mobile) chart. Default `min(220px, 90vw)`. Number = px; or any CSS length.\n */\n maxWidth?: number | string;\n /** Let the tooltip escape the chart's plotting box. Default: recharts (stays inside). */\n allowEscapeViewBox?: { x?: boolean; y?: boolean };\n}\n\nexport interface BaseChartProps<D = any> {\n recharts: RechartsLike;\n data: D[];\n height?: number;\n className?: string;\n ariaLabel?: string;\n /** Tooltip sizing/positioning. By default the tooltip caps its width and wraps. */\n tooltip?: ChartTooltipConfig;\n /**\n * recharts' keyboard-navigation layer (puts `tabindex=0` on the svg + arrow-key\n * navigation). Default `true`. Set `false` for a non-actionable chart so it's\n * not a Tab stop / not focusable (no drill-down → nothing to navigate to).\n */\n accessibilityLayer?: boolean;\n}\n\n// Mirror of Recharts' AxisInterval. Controls how category ticks thin on\n// collision so dense series (e.g. daily points) don't crowd the axis.\nexport type AxisInterval =\n | number\n | 'preserveStart'\n | 'preserveEnd'\n | 'preserveStartEnd'\n | 'equidistantPreserveStart'\n | 'equidistantPreserveEnd';\n\n// Shared cartesian controls (Line/Area/Bar). DonutChart/Sparkline don't have a\n// category axis, so they keep BaseChartProps.\nexport interface CartesianChartProps<D = any> extends BaseChartProps<D> {\n categoryKey: keyof D & string;\n series: Array<{ key: keyof D & string; label?: string; color?: string }>;\n showGrid?: boolean;\n showLegend?: boolean;\n /** Format each category-axis tick label, e.g. shorten `2026-05-23`. → XAxis.tickFormatter */\n xTickFormatter?: (value: string) => string;\n /** Thin out category ticks on collision. → XAxis.interval. Default `preserveStartEnd`. */\n xTickInterval?: AxisInterval;\n /** Rotate category-axis labels N degrees (anchors end + reserves height so they don't clip). */\n xTickAngle?: number;\n /** Format numeric values (value-axis ticks + tooltip). */\n valueFormatter?: (value: number) => string;\n /**\n * Allow fractional value-axis ticks. Default: auto — `false` when every series\n * value is an integer (count data → no `0.25` ticks), `true` otherwise. Pass\n * explicitly to override the auto-detection.\n */\n allowDecimals?: boolean;\n /**\n * Format the category label in the tooltip. Defaults to `xTickFormatter` so the\n * tooltip matches the axis (e.g. both show `18 jun`, not the raw `2026-06-18`).\n */\n tooltipLabelFormatter?: (value: string) => string;\n}\n\nconst DEFAULT_X_INTERVAL: AxisInterval = 'preserveStartEnd';\n\n// Recharts XAxis/YAxis are `any`-typed (structural mirror), so tick controls go\n// in as a spread. `rotate` is off when the category axis is the Y axis\n// (horizontal bars: those labels are already horizontal).\nfunction categoryTickProps(\n opts: Pick<CartesianChartProps, 'xTickFormatter' | 'xTickInterval' | 'xTickAngle'>,\n rotate = true,\n): Record<string, unknown> {\n const props: Record<string, unknown> = { interval: opts.xTickInterval ?? DEFAULT_X_INTERVAL };\n if (opts.xTickFormatter) props.tickFormatter = opts.xTickFormatter;\n if (rotate && opts.xTickAngle) {\n props.angle = opts.xTickAngle;\n props.textAnchor = 'end';\n props.height = 56; // reserve room so the rotated label isn't clipped\n }\n return props;\n}\n\n// Value axis: `allowDecimals` (count data → integer-only ticks) + optional\n// numeric tick formatter.\nfunction valueAxisProps(valueFormatter: ((v: number) => string) | undefined, allowDecimals: boolean): Record<string, unknown> {\n const props: Record<string, unknown> = { allowDecimals };\n if (valueFormatter) props.tickFormatter = (v: number) => valueFormatter(Number(v));\n return props;\n}\n\n// Tooltip box style: the kit chrome + a width cap with wrapping so long content\n// (long labels / many series) doesn't overflow a narrow chart. `min(220px, 90vw)`\n// stays inside on mobile and caps to 220px on desktop.\nconst TOOLTIP_BASE_STYLE = { background: 'var(--bg-surface)', border: '1px solid var(--border-default)', borderRadius: 8, fontSize: 12 } as const;\n\nfunction tooltipContentStyle(tooltip?: ChartTooltipConfig): Record<string, unknown> {\n return { ...TOOLTIP_BASE_STYLE, maxWidth: tooltip?.maxWidth ?? 'min(220px, 90vw)', whiteSpace: 'normal' };\n}\n\nfunction tooltipChrome(tooltip?: ChartTooltipConfig): Record<string, unknown> {\n return tooltip?.allowEscapeViewBox ? { allowEscapeViewBox: tooltip.allowEscapeViewBox } : {};\n}\n\n// Tooltip: value formatter + a category-label formatter that defaults to the\n// axis tick formatter (so the hovered label matches the axis).\nfunction tooltipProps(\n valueFormatter: ((v: number) => string) | undefined,\n tooltipLabelFormatter: ((v: string) => string) | undefined,\n xTickFormatter: ((v: string) => string) | undefined,\n): Record<string, unknown> {\n const props: Record<string, unknown> = {};\n if (valueFormatter) props.formatter = (v: unknown) => valueFormatter(Number(v));\n const labelFormatter = tooltipLabelFormatter ?? xTickFormatter;\n if (labelFormatter) props.labelFormatter = (v: unknown) => labelFormatter(String(v));\n return props;\n}\n\n// True when every plotted value is an integer → drives the `allowDecimals` auto-\n// detection (count series shouldn't get `0.25`-style ticks).\nfunction allIntegerValues<D>(data: D[], keys: string[]): boolean {\n for (const row of data) {\n for (const k of keys) {\n const v = (row as Record<string, unknown>)[k];\n if (typeof v === 'number' && Number.isFinite(v) && !Number.isInteger(v)) return false;\n }\n }\n return true;\n}\n\n// ---------- LineChart ---------------------------------------------------\nexport interface LineChartProps<D = any> extends CartesianChartProps<D> {\n smooth?: boolean;\n /** Interpolation. `monotone` smooths (default, back-compat); `linear` draws honest\n * straight segments — recommended for counts/stepped series (no phantom humps over zeros). */\n curve?: 'linear' | 'monotone';\n}\n\nexport function LineChart<D = any>({\n recharts: R, data, categoryKey, series,\n height = 280, className, ariaLabel,\n showGrid = true, showLegend = true, smooth = true, curve,\n xTickFormatter, xTickInterval, xTickAngle, valueFormatter, allowDecimals, tooltipLabelFormatter, tooltip, accessibilityLayer = true,\n}: LineChartProps<D>) {\n const lineType = curve ?? (smooth ? 'monotone' : 'linear');\n const allowDec = allowDecimals ?? !allIntegerValues(data, series.map((s) => s.key));\n return (\n <div className={cx('chart', className)} role=\"img\" aria-label={ariaLabel}>\n <R.ResponsiveContainer width=\"100%\" height={height}>\n <R.LineChart data={data} accessibilityLayer={accessibilityLayer} margin={{ top: 8, right: 16, bottom: 0, left: 0 }}>\n {showGrid && <R.CartesianGrid stroke=\"var(--border-default)\" strokeDasharray=\"3 3\" vertical={false} />}\n <R.XAxis dataKey={categoryKey} stroke=\"var(--fg-subtle)\" fontSize={12} tickLine={false} axisLine={false} {...categoryTickProps({ xTickFormatter, xTickInterval, xTickAngle })} />\n <R.YAxis stroke=\"var(--fg-subtle)\" fontSize={12} tickLine={false} axisLine={false} {...valueAxisProps(valueFormatter, allowDec)} />\n <R.Tooltip contentStyle={tooltipContentStyle(tooltip)} {...tooltipChrome(tooltip)} {...tooltipProps(valueFormatter, tooltipLabelFormatter, xTickFormatter)} />\n {showLegend && <R.Legend wrapperStyle={{ fontSize: 12 }} />}\n {series.map((s, i) => (\n <R.Line\n key={s.key}\n type={lineType}\n dataKey={s.key}\n name={s.label ?? s.key}\n stroke={s.color ?? PALETTE[i % PALETTE.length]}\n strokeWidth={2}\n dot={false}\n activeDot={{ r: 4 }}\n />\n ))}\n </R.LineChart>\n </R.ResponsiveContainer>\n </div>\n );\n}\n\n// ---------- AreaChart ---------------------------------------------------\nexport interface AreaChartProps<D = any> extends LineChartProps<D> {\n stacked?: boolean;\n}\n\nexport function AreaChart<D = any>({\n recharts: R, data, categoryKey, series,\n height = 280, className, ariaLabel,\n showGrid = true, showLegend = true, smooth = true, curve, stacked,\n xTickFormatter, xTickInterval, xTickAngle, valueFormatter, allowDecimals, tooltipLabelFormatter, tooltip, accessibilityLayer = true,\n}: AreaChartProps<D>) {\n const lineType = curve ?? (smooth ? 'monotone' : 'linear');\n const allowDec = allowDecimals ?? !allIntegerValues(data, series.map((s) => s.key));\n return (\n <div className={cx('chart', className)} role=\"img\" aria-label={ariaLabel}>\n <R.ResponsiveContainer width=\"100%\" height={height}>\n <R.AreaChart data={data} accessibilityLayer={accessibilityLayer} margin={{ top: 8, right: 16, bottom: 0, left: 0 }}>\n {showGrid && <R.CartesianGrid stroke=\"var(--border-default)\" strokeDasharray=\"3 3\" vertical={false} />}\n <R.XAxis dataKey={categoryKey} stroke=\"var(--fg-subtle)\" fontSize={12} tickLine={false} axisLine={false} {...categoryTickProps({ xTickFormatter, xTickInterval, xTickAngle })} />\n <R.YAxis stroke=\"var(--fg-subtle)\" fontSize={12} tickLine={false} axisLine={false} {...valueAxisProps(valueFormatter, allowDec)} />\n <R.Tooltip contentStyle={tooltipContentStyle(tooltip)} {...tooltipChrome(tooltip)} {...tooltipProps(valueFormatter, tooltipLabelFormatter, xTickFormatter)} />\n {showLegend && <R.Legend wrapperStyle={{ fontSize: 12 }} />}\n {series.map((s, i) => (\n <R.Area\n key={s.key}\n type={lineType}\n dataKey={s.key}\n name={s.label ?? s.key}\n stackId={stacked ? '1' : undefined}\n stroke={s.color ?? PALETTE[i % PALETTE.length]}\n fill={s.color ?? PALETTE[i % PALETTE.length]}\n fillOpacity={0.18}\n strokeWidth={2}\n />\n ))}\n </R.AreaChart>\n </R.ResponsiveContainer>\n </div>\n );\n}\n\n// ---------- BarChart ----------------------------------------------------\nexport interface BarChartProps<D = any> extends CartesianChartProps<D> {\n layout?: 'vertical' | 'horizontal';\n stacked?: boolean;\n}\n\nconst BAR_RADIUS = 4;\n\nexport function BarChart<D = any>({\n recharts: R, data, categoryKey, series,\n height = 280, className, ariaLabel,\n layout = 'vertical', stacked, showGrid = true, showLegend = true,\n xTickFormatter, xTickInterval, xTickAngle, valueFormatter, allowDecimals, tooltipLabelFormatter, tooltip, accessibilityLayer = true,\n}: BarChartProps<D>) {\n const isHorizontal = layout === 'horizontal';\n const allowDec = allowDecimals ?? !allIntegerValues(data, series.map((s) => s.key));\n // Radius must round the VALUE end: top for columns ([tl,tr,br,bl] → [R,R,0,0]),\n // right for horizontal bars ([0,R,R,0]). The old hardcoded [4,4,0,0] left\n // horizontal bars rounded-top / pointed-bottom.\n const endRadius = isHorizontal ? [0, BAR_RADIUS, BAR_RADIUS, 0] : [BAR_RADIUS, BAR_RADIUS, 0, 0];\n const lastIdx = series.length - 1;\n const catTicks = categoryTickProps({ xTickFormatter, xTickInterval, xTickAngle });\n const catTicksNoRotate = categoryTickProps({ xTickFormatter, xTickInterval, xTickAngle }, false);\n return (\n <div className={cx('chart', className)} role=\"img\" aria-label={ariaLabel}>\n <R.ResponsiveContainer width=\"100%\" height={height}>\n <R.BarChart data={data} accessibilityLayer={accessibilityLayer} layout={isHorizontal ? 'vertical' : 'horizontal'} margin={{ top: 8, right: 16, bottom: 0, left: 0 }}>\n {showGrid && <R.CartesianGrid stroke=\"var(--border-default)\" strokeDasharray=\"3 3\" vertical={isHorizontal} horizontal={!isHorizontal} />}\n {isHorizontal ? (\n <>\n <R.XAxis type=\"number\" stroke=\"var(--fg-subtle)\" fontSize={12} tickLine={false} axisLine={false} {...valueAxisProps(valueFormatter, allowDec)} />\n <R.YAxis dataKey={categoryKey} type=\"category\" stroke=\"var(--fg-subtle)\" fontSize={12} tickLine={false} axisLine={false} width={96} {...catTicksNoRotate} />\n </>\n ) : (\n <>\n <R.XAxis dataKey={categoryKey} stroke=\"var(--fg-subtle)\" fontSize={12} tickLine={false} axisLine={false} {...catTicks} />\n <R.YAxis stroke=\"var(--fg-subtle)\" fontSize={12} tickLine={false} axisLine={false} {...valueAxisProps(valueFormatter, allowDec)} />\n </>\n )}\n <R.Tooltip contentStyle={tooltipContentStyle(tooltip)} {...tooltipChrome(tooltip)} cursor={{ fill: 'var(--bg-subtle)' }} {...tooltipProps(valueFormatter, tooltipLabelFormatter, xTickFormatter)} />\n {showLegend && <R.Legend wrapperStyle={{ fontSize: 12 }} />}\n {series.map((s, i) => {\n // Stacked: only the outermost (last) segment carries the end radius;\n // inner segments stay square so the stack reads as one bar.\n const barRadius = stacked ? (i === lastIdx ? endRadius : [0, 0, 0, 0]) : endRadius;\n return (\n <R.Bar\n key={s.key}\n dataKey={s.key}\n name={s.label ?? s.key}\n stackId={stacked ? '1' : undefined}\n fill={s.color ?? PALETTE[i % PALETTE.length]}\n radius={barRadius}\n maxBarSize={48}\n />\n );\n })}\n </R.BarChart>\n </R.ResponsiveContainer>\n </div>\n );\n}\n\n// ---------- DonutChart --------------------------------------------------\nexport interface DonutChartProps extends Omit<BaseChartProps, 'data'> {\n data: Array<{ name: string; value: number; color?: string }>;\n centerLabel?: React.ReactNode;\n showLegend?: boolean;\n innerRadius?: number;\n outerRadius?: number;\n /** Format slice names in tooltip + legend, e.g. `V_REGION` → `V Región` (no need to pre-map the data). */\n nameFormatter?: (name: string) => string;\n /** Format slice values in the tooltip. */\n valueFormatter?: (value: number) => string;\n}\n\nexport function DonutChart({\n recharts: R, data, height = 240, className, ariaLabel,\n centerLabel, showLegend = true, innerRadius = 60, outerRadius = 88,\n nameFormatter, valueFormatter, tooltip, accessibilityLayer = true,\n}: DonutChartProps) {\n // Recharts Tooltip formatter returns [formattedValue, formattedName].\n const tooltipProps = (nameFormatter || valueFormatter)\n ? { formatter: (v: unknown, n: unknown) => [valueFormatter ? valueFormatter(Number(v)) : v, nameFormatter ? nameFormatter(String(n)) : n] }\n : {};\n return (\n <div className={cx('chart chart--donut', className)} role=\"img\" aria-label={ariaLabel}>\n <div className=\"chart__donut-area\" style={{ height }}>\n <R.ResponsiveContainer width=\"100%\" height=\"100%\">\n <R.PieChart accessibilityLayer={accessibilityLayer}>\n <R.Tooltip contentStyle={tooltipContentStyle(tooltip)} {...tooltipChrome(tooltip)} {...tooltipProps} />\n <R.Pie\n data={data}\n dataKey=\"value\"\n nameKey=\"name\"\n innerRadius={innerRadius}\n outerRadius={outerRadius}\n paddingAngle={2}\n stroke=\"var(--bg-surface)\"\n >\n {data.map((d, i) => <R.Cell key={i} fill={d.color ?? PALETTE[i % PALETTE.length]} />)}\n </R.Pie>\n </R.PieChart>\n </R.ResponsiveContainer>\n {centerLabel && <div className=\"chart__center\">{centerLabel}</div>}\n </div>\n {showLegend && (\n <ul className=\"chart__legend\" aria-hidden=\"true\">\n {data.map((d, i) => (\n <li key={d.name} className=\"chart__legend-item\">\n <span\n className=\"chart__legend-swatch\"\n style={{ background: d.color ?? PALETTE[i % PALETTE.length] }}\n />\n <span className=\"chart__legend-label\">{nameFormatter ? nameFormatter(d.name) : d.name}</span>\n </li>\n ))}\n </ul>\n )}\n </div>\n );\n}\n\n// ---------- Sparkline ---------------------------------------------------\nexport interface SparklineProps<D = any> {\n recharts: RechartsLike;\n data: D[];\n dataKey: keyof D & string;\n width?: number;\n height?: number;\n color?: string;\n fill?: boolean;\n /**\n * Show a hover dot. Default `false` — a sparkline is glanceable/non-interactive\n * (the fine detail lives in the big LineChart). When off there's no active dot\n * to clip at the edges/base; when on, the margins are widened so it isn't cut.\n */\n interactive?: boolean;\n /** Tooltip sizing/positioning (only used when `interactive`). */\n tooltip?: ChartTooltipConfig;\n className?: string;\n ariaLabel?: string;\n}\n\nexport function Sparkline<D = any>({\n recharts: R, data, dataKey,\n width = 120, height = 32, color = 'var(--color-primary)',\n fill = true, interactive = false, tooltip, className, ariaLabel,\n}: SparklineProps<D>) {\n // No hover dot by default (it clips against the tiny margins at the first/last\n // point and the baseline). When interactive, leave room so it can't be cut off.\n const margin = interactive ? { top: 4, right: 4, bottom: 4, left: 4 } : { top: 2, right: 0, bottom: 2, left: 0 };\n return (\n <div className={cx('sparkline', interactive && 'sparkline--interactive', className)} role=\"img\" aria-label={ariaLabel} style={{ width, height }}>\n <R.ResponsiveContainer width=\"100%\" height=\"100%\">\n <R.AreaChart data={data} accessibilityLayer={interactive} margin={margin}>\n {interactive && <R.Tooltip contentStyle={tooltipContentStyle(tooltip)} {...tooltipChrome(tooltip)} />}\n <R.Area\n type=\"monotone\"\n dataKey={dataKey}\n stroke={color}\n strokeWidth={1.5}\n fill={fill ? color : 'none'}\n fillOpacity={fill ? 0.18 : 0}\n isAnimationActive={false}\n activeDot={interactive ? { r: 2.5, strokeWidth: 0, fill: color } : false}\n />\n </R.AreaChart>\n </R.ResponsiveContainer>\n </div>\n );\n}\n"]}
|
|
@@ -28,6 +28,13 @@ function valueAxisProps(valueFormatter, allowDecimals) {
|
|
|
28
28
|
if (valueFormatter) props.tickFormatter = (v) => valueFormatter(Number(v));
|
|
29
29
|
return props;
|
|
30
30
|
}
|
|
31
|
+
var TOOLTIP_BASE_STYLE = { background: "var(--bg-surface)", border: "1px solid var(--border-default)", borderRadius: 8, fontSize: 12 };
|
|
32
|
+
function tooltipContentStyle(tooltip) {
|
|
33
|
+
return { ...TOOLTIP_BASE_STYLE, maxWidth: tooltip?.maxWidth ?? "min(220px, 90vw)", whiteSpace: "normal" };
|
|
34
|
+
}
|
|
35
|
+
function tooltipChrome(tooltip) {
|
|
36
|
+
return tooltip?.allowEscapeViewBox ? { allowEscapeViewBox: tooltip.allowEscapeViewBox } : {};
|
|
37
|
+
}
|
|
31
38
|
function tooltipProps(valueFormatter, tooltipLabelFormatter, xTickFormatter) {
|
|
32
39
|
const props = {};
|
|
33
40
|
if (valueFormatter) props.formatter = (v) => valueFormatter(Number(v));
|
|
@@ -61,15 +68,17 @@ function LineChart({
|
|
|
61
68
|
xTickAngle,
|
|
62
69
|
valueFormatter,
|
|
63
70
|
allowDecimals,
|
|
64
|
-
tooltipLabelFormatter
|
|
71
|
+
tooltipLabelFormatter,
|
|
72
|
+
tooltip,
|
|
73
|
+
accessibilityLayer = true
|
|
65
74
|
}) {
|
|
66
75
|
const lineType = curve ?? (smooth ? "monotone" : "linear");
|
|
67
76
|
const allowDec = allowDecimals ?? !allIntegerValues(data, series.map((s) => s.key));
|
|
68
|
-
return /* @__PURE__ */ jsx("div", { className: cx("chart", className), role: "img", "aria-label": ariaLabel, children: /* @__PURE__ */ jsx(R.ResponsiveContainer, { width: "100%", height, children: /* @__PURE__ */ jsxs(R.LineChart, { data, margin: { top: 8, right: 16, bottom: 0, left: 0 }, children: [
|
|
77
|
+
return /* @__PURE__ */ jsx("div", { className: cx("chart", className), role: "img", "aria-label": ariaLabel, children: /* @__PURE__ */ jsx(R.ResponsiveContainer, { width: "100%", height, children: /* @__PURE__ */ jsxs(R.LineChart, { data, accessibilityLayer, margin: { top: 8, right: 16, bottom: 0, left: 0 }, children: [
|
|
69
78
|
showGrid && /* @__PURE__ */ jsx(R.CartesianGrid, { stroke: "var(--border-default)", strokeDasharray: "3 3", vertical: false }),
|
|
70
79
|
/* @__PURE__ */ jsx(R.XAxis, { dataKey: categoryKey, stroke: "var(--fg-subtle)", fontSize: 12, tickLine: false, axisLine: false, ...categoryTickProps({ xTickFormatter, xTickInterval, xTickAngle }) }),
|
|
71
80
|
/* @__PURE__ */ jsx(R.YAxis, { stroke: "var(--fg-subtle)", fontSize: 12, tickLine: false, axisLine: false, ...valueAxisProps(valueFormatter, allowDec) }),
|
|
72
|
-
/* @__PURE__ */ jsx(R.Tooltip, { contentStyle:
|
|
81
|
+
/* @__PURE__ */ jsx(R.Tooltip, { contentStyle: tooltipContentStyle(tooltip), ...tooltipChrome(tooltip), ...tooltipProps(valueFormatter, tooltipLabelFormatter, xTickFormatter) }),
|
|
73
82
|
showLegend && /* @__PURE__ */ jsx(R.Legend, { wrapperStyle: { fontSize: 12 } }),
|
|
74
83
|
series.map((s, i) => /* @__PURE__ */ jsx(
|
|
75
84
|
R.Line,
|
|
@@ -104,15 +113,17 @@ function AreaChart({
|
|
|
104
113
|
xTickAngle,
|
|
105
114
|
valueFormatter,
|
|
106
115
|
allowDecimals,
|
|
107
|
-
tooltipLabelFormatter
|
|
116
|
+
tooltipLabelFormatter,
|
|
117
|
+
tooltip,
|
|
118
|
+
accessibilityLayer = true
|
|
108
119
|
}) {
|
|
109
120
|
const lineType = curve ?? (smooth ? "monotone" : "linear");
|
|
110
121
|
const allowDec = allowDecimals ?? !allIntegerValues(data, series.map((s) => s.key));
|
|
111
|
-
return /* @__PURE__ */ jsx("div", { className: cx("chart", className), role: "img", "aria-label": ariaLabel, children: /* @__PURE__ */ jsx(R.ResponsiveContainer, { width: "100%", height, children: /* @__PURE__ */ jsxs(R.AreaChart, { data, margin: { top: 8, right: 16, bottom: 0, left: 0 }, children: [
|
|
122
|
+
return /* @__PURE__ */ jsx("div", { className: cx("chart", className), role: "img", "aria-label": ariaLabel, children: /* @__PURE__ */ jsx(R.ResponsiveContainer, { width: "100%", height, children: /* @__PURE__ */ jsxs(R.AreaChart, { data, accessibilityLayer, margin: { top: 8, right: 16, bottom: 0, left: 0 }, children: [
|
|
112
123
|
showGrid && /* @__PURE__ */ jsx(R.CartesianGrid, { stroke: "var(--border-default)", strokeDasharray: "3 3", vertical: false }),
|
|
113
124
|
/* @__PURE__ */ jsx(R.XAxis, { dataKey: categoryKey, stroke: "var(--fg-subtle)", fontSize: 12, tickLine: false, axisLine: false, ...categoryTickProps({ xTickFormatter, xTickInterval, xTickAngle }) }),
|
|
114
125
|
/* @__PURE__ */ jsx(R.YAxis, { stroke: "var(--fg-subtle)", fontSize: 12, tickLine: false, axisLine: false, ...valueAxisProps(valueFormatter, allowDec) }),
|
|
115
|
-
/* @__PURE__ */ jsx(R.Tooltip, { contentStyle:
|
|
126
|
+
/* @__PURE__ */ jsx(R.Tooltip, { contentStyle: tooltipContentStyle(tooltip), ...tooltipChrome(tooltip), ...tooltipProps(valueFormatter, tooltipLabelFormatter, xTickFormatter) }),
|
|
116
127
|
showLegend && /* @__PURE__ */ jsx(R.Legend, { wrapperStyle: { fontSize: 12 } }),
|
|
117
128
|
series.map((s, i) => /* @__PURE__ */ jsx(
|
|
118
129
|
R.Area,
|
|
@@ -148,7 +159,9 @@ function BarChart({
|
|
|
148
159
|
xTickAngle,
|
|
149
160
|
valueFormatter,
|
|
150
161
|
allowDecimals,
|
|
151
|
-
tooltipLabelFormatter
|
|
162
|
+
tooltipLabelFormatter,
|
|
163
|
+
tooltip,
|
|
164
|
+
accessibilityLayer = true
|
|
152
165
|
}) {
|
|
153
166
|
const isHorizontal = layout === "horizontal";
|
|
154
167
|
const allowDec = allowDecimals ?? !allIntegerValues(data, series.map((s) => s.key));
|
|
@@ -156,7 +169,7 @@ function BarChart({
|
|
|
156
169
|
const lastIdx = series.length - 1;
|
|
157
170
|
const catTicks = categoryTickProps({ xTickFormatter, xTickInterval, xTickAngle });
|
|
158
171
|
const catTicksNoRotate = categoryTickProps({ xTickFormatter, xTickInterval, xTickAngle }, false);
|
|
159
|
-
return /* @__PURE__ */ jsx("div", { className: cx("chart", className), role: "img", "aria-label": ariaLabel, children: /* @__PURE__ */ jsx(R.ResponsiveContainer, { width: "100%", height, children: /* @__PURE__ */ jsxs(R.BarChart, { data, layout: isHorizontal ? "vertical" : "horizontal", margin: { top: 8, right: 16, bottom: 0, left: 0 }, children: [
|
|
172
|
+
return /* @__PURE__ */ jsx("div", { className: cx("chart", className), role: "img", "aria-label": ariaLabel, children: /* @__PURE__ */ jsx(R.ResponsiveContainer, { width: "100%", height, children: /* @__PURE__ */ jsxs(R.BarChart, { data, accessibilityLayer, layout: isHorizontal ? "vertical" : "horizontal", margin: { top: 8, right: 16, bottom: 0, left: 0 }, children: [
|
|
160
173
|
showGrid && /* @__PURE__ */ jsx(R.CartesianGrid, { stroke: "var(--border-default)", strokeDasharray: "3 3", vertical: isHorizontal, horizontal: !isHorizontal }),
|
|
161
174
|
isHorizontal ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
162
175
|
/* @__PURE__ */ jsx(R.XAxis, { type: "number", stroke: "var(--fg-subtle)", fontSize: 12, tickLine: false, axisLine: false, ...valueAxisProps(valueFormatter, allowDec) }),
|
|
@@ -165,7 +178,7 @@ function BarChart({
|
|
|
165
178
|
/* @__PURE__ */ jsx(R.XAxis, { dataKey: categoryKey, stroke: "var(--fg-subtle)", fontSize: 12, tickLine: false, axisLine: false, ...catTicks }),
|
|
166
179
|
/* @__PURE__ */ jsx(R.YAxis, { stroke: "var(--fg-subtle)", fontSize: 12, tickLine: false, axisLine: false, ...valueAxisProps(valueFormatter, allowDec) })
|
|
167
180
|
] }),
|
|
168
|
-
/* @__PURE__ */ jsx(R.Tooltip, { contentStyle:
|
|
181
|
+
/* @__PURE__ */ jsx(R.Tooltip, { contentStyle: tooltipContentStyle(tooltip), ...tooltipChrome(tooltip), cursor: { fill: "var(--bg-subtle)" }, ...tooltipProps(valueFormatter, tooltipLabelFormatter, xTickFormatter) }),
|
|
169
182
|
showLegend && /* @__PURE__ */ jsx(R.Legend, { wrapperStyle: { fontSize: 12 } }),
|
|
170
183
|
series.map((s, i) => {
|
|
171
184
|
const barRadius = stacked ? i === lastIdx ? endRadius : [0, 0, 0, 0] : endRadius;
|
|
@@ -195,13 +208,15 @@ function DonutChart({
|
|
|
195
208
|
innerRadius = 60,
|
|
196
209
|
outerRadius = 88,
|
|
197
210
|
nameFormatter,
|
|
198
|
-
valueFormatter
|
|
211
|
+
valueFormatter,
|
|
212
|
+
tooltip,
|
|
213
|
+
accessibilityLayer = true
|
|
199
214
|
}) {
|
|
200
215
|
const tooltipProps2 = nameFormatter || valueFormatter ? { formatter: (v, n) => [valueFormatter ? valueFormatter(Number(v)) : v, nameFormatter ? nameFormatter(String(n)) : n] } : {};
|
|
201
216
|
return /* @__PURE__ */ jsxs("div", { className: cx("chart chart--donut", className), role: "img", "aria-label": ariaLabel, children: [
|
|
202
217
|
/* @__PURE__ */ jsxs("div", { className: "chart__donut-area", style: { height }, children: [
|
|
203
|
-
/* @__PURE__ */ jsx(R.ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxs(R.PieChart, { children: [
|
|
204
|
-
/* @__PURE__ */ jsx(R.Tooltip, { contentStyle:
|
|
218
|
+
/* @__PURE__ */ jsx(R.ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxs(R.PieChart, { accessibilityLayer, children: [
|
|
219
|
+
/* @__PURE__ */ jsx(R.Tooltip, { contentStyle: tooltipContentStyle(tooltip), ...tooltipChrome(tooltip), ...tooltipProps2 }),
|
|
205
220
|
/* @__PURE__ */ jsx(
|
|
206
221
|
R.Pie,
|
|
207
222
|
{
|
|
@@ -239,12 +254,13 @@ function Sparkline({
|
|
|
239
254
|
color = "var(--color-primary)",
|
|
240
255
|
fill = true,
|
|
241
256
|
interactive = false,
|
|
257
|
+
tooltip,
|
|
242
258
|
className,
|
|
243
259
|
ariaLabel
|
|
244
260
|
}) {
|
|
245
261
|
const margin = interactive ? { top: 4, right: 4, bottom: 4, left: 4 } : { top: 2, right: 0, bottom: 2, left: 0 };
|
|
246
|
-
return /* @__PURE__ */ jsx("div", { className: cx("sparkline", interactive && "sparkline--interactive", className), role: "img", "aria-label": ariaLabel, style: { width, height }, children: /* @__PURE__ */ jsx(R.ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxs(R.AreaChart, { data, margin, children: [
|
|
247
|
-
interactive && /* @__PURE__ */ jsx(R.Tooltip, { contentStyle:
|
|
262
|
+
return /* @__PURE__ */ jsx("div", { className: cx("sparkline", interactive && "sparkline--interactive", className), role: "img", "aria-label": ariaLabel, style: { width, height }, children: /* @__PURE__ */ jsx(R.ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxs(R.AreaChart, { data, accessibilityLayer: interactive, margin, children: [
|
|
263
|
+
interactive && /* @__PURE__ */ jsx(R.Tooltip, { contentStyle: tooltipContentStyle(tooltip), ...tooltipChrome(tooltip) }),
|
|
248
264
|
/* @__PURE__ */ jsx(
|
|
249
265
|
R.Area,
|
|
250
266
|
{
|
|
@@ -262,5 +278,5 @@ function Sparkline({
|
|
|
262
278
|
}
|
|
263
279
|
|
|
264
280
|
export { AreaChart, BarChart, DonutChart, LineChart, Sparkline };
|
|
265
|
-
//# sourceMappingURL=chunk-
|
|
266
|
-
//# sourceMappingURL=chunk-
|
|
281
|
+
//# sourceMappingURL=chunk-JTSSM4NE.mjs.map
|
|
282
|
+
//# sourceMappingURL=chunk-JTSSM4NE.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/Charts.tsx"],"names":["tooltipProps"],"mappings":";;;AA8CA,IAAM,OAAA,GAAU;AAAA,EACd,sBAAA;AAAA,EACA,wBAAA;AAAA,EACA,0BAAA;AAAA,EACA,sBAAA;AAAA,EACA,sBAAA;AAAA,EACA,qBAAA;AAAA,EACA,SAAA;AAA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4NE.mjs","sourcesContent":["'use client';\nimport * as React from 'react';\nimport { cx } from '../utils/cx';\n\n/**\n * Lightweight chart wrappers. We do NOT bundle Recharts — the host app provides it\n * and passes the modules in via the `recharts` prop so consumers only pay for what they use.\n *\n * Recharts is treated as an implicit peer dependency: install it in the host\n * app if you use any chart component. Use **recharts ≥ 3** — earlier versions use\n * `defaultProps` on function components, which logs a deprecation warning under\n * React 19. recharts 3 removed them; these wrappers use default parameters, so on\n * recharts 3.8+ the console stays clean (verified).\n *\n * Usage in a Next.js client component:\n *\n * import * as Recharts from 'recharts';\n * import { LineChart } from '@misael703/elalba-ui';\n * <LineChart recharts={Recharts} data={...} dataKey=\"value\" categoryKey=\"month\" />\n */\n\n// Structural mirror of the Recharts public API. `any` is intentional here:\n// each Recharts component has a different prop shape, and typing them\n// exhaustively would mean depending on `recharts` types — which would force\n// consumers to install recharts even when they don't use any chart.\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype RechartsComp = React.ComponentType<any>;\n\nexport type RechartsLike = {\n ResponsiveContainer: RechartsComp;\n LineChart: RechartsComp;\n AreaChart: RechartsComp;\n BarChart: RechartsComp;\n PieChart: RechartsComp;\n Line: RechartsComp;\n Area: RechartsComp;\n Bar: RechartsComp;\n Pie: RechartsComp;\n Cell: RechartsComp;\n CartesianGrid: RechartsComp;\n XAxis: RechartsComp;\n YAxis: RechartsComp;\n Tooltip: RechartsComp;\n Legend: RechartsComp;\n};\n\nconst PALETTE = [\n 'var(--color-primary)',\n 'var(--color-secondary)',\n 'var(--color-primary-900)',\n 'var(--color-success)',\n 'var(--color-warning)',\n 'var(--color-danger)',\n '#6b7e95',\n '#d4a574',\n];\n\n/** Tooltip chrome shared by every chart. */\nexport interface ChartTooltipConfig {\n /**\n * Cap the tooltip width so long content wraps instead of overflowing a narrow\n * (mobile) chart. Default `min(220px, 90vw)`. Number = px; or any CSS length.\n */\n maxWidth?: number | string;\n /** Let the tooltip escape the chart's plotting box. Default: recharts (stays inside). */\n allowEscapeViewBox?: { x?: boolean; y?: boolean };\n}\n\nexport interface BaseChartProps<D = any> {\n recharts: RechartsLike;\n data: D[];\n height?: number;\n className?: string;\n ariaLabel?: string;\n /** Tooltip sizing/positioning. By default the tooltip caps its width and wraps. */\n tooltip?: ChartTooltipConfig;\n /**\n * recharts' keyboard-navigation layer (puts `tabindex=0` on the svg + arrow-key\n * navigation). Default `true`. Set `false` for a non-actionable chart so it's\n * not a Tab stop / not focusable (no drill-down → nothing to navigate to).\n */\n accessibilityLayer?: boolean;\n}\n\n// Mirror of Recharts' AxisInterval. Controls how category ticks thin on\n// collision so dense series (e.g. daily points) don't crowd the axis.\nexport type AxisInterval =\n | number\n | 'preserveStart'\n | 'preserveEnd'\n | 'preserveStartEnd'\n | 'equidistantPreserveStart'\n | 'equidistantPreserveEnd';\n\n// Shared cartesian controls (Line/Area/Bar). DonutChart/Sparkline don't have a\n// category axis, so they keep BaseChartProps.\nexport interface CartesianChartProps<D = any> extends BaseChartProps<D> {\n categoryKey: keyof D & string;\n series: Array<{ key: keyof D & string; label?: string; color?: string }>;\n showGrid?: boolean;\n showLegend?: boolean;\n /** Format each category-axis tick label, e.g. shorten `2026-05-23`. → XAxis.tickFormatter */\n xTickFormatter?: (value: string) => string;\n /** Thin out category ticks on collision. → XAxis.interval. Default `preserveStartEnd`. */\n xTickInterval?: AxisInterval;\n /** Rotate category-axis labels N degrees (anchors end + reserves height so they don't clip). */\n xTickAngle?: number;\n /** Format numeric values (value-axis ticks + tooltip). */\n valueFormatter?: (value: number) => string;\n /**\n * Allow fractional value-axis ticks. Default: auto — `false` when every series\n * value is an integer (count data → no `0.25` ticks), `true` otherwise. Pass\n * explicitly to override the auto-detection.\n */\n allowDecimals?: boolean;\n /**\n * Format the category label in the tooltip. Defaults to `xTickFormatter` so the\n * tooltip matches the axis (e.g. both show `18 jun`, not the raw `2026-06-18`).\n */\n tooltipLabelFormatter?: (value: string) => string;\n}\n\nconst DEFAULT_X_INTERVAL: AxisInterval = 'preserveStartEnd';\n\n// Recharts XAxis/YAxis are `any`-typed (structural mirror), so tick controls go\n// in as a spread. `rotate` is off when the category axis is the Y axis\n// (horizontal bars: those labels are already horizontal).\nfunction categoryTickProps(\n opts: Pick<CartesianChartProps, 'xTickFormatter' | 'xTickInterval' | 'xTickAngle'>,\n rotate = true,\n): Record<string, unknown> {\n const props: Record<string, unknown> = { interval: opts.xTickInterval ?? DEFAULT_X_INTERVAL };\n if (opts.xTickFormatter) props.tickFormatter = opts.xTickFormatter;\n if (rotate && opts.xTickAngle) {\n props.angle = opts.xTickAngle;\n props.textAnchor = 'end';\n props.height = 56; // reserve room so the rotated label isn't clipped\n }\n return props;\n}\n\n// Value axis: `allowDecimals` (count data → integer-only ticks) + optional\n// numeric tick formatter.\nfunction valueAxisProps(valueFormatter: ((v: number) => string) | undefined, allowDecimals: boolean): Record<string, unknown> {\n const props: Record<string, unknown> = { allowDecimals };\n if (valueFormatter) props.tickFormatter = (v: number) => valueFormatter(Number(v));\n return props;\n}\n\n// Tooltip box style: the kit chrome + a width cap with wrapping so long content\n// (long labels / many series) doesn't overflow a narrow chart. `min(220px, 90vw)`\n// stays inside on mobile and caps to 220px on desktop.\nconst TOOLTIP_BASE_STYLE = { background: 'var(--bg-surface)', border: '1px solid var(--border-default)', borderRadius: 8, fontSize: 12 } as const;\n\nfunction tooltipContentStyle(tooltip?: ChartTooltipConfig): Record<string, unknown> {\n return { ...TOOLTIP_BASE_STYLE, maxWidth: tooltip?.maxWidth ?? 'min(220px, 90vw)', whiteSpace: 'normal' };\n}\n\nfunction tooltipChrome(tooltip?: ChartTooltipConfig): Record<string, unknown> {\n return tooltip?.allowEscapeViewBox ? { allowEscapeViewBox: tooltip.allowEscapeViewBox } : {};\n}\n\n// Tooltip: value formatter + a category-label formatter that defaults to the\n// axis tick formatter (so the hovered label matches the axis).\nfunction tooltipProps(\n valueFormatter: ((v: number) => string) | undefined,\n tooltipLabelFormatter: ((v: string) => string) | undefined,\n xTickFormatter: ((v: string) => string) | undefined,\n): Record<string, unknown> {\n const props: Record<string, unknown> = {};\n if (valueFormatter) props.formatter = (v: unknown) => valueFormatter(Number(v));\n const labelFormatter = tooltipLabelFormatter ?? xTickFormatter;\n if (labelFormatter) props.labelFormatter = (v: unknown) => labelFormatter(String(v));\n return props;\n}\n\n// True when every plotted value is an integer → drives the `allowDecimals` auto-\n// detection (count series shouldn't get `0.25`-style ticks).\nfunction allIntegerValues<D>(data: D[], keys: string[]): boolean {\n for (const row of data) {\n for (const k of keys) {\n const v = (row as Record<string, unknown>)[k];\n if (typeof v === 'number' && Number.isFinite(v) && !Number.isInteger(v)) return false;\n }\n }\n return true;\n}\n\n// ---------- LineChart ---------------------------------------------------\nexport interface LineChartProps<D = any> extends CartesianChartProps<D> {\n smooth?: boolean;\n /** Interpolation. `monotone` smooths (default, back-compat); `linear` draws honest\n * straight segments — recommended for counts/stepped series (no phantom humps over zeros). */\n curve?: 'linear' | 'monotone';\n}\n\nexport function LineChart<D = any>({\n recharts: R, data, categoryKey, series,\n height = 280, className, ariaLabel,\n showGrid = true, showLegend = true, smooth = true, curve,\n xTickFormatter, xTickInterval, xTickAngle, valueFormatter, allowDecimals, tooltipLabelFormatter, tooltip, accessibilityLayer = true,\n}: LineChartProps<D>) {\n const lineType = curve ?? (smooth ? 'monotone' : 'linear');\n const allowDec = allowDecimals ?? !allIntegerValues(data, series.map((s) => s.key));\n return (\n <div className={cx('chart', className)} role=\"img\" aria-label={ariaLabel}>\n <R.ResponsiveContainer width=\"100%\" height={height}>\n <R.LineChart data={data} accessibilityLayer={accessibilityLayer} margin={{ top: 8, right: 16, bottom: 0, left: 0 }}>\n {showGrid && <R.CartesianGrid stroke=\"var(--border-default)\" strokeDasharray=\"3 3\" vertical={false} />}\n <R.XAxis dataKey={categoryKey} stroke=\"var(--fg-subtle)\" fontSize={12} tickLine={false} axisLine={false} {...categoryTickProps({ xTickFormatter, xTickInterval, xTickAngle })} />\n <R.YAxis stroke=\"var(--fg-subtle)\" fontSize={12} tickLine={false} axisLine={false} {...valueAxisProps(valueFormatter, allowDec)} />\n <R.Tooltip contentStyle={tooltipContentStyle(tooltip)} {...tooltipChrome(tooltip)} {...tooltipProps(valueFormatter, tooltipLabelFormatter, xTickFormatter)} />\n {showLegend && <R.Legend wrapperStyle={{ fontSize: 12 }} />}\n {series.map((s, i) => (\n <R.Line\n key={s.key}\n type={lineType}\n dataKey={s.key}\n name={s.label ?? s.key}\n stroke={s.color ?? PALETTE[i % PALETTE.length]}\n strokeWidth={2}\n dot={false}\n activeDot={{ r: 4 }}\n />\n ))}\n </R.LineChart>\n </R.ResponsiveContainer>\n </div>\n );\n}\n\n// ---------- AreaChart ---------------------------------------------------\nexport interface AreaChartProps<D = any> extends LineChartProps<D> {\n stacked?: boolean;\n}\n\nexport function AreaChart<D = any>({\n recharts: R, data, categoryKey, series,\n height = 280, className, ariaLabel,\n showGrid = true, showLegend = true, smooth = true, curve, stacked,\n xTickFormatter, xTickInterval, xTickAngle, valueFormatter, allowDecimals, tooltipLabelFormatter, tooltip, accessibilityLayer = true,\n}: AreaChartProps<D>) {\n const lineType = curve ?? (smooth ? 'monotone' : 'linear');\n const allowDec = allowDecimals ?? !allIntegerValues(data, series.map((s) => s.key));\n return (\n <div className={cx('chart', className)} role=\"img\" aria-label={ariaLabel}>\n <R.ResponsiveContainer width=\"100%\" height={height}>\n <R.AreaChart data={data} accessibilityLayer={accessibilityLayer} margin={{ top: 8, right: 16, bottom: 0, left: 0 }}>\n {showGrid && <R.CartesianGrid stroke=\"var(--border-default)\" strokeDasharray=\"3 3\" vertical={false} />}\n <R.XAxis dataKey={categoryKey} stroke=\"var(--fg-subtle)\" fontSize={12} tickLine={false} axisLine={false} {...categoryTickProps({ xTickFormatter, xTickInterval, xTickAngle })} />\n <R.YAxis stroke=\"var(--fg-subtle)\" fontSize={12} tickLine={false} axisLine={false} {...valueAxisProps(valueFormatter, allowDec)} />\n <R.Tooltip contentStyle={tooltipContentStyle(tooltip)} {...tooltipChrome(tooltip)} {...tooltipProps(valueFormatter, tooltipLabelFormatter, xTickFormatter)} />\n {showLegend && <R.Legend wrapperStyle={{ fontSize: 12 }} />}\n {series.map((s, i) => (\n <R.Area\n key={s.key}\n type={lineType}\n dataKey={s.key}\n name={s.label ?? s.key}\n stackId={stacked ? '1' : undefined}\n stroke={s.color ?? PALETTE[i % PALETTE.length]}\n fill={s.color ?? PALETTE[i % PALETTE.length]}\n fillOpacity={0.18}\n strokeWidth={2}\n />\n ))}\n </R.AreaChart>\n </R.ResponsiveContainer>\n </div>\n );\n}\n\n// ---------- BarChart ----------------------------------------------------\nexport interface BarChartProps<D = any> extends CartesianChartProps<D> {\n layout?: 'vertical' | 'horizontal';\n stacked?: boolean;\n}\n\nconst BAR_RADIUS = 4;\n\nexport function BarChart<D = any>({\n recharts: R, data, categoryKey, series,\n height = 280, className, ariaLabel,\n layout = 'vertical', stacked, showGrid = true, showLegend = true,\n xTickFormatter, xTickInterval, xTickAngle, valueFormatter, allowDecimals, tooltipLabelFormatter, tooltip, accessibilityLayer = true,\n}: BarChartProps<D>) {\n const isHorizontal = layout === 'horizontal';\n const allowDec = allowDecimals ?? !allIntegerValues(data, series.map((s) => s.key));\n // Radius must round the VALUE end: top for columns ([tl,tr,br,bl] → [R,R,0,0]),\n // right for horizontal bars ([0,R,R,0]). The old hardcoded [4,4,0,0] left\n // horizontal bars rounded-top / pointed-bottom.\n const endRadius = isHorizontal ? [0, BAR_RADIUS, BAR_RADIUS, 0] : [BAR_RADIUS, BAR_RADIUS, 0, 0];\n const lastIdx = series.length - 1;\n const catTicks = categoryTickProps({ xTickFormatter, xTickInterval, xTickAngle });\n const catTicksNoRotate = categoryTickProps({ xTickFormatter, xTickInterval, xTickAngle }, false);\n return (\n <div className={cx('chart', className)} role=\"img\" aria-label={ariaLabel}>\n <R.ResponsiveContainer width=\"100%\" height={height}>\n <R.BarChart data={data} accessibilityLayer={accessibilityLayer} layout={isHorizontal ? 'vertical' : 'horizontal'} margin={{ top: 8, right: 16, bottom: 0, left: 0 }}>\n {showGrid && <R.CartesianGrid stroke=\"var(--border-default)\" strokeDasharray=\"3 3\" vertical={isHorizontal} horizontal={!isHorizontal} />}\n {isHorizontal ? (\n <>\n <R.XAxis type=\"number\" stroke=\"var(--fg-subtle)\" fontSize={12} tickLine={false} axisLine={false} {...valueAxisProps(valueFormatter, allowDec)} />\n <R.YAxis dataKey={categoryKey} type=\"category\" stroke=\"var(--fg-subtle)\" fontSize={12} tickLine={false} axisLine={false} width={96} {...catTicksNoRotate} />\n </>\n ) : (\n <>\n <R.XAxis dataKey={categoryKey} stroke=\"var(--fg-subtle)\" fontSize={12} tickLine={false} axisLine={false} {...catTicks} />\n <R.YAxis stroke=\"var(--fg-subtle)\" fontSize={12} tickLine={false} axisLine={false} {...valueAxisProps(valueFormatter, allowDec)} />\n </>\n )}\n <R.Tooltip contentStyle={tooltipContentStyle(tooltip)} {...tooltipChrome(tooltip)} cursor={{ fill: 'var(--bg-subtle)' }} {...tooltipProps(valueFormatter, tooltipLabelFormatter, xTickFormatter)} />\n {showLegend && <R.Legend wrapperStyle={{ fontSize: 12 }} />}\n {series.map((s, i) => {\n // Stacked: only the outermost (last) segment carries the end radius;\n // inner segments stay square so the stack reads as one bar.\n const barRadius = stacked ? (i === lastIdx ? endRadius : [0, 0, 0, 0]) : endRadius;\n return (\n <R.Bar\n key={s.key}\n dataKey={s.key}\n name={s.label ?? s.key}\n stackId={stacked ? '1' : undefined}\n fill={s.color ?? PALETTE[i % PALETTE.length]}\n radius={barRadius}\n maxBarSize={48}\n />\n );\n })}\n </R.BarChart>\n </R.ResponsiveContainer>\n </div>\n );\n}\n\n// ---------- DonutChart --------------------------------------------------\nexport interface DonutChartProps extends Omit<BaseChartProps, 'data'> {\n data: Array<{ name: string; value: number; color?: string }>;\n centerLabel?: React.ReactNode;\n showLegend?: boolean;\n innerRadius?: number;\n outerRadius?: number;\n /** Format slice names in tooltip + legend, e.g. `V_REGION` → `V Región` (no need to pre-map the data). */\n nameFormatter?: (name: string) => string;\n /** Format slice values in the tooltip. */\n valueFormatter?: (value: number) => string;\n}\n\nexport function DonutChart({\n recharts: R, data, height = 240, className, ariaLabel,\n centerLabel, showLegend = true, innerRadius = 60, outerRadius = 88,\n nameFormatter, valueFormatter, tooltip, accessibilityLayer = true,\n}: DonutChartProps) {\n // Recharts Tooltip formatter returns [formattedValue, formattedName].\n const tooltipProps = (nameFormatter || valueFormatter)\n ? { formatter: (v: unknown, n: unknown) => [valueFormatter ? valueFormatter(Number(v)) : v, nameFormatter ? nameFormatter(String(n)) : n] }\n : {};\n return (\n <div className={cx('chart chart--donut', className)} role=\"img\" aria-label={ariaLabel}>\n <div className=\"chart__donut-area\" style={{ height }}>\n <R.ResponsiveContainer width=\"100%\" height=\"100%\">\n <R.PieChart accessibilityLayer={accessibilityLayer}>\n <R.Tooltip contentStyle={tooltipContentStyle(tooltip)} {...tooltipChrome(tooltip)} {...tooltipProps} />\n <R.Pie\n data={data}\n dataKey=\"value\"\n nameKey=\"name\"\n innerRadius={innerRadius}\n outerRadius={outerRadius}\n paddingAngle={2}\n stroke=\"var(--bg-surface)\"\n >\n {data.map((d, i) => <R.Cell key={i} fill={d.color ?? PALETTE[i % PALETTE.length]} />)}\n </R.Pie>\n </R.PieChart>\n </R.ResponsiveContainer>\n {centerLabel && <div className=\"chart__center\">{centerLabel}</div>}\n </div>\n {showLegend && (\n <ul className=\"chart__legend\" aria-hidden=\"true\">\n {data.map((d, i) => (\n <li key={d.name} className=\"chart__legend-item\">\n <span\n className=\"chart__legend-swatch\"\n style={{ background: d.color ?? PALETTE[i % PALETTE.length] }}\n />\n <span className=\"chart__legend-label\">{nameFormatter ? nameFormatter(d.name) : d.name}</span>\n </li>\n ))}\n </ul>\n )}\n </div>\n );\n}\n\n// ---------- Sparkline ---------------------------------------------------\nexport interface SparklineProps<D = any> {\n recharts: RechartsLike;\n data: D[];\n dataKey: keyof D & string;\n width?: number;\n height?: number;\n color?: string;\n fill?: boolean;\n /**\n * Show a hover dot. Default `false` — a sparkline is glanceable/non-interactive\n * (the fine detail lives in the big LineChart). When off there's no active dot\n * to clip at the edges/base; when on, the margins are widened so it isn't cut.\n */\n interactive?: boolean;\n /** Tooltip sizing/positioning (only used when `interactive`). */\n tooltip?: ChartTooltipConfig;\n className?: string;\n ariaLabel?: string;\n}\n\nexport function Sparkline<D = any>({\n recharts: R, data, dataKey,\n width = 120, height = 32, color = 'var(--color-primary)',\n fill = true, interactive = false, tooltip, className, ariaLabel,\n}: SparklineProps<D>) {\n // No hover dot by default (it clips against the tiny margins at the first/last\n // point and the baseline). When interactive, leave room so it can't be cut off.\n const margin = interactive ? { top: 4, right: 4, bottom: 4, left: 4 } : { top: 2, right: 0, bottom: 2, left: 0 };\n return (\n <div className={cx('sparkline', interactive && 'sparkline--interactive', className)} role=\"img\" aria-label={ariaLabel} style={{ width, height }}>\n <R.ResponsiveContainer width=\"100%\" height=\"100%\">\n <R.AreaChart data={data} accessibilityLayer={interactive} margin={margin}>\n {interactive && <R.Tooltip contentStyle={tooltipContentStyle(tooltip)} {...tooltipChrome(tooltip)} />}\n <R.Area\n type=\"monotone\"\n dataKey={dataKey}\n stroke={color}\n strokeWidth={1.5}\n fill={fill ? color : 'none'}\n fillOpacity={fill ? 0.18 : 0}\n isAnimationActive={false}\n activeDot={interactive ? { r: 2.5, strokeWidth: 0, fill: color } : false}\n />\n </R.AreaChart>\n </R.ResponsiveContainer>\n </div>\n );\n}\n"]}
|
|
@@ -35,12 +35,33 @@ type RechartsLike = {
|
|
|
35
35
|
Tooltip: RechartsComp;
|
|
36
36
|
Legend: RechartsComp;
|
|
37
37
|
};
|
|
38
|
+
/** Tooltip chrome shared by every chart. */
|
|
39
|
+
interface ChartTooltipConfig {
|
|
40
|
+
/**
|
|
41
|
+
* Cap the tooltip width so long content wraps instead of overflowing a narrow
|
|
42
|
+
* (mobile) chart. Default `min(220px, 90vw)`. Number = px; or any CSS length.
|
|
43
|
+
*/
|
|
44
|
+
maxWidth?: number | string;
|
|
45
|
+
/** Let the tooltip escape the chart's plotting box. Default: recharts (stays inside). */
|
|
46
|
+
allowEscapeViewBox?: {
|
|
47
|
+
x?: boolean;
|
|
48
|
+
y?: boolean;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
38
51
|
interface BaseChartProps<D = any> {
|
|
39
52
|
recharts: RechartsLike;
|
|
40
53
|
data: D[];
|
|
41
54
|
height?: number;
|
|
42
55
|
className?: string;
|
|
43
56
|
ariaLabel?: string;
|
|
57
|
+
/** Tooltip sizing/positioning. By default the tooltip caps its width and wraps. */
|
|
58
|
+
tooltip?: ChartTooltipConfig;
|
|
59
|
+
/**
|
|
60
|
+
* recharts' keyboard-navigation layer (puts `tabindex=0` on the svg + arrow-key
|
|
61
|
+
* navigation). Default `true`. Set `false` for a non-actionable chart so it's
|
|
62
|
+
* not a Tab stop / not focusable (no drill-down → nothing to navigate to).
|
|
63
|
+
*/
|
|
64
|
+
accessibilityLayer?: boolean;
|
|
44
65
|
}
|
|
45
66
|
type AxisInterval = number | 'preserveStart' | 'preserveEnd' | 'preserveStartEnd' | 'equidistantPreserveStart' | 'equidistantPreserveEnd';
|
|
46
67
|
interface CartesianChartProps<D = any> extends BaseChartProps<D> {
|
|
@@ -78,16 +99,16 @@ interface LineChartProps<D = any> extends CartesianChartProps<D> {
|
|
|
78
99
|
* straight segments — recommended for counts/stepped series (no phantom humps over zeros). */
|
|
79
100
|
curve?: 'linear' | 'monotone';
|
|
80
101
|
}
|
|
81
|
-
declare function LineChart<D = any>({ recharts: R, data, categoryKey, series, height, className, ariaLabel, showGrid, showLegend, smooth, curve, xTickFormatter, xTickInterval, xTickAngle, valueFormatter, allowDecimals, tooltipLabelFormatter, }: LineChartProps<D>): react_jsx_runtime.JSX.Element;
|
|
102
|
+
declare function LineChart<D = any>({ recharts: R, data, categoryKey, series, height, className, ariaLabel, showGrid, showLegend, smooth, curve, xTickFormatter, xTickInterval, xTickAngle, valueFormatter, allowDecimals, tooltipLabelFormatter, tooltip, accessibilityLayer, }: LineChartProps<D>): react_jsx_runtime.JSX.Element;
|
|
82
103
|
interface AreaChartProps<D = any> extends LineChartProps<D> {
|
|
83
104
|
stacked?: boolean;
|
|
84
105
|
}
|
|
85
|
-
declare function AreaChart<D = any>({ recharts: R, data, categoryKey, series, height, className, ariaLabel, showGrid, showLegend, smooth, curve, stacked, xTickFormatter, xTickInterval, xTickAngle, valueFormatter, allowDecimals, tooltipLabelFormatter, }: AreaChartProps<D>): react_jsx_runtime.JSX.Element;
|
|
106
|
+
declare function AreaChart<D = any>({ recharts: R, data, categoryKey, series, height, className, ariaLabel, showGrid, showLegend, smooth, curve, stacked, xTickFormatter, xTickInterval, xTickAngle, valueFormatter, allowDecimals, tooltipLabelFormatter, tooltip, accessibilityLayer, }: AreaChartProps<D>): react_jsx_runtime.JSX.Element;
|
|
86
107
|
interface BarChartProps<D = any> extends CartesianChartProps<D> {
|
|
87
108
|
layout?: 'vertical' | 'horizontal';
|
|
88
109
|
stacked?: boolean;
|
|
89
110
|
}
|
|
90
|
-
declare function BarChart<D = any>({ recharts: R, data, categoryKey, series, height, className, ariaLabel, layout, stacked, showGrid, showLegend, xTickFormatter, xTickInterval, xTickAngle, valueFormatter, allowDecimals, tooltipLabelFormatter, }: BarChartProps<D>): react_jsx_runtime.JSX.Element;
|
|
111
|
+
declare function BarChart<D = any>({ recharts: R, data, categoryKey, series, height, className, ariaLabel, layout, stacked, showGrid, showLegend, xTickFormatter, xTickInterval, xTickAngle, valueFormatter, allowDecimals, tooltipLabelFormatter, tooltip, accessibilityLayer, }: BarChartProps<D>): react_jsx_runtime.JSX.Element;
|
|
91
112
|
interface DonutChartProps extends Omit<BaseChartProps, 'data'> {
|
|
92
113
|
data: Array<{
|
|
93
114
|
name: string;
|
|
@@ -103,7 +124,7 @@ interface DonutChartProps extends Omit<BaseChartProps, 'data'> {
|
|
|
103
124
|
/** Format slice values in the tooltip. */
|
|
104
125
|
valueFormatter?: (value: number) => string;
|
|
105
126
|
}
|
|
106
|
-
declare function DonutChart({ recharts: R, data, height, className, ariaLabel, centerLabel, showLegend, innerRadius, outerRadius, nameFormatter, valueFormatter, }: DonutChartProps): react_jsx_runtime.JSX.Element;
|
|
127
|
+
declare function DonutChart({ recharts: R, data, height, className, ariaLabel, centerLabel, showLegend, innerRadius, outerRadius, nameFormatter, valueFormatter, tooltip, accessibilityLayer, }: DonutChartProps): react_jsx_runtime.JSX.Element;
|
|
107
128
|
interface SparklineProps<D = any> {
|
|
108
129
|
recharts: RechartsLike;
|
|
109
130
|
data: D[];
|
|
@@ -118,9 +139,11 @@ interface SparklineProps<D = any> {
|
|
|
118
139
|
* to clip at the edges/base; when on, the margins are widened so it isn't cut.
|
|
119
140
|
*/
|
|
120
141
|
interactive?: boolean;
|
|
142
|
+
/** Tooltip sizing/positioning (only used when `interactive`). */
|
|
143
|
+
tooltip?: ChartTooltipConfig;
|
|
121
144
|
className?: string;
|
|
122
145
|
ariaLabel?: string;
|
|
123
146
|
}
|
|
124
|
-
declare function Sparkline<D = any>({ recharts: R, data, dataKey, width, height, color, fill, interactive, className, ariaLabel, }: SparklineProps<D>): react_jsx_runtime.JSX.Element;
|
|
147
|
+
declare function Sparkline<D = any>({ recharts: R, data, dataKey, width, height, color, fill, interactive, tooltip, className, ariaLabel, }: SparklineProps<D>): react_jsx_runtime.JSX.Element;
|
|
125
148
|
|
|
126
|
-
export { AreaChart, type AreaChartProps, type AxisInterval, BarChart, type BarChartProps, type BaseChartProps, type CartesianChartProps, DonutChart, type DonutChartProps, LineChart, type LineChartProps, type RechartsLike, Sparkline, type SparklineProps };
|
|
149
|
+
export { AreaChart, type AreaChartProps, type AxisInterval, BarChart, type BarChartProps, type BaseChartProps, type CartesianChartProps, type ChartTooltipConfig, DonutChart, type DonutChartProps, LineChart, type LineChartProps, type RechartsLike, Sparkline, type SparklineProps };
|
|
@@ -35,12 +35,33 @@ type RechartsLike = {
|
|
|
35
35
|
Tooltip: RechartsComp;
|
|
36
36
|
Legend: RechartsComp;
|
|
37
37
|
};
|
|
38
|
+
/** Tooltip chrome shared by every chart. */
|
|
39
|
+
interface ChartTooltipConfig {
|
|
40
|
+
/**
|
|
41
|
+
* Cap the tooltip width so long content wraps instead of overflowing a narrow
|
|
42
|
+
* (mobile) chart. Default `min(220px, 90vw)`. Number = px; or any CSS length.
|
|
43
|
+
*/
|
|
44
|
+
maxWidth?: number | string;
|
|
45
|
+
/** Let the tooltip escape the chart's plotting box. Default: recharts (stays inside). */
|
|
46
|
+
allowEscapeViewBox?: {
|
|
47
|
+
x?: boolean;
|
|
48
|
+
y?: boolean;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
38
51
|
interface BaseChartProps<D = any> {
|
|
39
52
|
recharts: RechartsLike;
|
|
40
53
|
data: D[];
|
|
41
54
|
height?: number;
|
|
42
55
|
className?: string;
|
|
43
56
|
ariaLabel?: string;
|
|
57
|
+
/** Tooltip sizing/positioning. By default the tooltip caps its width and wraps. */
|
|
58
|
+
tooltip?: ChartTooltipConfig;
|
|
59
|
+
/**
|
|
60
|
+
* recharts' keyboard-navigation layer (puts `tabindex=0` on the svg + arrow-key
|
|
61
|
+
* navigation). Default `true`. Set `false` for a non-actionable chart so it's
|
|
62
|
+
* not a Tab stop / not focusable (no drill-down → nothing to navigate to).
|
|
63
|
+
*/
|
|
64
|
+
accessibilityLayer?: boolean;
|
|
44
65
|
}
|
|
45
66
|
type AxisInterval = number | 'preserveStart' | 'preserveEnd' | 'preserveStartEnd' | 'equidistantPreserveStart' | 'equidistantPreserveEnd';
|
|
46
67
|
interface CartesianChartProps<D = any> extends BaseChartProps<D> {
|
|
@@ -78,16 +99,16 @@ interface LineChartProps<D = any> extends CartesianChartProps<D> {
|
|
|
78
99
|
* straight segments — recommended for counts/stepped series (no phantom humps over zeros). */
|
|
79
100
|
curve?: 'linear' | 'monotone';
|
|
80
101
|
}
|
|
81
|
-
declare function LineChart<D = any>({ recharts: R, data, categoryKey, series, height, className, ariaLabel, showGrid, showLegend, smooth, curve, xTickFormatter, xTickInterval, xTickAngle, valueFormatter, allowDecimals, tooltipLabelFormatter, }: LineChartProps<D>): react_jsx_runtime.JSX.Element;
|
|
102
|
+
declare function LineChart<D = any>({ recharts: R, data, categoryKey, series, height, className, ariaLabel, showGrid, showLegend, smooth, curve, xTickFormatter, xTickInterval, xTickAngle, valueFormatter, allowDecimals, tooltipLabelFormatter, tooltip, accessibilityLayer, }: LineChartProps<D>): react_jsx_runtime.JSX.Element;
|
|
82
103
|
interface AreaChartProps<D = any> extends LineChartProps<D> {
|
|
83
104
|
stacked?: boolean;
|
|
84
105
|
}
|
|
85
|
-
declare function AreaChart<D = any>({ recharts: R, data, categoryKey, series, height, className, ariaLabel, showGrid, showLegend, smooth, curve, stacked, xTickFormatter, xTickInterval, xTickAngle, valueFormatter, allowDecimals, tooltipLabelFormatter, }: AreaChartProps<D>): react_jsx_runtime.JSX.Element;
|
|
106
|
+
declare function AreaChart<D = any>({ recharts: R, data, categoryKey, series, height, className, ariaLabel, showGrid, showLegend, smooth, curve, stacked, xTickFormatter, xTickInterval, xTickAngle, valueFormatter, allowDecimals, tooltipLabelFormatter, tooltip, accessibilityLayer, }: AreaChartProps<D>): react_jsx_runtime.JSX.Element;
|
|
86
107
|
interface BarChartProps<D = any> extends CartesianChartProps<D> {
|
|
87
108
|
layout?: 'vertical' | 'horizontal';
|
|
88
109
|
stacked?: boolean;
|
|
89
110
|
}
|
|
90
|
-
declare function BarChart<D = any>({ recharts: R, data, categoryKey, series, height, className, ariaLabel, layout, stacked, showGrid, showLegend, xTickFormatter, xTickInterval, xTickAngle, valueFormatter, allowDecimals, tooltipLabelFormatter, }: BarChartProps<D>): react_jsx_runtime.JSX.Element;
|
|
111
|
+
declare function BarChart<D = any>({ recharts: R, data, categoryKey, series, height, className, ariaLabel, layout, stacked, showGrid, showLegend, xTickFormatter, xTickInterval, xTickAngle, valueFormatter, allowDecimals, tooltipLabelFormatter, tooltip, accessibilityLayer, }: BarChartProps<D>): react_jsx_runtime.JSX.Element;
|
|
91
112
|
interface DonutChartProps extends Omit<BaseChartProps, 'data'> {
|
|
92
113
|
data: Array<{
|
|
93
114
|
name: string;
|
|
@@ -103,7 +124,7 @@ interface DonutChartProps extends Omit<BaseChartProps, 'data'> {
|
|
|
103
124
|
/** Format slice values in the tooltip. */
|
|
104
125
|
valueFormatter?: (value: number) => string;
|
|
105
126
|
}
|
|
106
|
-
declare function DonutChart({ recharts: R, data, height, className, ariaLabel, centerLabel, showLegend, innerRadius, outerRadius, nameFormatter, valueFormatter, }: DonutChartProps): react_jsx_runtime.JSX.Element;
|
|
127
|
+
declare function DonutChart({ recharts: R, data, height, className, ariaLabel, centerLabel, showLegend, innerRadius, outerRadius, nameFormatter, valueFormatter, tooltip, accessibilityLayer, }: DonutChartProps): react_jsx_runtime.JSX.Element;
|
|
107
128
|
interface SparklineProps<D = any> {
|
|
108
129
|
recharts: RechartsLike;
|
|
109
130
|
data: D[];
|
|
@@ -118,9 +139,11 @@ interface SparklineProps<D = any> {
|
|
|
118
139
|
* to clip at the edges/base; when on, the margins are widened so it isn't cut.
|
|
119
140
|
*/
|
|
120
141
|
interactive?: boolean;
|
|
142
|
+
/** Tooltip sizing/positioning (only used when `interactive`). */
|
|
143
|
+
tooltip?: ChartTooltipConfig;
|
|
121
144
|
className?: string;
|
|
122
145
|
ariaLabel?: string;
|
|
123
146
|
}
|
|
124
|
-
declare function Sparkline<D = any>({ recharts: R, data, dataKey, width, height, color, fill, interactive, className, ariaLabel, }: SparklineProps<D>): react_jsx_runtime.JSX.Element;
|
|
147
|
+
declare function Sparkline<D = any>({ recharts: R, data, dataKey, width, height, color, fill, interactive, tooltip, className, ariaLabel, }: SparklineProps<D>): react_jsx_runtime.JSX.Element;
|
|
125
148
|
|
|
126
|
-
export { AreaChart, type AreaChartProps, type AxisInterval, BarChart, type BarChartProps, type BaseChartProps, type CartesianChartProps, DonutChart, type DonutChartProps, LineChart, type LineChartProps, type RechartsLike, Sparkline, type SparklineProps };
|
|
149
|
+
export { AreaChart, type AreaChartProps, type AxisInterval, BarChart, type BarChartProps, type BaseChartProps, type CartesianChartProps, type ChartTooltipConfig, DonutChart, type DonutChartProps, LineChart, type LineChartProps, type RechartsLike, Sparkline, type SparklineProps };
|