@beydesign/storybook 0.0.14 → 0.0.15

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
@@ -16,28 +16,36 @@ npm install @beydesign/storybook
16
16
 
17
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.
18
18
 
19
+ After installing the tokens package, you will need to install the figtree font. Link to the font is provided in the [Links](#links) section.
20
+
19
21
  ## Usage
20
22
 
21
23
  1. Import the components you need:
22
24
 
23
25
  ```jsx
24
- import { MainButton, ButtonHierarchy, ButtonShape, ButtonSize } from '@beydesign/storybook';
26
+ import {
27
+ MainButton,
28
+ ButtonHierarchy,
29
+ ButtonShape,
30
+ ButtonSize,
31
+ } from '@beydesign/storybook';
25
32
 
26
33
  function App() {
27
34
  return (
28
35
  <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
- />
36
+ size={ButtonSize.lg}
37
+ shape={ButtonShape.Square}
38
+ onClick={rejoin}
39
+ disabled={buttonsDisabled}
40
+ hierarchy={ButtonHierarchy.Primary}
41
+ showLeadingIcon={false}
42
+ showTrailingIcon={false}
43
+ text="Rejoin"
44
+ />
38
45
  );
39
46
  }
40
47
  ```
48
+
41
49
  ## Development
42
50
 
43
51
  To run the Storybook development environment locally:
@@ -47,12 +55,13 @@ npm install
47
55
  npm run storybook
48
56
  ```
49
57
 
50
-
51
58
  ## Links
52
59
 
53
60
  - [Design System (Figma)](https://www.figma.com/design/mIhjz2yJjcpLlIqw6oUivt/Beyond-Presence?node-id=4295-3110&p=f&m=dev)
54
61
  - [NPM Package](https://www.npmjs.com/package/@beydesign/storybook)
55
62
  - [Hosted Storybook](https://beyond-presence.github.io/bey-design-system/)
63
+ - [Design Tokens Package](https://github.com/Beyond-Presence/bey-design-token)
64
+ - [Figtree Font](https://fonts.google.com/specimen/Figtree)
56
65
 
57
66
  ## Support
58
67
 
@@ -5,6 +5,10 @@ const meta = {
5
5
  component: Colors,
6
6
  parameters: {
7
7
  layout: 'fullscreen',
8
+ design: {
9
+ type: 'figspec',
10
+ url: 'https://www.figma.com/design/mIhjz2yJjcpLlIqw6oUivt/Beyond-Presence?node-id=4307-13259&m=dev',
11
+ },
8
12
  },
9
13
  };
10
14
  export default meta;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { HeaderProps } from './types/header';
3
+ export declare const Header: React.FC<HeaderProps>;
@@ -0,0 +1,12 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box } from '@mui/material';
3
+ import { MainButton } from './Button';
4
+ import { ButtonHierarchy, ButtonSize } from './types/button';
5
+ import { Typography } from './Typography';
6
+ import { TypographySize, TypographyWeight } from './types/typography';
7
+ import { Avatar } from './Avatar';
8
+ import { AvatarSize } from './types/avatar';
9
+ import styles from './Header.module.css';
10
+ export const Header = ({ title = 'Beyond Presence', email, avatarProps, backButtonText = 'Back', onBackClick, onLogoutClick, className, }) => {
11
+ return (_jsxs(Box, { className: className, display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', border: '1px solid var(--primitives-desktop-primary-gray-200)', bgcolor: 'var(--colors-light-background-bg-white)', paddingX: 'var(--spacing-tokens-size-in-px-spacing-spacing-4xl)', height: 'var( --spacing-tokens-size-in-px-spacing-spacing-7xl)', children: [onBackClick ? (_jsx(MainButton, { text: backButtonText, hierarchy: ButtonHierarchy.Tetriary, showLeadingIcon: true, leadingIcon: 'ArrowLeft', onClick: onBackClick })) : (_jsx(Typography, { text: title, size: TypographySize.HeadingS, weight: TypographyWeight.SemiBold })), _jsxs(Box, { display: 'flex', flexDirection: 'row', alignItems: 'center', gap: '8px', children: [_jsxs(Box, { display: 'flex', flexDirection: 'column', alignItems: 'flex-end', justifyContent: 'space-between', children: [_jsx(Typography, { text: email, size: TypographySize.TextS, weight: TypographyWeight.SemiBold, className: styles['header-email'] }), _jsx(MainButton, { text: 'Log Out', size: ButtonSize.sm, hierarchy: ButtonHierarchy.Tetriary, onClick: onLogoutClick, style: { paddingInline: '0px', paddingBlock: '0.1rem' } })] }), _jsx(Avatar, { ...avatarProps, size: AvatarSize.md })] })] }));
12
+ };
@@ -0,0 +1,7 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { Header } from './Header';
3
+ declare const meta: Meta<typeof Header>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof Header>;
6
+ export declare const Default: Story;
7
+ export declare const WithBackButton: Story;
@@ -0,0 +1,87 @@
1
+ import { Header } from './Header';
2
+ import { AvatarStyle } from './types/avatar';
3
+ import styles from './Header.module.css';
4
+ const meta = {
5
+ title: 'Design System/Components/Header',
6
+ component: Header,
7
+ parameters: {
8
+ layout: 'centered',
9
+ design: {
10
+ type: 'figspec',
11
+ url: 'https://www.figma.com/design/mIhjz2yJjcpLlIqw6oUivt/Beyond-Presence?node-id=5115-3325&t=DxHE3Y7uZLPwM9mQ-1',
12
+ },
13
+ },
14
+ tags: ['autodocs'],
15
+ argTypes: {
16
+ title: {
17
+ control: 'text',
18
+ description: 'Title of the header',
19
+ table: {
20
+ type: { summary: 'string' },
21
+ },
22
+ },
23
+ email: {
24
+ control: 'text',
25
+ description: 'Email of the logged in user',
26
+ table: {
27
+ type: { summary: 'string' },
28
+ },
29
+ },
30
+ avatarProps: {
31
+ control: 'object',
32
+ description: 'Avatar props',
33
+ table: {
34
+ type: { summary: 'object' },
35
+ },
36
+ },
37
+ backButtonText: {
38
+ control: 'text',
39
+ description: 'Text of the back button',
40
+ table: {
41
+ type: { summary: 'string' },
42
+ defaultValue: { summary: 'Back' },
43
+ },
44
+ },
45
+ onBackClick: {
46
+ description: 'Callback function to handle back button click',
47
+ table: {
48
+ type: { summary: 'function' },
49
+ },
50
+ },
51
+ onLogoutClick: {
52
+ description: 'Callback function to handle logout button click',
53
+ table: {
54
+ type: { summary: 'function' },
55
+ },
56
+ },
57
+ className: {
58
+ control: 'text',
59
+ description: 'Custom class name for the header',
60
+ table: {
61
+ type: { summary: 'string' },
62
+ defaultValue: { summary: styles['responsive-width'] },
63
+ },
64
+ },
65
+ },
66
+ };
67
+ export default meta;
68
+ export const Default = {
69
+ args: {
70
+ title: 'Beyond Presence',
71
+ email: 'john.doe@example.com',
72
+ avatarProps: {
73
+ avatarStyle: AvatarStyle.Placeholder,
74
+ text: 'John Doe',
75
+ },
76
+ backButtonText: 'Back',
77
+ onLogoutClick: () => { },
78
+ className: styles['responsive-width'],
79
+ },
80
+ };
81
+ export const WithBackButton = {
82
+ args: {
83
+ ...Default.args,
84
+ backButtonText: 'Back',
85
+ onBackClick: () => { },
86
+ },
87
+ };
@@ -5,6 +5,10 @@ declare const meta: {
5
5
  component: import("react").FC<import("./types/logo").LogoProps>;
6
6
  parameters: {
7
7
  layout: string;
8
+ design: {
9
+ type: string;
10
+ url: string;
11
+ };
8
12
  };
9
13
  tags: string[];
10
14
  argTypes: {
@@ -5,6 +5,10 @@ const meta = {
5
5
  component: Logo,
6
6
  parameters: {
7
7
  layout: 'centered',
8
+ design: {
9
+ type: 'figspec',
10
+ url: 'https://www.figma.com/design/mIhjz2yJjcpLlIqw6oUivt/Beyond-Presence?node-id=278-2962&m=dev',
11
+ },
8
12
  },
9
13
  tags: ['autodocs'],
10
14
  argTypes: {
@@ -55,7 +55,7 @@ const IOSSwitch = styled((props) => (_jsx(Switch, { focusVisibleClassName: ".Mui
55
55
  },
56
56
  }));
57
57
  export const Toggle = ({ checked, onChange, text = 'Click me', title, disabled = false, togglePosition = TogglePosition.Left, style, }) => {
58
- return (_jsxs(Box, { display: "flex", alignItems: "flex-start", flexDirection: togglePosition === TogglePosition.Left ? 'row' : 'row-reverse', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-md)', sx: style, children: [_jsx(IOSSwitch, { checked: checked, onChange: (e) => onChange(e.target.checked), disabled: disabled }), text && (_jsxs(Box, { display: "flex", flexDirection: "column", children: [_jsx(Typography, { text: text, size: TypographySize.TextS, weight: TypographyWeight.Medium, color: 'var(--colors-light-text-text-title)', style: { lineHeight: '20px' } }), title && (_jsx(Typography, { text: title, size: TypographySize.TextS, weight: TypographyWeight.Medium, color: "#475467", style: { lineHeight: '20px' } }))] }))] }));
58
+ return (_jsxs(Box, { display: "flex", alignItems: "flex-start", flexDirection: togglePosition === TogglePosition.Left ? 'row' : 'row-reverse', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-md)', sx: style, children: [_jsx(IOSSwitch, { checked: checked, onChange: (e) => onChange(e.target.checked), disabled: disabled }), text && (_jsxs(Box, { display: "flex", flexDirection: "column", children: [_jsx(Typography, { text: text, size: TypographySize.TextS, weight: TypographyWeight.Medium, color: 'var(--colors-light-text-text-title)' }), title && (_jsx(Typography, { text: title, size: TypographySize.TextS, weight: TypographyWeight.Medium, color: "#475467" }))] }))] }));
59
59
  };
60
60
  export const Components = () => {
61
61
  return (_jsxs("div", { style: { padding: '20px' }, children: [_jsx("h1", { children: "Toggle" }), _jsx("div", { style: { display: 'flex', gap: '1rem', flexDirection: 'column' } })] }));
@@ -7,7 +7,7 @@ const meta = {
7
7
  layout: 'centered',
8
8
  design: {
9
9
  type: 'figspec',
10
- url: 'https://www.figma.com/design/mIhjz2yJjcpLlIqw6oUivt/Beyond-Presence?node-id=4595-5881&t=3PJghL9RdZ71sldb-1',
10
+ url: 'https://www.figma.com/design/mIhjz2yJjcpLlIqw6oUivt/Beyond-Presence?node-id=4595-5881&t=3PJghL9RdZ71sldb-1&m=dev',
11
11
  },
12
12
  },
13
13
  tags: ['autodocs'],
@@ -7,7 +7,7 @@ const meta = {
7
7
  layout: 'centered',
8
8
  design: {
9
9
  type: 'figspec',
10
- url: '',
10
+ url: 'https://www.figma.com/design/mIhjz2yJjcpLlIqw6oUivt/Beyond-Presence?node-id=4730-7941&m=dev',
11
11
  },
12
12
  },
13
13
  tags: ['autodocs'],
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { TypographySize, TypographyWeight, } from './types/typography';
3
- export const Typography = ({ text, color, size = TypographySize.HeadingL, weight = TypographyWeight.Bold, style, }) => {
3
+ export const Typography = ({ text, color, size = TypographySize.HeadingL, weight = TypographyWeight.Bold, className, }) => {
4
4
  const getTypographySizeToken = () => {
5
5
  let sizeLc = size?.toLowerCase() || '';
6
6
  if (sizeLc.includes('heading')) {
@@ -24,12 +24,29 @@ export const Typography = ({ text, color, size = TypographySize.HeadingL, weight
24
24
  const fontSize = `var(--global-${sizeToken}-${weightToken}-font-size)`;
25
25
  const fontWeight = `var(--global-${sizeToken}-${weightToken}-font-weight)`;
26
26
  const fontFamily = `var(--global-${sizeToken}-${weightToken}-font-family)`;
27
- return (_jsx("span", { style: {
27
+ const lineHeight = `var(--global-${sizeToken}-${weightToken}-line-height)`;
28
+ const letterSpacing = `var(--global-${sizeToken}-${weightToken}-letter-spacing)`;
29
+ const paragraphIndent = `var(--global-${sizeToken}-${weightToken}-paragraph-indent)`;
30
+ const paragraphSpacing = `var(--global-${sizeToken}-${weightToken}-paragraph-spacing)`;
31
+ const textDecoration = `var(--global-${sizeToken}-${weightToken}-text-decoration)`;
32
+ const getTextTransform = () => {
33
+ const computedValue = getComputedStyle(document.documentElement)
34
+ .getPropertyValue(`--global-${sizeToken}-${weightToken}-text-case`)
35
+ .trim();
36
+ return (computedValue === 'uppercase' ? 'uppercase' : 'none');
37
+ };
38
+ return (_jsx("span", { className: className, style: {
39
+ display: 'block',
28
40
  fontSize: fontSize,
29
41
  fontWeight: fontWeight,
30
42
  fontFamily: fontFamily + ', sans-serif',
43
+ lineHeight: lineHeight + 'px',
44
+ letterSpacing: letterSpacing,
45
+ textIndent: paragraphIndent,
46
+ marginBottom: paragraphSpacing,
47
+ textTransform: getTextTransform(),
48
+ textDecoration: textDecoration,
31
49
  color: color || 'var(--global-text-text-title)',
32
- ...style,
33
50
  }, children: text }));
34
51
  };
35
52
  export const Components = () => {
@@ -44,13 +44,6 @@ const meta = {
44
44
  type: { summary: 'string' },
45
45
  },
46
46
  },
47
- style: {
48
- control: 'object',
49
- description: 'Style of the typography',
50
- table: {
51
- type: { summary: 'object' },
52
- },
53
- },
54
47
  },
55
48
  };
56
49
  export default meta;
@@ -0,0 +1,25 @@
1
+ import { AvatarProps } from './avatar';
2
+ /**
3
+ * Header component props
4
+ */
5
+ export type HeaderProps = {
6
+ /** Title of the header */
7
+ title: string;
8
+ /** Email of the logged in user */
9
+ email: string;
10
+ /** Avatar props */
11
+ avatarProps: AvatarProps;
12
+ /** Text of the back button */
13
+ backButtonText?: string;
14
+ /** CSS class name for additional styling */
15
+ className?: string;
16
+ /** Callback function to handle back button click */
17
+ onBackClick?: () => void;
18
+ /** Callback function to handle logout button click */
19
+ onLogoutClick?: () => void;
20
+ };
21
+ /**
22
+ * Props for the Components wrapper
23
+ */
24
+ export interface ComponentsProps {
25
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,3 @@
1
- import { CSSProperties } from 'react';
2
1
  /**
3
2
  * Typography size variants
4
3
  */
@@ -36,8 +35,8 @@ export interface TypographyProps {
36
35
  weight?: TypographyWeight;
37
36
  /** Color variant of the typography */
38
37
  color?: string;
39
- /** Style variant of the typography */
40
- style?: CSSProperties;
38
+ /** CSS class name for additional styling */
39
+ className?: string;
41
40
  }
42
41
  /**
43
42
  * Props for the Components wrapper
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@beydesign/storybook",
3
3
  "private": false,
4
- "version": "0.0.14",
4
+ "version": "0.0.15",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -25,7 +25,7 @@
25
25
  "access": "public"
26
26
  },
27
27
  "dependencies": {
28
- "@beydesign/tokens": "latest",
28
+ "@beydesign/tokens": "^0.0.6",
29
29
  "@emotion/react": "^11.11.4",
30
30
  "@emotion/styled": "^11.11.0",
31
31
  "@fortawesome/fontawesome-svg-core": "^6.5.1",