@mui/x-charts 7.22.3 → 8.0.0-alpha.1
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/AnimatedBarElement.d.ts +15 -0
- package/BarChart/AnimatedBarElement.js +21 -0
- package/BarChart/BarChart.d.ts +11 -16
- package/BarChart/BarChart.js +9 -59
- package/BarChart/BarElement.d.ts +6 -1343
- package/BarChart/BarElement.js +10 -20
- package/BarChart/BarLabel/BarLabelItem.d.ts +1 -1
- package/BarChart/BarPlot.js +24 -6
- package/BarChart/extremums.js +3 -3
- package/BarChart/useBarChartProps.d.ts +2 -4
- package/BarChart/useBarChartProps.js +4 -11
- package/CHANGELOG.md +348 -12
- package/ChartContainer/ChartContainer.d.ts +4 -38
- package/ChartContainer/ChartContainer.js +15 -44
- package/ChartContainer/ResizableContainer.d.ts +22 -0
- package/ChartContainer/ResizableContainer.js +60 -0
- package/ChartContainer/useChartContainerProps.d.ts +8 -92
- package/ChartContainer/useChartContainerProps.js +29 -59
- package/ChartsAxisHighlight/ChartsAxisHighlight.d.ts +1 -17
- package/ChartsAxisHighlight/ChartsAxisHighlight.js +10 -96
- package/ChartsAxisHighlight/ChartsAxisHighlight.types.d.ts +5 -0
- package/ChartsAxisHighlight/ChartsAxisHighlightPath.d.ts +6 -0
- package/ChartsAxisHighlight/ChartsAxisHighlightPath.js +34 -0
- package/ChartsAxisHighlight/ChartsXAxisHighlight.d.ts +10 -0
- package/ChartsAxisHighlight/ChartsXAxisHighlight.js +53 -0
- package/ChartsAxisHighlight/ChartsYAxisHighlight.d.ts +10 -0
- package/ChartsAxisHighlight/ChartsYAxisHighlight.js +53 -0
- package/ChartsAxisHighlight/chartsAxisHighlightClasses.d.ts +7 -0
- package/ChartsAxisHighlight/chartsAxisHighlightClasses.js +6 -0
- package/ChartsAxisHighlight/index.d.ts +3 -0
- package/ChartsAxisHighlight/index.js +4 -1
- package/ChartsGrid/ChartsGrid.js +1 -1
- package/ChartsGrid/ChartsHorizontalGrid.d.ts +2 -2
- package/ChartsGrid/ChartsHorizontalGrid.js +3 -3
- package/ChartsGrid/ChartsVerticalGrid.d.ts +2 -2
- package/ChartsGrid/ChartsVerticalGrid.js +3 -3
- package/ChartsLegend/ChartsLegend.js +0 -3
- package/ChartsLegend/DefaultChartsLegend.d.ts +0 -5
- package/ChartsLegend/DefaultChartsLegend.js +1 -12
- package/ChartsLegend/LegendPerItem.d.ts +3 -3
- package/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +11 -9
- package/ChartsOverlay/ChartsOverlay.d.ts +1 -1
- package/ChartsSurface/ChartsSurface.d.ts +0 -15
- package/ChartsSurface/ChartsSurface.js +35 -34
- package/ChartsTooltip/ChartTooltip.types.d.ts +15 -0
- package/ChartsTooltip/ChartsAxisTooltipContent.d.ts +7 -39
- package/ChartsTooltip/ChartsAxisTooltipContent.js +83 -72
- package/ChartsTooltip/ChartsItemTooltipContent.d.ts +5 -28
- package/ChartsTooltip/ChartsItemTooltipContent.js +54 -44
- package/ChartsTooltip/ChartsTooltip.d.ts +3 -69
- package/ChartsTooltip/ChartsTooltip.js +162 -107
- package/ChartsTooltip/ChartsTooltipContainer.d.ts +33 -0
- package/ChartsTooltip/ChartsTooltipContainer.js +298 -0
- package/ChartsTooltip/chartsTooltipClasses.d.ts +1 -0
- package/ChartsTooltip/chartsTooltipClasses.js +18 -2
- package/ChartsTooltip/index.d.ts +3 -3
- package/ChartsTooltip/index.js +2 -3
- package/ChartsTooltip/useAxisTooltip.d.ts +2 -2
- package/ChartsTooltip/useAxisTooltip.js +21 -21
- package/ChartsTooltip/useItemTooltip.d.ts +1 -1
- package/ChartsTooltip/useItemTooltip.js +8 -7
- package/ChartsTooltip/utils.d.ts +5 -16
- package/ChartsTooltip/utils.js +45 -50
- package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +50 -39
- package/Gauge/Gauge.d.ts +1 -1
- package/Gauge/Gauge.js +0 -6
- package/Gauge/GaugeContainer.d.ts +3 -3
- package/Gauge/GaugeContainer.js +60 -61
- package/LineChart/AnimatedArea.d.ts +0 -1333
- package/LineChart/AnimatedArea.js +9 -18
- package/LineChart/AnimatedLine.d.ts +0 -1333
- package/LineChart/AnimatedLine.js +9 -20
- package/LineChart/AreaElement.d.ts +1 -1
- package/LineChart/AreaPlot.js +14 -8
- package/LineChart/CircleMarkElement.js +6 -5
- package/LineChart/LineChart.d.ts +11 -17
- package/LineChart/LineChart.js +9 -60
- package/LineChart/LineElement.d.ts +1 -1
- package/LineChart/LineHighlightPlot.d.ts +1 -1
- package/LineChart/LineHighlightPlot.js +8 -11
- package/LineChart/LinePlot.js +14 -8
- package/LineChart/MarkElement.js +6 -5
- package/LineChart/MarkPlot.js +2 -6
- package/LineChart/extremums.js +10 -6
- package/LineChart/useLineChartProps.d.ts +2 -4
- package/LineChart/useLineChartProps.js +4 -11
- package/PieChart/PieArc.d.ts +0 -5
- package/PieChart/PieArc.js +1 -10
- package/PieChart/PieArcPlot.js +0 -5
- package/PieChart/PieChart.d.ts +10 -39
- package/PieChart/PieChart.js +20 -137
- package/PieChart/PiePlot.js +2 -2
- package/PieChart/getPieCoordinates.d.ts +2 -2
- package/README.md +4 -4
- package/ScatterChart/Scatter.js +6 -5
- package/ScatterChart/ScatterChart.d.ts +11 -17
- package/ScatterChart/ScatterChart.js +11 -60
- package/ScatterChart/ScatterPlot.js +3 -6
- package/ScatterChart/extremums.js +6 -6
- package/ScatterChart/useScatterChartProps.d.ts +2 -4
- package/ScatterChart/useScatterChartProps.js +3 -12
- package/SparkLineChart/SparkLineChart.d.ts +7 -8
- package/SparkLineChart/SparkLineChart.js +6 -33
- package/context/CartesianProvider/defaultizeAxis.d.ts +1 -1
- package/context/ChartDataProvider/ChartDataProvider.d.ts +31 -0
- package/{ResponsiveChartContainer/ResponsiveChartContainer.js → context/ChartDataProvider/ChartDataProvider.js} +45 -39
- package/context/ChartDataProvider/index.d.ts +1 -0
- package/context/ChartDataProvider/index.js +1 -0
- package/context/ChartDataProvider/useChartDataProviderProps.d.ts +94 -0
- package/context/ChartDataProvider/useChartDataProviderProps.js +66 -0
- package/{ChartContainer → context/ChartDataProvider}/useDefaultizeAxis.d.ts +12 -12
- package/{modern/ChartContainer → context/ChartDataProvider}/useDefaultizeAxis.js +1 -1
- package/context/{DrawingProvider.d.ts → DrawingAreaProvider/DrawingArea.types.d.ts} +3 -14
- package/context/DrawingAreaProvider/DrawingAreaContext.d.ts +8 -0
- package/context/DrawingAreaProvider/DrawingAreaContext.js +16 -0
- package/context/DrawingAreaProvider/DrawingAreaProvider.d.ts +3 -0
- package/{modern/context/DrawingProvider.js → context/DrawingAreaProvider/DrawingAreaProvider.js} +11 -41
- package/context/DrawingAreaProvider/index.d.ts +3 -0
- package/context/DrawingAreaProvider/index.js +3 -0
- package/context/HighlightedProvider/HighlightedContext.d.ts +0 -8
- package/context/HighlightedProvider/HighlightedProvider.js +1 -16
- package/context/InteractionProvider.d.ts +5 -48
- package/context/InteractionProvider.js +8 -64
- package/context/InteractionSelectors.d.ts +359 -0
- package/context/InteractionSelectors.js +12 -0
- package/context/PluginProvider/ExtremumGetter.types.d.ts +2 -2
- package/context/SizeProvider/Size.types.d.ts +30 -0
- package/context/SizeProvider/SizeContext.d.ts +4 -0
- package/context/SizeProvider/SizeContext.js +13 -0
- package/context/SizeProvider/SizeProvider.d.ts +11 -0
- package/context/SizeProvider/SizeProvider.js +26 -0
- package/context/SizeProvider/index.d.ts +4 -0
- package/context/SizeProvider/index.js +4 -0
- package/context/SizeProvider/useChartContainerDimensions.d.ts +9 -0
- package/{modern/ResponsiveChartContainer → context/SizeProvider}/useChartContainerDimensions.js +15 -7
- package/context/SizeProvider/useSize.d.ts +5 -0
- package/context/SizeProvider/useSize.js +13 -0
- package/context/SvgRefProvider/SvgRef.types.d.ts +8 -0
- package/context/SvgRefProvider/SvgRef.types.js +1 -0
- package/context/SvgRefProvider/SvgRefContext.d.ts +4 -0
- package/context/SvgRefProvider/SvgRefContext.js +17 -0
- package/context/SvgRefProvider/SvgRefProvider.d.ts +3 -0
- package/context/SvgRefProvider/SvgRefProvider.js +24 -0
- package/context/SvgRefProvider/index.d.ts +4 -0
- package/context/SvgRefProvider/index.js +4 -0
- package/context/SvgRefProvider/useSurfaceRef.d.ts +2 -0
- package/context/SvgRefProvider/useSurfaceRef.js +14 -0
- package/context/ZAxisContextProvider.d.ts +1 -1
- package/context/index.d.ts +2 -0
- package/context/index.js +2 -1
- package/hooks/useAxisEvents.js +32 -19
- package/hooks/useChartId.js +2 -2
- package/hooks/useDrawingArea.d.ts +2 -2
- package/hooks/useDrawingArea.js +2 -2
- package/hooks/useInteractionItemProps.js +19 -12
- package/hooks/useSvgRef.js +3 -3
- package/index.d.ts +1 -2
- package/index.js +2 -3
- package/internals/components/ChartsAxesGradients/ChartsAxesGradients.d.ts +1 -1
- package/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +9 -4
- package/internals/computeAxisValue.d.ts +2 -2
- package/internals/defaultizeColor.d.ts +1 -8
- package/internals/getSymbol.js +19 -3
- package/internals/index.d.ts +7 -6
- package/internals/index.js +7 -6
- package/internals/plugins/models/index.d.ts +35 -0
- package/internals/plugins/models/index.js +1 -0
- package/internals/plugins/utils/ChartStore.d.ts +12 -0
- package/internals/plugins/utils/ChartStore.js +26 -0
- package/internals/plugins/utils/ChartsStore.d.ts +12 -0
- package/internals/plugins/utils/ChartsStore.js +26 -0
- package/internals/plugins/utils/selectors.d.ts +9 -0
- package/internals/plugins/utils/selectors.js +37 -0
- package/internals/useCharts.d.ts +6 -0
- package/internals/useCharts.js +29 -0
- package/internals/useSelector.d.ts +4 -0
- package/internals/useSelector.js +6 -0
- package/internals/useStore.d.ts +2 -0
- package/internals/useStore.js +17 -0
- package/internals/useStringInterpolator.js +1 -0
- package/models/seriesType/bar.d.ts +1 -1
- package/models/seriesType/common.d.ts +0 -10
- package/models/seriesType/config.d.ts +1 -1
- package/models/seriesType/line.d.ts +1 -1
- package/models/seriesType/pie.d.ts +1 -1
- package/models/seriesType/scatter.d.ts +1 -6
- package/modern/BarChart/AnimatedBarElement.js +21 -0
- package/modern/BarChart/BarChart.js +9 -59
- package/modern/BarChart/BarElement.js +10 -20
- package/modern/BarChart/BarPlot.js +24 -6
- package/modern/BarChart/extremums.js +3 -3
- package/modern/BarChart/useBarChartProps.js +4 -11
- package/modern/ChartContainer/ChartContainer.js +15 -44
- package/modern/ChartContainer/ResizableContainer.js +60 -0
- package/modern/ChartContainer/useChartContainerProps.js +29 -59
- package/modern/ChartsAxisHighlight/ChartsAxisHighlight.js +10 -96
- package/modern/ChartsAxisHighlight/ChartsAxisHighlight.types.js +1 -0
- package/modern/ChartsAxisHighlight/ChartsAxisHighlightPath.js +34 -0
- package/modern/ChartsAxisHighlight/ChartsXAxisHighlight.js +53 -0
- package/modern/ChartsAxisHighlight/ChartsYAxisHighlight.js +53 -0
- package/modern/ChartsAxisHighlight/chartsAxisHighlightClasses.js +6 -0
- package/modern/ChartsAxisHighlight/index.js +4 -1
- package/modern/ChartsGrid/ChartsGrid.js +1 -1
- package/modern/ChartsGrid/ChartsHorizontalGrid.js +3 -3
- package/modern/ChartsGrid/ChartsVerticalGrid.js +3 -3
- package/modern/ChartsLegend/ChartsLegend.js +0 -3
- package/modern/ChartsLegend/DefaultChartsLegend.js +1 -12
- package/modern/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +11 -9
- package/modern/ChartsSurface/ChartsSurface.js +35 -34
- package/modern/ChartsTooltip/ChartTooltip.types.js +1 -0
- package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +83 -72
- package/modern/ChartsTooltip/ChartsItemTooltipContent.js +54 -44
- package/modern/ChartsTooltip/ChartsTooltip.js +162 -107
- package/modern/ChartsTooltip/ChartsTooltipContainer.js +298 -0
- package/modern/ChartsTooltip/chartsTooltipClasses.js +18 -2
- package/modern/ChartsTooltip/index.js +2 -3
- package/modern/ChartsTooltip/useAxisTooltip.js +21 -21
- package/modern/ChartsTooltip/useItemTooltip.js +8 -7
- package/modern/ChartsTooltip/utils.js +45 -50
- package/modern/ChartsVoronoiHandler/ChartsVoronoiHandler.js +50 -39
- package/modern/Gauge/Gauge.js +0 -6
- package/modern/Gauge/GaugeContainer.js +60 -61
- package/modern/LineChart/AnimatedArea.js +9 -18
- package/modern/LineChart/AnimatedLine.js +9 -20
- package/modern/LineChart/AreaPlot.js +14 -8
- package/modern/LineChart/CircleMarkElement.js +6 -5
- package/modern/LineChart/LineChart.js +9 -60
- package/modern/LineChart/LineHighlightPlot.js +8 -11
- package/modern/LineChart/LinePlot.js +14 -8
- package/modern/LineChart/MarkElement.js +6 -5
- package/modern/LineChart/MarkPlot.js +2 -6
- package/modern/LineChart/extremums.js +10 -6
- package/modern/LineChart/useLineChartProps.js +4 -11
- package/modern/PieChart/PieArc.js +1 -10
- package/modern/PieChart/PieArcPlot.js +0 -5
- package/modern/PieChart/PieChart.js +20 -137
- package/modern/PieChart/PiePlot.js +2 -2
- package/modern/ScatterChart/Scatter.js +6 -5
- package/modern/ScatterChart/ScatterChart.js +11 -60
- package/modern/ScatterChart/ScatterPlot.js +3 -6
- package/modern/ScatterChart/extremums.js +6 -6
- package/modern/ScatterChart/useScatterChartProps.js +3 -12
- package/modern/SparkLineChart/SparkLineChart.js +6 -33
- package/modern/{ResponsiveChartContainer/ResponsiveChartContainer.js → context/ChartDataProvider/ChartDataProvider.js} +45 -39
- package/modern/context/ChartDataProvider/index.js +1 -0
- package/modern/context/ChartDataProvider/useChartDataProviderProps.js +66 -0
- package/{ChartContainer → modern/context/ChartDataProvider}/useDefaultizeAxis.js +1 -1
- package/modern/context/DrawingAreaProvider/DrawingArea.types.js +1 -0
- package/modern/context/DrawingAreaProvider/DrawingAreaContext.js +16 -0
- package/{context/DrawingProvider.js → modern/context/DrawingAreaProvider/DrawingAreaProvider.js} +11 -41
- package/modern/context/DrawingAreaProvider/index.js +3 -0
- package/modern/context/HighlightedProvider/HighlightedProvider.js +1 -16
- package/modern/context/InteractionProvider.js +8 -64
- package/modern/context/InteractionSelectors.js +12 -0
- package/modern/context/SizeProvider/Size.types.js +1 -0
- package/modern/context/SizeProvider/SizeContext.js +13 -0
- package/modern/context/SizeProvider/SizeProvider.js +26 -0
- package/modern/context/SizeProvider/index.js +4 -0
- package/{ResponsiveChartContainer → modern/context/SizeProvider}/useChartContainerDimensions.js +15 -7
- package/modern/context/SizeProvider/useSize.js +13 -0
- package/modern/context/SvgRefProvider/SvgRef.types.js +1 -0
- package/modern/context/SvgRefProvider/SvgRefContext.js +17 -0
- package/modern/context/SvgRefProvider/SvgRefProvider.js +24 -0
- package/modern/context/SvgRefProvider/index.js +4 -0
- package/modern/context/SvgRefProvider/useSurfaceRef.js +14 -0
- package/modern/context/index.js +2 -1
- package/modern/hooks/useAxisEvents.js +32 -19
- package/modern/hooks/useChartId.js +2 -2
- package/modern/hooks/useDrawingArea.js +2 -2
- package/modern/hooks/useInteractionItemProps.js +19 -12
- package/modern/hooks/useSvgRef.js +3 -3
- package/modern/index.js +2 -3
- package/modern/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +9 -4
- package/modern/internals/getSymbol.js +19 -3
- package/modern/internals/index.js +7 -6
- package/modern/internals/plugins/models/index.js +1 -0
- package/modern/internals/plugins/utils/ChartStore.js +26 -0
- package/modern/internals/plugins/utils/ChartsStore.js +26 -0
- package/modern/internals/plugins/utils/selectors.js +37 -0
- package/modern/internals/useCharts.js +29 -0
- package/modern/internals/useSelector.js +6 -0
- package/modern/internals/useStore.js +17 -0
- package/modern/internals/useStringInterpolator.js +1 -0
- package/node/BarChart/AnimatedBarElement.js +28 -0
- package/node/BarChart/BarChart.js +9 -59
- package/node/BarChart/BarElement.js +11 -21
- package/node/BarChart/BarPlot.js +22 -4
- package/node/BarChart/extremums.js +3 -3
- package/node/BarChart/useBarChartProps.js +4 -11
- package/node/ChartContainer/ChartContainer.js +14 -43
- package/node/ChartContainer/ResizableContainer.js +68 -0
- package/node/ChartContainer/useChartContainerProps.js +29 -60
- package/node/ChartsAxisHighlight/ChartsAxisHighlight.js +12 -100
- package/node/ChartsAxisHighlight/ChartsAxisHighlightPath.js +40 -0
- package/node/ChartsAxisHighlight/ChartsXAxisHighlight.js +57 -0
- package/node/ChartsAxisHighlight/ChartsYAxisHighlight.js +57 -0
- package/node/ChartsAxisHighlight/chartsAxisHighlightClasses.js +14 -0
- package/node/ChartsAxisHighlight/index.js +33 -0
- package/node/ChartsGrid/ChartsGrid.js +2 -2
- package/node/ChartsGrid/ChartsHorizontalGrid.js +4 -4
- package/node/ChartsGrid/ChartsVerticalGrid.js +4 -4
- package/node/ChartsLegend/ChartsLegend.js +0 -3
- package/node/ChartsLegend/DefaultChartsLegend.js +1 -12
- package/node/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +11 -9
- package/node/ChartsSurface/ChartsSurface.js +35 -34
- package/node/ChartsTooltip/ChartsAxisTooltipContent.js +83 -73
- package/node/ChartsTooltip/ChartsItemTooltipContent.js +54 -45
- package/node/ChartsTooltip/ChartsTooltip.js +161 -106
- package/node/ChartsTooltip/ChartsTooltipContainer.js +304 -0
- package/node/ChartsTooltip/chartsTooltipClasses.js +22 -3
- package/node/ChartsTooltip/index.js +19 -28
- package/node/ChartsTooltip/useAxisTooltip.js +21 -21
- package/node/ChartsTooltip/useItemTooltip.js +8 -7
- package/node/ChartsTooltip/utils.js +46 -53
- package/node/ChartsVoronoiHandler/ChartsVoronoiHandler.js +51 -40
- package/node/Gauge/Gauge.js +0 -6
- package/node/Gauge/GaugeContainer.js +60 -61
- package/node/LineChart/AnimatedArea.js +9 -19
- package/node/LineChart/AnimatedLine.js +9 -21
- package/node/LineChart/AreaPlot.js +13 -7
- package/node/LineChart/CircleMarkElement.js +6 -5
- package/node/LineChart/LineChart.js +9 -60
- package/node/LineChart/LineHighlightPlot.js +8 -11
- package/node/LineChart/LinePlot.js +13 -7
- package/node/LineChart/MarkElement.js +6 -5
- package/node/LineChart/MarkPlot.js +2 -6
- package/node/LineChart/extremums.js +10 -6
- package/node/LineChart/useLineChartProps.js +4 -11
- package/node/PieChart/PieArc.js +1 -10
- package/node/PieChart/PieArcPlot.js +0 -5
- package/node/PieChart/PieChart.js +20 -137
- package/node/PieChart/PiePlot.js +2 -2
- package/node/ScatterChart/Scatter.js +6 -5
- package/node/ScatterChart/ScatterChart.js +11 -60
- package/node/ScatterChart/ScatterPlot.js +3 -6
- package/node/ScatterChart/extremums.js +6 -6
- package/node/ScatterChart/useScatterChartProps.js +3 -12
- package/node/SparkLineChart/SparkLineChart.js +6 -33
- package/node/{ResponsiveChartContainer/ResponsiveChartContainer.js → context/ChartDataProvider/ChartDataProvider.js} +45 -39
- package/node/context/ChartDataProvider/index.js +16 -0
- package/node/context/ChartDataProvider/useChartDataProviderProps.js +72 -0
- package/node/{ChartContainer → context/ChartDataProvider}/useDefaultizeAxis.js +1 -1
- package/node/context/DrawingAreaProvider/DrawingArea.types.js +5 -0
- package/node/context/DrawingAreaProvider/DrawingAreaContext.js +22 -0
- package/node/context/{DrawingProvider.js → DrawingAreaProvider/DrawingAreaProvider.js} +12 -44
- package/node/context/DrawingAreaProvider/index.js +38 -0
- package/node/context/HighlightedProvider/HighlightedProvider.js +1 -16
- package/node/context/InteractionProvider.js +9 -66
- package/node/context/InteractionSelectors.js +18 -0
- package/node/context/SizeProvider/Size.types.js +5 -0
- package/node/context/SizeProvider/SizeContext.js +20 -0
- package/node/context/SizeProvider/SizeProvider.js +29 -0
- package/node/context/SizeProvider/index.js +49 -0
- package/node/{ResponsiveChartContainer → context/SizeProvider}/useChartContainerDimensions.js +15 -7
- package/node/context/SizeProvider/useSize.js +20 -0
- package/node/context/SvgRefProvider/SvgRef.types.js +5 -0
- package/node/context/SvgRefProvider/SvgRefContext.js +23 -0
- package/node/context/SvgRefProvider/SvgRefProvider.js +31 -0
- package/node/context/SvgRefProvider/index.js +49 -0
- package/node/context/SvgRefProvider/useSurfaceRef.js +20 -0
- package/node/context/index.js +10 -2
- package/node/hooks/useAxisEvents.js +33 -19
- package/node/hooks/useChartId.js +2 -2
- package/node/hooks/useDrawingArea.js +2 -2
- package/node/hooks/useInteractionItemProps.js +20 -13
- package/node/hooks/useSvgRef.js +3 -3
- package/node/index.js +5 -16
- package/node/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +9 -4
- package/node/internals/getSymbol.js +19 -3
- package/node/internals/index.js +64 -44
- package/node/internals/plugins/models/index.js +5 -0
- package/node/internals/plugins/utils/ChartStore.js +33 -0
- package/node/internals/plugins/utils/ChartsStore.js +33 -0
- package/node/internals/plugins/utils/selectors.js +44 -0
- package/node/internals/useCharts.js +36 -0
- package/node/internals/useSelector.js +13 -0
- package/node/internals/useStore.js +24 -0
- package/node/internals/useStringInterpolator.js +2 -0
- package/package.json +8 -6
- package/themeAugmentation/props.d.ts +1 -2
- package/ChartsTooltip/DefaultChartsAxisTooltipContent.d.ts +0 -7
- package/ChartsTooltip/DefaultChartsAxisTooltipContent.js +0 -123
- package/ChartsTooltip/DefaultChartsItemTooltipContent.d.ts +0 -8
- package/ChartsTooltip/DefaultChartsItemTooltipContent.js +0 -92
- package/ResponsiveChartContainer/ResizableContainer.d.ts +0 -9
- package/ResponsiveChartContainer/ResizableContainer.js +0 -26
- package/ResponsiveChartContainer/ResponsiveChartContainer.d.ts +0 -24
- package/ResponsiveChartContainer/index.d.ts +0 -1
- package/ResponsiveChartContainer/index.js +0 -1
- package/ResponsiveChartContainer/package.json +0 -6
- package/ResponsiveChartContainer/useChartContainerDimensions.d.ts +0 -6
- package/ResponsiveChartContainer/useResponsiveChartContainerProps.d.ts +0 -19
- package/ResponsiveChartContainer/useResponsiveChartContainerProps.js +0 -70
- package/internals/SlotComponentPropsFromProps.d.ts +0 -1
- package/models/helpers.d.ts +0 -3
- package/modern/ChartsTooltip/DefaultChartsAxisTooltipContent.js +0 -123
- package/modern/ChartsTooltip/DefaultChartsItemTooltipContent.js +0 -92
- package/modern/ResponsiveChartContainer/ResizableContainer.js +0 -26
- package/modern/ResponsiveChartContainer/index.js +0 -1
- package/modern/ResponsiveChartContainer/useResponsiveChartContainerProps.js +0 -70
- package/node/ChartsTooltip/DefaultChartsAxisTooltipContent.js +0 -129
- package/node/ChartsTooltip/DefaultChartsItemTooltipContent.js +0 -98
- package/node/ResponsiveChartContainer/ResizableContainer.js +0 -32
- package/node/ResponsiveChartContainer/index.js +0 -16
- package/node/ResponsiveChartContainer/useResponsiveChartContainerProps.js +0 -77
- /package/{internals/SlotComponentPropsFromProps.js → ChartsAxisHighlight/ChartsAxisHighlight.types.js} +0 -0
- /package/ChartsGrid/{styledCommonents.d.ts → styledComponents.d.ts} +0 -0
- /package/ChartsGrid/{styledCommonents.js → styledComponents.js} +0 -0
- /package/{models/helpers.js → ChartsTooltip/ChartTooltip.types.js} +0 -0
- /package/{modern/internals/SlotComponentPropsFromProps.js → context/DrawingAreaProvider/DrawingArea.types.js} +0 -0
- /package/{modern/models/helpers.js → context/SizeProvider/Size.types.js} +0 -0
- /package/modern/ChartsGrid/{styledCommonents.js → styledComponents.js} +0 -0
- /package/node/{internals/SlotComponentPropsFromProps.js → ChartsAxisHighlight/ChartsAxisHighlight.types.js} +0 -0
- /package/node/ChartsGrid/{styledCommonents.js → styledComponents.js} +0 -0
- /package/node/{models/helpers.js → ChartsTooltip/ChartTooltip.types.js} +0 -0
|
@@ -3,45 +3,11 @@
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
-
import composeClasses from '@mui/utils/composeClasses';
|
|
7
|
-
import { styled, useThemeProps } from '@mui/material/styles';
|
|
8
|
-
import Popper from '@mui/material/Popper';
|
|
9
|
-
import NoSsr from '@mui/material/NoSsr';
|
|
10
|
-
import useSlotProps from '@mui/utils/useSlotProps';
|
|
11
|
-
import { InteractionContext } from "../context/InteractionProvider.js";
|
|
12
|
-
import { generateVirtualElement, useMouseTracker, getTooltipHasData } from "./utils.js";
|
|
13
6
|
import { ChartsItemTooltipContent } from "./ChartsItemTooltipContent.js";
|
|
14
7
|
import { ChartsAxisTooltipContent } from "./ChartsAxisTooltipContent.js";
|
|
15
|
-
import {
|
|
8
|
+
import { ChartsTooltipContainer } from "./ChartsTooltipContainer.js";
|
|
9
|
+
import { useUtilityClasses } from "./chartsTooltipClasses.js";
|
|
16
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
|
-
const useUtilityClasses = ownerState => {
|
|
18
|
-
const {
|
|
19
|
-
classes
|
|
20
|
-
} = ownerState;
|
|
21
|
-
const slots = {
|
|
22
|
-
root: ['root'],
|
|
23
|
-
paper: ['paper'],
|
|
24
|
-
table: ['table'],
|
|
25
|
-
row: ['row'],
|
|
26
|
-
cell: ['cell'],
|
|
27
|
-
mark: ['mark'],
|
|
28
|
-
markCell: ['markCell'],
|
|
29
|
-
labelCell: ['labelCell'],
|
|
30
|
-
valueCell: ['valueCell']
|
|
31
|
-
};
|
|
32
|
-
return composeClasses(slots, getChartsTooltipUtilityClass, classes);
|
|
33
|
-
};
|
|
34
|
-
const ChartsTooltipRoot = styled(Popper, {
|
|
35
|
-
name: 'MuiChartsTooltip',
|
|
36
|
-
slot: 'Root',
|
|
37
|
-
overridesResolver: (_, styles) => styles.root
|
|
38
|
-
})(({
|
|
39
|
-
theme
|
|
40
|
-
}) => ({
|
|
41
|
-
pointerEvents: 'none',
|
|
42
|
-
zIndex: theme.zIndex.modal
|
|
43
|
-
}));
|
|
44
|
-
|
|
45
11
|
/**
|
|
46
12
|
* Demos:
|
|
47
13
|
*
|
|
@@ -51,71 +17,20 @@ const ChartsTooltipRoot = styled(Popper, {
|
|
|
51
17
|
*
|
|
52
18
|
* - [ChartsTooltip API](https://mui.com/x/api/charts/charts-tool-tip/)
|
|
53
19
|
*/
|
|
54
|
-
function ChartsTooltip(
|
|
55
|
-
const props = useThemeProps({
|
|
56
|
-
props: inProps,
|
|
57
|
-
name: 'MuiChartsTooltip'
|
|
58
|
-
});
|
|
20
|
+
function ChartsTooltip(props) {
|
|
59
21
|
const {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
axisContent,
|
|
63
|
-
slots,
|
|
64
|
-
slotProps
|
|
22
|
+
classes: propClasses,
|
|
23
|
+
trigger = 'axis'
|
|
65
24
|
} = props;
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
axis
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
classes: props.classes
|
|
76
|
-
});
|
|
77
|
-
const PopperComponent = slots?.popper ?? ChartsTooltipRoot;
|
|
78
|
-
const popperProps = useSlotProps({
|
|
79
|
-
elementType: PopperComponent,
|
|
80
|
-
externalSlotProps: slotProps?.popper,
|
|
81
|
-
additionalProps: {
|
|
82
|
-
open: popperOpen,
|
|
83
|
-
placement: mousePosition?.pointerType === 'mouse' ? 'right-start' : 'top',
|
|
84
|
-
anchorEl: generateVirtualElement(mousePosition),
|
|
85
|
-
modifiers: [{
|
|
86
|
-
name: 'offset',
|
|
87
|
-
options: {
|
|
88
|
-
offset: [0, mousePosition?.pointerType === 'touch' ? 40 - mousePosition.height : 0]
|
|
89
|
-
}
|
|
90
|
-
}]
|
|
91
|
-
},
|
|
92
|
-
ownerState: {}
|
|
93
|
-
});
|
|
94
|
-
if (trigger === 'none') {
|
|
95
|
-
return null;
|
|
96
|
-
}
|
|
97
|
-
return /*#__PURE__*/_jsx(NoSsr, {
|
|
98
|
-
children: popperOpen && /*#__PURE__*/_jsx(PopperComponent, _extends({}, popperProps, {
|
|
99
|
-
className: classes.root,
|
|
100
|
-
children: trigger === 'item' ? /*#__PURE__*/_jsx(ChartsItemTooltipContent, {
|
|
101
|
-
itemData: displayedData,
|
|
102
|
-
content: slots?.itemContent ?? itemContent,
|
|
103
|
-
contentProps: slotProps?.itemContent,
|
|
104
|
-
sx: {
|
|
105
|
-
mx: 2
|
|
106
|
-
},
|
|
107
|
-
classes: classes
|
|
108
|
-
}) : /*#__PURE__*/_jsx(ChartsAxisTooltipContent, {
|
|
109
|
-
axisData: displayedData,
|
|
110
|
-
content: slots?.axisContent ?? axisContent,
|
|
111
|
-
contentProps: slotProps?.axisContent,
|
|
112
|
-
sx: {
|
|
113
|
-
mx: 2
|
|
114
|
-
},
|
|
115
|
-
classes: classes
|
|
116
|
-
})
|
|
117
|
-
}))
|
|
118
|
-
});
|
|
25
|
+
const classes = useUtilityClasses(propClasses);
|
|
26
|
+
return /*#__PURE__*/_jsx(ChartsTooltipContainer, _extends({}, props, {
|
|
27
|
+
classes: classes,
|
|
28
|
+
children: trigger === 'axis' ? /*#__PURE__*/_jsx(ChartsAxisTooltipContent, {
|
|
29
|
+
classes: classes
|
|
30
|
+
}) : /*#__PURE__*/_jsx(ChartsItemTooltipContent, {
|
|
31
|
+
classes: classes
|
|
32
|
+
})
|
|
33
|
+
}));
|
|
119
34
|
}
|
|
120
35
|
process.env.NODE_ENV !== "production" ? ChartsTooltip.propTypes = {
|
|
121
36
|
// ----------------------------- Warning --------------------------------
|
|
@@ -123,29 +38,169 @@ process.env.NODE_ENV !== "production" ? ChartsTooltip.propTypes = {
|
|
|
123
38
|
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
124
39
|
// ----------------------------------------------------------------------
|
|
125
40
|
/**
|
|
126
|
-
*
|
|
127
|
-
*
|
|
41
|
+
* An HTML element, [virtualElement](https://popper.js.org/docs/v2/virtual-elements/),
|
|
42
|
+
* or a function that returns either.
|
|
43
|
+
* It's used to set the position of the popper.
|
|
44
|
+
* The return value will passed as the reference object of the Popper instance.
|
|
128
45
|
*/
|
|
129
|
-
|
|
46
|
+
anchorEl: PropTypes.oneOfType([(props, propName) => {
|
|
47
|
+
if (props[propName] == null) {
|
|
48
|
+
return new Error(`Prop '${propName}' is required but wasn't specified`);
|
|
49
|
+
}
|
|
50
|
+
if (typeof props[propName] !== 'object' || props[propName].nodeType !== 1) {
|
|
51
|
+
return new Error(`Expected prop '${propName}' to be of type Element`);
|
|
52
|
+
}
|
|
53
|
+
return null;
|
|
54
|
+
}, PropTypes.func, PropTypes.shape({
|
|
55
|
+
contextElement: (props, propName) => {
|
|
56
|
+
if (props[propName] == null) {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
if (typeof props[propName] !== 'object' || props[propName].nodeType !== 1) {
|
|
60
|
+
return new Error(`Expected prop '${propName}' to be of type Element`);
|
|
61
|
+
}
|
|
62
|
+
return null;
|
|
63
|
+
},
|
|
64
|
+
getBoundingClientRect: PropTypes.func.isRequired
|
|
65
|
+
})]),
|
|
130
66
|
/**
|
|
131
67
|
* Override or extend the styles applied to the component.
|
|
132
68
|
*/
|
|
133
69
|
classes: PropTypes.object,
|
|
134
70
|
/**
|
|
135
|
-
*
|
|
136
|
-
*
|
|
71
|
+
* The component used for the root node.
|
|
72
|
+
* Either a string to use a HTML element or a component.
|
|
73
|
+
*/
|
|
74
|
+
component: PropTypes.elementType,
|
|
75
|
+
/**
|
|
76
|
+
* The components used for each slot inside the Popper.
|
|
77
|
+
* Either a string to use a HTML element or a component.
|
|
78
|
+
* @default {}
|
|
137
79
|
*/
|
|
138
|
-
|
|
80
|
+
components: PropTypes.shape({
|
|
81
|
+
Root: PropTypes.elementType
|
|
82
|
+
}),
|
|
139
83
|
/**
|
|
140
|
-
* The props used for each
|
|
84
|
+
* The props used for each slot inside the Popper.
|
|
85
|
+
* @default {}
|
|
86
|
+
*/
|
|
87
|
+
componentsProps: PropTypes.shape({
|
|
88
|
+
root: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
|
|
89
|
+
}),
|
|
90
|
+
/**
|
|
91
|
+
* An HTML element or function that returns one.
|
|
92
|
+
* The `container` will have the portal children appended to it.
|
|
93
|
+
*
|
|
94
|
+
* You can also provide a callback, which is called in a React layout effect.
|
|
95
|
+
* This lets you set the container from a ref, and also makes server-side rendering possible.
|
|
96
|
+
*
|
|
97
|
+
* By default, it uses the body of the top-level document object,
|
|
98
|
+
* so it's simply `document.body` most of the time.
|
|
99
|
+
*/
|
|
100
|
+
container: PropTypes.oneOfType([(props, propName) => {
|
|
101
|
+
if (props[propName] == null) {
|
|
102
|
+
return new Error(`Prop '${propName}' is required but wasn't specified`);
|
|
103
|
+
}
|
|
104
|
+
if (typeof props[propName] !== 'object' || props[propName].nodeType !== 1) {
|
|
105
|
+
return new Error(`Expected prop '${propName}' to be of type Element`);
|
|
106
|
+
}
|
|
107
|
+
return null;
|
|
108
|
+
}, PropTypes.func]),
|
|
109
|
+
/**
|
|
110
|
+
* The `children` will be under the DOM hierarchy of the parent component.
|
|
111
|
+
* @default false
|
|
112
|
+
*/
|
|
113
|
+
disablePortal: PropTypes.bool,
|
|
114
|
+
/**
|
|
115
|
+
* Always keep the children in the DOM.
|
|
116
|
+
* This prop can be useful in SEO situation or
|
|
117
|
+
* when you want to maximize the responsiveness of the Popper.
|
|
118
|
+
* @default false
|
|
119
|
+
*/
|
|
120
|
+
keepMounted: PropTypes.bool,
|
|
121
|
+
/**
|
|
122
|
+
* Popper.js is based on a "plugin-like" architecture,
|
|
123
|
+
* most of its features are fully encapsulated "modifiers".
|
|
124
|
+
*
|
|
125
|
+
* A modifier is a function that is called each time Popper.js needs to
|
|
126
|
+
* compute the position of the popper.
|
|
127
|
+
* For this reason, modifiers should be very performant to avoid bottlenecks.
|
|
128
|
+
* To learn how to create a modifier, [read the modifiers documentation](https://popper.js.org/docs/v2/modifiers/).
|
|
129
|
+
*/
|
|
130
|
+
modifiers: PropTypes.arrayOf(PropTypes.shape({
|
|
131
|
+
data: PropTypes.object,
|
|
132
|
+
effect: PropTypes.func,
|
|
133
|
+
enabled: PropTypes.bool,
|
|
134
|
+
fn: PropTypes.func,
|
|
135
|
+
name: PropTypes.any,
|
|
136
|
+
options: PropTypes.object,
|
|
137
|
+
phase: PropTypes.oneOf(['afterMain', 'afterRead', 'afterWrite', 'beforeMain', 'beforeRead', 'beforeWrite', 'main', 'read', 'write']),
|
|
138
|
+
requires: PropTypes.arrayOf(PropTypes.string),
|
|
139
|
+
requiresIfExists: PropTypes.arrayOf(PropTypes.string)
|
|
140
|
+
})),
|
|
141
|
+
/**
|
|
142
|
+
* If `true`, the component is shown.
|
|
143
|
+
*/
|
|
144
|
+
open: PropTypes.bool,
|
|
145
|
+
/**
|
|
146
|
+
* Popper placement.
|
|
147
|
+
* @default 'bottom'
|
|
148
|
+
*/
|
|
149
|
+
placement: PropTypes.oneOf(['auto-end', 'auto-start', 'auto', 'bottom-end', 'bottom-start', 'bottom', 'left-end', 'left-start', 'left', 'right-end', 'right-start', 'right', 'top-end', 'top-start', 'top']),
|
|
150
|
+
/**
|
|
151
|
+
* Options provided to the [`Popper.js`](https://popper.js.org/docs/v2/constructors/#options) instance.
|
|
152
|
+
* @default {}
|
|
153
|
+
*/
|
|
154
|
+
popperOptions: PropTypes.shape({
|
|
155
|
+
modifiers: PropTypes.array,
|
|
156
|
+
onFirstUpdate: PropTypes.func,
|
|
157
|
+
placement: PropTypes.oneOf(['auto-end', 'auto-start', 'auto', 'bottom-end', 'bottom-start', 'bottom', 'left-end', 'left-start', 'left', 'right-end', 'right-start', 'right', 'top-end', 'top-start', 'top']),
|
|
158
|
+
strategy: PropTypes.oneOf(['absolute', 'fixed'])
|
|
159
|
+
}),
|
|
160
|
+
/**
|
|
161
|
+
* A ref that points to the used popper instance.
|
|
162
|
+
*/
|
|
163
|
+
popperRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
164
|
+
current: PropTypes.shape({
|
|
165
|
+
destroy: PropTypes.func.isRequired,
|
|
166
|
+
forceUpdate: PropTypes.func.isRequired,
|
|
167
|
+
setOptions: PropTypes.func.isRequired,
|
|
168
|
+
state: PropTypes.shape({
|
|
169
|
+
attributes: PropTypes.object.isRequired,
|
|
170
|
+
elements: PropTypes.object.isRequired,
|
|
171
|
+
modifiersData: PropTypes.object.isRequired,
|
|
172
|
+
options: PropTypes.object.isRequired,
|
|
173
|
+
orderedModifiers: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
174
|
+
placement: PropTypes.oneOf(['auto-end', 'auto-start', 'auto', 'bottom-end', 'bottom-start', 'bottom', 'left-end', 'left-start', 'left', 'right-end', 'right-start', 'right', 'top-end', 'top-start', 'top']).isRequired,
|
|
175
|
+
rects: PropTypes.object.isRequired,
|
|
176
|
+
reset: PropTypes.bool.isRequired,
|
|
177
|
+
scrollParents: PropTypes.object.isRequired,
|
|
178
|
+
strategy: PropTypes.oneOf(['absolute', 'fixed']).isRequired,
|
|
179
|
+
styles: PropTypes.object.isRequired
|
|
180
|
+
}).isRequired,
|
|
181
|
+
update: PropTypes.func.isRequired
|
|
182
|
+
})
|
|
183
|
+
})]),
|
|
184
|
+
/**
|
|
185
|
+
* The props used for each slot inside the Popper.
|
|
141
186
|
* @default {}
|
|
142
187
|
*/
|
|
143
188
|
slotProps: PropTypes.object,
|
|
144
189
|
/**
|
|
145
|
-
*
|
|
190
|
+
* The components used for each slot inside the Popper.
|
|
191
|
+
* Either a string to use a HTML element or a component.
|
|
146
192
|
* @default {}
|
|
147
193
|
*/
|
|
148
194
|
slots: PropTypes.object,
|
|
195
|
+
/**
|
|
196
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
197
|
+
*/
|
|
198
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
199
|
+
/**
|
|
200
|
+
* Help supporting a react-transition-group/Transition component.
|
|
201
|
+
* @default false
|
|
202
|
+
*/
|
|
203
|
+
transition: PropTypes.bool,
|
|
149
204
|
/**
|
|
150
205
|
* Select the kind of tooltip to display
|
|
151
206
|
* - 'item': Shows data about the item below the mouse.
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
+
const _excluded = ["trigger", "classes", "children"];
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
import useLazyRef from '@mui/utils/useLazyRef';
|
|
9
|
+
import { styled, useThemeProps } from '@mui/material/styles';
|
|
10
|
+
import Popper from '@mui/material/Popper';
|
|
11
|
+
import NoSsr from '@mui/material/NoSsr';
|
|
12
|
+
import { useSvgRef } from "../hooks/useSvgRef.js";
|
|
13
|
+
import { usePointerType } from "./utils.js";
|
|
14
|
+
import { useSelector } from "../internals/useSelector.js";
|
|
15
|
+
import { useStore } from "../internals/useStore.js";
|
|
16
|
+
import { useXAxis } from "../hooks/index.js";
|
|
17
|
+
import { selectorChartsInteractionItemIsDefined, selectorChartsInteractionXAxisIsDefined, selectorChartsInteractionYAxisIsDefined } from "../context/InteractionSelectors.js";
|
|
18
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
|
+
const ChartsTooltipRoot = styled(Popper, {
|
|
20
|
+
name: 'MuiChartsTooltip',
|
|
21
|
+
slot: 'Root',
|
|
22
|
+
overridesResolver: (_, styles) => styles.root
|
|
23
|
+
})(({
|
|
24
|
+
theme
|
|
25
|
+
}) => ({
|
|
26
|
+
pointerEvents: 'none',
|
|
27
|
+
zIndex: theme.zIndex.modal
|
|
28
|
+
}));
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Demos:
|
|
32
|
+
*
|
|
33
|
+
* - [ChartsTooltip](https://mui.com/x/react-charts/tooltip/)
|
|
34
|
+
*
|
|
35
|
+
* API:
|
|
36
|
+
*
|
|
37
|
+
* - [ChartsTooltip API](https://mui.com/x/api/charts/charts-tool-tip/)
|
|
38
|
+
*/
|
|
39
|
+
function ChartsTooltipContainer(inProps) {
|
|
40
|
+
const props = useThemeProps({
|
|
41
|
+
props: inProps,
|
|
42
|
+
name: 'MuiChartsTooltipContainer'
|
|
43
|
+
});
|
|
44
|
+
const {
|
|
45
|
+
trigger = 'axis',
|
|
46
|
+
classes,
|
|
47
|
+
children
|
|
48
|
+
} = props,
|
|
49
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
50
|
+
const svgRef = useSvgRef();
|
|
51
|
+
const pointerType = usePointerType();
|
|
52
|
+
const xAxis = useXAxis();
|
|
53
|
+
const xAxisHasData = xAxis.data !== undefined && xAxis.data.length !== 0;
|
|
54
|
+
const popperRef = React.useRef(null);
|
|
55
|
+
const positionRef = useLazyRef(() => ({
|
|
56
|
+
x: 0,
|
|
57
|
+
y: 0
|
|
58
|
+
}));
|
|
59
|
+
const store = useStore();
|
|
60
|
+
const isOpen = useSelector(store,
|
|
61
|
+
// eslint-disable-next-line no-nested-ternary
|
|
62
|
+
trigger === 'axis' ? xAxisHasData ? selectorChartsInteractionXAxisIsDefined : selectorChartsInteractionYAxisIsDefined : selectorChartsInteractionItemIsDefined);
|
|
63
|
+
const popperOpen = pointerType !== null && isOpen; // tooltipHasData;
|
|
64
|
+
|
|
65
|
+
React.useEffect(() => {
|
|
66
|
+
const element = svgRef.current;
|
|
67
|
+
if (element === null) {
|
|
68
|
+
return () => {};
|
|
69
|
+
}
|
|
70
|
+
const handleMove = event => {
|
|
71
|
+
// eslint-disable-next-line react-compiler/react-compiler
|
|
72
|
+
positionRef.current = {
|
|
73
|
+
x: event.clientX,
|
|
74
|
+
y: event.clientY
|
|
75
|
+
};
|
|
76
|
+
popperRef.current?.update();
|
|
77
|
+
};
|
|
78
|
+
element.addEventListener('pointermove', handleMove);
|
|
79
|
+
return () => {
|
|
80
|
+
element.removeEventListener('pointermove', handleMove);
|
|
81
|
+
};
|
|
82
|
+
}, [svgRef, positionRef]);
|
|
83
|
+
if (trigger === 'none') {
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
return /*#__PURE__*/_jsx(NoSsr, {
|
|
87
|
+
children: popperOpen && /*#__PURE__*/_jsx(ChartsTooltipRoot, _extends({
|
|
88
|
+
className: classes?.root,
|
|
89
|
+
open: popperOpen,
|
|
90
|
+
placement: pointerType?.pointerType === 'mouse' ? 'right-start' : 'top',
|
|
91
|
+
popperRef: popperRef,
|
|
92
|
+
anchorEl: {
|
|
93
|
+
getBoundingClientRect: () => ({
|
|
94
|
+
x: positionRef.current.x,
|
|
95
|
+
y: positionRef.current.y,
|
|
96
|
+
top: positionRef.current.y,
|
|
97
|
+
left: positionRef.current.x,
|
|
98
|
+
right: positionRef.current.x,
|
|
99
|
+
bottom: positionRef.current.y,
|
|
100
|
+
width: 0,
|
|
101
|
+
height: 0,
|
|
102
|
+
toJSON: () => ''
|
|
103
|
+
})
|
|
104
|
+
},
|
|
105
|
+
modifiers: [{
|
|
106
|
+
name: 'offset',
|
|
107
|
+
options: {
|
|
108
|
+
offset: [0, pointerType?.pointerType === 'touch' ? 40 - pointerType.height : 0]
|
|
109
|
+
}
|
|
110
|
+
}]
|
|
111
|
+
}, other, {
|
|
112
|
+
children: children
|
|
113
|
+
}))
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
process.env.NODE_ENV !== "production" ? ChartsTooltipContainer.propTypes = {
|
|
117
|
+
// ----------------------------- Warning --------------------------------
|
|
118
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
119
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
120
|
+
// ----------------------------------------------------------------------
|
|
121
|
+
/**
|
|
122
|
+
* An HTML element, [virtualElement](https://popper.js.org/docs/v2/virtual-elements/),
|
|
123
|
+
* or a function that returns either.
|
|
124
|
+
* It's used to set the position of the popper.
|
|
125
|
+
* The return value will passed as the reference object of the Popper instance.
|
|
126
|
+
*/
|
|
127
|
+
anchorEl: PropTypes.oneOfType([(props, propName) => {
|
|
128
|
+
if (props[propName] == null) {
|
|
129
|
+
return new Error(`Prop '${propName}' is required but wasn't specified`);
|
|
130
|
+
}
|
|
131
|
+
if (typeof props[propName] !== 'object' || props[propName].nodeType !== 1) {
|
|
132
|
+
return new Error(`Expected prop '${propName}' to be of type Element`);
|
|
133
|
+
}
|
|
134
|
+
return null;
|
|
135
|
+
}, PropTypes.func, PropTypes.shape({
|
|
136
|
+
contextElement: (props, propName) => {
|
|
137
|
+
if (props[propName] == null) {
|
|
138
|
+
return null;
|
|
139
|
+
}
|
|
140
|
+
if (typeof props[propName] !== 'object' || props[propName].nodeType !== 1) {
|
|
141
|
+
return new Error(`Expected prop '${propName}' to be of type Element`);
|
|
142
|
+
}
|
|
143
|
+
return null;
|
|
144
|
+
},
|
|
145
|
+
getBoundingClientRect: PropTypes.func.isRequired
|
|
146
|
+
})]),
|
|
147
|
+
/**
|
|
148
|
+
* Popper render function or node.
|
|
149
|
+
*/
|
|
150
|
+
children: PropTypes.node,
|
|
151
|
+
/**
|
|
152
|
+
* Override or extend the styles applied to the component.
|
|
153
|
+
*/
|
|
154
|
+
classes: PropTypes.object,
|
|
155
|
+
/**
|
|
156
|
+
* The component used for the root node.
|
|
157
|
+
* Either a string to use a HTML element or a component.
|
|
158
|
+
*/
|
|
159
|
+
component: PropTypes.elementType,
|
|
160
|
+
/**
|
|
161
|
+
* The components used for each slot inside the Popper.
|
|
162
|
+
* Either a string to use a HTML element or a component.
|
|
163
|
+
* @default {}
|
|
164
|
+
*/
|
|
165
|
+
components: PropTypes.shape({
|
|
166
|
+
Root: PropTypes.elementType
|
|
167
|
+
}),
|
|
168
|
+
/**
|
|
169
|
+
* The props used for each slot inside the Popper.
|
|
170
|
+
* @default {}
|
|
171
|
+
*/
|
|
172
|
+
componentsProps: PropTypes.shape({
|
|
173
|
+
root: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
|
|
174
|
+
}),
|
|
175
|
+
/**
|
|
176
|
+
* An HTML element or function that returns one.
|
|
177
|
+
* The `container` will have the portal children appended to it.
|
|
178
|
+
*
|
|
179
|
+
* You can also provide a callback, which is called in a React layout effect.
|
|
180
|
+
* This lets you set the container from a ref, and also makes server-side rendering possible.
|
|
181
|
+
*
|
|
182
|
+
* By default, it uses the body of the top-level document object,
|
|
183
|
+
* so it's simply `document.body` most of the time.
|
|
184
|
+
*/
|
|
185
|
+
container: PropTypes.oneOfType([(props, propName) => {
|
|
186
|
+
if (props[propName] == null) {
|
|
187
|
+
return new Error(`Prop '${propName}' is required but wasn't specified`);
|
|
188
|
+
}
|
|
189
|
+
if (typeof props[propName] !== 'object' || props[propName].nodeType !== 1) {
|
|
190
|
+
return new Error(`Expected prop '${propName}' to be of type Element`);
|
|
191
|
+
}
|
|
192
|
+
return null;
|
|
193
|
+
}, PropTypes.func]),
|
|
194
|
+
/**
|
|
195
|
+
* The `children` will be under the DOM hierarchy of the parent component.
|
|
196
|
+
* @default false
|
|
197
|
+
*/
|
|
198
|
+
disablePortal: PropTypes.bool,
|
|
199
|
+
/**
|
|
200
|
+
* Always keep the children in the DOM.
|
|
201
|
+
* This prop can be useful in SEO situation or
|
|
202
|
+
* when you want to maximize the responsiveness of the Popper.
|
|
203
|
+
* @default false
|
|
204
|
+
*/
|
|
205
|
+
keepMounted: PropTypes.bool,
|
|
206
|
+
/**
|
|
207
|
+
* Popper.js is based on a "plugin-like" architecture,
|
|
208
|
+
* most of its features are fully encapsulated "modifiers".
|
|
209
|
+
*
|
|
210
|
+
* A modifier is a function that is called each time Popper.js needs to
|
|
211
|
+
* compute the position of the popper.
|
|
212
|
+
* For this reason, modifiers should be very performant to avoid bottlenecks.
|
|
213
|
+
* To learn how to create a modifier, [read the modifiers documentation](https://popper.js.org/docs/v2/modifiers/).
|
|
214
|
+
*/
|
|
215
|
+
modifiers: PropTypes.arrayOf(PropTypes.shape({
|
|
216
|
+
data: PropTypes.object,
|
|
217
|
+
effect: PropTypes.func,
|
|
218
|
+
enabled: PropTypes.bool,
|
|
219
|
+
fn: PropTypes.func,
|
|
220
|
+
name: PropTypes.any,
|
|
221
|
+
options: PropTypes.object,
|
|
222
|
+
phase: PropTypes.oneOf(['afterMain', 'afterRead', 'afterWrite', 'beforeMain', 'beforeRead', 'beforeWrite', 'main', 'read', 'write']),
|
|
223
|
+
requires: PropTypes.arrayOf(PropTypes.string),
|
|
224
|
+
requiresIfExists: PropTypes.arrayOf(PropTypes.string)
|
|
225
|
+
})),
|
|
226
|
+
/**
|
|
227
|
+
* If `true`, the component is shown.
|
|
228
|
+
*/
|
|
229
|
+
open: PropTypes.bool,
|
|
230
|
+
/**
|
|
231
|
+
* Popper placement.
|
|
232
|
+
* @default 'bottom'
|
|
233
|
+
*/
|
|
234
|
+
placement: PropTypes.oneOf(['auto-end', 'auto-start', 'auto', 'bottom-end', 'bottom-start', 'bottom', 'left-end', 'left-start', 'left', 'right-end', 'right-start', 'right', 'top-end', 'top-start', 'top']),
|
|
235
|
+
/**
|
|
236
|
+
* Options provided to the [`Popper.js`](https://popper.js.org/docs/v2/constructors/#options) instance.
|
|
237
|
+
* @default {}
|
|
238
|
+
*/
|
|
239
|
+
popperOptions: PropTypes.shape({
|
|
240
|
+
modifiers: PropTypes.array,
|
|
241
|
+
onFirstUpdate: PropTypes.func,
|
|
242
|
+
placement: PropTypes.oneOf(['auto-end', 'auto-start', 'auto', 'bottom-end', 'bottom-start', 'bottom', 'left-end', 'left-start', 'left', 'right-end', 'right-start', 'right', 'top-end', 'top-start', 'top']),
|
|
243
|
+
strategy: PropTypes.oneOf(['absolute', 'fixed'])
|
|
244
|
+
}),
|
|
245
|
+
/**
|
|
246
|
+
* A ref that points to the used popper instance.
|
|
247
|
+
*/
|
|
248
|
+
popperRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
249
|
+
current: PropTypes.shape({
|
|
250
|
+
destroy: PropTypes.func.isRequired,
|
|
251
|
+
forceUpdate: PropTypes.func.isRequired,
|
|
252
|
+
setOptions: PropTypes.func.isRequired,
|
|
253
|
+
state: PropTypes.shape({
|
|
254
|
+
attributes: PropTypes.object.isRequired,
|
|
255
|
+
elements: PropTypes.object.isRequired,
|
|
256
|
+
modifiersData: PropTypes.object.isRequired,
|
|
257
|
+
options: PropTypes.object.isRequired,
|
|
258
|
+
orderedModifiers: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
259
|
+
placement: PropTypes.oneOf(['auto-end', 'auto-start', 'auto', 'bottom-end', 'bottom-start', 'bottom', 'left-end', 'left-start', 'left', 'right-end', 'right-start', 'right', 'top-end', 'top-start', 'top']).isRequired,
|
|
260
|
+
rects: PropTypes.object.isRequired,
|
|
261
|
+
reset: PropTypes.bool.isRequired,
|
|
262
|
+
scrollParents: PropTypes.object.isRequired,
|
|
263
|
+
strategy: PropTypes.oneOf(['absolute', 'fixed']).isRequired,
|
|
264
|
+
styles: PropTypes.object.isRequired
|
|
265
|
+
}).isRequired,
|
|
266
|
+
update: PropTypes.func.isRequired
|
|
267
|
+
})
|
|
268
|
+
})]),
|
|
269
|
+
/**
|
|
270
|
+
* The props used for each slot inside the Popper.
|
|
271
|
+
* @default {}
|
|
272
|
+
*/
|
|
273
|
+
slotProps: PropTypes.object,
|
|
274
|
+
/**
|
|
275
|
+
* The components used for each slot inside the Popper.
|
|
276
|
+
* Either a string to use a HTML element or a component.
|
|
277
|
+
* @default {}
|
|
278
|
+
*/
|
|
279
|
+
slots: PropTypes.object,
|
|
280
|
+
/**
|
|
281
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
282
|
+
*/
|
|
283
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
284
|
+
/**
|
|
285
|
+
* Help supporting a react-transition-group/Transition component.
|
|
286
|
+
* @default false
|
|
287
|
+
*/
|
|
288
|
+
transition: PropTypes.bool,
|
|
289
|
+
/**
|
|
290
|
+
* Select the kind of tooltip to display
|
|
291
|
+
* - 'item': Shows data about the item below the mouse.
|
|
292
|
+
* - 'axis': Shows values associated with the hovered x value
|
|
293
|
+
* - 'none': Does not display tooltip
|
|
294
|
+
* @default 'axis'
|
|
295
|
+
*/
|
|
296
|
+
trigger: PropTypes.oneOf(['axis', 'item', 'none'])
|
|
297
|
+
} : void 0;
|
|
298
|
+
export { ChartsTooltipContainer };
|
|
@@ -1,5 +1,21 @@
|
|
|
1
|
-
import
|
|
1
|
+
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
|
2
|
+
import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
|
|
3
|
+
import composeClasses from '@mui/utils/composeClasses';
|
|
2
4
|
export function getChartsTooltipUtilityClass(slot) {
|
|
3
5
|
return generateUtilityClass('MuiChartsTooltip', slot);
|
|
4
6
|
}
|
|
5
|
-
export const chartsTooltipClasses = generateUtilityClasses('MuiChartsTooltip', ['root', 'paper', 'table', 'row', 'cell', 'mark', 'markCell', 'labelCell', 'valueCell']);
|
|
7
|
+
export const chartsTooltipClasses = generateUtilityClasses('MuiChartsTooltip', ['root', 'paper', 'table', 'row', 'cell', 'mark', 'markCell', 'labelCell', 'valueCell']);
|
|
8
|
+
export const useUtilityClasses = classes => {
|
|
9
|
+
const slots = {
|
|
10
|
+
root: ['root'],
|
|
11
|
+
paper: ['paper'],
|
|
12
|
+
table: ['table'],
|
|
13
|
+
row: ['row'],
|
|
14
|
+
cell: ['cell'],
|
|
15
|
+
mark: ['mark'],
|
|
16
|
+
markCell: ['markCell'],
|
|
17
|
+
labelCell: ['labelCell'],
|
|
18
|
+
valueCell: ['valueCell']
|
|
19
|
+
};
|
|
20
|
+
return composeClasses(slots, getChartsTooltipUtilityClass, classes);
|
|
21
|
+
};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
export * from "./ChartsTooltip.js";
|
|
2
|
-
export * from "./
|
|
2
|
+
export * from "./ChartsTooltipContainer.js";
|
|
3
|
+
export { getChartsTooltipUtilityClass, chartsTooltipClasses } from "./chartsTooltipClasses.js";
|
|
3
4
|
export * from "./ChartsAxisTooltipContent.js";
|
|
4
5
|
export * from "./ChartsItemTooltipContent.js";
|
|
5
|
-
export * from "./DefaultChartsAxisTooltipContent.js";
|
|
6
|
-
export * from "./DefaultChartsItemTooltipContent.js";
|
|
7
6
|
export * from "./ChartsTooltipTable.js";
|
|
8
7
|
export * from "./useItemTooltip.js";
|
|
9
8
|
export * from "./useAxisTooltip.js";
|