@mui/x-charts 8.0.0-alpha.3 → 8.0.0-alpha.5
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/CHANGELOG.md +377 -0
- package/ChartsAxis/ChartsAxis.js +0 -4
- package/ChartsLabel/ChartsLabel.d.ts +19 -0
- package/ChartsLabel/ChartsLabel.js +58 -0
- package/ChartsLabel/ChartsLabelGradient.d.ts +40 -0
- package/ChartsLabel/ChartsLabelGradient.js +133 -0
- package/ChartsLabel/ChartsLabelMark.d.ts +27 -0
- package/ChartsLabel/ChartsLabelMark.js +108 -0
- package/ChartsLabel/labelClasses.d.ts +9 -0
- package/ChartsLabel/labelClasses.js +13 -0
- package/ChartsLabel/labelGradientClasses.d.ts +15 -0
- package/ChartsLabel/labelGradientClasses.js +17 -0
- package/ChartsLabel/labelMarkClasses.d.ts +17 -0
- package/ChartsLabel/labelMarkClasses.js +17 -0
- package/ChartsLegend/useAxis.js +3 -3
- package/ChartsTooltip/ChartsAxisTooltipContent.js +5 -3
- package/ChartsTooltip/ChartsTooltipTable.js +15 -13
- package/ChartsTooltip/chartsTooltipClasses.d.ts +3 -1
- package/ChartsTooltip/chartsTooltipClasses.js +3 -2
- package/ChartsTooltip/useAxisTooltip.js +2 -3
- package/ChartsTooltip/useItemTooltip.js +2 -3
- package/PieChart/PiePlot.js +2 -2
- package/README.md +1 -1
- package/ScatterChart/ScatterPlot.js +2 -2
- package/ScatterChart/extremums.js +1 -3
- package/ScatterChart/formatter.js +3 -3
- package/hooks/useChartId.d.ts +1 -1
- package/hooks/useColorScale.js +2 -3
- package/hooks/useZAxis.d.ts +6 -0
- package/hooks/useZAxis.js +8 -0
- package/index.js +1 -1
- package/internals/consumeThemeProps.d.ts +54 -0
- package/internals/consumeThemeProps.js +79 -0
- package/internals/defaultizeColor.d.ts +1 -1
- package/internals/plugins/corePlugins/useChartId/useChartId.js +1 -1
- package/internals/plugins/corePlugins/useChartId/useChartId.selectors.d.ts +6 -6
- package/internals/plugins/corePlugins/useChartId/useChartId.types.d.ts +3 -3
- package/internals/store/useCharts.js +8 -2
- package/models/seriesType/scatter.d.ts +1 -1
- package/modern/ChartsAxis/ChartsAxis.js +0 -4
- package/modern/ChartsLabel/ChartsLabel.js +58 -0
- package/modern/ChartsLabel/ChartsLabelGradient.js +133 -0
- package/modern/ChartsLabel/ChartsLabelMark.js +108 -0
- package/modern/ChartsLabel/labelClasses.js +13 -0
- package/modern/ChartsLabel/labelGradientClasses.js +17 -0
- package/modern/ChartsLabel/labelMarkClasses.js +17 -0
- package/modern/ChartsLegend/useAxis.js +3 -3
- package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +5 -3
- package/modern/ChartsTooltip/ChartsTooltipTable.js +15 -13
- package/modern/ChartsTooltip/chartsTooltipClasses.js +3 -2
- package/modern/ChartsTooltip/useAxisTooltip.js +2 -3
- package/modern/ChartsTooltip/useItemTooltip.js +2 -3
- package/modern/PieChart/PiePlot.js +2 -2
- package/modern/ScatterChart/ScatterPlot.js +2 -2
- package/modern/ScatterChart/extremums.js +1 -3
- package/modern/ScatterChart/formatter.js +3 -3
- package/modern/hooks/useColorScale.js +2 -3
- package/modern/hooks/useZAxis.js +8 -0
- package/modern/index.js +1 -1
- package/modern/internals/consumeThemeProps.js +79 -0
- package/modern/internals/plugins/corePlugins/useChartId/useChartId.js +1 -1
- package/modern/internals/store/useCharts.js +8 -2
- package/node/ChartsAxis/ChartsAxis.js +0 -4
- package/node/ChartsLabel/ChartsLabel.js +64 -0
- package/node/ChartsLabel/ChartsLabelGradient.js +139 -0
- package/node/ChartsLabel/ChartsLabelMark.js +114 -0
- package/node/ChartsLabel/labelClasses.js +22 -0
- package/node/ChartsLabel/labelGradientClasses.js +26 -0
- package/node/ChartsLabel/labelMarkClasses.js +26 -0
- package/node/ChartsLegend/useAxis.js +2 -4
- package/node/ChartsTooltip/ChartsAxisTooltipContent.js +5 -3
- package/node/ChartsTooltip/ChartsTooltipTable.js +15 -13
- package/node/ChartsTooltip/chartsTooltipClasses.js +3 -2
- package/node/ChartsTooltip/useAxisTooltip.js +2 -4
- package/node/ChartsTooltip/useItemTooltip.js +2 -4
- package/node/PieChart/PiePlot.js +2 -2
- package/node/ScatterChart/ScatterPlot.js +2 -2
- package/node/ScatterChart/extremums.js +1 -3
- package/node/ScatterChart/formatter.js +3 -3
- package/node/hooks/useColorScale.js +2 -4
- package/node/hooks/useZAxis.js +15 -0
- package/node/index.js +1 -1
- package/node/internals/consumeThemeProps.js +87 -0
- package/node/internals/plugins/corePlugins/useChartId/useChartId.js +1 -1
- package/node/internals/store/useCharts.js +9 -2
- package/package.json +5 -4
|
@@ -4,7 +4,7 @@ import composeClasses from '@mui/utils/composeClasses';
|
|
|
4
4
|
export function getChartsTooltipUtilityClass(slot) {
|
|
5
5
|
return generateUtilityClass('MuiChartsTooltip', slot);
|
|
6
6
|
}
|
|
7
|
-
export const chartsTooltipClasses = generateUtilityClasses('MuiChartsTooltip', ['root', 'paper', 'table', 'row', 'cell', 'mark', 'markCell', 'labelCell', 'valueCell']);
|
|
7
|
+
export const chartsTooltipClasses = generateUtilityClasses('MuiChartsTooltip', ['root', 'paper', 'table', 'row', 'cell', 'mark', 'markCell', 'labelCell', 'valueCell', 'axisValueCell']);
|
|
8
8
|
export const useUtilityClasses = classes => {
|
|
9
9
|
const slots = {
|
|
10
10
|
root: ['root'],
|
|
@@ -15,7 +15,8 @@ export const useUtilityClasses = classes => {
|
|
|
15
15
|
mark: ['mark'],
|
|
16
16
|
markCell: ['markCell'],
|
|
17
17
|
labelCell: ['labelCell'],
|
|
18
|
-
valueCell: ['valueCell']
|
|
18
|
+
valueCell: ['valueCell'],
|
|
19
|
+
axisValueCell: ['axisValueCell']
|
|
19
20
|
};
|
|
20
21
|
return composeClasses(slots, getChartsTooltipUtilityClass, classes);
|
|
21
22
|
};
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import * as React from 'react';
|
|
4
3
|
import { useSeries } from "../hooks/useSeries.js";
|
|
5
4
|
import { useCartesianContext } from "../context/CartesianProvider/index.js";
|
|
6
|
-
import { ZAxisContext } from "../context/ZAxisContextProvider.js";
|
|
7
5
|
import { useColorProcessor } from "../context/PluginProvider/useColorProcessor.js";
|
|
8
6
|
import { useStore } from "../internals/store/useStore.js";
|
|
9
7
|
import { useSelector } from "../internals/store/useSelector.js";
|
|
@@ -11,6 +9,7 @@ import { getLabel } from "../internals/getLabel.js";
|
|
|
11
9
|
import { isCartesianSeriesType } from "../internals/isCartesian.js";
|
|
12
10
|
import { utcFormatter } from "./utils.js";
|
|
13
11
|
import { useXAxis, useYAxis } from "../hooks/useAxis.js";
|
|
12
|
+
import { useZAxis } from "../hooks/useZAxis.js";
|
|
14
13
|
import { selectorChartsInteractionXAxis, selectorChartsInteractionYAxis } from "../internals/plugins/featurePlugins/useChartInteraction/index.js";
|
|
15
14
|
export function useAxisTooltip() {
|
|
16
15
|
const defaultXAxis = useXAxis();
|
|
@@ -26,7 +25,7 @@ export function useAxisTooltip() {
|
|
|
26
25
|
const {
|
|
27
26
|
zAxis,
|
|
28
27
|
zAxisIds
|
|
29
|
-
} =
|
|
28
|
+
} = useZAxis();
|
|
30
29
|
const colorProcessors = useColorProcessor();
|
|
31
30
|
if (axisData === null) {
|
|
32
31
|
return null;
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
-
import * as React from 'react';
|
|
5
4
|
import { useSeries } from "../hooks/useSeries.js";
|
|
6
5
|
import { useCartesianContext } from "../context/CartesianProvider/index.js";
|
|
7
|
-
import { ZAxisContext } from "../context/ZAxisContextProvider.js";
|
|
8
6
|
import { useColorProcessor } from "../context/PluginProvider/useColorProcessor.js";
|
|
9
7
|
import { getLabel } from "../internals/getLabel.js";
|
|
10
8
|
import { selectorChartsInteractionItem } from "../internals/plugins/featurePlugins/useChartInteraction/index.js";
|
|
11
9
|
import { useSelector } from "../internals/store/useSelector.js";
|
|
12
10
|
import { useStore } from "../internals/store/useStore.js";
|
|
11
|
+
import { useZAxis } from "../hooks/useZAxis.js";
|
|
13
12
|
export function useItemTooltip() {
|
|
14
13
|
const store = useStore();
|
|
15
14
|
const item = useSelector(store, selectorChartsInteractionItem);
|
|
@@ -23,7 +22,7 @@ export function useItemTooltip() {
|
|
|
23
22
|
const {
|
|
24
23
|
zAxis,
|
|
25
24
|
zAxisIds
|
|
26
|
-
} =
|
|
25
|
+
} = useZAxis();
|
|
27
26
|
const colorProcessors = useColorProcessor();
|
|
28
27
|
const xAxisId = series.xAxisId ?? xAxisIds[0];
|
|
29
28
|
const yAxisId = series.yAxisId ?? yAxisIds[0];
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
|
-
import { DrawingAreaContext } from "../context/DrawingAreaProvider/index.js";
|
|
6
5
|
import { PieArcPlot } from "./PieArcPlot.js";
|
|
7
6
|
import { PieArcLabelPlot } from "./PieArcLabelPlot.js";
|
|
8
7
|
import { getPercentageValue } from "../internals/getPercentageValue.js";
|
|
9
8
|
import { getPieCoordinates } from "./getPieCoordinates.js";
|
|
10
9
|
import { usePieSeries } from "../hooks/useSeries.js";
|
|
11
10
|
import { useSkipAnimation } from "../context/AnimationProvider/index.js";
|
|
11
|
+
import { useDrawingArea } from "../hooks/index.js";
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
/**
|
|
14
14
|
* Demos:
|
|
@@ -33,7 +33,7 @@ function PiePlot(props) {
|
|
|
33
33
|
top,
|
|
34
34
|
width,
|
|
35
35
|
height
|
|
36
|
-
} =
|
|
36
|
+
} = useDrawingArea();
|
|
37
37
|
const skipAnimation = useSkipAnimation(inSkipAnimation);
|
|
38
38
|
if (seriesData === undefined) {
|
|
39
39
|
return null;
|
|
@@ -6,8 +6,8 @@ import PropTypes from 'prop-types';
|
|
|
6
6
|
import { Scatter } from "./Scatter.js";
|
|
7
7
|
import { useCartesianContext } from "../context/CartesianProvider/index.js";
|
|
8
8
|
import getColor from "./getColor.js";
|
|
9
|
-
import { ZAxisContext } from "../context/ZAxisContextProvider.js";
|
|
10
9
|
import { useScatterSeries } from "../hooks/useSeries.js";
|
|
10
|
+
import { useZAxis } from "../hooks/useZAxis.js";
|
|
11
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
12
|
/**
|
|
13
13
|
* Demos:
|
|
@@ -30,7 +30,7 @@ function ScatterPlot(props) {
|
|
|
30
30
|
const {
|
|
31
31
|
zAxis,
|
|
32
32
|
zAxisIds
|
|
33
|
-
} =
|
|
33
|
+
} = useZAxis();
|
|
34
34
|
if (seriesData === undefined) {
|
|
35
35
|
return null;
|
|
36
36
|
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
const mergeMinMax = (acc, val) =>
|
|
2
|
-
return [Math.min(acc[0], val[0]), Math.max(acc[1], val[1])];
|
|
3
|
-
};
|
|
1
|
+
const mergeMinMax = (acc, val) => [val[0] === null ? acc[0] : Math.min(acc[0], val[0]), val[1] === null ? acc[1] : Math.max(acc[1], val[1])];
|
|
4
2
|
export const getExtremumX = params => {
|
|
5
3
|
const {
|
|
6
4
|
series,
|
|
@@ -11,15 +11,15 @@ const formatter = ({
|
|
|
11
11
|
}
|
|
12
12
|
const data = !datasetKeys ? seriesData.data ?? [] : dataset?.map(d => {
|
|
13
13
|
return {
|
|
14
|
-
x: d[datasetKeys.x],
|
|
15
|
-
y: d[datasetKeys.y],
|
|
14
|
+
x: d[datasetKeys.x] ?? null,
|
|
15
|
+
y: d[datasetKeys.y] ?? null,
|
|
16
16
|
z: datasetKeys.z && d[datasetKeys.z],
|
|
17
17
|
id: d[datasetKeys.id]
|
|
18
18
|
};
|
|
19
19
|
}) ?? [];
|
|
20
20
|
return [seriesId, _extends({}, seriesData, {
|
|
21
21
|
data,
|
|
22
|
-
valueFormatter: seriesData.valueFormatter ?? (v => `(${v.x}, ${v.y})`)
|
|
22
|
+
valueFormatter: seriesData.valueFormatter ?? (v => v && `(${v.x}, ${v.y})`)
|
|
23
23
|
})];
|
|
24
24
|
}));
|
|
25
25
|
return {
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import * as React from 'react';
|
|
4
3
|
import { useCartesianContext } from "../context/CartesianProvider/index.js";
|
|
5
|
-
import {
|
|
4
|
+
import { useZAxis } from "./useZAxis.js";
|
|
6
5
|
export function useXColorScale(identifier) {
|
|
7
6
|
const {
|
|
8
7
|
xAxis,
|
|
@@ -23,7 +22,7 @@ export function useZColorScale(identifier) {
|
|
|
23
22
|
const {
|
|
24
23
|
zAxis,
|
|
25
24
|
zAxisIds
|
|
26
|
-
} =
|
|
25
|
+
} = useZAxis();
|
|
27
26
|
const id = typeof identifier === 'string' ? identifier : zAxisIds[identifier ?? 0];
|
|
28
27
|
return zAxis[id]?.colorScale;
|
|
29
28
|
}
|
package/modern/index.js
CHANGED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import { useTheme, useThemeProps } from '@mui/material/styles';
|
|
3
|
+
import resolveProps from '@mui/utils/resolveProps';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import * as ReactIs from 'react-is';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* A higher order component that consumes and merges the theme `defaultProps` and handles the `classes` and renders the component.
|
|
9
|
+
*
|
|
10
|
+
* This HOC will wrap a single component.
|
|
11
|
+
* If you need to render multiple components, you can manually consume the theme and render them in your component instead of using this HOC.
|
|
12
|
+
*
|
|
13
|
+
* In the example below, `MyComponent` will render the `DefaultComponent` with the `direction` prop set to `'row'` and the className set to `'my-custom-root'`.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* createTheme({
|
|
18
|
+
* components: {
|
|
19
|
+
* MuiMyComponent: {
|
|
20
|
+
* defaultProps: {
|
|
21
|
+
* direction: 'row',
|
|
22
|
+
* },
|
|
23
|
+
* },
|
|
24
|
+
* },
|
|
25
|
+
* })
|
|
26
|
+
*
|
|
27
|
+
* type MyComponentProps = {
|
|
28
|
+
* direction: 'row' | 'column';
|
|
29
|
+
* classes?: Record<'root', string>;
|
|
30
|
+
* };
|
|
31
|
+
*
|
|
32
|
+
* const MyComponent = consumeThemeProps(
|
|
33
|
+
* 'MuiMyComponent',
|
|
34
|
+
* function DefaultComponent(props: MyComponentProps) {
|
|
35
|
+
* return (
|
|
36
|
+
* <div className={props.classes.root}>
|
|
37
|
+
* {props.direction}
|
|
38
|
+
* </div>
|
|
39
|
+
* );
|
|
40
|
+
* }
|
|
41
|
+
* );
|
|
42
|
+
*
|
|
43
|
+
* render(<MyComponent classes={{ root: 'my-custom-root' }} />);
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* @param {string} name The mui component name.
|
|
47
|
+
* @param {object} options Options for the HOC.
|
|
48
|
+
* @param {Record<string, any>} options.defaultProps A set of defaults for the component, will be deep merged with the props.
|
|
49
|
+
* @param {Function} options.classesResolver A function that returns the classes for the component. It receives the props, after theme props and defaults have been applied. And the theme object as the second argument.
|
|
50
|
+
* @param InComponent The component to render if the slot is not provided.
|
|
51
|
+
*/
|
|
52
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
53
|
+
export const consumeThemeProps = (name, options, InComponent) => {
|
|
54
|
+
function InternalComponent(props, ref) {
|
|
55
|
+
const themedProps = useThemeProps({
|
|
56
|
+
props,
|
|
57
|
+
// eslint-disable-next-line material-ui/mui-name-matches-component-name
|
|
58
|
+
name
|
|
59
|
+
});
|
|
60
|
+
const defaultProps = typeof options.defaultProps === 'function' ? options.defaultProps(themedProps) : options.defaultProps ?? {};
|
|
61
|
+
const outProps = resolveProps(defaultProps, themedProps);
|
|
62
|
+
const theme = useTheme();
|
|
63
|
+
const classes = options.classesResolver?.(outProps, theme);
|
|
64
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
65
|
+
// eslint-disable-next-line react-compiler/react-compiler
|
|
66
|
+
InComponent.displayName = name;
|
|
67
|
+
}
|
|
68
|
+
const OutComponent = ReactIs.isForwardRef(InComponent) ? InComponent :
|
|
69
|
+
/*#__PURE__*/
|
|
70
|
+
// InComponent needs to be a function that accepts `(props, ref)`
|
|
71
|
+
// @ts-expect-error
|
|
72
|
+
React.forwardRef(InComponent);
|
|
73
|
+
return /*#__PURE__*/_jsx(OutComponent, _extends({}, outProps, {
|
|
74
|
+
classes: classes,
|
|
75
|
+
ref: ref
|
|
76
|
+
}));
|
|
77
|
+
}
|
|
78
|
+
return /*#__PURE__*/React.forwardRef(InternalComponent);
|
|
79
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import useId from '@mui/utils/useId';
|
|
2
3
|
import { ChartStore } from "../plugins/utils/ChartStore.js";
|
|
3
4
|
import { CHART_CORE_PLUGINS } from "../plugins/corePlugins/index.js";
|
|
4
5
|
export function useChartApiInitialization(inputApiRef) {
|
|
@@ -15,7 +16,10 @@ export function useChartApiInitialization(inputApiRef) {
|
|
|
15
16
|
let globalId = 0;
|
|
16
17
|
export function useCharts(inPlugins, props) {
|
|
17
18
|
const plugins = React.useMemo(() => [...CHART_CORE_PLUGINS, ...inPlugins], [inPlugins]);
|
|
18
|
-
const
|
|
19
|
+
const defaultChartId = useId();
|
|
20
|
+
const pluginParams = {
|
|
21
|
+
id: defaultChartId
|
|
22
|
+
}; // To generate when plugins use params.
|
|
19
23
|
const instanceRef = React.useRef({});
|
|
20
24
|
const instance = instanceRef.current;
|
|
21
25
|
const publicAPI = useChartApiInitialization(props.apiRef);
|
|
@@ -39,7 +43,9 @@ export function useCharts(inPlugins, props) {
|
|
|
39
43
|
};
|
|
40
44
|
plugins.forEach(plugin => {
|
|
41
45
|
if (plugin.getInitialState) {
|
|
42
|
-
Object.assign(initialState, plugin.getInitialState({
|
|
46
|
+
Object.assign(initialState, plugin.getInitialState({
|
|
47
|
+
id: defaultChartId
|
|
48
|
+
}));
|
|
43
49
|
}
|
|
44
50
|
});
|
|
45
51
|
storeRef.current = new ChartStore(initialState);
|
|
@@ -57,10 +57,6 @@ function ChartsAxis(props) {
|
|
|
57
57
|
yAxis,
|
|
58
58
|
yAxisIds
|
|
59
59
|
} = (0, _CartesianProvider.useCartesianContext)();
|
|
60
|
-
|
|
61
|
-
// TODO: use for plotting line without ticks or any thing
|
|
62
|
-
// const drawingArea = React.useContext(DrawingContext);
|
|
63
|
-
|
|
64
60
|
const leftId = getAxisId(leftAxis === undefined ? yAxisIds[0] : leftAxis, yAxisIds[0]);
|
|
65
61
|
const bottomId = getAxisId(bottomAxis === undefined ? xAxisIds[0] : bottomAxis, xAxisIds[0]);
|
|
66
62
|
const topId = getAxisId(topAxis, xAxisIds[0]);
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
exports.ChartsLabel = void 0;
|
|
10
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
11
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
12
|
+
var React = _interopRequireWildcard(require("react"));
|
|
13
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
14
|
+
var _styles = require("@mui/material/styles");
|
|
15
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
16
|
+
var _labelClasses = require("./labelClasses");
|
|
17
|
+
var _consumeThemeProps = require("../internals/consumeThemeProps");
|
|
18
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
+
const _excluded = ["children", "className", "classes"];
|
|
20
|
+
const Root = (0, _styles.styled)('span', {
|
|
21
|
+
name: 'MuiChartsLabel',
|
|
22
|
+
slot: 'Root',
|
|
23
|
+
overridesResolver: (props, styles) => styles.root
|
|
24
|
+
})(({
|
|
25
|
+
theme
|
|
26
|
+
}) => (0, _extends2.default)({}, theme.typography.caption, {
|
|
27
|
+
color: (theme.vars || theme).palette.text.primary,
|
|
28
|
+
lineHeight: undefined,
|
|
29
|
+
display: 'flex'
|
|
30
|
+
}));
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @ignore - internal component.
|
|
34
|
+
*
|
|
35
|
+
* Generates the label mark for the tooltip and legend.
|
|
36
|
+
*/
|
|
37
|
+
const ChartsLabel = exports.ChartsLabel = (0, _consumeThemeProps.consumeThemeProps)('MuiChartsLabel', {
|
|
38
|
+
classesResolver: _labelClasses.useUtilityClasses
|
|
39
|
+
}, function ChartsLabel(props, ref) {
|
|
40
|
+
const {
|
|
41
|
+
children,
|
|
42
|
+
className,
|
|
43
|
+
classes
|
|
44
|
+
} = props,
|
|
45
|
+
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
46
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Root, (0, _extends2.default)({
|
|
47
|
+
className: (0, _clsx.default)(classes?.root, className),
|
|
48
|
+
ownerState: props,
|
|
49
|
+
ref: ref
|
|
50
|
+
}, other, {
|
|
51
|
+
children: children
|
|
52
|
+
}));
|
|
53
|
+
});
|
|
54
|
+
process.env.NODE_ENV !== "production" ? ChartsLabel.propTypes = {
|
|
55
|
+
// ----------------------------- Warning --------------------------------
|
|
56
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
57
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
58
|
+
// ----------------------------------------------------------------------
|
|
59
|
+
children: _propTypes.default.node,
|
|
60
|
+
/**
|
|
61
|
+
* Override or extend the styles applied to the component.
|
|
62
|
+
*/
|
|
63
|
+
classes: _propTypes.default.object
|
|
64
|
+
} : void 0;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
exports.ChartsLabelGradient = void 0;
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
12
|
+
var React = _interopRequireWildcard(require("react"));
|
|
13
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
14
|
+
var _styles = require("@mui/material/styles");
|
|
15
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
16
|
+
var _labelGradientClasses = require("./labelGradientClasses");
|
|
17
|
+
var _consumeThemeProps = require("../internals/consumeThemeProps");
|
|
18
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
+
const _excluded = ["gradientId", "direction", "classes", "className"];
|
|
20
|
+
const getRotation = (direction, reverse, rotate) => {
|
|
21
|
+
if (!rotate && reverse) {
|
|
22
|
+
return direction === 'column' ? 90 : 180;
|
|
23
|
+
}
|
|
24
|
+
if (rotate && !reverse) {
|
|
25
|
+
return direction === 'column' ? 0 : 90;
|
|
26
|
+
}
|
|
27
|
+
if (rotate && reverse) {
|
|
28
|
+
return direction === 'column' ? 180 : -90;
|
|
29
|
+
}
|
|
30
|
+
return direction === 'column' ? -90 : 0;
|
|
31
|
+
};
|
|
32
|
+
const Root = (0, _styles.styled)('div', {
|
|
33
|
+
name: 'MuiChartsLabelGradient',
|
|
34
|
+
slot: 'Root',
|
|
35
|
+
overridesResolver: (props, styles) => styles.root
|
|
36
|
+
})(({
|
|
37
|
+
ownerState
|
|
38
|
+
}) => {
|
|
39
|
+
const rotation = getRotation(ownerState.direction, ownerState.reverse, ownerState.rotate);
|
|
40
|
+
return {
|
|
41
|
+
display: 'flex',
|
|
42
|
+
alignItems: 'center',
|
|
43
|
+
justifyContent: 'center',
|
|
44
|
+
[`.${_labelGradientClasses.labelGradientClasses.mask}`]: {
|
|
45
|
+
borderRadius: 2,
|
|
46
|
+
overflow: 'hidden'
|
|
47
|
+
},
|
|
48
|
+
[`&.${_labelGradientClasses.labelGradientClasses.row}`]: {
|
|
49
|
+
width: '100%',
|
|
50
|
+
[`.${_labelGradientClasses.labelGradientClasses.mask}`]: {
|
|
51
|
+
height: 12,
|
|
52
|
+
width: '100%'
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
[`&.${_labelGradientClasses.labelGradientClasses.column}`]: {
|
|
56
|
+
height: '100%',
|
|
57
|
+
[`.${_labelGradientClasses.labelGradientClasses.mask}`]: {
|
|
58
|
+
width: 12,
|
|
59
|
+
height: '100%',
|
|
60
|
+
'> svg': {
|
|
61
|
+
height: '100%'
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
svg: {
|
|
66
|
+
transform: `rotate(${rotation}deg)`,
|
|
67
|
+
display: 'block'
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* @ignore - internal component.
|
|
74
|
+
*
|
|
75
|
+
* Generates the label Gradient for the tooltip and legend.
|
|
76
|
+
*/
|
|
77
|
+
const ChartsLabelGradient = exports.ChartsLabelGradient = (0, _consumeThemeProps.consumeThemeProps)('MuiChartsLabelGradient', {
|
|
78
|
+
defaultProps: {
|
|
79
|
+
direction: 'row'
|
|
80
|
+
},
|
|
81
|
+
classesResolver: _labelGradientClasses.useUtilityClasses
|
|
82
|
+
}, function ChartsLabelGradient(props, ref) {
|
|
83
|
+
const {
|
|
84
|
+
gradientId,
|
|
85
|
+
classes,
|
|
86
|
+
className
|
|
87
|
+
} = props,
|
|
88
|
+
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
89
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Root, (0, _extends2.default)({
|
|
90
|
+
className: (0, _clsx.default)(classes?.root, className),
|
|
91
|
+
ownerState: props,
|
|
92
|
+
"aria-hidden": "true",
|
|
93
|
+
ref: ref
|
|
94
|
+
}, other, {
|
|
95
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
96
|
+
className: classes?.mask,
|
|
97
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("svg", {
|
|
98
|
+
viewBox: "0 0 24 24",
|
|
99
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("rect", {
|
|
100
|
+
width: "24",
|
|
101
|
+
height: "24",
|
|
102
|
+
fill: `url(#${gradientId})`
|
|
103
|
+
})
|
|
104
|
+
})
|
|
105
|
+
})
|
|
106
|
+
}));
|
|
107
|
+
});
|
|
108
|
+
process.env.NODE_ENV !== "production" ? ChartsLabelGradient.propTypes = {
|
|
109
|
+
// ----------------------------- Warning --------------------------------
|
|
110
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
111
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
112
|
+
// ----------------------------------------------------------------------
|
|
113
|
+
/**
|
|
114
|
+
* Override or extend the styles applied to the component.
|
|
115
|
+
*/
|
|
116
|
+
classes: _propTypes.default.object,
|
|
117
|
+
/**
|
|
118
|
+
* The direction of the gradient.
|
|
119
|
+
*
|
|
120
|
+
* @default 'row'
|
|
121
|
+
*/
|
|
122
|
+
direction: _propTypes.default.oneOf(['column', 'row']),
|
|
123
|
+
/**
|
|
124
|
+
* A unique identifier for the gradient.
|
|
125
|
+
*
|
|
126
|
+
* The `gradientId` will be used as `fill="url(#gradientId)"`.
|
|
127
|
+
*/
|
|
128
|
+
gradientId: _propTypes.default.string.isRequired,
|
|
129
|
+
/**
|
|
130
|
+
* If `true`, the gradient will be reversed.
|
|
131
|
+
*/
|
|
132
|
+
reverse: _propTypes.default.bool,
|
|
133
|
+
/**
|
|
134
|
+
* If provided, the gradient will be rotated by 90deg.
|
|
135
|
+
*
|
|
136
|
+
* Useful for linear gradients that are not in the correct orientation.
|
|
137
|
+
*/
|
|
138
|
+
rotate: _propTypes.default.bool
|
|
139
|
+
} : void 0;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
exports.ChartsLabelMark = void 0;
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
12
|
+
var React = _interopRequireWildcard(require("react"));
|
|
13
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
14
|
+
var _styles = require("@mui/material/styles");
|
|
15
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
16
|
+
var _labelMarkClasses = require("./labelMarkClasses");
|
|
17
|
+
var _consumeThemeProps = require("../internals/consumeThemeProps");
|
|
18
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
+
const _excluded = ["type", "color", "className", "classes"];
|
|
20
|
+
const Root = (0, _styles.styled)('div', {
|
|
21
|
+
name: 'MuiChartsLabelMark',
|
|
22
|
+
slot: 'Root',
|
|
23
|
+
overridesResolver: (props, styles) => styles.root
|
|
24
|
+
})(() => {
|
|
25
|
+
return {
|
|
26
|
+
display: 'flex',
|
|
27
|
+
alignItems: 'center',
|
|
28
|
+
justifyContent: 'center',
|
|
29
|
+
flexShrink: 0,
|
|
30
|
+
[`&.${_labelMarkClasses.labelMarkClasses.line}`]: {
|
|
31
|
+
width: 16,
|
|
32
|
+
display: 'flex',
|
|
33
|
+
alignItems: 'center',
|
|
34
|
+
[`.${_labelMarkClasses.labelMarkClasses.mask}`]: {
|
|
35
|
+
height: 4,
|
|
36
|
+
width: '100%',
|
|
37
|
+
borderRadius: 1,
|
|
38
|
+
overflow: 'hidden'
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
[`&.${_labelMarkClasses.labelMarkClasses.square}`]: {
|
|
42
|
+
height: 13,
|
|
43
|
+
width: 13,
|
|
44
|
+
borderRadius: 2,
|
|
45
|
+
overflow: 'hidden'
|
|
46
|
+
},
|
|
47
|
+
[`&.${_labelMarkClasses.labelMarkClasses.circle}`]: {
|
|
48
|
+
height: 15,
|
|
49
|
+
width: 15,
|
|
50
|
+
borderRadius: '50%',
|
|
51
|
+
overflow: 'hidden'
|
|
52
|
+
},
|
|
53
|
+
svg: {
|
|
54
|
+
display: 'block',
|
|
55
|
+
height: '100%',
|
|
56
|
+
width: '100%'
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* @ignore - internal component.
|
|
63
|
+
*
|
|
64
|
+
* Generates the label mark for the tooltip and legend.
|
|
65
|
+
*/
|
|
66
|
+
const ChartsLabelMark = exports.ChartsLabelMark = (0, _consumeThemeProps.consumeThemeProps)('MuiChartsLabelMark', {
|
|
67
|
+
classesResolver: _labelMarkClasses.useUtilityClasses
|
|
68
|
+
}, function ChartsLabelMark(props, ref) {
|
|
69
|
+
const {
|
|
70
|
+
type,
|
|
71
|
+
color,
|
|
72
|
+
className,
|
|
73
|
+
classes
|
|
74
|
+
} = props,
|
|
75
|
+
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
76
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Root, (0, _extends2.default)({
|
|
77
|
+
className: (0, _clsx.default)(classes?.root, className),
|
|
78
|
+
ownerState: props,
|
|
79
|
+
"aria-hidden": "true",
|
|
80
|
+
ref: ref
|
|
81
|
+
}, other, {
|
|
82
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
83
|
+
className: classes?.mask,
|
|
84
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("svg", {
|
|
85
|
+
viewBox: "0 0 24 24",
|
|
86
|
+
preserveAspectRatio: type === 'line' ? 'none' : undefined,
|
|
87
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("rect", {
|
|
88
|
+
width: "24",
|
|
89
|
+
height: "24",
|
|
90
|
+
fill: color
|
|
91
|
+
})
|
|
92
|
+
})
|
|
93
|
+
})
|
|
94
|
+
}));
|
|
95
|
+
});
|
|
96
|
+
process.env.NODE_ENV !== "production" ? ChartsLabelMark.propTypes = {
|
|
97
|
+
// ----------------------------- Warning --------------------------------
|
|
98
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
99
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
100
|
+
// ----------------------------------------------------------------------
|
|
101
|
+
/**
|
|
102
|
+
* Override or extend the styles applied to the component.
|
|
103
|
+
*/
|
|
104
|
+
classes: _propTypes.default.object,
|
|
105
|
+
/**
|
|
106
|
+
* The color of the mark.
|
|
107
|
+
*/
|
|
108
|
+
color: _propTypes.default.string,
|
|
109
|
+
/**
|
|
110
|
+
* The type of the mark.
|
|
111
|
+
* @default 'square'
|
|
112
|
+
*/
|
|
113
|
+
type: _propTypes.default.oneOf(['circle', 'line', 'square'])
|
|
114
|
+
} : void 0;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.getLabelUtilityClass = getLabelUtilityClass;
|
|
8
|
+
exports.useUtilityClasses = exports.labelClasses = void 0;
|
|
9
|
+
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
10
|
+
var _generateUtilityClass = _interopRequireDefault(require("@mui/utils/generateUtilityClass"));
|
|
11
|
+
var _generateUtilityClasses = _interopRequireDefault(require("@mui/utils/generateUtilityClasses"));
|
|
12
|
+
function getLabelUtilityClass(slot) {
|
|
13
|
+
return (0, _generateUtilityClass.default)('MuiChartsLabel', slot);
|
|
14
|
+
}
|
|
15
|
+
const labelClasses = exports.labelClasses = (0, _generateUtilityClasses.default)('MuiChartsLabel', ['root']);
|
|
16
|
+
const useUtilityClasses = props => {
|
|
17
|
+
const slots = {
|
|
18
|
+
root: ['root']
|
|
19
|
+
};
|
|
20
|
+
return (0, _composeClasses.default)(slots, getLabelUtilityClass, props.classes);
|
|
21
|
+
};
|
|
22
|
+
exports.useUtilityClasses = useUtilityClasses;
|