@mui/x-charts 8.5.0 → 8.5.2
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 +204 -0
- package/ChartsAxisHighlight/ChartsAxisHighlightPath.d.ts +1 -1
- package/ChartsGrid/ChartsHorizontalGrid.js +1 -1
- package/ChartsGrid/ChartsVerticalGrid.js +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/RadarChart/index.d.ts +1 -1
- package/ScatterChart/ScatterChart.js +2 -3
- package/Toolbar/Toolbar.d.ts +9 -8
- package/Toolbar/Toolbar.js +24 -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/ChartsHorizontalGrid.js +1 -1
- package/esm/ChartsGrid/ChartsVerticalGrid.js +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/RadarChart/index.d.ts +1 -1
- package/esm/ScatterChart/ScatterChart.js +2 -3
- package/esm/Toolbar/Toolbar.d.ts +9 -8
- package/esm/Toolbar/Toolbar.js +23 -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/defaultValueFormatters.d.ts +6 -0
- package/esm/internals/defaultValueFormatters.js +15 -0
- package/esm/internals/index.d.ts +7 -0
- package/esm/internals/index.js +7 -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/computeAxisValue.js +3 -1
- 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/internals/plugins/models/seriesConfig/colorProcessor.types.d.ts +5 -0
- package/esm/internals/plugins/models/seriesConfig/tooltipGetter.types.d.ts +3 -2
- package/esm/internals/store/useSelector.js +3 -1
- 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 +3 -1
- package/esm/models/index.d.ts +1 -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/defaultValueFormatters.d.ts +6 -0
- package/internals/defaultValueFormatters.js +21 -0
- package/internals/index.d.ts +7 -0
- package/internals/index.js +76 -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/computeAxisValue.js +3 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +2917 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +2 -1
- package/internals/plugins/models/seriesConfig/colorProcessor.types.d.ts +5 -0
- package/internals/plugins/models/seriesConfig/tooltipGetter.types.d.ts +3 -2
- package/internals/store/useSelector.js +4 -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 +3 -1
- package/models/index.d.ts +1 -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
package/RadarChart/RadarChart.js
CHANGED
|
@@ -11,7 +11,6 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
11
11
|
var React = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
13
|
var _styles = require("@mui/material/styles");
|
|
14
|
-
var _ChartsToolbar = require("../Toolbar/internals/ChartsToolbar");
|
|
15
14
|
var _ChartsLegend = require("../ChartsLegend");
|
|
16
15
|
var _ChartsOverlay = require("../ChartsOverlay/ChartsOverlay");
|
|
17
16
|
var _useRadarChartProps = require("./useRadarChartProps");
|
|
@@ -49,10 +48,10 @@ const RadarChart = exports.RadarChart = /*#__PURE__*/React.forwardRef(function R
|
|
|
49
48
|
children
|
|
50
49
|
} = (0, _useRadarChartProps.useRadarChartProps)(props);
|
|
51
50
|
const Tooltip = props.slots?.tooltip ?? _ChartsTooltip.ChartsTooltip;
|
|
52
|
-
const Toolbar = props.slots?.toolbar
|
|
51
|
+
const Toolbar = props.slots?.toolbar;
|
|
53
52
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_RadarDataProvider.RadarDataProvider, (0, _extends2.default)({}, radarDataProviderProps, {
|
|
54
53
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsWrapper.ChartsWrapper, (0, _extends2.default)({}, chartsWrapperProps, {
|
|
55
|
-
children: [props.showToolbar ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Toolbar, {}) : null, !props.hideLegend && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legendProps)), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsSurface.ChartsSurface, (0, _extends2.default)({}, chartsSurfaceProps, {
|
|
54
|
+
children: [props.showToolbar && Toolbar ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Toolbar, (0, _extends2.default)({}, props.slotProps?.toolbar)) : null, !props.hideLegend && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legendProps)), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsSurface.ChartsSurface, (0, _extends2.default)({}, chartsSurfaceProps, {
|
|
56
55
|
ref: ref,
|
|
57
56
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_RadarGrid.RadarGrid, (0, _extends2.default)({}, radarGrid)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_RadarMetricLabels.RadarMetricLabels, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_RadarSeriesPlot.RadarSeriesArea, {}), highlight === 'axis' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_RadarAxisHighlight.RadarAxisHighlight, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_RadarSeriesPlot.RadarSeriesMarks, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOverlay.ChartsOverlay, (0, _extends2.default)({}, overlayProps)), children]
|
|
58
57
|
})), !props.loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(Tooltip, (0, _extends2.default)({}, props.slotProps?.tooltip))]
|
package/RadarChart/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { RadarChart as Unstable_RadarChart } from "./RadarChart.js";
|
|
|
2
2
|
export { RadarChart } from "./RadarChart.js";
|
|
3
3
|
export { RadarDataProvider as Unstable_RadarDataProvider } from "./RadarDataProvider/index.js";
|
|
4
4
|
export { RadarDataProvider } from "./RadarDataProvider/index.js";
|
|
5
|
-
export type { RadarChartProps } from "./RadarChart.js";
|
|
5
|
+
export type { RadarChartProps, RadarChartSlots, RadarChartSlotProps } from "./RadarChart.js";
|
|
6
6
|
export type { RadarDataProviderProps } from "./RadarDataProvider/index.js";
|
|
7
7
|
export * from "./RadarGrid/index.js";
|
|
8
8
|
export * from "./RadarAxisHighlight/index.js";
|
|
@@ -23,7 +23,6 @@ var _useChartContainerProps = require("../ChartContainer/useChartContainerProps"
|
|
|
23
23
|
var _ChartDataProvider = require("../ChartDataProvider");
|
|
24
24
|
var _ChartsSurface = require("../ChartsSurface");
|
|
25
25
|
var _ChartsWrapper = require("../internals/components/ChartsWrapper");
|
|
26
|
-
var _ChartsToolbar = require("../Toolbar/internals/ChartsToolbar");
|
|
27
26
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
28
27
|
/**
|
|
29
28
|
* Demos:
|
|
@@ -56,10 +55,10 @@ const ScatterChart = exports.ScatterChart = /*#__PURE__*/React.forwardRef(functi
|
|
|
56
55
|
chartsSurfaceProps
|
|
57
56
|
} = (0, _useChartContainerProps.useChartContainerProps)(chartContainerProps, ref);
|
|
58
57
|
const Tooltip = props.slots?.tooltip ?? _ChartsTooltip.ChartsTooltip;
|
|
59
|
-
const Toolbar = props.slots?.toolbar
|
|
58
|
+
const Toolbar = props.slots?.toolbar;
|
|
60
59
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartDataProvider.ChartDataProvider, (0, _extends2.default)({}, chartDataProviderProps, {
|
|
61
60
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsWrapper.ChartsWrapper, (0, _extends2.default)({}, chartsWrapperProps, {
|
|
62
|
-
children: [props.showToolbar ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Toolbar, {}) : null, !props.hideLegend && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legendProps)), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsSurface.ChartsSurface, (0, _extends2.default)({}, chartsSurfaceProps, {
|
|
61
|
+
children: [props.showToolbar && Toolbar ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Toolbar, (0, _extends2.default)({}, props.slotProps?.toolbar)) : null, !props.hideLegend && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legendProps)), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsSurface.ChartsSurface, (0, _extends2.default)({}, chartsSurfaceProps, {
|
|
63
62
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxis.ChartsAxis, (0, _extends2.default)({}, chartsAxisProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsGrid.ChartsGrid, (0, _extends2.default)({}, gridProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
|
|
64
63
|
"data-drawing-container": true,
|
|
65
64
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScatterPlot.ScatterPlot, (0, _extends2.default)({}, scatterPlotProps))
|
package/Toolbar/Toolbar.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
|
|
2
|
+
import { RenderProp } from '@mui/x-internals/useComponentRenderer';
|
|
3
|
+
declare const ToolbarRoot: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.ClassAttributes<HTMLDivElement> | keyof React.HTMLAttributes<HTMLDivElement>>, {}>;
|
|
4
|
+
export interface ToolbarProps extends React.ComponentProps<'div'> {
|
|
3
5
|
className?: string;
|
|
6
|
+
/**
|
|
7
|
+
* A function to customize rendering of the component.
|
|
8
|
+
*/
|
|
9
|
+
render?: RenderProp<React.ComponentProps<typeof ToolbarRoot>>;
|
|
4
10
|
}
|
|
5
|
-
export declare
|
|
6
|
-
|
|
7
|
-
...other
|
|
8
|
-
}: ChartsToolbarProps): React.JSX.Element;
|
|
9
|
-
export declare namespace Toolbar {
|
|
10
|
-
var propTypes: any;
|
|
11
|
-
}
|
|
11
|
+
export declare const Toolbar: React.ForwardRefExoticComponent<Omit<ToolbarProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
12
|
+
export {};
|
package/Toolbar/Toolbar.js
CHANGED
|
@@ -5,16 +5,18 @@ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWild
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.Toolbar =
|
|
8
|
+
exports.Toolbar = void 0;
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
11
11
|
var React = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
13
|
var _styles = require("@mui/material/styles");
|
|
14
14
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
15
|
+
var _useComponentRenderer = require("@mui/x-internals/useComponentRenderer");
|
|
16
|
+
var _ToolbarContext = require("@mui/x-internals/ToolbarContext");
|
|
15
17
|
var _chartToolbarClasses = require("./chartToolbarClasses");
|
|
16
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
-
const _excluded = ["className"];
|
|
19
|
+
const _excluded = ["className", "render"];
|
|
18
20
|
const ToolbarRoot = (0, _styles.styled)('div', {
|
|
19
21
|
name: 'MuiChartsToolbar',
|
|
20
22
|
slot: 'Root'
|
|
@@ -27,24 +29,38 @@ const ToolbarRoot = (0, _styles.styled)('div', {
|
|
|
27
29
|
justifyContent: 'end',
|
|
28
30
|
gap: theme.spacing(0.25),
|
|
29
31
|
padding: theme.spacing(0.5),
|
|
32
|
+
marginBottom: theme.spacing(1.5),
|
|
30
33
|
minHeight: 44,
|
|
31
34
|
boxSizing: 'border-box',
|
|
32
35
|
border: `1px solid ${(theme.vars || theme).palette.divider}`,
|
|
33
36
|
borderRadius: 4
|
|
34
37
|
}));
|
|
35
|
-
function Toolbar(_ref) {
|
|
38
|
+
const Toolbar = exports.Toolbar = /*#__PURE__*/React.forwardRef(function Toolbar(_ref, ref) {
|
|
36
39
|
let {
|
|
37
|
-
className
|
|
40
|
+
className,
|
|
41
|
+
render
|
|
38
42
|
} = _ref,
|
|
39
43
|
other = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
|
|
40
|
-
|
|
44
|
+
const element = (0, _useComponentRenderer.useComponentRenderer)(ToolbarRoot, render, (0, _extends2.default)({
|
|
45
|
+
role: 'toolbar',
|
|
46
|
+
'aria-orientation': 'horizontal',
|
|
41
47
|
className: (0, _clsx.default)(_chartToolbarClasses.chartsToolbarClasses.root, className)
|
|
42
|
-
}, other
|
|
43
|
-
|
|
48
|
+
}, other, {
|
|
49
|
+
ref
|
|
50
|
+
}));
|
|
51
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ToolbarContext.ToolbarContextProvider, {
|
|
52
|
+
children: element
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
if (process.env.NODE_ENV !== "production") Toolbar.displayName = "Toolbar";
|
|
44
56
|
process.env.NODE_ENV !== "production" ? Toolbar.propTypes = {
|
|
45
57
|
// ----------------------------- Warning --------------------------------
|
|
46
58
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
47
59
|
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
48
60
|
// ----------------------------------------------------------------------
|
|
49
|
-
className: _propTypes.default.string
|
|
61
|
+
className: _propTypes.default.string,
|
|
62
|
+
/**
|
|
63
|
+
* A function to customize rendering of the component.
|
|
64
|
+
*/
|
|
65
|
+
render: _propTypes.default.oneOfType([_propTypes.default.element, _propTypes.default.func])
|
|
50
66
|
} : void 0;
|
package/Toolbar/ToolbarButton.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
'use client';
|
|
2
3
|
|
|
3
4
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
5
|
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
@@ -11,9 +12,12 @@ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runt
|
|
|
11
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
13
|
var React = _interopRequireWildcard(require("react"));
|
|
13
14
|
var _useComponentRenderer = require("@mui/x-internals/useComponentRenderer");
|
|
15
|
+
var _useForkRef = _interopRequireDefault(require("@mui/utils/useForkRef"));
|
|
16
|
+
var _ToolbarContext = require("@mui/x-internals/ToolbarContext");
|
|
14
17
|
var _ChartsSlotsContext = require("../context/ChartsSlotsContext");
|
|
15
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
-
const _excluded = ["render"]
|
|
19
|
+
const _excluded = ["render", "onKeyDown", "onFocus", "disabled", "aria-disabled"],
|
|
20
|
+
_excluded2 = ["tabIndex"];
|
|
17
21
|
const ToolbarButton = exports.ToolbarButton = /*#__PURE__*/React.forwardRef(function ToolbarButton(props, ref) {
|
|
18
22
|
const {
|
|
19
23
|
render
|
|
@@ -23,8 +27,17 @@ const ToolbarButton = exports.ToolbarButton = /*#__PURE__*/React.forwardRef(func
|
|
|
23
27
|
slots,
|
|
24
28
|
slotProps
|
|
25
29
|
} = (0, _ChartsSlotsContext.useChartsSlots)();
|
|
26
|
-
const
|
|
27
|
-
|
|
30
|
+
const buttonRef = React.useRef(null);
|
|
31
|
+
const handleRef = (0, _useForkRef.default)(buttonRef, ref);
|
|
32
|
+
const _useRegisterToolbarBu = (0, _ToolbarContext.useRegisterToolbarButton)(props, buttonRef),
|
|
33
|
+
{
|
|
34
|
+
tabIndex
|
|
35
|
+
} = _useRegisterToolbarBu,
|
|
36
|
+
toolbarButtonProps = (0, _objectWithoutPropertiesLoose2.default)(_useRegisterToolbarBu, _excluded2);
|
|
37
|
+
const element = (0, _useComponentRenderer.useComponentRenderer)(slots.baseIconButton, render, (0, _extends2.default)({}, slotProps?.baseIconButton, {
|
|
38
|
+
tabIndex
|
|
39
|
+
}, other, toolbarButtonProps, {
|
|
40
|
+
ref: handleRef
|
|
28
41
|
}));
|
|
29
42
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(React.Fragment, {
|
|
30
43
|
children: element
|
|
@@ -42,5 +55,6 @@ process.env.NODE_ENV !== "production" ? ToolbarButton.propTypes = {
|
|
|
42
55
|
* A function to customize the rendering of the component.
|
|
43
56
|
*/
|
|
44
57
|
render: _propTypes.default.oneOfType([_propTypes.default.element, _propTypes.default.func]),
|
|
45
|
-
style: _propTypes.default.object
|
|
58
|
+
style: _propTypes.default.object,
|
|
59
|
+
tabIndex: _propTypes.default.number
|
|
46
60
|
} : void 0;
|
package/esm/BarChart/BarChart.js
CHANGED
|
@@ -17,7 +17,6 @@ import { ChartDataProvider } from "../ChartDataProvider/index.js";
|
|
|
17
17
|
import { ChartsSurface } from "../ChartsSurface/index.js";
|
|
18
18
|
import { useChartContainerProps } from "../ChartContainer/useChartContainerProps.js";
|
|
19
19
|
import { ChartsWrapper } from "../internals/components/ChartsWrapper/index.js";
|
|
20
|
-
import { ChartsToolbar } from "../Toolbar/internals/ChartsToolbar.js";
|
|
21
20
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
21
|
/**
|
|
23
22
|
* Demos:
|
|
@@ -53,10 +52,10 @@ const BarChart = /*#__PURE__*/React.forwardRef(function BarChart(inProps, ref) {
|
|
|
53
52
|
chartsSurfaceProps
|
|
54
53
|
} = useChartContainerProps(chartContainerProps, ref);
|
|
55
54
|
const Tooltip = props.slots?.tooltip ?? ChartsTooltip;
|
|
56
|
-
const Toolbar = props.slots?.toolbar
|
|
55
|
+
const Toolbar = props.slots?.toolbar;
|
|
57
56
|
return /*#__PURE__*/_jsx(ChartDataProvider, _extends({}, chartDataProviderProps, {
|
|
58
57
|
children: /*#__PURE__*/_jsxs(ChartsWrapper, _extends({}, chartsWrapperProps, {
|
|
59
|
-
children: [props.showToolbar ? /*#__PURE__*/_jsx(Toolbar, {}) : null, !props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsxs(ChartsSurface, _extends({}, chartsSurfaceProps, {
|
|
58
|
+
children: [props.showToolbar && Toolbar ? /*#__PURE__*/_jsx(Toolbar, _extends({}, props.slotProps?.toolbar)) : null, !props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsxs(ChartsSurface, _extends({}, chartsSurfaceProps, {
|
|
60
59
|
children: [/*#__PURE__*/_jsx(ChartsGrid, _extends({}, gridProps)), /*#__PURE__*/_jsxs("g", _extends({}, clipPathGroupProps, {
|
|
61
60
|
children: [/*#__PURE__*/_jsx(BarPlot, _extends({}, barPlotProps)), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlightProps))]
|
|
62
61
|
})), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), /*#__PURE__*/_jsx(ChartsClipPath, _extends({}, clipPathProps)), children]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { BarLabelOwnerState } from "./BarLabel.types.js";
|
|
3
|
-
export declare const BarLabelComponent: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, Pick<React.SVGTextElementAttributes<SVGTextElement>, keyof React.SVGTextElementAttributes<SVGTextElement>>, {}>;
|
|
3
|
+
export declare const BarLabelComponent: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, Pick<React.SVGTextElementAttributes<SVGTextElement>, keyof React.SVGTextElementAttributes<SVGTextElement>>, {}>;
|
|
4
4
|
export type BarLabelProps = Omit<React.SVGProps<SVGTextElement>, 'ref' | 'id' | 'x' | 'y' | 'width' | 'height'> & BarLabelOwnerState & {
|
|
5
5
|
/**
|
|
6
6
|
* The x-coordinate of the stack this bar label belongs to.
|
|
@@ -56,7 +56,7 @@ const seriesProcessor = (params, dataset) => {
|
|
|
56
56
|
warnOnce([`MUI X Charts: your dataset key "${dataKey}" is used for plotting bars, but contains nonnumerical elements.`, 'Bar plots only support numbers and null values.']);
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
-
return
|
|
59
|
+
return null;
|
|
60
60
|
}
|
|
61
61
|
return value;
|
|
62
62
|
}) : series[id].data,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ChartsAxisHighlightType } from "./ChartsAxisHighlight.types.js";
|
|
2
|
-
export declare const ChartsAxisHighlightPath: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
2
|
+
export declare const ChartsAxisHighlightPath: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
|
|
3
3
|
ownerState: {
|
|
4
4
|
axisHighlight: ChartsAxisHighlightType;
|
|
5
5
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const GridRoot: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, Pick<import("react").SVGProps<SVGGElement>, keyof import("react").SVGProps<SVGGElement>>, {}>;
|
|
2
|
-
export declare const GridLine: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, Pick<import("react").SVGLineElementAttributes<SVGLineElement>, keyof import("react").SVGLineElementAttributes<SVGLineElement>>, {}>;
|
|
1
|
+
export declare const GridRoot: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, Pick<import("react").SVGProps<SVGGElement>, keyof import("react").SVGProps<SVGGElement>>, {}>;
|
|
2
|
+
export declare const GridLine: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, Pick<import("react").SVGLineElementAttributes<SVGLineElement>, keyof import("react").SVGLineElementAttributes<SVGLineElement>>, {}>;
|
|
@@ -38,4 +38,4 @@ export type CommonChartsReferenceLineProps = {
|
|
|
38
38
|
*/
|
|
39
39
|
classes?: Partial<ChartsReferenceLineClasses>;
|
|
40
40
|
};
|
|
41
|
-
export declare const ReferenceLineRoot: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").SVGProps<SVGGElement>, {}>;
|
|
41
|
+
export declare const ReferenceLineRoot: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").SVGProps<SVGGElement>, {}>;
|
|
@@ -25,7 +25,7 @@ function ChartsTooltip(props) {
|
|
|
25
25
|
} = props;
|
|
26
26
|
const classes = useUtilityClasses(propClasses);
|
|
27
27
|
return /*#__PURE__*/_jsx(ChartsTooltipContainer, _extends({}, props, {
|
|
28
|
-
classes:
|
|
28
|
+
classes: propClasses,
|
|
29
29
|
children: trigger === 'axis' ? /*#__PURE__*/_jsx(ChartsAxisTooltipContent, {
|
|
30
30
|
classes: classes
|
|
31
31
|
}) : /*#__PURE__*/_jsx(ChartsItemTooltipContent, {
|
|
@@ -11,7 +11,8 @@ import { styled, useThemeProps } from '@mui/material/styles';
|
|
|
11
11
|
import Popper from '@mui/material/Popper';
|
|
12
12
|
import NoSsr from '@mui/material/NoSsr';
|
|
13
13
|
import { useSvgRef } from "../hooks/useSvgRef.js";
|
|
14
|
-
import { usePointerType } from "./utils.js";
|
|
14
|
+
import { useIsFineMainPointer, usePointerType } from "./utils.js";
|
|
15
|
+
import { useUtilityClasses } from "./chartsTooltipClasses.js";
|
|
15
16
|
import { useSelector } from "../internals/store/useSelector.js";
|
|
16
17
|
import { useStore } from "../internals/store/useStore.js";
|
|
17
18
|
import { selectorChartsInteractionItemIsDefined } from "../internals/plugins/featurePlugins/useChartInteraction/index.js";
|
|
@@ -46,12 +47,14 @@ function ChartsTooltipContainer(inProps) {
|
|
|
46
47
|
});
|
|
47
48
|
const {
|
|
48
49
|
trigger = 'axis',
|
|
49
|
-
classes,
|
|
50
|
+
classes: propClasses,
|
|
50
51
|
children
|
|
51
52
|
} = props,
|
|
52
53
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
54
|
+
const classes = useUtilityClasses(propClasses);
|
|
53
55
|
const svgRef = useSvgRef();
|
|
54
56
|
const pointerType = usePointerType();
|
|
57
|
+
const isFineMainPointer = useIsFineMainPointer();
|
|
55
58
|
const popperRef = React.useRef(null);
|
|
56
59
|
const positionRef = useLazyRef(() => ({
|
|
57
60
|
x: 0,
|
|
@@ -60,14 +63,12 @@ function ChartsTooltipContainer(inProps) {
|
|
|
60
63
|
const axisSystem = useAxisSystem();
|
|
61
64
|
const store = useStore();
|
|
62
65
|
const isOpen = useSelector(store, trigger === 'axis' ? axisSystem === 'polar' && selectorChartsInteractionPolarAxisTooltip || axisSystem === 'cartesian' && selectorChartsInteractionAxisTooltip || noAxis : selectorChartsInteractionItemIsDefined);
|
|
63
|
-
const popperOpen = pointerType !== null && isOpen; // tooltipHasData;
|
|
64
|
-
|
|
65
66
|
React.useEffect(() => {
|
|
66
67
|
const element = svgRef.current;
|
|
67
68
|
if (element === null) {
|
|
68
69
|
return () => {};
|
|
69
70
|
}
|
|
70
|
-
const
|
|
71
|
+
const handlePointerEvent = event => {
|
|
71
72
|
// eslint-disable-next-line react-compiler/react-compiler
|
|
72
73
|
positionRef.current = {
|
|
73
74
|
x: event.clientX,
|
|
@@ -75,9 +76,11 @@ function ChartsTooltipContainer(inProps) {
|
|
|
75
76
|
};
|
|
76
77
|
popperRef.current?.update();
|
|
77
78
|
};
|
|
78
|
-
element.addEventListener('
|
|
79
|
+
element.addEventListener('pointerdown', handlePointerEvent);
|
|
80
|
+
element.addEventListener('pointermove', handlePointerEvent);
|
|
79
81
|
return () => {
|
|
80
|
-
element.removeEventListener('
|
|
82
|
+
element.removeEventListener('pointerdown', handlePointerEvent);
|
|
83
|
+
element.removeEventListener('pointermove', handlePointerEvent);
|
|
81
84
|
};
|
|
82
85
|
}, [svgRef, positionRef]);
|
|
83
86
|
const anchorEl = React.useMemo(() => ({
|
|
@@ -93,32 +96,34 @@ function ChartsTooltipContainer(inProps) {
|
|
|
93
96
|
toJSON: () => ''
|
|
94
97
|
})
|
|
95
98
|
}), [positionRef]);
|
|
99
|
+
const isMouse = pointerType?.pointerType === 'mouse' || isFineMainPointer;
|
|
100
|
+
const isTouch = pointerType?.pointerType === 'touch' || !isFineMainPointer;
|
|
96
101
|
const modifiers = React.useMemo(() => [{
|
|
97
102
|
name: 'offset',
|
|
98
103
|
options: {
|
|
99
104
|
offset: () => {
|
|
100
|
-
if (
|
|
101
|
-
|
|
102
|
-
return [0, 8];
|
|
105
|
+
if (isTouch) {
|
|
106
|
+
return [0, 64];
|
|
103
107
|
}
|
|
104
|
-
|
|
108
|
+
// The popper offset: [skidding, distance]
|
|
109
|
+
return [0, 8];
|
|
105
110
|
}
|
|
106
111
|
}
|
|
107
|
-
}, ...(
|
|
108
|
-
: [{
|
|
112
|
+
}, ...(!isMouse ? [{
|
|
109
113
|
name: 'flip',
|
|
110
114
|
options: {
|
|
111
115
|
fallbackPlacements: ['top-end', 'top-start', 'bottom-end', 'bottom']
|
|
112
116
|
}
|
|
113
|
-
}]
|
|
117
|
+
}] : []) // Keep default behavior
|
|
118
|
+
], [isMouse, isTouch]);
|
|
114
119
|
if (trigger === 'none') {
|
|
115
120
|
return null;
|
|
116
121
|
}
|
|
117
122
|
return /*#__PURE__*/_jsx(NoSsr, {
|
|
118
|
-
children:
|
|
123
|
+
children: isOpen && /*#__PURE__*/_jsx(ChartsTooltipRoot, _extends({
|
|
119
124
|
className: classes?.root,
|
|
120
|
-
open:
|
|
121
|
-
placement:
|
|
125
|
+
open: isOpen,
|
|
126
|
+
placement: isMouse ? 'right-start' : 'top',
|
|
122
127
|
popperRef: popperRef,
|
|
123
128
|
anchorEl: anchorEl,
|
|
124
129
|
modifiers: modifiers
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @ignore - internal component.
|
|
3
3
|
*/
|
|
4
|
-
export declare const ChartsTooltipPaper: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import("react").ClassAttributes<HTMLDivElement> | keyof import("react").HTMLAttributes<HTMLDivElement>>, {}>;
|
|
4
|
+
export declare const ChartsTooltipPaper: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import("react").ClassAttributes<HTMLDivElement> | keyof import("react").HTMLAttributes<HTMLDivElement>>, {}>;
|
|
5
5
|
/**
|
|
6
6
|
* @ignore - internal component.
|
|
7
7
|
*/
|
|
8
|
-
export declare const ChartsTooltipTable: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, Pick<import("react").DetailedHTMLProps<import("react").TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>, keyof import("react").ClassAttributes<HTMLTableElement> | keyof import("react").TableHTMLAttributes<HTMLTableElement>>, {}>;
|
|
8
|
+
export declare const ChartsTooltipTable: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, Pick<import("react").DetailedHTMLProps<import("react").TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>, keyof import("react").ClassAttributes<HTMLTableElement> | keyof import("react").TableHTMLAttributes<HTMLTableElement>>, {}>;
|
|
9
9
|
/**
|
|
10
10
|
* @ignore - internal component.
|
|
11
11
|
*/
|
|
12
|
-
export declare const ChartsTooltipRow: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>, keyof import("react").ClassAttributes<HTMLTableRowElement> | keyof import("react").HTMLAttributes<HTMLTableRowElement>>, {}>;
|
|
12
|
+
export declare const ChartsTooltipRow: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>, keyof import("react").ClassAttributes<HTMLTableRowElement> | keyof import("react").HTMLAttributes<HTMLTableRowElement>>, {}>;
|
|
13
13
|
/**
|
|
14
14
|
* @ignore - internal component.
|
|
15
15
|
*/
|
|
16
|
-
export declare const ChartsTooltipCell: import("@emotion/styled").StyledComponent<Pick<import("@mui/material").TypographyOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "p" | "style" | "typography" | "zIndex" | "classes" | "border" | "boxShadow" | "fontWeight" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "color" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "marginBlock" | "marginInline" | "overflow" | "padding" | "paddingBlock" | "paddingInline" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "displayPrint" | "className" | "children" | "sx" | "align" | "
|
|
16
|
+
export declare const ChartsTooltipCell: import("@emotion/styled").StyledComponent<Pick<import("@mui/material/Typography").TypographyOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "p" | "style" | "typography" | "zIndex" | "classes" | "border" | "boxShadow" | "fontWeight" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "color" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "marginBlock" | "marginInline" | "overflow" | "padding" | "paddingBlock" | "paddingInline" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "displayPrint" | "className" | "children" | "sx" | "align" | "variant" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping">, "p" | "slot" | "style" | "title" | "ref" | "typography" | "zIndex" | "classes" | "border" | "boxShadow" | "fontWeight" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "color" | "columnGap" | "content" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "translate" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "marginBlock" | "marginInline" | "overflow" | "padding" | "paddingBlock" | "paddingInline" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "displayPrint" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoCapitalize" | "autoFocus" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "enterKeyHint" | "hidden" | "id" | "lang" | "nonce" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "popover" | "popoverTargetAction" | "popoverTarget" | "inert" | "inputMode" | "is" | "exportparts" | "part" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onScrollEnd" | "onScrollEndCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onToggle" | "onBeforeToggle" | "onTransitionCancel" | "onTransitionCancelCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "onTransitionRun" | "onTransitionRunCapture" | "onTransitionStart" | "onTransitionStartCapture" | "sx" | "align" | "variant" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
|
|
17
17
|
component?: React.ElementType;
|
|
18
18
|
}, {}, {}>;
|
|
@@ -13,4 +13,10 @@ type PointerType = Pick<MousePosition, 'pointerType'>;
|
|
|
13
13
|
export declare function usePointerType(): null | PointerType;
|
|
14
14
|
export type TriggerOptions = 'item' | 'axis' | 'none';
|
|
15
15
|
export declare function utcFormatter(v: string | number | Date): string;
|
|
16
|
+
/**
|
|
17
|
+
* Returns true if the main pointer is fine (e.g. mouse).
|
|
18
|
+
* This is useful for determining how to position tooltips or other UI elements based on the type of input device.
|
|
19
|
+
* @returns true if the main pointer is fine, false otherwise.
|
|
20
|
+
*/
|
|
21
|
+
export declare const useIsFineMainPointer: () => boolean;
|
|
16
22
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
|
+
import useMediaQuery from '@mui/material/useMediaQuery';
|
|
4
5
|
import { useSvgRef } from "../hooks/index.js";
|
|
5
6
|
/**
|
|
6
7
|
* @deprecated We recommend using vanilla JS to let popper track mouse position.
|
|
@@ -80,4 +81,18 @@ export function utcFormatter(v) {
|
|
|
80
81
|
return v.toUTCString();
|
|
81
82
|
}
|
|
82
83
|
return v.toLocaleString();
|
|
83
|
-
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Taken from @mui/x-date-time-pickers
|
|
87
|
+
const mainPointerFineMediaQuery = '@media (pointer: fine)';
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Returns true if the main pointer is fine (e.g. mouse).
|
|
91
|
+
* This is useful for determining how to position tooltips or other UI elements based on the type of input device.
|
|
92
|
+
* @returns true if the main pointer is fine, false otherwise.
|
|
93
|
+
*/
|
|
94
|
+
export const useIsFineMainPointer = () => {
|
|
95
|
+
return useMediaQuery(mainPointerFineMediaQuery, {
|
|
96
|
+
defaultMatches: true
|
|
97
|
+
});
|
|
98
|
+
};
|
|
@@ -4,7 +4,6 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { useThemeProps } from '@mui/material/styles';
|
|
7
|
-
import { ChartsToolbar } from "../Toolbar/internals/ChartsToolbar.js";
|
|
8
7
|
import { AreaPlot } from "./AreaPlot.js";
|
|
9
8
|
import { LinePlot } from "./LinePlot.js";
|
|
10
9
|
import { MarkPlot } from "./MarkPlot.js";
|
|
@@ -58,10 +57,10 @@ const LineChart = /*#__PURE__*/React.forwardRef(function LineChart(inProps, ref)
|
|
|
58
57
|
chartsSurfaceProps
|
|
59
58
|
} = useChartContainerProps(chartContainerProps, ref);
|
|
60
59
|
const Tooltip = props.slots?.tooltip ?? ChartsTooltip;
|
|
61
|
-
const Toolbar = props.slots?.toolbar
|
|
60
|
+
const Toolbar = props.slots?.toolbar;
|
|
62
61
|
return /*#__PURE__*/_jsx(ChartDataProvider, _extends({}, chartDataProviderProps, {
|
|
63
62
|
children: /*#__PURE__*/_jsxs(ChartsWrapper, _extends({}, chartsWrapperProps, {
|
|
64
|
-
children: [props.showToolbar ? /*#__PURE__*/_jsx(Toolbar, {}) : null, !props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsxs(ChartsSurface, _extends({}, chartsSurfaceProps, {
|
|
63
|
+
children: [props.showToolbar && Toolbar ? /*#__PURE__*/_jsx(Toolbar, _extends({}, props.slotProps?.toolbar)) : null, !props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsxs(ChartsSurface, _extends({}, chartsSurfaceProps, {
|
|
65
64
|
children: [/*#__PURE__*/_jsx(ChartsGrid, _extends({}, gridProps)), /*#__PURE__*/_jsxs("g", _extends({}, clipPathGroupProps, {
|
|
66
65
|
children: [/*#__PURE__*/_jsx(AreaPlot, _extends({}, areaPlotProps)), /*#__PURE__*/_jsx(LinePlot, _extends({}, linePlotProps)), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlightProps))]
|
|
67
66
|
})), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), /*#__PURE__*/_jsx("g", {
|
package/esm/PieChart/PieChart.js
CHANGED
|
@@ -6,7 +6,7 @@ const _excluded = ["series", "width", "height", "margin", "colors", "sx", "skipA
|
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { useThemeProps } from '@mui/material/styles';
|
|
9
|
-
import {
|
|
9
|
+
import { DEFAULT_PIE_CHART_MARGIN } from "../internals/constants.js";
|
|
10
10
|
import { ChartsTooltip } from "../ChartsTooltip/index.js";
|
|
11
11
|
import { ChartsLegend } from "../ChartsLegend/index.js";
|
|
12
12
|
import { PiePlot } from "./PiePlot.js";
|
|
@@ -18,13 +18,6 @@ import { ChartsWrapper } from "../internals/components/ChartsWrapper/index.js";
|
|
|
18
18
|
import { PIE_CHART_PLUGINS } from "./PieChart.plugins.js";
|
|
19
19
|
import { defaultizeMargin } from "../internals/defaultizeMargin.js";
|
|
20
20
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
21
|
-
const defaultMargin = {
|
|
22
|
-
top: 5,
|
|
23
|
-
bottom: 5,
|
|
24
|
-
left: 5,
|
|
25
|
-
right: 5
|
|
26
|
-
};
|
|
27
|
-
|
|
28
21
|
/**
|
|
29
22
|
* Demos:
|
|
30
23
|
*
|
|
@@ -60,7 +53,7 @@ const PieChart = /*#__PURE__*/React.forwardRef(function PieChart(inProps, ref) {
|
|
|
60
53
|
showToolbar
|
|
61
54
|
} = props,
|
|
62
55
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
63
|
-
const margin = defaultizeMargin(marginProps,
|
|
56
|
+
const margin = defaultizeMargin(marginProps, DEFAULT_PIE_CHART_MARGIN);
|
|
64
57
|
const {
|
|
65
58
|
chartDataProviderProps,
|
|
66
59
|
chartsSurfaceProps
|
|
@@ -79,13 +72,13 @@ const PieChart = /*#__PURE__*/React.forwardRef(function PieChart(inProps, ref) {
|
|
|
79
72
|
plugins: PIE_CHART_PLUGINS
|
|
80
73
|
}), ref);
|
|
81
74
|
const Tooltip = slots?.tooltip ?? ChartsTooltip;
|
|
82
|
-
const Toolbar = props.slots?.toolbar
|
|
75
|
+
const Toolbar = props.slots?.toolbar;
|
|
83
76
|
return /*#__PURE__*/_jsx(ChartDataProvider, _extends({}, chartDataProviderProps, {
|
|
84
77
|
children: /*#__PURE__*/_jsxs(ChartsWrapper, {
|
|
85
78
|
legendPosition: props.slotProps?.legend?.position,
|
|
86
79
|
legendDirection: props?.slotProps?.legend?.direction ?? 'vertical',
|
|
87
80
|
sx: sx,
|
|
88
|
-
children: [showToolbar ? /*#__PURE__*/_jsx(Toolbar, {}) : null, !hideLegend && /*#__PURE__*/_jsx(ChartsLegend, {
|
|
81
|
+
children: [showToolbar && Toolbar ? /*#__PURE__*/_jsx(Toolbar, _extends({}, props.slotProps?.toolbar)) : null, !hideLegend && /*#__PURE__*/_jsx(ChartsLegend, {
|
|
89
82
|
direction: props?.slotProps?.legend?.direction ?? 'vertical',
|
|
90
83
|
slots: slots,
|
|
91
84
|
slotProps: slotProps
|
|
@@ -4,7 +4,6 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { useThemeProps } from '@mui/material/styles';
|
|
7
|
-
import { ChartsToolbar } from "../Toolbar/internals/ChartsToolbar.js";
|
|
8
7
|
import { ChartsLegend } from "../ChartsLegend/index.js";
|
|
9
8
|
import { ChartsOverlay } from "../ChartsOverlay/ChartsOverlay.js";
|
|
10
9
|
import { useRadarChartProps } from "./useRadarChartProps.js";
|
|
@@ -42,10 +41,10 @@ const RadarChart = /*#__PURE__*/React.forwardRef(function RadarChart(inProps, re
|
|
|
42
41
|
children
|
|
43
42
|
} = useRadarChartProps(props);
|
|
44
43
|
const Tooltip = props.slots?.tooltip ?? ChartsTooltip;
|
|
45
|
-
const Toolbar = props.slots?.toolbar
|
|
44
|
+
const Toolbar = props.slots?.toolbar;
|
|
46
45
|
return /*#__PURE__*/_jsx(RadarDataProvider, _extends({}, radarDataProviderProps, {
|
|
47
46
|
children: /*#__PURE__*/_jsxs(ChartsWrapper, _extends({}, chartsWrapperProps, {
|
|
48
|
-
children: [props.showToolbar ? /*#__PURE__*/_jsx(Toolbar, {}) : null, !props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsxs(ChartsSurface, _extends({}, chartsSurfaceProps, {
|
|
47
|
+
children: [props.showToolbar && Toolbar ? /*#__PURE__*/_jsx(Toolbar, _extends({}, props.slotProps?.toolbar)) : null, !props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsxs(ChartsSurface, _extends({}, chartsSurfaceProps, {
|
|
49
48
|
ref: ref,
|
|
50
49
|
children: [/*#__PURE__*/_jsx(RadarGrid, _extends({}, radarGrid)), /*#__PURE__*/_jsx(RadarMetricLabels, {}), /*#__PURE__*/_jsx(RadarSeriesArea, {}), highlight === 'axis' && /*#__PURE__*/_jsx(RadarAxisHighlight, {}), /*#__PURE__*/_jsx(RadarSeriesMarks, {}), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)), children]
|
|
51
50
|
})), !props.loading && /*#__PURE__*/_jsx(Tooltip, _extends({}, props.slotProps?.tooltip))]
|