@hybridcore/ui 1.6.21 → 1.6.22

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
@@ -75,6 +75,7 @@ import { ComponentName } from '@hybridcore/ui';
75
75
  | DrillDownTreemap | HCDrillDownTreemap | Treemap with click-to-drill-down hierarchy | chart, treemap, hierarchy |
76
76
  | DrillDownVoronoiTreemap | HCDrillDownVoronoiTreemap | Voronoi-tessellation treemap with drill-down | chart, treemap, voronoi |
77
77
  | Heatmap | HCHeatmap | Categorical heatmap (X/Y axes, color-coded values) | chart, heatmap |
78
+ | Histogram | HCHistogram | Numeric-bin distribution (ValueAxis bins, optional log scale) | chart, histogram, distribution |
78
79
  | HighlightLineChart | HCHighlightLineChart | Line chart with hover highlighting | chart, line, hover |
79
80
  | LineChart | HCLineChart | Multi-series line chart | chart, line |
80
81
  | LogaritmicScale | HCLogaritmicScale | Chart with logarithmic Y-axis | chart, log, scale |
@@ -1,10 +1,13 @@
1
1
  import { jsx as n } from "react/jsx-runtime";
2
- import { useButtonLogic as i } from "./logic.js";
3
- import { ButtonRoot as s } from "./styled.js";
4
- const u = (t) => {
5
- const { state: o, actions: r } = i(t);
6
- return /* @__PURE__ */ n(s, { ...o.rest, onClick: r.handleClick });
7
- };
2
+ import i from "react";
3
+ import { useButtonLogic as m } from "./logic.js";
4
+ import { ButtonRoot as c } from "./styled.js";
5
+ const p = i.forwardRef(
6
+ (t, o) => {
7
+ const { state: r, actions: e } = m(t);
8
+ return /* @__PURE__ */ n(c, { ref: o, ...r.rest, onClick: e.handleClick });
9
+ }
10
+ );
8
11
  export {
9
- u as Button
12
+ p as Button
10
13
  };
@@ -1,50 +1,52 @@
1
- import { jsxs as a, jsx as r, Fragment as h } from "react/jsx-runtime";
1
+ import { jsxs as i, jsx as r, Fragment as h } from "react/jsx-runtime";
2
2
  import { Typography as C, Divider as c } from "@mui/material";
3
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";
4
+ import { CandlestickChart as s } from "../candlestick/index.js";
5
+ import { ColumnLineMix as f } from "../column-line-mix/index.js";
6
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";
7
+ import { DrillDownTreemap as g } 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
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";
11
+ import { Histogram as k } from "../histogram/index.js";
12
+ import { LineChart as S } from "../line/index.js";
13
+ import { LogaritmicScale as P } from "../logaritmic-scale/index.js";
14
+ import { MultipleValueAxes as w } from "../multiple-value-axes/index.js";
15
+ import { NestedPie as H } from "../nested-pie/index.js";
15
16
  import { PackedCircles as A } from "../packed-circles/index.js";
16
17
  import { PieChart as T } from "../pie-chart/index.js";
17
18
  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 }) }),
19
+ import { StackedColumnChart as M } from "../stacked-column-chart/index.js";
20
+ import { XYChart as a } from "../xy-chart/index.js";
21
+ import { useChartWrapperLogic as V } from "./logic.js";
22
+ import { ChartWrapperRoot as v, ChartWrapperHeader as y, ChartWrapperContent as F } from "./styled.js";
23
+ const tr = (m) => {
24
+ const { title: p, type: o, chartProps: t, loading: n, ownerState: e, sx: l } = V(m);
25
+ return /* @__PURE__ */ i(v, { ownerState: e, sx: l, children: [
26
+ /* @__PURE__ */ r(y, { ownerState: e, children: /* @__PURE__ */ r(C, { sx: { paddingLeft: "0.5rem" }, variant: "h3", children: p }) }),
26
27
  /* @__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" }),
28
+ /* @__PURE__ */ r(F, { ownerState: e, children: n ? /* @__PURE__ */ r(d, { show: !0, position: "absolute" }) : /* @__PURE__ */ i(h, { children: [
29
+ o === "MultipleValueAxes" && /* @__PURE__ */ r(w, { ...t }),
30
+ o === "XYChart" && /* @__PURE__ */ r(a, { ...t }),
31
+ o === "XYChartHorizontal" && /* @__PURE__ */ r(a, { ...t, orientation: "horizontal" }),
31
32
  o === "HeatLegend" && /* @__PURE__ */ r(x, { ...t }),
33
+ o === "Histogram" && /* @__PURE__ */ r(k, { ...t }),
32
34
  o === "PieChart" && /* @__PURE__ */ r(T, { ...t }),
33
35
  o === "DonutChart" && /* @__PURE__ */ r(u, { ...t }),
34
- o === "StackedColumnChart" && /* @__PURE__ */ r(H, { ...t }),
36
+ o === "StackedColumnChart" && /* @__PURE__ */ r(M, { ...t }),
35
37
  o === "StackedAreaRadar" && /* @__PURE__ */ r(W, { ...t }),
36
- o === "LineChart" && /* @__PURE__ */ r(k, { ...t }),
37
- o === "NestedPie" && /* @__PURE__ */ r(w, { ...t }),
38
+ o === "LineChart" && /* @__PURE__ */ r(S, { ...t }),
39
+ o === "NestedPie" && /* @__PURE__ */ r(H, { ...t }),
38
40
  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 })
41
+ o === "LogarithmicScale" && /* @__PURE__ */ r(P, { ...t }),
42
+ o === "ColumnAndLineMix" && /* @__PURE__ */ r(f, { ...t }),
43
+ o === "DrillDownTreemap" && /* @__PURE__ */ r(g, { ...t }),
44
+ o === "DrillDownVoronoiTreemap" && /* @__PURE__ */ r(D, { ...t }),
45
+ o === "CandlestickChart" && /* @__PURE__ */ r(s, { ...t }),
46
+ o === "ForecastCone" && /* @__PURE__ */ r(L, { ...t })
45
47
  ] }) })
46
48
  ] });
47
49
  };
48
50
  export {
49
- rr as ChartWrapper
51
+ tr as ChartWrapper
50
52
  };
@@ -1,41 +1,41 @@
1
1
  import { R as M, A as O } from "../../../AnimatedTheme-ktdO3Bel.js";
2
- import { useThemeProps as E, useTheme as P } from "@mui/material";
3
- import C from "lodash";
2
+ import { useThemeProps as B, useTheme as E } from "@mui/material";
3
+ import P from "lodash";
4
4
  import { useId as V, useRef as z, useEffect as G } from "react";
5
- import { humanizeLabel as b } from "../_common/format.js";
5
+ import { humanizeLabel as C } from "../_common/format.js";
6
6
  import { attachCombinedAxisTooltip as N } from "../_common/tooltip.js";
7
7
  import { colorSetFromPalette as W, applyDateAxisLabelFormat as q, applyValueFormat as H } from "../_common/utils.js";
8
- import { c as l, p as U, a as D } from "../../../Entity-BJCuhdq_.js";
8
+ import { c as l, p as U, a as b } from "../../../Entity-BJCuhdq_.js";
9
9
  import { X as _, V as $ } from "../../../AxisRenderer-BCQoUJw6.js";
10
10
  import { S as j } from "../../../Scrollbar-CTI7_8Qw.js";
11
- import { A as X, a as J } from "../../../AxisRendererY-AXWvGU6r.js";
11
+ import { A as D, a as J } from "../../../AxisRendererY-AXWvGU6r.js";
12
12
  import { C as K } from "../../../CategoryAxis-B6NqW8qd.js";
13
13
  import { C as Q } from "../../../ColumnSeries-CtRTsn-E.js";
14
- import { D as L, G as Z } from "../../../GaplessDateAxis-B2g2jgSG.js";
14
+ import { D as X, G as Z } from "../../../GaplessDateAxis-B2g2jgSG.js";
15
15
  import { L as ee } from "../../../LineSeries-D_IL2qGF.js";
16
16
  import { B as te } from "../../../Bullet-Djj7Vs9T.js";
17
17
  import { C as re } from "../../../Circle-BnfBNKBD.js";
18
18
  import { X as ae } from "../../../XYCursor-CVUSpqb9.js";
19
19
  import { L as oe } from "../../../Legend-CFvQiIfn.js";
20
20
  import { D as se } from "../../../DateAxis-DEXKps1S.js";
21
- const Ye = (Y) => {
22
- const f = E({ props: Y, name: "HCColumnLineMix" }), {
21
+ const Ye = (L) => {
22
+ const f = B({ props: L, name: "HCColumnLineMix" }), {
23
23
  dimensions: t,
24
24
  values: n,
25
25
  data: p,
26
- initDelay: S = 0,
26
+ initDelay: Y = 0,
27
27
  baseInterval: h,
28
28
  colors: x,
29
29
  skipEmptyDates: A = !1,
30
- sx: T,
31
- ...R
32
- } = f, s = P(), y = `hc-column-line-mix-${V().replace(/:/g, "")}`, d = z(null), g = t.length < 1 ? "ColumnLineMix requires at least 1 dimension" : null;
30
+ sx: S,
31
+ ...T
32
+ } = f, s = E(), g = `hc-column-line-mix-${V().replace(/:/g, "")}`, d = z(null), y = t.length < 1 ? "ColumnLineMix requires at least 1 dimension" : null;
33
33
  G(() => {
34
- if (g) return;
34
+ if (y) return;
35
35
  let c;
36
36
  return c = setTimeout(() => {
37
37
  var w, F, v, k;
38
- const e = M.new(y);
38
+ const e = M.new(g);
39
39
  d.current = e, e.setThemes([O.new(e)]), e.interfaceColors.setAll({
40
40
  text: l(s.palette.text.primary),
41
41
  grid: l(s.palette.divider),
@@ -58,14 +58,14 @@ const Ye = (Y) => {
58
58
  );
59
59
  let a, m = p;
60
60
  if (t[0].type === "date") {
61
- m = C.orderBy(p, [t[0].value]);
61
+ m = P.orderBy(p, [t[0].value]);
62
62
  const i = A ? Z : se;
63
63
  a = r.xAxes.push(
64
64
  i.new(e, {
65
65
  maxDeviation: 0.1,
66
66
  groupData: !1,
67
67
  baseInterval: h || { timeUnit: "day", count: 1 },
68
- renderer: X.new(e, {})
68
+ renderer: D.new(e, {})
69
69
  })
70
70
  ), (w = a.get("renderer")) == null || w.grid.template.setAll({
71
71
  stroke: l(s.palette.divider),
@@ -75,7 +75,7 @@ const Ye = (Y) => {
75
75
  a = r.xAxes.push(
76
76
  K.new(e, {
77
77
  categoryField: t[0].value,
78
- renderer: X.new(e, {})
78
+ renderer: D.new(e, {})
79
79
  })
80
80
  ), (F = a.get("renderer")) == null || F.grid.template.setAll({
81
81
  stroke: l(s.palette.divider),
@@ -83,7 +83,7 @@ const Ye = (Y) => {
83
83
  }), e.numberFormatter.setAll({
84
84
  numberFormat: "#",
85
85
  numericFields: ["valueX"]
86
- }), m = C.orderBy(p, [t[0].value]), a.data.setAll(m);
86
+ }), a.data.setAll(m);
87
87
  const u = r.yAxes.push(
88
88
  $.new(e, {
89
89
  min: 0,
@@ -98,7 +98,7 @@ const Ye = (Y) => {
98
98
  if (I === 0) {
99
99
  const o = r.series.push(
100
100
  Q.new(e, {
101
- name: i.label ?? b(i.name),
101
+ name: i.label ?? C(i.name),
102
102
  xAxis: a,
103
103
  yAxis: u,
104
104
  valueYField: i.dataFieldName,
@@ -108,14 +108,14 @@ const Ye = (Y) => {
108
108
  o.columns.template.setAll({
109
109
  tooltipY: U(10),
110
110
  templateField: "columnSettings"
111
- }), t[0].type === "date" && (o.data.processor = L.new(e, {
111
+ }), t[0].type === "date" && (o.data.processor = X.new(e, {
112
112
  dateFormat: "i",
113
113
  dateFields: [t[0].value]
114
114
  })), o.data.setAll(m), o.appear();
115
115
  } else {
116
116
  const o = r.series.push(
117
117
  ee.new(e, {
118
- name: i.label ?? b(i.name),
118
+ name: i.label ?? C(i.name),
119
119
  xAxis: a,
120
120
  yAxis: u,
121
121
  valueYField: i.dataFieldName,
@@ -125,7 +125,7 @@ const Ye = (Y) => {
125
125
  o.strokes.template.setAll({
126
126
  strokeWidth: 3,
127
127
  templateField: "strokeSettings"
128
- }), t[0].type === "date" && (o.data.processor = L.new(e, {
128
+ }), t[0].type === "date" && (o.data.processor = X.new(e, {
129
129
  dateFormat: "i",
130
130
  dateFields: [t[0].value]
131
131
  })), o.data.setAll(m), o.bullets.push(function() {
@@ -152,17 +152,17 @@ const Ye = (Y) => {
152
152
  follow: !0
153
153
  }), r.children.push(
154
154
  oe.new(e, {
155
- centerX: D,
156
- x: D
155
+ centerX: b,
156
+ x: b
157
157
  })
158
158
  ).data.setAll(r.series.values), H(e, (k = n == null ? void 0 : n[0]) == null ? void 0 : k.format), r.appear(1e3, 100);
159
- }, S), () => {
159
+ }, Y), () => {
160
160
  var e;
161
161
  c && clearTimeout(c), (e = d.current) == null || e.dispose(), d.current = null;
162
162
  };
163
163
  }, [p, t, n, s.palette.mode, x, A]);
164
- const B = { ...f };
165
- return { chartId: y, ownerState: B, sx: T, error: g, other: R };
164
+ const R = { ...f };
165
+ return { chartId: g, ownerState: R, sx: S, error: y, other: T };
166
166
  };
167
167
  export {
168
168
  Ye as useColumnLineMixLogic
@@ -0,0 +1,11 @@
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { ChartError as a } from "../_common/chart-error.js";
3
+ import { useHistogramLogic as h } from "./logic.js";
4
+ import { HistogramRoot as g } from "./styled.js";
5
+ const f = (t) => {
6
+ const { chartId: i, ownerState: e, sx: m, error: o, other: s } = h(t);
7
+ return /* @__PURE__ */ r(g, { ownerState: e, sx: m, ...s, children: o ? /* @__PURE__ */ r(a, { message: o }) : /* @__PURE__ */ r("div", { id: i, style: { width: "100%", height: "100%" } }) });
8
+ };
9
+ export {
10
+ f as Histogram
11
+ };
@@ -0,0 +1,133 @@
1
+ import { R as O, A as H } from "../../../AnimatedTheme-ktdO3Bel.js";
2
+ import { useThemeProps as P, useTheme as W } from "@mui/material";
3
+ import z from "lodash";
4
+ import { useId as Z, useRef as $, useEffect as j } from "react";
5
+ import { humanizeLabel as q } from "../_common/format.js";
6
+ import { colorSetFromPalette as J, applyValueFormat as K } from "../_common/utils.js";
7
+ import { c as i, a as F, p as Q } from "../../../Entity-BJCuhdq_.js";
8
+ import { X as U, V as Y } from "../../../AxisRenderer-BCQoUJw6.js";
9
+ import { L as ee } from "../../../Legend-CFvQiIfn.js";
10
+ import { A as te, a as re } from "../../../AxisRendererY-AXWvGU6r.js";
11
+ import { C as oe } from "../../../ColumnSeries-CtRTsn-E.js";
12
+ import { T as se } from "../../../Tooltip-vyZRZWih.js";
13
+ import { X as ne } from "../../../XYCursor-CVUSpqb9.js";
14
+ const R = "__hcBinStart", _ = "__hcBinEnd", Ne = (C) => {
15
+ const x = P({ props: C, name: "HCHistogram" }), {
16
+ dimensions: p,
17
+ values: u,
18
+ data: A,
19
+ initDelay: B = 0,
20
+ colors: b,
21
+ binWidth: v,
22
+ barGap: y = 0,
23
+ logarithmic: d = !1,
24
+ sx: D,
25
+ ...I
26
+ } = x, r = W(), N = `hc-histogram-${Z().replace(/:/g, "")}`, h = $(null), X = p.length < 1 ? "Missing dimensions config!" : u.length < 1 ? "Missing values config!" : null;
27
+ j(() => {
28
+ if (X) return;
29
+ let f;
30
+ return f = setTimeout(() => {
31
+ var k, w;
32
+ const e = O.new(N);
33
+ h.current = e, e.setThemes([H.new(e)]), e.interfaceColors.setAll({
34
+ text: i(r.palette.text.primary),
35
+ grid: i(r.palette.divider),
36
+ stroke: i(r.palette.divider)
37
+ });
38
+ const o = e.container.children.push(
39
+ U.new(e, {
40
+ panX: !1,
41
+ panY: !1,
42
+ wheelX: "none",
43
+ wheelY: "none",
44
+ layout: e.verticalLayout
45
+ })
46
+ );
47
+ o.set("colors", J(e, b));
48
+ const S = o.children.push(
49
+ ee.new(e, {
50
+ centerX: F,
51
+ x: F
52
+ })
53
+ ), s = p[0].value, l = u[0], V = l.dataFieldName, m = z.orderBy(
54
+ A.filter(
55
+ (t) => (t == null ? void 0 : t[s]) != null && !Number.isNaN(Number(t[s]))
56
+ ),
57
+ [(t) => Number(t[s])]
58
+ );
59
+ let c = 1 / 0;
60
+ for (let t = 1; t < m.length; t++) {
61
+ const n = Number(m[t][s]) - Number(m[t - 1][s]);
62
+ n > 0 && n < c && (c = n);
63
+ }
64
+ const E = v ?? (Number.isFinite(c) ? c : 1), G = m.map((t) => {
65
+ const n = Number(t[s]);
66
+ return { ...t, [R]: n, [_]: n + E };
67
+ }), g = o.xAxes.push(
68
+ Y.new(e, {
69
+ maxDeviation: 0,
70
+ renderer: te.new(e, { minGridDistance: 40 })
71
+ })
72
+ ), T = o.yAxes.push(
73
+ Y.new(e, {
74
+ // Linear: frequency bars must grow from a zero baseline, else the auto
75
+ // min crops the axis and distorts relative bar heights. Log: `min: 0`
76
+ // is invalid (log 0 is undefined), so drop it and map zero-count bins
77
+ // to `1` (the axis floor) — those bins then render as no bar.
78
+ ...d ? { logarithmic: !0, treatZeroAs: 1 } : { min: 0 },
79
+ renderer: re.new(e, {
80
+ strokeOpacity: 0.1,
81
+ ...d ? { minorGridEnabled: !0 } : {}
82
+ })
83
+ })
84
+ );
85
+ (k = g.get("renderer")) == null || k.grid.template.setAll({
86
+ stroke: i(r.palette.divider),
87
+ strokeOpacity: 1
88
+ }), (w = T.get("renderer")) == null || w.grid.template.setAll({
89
+ stroke: i(r.palette.divider),
90
+ strokeOpacity: 1
91
+ });
92
+ const a = o.series.push(
93
+ oe.new(e, {
94
+ name: l.label ?? q(l.name),
95
+ xAxis: g,
96
+ yAxis: T,
97
+ valueYField: V,
98
+ // Explicit [open, value] edges give each bar its exact bin span, so
99
+ // bars sit to numeric scale and a missing bin leaves a real gap.
100
+ openValueXField: R,
101
+ valueXField: _
102
+ })
103
+ ), M = Math.min(Math.max(y, 0), 1);
104
+ a.columns.template.setAll({
105
+ width: Q((1 - M) * 100),
106
+ strokeOpacity: 1,
107
+ strokeWidth: 1,
108
+ stroke: i(r.palette.background.paper),
109
+ tooltipText: "{openValueX} – {valueX}: {valueY}"
110
+ }), a.set("tooltip", se.new(e, {})), a.data.setAll(G), a.appear(), S.data.push(a), o.set(
111
+ "cursor",
112
+ ne.new(e, { xAxis: g, behavior: "none" })
113
+ ).lineY.set("visible", !1), K(e, l.format), o.appear(1e3, 100);
114
+ }, B), () => {
115
+ var e;
116
+ f && clearTimeout(f), (e = h.current) == null || e.dispose(), h.current = null;
117
+ };
118
+ }, [
119
+ A,
120
+ p,
121
+ u,
122
+ r.palette.mode,
123
+ b,
124
+ v,
125
+ y,
126
+ d
127
+ ]);
128
+ const L = { ...x };
129
+ return { chartId: N, ownerState: L, sx: D, error: X, other: I };
130
+ };
131
+ export {
132
+ Ne as useHistogramLogic
133
+ };
@@ -0,0 +1,12 @@
1
+ import { styled as t, Box as r } from "@mui/material";
2
+ const s = t(r, {
3
+ name: "HCHistogram",
4
+ slot: "Root",
5
+ shouldForwardProp: (o) => o !== "ownerState"
6
+ })(() => ({
7
+ width: "100%",
8
+ height: "100%"
9
+ }));
10
+ export {
11
+ s as HistogramRoot
12
+ };
@@ -1,13 +1,13 @@
1
- import { R as H, T as Z, A as $ } from "../../../AnimatedTheme-ktdO3Bel.js";
2
- import { useThemeProps as j, useTheme as q } from "@mui/material";
3
- import U from "lodash";
1
+ import { R as z, T as H, A as Z } from "../../../AnimatedTheme-ktdO3Bel.js";
2
+ import { useThemeProps as $, useTheme as j } from "@mui/material";
3
+ import q from "lodash";
4
4
  import { useId as J, useRef as K, useEffect as Q } from "react";
5
5
  import { humanizeLabel as ee } from "../_common/format.js";
6
6
  import { attachCombinedAxisTooltip as te } from "../_common/tooltip.js";
7
7
  import { colorSetFromPalette as re, applyDateAxisLabelFormat as se, applyValueFormat as oe } from "../_common/utils.js";
8
- import { c as d, p as X, b as V } from "../../../Entity-BJCuhdq_.js";
8
+ import { c as d, p as X, b as U } from "../../../Entity-BJCuhdq_.js";
9
9
  import { X as ae, V as ie } from "../../../AxisRenderer-BCQoUJw6.js";
10
- import { A as _, a as ne } from "../../../AxisRendererY-AXWvGU6r.js";
10
+ import { A as V, a as ne } from "../../../AxisRendererY-AXWvGU6r.js";
11
11
  import { C as le } from "../../../CategoryAxis-B6NqW8qd.js";
12
12
  import { L as me } from "../../../LineSeries-D_IL2qGF.js";
13
13
  import { D as pe, G as de } from "../../../GaplessDateAxis-B2g2jgSG.js";
@@ -16,7 +16,7 @@ import { C as ue } from "../../../Circle-BnfBNKBD.js";
16
16
  import { X as fe } from "../../../XYCursor-CVUSpqb9.js";
17
17
  import { L as he } from "../../../Legend-CFvQiIfn.js";
18
18
  import { D as Ae } from "../../../DateAxis-DEXKps1S.js";
19
- const B = 1.1, ge = {
19
+ const _ = 1.1, ge = {
20
20
  millisecond: 1,
21
21
  second: 1e3,
22
22
  minute: 6e4,
@@ -26,28 +26,28 @@ const B = 1.1, ge = {
26
26
  month: 2592e6,
27
27
  year: 31536e6
28
28
  }, _e = (E) => {
29
- const b = j({ props: E, name: "HCLineChart" }), {
29
+ const b = $({ props: E, name: "HCLineChart" }), {
30
30
  dimensions: t,
31
31
  values: m,
32
- data: A,
32
+ data: w,
33
33
  initDelay: P = 0,
34
34
  baseInterval: n,
35
35
  colors: L,
36
36
  connectMissingData: k = !0,
37
- skipEmptyDates: v = !1,
37
+ skipEmptyDates: C = !1,
38
38
  sx: R,
39
39
  ...W
40
- } = b, l = q(), N = `hc-line-chart-${J().replace(/:/g, "")}`, C = K(null);
41
- let g = null;
42
- t.length < 1 ? g = "Missing dimensions config!" : m.length < 1 && (g = "Missing values config!"), Q(() => {
43
- if (g) return;
40
+ } = b, l = j(), N = `hc-line-chart-${J().replace(/:/g, "")}`, v = K(null);
41
+ let h = null;
42
+ t.length < 1 ? h = "Missing dimensions config!" : m.length < 1 && (h = "Missing values config!"), Q(() => {
43
+ if (h) return;
44
44
  let T;
45
45
  return T = setTimeout(() => {
46
46
  var G, O, I, M;
47
- const e = H.new(N);
48
- C.current = e;
49
- const z = Z.new(e);
50
- e.setThemes([$.new(e), z]), e.interfaceColors.setAll({
47
+ const e = z.new(N);
48
+ v.current = e;
49
+ const S = H.new(e);
50
+ e.setThemes([Z.new(e), S]), e.interfaceColors.setAll({
51
51
  text: d(l.palette.text.primary),
52
52
  grid: d(l.palette.divider),
53
53
  stroke: d(l.palette.divider)
@@ -65,27 +65,27 @@ const B = 1.1, ge = {
65
65
  })
66
66
  );
67
67
  s.set("colors", re(e, L));
68
- let i, c = A;
68
+ let i, A = w;
69
69
  if (t[0].type === "date") {
70
- const o = v ? de : Ae;
70
+ const o = C ? de : Ae;
71
71
  i = s.xAxes.push(
72
72
  o.new(e, {
73
73
  maxDeviation: 0.1,
74
74
  groupData: !1,
75
75
  baseInterval: n || { timeUnit: "day", count: 1 },
76
- renderer: _.new(e, {})
76
+ renderer: V.new(e, {})
77
77
  })
78
- ), se(i, t[0]), c = U.orderBy(A, [t[0].value]);
78
+ ), se(i, t[0]), A = q.orderBy(w, [t[0].value]);
79
79
  } else
80
80
  i = s.xAxes.push(
81
81
  le.new(e, {
82
82
  categoryField: t[0].value,
83
- renderer: _.new(e, {})
83
+ renderer: V.new(e, {})
84
84
  })
85
85
  ), e.numberFormatter.setAll({
86
86
  numberFormat: "#",
87
87
  numericFields: ["valueX"]
88
- }), c = U.orderBy(A, [t[0].value]), i.data.setAll(c);
88
+ }), i.data.setAll(A);
89
89
  const Y = s.yAxes.push(
90
90
  ie.new(e, {
91
91
  renderer: ne.new(e, {})
@@ -111,24 +111,24 @@ const B = 1.1, ge = {
111
111
  // `autoGapCount` (default 1.1) base intervals apart, so absent dates
112
112
  // surface as gaps instead of being bridged by a straight segment.
113
113
  connect: k,
114
- autoGapCount: B,
114
+ autoGapCount: _,
115
115
  ...t[0].type === "date" ? { valueXField: t[0].value } : { categoryXField: t[0].value }
116
116
  })
117
117
  );
118
118
  if (t[0].type === "date" && (a.data.processor = pe.new(e, {
119
119
  dateFormat: "i",
120
120
  dateFields: [t[0].value]
121
- })), t[0].type === "date" && !v) {
122
- const y = t[0].value, x = ge[(n == null ? void 0 : n.timeUnit) ?? "day"] * ((n == null ? void 0 : n.count) ?? 1), p = k ? 1 / 0 : x * B, w = c.map((r) => ({
123
- t: new Date(r[y]).getTime(),
121
+ })), t[0].type === "date" && !C) {
122
+ const g = t[0].value, y = ge[(n == null ? void 0 : n.timeUnit) ?? "day"] * ((n == null ? void 0 : n.count) ?? 1), p = k ? 1 / 0 : y * _, x = A.map((r) => ({
123
+ t: new Date(r[g]).getTime(),
124
124
  hasValue: r[o.dataFieldName] !== null && r[o.dataFieldName] !== void 0
125
125
  })).filter((r) => r.hasValue && !Number.isNaN(r.t)), D = /* @__PURE__ */ new Set();
126
- w.forEach((r, f) => {
127
- const F = f > 0 ? r.t - w[f - 1].t : 1 / 0, h = f < w.length - 1 ? w[f + 1].t - r.t : 1 / 0;
128
- F > p && h > p && D.add(r.t);
129
- }), D.size > 0 && a.bullets.push((r, f, F) => {
130
- const h = F.dataContext;
131
- if (D.has(new Date(h == null ? void 0 : h[y]).getTime()))
126
+ x.forEach((r, u) => {
127
+ const F = u > 0 ? r.t - x[u - 1].t : 1 / 0, f = u < x.length - 1 ? x[u + 1].t - r.t : 1 / 0;
128
+ F > p && f > p && D.add(r.t);
129
+ }), D.size > 0 && a.bullets.push((r, u, F) => {
130
+ const f = F.dataContext;
131
+ if (D.has(new Date(f == null ? void 0 : f[g]).getTime()))
132
132
  return ce.new(r, {
133
133
  sprite: ue.new(r, {
134
134
  radius: 3,
@@ -139,7 +139,7 @@ const B = 1.1, ge = {
139
139
  });
140
140
  });
141
141
  }
142
- a.data.setAll(c), a.strokes.template.setAll({ strokeWidth: 2 }), a.appear();
142
+ a.data.setAll(A), a.strokes.template.setAll({ strokeWidth: 2 }), a.appear();
143
143
  }), s.set(
144
144
  "cursor",
145
145
  fe.new(e, { xAxis: i, behavior: "none" })
@@ -152,7 +152,7 @@ const B = 1.1, ge = {
152
152
  baseInterval: n,
153
153
  follow: !0
154
154
  });
155
- const u = s.bottomAxesContainer.children.push(
155
+ const c = s.bottomAxesContainer.children.push(
156
156
  he.new(e, {
157
157
  width: X(100),
158
158
  paddingTop: 10,
@@ -161,16 +161,16 @@ const B = 1.1, ge = {
161
161
  layout: e.gridLayout
162
162
  })
163
163
  );
164
- u.itemContainers.template.events.on("pointerover", function(o) {
165
- var x;
166
- const a = o.target, y = (x = a == null ? void 0 : a.dataItem) == null ? void 0 : x.dataContext;
164
+ c.itemContainers.template.events.on("pointerover", function(o) {
165
+ var y;
166
+ const a = o.target, g = (y = a == null ? void 0 : a.dataItem) == null ? void 0 : y.dataContext;
167
167
  s.series.each(function(p) {
168
- p !== y ? p.strokes.template.setAll({
168
+ p !== g ? p.strokes.template.setAll({
169
169
  strokeOpacity: 0.15,
170
170
  stroke: d(0)
171
171
  }) : p.strokes.template.setAll({ strokeWidth: 3 });
172
172
  });
173
- }), u.itemContainers.template.events.on("pointerout", function() {
173
+ }), c.itemContainers.template.events.on("pointerout", function() {
174
174
  s.series.each(function(o) {
175
175
  o.strokes.template.setAll({
176
176
  strokeOpacity: 1,
@@ -178,25 +178,25 @@ const B = 1.1, ge = {
178
178
  stroke: o.get("fill")
179
179
  });
180
180
  });
181
- }), u.itemContainers.template.set("width", V), u.valueLabels.template.setAll({
182
- width: V,
181
+ }), c.itemContainers.template.set("width", U), c.valueLabels.template.setAll({
182
+ width: U,
183
183
  textAlign: "right"
184
- }), u.data.setAll(s.series.values), oe(e, (M = m == null ? void 0 : m[0]) == null ? void 0 : M.format), s.appear(1e3, 100);
184
+ }), c.data.setAll(s.series.values), oe(e, (M = m == null ? void 0 : m[0]) == null ? void 0 : M.format), s.appear(1e3, 100);
185
185
  }, P), () => {
186
186
  var e;
187
- T && clearTimeout(T), (e = C.current) == null || e.dispose(), C.current = null;
187
+ T && clearTimeout(T), (e = v.current) == null || e.dispose(), v.current = null;
188
188
  };
189
189
  }, [
190
- A,
190
+ w,
191
191
  t,
192
192
  m,
193
193
  l.palette.mode,
194
194
  L,
195
195
  k,
196
- v
196
+ C
197
197
  ]);
198
- const S = { ...b };
199
- return { chartId: N, ownerState: S, sx: R, error: g, other: W };
198
+ const B = { ...b };
199
+ return { chartId: N, ownerState: B, sx: R, error: h, other: W };
200
200
  };
201
201
  export {
202
202
  _e as useLineChartLogic