File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
packages/components/src/components/single-select Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -87,10 +87,15 @@ export class KolSingleSelect implements SingleSelectAPI {
8787 * Closes the dropdown and resets the opened state.
8888 */
8989 private onBlur ( ) {
90- if ( Array . isArray ( this . state . _options ) && this . state . _options . length > 0 && ! this . state . _options . some ( ( option ) => option . label === this . _inputValue ) ) {
91- this . _inputValue = this . state . _options . find ( ( option ) => ( option as Option < string > ) . value === this . _value ) ?. label as string ;
90+ const matchingOption = this . state . _options ?. find ( ( option ) => ( option . label as string ) ?. toLowerCase ( ) === this . _inputValue ?. toLowerCase ( ) ) ;
91+
92+ if ( matchingOption ) {
93+ this . selectOption ( matchingOption as Option < string > ) ;
94+ } else {
95+ this . _inputValue = this . state . _options ?. find ( ( option ) => ( option as Option < string > ) . value === this . _value ) ?. label as string ;
9296 this . _filteredOptions = [ ...this . state . _options ] ;
9397 }
98+
9499 this . _isOpen = false ;
95100 this . _hasOpened = false ;
96101 }
You can’t perform that action at this time.
0 commit comments