@mui/x-charts 7.0.0-beta.2 → 7.0.0-beta.3

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 (124) hide show
  1. package/BarChart/BarChart.d.ts +21 -5
  2. package/BarChart/BarChart.js +27 -5
  3. package/CHANGELOG.md +73 -9
  4. package/ChartsGrid/ChartsGrid.d.ts +30 -0
  5. package/ChartsGrid/ChartsGrid.js +128 -0
  6. package/ChartsGrid/chartsGridClasses.d.ts +13 -0
  7. package/ChartsGrid/chartsGridClasses.js +14 -0
  8. package/ChartsGrid/index.d.ts +2 -0
  9. package/ChartsGrid/index.js +27 -0
  10. package/ChartsGrid/package.json +6 -0
  11. package/ChartsSurface.js +6 -4
  12. package/ChartsXAxis/ChartsXAxis.js +2 -2
  13. package/ChartsYAxis/ChartsYAxis.js +2 -2
  14. package/Gauge/Gauge.d.ts +13 -0
  15. package/Gauge/Gauge.js +156 -0
  16. package/Gauge/GaugeContainer.d.ts +19 -0
  17. package/Gauge/GaugeContainer.js +216 -0
  18. package/Gauge/GaugeProvider.d.ts +117 -0
  19. package/Gauge/GaugeProvider.js +96 -0
  20. package/Gauge/GaugeReferenceArc.d.ts +2 -0
  21. package/Gauge/GaugeReferenceArc.js +44 -0
  22. package/Gauge/GaugeValueArc.d.ts +2 -0
  23. package/Gauge/GaugeValueArc.js +51 -0
  24. package/Gauge/GaugeValueText.d.ts +15 -0
  25. package/Gauge/GaugeValueText.js +77 -0
  26. package/Gauge/gaugeClasses.d.ts +14 -0
  27. package/Gauge/gaugeClasses.js +15 -0
  28. package/Gauge/index.d.ts +7 -0
  29. package/Gauge/index.js +87 -0
  30. package/Gauge/package.json +6 -0
  31. package/Gauge/utils.d.ts +19 -0
  32. package/Gauge/utils.js +75 -0
  33. package/LineChart/LineChart.d.ts +24 -5
  34. package/LineChart/LineChart.js +31 -5
  35. package/PieChart/PieArc.d.ts +4 -4
  36. package/PieChart/PieArc.js +9 -9
  37. package/PieChart/PieArcLabelPlot.js +13 -13
  38. package/PieChart/PieChart.d.ts +22 -0
  39. package/PieChart/PieChart.js +22 -0
  40. package/ResponsiveChartContainer/ResponsiveChartContainer.js +2 -66
  41. package/ResponsiveChartContainer/useChartContainerDimensions.d.ts +2 -0
  42. package/ResponsiveChartContainer/useChartContainerDimensions.js +76 -0
  43. package/ScatterChart/ScatterChart.d.ts +18 -0
  44. package/ScatterChart/ScatterChart.js +25 -0
  45. package/esm/BarChart/BarChart.js +27 -5
  46. package/esm/ChartsGrid/ChartsGrid.js +121 -0
  47. package/esm/ChartsGrid/chartsGridClasses.js +6 -0
  48. package/esm/ChartsGrid/index.js +2 -0
  49. package/esm/ChartsSurface.js +6 -4
  50. package/esm/ChartsXAxis/ChartsXAxis.js +1 -1
  51. package/esm/ChartsYAxis/ChartsYAxis.js +1 -1
  52. package/esm/Gauge/Gauge.js +149 -0
  53. package/esm/Gauge/GaugeContainer.js +211 -0
  54. package/esm/Gauge/GaugeProvider.js +85 -0
  55. package/esm/Gauge/GaugeReferenceArc.js +35 -0
  56. package/esm/Gauge/GaugeValueArc.js +42 -0
  57. package/esm/Gauge/GaugeValueText.js +69 -0
  58. package/esm/Gauge/gaugeClasses.js +7 -0
  59. package/esm/Gauge/index.js +7 -0
  60. package/esm/Gauge/utils.js +68 -0
  61. package/esm/LineChart/LineChart.js +31 -5
  62. package/esm/PieChart/PieArc.js +9 -9
  63. package/esm/PieChart/PieArcLabelPlot.js +13 -13
  64. package/esm/PieChart/PieChart.js +22 -0
  65. package/esm/ResponsiveChartContainer/ResponsiveChartContainer.js +2 -66
  66. package/esm/ResponsiveChartContainer/useChartContainerDimensions.js +66 -0
  67. package/esm/ScatterChart/ScatterChart.js +25 -0
  68. package/esm/hooks/useTicks.js +2 -3
  69. package/esm/index.js +2 -0
  70. package/hooks/useTicks.d.ts +1 -2
  71. package/hooks/useTicks.js +2 -3
  72. package/index.d.ts +2 -0
  73. package/index.js +23 -1
  74. package/legacy/BarChart/BarChart.js +27 -5
  75. package/legacy/ChartsGrid/ChartsGrid.js +119 -0
  76. package/legacy/ChartsGrid/chartsGridClasses.js +6 -0
  77. package/legacy/ChartsGrid/index.js +2 -0
  78. package/legacy/ChartsSurface.js +5 -3
  79. package/legacy/ChartsXAxis/ChartsXAxis.js +1 -1
  80. package/legacy/ChartsYAxis/ChartsYAxis.js +1 -1
  81. package/legacy/Gauge/Gauge.js +146 -0
  82. package/legacy/Gauge/GaugeContainer.js +215 -0
  83. package/legacy/Gauge/GaugeProvider.js +87 -0
  84. package/legacy/Gauge/GaugeReferenceArc.js +37 -0
  85. package/legacy/Gauge/GaugeValueArc.js +44 -0
  86. package/legacy/Gauge/GaugeValueText.js +66 -0
  87. package/legacy/Gauge/gaugeClasses.js +7 -0
  88. package/legacy/Gauge/index.js +7 -0
  89. package/legacy/Gauge/utils.js +84 -0
  90. package/legacy/LineChart/LineChart.js +31 -5
  91. package/legacy/PieChart/PieArc.js +10 -10
  92. package/legacy/PieChart/PieArcLabelPlot.js +14 -14
  93. package/legacy/PieChart/PieChart.js +22 -0
  94. package/legacy/ResponsiveChartContainer/ResponsiveChartContainer.js +7 -77
  95. package/legacy/ResponsiveChartContainer/useChartContainerDimensions.js +73 -0
  96. package/legacy/ScatterChart/ScatterChart.js +25 -0
  97. package/legacy/hooks/useTicks.js +2 -3
  98. package/legacy/index.js +3 -1
  99. package/modern/BarChart/BarChart.js +27 -5
  100. package/modern/ChartsGrid/ChartsGrid.js +121 -0
  101. package/modern/ChartsGrid/chartsGridClasses.js +6 -0
  102. package/modern/ChartsGrid/index.js +2 -0
  103. package/modern/ChartsSurface.js +6 -4
  104. package/modern/ChartsXAxis/ChartsXAxis.js +1 -1
  105. package/modern/ChartsYAxis/ChartsYAxis.js +1 -1
  106. package/modern/Gauge/Gauge.js +149 -0
  107. package/modern/Gauge/GaugeContainer.js +208 -0
  108. package/modern/Gauge/GaugeProvider.js +85 -0
  109. package/modern/Gauge/GaugeReferenceArc.js +35 -0
  110. package/modern/Gauge/GaugeValueArc.js +42 -0
  111. package/modern/Gauge/GaugeValueText.js +69 -0
  112. package/modern/Gauge/gaugeClasses.js +7 -0
  113. package/modern/Gauge/index.js +7 -0
  114. package/modern/Gauge/utils.js +68 -0
  115. package/modern/LineChart/LineChart.js +31 -5
  116. package/modern/PieChart/PieArc.js +9 -9
  117. package/modern/PieChart/PieArcLabelPlot.js +13 -13
  118. package/modern/PieChart/PieChart.js +22 -0
  119. package/modern/ResponsiveChartContainer/ResponsiveChartContainer.js +2 -66
  120. package/modern/ResponsiveChartContainer/useChartContainerDimensions.js +66 -0
  121. package/modern/ScatterChart/ScatterChart.js +25 -0
  122. package/modern/hooks/useTicks.js +2 -3
  123. package/modern/index.js +3 -1
  124. package/package.json +4 -4
@@ -8,6 +8,7 @@ import { ChartsTooltip } from '../ChartsTooltip';
8
8
  import { ChartsLegend } from '../ChartsLegend';
9
9
  import { ChartsAxisHighlight } from '../ChartsAxisHighlight';
10
10
  import { ChartsVoronoiHandler } from '../ChartsVoronoiHandler/ChartsVoronoiHandler';
11
+ import { ChartsGrid } from '../ChartsGrid';
11
12
  import { jsx as _jsx } from "react/jsx-runtime";
12
13
  import { jsxs as _jsxs } from "react/jsx-runtime";
13
14
  /**
@@ -34,6 +35,7 @@ var ScatterChart = /*#__PURE__*/React.forwardRef(function ScatterChart(props, re
34
35
  margin = props.margin,
35
36
  colors = props.colors,
36
37
  sx = props.sx,
38
+ grid = props.grid,
37
39
  topAxis = props.topAxis,
38
40
  leftAxis = props.leftAxis,
39
41
  rightAxis = props.rightAxis,
@@ -66,6 +68,9 @@ var ScatterChart = /*#__PURE__*/React.forwardRef(function ScatterChart(props, re
66
68
  bottomAxis: bottomAxis,
67
69
  slots: slots,
68
70
  slotProps: slotProps
71
+ }), grid && /*#__PURE__*/_jsx(ChartsGrid, {
72
+ vertical: grid.vertical,
73
+ horizontal: grid.horizontal
69
74
  }), /*#__PURE__*/_jsx(ScatterPlot, {
70
75
  slots: slots,
71
76
  slotProps: slotProps,
@@ -86,6 +91,11 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
86
91
  // | These PropTypes are generated from the TypeScript type definitions |
87
92
  // | To update them edit the TypeScript types and run "yarn proptypes" |
88
93
  // ----------------------------------------------------------------------
94
+ /**
95
+ * The configuration of axes highlight.
96
+ * @see See {@link https://mui.com/x/react-charts/tooltip/#highlights highlight docs} for more details.
97
+ * @default { x: 'none', y: 'none' }
98
+ */
89
99
  axisHighlight: PropTypes.shape({
90
100
  x: PropTypes.oneOf(['band', 'line', 'none']),
91
101
  y: PropTypes.oneOf(['band', 'line', 'none'])
@@ -140,6 +150,13 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
140
150
  * @default false
141
151
  */
142
152
  disableVoronoi: PropTypes.bool,
153
+ /**
154
+ * Option to display a cartesian grid in the background.
155
+ */
156
+ grid: PropTypes.shape({
157
+ horizontal: PropTypes.bool,
158
+ vertical: PropTypes.bool
159
+ }),
143
160
  /**
144
161
  * The height of the chart in px. If not defined, it takes the height of the parent element.
145
162
  * @default undefined
@@ -231,6 +248,9 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
231
248
  tickNumber: PropTypes.number,
232
249
  tickSize: PropTypes.number
233
250
  }), PropTypes.string]),
251
+ /**
252
+ * The series to display in the scatter chart.
253
+ */
234
254
  series: PropTypes.arrayOf(PropTypes.object).isRequired,
235
255
  /**
236
256
  * The props used for each component slot.
@@ -244,6 +264,11 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
244
264
  slots: PropTypes.object,
245
265
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
246
266
  title: PropTypes.string,
267
+ /**
268
+ * The configuration of the tooltip.
269
+ * @see See {@link https://mui.com/x/react-charts/tooltip/ tooltip docs} for more details.
270
+ * @default { trigger: 'item' }
271
+ */
247
272
  tooltip: PropTypes.shape({
248
273
  axisContent: PropTypes.elementType,
249
274
  classes: PropTypes.object,
@@ -13,7 +13,7 @@ export function getTickNumber(params) {
13
13
  var defaultizedTickNumber = tickNumber != null ? tickNumber : Math.floor(Math.abs(range[1] - range[0]) / 50);
14
14
  return Math.min(maxTicks, Math.max(minTicks, defaultizedTickNumber));
15
15
  }
16
- function useTicks(options) {
16
+ export function useTicks(options) {
17
17
  var scale = options.scale,
18
18
  tickNumber = options.tickNumber,
19
19
  valueFormatter = options.valueFormatter,
@@ -62,5 +62,4 @@ function useTicks(options) {
62
62
  };
63
63
  });
64
64
  }, [tickNumber, scale, valueFormatter, tickInterval]);
65
- }
66
- export default useTicks;
65
+ }
package/legacy/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-charts v7.0.0-beta.2
2
+ * @mui/x-charts v7.0.0-beta.3
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -15,6 +15,7 @@ export * from './ChartsReferenceLine';
15
15
  export * from './ChartsAxis';
16
16
  export * from './ChartsXAxis';
17
17
  export * from './ChartsYAxis';
18
+ export * from './ChartsGrid';
18
19
  export * from './ChartsText';
19
20
  export * from './ChartsTooltip';
20
21
  export * from './ChartsLegend';
@@ -26,6 +27,7 @@ export * from './LineChart';
26
27
  export * from './PieChart';
27
28
  export * from './ScatterChart';
28
29
  export * from './SparkLineChart';
30
+ export * from './Gauge';
29
31
  export * from './ChartContainer';
30
32
  export * from './ChartsSurface';
31
33
  export * from './ResponsiveChartContainer';
@@ -10,6 +10,7 @@ import { ChartsTooltip } from '../ChartsTooltip';
10
10
  import { ChartsLegend } from '../ChartsLegend';
11
11
  import { ChartsAxisHighlight } from '../ChartsAxisHighlight';
12
12
  import { ChartsClipPath } from '../ChartsClipPath';
13
+ import { ChartsGrid } from '../ChartsGrid';
13
14
  import { ChartsOnAxisClickHandler } from '../ChartsOnAxisClickHandler';
14
15
  import { jsx as _jsx } from "react/jsx-runtime";
15
16
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -39,6 +40,7 @@ const BarChart = /*#__PURE__*/React.forwardRef(function BarChart(props, ref) {
39
40
  tooltip,
40
41
  axisHighlight,
41
42
  legend,
43
+ grid,
42
44
  topAxis,
43
45
  leftAxis,
44
46
  rightAxis,
@@ -86,6 +88,9 @@ const BarChart = /*#__PURE__*/React.forwardRef(function BarChart(props, ref) {
86
88
  disableAxisListener: tooltip?.trigger !== 'axis' && axisHighlight?.x === 'none' && axisHighlight?.y === 'none' && !onAxisClick,
87
89
  children: [onAxisClick && /*#__PURE__*/_jsx(ChartsOnAxisClickHandler, {
88
90
  onAxisClick: onAxisClick
91
+ }), grid && /*#__PURE__*/_jsx(ChartsGrid, {
92
+ vertical: grid.vertical,
93
+ horizontal: grid.horizontal
89
94
  }), /*#__PURE__*/_jsx("g", {
90
95
  clipPath: `url(#${clipPathId})`,
91
96
  children: /*#__PURE__*/_jsx(BarPlot, {
@@ -118,11 +123,10 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
118
123
  // | To update them edit the TypeScript types and run "yarn proptypes" |
119
124
  // ----------------------------------------------------------------------
120
125
  /**
121
- * Object `{ x, y }` that defines how the charts highlight the mouse position along the x- and y-axes.
122
- * The two properties accept the following values:
123
- * - 'none': display nothing.
124
- * - 'line': display a line at the current mouse position.
125
- * - 'band': display a band at the current mouse position. Only available with band scale.
126
+ * The configuration of axes highlight.
127
+ * Default is set to 'band' in the bar direction.
128
+ * Depends on `layout` prop.
129
+ * @see See {@link https://mui.com/x/react-charts/tooltip/#highlights highlight docs} for more details.
126
130
  */
127
131
  axisHighlight: PropTypes.shape({
128
132
  x: PropTypes.oneOf(['band', 'line', 'none']),
@@ -173,11 +177,22 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
173
177
  * @default false
174
178
  */
175
179
  disableAxisListener: PropTypes.bool,
180
+ /**
181
+ * Option to display a cartesian grid in the background.
182
+ */
183
+ grid: PropTypes.shape({
184
+ horizontal: PropTypes.bool,
185
+ vertical: PropTypes.bool
186
+ }),
176
187
  /**
177
188
  * The height of the chart in px. If not defined, it takes the height of the parent element.
178
189
  * @default undefined
179
190
  */
180
191
  height: PropTypes.number,
192
+ /**
193
+ * The direction of the bar elements.
194
+ * @default 'vertical'
195
+ */
181
196
  layout: PropTypes.oneOf(['horizontal', 'vertical']),
182
197
  /**
183
198
  * Indicate which axis to display the left of the charts.
@@ -272,6 +287,9 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
272
287
  tickNumber: PropTypes.number,
273
288
  tickSize: PropTypes.number
274
289
  }), PropTypes.string]),
290
+ /**
291
+ * The series to display in the bar chart.
292
+ */
275
293
  series: PropTypes.arrayOf(PropTypes.object).isRequired,
276
294
  /**
277
295
  * If `true`, animations are skipped.
@@ -290,6 +308,10 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
290
308
  slots: PropTypes.object,
291
309
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
292
310
  title: PropTypes.string,
311
+ /**
312
+ * The configuration of the tooltip.
313
+ * @see See {@link https://mui.com/x/react-charts/tooltip/ tooltip docs} for more details.
314
+ */
293
315
  tooltip: PropTypes.shape({
294
316
  axisContent: PropTypes.elementType,
295
317
  classes: PropTypes.object,
@@ -0,0 +1,121 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
+ const _excluded = ["vertical", "horizontal"];
4
+ import * as React from 'react';
5
+ import PropTypes from 'prop-types';
6
+ import composeClasses from '@mui/utils/composeClasses';
7
+ import { styled } from '@mui/material/styles';
8
+ import { CartesianContext } from '../context/CartesianContextProvider';
9
+ import { useTicks } from '../hooks/useTicks';
10
+ import { getChartsGridUtilityClass, chartsGridClasses } from './chartsGridClasses';
11
+ import { jsx as _jsx } from "react/jsx-runtime";
12
+ import { jsxs as _jsxs } from "react/jsx-runtime";
13
+ const GridRoot = styled('g', {
14
+ name: 'MuiChartsGrid',
15
+ slot: 'Root',
16
+ overridesResolver: (props, styles) => styles.root
17
+ })(({
18
+ theme
19
+ }) => ({
20
+ [`& .${chartsGridClasses.line}`]: {
21
+ stroke: (theme.vars || theme).palette.divider,
22
+ shapeRendering: 'crispEdges',
23
+ strokeWidth: 1
24
+ }
25
+ }));
26
+ const useUtilityClasses = ({
27
+ classes
28
+ }) => {
29
+ const slots = {
30
+ root: ['root'],
31
+ verticalLine: ['line', 'verticalLine'],
32
+ horizontalLine: ['line', 'horizontalLine']
33
+ };
34
+ return composeClasses(slots, getChartsGridUtilityClass, classes);
35
+ };
36
+ /**
37
+ * Demos:
38
+ *
39
+ * - [Axis](https://mui.com/x/react-charts/axis/)
40
+ *
41
+ * API:
42
+ *
43
+ * - [ChartsGrid API](https://mui.com/x/api/charts/charts-axis/)
44
+ */
45
+ function ChartsGrid(props) {
46
+ const {
47
+ vertical,
48
+ horizontal
49
+ } = props,
50
+ other = _objectWithoutPropertiesLoose(props, _excluded);
51
+ const {
52
+ xAxis,
53
+ xAxisIds,
54
+ yAxis,
55
+ yAxisIds
56
+ } = React.useContext(CartesianContext);
57
+ const classes = useUtilityClasses(props);
58
+ const horizontalAxisId = yAxisIds[0];
59
+ const verticalAxisId = xAxisIds[0];
60
+ const {
61
+ scale: xScale,
62
+ tickNumber: xTickNumber,
63
+ tickInterval: xTickInterval
64
+ } = xAxis[verticalAxisId];
65
+ const {
66
+ scale: yScale,
67
+ tickNumber: yTickNumber,
68
+ tickInterval: yTickInterval
69
+ } = yAxis[horizontalAxisId];
70
+ const xTicks = useTicks({
71
+ scale: xScale,
72
+ tickNumber: xTickNumber,
73
+ tickInterval: xTickInterval
74
+ });
75
+ const yTicks = useTicks({
76
+ scale: yScale,
77
+ tickNumber: yTickNumber,
78
+ tickInterval: yTickInterval
79
+ });
80
+ return /*#__PURE__*/_jsxs(GridRoot, _extends({}, other, {
81
+ className: classes.root,
82
+ children: [vertical && xTicks.map(({
83
+ formattedValue,
84
+ offset
85
+ }) => /*#__PURE__*/_jsx("line", {
86
+ y1: yScale.range()[0],
87
+ y2: yScale.range()[1],
88
+ x1: offset,
89
+ x2: offset,
90
+ className: classes.verticalLine
91
+ }, formattedValue)), horizontal && yTicks.map(({
92
+ formattedValue,
93
+ offset
94
+ }) => /*#__PURE__*/_jsx("line", {
95
+ y1: offset,
96
+ y2: offset,
97
+ x1: xScale.range()[0],
98
+ x2: xScale.range()[1],
99
+ className: classes.horizontalLine
100
+ }, formattedValue))]
101
+ }));
102
+ }
103
+ process.env.NODE_ENV !== "production" ? ChartsGrid.propTypes = {
104
+ // ----------------------------- Warning --------------------------------
105
+ // | These PropTypes are generated from the TypeScript type definitions |
106
+ // | To update them edit the TypeScript types and run "yarn proptypes" |
107
+ // ----------------------------------------------------------------------
108
+ /**
109
+ * Override or extend the styles applied to the component.
110
+ */
111
+ classes: PropTypes.object,
112
+ /**
113
+ * Displays horizontal grid.
114
+ */
115
+ horizontal: PropTypes.bool,
116
+ /**
117
+ * Displays vertical grid.
118
+ */
119
+ vertical: PropTypes.bool
120
+ } : void 0;
121
+ export { ChartsGrid };
@@ -0,0 +1,6 @@
1
+ import generateUtilityClass from '@mui/utils/generateUtilityClass';
2
+ import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
3
+ export function getChartsGridUtilityClass(slot) {
4
+ return generateUtilityClass('MuiChartsGrid', slot);
5
+ }
6
+ export const chartsGridClasses = generateUtilityClasses('MuiChartsGrid', ['root', 'line', 'horizontalLine', 'verticalLine']);
@@ -0,0 +1,2 @@
1
+ export * from './ChartsGrid';
2
+ export * from './chartsGridClasses';
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["children", "width", "height", "viewBox", "disableAxisListener", "className"];
3
+ const _excluded = ["children", "width", "height", "viewBox", "disableAxisListener", "className", "title", "desc"];
4
4
  import { styled } from '@mui/material/styles';
5
5
  import PropTypes from 'prop-types';
6
6
  import * as React from 'react';
@@ -17,7 +17,9 @@ const ChartsSurface = /*#__PURE__*/React.forwardRef(function ChartsSurface(props
17
17
  width,
18
18
  height,
19
19
  viewBox,
20
- disableAxisListener = false
20
+ disableAxisListener = false,
21
+ title,
22
+ desc
21
23
  } = props,
22
24
  other = _objectWithoutPropertiesLoose(props, _excluded);
23
25
  const svgView = _extends({
@@ -34,9 +36,9 @@ const ChartsSurface = /*#__PURE__*/React.forwardRef(function ChartsSurface(props
34
36
  ref: ref
35
37
  }, other, {
36
38
  children: [/*#__PURE__*/_jsx("title", {
37
- children: props.title
39
+ children: title
38
40
  }), /*#__PURE__*/_jsx("desc", {
39
- children: props.desc
41
+ children: desc
40
42
  }), children]
41
43
  }));
42
44
  });
@@ -8,7 +8,7 @@ import { unstable_composeClasses as composeClasses } from '@mui/utils';
8
8
  import { useThemeProps, useTheme } from '@mui/material/styles';
9
9
  import { CartesianContext } from '../context/CartesianContextProvider';
10
10
  import { DrawingContext } from '../context/DrawingProvider';
11
- import useTicks from '../hooks/useTicks';
11
+ import { useTicks } from '../hooks/useTicks';
12
12
  import { getAxisUtilityClass } from '../ChartsAxis/axisClasses';
13
13
  import { AxisRoot } from '../internals/components/AxisSharedComponents';
14
14
  import { ChartsText } from '../ChartsText';
@@ -8,7 +8,7 @@ import { unstable_composeClasses as composeClasses } from '@mui/utils';
8
8
  import { useThemeProps, useTheme } from '@mui/material/styles';
9
9
  import { CartesianContext } from '../context/CartesianContextProvider';
10
10
  import { DrawingContext } from '../context/DrawingProvider';
11
- import useTicks from '../hooks/useTicks';
11
+ import { useTicks } from '../hooks/useTicks';
12
12
  import { AxisRoot } from '../internals/components/AxisSharedComponents';
13
13
  import { ChartsText } from '../ChartsText';
14
14
  import { getAxisUtilityClass } from '../ChartsAxis/axisClasses';
@@ -0,0 +1,149 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
+ const _excluded = ["text", "children", "classes"];
4
+ import * as React from 'react';
5
+ import PropTypes from 'prop-types';
6
+ import composeClasses from '@mui/utils/composeClasses';
7
+ import { GaugeContainer } from './GaugeContainer';
8
+ import { GaugeValueArc } from './GaugeValueArc';
9
+ import { GaugeReferenceArc } from './GaugeReferenceArc';
10
+ import { getGaugeUtilityClass } from './gaugeClasses';
11
+ import { GaugeValueText } from './GaugeValueText';
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { jsxs as _jsxs } from "react/jsx-runtime";
14
+ const useUtilityClasses = props => {
15
+ const {
16
+ classes
17
+ } = props;
18
+ const slots = {
19
+ root: ['root'],
20
+ valueArc: ['valueArc'],
21
+ referenceArc: ['referenceArc'],
22
+ valueText: ['valueText']
23
+ };
24
+ return composeClasses(slots, getGaugeUtilityClass, classes);
25
+ };
26
+ function Gauge(props) {
27
+ const {
28
+ text,
29
+ children
30
+ } = props,
31
+ other = _objectWithoutPropertiesLoose(props, _excluded);
32
+ const classes = useUtilityClasses(props);
33
+ return /*#__PURE__*/_jsxs(GaugeContainer, _extends({}, other, {
34
+ className: classes.root,
35
+ children: [/*#__PURE__*/_jsx(GaugeReferenceArc, {
36
+ className: classes.referenceArc
37
+ }), /*#__PURE__*/_jsx(GaugeValueArc, {
38
+ className: classes.valueArc
39
+ }), /*#__PURE__*/_jsx(GaugeValueText, {
40
+ className: classes.valueText,
41
+ text: text
42
+ }), children]
43
+ }));
44
+ }
45
+ process.env.NODE_ENV !== "production" ? Gauge.propTypes = {
46
+ // ----------------------------- Warning --------------------------------
47
+ // | These PropTypes are generated from the TypeScript type definitions |
48
+ // | To update them edit the TypeScript types and run "yarn proptypes" |
49
+ // ----------------------------------------------------------------------
50
+ children: PropTypes.node,
51
+ classes: PropTypes.object,
52
+ className: PropTypes.string,
53
+ /**
54
+ * The radius applied to arc corners (similar to border radius).
55
+ * Set it to '50%' to get rounded arc.
56
+ * @default 0
57
+ */
58
+ cornerRadius: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
59
+ /**
60
+ * The x coordinate of the arc center.
61
+ * Can be a number (in px) or a string with a percentage such as '50%'.
62
+ * The '100%' is the width the drawing area.
63
+ */
64
+ cx: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
65
+ /**
66
+ * The y coordinate of the arc center.
67
+ * Can be a number (in px) or a string with a percentage such as '50%'.
68
+ * The '100%' is the height the drawing area.
69
+ */
70
+ cy: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
71
+ desc: PropTypes.string,
72
+ /**
73
+ * If `true`, the charts will not listen to the mouse move event.
74
+ * It might break interactive features, but will improve performance.
75
+ * @default false
76
+ */
77
+ disableAxisListener: PropTypes.bool,
78
+ /**
79
+ * The end angle (deg).
80
+ * @default 360
81
+ */
82
+ endAngle: PropTypes.number,
83
+ /**
84
+ * The height of the chart in px. If not defined, it takes the height of the parent element.
85
+ * @default undefined
86
+ */
87
+ height: PropTypes.number,
88
+ /**
89
+ * The radius between circle center and the begining of the arc.
90
+ * Can be a number (in px) or a string with a percentage such as '50%'.
91
+ * The '100%' is the maximal radius that fit into the drawing area.
92
+ * @default '80%'
93
+ */
94
+ innerRadius: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
95
+ /**
96
+ * The margin between the SVG and the drawing area.
97
+ * It's used for leaving some space for extra information such as the x- and y-axis or legend.
98
+ * Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
99
+ * @default object Depends on the charts type.
100
+ */
101
+ margin: PropTypes.shape({
102
+ bottom: PropTypes.number,
103
+ left: PropTypes.number,
104
+ right: PropTypes.number,
105
+ top: PropTypes.number
106
+ }),
107
+ /**
108
+ * The radius between circle center and the end of the arc.
109
+ * Can be a number (in px) or a string with a percentage such as '50%'.
110
+ * The '100%' is the maximal radius that fit into the drawing area.
111
+ * @default '100%'
112
+ */
113
+ outerRadius: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
114
+ /**
115
+ * The start angle (deg).
116
+ * @default 0
117
+ */
118
+ startAngle: PropTypes.number,
119
+ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
120
+ text: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
121
+ title: PropTypes.string,
122
+ /**
123
+ * The value of the gauge.
124
+ * Set to `null` to not display a value.
125
+ */
126
+ value: PropTypes.number,
127
+ /**
128
+ * The maximal value of the gauge.
129
+ * @default 100
130
+ */
131
+ valueMax: PropTypes.number,
132
+ /**
133
+ * The minimal value of the gauge.
134
+ * @default 0
135
+ */
136
+ valueMin: PropTypes.number,
137
+ viewBox: PropTypes.shape({
138
+ height: PropTypes.number,
139
+ width: PropTypes.number,
140
+ x: PropTypes.number,
141
+ y: PropTypes.number
142
+ }),
143
+ /**
144
+ * The width of the chart in px. If not defined, it takes the width of the parent element.
145
+ * @default undefined
146
+ */
147
+ width: PropTypes.number
148
+ } : void 0;
149
+ export { Gauge };