@@ -54,7 +54,6 @@ var Origin = function (_Component) {
54
54
delete props [ 'dispatch' ] ;
55
55
56
56
if ( ! props . onMouseEnter ) {
57
- // Set default hover handler
58
57
props . onMouseEnter = function ( e ) {
59
58
var action = [ 'show' , 'both' ] . indexOf ( _this2 . props . delayOn ) !== - 1 ? _this2 . createWithDelay ( _actions . show , { el : e . target } ) : ( 0 , _actions . show ) ( _extends ( { } , _this2 . props , { el : e . target } ) ) ;
60
59
_this2 . props . dispatch ( action ) ;
@@ -63,21 +62,48 @@ var Origin = function (_Component) {
63
62
}
64
63
65
64
if ( ! props . onMouseLeave ) {
66
- // Set default leave handler
67
65
props . onMouseLeave = function ( e ) {
68
66
var action = [ 'hide' , 'both' ] . indexOf ( _this2 . props . delayOn ) !== - 1 ? _this2 . createWithDelay ( _actions . hide ) : ( 0 , _actions . hide ) ( _extends ( { } , _this2 . props ) ) ;
69
67
_this2 . props . dispatch ( action ) ;
70
68
_this2 . props . onLeave && _this2 . props . onLeave ( e ) ;
71
69
} ;
72
70
}
73
71
74
- return _react2 . default . createElement (
75
- 'span' ,
76
- _extends ( { ref : 'wrapper' } , props ) ,
77
- this . props . children
78
- ) ;
72
+ return _react2 . default . createElement ( this . props . tagName , _extends ( { } , props , { ref : 'wrapper'
73
+ } ) ) ;
79
74
}
80
75
} ] , [ {
76
+ key : 'wrapBy' ,
77
+ value : function wrapBy ( tagName ) {
78
+ var CustomOrigin = function ( _Origin ) {
79
+ _inherits ( CustomOrigin , _Origin ) ;
80
+
81
+ function CustomOrigin ( ) {
82
+ _classCallCheck ( this , CustomOrigin ) ;
83
+
84
+ return _possibleConstructorReturn ( this , Object . getPrototypeOf ( CustomOrigin ) . apply ( this , arguments ) ) ;
85
+ }
86
+
87
+ _createClass ( CustomOrigin , null , [ {
88
+ key : 'displayName' ,
89
+ get : function get ( ) {
90
+ return Origin . displayName + '.' + tagName ;
91
+ }
92
+ } , {
93
+ key : 'defaultProps' ,
94
+ get : function get ( ) {
95
+ return _extends ( { } , Origin . defaultProps , {
96
+ tagName : tagName
97
+ } ) ;
98
+ }
99
+ } ] ) ;
100
+
101
+ return CustomOrigin ;
102
+ } ( Origin ) ;
103
+
104
+ return ( 0 , _reactRedux . connect ) ( ) ( CustomOrigin ) ;
105
+ }
106
+ } , {
81
107
key : 'displayName' ,
82
108
get : function get ( ) {
83
109
return 'Origin' ;
@@ -91,6 +117,7 @@ var Origin = function (_Component) {
91
117
place : _react . PropTypes . oneOfType ( [ _react . PropTypes . string , _react . PropTypes . arrayOf ( _react . PropTypes . string ) ] ) ,
92
118
delay : _react . PropTypes . oneOfType ( [ _react . PropTypes . bool , _react . PropTypes . number , _react . PropTypes . string ] ) ,
93
119
delayOn : _react . PropTypes . oneOf ( [ 'show' , 'hide' , 'both' ] ) ,
120
+ tagName : _react . PropTypes . string ,
94
121
onMouseEnter : _react . PropTypes . func ,
95
122
onMouseLeave : _react . PropTypes . func
96
123
} ;
@@ -99,7 +126,8 @@ var Origin = function (_Component) {
99
126
key : 'defaultProps' ,
100
127
get : function get ( ) {
101
128
return {
102
- delayOn : 'hide'
129
+ delayOn : 'hide' ,
130
+ tagName : 'span'
103
131
} ;
104
132
}
105
133
} ] ) ;
0 commit comments