Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(textfield): inactive fields – improve UX globally #3292

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/components/autocomplete/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,11 @@ const Autocomplete = <T,>(props: AutocompletePropsType<T>) => {
PaperComponent={(paperProps) => (
<CustomPaper {...paperProps} optionsHeader={optionsHeader} />
)}
ListboxComponent={CustomListBoxComponent}
slotProps={{
listbox: {
component: CustomListBoxComponent,
},
}}
Comment on lines +107 to +111
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Update required: Found another instance of deprecated ListboxComponent prop

The verification revealed that there's still one instance of the deprecated ListboxComponent prop in src/components/autocomplete_multiple/index.tsx. For consistency and future compatibility, this should also be updated to use the new slotProps approach.

  • src/components/autocomplete_multiple/index.tsx: Replace ListboxComponent={CustomListBoxComponent} with:
    slotProps={{
      listbox: {
        component: CustomListBoxComponent,
      },
    }}
🔗 Analysis chain

Good move to adopt the latest MUI slotProps approach.

Replacing the deprecated ListboxComponent prop with slotProps.listbox.component ensures future compatibility and a more flexible prop structure. Verify that no references to ListboxComponent remain in your codebase or documentation.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for old references to ListboxComponent in the entire repo
rg 'ListboxComponent'

Length of output: 116

noOptionsText={
<Box sx={{ backgroundColor: 'var(--white)' }}>
<Typography className="body-regular">{t('tr_noOptions')}</Typography>
Expand All @@ -119,8 +123,7 @@ const Autocomplete = <T,>(props: AutocompletePropsType<T>) => {
<TextField
{...params}
variant={variant || 'outlined'}
label={props.value ? label : ''}
placeholder={props.value ? '' : label}
label={label}
slotProps={{ input: params.InputProps }}
startIcon={startIcon}
endIcon={endIcon}
Expand Down
17 changes: 14 additions & 3 deletions src/components/textfield/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const TextField = (props: TextFieldTypeProps) => {
type = 'text',
...defaultProps
} = props;

const [showAccessCode, setShowAccessCode] = useState(false);
const [inputType, setInputType] = useState<HTMLInputTypeAttribute>(type);

Expand Down Expand Up @@ -78,6 +79,7 @@ const TextField = (props: TextFieldTypeProps) => {
props.value || props.inputProps?.value
? 'var(--black)'
: 'var(--accent-400)',
cursor: props.disabled && 'not-allowed',
},
'.MuiInput-root:before': {
borderBottom: '1px solid var(--accent-300) !important',
Expand Down Expand Up @@ -118,9 +120,17 @@ const TextField = (props: TextFieldTypeProps) => {
border: '1px solid var(--red-main)',
},
},

'&.Mui-disabled fieldset': {
border: '1px solid var(--accent-200)',
},
},
'.MuiInputLabel-root': {
color: success ? 'var(--green-main)' : 'var(--accent-350)',
color: !props.disabled
? success
? 'var(--green-main)'
: 'var(--accent-350)'
: 'var(--accent-200)',
'&.Mui-focused': {
color: success ? 'var(--green-main)' : 'var(--accent-350)',
},
Expand All @@ -143,9 +153,10 @@ const TextField = (props: TextFieldTypeProps) => {
},

'& .MuiAutocomplete-endAdornment .MuiSvgIcon-root': {
color: endIcon?.props.color || 'var(--black)',
color: !props.disabled
? endIcon?.props.color || 'var(--black)'
: 'var(--accent-200)',
},

...props.sx,
}}
slotProps={{
Expand Down
Loading