minerva-design 1.2.0 → 1.3.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.
Files changed (256) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/charts/canvas.d.cts +4 -1
  3. package/dist/charts/canvas.d.ts +4 -1
  4. package/dist/charts/core.cjs +1 -1
  5. package/dist/charts/core.d.cts +5 -2
  6. package/dist/charts/core.d.ts +5 -2
  7. package/dist/charts/core.js +6 -4
  8. package/dist/charts/engine/canvas.cjs +1 -1
  9. package/dist/charts/engine/canvas.cjs.map +1 -1
  10. package/dist/charts/engine/canvas.js +65 -53
  11. package/dist/charts/engine/canvas.js.map +1 -1
  12. package/dist/charts/engine/chart.cjs +1 -2
  13. package/dist/charts/engine/chart.cjs.map +1 -1
  14. package/dist/charts/engine/chart.js +342 -323
  15. package/dist/charts/engine/chart.js.map +1 -1
  16. package/dist/charts/engine/color.cjs +1 -1
  17. package/dist/charts/engine/color.cjs.map +1 -1
  18. package/dist/charts/engine/color.d.cts +17 -0
  19. package/dist/charts/engine/color.d.ts +17 -0
  20. package/dist/charts/engine/color.js +27 -3
  21. package/dist/charts/engine/color.js.map +1 -1
  22. package/dist/charts/engine/controller.cjs +2 -2
  23. package/dist/charts/engine/controller.cjs.map +1 -1
  24. package/dist/charts/engine/controller.d.cts +6 -0
  25. package/dist/charts/engine/controller.d.ts +6 -0
  26. package/dist/charts/engine/controller.js +317 -253
  27. package/dist/charts/engine/controller.js.map +1 -1
  28. package/dist/charts/engine/curve.cjs +2 -0
  29. package/dist/charts/engine/curve.cjs.map +1 -0
  30. package/dist/charts/engine/curve.d.cts +15 -0
  31. package/dist/charts/engine/curve.d.ts +15 -0
  32. package/dist/charts/engine/curve.js +56 -0
  33. package/dist/charts/engine/curve.js.map +1 -0
  34. package/dist/charts/engine/data.cjs +1 -1
  35. package/dist/charts/engine/data.cjs.map +1 -1
  36. package/dist/charts/engine/data.d.cts +15 -2
  37. package/dist/charts/engine/data.d.ts +15 -2
  38. package/dist/charts/engine/data.js +98 -38
  39. package/dist/charts/engine/data.js.map +1 -1
  40. package/dist/charts/engine/dom.cjs +1 -1
  41. package/dist/charts/engine/dom.cjs.map +1 -1
  42. package/dist/charts/engine/dom.d.cts +5 -3
  43. package/dist/charts/engine/dom.d.ts +5 -3
  44. package/dist/charts/engine/dom.js +27 -22
  45. package/dist/charts/engine/dom.js.map +1 -1
  46. package/dist/charts/engine/items.cjs +1 -1
  47. package/dist/charts/engine/items.cjs.map +1 -1
  48. package/dist/charts/engine/items.js +132 -61
  49. package/dist/charts/engine/items.js.map +1 -1
  50. package/dist/charts/engine/model.cjs +1 -1
  51. package/dist/charts/engine/model.cjs.map +1 -1
  52. package/dist/charts/engine/model.d.cts +30 -3
  53. package/dist/charts/engine/model.d.ts +30 -3
  54. package/dist/charts/engine/model.js +225 -108
  55. package/dist/charts/engine/model.js.map +1 -1
  56. package/dist/charts/engine/overlay.cjs +1 -1
  57. package/dist/charts/engine/overlay.cjs.map +1 -1
  58. package/dist/charts/engine/overlay.d.cts +2 -0
  59. package/dist/charts/engine/overlay.d.ts +2 -0
  60. package/dist/charts/engine/overlay.js +16 -16
  61. package/dist/charts/engine/overlay.js.map +1 -1
  62. package/dist/charts/engine/presets.cjs +2 -2
  63. package/dist/charts/engine/presets.cjs.map +1 -1
  64. package/dist/charts/engine/presets.d.cts +71 -5
  65. package/dist/charts/engine/presets.d.ts +71 -5
  66. package/dist/charts/engine/presets.js +120 -33
  67. package/dist/charts/engine/presets.js.map +1 -1
  68. package/dist/charts/engine/renderers/canvas2d.cjs +1 -1
  69. package/dist/charts/engine/renderers/canvas2d.cjs.map +1 -1
  70. package/dist/charts/engine/renderers/canvas2d.js +149 -111
  71. package/dist/charts/engine/renderers/canvas2d.js.map +1 -1
  72. package/dist/charts/engine/renderers/range.cjs +1 -1
  73. package/dist/charts/engine/renderers/range.cjs.map +1 -1
  74. package/dist/charts/engine/renderers/range.js +4 -4
  75. package/dist/charts/engine/renderers/range.js.map +1 -1
  76. package/dist/charts/engine/renderers/shaders.cjs +37 -19
  77. package/dist/charts/engine/renderers/shaders.cjs.map +1 -1
  78. package/dist/charts/engine/renderers/shaders.d.cts +2 -2
  79. package/dist/charts/engine/renderers/shaders.d.ts +2 -2
  80. package/dist/charts/engine/renderers/shaders.js +37 -19
  81. package/dist/charts/engine/renderers/shaders.js.map +1 -1
  82. package/dist/charts/engine/renderers/types.cjs.map +1 -1
  83. package/dist/charts/engine/renderers/types.d.cts +11 -4
  84. package/dist/charts/engine/renderers/types.d.ts +11 -4
  85. package/dist/charts/engine/renderers/types.js.map +1 -1
  86. package/dist/charts/engine/renderers/webgl2.cjs +1 -1
  87. package/dist/charts/engine/renderers/webgl2.cjs.map +1 -1
  88. package/dist/charts/engine/renderers/webgl2.js +33 -12
  89. package/dist/charts/engine/renderers/webgl2.js.map +1 -1
  90. package/dist/charts/engine/renderers/webgpu.cjs +1 -1
  91. package/dist/charts/engine/renderers/webgpu.cjs.map +1 -1
  92. package/dist/charts/engine/renderers/webgpu.js +18 -15
  93. package/dist/charts/engine/renderers/webgpu.js.map +1 -1
  94. package/dist/charts/engine/scene.cjs +1 -1
  95. package/dist/charts/engine/scene.cjs.map +1 -1
  96. package/dist/charts/engine/scene.d.cts +19 -6
  97. package/dist/charts/engine/scene.d.ts +19 -6
  98. package/dist/charts/engine/scene.js +201 -89
  99. package/dist/charts/engine/scene.js.map +1 -1
  100. package/dist/charts/engine/shapes/canvas.cjs +2 -0
  101. package/dist/charts/engine/shapes/canvas.cjs.map +1 -0
  102. package/dist/charts/engine/shapes/canvas.d.cts +58 -0
  103. package/dist/charts/engine/shapes/canvas.d.ts +58 -0
  104. package/dist/charts/engine/shapes/canvas.js +159 -0
  105. package/dist/charts/engine/shapes/canvas.js.map +1 -0
  106. package/dist/charts/engine/shapes/chart.cjs +2 -0
  107. package/dist/charts/engine/shapes/chart.cjs.map +1 -0
  108. package/dist/charts/engine/shapes/chart.d.cts +6 -0
  109. package/dist/charts/engine/shapes/chart.d.ts +6 -0
  110. package/dist/charts/engine/shapes/chart.js +273 -0
  111. package/dist/charts/engine/shapes/chart.js.map +1 -0
  112. package/dist/charts/engine/shapes/draw.cjs +2 -0
  113. package/dist/charts/engine/shapes/draw.cjs.map +1 -0
  114. package/dist/charts/engine/shapes/draw.d.cts +20 -0
  115. package/dist/charts/engine/shapes/draw.d.ts +20 -0
  116. package/dist/charts/engine/shapes/draw.js +152 -0
  117. package/dist/charts/engine/shapes/draw.js.map +1 -0
  118. package/dist/charts/engine/shapes/funnel.cjs +2 -0
  119. package/dist/charts/engine/shapes/funnel.cjs.map +1 -0
  120. package/dist/charts/engine/shapes/funnel.d.cts +6 -0
  121. package/dist/charts/engine/shapes/funnel.d.ts +6 -0
  122. package/dist/charts/engine/shapes/funnel.js +149 -0
  123. package/dist/charts/engine/shapes/funnel.js.map +1 -0
  124. package/dist/charts/engine/shapes/gauge.cjs +2 -0
  125. package/dist/charts/engine/shapes/gauge.cjs.map +1 -0
  126. package/dist/charts/engine/shapes/gauge.d.cts +7 -0
  127. package/dist/charts/engine/shapes/gauge.d.ts +7 -0
  128. package/dist/charts/engine/shapes/gauge.js +173 -0
  129. package/dist/charts/engine/shapes/gauge.js.map +1 -0
  130. package/dist/charts/engine/shapes/hit.cjs +2 -0
  131. package/dist/charts/engine/shapes/hit.cjs.map +1 -0
  132. package/dist/charts/engine/shapes/hit.d.cts +28 -0
  133. package/dist/charts/engine/shapes/hit.d.ts +28 -0
  134. package/dist/charts/engine/shapes/hit.js +124 -0
  135. package/dist/charts/engine/shapes/hit.js.map +1 -0
  136. package/dist/charts/engine/shapes/index.d.cts +9 -0
  137. package/dist/charts/engine/shapes/index.d.ts +9 -0
  138. package/dist/charts/engine/shapes/layout.cjs +3 -0
  139. package/dist/charts/engine/shapes/layout.cjs.map +1 -0
  140. package/dist/charts/engine/shapes/layout.d.cts +88 -0
  141. package/dist/charts/engine/shapes/layout.d.ts +88 -0
  142. package/dist/charts/engine/shapes/layout.js +266 -0
  143. package/dist/charts/engine/shapes/layout.js.map +1 -0
  144. package/dist/charts/engine/shapes/pie.cjs +2 -0
  145. package/dist/charts/engine/shapes/pie.cjs.map +1 -0
  146. package/dist/charts/engine/shapes/pie.d.cts +20 -0
  147. package/dist/charts/engine/shapes/pie.d.ts +20 -0
  148. package/dist/charts/engine/shapes/pie.js +302 -0
  149. package/dist/charts/engine/shapes/pie.js.map +1 -0
  150. package/dist/charts/engine/shapes/radar.cjs +2 -0
  151. package/dist/charts/engine/shapes/radar.cjs.map +1 -0
  152. package/dist/charts/engine/shapes/radar.d.cts +8 -0
  153. package/dist/charts/engine/shapes/radar.d.ts +8 -0
  154. package/dist/charts/engine/shapes/radar.js +197 -0
  155. package/dist/charts/engine/shapes/radar.js.map +1 -0
  156. package/dist/charts/engine/shapes/runtime.cjs +2 -0
  157. package/dist/charts/engine/shapes/runtime.cjs.map +1 -0
  158. package/dist/charts/engine/shapes/runtime.d.cts +29 -0
  159. package/dist/charts/engine/shapes/runtime.d.ts +29 -0
  160. package/dist/charts/engine/shapes/runtime.js +97 -0
  161. package/dist/charts/engine/shapes/runtime.js.map +1 -0
  162. package/dist/charts/engine/shapes/scene.cjs +2 -0
  163. package/dist/charts/engine/shapes/scene.cjs.map +1 -0
  164. package/dist/charts/engine/shapes/scene.d.cts +257 -0
  165. package/dist/charts/engine/shapes/scene.d.ts +257 -0
  166. package/dist/charts/engine/shapes/scene.js +123 -0
  167. package/dist/charts/engine/shapes/scene.js.map +1 -0
  168. package/dist/charts/engine/shapes/treemap.cjs +2 -0
  169. package/dist/charts/engine/shapes/treemap.cjs.map +1 -0
  170. package/dist/charts/engine/shapes/treemap.d.cts +14 -0
  171. package/dist/charts/engine/shapes/treemap.d.ts +14 -0
  172. package/dist/charts/engine/shapes/treemap.js +213 -0
  173. package/dist/charts/engine/shapes/treemap.js.map +1 -0
  174. package/dist/charts/engine/shapes/types.d.cts +292 -0
  175. package/dist/charts/engine/shapes/types.d.ts +292 -0
  176. package/dist/charts/engine/signature.cjs +2 -0
  177. package/dist/charts/engine/signature.cjs.map +1 -0
  178. package/dist/charts/engine/signature.d.cts +9 -0
  179. package/dist/charts/engine/signature.d.ts +9 -0
  180. package/dist/charts/engine/signature.js +13 -0
  181. package/dist/charts/engine/signature.js.map +1 -0
  182. package/dist/charts/engine/theme.cjs +1 -1
  183. package/dist/charts/engine/theme.cjs.map +1 -1
  184. package/dist/charts/engine/theme.d.cts +10 -1
  185. package/dist/charts/engine/theme.d.ts +10 -1
  186. package/dist/charts/engine/theme.js +40 -16
  187. package/dist/charts/engine/theme.js.map +1 -1
  188. package/dist/charts/engine/types.d.cts +70 -9
  189. package/dist/charts/engine/types.d.ts +70 -9
  190. package/dist/charts/index.cjs +1 -1
  191. package/dist/charts/index.d.cts +4 -2
  192. package/dist/charts/index.d.ts +4 -2
  193. package/dist/charts/index.js +8 -5
  194. package/dist/charts/react/Chart.cjs +1 -1
  195. package/dist/charts/react/Chart.cjs.map +1 -1
  196. package/dist/charts/react/Chart.d.cts +8 -1
  197. package/dist/charts/react/Chart.d.ts +8 -1
  198. package/dist/charts/react/Chart.js +66 -47
  199. package/dist/charts/react/Chart.js.map +1 -1
  200. package/dist/charts/react/charts.cjs +1 -1
  201. package/dist/charts/react/charts.cjs.map +1 -1
  202. package/dist/charts/react/charts.d.cts +10 -2
  203. package/dist/charts/react/charts.d.ts +10 -2
  204. package/dist/charts/react/charts.js +174 -51
  205. package/dist/charts/react/charts.js.map +1 -1
  206. package/dist/charts/react/shapes.cjs +2 -0
  207. package/dist/charts/react/shapes.cjs.map +1 -0
  208. package/dist/charts/react/shapes.d.cts +255 -0
  209. package/dist/charts/react/shapes.d.ts +255 -0
  210. package/dist/charts/react/shapes.js +242 -0
  211. package/dist/charts/react/shapes.js.map +1 -0
  212. package/dist/charts/react/types.d.cts +73 -4
  213. package/dist/charts/react/types.d.ts +73 -4
  214. package/dist/native/charts/src/engine/color.cjs +1 -1
  215. package/dist/native/charts/src/engine/color.cjs.map +1 -1
  216. package/dist/native/charts/src/engine/color.js +12 -3
  217. package/dist/native/charts/src/engine/color.js.map +1 -1
  218. package/dist/native/charts/src/engine/controller.cjs +2 -2
  219. package/dist/native/charts/src/engine/controller.cjs.map +1 -1
  220. package/dist/native/charts/src/engine/controller.js +334 -270
  221. package/dist/native/charts/src/engine/controller.js.map +1 -1
  222. package/dist/native/charts/src/engine/curve.cjs +2 -0
  223. package/dist/native/charts/src/engine/curve.cjs.map +1 -0
  224. package/dist/native/charts/src/engine/curve.js +56 -0
  225. package/dist/native/charts/src/engine/curve.js.map +1 -0
  226. package/dist/native/charts/src/engine/data.cjs +1 -1
  227. package/dist/native/charts/src/engine/data.cjs.map +1 -1
  228. package/dist/native/charts/src/engine/data.js +98 -38
  229. package/dist/native/charts/src/engine/data.js.map +1 -1
  230. package/dist/native/charts/src/engine/model.cjs +1 -1
  231. package/dist/native/charts/src/engine/model.cjs.map +1 -1
  232. package/dist/native/charts/src/engine/model.js +229 -112
  233. package/dist/native/charts/src/engine/model.js.map +1 -1
  234. package/dist/native/charts/src/engine/overlay.cjs +1 -1
  235. package/dist/native/charts/src/engine/overlay.cjs.map +1 -1
  236. package/dist/native/charts/src/engine/overlay.js +16 -16
  237. package/dist/native/charts/src/engine/overlay.js.map +1 -1
  238. package/dist/native/charts/src/engine/presets.cjs +1 -1
  239. package/dist/native/charts/src/engine/presets.cjs.map +1 -1
  240. package/dist/native/charts/src/engine/presets.js +11 -4
  241. package/dist/native/charts/src/engine/presets.js.map +1 -1
  242. package/dist/native/charts/src/engine/scene.cjs +1 -1
  243. package/dist/native/charts/src/engine/scene.cjs.map +1 -1
  244. package/dist/native/charts/src/engine/scene.js +209 -97
  245. package/dist/native/charts/src/engine/scene.js.map +1 -1
  246. package/dist/native/charts/src/engine/theme.cjs.map +1 -1
  247. package/dist/native/charts/src/engine/theme.js.map +1 -1
  248. package/dist/native/components/Chart/scene.cjs +1 -1
  249. package/dist/native/components/Chart/scene.cjs.map +1 -1
  250. package/dist/native/components/Chart/scene.js +31 -19
  251. package/dist/native/components/Chart/scene.js.map +1 -1
  252. package/dist/native/source/components/Chart/scene.tsx +54 -20
  253. package/dist/taro/index.js +1059 -579
  254. package/dist/uni/charts-canvas.js +3 -1
  255. package/dist/weapp/controls.js +966 -225
  256. package/package.json +1 -1
@@ -0,0 +1,255 @@
1
+ import { CSSProperties, ReactNode, Ref } from 'react';
2
+ import { ChartPadding } from '../engine/types.cjs';
3
+ import { GaugeBand, RadarIndicator, RadarSeries, ShapeChartInstance, ShapeDatum, ShapeHoverEvent, ShapeLegendOptions, ShapeToggleEvent, ShapeTooltipOptions, TreemapNode } from '../engine/shapes/types.cjs';
4
+ /** Imperative handle of the shape chart components (`ref`) */
5
+ export interface ShapeChartHandle {
6
+ /** The underlying engine instance (minerva-design/charts/core) */
7
+ getInstance(): ShapeChartInstance | null;
8
+ }
9
+ /** Props shared by PieChart, DonutChart, RadarChart, GaugeChart, FunnelChart and TreemapChart */
10
+ export interface ShapeChartCommonProps {
11
+ /**
12
+ * Height of the chart (the legend included); numbers are pixels
13
+ * @default 320 (GaugeChart: 240)
14
+ */
15
+ height?: number | string;
16
+ /**
17
+ * Width of the chart; numbers are pixels
18
+ * @default "100%"
19
+ */
20
+ width?: number | string;
21
+ /** Colors of the marks without `color` (defaults to the `--chart-series-1..8` CSS variables, then the theme colors) */
22
+ palette?: readonly string[];
23
+ /**
24
+ * Legend; clicking an item hides / shows its slice, stage or series
25
+ * @default shown for pie, donut, funnel and multi-series radar charts
26
+ */
27
+ legend?: boolean | ShapeLegendOptions;
28
+ /**
29
+ * Tooltip; `false` disables it
30
+ * @default true
31
+ */
32
+ tooltip?: boolean | ShapeTooltipOptions;
33
+ /**
34
+ * Formats the values of the labels and the tooltip
35
+ * @default compact numbers (1.2k, 3.4M)
36
+ */
37
+ format?: (value: number) => string;
38
+ /**
39
+ * Formats the shares (labels, conversion rates, tooltip); `share` is 0-1
40
+ * @default one decimal, e.g. "40.0%"
41
+ */
42
+ percentFormat?: (share: number) => string;
43
+ /**
44
+ * Hidden slices / stages / radar series / top-level treemap nodes, by
45
+ * index. Makes the visibility controlled: legend clicks then only call
46
+ * `onToggle`, whose `hiddenIndexes` should be stored and passed back.
47
+ * Leave undefined to let the legend hide / show entries by itself.
48
+ */
49
+ hidden?: readonly number[];
50
+ /**
51
+ * Called when a legend item is clicked (or the instance's `toggle()` is
52
+ * called), with the toggled index and every hidden index after the toggle
53
+ */
54
+ onToggle?: (event: ShapeToggleEvent) => void;
55
+ /**
56
+ * Entry and update animations (skipped when the user prefers reduced motion)
57
+ * @default true
58
+ */
59
+ animation?: boolean;
60
+ /**
61
+ * Space around the drawing, in pixels
62
+ * @default 8 on every side
63
+ */
64
+ padding?: ChartPadding;
65
+ /**
66
+ * Accessible name of the chart
67
+ * @default the chart type, e.g. "Donut chart"
68
+ */
69
+ ariaLabel?: string;
70
+ /** Called when the hovered (or keyboard-focused) mark changes */
71
+ onHover?: (event: ShapeHoverEvent | null) => void;
72
+ /** Called when a mark is clicked, tapped or activated with Enter */
73
+ onClick?: (event: ShapeHoverEvent) => void;
74
+ /** React content of the tooltip (replaces the default content) */
75
+ renderTooltip?: (event: ShapeHoverEvent) => ReactNode;
76
+ /** Additional class name of the root element */
77
+ className?: string;
78
+ /** Inline styles of the root element */
79
+ style?: CSSProperties;
80
+ /** Imperative handle */
81
+ ref?: Ref<ShapeChartHandle>;
82
+ }
83
+ /** Props of PieChart */
84
+ export interface PieChartProps extends ShapeChartCommonProps {
85
+ /** Slices: a name, a value (negative values count as 0) and an optional color */
86
+ data: readonly ShapeDatum[];
87
+ /**
88
+ * Inner radius as a fraction of the outer radius: 0 = pie, 0.6 = donut
89
+ * @default 0
90
+ */
91
+ innerRadius?: number;
92
+ /**
93
+ * Angle of the first slice, degrees clockwise from 12 o'clock
94
+ * @default 0
95
+ */
96
+ startAngle?: number;
97
+ /**
98
+ * Gap between the slices, in pixels
99
+ * @default 1 (pie), 2 (donut)
100
+ */
101
+ padAngle?: number;
102
+ /**
103
+ * Corner radius of the slices, in pixels
104
+ * @default 0 (pie), 4 (donut)
105
+ */
106
+ cornerRadius?: number;
107
+ /**
108
+ * Nightingale rose: the radius (instead of the angle) shows the value
109
+ * @default false
110
+ */
111
+ rose?: boolean;
112
+ /**
113
+ * Slice labels: `outside` with leader lines, `inside` the slices, or none
114
+ * @default "outside" (up to 12 slices), "none" otherwise
115
+ */
116
+ labels?: "outside" | "inside" | "none";
117
+ /**
118
+ * What a label shows: name, value, percent (combinable)
119
+ * @default ["name", "percent"]
120
+ */
121
+ labelContent?: readonly ("name" | "value" | "percent")[];
122
+ /** Big text in the hole of a donut (e.g. the total) */
123
+ centerValue?: string;
124
+ /** Small text under `centerValue` */
125
+ centerLabel?: string;
126
+ }
127
+ /** Props of DonutChart: a PieChart with a hole */
128
+ export interface DonutChartProps extends PieChartProps {
129
+ /**
130
+ * Inner radius as a fraction of the outer radius
131
+ * @default 0.62
132
+ */
133
+ innerRadius?: number;
134
+ }
135
+ /** Props of RadarChart */
136
+ export interface RadarChartProps extends ShapeChartCommonProps {
137
+ /** Axes of the chart, clockwise from 12 o'clock */
138
+ indicators: readonly RadarIndicator[];
139
+ /** Polygons: one value per indicator */
140
+ series: readonly RadarSeries[];
141
+ /**
142
+ * Grid shape
143
+ * @default "polygon"
144
+ */
145
+ shape?: "polygon" | "circle";
146
+ /**
147
+ * Number of grid rings
148
+ * @default 4
149
+ */
150
+ levels?: number;
151
+ /**
152
+ * Dots on the vertices
153
+ * @default true
154
+ */
155
+ dots?: boolean;
156
+ }
157
+ /** Props of GaugeChart */
158
+ export interface GaugeChartProps extends ShapeChartCommonProps {
159
+ /** Value shown by the arc (clamped to `min` - `max` for the drawing) */
160
+ value: number;
161
+ /**
162
+ * Value at the start of the arc
163
+ * @default 0
164
+ */
165
+ min?: number;
166
+ /**
167
+ * Value at the end of the arc
168
+ * @default 100
169
+ */
170
+ max?: number;
171
+ /** Caption under the value */
172
+ label?: string;
173
+ /**
174
+ * Total angle of the arc, degrees
175
+ * @default 240
176
+ */
177
+ sweep?: number;
178
+ /**
179
+ * Thickness of the arc as a fraction of the radius
180
+ * @default 0.16
181
+ */
182
+ thickness?: number;
183
+ /** Colored ranges of the track; the value arc takes the color of its band */
184
+ bands?: readonly GaugeBand[];
185
+ /**
186
+ * Color of the value arc (when there are no bands)
187
+ * @default the first palette color
188
+ */
189
+ color?: string;
190
+ /**
191
+ * Draws a needle in addition to the value arc
192
+ * @default false
193
+ */
194
+ needle?: boolean;
195
+ /**
196
+ * Tick labels at the ends (and at the band bounds)
197
+ * @default true
198
+ */
199
+ ticks?: boolean;
200
+ }
201
+ /** Props of FunnelChart */
202
+ export interface FunnelChartProps extends ShapeChartCommonProps {
203
+ /** Stages: a name, a value and an optional color */
204
+ data: readonly ShapeDatum[];
205
+ /**
206
+ * Order of the stages
207
+ * @default "none" (data order)
208
+ */
209
+ sort?: "descending" | "ascending" | "none";
210
+ /**
211
+ * Vertical gap between the stages, in pixels
212
+ * @default 4
213
+ */
214
+ gap?: number;
215
+ /**
216
+ * Shows the conversion rate from the previous stage
217
+ * @default true
218
+ */
219
+ conversion?: boolean;
220
+ /**
221
+ * Shape of the stages: trapezoids that narrow to the next stage, or centered bars
222
+ * @default "trapezoid"
223
+ */
224
+ shape?: "trapezoid" | "bar";
225
+ }
226
+ /** Props of TreemapChart */
227
+ export interface TreemapChartProps extends ShapeChartCommonProps {
228
+ /** Nodes: leaves carry a value, parents sum their children */
229
+ data: readonly TreemapNode[];
230
+ /**
231
+ * Gap between the cells, in pixels
232
+ * @default 2
233
+ */
234
+ gap?: number;
235
+ /**
236
+ * Draws the names of the parents above their children
237
+ * @default true
238
+ */
239
+ headers?: boolean;
240
+ }
241
+ /**
242
+ * Pie chart (or a donut with `innerRadius`, or a Nightingale rose with
243
+ * `rose`): slices with gaps, outside labels with leader lines, legend toggles.
244
+ */
245
+ export declare function PieChart(props: PieChartProps): import('react').JSX.Element;
246
+ /** Donut chart: a PieChart with a hole and optional center texts */
247
+ export declare function DonutChart(props: DonutChartProps): import('react').JSX.Element;
248
+ /** Radar (spider) chart comparing series over several indicators */
249
+ export declare function RadarChart(props: RadarChartProps): import('react').JSX.Element;
250
+ /** Gauge (speedometer) showing one value on an arc, with colored bands */
251
+ export declare function GaugeChart(props: GaugeChartProps): import('react').JSX.Element;
252
+ /** Funnel chart of the stages of a process, with conversion rates */
253
+ export declare function FunnelChart(props: FunnelChartProps): import('react').JSX.Element;
254
+ /** Treemap: nested rectangles of areas proportional to the values */
255
+ export declare function TreemapChart(props: TreemapChartProps): import('react').JSX.Element;
@@ -0,0 +1,255 @@
1
+ import { CSSProperties, ReactNode, Ref } from 'react';
2
+ import { ChartPadding } from '../engine/types.js';
3
+ import { GaugeBand, RadarIndicator, RadarSeries, ShapeChartInstance, ShapeDatum, ShapeHoverEvent, ShapeLegendOptions, ShapeToggleEvent, ShapeTooltipOptions, TreemapNode } from '../engine/shapes/types.js';
4
+ /** Imperative handle of the shape chart components (`ref`) */
5
+ export interface ShapeChartHandle {
6
+ /** The underlying engine instance (minerva-design/charts/core) */
7
+ getInstance(): ShapeChartInstance | null;
8
+ }
9
+ /** Props shared by PieChart, DonutChart, RadarChart, GaugeChart, FunnelChart and TreemapChart */
10
+ export interface ShapeChartCommonProps {
11
+ /**
12
+ * Height of the chart (the legend included); numbers are pixels
13
+ * @default 320 (GaugeChart: 240)
14
+ */
15
+ height?: number | string;
16
+ /**
17
+ * Width of the chart; numbers are pixels
18
+ * @default "100%"
19
+ */
20
+ width?: number | string;
21
+ /** Colors of the marks without `color` (defaults to the `--chart-series-1..8` CSS variables, then the theme colors) */
22
+ palette?: readonly string[];
23
+ /**
24
+ * Legend; clicking an item hides / shows its slice, stage or series
25
+ * @default shown for pie, donut, funnel and multi-series radar charts
26
+ */
27
+ legend?: boolean | ShapeLegendOptions;
28
+ /**
29
+ * Tooltip; `false` disables it
30
+ * @default true
31
+ */
32
+ tooltip?: boolean | ShapeTooltipOptions;
33
+ /**
34
+ * Formats the values of the labels and the tooltip
35
+ * @default compact numbers (1.2k, 3.4M)
36
+ */
37
+ format?: (value: number) => string;
38
+ /**
39
+ * Formats the shares (labels, conversion rates, tooltip); `share` is 0-1
40
+ * @default one decimal, e.g. "40.0%"
41
+ */
42
+ percentFormat?: (share: number) => string;
43
+ /**
44
+ * Hidden slices / stages / radar series / top-level treemap nodes, by
45
+ * index. Makes the visibility controlled: legend clicks then only call
46
+ * `onToggle`, whose `hiddenIndexes` should be stored and passed back.
47
+ * Leave undefined to let the legend hide / show entries by itself.
48
+ */
49
+ hidden?: readonly number[];
50
+ /**
51
+ * Called when a legend item is clicked (or the instance's `toggle()` is
52
+ * called), with the toggled index and every hidden index after the toggle
53
+ */
54
+ onToggle?: (event: ShapeToggleEvent) => void;
55
+ /**
56
+ * Entry and update animations (skipped when the user prefers reduced motion)
57
+ * @default true
58
+ */
59
+ animation?: boolean;
60
+ /**
61
+ * Space around the drawing, in pixels
62
+ * @default 8 on every side
63
+ */
64
+ padding?: ChartPadding;
65
+ /**
66
+ * Accessible name of the chart
67
+ * @default the chart type, e.g. "Donut chart"
68
+ */
69
+ ariaLabel?: string;
70
+ /** Called when the hovered (or keyboard-focused) mark changes */
71
+ onHover?: (event: ShapeHoverEvent | null) => void;
72
+ /** Called when a mark is clicked, tapped or activated with Enter */
73
+ onClick?: (event: ShapeHoverEvent) => void;
74
+ /** React content of the tooltip (replaces the default content) */
75
+ renderTooltip?: (event: ShapeHoverEvent) => ReactNode;
76
+ /** Additional class name of the root element */
77
+ className?: string;
78
+ /** Inline styles of the root element */
79
+ style?: CSSProperties;
80
+ /** Imperative handle */
81
+ ref?: Ref<ShapeChartHandle>;
82
+ }
83
+ /** Props of PieChart */
84
+ export interface PieChartProps extends ShapeChartCommonProps {
85
+ /** Slices: a name, a value (negative values count as 0) and an optional color */
86
+ data: readonly ShapeDatum[];
87
+ /**
88
+ * Inner radius as a fraction of the outer radius: 0 = pie, 0.6 = donut
89
+ * @default 0
90
+ */
91
+ innerRadius?: number;
92
+ /**
93
+ * Angle of the first slice, degrees clockwise from 12 o'clock
94
+ * @default 0
95
+ */
96
+ startAngle?: number;
97
+ /**
98
+ * Gap between the slices, in pixels
99
+ * @default 1 (pie), 2 (donut)
100
+ */
101
+ padAngle?: number;
102
+ /**
103
+ * Corner radius of the slices, in pixels
104
+ * @default 0 (pie), 4 (donut)
105
+ */
106
+ cornerRadius?: number;
107
+ /**
108
+ * Nightingale rose: the radius (instead of the angle) shows the value
109
+ * @default false
110
+ */
111
+ rose?: boolean;
112
+ /**
113
+ * Slice labels: `outside` with leader lines, `inside` the slices, or none
114
+ * @default "outside" (up to 12 slices), "none" otherwise
115
+ */
116
+ labels?: "outside" | "inside" | "none";
117
+ /**
118
+ * What a label shows: name, value, percent (combinable)
119
+ * @default ["name", "percent"]
120
+ */
121
+ labelContent?: readonly ("name" | "value" | "percent")[];
122
+ /** Big text in the hole of a donut (e.g. the total) */
123
+ centerValue?: string;
124
+ /** Small text under `centerValue` */
125
+ centerLabel?: string;
126
+ }
127
+ /** Props of DonutChart: a PieChart with a hole */
128
+ export interface DonutChartProps extends PieChartProps {
129
+ /**
130
+ * Inner radius as a fraction of the outer radius
131
+ * @default 0.62
132
+ */
133
+ innerRadius?: number;
134
+ }
135
+ /** Props of RadarChart */
136
+ export interface RadarChartProps extends ShapeChartCommonProps {
137
+ /** Axes of the chart, clockwise from 12 o'clock */
138
+ indicators: readonly RadarIndicator[];
139
+ /** Polygons: one value per indicator */
140
+ series: readonly RadarSeries[];
141
+ /**
142
+ * Grid shape
143
+ * @default "polygon"
144
+ */
145
+ shape?: "polygon" | "circle";
146
+ /**
147
+ * Number of grid rings
148
+ * @default 4
149
+ */
150
+ levels?: number;
151
+ /**
152
+ * Dots on the vertices
153
+ * @default true
154
+ */
155
+ dots?: boolean;
156
+ }
157
+ /** Props of GaugeChart */
158
+ export interface GaugeChartProps extends ShapeChartCommonProps {
159
+ /** Value shown by the arc (clamped to `min` - `max` for the drawing) */
160
+ value: number;
161
+ /**
162
+ * Value at the start of the arc
163
+ * @default 0
164
+ */
165
+ min?: number;
166
+ /**
167
+ * Value at the end of the arc
168
+ * @default 100
169
+ */
170
+ max?: number;
171
+ /** Caption under the value */
172
+ label?: string;
173
+ /**
174
+ * Total angle of the arc, degrees
175
+ * @default 240
176
+ */
177
+ sweep?: number;
178
+ /**
179
+ * Thickness of the arc as a fraction of the radius
180
+ * @default 0.16
181
+ */
182
+ thickness?: number;
183
+ /** Colored ranges of the track; the value arc takes the color of its band */
184
+ bands?: readonly GaugeBand[];
185
+ /**
186
+ * Color of the value arc (when there are no bands)
187
+ * @default the first palette color
188
+ */
189
+ color?: string;
190
+ /**
191
+ * Draws a needle in addition to the value arc
192
+ * @default false
193
+ */
194
+ needle?: boolean;
195
+ /**
196
+ * Tick labels at the ends (and at the band bounds)
197
+ * @default true
198
+ */
199
+ ticks?: boolean;
200
+ }
201
+ /** Props of FunnelChart */
202
+ export interface FunnelChartProps extends ShapeChartCommonProps {
203
+ /** Stages: a name, a value and an optional color */
204
+ data: readonly ShapeDatum[];
205
+ /**
206
+ * Order of the stages
207
+ * @default "none" (data order)
208
+ */
209
+ sort?: "descending" | "ascending" | "none";
210
+ /**
211
+ * Vertical gap between the stages, in pixels
212
+ * @default 4
213
+ */
214
+ gap?: number;
215
+ /**
216
+ * Shows the conversion rate from the previous stage
217
+ * @default true
218
+ */
219
+ conversion?: boolean;
220
+ /**
221
+ * Shape of the stages: trapezoids that narrow to the next stage, or centered bars
222
+ * @default "trapezoid"
223
+ */
224
+ shape?: "trapezoid" | "bar";
225
+ }
226
+ /** Props of TreemapChart */
227
+ export interface TreemapChartProps extends ShapeChartCommonProps {
228
+ /** Nodes: leaves carry a value, parents sum their children */
229
+ data: readonly TreemapNode[];
230
+ /**
231
+ * Gap between the cells, in pixels
232
+ * @default 2
233
+ */
234
+ gap?: number;
235
+ /**
236
+ * Draws the names of the parents above their children
237
+ * @default true
238
+ */
239
+ headers?: boolean;
240
+ }
241
+ /**
242
+ * Pie chart (or a donut with `innerRadius`, or a Nightingale rose with
243
+ * `rose`): slices with gaps, outside labels with leader lines, legend toggles.
244
+ */
245
+ export declare function PieChart(props: PieChartProps): import('react').JSX.Element;
246
+ /** Donut chart: a PieChart with a hole and optional center texts */
247
+ export declare function DonutChart(props: DonutChartProps): import('react').JSX.Element;
248
+ /** Radar (spider) chart comparing series over several indicators */
249
+ export declare function RadarChart(props: RadarChartProps): import('react').JSX.Element;
250
+ /** Gauge (speedometer) showing one value on an arc, with colored bands */
251
+ export declare function GaugeChart(props: GaugeChartProps): import('react').JSX.Element;
252
+ /** Funnel chart of the stages of a process, with conversion rates */
253
+ export declare function FunnelChart(props: FunnelChartProps): import('react').JSX.Element;
254
+ /** Treemap: nested rectangles of areas proportional to the values */
255
+ export declare function TreemapChart(props: TreemapChartProps): import('react').JSX.Element;