@beydesign/storybook 0.0.98 → 0.1.0
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/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/stories/Credits/CreditsCard.js +2 -3
- package/dist/stories/Credits/CreditsCard.stories.js +2 -1
- package/dist/stories/Credits/types.d.ts +0 -4
- package/dist/stories/Navigation/Sidebar.js +1 -1
- package/dist/stories/Navigation/Sidebar.stories.js +0 -3
- package/dist/stories/StripeProduct/StripeProduct.d.ts +3 -0
- package/dist/stories/StripeProduct/StripeProduct.js +26 -0
- package/dist/stories/StripeProduct/StripeProduct.stories.d.ts +10 -0
- package/dist/stories/StripeProduct/StripeProduct.stories.js +110 -0
- package/dist/stories/StripeProduct/index.d.ts +2 -0
- package/dist/stories/StripeProduct/index.js +2 -0
- package/dist/stories/StripeProduct/types.d.ts +31 -0
- package/dist/stories/StripeProduct/types.js +1 -0
- package/dist/stories/UI/Badge.d.ts +1 -1
- package/dist/stories/UI/Badge.js +2 -2
- package/dist/utils/common.js +4 -5
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -41,14 +41,13 @@ const TextWrapper = styled.span `
|
|
|
41
41
|
display: inline-block;
|
|
42
42
|
white-space: nowrap;
|
|
43
43
|
`;
|
|
44
|
-
export const CreditsCard = ({ size = CreditsCardSize.Expanded, className, maxCredits = 1, usedCredits = 0, onUpgradeClick,
|
|
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
45
|
const isCollapsed = size === CreditsCardSize.Collapsed;
|
|
46
46
|
const creditsLimitReached = usedCredits >= maxCredits;
|
|
47
47
|
const case1 = overUsageEnabled && overUsedCredits > 0; // if over usage is enabled and over used credits are greater than 0
|
|
48
48
|
const case2 = case1 || !creditsLimitReached; // if case 1 is true or credits limit is not reached
|
|
49
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
|
|
51
50
|
const availableCredits = creditsLimitReached ? 0 : maxCredits - usedCredits;
|
|
52
51
|
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: [
|
|
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(--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" }) })), !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(--colors-light-text-text-title)", children: `Overused: ${overUsedCredits}` }) }) })), _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 }) }) })] })), 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?.() }) })] }))] }));
|
|
54
53
|
};
|
|
@@ -14,7 +14,8 @@ const meta = {
|
|
|
14
14
|
},
|
|
15
15
|
maxCredits: { control: 'number' },
|
|
16
16
|
usedCredits: { control: 'number' },
|
|
17
|
-
|
|
17
|
+
managedAgentsInfoText: { control: 'text' },
|
|
18
|
+
speechToVideoInfoText: { control: 'text' },
|
|
18
19
|
overUsageEnabled: { control: 'boolean' },
|
|
19
20
|
overUsedCredits: { control: 'number' },
|
|
20
21
|
},
|
|
@@ -28,10 +28,6 @@ export interface CreditsCardProps {
|
|
|
28
28
|
* Function to handle upgrade button click
|
|
29
29
|
*/
|
|
30
30
|
onUpgradeClick?: () => void;
|
|
31
|
-
/**
|
|
32
|
-
* Text explaining credit usage (e.g., "1 Credit = 1 min video")
|
|
33
|
-
*/
|
|
34
|
-
creditInfoText?: string;
|
|
35
31
|
/**
|
|
36
32
|
* Text explaining speech to video usage (e.g., "1 Min = 100 Credits")
|
|
37
33
|
*/
|
|
@@ -111,7 +111,7 @@ 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,
|
|
114
|
+
: CreditsCardSize.Expanded, maxCredits: credits.maxCredits, usedCredits: credits.usedCredits, managedAgentsInfoText: credits.managedAgentsInfoText, speechToVideoInfoText: credits.speechToVideoInfoText, 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
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',
|
|
@@ -121,7 +121,6 @@ export const InBoxContainer = {
|
|
|
121
121
|
}, children: _jsx(Sidebar, { ...args, size: SidebarSize.Expanded, navSections: defaultNavSections.slice(0, 3), bottomNavItems: defaultBottomNavItems, credits: {
|
|
122
122
|
maxCredits: 50,
|
|
123
123
|
usedCredits: 130,
|
|
124
|
-
creditInfoText: '1 Credit = 1 min video',
|
|
125
124
|
overUsageEnabled: true,
|
|
126
125
|
overUsedCredits: 20,
|
|
127
126
|
} }) }), _jsx(Box, { sx: { height: '100dvh', width: 'calc(100dvw)', overflow: 'hidden' }, children: _jsx(Typography, { children: "Lorem ipsum dolor sit amet consectetur adipisicing elit. Quisquam, quos." }) })] })),
|
|
@@ -134,7 +133,6 @@ export const Expanded = {
|
|
|
134
133
|
credits: {
|
|
135
134
|
maxCredits: 50,
|
|
136
135
|
usedCredits: 10,
|
|
137
|
-
creditInfoText: '1 Credit = 1 min video',
|
|
138
136
|
},
|
|
139
137
|
},
|
|
140
138
|
};
|
|
@@ -146,7 +144,6 @@ export const Collapsed = {
|
|
|
146
144
|
credits: {
|
|
147
145
|
maxCredits: 50,
|
|
148
146
|
usedCredits: 102,
|
|
149
|
-
creditInfoText: '1 Credit = 1 min video',
|
|
150
147
|
overUsageEnabled: true,
|
|
151
148
|
overUsedCredits: 20,
|
|
152
149
|
},
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box } from '@mui/material';
|
|
3
|
+
import { Typography, TypographySize, TypographyWeight } from '../Typography';
|
|
4
|
+
import { ButtonHierarchy, ButtonSize, MainButton } from '../Buttons';
|
|
5
|
+
import { getIconComponent } from '../../utils';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import { Badge, BadgeColor, BadgeSize } from '../UI';
|
|
8
|
+
export const StripeProduct = ({ className, description, features, isMostPopular, isEnterprisePlan, style, title, duration, price, buttonProps, bubbleText, bubbleTooltip, }) => {
|
|
9
|
+
return (_jsxs(Box, { display: 'flex', flexDirection: 'column', borderRadius: 'var(--spacing-tokens-size-in-px-spacing-spacing-lg)', paddingY: 'var(--spacing-tokens-size-in-px-spacing-spacing-2xl)', paddingX: 'var(--spacing-tokens-size-in-px-spacing-spacing-xl)', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-xl)', bgcolor: isMostPopular
|
|
10
|
+
? 'var(--primitives-desktop-primary-brand-violet-50)'
|
|
11
|
+
: 'var(--colors-light-background-bg-white)', border: isMostPopular
|
|
12
|
+
? '1.5px solid var(--colors-light-border-border-brand)'
|
|
13
|
+
: 'none', position: 'relative', boxShadow: '0px 0px 10px 0px rgba(0, 0, 0, 0.1)', style: style, className: className, children: [bubbleText && (_jsx(Box, { position: 'absolute', top: '-4%', right: 0, left: 0, children: _jsx(Badge, { text: bubbleText, color: BadgeColor.Yellow, children: bubbleTooltip, size: BadgeSize.xs, fill: true }) })), _jsxs(Box, { display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', children: [_jsx(Typography, { size: TypographySize.HeadingM, weight: TypographyWeight.Bold, color: 'var(--colors-light-text-text-title)', children: title }), isMostPopular && (_jsx(Box, { display: 'flex', justifyContent: 'center', alignItems: 'center', paddingX: 'var(--spacing-tokens-size-in-px-spacing-spacing-md)', paddingY: 'var(--spacing-tokens-size-in-px-spacing-spacing-xs)', bgcolor: 'var(--primitives-desktop-primary-brand-violet-200)', borderRadius: 'var(--spacing-tokens-size-in-px-radius-radius-sm)', children: _jsx(Typography, { size: TypographySize.HeadingXS, weight: TypographyWeight.Regular, color: 'var(--colors-light-text-text-accent)', children: "Most popular" }) }))] }), _jsx(Typography, { size: TypographySize.HeadingM, weight: TypographyWeight.Regular, color: 'var(--colors-light-text-text-paragraph)', textStyle: { textAlign: 'left' }, children: description }), _jsx(Box, { display: 'flex', flexDirection: 'row', justifyContent: 'flex-start', alignItems: 'end', children: isEnterprisePlan ? (_jsx(Typography, { size: TypographySize.HeadingL, weight: TypographyWeight.Bold, color: 'var(--colors-light-text-text-title)', children: "Custom" })) : (_jsxs(React.Fragment, { children: [_jsx(Typography, { size: TypographySize.HeadingL, weight: TypographyWeight.Bold, color: 'var(--colors-light-text-text-title)', children: price }), _jsxs(Typography, { size: TypographySize.HeadingXS, weight: TypographyWeight.Regular, color: 'var(--colors-light-text-text-paragraph)', children: ["/", duration] })] })) }), buttonProps && (_jsx(MainButton, { disabled: buttonProps?.disabled, onClick: buttonProps?.onClick, text: buttonProps?.text, size: buttonProps?.size || ButtonSize.lg, hierarchy: buttonProps?.hierarchy || ButtonHierarchy.Primary, style: {
|
|
14
|
+
margin: 'var(--spacing-tokens-size-in-px-spacing-spacing-3xl) 0',
|
|
15
|
+
} })), features && features?.length > 0 && (_jsxs(Box, { display: 'flex', flexDirection: 'column', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-xl)', alignItems: 'flex-start', children: [_jsx(Typography, { size: TypographySize.TextM, weight: TypographyWeight.Medium, color: 'var(--colors-light-text-text-title)', children: "This includes:" }), features.map((feature, index) => {
|
|
16
|
+
const isHeading = feature?.startsWith('-');
|
|
17
|
+
return (_jsxs(Box, { display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'flex-start', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-md)', children: [!isHeading && (_jsx(Box, { width: '18px', height: '18px', bgcolor: 'var(--primitives-desktop-primary-brand-violet-100)', borderRadius: 'var(--spacing-tokens-size-in-px-radius-radius-full)', display: 'flex', justifyContent: 'center', alignItems: 'center', children: getIconComponent('Check', {
|
|
18
|
+
size: '12px',
|
|
19
|
+
color: 'var(--primitives-desktop-primary-brand-violet-500)',
|
|
20
|
+
}) })), _jsx(Typography, { size: TypographySize.TextS, weight: isHeading
|
|
21
|
+
? TypographyWeight.Medium
|
|
22
|
+
: TypographyWeight.Regular, color: isHeading
|
|
23
|
+
? 'var(--colors-light-text-text-title)'
|
|
24
|
+
: 'var(--colors-light-text-text-paragraph)', textStyle: { textAlign: 'left' }, children: isHeading ? feature?.slice(1)?.trim() : feature })] }, `${index}`));
|
|
25
|
+
})] }))] }));
|
|
26
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { StripeProduct } from './StripeProduct';
|
|
3
|
+
declare const meta: Meta<typeof StripeProduct>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof StripeProduct>;
|
|
6
|
+
export declare const DefaultWithSubheadings: Story;
|
|
7
|
+
export declare const Default: Story;
|
|
8
|
+
export declare const MostPopular: Story;
|
|
9
|
+
export declare const EnterprisePlan: Story;
|
|
10
|
+
export declare const WithBubble: Story;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { StripeProduct } from './StripeProduct';
|
|
3
|
+
import { Tooltip } from '@mui/material';
|
|
4
|
+
import { Info } from '@phosphor-icons/react';
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'Design System/Components/StripeProduct/StripeProduct',
|
|
7
|
+
component: StripeProduct,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: 'centered',
|
|
10
|
+
design: {
|
|
11
|
+
type: 'figspec',
|
|
12
|
+
url: 'https://www.figma.com/design/LMfTHn8ncZVSVlEUGYSz4Q/Settings?node-id=3593-20344&m=dev',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
tags: ['autodocs'],
|
|
16
|
+
argTypes: {},
|
|
17
|
+
};
|
|
18
|
+
export default meta;
|
|
19
|
+
export const DefaultWithSubheadings = {
|
|
20
|
+
args: {
|
|
21
|
+
title: 'Starter',
|
|
22
|
+
description: 'Tailored for personal projects and independent creators.',
|
|
23
|
+
price: '$100',
|
|
24
|
+
duration: 'month',
|
|
25
|
+
features: [
|
|
26
|
+
'-E2E Agent API',
|
|
27
|
+
'Included Mins: 90',
|
|
28
|
+
'Bundle $/min: $0.54',
|
|
29
|
+
'Overage $/min: $0.33',
|
|
30
|
+
'-A2V Api',
|
|
31
|
+
'Included mins: 180',
|
|
32
|
+
'Bundle $/min: $0.27',
|
|
33
|
+
'Overage $/min: $0.18',
|
|
34
|
+
],
|
|
35
|
+
isMostPopular: false,
|
|
36
|
+
buttonProps: {
|
|
37
|
+
text: 'Select',
|
|
38
|
+
onClick: () => { },
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
export const Default = {
|
|
43
|
+
args: {
|
|
44
|
+
title: 'Starter',
|
|
45
|
+
description: 'Tailored for personal projects and independent creators.',
|
|
46
|
+
price: '$100',
|
|
47
|
+
duration: 'month',
|
|
48
|
+
features: [
|
|
49
|
+
'1 credit (1 min of Conversational Agent video)',
|
|
50
|
+
'5 stock Digital Twins',
|
|
51
|
+
],
|
|
52
|
+
isMostPopular: false,
|
|
53
|
+
buttonProps: {
|
|
54
|
+
text: 'Select',
|
|
55
|
+
onClick: () => { },
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
export const MostPopular = {
|
|
60
|
+
args: {
|
|
61
|
+
title: 'Growth',
|
|
62
|
+
description: 'Designed for professionals looking to expand their reach.',
|
|
63
|
+
price: '$149',
|
|
64
|
+
duration: 'month',
|
|
65
|
+
features: [
|
|
66
|
+
'300 credits (300 min of Conversational Agent video)',
|
|
67
|
+
'5 stock Digital Twins',
|
|
68
|
+
'3 active Conversational Agents',
|
|
69
|
+
'Priority support',
|
|
70
|
+
],
|
|
71
|
+
isMostPopular: true,
|
|
72
|
+
buttonProps: {
|
|
73
|
+
text: 'Select',
|
|
74
|
+
onClick: () => { },
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
export const EnterprisePlan = {
|
|
79
|
+
args: {
|
|
80
|
+
title: 'Enterprise',
|
|
81
|
+
description: 'Customized for large organizations and enterprise clients.',
|
|
82
|
+
price: 'Custom',
|
|
83
|
+
duration: 'month',
|
|
84
|
+
features: [
|
|
85
|
+
'5000+ credits (5000+ min of Conversational Agent video)',
|
|
86
|
+
'Integration support',
|
|
87
|
+
'Full customization',
|
|
88
|
+
],
|
|
89
|
+
isMostPopular: false,
|
|
90
|
+
isEnterprisePlan: true,
|
|
91
|
+
buttonProps: {
|
|
92
|
+
text: 'Contact us',
|
|
93
|
+
onClick: () => { },
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
export const WithBubble = {
|
|
98
|
+
args: {
|
|
99
|
+
title: 'Starter',
|
|
100
|
+
description: 'Tailored for personal projects and independent creators.',
|
|
101
|
+
price: '$100',
|
|
102
|
+
duration: 'month',
|
|
103
|
+
features: [
|
|
104
|
+
'1 credit (1 min of Conversational Agent video)',
|
|
105
|
+
'5 stock Digital Twins',
|
|
106
|
+
],
|
|
107
|
+
bubbleText: "You're currently on the monthly plan",
|
|
108
|
+
bubbleTooltip: (_jsx(Tooltip, { title: "You're currently on the monthly plan", placement: "top", children: _jsx(Info, {}) })),
|
|
109
|
+
},
|
|
110
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { MainButtonProps } from '../Buttons';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* Stripe product component props
|
|
5
|
+
*/
|
|
6
|
+
export interface StripeProductProps {
|
|
7
|
+
/** Title of the product */
|
|
8
|
+
title: string;
|
|
9
|
+
/** Description of the product */
|
|
10
|
+
description: string;
|
|
11
|
+
/** Price of the product */
|
|
12
|
+
price: string;
|
|
13
|
+
/** Duration of the product */
|
|
14
|
+
duration: string;
|
|
15
|
+
/** Features of the product */
|
|
16
|
+
features?: string[];
|
|
17
|
+
/** Whether the product is the most popular */
|
|
18
|
+
isMostPopular?: boolean;
|
|
19
|
+
/** Whether the product is the enterprise plan */
|
|
20
|
+
isEnterprisePlan?: boolean;
|
|
21
|
+
/** Props for the button */
|
|
22
|
+
buttonProps?: MainButtonProps;
|
|
23
|
+
/** Text of the bubble */
|
|
24
|
+
bubbleText?: string;
|
|
25
|
+
/** Tooltip of the bubble */
|
|
26
|
+
bubbleTooltip?: JSX.Element;
|
|
27
|
+
/** Style of the product */
|
|
28
|
+
style?: React.CSSProperties;
|
|
29
|
+
/** Class name of the product */
|
|
30
|
+
className?: string;
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/stories/UI/Badge.js
CHANGED
|
@@ -3,7 +3,7 @@ import { BadgeColor, BadgeSize } from './types';
|
|
|
3
3
|
import { Box } from '@mui/material';
|
|
4
4
|
import { Typography, TypographySize, TypographyWeight } from '../Typography';
|
|
5
5
|
import { getIconComponent } from '../../utils';
|
|
6
|
-
export const Badge = ({ color = BadgeColor.Default, size = BadgeSize.md, text, style: customStyle, icon = 'Cactus', showIcon = false, fill = true, iconWeight = 'regular', iconSize, iconColor, }) => {
|
|
6
|
+
export const Badge = ({ color = BadgeColor.Default, size = BadgeSize.md, text, children, style: customStyle, icon = 'Cactus', showIcon = false, fill = true, iconWeight = 'regular', iconSize, iconColor, }) => {
|
|
7
7
|
const getBackgroundColor = (color) => {
|
|
8
8
|
switch (color) {
|
|
9
9
|
case BadgeColor.Default:
|
|
@@ -114,5 +114,5 @@ export const Badge = ({ color = BadgeColor.Default, size = BadgeSize.md, text, s
|
|
|
114
114
|
color: iconColor || getTextColor(),
|
|
115
115
|
weight: iconWeight,
|
|
116
116
|
};
|
|
117
|
-
return (_jsxs(Box, { display: "flex", alignItems: "center", justifyContent: "center", bgcolor: fill ? backgroundColor : 'transparent', border: fill ? border : 'none', borderRadius: fill ? 'var(--spacing-tokens-size-in-px-radius-radius-full)' : 'none', padding: padding, margin: 0, gap: "4px", sx: customStyle, children: [showIcon && icon && getIconComponent(icon, iconProps), text && (_jsx(Typography, { size: getTypographySize(size), weight: TypographyWeight.Medium, color: getTextColor(), children: text }))] }));
|
|
117
|
+
return (_jsxs(Box, { display: "flex", alignItems: "center", justifyContent: "center", bgcolor: fill ? backgroundColor : 'transparent', border: fill ? border : 'none', borderRadius: fill ? 'var(--spacing-tokens-size-in-px-radius-radius-full)' : 'none', padding: padding, margin: 0, gap: "4px", sx: customStyle, children: [showIcon && icon && getIconComponent(icon, iconProps), text && (_jsx(Typography, { size: getTypographySize(size), weight: TypographyWeight.Medium, color: getTextColor(), children: text })), children] }));
|
|
118
118
|
};
|
package/dist/utils/common.js
CHANGED
|
@@ -10,12 +10,11 @@ export const formatNumberShort = (num) => {
|
|
|
10
10
|
const sign = num < 0 ? '-' : '';
|
|
11
11
|
num = Math.abs(num);
|
|
12
12
|
if (num < 1000)
|
|
13
|
-
return `${sign}${num}`;
|
|
14
|
-
const units = ['', '
|
|
13
|
+
return `${sign}${Math.floor(num)}`;
|
|
14
|
+
const units = ['', 'k', 'm', 'b', 't', 'q'];
|
|
15
15
|
const tier = Math.min(Math.floor(Math.log10(num) / 3), units.length - 1);
|
|
16
16
|
const suffix = units[tier];
|
|
17
17
|
const scale = Math.pow(10, tier * 3);
|
|
18
|
-
const scaled = num / scale;
|
|
19
|
-
|
|
20
|
-
return `${sign}${formatted}${suffix}`;
|
|
18
|
+
const scaled = Math.floor(num / scale);
|
|
19
|
+
return `${sign}${scaled}${suffix}`;
|
|
21
20
|
};
|