react-tooltip 5.0.0-beta.0 → 5.0.0-beta.1
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/dist/react-tooltip-tokens.css +8 -0
- package/dist/react-tooltip.d.ts +25 -0
- package/docs/docs/{getting-started.md → getting-started.mdx} +32 -2
- package/docs/docs/upgrade-guide/changelog-v4-v5.md +1 -0
- package/docs/docusaurus.config.js +10 -1
- package/docs/package.json +1 -1
- package/docs/src/components/HomepageFeatures/index.tsx +25 -24
- package/docs/src/pages/index.tsx +3 -0
- package/docs/static/img/Octocat.jpg +0 -0
- package/docs/static/img/Octocat.png +0 -0
- package/docs/static/img/Octocat.svg +9 -0
- package/docs/static/img/android-chrome-192x192.png +0 -0
- package/docs/static/img/android-chrome-512x512.png +0 -0
- package/docs/static/img/apple-touch-icon.png +0 -0
- package/docs/static/img/favicon-16x16.png +0 -0
- package/docs/static/img/favicon-32x32.png +0 -0
- package/docs/static/img/favicon-old.ico +0 -0
- package/docs/static/img/favicon.ico +0 -0
- package/docs/static/img/github.svg +1 -0
- package/docs/static/img/happy-face-tooltip.png +0 -0
- package/docs/static/img/happy-face-tooltip.svg +21 -0
- package/docs/static/img/logo-dinossaur.svg +1 -0
- package/docs/static/img/logo.png +0 -0
- package/docs/static/img/logo.svg +21 -1
- package/docs/static/img/only-tooltip-top.png +0 -0
- package/docs/static/img/only-tooltip-top.svg +4 -0
- package/docs/static/img/only-tooltip.png +0 -0
- package/docs/static/img/only-tooltip.svg +4 -0
- package/docs/static/img/site.webmanifest +1 -0
- package/docs/yarn.lock +30 -10
- package/package.json +3 -3
- package/rollup.config.types.js +13 -3
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { PlacesType, VariantType, WrapperType, ChildrenType, EventsType } from 'components/Tooltip/TooltipTypes';
|
|
2
|
+
|
|
3
|
+
interface ITooltipController {
|
|
4
|
+
className?: string
|
|
5
|
+
classNameArrow?: string
|
|
6
|
+
content?: string | number
|
|
7
|
+
html?: string
|
|
8
|
+
place?: PlacesType
|
|
9
|
+
offset?: number
|
|
10
|
+
id?: string
|
|
11
|
+
variant?: VariantType
|
|
12
|
+
anchorId?: string
|
|
13
|
+
wrapper?: WrapperType
|
|
14
|
+
children?: ChildrenType
|
|
15
|
+
events?: EventsType[]
|
|
16
|
+
delayShow?: number
|
|
17
|
+
delayHide?: number
|
|
18
|
+
getContent?: function
|
|
19
|
+
isOpen?: boolean
|
|
20
|
+
setIsOpen?: (value: boolean) => void
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
declare const TooltipController: ({ id, anchorId, content, html, className, classNameArrow, variant, place, offset, wrapper, children, events, delayShow, delayHide, getContent, isOpen, setIsOpen, }: ITooltipController) => JSX.Element;
|
|
24
|
+
|
|
25
|
+
export { TooltipController as Tooltip };
|
|
@@ -8,16 +8,43 @@ This docs is related to V5, [if you are using V4 please check here](https://reac
|
|
|
8
8
|
|
|
9
9
|
A react tooltip is a floating react element that displays information related to an anchor element when it receives keyboard focus or the mouse hovers over it.
|
|
10
10
|
|
|
11
|
+
import { Tooltip } from 'react-tooltip'
|
|
12
|
+
import 'react-tooltip/dist/react-tooltip.css'
|
|
13
|
+
|
|
14
|
+
export const TooltipAnchor = ({ children, id, ...rest }) => {
|
|
15
|
+
return (
|
|
16
|
+
<span
|
|
17
|
+
id={id}
|
|
18
|
+
style={{
|
|
19
|
+
display: 'flex',
|
|
20
|
+
justifyContent: 'center',
|
|
21
|
+
alignItems: 'center',
|
|
22
|
+
width: '60px',
|
|
23
|
+
height: '60px',
|
|
24
|
+
borderRadius: '60px',
|
|
25
|
+
color: '#222',
|
|
26
|
+
background: 'rgba(255, 255, 255, 1)',
|
|
27
|
+
cursor: 'pointer',
|
|
28
|
+
boxShadow: '3px 4px 3px rgba(0, 0, 0, 0.5)',
|
|
29
|
+
border: '1px solid #333',
|
|
30
|
+
}}
|
|
31
|
+
{...rest}
|
|
32
|
+
>
|
|
33
|
+
{children}
|
|
34
|
+
</span>
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
|
|
11
38
|
## Installation
|
|
12
39
|
|
|
13
40
|
```bash
|
|
14
|
-
npm install react-tooltip
|
|
41
|
+
npm install react-tooltip@5.0.0-beta.0
|
|
15
42
|
```
|
|
16
43
|
|
|
17
44
|
or
|
|
18
45
|
|
|
19
46
|
```bash
|
|
20
|
-
yarn add react-tooltip
|
|
47
|
+
yarn add react-tooltip@5.0.0-beta.0
|
|
21
48
|
```
|
|
22
49
|
|
|
23
50
|
## Usage
|
|
@@ -68,3 +95,6 @@ import ReactTooltip from 'react-tooltip'
|
|
|
68
95
|
```jsx
|
|
69
96
|
<ReactTooltip anchorId="my-anchor-element" />
|
|
70
97
|
```
|
|
98
|
+
|
|
99
|
+
<TooltipAnchor id="props-basic">◕‿‿◕</TooltipAnchor>
|
|
100
|
+
<Tooltip anchorId="props-basic" content="hello world!" />
|
|
@@ -21,6 +21,7 @@ V4 was a great react tooltip component but was built a few years ago, he was bui
|
|
|
21
21
|
|
|
22
22
|
## Break Changes
|
|
23
23
|
|
|
24
|
+
- All data attributes now has `tooltip` into his name
|
|
24
25
|
- Default Padding changed from `padding: 8px 21px;` to `padding: 8px 16px;`
|
|
25
26
|
- Exported module now is `Tooltip` instead of `ReactTooltip`
|
|
26
27
|
- - If you already have a `Tooltip` component in your application and want to explicitly declare this is `ReactTooltip`, just `import { Tooltip as ReactTooltip } from "react-tooltip"`
|
|
@@ -55,11 +55,20 @@ const config = {
|
|
|
55
55
|
themeConfig:
|
|
56
56
|
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
|
|
57
57
|
({
|
|
58
|
+
announcementBar: {
|
|
59
|
+
id: 'support_us',
|
|
60
|
+
content:
|
|
61
|
+
'⭐️ If you like ReactTooltip, give it a star on <a target="_blank" rel="noopener noreferrer" href="https://github.com/ReactTooltip/react-tooltip">GitHub</a> ⭐️',
|
|
62
|
+
backgroundColor: '#222',
|
|
63
|
+
textColor: '#fff',
|
|
64
|
+
isCloseable: false,
|
|
65
|
+
},
|
|
58
66
|
navbar: {
|
|
59
67
|
title: 'React Tooltip',
|
|
60
68
|
logo: {
|
|
61
69
|
alt: 'React Tooltip Logo',
|
|
62
|
-
src: 'img/
|
|
70
|
+
src: 'img/only-tooltip.svg',
|
|
71
|
+
width: 120,
|
|
63
72
|
},
|
|
64
73
|
items: [
|
|
65
74
|
{
|
package/docs/package.json
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/* eslint-disable import/no-unresolved */
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
3
|
+
/* eslint-disable global-require */
|
|
4
|
+
import React from 'react'
|
|
5
|
+
import clsx from 'clsx'
|
|
6
|
+
import styles from './styles.module.css'
|
|
4
7
|
|
|
5
8
|
type FeatureItem = {
|
|
6
|
-
title: string
|
|
7
|
-
Svg: React.ComponentType<React.ComponentProps<'svg'
|
|
8
|
-
description: JSX.Element
|
|
9
|
-
}
|
|
9
|
+
title: string
|
|
10
|
+
Svg: React.ComponentType<React.ComponentProps<'svg'>>
|
|
11
|
+
description: JSX.Element
|
|
12
|
+
}
|
|
10
13
|
|
|
11
14
|
const FeatureList: FeatureItem[] = [
|
|
12
15
|
{
|
|
13
16
|
title: 'Easy to Use',
|
|
14
|
-
Svg: require('@site/static/img/
|
|
17
|
+
Svg: require('@site/static/img/only-tooltip-top.svg').default,
|
|
15
18
|
description: (
|
|
16
|
-
<>
|
|
17
|
-
Docusaurus was designed from the ground up to be easily installed and
|
|
18
|
-
used to get your website up and running quickly.
|
|
19
|
-
</>
|
|
19
|
+
<>ReactTooltip was designed with love from the ground up to be easily installed and used.</>
|
|
20
20
|
),
|
|
21
21
|
},
|
|
22
22
|
{
|
|
23
|
-
title: '
|
|
24
|
-
Svg: require('@site/static/img/
|
|
23
|
+
title: 'Open Source',
|
|
24
|
+
Svg: require('@site/static/img/github.svg').default,
|
|
25
25
|
description: (
|
|
26
26
|
<>
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
An Open Source project built by developers to developers, we work together with the
|
|
28
|
+
community to always try to improve ReactTooltip.
|
|
29
29
|
</>
|
|
30
30
|
),
|
|
31
31
|
},
|
|
32
32
|
{
|
|
33
|
-
title: '
|
|
34
|
-
Svg: require('@site/static/img/
|
|
33
|
+
title: 'Focus on What Matters',
|
|
34
|
+
Svg: require('@site/static/img/happy-face-tooltip.svg').default,
|
|
35
35
|
description: (
|
|
36
36
|
<>
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
Don’t waste your time building a tooltip component from scratch, just use ReactTooltip
|
|
38
|
+
and focus on new features or bug fixes.
|
|
39
39
|
</>
|
|
40
40
|
),
|
|
41
41
|
},
|
|
42
|
-
]
|
|
42
|
+
]
|
|
43
43
|
|
|
44
|
-
function Feature({title, Svg, description}: FeatureItem) {
|
|
44
|
+
function Feature({ title, Svg, description }: FeatureItem) {
|
|
45
45
|
return (
|
|
46
46
|
<div className={clsx('col col--4')}>
|
|
47
47
|
<div className="text--center">
|
|
@@ -52,7 +52,7 @@ function Feature({title, Svg, description}: FeatureItem) {
|
|
|
52
52
|
<p>{description}</p>
|
|
53
53
|
</div>
|
|
54
54
|
</div>
|
|
55
|
-
)
|
|
55
|
+
)
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
export default function HomepageFeatures(): JSX.Element {
|
|
@@ -61,10 +61,11 @@ export default function HomepageFeatures(): JSX.Element {
|
|
|
61
61
|
<div className="container">
|
|
62
62
|
<div className="row">
|
|
63
63
|
{FeatureList.map((props, idx) => (
|
|
64
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
64
65
|
<Feature key={idx} {...props} />
|
|
65
66
|
))}
|
|
66
67
|
</div>
|
|
67
68
|
</div>
|
|
68
69
|
</section>
|
|
69
|
-
)
|
|
70
|
+
)
|
|
70
71
|
}
|
package/docs/src/pages/index.tsx
CHANGED
|
@@ -14,6 +14,9 @@ function HomepageHeader() {
|
|
|
14
14
|
<header className={clsx('hero hero--primary', styles.heroBanner)}>
|
|
15
15
|
<div className="container">
|
|
16
16
|
<h1 className="hero__title">{siteConfig.title}</h1>
|
|
17
|
+
<p className="hero__logo">
|
|
18
|
+
<img src="img/logo.svg" alt="Happy face with a tooltip saying 'Hello I'm a tooltip'" />
|
|
19
|
+
</p>
|
|
17
20
|
<p className="hero__subtitle">{siteConfig.tagline}</p>
|
|
18
21
|
<div className={styles.buttons}>
|
|
19
22
|
<Link className="button button--primary button--lg" to="/docs/category/upgrade-guide">
|
|
Binary file
|
|
Binary file
|