Skip to content

Commit fdc17d4

Browse files
committed
fix(pr): package.json fix; refactoring to exclude dependencies
1 parent 9a85253 commit fdc17d4

File tree

6 files changed

+12
-46
lines changed

6 files changed

+12
-46
lines changed

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
!.gitignore
99
!.npmignore
1010

11-
# NPM
12-
package-lock.json
13-
1411
# files
1512
node_modules/
1613
dist/

build/manifest.json

Lines changed: 0 additions & 8 deletions
This file was deleted.

package-lock.json

Lines changed: 2 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "react tooltip component",
55
"main": "dist/index.js",
66
"module": "dist/index.es.js",
7-
"jsnext:main": "dist/index.ex.js",
7+
"jsnext:main": "dist/index.es.js",
88
"engines": {
99
"node": ">=8",
1010
"npm": ">=5"
@@ -30,16 +30,6 @@
3030
"publishConfig": {
3131
"registry": "https://npm.pkg.github.com/"
3232
},
33-
"standard": {
34-
"parser": "babel-eslint",
35-
"ignore": [
36-
"dist/",
37-
"standalone/",
38-
"src/style.js",
39-
"src/style.css",
40-
"example/"
41-
]
42-
},
4333
"repository": {
4434
"type": "git",
4535
"url": "https://github.com/wwayne/react-tooltip"
@@ -66,8 +56,6 @@
6656
},
6757
"dependencies": {
6858
"aphrodite-jss": "^2.1.0",
69-
"classnames": "^2.2.6",
70-
"lodash": "^4.17.15",
7159
"prop-types": "^15.7.2"
7260
},
7361
"devDependencies": {

src/decorators/defaultStyles.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import _ from "lodash";
2-
31
/**
42
* Default pop-up style values (text color, background color).
53
*/
@@ -13,5 +11,5 @@ const defaultColors = {
1311
};
1412

1513
export function getDefaultPopupColors (type) {
16-
return _.cloneDeep(defaultColors[type]);
14+
return defaultColors[type] ? { ...defaultColors[type] } : undefined;
1715
}

src/index.js

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/* eslint-disable no-unused-vars, dot-notation */
22
import React from "react";
33
import PropTypes from "prop-types";
4-
import classname from "classnames";
54

65
/* Decorators */
76
import staticMethods from "./decorators/staticMethods";
@@ -674,18 +673,14 @@ class ReactTooltip extends React.Component {
674673
const placeholder = this.getTooltipContent();
675674
const isEmptyTip = this.isEmptyTip(placeholder);
676675

677-
const tooltipClass = classname(
678-
"__react_component_tooltip",
679-
{ "show": this.state.show && !disable && !isEmptyTip },
680-
{ "border": this.state.border },
681-
{ "place-top": this.state.place === "top" },
682-
{ "place-bottom": this.state.place === "bottom" },
683-
{ "place-left": this.state.place === "left" },
684-
{ "place-right": this.state.place === "right" },
685-
{ ["type-" + (this.hasCustomColors() ? "custom" : this.state.type)]: this.state.type },
686-
{ "allow_hover": this.props.delayUpdate },
687-
{ "allow_click": this.props.clickable }
688-
);
676+
const tooltipClass =
677+
"__react_component_tooltip" +
678+
(this.state.show && !disable && !isEmptyTip ? " show" : "") +
679+
(this.state.border ? " border" : "") +
680+
` place-${this.state.place}` + // top, bottom, left, right
681+
` type-${(this.hasCustomColors() ? "custom" : this.state.type)}` + // dark, success, warning, error, info, light, custom
682+
(this.props.delayUpdate ? " allow_hover" : "") +
683+
(this.props.clickable ? " allow_click" : "");
689684

690685
const tooltipStyle = getTooltipStyle(getPopupColors(this.state.customColors, this.state.type, this.state.border));
691686

0 commit comments

Comments
 (0)