@beydesign/storybook 0.7.0 → 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/UI/index.d.ts +0 -1
- package/dist/stories/UI/index.js +0 -1
- package/dist/stories/UI/types.d.ts +0 -32
- package/package.json +1 -1
- 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:
|
package/dist/stories/UI/index.js
CHANGED
|
@@ -449,38 +449,6 @@ export interface ConversationalVoiceAgentsBannerProps {
|
|
|
449
449
|
/** Test ID of the banner */
|
|
450
450
|
testId?: string;
|
|
451
451
|
}
|
|
452
|
-
export interface StepProps {
|
|
453
|
-
/** Current step of the stepper */
|
|
454
|
-
currentStep: number;
|
|
455
|
-
/** Total steps of the stepper */
|
|
456
|
-
totalSteps: number;
|
|
457
|
-
/** Index of the step */
|
|
458
|
-
index: number;
|
|
459
|
-
/** Title of the step */
|
|
460
|
-
title: string;
|
|
461
|
-
/** On click of the step */
|
|
462
|
-
onClick?: () => void;
|
|
463
|
-
/** Connector width of the step */
|
|
464
|
-
connectorWidth?: string | number;
|
|
465
|
-
/** Style of the step */
|
|
466
|
-
stepStyle?: SxProps<Theme>;
|
|
467
|
-
}
|
|
468
|
-
export interface StepperProps {
|
|
469
|
-
/** Steps of the stepper */
|
|
470
|
-
steps: string[];
|
|
471
|
-
/** Current step of the stepper */
|
|
472
|
-
currentStep: number;
|
|
473
|
-
/** On click of the step */
|
|
474
|
-
onStepClick?: (step: number) => void;
|
|
475
|
-
/** Style of the stepper */
|
|
476
|
-
style?: SxProps<Theme>;
|
|
477
|
-
/** Style of the step */
|
|
478
|
-
stepStyle?: SxProps<Theme>;
|
|
479
|
-
/** Test ID of the stepper */
|
|
480
|
-
testId?: string;
|
|
481
|
-
/** Connector width of the stepper */
|
|
482
|
-
connectorWidth?: string | number;
|
|
483
|
-
}
|
|
484
452
|
/**
|
|
485
453
|
* TabMenu size variants
|
|
486
454
|
*/
|
package/package.json
CHANGED
|
@@ -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
|
-
};
|