11import { unstable_composeClasses as composeClasses } from '@mui/base' ;
2- import { useSlotProps } from '@mui/base/utils' ;
32import { css , keyframes } from '@mui/system' ;
43import { OverridableComponent } from '@mui/types' ;
54import { unstable_capitalize as capitalize } from '@mui/utils' ;
@@ -8,6 +7,7 @@ import PropTypes from 'prop-types';
87import * as React from 'react' ;
98import styled from '../styles/styled' ;
109import useThemeProps from '../styles/useThemeProps' ;
10+ import useSlot from '../utils/useSlot' ;
1111import { getLinearProgressUtilityClass } from './linearProgressClasses' ;
1212import {
1313 LinearProgressOwnerState ,
@@ -145,7 +145,6 @@ const LinearProgress = React.forwardRef(function LinearProgress(inProps, ref) {
145145 } ) ;
146146
147147 const {
148- component = 'div' ,
149148 children,
150149 className,
151150 color = 'primary' ,
@@ -170,30 +169,28 @@ const LinearProgress = React.forwardRef(function LinearProgress(inProps, ref) {
170169
171170 const classes = useUtilityClasses ( ownerState ) ;
172171
173- const rootProps = useSlotProps ( {
172+ const [ SlotRoot , rootProps ] = useSlot ( 'root' , {
173+ ref,
174+ className : clsx ( classes . root , className ) ,
174175 elementType : LinearProgressRoot ,
175- externalSlotProps : { } ,
176176 externalForwardedProps : other ,
177177 ownerState,
178178 additionalProps : {
179- ref,
180- as : component ,
181179 role : 'progressbar' ,
182180 style : {
183181 // Setting this CSS varaible via inline-style
184182 // prevents the generation of new CSS every time
185183 // `value` prop updates
186184 '--LinearProgress-percent' : value ,
187185 } ,
186+ ...( typeof value === 'number' &&
187+ determinate && {
188+ 'aria-valuenow' : Math . round ( value ) ,
189+ } ) ,
188190 } ,
189- className : clsx ( classes . root , className ) ,
190- ...( typeof value === 'number' &&
191- determinate && {
192- 'aria-valuenow' : Math . round ( value ) ,
193- } ) ,
194191 } ) ;
195192
196- return < LinearProgressRoot { ...rootProps } > { children } </ LinearProgressRoot > ;
193+ return < SlotRoot { ...rootProps } > { children } </ SlotRoot > ;
197194} ) as OverridableComponent < LinearProgressTypeMap > ;
198195
199196LinearProgress . propTypes /* remove-proptypes */ = {
0 commit comments