@beydesign/storybook 0.0.42 → 0.0.43

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.
@@ -6,12 +6,12 @@ import { Typography, TypographySize, TypographyWeight } from '../Typography';
6
6
  import { Toggle, TogglePosition } from '../Form';
7
7
  import { Badge, ProgressIndicator, ProgressIndicatorMode, BadgeColor, BadgeSize, Menu, } from '../UI';
8
8
  import { MainButton, ButtonHierarchy, ButtonSize } from '../Buttons';
9
- import { ArrowsCounterClockwise } from '@phosphor-icons/react';
10
- export const AgentCard = ({ title, description = '', date = '', showDate = false, badges = [], showBadges = false, showTimeBadge = false, showDescription = false, showMenu = false, menuItems = [], active = false, showActiveToggle = false, onActiveToggleChange, activeToggleDisabled = false, agentImage, time, onPreview, agentState, previewButtonText = 'Preview', }) => {
9
+ import { ArrowsCounterClockwise, Warning } from '@phosphor-icons/react';
10
+ export const AgentCard = ({ title, description = '', date = '', showDate = false, badges = [], showBadges = false, showTimeBadge = false, showDescription = false, showMenu = false, menuItems = [], active = false, showActiveToggle = false, onActiveToggleChange, activeToggleDisabled = false, agentImage, time, onPreview, agentState, previewButtonText = 'Preview', showStatusBadge = false, statusBadgeText = '', }) => {
11
11
  const [hovered, setHovered] = useState(false);
12
12
  const [imageError, setImageError] = useState(false);
13
13
  const [isLoading, setIsLoading] = useState(!!agentImage);
14
- // const isError = agentState === AgentState.error;
14
+ const isError = agentState === AgentState.error;
15
15
  const isDraft = agentState === AgentState.pending;
16
16
  const isProcessing = agentState === AgentState.processing;
17
17
  const isReady = agentState === AgentState.ready;
@@ -59,17 +59,24 @@ export const AgentCard = ({ title, description = '', date = '', showDate = false
59
59
  }
60
60
  return (_jsx("img", { src: agentImage, alt: "Agent", width: '100%', height: '100%', style: { objectFit: 'cover', height: '100%', width: '100%' } }));
61
61
  };
62
- return (_jsxs(Box, { width: '300px', display: 'flex', flexDirection: 'column', borderRadius: 'var(--spacing-tokens-size-in-px-spacing-spacing-md)', padding: 'var(--spacing-tokens-size-in-px-spacing-spacing-xl)', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-lg)', bgcolor: isDraft
63
- ? 'var(--colors-light-background-bg-element)'
64
- : '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: [_jsxs(Box, { display: 'flex', justifyContent: 'center', alignItems: 'center', position: 'relative', width: '100%', sx: { aspectRatio: 1 }, borderRadius: 'var(--spacing-tokens-size-in-px-spacing-spacing-sm)', overflow: 'hidden', onMouseEnter: () => setHovered(true), onMouseLeave: () => setHovered(false), children: [renderImageContent(), showTimeBadge && time && (_jsx(Badge, { text: time, size: BadgeSize.md, fill: true, style: {
62
+ return (_jsxs(Box, { width: '300px', display: 'flex', flexDirection: 'column', borderRadius: 'var(--spacing-tokens-size-in-px-spacing-spacing-md)', padding: 'var(--spacing-tokens-size-in-px-spacing-spacing-xl)', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-lg)', bgcolor: isError
63
+ ? 'var(--colors-light-background-bg-error-subtle)'
64
+ : isDraft
65
+ ? 'var(--colors-light-background-bg-element)'
66
+ : '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: [_jsxs(Box, { display: 'flex', justifyContent: 'center', alignItems: 'center', position: 'relative', sx: { aspectRatio: 1 }, borderRadius: 'var(--spacing-tokens-size-in-px-spacing-spacing-sm)', overflow: 'hidden', onMouseEnter: () => setHovered(true), onMouseLeave: () => setHovered(false), children: [renderImageContent(), showTimeBadge && time && (_jsx(Badge, { text: time, size: BadgeSize.md, fill: true, style: {
65
67
  position: 'absolute',
66
68
  right: '8px',
67
69
  bottom: '8px',
68
70
  zIndex: 2,
69
- }, color: BadgeColor.Violet })), showMenu && menuItems.length > 0 && (_jsx(Menu, { items: menuItems, style: {
71
+ }, color: BadgeColor.Violet })), showStatusBadge && statusBadgeText && (_jsx(Badge, { text: statusBadgeText, size: BadgeSize.md, fill: true, style: {
72
+ position: 'absolute',
73
+ left: '8px',
74
+ top: '8px',
75
+ zIndex: 2,
76
+ }, color: BadgeColor.Blue })), showMenu && menuItems.length > 0 && (_jsx(Menu, { items: menuItems, style: {
70
77
  zIndex: 2,
71
78
  position: 'absolute',
72
79
  right: '8px',
73
80
  top: '8px',
74
- } })), isReady && hovered && onPreview && (_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(ArrowsCounterClockwise, { size: 24, weight: "bold", color: 'var(--primitives-desktop-primary-white-100)' }), _jsx(Typography, { text: "Agent creation in progress", size: TypographySize.TextS, weight: TypographyWeight.SemiBold, color: 'var(--primitives-desktop-primary-white-100)' }), _jsx(ProgressIndicator, { mode: ProgressIndicatorMode.Percentage, currentValue: 50, maxValue: 100, textColor: 'var(--primitives-desktop-primary-white-100)' })] }))] }), _jsx(Typography, { text: title, size: TypographySize.HeadingXS, weight: TypographyWeight.SemiBold }), (showDate || showActiveToggle) && (_jsxs(Box, { display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', children: [showDate && (_jsx(Typography, { text: date, size: TypographySize.TextS, weight: TypographyWeight.Regular, color: 'var(--colors-light-text-text-subtle)', style: { flex: 1 } })), showActiveToggle && (_jsx(Toggle, { checked: active, onChange: (checked) => onActiveToggleChange?.(checked), disabled: activeToggleDisabled, text: "Active", togglePosition: TogglePosition.Right, style: { flex: 1 } }))] })), showBadges && (_jsx(Box, { display: 'flex', flexDirection: 'row', flexWrap: 'wrap', alignItems: 'center', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-lg)', children: badges.map((badge, index) => (_jsx(Badge, { text: badge, size: BadgeSize.lg, fill: true }, `badge-${index}-${badge}`))) })), showDescription && (_jsx(Typography, { text: description, size: TypographySize.TextS, weight: TypographyWeight.Regular, color: 'var(--colors-light-text-text-paragraph)' }))] }));
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(ArrowsCounterClockwise, { size: 24, weight: "bold", color: 'var(--primitives-desktop-primary-white-100)' }), _jsx(Typography, { text: "Agent creation in progress", size: TypographySize.TextS, weight: TypographyWeight.SemiBold, color: 'var(--primitives-desktop-primary-white-100)' }), _jsx(ProgressIndicator, { mode: ProgressIndicatorMode.Percentage, currentValue: 50, 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, { text: "Something went wrong", size: TypographySize.TextS, weight: TypographyWeight.SemiBold, color: 'var(--primitives-desktop-primary-white-100)' })] }))] }), _jsx(Typography, { text: title, size: TypographySize.HeadingXS, weight: TypographyWeight.SemiBold }), (showDate || showActiveToggle) && (_jsxs(Box, { display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', children: [showDate && (_jsx(Typography, { text: date, size: TypographySize.TextS, weight: TypographyWeight.Regular, color: 'var(--colors-light-text-text-subtle)', style: { flex: 1 } })), showActiveToggle && (_jsx(Toggle, { checked: active, onChange: (checked) => onActiveToggleChange?.(checked), disabled: activeToggleDisabled, text: "Active", togglePosition: TogglePosition.Right, style: { flex: 1 } }))] })), showBadges && (_jsx(Box, { display: 'flex', flexDirection: 'row', flexWrap: 'wrap', alignItems: 'center', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-lg)', children: badges.map((badge, index) => (_jsx(Badge, { text: badge, size: BadgeSize.lg, fill: true }, `badge-${index}-${badge}`))) })), showDescription && (_jsx(Typography, { text: description, size: TypographySize.TextS, weight: TypographyWeight.Regular, color: 'var(--colors-light-text-text-paragraph)' }))] }));
75
82
  };
@@ -7,3 +7,5 @@ export declare const Placeholder: Story;
7
7
  export declare const CustomPreviewText: Story;
8
8
  export declare const LoadingPreview: Story;
9
9
  export declare const NoImage: Story;
10
+ export declare const WithStatusBadge: Story;
11
+ export declare const NoStatusBadge: Story;
@@ -124,6 +124,20 @@ const meta = {
124
124
  defaultValue: { summary: 'Preview' },
125
125
  },
126
126
  },
127
+ showStatusBadge: {
128
+ control: 'boolean',
129
+ description: 'Whether to show the status badge',
130
+ table: {
131
+ type: { summary: 'boolean' },
132
+ },
133
+ },
134
+ statusBadgeText: {
135
+ control: 'text',
136
+ description: 'Text to display in the status badge',
137
+ table: {
138
+ type: { summary: 'string' },
139
+ },
140
+ },
127
141
  },
128
142
  };
129
143
  export default meta;
@@ -149,6 +163,8 @@ export const Placeholder = {
149
163
  ],
150
164
  showMenu: true,
151
165
  agentState: AgentState.ready,
166
+ showStatusBadge: true,
167
+ statusBadgeText: 'Active',
152
168
  },
153
169
  };
154
170
  export const CustomPreviewText = {
@@ -164,6 +180,7 @@ export const LoadingPreview = {
164
180
  title: 'Loading Preview Example',
165
181
  // Using a non-existent image to force loading state
166
182
  agentImage: 'https://example.com/non-existent-image.jpg',
183
+ active: false,
167
184
  },
168
185
  parameters: {
169
186
  docs: {
@@ -187,3 +204,34 @@ export const NoImage = {
187
204
  },
188
205
  },
189
206
  };
207
+ export const WithStatusBadge = {
208
+ args: {
209
+ ...Placeholder.args,
210
+ title: 'Status Badge Example',
211
+ showStatusBadge: true,
212
+ statusBadgeText: 'Draft',
213
+ agentState: AgentState.pending,
214
+ },
215
+ parameters: {
216
+ docs: {
217
+ description: {
218
+ story: 'This example demonstrates the agent card with a status badge in the top-left corner.',
219
+ },
220
+ },
221
+ },
222
+ };
223
+ export const NoStatusBadge = {
224
+ args: {
225
+ ...Placeholder.args,
226
+ title: 'No Status Badge Example',
227
+ showStatusBadge: false,
228
+ statusBadgeText: '',
229
+ },
230
+ parameters: {
231
+ docs: {
232
+ description: {
233
+ story: 'This example demonstrates the agent card without a status badge.',
234
+ },
235
+ },
236
+ },
237
+ };
@@ -47,6 +47,10 @@ export type AgentCardProps = {
47
47
  agentState?: AgentState;
48
48
  /** Preview button text */
49
49
  previewButtonText?: string;
50
+ /** Show status badge */
51
+ showStatusBadge?: boolean;
52
+ /** Status badge text */
53
+ statusBadgeText?: string;
50
54
  };
51
55
  export interface AgentCardSkeletonProps {
52
56
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@beydesign/storybook",
3
3
  "private": false,
4
- "version": "0.0.42",
4
+ "version": "0.0.43",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",