@beydesign/storybook 0.2.2 → 0.2.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 +1 -0
- package/dist/index.js +1 -0
- package/dist/stories/Buttons/MainButton.js +62 -41
- package/dist/stories/Buttons/MainButton.stories.d.ts +1 -0
- package/dist/stories/Buttons/MainButton.stories.js +8 -0
- package/dist/stories/Buttons/SocialButton.d.ts +3 -0
- package/dist/stories/Buttons/SocialButton.js +50 -0
- package/dist/stories/Buttons/SocialButton.stories.d.ts +12 -0
- package/dist/stories/Buttons/SocialButton.stories.js +84 -0
- package/dist/stories/Buttons/SocialIcons.d.ts +11 -0
- package/dist/stories/Buttons/SocialIcons.js +7 -0
- package/dist/stories/Buttons/index.d.ts +2 -0
- package/dist/stories/Buttons/index.js +2 -0
- package/dist/stories/Buttons/types.d.ts +33 -1
- package/dist/stories/Buttons/types.js +10 -0
- package/dist/stories/Drawer/Drawer.d.ts +10 -0
- package/dist/stories/Drawer/Drawer.js +161 -0
- package/dist/stories/Drawer/Drawer.stories.d.ts +9 -0
- package/dist/stories/Drawer/Drawer.stories.js +107 -0
- package/dist/stories/Drawer/DrawerCreditsCard.d.ts +9 -0
- package/dist/stories/Drawer/DrawerCreditsCard.js +143 -0
- package/dist/stories/Drawer/DrawerCreditsCard.stories.d.ts +8 -0
- package/dist/stories/Drawer/DrawerCreditsCard.stories.js +45 -0
- package/dist/stories/Drawer/DrawerIcons.d.ts +14 -0
- package/dist/stories/Drawer/DrawerIcons.js +7 -0
- package/dist/stories/Drawer/DrawerNavItem.d.ts +8 -0
- package/dist/stories/Drawer/DrawerNavItem.js +87 -0
- package/dist/stories/Drawer/DrawerNavItem.stories.d.ts +11 -0
- package/dist/stories/Drawer/DrawerNavItem.stories.js +82 -0
- package/dist/stories/Drawer/DrawerProfile.d.ts +10 -0
- package/dist/stories/Drawer/DrawerProfile.js +170 -0
- package/dist/stories/Drawer/DrawerProfile.stories.d.ts +9 -0
- package/dist/stories/Drawer/DrawerProfile.stories.js +60 -0
- package/dist/stories/Drawer/index.d.ts +6 -0
- package/dist/stories/Drawer/index.js +6 -0
- package/dist/stories/Drawer/types.d.ts +164 -0
- package/dist/stories/Drawer/types.js +29 -0
- package/dist/stories/Form/TextInput.js +2 -2
- package/dist/stories/Form/TextInput.stories.d.ts +13 -0
- package/dist/stories/Form/TextInput.stories.js +18 -0
- package/dist/stories/Form/types.d.ts +5 -0
- package/dist/stories/UI/Menu.js +1 -1
- package/dist/stories/UI/Popover.d.ts +10 -0
- package/dist/stories/UI/Popover.js +66 -0
- package/dist/stories/UI/Popover.stories.d.ts +7 -0
- package/dist/stories/UI/Popover.stories.js +62 -0
- package/dist/stories/UI/ProgressIndicator.js +7 -3
- package/dist/stories/UI/ProgressIndicator.stories.d.ts +1 -0
- package/dist/stories/UI/ProgressIndicator.stories.js +9 -0
- package/dist/stories/UI/index.d.ts +1 -0
- package/dist/stories/UI/index.js +1 -0
- package/dist/stories/UI/types.d.ts +49 -2
- package/dist/stories/UI/types.js +10 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export * from './stories/Buttons';
|
|
|
7
7
|
export * from './stories/Typography';
|
|
8
8
|
export * from './stories/Credits';
|
|
9
9
|
export * from './stories/Navigation';
|
|
10
|
+
export * from './stories/Drawer';
|
|
10
11
|
export * from './stories/Typography';
|
|
11
12
|
export * from './stories/UI';
|
|
12
13
|
export * from './stories/StripeProduct';
|
package/dist/index.js
CHANGED
|
@@ -7,6 +7,7 @@ export * from './stories/Buttons';
|
|
|
7
7
|
export * from './stories/Typography';
|
|
8
8
|
export * from './stories/Credits';
|
|
9
9
|
export * from './stories/Navigation';
|
|
10
|
+
export * from './stories/Drawer';
|
|
10
11
|
export * from './stories/Typography';
|
|
11
12
|
export * from './stories/UI';
|
|
12
13
|
export * from './stories/StripeProduct';
|
|
@@ -16,7 +16,7 @@ const StyledButton = styled.button `
|
|
|
16
16
|
background: ${(props) => {
|
|
17
17
|
if (props.$destructive) {
|
|
18
18
|
if (props.$state === ButtonState.Disabled || props.$disabled)
|
|
19
|
-
return 'var(--color-background-bg-
|
|
19
|
+
return 'var(--color-background-bg-element)';
|
|
20
20
|
return 'var(--color-background-bg-error)';
|
|
21
21
|
}
|
|
22
22
|
switch (props.$hierarchy) {
|
|
@@ -27,27 +27,31 @@ const StyledButton = styled.button `
|
|
|
27
27
|
case ButtonHierarchy.PrimaryLemon:
|
|
28
28
|
if (props.$state === ButtonState.Disabled || props.$disabled)
|
|
29
29
|
return 'var(--color-background-bg-element)';
|
|
30
|
-
return 'var(--
|
|
30
|
+
return 'var(--color-background-bg-brand-secondary)';
|
|
31
31
|
case ButtonHierarchy.Secondary:
|
|
32
32
|
if (props.$state === ButtonState.Disabled || props.$disabled)
|
|
33
|
-
return 'var(--color-background-bg-
|
|
34
|
-
return '
|
|
33
|
+
return 'var(--color-background-bg-button-disabled)';
|
|
34
|
+
return 'transparent';
|
|
35
35
|
case ButtonHierarchy.SecondaryColor:
|
|
36
36
|
if (props.$state === ButtonState.Disabled || props.$disabled)
|
|
37
37
|
return 'var(--color-background-bg-element)';
|
|
38
|
-
return 'var(--color-background-bg-
|
|
38
|
+
return 'var(--color-background-bg-secondary-action)';
|
|
39
39
|
case ButtonHierarchy.SecondaryTransparent:
|
|
40
40
|
if (props.$state === ButtonState.Disabled || props.$disabled)
|
|
41
41
|
return 'var(--color-background-bg-overlay-1)';
|
|
42
|
-
return 'var(--
|
|
42
|
+
return 'var(--color-background-bg-button-transparent)';
|
|
43
43
|
case ButtonHierarchy.Tertiary:
|
|
44
44
|
if (props.$state === ButtonState.Disabled || props.$disabled)
|
|
45
|
-
return '
|
|
46
|
-
return '
|
|
45
|
+
return 'transparent';
|
|
46
|
+
return 'transparent';
|
|
47
47
|
case ButtonHierarchy.TertiaryColor:
|
|
48
48
|
if (props.$state === ButtonState.Disabled || props.$disabled)
|
|
49
|
-
return '
|
|
50
|
-
return '
|
|
49
|
+
return 'transparent';
|
|
50
|
+
return 'transparent';
|
|
51
|
+
case ButtonHierarchy.WhiteText:
|
|
52
|
+
if (props.$state === ButtonState.Disabled || props.$disabled)
|
|
53
|
+
return 'var(--color-background-bg-button-disabled)';
|
|
54
|
+
return 'var(--color-background-bg-overlay-1)';
|
|
51
55
|
default:
|
|
52
56
|
return 'var(--color-background-bg-brand-primary)';
|
|
53
57
|
}
|
|
@@ -55,26 +59,26 @@ const StyledButton = styled.button `
|
|
|
55
59
|
color: ${(props) => {
|
|
56
60
|
if (props.$destructive) {
|
|
57
61
|
if (props.$state === ButtonState.Disabled || props.$disabled)
|
|
58
|
-
return 'var(--color-text-text-
|
|
62
|
+
return 'var(--color-text-text-disabled)';
|
|
59
63
|
return 'var(--color-text-text-white)';
|
|
60
64
|
}
|
|
61
65
|
switch (props.$hierarchy) {
|
|
62
66
|
case ButtonHierarchy.Primary:
|
|
63
67
|
if (props.$state === ButtonState.Disabled || props.$disabled)
|
|
64
|
-
return 'var(--color-text-text-
|
|
65
|
-
return 'var(--color-text-text-
|
|
68
|
+
return 'var(--color-text-text-inactive)';
|
|
69
|
+
return 'var(--color-text-text-on-accent-color)';
|
|
66
70
|
case ButtonHierarchy.PrimaryLemon:
|
|
67
71
|
if (props.$state === ButtonState.Disabled || props.$disabled)
|
|
68
72
|
return 'var(--color-text-text-subtle)';
|
|
69
73
|
return 'var(--color-text-text-title)';
|
|
70
74
|
case ButtonHierarchy.Secondary:
|
|
71
75
|
if (props.$state === ButtonState.Disabled || props.$disabled)
|
|
72
|
-
return 'var(--color-text-text-
|
|
76
|
+
return 'var(--color-text-text-inactive)';
|
|
73
77
|
return 'var(--color-text-text-title)';
|
|
74
78
|
case ButtonHierarchy.SecondaryColor:
|
|
75
79
|
if (props.$state === ButtonState.Disabled || props.$disabled)
|
|
76
80
|
return 'var(--color-text-text-disabled)';
|
|
77
|
-
return 'var(--color-text-text-
|
|
81
|
+
return 'var(--color-text-text-clicable)';
|
|
78
82
|
case ButtonHierarchy.SecondaryTransparent:
|
|
79
83
|
if (props.$state === ButtonState.Disabled || props.$disabled)
|
|
80
84
|
return 'var(--color-text-text-white)';
|
|
@@ -87,6 +91,10 @@ const StyledButton = styled.button `
|
|
|
87
91
|
if (props.$state === ButtonState.Disabled || props.$disabled)
|
|
88
92
|
return 'var(--color-text-text-disabled)';
|
|
89
93
|
return 'var(--color-text-text-accent)';
|
|
94
|
+
case ButtonHierarchy.WhiteText:
|
|
95
|
+
if (props.$state === ButtonState.Disabled || props.$disabled)
|
|
96
|
+
return 'var(--color-text-text-inactive)';
|
|
97
|
+
return 'var(--color-text-text-white)';
|
|
90
98
|
default:
|
|
91
99
|
return 'var(--color-text-text-white)';
|
|
92
100
|
}
|
|
@@ -95,38 +103,40 @@ const StyledButton = styled.button `
|
|
|
95
103
|
${(props) => {
|
|
96
104
|
if (props.$destructive) {
|
|
97
105
|
if (props.$state === ButtonState.Disabled || props.$disabled)
|
|
98
|
-
return 'var(--color-
|
|
106
|
+
return 'var(--color-background-bg-element)';
|
|
99
107
|
return 'var(--color-background-bg-error)';
|
|
100
108
|
}
|
|
101
109
|
switch (props.$hierarchy) {
|
|
102
110
|
case ButtonHierarchy.Primary:
|
|
103
111
|
if (props.$state === ButtonState.Disabled || props.$disabled)
|
|
104
|
-
return 'var(--color-border-border-
|
|
112
|
+
return 'var(--color-border-border-disabled)';
|
|
105
113
|
return 'var(--color-background-bg-brand-primary)';
|
|
106
114
|
case ButtonHierarchy.PrimaryLemon:
|
|
107
115
|
if (props.$state === ButtonState.Disabled || props.$disabled)
|
|
108
116
|
return 'var(--color-border-border-component)';
|
|
109
|
-
return 'var(--
|
|
117
|
+
return 'var(--color-background-bg-brand-secondary)';
|
|
110
118
|
case ButtonHierarchy.Secondary:
|
|
111
119
|
if (props.$state === ButtonState.Disabled || props.$disabled)
|
|
112
|
-
return 'var(--color-border-border-
|
|
120
|
+
return 'var(--color-border-border-disabled)';
|
|
113
121
|
return 'var(--color-border-border-component)';
|
|
114
122
|
case ButtonHierarchy.SecondaryColor:
|
|
115
123
|
if (props.$state === ButtonState.Disabled || props.$disabled)
|
|
116
124
|
return 'var(--color-border-border-component)';
|
|
117
|
-
return 'var(--color-border-border-
|
|
125
|
+
return 'var(--color-border-border-secondary-action)';
|
|
118
126
|
case ButtonHierarchy.SecondaryTransparent:
|
|
119
127
|
if (props.$state === ButtonState.Disabled || props.$disabled)
|
|
120
128
|
return 'var(--color-border-border-disabled)';
|
|
121
|
-
return '
|
|
129
|
+
return 'transparent';
|
|
122
130
|
case ButtonHierarchy.Tertiary:
|
|
123
131
|
if (props.$state === ButtonState.Disabled || props.$disabled)
|
|
124
|
-
return '
|
|
125
|
-
return '
|
|
132
|
+
return 'transparent';
|
|
133
|
+
return 'transparent';
|
|
126
134
|
case ButtonHierarchy.TertiaryColor:
|
|
127
135
|
if (props.$state === ButtonState.Disabled || props.$disabled)
|
|
128
|
-
return '
|
|
129
|
-
return '
|
|
136
|
+
return 'transparent';
|
|
137
|
+
return 'transparent';
|
|
138
|
+
case ButtonHierarchy.WhiteText:
|
|
139
|
+
return 'transparent';
|
|
130
140
|
default:
|
|
131
141
|
return 'var(--color-background-bg-brand-primary)';
|
|
132
142
|
}
|
|
@@ -135,6 +145,13 @@ const StyledButton = styled.button `
|
|
|
135
145
|
align-items: center;
|
|
136
146
|
justify-content: center;
|
|
137
147
|
min-width: unset;
|
|
148
|
+
box-shadow: ${(props) => props.$hierarchy === ButtonHierarchy.WhiteText
|
|
149
|
+
? 'none'
|
|
150
|
+
: `var(--global-shadows-shadow-xs-offset-x)
|
|
151
|
+
var(--global-shadows-shadow-xs-offset-y)
|
|
152
|
+
var(--global-shadows-shadow-xs-blur)
|
|
153
|
+
var(--global-shadows-shadow-xs-spread)
|
|
154
|
+
var(--global-shadows-shadow-xs-color)`};
|
|
138
155
|
cursor: ${(props) => props.$state === ButtonState.Disabled || props.$disabled
|
|
139
156
|
? 'not-allowed'
|
|
140
157
|
: 'pointer'};
|
|
@@ -154,17 +171,19 @@ const StyledButton = styled.button `
|
|
|
154
171
|
case ButtonHierarchy.Primary:
|
|
155
172
|
return 'var(--color-background-bg-brand-primary-hover)';
|
|
156
173
|
case ButtonHierarchy.PrimaryLemon:
|
|
157
|
-
return 'var(--
|
|
174
|
+
return 'var(--color-background-bg-brand-secondary-hover)';
|
|
158
175
|
case ButtonHierarchy.Secondary:
|
|
159
|
-
return 'var(--color-background-bg-
|
|
176
|
+
return 'var(--color-background-bg-component)';
|
|
160
177
|
case ButtonHierarchy.SecondaryColor:
|
|
161
|
-
return 'var(--color-background-bg-
|
|
178
|
+
return 'var(--color-background-bg-secondary-action-hover)';
|
|
162
179
|
case ButtonHierarchy.SecondaryTransparent:
|
|
163
|
-
return 'var(--color-background-bg-
|
|
180
|
+
return 'var(--color-background-bg-button-transparent-hover)';
|
|
164
181
|
case ButtonHierarchy.Tertiary:
|
|
165
|
-
return 'var(--
|
|
182
|
+
return 'var(--color-background-bg-component-hover)';
|
|
166
183
|
case ButtonHierarchy.TertiaryColor:
|
|
167
184
|
return 'var(--color-background-bg-card-highlight-hover)';
|
|
185
|
+
case ButtonHierarchy.WhiteText:
|
|
186
|
+
return 'var(--color-background-bg-overlay-2)';
|
|
168
187
|
default:
|
|
169
188
|
return 'var(--color-background-bg-brand-primary-hover)';
|
|
170
189
|
}
|
|
@@ -177,17 +196,19 @@ const StyledButton = styled.button `
|
|
|
177
196
|
case ButtonHierarchy.Primary:
|
|
178
197
|
return 'var(--color-background-bg-brand-primary-hover)';
|
|
179
198
|
case ButtonHierarchy.PrimaryLemon:
|
|
180
|
-
return 'var(--
|
|
199
|
+
return 'var(--color-background-bg-brand-secondary-hover)';
|
|
181
200
|
case ButtonHierarchy.Secondary:
|
|
182
|
-
return 'var(--color-
|
|
201
|
+
return 'var(--color-border-border-component)';
|
|
183
202
|
case ButtonHierarchy.SecondaryColor:
|
|
184
|
-
return 'var(--color-
|
|
203
|
+
return 'var(--color-border-border-secondary-action)';
|
|
185
204
|
case ButtonHierarchy.SecondaryTransparent:
|
|
186
|
-
return '
|
|
205
|
+
return 'transparent';
|
|
187
206
|
case ButtonHierarchy.Tertiary:
|
|
188
|
-
return '
|
|
207
|
+
return 'transparent';
|
|
189
208
|
case ButtonHierarchy.TertiaryColor:
|
|
190
|
-
return '
|
|
209
|
+
return 'transparent';
|
|
210
|
+
case ButtonHierarchy.WhiteText:
|
|
211
|
+
return 'transparent';
|
|
191
212
|
default:
|
|
192
213
|
return 'var(--color-background-bg-brand-primary-hover)';
|
|
193
214
|
}
|
|
@@ -279,19 +300,19 @@ export const MainButton = ({ onClick, text, disabled = false, loading = false, t
|
|
|
279
300
|
if (size === ButtonSize.lg)
|
|
280
301
|
return TypographySize.TextM;
|
|
281
302
|
if (size === ButtonSize.md)
|
|
282
|
-
return TypographySize.
|
|
303
|
+
return TypographySize.TextM;
|
|
283
304
|
if (size === ButtonSize.sm)
|
|
284
|
-
return TypographySize.
|
|
305
|
+
return TypographySize.TextS;
|
|
285
306
|
if (size === ButtonSize.xs)
|
|
286
|
-
return TypographySize.
|
|
307
|
+
return TypographySize.TextS;
|
|
287
308
|
if (size === ButtonSize.xxs)
|
|
288
|
-
return TypographySize.
|
|
309
|
+
return TypographySize.TextS;
|
|
289
310
|
return TypographySize.TextM;
|
|
290
311
|
};
|
|
291
312
|
return (_jsxs("div", { style: {
|
|
292
313
|
display: 'flex',
|
|
293
314
|
alignItems: 'center',
|
|
294
|
-
gap:
|
|
315
|
+
gap: sizeStyles.gap,
|
|
295
316
|
}, children: [showLeadingIcon &&
|
|
296
317
|
leadingIcon &&
|
|
297
318
|
getIconComponent(leadingIcon, iconProps), text && (_jsx(Typography, { size: getTextSize(), weight: TypographyWeight.SemiBold, children: text })), showTrailingIcon &&
|
|
@@ -10,6 +10,7 @@ export declare const SecondaryColor: Story;
|
|
|
10
10
|
export declare const SecondaryTransparent: Story;
|
|
11
11
|
export declare const Tertiary: Story;
|
|
12
12
|
export declare const TertiaryColor: Story;
|
|
13
|
+
export declare const WhiteText: Story;
|
|
13
14
|
export declare const PrimaryHover: Story;
|
|
14
15
|
export declare const PrimaryDisabled: Story;
|
|
15
16
|
export declare const IconOnly: Story;
|
|
@@ -38,6 +38,7 @@ const meta = {
|
|
|
38
38
|
'Secondary-transparent',
|
|
39
39
|
'Tertiary',
|
|
40
40
|
'Tertiary-color',
|
|
41
|
+
'White-text',
|
|
41
42
|
],
|
|
42
43
|
description: 'Visual hierarchy of the button',
|
|
43
44
|
table: {
|
|
@@ -186,6 +187,13 @@ export const TertiaryColor = {
|
|
|
186
187
|
hierarchy: ButtonHierarchy.TertiaryColor,
|
|
187
188
|
},
|
|
188
189
|
};
|
|
190
|
+
export const WhiteText = {
|
|
191
|
+
args: {
|
|
192
|
+
...Primary.args,
|
|
193
|
+
text: 'Button',
|
|
194
|
+
hierarchy: ButtonHierarchy.WhiteText,
|
|
195
|
+
},
|
|
196
|
+
};
|
|
189
197
|
export const PrimaryHover = {
|
|
190
198
|
args: {
|
|
191
199
|
...Primary.args,
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import styled from '@emotion/styled';
|
|
3
|
+
import { SocialProvider, ButtonType } from './types';
|
|
4
|
+
import { Typography, TypographySize, TypographyWeight } from '../Typography';
|
|
5
|
+
import { GoogleIcon, MicrosoftIcon, AppleIcon } from './SocialIcons';
|
|
6
|
+
const ICON_SIZE = 24;
|
|
7
|
+
const providerIcon = {
|
|
8
|
+
[SocialProvider.Google]: _jsx(GoogleIcon, { size: ICON_SIZE }),
|
|
9
|
+
[SocialProvider.Microsoft]: _jsx(MicrosoftIcon, { size: ICON_SIZE }),
|
|
10
|
+
[SocialProvider.Apple]: _jsx(AppleIcon, { size: ICON_SIZE }),
|
|
11
|
+
};
|
|
12
|
+
const providerLabel = {
|
|
13
|
+
[SocialProvider.Google]: 'Continue with Google',
|
|
14
|
+
[SocialProvider.Microsoft]: 'Continue with Microsoft Account',
|
|
15
|
+
[SocialProvider.Apple]: 'Continue with Apple',
|
|
16
|
+
};
|
|
17
|
+
const StyledSocialButton = styled.button `
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
justify-content: center;
|
|
21
|
+
gap: var(--spacing-tokens-size-in-px-spacing-spacing-md);
|
|
22
|
+
box-sizing: border-box;
|
|
23
|
+
height: var(--spacing-tokens-size-in-px-spacing-spacing-6xl);
|
|
24
|
+
width: ${(props) => props.$supportingText
|
|
25
|
+
? props.$fullWidth
|
|
26
|
+
? '100%'
|
|
27
|
+
: 'auto'
|
|
28
|
+
: 'var(--spacing-tokens-size-in-px-spacing-spacing-6xl)'};
|
|
29
|
+
padding: 0 var(--spacing-tokens-size-in-px-spacing-spacing-lg);
|
|
30
|
+
border: none;
|
|
31
|
+
border-radius: var(--spacing-tokens-size-in-px-radius-radius-md);
|
|
32
|
+
background: var(--color-background-bg-card-highlight);
|
|
33
|
+
color: var(--color-text-text-title);
|
|
34
|
+
cursor: pointer;
|
|
35
|
+
transition: all 0.2s ease-in-out;
|
|
36
|
+
|
|
37
|
+
&:hover {
|
|
38
|
+
background: var(--color-background-bg-card-highlight-hover);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&:disabled {
|
|
42
|
+
cursor: not-allowed;
|
|
43
|
+
opacity: 0.5;
|
|
44
|
+
pointer-events: none;
|
|
45
|
+
}
|
|
46
|
+
`;
|
|
47
|
+
export const SocialButton = ({ provider, supportingText = true, text, fullWidth = true, onClick, disabled = false, type = ButtonType.Button, style, testId, }) => {
|
|
48
|
+
const label = text ?? providerLabel[provider];
|
|
49
|
+
return (_jsxs(StyledSocialButton, { onClick: onClick, type: type, disabled: disabled, "$supportingText": supportingText, "$fullWidth": fullWidth, style: style, "data-testid": testId, "aria-label": supportingText ? undefined : label, children: [providerIcon[provider], supportingText && (_jsx(Typography, { size: TypographySize.TextM, weight: TypographyWeight.SemiBold, color: "var(--color-text-text-title)", children: label }))] }));
|
|
50
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { SocialButton } from './SocialButton';
|
|
3
|
+
declare const meta: Meta<typeof SocialButton>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof SocialButton>;
|
|
6
|
+
export declare const Google: Story;
|
|
7
|
+
export declare const Microsoft: Story;
|
|
8
|
+
export declare const Apple: Story;
|
|
9
|
+
export declare const GoogleIconOnly: Story;
|
|
10
|
+
export declare const MicrosoftIconOnly: Story;
|
|
11
|
+
export declare const AppleIconOnly: Story;
|
|
12
|
+
export declare const Disabled: Story;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { SocialButton } from './SocialButton';
|
|
3
|
+
import { SocialProvider } from './types';
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'Design System/Components/Buttons/SocialButton',
|
|
6
|
+
component: SocialButton,
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: 'centered',
|
|
9
|
+
design: {
|
|
10
|
+
type: 'figspec',
|
|
11
|
+
url: 'https://www.figma.com/design/mIhjz2yJjcpLlIqw6oUivt/Beyond-Presence?node-id=4689-15999',
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
tags: ['autodocs'],
|
|
15
|
+
argTypes: {
|
|
16
|
+
provider: {
|
|
17
|
+
control: 'select',
|
|
18
|
+
options: ['Google', 'Microsoft', 'Apple'],
|
|
19
|
+
description: 'The social provider this button signs in with',
|
|
20
|
+
table: {
|
|
21
|
+
type: { summary: 'string' },
|
|
22
|
+
defaultValue: { summary: 'Google' },
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
supportingText: {
|
|
26
|
+
control: 'boolean',
|
|
27
|
+
description: 'Whether to show the text label (false renders an icon-only square button)',
|
|
28
|
+
table: {
|
|
29
|
+
type: { summary: 'boolean' },
|
|
30
|
+
defaultValue: { summary: 'true' },
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
text: {
|
|
34
|
+
control: 'text',
|
|
35
|
+
description: 'Overrides the default "Continue with …" label',
|
|
36
|
+
table: { type: { summary: 'string' } },
|
|
37
|
+
},
|
|
38
|
+
fullWidth: {
|
|
39
|
+
control: 'boolean',
|
|
40
|
+
description: 'Whether the text variant stretches to fill its container',
|
|
41
|
+
table: {
|
|
42
|
+
type: { summary: 'boolean' },
|
|
43
|
+
defaultValue: { summary: 'true' },
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
disabled: {
|
|
47
|
+
control: 'boolean',
|
|
48
|
+
description: 'Whether the button is disabled',
|
|
49
|
+
table: {
|
|
50
|
+
type: { summary: 'boolean' },
|
|
51
|
+
defaultValue: { summary: 'false' },
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
decorators: [
|
|
56
|
+
(Story) => (_jsx("div", { style: { width: 388 }, children: _jsx(Story, {}) })),
|
|
57
|
+
],
|
|
58
|
+
};
|
|
59
|
+
export default meta;
|
|
60
|
+
export const Google = {
|
|
61
|
+
args: { provider: SocialProvider.Google, supportingText: true },
|
|
62
|
+
};
|
|
63
|
+
export const Microsoft = {
|
|
64
|
+
args: { provider: SocialProvider.Microsoft, supportingText: true },
|
|
65
|
+
};
|
|
66
|
+
export const Apple = {
|
|
67
|
+
args: { provider: SocialProvider.Apple, supportingText: true },
|
|
68
|
+
};
|
|
69
|
+
export const GoogleIconOnly = {
|
|
70
|
+
args: { provider: SocialProvider.Google, supportingText: false },
|
|
71
|
+
};
|
|
72
|
+
export const MicrosoftIconOnly = {
|
|
73
|
+
args: { provider: SocialProvider.Microsoft, supportingText: false },
|
|
74
|
+
};
|
|
75
|
+
export const AppleIconOnly = {
|
|
76
|
+
args: { provider: SocialProvider.Apple, supportingText: false },
|
|
77
|
+
};
|
|
78
|
+
export const Disabled = {
|
|
79
|
+
args: {
|
|
80
|
+
provider: SocialProvider.Google,
|
|
81
|
+
supportingText: true,
|
|
82
|
+
disabled: true,
|
|
83
|
+
},
|
|
84
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface SocialIconProps {
|
|
3
|
+
size?: number;
|
|
4
|
+
}
|
|
5
|
+
/** Full-color Google "G" logo. */
|
|
6
|
+
export declare const GoogleIcon: React.FC<SocialIconProps>;
|
|
7
|
+
/** Full-color Microsoft logo (four squares). */
|
|
8
|
+
export declare const MicrosoftIcon: React.FC<SocialIconProps>;
|
|
9
|
+
/** Monochrome Apple logo — uses currentColor so it follows the button text color (theme-aware). */
|
|
10
|
+
export declare const AppleIcon: React.FC<SocialIconProps>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/** Full-color Google "G" logo. */
|
|
3
|
+
export const GoogleIcon = ({ size = 24 }) => (_jsxs("svg", { width: size, height: size, viewBox: "0 0 48 48", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", focusable: "false", children: [_jsx("path", { fill: "#FFC107", d: "M43.611 20.083H42V20H24v8h11.303c-1.649 4.657-6.08 8-11.303 8-6.627 0-12-5.373-12-12s5.373-12 12-12c3.059 0 5.842 1.154 7.961 3.039l5.657-5.657C34.046 6.053 29.268 4 24 4 12.955 4 4 12.955 4 24s8.955 20 20 20 20-8.955 20-20c0-1.341-.138-2.65-.389-3.917z" }), _jsx("path", { fill: "#FF3D00", d: "M6.306 14.691l6.571 4.819C14.655 15.108 18.961 12 24 12c3.059 0 5.842 1.154 7.961 3.039l5.657-5.657C34.046 6.053 29.268 4 24 4 16.318 4 9.656 8.337 6.306 14.691z" }), _jsx("path", { fill: "#4CAF50", d: "M24 44c5.166 0 9.86-1.977 13.409-5.192l-6.19-5.238C29.211 35.091 26.715 36 24 36c-5.202 0-9.619-3.317-11.283-7.946l-6.522 5.025C9.505 39.556 16.227 44 24 44z" }), _jsx("path", { fill: "#1976D2", d: "M43.611 20.083H42V20H24v8h11.303a12.04 12.04 0 0 1-4.087 5.571l6.19 5.238C36.971 39.205 44 34 44 24c0-1.341-.138-2.65-.389-3.917z" })] }));
|
|
4
|
+
/** Full-color Microsoft logo (four squares). */
|
|
5
|
+
export const MicrosoftIcon = ({ size = 24 }) => (_jsxs("svg", { width: size, height: size, viewBox: "0 0 23 23", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", focusable: "false", children: [_jsx("path", { fill: "#F25022", d: "M1 1h10v10H1z" }), _jsx("path", { fill: "#7FBA00", d: "M12 1h10v10H12z" }), _jsx("path", { fill: "#00A4EF", d: "M1 12h10v10H1z" }), _jsx("path", { fill: "#FFB900", d: "M12 12h10v10H12z" })] }));
|
|
6
|
+
/** Monochrome Apple logo — uses currentColor so it follows the button text color (theme-aware). */
|
|
7
|
+
export const AppleIcon = ({ size = 24 }) => (_jsx("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", focusable: "false", children: _jsx("path", { d: "M17.05 12.536c-.026-2.682 2.19-3.972 2.29-4.033-1.25-1.827-3.193-2.077-3.883-2.104-1.652-.168-3.225.973-4.063.973-.838 0-2.13-.949-3.504-.923-1.803.027-3.466 1.048-4.393 2.663-1.873 3.246-.479 8.05 1.344 10.682.891 1.288 1.954 2.733 3.348 2.681 1.34-.053 1.846-.866 3.466-.866 1.62 0 2.075.866 3.494.84 1.44-.027 2.355-1.314 3.236-2.606 1.018-1.495 1.438-2.942 1.463-3.017-.032-.013-2.808-1.077-2.835-4.266zM14.78 4.62c.74-.896 1.24-2.142 1.103-3.383-1.066.043-2.357.71-3.122 1.606-.686.795-1.286 2.063-1.124 3.28 1.19.092 2.404-.605 3.143-1.503z" }) }));
|
|
@@ -23,7 +23,8 @@ export declare enum ButtonHierarchy {
|
|
|
23
23
|
SecondaryColor = "Secondary-color",
|
|
24
24
|
SecondaryTransparent = "Secondary-transparent",
|
|
25
25
|
Tertiary = "Tertiary",
|
|
26
|
-
TertiaryColor = "Tertiary-color"
|
|
26
|
+
TertiaryColor = "Tertiary-color",
|
|
27
|
+
WhiteText = "White-text"
|
|
27
28
|
}
|
|
28
29
|
/**
|
|
29
30
|
* Button states
|
|
@@ -129,3 +130,34 @@ export type ToggleButtonGroupProps = {
|
|
|
129
130
|
/** Custom style of the toggle button */
|
|
130
131
|
style?: SxProps<Theme>;
|
|
131
132
|
};
|
|
133
|
+
/**
|
|
134
|
+
* Social sign-in providers
|
|
135
|
+
*/
|
|
136
|
+
export declare enum SocialProvider {
|
|
137
|
+
Google = "Google",
|
|
138
|
+
Microsoft = "Microsoft",
|
|
139
|
+
Apple = "Apple"
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Social (sign-in) button props
|
|
143
|
+
*/
|
|
144
|
+
export interface SocialButtonProps {
|
|
145
|
+
/** The social provider this button signs in with */
|
|
146
|
+
provider: SocialProvider;
|
|
147
|
+
/** Whether to show the supporting text label (false renders an icon-only square button) */
|
|
148
|
+
supportingText?: boolean;
|
|
149
|
+
/** Overrides the default "Continue with …" label */
|
|
150
|
+
text?: string;
|
|
151
|
+
/** Whether the text variant should stretch to fill its container */
|
|
152
|
+
fullWidth?: boolean;
|
|
153
|
+
/** Click handler for the button */
|
|
154
|
+
onClick?: React.MouseEventHandler<HTMLButtonElement>;
|
|
155
|
+
/** Whether the button is disabled */
|
|
156
|
+
disabled?: boolean;
|
|
157
|
+
/** HTML button type */
|
|
158
|
+
type?: ButtonType;
|
|
159
|
+
/** Custom styles for the button */
|
|
160
|
+
style?: CSSProperties;
|
|
161
|
+
/** Test Id */
|
|
162
|
+
testId?: string;
|
|
163
|
+
}
|
|
@@ -22,6 +22,7 @@ export var ButtonHierarchy;
|
|
|
22
22
|
ButtonHierarchy["SecondaryTransparent"] = "Secondary-transparent";
|
|
23
23
|
ButtonHierarchy["Tertiary"] = "Tertiary";
|
|
24
24
|
ButtonHierarchy["TertiaryColor"] = "Tertiary-color";
|
|
25
|
+
ButtonHierarchy["WhiteText"] = "White-text";
|
|
25
26
|
})(ButtonHierarchy || (ButtonHierarchy = {}));
|
|
26
27
|
/**
|
|
27
28
|
* Button states
|
|
@@ -66,3 +67,12 @@ export var ToggleButtonGroupSize;
|
|
|
66
67
|
ToggleButtonGroupSize["md"] = "md";
|
|
67
68
|
ToggleButtonGroupSize["sm"] = "sm";
|
|
68
69
|
})(ToggleButtonGroupSize || (ToggleButtonGroupSize = {}));
|
|
70
|
+
/**
|
|
71
|
+
* Social sign-in providers
|
|
72
|
+
*/
|
|
73
|
+
export var SocialProvider;
|
|
74
|
+
(function (SocialProvider) {
|
|
75
|
+
SocialProvider["Google"] = "Google";
|
|
76
|
+
SocialProvider["Microsoft"] = "Microsoft";
|
|
77
|
+
SocialProvider["Apple"] = "Apple";
|
|
78
|
+
})(SocialProvider || (SocialProvider = {}));
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DrawerProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Composed application sidebar ("Drawer"): logo header, navigation list,
|
|
5
|
+
* credits card and user-profile footer, with a floating collapse/expand
|
|
6
|
+
* toggle. Collapse state can be controlled (`collapsed` + `onToggle`) or left
|
|
7
|
+
* uncontrolled (`defaultCollapsed`). Every colour, space and radius resolves to
|
|
8
|
+
* `@beydesign/tokens` CSS variables, so it renders correctly in light and dark.
|
|
9
|
+
*/
|
|
10
|
+
export declare const Drawer: React.FC<DrawerProps>;
|