@mantine/charts 8.3.14 → 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
@@ -39,7 +39,7 @@ const varsResolver = core.createVarsResolver((theme, { textColor, gridColor }) =
39
39
  "--chart-grid-color": gridColor ? core.getThemeColor(gridColor, theme) : void 0
40
40
  }
41
41
  }));
42
- const AreaChart = core.factory((_props, ref) => {
42
+ const AreaChart = core.factory((_props) => {
43
43
  const props = core.useProps("AreaChart", defaultProps, _props);
44
44
  const {
45
45
  classNames,
@@ -146,7 +146,7 @@ const AreaChart = core.factory((_props, ref) => {
146
146
  isAnimationActive: false,
147
147
  connectNulls,
148
148
  stackId: stacked ? "stack-dots" : void 0,
149
- yAxisId: item.yAxisId || "left",
149
+ yAxisId: item.yAxisId || void 0,
150
150
  ...typeof areaProps === "function" ? areaProps(item) : areaProps
151
151
  }
152
152
  );
@@ -183,7 +183,7 @@ const AreaChart = core.factory((_props, ref) => {
183
183
  fillOpacity: dimmed ? 0 : 1,
184
184
  strokeOpacity: dimmed ? 0.5 : 1,
185
185
  strokeDasharray: item.strokeDasharray,
186
- yAxisId: item.yAxisId || "left",
186
+ yAxisId: item.yAxisId || void 0,
187
187
  label: withPointLabels ? /* @__PURE__ */ jsxRuntime.jsx(PointLabel.PointLabel, { valueFormatter }) : void 0,
188
188
  ...typeof areaProps === "function" ? areaProps(item) : areaProps
189
189
  }
@@ -197,7 +197,7 @@ const AreaChart = core.factory((_props, ref) => {
197
197
  {
198
198
  stroke: line.color ? color : "var(--chart-grid-color)",
199
199
  strokeWidth: 1,
200
- yAxisId: line.yAxisId || "left",
200
+ yAxisId: line.yAxisId || void 0,
201
201
  ...line,
202
202
  label: {
203
203
  value: line.label,
@@ -220,174 +220,164 @@ const AreaChart = core.factory((_props, ref) => {
220
220
  tickFormatter: orientation === "vertical" ? void 0 : tickFormatter,
221
221
  ...getStyles("axis")
222
222
  };
223
- return /* @__PURE__ */ jsxRuntime.jsx(
224
- core.Box,
223
+ return /* @__PURE__ */ jsxRuntime.jsx(core.Box, { ...getStyles("root"), onMouseLeave: handleMouseLeave, dir: dir || "ltr", ...others, children: /* @__PURE__ */ jsxRuntime.jsx(recharts.ResponsiveContainer, { ...getStyles("container"), children: /* @__PURE__ */ jsxRuntime.jsxs(
224
+ recharts.AreaChart,
225
225
  {
226
- ref,
227
- ...getStyles("root"),
228
- onMouseLeave: handleMouseLeave,
229
- dir: dir || "ltr",
230
- ...others,
231
- children: /* @__PURE__ */ jsxRuntime.jsx(recharts.ResponsiveContainer, { ...getStyles("container"), children: /* @__PURE__ */ jsxRuntime.jsxs(
232
- recharts.AreaChart,
233
- {
234
- data,
235
- stackOffset: type === "percent" ? "expand" : void 0,
236
- layout: orientation,
237
- margin: {
238
- bottom: xAxisLabel ? 30 : void 0,
239
- left: yAxisLabel ? 10 : void 0,
240
- right: yAxisLabel ? 5 : void 0
241
- },
242
- ...areaChartProps,
243
- children: [
244
- referenceLinesItems,
245
- withLegend && /* @__PURE__ */ jsxRuntime.jsx(
246
- recharts.Legend,
247
- {
248
- verticalAlign: "top",
249
- content: (payload) => /* @__PURE__ */ jsxRuntime.jsx(
250
- ChartLegend.ChartLegend,
251
- {
252
- payload: payload.payload,
253
- onHighlight: setHighlightedArea,
254
- legendPosition: legendProps?.verticalAlign || "top",
255
- classNames: resolvedClassNames,
256
- styles: resolvedStyles,
257
- series,
258
- attributes
259
- }
260
- ),
261
- ...legendProps
262
- }
263
- ),
264
- /* @__PURE__ */ jsxRuntime.jsx(
265
- recharts.CartesianGrid,
266
- {
267
- strokeDasharray,
268
- vertical: gridAxis === "y" || gridAxis === "xy",
269
- horizontal: gridAxis === "x" || gridAxis === "xy",
270
- ...getStyles("grid"),
271
- ...gridProps
272
- }
273
- ),
274
- /* @__PURE__ */ jsxRuntime.jsxs(
275
- recharts.XAxis,
276
- {
277
- hide: !withXAxis,
278
- ...orientation === "vertical" ? { type: "number" } : { dataKey },
279
- tick: { transform: "translate(0, 10)", fontSize: 12, fill: "currentColor" },
280
- stroke: "",
281
- interval: "preserveStartEnd",
282
- tickLine: withXTickLine ? { stroke: "currentColor" } : false,
283
- minTickGap: 5,
284
- tickFormatter: orientation === "vertical" ? tickFormatter : void 0,
285
- ...getStyles("axis"),
286
- ...xAxisProps,
287
- children: [
288
- xAxisLabel && /* @__PURE__ */ jsxRuntime.jsx(recharts.Label, { position: "insideBottom", offset: -20, fontSize: 12, ...getStyles("axisLabel"), children: xAxisLabel }),
289
- xAxisProps?.children
290
- ]
291
- }
292
- ),
293
- /* @__PURE__ */ jsxRuntime.jsxs(
294
- recharts.YAxis,
295
- {
296
- yAxisId: "left",
297
- orientation: "left",
298
- tick: { transform: "translate(-10, 0)", fontSize: 12, fill: "currentColor" },
299
- hide: !withYAxis,
300
- ...sharedYAxisProps,
301
- ...yAxisProps,
302
- children: [
303
- yAxisLabel && /* @__PURE__ */ jsxRuntime.jsx(
304
- recharts.Label,
305
- {
306
- position: "insideLeft",
307
- angle: -90,
308
- textAnchor: "middle",
309
- fontSize: 12,
310
- offset: -5,
311
- ...getStyles("axisLabel"),
312
- children: yAxisLabel
313
- }
314
- ),
315
- yAxisProps?.children
316
- ]
317
- }
318
- ),
319
- /* @__PURE__ */ jsxRuntime.jsxs(
320
- recharts.YAxis,
226
+ data,
227
+ stackOffset: type === "percent" ? "expand" : void 0,
228
+ layout: orientation,
229
+ margin: {
230
+ bottom: xAxisLabel ? 30 : void 0,
231
+ left: yAxisLabel ? 10 : void 0,
232
+ right: yAxisLabel ? 5 : void 0
233
+ },
234
+ ...areaChartProps,
235
+ children: [
236
+ referenceLinesItems,
237
+ withLegend && /* @__PURE__ */ jsxRuntime.jsx(
238
+ recharts.Legend,
239
+ {
240
+ verticalAlign: "top",
241
+ content: (payload) => /* @__PURE__ */ jsxRuntime.jsx(
242
+ ChartLegend.ChartLegend,
321
243
  {
322
- yAxisId: "right",
323
- orientation: "right",
324
- tick: { transform: "translate(10, 0)", fontSize: 12, fill: "currentColor" },
325
- hide: !withRightYAxis,
326
- ...sharedYAxisProps,
327
- ...rightYAxisProps,
328
- children: [
329
- rightYAxisLabel && /* @__PURE__ */ jsxRuntime.jsx(
330
- recharts.Label,
331
- {
332
- position: "insideRight",
333
- angle: 90,
334
- textAnchor: "middle",
335
- fontSize: 12,
336
- offset: -5,
337
- ...getStyles("axisLabel"),
338
- children: rightYAxisLabel
339
- }
340
- ),
341
- yAxisProps?.children
342
- ]
244
+ payload: payload.payload,
245
+ onHighlight: setHighlightedArea,
246
+ legendPosition: legendProps?.verticalAlign || "top",
247
+ classNames: resolvedClassNames,
248
+ styles: resolvedStyles,
249
+ series,
250
+ attributes
343
251
  }
344
252
  ),
345
- withTooltip && /* @__PURE__ */ jsxRuntime.jsx(
346
- recharts.Tooltip,
253
+ ...legendProps
254
+ }
255
+ ),
256
+ /* @__PURE__ */ jsxRuntime.jsx(
257
+ recharts.CartesianGrid,
258
+ {
259
+ strokeDasharray,
260
+ vertical: gridAxis === "y" || gridAxis === "xy",
261
+ horizontal: gridAxis === "x" || gridAxis === "xy",
262
+ ...getStyles("grid"),
263
+ ...gridProps
264
+ }
265
+ ),
266
+ /* @__PURE__ */ jsxRuntime.jsxs(
267
+ recharts.XAxis,
268
+ {
269
+ hide: !withXAxis,
270
+ ...orientation === "vertical" ? { type: "number" } : { dataKey },
271
+ tick: { transform: "translate(0, 10)", fontSize: 12, fill: "currentColor" },
272
+ stroke: "",
273
+ interval: "preserveStartEnd",
274
+ tickLine: withXTickLine ? { stroke: "currentColor" } : false,
275
+ minTickGap: 5,
276
+ tickFormatter: orientation === "vertical" ? tickFormatter : void 0,
277
+ ...getStyles("axis"),
278
+ ...xAxisProps,
279
+ children: [
280
+ xAxisLabel && /* @__PURE__ */ jsxRuntime.jsx(recharts.Label, { position: "insideBottom", offset: -20, fontSize: 12, ...getStyles("axisLabel"), children: xAxisLabel }),
281
+ xAxisProps?.children
282
+ ]
283
+ }
284
+ ),
285
+ /* @__PURE__ */ jsxRuntime.jsxs(
286
+ recharts.YAxis,
287
+ {
288
+ orientation: "left",
289
+ tick: { transform: "translate(-10, 0)", fontSize: 12, fill: "currentColor" },
290
+ hide: !withYAxis,
291
+ ...sharedYAxisProps,
292
+ ...yAxisProps,
293
+ children: [
294
+ yAxisLabel && /* @__PURE__ */ jsxRuntime.jsx(
295
+ recharts.Label,
296
+ {
297
+ position: "insideLeft",
298
+ angle: -90,
299
+ textAnchor: "middle",
300
+ fontSize: 12,
301
+ offset: -5,
302
+ ...getStyles("axisLabel"),
303
+ children: yAxisLabel
304
+ }
305
+ ),
306
+ yAxisProps?.children
307
+ ]
308
+ }
309
+ ),
310
+ /* @__PURE__ */ jsxRuntime.jsxs(
311
+ recharts.YAxis,
312
+ {
313
+ yAxisId: "right",
314
+ orientation: "right",
315
+ tick: { transform: "translate(10, 0)", fontSize: 12, fill: "currentColor" },
316
+ hide: !withRightYAxis,
317
+ ...sharedYAxisProps,
318
+ ...rightYAxisProps,
319
+ children: [
320
+ rightYAxisLabel && /* @__PURE__ */ jsxRuntime.jsx(
321
+ recharts.Label,
322
+ {
323
+ position: "insideRight",
324
+ angle: 90,
325
+ textAnchor: "middle",
326
+ fontSize: 12,
327
+ offset: -5,
328
+ ...getStyles("axisLabel"),
329
+ children: rightYAxisLabel
330
+ }
331
+ ),
332
+ yAxisProps?.children
333
+ ]
334
+ }
335
+ ),
336
+ withTooltip && /* @__PURE__ */ jsxRuntime.jsx(
337
+ recharts.Tooltip,
338
+ {
339
+ animationDuration: tooltipAnimationDuration,
340
+ isAnimationActive,
341
+ position: orientation === "vertical" ? {} : { y: 0 },
342
+ cursor: {
343
+ stroke: "var(--chart-grid-color)",
344
+ strokeWidth: 1,
345
+ strokeDasharray
346
+ },
347
+ content: ({ label, payload, labelFormatter }) => /* @__PURE__ */ jsxRuntime.jsx(
348
+ ChartTooltip.ChartTooltip,
347
349
  {
348
- animationDuration: tooltipAnimationDuration,
349
- isAnimationActive,
350
- position: orientation === "vertical" ? {} : { y: 0 },
351
- cursor: {
352
- stroke: "var(--chart-grid-color)",
353
- strokeWidth: 1,
354
- strokeDasharray
355
- },
356
- content: ({ label, payload, labelFormatter }) => /* @__PURE__ */ jsxRuntime.jsx(
357
- ChartTooltip.ChartTooltip,
358
- {
359
- label: labelFormatter && payload ? labelFormatter(label, payload) : label,
360
- payload,
361
- unit,
362
- classNames: resolvedClassNames,
363
- styles: resolvedStyles,
364
- series,
365
- valueFormatter,
366
- attributes
367
- }
368
- ),
369
- ...tooltipProps
350
+ label: labelFormatter && payload ? labelFormatter(label, payload) : label,
351
+ payload,
352
+ unit,
353
+ classNames: resolvedClassNames,
354
+ styles: resolvedStyles,
355
+ series,
356
+ valueFormatter,
357
+ attributes
370
358
  }
371
359
  ),
372
- type === "split" && /* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsx(
373
- AreaSplit.AreaSplit,
374
- {
375
- colors: splitColors,
376
- id: splitId,
377
- offset: splitOffset ?? getSplitOffset.getDefaultSplitOffset({ data, series }),
378
- fillOpacity
379
- }
380
- ) }),
381
- areas,
382
- withDots && dotsAreas,
383
- children
384
- ]
385
- }
386
- ) })
360
+ ...tooltipProps
361
+ }
362
+ ),
363
+ type === "split" && /* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsx(
364
+ AreaSplit.AreaSplit,
365
+ {
366
+ colors: splitColors,
367
+ id: splitId,
368
+ offset: splitOffset ?? getSplitOffset.getDefaultSplitOffset({ data, series }),
369
+ fillOpacity
370
+ }
371
+ ) }),
372
+ areas,
373
+ withDots && dotsAreas,
374
+ children
375
+ ]
387
376
  }
388
- );
377
+ ) }) });
389
378
  });
390
379
  AreaChart.classes = gridChart_module;
380
+ AreaChart.varsResolver = varsResolver;
391
381
  AreaChart.displayName = "@mantine/charts/AreaChart";
392
382
 
393
383
  exports.AreaChart = AreaChart;