@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
|
@@ -142,6 +142,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes /* remove-proptyp
|
|
|
142
142
|
* Options to enable features planned for the next major.
|
|
143
143
|
*/
|
|
144
144
|
experimentalFeatures: PropTypes.shape({
|
|
145
|
+
keyboardActivation: PropTypes.bool,
|
|
145
146
|
progressiveRendering: PropTypes.bool
|
|
146
147
|
}),
|
|
147
148
|
/**
|
|
@@ -15,6 +15,7 @@ var _useStore = require("../../internals/store/useStore");
|
|
|
15
15
|
var _useProgressiveRendering = require("../../internals/plugins/featurePlugins/useProgressiveRendering");
|
|
16
16
|
var _useChartCartesianAxis = require("../../internals/plugins/featurePlugins/useChartCartesianAxis");
|
|
17
17
|
var _scatterRenderData = require("./scatterRenderData.selectors");
|
|
18
|
+
var _useRegisterItemActivation = require("../../internals/useRegisterItemActivation");
|
|
18
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
20
|
/** Per-series points sampled while interacting; the rest fills in on settle. */const INTERACTION_POINT_BUDGET = 2000;
|
|
20
21
|
|
|
@@ -57,6 +58,14 @@ function ScatterAsync(props) {
|
|
|
57
58
|
// `count` (total points) is constant across zoom/pan, so the sampled set is
|
|
58
59
|
// stable while panning.
|
|
59
60
|
const interactionStep = getInteractionStep(count, nBatches, INTERACTION_POINT_BUDGET);
|
|
61
|
+
(0, _useRegisterItemActivation.useRegisterItemActivation)({
|
|
62
|
+
type: 'scatter',
|
|
63
|
+
seriesId: series.id
|
|
64
|
+
}, onItemClick && ((event, item) => onItemClick(event, {
|
|
65
|
+
type: 'scatter',
|
|
66
|
+
seriesId: series.id,
|
|
67
|
+
dataIndex: item.dataIndex
|
|
68
|
+
})));
|
|
60
69
|
const batches = [];
|
|
61
70
|
for (let b = 0; b < mountedBatches; b += 1) {
|
|
62
71
|
batches.push(/*#__PURE__*/(0, _jsxRuntime.jsx)(_ScatterAsyncBatch.ScatterAsyncBatch, {
|
|
@@ -7,6 +7,7 @@ import { useStore } from "../../internals/store/useStore.mjs";
|
|
|
7
7
|
import { selectorProgressiveBatchSize, selectorProgressiveSeriesRevealedBatches } from "../../internals/plugins/featurePlugins/useProgressiveRendering/index.mjs";
|
|
8
8
|
import { selectorChartZoomIsInteracting } from "../../internals/plugins/featurePlugins/useChartCartesianAxis/index.mjs";
|
|
9
9
|
import { selectorScatterSeriesRenderData } from "./scatterRenderData.selectors.mjs";
|
|
10
|
+
import { useRegisterItemActivation } from "../../internals/useRegisterItemActivation.mjs";
|
|
10
11
|
|
|
11
12
|
/** Per-series points sampled while interacting; the rest fills in on settle. */
|
|
12
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -51,6 +52,14 @@ function ScatterAsync(props) {
|
|
|
51
52
|
// `count` (total points) is constant across zoom/pan, so the sampled set is
|
|
52
53
|
// stable while panning.
|
|
53
54
|
const interactionStep = getInteractionStep(count, nBatches, INTERACTION_POINT_BUDGET);
|
|
55
|
+
useRegisterItemActivation({
|
|
56
|
+
type: 'scatter',
|
|
57
|
+
seriesId: series.id
|
|
58
|
+
}, onItemClick && ((event, item) => onItemClick(event, {
|
|
59
|
+
type: 'scatter',
|
|
60
|
+
seriesId: series.id,
|
|
61
|
+
dataIndex: item.dataIndex
|
|
62
|
+
})));
|
|
54
63
|
const batches = [];
|
|
55
64
|
for (let b = 0; b < mountedBatches; b += 1) {
|
|
56
65
|
batches.push(/*#__PURE__*/_jsx(ScatterAsyncBatch, {
|
|
@@ -256,6 +256,7 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes /* remove-propt
|
|
|
256
256
|
*/
|
|
257
257
|
experimentalFeatures: _propTypes.default.shape({
|
|
258
258
|
enablePositionBasedPointerInteraction: _propTypes.default.bool,
|
|
259
|
+
keyboardActivation: _propTypes.default.bool,
|
|
259
260
|
progressiveRendering: _propTypes.default.bool
|
|
260
261
|
}),
|
|
261
262
|
/**
|
|
@@ -478,7 +479,7 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes /* remove-propt
|
|
|
478
479
|
/**
|
|
479
480
|
* Callback fired when clicking close to an item.
|
|
480
481
|
* This is only available for scatter plot for now.
|
|
481
|
-
* @param {
|
|
482
|
+
* @param {ChartsActivationEvent} event Event caught at the svg level
|
|
482
483
|
* @param {ScatterItemIdentifier} scatterItemIdentifier Identify which item got clicked
|
|
483
484
|
*/
|
|
484
485
|
onItemClick: _propTypes.default.func,
|
|
@@ -249,6 +249,7 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes /* remove-propt
|
|
|
249
249
|
*/
|
|
250
250
|
experimentalFeatures: PropTypes.shape({
|
|
251
251
|
enablePositionBasedPointerInteraction: PropTypes.bool,
|
|
252
|
+
keyboardActivation: PropTypes.bool,
|
|
252
253
|
progressiveRendering: PropTypes.bool
|
|
253
254
|
}),
|
|
254
255
|
/**
|
|
@@ -471,7 +472,7 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes /* remove-propt
|
|
|
471
472
|
/**
|
|
472
473
|
* Callback fired when clicking close to an item.
|
|
473
474
|
* This is only available for scatter plot for now.
|
|
474
|
-
* @param {
|
|
475
|
+
* @param {ChartsActivationEvent} event Event caught at the svg level
|
|
475
476
|
* @param {ScatterItemIdentifier} scatterItemIdentifier Identify which item got clicked
|
|
476
477
|
*/
|
|
477
478
|
onItemClick: PropTypes.func,
|
package/Toolbar/ToolbarButton.js
CHANGED
|
@@ -16,7 +16,7 @@ var _useForkRef = _interopRequireDefault(require("@mui/utils/useForkRef"));
|
|
|
16
16
|
var _ToolbarContext = require("@mui/x-internals/ToolbarContext");
|
|
17
17
|
var _ChartsSlotsContext = require("../context/ChartsSlotsContext");
|
|
18
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
-
const _excluded = ["render", "onKeyDown", "onFocus", "disabled", "aria-disabled"],
|
|
19
|
+
const _excluded = ["render", "onKeyDown", "onFocus", "onBlur", "disabled", "aria-disabled"],
|
|
20
20
|
_excluded2 = ["tabIndex"];
|
|
21
21
|
const ToolbarButton = exports.ToolbarButton = /*#__PURE__*/React.forwardRef(function ToolbarButton(props, ref) {
|
|
22
22
|
const {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
-
const _excluded = ["render", "onKeyDown", "onFocus", "disabled", "aria-disabled"],
|
|
5
|
+
const _excluded = ["render", "onKeyDown", "onFocus", "onBlur", "disabled", "aria-disabled"],
|
|
6
6
|
_excluded2 = ["tabIndex"];
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import * as React from 'react';
|
|
@@ -7,6 +7,7 @@ exports.useAnimatePieArc = useAnimatePieArc;
|
|
|
7
7
|
var _d3Shape = require("@mui/x-charts-vendor/d3-shape");
|
|
8
8
|
var _d3Interpolate = require("@mui/x-charts-vendor/d3-interpolate");
|
|
9
9
|
var _useAnimate = require("./useAnimate");
|
|
10
|
+
var _snapEndAngleToFullCircle = require("../../internals/snapEndAngleToFullCircle");
|
|
10
11
|
function pieArcPropsInterpolator(from, to) {
|
|
11
12
|
const interpolateStartAngle = (0, _d3Interpolate.interpolateNumber)(from.startAngle, to.startAngle);
|
|
12
13
|
const interpolateEndAngle = (0, _d3Interpolate.interpolateNumber)(from.endAngle, to.endAngle);
|
|
@@ -53,7 +54,7 @@ function useAnimatePieArc(props) {
|
|
|
53
54
|
innerRadius: p.innerRadius,
|
|
54
55
|
outerRadius: p.outerRadius,
|
|
55
56
|
startAngle: p.startAngle,
|
|
56
|
-
endAngle: p.endAngle
|
|
57
|
+
endAngle: (0, _snapEndAngleToFullCircle.snapEndAngleToFullCircle)(p.startAngle, p.endAngle, p.outerRadius, p.paddingAngle)
|
|
57
58
|
}),
|
|
58
59
|
visibility: p.startAngle === p.endAngle ? 'hidden' : 'visible'
|
|
59
60
|
}),
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { arc as d3Arc } from '@mui/x-charts-vendor/d3-shape';
|
|
2
2
|
import { interpolateNumber } from '@mui/x-charts-vendor/d3-interpolate';
|
|
3
3
|
import { useAnimate } from "./useAnimate.mjs";
|
|
4
|
+
import { snapEndAngleToFullCircle } from "../../internals/snapEndAngleToFullCircle.mjs";
|
|
4
5
|
function pieArcPropsInterpolator(from, to) {
|
|
5
6
|
const interpolateStartAngle = interpolateNumber(from.startAngle, to.startAngle);
|
|
6
7
|
const interpolateEndAngle = interpolateNumber(from.endAngle, to.endAngle);
|
|
@@ -47,7 +48,7 @@ export function useAnimatePieArc(props) {
|
|
|
47
48
|
innerRadius: p.innerRadius,
|
|
48
49
|
outerRadius: p.outerRadius,
|
|
49
50
|
startAngle: p.startAngle,
|
|
50
|
-
endAngle: p.endAngle
|
|
51
|
+
endAngle: snapEndAngleToFullCircle(p.startAngle, p.endAngle, p.outerRadius, p.paddingAngle)
|
|
51
52
|
}),
|
|
52
53
|
visibility: p.startAngle === p.endAngle ? 'hidden' : 'visible'
|
|
53
54
|
}),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Get the focused item from keyboard navigation.
|
|
3
3
|
*/
|
|
4
|
-
export declare function useFocusedItem(): import("
|
|
4
|
+
export declare function useFocusedItem(): import("@mui/x-charts/models").FocusedItemIdentifier<keyof import("../internals/index.mjs").ChartsSeriesConfig> | null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Get the focused item from keyboard navigation.
|
|
3
3
|
*/
|
|
4
|
-
export declare function useFocusedItem(): import("
|
|
4
|
+
export declare function useFocusedItem(): import("@mui/x-charts/models").FocusedItemIdentifier<keyof import("../internals/index.js").ChartsSeriesConfig> | null;
|
|
@@ -6,4 +6,4 @@ import type { ChartSeriesType } from "../models/seriesType/config.mjs";
|
|
|
6
6
|
*
|
|
7
7
|
* @returns {(item: HighlightItemIdentifierWithType | null) => HighlightState} callback to get the highlight state of an item.
|
|
8
8
|
*/
|
|
9
|
-
export declare function useItemHighlightStateGetter<SeriesType extends ChartSeriesType>(): (item: import("
|
|
9
|
+
export declare function useItemHighlightStateGetter<SeriesType extends ChartSeriesType>(): (item: import("@mui/x-charts/models").HighlightItemIdentifierWithType<import("../internals/index.mjs").ComposableChartSeriesType<keyof import("../internals/index.mjs").ChartsSeriesConfig>> | null) => import("./useItemHighlightState.mjs").HighlightState;
|
|
@@ -6,4 +6,4 @@ import type { ChartSeriesType } from "../models/seriesType/config.js";
|
|
|
6
6
|
*
|
|
7
7
|
* @returns {(item: HighlightItemIdentifierWithType | null) => HighlightState} callback to get the highlight state of an item.
|
|
8
8
|
*/
|
|
9
|
-
export declare function useItemHighlightStateGetter<SeriesType extends ChartSeriesType>(): (item: import("
|
|
9
|
+
export declare function useItemHighlightStateGetter<SeriesType extends ChartSeriesType>(): (item: import("@mui/x-charts/models").HighlightItemIdentifierWithType<import("../internals/index.js").ComposableChartSeriesType<keyof import("../internals/index.js").ChartsSeriesConfig>> | null) => import("./useItemHighlightState.js").HighlightState;
|
package/index.js
CHANGED
package/index.mjs
CHANGED
|
@@ -28,7 +28,7 @@ compatibleSeriesTypes: Set<OutSeriesType>,
|
|
|
28
28
|
*/
|
|
29
29
|
allowCycles?: boolean,
|
|
30
30
|
/**
|
|
31
|
-
* If true, series max index is defined by the current series length and not all series.
|
|
31
|
+
* If true (default), series max index is defined by the current series length and not all series.
|
|
32
32
|
*/
|
|
33
33
|
useCurrentSeriesMaxLength?: boolean): (currentItem: WorkingItem | null, state: StateParameters<InSeriesType>) => ReturnedItem<OutSeriesType>;
|
|
34
34
|
export declare function createGetPreviousIndexFocusedItem<InSeriesType extends Exclude<ChartSeriesType, 'sankey' | 'heatmap'>, OutSeriesType extends Exclude<ChartSeriesType, 'sankey' | 'heatmap'> = InSeriesType>(
|
|
@@ -41,7 +41,7 @@ compatibleSeriesTypes: Set<OutSeriesType>,
|
|
|
41
41
|
*/
|
|
42
42
|
allowCycles?: boolean,
|
|
43
43
|
/**
|
|
44
|
-
* If true, series max index is defined by the current series length and not all series.
|
|
44
|
+
* If true (default), series max index is defined by the current series length and not all series.
|
|
45
45
|
*/
|
|
46
46
|
useCurrentSeriesMaxLength?: boolean): (currentItem: WorkingItem | null, state: StateParameters<InSeriesType>) => ReturnedItem<OutSeriesType>;
|
|
47
47
|
export declare function createGetNextSeriesFocusedItem<InSeriesType extends Exclude<ChartSeriesType, 'sankey' | 'heatmap'>, OutSeriesType extends Exclude<ChartSeriesType, 'sankey' | 'heatmap'> = InSeriesType>(
|
|
@@ -28,7 +28,7 @@ compatibleSeriesTypes: Set<OutSeriesType>,
|
|
|
28
28
|
*/
|
|
29
29
|
allowCycles?: boolean,
|
|
30
30
|
/**
|
|
31
|
-
* If true, series max index is defined by the current series length and not all series.
|
|
31
|
+
* If true (default), series max index is defined by the current series length and not all series.
|
|
32
32
|
*/
|
|
33
33
|
useCurrentSeriesMaxLength?: boolean): (currentItem: WorkingItem | null, state: StateParameters<InSeriesType>) => ReturnedItem<OutSeriesType>;
|
|
34
34
|
export declare function createGetPreviousIndexFocusedItem<InSeriesType extends Exclude<ChartSeriesType, 'sankey' | 'heatmap'>, OutSeriesType extends Exclude<ChartSeriesType, 'sankey' | 'heatmap'> = InSeriesType>(
|
|
@@ -41,7 +41,7 @@ compatibleSeriesTypes: Set<OutSeriesType>,
|
|
|
41
41
|
*/
|
|
42
42
|
allowCycles?: boolean,
|
|
43
43
|
/**
|
|
44
|
-
* If true, series max index is defined by the current series length and not all series.
|
|
44
|
+
* If true (default), series max index is defined by the current series length and not all series.
|
|
45
45
|
*/
|
|
46
46
|
useCurrentSeriesMaxLength?: boolean): (currentItem: WorkingItem | null, state: StateParameters<InSeriesType>) => ReturnedItem<OutSeriesType>;
|
|
47
47
|
export declare function createGetNextSeriesFocusedItem<InSeriesType extends Exclude<ChartSeriesType, 'sankey' | 'heatmap'>, OutSeriesType extends Exclude<ChartSeriesType, 'sankey' | 'heatmap'> = InSeriesType>(
|
|
@@ -33,9 +33,9 @@ compatibleSeriesTypes,
|
|
|
33
33
|
*/
|
|
34
34
|
allowCycles = false,
|
|
35
35
|
/**
|
|
36
|
-
* If true, series max index is defined by the current series length and not all series.
|
|
36
|
+
* If true (default), series max index is defined by the current series length and not all series.
|
|
37
37
|
*/
|
|
38
|
-
useCurrentSeriesMaxLength =
|
|
38
|
+
useCurrentSeriesMaxLength = true) {
|
|
39
39
|
return function getNextIndexFocusedItem(currentItem, state) {
|
|
40
40
|
const processedSeries = (0, _useChartSeries.selectorChartSeriesProcessed)(state);
|
|
41
41
|
let seriesId = currentItem?.seriesId;
|
|
@@ -84,9 +84,9 @@ compatibleSeriesTypes,
|
|
|
84
84
|
*/
|
|
85
85
|
allowCycles = false,
|
|
86
86
|
/**
|
|
87
|
-
* If true, series max index is defined by the current series length and not all series.
|
|
87
|
+
* If true (default), series max index is defined by the current series length and not all series.
|
|
88
88
|
*/
|
|
89
|
-
useCurrentSeriesMaxLength =
|
|
89
|
+
useCurrentSeriesMaxLength = true) {
|
|
90
90
|
return function getPreviousIndexFocusedItem(currentItem, state) {
|
|
91
91
|
const processedSeries = (0, _useChartSeries.selectorChartSeriesProcessed)(state);
|
|
92
92
|
let seriesId = currentItem?.seriesId;
|
|
@@ -25,9 +25,9 @@ compatibleSeriesTypes,
|
|
|
25
25
|
*/
|
|
26
26
|
allowCycles = false,
|
|
27
27
|
/**
|
|
28
|
-
* If true, series max index is defined by the current series length and not all series.
|
|
28
|
+
* If true (default), series max index is defined by the current series length and not all series.
|
|
29
29
|
*/
|
|
30
|
-
useCurrentSeriesMaxLength =
|
|
30
|
+
useCurrentSeriesMaxLength = true) {
|
|
31
31
|
return function getNextIndexFocusedItem(currentItem, state) {
|
|
32
32
|
const processedSeries = selectorChartSeriesProcessed(state);
|
|
33
33
|
let seriesId = currentItem?.seriesId;
|
|
@@ -76,9 +76,9 @@ compatibleSeriesTypes,
|
|
|
76
76
|
*/
|
|
77
77
|
allowCycles = false,
|
|
78
78
|
/**
|
|
79
|
-
* If true, series max index is defined by the current series length and not all series.
|
|
79
|
+
* If true (default), series max index is defined by the current series length and not all series.
|
|
80
80
|
*/
|
|
81
|
-
useCurrentSeriesMaxLength =
|
|
81
|
+
useCurrentSeriesMaxLength = true) {
|
|
82
82
|
return function getPreviousIndexFocusedItem(currentItem, state) {
|
|
83
83
|
const processedSeries = selectorChartSeriesProcessed(state);
|
|
84
84
|
let seriesId = currentItem?.seriesId;
|
|
@@ -60,6 +60,7 @@ function ChartsAccessibilityProxy() {
|
|
|
60
60
|
div.setAttribute('tabindex', '0');
|
|
61
61
|
}
|
|
62
62
|
div.setAttribute('role', 'img');
|
|
63
|
+
div.setAttribute('aria-hidden', 'true');
|
|
63
64
|
div.setAttribute('aria-labelledby', i === 0 ? `voiceover-${chartId}-1` : `voiceover-${chartId}-2`);
|
|
64
65
|
div.style.width = '100%';
|
|
65
66
|
div.style.height = '100%';
|
|
@@ -56,6 +56,7 @@ export function ChartsAccessibilityProxy() {
|
|
|
56
56
|
div.setAttribute('tabindex', '0');
|
|
57
57
|
}
|
|
58
58
|
div.setAttribute('role', 'img');
|
|
59
|
+
div.setAttribute('aria-hidden', 'true');
|
|
59
60
|
div.setAttribute('aria-labelledby', i === 0 ? `voiceover-${chartId}-1` : `voiceover-${chartId}-2`);
|
|
60
61
|
div.style.width = '100%';
|
|
61
62
|
div.style.height = '100%';
|
|
@@ -4,7 +4,7 @@ import type { ChartSeriesType } from "../models/seriesType/config.mjs";
|
|
|
4
4
|
*/
|
|
5
5
|
export declare function createCommonKeyboardFocusHandler<SeriesType extends Exclude<ChartSeriesType, 'sankey' | 'heatmap'>, TInputSeriesType extends Exclude<ChartSeriesType, 'sankey' | 'heatmap'> = SeriesType>(outSeriesTypes: Set<SeriesType>, allowCycles?: boolean, useCurrentSeriesMaxLength?: boolean): (event: KeyboardEvent) => ((currentItem: {
|
|
6
6
|
type: Exclude<ChartSeriesType, 'sankey' | 'heatmap'>;
|
|
7
|
-
seriesId: import("
|
|
7
|
+
seriesId: import("@mui/x-charts/models").SeriesId;
|
|
8
8
|
dataIndex?: number;
|
|
9
9
|
} | null, state: {
|
|
10
10
|
series: {
|
|
@@ -14,6 +14,6 @@ export declare function createCommonKeyboardFocusHandler<SeriesType extends Excl
|
|
|
14
14
|
};
|
|
15
15
|
}) => {
|
|
16
16
|
type: SeriesType;
|
|
17
|
-
seriesId: import("
|
|
17
|
+
seriesId: import("@mui/x-charts/models").SeriesId;
|
|
18
18
|
dataIndex: number;
|
|
19
19
|
} | null) | null;
|
|
@@ -4,7 +4,7 @@ import type { ChartSeriesType } from "../models/seriesType/config.js";
|
|
|
4
4
|
*/
|
|
5
5
|
export declare function createCommonKeyboardFocusHandler<SeriesType extends Exclude<ChartSeriesType, 'sankey' | 'heatmap'>, TInputSeriesType extends Exclude<ChartSeriesType, 'sankey' | 'heatmap'> = SeriesType>(outSeriesTypes: Set<SeriesType>, allowCycles?: boolean, useCurrentSeriesMaxLength?: boolean): (event: KeyboardEvent) => ((currentItem: {
|
|
6
6
|
type: Exclude<ChartSeriesType, 'sankey' | 'heatmap'>;
|
|
7
|
-
seriesId: import("
|
|
7
|
+
seriesId: import("@mui/x-charts/models").SeriesId;
|
|
8
8
|
dataIndex?: number;
|
|
9
9
|
} | null, state: {
|
|
10
10
|
series: {
|
|
@@ -14,6 +14,6 @@ export declare function createCommonKeyboardFocusHandler<SeriesType extends Excl
|
|
|
14
14
|
};
|
|
15
15
|
}) => {
|
|
16
16
|
type: SeriesType;
|
|
17
|
-
seriesId: import("
|
|
17
|
+
seriesId: import("@mui/x-charts/models").SeriesId;
|
|
18
18
|
dataIndex: number;
|
|
19
19
|
} | null) | null;
|
|
@@ -7,6 +7,7 @@ exports.createGetBarDimensions = createGetBarDimensions;
|
|
|
7
7
|
exports.createGetBucketBarDimensions = createGetBucketBarDimensions;
|
|
8
8
|
var _findMinMax = require("./findMinMax");
|
|
9
9
|
var _getBandSize = require("./getBandSize");
|
|
10
|
+
var _getSampledBucketRegion = require("./getSampledBucketRegion");
|
|
10
11
|
/** Minimum on-screen gap (px) kept between merged (sampled) bars so they stay distinguishable. */
|
|
11
12
|
const MIN_SAMPLED_BAR_GAP_PX = 2;
|
|
12
13
|
function shouldInvertStartCoordinate(verticalLayout, baseValue, reverse) {
|
|
@@ -78,9 +79,12 @@ function createGetBucketBarDimensions(params) {
|
|
|
78
79
|
const step = baseScale.step();
|
|
79
80
|
const valueScale = verticalLayout ? yAxisConfig.scale : xAxisConfig.scale;
|
|
80
81
|
return function getBucketBarDimensions(startIndex, endIndex, min, max, groupIndex) {
|
|
81
|
-
|
|
82
|
+
// Region matches the axis highlight (see `getSampledBandHighlight`) so bar and highlight stay in sync.
|
|
83
|
+
const {
|
|
84
|
+
regionStart,
|
|
85
|
+
regionSize: bucketStride
|
|
86
|
+
} = (0, _getSampledBucketRegion.getSampledBucketRegion)(baseScale, baseScaleConfig.data, startIndex, endIndex);
|
|
82
87
|
const bucketCount = endIndex - startIndex + 1;
|
|
83
|
-
const bucketStride = bucketCount * step;
|
|
84
88
|
|
|
85
89
|
// Keep the gap between buckets proportional to the bucket (same ratio as an unsampled chart),
|
|
86
90
|
// but never thinner than MIN_SAMPLED_BAR_GAP_PX so it stays visible at every level and zoom.
|
|
@@ -89,7 +93,8 @@ function createGetBucketBarDimensions(params) {
|
|
|
89
93
|
barWidth,
|
|
90
94
|
offset
|
|
91
95
|
} = (0, _getBandSize.getBandSize)(bucketStride - gap, numberOfGroups, baseScaleConfig.barGapRatio);
|
|
92
|
-
|
|
96
|
+
// Center the bars in the region (split the gap to both sides) so they sit under the highlight.
|
|
97
|
+
const barOffset = gap / 2 + groupIndex * (barWidth + offset);
|
|
93
98
|
const valueCoordinates = [valueScale(min), valueScale(max)];
|
|
94
99
|
const [minValueCoord, maxValueCoord] = (0, _findMinMax.findMinMax)(valueCoordinates).map(v => Math.round(v));
|
|
95
100
|
let barSize = maxValueCoord - minValueCoord;
|
|
@@ -97,8 +102,8 @@ function createGetBucketBarDimensions(params) {
|
|
|
97
102
|
barSize = Math.max(series.minBarSize, barSize);
|
|
98
103
|
}
|
|
99
104
|
return {
|
|
100
|
-
x: verticalLayout ?
|
|
101
|
-
y: verticalLayout ? minValueCoord :
|
|
105
|
+
x: verticalLayout ? regionStart + barOffset : minValueCoord,
|
|
106
|
+
y: verticalLayout ? minValueCoord : regionStart + barOffset,
|
|
102
107
|
height: verticalLayout ? barSize : barWidth,
|
|
103
108
|
width: verticalLayout ? barWidth : barSize
|
|
104
109
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { findMinMax } from "./findMinMax.mjs";
|
|
2
2
|
import { getBandSize } from "./getBandSize.mjs";
|
|
3
|
+
import { getSampledBucketRegion } from "./getSampledBucketRegion.mjs";
|
|
3
4
|
|
|
4
5
|
/** Minimum on-screen gap (px) kept between merged (sampled) bars so they stay distinguishable. */
|
|
5
6
|
const MIN_SAMPLED_BAR_GAP_PX = 2;
|
|
@@ -72,9 +73,12 @@ export function createGetBucketBarDimensions(params) {
|
|
|
72
73
|
const step = baseScale.step();
|
|
73
74
|
const valueScale = verticalLayout ? yAxisConfig.scale : xAxisConfig.scale;
|
|
74
75
|
return function getBucketBarDimensions(startIndex, endIndex, min, max, groupIndex) {
|
|
75
|
-
|
|
76
|
+
// Region matches the axis highlight (see `getSampledBandHighlight`) so bar and highlight stay in sync.
|
|
77
|
+
const {
|
|
78
|
+
regionStart,
|
|
79
|
+
regionSize: bucketStride
|
|
80
|
+
} = getSampledBucketRegion(baseScale, baseScaleConfig.data, startIndex, endIndex);
|
|
76
81
|
const bucketCount = endIndex - startIndex + 1;
|
|
77
|
-
const bucketStride = bucketCount * step;
|
|
78
82
|
|
|
79
83
|
// Keep the gap between buckets proportional to the bucket (same ratio as an unsampled chart),
|
|
80
84
|
// but never thinner than MIN_SAMPLED_BAR_GAP_PX so it stays visible at every level and zoom.
|
|
@@ -83,7 +87,8 @@ export function createGetBucketBarDimensions(params) {
|
|
|
83
87
|
barWidth,
|
|
84
88
|
offset
|
|
85
89
|
} = getBandSize(bucketStride - gap, numberOfGroups, baseScaleConfig.barGapRatio);
|
|
86
|
-
|
|
90
|
+
// Center the bars in the region (split the gap to both sides) so they sit under the highlight.
|
|
91
|
+
const barOffset = gap / 2 + groupIndex * (barWidth + offset);
|
|
87
92
|
const valueCoordinates = [valueScale(min), valueScale(max)];
|
|
88
93
|
const [minValueCoord, maxValueCoord] = findMinMax(valueCoordinates).map(v => Math.round(v));
|
|
89
94
|
let barSize = maxValueCoord - minValueCoord;
|
|
@@ -91,8 +96,8 @@ export function createGetBucketBarDimensions(params) {
|
|
|
91
96
|
barSize = Math.max(series.minBarSize, barSize);
|
|
92
97
|
}
|
|
93
98
|
return {
|
|
94
|
-
x: verticalLayout ?
|
|
95
|
-
y: verticalLayout ? minValueCoord :
|
|
99
|
+
x: verticalLayout ? regionStart + barOffset : minValueCoord,
|
|
100
|
+
y: verticalLayout ? minValueCoord : regionStart + barOffset,
|
|
96
101
|
height: verticalLayout ? barSize : barWidth,
|
|
97
102
|
width: verticalLayout ? barWidth : barSize
|
|
98
103
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { D3OrdinalScale } from "../models/axis.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* Computes the band region covered by a sampled bucket spanning `data[startIndex..endIndex]`.
|
|
4
|
+
*
|
|
5
|
+
* The region is anchored at its left-most slot and spans whole steps, so both the rendered bar
|
|
6
|
+
* (see `createGetBucketBarDimensions`) and the axis highlight (see `getSampledBandHighlight`)
|
|
7
|
+
* stay in sync — on a reversed axis `startIndex` maps to the right, hence the `Math.min`.
|
|
8
|
+
*/
|
|
9
|
+
export declare function getSampledBucketRegion(scale: D3OrdinalScale, data: readonly any[], startIndex: number, endIndex: number): {
|
|
10
|
+
regionStart: number;
|
|
11
|
+
regionSize: number;
|
|
12
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { D3OrdinalScale } from "../models/axis.js";
|
|
2
|
+
/**
|
|
3
|
+
* Computes the band region covered by a sampled bucket spanning `data[startIndex..endIndex]`.
|
|
4
|
+
*
|
|
5
|
+
* The region is anchored at its left-most slot and spans whole steps, so both the rendered bar
|
|
6
|
+
* (see `createGetBucketBarDimensions`) and the axis highlight (see `getSampledBandHighlight`)
|
|
7
|
+
* stay in sync — on a reversed axis `startIndex` maps to the right, hence the `Math.min`.
|
|
8
|
+
*/
|
|
9
|
+
export declare function getSampledBucketRegion(scale: D3OrdinalScale, data: readonly any[], startIndex: number, endIndex: number): {
|
|
10
|
+
regionStart: number;
|
|
11
|
+
regionSize: number;
|
|
12
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getSampledBucketRegion = getSampledBucketRegion;
|
|
7
|
+
/**
|
|
8
|
+
* Computes the band region covered by a sampled bucket spanning `data[startIndex..endIndex]`.
|
|
9
|
+
*
|
|
10
|
+
* The region is anchored at its left-most slot and spans whole steps, so both the rendered bar
|
|
11
|
+
* (see `createGetBucketBarDimensions`) and the axis highlight (see `getSampledBandHighlight`)
|
|
12
|
+
* stay in sync — on a reversed axis `startIndex` maps to the right, hence the `Math.min`.
|
|
13
|
+
*/
|
|
14
|
+
function getSampledBucketRegion(scale, data, startIndex, endIndex) {
|
|
15
|
+
const step = scale.step();
|
|
16
|
+
const halfPadding = (step - scale.bandwidth()) / 2;
|
|
17
|
+
const startPos = scale(data[startIndex]);
|
|
18
|
+
const endPos = scale(data[endIndex]);
|
|
19
|
+
return {
|
|
20
|
+
regionStart: Math.min(startPos, endPos) - halfPadding,
|
|
21
|
+
regionSize: (endIndex - startIndex + 1) * step
|
|
22
|
+
};
|
|
23
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Computes the band region covered by a sampled bucket spanning `data[startIndex..endIndex]`.
|
|
3
|
+
*
|
|
4
|
+
* The region is anchored at its left-most slot and spans whole steps, so both the rendered bar
|
|
5
|
+
* (see `createGetBucketBarDimensions`) and the axis highlight (see `getSampledBandHighlight`)
|
|
6
|
+
* stay in sync — on a reversed axis `startIndex` maps to the right, hence the `Math.min`.
|
|
7
|
+
*/
|
|
8
|
+
export function getSampledBucketRegion(scale, data, startIndex, endIndex) {
|
|
9
|
+
const step = scale.step();
|
|
10
|
+
const halfPadding = (step - scale.bandwidth()) / 2;
|
|
11
|
+
const startPos = scale(data[startIndex]);
|
|
12
|
+
const endPos = scale(data[endIndex]);
|
|
13
|
+
return {
|
|
14
|
+
regionStart: Math.min(startPos, endPos) - halfPadding,
|
|
15
|
+
regionSize: (endIndex - startIndex + 1) * step
|
|
16
|
+
};
|
|
17
|
+
}
|
package/internals/index.d.mts
CHANGED
|
@@ -76,6 +76,7 @@ export * from "./scaleGuards.mjs";
|
|
|
76
76
|
export * from "./findMinMax.mjs";
|
|
77
77
|
export * from "./commonNextFocusItem.mjs";
|
|
78
78
|
export { createCommonKeyboardFocusHandler } from "./createCommonKeyboardFocusHandler.mjs";
|
|
79
|
+
export { useRegisterItemActivation } from "./useRegisterItemActivation.mjs";
|
|
79
80
|
export { getSeriesColorFn } from "./getSeriesColorFn.mjs";
|
|
80
81
|
export { resolveColorProcessor } from "./resolveColorProcessor.mjs";
|
|
81
82
|
export { processLineLikeSeries } from "./processLineLikeSeries.mjs";
|
package/internals/index.d.ts
CHANGED
|
@@ -76,6 +76,7 @@ export * from "./scaleGuards.js";
|
|
|
76
76
|
export * from "./findMinMax.js";
|
|
77
77
|
export * from "./commonNextFocusItem.js";
|
|
78
78
|
export { createCommonKeyboardFocusHandler } from "./createCommonKeyboardFocusHandler.js";
|
|
79
|
+
export { useRegisterItemActivation } from "./useRegisterItemActivation.js";
|
|
79
80
|
export { getSeriesColorFn } from "./getSeriesColorFn.js";
|
|
80
81
|
export { resolveColorProcessor } from "./resolveColorProcessor.js";
|
|
81
82
|
export { processLineLikeSeries } from "./processLineLikeSeries.js";
|
package/internals/index.js
CHANGED
|
@@ -23,6 +23,7 @@ var _exportNames = {
|
|
|
23
23
|
getCartesianAxisIndex: true,
|
|
24
24
|
getRotationAxisIndex: true,
|
|
25
25
|
createCommonKeyboardFocusHandler: true,
|
|
26
|
+
useRegisterItemActivation: true,
|
|
26
27
|
getSeriesColorFn: true,
|
|
27
28
|
resolveColorProcessor: true,
|
|
28
29
|
processLineLikeSeries: true,
|
|
@@ -186,6 +187,12 @@ Object.defineProperty(exports, "useRadarChartProps", {
|
|
|
186
187
|
return _useRadarChartProps.useRadarChartProps;
|
|
187
188
|
}
|
|
188
189
|
});
|
|
190
|
+
Object.defineProperty(exports, "useRegisterItemActivation", {
|
|
191
|
+
enumerable: true,
|
|
192
|
+
get: function () {
|
|
193
|
+
return _useRegisterItemActivation.useRegisterItemActivation;
|
|
194
|
+
}
|
|
195
|
+
});
|
|
189
196
|
Object.defineProperty(exports, "useRegisterPointerInteractions", {
|
|
190
197
|
enumerable: true,
|
|
191
198
|
get: function () {
|
|
@@ -953,6 +960,7 @@ Object.keys(_commonNextFocusItem).forEach(function (key) {
|
|
|
953
960
|
});
|
|
954
961
|
});
|
|
955
962
|
var _createCommonKeyboardFocusHandler = require("./createCommonKeyboardFocusHandler");
|
|
963
|
+
var _useRegisterItemActivation = require("./useRegisterItemActivation");
|
|
956
964
|
var _getSeriesColorFn = require("./getSeriesColorFn");
|
|
957
965
|
var _resolveColorProcessor = require("./resolveColorProcessor");
|
|
958
966
|
var _processLineLikeSeries = require("./processLineLikeSeries");
|
package/internals/index.mjs
CHANGED
|
@@ -84,6 +84,7 @@ export * from "./scaleGuards.mjs";
|
|
|
84
84
|
export * from "./findMinMax.mjs";
|
|
85
85
|
export * from "./commonNextFocusItem.mjs";
|
|
86
86
|
export { createCommonKeyboardFocusHandler } from "./createCommonKeyboardFocusHandler.mjs";
|
|
87
|
+
export { useRegisterItemActivation } from "./useRegisterItemActivation.mjs";
|
|
87
88
|
export { getSeriesColorFn } from "./getSeriesColorFn.mjs";
|
|
88
89
|
export { resolveColorProcessor } from "./resolveColorProcessor.mjs";
|
|
89
90
|
export { processLineLikeSeries } from "./processLineLikeSeries.mjs";
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import type { ChartPluginSignature } from "../../models/index.mjs";
|
|
2
2
|
import type { ChartSeriesType } from "../../../../models/seriesType/config.mjs";
|
|
3
|
+
interface CommonExperimentalFeatures {
|
|
4
|
+
/**
|
|
5
|
+
* Enables activating the keyboard-focused item with <kbd>Enter</kbd> or <kbd>Space</kbd>,
|
|
6
|
+
* firing `onItemClick` and `onAxisClick` as a pointer click would.
|
|
7
|
+
*/
|
|
8
|
+
keyboardActivation?: boolean;
|
|
9
|
+
}
|
|
3
10
|
interface LineExperimentalFeatures {
|
|
4
11
|
/**
|
|
5
12
|
* Enables pointer-based interaction detection for line and area series.
|
|
@@ -27,7 +34,7 @@ interface ScatterExperimentalFeatures {
|
|
|
27
34
|
*/
|
|
28
35
|
progressiveRendering?: boolean;
|
|
29
36
|
}
|
|
30
|
-
export type ChartExperimentalFeatures<SeriesType extends ChartSeriesType = ChartSeriesType> = ('line' extends SeriesType ? LineExperimentalFeatures : {}) & ('scatter' extends SeriesType ? ScatterExperimentalFeatures : {});
|
|
37
|
+
export type ChartExperimentalFeatures<SeriesType extends ChartSeriesType = ChartSeriesType> = CommonExperimentalFeatures & ('line' extends SeriesType ? LineExperimentalFeatures : {}) & ('scatter' extends SeriesType ? ScatterExperimentalFeatures : {});
|
|
31
38
|
export interface UseChartExperimentalFeaturesParameters<SeriesType extends ChartSeriesType = ChartSeriesType> {
|
|
32
39
|
/**
|
|
33
40
|
* Options to enable features planned for the next major.
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import type { ChartPluginSignature } from "../../models/index.js";
|
|
2
2
|
import type { ChartSeriesType } from "../../../../models/seriesType/config.js";
|
|
3
|
+
interface CommonExperimentalFeatures {
|
|
4
|
+
/**
|
|
5
|
+
* Enables activating the keyboard-focused item with <kbd>Enter</kbd> or <kbd>Space</kbd>,
|
|
6
|
+
* firing `onItemClick` and `onAxisClick` as a pointer click would.
|
|
7
|
+
*/
|
|
8
|
+
keyboardActivation?: boolean;
|
|
9
|
+
}
|
|
3
10
|
interface LineExperimentalFeatures {
|
|
4
11
|
/**
|
|
5
12
|
* Enables pointer-based interaction detection for line and area series.
|
|
@@ -27,7 +34,7 @@ interface ScatterExperimentalFeatures {
|
|
|
27
34
|
*/
|
|
28
35
|
progressiveRendering?: boolean;
|
|
29
36
|
}
|
|
30
|
-
export type ChartExperimentalFeatures<SeriesType extends ChartSeriesType = ChartSeriesType> = ('line' extends SeriesType ? LineExperimentalFeatures : {}) & ('scatter' extends SeriesType ? ScatterExperimentalFeatures : {});
|
|
37
|
+
export type ChartExperimentalFeatures<SeriesType extends ChartSeriesType = ChartSeriesType> = CommonExperimentalFeatures & ('line' extends SeriesType ? LineExperimentalFeatures : {}) & ('scatter' extends SeriesType ? ScatterExperimentalFeatures : {});
|
|
31
38
|
export interface UseChartExperimentalFeaturesParameters<SeriesType extends ChartSeriesType = ChartSeriesType> {
|
|
32
39
|
/**
|
|
33
40
|
* Options to enable features planned for the next major.
|
package/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.js
CHANGED
|
@@ -32,7 +32,10 @@ const useChartInteractionListener = ({
|
|
|
32
32
|
preventIf: ['pan', 'zoomPinch', 'zoomPan']
|
|
33
33
|
}), new _core.TapGesture({
|
|
34
34
|
name: 'tap',
|
|
35
|
-
|
|
35
|
+
// `pan` is intentionally omitted: it has `threshold: 0`, so any pointer drift during a
|
|
36
|
+
// click activates it and would cancel the tap, discarding the click. The tap's own
|
|
37
|
+
// `maxDistance` already discriminates a click from a drag. See https://github.com/mui/mui-x/issues/20364
|
|
38
|
+
preventIf: ['zoomPinch', 'zoomPan']
|
|
36
39
|
}), new _core.PressGesture({
|
|
37
40
|
name: 'quickPress',
|
|
38
41
|
duration: 50
|
|
@@ -51,8 +54,13 @@ const useChartInteractionListener = ({
|
|
|
51
54
|
}
|
|
52
55
|
gestureManager.registerElement(['pan', 'move', 'tap', 'quickPress', 'brush'], svg);
|
|
53
56
|
return () => {
|
|
54
|
-
// Cleanup gesture manager
|
|
55
|
-
|
|
57
|
+
// Cleanup gesture manager. `destroy()` unregisters every element's gestures like
|
|
58
|
+
// `unregisterAllGestures()` does, and is additionally the only path that removes the
|
|
59
|
+
// document/window listeners owned by the internal PointerManager and KeyboardManager.
|
|
60
|
+
gestureManager.destroy();
|
|
61
|
+
// The manager is unusable once destroyed, so drop it and let the next mount build a
|
|
62
|
+
// fresh one. Reusing a destroyed manager loses its gesture templates.
|
|
63
|
+
gestureManagerRef.current = null;
|
|
56
64
|
};
|
|
57
65
|
}, [chartsLayerContainerRef, gestureManagerRef]);
|
|
58
66
|
const addInteractionListener = React.useCallback((interaction, callback, options) => {
|