@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,21 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { LayoutType } from './types';
|
|
4
|
+
import { Box } from '@mui/material';
|
|
5
|
+
import { ButtonDisplayMode, ButtonSize, MainButton } from '../Buttons';
|
|
6
|
+
import { ButtonHierarchy } from '../Buttons';
|
|
7
|
+
import { Typography, TypographySize, TypographyWeight } from '../Typography';
|
|
8
|
+
import { Badge, BadgeColor, BadgeSize } from '../UI';
|
|
9
|
+
import { AutoComplete } from '../Form/AutoComplete';
|
|
10
|
+
export const ComplexHeader = ({ title = 'Title', badgeText = '22', newButtonText = 'New', onNewClick, onOutputFileClick, onDownloadAllClick, onLayoutChange, className, sx, }) => {
|
|
11
|
+
const [layoutType, setLayoutType] = useState(LayoutType.Grid);
|
|
12
|
+
const handleLayoutChange = (type) => {
|
|
13
|
+
setLayoutType(type);
|
|
14
|
+
onLayoutChange?.(type);
|
|
15
|
+
};
|
|
16
|
+
return (_jsxs(Box, { className: className, display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', borderBottom: '1px solid var(--color-border-border-component)', bgcolor: 'var(--color-background-bg-page-contrast)', 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.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
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import styles from './Header.module.css';
|
|
2
|
+
import { ComplexHeader } from './ComplexHeader';
|
|
3
|
+
const meta = {
|
|
4
|
+
title: 'Design System/Components/Navigation/ComplexHeader',
|
|
5
|
+
component: ComplexHeader,
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: 'centered',
|
|
8
|
+
design: {
|
|
9
|
+
type: 'figspec',
|
|
10
|
+
url: 'https://www.figma.com/design/mIhjz2yJjcpLlIqw6oUivt/Beyond-Presence?node-id=4781-5713&t=vdrrXyG9txidDmlc-1',
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
tags: ['autodocs'],
|
|
14
|
+
argTypes: {
|
|
15
|
+
title: {
|
|
16
|
+
control: 'text',
|
|
17
|
+
description: 'Title of the header',
|
|
18
|
+
table: {
|
|
19
|
+
type: { summary: 'string' },
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
badgeText: {
|
|
23
|
+
control: 'text',
|
|
24
|
+
description: 'Text of the badge',
|
|
25
|
+
table: {
|
|
26
|
+
type: { summary: 'string' },
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
newButtonText: {
|
|
30
|
+
control: 'text',
|
|
31
|
+
description: 'Text of the new button',
|
|
32
|
+
table: {
|
|
33
|
+
type: { summary: 'string' },
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
onNewClick: {
|
|
37
|
+
description: 'Callback function to handle new button click',
|
|
38
|
+
table: {
|
|
39
|
+
type: { summary: 'function' },
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
onOutputFileClick: {
|
|
43
|
+
description: 'Callback function to handle output file button click',
|
|
44
|
+
table: {
|
|
45
|
+
type: { summary: 'function' },
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
onDownloadAllClick: {
|
|
49
|
+
description: 'Callback function to handle download all button click',
|
|
50
|
+
table: {
|
|
51
|
+
type: { summary: 'function' },
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
onLayoutChange: {
|
|
55
|
+
description: 'Callback function to handle layout change',
|
|
56
|
+
table: {
|
|
57
|
+
type: { summary: 'function' },
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
className: {
|
|
61
|
+
control: 'text',
|
|
62
|
+
description: 'Custom class name for the header',
|
|
63
|
+
table: {
|
|
64
|
+
type: { summary: 'string' },
|
|
65
|
+
defaultValue: { summary: styles['responsive-width'] },
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
export default meta;
|
|
71
|
+
export const Default = {
|
|
72
|
+
args: {
|
|
73
|
+
title: 'Beyond Presence',
|
|
74
|
+
badgeText: '22',
|
|
75
|
+
newButtonText: 'New Agent',
|
|
76
|
+
onNewClick: () => { },
|
|
77
|
+
onOutputFileClick: () => { },
|
|
78
|
+
onDownloadAllClick: () => { },
|
|
79
|
+
onLayoutChange: () => { },
|
|
80
|
+
className: styles['responsive-width'],
|
|
81
|
+
},
|
|
82
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box } from '@mui/material';
|
|
3
|
+
import { MainButton } from '../Buttons';
|
|
4
|
+
import { ButtonHierarchy, ButtonSize } from '../Buttons';
|
|
5
|
+
import { Typography, TypographySize, TypographyWeight } from '../Typography';
|
|
6
|
+
import { Avatar, AvatarSize } from '../UI';
|
|
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(--color-border-border-component)', bgcolor: 'var(--color-background-bg-page-contrast)', 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
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { Header } from './Header';
|
|
3
|
+
declare const meta: Meta<typeof Header>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Header>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const WithBackButton: Story;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { Header } from './Header';
|
|
2
|
+
import { AvatarStyle } from '../UI';
|
|
3
|
+
import styles from './Header.module.css';
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'Design System/Components/Navigation/Header',
|
|
6
|
+
component: Header,
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: 'centered',
|
|
9
|
+
design: {
|
|
10
|
+
type: 'figspec',
|
|
11
|
+
url: 'https://www.figma.com/design/mIhjz2yJjcpLlIqw6oUivt/Beyond-Presence?node-id=5115-3325&t=DxHE3Y7uZLPwM9mQ-1',
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
tags: ['autodocs'],
|
|
15
|
+
argTypes: {
|
|
16
|
+
title: {
|
|
17
|
+
control: 'text',
|
|
18
|
+
description: 'Title of the header',
|
|
19
|
+
table: {
|
|
20
|
+
type: { summary: 'string' },
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
email: {
|
|
24
|
+
control: 'text',
|
|
25
|
+
description: 'Email of the logged in user',
|
|
26
|
+
table: {
|
|
27
|
+
type: { summary: 'string' },
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
avatarProps: {
|
|
31
|
+
control: 'object',
|
|
32
|
+
description: 'Avatar props',
|
|
33
|
+
table: {
|
|
34
|
+
type: { summary: 'object' },
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
backButtonText: {
|
|
38
|
+
control: 'text',
|
|
39
|
+
description: 'Text of the back button',
|
|
40
|
+
table: {
|
|
41
|
+
type: { summary: 'string' },
|
|
42
|
+
defaultValue: { summary: 'Back' },
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
onBackClick: {
|
|
46
|
+
description: 'Callback function to handle back button click',
|
|
47
|
+
table: {
|
|
48
|
+
type: { summary: 'function' },
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
onLogoutClick: {
|
|
52
|
+
description: 'Callback function to handle logout button click',
|
|
53
|
+
table: {
|
|
54
|
+
type: { summary: 'function' },
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
className: {
|
|
58
|
+
control: 'text',
|
|
59
|
+
description: 'Custom class name for the header',
|
|
60
|
+
table: {
|
|
61
|
+
type: { summary: 'string' },
|
|
62
|
+
defaultValue: { summary: styles['responsive-width'] },
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
export default meta;
|
|
68
|
+
export const Default = {
|
|
69
|
+
args: {
|
|
70
|
+
title: 'Beyond Presence',
|
|
71
|
+
email: 'john.doe@example.com',
|
|
72
|
+
avatarProps: {
|
|
73
|
+
avatarStyle: AvatarStyle.Placeholder,
|
|
74
|
+
text: 'John Doe',
|
|
75
|
+
},
|
|
76
|
+
backButtonText: 'Back',
|
|
77
|
+
onLogoutClick: () => { },
|
|
78
|
+
className: styles['responsive-width'],
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
export const WithBackButton = {
|
|
82
|
+
args: {
|
|
83
|
+
...Default.args,
|
|
84
|
+
backButtonText: 'Back',
|
|
85
|
+
onBackClick: () => { },
|
|
86
|
+
},
|
|
87
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import styled from '@emotion/styled';
|
|
3
|
+
import { NavItemState, NavItemSize } from './types';
|
|
4
|
+
import { Typography, TypographySize, TypographyWeight } from '../Typography';
|
|
5
|
+
import { Badge, BadgeColor, BadgeSize } from '../UI';
|
|
6
|
+
import { Box } from '@mui/material';
|
|
7
|
+
import { getIconComponent } from '../../utils';
|
|
8
|
+
const StyledNavItem = styled.div `
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-direction: row;
|
|
11
|
+
align-items: center;
|
|
12
|
+
gap: 12px;
|
|
13
|
+
padding: ${({ $size }) => $size === NavItemSize.Collapsed ? '8px 28px' : '8px 60px 8px 28px'};
|
|
14
|
+
border-radius: 8px;
|
|
15
|
+
cursor: ${({ $state }) => $state === NavItemState.Disabled ? 'not-allowed' : 'pointer'};
|
|
16
|
+
opacity: ${({ $state }) => ($state === NavItemState.Disabled ? 0.5 : 1)};
|
|
17
|
+
transition: padding 0.3s ease-in-out;
|
|
18
|
+
justify-content: ${({ $size }) => $size === NavItemSize.Collapsed ? 'center' : 'flex-start'};
|
|
19
|
+
|
|
20
|
+
&:hover {
|
|
21
|
+
.nav-item-icon {
|
|
22
|
+
color: ${({ $state }) => $state === NavItemState.Disabled
|
|
23
|
+
? 'var(--color-text-text-subtle)'
|
|
24
|
+
: 'var(--color-background-bg-brand-primary-hover)'} !important;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.nav-item-text {
|
|
28
|
+
color: ${({ $state }) => $state === NavItemState.Disabled
|
|
29
|
+
? 'var(--color-text-text-subtle)'
|
|
30
|
+
: 'var(--color-background-bg-brand-primary-hover)'} !important;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
`;
|
|
34
|
+
// Custom styled span to handle icon color changes
|
|
35
|
+
const IconWrapper = styled.span `
|
|
36
|
+
display: inline-flex;
|
|
37
|
+
color: ${({ $state }) => $state === NavItemState.Active
|
|
38
|
+
? 'var(--color-background-bg-brand-primary)'
|
|
39
|
+
: 'var(--color-text-text-paragraph)'};
|
|
40
|
+
transition: color 0.3s ease-in-out;
|
|
41
|
+
`;
|
|
42
|
+
const TextWrapper = styled.span `
|
|
43
|
+
display: inline-block;
|
|
44
|
+
white-space: nowrap;
|
|
45
|
+
`;
|
|
46
|
+
export const NavItem = ({ text, icon, state = NavItemState.Default, size = NavItemSize.Expanded, showBadge = false, onClick, className, }) => {
|
|
47
|
+
const handleClick = () => {
|
|
48
|
+
if (state !== NavItemState.Disabled && onClick) {
|
|
49
|
+
onClick();
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
const isCollapsed = size === NavItemSize.Collapsed;
|
|
53
|
+
return (_jsxs(StyledNavItem, { "$state": state, "$size": size, onClick: handleClick, className: className, title: isCollapsed ? text : undefined, children: [_jsx("svg", { width: "5", height: "36", viewBox: "0 0 5 36", fill: state === NavItemState.Active
|
|
54
|
+
? 'var(--color-background-bg-brand-primary)'
|
|
55
|
+
: 'transparent', xmlns: "http://www.w3.org/2000/svg", style: {
|
|
56
|
+
transition: 'fill 0.3s ease-in-out',
|
|
57
|
+
position: 'absolute',
|
|
58
|
+
left: '0',
|
|
59
|
+
}, children: _jsx("path", { d: "M0 0C2.76142 0 5 2.23858 5 5V31C5 33.7614 2.76142 36 0 36V0Z" }) }), _jsxs(Box, { display: "flex", alignItems: "center", gap: "8px", sx: { transition: 'gap 0.3s ease-in-out' }, children: [_jsx(IconWrapper, { className: "nav-item-icon", "$state": state, children: getIconComponent(icon, {
|
|
60
|
+
size: 20,
|
|
61
|
+
}) }), !isCollapsed && (_jsx(TextWrapper, { className: "nav-item-text", children: _jsx(Typography, { size: TypographySize.TextS, weight: state === NavItemState.Active
|
|
62
|
+
? TypographyWeight.SemiBold
|
|
63
|
+
: TypographyWeight.Medium, className: "nav-item-text", color: state === NavItemState.Active
|
|
64
|
+
? 'var(--color-background-bg-brand-primary)'
|
|
65
|
+
: 'var(--color-text-text-paragraph)', children: text }) })), showBadge && !isCollapsed && (_jsx(Badge, { size: BadgeSize.xs, icon: "ClockCountdown", showIcon: true, text: "Coming Soon", color: BadgeColor.Default }))] })] }));
|
|
66
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { NavItem } from './NavItem';
|
|
3
|
+
declare const meta: Meta<typeof NavItem>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof NavItem>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const Active: Story;
|
|
8
|
+
export declare const Disabled: Story;
|
|
9
|
+
export declare const Expanded: Story;
|
|
10
|
+
export declare const Collapsed: Story;
|
|
11
|
+
export declare const WithComingSoonBadge: Story;
|
|
12
|
+
export declare const SidebarExpanded: Story;
|
|
13
|
+
export declare const SidebarCollapsed: Story;
|
|
14
|
+
export declare const DifferentIcons: Story;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { NavItem } from './NavItem';
|
|
3
|
+
import { NavItemState, NavItemSize } from './types';
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'Design System/Components/Navigation/NavItem',
|
|
6
|
+
component: NavItem,
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: 'centered',
|
|
9
|
+
},
|
|
10
|
+
tags: ['autodocs'],
|
|
11
|
+
argTypes: {
|
|
12
|
+
text: { control: 'text' },
|
|
13
|
+
icon: { control: 'text' },
|
|
14
|
+
state: {
|
|
15
|
+
control: 'select',
|
|
16
|
+
options: Object.values(NavItemState),
|
|
17
|
+
},
|
|
18
|
+
size: {
|
|
19
|
+
control: 'select',
|
|
20
|
+
options: Object.values(NavItemSize),
|
|
21
|
+
},
|
|
22
|
+
showBadge: { control: 'boolean' },
|
|
23
|
+
onClick: { action: 'clicked' },
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
export default meta;
|
|
27
|
+
export const Default = {
|
|
28
|
+
args: {
|
|
29
|
+
text: 'Navigation Item',
|
|
30
|
+
icon: 'House',
|
|
31
|
+
state: NavItemState.Default,
|
|
32
|
+
size: NavItemSize.Expanded,
|
|
33
|
+
showBadge: false,
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
export const Active = {
|
|
37
|
+
args: {
|
|
38
|
+
text: 'Active Item',
|
|
39
|
+
icon: 'House',
|
|
40
|
+
state: NavItemState.Active,
|
|
41
|
+
size: NavItemSize.Expanded,
|
|
42
|
+
showBadge: false,
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
export const Disabled = {
|
|
46
|
+
args: {
|
|
47
|
+
text: 'Disabled Item',
|
|
48
|
+
icon: 'House',
|
|
49
|
+
state: NavItemState.Disabled,
|
|
50
|
+
size: NavItemSize.Expanded,
|
|
51
|
+
showBadge: false,
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
export const Expanded = {
|
|
55
|
+
args: {
|
|
56
|
+
text: 'Expanded Item',
|
|
57
|
+
icon: 'House',
|
|
58
|
+
size: NavItemSize.Expanded,
|
|
59
|
+
showBadge: false,
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
export const Collapsed = {
|
|
63
|
+
args: {
|
|
64
|
+
text: 'Collapsed Item',
|
|
65
|
+
icon: 'House',
|
|
66
|
+
size: NavItemSize.Collapsed,
|
|
67
|
+
showBadge: false,
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
export const WithComingSoonBadge = {
|
|
71
|
+
args: {
|
|
72
|
+
text: 'New Feature',
|
|
73
|
+
icon: 'Sparkle',
|
|
74
|
+
showBadge: true,
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
export const SidebarExpanded = {
|
|
78
|
+
render: () => (_jsxs("div", { style: {
|
|
79
|
+
display: 'flex',
|
|
80
|
+
flexDirection: 'column',
|
|
81
|
+
gap: '8px',
|
|
82
|
+
padding: '16px',
|
|
83
|
+
backgroundColor: 'var(--color-background-bg-white)',
|
|
84
|
+
borderRadius: '8px',
|
|
85
|
+
boxShadow: '0 2px 8px rgba(0, 0, 0, 0.1)',
|
|
86
|
+
}, children: [_jsx(NavItem, { text: "Home", icon: "House", size: NavItemSize.Expanded, state: NavItemState.Active }), _jsx(NavItem, { text: "Settings", icon: "Gear", size: NavItemSize.Expanded }), _jsx(NavItem, { text: "Notifications", icon: "Bell", size: NavItemSize.Expanded }), _jsx(NavItem, { text: "Messages", icon: "ChatText", size: NavItemSize.Expanded }), _jsx(NavItem, { text: "Profile", icon: "User", size: NavItemSize.Expanded }), _jsx(NavItem, { text: "Analytics", icon: "ChartBar", size: NavItemSize.Expanded, showBadge: true, state: NavItemState.Disabled })] })),
|
|
87
|
+
};
|
|
88
|
+
export const SidebarCollapsed = {
|
|
89
|
+
render: () => (_jsxs("div", { style: {
|
|
90
|
+
display: 'flex',
|
|
91
|
+
flexDirection: 'column',
|
|
92
|
+
gap: '8px',
|
|
93
|
+
backgroundColor: 'var(--color-background-bg-white)',
|
|
94
|
+
borderRadius: '8px',
|
|
95
|
+
boxShadow: '0 2px 8px rgba(0, 0, 0, 0.1)',
|
|
96
|
+
}, children: [_jsx(NavItem, { text: "Home", icon: "House", size: NavItemSize.Collapsed, state: NavItemState.Active }), _jsx(NavItem, { text: "Settings", icon: "Gear", size: NavItemSize.Collapsed }), _jsx(NavItem, { text: "Notifications", icon: "Bell", size: NavItemSize.Collapsed }), _jsx(NavItem, { text: "Messages", icon: "ChatText", size: NavItemSize.Collapsed }), _jsx(NavItem, { text: "Profile", icon: "User", size: NavItemSize.Collapsed }), _jsx(NavItem, { text: "Analytics", icon: "ChartBar", state: NavItemState.Disabled, size: NavItemSize.Collapsed })] })),
|
|
97
|
+
};
|
|
98
|
+
export const DifferentIcons = {
|
|
99
|
+
render: () => (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '8px' }, children: [_jsx(NavItem, { text: "Home", icon: "House" }), _jsx(NavItem, { text: "Settings", icon: "Gear" }), _jsx(NavItem, { text: "Notifications", icon: "Bell" }), _jsx(NavItem, { text: "Messages", icon: "ChatText" }), _jsx(NavItem, { text: "Profile", icon: "User" }), _jsx(NavItem, { text: "Analytics", icon: "ChartBar", showBadge: true })] })),
|
|
100
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box } from '@mui/material';
|
|
3
|
+
import { Badge, BadgeColor, BadgeSize } from '../UI';
|
|
4
|
+
import { Typography, TypographySize, TypographyWeight } from '../Typography';
|
|
5
|
+
import { ButtonHierarchy, ButtonSize, MainButton } from '../Buttons';
|
|
6
|
+
export const ProcessHeader = ({ title, currentStep, subtitle, totalSteps, headerRightText, onCancelClick, sx, className, }) => {
|
|
7
|
+
const stepChecks = () => {
|
|
8
|
+
return (currentStep && totalSteps && currentStep >= 1 && currentStep <= totalSteps);
|
|
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.TertiaryColor, trailingIcon: 'X', showTrailingIcon: true }))] }));
|
|
11
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { ProcessHeader } from './ProcessHeader';
|
|
2
|
+
import styles from './Header.module.css';
|
|
3
|
+
const meta = {
|
|
4
|
+
title: 'Design System/Components/Navigation/ProcessHeader',
|
|
5
|
+
component: ProcessHeader,
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: 'centered',
|
|
8
|
+
design: {
|
|
9
|
+
type: 'figspec',
|
|
10
|
+
url: 'https://www.figma.com/design/Ze4bBHgBQYinBDZr1COHuk/Agents?node-id=1928-68769&t=ff7acatvxaY98hGj-1',
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
tags: ['autodocs'],
|
|
14
|
+
argTypes: {
|
|
15
|
+
title: {
|
|
16
|
+
control: 'text',
|
|
17
|
+
description: 'Title of the header',
|
|
18
|
+
table: {
|
|
19
|
+
type: { summary: 'string' },
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
subtitle: {
|
|
23
|
+
control: 'text',
|
|
24
|
+
description: 'Subtitle of the header',
|
|
25
|
+
table: {
|
|
26
|
+
type: { summary: 'string' },
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
currentStep: {
|
|
30
|
+
control: 'number',
|
|
31
|
+
description: 'Current step of the process',
|
|
32
|
+
table: {
|
|
33
|
+
type: { summary: 'number' },
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
totalSteps: {
|
|
37
|
+
control: 'number',
|
|
38
|
+
description: 'Total steps of the process',
|
|
39
|
+
table: {
|
|
40
|
+
type: { summary: 'number' },
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
headerRightText: {
|
|
44
|
+
control: 'text',
|
|
45
|
+
description: 'Text to display in the header right',
|
|
46
|
+
table: {
|
|
47
|
+
type: { summary: 'string' },
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
onCancelClick: {
|
|
51
|
+
description: 'Callback to handle the cancel button click',
|
|
52
|
+
table: {
|
|
53
|
+
type: { summary: 'function' },
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
sx: {
|
|
57
|
+
control: 'object',
|
|
58
|
+
description: 'Style object to apply to the component',
|
|
59
|
+
table: {
|
|
60
|
+
type: { summary: 'object' },
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
export default meta;
|
|
66
|
+
export const Default = {
|
|
67
|
+
args: {
|
|
68
|
+
title: 'Train Agent',
|
|
69
|
+
subtitle: 'Please fill in the necessary information for your agent & upload knowledge files.',
|
|
70
|
+
currentStep: 3,
|
|
71
|
+
totalSteps: 3,
|
|
72
|
+
headerRightText: 'New Agent',
|
|
73
|
+
onCancelClick: () => { },
|
|
74
|
+
className: styles['responsive-width'],
|
|
75
|
+
},
|
|
76
|
+
};
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
|
+
import styled from '@emotion/styled';
|
|
4
|
+
import { Box } from '@mui/material';
|
|
5
|
+
import { NavItem } from './NavItem';
|
|
6
|
+
import { Logo, LogoVariant } from '../UI';
|
|
7
|
+
import { CreditsCard, CreditsCardSize, CreditsCardSkeleton } from '../Credits';
|
|
8
|
+
import { SidebarSize, NavItemSize, NavItemState, } from './types';
|
|
9
|
+
import { Typography, TypographySize, TypographyWeight } from '../Typography';
|
|
10
|
+
import { MainButton, ButtonDisplayMode, ButtonHierarchy, ButtonShape, ButtonSize, } from '../Buttons';
|
|
11
|
+
const StyledSidebar = styled.div `
|
|
12
|
+
display: flex;
|
|
13
|
+
flex-direction: column;
|
|
14
|
+
background-color: var(--color-background-bg-component);
|
|
15
|
+
border-right: 1px solid var(--color-border-border-component);
|
|
16
|
+
height: 100vh;
|
|
17
|
+
width: ${({ $size }) => ($size === SidebarSize.Expanded ? '280px' : '80px')};
|
|
18
|
+
transition: width 0.3s ease-in-out;
|
|
19
|
+
overflow-x: hidden;
|
|
20
|
+
overflow-y: scroll;
|
|
21
|
+
position: relative;
|
|
22
|
+
padding: 16px 0px 24px 0px;
|
|
23
|
+
`;
|
|
24
|
+
const SidebarContainer = styled.div `
|
|
25
|
+
position: relative;
|
|
26
|
+
height: 100%;
|
|
27
|
+
background: linear-gradient(180deg, #ffffff 77.85%, #f4edff 115.17%);
|
|
28
|
+
`;
|
|
29
|
+
const LogoContainer = styled.div `
|
|
30
|
+
display: flex;
|
|
31
|
+
align-items: center;
|
|
32
|
+
justify-content: ${({ $size }) => $size === SidebarSize.Expanded ? 'left' : 'center'};
|
|
33
|
+
margin-bottom: 32px;
|
|
34
|
+
min-height: 38px;
|
|
35
|
+
height: 38px;
|
|
36
|
+
transition: all 0.3s ease-in-out;
|
|
37
|
+
padding: ${({ $size }) => $size === SidebarSize.Expanded ? '0px 28px' : '0px'};
|
|
38
|
+
`;
|
|
39
|
+
const ToggleButtonWrapper = styled.div `
|
|
40
|
+
position: absolute;
|
|
41
|
+
top: 1.5rem;
|
|
42
|
+
right: -1rem;
|
|
43
|
+
z-index: 99;
|
|
44
|
+
pointer-events: auto;
|
|
45
|
+
visibility: visible;
|
|
46
|
+
filter: drop-shadow(0px 2px 4px rgba(29, 20, 40, 0.08));
|
|
47
|
+
contain: layout;
|
|
48
|
+
transition: transform 0.3s ease-in-out;
|
|
49
|
+
`;
|
|
50
|
+
const NavItemsContainer = styled.div `
|
|
51
|
+
display: flex;
|
|
52
|
+
flex-direction: column;
|
|
53
|
+
flex: 1;
|
|
54
|
+
`;
|
|
55
|
+
const NavSection = styled.div `
|
|
56
|
+
display: flex;
|
|
57
|
+
flex-direction: column;
|
|
58
|
+
gap: 8px;
|
|
59
|
+
transition: all 0.3s ease-in-out;
|
|
60
|
+
`;
|
|
61
|
+
const SectionTitle = styled.div `
|
|
62
|
+
color: var(--color-text-text-subtle);
|
|
63
|
+
padding: ${({ $size }) => $size === SidebarSize.Expanded ? '0px 28px' : '0px'};
|
|
64
|
+
display: ${({ $size }) => $size === SidebarSize.Collapsed ? 'flex' : 'block'};
|
|
65
|
+
opacity: ${({ $size }) => ($size === SidebarSize.Collapsed ? 0 : 0.5)};
|
|
66
|
+
justify-content: ${({ $size }) => $size === SidebarSize.Collapsed ? 'center' : 'flex-start'};
|
|
67
|
+
transition: all 0.3s ease-in-out;
|
|
68
|
+
`;
|
|
69
|
+
const Separator = styled.div `
|
|
70
|
+
height: 1px;
|
|
71
|
+
background-color: var(--color-border-border-divider);
|
|
72
|
+
padding: ${({ $size }) => $size === SidebarSize.Collapsed ? '0px 8px' : '0px 28px'};
|
|
73
|
+
margin: ${({ $size }) => $size === SidebarSize.Collapsed ? '16px 12px' : '16px 18px'};
|
|
74
|
+
transition: all 0.3s ease-in-out;
|
|
75
|
+
`;
|
|
76
|
+
const BottomContainer = styled.div `
|
|
77
|
+
margin-top: 16px;
|
|
78
|
+
transition: all 0.3s ease-in-out;
|
|
79
|
+
`;
|
|
80
|
+
// Wrapper component to handle links
|
|
81
|
+
const NavItemWrapper = ({ item, isCollapsed, }) => {
|
|
82
|
+
const handleClick = () => {
|
|
83
|
+
if (item.link) {
|
|
84
|
+
window.location.href = item.link;
|
|
85
|
+
}
|
|
86
|
+
else if (item.onClick) {
|
|
87
|
+
item.onClick();
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
return (_jsx(NavItem, { text: item.text, icon: item.icon, state: item.state || NavItemState.Default, size: isCollapsed ? NavItemSize.Collapsed : NavItemSize.Expanded, showBadge: isCollapsed ? false : item.showBadge, onClick: handleClick }));
|
|
91
|
+
};
|
|
92
|
+
export const Sidebar = ({ size = SidebarSize.Expanded, className = '', navSections, bottomNavItems = [], credits, loadingCredits = false, onToggle, logoProps = { color: 'var(--color-foreground-fg-brand-logo)' }, }) => {
|
|
93
|
+
const [sidebarSize, setSidebarSize] = useState(size);
|
|
94
|
+
const handleToggle = () => {
|
|
95
|
+
const newSize = sidebarSize === SidebarSize.Expanded
|
|
96
|
+
? SidebarSize.Collapsed
|
|
97
|
+
: SidebarSize.Expanded;
|
|
98
|
+
setSidebarSize(newSize);
|
|
99
|
+
if (onToggle) {
|
|
100
|
+
onToggle(newSize);
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
const isCollapsed = sidebarSize === SidebarSize.Collapsed;
|
|
104
|
+
const cardSize = isCollapsed
|
|
105
|
+
? CreditsCardSize.Collapsed
|
|
106
|
+
: CreditsCardSize.Expanded;
|
|
107
|
+
return (_jsxs(SidebarContainer, { className: className, children: [_jsxs(StyledSidebar, { "$size": sidebarSize, children: [_jsx(LogoContainer, { "$size": sidebarSize, children: _jsx(Logo, { variant: isCollapsed ? LogoVariant.Icon : LogoVariant.Horizontal, color: logoProps.color, gradient: logoProps.gradient }) }), _jsx(NavItemsContainer, { children: navSections.map((section, sectionIndex) => (_jsxs(React.Fragment, { children: [_jsxs(NavSection, { children: [section.title && (_jsx(SectionTitle, { "$size": sidebarSize, children: _jsx(Typography, { size: TypographySize.TextS, weight: TypographyWeight.Medium, color: "var(--color-text-text-paragraph)", className: isCollapsed ? 'hidden' : '', children: isCollapsed
|
|
108
|
+
? section.title.split(' ')[0]
|
|
109
|
+
: section.title }) })), section.items.map((item, itemIndex) => (_jsx(NavItemWrapper, { item: item, isCollapsed: isCollapsed }, `${item.text}-${itemIndex}`)))] }), sectionIndex < navSections.length - 1 &&
|
|
110
|
+
section.showSeparator && _jsx(Separator, { "$size": sidebarSize })] }, `section-${sectionIndex}`))) }), _jsx(BottomContainer, { children: _jsxs(Box, { display: "flex", flexDirection: "column", gap: "16px", children: [_jsx(Box, { display: 'flex', justifyContent: 'center', padding: isCollapsed ? '8px' : '0px 12px', children: loadingCredits ? (_jsx(CreditsCardSkeleton, { size: cardSize })) : credits ? (_jsx(CreditsCard, { size: cardSize, maxCredits: credits.maxCredits, usedCredits: credits.usedCredits, managedAgentsInfoText: credits.managedAgentsInfoText, speechToVideoInfoText: credits.speechToVideoInfoText, onUpgradeClick: credits.onUpgradeClick, overUsageEnabled: credits.overUsageEnabled, overUsedCredits: credits.overUsedCredits })) : null }), 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: {
|
|
111
|
+
boxShadow: '2px 4px 8px 0px #1D142814',
|
|
112
|
+
} })) : (_jsx(MainButton, { size: ButtonSize.xxs, text: "Collapse", hierarchy: ButtonHierarchy.Tertiary, displayIconMode: ButtonDisplayMode.Only, displayIcon: "CaretLeft", onClick: handleToggle, style: {
|
|
113
|
+
boxShadow: '2px 4px 8px 0px #1D142814',
|
|
114
|
+
}, shape: ButtonShape.Circle })) })] }));
|
|
115
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { Sidebar } from './Sidebar';
|
|
3
|
+
declare const meta: Meta<typeof Sidebar>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Sidebar>;
|
|
6
|
+
export declare const InBoxContainer: Story;
|
|
7
|
+
export declare const Expanded: Story;
|
|
8
|
+
export declare const Collapsed: Story;
|
|
9
|
+
export declare const LoadingCredits: Story;
|
|
10
|
+
export declare const LoadingCreditsCollapsed: Story;
|
|
11
|
+
export declare const WithoutCredits: Story;
|