@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
package/node/internals/index.js
CHANGED
|
@@ -73,30 +73,6 @@ Object.keys(_ChartsAxesGradients).forEach(function (key) {
|
|
|
73
73
|
}
|
|
74
74
|
});
|
|
75
75
|
});
|
|
76
|
-
var _useChartContainerDimensions = require("../ChartContainer/useChartContainerDimensions");
|
|
77
|
-
Object.keys(_useChartContainerDimensions).forEach(function (key) {
|
|
78
|
-
if (key === "default" || key === "__esModule") return;
|
|
79
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
80
|
-
if (key in exports && exports[key] === _useChartContainerDimensions[key]) return;
|
|
81
|
-
Object.defineProperty(exports, key, {
|
|
82
|
-
enumerable: true,
|
|
83
|
-
get: function () {
|
|
84
|
-
return _useChartContainerDimensions[key];
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
var _ResizableContainer = require("../ChartContainer/ResizableContainer");
|
|
89
|
-
Object.keys(_ResizableContainer).forEach(function (key) {
|
|
90
|
-
if (key === "default" || key === "__esModule") return;
|
|
91
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
92
|
-
if (key in exports && exports[key] === _ResizableContainer[key]) return;
|
|
93
|
-
Object.defineProperty(exports, key, {
|
|
94
|
-
enumerable: true,
|
|
95
|
-
get: function () {
|
|
96
|
-
return _ResizableContainer[key];
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
});
|
|
100
76
|
var _useSeries = require("../hooks/useSeries");
|
|
101
77
|
var _useInteractionItemProps = require("../hooks/useInteractionItemProps");
|
|
102
78
|
var _useDrawingArea = require("../hooks/useDrawingArea");
|
|
@@ -224,27 +200,15 @@ Object.keys(_CartesianProvider).forEach(function (key) {
|
|
|
224
200
|
}
|
|
225
201
|
});
|
|
226
202
|
});
|
|
227
|
-
var
|
|
228
|
-
Object.keys(
|
|
229
|
-
if (key === "default" || key === "__esModule") return;
|
|
230
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
231
|
-
if (key in exports && exports[key] === _DrawingProvider[key]) return;
|
|
232
|
-
Object.defineProperty(exports, key, {
|
|
233
|
-
enumerable: true,
|
|
234
|
-
get: function () {
|
|
235
|
-
return _DrawingProvider[key];
|
|
236
|
-
}
|
|
237
|
-
});
|
|
238
|
-
});
|
|
239
|
-
var _InteractionProvider = require("../context/InteractionProvider");
|
|
240
|
-
Object.keys(_InteractionProvider).forEach(function (key) {
|
|
203
|
+
var _DrawingAreaProvider = require("../context/DrawingAreaProvider");
|
|
204
|
+
Object.keys(_DrawingAreaProvider).forEach(function (key) {
|
|
241
205
|
if (key === "default" || key === "__esModule") return;
|
|
242
206
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
243
|
-
if (key in exports && exports[key] ===
|
|
207
|
+
if (key in exports && exports[key] === _DrawingAreaProvider[key]) return;
|
|
244
208
|
Object.defineProperty(exports, key, {
|
|
245
209
|
enumerable: true,
|
|
246
210
|
get: function () {
|
|
247
|
-
return
|
|
211
|
+
return _DrawingAreaProvider[key];
|
|
248
212
|
}
|
|
249
213
|
});
|
|
250
214
|
});
|
|
@@ -309,6 +273,30 @@ Object.keys(_ChartDataProvider).forEach(function (key) {
|
|
|
309
273
|
}
|
|
310
274
|
});
|
|
311
275
|
});
|
|
276
|
+
var _SizeProvider = require("../context/SizeProvider");
|
|
277
|
+
Object.keys(_SizeProvider).forEach(function (key) {
|
|
278
|
+
if (key === "default" || key === "__esModule") return;
|
|
279
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
280
|
+
if (key in exports && exports[key] === _SizeProvider[key]) return;
|
|
281
|
+
Object.defineProperty(exports, key, {
|
|
282
|
+
enumerable: true,
|
|
283
|
+
get: function () {
|
|
284
|
+
return _SizeProvider[key];
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
});
|
|
288
|
+
var _ChartProvider = require("../context/ChartProvider");
|
|
289
|
+
Object.keys(_ChartProvider).forEach(function (key) {
|
|
290
|
+
if (key === "default" || key === "__esModule") return;
|
|
291
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
292
|
+
if (key in exports && exports[key] === _ChartProvider[key]) return;
|
|
293
|
+
Object.defineProperty(exports, key, {
|
|
294
|
+
enumerable: true,
|
|
295
|
+
get: function () {
|
|
296
|
+
return _ChartProvider[key];
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
});
|
|
312
300
|
var _config = require("../models/seriesType/config");
|
|
313
301
|
Object.keys(_config).forEach(function (key) {
|
|
314
302
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ALL_PLUGINS = void 0;
|
|
7
|
+
var _useChartInteraction = require("./featurePlugins/useChartInteraction");
|
|
8
|
+
// This file should be removed after creating all plugins in favor of a file per chart type.
|
|
9
|
+
|
|
10
|
+
const ALL_PLUGINS = exports.ALL_PLUGINS = [_useChartInteraction.useChartInteraction];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.CHART_CORE_PLUGINS = void 0;
|
|
7
|
+
var _useChartId = require("./useChartId");
|
|
8
|
+
/**
|
|
9
|
+
* Internal plugins that create the tools used by the other plugins.
|
|
10
|
+
* These plugins are used by the Charts components.
|
|
11
|
+
*/
|
|
12
|
+
const CHART_CORE_PLUGINS = exports.CHART_CORE_PLUGINS = [_useChartId.useChartId];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "CHART_CORE_PLUGINS", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _corePlugins.CHART_CORE_PLUGINS;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _corePlugins = require("./corePlugins");
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "useChartId", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _useChartId.useChartId;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _useChartId = require("./useChartId");
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.useChartId = void 0;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var React = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _useChartId = require("./useChartId.utils");
|
|
12
|
+
const useChartId = ({
|
|
13
|
+
params,
|
|
14
|
+
store
|
|
15
|
+
}) => {
|
|
16
|
+
React.useEffect(() => {
|
|
17
|
+
store.update(prevState => {
|
|
18
|
+
if (params.id === prevState.id.providedChartId && prevState.id.chartId !== undefined) {
|
|
19
|
+
return prevState;
|
|
20
|
+
}
|
|
21
|
+
return (0, _extends2.default)({}, prevState, {
|
|
22
|
+
id: (0, _extends2.default)({}, prevState.id, {
|
|
23
|
+
chartId: params.id ?? (0, _useChartId.createChartDefaultId)()
|
|
24
|
+
})
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
}, [store, params.id]);
|
|
28
|
+
return {};
|
|
29
|
+
};
|
|
30
|
+
exports.useChartId = useChartId;
|
|
31
|
+
useChartId.params = {
|
|
32
|
+
id: true
|
|
33
|
+
};
|
|
34
|
+
useChartId.getInitialState = ({
|
|
35
|
+
id
|
|
36
|
+
}) => ({
|
|
37
|
+
id: {
|
|
38
|
+
chartId: (0, _useChartId.createChartDefaultId)(),
|
|
39
|
+
providedChartId: id
|
|
40
|
+
}
|
|
41
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.selectorChartId = void 0;
|
|
7
|
+
var _selectors = require("../../utils/selectors");
|
|
8
|
+
const selectorChartIdState = state => state.id;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Get the id attribute of the chart.
|
|
12
|
+
* @param {ChartState<[UseChartIdSignature]>} state The state of the chart.
|
|
13
|
+
* @returns {string} The id attribute of the chart.
|
|
14
|
+
*/
|
|
15
|
+
const selectorChartId = exports.selectorChartId = (0, _selectors.createSelector)(selectorChartIdState, idState => idState.chartId);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createChartDefaultId = void 0;
|
|
7
|
+
let globalChartDefaultId = 0;
|
|
8
|
+
const createChartDefaultId = () => {
|
|
9
|
+
globalChartDefaultId += 1;
|
|
10
|
+
return `mui-chart-${globalChartDefaultId}`;
|
|
11
|
+
};
|
|
12
|
+
exports.createChartDefaultId = createChartDefaultId;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
useChartInteraction: true
|
|
8
|
+
};
|
|
9
|
+
Object.defineProperty(exports, "useChartInteraction", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () {
|
|
12
|
+
return _useChartInteraction.useChartInteraction;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
var _useChartInteraction = require("./useChartInteraction");
|
|
16
|
+
var _useChartInteraction2 = require("./useChartInteraction.selectors");
|
|
17
|
+
Object.keys(_useChartInteraction2).forEach(function (key) {
|
|
18
|
+
if (key === "default" || key === "__esModule") return;
|
|
19
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
20
|
+
if (key in exports && exports[key] === _useChartInteraction2[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _useChartInteraction2[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.useChartInteraction = void 0;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _useEventCallback = _interopRequireDefault(require("@mui/utils/useEventCallback"));
|
|
10
|
+
const useChartInteraction = ({
|
|
11
|
+
store
|
|
12
|
+
}) => {
|
|
13
|
+
const cleanInteraction = (0, _useEventCallback.default)(() => {
|
|
14
|
+
store.update(prev => (0, _extends2.default)({}, prev, {
|
|
15
|
+
interaction: (0, _extends2.default)({}, prev.interaction, {
|
|
16
|
+
axis: {
|
|
17
|
+
x: null,
|
|
18
|
+
y: null
|
|
19
|
+
},
|
|
20
|
+
item: null
|
|
21
|
+
})
|
|
22
|
+
}));
|
|
23
|
+
});
|
|
24
|
+
const setItemInteraction = (0, _useEventCallback.default)(newItem => {
|
|
25
|
+
store.update(prev => (0, _extends2.default)({}, prev, {
|
|
26
|
+
interaction: (0, _extends2.default)({}, prev.interaction, {
|
|
27
|
+
item: newItem
|
|
28
|
+
})
|
|
29
|
+
}));
|
|
30
|
+
});
|
|
31
|
+
const setAxisInteraction = (0, _useEventCallback.default)(({
|
|
32
|
+
x: newStateX,
|
|
33
|
+
y: newStateY
|
|
34
|
+
}) => {
|
|
35
|
+
store.update(prev => (0, _extends2.default)({}, prev, {
|
|
36
|
+
interaction: (0, _extends2.default)({}, prev.interaction, {
|
|
37
|
+
axis: (0, _extends2.default)({}, prev.interaction.axis, prev.interaction.axis.x?.index !== newStateX?.index || prev.interaction.axis.x?.value !== newStateX?.value ? {
|
|
38
|
+
x: newStateX
|
|
39
|
+
} : {}, prev.interaction.axis.y?.index !== newStateY?.index || prev.interaction.axis.y?.value !== newStateY?.value ? {
|
|
40
|
+
y: newStateY
|
|
41
|
+
} : {})
|
|
42
|
+
})
|
|
43
|
+
}));
|
|
44
|
+
});
|
|
45
|
+
const enableVoronoid = (0, _useEventCallback.default)(() => {
|
|
46
|
+
store.update(prev => (0, _extends2.default)({}, prev, {
|
|
47
|
+
interaction: (0, _extends2.default)({}, prev.interaction, {
|
|
48
|
+
isVoronoiEnabled: true
|
|
49
|
+
})
|
|
50
|
+
}));
|
|
51
|
+
});
|
|
52
|
+
const disableVoronoid = (0, _useEventCallback.default)(() => {
|
|
53
|
+
store.update(prev => (0, _extends2.default)({}, prev, {
|
|
54
|
+
interaction: (0, _extends2.default)({}, prev.interaction, {
|
|
55
|
+
isVoronoiEnabled: false
|
|
56
|
+
})
|
|
57
|
+
}));
|
|
58
|
+
});
|
|
59
|
+
return {
|
|
60
|
+
params: {},
|
|
61
|
+
instance: {
|
|
62
|
+
cleanInteraction,
|
|
63
|
+
setItemInteraction,
|
|
64
|
+
setAxisInteraction,
|
|
65
|
+
enableVoronoid,
|
|
66
|
+
disableVoronoid
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
exports.useChartInteraction = useChartInteraction;
|
|
71
|
+
useChartInteraction.getInitialState = () => ({
|
|
72
|
+
interaction: {
|
|
73
|
+
item: null,
|
|
74
|
+
axis: {
|
|
75
|
+
x: null,
|
|
76
|
+
y: null
|
|
77
|
+
},
|
|
78
|
+
isVoronoiEnabled: false
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
useChartInteraction.params = {};
|
package/node/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.selectorChartsInteractionYAxisIsDefined = exports.selectorChartsInteractionYAxis = exports.selectorChartsInteractionXAxisIsDefined = exports.selectorChartsInteractionXAxis = exports.selectorChartsInteractionItemIsDefined = exports.selectorChartsInteractionItem = exports.selectorChartsInteractionIsVoronoiEnabled = exports.selectorChartsInteractionAxis = void 0;
|
|
7
|
+
var _selectors = require("../../utils/selectors");
|
|
8
|
+
const selectInteraction = state => state.interaction;
|
|
9
|
+
const selectorChartsInteractionItem = exports.selectorChartsInteractionItem = (0, _selectors.createSelector)(selectInteraction, interaction => interaction.item);
|
|
10
|
+
const selectorChartsInteractionAxis = exports.selectorChartsInteractionAxis = (0, _selectors.createSelector)(selectInteraction, interaction => interaction.axis);
|
|
11
|
+
const selectorChartsInteractionXAxis = exports.selectorChartsInteractionXAxis = (0, _selectors.createSelector)(selectInteraction, interaction => interaction.axis.x);
|
|
12
|
+
const selectorChartsInteractionYAxis = exports.selectorChartsInteractionYAxis = (0, _selectors.createSelector)(selectInteraction, interaction => interaction.axis.y);
|
|
13
|
+
const selectorChartsInteractionItemIsDefined = exports.selectorChartsInteractionItemIsDefined = (0, _selectors.createSelector)(selectorChartsInteractionItem, item => item !== null);
|
|
14
|
+
const selectorChartsInteractionXAxisIsDefined = exports.selectorChartsInteractionXAxisIsDefined = (0, _selectors.createSelector)(selectorChartsInteractionXAxis, x => x !== null);
|
|
15
|
+
const selectorChartsInteractionYAxisIsDefined = exports.selectorChartsInteractionYAxisIsDefined = (0, _selectors.createSelector)(selectorChartsInteractionYAxis, y => y !== null);
|
|
16
|
+
const selectorChartsInteractionIsVoronoiEnabled = exports.selectorChartsInteractionIsVoronoiEnabled = (0, _selectors.createSelector)(selectInteraction, interaction => interaction.isVoronoiEnabled);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _helpers = require("./helpers");
|
|
7
|
+
Object.keys(_helpers).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _helpers[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _helpers[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _plugin = require("./plugin");
|
|
18
|
+
Object.keys(_plugin).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _plugin[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _plugin[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
var _chart = require("./chart");
|
|
29
|
+
Object.keys(_chart).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _chart[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _chart[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ChartStore = void 0;
|
|
7
|
+
class ChartStore {
|
|
8
|
+
constructor(value) {
|
|
9
|
+
this.value = void 0;
|
|
10
|
+
this.listeners = void 0;
|
|
11
|
+
this.subscribe = fn => {
|
|
12
|
+
this.listeners.add(fn);
|
|
13
|
+
return () => {
|
|
14
|
+
this.listeners.delete(fn);
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
this.getSnapshot = () => {
|
|
18
|
+
return this.value;
|
|
19
|
+
};
|
|
20
|
+
this.update = updater => {
|
|
21
|
+
const newState = updater(this.value);
|
|
22
|
+
if (newState !== this.value) {
|
|
23
|
+
this.value = newState;
|
|
24
|
+
this.listeners.forEach(l => l(newState));
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
this.value = value;
|
|
28
|
+
this.listeners = new Set();
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.ChartStore = ChartStore;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createSelector = void 0;
|
|
7
|
+
var _reselect = require("reselect");
|
|
8
|
+
const reselectCreateSelector = (0, _reselect.createSelectorCreator)({
|
|
9
|
+
memoize: _reselect.lruMemoize,
|
|
10
|
+
memoizeOptions: {
|
|
11
|
+
maxSize: 1,
|
|
12
|
+
equalityCheck: Object.is
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
const cache = new WeakMap();
|
|
16
|
+
/**
|
|
17
|
+
* Method wrapping reselect's createSelector to provide caching for chart instances.
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
const createSelector = (...createSelectorArgs) => {
|
|
21
|
+
const selector = (state, selectorArgs) => {
|
|
22
|
+
const cacheKey = state.cacheKey;
|
|
23
|
+
|
|
24
|
+
// If there is no cache for the current chart instance, create one.
|
|
25
|
+
let cacheForCurrentChartInstance = cache.get(cacheKey);
|
|
26
|
+
if (!cacheForCurrentChartInstance) {
|
|
27
|
+
cacheForCurrentChartInstance = new Map();
|
|
28
|
+
cache.set(cacheKey, cacheForCurrentChartInstance);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// If there is a cached selector, execute it.
|
|
32
|
+
const cachedSelector = cacheForCurrentChartInstance.get(createSelectorArgs);
|
|
33
|
+
if (cachedSelector) {
|
|
34
|
+
return cachedSelector(state, selectorArgs);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Otherwise, create a new selector and cache it and execute it.
|
|
38
|
+
const fn = reselectCreateSelector(...createSelectorArgs);
|
|
39
|
+
cacheForCurrentChartInstance.set(createSelectorArgs, fn);
|
|
40
|
+
return fn(state, selectorArgs);
|
|
41
|
+
};
|
|
42
|
+
return selector;
|
|
43
|
+
};
|
|
44
|
+
exports.createSelector = createSelector;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.useChartApiInitialization = useChartApiInitialization;
|
|
8
|
+
exports.useCharts = useCharts;
|
|
9
|
+
var React = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _ChartStore = require("../plugins/utils/ChartStore");
|
|
11
|
+
var _corePlugins = require("../plugins/corePlugins");
|
|
12
|
+
function useChartApiInitialization(inputApiRef) {
|
|
13
|
+
const fallbackPublicApiRef = React.useRef({});
|
|
14
|
+
if (inputApiRef) {
|
|
15
|
+
if (inputApiRef.current == null) {
|
|
16
|
+
// eslint-disable-next-line react-compiler/react-compiler
|
|
17
|
+
inputApiRef.current = {};
|
|
18
|
+
}
|
|
19
|
+
return inputApiRef.current;
|
|
20
|
+
}
|
|
21
|
+
return fallbackPublicApiRef.current;
|
|
22
|
+
}
|
|
23
|
+
let globalId = 0;
|
|
24
|
+
function useCharts(inPlugins, props) {
|
|
25
|
+
const plugins = React.useMemo(() => [..._corePlugins.CHART_CORE_PLUGINS, ...inPlugins], [inPlugins]);
|
|
26
|
+
const pluginParams = {}; // To generate when plugins use params.
|
|
27
|
+
const instanceRef = React.useRef({});
|
|
28
|
+
const instance = instanceRef.current;
|
|
29
|
+
const publicAPI = useChartApiInitialization(props.apiRef);
|
|
30
|
+
const innerSvgRef = React.useRef(null);
|
|
31
|
+
const storeRef = React.useRef(null);
|
|
32
|
+
if (storeRef.current == null) {
|
|
33
|
+
// eslint-disable-next-line react-compiler/react-compiler
|
|
34
|
+
globalId += 1;
|
|
35
|
+
const initialState = {
|
|
36
|
+
// TODO remove when the interaction moves to plugin
|
|
37
|
+
interaction: {
|
|
38
|
+
item: null,
|
|
39
|
+
axis: {
|
|
40
|
+
x: null,
|
|
41
|
+
y: null
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
cacheKey: {
|
|
45
|
+
id: globalId
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
plugins.forEach(plugin => {
|
|
49
|
+
if (plugin.getInitialState) {
|
|
50
|
+
Object.assign(initialState, plugin.getInitialState({}));
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
storeRef.current = new _ChartStore.ChartStore(initialState);
|
|
54
|
+
}
|
|
55
|
+
const runPlugin = plugin => {
|
|
56
|
+
const pluginResponse = plugin({
|
|
57
|
+
instance,
|
|
58
|
+
params: pluginParams,
|
|
59
|
+
plugins: plugins,
|
|
60
|
+
store: storeRef.current,
|
|
61
|
+
svgRef: innerSvgRef
|
|
62
|
+
});
|
|
63
|
+
if (pluginResponse.publicAPI) {
|
|
64
|
+
Object.assign(publicAPI, pluginResponse.publicAPI);
|
|
65
|
+
}
|
|
66
|
+
if (pluginResponse.instance) {
|
|
67
|
+
Object.assign(instance, pluginResponse.instance);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
plugins.forEach(runPlugin);
|
|
71
|
+
const contextValue = React.useMemo(() => ({
|
|
72
|
+
store: storeRef.current,
|
|
73
|
+
publicAPI,
|
|
74
|
+
instance,
|
|
75
|
+
svgRef: innerSvgRef
|
|
76
|
+
}), [instance, publicAPI]);
|
|
77
|
+
return {
|
|
78
|
+
contextValue
|
|
79
|
+
};
|
|
80
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useSelector = void 0;
|
|
7
|
+
var _withSelector = require("use-sync-external-store/with-selector");
|
|
8
|
+
const defaultCompare = Object.is;
|
|
9
|
+
const useSelector = (store, selector, args = undefined, equals = defaultCompare) => {
|
|
10
|
+
const selectorWithArgs = state => selector(state, args);
|
|
11
|
+
return (0, _withSelector.useSyncExternalStoreWithSelector)(store.subscribe, store.getSnapshot, store.getSnapshot, selectorWithArgs, equals);
|
|
12
|
+
};
|
|
13
|
+
exports.useSelector = useSelector;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useStore = useStore;
|
|
7
|
+
var _ChartProvider = require("../../context/ChartProvider");
|
|
8
|
+
// This hook should be removed because user and us should not interact with the store directly, but with public/private APIs
|
|
9
|
+
function useStore(skipError) {
|
|
10
|
+
const context = (0, _ChartProvider.useChartContext)();
|
|
11
|
+
if (skipError) {
|
|
12
|
+
// TODO: Remove once store is used by all charts.
|
|
13
|
+
// This line is only for `useAxisEvents` which is in the surface of the Gauge.
|
|
14
|
+
// But the Gauge don't have store yet because it does not need the interaction provider.
|
|
15
|
+
// Will be fixed when every thing move to the store since every component will have access to it.
|
|
16
|
+
// @ts-ignore
|
|
17
|
+
return context?.store;
|
|
18
|
+
}
|
|
19
|
+
if (!context) {
|
|
20
|
+
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'));
|
|
21
|
+
}
|
|
22
|
+
return context.store;
|
|
23
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-charts",
|
|
3
|
-
"version": "8.0.0-alpha.
|
|
3
|
+
"version": "8.0.0-alpha.2",
|
|
4
4
|
"description": "The community edition of the Charts components (MUI X).",
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"main": "./node/index.js",
|
|
@@ -35,16 +35,18 @@
|
|
|
35
35
|
"@react-spring/web": "^9.7.5",
|
|
36
36
|
"clsx": "^2.1.1",
|
|
37
37
|
"prop-types": "^15.8.1",
|
|
38
|
-
"
|
|
39
|
-
"
|
|
38
|
+
"reselect": "^5.1.1",
|
|
39
|
+
"use-sync-external-store": "^1.2.2",
|
|
40
|
+
"@mui/x-internals": "8.0.0-alpha.2",
|
|
41
|
+
"@mui/x-charts-vendor": "8.0.0-alpha.1"
|
|
40
42
|
},
|
|
41
43
|
"peerDependencies": {
|
|
42
44
|
"@emotion/react": "^11.9.0",
|
|
43
45
|
"@emotion/styled": "^11.8.1",
|
|
44
46
|
"@mui/material": "^5.15.14 || ^6.0.0",
|
|
45
47
|
"@mui/system": "^5.15.14 || ^6.0.0",
|
|
46
|
-
"react": "^17.0.0 || ^18.0.0",
|
|
47
|
-
"react-dom": "^17.0.0 || ^18.0.0"
|
|
48
|
+
"react": "^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
49
|
+
"react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0"
|
|
48
50
|
},
|
|
49
51
|
"peerDependenciesMeta": {
|
|
50
52
|
"@emotion/react": {
|
|
@@ -8,14 +8,13 @@ import { LineChartProps } from '../LineChart/LineChart';
|
|
|
8
8
|
import { ScatterChartProps } from '../ScatterChart/ScatterChart';
|
|
9
9
|
import { PieChartProps } from '../PieChart/PieChart';
|
|
10
10
|
import { ChartsXAxisProps, ChartsYAxisProps } from '../models/axis';
|
|
11
|
-
import { ChartSeriesType } from '../models/seriesType/config';
|
|
12
11
|
|
|
13
12
|
export interface ChartsComponentsPropsList {
|
|
14
13
|
MuiChartsXAxis: ChartsXAxisProps;
|
|
15
14
|
MuiChartsYAxis: ChartsYAxisProps;
|
|
16
15
|
MuiChartsGrid: ChartsGridProps;
|
|
17
16
|
MuiChartsLegend: ChartsLegendProps;
|
|
18
|
-
MuiChartsTooltip: ChartsTooltipProps
|
|
17
|
+
MuiChartsTooltip: ChartsTooltipProps;
|
|
19
18
|
MuiChartsSurface: ChartsSurfaceProps;
|
|
20
19
|
|
|
21
20
|
// BarChart components
|