@@ -11,7 +11,9 @@ class Dropdown extends React.Component {
11
11
disabled : React . PropTypes . bool ,
12
12
error : React . PropTypes . string ,
13
13
label : React . PropTypes . string ,
14
+ onBlur : React . PropTypes . func ,
14
15
onChange : React . PropTypes . func ,
16
+ onFocus : React . PropTypes . func ,
15
17
source : React . PropTypes . array . isRequired ,
16
18
template : React . PropTypes . func ,
17
19
value : React . PropTypes . string
@@ -33,10 +35,12 @@ class Dropdown extends React.Component {
33
35
const client = event . target . getBoundingClientRect ( ) ;
34
36
const screen_height = window . innerHeight || document . documentElement . offsetHeight ;
35
37
const up = this . props . auto ? client . top > ( ( screen_height / 2 ) + client . height ) : false ;
38
+ if ( this . props . onFocus ) this . props . onFocus ( ) ;
36
39
this . setState ( { active : true , up} ) ;
37
40
} ;
38
41
39
42
handleSelect = ( item , event ) => {
43
+ if ( this . props . onBlur ) this . props . onBlur ( ) ;
40
44
if ( ! this . props . disabled && this . props . onChange ) {
41
45
this . props . onChange ( item , event ) ;
42
46
this . setState ( { active : false } ) ;
0 commit comments