@alfalab/core-components-pure-cell 4.3.2 → 4.4.0

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.
Files changed (195) hide show
  1. package/{component-81a3aa3a.js → component-1d246a90.js} +9 -9
  2. package/component.js +2 -2
  3. package/components/addon/component.js +3 -3
  4. package/components/addon/index.css +10 -10
  5. package/components/addon/index.js +1 -1
  6. package/components/amount/component.js +4 -4
  7. package/components/amount/index.css +2 -2
  8. package/components/amount/index.js +1 -1
  9. package/components/amount-title/component.js +4 -4
  10. package/components/amount-title/index.css +3 -3
  11. package/components/amount-title/index.js +1 -1
  12. package/components/category/component.js +5 -5
  13. package/components/category/index.css +5 -5
  14. package/components/category/index.js +1 -1
  15. package/components/content/component.js +2 -2
  16. package/components/content/index.css +3 -3
  17. package/components/content/index.d.ts +1 -1
  18. package/components/content/index.js +2 -2
  19. package/components/footer/component.js +3 -3
  20. package/components/footer/index.css +4 -4
  21. package/components/footer/index.js +1 -1
  22. package/components/footer-button/component.js +3 -3
  23. package/components/footer-button/index.css +2 -2
  24. package/components/footer-button/index.js +1 -1
  25. package/components/footer-text/component.js +2 -2
  26. package/components/footer-text/index.js +1 -1
  27. package/components/graphics/component.js +3 -3
  28. package/components/graphics/index.css +5 -5
  29. package/components/graphics/index.js +1 -1
  30. package/components/main/component.js +2 -2
  31. package/components/main/index.css +4 -4
  32. package/components/main/index.d.ts +1 -1
  33. package/components/main/index.js +2 -2
  34. package/components/text/component.js +2 -2
  35. package/components/text/index.css +7 -7
  36. package/components/text/index.d.ts +1 -1
  37. package/components/text/index.js +2 -2
  38. package/cssm/{component-f0bb4ddf.js → component-ef4953bf.js} +5 -5
  39. package/cssm/component.js +2 -2
  40. package/cssm/components/addon/component.js +2 -2
  41. package/cssm/components/addon/index.js +1 -1
  42. package/cssm/components/amount/component.js +3 -3
  43. package/cssm/components/amount/index.js +1 -1
  44. package/cssm/components/amount-title/component.js +3 -3
  45. package/cssm/components/amount-title/index.js +1 -1
  46. package/cssm/components/category/component.js +4 -4
  47. package/cssm/components/category/index.js +1 -1
  48. package/cssm/components/content/component.js +2 -2
  49. package/cssm/components/content/index.d.ts +1 -1
  50. package/cssm/components/content/index.js +2 -2
  51. package/cssm/components/footer/component.js +2 -2
  52. package/cssm/components/footer/index.js +1 -1
  53. package/cssm/components/footer-button/component.js +2 -2
  54. package/cssm/components/footer-button/index.js +1 -1
  55. package/cssm/components/footer-text/component.js +2 -2
  56. package/cssm/components/footer-text/index.js +1 -1
  57. package/cssm/components/graphics/component.js +2 -2
  58. package/cssm/components/graphics/index.js +1 -1
  59. package/cssm/components/main/component.js +2 -2
  60. package/cssm/components/main/index.d.ts +1 -1
  61. package/cssm/components/main/index.js +2 -2
  62. package/cssm/components/text/component.js +2 -2
  63. package/cssm/components/text/index.d.ts +1 -1
  64. package/cssm/components/text/index.js +2 -2
  65. package/cssm/index.js +2 -2
  66. package/esm/{component-d81bf7aa.js → component-bdd266d4.js} +5 -5
  67. package/esm/component.js +2 -2
  68. package/esm/components/addon/component.js +2 -2
  69. package/esm/components/addon/index.css +10 -10
  70. package/esm/components/addon/index.js +1 -1
  71. package/esm/components/amount/component.js +2 -2
  72. package/esm/components/amount/index.css +2 -2
  73. package/esm/components/amount/index.js +1 -1
  74. package/esm/components/amount-title/component.js +2 -2
  75. package/esm/components/amount-title/index.css +3 -3
  76. package/esm/components/amount-title/index.js +1 -1
  77. package/esm/components/category/component.js +2 -2
  78. package/esm/components/category/index.css +5 -5
  79. package/esm/components/category/index.js +1 -1
  80. package/esm/components/content/component.js +2 -2
  81. package/esm/components/content/index.css +3 -3
  82. package/esm/components/content/index.d.ts +1 -1
  83. package/esm/components/content/index.js +2 -2
  84. package/esm/components/footer/component.js +2 -2
  85. package/esm/components/footer/index.css +4 -4
  86. package/esm/components/footer/index.js +1 -1
  87. package/esm/components/footer-button/component.js +2 -2
  88. package/esm/components/footer-button/index.css +2 -2
  89. package/esm/components/footer-button/index.js +1 -1
  90. package/esm/components/footer-text/component.js +1 -1
  91. package/esm/components/footer-text/index.js +1 -1
  92. package/esm/components/graphics/component.js +2 -2
  93. package/esm/components/graphics/index.css +5 -5
  94. package/esm/components/graphics/index.js +1 -1
  95. package/esm/components/main/component.js +2 -2
  96. package/esm/components/main/index.css +4 -4
  97. package/esm/components/main/index.d.ts +1 -1
  98. package/esm/components/main/index.js +2 -2
  99. package/esm/components/text/component.js +2 -2
  100. package/esm/components/text/index.css +7 -7
  101. package/esm/components/text/index.d.ts +1 -1
  102. package/esm/components/text/index.js +2 -2
  103. package/esm/index.css +21 -21
  104. package/esm/index.js +2 -2
  105. package/index.css +21 -21
  106. package/index.js +2 -2
  107. package/modern/{component-4a267d86.js → component-b811b670.js} +5 -5
  108. package/modern/component.js +2 -2
  109. package/modern/components/addon/component.js +2 -2
  110. package/modern/components/addon/index.css +10 -10
  111. package/modern/components/addon/index.js +1 -1
  112. package/modern/components/amount/component.js +2 -2
  113. package/modern/components/amount/index.css +2 -2
  114. package/modern/components/amount/index.js +1 -1
  115. package/modern/components/amount-title/component.js +2 -2
  116. package/modern/components/amount-title/index.css +3 -3
  117. package/modern/components/amount-title/index.js +1 -1
  118. package/modern/components/category/component.js +2 -2
  119. package/modern/components/category/index.css +5 -5
  120. package/modern/components/category/index.js +1 -1
  121. package/modern/components/content/component.js +2 -2
  122. package/modern/components/content/index.css +3 -3
  123. package/modern/components/content/index.d.ts +1 -1
  124. package/modern/components/content/index.js +2 -2
  125. package/modern/components/footer/component.js +2 -2
  126. package/modern/components/footer/index.css +4 -4
  127. package/modern/components/footer/index.js +1 -1
  128. package/modern/components/footer-button/component.js +2 -2
  129. package/modern/components/footer-button/index.css +2 -2
  130. package/modern/components/footer-button/index.js +1 -1
  131. package/modern/components/footer-text/component.js +1 -1
  132. package/modern/components/footer-text/index.js +1 -1
  133. package/modern/components/graphics/component.js +2 -2
  134. package/modern/components/graphics/index.css +5 -5
  135. package/modern/components/graphics/index.js +1 -1
  136. package/modern/components/main/component.js +2 -2
  137. package/modern/components/main/index.css +4 -4
  138. package/modern/components/main/index.d.ts +1 -1
  139. package/modern/components/main/index.js +2 -2
  140. package/modern/components/text/component.js +2 -2
  141. package/modern/components/text/index.css +7 -7
  142. package/modern/components/text/index.d.ts +1 -1
  143. package/modern/components/text/index.js +2 -2
  144. package/modern/index.css +21 -21
  145. package/modern/index.js +2 -2
  146. package/package.json +6 -5
  147. package/src/component.tsx +186 -0
  148. package/src/components/addon/component.tsx +44 -0
  149. package/src/components/addon/index.module.css +39 -0
  150. package/src/components/addon/index.ts +1 -0
  151. package/src/components/amount/component.tsx +56 -0
  152. package/src/components/amount/index.module.css +6 -0
  153. package/src/components/amount/index.ts +1 -0
  154. package/src/components/amount-title/component.tsx +42 -0
  155. package/src/components/amount-title/index.module.css +9 -0
  156. package/src/components/amount-title/index.ts +1 -0
  157. package/src/components/category/component.tsx +65 -0
  158. package/src/components/category/index.module.css +26 -0
  159. package/src/components/category/index.ts +1 -0
  160. package/src/components/content/component.tsx +34 -0
  161. package/src/components/content/index.module.css +12 -0
  162. package/src/components/content/index.ts +1 -0
  163. package/src/components/footer/component.tsx +34 -0
  164. package/src/components/footer/index.module.css +15 -0
  165. package/src/components/footer/index.ts +1 -0
  166. package/src/components/footer-button/component.tsx +17 -0
  167. package/src/components/footer-button/index.module.css +5 -0
  168. package/src/components/footer-button/index.ts +1 -0
  169. package/src/components/footer-text/component.tsx +31 -0
  170. package/src/components/footer-text/index.ts +1 -0
  171. package/src/components/graphics/component.tsx +34 -0
  172. package/src/components/graphics/index.module.css +18 -0
  173. package/src/components/graphics/index.ts +1 -0
  174. package/src/components/main/component.tsx +51 -0
  175. package/src/components/main/index.module.css +23 -0
  176. package/src/components/main/index.ts +1 -0
  177. package/src/components/text/component.tsx +100 -0
  178. package/src/components/text/index.module.css +34 -0
  179. package/src/components/text/index.ts +1 -0
  180. package/src/components/types.ts +27 -0
  181. package/src/components/typesProps.ts +56 -0
  182. package/src/index.module.css +94 -0
  183. package/src/index.ts +1 -0
  184. package/cssm/getDataTestId-5c876d98.d.ts +0 -2
  185. package/cssm/getDataTestId-5c876d98.js +0 -8
  186. package/esm/getDataTestId-da5e186a.d.ts +0 -2
  187. package/esm/getDataTestId-da5e186a.js +0 -6
  188. package/getDataTestId-ded5c63d.d.ts +0 -2
  189. package/getDataTestId-ded5c63d.js +0 -8
  190. package/modern/getDataTestId-ac4d85c3.d.ts +0 -2
  191. package/modern/getDataTestId-ac4d85c3.js +0 -6
  192. /package/{component-81a3aa3a.d.ts → component-1d246a90.d.ts} +0 -0
  193. /package/cssm/{component-f0bb4ddf.d.ts → component-ef4953bf.d.ts} +0 -0
  194. /package/esm/{component-d81bf7aa.d.ts → component-bdd266d4.d.ts} +0 -0
  195. /package/modern/{component-4a267d86.d.ts → component-b811b670.d.ts} +0 -0
@@ -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,9 @@
1
+ @import '@alfalab/core-components-themes/src/default.css';
2
+
3
+ .component {
4
+ display: flex;
5
+ }
6
+
7
+ .weight {
8
+ font-weight: inherit;
9
+ }
@@ -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,12 @@
1
+ @import '@alfalab/core-components-themes/src/default.css';
2
+
3
+ .component {
4
+ flex-basis: 100%;
5
+ display: grid;
6
+ grid-template-columns: 1fr auto;
7
+
8
+ &.horizontal {
9
+ /* for button */
10
+ align-self: stretch;
11
+ }
12
+ }
@@ -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,15 @@
1
+ @import '@alfalab/core-components-themes/src/default.css';
2
+
3
+ .component {
4
+ grid-column: 1/3;
5
+ display: grid;
6
+ grid-row-gap: var(--gap-xs);
7
+
8
+ &.none {
9
+ margin-top: 0;
10
+ }
11
+
12
+ &.default {
13
+ margin-top: var(--gap-xs);
14
+ }
15
+ }
@@ -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,5 @@
1
+ @import '@alfalab/core-components-themes/src/default.css';
2
+
3
+ .component {
4
+ justify-self: start;
5
+ }
@@ -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';
@@ -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 { GraphicsElement } from '../types';
7
+
8
+ import styles from './index.module.css';
9
+
10
+ export type Props = {
11
+ /**
12
+ * Компоненты
13
+ */
14
+ children: GraphicsElement;
15
+
16
+ /**
17
+ * Идентификатор для систем автоматизированного тестирования
18
+ */
19
+ dataTestId?: string;
20
+
21
+ /**
22
+ * Вертикальное выравнивание
23
+ */
24
+ verticalAlign?: 'top' | 'center' | 'bottom';
25
+ };
26
+
27
+ export const Graphics: React.FC<Props> = ({ children, dataTestId, verticalAlign = 'top' }) => (
28
+ <section
29
+ className={cn(styles.component, styles[verticalAlign])}
30
+ data-test-id={getDataTestId(dataTestId, 'graphics')}
31
+ >
32
+ {children}
33
+ </section>
34
+ );
@@ -0,0 +1,18 @@
1
+ @import '@alfalab/core-components-themes/src/default.css';
2
+
3
+ .component {
4
+ display: inline-flex;
5
+ flex-basis: auto;
6
+ }
7
+
8
+ .top {
9
+ align-self: flex-start;
10
+ }
11
+
12
+ .center {
13
+ align-self: center;
14
+ }
15
+
16
+ .bottom {
17
+ align-self: flex-end;
18
+ }
@@ -0,0 +1 @@
1
+ export * from './component';
@@ -0,0 +1,51 @@
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 { MainElement } from '../types';
8
+
9
+ import styles from './index.module.css';
10
+
11
+ type Props = {
12
+ /**
13
+ * Компоненты
14
+ */
15
+ children: MainElement;
16
+
17
+ /**
18
+ * Позволяет изменить расположение блоков внутри main
19
+ */
20
+ isReverse?: boolean;
21
+
22
+ /**
23
+ * Дополнительный класс
24
+ */
25
+ className?: string;
26
+
27
+ /**
28
+ * Идентификатор для систем автоматизированного тестирования
29
+ */
30
+ dataTestId?: string;
31
+ };
32
+
33
+ export const Main: React.FC<Props> = ({ children, isReverse, className, dataTestId }) => {
34
+ const { direction = 'horizontal' } = useContext(PureCellContext);
35
+
36
+ return (
37
+ <div
38
+ className={cn(
39
+ styles.component,
40
+ styles[direction],
41
+ {
42
+ [styles.reverse]: isReverse,
43
+ },
44
+ className,
45
+ )}
46
+ data-test-id={getDataTestId(dataTestId, 'main')}
47
+ >
48
+ {children}
49
+ </div>
50
+ );
51
+ };
@@ -0,0 +1,23 @@
1
+ @import '@alfalab/core-components-themes/src/default.css';
2
+
3
+ .component {
4
+ display: flex;
5
+ flex-direction: column;
6
+ align-self: center;
7
+
8
+ /* can use /r/n */
9
+ white-space: pre-line;
10
+
11
+ &.vertical {
12
+ grid-row-gap: var(--gap-3xs);
13
+ justify-content: center;
14
+ align-items: center;
15
+
16
+ /* for button */
17
+ text-align: center;
18
+ }
19
+
20
+ &.reverse {
21
+ flex-direction: column-reverse;
22
+ }
23
+ }
@@ -0,0 +1 @@
1
+ export * from './component';
@@ -0,0 +1,100 @@
1
+ import React, { ReactNode, useContext } from 'react';
2
+ import cn from 'classnames';
3
+
4
+ import { getDataTestId } from '@alfalab/core-components-shared';
5
+ import { Color, Typography } from '@alfalab/core-components-typography';
6
+
7
+ import { PureCellContext } from '../../component';
8
+
9
+ import styles from './index.module.css';
10
+
11
+ type Props = {
12
+ /**
13
+ * Контент
14
+ */
15
+ children?: ReactNode;
16
+
17
+ /**
18
+ * Количество строк
19
+ */
20
+ rowLimit?: 1 | 2;
21
+
22
+ /**
23
+ * Размер текста
24
+ */
25
+ view: 'primary-large' | 'primary-medium' | 'primary-small' | 'component';
26
+
27
+ /**
28
+ * Толщина title
29
+ */
30
+ titleWeight?: 'regular' | 'bold';
31
+
32
+ /**
33
+ * Цвет title
34
+ */
35
+ titleColor: Color;
36
+
37
+ /**
38
+ * Value ячейки
39
+ */
40
+ value?: ReactNode;
41
+
42
+ /**
43
+ * Цвет value
44
+ */
45
+ valueColor?: Color;
46
+
47
+ /**
48
+ * Идентификатор для систем автоматизированного тестирования
49
+ */
50
+ dataTestId?: string;
51
+ };
52
+
53
+ export const Text: React.FC<Props> = ({
54
+ children,
55
+ value,
56
+ rowLimit,
57
+ view = 'component',
58
+ titleWeight,
59
+ titleColor,
60
+ valueColor,
61
+ dataTestId,
62
+ }) => {
63
+ const { direction = 'horizontal' } = useContext(PureCellContext);
64
+ const className = rowLimit && styles[`rowLimit${rowLimit}`];
65
+
66
+ return (
67
+ <div
68
+ className={cn(styles.component, {
69
+ [styles.vertical]: direction !== 'horizontal',
70
+ })}
71
+ >
72
+ <div className={styles.title}>
73
+ <Typography.Text
74
+ view={view}
75
+ weight={titleWeight}
76
+ tag='div'
77
+ color={titleColor}
78
+ className={className}
79
+ data-test-id={getDataTestId(dataTestId, 'text_content')}
80
+ >
81
+ {children}
82
+ </Typography.Text>
83
+ </div>
84
+
85
+ {value && (
86
+ <div className={styles.value}>
87
+ <Typography.Text
88
+ view={view}
89
+ tag='div'
90
+ color={valueColor}
91
+ className={className}
92
+ data-test-id={getDataTestId(dataTestId, 'text_value')}
93
+ >
94
+ {value}
95
+ </Typography.Text>
96
+ </div>
97
+ )}
98
+ </div>
99
+ );
100
+ };
@@ -0,0 +1,34 @@
1
+ @import '@alfalab/core-components-themes/src/default.css';
2
+
3
+ .horizontal {
4
+ padding: var(--gap-3xs) 0;
5
+ }
6
+
7
+ .rowLimit1 {
8
+ @mixin row_limit 1;
9
+ word-break: break-all;
10
+ }
11
+
12
+ .rowLimit2 {
13
+ @mixin row_limit 2;
14
+ }
15
+
16
+ .component {
17
+ display: flex;
18
+ flex-direction: row;
19
+ flex-wrap: nowrap;
20
+ justify-content: space-between;
21
+ margin: var(--gap-3xs) 0;
22
+ word-break: break-word;
23
+ }
24
+
25
+ .component {
26
+ & .vertical {
27
+ justify-content: center;
28
+ }
29
+ }
30
+
31
+ .title + .value {
32
+ margin-left: var(--gap-m);
33
+ flex-shrink: 0;
34
+ }
@@ -0,0 +1 @@
1
+ export * from './component';
@@ -0,0 +1,27 @@
1
+ import { ReactElement, ReactNode } from 'react';
2
+
3
+ import { Comment } from '@alfalab/core-components-comment';
4
+
5
+ import { Amount } from './amount';
6
+ import { AmountTitle } from './amount-title';
7
+ import { FooterButton } from './footer-button';
8
+ import { FooterText } from './footer-text';
9
+ import { Graphics } from './graphics';
10
+ import { Text } from './text';
11
+
12
+ type TextElement = ReactElement<typeof Text>;
13
+ export type GraphicsElement = ReactElement<typeof Graphics>;
14
+ type AmountElement = ReactElement<typeof Amount>;
15
+ type AmountTitleElement = ReactElement<typeof AmountTitle>;
16
+ export type CommentElement = ReactElement<typeof Comment>;
17
+ type FooterButtonElement = ReactElement<typeof FooterButton>;
18
+ type FooterTitleElement = ReactElement<typeof FooterText>;
19
+ export type FooterElement =
20
+ | Array<ReactElement<FooterButtonElement> | FooterTitleElement>
21
+ | CommentElement;
22
+ export type MainElement =
23
+ | Array<undefined | '' | TextElement | AmountElement | AmountTitleElement>
24
+ | (TextElement | AmountElement | AmountTitleElement);
25
+ export type ContentElement = Array<MainElement | AddonElement | FooterElement> | MainElement;
26
+ export type AddonElement = Array<TextElement | ReactNode> | TextElement | ReactNode;
27
+ export type PureCellElement = Array<GraphicsElement | ContentElement> | ContentElement;
@@ -0,0 +1,56 @@
1
+ import { ReactNode } from 'react';
2
+
3
+ import { CurrencyCodes } from '@alfalab/data';
4
+
5
+ export type AmountProps = {
6
+ /**
7
+ * Денежное значение в минорных единицах
8
+ */
9
+ value: number;
10
+
11
+ /**
12
+ * Валюта
13
+ */
14
+ currency?: CurrencyCodes;
15
+
16
+ /**
17
+ * Слот справа
18
+ */
19
+ rightAddons?: ReactNode;
20
+
21
+ /**
22
+ * Количество минорных единиц в валюте
23
+ */
24
+ minority?: number;
25
+
26
+ /**
27
+ * Делает минорную часть полупрозрачной
28
+ */
29
+ transparentMinor?: boolean;
30
+
31
+ /**
32
+ * Количество минорных единиц в валюте для Клика
33
+ */
34
+ minorUnits?: number;
35
+
36
+ /**
37
+ * default - не отображаем копейки, если их значение 0
38
+ * withZeroMinorPart - отображаем копейки, даже если их значение равно 0
39
+ */
40
+ view?: 'default' | 'withZeroMinorPart';
41
+
42
+ /**
43
+ * Показывать значок + для положительных значений
44
+ */
45
+ showPlus?: boolean;
46
+
47
+ /**
48
+ * Дополнительный класс
49
+ */
50
+ className?: string;
51
+
52
+ /**
53
+ * Идентификатор для систем автоматизированного тестирования
54
+ */
55
+ dataTestId?: string;
56
+ };