react-tooltip 5.12.0-beta.1014.3 → 5.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -22
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
[![npm download][download-image]][download-url]
|
|
7
7
|

|
|
8
8
|

|
|
9
|
+
|
|
9
10
|
<!--  -->
|
|
10
11
|
|
|
11
12
|
[download-image]: https://img.shields.io/npm/dm/react-tooltip.svg?style=flat-square
|
|
@@ -17,7 +18,7 @@
|
|
|
17
18
|
</a>
|
|
18
19
|
</p>
|
|
19
20
|
|
|
20
|
-
If you like the project, please give the project a GitHub 🌟
|
|
21
|
+
If you like the project, please give the project a GitHub 🌟
|
|
21
22
|
|
|
22
23
|
## Demo
|
|
23
24
|
|
|
@@ -55,20 +56,23 @@ yarn add react-tooltip
|
|
|
55
56
|
|
|
56
57
|
## Usage
|
|
57
58
|
|
|
59
|
+
> :warning: ReactTooltip will inject the default styles into the page by default on version `5.13.0` or newer.
|
|
60
|
+
> The `react-tooltip/dist/react-tooltip.css` file is only for style reference and doesn't need to be imported manually anymore if you are already using `v5.13.0` or upper.
|
|
61
|
+
|
|
58
62
|
> :warning: If you were already using `react-tooltip<=5.7.5`, you'll be getting some deprecation warnings regarding the `anchorId` prop and some other features.
|
|
59
|
-
In versions >=5.8.0, we've introduced the `data-tooltip-id` attribute, and the `anchorSelect` prop, which are our recommended methods of using the tooltip moving forward. Check [the docs](https://react-tooltip.com/docs/getting-started) for more details.
|
|
63
|
+
> In versions >=5.8.0, we've introduced the `data-tooltip-id` attribute, and the `anchorSelect` prop, which are our recommended methods of using the tooltip moving forward. Check [the docs](https://react-tooltip.com/docs/getting-started) for more details.
|
|
60
64
|
|
|
61
65
|
### Using NPM package
|
|
62
66
|
|
|
63
67
|
1 . Import the CSS file to set default styling.
|
|
64
68
|
|
|
65
|
-
> :warning:
|
|
69
|
+
> :warning: If you are using a version before than `v5.13.0`, you must import the CSS file or the tooltip won't show!
|
|
66
70
|
|
|
67
71
|
```js
|
|
68
72
|
import 'react-tooltip/dist/react-tooltip.css'
|
|
69
73
|
```
|
|
70
74
|
|
|
71
|
-
This needs to be done only once. We suggest you do it on your `src/index.js` or equivalent file.
|
|
75
|
+
This needs to be done only once and only if you are using a version before than `5.13.0`. We suggest you do it on your `src/index.js` or equivalent file.
|
|
72
76
|
|
|
73
77
|
2 . Import `react-tooltip` after installation.
|
|
74
78
|
|
|
@@ -123,7 +127,7 @@ You can import `node_modules/react-tooltip/dist/react-tooltip.[mode].js` into yo
|
|
|
123
127
|
|
|
124
128
|
mode: `esm` `cjs` `umd`
|
|
125
129
|
|
|
126
|
-
|
|
130
|
+
If you are using a version older than `v5.13.0` don't forget to import the CSS file from `node_modules/react-tooltip/dist/react-tooltip.css` to set default styling. This needs to be done only once in your application. Version `v5.13.0` or newer already inject the default styles into the page by default.
|
|
127
131
|
|
|
128
132
|
PS: all the files have a minified version and a non-minified version.
|
|
129
133
|
|
|
@@ -145,7 +149,7 @@ You can use [`renderToStaticMarkup()` function](https://reactjs.org/docs/react-d
|
|
|
145
149
|
```jsx
|
|
146
150
|
import ReactDOMServer from 'react-dom/server';
|
|
147
151
|
[...]
|
|
148
|
-
<a
|
|
152
|
+
<a
|
|
149
153
|
data-tooltip-id="my-tooltip"
|
|
150
154
|
data-tooltip-html={ReactDOMServer.renderToStaticMarkup(<div>I am <b>JSX</b> content</div>)}
|
|
151
155
|
>
|
|
@@ -172,7 +176,7 @@ If there isn't, feel free to [submit a new issue](https://github.com/ReactToolti
|
|
|
172
176
|
|
|
173
177
|
### The tooltip is broken/not showing up
|
|
174
178
|
|
|
175
|
-
Make sure you've imported the default styling. You only need to do this once on your application
|
|
179
|
+
Make sure you've imported the default styling. You only need to do this once on your application and only if you are using a version before `5.13.0`, `App.jsx`/`App.tsx` is usually a good place to do it.
|
|
176
180
|
|
|
177
181
|
```jsx
|
|
178
182
|
import 'react-tooltip/dist/react-tooltip.css'
|
|
@@ -184,7 +188,7 @@ If `data-tooltip-content` and `data-tooltip-html` are both unset (or they have e
|
|
|
184
188
|
|
|
185
189
|
### Next.js `TypeError: f is not a function`
|
|
186
190
|
|
|
187
|
-
This problem seems to be caused by a bug related to the SWC bundler used by Next.js.
|
|
191
|
+
This problem seems to be caused by a bug related to the SWC bundler used by Next.js.
|
|
188
192
|
The best way to solve this is to upgrade to `next@13.3.0` or later versions.
|
|
189
193
|
|
|
190
194
|
Less ideally, if you're unable to upgrade, you can set `swcMinify: false` on your `next.config.js` file.
|
|
@@ -199,7 +203,7 @@ This is specially relevant when using components that are conditionally rendered
|
|
|
199
203
|
|
|
200
204
|
Always try to keep the `<Tooltip />` component rendered, so if you're having issues with a tooltip you've placed inside a component which is placed/removed from the DOM dynamically, try to move the tooltip outside of it.
|
|
201
205
|
|
|
202
|
-
We usually recommend placing the tooltip component directly inside the root component of your application (usually on `App.jsx`/`App.tsx`).
|
|
206
|
+
We usually recommend placing the tooltip component directly inside the root component of your application (usually on `App.jsx`/`App.tsx`).
|
|
203
207
|
|
|
204
208
|
#### Dynamically generated anchor elements
|
|
205
209
|
|
|
@@ -212,18 +216,12 @@ Here's a simple example on how to improve performance when using dynamically gen
|
|
|
212
216
|
```jsx
|
|
213
217
|
// ❌ BAD
|
|
214
218
|
<div className="items-container">
|
|
215
|
-
{
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
>
|
|
222
|
-
{content}
|
|
223
|
-
<Tooltip id={`tooltip-${id}`} content={tooltip} />
|
|
224
|
-
</div>
|
|
225
|
-
))
|
|
226
|
-
}
|
|
219
|
+
{myItems.map(({ id, content, tooltip }) => (
|
|
220
|
+
<div key={id} className="item" data-tooltip-id={`tooltip-${id}`}>
|
|
221
|
+
{content}
|
|
222
|
+
<Tooltip id={`tooltip-${id}`} content={tooltip} />
|
|
223
|
+
</div>
|
|
224
|
+
))}
|
|
227
225
|
</div>
|
|
228
226
|
```
|
|
229
227
|
|
|
@@ -268,7 +266,6 @@ Here's a simple example on how to improve performance when using dynamically gen
|
|
|
268
266
|
|
|
269
267
|
[wwayne](https://github.com/wwayne) (inactive) - Creator of the original React Tooltip (V1.x ~ V4.x.)
|
|
270
268
|
|
|
271
|
-
|
|
272
269
|
We would gladly accept a new maintainer to help out!
|
|
273
270
|
|
|
274
271
|
## Contributing
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-tooltip",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.13.0",
|
|
4
4
|
"description": "react tooltip component",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"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",
|