Skip to content

Commit d2a371b

Browse files
Merge branch 'master' into feat/imperative-mode
1 parent 555c133 commit d2a371b

File tree

15 files changed

+255
-101
lines changed

15 files changed

+255
-101
lines changed

docs/docs/examples/events.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ Events available in ReactTooltip component.
88

99
:::danger
1010

11-
This has been deprecated. Use the `openOnClick` tooltip prop instead.
11+
This has been deprecated. Use `openOnClick`, or `openEvents`, `closeEvents`, and `globalCloseEvents` instead.
12+
13+
See the [options page](../options.mdx#available-props) for more details.
1214

1315
:::
1416

docs/docs/examples/styling.mdx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,26 @@ In summary, if you do it correctly you can use CSS specificity instead of `!impo
372372

373373
:::
374374

375+
### Customizing opening/closing animation
376+
377+
By default, the tooltip has a fade-in/fade-out transition when opening/closing, with a delay of 150ms for both.
378+
If you wish to change the delay for any of them, override the following CSS variables:
379+
380+
:::caution
381+
382+
Do not set `--rt-transition-closing-delay` to `0`. Doing so will result in the tooltip component being stuck (but not visible) on the DOM. This isn't itself a problem, but may lead to performance issues.
383+
384+
Set to `1ms` or a similar value if you want to disable the fade-out transition when closing.
385+
386+
:::
387+
388+
```css
389+
:root {
390+
--rt-transition-show-delay: 0.15s;
391+
--rt-transition-closing-delay: 0.15s;
392+
}
393+
```
394+
375395
### Disabling ReactTooltip CSS
376396

377397
ReactTooltip works seamlessly by automatically injecting CSS into your application. To disable this functionality, use the tooltip prop `disableStyleInjection`.

docs/docs/getting-started.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,5 +219,7 @@ For advanced styling, check [the examples](./examples/styling.mdx).
219219
--rt-color-warning: #f0ad4e;
220220
--rt-color-info: #337ab7;
221221
--rt-opacity: 0.9;
222+
--rt-transition-show-delay: 0.15s;
223+
--rt-transition-closing-delay: 0.15s;
222224
}
223225
```

docs/docs/options.mdx

Lines changed: 14 additions & 11 deletions
Large diffs are not rendered by default.

docs/docs/upgrade-guide/changelog-v4-v5.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,15 @@ If you run into any problems with the tooltip not updating after changes are mad
5050
- [x] `float` - `boolean` - used to achieve V4's `effect="float"`
5151
- [x] `hidden` - `boolean` - when set, the tooltip will not show
5252
- [x] `render` - `function` - can be used to render dynamic content based on the active anchor element (check [the examples](../examples/render.mdx) for more details)
53-
- [x] `closeOnEsc` - `boolean` - when set, the tooltip will close after pressing the escape key
54-
- [x] `closeOnScroll` - `boolean` - when set, the tooltip will close when scrolling (similar to V4's `scrollHide`)
55-
- [x] `closeOnResize` - `boolean` - when set, the tooltip will close when resizing the window (same as V4's `resizeHide`)
53+
- [x] `closeOnEsc` - **DEPRECATED** - ~~`boolean` - when set, the tooltip will close after pressing the escape key~~
54+
- [x] `closeOnScroll` - **DEPRECATED** - ~~`boolean` - when set, the tooltip will close when scrolling (similar to V4's `scrollHide`)~~
55+
- [x] `closeOnResize` - **DEPRECATED** - ~~`boolean` - when set, the tooltip will close when resizing the window (same as V4's `resizeHide`)~~
56+
57+
:::note
58+
59+
Use `globalCloseEvents` instead of `closeOnEsc`, `closeOnScroll`, and `closeOnResize`. See the [options page](../options.mdx#available-props) for more details.
60+
61+
:::
5662

5763
## `V4` props available in `V5`
5864

@@ -78,10 +84,10 @@ If you run into any problems with the tooltip not updating after changes are mad
7884
- [x] `delayHide` - also available on anchor element as `data-delay-hide`
7985
- [ ] `delayUpdate` - can be implemented if requested
8086
- [x] `delayShow` - also available on anchor element as `data-delay-show`
81-
- [ ] `event`
82-
- [ ] `eventOff`
87+
- [x] `event` - functionality changed and renamed to `openEvents`
88+
- [x] `eventOff` - functionality changed and renamed to `closeEvents`
8389
- [ ] `isCapture`
84-
- [ ] `globalEventOff`
90+
- [x] `globalEventOff` - functionality changed and renamed to `globalCloseEvents`
8591
- [ ] `getContent` - pass dynamic values to `content` instead
8692
- [x] `afterShow`
8793
- [x] `afterHide`
@@ -92,7 +98,7 @@ If you run into any problems with the tooltip not updating after changes are mad
9298
- [x] `wrapper` - also available on anchor element as `data-tooltip-wrapper`
9399
- [ ] `bodyMode`
94100
- [x] `clickable`
95-
- [ ] `disableInternalStyle`
101+
- [x] `disableInternalStyle` - renamed to `disableStyleInjection`
96102

97103
### Detailed informations
98104

docs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"raw-loader": "^4.0.2",
2424
"react": "^18.2.0",
2525
"react-dom": "^18.2.0",
26-
"react-tooltip": "5.21.1"
26+
"react-tooltip": "5.22.0"
2727
},
2828
"devDependencies": {
2929
"@docusaurus/module-type-aliases": "^2.4.1",

docs/yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6126,10 +6126,10 @@ react-textarea-autosize@^8.3.2:
61266126
use-composed-ref "^1.3.0"
61276127
use-latest "^1.2.1"
61286128

6129-
react-tooltip@5.21.1:
6130-
version "5.21.1"
6131-
resolved "https://registry.yarnpkg.com/react-tooltip/-/react-tooltip-5.21.1.tgz#bc49d9662a4b90ed1ed4417b7de535cb5bee1d01"
6132-
integrity sha512-wJqF/yzK1wuJuy5/zAkVErFA609fVv1ZukhGjw44PcMvg9wL0jomnpQyz3qH1H7TWjz/wqO/OMc3ipQNjZ8zYg==
6129+
react-tooltip@5.22.0:
6130+
version "5.22.0"
6131+
resolved "https://registry.yarnpkg.com/react-tooltip/-/react-tooltip-5.22.0.tgz#3082065b1efbd207813f484b617b1b75325f15d5"
6132+
integrity sha512-xbJBRY1LyHYd7j00UeBOqZR9SH/1S47Pe+m8vM1a+ZXglkeSNnBt5YYoPttU/amjC/VZJAPQ8+2B9x8Fl8U1qA==
61336133
dependencies:
61346134
"@floating-ui/dom" "^1.0.0"
61356135
classnames "^2.3.0"

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-tooltip",
3-
"version": "5.21.5",
3+
"version": "5.22.0",
44
"description": "react tooltip component",
55
"scripts": {
66
"dev-rollup": "node ./prebuild.js --env=development && node --max_old_space_size=2048 ./node_modules/rollup/dist/bin/rollup -c rollup.config.dev.js --watch",

src/App.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,9 @@ function App() {
103103
ref={tooltipRef}
104104
anchorSelect="section[id='section-anchor-select'] > p > button"
105105
place="bottom"
106-
events={['click']}
106+
openEvents={{ click: true }}
107+
closeEvents={{ click: true }}
108+
globalCloseEvents={{ clickOutsideAnchor: true }}
107109
>
108110
Tooltip content
109111
</Tooltip>

0 commit comments

Comments
 (0)