@purpurds/badge 3.5.1 → 3.7.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/dist/LICENSE.txt +1 -1
- package/dist/badge.cjs.js +3 -3
- package/dist/badge.cjs.js.map +1 -1
- package/dist/badge.d.ts.map +1 -1
- package/dist/badge.es.js +87 -65
- package/dist/badge.es.js.map +1 -1
- package/dist/badge.system.js +3 -3
- package/dist/badge.system.js.map +1 -1
- package/package.json +5 -5
- package/readme.mdx +3 -15
- package/src/badge.test.tsx +2 -2
- package/src/badge.tsx +8 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@purpurds/badge",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.7.0",
|
|
4
4
|
"license": "AGPL-3.0-only",
|
|
5
5
|
"main": "./dist/badge.cjs.js",
|
|
6
6
|
"types": "./dist/badge.d.ts",
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
"source": "src/badge.tsx",
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"classnames": "~2.5.0",
|
|
19
|
-
"@purpurds/icon": "3.
|
|
20
|
-
"@purpurds/tokens": "3.
|
|
19
|
+
"@purpurds/icon": "3.7.0",
|
|
20
|
+
"@purpurds/tokens": "3.7.0"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@rushstack/eslint-patch": "~1.7.0",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"prettier": "~2.8.8",
|
|
39
39
|
"react-dom": "~18.2.0",
|
|
40
40
|
"react": "~18.2.0",
|
|
41
|
-
"typescript": "~5.
|
|
42
|
-
"vite": "~5.
|
|
41
|
+
"typescript": "~5.4.2",
|
|
42
|
+
"vite": "~5.2.2",
|
|
43
43
|
"vitest": "~1.4.0",
|
|
44
44
|
"@purpurds/component-rig": "1.0.0"
|
|
45
45
|
},
|
package/readme.mdx
CHANGED
|
@@ -21,30 +21,18 @@ import packageInfo from "./package.json";
|
|
|
21
21
|
|
|
22
22
|
#### Via NPM, in the monorepo
|
|
23
23
|
|
|
24
|
-
Add the dependency to your consumer app like `"@purpurds/
|
|
25
|
-
|
|
26
|
-
### Via NPM, outside the monorepo (build-time)
|
|
27
|
-
|
|
28
|
-
To install this package, you need to setup access to the new 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/
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
and
|
|
39
|
-
|
|
40
|
-
```tsx
|
|
41
|
-
import "@purpurds/badge/styles";
|
|
29
|
+
import "@purpurds/purpur/styles";
|
|
42
30
|
```
|
|
43
31
|
|
|
44
32
|
In MyComponent.tsx
|
|
45
33
|
|
|
46
34
|
```tsx
|
|
47
|
-
import { Badge } from "@purpurds/
|
|
35
|
+
import { Badge } from "@purpurds/purpur";
|
|
48
36
|
|
|
49
37
|
export const MyComponent = () => {
|
|
50
38
|
return (
|
package/src/badge.test.tsx
CHANGED
|
@@ -26,9 +26,9 @@ describe("Badge", () => {
|
|
|
26
26
|
expect(screen.getByTestId("badge-icon")).toHaveAttribute("aria-label", "Testing badge");
|
|
27
27
|
});
|
|
28
28
|
|
|
29
|
-
it("should render with badge
|
|
29
|
+
it("should render with badge without icon, with default icon", () => {
|
|
30
30
|
render(
|
|
31
|
-
<Badge data-testid="badge" variant="special" allyLabel="Testing badge">
|
|
31
|
+
<Badge data-testid="badge" variant="special" allyLabel="Testing badge" showIcon={false}>
|
|
32
32
|
Badge test
|
|
33
33
|
</Badge>
|
|
34
34
|
);
|
package/src/badge.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { ReactNode } from "react";
|
|
2
|
-
import { alert, checkCircle, error, Icon } from "@purpurds/icon";
|
|
2
|
+
import { alert, checkCircle, error, Icon, info, offering, question } from "@purpurds/icon";
|
|
3
3
|
import c from "classnames";
|
|
4
4
|
|
|
5
5
|
import styles from "./badge.module.scss";
|
|
@@ -20,12 +20,19 @@ export type BadgeVariant = (typeof BADGE_VARIANT)[keyof typeof BADGE_VARIANT];
|
|
|
20
20
|
|
|
21
21
|
const getIcon = (variant: BadgeVariant) => {
|
|
22
22
|
switch (variant) {
|
|
23
|
+
case BADGE_VARIANT.ATTENTION:
|
|
24
|
+
case BADGE_VARIANT.SPECIAL:
|
|
25
|
+
return offering;
|
|
26
|
+
case BADGE_VARIANT.INFORMATION:
|
|
27
|
+
return info;
|
|
23
28
|
case BADGE_VARIANT.SUCCESS:
|
|
24
29
|
return checkCircle;
|
|
25
30
|
case BADGE_VARIANT.WARNING:
|
|
26
31
|
return alert;
|
|
27
32
|
case BADGE_VARIANT.ERROR:
|
|
28
33
|
return error;
|
|
34
|
+
case BADGE_VARIANT.NEUTRAL:
|
|
35
|
+
return question;
|
|
29
36
|
default:
|
|
30
37
|
return;
|
|
31
38
|
}
|