@purpurds/tooltip 6.12.5 → 7.0.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/.rush/temp/chunked-rush-logs/tooltip.test_unit.chunks.jsonl +5 -5
- package/.rush/temp/ci_build/@purpurds/tooltip/{078f4ed79381ee77c30f80e9e8133560a4f254ec.untar.log → f7cd05a01b9c166112cdce318a349df8b9343ca0.untar.log} +2 -2
- package/.rush/temp/operation/ci_build/all.log +4 -4
- package/.rush/temp/operation/ci_build/log-chunks.jsonl +4 -4
- package/.rush/temp/operation/ci_build/state.json +1 -1
- package/.rush/temp/operation/test_unit/all.log +5 -5
- package/.rush/temp/operation/test_unit/log-chunks.jsonl +5 -5
- package/.rush/temp/operation/test_unit/state.json +1 -1
- package/.rush/temp/shrinkwrap-deps.json +11 -12
- package/dist/LICENSE.txt +4 -4
- package/dist/tooltip.cjs.js +2 -2
- package/dist/tooltip.cjs.js.map +1 -1
- package/dist/tooltip.d.ts +13 -14
- package/dist/tooltip.d.ts.map +1 -1
- package/dist/tooltip.es.js +1 -2
- package/dist/tooltip.es.js.map +1 -1
- package/package.json +6 -6
- package/src/tooltip.stories.tsx +3 -1
- package/src/tooltip.tsx +21 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@purpurds/tooltip",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0",
|
|
4
4
|
"license": "AGPL-3.0-only",
|
|
5
5
|
"main": "./dist/tooltip.cjs.js",
|
|
6
6
|
"types": "./dist/tooltip.d.ts",
|
|
@@ -17,11 +17,11 @@
|
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@radix-ui/react-tooltip": "~1.1.8",
|
|
19
19
|
"classnames": "~2.5.0",
|
|
20
|
-
"@purpurds/
|
|
21
|
-
"@purpurds/action": "
|
|
22
|
-
"@purpurds/
|
|
23
|
-
"@purpurds/tokens": "
|
|
24
|
-
"@purpurds/
|
|
20
|
+
"@purpurds/paragraph": "7.0.0",
|
|
21
|
+
"@purpurds/action": "7.0.0",
|
|
22
|
+
"@purpurds/button": "7.0.0",
|
|
23
|
+
"@purpurds/tokens": "7.0.0",
|
|
24
|
+
"@purpurds/icon": "7.0.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"eslint": "9.24.0",
|
package/src/tooltip.stories.tsx
CHANGED
|
@@ -22,7 +22,8 @@ const meta = {
|
|
|
22
22
|
args: {
|
|
23
23
|
align: "center",
|
|
24
24
|
position: "top",
|
|
25
|
-
|
|
25
|
+
triggerElement: undefined,
|
|
26
|
+
triggerAriaLabel: "Tooltip trigger",
|
|
26
27
|
negative: false,
|
|
27
28
|
children: "Some tooltip content",
|
|
28
29
|
},
|
|
@@ -104,6 +105,7 @@ export const TooltipWithCustomTrigger: Story = {
|
|
|
104
105
|
name: "With custom trigger",
|
|
105
106
|
args: {
|
|
106
107
|
triggerElement: customTooltipTrigger,
|
|
108
|
+
triggerAriaLabel: undefined,
|
|
107
109
|
},
|
|
108
110
|
};
|
|
109
111
|
|
package/src/tooltip.tsx
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, {
|
|
2
|
+
Children,
|
|
3
|
+
ForwardedRef,
|
|
4
|
+
forwardRef,
|
|
5
|
+
HTMLAttributes,
|
|
6
|
+
ReactNode,
|
|
7
|
+
useState,
|
|
8
|
+
} from "react";
|
|
2
9
|
import { Size } from "@purpurds/action";
|
|
3
10
|
import { Button, BUTTON_VARIANT } from "@purpurds/button";
|
|
4
11
|
import { IconInfo } from "@purpurds/icon/info";
|
|
@@ -26,7 +33,17 @@ export const TOOLTIP_ALIGN = {
|
|
|
26
33
|
} as const;
|
|
27
34
|
export type TooltipAlign = (typeof TOOLTIP_ALIGN)[keyof typeof TOOLTIP_ALIGN];
|
|
28
35
|
|
|
29
|
-
|
|
36
|
+
type WithTriggerElement = {
|
|
37
|
+
triggerElement: ReactNode;
|
|
38
|
+
triggerAriaLabel?: never;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
type WithoutTriggeElement = {
|
|
42
|
+
triggerElement?: never;
|
|
43
|
+
triggerAriaLabel: string;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export type TooltipProps = HTMLAttributes<HTMLDivElement> & {
|
|
30
47
|
align?: TooltipAlign;
|
|
31
48
|
buttonSize?: Size;
|
|
32
49
|
children: ReactNode;
|
|
@@ -36,7 +53,7 @@ export type TooltipProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
|
36
53
|
triggerAriaLabel?: string;
|
|
37
54
|
triggerElement?: ReactNode;
|
|
38
55
|
contentClassName?: string;
|
|
39
|
-
};
|
|
56
|
+
} & (WithTriggerElement | WithoutTriggeElement);
|
|
40
57
|
|
|
41
58
|
const rootClassName = "purpur-tooltip";
|
|
42
59
|
|
|
@@ -51,7 +68,7 @@ export const Tooltip = forwardRef(
|
|
|
51
68
|
negative = false,
|
|
52
69
|
position = TOOLTIP_POSITION.TOP,
|
|
53
70
|
align = TOOLTIP_ALIGN.CENTER,
|
|
54
|
-
triggerAriaLabel
|
|
71
|
+
triggerAriaLabel,
|
|
55
72
|
triggerElement,
|
|
56
73
|
...props
|
|
57
74
|
}: TooltipProps,
|