@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/hooks/useAxisEvents.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
4
|
import * as React from 'react';
|
|
4
|
-
import { InteractionContext } from "../context/InteractionProvider.js";
|
|
5
5
|
import { useCartesianContext } from "../context/CartesianProvider/index.js";
|
|
6
6
|
import { isBandScale } from "../internals/isBandScale.js";
|
|
7
7
|
import { getSVGPoint } from "../internals/getSVGPoint.js";
|
|
8
8
|
import { useSvgRef } from "./useSvgRef.js";
|
|
9
9
|
import { useDrawingArea } from "./useDrawingArea.js";
|
|
10
|
+
import { useStore } from "../internals/store/useStore.js";
|
|
10
11
|
function getAsANumber(value) {
|
|
11
12
|
return value instanceof Date ? value.getTime() : value;
|
|
12
13
|
}
|
|
@@ -19,9 +20,7 @@ export const useAxisEvents = disableAxisListener => {
|
|
|
19
20
|
xAxisIds,
|
|
20
21
|
yAxisIds
|
|
21
22
|
} = useCartesianContext();
|
|
22
|
-
const
|
|
23
|
-
dispatch
|
|
24
|
-
} = React.useContext(InteractionContext);
|
|
23
|
+
const store = useStore(disableAxisListener);
|
|
25
24
|
const usedXAxis = xAxisIds[0];
|
|
26
25
|
const usedYAxis = yAxisIds[0];
|
|
27
26
|
|
|
@@ -33,7 +32,7 @@ export const useAxisEvents = disableAxisListener => {
|
|
|
33
32
|
});
|
|
34
33
|
React.useEffect(() => {
|
|
35
34
|
const element = svgRef.current;
|
|
36
|
-
if (element === null || disableAxisListener) {
|
|
35
|
+
if (element === null || disableAxisListener || !store) {
|
|
37
36
|
return () => {};
|
|
38
37
|
}
|
|
39
38
|
function getNewAxisState(axisConfig, mouseValue) {
|
|
@@ -92,9 +91,15 @@ export const useAxisEvents = disableAxisListener => {
|
|
|
92
91
|
x: -1,
|
|
93
92
|
y: -1
|
|
94
93
|
};
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
94
|
+
store.update(prev => _extends({}, prev, {
|
|
95
|
+
interaction: {
|
|
96
|
+
item: null,
|
|
97
|
+
axis: {
|
|
98
|
+
x: null,
|
|
99
|
+
y: null
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}));
|
|
98
103
|
};
|
|
99
104
|
const handleMove = event => {
|
|
100
105
|
const target = 'targetTouches' in event ? event.targetTouches[0] : event;
|
|
@@ -105,9 +110,15 @@ export const useAxisEvents = disableAxisListener => {
|
|
|
105
110
|
targetElement: event.target
|
|
106
111
|
})) {
|
|
107
112
|
if (mousePosition.current.isInChart) {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
113
|
+
store.update(prev => _extends({}, prev, {
|
|
114
|
+
interaction: {
|
|
115
|
+
item: null,
|
|
116
|
+
axis: {
|
|
117
|
+
x: null,
|
|
118
|
+
y: null
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}));
|
|
111
122
|
mousePosition.current.isInChart = false;
|
|
112
123
|
}
|
|
113
124
|
return;
|
|
@@ -115,13 +126,15 @@ export const useAxisEvents = disableAxisListener => {
|
|
|
115
126
|
mousePosition.current.isInChart = true;
|
|
116
127
|
const newStateX = getNewAxisState(xAxis[usedXAxis], svgPoint.x);
|
|
117
128
|
const newStateY = getNewAxisState(yAxis[usedYAxis], svgPoint.y);
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
129
|
+
store.update(prev => _extends({}, prev, {
|
|
130
|
+
interaction: _extends({}, prev.interaction, {
|
|
131
|
+
axis: _extends({}, prev.interaction.axis, prev.interaction.axis.x?.index !== newStateX?.index || prev.interaction.axis.x?.value !== newStateX?.value ? {
|
|
132
|
+
x: newStateX
|
|
133
|
+
} : {}, prev.interaction.axis.y?.index !== newStateY?.index || prev.interaction.axis.y?.value !== newStateY?.value ? {
|
|
134
|
+
y: newStateY
|
|
135
|
+
} : {})
|
|
136
|
+
})
|
|
137
|
+
}));
|
|
125
138
|
};
|
|
126
139
|
const handleDown = event => {
|
|
127
140
|
const target = event.currentTarget;
|
|
@@ -144,5 +157,5 @@ export const useAxisEvents = disableAxisListener => {
|
|
|
144
157
|
element.removeEventListener('pointercancel', handleOut);
|
|
145
158
|
element.removeEventListener('pointerleave', handleOut);
|
|
146
159
|
};
|
|
147
|
-
}, [svgRef,
|
|
160
|
+
}, [svgRef, store, usedYAxis, yAxis, usedXAxis, xAxis, disableAxisListener, drawingArea]);
|
|
148
161
|
};
|
package/hooks/useChartId.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
3
|
+
import { useStore } from "../internals/store/useStore.js";
|
|
4
|
+
import { useSelector } from "../internals/store/useSelector.js";
|
|
5
|
+
import { selectorChartId } from "../internals/plugins/corePlugins/useChartId/useChartId.selectors.js";
|
|
5
6
|
export function useChartId() {
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
} = React.useContext(DrawingContext);
|
|
9
|
-
return React.useMemo(() => chartId, [chartId]);
|
|
7
|
+
const store = useStore();
|
|
8
|
+
return useSelector(store, selectorChartId);
|
|
10
9
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function useDrawingArea():
|
|
1
|
+
import { DrawingAreaState } from '../context/DrawingAreaProvider';
|
|
2
|
+
export declare function useDrawingArea(): DrawingAreaState;
|
package/hooks/useDrawingArea.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { DrawingAreaContext } from "../context/DrawingAreaProvider/index.js";
|
|
5
5
|
export function useDrawingArea() {
|
|
6
6
|
const {
|
|
7
7
|
left,
|
|
@@ -11,7 +11,7 @@ export function useDrawingArea() {
|
|
|
11
11
|
bottom,
|
|
12
12
|
right,
|
|
13
13
|
isPointInside
|
|
14
|
-
} = React.useContext(
|
|
14
|
+
} = React.useContext(DrawingAreaContext);
|
|
15
15
|
return React.useMemo(() => ({
|
|
16
16
|
left,
|
|
17
17
|
top,
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import { InteractionContext } from "../context/InteractionProvider.js";
|
|
3
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
5
4
|
import { useHighlighted } from "../context/index.js";
|
|
5
|
+
import { useStore } from "../internals/store/useStore.js";
|
|
6
6
|
export const useInteractionItemProps = skip => {
|
|
7
|
-
const
|
|
8
|
-
dispatch: dispatchInteraction
|
|
9
|
-
} = React.useContext(InteractionContext);
|
|
7
|
+
const store = useStore();
|
|
10
8
|
const {
|
|
11
9
|
setHighlighted,
|
|
12
10
|
clearHighlighted
|
|
@@ -21,20 +19,31 @@ export const useInteractionItemProps = skip => {
|
|
|
21
19
|
}
|
|
22
20
|
};
|
|
23
21
|
const onPointerEnter = () => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
store.update(prev => _extends({}, prev, {
|
|
23
|
+
interaction: _extends({}, prev.interaction, {
|
|
24
|
+
item: data
|
|
25
|
+
})
|
|
26
|
+
}));
|
|
28
27
|
setHighlighted({
|
|
29
28
|
seriesId: data.seriesId,
|
|
30
29
|
dataIndex: data.dataIndex
|
|
31
30
|
});
|
|
32
31
|
};
|
|
33
32
|
const onPointerLeave = event => {
|
|
34
|
-
event.currentTarget.
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
if (event.currentTarget.hasPointerCapture(event.pointerId)) {
|
|
34
|
+
event.currentTarget.releasePointerCapture(event.pointerId);
|
|
35
|
+
}
|
|
36
|
+
store.update(prev => {
|
|
37
|
+
const prevItem = prev.interaction.item;
|
|
38
|
+
if (prevItem === null || Object.keys(data).some(key => data[key] !== prevItem[key])) {
|
|
39
|
+
// The item is already something else, no need to clean it.
|
|
40
|
+
return prev;
|
|
41
|
+
}
|
|
42
|
+
return _extends({}, prev, {
|
|
43
|
+
interaction: _extends({}, prev.interaction, {
|
|
44
|
+
item: null
|
|
45
|
+
})
|
|
46
|
+
});
|
|
38
47
|
});
|
|
39
48
|
clearHighlighted();
|
|
40
49
|
};
|
package/hooks/useSvgRef.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
export declare function useSvgRef(): React.
|
|
2
|
+
export declare function useSvgRef(): React.RefObject<SVGSVGElement>;
|
package/hooks/useSvgRef.js
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import { SvgContext } from "../context/DrawingProvider.js";
|
|
3
|
+
import { useChartContext } from "../context/ChartProvider/index.js";
|
|
5
4
|
export function useSvgRef() {
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
data
|
|
9
|
-
} = React.useContext(SvgContext);
|
|
10
|
-
if (!isInitialized) {
|
|
5
|
+
const context = useChartContext();
|
|
6
|
+
if (!context) {
|
|
11
7
|
throw new Error(['MUI X: Could not find the svg ref context.', 'It looks like you rendered your component outside of a ChartsContainer parent component.'].join('\n'));
|
|
12
8
|
}
|
|
13
|
-
return
|
|
9
|
+
return context.svgRef;
|
|
14
10
|
}
|
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { AxisId } from '../../../models/axis';
|
|
3
3
|
export declare function useChartGradient(): (axisId: AxisId, direction: "x" | "y") => string;
|
|
4
|
-
export declare function ChartsAxesGradients(): React.JSX.Element;
|
|
4
|
+
export declare function ChartsAxesGradients(): React.JSX.Element | null;
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useCartesianContext } from "../../../context/CartesianProvider/index.js";
|
|
3
|
-
import {
|
|
4
|
-
import { useDrawingArea } from "../../../hooks/index.js";
|
|
3
|
+
import { useChartId, useDrawingArea } from "../../../hooks/index.js";
|
|
5
4
|
import ChartsPiecewiseGradient from "./ChartsPiecewiseGradient.js";
|
|
6
5
|
import ChartsContinuousGradient from "./ChartsContinuousGradient.js";
|
|
7
6
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
7
|
export function useChartGradient() {
|
|
9
|
-
const
|
|
10
|
-
chartId
|
|
11
|
-
} = React.useContext(DrawingContext);
|
|
8
|
+
const chartId = useChartId();
|
|
12
9
|
return React.useCallback((axisId, direction) => `${chartId}-gradient-${direction}-${axisId}`, [chartId]);
|
|
13
10
|
}
|
|
14
11
|
export function ChartsAxesGradients() {
|
|
@@ -29,8 +26,13 @@ export function ChartsAxesGradients() {
|
|
|
29
26
|
yAxisIds,
|
|
30
27
|
yAxis
|
|
31
28
|
} = useCartesianContext();
|
|
29
|
+
const filteredYAxisIds = yAxisIds.filter(axisId => yAxis[axisId].colorMap !== undefined);
|
|
30
|
+
const filteredXAxisIds = xAxisIds.filter(axisId => xAxis[axisId].colorMap !== undefined);
|
|
31
|
+
if (filteredYAxisIds.length === 0 && filteredXAxisIds.length === 0) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
32
34
|
return /*#__PURE__*/_jsxs("defs", {
|
|
33
|
-
children: [
|
|
35
|
+
children: [filteredYAxisIds.map(axisId => {
|
|
34
36
|
const gradientId = getGradientId(axisId, 'y');
|
|
35
37
|
const {
|
|
36
38
|
colorMap,
|
|
@@ -60,7 +62,7 @@ export function ChartsAxesGradients() {
|
|
|
60
62
|
}, gradientId);
|
|
61
63
|
}
|
|
62
64
|
return null;
|
|
63
|
-
}),
|
|
65
|
+
}), filteredXAxisIds.map(axisId => {
|
|
64
66
|
const gradientId = getGradientId(axisId, 'x');
|
|
65
67
|
const {
|
|
66
68
|
colorMap,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AxisConfig, ScaleName } from '../models';
|
|
2
2
|
import { ChartsXAxisProps, ChartsAxisProps, ChartsYAxisProps, ChartsRadiusAxisProps, ChartsRotationAxisProps } from '../models/axis';
|
|
3
3
|
import { CartesianChartSeriesType } from '../models/seriesType/config';
|
|
4
|
-
import {
|
|
4
|
+
import { DrawingAreaState } from '../context/DrawingAreaProvider';
|
|
5
5
|
import { FormattedSeries } from '../context/SeriesProvider';
|
|
6
6
|
import { ExtremumGetter } from '../context/PluginProvider';
|
|
7
7
|
import { DefaultizedAxisConfig, ZoomData, ZoomOptions, GetZoomAxisFilters } from '../context/CartesianProvider/Cartesian.types';
|
|
@@ -10,7 +10,7 @@ type ComputeResult<T extends ChartsAxisProps> = {
|
|
|
10
10
|
axisIds: string[];
|
|
11
11
|
};
|
|
12
12
|
type ComputeCommonParams = {
|
|
13
|
-
drawingArea:
|
|
13
|
+
drawingArea: DrawingAreaState;
|
|
14
14
|
formattedSeries: FormattedSeries;
|
|
15
15
|
extremumGetters: {
|
|
16
16
|
[K in CartesianChartSeriesType]?: ExtremumGetter<K>;
|
|
@@ -2,7 +2,7 @@ import { AllSeriesType } from '../models/seriesType';
|
|
|
2
2
|
export declare function defaultizeColor(series: AllSeriesType, seriesIndex: number, colors?: string[]): {
|
|
3
3
|
data: {
|
|
4
4
|
color: string;
|
|
5
|
-
label?:
|
|
5
|
+
label?: string | ((location: "tooltip" | "legend" | "arc") => string) | undefined;
|
|
6
6
|
value: number;
|
|
7
7
|
id?: import("..").PieItemId | undefined;
|
|
8
8
|
}[];
|
package/internals/index.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
export * from './components/ChartsAxesGradients';
|
|
2
|
-
export * from '../ChartContainer/useChartContainerDimensions';
|
|
3
|
-
export * from '../ChartContainer/ResizableContainer';
|
|
4
2
|
export { useSeries } from '../hooks/useSeries';
|
|
5
3
|
export { useInteractionItemProps } from '../hooks/useInteractionItemProps';
|
|
6
4
|
export { useDrawingArea } from '../hooks/useDrawingArea';
|
|
@@ -18,8 +16,7 @@ export { unstable_cleanupDOM } from './domUtils';
|
|
|
18
16
|
export * from './getScale';
|
|
19
17
|
export * from './computeAxisValue';
|
|
20
18
|
export * from '../context/CartesianProvider';
|
|
21
|
-
export * from '../context/
|
|
22
|
-
export * from '../context/InteractionProvider';
|
|
19
|
+
export * from '../context/DrawingAreaProvider';
|
|
23
20
|
export * from '../context/SeriesProvider';
|
|
24
21
|
export * from '../context/ZAxisContextProvider';
|
|
25
22
|
export * from '../context/PluginProvider';
|
|
@@ -27,6 +24,8 @@ export * from '../context/AnimationProvider';
|
|
|
27
24
|
export type * from '../context/context.types';
|
|
28
25
|
export { getAxisExtremum } from '../context/CartesianProvider/getAxisExtremum';
|
|
29
26
|
export * from '../context/ChartDataProvider';
|
|
27
|
+
export * from '../context/SizeProvider';
|
|
28
|
+
export * from '../context/ChartProvider';
|
|
30
29
|
export * from '../models/seriesType/config';
|
|
31
30
|
export * from '../models/seriesType/common';
|
|
32
31
|
export * from '../models/z-axis';
|
package/internals/index.js
CHANGED
|
@@ -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 declare const ALL_PLUGINS: readonly [import("./models").ChartPlugin<import("./featurePlugins/useChartInteraction").UseChartInteractionSignature>];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ConvertPluginsIntoSignatures } from '../models/helpers';
|
|
2
|
+
import { UseChartIdParameters } from './useChartId';
|
|
3
|
+
/**
|
|
4
|
+
* Internal plugins that create the tools used by the other plugins.
|
|
5
|
+
* These plugins are used by the Charts components.
|
|
6
|
+
*/
|
|
7
|
+
export declare const CHART_CORE_PLUGINS: readonly [import("../models").ChartPlugin<import("./useChartId").UseChartIdSignature>];
|
|
8
|
+
export type ChartCorePluginSignatures = ConvertPluginsIntoSignatures<typeof CHART_CORE_PLUGINS>;
|
|
9
|
+
export interface ChartCorePluginParameters extends UseChartIdParameters {
|
|
10
|
+
}
|
|
@@ -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,36 @@
|
|
|
1
|
+
import { ChartRootSelector } from '../../utils/selectors';
|
|
2
|
+
import { UseChartIdSignature } from './useChartId.types';
|
|
3
|
+
/**
|
|
4
|
+
* Get the id attribute of the chart.
|
|
5
|
+
* @param {ChartState<[UseChartIdSignature]>} state The state of the chart.
|
|
6
|
+
* @returns {string} The id attribute of the chart.
|
|
7
|
+
*/
|
|
8
|
+
export declare const selectorChartId: ((state: import("./useChartId.types").UseChartIdState & Partial<{}> & {
|
|
9
|
+
cacheKey: import("../../models").ChartStateCacheKey;
|
|
10
|
+
}) => string) & {
|
|
11
|
+
clearCache: () => void;
|
|
12
|
+
resultsCount: () => number;
|
|
13
|
+
resetResultsCount: () => void;
|
|
14
|
+
} & {
|
|
15
|
+
resultFunc: (resultFuncArgs_0: {
|
|
16
|
+
chartId: string;
|
|
17
|
+
providedChartId: string | undefined;
|
|
18
|
+
}) => string;
|
|
19
|
+
memoizedResultFunc: ((resultFuncArgs_0: {
|
|
20
|
+
chartId: string;
|
|
21
|
+
providedChartId: string | undefined;
|
|
22
|
+
}) => string) & {
|
|
23
|
+
clearCache: () => void;
|
|
24
|
+
resultsCount: () => number;
|
|
25
|
+
resetResultsCount: () => void;
|
|
26
|
+
};
|
|
27
|
+
lastResult: () => string;
|
|
28
|
+
dependencies: [ChartRootSelector<UseChartIdSignature>];
|
|
29
|
+
recomputations: () => number;
|
|
30
|
+
resetRecomputations: () => void;
|
|
31
|
+
dependencyRecomputations: () => number;
|
|
32
|
+
resetDependencyRecomputations: () => void;
|
|
33
|
+
} & {
|
|
34
|
+
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
35
|
+
memoize: typeof import("reselect").weakMapMemoize;
|
|
36
|
+
};
|
|
@@ -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,20 @@
|
|
|
1
|
+
import { ChartPluginSignature } from '../../models';
|
|
2
|
+
export interface UseChartIdParameters {
|
|
3
|
+
/**
|
|
4
|
+
* This prop is used to help implement the accessibility logic.
|
|
5
|
+
* If you don't provide this prop. It falls back to a randomly generated id.
|
|
6
|
+
*/
|
|
7
|
+
id?: string;
|
|
8
|
+
}
|
|
9
|
+
export type UseChartIdDefaultizedParameters = UseChartIdParameters;
|
|
10
|
+
export interface UseChartIdState {
|
|
11
|
+
id: {
|
|
12
|
+
chartId: string;
|
|
13
|
+
providedChartId: string | undefined;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export type UseChartIdSignature = ChartPluginSignature<{
|
|
17
|
+
params: UseChartIdParameters;
|
|
18
|
+
defaultizedParams: UseChartIdDefaultizedParameters;
|
|
19
|
+
state: UseChartIdState;
|
|
20
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const createChartDefaultId: () => string;
|
|
@@ -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 = {};
|