@@ -39,25 +39,22 @@ class SLDSTooltip extends React.Component {
39
39
} ;
40
40
}
41
41
42
- componentDidMount ( ) {
43
- } ,
44
-
45
- handleMouseClick ( event ) {
42
+ handleMouseClick ( ) {
46
43
this . setState ( {
47
44
isOpen : ! this . state . isOpen ,
48
45
isClosing : ! this . state . isOpen
49
46
} ) ;
50
- } ,
47
+ }
51
48
52
49
53
- handleMouseEnter ( event ) {
50
+ handleMouseEnter ( ) {
54
51
this . setState ( {
55
52
isOpen : true ,
56
53
isClosing : false
57
54
} ) ;
58
- } ,
55
+ }
59
56
60
- handleMouseLeave ( event ) {
57
+ handleMouseLeave ( ) {
61
58
this . setState ( { isClosing : true } ) ;
62
59
setTimeout ( ( ) => {
63
60
if ( this . isMounted && this . state . isClosing ) {
@@ -67,11 +64,11 @@ class SLDSTooltip extends React.Component {
67
64
} ) ;
68
65
}
69
66
} , this . props . hoverCloseDelay )
70
- } ,
67
+ }
71
68
72
69
getTooltipContent ( ) {
73
70
return < div className = 'slds-popover__body' > { this . props . content } </ div > ;
74
- } ,
71
+ }
75
72
76
73
getHorizontalAlign ( ) {
77
74
if ( this . props . align === 'left' ) {
@@ -81,7 +78,7 @@ class SLDSTooltip extends React.Component {
81
78
return 'right' ;
82
79
}
83
80
return 'center' ;
84
- } ,
81
+ }
85
82
86
83
getVerticalAlign ( ) {
87
84
if ( this . props . align === 'bottom' ) {
@@ -91,14 +88,14 @@ class SLDSTooltip extends React.Component {
91
88
return 'top' ;
92
89
}
93
90
return 'middle' ;
94
- } ,
91
+ }
95
92
96
93
handleCancel ( ) {
97
94
this . setState ( {
98
95
isOpen : false ,
99
96
isClosing : false
100
97
} ) ;
101
- } ,
98
+ }
102
99
103
100
getTooltip ( ) {
104
101
const style = {
@@ -127,18 +124,18 @@ class SLDSTooltip extends React.Component {
127
124
{ this . getTooltipContent ( ) }
128
125
</ div >
129
126
</ SLDSPopover > :null ;
130
- } ,
127
+ }
131
128
132
129
render ( ) {
133
130
return (
134
- < span refs = 'tooltipTarget' onClick = { this . props . openOn === 'click' ? this . handleMouseClick :null } onMouseEnter = { this . props . openOn === 'hover' ? this . handleMouseEnter :null } onMouseLeave = { this . props . openOn === 'hover' ? this . handleMouseLeave :null } >
131
+ < span refs = 'tooltipTarget' onClick = { this . props . openOn === 'click' ? this . handleMouseClick :null } onMouseEnter = { this . props . openOn === 'hover' ? this . handleMouseEnter . bind ( this ) :null } onMouseLeave = { this . props . openOn === 'hover' ? this . handleMouseLeave . bind ( this ) :null } >
135
132
{ this . props . children }
136
133
{ this . getTooltip ( ) }
137
134
</ span >
138
135
) ;
139
136
}
140
137
141
- } ;
138
+ }
142
139
143
140
144
141
SLDSTooltip . displayName = displayName ;
0 commit comments