@beydesign/storybook 0.0.71 → 0.0.73
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/stories/Form/TextArea.js +2 -2
- package/dist/stories/Form/TextArea.stories.d.ts +13 -0
- package/dist/stories/Form/TextArea.stories.js +20 -1
- package/dist/stories/Form/types.d.ts +2 -0
- package/dist/stories/Navigation/ComplexHeader.d.ts +3 -0
- package/dist/stories/Navigation/ComplexHeader.js +21 -0
- package/dist/stories/Navigation/ComplexHeader.stories.d.ts +6 -0
- package/dist/stories/Navigation/ComplexHeader.stories.js +82 -0
- package/dist/stories/Navigation/index.d.ts +1 -0
- package/dist/stories/Navigation/index.js +1 -0
- package/dist/stories/Navigation/types.d.ts +24 -0
- package/dist/stories/Navigation/types.js +5 -0
- package/dist/stories/UI/Topbar.d.ts +3 -0
- package/dist/stories/UI/Topbar.js +9 -0
- package/dist/stories/UI/Topbar.stories.d.ts +6 -0
- package/dist/stories/UI/Topbar.stories.js +71 -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 +15 -2
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ import { useState } from 'react';
|
|
|
3
3
|
import { Box } from '@mui/material';
|
|
4
4
|
import { Typography, TypographySize, TypographyWeight } from '../Typography';
|
|
5
5
|
import { HintBubble, HintBubbleSize } from '../UI';
|
|
6
|
-
export const TextArea = ({ label, value, onChange, placeholder, hintText, errorText, disabled, maxLength = 256, showMaxLengthIndicator = false, numberOfRows = 5, style, hintBubbleProps, hintBubbleText, required, labelTrailingElement, labelContainerStyle, }) => {
|
|
6
|
+
export const TextArea = ({ label, value, onChange, placeholder, hintText, errorText, disabled, allowMaxLength = false, maxLength = 256, showMaxLengthIndicator = false, numberOfRows = 5, style, hintBubbleProps, hintBubbleText, required, labelTrailingElement, labelContainerStyle, }) => {
|
|
7
7
|
const [focused, setFocused] = useState(false);
|
|
8
8
|
return (_jsx(Box, { display: 'flex', flexDirection: 'column', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-sm)', sx: style, children: _jsxs(Box, { display: 'flex', flexDirection: 'column', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-lg)', minWidth: '260px', children: [label && (_jsx(Typography, { text: label, size: TypographySize.HeadingXS, weight: TypographyWeight.SemiBold, required: required, trailingElement: labelTrailingElement, style: labelContainerStyle })), hintBubbleText && (_jsx(HintBubble, { text: hintBubbleText, size: HintBubbleSize.sm, ...hintBubbleProps })), _jsx(Box, { display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', bgcolor: 'var(--colors-light-background-bg-component)', border: `1px solid ${errorText
|
|
9
9
|
? 'var(--colors-light-border-border-error)'
|
|
@@ -19,5 +19,5 @@ export const TextArea = ({ label, value, onChange, placeholder, hintText, errorT
|
|
|
19
19
|
: 'var(--colors-light-text-text-title)',
|
|
20
20
|
backgroundColor: 'transparent',
|
|
21
21
|
resize: 'none',
|
|
22
|
-
}, maxLength: maxLength, onFocus: () => setFocused(true), onBlur: () => setFocused(false), required: required }) }), _jsxs(Box, { display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', children: [errorText ? (_jsx(Typography, { text: errorText, size: TypographySize.TextS, weight: TypographyWeight.Regular, color: 'var(--colors-light-text-text-error)' })) : hintText ? (_jsx(Typography, { text: hintText, size: TypographySize.TextS, weight: TypographyWeight.Regular, color: 'var(--colors-light-text-text-subtle)' })) : (_jsx(Box, { style: { flex: 1 } })), showMaxLengthIndicator && maxLength && (_jsx(Typography, { text: `${maxLength - value.length}`, size: TypographySize.TextS, weight: TypographyWeight.Regular, color: 'var(--colors-light-text-text-subtle)', style: { alignSelf: 'flex-end' } }))] })] }) }));
|
|
22
|
+
}, maxLength: allowMaxLength ? maxLength : undefined, onFocus: () => setFocused(true), onBlur: () => setFocused(false), required: required }) }), _jsxs(Box, { display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', children: [errorText ? (_jsx(Typography, { text: errorText, size: TypographySize.TextS, weight: TypographyWeight.Regular, color: 'var(--colors-light-text-text-error)' })) : hintText ? (_jsx(Typography, { text: hintText, size: TypographySize.TextS, weight: TypographyWeight.Regular, color: 'var(--colors-light-text-text-subtle)' })) : (_jsx(Box, { style: { flex: 1 } })), showMaxLengthIndicator && allowMaxLength && maxLength && (_jsx(Typography, { text: `${maxLength - value.length}`, size: TypographySize.TextS, weight: TypographyWeight.Regular, color: 'var(--colors-light-text-text-subtle)', style: { alignSelf: 'flex-end' } }))] })] }) }));
|
|
23
23
|
};
|
|
@@ -141,8 +141,21 @@ declare const meta: {
|
|
|
141
141
|
};
|
|
142
142
|
};
|
|
143
143
|
};
|
|
144
|
+
allowMaxLength: {
|
|
145
|
+
control: "boolean";
|
|
146
|
+
description: string;
|
|
147
|
+
table: {
|
|
148
|
+
type: {
|
|
149
|
+
summary: string;
|
|
150
|
+
};
|
|
151
|
+
defaultValue: {
|
|
152
|
+
summary: string;
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
};
|
|
144
156
|
};
|
|
145
157
|
};
|
|
146
158
|
export default meta;
|
|
147
159
|
type Story = StoryObj<typeof meta>;
|
|
148
160
|
export declare const Default: Story;
|
|
161
|
+
export declare const WithMaxLength: Story;
|
|
@@ -111,6 +111,14 @@ const meta = {
|
|
|
111
111
|
type: { summary: 'ReactNode' },
|
|
112
112
|
},
|
|
113
113
|
},
|
|
114
|
+
allowMaxLength: {
|
|
115
|
+
control: 'boolean',
|
|
116
|
+
description: 'Whether to apply max length restriction',
|
|
117
|
+
table: {
|
|
118
|
+
type: { summary: 'boolean' },
|
|
119
|
+
defaultValue: { summary: 'false' },
|
|
120
|
+
},
|
|
121
|
+
},
|
|
114
122
|
},
|
|
115
123
|
};
|
|
116
124
|
export default meta;
|
|
@@ -118,6 +126,17 @@ export const Default = {
|
|
|
118
126
|
args: {
|
|
119
127
|
label: "Agent's name",
|
|
120
128
|
value: 'Anna',
|
|
121
|
-
onChange: () => { },
|
|
129
|
+
onChange: (_value) => { },
|
|
130
|
+
},
|
|
131
|
+
};
|
|
132
|
+
export const WithMaxLength = {
|
|
133
|
+
args: {
|
|
134
|
+
label: 'Limited Text Area',
|
|
135
|
+
value: '',
|
|
136
|
+
onChange: (_value) => { },
|
|
137
|
+
allowMaxLength: true,
|
|
138
|
+
maxLength: 100,
|
|
139
|
+
showMaxLengthIndicator: true,
|
|
140
|
+
placeholder: 'Enter text (max 100 characters)',
|
|
122
141
|
},
|
|
123
142
|
};
|
|
@@ -19,6 +19,8 @@ export type TextAreaProps = {
|
|
|
19
19
|
errorText?: string;
|
|
20
20
|
/** Text input disabled */
|
|
21
21
|
disabled?: boolean;
|
|
22
|
+
/** Whether to apply max length restriction */
|
|
23
|
+
allowMaxLength?: boolean;
|
|
22
24
|
/** Text input max length */
|
|
23
25
|
maxLength?: number;
|
|
24
26
|
/** Text input show max length indicator */
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { LayoutType } from './types';
|
|
4
|
+
import { Box } from '@mui/material';
|
|
5
|
+
import { ButtonDisplayMode, ButtonSize, MainButton } from '../Buttons';
|
|
6
|
+
import { ButtonHierarchy } from '../Buttons';
|
|
7
|
+
import { Typography, TypographySize, TypographyWeight } from '../Typography';
|
|
8
|
+
import { Badge, BadgeColor, BadgeSize } from '../UI';
|
|
9
|
+
import { AutoComplete } from '../Form/AutoComplete';
|
|
10
|
+
export const ComplexHeader = ({ title = 'Title', badgeText = '22', newButtonText = 'New', onNewClick, onOutputFileClick, onDownloadAllClick, onLayoutChange, className, sx, }) => {
|
|
11
|
+
const [layoutType, setLayoutType] = useState(LayoutType.Grid);
|
|
12
|
+
const handleLayoutChange = (type) => {
|
|
13
|
+
setLayoutType(type);
|
|
14
|
+
onLayoutChange?.(type);
|
|
15
|
+
};
|
|
16
|
+
return (_jsxs(Box, { className: className, display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', borderBottom: '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)', sx: sx, children: [_jsxs(Box, { display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-lg)', children: [_jsx(Typography, { text: title, size: TypographySize.HeadingS, weight: TypographyWeight.Bold, trailingElement: badgeText && (_jsx(Badge, { text: badgeText, size: BadgeSize.md, color: BadgeColor.Violet })), style: { gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-md)' } }), onNewClick && (_jsx(MainButton, { text: newButtonText, hierarchy: ButtonHierarchy.Secondary, size: ButtonSize.xs, showTrailingIcon: true, trailingIcon: 'Plus', onClick: onNewClick }))] }), _jsxs(Box, { display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-lg)', children: [_jsx(AutoComplete, { options: [], placeholder: "Search", onChange: () => { }, value: '' }), _jsx(MainButton, { text: 'Output File', hierarchy: ButtonHierarchy.SecondaryColor, size: ButtonSize.lg, showTrailingIcon: true, trailingIcon: 'DownloadSimple', onClick: onOutputFileClick }), _jsx(MainButton, { text: 'Download All', hierarchy: ButtonHierarchy.Primary, size: ButtonSize.lg, showTrailingIcon: true, trailingIcon: 'DownloadSimple', onClick: onDownloadAllClick }), _jsxs(Box, { display: 'flex', flexDirection: 'row', justifyContent: 'center', alignItems: 'center', children: [_jsx(MainButton, { hierarchy: layoutType === LayoutType.Grid
|
|
17
|
+
? ButtonHierarchy.TetriaryColor
|
|
18
|
+
: ButtonHierarchy.Tetriary, size: ButtonSize.sm, displayIconMode: ButtonDisplayMode.Only, displayIcon: "GridFour", onClick: () => handleLayoutChange(LayoutType.Grid) }), _jsx(MainButton, { hierarchy: layoutType === LayoutType.List
|
|
19
|
+
? ButtonHierarchy.TetriaryColor
|
|
20
|
+
: ButtonHierarchy.Tetriary, size: ButtonSize.sm, displayIconMode: ButtonDisplayMode.Only, displayIcon: "List", onClick: () => handleLayoutChange(LayoutType.List) })] })] })] }));
|
|
21
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import styles from './Header.module.css';
|
|
2
|
+
import { ComplexHeader } from './ComplexHeader';
|
|
3
|
+
const meta = {
|
|
4
|
+
title: 'Design System/Components/Navigation/ComplexHeader',
|
|
5
|
+
component: ComplexHeader,
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: 'centered',
|
|
8
|
+
design: {
|
|
9
|
+
type: 'figspec',
|
|
10
|
+
url: 'https://www.figma.com/design/mIhjz2yJjcpLlIqw6oUivt/Beyond-Presence?node-id=4781-5713&t=vdrrXyG9txidDmlc-1',
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
tags: ['autodocs'],
|
|
14
|
+
argTypes: {
|
|
15
|
+
title: {
|
|
16
|
+
control: 'text',
|
|
17
|
+
description: 'Title of the header',
|
|
18
|
+
table: {
|
|
19
|
+
type: { summary: 'string' },
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
badgeText: {
|
|
23
|
+
control: 'text',
|
|
24
|
+
description: 'Text of the badge',
|
|
25
|
+
table: {
|
|
26
|
+
type: { summary: 'string' },
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
newButtonText: {
|
|
30
|
+
control: 'text',
|
|
31
|
+
description: 'Text of the new button',
|
|
32
|
+
table: {
|
|
33
|
+
type: { summary: 'string' },
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
onNewClick: {
|
|
37
|
+
description: 'Callback function to handle new button click',
|
|
38
|
+
table: {
|
|
39
|
+
type: { summary: 'function' },
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
onOutputFileClick: {
|
|
43
|
+
description: 'Callback function to handle output file button click',
|
|
44
|
+
table: {
|
|
45
|
+
type: { summary: 'function' },
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
onDownloadAllClick: {
|
|
49
|
+
description: 'Callback function to handle download all button click',
|
|
50
|
+
table: {
|
|
51
|
+
type: { summary: 'function' },
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
onLayoutChange: {
|
|
55
|
+
description: 'Callback function to handle layout change',
|
|
56
|
+
table: {
|
|
57
|
+
type: { summary: 'function' },
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
className: {
|
|
61
|
+
control: 'text',
|
|
62
|
+
description: 'Custom class name for the header',
|
|
63
|
+
table: {
|
|
64
|
+
type: { summary: 'string' },
|
|
65
|
+
defaultValue: { summary: styles['responsive-width'] },
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
export default meta;
|
|
71
|
+
export const Default = {
|
|
72
|
+
args: {
|
|
73
|
+
title: 'Beyond Presence',
|
|
74
|
+
badgeText: '22',
|
|
75
|
+
newButtonText: 'New Agent',
|
|
76
|
+
onNewClick: () => { },
|
|
77
|
+
onOutputFileClick: () => { },
|
|
78
|
+
onDownloadAllClick: () => { },
|
|
79
|
+
onLayoutChange: () => { },
|
|
80
|
+
className: styles['responsive-width'],
|
|
81
|
+
},
|
|
82
|
+
};
|
|
@@ -20,6 +20,30 @@ export type HeaderProps = {
|
|
|
20
20
|
/** Callback function to handle logout button click */
|
|
21
21
|
onLogoutClick?: () => void;
|
|
22
22
|
};
|
|
23
|
+
export declare enum LayoutType {
|
|
24
|
+
List = "list",
|
|
25
|
+
Grid = "grid"
|
|
26
|
+
}
|
|
27
|
+
export type ComplexHeaderProps = {
|
|
28
|
+
/** Title of the header */
|
|
29
|
+
title: string;
|
|
30
|
+
/** Text of the badge */
|
|
31
|
+
badgeText?: string;
|
|
32
|
+
/** Text of the new button */
|
|
33
|
+
newButtonText?: string;
|
|
34
|
+
/** Callback function to handle new button click */
|
|
35
|
+
onNewClick?: () => void;
|
|
36
|
+
/** Callback function to handle output file button click */
|
|
37
|
+
onOutputFileClick?: () => void;
|
|
38
|
+
/** Callback function to handle download all button click */
|
|
39
|
+
onDownloadAllClick?: () => void;
|
|
40
|
+
/** CSS class name for additional styling */
|
|
41
|
+
className?: string;
|
|
42
|
+
/** Callback function to handle layout change */
|
|
43
|
+
onLayoutChange?: (layoutType: LayoutType) => void;
|
|
44
|
+
/** Style object to apply to the component */
|
|
45
|
+
sx?: SxProps<Theme>;
|
|
46
|
+
};
|
|
23
47
|
export declare enum NavItemState {
|
|
24
48
|
Default = "default",
|
|
25
49
|
Active = "active",
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { BadgeColor, BadgeSize } from './types';
|
|
3
|
+
import { Box } from '@mui/material';
|
|
4
|
+
import { Typography, TypographySize, TypographyWeight } from '../Typography';
|
|
5
|
+
import { Badge } from './Badge';
|
|
6
|
+
import { ButtonHierarchy, ButtonSize, MainButton } from '../Buttons';
|
|
7
|
+
export const Topbar = ({ title, badgeText, newButtonText, onNewButtonClick, className, style, }) => {
|
|
8
|
+
return (_jsxs(Box, { display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', paddingX: 'var(--spacing-tokens-size-in-px-spacing-md)', paddingY: 'var(--spacing-tokens-size-in-px-spacing-sm)', className: className, sx: style, minWidth: '400px', children: [_jsx(Typography, { text: title, size: TypographySize.HeadingS, weight: TypographyWeight.SemiBold, trailingElement: badgeText && (_jsx(Badge, { text: badgeText, size: BadgeSize.xs, color: BadgeColor.Violet, style: { marginBottom: '10px' } })), style: { gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-sm)' } }), _jsx(MainButton, { size: ButtonSize.lg, text: newButtonText, onClick: onNewButtonClick, hierarchy: ButtonHierarchy.Primary, trailingIcon: 'Plus', showTrailingIcon: true })] }));
|
|
9
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Topbar } from './Topbar';
|
|
2
|
+
const meta = {
|
|
3
|
+
title: 'Design System/Components/UI/Topbar',
|
|
4
|
+
component: Topbar,
|
|
5
|
+
parameters: {
|
|
6
|
+
layout: 'centered',
|
|
7
|
+
design: {
|
|
8
|
+
type: 'figspec',
|
|
9
|
+
url: 'https://www.figma.com/design/Ze4bBHgBQYinBDZr1COHuk/Agents?node-id=1006-13664&t=CyBQppCouqmiQpIk-1',
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
tags: ['autodocs'],
|
|
13
|
+
argTypes: {
|
|
14
|
+
title: {
|
|
15
|
+
control: 'text',
|
|
16
|
+
description: 'Title of the topbar',
|
|
17
|
+
table: {
|
|
18
|
+
type: { summary: 'string' },
|
|
19
|
+
defaultValue: { summary: 'undefined' },
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
badgeText: {
|
|
23
|
+
control: 'text',
|
|
24
|
+
description: 'Text of the badge',
|
|
25
|
+
table: {
|
|
26
|
+
type: { summary: 'string' },
|
|
27
|
+
defaultValue: { summary: 'undefined' },
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
newButtonText: {
|
|
31
|
+
control: 'text',
|
|
32
|
+
description: 'Text of the new button',
|
|
33
|
+
table: {
|
|
34
|
+
type: { summary: 'string' },
|
|
35
|
+
defaultValue: { summary: 'undefined' },
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
onNewButtonClick: {
|
|
39
|
+
description: 'Function to call when the new button is clicked',
|
|
40
|
+
table: {
|
|
41
|
+
type: { summary: 'function' },
|
|
42
|
+
defaultValue: { summary: 'undefined' },
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
style: {
|
|
46
|
+
control: 'object',
|
|
47
|
+
description: 'Style of the topbar',
|
|
48
|
+
table: {
|
|
49
|
+
type: { summary: 'object' },
|
|
50
|
+
defaultValue: { summary: 'undefined' },
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
className: {
|
|
54
|
+
control: 'text',
|
|
55
|
+
description: 'Class name of the topbar',
|
|
56
|
+
table: {
|
|
57
|
+
type: { summary: 'string' },
|
|
58
|
+
defaultValue: { summary: 'undefined' },
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
export default meta;
|
|
64
|
+
export const Default = {
|
|
65
|
+
args: {
|
|
66
|
+
title: 'My Agents',
|
|
67
|
+
badgeText: '10',
|
|
68
|
+
newButtonText: 'New Agent',
|
|
69
|
+
onNewButtonClick: () => { },
|
|
70
|
+
},
|
|
71
|
+
};
|
package/dist/stories/UI/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Theme } from '@mui/material';
|
|
2
|
-
import { SxProps } from '@mui/material';
|
|
1
|
+
import { Theme, SxProps } from '@mui/material';
|
|
3
2
|
import { IconName } from '../../utils';
|
|
4
3
|
/**
|
|
5
4
|
* Badge size variants
|
|
@@ -205,3 +204,17 @@ export interface SkeletonLoaderProps {
|
|
|
205
204
|
*/
|
|
206
205
|
style?: React.CSSProperties;
|
|
207
206
|
}
|
|
207
|
+
export interface TopbarProps {
|
|
208
|
+
/** Title */
|
|
209
|
+
title: string;
|
|
210
|
+
/** Badge */
|
|
211
|
+
badgeText?: string;
|
|
212
|
+
/** New button */
|
|
213
|
+
newButtonText?: string;
|
|
214
|
+
/** On click of new button */
|
|
215
|
+
onNewButtonClick?: () => void;
|
|
216
|
+
/** Style */
|
|
217
|
+
style?: SxProps<Theme>;
|
|
218
|
+
/** Class name */
|
|
219
|
+
className?: string;
|
|
220
|
+
}
|