@mui/x-charts 8.11.3 → 8.12.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.d.ts +2 -2
- package/BarChart/BarChart.js +1 -0
- package/BarChart/BarChart.plugins.d.ts +3 -2
- package/BarChart/BarChart.plugins.js +2 -1
- package/BarChart/BarElement.js +10 -2
- package/BarChart/index.d.ts +1 -0
- package/BarChart/index.js +12 -0
- package/BarChart/useBarChartProps.d.ts +2 -2
- package/CHANGELOG.md +151 -6
- package/ChartContainer/ChartContainer.js +4 -2
- package/ChartContainer/useChartContainerProps.js +4 -2
- package/ChartsLegend/ContinuousColorLegend.js +1 -0
- package/ChartsLegend/PiecewiseColorLegend.js +1 -0
- package/ChartsSurface/ChartsSurface.js +21 -2
- package/ChartsWrapper/ChartsWrapper.d.ts +2 -1
- package/ChartsWrapper/ChartsWrapper.js +49 -46
- package/ChartsXAxis/useAxisTicksProps.d.ts +3 -3
- package/ChartsYAxis/useAxisTicksProps.d.ts +3 -3
- package/LineChart/FocusedMark.d.ts +2 -0
- package/LineChart/FocusedMark.js +44 -0
- package/LineChart/LineChart.d.ts +2 -2
- package/LineChart/LineChart.js +3 -1
- package/LineChart/LineChart.plugins.d.ts +3 -2
- package/LineChart/LineChart.plugins.js +2 -1
- package/LineChart/index.d.ts +1 -0
- package/LineChart/index.js +12 -0
- package/LineChart/useLineChartProps.d.ts +2 -2
- package/PieChart/PieArc.d.ts +1 -0
- package/PieChart/PieArc.js +7 -3
- package/PieChart/PieArcPlot.js +1 -0
- package/PieChart/PieChart.js +1 -0
- package/PieChart/PieChart.plugins.d.ts +2 -1
- package/PieChart/PieChart.plugins.js +2 -1
- package/PieChart/dataTransform/useTransformData.d.ts +1 -0
- package/PieChart/dataTransform/useTransformData.js +9 -1
- package/PieChart/index.d.ts +1 -0
- package/PieChart/index.js +12 -0
- package/RadarChart/RadarChart.plugins.d.ts +1 -1
- package/RadarChart/RadarDataProvider/RadarDataProvider.d.ts +3 -3
- package/RadarChart/index.d.ts +2 -1
- package/RadarChart/index.js +12 -0
- package/RadarChart/useRadarChartProps.d.ts +2 -2
- package/ScatterChart/BatchScatter.d.ts +32 -0
- package/ScatterChart/BatchScatter.js +171 -0
- package/ScatterChart/Scatter.js +13 -5
- package/ScatterChart/ScatterChart.d.ts +4 -4
- package/ScatterChart/ScatterChart.js +13 -2
- package/ScatterChart/ScatterChart.plugins.d.ts +4 -3
- package/ScatterChart/ScatterChart.plugins.js +3 -2
- package/ScatterChart/ScatterPlot.d.ts +10 -0
- package/ScatterChart/ScatterPlot.js +14 -2
- package/ScatterChart/index.d.ts +1 -0
- package/ScatterChart/index.js +12 -0
- package/ScatterChart/useScatterChartProps.d.ts +2 -2
- package/ScatterChart/useScatterChartProps.js +8 -5
- package/SparkLineChart/SparkLineChart.js +10 -5
- package/Toolbar/Toolbar.js +1 -2
- package/colorPalettes/types.d.ts +1 -1
- package/context/ChartApi.d.ts +6 -6
- package/esm/BarChart/BarChart.d.ts +2 -2
- package/esm/BarChart/BarChart.js +1 -0
- package/esm/BarChart/BarChart.plugins.d.ts +3 -2
- package/esm/BarChart/BarChart.plugins.js +2 -1
- package/esm/BarChart/BarElement.js +10 -2
- package/esm/BarChart/index.d.ts +1 -0
- package/esm/BarChart/index.js +1 -0
- package/esm/BarChart/useBarChartProps.d.ts +2 -2
- package/esm/ChartContainer/ChartContainer.js +4 -2
- package/esm/ChartContainer/useChartContainerProps.js +4 -2
- package/esm/ChartsLegend/ContinuousColorLegend.js +1 -0
- package/esm/ChartsLegend/PiecewiseColorLegend.js +1 -0
- package/esm/ChartsSurface/ChartsSurface.js +21 -2
- package/esm/ChartsWrapper/ChartsWrapper.d.ts +2 -1
- package/esm/ChartsWrapper/ChartsWrapper.js +49 -46
- package/esm/ChartsXAxis/useAxisTicksProps.d.ts +3 -3
- package/esm/ChartsYAxis/useAxisTicksProps.d.ts +3 -3
- package/esm/LineChart/FocusedMark.d.ts +2 -0
- package/esm/LineChart/FocusedMark.js +38 -0
- package/esm/LineChart/LineChart.d.ts +2 -2
- package/esm/LineChart/LineChart.js +3 -1
- package/esm/LineChart/LineChart.plugins.d.ts +3 -2
- package/esm/LineChart/LineChart.plugins.js +2 -1
- package/esm/LineChart/index.d.ts +1 -0
- package/esm/LineChart/index.js +1 -0
- package/esm/LineChart/useLineChartProps.d.ts +2 -2
- package/esm/PieChart/PieArc.d.ts +1 -0
- package/esm/PieChart/PieArc.js +7 -3
- package/esm/PieChart/PieArcPlot.js +1 -0
- package/esm/PieChart/PieChart.js +1 -0
- package/esm/PieChart/PieChart.plugins.d.ts +2 -1
- package/esm/PieChart/PieChart.plugins.js +2 -1
- package/esm/PieChart/dataTransform/useTransformData.d.ts +1 -0
- package/esm/PieChart/dataTransform/useTransformData.js +9 -1
- package/esm/PieChart/index.d.ts +1 -0
- package/esm/PieChart/index.js +1 -0
- package/esm/RadarChart/RadarChart.plugins.d.ts +1 -1
- package/esm/RadarChart/RadarDataProvider/RadarDataProvider.d.ts +3 -3
- package/esm/RadarChart/index.d.ts +2 -1
- package/esm/RadarChart/index.js +2 -1
- package/esm/RadarChart/useRadarChartProps.d.ts +2 -2
- package/esm/ScatterChart/BatchScatter.d.ts +32 -0
- package/esm/ScatterChart/BatchScatter.js +165 -0
- package/esm/ScatterChart/Scatter.js +13 -5
- package/esm/ScatterChart/ScatterChart.d.ts +4 -4
- package/esm/ScatterChart/ScatterChart.js +13 -2
- package/esm/ScatterChart/ScatterChart.plugins.d.ts +4 -3
- package/esm/ScatterChart/ScatterChart.plugins.js +3 -2
- package/esm/ScatterChart/ScatterPlot.d.ts +10 -0
- package/esm/ScatterChart/ScatterPlot.js +14 -2
- package/esm/ScatterChart/index.d.ts +1 -0
- package/esm/ScatterChart/index.js +1 -0
- package/esm/ScatterChart/useScatterChartProps.d.ts +2 -2
- package/esm/ScatterChart/useScatterChartProps.js +8 -5
- package/esm/SparkLineChart/SparkLineChart.js +10 -5
- package/esm/Toolbar/Toolbar.js +1 -2
- package/esm/colorPalettes/types.d.ts +1 -1
- package/esm/context/ChartApi.d.ts +6 -6
- package/esm/hooks/useAxis.d.ts +5 -5
- package/esm/hooks/useDrawingArea.d.ts +20 -2
- package/esm/hooks/useFocusedItem.d.ts +15 -0
- package/esm/hooks/useFocusedItem.js +20 -0
- package/esm/hooks/useIsItemFocused.d.ts +12 -0
- package/esm/hooks/useIsItemFocused.js +15 -0
- package/esm/hooks/useIsItemFocusedGetter.d.ts +8 -0
- package/esm/hooks/useIsItemFocusedGetter.js +14 -0
- package/esm/hooks/useScale.js +6 -0
- package/esm/index.d.ts +1 -0
- package/esm/index.js +2 -1
- package/esm/internals/animation/Transition.js +1 -3
- package/esm/internals/index.d.ts +3 -2
- package/esm/internals/index.js +3 -2
- package/esm/internals/plugins/allPlugins.d.ts +5 -4
- package/esm/internals/plugins/allPlugins.js +3 -2
- package/esm/internals/plugins/corePlugins/useChartSeries/processSeries.d.ts +1 -1
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.d.ts +2 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +66 -72
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.d.ts +3 -19
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.js +10 -18
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisDomainLimit.d.ts +1 -1
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/{getAxisExtremum.d.ts → getAxisExtrema.d.ts} +1 -1
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisExtrema.js +24 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisScale.d.ts +63 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisScale.js +123 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +8 -6
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.d.ts +2 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.js +46 -4
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +10 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +32 -21
- package/esm/internals/plugins/featurePlugins/useChartClosestPoint/index.d.ts +3 -0
- package/esm/internals/plugins/featurePlugins/useChartClosestPoint/index.js +2 -0
- package/esm/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.d.ts +3 -0
- package/esm/internals/plugins/featurePlugins/{useChartVoronoi/useChartVoronoi.js → useChartClosestPoint/useChartClosestPoint.js} +9 -7
- package/esm/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.selectors.d.ts +5 -0
- package/esm/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.selectors.js +3 -0
- package/esm/internals/plugins/featurePlugins/{useChartVoronoi/useChartVoronoi.types.d.ts → useChartClosestPoint/useChartClosestPoint.types.d.ts} +8 -4
- package/esm/internals/plugins/featurePlugins/useChartHighlight/highlightStates.d.ts +16 -0
- package/esm/internals/plugins/featurePlugins/useChartHighlight/highlightStates.js +32 -0
- package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.d.ts +4 -0
- package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.js +5 -0
- package/esm/internals/plugins/featurePlugins/useChartInteraction/checkHasInteractionPlugin.d.ts +3 -0
- package/esm/internals/plugins/featurePlugins/useChartInteraction/checkHasInteractionPlugin.js +3 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/index.d.ts +3 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/index.js +2 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.d.ts +3 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.helpers.d.ts +20 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.helpers.js +88 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.js +210 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.d.ts +25 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.js +7 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.d.ts +34 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.js +1 -0
- package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +10 -8
- package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.types.d.ts +2 -1
- package/esm/internals/plugins/models/seriesConfig/getSeriesWithDefaultValues.types.d.ts +1 -1
- package/esm/internals/scaleGuards.d.ts +7 -0
- package/esm/internals/scaleGuards.js +6 -0
- package/esm/locales/elGR.d.ts +96 -0
- package/esm/locales/elGR.js +100 -0
- package/esm/locales/enUS.d.ts +96 -0
- package/esm/locales/enUS.js +99 -1
- package/esm/locales/frFR.d.ts +96 -0
- package/esm/locales/frFR.js +100 -2
- package/esm/locales/ptBR.d.ts +96 -0
- package/esm/locales/ptBR.js +100 -0
- package/esm/locales/ptPT.d.ts +96 -0
- package/esm/locales/ptPT.js +100 -0
- package/esm/locales/svSE.d.ts +97 -1
- package/esm/locales/svSE.js +100 -0
- package/esm/locales/utils/chartsLocaleTextApi.d.ts +384 -0
- package/esm/locales/utils/getChartsLocalization.d.ts +96 -0
- package/esm/plugins/index.d.ts +6 -0
- package/esm/plugins/index.js +12 -0
- package/hooks/useAxis.d.ts +5 -5
- package/hooks/useDrawingArea.d.ts +20 -2
- package/hooks/useFocusedItem.d.ts +15 -0
- package/hooks/useFocusedItem.js +26 -0
- package/hooks/useIsItemFocused.d.ts +12 -0
- package/hooks/useIsItemFocused.js +20 -0
- package/hooks/useIsItemFocusedGetter.d.ts +8 -0
- package/hooks/useIsItemFocusedGetter.js +18 -0
- package/hooks/useScale.js +6 -0
- package/index.d.ts +1 -0
- package/index.js +13 -1
- package/internals/animation/Transition.js +0 -2
- package/internals/index.d.ts +3 -2
- package/internals/index.js +20 -8
- package/internals/plugins/allPlugins.d.ts +5 -4
- package/internals/plugins/allPlugins.js +3 -2
- package/internals/plugins/corePlugins/useChartSeries/processSeries.d.ts +1 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.d.ts +2 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +63 -69
- package/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.d.ts +3 -19
- package/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.js +10 -18
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisDomainLimit.d.ts +1 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/{getAxisExtremum.d.ts → getAxisExtrema.d.ts} +1 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisExtrema.js +30 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisScale.d.ts +63 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisScale.js +134 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +8 -6
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.d.ts +2 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.js +47 -5
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +10 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +33 -22
- package/internals/plugins/featurePlugins/useChartClosestPoint/index.d.ts +3 -0
- package/internals/plugins/featurePlugins/useChartClosestPoint/index.js +27 -0
- package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.d.ts +3 -0
- package/internals/plugins/featurePlugins/{useChartVoronoi/useChartVoronoi.js → useChartClosestPoint/useChartClosestPoint.js} +11 -9
- package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.selectors.d.ts +5 -0
- package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.selectors.js +9 -0
- package/internals/plugins/featurePlugins/{useChartVoronoi/useChartVoronoi.types.d.ts → useChartClosestPoint/useChartClosestPoint.types.d.ts} +8 -4
- package/internals/plugins/featurePlugins/useChartHighlight/highlightStates.d.ts +16 -0
- package/internals/plugins/featurePlugins/useChartHighlight/highlightStates.js +41 -0
- package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.d.ts +4 -0
- package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.js +6 -1
- package/internals/plugins/featurePlugins/useChartInteraction/checkHasInteractionPlugin.d.ts +3 -0
- package/internals/plugins/featurePlugins/useChartInteraction/checkHasInteractionPlugin.js +9 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/index.d.ts +3 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/index.js +27 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.d.ts +3 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.helpers.d.ts +20 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.helpers.js +96 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.js +218 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.d.ts +25 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.js +13 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.d.ts +34 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.js +5 -0
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +10 -8
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.types.d.ts +2 -1
- package/internals/plugins/models/seriesConfig/getSeriesWithDefaultValues.types.d.ts +1 -1
- package/internals/scaleGuards.d.ts +7 -0
- package/internals/scaleGuards.js +8 -0
- package/locales/elGR.d.ts +96 -0
- package/locales/elGR.js +100 -0
- package/locales/enUS.d.ts +96 -0
- package/locales/enUS.js +99 -1
- package/locales/frFR.d.ts +96 -0
- package/locales/frFR.js +100 -2
- package/locales/ptBR.d.ts +96 -0
- package/locales/ptBR.js +100 -0
- package/locales/ptPT.d.ts +96 -0
- package/locales/ptPT.js +100 -0
- package/locales/svSE.d.ts +97 -1
- package/locales/svSE.js +100 -0
- package/locales/utils/chartsLocaleTextApi.d.ts +384 -0
- package/locales/utils/getChartsLocalization.d.ts +96 -0
- package/package.json +4 -4
- package/plugins/index.d.ts +6 -0
- package/plugins/index.js +47 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisExtremum.js +0 -22
- package/esm/internals/plugins/featurePlugins/useChartVoronoi/index.d.ts +0 -3
- package/esm/internals/plugins/featurePlugins/useChartVoronoi/index.js +0 -2
- package/esm/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.d.ts +0 -3
- package/esm/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.selectors.d.ts +0 -5
- package/esm/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.selectors.js +0 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisExtremum.js +0 -29
- package/internals/plugins/featurePlugins/useChartVoronoi/index.d.ts +0 -3
- package/internals/plugins/featurePlugins/useChartVoronoi/index.js +0 -27
- package/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.d.ts +0 -3
- package/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.selectors.d.ts +0 -5
- package/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.selectors.js +0 -9
- /package/esm/internals/plugins/featurePlugins/{useChartVoronoi/useChartVoronoi.types.js → useChartClosestPoint/useChartClosestPoint.types.js} +0 -0
- /package/internals/plugins/featurePlugins/{useChartVoronoi/useChartVoronoi.types.js → useChartClosestPoint/useChartClosestPoint.types.js} +0 -0
|
@@ -12,6 +12,7 @@ import { useSvgRef } from "../hooks/useSvgRef.js";
|
|
|
12
12
|
import { useSelector } from "../internals/store/useSelector.js";
|
|
13
13
|
import { useStore } from "../internals/store/useStore.js";
|
|
14
14
|
import { selectorChartContainerSize, selectorChartPropsSize } from "../internals/plugins/corePlugins/useChartDimensions/useChartDimensions.selectors.js";
|
|
15
|
+
import { selectorChartsHasFocusedItem, selectorChartsIsKeyboardNavigationEnabled } from "../internals/plugins/featurePlugins/useChartKeyboardNavigation/index.js";
|
|
15
16
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
17
|
const ChartsSurfaceStyles = styled('svg', {
|
|
17
18
|
name: 'MuiChartsSurface',
|
|
@@ -31,7 +32,21 @@ const ChartsSurfaceStyles = styled('svg', {
|
|
|
31
32
|
// For example, prevent page scroll & zoom.
|
|
32
33
|
touchAction: 'pan-y',
|
|
33
34
|
userSelect: 'none',
|
|
34
|
-
gridArea: 'chart'
|
|
35
|
+
gridArea: 'chart',
|
|
36
|
+
'&:focus': {
|
|
37
|
+
outline: 'none' // By default don't show focus on the SVG container
|
|
38
|
+
},
|
|
39
|
+
'&:focus-visible': {
|
|
40
|
+
// Show focus outline on the SVG container only when using keyboard navigation
|
|
41
|
+
outline: 'auto',
|
|
42
|
+
'&[data-has-focused-item=true]': {
|
|
43
|
+
// But not if the chart has a focused children item
|
|
44
|
+
outline: 'none'
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
'& [data-focused=true]': {
|
|
48
|
+
outline: 'auto'
|
|
49
|
+
}
|
|
35
50
|
}));
|
|
36
51
|
|
|
37
52
|
/**
|
|
@@ -58,6 +73,8 @@ const ChartsSurface = /*#__PURE__*/React.forwardRef(function ChartsSurface(inPro
|
|
|
58
73
|
width: propsWidth,
|
|
59
74
|
height: propsHeight
|
|
60
75
|
} = useSelector(store, selectorChartPropsSize);
|
|
76
|
+
const isKeyboardNavigationEnabled = useSelector(store, selectorChartsIsKeyboardNavigationEnabled);
|
|
77
|
+
const hasFocusedItem = useSelector(store, selectorChartsHasFocusedItem);
|
|
61
78
|
const svgRef = useSvgRef();
|
|
62
79
|
const handleRef = useForkRef(svgRef, ref);
|
|
63
80
|
const themeProps = useThemeProps({
|
|
@@ -78,7 +95,9 @@ const ChartsSurface = /*#__PURE__*/React.forwardRef(function ChartsSurface(inPro
|
|
|
78
95
|
height: propsHeight
|
|
79
96
|
},
|
|
80
97
|
viewBox: `${0} ${0} ${svgWidth} ${svgHeight}`,
|
|
81
|
-
className: className
|
|
98
|
+
className: className,
|
|
99
|
+
tabIndex: isKeyboardNavigationEnabled ? 0 : undefined,
|
|
100
|
+
"data-has-focused-item": hasFocusedItem || undefined
|
|
82
101
|
}, other, {
|
|
83
102
|
ref: handleRef,
|
|
84
103
|
children: [title && /*#__PURE__*/_jsx("title", {
|
|
@@ -15,8 +15,9 @@ export interface ChartsWrapperProps {
|
|
|
15
15
|
legendDirection?: Direction;
|
|
16
16
|
/**
|
|
17
17
|
* If `true`, the legend is not rendered.
|
|
18
|
+
* @default false
|
|
18
19
|
*/
|
|
19
|
-
hideLegend
|
|
20
|
+
hideLegend?: boolean;
|
|
20
21
|
/**
|
|
21
22
|
* If `true`, the chart wrapper set `height: 100%`.
|
|
22
23
|
* @default `false` if the `height` prop is set. And `true` otherwise.
|
|
@@ -26,10 +26,6 @@ const getAlignItems = position => {
|
|
|
26
26
|
}
|
|
27
27
|
return 'center';
|
|
28
28
|
};
|
|
29
|
-
const addToolbar = template => {
|
|
30
|
-
return `"toolbar"
|
|
31
|
-
${template}`;
|
|
32
|
-
};
|
|
33
29
|
const getGridTemplateAreas = (hideLegend, direction, position) => {
|
|
34
30
|
if (hideLegend) {
|
|
35
31
|
return `"chart"`;
|
|
@@ -47,26 +43,25 @@ const getGridTemplateAreas = (hideLegend, direction, position) => {
|
|
|
47
43
|
return `"legend"
|
|
48
44
|
"chart"`;
|
|
49
45
|
};
|
|
50
|
-
const getTemplateColumns = (hideLegend, direction,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
return `${width ? 'auto' : '1fr'} auto`;
|
|
46
|
+
const getTemplateColumns = (hideLegend = false, direction = 'horizontal', horizontalPosition = 'end', width = undefined) => {
|
|
47
|
+
const drawingAreaColumn = width ? 'auto' : '1fr';
|
|
48
|
+
if (direction === 'horizontal') {
|
|
49
|
+
return drawingAreaColumn;
|
|
50
|
+
}
|
|
51
|
+
if (hideLegend) {
|
|
52
|
+
return drawingAreaColumn;
|
|
59
53
|
}
|
|
60
|
-
return '
|
|
54
|
+
return horizontalPosition === 'start' ? `auto ${drawingAreaColumn}` : `${drawingAreaColumn} auto`;
|
|
61
55
|
};
|
|
62
|
-
const getTemplateRows = (hideLegend, direction) => {
|
|
56
|
+
const getTemplateRows = (hideLegend = false, direction = 'horizontal', verticalPosition = 'top') => {
|
|
57
|
+
const drawingAreaRow = '1fr';
|
|
63
58
|
if (direction === 'vertical') {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
return
|
|
59
|
+
return drawingAreaRow;
|
|
60
|
+
}
|
|
61
|
+
if (hideLegend) {
|
|
62
|
+
return drawingAreaRow;
|
|
68
63
|
}
|
|
69
|
-
return 'auto
|
|
64
|
+
return verticalPosition === 'bottom' ? `${drawingAreaRow} auto` : `auto ${drawingAreaRow}`;
|
|
70
65
|
};
|
|
71
66
|
const Root = styled('div', {
|
|
72
67
|
name: 'MuiChartsWrapper',
|
|
@@ -75,32 +70,39 @@ const Root = styled('div', {
|
|
|
75
70
|
})(({
|
|
76
71
|
ownerState,
|
|
77
72
|
width
|
|
78
|
-
}) =>
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
73
|
+
}) => {
|
|
74
|
+
const gridTemplateColumns = getTemplateColumns(ownerState.hideLegend, ownerState.legendDirection, ownerState.legendPosition?.horizontal, width);
|
|
75
|
+
const gridTemplateRows = getTemplateRows(ownerState.hideLegend, ownerState.legendDirection, ownerState.legendPosition?.vertical);
|
|
76
|
+
const gridTemplateAreas = getGridTemplateAreas(ownerState.hideLegend, ownerState.legendDirection, ownerState.legendPosition);
|
|
77
|
+
return {
|
|
78
|
+
variants: [{
|
|
79
|
+
props: {
|
|
80
|
+
extendVertically: true
|
|
81
|
+
},
|
|
82
|
+
style: {
|
|
83
|
+
height: '100%'
|
|
84
|
+
}
|
|
85
|
+
}],
|
|
86
|
+
flex: 1,
|
|
87
|
+
display: 'grid',
|
|
88
|
+
gridTemplateColumns,
|
|
89
|
+
gridTemplateRows,
|
|
90
|
+
gridTemplateAreas,
|
|
91
|
+
[`&:has(.${chartsToolbarClasses.root})`]: {
|
|
92
|
+
// Add a row for toolbar if there is one.
|
|
93
|
+
gridTemplateRows: `auto ${gridTemplateRows}`,
|
|
94
|
+
gridTemplateAreas: `"${gridTemplateColumns.split(' ').map(() => 'toolbar').join(' ')}"
|
|
95
|
+
${gridTemplateAreas}`
|
|
82
96
|
},
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
gridTemplateAreas: addToolbar(getGridTemplateAreas(ownerState.hideLegend, ownerState.legendDirection, ownerState.legendPosition))
|
|
93
|
-
},
|
|
94
|
-
[`&:not(:has(.${chartsToolbarClasses.root}))`]: {
|
|
95
|
-
gridTemplateAreas: getGridTemplateAreas(ownerState.hideLegend, ownerState.legendDirection, ownerState.legendPosition)
|
|
96
|
-
},
|
|
97
|
-
justifyContent: 'center',
|
|
98
|
-
justifyItems: getJustifyItems(ownerState.legendPosition),
|
|
99
|
-
alignItems: getAlignItems(ownerState.legendPosition),
|
|
100
|
-
[`& > .${chartsToolbarClasses.root}`]: {
|
|
101
|
-
justifySelf: 'center'
|
|
102
|
-
}
|
|
103
|
-
}));
|
|
97
|
+
[`& .${chartsToolbarClasses.root}`]: {
|
|
98
|
+
gridArea: 'toolbar',
|
|
99
|
+
justifySelf: 'center'
|
|
100
|
+
},
|
|
101
|
+
justifyContent: 'center',
|
|
102
|
+
justifyItems: getJustifyItems(ownerState.legendPosition),
|
|
103
|
+
alignItems: getAlignItems(ownerState.legendPosition)
|
|
104
|
+
};
|
|
105
|
+
});
|
|
104
106
|
|
|
105
107
|
/**
|
|
106
108
|
* Wrapper for the charts components.
|
|
@@ -140,8 +142,9 @@ process.env.NODE_ENV !== "production" ? ChartsWrapper.propTypes = {
|
|
|
140
142
|
extendVertically: PropTypes.bool,
|
|
141
143
|
/**
|
|
142
144
|
* If `true`, the legend is not rendered.
|
|
145
|
+
* @default false
|
|
143
146
|
*/
|
|
144
|
-
hideLegend: PropTypes.bool
|
|
147
|
+
hideLegend: PropTypes.bool,
|
|
145
148
|
/**
|
|
146
149
|
* The direction of the legend.
|
|
147
150
|
* @default 'horizontal'
|
|
@@ -3685,9 +3685,11 @@ export declare function useAxisTicksProps(inProps: ChartsXAxisProps): {
|
|
|
3685
3685
|
x?: number | string | undefined | undefined;
|
|
3686
3686
|
y?: number | string | undefined | undefined;
|
|
3687
3687
|
radius?: number | string | undefined | undefined;
|
|
3688
|
+
href?: string | undefined | undefined;
|
|
3688
3689
|
media?: string | undefined | undefined;
|
|
3689
|
-
method?: string | undefined | undefined;
|
|
3690
3690
|
target?: string | undefined | undefined;
|
|
3691
|
+
from?: number | string | undefined | undefined;
|
|
3692
|
+
method?: string | undefined | undefined;
|
|
3691
3693
|
crossOrigin?: "" | "anonymous" | "use-credentials" | undefined;
|
|
3692
3694
|
accentHeight?: number | string | undefined | undefined;
|
|
3693
3695
|
accumulate?: "none" | "sum" | undefined | undefined;
|
|
@@ -3731,7 +3733,6 @@ export declare function useAxisTicksProps(inProps: ChartsXAxisProps): {
|
|
|
3731
3733
|
focusable?: "auto" | (boolean | "true" | "false") | undefined;
|
|
3732
3734
|
format?: number | string | undefined | undefined;
|
|
3733
3735
|
fr?: number | string | undefined | undefined;
|
|
3734
|
-
from?: number | string | undefined | undefined;
|
|
3735
3736
|
fx?: number | string | undefined | undefined;
|
|
3736
3737
|
fy?: number | string | undefined | undefined;
|
|
3737
3738
|
g1?: number | string | undefined | undefined;
|
|
@@ -3744,7 +3745,6 @@ export declare function useAxisTicksProps(inProps: ChartsXAxisProps): {
|
|
|
3744
3745
|
hanging?: number | string | undefined | undefined;
|
|
3745
3746
|
horizAdvX?: number | string | undefined | undefined;
|
|
3746
3747
|
horizOriginX?: number | string | undefined | undefined;
|
|
3747
|
-
href?: string | undefined | undefined;
|
|
3748
3748
|
ideographic?: number | string | undefined | undefined;
|
|
3749
3749
|
in2?: number | string | undefined | undefined;
|
|
3750
3750
|
in?: string | undefined | undefined;
|
|
@@ -3604,9 +3604,11 @@ export declare function useAxisTicksProps(inProps: ChartsYAxisProps): {
|
|
|
3604
3604
|
x?: number | string | undefined | undefined;
|
|
3605
3605
|
y?: number | string | undefined | undefined;
|
|
3606
3606
|
radius?: number | string | undefined | undefined;
|
|
3607
|
+
href?: string | undefined | undefined;
|
|
3607
3608
|
media?: string | undefined | undefined;
|
|
3608
|
-
method?: string | undefined | undefined;
|
|
3609
3609
|
target?: string | undefined | undefined;
|
|
3610
|
+
from?: number | string | undefined | undefined;
|
|
3611
|
+
method?: string | undefined | undefined;
|
|
3610
3612
|
crossOrigin?: "" | "anonymous" | "use-credentials" | undefined;
|
|
3611
3613
|
accentHeight?: number | string | undefined | undefined;
|
|
3612
3614
|
accumulate?: "none" | "sum" | undefined | undefined;
|
|
@@ -3650,7 +3652,6 @@ export declare function useAxisTicksProps(inProps: ChartsYAxisProps): {
|
|
|
3650
3652
|
focusable?: "auto" | (boolean | "true" | "false") | undefined;
|
|
3651
3653
|
format?: number | string | undefined | undefined;
|
|
3652
3654
|
fr?: number | string | undefined | undefined;
|
|
3653
|
-
from?: number | string | undefined | undefined;
|
|
3654
3655
|
fx?: number | string | undefined | undefined;
|
|
3655
3656
|
fy?: number | string | undefined | undefined;
|
|
3656
3657
|
g1?: number | string | undefined | undefined;
|
|
@@ -3663,7 +3664,6 @@ export declare function useAxisTicksProps(inProps: ChartsYAxisProps): {
|
|
|
3663
3664
|
hanging?: number | string | undefined | undefined;
|
|
3664
3665
|
horizAdvX?: number | string | undefined | undefined;
|
|
3665
3666
|
horizOriginX?: number | string | undefined | undefined;
|
|
3666
|
-
href?: string | undefined | undefined;
|
|
3667
3667
|
ideographic?: number | string | undefined | undefined;
|
|
3668
3668
|
in2?: number | string | undefined | undefined;
|
|
3669
3669
|
in?: string | undefined | undefined;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { useTheme } from '@mui/material/styles';
|
|
5
|
+
import { useFocusedItem } from "../hooks/useFocusedItem.js";
|
|
6
|
+
import { useLineSeriesContext, useXAxes, useYAxes } from "../hooks/index.js";
|
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
const RADIUS = 6;
|
|
9
|
+
export function FocusedMark() {
|
|
10
|
+
const theme = useTheme();
|
|
11
|
+
const focusedItem = useFocusedItem();
|
|
12
|
+
const lineSeries = useLineSeriesContext();
|
|
13
|
+
const {
|
|
14
|
+
xAxis,
|
|
15
|
+
xAxisIds
|
|
16
|
+
} = useXAxes();
|
|
17
|
+
const {
|
|
18
|
+
yAxis,
|
|
19
|
+
yAxisIds
|
|
20
|
+
} = useYAxes();
|
|
21
|
+
if (focusedItem === null || focusedItem.seriesType !== 'line' || !lineSeries) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
const series = lineSeries?.series[focusedItem.seriesId];
|
|
25
|
+
const xAxisId = series.xAxisId ?? xAxisIds[0];
|
|
26
|
+
const yAxisId = series.yAxisId ?? yAxisIds[0];
|
|
27
|
+
return /*#__PURE__*/_jsx("rect", {
|
|
28
|
+
fill: "none",
|
|
29
|
+
stroke: (theme.vars ?? theme).palette.text.primary,
|
|
30
|
+
strokeWidth: 2,
|
|
31
|
+
x: xAxis[xAxisId].scale(xAxis[xAxisId].data[focusedItem.dataIndex]) - RADIUS,
|
|
32
|
+
y: yAxis[yAxisId].scale(series.stackedData[focusedItem.dataIndex][1]) - RADIUS,
|
|
33
|
+
width: 2 * RADIUS,
|
|
34
|
+
height: 2 * RADIUS,
|
|
35
|
+
rx: 3,
|
|
36
|
+
ry: 3
|
|
37
|
+
});
|
|
38
|
+
}
|
|
@@ -14,12 +14,12 @@ import { ChartsAxisSlotProps, ChartsAxisSlots } from "../models/axis.js";
|
|
|
14
14
|
import { LineHighlightPlotSlots, LineHighlightPlotSlotProps } from "./LineHighlightPlot.js";
|
|
15
15
|
import { ChartsGridProps } from "../ChartsGrid/index.js";
|
|
16
16
|
import { ChartsOverlayProps, ChartsOverlaySlotProps, ChartsOverlaySlots } from "../ChartsOverlay/index.js";
|
|
17
|
-
import {
|
|
17
|
+
import { LineChartPluginSignatures } from "./LineChart.plugins.js";
|
|
18
18
|
import { ChartsToolbarSlots, ChartsToolbarSlotProps } from "../Toolbar/index.js";
|
|
19
19
|
export interface LineChartSlots extends ChartsAxisSlots, AreaPlotSlots, LinePlotSlots, MarkPlotSlots, LineHighlightPlotSlots, ChartsLegendSlots, ChartsOverlaySlots, ChartsTooltipSlots, ChartsToolbarSlots, Partial<ChartsSlots> {}
|
|
20
20
|
export interface LineChartSlotProps extends ChartsAxisSlotProps, AreaPlotSlotProps, LinePlotSlotProps, MarkPlotSlotProps, LineHighlightPlotSlotProps, ChartsLegendSlotProps, ChartsOverlaySlotProps, ChartsTooltipSlotProps, ChartsToolbarSlotProps, Partial<ChartsSlotProps> {}
|
|
21
21
|
export type LineSeries = MakeOptional<LineSeriesType, 'type'>;
|
|
22
|
-
export interface LineChartProps extends Omit<ChartContainerProps<'line',
|
|
22
|
+
export interface LineChartProps extends Omit<ChartContainerProps<'line', LineChartPluginSignatures>, 'series' | 'plugins' | 'zAxis'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'> {
|
|
23
23
|
/**
|
|
24
24
|
* The series to display in the line chart.
|
|
25
25
|
* An array of [[LineSeries]] objects.
|
|
@@ -20,6 +20,7 @@ import { useChartContainerProps } from "../ChartContainer/useChartContainerProps
|
|
|
20
20
|
import { ChartDataProvider } from "../ChartDataProvider/index.js";
|
|
21
21
|
import { ChartsSurface } from "../ChartsSurface/index.js";
|
|
22
22
|
import { ChartsWrapper } from "../ChartsWrapper/index.js";
|
|
23
|
+
import { FocusedMark } from "./FocusedMark.js";
|
|
23
24
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
25
|
/**
|
|
25
26
|
* Demos:
|
|
@@ -63,7 +64,7 @@ const LineChart = /*#__PURE__*/React.forwardRef(function LineChart(inProps, ref)
|
|
|
63
64
|
children: [props.showToolbar && Toolbar ? /*#__PURE__*/_jsx(Toolbar, _extends({}, props.slotProps?.toolbar)) : null, !props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsxs(ChartsSurface, _extends({}, chartsSurfaceProps, {
|
|
64
65
|
children: [/*#__PURE__*/_jsx(ChartsGrid, _extends({}, gridProps)), /*#__PURE__*/_jsxs("g", _extends({}, clipPathGroupProps, {
|
|
65
66
|
children: [/*#__PURE__*/_jsx(AreaPlot, _extends({}, areaPlotProps)), /*#__PURE__*/_jsx(LinePlot, _extends({}, linePlotProps)), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlightProps))]
|
|
66
|
-
})), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), /*#__PURE__*/_jsx("g", {
|
|
67
|
+
})), /*#__PURE__*/_jsx(FocusedMark, {}), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), /*#__PURE__*/_jsx("g", {
|
|
67
68
|
"data-drawing-container": true,
|
|
68
69
|
children: /*#__PURE__*/_jsx(MarkPlot, _extends({}, markPlotProps))
|
|
69
70
|
}), /*#__PURE__*/_jsx(LineHighlightPlot, _extends({}, lineHighlightPlotProps)), /*#__PURE__*/_jsx(ChartsClipPath, _extends({}, clipPathProps)), children]
|
|
@@ -111,6 +112,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
111
112
|
* If `true`, render the line highlight item.
|
|
112
113
|
*/
|
|
113
114
|
disableLineItemHighlight: PropTypes.bool,
|
|
115
|
+
enableKeyboardNavigation: PropTypes.bool,
|
|
114
116
|
/**
|
|
115
117
|
* Options to enable features planned for the next major.
|
|
116
118
|
*/
|
|
@@ -2,6 +2,7 @@ import { UseChartZAxisSignature } from "../internals/plugins/featurePlugins/useC
|
|
|
2
2
|
import { UseChartCartesianAxisSignature } from "../internals/plugins/featurePlugins/useChartCartesianAxis/index.js";
|
|
3
3
|
import { UseChartInteractionSignature } from "../internals/plugins/featurePlugins/useChartInteraction/index.js";
|
|
4
4
|
import { UseChartHighlightSignature } from "../internals/plugins/featurePlugins/useChartHighlight/index.js";
|
|
5
|
+
import { UseChartKeyboardNavigationSignature } from "../internals/plugins/featurePlugins/useChartKeyboardNavigation/index.js";
|
|
5
6
|
import { ConvertSignaturesIntoPlugins } from "../internals/plugins/models/helpers.js";
|
|
6
|
-
export type
|
|
7
|
-
export declare const LINE_CHART_PLUGINS: ConvertSignaturesIntoPlugins<
|
|
7
|
+
export type LineChartPluginSignatures = [UseChartZAxisSignature, UseChartCartesianAxisSignature<'line'>, UseChartInteractionSignature, UseChartHighlightSignature, UseChartKeyboardNavigationSignature];
|
|
8
|
+
export declare const LINE_CHART_PLUGINS: ConvertSignaturesIntoPlugins<LineChartPluginSignatures>;
|
|
@@ -2,4 +2,5 @@ import { useChartZAxis } from "../internals/plugins/featurePlugins/useChartZAxis
|
|
|
2
2
|
import { useChartCartesianAxis } from "../internals/plugins/featurePlugins/useChartCartesianAxis/index.js";
|
|
3
3
|
import { useChartInteraction } from "../internals/plugins/featurePlugins/useChartInteraction/index.js";
|
|
4
4
|
import { useChartHighlight } from "../internals/plugins/featurePlugins/useChartHighlight/index.js";
|
|
5
|
-
|
|
5
|
+
import { useChartKeyboardNavigation } from "../internals/plugins/featurePlugins/useChartKeyboardNavigation/index.js";
|
|
6
|
+
export const LINE_CHART_PLUGINS = [useChartZAxis, useChartCartesianAxis, useChartInteraction, useChartHighlight, useChartKeyboardNavigation];
|
package/esm/LineChart/index.d.ts
CHANGED
|
@@ -9,5 +9,6 @@ export * from "./LineElement.js";
|
|
|
9
9
|
export * from "./AnimatedLine.js";
|
|
10
10
|
export * from "./MarkElement.js";
|
|
11
11
|
export * from "./LineHighlightElement.js";
|
|
12
|
+
export * from "./LineChart.plugins.js";
|
|
12
13
|
export type { MarkElementClasses, MarkElementClassKey } from "./markElementClasses.js";
|
|
13
14
|
export { getMarkElementUtilityClass, markElementClasses } from "./markElementClasses.js";
|
package/esm/LineChart/index.js
CHANGED
|
@@ -9,4 +9,5 @@ export * from "./LineElement.js";
|
|
|
9
9
|
export * from "./AnimatedLine.js";
|
|
10
10
|
export * from "./MarkElement.js";
|
|
11
11
|
export * from "./LineHighlightElement.js";
|
|
12
|
+
export * from "./LineChart.plugins.js";
|
|
12
13
|
export { getMarkElementUtilityClass, markElementClasses } from "./markElementClasses.js";
|
|
@@ -12,7 +12,7 @@ import { LineHighlightPlotProps } from "./LineHighlightPlot.js";
|
|
|
12
12
|
import { LinePlotProps } from "./LinePlot.js";
|
|
13
13
|
import { MarkPlotProps } from "./MarkPlot.js";
|
|
14
14
|
import type { ChartsWrapperProps } from "../ChartsWrapper/index.js";
|
|
15
|
-
import {
|
|
15
|
+
import { LineChartPluginSignatures } from "./LineChart.plugins.js";
|
|
16
16
|
/**
|
|
17
17
|
* A helper function that extracts LineChartProps from the input props
|
|
18
18
|
* and returns an object with props for the children components of LineChart.
|
|
@@ -22,7 +22,7 @@ import { LineChartPluginsSignatures } from "./LineChart.plugins.js";
|
|
|
22
22
|
*/
|
|
23
23
|
export declare const useLineChartProps: (props: LineChartProps) => {
|
|
24
24
|
chartsWrapperProps: Omit<ChartsWrapperProps, "children">;
|
|
25
|
-
chartContainerProps: ChartContainerProps<"line",
|
|
25
|
+
chartContainerProps: ChartContainerProps<"line", LineChartPluginSignatures>;
|
|
26
26
|
gridProps: ChartsGridProps;
|
|
27
27
|
clipPathProps: ChartsClipPathProps;
|
|
28
28
|
clipPathGroupProps: {
|
package/esm/PieChart/PieArc.d.ts
CHANGED
package/esm/PieChart/PieArc.js
CHANGED
|
@@ -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 = ["classes", "color", "dataIndex", "id", "isFaded", "isHighlighted", "onClick", "cornerRadius", "startAngle", "endAngle", "innerRadius", "outerRadius", "paddingAngle", "skipAnimation"];
|
|
5
|
+
const _excluded = ["classes", "color", "dataIndex", "id", "isFaded", "isHighlighted", "isFocused", "onClick", "cornerRadius", "startAngle", "endAngle", "innerRadius", "outerRadius", "paddingAngle", "skipAnimation"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import composeClasses from '@mui/utils/composeClasses';
|
|
@@ -51,6 +51,7 @@ const PieArc = /*#__PURE__*/React.forwardRef(function PieArc(props, ref) {
|
|
|
51
51
|
id,
|
|
52
52
|
isFaded,
|
|
53
53
|
isHighlighted,
|
|
54
|
+
isFocused,
|
|
54
55
|
onClick,
|
|
55
56
|
cornerRadius,
|
|
56
57
|
startAngle,
|
|
@@ -67,7 +68,8 @@ const PieArc = /*#__PURE__*/React.forwardRef(function PieArc(props, ref) {
|
|
|
67
68
|
classes: innerClasses,
|
|
68
69
|
color,
|
|
69
70
|
isFaded,
|
|
70
|
-
isHighlighted
|
|
71
|
+
isHighlighted,
|
|
72
|
+
isFocused
|
|
71
73
|
};
|
|
72
74
|
const classes = useUtilityClasses(ownerState);
|
|
73
75
|
const interactionProps = useInteractionItemProps({
|
|
@@ -96,7 +98,8 @@ const PieArc = /*#__PURE__*/React.forwardRef(function PieArc(props, ref) {
|
|
|
96
98
|
strokeWidth: 1,
|
|
97
99
|
strokeLinejoin: "round",
|
|
98
100
|
"data-highlighted": ownerState.isHighlighted || undefined,
|
|
99
|
-
"data-faded": ownerState.isFaded || undefined
|
|
101
|
+
"data-faded": ownerState.isFaded || undefined,
|
|
102
|
+
"data-focused": isFocused || undefined
|
|
100
103
|
}, other, interactionProps, animatedProps));
|
|
101
104
|
});
|
|
102
105
|
if (process.env.NODE_ENV !== "production") PieArc.displayName = "PieArc";
|
|
@@ -112,6 +115,7 @@ process.env.NODE_ENV !== "production" ? PieArc.propTypes = {
|
|
|
112
115
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
113
116
|
innerRadius: PropTypes.number.isRequired,
|
|
114
117
|
isFaded: PropTypes.bool.isRequired,
|
|
118
|
+
isFocused: PropTypes.bool.isRequired,
|
|
115
119
|
isHighlighted: PropTypes.bool.isRequired,
|
|
116
120
|
outerRadius: PropTypes.number.isRequired,
|
|
117
121
|
paddingAngle: PropTypes.number.isRequired,
|
package/esm/PieChart/PieChart.js
CHANGED
|
@@ -120,6 +120,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
120
120
|
*/
|
|
121
121
|
dataset: PropTypes.arrayOf(PropTypes.object),
|
|
122
122
|
desc: PropTypes.string,
|
|
123
|
+
enableKeyboardNavigation: PropTypes.bool,
|
|
123
124
|
/**
|
|
124
125
|
* The height of the chart in px. If not defined, it takes the height of the parent element.
|
|
125
126
|
*/
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { UseChartInteractionSignature } from "../internals/plugins/featurePlugins/useChartInteraction/index.js";
|
|
2
2
|
import { UseChartHighlightSignature } from "../internals/plugins/featurePlugins/useChartHighlight/index.js";
|
|
3
|
+
import { UseChartKeyboardNavigationSignature } from "../internals/plugins/featurePlugins/useChartKeyboardNavigation/index.js";
|
|
3
4
|
import { ConvertSignaturesIntoPlugins } from "../internals/plugins/models/helpers.js";
|
|
4
|
-
export type PieChartPluginSignatures = [UseChartInteractionSignature, UseChartHighlightSignature];
|
|
5
|
+
export type PieChartPluginSignatures = [UseChartInteractionSignature, UseChartHighlightSignature, UseChartKeyboardNavigationSignature];
|
|
5
6
|
export declare const PIE_CHART_PLUGINS: ConvertSignaturesIntoPlugins<PieChartPluginSignatures>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { useChartInteraction } from "../internals/plugins/featurePlugins/useChartInteraction/index.js";
|
|
2
2
|
import { useChartHighlight } from "../internals/plugins/featurePlugins/useChartHighlight/index.js";
|
|
3
|
-
|
|
3
|
+
import { useChartKeyboardNavigation } from "../internals/plugins/featurePlugins/useChartKeyboardNavigation/index.js";
|
|
4
|
+
export const PIE_CHART_PLUGINS = [useChartInteraction, useChartHighlight, useChartKeyboardNavigation];
|
|
@@ -12,5 +12,6 @@ export interface ValueWithHighlight extends DefaultizedPieValueType, AnimatedObj
|
|
|
12
12
|
dataIndex: number;
|
|
13
13
|
isFaded: boolean;
|
|
14
14
|
isHighlighted: boolean;
|
|
15
|
+
isFocused: boolean;
|
|
15
16
|
}
|
|
16
17
|
export declare function useTransformData(series: Pick<DefaultizedPieSeriesType, 'cornerRadius' | 'paddingAngle' | 'id' | 'highlighted' | 'faded' | 'data'> & ComputedPieRadius): ValueWithHighlight[];
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { useItemHighlightedGetter } from "../../hooks/useItemHighlightedGetter.js";
|
|
6
|
+
import { useIsItemFocusedGetter } from "../../hooks/useIsItemFocusedGetter.js";
|
|
6
7
|
import { deg2rad } from "../../internals/angleConversion.js";
|
|
7
8
|
export function useTransformData(series) {
|
|
8
9
|
const {
|
|
@@ -20,6 +21,7 @@ export function useTransformData(series) {
|
|
|
20
21
|
isFaded: isItemFaded,
|
|
21
22
|
isHighlighted: isItemHighlighted
|
|
22
23
|
} = useItemHighlightedGetter();
|
|
24
|
+
const isItemFocused = useIsItemFocusedGetter();
|
|
23
25
|
const dataWithHighlight = React.useMemo(() => data.map((item, itemIndex) => {
|
|
24
26
|
const currentItem = {
|
|
25
27
|
seriesId,
|
|
@@ -27,6 +29,11 @@ export function useTransformData(series) {
|
|
|
27
29
|
};
|
|
28
30
|
const isHighlighted = isItemHighlighted(currentItem);
|
|
29
31
|
const isFaded = !isHighlighted && isItemFaded(currentItem);
|
|
32
|
+
const isFocused = isItemFocused({
|
|
33
|
+
seriesType: 'pie',
|
|
34
|
+
seriesId,
|
|
35
|
+
dataIndex: itemIndex
|
|
36
|
+
});
|
|
30
37
|
const attributesOverride = _extends({
|
|
31
38
|
additionalRadius: 0
|
|
32
39
|
}, isFaded && faded || isHighlighted && highlighted || {});
|
|
@@ -39,12 +46,13 @@ export function useTransformData(series) {
|
|
|
39
46
|
dataIndex: itemIndex,
|
|
40
47
|
isFaded,
|
|
41
48
|
isHighlighted,
|
|
49
|
+
isFocused,
|
|
42
50
|
paddingAngle,
|
|
43
51
|
innerRadius,
|
|
44
52
|
outerRadius,
|
|
45
53
|
cornerRadius,
|
|
46
54
|
arcLabelRadius
|
|
47
55
|
});
|
|
48
|
-
}), [baseCornerRadius, baseInnerRadius, baseOuterRadius, basePaddingAngle, baseArcLabelRadius, data, faded, highlighted, isItemFaded, isItemHighlighted, seriesId]);
|
|
56
|
+
}), [baseCornerRadius, baseInnerRadius, baseOuterRadius, basePaddingAngle, baseArcLabelRadius, data, faded, highlighted, isItemFaded, isItemHighlighted, isItemFocused, seriesId]);
|
|
49
57
|
return dataWithHighlight;
|
|
50
58
|
}
|
package/esm/PieChart/index.d.ts
CHANGED
|
@@ -5,5 +5,6 @@ export * from "./PieArcLabelPlot.js";
|
|
|
5
5
|
export * from "./PieArc.js";
|
|
6
6
|
export * from "./PieArcLabel.js";
|
|
7
7
|
export * from "./getPieCoordinates.js";
|
|
8
|
+
export * from "./PieChart.plugins.js";
|
|
8
9
|
export { pieClasses } from "./pieClasses.js";
|
|
9
10
|
export type { PieClasses, PieClassKey } from "./pieClasses.js";
|
package/esm/PieChart/index.js
CHANGED
|
@@ -2,4 +2,4 @@ import { UseChartPolarAxisSignature } from "../internals/plugins/featurePlugins/
|
|
|
2
2
|
import { UseChartInteractionSignature } from "../internals/plugins/featurePlugins/useChartInteraction/index.js";
|
|
3
3
|
import { UseChartHighlightSignature } from "../internals/plugins/featurePlugins/useChartHighlight/index.js";
|
|
4
4
|
export declare const RADAR_PLUGINS: readonly [import("../internals/index.js").ChartPlugin<UseChartPolarAxisSignature<any>>, import("../internals/index.js").ChartPlugin<UseChartInteractionSignature>, import("../internals/index.js").ChartPlugin<UseChartHighlightSignature>];
|
|
5
|
-
export type
|
|
5
|
+
export type RadarChartPluginSignatures = [UseChartPolarAxisSignature, UseChartInteractionSignature, UseChartHighlightSignature];
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { MakeOptional } from '@mui/x-internals/types';
|
|
3
|
-
import {
|
|
3
|
+
import { RadarChartPluginSignatures } from "../RadarChart.plugins.js";
|
|
4
4
|
import { RadarSeriesType } from "../../models/seriesType/radar.js";
|
|
5
5
|
import { ChartDataProviderProps } from "../../ChartDataProvider/index.js";
|
|
6
6
|
import { RadarConfig } from "./radar.types.js";
|
|
7
7
|
import { ChartAnyPluginSignature } from "../../internals/plugins/models/plugin.js";
|
|
8
8
|
export type RadarSeries = MakeOptional<RadarSeriesType, 'type'>;
|
|
9
|
-
export type RadarDataProviderProps<TSignatures extends readonly ChartAnyPluginSignature[] =
|
|
9
|
+
export type RadarDataProviderProps<TSignatures extends readonly ChartAnyPluginSignature[] = RadarChartPluginSignatures> = Omit<ChartDataProviderProps<'radar', TSignatures>, 'series' | 'rotationAxis' | 'radiusAxis' | 'dataset' | 'experimentalFeatures'> & {
|
|
10
10
|
/**
|
|
11
11
|
* The series to display in the bar chart.
|
|
12
12
|
* An array of [[RadarSeries]] objects.
|
|
@@ -22,5 +22,5 @@ export type RadarDataProviderProps<TSignatures extends readonly ChartAnyPluginSi
|
|
|
22
22
|
*/
|
|
23
23
|
highlight?: 'axis' | 'series' | 'none';
|
|
24
24
|
};
|
|
25
|
-
declare function RadarDataProvider<TSignatures extends readonly ChartAnyPluginSignature[] =
|
|
25
|
+
declare function RadarDataProvider<TSignatures extends readonly ChartAnyPluginSignature[] = RadarChartPluginSignatures>(props: RadarDataProviderProps<TSignatures>): React.JSX.Element;
|
|
26
26
|
export { RadarDataProvider };
|
|
@@ -15,4 +15,5 @@ export * from "./RadarGrid/index.js";
|
|
|
15
15
|
export * from "./RadarAxis/index.js";
|
|
16
16
|
export * from "./RadarAxisHighlight/index.js";
|
|
17
17
|
export * from "./RadarMetricLabels/index.js";
|
|
18
|
-
export * from "./RadarSeriesPlot/index.js";
|
|
18
|
+
export * from "./RadarSeriesPlot/index.js";
|
|
19
|
+
export * from "./RadarChart.plugins.js";
|
package/esm/RadarChart/index.js
CHANGED
|
@@ -16,4 +16,5 @@ export * from "./RadarGrid/index.js";
|
|
|
16
16
|
export * from "./RadarAxis/index.js";
|
|
17
17
|
export * from "./RadarAxisHighlight/index.js";
|
|
18
18
|
export * from "./RadarMetricLabels/index.js";
|
|
19
|
-
export * from "./RadarSeriesPlot/index.js";
|
|
19
|
+
export * from "./RadarSeriesPlot/index.js";
|
|
20
|
+
export * from "./RadarChart.plugins.js";
|
|
@@ -5,7 +5,7 @@ import type { ChartsWrapperProps } from "../ChartsWrapper/index.js";
|
|
|
5
5
|
import { RadarDataProviderProps } from "./RadarDataProvider/RadarDataProvider.js";
|
|
6
6
|
import { ChartsSurfaceProps } from "../ChartsSurface/index.js";
|
|
7
7
|
import { RadarGridProps } from "./RadarGrid/index.js";
|
|
8
|
-
import {
|
|
8
|
+
import { RadarChartPluginSignatures } from "./RadarChart.plugins.js";
|
|
9
9
|
import { RadarSeriesAreaProps, RadarSeriesMarksProps } from "./RadarSeriesPlot/index.js";
|
|
10
10
|
/**
|
|
11
11
|
* A helper function that extracts RadarChartProps from the input props
|
|
@@ -18,7 +18,7 @@ export declare const useRadarChartProps: (props: RadarChartProps) => {
|
|
|
18
18
|
highlight: "none" | "series" | "axis";
|
|
19
19
|
chartsWrapperProps: Omit<ChartsWrapperProps, "children">;
|
|
20
20
|
chartsSurfaceProps: ChartsSurfaceProps;
|
|
21
|
-
radarDataProviderProps: RadarDataProviderProps<
|
|
21
|
+
radarDataProviderProps: RadarDataProviderProps<RadarChartPluginSignatures>;
|
|
22
22
|
radarGrid: RadarGridProps;
|
|
23
23
|
radarSeriesAreaProps: RadarSeriesAreaProps;
|
|
24
24
|
radarSeriesMarksProps: RadarSeriesMarksProps;
|