@beydesign/storybook 0.0.87 → 0.0.90
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/Buttons/MainButton.js +16 -0
- package/dist/stories/Buttons/MainButton.stories.d.ts +1 -0
- package/dist/stories/Buttons/MainButton.stories.js +7 -0
- package/dist/stories/Buttons/types.d.ts +1 -0
- package/dist/stories/Buttons/types.js +1 -0
- package/dist/stories/Form/TextInput.js +2 -2
- package/dist/stories/Form/TextInput.stories.d.ts +12 -0
- package/dist/stories/Form/TextInput.stories.js +26 -0
- package/dist/stories/Form/types.d.ts +3 -0
- package/package.json +1 -1
|
@@ -24,6 +24,10 @@ const StyledButton = styled.button `
|
|
|
24
24
|
if (props.$state === ButtonState.Disabled || props.$disabled)
|
|
25
25
|
return 'var(--colors-light-background-bg-button-disabled)';
|
|
26
26
|
return 'var(--colors-light-background-bg-brand)';
|
|
27
|
+
case ButtonHierarchy.PrimaryLemon:
|
|
28
|
+
if (props.$state === ButtonState.Disabled || props.$disabled)
|
|
29
|
+
return 'var(--colors-light-background-bg-element)';
|
|
30
|
+
return 'var(--primitives-desktop-primary-brand-lemon-400)';
|
|
27
31
|
case ButtonHierarchy.Secondary:
|
|
28
32
|
if (props.$state === ButtonState.Disabled || props.$disabled)
|
|
29
33
|
return 'var(--colors-light-background-bg-component-disabled)';
|
|
@@ -59,6 +63,10 @@ const StyledButton = styled.button `
|
|
|
59
63
|
if (props.$state === ButtonState.Disabled || props.$disabled)
|
|
60
64
|
return 'var(--colors-light-text-text-white)';
|
|
61
65
|
return 'var(--colors-light-text-text-white)';
|
|
66
|
+
case ButtonHierarchy.PrimaryLemon:
|
|
67
|
+
if (props.$state === ButtonState.Disabled || props.$disabled)
|
|
68
|
+
return 'var(--colors-light-text-text-subtle)';
|
|
69
|
+
return 'var(--colors-light-text-text-title)';
|
|
62
70
|
case ButtonHierarchy.Secondary:
|
|
63
71
|
if (props.$state === ButtonState.Disabled || props.$disabled)
|
|
64
72
|
return 'var(--colors-light-text-text-disabled)';
|
|
@@ -95,6 +103,10 @@ const StyledButton = styled.button `
|
|
|
95
103
|
if (props.$state === ButtonState.Disabled || props.$disabled)
|
|
96
104
|
return 'var(--colors-light-border-border-component)';
|
|
97
105
|
return 'var(--colors-light-background-bg-brand)';
|
|
106
|
+
case ButtonHierarchy.PrimaryLemon:
|
|
107
|
+
if (props.$state === ButtonState.Disabled || props.$disabled)
|
|
108
|
+
return 'var(--colors-light-border-border-component)';
|
|
109
|
+
return 'var(--primitives-desktop-primary-brand-lemon-400)';
|
|
98
110
|
case ButtonHierarchy.Secondary:
|
|
99
111
|
if (props.$state === ButtonState.Disabled || props.$disabled)
|
|
100
112
|
return 'var(--colors-light-border-border-component)';
|
|
@@ -141,6 +153,8 @@ const StyledButton = styled.button `
|
|
|
141
153
|
switch (props.$hierarchy) {
|
|
142
154
|
case ButtonHierarchy.Primary:
|
|
143
155
|
return 'var(--colors-light-background-bg-brand-hover)';
|
|
156
|
+
case ButtonHierarchy.PrimaryLemon:
|
|
157
|
+
return 'var(--primitives-desktop-primary-brand-lemon-500)';
|
|
144
158
|
case ButtonHierarchy.Secondary:
|
|
145
159
|
return 'var(--colors-light-background-bg-card-highlight-hover)';
|
|
146
160
|
case ButtonHierarchy.SecondaryColor:
|
|
@@ -162,6 +176,8 @@ const StyledButton = styled.button `
|
|
|
162
176
|
switch (props.$hierarchy) {
|
|
163
177
|
case ButtonHierarchy.Primary:
|
|
164
178
|
return 'var(--colors-light-background-bg-brand-hover)';
|
|
179
|
+
case ButtonHierarchy.PrimaryLemon:
|
|
180
|
+
return 'var(--primitives-desktop-primary-brand-lemon-500)';
|
|
165
181
|
case ButtonHierarchy.Secondary:
|
|
166
182
|
return 'var(--colors-light-background-bg-card-highlight-hover)';
|
|
167
183
|
case ButtonHierarchy.SecondaryColor:
|
|
@@ -4,6 +4,7 @@ declare const meta: Meta<typeof MainButton>;
|
|
|
4
4
|
export default meta;
|
|
5
5
|
type Story = StoryObj<typeof MainButton>;
|
|
6
6
|
export declare const Primary: Story;
|
|
7
|
+
export declare const PrimaryLemon: Story;
|
|
7
8
|
export declare const Secondary: Story;
|
|
8
9
|
export declare const SecondaryColor: Story;
|
|
9
10
|
export declare const SecondaryTransparent: Story;
|
|
@@ -32,6 +32,7 @@ const meta = {
|
|
|
32
32
|
control: 'select',
|
|
33
33
|
options: [
|
|
34
34
|
'Primary',
|
|
35
|
+
'Primary-lemon',
|
|
35
36
|
'Secondary',
|
|
36
37
|
'Secondary-color',
|
|
37
38
|
'Secondary-transparent',
|
|
@@ -144,6 +145,12 @@ export const Primary = {
|
|
|
144
145
|
trailingIcon: 'Circle',
|
|
145
146
|
},
|
|
146
147
|
};
|
|
148
|
+
export const PrimaryLemon = {
|
|
149
|
+
args: {
|
|
150
|
+
...Primary.args,
|
|
151
|
+
hierarchy: ButtonHierarchy.PrimaryLemon,
|
|
152
|
+
},
|
|
153
|
+
};
|
|
147
154
|
export const Secondary = {
|
|
148
155
|
args: {
|
|
149
156
|
...Primary.args,
|
|
@@ -16,6 +16,7 @@ export var ButtonSize;
|
|
|
16
16
|
export var ButtonHierarchy;
|
|
17
17
|
(function (ButtonHierarchy) {
|
|
18
18
|
ButtonHierarchy["Primary"] = "Primary";
|
|
19
|
+
ButtonHierarchy["PrimaryLemon"] = "Primary-lemon";
|
|
19
20
|
ButtonHierarchy["Secondary"] = "Secondary";
|
|
20
21
|
ButtonHierarchy["SecondaryColor"] = "Secondary-color";
|
|
21
22
|
ButtonHierarchy["SecondaryTransparent"] = "Secondary-transparent";
|
|
@@ -3,7 +3,7 @@ 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, labelTrailingElement, labelContainerStyle, }) => {
|
|
6
|
+
export const TextInput = ({ label, value, onChange, placeholder, type = 'text', hintText, errorText, disabled, trailingText, style, hintBubbleText, hintBubbleProps, required, labelTrailingElement, labelContainerStyle, }) => {
|
|
7
7
|
const [focused, setFocused] = useState(false);
|
|
8
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 && (_jsxs(Box, { display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'flex-start', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-sm)', sx: labelContainerStyle, children: [_jsx(Typography, { size: TypographySize.HeadingXS, weight: TypographyWeight.SemiBold, required: required, children: label }), labelTrailingElement] })), 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
|
|
9
9
|
? 'none'
|
|
@@ -11,7 +11,7 @@ export const TextInput = ({ label, value, onChange, placeholder, hintText, error
|
|
|
11
11
|
? '1px solid var(--colors-light-border-border-error)'
|
|
12
12
|
: focused
|
|
13
13
|
? '1px solid var(--colors-light-border-border-component-active)'
|
|
14
|
-
: 'transparent'}`, children: _jsx("input", { type:
|
|
14
|
+
: 'transparent'}`, children: _jsx("input", { type: type, value: value, onChange: (e) => onChange(e.target.value), placeholder: placeholder, disabled: disabled, style: {
|
|
15
15
|
border: 'none',
|
|
16
16
|
outline: 'none',
|
|
17
17
|
width: '100%',
|
|
@@ -34,6 +34,16 @@ declare const meta: {
|
|
|
34
34
|
};
|
|
35
35
|
};
|
|
36
36
|
};
|
|
37
|
+
type: {
|
|
38
|
+
control: "select";
|
|
39
|
+
description: string;
|
|
40
|
+
options: string[];
|
|
41
|
+
table: {
|
|
42
|
+
type: {
|
|
43
|
+
summary: string;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
};
|
|
37
47
|
hintText: {
|
|
38
48
|
control: "text";
|
|
39
49
|
description: string;
|
|
@@ -128,3 +138,5 @@ declare const meta: {
|
|
|
128
138
|
export default meta;
|
|
129
139
|
type Story = StoryObj<typeof meta>;
|
|
130
140
|
export declare const Default: Story;
|
|
141
|
+
export declare const Password: Story;
|
|
142
|
+
export declare const Email: Story;
|
|
@@ -28,6 +28,14 @@ const meta = {
|
|
|
28
28
|
type: { summary: 'string' },
|
|
29
29
|
},
|
|
30
30
|
},
|
|
31
|
+
type: {
|
|
32
|
+
control: 'select',
|
|
33
|
+
description: 'The type of the text input',
|
|
34
|
+
options: ['text', 'password', 'email', 'number', 'tel', 'url'],
|
|
35
|
+
table: {
|
|
36
|
+
type: { summary: 'string' },
|
|
37
|
+
},
|
|
38
|
+
},
|
|
31
39
|
hintText: {
|
|
32
40
|
control: 'text',
|
|
33
41
|
description: 'The hint text of the text input',
|
|
@@ -108,3 +116,21 @@ export const Default = {
|
|
|
108
116
|
hintBubbleText: 'This is a hint bubble',
|
|
109
117
|
},
|
|
110
118
|
};
|
|
119
|
+
export const Password = {
|
|
120
|
+
args: {
|
|
121
|
+
label: 'Password',
|
|
122
|
+
value: 'password',
|
|
123
|
+
type: 'password',
|
|
124
|
+
onChange: () => { },
|
|
125
|
+
hintBubbleText: 'This is a hint bubble',
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
export const Email = {
|
|
129
|
+
args: {
|
|
130
|
+
label: 'Email',
|
|
131
|
+
value: 'email',
|
|
132
|
+
type: 'email',
|
|
133
|
+
onChange: () => { },
|
|
134
|
+
hintBubbleText: 'This is a hint bubble',
|
|
135
|
+
},
|
|
136
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { SxProps, Theme } from '@mui/material';
|
|
2
2
|
import { HintBubbleProps } from '../UI';
|
|
3
3
|
import { IconName } from '../../utils';
|
|
4
|
+
import React from 'react';
|
|
4
5
|
/**
|
|
5
6
|
* Text area component props
|
|
6
7
|
*/
|
|
@@ -52,6 +53,8 @@ export type TextInputProps = {
|
|
|
52
53
|
onChange: (value: string) => void;
|
|
53
54
|
/** Text input placeholder */
|
|
54
55
|
placeholder?: string;
|
|
56
|
+
/** Text input type */
|
|
57
|
+
type?: React.InputHTMLAttributes<HTMLInputElement>['type'];
|
|
55
58
|
/** Text input hint */
|
|
56
59
|
hintText?: string;
|
|
57
60
|
/** Text input error */
|