Skip to content

Commit

Permalink
3.2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
wwayne committed Feb 7, 2017
1 parent 0e43567 commit 6da857e
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 23 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
## Change Log

### 3.2.3 (2017/01/30 02:59 +00:00)
### 3.2.4 (2017/02/07 03:53 +00:00)
- [#251](https://github.com/wwayne/react-tooltip/pull/251) Dropfen dynamic wrapper (@dropfen)

### 3.2.3 (2017/01/30 03:00 +00:00)
- [#247](https://github.com/wwayne/react-tooltip/pull/247) Fix delayHide issue #246 (@huumanoid)
- [#238](https://github.com/wwayne/react-tooltip/pull/238) Update README.md (@nikbelikov)
- [#233](https://github.com/wwayne/react-tooltip/pull/233) Added more syntax highlighting (@oyeanuj)
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class | data-class | String | | extra custom class, can use !important to
disable | data-tip-disable | Bool | true, false | Disable the tooltip behaviour, default is false
scrollHide | data-scroll-hide | Bool | true, false | Hide the tooltip when scrolling, default is true
resizeHide | null | Bool | true, false | Hide the tooltip when resizing the window, default is true
wrapper | null | String | div, span | Selecting the wrapper element of the react tooltip, default is div

## Using react component as tooltip
Check the example [React-tooltip Test](http://wwayne.com/react-tooltip)
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": "react-tooltip",
"version": "3.2.3",
"version": "3.2.4",
"description": "react tooltip component",
"main": "dist/index.js",
"scripts": {
Expand Down
67 changes: 48 additions & 19 deletions standalone/react-tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,14 +160,28 @@ Object.defineProperty(exports, "__esModule", {
value: true
});

exports.default = function (target) {
target.prototype.getEffect = function (currentTarget) {
var dataEffect = currentTarget.getAttribute('data-effect');
return dataEffect || this.props.effect || 'float';
};
};

},{}],5:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
value: true
});

exports.default = function (target) {
target.prototype.isCapture = function (currentTarget) {
var dataIsCapture = currentTarget.getAttribute('data-iscapture');
return dataIsCapture && dataIsCapture === 'true' || this.props.isCapture || false;
};
};

},{}],5:[function(require,module,exports){
},{}],6:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
Expand Down Expand Up @@ -247,7 +261,7 @@ var dispatchGlobalEvent = function dispatchGlobalEvent(eventName, opts) {
* Static methods for react-tooltip
*/

},{"../constant":2}],6:[function(require,module,exports){
},{"../constant":2}],7:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
Expand Down Expand Up @@ -297,7 +311,7 @@ var _constant2 = _interopRequireDefault(_constant);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

},{"../constant":2}],7:[function(require,module,exports){
},{"../constant":2}],8:[function(require,module,exports){
(function (global){
'use strict';

Expand Down Expand Up @@ -344,6 +358,10 @@ var _isCapture = require('./decorators/isCapture');

var _isCapture2 = _interopRequireDefault(_isCapture);

var _getEffect = require('./decorators/getEffect');

var _getEffect2 = _interopRequireDefault(_getEffect);

var _getPosition = require('./utils/getPosition');

var _getPosition2 = _interopRequireDefault(_getPosition);
Expand All @@ -366,7 +384,7 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen

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; }

var ReactTooltip = (0, _staticMethods2.default)(_class = (0, _windowListener2.default)(_class = (0, _customEvent2.default)(_class = (0, _isCapture2.default)(_class = (_temp = _class2 = function (_Component) {
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) {
_inherits(ReactTooltip, _Component);

function ReactTooltip(props) {
Expand Down Expand Up @@ -474,9 +492,7 @@ var ReactTooltip = (0, _staticMethods2.default)(_class = (0, _windowListener2.de

// targetArray is a NodeList, convert it to a real array
// I hope I can use Object.values...
return Object.keys(targetArray).filter(function (key) {
return key !== 'length';
}).map(function (key) {
return Object.getOwnPropertyNames(targetArray).map(function (key) {
return targetArray[key];
});
}
Expand All @@ -499,6 +515,7 @@ var ReactTooltip = (0, _staticMethods2.default)(_class = (0, _windowListener2.de

targetArray.forEach(function (target) {
var isCaptureMode = _this3.isCapture(target);
var effect = _this3.getEffect(target);
if (target.getAttribute('currentItem') === null) {
target.setAttribute('currentItem', 'false');
}
Expand All @@ -510,7 +527,7 @@ var ReactTooltip = (0, _staticMethods2.default)(_class = (0, _windowListener2.de
}

target.addEventListener('mouseenter', _this3.showTooltip, isCaptureMode);
if (_this3.state.effect === 'float') {
if (effect === 'float') {
target.addEventListener('mousemove', _this3.updateTooltip, isCaptureMode);
}
target.addEventListener('mouseleave', _this3.hideTooltip, isCaptureMode);
Expand Down Expand Up @@ -610,12 +627,15 @@ var ReactTooltip = (0, _staticMethods2.default)(_class = (0, _windowListener2.de
scrollHide = this.props.scrollHide;
}

// To prevent previously created timers from triggering
this.clearTimer();

this.setState({
placeholder: placeholder,
isEmptyTip: isEmptyTip,
place: e.currentTarget.getAttribute('data-place') || this.props.place || 'top',
type: e.currentTarget.getAttribute('data-type') || this.props.type || 'dark',
effect: switchToSolid && 'solid' || e.currentTarget.getAttribute('data-effect') || this.props.effect || 'float',
effect: switchToSolid && 'solid' || this.getEffect(e.currentTarget),
offset: e.currentTarget.getAttribute('data-offset') || this.props.offset || {},
html: e.currentTarget.getAttribute('data-html') ? e.currentTarget.getAttribute('data-html') === 'true' : this.props.html || false,
delayShow: e.currentTarget.getAttribute('data-delay-show') || this.props.delayShow || 0,
Expand Down Expand Up @@ -816,14 +836,18 @@ var ReactTooltip = (0, _staticMethods2.default)(_class = (0, _windowListener2.de
var isEmptyTip = _state4.isEmptyTip;

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' });

var wrapper = ReactTooltip.supportedWrappers[this.props.wrapper];
if (!wrapper) wrapper = ReactTooltip.supportedWrappers['div'];

if (html) {
return _react2.default.createElement('div', _extends({ className: tooltipClass + ' ' + extraClass
return _react2.default.createElement('wrapper', _extends({ className: tooltipClass + ' ' + extraClass
}, ariaProps, {
'data-id': 'tooltip',
dangerouslySetInnerHTML: { __html: placeholder } }));
} else {
return _react2.default.createElement(
'div',
'wrapper',
_extends({ className: tooltipClass + ' ' + extraClass
}, ariaProps, {
'data-id': 'tooltip' }),
Expand Down Expand Up @@ -858,27 +882,32 @@ var ReactTooltip = (0, _staticMethods2.default)(_class = (0, _windowListener2.de
afterHide: _react.PropTypes.func,
disable: _react.PropTypes.bool,
scrollHide: _react.PropTypes.bool,
resizeHide: _react.PropTypes.bool
resizeHide: _react.PropTypes.bool,
wrapper: _react.PropTypes.string
}, _class2.defaultProps = {
insecure: true,
resizeHide: true
}, _temp)) || _class) || _class) || _class) || _class;
resizeHide: true,
wrapper: 'div'
}, _class2.supportedWrappers = {
'div': _react2.default.DOM.div,
'span': _react2.default.DOM.span
}, _temp)) || _class) || _class) || _class) || _class) || _class;

/* export default not fit for standalone, it will exports {default:...} */


module.exports = ReactTooltip;

}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"./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){
},{"./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){
'use strict';

Object.defineProperty(exports, "__esModule", {
value: true
});
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}';

},{}],9:[function(require,module,exports){
},{}],10:[function(require,module,exports){
"use strict";

Object.defineProperty(exports, "__esModule", {
Expand All @@ -904,7 +933,7 @@ function parseAria(props) {
return ariaObj;
}

},{}],10:[function(require,module,exports){
},{}],11:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
Expand Down Expand Up @@ -1219,7 +1248,7 @@ var getParent = function getParent(currentTarget) {
return { parentTop: parentTop, parentLeft: parentLeft };
};

},{}],11:[function(require,module,exports){
},{}],12:[function(require,module,exports){
(function (global){
'use strict';

Expand Down Expand Up @@ -1255,5 +1284,5 @@ var _react2 = _interopRequireDefault(_react);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{}]},{},[7])(7)
},{}]},{},[8])(8)
});
5 changes: 3 additions & 2 deletions standalone/react-tooltip.min.js

Large diffs are not rendered by default.

0 comments on commit 6da857e

Please sign in to comment.