@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.
@@ -1,6 +1,6 @@
1
- import { R as Y, A as R } from "../../../AnimatedTheme-ktdO3Bel.js";
2
- import { useThemeProps as E, useTheme as I } from "@mui/material";
3
- import F from "lodash";
1
+ import { R as T, A as Y } from "../../../AnimatedTheme-ktdO3Bel.js";
2
+ import { useThemeProps as R, useTheme as E } from "@mui/material";
3
+ import I from "lodash";
4
4
  import { useId as G, useRef as O, useEffect as P } from "react";
5
5
  import { humanizeLabel as V } from "../_common/format.js";
6
6
  import { attachCombinedAxisTooltip as q } from "../_common/tooltip.js";
@@ -8,32 +8,32 @@ import { colorSetFromPalette as z, applyDateAxisLabelFormat as B, applyValueForm
8
8
  import { c as i } from "../../../Entity-BJCuhdq_.js";
9
9
  import { X as N, V as U } from "../../../AxisRenderer-BCQoUJw6.js";
10
10
  import { X as W } from "../../../XYCursor-CVUSpqb9.js";
11
- import { A as X, a as Z } from "../../../AxisRendererY-AXWvGU6r.js";
11
+ import { A as F, a as Z } from "../../../AxisRendererY-AXWvGU6r.js";
12
12
  import { C as _ } from "../../../CategoryAxis-B6NqW8qd.js";
13
13
  import { L as $ } from "../../../LineSeries-D_IL2qGF.js";
14
14
  import { D as j, G as J } from "../../../GaplessDateAxis-B2g2jgSG.js";
15
15
  import { S as K } from "../../../Scrollbar-CTI7_8Qw.js";
16
16
  import { D as M } from "../../../DateAxis-DEXKps1S.js";
17
- const xe = (k) => {
18
- const f = E({ props: k, name: "HCLogaritmicScale" }), {
17
+ const xe = (X) => {
18
+ const f = R({ props: X, name: "HCLogaritmicScale" }), {
19
19
  dimensions: t,
20
20
  values: s,
21
- data: n,
22
- initDelay: L = 0,
21
+ data: p,
22
+ initDelay: k = 0,
23
23
  baseInterval: h,
24
24
  colors: A,
25
25
  skipEmptyDates: x = !1,
26
- sx: S,
27
- ...C
28
- } = f, a = I(), g = `hc-logaritmic-scale-${G().replace(/:/g, "")}`, d = O(null);
29
- let m = null;
30
- t.length < 1 ? m = "LogaritmicScale requires at least 1 dimension" : s.length < 1 && (m = "LogaritmicScale requires at least 1 value"), P(() => {
31
- if (m) return;
32
- let u;
33
- return u = setTimeout(() => {
34
- var v, w, D, b;
35
- const e = Y.new(g);
36
- d.current = e, e.setThemes([R.new(e)]), e.interfaceColors.setAll({
26
+ sx: L,
27
+ ...S
28
+ } = f, a = E(), g = `hc-logaritmic-scale-${G().replace(/:/g, "")}`, c = O(null);
29
+ let n = null;
30
+ t.length < 1 ? n = "LogaritmicScale requires at least 1 dimension" : s.length < 1 && (n = "LogaritmicScale requires at least 1 value"), P(() => {
31
+ if (n) return;
32
+ let d;
33
+ return d = setTimeout(() => {
34
+ var w, v, D, b;
35
+ const e = T.new(g);
36
+ c.current = e, e.setThemes([Y.new(e)]), e.interfaceColors.setAll({
37
37
  text: i(a.palette.text.primary),
38
38
  grid: i(a.palette.divider),
39
39
  stroke: i(a.palette.divider)
@@ -52,18 +52,18 @@ const xe = (k) => {
52
52
  "cursor",
53
53
  W.new(e, { behavior: "none" })
54
54
  ).lineY.set("visible", !1);
55
- let o, p = n;
55
+ let o, u = p;
56
56
  if (t[0].type === "date") {
57
- p = F.orderBy(n, [t[0].value]);
57
+ u = I.orderBy(p, [t[0].value]);
58
58
  const l = x ? J : M;
59
59
  o = r.xAxes.push(
60
60
  l.new(e, {
61
61
  maxDeviation: 0.1,
62
62
  groupData: !1,
63
63
  baseInterval: h || { timeUnit: "day", count: 1 },
64
- renderer: X.new(e, {})
64
+ renderer: F.new(e, {})
65
65
  })
66
- ), (v = o.get("renderer")) == null || v.grid.template.setAll({
66
+ ), (w = o.get("renderer")) == null || w.grid.template.setAll({
67
67
  stroke: i(a.palette.divider),
68
68
  strokeOpacity: 1
69
69
  }), B(o, t[0]);
@@ -71,12 +71,12 @@ const xe = (k) => {
71
71
  o = r.xAxes.push(
72
72
  _.new(e, {
73
73
  categoryField: t[0].value,
74
- renderer: X.new(e, {})
74
+ renderer: F.new(e, {})
75
75
  })
76
76
  ), e.numberFormatter.setAll({
77
77
  numberFormat: "#",
78
78
  numericFields: ["valueX"]
79
- }), p = F.orderBy(n, [t[0].value]), o.data.setAll(p), (w = o.get("renderer")) == null || w.grid.template.setAll({
79
+ }), o.data.setAll(u), (v = o.get("renderer")) == null || v.grid.template.setAll({
80
80
  stroke: i(a.palette.divider),
81
81
  strokeOpacity: 1
82
82
  });
@@ -90,7 +90,7 @@ const xe = (k) => {
90
90
  stroke: i(a.palette.divider),
91
91
  strokeOpacity: 1
92
92
  }), s.forEach((l) => {
93
- const c = r.series.push(
93
+ const m = r.series.push(
94
94
  $.new(e, {
95
95
  name: l.label ?? V(l.name),
96
96
  xAxis: o,
@@ -99,10 +99,10 @@ const xe = (k) => {
99
99
  ...t[0].type === "date" ? { valueXField: t[0].value } : { categoryXField: t[0].value }
100
100
  })
101
101
  );
102
- c.strokes.template.setAll({ strokeWidth: 3 }), t[0].type === "date" && (c.data.processor = j.new(e, {
102
+ m.strokes.template.setAll({ strokeWidth: 3 }), t[0].type === "date" && (m.data.processor = j.new(e, {
103
103
  dateFormat: "i",
104
104
  dateFields: [t[0].value]
105
- })), c.data.setAll(p), c.appear(1e3);
105
+ })), m.data.setAll(u), m.appear(1e3);
106
106
  }), q({
107
107
  root: e,
108
108
  chart: r,
@@ -115,13 +115,13 @@ const xe = (k) => {
115
115
  "scrollbarX",
116
116
  K.new(e, { orientation: "horizontal" })
117
117
  ), H(e, (b = s == null ? void 0 : s[0]) == null ? void 0 : b.format), r.appear(1e3, 100);
118
- }, L), () => {
118
+ }, k), () => {
119
119
  var e;
120
- u && clearTimeout(u), (e = d.current) == null || e.dispose(), d.current = null;
120
+ d && clearTimeout(d), (e = c.current) == null || e.dispose(), c.current = null;
121
121
  };
122
- }, [n, t, s, a.palette.mode, A, x]);
123
- const T = { ...f };
124
- return { chartId: g, ownerState: T, sx: S, error: m, other: C };
122
+ }, [p, t, s, a.palette.mode, A, x]);
123
+ const C = { ...f };
124
+ return { chartId: g, ownerState: C, sx: L, error: n, other: S };
125
125
  };
126
126
  export {
127
127
  xe as useLogaritmicScaleLogic
@@ -1,11 +1,11 @@
1
1
  import { R as j, A as q } from "../../../AnimatedTheme-ktdO3Bel.js";
2
2
  import { useThemeProps as z, useTheme as U } from "@mui/material";
3
- import v from "lodash";
3
+ import N from "lodash";
4
4
  import { useId as H, useRef as $, useEffect as J } from "react";
5
5
  import { humanizeLabel as P } from "../_common/format.js";
6
6
  import { attachCombinedAxisTooltip as K } from "../_common/tooltip.js";
7
7
  import { colorSetFromPalette as Q, applyDateAxisLabelFormat as Z, applyValueFormat as ee } from "../_common/utils.js";
8
- import { c as C, a as A } from "../../../Entity-BJCuhdq_.js";
8
+ import { c as v, a as g } from "../../../Entity-BJCuhdq_.js";
9
9
  import { X as te, V as re } from "../../../AxisRenderer-BCQoUJw6.js";
10
10
  import { L as se } from "../../../Legend-CFvQiIfn.js";
11
11
  import { A as X, a as ae } from "../../../AxisRendererY-AXWvGU6r.js";
@@ -14,10 +14,10 @@ import { X as oe } from "../../../XYCursor-CVUSpqb9.js";
14
14
  import { G as le, D as ne } from "../../../GaplessDateAxis-B2g2jgSG.js";
15
15
  import { D as ce } from "../../../DateAxis-DEXKps1S.js";
16
16
  import { L as me } from "../../../LineSeries-D_IL2qGF.js";
17
- import { G, R as ue } from "../../../Tooltip-vyZRZWih.js";
18
- import { C as pe } from "../../../Circle-BnfBNKBD.js";
17
+ import { G, R as pe } from "../../../Tooltip-vyZRZWih.js";
18
+ import { C as ue } from "../../../Circle-BnfBNKBD.js";
19
19
  import { B as de } from "../../../Bullet-Djj7Vs9T.js";
20
- class y extends G {
20
+ class x extends G {
21
21
  _beforeChanged() {
22
22
  super._beforeChanged(), (this.isDirty("width") || this.isDirty("height") || this.isPrivateDirty("width") || this.isPrivateDirty("height")) && (this._clear = !0);
23
23
  }
@@ -32,41 +32,41 @@ class y extends G {
32
32
  this.markDirty(), this._clear = !0;
33
33
  }
34
34
  }
35
- Object.defineProperty(y, "className", {
35
+ Object.defineProperty(x, "className", {
36
36
  enumerable: !0,
37
37
  configurable: !0,
38
38
  writable: !0,
39
39
  value: "Triangle"
40
40
  });
41
- Object.defineProperty(y, "classNames", {
41
+ Object.defineProperty(x, "classNames", {
42
42
  enumerable: !0,
43
43
  configurable: !0,
44
44
  writable: !0,
45
- value: G.classNames.concat([y.className])
45
+ value: G.classNames.concat([x.className])
46
46
  });
47
- const x = ["CIRCLE", "RECTANGLE", "TRIANGLE"], Ge = (T) => {
48
- const c = z({ props: T, name: "HCMultipleValueAxes" }), {
47
+ const A = ["CIRCLE", "RECTANGLE", "TRIANGLE"], Ge = (C) => {
48
+ const c = z({ props: C, name: "HCMultipleValueAxes" }), {
49
49
  dimensions: s,
50
50
  values: t,
51
- data: d,
51
+ data: y,
52
52
  initDelay: I = 0,
53
- baseInterval: L,
54
- colors: R,
55
- skipEmptyDates: E = !1,
53
+ baseInterval: T,
54
+ colors: L,
55
+ skipEmptyDates: R = !1,
56
56
  sx: Y,
57
57
  ...V
58
- } = c, u = U(), _ = `hc-multiple-value-axes-${H().replace(/:/g, "")}`, w = $(null);
59
- let h = null;
60
- s.length < 1 ? h = "MultipleValueAxes requires at least 1 dimension" : t.length < 1 && (h = "MultipleValueAxes requires at least 1 value"), J(() => {
61
- if (h) return;
58
+ } = c, p = U(), E = `hc-multiple-value-axes-${H().replace(/:/g, "")}`, w = $(null);
59
+ let u = null;
60
+ s.length < 1 ? u = "MultipleValueAxes requires at least 1 dimension" : t.length < 1 && (u = "MultipleValueAxes requires at least 1 value"), J(() => {
61
+ if (u) return;
62
62
  let b;
63
63
  return b = setTimeout(() => {
64
- var N;
65
- const e = j.new(_);
64
+ var F;
65
+ const e = j.new(E);
66
66
  w.current = e, e.setThemes([q.new(e)]), e.interfaceColors.setAll({
67
- text: C(u.palette.text.primary),
68
- grid: C(u.palette.divider),
69
- stroke: C(u.palette.divider)
67
+ text: v(p.palette.text.primary),
68
+ grid: v(p.palette.divider),
69
+ stroke: v(p.palette.divider)
70
70
  });
71
71
  const r = e.container.children.push(
72
72
  te.new(e, {
@@ -78,75 +78,75 @@ const x = ["CIRCLE", "RECTANGLE", "TRIANGLE"], Ge = (T) => {
78
78
  layout: e.verticalLayout
79
79
  })
80
80
  );
81
- r.set("colors", Q(e, R)), r.get("colors", {}).set("step", 3);
82
- const O = r.children.push(
83
- se.new(e, { centerX: A, x: A })
84
- ), i = s[0];
85
- let l, p = d;
86
- if (i.type === "date") {
87
- const a = E ? le : ce;
81
+ r.set("colors", Q(e, L)), r.get("colors", {}).set("step", 3);
82
+ const S = r.children.push(
83
+ se.new(e, { centerX: g, x: g })
84
+ ), o = s[0];
85
+ let l, d = y;
86
+ if (o.type === "date") {
87
+ const a = R ? le : ce;
88
88
  l = r.xAxes.push(
89
89
  a.new(e, {
90
90
  maxDeviation: 0.1,
91
91
  groupData: !1,
92
- baseInterval: L || { timeUnit: "day", count: 1 },
92
+ baseInterval: T || { timeUnit: "day", count: 1 },
93
93
  renderer: X.new(e, {})
94
94
  })
95
- ), Z(l, i), p = v.orderBy(d, [i.value]);
95
+ ), Z(l, o), d = N.orderBy(y, [o.value]);
96
96
  } else
97
97
  l = r.xAxes.push(
98
98
  ie.new(e, {
99
- categoryField: i.value,
99
+ categoryField: o.value,
100
100
  renderer: X.new(e, {})
101
101
  })
102
102
  ), e.numberFormatter.setAll({
103
103
  numberFormat: "#",
104
104
  numericFields: ["valueX"]
105
- }), p = v.orderBy(d, [i.value]), l.data.setAll(p);
106
- function F(a, n, m, S, W, D, M) {
107
- const f = ae.new(e, { opposite: W }), k = r.yAxes.push(
108
- re.new(e, { maxDeviation: 1, renderer: f })
105
+ }), l.data.setAll(d);
106
+ function _(a, n, m, B, W, D, M) {
107
+ const h = ae.new(e, { opposite: W }), k = r.yAxes.push(
108
+ re.new(e, { maxDeviation: 1, renderer: h })
109
109
  );
110
110
  r.yAxes.indexOf(k) > 0 && k.set("syncWithAxis", r.yAxes.getIndex(0));
111
- const o = r.series.push(
111
+ const i = r.series.push(
112
112
  me.new(e, {
113
113
  name: n,
114
114
  xAxis: l,
115
115
  yAxis: k,
116
- valueYField: S,
117
- ...i.type === "date" ? { valueXField: m } : { categoryXField: m }
116
+ valueYField: B,
117
+ ...o.type === "date" ? { valueXField: m } : { categoryXField: m }
118
118
  })
119
119
  );
120
- o.strokes.template.setAll({ strokeWidth: 2 }), f.grid.template.set("strokeOpacity", 0.05), f.labels.template.set("fill", o.get("fill")), f.setAll({
121
- stroke: o.get("fill"),
120
+ i.strokes.template.setAll({ strokeWidth: 2 }), h.grid.template.set("strokeOpacity", 0.05), h.labels.template.set("fill", i.get("fill")), h.setAll({
121
+ stroke: i.get("fill"),
122
122
  strokeOpacity: 1,
123
123
  opacity: 1
124
- }), M === "date" && (o.data.processor = ne.new(e, {
124
+ }), M === "date" && (i.data.processor = ne.new(e, {
125
125
  dateFormat: "i",
126
126
  dateFields: [m]
127
- })), D !== void 0 && o.bullets.push(function() {
128
- let g;
129
- return D === "RECTANGLE" ? g = ue.new(e, {
127
+ })), D !== void 0 && i.bullets.push(function() {
128
+ let f;
129
+ return D === "RECTANGLE" ? f = pe.new(e, {
130
130
  width: 10,
131
131
  height: 10,
132
- centerX: A,
133
- centerY: A,
132
+ centerX: g,
133
+ centerY: g,
134
134
  strokeWidth: 2,
135
- stroke: o.get("stroke"),
135
+ stroke: i.get("stroke"),
136
136
  fill: e.interfaceColors.get("background")
137
- }) : D === "TRIANGLE" ? g = y.new(e, {
137
+ }) : D === "TRIANGLE" ? f = x.new(e, {
138
138
  width: 10,
139
139
  height: 10,
140
140
  strokeWidth: 2,
141
- stroke: o.get("stroke"),
141
+ stroke: i.get("stroke"),
142
142
  fill: e.interfaceColors.get("background")
143
- }) : g = pe.new(e, {
143
+ }) : f = ue.new(e, {
144
144
  strokeWidth: 2,
145
145
  radius: 4,
146
- stroke: o.get("stroke"),
146
+ stroke: i.get("stroke"),
147
147
  fill: e.interfaceColors.get("background")
148
- }), de.new(e, { sprite: g });
149
- }), o.data.setAll(a);
148
+ }), de.new(e, { sprite: f });
149
+ }), i.data.setAll(a);
150
150
  }
151
151
  if (r.set(
152
152
  "cursor",
@@ -155,42 +155,42 @@ const x = ["CIRCLE", "RECTANGLE", "TRIANGLE"], Ge = (T) => {
155
155
  root: e,
156
156
  chart: r,
157
157
  xAxis: l,
158
- theme: u,
159
- isDateAxis: i.type === "date",
160
- baseInterval: L,
158
+ theme: p,
159
+ isDateAxis: o.type === "date",
160
+ baseInterval: T,
161
161
  follow: !0
162
162
  }), s.length > 1) {
163
- const a = v.groupBy(p, s[1].value);
163
+ const a = N.groupBy(d, s[1].value);
164
164
  Object.keys(a).forEach((n, m) => {
165
- F(
165
+ _(
166
166
  a[n],
167
167
  P(n),
168
168
  s[0].value,
169
169
  t[0].dataFieldName,
170
170
  m !== 0,
171
- x[m % x.length]
171
+ A[m % A.length]
172
172
  );
173
173
  });
174
174
  } else
175
175
  t.forEach((a, n) => {
176
- F(
177
- p,
176
+ _(
177
+ d,
178
178
  a.label ?? P(a.name),
179
- i.value,
179
+ o.value,
180
180
  a.dataFieldName,
181
181
  n !== 0,
182
- x[n % x.length],
183
- i.type
182
+ A[n % A.length],
183
+ o.type
184
184
  );
185
185
  });
186
- O.data.setAll(r.series.values), ee(e, (N = t == null ? void 0 : t[0]) == null ? void 0 : N.format), r.appear(1e3, 100);
186
+ S.data.setAll(r.series.values), ee(e, (F = t == null ? void 0 : t[0]) == null ? void 0 : F.format), r.appear(1e3, 100);
187
187
  }, I), () => {
188
188
  var e;
189
189
  b && clearTimeout(b), (e = w.current) == null || e.dispose(), w.current = null;
190
190
  };
191
- }, [d, s, t, u.palette.mode, R, E]);
192
- const B = { ...c };
193
- return { chartId: _, ownerState: B, sx: Y, error: h, other: V };
191
+ }, [y, s, t, p.palette.mode, L, R]);
192
+ const O = { ...c };
193
+ return { chartId: E, ownerState: O, sx: Y, error: u, other: V };
194
194
  };
195
195
  export {
196
196
  Ge as useMultipleValueAxesLogic
@@ -178,7 +178,15 @@ const Be = (I) => {
178
178
  var t;
179
179
  x && clearTimeout(x), (t = h.current) == null || t.dispose(), h.current = null;
180
180
  };
181
- }, [f, l, c, n.palette.mode, w, b, D]);
181
+ }, [
182
+ f,
183
+ l,
184
+ c,
185
+ n.palette.mode,
186
+ w,
187
+ b,
188
+ D
189
+ ]);
182
190
  const j = { ...g };
183
191
  return { chartId: X, ownerState: j, sx: W, error: C, other: N };
184
192
  };
package/dist/main.d.ts CHANGED
@@ -97,7 +97,7 @@ export declare interface BaseInterval {
97
97
  count: number;
98
98
  }
99
99
 
100
- export declare const Button: (props: ButtonProps) => JSX_2.Element;
100
+ export declare const Button: (props: ButtonProps & default_2.RefAttributes<HTMLButtonElement>) => default_2.ReactNode | null;
101
101
 
102
102
  export declare type ButtonComponentOverride<Theme = unknown> = {
103
103
  defaultProps?: Partial<ButtonProps>;
@@ -232,6 +232,7 @@ export declare interface ChartDimension {
232
232
 
233
233
  export declare type ChartNameType =
234
234
  | "HeatLegend"
235
+ | "Histogram"
235
236
  | "XYChart"
236
237
  | "XYChartHorizontal"
237
238
  | "MultipleValueAxes"
@@ -955,6 +956,36 @@ export declare interface HighlightLineChartProps {
955
956
  sx?: SxProps<Theme>;
956
957
  }
957
958
 
959
+ export declare const Histogram: (inProps: HistogramProps) => JSX_2.Element;
960
+
961
+ export declare type HistogramComponentOverride<Theme = unknown> = {
962
+ defaultProps?: Partial<HistogramProps>;
963
+ styleOverrides?: ComponentsOverrides_2<Theme>["HCHistogram"];
964
+ };
965
+
966
+ export declare type HistogramProps = ChartProps & {
967
+ /**
968
+ * Explicit bin width, in dimension units. When omitted, the width is inferred
969
+ * from the smallest positive gap between adjacent bin starts — correct for
970
+ * uniformly pre-binned data (e.g. 250-wide buckets). Set this when bins are
971
+ * non-uniform, or when a single bin makes the gap impossible to infer.
972
+ */
973
+ binWidth?: number;
974
+ /**
975
+ * Fractional gap between adjacent bars, `0`–`1`. `0` (default) makes bars
976
+ * touch edge-to-edge — the defining histogram look. Raise it toward a spaced
977
+ * bar chart if a visual separation is wanted.
978
+ */
979
+ barGap?: number;
980
+ /**
981
+ * Draw the frequency (Y) axis on a logarithmic scale. Useful when one bin
982
+ * dwarfs the rest (e.g. a large zero/overflow bucket) and a linear axis would
983
+ * flatten every other bar. Zero-count bins are treated as the axis floor, so
984
+ * they simply render as no bar. Default `false` (linear, zero-baselined).
985
+ */
986
+ logarithmic?: boolean;
987
+ };
988
+
958
989
  /**
959
990
  * Turn a raw field key into a human label: snake_case / kebab-case / camelCase
960
991
  * → Title Case (e.g. "total_revenue" / "totalRevenue" → "Total Revenue"). Used
@@ -2690,6 +2721,22 @@ declare module "@mui/material/styles" {
2690
2721
 
2691
2722
 
2692
2723
 
2724
+ declare module "@mui/material/styles" {
2725
+ interface ComponentNameToClassKey {
2726
+ HCHistogram: "root";
2727
+ }
2728
+
2729
+ interface ComponentsPropsList {
2730
+ HCHistogram: Partial<HistogramProps>;
2731
+ }
2732
+
2733
+ interface Components<Theme = unknown> {
2734
+ HCHistogram?: HistogramComponentOverride<Theme>;
2735
+ }
2736
+ }
2737
+
2738
+
2739
+
2693
2740
  declare module "@mui/material/styles" {
2694
2741
  interface ComponentNameToClassKey {
2695
2742
  HCLineChart: "root";