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.
Files changed (32) hide show
  1. package/dist/react-tooltip-tokens.css +8 -0
  2. package/dist/react-tooltip.d.ts +25 -0
  3. package/docs/docs/{getting-started.md → getting-started.mdx} +32 -2
  4. package/docs/docs/upgrade-guide/changelog-v4-v5.md +1 -0
  5. package/docs/docusaurus.config.js +10 -1
  6. package/docs/package.json +1 -1
  7. package/docs/src/components/HomepageFeatures/index.tsx +25 -24
  8. package/docs/src/pages/index.tsx +3 -0
  9. package/docs/static/img/Octocat.jpg +0 -0
  10. package/docs/static/img/Octocat.png +0 -0
  11. package/docs/static/img/Octocat.svg +9 -0
  12. package/docs/static/img/android-chrome-192x192.png +0 -0
  13. package/docs/static/img/android-chrome-512x512.png +0 -0
  14. package/docs/static/img/apple-touch-icon.png +0 -0
  15. package/docs/static/img/favicon-16x16.png +0 -0
  16. package/docs/static/img/favicon-32x32.png +0 -0
  17. package/docs/static/img/favicon-old.ico +0 -0
  18. package/docs/static/img/favicon.ico +0 -0
  19. package/docs/static/img/github.svg +1 -0
  20. package/docs/static/img/happy-face-tooltip.png +0 -0
  21. package/docs/static/img/happy-face-tooltip.svg +21 -0
  22. package/docs/static/img/logo-dinossaur.svg +1 -0
  23. package/docs/static/img/logo.png +0 -0
  24. package/docs/static/img/logo.svg +21 -1
  25. package/docs/static/img/only-tooltip-top.png +0 -0
  26. package/docs/static/img/only-tooltip-top.svg +4 -0
  27. package/docs/static/img/only-tooltip.png +0 -0
  28. package/docs/static/img/only-tooltip.svg +4 -0
  29. package/docs/static/img/site.webmanifest +1 -0
  30. package/docs/yarn.lock +30 -10
  31. package/package.json +3 -3
  32. package/rollup.config.types.js +13 -3
@@ -0,0 +1,8 @@
1
+ :root {
2
+ --rt-color-white: #fff;
3
+ --rt-color-dark: #222;
4
+ --rt-color-success: #8dc572;
5
+ --rt-color-error: #be6464;
6
+ --rt-color-warning: #f0ad4e;
7
+ --rt-color-info: #337ab7;
8
+ }
@@ -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/logo.svg',
70
+ src: 'img/only-tooltip.svg',
71
+ width: 120,
63
72
  },
64
73
  items: [
65
74
  {
package/docs/package.json CHANGED
@@ -22,7 +22,7 @@
22
22
  "prism-react-renderer": "^1.3.5",
23
23
  "react": "18.2.0",
24
24
  "react-dom": "18.2.0",
25
- "react-tooltip": "link:.."
25
+ "react-tooltip": "5.0.0-beta.0"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@docusaurus/module-type-aliases": "2.2.0",
@@ -1,47 +1,47 @@
1
- import React from 'react';
2
- import clsx from 'clsx';
3
- import styles from './styles.module.css';
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/undraw_docusaurus_mountain.svg').default,
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: 'Focus on What Matters',
24
- Svg: require('@site/static/img/undraw_docusaurus_tree.svg').default,
23
+ title: 'Open Source',
24
+ Svg: require('@site/static/img/github.svg').default,
25
25
  description: (
26
26
  <>
27
- Docusaurus lets you focus on your docs, and we&apos;ll do the chores. Go
28
- ahead and move your docs into the <code>docs</code> directory.
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: 'Powered by React',
34
- Svg: require('@site/static/img/undraw_docusaurus_react.svg').default,
33
+ title: 'Focus on What Matters',
34
+ Svg: require('@site/static/img/happy-face-tooltip.svg').default,
35
35
  description: (
36
36
  <>
37
- Extend or customize your website layout by reusing React. Docusaurus can
38
- be extended while reusing the same header and footer.
37
+ Don&rsquo;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
  }
@@ -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