@mui/x-charts 8.0.0-beta.2 → 8.0.0-beta.3
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 +38 -8
- package/BarChart/AnimatedBarElement.js +5 -5
- package/BarChart/BarChart.js +2 -0
- package/BarChart/BarClipPath.d.ts +19 -1
- package/BarChart/BarClipPath.js +84 -17
- package/BarChart/BarElement.d.ts +9 -20
- package/BarChart/BarElement.js +29 -26
- package/BarChart/BarLabel/BarLabel.d.ts +27 -854
- package/BarChart/BarLabel/BarLabel.js +32 -5
- package/BarChart/BarLabel/BarLabel.types.d.ts +2 -0
- package/BarChart/BarLabel/BarLabelItem.d.ts +24 -0
- package/BarChart/BarLabel/BarLabelItem.js +18 -6
- package/BarChart/BarLabel/BarLabelPlot.js +16 -46
- package/BarChart/BarLabel/barLabelClasses.d.ts +3 -1
- package/BarChart/BarLabel/barLabelClasses.js +4 -3
- package/BarChart/BarPlot.js +37 -61
- package/BarChart/barElementClasses.d.ts +21 -0
- package/BarChart/barElementClasses.js +29 -0
- package/BarChart/getRadius.d.ts +1 -1
- package/BarChart/index.d.ts +2 -1
- package/BarChart/index.js +11 -0
- package/BarChart/seriesConfig/index.js +3 -1
- package/BarChart/seriesConfig/tooltip.d.ts +2 -1
- package/BarChart/seriesConfig/tooltip.js +14 -1
- package/BarChart/types.d.ts +2 -2
- package/CHANGELOG.md +141 -0
- package/ChartContainer/ChartContainer.js +4 -0
- package/ChartsLabel/ChartsLabelMark.js +0 -4
- package/ChartsLabel/index.d.ts +1 -0
- package/ChartsLabel/index.js +7 -0
- package/ChartsLegend/continuousColorLegendClasses.d.ts +1 -1
- package/ChartsTooltip/ChartsAxisTooltipContent.js +47 -55
- package/ChartsTooltip/ChartsItemTooltipContent.js +11 -9
- package/ChartsTooltip/ChartsTooltip.js +2 -2
- package/ChartsTooltip/ChartsTooltipContainer.js +3 -8
- package/ChartsTooltip/ChartsTooltipTable.d.ts +3 -1
- package/ChartsTooltip/ChartsTooltipTable.js +24 -9
- package/ChartsTooltip/chartsTooltipClasses.d.ts +4 -4
- package/ChartsTooltip/chartsTooltipClasses.js +2 -2
- package/ChartsTooltip/index.d.ts +1 -0
- package/ChartsTooltip/index.js +12 -0
- package/ChartsTooltip/useAxesTooltip.d.ts +7 -0
- package/ChartsTooltip/useAxesTooltip.js +18 -0
- package/ChartsTooltip/useAxisTooltip.d.ts +24 -3
- package/ChartsTooltip/useAxisTooltip.js +71 -37
- package/ChartsTooltip/useItemTooltip.js +4 -1
- package/ChartsXAxis/ChartsXAxis.js +5 -2
- package/ChartsYAxis/ChartsYAxis.js +69 -17
- package/LineChart/AnimatedArea.js +5 -22
- package/LineChart/AnimatedLine.d.ts +1 -4
- package/LineChart/AnimatedLine.js +10 -25
- package/LineChart/AppearingMask.d.ts +5 -0
- package/LineChart/AppearingMask.js +25 -18
- package/LineChart/CircleMarkElement.js +16 -22
- package/LineChart/LineChart.js +2 -0
- package/LineChart/LineHighlightPlot.js +2 -3
- package/LineChart/MarkElement.js +16 -27
- package/LineChart/MarkPlot.js +0 -1
- package/LineChart/markElementClasses.d.ts +3 -0
- package/LineChart/markElementClasses.js +4 -3
- package/LineChart/seriesConfig/index.js +3 -1
- package/LineChart/seriesConfig/tooltip.d.ts +2 -1
- package/LineChart/seriesConfig/tooltip.js +8 -1
- package/PieChart/PieArc.d.ts +19 -11
- package/PieChart/PieArc.js +37 -24
- package/PieChart/PieArcLabel.d.ts +22 -13
- package/PieChart/PieArcLabel.js +52 -48
- package/PieChart/PieArcLabelPlot.js +16 -34
- package/PieChart/PieArcPlot.js +21 -34
- package/PieChart/seriesConfig/tooltip.js +3 -0
- package/ScatterChart/ScatterChart.js +2 -0
- package/SparkLineChart/SparkLineChart.js +2 -0
- package/colorPalettes/colorPalettes.js +2 -2
- package/constants/index.d.ts +1 -1
- package/constants/index.js +1 -1
- package/context/AnimationProvider/AnimationProvider.js +4 -6
- package/esm/BarChart/AnimatedBarElement.d.ts +38 -8
- package/esm/BarChart/AnimatedBarElement.js +5 -5
- package/esm/BarChart/BarChart.js +2 -0
- package/esm/BarChart/BarClipPath.d.ts +19 -1
- package/esm/BarChart/BarClipPath.js +84 -17
- package/esm/BarChart/BarElement.d.ts +9 -20
- package/esm/BarChart/BarElement.js +28 -23
- package/esm/BarChart/BarLabel/BarLabel.d.ts +27 -854
- package/esm/BarChart/BarLabel/BarLabel.js +32 -5
- package/esm/BarChart/BarLabel/BarLabel.types.d.ts +2 -0
- package/esm/BarChart/BarLabel/BarLabelItem.d.ts +24 -0
- package/esm/BarChart/BarLabel/BarLabelItem.js +18 -6
- package/esm/BarChart/BarLabel/BarLabelPlot.js +16 -46
- package/esm/BarChart/BarLabel/barLabelClasses.d.ts +3 -1
- package/esm/BarChart/BarLabel/barLabelClasses.js +4 -3
- package/esm/BarChart/BarPlot.js +37 -61
- package/esm/BarChart/barElementClasses.d.ts +21 -0
- package/esm/BarChart/barElementClasses.js +19 -0
- package/esm/BarChart/getRadius.d.ts +1 -1
- package/esm/BarChart/index.d.ts +2 -1
- package/esm/BarChart/index.js +2 -1
- package/esm/BarChart/seriesConfig/index.js +2 -1
- package/esm/BarChart/seriesConfig/tooltip.d.ts +2 -1
- package/esm/BarChart/seriesConfig/tooltip.js +12 -0
- package/esm/BarChart/types.d.ts +2 -2
- package/esm/ChartContainer/ChartContainer.js +4 -0
- package/esm/ChartsLabel/ChartsLabelMark.js +0 -4
- package/esm/ChartsLabel/index.d.ts +1 -0
- package/esm/ChartsLabel/index.js +1 -0
- package/esm/ChartsLegend/continuousColorLegendClasses.d.ts +1 -1
- package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +47 -55
- package/esm/ChartsTooltip/ChartsItemTooltipContent.js +11 -9
- package/esm/ChartsTooltip/ChartsTooltip.js +2 -2
- package/esm/ChartsTooltip/ChartsTooltipContainer.js +4 -9
- package/esm/ChartsTooltip/ChartsTooltipTable.d.ts +3 -1
- package/esm/ChartsTooltip/ChartsTooltipTable.js +23 -9
- package/esm/ChartsTooltip/chartsTooltipClasses.d.ts +4 -4
- package/esm/ChartsTooltip/chartsTooltipClasses.js +2 -2
- package/esm/ChartsTooltip/index.d.ts +1 -0
- package/esm/ChartsTooltip/index.js +1 -0
- package/esm/ChartsTooltip/useAxesTooltip.d.ts +7 -0
- package/esm/ChartsTooltip/useAxesTooltip.js +12 -0
- package/esm/ChartsTooltip/useAxisTooltip.d.ts +24 -3
- package/esm/ChartsTooltip/useAxisTooltip.js +72 -38
- package/esm/ChartsTooltip/useItemTooltip.js +4 -1
- package/esm/ChartsXAxis/ChartsXAxis.js +5 -2
- package/esm/ChartsYAxis/ChartsYAxis.js +69 -17
- package/esm/LineChart/AnimatedArea.js +5 -22
- package/esm/LineChart/AnimatedLine.d.ts +1 -4
- package/esm/LineChart/AnimatedLine.js +9 -24
- package/esm/LineChart/AppearingMask.d.ts +5 -0
- package/esm/LineChart/AppearingMask.js +23 -18
- package/esm/LineChart/CircleMarkElement.js +19 -25
- package/esm/LineChart/LineChart.js +2 -0
- package/esm/LineChart/LineHighlightPlot.js +3 -4
- package/esm/LineChart/MarkElement.js +17 -28
- package/esm/LineChart/MarkPlot.js +0 -1
- package/esm/LineChart/markElementClasses.d.ts +3 -0
- package/esm/LineChart/markElementClasses.js +4 -3
- package/esm/LineChart/seriesConfig/index.js +2 -1
- package/esm/LineChart/seriesConfig/tooltip.d.ts +2 -1
- package/esm/LineChart/seriesConfig/tooltip.js +6 -0
- package/esm/PieChart/PieArc.d.ts +19 -11
- package/esm/PieChart/PieArc.js +36 -23
- package/esm/PieChart/PieArcLabel.d.ts +22 -13
- package/esm/PieChart/PieArcLabel.js +51 -47
- package/esm/PieChart/PieArcLabelPlot.js +16 -34
- package/esm/PieChart/PieArcPlot.js +21 -34
- package/esm/PieChart/seriesConfig/tooltip.js +3 -0
- package/esm/ScatterChart/ScatterChart.js +2 -0
- package/esm/SparkLineChart/SparkLineChart.js +2 -0
- package/esm/colorPalettes/colorPalettes.js +2 -2
- package/esm/constants/index.d.ts +1 -1
- package/esm/constants/index.js +1 -1
- package/esm/context/AnimationProvider/AnimationProvider.js +3 -6
- package/esm/hooks/animation/index.d.ts +6 -0
- package/esm/hooks/animation/index.js +6 -0
- package/esm/hooks/animation/useAnimateArea.d.ts +15 -0
- package/esm/hooks/animation/useAnimateArea.js +27 -0
- package/esm/hooks/animation/useAnimateBar.d.ts +17 -0
- package/esm/hooks/animation/useAnimateBar.js +56 -0
- package/esm/hooks/animation/useAnimateBarLabel.d.ts +19 -0
- package/esm/hooks/animation/useAnimateBarLabel.js +59 -0
- package/esm/hooks/animation/useAnimateLine.d.ts +14 -0
- package/esm/hooks/animation/useAnimateLine.js +26 -0
- package/esm/hooks/animation/useAnimatePieArc.d.ts +15 -0
- package/esm/hooks/animation/useAnimatePieArc.js +70 -0
- package/esm/hooks/animation/useAnimatePieArcLabel.d.ts +15 -0
- package/esm/hooks/animation/useAnimatePieArcLabel.js +72 -0
- package/esm/hooks/index.d.ts +2 -1
- package/esm/hooks/index.js +2 -1
- package/esm/hooks/useInteractionItemProps.js +11 -0
- package/esm/index.js +1 -1
- package/esm/internals/animation/Transition.d.ts +37 -0
- package/esm/internals/animation/Transition.js +83 -0
- package/esm/internals/animation/animation.d.ts +4 -0
- package/esm/internals/animation/animation.js +4 -0
- package/esm/internals/animation/useAnimate.d.ts +19 -0
- package/esm/internals/animation/useAnimate.js +74 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.d.ts +1 -1
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +9 -3
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisTriggerTooltip.d.ts +5 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisTriggerTooltip.js +21 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +8 -32
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.d.ts +9 -1
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.js +60 -26
- package/esm/internals/plugins/models/seriesConfig/seriesConfig.types.d.ts +3 -1
- package/esm/internals/plugins/models/seriesConfig/tooltipGetter.types.d.ts +10 -4
- package/esm/internals/shallowEqual.d.ts +8 -0
- package/esm/internals/shallowEqual.js +31 -0
- package/esm/models/axis.d.ts +8 -0
- package/esm/themeAugmentation/overrides.d.ts +1 -1
- package/hooks/animation/index.d.ts +6 -0
- package/hooks/animation/index.js +71 -0
- package/hooks/animation/useAnimateArea.d.ts +15 -0
- package/hooks/animation/useAnimateArea.js +34 -0
- package/hooks/animation/useAnimateBar.d.ts +17 -0
- package/hooks/animation/useAnimateBar.js +62 -0
- package/hooks/animation/useAnimateBarLabel.d.ts +19 -0
- package/hooks/animation/useAnimateBarLabel.js +65 -0
- package/hooks/animation/useAnimateLine.d.ts +14 -0
- package/hooks/animation/useAnimateLine.js +33 -0
- package/hooks/animation/useAnimatePieArc.d.ts +15 -0
- package/hooks/animation/useAnimatePieArc.js +77 -0
- package/hooks/animation/useAnimatePieArcLabel.d.ts +15 -0
- package/hooks/animation/useAnimatePieArcLabel.js +79 -0
- package/hooks/index.d.ts +2 -1
- package/hooks/index.js +13 -1
- package/hooks/useInteractionItemProps.js +11 -0
- package/index.js +1 -1
- package/internals/animation/Transition.d.ts +37 -0
- package/internals/animation/Transition.js +89 -0
- package/internals/animation/animation.d.ts +4 -0
- package/internals/animation/animation.js +11 -0
- package/internals/animation/useAnimate.d.ts +19 -0
- package/internals/animation/useAnimate.js +80 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.d.ts +1 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +9 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisTriggerTooltip.d.ts +5 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisTriggerTooltip.js +28 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +8 -32
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.d.ts +9 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.js +61 -27
- package/internals/plugins/models/seriesConfig/seriesConfig.types.d.ts +3 -1
- package/internals/plugins/models/seriesConfig/tooltipGetter.types.d.ts +10 -4
- package/internals/shallowEqual.d.ts +8 -0
- package/internals/shallowEqual.js +37 -0
- package/models/axis.d.ts +8 -0
- package/modern/BarChart/AnimatedBarElement.d.ts +38 -8
- package/modern/BarChart/AnimatedBarElement.js +5 -5
- package/modern/BarChart/BarChart.js +2 -0
- package/modern/BarChart/BarClipPath.d.ts +19 -1
- package/modern/BarChart/BarClipPath.js +84 -17
- package/modern/BarChart/BarElement.d.ts +9 -20
- package/modern/BarChart/BarElement.js +28 -23
- package/modern/BarChart/BarLabel/BarLabel.d.ts +27 -854
- package/modern/BarChart/BarLabel/BarLabel.js +32 -5
- package/modern/BarChart/BarLabel/BarLabel.types.d.ts +2 -0
- package/modern/BarChart/BarLabel/BarLabelItem.d.ts +24 -0
- package/modern/BarChart/BarLabel/BarLabelItem.js +18 -6
- package/modern/BarChart/BarLabel/BarLabelPlot.js +16 -46
- package/modern/BarChart/BarLabel/barLabelClasses.d.ts +3 -1
- package/modern/BarChart/BarLabel/barLabelClasses.js +4 -3
- package/modern/BarChart/BarPlot.js +37 -61
- package/modern/BarChart/barElementClasses.d.ts +21 -0
- package/modern/BarChart/barElementClasses.js +19 -0
- package/modern/BarChart/getRadius.d.ts +1 -1
- package/modern/BarChart/index.d.ts +2 -1
- package/modern/BarChart/index.js +2 -1
- package/modern/BarChart/seriesConfig/index.js +2 -1
- package/modern/BarChart/seriesConfig/tooltip.d.ts +2 -1
- package/modern/BarChart/seriesConfig/tooltip.js +12 -0
- package/modern/BarChart/types.d.ts +2 -2
- package/modern/ChartContainer/ChartContainer.js +4 -0
- package/modern/ChartsLabel/ChartsLabelMark.js +0 -4
- package/modern/ChartsLabel/index.d.ts +1 -0
- package/modern/ChartsLabel/index.js +1 -0
- package/modern/ChartsLegend/continuousColorLegendClasses.d.ts +1 -1
- package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +47 -55
- package/modern/ChartsTooltip/ChartsItemTooltipContent.js +11 -9
- package/modern/ChartsTooltip/ChartsTooltip.js +2 -2
- package/modern/ChartsTooltip/ChartsTooltipContainer.js +4 -9
- package/modern/ChartsTooltip/ChartsTooltipTable.d.ts +3 -1
- package/modern/ChartsTooltip/ChartsTooltipTable.js +23 -9
- package/modern/ChartsTooltip/chartsTooltipClasses.d.ts +4 -4
- package/modern/ChartsTooltip/chartsTooltipClasses.js +2 -2
- package/modern/ChartsTooltip/index.d.ts +1 -0
- package/modern/ChartsTooltip/index.js +1 -0
- package/modern/ChartsTooltip/useAxesTooltip.d.ts +7 -0
- package/modern/ChartsTooltip/useAxesTooltip.js +12 -0
- package/modern/ChartsTooltip/useAxisTooltip.d.ts +24 -3
- package/modern/ChartsTooltip/useAxisTooltip.js +72 -38
- package/modern/ChartsTooltip/useItemTooltip.js +4 -1
- package/modern/ChartsXAxis/ChartsXAxis.js +5 -2
- package/modern/ChartsYAxis/ChartsYAxis.js +69 -17
- package/modern/LineChart/AnimatedArea.js +5 -22
- package/modern/LineChart/AnimatedLine.d.ts +1 -4
- package/modern/LineChart/AnimatedLine.js +9 -24
- package/modern/LineChart/AppearingMask.d.ts +5 -0
- package/modern/LineChart/AppearingMask.js +23 -18
- package/modern/LineChart/CircleMarkElement.js +19 -25
- package/modern/LineChart/LineChart.js +2 -0
- package/modern/LineChart/LineHighlightPlot.js +3 -4
- package/modern/LineChart/MarkElement.js +17 -28
- package/modern/LineChart/MarkPlot.js +0 -1
- package/modern/LineChart/markElementClasses.d.ts +3 -0
- package/modern/LineChart/markElementClasses.js +4 -3
- package/modern/LineChart/seriesConfig/index.js +2 -1
- package/modern/LineChart/seriesConfig/tooltip.d.ts +2 -1
- package/modern/LineChart/seriesConfig/tooltip.js +6 -0
- package/modern/PieChart/PieArc.d.ts +19 -11
- package/modern/PieChart/PieArc.js +36 -23
- package/modern/PieChart/PieArcLabel.d.ts +22 -13
- package/modern/PieChart/PieArcLabel.js +51 -47
- package/modern/PieChart/PieArcLabelPlot.js +16 -34
- package/modern/PieChart/PieArcPlot.js +21 -34
- package/modern/PieChart/seriesConfig/tooltip.js +3 -0
- package/modern/ScatterChart/ScatterChart.js +2 -0
- package/modern/SparkLineChart/SparkLineChart.js +2 -0
- package/modern/colorPalettes/colorPalettes.js +2 -2
- package/modern/constants/index.d.ts +1 -1
- package/modern/constants/index.js +1 -1
- package/modern/context/AnimationProvider/AnimationProvider.js +3 -6
- package/modern/hooks/animation/index.d.ts +6 -0
- package/modern/hooks/animation/index.js +6 -0
- package/modern/hooks/animation/useAnimateArea.d.ts +15 -0
- package/modern/hooks/animation/useAnimateArea.js +27 -0
- package/modern/hooks/animation/useAnimateBar.d.ts +17 -0
- package/modern/hooks/animation/useAnimateBar.js +56 -0
- package/modern/hooks/animation/useAnimateBarLabel.d.ts +19 -0
- package/modern/hooks/animation/useAnimateBarLabel.js +59 -0
- package/modern/hooks/animation/useAnimateLine.d.ts +14 -0
- package/modern/hooks/animation/useAnimateLine.js +26 -0
- package/modern/hooks/animation/useAnimatePieArc.d.ts +15 -0
- package/modern/hooks/animation/useAnimatePieArc.js +70 -0
- package/modern/hooks/animation/useAnimatePieArcLabel.d.ts +15 -0
- package/modern/hooks/animation/useAnimatePieArcLabel.js +72 -0
- package/modern/hooks/index.d.ts +2 -1
- package/modern/hooks/index.js +2 -1
- package/modern/hooks/useInteractionItemProps.js +11 -0
- package/modern/index.js +1 -1
- package/modern/internals/animation/Transition.d.ts +37 -0
- package/modern/internals/animation/Transition.js +83 -0
- package/modern/internals/animation/animation.d.ts +4 -0
- package/modern/internals/animation/animation.js +4 -0
- package/modern/internals/animation/useAnimate.d.ts +19 -0
- package/modern/internals/animation/useAnimate.js +74 -0
- package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.d.ts +1 -1
- package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +9 -3
- package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisTriggerTooltip.d.ts +5 -0
- package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisTriggerTooltip.js +21 -0
- package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +8 -32
- package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.d.ts +9 -1
- package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.js +60 -26
- package/modern/internals/plugins/models/seriesConfig/seriesConfig.types.d.ts +3 -1
- package/modern/internals/plugins/models/seriesConfig/tooltipGetter.types.d.ts +10 -4
- package/modern/internals/shallowEqual.d.ts +8 -0
- package/modern/internals/shallowEqual.js +31 -0
- package/modern/models/axis.d.ts +8 -0
- package/modern/themeAugmentation/overrides.d.ts +1 -1
- package/package.json +8 -9
- package/themeAugmentation/overrides.d.ts +1 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/PieChart/dataTransform/transition.d.ts +0 -4
- package/PieChart/dataTransform/transition.js +0 -145
- package/esm/PieChart/dataTransform/transition.d.ts +0 -4
- package/esm/PieChart/dataTransform/transition.js +0 -137
- package/modern/PieChart/dataTransform/transition.d.ts +0 -4
- package/modern/PieChart/dataTransform/transition.js +0 -137
|
@@ -3,45 +3,79 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.selectorChartsInteractionYAxisValue = exports.
|
|
6
|
+
exports.selectorChartsInteractionYAxisValues = exports.selectorChartsInteractionYAxisValue = exports.selectorChartsInteractionYAxisIndexes = exports.selectorChartsInteractionYAxisIndex = exports.selectorChartsInteractionXAxisValues = exports.selectorChartsInteractionXAxisValue = exports.selectorChartsInteractionXAxisIndexes = exports.selectorChartsInteractionXAxisIndex = exports.selectorChartsInteractionTooltipYAxes = exports.selectorChartsInteractionTooltipXAxes = exports.selectorChartsInteractionAxisTooltip = void 0;
|
|
7
7
|
var _selectors = require("../../utils/selectors");
|
|
8
8
|
var _useChartInteraction = require("../useChartInteraction/useChartInteraction.selectors");
|
|
9
9
|
var _getAxisValue = require("./getAxisValue");
|
|
10
10
|
var _useChartCartesianAxisRendering = require("./useChartCartesianAxisRendering.selectors");
|
|
11
|
-
const
|
|
12
|
-
|
|
11
|
+
const optionalGetAxisId = (_, id) => id;
|
|
12
|
+
const optionalGetAxisIds = (_, ids) => ids;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Get interaction indexes
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
function indexGetter(value, axes, ids = axes.axisIds[0]) {
|
|
19
|
+
return Array.isArray(ids) ? ids.map(id => (0, _getAxisValue.getAxisIndex)(axes.axis[id], value)) : (0, _getAxisValue.getAxisIndex)(axes.axis[ids], value);
|
|
20
|
+
}
|
|
21
|
+
const selectorChartsInteractionXAxisIndex = exports.selectorChartsInteractionXAxisIndex = (0, _selectors.createSelector)([_useChartInteraction.selectorChartsInteractionPointerX, _useChartCartesianAxisRendering.selectorChartXAxis, optionalGetAxisId], (value, axes, id) => value === null ? null : indexGetter(value, axes, id));
|
|
22
|
+
const selectorChartsInteractionXAxisIndexes = exports.selectorChartsInteractionXAxisIndexes = (0, _selectors.createSelector)([_useChartInteraction.selectorChartsInteractionPointerX, _useChartCartesianAxisRendering.selectorChartXAxis, optionalGetAxisIds], (value, axes, ids) => value === null ? null : indexGetter(value, axes, ids));
|
|
23
|
+
const selectorChartsInteractionYAxisIndex = exports.selectorChartsInteractionYAxisIndex = (0, _selectors.createSelector)([_useChartInteraction.selectorChartsInteractionPointerY, _useChartCartesianAxisRendering.selectorChartYAxis, optionalGetAxisId], (value, axes, id) => value === null ? null : indexGetter(value, axes, id));
|
|
24
|
+
const selectorChartsInteractionYAxisIndexes = exports.selectorChartsInteractionYAxisIndexes = (0, _selectors.createSelector)([_useChartInteraction.selectorChartsInteractionPointerY, _useChartCartesianAxisRendering.selectorChartYAxis, optionalGetAxisIds], (value, axes, ids) => value === null ? null : indexGetter(value, axes, ids));
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Get interaction values
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
function valueGetter(value, axes, indexes, ids = axes.axisIds[0]) {
|
|
31
|
+
return Array.isArray(ids) ? ids.map((id, axisIndex) => (0, _getAxisValue.getAxisValue)(axes.axis[id], value, indexes[axisIndex])) : (0, _getAxisValue.getAxisValue)(axes.axis[ids], value, indexes);
|
|
32
|
+
}
|
|
33
|
+
const selectorChartsInteractionXAxisValues = exports.selectorChartsInteractionXAxisValues = (0, _selectors.createSelector)([_useChartInteraction.selectorChartsInteractionPointerX, _useChartCartesianAxisRendering.selectorChartXAxis, selectorChartsInteractionXAxisIndexes, optionalGetAxisIds], (value, axes, indexes, ids) => value === null ? null : valueGetter(value, axes, indexes, ids));
|
|
34
|
+
const selectorChartsInteractionXAxisValue = exports.selectorChartsInteractionXAxisValue = (0, _selectors.createSelector)([_useChartInteraction.selectorChartsInteractionPointerX, _useChartCartesianAxisRendering.selectorChartXAxis, selectorChartsInteractionXAxisIndex, optionalGetAxisId], (x, xAxes, xIndex, id) => {
|
|
35
|
+
if (x === null || xIndex === null || xAxes.axisIds.length === 0) {
|
|
13
36
|
return null;
|
|
14
37
|
}
|
|
15
|
-
return (
|
|
38
|
+
return valueGetter(x, xAxes, xIndex, id);
|
|
16
39
|
});
|
|
17
|
-
const
|
|
18
|
-
|
|
40
|
+
const selectorChartsInteractionYAxisValues = exports.selectorChartsInteractionYAxisValues = (0, _selectors.createSelector)([_useChartInteraction.selectorChartsInteractionPointerY, _useChartCartesianAxisRendering.selectorChartYAxis, selectorChartsInteractionYAxisIndexes, optionalGetAxisIds], (value, axes, indexes, ids) => value === null ? null : valueGetter(value, axes, indexes, ids));
|
|
41
|
+
const selectorChartsInteractionYAxisValue = exports.selectorChartsInteractionYAxisValue = (0, _selectors.createSelector)([_useChartInteraction.selectorChartsInteractionPointerY, _useChartCartesianAxisRendering.selectorChartYAxis, selectorChartsInteractionYAxisIndex, optionalGetAxisId], (y, yAxes, yIndex, id) => {
|
|
42
|
+
if (y === null || yIndex === null || yAxes.axisIds.length === 0) {
|
|
19
43
|
return null;
|
|
20
44
|
}
|
|
21
|
-
return (
|
|
45
|
+
return valueGetter(y, yAxes, yIndex, id);
|
|
22
46
|
});
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Get x-axis ids and corresponding data index that should be display in the tooltip.
|
|
50
|
+
*/
|
|
51
|
+
const selectorChartsInteractionTooltipXAxes = exports.selectorChartsInteractionTooltipXAxes = (0, _selectors.createSelector)([_useChartInteraction.selectorChartsInteractionPointerX, _useChartCartesianAxisRendering.selectorChartXAxis], (value, axes) => {
|
|
52
|
+
if (value === null) {
|
|
53
|
+
return [];
|
|
26
54
|
}
|
|
27
|
-
return (
|
|
55
|
+
return axes.axisIds.filter(id => axes.axis[id].triggerTooltip).map(axisId => ({
|
|
56
|
+
axisId,
|
|
57
|
+
dataIndex: (0, _getAxisValue.getAxisIndex)(axes.axis[axisId], value)
|
|
58
|
+
})).filter(({
|
|
59
|
+
dataIndex
|
|
60
|
+
}) => dataIndex >= 0);
|
|
28
61
|
});
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Get y-axis ids and corresponding data index that should be display in the tooltip.
|
|
65
|
+
*/
|
|
66
|
+
const selectorChartsInteractionTooltipYAxes = exports.selectorChartsInteractionTooltipYAxes = (0, _selectors.createSelector)([_useChartInteraction.selectorChartsInteractionPointerY, _useChartCartesianAxisRendering.selectorChartYAxis], (value, axes) => {
|
|
67
|
+
if (value === null) {
|
|
68
|
+
return [];
|
|
32
69
|
}
|
|
33
|
-
return (
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
});
|
|
40
|
-
const selectorChartsInteractionYAxis = exports.selectorChartsInteractionYAxis = (0, _selectors.createSelector)([selectorChartsInteractionYAxisIndex, selectorChartsInteractionYAxisValue], (index, value) => index === null || value === null ? null : {
|
|
41
|
-
index,
|
|
42
|
-
value
|
|
70
|
+
return axes.axisIds.filter(id => axes.axis[id].triggerTooltip).map(axisId => ({
|
|
71
|
+
axisId,
|
|
72
|
+
dataIndex: (0, _getAxisValue.getAxisIndex)(axes.axis[axisId], value)
|
|
73
|
+
})).filter(({
|
|
74
|
+
dataIndex
|
|
75
|
+
}) => dataIndex >= 0);
|
|
43
76
|
});
|
|
44
77
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
78
|
+
/**
|
|
79
|
+
* Return `true` if the axis tooltip has something to display.
|
|
80
|
+
*/
|
|
81
|
+
const selectorChartsInteractionAxisTooltip = exports.selectorChartsInteractionAxisTooltip = (0, _selectors.createSelector)([selectorChartsInteractionTooltipXAxes, selectorChartsInteractionTooltipYAxes], (xTooltip, yTooltip) => xTooltip.length > 0 || yTooltip.length > 0);
|
|
@@ -3,7 +3,7 @@ import type { CartesianChartSeriesType, ChartSeriesType, PolarChartSeriesType }
|
|
|
3
3
|
import type { ColorProcessor } from './colorProcessor.types';
|
|
4
4
|
import type { CartesianExtremumGetter } from './cartesianExtremumGetter.types';
|
|
5
5
|
import type { LegendGetter } from './legendGetter.types';
|
|
6
|
-
import type { TooltipGetter } from './tooltipGetter.types';
|
|
6
|
+
import type { AxisTooltipGetter, TooltipGetter } from './tooltipGetter.types';
|
|
7
7
|
import { PolarExtremumGetter } from "./polarExtremumGetter.types.js";
|
|
8
8
|
import { GetSeriesWithDefaultValues } from "./getSeriesWithDefaultValues.types.js";
|
|
9
9
|
export type ChartSeriesTypeConfig<TSeriesType extends ChartSeriesType> = {
|
|
@@ -15,8 +15,10 @@ export type ChartSeriesTypeConfig<TSeriesType extends ChartSeriesType> = {
|
|
|
15
15
|
} & (TSeriesType extends CartesianChartSeriesType ? {
|
|
16
16
|
xExtremumGetter: CartesianExtremumGetter<TSeriesType>;
|
|
17
17
|
yExtremumGetter: CartesianExtremumGetter<TSeriesType>;
|
|
18
|
+
axisTooltipGetter?: AxisTooltipGetter<TSeriesType, 'x' | 'y'>;
|
|
18
19
|
} : {}) & (TSeriesType extends PolarChartSeriesType ? {
|
|
19
20
|
rotationExtremumGetter: PolarExtremumGetter<TSeriesType>;
|
|
20
21
|
radiusExtremumGetter: PolarExtremumGetter<TSeriesType>;
|
|
22
|
+
axisTooltipGetter?: AxisTooltipGetter<TSeriesType, 'rotation' | 'radius'>;
|
|
21
23
|
} : {});
|
|
22
24
|
export type ChartSeriesConfig<TSeriesType extends ChartSeriesType> = { [Key in TSeriesType]: ChartSeriesTypeConfig<Key> };
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import type { ItemTooltip } from '../../../../ChartsTooltip';
|
|
2
2
|
import type { ChartItemIdentifier, ChartSeriesDefaultized, ChartSeriesType } from '../../../../models/seriesType/config';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import { SeriesId } from "../../../../models/seriesType/common.js";
|
|
4
|
+
import { AxisId } from "../../../../models/axis.js";
|
|
5
|
+
export type TooltipGetter<TSeriesType extends ChartSeriesType> = (params: {
|
|
6
|
+
series: ChartSeriesDefaultized<TSeriesType>;
|
|
5
7
|
getColor: (dataIndex: number) => string;
|
|
6
|
-
identifier: ChartItemIdentifier<
|
|
7
|
-
}) => ItemTooltip<
|
|
8
|
+
identifier: ChartItemIdentifier<TSeriesType> | null;
|
|
9
|
+
}) => ItemTooltip<TSeriesType> | null;
|
|
10
|
+
export type AxisTooltipGetter<TSeriesType extends ChartSeriesType, Directions extends 'x' | 'y' | 'rotation' | 'radius' = 'x' | 'y'> = (series: Record<SeriesId, ChartSeriesDefaultized<TSeriesType>>) => {
|
|
11
|
+
direction: Directions;
|
|
12
|
+
axisId: AxisId | undefined;
|
|
13
|
+
}[];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Performs equality by iterating through keys on an object and returning false
|
|
3
|
+
* when any key has values which are not strictly equal between the arguments.
|
|
4
|
+
* Returns true when the values of all keys are strictly equal.
|
|
5
|
+
*
|
|
6
|
+
* Source: https://github.com/facebook/react/blob/c2a196174763e0b4f16ed1c512ed4442b062395e/packages/shared/shallowEqual.js#L18
|
|
7
|
+
*/
|
|
8
|
+
export declare function shallowEqual(objA: unknown, objB: unknown): boolean;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.shallowEqual = shallowEqual;
|
|
7
|
+
/**
|
|
8
|
+
* Performs equality by iterating through keys on an object and returning false
|
|
9
|
+
* when any key has values which are not strictly equal between the arguments.
|
|
10
|
+
* Returns true when the values of all keys are strictly equal.
|
|
11
|
+
*
|
|
12
|
+
* Source: https://github.com/facebook/react/blob/c2a196174763e0b4f16ed1c512ed4442b062395e/packages/shared/shallowEqual.js#L18
|
|
13
|
+
*/
|
|
14
|
+
function shallowEqual(objA, objB) {
|
|
15
|
+
if (Object.is(objA, objB)) {
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
const keysA = Object.keys(objA);
|
|
22
|
+
const keysB = Object.keys(objB);
|
|
23
|
+
if (keysA.length !== keysB.length) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Test for A's keys different from B.
|
|
28
|
+
for (let i = 0; i < keysA.length; i += 1) {
|
|
29
|
+
const currentKey = keysA[i];
|
|
30
|
+
if (!Object.prototype.hasOwnProperty.call(objB, currentKey) ||
|
|
31
|
+
// @ts-ignore
|
|
32
|
+
!Object.is(objA[currentKey], objB[currentKey])) {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return true;
|
|
37
|
+
}
|
package/models/axis.d.ts
CHANGED
|
@@ -335,6 +335,10 @@ type CommonAxisConfig<S extends ScaleName = ScaleName, V = any> = {
|
|
|
335
335
|
min: number;
|
|
336
336
|
max: number;
|
|
337
337
|
});
|
|
338
|
+
/**
|
|
339
|
+
* If `true`, the axis will be ignored by the tooltip with `trigger='axis'`.
|
|
340
|
+
*/
|
|
341
|
+
ignoreTooltip?: boolean;
|
|
338
342
|
};
|
|
339
343
|
export type PolarAxisConfig<S extends ScaleName = ScaleName, V = any, AxisProps extends ChartsAxisProps = ChartsRotationAxisProps | ChartsRadiusAxisProps> = {
|
|
340
344
|
/**
|
|
@@ -361,6 +365,10 @@ export type AxisDefaultized<S extends ScaleName = ScaleName, V = any, AxisProps
|
|
|
361
365
|
* An indication of the expected number of ticks.
|
|
362
366
|
*/
|
|
363
367
|
tickNumber: number;
|
|
368
|
+
/**
|
|
369
|
+
* Indicate if the axis should be consider by a tooltip with `trigger='axis'`.
|
|
370
|
+
*/
|
|
371
|
+
triggerTooltip?: boolean;
|
|
364
372
|
} & (AxisProps extends ChartsXAxisProps ? MakeRequired<AxisSideConfig<AxisProps>, 'height'> : AxisProps extends ChartsYAxisProps ? MakeRequired<AxisSideConfig<AxisProps>, 'width'> : AxisSideConfig<AxisProps>);
|
|
365
373
|
export declare function isBandScaleConfig(scaleConfig: AxisConfig<ScaleName>): scaleConfig is AxisConfig<'band'> & {
|
|
366
374
|
scaleType: 'band';
|
|
@@ -1,12 +1,42 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
export interface BarProps extends Omit<React.SVGProps<SVGRectElement>, 'id' | 'color' | 'ref' | 'x' | 'y' | 'height' | 'width'
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
width?: string | number | undefined;
|
|
9
|
-
}> {
|
|
2
|
+
import { SeriesId } from "../models/seriesType/common.js";
|
|
3
|
+
import { BarElementOwnerState } from "./barElementClasses.js";
|
|
4
|
+
export interface BarProps extends Omit<React.SVGProps<SVGRectElement>, 'id' | 'color' | 'ref' | 'x' | 'y' | 'height' | 'width'> {
|
|
5
|
+
id: SeriesId;
|
|
6
|
+
dataIndex: number;
|
|
7
|
+
color: string;
|
|
10
8
|
ownerState: BarElementOwnerState;
|
|
9
|
+
/**
|
|
10
|
+
* The position in the x-axis of the stack this bar belongs to.
|
|
11
|
+
*/
|
|
12
|
+
xOrigin: number;
|
|
13
|
+
/**
|
|
14
|
+
* The position in the y-axis of the stack this bar belongs to.
|
|
15
|
+
*/
|
|
16
|
+
yOrigin: number;
|
|
17
|
+
/**
|
|
18
|
+
* The position of the bar in the x-axis.
|
|
19
|
+
*/
|
|
20
|
+
x: number;
|
|
21
|
+
/**
|
|
22
|
+
* The position of the bar in the y-axis.
|
|
23
|
+
*/
|
|
24
|
+
y: number;
|
|
25
|
+
/**
|
|
26
|
+
* The height of the bar.
|
|
27
|
+
*/
|
|
28
|
+
height: number;
|
|
29
|
+
/**
|
|
30
|
+
* The width of the bar.
|
|
31
|
+
*/
|
|
32
|
+
width: number;
|
|
33
|
+
/**
|
|
34
|
+
* The orientation of the bar.
|
|
35
|
+
*/
|
|
36
|
+
layout: 'vertical' | 'horizontal';
|
|
37
|
+
/**
|
|
38
|
+
* If true, no animations should be applied.
|
|
39
|
+
*/
|
|
40
|
+
skipAnimation: boolean;
|
|
11
41
|
}
|
|
12
42
|
export declare function AnimatedBarElement(props: BarProps): React.JSX.Element;
|
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
-
const _excluded = ["ownerState"];
|
|
5
|
+
const _excluded = ["ownerState", "skipAnimation", "id", "dataIndex", "xOrigin", "yOrigin"];
|
|
6
6
|
import * as React from 'react';
|
|
7
|
-
import {
|
|
7
|
+
import { useAnimateBar } from "../hooks/animation/useAnimateBar.js";
|
|
8
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
9
|
export function AnimatedBarElement(props) {
|
|
10
10
|
const {
|
|
11
11
|
ownerState
|
|
12
12
|
} = props,
|
|
13
13
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
const animatedProps = useAnimateBar(props);
|
|
15
|
+
return /*#__PURE__*/_jsx("rect", _extends({}, other, {
|
|
16
16
|
filter: ownerState.isHighlighted ? 'brightness(120%)' : undefined,
|
|
17
17
|
opacity: ownerState.isFaded ? 0.3 : 1
|
|
18
|
-
}));
|
|
18
|
+
}, animatedProps));
|
|
19
19
|
}
|
|
@@ -238,6 +238,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
238
238
|
height: PropTypes.number,
|
|
239
239
|
hideTooltip: PropTypes.bool,
|
|
240
240
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
241
|
+
ignoreTooltip: PropTypes.bool,
|
|
241
242
|
label: PropTypes.string,
|
|
242
243
|
labelStyle: PropTypes.object,
|
|
243
244
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
@@ -293,6 +294,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
293
294
|
fill: PropTypes.string,
|
|
294
295
|
hideTooltip: PropTypes.bool,
|
|
295
296
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
297
|
+
ignoreTooltip: PropTypes.bool,
|
|
296
298
|
label: PropTypes.string,
|
|
297
299
|
labelStyle: PropTypes.object,
|
|
298
300
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
@@ -1,11 +1,29 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { GetRadiusData } from "./getRadius.js";
|
|
3
|
+
type UseAnimateBarClipRectParams = Pick<BarClipRectProps, 'x' | 'y' | 'width' | 'height' | 'skipAnimation'> & {
|
|
4
|
+
ref?: React.Ref<SVGRectElement>;
|
|
5
|
+
borderRadius: number;
|
|
6
|
+
ownerState: Omit<GetRadiusData, 'borderRadius'>;
|
|
7
|
+
};
|
|
8
|
+
type UseAnimateBarClipRectReturn = {
|
|
9
|
+
ref: React.Ref<SVGRectElement>;
|
|
10
|
+
style: React.CSSProperties;
|
|
11
|
+
} & Pick<BarClipRectProps, 'x' | 'y' | 'width' | 'height'>;
|
|
12
|
+
export declare function useAnimateBarClipRect(props: UseAnimateBarClipRectParams): UseAnimateBarClipRectReturn;
|
|
13
|
+
interface BarClipRectProps extends Pick<BarClipPathProps, 'x' | 'y' | 'width' | 'height' | 'skipAnimation'> {
|
|
14
|
+
ownerState: GetRadiusData;
|
|
15
|
+
}
|
|
2
16
|
export interface BarClipPathProps {
|
|
3
17
|
maskId: string;
|
|
4
18
|
borderRadius?: number;
|
|
5
19
|
hasNegative: boolean;
|
|
6
20
|
hasPositive: boolean;
|
|
7
21
|
layout?: 'vertical' | 'horizontal';
|
|
8
|
-
|
|
22
|
+
x: number;
|
|
23
|
+
y: number;
|
|
24
|
+
width: number;
|
|
25
|
+
height: number;
|
|
26
|
+
skipAnimation: boolean;
|
|
9
27
|
}
|
|
10
28
|
/**
|
|
11
29
|
* @ignore - internal component.
|
|
@@ -1,31 +1,94 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
4
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
const _excluded = ["
|
|
5
|
+
const _excluded = ["maskId", "x", "y", "width", "height", "skipAnimation"];
|
|
4
6
|
import * as React from 'react';
|
|
5
|
-
import {
|
|
7
|
+
import { interpolateNumber } from '@mui/x-charts-vendor/d3-interpolate';
|
|
8
|
+
import { useAnimate } from "../internals/animation/useAnimate.js";
|
|
6
9
|
import { getRadius } from "./getRadius.js";
|
|
7
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return /*#__PURE__*/_jsx(animated.rect, {
|
|
12
|
-
style: _extends({}, props.style, {
|
|
13
|
-
clipPath: (props.ownerState.layout === 'vertical' ? props.style?.height : props.style?.width).to(value => buildInset({
|
|
14
|
-
topLeft: Math.min(value, getRadius('top-left', radiusData)),
|
|
15
|
-
topRight: Math.min(value, getRadius('top-right', radiusData)),
|
|
16
|
-
bottomRight: Math.min(value, getRadius('bottom-right', radiusData)),
|
|
17
|
-
bottomLeft: Math.min(value, getRadius('bottom-left', radiusData))
|
|
18
|
-
}))
|
|
19
|
-
})
|
|
11
|
+
function buildClipPath(size, borderRadius, ownerState) {
|
|
12
|
+
const radiusData = _extends({}, ownerState, {
|
|
13
|
+
borderRadius
|
|
20
14
|
});
|
|
15
|
+
const topLeft = Math.min(size, getRadius('top-left', radiusData));
|
|
16
|
+
const topRight = Math.min(size, getRadius('top-right', radiusData));
|
|
17
|
+
const bottomRight = Math.min(size, getRadius('bottom-right', radiusData));
|
|
18
|
+
const bottomLeft = Math.min(size, getRadius('bottom-left', radiusData));
|
|
19
|
+
return `inset(0px round ${topLeft}px ${topRight}px ${bottomRight}px ${bottomLeft}px)`;
|
|
20
|
+
}
|
|
21
|
+
function barClipRectPropsInterpolator(from, to) {
|
|
22
|
+
const interpolateX = interpolateNumber(from.x, to.x);
|
|
23
|
+
const interpolateY = interpolateNumber(from.y, to.y);
|
|
24
|
+
const interpolateWidth = interpolateNumber(from.width, to.width);
|
|
25
|
+
const interpolateHeight = interpolateNumber(from.height, to.height);
|
|
26
|
+
const interpolateBorderRadius = interpolateNumber(from.borderRadius, to.borderRadius);
|
|
27
|
+
return t => {
|
|
28
|
+
return {
|
|
29
|
+
x: interpolateX(t),
|
|
30
|
+
y: interpolateY(t),
|
|
31
|
+
width: interpolateWidth(t),
|
|
32
|
+
height: interpolateHeight(t),
|
|
33
|
+
borderRadius: interpolateBorderRadius(t)
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export function useAnimateBarClipRect(props) {
|
|
38
|
+
const initialProps = {
|
|
39
|
+
x: props.x,
|
|
40
|
+
y: props.y + (props.ownerState.layout === 'vertical' ? props.height : 0),
|
|
41
|
+
width: props.ownerState.layout === 'vertical' ? props.width : 0,
|
|
42
|
+
height: props.ownerState.layout === 'vertical' ? 0 : props.height,
|
|
43
|
+
borderRadius: props.borderRadius
|
|
44
|
+
};
|
|
45
|
+
const ref = useAnimate({
|
|
46
|
+
x: props.x,
|
|
47
|
+
y: props.y,
|
|
48
|
+
width: props.width,
|
|
49
|
+
height: props.height,
|
|
50
|
+
borderRadius: props.borderRadius
|
|
51
|
+
}, {
|
|
52
|
+
createInterpolator: barClipRectPropsInterpolator,
|
|
53
|
+
applyProps(element, animatedProps) {
|
|
54
|
+
element.setAttribute('x', animatedProps.x.toString());
|
|
55
|
+
element.setAttribute('y', animatedProps.y.toString());
|
|
56
|
+
element.setAttribute('width', animatedProps.width.toString());
|
|
57
|
+
element.setAttribute('height', animatedProps.height.toString());
|
|
58
|
+
element.style.clipPath = buildClipPath(props.ownerState.layout === 'vertical' ? animatedProps.height : animatedProps.width, animatedProps.borderRadius, props.ownerState);
|
|
59
|
+
},
|
|
60
|
+
initialProps,
|
|
61
|
+
skip: props.skipAnimation
|
|
62
|
+
});
|
|
63
|
+
const usedProps = props.skipAnimation ? props : initialProps;
|
|
64
|
+
return {
|
|
65
|
+
ref,
|
|
66
|
+
x: usedProps.x,
|
|
67
|
+
y: usedProps.y,
|
|
68
|
+
width: usedProps.width,
|
|
69
|
+
height: usedProps.height,
|
|
70
|
+
style: {
|
|
71
|
+
clipPath: buildClipPath(props.ownerState.layout === 'vertical' ? usedProps.height : usedProps.width, usedProps.borderRadius, props.ownerState)
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function BarClipRect(props) {
|
|
76
|
+
const animatedProps = useAnimateBarClipRect(_extends({}, props, {
|
|
77
|
+
borderRadius: props.ownerState.borderRadius ?? 0
|
|
78
|
+
}));
|
|
79
|
+
return /*#__PURE__*/_jsx("rect", _extends({}, animatedProps));
|
|
21
80
|
}
|
|
22
81
|
/**
|
|
23
82
|
* @ignore - internal component.
|
|
24
83
|
*/
|
|
25
84
|
function BarClipPath(props) {
|
|
26
85
|
const {
|
|
27
|
-
|
|
28
|
-
|
|
86
|
+
maskId,
|
|
87
|
+
x,
|
|
88
|
+
y,
|
|
89
|
+
width,
|
|
90
|
+
height,
|
|
91
|
+
skipAnimation
|
|
29
92
|
} = props,
|
|
30
93
|
rest = _objectWithoutPropertiesLoose(props, _excluded);
|
|
31
94
|
if (!props.borderRadius || props.borderRadius <= 0) {
|
|
@@ -35,7 +98,11 @@ function BarClipPath(props) {
|
|
|
35
98
|
id: maskId,
|
|
36
99
|
children: /*#__PURE__*/_jsx(BarClipRect, {
|
|
37
100
|
ownerState: rest,
|
|
38
|
-
|
|
101
|
+
x: x,
|
|
102
|
+
y: y,
|
|
103
|
+
width: width,
|
|
104
|
+
height: height,
|
|
105
|
+
skipAnimation: skipAnimation
|
|
39
106
|
})
|
|
40
107
|
});
|
|
41
108
|
}
|
|
@@ -1,26 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { SlotComponentPropsFromProps } from '@mui/x-internals/types';
|
|
3
|
-
import {
|
|
3
|
+
import { BarElementOwnerState } from "./barElementClasses.js";
|
|
4
4
|
import { BarProps } from "./AnimatedBarElement.js";
|
|
5
|
-
export interface BarElementClasses {
|
|
6
|
-
/** Styles applied to the root element. */
|
|
7
|
-
root: string;
|
|
8
|
-
/** Styles applied to the root element if it is highlighted. */
|
|
9
|
-
highlighted: string;
|
|
10
|
-
/** Styles applied to the root element if it is faded. */
|
|
11
|
-
faded: string;
|
|
12
|
-
}
|
|
13
|
-
export type BarElementClassKey = keyof BarElementClasses;
|
|
14
|
-
export interface BarElementOwnerState {
|
|
15
|
-
id: SeriesId;
|
|
16
|
-
dataIndex: number;
|
|
17
|
-
color: string;
|
|
18
|
-
isFaded: boolean;
|
|
19
|
-
isHighlighted: boolean;
|
|
20
|
-
classes?: Partial<BarElementClasses>;
|
|
21
|
-
}
|
|
22
|
-
export declare function getBarElementUtilityClass(slot: string): string;
|
|
23
|
-
export declare const barElementClasses: BarElementClasses;
|
|
24
5
|
export interface BarElementSlots {
|
|
25
6
|
/**
|
|
26
7
|
* The component that renders the bar.
|
|
@@ -42,6 +23,14 @@ export type BarElementProps = Omit<BarElementOwnerState, 'isFaded' | 'isHighligh
|
|
|
42
23
|
* @default {}
|
|
43
24
|
*/
|
|
44
25
|
slots?: BarElementSlots;
|
|
26
|
+
x: number;
|
|
27
|
+
xOrigin: number;
|
|
28
|
+
y: number;
|
|
29
|
+
yOrigin: number;
|
|
30
|
+
width: number;
|
|
31
|
+
height: number;
|
|
32
|
+
layout: 'horizontal' | 'vertical';
|
|
33
|
+
skipAnimation: boolean;
|
|
45
34
|
};
|
|
46
35
|
declare function BarElement(props: BarElementProps): React.JSX.Element;
|
|
47
36
|
declare namespace BarElement {
|
|
@@ -2,33 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
-
const _excluded = ["id", "dataIndex", "classes", "color", "slots", "slotProps", "style", "onClick"];
|
|
5
|
+
const _excluded = ["id", "dataIndex", "classes", "color", "slots", "slotProps", "style", "onClick", "skipAnimation", "layout", "x", "xOrigin", "y", "yOrigin", "width", "height"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
|
-
import composeClasses from '@mui/utils/composeClasses';
|
|
9
8
|
import useSlotProps from '@mui/utils/useSlotProps';
|
|
10
|
-
import
|
|
11
|
-
import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
|
|
9
|
+
import { useUtilityClasses } from "./barElementClasses.js";
|
|
12
10
|
import { useInteractionItemProps } from "../hooks/useInteractionItemProps.js";
|
|
13
11
|
import { useItemHighlighted } from "../hooks/useItemHighlighted.js";
|
|
14
12
|
import { AnimatedBarElement } from "./AnimatedBarElement.js";
|
|
15
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
|
-
export function getBarElementUtilityClass(slot) {
|
|
17
|
-
return generateUtilityClass('MuiBarElement', slot);
|
|
18
|
-
}
|
|
19
|
-
export const barElementClasses = generateUtilityClasses('MuiBarElement', ['root', 'highlighted', 'faded']);
|
|
20
|
-
const useUtilityClasses = ownerState => {
|
|
21
|
-
const {
|
|
22
|
-
classes,
|
|
23
|
-
id,
|
|
24
|
-
isHighlighted,
|
|
25
|
-
isFaded
|
|
26
|
-
} = ownerState;
|
|
27
|
-
const slots = {
|
|
28
|
-
root: ['root', `series-${id}`, isHighlighted && 'highlighted', isFaded && 'faded']
|
|
29
|
-
};
|
|
30
|
-
return composeClasses(slots, getBarElementUtilityClass, classes);
|
|
31
|
-
};
|
|
32
14
|
function BarElement(props) {
|
|
33
15
|
const {
|
|
34
16
|
id,
|
|
@@ -38,7 +20,15 @@ function BarElement(props) {
|
|
|
38
20
|
slots,
|
|
39
21
|
slotProps,
|
|
40
22
|
style,
|
|
41
|
-
onClick
|
|
23
|
+
onClick,
|
|
24
|
+
skipAnimation,
|
|
25
|
+
layout,
|
|
26
|
+
x,
|
|
27
|
+
xOrigin,
|
|
28
|
+
y,
|
|
29
|
+
yOrigin,
|
|
30
|
+
width,
|
|
31
|
+
height
|
|
42
32
|
} = props,
|
|
43
33
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
44
34
|
const interactionProps = useInteractionItemProps({
|
|
@@ -68,11 +58,22 @@ function BarElement(props) {
|
|
|
68
58
|
externalSlotProps: slotProps?.bar,
|
|
69
59
|
externalForwardedProps: other,
|
|
70
60
|
additionalProps: _extends({}, interactionProps, {
|
|
61
|
+
id,
|
|
62
|
+
dataIndex,
|
|
63
|
+
color,
|
|
64
|
+
x,
|
|
65
|
+
xOrigin,
|
|
66
|
+
y,
|
|
67
|
+
yOrigin,
|
|
68
|
+
width,
|
|
69
|
+
height,
|
|
71
70
|
style,
|
|
72
71
|
onClick,
|
|
73
72
|
cursor: onClick ? 'pointer' : 'unset',
|
|
74
73
|
stroke: 'none',
|
|
75
|
-
fill: color
|
|
74
|
+
fill: color,
|
|
75
|
+
skipAnimation,
|
|
76
|
+
layout
|
|
76
77
|
}),
|
|
77
78
|
className: classes.root,
|
|
78
79
|
ownerState
|
|
@@ -87,6 +88,8 @@ process.env.NODE_ENV !== "production" ? BarElement.propTypes = {
|
|
|
87
88
|
classes: PropTypes.object,
|
|
88
89
|
dataIndex: PropTypes.number.isRequired,
|
|
89
90
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
91
|
+
layout: PropTypes.oneOf(['horizontal', 'vertical']).isRequired,
|
|
92
|
+
skipAnimation: PropTypes.bool.isRequired,
|
|
90
93
|
/**
|
|
91
94
|
* The props used for each component slot.
|
|
92
95
|
* @default {}
|
|
@@ -96,6 +99,8 @@ process.env.NODE_ENV !== "production" ? BarElement.propTypes = {
|
|
|
96
99
|
* Overridable component slots.
|
|
97
100
|
* @default {}
|
|
98
101
|
*/
|
|
99
|
-
slots: PropTypes.object
|
|
102
|
+
slots: PropTypes.object,
|
|
103
|
+
xOrigin: PropTypes.number.isRequired,
|
|
104
|
+
yOrigin: PropTypes.number.isRequired
|
|
100
105
|
} : void 0;
|
|
101
106
|
export { BarElement };
|