@mui/x-charts 8.0.0 → 8.1.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 -0
- package/BarChart/BarPlot.js +1 -2
- package/CHANGELOG.md +106 -0
- package/ChartContainer/ChartContainer.d.ts +1 -0
- package/ChartContainer/ChartContainer.js +4 -0
- package/ChartContainer/useChartContainerProps.js +4 -2
- package/ChartDataProvider/ChartDataProvider.d.ts +2 -1
- package/ChartDataProvider/ChartDataProvider.js +10 -1
- package/ChartDataProvider/useChartDataProviderProps.d.ts +3 -1
- package/ChartDataProvider/useChartDataProviderProps.js +3 -1
- package/ChartsAxisHighlight/ChartsAxisHighlightPath.js +1 -2
- package/ChartsGrid/styledComponents.js +1 -2
- package/ChartsLabel/ChartsLabelGradient.js +1 -2
- package/ChartsLabel/ChartsLabelMark.js +1 -2
- package/ChartsLegend/ChartsLegend.js +1 -2
- package/ChartsLegend/ContinuousColorLegend.js +1 -2
- package/ChartsLegend/PiecewiseColorLegend.js +1 -2
- package/ChartsLocalizationProvider/ChartsLocalizationProvider.d.ts +27 -0
- package/ChartsLocalizationProvider/ChartsLocalizationProvider.js +73 -0
- package/ChartsLocalizationProvider/index.d.ts +2 -0
- package/ChartsLocalizationProvider/index.js +12 -0
- package/ChartsOverlay/ChartsLoadingOverlay.js +5 -1
- package/ChartsOverlay/ChartsNoDataOverlay.js +5 -1
- package/ChartsOverlay/ChartsOverlay.d.ts +2 -0
- package/ChartsTooltip/ChartsTooltipContainer.js +11 -10
- package/ChartsTooltip/ChartsTooltipTable.js +3 -5
- package/ChartsTooltip/utils.d.ts +1 -1
- package/ChartsTooltip/utils.js +0 -1
- package/ChartsXAxis/ChartsXAxis.js +1 -2
- package/ChartsYAxis/ChartsYAxis.js +1 -2
- package/Gauge/GaugeReferenceArc.js +1 -2
- package/Gauge/GaugeValueArc.js +1 -2
- package/LineChart/AreaPlot.js +1 -2
- package/LineChart/LineChart.js +4 -0
- package/LineChart/LinePlot.js +1 -2
- package/LineChart/MarkElement.js +1 -2
- package/PieChart/PieArc.js +1 -1
- package/PieChart/PieArcLabel.js +1 -2
- package/PieChart/PieChart.js +4 -0
- package/RadarChart/RadarChart.js +4 -0
- package/RadarChart/RadarDataProvider/RadarDataProvider.js +4 -0
- package/ScatterChart/ScatterChart.js +4 -0
- package/SparkLineChart/SparkLineChart.js +4 -0
- package/context/ChartProvider/ChartProvider.types.d.ts +4 -0
- package/esm/BarChart/BarChart.js +4 -0
- package/esm/BarChart/BarPlot.js +1 -2
- package/esm/ChartContainer/ChartContainer.d.ts +1 -0
- package/esm/ChartContainer/ChartContainer.js +4 -0
- package/esm/ChartContainer/useChartContainerProps.js +4 -2
- package/esm/ChartDataProvider/ChartDataProvider.d.ts +2 -1
- package/esm/ChartDataProvider/ChartDataProvider.js +10 -1
- package/esm/ChartDataProvider/useChartDataProviderProps.d.ts +3 -1
- package/esm/ChartDataProvider/useChartDataProviderProps.js +3 -1
- package/esm/ChartsAxisHighlight/ChartsAxisHighlightPath.js +1 -2
- package/esm/ChartsGrid/styledComponents.js +1 -2
- package/esm/ChartsLabel/ChartsLabelGradient.js +1 -2
- package/esm/ChartsLabel/ChartsLabelMark.js +1 -2
- package/esm/ChartsLegend/ChartsLegend.js +1 -2
- package/esm/ChartsLegend/ContinuousColorLegend.js +1 -2
- package/esm/ChartsLegend/PiecewiseColorLegend.js +1 -2
- package/esm/ChartsLocalizationProvider/ChartsLocalizationProvider.d.ts +27 -0
- package/esm/ChartsLocalizationProvider/ChartsLocalizationProvider.js +66 -0
- package/esm/ChartsLocalizationProvider/index.d.ts +2 -0
- package/esm/ChartsLocalizationProvider/index.js +1 -0
- package/esm/ChartsOverlay/ChartsLoadingOverlay.js +5 -1
- package/esm/ChartsOverlay/ChartsNoDataOverlay.js +5 -1
- package/esm/ChartsOverlay/ChartsOverlay.d.ts +2 -0
- package/esm/ChartsTooltip/ChartsTooltipContainer.js +11 -10
- package/esm/ChartsTooltip/ChartsTooltipTable.js +3 -5
- package/esm/ChartsTooltip/utils.d.ts +1 -1
- package/esm/ChartsTooltip/utils.js +0 -1
- package/esm/ChartsXAxis/ChartsXAxis.js +1 -2
- package/esm/ChartsYAxis/ChartsYAxis.js +1 -2
- package/esm/Gauge/GaugeReferenceArc.js +1 -2
- package/esm/Gauge/GaugeValueArc.js +1 -2
- package/esm/LineChart/AreaPlot.js +1 -2
- package/esm/LineChart/LineChart.js +4 -0
- package/esm/LineChart/LinePlot.js +1 -2
- package/esm/LineChart/MarkElement.js +1 -2
- package/esm/PieChart/PieArc.js +1 -1
- package/esm/PieChart/PieArcLabel.js +1 -2
- package/esm/PieChart/PieChart.js +4 -0
- package/esm/RadarChart/RadarChart.js +4 -0
- package/esm/RadarChart/RadarDataProvider/RadarDataProvider.js +4 -0
- package/esm/ScatterChart/ScatterChart.js +4 -0
- package/esm/SparkLineChart/SparkLineChart.js +4 -0
- package/esm/context/ChartProvider/ChartProvider.types.d.ts +4 -0
- package/esm/hooks/index.d.ts +3 -1
- package/esm/hooks/index.js +3 -1
- package/esm/hooks/useChartRootRef.d.ts +6 -0
- package/esm/hooks/useChartRootRef.js +12 -0
- package/esm/hooks/useChartsLocalization.d.ts +1 -0
- package/esm/hooks/useChartsLocalization.js +9 -0
- package/esm/index.d.ts +1 -0
- package/esm/index.js +2 -1
- package/esm/internals/components/AxisSharedComponents.js +1 -2
- package/esm/internals/components/ChartsWrapper/ChartsWrapper.js +4 -2
- package/esm/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.js +0 -1
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.d.ts +3 -3
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.js +15 -0
- package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.d.ts +3 -3
- package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.js +8 -0
- package/esm/internals/plugins/models/plugin.d.ts +4 -0
- package/esm/internals/store/useCharts.d.ts +1 -0
- package/esm/internals/store/useCharts.js +4 -1
- package/esm/locales/enUS.d.ts +15 -0
- package/esm/locales/enUS.js +11 -0
- package/esm/locales/frFR.d.ts +14 -0
- package/esm/locales/frFR.js +7 -0
- package/esm/locales/index.d.ts +3 -0
- package/esm/locales/index.js +3 -0
- package/esm/locales/utils/chartsLocaleTextApi.d.ts +11 -0
- package/esm/locales/utils/chartsLocaleTextApi.js +1 -0
- package/esm/locales/utils/getChartsLocalization.d.ts +18 -0
- package/esm/locales/utils/getChartsLocalization.js +17 -0
- package/esm/themeAugmentation/components.d.ts +3 -0
- package/esm/themeAugmentation/props.d.ts +2 -0
- package/hooks/index.d.ts +3 -1
- package/hooks/index.js +24 -0
- package/hooks/useChartRootRef.d.ts +6 -0
- package/hooks/useChartRootRef.js +16 -0
- package/hooks/useChartsLocalization.d.ts +1 -0
- package/hooks/useChartsLocalization.js +17 -0
- package/index.d.ts +1 -0
- package/index.js +12 -1
- package/internals/components/AxisSharedComponents.js +1 -2
- package/internals/components/ChartsWrapper/ChartsWrapper.js +4 -2
- package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.js +0 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.d.ts +3 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.js +15 -0
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.d.ts +3 -3
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.js +8 -0
- package/internals/plugins/models/plugin.d.ts +4 -0
- package/internals/store/useCharts.d.ts +1 -0
- package/internals/store/useCharts.js +4 -1
- package/locales/enUS.d.ts +15 -0
- package/locales/enUS.js +16 -0
- package/locales/frFR.d.ts +14 -0
- package/locales/frFR.js +13 -0
- package/locales/index.d.ts +3 -0
- package/locales/index.js +27 -0
- package/locales/utils/chartsLocaleTextApi.d.ts +11 -0
- package/locales/utils/chartsLocaleTextApi.js +5 -0
- package/locales/utils/getChartsLocalization.d.ts +18 -0
- package/locales/utils/getChartsLocalization.js +25 -0
- package/package.json +1 -2
- package/themeAugmentation/components.d.ts +3 -0
- package/themeAugmentation/props.d.ts +2 -0
package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isDeepEqual } from '@mui/x-internals/isDeepEqual';
|
|
1
2
|
import { createSelector } from "../../utils/selectors.js";
|
|
2
3
|
import { selectorChartsInteractionPointerX, selectorChartsInteractionPointerY } from "../useChartInteraction/useChartInteraction.selectors.js";
|
|
3
4
|
import { generateSvg2rotation } from "./coordinateTransformation.js";
|
|
@@ -62,6 +63,13 @@ export const selectorChartsInteractionTooltipRotationAxes = createSelector([sele
|
|
|
62
63
|
axisId,
|
|
63
64
|
dataIndex
|
|
64
65
|
}) => axes.axis[axisId].triggerTooltip && dataIndex >= 0);
|
|
66
|
+
}, {
|
|
67
|
+
memoizeOptions: {
|
|
68
|
+
// Keep the same reference if array content is the same.
|
|
69
|
+
// If possible, avoid this pattern by creating selectors that
|
|
70
|
+
// uses string/number as arguments.
|
|
71
|
+
resultEqualityCheck: isDeepEqual
|
|
72
|
+
}
|
|
65
73
|
});
|
|
66
74
|
|
|
67
75
|
/**
|
|
@@ -25,6 +25,10 @@ export interface ChartPluginOptions<TSignature extends ChartAnyPluginSignature>
|
|
|
25
25
|
* Reference to the main svg element.
|
|
26
26
|
*/
|
|
27
27
|
svgRef: React.RefObject<SVGSVGElement | null>;
|
|
28
|
+
/**
|
|
29
|
+
* Reference to the chart root element.
|
|
30
|
+
*/
|
|
31
|
+
chartRootRef: React.RefObject<HTMLDivElement | null>;
|
|
28
32
|
/**
|
|
29
33
|
* All the plugins that are used in the chart.
|
|
30
34
|
*/
|
|
@@ -20,6 +20,7 @@ export declare function useCharts<TSeriesType extends ChartSeriesType, TSignatur
|
|
|
20
20
|
publicAPI: ChartPublicAPI<TSignatures>;
|
|
21
21
|
instance: ChartInstance<TSignatures>;
|
|
22
22
|
svgRef: React.RefObject<SVGSVGElement | null>;
|
|
23
|
+
chartRootRef: React.RefObject<HTMLDivElement | null>;
|
|
23
24
|
};
|
|
24
25
|
};
|
|
25
26
|
export declare function useChartApiInitialization<T>(inputApiRef: React.RefObject<T | undefined> | undefined): T;
|
|
@@ -27,6 +27,7 @@ export function useCharts(inPlugins, props, seriesConfig) {
|
|
|
27
27
|
const instanceRef = React.useRef({});
|
|
28
28
|
const instance = instanceRef.current;
|
|
29
29
|
const publicAPI = useChartApiInitialization(props.apiRef);
|
|
30
|
+
const innerChartRootRef = React.useRef(null);
|
|
30
31
|
const innerSvgRef = React.useRef(null);
|
|
31
32
|
const storeRef = React.useRef(null);
|
|
32
33
|
if (storeRef.current == null) {
|
|
@@ -51,6 +52,7 @@ export function useCharts(inPlugins, props, seriesConfig) {
|
|
|
51
52
|
plugins: plugins,
|
|
52
53
|
store: storeRef.current,
|
|
53
54
|
svgRef: innerSvgRef,
|
|
55
|
+
chartRootRef: innerChartRootRef,
|
|
54
56
|
seriesConfig,
|
|
55
57
|
models
|
|
56
58
|
});
|
|
@@ -66,7 +68,8 @@ export function useCharts(inPlugins, props, seriesConfig) {
|
|
|
66
68
|
store: storeRef.current,
|
|
67
69
|
publicAPI,
|
|
68
70
|
instance,
|
|
69
|
-
svgRef: innerSvgRef
|
|
71
|
+
svgRef: innerSvgRef,
|
|
72
|
+
chartRootRef: innerChartRootRef
|
|
70
73
|
}), [instance, publicAPI]);
|
|
71
74
|
return {
|
|
72
75
|
contextValue
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ChartsLocaleText } from "./utils/chartsLocaleTextApi.js";
|
|
2
|
+
export declare const enUSLocaleText: ChartsLocaleText;
|
|
3
|
+
export declare const DEFAULT_LOCALE: ChartsLocaleText;
|
|
4
|
+
export declare const enUS: {
|
|
5
|
+
components: {
|
|
6
|
+
MuiChartsLocalizationProvider: {
|
|
7
|
+
defaultProps: {
|
|
8
|
+
localeText: {
|
|
9
|
+
loading?: string | undefined;
|
|
10
|
+
noData?: string | undefined;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { getChartsLocalization } from "./utils/getChartsLocalization.js";
|
|
2
|
+
|
|
3
|
+
// This object is not Partial<ChartsLocaleText> because it is the default values
|
|
4
|
+
|
|
5
|
+
export const enUSLocaleText = {
|
|
6
|
+
// Overlay
|
|
7
|
+
loading: 'Loading data…',
|
|
8
|
+
noData: 'No data to display'
|
|
9
|
+
};
|
|
10
|
+
export const DEFAULT_LOCALE = enUSLocaleText;
|
|
11
|
+
export const enUS = getChartsLocalization(enUSLocaleText);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ChartsLocaleText } from "./utils/chartsLocaleTextApi.js";
|
|
2
|
+
export declare const frFRLocalText: Partial<ChartsLocaleText>;
|
|
3
|
+
export declare const frFR: {
|
|
4
|
+
components: {
|
|
5
|
+
MuiChartsLocalizationProvider: {
|
|
6
|
+
defaultProps: {
|
|
7
|
+
localeText: {
|
|
8
|
+
loading?: string | undefined;
|
|
9
|
+
noData?: string | undefined;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface ChartsLocaleText {
|
|
2
|
+
/**
|
|
3
|
+
* Title displayed in the overlay if `loading` is `true`.
|
|
4
|
+
*/
|
|
5
|
+
loading: string;
|
|
6
|
+
/**
|
|
7
|
+
* Title displayed in the overlay if there is no data to display.
|
|
8
|
+
*/
|
|
9
|
+
noData: string;
|
|
10
|
+
}
|
|
11
|
+
export type ChartsTranslationKeys = keyof ChartsLocaleText;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ChartsLocaleText } from "./chartsLocaleTextApi.js";
|
|
2
|
+
/**
|
|
3
|
+
* Helper to pass translation to all charts thanks to the MUI theme.
|
|
4
|
+
* @param chartsTranslations The translation object.
|
|
5
|
+
* @returns an object to pass the translation by using the MUI theme default props
|
|
6
|
+
*/
|
|
7
|
+
export declare const getChartsLocalization: (chartsTranslations: Partial<ChartsLocaleText>) => {
|
|
8
|
+
components: {
|
|
9
|
+
MuiChartsLocalizationProvider: {
|
|
10
|
+
defaultProps: {
|
|
11
|
+
localeText: {
|
|
12
|
+
loading?: string | undefined;
|
|
13
|
+
noData?: string | undefined;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
/**
|
|
3
|
+
* Helper to pass translation to all charts thanks to the MUI theme.
|
|
4
|
+
* @param chartsTranslations The translation object.
|
|
5
|
+
* @returns an object to pass the translation by using the MUI theme default props
|
|
6
|
+
*/
|
|
7
|
+
export const getChartsLocalization = chartsTranslations => {
|
|
8
|
+
return {
|
|
9
|
+
components: {
|
|
10
|
+
MuiChartsLocalizationProvider: {
|
|
11
|
+
defaultProps: {
|
|
12
|
+
localeText: _extends({}, chartsTranslations)
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
};
|
|
@@ -22,6 +22,9 @@ export interface ChartsComponents<Theme = unknown> {
|
|
|
22
22
|
defaultProps?: ComponentsProps['MuiChartsLegend'];
|
|
23
23
|
styleOverrides?: ComponentsOverrides<Theme>['MuiChartsLegend'];
|
|
24
24
|
};
|
|
25
|
+
MuiChartsLocalizationProvider?: {
|
|
26
|
+
defaultProps?: ComponentsProps['MuiChartsLocalizationProvider'];
|
|
27
|
+
};
|
|
25
28
|
MuiChartsTooltip?: {
|
|
26
29
|
defaultProps?: ComponentsProps['MuiChartsTooltip'];
|
|
27
30
|
styleOverrides?: ComponentsOverrides<Theme>['MuiChartsTooltip'];
|
|
@@ -8,11 +8,13 @@ import { LineChartProps } from "../LineChart/LineChart.js";
|
|
|
8
8
|
import { ScatterChartProps } from "../ScatterChart/ScatterChart.js";
|
|
9
9
|
import { PieChartProps } from "../PieChart/PieChart.js";
|
|
10
10
|
import { ChartsXAxisProps, ChartsYAxisProps } from "../models/axis.js";
|
|
11
|
+
import { ChartsLocalizationProviderProps } from "../ChartsLocalizationProvider/index.js";
|
|
11
12
|
export interface ChartsComponentsPropsList {
|
|
12
13
|
MuiChartsXAxis: ChartsXAxisProps;
|
|
13
14
|
MuiChartsYAxis: ChartsYAxisProps;
|
|
14
15
|
MuiChartsGrid: ChartsGridProps;
|
|
15
16
|
MuiChartsLegend: ChartsLegendProps;
|
|
17
|
+
MuiChartsLocalizationProvider: ChartsLocalizationProviderProps;
|
|
16
18
|
MuiChartsTooltip: ChartsTooltipProps;
|
|
17
19
|
MuiChartsSurface: ChartsSurfaceProps;
|
|
18
20
|
|
package/hooks/index.d.ts
CHANGED
|
@@ -14,4 +14,6 @@ export * from "./useItemHighlighted.js";
|
|
|
14
14
|
export * from "./useItemHighlightedGetter.js";
|
|
15
15
|
export * from "./useLegend.js";
|
|
16
16
|
export { useChartGradientId, useChartGradientIdObjectBound } from "./useChartGradientId.js";
|
|
17
|
-
export * from "./animation/index.js";
|
|
17
|
+
export * from "./animation/index.js";
|
|
18
|
+
export * from "./useChartRootRef.js";
|
|
19
|
+
export * from "./useChartsLocalization.js";
|
package/hooks/index.js
CHANGED
|
@@ -211,4 +211,28 @@ Object.keys(_animation).forEach(function (key) {
|
|
|
211
211
|
return _animation[key];
|
|
212
212
|
}
|
|
213
213
|
});
|
|
214
|
+
});
|
|
215
|
+
var _useChartRootRef = require("./useChartRootRef");
|
|
216
|
+
Object.keys(_useChartRootRef).forEach(function (key) {
|
|
217
|
+
if (key === "default" || key === "__esModule") return;
|
|
218
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
219
|
+
if (key in exports && exports[key] === _useChartRootRef[key]) return;
|
|
220
|
+
Object.defineProperty(exports, key, {
|
|
221
|
+
enumerable: true,
|
|
222
|
+
get: function () {
|
|
223
|
+
return _useChartRootRef[key];
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
});
|
|
227
|
+
var _useChartsLocalization = require("./useChartsLocalization");
|
|
228
|
+
Object.keys(_useChartsLocalization).forEach(function (key) {
|
|
229
|
+
if (key === "default" || key === "__esModule") return;
|
|
230
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
231
|
+
if (key in exports && exports[key] === _useChartsLocalization[key]) return;
|
|
232
|
+
Object.defineProperty(exports, key, {
|
|
233
|
+
enumerable: true,
|
|
234
|
+
get: function () {
|
|
235
|
+
return _useChartsLocalization[key];
|
|
236
|
+
}
|
|
237
|
+
});
|
|
214
238
|
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.useChartRootRef = useChartRootRef;
|
|
8
|
+
var _ChartProvider = require("../context/ChartProvider");
|
|
9
|
+
/**
|
|
10
|
+
* Get the ref for the root chart element.
|
|
11
|
+
* @returns The root chart element ref.
|
|
12
|
+
*/
|
|
13
|
+
function useChartRootRef() {
|
|
14
|
+
const context = (0, _ChartProvider.useChartContext)();
|
|
15
|
+
return context.chartRootRef;
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useChartsLocalization: () => import("../ChartsLocalizationProvider/ChartsLocalizationProvider").ChartsLocalizationContextValue;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.useChartsLocalization = void 0;
|
|
8
|
+
var React = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _ChartsLocalizationProvider = require("../ChartsLocalizationProvider/ChartsLocalizationProvider");
|
|
10
|
+
const useChartsLocalization = () => {
|
|
11
|
+
const localization = React.useContext(_ChartsLocalizationProvider.ChartsLocalizationContext);
|
|
12
|
+
if (localization === null) {
|
|
13
|
+
throw new Error(['MUI X: Can not find the charts localization context.', 'It looks like you forgot to wrap your component in ChartsLocalizationProvider.', 'This can also happen if you are bundling multiple versions of the `@mui/x-charts` package'].join('\n'));
|
|
14
|
+
}
|
|
15
|
+
return localization;
|
|
16
|
+
};
|
|
17
|
+
exports.useChartsLocalization = useChartsLocalization;
|
package/index.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export * from "./ChartsText/index.js";
|
|
|
13
13
|
export * from "./ChartsTooltip/index.js";
|
|
14
14
|
export * from "./ChartsLabel/index.js";
|
|
15
15
|
export * from "./ChartsLegend/index.js";
|
|
16
|
+
export * from "./ChartsLocalizationProvider/index.js";
|
|
16
17
|
export * from "./ChartsAxisHighlight/index.js";
|
|
17
18
|
export * from "./BarChart/index.js";
|
|
18
19
|
export * from "./LineChart/index.js";
|
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/x-charts v8.
|
|
2
|
+
* @mui/x-charts v8.1.0
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
@@ -175,6 +175,17 @@ Object.keys(_ChartsLegend).forEach(function (key) {
|
|
|
175
175
|
}
|
|
176
176
|
});
|
|
177
177
|
});
|
|
178
|
+
var _ChartsLocalizationProvider = require("./ChartsLocalizationProvider");
|
|
179
|
+
Object.keys(_ChartsLocalizationProvider).forEach(function (key) {
|
|
180
|
+
if (key === "default" || key === "__esModule") return;
|
|
181
|
+
if (key in exports && exports[key] === _ChartsLocalizationProvider[key]) return;
|
|
182
|
+
Object.defineProperty(exports, key, {
|
|
183
|
+
enumerable: true,
|
|
184
|
+
get: function () {
|
|
185
|
+
return _ChartsLocalizationProvider[key];
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
});
|
|
178
189
|
var _ChartsAxisHighlight = require("./ChartsAxisHighlight");
|
|
179
190
|
Object.keys(_ChartsAxisHighlight).forEach(function (key) {
|
|
180
191
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -10,8 +10,7 @@ var _styles = require("@mui/material/styles");
|
|
|
10
10
|
var _axisClasses = require("../../ChartsAxis/axisClasses");
|
|
11
11
|
const AxisRoot = exports.AxisRoot = (0, _styles.styled)('g', {
|
|
12
12
|
name: 'MuiChartsAxis',
|
|
13
|
-
slot: 'Root'
|
|
14
|
-
overridesResolver: (props, styles) => styles.root
|
|
13
|
+
slot: 'Root'
|
|
15
14
|
})(({
|
|
16
15
|
theme
|
|
17
16
|
}) => ({
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.ChartsWrapper = ChartsWrapper;
|
|
8
8
|
var React = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _styles = require("@mui/material/styles");
|
|
10
|
+
var _useChartRootRef = require("../../../hooks/useChartRootRef");
|
|
10
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
12
|
const getDirection = (direction, position) => {
|
|
12
13
|
if (direction === 'vertical') {
|
|
@@ -41,8 +42,7 @@ const getAlign = (direction, position) => {
|
|
|
41
42
|
};
|
|
42
43
|
const Root = (0, _styles.styled)('div', {
|
|
43
44
|
name: 'MuiChartsWrapper',
|
|
44
|
-
slot: 'Root'
|
|
45
|
-
overridesResolver: (props, styles) => styles.root
|
|
45
|
+
slot: 'Root'
|
|
46
46
|
})(({
|
|
47
47
|
ownerState
|
|
48
48
|
}) => ({
|
|
@@ -64,7 +64,9 @@ function ChartsWrapper(props) {
|
|
|
64
64
|
children,
|
|
65
65
|
sx
|
|
66
66
|
} = props;
|
|
67
|
+
const chartRootRef = (0, _useChartRootRef.useChartRootRef)();
|
|
67
68
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Root, {
|
|
69
|
+
ref: chartRootRef,
|
|
68
70
|
ownerState: props,
|
|
69
71
|
sx: sx,
|
|
70
72
|
children: children
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
'use client';
|
|
3
3
|
|
|
4
|
-
/* eslint-disable react-compiler/react-compiler */
|
|
5
4
|
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
6
5
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
7
6
|
Object.defineProperty(exports, "__esModule", {
|