From fdc17d44f1b22f640f7a87ffdf515e72035ef78a Mon Sep 17 00:00:00 2001 From: kebabmaster Date: Mon, 2 Mar 2020 11:05:06 +0000 Subject: [PATCH] fix(pr): package.json fix; refactoring to exclude dependencies --- .gitignore | 3 --- build/manifest.json | 8 -------- package-lock.json | 8 ++------ package.json | 14 +------------- src/decorators/defaultStyles.js | 4 +--- src/index.js | 21 ++++++++------------- 6 files changed, 12 insertions(+), 46 deletions(-) delete mode 100644 build/manifest.json diff --git a/.gitignore b/.gitignore index 360f2aa38..edb1b90a0 100644 --- a/.gitignore +++ b/.gitignore @@ -8,9 +8,6 @@ !.gitignore !.npmignore -# NPM -package-lock.json - # files node_modules/ dist/ diff --git a/build/manifest.json b/build/manifest.json deleted file mode 100644 index 08a3c8c16..000000000 --- a/build/manifest.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "short_name": "react-tooltip", - "name": "react-tooltip", - "start_url": "./index.html", - "display": "standalone", - "theme_color": "#000000", - "background_color": "#ffffff" -} diff --git a/package-lock.json b/package-lock.json index 06c932a14..67fbbc0f4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3996,11 +3996,6 @@ } } }, - "classnames": { - "version": "2.2.6", - "resolved": "https://registry.npmjs.org/classnames/-/classnames-2.2.6.tgz", - "integrity": "sha512-JR/iSQOSt+LQIWwrwEzJ9uk0xfN3mTVYMwt1Ir5mUcSN6pU+V4zQFFaJsclJbPuAUQH+yfWef6tm7l1quW3C8Q==" - }, "clean-stack": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-1.3.0.tgz", @@ -12187,7 +12182,8 @@ "lodash": { "version": "4.17.15", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", - "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==" + "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", + "dev": true }, "lodash._arraycopy": { "version": "3.0.0", diff --git a/package.json b/package.json index 0ba99fd2e..b9a030bf6 100755 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "react tooltip component", "main": "dist/index.js", "module": "dist/index.es.js", - "jsnext:main": "dist/index.ex.js", + "jsnext:main": "dist/index.es.js", "engines": { "node": ">=8", "npm": ">=5" @@ -30,16 +30,6 @@ "publishConfig": { "registry": "https://npm.pkg.github.com/" }, - "standard": { - "parser": "babel-eslint", - "ignore": [ - "dist/", - "standalone/", - "src/style.js", - "src/style.css", - "example/" - ] - }, "repository": { "type": "git", "url": "https://github.com/wwayne/react-tooltip" @@ -66,8 +56,6 @@ }, "dependencies": { "aphrodite-jss": "^2.1.0", - "classnames": "^2.2.6", - "lodash": "^4.17.15", "prop-types": "^15.7.2" }, "devDependencies": { diff --git a/src/decorators/defaultStyles.js b/src/decorators/defaultStyles.js index a35c972fb..33d7e30fd 100755 --- a/src/decorators/defaultStyles.js +++ b/src/decorators/defaultStyles.js @@ -1,5 +1,3 @@ -import _ from "lodash"; - /** * Default pop-up style values (text color, background color). */ @@ -13,5 +11,5 @@ const defaultColors = { }; export function getDefaultPopupColors (type) { - return _.cloneDeep(defaultColors[type]); + return defaultColors[type] ? { ...defaultColors[type] } : undefined; } diff --git a/src/index.js b/src/index.js index 4d3e7244f..46d381831 100755 --- a/src/index.js +++ b/src/index.js @@ -1,7 +1,6 @@ /* eslint-disable no-unused-vars, dot-notation */ import React from "react"; import PropTypes from "prop-types"; -import classname from "classnames"; /* Decorators */ import staticMethods from "./decorators/staticMethods"; @@ -674,18 +673,14 @@ class ReactTooltip extends React.Component { const placeholder = this.getTooltipContent(); const isEmptyTip = this.isEmptyTip(placeholder); - const tooltipClass = classname( - "__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-" + (this.hasCustomColors() ? "custom" : this.state.type)]: this.state.type }, - { "allow_hover": this.props.delayUpdate }, - { "allow_click": this.props.clickable } - ); + const tooltipClass = + "__react_component_tooltip" + + (this.state.show && !disable && !isEmptyTip ? " show" : "") + + (this.state.border ? " border" : "") + + ` place-${this.state.place}` + // top, bottom, left, right + ` type-${(this.hasCustomColors() ? "custom" : this.state.type)}` + // dark, success, warning, error, info, light, custom + (this.props.delayUpdate ? " allow_hover" : "") + + (this.props.clickable ? " allow_click" : ""); const tooltipStyle = getTooltipStyle(getPopupColors(this.state.customColors, this.state.type, this.state.border));