Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I have remade the autocomplete and removed some unnecessary features.
Main changes:
onChange
is no longer a required property.valueKey
andlabelKey
are nowstring
orfunction
.defaultOptions
it was useless and overcomplicated.simpleValue
we can do without it.typographyContentColor
doesn't work withmaterial ui 6
.inputSelectedColor
doesn't work withmaterial ui 6
.stopEventPropagation
no longer needed and improved.options
andloadOptions
createOption
reason andvalue
will be a string regardless of the option type.getOptionDisabled
is no longer required when you useisDisabled
flag inside an option.isMultiSelection
istrue
you can send a mixedvalue
array of bothvalueKey
and options (ie.[valueKey, valueKey, option, option]
)clear
button the disabled selections will also be removed. An issue has been raised withmaterial ui
44603.__internalShowLoadingOption
will put theloadingText
node at the end with a reference observer. It is used in the infinite scroll logic__internalDisplay
it is used in thecreatable
logic and will be${createdLabel} ${inputValue}
__internalInputValue
it is used in thecreatable
logic and will beinputValue
🚨 Breaking changes:
<CssBaseline/>
to the theme provider in your project:The onChange behavior of the Creatable Autocomplete component has been updated. When a new value is created, the format of the value passed to the onChange callback has changed.
Old behavior: When creating a new value, the onChange callback provided an object with the new value text stored in the name property. Example:
{ label: "New Text", value: "New Text", name: "New Text"}
New behavior: Now, the onChange callback provides the new value as a primitive string, instead of an object. Example:
"New Text"
The onChange behavior of the simpleValue Autocomplete has been updated. When using the Autocomplete with simpleValue mode enabled and options represented as a list of objects, the onChange event no longer automatically retrieves the desired value using the valueKey. You must now manually handle the event to extract the desired value from the selected option.
Old behavior: When the simpleValue prop was enabled, the onChange event would automatically return the value corresponding to the specified valueKey from the selected option.
New behavior: With the updated behavior, the onChange event now provides the full selected object. You are responsible for manually extracting the desired value based on the specified valueKey.