@mui/x-charts 9.10.0 → 9.11.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/BarChart.js +4 -2
- package/BarChart/BarChart.mjs +4 -2
- package/BarChart/BarPlot.d.mts +3 -3
- package/BarChart/BarPlot.d.ts +3 -3
- package/BarChart/BarPlot.js +1 -1
- package/BarChart/BarPlot.mjs +1 -1
- package/BarChart/BatchBarPlot/BatchBarPlot.d.mts +2 -2
- package/BarChart/BatchBarPlot/BatchBarPlot.d.ts +2 -2
- package/BarChart/IndividualBarPlot.d.mts +2 -2
- package/BarChart/IndividualBarPlot.d.ts +2 -2
- package/BarChart/seriesConfig/bar/getSeriesWithDefaultValues.d.mts +4 -4
- package/BarChart/seriesConfig/bar/getSeriesWithDefaultValues.d.ts +4 -4
- package/BarChart/seriesConfig/bar/keyboardFocusHandler.js +3 -1
- package/BarChart/seriesConfig/bar/keyboardFocusHandler.mjs +3 -1
- package/BarChart/useRegisterItemClickHandlers.d.mts +2 -1
- package/BarChart/useRegisterItemClickHandlers.d.ts +2 -1
- package/BarChart/useRegisterItemClickHandlers.js +8 -0
- package/BarChart/useRegisterItemClickHandlers.mjs +8 -1
- package/CHANGELOG.md +224 -0
- package/ChartsAxisHighlight/getSampledBandHighlight.d.mts +1 -1
- package/ChartsAxisHighlight/getSampledBandHighlight.d.ts +1 -1
- package/ChartsAxisHighlight/getSampledBandHighlight.js +15 -3
- package/ChartsAxisHighlight/getSampledBandHighlight.mjs +15 -3
- package/ChartsContainer/ChartsContainer.js +4 -2
- package/ChartsContainer/ChartsContainer.mjs +4 -2
- package/ChartsDataProvider/ChartsDataProvider.js +3 -1
- package/ChartsDataProvider/ChartsDataProvider.mjs +3 -1
- package/ChartsRadialDataProvider/ChartsRadialDataProvider.js +3 -1
- package/ChartsRadialDataProvider/ChartsRadialDataProvider.mjs +3 -1
- package/ChartsXAxis/useAxisTicksProps.d.mts +101 -101
- package/ChartsXAxis/useAxisTicksProps.d.ts +101 -101
- package/ChartsYAxis/useAxisTicksProps.d.mts +101 -101
- package/ChartsYAxis/useAxisTicksProps.d.ts +101 -101
- package/LineChart/AreaPlot.d.mts +3 -2
- package/LineChart/AreaPlot.d.ts +3 -2
- package/LineChart/AreaPlot.js +8 -2
- package/LineChart/AreaPlot.mjs +9 -3
- package/LineChart/LineChart.js +2 -1
- package/LineChart/LineChart.mjs +2 -1
- package/LineChart/LinePlot.d.mts +3 -2
- package/LineChart/LinePlot.d.ts +3 -2
- package/LineChart/LinePlot.js +2 -2
- package/LineChart/LinePlot.mjs +3 -3
- package/LineChart/MarkPlot.d.mts +5 -4
- package/LineChart/MarkPlot.d.ts +5 -4
- package/LineChart/MarkPlot.js +17 -8
- package/LineChart/MarkPlot.mjs +17 -8
- package/LineChart/seriesConfig/keyboardFocusHandler.js +3 -1
- package/LineChart/seriesConfig/keyboardFocusHandler.mjs +3 -1
- package/LineChart/useLineItemClickHandler.d.mts +25 -1
- package/LineChart/useLineItemClickHandler.d.ts +25 -1
- package/LineChart/useLineItemClickHandler.js +48 -1
- package/LineChart/useLineItemClickHandler.mjs +47 -1
- package/PieChart/PieArcPlot.d.mts +3 -2
- package/PieChart/PieArcPlot.d.ts +3 -2
- package/PieChart/PieArcPlot.js +16 -1
- package/PieChart/PieArcPlot.mjs +16 -1
- package/PieChart/PieChart.js +3 -1
- package/PieChart/PieChart.mjs +3 -1
- package/PieChart/PiePlot.js +1 -1
- package/PieChart/PiePlot.mjs +1 -1
- package/README.md +1 -11
- package/RadarChart/RadarChart.js +3 -1
- package/RadarChart/RadarChart.mjs +3 -1
- package/RadarChart/RadarSeriesPlot/RadarSeriesArea.js +3 -1
- package/RadarChart/RadarSeriesPlot/RadarSeriesArea.mjs +3 -1
- package/RadarChart/RadarSeriesPlot/RadarSeriesMarks.js +4 -1
- package/RadarChart/RadarSeriesPlot/RadarSeriesMarks.mjs +4 -1
- package/RadarChart/RadarSeriesPlot/RadarSeriesPlot.types.d.mts +5 -4
- package/RadarChart/RadarSeriesPlot/RadarSeriesPlot.types.d.ts +5 -4
- package/RadarChart/RadarSeriesPlot/useRegisterRadarItemActivation.d.mts +15 -0
- package/RadarChart/RadarSeriesPlot/useRegisterRadarItemActivation.d.ts +15 -0
- package/RadarChart/RadarSeriesPlot/useRegisterRadarItemActivation.js +32 -0
- package/RadarChart/RadarSeriesPlot/useRegisterRadarItemActivation.mjs +26 -0
- package/RadarChart/seriesConfig/keyboardFocusHandler.js +3 -1
- package/RadarChart/seriesConfig/keyboardFocusHandler.mjs +3 -1
- package/RadarChart/useRadarChartProps.js +5 -1
- package/RadarChart/useRadarChartProps.mjs +5 -1
- package/ScatterChart/Scatter.d.mts +3 -2
- package/ScatterChart/Scatter.d.ts +3 -2
- package/ScatterChart/Scatter.js +10 -1
- package/ScatterChart/Scatter.mjs +10 -1
- package/ScatterChart/ScatterChart.js +1 -0
- package/ScatterChart/ScatterChart.mjs +1 -0
- package/ScatterChart/async/ScatterAsync.js +9 -0
- package/ScatterChart/async/ScatterAsync.mjs +9 -0
- package/SparkLineChart/SparkLineChart.js +2 -1
- package/SparkLineChart/SparkLineChart.mjs +2 -1
- package/Toolbar/ToolbarButton.js +1 -1
- package/Toolbar/ToolbarButton.mjs +1 -1
- package/hooks/animation/useAnimatePieArc.js +2 -1
- package/hooks/animation/useAnimatePieArc.mjs +2 -1
- package/hooks/useFocusedItem.d.mts +1 -1
- package/hooks/useFocusedItem.d.ts +1 -1
- package/hooks/useItemHighlightStateGetter.d.mts +1 -1
- package/hooks/useItemHighlightStateGetter.d.ts +1 -1
- package/index.js +1 -1
- package/index.mjs +1 -1
- package/internals/commonNextFocusItem.d.mts +2 -2
- package/internals/commonNextFocusItem.d.ts +2 -2
- package/internals/commonNextFocusItem.js +4 -4
- package/internals/commonNextFocusItem.mjs +4 -4
- package/internals/components/ChartsAccessibilityProxy/ChartsAccessibilityProxy.js +1 -0
- package/internals/components/ChartsAccessibilityProxy/ChartsAccessibilityProxy.mjs +1 -0
- package/internals/createCommonKeyboardFocusHandler.d.mts +2 -2
- package/internals/createCommonKeyboardFocusHandler.d.ts +2 -2
- package/internals/createGetBarDimensions.js +10 -5
- package/internals/createGetBarDimensions.mjs +10 -5
- package/internals/getSampledBucketRegion.d.mts +12 -0
- package/internals/getSampledBucketRegion.d.ts +12 -0
- package/internals/getSampledBucketRegion.js +23 -0
- package/internals/getSampledBucketRegion.mjs +17 -0
- package/internals/index.d.mts +1 -0
- package/internals/index.d.ts +1 -0
- package/internals/index.js +8 -0
- package/internals/index.mjs +1 -0
- package/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.d.mts +8 -1
- package/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.d.ts +8 -1
- package/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.js +11 -3
- package/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.mjs +11 -3
- package/internals/plugins/corePlugins/useChartSeries/useChartSeries.selectors.d.mts +1 -0
- package/internals/plugins/corePlugins/useChartSeries/useChartSeries.selectors.d.ts +1 -0
- package/internals/plugins/corePlugins/useChartSeriesConfig/types/getItemWithData.types.d.mts +12 -0
- package/internals/plugins/corePlugins/useChartSeriesConfig/types/getItemWithData.types.d.ts +12 -0
- package/internals/plugins/corePlugins/useChartSeriesConfig/types/getItemWithData.types.js +5 -0
- package/internals/plugins/corePlugins/useChartSeriesConfig/types/getItemWithData.types.mjs +1 -0
- package/internals/plugins/corePlugins/useChartSeriesConfig/types/index.d.mts +1 -0
- package/internals/plugins/corePlugins/useChartSeriesConfig/types/index.d.ts +1 -0
- package/internals/plugins/corePlugins/useChartSeriesConfig/types/index.js +11 -0
- package/internals/plugins/corePlugins/useChartSeriesConfig/types/index.mjs +1 -0
- package/internals/plugins/corePlugins/useChartSeriesConfig/types/seriesConfig.types.d.mts +6 -0
- package/internals/plugins/corePlugins/useChartSeriesConfig/types/seriesConfig.types.d.ts +6 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisClickPayload.d.mts +21 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisClickPayload.d.ts +21 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisClickPayload.js +46 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisClickPayload.mjs +40 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +13 -31
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.mjs +13 -31
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.d.mts +2 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.d.ts +2 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.mts +11 -11
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +11 -11
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.d.mts +4 -4
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.d.ts +4 -4
- package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.js +19 -0
- package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.mjs +19 -0
- package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.types.d.mts +5 -3
- package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.types.d.ts +5 -3
- package/internals/plugins/featurePlugins/useChartItemClick/useChartItemClick.js +15 -0
- package/internals/plugins/featurePlugins/useChartItemClick/useChartItemClick.mjs +14 -0
- package/internals/plugins/featurePlugins/useChartItemClick/useChartItemClick.types.d.mts +5 -2
- package/internals/plugins/featurePlugins/useChartItemClick/useChartItemClick.types.d.ts +5 -2
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/index.d.mts +2 -1
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/index.d.ts +2 -1
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/index.js +10 -2
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/index.mjs +2 -1
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/itemActivation.d.mts +13 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/itemActivation.d.ts +13 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/itemActivation.js +39 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/itemActivation.mjs +32 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.js +47 -7
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.mjs +47 -7
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.d.mts +3 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.d.ts +3 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.js +3 -1
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.mjs +2 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.d.mts +39 -2
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.d.ts +39 -2
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/findVisibleDataIndex.d.mts +3 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/findVisibleDataIndex.d.ts +3 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/findVisibleDataIndex.js +3 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/findVisibleDataIndex.mjs +3 -0
- package/internals/plugins/featurePlugins/useChartPolarAxis/getPolarAxisClickPayload.d.mts +27 -0
- package/internals/plugins/featurePlugins/useChartPolarAxis/getPolarAxisClickPayload.d.ts +27 -0
- package/internals/plugins/featurePlugins/useChartPolarAxis/getPolarAxisClickPayload.js +36 -0
- package/internals/plugins/featurePlugins/useChartPolarAxis/getPolarAxisClickPayload.mjs +30 -0
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +19 -20
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.mjs +19 -20
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.selectors.d.mts +2 -2
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.selectors.d.ts +2 -2
- package/internals/plugins/featurePlugins/useChartTooltip/useChartTooltip.selectors.d.mts +1 -1
- package/internals/plugins/featurePlugins/useChartTooltip/useChartTooltip.selectors.d.ts +1 -1
- package/internals/seriesSelectorOfType.d.mts +4 -4
- package/internals/seriesSelectorOfType.d.ts +4 -4
- package/internals/snapEndAngleToFullCircle.d.mts +20 -0
- package/internals/snapEndAngleToFullCircle.d.ts +20 -0
- package/internals/snapEndAngleToFullCircle.js +47 -0
- package/internals/snapEndAngleToFullCircle.mjs +41 -0
- package/internals/useRegisterItemActivation.d.mts +23 -0
- package/internals/useRegisterItemActivation.d.ts +23 -0
- package/internals/useRegisterItemActivation.js +53 -0
- package/internals/useRegisterItemActivation.mjs +46 -0
- package/models/axis.d.mts +1 -1
- package/models/axis.d.ts +1 -1
- package/models/events.d.mts +11 -0
- package/models/events.d.ts +11 -0
- package/models/events.js +5 -0
- package/models/events.mjs +1 -0
- package/models/index.d.mts +1 -0
- package/models/index.d.ts +1 -0
- package/moduleAugmentation/barChartBatchRendererOnItemClick.d.mts +3 -4
- package/moduleAugmentation/barChartBatchRendererOnItemClick.d.ts +3 -4
- package/moduleAugmentation/keyboardActivation.d.mts +7 -0
- package/moduleAugmentation/keyboardActivation.d.ts +7 -0
- package/moduleAugmentation/keyboardActivation.js +8 -0
- package/moduleAugmentation/keyboardActivation.mjs +2 -0
- package/package.json +19 -5
|
@@ -12,7 +12,7 @@ import { generatePolar2svg, generateSvg2polar, generateSvg2radius, generateSvg2r
|
|
|
12
12
|
import { getRadiusAxisIndex, getRotationAxisIndex } from "./getAxisIndex.mjs";
|
|
13
13
|
import { selectorChartSeriesProcessed } from "../../corePlugins/useChartSeries/index.mjs";
|
|
14
14
|
import { checkHasInteractionPlugin } from "../useChartInteraction/checkHasInteractionPlugin.mjs";
|
|
15
|
-
import {
|
|
15
|
+
import { getPolarAxisClickPayload } from "./getPolarAxisClickPayload.mjs";
|
|
16
16
|
export const useChartPolarAxis = ({
|
|
17
17
|
params,
|
|
18
18
|
store,
|
|
@@ -167,34 +167,33 @@ export const useChartPolarAxis = ({
|
|
|
167
167
|
return () => {};
|
|
168
168
|
}
|
|
169
169
|
const axisClickHandler = instance.addInteractionListener('tap', event => {
|
|
170
|
-
let dataIndex = null;
|
|
171
|
-
let isRotationAxis = false;
|
|
172
170
|
const svgPoint = getChartPoint(element, event.detail.srcEvent);
|
|
173
171
|
const rotation = generateSvg2rotation(center)(svgPoint.x, svgPoint.y);
|
|
174
172
|
const rotationIndex = getRotationAxisIndex(rotationAxisWithScale[usedRotationAxisId], rotation);
|
|
175
173
|
const radius = generateSvg2radius(center)(svgPoint.x, svgPoint.y);
|
|
176
174
|
const radiusIndex = getRadiusAxisIndex(radiusAxisWithScale[usedRadiusAxisId], radius);
|
|
177
|
-
isRotationAxis = rotationIndex !== -1;
|
|
178
|
-
dataIndex = isRotationAxis ? rotationIndex : radiusIndex;
|
|
179
|
-
|
|
180
|
-
if (dataIndex == null || dataIndex === -1) {
|
|
175
|
+
const isRotationAxis = rotationIndex !== -1;
|
|
176
|
+
const dataIndex = isRotationAxis ? rotationIndex : radiusIndex;
|
|
177
|
+
if (dataIndex === -1) {
|
|
181
178
|
return;
|
|
182
179
|
}
|
|
183
|
-
|
|
184
|
-
// The .data exist because otherwise the dataIndex would be null or -1.
|
|
185
|
-
const axisValue = (isRotationAxis ? rotationAxisWithScale : radiusAxisWithScale)[USED_AXIS_ID].data[dataIndex];
|
|
186
|
-
const seriesValues = {};
|
|
187
|
-
Object.keys(processedSeries).filter(isPolarSeriesType).forEach(seriesType => {
|
|
188
|
-
processedSeries[seriesType]?.seriesOrder.forEach(seriesId => {
|
|
189
|
-
const seriesItem = processedSeries[seriesType].series[seriesId];
|
|
190
|
-
seriesValues[seriesId] = seriesItem.data[dataIndex];
|
|
191
|
-
});
|
|
192
|
-
});
|
|
193
|
-
onAxisClick(event.detail.srcEvent, {
|
|
180
|
+
const payload = getPolarAxisClickPayload({
|
|
194
181
|
dataIndex,
|
|
195
|
-
|
|
196
|
-
|
|
182
|
+
isRotationAxis,
|
|
183
|
+
rotationAxes: {
|
|
184
|
+
axis: rotationAxisWithScale,
|
|
185
|
+
axisIds: [usedRotationAxisId]
|
|
186
|
+
},
|
|
187
|
+
radiusAxes: {
|
|
188
|
+
axis: radiusAxisWithScale,
|
|
189
|
+
axisIds: [usedRadiusAxisId]
|
|
190
|
+
},
|
|
191
|
+
processedSeries
|
|
197
192
|
});
|
|
193
|
+
if (payload === null) {
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
onAxisClick(event.detail.srcEvent, payload);
|
|
198
197
|
});
|
|
199
198
|
return () => {
|
|
200
199
|
axisClickHandler.cleanup();
|
package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.selectors.d.mts
CHANGED
|
@@ -2,8 +2,8 @@ import type { UseChartPolarAxisSignature } from "./useChartPolarAxis.types.mjs";
|
|
|
2
2
|
import type { ChartState } from "../../models/chart.mjs";
|
|
3
3
|
import type { ChartDrawingArea } from "../../../../hooks/useDrawingArea.mjs";
|
|
4
4
|
export declare const selectorChartPolarAxisState: (state: ChartState<[], [UseChartPolarAxisSignature]>) => {
|
|
5
|
-
rotation: import("../../../index.mjs").PolarAxisConfig<import("
|
|
6
|
-
radius: import("../../../index.mjs").PolarAxisConfig<import("
|
|
5
|
+
rotation: import("../../../index.mjs").PolarAxisConfig<import("@mui/x-charts/models").ScaleName, any, import("../../../index.mjs").ChartsRotationAxisProps>[];
|
|
6
|
+
radius: import("../../../index.mjs").PolarAxisConfig<import("@mui/x-charts/models").ScaleName, any, import("../../../index.mjs").ChartsRadiusAxisProps>[];
|
|
7
7
|
} | undefined;
|
|
8
8
|
export declare const selectorChartRawRotationAxis: (args_0: import("../../corePlugins/useChartId/useChartId.types.mjs").UseChartIdState & import("../../corePlugins/useChartSeriesConfig/useChartSeriesConfig.types.mjs").UseChartSeriesConfigState<keyof import("../../../index.mjs").ChartsSeriesConfig> & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.mjs").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.mjs").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.mjs").UseChartSeriesState<keyof import("../../../index.mjs").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.mjs").UseChartAnimationState & import("../../../index.mjs").UseChartInteractionListenerState & Partial<import("./useChartPolarAxis.types.mjs").UseChartPolarAxisState> & {
|
|
9
9
|
cacheKey: import("../../models/index.mjs").ChartStateCacheKey;
|
|
@@ -2,8 +2,8 @@ import type { UseChartPolarAxisSignature } from "./useChartPolarAxis.types.js";
|
|
|
2
2
|
import type { ChartState } from "../../models/chart.js";
|
|
3
3
|
import type { ChartDrawingArea } from "../../../../hooks/useDrawingArea.js";
|
|
4
4
|
export declare const selectorChartPolarAxisState: (state: ChartState<[], [UseChartPolarAxisSignature]>) => {
|
|
5
|
-
rotation: import("../../../index.js").PolarAxisConfig<import("
|
|
6
|
-
radius: import("../../../index.js").PolarAxisConfig<import("
|
|
5
|
+
rotation: import("../../../index.js").PolarAxisConfig<import("@mui/x-charts/models").ScaleName, any, import("../../../index.js").ChartsRotationAxisProps>[];
|
|
6
|
+
radius: import("../../../index.js").PolarAxisConfig<import("@mui/x-charts/models").ScaleName, any, import("../../../index.js").ChartsRadiusAxisProps>[];
|
|
7
7
|
} | undefined;
|
|
8
8
|
export declare const selectorChartRawRotationAxis: (args_0: import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartSeriesConfig/useChartSeriesConfig.types.js").UseChartSeriesConfigState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & Partial<import("./useChartPolarAxis.types.js").UseChartPolarAxisState> & {
|
|
9
9
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { SeriesItemIdentifierWithType } from "../../../../models/index.mjs";
|
|
2
2
|
export declare const selectorChartsTooltipPointerItem: (args_0: import("../../corePlugins/useChartId/useChartId.types.mjs").UseChartIdState & import("../../corePlugins/useChartSeriesConfig/useChartSeriesConfig.types.mjs").UseChartSeriesConfigState<keyof import("../../../index.mjs").ChartsSeriesConfig> & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.mjs").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.mjs").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.mjs").UseChartSeriesState<keyof import("../../../index.mjs").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.mjs").UseChartAnimationState & import("../../../index.mjs").UseChartInteractionListenerState & Partial<import("./useChartTooltip.types.mjs").UseChartTooltipState<keyof import("../../../index.mjs").ChartsSeriesConfig>> & {
|
|
3
3
|
cacheKey: import("../../models/index.mjs").ChartStateCacheKey;
|
|
4
|
-
}) => import("
|
|
4
|
+
}) => import("@mui/x-charts/models").BarItemIdentifier | import("@mui/x-charts/models").LineItemIdentifier | import("@mui/x-charts/models").PieItemIdentifier | import("@mui/x-charts/models").RadarItemIdentifier | import("@mui/x-charts/models").ScatterItemIdentifier | null;
|
|
5
5
|
export declare const selectorChartsTooltipPointerItemIsDefined: (args_0: import("../../corePlugins/useChartId/useChartId.types.mjs").UseChartIdState & import("../../corePlugins/useChartSeriesConfig/useChartSeriesConfig.types.mjs").UseChartSeriesConfigState<keyof import("../../../index.mjs").ChartsSeriesConfig> & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.mjs").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.mjs").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.mjs").UseChartSeriesState<keyof import("../../../index.mjs").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.mjs").UseChartAnimationState & import("../../../index.mjs").UseChartInteractionListenerState & Partial<import("./useChartTooltip.types.mjs").UseChartTooltipState<keyof import("../../../index.mjs").ChartsSeriesConfig>> & {
|
|
6
6
|
cacheKey: import("../../models/index.mjs").ChartStateCacheKey;
|
|
7
7
|
}) => boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { SeriesItemIdentifierWithType } from "../../../../models/index.js";
|
|
2
2
|
export declare const selectorChartsTooltipPointerItem: (args_0: import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartSeriesConfig/useChartSeriesConfig.types.js").UseChartSeriesConfigState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & Partial<import("./useChartTooltip.types.js").UseChartTooltipState<keyof import("../../../index.js").ChartsSeriesConfig>> & {
|
|
3
3
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
4
|
-
}) => import("
|
|
4
|
+
}) => import("@mui/x-charts/models").BarItemIdentifier | import("@mui/x-charts/models").LineItemIdentifier | import("@mui/x-charts/models").PieItemIdentifier | import("@mui/x-charts/models").RadarItemIdentifier | import("@mui/x-charts/models").ScatterItemIdentifier | null;
|
|
5
5
|
export declare const selectorChartsTooltipPointerItemIsDefined: (args_0: import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartSeriesConfig/useChartSeriesConfig.types.js").UseChartSeriesConfigState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & Partial<import("./useChartTooltip.types.js").UseChartTooltipState<keyof import("../../../index.js").ChartsSeriesConfig>> & {
|
|
6
6
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
7
7
|
}) => boolean;
|
|
@@ -4,17 +4,17 @@ import type { ProcessedSeries } from "./plugins/corePlugins/useChartSeries/index
|
|
|
4
4
|
export declare const selectorAllSeriesOfType: (args_0: import("./plugins/corePlugins/useChartId/useChartId.types.mjs").UseChartIdState & import("./plugins/corePlugins/useChartSeriesConfig/useChartSeriesConfig.types.mjs").UseChartSeriesConfigState<keyof ChartsSeriesConfig> & import("./plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.mjs").UseChartExperimentalFeaturesState & import("./plugins/corePlugins/useChartDimensions/useChartDimensions.types.mjs").UseChartDimensionsState & import("./plugins/corePlugins/useChartSeries/useChartSeries.types.mjs").UseChartSeriesState<keyof ChartsSeriesConfig> & import("./plugins/corePlugins/useChartAnimation/useChartAnimation.types.mjs").UseChartAnimationState & import("./index.mjs").UseChartInteractionListenerState & Partial<{}> & {
|
|
5
5
|
cacheKey: import("./index.mjs").ChartStateCacheKey;
|
|
6
6
|
}, seriesType: keyof ChartsSeriesConfig) => {
|
|
7
|
-
series: Record<string, import("
|
|
7
|
+
series: Record<string, import("@mui/x-charts/models").DefaultizedPieSeriesType>;
|
|
8
8
|
seriesOrder: SeriesId[];
|
|
9
9
|
} | {
|
|
10
|
-
series: Record<string, import("
|
|
10
|
+
series: Record<string, import("@mui/x-charts/models").DefaultizedRadarSeriesType>;
|
|
11
11
|
seriesOrder: SeriesId[];
|
|
12
12
|
} | {
|
|
13
|
-
series: Record<string, import("
|
|
13
|
+
series: Record<string, import("@mui/x-charts/models").DefaultizedScatterSeriesType>;
|
|
14
14
|
seriesOrder: SeriesId[];
|
|
15
15
|
} | import("./index.mjs").SeriesProcessorResult<"bar"> | import("./index.mjs").SeriesProcessorResult<"line"> | undefined;
|
|
16
16
|
export declare const selectorSeriesOfType: (args_0: import("./plugins/corePlugins/useChartId/useChartId.types.mjs").UseChartIdState & import("./plugins/corePlugins/useChartSeriesConfig/useChartSeriesConfig.types.mjs").UseChartSeriesConfigState<keyof ChartsSeriesConfig> & import("./plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.mjs").UseChartExperimentalFeaturesState & import("./plugins/corePlugins/useChartDimensions/useChartDimensions.types.mjs").UseChartDimensionsState & import("./plugins/corePlugins/useChartSeries/useChartSeries.types.mjs").UseChartSeriesState<keyof ChartsSeriesConfig> & import("./plugins/corePlugins/useChartAnimation/useChartAnimation.types.mjs").UseChartAnimationState & import("./index.mjs").UseChartInteractionListenerState & Partial<{}> & {
|
|
17
17
|
cacheKey: import("./index.mjs").ChartStateCacheKey;
|
|
18
|
-
}, seriesType: keyof ChartsSeriesConfig, ids: string | string[] | undefined) => (import("
|
|
18
|
+
}, seriesType: keyof ChartsSeriesConfig, ids: string | string[] | undefined) => (import("@mui/x-charts/models").DefaultizedBarSeriesType | import("@mui/x-charts/models").DefaultizedLineSeriesType | import("@mui/x-charts/models").DefaultizedPieSeriesType | import("@mui/x-charts/models").DefaultizedRadarSeriesType | import("@mui/x-charts/models").DefaultizedScatterSeriesType | undefined)[] | import("@mui/x-charts/models").DefaultizedBarSeriesType | import("@mui/x-charts/models").DefaultizedLineSeriesType | import("@mui/x-charts/models").DefaultizedPieSeriesType | import("@mui/x-charts/models").DefaultizedRadarSeriesType | import("@mui/x-charts/models").DefaultizedScatterSeriesType | undefined;
|
|
19
19
|
export declare const useAllSeriesOfType: <T extends keyof ChartsSeriesConfig>(seriesType: T) => ProcessedSeries[T];
|
|
20
20
|
export declare const useSeriesOfType: <T extends keyof ChartsSeriesConfig>(seriesType: T, seriesId?: SeriesId | SeriesId[]) => ChartSeriesDefaultized<T> | ChartSeriesDefaultized<T>[] | undefined;
|
|
@@ -4,17 +4,17 @@ import type { ProcessedSeries } from "./plugins/corePlugins/useChartSeries/index
|
|
|
4
4
|
export declare const selectorAllSeriesOfType: (args_0: import("./plugins/corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("./plugins/corePlugins/useChartSeriesConfig/useChartSeriesConfig.types.js").UseChartSeriesConfigState<keyof ChartsSeriesConfig> & import("./plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("./plugins/corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("./plugins/corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof ChartsSeriesConfig> & import("./plugins/corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("./index.js").UseChartInteractionListenerState & Partial<{}> & {
|
|
5
5
|
cacheKey: import("./index.js").ChartStateCacheKey;
|
|
6
6
|
}, seriesType: keyof ChartsSeriesConfig) => {
|
|
7
|
-
series: Record<string, import("
|
|
7
|
+
series: Record<string, import("@mui/x-charts/models").DefaultizedPieSeriesType>;
|
|
8
8
|
seriesOrder: SeriesId[];
|
|
9
9
|
} | {
|
|
10
|
-
series: Record<string, import("
|
|
10
|
+
series: Record<string, import("@mui/x-charts/models").DefaultizedRadarSeriesType>;
|
|
11
11
|
seriesOrder: SeriesId[];
|
|
12
12
|
} | {
|
|
13
|
-
series: Record<string, import("
|
|
13
|
+
series: Record<string, import("@mui/x-charts/models").DefaultizedScatterSeriesType>;
|
|
14
14
|
seriesOrder: SeriesId[];
|
|
15
15
|
} | import("./index.js").SeriesProcessorResult<"bar"> | import("./index.js").SeriesProcessorResult<"line"> | undefined;
|
|
16
16
|
export declare const selectorSeriesOfType: (args_0: import("./plugins/corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("./plugins/corePlugins/useChartSeriesConfig/useChartSeriesConfig.types.js").UseChartSeriesConfigState<keyof ChartsSeriesConfig> & import("./plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("./plugins/corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("./plugins/corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof ChartsSeriesConfig> & import("./plugins/corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("./index.js").UseChartInteractionListenerState & Partial<{}> & {
|
|
17
17
|
cacheKey: import("./index.js").ChartStateCacheKey;
|
|
18
|
-
}, seriesType: keyof ChartsSeriesConfig, ids: string | string[] | undefined) => (import("
|
|
18
|
+
}, seriesType: keyof ChartsSeriesConfig, ids: string | string[] | undefined) => (import("@mui/x-charts/models").DefaultizedBarSeriesType | import("@mui/x-charts/models").DefaultizedLineSeriesType | import("@mui/x-charts/models").DefaultizedPieSeriesType | import("@mui/x-charts/models").DefaultizedRadarSeriesType | import("@mui/x-charts/models").DefaultizedScatterSeriesType | undefined)[] | import("@mui/x-charts/models").DefaultizedBarSeriesType | import("@mui/x-charts/models").DefaultizedLineSeriesType | import("@mui/x-charts/models").DefaultizedPieSeriesType | import("@mui/x-charts/models").DefaultizedRadarSeriesType | import("@mui/x-charts/models").DefaultizedScatterSeriesType | undefined;
|
|
19
19
|
export declare const useAllSeriesOfType: <T extends keyof ChartsSeriesConfig>(seriesType: T) => ProcessedSeries[T];
|
|
20
20
|
export declare const useSeriesOfType: <T extends keyof ChartsSeriesConfig>(seriesType: T, seriesId?: SeriesId | SeriesId[]) => ChartSeriesDefaultized<T> | ChartSeriesDefaultized<T>[] | undefined;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Snaps the end angle of an arc to create a full circle when the arc spans almost, but not
|
|
3
|
+
* exactly, the full circle.
|
|
4
|
+
*
|
|
5
|
+
* When an arc spans almost the full circle (e.g., when the remaining slices of a pie are
|
|
6
|
+
* extremely small compared to the largest one), its start and end points are so close that they
|
|
7
|
+
* can round to the same path coordinates. SVG omits arcs whose end point equals their start
|
|
8
|
+
* point, which makes the quasi-full-circle arc invisible.
|
|
9
|
+
* See https://github.com/mui/mui-x/issues/14167
|
|
10
|
+
*
|
|
11
|
+
* The end angle is only snapped when the gap left by the arc is smaller than the precision of
|
|
12
|
+
* the serialized path, so the snapping is visually lossless.
|
|
13
|
+
*
|
|
14
|
+
* @param startAngle The start angle of the arc, in radians.
|
|
15
|
+
* @param endAngle The end angle of the arc, in radians.
|
|
16
|
+
* @param outerRadius The outer radius of the arc.
|
|
17
|
+
* @param padAngle The pad angle of the arc, in radians.
|
|
18
|
+
* @returns The end angle, snapped to `startAngle ± 2 * Math.PI` when applicable.
|
|
19
|
+
*/
|
|
20
|
+
export declare function snapEndAngleToFullCircle(startAngle: number, endAngle: number, outerRadius: number, padAngle?: number): number;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Snaps the end angle of an arc to create a full circle when the arc spans almost, but not
|
|
3
|
+
* exactly, the full circle.
|
|
4
|
+
*
|
|
5
|
+
* When an arc spans almost the full circle (e.g., when the remaining slices of a pie are
|
|
6
|
+
* extremely small compared to the largest one), its start and end points are so close that they
|
|
7
|
+
* can round to the same path coordinates. SVG omits arcs whose end point equals their start
|
|
8
|
+
* point, which makes the quasi-full-circle arc invisible.
|
|
9
|
+
* See https://github.com/mui/mui-x/issues/14167
|
|
10
|
+
*
|
|
11
|
+
* The end angle is only snapped when the gap left by the arc is smaller than the precision of
|
|
12
|
+
* the serialized path, so the snapping is visually lossless.
|
|
13
|
+
*
|
|
14
|
+
* @param startAngle The start angle of the arc, in radians.
|
|
15
|
+
* @param endAngle The end angle of the arc, in radians.
|
|
16
|
+
* @param outerRadius The outer radius of the arc.
|
|
17
|
+
* @param padAngle The pad angle of the arc, in radians.
|
|
18
|
+
* @returns The end angle, snapped to `startAngle ± 2 * Math.PI` when applicable.
|
|
19
|
+
*/
|
|
20
|
+
export declare function snapEndAngleToFullCircle(startAngle: number, endAngle: number, outerRadius: number, padAngle?: number): number;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.snapEndAngleToFullCircle = snapEndAngleToFullCircle;
|
|
7
|
+
const TAU = 2 * Math.PI;
|
|
8
|
+
|
|
9
|
+
/* `d3-shape` serializes paths with a precision of 3 digits, i.e., a resolution of 1e-3. */
|
|
10
|
+
const PATH_PRECISION = 1e-3;
|
|
11
|
+
/* If the distance between the start and end points of an arc is at least twice the path
|
|
12
|
+
* precision, at least one of their coordinates is guaranteed to round to a different value. */
|
|
13
|
+
const MIN_DISTINCT_CHORD_LENGTH = 2 * PATH_PRECISION;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Snaps the end angle of an arc to create a full circle when the arc spans almost, but not
|
|
17
|
+
* exactly, the full circle.
|
|
18
|
+
*
|
|
19
|
+
* When an arc spans almost the full circle (e.g., when the remaining slices of a pie are
|
|
20
|
+
* extremely small compared to the largest one), its start and end points are so close that they
|
|
21
|
+
* can round to the same path coordinates. SVG omits arcs whose end point equals their start
|
|
22
|
+
* point, which makes the quasi-full-circle arc invisible.
|
|
23
|
+
* See https://github.com/mui/mui-x/issues/14167
|
|
24
|
+
*
|
|
25
|
+
* The end angle is only snapped when the gap left by the arc is smaller than the precision of
|
|
26
|
+
* the serialized path, so the snapping is visually lossless.
|
|
27
|
+
*
|
|
28
|
+
* @param startAngle The start angle of the arc, in radians.
|
|
29
|
+
* @param endAngle The end angle of the arc, in radians.
|
|
30
|
+
* @param outerRadius The outer radius of the arc.
|
|
31
|
+
* @param padAngle The pad angle of the arc, in radians.
|
|
32
|
+
* @returns The end angle, snapped to `startAngle ± 2 * Math.PI` when applicable.
|
|
33
|
+
*/
|
|
34
|
+
function snapEndAngleToFullCircle(startAngle, endAngle, outerRadius, padAngle = 0) {
|
|
35
|
+
const sweep = Math.abs(endAngle - startAngle);
|
|
36
|
+
if (sweep === 0 || sweep >= TAU) {
|
|
37
|
+
return endAngle;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Chord between the start and end points of the arc, once the padding is applied.
|
|
41
|
+
// For such small angles, the chord length is approximately `radius * angle`.
|
|
42
|
+
const gapChordLength = (TAU - sweep + Math.abs(padAngle)) * outerRadius;
|
|
43
|
+
if (gapChordLength >= MIN_DISTINCT_CHORD_LENGTH) {
|
|
44
|
+
return endAngle;
|
|
45
|
+
}
|
|
46
|
+
return startAngle + Math.sign(endAngle - startAngle) * TAU;
|
|
47
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const TAU = 2 * Math.PI;
|
|
2
|
+
|
|
3
|
+
/* `d3-shape` serializes paths with a precision of 3 digits, i.e., a resolution of 1e-3. */
|
|
4
|
+
const PATH_PRECISION = 1e-3;
|
|
5
|
+
/* If the distance between the start and end points of an arc is at least twice the path
|
|
6
|
+
* precision, at least one of their coordinates is guaranteed to round to a different value. */
|
|
7
|
+
const MIN_DISTINCT_CHORD_LENGTH = 2 * PATH_PRECISION;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Snaps the end angle of an arc to create a full circle when the arc spans almost, but not
|
|
11
|
+
* exactly, the full circle.
|
|
12
|
+
*
|
|
13
|
+
* When an arc spans almost the full circle (e.g., when the remaining slices of a pie are
|
|
14
|
+
* extremely small compared to the largest one), its start and end points are so close that they
|
|
15
|
+
* can round to the same path coordinates. SVG omits arcs whose end point equals their start
|
|
16
|
+
* point, which makes the quasi-full-circle arc invisible.
|
|
17
|
+
* See https://github.com/mui/mui-x/issues/14167
|
|
18
|
+
*
|
|
19
|
+
* The end angle is only snapped when the gap left by the arc is smaller than the precision of
|
|
20
|
+
* the serialized path, so the snapping is visually lossless.
|
|
21
|
+
*
|
|
22
|
+
* @param startAngle The start angle of the arc, in radians.
|
|
23
|
+
* @param endAngle The end angle of the arc, in radians.
|
|
24
|
+
* @param outerRadius The outer radius of the arc.
|
|
25
|
+
* @param padAngle The pad angle of the arc, in radians.
|
|
26
|
+
* @returns The end angle, snapped to `startAngle ± 2 * Math.PI` when applicable.
|
|
27
|
+
*/
|
|
28
|
+
export function snapEndAngleToFullCircle(startAngle, endAngle, outerRadius, padAngle = 0) {
|
|
29
|
+
const sweep = Math.abs(endAngle - startAngle);
|
|
30
|
+
if (sweep === 0 || sweep >= TAU) {
|
|
31
|
+
return endAngle;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Chord between the start and end points of the arc, once the padding is applied.
|
|
35
|
+
// For such small angles, the chord length is approximately `radius * angle`.
|
|
36
|
+
const gapChordLength = (TAU - sweep + Math.abs(padAngle)) * outerRadius;
|
|
37
|
+
if (gapChordLength >= MIN_DISTINCT_CHORD_LENGTH) {
|
|
38
|
+
return endAngle;
|
|
39
|
+
}
|
|
40
|
+
return startAngle + Math.sign(endAngle - startAngle) * TAU;
|
|
41
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ChartSeriesType } from "../models/seriesType/config.mjs";
|
|
2
|
+
import type { SeriesId } from "../models/seriesType/common.mjs";
|
|
3
|
+
import type { FocusedItemIdentifier } from "../models/seriesType/index.mjs";
|
|
4
|
+
/**
|
|
5
|
+
* Registers a handler fired when the keyboard-focused item is activated with <kbd>Enter</kbd> or
|
|
6
|
+
* <kbd>Space</kbd>. It is a no-op when the `keyboardActivation` experimental feature is off.
|
|
7
|
+
*
|
|
8
|
+
* Scope the registration as tightly as the caller knows: when several plots handle the same item,
|
|
9
|
+
* the most specific scope wins, `priority` breaks ties, `canActivate` can decline an item, and the
|
|
10
|
+
* handler runs once.
|
|
11
|
+
*
|
|
12
|
+
* The handler receives the `KeyboardEvent`, typed as `any` because the click callbacks it forwards
|
|
13
|
+
* to only describe the pointer event unless the user augments `keyboardActivationOverride`.
|
|
14
|
+
*
|
|
15
|
+
* @param scope The items covered by the handler. Omit `seriesId` to cover a whole series type.
|
|
16
|
+
* @param handler The handler to call on activation, or `undefined` to register nothing.
|
|
17
|
+
*/
|
|
18
|
+
export declare function useRegisterItemActivation<SeriesType extends ChartSeriesType = ChartSeriesType>(scope: {
|
|
19
|
+
type?: SeriesType;
|
|
20
|
+
seriesId?: SeriesId;
|
|
21
|
+
priority?: number;
|
|
22
|
+
canActivate?: (item: FocusedItemIdentifier<SeriesType>) => boolean;
|
|
23
|
+
}, handler: ((event: any, item: FocusedItemIdentifier<SeriesType>) => void) | undefined): void;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ChartSeriesType } from "../models/seriesType/config.js";
|
|
2
|
+
import type { SeriesId } from "../models/seriesType/common.js";
|
|
3
|
+
import type { FocusedItemIdentifier } from "../models/seriesType/index.js";
|
|
4
|
+
/**
|
|
5
|
+
* Registers a handler fired when the keyboard-focused item is activated with <kbd>Enter</kbd> or
|
|
6
|
+
* <kbd>Space</kbd>. It is a no-op when the `keyboardActivation` experimental feature is off.
|
|
7
|
+
*
|
|
8
|
+
* Scope the registration as tightly as the caller knows: when several plots handle the same item,
|
|
9
|
+
* the most specific scope wins, `priority` breaks ties, `canActivate` can decline an item, and the
|
|
10
|
+
* handler runs once.
|
|
11
|
+
*
|
|
12
|
+
* The handler receives the `KeyboardEvent`, typed as `any` because the click callbacks it forwards
|
|
13
|
+
* to only describe the pointer event unless the user augments `keyboardActivationOverride`.
|
|
14
|
+
*
|
|
15
|
+
* @param scope The items covered by the handler. Omit `seriesId` to cover a whole series type.
|
|
16
|
+
* @param handler The handler to call on activation, or `undefined` to register nothing.
|
|
17
|
+
*/
|
|
18
|
+
export declare function useRegisterItemActivation<SeriesType extends ChartSeriesType = ChartSeriesType>(scope: {
|
|
19
|
+
type?: SeriesType;
|
|
20
|
+
seriesId?: SeriesId;
|
|
21
|
+
priority?: number;
|
|
22
|
+
canActivate?: (item: FocusedItemIdentifier<SeriesType>) => boolean;
|
|
23
|
+
}, handler: ((event: any, item: FocusedItemIdentifier<SeriesType>) => void) | undefined): void;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
exports.useRegisterItemActivation = useRegisterItemActivation;
|
|
10
|
+
var React = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _useEventCallback = _interopRequireDefault(require("@mui/utils/useEventCallback"));
|
|
12
|
+
var _ChartsProvider = require("../context/ChartsProvider");
|
|
13
|
+
/**
|
|
14
|
+
* Registers a handler fired when the keyboard-focused item is activated with <kbd>Enter</kbd> or
|
|
15
|
+
* <kbd>Space</kbd>. It is a no-op when the `keyboardActivation` experimental feature is off.
|
|
16
|
+
*
|
|
17
|
+
* Scope the registration as tightly as the caller knows: when several plots handle the same item,
|
|
18
|
+
* the most specific scope wins, `priority` breaks ties, `canActivate` can decline an item, and the
|
|
19
|
+
* handler runs once.
|
|
20
|
+
*
|
|
21
|
+
* The handler receives the `KeyboardEvent`, typed as `any` because the click callbacks it forwards
|
|
22
|
+
* to only describe the pointer event unless the user augments `keyboardActivationOverride`.
|
|
23
|
+
*
|
|
24
|
+
* @param scope The items covered by the handler. Omit `seriesId` to cover a whole series type.
|
|
25
|
+
* @param handler The handler to call on activation, or `undefined` to register nothing.
|
|
26
|
+
*/
|
|
27
|
+
function useRegisterItemActivation(scope, handler) {
|
|
28
|
+
const {
|
|
29
|
+
instance
|
|
30
|
+
} = (0, _ChartsProvider.useChartsContext)();
|
|
31
|
+
const {
|
|
32
|
+
type,
|
|
33
|
+
seriesId,
|
|
34
|
+
priority,
|
|
35
|
+
canActivate
|
|
36
|
+
} = scope;
|
|
37
|
+
const hasHandler = handler !== undefined;
|
|
38
|
+
const stableHandler = (0, _useEventCallback.default)((event, item) => handler?.(event, item));
|
|
39
|
+
const hasCanActivate = canActivate !== undefined;
|
|
40
|
+
const stableCanActivate = (0, _useEventCallback.default)(item => canActivate ? canActivate(item) : true);
|
|
41
|
+
const registerItemActivationHandler = instance.registerItemActivationHandler;
|
|
42
|
+
React.useEffect(() => {
|
|
43
|
+
if (!hasHandler || !registerItemActivationHandler) {
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
return registerItemActivationHandler({
|
|
47
|
+
type,
|
|
48
|
+
seriesId,
|
|
49
|
+
priority,
|
|
50
|
+
canActivate: hasCanActivate ? stableCanActivate : undefined
|
|
51
|
+
}, stableHandler);
|
|
52
|
+
}, [registerItemActivationHandler, hasHandler, type, seriesId, priority, hasCanActivate, stableCanActivate, stableHandler]);
|
|
53
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import useEventCallback from '@mui/utils/useEventCallback';
|
|
5
|
+
import { useChartsContext } from "../context/ChartsProvider/index.mjs";
|
|
6
|
+
/**
|
|
7
|
+
* Registers a handler fired when the keyboard-focused item is activated with <kbd>Enter</kbd> or
|
|
8
|
+
* <kbd>Space</kbd>. It is a no-op when the `keyboardActivation` experimental feature is off.
|
|
9
|
+
*
|
|
10
|
+
* Scope the registration as tightly as the caller knows: when several plots handle the same item,
|
|
11
|
+
* the most specific scope wins, `priority` breaks ties, `canActivate` can decline an item, and the
|
|
12
|
+
* handler runs once.
|
|
13
|
+
*
|
|
14
|
+
* The handler receives the `KeyboardEvent`, typed as `any` because the click callbacks it forwards
|
|
15
|
+
* to only describe the pointer event unless the user augments `keyboardActivationOverride`.
|
|
16
|
+
*
|
|
17
|
+
* @param scope The items covered by the handler. Omit `seriesId` to cover a whole series type.
|
|
18
|
+
* @param handler The handler to call on activation, or `undefined` to register nothing.
|
|
19
|
+
*/
|
|
20
|
+
export function useRegisterItemActivation(scope, handler) {
|
|
21
|
+
const {
|
|
22
|
+
instance
|
|
23
|
+
} = useChartsContext();
|
|
24
|
+
const {
|
|
25
|
+
type,
|
|
26
|
+
seriesId,
|
|
27
|
+
priority,
|
|
28
|
+
canActivate
|
|
29
|
+
} = scope;
|
|
30
|
+
const hasHandler = handler !== undefined;
|
|
31
|
+
const stableHandler = useEventCallback((event, item) => handler?.(event, item));
|
|
32
|
+
const hasCanActivate = canActivate !== undefined;
|
|
33
|
+
const stableCanActivate = useEventCallback(item => canActivate ? canActivate(item) : true);
|
|
34
|
+
const registerItemActivationHandler = instance.registerItemActivationHandler;
|
|
35
|
+
React.useEffect(() => {
|
|
36
|
+
if (!hasHandler || !registerItemActivationHandler) {
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
return registerItemActivationHandler({
|
|
40
|
+
type,
|
|
41
|
+
seriesId,
|
|
42
|
+
priority,
|
|
43
|
+
canActivate: hasCanActivate ? stableCanActivate : undefined
|
|
44
|
+
}, stableHandler);
|
|
45
|
+
}, [registerItemActivationHandler, hasHandler, type, seriesId, priority, hasCanActivate, stableCanActivate, stableHandler]);
|
|
46
|
+
}
|
package/models/axis.d.mts
CHANGED
|
@@ -627,7 +627,7 @@ export interface ChartsAxisData {
|
|
|
627
627
|
/**
|
|
628
628
|
* The mapping of series ids to their value for this particular axis index.
|
|
629
629
|
*/
|
|
630
|
-
seriesValues: Record<string, HasProperty<ChartsTypeFeatureFlags, '
|
|
630
|
+
seriesValues: Record<string, HasProperty<ChartsTypeFeatureFlags, 'seriesValuesOverride'> extends true ? ChartsTypeFeatureFlags['seriesValuesOverride'] : number | null | undefined>;
|
|
631
631
|
}
|
|
632
632
|
export type CartesianDirection = 'x' | 'y';
|
|
633
633
|
export type PolarDirection = 'rotation' | 'radius';
|
package/models/axis.d.ts
CHANGED
|
@@ -627,7 +627,7 @@ export interface ChartsAxisData {
|
|
|
627
627
|
/**
|
|
628
628
|
* The mapping of series ids to their value for this particular axis index.
|
|
629
629
|
*/
|
|
630
|
-
seriesValues: Record<string, HasProperty<ChartsTypeFeatureFlags, '
|
|
630
|
+
seriesValues: Record<string, HasProperty<ChartsTypeFeatureFlags, 'seriesValuesOverride'> extends true ? ChartsTypeFeatureFlags['seriesValuesOverride'] : number | null | undefined>;
|
|
631
631
|
}
|
|
632
632
|
export type CartesianDirection = 'x' | 'y';
|
|
633
633
|
export type PolarDirection = 'rotation' | 'radius';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
import type { HasProperty } from '@mui/x-internals/types';
|
|
3
|
+
import type { ChartsTypeFeatureFlags } from "./featureFlags.mjs";
|
|
4
|
+
/**
|
|
5
|
+
* The event a click callback receives.
|
|
6
|
+
*
|
|
7
|
+
* It only describes the pointer event by default. Add
|
|
8
|
+
* `import type {} from '@mui/x-charts/moduleAugmentation/keyboardActivation'` to also get the
|
|
9
|
+
* `KeyboardEvent` fired by the `keyboardActivation` experimental feature.
|
|
10
|
+
*/
|
|
11
|
+
export type ChartsActivationEvent<Element = never> = ([Element] extends [never] ? MouseEvent : React.MouseEvent<Element, MouseEvent>) | (HasProperty<ChartsTypeFeatureFlags, 'keyboardActivationOverride'> extends true ? ChartsTypeFeatureFlags['keyboardActivationOverride'] : never);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
import type { HasProperty } from '@mui/x-internals/types';
|
|
3
|
+
import type { ChartsTypeFeatureFlags } from "./featureFlags.js";
|
|
4
|
+
/**
|
|
5
|
+
* The event a click callback receives.
|
|
6
|
+
*
|
|
7
|
+
* It only describes the pointer event by default. Add
|
|
8
|
+
* `import type {} from '@mui/x-charts/moduleAugmentation/keyboardActivation'` to also get the
|
|
9
|
+
* `KeyboardEvent` fired by the `keyboardActivation` experimental feature.
|
|
10
|
+
*/
|
|
11
|
+
export type ChartsActivationEvent<Element = never> = ([Element] extends [never] ? MouseEvent : React.MouseEvent<Element, MouseEvent>) | (HasProperty<ChartsTypeFeatureFlags, 'keyboardActivationOverride'> extends true ? ChartsTypeFeatureFlags['keyboardActivationOverride'] : never);
|
package/models/events.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/models/index.d.mts
CHANGED
|
@@ -2,6 +2,7 @@ export * from "./seriesType/index.mjs";
|
|
|
2
2
|
export * from "./stacking.mjs";
|
|
3
3
|
export * from "./slots/index.mjs";
|
|
4
4
|
export * from "./featureFlags.mjs";
|
|
5
|
+
export type { ChartsActivationEvent } from "./events.mjs";
|
|
5
6
|
export * from "./chartsSlotsComponentsProps.mjs";
|
|
6
7
|
export type { AxisConfig, ChartsYAxisProps, ChartsXAxisProps, ScaleName, ContinuousScaleName, ChartsAxisData, XAxis, YAxis, RadiusAxis, RotationAxis, AxisItemIdentifier, AxisValueFormatterContext } from "./axis.mjs";
|
|
7
8
|
export type { NumberValue } from '@mui/x-charts-vendor/d3-scale';
|
package/models/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export * from "./seriesType/index.js";
|
|
|
2
2
|
export * from "./stacking.js";
|
|
3
3
|
export * from "./slots/index.js";
|
|
4
4
|
export * from "./featureFlags.js";
|
|
5
|
+
export type { ChartsActivationEvent } from "./events.js";
|
|
5
6
|
export * from "./chartsSlotsComponentsProps.js";
|
|
6
7
|
export type { AxisConfig, ChartsYAxisProps, ChartsXAxisProps, ScaleName, ContinuousScaleName, ChartsAxisData, XAxis, YAxis, RadiusAxis, RotationAxis, AxisItemIdentifier, AxisValueFormatterContext } from "./axis.js";
|
|
7
8
|
export type { NumberValue } from '@mui/x-charts-vendor/d3-scale';
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type { BarItemIdentifier } from "../models/index.mjs";
|
|
1
|
+
import type { BarItemIdentifier, ChartsActivationEvent } from "../models/index.mjs";
|
|
3
2
|
declare module '@mui/x-charts/BarChart' {
|
|
4
3
|
interface BarPlotProps {
|
|
5
4
|
/**
|
|
6
5
|
* Callback fired when a bar item is clicked.
|
|
7
|
-
* @param {
|
|
6
|
+
* @param {ChartsActivationEvent | ChartsActivationEvent<SVGElement>} event The event source of the callback.
|
|
8
7
|
* It is a native MouseEvent for `svg-batch` renderer and a React MouseEvent for `svg-single` renderer.
|
|
9
8
|
* @param {BarItemIdentifier} barItemIdentifier The bar item identifier.
|
|
10
9
|
*/
|
|
11
|
-
onItemClick?(event:
|
|
10
|
+
onItemClick?(event: ChartsActivationEvent | ChartsActivationEvent<SVGElement>, barItemIdentifier: BarItemIdentifier): void;
|
|
12
11
|
}
|
|
13
12
|
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type { BarItemIdentifier } from "../models/index.js";
|
|
1
|
+
import type { BarItemIdentifier, ChartsActivationEvent } from "../models/index.js";
|
|
3
2
|
declare module '@mui/x-charts/BarChart' {
|
|
4
3
|
interface BarPlotProps {
|
|
5
4
|
/**
|
|
6
5
|
* Callback fired when a bar item is clicked.
|
|
7
|
-
* @param {
|
|
6
|
+
* @param {ChartsActivationEvent | ChartsActivationEvent<SVGElement>} event The event source of the callback.
|
|
8
7
|
* It is a native MouseEvent for `svg-batch` renderer and a React MouseEvent for `svg-single` renderer.
|
|
9
8
|
* @param {BarItemIdentifier} barItemIdentifier The bar item identifier.
|
|
10
9
|
*/
|
|
11
|
-
onItemClick?(event:
|
|
10
|
+
onItemClick?(event: ChartsActivationEvent | ChartsActivationEvent<SVGElement>, barItemIdentifier: BarItemIdentifier): void;
|
|
12
11
|
}
|
|
13
12
|
}
|