Skip to content

Commit

Permalink
fix(colors): allow customizable text, background, border, arrow colors
Browse files Browse the repository at this point in the history
  • Loading branch information
kebabmaster committed Feb 29, 2020
2 parents 510434b + 2be7537 commit 9a85253
Show file tree
Hide file tree
Showing 9 changed files with 66 additions and 24,310 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ package-lock.json

# files
node_modules/
example/dist/
dist/
build/
17 changes: 14 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,23 @@ script:
- yarn build
- git config --global user.name "Travis CI"
- git config --global user.email "aron.helser@kitware.com"
- export GIT_PUBLISH_URL=https://${GH_TOKEN}@github.com/wwayne/react-tooltip.git
- if [ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ]; then yarn gh-pages -- --repo ${GIT_PUBLISH_URL}; fi
- cd example
- yarn
- yarn build
- cd ..

after_success:
- yarn semantic-release


deploy:
provider: pages
local_dir: example/build
skip_cleanup: true
token: $GH_TOKEN
keep_history: true
on:
branch: master

branches:
except:
- "/^v\\d+\\.\\d+\\.\\d+$/"
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://github.com/feross/standard)
[![npm download][download-image]][download-url]
[![Build Status](https://travis-ci.org/wwayne/react-tooltip.svg?branch=master)](https://travis-ci.org/wwayne/react-tooltip)
[![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)

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

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

Or see it on [Github Page](https://wwayne.github.io/react-tooltip/).

## Maintainers

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

**Standalone**

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.
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.

## Options
Notes:
Expand Down
19 changes: 13 additions & 6 deletions contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,31 @@ This doc needs help! Please submit your PR...

## Commit messages

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.
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.

## Pull request testing

Some notes on testing and releasing.
* For a PR, follow Github's command-line instructions for retrieving the branch with the changes.
* `make dev` starts a development server, open `http://localhost:8888` to see the example website.
* To start a development server:

```sh
yarn build
cd example
yarn
yarn start
```

* Provide feedback on the PR about your results.

## Doing a release

We are using semantic-release instead of this:

* `make deploy` updates the files in the `standalone` directory
* update the version number in `package.json`
- Fixes update the patch number, features update the minor number.
- Major version update is reserved for API breaking changes, not just additions.
* `npm run github-changes -- -n 3.X.Y` to update the changelog
- Fixes update the patch number, features update the minor number.
- Major version update is reserved for API breaking changes, not just additions.
* `yarn github-changes -- -n 3.X.Y` to update the changelog
* `git add`, `git commit` and `git push` to get the version to master.
* `git tag -a 3.X.Y -m 3.X.Y` `git push --tags`
* `npm publish`
Expand Down
4 changes: 2 additions & 2 deletions example/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-tooltip-example",
"homepage": "https://github.com/wwayne/react-tooltip",
"homepage": "https://wwayne.github.io/react-tooltip/",
"version": "1.0.0",
"license": "MIT",
"dependencies": {
Expand All @@ -15,7 +15,7 @@
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject",
"predeploy": "npm run build",
"predeploy": "yarn build",
"deploy": "gh-pages -d build"
}
}
20 changes: 17 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
"npm": ">=5"
},
"scripts": {
"pretest": "./node_modules/.bin/eslint . --fix",
"test": "make lint",
"test:unit": "mocha --require @babel/register --require ignore-styles 'test/*.spec.js'",
"clean": "rimraf dist",
"build": "npm run test:unit & rollup -c",
"build": "npm run test:unit && rollup -c",
"build:watch": "rollup -c -w",
"start": "npm-run-all clean build:watch",
"gh-pages": "gh-pages -d example",
Expand All @@ -26,6 +27,19 @@
"path": "node_modules/cz-conventional-changelog"
}
},
"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"
Expand All @@ -47,8 +61,8 @@
"react-dom": "global:ReactDOM"
},
"peerDependencies": {
"react": ">=^16.0.0",
"react-dom": ">=^16.0.0"
"react": ">=16.0.0",
"react-dom": ">=16.0.0"
},
"dependencies": {
"aphrodite-jss": "^2.1.0",
Expand Down
23 changes: 15 additions & 8 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,19 +200,26 @@ class ReactTooltip extends React.Component {
* Pick out corresponded target elements
*/
getTargetArray(id) {
let targetArray;

let targetArray = [];
let selector;
if (!id) {
targetArray = document.querySelectorAll("[data-tip]:not([data-for])");
selector = "[data-tip]:not([data-for])";
} else {
const escaped = id.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
targetArray = document.querySelectorAll(
`[data-tip][data-for="${escaped}"]`
);
selector = `[data-tip][data-for="${escaped}"]`;
}

// targetArray is a NodeList, convert it to a real array
return nodeListToArray(targetArray);
// Scan document for shadow DOM elements
nodeListToArray(document.getElementsByTagName("*"))
.filter(element => element.shadowRoot)
.forEach(element => {
targetArray = targetArray.concat(
nodeListToArray(element.shadowRoot.querySelectorAll(selector))
);
});
return targetArray.concat(
nodeListToArray(document.querySelectorAll(selector))
);
}

/**
Expand Down
Loading

0 comments on commit 9a85253

Please sign in to comment.