@@ -18,9 +18,7 @@ import {
1818import { styled } from '@mui/material/styles' ;
1919import { useXAxes , useYAxes } from '@mui/x-charts/hooks' ;
2020import { rafThrottle } from '@mui/x-internals/rafThrottle' ;
21- import clsx from 'clsx' ;
2221import { shouldForwardProp } from '@mui/system' ;
23- import { chartAxisZoomSliderTrackClasses } from './chartAxisZoomSliderTrackClasses' ;
2422import { ChartsTooltipZoomSliderValue } from './ChartsTooltipZoomSliderValue' ;
2523import {
2624 selectorChartAxisZoomData ,
@@ -29,27 +27,25 @@ import {
2927import { ChartAxisZoomSliderThumb } from './ChartAxisZoomSliderThumb' ;
3028
3129const ZoomSliderTrack = styled ( 'rect' , {
32- shouldForwardProp : ( prop ) => shouldForwardProp ( prop ) && prop !== 'axisDirection' ,
33- } ) < { axisDirection : 'x' | 'y' } > ( ( { theme } ) => ( {
34- [ `&.${ chartAxisZoomSliderTrackClasses . root } ` ] : {
35- fill :
36- theme . palette . mode === 'dark'
37- ? ( theme . vars || theme ) . palette . grey [ 800 ]
38- : ( theme . vars || theme ) . palette . grey [ 300 ] ,
39- cursor : 'pointer' ,
40-
41- [ `&.${ chartAxisZoomSliderTrackClasses . selecting } ` ] : {
42- cursor : 'ew-resize' ,
43- } ,
44- } ,
30+ shouldForwardProp : ( prop ) =>
31+ shouldForwardProp ( prop ) && prop !== 'axisDirection' && prop !== 'isSelecting' ,
32+ } ) < { axisDirection : 'x' | 'y' ; isSelecting : boolean } > ( ( { theme } ) => ( {
33+ fill :
34+ theme . palette . mode === 'dark'
35+ ? ( theme . vars || theme ) . palette . grey [ 800 ]
36+ : ( theme . vars || theme ) . palette . grey [ 300 ] ,
37+ cursor : 'pointer' ,
4538 variants : [
4639 {
47- props : { axisDirection : 'y' } ,
40+ props : { axisDirection : 'x' , isSelecting : true } ,
4841 style : {
49- [ `&.${ chartAxisZoomSliderTrackClasses . root } .${ chartAxisZoomSliderTrackClasses . selecting } ` ] :
50- {
51- cursor : 'ns-resize' ,
52- } ,
42+ cursor : 'ew-resize' ,
43+ } ,
44+ } ,
45+ {
46+ props : { axisDirection : 'y' , isSelecting : true } ,
47+ style : {
48+ cursor : 'ns-resize' ,
5349 } ,
5450 } ,
5551 ] ,
@@ -183,10 +179,6 @@ function ChartAxisZoomSliderTrack({
183179 const { instance, svgRef } = useChartContext < [ UseChartProZoomSignature ] > ( ) ;
184180 const store = useStore < [ UseChartProZoomSignature ] > ( ) ;
185181 const [ isSelecting , setIsSelecting ] = React . useState ( false ) ;
186- const className = clsx (
187- chartAxisZoomSliderTrackClasses . root ,
188- isSelecting && chartAxisZoomSliderTrackClasses . selecting ,
189- ) ;
190182
191183 const onPointerDown = function onPointerDown ( event : React . PointerEvent < SVGRectElement > ) {
192184 const rect = ref . current ;
@@ -311,6 +303,7 @@ function ChartAxisZoomSliderTrack({
311303 className = { className }
312304 onPointerDown = { onPointerDown }
313305 axisDirection = { axisDirection }
306+ isSelecting = { isSelecting }
314307 { ...other }
315308 />
316309 ) ;
0 commit comments