@mui/x-charts 6.18.2 → 6.18.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 (89) hide show
  1. package/BarChart/BarElement.d.ts +5 -1
  2. package/BarChart/BarElement.js +24 -1
  3. package/BarChart/index.d.ts +3 -2
  4. package/BarChart/index.js +31 -12
  5. package/CHANGELOG.md +59 -0
  6. package/ChartsLegend/index.d.ts +1 -0
  7. package/ChartsLegend/index.js +11 -0
  8. package/ChartsTooltip/ChartsAxisTooltipContent.d.ts +5 -2
  9. package/ChartsTooltip/ChartsAxisTooltipContent.js +93 -73
  10. package/ChartsTooltip/ChartsItemTooltipContent.d.ts +5 -2
  11. package/ChartsTooltip/ChartsItemTooltipContent.js +38 -57
  12. package/ChartsTooltip/DefaultChartsAxisTooltipContent.d.ts +7 -0
  13. package/ChartsTooltip/DefaultChartsAxisTooltipContent.js +174 -0
  14. package/ChartsTooltip/DefaultChartsItemTooltipContent.d.ts +8 -0
  15. package/ChartsTooltip/DefaultChartsItemTooltipContent.js +99 -0
  16. package/ChartsTooltip/index.d.ts +4 -0
  17. package/ChartsTooltip/index.js +44 -0
  18. package/ChartsYAxis/ChartsYAxis.js +6 -4
  19. package/LineChart/extremums.js +25 -8
  20. package/LineChart/index.d.ts +5 -5
  21. package/LineChart/index.js +50 -41
  22. package/PieChart/PieArcLabelPlot.d.ts +5 -1
  23. package/PieChart/PieArcLabelPlot.js +89 -1
  24. package/PieChart/PieArcPlot.d.ts +5 -1
  25. package/PieChart/PieArcPlot.js +88 -1
  26. package/PieChart/index.d.ts +6 -6
  27. package/PieChart/index.js +60 -46
  28. package/ScatterChart/Scatter.js +1 -1
  29. package/ScatterChart/index.d.ts +3 -3
  30. package/ScatterChart/index.js +31 -19
  31. package/esm/BarChart/BarElement.js +26 -2
  32. package/esm/BarChart/index.js +3 -2
  33. package/esm/ChartsLegend/index.js +2 -1
  34. package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +95 -75
  35. package/esm/ChartsTooltip/ChartsItemTooltipContent.js +40 -58
  36. package/esm/ChartsTooltip/DefaultChartsAxisTooltipContent.js +168 -0
  37. package/esm/ChartsTooltip/DefaultChartsItemTooltipContent.js +92 -0
  38. package/esm/ChartsTooltip/index.js +5 -1
  39. package/esm/ChartsYAxis/ChartsYAxis.js +6 -4
  40. package/esm/LineChart/extremums.js +25 -8
  41. package/esm/LineChart/index.js +5 -5
  42. package/esm/PieChart/PieArcLabelPlot.js +91 -2
  43. package/esm/PieChart/PieArcPlot.js +90 -2
  44. package/esm/PieChart/index.js +6 -4
  45. package/esm/ScatterChart/Scatter.js +1 -1
  46. package/esm/ScatterChart/index.js +3 -3
  47. package/esm/internals/defaultizeValueFormatter.js +4 -3
  48. package/index.js +1 -1
  49. package/internals/defaultizeValueFormatter.d.ts +3 -1
  50. package/internals/defaultizeValueFormatter.js +3 -3
  51. package/legacy/BarChart/BarElement.js +26 -2
  52. package/legacy/BarChart/index.js +3 -2
  53. package/legacy/ChartsLegend/index.js +2 -1
  54. package/legacy/ChartsTooltip/ChartsAxisTooltipContent.js +95 -74
  55. package/legacy/ChartsTooltip/ChartsItemTooltipContent.js +40 -55
  56. package/legacy/ChartsTooltip/DefaultChartsAxisTooltipContent.js +167 -0
  57. package/legacy/ChartsTooltip/DefaultChartsItemTooltipContent.js +89 -0
  58. package/legacy/ChartsTooltip/index.js +5 -1
  59. package/legacy/ChartsYAxis/ChartsYAxis.js +6 -4
  60. package/legacy/LineChart/extremums.js +29 -14
  61. package/legacy/LineChart/index.js +5 -5
  62. package/legacy/PieChart/PieArcLabelPlot.js +91 -2
  63. package/legacy/PieChart/PieArcPlot.js +90 -2
  64. package/legacy/PieChart/index.js +6 -4
  65. package/legacy/ScatterChart/Scatter.js +1 -1
  66. package/legacy/ScatterChart/index.js +3 -3
  67. package/legacy/index.js +1 -1
  68. package/legacy/internals/defaultizeValueFormatter.js +4 -3
  69. package/models/seriesType/config.d.ts +5 -1
  70. package/models/seriesType/scatter.d.ts +1 -1
  71. package/modern/BarChart/BarElement.js +26 -2
  72. package/modern/BarChart/index.js +3 -2
  73. package/modern/ChartsLegend/index.js +2 -1
  74. package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +95 -74
  75. package/modern/ChartsTooltip/ChartsItemTooltipContent.js +40 -58
  76. package/modern/ChartsTooltip/DefaultChartsAxisTooltipContent.js +167 -0
  77. package/modern/ChartsTooltip/DefaultChartsItemTooltipContent.js +92 -0
  78. package/modern/ChartsTooltip/index.js +5 -1
  79. package/modern/ChartsYAxis/ChartsYAxis.js +6 -4
  80. package/modern/LineChart/extremums.js +25 -8
  81. package/modern/LineChart/index.js +5 -5
  82. package/modern/PieChart/PieArcLabelPlot.js +91 -2
  83. package/modern/PieChart/PieArcPlot.js +90 -2
  84. package/modern/PieChart/index.js +6 -4
  85. package/modern/ScatterChart/Scatter.js +1 -1
  86. package/modern/ScatterChart/index.js +3 -3
  87. package/modern/index.js +1 -1
  88. package/modern/internals/defaultizeValueFormatter.js +3 -3
  89. package/package.json +1 -1
@@ -3,12 +3,13 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
3
3
  const _excluded = ["slots", "slotProps", "innerRadius", "outerRadius", "cornerRadius", "paddingAngle", "id", "highlightScope", "highlighted", "faded", "data", "onClick", "skipAnimation"],
4
4
  _excluded2 = ["startAngle", "endAngle", "paddingAngle", "innerRadius", "outerRadius", "cornerRadius"];
5
5
  import * as React from 'react';
6
+ import PropTypes from 'prop-types';
6
7
  import { useTransition } from '@react-spring/web';
7
8
  import { PieArc } from './PieArc';
8
9
  import { defaultTransitionConfig } from './dataTransform/transition';
9
10
  import { useTransformData } from './dataTransform/useTransformData';
10
11
  import { jsx as _jsx } from "react/jsx-runtime";
11
- export function PieArcPlot(props) {
12
+ function PieArcPlot(props) {
12
13
  var _slots$pieArc;
13
14
  const {
14
15
  slots,
@@ -81,4 +82,91 @@ export function PieArcPlot(props) {
81
82
  }, slotProps == null ? void 0 : slotProps.pieArc));
82
83
  })
83
84
  }));
84
- }
85
+ }
86
+ process.env.NODE_ENV !== "production" ? PieArcPlot.propTypes = {
87
+ // ----------------------------- Warning --------------------------------
88
+ // | These PropTypes are generated from the TypeScript type definitions |
89
+ // | To update them edit the TypeScript types and run "yarn proptypes" |
90
+ // ----------------------------------------------------------------------
91
+ /**
92
+ * The radius applied to arc corners (similar to border radius).
93
+ * @default 0
94
+ */
95
+ cornerRadius: PropTypes.number,
96
+ data: PropTypes.arrayOf(PropTypes.shape({
97
+ color: PropTypes.string.isRequired,
98
+ endAngle: PropTypes.number.isRequired,
99
+ formattedValue: PropTypes.string.isRequired,
100
+ id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
101
+ index: PropTypes.number.isRequired,
102
+ label: PropTypes.string,
103
+ padAngle: PropTypes.number.isRequired,
104
+ startAngle: PropTypes.number.isRequired,
105
+ value: PropTypes.number.isRequired
106
+ })).isRequired,
107
+ /**
108
+ * Override the arc attibutes when it is faded.
109
+ */
110
+ faded: PropTypes.shape({
111
+ additionalRadius: PropTypes.number,
112
+ color: PropTypes.string,
113
+ cornerRadius: PropTypes.number,
114
+ innerRadius: PropTypes.number,
115
+ outerRadius: PropTypes.number,
116
+ paddingAngle: PropTypes.number
117
+ }),
118
+ /**
119
+ * Override the arc attibutes when it is highlighted.
120
+ */
121
+ highlighted: PropTypes.shape({
122
+ additionalRadius: PropTypes.number,
123
+ color: PropTypes.string,
124
+ cornerRadius: PropTypes.number,
125
+ innerRadius: PropTypes.number,
126
+ outerRadius: PropTypes.number,
127
+ paddingAngle: PropTypes.number
128
+ }),
129
+ highlightScope: PropTypes.shape({
130
+ faded: PropTypes.oneOf(['global', 'none', 'series']),
131
+ highlighted: PropTypes.oneOf(['item', 'none', 'series'])
132
+ }),
133
+ id: PropTypes.string.isRequired,
134
+ /**
135
+ * The radius between circle center and the begining of the arc.
136
+ * @default 0
137
+ */
138
+ innerRadius: PropTypes.number,
139
+ /**
140
+ * Callback fired when a pie item is clicked.
141
+ * @param {React.MouseEvent<SVGPathElement, MouseEvent>} event The event source of the callback.
142
+ * @param {PieItemIdentifier} pieItemIdentifier The pie item identifier.
143
+ * @param {DefaultizedPieValueType} item The pie item.
144
+ */
145
+ onClick: PropTypes.func,
146
+ /**
147
+ * The radius between circle center and the end of the arc.
148
+ * @default R_max The maximal radius that fit into the drawing area.
149
+ */
150
+ outerRadius: PropTypes.number.isRequired,
151
+ /**
152
+ * The padding angle (deg) between two arcs.
153
+ * @default 0
154
+ */
155
+ paddingAngle: PropTypes.number,
156
+ /**
157
+ * If `true`, animations are skiped.
158
+ * @default false
159
+ */
160
+ skipAnimation: PropTypes.bool,
161
+ /**
162
+ * The props used for each component slot.
163
+ * @default {}
164
+ */
165
+ slotProps: PropTypes.object,
166
+ /**
167
+ * Overridable component slots.
168
+ * @default {}
169
+ */
170
+ slots: PropTypes.object
171
+ } : void 0;
172
+ export { PieArcPlot };
@@ -1,4 +1,6 @@
1
- export { PiePlot } from './PiePlot';
2
- export { PieChart } from './PieChart';
3
- export { PieArcLabel, getPieArcLabelUtilityClass, pieArcLabelClasses } from './PieArcLabel';
4
- export { PieArc, getPieArcUtilityClass, pieArcClasses } from './PieArc';
1
+ export * from './PieChart';
2
+ export * from './PiePlot';
3
+ export * from './PieArcPlot';
4
+ export * from './PieArcLabelPlot';
5
+ export * from './PieArc';
6
+ export * from './PieArcLabel';
@@ -78,7 +78,7 @@ process.env.NODE_ENV !== "production" ? Scatter.propTypes = {
78
78
  color: PropTypes.string.isRequired,
79
79
  markerSize: PropTypes.number.isRequired,
80
80
  series: PropTypes.shape({
81
- color: PropTypes.string,
81
+ color: PropTypes.string.isRequired,
82
82
  data: PropTypes.arrayOf(PropTypes.shape({
83
83
  id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
84
84
  x: PropTypes.number.isRequired,
@@ -1,3 +1,3 @@
1
- export { ScatterPlot } from './ScatterPlot';
2
- export { ScatterChart } from './ScatterChart';
3
- export { Scatter } from './Scatter';
1
+ export * from './ScatterChart';
2
+ export * from './ScatterPlot';
3
+ export * from './Scatter';
@@ -2,9 +2,10 @@ import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  function defaultizeValueFormatter(series, defaultValueFormatter) {
3
3
  const defaultizedSeries = {};
4
4
  Object.keys(series).forEach(seriesId => {
5
- defaultizedSeries[seriesId] = _extends({
6
- valueFormatter: defaultValueFormatter
7
- }, series[seriesId]);
5
+ var _series$seriesId$valu;
6
+ defaultizedSeries[seriesId] = _extends({}, series[seriesId], {
7
+ valueFormatter: (_series$seriesId$valu = series[seriesId].valueFormatter) != null ? _series$seriesId$valu : defaultValueFormatter
8
+ });
8
9
  });
9
10
  return defaultizedSeries;
10
11
  }
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-charts v6.18.2
2
+ * @mui/x-charts v6.18.3
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -1,4 +1,6 @@
1
- declare function defaultizeValueFormatter<ISeries extends {}, IFormatter extends (v: any) => string>(series: {
1
+ declare function defaultizeValueFormatter<ISeries extends {
2
+ valueFormatter?: IFormatter;
3
+ }, IFormatter extends (v: any) => string>(series: {
2
4
  [id: string]: ISeries;
3
5
  }, defaultValueFormatter: IFormatter): {
4
6
  [id: string]: ISeries & {
@@ -9,9 +9,9 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
9
9
  function defaultizeValueFormatter(series, defaultValueFormatter) {
10
10
  const defaultizedSeries = {};
11
11
  Object.keys(series).forEach(seriesId => {
12
- defaultizedSeries[seriesId] = (0, _extends2.default)({
13
- valueFormatter: defaultValueFormatter
14
- }, series[seriesId]);
12
+ defaultizedSeries[seriesId] = (0, _extends2.default)({}, series[seriesId], {
13
+ valueFormatter: series[seriesId].valueFormatter ?? defaultValueFormatter
14
+ });
15
15
  });
16
16
  return defaultizedSeries;
17
17
  }
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
3
  var _excluded = ["id", "dataIndex", "classes", "color", "highlightScope", "slots", "slotProps", "style"];
4
4
  import * as React from 'react';
5
+ import PropTypes from 'prop-types';
5
6
  import composeClasses from '@mui/utils/composeClasses';
6
7
  import { useSlotProps } from '@mui/base/utils';
7
8
  import generateUtilityClass from '@mui/utils/generateUtilityClass';
@@ -40,7 +41,7 @@ export var BarElementPath = styled(animated.rect, {
40
41
  opacity: ownerState.isFaded && 0.3 || 1
41
42
  };
42
43
  });
43
- export function BarElement(props) {
44
+ function BarElement(props) {
44
45
  var _slots$bar;
45
46
  var id = props.id,
46
47
  dataIndex = props.dataIndex,
@@ -88,4 +89,27 @@ export function BarElement(props) {
88
89
  ownerState: ownerState
89
90
  });
90
91
  return /*#__PURE__*/_jsx(Bar, _extends({}, barProps));
91
- }
92
+ }
93
+ process.env.NODE_ENV !== "production" ? BarElement.propTypes = {
94
+ // ----------------------------- Warning --------------------------------
95
+ // | These PropTypes are generated from the TypeScript type definitions |
96
+ // | To update them edit the TypeScript types and run "yarn proptypes" |
97
+ // ----------------------------------------------------------------------
98
+ classes: PropTypes.object,
99
+ dataIndex: PropTypes.number.isRequired,
100
+ highlightScope: PropTypes.shape({
101
+ faded: PropTypes.oneOf(['global', 'none', 'series']),
102
+ highlighted: PropTypes.oneOf(['item', 'none', 'series'])
103
+ }),
104
+ /**
105
+ * The props used for each component slot.
106
+ * @default {}
107
+ */
108
+ slotProps: PropTypes.object,
109
+ /**
110
+ * Overridable component slots.
111
+ * @default {}
112
+ */
113
+ slots: PropTypes.object
114
+ } : void 0;
115
+ export { BarElement };
@@ -1,2 +1,3 @@
1
- export { BarPlot } from './BarPlot';
2
- export { BarChart } from './BarChart';
1
+ export * from './BarChart';
2
+ export * from './BarPlot';
3
+ export * from './BarElement';
@@ -1,2 +1,3 @@
1
1
  export * from './ChartsLegend';
2
- export * from './chartsLegendClasses';
2
+ export * from './chartsLegendClasses';
3
+ export * from './utils';
@@ -1,81 +1,12 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
- import clsx from 'clsx';
4
- import Typography from '@mui/material/Typography';
3
+ import PropTypes from 'prop-types';
5
4
  import { useSlotProps } from '@mui/base/utils';
6
5
  import { SeriesContext } from '../context/SeriesContextProvider';
7
6
  import { CartesianContext } from '../context/CartesianContextProvider';
8
- import { ChartsTooltipCell, ChartsTooltipPaper, ChartsTooltipTable, ChartsTooltipMark, ChartsTooltipRow } from './ChartsTooltipTable';
7
+ import { DefaultChartsAxisTooltipContent } from './DefaultChartsAxisTooltipContent';
9
8
  import { jsx as _jsx } from "react/jsx-runtime";
10
- import { jsxs as _jsxs } from "react/jsx-runtime";
11
- export function DefaultChartsAxisContent(props) {
12
- var _axis$valueFormatter;
13
- var series = props.series,
14
- axis = props.axis,
15
- dataIndex = props.dataIndex,
16
- axisValue = props.axisValue,
17
- sx = props.sx,
18
- classes = props.classes;
19
- if (dataIndex == null) {
20
- return null;
21
- }
22
- var axisFormatter = (_axis$valueFormatter = axis.valueFormatter) != null ? _axis$valueFormatter : function (v) {
23
- return v.toLocaleString();
24
- };
25
- return /*#__PURE__*/_jsx(ChartsTooltipPaper, {
26
- sx: sx,
27
- className: classes.root,
28
- children: /*#__PURE__*/_jsxs(ChartsTooltipTable, {
29
- className: classes.table,
30
- children: [axisValue != null && !axis.hideTooltip && /*#__PURE__*/_jsx("thead", {
31
- children: /*#__PURE__*/_jsx(ChartsTooltipRow, {
32
- children: /*#__PURE__*/_jsx(ChartsTooltipCell, {
33
- colSpan: 3,
34
- children: /*#__PURE__*/_jsx(Typography, {
35
- children: axisFormatter(axisValue)
36
- })
37
- })
38
- })
39
- }), /*#__PURE__*/_jsx("tbody", {
40
- children: series.map(function (_ref) {
41
- var color = _ref.color,
42
- id = _ref.id,
43
- label = _ref.label,
44
- valueFormatter = _ref.valueFormatter,
45
- data = _ref.data;
46
- var formattedValue = valueFormatter(data[dataIndex]);
47
- if (formattedValue == null) {
48
- return null;
49
- }
50
- return /*#__PURE__*/_jsxs(ChartsTooltipRow, {
51
- className: classes.row,
52
- children: [/*#__PURE__*/_jsx(ChartsTooltipCell, {
53
- className: clsx(classes.markCell, classes.cell),
54
- children: /*#__PURE__*/_jsx(ChartsTooltipMark, {
55
- ownerState: {
56
- color: color
57
- },
58
- boxShadow: 1,
59
- className: classes.mark
60
- })
61
- }), /*#__PURE__*/_jsx(ChartsTooltipCell, {
62
- className: clsx(classes.labelCell, classes.cell),
63
- children: label ? /*#__PURE__*/_jsx(Typography, {
64
- children: label
65
- }) : null
66
- }), /*#__PURE__*/_jsx(ChartsTooltipCell, {
67
- className: clsx(classes.valueCell, classes.cell),
68
- children: /*#__PURE__*/_jsx(Typography, {
69
- children: formattedValue
70
- })
71
- })]
72
- }, id);
73
- })
74
- })]
75
- })
76
- });
77
- }
78
- export function ChartsAxisTooltipContent(props) {
9
+ function ChartsAxisTooltipContent(props) {
79
10
  var content = props.content,
80
11
  contentProps = props.contentProps,
81
12
  axisData = props.axisData,
@@ -109,7 +40,7 @@ export function ChartsAxisTooltipContent(props) {
109
40
  var relevantAxis = React.useMemo(function () {
110
41
  return isXaxis ? xAxis[USED_AXIS_ID] : yAxis[USED_AXIS_ID];
111
42
  }, [USED_AXIS_ID, isXaxis, xAxis, yAxis]);
112
- var Content = content != null ? content : DefaultChartsAxisContent;
43
+ var Content = content != null ? content : DefaultChartsAxisTooltipContent;
113
44
  var chartTooltipContentProps = useSlotProps({
114
45
  elementType: Content,
115
46
  externalSlotProps: contentProps,
@@ -125,4 +56,94 @@ export function ChartsAxisTooltipContent(props) {
125
56
  ownerState: {}
126
57
  });
127
58
  return /*#__PURE__*/_jsx(Content, _extends({}, chartTooltipContentProps));
128
- }
59
+ }
60
+ process.env.NODE_ENV !== "production" ? ChartsAxisTooltipContent.propTypes = {
61
+ // ----------------------------- Warning --------------------------------
62
+ // | These PropTypes are generated from the TypeScript type definitions |
63
+ // | To update them edit the TypeScript types and run "yarn proptypes" |
64
+ // ----------------------------------------------------------------------
65
+ axisData: PropTypes.shape({
66
+ x: PropTypes.shape({
67
+ index: PropTypes.number,
68
+ value: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired
69
+ }),
70
+ y: PropTypes.shape({
71
+ index: PropTypes.number,
72
+ value: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired
73
+ })
74
+ }).isRequired,
75
+ classes: PropTypes.object.isRequired,
76
+ content: PropTypes.elementType,
77
+ contentProps: PropTypes.shape({
78
+ axis: PropTypes.shape({
79
+ axisId: PropTypes.string,
80
+ classes: PropTypes.object,
81
+ data: PropTypes.array,
82
+ dataKey: PropTypes.string,
83
+ disableLine: PropTypes.bool,
84
+ disableTicks: PropTypes.bool,
85
+ fill: PropTypes.string,
86
+ hideTooltip: PropTypes.bool,
87
+ id: PropTypes.string.isRequired,
88
+ label: PropTypes.string,
89
+ labelFontSize: PropTypes.number,
90
+ labelStyle: PropTypes.object,
91
+ max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
92
+ min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
93
+ position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
94
+ scale: PropTypes.func.isRequired,
95
+ scaleType: PropTypes.oneOf(['time']).isRequired,
96
+ slotProps: PropTypes.object,
97
+ slots: PropTypes.object,
98
+ stroke: PropTypes.string,
99
+ tickFontSize: PropTypes.number,
100
+ tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
101
+ tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
102
+ tickLabelStyle: PropTypes.object,
103
+ tickMaxStep: PropTypes.number,
104
+ tickMinStep: PropTypes.number,
105
+ tickNumber: PropTypes.number.isRequired,
106
+ tickSize: PropTypes.number,
107
+ valueFormatter: PropTypes.func
108
+ }),
109
+ axisData: PropTypes.shape({
110
+ x: PropTypes.shape({
111
+ index: PropTypes.number,
112
+ value: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired
113
+ }),
114
+ y: PropTypes.shape({
115
+ index: PropTypes.number,
116
+ value: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired
117
+ })
118
+ }),
119
+ axisValue: PropTypes.any,
120
+ classes: PropTypes.object,
121
+ dataIndex: PropTypes.number,
122
+ series: PropTypes.arrayOf(PropTypes.shape({
123
+ area: PropTypes.bool,
124
+ color: PropTypes.string.isRequired,
125
+ connectNulls: PropTypes.bool,
126
+ curve: PropTypes.oneOf(['catmullRom', 'linear', 'monotoneX', 'monotoneY', 'natural', 'step', 'stepAfter', 'stepBefore']),
127
+ data: PropTypes.arrayOf(PropTypes.number).isRequired,
128
+ dataKey: PropTypes.string,
129
+ disableHighlight: PropTypes.bool,
130
+ highlightScope: PropTypes.shape({
131
+ faded: PropTypes.oneOf(['global', 'none', 'series']),
132
+ highlighted: PropTypes.oneOf(['item', 'none', 'series'])
133
+ }),
134
+ id: PropTypes.string.isRequired,
135
+ label: PropTypes.string,
136
+ showMark: PropTypes.oneOfType([PropTypes.func, PropTypes.bool]),
137
+ stack: PropTypes.string,
138
+ stackOffset: PropTypes.oneOf(['diverging', 'expand', 'none', 'silhouette', 'wiggle']),
139
+ stackOrder: PropTypes.oneOf(['appearance', 'ascending', 'descending', 'insideOut', 'none', 'reverse']),
140
+ type: PropTypes.oneOf(['line']).isRequired,
141
+ valueFormatter: PropTypes.func.isRequired,
142
+ xAxisKey: PropTypes.string,
143
+ yAxisKey: PropTypes.string
144
+ })),
145
+ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
146
+ }),
147
+ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
148
+ } : void 0;
149
+ export { ChartsAxisTooltipContent };
@@ -1,68 +1,18 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
- import clsx from 'clsx';
3
+ import PropTypes from 'prop-types';
4
4
  import { useSlotProps } from '@mui/base/utils';
5
5
  import { SeriesContext } from '../context/SeriesContextProvider';
6
- import { ChartsTooltipTable, ChartsTooltipCell, ChartsTooltipMark, ChartsTooltipPaper, ChartsTooltipRow } from './ChartsTooltipTable';
6
+ import { DefaultChartsItemTooltipContent } from './DefaultChartsItemTooltipContent';
7
7
  import { jsx as _jsx } from "react/jsx-runtime";
8
- import { jsxs as _jsxs } from "react/jsx-runtime";
9
- export function DefaultChartsItemContent(props) {
10
- var series = props.series,
11
- itemData = props.itemData,
12
- sx = props.sx,
13
- classes = props.classes;
14
- if (itemData.dataIndex === undefined) {
15
- return null;
16
- }
17
- var _ref = series.type === 'pie' ? {
18
- color: series.data[itemData.dataIndex].color,
19
- displayedLabel: series.data[itemData.dataIndex].label
20
- } : {
21
- color: series.color,
22
- displayedLabel: series.label
23
- },
24
- displayedLabel = _ref.displayedLabel,
25
- color = _ref.color;
26
-
27
- // TODO: Manage to let TS understand series.data and series.valueFormatter are coherent
28
- // @ts-ignore
29
- var formattedValue = series.valueFormatter(series.data[itemData.dataIndex]);
30
- return /*#__PURE__*/_jsx(ChartsTooltipPaper, {
31
- sx: sx,
32
- className: classes.root,
33
- children: /*#__PURE__*/_jsx(ChartsTooltipTable, {
34
- className: classes.table,
35
- children: /*#__PURE__*/_jsx("tbody", {
36
- children: /*#__PURE__*/_jsxs(ChartsTooltipRow, {
37
- className: classes.row,
38
- children: [/*#__PURE__*/_jsx(ChartsTooltipCell, {
39
- className: clsx(classes.markCell, classes.cell),
40
- children: /*#__PURE__*/_jsx(ChartsTooltipMark, {
41
- ownerState: {
42
- color: color
43
- },
44
- className: classes.mark
45
- })
46
- }), /*#__PURE__*/_jsx(ChartsTooltipCell, {
47
- className: clsx(classes.labelCell, classes.cell),
48
- children: displayedLabel
49
- }), /*#__PURE__*/_jsx(ChartsTooltipCell, {
50
- className: clsx(classes.valueCell, classes.cell),
51
- children: formattedValue
52
- })]
53
- })
54
- })
55
- })
56
- });
57
- }
58
- export function ChartsItemTooltipContent(props) {
8
+ function ChartsItemTooltipContent(props) {
59
9
  var content = props.content,
60
10
  itemData = props.itemData,
61
11
  sx = props.sx,
62
12
  classes = props.classes,
63
13
  contentProps = props.contentProps;
64
14
  var series = React.useContext(SeriesContext)[itemData.type].series[itemData.seriesId];
65
- var Content = content != null ? content : DefaultChartsItemContent;
15
+ var Content = content != null ? content : DefaultChartsItemTooltipContent;
66
16
  var chartTooltipContentProps = useSlotProps({
67
17
  elementType: Content,
68
18
  externalSlotProps: contentProps,
@@ -75,4 +25,39 @@ export function ChartsItemTooltipContent(props) {
75
25
  ownerState: {}
76
26
  });
77
27
  return /*#__PURE__*/_jsx(Content, _extends({}, chartTooltipContentProps));
78
- }
28
+ }
29
+ process.env.NODE_ENV !== "production" ? ChartsItemTooltipContent.propTypes = {
30
+ // ----------------------------- Warning --------------------------------
31
+ // | These PropTypes are generated from the TypeScript type definitions |
32
+ // | To update them edit the TypeScript types and run "yarn proptypes" |
33
+ // ----------------------------------------------------------------------
34
+ classes: PropTypes.object.isRequired,
35
+ content: PropTypes.elementType,
36
+ contentProps: PropTypes.shape({
37
+ classes: PropTypes.object,
38
+ itemData: PropTypes.shape({
39
+ dataIndex: PropTypes.number,
40
+ seriesId: PropTypes.string.isRequired,
41
+ type: PropTypes.oneOf(['bar', 'line', 'pie', 'scatter']).isRequired
42
+ }),
43
+ series: PropTypes.shape({
44
+ color: PropTypes.string,
45
+ data: PropTypes.arrayOf(PropTypes.number).isRequired,
46
+ highlightScope: PropTypes.shape({
47
+ faded: PropTypes.oneOf(['global', 'none', 'series']),
48
+ highlighted: PropTypes.oneOf(['item', 'none', 'series'])
49
+ }),
50
+ id: PropTypes.string.isRequired,
51
+ type: PropTypes.oneOf(['bar', 'line', 'pie', 'scatter']).isRequired,
52
+ valueFormatter: PropTypes.func.isRequired
53
+ }),
54
+ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
55
+ }),
56
+ itemData: PropTypes.shape({
57
+ dataIndex: PropTypes.number,
58
+ seriesId: PropTypes.string.isRequired,
59
+ type: PropTypes.oneOf(['bar', 'line', 'pie', 'scatter']).isRequired
60
+ }).isRequired,
61
+ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
62
+ } : void 0;
63
+ export { ChartsItemTooltipContent };