@mui/x-charts 8.2.0 → 8.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 (134) hide show
  1. package/CHANGELOG.md +107 -0
  2. package/ChartsClipPath/ChartsClipPath.d.ts +8 -0
  3. package/ChartsClipPath/ChartsClipPath.js +8 -0
  4. package/LineChart/AppearingMask.js +1 -2
  5. package/LineChart/CircleMarkElement.d.ts +10 -0
  6. package/LineChart/CircleMarkElement.js +5 -15
  7. package/LineChart/MarkElement.d.ts +10 -0
  8. package/LineChart/MarkElement.js +15 -15
  9. package/LineChart/MarkPlot.js +18 -2
  10. package/PieChart/PieArcLabel.js +3 -4
  11. package/SparkLineChart/SparkLineChart.d.ts +19 -0
  12. package/SparkLineChart/SparkLineChart.js +52 -15
  13. package/Toolbar/Toolbar.d.ts +5 -0
  14. package/Toolbar/Toolbar.js +34 -0
  15. package/Toolbar/ToolbarButton.d.ts +5 -0
  16. package/Toolbar/ToolbarButton.js +27 -0
  17. package/Toolbar/index.d.ts +2 -0
  18. package/Toolbar/index.js +27 -0
  19. package/esm/ChartsClipPath/ChartsClipPath.d.ts +8 -0
  20. package/esm/ChartsClipPath/ChartsClipPath.js +8 -0
  21. package/esm/LineChart/AppearingMask.js +1 -2
  22. package/esm/LineChart/CircleMarkElement.d.ts +10 -0
  23. package/esm/LineChart/CircleMarkElement.js +5 -15
  24. package/esm/LineChart/MarkElement.d.ts +10 -0
  25. package/esm/LineChart/MarkElement.js +15 -15
  26. package/esm/LineChart/MarkPlot.js +19 -3
  27. package/esm/PieChart/PieArcLabel.js +3 -4
  28. package/esm/SparkLineChart/SparkLineChart.d.ts +19 -0
  29. package/esm/SparkLineChart/SparkLineChart.js +52 -15
  30. package/esm/Toolbar/Toolbar.d.ts +5 -0
  31. package/esm/Toolbar/Toolbar.js +27 -0
  32. package/esm/Toolbar/ToolbarButton.d.ts +5 -0
  33. package/esm/Toolbar/ToolbarButton.js +20 -0
  34. package/esm/Toolbar/index.d.ts +2 -0
  35. package/esm/Toolbar/index.js +2 -0
  36. package/esm/hooks/animation/useAnimatePieArcLabel.d.ts +10 -1
  37. package/esm/hooks/animation/useAnimatePieArcLabel.js +4 -4
  38. package/esm/index.d.ts +2 -1
  39. package/esm/index.js +3 -2
  40. package/esm/internals/constants.d.ts +4 -0
  41. package/esm/internals/constants.js +5 -0
  42. package/esm/internals/createSvgIcon.d.ts +3 -0
  43. package/esm/internals/createSvgIcon.js +2 -0
  44. package/esm/internals/index.d.ts +4 -1
  45. package/esm/internals/index.js +4 -1
  46. package/esm/internals/material/index.d.ts +4 -0
  47. package/esm/internals/material/index.js +7 -0
  48. package/esm/internals/plugins/corePlugins/corePlugins.d.ts +6 -4
  49. package/esm/internals/plugins/corePlugins/corePlugins.js +1 -1
  50. package/esm/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.selectors.d.ts +35 -0
  51. package/esm/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.selectors.js +1 -1
  52. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.d.ts +3 -4
  53. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.d.ts +10 -2
  54. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.js +16 -4
  55. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.js +7 -2
  56. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisSize.selectors.js +5 -4
  57. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts +2 -1
  58. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +159 -0
  59. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +2 -1
  60. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/zoom.types.d.ts +10 -0
  61. package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.js +28 -13
  62. package/esm/internals/plugins/models/helpers.d.ts +0 -1
  63. package/esm/internals/plugins/models/plugin.d.ts +0 -30
  64. package/esm/internals/store/useCharts.d.ts +1 -1
  65. package/esm/internals/store/useCharts.js +11 -12
  66. package/esm/locales/enUS.d.ts +2 -0
  67. package/esm/locales/enUS.js +3 -1
  68. package/esm/locales/frFR.d.ts +2 -0
  69. package/esm/locales/frFR.js +2 -0
  70. package/esm/locales/utils/chartsLocaleTextApi.d.ts +8 -0
  71. package/esm/locales/utils/getChartsLocalization.d.ts +2 -0
  72. package/esm/models/axis.d.ts +10 -3
  73. package/esm/models/axis.js +4 -0
  74. package/esm/models/index.d.ts +2 -1
  75. package/esm/models/slots/chartsBaseSlotProps.d.ts +13 -0
  76. package/esm/models/slots/chartsBaseSlotProps.js +1 -0
  77. package/esm/models/slots/chartsBaseSlots.d.ts +5 -0
  78. package/esm/models/slots/chartsBaseSlots.js +1 -0
  79. package/esm/models/slots/chartsIconSlots.d.ts +1 -0
  80. package/esm/models/slots/chartsIconSlots.js +1 -0
  81. package/esm/models/slots/index.d.ts +3 -0
  82. package/esm/models/slots/index.js +3 -0
  83. package/hooks/animation/useAnimatePieArcLabel.d.ts +10 -1
  84. package/hooks/animation/useAnimatePieArcLabel.js +4 -4
  85. package/index.d.ts +2 -1
  86. package/index.js +12 -1
  87. package/internals/constants.d.ts +4 -0
  88. package/internals/constants.js +11 -0
  89. package/internals/createSvgIcon.d.ts +3 -0
  90. package/internals/createSvgIcon.js +8 -0
  91. package/internals/index.d.ts +4 -1
  92. package/internals/index.js +36 -0
  93. package/internals/material/index.d.ts +4 -0
  94. package/internals/material/index.js +14 -0
  95. package/internals/plugins/corePlugins/corePlugins.d.ts +6 -4
  96. package/internals/plugins/corePlugins/corePlugins.js +1 -1
  97. package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.selectors.d.ts +35 -0
  98. package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.selectors.js +2 -2
  99. package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.d.ts +3 -4
  100. package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.d.ts +10 -2
  101. package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.js +21 -9
  102. package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.js +7 -2
  103. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisSize.selectors.js +5 -4
  104. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts +2 -1
  105. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +159 -0
  106. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +3 -2
  107. package/internals/plugins/featurePlugins/useChartCartesianAxis/zoom.types.d.ts +10 -0
  108. package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.js +28 -13
  109. package/internals/plugins/models/helpers.d.ts +0 -1
  110. package/internals/plugins/models/plugin.d.ts +0 -30
  111. package/internals/store/useCharts.d.ts +1 -1
  112. package/internals/store/useCharts.js +11 -12
  113. package/locales/enUS.d.ts +2 -0
  114. package/locales/enUS.js +3 -1
  115. package/locales/frFR.d.ts +2 -0
  116. package/locales/frFR.js +2 -0
  117. package/locales/utils/chartsLocaleTextApi.d.ts +8 -0
  118. package/locales/utils/getChartsLocalization.d.ts +2 -0
  119. package/models/axis.d.ts +10 -3
  120. package/models/axis.js +4 -0
  121. package/models/index.d.ts +2 -1
  122. package/models/slots/chartsBaseSlotProps.d.ts +13 -0
  123. package/models/slots/chartsBaseSlotProps.js +5 -0
  124. package/models/slots/chartsBaseSlots.d.ts +5 -0
  125. package/models/slots/chartsBaseSlots.js +5 -0
  126. package/models/slots/chartsIconSlots.d.ts +1 -0
  127. package/models/slots/chartsIconSlots.js +5 -0
  128. package/models/slots/index.d.ts +3 -0
  129. package/models/slots/index.js +38 -0
  130. package/package.json +5 -5
  131. package/esm/internals/store/useChartModels.d.ts +0 -7
  132. package/esm/internals/store/useChartModels.js +0 -64
  133. package/internals/store/useChartModels.d.ts +0 -7
  134. package/internals/store/useChartModels.js +0 -73
@@ -42,7 +42,15 @@ process.env.NODE_ENV !== "production" ? ChartsClipPath.propTypes = {
42
42
  // | These PropTypes are generated from the TypeScript type definitions |
43
43
  // | To update them edit the TypeScript types and run "pnpm proptypes" |
44
44
  // ----------------------------------------------------------------------
45
+ /**
46
+ * The id of the clip path.
47
+ */
45
48
  id: PropTypes.string.isRequired,
49
+ /**
50
+ * Offset, in pixels, of the clip path rectangle from the drawing area.
51
+ *
52
+ * A positive value will move the rectangle outside the drawing area.
53
+ */
46
54
  offset: PropTypes.shape({
47
55
  bottom: PropTypes.number,
48
56
  left: PropTypes.number,
@@ -3,7 +3,6 @@
3
3
  import * as React from 'react';
4
4
  import { styled } from '@mui/material/styles';
5
5
  import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
6
- import clsx from 'clsx';
7
6
  import { ANIMATION_DURATION_MS, ANIMATION_TIMING_FUNCTION } from "../internals/animation/animation.js";
8
7
  import { cleanId } from "../internals/cleanId.js";
9
8
  import { useChartId, useDrawingArea } from "../hooks/index.js";
@@ -34,7 +33,7 @@ export function AppearingMask(props) {
34
33
  children: [/*#__PURE__*/_jsx("clipPath", {
35
34
  id: clipId,
36
35
  children: /*#__PURE__*/_jsx(AnimatedRect, {
37
- className: clsx(!props.skipAnimation && appearingMaskClasses.animate),
36
+ className: props.skipAnimation ? '' : appearingMaskClasses.animate,
38
37
  x: 0,
39
38
  y: 0,
40
39
  width: drawingArea.left + drawingArea.width + drawingArea.right,
@@ -10,6 +10,16 @@ export type CircleMarkElementProps = Omit<MarkElementOwnerState, 'isFaded' | 'is
10
10
  * The index to the element in the series' data array.
11
11
  */
12
12
  dataIndex: number;
13
+ /**
14
+ * If `true`, the marker is faded.
15
+ * @default false
16
+ */
17
+ isFaded?: boolean;
18
+ /**
19
+ * If `true`, the marker is highlighted.
20
+ * @default false
21
+ */
22
+ isHighlighted?: boolean;
13
23
  };
14
24
  /**
15
25
  * The line mark element that only render circle for performance improvement.
@@ -2,17 +2,13 @@
2
2
 
3
3
  import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
5
- const _excluded = ["x", "y", "id", "classes", "color", "dataIndex", "onClick", "skipAnimation"];
5
+ const _excluded = ["x", "y", "id", "classes", "color", "dataIndex", "onClick", "skipAnimation", "isFaded", "isHighlighted"];
6
6
  import * as React from 'react';
7
7
  import PropTypes from 'prop-types';
8
8
  import { styled, useTheme } from '@mui/material/styles';
9
9
  import { ANIMATION_DURATION_MS, ANIMATION_TIMING_FUNCTION } from "../internals/animation/animation.js";
10
10
  import { useInteractionItemProps } from "../hooks/useInteractionItemProps.js";
11
- import { useItemHighlighted } from "../hooks/useItemHighlighted.js";
12
11
  import { markElementClasses, useUtilityClasses } from "./markElementClasses.js";
13
- import { useSelector } from "../internals/store/useSelector.js";
14
- import { selectorChartsInteractionXAxisIndex } from "../internals/plugins/featurePlugins/useChartCartesianAxis/index.js";
15
- import { useStore } from "../internals/store/useStore.js";
16
12
  import { jsx as _jsx } from "react/jsx-runtime";
17
13
  const Circle = styled('circle')({
18
14
  [`&.${markElementClasses.animate}`]: {
@@ -43,7 +39,9 @@ function CircleMarkElement(props) {
43
39
  color,
44
40
  dataIndex,
45
41
  onClick,
46
- skipAnimation
42
+ skipAnimation,
43
+ isFaded = false,
44
+ isHighlighted = false
47
45
  } = props,
48
46
  other = _objectWithoutPropertiesLoose(props, _excluded);
49
47
  const theme = useTheme();
@@ -52,18 +50,10 @@ function CircleMarkElement(props) {
52
50
  seriesId: id,
53
51
  dataIndex
54
52
  });
55
- const {
56
- isFaded,
57
- isHighlighted
58
- } = useItemHighlighted({
59
- seriesId: id
60
- });
61
- const store = useStore();
62
- const xAxisInteractionIndex = useSelector(store, selectorChartsInteractionXAxisIndex);
63
53
  const ownerState = {
64
54
  id,
65
55
  classes: innerClasses,
66
- isHighlighted: xAxisInteractionIndex === dataIndex || isHighlighted,
56
+ isHighlighted,
67
57
  isFaded,
68
58
  color,
69
59
  skipAnimation
@@ -14,6 +14,16 @@ export type MarkElementProps = Omit<MarkElementOwnerState, 'isFaded' | 'isHighli
14
14
  * The index to the element in the series' data array.
15
15
  */
16
16
  dataIndex: number;
17
+ /**
18
+ * If `true`, the marker is faded.
19
+ * @default false
20
+ */
21
+ isFaded?: boolean;
22
+ /**
23
+ * If `true`, the marker is highlighted.
24
+ * @default false
25
+ */
26
+ isHighlighted?: boolean;
17
27
  };
18
28
  /**
19
29
  * Demos:
@@ -2,7 +2,7 @@
2
2
 
3
3
  import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
5
- const _excluded = ["x", "y", "id", "classes", "color", "shape", "dataIndex", "onClick", "skipAnimation"];
5
+ const _excluded = ["x", "y", "id", "classes", "color", "shape", "dataIndex", "onClick", "skipAnimation", "isFaded", "isHighlighted"];
6
6
  import * as React from 'react';
7
7
  import PropTypes from 'prop-types';
8
8
  import { styled } from '@mui/material/styles';
@@ -10,11 +10,7 @@ import { symbol as d3Symbol, symbolsFill as d3SymbolsFill } from '@mui/x-charts-
10
10
  import { ANIMATION_DURATION_MS, ANIMATION_TIMING_FUNCTION } from "../internals/animation/animation.js";
11
11
  import { getSymbol } from "../internals/getSymbol.js";
12
12
  import { useInteractionItemProps } from "../hooks/useInteractionItemProps.js";
13
- import { useItemHighlighted } from "../hooks/useItemHighlighted.js";
14
- import { selectorChartsInteractionXAxisIndex } from "../internals/plugins/featurePlugins/useChartCartesianAxis/index.js";
15
13
  import { markElementClasses, useUtilityClasses } from "./markElementClasses.js";
16
- import { useSelector } from "../internals/store/useSelector.js";
17
- import { useStore } from "../internals/store/useStore.js";
18
14
  import { jsx as _jsx } from "react/jsx-runtime";
19
15
  const MarkElementPath = styled('path', {
20
16
  name: 'MuiMarkElement',
@@ -52,7 +48,9 @@ function MarkElement(props) {
52
48
  shape,
53
49
  dataIndex,
54
50
  onClick,
55
- skipAnimation
51
+ skipAnimation,
52
+ isFaded = false,
53
+ isHighlighted = false
56
54
  } = props,
57
55
  other = _objectWithoutPropertiesLoose(props, _excluded);
58
56
  const interactionProps = useInteractionItemProps({
@@ -60,18 +58,10 @@ function MarkElement(props) {
60
58
  seriesId: id,
61
59
  dataIndex
62
60
  });
63
- const {
64
- isFaded,
65
- isHighlighted
66
- } = useItemHighlighted({
67
- seriesId: id
68
- });
69
- const store = useStore();
70
- const xAxisInteractionIndex = useSelector(store, selectorChartsInteractionXAxisIndex);
71
61
  const ownerState = {
72
62
  id,
73
63
  classes: innerClasses,
74
- isHighlighted: xAxisInteractionIndex === dataIndex || isHighlighted,
64
+ isHighlighted,
75
65
  isFaded,
76
66
  color,
77
67
  skipAnimation
@@ -100,6 +90,16 @@ process.env.NODE_ENV !== "production" ? MarkElement.propTypes = {
100
90
  */
101
91
  dataIndex: PropTypes.number.isRequired,
102
92
  id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
93
+ /**
94
+ * If `true`, the marker is faded.
95
+ * @default false
96
+ */
97
+ isFaded: PropTypes.bool,
98
+ /**
99
+ * If `true`, the marker is highlighted.
100
+ * @default false
101
+ */
102
+ isHighlighted: PropTypes.bool,
103
103
  /**
104
104
  * The shape of the marker.
105
105
  */
@@ -5,6 +5,7 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
5
5
  const _excluded = ["slots", "slotProps", "skipAnimation", "onItemClick"];
6
6
  import PropTypes from 'prop-types';
7
7
  import * as React from 'react';
8
+ import { selectorChartsInteractionXAxisIndex } from "../internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.js";
8
9
  import { DEFAULT_X_AXIS_KEY } from "../constants/index.js";
9
10
  import { useSkipAnimation } from "../hooks/useSkipAnimation.js";
10
11
  import { useChartId } from "../hooks/useChartId.js";
@@ -15,8 +16,9 @@ import { CircleMarkElement } from "./CircleMarkElement.js";
15
16
  import getColor from "./seriesConfig/getColor.js";
16
17
  import { MarkElement } from "./MarkElement.js";
17
18
  import { useChartContext } from "../context/ChartProvider/index.js";
18
- import { useXAxes, useYAxes } from "../hooks/index.js";
19
+ import { useItemHighlightedGetter, useXAxes, useYAxes } from "../hooks/index.js";
19
20
  import { useInternalIsZoomInteracting } from "../internals/plugins/featurePlugins/useChartCartesianAxis/useInternalIsZoomInteracting.js";
21
+ import { useSelector } from "../internals/store/useSelector.js";
20
22
  import { jsx as _jsx } from "react/jsx-runtime";
21
23
  /**
22
24
  * Demos:
@@ -49,8 +51,14 @@ function MarkPlot(props) {
49
51
  } = useYAxes();
50
52
  const chartId = useChartId();
51
53
  const {
52
- instance
54
+ instance,
55
+ store
53
56
  } = useChartContext();
57
+ const {
58
+ isFaded,
59
+ isHighlighted
60
+ } = useItemHighlightedGetter();
61
+ const xAxisInteractionIndex = useSelector(store, selectorChartsInteractionXAxisIndex);
54
62
  if (seriesData === undefined) {
55
63
  return null;
56
64
  }
@@ -86,6 +94,12 @@ function MarkPlot(props) {
86
94
 
87
95
  const colorGetter = getColor(series[seriesId], xAxis[xAxisId], yAxis[yAxisId]);
88
96
  const Mark = slots?.mark ?? (shape === 'circle' ? CircleMarkElement : MarkElement);
97
+ const isSeriesHighlighted = isHighlighted({
98
+ seriesId
99
+ });
100
+ const isSeriesFaded = !isSeriesHighlighted && isFaded({
101
+ seriesId
102
+ });
89
103
  return /*#__PURE__*/_jsx("g", {
90
104
  clipPath: `url(#${clipId})`,
91
105
  children: xData?.map((x, index) => {
@@ -143,7 +157,9 @@ function MarkPlot(props) {
143
157
  type: 'line',
144
158
  seriesId,
145
159
  dataIndex: index
146
- }))
160
+ })),
161
+ isHighlighted: xAxisInteractionIndex === index || isSeriesHighlighted,
162
+ isFaded: isSeriesFaded
147
163
  }, slotProps?.mark), `${seriesId}-${index}`);
148
164
  })
149
165
  }, seriesId);
@@ -59,8 +59,7 @@ const PieArcLabel = /*#__PURE__*/React.forwardRef(function PieArcLabel(props, re
59
59
  startAngle,
60
60
  endAngle,
61
61
  paddingAngle,
62
- innerRadius,
63
- outerRadius,
62
+ arcLabelRadius,
64
63
  cornerRadius,
65
64
  formattedArcLabel,
66
65
  isHighlighted,
@@ -81,8 +80,8 @@ const PieArcLabel = /*#__PURE__*/React.forwardRef(function PieArcLabel(props, re
81
80
  cornerRadius,
82
81
  startAngle,
83
82
  endAngle,
84
- innerRadius,
85
- outerRadius,
83
+ innerRadius: arcLabelRadius,
84
+ outerRadius: arcLabelRadius,
86
85
  paddingAngle,
87
86
  skipAnimation,
88
87
  ref
@@ -86,6 +86,25 @@ export interface SparkLineChartProps extends Omit<ChartContainerProps, 'series'
86
86
  * @default rainbowSurgePalette[0]
87
87
  */
88
88
  color?: ChartsColor;
89
+ /**
90
+ * When `true`, the chart's drawing area will not be clipped and elements within can visually overflow the chart.
91
+ *
92
+ * @default false
93
+ */
94
+ disableClipping?: boolean;
95
+ /**
96
+ * The clipped area offset in pixels.
97
+ *
98
+ * This prevents partial clipping of lines when they are drawn on the edge of the drawing area.
99
+ *
100
+ * @default { top: 1, right: 1, bottom: 1, left: 1 }
101
+ */
102
+ clipAreaOffset?: {
103
+ top?: number;
104
+ right?: number;
105
+ bottom?: number;
106
+ left?: number;
107
+ };
89
108
  }
90
109
  /**
91
110
  * Demos:
@@ -2,9 +2,11 @@
2
2
 
3
3
  import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
5
- const _excluded = ["xAxis", "yAxis", "width", "height", "margin", "color", "sx", "showTooltip", "showHighlight", "axisHighlight", "children", "slots", "slotProps", "data", "plotType", "valueFormatter", "area", "curve", "className"];
5
+ const _excluded = ["xAxis", "yAxis", "width", "height", "margin", "color", "sx", "showTooltip", "showHighlight", "axisHighlight", "children", "slots", "slotProps", "data", "plotType", "valueFormatter", "area", "curve", "className", "disableClipping", "clipAreaOffset"];
6
6
  import * as React from 'react';
7
7
  import PropTypes from 'prop-types';
8
+ import useId from '@mui/utils/useId';
9
+ import { ChartsClipPath } from "../ChartsClipPath/index.js";
8
10
  import { BarPlot } from "../BarChart/index.js";
9
11
  import { LinePlot, AreaPlot, LineHighlightPlot } from "../LineChart/index.js";
10
12
  import { ChartContainer } from "../ChartContainer/index.js";
@@ -43,9 +45,19 @@ const SparkLineChart = /*#__PURE__*/React.forwardRef(function SparkLineChart(pro
43
45
  valueFormatter = value => value === null ? '' : value.toString(),
44
46
  area,
45
47
  curve = 'linear',
46
- className
48
+ className,
49
+ disableClipping,
50
+ clipAreaOffset
47
51
  } = props,
48
52
  other = _objectWithoutPropertiesLoose(props, _excluded);
53
+ const id = useId();
54
+ const clipPathId = `${id}-clip-path`;
55
+ const clipPathOffset = {
56
+ top: clipAreaOffset?.top ?? 1,
57
+ right: clipAreaOffset?.right ?? 1,
58
+ bottom: clipAreaOffset?.bottom ?? 1,
59
+ left: clipAreaOffset?.left ?? 1
60
+ };
49
61
  const defaultXHighlight = showHighlight && plotType === 'bar' ? {
50
62
  x: 'band'
51
63
  } : {
@@ -92,23 +104,29 @@ const SparkLineChart = /*#__PURE__*/React.forwardRef(function SparkLineChart(pro
92
104
  colors: colors,
93
105
  sx: sx,
94
106
  disableAxisListener: (!showTooltip || slotProps?.tooltip?.trigger !== 'axis') && axisHighlight?.x === 'none' && axisHighlight?.y === 'none',
95
- children: [plotType === 'bar' && /*#__PURE__*/_jsx(BarPlot, {
96
- skipAnimation: true,
97
- slots: slots,
98
- slotProps: slotProps
99
- }), plotType === 'line' && /*#__PURE__*/_jsxs(React.Fragment, {
100
- children: [/*#__PURE__*/_jsx(AreaPlot, {
101
- skipAnimation: true,
102
- slots: slots,
103
- slotProps: slotProps
104
- }), /*#__PURE__*/_jsx(LinePlot, {
107
+ children: [/*#__PURE__*/_jsxs("g", {
108
+ clipPath: `url(#${clipPathId})`,
109
+ children: [plotType === 'bar' && /*#__PURE__*/_jsx(BarPlot, {
105
110
  skipAnimation: true,
106
111
  slots: slots,
107
112
  slotProps: slotProps
108
- }), /*#__PURE__*/_jsx(LineHighlightPlot, {
109
- slots: slots,
110
- slotProps: slotProps
113
+ }), plotType === 'line' && /*#__PURE__*/_jsxs(React.Fragment, {
114
+ children: [/*#__PURE__*/_jsx(AreaPlot, {
115
+ skipAnimation: true,
116
+ slots: slots,
117
+ slotProps: slotProps
118
+ }), /*#__PURE__*/_jsx(LinePlot, {
119
+ skipAnimation: true,
120
+ slots: slots,
121
+ slotProps: slotProps
122
+ })]
111
123
  })]
124
+ }), plotType === 'line' && /*#__PURE__*/_jsx(LineHighlightPlot, {
125
+ slots: slots,
126
+ slotProps: slotProps
127
+ }), disableClipping ? null : /*#__PURE__*/_jsx(ChartsClipPath, {
128
+ id: clipPathId,
129
+ offset: clipPathOffset
112
130
  }), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlight)), showTooltip && /*#__PURE__*/_jsx(Tooltip, _extends({}, props.slotProps?.tooltip)), children]
113
131
  }));
114
132
  });
@@ -132,6 +150,19 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
132
150
  }),
133
151
  children: PropTypes.node,
134
152
  className: PropTypes.string,
153
+ /**
154
+ * The clipped area offset in pixels.
155
+ *
156
+ * This prevents partial clipping of lines when they are drawn on the edge of the drawing area.
157
+ *
158
+ * @default { top: 1, right: 1, bottom: 1, left: 1 }
159
+ */
160
+ clipAreaOffset: PropTypes.shape({
161
+ bottom: PropTypes.number,
162
+ left: PropTypes.number,
163
+ right: PropTypes.number,
164
+ top: PropTypes.number
165
+ }),
135
166
  /**
136
167
  * Color used to colorize the sparkline.
137
168
  * @default rainbowSurgePalette[0]
@@ -156,6 +187,12 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
156
187
  * @default false
157
188
  */
158
189
  disableAxisListener: PropTypes.bool,
190
+ /**
191
+ * When `true`, the chart's drawing area will not be clipped and elements within can visually overflow the chart.
192
+ *
193
+ * @default false
194
+ */
195
+ disableClipping: PropTypes.bool,
159
196
  /**
160
197
  * If true, the voronoi interaction are ignored.
161
198
  */
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ export interface ToolbarProps extends React.PropsWithChildren {}
3
+ export declare function Toolbar({
4
+ children
5
+ }: ToolbarProps): React.JSX.Element;
@@ -0,0 +1,27 @@
1
+ import * as React from 'react';
2
+ import { styled } from '@mui/material/styles';
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ const ToolbarRoot = styled('div', {
5
+ name: 'MuiChartsToolbar',
6
+ slot: 'Root'
7
+ })(({
8
+ theme
9
+ }) => ({
10
+ flex: 0,
11
+ display: 'flex',
12
+ alignItems: 'center',
13
+ justifyContent: 'end',
14
+ gap: theme.spacing(0.25),
15
+ padding: theme.spacing(0.5),
16
+ minHeight: 44,
17
+ boxSizing: 'border-box',
18
+ border: `1px solid ${(theme.vars || theme).palette.divider}`,
19
+ borderRadius: 4
20
+ }));
21
+ export function Toolbar({
22
+ children
23
+ }) {
24
+ return /*#__PURE__*/_jsx(ToolbarRoot, {
25
+ children: children
26
+ });
27
+ }
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ import { ChartBaseIconButtonProps } from "../models/slots/chartsBaseSlotProps.js";
3
+ export interface ToolbarButtonProps extends ChartBaseIconButtonProps {}
4
+ declare const ToolbarButton: React.ForwardRefExoticComponent<Omit<ToolbarButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
5
+ export { ToolbarButton };
@@ -0,0 +1,20 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import PropTypes from 'prop-types';
3
+ import * as React from 'react';
4
+ import { defaultSlotsMaterial } from "../internals/material/index.js";
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ const ToolbarButton = /*#__PURE__*/React.forwardRef(function ToolbarButton(props, ref) {
7
+ const IconButton = defaultSlotsMaterial.baseIconButton;
8
+ return /*#__PURE__*/_jsx(IconButton, _extends({
9
+ ref: ref
10
+ }, props));
11
+ });
12
+ process.env.NODE_ENV !== "production" ? ToolbarButton.propTypes = {
13
+ // ----------------------------- Warning --------------------------------
14
+ // | These PropTypes are generated from the TypeScript type definitions |
15
+ // | To update them edit the TypeScript types and run "pnpm proptypes" |
16
+ // ----------------------------------------------------------------------
17
+ className: PropTypes.string,
18
+ style: PropTypes.object
19
+ } : void 0;
20
+ export { ToolbarButton };
@@ -0,0 +1,2 @@
1
+ export * from "./Toolbar.js";
2
+ export * from "./ToolbarButton.js";
@@ -0,0 +1,2 @@
1
+ export * from "./Toolbar.js";
2
+ export * from "./ToolbarButton.js";
@@ -1,7 +1,16 @@
1
1
  import * as React from 'react';
2
2
  import type { PieArcLabelProps } from "../../PieChart/index.js";
3
- type UseAnimatePieArcLabelParams = Pick<PieArcLabelProps, 'startAngle' | 'endAngle' | 'cornerRadius' | 'paddingAngle' | 'innerRadius' | 'outerRadius' | 'skipAnimation'> & {
3
+ type UseAnimatePieArcLabelParams = Pick<PieArcLabelProps, 'startAngle' | 'endAngle' | 'cornerRadius' | 'paddingAngle' | 'skipAnimation'> & {
4
4
  ref?: React.Ref<SVGTextElement>;
5
+ arcLabelRadius?: number;
6
+ /**
7
+ * @deprecated Use `arcLabelRadius` instead. This prop will be removed in the next major version.
8
+ */
9
+ innerRadius: PieArcLabelProps['innerRadius'];
10
+ /**
11
+ * @deprecated Use `arcLabelRadius` instead. This prop will be removed in the next major version.
12
+ */
13
+ outerRadius: PieArcLabelProps['outerRadius'];
5
14
  };
6
15
  type UseAnimatePieArcLabelReturn = {
7
16
  ref: React.Ref<SVGTextElement>;
@@ -27,16 +27,16 @@ export function useAnimatePieArcLabel(props) {
27
27
  const initialProps = {
28
28
  startAngle: (props.startAngle + props.endAngle) / 2,
29
29
  endAngle: (props.startAngle + props.endAngle) / 2,
30
- innerRadius: props.innerRadius,
31
- outerRadius: props.outerRadius,
30
+ innerRadius: props.arcLabelRadius ?? props.innerRadius,
31
+ outerRadius: props.arcLabelRadius ?? props.outerRadius,
32
32
  paddingAngle: props.paddingAngle,
33
33
  cornerRadius: props.cornerRadius
34
34
  };
35
35
  return useAnimate({
36
36
  startAngle: props.startAngle,
37
37
  endAngle: props.endAngle,
38
- innerRadius: props.innerRadius,
39
- outerRadius: props.outerRadius,
38
+ innerRadius: props?.arcLabelRadius ?? props.innerRadius,
39
+ outerRadius: props?.arcLabelRadius ?? props.outerRadius,
40
40
  paddingAngle: props.paddingAngle,
41
41
  cornerRadius: props.cornerRadius
42
42
  }, {
package/esm/index.d.ts CHANGED
@@ -24,4 +24,5 @@ export * from "./Gauge/index.js";
24
24
  export * from "./RadarChart/index.js";
25
25
  export * from "./ChartsSurface/index.js";
26
26
  export * from "./ChartContainer/index.js";
27
- export * from "./ChartDataProvider/index.js";
27
+ export * from "./ChartDataProvider/index.js";
28
+ export * from "./Toolbar/index.js";
package/esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-charts v8.2.0
2
+ * @mui/x-charts v8.3.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -31,4 +31,5 @@ export * from "./Gauge/index.js";
31
31
  export * from "./RadarChart/index.js";
32
32
  export * from "./ChartsSurface/index.js";
33
33
  export * from "./ChartContainer/index.js";
34
- export * from "./ChartDataProvider/index.js";
34
+ export * from "./ChartDataProvider/index.js";
35
+ export * from "./Toolbar/index.js";
@@ -0,0 +1,4 @@
1
+ /** Margin in the opposite direction of the axis, i.e., horizontal if the axis is vertical and vice versa. */
2
+ export declare const ZOOM_SLIDER_MARGIN = 4;
3
+ /** Size reserved for the zoom slider. The actual size of the slider might be smaller. */
4
+ export declare const ZOOM_SLIDER_SIZE: number;
@@ -0,0 +1,5 @@
1
+ /** Margin in the opposite direction of the axis, i.e., horizontal if the axis is vertical and vice versa. */
2
+ export const ZOOM_SLIDER_MARGIN = 4;
3
+
4
+ /** Size reserved for the zoom slider. The actual size of the slider might be smaller. */
5
+ export const ZOOM_SLIDER_SIZE = 20 + 2 * ZOOM_SLIDER_MARGIN;
@@ -0,0 +1,3 @@
1
+ import * as React from 'react';
2
+ import { ChartBaseIconProps } from "../models/slots/chartsBaseSlotProps.js";
3
+ export declare const createSvgIcon: (path: React.ReactNode, displayName?: string) => (props: ChartBaseIconProps) => React.ReactNode;
@@ -0,0 +1,2 @@
1
+ import { createSvgIcon as createSvgIconMaterial } from '@mui/material/utils';
2
+ export const createSvgIcon = createSvgIconMaterial;
@@ -44,4 +44,7 @@ export * from "../models/seriesType/config.js";
44
44
  export * from "../models/seriesType/common.js";
45
45
  export * from "../models/z-axis.js";
46
46
  export * from "../models/axis.js";
47
- export * from "./plugins/models/index.js";
47
+ export * from "./plugins/models/index.js";
48
+ export * from "./material/index.js";
49
+ export * from "./createSvgIcon.js";
50
+ export * from "./constants.js";
@@ -58,4 +58,7 @@ export * from "../models/seriesType/config.js";
58
58
  export * from "../models/seriesType/common.js";
59
59
  export * from "../models/z-axis.js";
60
60
  export * from "../models/axis.js";
61
- export * from "./plugins/models/index.js";
61
+ export * from "./plugins/models/index.js";
62
+ export * from "./material/index.js";
63
+ export * from "./createSvgIcon.js";
64
+ export * from "./constants.js";
@@ -0,0 +1,4 @@
1
+ import { ChartsBaseSlots } from "../../models/slots/chartsBaseSlots.js";
2
+ import { ChartsIconSlots } from "../../models/slots/chartsIconSlots.js";
3
+ export type ChartsSlots = ChartsBaseSlots & ChartsIconSlots;
4
+ export declare const defaultSlotsMaterial: ChartsSlots;
@@ -0,0 +1,7 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import IconButton from '@mui/material/IconButton';
3
+ const baseSlots = {
4
+ baseIconButton: IconButton
5
+ };
6
+ const iconSlots = {};
7
+ export const defaultSlotsMaterial = _extends({}, baseSlots, iconSlots);
@@ -1,9 +1,11 @@
1
- import { ConvertPluginsIntoSignatures } from "../models/helpers.js";
2
- import { UseChartIdParameters } from "./useChartId/index.js";
1
+ import { type UseChartAnimationSignature } from "./useChartAnimation/index.js";
2
+ import { type UseChartDimensionsSignature } from "./useChartDimensions/index.js";
3
+ import { type UseChartIdSignature, UseChartIdParameters } from "./useChartId/index.js";
4
+ import { type UseChartSeriesSignature } from "./useChartSeries/index.js";
3
5
  /**
4
6
  * Internal plugins that create the tools used by the other plugins.
5
7
  * These plugins are used by the Charts components.
6
8
  */
7
- export declare const CHART_CORE_PLUGINS: readonly [import("../models/index.js").ChartPlugin<import("./useChartId/index.js").UseChartIdSignature>, import("../models/index.js").ChartPlugin<import("./useChartDimensions/index.js").UseChartDimensionsSignature>, import("../models/index.js").ChartPlugin<import("./useChartSeries/index.js").UseChartSeriesSignature>, import("../models/index.js").ChartPlugin<import("./useChartAnimation/index.js").UseChartAnimationSignature>];
8
- export type ChartCorePluginSignatures = ConvertPluginsIntoSignatures<typeof CHART_CORE_PLUGINS>;
9
+ export declare const CHART_CORE_PLUGINS: readonly [import("../models/index.js").ChartPlugin<UseChartIdSignature>, import("../models/index.js").ChartPlugin<UseChartDimensionsSignature>, import("../models/index.js").ChartPlugin<UseChartSeriesSignature>, import("../models/index.js").ChartPlugin<UseChartAnimationSignature>];
10
+ export type ChartCorePluginSignatures = [UseChartIdSignature, UseChartDimensionsSignature, UseChartSeriesSignature, UseChartAnimationSignature];
9
11
  export interface ChartCorePluginParameters extends UseChartIdParameters {}
@@ -1,5 +1,5 @@
1
1
  import { useChartAnimation } from "./useChartAnimation/index.js";
2
- import { useChartDimensions } from "./useChartDimensions/useChartDimensions.js";
2
+ import { useChartDimensions } from "./useChartDimensions/index.js";
3
3
  import { useChartId } from "./useChartId/index.js";
4
4
  import { useChartSeries } from "./useChartSeries/index.js";
5
5