@beydesign/storybook 0.4.0 → 0.4.2
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.
|
@@ -32,7 +32,7 @@ export const EntityCard = ({ view = 'avatar', name, image, description = '', sho
|
|
|
32
32
|
const imageAspectRatio = aspectRatio ?? ASPECT_RATIO_BY_VIEW[view];
|
|
33
33
|
const entityKey = name?.toLowerCase()?.replace(/\s+/g, '-');
|
|
34
34
|
const hasMenu = showMenu && menuItems.length > 0;
|
|
35
|
-
const isProcessing =
|
|
35
|
+
const isProcessing = processing && !error;
|
|
36
36
|
const canPreview = !!onPreview && !isProcessing && !error;
|
|
37
37
|
const showActions = hovered && (canPreview || hasMenu);
|
|
38
38
|
const showBadge = showStatusBadge && !!statusBadgeText;
|
|
@@ -45,7 +45,7 @@ export const EntityCard = ({ view = 'avatar', name, image, description = '', sho
|
|
|
45
45
|
opacity: hovered && !isProcessing && !error ? 1 : 0,
|
|
46
46
|
transition: 'opacity 0.15s ease-in-out',
|
|
47
47
|
pointerEvents: 'none',
|
|
48
|
-
} }), isProcessing && (_jsxs(Box, { position: 'absolute', top: 0, left: 0, right: 0, bottom: 0, display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-md)', bgcolor: 'var(--color-background-bg-overlay-2)', sx: { zIndex: 1 }, children: [_jsx(Spinner, {}), _jsx(Typography, { size: TypographySize.TextS, weight: TypographyWeight.SemiBold, color: 'var(--color-text-text-white)', children: processingText })] })), error && (_jsxs(Box, { position: 'absolute', top: 0, left: 0, right: 0, bottom: 0, display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-md)', bgcolor: 'var(--color-background-bg-error-solid)', sx: { zIndex: 3, opacity: 0.7 }, children: [_jsx(Warning, { size: 74, color: 'var(--color-text-text-white)' }), _jsx(Typography, { size: TypographySize.TextS, weight: TypographyWeight.SemiBold, color: 'var(--color-text-text-white)', children: errorText })] })), showBadge && (_jsx(Box, { position: 'absolute', top: 'var(--spacing-tokens-size-in-px-spacing-spacing-md)', left: 'var(--spacing-tokens-size-in-px-spacing-spacing-md)', sx: { zIndex: 2 }, children: _jsx(Badge, { text: statusBadgeText, color: statusBadgeColor, size: BadgeSize.md, showIcon: true, icon: 'Circle', iconWeight: 'fill', iconSize: 'var(--spacing-tokens-size-in-px-spacing-spacing-md)'
|
|
48
|
+
} }), isProcessing && (_jsxs(Box, { position: 'absolute', top: 0, left: 0, right: 0, bottom: 0, display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-md)', bgcolor: 'var(--color-background-bg-overlay-2)', sx: { zIndex: 1 }, children: [_jsx(Spinner, {}), _jsx(Typography, { size: TypographySize.TextS, weight: TypographyWeight.SemiBold, color: 'var(--color-text-text-white)', children: processingText })] })), error && (_jsxs(Box, { position: 'absolute', top: 0, left: 0, right: 0, bottom: 0, display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-md)', bgcolor: 'var(--color-background-bg-error-solid)', sx: { zIndex: 3, opacity: 0.7 }, children: [_jsx(Warning, { size: 74, color: 'var(--color-text-text-white)' }), _jsx(Typography, { size: TypographySize.TextS, weight: TypographyWeight.SemiBold, color: 'var(--color-text-text-white)', children: errorText })] })), showBadge && (_jsx(Box, { position: 'absolute', top: 'var(--spacing-tokens-size-in-px-spacing-spacing-md)', left: 'var(--spacing-tokens-size-in-px-spacing-spacing-md)', sx: { zIndex: 2 }, children: _jsx(Badge, { text: statusBadgeText, color: statusBadgeColor, size: BadgeSize.md, showIcon: true, icon: 'Circle', iconWeight: 'fill', iconSize: 'var(--spacing-tokens-size-in-px-spacing-spacing-md)' }) })), showActions && (_jsxs(Box, { position: 'absolute', top: 'var(--spacing-tokens-size-in-px-spacing-spacing-md)', right: 'var(--spacing-tokens-size-in-px-spacing-spacing-md)', display: 'flex', flexDirection: 'row', alignItems: 'center', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-md)', sx: { zIndex: 4 }, children: [canPreview &&
|
|
49
49
|
(previewButtonText ? (_jsx(MainButton, { text: previewButtonText, showLeadingIcon: true, leadingIcon: previewIcon, iconWeight: 'fill', hierarchy: ButtonHierarchy.SecondaryTransparent, size: ButtonSize.sm, onClick: onPreview, testId: `${entityKey}-preview-button` })) : (_jsx(MainButton, { displayIcon: previewIcon, displayIconMode: ButtonDisplayMode.Only, hierarchy: ButtonHierarchy.SecondaryTransparent, size: ButtonSize.sm, onClick: onPreview, testId: `${entityKey}-preview-button` }))), hasMenu && (_jsx(Menu, { items: menuItems, testKey: entityKey, size: ButtonSize.sm }))] })), isVideo ? (_jsxs(Box, { position: 'absolute', left: 0, right: 0, bottom: 0, display: 'flex', flexDirection: 'row', alignItems: 'flex-end', justifyContent: 'space-between', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-md)', padding: 'var(--spacing-tokens-size-in-px-spacing-spacing-3xl) var(--spacing-tokens-size-in-px-spacing-spacing-lg) var(--spacing-tokens-size-in-px-spacing-spacing-lg)', sx: {
|
|
50
50
|
zIndex: 2,
|
|
51
51
|
pointerEvents: 'none',
|
|
@@ -56,7 +56,7 @@ const meta = {
|
|
|
56
56
|
},
|
|
57
57
|
processing: {
|
|
58
58
|
control: 'boolean',
|
|
59
|
-
description: 'Show the processing overlay (spinner + label)
|
|
59
|
+
description: 'Show the processing overlay (spinner + label)',
|
|
60
60
|
table: { type: { summary: 'boolean' } },
|
|
61
61
|
},
|
|
62
62
|
processingText: {
|
|
@@ -326,3 +326,17 @@ export const VideoError = {
|
|
|
326
326
|
},
|
|
327
327
|
},
|
|
328
328
|
};
|
|
329
|
+
export const Processing = {
|
|
330
|
+
args: {
|
|
331
|
+
...Default.args,
|
|
332
|
+
name: 'Nelly',
|
|
333
|
+
processing: true,
|
|
334
|
+
},
|
|
335
|
+
parameters: {
|
|
336
|
+
docs: {
|
|
337
|
+
description: {
|
|
338
|
+
story: 'A processing overlay (spinner + label) covers the image while the preview action is suppressed. The menu stays accessible. Works across every view.',
|
|
339
|
+
},
|
|
340
|
+
},
|
|
341
|
+
},
|
|
342
|
+
};
|
|
@@ -25,7 +25,7 @@ export interface EntityCardProps {
|
|
|
25
25
|
date?: string;
|
|
26
26
|
/** Aspect ratio of the image — overrides the per-view default (`203 / 264` avatar, `1 / 1` agent, `16 / 9` video) */
|
|
27
27
|
aspectRatio?: string;
|
|
28
|
-
/** Show the processing overlay (spinner + label) over the image
|
|
28
|
+
/** Show the processing overlay (spinner + label) over the image */
|
|
29
29
|
processing?: boolean;
|
|
30
30
|
/** Processing overlay label. Defaults to "Please wait" */
|
|
31
31
|
processingText?: string;
|