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