Skip to content

Commit

Permalink
Bump 0.4.6
Browse files Browse the repository at this point in the history
  • Loading branch information
kuy committed Feb 7, 2016
1 parent 78295eb commit b3b8716
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 9 deletions.
44 changes: 36 additions & 8 deletions lib/origin.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ var Origin = function (_Component) {
delete props['dispatch'];

if (!props.onMouseEnter) {
// Set default hover handler
props.onMouseEnter = function (e) {
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 }));
_this2.props.dispatch(action);
Expand All @@ -63,21 +62,48 @@ var Origin = function (_Component) {
}

if (!props.onMouseLeave) {
// Set default leave handler
props.onMouseLeave = function (e) {
var action = ['hide', 'both'].indexOf(_this2.props.delayOn) !== -1 ? _this2.createWithDelay(_actions.hide) : (0, _actions.hide)(_extends({}, _this2.props));
_this2.props.dispatch(action);
_this2.props.onLeave && _this2.props.onLeave(e);
};
}

return _react2.default.createElement(
'span',
_extends({ ref: 'wrapper' }, props),
this.props.children
);
return _react2.default.createElement(this.props.tagName, _extends({}, props, { ref: 'wrapper'
}));
}
}], [{
key: 'wrapBy',
value: function wrapBy(tagName) {
var CustomOrigin = function (_Origin) {
_inherits(CustomOrigin, _Origin);

function CustomOrigin() {
_classCallCheck(this, CustomOrigin);

return _possibleConstructorReturn(this, Object.getPrototypeOf(CustomOrigin).apply(this, arguments));
}

_createClass(CustomOrigin, null, [{
key: 'displayName',
get: function get() {
return Origin.displayName + '.' + tagName;
}
}, {
key: 'defaultProps',
get: function get() {
return _extends({}, Origin.defaultProps, {
tagName: tagName
});
}
}]);

return CustomOrigin;
}(Origin);

return (0, _reactRedux.connect)()(CustomOrigin);
}
}, {
key: 'displayName',
get: function get() {
return 'Origin';
Expand All @@ -91,6 +117,7 @@ var Origin = function (_Component) {
place: _react.PropTypes.oneOfType([_react.PropTypes.string, _react.PropTypes.arrayOf(_react.PropTypes.string)]),
delay: _react.PropTypes.oneOfType([_react.PropTypes.bool, _react.PropTypes.number, _react.PropTypes.string]),
delayOn: _react.PropTypes.oneOf(['show', 'hide', 'both']),
tagName: _react.PropTypes.string,
onMouseEnter: _react.PropTypes.func,
onMouseLeave: _react.PropTypes.func
};
Expand All @@ -99,7 +126,8 @@ var Origin = function (_Component) {
key: 'defaultProps',
get: function get() {
return {
delayOn: 'hide'
delayOn: 'hide',
tagName: 'span'
};
}
}]);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "redux-tooltip",
"version": "0.4.5",
"version": "0.4.6",
"description": "A tooltip React component for Redux",
"main": "./lib/index.js",
"repository": {
Expand Down

0 comments on commit b3b8716

Please sign in to comment.