@beydesign/storybook 0.1.10 → 0.1.12
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/stories/Form/Toggle.js +2 -2
- package/dist/stories/Form/Toggle.stories.js +10 -0
- package/dist/stories/Form/types.d.ts +4 -0
- package/dist/stories/UI/ProgressIndicator.js +3 -3
- package/dist/stories/UI/ProgressIndicator.stories.js +2 -0
- package/dist/stories/UI/types.d.ts +2 -0
- package/package.json +1 -1
|
@@ -52,6 +52,6 @@ const IOSSwitch = styled((props) => (_jsx(Switch, { focusVisibleClassName: ".Mui
|
|
|
52
52
|
},
|
|
53
53
|
},
|
|
54
54
|
}));
|
|
55
|
-
export const Toggle = ({ checked, onChange, text = 'Click me', title, disabled = false, togglePosition = TogglePosition.Left, style, }) => {
|
|
56
|
-
return (_jsxs(Box, { display: "flex", alignItems: "flex-start", flexDirection: togglePosition === TogglePosition.Left ? 'row' : 'row-reverse', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-md)', sx: style, children: [_jsx(IOSSwitch, { checked: checked, onChange: (e) => onChange(e.target.checked), disabled: disabled }), text && (_jsxs(Box, { display: "flex", flexDirection: "column", children: [_jsx(Typography, { size: TypographySize.TextS, weight: TypographyWeight.Medium, color:
|
|
55
|
+
export const Toggle = ({ checked, onChange, text = 'Click me', title, disabled = false, togglePosition = TogglePosition.Left, style, textColor = 'var(--colors-light-text-text-title)', titleColor = '#475467', }) => {
|
|
56
|
+
return (_jsxs(Box, { display: "flex", alignItems: "flex-start", flexDirection: togglePosition === TogglePosition.Left ? 'row' : 'row-reverse', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-md)', sx: style, children: [_jsx(IOSSwitch, { checked: checked, onChange: (e) => onChange(e.target.checked), disabled: disabled }), text && (_jsxs(Box, { display: "flex", flexDirection: "column", children: [_jsx(Typography, { size: TypographySize.TextS, weight: TypographyWeight.Medium, color: textColor, children: text }), title && (_jsx(Typography, { size: TypographySize.TextS, weight: TypographyWeight.Medium, color: titleColor, children: title }))] }))] }));
|
|
57
57
|
};
|
|
@@ -54,6 +54,14 @@ const meta = {
|
|
|
54
54
|
description: 'Style of the toggle',
|
|
55
55
|
table: { type: { summary: 'object' } },
|
|
56
56
|
},
|
|
57
|
+
textColor: {
|
|
58
|
+
description: 'Color of the text',
|
|
59
|
+
table: { type: { summary: 'string' } },
|
|
60
|
+
},
|
|
61
|
+
titleColor: {
|
|
62
|
+
description: 'Color of the title',
|
|
63
|
+
table: { type: { summary: 'string' } },
|
|
64
|
+
},
|
|
57
65
|
},
|
|
58
66
|
};
|
|
59
67
|
export default meta;
|
|
@@ -65,5 +73,7 @@ export const Default = {
|
|
|
65
73
|
title: 'This is a toggle',
|
|
66
74
|
disabled: false,
|
|
67
75
|
togglePosition: TogglePosition.Right,
|
|
76
|
+
textColor: 'var(--colors-light-text-text-title)',
|
|
77
|
+
titleColor: '#475467',
|
|
68
78
|
},
|
|
69
79
|
};
|
|
@@ -101,6 +101,10 @@ export type ToggleProps = {
|
|
|
101
101
|
togglePosition?: TogglePosition;
|
|
102
102
|
/** Style of the toggle */
|
|
103
103
|
style?: SxProps<Theme>;
|
|
104
|
+
/** Text color of the toggle */
|
|
105
|
+
textColor?: string;
|
|
106
|
+
/** Title color of the toggle */
|
|
107
|
+
titleColor?: string;
|
|
104
108
|
};
|
|
105
109
|
export declare enum CheckboxType {
|
|
106
110
|
Radio = "Radio",
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { ProgressIndicatorMode } from './types';
|
|
3
3
|
import { Box } from '@mui/material';
|
|
4
4
|
import { Typography, TypographySize, TypographyWeight } from '../Typography';
|
|
5
|
-
export const ProgressIndicator = ({ mode = ProgressIndicatorMode.Value, overriddenText = null, currentValue = 40, maxValue = 100, fillColor = 'var(--colors-light-background-bg-brand)', backgroundColor = 'var(--colors-light-background-bg-white)', text = 'used', textColor = 'var(--colors-light-text-text-primary)', style, testId, }) => {
|
|
5
|
+
export const ProgressIndicator = ({ mode = ProgressIndicatorMode.Value, overriddenText = null, currentValue = 40, maxValue = 100, fillColor = 'var(--colors-light-background-bg-brand)', backgroundColor = 'var(--colors-light-background-bg-white)', text = 'used', textColor = 'var(--colors-light-text-text-primary)', style, textStyle, testId, }) => {
|
|
6
6
|
let errorText = '';
|
|
7
7
|
const calculateFill = () => {
|
|
8
8
|
if (currentValue > maxValue)
|
|
@@ -29,7 +29,7 @@ export const ProgressIndicator = ({ mode = ProgressIndicatorMode.Value, overridd
|
|
|
29
29
|
if (errorText) {
|
|
30
30
|
return (_jsx(Typography, { size: TypographySize.TextXS, weight: TypographyWeight.Regular, children: errorText }));
|
|
31
31
|
}
|
|
32
|
-
return (_jsxs(Box, { display: "flex", flexDirection: mode === ProgressIndicatorMode.Value ? 'column' : 'row', justifyContent: 'space-between', alignItems: mode === ProgressIndicatorMode.Value ? 'flex-end' : 'center', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-md)', sx: style, minWidth: 200, "data-testid": testId, children: [mode === ProgressIndicatorMode.Value && (_jsx(Typography, { size: TypographySize.TextXS, weight: TypographyWeight.Regular, color: textColor, children: overriddenText ||
|
|
33
|
-
`${currentValue.toLocaleString(undefined, { maximumFractionDigits: 2 })} / ${maxValue.toLocaleString(undefined, { maximumFractionDigits: 2 })} ${text}` })), _jsx(Box, { display: "flex", flexGrow: 1, flexDirection: "row", alignItems: "center", borderRadius: '4px', sx: { backgroundColor, overflow: 'hidden' }, height: '4px', width: '100%', children: _jsx(Box, { height: '100%', borderRadius: '4px', sx: { backgroundColor: fillColor, width: `${calculateFill()}%` } }) }), mode === ProgressIndicatorMode.Percentage && (_jsx(Typography, { size: TypographySize.TextXS, weight: TypographyWeight.Regular, color: textColor, textStyle:
|
|
32
|
+
return (_jsxs(Box, { display: "flex", flexDirection: mode === ProgressIndicatorMode.Value ? 'column' : 'row', justifyContent: 'space-between', alignItems: mode === ProgressIndicatorMode.Value ? 'flex-end' : 'center', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-md)', sx: style, minWidth: 200, "data-testid": testId, children: [mode === ProgressIndicatorMode.Value && (_jsx(Typography, { size: TypographySize.TextXS, weight: TypographyWeight.Regular, color: textColor, textStyle: textStyle, children: overriddenText ||
|
|
33
|
+
`${currentValue.toLocaleString(undefined, { maximumFractionDigits: 2 })} / ${maxValue.toLocaleString(undefined, { maximumFractionDigits: 2 })} ${text}` })), _jsx(Box, { display: "flex", flexGrow: 1, flexDirection: "row", alignItems: "center", borderRadius: '4px', sx: { backgroundColor, overflow: 'hidden' }, height: '4px', width: '100%', children: _jsx(Box, { height: '100%', borderRadius: '4px', sx: { backgroundColor: fillColor, width: `${calculateFill()}%` } }) }), mode === ProgressIndicatorMode.Percentage && (_jsx(Typography, { size: TypographySize.TextXS, weight: TypographyWeight.Regular, color: textColor, textStyle: textStyle, children: overriddenText ||
|
|
34
34
|
`${currentValue.toLocaleString(undefined, { maximumFractionDigits: 2 })}%` }))] }));
|
|
35
35
|
};
|
|
@@ -193,6 +193,8 @@ export type ProgressIndicatorProps = {
|
|
|
193
193
|
textColor?: string;
|
|
194
194
|
/** Style of the progress indicator */
|
|
195
195
|
style?: SxProps<Theme>;
|
|
196
|
+
/** Text style of the progress indicator */
|
|
197
|
+
textStyle?: React.CSSProperties;
|
|
196
198
|
/** Test ID of the progress indicator */
|
|
197
199
|
testId?: string;
|
|
198
200
|
};
|