@@ -33,22 +33,12 @@ function DropdownTerms({
33
33
let inputField ;
34
34
useEffect ( ( ) => {
35
35
const selectInput = containerRef . current . getElementsByClassName ( 'Select-input' ) ;
36
- const selectMenuOuter = containerRef . current . getElementsByClassName ( 'Select-menu-outer' ) ;
37
36
if ( selectInput && selectInput . length ) {
38
- const selectControl = containerRef . current . getElementsByClassName (
39
- 'Select-control' ,
40
- ) ;
41
- const height1 = selectMenuOuter && selectMenuOuter . length
42
- ? selectMenuOuter [ 0 ] . offsetHeight
43
- : 0 ;
44
- const height2 = selectControl && selectControl . length
45
- ? selectControl [ 0 ] . offsetHeight
46
- : 0 ;
47
- selectInput [ 0 ] . style . top = focused ? `${ height1 + height2 - 1 } px` : '0' ;
48
37
inputField = selectInput [ 0 ] . getElementsByTagName ( 'input' ) ;
49
38
inputField [ 0 ] . placeholder = focused ? addNewOptionPlaceholder : '' ;
50
39
inputField [ 0 ] . style . border = 'none' ;
51
40
inputField [ 0 ] . style . boxShadow = 'none' ;
41
+ selectInput [ 0 ] . style . borderTop = 'none' ;
52
42
}
53
43
} , [ focused , selectedOption ] ) ;
54
44
@@ -145,9 +135,13 @@ function DropdownTerms({
145
135
backspaceRemoves = { false }
146
136
multi
147
137
promptTextCreator = { ( ) => null }
148
- filterOptions = { ( ) => _ . filter (
149
- internalTerms , t => ! _ . find ( selectedOption , { label : t . label } ) ,
150
- ) . map ( o => ( { value : o . label , label : o . label } ) ) }
138
+ filterOptions = { ( option , inputValue ) => _ . filter (
139
+ internalTerms ,
140
+ t => ( inputValue && inputValue . length >= 2
141
+ ? t . label . toLowerCase ( ) . includes ( inputValue . toLowerCase ( ) )
142
+ && ! _ . find ( selectedOption , { label : t . label } )
143
+ : ! _ . find ( selectedOption , { label : t . label } ) ) ,
144
+ ) }
151
145
/>
152
146
< img width = "15" height = "9" styleName = "iconDropdown" src = { iconDown } alt = "dropdown-arrow-icon" />
153
147
</ div >
0 commit comments