@alfalab/core-components-pure-cell 4.3.2 → 4.4.1
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/component-5a229016.d.ts +4 -4
- package/{component-81a3aa3a.js → component-b96676c0.js} +9 -9
- package/component.js +2 -2
- package/components/addon/component.js +3 -3
- package/components/addon/index.css +10 -10
- package/components/addon/index.js +1 -1
- package/components/amount/component.js +4 -4
- package/components/amount/index.css +2 -2
- package/components/amount/index.js +1 -1
- package/components/amount-title/component.js +4 -4
- package/components/amount-title/index.css +3 -3
- package/components/amount-title/index.js +1 -1
- package/components/category/component.js +5 -5
- package/components/category/index.css +5 -5
- package/components/category/index.js +1 -1
- package/components/content/component.js +2 -2
- package/components/content/index.css +3 -3
- package/components/content/index.d.ts +1 -1
- package/components/content/index.js +2 -2
- package/components/footer/component.js +3 -3
- package/components/footer/index.css +4 -4
- package/components/footer/index.js +1 -1
- package/components/footer-button/component.js +3 -3
- package/components/footer-button/index.css +2 -2
- package/components/footer-button/index.js +1 -1
- package/components/footer-text/component.js +2 -2
- package/components/footer-text/index.js +1 -1
- package/components/graphics/component.js +3 -3
- package/components/graphics/index.css +5 -5
- package/components/graphics/index.js +1 -1
- package/components/main/component.js +2 -2
- package/components/main/index.css +4 -4
- package/components/main/index.d.ts +1 -1
- package/components/main/index.js +2 -2
- package/components/text/component.js +2 -2
- package/components/text/index.css +7 -7
- package/components/text/index.d.ts +1 -1
- package/components/text/index.js +2 -2
- package/cssm/component-5a229016.d.ts +4 -4
- package/cssm/{component-f0bb4ddf.js → component-ef4953bf.js} +5 -5
- package/cssm/component.js +2 -2
- package/cssm/components/addon/component.js +2 -2
- package/cssm/components/addon/index.js +1 -1
- package/cssm/components/amount/component.js +3 -3
- package/cssm/components/amount/index.js +1 -1
- package/cssm/components/amount-title/component.js +3 -3
- package/cssm/components/amount-title/index.js +1 -1
- package/cssm/components/category/component.js +4 -4
- package/cssm/components/category/index.js +1 -1
- package/cssm/components/content/component.js +2 -2
- package/cssm/components/content/index.d.ts +1 -1
- package/cssm/components/content/index.js +2 -2
- package/cssm/components/footer/component.js +2 -2
- package/cssm/components/footer/index.js +1 -1
- package/cssm/components/footer-button/component.js +2 -2
- package/cssm/components/footer-button/index.js +1 -1
- package/cssm/components/footer-text/component.js +2 -2
- package/cssm/components/footer-text/index.js +1 -1
- package/cssm/components/graphics/component.js +2 -2
- package/cssm/components/graphics/index.js +1 -1
- package/cssm/components/main/component.js +2 -2
- package/cssm/components/main/index.d.ts +1 -1
- package/cssm/components/main/index.js +2 -2
- package/cssm/components/text/component.js +2 -2
- package/cssm/components/text/index.d.ts +1 -1
- package/cssm/components/text/index.js +2 -2
- package/cssm/index.js +2 -2
- package/esm/{component-d81bf7aa.js → component-4f6ca416.js} +5 -5
- package/esm/component-5a229016.d.ts +4 -4
- package/esm/component.js +2 -2
- package/esm/components/addon/component.js +2 -2
- package/esm/components/addon/index.css +10 -10
- package/esm/components/addon/index.js +1 -1
- package/esm/components/amount/component.js +2 -2
- package/esm/components/amount/index.css +2 -2
- package/esm/components/amount/index.js +1 -1
- package/esm/components/amount-title/component.js +2 -2
- package/esm/components/amount-title/index.css +3 -3
- package/esm/components/amount-title/index.js +1 -1
- package/esm/components/category/component.js +2 -2
- package/esm/components/category/index.css +5 -5
- package/esm/components/category/index.js +1 -1
- package/esm/components/content/component.js +2 -2
- package/esm/components/content/index.css +3 -3
- package/esm/components/content/index.d.ts +1 -1
- package/esm/components/content/index.js +2 -2
- package/esm/components/footer/component.js +2 -2
- package/esm/components/footer/index.css +4 -4
- package/esm/components/footer/index.js +1 -1
- package/esm/components/footer-button/component.js +2 -2
- package/esm/components/footer-button/index.css +2 -2
- package/esm/components/footer-button/index.js +1 -1
- package/esm/components/footer-text/component.js +1 -1
- package/esm/components/footer-text/index.js +1 -1
- package/esm/components/graphics/component.js +2 -2
- package/esm/components/graphics/index.css +5 -5
- package/esm/components/graphics/index.js +1 -1
- package/esm/components/main/component.js +2 -2
- package/esm/components/main/index.css +4 -4
- package/esm/components/main/index.d.ts +1 -1
- package/esm/components/main/index.js +2 -2
- package/esm/components/text/component.js +2 -2
- package/esm/components/text/index.css +7 -7
- package/esm/components/text/index.d.ts +1 -1
- package/esm/components/text/index.js +2 -2
- package/esm/index.css +21 -21
- package/esm/index.js +2 -2
- package/index.css +21 -21
- package/index.js +2 -2
- package/modern/{component-4a267d86.js → component-4312f00c.js} +5 -5
- package/modern/component-5a229016.d.ts +4 -4
- package/modern/component.js +2 -2
- package/modern/components/addon/component.js +2 -2
- package/modern/components/addon/index.css +10 -10
- package/modern/components/addon/index.js +1 -1
- package/modern/components/amount/component.js +2 -2
- package/modern/components/amount/index.css +2 -2
- package/modern/components/amount/index.js +1 -1
- package/modern/components/amount-title/component.js +2 -2
- package/modern/components/amount-title/index.css +3 -3
- package/modern/components/amount-title/index.js +1 -1
- package/modern/components/category/component.js +2 -2
- package/modern/components/category/index.css +5 -5
- package/modern/components/category/index.js +1 -1
- package/modern/components/content/component.js +2 -2
- package/modern/components/content/index.css +3 -3
- package/modern/components/content/index.d.ts +1 -1
- package/modern/components/content/index.js +2 -2
- package/modern/components/footer/component.js +2 -2
- package/modern/components/footer/index.css +4 -4
- package/modern/components/footer/index.js +1 -1
- package/modern/components/footer-button/component.js +2 -2
- package/modern/components/footer-button/index.css +2 -2
- package/modern/components/footer-button/index.js +1 -1
- package/modern/components/footer-text/component.js +1 -1
- package/modern/components/footer-text/index.js +1 -1
- package/modern/components/graphics/component.js +2 -2
- package/modern/components/graphics/index.css +5 -5
- package/modern/components/graphics/index.js +1 -1
- package/modern/components/main/component.js +2 -2
- package/modern/components/main/index.css +4 -4
- package/modern/components/main/index.d.ts +1 -1
- package/modern/components/main/index.js +2 -2
- package/modern/components/text/component.js +2 -2
- package/modern/components/text/index.css +7 -7
- package/modern/components/text/index.d.ts +1 -1
- package/modern/components/text/index.js +2 -2
- package/modern/index.css +21 -21
- package/modern/index.js +2 -2
- package/package.json +7 -5
- package/src/component.tsx +186 -0
- package/src/components/addon/component.tsx +44 -0
- package/src/components/addon/index.module.css +39 -0
- package/src/components/addon/index.ts +1 -0
- package/src/components/amount/component.tsx +56 -0
- package/src/components/amount/index.module.css +6 -0
- package/src/components/amount/index.ts +1 -0
- package/src/components/amount-title/component.tsx +42 -0
- package/src/components/amount-title/index.module.css +9 -0
- package/src/components/amount-title/index.ts +1 -0
- package/src/components/category/component.tsx +65 -0
- package/src/components/category/index.module.css +26 -0
- package/src/components/category/index.ts +1 -0
- package/src/components/content/component.tsx +34 -0
- package/src/components/content/index.module.css +12 -0
- package/src/components/content/index.ts +1 -0
- package/src/components/footer/component.tsx +34 -0
- package/src/components/footer/index.module.css +15 -0
- package/src/components/footer/index.ts +1 -0
- package/src/components/footer-button/component.tsx +17 -0
- package/src/components/footer-button/index.module.css +5 -0
- package/src/components/footer-button/index.ts +1 -0
- package/src/components/footer-text/component.tsx +31 -0
- package/src/components/footer-text/index.ts +1 -0
- package/src/components/graphics/component.tsx +34 -0
- package/src/components/graphics/index.module.css +18 -0
- package/src/components/graphics/index.ts +1 -0
- package/src/components/main/component.tsx +51 -0
- package/src/components/main/index.module.css +23 -0
- package/src/components/main/index.ts +1 -0
- package/src/components/text/component.tsx +100 -0
- package/src/components/text/index.module.css +34 -0
- package/src/components/text/index.ts +1 -0
- package/src/components/types.ts +27 -0
- package/src/components/typesProps.ts +56 -0
- package/src/index.module.css +94 -0
- package/src/index.ts +1 -0
- package/cssm/getDataTestId-5c876d98.d.ts +0 -2
- package/cssm/getDataTestId-5c876d98.js +0 -8
- package/esm/getDataTestId-da5e186a.d.ts +0 -2
- package/esm/getDataTestId-da5e186a.js +0 -6
- package/getDataTestId-ded5c63d.d.ts +0 -2
- package/getDataTestId-ded5c63d.js +0 -8
- package/modern/getDataTestId-ac4d85c3.d.ts +0 -2
- package/modern/getDataTestId-ac4d85c3.js +0 -6
- /package/{component-81a3aa3a.d.ts → component-b96676c0.d.ts} +0 -0
- /package/cssm/{component-f0bb4ddf.d.ts → component-ef4953bf.d.ts} +0 -0
- /package/esm/{component-d81bf7aa.d.ts → component-4f6ca416.d.ts} +0 -0
- /package/modern/{component-4a267d86.d.ts → component-4312f00c.d.ts} +0 -0
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
/* eslint-disable react/jsx-no-constructed-context-values */
|
|
2
|
+
import React, {
|
|
3
|
+
AnchorHTMLAttributes,
|
|
4
|
+
ButtonHTMLAttributes,
|
|
5
|
+
ElementType,
|
|
6
|
+
forwardRef,
|
|
7
|
+
HTMLAttributes,
|
|
8
|
+
useRef,
|
|
9
|
+
} from 'react';
|
|
10
|
+
import mergeRefs from 'react-merge-refs';
|
|
11
|
+
import cn from 'classnames';
|
|
12
|
+
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
14
|
+
import { ButtonProps } from '@alfalab/core-components-button';
|
|
15
|
+
import { Comment } from '@alfalab/core-components-comment';
|
|
16
|
+
import { useFocus } from '@alfalab/hooks';
|
|
17
|
+
|
|
18
|
+
import { Addon } from './components/addon';
|
|
19
|
+
import { Amount } from './components/amount';
|
|
20
|
+
import { AmountTitle } from './components/amount-title';
|
|
21
|
+
import { Category } from './components/category';
|
|
22
|
+
import { Content } from './components/content';
|
|
23
|
+
import { Footer } from './components/footer';
|
|
24
|
+
import { FooterButton } from './components/footer-button';
|
|
25
|
+
import { FooterText } from './components/footer-text';
|
|
26
|
+
import { Graphics } from './components/graphics';
|
|
27
|
+
import { Main } from './components/main';
|
|
28
|
+
import { Text } from './components/text';
|
|
29
|
+
import { PureCellElement } from './components/types';
|
|
30
|
+
|
|
31
|
+
import styles from './index.module.css';
|
|
32
|
+
|
|
33
|
+
export type PureCellContext = {
|
|
34
|
+
/** Направление */
|
|
35
|
+
direction?: 'horizontal' | 'vertical';
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
39
|
+
export const PureCellContext = React.createContext<PureCellContext>({});
|
|
40
|
+
|
|
41
|
+
export type PureCellProps = {
|
|
42
|
+
/**
|
|
43
|
+
* Направление
|
|
44
|
+
*/
|
|
45
|
+
direction?: 'horizontal' | 'vertical';
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Сss класс для стилизации общей обёртки
|
|
49
|
+
*/
|
|
50
|
+
className?: string;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Выводит ссылку в виде ячейки
|
|
54
|
+
*/
|
|
55
|
+
href?: string;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Вертикальные отступы
|
|
59
|
+
*/
|
|
60
|
+
verticalPadding?: 'airy' | 'default' | 'compact' | 'tiny' | 'none';
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Горизонтальные отступы
|
|
64
|
+
*/
|
|
65
|
+
horizontalPadding?: 'left' | 'right' | 'both' | 'none';
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Позволяет использовать кастомный компонент для кнопки (например Link из роутера)
|
|
69
|
+
*/
|
|
70
|
+
tag?: ElementType;
|
|
71
|
+
/**
|
|
72
|
+
* Компоненты
|
|
73
|
+
*/
|
|
74
|
+
children: PureCellElement;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Идентификатор для систем автоматизированного тестирования
|
|
78
|
+
*/
|
|
79
|
+
dataTestId?: string;
|
|
80
|
+
};
|
|
81
|
+
type AnchorPureCellProps = PureCellProps & AnchorHTMLAttributes<HTMLAnchorElement>;
|
|
82
|
+
type ButtonPureCellProps = PureCellProps & ButtonHTMLAttributes<HTMLButtonElement>;
|
|
83
|
+
type ElementPureCellProps = PureCellProps & HTMLAttributes<HTMLElement>;
|
|
84
|
+
type PureProps = Partial<AnchorPureCellProps | ButtonPureCellProps | ElementPureCellProps>;
|
|
85
|
+
|
|
86
|
+
const PureCellComponent = forwardRef<HTMLElement, PureProps>(
|
|
87
|
+
(
|
|
88
|
+
{
|
|
89
|
+
className,
|
|
90
|
+
dataTestId,
|
|
91
|
+
onClick,
|
|
92
|
+
href,
|
|
93
|
+
tag: Component = (href && 'a') || (onClick && 'button') || 'section',
|
|
94
|
+
children,
|
|
95
|
+
horizontalPadding = 'none',
|
|
96
|
+
verticalPadding = 'none',
|
|
97
|
+
direction = 'horizontal',
|
|
98
|
+
...restProps
|
|
99
|
+
},
|
|
100
|
+
ref,
|
|
101
|
+
) => {
|
|
102
|
+
const cellRef = useRef<HTMLDivElement>(null);
|
|
103
|
+
const [focused] = useFocus(cellRef, 'keyboard');
|
|
104
|
+
const addClasses = {
|
|
105
|
+
[styles.component]: true,
|
|
106
|
+
[styles.focused]: focused,
|
|
107
|
+
[styles[direction]]: true,
|
|
108
|
+
[styles.defaultPadding]: verticalPadding === 'default',
|
|
109
|
+
[styles[verticalPadding]]: verticalPadding !== 'default',
|
|
110
|
+
[styles[horizontalPadding]]: true,
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
if (href) {
|
|
114
|
+
const { target } = restProps as AnchorHTMLAttributes<HTMLAnchorElement>;
|
|
115
|
+
|
|
116
|
+
// Для совместимости с react-router-dom, меняем href на to
|
|
117
|
+
const hrefProps = { [typeof Component === 'string' ? 'href' : 'to']: href };
|
|
118
|
+
|
|
119
|
+
return (
|
|
120
|
+
<Component
|
|
121
|
+
rel={target === '_blank' ? 'noreferrer noopener' : undefined}
|
|
122
|
+
{...(restProps as AnchorHTMLAttributes<HTMLAnchorElement>)}
|
|
123
|
+
{...hrefProps}
|
|
124
|
+
ref={mergeRefs([cellRef, ref])}
|
|
125
|
+
className={cn(styles.link, addClasses, className)}
|
|
126
|
+
data-test-id={dataTestId}
|
|
127
|
+
onClick={onClick}
|
|
128
|
+
>
|
|
129
|
+
<PureCellContext.Provider value={{ direction }}>
|
|
130
|
+
{children}
|
|
131
|
+
</PureCellContext.Provider>
|
|
132
|
+
</Component>
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (onClick) {
|
|
137
|
+
return (
|
|
138
|
+
<Component
|
|
139
|
+
{...(restProps as AnchorHTMLAttributes<HTMLAnchorElement>)}
|
|
140
|
+
ref={mergeRefs([cellRef, ref])}
|
|
141
|
+
className={cn(styles.button, addClasses, className)}
|
|
142
|
+
data-test-id={dataTestId}
|
|
143
|
+
onClick={onClick}
|
|
144
|
+
>
|
|
145
|
+
<PureCellContext.Provider value={{ direction }}>
|
|
146
|
+
{children}
|
|
147
|
+
</PureCellContext.Provider>
|
|
148
|
+
</Component>
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
return (
|
|
153
|
+
<Component
|
|
154
|
+
{...(restProps as AnchorHTMLAttributes<HTMLAnchorElement>)}
|
|
155
|
+
ref={ref}
|
|
156
|
+
tabIndex={0}
|
|
157
|
+
className={cn(addClasses, className)}
|
|
158
|
+
data-test-id={dataTestId}
|
|
159
|
+
>
|
|
160
|
+
<PureCellContext.Provider value={{ direction }}>
|
|
161
|
+
{children}
|
|
162
|
+
</PureCellContext.Provider>
|
|
163
|
+
</Component>
|
|
164
|
+
);
|
|
165
|
+
},
|
|
166
|
+
);
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Универсальный конструктор для сборки любой ячейки.
|
|
170
|
+
*
|
|
171
|
+
* [Макет](https://www.figma.com/file/KlFOLLkKO8rtvvQE3RXuhq/Click-Library?node-id=43525%3A240018)
|
|
172
|
+
*/
|
|
173
|
+
export const PureCell = Object.assign(PureCellComponent, {
|
|
174
|
+
Main,
|
|
175
|
+
Graphics,
|
|
176
|
+
Content,
|
|
177
|
+
Text,
|
|
178
|
+
Amount,
|
|
179
|
+
AmountTitle,
|
|
180
|
+
Addon,
|
|
181
|
+
Footer,
|
|
182
|
+
ExtraSubtitle: FooterText,
|
|
183
|
+
FooterButton,
|
|
184
|
+
Comment,
|
|
185
|
+
Category,
|
|
186
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import cn from 'classnames';
|
|
3
|
+
|
|
4
|
+
import { getDataTestId } from '@alfalab/core-components-shared';
|
|
5
|
+
|
|
6
|
+
import { AddonElement } from '../types';
|
|
7
|
+
|
|
8
|
+
import styles from './index.module.css';
|
|
9
|
+
|
|
10
|
+
type Props = {
|
|
11
|
+
/**
|
|
12
|
+
* Вертикальное выравнивание
|
|
13
|
+
*/
|
|
14
|
+
verticalAlign?: 'auto' | 'top' | 'center' | 'bottom';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Горизонтальные отступы
|
|
18
|
+
*/
|
|
19
|
+
addonPadding?: 'default' | 'none';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Компоненты
|
|
23
|
+
*/
|
|
24
|
+
children: AddonElement;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Идентификатор для систем автоматизированного тестирования
|
|
28
|
+
*/
|
|
29
|
+
dataTestId?: string;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const Addon: React.FC<Props> = ({
|
|
33
|
+
children,
|
|
34
|
+
verticalAlign = 'top',
|
|
35
|
+
addonPadding = 'default',
|
|
36
|
+
dataTestId,
|
|
37
|
+
}) => (
|
|
38
|
+
<section
|
|
39
|
+
className={cn(styles.component, styles[addonPadding], styles[verticalAlign])}
|
|
40
|
+
data-test-id={getDataTestId(dataTestId, 'addon')}
|
|
41
|
+
>
|
|
42
|
+
{children}
|
|
43
|
+
</section>
|
|
44
|
+
);
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
@import '@alfalab/core-components-themes/src/default.css';
|
|
2
|
+
|
|
3
|
+
.component {
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
align-items: flex-end;
|
|
7
|
+
|
|
8
|
+
& > * {
|
|
9
|
+
justify-content: flex-end;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
&.none {
|
|
13
|
+
padding-left: 0;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&.default {
|
|
17
|
+
padding-left: var(--gap-m);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
&.addonPadding {
|
|
21
|
+
padding-left: var(--gap-m);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&.auto {
|
|
25
|
+
align-self: auto;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
&.top {
|
|
29
|
+
align-self: flex-start;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&.center {
|
|
33
|
+
align-self: center;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&.bottom {
|
|
37
|
+
align-self: flex-end;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './component';
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import cn from 'classnames';
|
|
3
|
+
|
|
4
|
+
import { Amount as CoreAmount } from '@alfalab/core-components-amount';
|
|
5
|
+
import { getDataTestId } from '@alfalab/core-components-shared';
|
|
6
|
+
import { Color, Typography } from '@alfalab/core-components-typography';
|
|
7
|
+
|
|
8
|
+
import { AmountProps as AmountType } from '../typesProps';
|
|
9
|
+
|
|
10
|
+
import styles from './index.module.css';
|
|
11
|
+
|
|
12
|
+
type Props = {
|
|
13
|
+
/**
|
|
14
|
+
* Начертание шрифта денежного значения
|
|
15
|
+
*/
|
|
16
|
+
weight?: 'bold' | 'normal';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Размер денежного значения
|
|
20
|
+
*/
|
|
21
|
+
textView?: 'component' | 'primary-small';
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Цвет денежного значения
|
|
25
|
+
*/
|
|
26
|
+
color?: Color;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Идентификатор для систем автоматизированного тестирования
|
|
30
|
+
*/
|
|
31
|
+
dataTestId?: string;
|
|
32
|
+
} & AmountType;
|
|
33
|
+
|
|
34
|
+
export const Amount: React.FC<Props> = ({
|
|
35
|
+
weight = 'normal',
|
|
36
|
+
textView = 'component',
|
|
37
|
+
color = 'primary',
|
|
38
|
+
minority,
|
|
39
|
+
minorUnits = 100,
|
|
40
|
+
dataTestId,
|
|
41
|
+
...restProps
|
|
42
|
+
}) => (
|
|
43
|
+
<Typography.Text
|
|
44
|
+
view={textView}
|
|
45
|
+
dataTestId={getDataTestId(dataTestId, 'amount-text')}
|
|
46
|
+
className={cn(styles.component)}
|
|
47
|
+
color={color}
|
|
48
|
+
>
|
|
49
|
+
<CoreAmount
|
|
50
|
+
minority={minority || minorUnits}
|
|
51
|
+
bold={weight === 'bold' ? 'full' : 'none'}
|
|
52
|
+
dataTestId={getDataTestId(dataTestId, 'amount')}
|
|
53
|
+
{...restProps}
|
|
54
|
+
/>
|
|
55
|
+
</Typography.Text>
|
|
56
|
+
);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './component';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import cn from 'classnames';
|
|
3
|
+
|
|
4
|
+
import { Amount as CoreAmount } from '@alfalab/core-components-amount';
|
|
5
|
+
import { getDataTestId } from '@alfalab/core-components-shared';
|
|
6
|
+
import { Color, Typography } from '@alfalab/core-components-typography';
|
|
7
|
+
|
|
8
|
+
import { AmountProps as AmountType } from '../typesProps';
|
|
9
|
+
|
|
10
|
+
import styles from './index.module.css';
|
|
11
|
+
|
|
12
|
+
type Props = {
|
|
13
|
+
/**
|
|
14
|
+
* Цвет денежного значения
|
|
15
|
+
*/
|
|
16
|
+
color?: Color;
|
|
17
|
+
} & AmountType;
|
|
18
|
+
|
|
19
|
+
export const AmountTitle: React.FC<Props> = ({
|
|
20
|
+
minority,
|
|
21
|
+
minorUnits = 100,
|
|
22
|
+
className,
|
|
23
|
+
color = 'primary',
|
|
24
|
+
dataTestId,
|
|
25
|
+
...restProps
|
|
26
|
+
}) => (
|
|
27
|
+
<Typography.Title
|
|
28
|
+
tag='h4'
|
|
29
|
+
view='small'
|
|
30
|
+
dataTestId={getDataTestId(dataTestId, 'amount-title')}
|
|
31
|
+
className={styles.component}
|
|
32
|
+
color={color}
|
|
33
|
+
>
|
|
34
|
+
<CoreAmount
|
|
35
|
+
minority={minority || minorUnits}
|
|
36
|
+
className={cn(styles.weight, className)}
|
|
37
|
+
dataTestId={getDataTestId(dataTestId, 'core-amount-title')}
|
|
38
|
+
{...restProps}
|
|
39
|
+
bold='none'
|
|
40
|
+
/>
|
|
41
|
+
</Typography.Title>
|
|
42
|
+
);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './component';
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
import { getDataTestId } from '@alfalab/core-components-shared';
|
|
4
|
+
import { Typography } from '@alfalab/core-components-typography';
|
|
5
|
+
|
|
6
|
+
import styles from './index.module.css';
|
|
7
|
+
|
|
8
|
+
type Props = {
|
|
9
|
+
/**
|
|
10
|
+
* Наименование категории
|
|
11
|
+
*/
|
|
12
|
+
categoryName: string;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Процент категории
|
|
16
|
+
*/
|
|
17
|
+
categoryPercent?: number;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Слот справа
|
|
21
|
+
*/
|
|
22
|
+
rightAddons?: ReactNode;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Идентификатор для систем автоматизированного тестирования
|
|
26
|
+
*/
|
|
27
|
+
dataTestId?: string;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const Category: React.FC<Props> = ({
|
|
31
|
+
categoryName,
|
|
32
|
+
categoryPercent,
|
|
33
|
+
rightAddons,
|
|
34
|
+
dataTestId,
|
|
35
|
+
}) => (
|
|
36
|
+
<div className={styles.component} data-test-id='cell-pure-category'>
|
|
37
|
+
<Typography.Text
|
|
38
|
+
view='primary-small'
|
|
39
|
+
color='secondary'
|
|
40
|
+
dataTestId={getDataTestId(dataTestId, 'category-name')}
|
|
41
|
+
className={styles.categoryName}
|
|
42
|
+
>
|
|
43
|
+
{categoryName}
|
|
44
|
+
</Typography.Text>
|
|
45
|
+
{categoryPercent !== undefined && (
|
|
46
|
+
<Typography.Text
|
|
47
|
+
tag='div'
|
|
48
|
+
view='primary-small'
|
|
49
|
+
color='secondary'
|
|
50
|
+
className={styles.categoryPercent}
|
|
51
|
+
dataTestId={getDataTestId(dataTestId, 'category-percent')}
|
|
52
|
+
>
|
|
53
|
+
{categoryPercent}%
|
|
54
|
+
</Typography.Text>
|
|
55
|
+
)}
|
|
56
|
+
{rightAddons !== undefined && (
|
|
57
|
+
<div
|
|
58
|
+
className={styles.rightAddon}
|
|
59
|
+
data-test-id={getDataTestId(dataTestId, 'category-right-addon')}
|
|
60
|
+
>
|
|
61
|
+
{rightAddons}
|
|
62
|
+
</div>
|
|
63
|
+
)}
|
|
64
|
+
</div>
|
|
65
|
+
);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
@import '@alfalab/core-components-themes/src/default.css';
|
|
2
|
+
|
|
3
|
+
.component {
|
|
4
|
+
display: flex;
|
|
5
|
+
overflow: hidden;
|
|
6
|
+
padding: var(--gap-3xs) 0;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.categoryName {
|
|
10
|
+
display: -webkit-box;
|
|
11
|
+
-webkit-line-clamp: 1;
|
|
12
|
+
-webkit-box-orient: vertical;
|
|
13
|
+
overflow: hidden;
|
|
14
|
+
word-break: break-all;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.categoryPercent {
|
|
18
|
+
padding: 0 var(--gap-xs);
|
|
19
|
+
background-color: var(--color-light-bg-secondary);
|
|
20
|
+
border-radius: var(--border-radius-xl);
|
|
21
|
+
margin-left: var(--gap-2xs);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.rightAddon {
|
|
25
|
+
margin-left: var(--gap-2xs);
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './component';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
|
+
import cn from 'classnames';
|
|
3
|
+
|
|
4
|
+
import { getDataTestId } from '@alfalab/core-components-shared';
|
|
5
|
+
|
|
6
|
+
import { PureCellContext } from '../../component';
|
|
7
|
+
import { ContentElement } from '../types';
|
|
8
|
+
|
|
9
|
+
import styles from './index.module.css';
|
|
10
|
+
|
|
11
|
+
type Props = {
|
|
12
|
+
/**
|
|
13
|
+
* Компоненты
|
|
14
|
+
*/
|
|
15
|
+
children: ContentElement;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Идентификатор для систем автоматизированного тестирования
|
|
19
|
+
*/
|
|
20
|
+
dataTestId?: string;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const Content: React.FC<Props> = ({ children, dataTestId }) => {
|
|
24
|
+
const { direction } = useContext(PureCellContext);
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<section
|
|
28
|
+
className={cn(styles.component, { [styles.horizontal]: direction === 'horizontal' })}
|
|
29
|
+
data-test-id={getDataTestId(dataTestId, 'content')}
|
|
30
|
+
>
|
|
31
|
+
{children}
|
|
32
|
+
</section>
|
|
33
|
+
);
|
|
34
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './component';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import cn from 'classnames';
|
|
3
|
+
|
|
4
|
+
import { getDataTestId } from '@alfalab/core-components-shared';
|
|
5
|
+
|
|
6
|
+
import { FooterElement } from '../types';
|
|
7
|
+
|
|
8
|
+
import styles from './index.module.css';
|
|
9
|
+
|
|
10
|
+
type Props = {
|
|
11
|
+
/**
|
|
12
|
+
* Компоненты
|
|
13
|
+
*/
|
|
14
|
+
children: FooterElement;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Вертикальные отступы
|
|
18
|
+
*/
|
|
19
|
+
footerPadding?: 'default' | 'none';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Идентификатор для систем автоматизированного тестирования
|
|
23
|
+
*/
|
|
24
|
+
dataTestId?: string;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const Footer: React.FC<Props> = ({ children, footerPadding = 'default', dataTestId }) => (
|
|
28
|
+
<footer
|
|
29
|
+
className={cn(styles.component, styles[footerPadding])}
|
|
30
|
+
data-test-id={getDataTestId(dataTestId, 'footer')}
|
|
31
|
+
>
|
|
32
|
+
{children}
|
|
33
|
+
</footer>
|
|
34
|
+
);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './component';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { Button, ButtonProps } from '@alfalab/core-components-button';
|
|
4
|
+
import { getDataTestId } from '@alfalab/core-components-shared';
|
|
5
|
+
|
|
6
|
+
import styles from './index.module.css';
|
|
7
|
+
|
|
8
|
+
export const FooterButton: React.FC<ButtonProps> = ({ children, dataTestId, ...props }) => (
|
|
9
|
+
<Button
|
|
10
|
+
{...props}
|
|
11
|
+
size='xxs'
|
|
12
|
+
dataTestId={getDataTestId(dataTestId, 'button')}
|
|
13
|
+
className={styles.component}
|
|
14
|
+
>
|
|
15
|
+
{children}
|
|
16
|
+
</Button>
|
|
17
|
+
);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './component';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
import { getDataTestId } from '@alfalab/core-components-shared';
|
|
4
|
+
import { Color, Typography } from '@alfalab/core-components-typography';
|
|
5
|
+
|
|
6
|
+
export type Props = {
|
|
7
|
+
/**
|
|
8
|
+
* Цвет текста
|
|
9
|
+
*/
|
|
10
|
+
color?: Color;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Идентификатор для систем автоматизированного тестирования
|
|
14
|
+
*/
|
|
15
|
+
dataTestId?: string;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Дочерние элементы.
|
|
19
|
+
*/
|
|
20
|
+
children?: ReactNode;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const FooterText: React.FC<Props> = ({ children, color = 'secondary', dataTestId }) => (
|
|
24
|
+
<Typography.Text
|
|
25
|
+
view='primary-small'
|
|
26
|
+
color={color}
|
|
27
|
+
data-test-id={getDataTestId(dataTestId, 'footer-title')}
|
|
28
|
+
>
|
|
29
|
+
{children}
|
|
30
|
+
</Typography.Text>
|
|
31
|
+
);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './component';
|