@mui/x-charts 8.22.0 → 8.23.0
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/BarElement.js +1 -1
- package/BarChart/BarLabel/BarLabel.types.d.ts +3 -3
- package/BarChart/BarLabel/BarLabelItem.d.ts +1 -1
- package/BarChart/BarLabel/BarLabelPlot.d.ts +9 -9
- package/BarChart/BarLabel/getBarLabel.d.ts +3 -3
- package/BarChart/FocusedBar.js +1 -1
- package/BarChart/seriesConfig/bar/getSeriesWithDefaultValues.d.ts +18 -1
- package/BarChart/seriesConfig/bar/keyboardFocusHandler.d.ts +3 -0
- package/BarChart/seriesConfig/bar/keyboardFocusHandler.js +23 -0
- package/BarChart/seriesConfig/bar/seriesProcessor.js +2 -2
- package/BarChart/seriesConfig/index.js +3 -1
- package/CHANGELOG.md +202 -0
- package/ChartsAxisHighlight/ChartsXAxisHighlight.js +2 -3
- package/ChartsAxisHighlight/ChartsYAxisHighlight.js +2 -3
- package/ChartsBrushOverlay/ChartsBrushOverlay.js +6 -7
- package/ChartsSurface/ChartsSurface.js +7 -8
- package/ChartsTooltip/ChartsTooltipContainer.js +4 -5
- package/ChartsTooltip/useAxisTooltip.js +3 -4
- package/ChartsTooltip/useItemTooltip.js +2 -3
- package/ChartsWrapper/ChartsWrapper.js +2 -3
- package/LineChart/FocusedLineMark.js +1 -1
- package/LineChart/LineHighlightPlot.js +1 -2
- package/LineChart/MarkPlot.js +1 -2
- package/LineChart/seriesConfig/index.js +3 -1
- package/LineChart/seriesConfig/keyboardFocusHandler.d.ts +3 -0
- package/LineChart/seriesConfig/keyboardFocusHandler.js +23 -0
- package/LineChart/seriesConfig/seriesProcessor.js +2 -2
- package/PieChart/FocusedPieArc.d.ts +2 -0
- package/PieChart/FocusedPieArc.js +58 -0
- package/PieChart/PieArcPlot.js +3 -31
- package/PieChart/PieChart.js +2 -1
- package/PieChart/dataTransform/getModifiedArcProperties.d.ts +11 -0
- package/PieChart/dataTransform/getModifiedArcProperties.js +42 -0
- package/PieChart/dataTransform/useTransformData.js +16 -21
- package/PieChart/seriesConfig/index.js +3 -1
- package/PieChart/seriesConfig/keyboardFocusHandler.d.ts +3 -0
- package/PieChart/seriesConfig/keyboardFocusHandler.js +23 -0
- package/PieChart/seriesConfig/tooltipPosition.js +11 -20
- package/RadarChart/RadarAxis/useRadarAxis.js +1 -2
- package/RadarChart/RadarAxisHighlight/useRadarAxisHighlight.js +3 -4
- package/RadarChart/RadarGrid/useRadarGridData.js +1 -2
- package/RadarChart/RadarSeriesPlot/useRadarRotationIndex.js +1 -2
- package/ScatterChart/BatchScatter.js +4 -5
- package/ScatterChart/FocusedScatterMark.js +1 -1
- package/ScatterChart/Scatter.js +1 -2
- package/ScatterChart/seriesConfig/index.js +3 -1
- package/ScatterChart/seriesConfig/keyboardFocusHandler.d.ts +3 -0
- package/ScatterChart/seriesConfig/keyboardFocusHandler.js +23 -0
- package/esm/BarChart/BarElement.js +1 -1
- package/esm/BarChart/BarLabel/BarLabel.types.d.ts +3 -3
- package/esm/BarChart/BarLabel/BarLabelItem.d.ts +1 -1
- package/esm/BarChart/BarLabel/BarLabelPlot.d.ts +9 -9
- package/esm/BarChart/BarLabel/getBarLabel.d.ts +3 -3
- package/esm/BarChart/FocusedBar.js +1 -1
- package/esm/BarChart/seriesConfig/bar/getSeriesWithDefaultValues.d.ts +18 -1
- package/esm/BarChart/seriesConfig/bar/keyboardFocusHandler.d.ts +3 -0
- package/esm/BarChart/seriesConfig/bar/keyboardFocusHandler.js +17 -0
- package/esm/BarChart/seriesConfig/bar/seriesProcessor.js +1 -1
- package/esm/BarChart/seriesConfig/index.js +3 -1
- package/esm/ChartsAxisHighlight/ChartsXAxisHighlight.js +2 -3
- package/esm/ChartsAxisHighlight/ChartsYAxisHighlight.js +2 -3
- package/esm/ChartsBrushOverlay/ChartsBrushOverlay.js +6 -7
- package/esm/ChartsSurface/ChartsSurface.js +7 -8
- package/esm/ChartsTooltip/ChartsTooltipContainer.js +4 -5
- package/esm/ChartsTooltip/useAxisTooltip.js +3 -4
- package/esm/ChartsTooltip/useItemTooltip.js +2 -3
- package/esm/ChartsWrapper/ChartsWrapper.js +2 -3
- package/esm/LineChart/FocusedLineMark.js +1 -1
- package/esm/LineChart/LineHighlightPlot.js +1 -2
- package/esm/LineChart/MarkPlot.js +1 -2
- package/esm/LineChart/seriesConfig/index.js +3 -1
- package/esm/LineChart/seriesConfig/keyboardFocusHandler.d.ts +3 -0
- package/esm/LineChart/seriesConfig/keyboardFocusHandler.js +17 -0
- package/esm/LineChart/seriesConfig/seriesProcessor.js +1 -1
- package/esm/PieChart/FocusedPieArc.d.ts +2 -0
- package/esm/PieChart/FocusedPieArc.js +51 -0
- package/esm/PieChart/PieArcPlot.js +5 -33
- package/esm/PieChart/PieChart.js +2 -1
- package/esm/PieChart/dataTransform/getModifiedArcProperties.d.ts +11 -0
- package/esm/PieChart/dataTransform/getModifiedArcProperties.js +36 -0
- package/esm/PieChart/dataTransform/useTransformData.js +16 -21
- package/esm/PieChart/seriesConfig/index.js +3 -1
- package/esm/PieChart/seriesConfig/keyboardFocusHandler.d.ts +3 -0
- package/esm/PieChart/seriesConfig/keyboardFocusHandler.js +17 -0
- package/esm/PieChart/seriesConfig/tooltipPosition.js +11 -20
- package/esm/RadarChart/RadarAxis/useRadarAxis.js +1 -2
- package/esm/RadarChart/RadarAxisHighlight/useRadarAxisHighlight.js +3 -4
- package/esm/RadarChart/RadarGrid/useRadarGridData.js +1 -2
- package/esm/RadarChart/RadarSeriesPlot/useRadarRotationIndex.js +1 -2
- package/esm/ScatterChart/BatchScatter.js +4 -5
- package/esm/ScatterChart/FocusedScatterMark.js +1 -1
- package/esm/ScatterChart/Scatter.js +1 -2
- package/esm/ScatterChart/seriesConfig/index.js +3 -1
- package/esm/ScatterChart/seriesConfig/keyboardFocusHandler.d.ts +3 -0
- package/esm/ScatterChart/seriesConfig/keyboardFocusHandler.js +17 -0
- package/esm/hooks/useAxis.js +8 -9
- package/esm/hooks/useAxisSystem.js +2 -3
- package/esm/hooks/useBrush.js +1 -2
- package/esm/hooks/useChartId.js +1 -2
- package/esm/hooks/useDataset.js +1 -2
- package/esm/hooks/useDrawingArea.js +1 -2
- package/esm/hooks/useFocusedItem.d.ts +1 -12
- package/esm/hooks/useFocusedItem.js +3 -11
- package/esm/hooks/useInteractionItemProps.d.ts +3 -2
- package/esm/hooks/useInteractionItemProps.js +13 -2
- package/esm/hooks/useIsItemFocused.d.ts +4 -3
- package/esm/hooks/useIsItemFocused.js +2 -3
- package/esm/hooks/useIsItemFocusedGetter.d.ts +3 -2
- package/esm/hooks/useIsItemFocusedGetter.js +2 -1
- package/esm/hooks/useItemHighlighted.js +2 -3
- package/esm/hooks/useItemHighlightedGetter.js +2 -3
- package/esm/hooks/useLegend.js +1 -2
- package/esm/hooks/usePieSeries.js +1 -2
- package/esm/hooks/useSeries.js +1 -2
- package/esm/hooks/useSkipAnimation.js +1 -2
- package/esm/hooks/useZAxis.js +1 -2
- package/esm/index.js +1 -1
- package/esm/internals/commonNextFocusItem.d.ts +14 -0
- package/esm/internals/commonNextFocusItem.js +84 -0
- package/esm/internals/index.d.ts +1 -2
- package/esm/internals/index.js +1 -2
- package/esm/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.js +1 -2
- package/esm/internals/plugins/corePlugins/useChartSeries/useColorProcessor.js +1 -2
- package/esm/internals/plugins/featurePlugins/useChartBrush/useChartBrush.js +1 -2
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +5 -6
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useInternalIsZoomInteracting.js +1 -2
- package/esm/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.js +5 -6
- package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.js +4 -1
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/keyboardFocusHandler.types.d.ts +13 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/keyboardFocusHandler.types.js +1 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.d.ts +2 -2
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.js +12 -105
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.d.ts +5 -31
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.js +9 -15
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.d.ts +6 -21
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getNextNonEmptySeries.d.ts +15 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getNextNonEmptySeries.js +45 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getPreviousNonEmptySeries.d.ts +11 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getPreviousNonEmptySeries.js +40 -0
- package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +6 -7
- package/esm/internals/plugins/featurePlugins/useChartTooltip/useChartTooltip.selectors.d.ts +1 -9
- package/esm/internals/plugins/featurePlugins/useChartTooltip/useChartTooltip.selectors.js +2 -2
- package/esm/internals/plugins/featurePlugins/useChartTooltip/useChartTooltip.types.d.ts +7 -6
- package/esm/internals/plugins/models/seriesConfig/seriesConfig.types.d.ts +2 -0
- package/esm/internals/plugins/models/seriesConfig/seriesProcessor.types.d.ts +1 -1
- package/esm/internals/plugins/models/seriesConfig/tooltipGetter.types.d.ts +4 -3
- package/esm/internals/plugins/models/seriesConfig/tooltipItemPositionGetter.types.d.ts +3 -2
- package/esm/internals/seriesHasData.d.ts +4 -0
- package/esm/internals/seriesHasData.js +8 -0
- package/esm/internals/seriesSelectorOfType.js +2 -3
- package/esm/internals/stacking/index.d.ts +1 -0
- package/esm/internals/stacking/index.js +1 -0
- package/esm/internals/stacking/offset/index.d.ts +1 -0
- package/esm/internals/stacking/offset/index.js +1 -0
- package/esm/internals/stacking/offset/offsetDiverging.d.ts +8 -0
- package/esm/internals/stacking/offset/offsetDiverging.js +47 -0
- package/esm/internals/{stackSeries.d.ts → stacking/stackSeries.d.ts} +8 -8
- package/esm/internals/{stackSeries.js → stacking/stackSeries.js} +8 -6
- package/esm/models/seriesType/config.d.ts +0 -2
- package/esm/models/seriesType/index.d.ts +3 -1
- package/hooks/useAxis.js +8 -9
- package/hooks/useAxisSystem.js +2 -3
- package/hooks/useBrush.js +1 -2
- package/hooks/useChartId.js +1 -2
- package/hooks/useDataset.js +1 -2
- package/hooks/useDrawingArea.js +1 -2
- package/hooks/useFocusedItem.d.ts +1 -12
- package/hooks/useFocusedItem.js +1 -11
- package/hooks/useInteractionItemProps.d.ts +3 -2
- package/hooks/useInteractionItemProps.js +13 -2
- package/hooks/useIsItemFocused.d.ts +4 -3
- package/hooks/useIsItemFocused.js +2 -3
- package/hooks/useIsItemFocusedGetter.d.ts +3 -2
- package/hooks/useIsItemFocusedGetter.js +2 -1
- package/hooks/useItemHighlighted.js +2 -3
- package/hooks/useItemHighlightedGetter.js +2 -3
- package/hooks/useLegend.js +1 -2
- package/hooks/usePieSeries.js +1 -2
- package/hooks/useSeries.js +1 -2
- package/hooks/useSkipAnimation.js +1 -2
- package/hooks/useZAxis.js +1 -2
- package/index.js +1 -1
- package/internals/commonNextFocusItem.d.ts +14 -0
- package/internals/commonNextFocusItem.js +93 -0
- package/internals/index.d.ts +1 -2
- package/internals/index.js +4 -16
- package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.js +1 -2
- package/internals/plugins/corePlugins/useChartSeries/useColorProcessor.js +1 -2
- package/internals/plugins/featurePlugins/useChartBrush/useChartBrush.js +1 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +5 -6
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useInternalIsZoomInteracting.js +1 -2
- package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.js +5 -6
- package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.js +4 -1
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/keyboardFocusHandler.types.d.ts +13 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/keyboardFocusHandler.types.js +5 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.d.ts +2 -2
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.js +11 -104
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.d.ts +5 -31
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.js +10 -16
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.d.ts +6 -21
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getNextNonEmptySeries.d.ts +15 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getNextNonEmptySeries.js +51 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getPreviousNonEmptySeries.d.ts +11 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getPreviousNonEmptySeries.js +46 -0
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +6 -7
- package/internals/plugins/featurePlugins/useChartTooltip/useChartTooltip.selectors.d.ts +1 -9
- package/internals/plugins/featurePlugins/useChartTooltip/useChartTooltip.selectors.js +1 -1
- package/internals/plugins/featurePlugins/useChartTooltip/useChartTooltip.types.d.ts +7 -6
- package/internals/plugins/models/seriesConfig/seriesConfig.types.d.ts +2 -0
- package/internals/plugins/models/seriesConfig/seriesProcessor.types.d.ts +1 -1
- package/internals/plugins/models/seriesConfig/tooltipGetter.types.d.ts +4 -3
- package/internals/plugins/models/seriesConfig/tooltipItemPositionGetter.types.d.ts +3 -2
- package/internals/seriesHasData.d.ts +4 -0
- package/internals/seriesHasData.js +14 -0
- package/internals/seriesSelectorOfType.js +2 -3
- package/internals/stacking/index.d.ts +1 -0
- package/internals/stacking/index.js +16 -0
- package/internals/stacking/offset/index.d.ts +1 -0
- package/internals/stacking/offset/index.js +16 -0
- package/internals/stacking/offset/offsetDiverging.d.ts +8 -0
- package/internals/stacking/offset/offsetDiverging.js +53 -0
- package/internals/{stackSeries.d.ts → stacking/stackSeries.d.ts} +8 -8
- package/internals/{stackSeries.js → stacking/stackSeries.js} +3 -1
- package/models/seriesType/config.d.ts +0 -2
- package/models/seriesType/index.d.ts +3 -1
- package/package.json +4 -4
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/isFocusableSeriesType.d.ts +0 -3
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/isFocusableSeriesType.js +0 -4
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.helpers.d.ts +0 -21
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.helpers.js +0 -92
- package/esm/internals/store/useSelector.d.ts +0 -2
- package/esm/internals/store/useSelector.js +0 -2
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/isFocusableSeriesType.d.ts +0 -3
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/isFocusableSeriesType.js +0 -10
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.helpers.d.ts +0 -21
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.helpers.js +0 -99
- package/internals/store/useSelector.d.ts +0 -2
- package/internals/store/useSelector.js +0 -8
package/hooks/useAxis.js
CHANGED
|
@@ -14,7 +14,6 @@ exports.useYAxes = useYAxes;
|
|
|
14
14
|
exports.useYAxis = useYAxis;
|
|
15
15
|
var _useChartCartesianAxisRendering = require("../internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors");
|
|
16
16
|
var _useChartPolarAxis = require("../internals/plugins/featurePlugins/useChartPolarAxis");
|
|
17
|
-
var _useSelector = require("../internals/store/useSelector");
|
|
18
17
|
var _useStore = require("../internals/store/useStore");
|
|
19
18
|
/**
|
|
20
19
|
* Get all the x-axes.
|
|
@@ -36,7 +35,7 @@ function useXAxes() {
|
|
|
36
35
|
const {
|
|
37
36
|
axis: xAxis,
|
|
38
37
|
axisIds: xAxisIds
|
|
39
|
-
} =
|
|
38
|
+
} = store.use(_useChartCartesianAxisRendering.selectorChartXAxis);
|
|
40
39
|
return {
|
|
41
40
|
xAxis,
|
|
42
41
|
xAxisIds
|
|
@@ -63,7 +62,7 @@ function useYAxes() {
|
|
|
63
62
|
const {
|
|
64
63
|
axis: yAxis,
|
|
65
64
|
axisIds: yAxisIds
|
|
66
|
-
} =
|
|
65
|
+
} = store.use(_useChartCartesianAxisRendering.selectorChartYAxis);
|
|
67
66
|
return {
|
|
68
67
|
yAxis,
|
|
69
68
|
yAxisIds
|
|
@@ -91,7 +90,7 @@ function useXAxis(axisId) {
|
|
|
91
90
|
const {
|
|
92
91
|
axis: xAxis,
|
|
93
92
|
axisIds: xAxisIds
|
|
94
|
-
} =
|
|
93
|
+
} = store.use(_useChartCartesianAxisRendering.selectorChartXAxis);
|
|
95
94
|
const id = axisId ?? xAxisIds[0];
|
|
96
95
|
return xAxis[id];
|
|
97
96
|
}
|
|
@@ -117,7 +116,7 @@ function useYAxis(axisId) {
|
|
|
117
116
|
const {
|
|
118
117
|
axis: yAxis,
|
|
119
118
|
axisIds: yAxisIds
|
|
120
|
-
} =
|
|
119
|
+
} = store.use(_useChartCartesianAxisRendering.selectorChartYAxis);
|
|
121
120
|
const id = axisId ?? yAxisIds[0];
|
|
122
121
|
return yAxis[id];
|
|
123
122
|
}
|
|
@@ -142,7 +141,7 @@ function useRotationAxes() {
|
|
|
142
141
|
const {
|
|
143
142
|
axis: rotationAxis,
|
|
144
143
|
axisIds: rotationAxisIds
|
|
145
|
-
} =
|
|
144
|
+
} = store.use(_useChartPolarAxis.selectorChartRotationAxis);
|
|
146
145
|
return {
|
|
147
146
|
rotationAxis,
|
|
148
147
|
rotationAxisIds
|
|
@@ -169,7 +168,7 @@ function useRadiusAxes() {
|
|
|
169
168
|
const {
|
|
170
169
|
axis: radiusAxis,
|
|
171
170
|
axisIds: radiusAxisIds
|
|
172
|
-
} =
|
|
171
|
+
} = store.use(_useChartPolarAxis.selectorChartRadiusAxis);
|
|
173
172
|
return {
|
|
174
173
|
radiusAxis,
|
|
175
174
|
radiusAxisIds
|
|
@@ -200,7 +199,7 @@ function useRotationAxis(axisId) {
|
|
|
200
199
|
const {
|
|
201
200
|
axis: rotationAxis,
|
|
202
201
|
axisIds: rotationAxisIds
|
|
203
|
-
} =
|
|
202
|
+
} = store.use(_useChartPolarAxis.selectorChartRotationAxis);
|
|
204
203
|
const id = axisId ?? rotationAxisIds[0];
|
|
205
204
|
return rotationAxis[id];
|
|
206
205
|
}
|
|
@@ -229,7 +228,7 @@ function useRadiusAxis(axisId) {
|
|
|
229
228
|
const {
|
|
230
229
|
axis: radiusAxis,
|
|
231
230
|
axisIds: radiusAxisIds
|
|
232
|
-
} =
|
|
231
|
+
} = store.use(_useChartPolarAxis.selectorChartRadiusAxis);
|
|
233
232
|
const id = axisId ?? radiusAxisIds[0];
|
|
234
233
|
return radiusAxis[id];
|
|
235
234
|
}
|
package/hooks/useAxisSystem.js
CHANGED
|
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.useAxisSystem = useAxisSystem;
|
|
8
8
|
var _useChartCartesianAxis = require("../internals/plugins/featurePlugins/useChartCartesianAxis");
|
|
9
9
|
var _useChartPolarAxis = require("../internals/plugins/featurePlugins/useChartPolarAxis");
|
|
10
|
-
var _useSelector = require("../internals/store/useSelector");
|
|
11
10
|
var _useStore = require("../internals/store/useStore");
|
|
12
11
|
/**
|
|
13
12
|
* @internals
|
|
@@ -18,8 +17,8 @@ var _useStore = require("../internals/store/useStore");
|
|
|
18
17
|
*/
|
|
19
18
|
function useAxisSystem() {
|
|
20
19
|
const store = (0, _useStore.useStore)();
|
|
21
|
-
const rawRotationAxis =
|
|
22
|
-
const rawXAxis =
|
|
20
|
+
const rawRotationAxis = store.use(_useChartPolarAxis.selectorChartRawRotationAxis);
|
|
21
|
+
const rawXAxis = store.use(_useChartCartesianAxis.selectorChartRawXAxis);
|
|
23
22
|
if (rawRotationAxis !== undefined) {
|
|
24
23
|
return 'polar';
|
|
25
24
|
}
|
package/hooks/useBrush.js
CHANGED
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.useBrush = useBrush;
|
|
7
7
|
var _useChartBrush = require("../internals/plugins/featurePlugins/useChartBrush");
|
|
8
|
-
var _useSelector = require("../internals/store/useSelector");
|
|
9
8
|
var _useStore = require("../internals/store/useStore");
|
|
10
9
|
/**
|
|
11
10
|
* Get the current brush state.
|
|
@@ -17,5 +16,5 @@ var _useStore = require("../internals/store/useStore");
|
|
|
17
16
|
*/
|
|
18
17
|
function useBrush() {
|
|
19
18
|
const store = (0, _useStore.useStore)();
|
|
20
|
-
return
|
|
19
|
+
return store.use(_useChartBrush.selectorBrushState);
|
|
21
20
|
}
|
package/hooks/useChartId.js
CHANGED
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.useChartId = useChartId;
|
|
8
8
|
var _useStore = require("../internals/store/useStore");
|
|
9
|
-
var _useSelector = require("../internals/store/useSelector");
|
|
10
9
|
var _useChartId = require("../internals/plugins/corePlugins/useChartId/useChartId.selectors");
|
|
11
10
|
/**
|
|
12
11
|
* Get the unique identifier of the chart.
|
|
@@ -14,5 +13,5 @@ var _useChartId = require("../internals/plugins/corePlugins/useChartId/useChartI
|
|
|
14
13
|
*/
|
|
15
14
|
function useChartId() {
|
|
16
15
|
const store = (0, _useStore.useStore)();
|
|
17
|
-
return
|
|
16
|
+
return store.use(_useChartId.selectorChartId);
|
|
18
17
|
}
|
package/hooks/useDataset.js
CHANGED
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.useDataset = useDataset;
|
|
8
8
|
var _useStore = require("../internals/store/useStore");
|
|
9
|
-
var _useSelector = require("../internals/store/useSelector");
|
|
10
9
|
var _useChartSeries = require("../internals/plugins/corePlugins/useChartSeries/useChartSeries.selectors");
|
|
11
10
|
/**
|
|
12
11
|
* Get access to the dataset used to populate series and axes data.
|
|
@@ -14,5 +13,5 @@ var _useChartSeries = require("../internals/plugins/corePlugins/useChartSeries/u
|
|
|
14
13
|
*/
|
|
15
14
|
function useDataset() {
|
|
16
15
|
const store = (0, _useStore.useStore)();
|
|
17
|
-
return
|
|
16
|
+
return store.use(_useChartSeries.selectorChartDataset);
|
|
18
17
|
}
|
package/hooks/useDrawingArea.js
CHANGED
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.useDrawingArea = useDrawingArea;
|
|
8
8
|
var _useStore = require("../internals/store/useStore");
|
|
9
|
-
var _useSelector = require("../internals/store/useSelector");
|
|
10
9
|
var _useChartDimensions = require("../internals/plugins/corePlugins/useChartDimensions/useChartDimensions.selectors");
|
|
11
10
|
/**
|
|
12
11
|
* Get the drawing area dimensions and coordinates. The drawing area is the area where the chart is rendered.
|
|
@@ -17,5 +16,5 @@ var _useChartDimensions = require("../internals/plugins/corePlugins/useChartDime
|
|
|
17
16
|
*/
|
|
18
17
|
function useDrawingArea() {
|
|
19
18
|
const store = (0, _useStore.useStore)();
|
|
20
|
-
return
|
|
19
|
+
return store.use(_useChartDimensions.selectorChartDrawingArea);
|
|
21
20
|
}
|
|
@@ -1,15 +1,4 @@
|
|
|
1
|
-
import { type ChartSeriesType } from "../models/seriesType/config.js";
|
|
2
|
-
import { type SeriesId } from "../models/seriesType/common.js";
|
|
3
|
-
export type FocusedItemData = {
|
|
4
|
-
seriesType: ChartSeriesType;
|
|
5
|
-
seriesId: SeriesId;
|
|
6
|
-
dataIndex: number;
|
|
7
|
-
};
|
|
8
1
|
/**
|
|
9
2
|
* Get the focused item from keyboard navigation.
|
|
10
3
|
*/
|
|
11
|
-
export declare function useFocusedItem():
|
|
12
|
-
seriesType: "line" | "bar" | "scatter" | "pie";
|
|
13
|
-
seriesId: SeriesId;
|
|
14
|
-
dataIndex: number;
|
|
15
|
-
} | null;
|
|
4
|
+
export declare function useFocusedItem(): import("../index.js").FocusedItemIdentifier<keyof import("../internals/index.js").ChartsSeriesConfig> | null;
|
package/hooks/useFocusedItem.js
CHANGED
|
@@ -1,26 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
'use client';
|
|
3
3
|
|
|
4
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.useFocusedItem = useFocusedItem;
|
|
9
|
-
var React = _interopRequireWildcard(require("react"));
|
|
10
8
|
var _useStore = require("../internals/store/useStore");
|
|
11
|
-
var _useSelector = require("../internals/store/useSelector");
|
|
12
9
|
var _useChartKeyboardNavigation = require("../internals/plugins/featurePlugins/useChartKeyboardNavigation");
|
|
13
10
|
/**
|
|
14
11
|
* Get the focused item from keyboard navigation.
|
|
15
12
|
*/
|
|
16
13
|
function useFocusedItem() {
|
|
17
14
|
const store = (0, _useStore.useStore)();
|
|
18
|
-
|
|
19
|
-
const focusedSeriesId = (0, _useSelector.useSelector)(store, _useChartKeyboardNavigation.selectorChartsFocusedSeriesId);
|
|
20
|
-
const focusedDataIndex = (0, _useSelector.useSelector)(store, _useChartKeyboardNavigation.selectorChartsFocusedDataIndex);
|
|
21
|
-
return React.useMemo(() => focusedSeriesType === undefined || focusedSeriesId === undefined || focusedDataIndex === undefined ? null : {
|
|
22
|
-
seriesType: focusedSeriesType,
|
|
23
|
-
seriesId: focusedSeriesId,
|
|
24
|
-
dataIndex: focusedDataIndex
|
|
25
|
-
}, [focusedSeriesType, focusedSeriesId, focusedDataIndex]);
|
|
15
|
+
return store.use(_useChartKeyboardNavigation.selectorChartsFocusedItem);
|
|
26
16
|
}
|
|
@@ -2,7 +2,8 @@ import * as React from 'react';
|
|
|
2
2
|
import { type SeriesItemIdentifierWithData } from "../models/index.js";
|
|
3
3
|
import type { UseChartHighlightSignature } from "../internals/plugins/featurePlugins/useChartHighlight/index.js";
|
|
4
4
|
import type { UseChartInteractionSignature } from "../internals/plugins/featurePlugins/useChartInteraction/index.js";
|
|
5
|
-
import type { ChartSeriesType
|
|
5
|
+
import type { ChartSeriesType } from "../models/seriesType/config.js";
|
|
6
|
+
import type { SeriesItemIdentifier } from "../models/seriesType/index.js";
|
|
6
7
|
import type { ChartInstance } from "../internals/plugins/models/index.js";
|
|
7
8
|
import type { UseChartTooltipSignature } from "../internals/plugins/featurePlugins/useChartTooltip/index.js";
|
|
8
9
|
export declare const useInteractionItemProps: (data: SeriesItemIdentifierWithData, skip?: boolean) => {
|
|
@@ -10,7 +11,7 @@ export declare const useInteractionItemProps: (data: SeriesItemIdentifierWithDat
|
|
|
10
11
|
onPointerLeave?: () => void;
|
|
11
12
|
onPointerDown?: (event: React.PointerEvent) => void;
|
|
12
13
|
};
|
|
13
|
-
export declare function getInteractionItemProps(instance: ChartInstance<[UseChartInteractionSignature, UseChartHighlightSignature, UseChartTooltipSignature]>, item:
|
|
14
|
+
export declare function getInteractionItemProps(instance: ChartInstance<[UseChartInteractionSignature, UseChartHighlightSignature, UseChartTooltipSignature]>, item: SeriesItemIdentifier<ChartSeriesType>): {
|
|
14
15
|
onPointerEnter?: () => void;
|
|
15
16
|
onPointerLeave?: () => void;
|
|
16
17
|
onPointerDown?: (event: React.PointerEvent) => void;
|
|
@@ -25,7 +25,13 @@ const useInteractionItemProps = (data, skip) => {
|
|
|
25
25
|
interactionActive.current = true;
|
|
26
26
|
instance.setLastUpdateSource('pointer');
|
|
27
27
|
instance.setTooltipItem(data);
|
|
28
|
-
|
|
28
|
+
// TODO: uniformize sankey and other types to get a single plugin
|
|
29
|
+
instance.setHighlight(
|
|
30
|
+
// @ts-ignore
|
|
31
|
+
data.type === 'sankey' ? data : {
|
|
32
|
+
seriesId: data.seriesId,
|
|
33
|
+
dataIndex: data.dataIndex
|
|
34
|
+
});
|
|
29
35
|
});
|
|
30
36
|
const onPointerLeave = (0, _useEventCallback.default)(() => {
|
|
31
37
|
interactionActive.current = false;
|
|
@@ -54,7 +60,12 @@ function getInteractionItemProps(instance, item) {
|
|
|
54
60
|
}
|
|
55
61
|
instance.setLastUpdateSource('pointer');
|
|
56
62
|
instance.setTooltipItem(item);
|
|
57
|
-
instance.setHighlight(
|
|
63
|
+
instance.setHighlight(
|
|
64
|
+
// @ts-ignore
|
|
65
|
+
item.type === 'sankey' ? item : {
|
|
66
|
+
seriesId: item.seriesId,
|
|
67
|
+
dataIndex: item.dataIndex
|
|
68
|
+
});
|
|
58
69
|
}
|
|
59
70
|
function onPointerLeave() {
|
|
60
71
|
if (!item) {
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type
|
|
1
|
+
import type { ChartSeriesType } from "../models/seriesType/config.js";
|
|
2
|
+
import type { FocusedItemIdentifier } from "../models/seriesType/index.js";
|
|
3
|
+
type UseItemFocusedParams = FocusedItemIdentifier<ChartSeriesType>;
|
|
3
4
|
/**
|
|
4
5
|
* A hook to check if an item has the focus.
|
|
5
6
|
*
|
|
6
7
|
* If you need to process multiple points, use the `useIsItemFocusedGetter` hook instead.
|
|
7
8
|
*
|
|
8
|
-
* @param {
|
|
9
|
+
* @param {FocusedItemIdentifier} item is the item to check
|
|
9
10
|
* @returns {boolean} the focus state
|
|
10
11
|
*/
|
|
11
12
|
export declare function useIsItemFocused(item: UseItemFocusedParams): boolean;
|
|
@@ -6,17 +6,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.useIsItemFocused = useIsItemFocused;
|
|
8
8
|
var _useStore = require("../internals/store/useStore");
|
|
9
|
-
var _useSelector = require("../internals/store/useSelector");
|
|
10
9
|
var _useChartKeyboardNavigation = require("../internals/plugins/featurePlugins/useChartKeyboardNavigation");
|
|
11
10
|
/**
|
|
12
11
|
* A hook to check if an item has the focus.
|
|
13
12
|
*
|
|
14
13
|
* If you need to process multiple points, use the `useIsItemFocusedGetter` hook instead.
|
|
15
14
|
*
|
|
16
|
-
* @param {
|
|
15
|
+
* @param {FocusedItemIdentifier} item is the item to check
|
|
17
16
|
* @returns {boolean} the focus state
|
|
18
17
|
*/
|
|
19
18
|
function useIsItemFocused(item) {
|
|
20
19
|
const store = (0, _useStore.useStore)();
|
|
21
|
-
return
|
|
20
|
+
return store.use(_useChartKeyboardNavigation.selectorChartsItemIsFocused, item);
|
|
22
21
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { FocusedItemIdentifier } from "../models/seriesType/index.js";
|
|
2
|
+
import type { ChartSeriesType } from "../models/seriesType/config.js";
|
|
2
3
|
/**
|
|
3
4
|
* A hook to check focus state of multiple items.
|
|
4
5
|
* If you're interested by a single one, consider using `useIsItemFocused`.
|
|
5
6
|
*
|
|
6
7
|
* @returns {(item: FocusedItemData) => boolean} callback to get the state of the item.
|
|
7
8
|
*/
|
|
8
|
-
export declare function useIsItemFocusedGetter(): (item:
|
|
9
|
+
export declare function useIsItemFocusedGetter(): (item: FocusedItemIdentifier<ChartSeriesType>) => boolean;
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.useIsItemFocusedGetter = useIsItemFocusedGetter;
|
|
8
|
+
var _fastObjectShallowCompare = require("@mui/x-internals/fastObjectShallowCompare");
|
|
8
9
|
var _useFocusedItem = require("./useFocusedItem");
|
|
9
10
|
/**
|
|
10
11
|
* A hook to check focus state of multiple items.
|
|
@@ -14,5 +15,5 @@ var _useFocusedItem = require("./useFocusedItem");
|
|
|
14
15
|
*/
|
|
15
16
|
function useIsItemFocusedGetter() {
|
|
16
17
|
const focusedItem = (0, _useFocusedItem.useFocusedItem)();
|
|
17
|
-
return item => focusedItem !== null &&
|
|
18
|
+
return item => focusedItem !== null && (0, _fastObjectShallowCompare.fastObjectShallowCompare)(focusedItem, item);
|
|
18
19
|
}
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.useItemHighlighted = useItemHighlighted;
|
|
8
8
|
var _useStore = require("../internals/store/useStore");
|
|
9
|
-
var _useSelector = require("../internals/store/useSelector");
|
|
10
9
|
var _useChartHighlight = require("../internals/plugins/featurePlugins/useChartHighlight");
|
|
11
10
|
/**
|
|
12
11
|
* A hook to check the highlighted state of the item.
|
|
@@ -19,8 +18,8 @@ var _useChartHighlight = require("../internals/plugins/featurePlugins/useChartHi
|
|
|
19
18
|
*/
|
|
20
19
|
function useItemHighlighted(item) {
|
|
21
20
|
const store = (0, _useStore.useStore)();
|
|
22
|
-
const isHighlighted =
|
|
23
|
-
const isFaded =
|
|
21
|
+
const isHighlighted = store.use(_useChartHighlight.selectorChartsIsHighlighted, item);
|
|
22
|
+
const isFaded = store.use(_useChartHighlight.selectorChartsIsFaded, item);
|
|
24
23
|
return {
|
|
25
24
|
isHighlighted,
|
|
26
25
|
isFaded: !isHighlighted && isFaded
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.useItemHighlightedGetter = useItemHighlightedGetter;
|
|
8
|
-
var _useSelector = require("../internals/store/useSelector");
|
|
9
8
|
var _useStore = require("../internals/store/useStore");
|
|
10
9
|
var _useChartHighlight = require("../internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors");
|
|
11
10
|
/**
|
|
@@ -18,8 +17,8 @@ var _useChartHighlight = require("../internals/plugins/featurePlugins/useChartHi
|
|
|
18
17
|
*/
|
|
19
18
|
function useItemHighlightedGetter() {
|
|
20
19
|
const store = (0, _useStore.useStore)();
|
|
21
|
-
const isHighlighted =
|
|
22
|
-
const isFaded =
|
|
20
|
+
const isHighlighted = store.use(_useChartHighlight.selectorChartsIsHighlightedCallback);
|
|
21
|
+
const isFaded = store.use(_useChartHighlight.selectorChartsIsFadedCallback);
|
|
23
22
|
return {
|
|
24
23
|
isHighlighted,
|
|
25
24
|
isFaded
|
package/hooks/useLegend.js
CHANGED
|
@@ -8,7 +8,6 @@ exports.useLegend = useLegend;
|
|
|
8
8
|
var _useChartSeries = require("../internals/plugins/corePlugins/useChartSeries");
|
|
9
9
|
var _useSeries = require("./useSeries");
|
|
10
10
|
var _useStore = require("../internals/store/useStore");
|
|
11
|
-
var _useSelector = require("../internals/store/useSelector");
|
|
12
11
|
function getSeriesToDisplay(series, seriesConfig) {
|
|
13
12
|
return Object.keys(series).flatMap(seriesType => {
|
|
14
13
|
const getter = seriesConfig[seriesType].legendGetter;
|
|
@@ -28,7 +27,7 @@ function getSeriesToDisplay(series, seriesConfig) {
|
|
|
28
27
|
function useLegend() {
|
|
29
28
|
const series = (0, _useSeries.useSeries)();
|
|
30
29
|
const store = (0, _useStore.useStore)();
|
|
31
|
-
const seriesConfig =
|
|
30
|
+
const seriesConfig = store.use(_useChartSeries.selectorChartSeriesConfig);
|
|
32
31
|
return {
|
|
33
32
|
items: getSeriesToDisplay(series, seriesConfig)
|
|
34
33
|
};
|
package/hooks/usePieSeries.js
CHANGED
|
@@ -10,7 +10,6 @@ exports.usePieSeriesLayout = usePieSeriesLayout;
|
|
|
10
10
|
var _seriesSelectorOfType = require("../internals/seriesSelectorOfType");
|
|
11
11
|
var _useStore = require("../internals/store/useStore");
|
|
12
12
|
var _useChartSeries = require("../internals/plugins/corePlugins/useChartSeries");
|
|
13
|
-
var _useSelector = require("../internals/store/useSelector");
|
|
14
13
|
/**
|
|
15
14
|
* Get access to the internal state of pie series.
|
|
16
15
|
*
|
|
@@ -54,6 +53,6 @@ function usePieSeriesContext() {
|
|
|
54
53
|
*/
|
|
55
54
|
function usePieSeriesLayout() {
|
|
56
55
|
const store = (0, _useStore.useStore)();
|
|
57
|
-
const seriesLayout =
|
|
56
|
+
const seriesLayout = store.use(_useChartSeries.selectorChartSeriesLayout);
|
|
58
57
|
return seriesLayout.pie ?? {};
|
|
59
58
|
}
|
package/hooks/useSeries.js
CHANGED
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.useSeries = useSeries;
|
|
8
8
|
var _useStore = require("../internals/store/useStore");
|
|
9
|
-
var _useSelector = require("../internals/store/useSelector");
|
|
10
9
|
var _useChartSeries = require("../internals/plugins/corePlugins/useChartSeries/useChartSeries.selectors");
|
|
11
10
|
/**
|
|
12
11
|
* Get access to the internal state of series.
|
|
@@ -16,5 +15,5 @@ var _useChartSeries = require("../internals/plugins/corePlugins/useChartSeries/u
|
|
|
16
15
|
*/
|
|
17
16
|
function useSeries() {
|
|
18
17
|
const store = (0, _useStore.useStore)();
|
|
19
|
-
return
|
|
18
|
+
return store.use(_useChartSeries.selectorChartSeriesProcessed);
|
|
20
19
|
}
|
|
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.useSkipAnimation = useSkipAnimation;
|
|
8
8
|
var _useChartAnimation = require("../internals/plugins/corePlugins/useChartAnimation");
|
|
9
9
|
var _useStore = require("../internals/store/useStore");
|
|
10
|
-
var _useSelector = require("../internals/store/useSelector");
|
|
11
10
|
/**
|
|
12
11
|
* A hook to get if chart animations should be skipped.
|
|
13
12
|
*
|
|
@@ -15,6 +14,6 @@ var _useSelector = require("../internals/store/useSelector");
|
|
|
15
14
|
*/
|
|
16
15
|
function useSkipAnimation(skipAnimation) {
|
|
17
16
|
const store = (0, _useStore.useStore)();
|
|
18
|
-
const storeSkipAnimation =
|
|
17
|
+
const storeSkipAnimation = store.use(_useChartAnimation.selectorChartSkipAnimation);
|
|
19
18
|
return skipAnimation || storeSkipAnimation;
|
|
20
19
|
}
|
package/hooks/useZAxis.js
CHANGED
|
@@ -8,13 +8,12 @@ exports.useZAxes = useZAxes;
|
|
|
8
8
|
exports.useZAxis = useZAxis;
|
|
9
9
|
var _useStore = require("../internals/store/useStore");
|
|
10
10
|
var _useChartZAxis = require("../internals/plugins/featurePlugins/useChartZAxis");
|
|
11
|
-
var _useSelector = require("../internals/store/useSelector");
|
|
12
11
|
function useZAxes() {
|
|
13
12
|
const store = (0, _useStore.useStore)();
|
|
14
13
|
const {
|
|
15
14
|
axis: zAxis,
|
|
16
15
|
axisIds: zAxisIds
|
|
17
|
-
} =
|
|
16
|
+
} = store.use(_useChartZAxis.selectorChartZAxis) ?? {
|
|
18
17
|
axis: {},
|
|
19
18
|
axisIds: []
|
|
20
19
|
};
|
package/index.js
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { UseChartKeyboardNavigationSignature } from "./plugins/featurePlugins/useChartKeyboardNavigation/index.js";
|
|
2
|
+
import type { ChartState } from "./plugins/models/chart.js";
|
|
3
|
+
import type { ChartSeriesType } from "../models/seriesType/config.js";
|
|
4
|
+
import type { FocusedItemIdentifier, SeriesId, SeriesItemIdentifier } from "../models/seriesType/index.js";
|
|
5
|
+
type ReturnedItem<OutSeriesType extends ChartSeriesType> = {
|
|
6
|
+
type: OutSeriesType;
|
|
7
|
+
seriesId: SeriesId;
|
|
8
|
+
dataIndex: number;
|
|
9
|
+
} | null;
|
|
10
|
+
export declare function createGetNextIndexFocusedItem<InSeriesType extends Exclude<ChartSeriesType, 'sankey'>, OutSeriesType extends Exclude<ChartSeriesType, 'sankey'> = InSeriesType>(compatibleSeriesTypes: Set<OutSeriesType>): (currentItem: FocusedItemIdentifier<InSeriesType> | null, state: ChartState<[UseChartKeyboardNavigationSignature], []>) => ReturnedItem<OutSeriesType>;
|
|
11
|
+
export declare function createGetPreviousIndexFocusedItem<InSeriesType extends Exclude<ChartSeriesType, 'sankey'>, OutSeriesType extends Exclude<ChartSeriesType, 'sankey'> = InSeriesType>(compatibleSeriesTypes: Set<OutSeriesType>): (currentItem: SeriesItemIdentifier<InSeriesType> | null, state: ChartState<[UseChartKeyboardNavigationSignature], []>) => ReturnedItem<OutSeriesType>;
|
|
12
|
+
export declare function createGetNextSeriesFocusedItem<InSeriesType extends Exclude<ChartSeriesType, 'sankey'>, OutSeriesType extends Exclude<ChartSeriesType, 'sankey'> = InSeriesType>(compatibleSeriesTypes: Set<OutSeriesType>): (currentItem: SeriesItemIdentifier<InSeriesType> | null, state: ChartState<[UseChartKeyboardNavigationSignature], []>) => ReturnedItem<OutSeriesType>;
|
|
13
|
+
export declare function createGetPreviousSeriesFocusedItem<InSeriesType extends Exclude<ChartSeriesType, 'sankey'>, OutSeriesType extends Exclude<ChartSeriesType, 'sankey'> = InSeriesType>(compatibleSeriesTypes: Set<OutSeriesType>): (currentItem: SeriesItemIdentifier<InSeriesType> | null, state: ChartState<[UseChartKeyboardNavigationSignature], []>) => ReturnedItem<OutSeriesType>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createGetNextIndexFocusedItem = createGetNextIndexFocusedItem;
|
|
7
|
+
exports.createGetNextSeriesFocusedItem = createGetNextSeriesFocusedItem;
|
|
8
|
+
exports.createGetPreviousIndexFocusedItem = createGetPreviousIndexFocusedItem;
|
|
9
|
+
exports.createGetPreviousSeriesFocusedItem = createGetPreviousSeriesFocusedItem;
|
|
10
|
+
var _getPreviousNonEmptySeries = require("./plugins/featurePlugins/useChartKeyboardNavigation/utils/getPreviousNonEmptySeries");
|
|
11
|
+
var _useChartSeries = require("./plugins/corePlugins/useChartSeries");
|
|
12
|
+
var _getNextNonEmptySeries = require("./plugins/featurePlugins/useChartKeyboardNavigation/utils/getNextNonEmptySeries");
|
|
13
|
+
var _seriesHasData = require("./seriesHasData");
|
|
14
|
+
function createGetNextIndexFocusedItem(compatibleSeriesTypes) {
|
|
15
|
+
return function getNextIndexFocusedItem(currentItem, state) {
|
|
16
|
+
const processedSeries = (0, _useChartSeries.selectorChartSeriesProcessed)(state);
|
|
17
|
+
let seriesId = currentItem?.seriesId;
|
|
18
|
+
let type = currentItem?.type;
|
|
19
|
+
if (!type || seriesId == null || !(0, _seriesHasData.seriesHasData)(processedSeries, type, seriesId)) {
|
|
20
|
+
const nextSeries = (0, _getNextNonEmptySeries.getNextNonEmptySeries)(processedSeries, compatibleSeriesTypes, type, seriesId);
|
|
21
|
+
if (nextSeries === null) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
type = nextSeries.type;
|
|
25
|
+
seriesId = nextSeries.seriesId;
|
|
26
|
+
}
|
|
27
|
+
const dataLength = processedSeries[type].series[seriesId].data.length;
|
|
28
|
+
return {
|
|
29
|
+
type,
|
|
30
|
+
seriesId,
|
|
31
|
+
dataIndex: ((currentItem?.dataIndex ?? -1) + 1) % dataLength
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function createGetPreviousIndexFocusedItem(compatibleSeriesTypes) {
|
|
36
|
+
return function getPreviousIndexFocusedItem(currentItem, state) {
|
|
37
|
+
const processedSeries = (0, _useChartSeries.selectorChartSeriesProcessed)(state);
|
|
38
|
+
let seriesId = currentItem?.seriesId;
|
|
39
|
+
let type = currentItem?.type;
|
|
40
|
+
if (!type || seriesId == null || !(0, _seriesHasData.seriesHasData)(processedSeries, type, seriesId)) {
|
|
41
|
+
const previousSeries = (0, _getPreviousNonEmptySeries.getPreviousNonEmptySeries)(processedSeries, compatibleSeriesTypes, type, seriesId);
|
|
42
|
+
if (previousSeries === null) {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
type = previousSeries.type;
|
|
46
|
+
seriesId = previousSeries.seriesId;
|
|
47
|
+
}
|
|
48
|
+
const dataLength = processedSeries[type].series[seriesId].data.length;
|
|
49
|
+
return {
|
|
50
|
+
type,
|
|
51
|
+
seriesId,
|
|
52
|
+
dataIndex: (dataLength + (currentItem?.dataIndex ?? 1) - 1) % dataLength
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function createGetNextSeriesFocusedItem(compatibleSeriesTypes) {
|
|
57
|
+
return function getNextSeriesFocusedItem(currentItem, state) {
|
|
58
|
+
const processedSeries = (0, _useChartSeries.selectorChartSeriesProcessed)(state);
|
|
59
|
+
let seriesId = currentItem?.seriesId;
|
|
60
|
+
let type = currentItem?.type;
|
|
61
|
+
const nextSeries = (0, _getNextNonEmptySeries.getNextNonEmptySeries)(processedSeries, compatibleSeriesTypes, type, seriesId);
|
|
62
|
+
if (nextSeries === null) {
|
|
63
|
+
return null; // No series to move the focus to.
|
|
64
|
+
}
|
|
65
|
+
type = nextSeries.type;
|
|
66
|
+
seriesId = nextSeries.seriesId;
|
|
67
|
+
const dataLength = processedSeries[type].series[seriesId].data.length;
|
|
68
|
+
return {
|
|
69
|
+
type,
|
|
70
|
+
seriesId,
|
|
71
|
+
dataIndex: Math.min(dataLength - 1, currentItem?.dataIndex ?? 0)
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function createGetPreviousSeriesFocusedItem(compatibleSeriesTypes) {
|
|
76
|
+
return function getPreviousSeriesFocusedItem(currentItem, state) {
|
|
77
|
+
const processedSeries = (0, _useChartSeries.selectorChartSeriesProcessed)(state);
|
|
78
|
+
let seriesId = currentItem?.seriesId;
|
|
79
|
+
let type = currentItem?.type;
|
|
80
|
+
const previousSeries = (0, _getPreviousNonEmptySeries.getPreviousNonEmptySeries)(processedSeries, compatibleSeriesTypes, type, seriesId);
|
|
81
|
+
if (previousSeries === null) {
|
|
82
|
+
return null; // No series to move the focus to.
|
|
83
|
+
}
|
|
84
|
+
type = previousSeries.type;
|
|
85
|
+
seriesId = previousSeries.seriesId;
|
|
86
|
+
const dataLength = processedSeries[type].series[seriesId].data.length;
|
|
87
|
+
return {
|
|
88
|
+
type,
|
|
89
|
+
seriesId,
|
|
90
|
+
dataIndex: Math.min(dataLength - 1, currentItem?.dataIndex ?? 0)
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
}
|
package/internals/index.d.ts
CHANGED
|
@@ -37,7 +37,6 @@ export { getAxisTriggerTooltip as getCartesianAxisTriggerTooltip } from "./plugi
|
|
|
37
37
|
export { getAxisIndex as getCartesianAxisIndex } from "./plugins/featurePlugins/useChartCartesianAxis/getAxisValue.js";
|
|
38
38
|
export * from "./store/useCharts.js";
|
|
39
39
|
export * from "./store/useStore.js";
|
|
40
|
-
export * from "./store/useSelector.js";
|
|
41
40
|
export * from "../BarChart/BarChart.plugins.js";
|
|
42
41
|
export * from "../LineChart/LineChart.plugins.js";
|
|
43
42
|
export * from "../ScatterChart/ScatterChart.plugins.js";
|
|
@@ -48,7 +47,7 @@ export * from "./getLabel.js";
|
|
|
48
47
|
export * from "./getSVGPoint.js";
|
|
49
48
|
export * from "./isDefined.js";
|
|
50
49
|
export * from "./getScale.js";
|
|
51
|
-
export * from "./
|
|
50
|
+
export * from "./stacking/index.js";
|
|
52
51
|
export * from "./getCurve.js";
|
|
53
52
|
export * from "./consumeSlots.js";
|
|
54
53
|
export * from "./consumeThemeProps.js";
|
package/internals/index.js
CHANGED
|
@@ -434,18 +434,6 @@ Object.keys(_useStore).forEach(function (key) {
|
|
|
434
434
|
}
|
|
435
435
|
});
|
|
436
436
|
});
|
|
437
|
-
var _useSelector = require("./store/useSelector");
|
|
438
|
-
Object.keys(_useSelector).forEach(function (key) {
|
|
439
|
-
if (key === "default" || key === "__esModule") return;
|
|
440
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
441
|
-
if (key in exports && exports[key] === _useSelector[key]) return;
|
|
442
|
-
Object.defineProperty(exports, key, {
|
|
443
|
-
enumerable: true,
|
|
444
|
-
get: function () {
|
|
445
|
-
return _useSelector[key];
|
|
446
|
-
}
|
|
447
|
-
});
|
|
448
|
-
});
|
|
449
437
|
var _BarChart = require("../BarChart/BarChart.plugins");
|
|
450
438
|
Object.keys(_BarChart).forEach(function (key) {
|
|
451
439
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -566,15 +554,15 @@ Object.keys(_getScale).forEach(function (key) {
|
|
|
566
554
|
}
|
|
567
555
|
});
|
|
568
556
|
});
|
|
569
|
-
var
|
|
570
|
-
Object.keys(
|
|
557
|
+
var _stacking = require("./stacking");
|
|
558
|
+
Object.keys(_stacking).forEach(function (key) {
|
|
571
559
|
if (key === "default" || key === "__esModule") return;
|
|
572
560
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
573
|
-
if (key in exports && exports[key] ===
|
|
561
|
+
if (key in exports && exports[key] === _stacking[key]) return;
|
|
574
562
|
Object.defineProperty(exports, key, {
|
|
575
563
|
enumerable: true,
|
|
576
564
|
get: function () {
|
|
577
|
-
return
|
|
565
|
+
return _stacking[key];
|
|
578
566
|
}
|
|
579
567
|
});
|
|
580
568
|
});
|
|
@@ -12,7 +12,6 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
12
12
|
var _useEffectAfterFirstRender = require("@mui/x-internals/useEffectAfterFirstRender");
|
|
13
13
|
var _useEnhancedEffect = _interopRequireDefault(require("@mui/utils/useEnhancedEffect"));
|
|
14
14
|
var _ownerWindow = _interopRequireDefault(require("@mui/utils/ownerWindow"));
|
|
15
|
-
var _useSelector = require("../../../store/useSelector");
|
|
16
15
|
var _constants = require("../../../../constants");
|
|
17
16
|
var _useChartDimensions = require("./useChartDimensions.selectors");
|
|
18
17
|
var _defaultizeMargin = require("../../../defaultizeMargin");
|
|
@@ -143,7 +142,7 @@ const useChartDimensions = ({
|
|
|
143
142
|
stateRef.current.displayError = false;
|
|
144
143
|
}
|
|
145
144
|
}
|
|
146
|
-
const drawingArea =
|
|
145
|
+
const drawingArea = store.use(_useChartDimensions.selectorChartDrawingArea);
|
|
147
146
|
const isXInside = React.useCallback(x => x >= drawingArea.left - 1 && x <= drawingArea.left + drawingArea.width, [drawingArea.left, drawingArea.width]);
|
|
148
147
|
const isYInside = React.useCallback(y => y >= drawingArea.top - 1 && y <= drawingArea.top + drawingArea.height, [drawingArea.height, drawingArea.top]);
|
|
149
148
|
const isPointInside = React.useCallback((x, y, targetElement) => {
|