1
1
import { unstable_composeClasses as composeClasses } from '@mui/base' ;
2
- import { useSlotProps } from '@mui/base/utils' ;
3
2
import { css , keyframes } from '@mui/system' ;
4
3
import { OverridableComponent } from '@mui/types' ;
5
4
import { unstable_capitalize as capitalize } from '@mui/utils' ;
@@ -8,6 +7,7 @@ import PropTypes from 'prop-types';
8
7
import * as React from 'react' ;
9
8
import styled from '../styles/styled' ;
10
9
import useThemeProps from '../styles/useThemeProps' ;
10
+ import useSlot from '../utils/useSlot' ;
11
11
import { getCircularProgressUtilityClass } from './circularProgressClasses' ;
12
12
import {
13
13
CircularProgressOwnerState ,
@@ -189,8 +189,6 @@ const CircularProgress = React.forwardRef(function CircularProgress(inProps, ref
189
189
} ) ;
190
190
191
191
const {
192
- componentsProps = { } ,
193
- component = 'span' ,
194
192
children,
195
193
className,
196
194
color = 'primary' ,
@@ -215,59 +213,57 @@ const CircularProgress = React.forwardRef(function CircularProgress(inProps, ref
215
213
216
214
const classes = useUtilityClasses ( ownerState ) ;
217
215
218
- const rootProps = useSlotProps ( {
216
+ const [ SlotRoot , rootProps ] = useSlot ( 'root' , {
217
+ ref,
218
+ className : clsx ( classes . root , className ) ,
219
219
elementType : CircularProgressRoot ,
220
- externalSlotProps : componentsProps . root ,
221
220
externalForwardedProps : other ,
222
221
ownerState,
223
222
additionalProps : {
224
- ref,
225
- as : component ,
226
223
role : 'progressbar' ,
227
224
style : {
228
225
// Setting this CSS varaible via inline-style
229
226
// prevents the generation of new CSS every time
230
227
// `value` prop updates
231
228
'--CircularProgress-percent' : value ,
232
229
} ,
230
+ ...( value &&
231
+ determinate && {
232
+ 'aria-valuenow' :
233
+ typeof value === 'number' ? Math . round ( value ) : Math . round ( Number ( value || 0 ) ) ,
234
+ } ) ,
233
235
} ,
234
- className : clsx ( classes . root , className ) ,
235
- ...( value &&
236
- determinate && {
237
- 'aria-valuenow' :
238
- typeof value === 'number' ? Math . round ( value ) : Math . round ( Number ( value || 0 ) ) ,
239
- } ) ,
240
236
} ) ;
241
237
242
- const svgProps = useSlotProps ( {
238
+ const [ SlotSvg , svgProps ] = useSlot ( 'svg' , {
239
+ className : classes . svg ,
243
240
elementType : CircularProgressSvg ,
244
- externalSlotProps : componentsProps . svg ,
241
+ externalForwardedProps : other ,
245
242
ownerState,
246
- className : classes . svg ,
247
243
} ) ;
248
244
249
- const trackProps = useSlotProps ( {
245
+ const [ SlotTrack , trackProps ] = useSlot ( 'track' , {
246
+ className : classes . track ,
250
247
elementType : CircularProgressTrack ,
251
- externalSlotProps : componentsProps . track ,
248
+ externalForwardedProps : other ,
252
249
ownerState,
253
- className : classes . track ,
254
250
} ) ;
255
251
256
- const progressProps = useSlotProps ( {
252
+ const [ SlotProgress , progressProps ] = useSlot ( 'progress' , {
253
+ className : classes . progress ,
257
254
elementType : CircularProgressProgress ,
258
- externalSlotProps : componentsProps . progress ,
255
+ externalForwardedProps : other ,
259
256
ownerState,
260
- className : classes . progress ,
261
257
} ) ;
262
258
263
259
return (
264
- < CircularProgressRoot { ...rootProps } >
265
- < CircularProgressSvg { ...svgProps } >
266
- < CircularProgressTrack { ...trackProps } />
267
- < CircularProgressProgress { ...progressProps } />
268
- </ CircularProgressSvg >
260
+ < SlotRoot { ...rootProps } >
261
+ < SlotSvg { ...svgProps } >
262
+ < SlotTrack { ...trackProps } />
263
+ < SlotProgress { ...progressProps } />
264
+ </ SlotSvg >
269
265
{ children }
270
- </ CircularProgressRoot >
266
+ </ SlotRoot >
271
267
) ;
272
268
} ) as OverridableComponent < CircularProgressTypeMap > ;
273
269
0 commit comments