@mui/x-charts-pro 8.3.1 → 8.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BarChartPro/BarChartPro.d.ts +13 -5
- package/BarChartPro/BarChartPro.js +56 -21
- package/CHANGELOG.md +213 -0
- package/ChartContainerPro/ChartContainerPro.d.ts +0 -1
- package/ChartContainerPro/ChartContainerPro.js +1 -0
- package/ChartContainerPro/ChartProApi.d.ts +26 -0
- package/ChartContainerPro/ChartProApi.js +5 -0
- package/ChartContainerPro/index.d.ts +2 -1
- package/ChartContainerPro/index.js +11 -0
- package/ChartDataProviderPro/ChartDataProviderPro.d.ts +11 -1
- package/ChartDataProviderPro/ChartDataProviderPro.js +19 -3
- package/ChartDataProviderPro/useChartDataProviderProProps.d.ts +2 -0
- package/ChartDataProviderPro/useChartDataProviderProProps.js +5 -1
- package/ChartZoomSlider/index.d.ts +1 -1
- package/ChartZoomSlider/index.js +4 -4
- package/ChartZoomSlider/internals/ChartAxisZoomSlider.d.ts +1 -3
- package/ChartZoomSlider/internals/ChartAxisZoomSlider.js +31 -287
- package/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.d.ts +24 -0
- package/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.js +251 -0
- package/ChartZoomSlider/internals/ChartAxisZoomSliderThumb.d.ts +12 -0
- package/ChartZoomSlider/internals/ChartAxisZoomSliderThumb.js +92 -0
- package/ChartZoomSlider/internals/ChartAxisZoomSliderTrack.d.ts +18 -0
- package/ChartZoomSlider/internals/ChartAxisZoomSliderTrack.js +160 -0
- package/ChartZoomSlider/internals/ChartsTooltipZoomSliderValue.d.ts +11 -0
- package/ChartZoomSlider/internals/ChartsTooltipZoomSliderValue.js +58 -0
- package/ChartZoomSlider/internals/chartAxisZoomSliderThumbClasses.d.ts +17 -0
- package/ChartZoomSlider/internals/{chartAxisZoomSliderHandleClasses.js → chartAxisZoomSliderThumbClasses.js} +6 -6
- package/ChartZoomSlider/internals/constants.d.ts +5 -0
- package/ChartZoomSlider/internals/constants.js +11 -0
- package/ChartZoomSlider/internals/zoom-utils.d.ts +4 -0
- package/ChartZoomSlider/internals/zoom-utils.js +48 -0
- package/ChartsToolbarPro/ChartsToolbarPro.d.ts +8 -1
- package/ChartsToolbarPro/ChartsToolbarPro.js +42 -8
- package/ChartsToolbarPro/ChartsToolbarZoomInButton.d.ts +16 -0
- package/ChartsToolbarPro/ChartsToolbarZoomInButton.js +56 -0
- package/ChartsToolbarPro/ChartsToolbarZoomOutButton.d.ts +16 -0
- package/ChartsToolbarPro/ChartsToolbarZoomOutButton.js +56 -0
- package/ChartsToolbarPro/index.d.ts +3 -1
- package/ChartsToolbarPro/index.js +22 -0
- package/FunnelChart/FunnelChart.d.ts +2 -1
- package/FunnelChart/FunnelChart.js +6 -23
- package/FunnelChart/FunnelChart.plugins.d.ts +4 -0
- package/FunnelChart/FunnelChart.plugins.js +9 -0
- package/FunnelChart/FunnelPlot.js +2 -0
- package/FunnelChart/FunnelSection.js +2 -1
- package/FunnelChart/curves/curve.types.d.ts +4 -0
- package/FunnelChart/curves/pyramid.d.ts +3 -1
- package/FunnelChart/curves/pyramid.js +37 -10
- package/FunnelChart/curves/step-pyramid.d.ts +10 -2
- package/FunnelChart/curves/step-pyramid.js +96 -20
- package/FunnelChart/curves/step.d.ts +5 -1
- package/FunnelChart/curves/step.js +20 -2
- package/FunnelChart/funnel.types.d.ts +7 -0
- package/FunnelChart/funnelSlots.types.d.ts +4 -3
- package/FunnelChart/seriesConfig/seriesProcessor.js +47 -1
- package/FunnelChart/useFunnelChartProps.d.ts +2 -1
- package/FunnelChart/useFunnelChartProps.js +3 -1
- package/Heatmap/Heatmap.d.ts +18 -5
- package/Heatmap/Heatmap.js +64 -26
- package/Heatmap/Heatmap.plugins.d.ts +2 -1
- package/Heatmap/Heatmap.plugins.js +2 -1
- package/Heatmap/HeatmapTooltip/HeatmapTooltip.classes.d.ts +2 -0
- package/Heatmap/HeatmapTooltip/HeatmapTooltip.classes.js +27 -0
- package/Heatmap/HeatmapTooltip/HeatmapTooltip.d.ts +1 -10
- package/Heatmap/HeatmapTooltip/HeatmapTooltip.js +4 -102
- package/Heatmap/HeatmapTooltip/HeatmapTooltip.types.d.ts +10 -0
- package/Heatmap/HeatmapTooltip/HeatmapTooltip.types.js +5 -0
- package/Heatmap/HeatmapTooltip/HeatmapTooltipContent.d.ts +7 -0
- package/Heatmap/HeatmapTooltip/HeatmapTooltipContent.js +96 -0
- package/Heatmap/HeatmapTooltip/index.d.ts +3 -1
- package/Heatmap/HeatmapTooltip/index.js +11 -0
- package/LineChartPro/LineChartPro.d.ts +13 -5
- package/LineChartPro/LineChartPro.js +56 -21
- package/RadarChartPro/RadarChartPro.d.ts +15 -0
- package/RadarChartPro/RadarChartPro.js +202 -0
- package/RadarChartPro/RadarChartPro.plugins.d.ts +4 -0
- package/RadarChartPro/RadarChartPro.plugins.js +9 -0
- package/RadarChartPro/index.d.ts +1 -0
- package/RadarChartPro/index.js +16 -0
- package/ScatterChartPro/ScatterChartPro.d.ts +13 -5
- package/ScatterChartPro/ScatterChartPro.js +57 -22
- package/context/index.d.ts +1 -0
- package/context/index.js +16 -0
- package/context/useChartApiContext.d.ts +9 -0
- package/context/useChartApiContext.js +17 -0
- package/esm/BarChartPro/BarChartPro.d.ts +13 -5
- package/esm/BarChartPro/BarChartPro.js +54 -19
- package/esm/ChartContainerPro/ChartContainerPro.d.ts +0 -1
- package/esm/ChartContainerPro/ChartContainerPro.js +1 -0
- package/esm/ChartContainerPro/ChartProApi.d.ts +26 -0
- package/esm/ChartContainerPro/ChartProApi.js +1 -0
- package/esm/ChartContainerPro/index.d.ts +2 -1
- package/esm/ChartContainerPro/index.js +2 -1
- package/esm/ChartDataProviderPro/ChartDataProviderPro.d.ts +11 -1
- package/esm/ChartDataProviderPro/ChartDataProviderPro.js +20 -4
- package/esm/ChartDataProviderPro/useChartDataProviderProProps.d.ts +2 -0
- package/esm/ChartDataProviderPro/useChartDataProviderProProps.js +5 -1
- package/esm/ChartZoomSlider/index.d.ts +1 -1
- package/esm/ChartZoomSlider/index.js +1 -1
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSlider.d.ts +1 -3
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSlider.js +30 -283
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.d.ts +24 -0
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.js +243 -0
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderThumb.d.ts +12 -0
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderThumb.js +85 -0
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderTrack.d.ts +18 -0
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderTrack.js +152 -0
- package/esm/ChartZoomSlider/internals/ChartsTooltipZoomSliderValue.d.ts +11 -0
- package/esm/ChartZoomSlider/internals/ChartsTooltipZoomSliderValue.js +52 -0
- package/esm/ChartZoomSlider/internals/chartAxisZoomSliderThumbClasses.d.ts +17 -0
- package/esm/ChartZoomSlider/internals/{chartAxisZoomSliderHandleClasses.js → chartAxisZoomSliderThumbClasses.js} +4 -4
- package/esm/ChartZoomSlider/internals/constants.d.ts +5 -0
- package/esm/ChartZoomSlider/internals/constants.js +5 -0
- package/esm/ChartZoomSlider/internals/zoom-utils.d.ts +4 -0
- package/esm/ChartZoomSlider/internals/zoom-utils.js +40 -0
- package/esm/ChartsToolbarPro/ChartsToolbarPro.d.ts +8 -1
- package/esm/ChartsToolbarPro/ChartsToolbarPro.js +42 -9
- package/esm/ChartsToolbarPro/ChartsToolbarZoomInButton.d.ts +16 -0
- package/esm/ChartsToolbarPro/ChartsToolbarZoomInButton.js +50 -0
- package/esm/ChartsToolbarPro/ChartsToolbarZoomOutButton.d.ts +16 -0
- package/esm/ChartsToolbarPro/ChartsToolbarZoomOutButton.js +50 -0
- package/esm/ChartsToolbarPro/index.d.ts +3 -1
- package/esm/ChartsToolbarPro/index.js +3 -1
- package/esm/FunnelChart/FunnelChart.d.ts +2 -1
- package/esm/FunnelChart/FunnelChart.js +6 -23
- package/esm/FunnelChart/FunnelChart.plugins.d.ts +4 -0
- package/esm/FunnelChart/FunnelChart.plugins.js +3 -0
- package/esm/FunnelChart/FunnelPlot.js +2 -0
- package/esm/FunnelChart/FunnelSection.js +1 -0
- package/esm/FunnelChart/curves/curve.types.d.ts +4 -0
- package/esm/FunnelChart/curves/pyramid.d.ts +3 -1
- package/esm/FunnelChart/curves/pyramid.js +37 -10
- package/esm/FunnelChart/curves/step-pyramid.d.ts +10 -2
- package/esm/FunnelChart/curves/step-pyramid.js +96 -20
- package/esm/FunnelChart/curves/step.d.ts +5 -1
- package/esm/FunnelChart/curves/step.js +20 -2
- package/esm/FunnelChart/funnel.types.d.ts +7 -0
- package/esm/FunnelChart/funnelSlots.types.d.ts +4 -3
- package/esm/FunnelChart/seriesConfig/seriesProcessor.js +47 -1
- package/esm/FunnelChart/useFunnelChartProps.d.ts +2 -1
- package/esm/FunnelChart/useFunnelChartProps.js +3 -1
- package/esm/Heatmap/Heatmap.d.ts +18 -5
- package/esm/Heatmap/Heatmap.js +62 -24
- package/esm/Heatmap/Heatmap.plugins.d.ts +2 -1
- package/esm/Heatmap/Heatmap.plugins.js +2 -1
- package/esm/Heatmap/HeatmapTooltip/HeatmapTooltip.classes.d.ts +2 -0
- package/esm/Heatmap/HeatmapTooltip/HeatmapTooltip.classes.js +19 -0
- package/esm/Heatmap/HeatmapTooltip/HeatmapTooltip.d.ts +1 -10
- package/esm/Heatmap/HeatmapTooltip/HeatmapTooltip.js +5 -103
- package/esm/Heatmap/HeatmapTooltip/HeatmapTooltip.types.d.ts +10 -0
- package/esm/Heatmap/HeatmapTooltip/HeatmapTooltip.types.js +1 -0
- package/esm/Heatmap/HeatmapTooltip/HeatmapTooltipContent.d.ts +7 -0
- package/esm/Heatmap/HeatmapTooltip/HeatmapTooltipContent.js +89 -0
- package/esm/Heatmap/HeatmapTooltip/index.d.ts +3 -1
- package/esm/Heatmap/HeatmapTooltip/index.js +3 -1
- package/esm/LineChartPro/LineChartPro.d.ts +13 -5
- package/esm/LineChartPro/LineChartPro.js +54 -19
- package/esm/RadarChartPro/RadarChartPro.d.ts +15 -0
- package/esm/RadarChartPro/RadarChartPro.js +195 -0
- package/esm/RadarChartPro/RadarChartPro.plugins.d.ts +4 -0
- package/esm/RadarChartPro/RadarChartPro.plugins.js +3 -0
- package/esm/RadarChartPro/index.d.ts +1 -0
- package/esm/RadarChartPro/index.js +1 -0
- package/esm/ScatterChartPro/ScatterChartPro.d.ts +13 -5
- package/esm/ScatterChartPro/ScatterChartPro.js +55 -20
- package/esm/context/index.d.ts +1 -0
- package/esm/context/index.js +1 -0
- package/esm/context/useChartApiContext.d.ts +9 -0
- package/esm/context/useChartApiContext.js +11 -0
- package/esm/hooks/index.d.ts +2 -1
- package/esm/hooks/index.js +2 -1
- package/esm/index.d.ts +2 -1
- package/esm/index.js +2 -1
- package/esm/internals/material/index.d.ts +1 -0
- package/esm/internals/plugins/useChartProExport/exportImage.js +1 -1
- package/esm/internals/plugins/useChartProZoom/useChartProZoom.js +12 -2
- package/esm/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +358 -0
- package/esm/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +15 -1
- package/esm/internals/plugins/useChartProZoom/useChartProZoom.types.d.ts +7 -0
- package/esm/models/index.d.ts +1 -1
- package/hooks/index.d.ts +2 -1
- package/hooks/index.js +21 -10
- package/index.d.ts +2 -1
- package/index.js +12 -1
- package/internals/material/index.d.ts +1 -0
- package/internals/plugins/useChartProExport/exportImage.js +1 -1
- package/internals/plugins/useChartProZoom/useChartProZoom.js +12 -2
- package/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +358 -0
- package/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +16 -2
- package/internals/plugins/useChartProZoom/useChartProZoom.types.d.ts +7 -0
- package/models/index.d.ts +1 -1
- package/package.json +5 -5
- package/ChartZoomSlider/internals/ChartAxisZoomSliderHandle.d.ts +0 -12
- package/ChartZoomSlider/internals/ChartAxisZoomSliderHandle.js +0 -92
- package/ChartZoomSlider/internals/chartAxisZoomSliderHandleClasses.d.ts +0 -17
- package/ChartsToolbarPro/internal/ChartsToolbarZoomInButton.d.ts +0 -13
- package/ChartsToolbarPro/internal/ChartsToolbarZoomInButton.js +0 -36
- package/ChartsToolbarPro/internal/ChartsToolbarZoomOutButton.d.ts +0 -13
- package/ChartsToolbarPro/internal/ChartsToolbarZoomOutButton.js +0 -36
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderHandle.d.ts +0 -12
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderHandle.js +0 -85
- package/esm/ChartZoomSlider/internals/chartAxisZoomSliderHandleClasses.d.ts +0 -17
- package/esm/ChartsToolbarPro/internal/ChartsToolbarZoomInButton.d.ts +0 -13
- package/esm/ChartsToolbarPro/internal/ChartsToolbarZoomInButton.js +0 -29
- package/esm/ChartsToolbarPro/internal/ChartsToolbarZoomOutButton.d.ts +0 -13
- package/esm/ChartsToolbarPro/internal/ChartsToolbarZoomOutButton.js +0 -29
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
+
const _excluded = ["className", "onMove", "orientation", "placement", "rx", "ry"];
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
import { styled } from '@mui/material/styles';
|
|
8
|
+
import useForkRef from '@mui/utils/useForkRef';
|
|
9
|
+
import useEventCallback from '@mui/utils/useEventCallback';
|
|
10
|
+
import { rafThrottle } from '@mui/x-internals/rafThrottle';
|
|
11
|
+
import clsx from 'clsx';
|
|
12
|
+
import { chartAxisZoomSliderThumbClasses, useUtilityClasses } from "./chartAxisZoomSliderThumbClasses.js";
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
const Rect = styled('rect')(({
|
|
15
|
+
theme
|
|
16
|
+
}) => ({
|
|
17
|
+
[`&.${chartAxisZoomSliderThumbClasses.root}`]: {
|
|
18
|
+
fill: theme.palette.mode === 'dark' ? (theme.vars || theme).palette.grey[300] : (theme.vars || theme).palette.common.white,
|
|
19
|
+
stroke: theme.palette.mode === 'dark' ? (theme.vars || theme).palette.grey[600] : (theme.vars || theme).palette.grey[500]
|
|
20
|
+
},
|
|
21
|
+
[`&.${chartAxisZoomSliderThumbClasses.horizontal}`]: {
|
|
22
|
+
cursor: 'ew-resize'
|
|
23
|
+
},
|
|
24
|
+
[`&.${chartAxisZoomSliderThumbClasses.vertical}`]: {
|
|
25
|
+
cursor: 'ns-resize'
|
|
26
|
+
}
|
|
27
|
+
}));
|
|
28
|
+
/**
|
|
29
|
+
* Renders the zoom slider thumb, which is responsible for resizing the zoom range.
|
|
30
|
+
* @internal
|
|
31
|
+
*/
|
|
32
|
+
export const ChartAxisZoomSliderThumb = /*#__PURE__*/React.forwardRef(function ChartAxisZoomSliderThumb(_ref, forwardedRef) {
|
|
33
|
+
let {
|
|
34
|
+
className,
|
|
35
|
+
onMove,
|
|
36
|
+
orientation,
|
|
37
|
+
placement,
|
|
38
|
+
rx = 4,
|
|
39
|
+
ry = 4
|
|
40
|
+
} = _ref,
|
|
41
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
42
|
+
const classes = useUtilityClasses({
|
|
43
|
+
onMove,
|
|
44
|
+
orientation,
|
|
45
|
+
placement
|
|
46
|
+
});
|
|
47
|
+
const thumbRef = React.useRef(null);
|
|
48
|
+
const ref = useForkRef(thumbRef, forwardedRef);
|
|
49
|
+
const onMoveEvent = useEventCallback(onMove);
|
|
50
|
+
React.useEffect(() => {
|
|
51
|
+
const thumb = thumbRef.current;
|
|
52
|
+
if (!thumb) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const onPointerMove = rafThrottle(event => {
|
|
56
|
+
onMoveEvent(event);
|
|
57
|
+
});
|
|
58
|
+
const onPointerUp = () => {
|
|
59
|
+
thumb.removeEventListener('pointermove', onPointerMove);
|
|
60
|
+
thumb.removeEventListener('pointerup', onPointerUp);
|
|
61
|
+
};
|
|
62
|
+
const onPointerDown = event => {
|
|
63
|
+
// Prevent text selection when dragging the thumb
|
|
64
|
+
event.preventDefault();
|
|
65
|
+
event.stopPropagation();
|
|
66
|
+
thumb.setPointerCapture(event.pointerId);
|
|
67
|
+
thumb.addEventListener('pointerup', onPointerUp);
|
|
68
|
+
thumb.addEventListener('pointermove', onPointerMove);
|
|
69
|
+
};
|
|
70
|
+
thumb.addEventListener('pointerdown', onPointerDown);
|
|
71
|
+
|
|
72
|
+
// eslint-disable-next-line consistent-return
|
|
73
|
+
return () => {
|
|
74
|
+
thumb.removeEventListener('pointerdown', onPointerDown);
|
|
75
|
+
onPointerMove.clear();
|
|
76
|
+
};
|
|
77
|
+
}, [onMoveEvent, orientation]);
|
|
78
|
+
return /*#__PURE__*/_jsx(Rect, _extends({
|
|
79
|
+
className: clsx(classes.root, className),
|
|
80
|
+
ref: ref,
|
|
81
|
+
rx: rx,
|
|
82
|
+
ry: ry
|
|
83
|
+
}, rest));
|
|
84
|
+
});
|
|
85
|
+
if (process.env.NODE_ENV !== "production") ChartAxisZoomSliderThumb.displayName = "ChartAxisZoomSliderThumb";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { AxisId } from '@mui/x-charts/internals';
|
|
3
|
+
interface ChartAxisZoomSliderTrackProps extends React.ComponentProps<'rect'> {
|
|
4
|
+
axisId: AxisId;
|
|
5
|
+
axisDirection: 'x' | 'y';
|
|
6
|
+
reverse: boolean;
|
|
7
|
+
onSelectStart?: () => void;
|
|
8
|
+
onSelectEnd?: () => void;
|
|
9
|
+
}
|
|
10
|
+
export declare function ChartAxisZoomSliderTrack({
|
|
11
|
+
axisId,
|
|
12
|
+
axisDirection,
|
|
13
|
+
reverse,
|
|
14
|
+
onSelectStart,
|
|
15
|
+
onSelectEnd,
|
|
16
|
+
...other
|
|
17
|
+
}: ChartAxisZoomSliderTrackProps): React.JSX.Element;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
+
const _excluded = ["axisId", "axisDirection", "reverse", "onSelectStart", "onSelectEnd"];
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { useChartContext, getSVGPoint, selectorChartAxisZoomOptionsLookup, useStore } from '@mui/x-charts/internals';
|
|
6
|
+
import { styled } from '@mui/material/styles';
|
|
7
|
+
import { rafThrottle } from '@mui/x-internals/rafThrottle';
|
|
8
|
+
import { shouldForwardProp } from '@mui/system';
|
|
9
|
+
import { calculateZoomEnd, calculateZoomFromPoint, calculateZoomStart } from "./zoom-utils.js";
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
const ZoomSliderTrack = styled('rect', {
|
|
12
|
+
shouldForwardProp: prop => shouldForwardProp(prop) && prop !== 'axisDirection' && prop !== 'isSelecting'
|
|
13
|
+
})(({
|
|
14
|
+
theme
|
|
15
|
+
}) => ({
|
|
16
|
+
fill: theme.palette.mode === 'dark' ? (theme.vars || theme).palette.grey[800] : (theme.vars || theme).palette.grey[300],
|
|
17
|
+
cursor: 'pointer',
|
|
18
|
+
variants: [{
|
|
19
|
+
props: {
|
|
20
|
+
axisDirection: 'x',
|
|
21
|
+
isSelecting: true
|
|
22
|
+
},
|
|
23
|
+
style: {
|
|
24
|
+
cursor: 'ew-resize'
|
|
25
|
+
}
|
|
26
|
+
}, {
|
|
27
|
+
props: {
|
|
28
|
+
axisDirection: 'y',
|
|
29
|
+
isSelecting: true
|
|
30
|
+
},
|
|
31
|
+
style: {
|
|
32
|
+
cursor: 'ns-resize'
|
|
33
|
+
}
|
|
34
|
+
}]
|
|
35
|
+
}));
|
|
36
|
+
export function ChartAxisZoomSliderTrack(_ref) {
|
|
37
|
+
let {
|
|
38
|
+
axisId,
|
|
39
|
+
axisDirection,
|
|
40
|
+
onSelectStart,
|
|
41
|
+
onSelectEnd
|
|
42
|
+
} = _ref,
|
|
43
|
+
other = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
44
|
+
const ref = React.useRef(null);
|
|
45
|
+
const {
|
|
46
|
+
instance,
|
|
47
|
+
svgRef
|
|
48
|
+
} = useChartContext();
|
|
49
|
+
const store = useStore();
|
|
50
|
+
const [isSelecting, setIsSelecting] = React.useState(false);
|
|
51
|
+
const onPointerDown = function onPointerDown(event) {
|
|
52
|
+
const rect = ref.current;
|
|
53
|
+
const element = svgRef.current;
|
|
54
|
+
if (!rect || !element) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const pointerDownPoint = getSVGPoint(element, event);
|
|
58
|
+
let zoomFromPointerDown = calculateZoomFromPoint(store.getSnapshot(), axisId, pointerDownPoint);
|
|
59
|
+
if (zoomFromPointerDown === null) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const {
|
|
63
|
+
minStart,
|
|
64
|
+
maxEnd
|
|
65
|
+
} = selectorChartAxisZoomOptionsLookup(store.getSnapshot(), axisId);
|
|
66
|
+
|
|
67
|
+
// Ensure the zoomFromPointerDown is within the min and max range
|
|
68
|
+
zoomFromPointerDown = Math.max(Math.min(zoomFromPointerDown, maxEnd), minStart);
|
|
69
|
+
let pointerMoved = false;
|
|
70
|
+
const onPointerMove = rafThrottle(function onPointerMove(pointerMoveEvent) {
|
|
71
|
+
const pointerMovePoint = getSVGPoint(element, pointerMoveEvent);
|
|
72
|
+
const zoomFromPointerMove = calculateZoomFromPoint(store.getSnapshot(), axisId, pointerMovePoint);
|
|
73
|
+
if (zoomFromPointerMove === null) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
pointerMoved = true;
|
|
77
|
+
const zoomOptions = selectorChartAxisZoomOptionsLookup(store.getSnapshot(), axisId);
|
|
78
|
+
instance.setAxisZoomData(axisId, prevZoomData => {
|
|
79
|
+
if (zoomFromPointerMove > zoomFromPointerDown) {
|
|
80
|
+
const end = calculateZoomEnd(zoomFromPointerMove, _extends({}, prevZoomData, {
|
|
81
|
+
start: zoomFromPointerDown
|
|
82
|
+
}), zoomOptions);
|
|
83
|
+
|
|
84
|
+
/* If the starting point is too close to the end that minSpan wouldn't be respected, we need to update the
|
|
85
|
+
* start point. */
|
|
86
|
+
const start = calculateZoomStart(zoomFromPointerDown, _extends({}, prevZoomData, {
|
|
87
|
+
start: zoomFromPointerDown,
|
|
88
|
+
end
|
|
89
|
+
}), zoomOptions);
|
|
90
|
+
return _extends({}, prevZoomData, {
|
|
91
|
+
start,
|
|
92
|
+
end
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
const start = calculateZoomStart(zoomFromPointerMove, _extends({}, prevZoomData, {
|
|
96
|
+
end: zoomFromPointerDown
|
|
97
|
+
}), zoomOptions);
|
|
98
|
+
|
|
99
|
+
/* If the starting point is too close to the start that minSpan wouldn't be respected, we need to update the
|
|
100
|
+
* start point. */
|
|
101
|
+
const end = calculateZoomEnd(zoomFromPointerDown, _extends({}, prevZoomData, {
|
|
102
|
+
start,
|
|
103
|
+
end: zoomFromPointerDown
|
|
104
|
+
}), zoomOptions);
|
|
105
|
+
return _extends({}, prevZoomData, {
|
|
106
|
+
start,
|
|
107
|
+
end
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
const onPointerUp = function onPointerUp(pointerUpEvent) {
|
|
112
|
+
rect.releasePointerCapture(pointerUpEvent.pointerId);
|
|
113
|
+
rect.removeEventListener('pointermove', onPointerMove);
|
|
114
|
+
document.removeEventListener('pointerup', onPointerUp);
|
|
115
|
+
setIsSelecting(false);
|
|
116
|
+
onSelectEnd?.();
|
|
117
|
+
if (pointerMoved) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// If the pointer didn't move, we still need to respect the zoom constraints (minSpan, etc.)
|
|
122
|
+
// In that case, we assume the start to be the pointerZoom and calculate the end.
|
|
123
|
+
const pointerUpPoint = getSVGPoint(element, pointerUpEvent);
|
|
124
|
+
const zoomFromPointerUp = calculateZoomFromPoint(store.getSnapshot(), axisId, pointerUpPoint);
|
|
125
|
+
if (zoomFromPointerUp === null) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
const zoomOptions = selectorChartAxisZoomOptionsLookup(store.getSnapshot(), axisId);
|
|
129
|
+
instance.setAxisZoomData(axisId, prev => _extends({}, prev, {
|
|
130
|
+
start: zoomFromPointerUp,
|
|
131
|
+
end: calculateZoomEnd(zoomFromPointerUp, prev, zoomOptions)
|
|
132
|
+
}));
|
|
133
|
+
};
|
|
134
|
+
event.preventDefault();
|
|
135
|
+
event.stopPropagation();
|
|
136
|
+
rect.setPointerCapture(event.pointerId);
|
|
137
|
+
document.addEventListener('pointerup', onPointerUp);
|
|
138
|
+
rect.addEventListener('pointermove', onPointerMove);
|
|
139
|
+
onSelectStart?.();
|
|
140
|
+
setIsSelecting(true);
|
|
141
|
+
instance.setAxisZoomData(axisId, prev => _extends({}, prev, {
|
|
142
|
+
start: zoomFromPointerDown,
|
|
143
|
+
end: zoomFromPointerDown
|
|
144
|
+
}));
|
|
145
|
+
};
|
|
146
|
+
return /*#__PURE__*/_jsx(ZoomSliderTrack, _extends({
|
|
147
|
+
ref: ref,
|
|
148
|
+
onPointerDown: onPointerDown,
|
|
149
|
+
axisDirection: axisDirection,
|
|
150
|
+
isSelecting: isSelecting
|
|
151
|
+
}, other));
|
|
152
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { PopperProps } from '@mui/material/Popper';
|
|
3
|
+
interface ChartsTooltipZoomSliderValueProps extends Pick<PopperProps, 'anchorEl' | 'open' | 'modifiers' | 'placement'>, React.PropsWithChildren {}
|
|
4
|
+
export declare function ChartsTooltipZoomSliderValue({
|
|
5
|
+
anchorEl,
|
|
6
|
+
open,
|
|
7
|
+
placement,
|
|
8
|
+
modifiers,
|
|
9
|
+
children
|
|
10
|
+
}: ChartsTooltipZoomSliderValueProps): React.JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import NoSsr from '@mui/material/NoSsr';
|
|
3
|
+
import Popper from '@mui/material/Popper';
|
|
4
|
+
import { ChartsTooltipPaper } from '@mui/x-charts/ChartsTooltip';
|
|
5
|
+
import Typography from '@mui/material/Typography';
|
|
6
|
+
import { styled } from '@mui/material/styles';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The root component of the zoom slider tooltip.
|
|
10
|
+
* @ignore - internal component.
|
|
11
|
+
*/
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
const ChartsZoomSliderTooltipRoot = styled(Popper, {
|
|
14
|
+
name: 'MuiChartsZoomSliderTooltip',
|
|
15
|
+
slot: 'Root'
|
|
16
|
+
})(({
|
|
17
|
+
theme
|
|
18
|
+
}) => ({
|
|
19
|
+
pointerEvents: 'none',
|
|
20
|
+
zIndex: theme.zIndex.modal
|
|
21
|
+
}));
|
|
22
|
+
const MODIFIERS = [{
|
|
23
|
+
name: 'offset',
|
|
24
|
+
options: {
|
|
25
|
+
offset: [0, 4]
|
|
26
|
+
}
|
|
27
|
+
}];
|
|
28
|
+
export function ChartsTooltipZoomSliderValue({
|
|
29
|
+
anchorEl,
|
|
30
|
+
open,
|
|
31
|
+
placement,
|
|
32
|
+
modifiers = MODIFIERS,
|
|
33
|
+
children
|
|
34
|
+
}) {
|
|
35
|
+
return /*#__PURE__*/_jsx(NoSsr, {
|
|
36
|
+
children: open ? /*#__PURE__*/_jsx(ChartsZoomSliderTooltipRoot, {
|
|
37
|
+
open: open,
|
|
38
|
+
anchorEl: anchorEl,
|
|
39
|
+
placement: placement,
|
|
40
|
+
modifiers: modifiers,
|
|
41
|
+
children: /*#__PURE__*/_jsx(ChartsTooltipPaper, {
|
|
42
|
+
sx: {
|
|
43
|
+
paddingX: 0.5
|
|
44
|
+
},
|
|
45
|
+
children: /*#__PURE__*/_jsx(Typography, {
|
|
46
|
+
variant: "caption",
|
|
47
|
+
children: children
|
|
48
|
+
})
|
|
49
|
+
})
|
|
50
|
+
}) : null
|
|
51
|
+
});
|
|
52
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ChartZoomSliderThumbOwnerState } from "./ChartAxisZoomSliderThumb.js";
|
|
2
|
+
export interface ChartAxisZoomSliderThumbClasses {
|
|
3
|
+
/** Styles applied to the root element. */
|
|
4
|
+
root: string;
|
|
5
|
+
/** Styles applied to the root element when it is horizontal. */
|
|
6
|
+
horizontal: string;
|
|
7
|
+
/** Styles applied to the root element when it is vertical. */
|
|
8
|
+
vertical: string;
|
|
9
|
+
/** Styles applied to the root element when it is a start thumb. */
|
|
10
|
+
start: string;
|
|
11
|
+
/** Styles applied to the root element when it is an end thumb. */
|
|
12
|
+
end: string;
|
|
13
|
+
}
|
|
14
|
+
export type ChartAxisZoomSliderThumbClassKey = keyof ChartAxisZoomSliderThumbClasses;
|
|
15
|
+
export declare const chartAxisZoomSliderThumbClasses: ChartAxisZoomSliderThumbClasses;
|
|
16
|
+
export declare function getAxisZoomSliderThumbUtilityClass(slot: string): string;
|
|
17
|
+
export declare const useUtilityClasses: (ownerState: ChartZoomSliderThumbOwnerState) => Record<"root", string>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
|
|
2
2
|
import composeClasses from '@mui/utils/composeClasses';
|
|
3
3
|
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
|
4
|
-
export const
|
|
5
|
-
export function
|
|
6
|
-
return generateUtilityClass('
|
|
4
|
+
export const chartAxisZoomSliderThumbClasses = generateUtilityClasses('MuiChartAxisZoomSliderThumb', ['root', 'horizontal', 'vertical', 'start', 'end']);
|
|
5
|
+
export function getAxisZoomSliderThumbUtilityClass(slot) {
|
|
6
|
+
return generateUtilityClass('MuiChartAxisZoomSliderThumb', slot);
|
|
7
7
|
}
|
|
8
8
|
export const useUtilityClasses = ownerState => {
|
|
9
9
|
const {
|
|
@@ -13,5 +13,5 @@ export const useUtilityClasses = ownerState => {
|
|
|
13
13
|
const slots = {
|
|
14
14
|
root: ['root', orientation === 'horizontal' ? 'horizontal' : 'vertical', placement === 'start' ? 'start' : 'end']
|
|
15
15
|
};
|
|
16
|
-
return composeClasses(slots,
|
|
16
|
+
return composeClasses(slots, getAxisZoomSliderThumbUtilityClass);
|
|
17
17
|
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export const ZOOM_SLIDER_TRACK_SIZE = 8;
|
|
2
|
+
export const ZOOM_SLIDER_ACTIVE_TRACK_SIZE = 10;
|
|
3
|
+
export const ZOOM_SLIDER_THUMB_HEIGHT = 20;
|
|
4
|
+
export const ZOOM_SLIDER_THUMB_WIDTH = 10;
|
|
5
|
+
export const ZOOM_SLIDER_SIZE = Math.max(ZOOM_SLIDER_TRACK_SIZE, ZOOM_SLIDER_ACTIVE_TRACK_SIZE, ZOOM_SLIDER_THUMB_HEIGHT, ZOOM_SLIDER_THUMB_WIDTH);
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { AxisId, ChartState, DefaultizedZoomOptions, ZoomData } from '@mui/x-charts/internals';
|
|
2
|
+
export declare function calculateZoomFromPoint(state: ChartState<any>, axisId: AxisId, point: DOMPoint): number | null;
|
|
3
|
+
export declare function calculateZoomStart(newStart: number, currentZoom: ZoomData, options: Pick<DefaultizedZoomOptions, 'minStart' | 'minSpan' | 'maxSpan'>): number;
|
|
4
|
+
export declare function calculateZoomEnd(newEnd: number, currentZoom: ZoomData, options: Pick<DefaultizedZoomOptions, 'maxEnd' | 'minSpan' | 'maxSpan'>): number;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { selectorChartDrawingArea, selectorChartRawAxis } from '@mui/x-charts/internals';
|
|
2
|
+
export function calculateZoomFromPoint(state, axisId, point) {
|
|
3
|
+
const {
|
|
4
|
+
left,
|
|
5
|
+
top,
|
|
6
|
+
height,
|
|
7
|
+
width
|
|
8
|
+
} = selectorChartDrawingArea(state);
|
|
9
|
+
const axis = selectorChartRawAxis(state, axisId);
|
|
10
|
+
if (!axis) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
const axisDirection = axis.position === 'right' || axis.position === 'left' ? 'y' : 'x';
|
|
14
|
+
let pointerZoom;
|
|
15
|
+
if (axisDirection === 'x') {
|
|
16
|
+
pointerZoom = (point.x - left) / width * 100;
|
|
17
|
+
} else {
|
|
18
|
+
pointerZoom = (top + height - point.y) / height * 100;
|
|
19
|
+
}
|
|
20
|
+
if (axis.reverse) {
|
|
21
|
+
pointerZoom = 100 - pointerZoom;
|
|
22
|
+
}
|
|
23
|
+
return pointerZoom;
|
|
24
|
+
}
|
|
25
|
+
export function calculateZoomStart(newStart, currentZoom, options) {
|
|
26
|
+
const {
|
|
27
|
+
minStart,
|
|
28
|
+
minSpan,
|
|
29
|
+
maxSpan
|
|
30
|
+
} = options;
|
|
31
|
+
return Math.max(minStart, currentZoom.end - maxSpan, Math.min(currentZoom.end - minSpan, newStart));
|
|
32
|
+
}
|
|
33
|
+
export function calculateZoomEnd(newEnd, currentZoom, options) {
|
|
34
|
+
const {
|
|
35
|
+
maxEnd,
|
|
36
|
+
minSpan,
|
|
37
|
+
maxSpan
|
|
38
|
+
} = options;
|
|
39
|
+
return Math.min(maxEnd, currentZoom.start + maxSpan, Math.max(currentZoom.start + minSpan, newEnd));
|
|
40
|
+
}
|
|
@@ -1,2 +1,9 @@
|
|
|
1
|
+
import { ChartsToolbarProps } from '@mui/x-charts/Toolbar';
|
|
1
2
|
import * as React from 'react';
|
|
2
|
-
|
|
3
|
+
/**
|
|
4
|
+
* The chart toolbar component for the pro package.
|
|
5
|
+
*/
|
|
6
|
+
export declare function ChartsToolbarPro(props: React.PropsWithChildren<ChartsToolbarProps>): React.JSX.Element | null;
|
|
7
|
+
export declare namespace ChartsToolbarPro {
|
|
8
|
+
var propTypes: any;
|
|
9
|
+
}
|
|
@@ -1,24 +1,57 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
1
2
|
import { Toolbar } from '@mui/x-charts/Toolbar';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
2
4
|
import * as React from 'react';
|
|
3
|
-
import { useChartContext, useSelector } from '@mui/x-charts/internals';
|
|
5
|
+
import { useChartContext, useSelector, useChartsSlots } from '@mui/x-charts/internals';
|
|
6
|
+
import { useChartsLocalization } from '@mui/x-charts/hooks';
|
|
4
7
|
import { selectorChartZoomIsEnabled } from "../internals/plugins/useChartProZoom/index.js";
|
|
5
|
-
import { ChartsToolbarZoomInButton } from "./
|
|
6
|
-
import { ChartsToolbarZoomOutButton } from "./
|
|
8
|
+
import { ChartsToolbarZoomInButton } from "./ChartsToolbarZoomInButton.js";
|
|
9
|
+
import { ChartsToolbarZoomOutButton } from "./ChartsToolbarZoomOutButton.js";
|
|
7
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
-
|
|
11
|
+
/**
|
|
12
|
+
* The chart toolbar component for the pro package.
|
|
13
|
+
*/
|
|
14
|
+
export function ChartsToolbarPro(props) {
|
|
15
|
+
const {
|
|
16
|
+
slots,
|
|
17
|
+
slotProps
|
|
18
|
+
} = useChartsSlots();
|
|
9
19
|
const {
|
|
10
20
|
store
|
|
11
21
|
} = useChartContext();
|
|
22
|
+
const {
|
|
23
|
+
localeText
|
|
24
|
+
} = useChartsLocalization();
|
|
12
25
|
const isZoomEnabled = useSelector(store, selectorChartZoomIsEnabled);
|
|
13
26
|
const children = [];
|
|
14
27
|
if (isZoomEnabled) {
|
|
15
|
-
|
|
16
|
-
|
|
28
|
+
const Tooltip = slots.baseTooltip;
|
|
29
|
+
const ZoomOutIcon = slots.zoomOutIcon;
|
|
30
|
+
const ZoomInIcon = slots.zoomInIcon;
|
|
31
|
+
children.push(/*#__PURE__*/_jsx(Tooltip, _extends({}, slotProps.baseTooltip, {
|
|
32
|
+
title: localeText.zoomIn,
|
|
33
|
+
children: /*#__PURE__*/_jsx(ChartsToolbarZoomInButton, {
|
|
34
|
+
children: /*#__PURE__*/_jsx(ZoomInIcon, _extends({}, slotProps.zoomInIcon))
|
|
35
|
+
})
|
|
36
|
+
}), "zoom-in"));
|
|
37
|
+
children.push(/*#__PURE__*/_jsx(Tooltip, _extends({}, slotProps.baseTooltip, {
|
|
38
|
+
title: localeText.zoomOut,
|
|
39
|
+
children: /*#__PURE__*/_jsx(ChartsToolbarZoomOutButton, {
|
|
40
|
+
children: /*#__PURE__*/_jsx(ZoomOutIcon, _extends({}, slotProps.zoomOutIcon))
|
|
41
|
+
})
|
|
42
|
+
}), "zoom-out"));
|
|
17
43
|
}
|
|
18
44
|
if (children.length === 0) {
|
|
19
45
|
return null;
|
|
20
46
|
}
|
|
21
|
-
return /*#__PURE__*/_jsx(Toolbar, {
|
|
47
|
+
return /*#__PURE__*/_jsx(Toolbar, _extends({}, props, {
|
|
22
48
|
children: children
|
|
23
|
-
});
|
|
24
|
-
}
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
51
|
+
process.env.NODE_ENV !== "production" ? ChartsToolbarPro.propTypes = {
|
|
52
|
+
// ----------------------------- Warning --------------------------------
|
|
53
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
54
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
55
|
+
// ----------------------------------------------------------------------
|
|
56
|
+
className: PropTypes.string
|
|
57
|
+
} : void 0;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ChartsSlotProps } from '@mui/x-charts/internals';
|
|
3
|
+
import { RenderProp } from '@mui/x-internals/useComponentRenderer';
|
|
4
|
+
interface ChartsToolbarZoomInButtonProps {
|
|
5
|
+
/**
|
|
6
|
+
* A function to customize the rendering of the component.
|
|
7
|
+
*/
|
|
8
|
+
render?: RenderProp<ChartsSlotProps['baseIconButton']>;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The zoom-in button for the chart toolbar.
|
|
12
|
+
*/
|
|
13
|
+
declare const ChartsToolbarZoomInButton: React.ForwardRefExoticComponent<ChartsToolbarZoomInButtonProps & {
|
|
14
|
+
children?: React.ReactNode | undefined;
|
|
15
|
+
} & React.RefAttributes<HTMLButtonElement>>;
|
|
16
|
+
export { ChartsToolbarZoomInButton };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
+
const _excluded = ["render"];
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
import { useChartContext, useChartsSlots, useSelector } from '@mui/x-charts/internals';
|
|
9
|
+
import { useComponentRenderer } from '@mui/x-internals/useComponentRenderer';
|
|
10
|
+
import { selectorChartCanZoomIn } from "../internals/plugins/useChartProZoom/index.js";
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
+
/**
|
|
13
|
+
* The zoom-in button for the chart toolbar.
|
|
14
|
+
*/
|
|
15
|
+
const ChartsToolbarZoomInButton = /*#__PURE__*/React.forwardRef(function ChartsToolbarZoomInButton(_ref, ref) {
|
|
16
|
+
let {
|
|
17
|
+
render
|
|
18
|
+
} = _ref,
|
|
19
|
+
other = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
20
|
+
const {
|
|
21
|
+
slots,
|
|
22
|
+
slotProps
|
|
23
|
+
} = useChartsSlots();
|
|
24
|
+
const {
|
|
25
|
+
instance,
|
|
26
|
+
store
|
|
27
|
+
} = useChartContext();
|
|
28
|
+
const disabled = useSelector(store, selectorChartCanZoomIn);
|
|
29
|
+
const element = useComponentRenderer(slots.baseIconButton, render, _extends({}, slotProps?.baseIconButton, {
|
|
30
|
+
onClick: () => instance.zoomIn(),
|
|
31
|
+
disabled
|
|
32
|
+
}, other, {
|
|
33
|
+
ref
|
|
34
|
+
}));
|
|
35
|
+
return /*#__PURE__*/_jsx(React.Fragment, {
|
|
36
|
+
children: element
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
if (process.env.NODE_ENV !== "production") ChartsToolbarZoomInButton.displayName = "ChartsToolbarZoomInButton";
|
|
40
|
+
process.env.NODE_ENV !== "production" ? ChartsToolbarZoomInButton.propTypes = {
|
|
41
|
+
// ----------------------------- Warning --------------------------------
|
|
42
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
43
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
44
|
+
// ----------------------------------------------------------------------
|
|
45
|
+
/**
|
|
46
|
+
* A function to customize the rendering of the component.
|
|
47
|
+
*/
|
|
48
|
+
render: PropTypes.oneOfType([PropTypes.element, PropTypes.func])
|
|
49
|
+
} : void 0;
|
|
50
|
+
export { ChartsToolbarZoomInButton };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ChartsSlotProps } from '@mui/x-charts/internals';
|
|
3
|
+
import { RenderProp } from '@mui/x-internals/useComponentRenderer';
|
|
4
|
+
interface ChartsToolbarZoomOutButtonProps {
|
|
5
|
+
/**
|
|
6
|
+
* A function to customize the rendering of the component.
|
|
7
|
+
*/
|
|
8
|
+
render?: RenderProp<ChartsSlotProps['baseIconButton']>;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The zoom-out button for the chart toolbar.
|
|
12
|
+
*/
|
|
13
|
+
declare const ChartsToolbarZoomOutButton: React.ForwardRefExoticComponent<ChartsToolbarZoomOutButtonProps & {
|
|
14
|
+
children?: React.ReactNode | undefined;
|
|
15
|
+
} & React.RefAttributes<HTMLButtonElement>>;
|
|
16
|
+
export { ChartsToolbarZoomOutButton };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
+
const _excluded = ["render"];
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
import { useChartContext, useChartsSlots, useSelector } from '@mui/x-charts/internals';
|
|
9
|
+
import { useComponentRenderer } from '@mui/x-internals/useComponentRenderer';
|
|
10
|
+
import { selectorChartCanZoomOut } from "../internals/plugins/useChartProZoom/index.js";
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
+
/**
|
|
13
|
+
* The zoom-out button for the chart toolbar.
|
|
14
|
+
*/
|
|
15
|
+
const ChartsToolbarZoomOutButton = /*#__PURE__*/React.forwardRef(function ChartsToolbarZoomOutButton(_ref, ref) {
|
|
16
|
+
let {
|
|
17
|
+
render
|
|
18
|
+
} = _ref,
|
|
19
|
+
other = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
20
|
+
const {
|
|
21
|
+
slots,
|
|
22
|
+
slotProps
|
|
23
|
+
} = useChartsSlots();
|
|
24
|
+
const {
|
|
25
|
+
instance,
|
|
26
|
+
store
|
|
27
|
+
} = useChartContext();
|
|
28
|
+
const disabled = useSelector(store, selectorChartCanZoomOut);
|
|
29
|
+
const element = useComponentRenderer(slots.baseIconButton, render, _extends({}, slotProps?.baseIconButton, {
|
|
30
|
+
onClick: () => instance.zoomOut(),
|
|
31
|
+
disabled
|
|
32
|
+
}, other, {
|
|
33
|
+
ref
|
|
34
|
+
}));
|
|
35
|
+
return /*#__PURE__*/_jsx(React.Fragment, {
|
|
36
|
+
children: element
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
if (process.env.NODE_ENV !== "production") ChartsToolbarZoomOutButton.displayName = "ChartsToolbarZoomOutButton";
|
|
40
|
+
process.env.NODE_ENV !== "production" ? ChartsToolbarZoomOutButton.propTypes = {
|
|
41
|
+
// ----------------------------- Warning --------------------------------
|
|
42
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
43
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
44
|
+
// ----------------------------------------------------------------------
|
|
45
|
+
/**
|
|
46
|
+
* A function to customize the rendering of the component.
|
|
47
|
+
*/
|
|
48
|
+
render: PropTypes.oneOfType([PropTypes.element, PropTypes.func])
|
|
49
|
+
} : void 0;
|
|
50
|
+
export { ChartsToolbarZoomOutButton };
|
|
@@ -7,7 +7,8 @@ import { FunnelSeriesType } from "./funnel.types.js";
|
|
|
7
7
|
import { ChartContainerProProps } from "../ChartContainerPro/index.js";
|
|
8
8
|
import { FunnelChartSlotExtension } from "./funnelSlots.types.js";
|
|
9
9
|
import { CategoryAxis } from "./categoryAxis.types.js";
|
|
10
|
-
|
|
10
|
+
import { FunnelChartPluginsSignatures } from "./FunnelChart.plugins.js";
|
|
11
|
+
export interface FunnelChartProps extends Omit<ChartContainerProProps<'funnel', FunnelChartPluginsSignatures>, 'series' | 'plugins' | 'zAxis' | 'zoom' | 'onZoomChange' | 'dataset' | 'yAxis' | 'xAxis' | 'rotationAxis' | 'radiusAxis' | 'slots' | 'slotProps'>, Omit<FunnelPlotProps, 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'>, FunnelChartSlotExtension {
|
|
11
12
|
/**
|
|
12
13
|
* The series to display in the funnel chart.
|
|
13
14
|
* An array of [[FunnelSeriesType]] objects.
|