@mui/x-charts 8.0.0-alpha.0 → 8.0.0-alpha.2
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 +4 -9
- package/BarChart/BarChart.js +3 -35
- package/BarChart/BarElement.d.ts +5 -1342
- package/BarChart/BarElement.js +10 -20
- package/BarChart/BarLabel/BarLabel.d.ts +298 -298
- package/BarChart/BarPlot.js +12 -2
- package/BarChart/useBarChartProps.d.ts +0 -2
- package/BarChart/useBarChartProps.js +2 -8
- package/CHANGELOG.md +651 -6
- package/ChartContainer/ChartContainer.d.ts +26 -19
- package/ChartContainer/ChartContainer.js +31 -25
- package/ChartContainer/useChartContainerProps.d.ts +5 -7
- package/ChartContainer/useChartContainerProps.js +12 -27
- package/ChartsAxis/axisClasses.js +2 -1
- package/ChartsAxisHighlight/ChartsAxisHighlight.d.ts +1 -17
- package/ChartsAxisHighlight/ChartsAxisHighlight.js +10 -96
- package/ChartsAxisHighlight/ChartsAxisHighlight.types.d.ts +5 -0
- package/ChartsAxisHighlight/ChartsAxisHighlight.types.js +1 -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/LegendPerItem.d.ts +2 -2
- package/ChartsLegend/chartsLegendClasses.js +2 -1
- package/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +9 -7
- package/ChartsSurface/ChartsSurface.d.ts +14 -15
- package/ChartsSurface/ChartsSurface.js +68 -35
- package/ChartsTooltip/ChartTooltip.types.d.ts +15 -0
- package/ChartsTooltip/ChartTooltip.types.js +1 -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 +143 -145
- package/ChartsTooltip/ChartsTooltipContainer.d.ts +33 -0
- package/ChartsTooltip/ChartsTooltipContainer.js +280 -0
- package/ChartsTooltip/ChartsTooltipTable.js +1 -1
- 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 +19 -19
- package/ChartsTooltip/useItemTooltip.d.ts +2 -3
- package/ChartsTooltip/useItemTooltip.js +5 -4
- package/ChartsTooltip/utils.d.ts +0 -3
- package/ChartsTooltip/utils.js +0 -8
- package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +49 -36
- package/ChartsXAxis/ChartsXAxis.js +3 -17
- package/ChartsYAxis/ChartsYAxis.js +2 -17
- package/Gauge/Gauge.d.ts +1 -1
- package/Gauge/Gauge.js +0 -6
- package/Gauge/GaugeContainer.d.ts +3 -3
- package/Gauge/GaugeContainer.js +42 -76
- 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/AreaPlot.js +12 -2
- package/LineChart/CircleMarkElement.js +6 -5
- package/LineChart/LineChart.d.ts +4 -10
- package/LineChart/LineChart.js +3 -36
- package/LineChart/LineHighlightPlot.js +6 -5
- package/LineChart/LinePlot.js +12 -2
- package/LineChart/MarkElement.js +6 -5
- package/LineChart/useLineChartProps.d.ts +0 -2
- package/LineChart/useLineChartProps.js +2 -8
- package/PieChart/PieChart.d.ts +3 -9
- package/PieChart/PieChart.js +5 -41
- package/PieChart/PiePlot.js +2 -2
- package/PieChart/getPieCoordinates.d.ts +2 -2
- package/README.md +2 -2
- package/ScatterChart/Scatter.js +6 -5
- package/ScatterChart/ScatterChart.d.ts +4 -10
- package/ScatterChart/ScatterChart.js +5 -36
- package/ScatterChart/useScatterChartProps.d.ts +0 -2
- package/ScatterChart/useScatterChartProps.js +1 -9
- package/SparkLineChart/SparkLineChart.d.ts +3 -4
- package/SparkLineChart/SparkLineChart.js +4 -35
- package/context/CartesianProvider/defaultizeAxis.d.ts +9 -11
- package/context/ChartDataProvider/ChartDataProvider.d.ts +36 -19
- package/context/ChartDataProvider/ChartDataProvider.js +55 -48
- package/context/ChartDataProvider/useChartDataProviderProps.d.ts +25 -32
- package/context/ChartDataProvider/useChartDataProviderProps.js +22 -42
- package/context/ChartDataProvider/useDefaultizeAxis.d.ts +9 -11
- package/context/ChartProvider/ChartContext.d.ts +6 -0
- package/context/ChartProvider/ChartContext.js +8 -0
- package/context/ChartProvider/ChartProvider.d.ts +4 -0
- package/context/ChartProvider/ChartProvider.js +19 -0
- package/context/ChartProvider/ChartProvider.types.d.ts +24 -0
- package/context/ChartProvider/ChartProvider.types.js +1 -0
- package/context/ChartProvider/index.d.ts +3 -0
- package/context/ChartProvider/index.js +3 -0
- package/context/ChartProvider/useChartContext.d.ts +3 -0
- package/context/ChartProvider/useChartContext.js +11 -0
- package/context/{DrawingProvider.d.ts → DrawingAreaProvider/DrawingArea.types.d.ts} +3 -14
- package/context/DrawingAreaProvider/DrawingArea.types.js +1 -0
- package/context/DrawingAreaProvider/DrawingAreaContext.d.ts +3 -0
- package/context/DrawingAreaProvider/DrawingAreaContext.js +15 -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/InteractionSelectors.d.ts +382 -0
- package/context/InteractionSelectors.js +12 -0
- package/context/SizeProvider/Size.types.d.ts +30 -0
- package/context/SizeProvider/Size.types.js +1 -0
- package/context/SizeProvider/SizeContext.d.ts +4 -0
- package/context/SizeProvider/SizeContext.js +15 -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/ChartContainer → context/SizeProvider}/useChartContainerDimensions.js +16 -6
- package/context/SizeProvider/useSize.d.ts +5 -0
- package/context/SizeProvider/useSize.js +13 -0
- package/context/index.d.ts +2 -0
- package/context/index.js +2 -1
- package/hooks/useAxisEvents.js +32 -19
- package/hooks/useChartId.js +5 -6
- package/hooks/useDrawingArea.d.ts +2 -2
- package/hooks/useDrawingArea.js +2 -2
- package/hooks/useInteractionItemProps.js +22 -13
- package/hooks/useSvgRef.d.ts +1 -1
- package/hooks/useSvgRef.js +4 -8
- package/index.js +1 -1
- package/internals/components/ChartsAxesGradients/ChartsAxesGradients.d.ts +1 -1
- package/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +9 -7
- package/internals/computeAxisValue.d.ts +2 -2
- package/internals/defaultizeColor.d.ts +1 -1
- package/internals/index.d.ts +3 -4
- package/internals/index.js +3 -4
- package/internals/plugins/allPlugins.d.ts +1 -0
- package/internals/plugins/allPlugins.js +3 -0
- package/internals/plugins/corePlugins/corePlugins.d.ts +10 -0
- package/internals/plugins/corePlugins/corePlugins.js +7 -0
- package/internals/plugins/corePlugins/index.d.ts +2 -0
- package/internals/plugins/corePlugins/index.js +1 -0
- package/internals/plugins/corePlugins/useChartId/index.d.ts +2 -0
- package/internals/plugins/corePlugins/useChartId/index.js +1 -0
- package/internals/plugins/corePlugins/useChartId/useChartId.d.ts +3 -0
- package/internals/plugins/corePlugins/useChartId/useChartId.js +32 -0
- package/internals/plugins/corePlugins/useChartId/useChartId.selectors.d.ts +36 -0
- package/internals/plugins/corePlugins/useChartId/useChartId.selectors.js +9 -0
- package/internals/plugins/corePlugins/useChartId/useChartId.types.d.ts +20 -0
- package/internals/plugins/corePlugins/useChartId/useChartId.types.js +1 -0
- package/internals/plugins/corePlugins/useChartId/useChartId.utils.d.ts +1 -0
- package/internals/plugins/corePlugins/useChartId/useChartId.utils.js +5 -0
- package/internals/plugins/featurePlugins/useChartInteraction/index.d.ts +3 -0
- package/internals/plugins/featurePlugins/useChartInteraction/index.js +2 -0
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.d.ts +3 -0
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +73 -0
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.d.ts +376 -0
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.js +10 -0
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.types.d.ts +57 -0
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.types.js +1 -0
- package/internals/plugins/models/chart.d.ts +14 -0
- package/internals/plugins/models/chart.js +1 -0
- package/internals/plugins/models/helpers.d.ts +7 -0
- package/internals/plugins/models/helpers.js +1 -0
- package/internals/plugins/models/index.d.ts +3 -0
- package/internals/plugins/models/index.js +3 -0
- package/internals/plugins/models/plugin.d.ts +75 -0
- package/internals/plugins/models/plugin.js +1 -0
- package/internals/plugins/utils/ChartStore.d.ts +13 -0
- package/internals/plugins/utils/ChartStore.js +24 -0
- package/internals/plugins/utils/selectors.d.ts +9 -0
- package/internals/plugins/utils/selectors.js +37 -0
- package/internals/store/useCharts.d.ts +14 -0
- package/internals/store/useCharts.js +72 -0
- package/internals/store/useCharts.types.d.ts +5 -0
- package/internals/store/useCharts.types.js +1 -0
- package/internals/store/useSelector.d.ts +4 -0
- package/internals/store/useSelector.js +6 -0
- package/internals/store/useStore.d.ts +3 -0
- package/internals/store/useStore.js +17 -0
- package/models/axis.d.ts +1 -13
- package/modern/BarChart/AnimatedBarElement.js +21 -0
- package/modern/BarChart/BarChart.js +3 -35
- package/modern/BarChart/BarElement.js +10 -20
- package/modern/BarChart/BarPlot.js +12 -2
- package/modern/BarChart/useBarChartProps.js +2 -8
- package/modern/ChartContainer/ChartContainer.js +31 -25
- package/modern/ChartContainer/useChartContainerProps.js +12 -27
- package/modern/ChartsAxis/axisClasses.js +2 -1
- 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/chartsLegendClasses.js +2 -1
- package/modern/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +9 -7
- package/modern/ChartsSurface/ChartsSurface.js +68 -35
- 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 +143 -145
- package/modern/ChartsTooltip/ChartsTooltipContainer.js +280 -0
- package/modern/ChartsTooltip/ChartsTooltipTable.js +1 -1
- package/modern/ChartsTooltip/chartsTooltipClasses.js +18 -2
- package/modern/ChartsTooltip/index.js +2 -3
- package/modern/ChartsTooltip/useAxisTooltip.js +19 -19
- package/modern/ChartsTooltip/useItemTooltip.js +5 -4
- package/modern/ChartsTooltip/utils.js +0 -8
- package/modern/ChartsVoronoiHandler/ChartsVoronoiHandler.js +49 -36
- package/modern/ChartsXAxis/ChartsXAxis.js +3 -17
- package/modern/ChartsYAxis/ChartsYAxis.js +2 -17
- package/modern/Gauge/Gauge.js +0 -6
- package/modern/Gauge/GaugeContainer.js +42 -76
- package/modern/LineChart/AnimatedArea.js +9 -18
- package/modern/LineChart/AnimatedLine.js +9 -20
- package/modern/LineChart/AreaPlot.js +12 -2
- package/modern/LineChart/CircleMarkElement.js +6 -5
- package/modern/LineChart/LineChart.js +3 -36
- package/modern/LineChart/LineHighlightPlot.js +6 -5
- package/modern/LineChart/LinePlot.js +12 -2
- package/modern/LineChart/MarkElement.js +6 -5
- package/modern/LineChart/useLineChartProps.js +2 -8
- package/modern/PieChart/PieChart.js +5 -41
- package/modern/PieChart/PiePlot.js +2 -2
- package/modern/ScatterChart/Scatter.js +6 -5
- package/modern/ScatterChart/ScatterChart.js +5 -36
- package/modern/ScatterChart/useScatterChartProps.js +1 -9
- package/modern/SparkLineChart/SparkLineChart.js +4 -35
- package/modern/context/ChartDataProvider/ChartDataProvider.js +55 -48
- package/modern/context/ChartDataProvider/useChartDataProviderProps.js +22 -42
- package/modern/context/ChartProvider/ChartContext.js +8 -0
- package/modern/context/ChartProvider/ChartProvider.js +19 -0
- package/modern/context/ChartProvider/ChartProvider.types.js +1 -0
- package/modern/context/ChartProvider/index.js +3 -0
- package/modern/context/ChartProvider/useChartContext.js +11 -0
- package/modern/context/DrawingAreaProvider/DrawingArea.types.js +1 -0
- package/modern/context/DrawingAreaProvider/DrawingAreaContext.js +15 -0
- package/{context/DrawingProvider.js → modern/context/DrawingAreaProvider/DrawingAreaProvider.js} +11 -41
- package/modern/context/DrawingAreaProvider/index.js +3 -0
- package/modern/context/InteractionSelectors.js +12 -0
- package/modern/context/SizeProvider/Size.types.js +1 -0
- package/modern/context/SizeProvider/SizeContext.js +15 -0
- package/modern/context/SizeProvider/SizeProvider.js +26 -0
- package/modern/context/SizeProvider/index.js +4 -0
- package/{ChartContainer → modern/context/SizeProvider}/useChartContainerDimensions.js +16 -6
- package/modern/context/SizeProvider/useSize.js +13 -0
- package/modern/context/index.js +2 -1
- package/modern/hooks/useAxisEvents.js +32 -19
- package/modern/hooks/useChartId.js +5 -6
- package/modern/hooks/useDrawingArea.js +2 -2
- package/modern/hooks/useInteractionItemProps.js +22 -13
- package/modern/hooks/useSvgRef.js +4 -8
- package/modern/index.js +1 -1
- package/modern/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +9 -7
- package/modern/internals/index.js +3 -4
- package/modern/internals/plugins/allPlugins.js +3 -0
- package/modern/internals/plugins/corePlugins/corePlugins.js +7 -0
- package/modern/internals/plugins/corePlugins/index.js +1 -0
- package/modern/internals/plugins/corePlugins/useChartId/index.js +1 -0
- package/modern/internals/plugins/corePlugins/useChartId/useChartId.js +32 -0
- package/modern/internals/plugins/corePlugins/useChartId/useChartId.selectors.js +9 -0
- package/modern/internals/plugins/corePlugins/useChartId/useChartId.types.js +1 -0
- package/modern/internals/plugins/corePlugins/useChartId/useChartId.utils.js +5 -0
- package/modern/internals/plugins/featurePlugins/useChartInteraction/index.js +2 -0
- package/modern/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +73 -0
- package/modern/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.js +10 -0
- package/modern/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.types.js +1 -0
- package/modern/internals/plugins/models/chart.js +1 -0
- package/modern/internals/plugins/models/helpers.js +1 -0
- package/modern/internals/plugins/models/index.js +3 -0
- package/modern/internals/plugins/models/plugin.js +1 -0
- package/modern/internals/plugins/utils/ChartStore.js +24 -0
- package/modern/internals/plugins/utils/selectors.js +37 -0
- package/modern/internals/store/useCharts.js +72 -0
- package/modern/internals/store/useCharts.types.js +1 -0
- package/modern/internals/store/useSelector.js +6 -0
- package/modern/internals/store/useStore.js +17 -0
- package/node/BarChart/AnimatedBarElement.js +28 -0
- package/node/BarChart/BarChart.js +3 -35
- package/node/BarChart/BarElement.js +11 -21
- package/node/BarChart/BarPlot.js +11 -1
- package/node/BarChart/useBarChartProps.js +2 -8
- package/node/ChartContainer/ChartContainer.js +31 -25
- package/node/ChartContainer/useChartContainerProps.js +12 -27
- package/node/ChartsAxis/axisClasses.js +5 -3
- package/node/ChartsAxisHighlight/ChartsAxisHighlight.js +12 -100
- package/node/ChartsAxisHighlight/ChartsAxisHighlight.types.js +5 -0
- 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/chartsLegendClasses.js +5 -3
- package/node/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +9 -7
- package/node/ChartsSurface/ChartsSurface.js +68 -35
- package/node/ChartsTooltip/ChartTooltip.types.js +5 -0
- package/node/ChartsTooltip/ChartsAxisTooltipContent.js +83 -73
- package/node/ChartsTooltip/ChartsItemTooltipContent.js +54 -45
- package/node/ChartsTooltip/ChartsTooltip.js +142 -144
- package/node/ChartsTooltip/ChartsTooltipContainer.js +286 -0
- package/node/ChartsTooltip/ChartsTooltipTable.js +2 -2
- package/node/ChartsTooltip/chartsTooltipClasses.js +22 -3
- package/node/ChartsTooltip/index.js +19 -28
- package/node/ChartsTooltip/useAxisTooltip.js +19 -19
- package/node/ChartsTooltip/useItemTooltip.js +5 -4
- package/node/ChartsTooltip/utils.js +0 -9
- package/node/ChartsVoronoiHandler/ChartsVoronoiHandler.js +50 -37
- package/node/ChartsXAxis/ChartsXAxis.js +3 -17
- package/node/ChartsYAxis/ChartsYAxis.js +2 -17
- package/node/Gauge/Gauge.js +0 -6
- package/node/Gauge/GaugeContainer.js +42 -76
- package/node/LineChart/AnimatedArea.js +9 -19
- package/node/LineChart/AnimatedLine.js +9 -21
- package/node/LineChart/AreaPlot.js +11 -1
- package/node/LineChart/CircleMarkElement.js +6 -5
- package/node/LineChart/LineChart.js +3 -36
- package/node/LineChart/LineHighlightPlot.js +6 -5
- package/node/LineChart/LinePlot.js +11 -1
- package/node/LineChart/MarkElement.js +6 -5
- package/node/LineChart/useLineChartProps.js +2 -8
- package/node/PieChart/PieChart.js +5 -41
- package/node/PieChart/PiePlot.js +2 -2
- package/node/ScatterChart/Scatter.js +6 -5
- package/node/ScatterChart/ScatterChart.js +5 -36
- package/node/ScatterChart/useScatterChartProps.js +1 -9
- package/node/SparkLineChart/SparkLineChart.js +4 -35
- package/node/context/ChartDataProvider/ChartDataProvider.js +55 -48
- package/node/context/ChartDataProvider/useChartDataProviderProps.js +22 -44
- package/node/context/ChartProvider/ChartContext.js +15 -0
- package/node/context/ChartProvider/ChartProvider.js +24 -0
- package/node/context/ChartProvider/ChartProvider.types.js +5 -0
- package/node/context/ChartProvider/index.js +38 -0
- package/node/context/ChartProvider/useChartContext.js +18 -0
- package/node/context/DrawingAreaProvider/DrawingArea.types.js +5 -0
- package/node/context/DrawingAreaProvider/DrawingAreaContext.js +21 -0
- package/node/context/{DrawingProvider.js → DrawingAreaProvider/DrawingAreaProvider.js} +12 -44
- package/node/context/DrawingAreaProvider/index.js +38 -0
- package/node/context/InteractionSelectors.js +18 -0
- package/node/context/SizeProvider/Size.types.js +5 -0
- package/node/context/SizeProvider/SizeContext.js +22 -0
- package/node/context/SizeProvider/SizeProvider.js +29 -0
- package/node/context/SizeProvider/index.js +49 -0
- package/node/{ChartContainer → context/SizeProvider}/useChartContainerDimensions.js +16 -6
- package/node/context/SizeProvider/useSize.js +20 -0
- package/node/context/index.js +10 -2
- package/node/hooks/useAxisEvents.js +33 -19
- package/node/hooks/useChartId.js +5 -7
- package/node/hooks/useDrawingArea.js +2 -2
- package/node/hooks/useInteractionItemProps.js +23 -14
- package/node/hooks/useSvgRef.js +4 -9
- package/node/index.js +1 -1
- package/node/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +8 -6
- package/node/internals/index.js +28 -40
- package/node/internals/plugins/allPlugins.js +10 -0
- package/node/internals/plugins/corePlugins/corePlugins.js +12 -0
- package/node/internals/plugins/corePlugins/index.js +12 -0
- package/node/internals/plugins/corePlugins/useChartId/index.js +12 -0
- package/node/internals/plugins/corePlugins/useChartId/useChartId.js +41 -0
- package/node/internals/plugins/corePlugins/useChartId/useChartId.selectors.js +15 -0
- package/node/internals/plugins/corePlugins/useChartId/useChartId.types.js +5 -0
- package/node/internals/plugins/corePlugins/useChartId/useChartId.utils.js +12 -0
- package/node/internals/plugins/featurePlugins/useChartInteraction/index.js +27 -0
- package/node/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +81 -0
- package/node/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.js +16 -0
- package/node/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.types.js +5 -0
- package/node/internals/plugins/models/chart.js +5 -0
- package/node/internals/plugins/models/helpers.js +5 -0
- package/node/internals/plugins/models/index.js +38 -0
- package/node/internals/plugins/models/plugin.js +5 -0
- package/node/internals/plugins/utils/ChartStore.js +31 -0
- package/node/internals/plugins/utils/selectors.js +44 -0
- package/node/internals/store/useCharts.js +80 -0
- package/node/internals/store/useCharts.types.js +5 -0
- package/node/internals/store/useSelector.js +13 -0
- package/node/internals/store/useStore.js +23 -0
- package/package.json +7 -5
- package/themeAugmentation/props.d.ts +1 -2
- package/ChartContainer/ResizableContainer.d.ts +0 -9
- package/ChartContainer/ResizableContainer.js +0 -26
- package/ChartContainer/useChartContainerDimensions.d.ts +0 -6
- 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/context/InteractionProvider.d.ts +0 -50
- package/context/InteractionProvider.js +0 -78
- package/modern/ChartContainer/ResizableContainer.js +0 -26
- package/modern/ChartsTooltip/DefaultChartsAxisTooltipContent.js +0 -123
- package/modern/ChartsTooltip/DefaultChartsItemTooltipContent.js +0 -92
- package/modern/context/InteractionProvider.js +0 -78
- package/node/ChartContainer/ResizableContainer.js +0 -32
- package/node/ChartsTooltip/DefaultChartsAxisTooltipContent.js +0 -129
- package/node/ChartsTooltip/DefaultChartsItemTooltipContent.js +0 -98
- package/node/context/InteractionProvider.js +0 -85
- /package/ChartsGrid/{styledCommonents.d.ts → styledComponents.d.ts} +0 -0
- /package/ChartsGrid/{styledCommonents.js → styledComponents.js} +0 -0
- /package/modern/ChartsGrid/{styledCommonents.js → styledComponents.js} +0 -0
- /package/node/ChartsGrid/{styledCommonents.js → styledComponents.js} +0 -0
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
// Components
|
|
2
2
|
export * from "./components/ChartsAxesGradients/index.js";
|
|
3
|
-
export * from "../ChartContainer/useChartContainerDimensions.js";
|
|
4
|
-
export * from "../ChartContainer/ResizableContainer.js";
|
|
5
3
|
|
|
6
4
|
// hooks
|
|
7
5
|
export { useSeries } from "../hooks/useSeries.js";
|
|
@@ -26,14 +24,15 @@ export * from "./computeAxisValue.js";
|
|
|
26
24
|
// contexts
|
|
27
25
|
|
|
28
26
|
export * from "../context/CartesianProvider/index.js";
|
|
29
|
-
export * from "../context/
|
|
30
|
-
export * from "../context/InteractionProvider.js";
|
|
27
|
+
export * from "../context/DrawingAreaProvider/index.js";
|
|
31
28
|
export * from "../context/SeriesProvider/index.js";
|
|
32
29
|
export * from "../context/ZAxisContextProvider.js";
|
|
33
30
|
export * from "../context/PluginProvider/index.js";
|
|
34
31
|
export * from "../context/AnimationProvider/index.js";
|
|
35
32
|
export { getAxisExtremum } from "../context/CartesianProvider/getAxisExtremum.js";
|
|
36
33
|
export * from "../context/ChartDataProvider/index.js";
|
|
34
|
+
export * from "../context/SizeProvider/index.js";
|
|
35
|
+
export * from "../context/ChartProvider/index.js";
|
|
37
36
|
|
|
38
37
|
// series configuration
|
|
39
38
|
export * from "../models/seriesType/config.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CHART_CORE_PLUGINS } from "./corePlugins.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useChartId } from "./useChartId.js";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { createChartDefaultId } from "./useChartId.utils.js";
|
|
4
|
+
export const useChartId = ({
|
|
5
|
+
params,
|
|
6
|
+
store
|
|
7
|
+
}) => {
|
|
8
|
+
React.useEffect(() => {
|
|
9
|
+
store.update(prevState => {
|
|
10
|
+
if (params.id === prevState.id.providedChartId && prevState.id.chartId !== undefined) {
|
|
11
|
+
return prevState;
|
|
12
|
+
}
|
|
13
|
+
return _extends({}, prevState, {
|
|
14
|
+
id: _extends({}, prevState.id, {
|
|
15
|
+
chartId: params.id ?? createChartDefaultId()
|
|
16
|
+
})
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
}, [store, params.id]);
|
|
20
|
+
return {};
|
|
21
|
+
};
|
|
22
|
+
useChartId.params = {
|
|
23
|
+
id: true
|
|
24
|
+
};
|
|
25
|
+
useChartId.getInitialState = ({
|
|
26
|
+
id
|
|
27
|
+
}) => ({
|
|
28
|
+
id: {
|
|
29
|
+
chartId: createChartDefaultId(),
|
|
30
|
+
providedChartId: id
|
|
31
|
+
}
|
|
32
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createSelector } from "../../utils/selectors.js";
|
|
2
|
+
const selectorChartIdState = state => state.id;
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Get the id attribute of the chart.
|
|
6
|
+
* @param {ChartState<[UseChartIdSignature]>} state The state of the chart.
|
|
7
|
+
* @returns {string} The id attribute of the chart.
|
|
8
|
+
*/
|
|
9
|
+
export const selectorChartId = createSelector(selectorChartIdState, idState => idState.chartId);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import useEventCallback from '@mui/utils/useEventCallback';
|
|
3
|
+
export const useChartInteraction = ({
|
|
4
|
+
store
|
|
5
|
+
}) => {
|
|
6
|
+
const cleanInteraction = useEventCallback(() => {
|
|
7
|
+
store.update(prev => _extends({}, prev, {
|
|
8
|
+
interaction: _extends({}, prev.interaction, {
|
|
9
|
+
axis: {
|
|
10
|
+
x: null,
|
|
11
|
+
y: null
|
|
12
|
+
},
|
|
13
|
+
item: null
|
|
14
|
+
})
|
|
15
|
+
}));
|
|
16
|
+
});
|
|
17
|
+
const setItemInteraction = useEventCallback(newItem => {
|
|
18
|
+
store.update(prev => _extends({}, prev, {
|
|
19
|
+
interaction: _extends({}, prev.interaction, {
|
|
20
|
+
item: newItem
|
|
21
|
+
})
|
|
22
|
+
}));
|
|
23
|
+
});
|
|
24
|
+
const setAxisInteraction = useEventCallback(({
|
|
25
|
+
x: newStateX,
|
|
26
|
+
y: newStateY
|
|
27
|
+
}) => {
|
|
28
|
+
store.update(prev => _extends({}, prev, {
|
|
29
|
+
interaction: _extends({}, prev.interaction, {
|
|
30
|
+
axis: _extends({}, prev.interaction.axis, prev.interaction.axis.x?.index !== newStateX?.index || prev.interaction.axis.x?.value !== newStateX?.value ? {
|
|
31
|
+
x: newStateX
|
|
32
|
+
} : {}, prev.interaction.axis.y?.index !== newStateY?.index || prev.interaction.axis.y?.value !== newStateY?.value ? {
|
|
33
|
+
y: newStateY
|
|
34
|
+
} : {})
|
|
35
|
+
})
|
|
36
|
+
}));
|
|
37
|
+
});
|
|
38
|
+
const enableVoronoid = useEventCallback(() => {
|
|
39
|
+
store.update(prev => _extends({}, prev, {
|
|
40
|
+
interaction: _extends({}, prev.interaction, {
|
|
41
|
+
isVoronoiEnabled: true
|
|
42
|
+
})
|
|
43
|
+
}));
|
|
44
|
+
});
|
|
45
|
+
const disableVoronoid = useEventCallback(() => {
|
|
46
|
+
store.update(prev => _extends({}, prev, {
|
|
47
|
+
interaction: _extends({}, prev.interaction, {
|
|
48
|
+
isVoronoiEnabled: false
|
|
49
|
+
})
|
|
50
|
+
}));
|
|
51
|
+
});
|
|
52
|
+
return {
|
|
53
|
+
params: {},
|
|
54
|
+
instance: {
|
|
55
|
+
cleanInteraction,
|
|
56
|
+
setItemInteraction,
|
|
57
|
+
setAxisInteraction,
|
|
58
|
+
enableVoronoid,
|
|
59
|
+
disableVoronoid
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
useChartInteraction.getInitialState = () => ({
|
|
64
|
+
interaction: {
|
|
65
|
+
item: null,
|
|
66
|
+
axis: {
|
|
67
|
+
x: null,
|
|
68
|
+
y: null
|
|
69
|
+
},
|
|
70
|
+
isVoronoiEnabled: false
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
useChartInteraction.params = {};
|
package/modern/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createSelector } from "../../utils/selectors.js";
|
|
2
|
+
const selectInteraction = state => state.interaction;
|
|
3
|
+
export const selectorChartsInteractionItem = createSelector(selectInteraction, interaction => interaction.item);
|
|
4
|
+
export const selectorChartsInteractionAxis = createSelector(selectInteraction, interaction => interaction.axis);
|
|
5
|
+
export const selectorChartsInteractionXAxis = createSelector(selectInteraction, interaction => interaction.axis.x);
|
|
6
|
+
export const selectorChartsInteractionYAxis = createSelector(selectInteraction, interaction => interaction.axis.y);
|
|
7
|
+
export const selectorChartsInteractionItemIsDefined = createSelector(selectorChartsInteractionItem, item => item !== null);
|
|
8
|
+
export const selectorChartsInteractionXAxisIsDefined = createSelector(selectorChartsInteractionXAxis, x => x !== null);
|
|
9
|
+
export const selectorChartsInteractionYAxisIsDefined = createSelector(selectorChartsInteractionYAxis, y => y !== null);
|
|
10
|
+
export const selectorChartsInteractionIsVoronoiEnabled = createSelector(selectInteraction, interaction => interaction.isVoronoiEnabled);
|
package/modern/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export class ChartStore {
|
|
2
|
+
constructor(value) {
|
|
3
|
+
this.value = void 0;
|
|
4
|
+
this.listeners = void 0;
|
|
5
|
+
this.subscribe = fn => {
|
|
6
|
+
this.listeners.add(fn);
|
|
7
|
+
return () => {
|
|
8
|
+
this.listeners.delete(fn);
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
this.getSnapshot = () => {
|
|
12
|
+
return this.value;
|
|
13
|
+
};
|
|
14
|
+
this.update = updater => {
|
|
15
|
+
const newState = updater(this.value);
|
|
16
|
+
if (newState !== this.value) {
|
|
17
|
+
this.value = newState;
|
|
18
|
+
this.listeners.forEach(l => l(newState));
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
this.value = value;
|
|
22
|
+
this.listeners = new Set();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { lruMemoize, createSelectorCreator } from 'reselect';
|
|
2
|
+
const reselectCreateSelector = createSelectorCreator({
|
|
3
|
+
memoize: lruMemoize,
|
|
4
|
+
memoizeOptions: {
|
|
5
|
+
maxSize: 1,
|
|
6
|
+
equalityCheck: Object.is
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
const cache = new WeakMap();
|
|
10
|
+
/**
|
|
11
|
+
* Method wrapping reselect's createSelector to provide caching for chart instances.
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
14
|
+
export const createSelector = (...createSelectorArgs) => {
|
|
15
|
+
const selector = (state, selectorArgs) => {
|
|
16
|
+
const cacheKey = state.cacheKey;
|
|
17
|
+
|
|
18
|
+
// If there is no cache for the current chart instance, create one.
|
|
19
|
+
let cacheForCurrentChartInstance = cache.get(cacheKey);
|
|
20
|
+
if (!cacheForCurrentChartInstance) {
|
|
21
|
+
cacheForCurrentChartInstance = new Map();
|
|
22
|
+
cache.set(cacheKey, cacheForCurrentChartInstance);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// If there is a cached selector, execute it.
|
|
26
|
+
const cachedSelector = cacheForCurrentChartInstance.get(createSelectorArgs);
|
|
27
|
+
if (cachedSelector) {
|
|
28
|
+
return cachedSelector(state, selectorArgs);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Otherwise, create a new selector and cache it and execute it.
|
|
32
|
+
const fn = reselectCreateSelector(...createSelectorArgs);
|
|
33
|
+
cacheForCurrentChartInstance.set(createSelectorArgs, fn);
|
|
34
|
+
return fn(state, selectorArgs);
|
|
35
|
+
};
|
|
36
|
+
return selector;
|
|
37
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ChartStore } from "../plugins/utils/ChartStore.js";
|
|
3
|
+
import { CHART_CORE_PLUGINS } from "../plugins/corePlugins/index.js";
|
|
4
|
+
export function useChartApiInitialization(inputApiRef) {
|
|
5
|
+
const fallbackPublicApiRef = React.useRef({});
|
|
6
|
+
if (inputApiRef) {
|
|
7
|
+
if (inputApiRef.current == null) {
|
|
8
|
+
// eslint-disable-next-line react-compiler/react-compiler
|
|
9
|
+
inputApiRef.current = {};
|
|
10
|
+
}
|
|
11
|
+
return inputApiRef.current;
|
|
12
|
+
}
|
|
13
|
+
return fallbackPublicApiRef.current;
|
|
14
|
+
}
|
|
15
|
+
let globalId = 0;
|
|
16
|
+
export function useCharts(inPlugins, props) {
|
|
17
|
+
const plugins = React.useMemo(() => [...CHART_CORE_PLUGINS, ...inPlugins], [inPlugins]);
|
|
18
|
+
const pluginParams = {}; // To generate when plugins use params.
|
|
19
|
+
const instanceRef = React.useRef({});
|
|
20
|
+
const instance = instanceRef.current;
|
|
21
|
+
const publicAPI = useChartApiInitialization(props.apiRef);
|
|
22
|
+
const innerSvgRef = React.useRef(null);
|
|
23
|
+
const storeRef = React.useRef(null);
|
|
24
|
+
if (storeRef.current == null) {
|
|
25
|
+
// eslint-disable-next-line react-compiler/react-compiler
|
|
26
|
+
globalId += 1;
|
|
27
|
+
const initialState = {
|
|
28
|
+
// TODO remove when the interaction moves to plugin
|
|
29
|
+
interaction: {
|
|
30
|
+
item: null,
|
|
31
|
+
axis: {
|
|
32
|
+
x: null,
|
|
33
|
+
y: null
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
cacheKey: {
|
|
37
|
+
id: globalId
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
plugins.forEach(plugin => {
|
|
41
|
+
if (plugin.getInitialState) {
|
|
42
|
+
Object.assign(initialState, plugin.getInitialState({}));
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
storeRef.current = new ChartStore(initialState);
|
|
46
|
+
}
|
|
47
|
+
const runPlugin = plugin => {
|
|
48
|
+
const pluginResponse = plugin({
|
|
49
|
+
instance,
|
|
50
|
+
params: pluginParams,
|
|
51
|
+
plugins: plugins,
|
|
52
|
+
store: storeRef.current,
|
|
53
|
+
svgRef: innerSvgRef
|
|
54
|
+
});
|
|
55
|
+
if (pluginResponse.publicAPI) {
|
|
56
|
+
Object.assign(publicAPI, pluginResponse.publicAPI);
|
|
57
|
+
}
|
|
58
|
+
if (pluginResponse.instance) {
|
|
59
|
+
Object.assign(instance, pluginResponse.instance);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
plugins.forEach(runPlugin);
|
|
63
|
+
const contextValue = React.useMemo(() => ({
|
|
64
|
+
store: storeRef.current,
|
|
65
|
+
publicAPI,
|
|
66
|
+
instance,
|
|
67
|
+
svgRef: innerSvgRef
|
|
68
|
+
}), [instance, publicAPI]);
|
|
69
|
+
return {
|
|
70
|
+
contextValue
|
|
71
|
+
};
|
|
72
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { useSyncExternalStoreWithSelector } from 'use-sync-external-store/with-selector';
|
|
2
|
+
const defaultCompare = Object.is;
|
|
3
|
+
export const useSelector = (store, selector, args = undefined, equals = defaultCompare) => {
|
|
4
|
+
const selectorWithArgs = state => selector(state, args);
|
|
5
|
+
return useSyncExternalStoreWithSelector(store.subscribe, store.getSnapshot, store.getSnapshot, selectorWithArgs, equals);
|
|
6
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useChartContext } from "../../context/ChartProvider/index.js";
|
|
2
|
+
// This hook should be removed because user and us should not interact with the store directly, but with public/private APIs
|
|
3
|
+
export function useStore(skipError) {
|
|
4
|
+
const context = useChartContext();
|
|
5
|
+
if (skipError) {
|
|
6
|
+
// TODO: Remove once store is used by all charts.
|
|
7
|
+
// This line is only for `useAxisEvents` which is in the surface of the Gauge.
|
|
8
|
+
// But the Gauge don't have store yet because it does not need the interaction provider.
|
|
9
|
+
// Will be fixed when every thing move to the store since every component will have access to it.
|
|
10
|
+
// @ts-ignore
|
|
11
|
+
return context?.store;
|
|
12
|
+
}
|
|
13
|
+
if (!context) {
|
|
14
|
+
throw new Error(['MUI X: Could not find the charts context.', 'It looks like you rendered your component outside of a ChartsContainer parent component.'].join('\n'));
|
|
15
|
+
}
|
|
16
|
+
return context.store;
|
|
17
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
exports.AnimatedBarElement = AnimatedBarElement;
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
12
|
+
var React = _interopRequireWildcard(require("react"));
|
|
13
|
+
var _web = require("@react-spring/web");
|
|
14
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
+
const _excluded = ["ownerState"];
|
|
16
|
+
/**
|
|
17
|
+
* @ignore - internal component.
|
|
18
|
+
*/
|
|
19
|
+
function AnimatedBarElement(props) {
|
|
20
|
+
const {
|
|
21
|
+
ownerState
|
|
22
|
+
} = props,
|
|
23
|
+
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
24
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_web.animated.rect, (0, _extends2.default)({}, other, {
|
|
25
|
+
filter: ownerState.isHighlighted ? 'brightness(120%)' : undefined,
|
|
26
|
+
opacity: ownerState.isFaded ? 0.3 : 1
|
|
27
|
+
}));
|
|
28
|
+
}
|
|
@@ -50,15 +50,15 @@ const BarChart = exports.BarChart = /*#__PURE__*/React.forwardRef(function BarCh
|
|
|
50
50
|
chartsAxisProps,
|
|
51
51
|
axisHighlightProps,
|
|
52
52
|
legendProps,
|
|
53
|
-
tooltipProps,
|
|
54
53
|
children
|
|
55
54
|
} = (0, _useBarChartProps.useBarChartProps)(props);
|
|
55
|
+
const Tooltip = props.slots?.tooltip ?? _ChartsTooltip.ChartsTooltip;
|
|
56
56
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartContainer.ChartContainer, (0, _extends2.default)({
|
|
57
57
|
ref: ref
|
|
58
58
|
}, chartContainerProps, {
|
|
59
59
|
children: [props.onAxisClick && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOnAxisClickHandler.ChartsOnAxisClickHandler, (0, _extends2.default)({}, axisClickHandlerProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsGrid.ChartsGrid, (0, _extends2.default)({}, gridProps)), /*#__PURE__*/(0, _jsxRuntime.jsxs)("g", (0, _extends2.default)({}, clipPathGroupProps, {
|
|
60
60
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_BarPlot.BarPlot, (0, _extends2.default)({}, barPlotProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOverlay.ChartsOverlay, (0, _extends2.default)({}, overlayProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlight.ChartsAxisHighlight, (0, _extends2.default)({}, axisHighlightProps))]
|
|
61
|
-
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxis.ChartsAxis, (0, _extends2.default)({}, chartsAxisProps)), !props.hideLegend && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legendProps)), !props.loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
61
|
+
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxis.ChartsAxis, (0, _extends2.default)({}, chartsAxisProps)), !props.hideLegend && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legendProps)), !props.loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(Tooltip, (0, _extends2.default)({}, props.slotProps?.tooltip)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsClipPath.ChartsClipPath, (0, _extends2.default)({}, clipPathProps)), children]
|
|
62
62
|
}));
|
|
63
63
|
});
|
|
64
64
|
process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
@@ -70,7 +70,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
70
70
|
* The configuration of axes highlight.
|
|
71
71
|
* Default is set to 'band' in the bar direction.
|
|
72
72
|
* Depends on `layout` prop.
|
|
73
|
-
* @see See {@link https://mui.com/x/react-charts/highlighting highlighting docs} for more details.
|
|
73
|
+
* @see See {@link https://mui.com/x/react-charts/highlighting/ highlighting docs} for more details.
|
|
74
74
|
*/
|
|
75
75
|
axisHighlight: _propTypes.default.shape({
|
|
76
76
|
x: _propTypes.default.oneOf(['band', 'line', 'none']),
|
|
@@ -181,16 +181,6 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
181
181
|
* @param {BarItemIdentifier} barItemIdentifier The bar item identifier.
|
|
182
182
|
*/
|
|
183
183
|
onItemClick: _propTypes.default.func,
|
|
184
|
-
/**
|
|
185
|
-
* The chart will try to wait for the parent container to resolve its size
|
|
186
|
-
* before it renders for the first time.
|
|
187
|
-
*
|
|
188
|
-
* This can be useful in some scenarios where the chart appear to grow after
|
|
189
|
-
* the first render, like when used inside a grid.
|
|
190
|
-
*
|
|
191
|
-
* @default false
|
|
192
|
-
*/
|
|
193
|
-
resolveSizeBeforeRender: _propTypes.default.bool,
|
|
194
184
|
/**
|
|
195
185
|
* Indicate which axis to display the right of the charts.
|
|
196
186
|
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
@@ -219,30 +209,12 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
219
209
|
slots: _propTypes.default.object,
|
|
220
210
|
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
|
|
221
211
|
title: _propTypes.default.string,
|
|
222
|
-
/**
|
|
223
|
-
* The configuration of the tooltip.
|
|
224
|
-
* @see See {@link https://mui.com/x/react-charts/tooltip/ tooltip docs} for more details.
|
|
225
|
-
*/
|
|
226
|
-
tooltip: _propTypes.default.shape({
|
|
227
|
-
axisContent: _propTypes.default.elementType,
|
|
228
|
-
classes: _propTypes.default.object,
|
|
229
|
-
itemContent: _propTypes.default.elementType,
|
|
230
|
-
slotProps: _propTypes.default.object,
|
|
231
|
-
slots: _propTypes.default.object,
|
|
232
|
-
trigger: _propTypes.default.oneOf(['axis', 'item', 'none'])
|
|
233
|
-
}),
|
|
234
212
|
/**
|
|
235
213
|
* Indicate which axis to display the top of the charts.
|
|
236
214
|
* Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
|
|
237
215
|
* @default null
|
|
238
216
|
*/
|
|
239
217
|
topAxis: _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.string]),
|
|
240
|
-
viewBox: _propTypes.default.shape({
|
|
241
|
-
height: _propTypes.default.number,
|
|
242
|
-
width: _propTypes.default.number,
|
|
243
|
-
x: _propTypes.default.number,
|
|
244
|
-
y: _propTypes.default.number
|
|
245
|
-
}),
|
|
246
218
|
/**
|
|
247
219
|
* The width of the chart in px. If not defined, it takes the width of the parent element.
|
|
248
220
|
*/
|
|
@@ -278,7 +250,6 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
278
250
|
hideTooltip: _propTypes.default.bool,
|
|
279
251
|
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
280
252
|
label: _propTypes.default.string,
|
|
281
|
-
labelFontSize: _propTypes.default.number,
|
|
282
253
|
labelStyle: _propTypes.default.object,
|
|
283
254
|
max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
284
255
|
min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
@@ -289,7 +260,6 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
289
260
|
slots: _propTypes.default.object,
|
|
290
261
|
stroke: _propTypes.default.string,
|
|
291
262
|
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
|
|
292
|
-
tickFontSize: _propTypes.default.number,
|
|
293
263
|
tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
|
|
294
264
|
tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
|
|
295
265
|
tickLabelPlacement: _propTypes.default.oneOf(['middle', 'tick']),
|
|
@@ -332,7 +302,6 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
332
302
|
hideTooltip: _propTypes.default.bool,
|
|
333
303
|
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
334
304
|
label: _propTypes.default.string,
|
|
335
|
-
labelFontSize: _propTypes.default.number,
|
|
336
305
|
labelStyle: _propTypes.default.object,
|
|
337
306
|
max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
338
307
|
min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
@@ -343,7 +312,6 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
343
312
|
slots: _propTypes.default.object,
|
|
344
313
|
stroke: _propTypes.default.string,
|
|
345
314
|
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
|
|
346
|
-
tickFontSize: _propTypes.default.number,
|
|
347
315
|
tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
|
|
348
316
|
tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
|
|
349
317
|
tickLabelPlacement: _propTypes.default.oneOf(['middle', 'tick']),
|
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
value: true
|
|
8
8
|
});
|
|
9
9
|
exports.BarElement = BarElement;
|
|
10
|
-
exports.barElementClasses =
|
|
10
|
+
exports.barElementClasses = void 0;
|
|
11
11
|
exports.getBarElementUtilityClass = getBarElementUtilityClass;
|
|
12
12
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
13
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
@@ -16,40 +16,28 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
16
16
|
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
17
17
|
var _useSlotProps = _interopRequireDefault(require("@mui/utils/useSlotProps"));
|
|
18
18
|
var _generateUtilityClass = _interopRequireDefault(require("@mui/utils/generateUtilityClass"));
|
|
19
|
-
var _styles = require("@mui/material/styles");
|
|
20
19
|
var _generateUtilityClasses = _interopRequireDefault(require("@mui/utils/generateUtilityClasses"));
|
|
21
|
-
var _d3Color = require("@mui/x-charts-vendor/d3-color");
|
|
22
|
-
var _web = require("@react-spring/web");
|
|
23
20
|
var _useInteractionItemProps = require("../hooks/useInteractionItemProps");
|
|
24
21
|
var _context = require("../context");
|
|
22
|
+
var _AnimatedBarElement = require("./AnimatedBarElement");
|
|
25
23
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
26
24
|
const _excluded = ["id", "dataIndex", "classes", "color", "slots", "slotProps", "style", "onClick"];
|
|
27
25
|
function getBarElementUtilityClass(slot) {
|
|
28
26
|
return (0, _generateUtilityClass.default)('MuiBarElement', slot);
|
|
29
27
|
}
|
|
30
|
-
const barElementClasses = exports.barElementClasses = (0, _generateUtilityClasses.default)('MuiBarElement', ['root']);
|
|
28
|
+
const barElementClasses = exports.barElementClasses = (0, _generateUtilityClasses.default)('MuiBarElement', ['root', 'highlighted', 'faded']);
|
|
31
29
|
const useUtilityClasses = ownerState => {
|
|
32
30
|
const {
|
|
33
31
|
classes,
|
|
34
|
-
id
|
|
32
|
+
id,
|
|
33
|
+
isHighlighted,
|
|
34
|
+
isFaded
|
|
35
35
|
} = ownerState;
|
|
36
36
|
const slots = {
|
|
37
|
-
root: ['root', `series-${id}
|
|
37
|
+
root: ['root', `series-${id}`, isHighlighted && 'highlighted', isFaded && 'faded']
|
|
38
38
|
};
|
|
39
39
|
return (0, _composeClasses.default)(slots, getBarElementUtilityClass, classes);
|
|
40
40
|
};
|
|
41
|
-
const BarElementPath = exports.BarElementPath = (0, _styles.styled)(_web.animated.rect, {
|
|
42
|
-
name: 'MuiBarElement',
|
|
43
|
-
slot: 'Root',
|
|
44
|
-
overridesResolver: (_, styles) => styles.root
|
|
45
|
-
})(({
|
|
46
|
-
ownerState
|
|
47
|
-
}) => ({
|
|
48
|
-
stroke: 'none',
|
|
49
|
-
fill: ownerState.isHighlighted ? (0, _d3Color.color)(ownerState.color).brighter(0.5).formatHex() : ownerState.color,
|
|
50
|
-
transition: 'opacity 0.2s ease-in, fill 0.2s ease-in',
|
|
51
|
-
opacity: ownerState.isFaded && 0.3 || 1
|
|
52
|
-
}));
|
|
53
41
|
function BarElement(props) {
|
|
54
42
|
const {
|
|
55
43
|
id,
|
|
@@ -79,7 +67,7 @@ function BarElement(props) {
|
|
|
79
67
|
isHighlighted
|
|
80
68
|
};
|
|
81
69
|
const classes = useUtilityClasses(ownerState);
|
|
82
|
-
const Bar = slots?.bar ??
|
|
70
|
+
const Bar = slots?.bar ?? _AnimatedBarElement.AnimatedBarElement;
|
|
83
71
|
const barProps = (0, _useSlotProps.default)({
|
|
84
72
|
elementType: Bar,
|
|
85
73
|
externalSlotProps: slotProps?.bar,
|
|
@@ -91,7 +79,9 @@ function BarElement(props) {
|
|
|
91
79
|
}), {
|
|
92
80
|
style,
|
|
93
81
|
onClick,
|
|
94
|
-
cursor: onClick ? 'pointer' : 'unset'
|
|
82
|
+
cursor: onClick ? 'pointer' : 'unset',
|
|
83
|
+
stroke: 'none',
|
|
84
|
+
fill: color
|
|
95
85
|
}),
|
|
96
86
|
className: classes.root,
|
|
97
87
|
ownerState
|
package/node/BarChart/BarPlot.js
CHANGED
|
@@ -12,6 +12,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
12
12
|
var React = _interopRequireWildcard(require("react"));
|
|
13
13
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
14
14
|
var _web = require("@react-spring/web");
|
|
15
|
+
var _styles = require("@mui/material/styles");
|
|
15
16
|
var _CartesianProvider = require("../context/CartesianProvider");
|
|
16
17
|
var _BarElement = require("./BarElement");
|
|
17
18
|
var _getColor = _interopRequireDefault(require("./getColor"));
|
|
@@ -185,6 +186,15 @@ const enterStyle = ({
|
|
|
185
186
|
height,
|
|
186
187
|
width
|
|
187
188
|
});
|
|
189
|
+
const BarPlotRoot = (0, _styles.styled)('g', {
|
|
190
|
+
name: 'MuiBarPlot',
|
|
191
|
+
slot: 'Root',
|
|
192
|
+
overridesResolver: (_, styles) => styles.root
|
|
193
|
+
})({
|
|
194
|
+
[`& .${_BarElement.barElementClasses.root}`]: {
|
|
195
|
+
transition: 'opacity 0.2s ease-in, fill 0.2s ease-in'
|
|
196
|
+
}
|
|
197
|
+
});
|
|
188
198
|
|
|
189
199
|
/**
|
|
190
200
|
* Demos:
|
|
@@ -227,7 +237,7 @@ function BarPlot(props) {
|
|
|
227
237
|
update: enterStyle,
|
|
228
238
|
immediate: skipAnimation
|
|
229
239
|
});
|
|
230
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(
|
|
240
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(BarPlotRoot, {
|
|
231
241
|
children: [!withoutBorderRadius && maskTransition((style, {
|
|
232
242
|
id,
|
|
233
243
|
hasPositive,
|