Skip to content

Commit 9a85253

Browse files
committed
fix(colors): allow customizable text, background, border, arrow colors
2 parents 510434b + 2be7537 commit 9a85253

File tree

9 files changed

+66
-24310
lines changed

9 files changed

+66
-24310
lines changed

Diff for: .gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ package-lock.json
1313

1414
# files
1515
node_modules/
16-
example/dist/
1716
dist/
17+
build/

Diff for: .travis.yml

+14-3
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,23 @@ script:
1717
- yarn build
1818
- git config --global user.name "Travis CI"
1919
- git config --global user.email "[email protected]"
20-
- export GIT_PUBLISH_URL=https://${GH_TOKEN}@github.com/wwayne/react-tooltip.git
21-
- if [ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ]; then yarn gh-pages -- --repo ${GIT_PUBLISH_URL}; fi
20+
- cd example
21+
- yarn
22+
- yarn build
23+
- cd ..
2224

2325
after_success:
2426
- yarn semantic-release
25-
27+
28+
deploy:
29+
provider: pages
30+
local_dir: example/build
31+
skip_cleanup: true
32+
token: $GH_TOKEN
33+
keep_history: true
34+
on:
35+
branch: master
36+
2637
branches:
2738
except:
2839
- "/^v\\d+\\.\\d+\\.\\d+$/"

Diff for: README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://github.com/feross/standard)
44
[![npm download][download-image]][download-url]
55
[![Build Status](https://travis-ci.org/wwayne/react-tooltip.svg?branch=master)](https://travis-ci.org/wwayne/react-tooltip)
6+
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
67

78
[download-image]: https://img.shields.io/npm/dm/react-tooltip.svg?style=flat-square
89
[download-url]: https://npmjs.org/package/react-tooltip
@@ -11,6 +12,8 @@
1112

1213
[![Edit ReactTooltip](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/heuristic-curran-bddeu?fontsize=14&hidenavigation=1&theme=dark)
1314

15+
Or see it on [Github Page](https://wwayne.github.io/react-tooltip/).
16+
1417
## Maintainers
1518

1619
[aronhelser](https://github.com/aronhelser) Passive maintainer - accepting PRs and doing minor testing, but not fixing issues or doing active development.
@@ -56,7 +59,7 @@ import ReactTooltip from 'react-tooltip'
5659

5760
**Standalone**
5861

59-
You can import `node_modules/react-tooltip/standalone/react-tooltip.min.js` into your page. Please make sure that you have already imported `react` and `react-dom` into your page.
62+
You can import `node_modules/react-tooltip/dist/index.js` into your page. Please make sure that you have already imported `react` and `react-dom` into your page.
6063

6164
## Options
6265
Notes:

Diff for: contributing.md

+13-6
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,31 @@ This doc needs help! Please submit your PR...
44

55
## Commit messages
66

7-
We are using semantic-release to automate the release process, and this depends on a specific format for commit messages. Please run `npm run commit` to use `commitizen` to properly format your commit messages so they can be automatically processed and included in release notes.
7+
We are using semantic-release to automate the release process, and this depends on a specific format for commit messages. Please run `yarn commit` to use `commitizen` to properly format your commit messages so they can be automatically processed and included in release notes.
88

99
## Pull request testing
1010

1111
Some notes on testing and releasing.
1212
* For a PR, follow Github's command-line instructions for retrieving the branch with the changes.
13-
* `make dev` starts a development server, open `http://localhost:8888` to see the example website.
13+
* To start a development server:
14+
15+
```sh
16+
yarn build
17+
cd example
18+
yarn
19+
yarn start
20+
```
21+
1422
* Provide feedback on the PR about your results.
1523

1624
## Doing a release
1725

1826
We are using semantic-release instead of this:
1927

20-
* `make deploy` updates the files in the `standalone` directory
2128
* update the version number in `package.json`
22-
- Fixes update the patch number, features update the minor number.
23-
- Major version update is reserved for API breaking changes, not just additions.
24-
* `npm run github-changes -- -n 3.X.Y` to update the changelog
29+
- Fixes update the patch number, features update the minor number.
30+
- Major version update is reserved for API breaking changes, not just additions.
31+
* `yarn github-changes -- -n 3.X.Y` to update the changelog
2532
* `git add`, `git commit` and `git push` to get the version to master.
2633
* `git tag -a 3.X.Y -m 3.X.Y` `git push --tags`
2734
* `npm publish`

Diff for: example/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-tooltip-example",
3-
"homepage": "https://github.com/wwayne/react-tooltip",
3+
"homepage": "https://wwayne.github.io/react-tooltip/",
44
"version": "1.0.0",
55
"license": "MIT",
66
"dependencies": {
@@ -15,7 +15,7 @@
1515
"build": "react-scripts build",
1616
"test": "react-scripts test --env=jsdom",
1717
"eject": "react-scripts eject",
18-
"predeploy": "npm run build",
18+
"predeploy": "yarn build",
1919
"deploy": "gh-pages -d build"
2020
}
2121
}

Diff for: package.json

+17-3
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@
1010
"npm": ">=5"
1111
},
1212
"scripts": {
13+
"pretest": "./node_modules/.bin/eslint . --fix",
1314
"test": "make lint",
1415
"test:unit": "mocha --require @babel/register --require ignore-styles 'test/*.spec.js'",
1516
"clean": "rimraf dist",
16-
"build": "npm run test:unit & rollup -c",
17+
"build": "npm run test:unit && rollup -c",
1718
"build:watch": "rollup -c -w",
1819
"start": "npm-run-all clean build:watch",
1920
"gh-pages": "gh-pages -d example",
@@ -26,6 +27,19 @@
2627
"path": "node_modules/cz-conventional-changelog"
2728
}
2829
},
30+
"publishConfig": {
31+
"registry": "https://npm.pkg.github.com/"
32+
},
33+
"standard": {
34+
"parser": "babel-eslint",
35+
"ignore": [
36+
"dist/",
37+
"standalone/",
38+
"src/style.js",
39+
"src/style.css",
40+
"example/"
41+
]
42+
},
2943
"repository": {
3044
"type": "git",
3145
"url": "https://github.com/wwayne/react-tooltip"
@@ -47,8 +61,8 @@
4761
"react-dom": "global:ReactDOM"
4862
},
4963
"peerDependencies": {
50-
"react": ">=^16.0.0",
51-
"react-dom": ">=^16.0.0"
64+
"react": ">=16.0.0",
65+
"react-dom": ">=16.0.0"
5266
},
5367
"dependencies": {
5468
"aphrodite-jss": "^2.1.0",

Diff for: src/index.js

+15-8
Original file line numberDiff line numberDiff line change
@@ -200,19 +200,26 @@ class ReactTooltip extends React.Component {
200200
* Pick out corresponded target elements
201201
*/
202202
getTargetArray(id) {
203-
let targetArray;
204-
203+
let targetArray = [];
204+
let selector;
205205
if (!id) {
206-
targetArray = document.querySelectorAll("[data-tip]:not([data-for])");
206+
selector = "[data-tip]:not([data-for])";
207207
} else {
208208
const escaped = id.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
209-
targetArray = document.querySelectorAll(
210-
`[data-tip][data-for="${escaped}"]`
211-
);
209+
selector = `[data-tip][data-for="${escaped}"]`;
212210
}
213211

214-
// targetArray is a NodeList, convert it to a real array
215-
return nodeListToArray(targetArray);
212+
// Scan document for shadow DOM elements
213+
nodeListToArray(document.getElementsByTagName("*"))
214+
.filter(element => element.shadowRoot)
215+
.forEach(element => {
216+
targetArray = targetArray.concat(
217+
nodeListToArray(element.shadowRoot.querySelectorAll(selector))
218+
);
219+
});
220+
return targetArray.concat(
221+
nodeListToArray(document.querySelectorAll(selector))
222+
);
216223
}
217224

218225
/**

0 commit comments

Comments
 (0)