@acronis-platform/ui-react 0.60.0 → 0.62.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.
Files changed (99) hide show
  1. package/README.md +5 -5
  2. package/dist/components/ui/app-shell/app-shell.js.map +1 -1
  3. package/dist/components/ui/area-chart/area-chart.js +209 -146
  4. package/dist/components/ui/area-chart/area-chart.js.map +1 -1
  5. package/dist/components/ui/avatar/avatar.js +26 -23
  6. package/dist/components/ui/avatar/avatar.js.map +1 -1
  7. package/dist/components/ui/bar-chart/bar-chart.js +595 -180
  8. package/dist/components/ui/bar-chart/bar-chart.js.map +1 -1
  9. package/dist/components/ui/calendar-panel/calendar-panel-utils.js +63 -0
  10. package/dist/components/ui/calendar-panel/calendar-panel-utils.js.map +1 -0
  11. package/dist/components/ui/calendar-panel/calendar-panel.js +260 -0
  12. package/dist/components/ui/calendar-panel/calendar-panel.js.map +1 -0
  13. package/dist/components/ui/category-bar/category-bar.js +98 -77
  14. package/dist/components/ui/category-bar/category-bar.js.map +1 -1
  15. package/dist/components/ui/chart/chart-format.js +144 -14
  16. package/dist/components/ui/chart/chart-format.js.map +1 -1
  17. package/dist/components/ui/chart/chart.js +204 -150
  18. package/dist/components/ui/chart/chart.js.map +1 -1
  19. package/dist/components/ui/composed-chart/composed-chart.js +422 -125
  20. package/dist/components/ui/composed-chart/composed-chart.js.map +1 -1
  21. package/dist/components/ui/confidence-cone/confidence-cone.js +308 -202
  22. package/dist/components/ui/confidence-cone/confidence-cone.js.map +1 -1
  23. package/dist/components/ui/filter-cards/filter-cards.js +25 -0
  24. package/dist/components/ui/filter-cards/filter-cards.js.map +1 -0
  25. package/dist/components/ui/funnel-chart/funnel-chart.js +245 -51
  26. package/dist/components/ui/funnel-chart/funnel-chart.js.map +1 -1
  27. package/dist/components/ui/histogram/histogram.js +85 -81
  28. package/dist/components/ui/histogram/histogram.js.map +1 -1
  29. package/dist/components/ui/line-chart/line-chart.js +227 -184
  30. package/dist/components/ui/line-chart/line-chart.js.map +1 -1
  31. package/dist/components/ui/metric/metric.js +88 -70
  32. package/dist/components/ui/metric/metric.js.map +1 -1
  33. package/dist/components/ui/pie-chart/pie-chart.js +234 -80
  34. package/dist/components/ui/pie-chart/pie-chart.js.map +1 -1
  35. package/dist/components/ui/radar-chart/radar-chart.js +210 -57
  36. package/dist/components/ui/radar-chart/radar-chart.js.map +1 -1
  37. package/dist/components/ui/radial-bar-chart/radial-bar-chart.js +358 -50
  38. package/dist/components/ui/radial-bar-chart/radial-bar-chart.js.map +1 -1
  39. package/dist/components/ui/resizable/resizable.js +23 -11
  40. package/dist/components/ui/resizable/resizable.js.map +1 -1
  41. package/dist/components/ui/sankey-chart/sankey-chart.js +25 -18
  42. package/dist/components/ui/sankey-chart/sankey-chart.js.map +1 -1
  43. package/dist/components/ui/scatter-chart/scatter-chart.js +86 -78
  44. package/dist/components/ui/scatter-chart/scatter-chart.js.map +1 -1
  45. package/dist/components/ui/sidebar-secondary/sidebar-secondary.js.map +1 -1
  46. package/dist/components/ui/timeline/timeline.js +206 -142
  47. package/dist/components/ui/timeline/timeline.js.map +1 -1
  48. package/dist/components/ui/treemap/treemap.js +183 -59
  49. package/dist/components/ui/treemap/treemap.js.map +1 -1
  50. package/dist/index.js +446 -420
  51. package/dist/index.js.map +1 -1
  52. package/dist/node_modules/.pnpm/react-day-picker@10.0.1_@types_react@19.2.15_react@19.2.6/node_modules/react-day-picker/dist/esm/useDayPicker.js +3 -3
  53. package/dist/react.js +446 -420
  54. package/dist/react.js.map +1 -1
  55. package/dist/src/components/ui/area-chart/area-chart.d.ts +53 -3
  56. package/dist/src/components/ui/area-chart/index.d.ts +1 -1
  57. package/dist/src/components/ui/avatar/avatar.d.ts +1 -1
  58. package/dist/src/components/ui/bar-chart/bar-chart.d.ts +154 -16
  59. package/dist/src/components/ui/bar-chart/index.d.ts +1 -1
  60. package/dist/src/components/ui/button/button.d.ts +1 -1
  61. package/dist/src/components/ui/button-menu/button-menu.d.ts +1 -1
  62. package/dist/src/components/ui/calendar-panel/__tests__/calendar-panel-utils.test.d.ts +1 -0
  63. package/dist/src/components/ui/calendar-panel/calendar-panel-utils.d.ts +55 -0
  64. package/dist/src/components/ui/calendar-panel/calendar-panel.d.ts +112 -0
  65. package/dist/src/components/ui/calendar-panel/index.d.ts +1 -0
  66. package/dist/src/components/ui/chart/__tests__/chart-layout.d.ts +63 -0
  67. package/dist/src/components/ui/chart/__tests__/chart-layout.test.d.ts +1 -0
  68. package/dist/src/components/ui/chart/chart-format.d.ts +415 -0
  69. package/dist/src/components/ui/chart/chart.d.ts +9 -3
  70. package/dist/src/components/ui/chart/index.d.ts +2 -2
  71. package/dist/src/components/ui/composed-chart/composed-chart.d.ts +156 -7
  72. package/dist/src/components/ui/composed-chart/index.d.ts +1 -1
  73. package/dist/src/components/ui/confidence-cone/confidence-cone.d.ts +138 -20
  74. package/dist/src/components/ui/confidence-cone/index.d.ts +1 -1
  75. package/dist/src/components/ui/filter-cards/filter-cards.d.ts +11 -0
  76. package/dist/src/components/ui/filter-cards/index.d.ts +1 -0
  77. package/dist/src/components/ui/funnel-chart/funnel-chart.d.ts +201 -3
  78. package/dist/src/components/ui/funnel-chart/index.d.ts +1 -1
  79. package/dist/src/components/ui/histogram/histogram.d.ts +2 -2
  80. package/dist/src/components/ui/line-chart/index.d.ts +1 -1
  81. package/dist/src/components/ui/line-chart/line-chart.d.ts +51 -3
  82. package/dist/src/components/ui/pie-chart/index.d.ts +1 -1
  83. package/dist/src/components/ui/pie-chart/pie-chart.d.ts +145 -4
  84. package/dist/src/components/ui/radar-chart/index.d.ts +1 -1
  85. package/dist/src/components/ui/radar-chart/radar-chart.d.ts +219 -6
  86. package/dist/src/components/ui/radial-bar-chart/index.d.ts +1 -1
  87. package/dist/src/components/ui/radial-bar-chart/radial-bar-chart.d.ts +215 -9
  88. package/dist/src/components/ui/scatter-chart/scatter-chart.d.ts +2 -2
  89. package/dist/src/components/ui/timeline/index.d.ts +1 -1
  90. package/dist/src/components/ui/timeline/timeline.d.ts +79 -20
  91. package/dist/src/components/ui/treemap/index.d.ts +1 -1
  92. package/dist/src/components/ui/treemap/treemap.d.ts +68 -8
  93. package/dist/src/index.d.ts +2 -1
  94. package/dist/ui-react.css +1 -1
  95. package/package.json +2 -2
  96. package/dist/components/ui/search-global/search-global.js +0 -60
  97. package/dist/components/ui/search-global/search-global.js.map +0 -1
  98. package/dist/src/components/ui/search-global/index.d.ts +0 -1
  99. package/dist/src/components/ui/search-global/search-global.d.ts +0 -7
@@ -1,223 +1,329 @@
1
- import { jsx as e, jsxs as U } from "react/jsx-runtime";
2
- import * as f from "react";
3
- import { ComposedChart as V, CartesianGrid as Z, XAxis as K, YAxis as W, ReferenceArea as ee, ReferenceLine as te, Area as b, Line as oe } from "recharts";
4
- import { cn as ne } from "../../../lib/utils.js";
5
- import { ChartContainer as re, ChartTooltip as N, ChartTooltipContent as ie, ChartLegend as ae, ChartLegendContent as le } from "../chart/chart.js";
6
- import { resolveAxisDomain as ce } from "../chart/chart-format.js";
7
- const m = "__cone";
8
- function v(o) {
9
- return o == null ? void 0 : o.filter((l) => l.dataKey !== m);
1
+ import { jsx as r, jsxs as x, Fragment as E } from "react/jsx-runtime";
2
+ import * as m from "react";
3
+ import { ComposedChart as Fe, CartesianGrid as Ke, Text as Re, XAxis as Le, YAxis as Ne, ReferenceArea as Me, ReferenceLine as B, Area as z, Line as H } from "recharts";
4
+ import { cn as Oe } from "../../../lib/utils.js";
5
+ import { resolveAnimation as Xe, resolveRotatedTickAnchor as _e, CHART_LABEL_FONT_SIZE as Se, resolveXAxisTitle as Ee, resolveXAxisHeight as Be, resolveYAxisTitle as ze, resolveAxisDomain as He } from "../chart/chart-format.js";
6
+ import { ChartContainer as je, ChartTooltip as j, ChartTooltipContent as we, ChartLegend as Ie, ChartLegendContent as Pe } from "../chart/chart.js";
7
+ const w = "__cone", A = (t) => `${w}:${t}`;
8
+ function I(t) {
9
+ return t == null ? void 0 : t.filter(
10
+ (o) => !(typeof o.dataKey == "string" && o.dataKey.startsWith(w))
11
+ );
10
12
  }
11
- function se(o) {
13
+ function We(t, o) {
14
+ return t == null ? void 0 : t.filter(
15
+ (n) => typeof n.dataKey == "string" && o.includes(n.dataKey)
16
+ );
17
+ }
18
+ function Ye(t) {
12
19
  return function(n) {
13
- const r = {
20
+ const l = {
14
21
  ...n,
15
- payload: v(n.payload)
22
+ payload: I(n.payload)
16
23
  };
17
- return typeof o == "function" ? f.createElement(
18
- o,
19
- r
20
- ) : f.cloneElement(o, r);
24
+ return typeof t == "function" ? m.createElement(
25
+ t,
26
+ l
27
+ ) : m.cloneElement(t, l);
28
+ };
29
+ }
30
+ function Ge(t, o, n) {
31
+ return t.filter((l) => o.some(({ forecastKey: c }) => typeof l[c] == "number")).map((l) => l[n]);
32
+ }
33
+ function Ze(t, o, n) {
34
+ return function({
35
+ payload: c,
36
+ index: v,
37
+ ...y
38
+ }) {
39
+ const f = c == null ? void 0 : c.value;
40
+ return /* @__PURE__ */ r(
41
+ Re,
42
+ {
43
+ ...y,
44
+ style: f != null && t.has(f) ? { fontStyle: "italic", fill: o } : void 0,
45
+ children: n && f != null ? n(f, v) : f
46
+ }
47
+ );
21
48
  };
22
49
  }
23
- const fe = f.forwardRef(
50
+ const qe = m.forwardRef(
24
51
  ({
25
- className: o,
26
- config: l,
52
+ className: t,
53
+ config: o,
27
54
  data: n,
28
- xKey: r,
29
- actualKey: i,
30
- forecastKey: p,
31
- lowerKey: A,
32
- upperKey: L,
33
- xAxisLabel: c,
34
- yAxisLabel: d,
35
- yUnit: O,
36
- strokeWidth: h = 2,
37
- showForecastRegion: R = !0,
38
- showGrid: _ = !0,
39
- showTooltip: $ = !0,
40
- showLegend: B = !0,
41
- showXAxis: E = !0,
42
- showYAxis: j = !0,
43
- xTickFormatter: w,
44
- yTickFormatter: z,
45
- xAxisAngle: a,
46
- xAxisInterval: F,
47
- yAxisTickCount: M,
48
- yAxisDomain: X,
49
- gridDashed: Y,
50
- gridHorizontal: x,
51
- gridVertical: G,
52
- tooltipContent: u,
53
- ...H
54
- }, S) => {
55
- var k, g;
56
- const y = f.useMemo(
57
- () => u ? se(u) : void 0,
58
- [u]
59
- ), q = c ? { value: c, position: "insideBottom", offset: 0 } : void 0, I = d ? {
60
- value: d,
61
- angle: -90,
62
- position: "insideLeft",
63
- style: { textAnchor: "middle" }
64
- } : void 0, J = ce(X), P = c || a != null ? 30 + (a != null ? 20 : 0) + (c ? 18 : 0) : void 0, Q = n.map((t) => {
65
- const D = t[A], T = t[L];
66
- return {
67
- ...t,
68
- [m]: typeof D == "number" && typeof T == "number" ? [D, T] : void 0
69
- };
70
- }), s = R ? (k = n.find((t) => typeof t[p] == "number")) == null ? void 0 : k[r] : void 0, C = (g = n[n.length - 1]) == null ? void 0 : g[r];
71
- return /* @__PURE__ */ e("div", { ref: S, className: ne(o), ...H, children: /* @__PURE__ */ e(
72
- re,
55
+ xKey: l,
56
+ series: c,
57
+ actualKey: v,
58
+ forecastKey: y,
59
+ lowerKey: f,
60
+ upperKey: C,
61
+ xAxisLabel: $,
62
+ yAxisLabel: D,
63
+ yUnit: P,
64
+ actualType: F = "area",
65
+ strokeWidth: K = 2,
66
+ showDots: p = !1,
67
+ styleForecastTicks: W = !1,
68
+ referenceLine: h,
69
+ showForecastRegion: Y = !0,
70
+ showGrid: G = !0,
71
+ showTooltip: Z = !0,
72
+ showLegend: q = !0,
73
+ showXAxis: J = !0,
74
+ showYAxis: Q = !0,
75
+ xTickFormatter: R,
76
+ yTickFormatter: U,
77
+ xAxisAngle: g,
78
+ xAxisInterval: V,
79
+ yAxisTickCount: ee,
80
+ yAxisDomain: te,
81
+ gridDashed: re,
82
+ gridHorizontal: oe,
83
+ gridVertical: ne,
84
+ tooltipContent: T,
85
+ animate: ae,
86
+ animationDuration: le,
87
+ animationBegin: ce,
88
+ animationEasing: ie,
89
+ ...se
90
+ }, ue) => {
91
+ var O, X;
92
+ const s = m.useMemo(() => c != null && c.length ? c : !v || !y ? [] : [{ actualKey: v, forecastKey: y, lowerKey: f, upperKey: C }], [c, v, y, f, C]), b = Xe({
93
+ animate: ae,
94
+ animationDuration: le,
95
+ animationBegin: ce,
96
+ animationEasing: ie
97
+ }), L = m.useMemo(
98
+ () => T ? Ye(T) : void 0,
99
+ [T]
100
+ ), fe = Ee($), de = ze(D), me = He(te), ve = m.useMemo(() => {
101
+ let e;
102
+ for (const { actualKey: a, forecastKey: i } of s) {
103
+ const u = o[a], d = o[i];
104
+ !u || !d || (e ?? (e = { ...o }), e[i] = {
105
+ label: d.label,
106
+ icon: d.icon,
107
+ ...u.theme ? { theme: u.theme } : { color: u.color }
108
+ });
109
+ }
110
+ return e ?? o;
111
+ }, [o, s]), ye = Be($, g), pe = n.map((e) => {
112
+ const a = { ...e };
113
+ for (const { actualKey: i, lowerKey: u, upperKey: d } of s) {
114
+ if (!u || !d) continue;
115
+ const _ = e[u], S = e[d];
116
+ a[A(i)] = typeof _ == "number" && typeof S == "number" ? [_, S] : void 0;
117
+ }
118
+ return a;
119
+ }), N = Ge(n, s, l), k = Y ? N[0] : void 0, M = (O = n[n.length - 1]) == null ? void 0 : O[l], he = Ze(
120
+ new Set(N),
121
+ `var(--color-${(X = s[0]) == null ? void 0 : X.actualKey})`,
122
+ R
123
+ ), ke = h ? Array.isArray(h) ? h : [h] : [], ge = () => /* @__PURE__ */ x(E, { children: [
124
+ /* @__PURE__ */ r(
125
+ Le,
126
+ {
127
+ dataKey: l,
128
+ type: "category",
129
+ hide: !J,
130
+ tickLine: !1,
131
+ axisLine: !1,
132
+ tickMargin: 8,
133
+ tickFormatter: R,
134
+ tick: W ? he : void 0,
135
+ angle: g,
136
+ interval: V,
137
+ textAnchor: _e(g),
138
+ height: ye,
139
+ label: fe
140
+ }
141
+ ),
142
+ /* @__PURE__ */ r(
143
+ Ne,
144
+ {
145
+ type: "number",
146
+ hide: !Q,
147
+ tickLine: !1,
148
+ axisLine: !1,
149
+ unit: P,
150
+ tickFormatter: U,
151
+ tickCount: ee,
152
+ domain: me,
153
+ width: D ? 72 : void 0,
154
+ label: de
155
+ }
156
+ )
157
+ ] }), Te = () => /* @__PURE__ */ x(E, { children: [
158
+ k != null && M != null && /* @__PURE__ */ r(
159
+ Me,
160
+ {
161
+ x1: k,
162
+ x2: M,
163
+ fill: "var(--ui-background-surface-secondary)",
164
+ fillOpacity: 0.5,
165
+ ifOverflow: "extendDomain"
166
+ }
167
+ ),
168
+ k != null && /* @__PURE__ */ r(
169
+ B,
170
+ {
171
+ x: k,
172
+ stroke: "var(--ui-border-on-surface-border)",
173
+ strokeDasharray: "4 4"
174
+ }
175
+ )
176
+ ] }), be = (e, a) => /* @__PURE__ */ r(
177
+ B,
178
+ {
179
+ y: e.value,
180
+ stroke: "var(--ui-text-on-surface-secondary)",
181
+ strokeDasharray: "4 4",
182
+ ifOverflow: "extendDomain",
183
+ label: e.label ? {
184
+ value: e.label,
185
+ position: "insideTopRight",
186
+ fill: "var(--ui-text-on-surface-secondary)",
187
+ fontSize: Se
188
+ } : void 0
189
+ },
190
+ `${e.label ?? "threshold"}-${a}`
191
+ ), xe = () => L ? (
192
+ // Strips the synthetic band before the caller's tooltip sees it — the
193
+ // `__cone` series feeds the Area, not the tooltip.
194
+ /* @__PURE__ */ r(j, { content: L })
195
+ ) : /* @__PURE__ */ r(
196
+ j,
197
+ {
198
+ content: (e) => /* @__PURE__ */ r(
199
+ we,
200
+ {
201
+ active: e.active,
202
+ label: e.label,
203
+ payload: I(e.payload)
204
+ }
205
+ )
206
+ }
207
+ ), Ae = () => /* @__PURE__ */ r(
208
+ Ie,
209
+ {
210
+ content: (e) => /* @__PURE__ */ r(
211
+ Pe,
212
+ {
213
+ verticalAlign: e.verticalAlign,
214
+ payload: We(
215
+ e.payload,
216
+ s.map((a) => a.actualKey)
217
+ )
218
+ }
219
+ )
220
+ }
221
+ ), Ce = ({
222
+ actualKey: e,
223
+ lowerKey: a,
224
+ upperKey: i
225
+ }) => a && i ? /* @__PURE__ */ r(
226
+ z,
227
+ {
228
+ "data-slot": "confidence-cone-band",
229
+ dataKey: A(e),
230
+ type: "monotone",
231
+ stroke: "none",
232
+ fill: `var(--color-${e})`,
233
+ fillOpacity: 0.15,
234
+ connectNulls: !1,
235
+ dot: !1,
236
+ activeDot: !1,
237
+ ...b,
238
+ legendType: "none",
239
+ tooltipType: "none"
240
+ },
241
+ A(e)
242
+ ) : null, $e = ({ actualKey: e }) => {
243
+ const a = F === "line" ? H : z, i = F === "line" ? void 0 : { fill: `var(--color-${e})`, fillOpacity: 0.15 }, u = p ? {
244
+ r: 3,
245
+ fill: `var(--color-${e})`,
246
+ fillOpacity: 1,
247
+ stroke: `var(--color-${e})`,
248
+ strokeWidth: 2
249
+ } : !1;
250
+ return /* @__PURE__ */ r(
251
+ a,
252
+ {
253
+ dataKey: e,
254
+ type: "monotone",
255
+ stroke: `var(--color-${e})`,
256
+ strokeWidth: K,
257
+ ...i,
258
+ dot: u,
259
+ activeDot: p ? { r: 5 } : !1,
260
+ connectNulls: !0,
261
+ ...b,
262
+ legendType: "rect"
263
+ },
264
+ e
265
+ );
266
+ }, De = ({
267
+ actualKey: e,
268
+ forecastKey: a
269
+ }) => {
270
+ const i = p ? {
271
+ r: 3,
272
+ fill: "var(--ui-background-surface-primary)",
273
+ stroke: `var(--color-${e})`,
274
+ strokeWidth: 2,
275
+ strokeDasharray: "none"
276
+ } : !1;
277
+ return /* @__PURE__ */ r(
278
+ H,
279
+ {
280
+ dataKey: a,
281
+ type: "monotone",
282
+ stroke: `var(--color-${e})`,
283
+ strokeWidth: K,
284
+ strokeDasharray: "5 5",
285
+ dot: i,
286
+ activeDot: p ? { r: 5 } : !1,
287
+ connectNulls: !0,
288
+ ...b
289
+ },
290
+ a
291
+ );
292
+ };
293
+ return /* @__PURE__ */ r("div", { ref: ue, className: Oe(t), ...se, children: /* @__PURE__ */ r(
294
+ je,
73
295
  {
74
- config: l,
296
+ config: ve,
75
297
  className: "size-full [&_.recharts-label]:fill-foreground",
76
- children: /* @__PURE__ */ U(V, { data: Q, children: [
77
- _ && /* @__PURE__ */ e(
78
- Z,
79
- {
80
- horizontal: x ?? !0,
81
- vertical: G ?? !1,
82
- strokeDasharray: Y ? "3 3" : void 0
83
- }
84
- ),
85
- /* @__PURE__ */ e(
86
- K,
87
- {
88
- dataKey: r,
89
- type: "category",
90
- hide: !E,
91
- tickLine: !1,
92
- axisLine: !1,
93
- tickMargin: 8,
94
- tickFormatter: w,
95
- angle: a,
96
- interval: F,
97
- textAnchor: a != null ? a < 0 ? "end" : "start" : void 0,
98
- height: P,
99
- label: q
100
- }
101
- ),
102
- /* @__PURE__ */ e(
103
- W,
104
- {
105
- type: "number",
106
- hide: !j,
107
- tickLine: !1,
108
- axisLine: !1,
109
- unit: O,
110
- tickFormatter: z,
111
- tickCount: M,
112
- domain: J,
113
- width: d ? 72 : void 0,
114
- label: I
115
- }
116
- ),
117
- s != null && C != null && /* @__PURE__ */ e(
118
- ee,
119
- {
120
- x1: s,
121
- x2: C,
122
- fill: "var(--ui-background-surface-secondary)",
123
- fillOpacity: 0.5,
124
- ifOverflow: "extendDomain"
125
- }
126
- ),
127
- s != null && /* @__PURE__ */ e(
128
- te,
129
- {
130
- x: s,
131
- stroke: "var(--ui-border-on-surface-border)",
132
- strokeDasharray: "4 4"
133
- }
134
- ),
135
- $ && (y ? (
136
- // Strips the synthetic band before the caller's tooltip sees it
137
- // — the `__cone` series feeds the Area, not the tooltip.
138
- /* @__PURE__ */ e(N, { content: y })
139
- ) : /* @__PURE__ */ e(
140
- N,
298
+ children: /* @__PURE__ */ x(Fe, { data: pe, children: [
299
+ G && /* @__PURE__ */ r(
300
+ Ke,
141
301
  {
142
- content: (t) => /* @__PURE__ */ e(
143
- ie,
144
- {
145
- active: t.active,
146
- label: t.label,
147
- payload: v(
148
- t.payload
149
- )
150
- }
151
- )
152
- }
153
- )),
154
- B && /* @__PURE__ */ e(
155
- ae,
156
- {
157
- content: (t) => /* @__PURE__ */ e(
158
- le,
159
- {
160
- verticalAlign: t.verticalAlign,
161
- payload: v(
162
- t.payload
163
- )
164
- }
165
- )
166
- }
167
- ),
168
- /* @__PURE__ */ e(
169
- b,
170
- {
171
- dataKey: m,
172
- type: "monotone",
173
- stroke: "none",
174
- fill: `var(--color-${i})`,
175
- fillOpacity: 0.15,
176
- connectNulls: !1,
177
- dot: !1,
178
- activeDot: !1,
179
- isAnimationActive: !1,
180
- legendType: "none",
181
- tooltipType: "none"
302
+ horizontal: oe ?? !0,
303
+ vertical: ne ?? !1,
304
+ strokeDasharray: re ? "3 3" : void 0
182
305
  }
183
306
  ),
184
- /* @__PURE__ */ e(
185
- b,
186
- {
187
- dataKey: i,
188
- type: "monotone",
189
- stroke: `var(--color-${i})`,
190
- strokeWidth: h,
191
- fill: `var(--color-${i})`,
192
- fillOpacity: 0.15,
193
- dot: !1,
194
- activeDot: !1,
195
- connectNulls: !0,
196
- isAnimationActive: !1
197
- }
198
- ),
199
- /* @__PURE__ */ e(
200
- oe,
201
- {
202
- dataKey: p,
203
- type: "monotone",
204
- stroke: `var(--color-${i})`,
205
- strokeWidth: h,
206
- strokeDasharray: "5 5",
207
- dot: !1,
208
- connectNulls: !0,
209
- isAnimationActive: !1
210
- }
211
- )
307
+ ge(),
308
+ Te(),
309
+ ke.map(be),
310
+ Z && xe(),
311
+ q && Ae(),
312
+ s.map(Ce),
313
+ s.map($e),
314
+ s.map(De)
212
315
  ] })
213
316
  }
214
317
  ) });
215
318
  }
216
319
  );
217
- fe.displayName = "ConfidenceCone";
320
+ qe.displayName = "ConfidenceCone";
218
321
  export {
219
- fe as ConfidenceCone,
220
- se as createConeTooltip,
221
- v as dropConeBand
322
+ qe as ConfidenceCone,
323
+ Ye as createConeTooltip,
324
+ Ze as createForecastTick,
325
+ I as dropConeBand,
326
+ Ge as forecastPeriodX,
327
+ We as keepMetricSeries
222
328
  };
223
329
  //# sourceMappingURL=confidence-cone.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"confidence-cone.js","sources":["../../../../src/components/ui/confidence-cone/confidence-cone.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport {\n Area,\n CartesianGrid,\n ComposedChart,\n Line,\n ReferenceArea,\n ReferenceLine,\n XAxis,\n YAxis,\n} from 'recharts';\n\nimport { cn } from '@/lib/utils';\nimport {\n ChartContainer,\n ChartLegend,\n ChartLegendContent,\n ChartTooltip,\n ChartTooltipContent,\n resolveAxisDomain,\n type ChartConfig,\n type ChartLegendContentProps,\n type ChartTooltipContentProps,\n type CartesianChartProps,\n} from '../chart';\n\n// A forecast confidence-cone: a solid line over the known/actual period, a\n// dashed line over the forecast period, and a shaded band (the \"cone\") between\n// a lower and upper bound that typically widens with the horizon — visualizing\n// growing uncertainty. Built on the shared Chart primitives; no new tokens\n// (series colors are caller-supplied via `config`). The whole metric renders in\n// one hue — actual and forecast differ by line style, not color — so the cone\n// band and the forecast line both reuse the actual series' color.\n\n// The band is a synthetic `[lower, upper]` range field per row that a recharts\n// <Area> shades; kept out of the tooltip/legend (see the filters below).\nconst BAND_KEY = '__cone';\n\n/**\n * Drop the synthetic cone-band range series from a recharts tooltip/legend\n * payload, keeping the real actual/forecast series (and their order). Applied to\n * both the default tooltip and any caller-supplied `tooltipContent`, so the\n * `__cone` band never surfaces regardless of which path renders.\n */\nexport function dropConeBand<T extends { dataKey?: unknown }>(\n payload: readonly T[] | undefined\n): T[] | undefined {\n return payload?.filter((item) => item.dataKey !== BAND_KEY);\n}\n\n/**\n * Wrap a caller-supplied `tooltipContent` so the synthetic cone band is stripped\n * from the payload before it renders, while preserving recharts' own mount\n * semantics — a function is mounted via `createElement` (its own component\n * identity + hook state), an element via `cloneElement`. This mirrors what the\n * pass-through charts get by handing `content` straight to recharts, so a\n * function-form tooltip keeps its state across re-renders here too. The returned\n * component is a stable content type (memoize it on `tooltipContent`).\n */\ntype TooltipContentType = NonNullable<\n React.ComponentProps<typeof ChartTooltip>['content']\n>;\ntype TooltipContentFn = Extract<TooltipContentType, (...args: never[]) => unknown>;\ntype TooltipRenderProps = Parameters<TooltipContentFn>[0];\n\nexport function createConeTooltip(tooltipContent: TooltipContentType) {\n return function ConeTooltip(props: TooltipRenderProps) {\n const merged = {\n ...props,\n payload: dropConeBand(props.payload),\n } as TooltipRenderProps;\n return typeof tooltipContent === 'function'\n ? React.createElement(\n tooltipContent as React.FunctionComponent<TooltipRenderProps>,\n merged\n )\n : React.cloneElement(tooltipContent, merged);\n };\n}\n\nexport interface ConfidenceConeProps\n extends Omit<React.ComponentProps<'div'>, 'children'>,\n CartesianChartProps {\n /**\n * Row-per-point data — the shared x dimension plus the actual / forecast /\n * bound fields. Rows are naturally sparse (a point has either an actual or a\n * forecast + bounds), so missing fields are allowed. Avoid a field named\n * `__cone` — it's reserved for the internal prediction-band series.\n */\n data: ReadonlyArray<Record<string, string | number | null | undefined>>;\n /**\n * Per-series map of `label` / `color` for the actual + forecast lines\n * (imported from the shared `Chart` primitives). Colors are caller-supplied —\n * reference an existing semantic `--ui-*` token; there is no chart palette tier\n * yet. The cone band and the forecast line both reuse the actual series'\n * color — actual and forecast differ by line style, not hue.\n */\n config: ChartConfig;\n /** Category / time axis key (the shared dimension across rows). */\n xKey: string;\n /** Field for the known/actual values — drawn as a solid line with a filled area. */\n actualKey: string;\n /** Field for the projected values — drawn as a dashed line. */\n forecastKey: string;\n /** Field for the cone's lower bound. */\n lowerKey: string;\n /** Field for the cone's upper bound. */\n upperKey: string;\n /** Stroke width of the actual + forecast lines. */\n strokeWidth?: number;\n /**\n * Set off the forecast period from the actuals with a dashed divider at the\n * hand-off point (the first row with a forecast value) and a subtle shaded\n * band over the forecast region.\n */\n showForecastRegion?: boolean;\n showLegend?: boolean;\n}\n\nconst ConfidenceCone = React.forwardRef<HTMLDivElement, ConfidenceConeProps>(\n (\n {\n className,\n config,\n data,\n xKey,\n actualKey,\n forecastKey,\n lowerKey,\n upperKey,\n xAxisLabel,\n yAxisLabel,\n yUnit,\n strokeWidth = 2,\n showForecastRegion = true,\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 ...props\n },\n ref\n ) => {\n // Memoized so recharts sees a stable content type across renders — a fresh\n // wrapper each render would remount the caller's tooltip and reset its state.\n const customTooltip = React.useMemo(\n () => (tooltipContent ? createConeTooltip(tooltipContent) : undefined),\n [tooltipContent]\n );\n\n const xAxisTitle = xAxisLabel\n ? { value: xAxisLabel, position: 'insideBottom' as const, offset: 0 }\n : undefined;\n const yAxisTitle = yAxisLabel\n ? {\n value: yAxisLabel,\n angle: -90,\n position: 'insideLeft' as const,\n style: { textAnchor: 'middle' as const },\n }\n : undefined;\n\n const yDomain = resolveAxisDomain(yAxisDomain);\n\n // Room for the X tick row: recharts' default 30, plus a rotated tick row\n // (+20) and/or the axis title (+18). Additive — both can be present at once,\n // which the old label-or-angle ternary under-allocated.\n const xAxisHeight =\n xAxisLabel || xAxisAngle != null\n ? 30 + (xAxisAngle != null ? 20 : 0) + (xAxisLabel ? 18 : 0)\n : undefined;\n\n // Augment each row with the `[lower, upper]` band tuple the Area shades.\n // Rows missing a numeric bound are left un-coned (the band breaks there).\n const chartData = data.map((row) => {\n const lower = row[lowerKey];\n const upper = row[upperKey];\n return {\n ...row,\n [BAND_KEY]:\n typeof lower === 'number' && typeof upper === 'number'\n ? [lower, upper]\n : undefined,\n };\n });\n\n // The forecast begins at the first row carrying a forecast value; set that\n // region off from the actuals with a shaded band + a divider at the hand-off.\n const forecastStart = showForecastRegion\n ? data.find((row) => typeof row[forecastKey] === 'number')?.[xKey]\n : undefined;\n const lastX = data[data.length - 1]?.[xKey];\n\n return (\n <div ref={ref} className={cn(className)} {...props}>\n <ChartContainer\n config={config}\n className=\"size-full [&_.recharts-label]:fill-foreground\"\n >\n <ComposedChart data={chartData as readonly unknown[]}>\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={xTickFormatter}\n angle={xAxisAngle}\n interval={xAxisInterval}\n textAnchor={\n xAxisAngle != null ? (xAxisAngle < 0 ? 'end' : 'start') : undefined\n }\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 {/* Set the forecast region off from the actuals (behind everything). */}\n {forecastStart != null && lastX != null && (\n <ReferenceArea\n x1={forecastStart}\n x2={lastX}\n fill=\"var(--ui-background-surface-secondary)\"\n fillOpacity={0.5}\n ifOverflow=\"extendDomain\"\n />\n )}\n {forecastStart != null && (\n <ReferenceLine\n x={forecastStart}\n stroke=\"var(--ui-border-on-surface-border)\"\n strokeDasharray=\"4 4\"\n />\n )}\n {showTooltip &&\n (customTooltip ? (\n // Strips the synthetic band before the caller's tooltip sees it\n // — the `__cone` series feeds the Area, not the tooltip.\n <ChartTooltip content={customTooltip} />\n ) : (\n <ChartTooltip\n content={(tp) => (\n <ChartTooltipContent\n active={tp.active}\n label={tp.label}\n // The synthetic band feeds the Area, not the tooltip.\n payload={\n dropConeBand(\n tp.payload\n ) as ChartTooltipContentProps['payload']\n }\n />\n )}\n />\n ))}\n {showLegend && (\n <ChartLegend\n content={(lp) => (\n <ChartLegendContent\n verticalAlign={lp.verticalAlign}\n payload={\n dropConeBand(\n lp.payload\n ) as ChartLegendContentProps['payload']\n }\n />\n )}\n />\n )}\n {/* The cone renders first so the lines draw on top. One color for the\n whole metric — actual and forecast differ by line style, not hue —\n so the cone + forecast line reuse the actual series' color. */}\n <Area\n dataKey={BAND_KEY}\n type=\"monotone\"\n stroke=\"none\"\n fill={`var(--color-${actualKey})`}\n fillOpacity={0.15}\n connectNulls={false}\n dot={false}\n activeDot={false}\n isAnimationActive={false}\n legendType=\"none\"\n tooltipType=\"none\"\n />\n <Area\n dataKey={actualKey}\n type=\"monotone\"\n stroke={`var(--color-${actualKey})`}\n strokeWidth={strokeWidth}\n fill={`var(--color-${actualKey})`}\n fillOpacity={0.15}\n dot={false}\n activeDot={false}\n connectNulls\n isAnimationActive={false}\n />\n <Line\n dataKey={forecastKey}\n type=\"monotone\"\n stroke={`var(--color-${actualKey})`}\n strokeWidth={strokeWidth}\n strokeDasharray=\"5 5\"\n dot={false}\n connectNulls\n isAnimationActive={false}\n />\n </ComposedChart>\n </ChartContainer>\n </div>\n );\n }\n);\nConfidenceCone.displayName = 'ConfidenceCone';\n\nexport { ConfidenceCone };\n"],"names":["BAND_KEY","dropConeBand","payload","item","createConeTooltip","tooltipContent","props","merged","React","ConfidenceCone","className","config","data","xKey","actualKey","forecastKey","lowerKey","upperKey","xAxisLabel","yAxisLabel","yUnit","strokeWidth","showForecastRegion","showGrid","showTooltip","showLegend","showXAxis","showYAxis","xTickFormatter","yTickFormatter","xAxisAngle","xAxisInterval","yAxisTickCount","yAxisDomain","gridDashed","gridHorizontal","gridVertical","ref","customTooltip","xAxisTitle","yAxisTitle","yDomain","resolveAxisDomain","xAxisHeight","chartData","row","lower","upper","forecastStart","_a","lastX","_b","jsx","cn","ChartContainer","jsxs","ComposedChart","CartesianGrid","XAxis","YAxis","ReferenceArea","ReferenceLine","ChartTooltip","tp","ChartTooltipContent","ChartLegend","lp","ChartLegendContent","Area","Line"],"mappings":";;;;;;AAsCA,MAAMA,IAAW;AAQV,SAASC,EACdC,GACiB;AACjB,SAAOA,KAAA,gBAAAA,EAAS,OAAO,CAACC,MAASA,EAAK,YAAYH;AACpD;AAiBO,SAASI,GAAkBC,GAAoC;AACpE,SAAO,SAAqBC,GAA2B;AACrD,UAAM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AAAA,YAACgB;AAAA,YAAA;AAAA,cACC,SAASpE;AAAA,cACT,MAAK;AAAA,cACL,QAAO;AAAA,cACP,MAAM,eAAec,CAAS;AAAA,cAC9B,aAAa;AAAA,cACb,cAAc;AAAA,cACd,KAAK;AAAA,cACL,WAAW;AAAA,cACX,mBAAmB;AAAA,cACnB,YAAW;AAAA,cACX,aAAY;AAAA,YAAA;AAAA,UAAA;AAAA,UAEd,gBAAAsC;AAAA,YAACgB;AAAA,YAAA;AAAA,cACC,SAAStD;AAAA,cACT,MAAK;AAAA,cACL,QAAQ,eAAeA,CAAS;AAAA,cAChC,aAAAO;AAAA,cACA,MAAM,eAAeP,CAAS;AAAA,cAC9B,aAAa;AAAA,cACb,KAAK;AAAA,cACL,WAAW;AAAA,cACX,cAAY;AAAA,cACZ,mBAAmB;AAAA,YAAA;AAAA,UAAA;AAAA,UAErB,gBAAAsC;AAAA,YAACiB;AAAA,YAAA;AAAA,cACC,SAAStD;AAAA,cACT,MAAK;AAAA,cACL,QAAQ,eAAeD,CAAS;AAAA,cAChC,aAAAO;AAAA,cACA,iBAAgB;AAAA,cAChB,KAAK;AAAA,cACL,cAAY;AAAA,cACZ,mBAAmB;AAAA,YAAA;AAAA,UAAA;AAAA,QACrB,EAAA,CACF;AAAA,MAAA;AAAA,IAAA,GAEJ;AAAA,EAEJ;AACF;AACAZ,GAAe,cAAc;"}
1
+ {"version":3,"file":"confidence-cone.js","sources":["../../../../src/components/ui/confidence-cone/confidence-cone.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport {\n Area,\n CartesianGrid,\n ComposedChart,\n Line,\n ReferenceArea,\n ReferenceLine,\n Text,\n XAxis,\n YAxis,\n} from 'recharts';\n\nimport { cn } from '@/lib/utils';\nimport {\n ChartContainer,\n ChartLegend,\n ChartLegendContent,\n ChartTooltip,\n ChartTooltipContent,\n resolveAxisDomain,\n resolveAnimation,\n resolveRotatedTickAnchor,\n resolveXAxisHeight,\n resolveXAxisTitle,\n resolveYAxisTitle,\n CHART_LABEL_FONT_SIZE,\n type ChartConfig,\n type ChartLegendContentProps,\n type ChartTooltipContentProps,\n type CartesianChartProps,\n type ChartAnimationProps,\n} from '../chart';\n\n// A forecast confidence-cone: a solid line over the known/actual period, a\n// dashed line over the forecast period, and a shaded band (the \"cone\") between\n// a lower and upper bound that typically widens with the horizon — visualizing\n// growing uncertainty. Built on the shared Chart primitives; no new tokens\n// (series colors are caller-supplied via `config`). The whole metric renders in\n// one hue — actual and forecast differ by line style, not color — so the cone\n// band and the forecast line both reuse the actual series' color.\n\n// Each series' band is a synthetic `[lower, upper]` range field per row that a\n// recharts <Area> shades; kept out of the tooltip/legend (see the filters\n// below). One band per series, so the key carries the series' actual key — the\n// whole `__cone` prefix is reserved.\nconst BAND_PREFIX = '__cone';\nconst bandKeyFor = (actualKey: string) => `${BAND_PREFIX}:${actualKey}`;\n\n/**\n * Drop every synthetic cone-band range series from a recharts tooltip/legend\n * payload, keeping the real actual/forecast series (and their order). Applied to\n * both the default tooltip and any caller-supplied `tooltipContent`, so no band\n * surfaces regardless of which path renders or how many series are plotted.\n */\nexport function dropConeBand<T extends { dataKey?: unknown }>(\n payload: readonly T[] | undefined\n): T[] | undefined {\n return payload?.filter(\n (item) =>\n !(typeof item.dataKey === 'string' && item.dataKey.startsWith(BAND_PREFIX))\n );\n}\n\n/**\n * Reduce a legend payload to the metrics the chart plots — one entry per series.\n * A series' actual, forecast and cone are three recharts series painting a\n * single metric in a single hue, so the legend names each metric once, with its\n * actual series' swatch, instead of listing line styles as separate series.\n */\nexport function keepMetricSeries<T extends { dataKey?: unknown }>(\n payload: readonly T[] | undefined,\n actualKeys: readonly string[]\n): T[] | undefined {\n return payload?.filter(\n (item) => typeof item.dataKey === 'string' && actualKeys.includes(item.dataKey)\n );\n}\n\n/**\n * Wrap a caller-supplied `tooltipContent` so the synthetic cone band is stripped\n * from the payload before it renders, while preserving recharts' own mount\n * semantics — a function is mounted via `createElement` (its own component\n * identity + hook state), an element via `cloneElement`. This mirrors what the\n * pass-through charts get by handing `content` straight to recharts, so a\n * function-form tooltip keeps its state across re-renders here too. The returned\n * component is a stable content type (memoize it on `tooltipContent`).\n */\ntype TooltipContentType = NonNullable<\n React.ComponentProps<typeof ChartTooltip>['content']\n>;\ntype TooltipContentFn = Extract<TooltipContentType, (...args: never[]) => unknown>;\ntype TooltipRenderProps = Parameters<TooltipContentFn>[0];\n\nexport function createConeTooltip(tooltipContent: TooltipContentType) {\n return function ConeTooltip(props: TooltipRenderProps) {\n const merged = {\n ...props,\n payload: dropConeBand(props.payload),\n } as TooltipRenderProps;\n return typeof tooltipContent === 'function'\n ? React.createElement(\n tooltipContent as React.FunctionComponent<TooltipRenderProps>,\n merged\n )\n : React.cloneElement(tooltipContent, merged);\n };\n}\n\n/**\n * One plotted metric: its actual / forecast columns and, optionally, the two\n * bound columns that shade its cone. Omit `lowerKey`/`upperKey` for a band-less\n * metric — a solid line handing off to a bare dashed projection.\n */\nexport interface ConfidenceConeSeries {\n /** Field for the known/actual values — drawn as a solid line with a filled area. */\n actualKey: string;\n /** Field for the projected values — drawn as a dashed line. */\n forecastKey: string;\n /** Field for the cone's lower bound. Omit (with `upperKey`) for no cone. */\n lowerKey?: string;\n /** Field for the cone's upper bound. Omit (with `lowerKey`) for no cone. */\n upperKey?: string;\n}\n\n/**\n * The x values of the projected period — every row carrying a forecast value for\n * at least one series, in data order. The first is the hand-off point (where the\n * shaded region and divider start); the whole set drives the forecast tick\n * styling, matched by value so tick `interval` can't skew it the way a tick\n * index would. Exported for unit tests; not part of the package's public API.\n */\nexport function forecastPeriodX(\n data: ReadonlyArray<Record<string, string | number | null | undefined>>,\n series: readonly ConfidenceConeSeries[],\n xKey: string\n): Array<string | number | null | undefined> {\n return data\n .filter((row) => series.some(({ forecastKey }) => typeof row[forecastKey] === 'number'))\n .map((row) => row[xKey]);\n}\n\n/**\n * Build the X-axis tick renderer that sets the projected columns apart: italic,\n * in the metric's hue. Styled inline rather than through the `fill` attribute\n * recharts hands every tick, so the accent survives the class-based tick color\n * a chart theme may apply. A custom tick owns its own text, so the caller's\n * `xTickFormatter` is applied here — recharts only applies it to default ticks.\n * Exported for unit tests; not part of the package's public API.\n */\nexport function createForecastTick(\n forecastX: ReadonlySet<string | number | null | undefined>,\n color: string,\n tickFormatter?: CartesianChartProps['xTickFormatter']\n) {\n return function ForecastTick({\n payload,\n index,\n ...tickProps\n }: {\n payload?: { value?: string | number };\n index?: number;\n }) {\n const value = payload?.value;\n return (\n <Text\n {...tickProps}\n style={\n value != null && forecastX.has(value)\n ? { fontStyle: 'italic', fill: color }\n : undefined\n }\n >\n {tickFormatter && value != null ? tickFormatter(value, index) : value}\n </Text>\n );\n };\n}\n\n/** A dashed horizontal threshold on the value axis. */\nexport interface ConfidenceConeReferenceLine {\n /** Position on the value (Y) axis. */\n value: number;\n /** Optional caption rendered at the line's right end. */\n label?: string;\n}\n\n/**\n * Every prop except the one-form-or-the-other requirement `ConfidenceConeProps`\n * layers on below. Exported so the stories can type their `Meta` on a single\n * object shape — Storybook can't split a union's required args between `meta.args`\n * and a story's. Not re-exported from `index.ts`; not part of the public API.\n */\nexport interface ConfidenceConeBaseProps\n extends Omit<React.ComponentProps<'div'>, 'children'>,\n CartesianChartProps,\n ChartAnimationProps {\n /**\n * Row-per-point data — the shared x dimension plus each series' actual /\n * forecast / bound fields. Rows are naturally sparse (a point has either an\n * actual or a forecast + bounds), so missing fields are allowed. Avoid fields\n * starting with `__cone` — that prefix is reserved for the internal\n * prediction-band series.\n */\n data: ReadonlyArray<Record<string, string | number | null | undefined>>;\n /**\n * Per-series map of `label` / `color` for the actual + forecast lines\n * (imported from the shared `Chart` primitives). Colors are caller-supplied —\n * reference an existing semantic `--ui-*` token; there is no chart palette tier\n * yet. Each metric renders in one hue: its cone band and forecast line both\n * reuse its actual series' color — actual and forecast differ by line style,\n * not hue.\n */\n config: ChartConfig;\n /** Category / time axis key (the shared dimension across rows). */\n xKey: string;\n /**\n * Plot several metrics against one shared axis — each with its own actual /\n * forecast / bound fields and its own hue (from `config[actualKey]`). Takes\n * precedence over the single-series `actualKey`/`forecastKey`/`lowerKey`/\n * `upperKey` shorthand below; pass one form or the other, not both. One of the\n * two forms is required.\n */\n series?: readonly ConfidenceConeSeries[];\n /**\n * Single-series shorthand — field for the known/actual values, drawn as a\n * solid line with a filled area. Required (with `forecastKey`) unless `series`\n * is set, which supersedes it.\n */\n actualKey?: string;\n /**\n * Single-series shorthand — field for the projected values, drawn as a dashed\n * line. Required (with `actualKey`) unless `series` is set, which supersedes\n * it.\n */\n forecastKey?: string;\n /** Field for the cone's lower bound. Omit (with `upperKey`) for no cone. */\n lowerKey?: string;\n /** Field for the cone's upper bound. Omit (with `lowerKey`) for no cone. */\n upperKey?: string;\n /**\n * How the known/actual period is drawn: a filled `area` under the line (the\n * default), or a bare `line` — for a chart where the cone is the only shaded\n * region, or where several metrics' fills would muddy each other.\n */\n actualType?: 'area' | 'line';\n /** Stroke width of the actual + forecast lines. */\n strokeWidth?: number;\n /**\n * Mark each data point: a filled dot on the observed values, a hollow one on\n * the projection — so a point reads as measured or predicted at a glance.\n */\n showDots?: boolean;\n /**\n * Italicize the X-axis ticks over the forecast period and paint them in the\n * first series' hue, so the projected columns read as projected even when the\n * shaded region is off.\n */\n styleForecastTicks?: boolean;\n /**\n * One or more dashed horizontal thresholds on the value axis — e.g. a target\n * or a capacity limit. Pass a single object or an array to draw several.\n */\n referenceLine?: ConfidenceConeReferenceLine | ConfidenceConeReferenceLine[];\n /**\n * Set off the forecast period from the actuals with a dashed divider at the\n * hand-off point (the first row with a forecast value) and a subtle shaded\n * band over the forecast region.\n */\n showForecastRegion?: boolean;\n showLegend?: boolean;\n}\n\n/**\n * Which columns to plot has to be spelled out one way or the other: the `series`\n * array, or the flat `actualKey` + `forecastKey` shorthand. Expressed as a union\n * so a chart with neither is a compile error rather than a silent plot of axes\n * and nothing else. Both forms together stay legal — `series` wins (see\n * `plotted`), which is what the multi-series stories rely on to clear the args\n * table.\n */\nexport type ConfidenceConeProps = ConfidenceConeBaseProps &\n (\n | { series: readonly ConfidenceConeSeries[] }\n | { actualKey: string; forecastKey: string }\n );\n\nconst ConfidenceCone = React.forwardRef<HTMLDivElement, ConfidenceConeProps>(\n (\n {\n className,\n config,\n data,\n xKey,\n series,\n actualKey,\n forecastKey,\n lowerKey,\n upperKey,\n xAxisLabel,\n yAxisLabel,\n yUnit,\n actualType = 'area',\n strokeWidth = 2,\n showDots = false,\n styleForecastTicks = false,\n referenceLine,\n showForecastRegion = true,\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 ...props\n },\n ref\n ) => {\n // The flat *Key props are the single-series shorthand for `series`.\n const plotted = React.useMemo<readonly ConfidenceConeSeries[]>(() => {\n if (series?.length) return series;\n if (!actualKey || !forecastKey) return [];\n return [{ actualKey, forecastKey, lowerKey, upperKey }];\n }, [series, actualKey, forecastKey, lowerKey, upperKey]);\n\n const animation = resolveAnimation({\n animate,\n animationDuration,\n animationBegin,\n animationEasing,\n });\n // Memoized so recharts sees a stable content type across renders — a fresh\n // wrapper each render would remount the caller's tooltip and reset its state.\n const customTooltip = React.useMemo(\n () => (tooltipContent ? createConeTooltip(tooltipContent) : undefined),\n [tooltipContent]\n );\n\n const xAxisTitle = resolveXAxisTitle(xAxisLabel);\n const yAxisTitle = resolveYAxisTitle(yAxisLabel);\n\n const yDomain = resolveAxisDomain(yAxisDomain);\n\n // One hue per metric. Each cone and forecast line already paints with its own\n // series' actual color; re-pointing that series' forecast key's `--color-*`\n // at it too means nothing downstream — a custom tooltip, a caller's\n // `var(--color-<forecastKey>)` — can reintroduce a second color.\n const seriesConfig = React.useMemo(() => {\n let next: ChartConfig | undefined;\n for (const { actualKey: aKey, forecastKey: fKey } of plotted) {\n const actual = config[aKey];\n const forecast = config[fKey];\n if (!actual || !forecast) continue;\n next ??= { ...config };\n next[fKey] = {\n label: forecast.label,\n icon: forecast.icon,\n ...(actual.theme ? { theme: actual.theme } : { color: actual.color }),\n };\n }\n return next ?? config;\n }, [config, plotted]);\n\n const xAxisHeight = resolveXAxisHeight(xAxisLabel, xAxisAngle);\n\n // Augment each row with one `[lower, upper]` band tuple per coned series for\n // its Area to shade. Rows missing a numeric bound are left un-coned (the\n // band breaks there); a series without bounds gets no band at all.\n const chartData = data.map((row) => {\n const next: Record<string, unknown> = { ...row };\n for (const { actualKey: aKey, lowerKey: lKey, upperKey: uKey } of plotted) {\n if (!lKey || !uKey) continue;\n const lower = row[lKey];\n const upper = row[uKey];\n next[bandKeyFor(aKey)] =\n typeof lower === 'number' && typeof upper === 'number'\n ? [lower, upper]\n : undefined;\n }\n return next;\n });\n\n const forecastX = forecastPeriodX(data, plotted, xKey);\n // Set the projected period off from the actuals with a shaded band + a\n // divider at the hand-off.\n const forecastStart = showForecastRegion ? forecastX[0] : undefined;\n const lastX = data[data.length - 1]?.[xKey];\n\n const renderForecastTick = createForecastTick(\n new Set(forecastX),\n `var(--color-${plotted[0]?.actualKey})`,\n xTickFormatter\n );\n\n const referenceLines = referenceLine\n ? Array.isArray(referenceLine)\n ? referenceLine\n : [referenceLine]\n : [];\n\n // Everything from here to the `return` is lifted out of the returned tree\n // only to keep it readable as a flat list of chart children. Nothing in\n // recharts forces the `render*` helpers to be plain functions: axes and\n // series register themselves with the chart's store, and `<Cell>` is the\n // only child still looked up by element type — a component wrapper renders\n // fine (see AreaChart's `AreaFillGradients`). They stay functions because\n // they are declared inside the render body, where a component would get a\n // fresh element type on every render and remount its subtree.\n\n const renderAxes = () => (\n <>\n <XAxis\n dataKey={xKey}\n type=\"category\"\n hide={!showXAxis}\n tickLine={false}\n axisLine={false}\n tickMargin={8}\n tickFormatter={xTickFormatter}\n tick={styleForecastTicks ? renderForecastTick : undefined}\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 </>\n );\n\n // Set the forecast region off from the actuals (behind everything).\n const renderForecastRegion = () => (\n <>\n {forecastStart != null && lastX != null && (\n <ReferenceArea\n x1={forecastStart}\n x2={lastX}\n fill=\"var(--ui-background-surface-secondary)\"\n fillOpacity={0.5}\n ifOverflow=\"extendDomain\"\n />\n )}\n {forecastStart != null && (\n <ReferenceLine\n x={forecastStart}\n stroke=\"var(--ui-border-on-surface-border)\"\n strokeDasharray=\"4 4\"\n />\n )}\n </>\n );\n\n const renderThreshold = (\n threshold: ConfidenceConeReferenceLine,\n index: number\n ) => (\n <ReferenceLine\n key={`${threshold.label ?? 'threshold'}-${index}`}\n y={threshold.value}\n stroke=\"var(--ui-text-on-surface-secondary)\"\n strokeDasharray=\"4 4\"\n // extendDomain so a threshold beyond the data max stays visible.\n ifOverflow=\"extendDomain\"\n label={\n threshold.label\n ? {\n value: threshold.label,\n position: 'insideTopRight',\n fill: 'var(--ui-text-on-surface-secondary)',\n fontSize: CHART_LABEL_FONT_SIZE,\n }\n : undefined\n }\n />\n );\n\n const renderTooltip = () =>\n customTooltip ? (\n // Strips the synthetic band before the caller's tooltip sees it — the\n // `__cone` series feeds the Area, not the tooltip.\n <ChartTooltip content={customTooltip} />\n ) : (\n <ChartTooltip\n content={(tp) => (\n <ChartTooltipContent\n active={tp.active}\n label={tp.label}\n // The synthetic band feeds the Area, not the tooltip.\n payload={\n dropConeBand(tp.payload) as ChartTooltipContentProps['payload']\n }\n />\n )}\n />\n );\n\n const renderLegend = () => (\n <ChartLegend\n content={(lp) => (\n <ChartLegendContent\n verticalAlign={lp.verticalAlign}\n payload={\n keepMetricSeries(\n lp.payload,\n plotted.map((s) => s.actualKey)\n ) as ChartLegendContentProps['payload']\n }\n />\n )}\n />\n );\n\n // One color per metric — actual and forecast differ by line style, not hue\n // — so a cone reuses its series' actual color.\n const renderConeBand = ({\n actualKey: aKey,\n lowerKey: lKey,\n upperKey: uKey,\n }: ConfidenceConeSeries) =>\n lKey && uKey ? (\n <Area\n key={bandKeyFor(aKey)}\n // The band paints in the same hue, at the same opacity, as the\n // actual series' own area, so nothing on the rendered path tells\n // the two apart. recharts forwards `data-*` onto the path it\n // draws; the tests select the band through this.\n data-slot=\"confidence-cone-band\"\n dataKey={bandKeyFor(aKey)}\n type=\"monotone\"\n stroke=\"none\"\n fill={`var(--color-${aKey})`}\n fillOpacity={0.15}\n connectNulls={false}\n dot={false}\n activeDot={false}\n {...animation}\n legendType=\"none\"\n tooltipType=\"none\"\n />\n ) : null;\n\n const renderActualMark = ({ actualKey: aKey }: ConfidenceConeSeries) => {\n // An area and a line take the same props here; only the region under the\n // curve (and the mark recharts draws) differ. A `Line` gets no fill at\n // all — `fillOpacity: 0` would also erase its dots.\n const ActualMark = actualType === 'line' ? Line : Area;\n const areaFill =\n actualType === 'line'\n ? undefined\n : { fill: `var(--color-${aKey})`, fillOpacity: 0.15 };\n // Observed points read as measured: LineChart's dot geometry (r 3, 2px\n // ring) filled with the metric hue. The ring is that same hue, so the\n // mark is solid — and wide enough against the 2px line not to read as a\n // mere thickening of it. `fillOpacity: 1` is load-bearing: recharts\n // merges the parent mark's own presentation props into every dot it\n // draws, so an `<Area>`'s 0.15 would otherwise wash the dot out to a halo.\n const dot = showDots\n ? {\n r: 3,\n fill: `var(--color-${aKey})`,\n fillOpacity: 1,\n stroke: `var(--color-${aKey})`,\n strokeWidth: 2,\n }\n : false;\n return (\n <ActualMark\n key={aKey}\n dataKey={aKey}\n type=\"monotone\"\n stroke={`var(--color-${aKey})`}\n strokeWidth={strokeWidth}\n {...areaFill}\n dot={dot}\n activeDot={showDots ? { r: 5 } : false}\n connectNulls\n {...animation}\n // The legend names the metric once, so it carries the swatch that\n // stands for the whole series rather than the actual line's style.\n legendType=\"rect\"\n />\n );\n };\n\n const renderForecastLine = ({\n actualKey: aKey,\n forecastKey: fKey,\n }: ConfidenceConeSeries) => {\n // Projected points read as predicted: the same LineChart dot, inverted —\n // the metric's hue as the ring, the surface color as the fill, so the\n // dashed line doesn't show through the middle. (LineChart leaves the fill\n // to recharts, whose `Line` defaults it to `#fff`; the token is that same\n // white in the light theme and also holds up in the dark one.)\n // `strokeDasharray: 'none'` is load-bearing: recharts merges the parent\n // mark's presentation props into every dot, so this line's `5 5` would\n // otherwise break each dot's ring into two arcs.\n const dot = showDots\n ? {\n r: 3,\n fill: 'var(--ui-background-surface-primary)',\n stroke: `var(--color-${aKey})`,\n strokeWidth: 2,\n strokeDasharray: 'none',\n }\n : false;\n return (\n <Line\n key={fKey}\n dataKey={fKey}\n type=\"monotone\"\n stroke={`var(--color-${aKey})`}\n strokeWidth={strokeWidth}\n strokeDasharray=\"5 5\"\n dot={dot}\n // Paired with `dot` the way every other chart does it — left unset,\n // the projection would keep recharts' default active dot while the\n // actuals had none (and a different radius when on).\n activeDot={showDots ? { r: 5 } : false}\n connectNulls\n {...animation}\n />\n );\n };\n\n return (\n <div ref={ref} className={cn(className)} {...props}>\n <ChartContainer\n config={seriesConfig}\n className=\"size-full [&_.recharts-label]:fill-foreground\"\n >\n <ComposedChart data={chartData as readonly unknown[]}>\n {showGrid && (\n <CartesianGrid\n horizontal={gridHorizontal ?? true}\n vertical={gridVertical ?? false}\n strokeDasharray={gridDashed ? '3 3' : undefined}\n />\n )}\n {renderAxes()}\n {renderForecastRegion()}\n {referenceLines.map(renderThreshold)}\n {showTooltip && renderTooltip()}\n {showLegend && renderLegend()}\n {/* Every cone renders before any line, so the lines draw on top of\n all of them. */}\n {plotted.map(renderConeBand)}\n {plotted.map(renderActualMark)}\n {plotted.map(renderForecastLine)}\n </ComposedChart>\n </ChartContainer>\n </div>\n );\n }\n);\nConfidenceCone.displayName = 'ConfidenceCone';\n\nexport { ConfidenceCone };\n"],"names":["BAND_PREFIX","bandKeyFor","actualKey","dropConeBand","payload","item","keepMetricSeries","actualKeys","createConeTooltip","tooltipContent","props","merged","React","forecastPeriodX","data","series","xKey","row","forecastKey","createForecastTick","forecastX","color","tickFormatter","index","tickProps","value","jsx","Text","ConfidenceCone","className","config","lowerKey","upperKey","xAxisLabel","yAxisLabel","yUnit","actualType","strokeWidth","showDots","styleForecastTicks","referenceLine","showForecastRegion","showGrid","showTooltip","showLegend","showXAxis","showYAxis","xTickFormatter","yTickFormatter","xAxisAngle","xAxisInterval","yAxisTickCount","yAxisDomain","gridDashed","gridHorizontal","gridVertical","animate","animationDuration","animationBegin","animationEasing","ref","plotted","animation","resolveAnimation","customTooltip","xAxisTitle","resolveXAxisTitle","yAxisTitle","resolveYAxisTitle","yDomain","resolveAxisDomain","seriesConfig","next","aKey","fKey","actual","forecast","xAxisHeight","resolveXAxisHeight","chartData","lKey","uKey","lower","upper","forecastStart","lastX","_a","renderForecastTick","_b","referenceLines","renderAxes","jsxs","Fragment","XAxis","resolveRotatedTickAnchor","YAxis","renderForecastRegion","ReferenceArea","ReferenceLine","renderThreshold","threshold","CHART_LABEL_FONT_SIZE","renderTooltip","ChartTooltip","tp","ChartTooltipContent","renderLegend","ChartLegend","lp","ChartLegendContent","s","renderConeBand","Area","renderActualMark","ActualMark","Line","areaFill","dot","renderForecastLine","cn","ChartContainer","ComposedChart","CartesianGrid"],"mappings":";;;;;;AAgDA,MAAMA,IAAc,UACdC,IAAa,CAACC,MAAsB,GAAGF,CAAW,IAAIE,CAAS;AAQ9D,SAASC,EACdC,GACiB;AACjB,SAAOA,KAAA,gBAAAA,EAAS;AAAA,IACd,CAACC,MACC,EAAE,OAAOA,EAAK,WAAY,YAAYA,EAAK,QAAQ,WAAWL,CAAW;AAAA;AAE/E;AAQO,SAASM,GACdF,GACAG,GACiB;AACj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