@purpurds/badge 5.10.1 → 5.11.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.
- package/dist/LICENSE.txt +1 -1
- package/dist/badge.cjs.js +2 -2
- package/dist/badge.cjs.js.map +1 -1
- package/dist/badge.es.js +15 -15
- package/dist/badge.es.js.map +1 -1
- package/package.json +12 -12
- package/src/badge.stories.tsx +30 -6
- package/readme.mdx +0 -57
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@purpurds/badge",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.11.1",
|
|
4
4
|
"license": "AGPL-3.0-only",
|
|
5
5
|
"main": "./dist/badge.cjs.js",
|
|
6
6
|
"types": "./dist/badge.d.ts",
|
|
@@ -15,30 +15,30 @@
|
|
|
15
15
|
"source": "src/badge.tsx",
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"classnames": "~2.5.0",
|
|
18
|
-
"@purpurds/
|
|
19
|
-
"@purpurds/
|
|
18
|
+
"@purpurds/tokens": "5.11.1",
|
|
19
|
+
"@purpurds/icon": "5.11.1"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@rushstack/eslint-patch": "~1.10.0",
|
|
23
|
-
"@storybook/
|
|
24
|
-
"
|
|
23
|
+
"@storybook/react": "^8.2.6",
|
|
24
|
+
"storybook": "^8.2.6",
|
|
25
25
|
"@telia/base-rig": "~8.2.0",
|
|
26
26
|
"@telia/react-rig": "~3.2.0",
|
|
27
27
|
"@testing-library/dom": "~9.3.3",
|
|
28
28
|
"@testing-library/jest-dom": "~6.4.0",
|
|
29
29
|
"@testing-library/react": "~14.3.0",
|
|
30
30
|
"@types/node": "20.12.12",
|
|
31
|
-
"@types/react-dom": "
|
|
32
|
-
"@types/react": "
|
|
31
|
+
"@types/react-dom": "^18.3.0",
|
|
32
|
+
"@types/react": "^18.3.3",
|
|
33
33
|
"eslint-plugin-testing-library": "~6.2.0",
|
|
34
|
-
"eslint": "
|
|
34
|
+
"eslint": "^8.57.0",
|
|
35
35
|
"jsdom": "~22.1.0",
|
|
36
36
|
"lint-staged": "~10.5.3",
|
|
37
37
|
"prettier": "~2.8.8",
|
|
38
|
-
"react-dom": "
|
|
39
|
-
"react": "
|
|
40
|
-
"typescript": "
|
|
41
|
-
"vite": "
|
|
38
|
+
"react-dom": "^18.3.1",
|
|
39
|
+
"react": "^18.3.1",
|
|
40
|
+
"typescript": "^5.5.4",
|
|
41
|
+
"vite": "5.3.4",
|
|
42
42
|
"vitest": "~1.5.0",
|
|
43
43
|
"@purpurds/component-rig": "1.0.0"
|
|
44
44
|
},
|
package/src/badge.stories.tsx
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { IconSmileyHappy } from "@purpurds/icon";
|
|
1
3
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
4
|
|
|
3
5
|
import "@purpurds/icon/styles";
|
|
4
|
-
import { Badge, BADGE_VARIANT } from "./badge";
|
|
6
|
+
import { Badge, BADGE_VARIANT, badgeVariants } from "./badge";
|
|
5
7
|
|
|
6
|
-
const meta
|
|
8
|
+
const meta = {
|
|
7
9
|
title: "Components/Badge",
|
|
8
10
|
component: Badge,
|
|
9
11
|
parameters: {
|
|
@@ -15,15 +17,37 @@ const meta: Meta<typeof Badge> = {
|
|
|
15
17
|
},
|
|
16
18
|
],
|
|
17
19
|
},
|
|
18
|
-
|
|
20
|
+
args: {
|
|
21
|
+
variant: BADGE_VARIANT.SUCCESS,
|
|
22
|
+
children: "Badge",
|
|
23
|
+
showIcon: true,
|
|
24
|
+
},
|
|
25
|
+
argTypes: {
|
|
26
|
+
variant: {
|
|
27
|
+
table: {
|
|
28
|
+
type: {
|
|
29
|
+
summary: badgeVariants.map((x) => `"${x}"`).join(" | "),
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
} satisfies Meta<typeof Badge>;
|
|
35
|
+
|
|
19
36
|
export default meta;
|
|
20
37
|
|
|
21
38
|
type Story = StoryObj<typeof Badge>;
|
|
22
39
|
|
|
23
|
-
export const Showcase: Story = {
|
|
40
|
+
export const Showcase: Story = {};
|
|
41
|
+
|
|
42
|
+
export const CustomIcon: Story = {
|
|
24
43
|
args: {
|
|
25
44
|
variant: BADGE_VARIANT.SUCCESS,
|
|
26
|
-
children:
|
|
27
|
-
|
|
45
|
+
children: (
|
|
46
|
+
<>
|
|
47
|
+
<IconSmileyHappy size="xs" allyTitle="really wide smile" />
|
|
48
|
+
Great success 👌
|
|
49
|
+
</>
|
|
50
|
+
),
|
|
51
|
+
showIcon: false,
|
|
28
52
|
},
|
|
29
53
|
};
|
package/readme.mdx
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { Meta, Stories, ArgTypes, Primary, Subtitle } from "@storybook/blocks";
|
|
2
|
-
|
|
3
|
-
import * as BadgeStories from "./src/badge.stories";
|
|
4
|
-
import packageInfo from "./package.json";
|
|
5
|
-
|
|
6
|
-
<Meta name="Docs" title="Components/Badge" of={BadgeStories} />
|
|
7
|
-
|
|
8
|
-
# Badge
|
|
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, in the monorepo
|
|
23
|
-
|
|
24
|
-
Add the dependency to your consumer app like `"@purpurds/purpur": "^x.y.z"`
|
|
25
|
-
|
|
26
|
-
### Usage
|
|
27
|
-
|
|
28
|
-
In MyApp.tsx
|
|
29
|
-
|
|
30
|
-
```tsx
|
|
31
|
-
import "@purpurds/purpur/styles";
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
## Standard
|
|
35
|
-
|
|
36
|
-
In MyComponent.tsx
|
|
37
|
-
|
|
38
|
-
```tsx
|
|
39
|
-
import { Badge } from "@purpurds/purpur";
|
|
40
|
-
|
|
41
|
-
export const MyComponent = () => <Badge variant="success">Great success 👌</Badge>;
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
## With custom icon
|
|
45
|
-
|
|
46
|
-
In MyComponent.tsx
|
|
47
|
-
|
|
48
|
-
```tsx
|
|
49
|
-
import { Badge, IconSmileyHappy } from "@purpurds/purpur";
|
|
50
|
-
|
|
51
|
-
export const MyComponent = () => (
|
|
52
|
-
<Badge variant="success" showIcon={false}>
|
|
53
|
-
<IconSmileyHappy size="xs" />
|
|
54
|
-
Great success 👌
|
|
55
|
-
</Badge>
|
|
56
|
-
);
|
|
57
|
-
```
|