import { Box, Chip, InputAdornment, Paper, TextField } from "@mui/material"; import SearchIcon from "@mui/icons-material/Search"; import { MultiSelectSearchPanelProps } from "./Interface"; const MultiSelectSearchPanel = ({ children, selectedOptions = [], onRemoveChip, searchValue = "", onSearchChange, searchPlaceholder, styleConfig = {}, isDisabled = false, appTheme: theme, ...paperProps }: MultiSelectSearchPanelProps) => { return ( {!isDisabled && ( onSearchChange?.(e.target.value)} placeholder={searchPlaceholder || "Search..."} onKeyDown={(e) => e.stopPropagation()} onMouseDown={(e) => e.stopPropagation()} onClick={(e) => e.stopPropagation()} slotProps={{ input: { startAdornment: ( ), }, }} sx={{ "& .MuiOutlinedInput-root": { borderRadius: "8px", backgroundColor: "#f5f5f5", fontSize: "13px", "& fieldset": { borderColor: theme.myTheme.palette?.secondary?.light }, "&:hover fieldset": { borderColor: theme.myTheme.palette?.secondary?.contrastText }, "&.Mui-focused fieldset": { borderColor: theme.myTheme.palette?.primary?.main }, }, "& input": { padding: "6px 8px 6px 0 !important" }, ...styleConfig?.searchFieldStyle, }} /> )} {selectedOptions.length > 0 && ( {selectedOptions.map((opt: any) => ( onRemoveChip?.(opt.value) : undefined } onMouseDown={(e) => e.stopPropagation()} sx={{ backgroundColor: isDisabled ? "#a0c8ca" : theme.myTheme.palette?.primary?.main, color: theme.myTheme.palette?.common?.white, borderRadius: "6px", height: "26px", fontSize: "12px", cursor: isDisabled ? "default" : "pointer", "& .MuiChip-deleteIcon": { color: theme.myTheme.palette?.common?.white, fontSize: "15px", "&:hover": { color: theme.myTheme.palette?.common?.white }, }, ...styleConfig?.chipStyle, }} /> ))} )} {children} ); }; export default MultiSelectSearchPanel;