@beydesign/storybook 0.0.81 → 0.0.83

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.
@@ -8,7 +8,7 @@ import { Badge, ProgressIndicator, ProgressIndicatorMode, BadgeColor, BadgeSize,
8
8
  import { MainButton, ButtonHierarchy, ButtonSize } from '../Buttons';
9
9
  import { ArrowsClockwise, Warning } from '@phosphor-icons/react';
10
10
  import { getIconComponent } from '../../utils';
11
- 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 = '', showProgressIndicator = false, progressValue = 50, processingText = 'Creation in progress', agentId = '', }) => {
11
+ 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 = '', showProgressIndicator = false, progressValue = 50, processingText = 'Creation in progress', agentId = '', onClickAgentId, }) => {
12
12
  const [hovered, setHovered] = useState(false);
13
13
  const [imageError, setImageError] = useState(false);
14
14
  const [isLoading, setIsLoading] = useState(!!agentImage);
@@ -41,9 +41,6 @@ export const AgentCard = ({ title, description = '', date = '', showDate = false
41
41
  img.onerror = null;
42
42
  };
43
43
  }, [agentImage]);
44
- const copyToClipboard = (text) => {
45
- navigator.clipboard.writeText(text);
46
- };
47
44
  // Render loading state or placeholder
48
45
  const renderImageContent = () => {
49
46
  if (isLoading) {
@@ -91,12 +88,13 @@ export const AgentCard = ({ title, description = '', date = '', showDate = false
91
88
  overflow: 'hidden',
92
89
  whiteSpace: 'nowrap',
93
90
  textOverflow: 'ellipsis',
94
- }, title: agentId, children: ["ID ", agentId] }), getIconComponent('Copy', {
95
- width: '20px',
96
- height: '20px',
97
- weight: 'bold',
98
- color: 'var(--colors-light-text-text-accent)',
99
- style: { cursor: 'pointer' },
100
- onClick: () => copyToClipboard(agentId),
101
- })] }))] }), (showDate || showActiveToggle) && (_jsxs(Box, { display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', children: [showDate && (_jsx(Typography, { size: TypographySize.TextS, weight: TypographyWeight.Regular, color: 'var(--colors-light-text-text-subtle)', children: date })), 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, { size: TypographySize.TextS, weight: TypographyWeight.Regular, color: 'var(--colors-light-text-text-paragraph)', children: description }))] }));
91
+ }, title: agentId, children: ["ID ", agentId] }), onClickAgentId &&
92
+ getIconComponent('Copy', {
93
+ width: '20px',
94
+ height: '20px',
95
+ weight: 'bold',
96
+ color: 'var(--colors-light-text-text-accent)',
97
+ style: { cursor: 'pointer' },
98
+ onClick: () => onClickAgentId(agentId),
99
+ })] }))] }), (showDate || showActiveToggle) && (_jsxs(Box, { display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', children: [showDate && (_jsx(Typography, { size: TypographySize.TextS, weight: TypographyWeight.Regular, color: 'var(--colors-light-text-text-subtle)', children: date })), 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, { size: TypographySize.TextS, weight: TypographyWeight.Regular, color: 'var(--colors-light-text-text-paragraph)', children: description }))] }));
102
100
  };
@@ -197,6 +197,7 @@ export const Placeholder = {
197
197
  showStatusBadge: true,
198
198
  statusBadgeText: 'Active',
199
199
  agentId: '112657154',
200
+ onClickAgentId: () => { },
200
201
  },
201
202
  };
202
203
  export const CustomPreviewText = {
@@ -10,7 +10,9 @@ export declare enum AgentState {
10
10
  */
11
11
  export type AgentCardProps = {
12
12
  /** Agent id */
13
- agentId: string;
13
+ agentId?: string;
14
+ /** On click agent id */
15
+ onClickAgentId?: (agentId: string) => void;
14
16
  /** Agent image */
15
17
  agentImage?: string;
16
18
  /** Show date */
@@ -5,6 +5,8 @@ import { Typography, TypographySize, TypographyWeight } from '../Typography';
5
5
  export const ProgressIndicator = ({ mode = ProgressIndicatorMode.Value, currentValue = 40, maxValue = 100, fillColor = 'var(--colors-light-background-bg-brand)', backgroundColor = 'var(--colors-light-background-bg-white)', text = 'used', textColor = 'var(--colors-light-text-text-primary)', style, }) => {
6
6
  let errorText = '';
7
7
  const calculateFill = () => {
8
+ if (currentValue > maxValue)
9
+ return 100;
8
10
  return (currentValue / maxValue) * 100;
9
11
  };
10
12
  if (isNaN(currentValue) || !isFinite(currentValue)) {
@@ -16,13 +18,13 @@ export const ProgressIndicator = ({ mode = ProgressIndicatorMode.Value, currentV
16
18
  else if (currentValue < 0) {
17
19
  errorText = 'Invalid current value';
18
20
  }
19
- else if (currentValue > maxValue) {
20
- errorText = 'Current value is greater than max value';
21
- }
22
21
  else if (mode === ProgressIndicatorMode.Percentage) {
23
22
  if (maxValue > 100 || maxValue < 0) {
24
23
  errorText = 'Invalid max value for percentage mode';
25
24
  }
25
+ else if (currentValue > maxValue) {
26
+ errorText = 'Current value is greater than max value for percentage mode';
27
+ }
26
28
  }
27
29
  if (errorText) {
28
30
  return (_jsx(Typography, { size: TypographySize.TextXS, weight: TypographyWeight.Regular, children: errorText }));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@beydesign/storybook",
3
3
  "private": false,
4
- "version": "0.0.81",
4
+ "version": "0.0.83",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",