@beydesign/storybook 0.6.2 → 0.7.1
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 +30 -1
- package/dist/stories/Form/FileUpload/FileUpload.js +7 -1
- package/dist/stories/Navigation/index.d.ts +0 -1
- package/dist/stories/Navigation/index.js +0 -1
- package/dist/stories/Navigation/types.d.ts +0 -18
- package/dist/stories/UI/Badge.js +21 -6
- package/dist/stories/UI/CheckIcon.js +1 -0
- package/dist/stories/UI/index.d.ts +0 -1
- package/dist/stories/UI/index.js +0 -1
- package/dist/stories/UI/types.d.ts +2 -33
- package/dist/stories/UI/types.js +1 -0
- package/package.json +1 -1
- package/dist/stories/Navigation/ProcessHeader.d.ts +0 -3
- package/dist/stories/Navigation/ProcessHeader.js +0 -11
- package/dist/stories/Navigation/ProcessHeader.stories.d.ts +0 -6
- package/dist/stories/Navigation/ProcessHeader.stories.js +0 -76
- package/dist/stories/UI/Stepper.d.ts +0 -3
- package/dist/stories/UI/Stepper.js +0 -67
- package/dist/stories/UI/Stepper.stories.d.ts +0 -6
- package/dist/stories/UI/Stepper.stories.js +0 -65
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# BeyDesign Storybook
|
|
2
|
-
[](https://github.com/Beyond-Presence/bey-design-system/actions/workflows/lint.yml) [](https://github.com/Beyond-Presence/bey-design-system/actions/workflows/storybook.yml) [](https://github.com/Beyond-Presence/bey-design-system/actions/workflows/publish.yml)
|
|
3
2
|
|
|
3
|
+
[](https://github.com/Beyond-Presence/bey-design-system/actions/workflows/lint.yml) [](https://github.com/Beyond-Presence/bey-design-system/actions/workflows/storybook.yml) [](https://github.com/Beyond-Presence/bey-design-system/actions/workflows/publish.yml)
|
|
4
4
|
|
|
5
5
|
A React component library implementing the Beyond Presence Design System. This package provides a collection of reusable components that follow the design specifications from our [Figma Design System](https://www.figma.com/design/mIhjz2yJjcpLlIqw6oUivt/Beyond-Presence?node-id=4295-3110&p=f&m=dev).
|
|
6
6
|
|
|
@@ -48,6 +48,35 @@ function App() {
|
|
|
48
48
|
}
|
|
49
49
|
```
|
|
50
50
|
|
|
51
|
+
## Color pairing
|
|
52
|
+
|
|
53
|
+
Color tokens come in three families, and they are not interchangeable. Pick the
|
|
54
|
+
text token by the surface it sits on:
|
|
55
|
+
|
|
56
|
+
| Surface | Example | Text token |
|
|
57
|
+
| ------------ | ------------------------------------------------ | ------------------------------------------------------------ |
|
|
58
|
+
| Solid fill | `bg-success`, `bg-error` | `text-success-on-color`, `text-red-on-color` |
|
|
59
|
+
| Subtle tint | `bg-badge-accent-success`, `bg-badge-accent-red` | `text-success`, `text-error` |
|
|
60
|
+
| Page or card | `bg-page`, `bg-page-contrast` | `text-success`, `text-error`, `text-title`, `text-paragraph` |
|
|
61
|
+
|
|
62
|
+
The trap: a solid fill and its accent text resolve to the **same** primitive.
|
|
63
|
+
`bg-success` and `text-success` are both `Primary.Success.500`, so pairing them
|
|
64
|
+
renders invisible text. That is what the `-on-color` family is for — it is the
|
|
65
|
+
darker step (`Primary.Success.800`) meant to sit on the solid fill.
|
|
66
|
+
|
|
67
|
+
There is an `-on-color` token per accent: `text-success-on-color`,
|
|
68
|
+
`text-red-on-color`, `text-yellow-on-color`, `text-violet-on-color`,
|
|
69
|
+
`text-lemon-on-color`, `text-blue-on-color`, `text-cyan-on-color` and
|
|
70
|
+
`text-pink-on-color`.
|
|
71
|
+
|
|
72
|
+
Two related notes:
|
|
73
|
+
|
|
74
|
+
- Some tokens are relative to the page rather than absolute. `bg-error-subtle`
|
|
75
|
+
is a near-white `Red.25` in light but a solid `Red.700` in dark — subtle
|
|
76
|
+
_against its own page_, not subtle in isolation. Check both themes.
|
|
77
|
+
- `bg-component` is pure white in light, so it disappears on a card
|
|
78
|
+
(`bg-page-contrast`). Use `bg-element` for insets on a card.
|
|
79
|
+
|
|
51
80
|
## Development
|
|
52
81
|
|
|
53
82
|
To run the Storybook development environment locally:
|
|
@@ -44,6 +44,12 @@ const fileIconMap = {
|
|
|
44
44
|
};
|
|
45
45
|
// Default icon for unknown file types
|
|
46
46
|
const defaultIcon = FileCode;
|
|
47
|
+
/**
|
|
48
|
+
* Figma draws the upload glyph in a 28px frame with the stroke inside it.
|
|
49
|
+
* Deriving the box from padding puts the CSS border outside, leaving it 2px
|
|
50
|
+
* oversized, so pin the frame and let border-box absorb the stroke.
|
|
51
|
+
*/
|
|
52
|
+
const ICON_BOX_SIZE = 28;
|
|
47
53
|
export const FileUpload = ({ disabled, sx, acceptedFileTypes = '.pdf,.doc,.docx,.txt', maxFileSizeMB = 10, onFileSelect, hintText, showFileTypeIcons = true, }) => {
|
|
48
54
|
const [isDragging, setIsDragging] = useState(false);
|
|
49
55
|
const fileInputRef = useRef(null);
|
|
@@ -124,7 +130,7 @@ export const FileUpload = ({ disabled, sx, acceptedFileTypes = '.pdf,.doc,.docx,
|
|
|
124
130
|
? 'var(--color-background-bg-component-disabled)'
|
|
125
131
|
: isDragging
|
|
126
132
|
? 'var(--color-background-bg-component-hover)'
|
|
127
|
-
: 'var(--color-background-bg-element)', sx: { cursor: disabled ? 'not-allowed' : 'pointer', ...sx }, onClick: handleClick, onDragOver: handleDragOver, onDragLeave: handleDragLeave, onDrop: handleDrop, children: [_jsx("input", { type: "file", ref: fileInputRef, style: { display: 'none' }, accept: acceptedFileTypes, onChange: handleInputChange, disabled: disabled }), _jsx(Box, { display: 'flex', alignItems: 'center', justifyContent: '
|
|
133
|
+
: 'var(--color-background-bg-element)', sx: { cursor: disabled ? 'not-allowed' : 'pointer', ...sx }, onClick: handleClick, onDragOver: handleDragOver, onDragLeave: handleDragLeave, onDrop: handleDrop, children: [_jsx("input", { type: "file", ref: fileInputRef, style: { display: 'none' }, accept: acceptedFileTypes, onChange: handleInputChange, disabled: disabled }), _jsx(Box, { display: 'flex', alignItems: 'center', justifyContent: 'center', width: ICON_BOX_SIZE, height: ICON_BOX_SIZE, boxSizing: 'border-box', border: `1px solid ${disabled
|
|
128
134
|
? 'var(--color-border-border-disabled)'
|
|
129
135
|
: 'var(--color-border-border-component)'}`, borderRadius: 'var(--spacing-tokens-size-in-px-spacing-spacing-sm)', bgcolor: disabled
|
|
130
136
|
? 'var(--color-background-bg-button-disabled)'
|
|
@@ -168,24 +168,6 @@ export interface SidebarProps {
|
|
|
168
168
|
color?: string;
|
|
169
169
|
};
|
|
170
170
|
}
|
|
171
|
-
export interface ProcessHeaderProps {
|
|
172
|
-
/** The title of the process */
|
|
173
|
-
title: string;
|
|
174
|
-
/** The subtitle of the process */
|
|
175
|
-
subtitle: string;
|
|
176
|
-
/** The current step of the process */
|
|
177
|
-
currentStep: number;
|
|
178
|
-
/** The total steps of the process */
|
|
179
|
-
totalSteps: number;
|
|
180
|
-
/** The text to display in the header right */
|
|
181
|
-
headerRightText?: string;
|
|
182
|
-
/** The callback to handle the cancel button click */
|
|
183
|
-
onCancelClick?: () => void;
|
|
184
|
-
/** The style object to apply to the component */
|
|
185
|
-
sx?: SxProps<Theme>;
|
|
186
|
-
/** The class name to apply to the component */
|
|
187
|
-
className?: string;
|
|
188
|
-
}
|
|
189
171
|
/**
|
|
190
172
|
* Props for the {@link MobileNav} overlay — the single navigation panel used
|
|
191
173
|
* below the mobile breakpoint, which holds the `Drawer` and any `subNav` as
|
package/dist/stories/UI/Badge.js
CHANGED
|
@@ -3,6 +3,18 @@ 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
|
+
/**
|
|
7
|
+
* Figma sizes a badge by its height, with the label centred inside and the
|
|
8
|
+
* 1px stroke drawn within that box. A CSS border sits outside instead, so
|
|
9
|
+
* deriving the height from vertical padding leaves every badge 2px taller
|
|
10
|
+
* than the design. Pin the height and let border-box absorb the stroke —
|
|
11
|
+
* the same fix MainButton applies to text buttons.
|
|
12
|
+
*/
|
|
13
|
+
const BADGE_HEIGHT = {
|
|
14
|
+
[BadgeSize.lg]: 32,
|
|
15
|
+
[BadgeSize.md]: 28,
|
|
16
|
+
[BadgeSize.xs]: 24,
|
|
17
|
+
};
|
|
6
18
|
export const Badge = ({ color = BadgeColor.Default, size = BadgeSize.md, text, children, style: customStyle, icon = 'Cactus', showIcon = false, fill = true, iconWeight = 'regular', iconSize, iconColor, testId, }) => {
|
|
7
19
|
const getBackgroundColor = (color) => {
|
|
8
20
|
switch (color) {
|
|
@@ -82,14 +94,14 @@ export const Badge = ({ color = BadgeColor.Default, size = BadgeSize.md, text, c
|
|
|
82
94
|
return '1px solid rgba(0, 0, 0, 0.3)';
|
|
83
95
|
}
|
|
84
96
|
};
|
|
85
|
-
const
|
|
97
|
+
const getPaddingX = (size) => {
|
|
86
98
|
switch (size) {
|
|
87
99
|
case BadgeSize.lg:
|
|
88
|
-
return 'var(--spacing-tokens-size-in-px-spacing-spacing-
|
|
100
|
+
return 'var(--spacing-tokens-size-in-px-spacing-spacing-lg)';
|
|
89
101
|
case BadgeSize.md:
|
|
90
|
-
return '
|
|
102
|
+
return '10px';
|
|
91
103
|
case BadgeSize.xs:
|
|
92
|
-
return 'var(--spacing-tokens-size-in-px-spacing-spacing-
|
|
104
|
+
return 'var(--spacing-tokens-size-in-px-spacing-spacing-md)';
|
|
93
105
|
}
|
|
94
106
|
};
|
|
95
107
|
const getIconSize = (size) => {
|
|
@@ -114,11 +126,14 @@ export const Badge = ({ color = BadgeColor.Default, size = BadgeSize.md, text, c
|
|
|
114
126
|
};
|
|
115
127
|
const backgroundColor = getBackgroundColor(color);
|
|
116
128
|
const border = getBorder(color);
|
|
117
|
-
|
|
129
|
+
// Figma measures padding from the frame edge with the stroke drawn inside
|
|
130
|
+
// it, so subtract the border to keep the label the same distance in.
|
|
131
|
+
const figmaPaddingX = getPaddingX(size);
|
|
132
|
+
const paddingX = fill ? `calc(${figmaPaddingX} - 1px)` : figmaPaddingX;
|
|
118
133
|
const iconProps = {
|
|
119
134
|
size: iconSize || getIconSize(size),
|
|
120
135
|
color: iconColor || getTextColor(),
|
|
121
136
|
weight: iconWeight,
|
|
122
137
|
};
|
|
123
|
-
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',
|
|
138
|
+
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', height: BADGE_HEIGHT[size], boxSizing: "border-box", paddingX: paddingX, margin: 0, gap: "4px", sx: customStyle, "data-testid": testId, children: [showIcon && icon && getIconComponent(icon, iconProps), text && (_jsx(Typography, { size: getTypographySize(size), weight: TypographyWeight.Medium, color: getTextColor(), children: text })), children] }));
|
|
124
139
|
};
|
package/dist/stories/UI/index.js
CHANGED
|
@@ -237,7 +237,8 @@ export declare enum CheckIconSize {
|
|
|
237
237
|
xs = "xs",
|
|
238
238
|
sm = "sm",
|
|
239
239
|
md = "md",
|
|
240
|
-
lg = "lg"
|
|
240
|
+
lg = "lg",
|
|
241
|
+
xl = "xl"
|
|
241
242
|
}
|
|
242
243
|
/**
|
|
243
244
|
* Check icon type variants.
|
|
@@ -448,38 +449,6 @@ export interface ConversationalVoiceAgentsBannerProps {
|
|
|
448
449
|
/** Test ID of the banner */
|
|
449
450
|
testId?: string;
|
|
450
451
|
}
|
|
451
|
-
export interface StepProps {
|
|
452
|
-
/** Current step of the stepper */
|
|
453
|
-
currentStep: number;
|
|
454
|
-
/** Total steps of the stepper */
|
|
455
|
-
totalSteps: number;
|
|
456
|
-
/** Index of the step */
|
|
457
|
-
index: number;
|
|
458
|
-
/** Title of the step */
|
|
459
|
-
title: string;
|
|
460
|
-
/** On click of the step */
|
|
461
|
-
onClick?: () => void;
|
|
462
|
-
/** Connector width of the step */
|
|
463
|
-
connectorWidth?: string | number;
|
|
464
|
-
/** Style of the step */
|
|
465
|
-
stepStyle?: SxProps<Theme>;
|
|
466
|
-
}
|
|
467
|
-
export interface StepperProps {
|
|
468
|
-
/** Steps of the stepper */
|
|
469
|
-
steps: string[];
|
|
470
|
-
/** Current step of the stepper */
|
|
471
|
-
currentStep: number;
|
|
472
|
-
/** On click of the step */
|
|
473
|
-
onStepClick?: (step: number) => void;
|
|
474
|
-
/** Style of the stepper */
|
|
475
|
-
style?: SxProps<Theme>;
|
|
476
|
-
/** Style of the step */
|
|
477
|
-
stepStyle?: SxProps<Theme>;
|
|
478
|
-
/** Test ID of the stepper */
|
|
479
|
-
testId?: string;
|
|
480
|
-
/** Connector width of the stepper */
|
|
481
|
-
connectorWidth?: string | number;
|
|
482
|
-
}
|
|
483
452
|
/**
|
|
484
453
|
* TabMenu size variants
|
|
485
454
|
*/
|
package/dist/stories/UI/types.js
CHANGED
package/package.json
CHANGED
|
@@ -1,11 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,76 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,67 +0,0 @@
|
|
|
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 ? () => onStepClick(index + 1) : undefined, 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(--color-text-text-paragraph)';
|
|
16
|
-
else if (isCurrent)
|
|
17
|
-
return 'var(--color-text-text-clicable)';
|
|
18
|
-
else if (isCompleted)
|
|
19
|
-
return 'var(--color-text-text-title)';
|
|
20
|
-
else
|
|
21
|
-
return 'var(--color-text-text-paragraph)';
|
|
22
|
-
};
|
|
23
|
-
const getIconColor = () => {
|
|
24
|
-
if (isDisabled)
|
|
25
|
-
return 'var(--color-foreground-fg-disabled)';
|
|
26
|
-
else if (isCurrent)
|
|
27
|
-
return 'var(--color-background-bg-brand-primary)';
|
|
28
|
-
else if (isCompleted)
|
|
29
|
-
return 'var(--color-background-bg-brand-primary)';
|
|
30
|
-
else
|
|
31
|
-
return 'var(--color-foreground-fg-secondary)';
|
|
32
|
-
};
|
|
33
|
-
const IconComponent = getIconComponent('CheckCircle', {
|
|
34
|
-
size: '24px',
|
|
35
|
-
color: getIconColor(),
|
|
36
|
-
weight: isCompleted ? 'fill' : 'regular',
|
|
37
|
-
onClick: () => onClick?.(),
|
|
38
|
-
style: { cursor: onClick ? 'pointer' : 'default' },
|
|
39
|
-
});
|
|
40
|
-
const getConnectorColor = (position) => {
|
|
41
|
-
if (position === 'left') {
|
|
42
|
-
if (thisStep === 1)
|
|
43
|
-
return 'transparent';
|
|
44
|
-
else if (thisStep <= currentStep)
|
|
45
|
-
return 'var(--color-background-bg-brand-primary)';
|
|
46
|
-
else
|
|
47
|
-
return 'var(--color-foreground-fg-disabled)';
|
|
48
|
-
}
|
|
49
|
-
else if (position === 'right') {
|
|
50
|
-
if (thisStep === totalSteps)
|
|
51
|
-
return 'transparent';
|
|
52
|
-
else if (thisStep < currentStep)
|
|
53
|
-
return 'var(--color-background-bg-brand-primary)';
|
|
54
|
-
else
|
|
55
|
-
return 'var(--color-foreground-fg-disabled)';
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
return (_jsxs(Box, { display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', paddingY: 'var(--spacing-tokens-size-in-px-spacing-spacing-md)', onClick: onClick ? () => onClick() : undefined, sx: {
|
|
59
|
-
cursor: onClick ? 'pointer' : 'default',
|
|
60
|
-
'&:hover': {
|
|
61
|
-
border: '1px solid #6938EF33',
|
|
62
|
-
borderRadius: 'var(--spacing-tokens-size-in-px-spacing-spacing-sm)',
|
|
63
|
-
backgroundColor: '#6938EF1A',
|
|
64
|
-
},
|
|
65
|
-
...stepStyle,
|
|
66
|
-
}, 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(Typography, { size: TypographySize.TextM, weight: TypographyWeight.SemiBold, color: getTextColor(), children: title })] }));
|
|
67
|
-
};
|
|
@@ -1,65 +0,0 @@
|
|
|
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
|
-
};
|