@mui/x-charts 8.5.0 → 8.5.1
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 +2 -3
- package/BarChart/BarLabel/BarLabel.d.ts +1 -1
- package/BarChart/seriesConfig/seriesProcessor.js +1 -1
- package/CHANGELOG.md +112 -0
- package/ChartsAxisHighlight/ChartsAxisHighlightPath.d.ts +1 -1
- package/ChartsGrid/styledComponents.d.ts +2 -2
- package/ChartsReferenceLine/common.d.ts +1 -1
- package/ChartsTooltip/ChartsTooltip.js +1 -1
- package/ChartsTooltip/ChartsTooltipContainer.js +21 -16
- package/ChartsTooltip/ChartsTooltipTable.d.ts +4 -4
- package/ChartsTooltip/utils.d.ts +6 -0
- package/ChartsTooltip/utils.js +19 -1
- package/LineChart/LineChart.js +2 -3
- package/PieChart/PieChart.js +4 -11
- package/RadarChart/RadarChart.js +2 -3
- package/ScatterChart/ScatterChart.js +2 -3
- package/Toolbar/Toolbar.d.ts +9 -8
- package/Toolbar/Toolbar.js +23 -8
- package/Toolbar/Toolbar.types.d.ts +1 -1
- package/Toolbar/ToolbarButton.js +18 -4
- package/esm/BarChart/BarChart.js +2 -3
- package/esm/BarChart/BarLabel/BarLabel.d.ts +1 -1
- package/esm/BarChart/seriesConfig/seriesProcessor.js +1 -1
- package/esm/ChartsAxisHighlight/ChartsAxisHighlightPath.d.ts +1 -1
- package/esm/ChartsGrid/styledComponents.d.ts +2 -2
- package/esm/ChartsReferenceLine/common.d.ts +1 -1
- package/esm/ChartsTooltip/ChartsTooltip.js +1 -1
- package/esm/ChartsTooltip/ChartsTooltipContainer.js +22 -17
- package/esm/ChartsTooltip/ChartsTooltipTable.d.ts +4 -4
- package/esm/ChartsTooltip/utils.d.ts +6 -0
- package/esm/ChartsTooltip/utils.js +16 -1
- package/esm/LineChart/LineChart.js +2 -3
- package/esm/PieChart/PieChart.js +4 -11
- package/esm/RadarChart/RadarChart.js +2 -3
- package/esm/ScatterChart/ScatterChart.js +2 -3
- package/esm/Toolbar/Toolbar.d.ts +9 -8
- package/esm/Toolbar/Toolbar.js +22 -7
- package/esm/Toolbar/Toolbar.types.d.ts +1 -1
- package/esm/Toolbar/ToolbarButton.js +19 -4
- package/esm/index.js +1 -1
- package/esm/internals/components/AxisSharedComponents.d.ts +1 -1
- package/esm/internals/components/ChartsWrapper/ChartsWrapper.d.ts +5 -0
- package/esm/internals/components/ChartsWrapper/ChartsWrapper.js +22 -3
- package/esm/internals/constants.d.ts +8 -1
- package/esm/internals/constants.js +9 -1
- package/esm/internals/index.d.ts +2 -0
- package/esm/internals/index.js +2 -0
- package/esm/internals/invertScale.d.ts +2 -0
- package/esm/internals/invertScale.js +8 -0
- package/esm/internals/material/index.js +2 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +2917 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +1 -0
- package/esm/locales/index.d.ts +3 -1
- package/esm/locales/index.js +2 -0
- package/esm/locales/ptBR.d.ts +16 -0
- package/esm/locales/ptBR.js +9 -0
- package/esm/locales/ptPT.d.ts +16 -0
- package/esm/locales/ptPT.js +9 -0
- package/esm/models/axis.d.ts +2 -1
- package/esm/models/seriesType/bar.d.ts +2 -2
- package/esm/models/slots/chartsBaseSlotProps.d.ts +6 -0
- package/esm/models/slots/chartsBaseSlots.d.ts +2 -1
- package/index.js +1 -1
- package/internals/components/AxisSharedComponents.d.ts +1 -1
- package/internals/components/ChartsWrapper/ChartsWrapper.d.ts +5 -0
- package/internals/components/ChartsWrapper/ChartsWrapper.js +22 -3
- package/internals/constants.d.ts +8 -1
- package/internals/constants.js +10 -2
- package/internals/index.d.ts +2 -0
- package/internals/index.js +24 -0
- package/internals/invertScale.d.ts +2 -0
- package/internals/invertScale.js +14 -0
- package/internals/material/index.js +2 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +2917 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +2 -1
- package/locales/index.d.ts +3 -1
- package/locales/index.js +22 -0
- package/locales/ptBR.d.ts +16 -0
- package/locales/ptBR.js +15 -0
- package/locales/ptPT.d.ts +16 -0
- package/locales/ptPT.js +15 -0
- package/models/axis.d.ts +2 -1
- package/models/seriesType/bar.d.ts +2 -2
- package/models/slots/chartsBaseSlotProps.d.ts +6 -0
- package/models/slots/chartsBaseSlots.d.ts +2 -1
- package/package.json +5 -5
- package/Toolbar/internals/ChartsToolbar.d.ts +0 -6
- package/Toolbar/internals/ChartsToolbar.js +0 -14
- package/esm/Toolbar/internals/ChartsToolbar.d.ts +0 -6
- package/esm/Toolbar/internals/ChartsToolbar.js +0 -8
|
@@ -1,9 +1,14 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["render"]
|
|
5
|
+
const _excluded = ["render", "onKeyDown", "onFocus", "disabled", "aria-disabled"],
|
|
6
|
+
_excluded2 = ["tabIndex"];
|
|
4
7
|
import PropTypes from 'prop-types';
|
|
5
8
|
import * as React from 'react';
|
|
6
9
|
import { useComponentRenderer } from '@mui/x-internals/useComponentRenderer';
|
|
10
|
+
import useForkRef from '@mui/utils/useForkRef';
|
|
11
|
+
import { useRegisterToolbarButton } from '@mui/x-internals/ToolbarContext';
|
|
7
12
|
import { useChartsSlots } from "../context/ChartsSlotsContext.js";
|
|
8
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
14
|
const ToolbarButton = /*#__PURE__*/React.forwardRef(function ToolbarButton(props, ref) {
|
|
@@ -15,8 +20,17 @@ const ToolbarButton = /*#__PURE__*/React.forwardRef(function ToolbarButton(props
|
|
|
15
20
|
slots,
|
|
16
21
|
slotProps
|
|
17
22
|
} = useChartsSlots();
|
|
18
|
-
const
|
|
19
|
-
|
|
23
|
+
const buttonRef = React.useRef(null);
|
|
24
|
+
const handleRef = useForkRef(buttonRef, ref);
|
|
25
|
+
const _useRegisterToolbarBu = useRegisterToolbarButton(props, buttonRef),
|
|
26
|
+
{
|
|
27
|
+
tabIndex
|
|
28
|
+
} = _useRegisterToolbarBu,
|
|
29
|
+
toolbarButtonProps = _objectWithoutPropertiesLoose(_useRegisterToolbarBu, _excluded2);
|
|
30
|
+
const element = useComponentRenderer(slots.baseIconButton, render, _extends({}, slotProps?.baseIconButton, {
|
|
31
|
+
tabIndex
|
|
32
|
+
}, other, toolbarButtonProps, {
|
|
33
|
+
ref: handleRef
|
|
20
34
|
}));
|
|
21
35
|
return /*#__PURE__*/_jsx(React.Fragment, {
|
|
22
36
|
children: element
|
|
@@ -34,6 +48,7 @@ process.env.NODE_ENV !== "production" ? ToolbarButton.propTypes = {
|
|
|
34
48
|
* A function to customize the rendering of the component.
|
|
35
49
|
*/
|
|
36
50
|
render: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
|
|
37
|
-
style: PropTypes.object
|
|
51
|
+
style: PropTypes.object,
|
|
52
|
+
tabIndex: PropTypes.number
|
|
38
53
|
} : void 0;
|
|
39
54
|
export { ToolbarButton };
|
package/esm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const AxisRoot: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, Pick<import("react").SVGProps<SVGGElement>, keyof import("react").SVGProps<SVGGElement>>, {}>;
|
|
1
|
+
export declare const AxisRoot: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, Pick<import("react").SVGProps<SVGGElement>, keyof import("react").SVGProps<SVGGElement>>, {}>;
|
|
@@ -5,6 +5,11 @@ import { Position } from "../../../models/index.js";
|
|
|
5
5
|
export interface ChartsWrapperProps {
|
|
6
6
|
legendPosition?: Position;
|
|
7
7
|
legendDirection?: Direction;
|
|
8
|
+
/**
|
|
9
|
+
* If `true`, the chart wrapper set `height: 100%`.
|
|
10
|
+
* @default `false` if the `height` prop is set. And `true` otherwise.
|
|
11
|
+
*/
|
|
12
|
+
extendVertically?: boolean;
|
|
8
13
|
children: React.ReactNode;
|
|
9
14
|
sx?: SxProps<Theme>;
|
|
10
15
|
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { styled } from '@mui/material/styles';
|
|
3
|
+
import { shouldForwardProp } from '@mui/system/createStyled';
|
|
3
4
|
import { useChartRootRef } from "../../../hooks/useChartRootRef.js";
|
|
5
|
+
import { useStore } from "../../store/useStore.js";
|
|
6
|
+
import { useSelector } from "../../store/useSelector.js";
|
|
7
|
+
import { selectorChartPropsSize } from "../../plugins/corePlugins/useChartDimensions/index.js";
|
|
4
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
9
|
const getDirection = (direction, position) => {
|
|
6
10
|
if (direction === 'vertical') {
|
|
@@ -35,7 +39,8 @@ const getAlign = (direction, position) => {
|
|
|
35
39
|
};
|
|
36
40
|
const Root = styled('div', {
|
|
37
41
|
name: 'MuiChartsWrapper',
|
|
38
|
-
slot: 'Root'
|
|
42
|
+
slot: 'Root',
|
|
43
|
+
shouldForwardProp: prop => shouldForwardProp(prop) && prop !== 'extendVertically'
|
|
39
44
|
})(({
|
|
40
45
|
ownerState
|
|
41
46
|
}) => ({
|
|
@@ -43,7 +48,15 @@ const Root = styled('div', {
|
|
|
43
48
|
flexDirection: getDirection(ownerState.legendDirection, ownerState.legendPosition),
|
|
44
49
|
flex: 1,
|
|
45
50
|
justifyContent: 'center',
|
|
46
|
-
alignItems: getAlign(ownerState.legendDirection, ownerState.legendPosition)
|
|
51
|
+
alignItems: getAlign(ownerState.legendDirection, ownerState.legendPosition),
|
|
52
|
+
variants: [{
|
|
53
|
+
props: {
|
|
54
|
+
extendVertically: true
|
|
55
|
+
},
|
|
56
|
+
style: {
|
|
57
|
+
height: '100%'
|
|
58
|
+
}
|
|
59
|
+
}]
|
|
47
60
|
}));
|
|
48
61
|
|
|
49
62
|
/**
|
|
@@ -55,13 +68,19 @@ const Root = styled('div', {
|
|
|
55
68
|
function ChartsWrapper(props) {
|
|
56
69
|
const {
|
|
57
70
|
children,
|
|
58
|
-
sx
|
|
71
|
+
sx,
|
|
72
|
+
extendVertically
|
|
59
73
|
} = props;
|
|
60
74
|
const chartRootRef = useChartRootRef();
|
|
75
|
+
const store = useStore();
|
|
76
|
+
const {
|
|
77
|
+
height: propsHeight
|
|
78
|
+
} = useSelector(store, selectorChartPropsSize);
|
|
61
79
|
return /*#__PURE__*/_jsx(Root, {
|
|
62
80
|
ref: chartRootRef,
|
|
63
81
|
ownerState: props,
|
|
64
82
|
sx: sx,
|
|
83
|
+
extendVertically: extendVertically ?? propsHeight === undefined,
|
|
65
84
|
children: children
|
|
66
85
|
});
|
|
67
86
|
}
|
|
@@ -3,4 +3,11 @@ import type { ZoomSliderShowTooltip } from "./plugins/featurePlugins/useChartCar
|
|
|
3
3
|
export declare const ZOOM_SLIDER_MARGIN = 4;
|
|
4
4
|
/** Size reserved for the zoom slider. The actual size of the slider might be smaller. */
|
|
5
5
|
export declare const DEFAULT_ZOOM_SLIDER_SIZE: number;
|
|
6
|
-
export declare const DEFAULT_ZOOM_SLIDER_SHOW_TOOLTIP: ZoomSliderShowTooltip;
|
|
6
|
+
export declare const DEFAULT_ZOOM_SLIDER_SHOW_TOOLTIP: ZoomSliderShowTooltip;
|
|
7
|
+
/** Default margin for pie charts. */
|
|
8
|
+
export declare const DEFAULT_PIE_CHART_MARGIN: {
|
|
9
|
+
top: number;
|
|
10
|
+
bottom: number;
|
|
11
|
+
left: number;
|
|
12
|
+
right: number;
|
|
13
|
+
};
|
|
@@ -3,4 +3,12 @@ export const ZOOM_SLIDER_MARGIN = 4;
|
|
|
3
3
|
|
|
4
4
|
/** Size reserved for the zoom slider. The actual size of the slider might be smaller. */
|
|
5
5
|
export const DEFAULT_ZOOM_SLIDER_SIZE = 20 + 2 * ZOOM_SLIDER_MARGIN;
|
|
6
|
-
export const DEFAULT_ZOOM_SLIDER_SHOW_TOOLTIP = 'hover';
|
|
6
|
+
export const DEFAULT_ZOOM_SLIDER_SHOW_TOOLTIP = 'hover';
|
|
7
|
+
|
|
8
|
+
/** Default margin for pie charts. */
|
|
9
|
+
export const DEFAULT_PIE_CHART_MARGIN = {
|
|
10
|
+
top: 5,
|
|
11
|
+
bottom: 5,
|
|
12
|
+
left: 5,
|
|
13
|
+
right: 5
|
|
14
|
+
};
|
package/esm/internals/index.d.ts
CHANGED
|
@@ -28,6 +28,7 @@ export * from "../BarChart/BarChart.plugins.js";
|
|
|
28
28
|
export * from "../LineChart/LineChart.plugins.js";
|
|
29
29
|
export * from "../ScatterChart/ScatterChart.plugins.js";
|
|
30
30
|
export * from "../RadarChart/RadarChart.plugins.js";
|
|
31
|
+
export * from "../PieChart/PieChart.plugins.js";
|
|
31
32
|
export * from "./defaultizeValueFormatter.js";
|
|
32
33
|
export * from "./configInit.js";
|
|
33
34
|
export * from "./getLabel.js";
|
|
@@ -40,6 +41,7 @@ export * from "./consumeSlots.js";
|
|
|
40
41
|
export * from "./consumeThemeProps.js";
|
|
41
42
|
export * from "./defaultizeMargin.js";
|
|
42
43
|
export * from "./dateHelpers.js";
|
|
44
|
+
export * from "./invertScale.js";
|
|
43
45
|
export { getAxisExtremum } from "./plugins/featurePlugins/useChartCartesianAxis/getAxisExtremum.js";
|
|
44
46
|
export * from "../context/ChartProvider/index.js";
|
|
45
47
|
export * from "../context/ChartsSlotsContext.js";
|
package/esm/internals/index.js
CHANGED
|
@@ -36,6 +36,7 @@ export * from "../BarChart/BarChart.plugins.js";
|
|
|
36
36
|
export * from "../LineChart/LineChart.plugins.js";
|
|
37
37
|
export * from "../ScatterChart/ScatterChart.plugins.js";
|
|
38
38
|
export * from "../RadarChart/RadarChart.plugins.js";
|
|
39
|
+
export * from "../PieChart/PieChart.plugins.js";
|
|
39
40
|
|
|
40
41
|
// utils
|
|
41
42
|
export * from "./defaultizeValueFormatter.js";
|
|
@@ -50,6 +51,7 @@ export * from "./consumeSlots.js";
|
|
|
50
51
|
export * from "./consumeThemeProps.js";
|
|
51
52
|
export * from "./defaultizeMargin.js";
|
|
52
53
|
export * from "./dateHelpers.js";
|
|
54
|
+
export * from "./invertScale.js";
|
|
53
55
|
|
|
54
56
|
// contexts
|
|
55
57
|
export { getAxisExtremum } from "./plugins/featurePlugins/useChartCartesianAxis/getAxisExtremum.js";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { isBandScale } from "./isBandScale.js";
|
|
2
|
+
export function invertScale(scale, data, value) {
|
|
3
|
+
if (isBandScale(scale)) {
|
|
4
|
+
const dataIndex = scale.bandwidth() === 0 ? Math.floor((value - Math.min(...scale.range()) + scale.step() / 2) / scale.step()) : Math.floor((value - Math.min(...scale.range())) / scale.step());
|
|
5
|
+
return data[dataIndex];
|
|
6
|
+
}
|
|
7
|
+
return scale.invert(value);
|
|
8
|
+
}
|