partial: autocomplete and theme

This commit is contained in:
Rafael Taranto 2025-04-22 11:56:09 +01:00
parent 2937cebc34
commit 04ef056ba2
3 changed files with 27 additions and 7 deletions

View file

@ -52,7 +52,7 @@ const SearchBox = memo(
clearOnEscape clearOnEscape
multiple multiple
filterSelectedOptions filterSelectedOptions
getOptionSelected={(option, value) => option.type === value.type} isOptionEqualToValue={(option, value) => option.type === value.type}
PaperComponent={({ children }) => ( PaperComponent={({ children }) => (
<Paper elevation={0} className={classes.popup}> <Paper elevation={0} className={classes.popup}>
<div className={classes.separator} /> <div className={classes.separator} />

View file

@ -84,7 +84,7 @@ const Autocomplete = ({
disableClearable disableClearable
ChipProps={{ onDelete: null }} ChipProps={{ onDelete: null }}
clearOnEscape clearOnEscape
getOptionSelected={R.eqProps(valueProp)} isOptionEqualToValue={R.eqProps(valueProp)}
{...props} {...props}
renderInput={params => { renderInput={params => {
return ( return (
@ -102,7 +102,7 @@ const Autocomplete = ({
}} }}
renderOption={(iprops, props) => { renderOption={(iprops, props) => {
if (!props.warning && !props.warningMessage) if (!props.warning && !props.warningMessage)
return R.path([labelProp])(props) return <li {...iprops}>{R.path([labelProp])(props)}</li>
const warningColors = { const warningColors = {
clean: spring4, clean: spring4,
@ -119,6 +119,7 @@ const Autocomplete = ({
/> />
) )
console.log('props.warningMessage: ', props)
return ( return (
<li {...iprops}> <li {...iprops}>
<Box <Box

View file

@ -39,11 +39,12 @@ let theme = createTheme({
}, },
}) })
theme = createTheme({ theme = createTheme(theme, {
components: { components: {
MuiTypography: { MuiTypography: {
styleOverrides: { styleOverrides: {
root: { ...p } root: { ...p },
body1: { ...p },
} }
}, },
MuiButtonBase: { MuiButtonBase: {
@ -98,6 +99,21 @@ theme = createTheme({
} }
} }
}, },
MuiMenuItem: {
styleOverrides: {
root: {
'&:hover': {
backgroundColor: subheaderColor
},
'&.Mui-selected': {
'&:hover': {
backgroundColor: subheaderColor
},
backgroundColor: subheaderColor
}
}
}
},
MuiAutocomplete: { MuiAutocomplete: {
styleOverrides: { styleOverrides: {
root: { root: {
@ -107,9 +123,12 @@ theme = createTheme({
padding: `6px 16px` padding: `6px 16px`
}, },
option: { option: {
'&[data-focus="true"]': { '&.Mui-focused': {
backgroundColor: subheaderColor backgroundColor: subheaderColor
} },
'&[aria-selected="true"]': {
backgroundColor: `${subheaderColor} !important`
},
}, },
paper: { paper: {
color: fontColor, color: fontColor,