var definedLocalProps = ['defaultValue', 'disabled', 'error', 'required', 'value'].filter(function (prop) {
return parameters[prop] !== undefined;
});
if (definedLocalProps.length > 0) {
console.warn(['MUI: You have set props on an input that is inside a FormControlUnstyled.', 'Set these props on a FormControlUnstyled instead. Otherwise they will be ignored.', "Ignored props: ".concat(definedLocalProps.join(', '))].join('\n'));
}
}
} else {
defaultValue = defaultValueProp;
disabled = disabledProp;
error = errorProp;
required = requiredProp;
value = valueProp;
}
var _React$useRef = React.useRef(value != null),
isControlled = _React$useRef.current;
var handleInputRefWarning = React.useCallback(function (instance) {
if (process.env.NODE_ENV !== 'production') {
if (instance && instance.nodeName !== 'INPUT' && !instance.focus) {
console.error(['MUI: You have provided a `slots.input` to the input component', 'that does not correctly handle the `ref` prop.', 'Make sure the `ref` prop is called with a HTMLInputElement.'].join('\n'));
}
}
}, []);
var inputRef = React.useRef(null);
var handleInputRef = useForkRef(inputRef, handleInputRefWarning);
var _React$useState = React.useState(false),
focused = _React$useState[0],
setFocused = _React$useState[1]; // The blur won't fire when the disabled state is set on a focused input.
// We need to book keep the focused state manually.
if (formControlContext && formControlContext.onBlur) {
formControlContext.onBlur();
} else {
setFocused(false);
}
};
};
var handleChange = function handleChange(otherHandlers) {
return function (event) {
var _formControlContext$o2, _otherHandlers$onChan;
if (!isControlled) {
var element = event.target || inputRef.current;
if (element == null) {
throw new Error(process.env.NODE_ENV !== "production" ? "MUI: Expected valid input target. Did you use a custom `slots.input` and forget to forward refs? See https://mui.com/r/input-component-ref-interface for more info." : _formatMuiErrorMessage(17));