@beydesign/storybook 0.0.1 → 0.0.4
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/README.md +49 -40
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/stories/Avatar.d.ts +4 -0
- package/dist/stories/Avatar.js +79 -0
- package/dist/stories/Avatar.stories.d.ts +8 -0
- package/dist/stories/Avatar.stories.js +76 -0
- package/dist/stories/Badge.stories.d.ts +11 -0
- package/dist/stories/Badge.stories.js +98 -0
- package/dist/stories/Bagde.d.ts +3 -0
- package/dist/stories/Bagde.js +113 -0
- package/dist/stories/Button.js +62 -23
- package/dist/stories/Button.stories.d.ts +27 -0
- package/dist/stories/Button.stories.js +295 -0
- package/dist/stories/Checkbox.d.ts +3 -0
- package/dist/stories/Checkbox.js +66 -0
- package/dist/stories/Checkbox.stories.d.ts +13 -0
- package/dist/stories/Checkbox.stories.js +121 -0
- package/dist/stories/Colors.d.ts +1 -4
- package/dist/stories/Colors.js +251 -6
- package/dist/stories/Colors.stories.d.ts +6 -0
- package/dist/stories/Colors.stories.js +10 -0
- package/dist/stories/Typography.d.ts +4 -0
- package/dist/stories/Typography.js +36 -0
- package/dist/stories/Typography.stories.d.ts +25 -0
- package/dist/stories/Typography.stories.js +189 -0
- package/dist/stories/types/avatar.d.ts +44 -0
- package/dist/stories/types/avatar.js +28 -0
- package/dist/stories/types/badge.d.ts +47 -0
- package/dist/stories/types/badge.js +25 -0
- package/dist/stories/types/checkbox.d.ts +26 -0
- package/dist/stories/types/checkbox.js +5 -0
- package/dist/stories/types/typography.d.ts +43 -0
- package/dist/stories/types/typography.js +27 -0
- package/package.json +10 -5
- package/dist/stories/Header.d.ts +0 -12
- package/dist/stories/Header.js +0 -4
- package/dist/stories/Header.stories.d.ts +0 -18
- package/dist/stories/Header.stories.js +0 -26
- package/dist/stories/Page.d.ts +0 -3
- package/dist/stories/Page.js +0 -8
- package/dist/stories/Page.stories.d.ts +0 -12
- package/dist/stories/Page.stories.js +0 -24
package/README.md
CHANGED
|
@@ -1,50 +1,59 @@
|
|
|
1
|
-
#
|
|
1
|
+
# BeyDesign Storybook
|
|
2
2
|
|
|
3
|
-
This
|
|
3
|
+
A React component library implementing the Beyond Presence Design System. This package provides a collection of reusable components that follow the design specifications from our [Figma Design System](https://www.figma.com/design/mIhjz2yJjcpLlIqw6oUivt/Beyond-Presence?node-id=4295-3110&p=f&m=dev).
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Installation
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
```bash
|
|
8
|
+
# First install the required design tokens package
|
|
9
|
+
npm install @beydesign/tokens
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
# Then install the component library
|
|
12
|
+
npm install @beydesign/storybook
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Prerequisites
|
|
16
|
+
|
|
17
|
+
This package depends on `@beydesign/tokens` which provides the design tokens (colors, typography, spacing, etc.) used across the components. Make sure to install and configure it first.
|
|
11
18
|
|
|
12
|
-
|
|
19
|
+
## Usage
|
|
13
20
|
|
|
14
|
-
|
|
21
|
+
1. Import the components you need:
|
|
15
22
|
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
23
|
+
```jsx
|
|
24
|
+
import { MainButton, ButtonHierarchy, ButtonShape, ButtonSize } from '@beydesign/storybook';
|
|
25
|
+
|
|
26
|
+
function App() {
|
|
27
|
+
return (
|
|
28
|
+
<MainButton
|
|
29
|
+
size={ButtonSize.lg}
|
|
30
|
+
shape={ButtonShape.Square}
|
|
31
|
+
onClick={rejoin}
|
|
32
|
+
disabled={buttonsDisabled}
|
|
33
|
+
hierarchy={ButtonHierarchy.Primary}
|
|
34
|
+
showLeadingIcon={false}
|
|
35
|
+
showTrailingIcon={false}
|
|
36
|
+
text="Rejoin"
|
|
37
|
+
/>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
26
40
|
```
|
|
41
|
+
## Development
|
|
42
|
+
|
|
43
|
+
To run the Storybook development environment locally:
|
|
27
44
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
```js
|
|
33
|
-
// eslint.config.js
|
|
34
|
-
import react from 'eslint-plugin-react'
|
|
35
|
-
|
|
36
|
-
export default tseslint.config({
|
|
37
|
-
// Set the react version
|
|
38
|
-
settings: { react: { version: '18.3' } },
|
|
39
|
-
plugins: {
|
|
40
|
-
// Add the react plugin
|
|
41
|
-
react,
|
|
42
|
-
},
|
|
43
|
-
rules: {
|
|
44
|
-
// other rules...
|
|
45
|
-
// Enable its recommended rules
|
|
46
|
-
...react.configs.recommended.rules,
|
|
47
|
-
...react.configs['jsx-runtime'].rules,
|
|
48
|
-
},
|
|
49
|
-
})
|
|
45
|
+
```bash
|
|
46
|
+
npm install
|
|
47
|
+
npm run storybook
|
|
50
48
|
```
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
## Links
|
|
52
|
+
|
|
53
|
+
- [Design System (Figma)](https://www.figma.com/design/mIhjz2yJjcpLlIqw6oUivt/Beyond-Presence?node-id=4295-3110&p=f&m=dev)
|
|
54
|
+
- [NPM Package](https://www.npmjs.com/package/@beydesign/storybook)
|
|
55
|
+
- [Hosted Storybook](https://beyond-presence.github.io/bey-design-system/)
|
|
56
|
+
|
|
57
|
+
## Support
|
|
58
|
+
|
|
59
|
+
For issues and feature requests, please use our GitHub issues page.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { MainButton } from './stories/Button';
|
|
2
|
-
export { ButtonSize, ButtonHierarchy, ButtonState, ButtonShape, ButtonDisplayMode, ButtonType, type MainButtonProps } from './stories/types/button';
|
|
2
|
+
export { ButtonSize, ButtonHierarchy, ButtonState, ButtonShape, ButtonDisplayMode, ButtonType, type MainButtonProps, } from './stories/types/button';
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// Components
|
|
2
2
|
export { MainButton } from './stories/Button';
|
|
3
3
|
// Types
|
|
4
|
-
export { ButtonSize, ButtonHierarchy, ButtonState, ButtonShape, ButtonDisplayMode, ButtonType } from './stories/types/button';
|
|
4
|
+
export { ButtonSize, ButtonHierarchy, ButtonState, ButtonShape, ButtonDisplayMode, ButtonType, } from './stories/types/button';
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { AvatarImage, AvatarSize, AvatarStyle, getInitials, } from './types/avatar';
|
|
3
|
+
import { Avatar as MuiAvatar, } from '@mui/material';
|
|
4
|
+
import { User } from '@phosphor-icons/react';
|
|
5
|
+
import { Typography } from './Typography';
|
|
6
|
+
import { TypographySize, TypographyWeight } from './types/typography';
|
|
7
|
+
export const Avatar = ({ avatarStyle = AvatarStyle.Placeholder, border = false, image = AvatarImage, size = AvatarSize.xxl, style: customStyle, text = 'Scarlett Johansson', }) => {
|
|
8
|
+
const getDimensions = (avatarSize) => {
|
|
9
|
+
switch (avatarSize) {
|
|
10
|
+
case AvatarSize.xs:
|
|
11
|
+
return 24;
|
|
12
|
+
case AvatarSize.sm:
|
|
13
|
+
return 32;
|
|
14
|
+
case AvatarSize.md:
|
|
15
|
+
return 40;
|
|
16
|
+
case AvatarSize.lg:
|
|
17
|
+
return 48;
|
|
18
|
+
case AvatarSize.xl:
|
|
19
|
+
return 56;
|
|
20
|
+
case AvatarSize.xxl:
|
|
21
|
+
return 64;
|
|
22
|
+
default:
|
|
23
|
+
return 40;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
const getColor = (avatarStyle) => {
|
|
27
|
+
switch (avatarStyle) {
|
|
28
|
+
case AvatarStyle.Letters:
|
|
29
|
+
return 'var(--colors-light-foreground-fg-primary)';
|
|
30
|
+
case AvatarStyle.Placeholder:
|
|
31
|
+
return 'var(--colors-light-foreground-fg-tertiary)';
|
|
32
|
+
case AvatarStyle.Picture:
|
|
33
|
+
return 'var(--colors-light-foreground-fg-secondary)';
|
|
34
|
+
default:
|
|
35
|
+
return 'var(--colors-light-foreground-fg-tertiary)';
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
const getTextSize = () => {
|
|
39
|
+
if (size === AvatarSize.xxl)
|
|
40
|
+
return TypographySize.TextL;
|
|
41
|
+
else if ([AvatarSize.xl, AvatarSize.lg].includes(size))
|
|
42
|
+
return TypographySize.TextM;
|
|
43
|
+
else if (size === AvatarSize.md)
|
|
44
|
+
return TypographySize.TextS;
|
|
45
|
+
else if (size === AvatarSize.sm)
|
|
46
|
+
return TypographySize.TextXS;
|
|
47
|
+
else if (size === AvatarSize.xs)
|
|
48
|
+
return TypographySize.Text2XS;
|
|
49
|
+
else
|
|
50
|
+
return TypographySize.TextS;
|
|
51
|
+
};
|
|
52
|
+
const dimensions = getDimensions(size);
|
|
53
|
+
const props = {
|
|
54
|
+
sx: {
|
|
55
|
+
width: dimensions,
|
|
56
|
+
height: dimensions,
|
|
57
|
+
border: border
|
|
58
|
+
? '1px solid var(--colors-light-border-border-component)'
|
|
59
|
+
: 'none',
|
|
60
|
+
backgroundColor: 'var(--colors-light-background-bg-card-highlight)',
|
|
61
|
+
color: getColor(avatarStyle),
|
|
62
|
+
fontSize: getTextSize(),
|
|
63
|
+
borderRadius: 'var(--spacing-tokens-size-in-px-spacing-spacing-11xl)',
|
|
64
|
+
...customStyle,
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
if (avatarStyle === AvatarStyle.Letters) {
|
|
68
|
+
return (_jsx(MuiAvatar, { ...props, children: _jsx(Typography, { text: getInitials(text), size: getTextSize(), weight: TypographyWeight.Medium }) }));
|
|
69
|
+
}
|
|
70
|
+
else if (avatarStyle === AvatarStyle.Picture) {
|
|
71
|
+
return _jsx(MuiAvatar, { ...props, src: image });
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
return (_jsx(MuiAvatar, { ...props, children: _jsx(User, { size: dimensions / 2, weight: "bold" }) }));
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
export const Components = () => {
|
|
78
|
+
return (_jsxs("div", { style: { padding: '20px' }, children: [_jsx("h1", { children: "Avatars" }), _jsxs("div", { style: { display: 'flex', gap: '1rem', flexDirection: 'column' }, children: [_jsxs("div", { children: [_jsx("h2", { children: "Size: sm, Avatar Style: Letters" }), _jsx(Avatar, { text: "Scarlett Johansson", size: AvatarSize.sm, avatarStyle: AvatarStyle.Letters })] }), _jsxs("div", { children: [_jsx("h2", { children: "Size: sm, Avatar Style: Picture" }), _jsx(Avatar, { image: AvatarImage, size: AvatarSize.sm, avatarStyle: AvatarStyle.Picture })] }), _jsxs("div", { children: [_jsx("h2", { children: "Size: sm, Avatar Style: Placeholder" }), _jsx(Avatar, { size: AvatarSize.sm, avatarStyle: AvatarStyle.Placeholder })] })] })] }));
|
|
79
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { Avatar } from './Avatar';
|
|
3
|
+
declare const meta: Meta<typeof Avatar>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Avatar>;
|
|
6
|
+
export declare const Placeholder: Story;
|
|
7
|
+
export declare const Picture: Story;
|
|
8
|
+
export declare const Letters: Story;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { Avatar } from './Avatar';
|
|
2
|
+
import { AvatarImage, AvatarSize, AvatarStyle } from './types/avatar';
|
|
3
|
+
const meta = {
|
|
4
|
+
title: 'Design System/Components/Avatar',
|
|
5
|
+
component: Avatar,
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: 'centered',
|
|
8
|
+
design: {
|
|
9
|
+
type: 'figspec',
|
|
10
|
+
url: 'https://www.figma.com/design/mIhjz2yJjcpLlIqw6oUivt/Beyond-Presence?node-id=4694-9405&t=HGXFzkH7TV5e4UsD-1',
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
tags: ['autodocs'],
|
|
14
|
+
argTypes: {
|
|
15
|
+
text: {
|
|
16
|
+
control: 'text',
|
|
17
|
+
description: 'Avatar text content',
|
|
18
|
+
table: {
|
|
19
|
+
type: { summary: 'string' },
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
image: {
|
|
23
|
+
control: 'text',
|
|
24
|
+
description: 'Image URL for the avatar',
|
|
25
|
+
table: {
|
|
26
|
+
type: { summary: 'string' },
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
border: {
|
|
30
|
+
control: 'boolean',
|
|
31
|
+
description: 'Whether to show a border around the avatar',
|
|
32
|
+
table: {
|
|
33
|
+
type: { summary: 'boolean' },
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
size: {
|
|
37
|
+
control: 'select',
|
|
38
|
+
options: ['xxl', 'xl', 'lg', 'md', 'sm', 'xs'],
|
|
39
|
+
description: 'Size of the avatar',
|
|
40
|
+
table: {
|
|
41
|
+
type: { summary: 'string' },
|
|
42
|
+
defaultValue: { summary: AvatarSize.xxl },
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
avatarStyle: {
|
|
46
|
+
control: 'select',
|
|
47
|
+
options: ['Placeholder', 'Letters', 'Picture'],
|
|
48
|
+
description: 'Style of the avatar',
|
|
49
|
+
table: {
|
|
50
|
+
type: { summary: 'string' },
|
|
51
|
+
defaultValue: { summary: AvatarStyle.Placeholder },
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
export default meta;
|
|
57
|
+
export const Placeholder = {
|
|
58
|
+
args: {
|
|
59
|
+
size: AvatarSize.xxl,
|
|
60
|
+
avatarStyle: AvatarStyle.Placeholder,
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
export const Picture = {
|
|
64
|
+
args: {
|
|
65
|
+
size: AvatarSize.xxl,
|
|
66
|
+
image: AvatarImage,
|
|
67
|
+
avatarStyle: AvatarStyle.Picture,
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
export const Letters = {
|
|
71
|
+
args: {
|
|
72
|
+
size: AvatarSize.xxl,
|
|
73
|
+
text: 'Scarlett Johansson',
|
|
74
|
+
avatarStyle: AvatarStyle.Letters,
|
|
75
|
+
},
|
|
76
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { Badge } from './Bagde';
|
|
3
|
+
declare const meta: Meta<typeof Badge>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Badge>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const Violet: Story;
|
|
8
|
+
export declare const Lemon: Story;
|
|
9
|
+
export declare const Green: Story;
|
|
10
|
+
export declare const Red: Story;
|
|
11
|
+
export declare const Yellow: Story;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { Badge } from './Bagde';
|
|
2
|
+
import { BadgeColor, BadgeSize } from './types/badge';
|
|
3
|
+
const meta = {
|
|
4
|
+
title: 'Design System/Components/Badge',
|
|
5
|
+
component: Badge,
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: 'centered',
|
|
8
|
+
design: {
|
|
9
|
+
type: 'figspec',
|
|
10
|
+
url: 'https://www.figma.com/design/mIhjz2yJjcpLlIqw6oUivt/Beyond-Presence?node-id=4575-13743&t=cm6NmhzfUGa6aUnh-1',
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
tags: ['autodocs'],
|
|
14
|
+
argTypes: {
|
|
15
|
+
text: {
|
|
16
|
+
control: 'text',
|
|
17
|
+
description: 'Badge text content',
|
|
18
|
+
table: {
|
|
19
|
+
type: { summary: 'string' },
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
color: {
|
|
23
|
+
control: 'select',
|
|
24
|
+
description: 'Badge color variant',
|
|
25
|
+
options: Object.values(BadgeColor),
|
|
26
|
+
table: {
|
|
27
|
+
type: { summary: 'string' },
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
size: {
|
|
31
|
+
control: 'select',
|
|
32
|
+
description: 'Badge size variant',
|
|
33
|
+
options: Object.values(BadgeSize),
|
|
34
|
+
table: {
|
|
35
|
+
type: { summary: 'string' },
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
icon: {
|
|
39
|
+
control: 'text',
|
|
40
|
+
description: 'Name of the display Phosphor icon (e.g., "Circle")',
|
|
41
|
+
table: {
|
|
42
|
+
type: { summary: 'string' },
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
fill: {
|
|
46
|
+
control: 'boolean',
|
|
47
|
+
description: 'Fill the badge with color',
|
|
48
|
+
table: {
|
|
49
|
+
type: { summary: 'boolean' },
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
style: {
|
|
53
|
+
control: 'object',
|
|
54
|
+
description: 'Custom style for the badge',
|
|
55
|
+
table: {
|
|
56
|
+
type: { summary: 'object' },
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
export default meta;
|
|
62
|
+
export const Default = {
|
|
63
|
+
args: {
|
|
64
|
+
text: 'Badge',
|
|
65
|
+
color: BadgeColor.Default,
|
|
66
|
+
size: BadgeSize.md,
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
export const Violet = {
|
|
70
|
+
args: {
|
|
71
|
+
text: 'Badge',
|
|
72
|
+
color: BadgeColor.Violet,
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
export const Lemon = {
|
|
76
|
+
args: {
|
|
77
|
+
text: 'Badge',
|
|
78
|
+
color: BadgeColor.Lemon,
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
export const Green = {
|
|
82
|
+
args: {
|
|
83
|
+
text: 'Badge',
|
|
84
|
+
color: BadgeColor.Green,
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
export const Red = {
|
|
88
|
+
args: {
|
|
89
|
+
text: 'Badge',
|
|
90
|
+
color: BadgeColor.Red,
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
export const Yellow = {
|
|
94
|
+
args: {
|
|
95
|
+
text: 'Badge',
|
|
96
|
+
color: BadgeColor.Yellow,
|
|
97
|
+
},
|
|
98
|
+
};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { BadgeColor, BadgeSize } from './types/badge';
|
|
3
|
+
import * as PhosphorIcons from '@phosphor-icons/react';
|
|
4
|
+
import { Box } from '@mui/material';
|
|
5
|
+
import { Typography } from './Typography';
|
|
6
|
+
import { TypographySize, TypographyWeight } from './types/typography';
|
|
7
|
+
const getIconComponent = (iconName, props) => {
|
|
8
|
+
const Icon = PhosphorIcons[iconName];
|
|
9
|
+
return Icon ? _jsx(Icon, { ...props }) : null;
|
|
10
|
+
};
|
|
11
|
+
export const Badge = ({ color = BadgeColor.Default, size = BadgeSize.md, text, style: customStyle, icon = 'Cactus', fill = true, }) => {
|
|
12
|
+
const getBackgroundColor = (color) => {
|
|
13
|
+
switch (color) {
|
|
14
|
+
case BadgeColor.Default:
|
|
15
|
+
return 'var(--primitives-desktop-primary-gray-50)';
|
|
16
|
+
case BadgeColor.Violet:
|
|
17
|
+
return 'var(--primitives-desktop-primary-brand-violet-100)';
|
|
18
|
+
case BadgeColor.Lemon:
|
|
19
|
+
return 'var(--primitives-desktop-primary-brand-lemon-200)';
|
|
20
|
+
case BadgeColor.Green:
|
|
21
|
+
return 'var(--primitives-desktop-primary-success-100)';
|
|
22
|
+
case BadgeColor.Red:
|
|
23
|
+
return 'var(--primitives-desktop-primary-red-100)';
|
|
24
|
+
case BadgeColor.Yellow:
|
|
25
|
+
return 'var(--primitives-desktop-primary-yellow-100)';
|
|
26
|
+
case BadgeColor.Blue:
|
|
27
|
+
return 'var(--primitives-desktop-secondary-blue-100)';
|
|
28
|
+
case BadgeColor.Cyan:
|
|
29
|
+
return 'var(--primitives-desktop-secondary-cyan-50)';
|
|
30
|
+
case BadgeColor.Pink:
|
|
31
|
+
return 'var(--primitives-desktop-secondary-pink-50)';
|
|
32
|
+
case BadgeColor.DarkTransparent:
|
|
33
|
+
return `var(--primitives-desktop-primary-transparent-black-60)`;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
const getTextColor = () => {
|
|
37
|
+
switch (color) {
|
|
38
|
+
case BadgeColor.Default:
|
|
39
|
+
return 'var(--colors-light-text-text-title)';
|
|
40
|
+
case BadgeColor.Violet:
|
|
41
|
+
return 'var(--primitives-desktop-primary-brand-violet-800)';
|
|
42
|
+
case BadgeColor.Lemon:
|
|
43
|
+
return 'var(--primitives-desktop-primary-brand-lemon-900)';
|
|
44
|
+
case BadgeColor.Green:
|
|
45
|
+
return 'var(--primitives-desktop-primary-success-800)';
|
|
46
|
+
case BadgeColor.Red:
|
|
47
|
+
return 'var(--primitives-desktop-primary-red-800)';
|
|
48
|
+
case BadgeColor.Yellow:
|
|
49
|
+
return 'var(--primitives-desktop-primary-yellow-800)';
|
|
50
|
+
case BadgeColor.Blue:
|
|
51
|
+
return 'var(--primitives-desktop-secondary-blue-800)';
|
|
52
|
+
case BadgeColor.Cyan:
|
|
53
|
+
return 'var(--primitives-desktop-secondary-cyan-800)';
|
|
54
|
+
case BadgeColor.Pink:
|
|
55
|
+
return 'var(--primitives-desktop-secondary-pink-800)';
|
|
56
|
+
case BadgeColor.DarkTransparent:
|
|
57
|
+
return 'var(--colors-light-text-text-white)';
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
const getBorder = (color) => {
|
|
61
|
+
switch (color) {
|
|
62
|
+
case BadgeColor.Default:
|
|
63
|
+
return '1px solid var(--primitives-desktop-primary-gray-100)';
|
|
64
|
+
case BadgeColor.Violet:
|
|
65
|
+
return '1px solid var(--primitives-desktop-primary-brand-violet-300)';
|
|
66
|
+
case BadgeColor.Lemon:
|
|
67
|
+
return '1px solid var(--primitives-desktop-primary-brand-lemon-300)';
|
|
68
|
+
case BadgeColor.Green:
|
|
69
|
+
return '1px solid var(--primitives-desktop-primary-success-300)';
|
|
70
|
+
case BadgeColor.Red:
|
|
71
|
+
return '1px solid var(--primitives-desktop-primary-red-300)';
|
|
72
|
+
case BadgeColor.Yellow:
|
|
73
|
+
return '1px solid var(--primitives-desktop-primary-yellow-300)';
|
|
74
|
+
case BadgeColor.Blue:
|
|
75
|
+
return '1px solid var(--primitives-desktop-secondary-blue-300)';
|
|
76
|
+
case BadgeColor.Cyan:
|
|
77
|
+
return '1px solid var(--primitives-desktop-secondary-cyan-300)';
|
|
78
|
+
case BadgeColor.Pink:
|
|
79
|
+
return '1px solid var(--primitives-desktop-secondary-pink-300)';
|
|
80
|
+
case BadgeColor.DarkTransparent:
|
|
81
|
+
return '1px solid rgba(var(--colors-light-background-bg-component-dark), 0.9)';
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
const getPadding = (size) => {
|
|
85
|
+
switch (size) {
|
|
86
|
+
case BadgeSize.lg:
|
|
87
|
+
return 'var(--spacing-tokens-size-in-px-spacing-spacing-sm) var(--spacing-tokens-size-in-px-spacing-spacing-lg)';
|
|
88
|
+
case BadgeSize.md:
|
|
89
|
+
return 'var(--spacing-tokens-size-in-px-spacing-spacing-xs) var(--spacing-tokens-size-in-px-spacing-spacing-md)';
|
|
90
|
+
case BadgeSize.xs:
|
|
91
|
+
return 'var(--spacing-tokens-size-in-px-spacing-spacing-xs) var(--spacing-tokens-size-in-px-spacing-spacing-md)';
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
const getIconSize = (size) => {
|
|
95
|
+
switch (size) {
|
|
96
|
+
case BadgeSize.lg:
|
|
97
|
+
return '20px';
|
|
98
|
+
case BadgeSize.md:
|
|
99
|
+
return '16px';
|
|
100
|
+
case BadgeSize.xs:
|
|
101
|
+
return '12px';
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
const backgroundColor = getBackgroundColor(color);
|
|
105
|
+
const border = getBorder(color);
|
|
106
|
+
const padding = getPadding(size);
|
|
107
|
+
const iconProps = {
|
|
108
|
+
size: getIconSize(size),
|
|
109
|
+
color: getTextColor(),
|
|
110
|
+
weight: 'regular',
|
|
111
|
+
};
|
|
112
|
+
return (_jsxs(Box, { display: "flex", alignItems: "center", justifyContent: "center", bgcolor: fill ? backgroundColor : 'transparent', border: fill ? border : 'none', borderRadius: fill ? 'var(--spacing-tokens-size-in-px-radius-radius-full)' : 'none', padding: padding, gap: "4px", sx: customStyle, children: [icon && getIconComponent(icon, iconProps), text && (_jsx(Typography, { text: text, size: TypographySize.TextS, weight: TypographyWeight.Medium, color: getTextColor() }))] }));
|
|
113
|
+
};
|