@purpurds/tooltip 5.11.0 → 5.11.2
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/.rush/temp/ci_build/@purpurds/tooltip/{378d70fad0e063599bb62be99cca0155c7d86993.untar.log → 57d263ae9dcce069c2b376bd44053a79b7a42a49.untar.log} +2 -2
- package/.rush/temp/operation/ci_build/all.log +6 -6
- package/.rush/temp/operation/ci_build/state.json +1 -1
- package/.rush/temp/operation/test_unit/all.log +3 -3
- package/.rush/temp/operation/test_unit/state.json +1 -1
- package/.rush/temp/shrinkwrap-deps.json +314 -184
- package/dist/LICENSE.txt +4 -11
- package/dist/tooltip.cjs.js +6 -6
- package/dist/tooltip.cjs.js.map +1 -1
- package/dist/tooltip.d.ts.map +1 -1
- package/dist/tooltip.es.js +396 -411
- package/dist/tooltip.es.js.map +1 -1
- package/package.json +15 -15
- package/src/tooltip.stories.tsx +39 -18
- package/src/tooltip.tsx +2 -2
- package/readme.mdx +0 -93
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@purpurds/tooltip",
|
|
3
|
-
"version": "5.11.
|
|
3
|
+
"version": "5.11.2",
|
|
4
4
|
"license": "AGPL-3.0-only",
|
|
5
5
|
"main": "./dist/tooltip.cjs.js",
|
|
6
6
|
"types": "./dist/tooltip.d.ts",
|
|
@@ -16,16 +16,16 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@radix-ui/react-tooltip": "~1.0.7",
|
|
18
18
|
"classnames": "~2.5.0",
|
|
19
|
-
"@purpurds/button": "5.11.
|
|
20
|
-
"@purpurds/action": "5.11.
|
|
21
|
-
"@purpurds/icon": "5.11.
|
|
22
|
-
"@purpurds/paragraph": "5.11.
|
|
23
|
-
"@purpurds/tokens": "5.11.
|
|
19
|
+
"@purpurds/button": "5.11.2",
|
|
20
|
+
"@purpurds/action": "5.11.2",
|
|
21
|
+
"@purpurds/icon": "5.11.2",
|
|
22
|
+
"@purpurds/paragraph": "5.11.2",
|
|
23
|
+
"@purpurds/tokens": "5.11.2"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@rushstack/eslint-patch": "~1.10.0",
|
|
27
|
-
"@storybook/
|
|
28
|
-
"
|
|
27
|
+
"@storybook/react": "^8.2.6",
|
|
28
|
+
"storybook": "^8.2.6",
|
|
29
29
|
"@telia/base-rig": "~8.2.0",
|
|
30
30
|
"@telia/react-rig": "~3.2.0",
|
|
31
31
|
"@testing-library/dom": "~9.3.3",
|
|
@@ -33,17 +33,17 @@
|
|
|
33
33
|
"@testing-library/react": "~14.3.0",
|
|
34
34
|
"@testing-library/user-event": "~14.5.1",
|
|
35
35
|
"@types/node": "20.12.12",
|
|
36
|
-
"@types/react-dom": "
|
|
37
|
-
"@types/react": "
|
|
36
|
+
"@types/react-dom": "^18.3.0",
|
|
37
|
+
"@types/react": "^18.3.3",
|
|
38
38
|
"eslint-plugin-testing-library": "~6.2.0",
|
|
39
|
-
"eslint": "
|
|
39
|
+
"eslint": "^8.57.0",
|
|
40
40
|
"jsdom": "~22.1.0",
|
|
41
41
|
"lint-staged": "~10.5.3",
|
|
42
42
|
"prettier": "~2.8.8",
|
|
43
|
-
"react-dom": "
|
|
44
|
-
"react": "
|
|
45
|
-
"typescript": "
|
|
46
|
-
"vite": "
|
|
43
|
+
"react-dom": "^18.3.1",
|
|
44
|
+
"react": "^18.3.1",
|
|
45
|
+
"typescript": "^5.5.4",
|
|
46
|
+
"vite": "5.3.4",
|
|
47
47
|
"vitest": "~1.5.0",
|
|
48
48
|
"@purpurds/component-rig": "1.0.0"
|
|
49
49
|
},
|
package/src/tooltip.stories.tsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { ReactNode } from "react";
|
|
2
|
+
import { SIZE } from "@purpurds/action";
|
|
2
3
|
import { Button, BUTTON_VARIANT } from "@purpurds/button";
|
|
3
4
|
import { IconPetDog } from "@purpurds/icon";
|
|
4
5
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
@@ -8,7 +9,7 @@ import "@purpurds/icon/styles";
|
|
|
8
9
|
import "@purpurds/paragraph/styles";
|
|
9
10
|
import { Tooltip, TOOLTIP_ALIGN, TOOLTIP_POSITION } from "./tooltip";
|
|
10
11
|
|
|
11
|
-
const meta
|
|
12
|
+
const meta = {
|
|
12
13
|
title: "Components/Tooltip",
|
|
13
14
|
component: Tooltip,
|
|
14
15
|
decorators: [
|
|
@@ -20,14 +21,45 @@ const meta: Meta<typeof Tooltip> = {
|
|
|
20
21
|
],
|
|
21
22
|
args: {
|
|
22
23
|
align: "center",
|
|
23
|
-
children: "Some tooltip content",
|
|
24
|
-
negative: false,
|
|
25
24
|
position: "top",
|
|
26
25
|
triggerAriaLabel: "Tooltip button",
|
|
26
|
+
negative: false,
|
|
27
|
+
children: "Some tooltip content",
|
|
27
28
|
},
|
|
28
29
|
argTypes: {
|
|
29
|
-
position: {
|
|
30
|
-
|
|
30
|
+
position: {
|
|
31
|
+
control: { type: "select" },
|
|
32
|
+
options: Object.values(TOOLTIP_POSITION),
|
|
33
|
+
table: {
|
|
34
|
+
type: {
|
|
35
|
+
summary: Object.values(TOOLTIP_POSITION)
|
|
36
|
+
.map((x) => `"${x}"`)
|
|
37
|
+
.join(" | "),
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
align: {
|
|
42
|
+
control: { type: "select" },
|
|
43
|
+
options: Object.values(TOOLTIP_ALIGN),
|
|
44
|
+
table: {
|
|
45
|
+
type: {
|
|
46
|
+
summary: Object.values(TOOLTIP_ALIGN)
|
|
47
|
+
.map((x) => `"${x}"`)
|
|
48
|
+
.join(" | "),
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
buttonSize: {
|
|
53
|
+
control: { type: "select" },
|
|
54
|
+
options: Object.values(SIZE),
|
|
55
|
+
table: {
|
|
56
|
+
type: {
|
|
57
|
+
summary: Object.values(SIZE)
|
|
58
|
+
.map((x) => `"${x}"`)
|
|
59
|
+
.join(" | "),
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
},
|
|
31
63
|
},
|
|
32
64
|
parameters: {
|
|
33
65
|
design: [
|
|
@@ -38,7 +70,8 @@ const meta: Meta<typeof Tooltip> = {
|
|
|
38
70
|
},
|
|
39
71
|
],
|
|
40
72
|
},
|
|
41
|
-
}
|
|
73
|
+
} satisfies Meta<typeof Tooltip>;
|
|
74
|
+
|
|
42
75
|
const customTooltipTrigger: ReactNode = (
|
|
43
76
|
<Button aria-label="toggleButton" variant={BUTTON_VARIANT.PRIMARY}>
|
|
44
77
|
<IconPetDog size="md" />
|
|
@@ -67,18 +100,6 @@ export const Showcase: Story = {
|
|
|
67
100
|
},
|
|
68
101
|
};
|
|
69
102
|
|
|
70
|
-
export const TooltipNegative: Story = {
|
|
71
|
-
name: "Negative",
|
|
72
|
-
args: {
|
|
73
|
-
negative: true,
|
|
74
|
-
},
|
|
75
|
-
parameters: {
|
|
76
|
-
backgrounds: {
|
|
77
|
-
default: "Primary tone-on-tone",
|
|
78
|
-
},
|
|
79
|
-
},
|
|
80
|
-
};
|
|
81
|
-
|
|
82
103
|
export const TooltipWithCustomTrigger: Story = {
|
|
83
104
|
name: "With custom trigger",
|
|
84
105
|
args: {
|
package/src/tooltip.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { Children, ForwardedRef, forwardRef, ReactNode, useState } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { Size } from "@purpurds/action";
|
|
3
3
|
import { Button, BUTTON_VARIANT } from "@purpurds/button";
|
|
4
4
|
import { IconInfo } from "@purpurds/icon";
|
|
5
5
|
import { Paragraph, ParagraphVariant } from "@purpurds/paragraph";
|
|
@@ -45,7 +45,7 @@ export const Tooltip = forwardRef(
|
|
|
45
45
|
(
|
|
46
46
|
{
|
|
47
47
|
["data-testid"]: dataTestId,
|
|
48
|
-
buttonSize =
|
|
48
|
+
buttonSize = "md",
|
|
49
49
|
children,
|
|
50
50
|
className,
|
|
51
51
|
contentClassName,
|
package/readme.mdx
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { Meta, Stories, ArgTypes, Primary, Subtitle } from "@storybook/blocks";
|
|
2
|
-
|
|
3
|
-
import * as TooltipStories from "./src/tooltip.stories";
|
|
4
|
-
import packageInfo from "./package.json";
|
|
5
|
-
|
|
6
|
-
<Meta name="Docs" title="Components/Tooltip" of={TooltipStories} />
|
|
7
|
-
|
|
8
|
-
# Tooltip
|
|
9
|
-
|
|
10
|
-
<Subtitle>Version {packageInfo.version}</Subtitle>
|
|
11
|
-
|
|
12
|
-
### Showcase
|
|
13
|
-
|
|
14
|
-
<Primary />
|
|
15
|
-
|
|
16
|
-
### Properties
|
|
17
|
-
|
|
18
|
-
<ArgTypes />
|
|
19
|
-
|
|
20
|
-
### Installation
|
|
21
|
-
|
|
22
|
-
#### Via NPM
|
|
23
|
-
|
|
24
|
-
Add the dependency to your consumer app like `"@purpurds/purpur": "^x.y.z"`
|
|
25
|
-
|
|
26
|
-
In MyApp.tsx
|
|
27
|
-
|
|
28
|
-
```tsx
|
|
29
|
-
import "@purpurds/purpur/styles";
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
In MyComponent.tsx
|
|
33
|
-
|
|
34
|
-
Standard usage:
|
|
35
|
-
|
|
36
|
-
```tsx
|
|
37
|
-
import { Tooltip } from "@purpurds/purpur";
|
|
38
|
-
|
|
39
|
-
export const MyComponent = () => {
|
|
40
|
-
return <Tooltip triggerAriaLabel="extra information about something">Some content</Tooltip>;
|
|
41
|
-
};
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
Setting negative variant with position and alignment:
|
|
45
|
-
|
|
46
|
-
```tsx
|
|
47
|
-
import { Tooltip } from "@purpurds/purpur";
|
|
48
|
-
|
|
49
|
-
export const MyComponent = () => {
|
|
50
|
-
return (
|
|
51
|
-
<Tooltip
|
|
52
|
-
triggerAriaLabel="extra information about something"
|
|
53
|
-
variant="primary"
|
|
54
|
-
negative
|
|
55
|
-
position="top"
|
|
56
|
-
align="center"
|
|
57
|
-
>
|
|
58
|
-
Some content
|
|
59
|
-
</Tooltip>
|
|
60
|
-
);
|
|
61
|
-
};
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
Using custom trigger element:
|
|
65
|
-
|
|
66
|
-
```tsx
|
|
67
|
-
import { Button, IconPetDog, Tooltip } from "@purpurds/purpur";
|
|
68
|
-
|
|
69
|
-
export const MyComponent = () => {
|
|
70
|
-
const customTooltipTrigger: ReactNode = (
|
|
71
|
-
<Button variant="primary">
|
|
72
|
-
<IconPetDog />
|
|
73
|
-
This is a custom trigger
|
|
74
|
-
</Button>
|
|
75
|
-
);
|
|
76
|
-
|
|
77
|
-
return <Tooltip triggerElement={customTooltipTrigger}>Some content</Tooltip>;
|
|
78
|
-
};
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
Using jsx in content:
|
|
82
|
-
|
|
83
|
-
```tsx
|
|
84
|
-
import { Tooltip } from "@purpurds/purpur";
|
|
85
|
-
|
|
86
|
-
export const MyComponent = () => {
|
|
87
|
-
return (
|
|
88
|
-
<Tooltip triggerAriaLabel="extra information about something">
|
|
89
|
-
<div>Hello world! This is the content</div>
|
|
90
|
-
</Tooltip>
|
|
91
|
-
);
|
|
92
|
-
};
|
|
93
|
-
```
|