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 { getLinearProgressUtilityClass } from './linearProgressClasses' ;
12
12
import {
13
13
LinearProgressOwnerState ,
@@ -145,7 +145,6 @@ const LinearProgress = React.forwardRef(function LinearProgress(inProps, ref) {
145
145
} ) ;
146
146
147
147
const {
148
- component = 'div' ,
149
148
children,
150
149
className,
151
150
color = 'primary' ,
@@ -170,30 +169,28 @@ const LinearProgress = React.forwardRef(function LinearProgress(inProps, ref) {
170
169
171
170
const classes = useUtilityClasses ( ownerState ) ;
172
171
173
- const rootProps = useSlotProps ( {
172
+ const [ SlotRoot , rootProps ] = useSlot ( 'root' , {
173
+ ref,
174
+ className : clsx ( classes . root , className ) ,
174
175
elementType : LinearProgressRoot ,
175
- externalSlotProps : { } ,
176
176
externalForwardedProps : other ,
177
177
ownerState,
178
178
additionalProps : {
179
- ref,
180
- as : component ,
181
179
role : 'progressbar' ,
182
180
style : {
183
181
// Setting this CSS varaible via inline-style
184
182
// prevents the generation of new CSS every time
185
183
// `value` prop updates
186
184
'--LinearProgress-percent' : value ,
187
185
} ,
186
+ ...( typeof value === 'number' &&
187
+ determinate && {
188
+ 'aria-valuenow' : Math . round ( value ) ,
189
+ } ) ,
188
190
} ,
189
- className : clsx ( classes . root , className ) ,
190
- ...( typeof value === 'number' &&
191
- determinate && {
192
- 'aria-valuenow' : Math . round ( value ) ,
193
- } ) ,
194
191
} ) ;
195
192
196
- return < LinearProgressRoot { ...rootProps } > { children } </ LinearProgressRoot > ;
193
+ return < SlotRoot { ...rootProps } > { children } </ SlotRoot > ;
197
194
} ) as OverridableComponent < LinearProgressTypeMap > ;
198
195
199
196
LinearProgress . propTypes /* remove-proptypes */ = {
0 commit comments