Skip to content

Commit

Permalink
Fixes conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
artdevgame committed Jan 2, 2020
2 parents bebdcf0 + c28d02b commit f3e126a
Show file tree
Hide file tree
Showing 25 changed files with 23,896 additions and 663 deletions.
24 changes: 21 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,26 @@ cache:
directories:
- node_modules
node_js:
- "4"
- "8"
notifications:
email: false
email:
recipients:
- aron.helser@kitware.com
on_success: change
on_failure: always
install:
- npm install
- npm install

script:
- npm run 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 npm run gh-pages -- --repo ${GIT_PUBLISH_URL}; fi

after_success:
- npm run semantic-release

branches:
except:
- "/^v\\d+\\.\\d+\\.\\d+$/"
76 changes: 75 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,79 @@
## Change Log

### v3.9.0 (2018/11/07 00:43 +00:00)
- [#452](https://github.com/wwayne/react-tooltip/pull/452) docs(README.md): Updates demo url (@tjFogarty)
- [#439](https://github.com/wwayne/react-tooltip/pull/439) added support for passing options to sanitizeHtml (@icheishvili)
- [#433](https://github.com/wwayne/react-tooltip/pull/433) Use capture mode with globalEventOff (@apandichi)

### v3.8.4 (2018/09/12 18:00 +00:00)
- [#428](https://github.com/wwayne/react-tooltip/pull/428) fix(example): <p> warning from react, make text match code. (@aronhelser)

### v3.8.3 (2018/09/12 13:47 +00:00)
- [#426](https://github.com/wwayne/react-tooltip/pull/426) perf(Use sanitize-html-react instead of sanitize-html) (@jgerlier)
- [#425](https://github.com/wwayne/react-tooltip/pull/425) fix(index.js): fix state initialization (@MtBlue81)

### v3.8.2 (2018/09/11 17:55 +00:00)
- [#413](https://github.com/wwayne/react-tooltip/pull/413) fix(index.js): Use correct orientation when mouse enters (@an4ger)

### v3.8.1 (2018/09/06 14:07 +00:00)
- [#422](https://github.com/wwayne/react-tooltip/pull/422) fix(tooltip): sanitize HTML to prevent XSS (@wichniowski)

### v3.7.0 (2018/09/03 15:13 +00:00)
- [#416](https://github.com/wwayne/react-tooltip/pull/416) feat(mouseover): Add ability to hover on tooltip. (@RobertGary1)
- [#414](https://github.com/wwayne/react-tooltip/pull/414) Fixed jsdoc return typos (@AlexanderEllis)
- [#399](https://github.com/wwayne/react-tooltip/pull/399) Fixes Typos (@jstettner)
- [#391](https://github.com/wwayne/react-tooltip/pull/391) fix(positioning): make sure tooltip is oriented correctly when close to edge (@hassanbot)

### v3.6.1 (2018/06/05 13:46 +00:00)
- [#389](https://github.com/wwayne/react-tooltip/pull/389) fix(isCapture): guard use of currentTarget (@aronhelser)
- [#384](https://github.com/wwayne/react-tooltip/pull/384) Detach custom event listener (@P0lip)

### v3.6.0 (2018/05/15 18:03 +00:00)
- [#360](https://github.com/wwayne/react-tooltip/pull/360) Compute or enrich tip content (@austil)

### v3.5.1 (2018/05/03 18:11 +00:00)
- [#380](https://github.com/wwayne/react-tooltip/pull/380) fix(examples): add SVG example (@P0lip)
- [#379](https://github.com/wwayne/react-tooltip/pull/379) ci(gh-pages): Allow travis to publish new examples to github (@aronhelser)
- [#366](https://github.com/wwayne/react-tooltip/pull/366) Make getPosition() calculate offsets correctly for svg elements (@P0lip)
- [#310](https://github.com/wwayne/react-tooltip/pull/310) Update position with content (@stefanhayden)
- [#368](https://github.com/wwayne/react-tooltip/pull/368) Fix issue where tooltip won't show for adjacent elements. (@tishihar94)
- [#376](https://github.com/wwayne/react-tooltip/pull/376) Add displayName (@clehnert-psl)
- [#375](https://github.com/wwayne/react-tooltip/pull/375) test(scrolling): Add example showing tooltip inside scrolling div (@aronhelser)

### v3.5.0 (2018/04/11 18:04 +00:00)
- [#281](https://github.com/wwayne/react-tooltip/pull/281) Get tooltip content dynamically in the render method (@alfonsomunozpomer)

### v3.4.3 (2018/04/11 15:14 +00:00)
- [#207](https://github.com/wwayne/react-tooltip/pull/207) Return tooltip to original position when possible (@hassanbot)
- [#301](https://github.com/wwayne/react-tooltip/pull/301) insert css as first to allow easy css styling without important (@roblan)

### 3.4.2 (2018/04/09 18:58 +00:00)
- [#373](https://github.com/wwayne/react-tooltip/pull/373) fix(example): 'made dev' works again, small fixes. (@aronhelser)
- [#337](https://github.com/wwayne/react-tooltip/pull/337) Fix README show tip usage error (@sivagao)
- [#359](https://github.com/wwayne/react-tooltip/pull/359) License should use H2 as the previous sections do (@konekoya)

### 3.4.1 (2018/04/05 17:24 +00:00)
- [#369](https://github.com/wwayne/react-tooltip/pull/369) fix(index.js): add missing argument so tooltip hides. (@aronhelser)
- [#372](https://github.com/wwayne/react-tooltip/pull/372) Travis: update node version to fix travis build. (@aronhelser)

### 3.4.0 (2017/10/16 13:39 +00:00)
- [#321](https://github.com/wwayne/react-tooltip/pull/321) React 16 support (@mikecousins)

### 3.3.1 (2017/10/05 05:08 +00:00)
- [#292](https://github.com/wwayne/react-tooltip/pull/292) Fix typo (@piperchester)

### 3.3.0 (2017/04/14 03:34 +00:00)
- [#287](https://github.com/wwayne/react-tooltip/pull/287) Use prop-types package instead of React.PropTypes (@ssilve1989)

### 3.2.10 (2017/03/28 20:41 +00:00)
- [#278](https://github.com/wwayne/react-tooltip/pull/278) Make MutationObserver-based removal tracking (@huumanoid)
- [#272](https://github.com/wwayne/react-tooltip/pull/272) Fix wrapper tag (@huumanoid)
- [#259](https://github.com/wwayne/react-tooltip/pull/259) Track removal of DOM elements (@antoniogiordano)
- [#270](https://github.com/wwayne/react-tooltip/pull/270) Fix typos and improve for clarity (@theholla)

### 3.2.9 (2017/03/20 15:41 +00:00)
- [#236](https://github.com/wwayne/react-tooltip/pull/236) escape backslash in getTargetArray method (@rnons)

### 3.2.7 (2017/02/17 07:24 +00:00)
- [#262](https://github.com/wwayne/react-tooltip/pull/262) Fix nodelist converte in safari (@wwayne)
- [#260](https://github.com/wwayne/react-tooltip/pull/260) Fix NodeList to Array convertion (@huumanoid)
Expand Down Expand Up @@ -65,7 +139,7 @@
- [#145](https://github.com/wwayne/react-tooltip/pull/145) fix typo (@meandavejustice)

### 3.0.13 (2016/07/14 09:53 +00:00)
- [#136](https://github.com/wwayne/react-tooltip/pull/136) Check if current element is under transform (@CremAlex)
- [#136](https://github.com/wwayne/react-tooltip/pull/136) Check if current element is under transform (@CremaFR)
- [#135](https://github.com/wwayne/react-tooltip/pull/135) Transform 3d (@wwayne)

### 3.0.10 (2016/07/12 00:28 +00:00)
Expand Down
13 changes: 8 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ lint:
@echo Linting...
@$(NODE_BIN)/standard --verbose | $(NODE_BIN)/snazzy src/index.js

test: lint
@echo Start testing...
@$(NODE_BIN)/mocha $(MOCHA_OPTS) $(TEST)

convertCSS:
@echo Converting css...
@node bin/transferSass.js
Expand All @@ -33,6 +29,11 @@ devCSS:
@$(NODE_BIN)/node-sass $(SRC)/index.scss $(EXAMPLE_DIST)/style.css
@$(NODE_BIN)/node-sass -w $(EXAMPLE_SRC)/index.scss $(EXAMPLE_DIST)/index.css

deployExample:
@$(NODE_BIN)/browserify -t babelify $(EXAMPLE_SRC)/index.js -o $(EXAMPLE_DIST)/index.js -dv
@$(NODE_BIN)/node-sass $(EXAMPLE_SRC)/index.scss $(EXAMPLE_DIST)/index.css
@$(NODE_BIN)/node-sass $(SRC)/index.scss $(EXAMPLE_DIST)/style.css

devServer:
@echo Listening 8888...
@$(NODE_BIN)/http-server example -p 8888 -s
Expand All @@ -51,9 +52,11 @@ deployJS:
deploy: lint
@echo Deploy...
@rm -rf dist && mkdir dist
@rm -rf $(EXAMPLE_DIST) && mkdir -p $(EXAMPLE_DIST)
@make deployExample
@make convertCSS
@make deployJS
@make genStand
@echo success!

.PHONY: lint convertCSS genStand devJS devCSS devServer dev deployJS deployCSS deploy
.PHONY: lint convertCSS genStand devJS devCSS devServer dev deployExample deployJS deployCSS deploy
77 changes: 47 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@
[download-image]: https://img.shields.io/npm/dm/react-tooltip.svg?style=flat-square
[download-url]: https://npmjs.org/package/react-tooltip

## Maintainers

[aronhelser](https://github.com/aronhelser) Passive maintainer - accepting PRs and doing minor testing, but not fixing issues or doing active development.

[huumanoid](https://github.com/huumanoid) (inactive)

We would gladly accept a new maintainer to help out!

## Installation

```sh
Expand All @@ -27,7 +35,7 @@ import ReactTooltip from 'react-tooltip'
<p data-tip="hello world">Tooltip</p>
```

3 . Including react-tooltip component
3 . Include react-tooltip component


```js
Expand All @@ -36,15 +44,15 @@ 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/standalone/react-tooltip.min.js` into your page. Please make sure that you have already imported `react` and `react-dom` into your page.

## Options
Notes:
* The tooltip is using `type: dark` `place: top` `effect: float` as **default** attribute, you don't have to add these options if you don't want to change default
* The tooltip sets `type: dark` `place: top` `effect: float` as **default** attributes. You don't have to add these options if you don't want to change the defaults
* The option you set on `<ReactTooltip />` component will be implemented on every tooltip in a same page: `<ReactTooltip effect="solid" />`
* The option you set on specific element, for example: `<a data-type="warning"></a>` will only make effect on this specific tooltip
* The option you set on a specific element, for example: `<a data-type="warning"></a>` will only affect this specific tooltip

Check example: [React-tooltip Test](http://wwayne.com/react-tooltip)
Check example: [React-tooltip Test](https://react-tooltip.netlify.com/)

Global|Specific |Type |Values | Description
|:---|:---|:---|:---|:----
Expand All @@ -58,71 +66,76 @@ Global|Specific |Type |Values | Description
offset | data-offset | Object | top, right, bottom, left | `data-offset="{'top': 10, 'left': 10}"` for specific and `offset={{top: 10, left: 10}}` for global
multiline | data-multiline | Bool | true, false | support `<br>`, `<br />` to make multiline
className | data-class | String | | extra custom class, can use !important to overwrite react-tooltip's default class
html | data-html | Bool | true, false | `<p data-tip="<p>HTML tooltip</p>" data-html={true}></p>` or `<ReactTooltip html={true} />`
html | data-html | Bool | true, false | `<p data-tip="<p>HTML tooltip</p>" data-html={true}></p>` or `<ReactTooltip html={true} />`, but see [Security Note](#security-note) below.
delayHide | data-delay-hide | Number | | `<p data-tip="tooltip" data-delay-hide='1000'></p>` or `<ReactTooltip delayHide={1000} />`
delayShow | data-delay-show | Number | | `<p data-tip="tooltip" data-delay-show='1000'></p>` or `<ReactTooltip delayShow={1000} />`
delayUpdate | data-delay-update | Number | | `<p data-tip="tooltip" data-delay-update='1000'></p>` or `<ReactTooltip delayUpdate={1000} />` Sets a delay in calling getContent if the tooltip is already shown and you mouse over another target
insecure | null | Bool | true, false | Whether to inject the style header into the page dynamically (violates CSP style-src but is a convenient default)
border | data-border | Bool | true, false | Add one pixel white border
getContent | null | Func or Array | () => {}, [() => {}, Interval] | Generate the tip content dynamically
afterShow | null | Func | () => {} | Function that will be called after tooltip show
afterHide | null | Func | () => {} | Function that will be called after tooltip hide
getContent | null | Func or Array | (dataTip) => {}, [(dataTip) => {}, Interval] | Generate the tip content dynamically
afterShow | null | Func | (evt) => {} | Function that will be called after tooltip show, with event that triggered show
afterHide | null | Func | (evt) => {} | Function that will be called after tooltip hide, with event that triggered hide
overridePosition | null | Func | ({left:number, top: number}, currentEvent, currentTarget, node, place, desiredPlace, effect, offset) => ({left: number, top: number}) | Function that will replace tooltip position with custom one
disable | data-tip-disable | Bool | true, false | Disable the tooltip behaviour, default is false
scrollHide | data-scroll-hide | Bool | true, false | Hide the tooltip when scrolling, default is true
resizeHide | null | Bool | true, false | Hide the tooltip when resizing the window, default is true
wrapper | null | String | div, span | Selecting the wrapper element of the react tooltip, default is div
clickable | null | Bool | true, false | Enables tooltip to respond to mouse (or touch) events, default is false

### Security Note

The `html` option allows a tooltip to directly display raw HTML. This is a security risk if any of that content is supplied by the user. Any user-supplied content must be sanitized, using a package like [sanitize-html-react](https://www.npmjs.com/package/sanitize-html-react). We chose not to include sanitization after discovering it [increased our package size](https://github.com/wwayne/react-tooltip/issues/429) too much - we don't want to penalize people who don't use the `html` option.

## Using react component as tooltip
Check the example [React-tooltip Test](http://wwayne.com/react-tooltip)
Check the example [React-tooltip Test](https://react-tooltip.netlify.com/)

##### Note:
1. **data-tip** is necessary, because `<ReactTooltip />` find tooltip via this attribute
2. **data-for** correspond to the **id** of `<ReactTooltip />`
3. When using react component as tooltip, you can have many `<ReactTooltip />` in a page but they should have different **id**
1. **data-tip** is necessary, because `<ReactTooltip />` finds the tooltip via this attribute
2. **data-for** corresponds to the **id** of `<ReactTooltip />`
3. When using react component as tooltip, you can have many `<ReactTooltip />` in a page but they should have different **id**s

## Static Methods
###ReactTooltip.hide(target)
### ReactTooltip.hide(target)

> Hide the tooltip manually, the target is optional, if no target passed in, all exitent tooltip will be hiden
> Hide the tooltip manually, the target is optional, if no target passed in, all existing tooltips will be hidden
```js
import {findDOMNode} from 'react-dom'
import ReactTooltip from 'react-tooltip'

<p ref='foo' data-tip='tooltip'></p>
<button onClick={() => { ReactTooltip.hide(findDOMNode(this.refs.foo)) }}></button>
<p ref={ref => this.fooRef = ref} data-tip='tooltip'></p>
<button onClick={() => { ReactTooltip.hide(this.fooRef) }}></button>
<ReactTooltip />
```

###ReactTooltip.rebuild()
### ReactTooltip.rebuild()

> Rebinding all tooltips
###ReactTooltip.show(target)
### ReactTooltip.show(target)

> Show specific tooltip manually, for example:
```js
import {findDOMNode} from 'react-dom'
import ReactTooltip from 'react-tooltip'

<p ref='foo' data-tip='tooltip'></p>
<button onClick={() => { ReactTooltip.show(findDOMNode(this.refs.foo)) }}></button>
<p ref={ref => this.fooRef = ref} data-tip='tooltip'></p>
<button onClick={() => { ReactTooltip.show(this.fooRef) }}></button>
<ReactTooltip />
```

## Trouble Shooting
## Troubleshooting
### 1. Using tooltip within the modal (e.g. [react-modal](https://github.com/reactjs/react-modal))
The component was designed to set a `<Reactooltip />` one place then use tooltip everywhere, but a lot of people stuck in using this component with modal, you can check the discussion [here](https://github.com/wwayne/react-tooltip/issues/130), the summarization of solving the problem is as following:
The component was designed to set `<ReactTooltip />` once and then use tooltip everywhere, but a lot of people get stuck when using this component in a modal. You can read the discussion [here](https://github.com/wwayne/react-tooltip/issues/130). To solve this problem:

1. Put `<ReactTooltip />` out of the `<Modal>`
1. Place `<ReactTooltip />` outside of the `<Modal>`
2. Use `ReactTooltip.rebuild()` when opening the modal
3. If your modal's z-index happens to higher than the tooltip, use the attribute `className` to custom your tooltip's z-index
3. If your modal's z-index happens to be higher than the tooltip's, use the attribute `className` to custom your tooltip's z-index

>I suggest always put `<ReactTooltip />` in the Highest level or smart component of Redux, so you might need these static
>I suggest always putting `<ReactTooltip />` in the Highest level or smart component of Redux, so you might need these static
method to control tooltip's behaviour in some situations

### 2. Hide tooltip when getContent returns undefined
When you set `getContent={() => { return }}` you will find the tooltip will dispaly `true`, that's because React will set the value of data-* to be 'true' automatically if there is no value to be set. So you have to set `data-tip=''` in this situaction.
When you set `getContent={() => { return }}` you will find the tooltip will display `true`. That's because React will set the value of data-* to be 'true' automatically if there is no value to be set. So you have to set `data-tip=''` in this situation.

```jsx
<p data-tip='' data-for='test'></p>
Expand All @@ -139,6 +152,10 @@ Same for empty children, if you don't want show the tooltip when the children is
## Article
[How I insert sass into react component](https://medium.com/@wwayne_me/how-i-insert-sass-into-my-npm-react-component-b46b9811c226#.gi4hxu44a)

### License
## Contributing

We welcome your contribution! Fork the repo, make some changes, submit a pull-request! Our [contributing](contributing.md) doc has some details.

## License

MIT
3 changes: 2 additions & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"url": "https://github.com/wwayne/react-tooltip"
},
"dependencies": {
"react": "^0.14.0 || ^15.0.0"
"react": ">=0.14",
"react-dom": ">=0.14"
}
}
28 changes: 28 additions & 0 deletions contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Contributing

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.

## 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.
* 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
* `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`
* add a version on the github release page, based on the tag

0 comments on commit f3e126a

Please sign in to comment.