From 30a908b203ebbe69da6ba74d0f616ddc9b25e33e Mon Sep 17 00:00:00 2001 From: Albert Yu Date: Thu, 5 Oct 2023 14:09:56 +0800 Subject: [PATCH] Fully use useSlotProps --- .../src/FilledInput/FilledInput.tsx | 40 +++++-------------- 1 file changed, 10 insertions(+), 30 deletions(-) diff --git a/packages/mui-material-next/src/FilledInput/FilledInput.tsx b/packages/mui-material-next/src/FilledInput/FilledInput.tsx index cec98c5986e405..5e4cb3655a1ef8 100644 --- a/packages/mui-material-next/src/FilledInput/FilledInput.tsx +++ b/packages/mui-material-next/src/FilledInput/FilledInput.tsx @@ -13,6 +13,7 @@ import { inputOverridesResolver as inputBaseInputOverridesResolver, } from '../InputBase/InputBase'; import InputBase from '../InputBase'; +import { InputBaseOwnerState } from '../InputBase/InputBase.types'; import filledInputClasses, { getFilledInputUtilityClass } from './filledInputClasses'; import { FilledInputOwnerState, FilledInputProps, FilledInputTypeMap } from './FilledInput.types'; @@ -260,32 +261,20 @@ const FilledInput = React.forwardRef(function FilledInput< const rootProps = useSlotProps({ elementType: Root, externalSlotProps: slotProps.root, - ownerState: { - ...ownerState, - maxRows: undefined, - minRows: undefined, - rows: undefined, - 'aria-describedby': undefined, - autoComplete: undefined, - formControl: undefined, - focused: false, + additionalProps: { + ref: forwardedRef, + fullWidth, + inputComponent, }, + externalForwardedProps: other, + ownerState: ownerState as FilledInputOwnerState & InputBaseOwnerState, className: [classes.root], }); const inputProps = useSlotProps({ elementType: Input, externalSlotProps: slotProps.input, - ownerState: { - ...ownerState, - maxRows: undefined, - minRows: undefined, - rows: undefined, - 'aria-describedby': undefined, - autoComplete: undefined, - formControl: undefined, - focused: false, - }, + ownerState: ownerState as FilledInputOwnerState & InputBaseOwnerState, className: [classes.input], }); @@ -294,14 +283,10 @@ const FilledInput = React.forwardRef(function FilledInput< ); } @@ -310,15 +295,10 @@ const FilledInput = React.forwardRef(function FilledInput< ); }) as FilledInputComponent;