console.error(['MUI: You have provided a `inputComponent` to the input component','that does not correctly handle the `ref` prop.','Make sure the `ref` prop is called with a HTMLInputElement.'].join('\n'));
// Fix a bug with IE11 where the focus/blur events are triggered
// while the component is disabled.
if(fcs.disabled){
event.stopPropagation();
return;
}
if(onFocus){
onFocus(event);
}
if(inputPropsProp.onFocus){
inputPropsProp.onFocus(event);
}
if(muiFormControl&&muiFormControl.onFocus){
muiFormControl.onFocus(event);
}else{
setFocused(true);
}
};
consthandleBlur=event=>{
if(onBlur){
onBlur(event);
}
if(inputPropsProp.onBlur){
inputPropsProp.onBlur(event);
}
if(muiFormControl&&muiFormControl.onBlur){
muiFormControl.onBlur(event);
}else{
setFocused(false);
}
};
consthandleChange=(event,...args)=>{
if(!isControlled){
constelement=event.target||inputRef.current;
if(element==null){
thrownewError(process.env.NODE_ENV!=="production"?`MUI:Expectedvalidinputtarget.Didyouuseacustom\`inputComponent\`andforgettoforwardrefs?Seehttps://mui.com/r/input-component-ref-interface for more info.` : _formatMuiErrorMessage(1));
}
checkDirty({
value:element.value
});
}
if(inputPropsProp.onChange){
inputPropsProp.onChange(event,...args);
}
// Perform in the willUpdate
if(onChange){
onChange(event,...args);
}
};
// Check the input state on mount, in case it was filled by the user
// or auto filled by the browser before the hydration (for SSR).
* It's recommended to use the `slots` prop instead.
*
* @default {}
*/
components:PropTypes.shape({
Input:PropTypes.elementType,
Root:PropTypes.elementType
}),
/**
* The extra props for the slot components.
* You can override the existing props or add new ones.
*
* This prop is an alias for the `slotProps` prop.
* It's recommended to use the `slotProps` prop instead, as `componentsProps` will be deprecated in the future.
*
* @default {}
*/
componentsProps:PropTypes.shape({
input:PropTypes.object,
root:PropTypes.object
}),
/**
* The default value. Use when the component is not controlled.
*/
defaultValue:PropTypes.any,
/**
* If `true`, the component is disabled.
* The prop defaults to the value (`false`) inherited from the parent FormControl component.
*/
disabled:PropTypes.bool,
/**
* If `true`, GlobalStyles for the auto-fill keyframes will not be injected/removed on mount/unmount. Make sure to inject them at the top of your application.
* This option is intended to help with boosting the initial rendering performance if you are loading a big amount of Input components at once.
* @default false
*/
disableInjectingGlobalStyles:PropTypes.bool,
/**
* End `InputAdornment` for this component.
*/
endAdornment:PropTypes.node,
/**
* If `true`, the `input` will indicate an error.
* The prop defaults to the value (`false`) inherited from the parent FormControl component.
*/
error:PropTypes.bool,
/**
* If `true`, the `input` will take up the full width of its container.
* @default false
*/
fullWidth:PropTypes.bool,
/**
* The id of the `input` element.
*/
id:PropTypes.string,
/**
* The component used for the `input` element.
* Either a string to use a HTML element or a component.
* @default 'input'
*/
inputComponent:elementTypeAcceptingRef,
/**
* [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Attributes) applied to the `input` element.
* @default {}
*/
inputProps:PropTypes.object,
/**
* Pass a ref to the `input` element.
*/
inputRef:refType,
/**
* If `dense`, will adjust vertical spacing. This is normally obtained via context from
* FormControl.
* The prop defaults to the value (`'none'`) inherited from the parent FormControl component.
*/
margin:PropTypes.oneOf(['dense','none']),
/**
* Maximum number of rows to display when multiline option is set to true.
* Type of the `input` element. It should be [a valid HTML5 input type](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Form_%3Cinput%3E_types).
* @default 'text'
*/
type:PropTypes.string,
/**
* The value of the `input` element, required for a controlled component.