@beydesign/storybook 0.0.97 → 0.0.98
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/dist/stories/Buttons/MainButton.js +10 -10
- package/dist/stories/Buttons/MainButton.stories.d.ts +2 -2
- package/dist/stories/Buttons/MainButton.stories.js +6 -6
- package/dist/stories/Buttons/ToggleButtonGroup.js +1 -1
- package/dist/stories/Buttons/types.d.ts +2 -2
- package/dist/stories/Buttons/types.js +2 -2
- package/dist/stories/Credits/CreditsCard.js +9 -18
- package/dist/stories/Credits/types.d.ts +8 -0
- package/dist/stories/Navigation/ComplexHeader.js +4 -4
- package/dist/stories/Navigation/Header.js +1 -1
- package/dist/stories/Navigation/ProcessHeader.js +1 -1
- package/dist/stories/Navigation/Sidebar.js +2 -2
- package/dist/stories/Navigation/types.d.ts +2 -8
- package/dist/utils/common.d.ts +1 -0
- package/dist/utils/common.js +13 -0
- package/package.json +1 -1
|
@@ -40,11 +40,11 @@ const StyledButton = styled.button `
|
|
|
40
40
|
if (props.$state === ButtonState.Disabled || props.$disabled)
|
|
41
41
|
return 'var(--colors-light-background-bg-overlay-1)';
|
|
42
42
|
return 'var(--primitives-desktop-primary-transparent-violet-50)';
|
|
43
|
-
case ButtonHierarchy.
|
|
43
|
+
case ButtonHierarchy.Tertiary:
|
|
44
44
|
if (props.$state === ButtonState.Disabled || props.$disabled)
|
|
45
45
|
return 'var(--primitives-desktop-primary-white-0)';
|
|
46
46
|
return 'var(--primitives-desktop-primary-white-0)';
|
|
47
|
-
case ButtonHierarchy.
|
|
47
|
+
case ButtonHierarchy.TertiaryColor:
|
|
48
48
|
if (props.$state === ButtonState.Disabled || props.$disabled)
|
|
49
49
|
return 'var(--primitives-desktop-primary-white-0)';
|
|
50
50
|
return 'var(--primitives-desktop-primary-white-0)';
|
|
@@ -79,11 +79,11 @@ const StyledButton = styled.button `
|
|
|
79
79
|
if (props.$state === ButtonState.Disabled || props.$disabled)
|
|
80
80
|
return 'var(--colors-light-text-text-white)';
|
|
81
81
|
return 'var(--colors-light-text-text-white)';
|
|
82
|
-
case ButtonHierarchy.
|
|
82
|
+
case ButtonHierarchy.Tertiary:
|
|
83
83
|
if (props.$state === ButtonState.Disabled || props.$disabled)
|
|
84
84
|
return 'var(--colors-light-text-text-disabled)';
|
|
85
85
|
return 'var(--colors-light-text-text-title)';
|
|
86
|
-
case ButtonHierarchy.
|
|
86
|
+
case ButtonHierarchy.TertiaryColor:
|
|
87
87
|
if (props.$state === ButtonState.Disabled || props.$disabled)
|
|
88
88
|
return 'var(--colors-light-text-text-disabled)';
|
|
89
89
|
return 'var(--colors-light-text-text-accent)';
|
|
@@ -119,11 +119,11 @@ const StyledButton = styled.button `
|
|
|
119
119
|
if (props.$state === ButtonState.Disabled || props.$disabled)
|
|
120
120
|
return 'var(--colors-light-border-border-disabled)';
|
|
121
121
|
return 'var(--colors-light-background-bg-white)';
|
|
122
|
-
case ButtonHierarchy.
|
|
122
|
+
case ButtonHierarchy.Tertiary:
|
|
123
123
|
if (props.$state === ButtonState.Disabled || props.$disabled)
|
|
124
124
|
return 'var(--primitives-desktop-primary-white-0)';
|
|
125
125
|
return 'var(--primitives-desktop-primary-white-0)';
|
|
126
|
-
case ButtonHierarchy.
|
|
126
|
+
case ButtonHierarchy.TertiaryColor:
|
|
127
127
|
if (props.$state === ButtonState.Disabled || props.$disabled)
|
|
128
128
|
return 'var(--primitives-desktop-primary-white-0)';
|
|
129
129
|
return 'var(--primitives-desktop-primary-white-0)';
|
|
@@ -161,9 +161,9 @@ const StyledButton = styled.button `
|
|
|
161
161
|
return 'var(--colors-light-background-bg-card-highlight-hover)';
|
|
162
162
|
case ButtonHierarchy.SecondaryTransparent:
|
|
163
163
|
return 'var(--colors-light-background-bg-brand-hover)';
|
|
164
|
-
case ButtonHierarchy.
|
|
164
|
+
case ButtonHierarchy.Tertiary:
|
|
165
165
|
return 'var(--primitives-desktop-primary-white-40)';
|
|
166
|
-
case ButtonHierarchy.
|
|
166
|
+
case ButtonHierarchy.TertiaryColor:
|
|
167
167
|
return 'var(--colors-light-background-bg-card-highlight-hover)';
|
|
168
168
|
default:
|
|
169
169
|
return 'var(--colors-light-background-bg-brand-hover)';
|
|
@@ -184,9 +184,9 @@ const StyledButton = styled.button `
|
|
|
184
184
|
return 'var(--colors-light-background-bg-brand-hover)';
|
|
185
185
|
case ButtonHierarchy.SecondaryTransparent:
|
|
186
186
|
return 'var(--primitives-desktop-primary-white-100)';
|
|
187
|
-
case ButtonHierarchy.
|
|
187
|
+
case ButtonHierarchy.Tertiary:
|
|
188
188
|
return 'var(--primitives-desktop-primary-white-0)';
|
|
189
|
-
case ButtonHierarchy.
|
|
189
|
+
case ButtonHierarchy.TertiaryColor:
|
|
190
190
|
return 'var(--primitives-desktop-primary-white-0)';
|
|
191
191
|
default:
|
|
192
192
|
return 'var(--colors-light-background-bg-brand-hover)';
|
|
@@ -8,8 +8,8 @@ export declare const PrimaryLemon: Story;
|
|
|
8
8
|
export declare const Secondary: Story;
|
|
9
9
|
export declare const SecondaryColor: Story;
|
|
10
10
|
export declare const SecondaryTransparent: Story;
|
|
11
|
-
export declare const
|
|
12
|
-
export declare const
|
|
11
|
+
export declare const Tertiary: Story;
|
|
12
|
+
export declare const TertiaryColor: Story;
|
|
13
13
|
export declare const PrimaryHover: Story;
|
|
14
14
|
export declare const PrimaryDisabled: Story;
|
|
15
15
|
export declare const IconOnly: Story;
|
|
@@ -36,8 +36,8 @@ const meta = {
|
|
|
36
36
|
'Secondary',
|
|
37
37
|
'Secondary-color',
|
|
38
38
|
'Secondary-transparent',
|
|
39
|
-
'
|
|
40
|
-
'
|
|
39
|
+
'Tertiary',
|
|
40
|
+
'Tertiary-color',
|
|
41
41
|
],
|
|
42
42
|
description: 'Visual hierarchy of the button',
|
|
43
43
|
table: {
|
|
@@ -172,18 +172,18 @@ export const SecondaryTransparent = {
|
|
|
172
172
|
hierarchy: ButtonHierarchy.SecondaryTransparent,
|
|
173
173
|
},
|
|
174
174
|
};
|
|
175
|
-
export const
|
|
175
|
+
export const Tertiary = {
|
|
176
176
|
args: {
|
|
177
177
|
...Primary.args,
|
|
178
178
|
text: 'Button',
|
|
179
|
-
hierarchy: ButtonHierarchy.
|
|
179
|
+
hierarchy: ButtonHierarchy.Tertiary,
|
|
180
180
|
},
|
|
181
181
|
};
|
|
182
|
-
export const
|
|
182
|
+
export const TertiaryColor = {
|
|
183
183
|
args: {
|
|
184
184
|
...Primary.args,
|
|
185
185
|
text: 'Button',
|
|
186
|
-
hierarchy: ButtonHierarchy.
|
|
186
|
+
hierarchy: ButtonHierarchy.TertiaryColor,
|
|
187
187
|
},
|
|
188
188
|
};
|
|
189
189
|
export const PrimaryHover = {
|
|
@@ -29,6 +29,6 @@ export const ToggleButtonGroup = ({ onChange, options, selectedOption, disabled,
|
|
|
29
29
|
...style,
|
|
30
30
|
}, gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-xs)', padding: 'var(--spacing-tokens-size-in-px-spacing-spacing-xs)', border: `1px solid var(--colors-light-border-border-component)`, width: 'fit-content', children: options.map((option) => {
|
|
31
31
|
const isSelected = option === selectedOption;
|
|
32
|
-
return (_jsx(MainButton, { text: option, onClick: () => onChange(option), size: getButtonSize(), hierarchy: ButtonHierarchy.
|
|
32
|
+
return (_jsx(MainButton, { text: option, onClick: () => onChange(option), size: getButtonSize(), hierarchy: ButtonHierarchy.Tertiary, type: ButtonType.Button, style: isSelected ? selectedOptionStyle : unselectedOptionStyle, disabled: disabled }, option));
|
|
33
33
|
}) }));
|
|
34
34
|
};
|
|
@@ -22,8 +22,8 @@ export declare enum ButtonHierarchy {
|
|
|
22
22
|
Secondary = "Secondary",
|
|
23
23
|
SecondaryColor = "Secondary-color",
|
|
24
24
|
SecondaryTransparent = "Secondary-transparent",
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
Tertiary = "Tertiary",
|
|
26
|
+
TertiaryColor = "Tertiary-color"
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
29
|
* Button states
|
|
@@ -20,8 +20,8 @@ export var ButtonHierarchy;
|
|
|
20
20
|
ButtonHierarchy["Secondary"] = "Secondary";
|
|
21
21
|
ButtonHierarchy["SecondaryColor"] = "Secondary-color";
|
|
22
22
|
ButtonHierarchy["SecondaryTransparent"] = "Secondary-transparent";
|
|
23
|
-
ButtonHierarchy["
|
|
24
|
-
ButtonHierarchy["
|
|
23
|
+
ButtonHierarchy["Tertiary"] = "Tertiary";
|
|
24
|
+
ButtonHierarchy["TertiaryColor"] = "Tertiary-color";
|
|
25
25
|
})(ButtonHierarchy || (ButtonHierarchy = {}));
|
|
26
26
|
/**
|
|
27
27
|
* Button states
|
|
@@ -5,11 +5,14 @@ import { CreditsCardSize } from './types';
|
|
|
5
5
|
import { Typography, TypographySize, TypographyWeight } from '../Typography';
|
|
6
6
|
import { Box } from '@mui/material';
|
|
7
7
|
import { MainButton, ButtonHierarchy, ButtonSize } from '../Buttons';
|
|
8
|
+
import { formatNumberShort } from '../../utils';
|
|
8
9
|
const StyledCard = styled.div `
|
|
9
10
|
display: flex;
|
|
10
11
|
flex-direction: column;
|
|
11
|
-
gap:
|
|
12
|
-
padding: ${({ $size }) => $size === CreditsCardSize.Collapsed
|
|
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)'};
|
|
13
16
|
background-color: ${({ $warning }) => $warning
|
|
14
17
|
? 'var(--primitives-desktop-primary-red-50)'
|
|
15
18
|
: 'var(--colors-light-background-bg-card-highlight)'};
|
|
@@ -38,26 +41,14 @@ const TextWrapper = styled.span `
|
|
|
38
41
|
display: inline-block;
|
|
39
42
|
white-space: nowrap;
|
|
40
43
|
`;
|
|
41
|
-
export const CreditsCard = ({ size = CreditsCardSize.Expanded, className, maxCredits = 1, usedCredits = 0, onUpgradeClick, creditInfoText = '1 Credit = 1 min video', overUsageEnabled = false, overUsedCredits = 0, }) => {
|
|
44
|
+
export const CreditsCard = ({ size = CreditsCardSize.Expanded, className, maxCredits = 1, usedCredits = 0, onUpgradeClick, creditInfoText = '1 Credit = 1 min video', managedAgentsInfoText = 'Managed Agents 1 Min = 100 Credits', speechToVideoInfoText = 'Speech-to-Video 1 Min = 50 Credits', overUsageEnabled = false, overUsedCredits = 0, }) => {
|
|
42
45
|
const isCollapsed = size === CreditsCardSize.Collapsed;
|
|
43
46
|
const creditsLimitReached = usedCredits >= maxCredits;
|
|
44
47
|
const case1 = overUsageEnabled && overUsedCredits > 0; // if over usage is enabled and over used credits are greater than 0
|
|
45
48
|
const case2 = case1 || !creditsLimitReached; // if case 1 is true or credits limit is not reached
|
|
46
49
|
const case3 = !overUsageEnabled && creditsLimitReached; // if over usage is not enabled and credits limit is reached
|
|
50
|
+
const case4 = !overUsageEnabled && !creditsLimitReached; // if over usage is not enabled and credits limit is not reached
|
|
47
51
|
const availableCredits = creditsLimitReached ? 0 : maxCredits - usedCredits;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
availableCredits !== undefined && (_jsxs(React.Fragment, { children: [_jsxs(CreditRow, { style: {
|
|
51
|
-
gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-md)',
|
|
52
|
-
}, children: [case2 && (_jsxs(Box, { gap: "2px", display: "flex", flexDirection: "row", children: [_jsx(TextWrapper, { children: _jsx(Typography, { size: TypographySize.TextS, weight: TypographyWeight.Medium, color: "var(--colors-light-text-text-title)", children: "My Credits:" }) }), _jsx(TextWrapper, { children: _jsx(Typography, { size: TypographySize.TextS, weight: TypographyWeight.Medium, color: "var(--colors-light-text-text-title)", children: `${availableCredits}/` }) }), _jsx(TextWrapper, { children: _jsx(Typography, { size: TypographySize.TextS, weight: TypographyWeight.Medium, color: "var(--colors-light-text-text-paragraph)", children: `${maxCredits}` }) })] })), case3 && (_jsx(TextWrapper, { children: _jsx(Typography, { size: TypographySize.TextS, weight: TypographyWeight.Medium, color: "var(--colors-light-text-text-title)", children: "Credits Limit Reached" }) })), _jsx(MainButton, { text: "Upgrade", hierarchy: ButtonHierarchy.TetriaryColor, size: ButtonSize.md, style: { padding: '0' }, onClick: () => {
|
|
53
|
-
if (onUpgradeClick) {
|
|
54
|
-
onUpgradeClick();
|
|
55
|
-
}
|
|
56
|
-
} })] }), case1 && (_jsx(CreditRow, { children: _jsx(Box, { display: "flex", flexDirection: "row", children: _jsx(TextWrapper, { children: _jsx(Typography, { size: TypographySize.TextS, weight: TypographyWeight.Medium, color: "var(--colors-light-text-text-title)", children: `Overused: ${overUsedCredits}` }) }) }) })), _jsx(CreditRow, { style: { justifyContent: 'end' }, children: _jsx(Box, { display: "flex", flexDirection: "row", children: _jsx(TextWrapper, { children: _jsx(Typography, { size: TypographySize.TextXS, weight: TypographyWeight.Regular, color: "var(--colors-light-text-text-subtle)", children: creditInfoText }) }) }) })] })), isCollapsed &&
|
|
57
|
-
maxCredits !== undefined &&
|
|
58
|
-
availableCredits !== undefined && (_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(--colors-light-text-text-title)", children: `${availableCredits}/` }) }), _jsx(TextWrapper, { children: _jsx(Typography, { size: TypographySize.TextM, weight: TypographyWeight.Medium, color: "var(--colors-light-text-text-paragraph)", children: `${maxCredits}` }) })] }) })), case3 && (_jsx(TextWrapper, { children: _jsx(Typography, { size: TypographySize.TextM, weight: TypographyWeight.Medium, color: "var(--colors-light-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(--colors-light-text-text-title)", children: `${overUsedCredits}` }) })), _jsx(Box, { onClick: (e) => e.stopPropagation(), children: _jsx(MainButton, { text: "Upgrade", hierarchy: ButtonHierarchy.TetriaryColor, size: ButtonSize.md, style: { padding: '0' }, onClick: () => {
|
|
59
|
-
if (onUpgradeClick) {
|
|
60
|
-
onUpgradeClick();
|
|
61
|
-
}
|
|
62
|
-
} }) })] }))] }));
|
|
52
|
+
const isValid = maxCredits !== undefined && availableCredits !== undefined;
|
|
53
|
+
return (_jsxs(StyledCard, { "$collapsed": isCollapsed, "$size": size, className: className, "$warning": case3, children: [!isCollapsed && isValid && (_jsxs(React.Fragment, { children: [case4 && (_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(--colors-light-text-text-title)", children: "My Credits:" }) }), _jsx(TextWrapper, { children: _jsx(Typography, { size: TypographySize.TextS, weight: TypographyWeight.Medium, color: "var(--colors-light-text-text-title)", children: `${availableCredits}/` }) }), _jsx(TextWrapper, { children: _jsx(Typography, { size: TypographySize.TextS, weight: TypographyWeight.Medium, color: "var(--colors-light-text-text-paragraph)", children: `${maxCredits}` }) })] })), case3 && (_jsx(TextWrapper, { children: _jsx(Typography, { size: TypographySize.TextS, weight: TypographyWeight.Medium, color: "var(--colors-light-text-text-title)", children: "Credits Limit Reached" }) })), !case4 && (_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(--colors-light-text-text-title)", children: `Overused: ${overUsedCredits}` }) }) })), case4 ? (_jsxs(React.Fragment, { children: [_jsx(CreditRow, { children: _jsx(TextWrapper, { children: _jsx(Typography, { size: TypographySize.TextXS, weight: TypographyWeight.Regular, color: "var(--colors-light-text-text-subtle)", children: managedAgentsInfoText }) }) }), _jsx(CreditRow, { children: _jsx(TextWrapper, { children: _jsx(Typography, { size: TypographySize.TextXS, weight: TypographyWeight.Regular, color: "var(--colors-light-text-text-subtle)", children: speechToVideoInfoText }) }) })] })) : (_jsx(CreditRow, { style: { justifyContent: 'end' }, children: _jsx(TextWrapper, { children: _jsx(Typography, { size: TypographySize.TextXS, weight: TypographyWeight.Regular, color: "var(--colors-light-text-text-subtle)", children: creditInfoText }) }) }))] })), 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(--colors-light-text-text-title)", children: `${formatNumberShort(availableCredits)}/` }) }), _jsx(TextWrapper, { children: _jsx(Typography, { size: TypographySize.TextM, weight: TypographyWeight.Medium, color: "var(--colors-light-text-text-paragraph)", children: `${formatNumberShort(maxCredits)}` }) })] }) })), case3 && (_jsx(TextWrapper, { children: _jsx(Typography, { size: TypographySize.TextM, weight: TypographyWeight.Medium, color: "var(--colors-light-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(--colors-light-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?.() }) })] }))] }));
|
|
63
54
|
};
|
|
@@ -32,6 +32,14 @@ export interface CreditsCardProps {
|
|
|
32
32
|
* Text explaining credit usage (e.g., "1 Credit = 1 min video")
|
|
33
33
|
*/
|
|
34
34
|
creditInfoText?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Text explaining speech to video usage (e.g., "1 Min = 100 Credits")
|
|
37
|
+
*/
|
|
38
|
+
speechToVideoInfoText?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Text explaining managed agents usage (e.g., "Managed Agents 1 Min = 100 Credits")
|
|
41
|
+
*/
|
|
42
|
+
managedAgentsInfoText?: string;
|
|
35
43
|
/**
|
|
36
44
|
* Whether to enable over usage
|
|
37
45
|
*/
|
|
@@ -14,8 +14,8 @@ export const ComplexHeader = ({ title = 'Title', badgeText = '22', newButtonText
|
|
|
14
14
|
onLayoutChange?.(type);
|
|
15
15
|
};
|
|
16
16
|
return (_jsxs(Box, { className: className, display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', borderBottom: '1px solid var(--primitives-desktop-primary-gray-200)', bgcolor: 'var(--colors-light-background-bg-white)', paddingX: 'var(--spacing-tokens-size-in-px-spacing-spacing-4xl)', height: 'var( --spacing-tokens-size-in-px-spacing-spacing-7xl)', sx: sx, children: [_jsxs(Box, { display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-lg)', children: [_jsxs(Box, { display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'flex-start', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-md)', children: [_jsx(Typography, { size: TypographySize.HeadingS, weight: TypographyWeight.Bold, children: title }), badgeText && (_jsx(Badge, { text: badgeText, size: BadgeSize.md, color: BadgeColor.Violet }))] }), onNewClick && (_jsx(MainButton, { text: newButtonText, hierarchy: ButtonHierarchy.Secondary, size: ButtonSize.xs, showTrailingIcon: true, trailingIcon: 'Plus', onClick: onNewClick }))] }), _jsxs(Box, { display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-lg)', children: [_jsx(AutoComplete, { options: [], placeholder: "Search", onChange: () => { }, value: '' }), _jsx(MainButton, { text: 'Output File', hierarchy: ButtonHierarchy.SecondaryColor, size: ButtonSize.lg, showTrailingIcon: true, trailingIcon: 'DownloadSimple', onClick: onOutputFileClick }), _jsx(MainButton, { text: 'Download All', hierarchy: ButtonHierarchy.Primary, size: ButtonSize.lg, showTrailingIcon: true, trailingIcon: 'DownloadSimple', onClick: onDownloadAllClick }), _jsxs(Box, { display: 'flex', flexDirection: 'row', justifyContent: 'center', alignItems: 'center', children: [_jsx(MainButton, { hierarchy: layoutType === LayoutType.Grid
|
|
17
|
-
? ButtonHierarchy.
|
|
18
|
-
: ButtonHierarchy.
|
|
19
|
-
? ButtonHierarchy.
|
|
20
|
-
: ButtonHierarchy.
|
|
17
|
+
? ButtonHierarchy.TertiaryColor
|
|
18
|
+
: ButtonHierarchy.Tertiary, size: ButtonSize.sm, displayIconMode: ButtonDisplayMode.Only, displayIcon: "GridFour", onClick: () => handleLayoutChange(LayoutType.Grid) }), _jsx(MainButton, { hierarchy: layoutType === LayoutType.List
|
|
19
|
+
? ButtonHierarchy.TertiaryColor
|
|
20
|
+
: ButtonHierarchy.Tertiary, size: ButtonSize.sm, displayIconMode: ButtonDisplayMode.Only, displayIcon: "List", onClick: () => handleLayoutChange(LayoutType.List) })] })] })] }));
|
|
21
21
|
};
|
|
@@ -5,5 +5,5 @@ import { ButtonHierarchy, ButtonSize } from '../Buttons';
|
|
|
5
5
|
import { Typography, TypographySize, TypographyWeight } from '../Typography';
|
|
6
6
|
import { Avatar, AvatarSize } from '../UI';
|
|
7
7
|
export const Header = ({ title = 'Beyond Presence', email, avatarProps, backButtonText = 'Back', onBackClick, onLogoutClick, className, }) => {
|
|
8
|
-
return (_jsxs(Box, { className: className, display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', borderBottom: '1px solid var(--primitives-desktop-primary-gray-200)', bgcolor: 'var(--colors-light-background-bg-white)', paddingX: 'var(--spacing-tokens-size-in-px-spacing-spacing-4xl)', height: 'var( --spacing-tokens-size-in-px-spacing-spacing-7xl)', children: [onBackClick ? (_jsx(MainButton, { text: backButtonText, hierarchy: ButtonHierarchy.
|
|
8
|
+
return (_jsxs(Box, { className: className, display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', borderBottom: '1px solid var(--primitives-desktop-primary-gray-200)', bgcolor: 'var(--colors-light-background-bg-white)', paddingX: 'var(--spacing-tokens-size-in-px-spacing-spacing-4xl)', height: 'var( --spacing-tokens-size-in-px-spacing-spacing-7xl)', children: [onBackClick ? (_jsx(MainButton, { text: backButtonText, hierarchy: ButtonHierarchy.Tertiary, showLeadingIcon: true, leadingIcon: 'ArrowLeft', onClick: onBackClick })) : (_jsx(Typography, { size: TypographySize.HeadingS, weight: TypographyWeight.SemiBold, children: title })), _jsxs(Box, { display: 'flex', flexDirection: 'row', alignItems: 'center', gap: '8px', children: [_jsxs(Box, { display: 'flex', flexDirection: 'column', alignItems: 'flex-end', justifyContent: 'space-between', children: [_jsx(Typography, { size: TypographySize.TextS, weight: TypographyWeight.SemiBold, children: email }), _jsx(MainButton, { text: 'Log Out', size: ButtonSize.sm, hierarchy: ButtonHierarchy.Tertiary, onClick: onLogoutClick, style: { paddingInline: '0px', paddingBlock: '0.1rem' } })] }), _jsx(Avatar, { ...avatarProps, size: AvatarSize.md })] })] }));
|
|
9
9
|
};
|
|
@@ -7,5 +7,5 @@ export const ProcessHeader = ({ title, currentStep, subtitle, totalSteps, header
|
|
|
7
7
|
const stepChecks = () => {
|
|
8
8
|
return (currentStep && totalSteps && currentStep >= 1 && currentStep <= totalSteps);
|
|
9
9
|
};
|
|
10
|
-
return (_jsxs(Box, { display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', paddingX: 'var(--spacing-tokens-size-in-px-spacing-spacing-3xl)', paddingY: 'var(--spacing-tokens-size-in-px-spacing-spacing-md)', sx: sx, className: className, children: [_jsxs(Box, { display: 'flex', flexDirection: 'row', alignItems: 'center', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-lg)', children: [_jsxs(Box, { display: 'flex', flexDirection: 'row', alignItems: 'center', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-lg)', children: [headerRightText && (_jsx(Badge, { text: headerRightText, size: BadgeSize.lg, color: BadgeColor.Green })), stepChecks() && (_jsx(Badge, { text: `Step ${currentStep} of ${totalSteps}`, size: BadgeSize.lg, color: BadgeColor.Violet }))] }), _jsxs(Box, { display: 'flex', flexDirection: 'row', alignItems: 'center', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-md)', children: [title && (_jsx(Typography, { size: TypographySize.TextM, weight: TypographyWeight.SemiBold, children: `${title}.` })), subtitle && (_jsx(Typography, { size: TypographySize.TextS, weight: TypographyWeight.Regular, children: subtitle }))] })] }), onCancelClick && (_jsx(MainButton, { text: 'Cancel Process', onClick: onCancelClick, size: ButtonSize.md, hierarchy: ButtonHierarchy.
|
|
10
|
+
return (_jsxs(Box, { display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', paddingX: 'var(--spacing-tokens-size-in-px-spacing-spacing-3xl)', paddingY: 'var(--spacing-tokens-size-in-px-spacing-spacing-md)', sx: sx, className: className, children: [_jsxs(Box, { display: 'flex', flexDirection: 'row', alignItems: 'center', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-lg)', children: [_jsxs(Box, { display: 'flex', flexDirection: 'row', alignItems: 'center', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-lg)', children: [headerRightText && (_jsx(Badge, { text: headerRightText, size: BadgeSize.lg, color: BadgeColor.Green })), stepChecks() && (_jsx(Badge, { text: `Step ${currentStep} of ${totalSteps}`, size: BadgeSize.lg, color: BadgeColor.Violet }))] }), _jsxs(Box, { display: 'flex', flexDirection: 'row', alignItems: 'center', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-md)', children: [title && (_jsx(Typography, { size: TypographySize.TextM, weight: TypographyWeight.SemiBold, children: `${title}.` })), subtitle && (_jsx(Typography, { size: TypographySize.TextS, weight: TypographyWeight.Regular, children: subtitle }))] })] }), onCancelClick && (_jsx(MainButton, { text: 'Cancel Process', onClick: onCancelClick, size: ButtonSize.md, hierarchy: ButtonHierarchy.TertiaryColor, trailingIcon: 'X', showTrailingIcon: true }))] }));
|
|
11
11
|
};
|
|
@@ -111,9 +111,9 @@ export const Sidebar = ({ size = SidebarSize.Expanded, className = '', navSectio
|
|
|
111
111
|
padding: isCollapsed ? '8px' : '0px 12px',
|
|
112
112
|
}, children: _jsx(CreditsCard, { size: isCollapsed
|
|
113
113
|
? CreditsCardSize.Collapsed
|
|
114
|
-
: CreditsCardSize.Expanded, maxCredits: credits.maxCredits, usedCredits: credits.usedCredits, creditInfoText: credits.creditInfoText, onUpgradeClick: credits.onUpgradeClick, overUsageEnabled: credits.overUsageEnabled, overUsedCredits: credits.overUsedCredits }) })), bottomNavItems.map((item, index) => (_jsx(NavItemWrapper, { item: item, isCollapsed: isCollapsed }, `bottom-${item.text}-${index}`)))] }) })] }), _jsx(ToggleButtonWrapper, { children: isCollapsed ? (_jsx(MainButton, { text: "Expand", size: ButtonSize.xxs, displayIconMode: ButtonDisplayMode.Only, displayIcon: "CaretRight", onClick: handleToggle, shape: ButtonShape.Circle, hierarchy: ButtonHierarchy.
|
|
114
|
+
: CreditsCardSize.Expanded, maxCredits: credits.maxCredits, usedCredits: credits.usedCredits, creditInfoText: credits.creditInfoText, onUpgradeClick: credits.onUpgradeClick, overUsageEnabled: credits.overUsageEnabled, overUsedCredits: credits.overUsedCredits }) })), bottomNavItems.map((item, index) => (_jsx(NavItemWrapper, { item: item, isCollapsed: isCollapsed }, `bottom-${item.text}-${index}`)))] }) })] }), _jsx(ToggleButtonWrapper, { children: isCollapsed ? (_jsx(MainButton, { text: "Expand", size: ButtonSize.xxs, displayIconMode: ButtonDisplayMode.Only, displayIcon: "CaretRight", onClick: handleToggle, shape: ButtonShape.Circle, hierarchy: ButtonHierarchy.Tertiary, style: {
|
|
115
115
|
boxShadow: '2px 4px 8px 0px #1D142814',
|
|
116
|
-
} })) : (_jsx(MainButton, { size: ButtonSize.xxs, text: "Collapse", hierarchy: ButtonHierarchy.
|
|
116
|
+
} })) : (_jsx(MainButton, { size: ButtonSize.xxs, text: "Collapse", hierarchy: ButtonHierarchy.Tertiary, displayIconMode: ButtonDisplayMode.Only, displayIcon: "CaretLeft", onClick: handleToggle, style: {
|
|
117
117
|
boxShadow: '2px 4px 8px 0px #1D142814',
|
|
118
118
|
}, shape: ButtonShape.Circle })) })] }));
|
|
119
119
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { SxProps, Theme } from '@mui/material';
|
|
2
2
|
import { IconName } from '../../utils';
|
|
3
3
|
import { AvatarProps } from '../UI';
|
|
4
|
+
import { CreditsCardProps } from '../Credits';
|
|
4
5
|
/**
|
|
5
6
|
* Header component props
|
|
6
7
|
*/
|
|
@@ -148,14 +149,7 @@ export interface SidebarProps {
|
|
|
148
149
|
/**
|
|
149
150
|
* Credits information
|
|
150
151
|
*/
|
|
151
|
-
credits?:
|
|
152
|
-
maxCredits: number;
|
|
153
|
-
usedCredits: number;
|
|
154
|
-
creditInfoText?: string;
|
|
155
|
-
onUpgradeClick?: () => void;
|
|
156
|
-
overUsageEnabled?: boolean;
|
|
157
|
-
overUsedCredits?: number;
|
|
158
|
-
};
|
|
152
|
+
credits?: Omit<CreditsCardProps, 'size' | 'className'>;
|
|
159
153
|
/**
|
|
160
154
|
* Optional callback when sidebar is toggled
|
|
161
155
|
*/
|
package/dist/utils/common.d.ts
CHANGED
package/dist/utils/common.js
CHANGED
|
@@ -6,3 +6,16 @@ export const getInitials = (text) => {
|
|
|
6
6
|
.map((word) => word[0]?.toUpperCase())
|
|
7
7
|
.join('');
|
|
8
8
|
};
|
|
9
|
+
export const formatNumberShort = (num) => {
|
|
10
|
+
const sign = num < 0 ? '-' : '';
|
|
11
|
+
num = Math.abs(num);
|
|
12
|
+
if (num < 1000)
|
|
13
|
+
return `${sign}${num}`;
|
|
14
|
+
const units = ['', 'K', 'M', 'B', 'T', 'Q'];
|
|
15
|
+
const tier = Math.min(Math.floor(Math.log10(num) / 3), units.length - 1);
|
|
16
|
+
const suffix = units[tier];
|
|
17
|
+
const scale = Math.pow(10, tier * 3);
|
|
18
|
+
const scaled = num / scale;
|
|
19
|
+
const formatted = scaled % 1 === 0 ? scaled.toString() : scaled.toFixed(1);
|
|
20
|
+
return `${sign}${formatted}${suffix}`;
|
|
21
|
+
};
|