ff-ds-ui 0.0.2 → 0.0.4
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/.husky/pre-commit +2 -0
- package/.prettierrc +7 -0
- package/.storybook/main.ts +14 -0
- package/.storybook/preview.ts +21 -0
- package/.storybook/vitest.setup.ts +7 -0
- package/LICENSE +21 -21
- package/README.md +13 -73
- package/eslint.config.js +29 -23
- package/package.json +57 -36
- package/src/components/Avatar/Avatar.scss +90 -0
- package/src/components/Avatar/Avatar.tsx +40 -0
- package/src/components/Avatar/__stories__/Avatar.stories.tsx +21 -0
- package/src/components/Avatar/__test__/utils.test.ts +76 -0
- package/src/components/Avatar/index.ts +1 -0
- package/src/components/Avatar/utils.tsx +26 -0
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +40 -0
- package/src/components/Breadcrumbs/__stories__/Breadcrumbs.stories.tsx +20 -0
- package/src/components/Breadcrumbs/index.ts +1 -0
- package/src/components/Button/Button.scss +245 -0
- package/src/components/Button/Button.tsx +34 -0
- package/src/components/Button/__stories__/Button.stories.tsx +168 -0
- package/src/components/Button/const.ts +26 -0
- package/src/components/Button/index.ts +1 -0
- package/src/components/Card/Card.scss +13 -0
- package/src/components/Card/Card.tsx +12 -0
- package/src/components/Card/__stories__/Card.stories.tsx +18 -0
- package/src/components/Card/index.ts +1 -0
- package/src/components/Checkbox/Checkbox.scss +28 -0
- package/src/components/Checkbox/Checkbox.tsx +23 -0
- package/src/components/Checkbox/__stories__/Checkbox.stories.tsx +21 -0
- package/src/components/Checkbox/index.ts +1 -0
- package/src/components/Divider/Divider.scss +62 -0
- package/src/components/Divider/Divider.tsx +21 -0
- package/src/components/Divider/__stories__/Divider.stories.tsx +68 -0
- package/src/components/Divider/index.ts +1 -0
- package/src/components/Flex/Flex.scss +94 -0
- package/src/components/Flex/Flex.tsx +41 -0
- package/src/components/Flex/__stories__/Flex.stories.tsx +27 -0
- package/src/components/Flex/index.ts +1 -0
- package/src/components/Label/Label.scss +53 -0
- package/src/components/Label/Label.tsx +27 -0
- package/src/components/Label/__stories__/Label.stories.tsx +26 -0
- package/src/components/Label/index.ts +1 -0
- package/src/components/Link/Link.scss +13 -0
- package/src/components/Link/Link.tsx +18 -0
- package/src/components/Link/__stories__/Link.stories.tsx +20 -0
- package/src/components/Link/index.ts +1 -0
- package/src/components/Loader/Loader.scss +56 -0
- package/src/components/Loader/Loader.tsx +33 -0
- package/src/components/Loader/__stories__/Loader.stories.tsx +18 -0
- package/src/components/Loader/const.ts +7 -0
- package/src/components/Loader/index.ts +1 -0
- package/src/components/Radio/Radio.scss +28 -0
- package/src/components/Radio/Radio.tsx +24 -0
- package/src/components/Radio/__stories__/Radio.stories.tsx +21 -0
- package/src/components/Radio/index.ts +1 -0
- package/src/components/Skeleton/Skeleton.scss +73 -0
- package/src/components/Skeleton/Skeleton.tsx +16 -0
- package/src/components/Skeleton/__stories__/Skeleton.stories.tsx +16 -0
- package/src/components/Skeleton/index.ts +1 -0
- package/src/components/Tabs/Tabs.scss +25 -0
- package/src/components/Tabs/Tabs.tsx +39 -0
- package/src/components/Tabs/__stories__/Tabs.stories.tsx +19 -0
- package/src/components/Tabs/index.ts +1 -0
- package/src/components/Text/Text.scss +30 -0
- package/src/components/Text/Text.tsx +68 -0
- package/src/components/Text/_stories_/Text.stories.tsx +95 -0
- package/src/components/Text/index.ts +1 -0
- package/src/components/TextArea/TextArea.scss +45 -0
- package/src/components/TextArea/TextArea.tsx +38 -0
- package/src/components/TextArea/__stories__/TextArea.stories.tsx +20 -0
- package/src/components/TextArea/index.ts +1 -0
- package/src/components/TextInput/TextInput.scss +92 -0
- package/src/components/TextInput/TextInput.tsx +43 -0
- package/src/components/TextInput/__stories__/TextInput.stories.tsx +40 -0
- package/src/components/TextInput/index.ts +1 -0
- package/src/components/User/User.scss +7 -0
- package/src/components/User/User.tsx +23 -0
- package/src/components/User/__stories__/User.stories.tsx +23 -0
- package/src/components/User/index.ts +1 -0
- package/src/components/index.ts +17 -0
- package/src/index.ts +1 -1
- package/src/stories/modules.mdx +14 -0
- package/src/styles/fonts.scss +1 -0
- package/src/styles/mixins/_index.scss +18 -0
- package/src/styles/mixins/button.scss +29 -0
- package/src/styles/mixins/typography.scss +107 -0
- package/src/styles/styles.scss +3 -0
- package/src/styles/variables/_index.scss +25 -0
- package/src/styles/variables/colors.scss +45 -0
- package/src/styles/variables/padding.scss +7 -0
- package/src/styles/variables/radius.scss +8 -0
- package/src/styles/variables/spacing.scss +15 -0
- package/src/styles/variables/typography.scss +66 -0
- package/src/utils/bem/__tests__/bem.test.ts +25 -0
- package/src/utils/bem/bem.ts +24 -0
- package/src/utils/index.ts +1 -0
- package/tsconfig.app.json +28 -28
- package/tsconfig.build.json +16 -0
- package/tsconfig.json +4 -7
- package/tsconfig.node.json +26 -26
- package/vite.config.ts +78 -32
- package/vitest.shims.d.ts +1 -0
- package/index.html +0 -13
- package/public/vite.svg +0 -1
- package/src/components/Button.tsx +0 -9
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
@use '../../styles/styles' as MainStyles;
|
|
2
|
+
@use '../../styles/variables' as Variables;
|
|
3
|
+
@use '../../styles/mixins' as Mixins;
|
|
4
|
+
|
|
5
|
+
$block: '.#{MainStyles.$ns}button';
|
|
6
|
+
|
|
7
|
+
#{$block} {
|
|
8
|
+
@include Mixins.button-reset-styles;
|
|
9
|
+
@include Variables.variables-padding;
|
|
10
|
+
@include Variables.variables-radius;
|
|
11
|
+
@include Variables.variables-colors;
|
|
12
|
+
|
|
13
|
+
background: transparent;
|
|
14
|
+
border-radius: 8px;
|
|
15
|
+
box-sizing: border-box;
|
|
16
|
+
|
|
17
|
+
display: flex;
|
|
18
|
+
justify-content: center;
|
|
19
|
+
align-items: center;
|
|
20
|
+
|
|
21
|
+
/*
|
|
22
|
+
States
|
|
23
|
+
*/
|
|
24
|
+
&_loading {
|
|
25
|
+
&::after {
|
|
26
|
+
content: '...';
|
|
27
|
+
animation: fade 1.4s infinite;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@keyframes fade {
|
|
31
|
+
0% {
|
|
32
|
+
opacity: 0.2;
|
|
33
|
+
}
|
|
34
|
+
50% {
|
|
35
|
+
opacity: 1;
|
|
36
|
+
}
|
|
37
|
+
100% {
|
|
38
|
+
opacity: 0.2;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&:disabled {
|
|
44
|
+
opacity: 0.5;
|
|
45
|
+
cursor: default;
|
|
46
|
+
pointer-events: none;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&:active {
|
|
50
|
+
transform: scale(0.99);
|
|
51
|
+
-webkit-transform: scale(0.99);
|
|
52
|
+
-moz-transform: scale(0.99);
|
|
53
|
+
-ms-transform: scale(0.99);
|
|
54
|
+
-o-transform: scale(0.99);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
&:focus {
|
|
58
|
+
outline: 2px solid;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/*
|
|
62
|
+
Variants
|
|
63
|
+
*/
|
|
64
|
+
&_variant {
|
|
65
|
+
/*
|
|
66
|
+
Base
|
|
67
|
+
*/
|
|
68
|
+
&_brand {
|
|
69
|
+
background: var(--FF-DS-color-brand-base);
|
|
70
|
+
border: 1px solid var(--FF-DS-color-brand-border);
|
|
71
|
+
color: var(--FF-DS-color-brand-text);
|
|
72
|
+
@include Mixins.outlined-hover(--FF-DS-color-brand-base-rgb, 0.7, 0.9);
|
|
73
|
+
}
|
|
74
|
+
&_primary {
|
|
75
|
+
background: var(--FF-DS-color-primary-base);
|
|
76
|
+
border: 1px solid var(--FF-DS-color-primary-border);
|
|
77
|
+
color: var(--FF-DS-color-primary-text);
|
|
78
|
+
@include Mixins.outlined-hover(--FF-DS-color-primary-base-rgb, 0.7, 0.9);
|
|
79
|
+
}
|
|
80
|
+
&_success {
|
|
81
|
+
background: var(--FF-DS-color-success-base);
|
|
82
|
+
border: 1px solid var(--FF-DS-color-success-border);
|
|
83
|
+
color: var(--FF-DS-color-success-text);
|
|
84
|
+
@include Mixins.outlined-hover(--FF-DS-color-success-base-rgb, 0.7, 0.9);
|
|
85
|
+
}
|
|
86
|
+
&_warning {
|
|
87
|
+
background: var(--FF-DS-color-warning-base);
|
|
88
|
+
border: 1px solid var(--FF-DS-color-warning-border);
|
|
89
|
+
color: var(--FF-DS-color-warning-text);
|
|
90
|
+
@include Mixins.outlined-hover(--FF-DS-color-warning-base-rgb, 0.7, 0.9);
|
|
91
|
+
}
|
|
92
|
+
&_secondary {
|
|
93
|
+
background: var(--FF-DS-color-secondary-base);
|
|
94
|
+
border: 1px solid var(--FF-DS-color-secondary-border);
|
|
95
|
+
color: var(--FF-DS-color-secondary-text);
|
|
96
|
+
@include Mixins.outlined-hover(--FF-DS-color-secondary-base-rgb, 0.7, 0.9);
|
|
97
|
+
}
|
|
98
|
+
&_error {
|
|
99
|
+
background: var(--FF-DS-color-error-base);
|
|
100
|
+
border: 1px solid var(--FF-DS-color-error-border);
|
|
101
|
+
color: var(--FF-DS-color-error-text);
|
|
102
|
+
@include Mixins.outlined-hover(--FF-DS-color-error-base-rgb, 0.7, 0.9);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// /*
|
|
106
|
+
// Outlined
|
|
107
|
+
// */
|
|
108
|
+
&_outlined-brand {
|
|
109
|
+
border: 1px solid var(--FF-DS-color-brand-border);
|
|
110
|
+
color: var(--FF-DS-color-brand-border);
|
|
111
|
+
@include Mixins.outlined-hover(--FF-DS-color-brand-base-rgb, 0.2, 0.25);
|
|
112
|
+
}
|
|
113
|
+
&_outlined-primary {
|
|
114
|
+
border: 1px solid var(--FF-DS-color-primary-border);
|
|
115
|
+
color: var(--FF-DS-color-primary-border);
|
|
116
|
+
@include Mixins.outlined-hover(--FF-DS-color-primary-base-rgb, 0.2, 0.25);
|
|
117
|
+
}
|
|
118
|
+
&_outlined-success {
|
|
119
|
+
border: 1px solid var(--FF-DS-color-success-border);
|
|
120
|
+
color: var(--FF-DS-color-success-border);
|
|
121
|
+
@include Mixins.outlined-hover(--FF-DS-color-success-base-rgb, 0.2, 0.25);
|
|
122
|
+
}
|
|
123
|
+
&_outlined-warning {
|
|
124
|
+
border: 1px solid var(--FF-DS-color-warning-border);
|
|
125
|
+
color: var(--FF-DS-color-warning-border);
|
|
126
|
+
@include Mixins.outlined-hover(--FF-DS-color-warning-base-rgb, 0.2, 0.25);
|
|
127
|
+
}
|
|
128
|
+
&_outlined-secondary {
|
|
129
|
+
border: 1px solid var(--FF-DS-color-secondary-border);
|
|
130
|
+
color: var(--FF-DS-color-secondary-border);
|
|
131
|
+
@include Mixins.outlined-hover(--FF-DS-color-secondary-base-rgb, 0.2, 0.25);
|
|
132
|
+
}
|
|
133
|
+
&_outlined-error {
|
|
134
|
+
border: 1px solid var(--FF-DS-color-error-border);
|
|
135
|
+
color: var(--FF-DS-color-error-border);
|
|
136
|
+
@include Mixins.outlined-hover(--FF-DS-color-error-base-rgb, 0.2, 0.25);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// /*
|
|
140
|
+
// Flat
|
|
141
|
+
// */
|
|
142
|
+
&_flat-brand {
|
|
143
|
+
border: none;
|
|
144
|
+
color: var(--FF-DS-color-brand-border);
|
|
145
|
+
@include Mixins.outlined-hover(--FF-DS-color-brand-base-rgb, 0.2, 0.25);
|
|
146
|
+
}
|
|
147
|
+
&_flat-primary {
|
|
148
|
+
border: none;
|
|
149
|
+
color: var(--FF-DS-color-primary-border);
|
|
150
|
+
@include Mixins.outlined-hover(--FF-DS-color-primary-base-rgb, 0.2, 0.25);
|
|
151
|
+
}
|
|
152
|
+
&_flat-success {
|
|
153
|
+
border: none;
|
|
154
|
+
color: var(--FF-DS-color-success-border);
|
|
155
|
+
@include Mixins.outlined-hover(--FF-DS-color-success-base-rgb, 0.2, 0.25);
|
|
156
|
+
}
|
|
157
|
+
&_flat-warning {
|
|
158
|
+
border: none;
|
|
159
|
+
color: var(--FF-DS-color-warning-border);
|
|
160
|
+
@include Mixins.outlined-hover(--FF-DS-color-warning-base-rgb, 0.2, 0.25);
|
|
161
|
+
}
|
|
162
|
+
&_flat-secondary {
|
|
163
|
+
border: none;
|
|
164
|
+
color: var(--FF-DS-color-secondary-border);
|
|
165
|
+
@include Mixins.outlined-hover(--FF-DS-color-secondary-base-rgb, 0.2, 0.25);
|
|
166
|
+
}
|
|
167
|
+
&_flat-error {
|
|
168
|
+
border: none;
|
|
169
|
+
color: var(--FF-DS-color-error-border);
|
|
170
|
+
@include Mixins.outlined-hover(--FF-DS-color-error-base-rgb, 0.2, 0.25);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/*
|
|
175
|
+
Width
|
|
176
|
+
*/
|
|
177
|
+
&_width {
|
|
178
|
+
&_auto {
|
|
179
|
+
max-width: 100%;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
&_full {
|
|
183
|
+
width: 100%;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/*
|
|
188
|
+
Sizes
|
|
189
|
+
*/
|
|
190
|
+
&_size {
|
|
191
|
+
&_xs {
|
|
192
|
+
height: 20px;
|
|
193
|
+
border-radius: var(--FF-DS-border-radius-xs);
|
|
194
|
+
padding: var(--FF-DS-padding-xs);
|
|
195
|
+
}
|
|
196
|
+
&_s {
|
|
197
|
+
height: 24px;
|
|
198
|
+
border-radius: var(--FF-DS-border-radius-s);
|
|
199
|
+
padding: var(--FF-DS-padding-s);
|
|
200
|
+
}
|
|
201
|
+
&_m {
|
|
202
|
+
height: 28px;
|
|
203
|
+
border-radius: var(--FF-DS-border-radius-m);
|
|
204
|
+
padding: var(--FF-DS-padding-m);
|
|
205
|
+
}
|
|
206
|
+
&_l {
|
|
207
|
+
height: 36px;
|
|
208
|
+
border-radius: var(--FF-DS-border-radius-l);
|
|
209
|
+
padding: var(--FF-DS-padding-l);
|
|
210
|
+
}
|
|
211
|
+
&_xl {
|
|
212
|
+
font-size: 16px;
|
|
213
|
+
height: 44px;
|
|
214
|
+
border-radius: var(--FF-DS-border-radius-xl);
|
|
215
|
+
padding: var(--FF-DS-padding-xl);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/*
|
|
220
|
+
Border radius
|
|
221
|
+
*/
|
|
222
|
+
&_borderRadius_circle {
|
|
223
|
+
border-radius: 100%;
|
|
224
|
+
-webkit-border-radius: 100%;
|
|
225
|
+
-moz-border-radius: 100%;
|
|
226
|
+
-ms-border-radius: 100%;
|
|
227
|
+
-o-border-radius: 100%;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
&_borderRadius_round {
|
|
231
|
+
border-radius: 8px;
|
|
232
|
+
-webkit-border-radius: 8px;
|
|
233
|
+
-moz-border-radius: 8px;
|
|
234
|
+
-ms-border-radius: 8px;
|
|
235
|
+
-o-border-radius: 8px;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
&_borderRadius_box {
|
|
239
|
+
border-radius: 0px;
|
|
240
|
+
-webkit-border-radius: 0px;
|
|
241
|
+
-moz-border-radius: 0px;
|
|
242
|
+
-ms-border-radius: 0px;
|
|
243
|
+
-o-border-radius: 0px;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import './Button.scss'
|
|
3
|
+
import { bemBlock } from '../../utils'
|
|
4
|
+
import type { BUTTON_BORDER, BUTTON_SIZES, BUTTON_VARIANTS, BUTTON_WIDTH } from './const'
|
|
5
|
+
|
|
6
|
+
export type ButtonBorder = (typeof BUTTON_BORDER)[number]
|
|
7
|
+
export type ButtonVariants = (typeof BUTTON_VARIANTS)[number]
|
|
8
|
+
export type ButtonWidth = (typeof BUTTON_WIDTH)[number]
|
|
9
|
+
export type ButtonSizes = (typeof BUTTON_SIZES)[number]
|
|
10
|
+
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
11
|
+
size?: ButtonSizes
|
|
12
|
+
variant?: ButtonVariants
|
|
13
|
+
width?: ButtonWidth
|
|
14
|
+
borderRadius?: ButtonBorder
|
|
15
|
+
loading?: boolean
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
19
|
+
({ variant, size, width, children, borderRadius = 'round', loading, ...props }, ref) => {
|
|
20
|
+
const b = bemBlock('button')
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<button
|
|
24
|
+
className={b({ variant, size, width, borderRadius, loading })}
|
|
25
|
+
ref={ref}
|
|
26
|
+
{...props}
|
|
27
|
+
>
|
|
28
|
+
{children}
|
|
29
|
+
</button>
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
Button.displayName = 'Button'
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { Flex } from '../../'
|
|
2
|
+
import { Button } from '../Button'
|
|
3
|
+
import { BUTTON_BORDER, BUTTON_SIZES, BUTTON_VARIANTS, BUTTON_WIDTH } from '../const'
|
|
4
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'Components/Button',
|
|
8
|
+
component: Button,
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
argTypes: {
|
|
11
|
+
variant: {
|
|
12
|
+
description: 'Button style variants',
|
|
13
|
+
control: 'select',
|
|
14
|
+
options: BUTTON_VARIANTS,
|
|
15
|
+
},
|
|
16
|
+
loading: {
|
|
17
|
+
description: 'Is loading styles',
|
|
18
|
+
control: 'radio',
|
|
19
|
+
options: [false, true],
|
|
20
|
+
},
|
|
21
|
+
size: {
|
|
22
|
+
description: 'Button sizes',
|
|
23
|
+
control: 'radio',
|
|
24
|
+
options: BUTTON_SIZES,
|
|
25
|
+
},
|
|
26
|
+
borderRadius: {
|
|
27
|
+
description: 'Button border-radius',
|
|
28
|
+
control: 'radio',
|
|
29
|
+
options: BUTTON_BORDER,
|
|
30
|
+
},
|
|
31
|
+
width: {
|
|
32
|
+
description: 'Button width',
|
|
33
|
+
control: 'radio',
|
|
34
|
+
options: BUTTON_WIDTH,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
} satisfies Meta<typeof Button>
|
|
38
|
+
|
|
39
|
+
export default meta
|
|
40
|
+
|
|
41
|
+
type Story = StoryObj<typeof meta>
|
|
42
|
+
|
|
43
|
+
export const Loading: Story = {
|
|
44
|
+
args: {
|
|
45
|
+
size: 'xl',
|
|
46
|
+
loading: true,
|
|
47
|
+
variant: 'primary',
|
|
48
|
+
children: 'Loading',
|
|
49
|
+
},
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export const BorderRadius: Story = {
|
|
53
|
+
render: (props) => (
|
|
54
|
+
<Flex gap="xl">
|
|
55
|
+
<Button size="xl" borderRadius="circle" variant="primary" {...props}>
|
|
56
|
+
circle
|
|
57
|
+
</Button>
|
|
58
|
+
<Button size="xl" borderRadius="box" variant="primary" {...props}>
|
|
59
|
+
box
|
|
60
|
+
</Button>
|
|
61
|
+
<Button size="xl" borderRadius="round" variant="primary" {...props}>
|
|
62
|
+
round
|
|
63
|
+
</Button>
|
|
64
|
+
</Flex>
|
|
65
|
+
),
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export const Disabled: Story = {
|
|
69
|
+
args: {
|
|
70
|
+
width: 'full',
|
|
71
|
+
size: 'xl',
|
|
72
|
+
disabled: true,
|
|
73
|
+
variant: 'error',
|
|
74
|
+
children: 'disabled',
|
|
75
|
+
},
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export const Width: Story = {
|
|
79
|
+
render: (props) => (
|
|
80
|
+
<Flex direction="col" alignItems="center" justifyContent="center" gap="xl">
|
|
81
|
+
<div style={{ width: 700 }}>
|
|
82
|
+
<Button variant="primary" width="auto" size="xl" {...props}>
|
|
83
|
+
width auto
|
|
84
|
+
</Button>
|
|
85
|
+
</div>
|
|
86
|
+
<div style={{ width: 700 }}>
|
|
87
|
+
<Button variant="primary" width="full" size="xl" {...props}>
|
|
88
|
+
width full
|
|
89
|
+
</Button>
|
|
90
|
+
</div>
|
|
91
|
+
</Flex>
|
|
92
|
+
),
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export const Base: Story = {
|
|
96
|
+
render: (props) => (
|
|
97
|
+
<Flex gap="xl" wrap>
|
|
98
|
+
<Button variant="secondary" size="l" {...props}>
|
|
99
|
+
base-secondary
|
|
100
|
+
</Button>
|
|
101
|
+
<Button variant="primary" size="l" {...props}>
|
|
102
|
+
base-info
|
|
103
|
+
</Button>
|
|
104
|
+
<Button variant="success" size="l" {...props}>
|
|
105
|
+
base-success
|
|
106
|
+
</Button>
|
|
107
|
+
<Button variant="warning" size="l" {...props}>
|
|
108
|
+
base-warning
|
|
109
|
+
</Button>
|
|
110
|
+
<Button variant="error" size="l" {...props}>
|
|
111
|
+
base-danger
|
|
112
|
+
</Button>
|
|
113
|
+
<Button variant="brand" size="l" {...props}>
|
|
114
|
+
base-brand
|
|
115
|
+
</Button>
|
|
116
|
+
</Flex>
|
|
117
|
+
),
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export const Outlined: Story = {
|
|
121
|
+
render: (props) => (
|
|
122
|
+
<Flex gap="xl" wrap>
|
|
123
|
+
<Button variant="outlined-secondary" size="l" {...props}>
|
|
124
|
+
outlined-secondary
|
|
125
|
+
</Button>
|
|
126
|
+
<Button variant="outlined-primary" size="l" {...props}>
|
|
127
|
+
outlined-info
|
|
128
|
+
</Button>
|
|
129
|
+
<Button variant="outlined-success" size="l" {...props}>
|
|
130
|
+
outlined-success
|
|
131
|
+
</Button>
|
|
132
|
+
<Button variant="outlined-warning" size="l" {...props}>
|
|
133
|
+
outlined-warning
|
|
134
|
+
</Button>
|
|
135
|
+
<Button variant="outlined-error" size="l" {...props}>
|
|
136
|
+
outlined-danger
|
|
137
|
+
</Button>
|
|
138
|
+
<Button variant="outlined-brand" size="l" {...props}>
|
|
139
|
+
outlined-brand
|
|
140
|
+
</Button>
|
|
141
|
+
</Flex>
|
|
142
|
+
),
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export const Flat: Story = {
|
|
146
|
+
render: (props) => (
|
|
147
|
+
<Flex gap="xl" wrap>
|
|
148
|
+
<Button variant="flat-secondary" size="l" {...props}>
|
|
149
|
+
flat-secondary
|
|
150
|
+
</Button>
|
|
151
|
+
<Button variant="flat-primary" size="l" {...props}>
|
|
152
|
+
flat-info
|
|
153
|
+
</Button>
|
|
154
|
+
<Button variant="flat-success" size="l" {...props}>
|
|
155
|
+
flat-success
|
|
156
|
+
</Button>
|
|
157
|
+
<Button variant="flat-warning" size="l" {...props}>
|
|
158
|
+
flat-warning
|
|
159
|
+
</Button>
|
|
160
|
+
<Button variant="flat-error" size="l" {...props}>
|
|
161
|
+
flat-danger
|
|
162
|
+
</Button>
|
|
163
|
+
<Button variant="flat-brand" size="l" {...props}>
|
|
164
|
+
flat-brand
|
|
165
|
+
</Button>
|
|
166
|
+
</Flex>
|
|
167
|
+
),
|
|
168
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export const BUTTON_SIZES = ['xs', 's', 'm', 'l', 'xl'] as const
|
|
2
|
+
export const BUTTON_WIDTH = ['auto', 'full'] as const
|
|
3
|
+
export const BUTTON_BORDER = ['circle', 'round', 'box']
|
|
4
|
+
export const BUTTON_VARIANTS = [
|
|
5
|
+
// Background, border, text colored
|
|
6
|
+
'brand',
|
|
7
|
+
'primary',
|
|
8
|
+
'success',
|
|
9
|
+
'warning',
|
|
10
|
+
'secondary',
|
|
11
|
+
'error',
|
|
12
|
+
// No background, no border, text colored
|
|
13
|
+
'flat-brand',
|
|
14
|
+
'flat-primary',
|
|
15
|
+
'flat-success',
|
|
16
|
+
'flat-warning',
|
|
17
|
+
'flat-secondary',
|
|
18
|
+
'flat-error',
|
|
19
|
+
// // No background, bordered, text colored
|
|
20
|
+
'outlined-brand',
|
|
21
|
+
'outlined-primary',
|
|
22
|
+
'outlined-success',
|
|
23
|
+
'outlined-warning',
|
|
24
|
+
'outlined-secondary',
|
|
25
|
+
'outlined-error',
|
|
26
|
+
] as const
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Button'
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
@use '../../styles/styles.scss' as MainStyles;
|
|
2
|
+
|
|
3
|
+
$block: '.#{MainStyles.$ns}card';
|
|
4
|
+
|
|
5
|
+
#{$block} {
|
|
6
|
+
padding: 8px;
|
|
7
|
+
border-radius: 4px;
|
|
8
|
+
-webkit-border-radius: 4px;
|
|
9
|
+
-moz-border-radius: 4px;
|
|
10
|
+
-ms-border-radius: 4px;
|
|
11
|
+
-o-border-radius: 4px;
|
|
12
|
+
border: 1px solid lightgrey;
|
|
13
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import './Card.scss'
|
|
3
|
+
import { bemBlock } from '../../utils'
|
|
4
|
+
|
|
5
|
+
interface CardProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
6
|
+
children?: React.ReactNode
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const Card: React.FC<CardProps> = ({ children }) => {
|
|
10
|
+
const b = bemBlock('card')
|
|
11
|
+
return <div className={b()}>{children}</div>
|
|
12
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import { Card } from '../Card'
|
|
3
|
+
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'Components/Card',
|
|
6
|
+
component: Card,
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
} satisfies Meta<typeof Card>
|
|
9
|
+
|
|
10
|
+
export default meta
|
|
11
|
+
|
|
12
|
+
type Story = StoryObj<typeof meta>
|
|
13
|
+
|
|
14
|
+
export const Card_default: Story = {
|
|
15
|
+
args: {
|
|
16
|
+
children: 'content',
|
|
17
|
+
},
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Card'
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
@use '../../styles/styles.scss' as MainStyles;
|
|
2
|
+
|
|
3
|
+
$block: '.#{MainStyles.$ns}checkbox';
|
|
4
|
+
|
|
5
|
+
#{$block} {
|
|
6
|
+
border-radius: 8px;
|
|
7
|
+
-webkit-border-radius: 8px;
|
|
8
|
+
-moz-border-radius: 8px;
|
|
9
|
+
-ms-border-radius: 8px;
|
|
10
|
+
-o-border-radius: 8px;
|
|
11
|
+
|
|
12
|
+
&_size {
|
|
13
|
+
&_s {
|
|
14
|
+
width: 14px;
|
|
15
|
+
height: 14px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
&_m {
|
|
19
|
+
width: 18px;
|
|
20
|
+
height: 18px;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&_l {
|
|
24
|
+
width: 20px;
|
|
25
|
+
height: 20px;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import './Checkbox.scss'
|
|
3
|
+
import { Text } from '../Text'
|
|
4
|
+
import { Flex } from '../Flex'
|
|
5
|
+
import { bemBlock } from '../../utils'
|
|
6
|
+
|
|
7
|
+
interface CheckboxProps {
|
|
8
|
+
size?: 's' | 'm' | 'l'
|
|
9
|
+
text?: string
|
|
10
|
+
checked?: boolean
|
|
11
|
+
disabled?: boolean
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const Checkbox: React.FC<CheckboxProps> = ({ size = 's', text, checked, disabled }) => {
|
|
15
|
+
const b = bemBlock('checkbox')
|
|
16
|
+
return (
|
|
17
|
+
<Flex gap="xs" alignItems="center">
|
|
18
|
+
<input className={b({ size })} type="checkbox" checked={checked} disabled={disabled} />
|
|
19
|
+
{/* //TODO: change to label with htmlFor */}
|
|
20
|
+
<Text>{text}</Text>
|
|
21
|
+
</Flex>
|
|
22
|
+
)
|
|
23
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import { Checkbox } from '../Checkbox'
|
|
3
|
+
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'Components/Checkbox',
|
|
6
|
+
component: Checkbox,
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
} satisfies Meta<typeof Checkbox>
|
|
9
|
+
|
|
10
|
+
export default meta
|
|
11
|
+
|
|
12
|
+
type Story = StoryObj<typeof meta>
|
|
13
|
+
|
|
14
|
+
export const Checkbox_default: Story = {
|
|
15
|
+
args: {
|
|
16
|
+
size: 's',
|
|
17
|
+
text: 'ready?',
|
|
18
|
+
checked: true,
|
|
19
|
+
disabled: false,
|
|
20
|
+
},
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Checkbox'
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
@use '../../styles/styles.scss' as MainStyles;
|
|
2
|
+
@use '../../styles/variables/spacing.scss' as Spacing;
|
|
3
|
+
@use '../../styles/variables/colors.scss' as Colors;
|
|
4
|
+
|
|
5
|
+
$block: '.#{MainStyles.$ns}divider';
|
|
6
|
+
|
|
7
|
+
#{$block} {
|
|
8
|
+
@include Spacing.variables;
|
|
9
|
+
@include Colors.variables;
|
|
10
|
+
|
|
11
|
+
position: relative;
|
|
12
|
+
display: flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
|
|
15
|
+
&_orientation {
|
|
16
|
+
&_horizontal {
|
|
17
|
+
flex-direction: row;
|
|
18
|
+
margin-top: var(--FF-DS-spacing-s);
|
|
19
|
+
margin-bottom: var(--FF-DS-spacing-s);
|
|
20
|
+
|
|
21
|
+
&::before,
|
|
22
|
+
&::after {
|
|
23
|
+
content: '';
|
|
24
|
+
flex: 1;
|
|
25
|
+
height: 1px;
|
|
26
|
+
background: var(--FF-DS-color-secondary-border);
|
|
27
|
+
}
|
|
28
|
+
& > span {
|
|
29
|
+
white-space: nowrap;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&_vertical {
|
|
34
|
+
flex-direction: column;
|
|
35
|
+
margin-left: var(--FF-DS-spacing-s);
|
|
36
|
+
margin-right: var(--FF-DS-spacing-s);
|
|
37
|
+
background: var(--FF-DS-color-secondary-border);
|
|
38
|
+
width: 1px;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&_position {
|
|
43
|
+
&_left {
|
|
44
|
+
&::before {
|
|
45
|
+
flex: 0;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&_center {
|
|
50
|
+
&::before,
|
|
51
|
+
&::after {
|
|
52
|
+
flex: 1;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
&_right {
|
|
57
|
+
&::after {
|
|
58
|
+
flex: 0;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import './Divider.scss'
|
|
3
|
+
import { bemBlock } from '../../utils'
|
|
4
|
+
import { Text } from '../Text'
|
|
5
|
+
|
|
6
|
+
interface DividerProps {
|
|
7
|
+
orientation: 'vertical' | 'horizontal'
|
|
8
|
+
position?: 'left' | 'center' | 'right'
|
|
9
|
+
children?: React.ReactNode
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const Divider: React.FC<DividerProps> = ({ orientation, position, children }) => {
|
|
13
|
+
const b = bemBlock('divider')
|
|
14
|
+
return (
|
|
15
|
+
<div className={b({ orientation, position })}>
|
|
16
|
+
<Text style={{ padding: children ? '0 10px' : '' }} variant="caption2">
|
|
17
|
+
{orientation === 'horizontal' && children}
|
|
18
|
+
</Text>
|
|
19
|
+
</div>
|
|
20
|
+
)
|
|
21
|
+
}
|