@mui/x-charts-pro 9.0.0-alpha.3 → 9.0.0-alpha.4
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/BarChartPro/BarChartPro.d.mts +2 -2
- package/BarChartPro/BarChartPro.d.ts +2 -2
- package/BarChartPro/BarChartPro.js +38 -8
- package/BarChartPro/BarChartPro.mjs +38 -8
- package/CHANGELOG.md +123 -0
- package/ChartsContainerPro/ChartsContainerPro.js +2 -2
- package/ChartsContainerPro/ChartsContainerPro.mjs +2 -2
- package/ChartsContainerPro/useChartsContainerProProps.d.mts +2 -2
- package/ChartsContainerPro/useChartsContainerProProps.d.ts +2 -2
- package/ChartsContainerPro/useChartsContainerProProps.js +3 -3
- package/ChartsContainerPro/useChartsContainerProProps.mjs +3 -3
- package/ChartsDataProviderPro/ChartsDataProviderPro.js +2 -8
- package/ChartsDataProviderPro/ChartsDataProviderPro.mjs +2 -8
- package/ChartsToolbarPro/ChartsToolbarPro.js +1 -1
- package/ChartsToolbarPro/ChartsToolbarPro.mjs +2 -2
- package/ChartsToolbarPro/ChartsToolbarZoomInTrigger.js +1 -1
- package/ChartsToolbarPro/ChartsToolbarZoomInTrigger.mjs +2 -2
- package/ChartsToolbarPro/ChartsToolbarZoomOutTrigger.js +1 -1
- package/ChartsToolbarPro/ChartsToolbarZoomOutTrigger.mjs +2 -2
- package/ChartsToolbarPro/index.d.mts +2 -1
- package/ChartsToolbarPro/index.d.ts +2 -1
- package/ChartsToolbarPro/index.mjs +2 -1
- package/ChartsZoomSlider/internals/ChartsAxisZoomSliderActiveTrack.js +1 -1
- package/ChartsZoomSlider/internals/ChartsAxisZoomSliderActiveTrack.mjs +2 -2
- package/ChartsZoomSlider/internals/ChartsAxisZoomSliderTrack.js +1 -1
- package/ChartsZoomSlider/internals/ChartsAxisZoomSliderTrack.mjs +2 -2
- package/FunnelChart/FunnelChart.d.mts +2 -2
- package/FunnelChart/FunnelChart.d.ts +2 -2
- package/FunnelChart/FunnelChart.js +18 -6
- package/FunnelChart/FunnelChart.mjs +18 -6
- package/FunnelChart/FunnelPlot.js +8 -3
- package/FunnelChart/FunnelPlot.mjs +8 -3
- package/FunnelChart/FunnelSection.d.mts +3 -3
- package/FunnelChart/FunnelSection.d.ts +3 -3
- package/FunnelChart/FunnelSection.js +5 -5
- package/FunnelChart/FunnelSection.mjs +4 -4
- package/FunnelChart/FunnelSectionLabel.d.mts +9 -3
- package/FunnelChart/FunnelSectionLabel.d.ts +9 -3
- package/FunnelChart/FunnelSectionLabel.js +15 -6
- package/FunnelChart/FunnelSectionLabel.mjs +15 -6
- package/FunnelChart/funnelClasses.d.mts +29 -0
- package/FunnelChart/funnelClasses.d.ts +29 -0
- package/FunnelChart/funnelClasses.js +29 -0
- package/FunnelChart/funnelClasses.mjs +19 -0
- package/FunnelChart/index.d.mts +2 -2
- package/FunnelChart/index.d.ts +2 -2
- package/FunnelChart/index.js +4 -4
- package/FunnelChart/index.mjs +1 -1
- package/FunnelChart/seriesConfig/legend.js +0 -2
- package/FunnelChart/seriesConfig/legend.mjs +0 -2
- package/FunnelChart/useFunnelChartProps.d.mts +2 -2
- package/FunnelChart/useFunnelChartProps.d.ts +2 -2
- package/FunnelChart/useFunnelChartProps.js +2 -2
- package/FunnelChart/useFunnelChartProps.mjs +2 -2
- package/Heatmap/Heatmap.d.mts +2 -11
- package/Heatmap/Heatmap.d.ts +2 -11
- package/Heatmap/Heatmap.js +20 -15
- package/Heatmap/Heatmap.mjs +20 -15
- package/Heatmap/HeatmapCell.d.mts +33 -0
- package/Heatmap/HeatmapCell.d.ts +33 -0
- package/Heatmap/HeatmapCell.js +62 -0
- package/Heatmap/HeatmapCell.mjs +55 -0
- package/Heatmap/HeatmapItem.d.mts +1 -9
- package/Heatmap/HeatmapItem.d.ts +1 -9
- package/Heatmap/HeatmapItem.js +5 -22
- package/Heatmap/HeatmapItem.mjs +5 -22
- package/Heatmap/HeatmapSVGPlot.js +10 -3
- package/Heatmap/HeatmapSVGPlot.mjs +10 -3
- package/Heatmap/HeatmapTooltip/HeatmapTooltip.classes.js +2 -2
- package/Heatmap/HeatmapTooltip/HeatmapTooltip.classes.mjs +1 -1
- package/Heatmap/heatmapClasses.d.mts +6 -1
- package/Heatmap/heatmapClasses.d.ts +6 -1
- package/Heatmap/heatmapClasses.js +18 -3
- package/Heatmap/heatmapClasses.mjs +16 -2
- package/Heatmap/index.d.mts +4 -2
- package/Heatmap/index.d.ts +4 -2
- package/Heatmap/index.js +17 -13
- package/Heatmap/index.mjs +2 -1
- package/Heatmap/shouldRegisterPointerInteractionsGlobally.js +1 -1
- package/Heatmap/shouldRegisterPointerInteractionsGlobally.mjs +1 -1
- package/Heatmap/useHeatmapProps.d.mts +2 -2
- package/Heatmap/useHeatmapProps.d.ts +2 -2
- package/Heatmap/useHeatmapProps.js +2 -4
- package/Heatmap/useHeatmapProps.mjs +2 -4
- package/LineChartPro/LineChartPro.d.mts +2 -2
- package/LineChartPro/LineChartPro.d.ts +2 -2
- package/LineChartPro/LineChartPro.js +35 -11
- package/LineChartPro/LineChartPro.mjs +35 -11
- package/PieChartPro/PieChartPro.d.mts +2 -2
- package/PieChartPro/PieChartPro.d.ts +2 -2
- package/PieChartPro/PieChartPro.js +17 -5
- package/PieChartPro/PieChartPro.mjs +17 -5
- package/RadarChartPro/RadarChartPro.d.mts +1 -1
- package/RadarChartPro/RadarChartPro.d.ts +1 -1
- package/RadarChartPro/RadarChartPro.js +15 -0
- package/RadarChartPro/RadarChartPro.mjs +15 -0
- package/SankeyChart/SankeyChart.d.mts +2 -2
- package/SankeyChart/SankeyChart.d.ts +2 -2
- package/SankeyChart/SankeyChart.js +16 -10
- package/SankeyChart/SankeyChart.mjs +16 -10
- package/SankeyChart/SankeyDataProvider.d.mts +2 -2
- package/SankeyChart/SankeyDataProvider.d.ts +2 -2
- package/SankeyChart/SankeyDataProvider.js +2 -2
- package/SankeyChart/SankeyDataProvider.mjs +2 -2
- package/SankeyChart/SankeyLinkElement.js +3 -0
- package/SankeyChart/SankeyLinkElement.mjs +3 -0
- package/SankeyChart/SankeyLinkLabel.js +3 -0
- package/SankeyChart/SankeyLinkLabel.mjs +3 -0
- package/SankeyChart/SankeyLinkLabelPlot.d.mts +2 -2
- package/SankeyChart/SankeyLinkLabelPlot.d.ts +2 -2
- package/SankeyChart/SankeyLinkLabelPlot.js +1 -1
- package/SankeyChart/SankeyLinkLabelPlot.mjs +1 -1
- package/SankeyChart/SankeyLinkPlot.d.mts +2 -2
- package/SankeyChart/SankeyLinkPlot.d.ts +2 -2
- package/SankeyChart/SankeyLinkPlot.js +1 -1
- package/SankeyChart/SankeyLinkPlot.mjs +1 -1
- package/SankeyChart/SankeyNodeElement.d.mts +1 -1
- package/SankeyChart/SankeyNodeElement.d.ts +1 -1
- package/SankeyChart/SankeyNodeElement.js +16 -15
- package/SankeyChart/SankeyNodeElement.mjs +16 -15
- package/SankeyChart/SankeyNodeLabel.js +3 -0
- package/SankeyChart/SankeyNodeLabel.mjs +3 -0
- package/SankeyChart/SankeyNodeLabelPlot.d.mts +2 -2
- package/SankeyChart/SankeyNodeLabelPlot.d.ts +2 -2
- package/SankeyChart/SankeyNodeLabelPlot.js +1 -1
- package/SankeyChart/SankeyNodeLabelPlot.mjs +1 -1
- package/SankeyChart/SankeyNodePlot.d.mts +2 -2
- package/SankeyChart/SankeyNodePlot.d.ts +2 -2
- package/SankeyChart/SankeyNodePlot.js +1 -1
- package/SankeyChart/SankeyNodePlot.mjs +1 -1
- package/SankeyChart/SankeyPlot.d.mts +2 -2
- package/SankeyChart/SankeyPlot.d.ts +2 -2
- package/SankeyChart/SankeyPlot.js +3 -3
- package/SankeyChart/SankeyPlot.mjs +3 -3
- package/SankeyChart/SankeyTooltip/SankeyTooltip.classes.js +2 -2
- package/SankeyChart/SankeyTooltip/SankeyTooltip.classes.mjs +1 -1
- package/SankeyChart/index.d.mts +2 -1
- package/SankeyChart/index.d.ts +2 -1
- package/SankeyChart/index.js +3 -3
- package/SankeyChart/index.mjs +1 -1
- package/SankeyChart/sankeyClasses.d.mts +15 -6
- package/SankeyChart/sankeyClasses.d.ts +15 -6
- package/SankeyChart/sankeyClasses.js +12 -8
- package/SankeyChart/sankeyClasses.mjs +10 -6
- package/SankeyChart/useSankeyChartProps.d.mts +2 -2
- package/SankeyChart/useSankeyChartProps.d.ts +2 -2
- package/SankeyChart/useSankeyChartProps.js +2 -2
- package/SankeyChart/useSankeyChartProps.mjs +2 -2
- package/ScatterChartPro/ScatterChartPro.d.mts +2 -2
- package/ScatterChartPro/ScatterChartPro.d.ts +2 -2
- package/ScatterChartPro/ScatterChartPro.js +57 -15
- package/ScatterChartPro/ScatterChartPro.mjs +57 -15
- package/context/useChartProApiContext.d.mts +1 -1
- package/context/useChartProApiContext.d.ts +1 -1
- package/context/useChartProApiContext.js +1 -1
- package/context/useChartProApiContext.mjs +1 -1
- package/index.d.mts +0 -4
- package/index.d.ts +0 -4
- package/index.js +2 -34
- package/index.mjs +1 -4
- package/internals/index.d.mts +0 -1
- package/internals/index.d.ts +0 -1
- package/internals/index.js +0 -8
- package/internals/index.mjs +0 -1
- package/internals/plugins/useChartProExport/common.js +4 -8
- package/internals/plugins/useChartProExport/common.mjs +4 -8
- package/internals/plugins/useChartProZoom/ZoomInteractionConfig.types.d.mts +1 -1
- package/internals/plugins/useChartProZoom/ZoomInteractionConfig.types.d.ts +1 -1
- package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnBrush.js +16 -1
- package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnBrush.mjs +16 -1
- package/package.json +129 -185
- package/themeAugmentation/components.d.mts +19 -1
- package/themeAugmentation/components.d.ts +19 -1
- package/themeAugmentation/overrides.d.mts +5 -2
- package/themeAugmentation/overrides.d.ts +5 -2
- package/themeAugmentation/props.d.mts +8 -0
- package/themeAugmentation/props.d.ts +8 -0
- package/ChartContainer/index.d.mts +0 -1
- package/ChartContainer/index.d.ts +0 -1
- package/ChartContainer/index.js +0 -16
- package/ChartContainer/index.mjs +0 -2
- package/ChartContainerPro/ChartContainerPro.d.mts +0 -21
- package/ChartContainerPro/ChartContainerPro.d.ts +0 -21
- package/ChartContainerPro/ChartContainerPro.js +0 -24
- package/ChartContainerPro/ChartContainerPro.mjs +0 -20
- package/ChartContainerPro/index.d.mts +0 -9
- package/ChartContainerPro/index.d.ts +0 -9
- package/ChartContainerPro/index.js +0 -17
- package/ChartContainerPro/index.mjs +0 -6
- package/ChartContainerPro/useChartContainerProProps.d.mts +0 -12
- package/ChartContainerPro/useChartContainerProProps.d.ts +0 -12
- package/ChartContainerPro/useChartContainerProProps.js +0 -19
- package/ChartContainerPro/useChartContainerProProps.mjs +0 -14
- package/ChartDataProvider/index.d.mts +0 -1
- package/ChartDataProvider/index.d.ts +0 -1
- package/ChartDataProvider/index.js +0 -16
- package/ChartDataProvider/index.mjs +0 -2
- package/ChartDataProviderPro/ChartDataProviderPro.d.mts +0 -20
- package/ChartDataProviderPro/ChartDataProviderPro.d.ts +0 -20
- package/ChartDataProviderPro/ChartDataProviderPro.js +0 -30
- package/ChartDataProviderPro/ChartDataProviderPro.mjs +0 -21
- package/ChartDataProviderPro/index.d.mts +0 -2
- package/ChartDataProviderPro/index.d.ts +0 -2
- package/ChartDataProviderPro/index.js +0 -13
- package/ChartDataProviderPro/index.mjs +0 -2
- package/ChartDataProviderPro/useChartDataProviderProProps.d.mts +0 -10
- package/ChartDataProviderPro/useChartDataProviderProProps.d.ts +0 -10
- package/ChartDataProviderPro/useChartDataProviderProProps.js +0 -12
- package/ChartDataProviderPro/useChartDataProviderProProps.mjs +0 -8
- package/FunnelChart/funnelSectionClasses.d.mts +0 -30
- package/FunnelChart/funnelSectionClasses.d.ts +0 -30
- package/FunnelChart/funnelSectionClasses.js +0 -44
- package/FunnelChart/funnelSectionClasses.mjs +0 -35
- package/Heatmap/internals/HeatmapCell.d.mts +0 -21
- package/Heatmap/internals/HeatmapCell.d.ts +0 -21
- package/Heatmap/internals/HeatmapCell.js +0 -18
- package/Heatmap/internals/HeatmapCell.mjs +0 -12
- package/tests/constants.js +0 -7
- package/tests/constants.mjs +0 -1
package/Heatmap/Heatmap.mjs
CHANGED
|
@@ -13,7 +13,7 @@ import { ChartsBrushOverlay } from '@mui/x-charts/ChartsBrushOverlay';
|
|
|
13
13
|
import { ChartsLayerContainer } from '@mui/x-charts/ChartsLayerContainer';
|
|
14
14
|
import { HeatmapPlot } from "./HeatmapPlot.mjs";
|
|
15
15
|
import { HeatmapTooltip } from "./HeatmapTooltip/index.mjs";
|
|
16
|
-
import {
|
|
16
|
+
import { ChartsDataProviderPro } from "../ChartsDataProviderPro/index.mjs";
|
|
17
17
|
import { ChartsToolbarPro } from "../ChartsToolbarPro/index.mjs";
|
|
18
18
|
import { FocusedHeatmapCell } from "./FocusedHeatmapCell.mjs";
|
|
19
19
|
import { useHeatmapProps } from "./useHeatmapProps.mjs";
|
|
@@ -33,7 +33,7 @@ const Heatmap = /*#__PURE__*/React.forwardRef(function Heatmap(inProps, ref) {
|
|
|
33
33
|
showToolbar = false
|
|
34
34
|
} = props;
|
|
35
35
|
const {
|
|
36
|
-
|
|
36
|
+
chartsDataProviderProProps,
|
|
37
37
|
chartsWrapperProps,
|
|
38
38
|
chartsAxisProps,
|
|
39
39
|
clipPathProps,
|
|
@@ -45,7 +45,7 @@ const Heatmap = /*#__PURE__*/React.forwardRef(function Heatmap(inProps, ref) {
|
|
|
45
45
|
} = useHeatmapProps(props);
|
|
46
46
|
const Tooltip = slots?.tooltip ?? HeatmapTooltip;
|
|
47
47
|
const Toolbar = slots?.toolbar ?? ChartsToolbarPro;
|
|
48
|
-
return /*#__PURE__*/_jsx(
|
|
48
|
+
return /*#__PURE__*/_jsx(ChartsDataProviderPro, _extends({}, chartsDataProviderProProps, {
|
|
49
49
|
children: /*#__PURE__*/_jsxs(ChartsWrapper, _extends({}, chartsWrapperProps, {
|
|
50
50
|
ref: ref,
|
|
51
51
|
children: [showToolbar ? /*#__PURE__*/_jsx(Toolbar, _extends({}, props.slotProps?.toolbar)) : null, !hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsx(ChartsLayerContainer, {
|
|
@@ -95,6 +95,10 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
95
95
|
* An array of objects that can be used to populate series and axes data using their `dataKey` property.
|
|
96
96
|
*/
|
|
97
97
|
dataset: PropTypes.arrayOf(PropTypes.object),
|
|
98
|
+
/**
|
|
99
|
+
* The description of the chart.
|
|
100
|
+
* Used to provide an accessible description for the chart.
|
|
101
|
+
*/
|
|
98
102
|
desc: PropTypes.string,
|
|
99
103
|
/**
|
|
100
104
|
* If `true`, the charts will not listen to the mouse move event.
|
|
@@ -106,6 +110,10 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
106
110
|
* If `true`, disables keyboard navigation for the chart.
|
|
107
111
|
*/
|
|
108
112
|
disableKeyboardNavigation: PropTypes.bool,
|
|
113
|
+
/**
|
|
114
|
+
* Options to enable features planned for the next major.
|
|
115
|
+
*/
|
|
116
|
+
experimentalFeatures: PropTypes.object,
|
|
109
117
|
/**
|
|
110
118
|
* The height of the chart in px. If not defined, it takes the height of the parent element.
|
|
111
119
|
*/
|
|
@@ -163,15 +171,6 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
163
171
|
right: PropTypes.number,
|
|
164
172
|
top: PropTypes.number
|
|
165
173
|
})]),
|
|
166
|
-
/**
|
|
167
|
-
* The function called for onClick events.
|
|
168
|
-
* The second argument contains information about all line/bar elements at the current mouse position.
|
|
169
|
-
* @param {MouseEvent} event The mouse event recorded on the `<svg/>` element.
|
|
170
|
-
* @param {null | ChartsAxisData} data The data about the clicked axis and items associated with it.
|
|
171
|
-
*
|
|
172
|
-
* @deprecated Use `onItemClick` instead to get access to both x- and y-axis values.
|
|
173
|
-
*/
|
|
174
|
-
onAxisClick: PropTypes.func,
|
|
175
174
|
/**
|
|
176
175
|
* The callback fired when the highlighted item changes.
|
|
177
176
|
*
|
|
@@ -181,7 +180,7 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
181
180
|
/**
|
|
182
181
|
* The callback fired when an item is clicked.
|
|
183
182
|
*
|
|
184
|
-
* @param {React.MouseEvent<
|
|
183
|
+
* @param {React.MouseEvent<HTMLDivElement, MouseEvent>} event The click event.
|
|
185
184
|
* @param {SeriesItemIdentifierWithType<SeriesType>} item The clicked item.
|
|
186
185
|
*/
|
|
187
186
|
onItemClick: PropTypes.func,
|
|
@@ -227,6 +226,10 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
227
226
|
slots: PropTypes.object,
|
|
228
227
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
229
228
|
theme: PropTypes.oneOf(['dark', 'light']),
|
|
229
|
+
/**
|
|
230
|
+
* The title of the chart.
|
|
231
|
+
* Used to provide an accessible label for the chart.
|
|
232
|
+
*/
|
|
230
233
|
title: PropTypes.string,
|
|
231
234
|
/**
|
|
232
235
|
* The configuration of the tooltip.
|
|
@@ -269,6 +272,7 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
269
272
|
barGapRatio: PropTypes.number,
|
|
270
273
|
categoryGapRatio: PropTypes.number,
|
|
271
274
|
classes: PropTypes.object,
|
|
275
|
+
className: PropTypes.string,
|
|
272
276
|
colorMap: PropTypes.oneOfType([PropTypes.shape({
|
|
273
277
|
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
274
278
|
type: PropTypes.oneOf(['ordinal']).isRequired,
|
|
@@ -350,6 +354,7 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
350
354
|
barGapRatio: PropTypes.number,
|
|
351
355
|
categoryGapRatio: PropTypes.number,
|
|
352
356
|
classes: PropTypes.object,
|
|
357
|
+
className: PropTypes.string,
|
|
353
358
|
colorMap: PropTypes.oneOfType([PropTypes.shape({
|
|
354
359
|
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
355
360
|
type: PropTypes.oneOf(['ordinal']).isRequired,
|
|
@@ -488,8 +493,8 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
488
493
|
requiredKeys: PropTypes.arrayOf(PropTypes.string),
|
|
489
494
|
type: PropTypes.oneOf(['doubleTapReset']).isRequired
|
|
490
495
|
}), PropTypes.shape({
|
|
491
|
-
pointerMode: PropTypes.
|
|
492
|
-
requiredKeys: PropTypes.
|
|
496
|
+
pointerMode: PropTypes.oneOf(['mouse', 'touch']),
|
|
497
|
+
requiredKeys: PropTypes.arrayOf(PropTypes.string),
|
|
493
498
|
type: PropTypes.oneOf(['brush']).isRequired
|
|
494
499
|
})]).isRequired)
|
|
495
500
|
})
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { SeriesId } from "../models/index.mjs";
|
|
3
|
+
import type { HeatmapClasses } from "./heatmapClasses.mjs";
|
|
4
|
+
export interface HeatmapCellOwnerState {
|
|
5
|
+
seriesId: SeriesId;
|
|
6
|
+
color: string;
|
|
7
|
+
isFaded: boolean;
|
|
8
|
+
isHighlighted: boolean;
|
|
9
|
+
classes?: Partial<HeatmapClasses>;
|
|
10
|
+
value: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated Use `HeatmapCellOwnerState` instead.
|
|
14
|
+
*/
|
|
15
|
+
export type HeatmapItemOwnerState = HeatmapCellOwnerState;
|
|
16
|
+
export interface HeatmapCellProps extends React.ComponentPropsWithRef<'rect'> {
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
width: number;
|
|
20
|
+
height: number;
|
|
21
|
+
ownerState: HeatmapCellOwnerState;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Demos:
|
|
25
|
+
*
|
|
26
|
+
* - [Heatmap](https://mui.com/x/react-charts/heatmap/)
|
|
27
|
+
*
|
|
28
|
+
* API:
|
|
29
|
+
*
|
|
30
|
+
* - [HeatmapCell API](https://mui.com/x/api/charts/heatmap-cell/)
|
|
31
|
+
*/
|
|
32
|
+
declare const HeatmapCell: React.ForwardRefExoticComponent<Omit<HeatmapCellProps, "ref"> & React.RefAttributes<SVGRectElement>>;
|
|
33
|
+
export { HeatmapCell };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { SeriesId } from "../models/index.js";
|
|
3
|
+
import type { HeatmapClasses } from "./heatmapClasses.js";
|
|
4
|
+
export interface HeatmapCellOwnerState {
|
|
5
|
+
seriesId: SeriesId;
|
|
6
|
+
color: string;
|
|
7
|
+
isFaded: boolean;
|
|
8
|
+
isHighlighted: boolean;
|
|
9
|
+
classes?: Partial<HeatmapClasses>;
|
|
10
|
+
value: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated Use `HeatmapCellOwnerState` instead.
|
|
14
|
+
*/
|
|
15
|
+
export type HeatmapItemOwnerState = HeatmapCellOwnerState;
|
|
16
|
+
export interface HeatmapCellProps extends React.ComponentPropsWithRef<'rect'> {
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
width: number;
|
|
20
|
+
height: number;
|
|
21
|
+
ownerState: HeatmapCellOwnerState;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Demos:
|
|
25
|
+
*
|
|
26
|
+
* - [Heatmap](https://mui.com/x/react-charts/heatmap/)
|
|
27
|
+
*
|
|
28
|
+
* API:
|
|
29
|
+
*
|
|
30
|
+
* - [HeatmapCell API](https://mui.com/x/api/charts/heatmap-cell/)
|
|
31
|
+
*/
|
|
32
|
+
declare const HeatmapCell: React.ForwardRefExoticComponent<Omit<HeatmapCellProps, "ref"> & React.RefAttributes<SVGRectElement>>;
|
|
33
|
+
export { HeatmapCell };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.HeatmapCell = void 0;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var React = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
|
+
var _styles = require("@mui/material/styles");
|
|
13
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated Use `HeatmapCellOwnerState` instead.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
const HeatmapCellRoot = (0, _styles.styled)('rect', {
|
|
19
|
+
name: 'MuiHeatmap',
|
|
20
|
+
slot: 'Cell',
|
|
21
|
+
overridesResolver: (_, styles) => styles.cell
|
|
22
|
+
})(({
|
|
23
|
+
ownerState
|
|
24
|
+
}) => ({
|
|
25
|
+
filter: ownerState.isHighlighted && 'saturate(120%)' || ownerState.isFaded && 'saturate(80%)' || undefined,
|
|
26
|
+
fill: ownerState.color,
|
|
27
|
+
shapeRendering: 'crispEdges'
|
|
28
|
+
}));
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Demos:
|
|
32
|
+
*
|
|
33
|
+
* - [Heatmap](https://mui.com/x/react-charts/heatmap/)
|
|
34
|
+
*
|
|
35
|
+
* API:
|
|
36
|
+
*
|
|
37
|
+
* - [HeatmapCell API](https://mui.com/x/api/charts/heatmap-cell/)
|
|
38
|
+
*/
|
|
39
|
+
const HeatmapCell = exports.HeatmapCell = /*#__PURE__*/React.forwardRef(function HeatmapCell(props, ref) {
|
|
40
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(HeatmapCellRoot, (0, _extends2.default)({
|
|
41
|
+
ref: ref
|
|
42
|
+
}, props));
|
|
43
|
+
});
|
|
44
|
+
if (process.env.NODE_ENV !== "production") HeatmapCell.displayName = "HeatmapCell";
|
|
45
|
+
process.env.NODE_ENV !== "production" ? HeatmapCell.propTypes = {
|
|
46
|
+
// ----------------------------- Warning --------------------------------
|
|
47
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
48
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
49
|
+
// ----------------------------------------------------------------------
|
|
50
|
+
height: _propTypes.default.number.isRequired,
|
|
51
|
+
ownerState: _propTypes.default.shape({
|
|
52
|
+
classes: _propTypes.default.object,
|
|
53
|
+
color: _propTypes.default.string.isRequired,
|
|
54
|
+
isFaded: _propTypes.default.bool.isRequired,
|
|
55
|
+
isHighlighted: _propTypes.default.bool.isRequired,
|
|
56
|
+
seriesId: _propTypes.default.string.isRequired,
|
|
57
|
+
value: _propTypes.default.number.isRequired
|
|
58
|
+
}).isRequired,
|
|
59
|
+
width: _propTypes.default.number.isRequired,
|
|
60
|
+
x: _propTypes.default.number.isRequired,
|
|
61
|
+
y: _propTypes.default.number.isRequired
|
|
62
|
+
} : void 0;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import { styled } from '@mui/material/styles';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated Use `HeatmapCellOwnerState` instead.
|
|
8
|
+
*/
|
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
+
const HeatmapCellRoot = styled('rect', {
|
|
11
|
+
name: 'MuiHeatmap',
|
|
12
|
+
slot: 'Cell',
|
|
13
|
+
overridesResolver: (_, styles) => styles.cell
|
|
14
|
+
})(({
|
|
15
|
+
ownerState
|
|
16
|
+
}) => ({
|
|
17
|
+
filter: ownerState.isHighlighted && 'saturate(120%)' || ownerState.isFaded && 'saturate(80%)' || undefined,
|
|
18
|
+
fill: ownerState.color,
|
|
19
|
+
shapeRendering: 'crispEdges'
|
|
20
|
+
}));
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Demos:
|
|
24
|
+
*
|
|
25
|
+
* - [Heatmap](https://mui.com/x/react-charts/heatmap/)
|
|
26
|
+
*
|
|
27
|
+
* API:
|
|
28
|
+
*
|
|
29
|
+
* - [HeatmapCell API](https://mui.com/x/api/charts/heatmap-cell/)
|
|
30
|
+
*/
|
|
31
|
+
const HeatmapCell = /*#__PURE__*/React.forwardRef(function HeatmapCell(props, ref) {
|
|
32
|
+
return /*#__PURE__*/_jsx(HeatmapCellRoot, _extends({
|
|
33
|
+
ref: ref
|
|
34
|
+
}, props));
|
|
35
|
+
});
|
|
36
|
+
if (process.env.NODE_ENV !== "production") HeatmapCell.displayName = "HeatmapCell";
|
|
37
|
+
process.env.NODE_ENV !== "production" ? HeatmapCell.propTypes = {
|
|
38
|
+
// ----------------------------- Warning --------------------------------
|
|
39
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
40
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
41
|
+
// ----------------------------------------------------------------------
|
|
42
|
+
height: PropTypes.number.isRequired,
|
|
43
|
+
ownerState: PropTypes.shape({
|
|
44
|
+
classes: PropTypes.object,
|
|
45
|
+
color: PropTypes.string.isRequired,
|
|
46
|
+
isFaded: PropTypes.bool.isRequired,
|
|
47
|
+
isHighlighted: PropTypes.bool.isRequired,
|
|
48
|
+
seriesId: PropTypes.string.isRequired,
|
|
49
|
+
value: PropTypes.number.isRequired
|
|
50
|
+
}).isRequired,
|
|
51
|
+
width: PropTypes.number.isRequired,
|
|
52
|
+
x: PropTypes.number.isRequired,
|
|
53
|
+
y: PropTypes.number.isRequired
|
|
54
|
+
} : void 0;
|
|
55
|
+
export { HeatmapCell };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type SeriesId } from '@mui/x-charts/internals';
|
|
3
|
-
import { type
|
|
3
|
+
import { type HeatmapCellProps } from "./HeatmapCell.mjs";
|
|
4
4
|
export interface HeatmapItemSlots {
|
|
5
5
|
/**
|
|
6
6
|
* The component that renders the heatmap cell.
|
|
@@ -12,7 +12,6 @@ export interface HeatmapItemSlotProps {
|
|
|
12
12
|
cell?: Partial<HeatmapCellProps>;
|
|
13
13
|
}
|
|
14
14
|
export interface HeatmapItemProps {
|
|
15
|
-
dataIndex: number;
|
|
16
15
|
seriesId: SeriesId;
|
|
17
16
|
value: number;
|
|
18
17
|
width: number;
|
|
@@ -39,13 +38,6 @@ export interface HeatmapItemProps {
|
|
|
39
38
|
*/
|
|
40
39
|
slots?: HeatmapItemSlots;
|
|
41
40
|
}
|
|
42
|
-
export interface HeatmapCellProps extends React.ComponentPropsWithRef<'rect'> {
|
|
43
|
-
x: number;
|
|
44
|
-
y: number;
|
|
45
|
-
width: number;
|
|
46
|
-
height: number;
|
|
47
|
-
ownerState: HeatmapItemOwnerState;
|
|
48
|
-
}
|
|
49
41
|
/**
|
|
50
42
|
* @ignore - internal component.
|
|
51
43
|
*/
|
package/Heatmap/HeatmapItem.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type SeriesId } from '@mui/x-charts/internals';
|
|
3
|
-
import { type
|
|
3
|
+
import { type HeatmapCellProps } from "./HeatmapCell.js";
|
|
4
4
|
export interface HeatmapItemSlots {
|
|
5
5
|
/**
|
|
6
6
|
* The component that renders the heatmap cell.
|
|
@@ -12,7 +12,6 @@ export interface HeatmapItemSlotProps {
|
|
|
12
12
|
cell?: Partial<HeatmapCellProps>;
|
|
13
13
|
}
|
|
14
14
|
export interface HeatmapItemProps {
|
|
15
|
-
dataIndex: number;
|
|
16
15
|
seriesId: SeriesId;
|
|
17
16
|
value: number;
|
|
18
17
|
width: number;
|
|
@@ -39,13 +38,6 @@ export interface HeatmapItemProps {
|
|
|
39
38
|
*/
|
|
40
39
|
slots?: HeatmapItemSlots;
|
|
41
40
|
}
|
|
42
|
-
export interface HeatmapCellProps extends React.ComponentPropsWithRef<'rect'> {
|
|
43
|
-
x: number;
|
|
44
|
-
y: number;
|
|
45
|
-
width: number;
|
|
46
|
-
height: number;
|
|
47
|
-
ownerState: HeatmapItemOwnerState;
|
|
48
|
-
}
|
|
49
41
|
/**
|
|
50
42
|
* @ignore - internal component.
|
|
51
43
|
*/
|
package/Heatmap/HeatmapItem.js
CHANGED
|
@@ -11,33 +11,18 @@ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runt
|
|
|
11
11
|
var React = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
13
|
var _useSlotProps = _interopRequireDefault(require("@mui/utils/useSlotProps"));
|
|
14
|
-
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
15
14
|
var _internals = require("@mui/x-charts/internals");
|
|
16
15
|
var _heatmapClasses = require("./heatmapClasses");
|
|
17
|
-
var _HeatmapCell = require("./
|
|
16
|
+
var _HeatmapCell = require("./HeatmapCell");
|
|
18
17
|
var _shouldRegisterPointerInteractionsGlobally = require("./shouldRegisterPointerInteractionsGlobally");
|
|
19
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
|
-
const _excluded = ["seriesId", "
|
|
21
|
-
const useUtilityClasses = ownerState => {
|
|
22
|
-
const {
|
|
23
|
-
classes,
|
|
24
|
-
seriesId,
|
|
25
|
-
isFaded,
|
|
26
|
-
isHighlighted
|
|
27
|
-
} = ownerState;
|
|
28
|
-
const slots = {
|
|
29
|
-
cell: ['cell', `series-${seriesId}`, isFaded && 'faded', isHighlighted && 'highlighted']
|
|
30
|
-
};
|
|
31
|
-
return (0, _composeClasses.default)(slots, _heatmapClasses.getHeatmapUtilityClass, classes);
|
|
32
|
-
};
|
|
33
|
-
|
|
19
|
+
const _excluded = ["seriesId", "color", "value", "isHighlighted", "isFaded", "borderRadius", "xIndex", "yIndex", "slotProps", "slots"];
|
|
34
20
|
/**
|
|
35
21
|
* @ignore - internal component.
|
|
36
22
|
*/
|
|
37
23
|
function HeatmapItem(props) {
|
|
38
24
|
const {
|
|
39
25
|
seriesId,
|
|
40
|
-
dataIndex,
|
|
41
26
|
color,
|
|
42
27
|
value,
|
|
43
28
|
isHighlighted = false,
|
|
@@ -61,13 +46,12 @@ function HeatmapItem(props) {
|
|
|
61
46
|
}, skipInteractionItemProps);
|
|
62
47
|
const ownerState = {
|
|
63
48
|
seriesId,
|
|
64
|
-
dataIndex,
|
|
65
49
|
color,
|
|
66
|
-
value,
|
|
67
50
|
isFaded,
|
|
68
|
-
isHighlighted
|
|
51
|
+
isHighlighted,
|
|
52
|
+
value
|
|
69
53
|
};
|
|
70
|
-
const classes = useUtilityClasses(ownerState);
|
|
54
|
+
const classes = (0, _heatmapClasses.useUtilityClasses)(ownerState);
|
|
71
55
|
const Cell = slots?.cell ?? _HeatmapCell.HeatmapCell;
|
|
72
56
|
const cellProps = (0, _useSlotProps.default)({
|
|
73
57
|
elementType: Cell,
|
|
@@ -90,7 +74,6 @@ process.env.NODE_ENV !== "production" ? HeatmapItem.propTypes = {
|
|
|
90
74
|
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
91
75
|
// ----------------------------------------------------------------------
|
|
92
76
|
color: _propTypes.default.string.isRequired,
|
|
93
|
-
dataIndex: _propTypes.default.number.isRequired,
|
|
94
77
|
height: _propTypes.default.number.isRequired,
|
|
95
78
|
seriesId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
|
|
96
79
|
/**
|
package/Heatmap/HeatmapItem.mjs
CHANGED
|
@@ -1,35 +1,20 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["seriesId", "
|
|
3
|
+
const _excluded = ["seriesId", "color", "value", "isHighlighted", "isFaded", "borderRadius", "xIndex", "yIndex", "slotProps", "slots"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import useSlotProps from '@mui/utils/useSlotProps';
|
|
7
|
-
import composeClasses from '@mui/utils/composeClasses';
|
|
8
7
|
import { useInteractionItemProps } from '@mui/x-charts/internals';
|
|
9
|
-
import {
|
|
10
|
-
import { HeatmapCell } from "./
|
|
8
|
+
import { useUtilityClasses } from "./heatmapClasses.mjs";
|
|
9
|
+
import { HeatmapCell } from "./HeatmapCell.mjs";
|
|
11
10
|
import { shouldRegisterPointerInteractionsGlobally } from "./shouldRegisterPointerInteractionsGlobally.mjs";
|
|
12
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
const useUtilityClasses = ownerState => {
|
|
14
|
-
const {
|
|
15
|
-
classes,
|
|
16
|
-
seriesId,
|
|
17
|
-
isFaded,
|
|
18
|
-
isHighlighted
|
|
19
|
-
} = ownerState;
|
|
20
|
-
const slots = {
|
|
21
|
-
cell: ['cell', `series-${seriesId}`, isFaded && 'faded', isHighlighted && 'highlighted']
|
|
22
|
-
};
|
|
23
|
-
return composeClasses(slots, getHeatmapUtilityClass, classes);
|
|
24
|
-
};
|
|
25
|
-
|
|
26
12
|
/**
|
|
27
13
|
* @ignore - internal component.
|
|
28
14
|
*/
|
|
29
15
|
function HeatmapItem(props) {
|
|
30
16
|
const {
|
|
31
17
|
seriesId,
|
|
32
|
-
dataIndex,
|
|
33
18
|
color,
|
|
34
19
|
value,
|
|
35
20
|
isHighlighted = false,
|
|
@@ -53,11 +38,10 @@ function HeatmapItem(props) {
|
|
|
53
38
|
}, skipInteractionItemProps);
|
|
54
39
|
const ownerState = {
|
|
55
40
|
seriesId,
|
|
56
|
-
dataIndex,
|
|
57
41
|
color,
|
|
58
|
-
value,
|
|
59
42
|
isFaded,
|
|
60
|
-
isHighlighted
|
|
43
|
+
isHighlighted,
|
|
44
|
+
value
|
|
61
45
|
};
|
|
62
46
|
const classes = useUtilityClasses(ownerState);
|
|
63
47
|
const Cell = slots?.cell ?? HeatmapCell;
|
|
@@ -82,7 +66,6 @@ process.env.NODE_ENV !== "production" ? HeatmapItem.propTypes = {
|
|
|
82
66
|
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
83
67
|
// ----------------------------------------------------------------------
|
|
84
68
|
color: PropTypes.string.isRequired,
|
|
85
|
-
dataIndex: PropTypes.number.isRequired,
|
|
86
69
|
height: PropTypes.number.isRequired,
|
|
87
70
|
seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
88
71
|
/**
|
|
@@ -7,15 +7,21 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.HeatmapSVGPlot = HeatmapSVGPlot;
|
|
9
9
|
var React = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _styles = require("@mui/material/styles");
|
|
10
11
|
var _hooks = require("@mui/x-charts/hooks");
|
|
11
12
|
var _internals = require("@mui/x-charts/internals");
|
|
12
13
|
var _hooks2 = require("../hooks");
|
|
13
14
|
var _HeatmapItem = require("./HeatmapItem");
|
|
14
15
|
var _useChartHeatmapPosition = require("../plugins/selectors/useChartHeatmapPosition.selectors");
|
|
15
16
|
var _shouldRegisterPointerInteractionsGlobally = require("./shouldRegisterPointerInteractionsGlobally");
|
|
17
|
+
var _heatmapClasses = require("./heatmapClasses");
|
|
16
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
19
|
const MemoHeatmapItem = /*#__PURE__*/React.memo(_HeatmapItem.HeatmapItem);
|
|
18
20
|
if (process.env.NODE_ENV !== "production") MemoHeatmapItem.displayName = "MemoHeatmapItem";
|
|
21
|
+
const HeatmapPlotRoot = (0, _styles.styled)('g', {
|
|
22
|
+
name: 'MuiHeatmapPlot',
|
|
23
|
+
slot: 'Root'
|
|
24
|
+
})();
|
|
19
25
|
function HeatmapSVGPlot(props) {
|
|
20
26
|
const store = (0, _internals.useStore)();
|
|
21
27
|
const xScale = (0, _hooks.useXScale)();
|
|
@@ -30,8 +36,10 @@ function HeatmapSVGPlot(props) {
|
|
|
30
36
|
}
|
|
31
37
|
const seriesToDisplay = series.series[series.seriesOrder[0]];
|
|
32
38
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
|
33
|
-
children: [(0, _shouldRegisterPointerInteractionsGlobally.shouldRegisterPointerInteractionsGlobally)(props.slots, props.slotProps) ? /*#__PURE__*/(0, _jsxRuntime.jsx)(RegisterHeatmapPointerInteractions, {}) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
34
|
-
|
|
39
|
+
children: [(0, _shouldRegisterPointerInteractionsGlobally.shouldRegisterPointerInteractionsGlobally)(props.slots, props.slotProps) ? /*#__PURE__*/(0, _jsxRuntime.jsx)(RegisterHeatmapPointerInteractions, {}) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(HeatmapPlotRoot, {
|
|
40
|
+
className: _heatmapClasses.heatmapClasses.root,
|
|
41
|
+
"data-series": seriesToDisplay.id,
|
|
42
|
+
children: seriesToDisplay.data.map(([xIndex, yIndex, value]) => {
|
|
35
43
|
const x = xScale(xDomain[xIndex]);
|
|
36
44
|
const y = yScale(yDomain[yIndex]);
|
|
37
45
|
const color = colorScale?.(value);
|
|
@@ -53,7 +61,6 @@ function HeatmapSVGPlot(props) {
|
|
|
53
61
|
xIndex: xIndex,
|
|
54
62
|
yIndex: yIndex,
|
|
55
63
|
color: color,
|
|
56
|
-
dataIndex: dataIndex,
|
|
57
64
|
seriesId: series.seriesOrder[0],
|
|
58
65
|
value: value,
|
|
59
66
|
slots: props.slots,
|
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
|
+
import { styled } from '@mui/material/styles';
|
|
4
5
|
import { useXScale, useYScale, useZColorScale } from '@mui/x-charts/hooks';
|
|
5
6
|
import { selectorChartsHighlightStateCallback, useStore, useRegisterPointerInteractions } from '@mui/x-charts/internals';
|
|
6
7
|
import { useHeatmapSeriesContext } from "../hooks/index.mjs";
|
|
7
8
|
import { HeatmapItem } from "./HeatmapItem.mjs";
|
|
8
9
|
import { selectorHeatmapItemAtPosition } from "../plugins/selectors/useChartHeatmapPosition.selectors.mjs";
|
|
9
10
|
import { shouldRegisterPointerInteractionsGlobally } from "./shouldRegisterPointerInteractionsGlobally.mjs";
|
|
11
|
+
import { heatmapClasses } from "./heatmapClasses.mjs";
|
|
10
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
13
|
const MemoHeatmapItem = /*#__PURE__*/React.memo(HeatmapItem);
|
|
12
14
|
if (process.env.NODE_ENV !== "production") MemoHeatmapItem.displayName = "MemoHeatmapItem";
|
|
15
|
+
const HeatmapPlotRoot = styled('g', {
|
|
16
|
+
name: 'MuiHeatmapPlot',
|
|
17
|
+
slot: 'Root'
|
|
18
|
+
})();
|
|
13
19
|
export function HeatmapSVGPlot(props) {
|
|
14
20
|
const store = useStore();
|
|
15
21
|
const xScale = useXScale();
|
|
@@ -24,8 +30,10 @@ export function HeatmapSVGPlot(props) {
|
|
|
24
30
|
}
|
|
25
31
|
const seriesToDisplay = series.series[series.seriesOrder[0]];
|
|
26
32
|
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
27
|
-
children: [shouldRegisterPointerInteractionsGlobally(props.slots, props.slotProps) ? /*#__PURE__*/_jsx(RegisterHeatmapPointerInteractions, {}) : null, /*#__PURE__*/_jsx(
|
|
28
|
-
|
|
33
|
+
children: [shouldRegisterPointerInteractionsGlobally(props.slots, props.slotProps) ? /*#__PURE__*/_jsx(RegisterHeatmapPointerInteractions, {}) : null, /*#__PURE__*/_jsx(HeatmapPlotRoot, {
|
|
34
|
+
className: heatmapClasses.root,
|
|
35
|
+
"data-series": seriesToDisplay.id,
|
|
36
|
+
children: seriesToDisplay.data.map(([xIndex, yIndex, value]) => {
|
|
29
37
|
const x = xScale(xDomain[xIndex]);
|
|
30
38
|
const y = yScale(yDomain[yIndex]);
|
|
31
39
|
const color = colorScale?.(value);
|
|
@@ -47,7 +55,6 @@ export function HeatmapSVGPlot(props) {
|
|
|
47
55
|
xIndex: xIndex,
|
|
48
56
|
yIndex: yIndex,
|
|
49
57
|
color: color,
|
|
50
|
-
dataIndex: dataIndex,
|
|
51
58
|
seriesId: series.seriesOrder[0],
|
|
52
59
|
value: value,
|
|
53
60
|
slots: props.slots,
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.useUtilityClasses = void 0;
|
|
8
8
|
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
9
|
-
var
|
|
9
|
+
var _internals = require("@mui/x-charts/internals");
|
|
10
10
|
const useUtilityClasses = props => {
|
|
11
11
|
const {
|
|
12
12
|
classes
|
|
@@ -22,6 +22,6 @@ const useUtilityClasses = props => {
|
|
|
22
22
|
labelCell: ['labelCell'],
|
|
23
23
|
valueCell: ['valueCell']
|
|
24
24
|
};
|
|
25
|
-
return (0, _composeClasses.default)(slots,
|
|
25
|
+
return (0, _composeClasses.default)(slots, _internals.getChartsTooltipUtilityClass, classes);
|
|
26
26
|
};
|
|
27
27
|
exports.useUtilityClasses = useUtilityClasses;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import composeClasses from '@mui/utils/composeClasses';
|
|
2
|
-
import { getChartsTooltipUtilityClass } from '@mui/x-charts/
|
|
2
|
+
import { getChartsTooltipUtilityClass } from '@mui/x-charts/internals';
|
|
3
3
|
export const useUtilityClasses = props => {
|
|
4
4
|
const {
|
|
5
5
|
classes
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import type { HeatmapCellOwnerState } from "./HeatmapCell.mjs";
|
|
1
2
|
export interface HeatmapClasses {
|
|
3
|
+
/** Styles applied to the heatmap plot root element. */
|
|
4
|
+
root: string;
|
|
2
5
|
/** Styles applied to the heatmap cells. */
|
|
3
6
|
cell: string;
|
|
4
7
|
/**
|
|
@@ -14,9 +17,11 @@ export interface HeatmapClasses {
|
|
|
14
17
|
/**
|
|
15
18
|
* Styles applied to the root element for a specified series.
|
|
16
19
|
* Needs to be suffixed with the series ID: `.${heatmapClasses.series}-${seriesId}`.
|
|
20
|
+
* @deprecated Use `[data-series="${seriesId}"]` selector instead.
|
|
17
21
|
*/
|
|
18
22
|
series: string;
|
|
19
23
|
}
|
|
20
24
|
export type HeatmapClassKey = keyof HeatmapClasses;
|
|
21
25
|
export declare function getHeatmapUtilityClass(slot: string): string;
|
|
22
|
-
export declare const heatmapClasses: HeatmapClasses;
|
|
26
|
+
export declare const heatmapClasses: HeatmapClasses;
|
|
27
|
+
export declare const useUtilityClasses: (ownerState: HeatmapCellOwnerState) => Record<"cell" | "root", string>;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import type { HeatmapCellOwnerState } from "./HeatmapCell.js";
|
|
1
2
|
export interface HeatmapClasses {
|
|
3
|
+
/** Styles applied to the heatmap plot root element. */
|
|
4
|
+
root: string;
|
|
2
5
|
/** Styles applied to the heatmap cells. */
|
|
3
6
|
cell: string;
|
|
4
7
|
/**
|
|
@@ -14,9 +17,11 @@ export interface HeatmapClasses {
|
|
|
14
17
|
/**
|
|
15
18
|
* Styles applied to the root element for a specified series.
|
|
16
19
|
* Needs to be suffixed with the series ID: `.${heatmapClasses.series}-${seriesId}`.
|
|
20
|
+
* @deprecated Use `[data-series="${seriesId}"]` selector instead.
|
|
17
21
|
*/
|
|
18
22
|
series: string;
|
|
19
23
|
}
|
|
20
24
|
export type HeatmapClassKey = keyof HeatmapClasses;
|
|
21
25
|
export declare function getHeatmapUtilityClass(slot: string): string;
|
|
22
|
-
export declare const heatmapClasses: HeatmapClasses;
|
|
26
|
+
export declare const heatmapClasses: HeatmapClasses;
|
|
27
|
+
export declare const useUtilityClasses: (ownerState: HeatmapCellOwnerState) => Record<"cell" | "root", string>;
|
|
@@ -5,9 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.getHeatmapUtilityClass = getHeatmapUtilityClass;
|
|
8
|
-
exports.heatmapClasses = void 0;
|
|
8
|
+
exports.useUtilityClasses = exports.heatmapClasses = void 0;
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var _generateUtilityClass = _interopRequireDefault(require("@mui/utils/generateUtilityClass"));
|
|
11
|
+
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
11
12
|
var _generateUtilityClasses = _interopRequireDefault(require("@mui/utils/generateUtilityClasses"));
|
|
12
13
|
function getHeatmapUtilityClass(slot) {
|
|
13
14
|
// Those should be common to all charts
|
|
@@ -16,7 +17,21 @@ function getHeatmapUtilityClass(slot) {
|
|
|
16
17
|
}
|
|
17
18
|
return (0, _generateUtilityClass.default)('MuiHeatmap', slot);
|
|
18
19
|
}
|
|
19
|
-
const heatmapClasses = exports.heatmapClasses = (0, _extends2.default)({}, (0, _generateUtilityClasses.default)('MuiHeatmap', ['cell', 'series']), {
|
|
20
|
+
const heatmapClasses = exports.heatmapClasses = (0, _extends2.default)({}, (0, _generateUtilityClasses.default)('MuiHeatmap', ['root', 'cell', 'series']), {
|
|
20
21
|
highlighted: 'Charts-highlighted',
|
|
21
22
|
faded: 'Charts-faded'
|
|
22
|
-
});
|
|
23
|
+
});
|
|
24
|
+
const useUtilityClasses = ownerState => {
|
|
25
|
+
const {
|
|
26
|
+
classes,
|
|
27
|
+
seriesId,
|
|
28
|
+
isFaded,
|
|
29
|
+
isHighlighted
|
|
30
|
+
} = ownerState;
|
|
31
|
+
const slots = {
|
|
32
|
+
root: ['root'],
|
|
33
|
+
cell: ['cell', `series-${seriesId}`, isFaded && 'faded', isHighlighted && 'highlighted']
|
|
34
|
+
};
|
|
35
|
+
return (0, _composeClasses.default)(slots, getHeatmapUtilityClass, classes);
|
|
36
|
+
};
|
|
37
|
+
exports.useUtilityClasses = useUtilityClasses;
|