@mui/x-charts 8.0.0-alpha.0 → 8.0.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BarChart/AnimatedBarElement.d.ts +15 -0
- package/BarChart/AnimatedBarElement.js +21 -0
- package/BarChart/BarChart.d.ts +4 -9
- package/BarChart/BarChart.js +3 -35
- package/BarChart/BarElement.d.ts +5 -1342
- package/BarChart/BarElement.js +10 -20
- package/BarChart/BarLabel/BarLabel.d.ts +298 -298
- package/BarChart/BarPlot.js +12 -2
- package/BarChart/useBarChartProps.d.ts +0 -2
- package/BarChart/useBarChartProps.js +2 -8
- package/CHANGELOG.md +651 -6
- package/ChartContainer/ChartContainer.d.ts +26 -19
- package/ChartContainer/ChartContainer.js +31 -25
- package/ChartContainer/useChartContainerProps.d.ts +5 -7
- package/ChartContainer/useChartContainerProps.js +12 -27
- package/ChartsAxis/axisClasses.js +2 -1
- package/ChartsAxisHighlight/ChartsAxisHighlight.d.ts +1 -17
- package/ChartsAxisHighlight/ChartsAxisHighlight.js +10 -96
- package/ChartsAxisHighlight/ChartsAxisHighlight.types.d.ts +5 -0
- package/ChartsAxisHighlight/ChartsAxisHighlight.types.js +1 -0
- package/ChartsAxisHighlight/ChartsAxisHighlightPath.d.ts +6 -0
- package/ChartsAxisHighlight/ChartsAxisHighlightPath.js +34 -0
- package/ChartsAxisHighlight/ChartsXAxisHighlight.d.ts +10 -0
- package/ChartsAxisHighlight/ChartsXAxisHighlight.js +53 -0
- package/ChartsAxisHighlight/ChartsYAxisHighlight.d.ts +10 -0
- package/ChartsAxisHighlight/ChartsYAxisHighlight.js +53 -0
- package/ChartsAxisHighlight/chartsAxisHighlightClasses.d.ts +7 -0
- package/ChartsAxisHighlight/chartsAxisHighlightClasses.js +6 -0
- package/ChartsAxisHighlight/index.d.ts +3 -0
- package/ChartsAxisHighlight/index.js +4 -1
- package/ChartsGrid/ChartsGrid.js +1 -1
- package/ChartsGrid/ChartsHorizontalGrid.d.ts +2 -2
- package/ChartsGrid/ChartsHorizontalGrid.js +3 -3
- package/ChartsGrid/ChartsVerticalGrid.d.ts +2 -2
- package/ChartsGrid/ChartsVerticalGrid.js +3 -3
- package/ChartsLegend/LegendPerItem.d.ts +2 -2
- package/ChartsLegend/chartsLegendClasses.js +2 -1
- package/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +9 -7
- package/ChartsSurface/ChartsSurface.d.ts +14 -15
- package/ChartsSurface/ChartsSurface.js +68 -35
- package/ChartsTooltip/ChartTooltip.types.d.ts +15 -0
- package/ChartsTooltip/ChartTooltip.types.js +1 -0
- package/ChartsTooltip/ChartsAxisTooltipContent.d.ts +7 -39
- package/ChartsTooltip/ChartsAxisTooltipContent.js +83 -72
- package/ChartsTooltip/ChartsItemTooltipContent.d.ts +5 -28
- package/ChartsTooltip/ChartsItemTooltipContent.js +54 -44
- package/ChartsTooltip/ChartsTooltip.d.ts +3 -69
- package/ChartsTooltip/ChartsTooltip.js +143 -145
- package/ChartsTooltip/ChartsTooltipContainer.d.ts +33 -0
- package/ChartsTooltip/ChartsTooltipContainer.js +280 -0
- package/ChartsTooltip/ChartsTooltipTable.js +1 -1
- package/ChartsTooltip/chartsTooltipClasses.d.ts +1 -0
- package/ChartsTooltip/chartsTooltipClasses.js +18 -2
- package/ChartsTooltip/index.d.ts +3 -3
- package/ChartsTooltip/index.js +2 -3
- package/ChartsTooltip/useAxisTooltip.d.ts +2 -2
- package/ChartsTooltip/useAxisTooltip.js +19 -19
- package/ChartsTooltip/useItemTooltip.d.ts +2 -3
- package/ChartsTooltip/useItemTooltip.js +5 -4
- package/ChartsTooltip/utils.d.ts +0 -3
- package/ChartsTooltip/utils.js +0 -8
- package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +49 -36
- package/ChartsXAxis/ChartsXAxis.js +3 -17
- package/ChartsYAxis/ChartsYAxis.js +2 -17
- package/Gauge/Gauge.d.ts +1 -1
- package/Gauge/Gauge.js +0 -6
- package/Gauge/GaugeContainer.d.ts +3 -3
- package/Gauge/GaugeContainer.js +42 -76
- package/LineChart/AnimatedArea.d.ts +0 -1333
- package/LineChart/AnimatedArea.js +9 -18
- package/LineChart/AnimatedLine.d.ts +0 -1333
- package/LineChart/AnimatedLine.js +9 -20
- package/LineChart/AreaPlot.js +12 -2
- package/LineChart/CircleMarkElement.js +6 -5
- package/LineChart/LineChart.d.ts +4 -10
- package/LineChart/LineChart.js +3 -36
- package/LineChart/LineHighlightPlot.js +6 -5
- package/LineChart/LinePlot.js +12 -2
- package/LineChart/MarkElement.js +6 -5
- package/LineChart/useLineChartProps.d.ts +0 -2
- package/LineChart/useLineChartProps.js +2 -8
- package/PieChart/PieChart.d.ts +3 -9
- package/PieChart/PieChart.js +5 -41
- package/PieChart/PiePlot.js +2 -2
- package/PieChart/getPieCoordinates.d.ts +2 -2
- package/README.md +2 -2
- package/ScatterChart/Scatter.js +6 -5
- package/ScatterChart/ScatterChart.d.ts +4 -10
- package/ScatterChart/ScatterChart.js +5 -36
- package/ScatterChart/useScatterChartProps.d.ts +0 -2
- package/ScatterChart/useScatterChartProps.js +1 -9
- package/SparkLineChart/SparkLineChart.d.ts +3 -4
- package/SparkLineChart/SparkLineChart.js +4 -35
- package/context/CartesianProvider/defaultizeAxis.d.ts +9 -11
- package/context/ChartDataProvider/ChartDataProvider.d.ts +36 -19
- package/context/ChartDataProvider/ChartDataProvider.js +55 -48
- package/context/ChartDataProvider/useChartDataProviderProps.d.ts +25 -32
- package/context/ChartDataProvider/useChartDataProviderProps.js +22 -42
- package/context/ChartDataProvider/useDefaultizeAxis.d.ts +9 -11
- package/context/ChartProvider/ChartContext.d.ts +6 -0
- package/context/ChartProvider/ChartContext.js +8 -0
- package/context/ChartProvider/ChartProvider.d.ts +4 -0
- package/context/ChartProvider/ChartProvider.js +19 -0
- package/context/ChartProvider/ChartProvider.types.d.ts +24 -0
- package/context/ChartProvider/ChartProvider.types.js +1 -0
- package/context/ChartProvider/index.d.ts +3 -0
- package/context/ChartProvider/index.js +3 -0
- package/context/ChartProvider/useChartContext.d.ts +3 -0
- package/context/ChartProvider/useChartContext.js +11 -0
- package/context/{DrawingProvider.d.ts → DrawingAreaProvider/DrawingArea.types.d.ts} +3 -14
- package/context/DrawingAreaProvider/DrawingArea.types.js +1 -0
- package/context/DrawingAreaProvider/DrawingAreaContext.d.ts +3 -0
- package/context/DrawingAreaProvider/DrawingAreaContext.js +15 -0
- package/context/DrawingAreaProvider/DrawingAreaProvider.d.ts +3 -0
- package/{modern/context/DrawingProvider.js → context/DrawingAreaProvider/DrawingAreaProvider.js} +11 -41
- package/context/DrawingAreaProvider/index.d.ts +3 -0
- package/context/DrawingAreaProvider/index.js +3 -0
- package/context/InteractionSelectors.d.ts +382 -0
- package/context/InteractionSelectors.js +12 -0
- package/context/SizeProvider/Size.types.d.ts +30 -0
- package/context/SizeProvider/Size.types.js +1 -0
- package/context/SizeProvider/SizeContext.d.ts +4 -0
- package/context/SizeProvider/SizeContext.js +15 -0
- package/context/SizeProvider/SizeProvider.d.ts +11 -0
- package/context/SizeProvider/SizeProvider.js +26 -0
- package/context/SizeProvider/index.d.ts +4 -0
- package/context/SizeProvider/index.js +4 -0
- package/context/SizeProvider/useChartContainerDimensions.d.ts +9 -0
- package/{modern/ChartContainer → context/SizeProvider}/useChartContainerDimensions.js +16 -6
- package/context/SizeProvider/useSize.d.ts +5 -0
- package/context/SizeProvider/useSize.js +13 -0
- package/context/index.d.ts +2 -0
- package/context/index.js +2 -1
- package/hooks/useAxisEvents.js +32 -19
- package/hooks/useChartId.js +5 -6
- package/hooks/useDrawingArea.d.ts +2 -2
- package/hooks/useDrawingArea.js +2 -2
- package/hooks/useInteractionItemProps.js +22 -13
- package/hooks/useSvgRef.d.ts +1 -1
- package/hooks/useSvgRef.js +4 -8
- package/index.js +1 -1
- package/internals/components/ChartsAxesGradients/ChartsAxesGradients.d.ts +1 -1
- package/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +9 -7
- package/internals/computeAxisValue.d.ts +2 -2
- package/internals/defaultizeColor.d.ts +1 -1
- package/internals/index.d.ts +3 -4
- package/internals/index.js +3 -4
- package/internals/plugins/allPlugins.d.ts +1 -0
- package/internals/plugins/allPlugins.js +3 -0
- package/internals/plugins/corePlugins/corePlugins.d.ts +10 -0
- package/internals/plugins/corePlugins/corePlugins.js +7 -0
- package/internals/plugins/corePlugins/index.d.ts +2 -0
- package/internals/plugins/corePlugins/index.js +1 -0
- package/internals/plugins/corePlugins/useChartId/index.d.ts +2 -0
- package/internals/plugins/corePlugins/useChartId/index.js +1 -0
- package/internals/plugins/corePlugins/useChartId/useChartId.d.ts +3 -0
- package/internals/plugins/corePlugins/useChartId/useChartId.js +32 -0
- package/internals/plugins/corePlugins/useChartId/useChartId.selectors.d.ts +36 -0
- package/internals/plugins/corePlugins/useChartId/useChartId.selectors.js +9 -0
- package/internals/plugins/corePlugins/useChartId/useChartId.types.d.ts +20 -0
- package/internals/plugins/corePlugins/useChartId/useChartId.types.js +1 -0
- package/internals/plugins/corePlugins/useChartId/useChartId.utils.d.ts +1 -0
- package/internals/plugins/corePlugins/useChartId/useChartId.utils.js +5 -0
- package/internals/plugins/featurePlugins/useChartInteraction/index.d.ts +3 -0
- package/internals/plugins/featurePlugins/useChartInteraction/index.js +2 -0
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.d.ts +3 -0
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +73 -0
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.d.ts +376 -0
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.js +10 -0
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.types.d.ts +57 -0
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.types.js +1 -0
- package/internals/plugins/models/chart.d.ts +14 -0
- package/internals/plugins/models/chart.js +1 -0
- package/internals/plugins/models/helpers.d.ts +7 -0
- package/internals/plugins/models/helpers.js +1 -0
- package/internals/plugins/models/index.d.ts +3 -0
- package/internals/plugins/models/index.js +3 -0
- package/internals/plugins/models/plugin.d.ts +75 -0
- package/internals/plugins/models/plugin.js +1 -0
- package/internals/plugins/utils/ChartStore.d.ts +13 -0
- package/internals/plugins/utils/ChartStore.js +24 -0
- package/internals/plugins/utils/selectors.d.ts +9 -0
- package/internals/plugins/utils/selectors.js +37 -0
- package/internals/store/useCharts.d.ts +14 -0
- package/internals/store/useCharts.js +72 -0
- package/internals/store/useCharts.types.d.ts +5 -0
- package/internals/store/useCharts.types.js +1 -0
- package/internals/store/useSelector.d.ts +4 -0
- package/internals/store/useSelector.js +6 -0
- package/internals/store/useStore.d.ts +3 -0
- package/internals/store/useStore.js +17 -0
- package/models/axis.d.ts +1 -13
- package/modern/BarChart/AnimatedBarElement.js +21 -0
- package/modern/BarChart/BarChart.js +3 -35
- package/modern/BarChart/BarElement.js +10 -20
- package/modern/BarChart/BarPlot.js +12 -2
- package/modern/BarChart/useBarChartProps.js +2 -8
- package/modern/ChartContainer/ChartContainer.js +31 -25
- package/modern/ChartContainer/useChartContainerProps.js +12 -27
- package/modern/ChartsAxis/axisClasses.js +2 -1
- package/modern/ChartsAxisHighlight/ChartsAxisHighlight.js +10 -96
- package/modern/ChartsAxisHighlight/ChartsAxisHighlight.types.js +1 -0
- package/modern/ChartsAxisHighlight/ChartsAxisHighlightPath.js +34 -0
- package/modern/ChartsAxisHighlight/ChartsXAxisHighlight.js +53 -0
- package/modern/ChartsAxisHighlight/ChartsYAxisHighlight.js +53 -0
- package/modern/ChartsAxisHighlight/chartsAxisHighlightClasses.js +6 -0
- package/modern/ChartsAxisHighlight/index.js +4 -1
- package/modern/ChartsGrid/ChartsGrid.js +1 -1
- package/modern/ChartsGrid/ChartsHorizontalGrid.js +3 -3
- package/modern/ChartsGrid/ChartsVerticalGrid.js +3 -3
- package/modern/ChartsLegend/chartsLegendClasses.js +2 -1
- package/modern/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +9 -7
- package/modern/ChartsSurface/ChartsSurface.js +68 -35
- package/modern/ChartsTooltip/ChartTooltip.types.js +1 -0
- package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +83 -72
- package/modern/ChartsTooltip/ChartsItemTooltipContent.js +54 -44
- package/modern/ChartsTooltip/ChartsTooltip.js +143 -145
- package/modern/ChartsTooltip/ChartsTooltipContainer.js +280 -0
- package/modern/ChartsTooltip/ChartsTooltipTable.js +1 -1
- package/modern/ChartsTooltip/chartsTooltipClasses.js +18 -2
- package/modern/ChartsTooltip/index.js +2 -3
- package/modern/ChartsTooltip/useAxisTooltip.js +19 -19
- package/modern/ChartsTooltip/useItemTooltip.js +5 -4
- package/modern/ChartsTooltip/utils.js +0 -8
- package/modern/ChartsVoronoiHandler/ChartsVoronoiHandler.js +49 -36
- package/modern/ChartsXAxis/ChartsXAxis.js +3 -17
- package/modern/ChartsYAxis/ChartsYAxis.js +2 -17
- package/modern/Gauge/Gauge.js +0 -6
- package/modern/Gauge/GaugeContainer.js +42 -76
- package/modern/LineChart/AnimatedArea.js +9 -18
- package/modern/LineChart/AnimatedLine.js +9 -20
- package/modern/LineChart/AreaPlot.js +12 -2
- package/modern/LineChart/CircleMarkElement.js +6 -5
- package/modern/LineChart/LineChart.js +3 -36
- package/modern/LineChart/LineHighlightPlot.js +6 -5
- package/modern/LineChart/LinePlot.js +12 -2
- package/modern/LineChart/MarkElement.js +6 -5
- package/modern/LineChart/useLineChartProps.js +2 -8
- package/modern/PieChart/PieChart.js +5 -41
- package/modern/PieChart/PiePlot.js +2 -2
- package/modern/ScatterChart/Scatter.js +6 -5
- package/modern/ScatterChart/ScatterChart.js +5 -36
- package/modern/ScatterChart/useScatterChartProps.js +1 -9
- package/modern/SparkLineChart/SparkLineChart.js +4 -35
- package/modern/context/ChartDataProvider/ChartDataProvider.js +55 -48
- package/modern/context/ChartDataProvider/useChartDataProviderProps.js +22 -42
- package/modern/context/ChartProvider/ChartContext.js +8 -0
- package/modern/context/ChartProvider/ChartProvider.js +19 -0
- package/modern/context/ChartProvider/ChartProvider.types.js +1 -0
- package/modern/context/ChartProvider/index.js +3 -0
- package/modern/context/ChartProvider/useChartContext.js +11 -0
- package/modern/context/DrawingAreaProvider/DrawingArea.types.js +1 -0
- package/modern/context/DrawingAreaProvider/DrawingAreaContext.js +15 -0
- package/{context/DrawingProvider.js → modern/context/DrawingAreaProvider/DrawingAreaProvider.js} +11 -41
- package/modern/context/DrawingAreaProvider/index.js +3 -0
- package/modern/context/InteractionSelectors.js +12 -0
- package/modern/context/SizeProvider/Size.types.js +1 -0
- package/modern/context/SizeProvider/SizeContext.js +15 -0
- package/modern/context/SizeProvider/SizeProvider.js +26 -0
- package/modern/context/SizeProvider/index.js +4 -0
- package/{ChartContainer → modern/context/SizeProvider}/useChartContainerDimensions.js +16 -6
- package/modern/context/SizeProvider/useSize.js +13 -0
- package/modern/context/index.js +2 -1
- package/modern/hooks/useAxisEvents.js +32 -19
- package/modern/hooks/useChartId.js +5 -6
- package/modern/hooks/useDrawingArea.js +2 -2
- package/modern/hooks/useInteractionItemProps.js +22 -13
- package/modern/hooks/useSvgRef.js +4 -8
- package/modern/index.js +1 -1
- package/modern/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +9 -7
- package/modern/internals/index.js +3 -4
- package/modern/internals/plugins/allPlugins.js +3 -0
- package/modern/internals/plugins/corePlugins/corePlugins.js +7 -0
- package/modern/internals/plugins/corePlugins/index.js +1 -0
- package/modern/internals/plugins/corePlugins/useChartId/index.js +1 -0
- package/modern/internals/plugins/corePlugins/useChartId/useChartId.js +32 -0
- package/modern/internals/plugins/corePlugins/useChartId/useChartId.selectors.js +9 -0
- package/modern/internals/plugins/corePlugins/useChartId/useChartId.types.js +1 -0
- package/modern/internals/plugins/corePlugins/useChartId/useChartId.utils.js +5 -0
- package/modern/internals/plugins/featurePlugins/useChartInteraction/index.js +2 -0
- package/modern/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +73 -0
- package/modern/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.js +10 -0
- package/modern/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.types.js +1 -0
- package/modern/internals/plugins/models/chart.js +1 -0
- package/modern/internals/plugins/models/helpers.js +1 -0
- package/modern/internals/plugins/models/index.js +3 -0
- package/modern/internals/plugins/models/plugin.js +1 -0
- package/modern/internals/plugins/utils/ChartStore.js +24 -0
- package/modern/internals/plugins/utils/selectors.js +37 -0
- package/modern/internals/store/useCharts.js +72 -0
- package/modern/internals/store/useCharts.types.js +1 -0
- package/modern/internals/store/useSelector.js +6 -0
- package/modern/internals/store/useStore.js +17 -0
- package/node/BarChart/AnimatedBarElement.js +28 -0
- package/node/BarChart/BarChart.js +3 -35
- package/node/BarChart/BarElement.js +11 -21
- package/node/BarChart/BarPlot.js +11 -1
- package/node/BarChart/useBarChartProps.js +2 -8
- package/node/ChartContainer/ChartContainer.js +31 -25
- package/node/ChartContainer/useChartContainerProps.js +12 -27
- package/node/ChartsAxis/axisClasses.js +5 -3
- package/node/ChartsAxisHighlight/ChartsAxisHighlight.js +12 -100
- package/node/ChartsAxisHighlight/ChartsAxisHighlight.types.js +5 -0
- package/node/ChartsAxisHighlight/ChartsAxisHighlightPath.js +40 -0
- package/node/ChartsAxisHighlight/ChartsXAxisHighlight.js +57 -0
- package/node/ChartsAxisHighlight/ChartsYAxisHighlight.js +57 -0
- package/node/ChartsAxisHighlight/chartsAxisHighlightClasses.js +14 -0
- package/node/ChartsAxisHighlight/index.js +33 -0
- package/node/ChartsGrid/ChartsGrid.js +2 -2
- package/node/ChartsGrid/ChartsHorizontalGrid.js +4 -4
- package/node/ChartsGrid/ChartsVerticalGrid.js +4 -4
- package/node/ChartsLegend/chartsLegendClasses.js +5 -3
- package/node/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +9 -7
- package/node/ChartsSurface/ChartsSurface.js +68 -35
- package/node/ChartsTooltip/ChartTooltip.types.js +5 -0
- package/node/ChartsTooltip/ChartsAxisTooltipContent.js +83 -73
- package/node/ChartsTooltip/ChartsItemTooltipContent.js +54 -45
- package/node/ChartsTooltip/ChartsTooltip.js +142 -144
- package/node/ChartsTooltip/ChartsTooltipContainer.js +286 -0
- package/node/ChartsTooltip/ChartsTooltipTable.js +2 -2
- package/node/ChartsTooltip/chartsTooltipClasses.js +22 -3
- package/node/ChartsTooltip/index.js +19 -28
- package/node/ChartsTooltip/useAxisTooltip.js +19 -19
- package/node/ChartsTooltip/useItemTooltip.js +5 -4
- package/node/ChartsTooltip/utils.js +0 -9
- package/node/ChartsVoronoiHandler/ChartsVoronoiHandler.js +50 -37
- package/node/ChartsXAxis/ChartsXAxis.js +3 -17
- package/node/ChartsYAxis/ChartsYAxis.js +2 -17
- package/node/Gauge/Gauge.js +0 -6
- package/node/Gauge/GaugeContainer.js +42 -76
- package/node/LineChart/AnimatedArea.js +9 -19
- package/node/LineChart/AnimatedLine.js +9 -21
- package/node/LineChart/AreaPlot.js +11 -1
- package/node/LineChart/CircleMarkElement.js +6 -5
- package/node/LineChart/LineChart.js +3 -36
- package/node/LineChart/LineHighlightPlot.js +6 -5
- package/node/LineChart/LinePlot.js +11 -1
- package/node/LineChart/MarkElement.js +6 -5
- package/node/LineChart/useLineChartProps.js +2 -8
- package/node/PieChart/PieChart.js +5 -41
- package/node/PieChart/PiePlot.js +2 -2
- package/node/ScatterChart/Scatter.js +6 -5
- package/node/ScatterChart/ScatterChart.js +5 -36
- package/node/ScatterChart/useScatterChartProps.js +1 -9
- package/node/SparkLineChart/SparkLineChart.js +4 -35
- package/node/context/ChartDataProvider/ChartDataProvider.js +55 -48
- package/node/context/ChartDataProvider/useChartDataProviderProps.js +22 -44
- package/node/context/ChartProvider/ChartContext.js +15 -0
- package/node/context/ChartProvider/ChartProvider.js +24 -0
- package/node/context/ChartProvider/ChartProvider.types.js +5 -0
- package/node/context/ChartProvider/index.js +38 -0
- package/node/context/ChartProvider/useChartContext.js +18 -0
- package/node/context/DrawingAreaProvider/DrawingArea.types.js +5 -0
- package/node/context/DrawingAreaProvider/DrawingAreaContext.js +21 -0
- package/node/context/{DrawingProvider.js → DrawingAreaProvider/DrawingAreaProvider.js} +12 -44
- package/node/context/DrawingAreaProvider/index.js +38 -0
- package/node/context/InteractionSelectors.js +18 -0
- package/node/context/SizeProvider/Size.types.js +5 -0
- package/node/context/SizeProvider/SizeContext.js +22 -0
- package/node/context/SizeProvider/SizeProvider.js +29 -0
- package/node/context/SizeProvider/index.js +49 -0
- package/node/{ChartContainer → context/SizeProvider}/useChartContainerDimensions.js +16 -6
- package/node/context/SizeProvider/useSize.js +20 -0
- package/node/context/index.js +10 -2
- package/node/hooks/useAxisEvents.js +33 -19
- package/node/hooks/useChartId.js +5 -7
- package/node/hooks/useDrawingArea.js +2 -2
- package/node/hooks/useInteractionItemProps.js +23 -14
- package/node/hooks/useSvgRef.js +4 -9
- package/node/index.js +1 -1
- package/node/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +8 -6
- package/node/internals/index.js +28 -40
- package/node/internals/plugins/allPlugins.js +10 -0
- package/node/internals/plugins/corePlugins/corePlugins.js +12 -0
- package/node/internals/plugins/corePlugins/index.js +12 -0
- package/node/internals/plugins/corePlugins/useChartId/index.js +12 -0
- package/node/internals/plugins/corePlugins/useChartId/useChartId.js +41 -0
- package/node/internals/plugins/corePlugins/useChartId/useChartId.selectors.js +15 -0
- package/node/internals/plugins/corePlugins/useChartId/useChartId.types.js +5 -0
- package/node/internals/plugins/corePlugins/useChartId/useChartId.utils.js +12 -0
- package/node/internals/plugins/featurePlugins/useChartInteraction/index.js +27 -0
- package/node/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +81 -0
- package/node/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.js +16 -0
- package/node/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.types.js +5 -0
- package/node/internals/plugins/models/chart.js +5 -0
- package/node/internals/plugins/models/helpers.js +5 -0
- package/node/internals/plugins/models/index.js +38 -0
- package/node/internals/plugins/models/plugin.js +5 -0
- package/node/internals/plugins/utils/ChartStore.js +31 -0
- package/node/internals/plugins/utils/selectors.js +44 -0
- package/node/internals/store/useCharts.js +80 -0
- package/node/internals/store/useCharts.types.js +5 -0
- package/node/internals/store/useSelector.js +13 -0
- package/node/internals/store/useStore.js +23 -0
- package/package.json +7 -5
- package/themeAugmentation/props.d.ts +1 -2
- package/ChartContainer/ResizableContainer.d.ts +0 -9
- package/ChartContainer/ResizableContainer.js +0 -26
- package/ChartContainer/useChartContainerDimensions.d.ts +0 -6
- package/ChartsTooltip/DefaultChartsAxisTooltipContent.d.ts +0 -7
- package/ChartsTooltip/DefaultChartsAxisTooltipContent.js +0 -123
- package/ChartsTooltip/DefaultChartsItemTooltipContent.d.ts +0 -8
- package/ChartsTooltip/DefaultChartsItemTooltipContent.js +0 -92
- package/context/InteractionProvider.d.ts +0 -50
- package/context/InteractionProvider.js +0 -78
- package/modern/ChartContainer/ResizableContainer.js +0 -26
- package/modern/ChartsTooltip/DefaultChartsAxisTooltipContent.js +0 -123
- package/modern/ChartsTooltip/DefaultChartsItemTooltipContent.js +0 -92
- package/modern/context/InteractionProvider.js +0 -78
- package/node/ChartContainer/ResizableContainer.js +0 -32
- package/node/ChartsTooltip/DefaultChartsAxisTooltipContent.js +0 -129
- package/node/ChartsTooltip/DefaultChartsItemTooltipContent.js +0 -98
- package/node/context/InteractionProvider.js +0 -85
- /package/ChartsGrid/{styledCommonents.d.ts → styledComponents.d.ts} +0 -0
- /package/ChartsGrid/{styledCommonents.js → styledComponents.js} +0 -0
- /package/modern/ChartsGrid/{styledCommonents.js → styledComponents.js} +0 -0
- /package/node/ChartsGrid/{styledCommonents.js → styledComponents.js} +0 -0
|
@@ -1,23 +1,19 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { DrawingProviderProps } from '../DrawingProvider';
|
|
1
|
+
import type { DrawingAreaProviderProps } from '../DrawingAreaProvider';
|
|
3
2
|
import type { CartesianProviderProps } from '../CartesianProvider';
|
|
4
3
|
import type { SeriesProviderProps } from '../SeriesProvider';
|
|
5
4
|
import type { ZAxisContextProviderProps } from '../ZAxisContextProvider';
|
|
6
5
|
import type { ChartDataProviderProps } from './ChartDataProvider';
|
|
7
|
-
import { HighlightedProviderProps } from '
|
|
8
|
-
import { ChartsSurfaceProps } from '../../ChartsSurface';
|
|
6
|
+
import { HighlightedProviderProps } from '../HighlightedProvider';
|
|
9
7
|
import { PluginProviderProps } from '../PluginProvider';
|
|
10
8
|
import { AnimationProviderProps } from '../AnimationProvider';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
import { SizeProviderProps } from '../SizeProvider';
|
|
10
|
+
export declare const useChartDataProviderProps: (props: ChartDataProviderProps) => {
|
|
11
|
+
children: import("react").ReactNode;
|
|
12
|
+
drawingAreaProviderProps: Omit<DrawingAreaProviderProps, "children">;
|
|
14
13
|
seriesProviderProps: Omit<SeriesProviderProps, "children">;
|
|
15
14
|
cartesianProviderProps: Omit<CartesianProviderProps, "children">;
|
|
16
15
|
zAxisContextProps: Omit<ZAxisContextProviderProps, "children">;
|
|
17
16
|
highlightedProviderProps: Omit<HighlightedProviderProps, "children">;
|
|
18
|
-
chartsSurfaceProps: ChartsSurfaceProps & {
|
|
19
|
-
ref: any;
|
|
20
|
-
};
|
|
21
17
|
pluginProviderProps: Omit<PluginProviderProps, "children">;
|
|
22
18
|
animationProviderProps: Omit<AnimationProviderProps, "children">;
|
|
23
19
|
xAxis: {
|
|
@@ -31,30 +27,28 @@ export declare const useChartDataProviderProps: (props: ChartDataProviderProps,
|
|
|
31
27
|
valueFormatter?: ((value: any, context: import("../../internals").AxisValueFormatterContext) => string) | undefined;
|
|
32
28
|
dataKey?: string | undefined;
|
|
33
29
|
sx?: import("@mui/system").SxProps | undefined;
|
|
34
|
-
classes?: Partial<import("../..").ChartsAxisClasses> | undefined;
|
|
35
30
|
tickMaxStep?: number | undefined;
|
|
36
31
|
tickMinStep?: number | undefined;
|
|
37
32
|
tickNumber?: number | undefined;
|
|
38
33
|
disableLine?: boolean | undefined;
|
|
39
34
|
disableTicks?: boolean | undefined;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
tickLabelInterval?: ("auto" | ((value: any, index: number) => boolean)) | undefined;
|
|
44
|
-
labelFontSize?: number | undefined;
|
|
35
|
+
tickLabelStyle?: import("../..").ChartsTextStyle | undefined;
|
|
36
|
+
labelStyle?: import("../..").ChartsTextStyle | undefined;
|
|
37
|
+
tickLabelInterval?: "auto" | ((value: any, index: number) => boolean) | undefined;
|
|
45
38
|
tickSize?: number | undefined;
|
|
39
|
+
classes?: Partial<import("../..").ChartsAxisClasses> | undefined;
|
|
46
40
|
slots?: Partial<import("../../internals").ChartsAxisSlots> | undefined;
|
|
47
41
|
slotProps?: Partial<import("../../internals").ChartsAxisSlotProps> | undefined;
|
|
48
|
-
tickInterval?:
|
|
49
|
-
tickPlacement?:
|
|
50
|
-
tickLabelPlacement?:
|
|
42
|
+
tickInterval?: "auto" | ((value: any, index: number) => boolean) | any[] | undefined;
|
|
43
|
+
tickPlacement?: "start" | "end" | "middle" | "extremities" | undefined;
|
|
44
|
+
tickLabelPlacement?: "middle" | "tick" | undefined;
|
|
51
45
|
scaleType?: "linear" | "time" | "log" | "band" | "point" | "pow" | "sqrt" | "utc" | undefined;
|
|
52
46
|
colorMap?: import("../../models/colorMapping").ContinuousColorConfig<number | Date> | import("../../models/colorMapping").PiecewiseColorConfig<number | Date> | import("../../models/colorMapping").OrdinalColorConfig<string | number | Date> | undefined;
|
|
53
47
|
hideTooltip?: boolean | undefined;
|
|
54
|
-
domainLimit?:
|
|
48
|
+
domainLimit?: "nice" | "strict" | ((min: number, max: number) => {
|
|
55
49
|
min: number;
|
|
56
50
|
max: number;
|
|
57
|
-
})
|
|
51
|
+
}) | undefined;
|
|
58
52
|
id: import("../../internals").AxisId;
|
|
59
53
|
}[];
|
|
60
54
|
yAxis: {
|
|
@@ -68,30 +62,29 @@ export declare const useChartDataProviderProps: (props: ChartDataProviderProps,
|
|
|
68
62
|
valueFormatter?: ((value: any, context: import("../../internals").AxisValueFormatterContext) => string) | undefined;
|
|
69
63
|
dataKey?: string | undefined;
|
|
70
64
|
sx?: import("@mui/system").SxProps | undefined;
|
|
71
|
-
classes?: Partial<import("../..").ChartsAxisClasses> | undefined;
|
|
72
65
|
tickMaxStep?: number | undefined;
|
|
73
66
|
tickMinStep?: number | undefined;
|
|
74
67
|
tickNumber?: number | undefined;
|
|
75
68
|
disableLine?: boolean | undefined;
|
|
76
69
|
disableTicks?: boolean | undefined;
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
tickLabelInterval?: ("auto" | ((value: any, index: number) => boolean)) | undefined;
|
|
81
|
-
labelFontSize?: number | undefined;
|
|
70
|
+
tickLabelStyle?: import("../..").ChartsTextStyle | undefined;
|
|
71
|
+
labelStyle?: import("../..").ChartsTextStyle | undefined;
|
|
72
|
+
tickLabelInterval?: "auto" | ((value: any, index: number) => boolean) | undefined;
|
|
82
73
|
tickSize?: number | undefined;
|
|
74
|
+
classes?: Partial<import("../..").ChartsAxisClasses> | undefined;
|
|
83
75
|
slots?: Partial<import("../../internals").ChartsAxisSlots> | undefined;
|
|
84
76
|
slotProps?: Partial<import("../../internals").ChartsAxisSlotProps> | undefined;
|
|
85
|
-
tickInterval?:
|
|
86
|
-
tickPlacement?:
|
|
87
|
-
tickLabelPlacement?:
|
|
77
|
+
tickInterval?: "auto" | ((value: any, index: number) => boolean) | any[] | undefined;
|
|
78
|
+
tickPlacement?: "start" | "end" | "middle" | "extremities" | undefined;
|
|
79
|
+
tickLabelPlacement?: "middle" | "tick" | undefined;
|
|
88
80
|
scaleType?: "linear" | "time" | "log" | "band" | "point" | "pow" | "sqrt" | "utc" | undefined;
|
|
89
81
|
colorMap?: import("../../models/colorMapping").ContinuousColorConfig<number | Date> | import("../../models/colorMapping").PiecewiseColorConfig<number | Date> | import("../../models/colorMapping").OrdinalColorConfig<string | number | Date> | undefined;
|
|
90
82
|
hideTooltip?: boolean | undefined;
|
|
91
|
-
domainLimit?:
|
|
83
|
+
domainLimit?: "nice" | "strict" | ((min: number, max: number) => {
|
|
92
84
|
min: number;
|
|
93
85
|
max: number;
|
|
94
|
-
})
|
|
86
|
+
}) | undefined;
|
|
95
87
|
id: import("../../internals").AxisId;
|
|
96
88
|
}[];
|
|
89
|
+
sizeProviderProps: Omit<SizeProviderProps, "children">;
|
|
97
90
|
};
|
|
@@ -1,41 +1,26 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
-
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
-
const _excluded = ["width", "height", "series", "margin", "xAxis", "yAxis", "zAxis", "colors", "dataset", "sx", "title", "desc", "disableAxisListener", "highlightedItem", "onHighlightChange", "plugins", "children", "skipAnimation"];
|
|
6
|
-
import * as React from 'react';
|
|
7
|
-
import useForkRef from '@mui/utils/useForkRef';
|
|
8
3
|
import { useDefaultizeAxis } from "./useDefaultizeAxis.js";
|
|
9
|
-
export const useChartDataProviderProps =
|
|
4
|
+
export const useChartDataProviderProps = props => {
|
|
10
5
|
const {
|
|
11
|
-
width,
|
|
12
|
-
height,
|
|
13
|
-
series,
|
|
14
|
-
margin,
|
|
15
|
-
xAxis,
|
|
16
|
-
yAxis,
|
|
17
|
-
zAxis,
|
|
18
|
-
colors,
|
|
19
|
-
dataset,
|
|
20
|
-
sx,
|
|
21
|
-
title,
|
|
22
|
-
desc,
|
|
23
|
-
disableAxisListener,
|
|
24
|
-
highlightedItem,
|
|
25
|
-
onHighlightChange,
|
|
26
|
-
plugins,
|
|
27
|
-
children,
|
|
28
|
-
skipAnimation
|
|
29
|
-
} = props,
|
|
30
|
-
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
31
|
-
const svgRef = React.useRef(null);
|
|
32
|
-
const chartSurfaceRef = useForkRef(ref, svgRef);
|
|
33
|
-
const [defaultizedXAxis, defaultizedYAxis] = useDefaultizeAxis(xAxis, yAxis, dataset);
|
|
34
|
-
const drawingProviderProps = {
|
|
35
6
|
width,
|
|
36
7
|
height,
|
|
8
|
+
series,
|
|
37
9
|
margin,
|
|
38
|
-
|
|
10
|
+
xAxis,
|
|
11
|
+
yAxis,
|
|
12
|
+
zAxis,
|
|
13
|
+
colors,
|
|
14
|
+
dataset,
|
|
15
|
+
highlightedItem,
|
|
16
|
+
onHighlightChange,
|
|
17
|
+
plugins,
|
|
18
|
+
children,
|
|
19
|
+
skipAnimation
|
|
20
|
+
} = props;
|
|
21
|
+
const [defaultizedXAxis, defaultizedYAxis] = useDefaultizeAxis(xAxis, yAxis, dataset);
|
|
22
|
+
const drawingAreaProviderProps = {
|
|
23
|
+
margin
|
|
39
24
|
};
|
|
40
25
|
const animationProviderProps = {
|
|
41
26
|
skipAnimation
|
|
@@ -61,26 +46,21 @@ export const useChartDataProviderProps = (props, ref) => {
|
|
|
61
46
|
highlightedItem,
|
|
62
47
|
onHighlightChange
|
|
63
48
|
};
|
|
64
|
-
const
|
|
49
|
+
const sizeProviderProps = {
|
|
65
50
|
width,
|
|
66
|
-
height
|
|
67
|
-
|
|
68
|
-
sx,
|
|
69
|
-
title,
|
|
70
|
-
desc,
|
|
71
|
-
disableAxisListener
|
|
72
|
-
});
|
|
51
|
+
height
|
|
52
|
+
};
|
|
73
53
|
return {
|
|
74
54
|
children,
|
|
75
|
-
|
|
55
|
+
drawingAreaProviderProps,
|
|
76
56
|
seriesProviderProps,
|
|
77
57
|
cartesianProviderProps,
|
|
78
58
|
zAxisContextProps,
|
|
79
59
|
highlightedProviderProps,
|
|
80
|
-
chartsSurfaceProps,
|
|
81
60
|
pluginProviderProps,
|
|
82
61
|
animationProviderProps,
|
|
83
62
|
xAxis: defaultizedXAxis,
|
|
84
|
-
yAxis: defaultizedYAxis
|
|
63
|
+
yAxis: defaultizedYAxis,
|
|
64
|
+
sizeProviderProps
|
|
85
65
|
};
|
|
86
66
|
};
|
|
@@ -13,29 +13,27 @@ export declare const useDefaultizeAxis: (inXAxis: MakeOptional<AxisConfig<ScaleN
|
|
|
13
13
|
valueFormatter?: ((value: any, context: import("../../internals").AxisValueFormatterContext) => string) | undefined;
|
|
14
14
|
dataKey?: string | undefined;
|
|
15
15
|
sx?: import("@mui/system").SxProps | undefined;
|
|
16
|
-
classes?: Partial<import("../..").ChartsAxisClasses> | undefined;
|
|
17
16
|
tickMaxStep?: number | undefined;
|
|
18
17
|
tickMinStep?: number | undefined;
|
|
19
18
|
tickNumber?: number | undefined;
|
|
20
19
|
disableLine?: boolean | undefined;
|
|
21
20
|
disableTicks?: boolean | undefined;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
tickLabelInterval?: ("auto" | ((value: any, index: number) => boolean)) | undefined;
|
|
26
|
-
labelFontSize?: number | undefined;
|
|
21
|
+
tickLabelStyle?: import("../..").ChartsTextStyle | undefined;
|
|
22
|
+
labelStyle?: import("../..").ChartsTextStyle | undefined;
|
|
23
|
+
tickLabelInterval?: "auto" | ((value: any, index: number) => boolean) | undefined;
|
|
27
24
|
tickSize?: number | undefined;
|
|
25
|
+
classes?: Partial<import("../..").ChartsAxisClasses> | undefined;
|
|
28
26
|
slots?: Partial<import("../../internals").ChartsAxisSlots> | undefined;
|
|
29
27
|
slotProps?: Partial<import("../../internals").ChartsAxisSlotProps> | undefined;
|
|
30
|
-
tickInterval?:
|
|
31
|
-
tickPlacement?:
|
|
32
|
-
tickLabelPlacement?:
|
|
28
|
+
tickInterval?: "auto" | ((value: any, index: number) => boolean) | any[] | undefined;
|
|
29
|
+
tickPlacement?: "start" | "end" | "middle" | "extremities" | undefined;
|
|
30
|
+
tickLabelPlacement?: "middle" | "tick" | undefined;
|
|
33
31
|
scaleType?: "linear" | "time" | "log" | "band" | "point" | "pow" | "sqrt" | "utc" | undefined;
|
|
34
32
|
colorMap?: import("../../models/colorMapping").ContinuousColorConfig<number | Date> | import("../../models/colorMapping").PiecewiseColorConfig<number | Date> | import("../../models/colorMapping").OrdinalColorConfig<string | number | Date> | undefined;
|
|
35
33
|
hideTooltip?: boolean | undefined;
|
|
36
|
-
domainLimit?:
|
|
34
|
+
domainLimit?: "nice" | "strict" | ((min: number, max: number) => {
|
|
37
35
|
min: number;
|
|
38
36
|
max: number;
|
|
39
|
-
})
|
|
37
|
+
}) | undefined;
|
|
40
38
|
id: import("../../internals").AxisId;
|
|
41
39
|
}[][];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { useCharts } from "../../internals/store/useCharts.js";
|
|
5
|
+
import { ChartContext } from "./ChartContext.js";
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
function ChartProvider(props) {
|
|
8
|
+
const {
|
|
9
|
+
children
|
|
10
|
+
} = props;
|
|
11
|
+
const {
|
|
12
|
+
contextValue
|
|
13
|
+
} = useCharts([], {});
|
|
14
|
+
return /*#__PURE__*/_jsx(ChartContext.Provider, {
|
|
15
|
+
value: contextValue,
|
|
16
|
+
children: children
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
export { ChartProvider };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ChartAnyPluginSignature, ChartInstance, ChartPublicAPI } from '../../internals/plugins/models';
|
|
3
|
+
import { ChartStore } from '../../internals/plugins/utils/ChartStore';
|
|
4
|
+
export type ChartContextValue<TSignatures extends readonly ChartAnyPluginSignature[], TOptionalSignatures extends readonly ChartAnyPluginSignature[] = []> = {
|
|
5
|
+
/**
|
|
6
|
+
* And object with all the methods needed to interact with the chart.
|
|
7
|
+
*/
|
|
8
|
+
instance: ChartInstance<TSignatures, TOptionalSignatures>;
|
|
9
|
+
/**
|
|
10
|
+
* A subset of the `instance` method that are exposed to the developers.
|
|
11
|
+
*/
|
|
12
|
+
publicAPI: ChartPublicAPI<TSignatures, TOptionalSignatures>;
|
|
13
|
+
/**
|
|
14
|
+
* The internal state of the chart.
|
|
15
|
+
*/
|
|
16
|
+
store: ChartStore<TSignatures>;
|
|
17
|
+
/**
|
|
18
|
+
* The ref to the <svg />.
|
|
19
|
+
*/
|
|
20
|
+
svgRef: React.RefObject<SVGSVGElement>;
|
|
21
|
+
};
|
|
22
|
+
export interface ChartProviderProps {
|
|
23
|
+
children: React.ReactNode;
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ChartAnyPluginSignature } from '../../internals/plugins/models';
|
|
2
|
+
import { ChartContextValue } from './ChartProvider.types';
|
|
3
|
+
export declare const useChartContext: <TSignatures extends readonly ChartAnyPluginSignature[], TOptionalSignatures extends readonly ChartAnyPluginSignature[] = []>() => ChartContextValue<TSignatures, TOptionalSignatures>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { ChartContext } from "./ChartContext.js";
|
|
5
|
+
export const useChartContext = () => {
|
|
6
|
+
const context = React.useContext(ChartContext);
|
|
7
|
+
if (context == null) {
|
|
8
|
+
throw new Error(['MUI X: Could not find the Chart context.', 'It looks like you rendered your component outside of a ChartDataProvider.', 'This can also happen if you are bundling multiple versions of the library.'].join('\n'));
|
|
9
|
+
}
|
|
10
|
+
return context;
|
|
11
|
+
};
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { LayoutConfig } from '
|
|
3
|
-
|
|
4
|
-
export interface DrawingProviderProps extends LayoutConfig {
|
|
2
|
+
import { LayoutConfig } from '../../models';
|
|
3
|
+
export interface DrawingAreaProviderProps extends Pick<LayoutConfig, 'margin'> {
|
|
5
4
|
children: React.ReactNode;
|
|
6
|
-
svgRef: React.RefObject<SVGSVGElement>;
|
|
7
5
|
}
|
|
8
6
|
/**
|
|
9
7
|
* Defines the area in which it is possible to draw the charts.
|
|
10
8
|
*/
|
|
11
|
-
export type
|
|
9
|
+
export type DrawingAreaState = {
|
|
12
10
|
/**
|
|
13
11
|
* The gap between the left border of the SVG and the drawing area.
|
|
14
12
|
*/
|
|
@@ -51,12 +49,3 @@ export type DrawingArea = {
|
|
|
51
49
|
direction?: 'x' | 'y';
|
|
52
50
|
}) => boolean;
|
|
53
51
|
};
|
|
54
|
-
export declare const DrawingContext: React.Context<DrawingArea & {
|
|
55
|
-
/**
|
|
56
|
-
* A random id used to distinguish each chart on the same page.
|
|
57
|
-
*/
|
|
58
|
-
chartId: string;
|
|
59
|
-
}>;
|
|
60
|
-
export type SvgContextState = React.RefObject<SVGSVGElement>;
|
|
61
|
-
export declare const SvgContext: React.Context<Initializable<SvgContextState>>;
|
|
62
|
-
export declare function DrawingProvider(props: DrawingProviderProps): React.JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
export const DrawingAreaContext = /*#__PURE__*/React.createContext({
|
|
5
|
+
top: 0,
|
|
6
|
+
left: 0,
|
|
7
|
+
bottom: 0,
|
|
8
|
+
right: 0,
|
|
9
|
+
height: 300,
|
|
10
|
+
width: 400,
|
|
11
|
+
isPointInside: () => false
|
|
12
|
+
});
|
|
13
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
14
|
+
DrawingAreaContext.displayName = 'DrawingContext';
|
|
15
|
+
}
|
package/{modern/context/DrawingProvider.js → context/DrawingAreaProvider/DrawingAreaProvider.js}
RENAMED
|
@@ -3,42 +3,19 @@
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import useId from '@mui/utils/useId';
|
|
6
|
-
import useChartDimensions from "
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
* Defines the area in which it is possible to draw the charts.
|
|
10
|
-
*/
|
|
6
|
+
import useChartDimensions from "../../hooks/useChartDimensions.js";
|
|
7
|
+
import { DrawingAreaContext } from "./DrawingAreaContext.js";
|
|
8
|
+
import { useSize } from "../SizeProvider/index.js";
|
|
11
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
-
export
|
|
13
|
-
top: 0,
|
|
14
|
-
left: 0,
|
|
15
|
-
bottom: 0,
|
|
16
|
-
right: 0,
|
|
17
|
-
height: 300,
|
|
18
|
-
width: 400,
|
|
19
|
-
chartId: '',
|
|
20
|
-
isPointInside: () => false
|
|
21
|
-
});
|
|
22
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
23
|
-
DrawingContext.displayName = 'DrawingContext';
|
|
24
|
-
}
|
|
25
|
-
export const SvgContext = /*#__PURE__*/React.createContext({
|
|
26
|
-
isInitialized: false,
|
|
27
|
-
data: {
|
|
28
|
-
current: null
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
32
|
-
SvgContext.displayName = 'SvgContext';
|
|
33
|
-
}
|
|
34
|
-
export function DrawingProvider(props) {
|
|
10
|
+
export function DrawingAreaProvider(props) {
|
|
35
11
|
const {
|
|
36
|
-
width,
|
|
37
|
-
height,
|
|
38
12
|
margin,
|
|
39
|
-
svgRef,
|
|
40
13
|
children
|
|
41
14
|
} = props;
|
|
15
|
+
const {
|
|
16
|
+
width,
|
|
17
|
+
height
|
|
18
|
+
} = useSize();
|
|
42
19
|
const drawingArea = useChartDimensions(width, height, margin);
|
|
43
20
|
const chartId = useId();
|
|
44
21
|
const isPointInside = React.useCallback(({
|
|
@@ -64,15 +41,8 @@ export function DrawingProvider(props) {
|
|
|
64
41
|
}, drawingArea, {
|
|
65
42
|
isPointInside
|
|
66
43
|
}), [chartId, drawingArea, isPointInside]);
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}), [svgRef]);
|
|
71
|
-
return /*#__PURE__*/_jsx(SvgContext.Provider, {
|
|
72
|
-
value: refValue,
|
|
73
|
-
children: /*#__PURE__*/_jsx(DrawingContext.Provider, {
|
|
74
|
-
value: value,
|
|
75
|
-
children: children
|
|
76
|
-
})
|
|
44
|
+
return /*#__PURE__*/_jsx(DrawingAreaContext.Provider, {
|
|
45
|
+
value: value,
|
|
46
|
+
children: children
|
|
77
47
|
});
|
|
78
48
|
}
|