@mui/x-charts 7.16.0 → 7.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BarChart/BarChart.js +13 -0
- package/BarChart/BarElement.js +2 -0
- package/BarChart/BarLabel/BarLabel.js +2 -0
- package/BarChart/BarPlot.js +2 -0
- package/BarChart/legend.js +3 -2
- package/BarChart/useBarChartProps.js +2 -0
- package/CHANGELOG.md +184 -4
- package/ChartContainer/ChartContainer.js +2 -0
- package/ChartContainer/useChartContainerProps.js +2 -0
- package/ChartContainer/useDefaultizeAxis.js +2 -0
- package/ChartsAxis/ChartsAxis.js +2 -0
- package/ChartsAxisHighlight/ChartsAxisHighlight.js +2 -0
- package/ChartsClipPath/ChartsClipPath.js +2 -0
- package/ChartsGrid/ChartsGrid.js +2 -0
- package/ChartsLegend/ChartsLegend.d.ts +2 -2
- package/ChartsLegend/ChartsLegend.js +11 -1
- package/ChartsLegend/ChartsLegendItem.d.ts +26 -0
- package/ChartsLegend/ChartsLegendItem.js +65 -0
- package/ChartsLegend/ContinuousColorLegend.js +2 -0
- package/ChartsLegend/DefaultChartsLegend.d.ts +9 -1
- package/ChartsLegend/DefaultChartsLegend.js +26 -4
- package/ChartsLegend/LegendPerItem.d.ts +1 -0
- package/ChartsLegend/LegendPerItem.js +19 -28
- package/ChartsLegend/PiecewiseColorLegend.d.ts +9 -1
- package/ChartsLegend/PiecewiseColorLegend.js +28 -7
- package/ChartsLegend/chartsLegend.types.d.ts +39 -1
- package/ChartsLegend/chartsLegendClasses.d.ts +2 -0
- package/ChartsLegend/chartsLegendClasses.js +1 -1
- package/ChartsLegend/useAxis.js +2 -0
- package/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +3 -1
- package/ChartsOverlay/ChartsLoadingOverlay.js +2 -0
- package/ChartsOverlay/ChartsNoDataOverlay.js +2 -0
- package/ChartsOverlay/ChartsOverlay.js +2 -0
- package/ChartsReferenceLine/ChartsReferenceLine.js +2 -0
- package/ChartsReferenceLine/ChartsXReferenceLine.js +3 -1
- package/ChartsReferenceLine/ChartsYReferenceLine.js +3 -1
- package/ChartsSurface/ChartsSurface.js +2 -0
- package/ChartsText/ChartsText.js +2 -0
- package/ChartsTooltip/ChartsTooltip.js +2 -0
- package/ChartsTooltip/DefaultChartsAxisTooltipContent.js +2 -0
- package/ChartsTooltip/DefaultChartsItemTooltipContent.js +2 -0
- package/ChartsTooltip/index.d.ts +3 -0
- package/ChartsTooltip/index.js +4 -1
- package/ChartsTooltip/useAxisTooltip.d.ts +18 -0
- package/ChartsTooltip/useAxisTooltip.js +84 -0
- package/ChartsTooltip/useItemTooltip.d.ts +10 -0
- package/ChartsTooltip/useItemTooltip.js +64 -0
- package/ChartsTooltip/utils.d.ts +2 -1
- package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +2 -0
- package/ChartsXAxis/ChartsXAxis.js +2 -0
- package/ChartsYAxis/ChartsYAxis.js +2 -0
- package/Gauge/Gauge.js +2 -0
- package/Gauge/GaugeContainer.js +2 -0
- package/Gauge/GaugeReferenceArc.js +2 -0
- package/Gauge/GaugeValueArc.js +2 -0
- package/Gauge/GaugeValueText.js +2 -0
- package/LineChart/AnimatedArea.js +2 -0
- package/LineChart/AnimatedLine.js +14 -22
- package/LineChart/AreaElement.js +2 -0
- package/LineChart/AreaPlot.js +2 -0
- package/LineChart/CircleMarkElement.d.ts +34 -0
- package/LineChart/CircleMarkElement.js +107 -0
- package/LineChart/LineChart.d.ts +4 -0
- package/LineChart/LineChart.js +17 -0
- package/LineChart/LineElement.js +2 -0
- package/LineChart/LineHighlightElement.js +2 -0
- package/LineChart/LineHighlightPlot.js +2 -0
- package/LineChart/LinePlot.js +2 -0
- package/LineChart/MarkElement.d.ts +1 -19
- package/LineChart/MarkElement.js +3 -19
- package/LineChart/MarkPlot.d.ts +6 -0
- package/LineChart/MarkPlot.js +13 -3
- package/LineChart/index.d.ts +2 -0
- package/LineChart/index.js +2 -1
- package/LineChart/legend.js +3 -2
- package/LineChart/markElementClasses.d.ts +20 -0
- package/LineChart/markElementClasses.js +19 -0
- package/LineChart/useLineChartProps.js +7 -3
- package/PieChart/PieArc.js +2 -0
- package/PieChart/PieArcLabel.js +2 -0
- package/PieChart/PieArcLabelPlot.js +2 -0
- package/PieChart/PieArcPlot.js +2 -0
- package/PieChart/PieChart.js +13 -0
- package/PieChart/PiePlot.js +2 -0
- package/PieChart/dataTransform/useTransformData.js +2 -0
- package/PieChart/legend.js +3 -1
- package/ResponsiveChartContainer/ResponsiveChartContainer.d.ts +10 -0
- package/ResponsiveChartContainer/ResponsiveChartContainer.js +12 -0
- package/ResponsiveChartContainer/useChartContainerDimensions.d.ts +1 -1
- package/ResponsiveChartContainer/useChartContainerDimensions.js +35 -9
- package/ResponsiveChartContainer/useResponsiveChartContainerProps.js +5 -2
- package/ScatterChart/Scatter.js +2 -0
- package/ScatterChart/ScatterChart.js +13 -0
- package/ScatterChart/ScatterPlot.js +2 -0
- package/ScatterChart/legend.js +3 -2
- package/ScatterChart/useScatterChartProps.js +2 -0
- package/SparkLineChart/SparkLineChart.js +12 -0
- package/context/CartesianProvider/CartesianProvider.js +5 -3
- package/context/CartesianProvider/getAxisExtremum.d.ts +1 -1
- package/context/CartesianProvider/getAxisExtremum.js +5 -4
- package/context/CartesianProvider/index.d.ts +0 -5
- package/context/CartesianProvider/index.js +1 -6
- package/context/CartesianProvider/useCartesianContext.js +2 -0
- package/context/DrawingProvider.js +2 -0
- package/context/HighlightedProvider/HighlightedProvider.js +2 -0
- package/context/HighlightedProvider/useHighlighted.js +2 -0
- package/context/HighlightedProvider/useItemHighlighted.js +2 -0
- package/context/InteractionProvider.js +2 -0
- package/context/PluginProvider/ExtremumGetter.types.d.ts +1 -0
- package/context/PluginProvider/Plugin.types.d.ts +4 -0
- package/context/PluginProvider/PluginContext.js +3 -1
- package/context/PluginProvider/PluginProvider.js +2 -0
- package/context/PluginProvider/index.d.ts +2 -0
- package/context/PluginProvider/index.js +3 -1
- package/context/PluginProvider/mergePlugins.d.ts +10 -0
- package/context/PluginProvider/mergePlugins.js +11 -1
- package/context/PluginProvider/useColorProcessor.js +2 -0
- package/context/PluginProvider/useRadiusExtremumGetter.d.ts +4 -0
- package/context/PluginProvider/useRadiusExtremumGetter.js +17 -0
- package/context/PluginProvider/useRotationExtremumGetter.d.ts +4 -0
- package/context/PluginProvider/useRotationExtremumGetter.js +17 -0
- package/context/PluginProvider/useSeriesFormatter.js +2 -0
- package/context/PolarProvider/Polar.types.d.ts +42 -0
- package/context/PolarProvider/Polar.types.js +1 -0
- package/context/PolarProvider/PolarContext.d.ts +4 -0
- package/context/PolarProvider/PolarContext.js +13 -0
- package/context/PolarProvider/PolarProvider.d.ts +4 -0
- package/context/PolarProvider/PolarProvider.js +49 -0
- package/context/PolarProvider/getAxisExtremum.d.ts +4 -0
- package/context/PolarProvider/getAxisExtremum.js +20 -0
- package/context/PolarProvider/index.d.ts +0 -0
- package/context/PolarProvider/index.js +0 -0
- package/context/PolarProvider/usePolarContext.d.ts +2 -0
- package/context/PolarProvider/usePolarContext.js +10 -0
- package/context/SeriesProvider/SeriesProvider.js +2 -0
- package/context/ZAxisContextProvider.js +2 -0
- package/hooks/useAxis.js +2 -0
- package/hooks/useAxisEvents.js +2 -0
- package/hooks/useChartDimensions.js +2 -0
- package/hooks/useChartId.js +2 -0
- package/hooks/useColorScale.js +2 -0
- package/hooks/useDrawingArea.js +2 -0
- package/hooks/useInteractionItemProps.js +2 -0
- package/hooks/useMounted.js +2 -0
- package/hooks/useReducedMotion.js +2 -0
- package/hooks/useScale.js +2 -0
- package/hooks/useSeries.js +2 -0
- package/hooks/useSvgRef.js +2 -0
- package/hooks/useTicks.js +2 -0
- package/index.js +1 -1
- package/internals/computeAxisValue.d.ts +38 -0
- package/{modern/context/CartesianProvider/computeValue.js → internals/computeAxisValue.js} +28 -15
- package/internals/index.d.ts +1 -0
- package/internals/index.js +1 -0
- package/models/axis.d.ts +20 -0
- package/models/seriesType/config.d.ts +6 -2
- package/modern/BarChart/BarChart.js +13 -0
- package/modern/BarChart/BarElement.js +2 -0
- package/modern/BarChart/BarLabel/BarLabel.js +2 -0
- package/modern/BarChart/BarPlot.js +2 -0
- package/modern/BarChart/legend.js +3 -2
- package/modern/BarChart/useBarChartProps.js +2 -0
- package/modern/ChartContainer/ChartContainer.js +2 -0
- package/modern/ChartContainer/useChartContainerProps.js +2 -0
- package/modern/ChartContainer/useDefaultizeAxis.js +2 -0
- package/modern/ChartsAxis/ChartsAxis.js +2 -0
- package/modern/ChartsAxisHighlight/ChartsAxisHighlight.js +2 -0
- package/modern/ChartsClipPath/ChartsClipPath.js +2 -0
- package/modern/ChartsGrid/ChartsGrid.js +2 -0
- package/modern/ChartsLegend/ChartsLegend.js +11 -1
- package/modern/ChartsLegend/ChartsLegendItem.js +65 -0
- package/modern/ChartsLegend/ContinuousColorLegend.js +2 -0
- package/modern/ChartsLegend/DefaultChartsLegend.js +26 -4
- package/modern/ChartsLegend/LegendPerItem.js +19 -28
- package/modern/ChartsLegend/PiecewiseColorLegend.js +28 -7
- package/modern/ChartsLegend/chartsLegendClasses.js +1 -1
- package/modern/ChartsLegend/useAxis.js +2 -0
- package/modern/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +3 -1
- package/modern/ChartsOverlay/ChartsLoadingOverlay.js +2 -0
- package/modern/ChartsOverlay/ChartsNoDataOverlay.js +2 -0
- package/modern/ChartsOverlay/ChartsOverlay.js +2 -0
- package/modern/ChartsReferenceLine/ChartsReferenceLine.js +2 -0
- package/modern/ChartsReferenceLine/ChartsXReferenceLine.js +3 -1
- package/modern/ChartsReferenceLine/ChartsYReferenceLine.js +3 -1
- package/modern/ChartsSurface/ChartsSurface.js +2 -0
- package/modern/ChartsText/ChartsText.js +2 -0
- package/modern/ChartsTooltip/ChartsTooltip.js +2 -0
- package/modern/ChartsTooltip/DefaultChartsAxisTooltipContent.js +2 -0
- package/modern/ChartsTooltip/DefaultChartsItemTooltipContent.js +2 -0
- package/modern/ChartsTooltip/index.js +4 -1
- package/modern/ChartsTooltip/useAxisTooltip.js +84 -0
- package/modern/ChartsTooltip/useItemTooltip.js +64 -0
- package/modern/ChartsVoronoiHandler/ChartsVoronoiHandler.js +2 -0
- package/modern/ChartsXAxis/ChartsXAxis.js +2 -0
- package/modern/ChartsYAxis/ChartsYAxis.js +2 -0
- package/modern/Gauge/Gauge.js +2 -0
- package/modern/Gauge/GaugeContainer.js +2 -0
- package/modern/Gauge/GaugeReferenceArc.js +2 -0
- package/modern/Gauge/GaugeValueArc.js +2 -0
- package/modern/Gauge/GaugeValueText.js +2 -0
- package/modern/LineChart/AnimatedArea.js +2 -0
- package/modern/LineChart/AnimatedLine.js +14 -22
- package/modern/LineChart/AreaElement.js +2 -0
- package/modern/LineChart/AreaPlot.js +2 -0
- package/modern/LineChart/CircleMarkElement.js +107 -0
- package/modern/LineChart/LineChart.js +17 -0
- package/modern/LineChart/LineElement.js +2 -0
- package/modern/LineChart/LineHighlightElement.js +2 -0
- package/modern/LineChart/LineHighlightPlot.js +2 -0
- package/modern/LineChart/LinePlot.js +2 -0
- package/modern/LineChart/MarkElement.js +3 -19
- package/modern/LineChart/MarkPlot.js +13 -3
- package/modern/LineChart/index.js +2 -1
- package/modern/LineChart/legend.js +3 -2
- package/modern/LineChart/markElementClasses.js +19 -0
- package/modern/LineChart/useLineChartProps.js +7 -3
- package/modern/PieChart/PieArc.js +2 -0
- package/modern/PieChart/PieArcLabel.js +2 -0
- package/modern/PieChart/PieArcLabelPlot.js +2 -0
- package/modern/PieChart/PieArcPlot.js +2 -0
- package/modern/PieChart/PieChart.js +13 -0
- package/modern/PieChart/PiePlot.js +2 -0
- package/modern/PieChart/dataTransform/useTransformData.js +2 -0
- package/modern/PieChart/legend.js +3 -1
- package/modern/ResponsiveChartContainer/ResponsiveChartContainer.js +12 -0
- package/modern/ResponsiveChartContainer/useChartContainerDimensions.js +35 -9
- package/modern/ResponsiveChartContainer/useResponsiveChartContainerProps.js +5 -2
- package/modern/ScatterChart/Scatter.js +2 -0
- package/modern/ScatterChart/ScatterChart.js +13 -0
- package/modern/ScatterChart/ScatterPlot.js +2 -0
- package/modern/ScatterChart/legend.js +3 -2
- package/modern/ScatterChart/useScatterChartProps.js +2 -0
- package/modern/SparkLineChart/SparkLineChart.js +12 -0
- package/modern/context/CartesianProvider/CartesianProvider.js +5 -3
- package/modern/context/CartesianProvider/getAxisExtremum.js +5 -4
- package/modern/context/CartesianProvider/index.js +1 -6
- package/modern/context/CartesianProvider/useCartesianContext.js +2 -0
- package/modern/context/DrawingProvider.js +2 -0
- package/modern/context/HighlightedProvider/HighlightedProvider.js +2 -0
- package/modern/context/HighlightedProvider/useHighlighted.js +2 -0
- package/modern/context/HighlightedProvider/useItemHighlighted.js +2 -0
- package/modern/context/InteractionProvider.js +2 -0
- package/modern/context/PluginProvider/PluginContext.js +3 -1
- package/modern/context/PluginProvider/PluginProvider.js +2 -0
- package/modern/context/PluginProvider/index.js +3 -1
- package/modern/context/PluginProvider/mergePlugins.js +11 -1
- package/modern/context/PluginProvider/useColorProcessor.js +2 -0
- package/modern/context/PluginProvider/useRadiusExtremumGetter.js +17 -0
- package/modern/context/PluginProvider/useRotationExtremumGetter.js +17 -0
- package/modern/context/PluginProvider/useSeriesFormatter.js +2 -0
- package/modern/context/PolarProvider/Polar.types.js +1 -0
- package/modern/context/PolarProvider/PolarContext.js +13 -0
- package/modern/context/PolarProvider/PolarProvider.js +49 -0
- package/modern/context/PolarProvider/getAxisExtremum.js +20 -0
- package/modern/context/PolarProvider/index.js +0 -0
- package/modern/context/PolarProvider/usePolarContext.js +10 -0
- package/modern/context/SeriesProvider/SeriesProvider.js +2 -0
- package/modern/context/ZAxisContextProvider.js +2 -0
- package/modern/hooks/useAxis.js +2 -0
- package/modern/hooks/useAxisEvents.js +2 -0
- package/modern/hooks/useChartDimensions.js +2 -0
- package/modern/hooks/useChartId.js +2 -0
- package/modern/hooks/useColorScale.js +2 -0
- package/modern/hooks/useDrawingArea.js +2 -0
- package/modern/hooks/useInteractionItemProps.js +2 -0
- package/modern/hooks/useMounted.js +2 -0
- package/modern/hooks/useReducedMotion.js +2 -0
- package/modern/hooks/useScale.js +2 -0
- package/modern/hooks/useSeries.js +2 -0
- package/modern/hooks/useSvgRef.js +2 -0
- package/modern/hooks/useTicks.js +2 -0
- package/modern/index.js +1 -1
- package/{context/CartesianProvider/computeValue.js → modern/internals/computeAxisValue.js} +28 -15
- package/modern/internals/index.js +1 -0
- package/node/BarChart/BarChart.js +12 -0
- package/node/BarChart/BarElement.js +1 -0
- package/node/BarChart/BarLabel/BarLabel.js +1 -0
- package/node/BarChart/BarPlot.js +1 -0
- package/node/BarChart/legend.js +3 -2
- package/node/BarChart/useBarChartProps.js +1 -0
- package/node/ChartContainer/ChartContainer.js +1 -0
- package/node/ChartContainer/useChartContainerProps.js +1 -0
- package/node/ChartContainer/useDefaultizeAxis.js +1 -0
- package/node/ChartsAxis/ChartsAxis.js +1 -0
- package/node/ChartsAxisHighlight/ChartsAxisHighlight.js +1 -0
- package/node/ChartsClipPath/ChartsClipPath.js +1 -0
- package/node/ChartsGrid/ChartsGrid.js +1 -0
- package/node/ChartsLegend/ChartsLegend.js +10 -1
- package/node/ChartsLegend/ChartsLegendItem.js +72 -0
- package/node/ChartsLegend/ContinuousColorLegend.js +1 -0
- package/node/ChartsLegend/DefaultChartsLegend.js +25 -4
- package/node/ChartsLegend/LegendPerItem.js +18 -28
- package/node/ChartsLegend/PiecewiseColorLegend.js +27 -7
- package/node/ChartsLegend/chartsLegendClasses.js +1 -1
- package/node/ChartsLegend/useAxis.js +1 -0
- package/node/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +2 -1
- package/node/ChartsOverlay/ChartsLoadingOverlay.js +1 -0
- package/node/ChartsOverlay/ChartsNoDataOverlay.js +1 -0
- package/node/ChartsOverlay/ChartsOverlay.js +1 -0
- package/node/ChartsReferenceLine/ChartsReferenceLine.js +1 -0
- package/node/ChartsReferenceLine/ChartsXReferenceLine.js +2 -1
- package/node/ChartsReferenceLine/ChartsYReferenceLine.js +2 -1
- package/node/ChartsSurface/ChartsSurface.js +1 -0
- package/node/ChartsText/ChartsText.js +1 -0
- package/node/ChartsTooltip/ChartsTooltip.js +1 -0
- package/node/ChartsTooltip/DefaultChartsAxisTooltipContent.js +1 -0
- package/node/ChartsTooltip/DefaultChartsItemTooltipContent.js +1 -0
- package/node/ChartsTooltip/index.js +42 -1
- package/node/ChartsTooltip/useAxisTooltip.js +90 -0
- package/node/ChartsTooltip/useItemTooltip.js +71 -0
- package/node/ChartsVoronoiHandler/ChartsVoronoiHandler.js +1 -0
- package/node/ChartsXAxis/ChartsXAxis.js +1 -0
- package/node/ChartsYAxis/ChartsYAxis.js +1 -0
- package/node/Gauge/Gauge.js +1 -0
- package/node/Gauge/GaugeContainer.js +1 -0
- package/node/Gauge/GaugeReferenceArc.js +1 -0
- package/node/Gauge/GaugeValueArc.js +1 -0
- package/node/Gauge/GaugeValueText.js +1 -0
- package/node/LineChart/AnimatedArea.js +1 -0
- package/node/LineChart/AnimatedLine.js +13 -22
- package/node/LineChart/AreaElement.js +1 -0
- package/node/LineChart/AreaPlot.js +1 -0
- package/node/LineChart/CircleMarkElement.js +113 -0
- package/node/LineChart/LineChart.js +16 -0
- package/node/LineChart/LineElement.js +1 -0
- package/node/LineChart/LineHighlightElement.js +1 -0
- package/node/LineChart/LineHighlightPlot.js +1 -0
- package/node/LineChart/LinePlot.js +1 -0
- package/node/LineChart/MarkElement.js +3 -22
- package/node/LineChart/MarkPlot.js +12 -3
- package/node/LineChart/index.js +29 -1
- package/node/LineChart/legend.js +3 -2
- package/node/LineChart/markElementClasses.js +28 -0
- package/node/LineChart/useLineChartProps.js +6 -3
- package/node/PieChart/PieArc.js +1 -0
- package/node/PieChart/PieArcLabel.js +1 -0
- package/node/PieChart/PieArcLabelPlot.js +1 -0
- package/node/PieChart/PieArcPlot.js +1 -0
- package/node/PieChart/PieChart.js +12 -0
- package/node/PieChart/PiePlot.js +1 -0
- package/node/PieChart/dataTransform/useTransformData.js +1 -0
- package/node/PieChart/legend.js +3 -1
- package/node/ResponsiveChartContainer/ResponsiveChartContainer.js +11 -0
- package/node/ResponsiveChartContainer/useChartContainerDimensions.js +34 -9
- package/node/ResponsiveChartContainer/useResponsiveChartContainerProps.js +4 -2
- package/node/ScatterChart/Scatter.js +1 -0
- package/node/ScatterChart/ScatterChart.js +12 -0
- package/node/ScatterChart/ScatterPlot.js +1 -0
- package/node/ScatterChart/legend.js +3 -2
- package/node/ScatterChart/useScatterChartProps.js +1 -0
- package/node/SparkLineChart/SparkLineChart.js +11 -0
- package/node/context/CartesianProvider/CartesianProvider.js +4 -3
- package/node/context/CartesianProvider/getAxisExtremum.js +5 -4
- package/node/context/CartesianProvider/index.js +1 -13
- package/node/context/CartesianProvider/useCartesianContext.js +1 -0
- package/node/context/DrawingProvider.js +1 -0
- package/node/context/HighlightedProvider/HighlightedProvider.js +1 -0
- package/node/context/HighlightedProvider/useHighlighted.js +1 -0
- package/node/context/HighlightedProvider/useItemHighlighted.js +1 -0
- package/node/context/InteractionProvider.js +1 -0
- package/node/context/PluginProvider/PluginContext.js +3 -1
- package/node/context/PluginProvider/PluginProvider.js +1 -0
- package/node/context/PluginProvider/index.js +22 -0
- package/node/context/PluginProvider/mergePlugins.js +11 -1
- package/node/context/PluginProvider/useColorProcessor.js +1 -0
- package/node/context/PluginProvider/useRadiusExtremumGetter.js +23 -0
- package/node/context/PluginProvider/useRotationExtremumGetter.js +23 -0
- package/node/context/PluginProvider/useSeriesFormatter.js +1 -0
- package/node/context/PolarProvider/Polar.types.js +5 -0
- package/node/context/PolarProvider/PolarContext.js +20 -0
- package/node/context/PolarProvider/PolarProvider.js +54 -0
- package/node/context/PolarProvider/getAxisExtremum.js +27 -0
- package/node/context/PolarProvider/index.js +1 -0
- package/node/context/PolarProvider/usePolarContext.js +17 -0
- package/node/context/SeriesProvider/SeriesProvider.js +1 -0
- package/node/context/ZAxisContextProvider.js +1 -0
- package/node/hooks/useAxis.js +1 -0
- package/node/hooks/useAxisEvents.js +1 -0
- package/node/hooks/useChartDimensions.js +1 -0
- package/node/hooks/useChartId.js +1 -0
- package/node/hooks/useColorScale.js +1 -0
- package/node/hooks/useDrawingArea.js +1 -0
- package/node/hooks/useInteractionItemProps.js +1 -0
- package/node/hooks/useMounted.js +1 -0
- package/node/hooks/useReducedMotion.js +1 -0
- package/node/hooks/useScale.js +1 -0
- package/node/hooks/useSeries.js +1 -0
- package/node/hooks/useSvgRef.js +1 -0
- package/node/hooks/useTicks.js +1 -0
- package/node/index.js +1 -1
- package/node/{context/CartesianProvider/computeValue.js → internals/computeAxisValue.js} +29 -16
- package/node/internals/index.js +12 -0
- package/package.json +4 -4
- package/context/CartesianProvider/computeValue.d.ts +0 -30
- package/internals/warning.d.ts +0 -2
- package/internals/warning.js +0 -21
- package/modern/internals/warning.js +0 -21
- package/node/internals/warning.js +0 -28
package/BarChart/BarChart.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
4
|
import * as React from 'react';
|
|
3
5
|
import PropTypes from 'prop-types';
|
|
@@ -144,6 +146,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
144
146
|
itemMarkWidth: PropTypes.number,
|
|
145
147
|
labelStyle: PropTypes.object,
|
|
146
148
|
markGap: PropTypes.number,
|
|
149
|
+
onItemClick: PropTypes.func,
|
|
147
150
|
padding: PropTypes.oneOfType([PropTypes.number, PropTypes.shape({
|
|
148
151
|
bottom: PropTypes.number,
|
|
149
152
|
left: PropTypes.number,
|
|
@@ -193,6 +196,16 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
193
196
|
* @param {BarItemIdentifier} barItemIdentifier The bar item identifier.
|
|
194
197
|
*/
|
|
195
198
|
onItemClick: PropTypes.func,
|
|
199
|
+
/**
|
|
200
|
+
* The chart will try to wait for the parent container to resolve its size
|
|
201
|
+
* before it renders for the first time.
|
|
202
|
+
*
|
|
203
|
+
* This can be useful in some scenarios where the chart appear to grow after
|
|
204
|
+
* the first render, like when used inside a grid.
|
|
205
|
+
*
|
|
206
|
+
* @default false
|
|
207
|
+
*/
|
|
208
|
+
resolveSizeBeforeRender: PropTypes.bool,
|
|
196
209
|
/**
|
|
197
210
|
* Indicate which axis to display the right of the charts.
|
|
198
211
|
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
package/BarChart/BarElement.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
5
|
const _excluded = ["id", "dataIndex", "classes", "color", "slots", "slotProps", "style", "onClick"];
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
4
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
5
|
const _excluded = ["seriesId", "dataIndex", "color", "isFaded", "isHighlighted", "classes"];
|
package/BarChart/BarPlot.js
CHANGED
package/BarChart/legend.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
5
|
const _excluded = ["xAxis", "yAxis", "series", "width", "height", "margin", "colors", "dataset", "sx", "tooltip", "onAxisClick", "axisHighlight", "legend", "grid", "topAxis", "leftAxis", "rightAxis", "bottomAxis", "children", "slots", "slotProps", "skipAnimation", "loading", "layout", "onItemClick", "highlightedItem", "onHighlightChange", "borderRadius", "barLabel", "className"];
|
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,186 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 7.18.0
|
|
7
|
+
|
|
8
|
+
_Sep 20, 2024_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 14 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 💫 Support [Row spanning](https://mui.com/x/react-data-grid/row-spanning/) on the Data Grid that automatically merges the consecutive cells in a column based on the cell value
|
|
13
|
+
|
|
14
|
+
<img width="600" src="https://github.com/user-attachments/assets/d32ec936-d238-4c92-9e1a-af6788d74cdf" alt="data grid row spanning" />
|
|
15
|
+
|
|
16
|
+
- ⏰ Support `date-fns` v4 (#14673) @LukasTy
|
|
17
|
+
- 🎉 Add option for Pickers to change the order of displayed years (#11780) @thomasmoon
|
|
18
|
+
- 🐞 Bugfixes
|
|
19
|
+
- 📚 Documentation improvements
|
|
20
|
+
|
|
21
|
+
<!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
|
|
22
|
+
|
|
23
|
+
### Data Grid
|
|
24
|
+
|
|
25
|
+
#### `@mui/x-data-grid@7.18.0`
|
|
26
|
+
|
|
27
|
+
- [DataGrid] Add default reset value in row edit mode (#14050) @michelengelen
|
|
28
|
+
- [DataGrid] Add `columnGroupHeaderHeight` prop for sizing column group headers (#14637) @KenanYusuf
|
|
29
|
+
- [DataGrid] Fix `document` reference when the grid is rendered in a popup window (#14649) @arminmeh
|
|
30
|
+
- [DataGrid] Remove `minFirstColumn` from `GetHeadersParams` interface (#14450) @k-rajat19
|
|
31
|
+
- [DataGrid] Row spanning (#14124) @MBilalShafi
|
|
32
|
+
|
|
33
|
+
#### `@mui/x-data-grid-pro@7.18.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
34
|
+
|
|
35
|
+
Same changes as in `@mui/x-data-grid@7.18.0`, plus:
|
|
36
|
+
|
|
37
|
+
- [DataGridPro] Fix `onRowsScrollEnd` being triggered instantly when bottom pinned row is present (#14602) @arminmeh
|
|
38
|
+
- [DataGridPro] Fix header filters rendering issue for `isEmpty` and `isNotEmpty` filter operators (#14493) @k-rajat19
|
|
39
|
+
- [DataGridPro] Fix pinned columns in RTL mode (#14586) @KenanYusuf
|
|
40
|
+
|
|
41
|
+
#### `@mui/x-data-grid-premium@7.18.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
42
|
+
|
|
43
|
+
Same changes as in `@mui/x-data-grid-pro@7.18.0`.
|
|
44
|
+
|
|
45
|
+
### Date and Time Pickers
|
|
46
|
+
|
|
47
|
+
#### `@mui/x-date-pickers@7.18.0`
|
|
48
|
+
|
|
49
|
+
- [pickers] Add option to change the order of displayed years (#11780) @thomasmoon
|
|
50
|
+
- [pickers] Support `date-fns` v4 (#14673) @LukasTy
|
|
51
|
+
|
|
52
|
+
#### `@mui/x-date-pickers-pro@7.18.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
53
|
+
|
|
54
|
+
Same changes as in `@mui/x-date-pickers@7.18.0`.
|
|
55
|
+
|
|
56
|
+
### Charts
|
|
57
|
+
|
|
58
|
+
#### `@mui/x-charts@7.18.0`
|
|
59
|
+
|
|
60
|
+
- [charts] Add a `PolarProvider` to manage polar axes (#14642) @alexfauquette
|
|
61
|
+
- [charts] Fix `LineChart` animation being stuck with initial drawing area value (#14553) @JCQuintas
|
|
62
|
+
- [charts] Fix legend slot typing (#14657) @alexfauquette
|
|
63
|
+
- [charts] Pass the axis index to extremum getter (#14641) @alexfauquette
|
|
64
|
+
- [charts] Provide hooks to create custom tooltip (#14377) @alexfauquette
|
|
65
|
+
|
|
66
|
+
#### `@mui/x-charts-pro@7.0.0-beta.1` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
67
|
+
|
|
68
|
+
Same changes as in `@mui/x-charts@7.18.0`.
|
|
69
|
+
|
|
70
|
+
### Tree View
|
|
71
|
+
|
|
72
|
+
#### `@mui/x-tree-view@7.18.0`
|
|
73
|
+
|
|
74
|
+
- [TreeView] Add `"use client"` directive to every public component and hook (#14579) @flaviendelangle
|
|
75
|
+
|
|
76
|
+
### Docs
|
|
77
|
+
|
|
78
|
+
- [docs] Add `groupingValueGetter` callout in column definition docs (#14599) @michelengelen
|
|
79
|
+
- [docs] Clean v6 => v7 migration guide (#14652) @flaviendelangle
|
|
80
|
+
- [docs] Copy `vale-action.yml` from main repo @oliviertassinari
|
|
81
|
+
- [docs] Edit the Pickers Getting started doc (#14555) @samuelsycamore
|
|
82
|
+
- [docs] Fix TypeScript capitalization @oliviertassinari
|
|
83
|
+
- [docs] Fix Vale error @oliviertassinari
|
|
84
|
+
- [docs] Make the migration guide diff a bit easier to read @oliviertassinari
|
|
85
|
+
- [docs] Report Vale at warning level (#14660) @oliviertassinari
|
|
86
|
+
- [docs] Warn about the `valueGetter` and `valueFormatter` signature change (#14613) @cherniavskii
|
|
87
|
+
- [docs] Polish code formatting (#14603) @oliviertassinari
|
|
88
|
+
- [test] Spy on `observe` method to avoid flaky wait for a callback (#14640) @arminmeh
|
|
89
|
+
|
|
90
|
+
### Core
|
|
91
|
+
|
|
92
|
+
- [core] Fix 301 link to Next.js and git diff @oliviertassinari
|
|
93
|
+
- [core] Fix failing CI on `master` (#14644) @cherniavskii
|
|
94
|
+
- [core] Fix `package.json` repository rule @oliviertassinari
|
|
95
|
+
- [core] MUI X repository moved to a new location @oliviertassinari
|
|
96
|
+
- [docs-infra] Strengthen CSP (#14581) @oliviertassinari
|
|
97
|
+
- [license] Finish renaming of LicensingModel (#14615) @oliviertassinari
|
|
98
|
+
|
|
99
|
+
## 7.17.0
|
|
100
|
+
|
|
101
|
+
_Sep 13, 2024_
|
|
102
|
+
|
|
103
|
+
We'd like to offer a big thanks to the 12 contributors who made this release possible. Here are some highlights ✨:
|
|
104
|
+
|
|
105
|
+
- 📊 Charts performance improvement
|
|
106
|
+
- 🧑💻 New Data Grid [custom columns demo](https://mui.com/x/react-data-grid/custom-columns/#full-example)
|
|
107
|
+
- 🐞 Bugfixes
|
|
108
|
+
- 📚 Documentation improvements
|
|
109
|
+
- 🌍 Improve Hungarian (hu-HU) locale on the Data Grid
|
|
110
|
+
|
|
111
|
+
<!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
|
|
112
|
+
|
|
113
|
+
### Data Grid
|
|
114
|
+
|
|
115
|
+
#### `@mui/x-data-grid@7.17.0`
|
|
116
|
+
|
|
117
|
+
- [DataGrid] Add "does not equal" and "does not contain" filter operators (#14489) @KenanYusuf
|
|
118
|
+
- [DataGrid] Add demo to the "Custom columns" page that does not use generator (#13695) @arminmeh
|
|
119
|
+
- [DataGrid] Fix Voice Over reading the column name twice (#14482) @arminmeh
|
|
120
|
+
- [DataGrid] Fix bug in CRUD example (#14513) @michelengelen
|
|
121
|
+
- [DataGrid] Fix failing jsdom tests caused by `:has()` selectors (#14559) @KenanYusuf
|
|
122
|
+
- [DataGrid] Refactor string operator filter functions (#14564) @KenanYusuf
|
|
123
|
+
- [l10n] Improve Hungarian (hu-HU) locale (#14506) @ntamas
|
|
124
|
+
|
|
125
|
+
#### `@mui/x-data-grid-pro@7.17.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
126
|
+
|
|
127
|
+
Same changes as in `@mui/x-data-grid@7.17.0`.
|
|
128
|
+
|
|
129
|
+
#### `@mui/x-data-grid-premium@7.17.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
130
|
+
|
|
131
|
+
Same changes as in `@mui/x-data-grid-pro@7.17.0`.
|
|
132
|
+
|
|
133
|
+
### Date and Time Pickers
|
|
134
|
+
|
|
135
|
+
#### `@mui/x-date-pickers@7.17.0`
|
|
136
|
+
|
|
137
|
+
- [fields] Improve `useSplitFieldProps` and make it public (#14514) @flaviendelangle
|
|
138
|
+
- [pickers] Improve clear action label (#14243) @oliviertassinari
|
|
139
|
+
- [pickers] Add `"use client"` directive to every public component and hook (#14562) @flaviendelangle
|
|
140
|
+
- [pickers] Allow custom fields to validate the value (#14486) @flaviendelangle
|
|
141
|
+
- [pickers] Stop using utils in locales (#14505) @flaviendelangle
|
|
142
|
+
|
|
143
|
+
#### `@mui/x-date-pickers-pro@7.17.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
144
|
+
|
|
145
|
+
Same changes as in `@mui/x-date-pickers@7.17.0`, plus:
|
|
146
|
+
|
|
147
|
+
- [DateRangePicker] Fix `currentMonthCalendarPosition` not scrolling to future sibling (#14442) @GMchris
|
|
148
|
+
|
|
149
|
+
### Charts
|
|
150
|
+
|
|
151
|
+
#### `@mui/x-charts@7.17.0`
|
|
152
|
+
|
|
153
|
+
- [charts] Add `"use client"` directive to every public component and hook (#14578) @flaviendelangle
|
|
154
|
+
- [charts] Allow `onItemClick` on the `Legend` component (#14231) @JCQuintas
|
|
155
|
+
- [charts] Fix `onAxisClick` with `layout='horizontal'` (#14547) @alexfauquette
|
|
156
|
+
- [charts] Replace `path` with `circle` for performance improvement (#14518) @alexfauquette
|
|
157
|
+
|
|
158
|
+
#### `@mui/x-charts-pro@7.0.0-beta.1` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
159
|
+
|
|
160
|
+
Same changes as in `@mui/x-charts@7.17.0`.
|
|
161
|
+
|
|
162
|
+
### Tree View
|
|
163
|
+
|
|
164
|
+
#### `@mui/x-tree-view@7.17.0`
|
|
165
|
+
|
|
166
|
+
- [TreeView] Make `useTreeItem2` stable (#14498) @flaviendelangle
|
|
167
|
+
|
|
168
|
+
### Docs
|
|
169
|
+
|
|
170
|
+
- [docs] Add missing callout on "Imperative API" tree view sections (#14503) @flaviendelangle
|
|
171
|
+
- [docs] Fix broken redirection to MUI X v5 @oliviertassinari
|
|
172
|
+
- [docs] Fix multiple `console.error` messages on `charts` docs (#14554) @JCQuintas
|
|
173
|
+
- [docs] Fixed typo in Row Grouping recipes (#14549) @Miodini
|
|
174
|
+
- [docs] Match title with blog posts @oliviertassinari
|
|
175
|
+
|
|
176
|
+
### Core
|
|
177
|
+
|
|
178
|
+
- [core] Move warning methods to `@mui/x-internals` (#14528) @k-rajat19
|
|
179
|
+
- [core] Sync with core release flow @oliviertassinari
|
|
180
|
+
- [code-infra] Fix charts benchmark workflow (#14573) @JCQuintas
|
|
181
|
+
- [docs-infra] Type interface API pages (#14138) @alexfauquette
|
|
182
|
+
- [infra] Create `ESLint plugins` renovate group (#14574) @LukasTy
|
|
183
|
+
- [license] Clean-up terminology to match codebase (#14531) @oliviertassinari
|
|
184
|
+
- [test] Remove dead `act()` logic (#14529) @oliviertassinari
|
|
185
|
+
|
|
6
186
|
## 7.16.0
|
|
7
187
|
|
|
8
188
|
_Sep 5, 2024_
|
|
@@ -108,7 +288,7 @@ We'd like to offer a big thanks to the 8 contributors who made this release poss
|
|
|
108
288
|
|
|
109
289
|
- 💫 Support Material UI v6 (`@mui/material@6`) peer dependency (#14142) @cherniavskii
|
|
110
290
|
|
|
111
|
-
You can now use MUI
|
|
291
|
+
You can now use MUI X components with either v5 or v6 of `@mui/material` package 🎉
|
|
112
292
|
|
|
113
293
|
- 🐞 Bugfixes
|
|
114
294
|
|
|
@@ -153,7 +333,7 @@ Same changes as in `@mui/x-charts@7.15.0`, plus:
|
|
|
153
333
|
|
|
154
334
|
- [docs] Fix sentence case `h2` @oliviertassinari
|
|
155
335
|
- [docs] Clarify contribution guide references @oliviertassinari
|
|
156
|
-
- [docs] Fix Stack
|
|
336
|
+
- [docs] Fix Stack Overflow issue canned response @oliviertassinari
|
|
157
337
|
- [docs] Fix outdated link to support page @oliviertassinari
|
|
158
338
|
- [docs] Fix use of Material UI @oliviertassinari
|
|
159
339
|
- [docs] Update deprecated props in docs (#14295) @JCQuintas
|
|
@@ -411,7 +591,7 @@ The [Pro plan](https://mui.com/x/introduction/licensing/#pro-plan) is receiving
|
|
|
411
591
|
|
|
412
592
|
As always, every feature released as part of the MIT plan will remain free and MIT licensed forever.
|
|
413
593
|
|
|
414
|
-
This expansion of the Pro plan comes with some adjustments to our pricing strategy. Learn more about those in the [Upcoming changes to MUI
|
|
594
|
+
This expansion of the Pro plan comes with some adjustments to our pricing strategy. Learn more about those in the [Upcoming changes to MUI X pricing in 2024](https://mui.com/blog/mui-x-sep-2024-price-update/) blog post.
|
|
415
595
|
|
|
416
596
|
### Highlights
|
|
417
597
|
|
|
@@ -476,7 +656,7 @@ Same changes as in `@mui/x-date-pickers@7.12.0`.
|
|
|
476
656
|
#### `@mui/x-charts@7.12.0`
|
|
477
657
|
|
|
478
658
|
- [charts] Fix incorrect `axisId` prop being allowed in xAxis/yAxis config. Use `id` instead. (#13986) @JCQuintas
|
|
479
|
-
- [charts] Use vendor to have
|
|
659
|
+
- [charts] Use vendor to have CommonJS bundle working out of the box (#13608) @alexfauquette
|
|
480
660
|
- [charts] Divide the `SeriesProvider` to use in filtering (#14026) @JCQuintas
|
|
481
661
|
|
|
482
662
|
### Tree View
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
5
|
const _excluded = ["width", "height", "series", "margin", "xAxis", "yAxis", "zAxis", "colors", "dataset", "sx", "title", "desc", "disableAxisListener", "highlightedItem", "onHighlightChange", "plugins", "children"];
|
package/ChartsAxis/ChartsAxis.js
CHANGED
package/ChartsGrid/ChartsGrid.js
CHANGED
|
@@ -7,10 +7,10 @@ export interface ChartsLegendSlots {
|
|
|
7
7
|
* Custom rendering of the legend.
|
|
8
8
|
* @default DefaultChartsLegend
|
|
9
9
|
*/
|
|
10
|
-
legend?: React.JSXElementConstructor<
|
|
10
|
+
legend?: React.JSXElementConstructor<LegendRendererProps>;
|
|
11
11
|
}
|
|
12
12
|
export interface ChartsLegendSlotProps {
|
|
13
|
-
legend?: Partial<
|
|
13
|
+
legend?: Partial<LegendRendererProps>;
|
|
14
14
|
}
|
|
15
15
|
export interface ChartsLegendProps extends ChartsLegendPropsBase {
|
|
16
16
|
/**
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
4
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
5
|
const _excluded = ["slots", "slotProps"];
|
|
@@ -21,7 +23,8 @@ const useUtilityClasses = ownerState => {
|
|
|
21
23
|
root: ['root', direction],
|
|
22
24
|
mark: ['mark'],
|
|
23
25
|
label: ['label'],
|
|
24
|
-
series: ['series']
|
|
26
|
+
series: ['series'],
|
|
27
|
+
itemBackground: ['itemBackground']
|
|
25
28
|
};
|
|
26
29
|
return composeClasses(slots, getLegendUtilityClass, classes);
|
|
27
30
|
};
|
|
@@ -108,6 +111,13 @@ process.env.NODE_ENV !== "production" ? ChartsLegend.propTypes = {
|
|
|
108
111
|
* @default 5
|
|
109
112
|
*/
|
|
110
113
|
markGap: PropTypes.number,
|
|
114
|
+
/**
|
|
115
|
+
* Callback fired when a legend item is clicked.
|
|
116
|
+
* @param {React.MouseEvent<SVGRectElement, MouseEvent>} event The click event.
|
|
117
|
+
* @param {SeriesLegendItemContext} legendItem The legend item data.
|
|
118
|
+
* @param {number} index The index of the clicked legend item.
|
|
119
|
+
*/
|
|
120
|
+
onItemClick: PropTypes.func,
|
|
111
121
|
/**
|
|
112
122
|
* Legend padding (in px).
|
|
113
123
|
* Can either be a single number, or an object with top, left, bottom, right properties.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ChartsTextStyle } from '../ChartsText';
|
|
3
|
+
import { LegendItemParams } from './chartsLegend.types';
|
|
4
|
+
import { ChartsLegendClasses } from './chartsLegendClasses';
|
|
5
|
+
export interface ChartsLegendItemProps extends LegendItemParams {
|
|
6
|
+
positionY: number;
|
|
7
|
+
label: string;
|
|
8
|
+
positionX: number;
|
|
9
|
+
innerHeight: number;
|
|
10
|
+
innerWidth: number;
|
|
11
|
+
color: string;
|
|
12
|
+
gapX: number;
|
|
13
|
+
gapY: number;
|
|
14
|
+
legendWidth: number;
|
|
15
|
+
itemMarkHeight: number;
|
|
16
|
+
itemMarkWidth: number;
|
|
17
|
+
markGap: number;
|
|
18
|
+
labelStyle: ChartsTextStyle;
|
|
19
|
+
classes?: Omit<Partial<ChartsLegendClasses>, 'column' | 'row' | 'label'>;
|
|
20
|
+
onClick?: (event: React.MouseEvent<SVGRectElement, MouseEvent>) => void;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* @ignore - internal component.
|
|
24
|
+
*/
|
|
25
|
+
declare function ChartsLegendItem(props: ChartsLegendItemProps): React.JSX.Element;
|
|
26
|
+
export { ChartsLegendItem };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import { useRtl } from '@mui/system/RtlProvider';
|
|
5
|
+
import { ChartsText } from "../ChartsText/index.js";
|
|
6
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
/**
|
|
8
|
+
* @ignore - internal component.
|
|
9
|
+
*/
|
|
10
|
+
function ChartsLegendItem(props) {
|
|
11
|
+
const isRTL = useRtl();
|
|
12
|
+
const {
|
|
13
|
+
id,
|
|
14
|
+
positionY,
|
|
15
|
+
label,
|
|
16
|
+
positionX,
|
|
17
|
+
innerHeight,
|
|
18
|
+
innerWidth,
|
|
19
|
+
legendWidth,
|
|
20
|
+
color,
|
|
21
|
+
gapX,
|
|
22
|
+
gapY,
|
|
23
|
+
itemMarkHeight,
|
|
24
|
+
itemMarkWidth,
|
|
25
|
+
markGap,
|
|
26
|
+
labelStyle,
|
|
27
|
+
classes,
|
|
28
|
+
onClick
|
|
29
|
+
} = props;
|
|
30
|
+
return /*#__PURE__*/_jsxs("g", {
|
|
31
|
+
className: clsx(classes?.series, `${classes?.series}-${id}`),
|
|
32
|
+
transform: `translate(${gapX + (isRTL ? legendWidth - positionX : positionX)} ${gapY + positionY})`,
|
|
33
|
+
children: [/*#__PURE__*/_jsx("rect", {
|
|
34
|
+
x: isRTL ? -(innerWidth + 2) : -2,
|
|
35
|
+
y: -itemMarkHeight / 2 - 2,
|
|
36
|
+
width: innerWidth + 4,
|
|
37
|
+
height: innerHeight + 4,
|
|
38
|
+
fill: "transparent",
|
|
39
|
+
className: classes?.itemBackground,
|
|
40
|
+
onClick: onClick,
|
|
41
|
+
style: {
|
|
42
|
+
pointerEvents: onClick ? 'all' : 'none',
|
|
43
|
+
cursor: onClick ? 'pointer' : 'unset'
|
|
44
|
+
}
|
|
45
|
+
}), /*#__PURE__*/_jsx("rect", {
|
|
46
|
+
className: classes?.mark,
|
|
47
|
+
x: isRTL ? -itemMarkWidth : 0,
|
|
48
|
+
y: -itemMarkHeight / 2,
|
|
49
|
+
width: itemMarkWidth,
|
|
50
|
+
height: itemMarkHeight,
|
|
51
|
+
fill: color,
|
|
52
|
+
style: {
|
|
53
|
+
pointerEvents: 'none'
|
|
54
|
+
}
|
|
55
|
+
}), /*#__PURE__*/_jsx(ChartsText, {
|
|
56
|
+
style: _extends({
|
|
57
|
+
pointerEvents: 'none'
|
|
58
|
+
}, labelStyle),
|
|
59
|
+
text: label,
|
|
60
|
+
x: (isRTL ? -1 : 1) * (itemMarkWidth + markGap),
|
|
61
|
+
y: 0
|
|
62
|
+
})]
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
export { ChartsLegendItem };
|
|
@@ -2,13 +2,21 @@ import * as React from 'react';
|
|
|
2
2
|
import { FormattedSeries } from '../context/SeriesProvider';
|
|
3
3
|
import { LegendPerItemProps } from './LegendPerItem';
|
|
4
4
|
import { DrawingArea } from '../context/DrawingProvider';
|
|
5
|
-
|
|
5
|
+
import { SeriesLegendItemContext } from './chartsLegend.types';
|
|
6
|
+
export interface LegendRendererProps extends Omit<LegendPerItemProps, 'itemsToDisplay' | 'onItemClick'> {
|
|
6
7
|
series: FormattedSeries;
|
|
7
8
|
seriesToDisplay: LegendPerItemProps['itemsToDisplay'];
|
|
8
9
|
/**
|
|
9
10
|
* @deprecated Use the `useDrawingArea` hook instead.
|
|
10
11
|
*/
|
|
11
12
|
drawingArea: Omit<DrawingArea, 'isPointInside'>;
|
|
13
|
+
/**
|
|
14
|
+
* Callback fired when a legend item is clicked.
|
|
15
|
+
* @param {React.MouseEvent<SVGRectElement, MouseEvent>} event The click event.
|
|
16
|
+
* @param {SeriesLegendItemContext} legendItem The legend item data.
|
|
17
|
+
* @param {number} index The index of the clicked legend item.
|
|
18
|
+
*/
|
|
19
|
+
onItemClick?: (event: React.MouseEvent<SVGRectElement, MouseEvent>, legendItem: SeriesLegendItemContext, index: number) => void;
|
|
12
20
|
/**
|
|
13
21
|
* Set to true to hide the legend.
|
|
14
22
|
* @default false
|
|
@@ -1,21 +1,32 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["drawingArea", "seriesToDisplay", "hidden"];
|
|
5
|
+
const _excluded = ["drawingArea", "seriesToDisplay", "hidden", "onItemClick"];
|
|
4
6
|
import * as React from 'react';
|
|
5
7
|
import PropTypes from 'prop-types';
|
|
6
8
|
import { LegendPerItem } from "./LegendPerItem.js";
|
|
7
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
+
const seriesContextBuilder = context => ({
|
|
11
|
+
type: 'series',
|
|
12
|
+
color: context.color,
|
|
13
|
+
label: context.label,
|
|
14
|
+
seriesId: context.seriesId,
|
|
15
|
+
itemId: context.itemId
|
|
16
|
+
});
|
|
8
17
|
function DefaultChartsLegend(props) {
|
|
9
18
|
const {
|
|
10
19
|
seriesToDisplay,
|
|
11
|
-
hidden
|
|
20
|
+
hidden,
|
|
21
|
+
onItemClick
|
|
12
22
|
} = props,
|
|
13
23
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
14
24
|
if (hidden) {
|
|
15
25
|
return null;
|
|
16
26
|
}
|
|
17
27
|
return /*#__PURE__*/_jsx(LegendPerItem, _extends({}, other, {
|
|
18
|
-
itemsToDisplay: seriesToDisplay
|
|
28
|
+
itemsToDisplay: seriesToDisplay,
|
|
29
|
+
onItemClick: onItemClick ? (e, i) => onItemClick(e, seriesContextBuilder(seriesToDisplay[i]), i) : undefined
|
|
19
30
|
}));
|
|
20
31
|
}
|
|
21
32
|
process.env.NODE_ENV !== "production" ? DefaultChartsLegend.propTypes = {
|
|
@@ -73,6 +84,13 @@ process.env.NODE_ENV !== "production" ? DefaultChartsLegend.propTypes = {
|
|
|
73
84
|
* @default 5
|
|
74
85
|
*/
|
|
75
86
|
markGap: PropTypes.number,
|
|
87
|
+
/**
|
|
88
|
+
* Callback fired when a legend item is clicked.
|
|
89
|
+
* @param {React.MouseEvent<SVGRectElement, MouseEvent>} event The click event.
|
|
90
|
+
* @param {SeriesLegendItemContext} legendItem The legend item data.
|
|
91
|
+
* @param {number} index The index of the clicked legend item.
|
|
92
|
+
*/
|
|
93
|
+
onItemClick: PropTypes.func,
|
|
76
94
|
/**
|
|
77
95
|
* Legend padding (in px).
|
|
78
96
|
* Can either be a single number, or an object with top, left, bottom, right properties.
|
|
@@ -95,7 +113,11 @@ process.env.NODE_ENV !== "production" ? DefaultChartsLegend.propTypes = {
|
|
|
95
113
|
seriesToDisplay: PropTypes.arrayOf(PropTypes.shape({
|
|
96
114
|
color: PropTypes.string.isRequired,
|
|
97
115
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
98
|
-
|
|
116
|
+
itemId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
117
|
+
label: PropTypes.string.isRequired,
|
|
118
|
+
maxValue: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
119
|
+
minValue: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
120
|
+
seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
99
121
|
})).isRequired
|
|
100
122
|
} : void 0;
|
|
101
123
|
export { DefaultChartsLegend };
|
|
@@ -55,6 +55,7 @@ export interface LegendPerItemProps extends DefaultizedProps<LegendPlacement, ke
|
|
|
55
55
|
* @default 10
|
|
56
56
|
*/
|
|
57
57
|
padding?: number | Partial<CardinalDirections<number>>;
|
|
58
|
+
onItemClick?: (event: React.MouseEvent<SVGRectElement, MouseEvent>, index: number) => void;
|
|
58
59
|
}
|
|
59
60
|
/**
|
|
60
61
|
* Internal component to display an array of items as a legend.
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
4
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
5
|
const _excluded = ["rotate", "dominantBaseline"];
|
|
4
6
|
import * as React from 'react';
|
|
5
7
|
import NoSsr from '@mui/material/NoSsr';
|
|
6
8
|
import { useTheme, styled } from '@mui/material/styles';
|
|
7
|
-
import { useRtl } from '@mui/system/RtlProvider';
|
|
8
|
-
import { ChartsText } from "../ChartsText/index.js";
|
|
9
9
|
import { getWordsByLines } from "../internals/getWordsByLines.js";
|
|
10
10
|
import { legendItemPlacements } from "./legendItemsPlacement.js";
|
|
11
11
|
import { useDrawingArea } from "../hooks/useDrawingArea.js";
|
|
12
|
-
import {
|
|
12
|
+
import { ChartsLegendItem } from "./ChartsLegendItem.js";
|
|
13
|
+
import { createElement as _createElement } from "react";
|
|
14
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
15
|
export const ChartsLegendRoot = styled('g', {
|
|
14
16
|
name: 'MuiChartsLegend',
|
|
15
17
|
slot: 'Root',
|
|
@@ -51,10 +53,10 @@ export function LegendPerItem(props) {
|
|
|
51
53
|
markGap = 5,
|
|
52
54
|
itemGap = 10,
|
|
53
55
|
padding: paddingProps = 10,
|
|
54
|
-
labelStyle: inLabelStyle
|
|
56
|
+
labelStyle: inLabelStyle,
|
|
57
|
+
onItemClick
|
|
55
58
|
} = props;
|
|
56
59
|
const theme = useTheme();
|
|
57
|
-
const isRtl = useRtl();
|
|
58
60
|
const drawingArea = useDrawingArea();
|
|
59
61
|
const labelStyle = React.useMemo(() => _extends({}, theme.typography.subtitle1, {
|
|
60
62
|
color: 'inherit',
|
|
@@ -110,29 +112,18 @@ export function LegendPerItem(props) {
|
|
|
110
112
|
return /*#__PURE__*/_jsx(NoSsr, {
|
|
111
113
|
children: /*#__PURE__*/_jsx(ChartsLegendRoot, {
|
|
112
114
|
className: classes?.root,
|
|
113
|
-
children: itemsWithPosition.map(({
|
|
114
|
-
id,
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
y: -itemMarkHeight / 2,
|
|
126
|
-
width: itemMarkWidth,
|
|
127
|
-
height: itemMarkHeight,
|
|
128
|
-
fill: color
|
|
129
|
-
}), /*#__PURE__*/_jsx(ChartsText, {
|
|
130
|
-
style: labelStyle,
|
|
131
|
-
text: label,
|
|
132
|
-
x: (isRtl ? -1 : 1) * (itemMarkWidth + markGap),
|
|
133
|
-
y: 0
|
|
134
|
-
})]
|
|
135
|
-
}, id))
|
|
115
|
+
children: itemsWithPosition.map((item, i) => /*#__PURE__*/_createElement(ChartsLegendItem, _extends({}, item, {
|
|
116
|
+
key: item.id,
|
|
117
|
+
gapX: gapX,
|
|
118
|
+
gapY: gapY,
|
|
119
|
+
legendWidth: legendWidth,
|
|
120
|
+
itemMarkHeight: itemMarkHeight,
|
|
121
|
+
itemMarkWidth: itemMarkWidth,
|
|
122
|
+
markGap: markGap,
|
|
123
|
+
labelStyle: labelStyle,
|
|
124
|
+
classes: classes,
|
|
125
|
+
onClick: onItemClick ? e => onItemClick(e, i) : undefined
|
|
126
|
+
})))
|
|
136
127
|
})
|
|
137
128
|
});
|
|
138
129
|
}
|