@beydesign/storybook 0.1.7 → 0.1.9

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.
@@ -102,14 +102,13 @@ export const Sidebar = ({ size = SidebarSize.Expanded, className = '', navSectio
102
102
  }
103
103
  };
104
104
  const isCollapsed = sidebarSize === SidebarSize.Collapsed;
105
+ const cardSize = isCollapsed
106
+ ? CreditsCardSize.Collapsed
107
+ : CreditsCardSize.Expanded;
105
108
  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(--colors-light-text-text-paragraph)", className: isCollapsed ? 'hidden' : '', children: isCollapsed
106
109
  ? section.title.split(' ')[0]
107
110
  : section.title }) })), section.items.map((item, itemIndex) => (_jsx(NavItemWrapper, { item: item, isCollapsed: isCollapsed }, `${item.text}-${itemIndex}`)))] }), sectionIndex < navSections.length - 1 &&
108
- section.showSeparator && _jsx(Separator, { "$size": sidebarSize })] }, `section-${sectionIndex}`))) }), _jsx(BottomContainer, { children: _jsxs(Box, { display: "flex", flexDirection: "column", gap: "16px", children: [_jsxs(Box, { display: 'flex', justifyContent: 'center', padding: isCollapsed ? '8px' : '0px 12px', children: [credits && !loadingCredits && (_jsx(CreditsCard, { size: isCollapsed
109
- ? CreditsCardSize.Collapsed
110
- : CreditsCardSize.Expanded, maxCredits: credits.maxCredits, usedCredits: credits.usedCredits, managedAgentsInfoText: credits.managedAgentsInfoText, speechToVideoInfoText: credits.speechToVideoInfoText, onUpgradeClick: credits.onUpgradeClick, overUsageEnabled: credits.overUsageEnabled, overUsedCredits: credits.overUsedCredits })), !credits && loadingCredits && (_jsx(CreditsCardSkeleton, { size: isCollapsed
111
- ? CreditsCardSize.Collapsed
112
- : CreditsCardSize.Expanded }))] }), 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
+ 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: {
113
112
  boxShadow: '2px 4px 8px 0px #1D142814',
114
113
  } })) : (_jsx(MainButton, { size: ButtonSize.xxs, text: "Collapse", hierarchy: ButtonHierarchy.Tertiary, displayIconMode: ButtonDisplayMode.Only, displayIcon: "CaretLeft", onClick: handleToggle, style: {
115
114
  boxShadow: '2px 4px 8px 0px #1D142814',
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { StepperProps } from './types';
3
+ export declare const Stepper: React.FC<StepperProps>;
@@ -0,0 +1,58 @@
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 { getIconComponent } from '../../utils';
5
+ export const Stepper = ({ steps, currentStep, onStepClick, style, testId, connectorWidth, stepStyle, }) => {
6
+ return (_jsx(Box, { borderRadius: 'var(--spacing-tokens-size-in-px-spacing-spacing-md)', sx: style, "data-testId": testId, display: 'flex', flexDirection: 'row', alignItems: 'center', children: steps.map((step, index) => (_jsx(Step, { currentStep: currentStep, index: index, title: step, onClick: () => onStepClick(index), totalSteps: steps.length, connectorWidth: connectorWidth, stepStyle: stepStyle }, index))) }));
7
+ };
8
+ const Step = ({ currentStep, totalSteps, index, title, onClick, connectorWidth = '70px', stepStyle, }) => {
9
+ const thisStep = index + 1;
10
+ const isDisabled = currentStep < thisStep;
11
+ const isCurrent = currentStep === thisStep;
12
+ const isCompleted = currentStep > thisStep;
13
+ const getTextColor = () => {
14
+ if (isDisabled)
15
+ return 'var(--colors-light-text-text-paragraph)';
16
+ else if (isCurrent)
17
+ return 'var(--colors-light-text-text-clicable)';
18
+ else if (isCompleted)
19
+ return 'var(--colors-light-text-text-title)';
20
+ else
21
+ return 'var(--colors-light-text-text-paragraph)';
22
+ };
23
+ const getIconColor = () => {
24
+ if (isDisabled)
25
+ return 'var(--colors-light-foreground-fg-disabled)';
26
+ else if (isCurrent)
27
+ return 'var(--colors-light-background-bg-brand)';
28
+ else if (isCompleted)
29
+ return 'var(--colors-light-background-bg-brand)';
30
+ else
31
+ return 'var(--colors-light-foreground-fg-secondary)';
32
+ };
33
+ const IconComponent = getIconComponent('CheckCircle', {
34
+ size: '24px',
35
+ color: getIconColor(),
36
+ weight: isCompleted ? 'fill' : 'regular',
37
+ onClick: onClick,
38
+ });
39
+ const getConnectorColor = (position) => {
40
+ if (position === 'left') {
41
+ if (thisStep === 1)
42
+ return 'transparent';
43
+ else if (thisStep <= currentStep)
44
+ return 'var(--colors-light-background-bg-brand)';
45
+ else
46
+ return 'var(--colors-light-foreground-fg-disabled)';
47
+ }
48
+ else if (position === 'right') {
49
+ if (thisStep === totalSteps)
50
+ return 'transparent';
51
+ else if (thisStep < currentStep)
52
+ return 'var(--colors-light-background-bg-brand)';
53
+ else
54
+ return 'var(--colors-light-foreground-fg-disabled)';
55
+ }
56
+ };
57
+ return (_jsxs(Box, { display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', sx: stepStyle, children: [_jsxs(Box, { display: 'flex', flexDirection: 'row', alignItems: 'center', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-md)', children: [_jsx(Box, { height: '1px', bgcolor: getConnectorColor('left'), width: connectorWidth, borderRadius: 'var(--spacing-tokens-size-in-px-spacing-spacing-xs)' }), IconComponent, _jsx(Box, { height: '1px', bgcolor: getConnectorColor('right'), width: connectorWidth, borderRadius: 'var(--spacing-tokens-size-in-px-spacing-spacing-xs)' })] }), _jsx(Box, { onClick: onClick, children: _jsx(Typography, { size: TypographySize.TextM, weight: TypographyWeight.SemiBold, color: getTextColor(), children: title }) })] }));
58
+ };
@@ -0,0 +1,6 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { Stepper } from './Stepper';
3
+ declare const meta: Meta<typeof Stepper>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof Stepper>;
6
+ export declare const Default: Story;
@@ -0,0 +1,65 @@
1
+ import { Stepper } from './Stepper';
2
+ const meta = {
3
+ title: 'Design System/Components/UI/Stepper',
4
+ component: Stepper,
5
+ parameters: {
6
+ layout: 'centered',
7
+ design: {
8
+ type: 'figspec',
9
+ url: '',
10
+ },
11
+ },
12
+ tags: ['autodocs'],
13
+ argTypes: {
14
+ currentStep: {
15
+ control: 'number',
16
+ description: 'Current step of the stepper',
17
+ table: {
18
+ type: { summary: 'number' },
19
+ },
20
+ },
21
+ steps: {
22
+ control: 'object',
23
+ description: 'Steps of the stepper',
24
+ table: {
25
+ type: { summary: 'object' },
26
+ },
27
+ },
28
+ onStepClick: {
29
+ description: 'Function to call when a step is clicked',
30
+ table: {
31
+ type: { summary: 'function' },
32
+ },
33
+ },
34
+ style: {
35
+ control: 'object',
36
+ description: 'Style of the stepper',
37
+ table: {
38
+ type: { summary: 'object' },
39
+ },
40
+ },
41
+ testId: {
42
+ control: 'text',
43
+ description: 'Test ID of the stepper',
44
+ table: {
45
+ type: { summary: 'string' },
46
+ },
47
+ },
48
+ },
49
+ };
50
+ export default meta;
51
+ export const Default = {
52
+ args: {
53
+ currentStep: 1,
54
+ steps: [
55
+ 'Lighting, Audio & Setup',
56
+ 'Beginning',
57
+ 'Speaking Phase',
58
+ 'Ending',
59
+ 'Final Checklist',
60
+ ],
61
+ onStepClick: () => { },
62
+ style: {},
63
+ testId: 'stepper',
64
+ },
65
+ };
@@ -7,3 +7,4 @@ export * from './ProgressIndicator';
7
7
  export * from './SkeletonLoader';
8
8
  export * from './Topbar';
9
9
  export * from './types';
10
+ export * from './Stepper';
@@ -7,3 +7,4 @@ export * from './ProgressIndicator';
7
7
  export * from './SkeletonLoader';
8
8
  export * from './Topbar';
9
9
  export * from './types';
10
+ export * from './Stepper';
@@ -232,3 +232,35 @@ export interface TopbarProps {
232
232
  /** Class name */
233
233
  className?: string;
234
234
  }
235
+ export interface StepProps {
236
+ /** Current step of the stepper */
237
+ currentStep: number;
238
+ /** Total steps of the stepper */
239
+ totalSteps: number;
240
+ /** Index of the step */
241
+ index: number;
242
+ /** Title of the step */
243
+ title: string;
244
+ /** On click of the step */
245
+ onClick?: () => void;
246
+ /** Connector width of the step */
247
+ connectorWidth?: string | number;
248
+ /** Style of the step */
249
+ stepStyle?: SxProps<Theme>;
250
+ }
251
+ export interface StepperProps {
252
+ /** Steps of the stepper */
253
+ steps: string[];
254
+ /** Current step of the stepper */
255
+ currentStep: number;
256
+ /** On click of the step */
257
+ onStepClick: (step: number) => void;
258
+ /** Style of the stepper */
259
+ style?: SxProps<Theme>;
260
+ /** Style of the step */
261
+ stepStyle?: SxProps<Theme>;
262
+ /** Test ID of the stepper */
263
+ testId?: string;
264
+ /** Connector width of the stepper */
265
+ connectorWidth?: string | number;
266
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@beydesign/storybook",
3
3
  "private": false,
4
- "version": "0.1.7",
4
+ "version": "0.1.9",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",