@beydesign/storybook 0.0.3 → 0.0.5

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/index.d.ts CHANGED
@@ -1,2 +1,11 @@
1
1
  export { MainButton } from './stories/Button';
2
+ export { Avatar } from './stories/Avatar';
3
+ export { Typography } from './stories/Typography';
4
+ export { Badge } from './stories/Bagde';
5
+ export { Colors } from './stories/Colors';
6
+ export { Checkbox } from './stories/Checkbox';
2
7
  export { ButtonSize, ButtonHierarchy, ButtonState, ButtonShape, ButtonDisplayMode, ButtonType, type MainButtonProps, } from './stories/types/button';
8
+ export { BadgeColor, BadgeSize, type BadgeProps } from './stories/types/badge';
9
+ export { AvatarStyle, AvatarSize, type AvatarProps, } from './stories/types/avatar';
10
+ export { TypographySize, TypographyWeight, type TypographyProps, } from './stories/types/typography';
11
+ export { CheckboxType, type CheckboxProps } from './stories/types/checkbox';
package/dist/index.js CHANGED
@@ -1,4 +1,13 @@
1
1
  // Components
2
2
  export { MainButton } from './stories/Button';
3
+ export { Avatar } from './stories/Avatar';
4
+ export { Typography } from './stories/Typography';
5
+ export { Badge } from './stories/Bagde';
6
+ export { Colors } from './stories/Colors';
7
+ export { Checkbox } from './stories/Checkbox';
3
8
  // Types
4
9
  export { ButtonSize, ButtonHierarchy, ButtonState, ButtonShape, ButtonDisplayMode, ButtonType, } from './stories/types/button';
10
+ export { BadgeColor, BadgeSize } from './stories/types/badge';
11
+ export { AvatarStyle, AvatarSize, } from './stories/types/avatar';
12
+ export { TypographySize, TypographyWeight, } from './stories/types/typography';
13
+ export { CheckboxType } from './stories/types/checkbox';
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { AvatarProps, ComponentsProps } from './types/avatar';
3
+ export declare const Avatar: React.FC<AvatarProps>;
4
+ export declare const Components: React.FC<ComponentsProps>;
@@ -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,3 @@
1
+ import React from 'react';
2
+ import { BadgeProps } from './types/badge';
3
+ export declare const Badge: React.FC<BadgeProps>;
@@ -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
+ };
@@ -1,12 +1,14 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Button, CircularProgress } from '@mui/material';
2
+ import { CircularProgress } from '@mui/material';
3
3
  import * as PhosphorIcons from '@phosphor-icons/react';
4
4
  import { ButtonSize, ButtonHierarchy, ButtonState, ButtonShape, ButtonDisplayMode, ButtonType, } from './types/button';
5
+ import { Typography } from './Typography';
6
+ import { TypographySize, TypographyWeight } from './types/typography';
5
7
  const getIconComponent = (iconName, props) => {
6
8
  const Icon = PhosphorIcons[iconName];
7
9
  return Icon ? _jsx(Icon, { ...props }) : null;
8
10
  };
9
- export const MainButton = ({ onClick, text, disabled = false, loading = false, type = ButtonType.Button, style, size = ButtonSize.xl, hierarchy = ButtonHierarchy.Primary, displayIcon, displayIconMode = ButtonDisplayMode.Default, state = ButtonState.Default, shape = ButtonShape.Square, destructive = false, showLeadingIcon = true, showTrailingIcon = true, leadingIcon = 'Circle', trailingIcon = 'Circle', }) => {
11
+ export const MainButton = ({ onClick, text, disabled = false, loading = false, type = ButtonType.Button, style, size = ButtonSize.xl, hierarchy = ButtonHierarchy.Primary, displayIcon, displayIconMode = ButtonDisplayMode.Default, state = ButtonState.Default, shape = ButtonShape.Square, destructive = false, showLeadingIcon = false, showTrailingIcon = false, leadingIcon = 'Circle', trailingIcon = 'Circle', }) => {
10
12
  const getBackgroundColor = (isHover = false) => {
11
13
  if (destructive) {
12
14
  if (state === ButtonState.Disabled || disabled)
@@ -42,16 +44,16 @@ export const MainButton = ({ onClick, text, disabled = false, loading = false, t
42
44
  return 'var(--primitives-desktop-primary-transparent-violet-50)';
43
45
  case ButtonHierarchy.Tetriary:
44
46
  if (state === ButtonState.Disabled || disabled)
45
- return 'var(--colors-light-background-bg-element)';
47
+ return 'var(--primitives-desktop-primary-white-0)';
46
48
  if (state === ButtonState.Hover || isHover)
47
49
  return 'var(--primitives-desktop-primary-white-40)';
48
- return 'var(--colors-light-background-bg-white)';
50
+ return 'var(--primitives-desktop-primary-white-0)';
49
51
  case ButtonHierarchy.TetriaryColor:
50
52
  if (state === ButtonState.Disabled || disabled)
51
- return 'var(--colors-light-background-bg-element)';
53
+ return 'var(--primitives-desktop-primary-white-0)';
52
54
  if (state === ButtonState.Hover || isHover)
53
55
  return 'var(--colors-light-background-bg-card-highlight-hover)';
54
- return 'transparent';
56
+ return 'var(--primitives-desktop-primary-white-0)';
55
57
  default:
56
58
  return 'var(--colors-light-background-bg-brand)';
57
59
  }
@@ -126,12 +128,12 @@ export const MainButton = ({ onClick, text, disabled = false, loading = false, t
126
128
  return 'var(--colors-light-background-bg-white)';
127
129
  case ButtonHierarchy.Tetriary:
128
130
  if (state === ButtonState.Disabled || disabled)
129
- return 'var(--colors-light-border-border-component)';
130
- return 'var(--colors-light-border-bg-white)';
131
+ return 'var(--primitives-desktop-primary-white-0)';
132
+ return 'var(--primitives-desktop-primary-white-0)';
131
133
  case ButtonHierarchy.TetriaryColor:
132
134
  if (state === ButtonState.Disabled || disabled)
133
- return 'var(--colors-light-border-border-component)';
134
- return 'var(--colors-light-border-bg-white)';
135
+ return 'var(--primitives-desktop-primary-white-0)';
136
+ return 'var(--primitives-desktop-primary-white-0)';
135
137
  default:
136
138
  return 'var(--colors-light-background-bg-brand)';
137
139
  }
@@ -231,24 +233,39 @@ export const MainButton = ({ onClick, text, disabled = false, loading = false, t
231
233
  if (displayIconMode === ButtonDisplayMode.Only && displayIcon) {
232
234
  return getIconComponent(displayIcon, iconProps);
233
235
  }
236
+ const getTextSize = () => {
237
+ if (size === ButtonSize.xl)
238
+ return TypographySize.TextL;
239
+ if (size === ButtonSize.lg)
240
+ return TypographySize.TextM;
241
+ if (size === ButtonSize.md)
242
+ return TypographySize.TextS;
243
+ if (size === ButtonSize.sm)
244
+ return TypographySize.TextXS;
245
+ if (size === ButtonSize.xs)
246
+ return TypographySize.Text2XS;
247
+ if (size === ButtonSize.xxs)
248
+ return TypographySize.Text2XS;
249
+ return TypographySize.TextM;
250
+ };
234
251
  return (_jsxs("div", { style: {
235
252
  display: 'flex',
236
253
  alignItems: 'center',
237
254
  gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-sm)',
238
255
  }, children: [showLeadingIcon &&
239
256
  leadingIcon &&
240
- getIconComponent(leadingIcon, iconProps), text, showTrailingIcon &&
257
+ getIconComponent(leadingIcon, iconProps), _jsx(Typography, { text: text, size: getTextSize(), weight: TypographyWeight.SemiBold }), showTrailingIcon &&
241
258
  trailingIcon &&
242
259
  getIconComponent(trailingIcon, iconProps)] }));
243
260
  };
244
- return (_jsx(Button, { onClick: onClick ? onClick : () => { }, type: type, disabled: state === ButtonState.Disabled || disabled, sx: {
261
+ return (_jsx("button", { onClick: onClick ? onClick : () => { }, type: type, disabled: state === ButtonState.Disabled || disabled, style: {
245
262
  textTransform: 'none',
246
263
  ...sizeStyles,
247
264
  borderRadius: getButtonShape(),
248
265
  background: getBackgroundColor(),
249
266
  color: getTextColor(),
250
267
  border: `1px solid ${getBorderColor()}`,
251
- boxShadow: state === ButtonState.Default
268
+ boxShadow: state === ButtonState.Hover
252
269
  ? 'var(--global-shadows-shadow-xs-offset-x) var(--global-shadows-shadow-xs-offset-y) var(--global-shadows-shadow-xs-blur) var(--global-shadows-shadow-xs-spread) var(--global-shadows-shadow-xs-color)'
253
270
  : 'none',
254
271
  display: 'flex',
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { CheckboxProps } from './types/checkbox';
3
+ export declare const Checkbox: React.FC<CheckboxProps>;
@@ -0,0 +1,66 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box, Checkbox as MuiCheckbox } from '@mui/material';
3
+ import { CheckboxType } from './types/checkbox';
4
+ import { Typography } from './Typography';
5
+ import { TypographySize, TypographyWeight } from './types/typography';
6
+ export const Checkbox = ({ type = CheckboxType.Checkbox, label, checked, disabled, required, onChange, }) => {
7
+ const props = {
8
+ checked,
9
+ disabled,
10
+ required,
11
+ onChange,
12
+ disableRipple: true,
13
+ };
14
+ const handleRadioClick = () => {
15
+ if (!disabled && onChange) {
16
+ const event = {
17
+ target: { checked: !checked },
18
+ };
19
+ onChange(event);
20
+ }
21
+ };
22
+ return (_jsxs(Box, { display: "flex", alignItems: "center", justifyContent: "space-between", padding: 'var(--spacing-tokens-size-in-px-spacing-spacing-xs)', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-xs)', children: [type === CheckboxType.Checkbox ? (_jsx(MuiCheckbox, { ...props, sx: {
23
+ padding: 0,
24
+ '&.Mui-checked': {
25
+ color: disabled
26
+ ? 'var(--colors-light-background-bg-button-disabled)'
27
+ : 'var(--colors-light-background-bg-brand)',
28
+ borderRadius: 'var(--spacing-tokens-size-in-px-spacing-spacing-xs)',
29
+ '&:hover': {
30
+ color: 'var(--colors-light-background-bg-brand-hover)',
31
+ },
32
+ },
33
+ } })) : type === CheckboxType.Radio ? (_jsx(Box, { onClick: handleRadioClick, sx: {
34
+ width: '20px',
35
+ height: '20px',
36
+ borderRadius: 'var(--spacing-tokens-size-in-px-radius-radius-full)',
37
+ border: checked ? '6px solid' : '1px solid',
38
+ borderColor: disabled
39
+ ? 'var(--colors-light-background-bg-button-disabled)'
40
+ : checked
41
+ ? 'var(--colors-light-background-bg-brand)'
42
+ : 'var(--colors-light-background-bg-button-disabled)',
43
+ display: 'flex',
44
+ alignItems: 'center',
45
+ justifyContent: 'center',
46
+ cursor: disabled ? 'not-allowed' : 'pointer',
47
+ position: 'relative',
48
+ backgroundColor: 'transparent',
49
+ boxSizing: 'border-box',
50
+ transition: 'all 0.2s ease-in-out',
51
+ '&:hover': !disabled
52
+ ? {
53
+ borderColor: 'var(--colors-light-background-bg-brand-hover)',
54
+ }
55
+ : undefined,
56
+ '&::after': {
57
+ content: '""',
58
+ position: 'absolute',
59
+ width: '10px',
60
+ height: '10px',
61
+ borderRadius: 'var(--spacing-tokens-size-in-px-radius-radius-full)',
62
+ backgroundColor: 'transparent',
63
+ transition: 'all 0.2s ease-in-out',
64
+ },
65
+ } })) : null, _jsx(Typography, { text: label, size: TypographySize.TextS, weight: TypographyWeight.Medium })] }));
66
+ };
@@ -0,0 +1,13 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { Checkbox } from './Checkbox';
3
+ declare const meta: Meta<typeof Checkbox>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof Checkbox>;
6
+ export declare const Default: Story;
7
+ export declare const Checked: Story;
8
+ export declare const DisabledUnchecked: Story;
9
+ export declare const DisabledChecked: Story;
10
+ export declare const Radio: Story;
11
+ export declare const RadioChecked: Story;
12
+ export declare const RadioDisabledUnchecked: Story;
13
+ export declare const RadioDisabledChecked: Story;