import { Autocomplete, TextField } from "@mui/material"; function AutoCompleteSearch({ data, noneBg, clearText, inputValue, placeholder, handleSearch, setInputValue, setSelectedOption, }) { const clearIndicatorProps = clearText ? { clearIndicator: { onClick: () => { clearText(); }, }, } : {}; return ( option.name} inputValue={inputValue} className="!w-full" onInputChange={(_, newInputValue) => { setInputValue && setInputValue(newInputValue); handleSearch(newInputValue); }} onChange={(_, newValue) => { setSelectedOption && setSelectedOption(newValue); handleSearch(newValue ? newValue.name : ""); }} componentsProps={clearIndicatorProps} renderOption={(props, option) => (
  • {option.name}
  • )} sx={{ "& .MuiAutocomplete-input": { background: noneBg ? "" : "#ffffff !important", }, }} renderInput={(params) => ( )} /> ); } export default AutoCompleteSearch;