@hybridcore/ui 1.6.14 → 1.6.16

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.
@@ -1,6 +1,6 @@
1
- import { T as x } from "../../../Tooltip-vyZRZWih.js";
2
- import { c as p, p as v } from "../../../Entity-BJCuhdq_.js";
3
- const F = {
1
+ import { T } from "../../../Tooltip-vyZRZWih.js";
2
+ import { c as p, p as S } from "../../../Entity-BJCuhdq_.js";
3
+ const w = {
4
4
  millisecond: "d MMM, yyyy HH:mm:ss.SSS",
5
5
  second: "d MMM, yyyy HH:mm:ss",
6
6
  minute: "d MMM, yyyy HH:mm",
@@ -9,7 +9,7 @@ const F = {
9
9
  week: "d MMM, yyyy",
10
10
  month: "MMM yyyy",
11
11
  year: "yyyy"
12
- }, $ = (o) => F[(o == null ? void 0 : o.timeUnit) ?? "day"], T = (o, t) => {
12
+ }, A = (o) => w[(o == null ? void 0 : o.timeUnit) ?? "day"], F = (o, t) => {
13
13
  var i;
14
14
  (i = o.get("background")) == null || i.setAll({
15
15
  fill: p(t.palette.background.paper),
@@ -18,56 +18,65 @@ const F = {
18
18
  }), o.label.setAll({
19
19
  fill: p(t.palette.text.primary),
20
20
  textAlign: "left",
21
- lineHeight: v(160)
21
+ lineHeight: S(160)
22
22
  });
23
- }, D = (o) => {
24
- const { root: t, chart: i, theme: s, getText: y } = o, e = x.new(t, { getFillFromSprite: !1 });
25
- T(e, s), e.label.adapters.add("text", y), t.tooltipContainer.children.push(e);
26
- const n = i.get("cursor");
27
- return n == null || n.events.on("cursormoved", () => {
28
- const c = n.getPrivate("point");
29
- c && (e.label.text.markDirtyText(), e.set("pointTo", n.toGlobal(c)), e.show());
30
- }), n == null || n.events.on("cursorhidden", () => e.hide()), e;
31
- }, A = (o) => {
32
- const { root: t, chart: i, xAxis: s, theme: y, isDateAxis: e, baseInterval: n, follow: c } = o, f = $(n), b = p(y.palette.text.secondary).toCSSHex(), g = () => {
33
- let l = "";
23
+ }, k = (o) => {
24
+ const { root: t, chart: i, theme: s, getText: c } = o, e = T.new(t, { getFillFromSprite: !1 });
25
+ F(e, s), e.label.adapters.add("text", c), t.tooltipContainer.children.push(e);
26
+ const a = i.get("cursor");
27
+ return a == null || a.events.on("cursormoved", () => {
28
+ const y = a.getPrivate("point");
29
+ y && (e.label.text.markDirtyText(), e.set("pointTo", a.toGlobal(y)), e.show());
30
+ }), a == null || a.events.on("cursorhidden", () => e.hide()), e;
31
+ }, O = (o) => {
32
+ const {
33
+ root: t,
34
+ chart: i,
35
+ xAxis: s,
36
+ theme: c,
37
+ isDateAxis: e,
38
+ baseInterval: a,
39
+ follow: y,
40
+ horizontal: u
41
+ } = o, g = A(a), v = p(c.palette.text.secondary).toCSSHex(), b = u ? "valueX" : "valueY", H = u ? "valueY" : "valueX", $ = u ? "categoryY" : "categoryX", M = () => {
42
+ let n = "";
34
43
  const m = [];
35
44
  if (i.series.each((r) => {
36
- const a = r.get("tooltipDataItem"), u = a == null ? void 0 : a.get("valueY");
37
- if (a === void 0 || u === void 0 || u === null)
45
+ const l = r.get("tooltipDataItem"), f = l == null ? void 0 : l.get(b);
46
+ if (l === void 0 || f === void 0 || f === null)
38
47
  return;
39
- if (!l)
48
+ if (!n)
40
49
  if (e) {
41
- const h = a.get("valueX");
42
- typeof h == "number" && (l = t.dateFormatter.format(new Date(h), f));
50
+ const x = l.get(H);
51
+ typeof x == "number" && (n = t.dateFormatter.format(new Date(x), g));
43
52
  } else
44
- l = `${a.get("categoryX") ?? ""}`;
45
- const M = r.get("fill") ?? r.get("stroke"), H = M ? `[${M.toCSSHex()}]●[/] ` : "";
53
+ n = `${l.get($) ?? ""}`;
54
+ const h = r.get("fill") ?? r.get("stroke"), D = h ? `[${h.toCSSHex()}]●[/] ` : "";
46
55
  m.push(
47
- `${H}${r.get("name")}: ${t.numberFormatter.format(u)}`
56
+ `${D}${r.get("name")}: ${t.numberFormatter.format(f)}`
48
57
  );
49
58
  }), m.length === 0) {
50
59
  if (e) {
51
- const a = s.positionToValue(
60
+ const l = s.positionToValue(
52
61
  s.getPrivate("tooltipPosition", 0)
53
62
  );
54
- typeof a == "number" && !Number.isNaN(a) && (l = t.dateFormatter.format(new Date(a), f));
63
+ typeof l == "number" && !Number.isNaN(l) && (n = t.dateFormatter.format(new Date(l), g));
55
64
  }
56
- const r = `[${b}]No data[/]`;
57
- return l ? `[bold]${l}[/]
65
+ const r = `[${v}]No data[/]`;
66
+ return n ? `[bold]${n}[/]
58
67
  ${r}` : r;
59
68
  }
60
- return l ? `[bold]${l}[/]
69
+ return n ? `[bold]${n}[/]
61
70
  ${m.join(`
62
71
  `)}` : m.join(`
63
72
  `);
64
73
  };
65
- if (c) return D({ root: t, chart: i, theme: y, getText: g });
66
- const d = x.new(t, { getFillFromSprite: !1 });
67
- return T(d, y), d.label.adapters.add("text", g), s.set("tooltip", d), d;
74
+ if (y) return k({ root: t, chart: i, theme: c, getText: M });
75
+ const d = T.new(t, { getFillFromSprite: !1 });
76
+ return F(d, c), d.label.adapters.add("text", M), s.set("tooltip", d), d;
68
77
  };
69
78
  export {
70
- A as attachCombinedAxisTooltip,
71
- D as attachCursorTooltip,
72
- $ as getTooltipDateFormat
79
+ O as attachCombinedAxisTooltip,
80
+ k as attachCursorTooltip,
81
+ A as getTooltipDateFormat
73
82
  };
@@ -1,46 +1,47 @@
1
- import { jsxs as a, jsx as r, Fragment as l } from "react/jsx-runtime";
2
- import { Typography as C, Divider as h } from "@mui/material";
3
- import { Loading as c } from "../../loading/index.js";
4
- import { CandlestickChart as d } 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 { ForecastConeChart as L } from "../forecast-cone/index.js";
10
- import { Heatmap as g } from "../heatmap/index.js";
11
- import { LineChart as x } from "../line/index.js";
12
- import { LogaritmicScale as k } from "../logaritmic-scale/index.js";
13
- import { MultipleValueAxes as S } from "../multiple-value-axes/index.js";
14
- import { NestedPie as P } from "../nested-pie/index.js";
15
- import { PackedCircles as w } from "../packed-circles/index.js";
16
- import { PieChart as A } from "../pie-chart/index.js";
17
- import { StackedAreaRadar as T } from "../stacked-area-radar/index.js";
18
- import { StackedColumnChart as W } from "../stacked-column-chart/index.js";
19
- import { XYChart as M } from "../xy-chart/index.js";
20
- import { useChartWrapperLogic as V } from "./logic.js";
21
- import { ChartWrapperRoot as v, ChartWrapperHeader as y, ChartWrapperContent as F } from "./styled.js";
22
- const rr = (i) => {
23
- const { title: m, type: o, chartProps: e, loading: p, ownerState: t, sx: n } = V(i);
24
- return /* @__PURE__ */ a(v, { ownerState: t, sx: n, children: [
25
- /* @__PURE__ */ r(y, { ownerState: t, children: /* @__PURE__ */ r(C, { sx: { paddingLeft: "0.5rem" }, variant: "h3", children: m }) }),
26
- /* @__PURE__ */ r(h, {}),
27
- /* @__PURE__ */ r(F, { ownerState: t, children: p ? /* @__PURE__ */ r(c, { show: !0, position: "absolute" }) : /* @__PURE__ */ a(l, { children: [
28
- o === "MultipleValueAxes" && /* @__PURE__ */ r(S, { ...e }),
29
- o === "XYChart" && /* @__PURE__ */ r(M, { ...e }),
30
- o === "HeatLegend" && /* @__PURE__ */ r(g, { ...e }),
31
- o === "PieChart" && /* @__PURE__ */ r(A, { ...e }),
32
- o === "DonutChart" && /* @__PURE__ */ r(s, { ...e }),
33
- o === "StackedColumnChart" && /* @__PURE__ */ r(W, { ...e }),
34
- o === "StackedAreaRadar" && /* @__PURE__ */ r(T, { ...e }),
35
- o === "LineChart" && /* @__PURE__ */ r(x, { ...e }),
36
- o === "NestedPie" && /* @__PURE__ */ r(P, { ...e }),
37
- o === "SingleLevelPackedCircles" && /* @__PURE__ */ r(w, { ...e }),
38
- o === "LogarithmicScale" && /* @__PURE__ */ r(k, { ...e }),
39
- o === "ColumnAndLineMix" && /* @__PURE__ */ r(f, { ...e }),
40
- o === "DrillDownTreemap" && /* @__PURE__ */ r(u, { ...e }),
41
- o === "DrillDownVoronoiTreemap" && /* @__PURE__ */ r(D, { ...e }),
42
- o === "CandlestickChart" && /* @__PURE__ */ r(d, { ...e }),
43
- o === "ForecastCone" && /* @__PURE__ */ r(L, { ...e })
1
+ import { jsxs as a, jsx as r, Fragment as h } from "react/jsx-runtime";
2
+ import { Typography as C, Divider as c } from "@mui/material";
3
+ import { Loading as d } from "../../loading/index.js";
4
+ import { CandlestickChart as f } from "../candlestick/index.js";
5
+ import { ColumnLineMix as s } from "../column-line-mix/index.js";
6
+ import { DonutChart as u } from "../donut-chart/index.js";
7
+ import { DrillDownTreemap as D } from "../drill-down-treemap/index.js";
8
+ import { DrillDownVoronoiTreemap as L } from "../drill-down-voronoi-treemap/index.js";
9
+ import { ForecastConeChart as g } from "../forecast-cone/index.js";
10
+ import { Heatmap as x } from "../heatmap/index.js";
11
+ import { LineChart as k } from "../line/index.js";
12
+ import { LogaritmicScale as S } from "../logaritmic-scale/index.js";
13
+ import { MultipleValueAxes as P } from "../multiple-value-axes/index.js";
14
+ import { NestedPie as w } from "../nested-pie/index.js";
15
+ import { PackedCircles as A } from "../packed-circles/index.js";
16
+ import { PieChart as T } from "../pie-chart/index.js";
17
+ import { StackedAreaRadar as W } from "../stacked-area-radar/index.js";
18
+ import { StackedColumnChart as H } from "../stacked-column-chart/index.js";
19
+ import { XYChart as i } from "../xy-chart/index.js";
20
+ import { useChartWrapperLogic as M } from "./logic.js";
21
+ import { ChartWrapperRoot as V, ChartWrapperHeader as v, ChartWrapperContent as y } from "./styled.js";
22
+ const rr = (m) => {
23
+ const { title: p, type: o, chartProps: t, loading: n, ownerState: e, sx: l } = M(m);
24
+ return /* @__PURE__ */ a(V, { ownerState: e, sx: l, children: [
25
+ /* @__PURE__ */ r(v, { ownerState: e, children: /* @__PURE__ */ r(C, { sx: { paddingLeft: "0.5rem" }, variant: "h3", children: p }) }),
26
+ /* @__PURE__ */ r(c, {}),
27
+ /* @__PURE__ */ r(y, { ownerState: e, children: n ? /* @__PURE__ */ r(d, { show: !0, position: "absolute" }) : /* @__PURE__ */ a(h, { children: [
28
+ o === "MultipleValueAxes" && /* @__PURE__ */ r(P, { ...t }),
29
+ o === "XYChart" && /* @__PURE__ */ r(i, { ...t }),
30
+ o === "XYChartHorizontal" && /* @__PURE__ */ r(i, { ...t, orientation: "horizontal" }),
31
+ o === "HeatLegend" && /* @__PURE__ */ r(x, { ...t }),
32
+ o === "PieChart" && /* @__PURE__ */ r(T, { ...t }),
33
+ o === "DonutChart" && /* @__PURE__ */ r(u, { ...t }),
34
+ o === "StackedColumnChart" && /* @__PURE__ */ r(H, { ...t }),
35
+ o === "StackedAreaRadar" && /* @__PURE__ */ r(W, { ...t }),
36
+ o === "LineChart" && /* @__PURE__ */ r(k, { ...t }),
37
+ o === "NestedPie" && /* @__PURE__ */ r(w, { ...t }),
38
+ o === "SingleLevelPackedCircles" && /* @__PURE__ */ r(A, { ...t }),
39
+ o === "LogarithmicScale" && /* @__PURE__ */ r(S, { ...t }),
40
+ o === "ColumnAndLineMix" && /* @__PURE__ */ r(s, { ...t }),
41
+ o === "DrillDownTreemap" && /* @__PURE__ */ r(D, { ...t }),
42
+ o === "DrillDownVoronoiTreemap" && /* @__PURE__ */ r(L, { ...t }),
43
+ o === "CandlestickChart" && /* @__PURE__ */ r(f, { ...t }),
44
+ o === "ForecastCone" && /* @__PURE__ */ r(g, { ...t })
44
45
  ] }) })
45
46
  ] });
46
47
  };
@@ -1,69 +1,82 @@
1
- import { R as P, A } from "../../../AnimatedTheme-ktdO3Bel.js";
2
- import { useThemeProps as C, useTheme as D } from "@mui/material";
3
- import F from "dayjs";
4
- import { useId as R, useRef as L, useEffect as I } from "react";
5
- import { applyValueFormat as S, colorSetFromPalette as b } from "../_common/utils.js";
6
- import { P as E, a as N } from "../../../PieSeries-CMH0Z7pz.js";
7
- import { p as m, c as u } from "../../../Entity-BJCuhdq_.js";
8
- import { L as j } from "../../../Legend-CFvQiIfn.js";
9
- const K = (y) => {
10
- const p = C({ props: y, name: "HCDonutChart" }), {
1
+ import { R as w, A } from "../../../AnimatedTheme-ktdO3Bel.js";
2
+ import { useThemeProps as P, useTheme as R } from "@mui/material";
3
+ import b from "dayjs";
4
+ import { useId as C, useRef as D, useEffect as F } from "react";
5
+ import { applyValueFormat as L, colorSetFromPalette as I } from "../_common/utils.js";
6
+ import { P as S, a as B } from "../../../PieSeries-CMH0Z7pz.js";
7
+ import { p as l, c as s } from "../../../Entity-BJCuhdq_.js";
8
+ import { L as E } from "../../../Legend-CFvQiIfn.js";
9
+ const G = (y) => {
10
+ const u = P({ props: y, name: "HCDonutChart" }), {
11
11
  dimensions: t,
12
12
  values: o,
13
- data: i,
13
+ data: n,
14
14
  initDelay: T = 0,
15
15
  colors: d,
16
16
  sx: x,
17
17
  ...M
18
- } = p, a = D(), f = `hc-donut-chart-${R().replace(/:/g, "")}`, n = L(null);
19
- let s = null;
20
- t.length < 1 ? s = "Missing dimensions config!" : o.length < 1 && (s = "Missing values config!"), I(() => {
21
- if (s) return;
22
- let l;
23
- return l = setTimeout(() => {
24
- var Y;
25
- const e = P.new(f);
26
- n.current = e, S(e, (Y = o == null ? void 0 : o[0]) == null ? void 0 : Y.format), e.setThemes([A.new(e)]);
18
+ } = u, a = R(), f = `hc-donut-chart-${C().replace(/:/g, "")}`, c = D(null);
19
+ let i = null;
20
+ t.length < 1 ? i = "Missing dimensions config!" : o.length < 1 && (i = "Missing values config!"), F(() => {
21
+ if (i) return;
22
+ let m;
23
+ return m = setTimeout(() => {
24
+ var v;
25
+ const e = w.new(f);
26
+ c.current = e, L(e, (v = o == null ? void 0 : o[0]) == null ? void 0 : v.format), e.setThemes([A.new(e)]);
27
27
  const h = e.container.children.push(
28
- E.new(e, {
28
+ S.new(e, {
29
29
  layout: e.verticalLayout,
30
- innerRadius: m(50)
30
+ innerRadius: l(50)
31
31
  })
32
32
  );
33
33
  e.interfaceColors.setAll({
34
- text: u(a.palette.text.primary),
35
- grid: u(a.palette.divider),
36
- stroke: u(a.palette.divider)
34
+ text: s(a.palette.text.primary),
35
+ grid: s(a.palette.divider),
36
+ stroke: s(a.palette.divider),
37
+ // Drives the gap color between slices; tie it to the surface so the
38
+ // beveled edges read correctly in both light and dark mode.
39
+ background: s(a.palette.background.paper)
37
40
  });
38
41
  const r = h.series.push(
39
- N.new(e, {
42
+ B.new(e, {
40
43
  valueField: o[0].dataFieldName,
41
44
  categoryField: t[0].value
42
45
  })
43
46
  );
44
- r.set("colors", b(e, d));
47
+ r.set("colors", I(e, d));
45
48
  const g = "{category}: {valuePercentTotal.formatNumber('0.00')}% ({value})";
46
- r.slices.template.set("tooltipText", g), r.labels.template.set("text", g), t[0].type === "date" && i.forEach((v) => {
47
- let c = "YYYY";
48
- t[0].value.includes("month") ? c = "MMM YYYY" : t[0].value.includes("day") && (c = "DD MMM YYYY"), v[t[0].value] = F(v[t[0].value]).format(
49
- c
49
+ r.slices.template.setAll({
50
+ tooltipText: g,
51
+ stroke: s(a.palette.background.paper),
52
+ strokeWidth: 2,
53
+ strokeOpacity: 1,
54
+ cornerRadius: 4
55
+ }), r.slices.template.states.create("hover", { scale: 1.04 }), r.set("radius", l(80)), r.labels.template.setAll({
56
+ text: g,
57
+ maxWidth: 140,
58
+ oversizedBehavior: "wrap"
59
+ }), t[0].type === "date" && n.forEach((Y) => {
60
+ let p = "YYYY";
61
+ t[0].value.includes("month") ? p = "MMM YYYY" : t[0].value.includes("day") && (p = "DD MMM YYYY"), Y[t[0].value] = b(Y[t[0].value]).format(
62
+ p
50
63
  );
51
- }), r.data.setAll(i), h.children.push(
52
- j.new(e, {
53
- centerX: m(50),
54
- x: m(50),
64
+ }), r.data.setAll(n), h.children.push(
65
+ E.new(e, {
66
+ centerX: l(50),
67
+ x: l(50),
55
68
  marginTop: 15,
56
69
  marginBottom: 15
57
70
  })
58
71
  ).data.setAll(r.dataItems), r.appear(1e3, 100);
59
72
  }, T), () => {
60
73
  var e;
61
- l && clearTimeout(l), (e = n.current) == null || e.dispose(), n.current = null;
74
+ m && clearTimeout(m), (e = c.current) == null || e.dispose(), c.current = null;
62
75
  };
63
- }, [i, t, o, a.palette.mode, d]);
64
- const w = { ...p };
65
- return { chartId: f, ownerState: w, sx: x, error: s, other: M };
76
+ }, [n, t, o, a.palette.mode, d]);
77
+ const k = { ...u };
78
+ return { chartId: f, ownerState: k, sx: x, error: i, other: M };
66
79
  };
67
80
  export {
68
- K as useDonutChartLogic
81
+ G as useDonutChartLogic
69
82
  };