@hybridcore/ui 1.6.3 → 1.6.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.
package/CATALOG.md CHANGED
@@ -71,6 +71,7 @@ import { ComponentName } from '@hybridcore/ui';
71
71
  | ChartWrapper | HCChartWrapper | Switches between 14 chart types from a single config | chart, wrapper |
72
72
  | CandlestickChart | HCCandlestickChart | Financial OHLC candlestick chart | chart, financial, ohlc |
73
73
  | ColumnLineMix | HCColumnLineMix | Mixed column + line chart for combined metrics | chart, column, line |
74
+ | DonutChart | HCDonutChart | Pie chart with a hollow center (donut) for an extra metric | chart, pie, donut |
74
75
  | DrillDownTreemap | HCDrillDownTreemap | Treemap with click-to-drill-down hierarchy | chart, treemap, hierarchy |
75
76
  | DrillDownVoronoiTreemap | HCDrillDownVoronoiTreemap | Voronoi-tessellation treemap with drill-down | chart, treemap, voronoi |
76
77
  | Heatmap | HCHeatmap | Categorical heatmap (X/Y axes, color-coded values) | chart, heatmap |
@@ -0,0 +1,93 @@
1
+ import { E as M, e as v, f as w, u as G } from "./ColorSet-C7vpNXhM.js";
2
+ import { m as B, s as O } from "./AnimatedTheme-jnasw6rT.js";
3
+ class c extends M {
4
+ _afterNew() {
5
+ super._afterNewApplyThemes();
6
+ }
7
+ /**
8
+ * @ignore
9
+ */
10
+ getFill(t) {
11
+ return {
12
+ addColorStop: (l, e) => {
13
+ }
14
+ };
15
+ }
16
+ _changed() {
17
+ super._changed();
18
+ }
19
+ /**
20
+ * @ignore
21
+ */
22
+ getBounds(t) {
23
+ const l = this.get("target");
24
+ if (l) {
25
+ let e = l.globalBounds();
26
+ const r = t.toLocal({ x: e.left, y: e.top }), s = t.toLocal({ x: e.right, y: e.top }), a = t.toLocal({ x: e.right, y: e.bottom }), n = t.toLocal({ x: e.left, y: e.bottom });
27
+ return {
28
+ left: Math.min(r.x, s.x, a.x, n.x),
29
+ top: Math.min(r.y, s.y, a.y, n.y),
30
+ right: Math.max(r.x, s.x, a.x, n.x),
31
+ bottom: Math.max(r.y, s.y, a.y, n.y)
32
+ };
33
+ }
34
+ return t._display.getLocalBounds();
35
+ }
36
+ }
37
+ Object.defineProperty(c, "className", {
38
+ enumerable: !0,
39
+ configurable: !0,
40
+ writable: !0,
41
+ value: "Gradient"
42
+ });
43
+ Object.defineProperty(c, "classNames", {
44
+ enumerable: !0,
45
+ configurable: !0,
46
+ writable: !0,
47
+ value: M.classNames.concat([c.className])
48
+ });
49
+ class d extends c {
50
+ /**
51
+ * @ignore
52
+ */
53
+ getFill(t) {
54
+ const l = this.get("rotation", 0);
55
+ let e = this.getBounds(t), r = e.left || 0, s = e.right || 0, a = e.top || 0, n = e.bottom || 0, h = B(l), p = O(l), u = h * (s - r), f = p * (n - a);
56
+ u == 0 && (u = 1), f == 0 && (f = 1);
57
+ let y = Math.max(u, f);
58
+ const x = this._root._renderer.createLinearGradient(r, a, r + y * h, a + y * p), b = this.get("stops");
59
+ if (b) {
60
+ let N = 0;
61
+ v(b, (i) => {
62
+ let g = i.offset;
63
+ w(g) || (g = N / (b.length - 1));
64
+ let m = i.opacity;
65
+ w(m) || (m = 1);
66
+ let o = i.color;
67
+ if (o) {
68
+ const _ = i.lighten;
69
+ _ && (o = G.lighten(o, _));
70
+ const L = i.brighten;
71
+ L && (o = G.brighten(o, L)), x.addColorStop(g, "rgba(" + o.r + "," + o.g + "," + o.b + "," + m + ")");
72
+ }
73
+ N++;
74
+ });
75
+ }
76
+ return x;
77
+ }
78
+ }
79
+ Object.defineProperty(d, "className", {
80
+ enumerable: !0,
81
+ configurable: !0,
82
+ writable: !0,
83
+ value: "LinearGradient"
84
+ });
85
+ Object.defineProperty(d, "classNames", {
86
+ enumerable: !0,
87
+ configurable: !0,
88
+ writable: !0,
89
+ value: c.classNames.concat([d.className])
90
+ });
91
+ export {
92
+ d as L
93
+ };
@@ -1,44 +1,47 @@
1
- import { jsxs as i, jsx as r } from "react/jsx-runtime";
2
- import { Typography as l, Divider as n } from "@mui/material";
3
- import { CandlestickChart as C } from "../candlestick/index.js";
4
- import { ColumnLineMix as h } from "../column-line-mix/index.js";
5
- import { DrillDownTreemap as c } from "../drill-down-treemap/index.js";
6
- import { DrillDownVoronoiTreemap as d } from "../drill-down-voronoi-treemap/index.js";
7
- import { Heatmap as f } from "../heatmap/index.js";
8
- import { LineChart as s } from "../line/index.js";
9
- import { LogaritmicScale as u } from "../logaritmic-scale/index.js";
10
- import { MultipleValueAxes as L } from "../multiple-value-axes/index.js";
11
- import { NestedPie as x } from "../nested-pie/index.js";
12
- import { PackedCircles as D } from "../packed-circles/index.js";
13
- import { PieChart as k } from "../pie-chart/index.js";
14
- import { StackedAreaRadar as S } from "../stacked-area-radar/index.js";
15
- import { StackedColumnChart as g } from "../stacked-column-chart/index.js";
16
- import { XYChart as P } from "../xy-chart/index.js";
17
- import { useChartWrapperLogic as w } from "./logic.js";
18
- import { ChartWrapperRoot as A, ChartWrapperHeader as T, ChartWrapperContent as W } from "./styled.js";
19
- const J = (a) => {
20
- const { title: m, type: e, chartProps: o, ownerState: t, sx: p } = w(a);
21
- return /* @__PURE__ */ i(A, { ownerState: t, sx: p, children: [
22
- /* @__PURE__ */ r(T, { ownerState: t, children: /* @__PURE__ */ r(l, { sx: { paddingLeft: "0.5rem" }, variant: "h3", children: m }) }),
23
- /* @__PURE__ */ r(n, {}),
24
- /* @__PURE__ */ i(W, { ownerState: t, children: [
25
- e === "MultipleValueAxes" && /* @__PURE__ */ r(L, { ...o }),
26
- e === "XYChart" && /* @__PURE__ */ r(P, { ...o }),
27
- e === "HeatLegend" && /* @__PURE__ */ r(f, { ...o }),
28
- e === "PieChart" && /* @__PURE__ */ r(k, { ...o }),
29
- e === "StackedColumnChart" && /* @__PURE__ */ r(g, { ...o }),
30
- e === "StackedAreaRadar" && /* @__PURE__ */ r(S, { ...o }),
31
- e === "LineChart" && /* @__PURE__ */ r(s, { ...o }),
32
- e === "NestedPie" && /* @__PURE__ */ r(x, { ...o }),
33
- e === "SingleLevelPackedCircles" && /* @__PURE__ */ r(D, { ...o }),
34
- e === "LogarithmicScale" && /* @__PURE__ */ r(u, { ...o }),
35
- e === "ColumnAndLineMix" && /* @__PURE__ */ r(h, { ...o }),
36
- e === "DrillDownTreemap" && /* @__PURE__ */ r(c, { ...o }),
37
- e === "DrillDownVoronoiTreemap" && /* @__PURE__ */ r(d, { ...o }),
38
- e === "CandlestickChart" && /* @__PURE__ */ r(C, { ...o })
39
- ] })
1
+ import { jsxs as i, jsx as r, Fragment as l } from "react/jsx-runtime";
2
+ import { Typography as h, Divider as C } from "@mui/material";
3
+ import { Loading as d } from "../../loading/index.js";
4
+ import { CandlestickChart as c } from "../candlestick/index.js";
5
+ import { ColumnLineMix as f } from "../column-line-mix/index.js";
6
+ import { DonutChart as s } from "../donut-chart/index.js";
7
+ import { DrillDownTreemap as u } from "../drill-down-treemap/index.js";
8
+ import { DrillDownVoronoiTreemap as D } from "../drill-down-voronoi-treemap/index.js";
9
+ import { Heatmap as L } from "../heatmap/index.js";
10
+ import { LineChart as g } from "../line/index.js";
11
+ import { LogaritmicScale as x } from "../logaritmic-scale/index.js";
12
+ import { MultipleValueAxes as k } from "../multiple-value-axes/index.js";
13
+ import { NestedPie as S } from "../nested-pie/index.js";
14
+ import { PackedCircles as P } from "../packed-circles/index.js";
15
+ import { PieChart as w } from "../pie-chart/index.js";
16
+ import { StackedAreaRadar as A } from "../stacked-area-radar/index.js";
17
+ import { StackedColumnChart as T } from "../stacked-column-chart/index.js";
18
+ import { XYChart as W } from "../xy-chart/index.js";
19
+ import { useChartWrapperLogic as M } from "./logic.js";
20
+ import { ChartWrapperRoot as V, ChartWrapperHeader as v, ChartWrapperContent as y } from "./styled.js";
21
+ const _ = (a) => {
22
+ const { title: m, type: o, chartProps: e, loading: p, ownerState: t, sx: n } = M(a);
23
+ return /* @__PURE__ */ i(V, { ownerState: t, sx: n, children: [
24
+ /* @__PURE__ */ r(v, { ownerState: t, children: /* @__PURE__ */ r(h, { sx: { paddingLeft: "0.5rem" }, variant: "h3", children: m }) }),
25
+ /* @__PURE__ */ r(C, {}),
26
+ /* @__PURE__ */ r(y, { ownerState: t, children: p ? /* @__PURE__ */ r(d, { show: !0, position: "absolute" }) : /* @__PURE__ */ i(l, { children: [
27
+ o === "MultipleValueAxes" && /* @__PURE__ */ r(k, { ...e }),
28
+ o === "XYChart" && /* @__PURE__ */ r(W, { ...e }),
29
+ o === "HeatLegend" && /* @__PURE__ */ r(L, { ...e }),
30
+ o === "PieChart" && /* @__PURE__ */ r(w, { ...e }),
31
+ o === "DonutChart" && /* @__PURE__ */ r(s, { ...e }),
32
+ o === "StackedColumnChart" && /* @__PURE__ */ r(T, { ...e }),
33
+ o === "StackedAreaRadar" && /* @__PURE__ */ r(A, { ...e }),
34
+ o === "LineChart" && /* @__PURE__ */ r(g, { ...e }),
35
+ o === "NestedPie" && /* @__PURE__ */ r(S, { ...e }),
36
+ o === "SingleLevelPackedCircles" && /* @__PURE__ */ r(P, { ...e }),
37
+ o === "LogarithmicScale" && /* @__PURE__ */ r(x, { ...e }),
38
+ o === "ColumnAndLineMix" && /* @__PURE__ */ r(f, { ...e }),
39
+ o === "DrillDownTreemap" && /* @__PURE__ */ r(u, { ...e }),
40
+ o === "DrillDownVoronoiTreemap" && /* @__PURE__ */ r(D, { ...e }),
41
+ o === "CandlestickChart" && /* @__PURE__ */ r(c, { ...e })
42
+ ] }) })
40
43
  ] });
41
44
  };
42
45
  export {
43
- J as ChartWrapper
46
+ _ as ChartWrapper
44
47
  };
@@ -1,7 +1,7 @@
1
1
  import { useThemeProps as v } from "@mui/material";
2
2
  import { useMemo as P } from "react";
3
- import { adaptTemporalData as g } from "./helpers.js";
4
- const x = (l) => {
3
+ import { adaptTemporalData as C } from "./helpers.js";
4
+ const M = (l) => {
5
5
  const n = v({ props: l, name: "HCChartWrapper" }), {
6
6
  title: m,
7
7
  description: d,
@@ -11,9 +11,10 @@ const x = (l) => {
11
11
  dimensions: s = [],
12
12
  values: p = [],
13
13
  series: r = [],
14
- sx: f,
15
- ...u
16
- } = n, h = {
14
+ loading: f = !1,
15
+ sx: u,
16
+ ...h
17
+ } = n, y = {
17
18
  ...P(() => {
18
19
  let t = { data: a, dimensions: s, values: p };
19
20
  if (s.length > 0) {
@@ -26,22 +27,23 @@ const x = (l) => {
26
27
  };
27
28
  }
28
29
  } else if (r.length > 0) {
29
- const o = g(r);
30
+ const o = C(r);
30
31
  t = { ...t, ...o };
31
32
  }
32
33
  return t;
33
34
  }, [i, a, s, p, r]),
34
- ...u
35
- }, y = { ...n };
35
+ ...h
36
+ }, g = { ...n };
36
37
  return {
37
38
  title: m,
38
39
  description: d,
39
40
  type: c,
40
- chartProps: h,
41
- ownerState: y,
42
- sx: f
41
+ chartProps: y,
42
+ loading: f,
43
+ ownerState: g,
44
+ sx: u
43
45
  };
44
46
  };
45
47
  export {
46
- x as useChartWrapperLogic
48
+ M as useChartWrapperLogic
47
49
  };
@@ -0,0 +1,11 @@
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { ChartError as n } from "../_common/chart-error.js";
3
+ import { useDonutChartLogic as s } from "./logic.js";
4
+ import { DonutChartRoot as a } from "./styled.js";
5
+ const f = (o) => {
6
+ const { chartId: e, ownerState: h, sx: i, error: t, other: m } = s(o);
7
+ return /* @__PURE__ */ r(a, { ownerState: h, sx: i, ...m, children: t ? /* @__PURE__ */ r(n, { message: t }) : /* @__PURE__ */ r("div", { id: e, style: { width: "100%", height: "100%" } }) });
8
+ };
9
+ export {
10
+ f as DonutChart
11
+ };
@@ -0,0 +1,66 @@
1
+ import { R as w, A as x } from "../../../AnimatedTheme-jnasw6rT.js";
2
+ import { useThemeProps as A, useTheme as C } from "@mui/material";
3
+ import D from "dayjs";
4
+ import { useId as P, useRef as R, useEffect as F } from "react";
5
+ import { colorSetFromPalette as L } from "../_common/utils.js";
6
+ import { P as I, a as S } from "../../../PieSeries-B2fW3z0s.js";
7
+ import { p as m, c as u } from "../../../ColorSet-C7vpNXhM.js";
8
+ import { L as E } from "../../../Legend-Dp_MKfS4.js";
9
+ const G = (Y) => {
10
+ const d = A({ props: Y, name: "HCDonutChart" }), {
11
+ dimensions: t,
12
+ values: a,
13
+ data: n,
14
+ initDelay: v = 0,
15
+ colors: p,
16
+ sx: y,
17
+ ...M
18
+ } = d, o = C(), f = `hc-donut-chart-${P().replace(/:/g, "")}`, i = R(null);
19
+ let r = null;
20
+ t.length < 1 ? r = "Missing dimensions config!" : a.length < 1 && (r = "Missing values config!"), F(() => {
21
+ if (r) return;
22
+ let l;
23
+ return l = setTimeout(() => {
24
+ const e = w.new(f);
25
+ i.current = e, e.setThemes([x.new(e)]);
26
+ const h = e.container.children.push(
27
+ I.new(e, {
28
+ layout: e.verticalLayout,
29
+ innerRadius: m(50)
30
+ })
31
+ );
32
+ e.interfaceColors.setAll({
33
+ text: u(o.palette.text.primary),
34
+ grid: u(o.palette.divider),
35
+ stroke: u(o.palette.divider)
36
+ });
37
+ const s = h.series.push(
38
+ S.new(e, {
39
+ valueField: a[0].dataFieldName,
40
+ categoryField: t[0].value
41
+ })
42
+ );
43
+ s.set("colors", L(e, p)), t[0].type === "date" && n.forEach((g) => {
44
+ let c = "YYYY";
45
+ t[0].value.includes("month") ? c = "MMM YYYY" : t[0].value.includes("day") && (c = "DD MMM YYYY"), g[t[0].value] = D(g[t[0].value]).format(
46
+ c
47
+ );
48
+ }), s.data.setAll(n), h.children.push(
49
+ E.new(e, {
50
+ centerX: m(50),
51
+ x: m(50),
52
+ marginTop: 15,
53
+ marginBottom: 15
54
+ })
55
+ ).data.setAll(s.dataItems), s.appear(1e3, 100);
56
+ }, v), () => {
57
+ var e;
58
+ l && clearTimeout(l), (e = i.current) == null || e.dispose(), i.current = null;
59
+ };
60
+ }, [n, t, a, o.palette.mode, p]);
61
+ const T = { ...d };
62
+ return { chartId: f, ownerState: T, sx: y, error: r, other: M };
63
+ };
64
+ export {
65
+ G as useDonutChartLogic
66
+ };
@@ -0,0 +1,12 @@
1
+ import { styled as t, Box as r } from "@mui/material";
2
+ const h = t(r, {
3
+ name: "HCDonutChart",
4
+ slot: "Root",
5
+ shouldForwardProp: (o) => o !== "ownerState"
6
+ })(() => ({
7
+ width: "100%",
8
+ height: "100%"
9
+ }));
10
+ export {
11
+ h as DonutChartRoot
12
+ };