@beydesign/storybook 0.0.44 → 0.0.46
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/Agent/AgentCard.js +1 -1
- package/dist/stories/Buttons/ToggleButtonGroup.js +2 -1
- package/dist/stories/Buttons/types.d.ts +4 -0
- package/dist/stories/Form/Checkbox.js +2 -2
- package/dist/stories/Form/TextArea.js +4 -3
- package/dist/stories/Form/TextArea.stories.d.ts +36 -0
- package/dist/stories/Form/TextArea.stories.js +28 -0
- package/dist/stories/Form/TextInput.js +4 -3
- package/dist/stories/Form/TextInput.stories.d.ts +36 -0
- package/dist/stories/Form/TextInput.stories.js +29 -0
- package/dist/stories/Form/types.d.ts +21 -2
- package/dist/stories/Typography/Typography.js +7 -5
- package/dist/stories/Typography/Typography.stories.js +22 -1
- package/dist/stories/Typography/types.d.ts +2 -0
- package/dist/stories/UI/HintBubble.js +2 -2
- package/dist/stories/UI/types.d.ts +2 -0
- package/package.json +1 -1
|
@@ -55,7 +55,7 @@ export const AgentCard = ({ title, description = '', date = '', showDate = false
|
|
|
55
55
|
` })] }));
|
|
56
56
|
}
|
|
57
57
|
if (imageError || !agentImage) {
|
|
58
|
-
return (_jsx(Box, { width: '100%', height: '100%', bgcolor: 'var(--colors-light-background-bg-element)', display: 'flex', justifyContent: 'center', alignItems: 'center', children: _jsx(Typography, { text: "No Preview Available", size: TypographySize.HeadingXS, weight: TypographyWeight.SemiBold }) }));
|
|
58
|
+
return (_jsx(Box, { width: '100%', height: '100%', bgcolor: 'var(--colors-light-background-bg-element)', borderRadius: 'var(--spacing-tokens-size-in-px-spacing-spacing-sm)', border: '2px solid var(--colors-light-border-border-component)', boxSizing: 'border-box', display: 'flex', justifyContent: 'center', alignItems: 'center', children: _jsx(Typography, { text: "No Preview Available", size: TypographySize.HeadingXS, weight: TypographyWeight.SemiBold }) }));
|
|
59
59
|
}
|
|
60
60
|
return (_jsx("img", { src: agentImage, alt: "Agent", width: '100%', height: '100%', style: { objectFit: 'cover', height: '100%', width: '100%' } }));
|
|
61
61
|
};
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { ToggleButtonGroupSize, ButtonHierarchy, ButtonSize, ButtonType, } from './types';
|
|
3
3
|
import { Box } from '@mui/material';
|
|
4
4
|
import { MainButton } from './MainButton';
|
|
5
|
-
export const ToggleButtonGroup = ({ onChange, options, selectedOption, disabled, size = ToggleButtonGroupSize.lg, }) => {
|
|
5
|
+
export const ToggleButtonGroup = ({ onChange, options, selectedOption, disabled, size = ToggleButtonGroupSize.lg, style, }) => {
|
|
6
6
|
const selectedOptionStyle = {
|
|
7
7
|
backgroundColor: 'var(--colors-light-background-bg-card-highlight-hover)',
|
|
8
8
|
color: 'var(--colors-light-text-text-accent)',
|
|
@@ -26,6 +26,7 @@ export const ToggleButtonGroup = ({ onChange, options, selectedOption, disabled,
|
|
|
26
26
|
borderRadius: 'var(--spacing-tokens-size-in-px-spacing-spacing-md)',
|
|
27
27
|
overflow: 'hidden',
|
|
28
28
|
backgroundColor: 'var(--colors-light-background-bg-component)',
|
|
29
|
+
...style,
|
|
29
30
|
}, gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-xs)', padding: 'var(--spacing-tokens-size-in-px-spacing-spacing-xs)', border: `1px solid var(--colors-light-border-border-component)`, width: 'fit-content', children: options.map((option) => {
|
|
30
31
|
const isSelected = option === selectedOption;
|
|
31
32
|
return (_jsx(MainButton, { text: option, onClick: () => onChange(option), size: getButtonSize(), hierarchy: ButtonHierarchy.Tetriary, type: ButtonType.Button, style: isSelected ? selectedOptionStyle : unselectedOptionStyle, disabled: disabled }, option));
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { CSSProperties } from 'react';
|
|
2
2
|
import { IconName } from '../../utils';
|
|
3
|
+
import { SxProps } from '@mui/material';
|
|
4
|
+
import { Theme } from '@mui/material';
|
|
3
5
|
/**
|
|
4
6
|
* Button size variants
|
|
5
7
|
*/
|
|
@@ -121,4 +123,6 @@ export type ToggleButtonGroupProps = {
|
|
|
121
123
|
disabled?: boolean;
|
|
122
124
|
/** Callback function when the toggle button is selected */
|
|
123
125
|
onChange: (option: string) => void;
|
|
126
|
+
/** Custom style of the toggle button */
|
|
127
|
+
style?: SxProps<Theme>;
|
|
124
128
|
};
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Box, Checkbox as MuiCheckbox } from '@mui/material';
|
|
3
3
|
import { CheckboxType } from './types';
|
|
4
4
|
import { Typography, TypographySize, TypographyWeight } from '../Typography';
|
|
5
|
-
export const Checkbox = ({ type = CheckboxType.Checkbox, label, checked, disabled, required, onChange, }) => {
|
|
5
|
+
export const Checkbox = ({ type = CheckboxType.Checkbox, label, checked, disabled, required, onChange, style, }) => {
|
|
6
6
|
const props = {
|
|
7
7
|
checked,
|
|
8
8
|
disabled,
|
|
@@ -18,7 +18,7 @@ export const Checkbox = ({ type = CheckboxType.Checkbox, label, checked, disable
|
|
|
18
18
|
onChange(event);
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
|
-
return (_jsxs(Box, { display: "flex", alignItems: "center", justifyContent: "space-between", padding: 'var(--spacing-tokens-size-in-px-spacing-spacing-xs)', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-xs)', children: [type === CheckboxType.Checkbox ? (_jsx(MuiCheckbox, { ...props, sx: {
|
|
21
|
+
return (_jsxs(Box, { display: "flex", alignItems: "center", justifyContent: "space-between", padding: 'var(--spacing-tokens-size-in-px-spacing-spacing-xs)', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-xs)', sx: style, children: [type === CheckboxType.Checkbox ? (_jsx(MuiCheckbox, { ...props, sx: {
|
|
22
22
|
padding: 0,
|
|
23
23
|
'&.Mui-checked': {
|
|
24
24
|
color: disabled
|
|
@@ -2,9 +2,10 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useState } from 'react';
|
|
3
3
|
import { Box } from '@mui/material';
|
|
4
4
|
import { Typography, TypographySize, TypographyWeight } from '../Typography';
|
|
5
|
-
|
|
5
|
+
import { HintBubble, HintBubbleSize } from '../UI';
|
|
6
|
+
export const TextArea = ({ label, value, onChange, placeholder, hintText, errorText, disabled, maxLength = 256, showMaxLengthIndicator = false, numberOfRows = 5, style, hintBubbleProps, hintBubbleText, required, }) => {
|
|
6
7
|
const [focused, setFocused] = useState(false);
|
|
7
|
-
return (_jsx(Box, { display: 'flex', flexDirection: 'column', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-sm)', children: _jsxs(Box, { display: 'flex', flexDirection: 'column', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-lg)', minWidth: '260px', children: [_jsx(Typography, { text: label, size: TypographySize.HeadingXS, weight: TypographyWeight.SemiBold }), _jsx(Box, { display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', bgcolor: 'var(--colors-light-background-bg-component)', border: `1px solid ${errorText
|
|
8
|
+
return (_jsx(Box, { display: 'flex', flexDirection: 'column', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-sm)', sx: style, children: _jsxs(Box, { display: 'flex', flexDirection: 'column', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-lg)', minWidth: '260px', children: [label && (_jsx(Typography, { text: label, size: TypographySize.HeadingXS, weight: TypographyWeight.SemiBold, required: required })), hintBubbleText && (_jsx(HintBubble, { text: hintBubbleText, size: HintBubbleSize.sm, ...hintBubbleProps })), _jsx(Box, { display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', bgcolor: 'var(--colors-light-background-bg-component)', border: `1px solid ${errorText
|
|
8
9
|
? 'var(--colors-light-border-border-error)'
|
|
9
10
|
: focused
|
|
10
11
|
? 'var(--colors-light-border-border-component-active)'
|
|
@@ -18,5 +19,5 @@ export const TextArea = ({ label, value, onChange, placeholder, hintText, errorT
|
|
|
18
19
|
: 'var(--colors-light-text-text-title)',
|
|
19
20
|
backgroundColor: 'transparent',
|
|
20
21
|
resize: 'none',
|
|
21
|
-
}, maxLength: maxLength, onFocus: () => setFocused(true), onBlur: () => setFocused(false) }) }), _jsxs(Box, { display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', children: [errorText ? (_jsx(Typography, { text: errorText, size: TypographySize.TextS, weight: TypographyWeight.Regular, color: 'var(--colors-light-text-text-error)' })) : hintText ? (_jsx(Typography, { text: hintText, size: TypographySize.TextS, weight: TypographyWeight.Regular, color: 'var(--colors-light-text-text-subtle)' })) : (_jsx(Box, { style: { flex: 1 } })), showMaxLengthIndicator && maxLength && (_jsx(Typography, { text: `${maxLength - value.length}`, size: TypographySize.TextS, weight: TypographyWeight.Regular, color: 'var(--colors-light-text-text-subtle)', style: { alignSelf: 'flex-end' } }))] })] }) }));
|
|
22
|
+
}, maxLength: maxLength, onFocus: () => setFocused(true), onBlur: () => setFocused(false), required: required }) }), _jsxs(Box, { display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', children: [errorText ? (_jsx(Typography, { text: errorText, size: TypographySize.TextS, weight: TypographyWeight.Regular, color: 'var(--colors-light-text-text-error)' })) : hintText ? (_jsx(Typography, { text: hintText, size: TypographySize.TextS, weight: TypographyWeight.Regular, color: 'var(--colors-light-text-text-subtle)' })) : (_jsx(Box, { style: { flex: 1 } })), showMaxLengthIndicator && maxLength && (_jsx(Typography, { text: `${maxLength - value.length}`, size: TypographySize.TextS, weight: TypographyWeight.Regular, color: 'var(--colors-light-text-text-subtle)', style: { alignSelf: 'flex-end' } }))] })] }) }));
|
|
22
23
|
};
|
|
@@ -96,6 +96,42 @@ declare const meta: {
|
|
|
96
96
|
};
|
|
97
97
|
};
|
|
98
98
|
};
|
|
99
|
+
hintBubbleText: {
|
|
100
|
+
control: "text";
|
|
101
|
+
description: string;
|
|
102
|
+
table: {
|
|
103
|
+
type: {
|
|
104
|
+
summary: string;
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
hintBubbleProps: {
|
|
109
|
+
control: "object";
|
|
110
|
+
description: string;
|
|
111
|
+
table: {
|
|
112
|
+
type: {
|
|
113
|
+
summary: string;
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
required: {
|
|
118
|
+
control: "boolean";
|
|
119
|
+
description: string;
|
|
120
|
+
table: {
|
|
121
|
+
type: {
|
|
122
|
+
summary: string;
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
style: {
|
|
127
|
+
control: "object";
|
|
128
|
+
description: string;
|
|
129
|
+
table: {
|
|
130
|
+
type: {
|
|
131
|
+
summary: string;
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
};
|
|
99
135
|
};
|
|
100
136
|
};
|
|
101
137
|
export default meta;
|
|
@@ -76,6 +76,34 @@ const meta = {
|
|
|
76
76
|
type: { summary: 'number' },
|
|
77
77
|
},
|
|
78
78
|
},
|
|
79
|
+
hintBubbleText: {
|
|
80
|
+
control: 'text',
|
|
81
|
+
description: 'The text of the hint bubble',
|
|
82
|
+
table: {
|
|
83
|
+
type: { summary: 'string' },
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
hintBubbleProps: {
|
|
87
|
+
control: 'object',
|
|
88
|
+
description: 'The props of the hint bubble',
|
|
89
|
+
table: {
|
|
90
|
+
type: { summary: 'object' },
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
required: {
|
|
94
|
+
control: 'boolean',
|
|
95
|
+
description: 'Whether the text area is required',
|
|
96
|
+
table: {
|
|
97
|
+
type: { summary: 'boolean' },
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
style: {
|
|
101
|
+
control: 'object',
|
|
102
|
+
description: 'Style of the text area',
|
|
103
|
+
table: {
|
|
104
|
+
type: { summary: 'object' },
|
|
105
|
+
},
|
|
106
|
+
},
|
|
79
107
|
},
|
|
80
108
|
};
|
|
81
109
|
export default meta;
|
|
@@ -2,9 +2,10 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useState } from 'react';
|
|
3
3
|
import { Box } from '@mui/material';
|
|
4
4
|
import { Typography, TypographySize, TypographyWeight } from '../Typography';
|
|
5
|
-
|
|
5
|
+
import { HintBubble, HintBubbleSize } from '../UI';
|
|
6
|
+
export const TextInput = ({ label, value, onChange, placeholder, hintText, errorText, disabled, trailingText, style, hintBubbleText, hintBubbleProps, required, }) => {
|
|
6
7
|
const [focused, setFocused] = useState(false);
|
|
7
|
-
return (_jsx(Box, { display: 'flex', flexDirection: 'column', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-sm)', children: _jsxs(Box, { display: 'flex', flexDirection: 'column', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-lg)', minWidth: '260px', children: [_jsx(Typography, { text: label, size: TypographySize.HeadingXS, weight: TypographyWeight.SemiBold }), _jsxs(Box, { display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', bgcolor: 'var(--colors-light-background-bg-component)', border: errorText
|
|
8
|
+
return (_jsx(Box, { display: 'flex', flexDirection: 'column', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-sm)', sx: style, children: _jsxs(Box, { display: 'flex', flexDirection: 'column', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-lg)', minWidth: '260px', children: [label && (_jsx(Typography, { text: label, size: TypographySize.HeadingXS, weight: TypographyWeight.SemiBold, required: required })), hintBubbleText && (_jsx(HintBubble, { text: hintBubbleText, size: HintBubbleSize.sm, ...hintBubbleProps })), _jsxs(Box, { display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', bgcolor: 'var(--colors-light-background-bg-component)', border: errorText
|
|
8
9
|
? 'none'
|
|
9
10
|
: '1px solid var(--colors-light-border-border-component)', overflow: 'hidden', borderRadius: 'var(--spacing-tokens-size-in-px-spacing-spacing-xs)', children: [_jsx(Box, { display: 'flex', flexDirection: 'row', padding: 'var(--spacing-tokens-size-in-px-spacing-spacing-lg)', width: '100%', borderRadius: 'var(--spacing-tokens-size-in-px-spacing-spacing-xs) 0 0 var(--spacing-tokens-size-in-px-spacing-spacing-xs)', border: `${errorText
|
|
10
11
|
? '1px solid var(--colors-light-border-border-error)'
|
|
@@ -18,5 +19,5 @@ export const TextInput = ({ label, value, onChange, placeholder, hintText, error
|
|
|
18
19
|
? 'var(--colors-light-text-text-disabled)'
|
|
19
20
|
: 'var(--colors-light-text-text-title)',
|
|
20
21
|
backgroundColor: 'transparent',
|
|
21
|
-
}, onFocus: () => setFocused(true), onBlur: () => setFocused(false) }) }), trailingText && (_jsx(Box, { display: 'flex', alignItems: 'center', height: '100%', padding: 'var(--spacing-tokens-size-in-px-spacing-spacing-lg)', borderLeft: '1px solid var(--colors-light-border-border-component)', children: _jsx(Typography, { text: trailingText, size: TypographySize.TextS, weight: TypographyWeight.Regular, color: 'var(--colors-light-text-text-paragraph)' }) }))] }), errorText && (_jsx(Typography, { text: errorText, size: TypographySize.TextS, weight: TypographyWeight.Regular, color: 'var(--colors-light-text-text-error)' })), hintText && !errorText && (_jsx(Typography, { text: hintText, size: TypographySize.TextS, weight: TypographyWeight.Regular, color: 'var(--colors-light-text-text-subtle)' }))] }) }));
|
|
22
|
+
}, onFocus: () => setFocused(true), onBlur: () => setFocused(false), required: required }) }), trailingText && (_jsx(Box, { display: 'flex', alignItems: 'center', height: '100%', padding: 'var(--spacing-tokens-size-in-px-spacing-spacing-lg)', borderLeft: '1px solid var(--colors-light-border-border-component)', children: _jsx(Typography, { text: trailingText, size: TypographySize.TextS, weight: TypographyWeight.Regular, color: 'var(--colors-light-text-text-paragraph)' }) }))] }), errorText && (_jsx(Typography, { text: errorText, size: TypographySize.TextS, weight: TypographyWeight.Regular, color: 'var(--colors-light-text-text-error)' })), hintText && !errorText && (_jsx(Typography, { text: hintText, size: TypographySize.TextS, weight: TypographyWeight.Regular, color: 'var(--colors-light-text-text-subtle)' }))] }) }));
|
|
22
23
|
};
|
|
@@ -78,6 +78,42 @@ declare const meta: {
|
|
|
78
78
|
};
|
|
79
79
|
};
|
|
80
80
|
};
|
|
81
|
+
hintBubbleProps: {
|
|
82
|
+
control: "object";
|
|
83
|
+
description: string;
|
|
84
|
+
table: {
|
|
85
|
+
type: {
|
|
86
|
+
summary: string;
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
hintBubbleText: {
|
|
91
|
+
control: "text";
|
|
92
|
+
description: string;
|
|
93
|
+
table: {
|
|
94
|
+
type: {
|
|
95
|
+
summary: string;
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
required: {
|
|
100
|
+
control: "boolean";
|
|
101
|
+
description: string;
|
|
102
|
+
table: {
|
|
103
|
+
type: {
|
|
104
|
+
summary: string;
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
style: {
|
|
109
|
+
control: "object";
|
|
110
|
+
description: string;
|
|
111
|
+
table: {
|
|
112
|
+
type: {
|
|
113
|
+
summary: string;
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
};
|
|
81
117
|
};
|
|
82
118
|
};
|
|
83
119
|
export default meta;
|
|
@@ -62,6 +62,34 @@ const meta = {
|
|
|
62
62
|
type: { summary: 'function' },
|
|
63
63
|
},
|
|
64
64
|
},
|
|
65
|
+
hintBubbleProps: {
|
|
66
|
+
control: 'object',
|
|
67
|
+
description: 'The props of the hint bubble',
|
|
68
|
+
table: {
|
|
69
|
+
type: { summary: 'object' },
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
hintBubbleText: {
|
|
73
|
+
control: 'text',
|
|
74
|
+
description: 'The text of the hint bubble',
|
|
75
|
+
table: {
|
|
76
|
+
type: { summary: 'string' },
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
required: {
|
|
80
|
+
control: 'boolean',
|
|
81
|
+
description: 'Whether the text input is required',
|
|
82
|
+
table: {
|
|
83
|
+
type: { summary: 'boolean' },
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
style: {
|
|
87
|
+
control: 'object',
|
|
88
|
+
description: 'Style of the text input',
|
|
89
|
+
table: {
|
|
90
|
+
type: { summary: 'object' },
|
|
91
|
+
},
|
|
92
|
+
},
|
|
65
93
|
},
|
|
66
94
|
};
|
|
67
95
|
export default meta;
|
|
@@ -70,5 +98,6 @@ export const Default = {
|
|
|
70
98
|
label: "Agent's name",
|
|
71
99
|
value: 'Anna',
|
|
72
100
|
onChange: () => { },
|
|
101
|
+
hintBubbleText: 'This is a hint bubble',
|
|
73
102
|
},
|
|
74
103
|
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { SxProps, Theme } from '@mui/material';
|
|
2
|
+
import { HintBubbleProps } from '../UI';
|
|
2
3
|
/**
|
|
3
4
|
* Text area component props
|
|
4
5
|
*/
|
|
5
6
|
export type TextAreaProps = {
|
|
6
7
|
/** Text area label */
|
|
7
|
-
label
|
|
8
|
+
label?: string;
|
|
8
9
|
/** Text area value */
|
|
9
10
|
value: string;
|
|
10
11
|
/** Text area onChange */
|
|
@@ -23,13 +24,21 @@ export type TextAreaProps = {
|
|
|
23
24
|
showMaxLengthIndicator?: boolean;
|
|
24
25
|
/** Text input number of rows */
|
|
25
26
|
numberOfRows?: number;
|
|
27
|
+
/** Text input hint bubble */
|
|
28
|
+
hintBubbleText?: string;
|
|
29
|
+
/** Text input hint bubble props */
|
|
30
|
+
hintBubbleProps?: Omit<HintBubbleProps, 'text'>;
|
|
31
|
+
/** Custom style of the text area */
|
|
32
|
+
style?: SxProps<Theme>;
|
|
33
|
+
/** Whether the text area is required */
|
|
34
|
+
required?: boolean;
|
|
26
35
|
};
|
|
27
36
|
/**
|
|
28
37
|
* Text input component props
|
|
29
38
|
*/
|
|
30
39
|
export type TextInputProps = {
|
|
31
40
|
/** Text input label */
|
|
32
|
-
label
|
|
41
|
+
label?: string;
|
|
33
42
|
/** Text input value */
|
|
34
43
|
value: string;
|
|
35
44
|
/** Text input onChange */
|
|
@@ -44,6 +53,14 @@ export type TextInputProps = {
|
|
|
44
53
|
disabled?: boolean;
|
|
45
54
|
/** Text input trailing text */
|
|
46
55
|
trailingText?: string;
|
|
56
|
+
/** Text input hint bubble */
|
|
57
|
+
hintBubbleText?: string;
|
|
58
|
+
/** Text input hint bubble props */
|
|
59
|
+
hintBubbleProps?: Omit<HintBubbleProps, 'text'>;
|
|
60
|
+
/** Text input style */
|
|
61
|
+
style?: SxProps<Theme>;
|
|
62
|
+
/** Whether the text input is required */
|
|
63
|
+
required?: boolean;
|
|
47
64
|
};
|
|
48
65
|
/**
|
|
49
66
|
* Toggle position variants
|
|
@@ -91,6 +108,8 @@ export type CheckboxProps = {
|
|
|
91
108
|
required?: boolean;
|
|
92
109
|
/** Event handler for the checkbox */
|
|
93
110
|
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
111
|
+
/** Custom style of the checkbox */
|
|
112
|
+
style?: SxProps<Theme>;
|
|
94
113
|
};
|
|
95
114
|
export interface FileUploadProps {
|
|
96
115
|
/** Whether the file upload is disabled */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { TypographySize, TypographyWeight } from './types';
|
|
3
|
-
export const Typography = ({ text, color, size = TypographySize.HeadingL, weight = TypographyWeight.Bold, className, style, }) => {
|
|
3
|
+
export const Typography = ({ text, color, size = TypographySize.HeadingL, weight = TypographyWeight.Bold, className, required = false, style, }) => {
|
|
4
4
|
const getTypographySizeToken = () => {
|
|
5
5
|
let sizeLc = size?.toLowerCase() || '';
|
|
6
6
|
if (sizeLc.includes('heading')) {
|
|
@@ -35,8 +35,9 @@ export const Typography = ({ text, color, size = TypographySize.HeadingL, weight
|
|
|
35
35
|
.trim();
|
|
36
36
|
return (computedValue === 'uppercase' ? 'uppercase' : 'none');
|
|
37
37
|
};
|
|
38
|
-
return (
|
|
39
|
-
display: '
|
|
38
|
+
return (_jsxs("span", { className: className, style: {
|
|
39
|
+
display: 'flex',
|
|
40
|
+
alignItems: 'center',
|
|
40
41
|
fontSize: fontSize,
|
|
41
42
|
fontWeight: fontWeight,
|
|
42
43
|
fontFamily: fontFamily + ', sans-serif',
|
|
@@ -47,6 +48,7 @@ export const Typography = ({ text, color, size = TypographySize.HeadingL, weight
|
|
|
47
48
|
textTransform: getTextTransform(),
|
|
48
49
|
textDecoration: textDecoration,
|
|
49
50
|
color: color || 'var(--global-text-text-title)',
|
|
51
|
+
gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-xs)',
|
|
50
52
|
...style,
|
|
51
|
-
}, children: text }));
|
|
53
|
+
}, children: [text, required && (_jsx("span", { style: { color: 'var(--colors-light-text-text-error)' }, children: "*" }))] }));
|
|
52
54
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Typography } from './Typography';
|
|
2
2
|
import { TypographySize, TypographyWeight } from './types';
|
|
3
3
|
const meta = {
|
|
4
|
-
title: 'Design System/
|
|
4
|
+
title: 'Design System/Components/Typography/Typography',
|
|
5
5
|
component: Typography,
|
|
6
6
|
parameters: {
|
|
7
7
|
layout: 'centered',
|
|
@@ -44,6 +44,27 @@ const meta = {
|
|
|
44
44
|
type: { summary: 'string' },
|
|
45
45
|
},
|
|
46
46
|
},
|
|
47
|
+
required: {
|
|
48
|
+
control: 'boolean',
|
|
49
|
+
description: 'Whether the typography is required',
|
|
50
|
+
table: {
|
|
51
|
+
type: { summary: 'boolean' },
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
style: {
|
|
55
|
+
control: 'object',
|
|
56
|
+
description: 'Style of the typography',
|
|
57
|
+
table: {
|
|
58
|
+
type: { summary: 'object' },
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
className: {
|
|
62
|
+
control: 'text',
|
|
63
|
+
description: 'Class name of the typography',
|
|
64
|
+
table: {
|
|
65
|
+
type: { summary: 'string' },
|
|
66
|
+
},
|
|
67
|
+
},
|
|
47
68
|
},
|
|
48
69
|
};
|
|
49
70
|
export default meta;
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { Box } from '@mui/material';
|
|
3
3
|
import { Typography, TypographySize, TypographyWeight } from '../Typography';
|
|
4
4
|
import { HintBubbleSize, HintBubbleType } from './types';
|
|
5
|
-
export const HintBubble = ({ text, size = HintBubbleSize.md, type = HintBubbleType.Info, }) => {
|
|
5
|
+
export const HintBubble = ({ text, size = HintBubbleSize.md, type = HintBubbleType.Info, style, }) => {
|
|
6
6
|
const getPadding = () => {
|
|
7
7
|
if (size === HintBubbleSize.sm) {
|
|
8
8
|
return 'var(--spacing-tokens-size-in-px-spacing-spacing-md) var(--spacing-tokens-size-in-px-spacing-spacing-lg)';
|
|
@@ -24,5 +24,5 @@ export const HintBubble = ({ text, size = HintBubbleSize.md, type = HintBubbleTy
|
|
|
24
24
|
return 'var(--colors-light-text-text-error)';
|
|
25
25
|
return 'var(--colors-light-text-text-title)';
|
|
26
26
|
};
|
|
27
|
-
return (_jsx(Box, { borderRadius: 'var(--spacing-tokens-size-in-px-spacing-spacing-md)', bgcolor: 'var(--colors-light-background-bg-card-highlight)', padding: getPadding(), gap: '10px', children: _jsx(Typography, { text: text, size: getTypographySize(), weight: getTypographyWeight(), color: getTypographyColor() }) }));
|
|
27
|
+
return (_jsx(Box, { borderRadius: 'var(--spacing-tokens-size-in-px-spacing-spacing-md)', bgcolor: 'var(--colors-light-background-bg-card-highlight)', padding: getPadding(), gap: '10px', sx: style, children: _jsx(Typography, { text: text, size: getTypographySize(), weight: getTypographyWeight(), color: getTypographyColor() }) }));
|
|
28
28
|
};
|
|
@@ -98,6 +98,8 @@ export type HintBubbleProps = {
|
|
|
98
98
|
size?: HintBubbleSize;
|
|
99
99
|
/** Text of the hint bubble */
|
|
100
100
|
text: string;
|
|
101
|
+
/** Custom style of the hint bubble */
|
|
102
|
+
style?: SxProps<Theme>;
|
|
101
103
|
};
|
|
102
104
|
export declare enum LogoVariant {
|
|
103
105
|
Horizontal = "horizontal",
|