@thebuoyant-tsdev/mui-ts-library 3.26.1 → 3.27.1

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 (24) hide show
  1. package/README.de.md +17 -0
  2. package/README.md +17 -0
  3. package/dist/components/chord-chart/ChordChart.d.ts +1 -1
  4. package/dist/components/chord-chart/ChordChart.js +138 -128
  5. package/dist/components/chord-chart/ChordChart.types.d.ts +4 -0
  6. package/dist/components/circle-packing-chart/CirclePackingChart.d.ts +1 -1
  7. package/dist/components/circle-packing-chart/CirclePackingChart.js +142 -142
  8. package/dist/components/circle-packing-chart/CirclePackingChart.types.d.ts +2 -0
  9. package/dist/components/gantt-chart/GanttChart.js +125 -125
  10. package/dist/components/gantt-chart/GanttTaskPanel.js +2 -0
  11. package/dist/components/horizontal-tree-chart/HorizontalTreeChart.d.ts +1 -1
  12. package/dist/components/horizontal-tree-chart/HorizontalTreeChart.js +131 -125
  13. package/dist/components/horizontal-tree-chart/HorizontalTreeChart.types.d.ts +2 -0
  14. package/dist/components/radial-stacked-bar-chart/RadialStackedBarChart.d.ts +1 -1
  15. package/dist/components/radial-stacked-bar-chart/RadialStackedBarChart.js +60 -50
  16. package/dist/components/radial-stacked-bar-chart/RadialStackedBarChart.types.d.ts +2 -0
  17. package/dist/components/radial-tree-chart/RadialTreeChart.d.ts +1 -1
  18. package/dist/components/radial-tree-chart/RadialTreeChart.js +115 -111
  19. package/dist/components/radial-tree-chart/RadialTreeChart.types.d.ts +2 -0
  20. package/dist/components/sunburst-chart/SunburstChart.d.ts +1 -1
  21. package/dist/components/sunburst-chart/SunburstChart.js +120 -106
  22. package/dist/components/sunburst-chart/SunburstChart.types.d.ts +2 -0
  23. package/dist/index.cjs +2 -2
  24. package/package.json +1 -1
@@ -58,11 +58,11 @@ function ee({ barData: e, seriesKey: t, seriesLabel: n, decimals: r, decimalSep:
58
58
  ]
59
59
  });
60
60
  }
61
- function _({ data: c, keys: m, size: _ = 500, innerRadius: v, barPadding: y = .12, chartColors: b, colorConfig: x, showLabels: S = !0, showGridLines: C = !0, gridLineCount: w = 3, showGridValues: T = !0, showLegend: te = !0, sortBy: E = "none", valueDecimalCount: ne = 0, valueDecimalSeparator: re = ".", valueThousandsSeparator: ie = ",", valueFormatter: ae, gridValueFormatter: oe, zoomable: D = !1, onBarClick: O, disabled: k = !1, translation: se }) {
62
- let A = l(), ce = {
61
+ function _({ data: c, keys: m, size: _ = 500, innerRadius: v, barPadding: y = .12, chartColors: b, colorConfig: x, showLabels: S = !0, showGridLines: C = !0, gridLineCount: w = 3, showGridValues: te = !0, showLegend: ne = !0, sortBy: T = "none", valueDecimalCount: re = 0, valueDecimalSeparator: ie = ".", valueThousandsSeparator: ae = ",", valueFormatter: oe, gridValueFormatter: se, zoomable: E = !1, onBarClick: ce, onBarHover: D, disabled: O = !1, translation: k }) {
62
+ let A = l(), le = {
63
63
  ...e,
64
- ...se
65
- }, j = r(() => g(m), [m]), M = r(() => j.map((e) => e.key), [j]), N = c.length === 0 || j.length === 0, le = S ? 63 : 16, P = _ / 2 - le, F = v == null ? Math.round(_ * .18) : Math.max(0, Math.min(v, P - 1)), ue = [
64
+ ...k
65
+ }, j = r(() => g(m), [m]), M = r(() => j.map((e) => e.key), [j]), N = c.length === 0 || j.length === 0, ue = S ? 63 : 16, P = _ / 2 - ue, F = v == null ? Math.round(_ * .18) : Math.max(0, Math.min(v, P - 1)), de = [
66
66
  A.palette.primary.main,
67
67
  A.palette.secondary.main,
68
68
  A.palette.success.main,
@@ -73,38 +73,38 @@ function _({ data: c, keys: m, size: _ = 500, innerRadius: v, barPadding: y = .1
73
73
  "#00897b",
74
74
  "#f06292",
75
75
  "#a1887f"
76
- ], I = b && b.length > 0 ? b : ue, L = t((e, t) => {
76
+ ], I = b && b.length > 0 ? b : de, L = t((e, t) => {
77
77
  let n = x?.[e];
78
78
  return n?.fill ? n.fill : I[t % I.length];
79
- }, [x, I]), R = r(() => E === "value" ? [...c].sort((e, t) => p.sum(M, (e) => t.values[e] ?? 0) - p.sum(M, (t) => e.values[t] ?? 0)) : E === "label" ? [...c].sort((e, t) => e.label.localeCompare(t.label, void 0, {
79
+ }, [x, I]), R = r(() => T === "value" ? [...c].sort((e, t) => p.sum(M, (e) => t.values[e] ?? 0) - p.sum(M, (t) => e.values[t] ?? 0)) : T === "label" ? [...c].sort((e, t) => e.label.localeCompare(t.label, void 0, {
80
80
  numeric: !0,
81
81
  sensitivity: "base"
82
82
  })) : c, [
83
83
  c,
84
- E,
84
+ T,
85
85
  M
86
86
  ]), z = r(() => p.max(R, (e) => p.sum(M, (t) => e.values[t] ?? 0)) ?? 0, [R, M]), B = r(() => p.scaleBand().domain(R.map((e) => e.id)).range([0, 2 * Math.PI]).padding(y), [R, y]), V = r(() => p.scaleLinear().domain([0, z]).range([F, P]), [
87
87
  F,
88
88
  P,
89
89
  z
90
- ]), H = r(() => N ? [] : p.stack().keys(M).value((e, t) => e.values[t] ?? 0).order(p.stackOrderNone).offset(p.stackOffsetNone)(R), [
90
+ ]), fe = r(() => N ? [] : p.stack().keys(M).value((e, t) => e.values[t] ?? 0).order(p.stackOrderNone).offset(p.stackOffsetNone)(R), [
91
91
  N,
92
92
  R,
93
93
  M
94
- ]), de = r(() => p.arc().startAngle((e) => e.x0).endAngle((e) => e.x1).innerRadius((e) => e.y0).outerRadius((e) => e.y1).padAngle(.008).padRadius(F + 10), [F]), U = r(() => z > 0 ? p.ticks(0, z, w).filter((e) => e > 0) : [], [z, w]), fe = oe ?? h, [W, G] = a(1), K = i(null), [q, J] = a(`-${_ / 2} -${_ / 2} ${_} ${_}`), pe = r(() => {
95
- if (W === 1) return q;
96
- let [e, t, n, r] = q.split(" ").map(Number), i = n / W, a = r / W;
94
+ ]), pe = r(() => p.arc().startAngle((e) => e.x0).endAngle((e) => e.x1).innerRadius((e) => e.y0).outerRadius((e) => e.y1).padAngle(.008).padRadius(F + 10), [F]), H = r(() => z > 0 ? p.ticks(0, z, w).filter((e) => e > 0) : [], [z, w]), me = se ?? h, [U, W] = a(1), G = i(null), [K, q] = a(`-${_ / 2} -${_ / 2} ${_} ${_}`), he = r(() => {
95
+ if (U === 1) return K;
96
+ let [e, t, n, r] = K.split(" ").map(Number), i = n / U, a = r / U;
97
97
  return `${e + (n - i) / 2} ${t + (r - a) / 2} ${i} ${a}`;
98
- }, [q, W]);
98
+ }, [K, U]);
99
99
  n(() => {
100
- let e = K.current;
100
+ let e = G.current;
101
101
  if (!e) return;
102
102
  let t = requestAnimationFrame(() => {
103
103
  try {
104
104
  let t = e.getBBox();
105
- J(`${t.x - 4} ${t.y - 4} ${t.width + 8} ${t.height + 8}`);
105
+ q(`${t.x - 4} ${t.y - 4} ${t.width + 8} ${t.height + 8}`);
106
106
  } catch {
107
- J(`-${_ / 2} -${_ / 2} ${_} ${_}`);
107
+ q(`-${_ / 2} -${_ / 2} ${_} ${_}`);
108
108
  }
109
109
  });
110
110
  return () => cancelAnimationFrame(t);
@@ -117,52 +117,52 @@ function _({ data: c, keys: m, size: _ = 500, innerRadius: v, barPadding: y = .1
117
117
  S,
118
118
  C
119
119
  ]), n(() => {
120
- if (k) return;
120
+ if (O) return;
121
121
  let e = (e) => {
122
- e.key === "Escape" && G(1);
122
+ e.key === "Escape" && W(1);
123
123
  };
124
124
  return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
125
- }, [k]);
126
- let me = t((e) => {
127
- if (!D || k || !e.ctrlKey) return;
125
+ }, [O]);
126
+ let ge = t((e) => {
127
+ if (!E || O || !e.ctrlKey) return;
128
128
  e.preventDefault();
129
129
  let t = e.deltaY < 0 ? 1.15 : 1 / 1.15;
130
- G((e) => Math.max(.25, Math.min(8, e * t)));
131
- }, [D, k]), he = -(j.length * 16) / 2, Y = Math.max(0, F * 2 - 10 - 5 - 10), X = 9 * .57, ge = j.reduce((e, t) => Math.max(e, (t.label ?? t.key).length), 0), _e = -((15 + Math.min(ge * X, Y)) / 2), Z = Math.max(1, Math.floor(Y / X)), ve = (e) => e.length <= Z ? e : `${e.slice(0, Z - 1)}…`, ye = {
130
+ W((e) => Math.max(.25, Math.min(8, e * t)));
131
+ }, [E, O]), J = -(j.length * 16) / 2, Y = Math.max(0, F * 2 - 10 - 5 - 10), X = 9 * .57, _e = j.reduce((e, t) => Math.max(e, (t.label ?? t.key).length), 0), ve = -((15 + Math.min(_e * X, Y)) / 2), Z = Math.max(1, Math.floor(Y / X)), ye = (e) => e.length <= Z ? e : `${e.slice(0, Z - 1)}…`, be = {
132
132
  followCursor: !0,
133
133
  enterDelay: 50,
134
134
  enterNextDelay: 0,
135
- disableHoverListener: k,
135
+ disableHoverListener: O,
136
136
  slotProps: { tooltip: { sx: { maxWidth: 240 } } }
137
- }, Q = A.palette.text.primary, $ = A.palette.divider, be = A.typography.fontFamily;
137
+ }, Q = A.palette.text.primary, $ = A.palette.divider, xe = A.typography.fontFamily;
138
138
  return /* @__PURE__ */ d(o, {
139
- style: { opacity: k ? .5 : 1 },
139
+ style: { opacity: O ? .5 : 1 },
140
140
  sx: {
141
141
  display: "inline-flex",
142
- cursor: k ? "not-allowed" : "default",
142
+ cursor: O ? "not-allowed" : "default",
143
143
  userSelect: "none"
144
144
  },
145
145
  children: /* @__PURE__ */ d("svg", {
146
146
  width: _,
147
147
  height: _,
148
- viewBox: pe,
149
- onWheel: me,
148
+ viewBox: he,
149
+ onWheel: ge,
150
150
  style: {
151
- fontFamily: be ?? "sans-serif",
152
- overflow: D && W > 1 ? "hidden" : "visible"
151
+ fontFamily: xe ?? "sans-serif",
152
+ overflow: E && U > 1 ? "hidden" : "visible"
153
153
  },
154
154
  role: "img",
155
155
  "aria-label": "Radial stacked bar chart",
156
156
  children: /* @__PURE__ */ f("g", {
157
- ref: K,
157
+ ref: G,
158
158
  children: [N && /* @__PURE__ */ d("text", {
159
159
  textAnchor: "middle",
160
160
  dy: "0.35em",
161
161
  fontSize: 13,
162
162
  fill: A.palette.text.secondary,
163
- children: ce.noData
163
+ children: le.noData
164
164
  }), !N && /* @__PURE__ */ f(u, { children: [
165
- C && U.map((e) => /* @__PURE__ */ d("circle", {
165
+ C && H.map((e) => /* @__PURE__ */ d("circle", {
166
166
  r: V(e),
167
167
  fill: "none",
168
168
  stroke: $,
@@ -175,7 +175,7 @@ function _({ data: c, keys: m, size: _ = 500, innerRadius: v, barPadding: y = .1
175
175
  stroke: $,
176
176
  strokeWidth: .75
177
177
  }),
178
- C && T && U.map((e) => /* @__PURE__ */ d("text", {
178
+ C && te && H.map((e) => /* @__PURE__ */ d("text", {
179
179
  x: 0,
180
180
  y: -V(e),
181
181
  textAnchor: "middle",
@@ -183,46 +183,56 @@ function _({ data: c, keys: m, size: _ = 500, innerRadius: v, barPadding: y = .1
183
183
  fontSize: 9,
184
184
  fill: A.palette.text.secondary,
185
185
  pointerEvents: "none",
186
- children: fe(e)
186
+ children: me(e)
187
187
  }, `gv-${e}`)),
188
- H.map((e, t) => {
188
+ fe.map((e, t) => {
189
189
  let n = e.key, r = j[t]?.label ?? n, i = L(n, t);
190
190
  return e.map((e, t) => {
191
191
  let a = e.data, o = B(a.id) ?? 0, c = o + B.bandwidth(), l = V(e[0]), u = V(e[1]);
192
192
  if (u - l < .5) return null;
193
- let f = de({
193
+ let f = pe({
194
194
  x0: o,
195
195
  x1: c,
196
196
  y0: l,
197
197
  y1: u
198
198
  }) ?? "";
199
199
  return /* @__PURE__ */ d(s, {
200
- ...ye,
200
+ ...be,
201
201
  placement: "top",
202
202
  title: /* @__PURE__ */ d(ee, {
203
203
  barData: a,
204
204
  seriesKey: n,
205
205
  seriesLabel: r,
206
- decimals: ne,
207
- decimalSep: re,
208
- thousandSep: ie,
209
- valueFormatter: ae
206
+ decimals: re,
207
+ decimalSep: ie,
208
+ thousandSep: ae,
209
+ valueFormatter: oe
210
210
  }),
211
211
  children: /* @__PURE__ */ d("path", {
212
212
  d: f,
213
213
  fill: i,
214
214
  style: {
215
- cursor: k ? "not-allowed" : "pointer",
215
+ cursor: O ? "not-allowed" : "pointer",
216
216
  transition: "opacity 0.15s"
217
217
  },
218
218
  onMouseEnter: (e) => {
219
- k || (e.currentTarget.style.opacity = "0.75");
219
+ if (O) return;
220
+ e.currentTarget.style.opacity = "0.75";
221
+ let t = p.sum(M, (e) => a.values[e] ?? 0), r = {
222
+ id: a.id,
223
+ label: a.label,
224
+ seriesKey: n,
225
+ value: a.values[n] ?? 0,
226
+ total: t,
227
+ values: a.values
228
+ };
229
+ D?.(r, e);
220
230
  },
221
231
  onMouseLeave: (e) => {
222
- e.currentTarget.style.opacity = "1";
232
+ e.currentTarget.style.opacity = "1", D?.(null, e);
223
233
  },
224
234
  onClick: (e) => {
225
- if (k) return;
235
+ if (O) return;
226
236
  let t = p.sum(M, (e) => a.values[e] ?? 0), r = {
227
237
  id: a.id,
228
238
  label: a.label,
@@ -231,7 +241,7 @@ function _({ data: c, keys: m, size: _ = 500, innerRadius: v, barPadding: y = .1
231
241
  total: t,
232
242
  values: a.values
233
243
  };
234
- O?.(r, e);
244
+ ce?.(r, e);
235
245
  }
236
246
  })
237
247
  }, `${n}-${t}`);
@@ -251,11 +261,11 @@ function _({ data: c, keys: m, size: _ = 500, innerRadius: v, barPadding: y = .1
251
261
  children: e.label
252
262
  }, `lbl-${e.id}`);
253
263
  }),
254
- te && /* @__PURE__ */ d("g", {
264
+ ne && /* @__PURE__ */ d("g", {
255
265
  pointerEvents: "none",
256
- transform: `translate(${_e},0)`,
266
+ transform: `translate(${ve},0)`,
257
267
  children: j.map((e, t) => {
258
- let n = L(e.key, t), r = he + t * 16, i = ve(e.label ?? e.key);
268
+ let n = L(e.key, t), r = J + t * 16, i = ye(e.label ?? e.key);
259
269
  return /* @__PURE__ */ f("g", {
260
270
  transform: `translate(0,${r})`,
261
271
  children: [/* @__PURE__ */ d("rect", {
@@ -92,6 +92,8 @@ export type RadialStackedBarChartProps = {
92
92
  zoomable?: boolean;
93
93
  /** Fired on click of any bar segment */
94
94
  onBarClick?: (info: RadialStackedBarBarInfo, event: React.MouseEvent<SVGPathElement>) => void;
95
+ /** Fired on mouse enter/leave a bar segment — `null` on leave. Use for linked-view highlighting. */
96
+ onBarHover?: (info: RadialStackedBarBarInfo | null, event: React.MouseEvent<SVGPathElement> | null) => void;
95
97
  /** Disables all interactions (default: false) */
96
98
  disabled?: boolean;
97
99
  /** Override any translation string */
@@ -1,5 +1,5 @@
1
1
  import { type RadialTreeChartProps } from "./RadialTreeChart.types";
2
- export declare function RadialTreeChart({ data, size, autoFit, sortBy, showLabels, showIcons, chartColors, rootNodeRadius, branchNodeRadius, leafNodeRadius, linkColor, linkStrokeOpacity, linkStrokeWidth, labelFontSize, labelColor, separationSibling, separationCousin, zoomable, drillable, onFocusChange, duration, showNodePopover, renderNodePopoverContent, onNodeClick, disabled, translation, }: RadialTreeChartProps): import("react/jsx-runtime").JSX.Element;
2
+ export declare function RadialTreeChart({ data, size, autoFit, sortBy, showLabels, showIcons, chartColors, rootNodeRadius, branchNodeRadius, leafNodeRadius, linkColor, linkStrokeOpacity, linkStrokeWidth, labelFontSize, labelColor, separationSibling, separationCousin, zoomable, drillable, onFocusChange, duration, showNodePopover, renderNodePopoverContent, onNodeClick, onNodeHover, disabled, translation, }: RadialTreeChartProps): import("react/jsx-runtime").JSX.Element;
3
3
  export declare namespace RadialTreeChart {
4
4
  var displayName: string;
5
5
  }