You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP
Socket
Sign inDemoInstall
Socket

react-hint

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-hint - npm Package Compare versions

Comparing version

to
1.2.1

4

lib/index.js

@@ -141,2 +141,6 @@ 'use strict';

ReactHint.prototype.componentWillUnmount = function componentWillUnmount() {
ReactHint.instance = null;
};
ReactHint.prototype.render = function render() {

@@ -143,0 +147,0 @@ var className = this.props.className;

2

package.json
{
"name": "react-hint",
"version": "1.2.0",
"version": "1.2.1",
"description": "a simple tooltip component for React",

@@ -5,0 +5,0 @@ "author": "Vladimir Simonov <slmgc@ya.ru>",

@@ -56,2 +56,6 @@ import React from 'react'

componentWillUnmount() {
ReactHint.instance = null
}
findHint = (el) => {

@@ -58,0 +62,0 @@ while (el) {

/*!
* react-hint v1.2.0 - https://github.com/slmgc/react-hint
* react-hint v1.2.1 - https://github.com/slmgc/react-hint
* MIT Licensed

@@ -210,2 +210,6 @@ */

ReactHint.prototype.componentWillUnmount = function componentWillUnmount() {
ReactHint.instance = null;
};
ReactHint.prototype.render = function render() {

@@ -225,3 +229,3 @@ var className = this.props.className;

fileName: _jsxFileName,
lineNumber: 127
lineNumber: 131
},

@@ -236,3 +240,3 @@ __self: this

fileName: _jsxFileName,
lineNumber: 130
lineNumber: 134
},

@@ -245,3 +249,3 @@ __self: this

fileName: _jsxFileName,
lineNumber: 133
lineNumber: 137
},

@@ -248,0 +252,0 @@ __self: this

/*!
* react-hint v1.2.0 - https://github.com/slmgc/react-hint
* react-hint v1.2.1 - https://github.com/slmgc/react-hint
* MIT Licensed
*/
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react")):"function"==typeof define&&define.amd?define(["react"],e):"object"==typeof exports?exports.ReactHint=e(require("react")):t.ReactHint=e(t.React)}(this,function(t){return function(t){function e(o){if(n[o])return n[o].exports;var r=n[o]={exports:{},id:o,loaded:!1};return t[o].call(r.exports,r,r.exports,e),r.loaded=!0,r.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){t.exports=n(1)},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}e.__esModule=!0,e.default=void 0;var u,c,s=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}(),f=n(2),l=o(f),p=(c=u=function(t){function e(){var n,o,a;r(this,e);for(var u=arguments.length,c=Array(u),s=0;s<u;s++)c[s]=arguments[s];return n=o=i(this,t.call.apply(t,[this].concat(c))),o.state={target:null,at:"top",top:0,left:0},o.findHint=function(t){for(;t&&t!==document;){if(t.hasAttribute("data-rh"))return t;t=t.parentNode}return null},o.getPosition=function(t){var e=o,n=e._container,r=e._hint,i=n.getBoundingClientRect(),a=i.top,u=i.left,c=r.getBoundingClientRect(),s=c.width,f=c.height,l=t.getBoundingClientRect(),p=l.top,d=l.left,h=l.width,v=l.height,g=void 0,m=void 0,b=t.getAttribute("data-rh-at")||"top";switch(b){case"left":g=v-f>>1,m=-s;break;case"right":g=v-f>>1,m=h;break;case"bottom":g=v,m=h-s>>1;break;case"top":default:g=-f,m=h-s>>1}return{at:b,top:g+p-a,left:m+d-u}},o.onHover=function(t){var e=t.target;return o.setState({target:o.findHint(e)})},o.setRef=function(t,e){return o[t]=e},a=n,i(o,a)}return a(e,t),e.prototype.shouldComponentUpdate=function(t,e){var n=t.className,o=e.target,r=e.at,i=e.top,a=e.left,u=this.props,c=this.state;return o!==c.target||r!==c.at||i!==c.top||a!==c.left||n!==u.className},e.prototype.componentDidMount=function(){e.instance&&(e.instance=null),e.instance=this},e.prototype.componentDidUpdate=function(){var t=this.state.target;if(t){var e=t.getBoundingClientRect(),n=e.top,o=e.left,r=e.width,i=e.height;(n||o||r||i)&&this.setState(this.getPosition(t))}},e.prototype.render=function(){var t=this.props.className,e=this.state,n=e.target,o=e.at,r=e.top,i=e.left;return l.default.createElement("div",{style:{position:"relative"},ref:this.setRef.bind(this,"_container")},n&&l.default.createElement("div",{className:t+" "+t+"--"+o,ref:this.setRef.bind(this,"_hint"),style:{top:r,left:i}},l.default.createElement("div",{className:t+"__content"},n.getAttribute("data-rh"))))},s(e,null,[{key:"instance",get:function(){return e._instance},set:function(t){t?document.addEventListener("mouseover",t.onHover):document.removeEventListener("mouseover",e.instance.onHover),e._instance=t}}]),e}(l.default.Component),u._instance=null,u.defaultProps={className:"react-hint"},c);e.default=p},function(e,n){e.exports=t}])});
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react")):"function"==typeof define&&define.amd?define(["react"],e):"object"==typeof exports?exports.ReactHint=e(require("react")):t.ReactHint=e(t.React)}(this,function(t){return function(t){function e(o){if(n[o])return n[o].exports;var r=n[o]={exports:{},id:o,loaded:!1};return t[o].call(r.exports,r,r.exports,e),r.loaded=!0,r.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){t.exports=n(1)},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}e.__esModule=!0,e.default=void 0;var u,c,s=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}(),f=n(2),l=o(f),p=(c=u=function(t){function e(){var n,o,a;r(this,e);for(var u=arguments.length,c=Array(u),s=0;s<u;s++)c[s]=arguments[s];return n=o=i(this,t.call.apply(t,[this].concat(c))),o.state={target:null,at:"top",top:0,left:0},o.findHint=function(t){for(;t&&t!==document;){if(t.hasAttribute("data-rh"))return t;t=t.parentNode}return null},o.getPosition=function(t){var e=o,n=e._container,r=e._hint,i=n.getBoundingClientRect(),a=i.top,u=i.left,c=r.getBoundingClientRect(),s=c.width,f=c.height,l=t.getBoundingClientRect(),p=l.top,d=l.left,h=l.width,m=l.height,v=void 0,g=void 0,b=t.getAttribute("data-rh-at")||"top";switch(b){case"left":v=m-f>>1,g=-s;break;case"right":v=m-f>>1,g=h;break;case"bottom":v=m,g=h-s>>1;break;case"top":default:v=-f,g=h-s>>1}return{at:b,top:v+p-a,left:g+d-u}},o.onHover=function(t){var e=t.target;return o.setState({target:o.findHint(e)})},o.setRef=function(t,e){return o[t]=e},a=n,i(o,a)}return a(e,t),e.prototype.shouldComponentUpdate=function(t,e){var n=t.className,o=e.target,r=e.at,i=e.top,a=e.left,u=this.props,c=this.state;return o!==c.target||r!==c.at||i!==c.top||a!==c.left||n!==u.className},e.prototype.componentDidMount=function(){e.instance&&(e.instance=null),e.instance=this},e.prototype.componentDidUpdate=function(){var t=this.state.target;if(t){var e=t.getBoundingClientRect(),n=e.top,o=e.left,r=e.width,i=e.height;(n||o||r||i)&&this.setState(this.getPosition(t))}},e.prototype.componentWillUnmount=function(){e.instance=null},e.prototype.render=function(){var t=this.props.className,e=this.state,n=e.target,o=e.at,r=e.top,i=e.left;return l.default.createElement("div",{style:{position:"relative"},ref:this.setRef.bind(this,"_container")},n&&l.default.createElement("div",{className:t+" "+t+"--"+o,ref:this.setRef.bind(this,"_hint"),style:{top:r,left:i}},l.default.createElement("div",{className:t+"__content"},n.getAttribute("data-rh"))))},s(e,null,[{key:"instance",get:function(){return e._instance},set:function(t){t?document.addEventListener("mouseover",t.onHover):document.removeEventListener("mouseover",e.instance.onHover),e._instance=t}}]),e}(l.default.Component),u._instance=null,u.defaultProps={className:"react-hint"},c);e.default=p},function(e,n){e.exports=t}])});
//# sourceMappingURL=react-hint.min.js.map

Sorry, the diff of this file is not supported yet