Skip to content

Commit

Permalink
fixed multi select + simple value + disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed Nov 30, 2024
1 parent 9054463 commit a492a51
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/components/inputs/Autocomplete/Autocomplete.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ const Autocomplete: React.FC<
const getValue = valueKey instanceof Function ? valueKey : prop(valueKey)
const getLabel = labelKey instanceof Function ? labelKey : prop(labelKey)

const convertedOption = convertValueToOption(
const convertedOption: unknown = convertValueToOption(
option,
allOptions,
extractFirstValue([getValue, internalValue, identity])
Expand Down Expand Up @@ -334,12 +334,19 @@ const Autocomplete: React.FC<
>
) => {
return value.map((option, index) => {
const getValue = valueKey instanceof Function ? valueKey : prop(valueKey)

const convertedOption = convertValueToOption(
option,
allOptions,
extractFirstValue([getValue, internalValue, identity])
)
const { key, ...tagProps } = getTagProps({ index })
const isDisabled: boolean = has('isDisabled', option) && Boolean(option.isDisabled)
const isDisabled: boolean = has('isDisabled', convertedOption) && Boolean(convertedOption.isDisabled)
return (
<Chip
key={key}
label={handleGetOptionLabel(option, true)}
label={handleGetOptionLabel(convertedOption, true)}
{...tagProps}
disabled={isDisabled || ownerState.disabled}
/>
Expand Down

0 comments on commit a492a51

Please sign in to comment.