@@ -160,14 +160,28 @@ Object.defineProperty(exports, "__esModule", {
160
160
value : true
161
161
} ) ;
162
162
163
+ exports . default = function ( target ) {
164
+ target . prototype . getEffect = function ( currentTarget ) {
165
+ var dataEffect = currentTarget . getAttribute ( 'data-effect' ) ;
166
+ return dataEffect || this . props . effect || 'float' ;
167
+ } ;
168
+ } ;
169
+
170
+ } , { } ] , 5 :[ function ( require , module , exports ) {
171
+ 'use strict' ;
172
+
173
+ Object . defineProperty ( exports , "__esModule" , {
174
+ value : true
175
+ } ) ;
176
+
163
177
exports . default = function ( target ) {
164
178
target . prototype . isCapture = function ( currentTarget ) {
165
179
var dataIsCapture = currentTarget . getAttribute ( 'data-iscapture' ) ;
166
180
return dataIsCapture && dataIsCapture === 'true' || this . props . isCapture || false ;
167
181
} ;
168
182
} ;
169
183
170
- } , { } ] , 5 :[ function ( require , module , exports ) {
184
+ } , { } ] , 6 :[ function ( require , module , exports ) {
171
185
'use strict' ;
172
186
173
187
Object . defineProperty ( exports , "__esModule" , {
@@ -247,7 +261,7 @@ var dispatchGlobalEvent = function dispatchGlobalEvent(eventName, opts) {
247
261
* Static methods for react-tooltip
248
262
*/
249
263
250
- } , { "../constant" :2 } ] , 6 :[ function ( require , module , exports ) {
264
+ } , { "../constant" :2 } ] , 7 :[ function ( require , module , exports ) {
251
265
'use strict' ;
252
266
253
267
Object . defineProperty ( exports , "__esModule" , {
@@ -297,7 +311,7 @@ var _constant2 = _interopRequireDefault(_constant);
297
311
298
312
function _interopRequireDefault ( obj ) { return obj && obj . __esModule ? obj : { default : obj } ; }
299
313
300
- } , { "../constant" :2 } ] , 7 :[ function ( require , module , exports ) {
314
+ } , { "../constant" :2 } ] , 8 :[ function ( require , module , exports ) {
301
315
( function ( global ) {
302
316
'use strict' ;
303
317
@@ -344,6 +358,10 @@ var _isCapture = require('./decorators/isCapture');
344
358
345
359
var _isCapture2 = _interopRequireDefault ( _isCapture ) ;
346
360
361
+ var _getEffect = require ( './decorators/getEffect' ) ;
362
+
363
+ var _getEffect2 = _interopRequireDefault ( _getEffect ) ;
364
+
347
365
var _getPosition = require ( './utils/getPosition' ) ;
348
366
349
367
var _getPosition2 = _interopRequireDefault ( _getPosition ) ;
@@ -366,7 +384,7 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen
366
384
367
385
function _inherits ( subClass , superClass ) { if ( typeof superClass !== "function" && superClass !== null ) { throw new TypeError ( "Super expression must either be null or a function, not " + typeof superClass ) ; } subClass . prototype = Object . create ( superClass && superClass . prototype , { constructor : { value : subClass , enumerable : false , writable : true , configurable : true } } ) ; if ( superClass ) Object . setPrototypeOf ? Object . setPrototypeOf ( subClass , superClass ) : subClass . __proto__ = superClass ; }
368
386
369
- var ReactTooltip = ( 0 , _staticMethods2 . default ) ( _class = ( 0 , _windowListener2 . default ) ( _class = ( 0 , _customEvent2 . default ) ( _class = ( 0 , _isCapture2 . default ) ( _class = ( _temp = _class2 = function ( _Component ) {
387
+ var ReactTooltip = ( 0 , _staticMethods2 . default ) ( _class = ( 0 , _windowListener2 . default ) ( _class = ( 0 , _customEvent2 . default ) ( _class = ( 0 , _isCapture2 . default ) ( _class = ( 0 , _getEffect2 . default ) ( _class = ( _temp = _class2 = function ( _Component ) {
370
388
_inherits ( ReactTooltip , _Component ) ;
371
389
372
390
function ReactTooltip ( props ) {
@@ -474,9 +492,7 @@ var ReactTooltip = (0, _staticMethods2.default)(_class = (0, _windowListener2.de
474
492
475
493
// targetArray is a NodeList, convert it to a real array
476
494
// I hope I can use Object.values...
477
- return Object . keys ( targetArray ) . filter ( function ( key ) {
478
- return key !== 'length' ;
479
- } ) . map ( function ( key ) {
495
+ return Object . getOwnPropertyNames ( targetArray ) . map ( function ( key ) {
480
496
return targetArray [ key ] ;
481
497
} ) ;
482
498
}
@@ -499,6 +515,7 @@ var ReactTooltip = (0, _staticMethods2.default)(_class = (0, _windowListener2.de
499
515
500
516
targetArray . forEach ( function ( target ) {
501
517
var isCaptureMode = _this3 . isCapture ( target ) ;
518
+ var effect = _this3 . getEffect ( target ) ;
502
519
if ( target . getAttribute ( 'currentItem' ) === null ) {
503
520
target . setAttribute ( 'currentItem' , 'false' ) ;
504
521
}
@@ -510,7 +527,7 @@ var ReactTooltip = (0, _staticMethods2.default)(_class = (0, _windowListener2.de
510
527
}
511
528
512
529
target . addEventListener ( 'mouseenter' , _this3 . showTooltip , isCaptureMode ) ;
513
- if ( _this3 . state . effect === 'float' ) {
530
+ if ( effect === 'float' ) {
514
531
target . addEventListener ( 'mousemove' , _this3 . updateTooltip , isCaptureMode ) ;
515
532
}
516
533
target . addEventListener ( 'mouseleave' , _this3 . hideTooltip , isCaptureMode ) ;
@@ -610,12 +627,15 @@ var ReactTooltip = (0, _staticMethods2.default)(_class = (0, _windowListener2.de
610
627
scrollHide = this . props . scrollHide ;
611
628
}
612
629
630
+ // To prevent previously created timers from triggering
631
+ this . clearTimer ( ) ;
632
+
613
633
this . setState ( {
614
634
placeholder : placeholder ,
615
635
isEmptyTip : isEmptyTip ,
616
636
place : e . currentTarget . getAttribute ( 'data-place' ) || this . props . place || 'top' ,
617
637
type : e . currentTarget . getAttribute ( 'data-type' ) || this . props . type || 'dark' ,
618
- effect : switchToSolid && 'solid' || e . currentTarget . getAttribute ( 'data-effect' ) || this . props . effect || 'float' ,
638
+ effect : switchToSolid && 'solid' || this . getEffect ( e . currentTarget ) ,
619
639
offset : e . currentTarget . getAttribute ( 'data-offset' ) || this . props . offset || { } ,
620
640
html : e . currentTarget . getAttribute ( 'data-html' ) ? e . currentTarget . getAttribute ( 'data-html' ) === 'true' : this . props . html || false ,
621
641
delayShow : e . currentTarget . getAttribute ( 'data-delay-show' ) || this . props . delayShow || 0 ,
@@ -816,14 +836,18 @@ var ReactTooltip = (0, _staticMethods2.default)(_class = (0, _windowListener2.de
816
836
var isEmptyTip = _state4 . isEmptyTip ;
817
837
818
838
var tooltipClass = ( 0 , _classnames2 . default ) ( '__react_component_tooltip' , { 'show' : this . state . show && ! disable && ! isEmptyTip } , { 'border' : this . state . border } , { 'place-top' : this . state . place === 'top' } , { 'place-bottom' : this . state . place === 'bottom' } , { 'place-left' : this . state . place === 'left' } , { 'place-right' : this . state . place === 'right' } , { 'type-dark' : this . state . type === 'dark' } , { 'type-success' : this . state . type === 'success' } , { 'type-warning' : this . state . type === 'warning' } , { 'type-error' : this . state . type === 'error' } , { 'type-info' : this . state . type === 'info' } , { 'type-light' : this . state . type === 'light' } ) ;
839
+
840
+ var wrapper = ReactTooltip . supportedWrappers [ this . props . wrapper ] ;
841
+ if ( ! wrapper ) wrapper = ReactTooltip . supportedWrappers [ 'div' ] ;
842
+
819
843
if ( html ) {
820
- return _react2 . default . createElement ( 'div ' , _extends ( { className : tooltipClass + ' ' + extraClass
844
+ return _react2 . default . createElement ( 'wrapper ' , _extends ( { className : tooltipClass + ' ' + extraClass
821
845
} , ariaProps , {
822
846
'data-id' : 'tooltip' ,
823
847
dangerouslySetInnerHTML : { __html : placeholder } } ) ) ;
824
848
} else {
825
849
return _react2 . default . createElement (
826
- 'div ' ,
850
+ 'wrapper ' ,
827
851
_extends ( { className : tooltipClass + ' ' + extraClass
828
852
} , ariaProps , {
829
853
'data-id' : 'tooltip' } ) ,
@@ -858,27 +882,32 @@ var ReactTooltip = (0, _staticMethods2.default)(_class = (0, _windowListener2.de
858
882
afterHide : _react . PropTypes . func ,
859
883
disable : _react . PropTypes . bool ,
860
884
scrollHide : _react . PropTypes . bool ,
861
- resizeHide : _react . PropTypes . bool
885
+ resizeHide : _react . PropTypes . bool ,
886
+ wrapper : _react . PropTypes . string
862
887
} , _class2 . defaultProps = {
863
888
insecure : true ,
864
- resizeHide : true
865
- } , _temp ) ) || _class ) || _class ) || _class ) || _class ;
889
+ resizeHide : true ,
890
+ wrapper : 'div'
891
+ } , _class2 . supportedWrappers = {
892
+ 'div' : _react2 . default . DOM . div ,
893
+ 'span' : _react2 . default . DOM . span
894
+ } , _temp ) ) || _class ) || _class ) || _class ) || _class ) || _class ;
866
895
867
896
/* export default not fit for standalone, it will exports {default:...} */
868
897
869
898
870
899
module . exports = ReactTooltip ;
871
900
872
901
} ) . call ( this , typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : { } )
873
- } , { "./decorators/customEvent" :3 , "./decorators/isCapture " :4 , "./decorators/staticMethods " :5 , "./decorators/windowListener " :6 , "./style" :8 , "./utils/aria" :9 , "./utils/getPosition" :10 , "./utils/getTipContent" :11 , "classnames" :1 } ] , 8 :[ function ( require , module , exports ) {
902
+ } , { "./decorators/customEvent" :3 , "./decorators/getEffect " :4 , "./decorators/isCapture " :5 , "./decorators/staticMethods " :6 , "./decorators/windowListener" : 7 , "./ style" :9 , "./utils/aria" :10 , "./utils/getPosition" :11 , "./utils/getTipContent" :12 , "classnames" :1 } ] , 9 :[ function ( require , module , exports ) {
874
903
'use strict' ;
875
904
876
905
Object . defineProperty ( exports , "__esModule" , {
877
906
value : true
878
907
} ) ;
879
908
exports . default = '.__react_component_tooltip{border-radius:3px;display:inline-block;font-size:13px;left:-999em;opacity:0;padding:8px 21px;position:fixed;pointer-events:none;transition:opacity 0.3s ease-out;top:-999em;visibility:hidden;z-index:999}.__react_component_tooltip:before,.__react_component_tooltip:after{content:"";width:0;height:0;position:absolute}.__react_component_tooltip.show{opacity:0.9;margin-top:0px;margin-left:0px;visibility:visible}.__react_component_tooltip.type-dark{color:#fff;background-color:#222}.__react_component_tooltip.type-dark.place-top:after{border-top-color:#222;border-top-style:solid;border-top-width:6px}.__react_component_tooltip.type-dark.place-bottom:after{border-bottom-color:#222;border-bottom-style:solid;border-bottom-width:6px}.__react_component_tooltip.type-dark.place-left:after{border-left-color:#222;border-left-style:solid;border-left-width:6px}.__react_component_tooltip.type-dark.place-right:after{border-right-color:#222;border-right-style:solid;border-right-width:6px}.__react_component_tooltip.type-dark.border{border:1px solid #fff}.__react_component_tooltip.type-dark.border.place-top:before{border-top:8px solid #fff}.__react_component_tooltip.type-dark.border.place-bottom:before{border-bottom:8px solid #fff}.__react_component_tooltip.type-dark.border.place-left:before{border-left:8px solid #fff}.__react_component_tooltip.type-dark.border.place-right:before{border-right:8px solid #fff}.__react_component_tooltip.type-success{color:#fff;background-color:#8DC572}.__react_component_tooltip.type-success.place-top:after{border-top-color:#8DC572;border-top-style:solid;border-top-width:6px}.__react_component_tooltip.type-success.place-bottom:after{border-bottom-color:#8DC572;border-bottom-style:solid;border-bottom-width:6px}.__react_component_tooltip.type-success.place-left:after{border-left-color:#8DC572;border-left-style:solid;border-left-width:6px}.__react_component_tooltip.type-success.place-right:after{border-right-color:#8DC572;border-right-style:solid;border-right-width:6px}.__react_component_tooltip.type-success.border{border:1px solid #fff}.__react_component_tooltip.type-success.border.place-top:before{border-top:8px solid #fff}.__react_component_tooltip.type-success.border.place-bottom:before{border-bottom:8px solid #fff}.__react_component_tooltip.type-success.border.place-left:before{border-left:8px solid #fff}.__react_component_tooltip.type-success.border.place-right:before{border-right:8px solid #fff}.__react_component_tooltip.type-warning{color:#fff;background-color:#F0AD4E}.__react_component_tooltip.type-warning.place-top:after{border-top-color:#F0AD4E;border-top-style:solid;border-top-width:6px}.__react_component_tooltip.type-warning.place-bottom:after{border-bottom-color:#F0AD4E;border-bottom-style:solid;border-bottom-width:6px}.__react_component_tooltip.type-warning.place-left:after{border-left-color:#F0AD4E;border-left-style:solid;border-left-width:6px}.__react_component_tooltip.type-warning.place-right:after{border-right-color:#F0AD4E;border-right-style:solid;border-right-width:6px}.__react_component_tooltip.type-warning.border{border:1px solid #fff}.__react_component_tooltip.type-warning.border.place-top:before{border-top:8px solid #fff}.__react_component_tooltip.type-warning.border.place-bottom:before{border-bottom:8px solid #fff}.__react_component_tooltip.type-warning.border.place-left:before{border-left:8px solid #fff}.__react_component_tooltip.type-warning.border.place-right:before{border-right:8px solid #fff}.__react_component_tooltip.type-error{color:#fff;background-color:#BE6464}.__react_component_tooltip.type-error.place-top:after{border-top-color:#BE6464;border-top-style:solid;border-top-width:6px}.__react_component_tooltip.type-error.place-bottom:after{border-bottom-color:#BE6464;border-bottom-style:solid;border-bottom-width:6px}.__react_component_tooltip.type-error.place-left:after{border-left-color:#BE6464;border-left-style:solid;border-left-width:6px}.__react_component_tooltip.type-error.place-right:after{border-right-color:#BE6464;border-right-style:solid;border-right-width:6px}.__react_component_tooltip.type-error.border{border:1px solid #fff}.__react_component_tooltip.type-error.border.place-top:before{border-top:8px solid #fff}.__react_component_tooltip.type-error.border.place-bottom:before{border-bottom:8px solid #fff}.__react_component_tooltip.type-error.border.place-left:before{border-left:8px solid #fff}.__react_component_tooltip.type-error.border.place-right:before{border-right:8px solid #fff}.__react_component_tooltip.type-info{color:#fff;background-color:#337AB7}.__react_component_tooltip.type-info.place-top:after{border-top-color:#337AB7;border-top-style:solid;border-top-width:6px}.__react_component_tooltip.type-info.place-bottom:after{border-bottom-color:#337AB7;border-bottom-style:solid;border-bottom-width:6px}.__react_component_tooltip.type-info.place-left:after{border-left-color:#337AB7;border-left-style:solid;border-left-width:6px}.__react_component_tooltip.type-info.place-right:after{border-right-color:#337AB7;border-right-style:solid;border-right-width:6px}.__react_component_tooltip.type-info.border{border:1px solid #fff}.__react_component_tooltip.type-info.border.place-top:before{border-top:8px solid #fff}.__react_component_tooltip.type-info.border.place-bottom:before{border-bottom:8px solid #fff}.__react_component_tooltip.type-info.border.place-left:before{border-left:8px solid #fff}.__react_component_tooltip.type-info.border.place-right:before{border-right:8px solid #fff}.__react_component_tooltip.type-light{color:#222;background-color:#fff}.__react_component_tooltip.type-light.place-top:after{border-top-color:#fff;border-top-style:solid;border-top-width:6px}.__react_component_tooltip.type-light.place-bottom:after{border-bottom-color:#fff;border-bottom-style:solid;border-bottom-width:6px}.__react_component_tooltip.type-light.place-left:after{border-left-color:#fff;border-left-style:solid;border-left-width:6px}.__react_component_tooltip.type-light.place-right:after{border-right-color:#fff;border-right-style:solid;border-right-width:6px}.__react_component_tooltip.type-light.border{border:1px solid #222}.__react_component_tooltip.type-light.border.place-top:before{border-top:8px solid #222}.__react_component_tooltip.type-light.border.place-bottom:before{border-bottom:8px solid #222}.__react_component_tooltip.type-light.border.place-left:before{border-left:8px solid #222}.__react_component_tooltip.type-light.border.place-right:before{border-right:8px solid #222}.__react_component_tooltip.place-top{margin-top:-10px}.__react_component_tooltip.place-top:before{border-left:10px solid transparent;border-right:10px solid transparent;bottom:-8px;left:50%;margin-left:-10px}.__react_component_tooltip.place-top:after{border-left:8px solid transparent;border-right:8px solid transparent;bottom:-6px;left:50%;margin-left:-8px}.__react_component_tooltip.place-bottom{margin-top:10px}.__react_component_tooltip.place-bottom:before{border-left:10px solid transparent;border-right:10px solid transparent;top:-8px;left:50%;margin-left:-10px}.__react_component_tooltip.place-bottom:after{border-left:8px solid transparent;border-right:8px solid transparent;top:-6px;left:50%;margin-left:-8px}.__react_component_tooltip.place-left{margin-left:-10px}.__react_component_tooltip.place-left:before{border-top:6px solid transparent;border-bottom:6px solid transparent;right:-8px;top:50%;margin-top:-5px}.__react_component_tooltip.place-left:after{border-top:5px solid transparent;border-bottom:5px solid transparent;right:-6px;top:50%;margin-top:-4px}.__react_component_tooltip.place-right{margin-left:10px}.__react_component_tooltip.place-right:before{border-top:6px solid transparent;border-bottom:6px solid transparent;left:-8px;top:50%;margin-top:-5px}.__react_component_tooltip.place-right:after{border-top:5px solid transparent;border-bottom:5px solid transparent;left:-6px;top:50%;margin-top:-4px}.__react_component_tooltip .multi-line{display:block;padding:2px 0px;text-align:center}' ;
880
909
881
- } , { } ] , 9 :[ function ( require , module , exports ) {
910
+ } , { } ] , 10 :[ function ( require , module , exports ) {
882
911
"use strict" ;
883
912
884
913
Object . defineProperty ( exports , "__esModule" , {
@@ -904,7 +933,7 @@ function parseAria(props) {
904
933
return ariaObj ;
905
934
}
906
935
907
- } , { } ] , 10 :[ function ( require , module , exports ) {
936
+ } , { } ] , 11 :[ function ( require , module , exports ) {
908
937
'use strict' ;
909
938
910
939
Object . defineProperty ( exports , "__esModule" , {
@@ -1219,7 +1248,7 @@ var getParent = function getParent(currentTarget) {
1219
1248
return { parentTop : parentTop , parentLeft : parentLeft } ;
1220
1249
} ;
1221
1250
1222
- } , { } ] , 11 :[ function ( require , module , exports ) {
1251
+ } , { } ] , 12 :[ function ( require , module , exports ) {
1223
1252
( function ( global ) {
1224
1253
'use strict' ;
1225
1254
@@ -1255,5 +1284,5 @@ var _react2 = _interopRequireDefault(_react);
1255
1284
function _interopRequireDefault ( obj ) { return obj && obj . __esModule ? obj : { default : obj } ; }
1256
1285
1257
1286
} ) . call ( this , typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : { } )
1258
- } , { } ] } , { } , [ 7 ] ) ( 7 )
1287
+ } , { } ] } , { } , [ 8 ] ) ( 8 )
1259
1288
} ) ;
0 commit comments