@hybridcore/ui 1.6.4 → 1.6.6

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 (35) hide show
  1. package/CATALOG.md +1 -0
  2. package/dist/IconX-C2wmVYSK.js +11 -0
  3. package/dist/components/charts/_common/format.js +49 -0
  4. package/dist/components/charts/_common/utils.js +12 -7
  5. package/dist/components/charts/chart-wrapper/index.js +36 -34
  6. package/dist/components/charts/column-line-mix/logic.js +78 -78
  7. package/dist/components/charts/donut-chart/index.js +11 -0
  8. package/dist/components/charts/donut-chart/logic.js +67 -0
  9. package/dist/components/charts/donut-chart/styled.js +12 -0
  10. package/dist/components/charts/drill-down-treemap/logic.js +123 -123
  11. package/dist/components/charts/drill-down-voronoi-treemap/logic.js +253 -252
  12. package/dist/components/charts/heatmap/logic.js +73 -73
  13. package/dist/components/charts/line/logic.js +66 -66
  14. package/dist/components/charts/logaritmic-scale/logic.js +65 -65
  15. package/dist/components/charts/multiple-value-axes/logic.js +75 -74
  16. package/dist/components/charts/nested-pie/logic.js +43 -42
  17. package/dist/components/charts/packed-circles/logic.js +111 -110
  18. package/dist/components/charts/pie-chart/logic.js +40 -39
  19. package/dist/components/charts/stacked-area-radar/logic.js +51 -51
  20. package/dist/components/charts/stacked-column-chart/logic.js +79 -79
  21. package/dist/components/charts/xy-chart/logic.js +71 -71
  22. package/dist/components/color-picker/index.js +1645 -1602
  23. package/dist/components/color-picker/logic.js +21 -12
  24. package/dist/components/color-picker/styled.js +4 -2
  25. package/dist/components/date-range-picker/index.js +359 -365
  26. package/dist/components/metric-card/helpers.js +12 -5
  27. package/dist/components/metric-card/logic.js +65 -57
  28. package/dist/components/metric-card/styled.js +55 -47
  29. package/dist/components/simple-pivot-table/index.js +129 -54
  30. package/dist/components/simple-pivot-table/logic.js +111 -45
  31. package/dist/components/simple-pivot-table/styled.js +31 -11
  32. package/dist/main.d.ts +128 -8
  33. package/dist/main.js +163 -157
  34. package/dist/{styled-Db1RdcPA.js → styled-SoqbyrkW.js} +116 -89
  35. package/package.json +1 -1
@@ -1,42 +1,42 @@
1
- import { R as L, A as C, T as u } from "../../../AnimatedTheme-jnasw6rT.js";
2
- import { useThemeProps as R, useTheme as I } from "@mui/material";
3
- import y from "lodash";
4
- import { useId as E, useRef as O, useEffect as P } from "react";
5
- import { colorSetFromPalette as q } from "../_common/utils.js";
6
- import { c as s } from "../../../ColorSet-C7vpNXhM.js";
7
- import { X as B, V } from "../../../AxisRenderer-DTyLLA6c.js";
8
- import { X as z } from "../../../XYCursor-C8WktvKM.js";
9
- import { D as G } from "../../../DateAxis-YX3QNIB-.js";
10
- import { A as X, a as H } from "../../../AxisRendererY-C_ItLPNV.js";
11
- import { C as N } from "../../../CategoryAxis-CwnfaGc8.js";
12
- import { L as U } from "../../../LineSeries-Uiv5o56b.js";
13
- import { D as W } from "../../../DataProcessor-CHDO51q4.js";
14
- import { S as Z } from "../../../Scrollbar-D86MJyr2.js";
15
- const me = (F) => {
16
- const f = R({ props: F, name: "HCLogaritmicScale" }), {
1
+ import { R as C, A as R, T as u } from "../../../AnimatedTheme-jnasw6rT.js";
2
+ import { useThemeProps as I, useTheme as E } from "@mui/material";
3
+ import F from "lodash";
4
+ import { useId as O, useRef as P, useEffect as V } from "react";
5
+ import { colorSetFromPalette as q, applyValueFormat as B } from "../_common/utils.js";
6
+ import { c as i } from "../../../ColorSet-C7vpNXhM.js";
7
+ import { X as z, V as G } from "../../../AxisRenderer-DTyLLA6c.js";
8
+ import { X as H } from "../../../XYCursor-C8WktvKM.js";
9
+ import { D as N } from "../../../DateAxis-YX3QNIB-.js";
10
+ import { A as X, a as U } from "../../../AxisRendererY-C_ItLPNV.js";
11
+ import { C as W } from "../../../CategoryAxis-CwnfaGc8.js";
12
+ import { L as Z } from "../../../LineSeries-Uiv5o56b.js";
13
+ import { D as _ } from "../../../DataProcessor-CHDO51q4.js";
14
+ import { S as $ } from "../../../Scrollbar-D86MJyr2.js";
15
+ const ce = (b) => {
16
+ const f = I({ props: b, name: "HCLogaritmicScale" }), {
17
17
  dimensions: t,
18
- values: c,
19
- data: i,
20
- initDelay: b = 0,
21
- baseInterval: k,
18
+ values: a,
19
+ data: l,
20
+ initDelay: k = 0,
21
+ baseInterval: S,
22
22
  colors: h,
23
- sx: S,
24
- ...T
25
- } = f, o = I(), v = `hc-logaritmic-scale-${E().replace(/:/g, "")}`, p = O(null);
26
- let l = null;
27
- t.length < 1 ? l = "LogaritmicScale requires at least 1 dimension" : c.length < 1 && (l = "LogaritmicScale requires at least 1 value"), P(() => {
28
- if (l) return;
23
+ sx: T,
24
+ ...D
25
+ } = f, o = E(), g = `hc-logaritmic-scale-${O().replace(/:/g, "")}`, c = P(null);
26
+ let n = null;
27
+ t.length < 1 ? n = "LogaritmicScale requires at least 1 dimension" : a.length < 1 && (n = "LogaritmicScale requires at least 1 value"), V(() => {
28
+ if (n) return;
29
29
  let d;
30
30
  return d = setTimeout(() => {
31
- var A, w, x;
32
- const e = L.new(v);
33
- p.current = e, e.setThemes([C.new(e)]), e.interfaceColors.setAll({
34
- text: s(o.palette.text.primary),
35
- grid: s(o.palette.divider),
36
- stroke: s(o.palette.divider)
31
+ var v, w, x, y;
32
+ const e = C.new(g);
33
+ c.current = e, e.setThemes([R.new(e)]), e.interfaceColors.setAll({
34
+ text: i(o.palette.text.primary),
35
+ grid: i(o.palette.divider),
36
+ stroke: i(o.palette.divider)
37
37
  });
38
38
  const r = e.container.children.push(
39
- B.new(e, {
39
+ z.new(e, {
40
40
  panX: !0,
41
41
  panY: !0,
42
42
  wheelX: "none",
@@ -46,22 +46,22 @@ const me = (F) => {
46
46
  );
47
47
  r.set("colors", q(e, h)), r.set(
48
48
  "cursor",
49
- z.new(e, { behavior: "none" })
49
+ H.new(e, { behavior: "none" })
50
50
  ).lineY.set("visible", !1);
51
- let a, n = i;
52
- t[0].type === "date" ? (n = y.orderBy(i, [t[0].value]), a = r.xAxes.push(
53
- G.new(e, {
51
+ let s, m = l;
52
+ t[0].type === "date" ? (m = F.orderBy(l, [t[0].value]), s = r.xAxes.push(
53
+ N.new(e, {
54
54
  maxDeviation: 0.1,
55
55
  groupData: !1,
56
- baseInterval: k || { timeUnit: "day", count: 1 },
56
+ baseInterval: S || { timeUnit: "day", count: 1 },
57
57
  renderer: X.new(e, {}),
58
58
  tooltip: u.new(e, {})
59
59
  })
60
- ), (A = a.get("renderer")) == null || A.grid.template.setAll({
61
- stroke: s(o.palette.divider),
60
+ ), (v = s.get("renderer")) == null || v.grid.template.setAll({
61
+ stroke: i(o.palette.divider),
62
62
  strokeOpacity: 1
63
- })) : (a = r.xAxes.push(
64
- N.new(e, {
63
+ })) : (s = r.xAxes.push(
64
+ W.new(e, {
65
65
  categoryField: t[0].value,
66
66
  renderer: X.new(e, {}),
67
67
  tooltip: u.new(e, {})
@@ -69,45 +69,45 @@ const me = (F) => {
69
69
  ), e.numberFormatter.setAll({
70
70
  numberFormat: "#",
71
71
  numericFields: ["valueX"]
72
- }), n = y.orderBy(i, [t[0].value]), a.data.setAll(n), (w = a.get("renderer")) == null || w.grid.template.setAll({
73
- stroke: s(o.palette.divider),
72
+ }), m = F.orderBy(l, [t[0].value]), s.data.setAll(m), (w = s.get("renderer")) == null || w.grid.template.setAll({
73
+ stroke: i(o.palette.divider),
74
74
  strokeOpacity: 1
75
75
  }));
76
- const g = r.yAxes.push(
77
- V.new(e, {
76
+ const A = r.yAxes.push(
77
+ G.new(e, {
78
78
  logarithmic: !0,
79
- renderer: H.new(e, { minorGridEnabled: !0 })
79
+ renderer: U.new(e, { minorGridEnabled: !0 })
80
80
  })
81
81
  );
82
- (x = g.get("renderer")) == null || x.grid.template.setAll({
83
- stroke: s(o.palette.divider),
82
+ (x = A.get("renderer")) == null || x.grid.template.setAll({
83
+ stroke: i(o.palette.divider),
84
84
  strokeOpacity: 1
85
- }), c.forEach((Y) => {
86
- const m = r.series.push(
87
- U.new(e, {
88
- xAxis: a,
89
- yAxis: g,
90
- valueYField: Y.dataFieldName,
85
+ }), a.forEach((L) => {
86
+ const p = r.series.push(
87
+ Z.new(e, {
88
+ xAxis: s,
89
+ yAxis: A,
90
+ valueYField: L.dataFieldName,
91
91
  ...t[0].type === "date" ? { valueXField: t[0].value } : { categoryXField: t[0].value },
92
92
  tooltip: u.new(e, { labelText: "{valueY}" })
93
93
  })
94
94
  );
95
- m.strokes.template.setAll({ strokeWidth: 3 }), t[0].type === "date" && (m.data.processor = W.new(e, {
95
+ p.strokes.template.setAll({ strokeWidth: 3 }), t[0].type === "date" && (p.data.processor = _.new(e, {
96
96
  dateFormat: "i",
97
97
  dateFields: [t[0].value]
98
- })), m.data.setAll(n), m.appear(1e3);
98
+ })), p.data.setAll(m), p.appear(1e3);
99
99
  }), r.set(
100
100
  "scrollbarX",
101
- Z.new(e, { orientation: "horizontal" })
102
- ), r.appear(1e3, 100);
103
- }, b), () => {
101
+ $.new(e, { orientation: "horizontal" })
102
+ ), B(e, (y = a == null ? void 0 : a[0]) == null ? void 0 : y.format), r.appear(1e3, 100);
103
+ }, k), () => {
104
104
  var e;
105
- d && clearTimeout(d), (e = p.current) == null || e.dispose(), p.current = null;
105
+ d && clearTimeout(d), (e = c.current) == null || e.dispose(), c.current = null;
106
106
  };
107
- }, [i, t, c, o.palette.mode, h]);
108
- const D = { ...f };
109
- return { chartId: v, ownerState: D, sx: S, error: l, other: T };
107
+ }, [l, t, a, o.palette.mode, h]);
108
+ const Y = { ...f };
109
+ return { chartId: g, ownerState: Y, sx: T, error: n, other: D };
110
110
  };
111
111
  export {
112
- me as useLogaritmicScaleLogic
112
+ ce as useLogaritmicScaleLogic
113
113
  };
@@ -1,19 +1,19 @@
1
- import { G as P, R as W, A as M, T, b as j } from "../../../AnimatedTheme-jnasw6rT.js";
2
- import { useThemeProps as q, useTheme as z } from "@mui/material";
1
+ import { G as P, R as M, A as j, T, b as q } from "../../../AnimatedTheme-jnasw6rT.js";
2
+ import { useThemeProps as z, useTheme as U } from "@mui/material";
3
3
  import C from "lodash";
4
- import { useId as U, useRef as $, useEffect as H } from "react";
5
- import { colorSetFromPalette as J } from "../_common/utils.js";
4
+ import { useId as $, useRef as H, useEffect as J } from "react";
5
+ import { colorSetFromPalette as K, applyValueFormat as Q } from "../_common/utils.js";
6
6
  import { c as D, a as w } from "../../../ColorSet-C7vpNXhM.js";
7
- import { X as K, V as Q } from "../../../AxisRenderer-DTyLLA6c.js";
8
- import { L as Z } from "../../../Legend-Dp_MKfS4.js";
9
- import { D as ee } from "../../../DateAxis-YX3QNIB-.js";
10
- import { A as N, a as te } from "../../../AxisRendererY-C_ItLPNV.js";
11
- import { C as re } from "../../../CategoryAxis-CwnfaGc8.js";
12
- import { X as se } from "../../../XYCursor-C8WktvKM.js";
13
- import { L as ae } from "../../../LineSeries-Uiv5o56b.js";
14
- import { D as ie } from "../../../DataProcessor-CHDO51q4.js";
15
- import { C as oe } from "../../../Circle-Cy5s-pVc.js";
16
- import { B as le } from "../../../Bullet-DVczI2TD.js";
7
+ import { X as Z, V as ee } from "../../../AxisRenderer-DTyLLA6c.js";
8
+ import { L as te } from "../../../Legend-Dp_MKfS4.js";
9
+ import { D as re } from "../../../DateAxis-YX3QNIB-.js";
10
+ import { A as F, a as se } from "../../../AxisRendererY-C_ItLPNV.js";
11
+ import { C as ae } from "../../../CategoryAxis-CwnfaGc8.js";
12
+ import { X as ie } from "../../../XYCursor-C8WktvKM.js";
13
+ import { L as oe } from "../../../LineSeries-Uiv5o56b.js";
14
+ import { D as le } from "../../../DataProcessor-CHDO51q4.js";
15
+ import { C as ne } from "../../../Circle-Cy5s-pVc.js";
16
+ import { B as ce } from "../../../Bullet-DVczI2TD.js";
17
17
  class x extends P {
18
18
  _beforeChanged() {
19
19
  super._beforeChanged(), (this.isDirty("width") || this.isDirty("height") || this.isPrivateDirty("width") || this.isPrivateDirty("height")) && (this._clear = !0);
@@ -22,8 +22,8 @@ class x extends P {
22
22
  super._changed(), this._clear && !this.get("draw") && this._draw();
23
23
  }
24
24
  _draw() {
25
- const n = this.width(), r = this.height(), s = this._display;
26
- s.moveTo(-n / 2, r / 2), s.lineTo(0, -r / 2), s.lineTo(n / 2, r / 2), s.lineTo(-n / 2, r / 2), s.closePath();
25
+ const n = this.width(), s = this.height(), t = this._display;
26
+ t.moveTo(-n / 2, s / 2), t.lineTo(0, -s / 2), t.lineTo(n / 2, s / 2), t.lineTo(-n / 2, s / 2), t.closePath();
27
27
  }
28
28
  _updateSize() {
29
29
  this.markDirty(), this._clear = !0;
@@ -41,30 +41,31 @@ Object.defineProperty(x, "classNames", {
41
41
  writable: !0,
42
42
  value: P.classNames.concat([x.className])
43
43
  });
44
- const A = ["CIRCLE", "RECTANGLE", "TRIANGLE"], De = (L) => {
45
- const n = q({ props: L, name: "HCMultipleValueAxes" }), {
46
- dimensions: r,
47
- values: s,
48
- data: p,
44
+ const A = ["CIRCLE", "RECTANGLE", "TRIANGLE"], Re = (L) => {
45
+ const n = z({ props: L, name: "HCMultipleValueAxes" }), {
46
+ dimensions: s,
47
+ values: t,
48
+ data: d,
49
49
  initDelay: X = 0,
50
50
  baseInterval: Y,
51
51
  colors: R,
52
- sx: F,
53
- ...I
54
- } = n, h = z(), _ = `hc-multiple-value-axes-${U().replace(/:/g, "")}`, y = $(null);
55
- let m = null;
56
- r.length < 1 ? m = "MultipleValueAxes requires at least 1 dimension" : s.length < 1 && (m = "MultipleValueAxes requires at least 1 value"), H(() => {
57
- if (m) return;
58
- let v;
59
- return v = setTimeout(() => {
60
- const e = W.new(_);
61
- y.current = e, e.setThemes([M.new(e)]), e.interfaceColors.setAll({
62
- text: D(h.palette.text.primary),
63
- grid: D(h.palette.divider),
64
- stroke: D(h.palette.divider)
52
+ sx: I,
53
+ ...O
54
+ } = n, m = U(), _ = `hc-multiple-value-axes-${$().replace(/:/g, "")}`, y = H(null);
55
+ let h = null;
56
+ s.length < 1 ? h = "MultipleValueAxes requires at least 1 dimension" : t.length < 1 && (h = "MultipleValueAxes requires at least 1 value"), J(() => {
57
+ if (h) return;
58
+ let b;
59
+ return b = setTimeout(() => {
60
+ var N;
61
+ const e = M.new(_);
62
+ y.current = e, e.setThemes([j.new(e)]), e.interfaceColors.setAll({
63
+ text: D(m.palette.text.primary),
64
+ grid: D(m.palette.divider),
65
+ stroke: D(m.palette.divider)
65
66
  });
66
- const t = e.container.children.push(
67
- K.new(e, {
67
+ const r = e.container.children.push(
68
+ Z.new(e, {
68
69
  panX: !1,
69
70
  panY: !1,
70
71
  wheelX: "none",
@@ -72,36 +73,36 @@ const A = ["CIRCLE", "RECTANGLE", "TRIANGLE"], De = (L) => {
72
73
  layout: e.verticalLayout
73
74
  })
74
75
  );
75
- t.set("colors", J(e, R)), t.get("colors", {}).set("step", 3);
76
- const B = t.children.push(
77
- Z.new(e, { centerX: w, x: w })
78
- ), o = r[0];
79
- let u, d = p;
80
- o.type === "date" ? (u = t.xAxes.push(
81
- ee.new(e, {
76
+ r.set("colors", K(e, R)), r.get("colors", {}).set("step", 3);
77
+ const B = r.children.push(
78
+ te.new(e, { centerX: w, x: w })
79
+ ), o = s[0];
80
+ let u, p = d;
81
+ o.type === "date" ? (u = r.xAxes.push(
82
+ re.new(e, {
82
83
  maxDeviation: 0.1,
83
84
  groupData: !1,
84
85
  baseInterval: Y || { timeUnit: "day", count: 1 },
85
- renderer: N.new(e, {}),
86
+ renderer: F.new(e, {}),
86
87
  tooltip: T.new(e, {})
87
88
  })
88
- ), d = C.orderBy(p, [o.value])) : (u = t.xAxes.push(
89
- re.new(e, {
89
+ ), p = C.orderBy(d, [o.value])) : (u = r.xAxes.push(
90
+ ae.new(e, {
90
91
  categoryField: o.value,
91
- renderer: N.new(e, {}),
92
+ renderer: F.new(e, {}),
92
93
  tooltip: T.new(e, {})
93
94
  })
94
95
  ), e.numberFormatter.setAll({
95
96
  numberFormat: "#",
96
97
  numericFields: ["valueX"]
97
- }), d = C.orderBy(p, [o.value]), u.data.setAll(d));
98
- function E(l, i, c, G, S, b, V) {
99
- const f = te.new(e, { opposite: S }), k = t.yAxes.push(
100
- Q.new(e, { maxDeviation: 1, renderer: f })
98
+ }), p = C.orderBy(d, [o.value]), u.data.setAll(p));
99
+ function E(l, i, c, G, S, v, W) {
100
+ const f = se.new(e, { opposite: S }), k = r.yAxes.push(
101
+ ee.new(e, { maxDeviation: 1, renderer: f })
101
102
  );
102
- t.yAxes.indexOf(k) > 0 && k.set("syncWithAxis", t.yAxes.getIndex(0));
103
- const a = t.series.push(
104
- ae.new(e, {
103
+ r.yAxes.indexOf(k) > 0 && k.set("syncWithAxis", r.yAxes.getIndex(0));
104
+ const a = r.series.push(
105
+ oe.new(e, {
105
106
  name: i,
106
107
  xAxis: u,
107
108
  yAxis: k,
@@ -117,12 +118,12 @@ const A = ["CIRCLE", "RECTANGLE", "TRIANGLE"], De = (L) => {
117
118
  stroke: a.get("fill"),
118
119
  strokeOpacity: 1,
119
120
  opacity: 1
120
- }), V === "date" && (a.data.processor = ie.new(e, {
121
+ }), W === "date" && (a.data.processor = le.new(e, {
121
122
  dateFormat: "i",
122
123
  dateFields: [c]
123
- })), b !== void 0 && a.bullets.push(function() {
124
+ })), v !== void 0 && a.bullets.push(function() {
124
125
  let g;
125
- return b === "RECTANGLE" ? g = j.new(e, {
126
+ return v === "RECTANGLE" ? g = q.new(e, {
126
127
  width: 10,
127
128
  height: 10,
128
129
  centerX: w,
@@ -130,39 +131,39 @@ const A = ["CIRCLE", "RECTANGLE", "TRIANGLE"], De = (L) => {
130
131
  strokeWidth: 2,
131
132
  stroke: a.get("stroke"),
132
133
  fill: e.interfaceColors.get("background")
133
- }) : b === "TRIANGLE" ? g = x.new(e, {
134
+ }) : v === "TRIANGLE" ? g = x.new(e, {
134
135
  width: 10,
135
136
  height: 10,
136
137
  strokeWidth: 2,
137
138
  stroke: a.get("stroke"),
138
139
  fill: e.interfaceColors.get("background")
139
- }) : g = oe.new(e, {
140
+ }) : g = ne.new(e, {
140
141
  strokeWidth: 2,
141
142
  radius: 4,
142
143
  stroke: a.get("stroke"),
143
144
  fill: e.interfaceColors.get("background")
144
- }), le.new(e, { sprite: g });
145
+ }), ce.new(e, { sprite: g });
145
146
  }), a.data.setAll(l);
146
147
  }
147
- if (t.set(
148
+ if (r.set(
148
149
  "cursor",
149
- se.new(e, { xAxis: u, behavior: "none" })
150
- ).lineY.set("visible", !1), r.length > 1) {
151
- const l = C.groupBy(d, r[1].value);
150
+ ie.new(e, { xAxis: u, behavior: "none" })
151
+ ).lineY.set("visible", !1), s.length > 1) {
152
+ const l = C.groupBy(p, s[1].value);
152
153
  Object.keys(l).forEach((i, c) => {
153
154
  E(
154
155
  l[i],
155
156
  i,
156
- r[0].value,
157
- s[0].dataFieldName,
157
+ s[0].value,
158
+ t[0].dataFieldName,
158
159
  c !== 0,
159
160
  A[c % A.length]
160
161
  );
161
162
  });
162
163
  } else
163
- s.forEach((l, i) => {
164
+ t.forEach((l, i) => {
164
165
  E(
165
- d,
166
+ p,
166
167
  l.name,
167
168
  o.value,
168
169
  l.dataFieldName,
@@ -171,15 +172,15 @@ const A = ["CIRCLE", "RECTANGLE", "TRIANGLE"], De = (L) => {
171
172
  o.type
172
173
  );
173
174
  });
174
- B.data.setAll(t.series.values), t.appear(1e3, 100);
175
+ B.data.setAll(r.series.values), Q(e, (N = t == null ? void 0 : t[0]) == null ? void 0 : N.format), r.appear(1e3, 100);
175
176
  }, X), () => {
176
177
  var e;
177
- v && clearTimeout(v), (e = y.current) == null || e.dispose(), y.current = null;
178
+ b && clearTimeout(b), (e = y.current) == null || e.dispose(), y.current = null;
178
179
  };
179
- }, [p, r, s, h.palette.mode, R]);
180
- const O = { ...n };
181
- return { chartId: _, ownerState: O, sx: F, error: m, other: I };
180
+ }, [d, s, t, m.palette.mode, R]);
181
+ const V = { ...n };
182
+ return { chartId: _, ownerState: V, sx: I, error: h, other: O };
182
183
  };
183
184
  export {
184
- De as useMultipleValueAxesLogic
185
+ Re as useMultipleValueAxesLogic
185
186
  };
@@ -1,52 +1,53 @@
1
- import { R as C, A as S } from "../../../AnimatedTheme-jnasw6rT.js";
2
- import { useThemeProps as E, useTheme as L } from "@mui/material";
3
- import j from "dayjs";
1
+ import { R as S, A as E } from "../../../AnimatedTheme-jnasw6rT.js";
2
+ import { useThemeProps as L, useTheme as j } from "@mui/material";
3
+ import q from "dayjs";
4
4
  import T from "lodash";
5
- import { useId as q, useRef as B, useEffect as H } from "react";
6
- import { colorSetFromPalette as I } from "../_common/utils.js";
5
+ import { useId as B, useRef as H, useEffect as I } from "react";
6
+ import { applyValueFormat as W, colorSetFromPalette as O } from "../_common/utils.js";
7
7
  import { c as n, p as o } from "../../../ColorSet-C7vpNXhM.js";
8
- import { P as W, a as F } from "../../../PieSeries-B2fW3z0s.js";
9
- const U = (N) => {
10
- const v = E({ props: N, name: "HCNestedPie" }), {
8
+ import { P as V, a as N } from "../../../PieSeries-B2fW3z0s.js";
9
+ const Z = (b) => {
10
+ const g = L({ props: b, name: "HCNestedPie" }), {
11
11
  dimensions: a,
12
- values: s,
12
+ values: r,
13
13
  data: d,
14
- initDelay: b = 0,
15
- colors: g,
16
- sx: x,
17
- ...k
18
- } = v, i = L(), y = `hc-nested-pie-${q().replace(/:/g, "")}`, m = B(null);
14
+ initDelay: x = 0,
15
+ colors: v,
16
+ sx: k,
17
+ ...w
18
+ } = g, i = j(), y = `hc-nested-pie-${B().replace(/:/g, "")}`, m = H(null);
19
19
  let c = null;
20
- a.length < 2 ? c = "NestedPie requires at least 2 dimensions" : s.length < 1 && (c = "NestedPie requires at least 1 value"), H(() => {
20
+ a.length < 2 ? c = "NestedPie requires at least 2 dimensions" : r.length < 1 && (c = "NestedPie requires at least 1 value"), I(() => {
21
21
  if (c) return;
22
22
  let p;
23
23
  return p = setTimeout(() => {
24
- const e = C.new(y);
25
- m.current = e, e.setThemes([S.new(e)]), e.interfaceColors.setAll({
24
+ var Y;
25
+ const e = S.new(y);
26
+ m.current = e, W(e, (Y = r == null ? void 0 : r[0]) == null ? void 0 : Y.format), e.setThemes([E.new(e)]), e.interfaceColors.setAll({
26
27
  text: n(i.palette.text.primary),
27
28
  grid: n(i.palette.divider),
28
29
  stroke: n(i.palette.divider)
29
30
  });
30
31
  const f = e.container.children.push(
31
- W.new(e, {
32
+ V.new(e, {
32
33
  layout: e.verticalLayout,
33
34
  radius: o(100)
34
35
  })
35
36
  );
36
- a[0].type === "date" && d.forEach((r) => {
37
+ a[0].type === "date" && d.forEach((s) => {
37
38
  let l = "YYYY";
38
- a[0].value.includes("month") ? l = "MMM YYYY" : a[0].value.includes("day") && (l = "DD MMM YYYY"), r[a[0].value] = j(r[a[0].value]).format(
39
+ a[0].value.includes("month") ? l = "MMM YYYY" : a[0].value.includes("day") && (l = "DD MMM YYYY"), s[a[0].value] = q(s[a[0].value]).format(
39
40
  l
40
41
  );
41
42
  });
42
- const h = T.orderBy(d, (r) => r[a[0].value]);
43
- a.forEach((r, l) => {
44
- const Y = e.interfaceColors.get("background");
43
+ const h = T.orderBy(d, (s) => s[a[0].value]);
44
+ a.forEach((s, l) => {
45
+ const A = e.interfaceColors.get("background");
45
46
  if (l === 0) {
46
47
  const t = f.series.push(
47
- F.new(e, {
48
- valueField: s[0].dataFieldName,
49
- categoryField: r.value,
48
+ N.new(e, {
49
+ valueField: r[0].dataFieldName,
50
+ categoryField: s.value,
50
51
  alignLabels: !1,
51
52
  radius: o(80),
52
53
  innerRadius: o(25)
@@ -58,47 +59,47 @@ const U = (N) => {
58
59
  textType: "radial",
59
60
  centerX: o(100)
60
61
  }), t.slices.template.setAll({
61
- stroke: Y,
62
+ stroke: A,
62
63
  strokeWidth: 2,
63
64
  fill: n(11184810),
64
65
  tooltipText: "{category}: {valuePercentTotal.formatNumber('0.00')}% ({value})"
65
66
  }), t.slices.template.states.create("hover", { scale: 0.95 }), a.length > 1) {
66
- const u = [], A = T.groupBy(h, r.value);
67
- Object.keys(A).forEach((P) => {
68
- const D = A[P].reduce((M, R) => M + R[s[0].dataFieldName], 0);
67
+ const u = [], F = T.groupBy(h, s.value);
68
+ Object.keys(F).forEach((P) => {
69
+ const M = F[P].reduce((R, C) => R + C[r[0].dataFieldName], 0);
69
70
  u.push({
70
- [r.value]: P,
71
- [s[0].dataFieldName]: D
71
+ [s.value]: P,
72
+ [r[0].dataFieldName]: M
72
73
  });
73
74
  }), t.data.setAll(u);
74
75
  } else
75
76
  t.data.setAll(h);
76
77
  } else if (l === 1) {
77
78
  const t = f.series.push(
78
- F.new(e, {
79
- valueField: s[0].dataFieldName,
80
- categoryField: r.value,
79
+ N.new(e, {
80
+ valueField: r[0].dataFieldName,
81
+ categoryField: s.value,
81
82
  alignLabels: !0,
82
83
  innerRadius: o(80),
83
84
  radius: o(100)
84
85
  })
85
- ), u = I(e, g);
86
+ ), u = O(e, v);
86
87
  t.set("colors", u), t.slices.template.setAll({
87
- stroke: Y,
88
+ stroke: A,
88
89
  strokeWidth: 2,
89
90
  templateField: "settings",
90
91
  tooltipText: "{category}: {valuePercentTotal.formatNumber('0.00')}% ({value})"
91
92
  }), t.labels.template.setAll({ text: "{category}" }), t.data.setAll(h);
92
93
  }
93
94
  }), f.appear(1e3, 100);
94
- }, b), () => {
95
+ }, x), () => {
95
96
  var e;
96
97
  p && clearTimeout(p), (e = m.current) == null || e.dispose(), m.current = null;
97
98
  };
98
- }, [d, a, s, i.palette.mode, g]);
99
- const w = { ...v };
100
- return { chartId: y, ownerState: w, sx: x, error: c, other: k };
99
+ }, [d, a, r, i.palette.mode, v]);
100
+ const D = { ...g };
101
+ return { chartId: y, ownerState: D, sx: k, error: c, other: w };
101
102
  };
102
103
  export {
103
- U as useNestedPieLogic
104
+ Z as useNestedPieLogic
104
105
  };