@mantine/charts 8.3.13 → 9.0.0-alpha.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 (112) hide show
  1. package/cjs/AreaChart/AreaChart.cjs +152 -162
  2. package/cjs/AreaChart/AreaChart.cjs.map +1 -1
  3. package/cjs/BarChart/BarChart.cjs +4 -5
  4. package/cjs/BarChart/BarChart.cjs.map +1 -1
  5. package/cjs/BarsList/BarsList.cjs +121 -0
  6. package/cjs/BarsList/BarsList.cjs.map +1 -0
  7. package/cjs/BarsList/BarsList.module.css.cjs +7 -0
  8. package/cjs/BarsList/BarsList.module.css.cjs.map +1 -0
  9. package/cjs/BubbleChart/BubbleChart.cjs +3 -2
  10. package/cjs/BubbleChart/BubbleChart.cjs.map +1 -1
  11. package/cjs/ChartLegend/ChartLegend.cjs +5 -12
  12. package/cjs/ChartLegend/ChartLegend.cjs.map +1 -1
  13. package/cjs/ChartTooltip/ChartTooltip.cjs +2 -2
  14. package/cjs/ChartTooltip/ChartTooltip.cjs.map +1 -1
  15. package/cjs/CompositeChart/CompositeChart.cjs +141 -151
  16. package/cjs/CompositeChart/CompositeChart.cjs.map +1 -1
  17. package/cjs/DonutChart/DonutChart.cjs +5 -4
  18. package/cjs/DonutChart/DonutChart.cjs.map +1 -1
  19. package/cjs/FunnelChart/FunnelChart.cjs +4 -3
  20. package/cjs/FunnelChart/FunnelChart.cjs.map +1 -1
  21. package/cjs/Heatmap/Heatmap.cjs +1 -2
  22. package/cjs/Heatmap/Heatmap.cjs.map +1 -1
  23. package/cjs/LineChart/LineChart.cjs +142 -153
  24. package/cjs/LineChart/LineChart.cjs.map +1 -1
  25. package/cjs/PieChart/PieChart.cjs +10 -9
  26. package/cjs/PieChart/PieChart.cjs.map +1 -1
  27. package/cjs/RadarChart/RadarChart.cjs +3 -2
  28. package/cjs/RadarChart/RadarChart.cjs.map +1 -1
  29. package/cjs/RadialBarChart/RadialBarChart.cjs +3 -2
  30. package/cjs/RadialBarChart/RadialBarChart.cjs.map +1 -1
  31. package/cjs/ScatterChart/ScatterChart.cjs +127 -136
  32. package/cjs/ScatterChart/ScatterChart.cjs.map +1 -1
  33. package/cjs/Sparkline/Sparkline.cjs +7 -5
  34. package/cjs/Sparkline/Sparkline.cjs.map +1 -1
  35. package/cjs/Sparkline/Sparkline.module.css.cjs +7 -0
  36. package/cjs/Sparkline/Sparkline.module.css.cjs.map +1 -0
  37. package/cjs/index.cjs +2 -0
  38. package/cjs/index.cjs.map +1 -1
  39. package/esm/AreaChart/AreaChart.mjs +152 -162
  40. package/esm/AreaChart/AreaChart.mjs.map +1 -1
  41. package/esm/BarChart/BarChart.mjs +4 -5
  42. package/esm/BarChart/BarChart.mjs.map +1 -1
  43. package/esm/BarsList/BarsList.mjs +119 -0
  44. package/esm/BarsList/BarsList.mjs.map +1 -0
  45. package/esm/BarsList/BarsList.module.css.mjs +5 -0
  46. package/esm/BarsList/BarsList.module.css.mjs.map +1 -0
  47. package/esm/BubbleChart/BubbleChart.mjs +3 -2
  48. package/esm/BubbleChart/BubbleChart.mjs.map +1 -1
  49. package/esm/ChartLegend/ChartLegend.mjs +5 -12
  50. package/esm/ChartLegend/ChartLegend.mjs.map +1 -1
  51. package/esm/ChartTooltip/ChartTooltip.mjs +2 -2
  52. package/esm/ChartTooltip/ChartTooltip.mjs.map +1 -1
  53. package/esm/CompositeChart/CompositeChart.mjs +141 -151
  54. package/esm/CompositeChart/CompositeChart.mjs.map +1 -1
  55. package/esm/DonutChart/DonutChart.mjs +5 -4
  56. package/esm/DonutChart/DonutChart.mjs.map +1 -1
  57. package/esm/FunnelChart/FunnelChart.mjs +4 -3
  58. package/esm/FunnelChart/FunnelChart.mjs.map +1 -1
  59. package/esm/Heatmap/Heatmap.mjs +1 -2
  60. package/esm/Heatmap/Heatmap.mjs.map +1 -1
  61. package/esm/LineChart/LineChart.mjs +142 -153
  62. package/esm/LineChart/LineChart.mjs.map +1 -1
  63. package/esm/PieChart/PieChart.mjs +10 -9
  64. package/esm/PieChart/PieChart.mjs.map +1 -1
  65. package/esm/RadarChart/RadarChart.mjs +3 -2
  66. package/esm/RadarChart/RadarChart.mjs.map +1 -1
  67. package/esm/RadialBarChart/RadialBarChart.mjs +3 -2
  68. package/esm/RadialBarChart/RadialBarChart.mjs.map +1 -1
  69. package/esm/ScatterChart/ScatterChart.mjs +127 -136
  70. package/esm/ScatterChart/ScatterChart.mjs.map +1 -1
  71. package/esm/Sparkline/Sparkline.mjs +5 -3
  72. package/esm/Sparkline/Sparkline.mjs.map +1 -1
  73. package/esm/Sparkline/Sparkline.module.css.mjs +5 -0
  74. package/esm/Sparkline/Sparkline.module.css.mjs.map +1 -0
  75. package/esm/index.mjs +1 -0
  76. package/esm/index.mjs.map +1 -1
  77. package/lib/AreaChart/AreaChart.d.ts +10 -10
  78. package/lib/AreaChart/index.d.ts +10 -1
  79. package/lib/BarChart/BarChart.d.ts +6 -6
  80. package/lib/BarChart/index.d.ts +10 -1
  81. package/lib/BarsList/BarsList.d.ts +55 -0
  82. package/lib/BarsList/index.d.ts +9 -0
  83. package/lib/BubbleChart/BubbleChart.d.ts +3 -3
  84. package/lib/BubbleChart/index.d.ts +9 -1
  85. package/lib/ChartLegend/ChartLegend.d.ts +2 -2
  86. package/lib/ChartTooltip/ChartTooltip.d.ts +4 -4
  87. package/lib/CompositeChart/CompositeChart.d.ts +8 -8
  88. package/lib/CompositeChart/index.d.ts +10 -1
  89. package/lib/DonutChart/DonutChart.d.ts +12 -12
  90. package/lib/DonutChart/index.d.ts +9 -1
  91. package/lib/FunnelChart/FunnelChart.d.ts +9 -9
  92. package/lib/FunnelChart/index.d.ts +9 -1
  93. package/lib/Heatmap/Heatmap.d.ts +6 -6
  94. package/lib/Heatmap/HeatmapWeeks.types.d.ts +1 -1
  95. package/lib/Heatmap/index.d.ts +7 -1
  96. package/lib/LineChart/LineChart.d.ts +9 -9
  97. package/lib/LineChart/index.d.ts +10 -1
  98. package/lib/PieChart/PieChart.d.ts +13 -13
  99. package/lib/PieChart/index.d.ts +9 -1
  100. package/lib/RadarChart/RadarChart.d.ts +8 -8
  101. package/lib/RadarChart/index.d.ts +9 -1
  102. package/lib/RadialBarChart/RadialBarChart.d.ts +7 -7
  103. package/lib/RadialBarChart/index.d.ts +8 -1
  104. package/lib/ScatterChart/ScatterChart.d.ts +1 -1
  105. package/lib/ScatterChart/index.d.ts +9 -1
  106. package/lib/Sparkline/Sparkline.d.ts +6 -6
  107. package/lib/Sparkline/index.d.ts +8 -1
  108. package/lib/index.d.mts +1 -0
  109. package/lib/index.d.ts +1 -0
  110. package/package.json +6 -6
  111. package/styles.css +64 -1
  112. package/styles.layer.css +64 -1
@@ -29,7 +29,7 @@ const varsResolver = createVarsResolver(
29
29
  }
30
30
  })
31
31
  );
32
- const CompositeChart = factory((_props, ref) => {
32
+ const CompositeChart = factory((_props) => {
33
33
  const props = useProps("CompositeChart", defaultProps, _props);
34
34
  const {
35
35
  classNames,
@@ -138,7 +138,7 @@ const CompositeChart = factory((_props, ref) => {
138
138
  connectNulls,
139
139
  type: curveType,
140
140
  strokeDasharray: item.strokeDasharray,
141
- yAxisId: item.yAxisId || "left",
141
+ yAxisId: item.yAxisId || void 0,
142
142
  label: withPointLabels ? /* @__PURE__ */ jsx(PointLabel, { valueFormatter }) : void 0,
143
143
  ...typeof lineProps === "function" ? lineProps(item) : lineProps
144
144
  }
@@ -176,7 +176,7 @@ const CompositeChart = factory((_props, ref) => {
176
176
  fillOpacity: dimmed ? 0 : 0.2,
177
177
  strokeOpacity: dimmed ? 0.5 : 1,
178
178
  strokeDasharray: item.strokeDasharray,
179
- yAxisId: item.yAxisId || "left",
179
+ yAxisId: item.yAxisId || void 0,
180
180
  label: withPointLabels ? /* @__PURE__ */ jsx(PointLabel, { valueFormatter }) : void 0,
181
181
  ...typeof areaProps === "function" ? areaProps(item) : areaProps
182
182
  }
@@ -195,7 +195,7 @@ const CompositeChart = factory((_props, ref) => {
195
195
  isAnimationActive: false,
196
196
  fillOpacity: dimmed ? 0.1 : 1,
197
197
  strokeOpacity: dimmed ? 0.2 : 0,
198
- yAxisId: item.yAxisId || "left",
198
+ yAxisId: item.yAxisId || void 0,
199
199
  minPointSize: minBarSize,
200
200
  ...typeof barProps === "function" ? barProps(item) : barProps
201
201
  },
@@ -219,7 +219,7 @@ const CompositeChart = factory((_props, ref) => {
219
219
  {
220
220
  stroke: line.color ? color : "var(--chart-grid-color)",
221
221
  strokeWidth: 1,
222
- yAxisId: line.yAxisId || "left",
222
+ yAxisId: line.yAxisId || void 0,
223
223
  ...line,
224
224
  label: {
225
225
  value: line.label,
@@ -241,163 +241,153 @@ const CompositeChart = factory((_props, ref) => {
241
241
  tickFormatter: valueFormatter,
242
242
  ...getStyles("axis")
243
243
  };
244
- return /* @__PURE__ */ jsx(
245
- Box,
244
+ return /* @__PURE__ */ jsx(Box, { ...getStyles("root"), onMouseLeave: handleMouseLeave, dir: dir || "ltr", ...others, children: /* @__PURE__ */ jsx(ResponsiveContainer, { ...getStyles("container"), children: /* @__PURE__ */ jsxs(
245
+ ComposedChart,
246
246
  {
247
- ref,
248
- ...getStyles("root"),
249
- onMouseLeave: handleMouseLeave,
250
- dir: dir || "ltr",
251
- ...others,
252
- children: /* @__PURE__ */ jsx(ResponsiveContainer, { ...getStyles("container"), children: /* @__PURE__ */ jsxs(
253
- ComposedChart,
254
- {
255
- data,
256
- maxBarSize: maxBarWidth,
257
- margin: {
258
- bottom: xAxisLabel ? 30 : void 0,
259
- left: yAxisLabel ? 10 : void 0,
260
- right: yAxisLabel ? 5 : void 0
261
- },
262
- ...composedChartProps,
263
- children: [
264
- withLegend && /* @__PURE__ */ jsx(
265
- Legend,
266
- {
267
- verticalAlign: "top",
268
- content: (payload) => /* @__PURE__ */ jsx(
269
- ChartLegend,
270
- {
271
- payload: payload.payload,
272
- onHighlight: setHighlightedArea,
273
- legendPosition: legendProps?.verticalAlign || "top",
274
- classNames: resolvedClassNames,
275
- styles: resolvedStyles,
276
- series,
277
- attributes
278
- }
279
- ),
280
- ...legendProps
281
- }
282
- ),
283
- /* @__PURE__ */ jsxs(
284
- XAxis,
285
- {
286
- hide: !withXAxis,
287
- dataKey,
288
- tick: { transform: "translate(0, 10)", fontSize: 12, fill: "currentColor" },
289
- stroke: "",
290
- interval: "preserveStartEnd",
291
- tickLine: withXTickLine ? { stroke: "currentColor" } : false,
292
- minTickGap: 5,
293
- ...getStyles("axis"),
294
- ...xAxisProps,
295
- children: [
296
- xAxisLabel && /* @__PURE__ */ jsx(Label, { position: "insideBottom", offset: -20, fontSize: 12, ...getStyles("axisLabel"), children: xAxisLabel }),
297
- xAxisProps?.children
298
- ]
299
- }
300
- ),
301
- /* @__PURE__ */ jsxs(
302
- YAxis,
303
- {
304
- yAxisId: "left",
305
- orientation: "left",
306
- tick: { transform: "translate(-10, 0)", fontSize: 12, fill: "currentColor" },
307
- hide: !withYAxis,
308
- ...sharedYAxisProps,
309
- ...yAxisProps,
310
- children: [
311
- yAxisLabel && /* @__PURE__ */ jsx(
312
- Label,
313
- {
314
- position: "insideLeft",
315
- angle: -90,
316
- textAnchor: "middle",
317
- fontSize: 12,
318
- offset: -5,
319
- ...getStyles("axisLabel"),
320
- children: yAxisLabel
321
- }
322
- ),
323
- yAxisProps?.children
324
- ]
325
- }
326
- ),
327
- /* @__PURE__ */ jsxs(
328
- YAxis,
329
- {
330
- yAxisId: "right",
331
- orientation: "right",
332
- tick: { transform: "translate(10, 0)", fontSize: 12, fill: "currentColor" },
333
- hide: !withRightYAxis,
334
- ...sharedYAxisProps,
335
- ...rightYAxisProps,
336
- children: [
337
- rightYAxisLabel && /* @__PURE__ */ jsx(
338
- Label,
339
- {
340
- position: "insideRight",
341
- angle: 90,
342
- textAnchor: "middle",
343
- fontSize: 12,
344
- offset: -5,
345
- ...getStyles("axisLabel"),
346
- children: rightYAxisLabel
347
- }
348
- ),
349
- yAxisProps?.children
350
- ]
351
- }
352
- ),
353
- /* @__PURE__ */ jsx(
354
- CartesianGrid,
247
+ data,
248
+ maxBarSize: maxBarWidth,
249
+ margin: {
250
+ bottom: xAxisLabel ? 30 : void 0,
251
+ left: yAxisLabel ? 10 : void 0,
252
+ right: yAxisLabel ? 5 : void 0
253
+ },
254
+ ...composedChartProps,
255
+ children: [
256
+ withLegend && /* @__PURE__ */ jsx(
257
+ Legend,
258
+ {
259
+ verticalAlign: "top",
260
+ content: (payload) => /* @__PURE__ */ jsx(
261
+ ChartLegend,
355
262
  {
356
- strokeDasharray,
357
- vertical: gridAxis === "y" || gridAxis === "xy",
358
- horizontal: gridAxis === "x" || gridAxis === "xy",
359
- ...getStyles("grid"),
360
- ...gridProps
263
+ payload: payload.payload,
264
+ onHighlight: setHighlightedArea,
265
+ legendPosition: legendProps?.verticalAlign || "top",
266
+ classNames: resolvedClassNames,
267
+ styles: resolvedStyles,
268
+ series,
269
+ attributes
361
270
  }
362
271
  ),
363
- withTooltip && /* @__PURE__ */ jsx(
364
- Tooltip,
272
+ ...legendProps
273
+ }
274
+ ),
275
+ /* @__PURE__ */ jsxs(
276
+ XAxis,
277
+ {
278
+ hide: !withXAxis,
279
+ dataKey,
280
+ tick: { transform: "translate(0, 10)", fontSize: 12, fill: "currentColor" },
281
+ stroke: "",
282
+ interval: "preserveStartEnd",
283
+ tickLine: withXTickLine ? { stroke: "currentColor" } : false,
284
+ minTickGap: 5,
285
+ ...getStyles("axis"),
286
+ ...xAxisProps,
287
+ children: [
288
+ xAxisLabel && /* @__PURE__ */ jsx(Label, { position: "insideBottom", offset: -20, fontSize: 12, ...getStyles("axisLabel"), children: xAxisLabel }),
289
+ xAxisProps?.children
290
+ ]
291
+ }
292
+ ),
293
+ /* @__PURE__ */ jsxs(
294
+ YAxis,
295
+ {
296
+ orientation: "left",
297
+ tick: { transform: "translate(-10, 0)", fontSize: 12, fill: "currentColor" },
298
+ hide: !withYAxis,
299
+ ...sharedYAxisProps,
300
+ ...yAxisProps,
301
+ children: [
302
+ yAxisLabel && /* @__PURE__ */ jsx(
303
+ Label,
304
+ {
305
+ position: "insideLeft",
306
+ angle: -90,
307
+ textAnchor: "middle",
308
+ fontSize: 12,
309
+ offset: -5,
310
+ ...getStyles("axisLabel"),
311
+ children: yAxisLabel
312
+ }
313
+ ),
314
+ yAxisProps?.children
315
+ ]
316
+ }
317
+ ),
318
+ /* @__PURE__ */ jsxs(
319
+ YAxis,
320
+ {
321
+ yAxisId: "right",
322
+ orientation: "right",
323
+ tick: { transform: "translate(10, 0)", fontSize: 12, fill: "currentColor" },
324
+ hide: !withRightYAxis,
325
+ ...sharedYAxisProps,
326
+ ...rightYAxisProps,
327
+ children: [
328
+ rightYAxisLabel && /* @__PURE__ */ jsx(
329
+ Label,
330
+ {
331
+ position: "insideRight",
332
+ angle: 90,
333
+ textAnchor: "middle",
334
+ fontSize: 12,
335
+ offset: -5,
336
+ ...getStyles("axisLabel"),
337
+ children: rightYAxisLabel
338
+ }
339
+ ),
340
+ yAxisProps?.children
341
+ ]
342
+ }
343
+ ),
344
+ /* @__PURE__ */ jsx(
345
+ CartesianGrid,
346
+ {
347
+ strokeDasharray,
348
+ vertical: gridAxis === "y" || gridAxis === "xy",
349
+ horizontal: gridAxis === "x" || gridAxis === "xy",
350
+ ...getStyles("grid"),
351
+ ...gridProps
352
+ }
353
+ ),
354
+ withTooltip && /* @__PURE__ */ jsx(
355
+ Tooltip,
356
+ {
357
+ animationDuration: tooltipAnimationDuration,
358
+ isAnimationActive: tooltipAnimationDuration !== 0,
359
+ position: { y: 0 },
360
+ cursor: {
361
+ stroke: "var(--chart-grid-color)",
362
+ strokeWidth: 1,
363
+ strokeDasharray
364
+ },
365
+ content: ({ label, payload, labelFormatter }) => /* @__PURE__ */ jsx(
366
+ ChartTooltip,
365
367
  {
366
- animationDuration: tooltipAnimationDuration,
367
- isAnimationActive: tooltipAnimationDuration !== 0,
368
- position: { y: 0 },
369
- cursor: {
370
- stroke: "var(--chart-grid-color)",
371
- strokeWidth: 1,
372
- strokeDasharray
373
- },
374
- content: ({ label, payload, labelFormatter }) => /* @__PURE__ */ jsx(
375
- ChartTooltip,
376
- {
377
- label: labelFormatter && payload ? labelFormatter(label, payload) : label,
378
- payload,
379
- unit,
380
- classNames: resolvedClassNames,
381
- styles: resolvedStyles,
382
- series,
383
- valueFormatter,
384
- attributes
385
- }
386
- ),
387
- ...tooltipProps
368
+ label: labelFormatter && payload ? labelFormatter(label, payload) : label,
369
+ payload,
370
+ unit,
371
+ classNames: resolvedClassNames,
372
+ styles: resolvedStyles,
373
+ series,
374
+ valueFormatter,
375
+ attributes
388
376
  }
389
377
  ),
390
- lines,
391
- referenceLinesItems,
392
- children
393
- ]
394
- }
395
- ) })
378
+ ...tooltipProps
379
+ }
380
+ ),
381
+ lines,
382
+ referenceLinesItems,
383
+ children
384
+ ]
396
385
  }
397
- );
386
+ ) }) });
398
387
  });
399
388
  CompositeChart.displayName = "@mantine/charts/CompositeChart";
400
389
  CompositeChart.classes = classes;
390
+ CompositeChart.varsResolver = varsResolver;
401
391
 
402
392
  export { CompositeChart };
403
393
  //# sourceMappingURL=CompositeChart.mjs.map