@beydesign/storybook 0.0.1 → 0.0.3

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 CHANGED
@@ -1,50 +1,59 @@
1
- # React + TypeScript + Vite
1
+ # BeyDesign Storybook
2
2
 
3
- This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
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
- Currently, two official plugins are available:
5
+ ## Installation
6
6
 
7
- - [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
8
- - [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
7
+ ```bash
8
+ # First install the required design tokens package
9
+ npm install @beydesign/tokens
9
10
 
10
- ## Expanding the ESLint configuration
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
- If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:
19
+ ## Usage
13
20
 
14
- - Configure the top-level `parserOptions` property like this:
21
+ 1. Import the components you need:
15
22
 
16
- ```js
17
- export default tseslint.config({
18
- languageOptions: {
19
- // other options...
20
- parserOptions: {
21
- project: ['./tsconfig.node.json', './tsconfig.app.json'],
22
- tsconfigRootDir: import.meta.dirname,
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
- - Replace `tseslint.configs.recommended` to `tseslint.configs.recommendedTypeChecked` or `tseslint.configs.strictTypeChecked`
29
- - Optionally add `...tseslint.configs.stylisticTypeChecked`
30
- - Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and update the config:
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';
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Button, CircularProgress } from '@mui/material';
3
3
  import * as PhosphorIcons from '@phosphor-icons/react';
4
- import { ButtonSize, ButtonHierarchy, ButtonState, ButtonShape, ButtonDisplayMode, ButtonType } from './types/button';
4
+ import { ButtonSize, ButtonHierarchy, ButtonState, ButtonShape, ButtonDisplayMode, ButtonType, } from './types/button';
5
5
  const getIconComponent = (iconName, props) => {
6
6
  const Icon = PhosphorIcons[iconName];
7
7
  return Icon ? _jsx(Icon, { ...props }) : null;
@@ -141,45 +141,57 @@ export const MainButton = ({ onClick, text, disabled = false, loading = false, t
141
141
  [ButtonSize.xl]: {
142
142
  width: displayIconMode === ButtonDisplayMode.Only ? '3.25rem' : '12.75rem',
143
143
  height: '3.25rem',
144
- padding: displayIconMode === ButtonDisplayMode.Only ? 'var(--spacing-tokens-size-in-px-spacing-spacing-md)' : 'var(--spacing-tokens-size-in-px-spacing-spacing-lg) var(--spacing-tokens-size-in-px-spacing-spacing-3xl)',
144
+ padding: displayIconMode === ButtonDisplayMode.Only
145
+ ? 'var(--spacing-tokens-size-in-px-spacing-spacing-md)'
146
+ : 'var(--spacing-tokens-size-in-px-spacing-spacing-lg) var(--spacing-tokens-size-in-px-spacing-spacing-3xl)',
145
147
  fontSize: 'var(--global-font-size-3)',
146
148
  gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-sm)',
147
149
  },
148
150
  [ButtonSize.lg]: {
149
151
  width: displayIconMode === ButtonDisplayMode.Only ? '3rem' : '11.75rem',
150
152
  height: '3rem',
151
- padding: displayIconMode === ButtonDisplayMode.Only ? 'var(--spacing-tokens-size-in-px-spacing-spacing-md)' : 'var(--spacing-tokens-size-in-px-spacing-spacing-lg) var(--spacing-tokens-size-in-px-spacing-spacing-2xl)',
153
+ padding: displayIconMode === ButtonDisplayMode.Only
154
+ ? 'var(--spacing-tokens-size-in-px-spacing-spacing-md)'
155
+ : 'var(--spacing-tokens-size-in-px-spacing-spacing-lg) var(--spacing-tokens-size-in-px-spacing-spacing-2xl)',
152
156
  fontSize: 'var(--global-font-size-3)',
153
157
  gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-sm)',
154
158
  },
155
159
  [ButtonSize.md]: {
156
160
  width: displayIconMode === ButtonDisplayMode.Only ? '2.75rem' : '10.75rem',
157
161
  height: '2.75rem',
158
- padding: displayIconMode === ButtonDisplayMode.Only ? 'var(--spacing-tokens-size-in-px-spacing-spacing-md)' : 'var(--spacing-tokens-size-in-px-spacing-spacing-md) var(--spacing-tokens-size-in-px-spacing-spacing-xl)',
162
+ padding: displayIconMode === ButtonDisplayMode.Only
163
+ ? 'var(--spacing-tokens-size-in-px-spacing-spacing-md)'
164
+ : 'var(--spacing-tokens-size-in-px-spacing-spacing-md) var(--spacing-tokens-size-in-px-spacing-spacing-xl)',
159
165
  fontSize: 'var(--global-font-size-2)',
160
166
  gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-sm)',
161
167
  },
162
168
  [ButtonSize.sm]: {
163
169
  width: displayIconMode === ButtonDisplayMode.Only ? '2.5rem' : '9.75rem',
164
170
  height: '2.5rem',
165
- padding: displayIconMode === ButtonDisplayMode.Only ? 'var(--spacing-tokens-size-in-px-spacing-spacing-md)' : 'var(--spacing-tokens-size-in-px-spacing-spacing-md) var(--spacing-tokens-size-in-px-spacing-spacing-xl)',
171
+ padding: displayIconMode === ButtonDisplayMode.Only
172
+ ? 'var(--spacing-tokens-size-in-px-spacing-spacing-md)'
173
+ : 'var(--spacing-tokens-size-in-px-spacing-spacing-md) var(--spacing-tokens-size-in-px-spacing-spacing-xl)',
166
174
  fontSize: 'var(--global-font-size-1)',
167
175
  gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-xs)',
168
176
  },
169
177
  [ButtonSize.xs]: {
170
178
  width: displayIconMode === ButtonDisplayMode.Only ? '2.25rem' : '8.75rem',
171
179
  height: '2.25rem',
172
- padding: displayIconMode === ButtonDisplayMode.Only ? 'var(--spacing-tokens-size-in-px-spacing-spacing-md)' : 'var(--spacing-tokens-size-in-px-spacing-spacing-md) var(--spacing-tokens-size-in-px-spacing-spacing-lg)',
180
+ padding: displayIconMode === ButtonDisplayMode.Only
181
+ ? 'var(--spacing-tokens-size-in-px-spacing-spacing-md)'
182
+ : 'var(--spacing-tokens-size-in-px-spacing-spacing-md) var(--spacing-tokens-size-in-px-spacing-spacing-lg)',
173
183
  fontSize: 'var(--global-font-size-1)',
174
184
  gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-xs)',
175
185
  },
176
186
  [ButtonSize.xxs]: {
177
187
  width: displayIconMode === ButtonDisplayMode.Only ? '2rem' : '7.75rem',
178
188
  height: '2rem',
179
- padding: displayIconMode === ButtonDisplayMode.Only ? 'var(--spacing-tokens-size-in-px-spacing-spacing-sm)' : 'var(--spacing-tokens-size-in-px-spacing-spacing-sm) var(--spacing-tokens-size-in-px-spacing-spacing-md)',
189
+ padding: displayIconMode === ButtonDisplayMode.Only
190
+ ? 'var(--spacing-tokens-size-in-px-spacing-spacing-sm)'
191
+ : 'var(--spacing-tokens-size-in-px-spacing-spacing-sm) var(--spacing-tokens-size-in-px-spacing-spacing-md)',
180
192
  fontSize: 'var(--global-font-size-0)',
181
193
  gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-xs)',
182
- }
194
+ },
183
195
  };
184
196
  return sizes[size] || sizes[ButtonSize.xl];
185
197
  };
@@ -200,35 +212,45 @@ export const MainButton = ({ onClick, text, disabled = false, loading = false, t
200
212
  [ButtonSize.md]: 20,
201
213
  [ButtonSize.sm]: 18,
202
214
  [ButtonSize.xs]: 16,
203
- [ButtonSize.xxs]: 14
215
+ [ButtonSize.xxs]: 14,
204
216
  };
205
217
  return sizes[size] || sizes[ButtonSize.xl];
206
218
  };
207
219
  const iconProps = {
208
220
  size: getIconSize(),
209
221
  color: getTextColor(),
210
- weight: "regular"
222
+ weight: 'regular',
211
223
  };
212
224
  const sizeStyles = getButtonSize();
213
225
  const renderContent = () => {
214
226
  if (loading) {
215
227
  return (_jsx(CircularProgress, { size: 24, sx: {
216
- color: getTextColor()
228
+ color: getTextColor(),
217
229
  } }));
218
230
  }
219
231
  if (displayIconMode === ButtonDisplayMode.Only && displayIcon) {
220
232
  return getIconComponent(displayIcon, iconProps);
221
233
  }
222
- return (_jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-sm)' }, children: [showLeadingIcon && leadingIcon && getIconComponent(leadingIcon, iconProps), text, showTrailingIcon && trailingIcon && getIconComponent(trailingIcon, iconProps)] }));
234
+ return (_jsxs("div", { style: {
235
+ display: 'flex',
236
+ alignItems: 'center',
237
+ gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-sm)',
238
+ }, children: [showLeadingIcon &&
239
+ leadingIcon &&
240
+ getIconComponent(leadingIcon, iconProps), text, showTrailingIcon &&
241
+ trailingIcon &&
242
+ getIconComponent(trailingIcon, iconProps)] }));
223
243
  };
224
244
  return (_jsx(Button, { onClick: onClick ? onClick : () => { }, type: type, disabled: state === ButtonState.Disabled || disabled, sx: {
225
- textTransform: "none",
245
+ textTransform: 'none',
226
246
  ...sizeStyles,
227
247
  borderRadius: getButtonShape(),
228
248
  background: getBackgroundColor(),
229
249
  color: getTextColor(),
230
250
  border: `1px solid ${getBorderColor()}`,
231
- boxShadow: state === ButtonState.Default ? '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)' : 'none',
251
+ boxShadow: state === ButtonState.Default
252
+ ? '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
+ : 'none',
232
254
  display: 'flex',
233
255
  alignItems: 'center',
234
256
  justifyContent: 'center',
@@ -0,0 +1,27 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { MainButton } from './Button';
3
+ declare const meta: Meta<typeof MainButton>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof MainButton>;
6
+ export declare const Primary: Story;
7
+ export declare const Secondary: Story;
8
+ export declare const SecondaryColor: Story;
9
+ export declare const SecondaryTransparent: Story;
10
+ export declare const Tetriary: Story;
11
+ export declare const TetriaryColor: Story;
12
+ export declare const PrimaryHover: Story;
13
+ export declare const PrimaryDisabled: Story;
14
+ export declare const IconOnly: Story;
15
+ export declare const IconOnlyHover: Story;
16
+ export declare const IconOnlyDisabled: Story;
17
+ export declare const Destructive: Story;
18
+ export declare const DestructiveHover: Story;
19
+ export declare const DestructiveDisabled: Story;
20
+ export declare const Large: Story;
21
+ export declare const Medium: Story;
22
+ export declare const Small: Story;
23
+ export declare const ExtraSmall: Story;
24
+ export declare const ExtraExtraSmall: Story;
25
+ export declare const CircularButton: Story;
26
+ export declare const CircularButtonHover: Story;
27
+ export declare const CircularButtonDisabled: Story;
@@ -0,0 +1,295 @@
1
+ import { MainButton } from './Button';
2
+ import { ButtonShape, ButtonState } from './types/button';
3
+ import { ButtonDisplayMode } from './types/button';
4
+ import { ButtonHierarchy } from './types/button';
5
+ import { ButtonSize } from './types/button';
6
+ const meta = {
7
+ title: 'Design System/Components/Button',
8
+ component: MainButton,
9
+ parameters: {
10
+ layout: 'centered',
11
+ design: {
12
+ type: 'figspec',
13
+ url: 'https://www.figma.com/design/mIhjz2yJjcpLlIqw6oUivt/Beyond-Presence?node-id=4339-3441&t=21PpejYhkGTLCVlu-4',
14
+ },
15
+ },
16
+ tags: ['autodocs'],
17
+ argTypes: {
18
+ text: {
19
+ control: 'text',
20
+ description: 'Button text content',
21
+ table: {
22
+ type: { summary: 'string' },
23
+ },
24
+ },
25
+ size: {
26
+ control: 'select',
27
+ options: ['xl', 'lg', 'md', 'sm', 'xs', 'xxs'],
28
+ description: 'Size of the button',
29
+ table: {
30
+ type: { summary: 'string' },
31
+ defaultValue: { summary: 'xl' },
32
+ },
33
+ },
34
+ hierarchy: {
35
+ control: 'select',
36
+ options: [
37
+ 'Primary',
38
+ 'Secondary',
39
+ 'Secondary-color',
40
+ 'Secondary-transparent',
41
+ 'Tetriary',
42
+ 'Tetriary-color',
43
+ ],
44
+ description: 'Visual hierarchy of the button',
45
+ table: {
46
+ type: { summary: 'string' },
47
+ defaultValue: { summary: 'Primary' },
48
+ },
49
+ },
50
+ displayIcon: {
51
+ control: 'text',
52
+ description: 'Name of the display Phosphor icon (e.g., "Circle", "AndroidLogo", "Armchair")',
53
+ table: {
54
+ type: { summary: 'string' },
55
+ },
56
+ },
57
+ displayIconMode: {
58
+ control: 'select',
59
+ options: ['Default', 'Only'],
60
+ description: 'Icon display mode - Default shows text with icons, Only shows a single icon without text',
61
+ table: {
62
+ type: { summary: 'string' },
63
+ defaultValue: { summary: 'Default' },
64
+ },
65
+ },
66
+ state: {
67
+ control: 'select',
68
+ options: ['Default', 'Hover', 'Disabled'],
69
+ description: 'Current state of the button',
70
+ table: {
71
+ type: { summary: 'string' },
72
+ defaultValue: { summary: 'Default' },
73
+ },
74
+ },
75
+ shape: {
76
+ control: 'select',
77
+ options: ['Square', 'Circle'],
78
+ description: 'Shape of the button',
79
+ table: {
80
+ type: { summary: 'string' },
81
+ defaultValue: { summary: 'Square' },
82
+ },
83
+ },
84
+ destructive: {
85
+ control: 'boolean',
86
+ description: 'Whether the button is destructive',
87
+ table: {
88
+ type: { summary: 'boolean' },
89
+ defaultValue: { summary: 'false' },
90
+ },
91
+ },
92
+ loading: {
93
+ control: 'boolean',
94
+ description: 'Whether the button is in loading state',
95
+ table: {
96
+ type: { summary: 'boolean' },
97
+ defaultValue: { summary: 'false' },
98
+ },
99
+ },
100
+ showLeadingIcon: {
101
+ control: 'boolean',
102
+ description: 'Whether to show the leading icon',
103
+ table: {
104
+ type: { summary: 'boolean' },
105
+ defaultValue: { summary: 'true' },
106
+ },
107
+ },
108
+ showTrailingIcon: {
109
+ control: 'boolean',
110
+ description: 'Whether to show the trailing icon',
111
+ table: {
112
+ type: { summary: 'boolean' },
113
+ defaultValue: { summary: 'true' },
114
+ },
115
+ },
116
+ leadingIcon: {
117
+ control: 'text',
118
+ description: 'Name of the leading Phosphor icon (e.g., "Circle", "AndroidLogo", "Armchair")',
119
+ table: {
120
+ type: { summary: 'string' },
121
+ defaultValue: { summary: 'Circle' },
122
+ },
123
+ },
124
+ trailingIcon: {
125
+ control: 'text',
126
+ description: 'Name of the trailing Phosphor icon (e.g., "Circle", "AndroidLogo", "Armchair")',
127
+ table: {
128
+ type: { summary: 'string' },
129
+ defaultValue: { summary: 'Circle' },
130
+ },
131
+ },
132
+ },
133
+ };
134
+ export default meta;
135
+ export const Primary = {
136
+ args: {
137
+ text: 'Button',
138
+ size: ButtonSize.xl,
139
+ hierarchy: ButtonHierarchy.Primary,
140
+ displayIconMode: ButtonDisplayMode.Default,
141
+ state: ButtonState.Default,
142
+ shape: ButtonShape.Square,
143
+ destructive: false,
144
+ showLeadingIcon: true,
145
+ showTrailingIcon: true,
146
+ leadingIcon: 'Circle',
147
+ trailingIcon: 'Circle',
148
+ },
149
+ };
150
+ export const Secondary = {
151
+ args: {
152
+ ...Primary.args,
153
+ text: 'Button',
154
+ hierarchy: ButtonHierarchy.Secondary,
155
+ },
156
+ };
157
+ export const SecondaryColor = {
158
+ args: {
159
+ ...Primary.args,
160
+ text: 'Button',
161
+ hierarchy: ButtonHierarchy.SecondaryColor,
162
+ },
163
+ };
164
+ export const SecondaryTransparent = {
165
+ args: {
166
+ ...Primary.args,
167
+ text: 'Button',
168
+ hierarchy: ButtonHierarchy.SecondaryTransparent,
169
+ },
170
+ };
171
+ export const Tetriary = {
172
+ args: {
173
+ ...Primary.args,
174
+ text: 'Button',
175
+ hierarchy: ButtonHierarchy.Tetriary,
176
+ },
177
+ };
178
+ export const TetriaryColor = {
179
+ args: {
180
+ ...Primary.args,
181
+ text: 'Button',
182
+ hierarchy: ButtonHierarchy.TetriaryColor,
183
+ },
184
+ };
185
+ export const PrimaryHover = {
186
+ args: {
187
+ ...Primary.args,
188
+ state: ButtonState.Hover,
189
+ },
190
+ };
191
+ export const PrimaryDisabled = {
192
+ args: {
193
+ ...Primary.args,
194
+ state: ButtonState.Disabled,
195
+ },
196
+ };
197
+ export const IconOnly = {
198
+ args: {
199
+ displayIconMode: ButtonDisplayMode.Only,
200
+ displayIcon: 'AndroidLogo',
201
+ size: ButtonSize.xl,
202
+ hierarchy: ButtonHierarchy.Primary,
203
+ state: ButtonState.Default,
204
+ shape: ButtonShape.Square,
205
+ },
206
+ };
207
+ export const IconOnlyHover = {
208
+ args: {
209
+ ...IconOnly.args,
210
+ state: ButtonState.Hover,
211
+ },
212
+ };
213
+ export const IconOnlyDisabled = {
214
+ args: {
215
+ ...IconOnly.args,
216
+ state: ButtonState.Disabled,
217
+ },
218
+ };
219
+ export const Destructive = {
220
+ args: {
221
+ ...Primary.args,
222
+ text: 'Button',
223
+ destructive: true,
224
+ },
225
+ };
226
+ export const DestructiveHover = {
227
+ args: {
228
+ ...Destructive.args,
229
+ state: ButtonState.Hover,
230
+ },
231
+ };
232
+ export const DestructiveDisabled = {
233
+ args: {
234
+ ...Destructive.args,
235
+ state: ButtonState.Disabled,
236
+ },
237
+ };
238
+ export const Large = {
239
+ args: {
240
+ ...Primary.args,
241
+ size: ButtonSize.lg,
242
+ text: 'Button',
243
+ },
244
+ };
245
+ export const Medium = {
246
+ args: {
247
+ ...Primary.args,
248
+ size: ButtonSize.md,
249
+ text: 'Button',
250
+ },
251
+ };
252
+ export const Small = {
253
+ args: {
254
+ ...Primary.args,
255
+ size: ButtonSize.sm,
256
+ text: 'Button',
257
+ },
258
+ };
259
+ export const ExtraSmall = {
260
+ args: {
261
+ ...Primary.args,
262
+ size: ButtonSize.xs,
263
+ text: 'Button',
264
+ },
265
+ };
266
+ export const ExtraExtraSmall = {
267
+ args: {
268
+ ...Primary.args,
269
+ size: ButtonSize.xxs,
270
+ text: 'Button',
271
+ },
272
+ };
273
+ export const CircularButton = {
274
+ args: {
275
+ text: 'Button',
276
+ size: ButtonSize.xl,
277
+ hierarchy: ButtonHierarchy.Primary,
278
+ displayIconMode: ButtonDisplayMode.Only,
279
+ displayIcon: 'Circle',
280
+ shape: ButtonShape.Circle,
281
+ state: ButtonState.Default,
282
+ },
283
+ };
284
+ export const CircularButtonHover = {
285
+ args: {
286
+ ...CircularButton.args,
287
+ state: ButtonState.Hover,
288
+ },
289
+ };
290
+ export const CircularButtonDisabled = {
291
+ args: {
292
+ ...CircularButton.args,
293
+ state: ButtonState.Disabled,
294
+ },
295
+ };
@@ -0,0 +1,6 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { Colors } from './Colors';
3
+ declare const meta: Meta<typeof Colors>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof Colors>;
6
+ export declare const Default: Story;
@@ -0,0 +1,10 @@
1
+ import { Colors } from './Colors';
2
+ const meta = {
3
+ title: 'Design System/Colors',
4
+ component: Colors,
5
+ parameters: {
6
+ layout: 'fullscreen',
7
+ },
8
+ };
9
+ export default meta;
10
+ export const Default = {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@beydesign/storybook",
3
3
  "private": false,
4
- "version": "0.0.1",
4
+ "version": "0.0.3",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -16,7 +16,10 @@
16
16
  "lint": "eslint .",
17
17
  "preview": "vite preview",
18
18
  "storybook": "storybook dev -p 6006",
19
- "build-storybook": "storybook build"
19
+ "build-storybook": "storybook build",
20
+ "version:patch": "npm version patch -m \"🔖 Release %s\"",
21
+ "version:minor": "npm version minor -m \"🔖 Release %s\"",
22
+ "version:major": "npm version major -m \"🔖 Release %s\""
20
23
  },
21
24
  "publishConfig": {
22
25
  "access": "public"
@@ -33,8 +36,7 @@
33
36
  "@phosphor-icons/react": "^2.1.7",
34
37
  "react": "^18.2.0",
35
38
  "react-dom": "^18.2.0",
36
- "style-dictionary": "^4.3.2",
37
- "token-transformer": "^0.0.33"
39
+ "typescript": "~5.5.0"
38
40
  },
39
41
  "devDependencies": {
40
42
  "@chromatic-com/storybook": "^3.2.4",
@@ -49,6 +51,8 @@
49
51
  "@storybook/test": "^8.5.2",
50
52
  "@types/react": "^18.3.2",
51
53
  "@types/react-dom": "^18.3.0",
54
+ "@typescript-eslint/eslint-plugin": "^7.1.1",
55
+ "@typescript-eslint/parser": "^7.1.1",
52
56
  "@vitejs/plugin-react": "^4.2.1",
53
57
  "autoprefixer": "^10.4.18",
54
58
  "eslint": "^8.57.0",
@@ -62,6 +66,7 @@
62
66
  "postcss": "^8.4.35",
63
67
  "prettier": "3.2.5",
64
68
  "storybook": "^8.5.2",
69
+ "typescript-eslint": "^7.1.1",
65
70
  "vite": "^5.1.6"
66
71
  },
67
72
  "eslintConfig": {
@@ -1,12 +0,0 @@
1
- import './header.css';
2
- type User = {
3
- name: string;
4
- };
5
- export interface HeaderProps {
6
- user?: User;
7
- onLogin?: () => void;
8
- onLogout?: () => void;
9
- onCreateAccount?: () => void;
10
- }
11
- export declare const Header: ({ user, onLogin, onLogout, onCreateAccount }: HeaderProps) => import("react/jsx-runtime").JSX.Element;
12
- export {};
@@ -1,4 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { Button } from '@mui/material';
3
- import './header.css';
4
- export const Header = ({ user, onLogin, onLogout, onCreateAccount }) => (_jsx("header", { children: _jsxs("div", { className: "storybook-header", children: [_jsxs("div", { children: [_jsx("svg", { width: "32", height: "32", viewBox: "0 0 32 32", xmlns: "http://www.w3.org/2000/svg", children: _jsxs("g", { fill: "none", fillRule: "evenodd", children: [_jsx("path", { d: "M10 0h12a10 10 0 0110 10v12a10 10 0 01-10 10H10A10 10 0 010 22V10A10 10 0 0110 0z", fill: "#FFF" }), _jsx("path", { d: "M5.3 10.6l10.4 6v11.1l-10.4-6v-11zm11.4-6.2l9.7 5.5-9.7 5.6V4.4z", fill: "#555AB9" }), _jsx("path", { d: "M27.2 10.6v11.2l-10.5 6V16.5l10.5-6zM15.7 4.4v11L6 10l9.7-5.5z", fill: "#91BAF8" })] }) }), _jsx("h1", { children: "Acme" })] }), _jsx("div", { children: user ? (_jsxs(_Fragment, { children: [_jsxs("span", { className: "welcome", children: ["Welcome, ", _jsx("b", { children: user.name }), "!"] }), _jsx(Button, { size: "small", onClick: onLogout, children: "Log out" })] })) : (_jsxs(_Fragment, { children: [_jsx(Button, { size: "small", onClick: onLogin, children: "Log in" }), _jsx(Button, { size: "small", onClick: onCreateAccount, children: "Sign up" })] })) })] }) }));
@@ -1,18 +0,0 @@
1
- import type { StoryObj } from '@storybook/react';
2
- declare const meta: {
3
- title: string;
4
- component: ({ user, onLogin, onLogout, onCreateAccount }: import("./Header").HeaderProps) => import("react/jsx-runtime").JSX.Element;
5
- tags: string[];
6
- parameters: {
7
- layout: string;
8
- };
9
- args: {
10
- onLogin: import("@vitest/spy").Mock<(...args: any[]) => any>;
11
- onLogout: import("@vitest/spy").Mock<(...args: any[]) => any>;
12
- onCreateAccount: import("@vitest/spy").Mock<(...args: any[]) => any>;
13
- };
14
- };
15
- export default meta;
16
- type Story = StoryObj<typeof meta>;
17
- export declare const LoggedIn: Story;
18
- export declare const LoggedOut: Story;
@@ -1,26 +0,0 @@
1
- import { fn } from '@storybook/test';
2
- import { Header } from './Header';
3
- const meta = {
4
- title: 'Example/Header',
5
- component: Header,
6
- // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
7
- tags: ['autodocs'],
8
- parameters: {
9
- // More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
10
- layout: 'fullscreen',
11
- },
12
- args: {
13
- onLogin: fn(),
14
- onLogout: fn(),
15
- onCreateAccount: fn(),
16
- },
17
- };
18
- export default meta;
19
- export const LoggedIn = {
20
- args: {
21
- user: {
22
- name: 'Jane Doe',
23
- },
24
- },
25
- };
26
- export const LoggedOut = {};
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- import './page.css';
3
- export declare const Page: React.FC;
@@ -1,8 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import React from 'react';
3
- import { Header } from './Header';
4
- import './page.css';
5
- export const Page = () => {
6
- const [user, setUser] = React.useState();
7
- return (_jsxs("article", { children: [_jsx(Header, { user: user, onLogin: () => setUser({ name: 'Jane Doe' }), onLogout: () => setUser(undefined), onCreateAccount: () => setUser({ name: 'Jane Doe' }) }), _jsxs("section", { className: "storybook-page", children: [_jsx("h2", { children: "Pages in Storybook" }), _jsxs("p", { children: ["We recommend building UIs with a", ' ', _jsx("a", { href: "https://componentdriven.org", target: "_blank", rel: "noopener noreferrer", children: _jsx("strong", { children: "component-driven" }) }), ' ', "process starting with atomic components and ending with pages."] }), _jsx("p", { children: "Render pages with mock data. This makes it easy to build and review page states without needing to navigate to them in your app. Here are some handy patterns for managing page data in Storybook:" }), _jsxs("ul", { children: [_jsx("li", { children: "Use a higher-level connected component. Storybook helps you compose such data from the \"args\" of child component stories" }), _jsx("li", { children: "Assemble data in the page component from your services. You can mock these services out using Storybook." })] }), _jsxs("p", { children: ["Get a guided tutorial on component-driven development at", ' ', _jsx("a", { href: "https://storybook.js.org/tutorials/", target: "_blank", rel: "noopener noreferrer", children: "Storybook tutorials" }), ". Read more in the", ' ', _jsx("a", { href: "https://storybook.js.org/docs", target: "_blank", rel: "noopener noreferrer", children: "docs" }), "."] }), _jsxs("div", { className: "tip-wrapper", children: [_jsx("span", { className: "tip", children: "Tip" }), " Adjust the width of the canvas with the", ' ', _jsx("svg", { width: "10", height: "10", viewBox: "0 0 12 12", xmlns: "http://www.w3.org/2000/svg", children: _jsx("g", { fill: "none", fillRule: "evenodd", children: _jsx("path", { d: "M1.5 5.2h4.8c.3 0 .5.2.5.4v5.1c-.1.2-.3.3-.4.3H1.4a.5.5 0 01-.5-.4V5.7c0-.3.2-.5.5-.5zm0-2.1h6.9c.3 0 .5.2.5.4v7a.5.5 0 01-1 0V4H1.5a.5.5 0 010-1zm0-2.1h9c.3 0 .5.2.5.4v9.1a.5.5 0 01-1 0V2H1.5a.5.5 0 010-1zm4.3 5.2H2V10h3.8V6.2z", id: "a", fill: "#999" }) }) }), "Viewports addon in the toolbar"] })] })] }));
8
- };
@@ -1,12 +0,0 @@
1
- import type { StoryObj } from '@storybook/react';
2
- declare const meta: {
3
- title: string;
4
- component: import("react").FC<{}>;
5
- parameters: {
6
- layout: string;
7
- };
8
- };
9
- export default meta;
10
- type Story = StoryObj<typeof meta>;
11
- export declare const LoggedOut: Story;
12
- export declare const LoggedIn: Story;
@@ -1,24 +0,0 @@
1
- import { expect, userEvent, within } from '@storybook/test';
2
- import { Page } from './Page';
3
- const meta = {
4
- title: 'Example/Page',
5
- component: Page,
6
- parameters: {
7
- // More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
8
- layout: 'fullscreen',
9
- },
10
- };
11
- export default meta;
12
- export const LoggedOut = {};
13
- // More on component testing: https://storybook.js.org/docs/writing-tests/component-testing
14
- export const LoggedIn = {
15
- play: async ({ canvasElement }) => {
16
- const canvas = within(canvasElement);
17
- const loginButton = canvas.getByRole('button', { name: /Log in/i });
18
- await expect(loginButton).toBeInTheDocument();
19
- await userEvent.click(loginButton);
20
- await expect(loginButton).not.toBeInTheDocument();
21
- const logoutButton = canvas.getByRole('button', { name: /Log out/i });
22
- await expect(logoutButton).toBeInTheDocument();
23
- },
24
- };