@beydesign/storybook 0.0.88 → 0.0.91
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 +2 -0
- package/dist/stories/Agent/AgentCard.js +3 -2
- package/dist/stories/Buttons/MainButton.js +2 -2
- package/dist/stories/Buttons/types.d.ts +2 -0
- package/dist/stories/Form/TextInput.js +2 -2
- package/dist/stories/Form/TextInput.stories.d.ts +12 -0
- package/dist/stories/Form/TextInput.stories.js +26 -0
- package/dist/stories/Form/types.d.ts +3 -0
- package/dist/stories/UI/Menu.js +3 -3
- package/dist/stories/UI/types.d.ts +2 -0
- package/dist/utils/common.js +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
# BeyDesign Storybook
|
|
2
|
+
[](https://github.com/Beyond-Presence/bey-design-system/actions/workflows/lint.yml) [](https://github.com/Beyond-Presence/bey-design-system/actions/workflows/storybook.yml) [](https://github.com/Beyond-Presence/bey-design-system/actions/workflows/publish.yml)
|
|
3
|
+
|
|
2
4
|
|
|
3
5
|
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
6
|
|
|
@@ -16,6 +16,7 @@ export const AgentCard = ({ title, description = '', date = '', showDate = false
|
|
|
16
16
|
const isDraft = agentState === AgentState.pending;
|
|
17
17
|
const isProcessing = agentState === AgentState.processing;
|
|
18
18
|
const isReady = agentState === AgentState.ready;
|
|
19
|
+
const agentKey = title?.toLowerCase()?.replace(/\s+/g, '-');
|
|
19
20
|
// Handle image loading and errors
|
|
20
21
|
React.useEffect(() => {
|
|
21
22
|
if (!agentImage) {
|
|
@@ -55,7 +56,7 @@ export const AgentCard = ({ title, description = '', date = '', showDate = false
|
|
|
55
56
|
? 'var(--colors-light-background-bg-error-subtle)'
|
|
56
57
|
: isDraft
|
|
57
58
|
? 'var(--colors-light-background-bg-element)'
|
|
58
|
-
: 'var(--colors-light-background-bg-component)', boxShadow: `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)`, children: [_jsx("style", { children: `
|
|
59
|
+
: 'var(--colors-light-background-bg-component)', boxShadow: `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)`, "data-testid": `${agentKey}-parent`, children: [_jsx("style", { children: `
|
|
59
60
|
@keyframes spin {
|
|
60
61
|
0% { transform: rotate(0deg); }
|
|
61
62
|
100% { transform: rotate(360deg); }
|
|
@@ -78,7 +79,7 @@ export const AgentCard = ({ title, description = '', date = '', showDate = false
|
|
|
78
79
|
position: 'absolute',
|
|
79
80
|
right: '8px',
|
|
80
81
|
top: '8px',
|
|
81
|
-
} })), isReady && hovered && onPreview && active && (_jsx(Box, { position: 'absolute', top: '0', left: '0', width: '100%', height: '100%', bgcolor: 'var(--colors-light-background-bg-component-hover)', sx: { zIndex: 1 }, display: 'flex', justifyContent: 'center', alignItems: 'center', children: _jsx(MainButton, { text: previewButtonText, onClick: onPreview, showTrailingIcon: true, trailingIcon: "Play", hierarchy: ButtonHierarchy.SecondaryTransparent, size: ButtonSize.sm, style: { border: 'none' } }) })), isProcessing && (_jsxs(Box, { position: 'absolute', top: '0', left: '0', width: '100%', height: '100%', bgcolor: 'var(--colors-light-background-bg-component-hover)', style: { zIndex: 1 }, display: 'flex', flexDirection: 'column', justifyContent: 'center', alignItems: 'center', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-md)', children: [_jsx(ArrowsClockwise, { size: 24, color: 'var(--primitives-desktop-primary-white-100)', className: "spin-animation" }), _jsx(Typography, { size: TypographySize.TextS, weight: TypographyWeight.SemiBold, color: 'var(--primitives-desktop-primary-white-100)', children: processingText }), showProgressIndicator && (_jsx(ProgressIndicator, { mode: ProgressIndicatorMode.Percentage, currentValue: progressValue, maxValue: 100, textColor: 'var(--primitives-desktop-primary-white-100)' }))] })), isError && (_jsxs(Box, { position: 'absolute', top: '0', left: '0', width: '100%', height: '100%', bgcolor: 'var(--colors-light-background-bg-error-solid)', style: { zIndex: 1, opacity: 0.7 }, display: 'flex', flexDirection: 'column', justifyContent: 'center', alignItems: 'center', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-md)', children: [_jsx(Warning, { size: 74, color: 'var(--primitives-desktop-primary-white-100)' }), _jsx(Typography, { size: TypographySize.TextS, weight: TypographyWeight.SemiBold, color: 'var(--primitives-desktop-primary-white-100)', children: "Something went wrong" })] }))] }), _jsxs(Box, { display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', children: [_jsx(Typography, { size: TypographySize.HeadingXS, weight: TypographyWeight.SemiBold, textStyle: {
|
|
82
|
+
}, testKey: agentKey })), isReady && hovered && onPreview && active && (_jsx(Box, { position: 'absolute', top: '0', left: '0', width: '100%', height: '100%', bgcolor: 'var(--colors-light-background-bg-component-hover)', sx: { zIndex: 1 }, display: 'flex', justifyContent: 'center', alignItems: 'center', children: _jsx(MainButton, { text: previewButtonText, onClick: onPreview, showTrailingIcon: true, trailingIcon: "Play", hierarchy: ButtonHierarchy.SecondaryTransparent, size: ButtonSize.sm, style: { border: 'none' } }) })), isProcessing && (_jsxs(Box, { position: 'absolute', top: '0', left: '0', width: '100%', height: '100%', bgcolor: 'var(--colors-light-background-bg-component-hover)', style: { zIndex: 1 }, display: 'flex', flexDirection: 'column', justifyContent: 'center', alignItems: 'center', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-md)', children: [_jsx(ArrowsClockwise, { size: 24, color: 'var(--primitives-desktop-primary-white-100)', className: "spin-animation" }), _jsx(Typography, { size: TypographySize.TextS, weight: TypographyWeight.SemiBold, color: 'var(--primitives-desktop-primary-white-100)', children: processingText }), showProgressIndicator && (_jsx(ProgressIndicator, { mode: ProgressIndicatorMode.Percentage, currentValue: progressValue, maxValue: 100, textColor: 'var(--primitives-desktop-primary-white-100)' }))] })), isError && (_jsxs(Box, { position: 'absolute', top: '0', left: '0', width: '100%', height: '100%', bgcolor: 'var(--colors-light-background-bg-error-solid)', style: { zIndex: 1, opacity: 0.7 }, display: 'flex', flexDirection: 'column', justifyContent: 'center', alignItems: 'center', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-md)', children: [_jsx(Warning, { size: 74, color: 'var(--primitives-desktop-primary-white-100)' }), _jsx(Typography, { size: TypographySize.TextS, weight: TypographyWeight.SemiBold, color: 'var(--primitives-desktop-primary-white-100)', children: "Something went wrong" })] }))] }), _jsxs(Box, { display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', children: [_jsx(Typography, { size: TypographySize.HeadingXS, weight: TypographyWeight.SemiBold, textStyle: {
|
|
82
83
|
maxWidth: '140px',
|
|
83
84
|
overflow: 'hidden',
|
|
84
85
|
whiteSpace: 'nowrap',
|
|
@@ -199,7 +199,7 @@ const StyledButton = styled.button `
|
|
|
199
199
|
var(--global-shadows-shadow-xs-color);
|
|
200
200
|
}
|
|
201
201
|
`;
|
|
202
|
-
export const MainButton = ({ onClick, text, disabled = false, loading = false, type = ButtonType.Button, style, size = ButtonSize.xl, hierarchy = ButtonHierarchy.Primary, displayIcon, displayIconMode = ButtonDisplayMode.Default, state = ButtonState.Default, shape = ButtonShape.Square, destructive = false, showLeadingIcon = false, showTrailingIcon = false, leadingIcon = 'Circle', trailingIcon = 'Circle', }) => {
|
|
202
|
+
export const MainButton = ({ onClick, text, disabled = false, loading = false, type = ButtonType.Button, style, size = ButtonSize.xl, hierarchy = ButtonHierarchy.Primary, displayIcon, displayIconMode = ButtonDisplayMode.Default, state = ButtonState.Default, shape = ButtonShape.Square, destructive = false, showLeadingIcon = false, showTrailingIcon = false, leadingIcon = 'Circle', trailingIcon = 'Circle', testId, }) => {
|
|
203
203
|
const getIconSize = () => {
|
|
204
204
|
const sizes = {
|
|
205
205
|
[ButtonSize.xl]: 24,
|
|
@@ -298,5 +298,5 @@ export const MainButton = ({ onClick, text, disabled = false, loading = false, t
|
|
|
298
298
|
trailingIcon &&
|
|
299
299
|
getIconComponent(trailingIcon, iconProps)] }));
|
|
300
300
|
};
|
|
301
|
-
return (_jsx(StyledButton, { onClick: onClick, type: type, disabled: state === ButtonState.Disabled || disabled, "$size": size, "$hierarchy": hierarchy, "$state": state, "$shape": shape, "$destructive": destructive, "$disabled": disabled, "$displayIconMode": displayIconMode, "$sizeStyles": sizeStyles, style: style, children: renderContent() }));
|
|
301
|
+
return (_jsx(StyledButton, { onClick: onClick, type: type, disabled: state === ButtonState.Disabled || disabled, "$size": size, "$hierarchy": hierarchy, "$state": state, "$shape": shape, "$destructive": destructive, "$disabled": disabled, "$displayIconMode": displayIconMode, "$sizeStyles": sizeStyles, style: style, "data-testid": testId, children: renderContent() }));
|
|
302
302
|
};
|
|
@@ -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 TextInput = ({ label, value, onChange, placeholder, hintText, errorText, disabled, trailingText, style, hintBubbleText, hintBubbleProps, required, labelTrailingElement, labelContainerStyle, }) => {
|
|
6
|
+
export const TextInput = ({ label, value, onChange, placeholder, type = 'text', hintText, errorText, disabled, trailingText, style, hintBubbleText, hintBubbleProps, 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 && (_jsxs(Box, { display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'flex-start', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-sm)', sx: labelContainerStyle, children: [_jsx(Typography, { size: TypographySize.HeadingXS, weight: TypographyWeight.SemiBold, required: required, children: label }), labelTrailingElement] })), hintBubbleText && (_jsx(HintBubble, { text: hintBubbleText, size: HintBubbleSize.sm, ...hintBubbleProps })), _jsxs(Box, { display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', bgcolor: 'var(--colors-light-background-bg-component)', border: errorText
|
|
9
9
|
? 'none'
|
|
@@ -11,7 +11,7 @@ export const TextInput = ({ label, value, onChange, placeholder, hintText, error
|
|
|
11
11
|
? '1px solid var(--colors-light-border-border-error)'
|
|
12
12
|
: focused
|
|
13
13
|
? '1px solid var(--colors-light-border-border-component-active)'
|
|
14
|
-
: 'transparent'}`, children: _jsx("input", { type:
|
|
14
|
+
: 'transparent'}`, children: _jsx("input", { type: type, value: value, onChange: (e) => onChange(e.target.value), placeholder: placeholder, disabled: disabled, style: {
|
|
15
15
|
border: 'none',
|
|
16
16
|
outline: 'none',
|
|
17
17
|
width: '100%',
|
|
@@ -34,6 +34,16 @@ declare const meta: {
|
|
|
34
34
|
};
|
|
35
35
|
};
|
|
36
36
|
};
|
|
37
|
+
type: {
|
|
38
|
+
control: "select";
|
|
39
|
+
description: string;
|
|
40
|
+
options: string[];
|
|
41
|
+
table: {
|
|
42
|
+
type: {
|
|
43
|
+
summary: string;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
};
|
|
37
47
|
hintText: {
|
|
38
48
|
control: "text";
|
|
39
49
|
description: string;
|
|
@@ -128,3 +138,5 @@ declare const meta: {
|
|
|
128
138
|
export default meta;
|
|
129
139
|
type Story = StoryObj<typeof meta>;
|
|
130
140
|
export declare const Default: Story;
|
|
141
|
+
export declare const Password: Story;
|
|
142
|
+
export declare const Email: Story;
|
|
@@ -28,6 +28,14 @@ const meta = {
|
|
|
28
28
|
type: { summary: 'string' },
|
|
29
29
|
},
|
|
30
30
|
},
|
|
31
|
+
type: {
|
|
32
|
+
control: 'select',
|
|
33
|
+
description: 'The type of the text input',
|
|
34
|
+
options: ['text', 'password', 'email', 'number', 'tel', 'url'],
|
|
35
|
+
table: {
|
|
36
|
+
type: { summary: 'string' },
|
|
37
|
+
},
|
|
38
|
+
},
|
|
31
39
|
hintText: {
|
|
32
40
|
control: 'text',
|
|
33
41
|
description: 'The hint text of the text input',
|
|
@@ -108,3 +116,21 @@ export const Default = {
|
|
|
108
116
|
hintBubbleText: 'This is a hint bubble',
|
|
109
117
|
},
|
|
110
118
|
};
|
|
119
|
+
export const Password = {
|
|
120
|
+
args: {
|
|
121
|
+
label: 'Password',
|
|
122
|
+
value: 'password',
|
|
123
|
+
type: 'password',
|
|
124
|
+
onChange: () => { },
|
|
125
|
+
hintBubbleText: 'This is a hint bubble',
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
export const Email = {
|
|
129
|
+
args: {
|
|
130
|
+
label: 'Email',
|
|
131
|
+
value: 'email',
|
|
132
|
+
type: 'email',
|
|
133
|
+
onChange: () => { },
|
|
134
|
+
hintBubbleText: 'This is a hint bubble',
|
|
135
|
+
},
|
|
136
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { SxProps, Theme } from '@mui/material';
|
|
2
2
|
import { HintBubbleProps } from '../UI';
|
|
3
3
|
import { IconName } from '../../utils';
|
|
4
|
+
import React from 'react';
|
|
4
5
|
/**
|
|
5
6
|
* Text area component props
|
|
6
7
|
*/
|
|
@@ -52,6 +53,8 @@ export type TextInputProps = {
|
|
|
52
53
|
onChange: (value: string) => void;
|
|
53
54
|
/** Text input placeholder */
|
|
54
55
|
placeholder?: string;
|
|
56
|
+
/** Text input type */
|
|
57
|
+
type?: React.InputHTMLAttributes<HTMLInputElement>['type'];
|
|
55
58
|
/** Text input hint */
|
|
56
59
|
hintText?: string;
|
|
57
60
|
/** Text input error */
|
package/dist/stories/UI/Menu.js
CHANGED
|
@@ -4,7 +4,7 @@ import { Fragment, useState } from 'react';
|
|
|
4
4
|
import { MainButton, ButtonDisplayMode, ButtonHierarchy, ButtonType, } from '../Buttons';
|
|
5
5
|
import { Typography, TypographySize, TypographyWeight } from '../Typography';
|
|
6
6
|
import { getIconComponent } from '../../utils';
|
|
7
|
-
export const Menu = ({ icon = 'DotsThree', items, style, }) => {
|
|
7
|
+
export const Menu = ({ icon = 'DotsThree', items, style, testKey, }) => {
|
|
8
8
|
const [anchorEl, setAnchorEl] = useState(null);
|
|
9
9
|
const open = Boolean(anchorEl);
|
|
10
10
|
const handleClick = (event) => {
|
|
@@ -24,7 +24,7 @@ export const Menu = ({ icon = 'DotsThree', items, style, }) => {
|
|
|
24
24
|
return 'var(--colors-light-text-text-error)';
|
|
25
25
|
return 'var(--colors-light-text-text-title)';
|
|
26
26
|
};
|
|
27
|
-
return (_jsxs(Fragment, { children: [_jsx(MainButton, { displayIcon: icon, onClick: handleClick, type: ButtonType.Button, displayIconMode: ButtonDisplayMode.Only, hierarchy: ButtonHierarchy.Secondary, style: style }), _jsx(MuiMenu, { id: "basic-menu", anchorEl: anchorEl, open: open, onClose: handleClose, MenuListProps: {
|
|
27
|
+
return (_jsxs(Fragment, { children: [_jsx(MainButton, { displayIcon: icon, onClick: handleClick, type: ButtonType.Button, displayIconMode: ButtonDisplayMode.Only, hierarchy: ButtonHierarchy.Secondary, style: style, testId: `${testKey}-menu-button` }), _jsx(MuiMenu, { id: "basic-menu", "data-testid": `${testKey}-menu`, anchorEl: anchorEl, open: open, onClose: handleClose, MenuListProps: {
|
|
28
28
|
'aria-labelledby': 'basic-button',
|
|
29
29
|
style: {
|
|
30
30
|
padding: 'var(--spacing-tokens-size-in-px-spacing-spacing-xs)',
|
|
@@ -38,7 +38,7 @@ export const Menu = ({ icon = 'DotsThree', items, style, }) => {
|
|
|
38
38
|
root: { style: { gap: '4px' } },
|
|
39
39
|
}, children: items?.map((action, index) => {
|
|
40
40
|
if (action) {
|
|
41
|
-
return (_jsxs(MuiMenuItem, { onClick: (e) => handleMenuItemClick(action, e), sx: { gap: '8px' }, disableRipple: true, children: [action?.icon &&
|
|
41
|
+
return (_jsxs(MuiMenuItem, { onClick: (e) => handleMenuItemClick(action, e), sx: { gap: '8px' }, disableRipple: true, "data-testid": `${testKey}-menu-item-${index}`, children: [action?.icon &&
|
|
42
42
|
getIconComponent(action.icon, {
|
|
43
43
|
width: '20px',
|
|
44
44
|
height: '20px',
|
package/dist/utils/common.js
CHANGED