@acronis-platform/ui-react 5.4.1 → 5.4.3
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/components/ui/area-chart/area-chart.js +107 -105
- package/dist/components/ui/area-chart/area-chart.js.map +1 -1
- package/dist/components/ui/bar-chart/bar-chart.js +135 -132
- package/dist/components/ui/bar-chart/bar-chart.js.map +1 -1
- package/dist/components/ui/chart/chart-format.js +36 -31
- package/dist/components/ui/chart/chart-format.js.map +1 -1
- package/dist/components/ui/chart/chart.js +9 -7
- package/dist/components/ui/chart/chart.js.map +1 -1
- package/dist/components/ui/chart/use-x-axis-layout.js +71 -0
- package/dist/components/ui/chart/use-x-axis-layout.js.map +1 -0
- package/dist/components/ui/composed-chart/composed-chart.js +141 -139
- package/dist/components/ui/composed-chart/composed-chart.js.map +1 -1
- package/dist/components/ui/confidence-cone/confidence-cone.js +70 -67
- package/dist/components/ui/confidence-cone/confidence-cone.js.map +1 -1
- package/dist/components/ui/histogram/histogram.js +54 -51
- package/dist/components/ui/histogram/histogram.js.map +1 -1
- package/dist/components/ui/line-chart/line-chart.js +119 -117
- package/dist/components/ui/line-chart/line-chart.js.map +1 -1
- package/dist/components/ui/scatter-chart/scatter-chart.js +53 -51
- package/dist/components/ui/scatter-chart/scatter-chart.js.map +1 -1
- package/dist/llms/area-chart.md +10 -1
- package/dist/llms/bar-chart.md +10 -1
- package/dist/llms/composed-chart.md +10 -1
- package/dist/llms/confidence-cone.md +10 -1
- package/dist/llms/histogram.md +10 -1
- package/dist/llms/line-chart.md +10 -1
- package/dist/llms/scatter-chart.md +10 -1
- package/dist/llms.txt +1 -1
- package/dist/src/components/ui/chart/chart-format.d.ts +10 -4
- package/dist/src/components/ui/chart/chart.d.ts +1 -1
- package/dist/src/components/ui/chart/use-x-axis-layout.d.ts +28 -0
- package/dist/ui-react.css +1 -1
- package/package.json +2 -2
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
import { cn as e } from "../../../lib/utils.js";
|
|
3
3
|
import { cva as t } from "../../../node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.js";
|
|
4
4
|
import { ChartContainer as n, ChartLegend as r, ChartLegendContent as i, ChartTooltip as a, ChartTooltipContent as o, toCssKey as s } from "../chart/chart.js";
|
|
5
|
-
import { CHART_LABEL_MARGIN as c, dropProjectionPayload as l, resolveAnimation as u, resolveAxisDomain as d, resolveBrushProps as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
5
|
+
import { CHART_LABEL_MARGIN as c, dropProjectionPayload as l, resolveAnimation as u, resolveAxisDomain as d, resolveBrushProps as f, resolveCartesianLabelPosition as p, resolveChartReferenceValue as m, resolveLabelFillClass as h, resolveReferenceLineProps as ee, resolveRotatedTickAnchor as te, resolveXAxisTickLabels as ne, resolveXAxisTitle as re, resolveYAxisTitle as ie, toLabelFormatter as ae, toReferenceLineList as oe } from "../chart/chart-format.js";
|
|
6
|
+
import { mergeXAxisLayoutMargin as se, useXAxisLayout as g } from "../chart/use-x-axis-layout.js";
|
|
7
|
+
import * as _ from "react";
|
|
8
|
+
import { Fragment as v, jsx as y, jsxs as b } from "react/jsx-runtime";
|
|
9
|
+
import { Area as x, AreaChart as ce, Brush as le, CartesianGrid as ue, LabelList as de, ReferenceLine as fe, Text as pe, XAxis as me, YAxis as he, usePlotArea as S, useXAxisScale as C } from "recharts";
|
|
9
10
|
//#region src/components/ui/area-chart/area-chart.tsx
|
|
10
11
|
var w = t("", {
|
|
11
12
|
variants: {
|
|
@@ -23,38 +24,38 @@ var w = t("", {
|
|
|
23
24
|
fill: "solid"
|
|
24
25
|
}
|
|
25
26
|
});
|
|
26
|
-
function
|
|
27
|
+
function ge(e) {
|
|
27
28
|
return function(t) {
|
|
28
29
|
let n = {
|
|
29
30
|
...t,
|
|
30
31
|
payload: l(t.payload)
|
|
31
32
|
};
|
|
32
|
-
return typeof e == "function" ? /* @__PURE__ */
|
|
33
|
+
return typeof e == "function" ? /* @__PURE__ */ y(e, { ...n }) : _.cloneElement(e, n);
|
|
33
34
|
};
|
|
34
35
|
}
|
|
35
|
-
function
|
|
36
|
+
function _e({ projectionStart: e, prevTick: t, clipId: n }) {
|
|
36
37
|
let r = C(), i = S();
|
|
37
38
|
if (!r || !i) return null;
|
|
38
39
|
let a = r(t), o = r(e);
|
|
39
40
|
if (a == null || o == null) return null;
|
|
40
41
|
let s = (a + o) / 2, { x: c, y: l, width: u, height: d } = i;
|
|
41
|
-
return /* @__PURE__ */
|
|
42
|
+
return /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ b("defs", { children: [/* @__PURE__ */ y("clipPath", {
|
|
42
43
|
id: `${n}-actual`,
|
|
43
|
-
children: /* @__PURE__ */
|
|
44
|
+
children: /* @__PURE__ */ y("rect", {
|
|
44
45
|
x: c,
|
|
45
46
|
y: l,
|
|
46
47
|
width: s - c,
|
|
47
48
|
height: d
|
|
48
49
|
})
|
|
49
|
-
}), /* @__PURE__ */
|
|
50
|
+
}), /* @__PURE__ */ y("clipPath", {
|
|
50
51
|
id: `${n}-projection`,
|
|
51
|
-
children: /* @__PURE__ */
|
|
52
|
+
children: /* @__PURE__ */ y("rect", {
|
|
52
53
|
x: s,
|
|
53
54
|
y: l,
|
|
54
55
|
width: c + u - s,
|
|
55
56
|
height: d
|
|
56
57
|
})
|
|
57
|
-
})] }), /* @__PURE__ */
|
|
58
|
+
})] }), /* @__PURE__ */ y("line", {
|
|
58
59
|
x1: s,
|
|
59
60
|
y1: l,
|
|
60
61
|
x2: s,
|
|
@@ -63,192 +64,193 @@ function he({ projectionStart: e, prevTick: t, clipId: n }) {
|
|
|
63
64
|
strokeDasharray: "4 4"
|
|
64
65
|
})] });
|
|
65
66
|
}
|
|
66
|
-
function
|
|
67
|
-
return /* @__PURE__ */
|
|
67
|
+
function ve({ dataKeys: e, gradientId: t, colorFor: n }) {
|
|
68
|
+
return /* @__PURE__ */ y("defs", { children: e.map((e) => /* @__PURE__ */ b("linearGradient", {
|
|
68
69
|
id: `${t}-${s(e)}`,
|
|
69
70
|
x1: "0",
|
|
70
71
|
y1: "0",
|
|
71
72
|
x2: "0",
|
|
72
73
|
y2: "1",
|
|
73
|
-
children: [/* @__PURE__ */
|
|
74
|
+
children: [/* @__PURE__ */ y("stop", {
|
|
74
75
|
offset: "5%",
|
|
75
76
|
stopColor: n(e),
|
|
76
77
|
stopOpacity: .8
|
|
77
|
-
}), /* @__PURE__ */
|
|
78
|
+
}), /* @__PURE__ */ y("stop", {
|
|
78
79
|
offset: "95%",
|
|
79
80
|
stopColor: n(e),
|
|
80
81
|
stopOpacity: .1
|
|
81
82
|
})]
|
|
82
83
|
}, e)) });
|
|
83
84
|
}
|
|
84
|
-
var T =
|
|
85
|
-
let
|
|
86
|
-
animate:
|
|
87
|
-
animationDuration:
|
|
88
|
-
animationBegin:
|
|
89
|
-
animationEasing:
|
|
90
|
-
}),
|
|
91
|
-
labelPosition:
|
|
92
|
-
isStacked:
|
|
93
|
-
}),
|
|
94
|
-
|
|
85
|
+
var T = _.forwardRef(({ className: t, config: v, palette: S, data: C, dataKeys: T, xKey: E, xAxisLabel: D, yAxisLabel: O, yUnit: ye, layout: k = "single", fill: A = "solid", curve: j = "monotone", strokeWidth: M = 2, fillOpacity: N = .4, showDots: P = !1, dotSize: be = 3, showActiveDot: xe, connectNulls: Se = !1, areaSettings: F, referenceLine: Ce, projectionStart: I, showGrid: we = !0, showTooltip: Te = !0, showLegend: Ee = !0, showXAxis: De = !0, showYAxis: Oe = !0, xTickFormatter: L, yTickFormatter: ke, xAxisAngle: R, xAxisInterval: Ae, yAxisTickCount: je, yAxisDomain: Me, gridDashed: Ne, gridHorizontal: Pe, gridVertical: Fe, tooltipContent: z, animate: Ie, animationDuration: Le, animationBegin: Re, animationEasing: ze, showLabels: B = !1, labelPosition: Be, labelFormatter: Ve, showBrush: He = !1, brushHeight: Ue, brushAriaLabel: We, ...Ge }, Ke) => {
|
|
86
|
+
let V = u({
|
|
87
|
+
animate: Ie,
|
|
88
|
+
animationDuration: Le,
|
|
89
|
+
animationBegin: Re,
|
|
90
|
+
animationEasing: ze
|
|
91
|
+
}), H = k === "stacked", qe = p({
|
|
92
|
+
labelPosition: Be,
|
|
93
|
+
isStacked: H
|
|
94
|
+
}), U = A === "gradient", Je = oe(Ce), W = (e) => F?.[e]?.color ?? `var(--color-${s(e)})`, Ye = B || Object.values(F ?? {}).some((e) => e.showLabel), Xe = re(D), Ze = ie(O), Qe = d(Me), $e = ne(C.map((e) => e[E]), L), G = _.useRef(null), K = g(G, R, D, $e.join("\0")), et = se(Ye ? c : void 0, K.margin), q = _.useMemo(() => I === void 0 ? -1 : C.findIndex((e) => e[E] === I), [
|
|
95
|
+
I,
|
|
95
96
|
C,
|
|
96
97
|
E
|
|
97
|
-
]),
|
|
98
|
-
if (!
|
|
99
|
-
let e = new Set(C.slice(
|
|
100
|
-
return ({ payload: t, index: n, ...r }) => /* @__PURE__ */
|
|
98
|
+
]), J = q > 0, Y = _.useMemo(() => {
|
|
99
|
+
if (!J) return;
|
|
100
|
+
let e = new Set(C.slice(q).map((e) => e[E]));
|
|
101
|
+
return ({ payload: t, index: n, ...r }) => /* @__PURE__ */ y(pe, {
|
|
101
102
|
...r,
|
|
102
103
|
fontSize: 12,
|
|
103
104
|
className: e.has(t.value) ? "fill-[var(--ui-text-on-surface-disabled)]" : "fill-muted-foreground",
|
|
104
|
-
children:
|
|
105
|
+
children: L ? L(t.value, n) : t.value
|
|
105
106
|
});
|
|
106
107
|
}, [
|
|
107
|
-
Y,
|
|
108
108
|
J,
|
|
109
|
+
q,
|
|
109
110
|
C,
|
|
110
111
|
E,
|
|
111
|
-
|
|
112
|
-
]),
|
|
112
|
+
L
|
|
113
|
+
]), X = _.useMemo(() => J ? C.map((e) => ({
|
|
113
114
|
...e,
|
|
114
115
|
...Object.fromEntries(T.map((t) => [`_proj_${t}`, e[t]]))
|
|
115
116
|
})) : C, [
|
|
116
|
-
|
|
117
|
+
J,
|
|
117
118
|
C,
|
|
118
119
|
T
|
|
119
|
-
]), Z =
|
|
120
|
-
if (!(
|
|
120
|
+
]), Z = _.useMemo(() => {
|
|
121
|
+
if (!(q <= 0)) return C[q - 1]?.[E];
|
|
121
122
|
}, [
|
|
122
|
-
|
|
123
|
+
q,
|
|
123
124
|
C,
|
|
124
125
|
E
|
|
125
|
-
]),
|
|
126
|
+
]), tt = _.useMemo(() => J && z ? ge(z) : void 0, [J, z]), nt = J ? tt ?? ((e) => /* @__PURE__ */ y(o, {
|
|
126
127
|
active: e.active,
|
|
127
128
|
label: e.label,
|
|
128
129
|
payload: l(e.payload)
|
|
129
|
-
})) :
|
|
130
|
+
})) : z ?? /* @__PURE__ */ y(o, {}), rt = J ? (e) => /* @__PURE__ */ y(i, {
|
|
130
131
|
verticalAlign: e.verticalAlign,
|
|
131
132
|
payload: l(e.payload)
|
|
132
|
-
}) : /* @__PURE__ */
|
|
133
|
-
return /* @__PURE__ */
|
|
134
|
-
ref:
|
|
133
|
+
}) : /* @__PURE__ */ y(i, {}), Q = `area-gradient-${_.useId().replace(/:/g, "")}`, $ = `area-proj-${_.useId().replace(/:/g, "")}`;
|
|
134
|
+
return /* @__PURE__ */ y("div", {
|
|
135
|
+
ref: Ke,
|
|
135
136
|
"data-layout": k,
|
|
136
137
|
"data-fill": A,
|
|
137
138
|
className: e(w({
|
|
138
139
|
layout: k,
|
|
139
140
|
fill: A
|
|
140
141
|
}), t),
|
|
141
|
-
...
|
|
142
|
-
children: /* @__PURE__ */
|
|
143
|
-
|
|
142
|
+
...Ge,
|
|
143
|
+
children: /* @__PURE__ */ y(n, {
|
|
144
|
+
ref: G,
|
|
145
|
+
config: v,
|
|
144
146
|
palette: S,
|
|
145
147
|
className: "size-full [&_.recharts-label]:fill-foreground",
|
|
146
|
-
children: /* @__PURE__ */
|
|
147
|
-
data:
|
|
148
|
-
margin:
|
|
148
|
+
children: /* @__PURE__ */ b(ce, {
|
|
149
|
+
data: X,
|
|
150
|
+
margin: et,
|
|
149
151
|
children: [
|
|
150
|
-
|
|
152
|
+
U && /* @__PURE__ */ y(ve, {
|
|
151
153
|
dataKeys: T,
|
|
152
154
|
gradientId: Q,
|
|
153
|
-
colorFor:
|
|
155
|
+
colorFor: W
|
|
154
156
|
}),
|
|
155
|
-
|
|
156
|
-
horizontal:
|
|
157
|
-
vertical:
|
|
158
|
-
strokeDasharray:
|
|
157
|
+
we && /* @__PURE__ */ y(ue, {
|
|
158
|
+
horizontal: Pe ?? !0,
|
|
159
|
+
vertical: Fe ?? !1,
|
|
160
|
+
strokeDasharray: Ne ? "3 3" : void 0
|
|
159
161
|
}),
|
|
160
|
-
/* @__PURE__ */
|
|
162
|
+
/* @__PURE__ */ y(me, {
|
|
161
163
|
dataKey: E,
|
|
162
164
|
type: "category",
|
|
163
|
-
hide: !
|
|
165
|
+
hide: !De,
|
|
164
166
|
tickLine: !1,
|
|
165
167
|
axisLine: !1,
|
|
166
168
|
tickMargin: 8,
|
|
167
|
-
tickFormatter:
|
|
168
|
-
tick:
|
|
169
|
-
angle:
|
|
170
|
-
interval:
|
|
171
|
-
textAnchor:
|
|
172
|
-
height:
|
|
173
|
-
label:
|
|
169
|
+
tickFormatter: Y ? void 0 : L,
|
|
170
|
+
tick: Y,
|
|
171
|
+
angle: R,
|
|
172
|
+
interval: Ae,
|
|
173
|
+
textAnchor: te(R),
|
|
174
|
+
height: K.height,
|
|
175
|
+
label: Xe
|
|
174
176
|
}),
|
|
175
|
-
/* @__PURE__ */
|
|
177
|
+
/* @__PURE__ */ y(he, {
|
|
176
178
|
type: "number",
|
|
177
|
-
hide: !
|
|
179
|
+
hide: !Oe,
|
|
178
180
|
tickLine: !1,
|
|
179
181
|
axisLine: !1,
|
|
180
|
-
unit:
|
|
181
|
-
tickFormatter:
|
|
182
|
-
tickCount:
|
|
183
|
-
domain:
|
|
182
|
+
unit: ye,
|
|
183
|
+
tickFormatter: ke,
|
|
184
|
+
tickCount: je,
|
|
185
|
+
domain: Qe,
|
|
184
186
|
width: O ? 72 : void 0,
|
|
185
|
-
label:
|
|
187
|
+
label: Ze
|
|
186
188
|
}),
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
projectionStart:
|
|
189
|
+
Te && /* @__PURE__ */ y(a, { content: nt }),
|
|
190
|
+
Ee && /* @__PURE__ */ y(r, { content: rt }),
|
|
191
|
+
J && Z != null && /* @__PURE__ */ y(_e, {
|
|
192
|
+
projectionStart: I,
|
|
191
193
|
prevTick: Z,
|
|
192
194
|
clipId: $
|
|
193
195
|
}),
|
|
194
196
|
T.map((e) => {
|
|
195
|
-
let t =
|
|
196
|
-
return /* @__PURE__ */
|
|
197
|
+
let t = F?.[e], n = t?.showDots ?? P, r = t?.dotSize ?? be, i = xe ?? n, a = t?.showLabel ?? B, o = t?.labelPosition ?? qe;
|
|
198
|
+
return /* @__PURE__ */ y(x, {
|
|
197
199
|
type: t?.curveType ?? j ?? "monotone",
|
|
198
200
|
dataKey: e,
|
|
199
|
-
stackId:
|
|
200
|
-
stroke:
|
|
201
|
+
stackId: H ? "a" : void 0,
|
|
202
|
+
stroke: W(e),
|
|
201
203
|
strokeWidth: t?.strokeWidth ?? M,
|
|
202
204
|
strokeDasharray: t?.dashed ? "5 5" : void 0,
|
|
203
|
-
fill:
|
|
204
|
-
fillOpacity: t?.fillOpacity ?? (
|
|
205
|
+
fill: U ? `url(#${Q}-${s(e)})` : W(e),
|
|
206
|
+
fillOpacity: t?.fillOpacity ?? (U ? 1 : N),
|
|
205
207
|
dot: n ? { r } : !1,
|
|
206
208
|
activeDot: i ? { r: r + 2 } : !1,
|
|
207
|
-
connectNulls:
|
|
208
|
-
clipPath:
|
|
209
|
-
...
|
|
210
|
-
children: a && /* @__PURE__ */
|
|
209
|
+
connectNulls: Se,
|
|
210
|
+
clipPath: J ? `url(#${$}-actual)` : void 0,
|
|
211
|
+
...V,
|
|
212
|
+
children: a && /* @__PURE__ */ y(de, {
|
|
211
213
|
dataKey: e,
|
|
212
214
|
position: o,
|
|
213
|
-
formatter:
|
|
214
|
-
className:
|
|
215
|
+
formatter: ae(Ve),
|
|
216
|
+
className: h(o, { translucentSeries: !0 }),
|
|
215
217
|
fontSize: 12
|
|
216
218
|
})
|
|
217
219
|
}, e);
|
|
218
220
|
}),
|
|
219
|
-
|
|
220
|
-
let t =
|
|
221
|
-
return /* @__PURE__ */
|
|
221
|
+
J && T.map((e) => {
|
|
222
|
+
let t = F?.[e];
|
|
223
|
+
return /* @__PURE__ */ y(x, {
|
|
222
224
|
type: t?.curveType ?? j ?? "monotone",
|
|
223
225
|
dataKey: `_proj_${e}`,
|
|
224
226
|
name: e,
|
|
225
|
-
stackId:
|
|
226
|
-
stroke:
|
|
227
|
+
stackId: H ? "proj" : void 0,
|
|
228
|
+
stroke: W(e),
|
|
227
229
|
strokeWidth: t?.strokeWidth ?? M,
|
|
228
230
|
strokeDasharray: "5 5",
|
|
229
|
-
fill:
|
|
230
|
-
fillOpacity: t?.fillOpacity ?? (
|
|
231
|
+
fill: U ? `url(#${Q}-${s(e)})` : W(e),
|
|
232
|
+
fillOpacity: t?.fillOpacity ?? (U ? 1 : N),
|
|
231
233
|
dot: !1,
|
|
232
234
|
activeDot: !1,
|
|
233
235
|
clipPath: `url(#${$}-projection)`,
|
|
234
236
|
legendType: "none",
|
|
235
237
|
tooltipType: "none",
|
|
236
|
-
...
|
|
238
|
+
...V
|
|
237
239
|
}, `_proj_${e}`);
|
|
238
240
|
}),
|
|
239
|
-
|
|
240
|
-
let n =
|
|
241
|
-
return n === void 0 ? null : /* @__PURE__ */
|
|
241
|
+
Je.map((e, t) => {
|
|
242
|
+
let n = m(e, C, T);
|
|
243
|
+
return n === void 0 ? null : /* @__PURE__ */ y(fe, {
|
|
242
244
|
y: n,
|
|
243
|
-
...
|
|
245
|
+
...ee(e.label, e.labelPosition)
|
|
244
246
|
}, `${e.label ?? "ref"}-${t}`);
|
|
245
247
|
}),
|
|
246
|
-
|
|
248
|
+
He && /* @__PURE__ */ y(le, {
|
|
247
249
|
dataKey: E,
|
|
248
|
-
tickFormatter:
|
|
249
|
-
...
|
|
250
|
-
brushHeight:
|
|
251
|
-
brushAriaLabel:
|
|
250
|
+
tickFormatter: L,
|
|
251
|
+
...f({
|
|
252
|
+
brushHeight: Ue,
|
|
253
|
+
brushAriaLabel: We
|
|
252
254
|
})
|
|
253
255
|
})
|
|
254
256
|
]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"area-chart.js","names":[],"sources":["../../../../src/components/ui/area-chart/area-chart.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport {\n Area,\n AreaChart as RechartsAreaChart,\n Brush,\n CartesianGrid,\n LabelList,\n ReferenceLine,\n Text,\n XAxis,\n YAxis,\n useXAxisScale,\n usePlotArea,\n} from 'recharts';\n\nimport { cn } from '@/lib/utils';\nimport {\n CHART_LABEL_FONT_SIZE,\n CHART_LABEL_MARGIN,\n ChartContainer,\n ChartLegend,\n ChartLegendContent,\n ChartTooltip,\n ChartTooltipContent,\n resolveAnimation,\n resolveAxisDomain,\n resolveBrushProps,\n resolveCartesianLabelPosition,\n dropProjectionPayload,\n resolveChartReferenceValue,\n resolveLabelFillClass,\n resolveReferenceLineProps,\n resolveRotatedTickAnchor,\n resolveXAxisHeight,\n resolveXAxisTitle,\n resolveYAxisTitle,\n toLabelFormatter,\n toReferenceLineList,\n type ChartConfig,\n type ChartPalette,\n type ChartLegendContentProps,\n type ChartTooltipContentProps,\n type CartesianChartProps,\n type ChartAnimationProps,\n type ChartBrushProps,\n type ChartCurveType,\n type ChartDataLabelProps,\n type ChartReferenceLine,\n toCssKey,\n type CartesianLabelPosition,\n} from '../chart';\n\n// A typed recharts composition over the shared `Chart` primitives. The two CVA\n// axes are the design's Area-chart variant set: `layout` (independent\n// overlapping areas vs summed on a shared stack) and `fill` (a flat translucent\n// fill vs a vertical gradient). The classes stay empty because recharts' SVG —\n// not CSS — draws the areas: `layout` drives each `<Area>`'s `stackId` and `fill`\n// drives whether it paints from a `<linearGradient>` def or a flat token color.\n// CVA is kept so the variant set is a first-class, spec-conformant part of the\n// API (matched against ui-spec's api.yaml enums) and exposed via `VariantProps`;\n// the resolved values are also mirrored onto `data-layout` / `data-fill`.\nconst areaChartVariants = cva('', {\n variants: {\n layout: {\n single: '',\n stacked: '',\n },\n fill: {\n solid: '',\n gradient: '',\n },\n },\n defaultVariants: {\n layout: 'single',\n fill: 'solid',\n },\n});\n\n/**\n * Style override for one series, keyed by its `dataKeys` entry. Anything left\n * unset falls back to the chart-wide prop, so an entry only states what differs\n * — e.g. a projection band that reads fainter than the actuals beside it.\n */\nexport interface AreaChartAreaSettings {\n /** Stroke and fill color. Defaults to the series' `config` color. */\n color?: string;\n /** Width of this series' top border. Defaults to the chart's `strokeWidth`. */\n strokeWidth?: number;\n /** Dash this series' top border. */\n dashed?: boolean;\n /** Interpolation for this series only. Defaults to the chart's `curve`. */\n curveType?: ChartCurveType;\n /**\n * Fill opacity for this series. Under `fill=\"gradient\"` it scales the\n * gradient's own alpha rather than replacing it.\n */\n fillOpacity?: number;\n /** Render this series' per-point dots. Defaults to the chart's `showDots`. */\n showDots?: boolean;\n /** Dot radius for this series, in px. Defaults to the chart's `dotSize`. */\n dotSize?: number;\n /** Show/hide this series' value labels, overriding the chart's `showLabels`. */\n showLabel?: boolean;\n /** Position of this series' value labels. Defaults to the chart's `labelPosition`. */\n labelPosition?: CartesianLabelPosition;\n}\n\nexport interface AreaChartProps\n extends Omit<React.ComponentProps<'div'>, 'children'>,\n VariantProps<typeof areaChartVariants>,\n CartesianChartProps,\n ChartAnimationProps,\n ChartBrushProps,\n ChartDataLabelProps {\n /**\n * The dataviz palette this chart's series are painted from. Series that\n * state no `color` of their own take a stop of it. See `ChartPalette`.\n */\n palette?: ChartPalette;\n /** Row-per-point data. Each object holds the category key + one numeric field per series (`null` breaks the area unless `connectNulls`). */\n data: ReadonlyArray<Record<string, string | number | null>>;\n /**\n * Per-series map of `label` / `icon` / `tone` (from the shared `Chart`\n * primitives). Series take their colour from the container's `palette`; each\n * entry maps a key to a `label` and an optional `tone`.\n */\n config: ChartConfig;\n /** Series to plot — one `<Area>` per key. Each must exist in `config` and in every data row. */\n dataKeys: string[];\n /** Category axis key (the shared dimension across rows, e.g. `\"month\"`). */\n xKey: string;\n /** Interpolation between points. */\n curve?: ChartCurveType;\n /** Stroke width of each area's top border. */\n strokeWidth?: number;\n /** Flat-fill opacity — used only when `fill=\"solid\"` (gradient controls its own stops). */\n fillOpacity?: number;\n /** Render a dot at each data point. */\n showDots?: boolean;\n /** Radius of each point's dot, in px. Its hover dot is 2px larger. */\n dotSize?: number;\n /**\n * Enlarge the hovered point's dot. Defaults to following `showDots`, so pass\n * it explicitly to get hover dots on a dot-less area (`showDots={false}` with\n * `showActiveDot`) or a static-only area (dots without the hover one).\n */\n showActiveDot?: boolean;\n /** Bridge `null` gaps in the data instead of breaking the area. */\n connectNulls?: boolean;\n /**\n * Per-series style overrides, keyed by `dataKeys` entry. Series with no entry\n * render from the chart-wide props.\n */\n areaSettings?: Record<string, AreaChartAreaSettings>;\n /**\n * One or more dashed reference/average lines on the value axis — a target, a\n * threshold, or a series mean. Pass a single object or an array to draw\n * several at once. On a stacked chart the value is read against the stack's\n * axis, not one series.\n */\n referenceLine?: ChartReferenceLine | ChartReferenceLine[];\n /**\n * The category value (matching an `xKey` entry) at which the projection\n * zone starts. Ticks from this point onward render in the disabled text\n * color (`--ui-text-on-surface-disabled`). The chart data and series\n * themselves are not affected — only the X-axis tick appearance changes.\n *\n * Use this when displaying a forecast/projection range where future\n * data points should be visually de-emphasized on the axis.\n */\n projectionStart?: string | number;\n showLegend?: boolean;\n /** Position of the value labels when `showLabels` is on. Defaults to `top`. */\n labelPosition?: CartesianLabelPosition;\n}\n\ntype TooltipContentType = NonNullable<React.ComponentProps<typeof ChartTooltip>['content']>;\ntype TooltipContentFn = Extract<TooltipContentType, (...args: never[]) => unknown>;\ntype TooltipRenderProps = Parameters<TooltipContentFn>[0];\ntype LegendContentFn = Extract<\n React.ComponentProps<typeof ChartLegend>['content'],\n (...args: never[]) => unknown\n>;\ntype LegendContentProps = Parameters<LegendContentFn>[0];\n\nfunction createProjectionTooltip(tooltipContent: TooltipContentType) {\n return function ProjectionTooltip(props: TooltipRenderProps) {\n const merged = {\n ...props,\n payload: dropProjectionPayload(props.payload),\n } as TooltipRenderProps;\n if (typeof tooltipContent === 'function') {\n const Comp = tooltipContent as React.FunctionComponent<TooltipRenderProps>;\n return <Comp {...merged} />;\n }\n // Element-form tooltip: cloneElement is the React-idiomatic way to\n // re-render an existing element with new props (preserves refs & keys).\n return React.cloneElement(tooltipContent, merged);\n };\n}\n\n// Renders two <clipPath> defs (actual / projection) and a dashed separator\n// line at the visual midpoint between the last actual tick and the first\n// projection tick. Both the actual and projection <Area> series reference\n// these clip regions, so the exact same curve renders on each side — no kink.\nfunction ProjectionClip({\n projectionStart,\n prevTick,\n clipId,\n}: {\n projectionStart: string | number;\n prevTick: string | number;\n clipId: string;\n}) {\n const xScale = useXAxisScale();\n const plotArea = usePlotArea();\n if (!xScale || !plotArea) return null;\n const prevX = xScale(prevTick as string);\n const currX = xScale(projectionStart as string);\n if (prevX == null || currX == null) return null;\n const midX = (prevX + currX) / 2;\n const { x, y, width, height } = plotArea;\n return (\n <>\n <defs>\n <clipPath id={`${clipId}-actual`}>\n <rect x={x} y={y} width={midX - x} height={height} />\n </clipPath>\n <clipPath id={`${clipId}-projection`}>\n <rect x={midX} y={y} width={x + width - midX} height={height} />\n </clipPath>\n </defs>\n <line\n x1={midX}\n y1={y}\n x2={midX}\n y2={y + height}\n stroke=\"var(--ui-border-on-surface-border)\"\n strokeDasharray=\"4 4\"\n />\n </>\n );\n}\n\n/**\n * One top-to-bottom fade per series, referenced by each `<Area>`'s `fill`.\n *\n * The ids are scoped by `gradientId` because SVG `<defs>` ids are\n * document-global: two AreaCharts on the same page would otherwise share (and\n * silently overwrite) each other's stops.\n */\nfunction AreaFillGradients({\n dataKeys,\n gradientId,\n colorFor,\n}: {\n dataKeys: string[];\n gradientId: string;\n colorFor: (key: string) => string;\n}) {\n return (\n <defs>\n {dataKeys.map((key) => (\n <linearGradient\n key={key}\n id={`${gradientId}-${toCssKey(key)}`}\n x1=\"0\"\n y1=\"0\"\n x2=\"0\"\n y2=\"1\"\n >\n <stop offset=\"5%\" stopColor={colorFor(key)} stopOpacity={0.8} />\n <stop offset=\"95%\" stopColor={colorFor(key)} stopOpacity={0.1} />\n </linearGradient>\n ))}\n </defs>\n );\n}\n\nconst AreaChart = React.forwardRef<HTMLDivElement, AreaChartProps>(\n (\n {\n className,\n config,\n palette,\n data,\n dataKeys,\n xKey,\n xAxisLabel,\n yAxisLabel,\n yUnit,\n layout = 'single',\n fill = 'solid',\n curve = 'monotone',\n strokeWidth = 2,\n fillOpacity = 0.4,\n showDots = false,\n dotSize = 3,\n showActiveDot,\n connectNulls = false,\n areaSettings,\n referenceLine,\n projectionStart,\n showGrid = true,\n showTooltip = true,\n showLegend = true,\n showXAxis = true,\n showYAxis = true,\n xTickFormatter,\n yTickFormatter,\n xAxisAngle,\n xAxisInterval,\n yAxisTickCount,\n yAxisDomain,\n gridDashed,\n gridHorizontal,\n gridVertical,\n tooltipContent,\n animate,\n animationDuration,\n animationBegin,\n animationEasing,\n showLabels = false,\n labelPosition,\n labelFormatter,\n showBrush = false,\n brushHeight,\n brushAriaLabel,\n ...props\n },\n ref\n ) => {\n const animation = resolveAnimation({\n animate,\n animationDuration,\n animationBegin,\n animationEasing,\n });\n const isStacked = layout === 'stacked';\n const areaLabelPosition = resolveCartesianLabelPosition({\n labelPosition,\n isStacked,\n });\n const isGradient = fill === 'gradient';\n const referenceLines = toReferenceLineList(referenceLine);\n\n // A series' `color` override has to reach its gradient stops too, or a\n // gradient-filled chart would keep painting the `config` color.\n const colorFor = (key: string) =>\n areaSettings?.[key]?.color ?? `var(--color-${toCssKey(key)})`;\n\n // The plot inset is needed as soon as *any* series carries outside labels —\n // a per-series `showLabel` counts, not only the chart-wide `showLabels`.\n const hasLabels =\n showLabels ||\n Object.values(areaSettings ?? {}).some((settings) => settings.showLabel);\n\n // Axis titles: the X title sits below the ticks; the Y title is rotated in\n // the left gutter. Passed to recharts' native `label` (themed via the\n // `.recharts-label` fill selector on the container).\n const xAxisTitle = resolveXAxisTitle(xAxisLabel);\n const yAxisTitle = resolveYAxisTitle(yAxisLabel);\n\n const yDomain = resolveAxisDomain(yAxisDomain);\n\n const xAxisHeight = resolveXAxisHeight(xAxisLabel, xAxisAngle);\n\n const projStartIndex = React.useMemo(() => {\n if (projectionStart === undefined) return -1;\n return data.findIndex((row) => row[xKey] === projectionStart);\n }, [projectionStart, data, xKey]);\n // projStartIndex === 0 (boundary at the first tick) is excluded: there is no\n // \"previous tick\" to define the clip midpoint, so clipPath defs can't be\n // emitted, which would make all series invisible. Treat it as no-projection.\n const hasProjection = projStartIndex > 0;\n\n // Build the projection tick renderer when projectionStart is set. Each tick\n // past (and including) the start value renders in the disabled text color;\n // ticks before it stay in the muted-foreground color. Returns undefined when\n // projectionStart is absent or not found so recharts uses its own renderer.\n const projectionTick = React.useMemo(() => {\n if (!hasProjection) return undefined;\n const projectedValues = new Set(\n data.slice(projStartIndex).map((row) => row[xKey])\n );\n const ProjectionTick = ({\n payload,\n index,\n ...tickProps\n }: {\n payload: { value: string | number };\n index?: number;\n [key: string]: unknown;\n }) => (\n <Text\n {...(tickProps as React.ComponentProps<typeof Text>)}\n fontSize={12}\n className={\n projectedValues.has(payload.value)\n ? 'fill-[var(--ui-text-on-surface-disabled)]'\n : 'fill-muted-foreground'\n }\n >\n {xTickFormatter\n ? xTickFormatter(payload.value as never, index)\n : payload.value}\n </Text>\n );\n return ProjectionTick;\n }, [hasProjection, projStartIndex, data, xKey, xTickFormatter]);\n\n // When projection is active, copy each series value to `_proj_${key}` — same\n // data, no nulls. Both the actual and projection <Area> see the identical curve;\n // the clipPath (computed in ProjectionClip) restricts which half each paints.\n const chartData = React.useMemo(() => {\n if (!hasProjection) return data;\n return data.map((row) => ({\n ...row,\n ...Object.fromEntries(\n dataKeys.map((k) => [`_proj_${k}`, row[k]])\n ),\n }));\n }, [hasProjection, data, dataKeys]);\n\n // The tick immediately before the projection boundary — needed to compute the\n // visual midpoint where the clip edge and separator line are placed.\n const prevTickValue = React.useMemo(() => {\n if (projStartIndex <= 0) return undefined;\n return data[projStartIndex - 1]?.[xKey];\n }, [projStartIndex, data, xKey]);\n\n const projectionTooltip = React.useMemo(\n () =>\n hasProjection && tooltipContent\n ? createProjectionTooltip(tooltipContent)\n : undefined,\n [hasProjection, tooltipContent]\n );\n\n const tooltipNode = hasProjection\n ? (projectionTooltip ??\n ((tp: TooltipRenderProps) => (\n <ChartTooltipContent\n active={tp.active}\n label={tp.label}\n payload={\n dropProjectionPayload(\n tp.payload\n ) as ChartTooltipContentProps['payload']\n }\n />\n )))\n : (tooltipContent ?? <ChartTooltipContent />);\n\n const legendNode = hasProjection\n ? (lp: LegendContentProps) => (\n <ChartLegendContent\n verticalAlign={lp.verticalAlign}\n payload={\n dropProjectionPayload(\n lp.payload\n ) as ChartLegendContentProps['payload']\n }\n />\n )\n : <ChartLegendContent />;\n\n // recharts renders SVG <defs> once per chart; the gradient/clip ids must be\n // unique across chart instances on the page. useId gives a stable per-instance\n // id; strip the colons React emits (invalid in a url(#…) reference).\n const gradientId = `area-gradient-${React.useId().replace(/:/g, '')}`;\n const clipId = `area-proj-${React.useId().replace(/:/g, '')}`;\n\n return (\n <div\n ref={ref}\n data-layout={layout}\n data-fill={fill}\n className={cn(areaChartVariants({ layout, fill }), className)}\n {...props}\n >\n <ChartContainer\n config={config}\n palette={palette}\n className=\"size-full [&_.recharts-label]:fill-foreground\"\n >\n <RechartsAreaChart\n data={chartData as readonly unknown[]}\n margin={hasLabels ? CHART_LABEL_MARGIN : undefined}\n >\n {isGradient && (\n <AreaFillGradients\n dataKeys={dataKeys}\n gradientId={gradientId}\n colorFor={colorFor}\n />\n )}\n {showGrid && (\n <CartesianGrid\n horizontal={gridHorizontal ?? true}\n vertical={gridVertical ?? false}\n strokeDasharray={gridDashed ? '3 3' : undefined}\n />\n )}\n <XAxis\n dataKey={xKey}\n type=\"category\"\n hide={!showXAxis}\n tickLine={false}\n axisLine={false}\n tickMargin={8}\n tickFormatter={projectionTick ? undefined : xTickFormatter}\n tick={projectionTick}\n angle={xAxisAngle}\n interval={xAxisInterval}\n textAnchor={resolveRotatedTickAnchor(xAxisAngle)}\n height={xAxisHeight}\n label={xAxisTitle}\n />\n <YAxis\n type=\"number\"\n hide={!showYAxis}\n tickLine={false}\n axisLine={false}\n unit={yUnit}\n tickFormatter={yTickFormatter}\n tickCount={yAxisTickCount}\n domain={yDomain}\n width={yAxisLabel ? 72 : undefined}\n label={yAxisTitle}\n />\n {showTooltip && <ChartTooltip content={tooltipNode} />}\n {showLegend && <ChartLegend content={legendNode} />}\n {hasProjection && prevTickValue != null && (\n <ProjectionClip\n projectionStart={projectionStart!}\n prevTick={prevTickValue}\n clipId={clipId}\n />\n )}\n {dataKeys.map((key) => {\n const settings = areaSettings?.[key];\n const seriesDots = settings?.showDots ?? showDots;\n const dotRadius = settings?.dotSize ?? dotSize;\n // The hover dot follows the static dots unless asked otherwise, so\n // a chart that sets neither renders exactly as before.\n const activeDot = showActiveDot ?? seriesDots;\n const seriesLabel = settings?.showLabel ?? showLabels;\n const seriesLabelPosition =\n settings?.labelPosition ?? areaLabelPosition;\n return (\n <Area\n key={key}\n type={settings?.curveType ?? curve ?? 'monotone'}\n dataKey={key}\n stackId={isStacked ? 'a' : undefined}\n stroke={colorFor(key)}\n strokeWidth={settings?.strokeWidth ?? strokeWidth}\n strokeDasharray={settings?.dashed ? '5 5' : undefined}\n fill={\n isGradient ? `url(#${gradientId}-${toCssKey(key)})` : colorFor(key)\n }\n fillOpacity={\n settings?.fillOpacity ?? (isGradient ? 1 : fillOpacity)\n }\n dot={seriesDots ? { r: dotRadius } : false}\n activeDot={activeDot ? { r: dotRadius + 2 } : false}\n connectNulls={connectNulls}\n clipPath={hasProjection ? `url(#${clipId}-actual)` : undefined}\n {...animation}\n >\n {seriesLabel && (\n <LabelList\n dataKey={key}\n position={seriesLabelPosition}\n formatter={toLabelFormatter(labelFormatter)}\n className={resolveLabelFillClass(seriesLabelPosition, {\n translucentSeries: true,\n })}\n fontSize={CHART_LABEL_FONT_SIZE}\n />\n )}\n </Area>\n );\n })}\n {hasProjection &&\n dataKeys.map((key) => {\n const settings = areaSettings?.[key];\n return (\n <Area\n key={`_proj_${key}`}\n type={settings?.curveType ?? curve ?? 'monotone'}\n dataKey={`_proj_${key}`}\n name={key}\n stackId={isStacked ? 'proj' : undefined}\n stroke={colorFor(key)}\n strokeWidth={settings?.strokeWidth ?? strokeWidth}\n strokeDasharray=\"5 5\"\n fill={\n isGradient ? `url(#${gradientId}-${toCssKey(key)})` : colorFor(key)\n }\n fillOpacity={\n settings?.fillOpacity ?? (isGradient ? 1 : fillOpacity)\n }\n dot={false}\n activeDot={false}\n clipPath={`url(#${clipId}-projection)`}\n legendType=\"none\"\n tooltipType=\"none\"\n {...animation}\n />\n );\n })}\n {/* Annotations draw over the series they describe. */}\n {referenceLines.map((ref, index) => {\n const value = resolveChartReferenceValue(ref, data, dataKeys);\n if (value === undefined) return null;\n return (\n <ReferenceLine\n key={`${ref.label ?? 'ref'}-${index}`}\n y={value}\n {...resolveReferenceLineProps(ref.label, ref.labelPosition)}\n />\n );\n })}\n {showBrush && (\n <Brush\n dataKey={xKey}\n tickFormatter={xTickFormatter}\n {...resolveBrushProps({ brushHeight, brushAriaLabel })}\n />\n )}\n </RechartsAreaChart>\n </ChartContainer>\n </div>\n );\n }\n);\nAreaChart.displayName = 'AreaChart';\n\nexport { AreaChart, areaChartVariants };\n"],"mappings":";;;;;;;;;AAgEA,IAAM,IAAoB,EAAI,IAAI;CAChC,UAAU;EACR,QAAQ;GACN,QAAQ;GACR,SAAS;EACX;EACA,MAAM;GACJ,OAAO;GACP,UAAU;EACZ;CACF;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;MACT,eAAe;MACf,GAAI,GAAkB;OAAE;OAAa;MAAe,CAAC;KACtD,CAAA;IAEc;;EACL,CAAA;CACb,CAAA;AAET,CACF;AACA,EAAU,cAAc"}
|
|
1
|
+
{"version":3,"file":"area-chart.js","names":[],"sources":["../../../../src/components/ui/area-chart/area-chart.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport {\n Area,\n AreaChart as RechartsAreaChart,\n Brush,\n CartesianGrid,\n LabelList,\n ReferenceLine,\n Text,\n XAxis,\n YAxis,\n useXAxisScale,\n usePlotArea,\n} from 'recharts';\n\nimport { cn } from '@/lib/utils';\nimport {\n CHART_LABEL_FONT_SIZE,\n CHART_LABEL_MARGIN,\n ChartContainer,\n ChartLegend,\n ChartLegendContent,\n ChartTooltip,\n ChartTooltipContent,\n resolveAnimation,\n resolveAxisDomain,\n resolveBrushProps,\n resolveCartesianLabelPosition,\n dropProjectionPayload,\n resolveChartReferenceValue,\n resolveLabelFillClass,\n resolveReferenceLineProps,\n resolveRotatedTickAnchor,\n resolveXAxisTitle,\n resolveYAxisTitle,\n toLabelFormatter,\n toReferenceLineList,\n type ChartConfig,\n type ChartPalette,\n type ChartLegendContentProps,\n type ChartTooltipContentProps,\n type CartesianChartProps,\n type ChartAnimationProps,\n type ChartBrushProps,\n type ChartCurveType,\n type ChartDataLabelProps,\n type ChartReferenceLine,\n toCssKey,\n type CartesianLabelPosition,\n} from '../chart';\nimport {\n mergeXAxisLayoutMargin,\n useXAxisLayout,\n} from '../chart/use-x-axis-layout';\nimport { resolveXAxisTickLabels } from '../chart/chart-format';\n\n// A typed recharts composition over the shared `Chart` primitives. The two CVA\n// axes are the design's Area-chart variant set: `layout` (independent\n// overlapping areas vs summed on a shared stack) and `fill` (a flat translucent\n// fill vs a vertical gradient). The classes stay empty because recharts' SVG —\n// not CSS — draws the areas: `layout` drives each `<Area>`'s `stackId` and `fill`\n// drives whether it paints from a `<linearGradient>` def or a flat token color.\n// CVA is kept so the variant set is a first-class, spec-conformant part of the\n// API (matched against ui-spec's api.yaml enums) and exposed via `VariantProps`;\n// the resolved values are also mirrored onto `data-layout` / `data-fill`.\nconst areaChartVariants = cva('', {\n variants: {\n layout: {\n single: '',\n stacked: '',\n },\n fill: {\n solid: '',\n gradient: '',\n },\n },\n defaultVariants: {\n layout: 'single',\n fill: 'solid',\n },\n});\n\n/**\n * Style override for one series, keyed by its `dataKeys` entry. Anything left\n * unset falls back to the chart-wide prop, so an entry only states what differs\n * — e.g. a projection band that reads fainter than the actuals beside it.\n */\nexport interface AreaChartAreaSettings {\n /** Stroke and fill color. Defaults to the series' `config` color. */\n color?: string;\n /** Width of this series' top border. Defaults to the chart's `strokeWidth`. */\n strokeWidth?: number;\n /** Dash this series' top border. */\n dashed?: boolean;\n /** Interpolation for this series only. Defaults to the chart's `curve`. */\n curveType?: ChartCurveType;\n /**\n * Fill opacity for this series. Under `fill=\"gradient\"` it scales the\n * gradient's own alpha rather than replacing it.\n */\n fillOpacity?: number;\n /** Render this series' per-point dots. Defaults to the chart's `showDots`. */\n showDots?: boolean;\n /** Dot radius for this series, in px. Defaults to the chart's `dotSize`. */\n dotSize?: number;\n /** Show/hide this series' value labels, overriding the chart's `showLabels`. */\n showLabel?: boolean;\n /** Position of this series' value labels. Defaults to the chart's `labelPosition`. */\n labelPosition?: CartesianLabelPosition;\n}\n\nexport interface AreaChartProps\n extends Omit<React.ComponentProps<'div'>, 'children'>,\n VariantProps<typeof areaChartVariants>,\n CartesianChartProps,\n ChartAnimationProps,\n ChartBrushProps,\n ChartDataLabelProps {\n /**\n * The dataviz palette this chart's series are painted from. Series that\n * state no `color` of their own take a stop of it. See `ChartPalette`.\n */\n palette?: ChartPalette;\n /** Row-per-point data. Each object holds the category key + one numeric field per series (`null` breaks the area unless `connectNulls`). */\n data: ReadonlyArray<Record<string, string | number | null>>;\n /**\n * Per-series map of `label` / `icon` / `tone` (from the shared `Chart`\n * primitives). Series take their colour from the container's `palette`; each\n * entry maps a key to a `label` and an optional `tone`.\n */\n config: ChartConfig;\n /** Series to plot — one `<Area>` per key. Each must exist in `config` and in every data row. */\n dataKeys: string[];\n /** Category axis key (the shared dimension across rows, e.g. `\"month\"`). */\n xKey: string;\n /** Interpolation between points. */\n curve?: ChartCurveType;\n /** Stroke width of each area's top border. */\n strokeWidth?: number;\n /** Flat-fill opacity — used only when `fill=\"solid\"` (gradient controls its own stops). */\n fillOpacity?: number;\n /** Render a dot at each data point. */\n showDots?: boolean;\n /** Radius of each point's dot, in px. Its hover dot is 2px larger. */\n dotSize?: number;\n /**\n * Enlarge the hovered point's dot. Defaults to following `showDots`, so pass\n * it explicitly to get hover dots on a dot-less area (`showDots={false}` with\n * `showActiveDot`) or a static-only area (dots without the hover one).\n */\n showActiveDot?: boolean;\n /** Bridge `null` gaps in the data instead of breaking the area. */\n connectNulls?: boolean;\n /**\n * Per-series style overrides, keyed by `dataKeys` entry. Series with no entry\n * render from the chart-wide props.\n */\n areaSettings?: Record<string, AreaChartAreaSettings>;\n /**\n * One or more dashed reference/average lines on the value axis — a target, a\n * threshold, or a series mean. Pass a single object or an array to draw\n * several at once. On a stacked chart the value is read against the stack's\n * axis, not one series.\n */\n referenceLine?: ChartReferenceLine | ChartReferenceLine[];\n /**\n * The category value (matching an `xKey` entry) at which the projection\n * zone starts. Ticks from this point onward render in the disabled text\n * color (`--ui-text-on-surface-disabled`). The chart data and series\n * themselves are not affected — only the X-axis tick appearance changes.\n *\n * Use this when displaying a forecast/projection range where future\n * data points should be visually de-emphasized on the axis.\n */\n projectionStart?: string | number;\n showLegend?: boolean;\n /** Position of the value labels when `showLabels` is on. Defaults to `top`. */\n labelPosition?: CartesianLabelPosition;\n}\n\ntype TooltipContentType = NonNullable<React.ComponentProps<typeof ChartTooltip>['content']>;\ntype TooltipContentFn = Extract<TooltipContentType, (...args: never[]) => unknown>;\ntype TooltipRenderProps = Parameters<TooltipContentFn>[0];\ntype LegendContentFn = Extract<\n React.ComponentProps<typeof ChartLegend>['content'],\n (...args: never[]) => unknown\n>;\ntype LegendContentProps = Parameters<LegendContentFn>[0];\n\nfunction createProjectionTooltip(tooltipContent: TooltipContentType) {\n return function ProjectionTooltip(props: TooltipRenderProps) {\n const merged = {\n ...props,\n payload: dropProjectionPayload(props.payload),\n } as TooltipRenderProps;\n if (typeof tooltipContent === 'function') {\n const Comp = tooltipContent as React.FunctionComponent<TooltipRenderProps>;\n return <Comp {...merged} />;\n }\n // Element-form tooltip: cloneElement is the React-idiomatic way to\n // re-render an existing element with new props (preserves refs & keys).\n return React.cloneElement(tooltipContent, merged);\n };\n}\n\n// Renders two <clipPath> defs (actual / projection) and a dashed separator\n// line at the visual midpoint between the last actual tick and the first\n// projection tick. Both the actual and projection <Area> series reference\n// these clip regions, so the exact same curve renders on each side — no kink.\nfunction ProjectionClip({\n projectionStart,\n prevTick,\n clipId,\n}: {\n projectionStart: string | number;\n prevTick: string | number;\n clipId: string;\n}) {\n const xScale = useXAxisScale();\n const plotArea = usePlotArea();\n if (!xScale || !plotArea) return null;\n const prevX = xScale(prevTick as string);\n const currX = xScale(projectionStart as string);\n if (prevX == null || currX == null) return null;\n const midX = (prevX + currX) / 2;\n const { x, y, width, height } = plotArea;\n return (\n <>\n <defs>\n <clipPath id={`${clipId}-actual`}>\n <rect x={x} y={y} width={midX - x} height={height} />\n </clipPath>\n <clipPath id={`${clipId}-projection`}>\n <rect x={midX} y={y} width={x + width - midX} height={height} />\n </clipPath>\n </defs>\n <line\n x1={midX}\n y1={y}\n x2={midX}\n y2={y + height}\n stroke=\"var(--ui-border-on-surface-border)\"\n strokeDasharray=\"4 4\"\n />\n </>\n );\n}\n\n/**\n * One top-to-bottom fade per series, referenced by each `<Area>`'s `fill`.\n *\n * The ids are scoped by `gradientId` because SVG `<defs>` ids are\n * document-global: two AreaCharts on the same page would otherwise share (and\n * silently overwrite) each other's stops.\n */\nfunction AreaFillGradients({\n dataKeys,\n gradientId,\n colorFor,\n}: {\n dataKeys: string[];\n gradientId: string;\n colorFor: (key: string) => string;\n}) {\n return (\n <defs>\n {dataKeys.map((key) => (\n <linearGradient\n key={key}\n id={`${gradientId}-${toCssKey(key)}`}\n x1=\"0\"\n y1=\"0\"\n x2=\"0\"\n y2=\"1\"\n >\n <stop offset=\"5%\" stopColor={colorFor(key)} stopOpacity={0.8} />\n <stop offset=\"95%\" stopColor={colorFor(key)} stopOpacity={0.1} />\n </linearGradient>\n ))}\n </defs>\n );\n}\n\nconst AreaChart = React.forwardRef<HTMLDivElement, AreaChartProps>(\n (\n {\n className,\n config,\n palette,\n data,\n dataKeys,\n xKey,\n xAxisLabel,\n yAxisLabel,\n yUnit,\n layout = 'single',\n fill = 'solid',\n curve = 'monotone',\n strokeWidth = 2,\n fillOpacity = 0.4,\n showDots = false,\n dotSize = 3,\n showActiveDot,\n connectNulls = false,\n areaSettings,\n referenceLine,\n projectionStart,\n showGrid = true,\n showTooltip = true,\n showLegend = true,\n showXAxis = true,\n showYAxis = true,\n xTickFormatter,\n yTickFormatter,\n xAxisAngle,\n xAxisInterval,\n yAxisTickCount,\n yAxisDomain,\n gridDashed,\n gridHorizontal,\n gridVertical,\n tooltipContent,\n animate,\n animationDuration,\n animationBegin,\n animationEasing,\n showLabels = false,\n labelPosition,\n labelFormatter,\n showBrush = false,\n brushHeight,\n brushAriaLabel,\n ...props\n },\n ref\n ) => {\n const animation = resolveAnimation({\n animate,\n animationDuration,\n animationBegin,\n animationEasing,\n });\n const isStacked = layout === 'stacked';\n const areaLabelPosition = resolveCartesianLabelPosition({\n labelPosition,\n isStacked,\n });\n const isGradient = fill === 'gradient';\n const referenceLines = toReferenceLineList(referenceLine);\n\n // A series' `color` override has to reach its gradient stops too, or a\n // gradient-filled chart would keep painting the `config` color.\n const colorFor = (key: string) =>\n areaSettings?.[key]?.color ?? `var(--color-${toCssKey(key)})`;\n\n // The plot inset is needed as soon as *any* series carries outside labels —\n // a per-series `showLabel` counts, not only the chart-wide `showLabels`.\n const hasLabels =\n showLabels ||\n Object.values(areaSettings ?? {}).some((settings) => settings.showLabel);\n\n // Axis titles: the X title sits below the ticks; the Y title is rotated in\n // the left gutter. Passed to recharts' native `label` (themed via the\n // `.recharts-label` fill selector on the container).\n const xAxisTitle = resolveXAxisTitle(xAxisLabel);\n const yAxisTitle = resolveYAxisTitle(yAxisLabel);\n\n const yDomain = resolveAxisDomain(yAxisDomain);\n\n const xAxisTickLabels = resolveXAxisTickLabels(\n data.map((row) => row[xKey]),\n xTickFormatter\n );\n const chartContainerRef = React.useRef<HTMLDivElement>(null);\n const xAxisLayout = useXAxisLayout(\n chartContainerRef,\n xAxisAngle,\n xAxisLabel,\n xAxisTickLabels.join('\\u0000')\n );\n const chartMargin = mergeXAxisLayoutMargin(\n hasLabels ? CHART_LABEL_MARGIN : undefined,\n xAxisLayout.margin\n );\n\n const projStartIndex = React.useMemo(() => {\n if (projectionStart === undefined) return -1;\n return data.findIndex((row) => row[xKey] === projectionStart);\n }, [projectionStart, data, xKey]);\n // projStartIndex === 0 (boundary at the first tick) is excluded: there is no\n // \"previous tick\" to define the clip midpoint, so clipPath defs can't be\n // emitted, which would make all series invisible. Treat it as no-projection.\n const hasProjection = projStartIndex > 0;\n\n // Build the projection tick renderer when projectionStart is set. Each tick\n // past (and including) the start value renders in the disabled text color;\n // ticks before it stay in the muted-foreground color. Returns undefined when\n // projectionStart is absent or not found so recharts uses its own renderer.\n const projectionTick = React.useMemo(() => {\n if (!hasProjection) return undefined;\n const projectedValues = new Set(\n data.slice(projStartIndex).map((row) => row[xKey])\n );\n const ProjectionTick = ({\n payload,\n index,\n ...tickProps\n }: {\n payload: { value: string | number };\n index?: number;\n [key: string]: unknown;\n }) => (\n <Text\n {...(tickProps as React.ComponentProps<typeof Text>)}\n fontSize={12}\n className={\n projectedValues.has(payload.value)\n ? 'fill-[var(--ui-text-on-surface-disabled)]'\n : 'fill-muted-foreground'\n }\n >\n {xTickFormatter\n ? xTickFormatter(payload.value as never, index)\n : payload.value}\n </Text>\n );\n return ProjectionTick;\n }, [hasProjection, projStartIndex, data, xKey, xTickFormatter]);\n\n // When projection is active, copy each series value to `_proj_${key}` — same\n // data, no nulls. Both the actual and projection <Area> see the identical curve;\n // the clipPath (computed in ProjectionClip) restricts which half each paints.\n const chartData = React.useMemo(() => {\n if (!hasProjection) return data;\n return data.map((row) => ({\n ...row,\n ...Object.fromEntries(\n dataKeys.map((k) => [`_proj_${k}`, row[k]])\n ),\n }));\n }, [hasProjection, data, dataKeys]);\n\n // The tick immediately before the projection boundary — needed to compute the\n // visual midpoint where the clip edge and separator line are placed.\n const prevTickValue = React.useMemo(() => {\n if (projStartIndex <= 0) return undefined;\n return data[projStartIndex - 1]?.[xKey];\n }, [projStartIndex, data, xKey]);\n\n const projectionTooltip = React.useMemo(\n () =>\n hasProjection && tooltipContent\n ? createProjectionTooltip(tooltipContent)\n : undefined,\n [hasProjection, tooltipContent]\n );\n\n const tooltipNode = hasProjection\n ? (projectionTooltip ??\n ((tp: TooltipRenderProps) => (\n <ChartTooltipContent\n active={tp.active}\n label={tp.label}\n payload={\n dropProjectionPayload(\n tp.payload\n ) as ChartTooltipContentProps['payload']\n }\n />\n )))\n : (tooltipContent ?? <ChartTooltipContent />);\n\n const legendNode = hasProjection\n ? (lp: LegendContentProps) => (\n <ChartLegendContent\n verticalAlign={lp.verticalAlign}\n payload={\n dropProjectionPayload(\n lp.payload\n ) as ChartLegendContentProps['payload']\n }\n />\n )\n : <ChartLegendContent />;\n\n // recharts renders SVG <defs> once per chart; the gradient/clip ids must be\n // unique across chart instances on the page. useId gives a stable per-instance\n // id; strip the colons React emits (invalid in a url(#…) reference).\n const gradientId = `area-gradient-${React.useId().replace(/:/g, '')}`;\n const clipId = `area-proj-${React.useId().replace(/:/g, '')}`;\n\n return (\n <div\n ref={ref}\n data-layout={layout}\n data-fill={fill}\n className={cn(areaChartVariants({ layout, fill }), className)}\n {...props}\n >\n <ChartContainer\n ref={chartContainerRef}\n config={config}\n palette={palette}\n className=\"size-full [&_.recharts-label]:fill-foreground\"\n >\n <RechartsAreaChart\n data={chartData as readonly unknown[]}\n margin={chartMargin}\n >\n {isGradient && (\n <AreaFillGradients\n dataKeys={dataKeys}\n gradientId={gradientId}\n colorFor={colorFor}\n />\n )}\n {showGrid && (\n <CartesianGrid\n horizontal={gridHorizontal ?? true}\n vertical={gridVertical ?? false}\n strokeDasharray={gridDashed ? '3 3' : undefined}\n />\n )}\n <XAxis\n dataKey={xKey}\n type=\"category\"\n hide={!showXAxis}\n tickLine={false}\n axisLine={false}\n tickMargin={8}\n tickFormatter={projectionTick ? undefined : xTickFormatter}\n tick={projectionTick}\n angle={xAxisAngle}\n interval={xAxisInterval}\n textAnchor={resolveRotatedTickAnchor(xAxisAngle)}\n height={xAxisLayout.height}\n label={xAxisTitle}\n />\n <YAxis\n type=\"number\"\n hide={!showYAxis}\n tickLine={false}\n axisLine={false}\n unit={yUnit}\n tickFormatter={yTickFormatter}\n tickCount={yAxisTickCount}\n domain={yDomain}\n width={yAxisLabel ? 72 : undefined}\n label={yAxisTitle}\n />\n {showTooltip && <ChartTooltip content={tooltipNode} />}\n {showLegend && <ChartLegend content={legendNode} />}\n {hasProjection && prevTickValue != null && (\n <ProjectionClip\n projectionStart={projectionStart!}\n prevTick={prevTickValue}\n clipId={clipId}\n />\n )}\n {dataKeys.map((key) => {\n const settings = areaSettings?.[key];\n const seriesDots = settings?.showDots ?? showDots;\n const dotRadius = settings?.dotSize ?? dotSize;\n // The hover dot follows the static dots unless asked otherwise, so\n // a chart that sets neither renders exactly as before.\n const activeDot = showActiveDot ?? seriesDots;\n const seriesLabel = settings?.showLabel ?? showLabels;\n const seriesLabelPosition =\n settings?.labelPosition ?? areaLabelPosition;\n return (\n <Area\n key={key}\n type={settings?.curveType ?? curve ?? 'monotone'}\n dataKey={key}\n stackId={isStacked ? 'a' : undefined}\n stroke={colorFor(key)}\n strokeWidth={settings?.strokeWidth ?? strokeWidth}\n strokeDasharray={settings?.dashed ? '5 5' : undefined}\n fill={\n isGradient ? `url(#${gradientId}-${toCssKey(key)})` : colorFor(key)\n }\n fillOpacity={\n settings?.fillOpacity ?? (isGradient ? 1 : fillOpacity)\n }\n dot={seriesDots ? { r: dotRadius } : false}\n activeDot={activeDot ? { r: dotRadius + 2 } : false}\n connectNulls={connectNulls}\n clipPath={hasProjection ? `url(#${clipId}-actual)` : undefined}\n {...animation}\n >\n {seriesLabel && (\n <LabelList\n dataKey={key}\n position={seriesLabelPosition}\n formatter={toLabelFormatter(labelFormatter)}\n className={resolveLabelFillClass(seriesLabelPosition, {\n translucentSeries: true,\n })}\n fontSize={CHART_LABEL_FONT_SIZE}\n />\n )}\n </Area>\n );\n })}\n {hasProjection &&\n dataKeys.map((key) => {\n const settings = areaSettings?.[key];\n return (\n <Area\n key={`_proj_${key}`}\n type={settings?.curveType ?? curve ?? 'monotone'}\n dataKey={`_proj_${key}`}\n name={key}\n stackId={isStacked ? 'proj' : undefined}\n stroke={colorFor(key)}\n strokeWidth={settings?.strokeWidth ?? strokeWidth}\n strokeDasharray=\"5 5\"\n fill={\n isGradient ? `url(#${gradientId}-${toCssKey(key)})` : colorFor(key)\n }\n fillOpacity={\n settings?.fillOpacity ?? (isGradient ? 1 : fillOpacity)\n }\n dot={false}\n activeDot={false}\n clipPath={`url(#${clipId}-projection)`}\n legendType=\"none\"\n tooltipType=\"none\"\n {...animation}\n />\n );\n })}\n {/* Annotations draw over the series they describe. */}\n {referenceLines.map((ref, index) => {\n const value = resolveChartReferenceValue(ref, data, dataKeys);\n if (value === undefined) return null;\n return (\n <ReferenceLine\n key={`${ref.label ?? 'ref'}-${index}`}\n y={value}\n {...resolveReferenceLineProps(ref.label, ref.labelPosition)}\n />\n );\n })}\n {showBrush && (\n <Brush\n dataKey={xKey}\n tickFormatter={xTickFormatter}\n {...resolveBrushProps({ brushHeight, brushAriaLabel })}\n />\n )}\n </RechartsAreaChart>\n </ChartContainer>\n </div>\n );\n }\n);\nAreaChart.displayName = 'AreaChart';\n\nexport { AreaChart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