@mui/x-charts 7.8.0 → 7.10.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.
- package/BarChart/BarChart.d.ts +3 -3
- package/BarChart/useBarChartProps.d.ts +1 -1
- package/CHANGELOG.md +140 -0
- package/ChartContainer/ChartContainer.js +3 -1
- package/ChartsAxisHighlight/ChartsAxisHighlight.js +1 -1
- package/ChartsSurface.js +5 -1
- package/ChartsTooltip/ChartsAxisTooltipContent.d.ts +3 -3
- package/ChartsTooltip/ChartsAxisTooltipContent.js +4 -39
- package/ChartsTooltip/ChartsItemTooltipContent.d.ts +7 -6
- package/ChartsTooltip/ChartsItemTooltipContent.js +4 -27
- package/ChartsTooltip/ChartsTooltip.d.ts +10 -9
- package/ChartsTooltip/ChartsTooltip.js +8 -2
- package/ChartsTooltip/ChartsTooltipTable.d.ts +15 -0
- package/ChartsTooltip/ChartsTooltipTable.js +19 -0
- package/ChartsTooltip/index.d.ts +1 -0
- package/ChartsTooltip/index.js +11 -0
- package/ChartsTooltip/utils.d.ts +7 -6
- package/ChartsTooltip/utils.js +24 -30
- package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +5 -5
- package/ChartsXAxis/ChartsXAxis.js +7 -5
- package/LineChart/AreaPlot.js +7 -1
- package/LineChart/LineChart.d.ts +3 -3
- package/LineChart/MarkPlot.js +6 -2
- package/LineChart/extremums.js +1 -1
- package/LineChart/useLineChartProps.d.ts +1 -1
- package/PieChart/PieChart.d.ts +3 -3
- package/ResponsiveChartContainer/ResponsiveChartContainer.js +3 -1
- package/ScatterChart/Scatter.js +7 -5
- package/ScatterChart/ScatterChart.d.ts +3 -3
- package/ScatterChart/ScatterChart.js +3 -1
- package/ScatterChart/useScatterChartProps.d.ts +1 -1
- package/SparkLineChart/SparkLineChart.d.ts +3 -3
- package/context/CartesianProvider/computeValue.d.ts +2 -2
- package/context/CartesianProvider/computeValue.js +21 -5
- package/context/ZAxisContextProvider.js +7 -2
- package/esm/ChartContainer/ChartContainer.js +3 -1
- package/esm/ChartsAxisHighlight/ChartsAxisHighlight.js +1 -1
- package/esm/ChartsSurface.js +5 -1
- package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +3 -38
- package/esm/ChartsTooltip/ChartsItemTooltipContent.js +3 -26
- package/esm/ChartsTooltip/ChartsTooltip.js +8 -2
- package/esm/ChartsTooltip/ChartsTooltipTable.js +20 -0
- package/esm/ChartsTooltip/index.js +2 -1
- package/esm/ChartsTooltip/utils.js +23 -30
- package/esm/ChartsVoronoiHandler/ChartsVoronoiHandler.js +5 -5
- package/esm/ChartsXAxis/ChartsXAxis.js +7 -5
- package/esm/LineChart/AreaPlot.js +7 -1
- package/esm/LineChart/MarkPlot.js +6 -2
- package/esm/LineChart/extremums.js +1 -1
- package/esm/ResponsiveChartContainer/ResponsiveChartContainer.js +3 -1
- package/esm/ScatterChart/Scatter.js +7 -5
- package/esm/ScatterChart/ScatterChart.js +3 -1
- package/esm/context/CartesianProvider/computeValue.js +21 -5
- package/esm/context/ZAxisContextProvider.js +7 -2
- package/esm/hooks/index.js +1 -0
- package/esm/hooks/useAxis.js +17 -0
- package/esm/hooks/useAxisEvents.js +20 -9
- package/esm/hooks/useInteractionItemProps.js +11 -4
- package/esm/hooks/useScale.js +6 -13
- package/esm/internals/index.js +2 -0
- package/hooks/index.d.ts +1 -0
- package/hooks/index.js +12 -0
- package/hooks/useAxis.d.ts +2 -0
- package/hooks/useAxis.js +24 -0
- package/hooks/useAxisEvents.js +20 -9
- package/hooks/useInteractionItemProps.d.ts +4 -2
- package/hooks/useInteractionItemProps.js +11 -4
- package/hooks/useScale.js +5 -13
- package/index.js +1 -1
- package/internals/index.d.ts +2 -0
- package/internals/index.js +20 -0
- package/models/colorMapping.d.ts +1 -1
- package/models/z-axis.d.ts +8 -0
- package/modern/ChartContainer/ChartContainer.js +3 -1
- package/modern/ChartsAxisHighlight/ChartsAxisHighlight.js +1 -1
- package/modern/ChartsSurface.js +5 -1
- package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +3 -38
- package/modern/ChartsTooltip/ChartsItemTooltipContent.js +3 -26
- package/modern/ChartsTooltip/ChartsTooltip.js +8 -2
- package/modern/ChartsTooltip/ChartsTooltipTable.js +20 -0
- package/modern/ChartsTooltip/index.js +2 -1
- package/modern/ChartsTooltip/utils.js +23 -30
- package/modern/ChartsVoronoiHandler/ChartsVoronoiHandler.js +5 -5
- package/modern/ChartsXAxis/ChartsXAxis.js +7 -5
- package/modern/LineChart/AreaPlot.js +7 -1
- package/modern/LineChart/MarkPlot.js +6 -2
- package/modern/LineChart/extremums.js +1 -1
- package/modern/ResponsiveChartContainer/ResponsiveChartContainer.js +3 -1
- package/modern/ScatterChart/Scatter.js +7 -5
- package/modern/ScatterChart/ScatterChart.js +3 -1
- package/modern/context/CartesianProvider/computeValue.js +21 -5
- package/modern/context/ZAxisContextProvider.js +7 -2
- package/modern/hooks/index.js +1 -0
- package/modern/hooks/useAxis.js +17 -0
- package/modern/hooks/useAxisEvents.js +20 -9
- package/modern/hooks/useInteractionItemProps.js +11 -4
- package/modern/hooks/useScale.js +6 -13
- package/modern/index.js +1 -1
- package/modern/internals/index.js +2 -0
- package/package.json +3 -3
- package/themeAugmentation/props.d.ts +2 -1
package/BarChart/BarChart.d.ts
CHANGED
|
@@ -11,9 +11,9 @@ import { ChartsAxisSlots, ChartsAxisSlotProps } from '../models/axis';
|
|
|
11
11
|
import { ChartsGridProps } from '../ChartsGrid';
|
|
12
12
|
import { ChartsOnAxisClickHandlerProps } from '../ChartsOnAxisClickHandler';
|
|
13
13
|
import { ChartsOverlayProps, ChartsOverlaySlotProps, ChartsOverlaySlots } from '../ChartsOverlay/ChartsOverlay';
|
|
14
|
-
export interface BarChartSlots extends ChartsAxisSlots, BarPlotSlots, ChartsLegendSlots, ChartsTooltipSlots
|
|
14
|
+
export interface BarChartSlots extends ChartsAxisSlots, BarPlotSlots, ChartsLegendSlots, ChartsTooltipSlots<'bar'>, ChartsOverlaySlots {
|
|
15
15
|
}
|
|
16
|
-
export interface BarChartSlotProps extends ChartsAxisSlotProps, BarPlotSlotProps, ChartsLegendSlotProps, ChartsTooltipSlotProps
|
|
16
|
+
export interface BarChartSlotProps extends ChartsAxisSlotProps, BarPlotSlotProps, ChartsLegendSlotProps, ChartsTooltipSlotProps<'bar'>, ChartsOverlaySlotProps {
|
|
17
17
|
}
|
|
18
18
|
export interface BarChartProps extends Omit<ResponsiveChartContainerProps, 'series' | 'plugins' | 'zAxis'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'>, Omit<BarPlotProps, 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'>, ChartsOnAxisClickHandlerProps {
|
|
19
19
|
/**
|
|
@@ -25,7 +25,7 @@ export interface BarChartProps extends Omit<ResponsiveChartContainerProps, 'seri
|
|
|
25
25
|
* The configuration of the tooltip.
|
|
26
26
|
* @see See {@link https://mui.com/x/react-charts/tooltip/ tooltip docs} for more details.
|
|
27
27
|
*/
|
|
28
|
-
tooltip?: ChartsTooltipProps
|
|
28
|
+
tooltip?: ChartsTooltipProps<'bar'>;
|
|
29
29
|
/**
|
|
30
30
|
* Option to display a cartesian grid in the background.
|
|
31
31
|
*/
|
|
@@ -29,6 +29,6 @@ export declare const useBarChartProps: (props: BarChartProps) => {
|
|
|
29
29
|
chartsAxisProps: ChartsAxisProps;
|
|
30
30
|
axisHighlightProps: ChartsAxisHighlightProps;
|
|
31
31
|
legendProps: ChartsLegendProps;
|
|
32
|
-
tooltipProps: ChartsTooltipProps
|
|
32
|
+
tooltipProps: ChartsTooltipProps<"bar">;
|
|
33
33
|
children: import("react").ReactNode;
|
|
34
34
|
};
|
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,146 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 7.10.0
|
|
7
|
+
|
|
8
|
+
_Jul 11, 2024_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 12 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 🎁 Add selectors to support showing child row count in footer in the Data Grid
|
|
13
|
+
- ✨ New APIs for retrieving current item tree and item's children IDs in the Tree View
|
|
14
|
+
- 🌍 Improve Spanish (es-ES) locale on the Data Grid
|
|
15
|
+
- 🐞 Bugfixes
|
|
16
|
+
- 📚 Documentation improvements
|
|
17
|
+
|
|
18
|
+
<!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
|
|
19
|
+
|
|
20
|
+
### Data Grid
|
|
21
|
+
|
|
22
|
+
#### `@mui/x-data-grid@7.10.0`
|
|
23
|
+
|
|
24
|
+
- [DataGrid] Add selectors to support showing child row count in footer (#13725) @KenanYusuf
|
|
25
|
+
- [DataGrid] Fix incorrect panels position when using a toolbar (#13474) @oukunan
|
|
26
|
+
- [DataGrid] Set default variant to `'standard'` in `GridFilterInputMultipleValue` (#13129) @tarunrajput
|
|
27
|
+
- [DataGrid] Use `readonly` on more array props (#13331) @pcorpet
|
|
28
|
+
- [l10n] Improve Spanish (es-ES) locale (#13772) @joserealdev
|
|
29
|
+
|
|
30
|
+
#### `@mui/x-data-grid-pro@7.10.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
31
|
+
|
|
32
|
+
Same changes as in `@mui/x-data-grid@7.10.0`, plus:
|
|
33
|
+
|
|
34
|
+
- [DataGridPro] Keep bottom pinned row at the bottom (#13313) @romgrk
|
|
35
|
+
|
|
36
|
+
#### `@mui/x-data-grid-premium@7.10.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
37
|
+
|
|
38
|
+
Same changes as in `@mui/x-data-grid-pro@7.10.0`.
|
|
39
|
+
|
|
40
|
+
### Date and Time Pickers
|
|
41
|
+
|
|
42
|
+
#### `@mui/x-date-pickers@7.10.0`
|
|
43
|
+
|
|
44
|
+
- [fields] Prevent infinite recursion when ensuring selection (#13779) @LukasTy
|
|
45
|
+
- [fields] Unify fields behavior regardless of the `readOnly` flag (#13688) @LukasTy
|
|
46
|
+
|
|
47
|
+
#### `@mui/x-date-pickers-pro@7.10.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
48
|
+
|
|
49
|
+
Same changes as in `@mui/x-date-pickers@7.10.0`, plus:
|
|
50
|
+
|
|
51
|
+
- [DateRangePicker] Fix `calendarHeader` slot props propagation (#13780) @LukasTy
|
|
52
|
+
- [DateTimeRangePicker] Resolve `format` from given `views` (#13743) @LukasTy
|
|
53
|
+
|
|
54
|
+
### Charts
|
|
55
|
+
|
|
56
|
+
#### `@mui/x-charts@7.10.0`
|
|
57
|
+
|
|
58
|
+
- [charts] Fix displaying area of a `LineChart` when using the `log` scale (#13791) @alexfauquette
|
|
59
|
+
- [charts] Use correct click handler prop on pie chart `OnSeriesItemClick` documentation (#13761) @tonyhallett
|
|
60
|
+
|
|
61
|
+
### Tree View
|
|
62
|
+
|
|
63
|
+
#### `@mui/x-tree-view@7.10.0`
|
|
64
|
+
|
|
65
|
+
- [TreeView] Add `getItemTree` and `getItemOrderedChildrenIds` methods to the public API (#13804) @flaviendelangle
|
|
66
|
+
- [TreeView] Add utility function to check if an optional plugin is present (#13788) @flaviendelangle
|
|
67
|
+
|
|
68
|
+
### Docs
|
|
69
|
+
|
|
70
|
+
- [docs] Add missing default `loading` prop value (#13604) @oliviertassinari
|
|
71
|
+
- [docs] Add the `DateTimeRangePicker` to the "Commonly used components" demo (#13775) @flaviendelangle
|
|
72
|
+
- [docs] Fix Pickers customization playground overflow (#13742) @LukasTy
|
|
73
|
+
- [docs] Move Pickers dialog guidelines to accessibility page (#13778) @arthurbalduini
|
|
74
|
+
|
|
75
|
+
### Core
|
|
76
|
+
|
|
77
|
+
- [core] Sort `DATA_GRID_PROPS_DEFAULT_VALUES` alphabetically (#13783) @oliviertassinari
|
|
78
|
+
- [test] Fix split infinitive use in tests @oliviertassinari
|
|
79
|
+
|
|
80
|
+
## 7.9.0
|
|
81
|
+
|
|
82
|
+
_Jul 5, 2024_
|
|
83
|
+
|
|
84
|
+
We'd like to offer a big thanks to the 7 contributors who made this release possible. Here are some highlights ✨:
|
|
85
|
+
|
|
86
|
+
- 🔄 Add loading overlay variants, including a skeleton loader option to the Data Grid component. See [Loading overlay docs](https://mui.com/x/react-data-grid/overlays/#loading-overlay) for more details.
|
|
87
|
+
- 🌳 Add `selectItem` and `getItemDOMElement` methods to the TreeView component public API
|
|
88
|
+
- ⛏️ Make the `usePickersTranslations` hook public in the pickers component
|
|
89
|
+
- 🐞 Bugfixes
|
|
90
|
+
|
|
91
|
+
<!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
|
|
92
|
+
|
|
93
|
+
### Data Grid
|
|
94
|
+
|
|
95
|
+
#### `@mui/x-data-grid@7.9.0`
|
|
96
|
+
|
|
97
|
+
- [DataGrid] Add skeleton loading overlay support (#13293) @KenanYusuf
|
|
98
|
+
- [DataGrid] Fix pagination when `pagination={undefined}` (#13349) @sai6855
|
|
99
|
+
|
|
100
|
+
#### `@mui/x-data-grid-pro@7.9.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
101
|
+
|
|
102
|
+
Same changes as in `@mui/x-data-grid@7.9.0`.
|
|
103
|
+
|
|
104
|
+
#### `@mui/x-data-grid-premium@7.9.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
105
|
+
|
|
106
|
+
Same changes as in `@mui/x-data-grid-pro@7.9.0`.
|
|
107
|
+
|
|
108
|
+
### Date and Time Pickers
|
|
109
|
+
|
|
110
|
+
#### `@mui/x-date-pickers@7.9.0`
|
|
111
|
+
|
|
112
|
+
- [pickers] Make the `usePickersTranslations` hook public (#13657) @flaviendelangle
|
|
113
|
+
|
|
114
|
+
#### `@mui/x-date-pickers-pro@7.9.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
115
|
+
|
|
116
|
+
Same changes as in `@mui/x-date-pickers@7.9.0`.
|
|
117
|
+
|
|
118
|
+
### Charts
|
|
119
|
+
|
|
120
|
+
#### `@mui/x-charts@7.9.0`
|
|
121
|
+
|
|
122
|
+
- [charts] Add Heatmap (unreleased) (#13209) @alexfauquette
|
|
123
|
+
- [charts] Add initial `Zoom&Pan` to the Pro charts (unreleased) (#13405) @JCQuintas
|
|
124
|
+
- [charts] Fix Axis Highlight on horizontal bar charts regression (#13717) @JCQuintas
|
|
125
|
+
- [charts] Improve charts interaction for mobile users (#13692) @JCQuintas
|
|
126
|
+
- [charts] Add documentation on how to disable the tooltip on charts (#13724) @JCQuintas
|
|
127
|
+
|
|
128
|
+
### Tree View
|
|
129
|
+
|
|
130
|
+
#### `@mui/x-tree-view@7.9.0`
|
|
131
|
+
|
|
132
|
+
- [TreeView] Add `selectItem` and `getItemDOMElement` methods to the public API (#13485) @flaviendelangle
|
|
133
|
+
|
|
134
|
+
### Docs
|
|
135
|
+
|
|
136
|
+
- [docs] Fix custom "no results overlay" demo in dark mode (#13715) @KenanYusuf
|
|
137
|
+
|
|
138
|
+
### Core
|
|
139
|
+
|
|
140
|
+
- [core] Add `react_next` workflow in CircleCI (#13360) @cherniavskii
|
|
141
|
+
- [core] Create a new package to share utils across X packages (#13528) @flaviendelangle
|
|
142
|
+
- [core] Fix dependency setup (#13684) @LukasTy
|
|
143
|
+
- [core] Remove `jscodeshift-add-imports` package (#13720) @LukasTy
|
|
144
|
+
- [code-infra] Cleanup monorepo and `@mui/docs` usage (#13713) @LukasTy
|
|
145
|
+
|
|
6
146
|
## 7.8.0
|
|
7
147
|
|
|
8
148
|
_Jun 28, 2024_
|
|
@@ -292,6 +292,8 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
|
|
|
292
292
|
})]),
|
|
293
293
|
data: _propTypes.default.array,
|
|
294
294
|
dataKey: _propTypes.default.string,
|
|
295
|
-
id: _propTypes.default.string
|
|
295
|
+
id: _propTypes.default.string,
|
|
296
|
+
max: _propTypes.default.number,
|
|
297
|
+
min: _propTypes.default.number
|
|
296
298
|
}))
|
|
297
299
|
} : void 0;
|
|
@@ -97,7 +97,7 @@ function ChartsAxisHighlight(props) {
|
|
|
97
97
|
ownerState: {
|
|
98
98
|
axisHighlight: 'band'
|
|
99
99
|
}
|
|
100
|
-
}), isBandScaleY && yScale(axisY.value)
|
|
100
|
+
}), isBandScaleY && yScale(axisY.value) !== undefined && /*#__PURE__*/(0, _jsxRuntime.jsx)(ChartsAxisHighlightPath, {
|
|
101
101
|
d: `M ${xScale.range()[0]} ${
|
|
102
102
|
// @ts-expect-error, yScale value is checked in the statement above
|
|
103
103
|
yScale(axisY.value) - (yScale.step() - yScale.bandwidth()) / 2} l 0 ${yScale.step()} l ${xScale.range()[1] - xScale.range()[0]} 0 l 0 ${-yScale.step()} Z`,
|
package/ChartsSurface.js
CHANGED
|
@@ -18,7 +18,11 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
18
18
|
const ChartChartsSurfaceStyles = (0, _styles.styled)('svg', {
|
|
19
19
|
name: 'MuiChartsSurface',
|
|
20
20
|
slot: 'Root'
|
|
21
|
-
})(() => ({
|
|
21
|
+
})(() => ({
|
|
22
|
+
// This prevents default touch actions when using the svg on mobile devices.
|
|
23
|
+
// For example, prevent page scroll & zoom.
|
|
24
|
+
touchAction: 'none'
|
|
25
|
+
}));
|
|
22
26
|
const ChartsSurface = exports.ChartsSurface = /*#__PURE__*/React.forwardRef(function ChartsSurface(props, ref) {
|
|
23
27
|
const {
|
|
24
28
|
children,
|
|
@@ -34,6 +34,9 @@ export type ChartsAxisContentProps = {
|
|
|
34
34
|
classes: ChartsTooltipClasses;
|
|
35
35
|
sx?: SxProps<Theme>;
|
|
36
36
|
};
|
|
37
|
+
/**
|
|
38
|
+
* @ignore - internal component.
|
|
39
|
+
*/
|
|
37
40
|
declare function ChartsAxisTooltipContent(props: {
|
|
38
41
|
axisData: AxisInteractionData;
|
|
39
42
|
content?: React.ElementType<ChartsAxisContentProps>;
|
|
@@ -41,7 +44,4 @@ declare function ChartsAxisTooltipContent(props: {
|
|
|
41
44
|
sx?: SxProps<Theme>;
|
|
42
45
|
classes: ChartsAxisContentProps['classes'];
|
|
43
46
|
}): React.JSX.Element;
|
|
44
|
-
declare namespace ChartsAxisTooltipContent {
|
|
45
|
-
var propTypes: any;
|
|
46
|
-
}
|
|
47
47
|
export { ChartsAxisTooltipContent };
|
|
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.ChartsAxisTooltipContent = ChartsAxisTooltipContent;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var React = _interopRequireWildcard(require("react"));
|
|
10
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
10
|
var _utils = require("@mui/base/utils");
|
|
12
11
|
var _CartesianProvider = require("../context/CartesianProvider");
|
|
13
12
|
var _DefaultChartsAxisTooltipContent = require("./DefaultChartsAxisTooltipContent");
|
|
@@ -18,6 +17,9 @@ var _useSeries = require("../hooks/useSeries");
|
|
|
18
17
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
18
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
20
19
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
20
|
+
/**
|
|
21
|
+
* @ignore - internal component.
|
|
22
|
+
*/
|
|
21
23
|
function ChartsAxisTooltipContent(props) {
|
|
22
24
|
const {
|
|
23
25
|
content,
|
|
@@ -79,41 +81,4 @@ function ChartsAxisTooltipContent(props) {
|
|
|
79
81
|
ownerState: {}
|
|
80
82
|
});
|
|
81
83
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Content, (0, _extends2.default)({}, chartTooltipContentProps));
|
|
82
|
-
}
|
|
83
|
-
process.env.NODE_ENV !== "production" ? ChartsAxisTooltipContent.propTypes = {
|
|
84
|
-
// ----------------------------- Warning --------------------------------
|
|
85
|
-
// | These PropTypes are generated from the TypeScript type definitions |
|
|
86
|
-
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
87
|
-
// ----------------------------------------------------------------------
|
|
88
|
-
axisData: _propTypes.default.shape({
|
|
89
|
-
x: _propTypes.default.shape({
|
|
90
|
-
index: _propTypes.default.number,
|
|
91
|
-
value: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number, _propTypes.default.string]).isRequired
|
|
92
|
-
}),
|
|
93
|
-
y: _propTypes.default.shape({
|
|
94
|
-
index: _propTypes.default.number,
|
|
95
|
-
value: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number, _propTypes.default.string]).isRequired
|
|
96
|
-
})
|
|
97
|
-
}).isRequired,
|
|
98
|
-
classes: _propTypes.default.object.isRequired,
|
|
99
|
-
content: _propTypes.default.elementType,
|
|
100
|
-
contentProps: _propTypes.default.shape({
|
|
101
|
-
axis: _propTypes.default.object,
|
|
102
|
-
axisData: _propTypes.default.shape({
|
|
103
|
-
x: _propTypes.default.shape({
|
|
104
|
-
index: _propTypes.default.number,
|
|
105
|
-
value: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number, _propTypes.default.string]).isRequired
|
|
106
|
-
}),
|
|
107
|
-
y: _propTypes.default.shape({
|
|
108
|
-
index: _propTypes.default.number,
|
|
109
|
-
value: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number, _propTypes.default.string]).isRequired
|
|
110
|
-
})
|
|
111
|
-
}),
|
|
112
|
-
axisValue: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number, _propTypes.default.string]),
|
|
113
|
-
classes: _propTypes.default.object,
|
|
114
|
-
dataIndex: _propTypes.default.number,
|
|
115
|
-
series: _propTypes.default.arrayOf(_propTypes.default.object),
|
|
116
|
-
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object])
|
|
117
|
-
}),
|
|
118
|
-
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object])
|
|
119
|
-
} : void 0;
|
|
84
|
+
}
|
|
@@ -3,7 +3,7 @@ import { SxProps, Theme } from '@mui/material/styles';
|
|
|
3
3
|
import { ItemInteractionData } from '../context/InteractionProvider';
|
|
4
4
|
import { ChartSeriesDefaultized, ChartSeriesType } from '../models/seriesType/config';
|
|
5
5
|
import { ChartsTooltipClasses } from './chartsTooltipClasses';
|
|
6
|
-
export
|
|
6
|
+
export interface ChartsItemContentProps<T extends ChartSeriesType> {
|
|
7
7
|
/**
|
|
8
8
|
* The data used to identify the triggered item.
|
|
9
9
|
*/
|
|
@@ -23,15 +23,16 @@ export type ChartsItemContentProps<T extends ChartSeriesType = ChartSeriesType>
|
|
|
23
23
|
*/
|
|
24
24
|
getColor: (dataIndex: number) => string;
|
|
25
25
|
sx?: SxProps<Theme>;
|
|
26
|
-
}
|
|
27
|
-
|
|
26
|
+
}
|
|
27
|
+
export interface ChartsItemTooltipContentProps<T extends ChartSeriesType> {
|
|
28
28
|
itemData: ItemInteractionData<T>;
|
|
29
29
|
content?: React.ElementType<ChartsItemContentProps<T>>;
|
|
30
30
|
contentProps?: Partial<ChartsItemContentProps<T>>;
|
|
31
31
|
sx?: SxProps<Theme>;
|
|
32
32
|
classes: ChartsItemContentProps<T>['classes'];
|
|
33
|
-
}): React.JSX.Element;
|
|
34
|
-
declare namespace ChartsItemTooltipContent {
|
|
35
|
-
var propTypes: any;
|
|
36
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* @ignore - internal component.
|
|
36
|
+
*/
|
|
37
|
+
declare function ChartsItemTooltipContent<T extends ChartSeriesType>(props: ChartsItemTooltipContentProps<T>): React.JSX.Element;
|
|
37
38
|
export { ChartsItemTooltipContent };
|
|
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.ChartsItemTooltipContent = ChartsItemTooltipContent;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var React = _interopRequireWildcard(require("react"));
|
|
10
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
10
|
var _utils = require("@mui/base/utils");
|
|
12
11
|
var _DefaultChartsItemTooltipContent = require("./DefaultChartsItemTooltipContent");
|
|
13
12
|
var _CartesianProvider = require("../context/CartesianProvider");
|
|
@@ -17,6 +16,9 @@ var _useSeries = require("../hooks/useSeries");
|
|
|
17
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
17
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
19
18
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
19
|
+
/**
|
|
20
|
+
* @ignore - internal component.
|
|
21
|
+
*/
|
|
20
22
|
function ChartsItemTooltipContent(props) {
|
|
21
23
|
const {
|
|
22
24
|
content,
|
|
@@ -55,29 +57,4 @@ function ChartsItemTooltipContent(props) {
|
|
|
55
57
|
ownerState: {}
|
|
56
58
|
});
|
|
57
59
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Content, (0, _extends2.default)({}, chartTooltipContentProps));
|
|
58
|
-
}
|
|
59
|
-
process.env.NODE_ENV !== "production" ? ChartsItemTooltipContent.propTypes = {
|
|
60
|
-
// ----------------------------- Warning --------------------------------
|
|
61
|
-
// | These PropTypes are generated from the TypeScript type definitions |
|
|
62
|
-
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
63
|
-
// ----------------------------------------------------------------------
|
|
64
|
-
classes: _propTypes.default.object.isRequired,
|
|
65
|
-
content: _propTypes.default.elementType,
|
|
66
|
-
contentProps: _propTypes.default.shape({
|
|
67
|
-
classes: _propTypes.default.object,
|
|
68
|
-
getColor: _propTypes.default.func,
|
|
69
|
-
itemData: _propTypes.default.shape({
|
|
70
|
-
dataIndex: _propTypes.default.number,
|
|
71
|
-
seriesId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
|
|
72
|
-
type: _propTypes.default.oneOf(['bar', 'line', 'pie', 'scatter']).isRequired
|
|
73
|
-
}),
|
|
74
|
-
series: _propTypes.default.object,
|
|
75
|
-
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object])
|
|
76
|
-
}),
|
|
77
|
-
itemData: _propTypes.default.shape({
|
|
78
|
-
dataIndex: _propTypes.default.number,
|
|
79
|
-
seriesId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
|
|
80
|
-
type: _propTypes.default.oneOf(['bar', 'line', 'pie', 'scatter']).isRequired
|
|
81
|
-
}).isRequired,
|
|
82
|
-
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object])
|
|
83
|
-
} : void 0;
|
|
60
|
+
}
|
|
@@ -2,6 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { SxProps, Theme } from '@mui/material/styles';
|
|
3
3
|
import { PopperProps as BasePopperProps } from '@mui/base/Popper';
|
|
4
4
|
import { TriggerOptions } from './utils';
|
|
5
|
+
import { ChartSeriesType } from '../models/seriesType/config';
|
|
5
6
|
import { ChartsItemContentProps } from './ChartsItemTooltipContent';
|
|
6
7
|
import { ChartsAxisContentProps } from './ChartsAxisTooltipContent';
|
|
7
8
|
import { ChartsTooltipClasses } from './chartsTooltipClasses';
|
|
@@ -11,7 +12,7 @@ export type PopperProps = BasePopperProps & {
|
|
|
11
12
|
*/
|
|
12
13
|
sx?: SxProps<Theme>;
|
|
13
14
|
};
|
|
14
|
-
export interface ChartsTooltipSlots {
|
|
15
|
+
export interface ChartsTooltipSlots<T extends ChartSeriesType> {
|
|
15
16
|
/**
|
|
16
17
|
* Custom component for the tooltip popper.
|
|
17
18
|
* @default ChartsTooltipRoot
|
|
@@ -26,14 +27,14 @@ export interface ChartsTooltipSlots {
|
|
|
26
27
|
* Custom component for displaying tooltip content when triggered by item event.
|
|
27
28
|
* @default DefaultChartsItemTooltipContent
|
|
28
29
|
*/
|
|
29
|
-
itemContent?: React.ElementType<ChartsItemContentProps
|
|
30
|
+
itemContent?: React.ElementType<ChartsItemContentProps<T>>;
|
|
30
31
|
}
|
|
31
|
-
export interface ChartsTooltipSlotProps {
|
|
32
|
+
export interface ChartsTooltipSlotProps<T extends ChartSeriesType> {
|
|
32
33
|
popper?: Partial<PopperProps>;
|
|
33
34
|
axisContent?: Partial<ChartsAxisContentProps>;
|
|
34
|
-
itemContent?: Partial<ChartsItemContentProps
|
|
35
|
+
itemContent?: Partial<ChartsItemContentProps<T>>;
|
|
35
36
|
}
|
|
36
|
-
export
|
|
37
|
+
export interface ChartsTooltipProps<T extends ChartSeriesType> {
|
|
37
38
|
/**
|
|
38
39
|
* Select the kind of tooltip to display
|
|
39
40
|
* - 'item': Shows data about the item below the mouse.
|
|
@@ -60,13 +61,13 @@ export type ChartsTooltipProps = {
|
|
|
60
61
|
* Overridable component slots.
|
|
61
62
|
* @default {}
|
|
62
63
|
*/
|
|
63
|
-
slots?: ChartsTooltipSlots
|
|
64
|
+
slots?: ChartsTooltipSlots<T>;
|
|
64
65
|
/**
|
|
65
66
|
* The props used for each component slot.
|
|
66
67
|
* @default {}
|
|
67
68
|
*/
|
|
68
|
-
slotProps?: ChartsTooltipSlotProps
|
|
69
|
-
}
|
|
69
|
+
slotProps?: ChartsTooltipSlotProps<T>;
|
|
70
|
+
}
|
|
70
71
|
/**
|
|
71
72
|
* Demos:
|
|
72
73
|
*
|
|
@@ -76,7 +77,7 @@ export type ChartsTooltipProps = {
|
|
|
76
77
|
*
|
|
77
78
|
* - [ChartsTooltip API](https://mui.com/x/api/charts/charts-tool-tip/)
|
|
78
79
|
*/
|
|
79
|
-
declare function ChartsTooltip(props: ChartsTooltipProps): React.JSX.Element | null;
|
|
80
|
+
declare function ChartsTooltip<T extends ChartSeriesType>(props: ChartsTooltipProps<T>): React.JSX.Element | null;
|
|
80
81
|
declare namespace ChartsTooltip {
|
|
81
82
|
var propTypes: any;
|
|
82
83
|
}
|
|
@@ -86,8 +86,14 @@ function ChartsTooltip(props) {
|
|
|
86
86
|
externalSlotProps: slotProps?.popper,
|
|
87
87
|
additionalProps: {
|
|
88
88
|
open: popperOpen,
|
|
89
|
-
placement: 'right-start',
|
|
90
|
-
anchorEl: (0, _utils2.generateVirtualElement)(mousePosition)
|
|
89
|
+
placement: mousePosition?.pointerType === 'mouse' ? 'right-start' : 'top',
|
|
90
|
+
anchorEl: (0, _utils2.generateVirtualElement)(mousePosition),
|
|
91
|
+
modifiers: [{
|
|
92
|
+
name: 'offset',
|
|
93
|
+
options: {
|
|
94
|
+
offset: [0, mousePosition?.pointerType === 'touch' ? 40 - mousePosition.height : 0]
|
|
95
|
+
}
|
|
96
|
+
}]
|
|
91
97
|
},
|
|
92
98
|
ownerState: {}
|
|
93
99
|
});
|
|
@@ -1,7 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @ignore - internal component.
|
|
3
|
+
*/
|
|
1
4
|
export declare const ChartsTooltipPaper: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import("react").ClassAttributes<HTMLDivElement> | keyof import("react").HTMLAttributes<HTMLDivElement>>, {}>;
|
|
5
|
+
/**
|
|
6
|
+
* @ignore - internal component.
|
|
7
|
+
*/
|
|
2
8
|
export declare const ChartsTooltipTable: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, Pick<import("react").DetailedHTMLProps<import("react").TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>, keyof import("react").ClassAttributes<HTMLTableElement> | keyof import("react").TableHTMLAttributes<HTMLTableElement>>, {}>;
|
|
9
|
+
/**
|
|
10
|
+
* @ignore - internal component.
|
|
11
|
+
*/
|
|
3
12
|
export declare const ChartsTooltipRow: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>, keyof import("react").ClassAttributes<HTMLTableRowElement> | keyof import("react").HTMLAttributes<HTMLTableRowElement>>, {}>;
|
|
13
|
+
/**
|
|
14
|
+
* @ignore - internal component.
|
|
15
|
+
*/
|
|
4
16
|
export declare const ChartsTooltipCell: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, Pick<import("react").DetailedHTMLProps<import("react").TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement>, keyof import("react").ClassAttributes<HTMLTableDataCellElement> | keyof import("react").TdHTMLAttributes<HTMLTableDataCellElement>>, {}>;
|
|
17
|
+
/**
|
|
18
|
+
* @ignore - internal component.
|
|
19
|
+
*/
|
|
5
20
|
export declare const ChartsTooltipMark: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
|
|
6
21
|
color: string;
|
|
7
22
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
@@ -7,6 +7,9 @@ exports.ChartsTooltipTable = exports.ChartsTooltipRow = exports.ChartsTooltipPap
|
|
|
7
7
|
var _styles = require("@mui/material/styles");
|
|
8
8
|
var _system = require("@mui/system");
|
|
9
9
|
var _chartsTooltipClasses = require("./chartsTooltipClasses");
|
|
10
|
+
/**
|
|
11
|
+
* @ignore - internal component.
|
|
12
|
+
*/
|
|
10
13
|
const ChartsTooltipPaper = exports.ChartsTooltipPaper = (0, _styles.styled)('div', {
|
|
11
14
|
name: 'MuiChartsTooltip',
|
|
12
15
|
slot: 'Container'
|
|
@@ -19,6 +22,10 @@ const ChartsTooltipPaper = exports.ChartsTooltipPaper = (0, _styles.styled)('div
|
|
|
19
22
|
transition: theme.transitions.create('box-shadow'),
|
|
20
23
|
borderRadius: theme.shape.borderRadius
|
|
21
24
|
}));
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @ignore - internal component.
|
|
28
|
+
*/
|
|
22
29
|
const ChartsTooltipTable = exports.ChartsTooltipTable = (0, _styles.styled)('table', {
|
|
23
30
|
name: 'MuiChartsTooltip',
|
|
24
31
|
slot: 'Table'
|
|
@@ -30,6 +37,10 @@ const ChartsTooltipTable = exports.ChartsTooltipTable = (0, _styles.styled)('tab
|
|
|
30
37
|
borderBottom: `solid ${(theme.vars || theme).palette.divider} 1px`
|
|
31
38
|
}
|
|
32
39
|
}));
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @ignore - internal component.
|
|
43
|
+
*/
|
|
33
44
|
const ChartsTooltipRow = exports.ChartsTooltipRow = (0, _styles.styled)('tr', {
|
|
34
45
|
name: 'MuiChartsTooltip',
|
|
35
46
|
slot: 'Row'
|
|
@@ -43,6 +54,10 @@ const ChartsTooltipRow = exports.ChartsTooltipRow = (0, _styles.styled)('tr', {
|
|
|
43
54
|
paddingBottom: theme.spacing(1)
|
|
44
55
|
}
|
|
45
56
|
}));
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* @ignore - internal component.
|
|
60
|
+
*/
|
|
46
61
|
const ChartsTooltipCell = exports.ChartsTooltipCell = (0, _styles.styled)('td', {
|
|
47
62
|
name: 'MuiChartsTooltip',
|
|
48
63
|
slot: 'Cell'
|
|
@@ -65,6 +80,10 @@ const ChartsTooltipCell = exports.ChartsTooltipCell = (0, _styles.styled)('td',
|
|
|
65
80
|
paddingRight: theme.spacing(2)
|
|
66
81
|
}
|
|
67
82
|
}));
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* @ignore - internal component.
|
|
86
|
+
*/
|
|
68
87
|
const ChartsTooltipMark = exports.ChartsTooltipMark = (0, _styles.styled)('div', {
|
|
69
88
|
name: 'MuiChartsTooltip',
|
|
70
89
|
slot: 'Mark',
|
package/ChartsTooltip/index.d.ts
CHANGED
package/ChartsTooltip/index.js
CHANGED
|
@@ -68,4 +68,15 @@ Object.keys(_DefaultChartsItemTooltipContent).forEach(function (key) {
|
|
|
68
68
|
return _DefaultChartsItemTooltipContent[key];
|
|
69
69
|
}
|
|
70
70
|
});
|
|
71
|
+
});
|
|
72
|
+
var _ChartsTooltipTable = require("./ChartsTooltipTable");
|
|
73
|
+
Object.keys(_ChartsTooltipTable).forEach(function (key) {
|
|
74
|
+
if (key === "default" || key === "__esModule") return;
|
|
75
|
+
if (key in exports && exports[key] === _ChartsTooltipTable[key]) return;
|
|
76
|
+
Object.defineProperty(exports, key, {
|
|
77
|
+
enumerable: true,
|
|
78
|
+
get: function () {
|
|
79
|
+
return _ChartsTooltipTable[key];
|
|
80
|
+
}
|
|
81
|
+
});
|
|
71
82
|
});
|
package/ChartsTooltip/utils.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { AxisInteractionData, ItemInteractionData } from '../context/InteractionProvider';
|
|
2
2
|
import { ChartSeriesType } from '../models/seriesType/config';
|
|
3
|
-
|
|
3
|
+
type MousePosition = {
|
|
4
4
|
x: number;
|
|
5
5
|
y: number;
|
|
6
|
-
|
|
6
|
+
pointerType: 'mouse' | 'touch' | 'pen';
|
|
7
|
+
height: number;
|
|
8
|
+
};
|
|
9
|
+
export declare function generateVirtualElement(mousePosition: MousePosition | null): {
|
|
7
10
|
getBoundingClientRect: () => {
|
|
8
11
|
width: number;
|
|
9
12
|
height: number;
|
|
@@ -16,10 +19,8 @@ export declare function generateVirtualElement(mousePosition: {
|
|
|
16
19
|
toJSON: () => string;
|
|
17
20
|
};
|
|
18
21
|
};
|
|
19
|
-
export declare function useMouseTracker():
|
|
20
|
-
x: number;
|
|
21
|
-
y: number;
|
|
22
|
-
} | null;
|
|
22
|
+
export declare function useMouseTracker(): MousePosition | null;
|
|
23
23
|
export type TriggerOptions = 'item' | 'axis' | 'none';
|
|
24
24
|
export declare function getTooltipHasData(trigger: TriggerOptions, displayedData: null | AxisInteractionData | ItemInteractionData<ChartSeriesType>): boolean;
|
|
25
25
|
export declare function utcFormatter(v: string | number | Date): string;
|
|
26
|
+
export {};
|