@acronis-platform/ui-react 5.5.3 → 5.5.5

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.
@@ -2,11 +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, resolveAnimation as l, resolveAxisDomain as u, resolveBrushProps as d, resolveCartesianLabelPosition as ee, resolveCategoryRange as f, resolveChartReferenceValue as p, resolveLabelFillClass as te, resolveReferenceLineProps as ne, resolveRotatedTickAnchor as re, resolveXAxisTickLabels as ie, resolveXAxisTitle as m, resolveYAxisTitle as h, toLabelFormatter as ae } from "../chart/chart-format.js";
5
+ import { CHART_LABEL_MARGIN as c, resolveAnimation as l, resolveAxisDomain as u, resolveBrushProps as d, resolveCartesianLabelPosition as ee, resolveCategoryRange as f, resolveChartReferenceValue as p, resolveLabelFillClass as te, resolveReferenceLineProps as ne, resolveRotatedTickAnchor as re, resolveXAxisTickLabels as ie, resolveXAxisTitle as m, resolveYAxisTitle as h, resolveYAxisWidth as g, toLabelFormatter as ae } from "../chart/chart-format.js";
6
6
  import { mergeXAxisLayoutMargin as oe, useXAxisLayout as se } from "../chart/use-x-axis-layout.js";
7
- import * as g from "react";
8
- import { Fragment as _, jsx as v, jsxs as y } from "react/jsx-runtime";
9
- import { Area as ce, Bar as le, Brush as ue, CartesianGrid as de, ComposedChart as fe, LabelList as pe, Line as me, ReferenceArea as he, ReferenceLine as ge, XAxis as b, YAxis as x } from "recharts";
7
+ import * as _ from "react";
8
+ import { Fragment as v, jsx as y, jsxs as b } from "react/jsx-runtime";
9
+ import { Area as ce, Bar as le, Brush as ue, CartesianGrid as de, ComposedChart as fe, LabelList as pe, Line as me, ReferenceArea as he, ReferenceLine as ge, XAxis as x, YAxis as S } from "recharts";
10
10
  //#region src/components/ui/composed-chart/composed-chart.tsx
11
11
  var _e = t("", {
12
12
  variants: { orientation: {
@@ -14,148 +14,148 @@ var _e = t("", {
14
14
  horizontal: ""
15
15
  } },
16
16
  defaultVariants: { orientation: "vertical" }
17
- }), ve = 100, ye = 50, S = "secondary", be = {
17
+ }), ve = 100, ye = 50, C = "secondary", be = {
18
18
  top: 5,
19
19
  right: 5,
20
20
  bottom: 5,
21
21
  left: 5
22
- }, xe = .85, Se = { top: 16 }, C = g.forwardRef(({ className: t, config: C, palette: Ce, data: w, series: T, xKey: E, referenceLine: D, referenceArea: O, orientation: k = "vertical", xAxisLabel: A, yAxisLabel: j, xUnit: we, yUnit: Te, curve: M = "monotone", barRadius: Ee = 4, barSize: De, barGap: Oe, barCategoryGap: ke, showBackground: Ae = !1, backgroundFill: je = "var(--ui-background-surface-secondary)", showActiveBar: Me = !1, fillOpacity: Ne = .3, strokeWidth: N, showDots: Pe = !1, showActiveDots: Fe, connectNulls: Ie = !1, margin: P, showGrid: Le = !0, showTooltip: Re = !0, tooltipCursor: ze = !0, showLegend: Be = !0, legendPosition: F = "bottom", legendFontSize: I, legendAriaLabel: L, showXAxis: R = !0, showYAxis: z = !0, xTickFormatter: B, yTickFormatter: V, xAxisAngle: H, xAxisInterval: U, yAxisTickCount: Ve, yAxisDomain: He, yAxisOrientation: W, showSecondaryYAxis: Ue = !0, secondaryYAxisLabel: G, secondaryYUnit: We, secondaryYTickFormatter: Ge, secondaryYAxisTickCount: Ke, secondaryYAxisDomain: qe, gridDashed: Je, gridHorizontal: Ye, gridVertical: Xe, tooltipContent: Ze, animate: Qe, animationDuration: $e, animationBegin: et, animationEasing: tt, showLabels: nt = !1, labelPosition: rt, labelFormatter: it, showBrush: at = !1, brushHeight: ot, brushAriaLabel: st, ...ct }, lt) => {
22
+ }, xe = .85, Se = { top: 16 }, w = _.forwardRef(({ className: t, config: w, palette: Ce, data: T, series: E, xKey: D, referenceLine: O, referenceArea: k, orientation: A = "vertical", xAxisLabel: j, yAxisLabel: M, xUnit: we, yUnit: Te, curve: N = "monotone", barRadius: Ee = 4, barSize: De, barGap: Oe, barCategoryGap: ke, showBackground: Ae = !1, backgroundFill: je = "var(--ui-background-surface-secondary)", showActiveBar: Me = !1, fillOpacity: Ne = .3, strokeWidth: P, showDots: Pe = !1, showActiveDots: Fe, connectNulls: Ie = !1, margin: F, showGrid: Le = !0, showTooltip: Re = !0, tooltipCursor: ze = !0, showLegend: Be = !0, legendPosition: I = "bottom", legendFontSize: L, legendAriaLabel: R, showXAxis: z = !0, showYAxis: B = !0, xTickFormatter: V, yTickFormatter: H, xAxisAngle: U, xAxisInterval: Ve, yAxisTickCount: He, yAxisDomain: Ue, yAxisOrientation: W, showSecondaryYAxis: We = !0, secondaryYAxisLabel: G, secondaryYUnit: Ge, secondaryYTickFormatter: Ke, secondaryYAxisTickCount: qe, secondaryYAxisDomain: Je, gridDashed: Ye, gridHorizontal: Xe, gridVertical: Ze, tooltipContent: Qe, animate: $e, animationDuration: et, animationBegin: tt, animationEasing: nt, showLabels: rt = !1, labelPosition: it, labelFormatter: at, showBrush: ot = !1, brushHeight: st, brushAriaLabel: ct, ...lt }, ut) => {
23
23
  let K = l({
24
- animate: Qe,
25
- animationDuration: $e,
26
- animationBegin: et,
27
- animationEasing: tt
28
- }), q = k === "horizontal", ut = m(A), J = T.some((e) => e.yAxis === "secondary"), dt = T.some((e) => e.yAxis !== "secondary"), Y = J && !dt, ft = W ?? "left", pt = ft === "left" ? "right" : "left", mt = h(j, q ? "left" : ft), ht = h(G, pt), gt = m(G, "insideTop"), _t = u(He), vt = u(qe), X = (e) => {
29
- let t = e === "secondary" ? S : void 0;
24
+ animate: $e,
25
+ animationDuration: et,
26
+ animationBegin: tt,
27
+ animationEasing: nt
28
+ }), q = A === "horizontal", dt = m(j), J = E.some((e) => e.yAxis === "secondary"), ft = E.some((e) => e.yAxis !== "secondary"), Y = J && !ft, pt = W ?? "left", mt = pt === "left" ? "right" : "left", ht = h(M, q ? "left" : pt), gt = h(G, mt), _t = m(G, "insideTop"), vt = u(Ue), yt = u(Je), bt = g(T.length > 0, !!M), xt = g(T.length > 0, !!G), X = (e) => {
29
+ let t = e === "secondary" ? C : void 0;
30
30
  return q ? { xAxisId: t } : { yAxisId: t };
31
- }, yt = Y ? X("secondary") : {}, bt = ie(q ? [] : w.map((e) => e[E]), B), Z = g.useRef(null), Q = se(Z, H, A, bt.join("\0")), xt = D ? Array.isArray(D) ? D : [D] : [], St = (O ? Array.isArray(O) ? O : [O] : []).map((e) => ({
31
+ }, St = Y ? X("secondary") : {}, Ct = ie(q ? [] : T.map((e) => e[D]), V), wt = _.useRef(null), Z = se(wt, U, j, Ct.join("\0")), Tt = O ? Array.isArray(O) ? O : [O] : [], Et = (k ? Array.isArray(k) ? k : [k] : []).map((e) => ({
32
32
  area: e,
33
- range: f(e, w, E)
34
- })).filter((e) => e.range !== void 0), Ct = Y ? "secondary" : "primary", wt = (e) => e.yAxis ?? "primary", Tt = new Map(T.map((e) => [e.key, wt(e)])), Et = (e) => T.filter((t) => wt(t) === e).map((e) => e.key), Dt = new Set(T.filter((e) => e.legendType === "none").map((e) => e.key)), $ = (e) => w[e]?.[E] ?? void 0, Ot = xt.map((e) => {
33
+ range: f(e, T, D)
34
+ })).filter((e) => e.range !== void 0), Dt = Y ? "secondary" : "primary", Ot = (e) => e.yAxis ?? "primary", kt = new Map(E.map((e) => [e.key, Ot(e)])), At = (e) => E.filter((t) => Ot(t) === e).map((e) => e.key), jt = new Set(E.filter((e) => e.legendType === "none").map((e) => e.key)), Q = (e) => T[e]?.[D] ?? void 0, Mt = Tt.map((e) => {
35
35
  let t = e.category === void 0 ? void 0 : f({
36
36
  from: e.category,
37
37
  to: e.category
38
- }, w, E), n = e.yAxis ?? (typeof e.average == "string" ? Tt.get(e.average) ?? Ct : Ct), r = p(e, w, Et(n)), i = t ? $(t[0]) : void 0;
38
+ }, T, D), n = e.yAxis ?? (typeof e.average == "string" ? kt.get(e.average) ?? Dt : Dt), r = p(e, T, At(n)), i = t ? Q(t[0]) : void 0;
39
39
  return {
40
40
  line: e,
41
41
  lineAxis: n,
42
42
  position: r === void 0 ? i === void 0 ? void 0 : q ? { y: i } : { x: i } : q ? { x: r } : { y: r },
43
43
  isVerticalRule: r !== void 0 === q
44
44
  };
45
- }).filter((e) => e.position !== void 0), kt = nt ? c : void 0, At = Ot.some((e) => e.line.label && e.isVerticalRule) ? Se : void 0, jt = P || kt || At ? {
46
- ...P ? be : {},
47
- ...At,
48
- ...kt,
49
- ...P
50
- } : void 0, Mt = oe(jt, Q.margin), Nt = /* @__PURE__ */ new Map();
51
- T.forEach((e, t) => {
52
- e.stackId && e.type !== "line" && Nt.set(`${e.type}-${e.stackId}`, t);
45
+ }).filter((e) => e.position !== void 0), $ = rt ? c : void 0, Nt = Mt.some((e) => e.line.label && e.isVerticalRule) ? Se : void 0, Pt = F || $ || Nt ? {
46
+ ...F ? be : {},
47
+ ...Nt,
48
+ ...$,
49
+ ...F
50
+ } : void 0, Ft = oe(Pt, Z.margin), It = /* @__PURE__ */ new Map();
51
+ E.forEach((e, t) => {
52
+ e.stackId && e.type !== "line" && It.set(`${e.type}-${e.stackId}`, t);
53
53
  });
54
- let Pt = () => /* @__PURE__ */ y(_, { children: [
55
- /* @__PURE__ */ v(b, {
54
+ let Lt = () => /* @__PURE__ */ b(v, { children: [
55
+ /* @__PURE__ */ y(x, {
56
56
  type: "number",
57
- hide: !R || Y,
57
+ hide: !z || Y,
58
58
  tickLine: !1,
59
59
  axisLine: !1,
60
60
  unit: we,
61
- tickFormatter: B,
62
- angle: H,
63
- interval: U,
64
- textAnchor: re(H),
65
- tickCount: Ve,
66
- domain: _t,
67
- height: Q.height,
68
- label: ut
61
+ tickFormatter: V,
62
+ angle: U,
63
+ interval: Ve,
64
+ textAnchor: re(U),
65
+ tickCount: He,
66
+ domain: vt,
67
+ height: Z.height,
68
+ label: dt
69
69
  }),
70
- /* @__PURE__ */ v(x, {
71
- dataKey: E,
70
+ /* @__PURE__ */ y(S, {
71
+ dataKey: D,
72
72
  type: "category",
73
- hide: !z,
73
+ hide: !B,
74
74
  tickLine: !1,
75
75
  axisLine: !1,
76
- tickFormatter: V,
77
- width: j ? 96 : 80,
78
- label: mt
76
+ tickFormatter: H,
77
+ width: M ? 96 : 80,
78
+ label: ht
79
79
  }),
80
- J && /* @__PURE__ */ v(b, {
81
- xAxisId: S,
80
+ J && /* @__PURE__ */ y(x, {
81
+ xAxisId: C,
82
82
  type: "number",
83
- hide: !Ue,
83
+ hide: !We,
84
84
  orientation: "top",
85
85
  tickLine: !1,
86
86
  axisLine: !1,
87
- unit: We,
88
- tickFormatter: Ge,
89
- tickCount: Ke,
90
- domain: vt,
91
- label: gt
87
+ unit: Ge,
88
+ tickFormatter: Ke,
89
+ tickCount: qe,
90
+ domain: yt,
91
+ label: _t
92
92
  })
93
- ] }), Ft = () => /* @__PURE__ */ y(_, { children: [
94
- /* @__PURE__ */ v(b, {
95
- dataKey: E,
93
+ ] }), Rt = () => /* @__PURE__ */ b(v, { children: [
94
+ /* @__PURE__ */ y(x, {
95
+ dataKey: D,
96
96
  type: "category",
97
- hide: !R,
97
+ hide: !z,
98
98
  tickLine: !1,
99
99
  axisLine: !1,
100
100
  tickMargin: 8,
101
- tickFormatter: B,
102
- angle: H,
103
- interval: U,
104
- textAnchor: re(H),
105
- height: Q.height,
106
- label: ut
101
+ tickFormatter: V,
102
+ angle: U,
103
+ interval: Ve,
104
+ textAnchor: re(U),
105
+ height: Z.height,
106
+ label: dt
107
107
  }),
108
- /* @__PURE__ */ v(x, {
108
+ /* @__PURE__ */ y(S, {
109
109
  type: "number",
110
- hide: !z || Y,
110
+ hide: !B || Y,
111
111
  ...W ? { orientation: W } : {},
112
112
  tickLine: !1,
113
113
  axisLine: !1,
114
114
  unit: Te,
115
- tickFormatter: V,
116
- tickCount: Ve,
117
- domain: _t,
118
- width: j ? 72 : void 0,
119
- label: mt
115
+ tickFormatter: H,
116
+ tickCount: He,
117
+ domain: vt,
118
+ width: bt,
119
+ label: ht
120
120
  }),
121
- J && /* @__PURE__ */ v(x, {
122
- yAxisId: S,
121
+ J && /* @__PURE__ */ y(S, {
122
+ yAxisId: C,
123
123
  type: "number",
124
- hide: !Ue,
125
- orientation: pt,
124
+ hide: !We,
125
+ orientation: mt,
126
126
  tickLine: !1,
127
127
  axisLine: !1,
128
- unit: We,
129
- tickFormatter: Ge,
130
- tickCount: Ke,
131
- domain: vt,
132
- width: G ? 72 : void 0,
133
- label: ht
128
+ unit: Ge,
129
+ tickFormatter: Ke,
130
+ tickCount: qe,
131
+ domain: yt,
132
+ width: xt,
133
+ label: gt
134
134
  })
135
- ] }), It = Dt.size > 0 ? (e) => /* @__PURE__ */ v(i, {
136
- verticalAlign: F,
137
- fontSize: I,
138
- ariaLabel: L,
139
- payload: e.payload?.filter((e) => !Dt.has(String(e.dataKey)))
140
- }) : /* @__PURE__ */ v(i, {
141
- verticalAlign: F,
142
- fontSize: I,
143
- ariaLabel: L
144
- }), Lt = (e, t) => {
135
+ ] }), zt = jt.size > 0 ? (e) => /* @__PURE__ */ y(i, {
136
+ verticalAlign: I,
137
+ fontSize: L,
138
+ ariaLabel: R,
139
+ payload: e.payload?.filter((e) => !jt.has(String(e.dataKey)))
140
+ }) : /* @__PURE__ */ y(i, {
141
+ verticalAlign: I,
142
+ fontSize: L,
143
+ ariaLabel: R
144
+ }), Bt = (e, t) => {
145
145
  let n = e.color ?? `var(--color-${s(e.key)})`, r = ve + t, i = X(e.yAxis), a = e.stackId && e.type !== "line" ? `${e.type}-${e.stackId}` : void 0, o = e.fillOpacity ?? Ne, c = e.connectNulls ?? Ie, l = e.showDots ?? Pe, u = e.showActiveDots ?? Fe, d = e.legendType ? { legendType: e.legendType } : {}, f = ee({
146
- labelPosition: rt,
146
+ labelPosition: it,
147
147
  isStacked: a !== void 0,
148
148
  growingEnd: q ? "right" : "top"
149
- }), p = nt ? /* @__PURE__ */ v(pe, {
149
+ }), p = rt ? /* @__PURE__ */ y(pe, {
150
150
  dataKey: e.key,
151
151
  position: f,
152
- formatter: ae(it),
152
+ formatter: ae(at),
153
153
  className: te(f, { translucentSeries: e.type === "area" }),
154
154
  fontSize: 12
155
155
  }) : null;
156
156
  if (e.type === "bar") {
157
- let o = e.barRadius ?? Ee, s = a === void 0 || Nt.get(a) === t, c = e.showBackground ?? Ae, l = e.showActiveBar ?? Me;
158
- return /* @__PURE__ */ v(le, {
157
+ let o = e.barRadius ?? Ee, s = a === void 0 || It.get(a) === t, c = e.showBackground ?? Ae, l = e.showActiveBar ?? Me;
158
+ return /* @__PURE__ */ y(le, {
159
159
  dataKey: e.key,
160
160
  ...i,
161
161
  fill: n,
@@ -187,9 +187,9 @@ var _e = t("", {
187
187
  }, e.key);
188
188
  }
189
189
  if (e.type === "area") {
190
- let t = e.strokeWidth ?? N, s = t === void 0 ? {} : { strokeWidth: t };
191
- return /* @__PURE__ */ v(ce, {
192
- type: e.curve ?? M,
190
+ let t = e.strokeWidth ?? P, s = t === void 0 ? {} : { strokeWidth: t };
191
+ return /* @__PURE__ */ y(ce, {
192
+ type: e.curve ?? N,
193
193
  dataKey: e.key,
194
194
  ...i,
195
195
  stroke: n,
@@ -207,12 +207,12 @@ var _e = t("", {
207
207
  children: p
208
208
  }, e.key);
209
209
  }
210
- return /* @__PURE__ */ v(me, {
211
- type: e.curve ?? M,
210
+ return /* @__PURE__ */ y(me, {
211
+ type: e.curve ?? N,
212
212
  dataKey: e.key,
213
213
  ...i,
214
214
  stroke: n,
215
- strokeWidth: e.strokeWidth ?? N ?? 2,
215
+ strokeWidth: e.strokeWidth ?? P ?? 2,
216
216
  dot: l ? { r: 3 } : !1,
217
217
  zIndex: r,
218
218
  ...e.strokeDasharray === void 0 ? {} : { strokeDasharray: e.strokeDasharray },
@@ -222,16 +222,16 @@ var _e = t("", {
222
222
  ...K,
223
223
  children: p
224
224
  }, e.key);
225
- }, Rt = ({ area: e, range: t }, n) => {
225
+ }, Vt = ({ area: e, range: t }, n) => {
226
226
  let [r, i] = t;
227
- return /* @__PURE__ */ v(he, {
228
- ...yt,
227
+ return /* @__PURE__ */ y(he, {
228
+ ...St,
229
229
  ...q ? {
230
- y1: $(r),
231
- y2: $(i)
230
+ y1: Q(r),
231
+ y2: Q(i)
232
232
  } : {
233
- x1: $(r),
234
- x2: $(i)
233
+ x1: Q(r),
234
+ x2: Q(i)
235
235
  },
236
236
  fill: "var(--ui-background-surface-secondary)",
237
237
  fillOpacity: .6,
@@ -244,53 +244,53 @@ var _e = t("", {
244
244
  fontSize: 12
245
245
  } : void 0
246
246
  }, `${e.label ?? "area"}-${n}`);
247
- }, zt = ({ line: e, lineAxis: t, position: n, isVerticalRule: r }, i) => /* @__PURE__ */ v(ge, {
247
+ }, Ht = ({ line: e, lineAxis: t, position: n, isVerticalRule: r }, i) => /* @__PURE__ */ y(ge, {
248
248
  ...t === "secondary" && J ? X("secondary") : {},
249
249
  ...n,
250
250
  ...ne(e.label, e.labelPosition ?? (r ? "top" : "insideTopRight"))
251
251
  }, `${e.label ?? "ref"}-${i}`);
252
- return /* @__PURE__ */ v("div", {
253
- ref: lt,
254
- "data-orientation": k,
255
- className: e(_e({ orientation: k }), t),
256
- ...ct,
257
- children: /* @__PURE__ */ v(n, {
258
- ref: Z,
259
- config: C,
252
+ return /* @__PURE__ */ y("div", {
253
+ ref: ut,
254
+ "data-orientation": A,
255
+ className: e(_e({ orientation: A }), t),
256
+ ...lt,
257
+ children: /* @__PURE__ */ y(n, {
258
+ ref: wt,
259
+ config: w,
260
260
  palette: Ce,
261
261
  className: "size-full [&_.recharts-label]:fill-foreground",
262
- children: /* @__PURE__ */ y(fe, {
263
- data: w,
262
+ children: /* @__PURE__ */ b(fe, {
263
+ data: T,
264
264
  layout: q ? "vertical" : "horizontal",
265
265
  barSize: De,
266
266
  barGap: Oe,
267
267
  barCategoryGap: ke,
268
- margin: Mt,
268
+ margin: Ft,
269
269
  children: [
270
- Le && /* @__PURE__ */ v(de, {
271
- ...yt,
272
- horizontal: Ye ?? !q,
273
- vertical: Xe ?? q,
274
- strokeDasharray: Je ? "3 3" : void 0
270
+ Le && /* @__PURE__ */ y(de, {
271
+ ...St,
272
+ horizontal: Xe ?? !q,
273
+ vertical: Ze ?? q,
274
+ strokeDasharray: Ye ? "3 3" : void 0
275
275
  }),
276
- q ? Pt() : Ft(),
277
- Re && /* @__PURE__ */ v(a, {
276
+ q ? Lt() : Rt(),
277
+ Re && /* @__PURE__ */ y(a, {
278
278
  ...ze ? {} : { cursor: !1 },
279
- content: Ze ?? /* @__PURE__ */ v(o, {})
279
+ content: Qe ?? /* @__PURE__ */ y(o, {})
280
280
  }),
281
- Be && /* @__PURE__ */ v(r, {
282
- verticalAlign: F,
283
- content: It
281
+ Be && /* @__PURE__ */ y(r, {
282
+ verticalAlign: I,
283
+ content: zt
284
284
  }),
285
- T.map(Lt),
286
- St.map(Rt),
287
- Ot.map(zt),
288
- at && /* @__PURE__ */ v(ue, {
289
- dataKey: E,
290
- tickFormatter: q ? V : B,
285
+ E.map(Bt),
286
+ Et.map(Vt),
287
+ Mt.map(Ht),
288
+ ot && /* @__PURE__ */ y(ue, {
289
+ dataKey: D,
290
+ tickFormatter: q ? H : V,
291
291
  ...d({
292
- brushHeight: ot,
293
- brushAriaLabel: st
292
+ brushHeight: st,
293
+ brushAriaLabel: ct
294
294
  })
295
295
  })
296
296
  ]
@@ -298,8 +298,8 @@ var _e = t("", {
298
298
  })
299
299
  });
300
300
  });
301
- C.displayName = "ComposedChart";
301
+ w.displayName = "ComposedChart";
302
302
  //#endregion
303
- export { C as ComposedChart, _e as composedChartVariants };
303
+ export { w as ComposedChart, _e as composedChartVariants };
304
304
 
305
305
  //# sourceMappingURL=composed-chart.js.map