@purpurds/tooltip 3.5.1 → 3.6.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpurds/tooltip",
3
- "version": "3.5.1",
3
+ "version": "3.6.0",
4
4
  "license": "AGPL-3.0-only",
5
5
  "main": "./dist/tooltip.cjs.js",
6
6
  "types": "./dist/tooltip.d.ts",
@@ -17,10 +17,10 @@
17
17
  "dependencies": {
18
18
  "@radix-ui/react-tooltip": "~1.0.7",
19
19
  "classnames": "~2.5.0",
20
- "@purpurds/button": "3.5.1",
21
- "@purpurds/icon": "3.5.1",
22
- "@purpurds/paragraph": "3.5.1",
23
- "@purpurds/tokens": "3.5.1"
20
+ "@purpurds/button": "3.6.0",
21
+ "@purpurds/icon": "3.6.0",
22
+ "@purpurds/tokens": "3.6.0",
23
+ "@purpurds/paragraph": "3.6.0"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@rushstack/eslint-patch": "~1.7.0",
@@ -42,8 +42,8 @@
42
42
  "prettier": "~2.8.8",
43
43
  "react-dom": "~18.2.0",
44
44
  "react": "~18.2.0",
45
- "typescript": "~5.2.2",
46
- "vite": "~5.1.0",
45
+ "typescript": "~5.4.2",
46
+ "vite": "~5.2.2",
47
47
  "vitest": "~1.4.0",
48
48
  "@purpurds/component-rig": "1.0.0"
49
49
  },
package/readme.mdx CHANGED
@@ -21,24 +21,12 @@ import packageInfo from "./package.json";
21
21
 
22
22
  #### Via NPM
23
23
 
24
- Add the dependency to your consumer app like `"@purpurds/tooltip": "x.y.z"`
25
-
26
- #### From outside the monorepo (build-time)
27
-
28
- To install this package, you need to setup access to the artifactory. [Click here to go to the guide on how to do that](https://github.com/telia-company/jfrog-documentation/blob/main/doc/JFrog/JFrog_Onboarding.md#getting-access-to-artifactory-and-other-jfrog-applications).
29
-
30
- ---
24
+ Add the dependency to your consumer app like `"@purpurds/purpur": "^x.y.z"`
31
25
 
32
26
  In MyApp.tsx
33
27
 
34
28
  ```tsx
35
- import "@purpurds/tokens/index.css";
36
- ```
37
-
38
- and
39
-
40
- ```tsx
41
- import "@purpurds/tooltip/styles";
29
+ import "@purpurds/purpur/styles";
42
30
  ```
43
31
 
44
32
  In MyComponent.tsx
@@ -46,7 +34,7 @@ In MyComponent.tsx
46
34
  Standard usage:
47
35
 
48
36
  ```tsx
49
- import { Tooltip } from "@purpurds/tooltip";
37
+ import { Tooltip } from "@purpurds/purpur";
50
38
 
51
39
  export const MyComponent = () => {
52
40
  return <Tooltip triggerAriaLabel="extra information about something">Some content</Tooltip>;
@@ -56,15 +44,15 @@ export const MyComponent = () => {
56
44
  Setting negative variant with position and alignment:
57
45
 
58
46
  ```tsx
59
- import { Tooltip, TOOLTIP_VARIANT, TOOLTIP_POSITION, TOOLTIP_ALIGN } from "@purpurds/tooltip";
47
+ import { Tooltip } from "@purpurds/purpur";
60
48
 
61
49
  export const MyComponent = () => {
62
50
  return (
63
51
  <Tooltip
64
52
  triggerAriaLabel="extra information about something"
65
- variant={TOOLTIP_VARIANT.PRIMARY_NEGATIVE}
66
- position={TOOLTIP_POSITION.TOP}
67
- align={TOOLTIP_ALIGN.CENTER}
53
+ variant="primary-negative"
54
+ position="top"
55
+ align="center"
68
56
  >
69
57
  Some content
70
58
  </Tooltip>
@@ -75,14 +63,12 @@ export const MyComponent = () => {
75
63
  Using custom trigger element:
76
64
 
77
65
  ```tsx
78
- import { Tooltip } from "@purpurds/tooltip";
79
- import { Button, BUTTON_VARIANT } from "@purpurds/button";
80
- import { IconPetDog } from "@purpurds/icon";
66
+ import { Button, IconPetDog, Tooltip } from "@purpurds/purpur";
81
67
 
82
68
  export const MyComponent = () => {
83
69
  const customTooltipTrigger: ReactNode = (
84
- <Button variant={BUTTON_VARIANT.PRIMARY}>
85
- <IconPetDog size="md" />
70
+ <Button variant="primary">
71
+ <IconPetDog />
86
72
  This is a custom trigger
87
73
  </Button>
88
74
  );
@@ -94,7 +80,7 @@ export const MyComponent = () => {
94
80
  Using jsx in content:
95
81
 
96
82
  ```tsx
97
- import { Tooltip } from "@purpurds/tooltip";
83
+ import { Tooltip } from "@purpurds/purpur";
98
84
 
99
85
  export const MyComponent = () => {
100
86
  return (
@@ -10,6 +10,7 @@
10
10
  animation-duration: var(--purpur-motion-duration-400);
11
11
  animation-timing-function: var(--purpur-motion-easing-ease-out);
12
12
  will-change: transform, opacity;
13
+
13
14
  &--primary {
14
15
  background-color: var(--purpur-color-background-tone-on-tone-primary);
15
16
  }
package/src/tooltip.tsx CHANGED
@@ -40,6 +40,7 @@ export type TooltipProps = {
40
40
  triggerAriaLabel?: string;
41
41
  triggerElement?: ReactNode;
42
42
  className?: string;
43
+ contentClassName?: string;
43
44
  };
44
45
 
45
46
  const ButtonVariants = {
@@ -55,6 +56,7 @@ export const Tooltip = forwardRef(
55
56
  ["data-testid"]: dataTestId,
56
57
  children,
57
58
  className,
59
+ contentClassName,
58
60
  variant = TOOLTIP_VARIANT.PRIMARY,
59
61
  position = TOOLTIP_POSITION.TOP,
60
62
  align = TOOLTIP_ALIGN.CENTER,
@@ -102,6 +104,7 @@ export const Tooltip = forwardRef(
102
104
  side={position}
103
105
  align={align}
104
106
  className={cx([
107
+ contentClassName,
105
108
  styles[`${rootClassName}__content`],
106
109
  styles[`${rootClassName}__content--${variant}`],
107
110
  ])}