@beydesign/storybook 0.0.1 → 0.0.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.
- package/README.md +60 -40
- package/dist/App.js +161 -5
- package/dist/assets/animations/loading-animation.json +1 -0
- package/dist/index.d.ts +12 -2
- package/dist/index.js +12 -4
- package/dist/stories/Agent/AgentCard.d.ts +3 -0
- package/dist/stories/Agent/AgentCard.js +102 -0
- package/dist/stories/Agent/AgentCard.stories.d.ts +13 -0
- package/dist/stories/Agent/AgentCard.stories.js +303 -0
- package/dist/stories/Agent/AgentCardSkeleton.d.ts +2 -0
- package/dist/stories/Agent/AgentCardSkeleton.js +6 -0
- package/dist/stories/Agent/AgentCardSkeleton.stories.d.ts +13 -0
- package/dist/stories/Agent/AgentCardSkeleton.stories.js +101 -0
- package/dist/stories/Agent/CreateNewCard.d.ts +7 -0
- package/dist/stories/Agent/CreateNewCard.js +25 -0
- package/dist/stories/Agent/CreateNewCard.stories.d.ts +7 -0
- package/dist/stories/Agent/CreateNewCard.stories.js +23 -0
- package/dist/stories/Agent/index.d.ts +4 -0
- package/dist/stories/Agent/index.js +4 -0
- package/dist/stories/Agent/types.d.ts +96 -0
- package/dist/stories/Agent/types.js +7 -0
- package/dist/stories/Buttons/MainButton.d.ts +3 -0
- package/dist/stories/Buttons/MainButton.js +302 -0
- package/dist/stories/Buttons/MainButton.stories.d.ts +28 -0
- package/dist/stories/Buttons/MainButton.stories.js +299 -0
- package/dist/stories/Buttons/ToggleButtonGroup.d.ts +3 -0
- package/dist/stories/Buttons/ToggleButtonGroup.js +34 -0
- package/dist/stories/Buttons/ToggleButtonGroup.stories.d.ts +9 -0
- package/dist/stories/Buttons/ToggleButtonGroup.stories.js +78 -0
- package/dist/stories/Buttons/index.d.ts +3 -0
- package/dist/stories/Buttons/index.js +3 -0
- package/dist/stories/{types/button.d.ts → Buttons/types.d.ts} +37 -14
- package/dist/stories/{types/button.js → Buttons/types.js} +12 -2
- package/dist/stories/Credits/CreditsCard.d.ts +3 -0
- package/dist/stories/Credits/CreditsCard.js +53 -0
- package/dist/stories/Credits/CreditsCard.stories.d.ts +7 -0
- package/dist/stories/Credits/CreditsCard.stories.js +34 -0
- package/dist/stories/Credits/CreditsCardSkeleton.d.ts +3 -0
- package/dist/stories/Credits/CreditsCardSkeleton.js +30 -0
- package/dist/stories/Credits/CreditsCardSkeleton.stories.d.ts +7 -0
- package/dist/stories/Credits/CreditsCardSkeleton.stories.js +40 -0
- package/dist/stories/Credits/index.d.ts +3 -0
- package/dist/stories/Credits/index.js +3 -0
- package/dist/stories/Credits/types.d.ts +57 -0
- package/dist/stories/Credits/types.js +11 -0
- package/dist/stories/EntityCard/EntityCard.d.ts +3 -0
- package/dist/stories/EntityCard/EntityCard.js +22 -0
- package/dist/stories/EntityCard/EntityCard.stories.d.ts +10 -0
- package/dist/stories/EntityCard/EntityCard.stories.js +187 -0
- package/dist/stories/EntityCard/EntityCardSkeleton.d.ts +3 -0
- package/dist/stories/EntityCard/EntityCardSkeleton.js +9 -0
- package/dist/stories/EntityCard/EntityCardSkeleton.stories.d.ts +10 -0
- package/dist/stories/EntityCard/EntityCardSkeleton.stories.js +73 -0
- package/dist/stories/EntityCard/index.d.ts +3 -0
- package/dist/stories/EntityCard/index.js +3 -0
- package/dist/stories/EntityCard/types.d.ts +54 -0
- package/dist/stories/EntityCard/types.js +1 -0
- package/dist/stories/Form/AutoComplete.d.ts +3 -0
- package/dist/stories/Form/AutoComplete.js +163 -0
- package/dist/stories/Form/AutoComplete.stories.d.ts +6 -0
- package/dist/stories/Form/AutoComplete.stories.js +88 -0
- package/dist/stories/Form/Checkbox.d.ts +3 -0
- package/dist/stories/Form/Checkbox.js +65 -0
- package/dist/stories/Form/Checkbox.stories.d.ts +13 -0
- package/dist/stories/Form/Checkbox.stories.js +121 -0
- package/dist/stories/Form/Dropdown.d.ts +3 -0
- package/dist/stories/Form/Dropdown.js +183 -0
- package/dist/stories/Form/Dropdown.stories.d.ts +6 -0
- package/dist/stories/Form/Dropdown.stories.js +122 -0
- package/dist/stories/Form/FileUpload/FileUpload.d.ts +3 -0
- package/dist/stories/Form/FileUpload/FileUpload.js +128 -0
- package/dist/stories/Form/FileUpload/FileUpload.stories.d.ts +7 -0
- package/dist/stories/Form/FileUpload/FileUpload.stories.js +51 -0
- package/dist/stories/Form/FileUpload/FileUploading.d.ts +3 -0
- package/dist/stories/Form/FileUpload/FileUploading.js +49 -0
- package/dist/stories/Form/FileUpload/FileUploading.stories.d.ts +10 -0
- package/dist/stories/Form/FileUpload/FileUploading.stories.js +108 -0
- package/dist/stories/Form/FileUpload/UploadedFile.d.ts +3 -0
- package/dist/stories/Form/FileUpload/UploadedFile.js +12 -0
- package/dist/stories/Form/FileUpload/UploadedFile.stories.d.ts +7 -0
- package/dist/stories/Form/FileUpload/UploadedFile.stories.js +73 -0
- package/dist/stories/Form/FileUpload/index.d.ts +3 -0
- package/dist/stories/Form/FileUpload/index.js +3 -0
- package/dist/stories/Form/TextArea.d.ts +3 -0
- package/dist/stories/Form/TextArea.js +23 -0
- package/dist/stories/Form/TextArea.stories.d.ts +161 -0
- package/dist/stories/Form/TextArea.stories.js +142 -0
- package/dist/stories/Form/TextInput.d.ts +3 -0
- package/dist/stories/Form/TextInput.js +57 -0
- package/dist/stories/Form/TextInput.stories.d.ts +155 -0
- package/dist/stories/Form/TextInput.stories.js +155 -0
- package/dist/stories/Form/Toggle.d.ts +3 -0
- package/dist/stories/Form/Toggle.js +57 -0
- package/dist/stories/Form/Toggle.stories.d.ts +6 -0
- package/dist/stories/Form/Toggle.stories.js +79 -0
- package/dist/stories/Form/index.d.ts +8 -0
- package/dist/stories/Form/index.js +8 -0
- package/dist/stories/Form/types.d.ts +274 -0
- package/dist/stories/Form/types.js +46 -0
- package/dist/stories/Foundations/Colors.d.ts +2 -0
- package/dist/stories/Foundations/Colors.js +266 -0
- package/dist/stories/Foundations/Colors.stories.d.ts +6 -0
- package/dist/stories/Foundations/Colors.stories.js +15 -0
- package/dist/stories/Foundations/index.d.ts +1 -0
- package/dist/stories/Foundations/index.js +1 -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/Header.d.ts +3 -0
- package/dist/stories/Navigation/Header.js +9 -0
- package/dist/stories/Navigation/Header.stories.d.ts +7 -0
- package/dist/stories/Navigation/Header.stories.js +87 -0
- package/dist/stories/Navigation/NavItem.d.ts +3 -0
- package/dist/stories/Navigation/NavItem.js +66 -0
- package/dist/stories/Navigation/NavItem.stories.d.ts +14 -0
- package/dist/stories/Navigation/NavItem.stories.js +100 -0
- package/dist/stories/Navigation/ProcessHeader.d.ts +3 -0
- package/dist/stories/Navigation/ProcessHeader.js +11 -0
- package/dist/stories/Navigation/ProcessHeader.stories.d.ts +6 -0
- package/dist/stories/Navigation/ProcessHeader.stories.js +76 -0
- package/dist/stories/Navigation/Sidebar.d.ts +3 -0
- package/dist/stories/Navigation/Sidebar.js +115 -0
- package/dist/stories/Navigation/Sidebar.stories.d.ts +11 -0
- package/dist/stories/Navigation/Sidebar.stories.js +174 -0
- package/dist/stories/Navigation/index.d.ts +6 -0
- package/dist/stories/Navigation/index.js +6 -0
- package/dist/stories/Navigation/types.d.ts +186 -0
- package/dist/stories/Navigation/types.js +21 -0
- package/dist/stories/PlanCard/PlanCard.d.ts +3 -0
- package/dist/stories/PlanCard/PlanCard.js +13 -0
- package/dist/stories/PlanCard/PlanCard.stories.d.ts +9 -0
- package/dist/stories/PlanCard/PlanCard.stories.js +125 -0
- package/dist/stories/PlanCard/PlanCardSkeleton.d.ts +3 -0
- package/dist/stories/PlanCard/PlanCardSkeleton.js +6 -0
- package/dist/stories/PlanCard/PlanCardSkeleton.stories.d.ts +7 -0
- package/dist/stories/PlanCard/PlanCardSkeleton.stories.js +40 -0
- package/dist/stories/PlanCard/index.d.ts +3 -0
- package/dist/stories/PlanCard/index.js +3 -0
- package/dist/stories/PlanCard/types.d.ts +61 -0
- package/dist/stories/PlanCard/types.js +1 -0
- package/dist/stories/StripeProduct/StripeProduct.d.ts +3 -0
- package/dist/stories/StripeProduct/StripeProduct.js +24 -0
- package/dist/stories/StripeProduct/StripeProduct.stories.d.ts +10 -0
- package/dist/stories/StripeProduct/StripeProduct.stories.js +110 -0
- package/dist/stories/StripeProduct/StripeProductCardSkeleton.d.ts +3 -0
- package/dist/stories/StripeProduct/StripeProductCardSkeleton.js +6 -0
- package/dist/stories/StripeProduct/StripeProductCardSkeleton.stories.d.ts +16 -0
- package/dist/stories/StripeProduct/StripeProductCardSkeleton.stories.js +137 -0
- package/dist/stories/StripeProduct/index.d.ts +3 -0
- package/dist/stories/StripeProduct/index.js +3 -0
- package/dist/stories/StripeProduct/types.d.ts +56 -0
- package/dist/stories/StripeProduct/types.js +1 -0
- package/dist/stories/Typography/Typography.d.ts +3 -0
- package/dist/stories/Typography/Typography.js +22 -0
- package/dist/stories/Typography/Typography.stories.d.ts +25 -0
- package/dist/stories/Typography/Typography.stories.js +225 -0
- package/dist/stories/Typography/index.d.ts +2 -0
- package/dist/stories/Typography/index.js +2 -0
- package/dist/stories/Typography/types.d.ts +46 -0
- package/dist/stories/Typography/types.js +27 -0
- package/dist/stories/UI/Avatar.d.ts +3 -0
- package/dist/stories/UI/Avatar.js +76 -0
- package/dist/stories/UI/Avatar.stories.d.ts +8 -0
- package/dist/stories/UI/Avatar.stories.js +76 -0
- package/dist/stories/UI/Badge.d.ts +3 -0
- package/dist/stories/UI/Badge.js +118 -0
- package/dist/stories/UI/Badge.stories.d.ts +11 -0
- package/dist/stories/UI/Badge.stories.js +107 -0
- package/dist/stories/UI/CheckIcon.d.ts +3 -0
- package/dist/stories/UI/CheckIcon.js +36 -0
- package/dist/stories/UI/CheckIcon.stories.d.ts +7 -0
- package/dist/stories/UI/CheckIcon.stories.js +48 -0
- package/dist/stories/UI/FeatureBanner.d.ts +3 -0
- package/dist/stories/UI/FeatureBanner.js +34 -0
- package/dist/stories/UI/FeatureBanner.stories.d.ts +9 -0
- package/dist/stories/UI/FeatureBanner.stories.js +131 -0
- package/dist/stories/UI/HintBubble.d.ts +3 -0
- package/dist/stories/UI/HintBubble.js +28 -0
- package/dist/stories/UI/HintBubble.stories.d.ts +9 -0
- package/dist/stories/UI/HintBubble.stories.js +68 -0
- package/dist/stories/UI/Logo.d.ts +3 -0
- package/dist/stories/UI/Logo.js +60 -0
- package/dist/stories/UI/Logo.stories.d.ts +11 -0
- package/dist/stories/UI/Logo.stories.js +65 -0
- package/dist/stories/UI/Menu.d.ts +3 -0
- package/dist/stories/UI/Menu.js +56 -0
- package/dist/stories/UI/Menu.stories.d.ts +7 -0
- package/dist/stories/UI/Menu.stories.js +80 -0
- package/dist/stories/UI/ProgressIndicator.d.ts +3 -0
- package/dist/stories/UI/ProgressIndicator.js +35 -0
- package/dist/stories/UI/ProgressIndicator.stories.d.ts +10 -0
- package/dist/stories/UI/ProgressIndicator.stories.js +98 -0
- package/dist/stories/UI/PromoBanner.d.ts +3 -0
- package/dist/stories/UI/PromoBanner.js +34 -0
- package/dist/stories/UI/PromoBanner.stories.d.ts +9 -0
- package/dist/stories/UI/PromoBanner.stories.js +159 -0
- package/dist/stories/UI/SkeletonLoader.d.ts +3 -0
- package/dist/stories/UI/SkeletonLoader.js +19 -0
- package/dist/stories/UI/SkeletonLoader.stories.d.ts +8 -0
- package/dist/stories/UI/SkeletonLoader.stories.js +74 -0
- package/dist/stories/UI/Stepper.d.ts +3 -0
- package/dist/stories/UI/Stepper.js +67 -0
- package/dist/stories/UI/Stepper.stories.d.ts +6 -0
- package/dist/stories/UI/Stepper.stories.js +65 -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 +13 -0
- package/dist/stories/UI/index.js +13 -0
- package/dist/stories/UI/types.d.ts +398 -0
- package/dist/stories/UI/types.js +110 -0
- package/dist/utils/common.d.ts +2 -0
- package/dist/utils/common.js +20 -0
- package/dist/utils/icon.d.ts +6 -0
- package/dist/utils/icon.js +6 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.js +3 -0
- package/dist/utils/typography.d.ts +14 -0
- package/dist/utils/typography.js +46 -0
- package/package.json +48 -42
- package/dist/stories/Button.d.ts +0 -4
- package/dist/stories/Button.js +0 -258
- package/dist/stories/Colors.d.ts +0 -5
- package/dist/stories/Colors.js +0 -9
- package/dist/stories/Header.d.ts +0 -12
- package/dist/stories/Header.js +0 -4
- package/dist/stories/Header.stories.d.ts +0 -18
- package/dist/stories/Header.stories.js +0 -26
- package/dist/stories/Page.d.ts +0 -3
- package/dist/stories/Page.js +0 -8
- package/dist/stories/Page.stories.d.ts +0 -12
- package/dist/stories/Page.stories.js +0 -24
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { ToggleButtonGroup } from './ToggleButtonGroup';
|
|
2
|
+
import { ToggleButtonGroupSize } from './types';
|
|
3
|
+
const meta = {
|
|
4
|
+
title: 'Design System/Components/Buttons/ToggleButtonGroup',
|
|
5
|
+
component: ToggleButtonGroup,
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: 'centered',
|
|
8
|
+
design: {
|
|
9
|
+
type: 'figspec',
|
|
10
|
+
url: 'https://www.figma.com/design/mIhjz2yJjcpLlIqw6oUivt/Beyond-Presence?node-id=4730-7941&m=dev',
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
tags: ['autodocs'],
|
|
14
|
+
argTypes: {
|
|
15
|
+
options: {
|
|
16
|
+
control: 'radio',
|
|
17
|
+
description: 'Options for the toggle button',
|
|
18
|
+
table: {
|
|
19
|
+
type: { summary: 'string[]' },
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
selectedOption: {
|
|
23
|
+
control: 'text',
|
|
24
|
+
description: 'Selected option for the toggle button',
|
|
25
|
+
table: {
|
|
26
|
+
type: { summary: 'string' },
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
disabled: {
|
|
30
|
+
control: 'boolean',
|
|
31
|
+
description: 'Whether the toggle button is disabled',
|
|
32
|
+
table: {
|
|
33
|
+
type: { summary: 'boolean' },
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
size: {
|
|
37
|
+
control: 'select',
|
|
38
|
+
options: Object.values(ToggleButtonGroupSize),
|
|
39
|
+
description: 'Size of the toggle button',
|
|
40
|
+
table: {
|
|
41
|
+
type: { summary: 'string' },
|
|
42
|
+
defaultValue: { summary: ToggleButtonGroupSize.md },
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
export default meta;
|
|
48
|
+
export const Default = {
|
|
49
|
+
args: {
|
|
50
|
+
options: ['Option 1', 'Option 2', 'Option 3'],
|
|
51
|
+
selectedOption: 'Option 1',
|
|
52
|
+
onChange: () => { },
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
export const Size_SM = {
|
|
56
|
+
args: {
|
|
57
|
+
options: ['Option 1', 'Option 2', 'Option 3'],
|
|
58
|
+
selectedOption: 'Option 1',
|
|
59
|
+
onChange: () => { },
|
|
60
|
+
size: ToggleButtonGroupSize.sm,
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
export const Size_MD = {
|
|
64
|
+
args: {
|
|
65
|
+
options: ['Option 1', 'Option 2', 'Option 3'],
|
|
66
|
+
selectedOption: 'Option 1',
|
|
67
|
+
onChange: () => { },
|
|
68
|
+
size: ToggleButtonGroupSize.md,
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
export const Size_LG = {
|
|
72
|
+
args: {
|
|
73
|
+
options: ['Option 1', 'Option 2', 'Option 3'],
|
|
74
|
+
selectedOption: 'Option 1',
|
|
75
|
+
onChange: () => { },
|
|
76
|
+
size: ToggleButtonGroupSize.lg,
|
|
77
|
+
},
|
|
78
|
+
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
|
+
import { IconName } from '../../utils';
|
|
3
|
+
import { SxProps } from '@mui/material';
|
|
4
|
+
import { Theme } from '@mui/material';
|
|
3
5
|
/**
|
|
4
6
|
* Button size variants
|
|
5
7
|
*/
|
|
@@ -16,11 +18,12 @@ export declare enum ButtonSize {
|
|
|
16
18
|
*/
|
|
17
19
|
export declare enum ButtonHierarchy {
|
|
18
20
|
Primary = "Primary",
|
|
21
|
+
PrimaryLemon = "Primary-lemon",
|
|
19
22
|
Secondary = "Secondary",
|
|
20
23
|
SecondaryColor = "Secondary-color",
|
|
21
24
|
SecondaryTransparent = "Secondary-transparent",
|
|
22
|
-
|
|
23
|
-
|
|
25
|
+
Tertiary = "Tertiary",
|
|
26
|
+
TertiaryColor = "Tertiary-color"
|
|
24
27
|
}
|
|
25
28
|
/**
|
|
26
29
|
* Button states
|
|
@@ -56,8 +59,6 @@ export declare enum ButtonType {
|
|
|
56
59
|
* Size configuration for a button
|
|
57
60
|
*/
|
|
58
61
|
export interface ButtonSizeConfig {
|
|
59
|
-
width: string;
|
|
60
|
-
height: string;
|
|
61
62
|
padding: string;
|
|
62
63
|
fontSize: string;
|
|
63
64
|
gap: string;
|
|
@@ -67,9 +68,9 @@ export interface ButtonSizeConfig {
|
|
|
67
68
|
*/
|
|
68
69
|
export interface MainButtonProps {
|
|
69
70
|
/** Click handler for the button */
|
|
70
|
-
onClick?:
|
|
71
|
+
onClick?: React.MouseEventHandler<HTMLButtonElement>;
|
|
71
72
|
/** Text content of the button */
|
|
72
|
-
text
|
|
73
|
+
text?: string;
|
|
73
74
|
/** Whether the button is disabled */
|
|
74
75
|
disabled?: boolean;
|
|
75
76
|
/** Whether the button is in loading state */
|
|
@@ -77,13 +78,13 @@ export interface MainButtonProps {
|
|
|
77
78
|
/** HTML button type */
|
|
78
79
|
type?: ButtonType;
|
|
79
80
|
/** Custom styles for the button */
|
|
80
|
-
style?:
|
|
81
|
+
style?: CSSProperties;
|
|
81
82
|
/** Size variant of the button */
|
|
82
83
|
size?: ButtonSize;
|
|
83
84
|
/** Visual hierarchy of the button */
|
|
84
85
|
hierarchy?: ButtonHierarchy;
|
|
85
86
|
/** Icon to display when in icon mode */
|
|
86
|
-
displayIcon?:
|
|
87
|
+
displayIcon?: IconName;
|
|
87
88
|
/** How to display the icon */
|
|
88
89
|
displayIconMode?: ButtonDisplayMode;
|
|
89
90
|
/** Current state of the button */
|
|
@@ -97,12 +98,34 @@ export interface MainButtonProps {
|
|
|
97
98
|
/** Whether to show the trailing icon */
|
|
98
99
|
showTrailingIcon?: boolean;
|
|
99
100
|
/** Icon to show at the start of the button */
|
|
100
|
-
leadingIcon?:
|
|
101
|
+
leadingIcon?: IconName;
|
|
101
102
|
/** Icon to show at the end of the button */
|
|
102
|
-
trailingIcon?:
|
|
103
|
+
trailingIcon?: IconName;
|
|
104
|
+
/** Test Id */
|
|
105
|
+
testId?: string;
|
|
103
106
|
}
|
|
104
107
|
/**
|
|
105
|
-
*
|
|
108
|
+
* Toggle button size variants
|
|
106
109
|
*/
|
|
107
|
-
export
|
|
110
|
+
export declare enum ToggleButtonGroupSize {
|
|
111
|
+
lg = "lg",
|
|
112
|
+
md = "md",
|
|
113
|
+
sm = "sm"
|
|
108
114
|
}
|
|
115
|
+
/**
|
|
116
|
+
* Toggle button component props
|
|
117
|
+
*/
|
|
118
|
+
export type ToggleButtonGroupProps = {
|
|
119
|
+
/** Size variant of the toggle button */
|
|
120
|
+
size?: ToggleButtonGroupSize;
|
|
121
|
+
/** Selected option of the toggle button */
|
|
122
|
+
selectedOption: string;
|
|
123
|
+
/** Options of the toggle button */
|
|
124
|
+
options: string[];
|
|
125
|
+
/** Whether the toggle button is disabled */
|
|
126
|
+
disabled?: boolean;
|
|
127
|
+
/** Callback function when the toggle button is selected */
|
|
128
|
+
onChange: (option: string) => void;
|
|
129
|
+
/** Custom style of the toggle button */
|
|
130
|
+
style?: SxProps<Theme>;
|
|
131
|
+
};
|
|
@@ -16,11 +16,12 @@ export var ButtonSize;
|
|
|
16
16
|
export var ButtonHierarchy;
|
|
17
17
|
(function (ButtonHierarchy) {
|
|
18
18
|
ButtonHierarchy["Primary"] = "Primary";
|
|
19
|
+
ButtonHierarchy["PrimaryLemon"] = "Primary-lemon";
|
|
19
20
|
ButtonHierarchy["Secondary"] = "Secondary";
|
|
20
21
|
ButtonHierarchy["SecondaryColor"] = "Secondary-color";
|
|
21
22
|
ButtonHierarchy["SecondaryTransparent"] = "Secondary-transparent";
|
|
22
|
-
ButtonHierarchy["
|
|
23
|
-
ButtonHierarchy["
|
|
23
|
+
ButtonHierarchy["Tertiary"] = "Tertiary";
|
|
24
|
+
ButtonHierarchy["TertiaryColor"] = "Tertiary-color";
|
|
24
25
|
})(ButtonHierarchy || (ButtonHierarchy = {}));
|
|
25
26
|
/**
|
|
26
27
|
* Button states
|
|
@@ -56,3 +57,12 @@ export var ButtonType;
|
|
|
56
57
|
ButtonType["Submit"] = "submit";
|
|
57
58
|
ButtonType["Reset"] = "reset";
|
|
58
59
|
})(ButtonType || (ButtonType = {}));
|
|
60
|
+
/**
|
|
61
|
+
* Toggle button size variants
|
|
62
|
+
*/
|
|
63
|
+
export var ToggleButtonGroupSize;
|
|
64
|
+
(function (ToggleButtonGroupSize) {
|
|
65
|
+
ToggleButtonGroupSize["lg"] = "lg";
|
|
66
|
+
ToggleButtonGroupSize["md"] = "md";
|
|
67
|
+
ToggleButtonGroupSize["sm"] = "sm";
|
|
68
|
+
})(ToggleButtonGroupSize || (ToggleButtonGroupSize = {}));
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import styled from '@emotion/styled';
|
|
4
|
+
import { CreditsCardSize } from './types';
|
|
5
|
+
import { Typography, TypographySize, TypographyWeight } from '../Typography';
|
|
6
|
+
import { Box } from '@mui/material';
|
|
7
|
+
import { MainButton, ButtonHierarchy, ButtonSize } from '../Buttons';
|
|
8
|
+
import { formatNumberShort } from '../../utils';
|
|
9
|
+
const StyledCard = styled.div `
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
gap: var(--spacing-tokens-size-in-px-spacing-spacing-md);
|
|
13
|
+
padding: ${({ $size }) => $size === CreditsCardSize.Collapsed
|
|
14
|
+
? 'var(--spacing-tokens-size-in-px-spacing-spacing-md)'
|
|
15
|
+
: 'var(--spacing-tokens-size-in-px-spacing-spacing-md) var(--spacing-tokens-size-in-px-spacing-spacing-lg)'};
|
|
16
|
+
background-color: ${({ $warning }) => $warning
|
|
17
|
+
? 'var(--color-background-bg-badge-accent-red)'
|
|
18
|
+
: 'var(--color-background-bg-card-highlight)'};
|
|
19
|
+
border: 1px solid var(--color-border-border-component);
|
|
20
|
+
border-radius: var(--spacing-tokens-size-in-px-spacing-spacing-md);
|
|
21
|
+
padding: ${({ $collapsed }) => $collapsed
|
|
22
|
+
? 'var(--spacing-tokens-size-in-px-spacing-spacing-md)'
|
|
23
|
+
: '8px var(--spacing-tokens-size-in-px-spacing-spacing-lg)'};
|
|
24
|
+
opacity: 1;
|
|
25
|
+
transition:
|
|
26
|
+
padding 0.3s ease-in-out,
|
|
27
|
+
width 0.3s ease-in-out,
|
|
28
|
+
height 0.3s ease-in-out;
|
|
29
|
+
width: 100%;
|
|
30
|
+
height: auto;
|
|
31
|
+
position: relative;
|
|
32
|
+
`;
|
|
33
|
+
const CreditRow = styled.div `
|
|
34
|
+
display: flex;
|
|
35
|
+
justify-content: ${({ $collapsed }) => $collapsed ? 'center' : 'space-between'};
|
|
36
|
+
align-items: center;
|
|
37
|
+
width: 100%;
|
|
38
|
+
transition: justify-content 0.3s ease-in-out;
|
|
39
|
+
`;
|
|
40
|
+
const TextWrapper = styled.span `
|
|
41
|
+
display: inline-block;
|
|
42
|
+
white-space: nowrap;
|
|
43
|
+
`;
|
|
44
|
+
export const CreditsCard = ({ size = CreditsCardSize.Expanded, className, maxCredits = 1, usedCredits = 0, onUpgradeClick, managedAgentsInfoText = 'Managed Agents 1 Min = 100 Credits', speechToVideoInfoText = 'Speech-to-Video 1 Min = 50 Credits', overUsageEnabled = false, overUsedCredits = 0, }) => {
|
|
45
|
+
const isCollapsed = size === CreditsCardSize.Collapsed;
|
|
46
|
+
const creditsLimitReached = usedCredits >= maxCredits;
|
|
47
|
+
const case1 = overUsageEnabled && overUsedCredits > 0; // if over usage is enabled and over used credits are greater than 0
|
|
48
|
+
const case2 = case1 || !creditsLimitReached; // if case 1 is true or credits limit is not reached
|
|
49
|
+
const case3 = !overUsageEnabled && creditsLimitReached; // if over usage is not enabled and credits limit is reached
|
|
50
|
+
const availableCredits = creditsLimitReached ? 0 : maxCredits - usedCredits;
|
|
51
|
+
const isValid = maxCredits !== undefined && availableCredits !== undefined;
|
|
52
|
+
return (_jsxs(StyledCard, { "$collapsed": isCollapsed, "$size": size, className: className, "$warning": case3, children: [!isCollapsed && isValid && (_jsxs(React.Fragment, { children: [case2 && (_jsx(CreditRow, { style: { justifyContent: 'end' }, children: _jsx(MainButton, { text: "Upgrade", hierarchy: ButtonHierarchy.TertiaryColor, size: ButtonSize.md, style: { padding: '0' }, onClick: () => onUpgradeClick?.() }) })), _jsxs(CreditRow, { children: [case2 && (_jsxs(Box, { gap: "2px", display: "flex", flexDirection: "row", children: [_jsx(TextWrapper, { children: _jsx(Typography, { size: TypographySize.TextS, weight: TypographyWeight.Medium, color: "var(--color-text-text-title)", children: "My Credits:" }) }), _jsx(TextWrapper, { children: _jsx(Typography, { size: TypographySize.TextS, weight: TypographyWeight.Medium, color: "var(--color-text-text-title)", children: `${availableCredits}/` }) }), _jsx(TextWrapper, { children: _jsx(Typography, { size: TypographySize.TextS, weight: TypographyWeight.Medium, color: "var(--color-text-text-paragraph)", children: `${maxCredits}` }) })] })), case3 && (_jsx(TextWrapper, { children: _jsx(Typography, { size: TypographySize.TextS, weight: TypographyWeight.Medium, color: "var(--color-text-text-title)", children: "Credits Limit Reached" }) })), !case2 && (_jsx(MainButton, { text: "Upgrade", hierarchy: ButtonHierarchy.TertiaryColor, size: ButtonSize.md, style: { padding: '0' }, onClick: () => onUpgradeClick?.() }))] }), case1 && (_jsx(CreditRow, { children: _jsx(TextWrapper, { children: _jsx(Typography, { size: TypographySize.TextS, weight: TypographyWeight.Medium, color: "var(--color-text-text-title)", children: `Overused: ${overUsedCredits}` }) }) })), _jsx(CreditRow, { children: _jsx(TextWrapper, { children: _jsx(Typography, { size: TypographySize.TextXS, weight: TypographyWeight.Regular, color: "var(--color-text-text-subtle)", children: managedAgentsInfoText }) }) }), _jsx(CreditRow, { children: _jsx(TextWrapper, { children: _jsx(Typography, { size: TypographySize.TextXS, weight: TypographyWeight.Regular, color: "var(--color-text-text-subtle)", children: speechToVideoInfoText }) }) })] })), isCollapsed && isValid && (_jsxs(Box, { display: "flex", flexDirection: "column", gap: "var(--spacing-tokens-size-in-px-spacing-spacing-md)", alignItems: "center", justifyContent: "center", children: [case2 && (_jsx(CreditRow, { "$collapsed": true, children: _jsxs(Box, { display: "flex", flexDirection: "row", gap: "2px", children: [_jsx(TextWrapper, { children: _jsx(Typography, { size: TypographySize.TextM, weight: TypographyWeight.Medium, color: "var(--color-text-text-title)", children: `${formatNumberShort(availableCredits)}/` }) }), _jsx(TextWrapper, { children: _jsx(Typography, { size: TypographySize.TextM, weight: TypographyWeight.Medium, color: "var(--color-text-text-paragraph)", children: `${formatNumberShort(maxCredits)}` }) })] }) })), case3 && (_jsx(TextWrapper, { children: _jsx(Typography, { size: TypographySize.TextM, weight: TypographyWeight.Medium, color: "var(--color-text-text-title)", textStyle: { textOverflow: 'ellipsis' }, title: "Credits Limit Reached", children: "Cred..." }) })), case1 && (_jsx(TextWrapper, { children: _jsx(Typography, { size: TypographySize.TextS, weight: TypographyWeight.Medium, color: "var(--color-text-text-title)", children: `${formatNumberShort(overUsedCredits)}` }) })), _jsx(Box, { onClick: (e) => e.stopPropagation(), children: _jsx(MainButton, { text: "Upgrade", hierarchy: ButtonHierarchy.TertiaryColor, size: ButtonSize.md, style: { padding: '0' }, onClick: () => onUpgradeClick?.() }) })] }))] }));
|
|
53
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { CreditsCard } from './CreditsCard';
|
|
3
|
+
declare const meta: Meta<typeof CreditsCard>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof CreditsCard>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const Collapsed: Story;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { CreditsCard } from './CreditsCard';
|
|
2
|
+
import { CreditsCardSize } from './types';
|
|
3
|
+
const meta = {
|
|
4
|
+
title: 'Design System/Components/Credits/CreditsCard',
|
|
5
|
+
component: CreditsCard,
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: 'centered',
|
|
8
|
+
},
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
argTypes: {
|
|
11
|
+
size: {
|
|
12
|
+
control: 'select',
|
|
13
|
+
options: Object.values(CreditsCardSize),
|
|
14
|
+
},
|
|
15
|
+
maxCredits: { control: 'number' },
|
|
16
|
+
usedCredits: { control: 'number' },
|
|
17
|
+
managedAgentsInfoText: { control: 'text' },
|
|
18
|
+
speechToVideoInfoText: { control: 'text' },
|
|
19
|
+
overUsageEnabled: { control: 'boolean' },
|
|
20
|
+
overUsedCredits: { control: 'number' },
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
export default meta;
|
|
24
|
+
export const Default = {
|
|
25
|
+
args: {
|
|
26
|
+
size: CreditsCardSize.Expanded,
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
export const Collapsed = {
|
|
30
|
+
args: {
|
|
31
|
+
...Default.args,
|
|
32
|
+
size: CreditsCardSize.Collapsed,
|
|
33
|
+
},
|
|
34
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Box } from '@mui/material';
|
|
4
|
+
import styled from '@emotion/styled';
|
|
5
|
+
import { SkeletonLoader } from '../UI';
|
|
6
|
+
import { CreditsCardSize } from './types';
|
|
7
|
+
const StyledSkeletonCard = styled.div `
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
gap: var(--spacing-tokens-size-in-px-spacing-spacing-md);
|
|
11
|
+
padding: ${({ $collapsed }) => $collapsed
|
|
12
|
+
? 'var(--spacing-tokens-size-in-px-spacing-spacing-md)'
|
|
13
|
+
: '8px var(--spacing-tokens-size-in-px-spacing-spacing-lg)'};
|
|
14
|
+
background-color: var(--color-background-bg-card-highlight);
|
|
15
|
+
border: 1px solid var(--color-border-border-component);
|
|
16
|
+
border-radius: var(--spacing-tokens-size-in-px-spacing-spacing-md);
|
|
17
|
+
width: 100%;
|
|
18
|
+
height: auto;
|
|
19
|
+
position: relative;
|
|
20
|
+
`;
|
|
21
|
+
const CreditRow = styled.div `
|
|
22
|
+
display: flex;
|
|
23
|
+
justify-content: ${({ $collapsed }) => $collapsed ? 'center' : 'space-between'};
|
|
24
|
+
align-items: center;
|
|
25
|
+
width: 100%;
|
|
26
|
+
`;
|
|
27
|
+
export const CreditsCardSkeleton = ({ size = CreditsCardSize.Expanded, style, }) => {
|
|
28
|
+
const isCollapsed = size === CreditsCardSize.Collapsed;
|
|
29
|
+
return (_jsxs(StyledSkeletonCard, { "$collapsed": isCollapsed, "$size": size, style: style, children: [!isCollapsed && (_jsxs(React.Fragment, { children: [_jsx(CreditRow, { style: { justifyContent: 'end' }, children: _jsx(SkeletonLoader, { width: "80px", height: "20px", borderRadius: "var(--spacing-tokens-size-in-px-spacing-spacing-xs)" }) }), _jsx(CreditRow, { children: _jsx(Box, { gap: "4px", display: "flex", flexDirection: "row", children: _jsx(SkeletonLoader, { width: "140px", height: "20px", borderRadius: "var(--spacing-tokens-size-in-px-spacing-spacing-xs)" }) }) }), _jsx(CreditRow, { children: _jsx(SkeletonLoader, { width: "100%", height: "16px", borderRadius: "var(--spacing-tokens-size-in-px-spacing-spacing-xs)" }) }), _jsx(CreditRow, { children: _jsx(SkeletonLoader, { width: "100%", height: "16px", borderRadius: "var(--spacing-tokens-size-in-px-spacing-spacing-xs)" }) })] })), isCollapsed && (_jsxs(Box, { display: "flex", flexDirection: "column", gap: "var(--spacing-tokens-size-in-px-spacing-spacing-md)", alignItems: "center", justifyContent: "center", children: [_jsx(CreditRow, { "$collapsed": true, children: _jsx(SkeletonLoader, { width: "40px", height: "16px", borderRadius: "var(--spacing-tokens-size-in-px-spacing-spacing-xs)" }) }), _jsx(SkeletonLoader, { width: "60px", height: "20px", borderRadius: "var(--spacing-tokens-size-in-px-spacing-spacing-xs)" })] }))] }));
|
|
30
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { CreditsCardSkeleton } from './CreditsCardSkeleton';
|
|
3
|
+
declare const meta: Meta<typeof CreditsCardSkeleton>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof CreditsCardSkeleton>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const Collapsed: Story;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { CreditsCardSkeleton } from './CreditsCardSkeleton';
|
|
2
|
+
import { CreditsCardSize } from './types';
|
|
3
|
+
const meta = {
|
|
4
|
+
title: 'Design System/Components/Credits/CreditsCardSkeleton',
|
|
5
|
+
component: CreditsCardSkeleton,
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: 'centered',
|
|
8
|
+
},
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
argTypes: {
|
|
11
|
+
size: {
|
|
12
|
+
control: 'select',
|
|
13
|
+
options: Object.values(CreditsCardSize),
|
|
14
|
+
description: 'Size variant of the skeleton',
|
|
15
|
+
table: {
|
|
16
|
+
type: { summary: 'CreditsCardSize' },
|
|
17
|
+
defaultValue: { summary: 'CreditsCardSize.Expanded' },
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
style: {
|
|
21
|
+
control: 'object',
|
|
22
|
+
description: 'Optional inline styles',
|
|
23
|
+
table: {
|
|
24
|
+
type: { summary: 'React.CSSProperties' },
|
|
25
|
+
defaultValue: { summary: 'undefined' },
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
export default meta;
|
|
31
|
+
export const Default = {
|
|
32
|
+
args: {
|
|
33
|
+
size: CreditsCardSize.Expanded,
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
export const Collapsed = {
|
|
37
|
+
args: {
|
|
38
|
+
size: CreditsCardSize.Collapsed,
|
|
39
|
+
},
|
|
40
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export declare enum CreditsCardSize {
|
|
2
|
+
Expanded = "expanded",
|
|
3
|
+
Collapsed = "collapsed"
|
|
4
|
+
}
|
|
5
|
+
export declare enum CreditsCardState {
|
|
6
|
+
Default = "default",
|
|
7
|
+
Active = "active",
|
|
8
|
+
Disabled = "disabled"
|
|
9
|
+
}
|
|
10
|
+
export interface CreditsCardProps {
|
|
11
|
+
/**
|
|
12
|
+
* The size of the card
|
|
13
|
+
*/
|
|
14
|
+
size?: CreditsCardSize;
|
|
15
|
+
/**
|
|
16
|
+
* Optional className for additional styling
|
|
17
|
+
*/
|
|
18
|
+
className?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Maximum available credits
|
|
21
|
+
*/
|
|
22
|
+
maxCredits?: number;
|
|
23
|
+
/**
|
|
24
|
+
* Currently used credits
|
|
25
|
+
*/
|
|
26
|
+
usedCredits?: number;
|
|
27
|
+
/**
|
|
28
|
+
* Function to handle upgrade button click
|
|
29
|
+
*/
|
|
30
|
+
onUpgradeClick?: () => void;
|
|
31
|
+
/**
|
|
32
|
+
* Text explaining speech to video usage (e.g., "1 Min = 100 Credits")
|
|
33
|
+
*/
|
|
34
|
+
speechToVideoInfoText?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Text explaining managed agents usage (e.g., "Managed Agents 1 Min = 100 Credits")
|
|
37
|
+
*/
|
|
38
|
+
managedAgentsInfoText?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Whether to enable over usage
|
|
41
|
+
*/
|
|
42
|
+
overUsageEnabled?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Over used credits
|
|
45
|
+
*/
|
|
46
|
+
overUsedCredits?: number;
|
|
47
|
+
}
|
|
48
|
+
export interface CreditsCardSkeletonProps {
|
|
49
|
+
/**
|
|
50
|
+
* The size of the skeleton card
|
|
51
|
+
*/
|
|
52
|
+
size?: CreditsCardSize;
|
|
53
|
+
/**
|
|
54
|
+
* Optional inline styles
|
|
55
|
+
*/
|
|
56
|
+
style?: React.CSSProperties;
|
|
57
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export var CreditsCardSize;
|
|
2
|
+
(function (CreditsCardSize) {
|
|
3
|
+
CreditsCardSize["Expanded"] = "expanded";
|
|
4
|
+
CreditsCardSize["Collapsed"] = "collapsed";
|
|
5
|
+
})(CreditsCardSize || (CreditsCardSize = {}));
|
|
6
|
+
export var CreditsCardState;
|
|
7
|
+
(function (CreditsCardState) {
|
|
8
|
+
CreditsCardState["Default"] = "default";
|
|
9
|
+
CreditsCardState["Active"] = "active";
|
|
10
|
+
CreditsCardState["Disabled"] = "disabled";
|
|
11
|
+
})(CreditsCardState || (CreditsCardState = {}));
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { Box } from '@mui/material';
|
|
4
|
+
import { Typography, TypographySize, TypographyWeight } from '../Typography';
|
|
5
|
+
import { Menu, Badge, BadgeColor, BadgeSize } from '../UI';
|
|
6
|
+
import { MainButton, ButtonHierarchy, ButtonSize, ButtonDisplayMode, } from '../Buttons';
|
|
7
|
+
import { UserCircle } from '@phosphor-icons/react';
|
|
8
|
+
export const EntityCard = ({ view = 'avatar', name, image, description = '', showDescription = false, onPreview, previewButtonText, previewIcon = 'Play', showStatusBadge = false, statusBadgeText = '', statusBadgeColor = BadgeColor.Green, menuItems = [], showMenu = false, width, }) => {
|
|
9
|
+
const [hovered, setHovered] = useState(false);
|
|
10
|
+
const [imageError, setImageError] = useState(false);
|
|
11
|
+
const isAgent = view === 'agent';
|
|
12
|
+
const cardWidth = width ?? (isAgent ? '280px' : '208px');
|
|
13
|
+
const imageAspectRatio = isAgent ? '1 / 1' : '203 / 264';
|
|
14
|
+
const entityKey = name?.toLowerCase()?.replace(/\s+/g, '-');
|
|
15
|
+
const hasMenu = showMenu && menuItems.length > 0;
|
|
16
|
+
const showActions = hovered && (!!onPreview || hasMenu);
|
|
17
|
+
const showBadge = showStatusBadge && !!statusBadgeText;
|
|
18
|
+
return (_jsxs(Box, { width: cardWidth, display: 'flex', flexDirection: 'column', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-md)', padding: 'var(--spacing-tokens-size-in-px-spacing-spacing-md)', borderRadius: 'var(--spacing-tokens-size-in-px-spacing-spacing-sm)', bgcolor: 'var(--color-background-bg-card-highlight)', border: '1px solid var(--color-border-border-subtle)', boxSizing: 'border-box', overflow: 'hidden', "data-testid": `${entityKey}-entity-card`, children: [_jsxs(Box, { position: 'relative', width: '100%', borderRadius: 'var(--spacing-tokens-size-in-px-spacing-spacing-sm)', overflow: 'hidden', sx: { aspectRatio: imageAspectRatio }, onMouseEnter: () => setHovered(true), onMouseLeave: () => setHovered(false), children: [image && !imageError ? (_jsx("img", { src: image, alt: name, width: '100%', height: '100%', style: { objectFit: 'cover', height: '100%', width: '100%' }, onError: () => setImageError(true) })) : (_jsx(Box, { width: '100%', height: '100%', bgcolor: 'var(--color-background-bg-element)', display: 'flex', justifyContent: 'center', alignItems: 'center', children: _jsx(UserCircle, { size: 74, weight: 'thin', color: 'var(--color-text-text-subtle)' }) })), _jsx(Box, { position: 'absolute', left: 0, right: 0, bottom: 0, display: 'flex', alignItems: 'center', 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: {
|
|
19
|
+
backgroundImage: 'linear-gradient(rgba(45, 38, 55, 0) 0%, rgba(45, 38, 55, 0.16) 34%, rgba(45, 38, 55, 0.64) 100%)',
|
|
20
|
+
}, children: _jsx(Typography, { size: TypographySize.HeadingXS, weight: TypographyWeight.SemiBold, color: 'var(--color-text-text-white)', textStyle: { wordBreak: 'break-word' }, children: name }) }), 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)', iconColor: 'var(--color-foreground-fg-accent-success)' }) })), 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: 2 }, children: [onPreview &&
|
|
21
|
+
(previewButtonText ? (_jsx(MainButton, { text: previewButtonText, showLeadingIcon: true, leadingIcon: previewIcon, hierarchy: ButtonHierarchy.Primary, size: ButtonSize.sm, onClick: onPreview, testId: `${entityKey}-preview-button` })) : (_jsx(MainButton, { displayIcon: previewIcon, displayIconMode: ButtonDisplayMode.Only, hierarchy: ButtonHierarchy.Primary, size: ButtonSize.sm, onClick: onPreview, testId: `${entityKey}-preview-button` }))), hasMenu && (_jsx(Menu, { items: menuItems, testKey: entityKey, size: ButtonSize.sm }))] }))] }), showDescription && description && (_jsx(Box, { display: 'flex', alignItems: 'center', padding: '0 var(--spacing-tokens-size-in-px-spacing-spacing-lg)', width: '100%', boxSizing: 'border-box', children: _jsx(Typography, { size: TypographySize.TextS, weight: TypographyWeight.Regular, color: 'var(--color-text-text-label)', textStyle: { wordBreak: 'break-word' }, children: description }) }))] }));
|
|
22
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { EntityCard } from './EntityCard';
|
|
3
|
+
declare const meta: Meta<typeof EntityCard>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof EntityCard>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const AgentView: Story;
|
|
8
|
+
export declare const WithDescription: Story;
|
|
9
|
+
export declare const NoActions: Story;
|
|
10
|
+
export declare const NoImage: Story;
|