ff-ds-ui 0.0.2 → 0.0.3
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 +1 -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 +39 -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 +31 -28
- package/tsconfig.build.json +20 -0
- package/tsconfig.json +4 -7
- package/tsconfig.node.json +26 -26
- package/vite.config.ts +83 -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,68 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import { Divider } from '../Divider'
|
|
3
|
+
import { Flex } from '@/components/Flex'
|
|
4
|
+
import { Avatar } from '@/components/Avatar'
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'Components/Divider',
|
|
8
|
+
component: Divider,
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
argTypes: {
|
|
11
|
+
orientation: {
|
|
12
|
+
description: 'Ориентация',
|
|
13
|
+
control: 'radio',
|
|
14
|
+
options: ['horizontal', 'vertical'],
|
|
15
|
+
},
|
|
16
|
+
position: {
|
|
17
|
+
description: 'Позиция линии, работает только с horizontal',
|
|
18
|
+
control: 'radio',
|
|
19
|
+
options: ['left', 'center', 'right'],
|
|
20
|
+
},
|
|
21
|
+
children: {
|
|
22
|
+
description: 'Текст, компонента',
|
|
23
|
+
control: 'text',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
} satisfies Meta<typeof Divider>
|
|
27
|
+
|
|
28
|
+
export default meta
|
|
29
|
+
|
|
30
|
+
type Story = StoryObj<typeof meta>
|
|
31
|
+
|
|
32
|
+
export const Divider_horizontal: Story = {
|
|
33
|
+
render: (props) => (
|
|
34
|
+
<Flex direction="col">
|
|
35
|
+
<Avatar text="AD" />
|
|
36
|
+
<Divider {...props} />
|
|
37
|
+
<Avatar text="AD" />
|
|
38
|
+
<Divider {...props} />
|
|
39
|
+
<Avatar text="AD" />
|
|
40
|
+
<Divider {...props} />
|
|
41
|
+
<Avatar text="AD" />
|
|
42
|
+
<Divider {...props} />
|
|
43
|
+
<Avatar text="AD" />
|
|
44
|
+
</Flex>
|
|
45
|
+
),
|
|
46
|
+
args: {
|
|
47
|
+
orientation: 'horizontal',
|
|
48
|
+
},
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export const Divider_vertical: Story = {
|
|
52
|
+
render: (props) => (
|
|
53
|
+
<Flex direction="row">
|
|
54
|
+
<Avatar text="AD" />
|
|
55
|
+
<Divider {...props} />
|
|
56
|
+
<Avatar text="AD" />
|
|
57
|
+
<Divider {...props} />
|
|
58
|
+
<Avatar text="AD" />
|
|
59
|
+
<Divider {...props} />
|
|
60
|
+
<Avatar text="AD" />
|
|
61
|
+
<Divider {...props} />
|
|
62
|
+
<Avatar text="AD" />
|
|
63
|
+
</Flex>
|
|
64
|
+
),
|
|
65
|
+
args: {
|
|
66
|
+
orientation: 'vertical',
|
|
67
|
+
},
|
|
68
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Divider'
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
@use '../../styles/styles.scss' as MainStyles;
|
|
2
|
+
@use '../../styles/variables/index' as Variables;
|
|
3
|
+
|
|
4
|
+
$block: '.#{MainStyles.$ns}flex';
|
|
5
|
+
|
|
6
|
+
#{$block} {
|
|
7
|
+
@include Variables.variables-spacing;
|
|
8
|
+
|
|
9
|
+
display: flex;
|
|
10
|
+
|
|
11
|
+
//TODO: перенести в миксины???
|
|
12
|
+
&_gap {
|
|
13
|
+
&_xs {
|
|
14
|
+
gap: var(--FF-DS-spacing-xs);
|
|
15
|
+
}
|
|
16
|
+
&_xm {
|
|
17
|
+
gap: var(--FF-DS-spacing-xm);
|
|
18
|
+
}
|
|
19
|
+
&_s {
|
|
20
|
+
gap: var(--FF-DS-spacing-s);
|
|
21
|
+
}
|
|
22
|
+
&_m {
|
|
23
|
+
gap: var(--FF-DS-spacing-m);
|
|
24
|
+
}
|
|
25
|
+
&_l {
|
|
26
|
+
gap: var(--FF-DS-spacing-l);
|
|
27
|
+
}
|
|
28
|
+
&_xl {
|
|
29
|
+
gap: var(--FF-DS-spacing-xl);
|
|
30
|
+
}
|
|
31
|
+
&_2xl {
|
|
32
|
+
gap: var(--FF-DS-spacing-2xl);
|
|
33
|
+
}
|
|
34
|
+
&_3xl {
|
|
35
|
+
gap: var(--FF-DS-spacing-3xl);
|
|
36
|
+
}
|
|
37
|
+
&_4xl {
|
|
38
|
+
gap: var(--FF-DS-spacing-4xl);
|
|
39
|
+
}
|
|
40
|
+
&_5xl {
|
|
41
|
+
gap: var(--FF-DS-spacing-5xl);
|
|
42
|
+
}
|
|
43
|
+
&_6xl {
|
|
44
|
+
gap: var(--FF-DS-spacing-6xl);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
&_direction {
|
|
49
|
+
&_row {
|
|
50
|
+
flex-direction: row;
|
|
51
|
+
}
|
|
52
|
+
&_col {
|
|
53
|
+
flex-direction: column;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
&_wrap {
|
|
58
|
+
flex-wrap: wrap;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
&_width {
|
|
62
|
+
&_auto {
|
|
63
|
+
max-width: 100%;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
&_full {
|
|
67
|
+
width: 100%;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
&_justifyContent {
|
|
72
|
+
&_start {
|
|
73
|
+
justify-content: start;
|
|
74
|
+
}
|
|
75
|
+
&_center {
|
|
76
|
+
justify-content: center;
|
|
77
|
+
}
|
|
78
|
+
&_end {
|
|
79
|
+
justify-content: end;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
&_alignItems {
|
|
84
|
+
&_start {
|
|
85
|
+
align-items: start;
|
|
86
|
+
}
|
|
87
|
+
&_center {
|
|
88
|
+
align-items: center;
|
|
89
|
+
}
|
|
90
|
+
&_end {
|
|
91
|
+
align-items: end;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import './Flex.scss'
|
|
3
|
+
import { bemBlock } from '@/utils'
|
|
4
|
+
|
|
5
|
+
interface FlexProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
6
|
+
children: React.ReactNode
|
|
7
|
+
direction?: 'row' | 'col'
|
|
8
|
+
justifyContent?: 'start' | 'center' | 'end'
|
|
9
|
+
alignItems?: 'start' | 'center' | 'end'
|
|
10
|
+
//TODO: перенести в константы для всех файлов (SPACING)
|
|
11
|
+
gap?: 'xs' | 'xm' | 's' | 'm' | 'l' | 'xl' | '2xl' | '3xl' | '4xl' | '5xl' | '6xl'
|
|
12
|
+
wrap?: boolean
|
|
13
|
+
width?: 'auto' | 'full'
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const Flex: React.FC<FlexProps> = ({
|
|
17
|
+
children,
|
|
18
|
+
justifyContent = 'start',
|
|
19
|
+
alignItems,
|
|
20
|
+
gap,
|
|
21
|
+
wrap,
|
|
22
|
+
direction = 'row',
|
|
23
|
+
width = 'auto',
|
|
24
|
+
}) => {
|
|
25
|
+
const b = bemBlock('flex')
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<div
|
|
29
|
+
className={b({
|
|
30
|
+
justifyContent,
|
|
31
|
+
alignItems,
|
|
32
|
+
gap,
|
|
33
|
+
wrap,
|
|
34
|
+
direction,
|
|
35
|
+
width,
|
|
36
|
+
})}
|
|
37
|
+
>
|
|
38
|
+
{children}
|
|
39
|
+
</div>
|
|
40
|
+
)
|
|
41
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import { Flex } from '../Flex'
|
|
3
|
+
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'Components/Flex',
|
|
6
|
+
component: Flex,
|
|
7
|
+
render: (props) => {
|
|
8
|
+
return (
|
|
9
|
+
<Flex {...props}>
|
|
10
|
+
<div>1</div>
|
|
11
|
+
<div>2</div>
|
|
12
|
+
</Flex>
|
|
13
|
+
)
|
|
14
|
+
},
|
|
15
|
+
tags: ['autodocs'],
|
|
16
|
+
} satisfies Meta<typeof Flex>
|
|
17
|
+
|
|
18
|
+
export default meta
|
|
19
|
+
|
|
20
|
+
type Story = StoryObj<typeof meta>
|
|
21
|
+
|
|
22
|
+
export const FlexTest: Story = {
|
|
23
|
+
args: {
|
|
24
|
+
children: <div>1 elem</div>,
|
|
25
|
+
direction: 'row',
|
|
26
|
+
},
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Flex'
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
@use '../../styles/styles.scss' as MainStyles;
|
|
2
|
+
@use '../../styles/variables' as Variables;
|
|
3
|
+
|
|
4
|
+
$block: '.#{MainStyles.$ns}label';
|
|
5
|
+
|
|
6
|
+
#{$block} {
|
|
7
|
+
@include Variables.variables-colors;
|
|
8
|
+
@include Variables.variables-padding;
|
|
9
|
+
@include Variables.variables-colors;
|
|
10
|
+
|
|
11
|
+
border-radius: 4px;
|
|
12
|
+
-webkit-border-radius: 4px;
|
|
13
|
+
-moz-border-radius: 4px;
|
|
14
|
+
-ms-border-radius: 4px;
|
|
15
|
+
-o-border-radius: 4px;
|
|
16
|
+
box-sizing: border-box;
|
|
17
|
+
background: var(--FF-DS-color-secondary-base);
|
|
18
|
+
color: var(--FF-DS-color-secondary-text);
|
|
19
|
+
width: fit-content;
|
|
20
|
+
|
|
21
|
+
&_variant {
|
|
22
|
+
&_brand {
|
|
23
|
+
background: var(--FF-DS-color-brand-base);
|
|
24
|
+
}
|
|
25
|
+
&_primary {
|
|
26
|
+
background: var(--FF-DS-color-primary-base);
|
|
27
|
+
}
|
|
28
|
+
&_success {
|
|
29
|
+
background: var(--FF-DS-color-success-base);
|
|
30
|
+
}
|
|
31
|
+
&_warning {
|
|
32
|
+
background: var(--FF-DS-color-warning-base);
|
|
33
|
+
}
|
|
34
|
+
&_secondary {
|
|
35
|
+
background: var(--FF-DS-color-secondary-base);
|
|
36
|
+
}
|
|
37
|
+
&_error {
|
|
38
|
+
background: var(--FF-DS-color-error-base);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&_size {
|
|
43
|
+
&_s {
|
|
44
|
+
padding: calc(var(--FF-DS-padding-s) * 0.25) var(--FF-DS-padding-s);
|
|
45
|
+
}
|
|
46
|
+
&_m {
|
|
47
|
+
padding: calc(var(--FF-DS-padding-s) * 0.5) var(--FF-DS-padding-m);
|
|
48
|
+
}
|
|
49
|
+
&_l {
|
|
50
|
+
padding: calc(var(--FF-DS-padding-m) * 0.5) var(--FF-DS-padding-l);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import './Label.scss'
|
|
3
|
+
import { bemBlock } from '@/utils'
|
|
4
|
+
import { Text } from '../Text'
|
|
5
|
+
import { Flex } from '../Flex'
|
|
6
|
+
|
|
7
|
+
interface LabelProps {
|
|
8
|
+
size?: 's' | 'm' | 'l'
|
|
9
|
+
variant?: 'brand' | 'primary' | 'success' | 'warning' | 'secondary' | 'error'
|
|
10
|
+
title?: string
|
|
11
|
+
value?: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const Label: React.FC<LabelProps> = ({ size = 's', title, value, variant }) => {
|
|
15
|
+
const b = bemBlock('label')
|
|
16
|
+
|
|
17
|
+
if (!title) return null
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<div className={b({ size, variant })}>
|
|
21
|
+
<Flex direction="row" alignItems="center" justifyContent="center">
|
|
22
|
+
{title && <Text variant="caption2">{title}</Text>}
|
|
23
|
+
{title && value && <Text variant="caption2">: {value}</Text>}
|
|
24
|
+
</Flex>
|
|
25
|
+
</div>
|
|
26
|
+
)
|
|
27
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import { Label } from '../Label'
|
|
3
|
+
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'Components/Label',
|
|
6
|
+
component: Label,
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
argTypes: {
|
|
9
|
+
variant: {
|
|
10
|
+
control: 'radio',
|
|
11
|
+
options: ['brand', 'primary', 'success', 'warning', 'secondary', 'error'],
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
} satisfies Meta<typeof Label>
|
|
15
|
+
|
|
16
|
+
export default meta
|
|
17
|
+
|
|
18
|
+
type Story = StoryObj<typeof meta>
|
|
19
|
+
|
|
20
|
+
export const Label_default: Story = {
|
|
21
|
+
args: {
|
|
22
|
+
size: 's',
|
|
23
|
+
title: 'keya',
|
|
24
|
+
value: 'value',
|
|
25
|
+
},
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Label'
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import './Link.scss'
|
|
3
|
+
import { bemBlock } from '@/utils'
|
|
4
|
+
|
|
5
|
+
interface LinkProps {
|
|
6
|
+
underline?: boolean
|
|
7
|
+
href: string
|
|
8
|
+
title: string
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const Link: React.FC<LinkProps> = ({ href, underline, title }) => {
|
|
12
|
+
const b = bemBlock('link')
|
|
13
|
+
return (
|
|
14
|
+
<a className={b({ underline })} href={href}>
|
|
15
|
+
{title}
|
|
16
|
+
</a>
|
|
17
|
+
)
|
|
18
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import { Link } from '../Link'
|
|
3
|
+
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'Components/Link',
|
|
6
|
+
component: Link,
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
} satisfies Meta<typeof Link>
|
|
9
|
+
|
|
10
|
+
export default meta
|
|
11
|
+
|
|
12
|
+
type Story = StoryObj<typeof meta>
|
|
13
|
+
|
|
14
|
+
export const Link_default: Story = {
|
|
15
|
+
args: {
|
|
16
|
+
href: '/',
|
|
17
|
+
title: 'url to any page',
|
|
18
|
+
underline: true,
|
|
19
|
+
},
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Link'
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
@use '../../styles/styles.scss' as MainStyles;
|
|
2
|
+
|
|
3
|
+
$block: '.#{MainStyles.$ns}loader';
|
|
4
|
+
$blockPath: '.#{MainStyles.$ns}path';
|
|
5
|
+
|
|
6
|
+
$offset: 186;
|
|
7
|
+
$duration: 2s;
|
|
8
|
+
|
|
9
|
+
#{$block} {
|
|
10
|
+
animation: rotator $duration linear infinite;
|
|
11
|
+
-webkit-animation: rotator $duration linear infinite;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
#{$blockPath} {
|
|
15
|
+
stroke: grey;
|
|
16
|
+
stroke-dasharray: $offset;
|
|
17
|
+
stroke-dashoffset: 0;
|
|
18
|
+
transform-origin: center;
|
|
19
|
+
animation: dash $duration ease infinite;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@keyframes rotator {
|
|
23
|
+
0% {
|
|
24
|
+
transform: rotate(0deg);
|
|
25
|
+
}
|
|
26
|
+
100% {
|
|
27
|
+
transform: rotate(270deg);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@keyframes dash {
|
|
32
|
+
0% {
|
|
33
|
+
stroke-dashoffset: $offset;
|
|
34
|
+
transform: rotate(0deg);
|
|
35
|
+
-webkit-transform: rotate(0deg);
|
|
36
|
+
-moz-transform: rotate(0deg);
|
|
37
|
+
-ms-transform: rotate(0deg);
|
|
38
|
+
-o-transform: rotate(0deg);
|
|
39
|
+
}
|
|
40
|
+
50% {
|
|
41
|
+
stroke-dashoffset: $offset/2;
|
|
42
|
+
transform: rotate(135deg);
|
|
43
|
+
-webkit-transform: rotate(135deg);
|
|
44
|
+
-moz-transform: rotate(135deg);
|
|
45
|
+
-ms-transform: rotate(135deg);
|
|
46
|
+
-o-transform: rotate(135deg);
|
|
47
|
+
}
|
|
48
|
+
100% {
|
|
49
|
+
stroke-dashoffset: $offset;
|
|
50
|
+
transform: rotate(360deg);
|
|
51
|
+
-webkit-transform: rotate(360deg);
|
|
52
|
+
-moz-transform: rotate(360deg);
|
|
53
|
+
-ms-transform: rotate(360deg);
|
|
54
|
+
-o-transform: rotate(360deg);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import './Loader.scss'
|
|
3
|
+
import { bemBlock } from '@/utils'
|
|
4
|
+
import { loaderSizes } from './const'
|
|
5
|
+
|
|
6
|
+
interface LoaderProps {
|
|
7
|
+
size: 'xs' | 's' | 'm' | 'l' | 'xl'
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const Loader: React.FC<LoaderProps> = ({ size }) => {
|
|
11
|
+
const bLoader = bemBlock('loader')
|
|
12
|
+
const bPath = bemBlock('path')
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<svg
|
|
16
|
+
className={bLoader()}
|
|
17
|
+
width={loaderSizes[size]}
|
|
18
|
+
height={loaderSizes[size]}
|
|
19
|
+
viewBox="0 0 66 66"
|
|
20
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
21
|
+
>
|
|
22
|
+
<circle
|
|
23
|
+
className={bPath()}
|
|
24
|
+
fill="none"
|
|
25
|
+
stroke-width="6"
|
|
26
|
+
stroke-linecap="round"
|
|
27
|
+
cx="33"
|
|
28
|
+
cy="33"
|
|
29
|
+
r="30"
|
|
30
|
+
/>
|
|
31
|
+
</svg>
|
|
32
|
+
)
|
|
33
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import { Loader } from '../Loader'
|
|
3
|
+
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'Components/Loader',
|
|
6
|
+
component: Loader,
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
} satisfies Meta<typeof Loader>
|
|
9
|
+
|
|
10
|
+
export default meta
|
|
11
|
+
|
|
12
|
+
type Story = StoryObj<typeof meta>
|
|
13
|
+
|
|
14
|
+
export const Loader_default: Story = {
|
|
15
|
+
args: {
|
|
16
|
+
size: 's',
|
|
17
|
+
},
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Loader'
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
@use '../../styles/styles.scss' as MainStyles;
|
|
2
|
+
|
|
3
|
+
$block: '.#{MainStyles.$ns}radio';
|
|
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,24 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import './Radio.scss'
|
|
3
|
+
import { bemBlock } from '@/utils'
|
|
4
|
+
import { Text } from '../Text'
|
|
5
|
+
import { Flex } from '../Flex'
|
|
6
|
+
|
|
7
|
+
interface RadioProps {
|
|
8
|
+
size?: 's' | 'm' | 'l'
|
|
9
|
+
text?: string
|
|
10
|
+
checked?: boolean
|
|
11
|
+
disabled?: boolean
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const Radio: React.FC<RadioProps> = ({ size = 's', text, checked, disabled }) => {
|
|
15
|
+
const b = bemBlock('radio')
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<Flex alignItems="center" gap="xs">
|
|
19
|
+
<input disabled={disabled} checked={checked} type={'radio'} className={b({ size })} />
|
|
20
|
+
{/* // TODO: change to label with htmlFor */}
|
|
21
|
+
<Text>{text}</Text>
|
|
22
|
+
</Flex>
|
|
23
|
+
)
|
|
24
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import { Radio } from '../Radio'
|
|
3
|
+
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'Components/Radio',
|
|
6
|
+
component: Radio,
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
} satisfies Meta<typeof Radio>
|
|
9
|
+
|
|
10
|
+
export default meta
|
|
11
|
+
|
|
12
|
+
type Story = StoryObj<typeof meta>
|
|
13
|
+
|
|
14
|
+
export const Radio_default: Story = {
|
|
15
|
+
args: {
|
|
16
|
+
size: 's',
|
|
17
|
+
text: 'ready?',
|
|
18
|
+
checked: true,
|
|
19
|
+
disabled: false,
|
|
20
|
+
},
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Radio'
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
@use '../../styles/styles.scss' as MainStyles;
|
|
2
|
+
|
|
3
|
+
$block: '.#{MainStyles.$ns}skeleton';
|
|
4
|
+
|
|
5
|
+
#{$block} {
|
|
6
|
+
width: 10px;
|
|
7
|
+
height: 10px;
|
|
8
|
+
|
|
9
|
+
padding: 0;
|
|
10
|
+
margin: 0;
|
|
11
|
+
|
|
12
|
+
animation-duration: 1s;
|
|
13
|
+
animation-fill-mode: forwards;
|
|
14
|
+
animation-iteration-count: infinite;
|
|
15
|
+
animation-name: placeHolderShimmer;
|
|
16
|
+
animation-timing-function: linear;
|
|
17
|
+
|
|
18
|
+
background: #f6f7f8;
|
|
19
|
+
background-image: -webkit-gradient(
|
|
20
|
+
linear,
|
|
21
|
+
left center,
|
|
22
|
+
right center,
|
|
23
|
+
from(#f6f7f8),
|
|
24
|
+
color-stop(0.2, #edeef1),
|
|
25
|
+
color-stop(0.4, #f6f7f8),
|
|
26
|
+
to(#f6f7f8)
|
|
27
|
+
);
|
|
28
|
+
background-image: -webkit-linear-gradient(
|
|
29
|
+
left,
|
|
30
|
+
#f6f7f8 0%,
|
|
31
|
+
#edeef1 20%,
|
|
32
|
+
#f6f7f8 40%,
|
|
33
|
+
#f6f7f8 100%
|
|
34
|
+
);
|
|
35
|
+
background-size: 980px;
|
|
36
|
+
position: relative;
|
|
37
|
+
|
|
38
|
+
border-radius: 8px;
|
|
39
|
+
-webkit-border-radius: 8px;
|
|
40
|
+
-moz-border-radius: 8px;
|
|
41
|
+
-ms-border-radius: 8px;
|
|
42
|
+
-o-border-radius: 8px;
|
|
43
|
+
|
|
44
|
+
&_fullWidth {
|
|
45
|
+
width: 100% !important;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
&_view {
|
|
49
|
+
&_circle {
|
|
50
|
+
border-radius: 100%;
|
|
51
|
+
-webkit-border-radius: 100%;
|
|
52
|
+
-moz-border-radius: 100%;
|
|
53
|
+
-ms-border-radius: 100%;
|
|
54
|
+
-o-border-radius: 100%;
|
|
55
|
+
}
|
|
56
|
+
&_square {
|
|
57
|
+
border-radius: 4px;
|
|
58
|
+
-webkit-border-radius: 4px;
|
|
59
|
+
-moz-border-radius: 4px;
|
|
60
|
+
-ms-border-radius: 4px;
|
|
61
|
+
-o-border-radius: 4px;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
@keyframes placeHolderShimmer {
|
|
67
|
+
0% {
|
|
68
|
+
background-position: -490px 0;
|
|
69
|
+
}
|
|
70
|
+
100% {
|
|
71
|
+
background-position: 490px 0;
|
|
72
|
+
}
|
|
73
|
+
}
|