|
|
@ -3,6 +3,7 @@ import { |
|
|
|
autocompleteClasses as muiAutocompleteClasses, |
|
|
|
autocompleteClasses as muiAutocompleteClasses, |
|
|
|
AutocompleteProps as MUIAutocompleteProps, |
|
|
|
AutocompleteProps as MUIAutocompleteProps, |
|
|
|
AutocompleteRenderInputParams as MUIAutocompleteRenderInputParams, |
|
|
|
AutocompleteRenderInputParams as MUIAutocompleteRenderInputParams, |
|
|
|
|
|
|
|
Box, |
|
|
|
Grow as MUIGrow, |
|
|
|
Grow as MUIGrow, |
|
|
|
outlinedInputClasses as muiOutlinedInputClasses, |
|
|
|
outlinedInputClasses as muiOutlinedInputClasses, |
|
|
|
Paper as MUIPaper, |
|
|
|
Paper as MUIPaper, |
|
|
@ -12,6 +13,8 @@ import { |
|
|
|
|
|
|
|
|
|
|
|
import { GREY, TEXT } from '../lib/consts/DEFAULT_THEME'; |
|
|
|
import { GREY, TEXT } from '../lib/consts/DEFAULT_THEME'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import InputMessageBox from './InputMessageBox'; |
|
|
|
|
|
|
|
import { MessageBoxProps } from './MessageBox'; |
|
|
|
import OutlinedInputWithLabel, { |
|
|
|
import OutlinedInputWithLabel, { |
|
|
|
OutlinedInputWithLabelProps, |
|
|
|
OutlinedInputWithLabelProps, |
|
|
|
} from './OutlinedInputWithLabel'; |
|
|
|
} from './OutlinedInputWithLabel'; |
|
|
@ -21,6 +24,7 @@ type AutocompleteOptionalProps = { |
|
|
|
inputWithLabelProps: OutlinedInputWithLabelProps, |
|
|
|
inputWithLabelProps: OutlinedInputWithLabelProps, |
|
|
|
renderInputParams?: MUIAutocompleteRenderInputParams, |
|
|
|
renderInputParams?: MUIAutocompleteRenderInputParams, |
|
|
|
) => void; |
|
|
|
) => void; |
|
|
|
|
|
|
|
messageBoxProps?: Partial<MessageBoxProps>; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
type AutocompleteProps< |
|
|
|
type AutocompleteProps< |
|
|
@ -54,8 +58,14 @@ const Autocomplete = < |
|
|
|
>( |
|
|
|
>( |
|
|
|
autocompleteProps: AutocompleteProps<T, Multiple, DisableClearable, FreeSolo>, |
|
|
|
autocompleteProps: AutocompleteProps<T, Multiple, DisableClearable, FreeSolo>, |
|
|
|
): JSX.Element => { |
|
|
|
): JSX.Element => { |
|
|
|
const { componentsProps, extendRenderInput, label, renderInput, sx } = |
|
|
|
const { |
|
|
|
autocompleteProps; |
|
|
|
componentsProps, |
|
|
|
|
|
|
|
extendRenderInput, |
|
|
|
|
|
|
|
label, |
|
|
|
|
|
|
|
messageBoxProps, |
|
|
|
|
|
|
|
renderInput, |
|
|
|
|
|
|
|
sx, |
|
|
|
|
|
|
|
} = autocompleteProps; |
|
|
|
const combinedComponentsProps: AutocompleteProps< |
|
|
|
const combinedComponentsProps: AutocompleteProps< |
|
|
|
T, |
|
|
|
T, |
|
|
|
Multiple, |
|
|
|
Multiple, |
|
|
@ -109,6 +119,7 @@ const Autocomplete = < |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
|
|
|
|
<Box sx={{ display: 'flex', flexDirection: 'column' }}> |
|
|
|
<MUIAutocomplete |
|
|
|
<MUIAutocomplete |
|
|
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
|
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
|
|
{...{ |
|
|
|
{...{ |
|
|
@ -119,6 +130,9 @@ const Autocomplete = < |
|
|
|
sx: combinedSx, |
|
|
|
sx: combinedSx, |
|
|
|
}} |
|
|
|
}} |
|
|
|
/> |
|
|
|
/> |
|
|
|
|
|
|
|
{/* eslint-disable-next-line react/jsx-props-no-spreading */} |
|
|
|
|
|
|
|
<InputMessageBox {...messageBoxProps} /> |
|
|
|
|
|
|
|
</Box> |
|
|
|
); |
|
|
|
); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|