rc-tooltip
Advanced tools
Comparing version 3.4.2 to 3.4.3
# History | ||
---- | ||
### 3.4.3 | ||
- Fix `createClass` and `PropTypes` warning. | ||
### 3.4.0 | ||
@@ -71,2 +75,2 @@ | ||
add defaultVisible and onVisibleChange | ||
add defaultVisible and onVisibleChange |
@@ -7,4 +7,22 @@ 'use strict'; | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var _extends2 = require('babel-runtime/helpers/extends'); | ||
var _extends3 = _interopRequireDefault(_extends2); | ||
var _objectWithoutProperties2 = require('babel-runtime/helpers/objectWithoutProperties'); | ||
var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2); | ||
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck'); | ||
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); | ||
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn'); | ||
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); | ||
var _inherits2 = require('babel-runtime/helpers/inherits'); | ||
var _inherits3 = _interopRequireDefault(_inherits2); | ||
var _react = require('react'); | ||
@@ -14,4 +32,6 @@ | ||
var _placements = require('./placements'); | ||
var _propTypes = require('prop-types'); | ||
var _propTypes2 = _interopRequireDefault(_propTypes); | ||
var _rcTrigger = require('rc-trigger'); | ||
@@ -21,83 +41,60 @@ | ||
var _placements = require('./placements'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } | ||
var Tooltip = function (_Component) { | ||
(0, _inherits3["default"])(Tooltip, _Component); | ||
var Tooltip = _react2["default"].createClass({ | ||
displayName: 'Tooltip', | ||
function Tooltip() { | ||
var _temp, _this, _ret; | ||
propTypes: { | ||
trigger: _react.PropTypes.any, | ||
children: _react.PropTypes.any, | ||
defaultVisible: _react.PropTypes.bool, | ||
visible: _react.PropTypes.bool, | ||
placement: _react.PropTypes.string, | ||
transitionName: _react.PropTypes.string, | ||
animation: _react.PropTypes.any, | ||
onVisibleChange: _react.PropTypes.func, | ||
afterVisibleChange: _react.PropTypes.func, | ||
overlay: _react.PropTypes.oneOfType([_react2["default"].PropTypes.node, _react2["default"].PropTypes.func]).isRequired, | ||
overlayStyle: _react.PropTypes.object, | ||
overlayClassName: _react.PropTypes.string, | ||
prefixCls: _react.PropTypes.string, | ||
mouseEnterDelay: _react.PropTypes.number, | ||
mouseLeaveDelay: _react.PropTypes.number, | ||
getTooltipContainer: _react.PropTypes.func, | ||
destroyTooltipOnHide: _react.PropTypes.bool, | ||
align: _react.PropTypes.object, | ||
arrowContent: _react.PropTypes.any | ||
}, | ||
(0, _classCallCheck3["default"])(this, Tooltip); | ||
getDefaultProps: function getDefaultProps() { | ||
return { | ||
prefixCls: 'rc-tooltip', | ||
mouseEnterDelay: 0, | ||
destroyTooltipOnHide: false, | ||
mouseLeaveDelay: 0.1, | ||
align: {}, | ||
placement: 'right', | ||
trigger: ['hover'], | ||
arrowContent: null | ||
}; | ||
}, | ||
getPopupElement: function getPopupElement() { | ||
var _props = this.props; | ||
var arrowContent = _props.arrowContent; | ||
var overlay = _props.overlay; | ||
var prefixCls = _props.prefixCls; | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
return [_react2["default"].createElement( | ||
'div', | ||
{ className: prefixCls + '-arrow', key: 'arrow' }, | ||
arrowContent | ||
), _react2["default"].createElement( | ||
'div', | ||
{ className: prefixCls + '-inner', key: 'content' }, | ||
typeof overlay === 'function' ? overlay() : overlay | ||
)]; | ||
}, | ||
getPopupDomNode: function getPopupDomNode() { | ||
return _ret = (_temp = (_this = (0, _possibleConstructorReturn3["default"])(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.getPopupElement = function () { | ||
var _this$props = _this.props, | ||
arrowContent = _this$props.arrowContent, | ||
overlay = _this$props.overlay, | ||
prefixCls = _this$props.prefixCls; | ||
return [_react2["default"].createElement( | ||
'div', | ||
{ className: prefixCls + '-arrow', key: 'arrow' }, | ||
arrowContent | ||
), _react2["default"].createElement( | ||
'div', | ||
{ className: prefixCls + '-inner', key: 'content' }, | ||
typeof overlay === 'function' ? overlay() : overlay | ||
)]; | ||
}, _temp), (0, _possibleConstructorReturn3["default"])(_this, _ret); | ||
} | ||
Tooltip.prototype.getPopupDomNode = function getPopupDomNode() { | ||
return this.refs.trigger.getPopupDomNode(); | ||
}, | ||
render: function render() { | ||
var _props2 = this.props; | ||
var overlayClassName = _props2.overlayClassName; | ||
var trigger = _props2.trigger; | ||
var mouseEnterDelay = _props2.mouseEnterDelay; | ||
var mouseLeaveDelay = _props2.mouseLeaveDelay; | ||
var overlayStyle = _props2.overlayStyle; | ||
var prefixCls = _props2.prefixCls; | ||
var children = _props2.children; | ||
var onVisibleChange = _props2.onVisibleChange; | ||
var transitionName = _props2.transitionName; | ||
var animation = _props2.animation; | ||
var placement = _props2.placement; | ||
var align = _props2.align; | ||
var destroyTooltipOnHide = _props2.destroyTooltipOnHide; | ||
var defaultVisible = _props2.defaultVisible; | ||
var getTooltipContainer = _props2.getTooltipContainer; | ||
}; | ||
var restProps = _objectWithoutProperties(_props2, ['overlayClassName', 'trigger', 'mouseEnterDelay', 'mouseLeaveDelay', 'overlayStyle', 'prefixCls', 'children', 'onVisibleChange', 'transitionName', 'animation', 'placement', 'align', 'destroyTooltipOnHide', 'defaultVisible', 'getTooltipContainer']); | ||
Tooltip.prototype.render = function render() { | ||
var _props = this.props, | ||
overlayClassName = _props.overlayClassName, | ||
trigger = _props.trigger, | ||
mouseEnterDelay = _props.mouseEnterDelay, | ||
mouseLeaveDelay = _props.mouseLeaveDelay, | ||
overlayStyle = _props.overlayStyle, | ||
prefixCls = _props.prefixCls, | ||
children = _props.children, | ||
onVisibleChange = _props.onVisibleChange, | ||
transitionName = _props.transitionName, | ||
animation = _props.animation, | ||
placement = _props.placement, | ||
align = _props.align, | ||
destroyTooltipOnHide = _props.destroyTooltipOnHide, | ||
defaultVisible = _props.defaultVisible, | ||
getTooltipContainer = _props.getTooltipContainer, | ||
restProps = (0, _objectWithoutProperties3["default"])(_props, ['overlayClassName', 'trigger', 'mouseEnterDelay', 'mouseLeaveDelay', 'overlayStyle', 'prefixCls', 'children', 'onVisibleChange', 'transitionName', 'animation', 'placement', 'align', 'destroyTooltipOnHide', 'defaultVisible', 'getTooltipContainer']); | ||
var extraProps = _extends({}, restProps); | ||
var extraProps = (0, _extends3["default"])({}, restProps); | ||
if ('visible' in this.props) { | ||
@@ -108,3 +105,3 @@ extraProps.popupVisible = this.props.visible; | ||
_rcTrigger2["default"], | ||
_extends({ | ||
(0, _extends3["default"])({ | ||
popupClassName: overlayClassName, | ||
@@ -130,6 +127,39 @@ ref: 'trigger', | ||
); | ||
} | ||
}); | ||
}; | ||
return Tooltip; | ||
}(_react.Component); | ||
Tooltip.propTypes = { | ||
trigger: _propTypes2["default"].any, | ||
children: _propTypes2["default"].any, | ||
defaultVisible: _propTypes2["default"].bool, | ||
visible: _propTypes2["default"].bool, | ||
placement: _propTypes2["default"].string, | ||
transitionName: _propTypes2["default"].string, | ||
animation: _propTypes2["default"].any, | ||
onVisibleChange: _propTypes2["default"].func, | ||
afterVisibleChange: _propTypes2["default"].func, | ||
overlay: _propTypes2["default"].oneOfType([_propTypes2["default"].node, _propTypes2["default"].func]).isRequired, | ||
overlayStyle: _propTypes2["default"].object, | ||
overlayClassName: _propTypes2["default"].string, | ||
prefixCls: _propTypes2["default"].string, | ||
mouseEnterDelay: _propTypes2["default"].number, | ||
mouseLeaveDelay: _propTypes2["default"].number, | ||
getTooltipContainer: _propTypes2["default"].func, | ||
destroyTooltipOnHide: _propTypes2["default"].bool, | ||
align: _propTypes2["default"].object, | ||
arrowContent: _propTypes2["default"].any | ||
}; | ||
Tooltip.defaultProps = { | ||
prefixCls: 'rc-tooltip', | ||
mouseEnterDelay: 0, | ||
destroyTooltipOnHide: false, | ||
mouseLeaveDelay: 0.1, | ||
align: {}, | ||
placement: 'right', | ||
trigger: ['hover'], | ||
arrowContent: null | ||
}; | ||
exports["default"] = Tooltip; | ||
module.exports = exports['default']; |
{ | ||
"name": "rc-tooltip", | ||
"version": "3.4.2", | ||
"version": "3.4.3", | ||
"description": "React Tooltip", | ||
@@ -27,3 +27,3 @@ "keywords": [ | ||
}, | ||
"licenses": "MIT", | ||
"license": "MIT", | ||
"config": { | ||
@@ -36,3 +36,3 @@ "port": 8007 | ||
"start": "rc-tools run server", | ||
"pub": "rc-tools run pub", | ||
"pub": "rc-tools run pub --babel-runtime", | ||
"lint": "rc-tools run lint", | ||
@@ -42,2 +42,3 @@ "karma": "rc-tools run karma", | ||
"test": "rc-tools run test", | ||
"prepublish": "rc-tools run guard", | ||
"chrome-test": "rc-tools run chrome-test", | ||
@@ -54,5 +55,4 @@ "coverage": "rc-tools run coverage" | ||
"rc-tools": "5.x", | ||
"react": "^0.14.0", | ||
"react-addons-test-utils": "^0.14.0", | ||
"react-dom": "^0.14.0" | ||
"react": "15.x", | ||
"react-dom": "15.x" | ||
}, | ||
@@ -63,4 +63,5 @@ "pre-commit": [ | ||
"dependencies": { | ||
"prop-types": "^15.5.8", | ||
"rc-trigger": "1.x" | ||
} | ||
} |
@@ -26,12 +26,14 @@ # rc-tooltip | ||
## Screenshots | ||
## Screenshot | ||
<img src="http://gtms03.alicdn.com/tps/i3/TB1NQUSHpXXXXaUXFXXlQqyZXXX-1312-572.png" width="600"/> | ||
## Feature | ||
## Browser Support | ||
* support ie8,ie8+,chrome,firefox,safari | ||
|![IE](https://raw.github.com/alrra/browser-logos/master/internet-explorer/internet-explorer_48x48.png) | ![Chrome](https://raw.github.com/alrra/browser-logos/master/chrome/chrome_48x48.png) | ![Firefox](https://raw.github.com/alrra/browser-logos/master/firefox/firefox_48x48.png) | ![Opera](https://raw.github.com/alrra/browser-logos/master/opera/opera_48x48.png) | ![Safari](https://raw.github.com/alrra/browser-logos/master/safari/safari_48x48.png)| | ||
| --- | --- | --- | --- | --- | | ||
| IE 8 + IE 8+ ✔ | Chrome 31.0+ ✔ | Firefox 31.0+ ✔ | Opera 30.0+ ✔ | Safari 7.0+ ✔ | | ||
## install | ||
## Install | ||
@@ -45,15 +47,16 @@ [![rc-tooltip](https://nodei.co/npm/rc-tooltip.png)](https://npmjs.org/package/rc-tooltip) | ||
var React = require('react'); | ||
var ReactDOM = require('react-dom') | ||
var ReactDOM = require('react-dom'); | ||
ReactDOM.render(<Tooltip placement="left" trigger={['click']} overlay={<span>tooltip</span>}><a href='#'>hover</a></Tooltip>, container); | ||
``` | ||
## Example | ||
## Examples | ||
http://localhost:8007/examples | ||
`npm start` and then go to | ||
[http://localhost:8007/examples](http://localhost:8007/examples) | ||
online example: http://react-component.github.io/tooltip/examples/ | ||
Online examples: [http://react-component.github.io/tooltip/examples/](http://react-component.github.io/tooltip/examples/) | ||
## API | ||
### props | ||
### Props | ||
@@ -164,3 +167,3 @@ <table class="table table-bordered table-striped"> | ||
<td></td> | ||
<td>function returning html node which will act as tooltip contaier</td> | ||
<td>function returning html node which will act as tooltip container</td> | ||
</tr> | ||
@@ -176,6 +179,10 @@ <tr> | ||
## Note | ||
`Tooltip` requires child node accepts `onMouseEnter`, `onMouseLeave`, `onFocus`, `onClick` event. | ||
## Development | ||
``` | ||
```bash | ||
npm install | ||
@@ -187,10 +194,15 @@ npm start | ||
http://localhost:8007/tests/runner.html?coverage | ||
```bash | ||
npm test | ||
npm run chrome-test | ||
``` | ||
## Coverage | ||
http://localhost:8007/node_modules/rc-server/node_modules/node-jscover/lib/front-end/jscoverage.html?w=http://localhost:8007/tests/runner.html?coverage | ||
```bash | ||
npm run coverage | ||
``` | ||
## License | ||
rc-tooltip is released under the MIT license. | ||
`rc-tooltip` is released under the MIT license. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Misc. License Issues
License(Experimental) A package's licensing information has fine-grained problems.
Found 1 instance in 1 package
29867
9
0
673
204
2
+ Addedprop-types@^15.5.8