@thebuoyant-tsdev/mui-ts-library 2.1.0 → 2.2.0

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/README.de.md CHANGED
@@ -17,6 +17,7 @@ Eine typsichere React-Komponentenbibliothek auf Basis von **TypeScript** und **M
17
17
  | [`RichTextEditor`](#richtexteditor) | WYSIWYG-Editor (TipTap v3) mit Toolbar, Link-Dialog, Textfarbe, Hervorhebung, Wörter-Zähler, Vollbild-Modus, Markdown-Einfügen, Tabellen-Bearbeitung, Bild-Embed und Emoji-Picker | [Vollständiges Manual →](user-manuals/RichTextEditor.de.md) |
18
18
  | [`SqlEditor`](#sqleditor) | SQL-Code-Editor (CodeMirror 6) mit Syntax-Highlighting, Multi-Dialekt, Autocomplete, Linting und `Cmd+Enter`-Ausführen-Shortcut | [Vollständiges Manual →](user-manuals/SqlEditor.de.md) |
19
19
  | [`JsonEditor`](#jsoneditor) | JSON-Code-Editor (CodeMirror 6) mit Echtzeit-Validierung, Format- und Komprimieren-Schaltfläche sowie optionaler Minimap | [Vollständiges Manual →](user-manuals/JsonEditor.de.md) |
20
+ | [`SunburstChart`](#sunburstchart) | D3 v7 hierarchisches Chart — konzentrische Ringe, Ctrl+Click-Zoom, Donut-Modus, eigene Farben, MUI-Theme-Integration. Erste der D3-Chart-Familie. | [Vollständiges Manual →](user-manuals/SunburstChart.de.md) |
20
21
 
21
22
  ---
22
23
 
@@ -171,6 +172,36 @@ import { JsonEditor } from '@thebuoyant-tsdev/mui-ts-library';
171
172
 
172
173
  ---
173
174
 
175
+ ### SunburstChart
176
+
177
+ ```tsx
178
+ import { SunburstChart } from '@thebuoyant-tsdev/mui-ts-library';
179
+ import type { SunburstChartData } from '@thebuoyant-tsdev/mui-ts-library';
180
+
181
+ const data: SunburstChartData = {
182
+ id: 'root', name: 'Budget',
183
+ children: [
184
+ { id: 'eng', name: 'Engineering', children: [
185
+ { id: 'fe', name: 'Frontend', value: 480 },
186
+ { id: 'be', name: 'Backend', value: 620 },
187
+ ]},
188
+ { id: 'sales', name: 'Vertrieb', value: 890 },
189
+ ],
190
+ };
191
+
192
+ <SunburstChart
193
+ data={data}
194
+ size={500}
195
+ onSegmentClick={(info) => console.log(info.path, info.value)}
196
+ />
197
+ ```
198
+
199
+ **Zoom:** `Ctrl+Click` → Drill-down · `Ctrl+Doppelklick` → Zoom out · `Escape` → Reset
200
+
201
+ → [Vollständige Dokumentation](user-manuals/SunburstChart.de.md)
202
+
203
+ ---
204
+
174
205
  ## TypeScript
175
206
 
176
207
  Alle Typen und Defaults werden direkt exportiert — kein separates `@types/...`-Paket nötig.
package/README.md CHANGED
@@ -17,6 +17,7 @@ A type-safe React component library built on **TypeScript** and **MUI (Material
17
17
  | [`RichTextEditor`](#richtexteditor) | WYSIWYG editor (TipTap v3) with toolbar, link dialog, text color, highlight, word count, fullscreen mode, Markdown paste, table editing, image embed, and emoji picker | [Full Manual →](user-manuals/RichTextEditor.md) |
18
18
  | [`SqlEditor`](#sqleditor) | SQL code editor (CodeMirror 6) with syntax highlighting, multi-dialect, autocomplete, linting, and `Cmd+Enter` execute shortcut | [Full Manual →](user-manuals/SqlEditor.md) |
19
19
  | [`JsonEditor`](#jsoneditor) | JSON code editor (CodeMirror 6) with real-time validation, Format, Compact buttons, and optional minimap | [Full Manual →](user-manuals/JsonEditor.md) |
20
+ | [`SunburstChart`](#sunburstchart) | D3 v7 hierarchical chart — concentric rings, Ctrl+Click zoom, donut mode, custom colors, MUI theme integration. First of the D3 Charts family. | [Full Manual →](user-manuals/SunburstChart.md) |
20
21
 
21
22
  ---
22
23
 
@@ -171,6 +172,36 @@ import { JsonEditor } from '@thebuoyant-tsdev/mui-ts-library';
171
172
 
172
173
  ---
173
174
 
175
+ ### SunburstChart
176
+
177
+ ```tsx
178
+ import { SunburstChart } from '@thebuoyant-tsdev/mui-ts-library';
179
+ import type { SunburstChartData } from '@thebuoyant-tsdev/mui-ts-library';
180
+
181
+ const data: SunburstChartData = {
182
+ id: 'root', name: 'Budget',
183
+ children: [
184
+ { id: 'eng', name: 'Engineering', children: [
185
+ { id: 'fe', name: 'Frontend', value: 480 },
186
+ { id: 'be', name: 'Backend', value: 620 },
187
+ ]},
188
+ { id: 'sales', name: 'Sales', value: 890 },
189
+ ],
190
+ };
191
+
192
+ <SunburstChart
193
+ data={data}
194
+ size={500}
195
+ onSegmentClick={(info) => console.log(info.path, info.value)}
196
+ />
197
+ ```
198
+
199
+ **Zoom:** `Ctrl+Click` → drill down · `Ctrl+Double-click` → zoom out · `Escape` → reset
200
+
201
+ → [Full documentation](user-manuals/SunburstChart.md)
202
+
203
+ ---
204
+
174
205
  ## TypeScript
175
206
 
176
207
  All types and defaults are exported directly — no separate `@types/...` package needed.
@@ -0,0 +1,5 @@
1
+ import { type SunburstChartProps } from "./SunburstChart.types";
2
+ export declare function SunburstChart({ data, size, showSegmentLabels, innerRadius, sortBy, chartColors, showRootLabel, onSegmentClick, onZoomChange, valueDecimalCount, valueDecimalSeparator, valueThousandsSeparator, disabled, }: SunburstChartProps): import("react/jsx-runtime").JSX.Element;
3
+ export declare namespace SunburstChart {
4
+ var displayName: string;
5
+ }
@@ -0,0 +1,65 @@
1
+ export type SunburstSortBy = 'value' | 'name';
2
+ export type SunburstChartData = {
3
+ id: string;
4
+ name: string;
5
+ value?: number;
6
+ children?: SunburstChartData[];
7
+ };
8
+ export type SunburstSegmentInfo = {
9
+ /** Node ID — direct access, same as `data.id` */
10
+ id: string;
11
+ name: string;
12
+ /** D3 aggregate value — sum of all descendant leaf values */
13
+ value: number | null;
14
+ /** Percentage of root total — `(value / root.value) * 100` */
15
+ percentage: number;
16
+ depth: number;
17
+ /** Breadcrumb path from root — array of node names */
18
+ path: string[];
19
+ /** Breadcrumb path from root — array of node IDs (for backend linking) */
20
+ pathIds: string[];
21
+ childrenCount: number;
22
+ /** Original data node as passed to the chart */
23
+ data: SunburstChartData;
24
+ };
25
+ export type SunburstZoomInfo = {
26
+ /** The node that is now the focus center */
27
+ focusNode: SunburstSegmentInfo;
28
+ /** True when zoom has been reset to root */
29
+ isRoot: boolean;
30
+ };
31
+ export type SunburstChartTranslation = {
32
+ /** Shown when data has no children and no value */
33
+ noData: string;
34
+ };
35
+ export declare const DEFAULT_SUNBURST_CHART_TRANSLATION: SunburstChartTranslation;
36
+ export type SunburstChartProps = {
37
+ /** Hierarchical data tree — root node with optional nested children */
38
+ data: SunburstChartData;
39
+ /** Width and height of the SVG in pixels (default: 500) */
40
+ size?: number;
41
+ /** Show name labels on segments (default: true) */
42
+ showSegmentLabels?: boolean;
43
+ /** Inner hole radius in px — 0 = solid sunburst, > 0 = donut style (default: 0) */
44
+ innerRadius?: number;
45
+ /** Sort segments by value (largest first) or by name (default: 'value') */
46
+ sortBy?: SunburstSortBy;
47
+ /** Custom color palette for top-level segments — falls back to MUI theme palette */
48
+ chartColors?: string[];
49
+ /** Show the root node name in the center (default: true) */
50
+ showRootLabel?: boolean;
51
+ /** Fired on single-click on any segment */
52
+ onSegmentClick?: (info: SunburstSegmentInfo, event: React.MouseEvent<SVGPathElement | SVGCircleElement>) => void;
53
+ /** Fired when zoom focus changes (Ctrl+Click in/out, Escape reset) */
54
+ onZoomChange?: (zoom: SunburstZoomInfo) => void;
55
+ /** Decimal places for value display in tooltips (default: 0) */
56
+ valueDecimalCount?: number;
57
+ /** Decimal separator for values (default: '.') */
58
+ valueDecimalSeparator?: string;
59
+ /** Thousands separator for values (default: ',') */
60
+ valueThousandsSeparator?: string;
61
+ /** Disables all interactions (default: false) */
62
+ disabled?: boolean;
63
+ /** Override any translation string */
64
+ translation?: Partial<SunburstChartTranslation>;
65
+ };