@alfalab/core-components-typography 6.0.13 → 6.0.14-alfasans
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/colors.css +20 -20
- package/colors.module.css.js +1 -1
- package/cssm/text/component.js +18 -16
- package/cssm/text/component.js.map +1 -1
- package/cssm/text/index.module.css +48 -14
- package/cssm/title/common.module.css +8 -1
- package/cssm/title/component.d.ts +2 -8
- package/cssm/title/component.js +16 -17
- package/cssm/title/component.js.map +1 -1
- package/cssm/title/index.d.ts +1 -4
- package/cssm/title/index.module.css +23 -74
- package/cssm/title-mobile/component.d.ts +1 -4
- package/cssm/title-mobile/index.module.css +28 -45
- package/cssm/title-responsive/component.d.ts +1 -4
- package/esm/colors.css +20 -20
- package/esm/colors.module.css.js +1 -1
- package/esm/text/component.js +19 -17
- package/esm/text/component.js.map +1 -1
- package/esm/text/index.css +88 -54
- package/esm/text/index.module.css.js +1 -1
- package/esm/text/index.module.css.js.map +1 -1
- package/esm/title/common.css +13 -6
- package/esm/title/common.module.css.js +1 -1
- package/esm/title/common.module.css.js.map +1 -1
- package/esm/title/component.d.ts +2 -8
- package/esm/title/component.js +16 -17
- package/esm/title/component.js.map +1 -1
- package/esm/title/index.css +38 -89
- package/esm/title/index.d.ts +1 -4
- package/esm/title/index.module.css.js +1 -1
- package/esm/title/index.module.css.js.map +1 -1
- package/esm/title-mobile/component.d.ts +1 -4
- package/esm/title-mobile/index.css +53 -70
- package/esm/title-mobile/index.module.css.js +1 -1
- package/esm/title-responsive/component.d.ts +1 -4
- package/modern/colors.css +20 -20
- package/modern/colors.module.css.js +1 -1
- package/modern/text/component.js +19 -17
- package/modern/text/component.js.map +1 -1
- package/modern/text/index.css +88 -54
- package/modern/text/index.module.css.js +1 -1
- package/modern/text/index.module.css.js.map +1 -1
- package/modern/title/common.css +13 -6
- package/modern/title/common.module.css.js +1 -1
- package/modern/title/common.module.css.js.map +1 -1
- package/modern/title/component.d.ts +2 -8
- package/modern/title/component.js +15 -16
- package/modern/title/component.js.map +1 -1
- package/modern/title/index.css +38 -89
- package/modern/title/index.d.ts +1 -4
- package/modern/title/index.module.css.js +1 -1
- package/modern/title/index.module.css.js.map +1 -1
- package/modern/title-mobile/component.d.ts +1 -4
- package/modern/title-mobile/index.css +53 -70
- package/modern/title-mobile/index.module.css.js +1 -1
- package/modern/title-responsive/component.d.ts +1 -4
- package/moderncssm/text/component.js +19 -17
- package/moderncssm/text/component.js.map +1 -1
- package/moderncssm/text/index.module.css +47 -12
- package/moderncssm/title/common.module.css +10 -1
- package/moderncssm/title/component.d.ts +2 -8
- package/moderncssm/title/component.js +15 -16
- package/moderncssm/title/component.js.map +1 -1
- package/moderncssm/title/index.d.ts +1 -4
- package/moderncssm/title/index.module.css +20 -79
- package/moderncssm/title-mobile/component.d.ts +1 -4
- package/moderncssm/title-mobile/index.module.css +25 -40
- package/moderncssm/title-responsive/component.d.ts +1 -4
- package/package.json +6 -6
- package/src/common.module.css +10 -1
- package/src/text/component.tsx +36 -31
- package/src/title/component.tsx +36 -36
- package/src/title/index.module.css +0 -8
- package/text/component.js +18 -16
- package/text/component.js.map +1 -1
- package/text/index.css +88 -54
- package/text/index.module.css.js +1 -1
- package/text/index.module.css.js.map +1 -1
- package/title/common.css +13 -6
- package/title/common.module.css.js +1 -1
- package/title/common.module.css.js.map +1 -1
- package/title/component.d.ts +2 -8
- package/title/component.js +15 -16
- package/title/component.js.map +1 -1
- package/title/index.css +38 -89
- package/title/index.d.ts +1 -4
- package/title/index.module.css.js +1 -1
- package/title/index.module.css.js.map +1 -1
- package/title-mobile/component.d.ts +1 -4
- package/title-mobile/index.css +53 -70
- package/title-mobile/index.module.css.js +1 -1
- package/title-responsive/component.d.ts +1 -4
- package/cssm/title/utils.d.ts +0 -1
- package/cssm/title/utils.js +0 -16
- package/cssm/title/utils.js.map +0 -1
- package/esm/title/utils.d.ts +0 -1
- package/esm/title/utils.js +0 -12
- package/esm/title/utils.js.map +0 -1
- package/modern/title/utils.d.ts +0 -1
- package/modern/title/utils.js +0 -12
- package/modern/title/utils.js.map +0 -1
- package/moderncssm/title/utils.d.ts +0 -1
- package/moderncssm/title/utils.js +0 -12
- package/moderncssm/title/utils.js.map +0 -1
- package/src/title/utils.ts +0 -14
- package/title/utils.d.ts +0 -1
- package/title/utils.js +0 -16
- package/title/utils.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './index.css';
|
|
2
2
|
|
|
3
|
-
const styles = {"xlarge":"
|
|
3
|
+
const styles = {"xlarge":"typography__xlarge_1ntge","regular-xlarge":"typography__regular-xlarge_1ntge","large":"typography__large_1ntge","regular-large":"typography__regular-large_1ntge","medium":"typography__medium_1ntge","regular-medium":"typography__regular-medium_1ntge","small":"typography__small_1ntge","regular-small":"typography__regular-small_1ntge","xsmall":"typography__xsmall_1ntge","regular-xsmall":"typography__regular-xsmall_1ntge","component":"typography__component_1ntge","margins-xlarge":"typography__margins-xlarge_1ntge","margins-large":"typography__margins-large_1ntge","margins-medium":"typography__margins-medium_1ntge","margins-small":"typography__margins-small_1ntge","margins-xsmall":"typography__margins-xsmall_1ntge"};
|
|
4
4
|
|
|
5
5
|
export { styles as default };
|
|
6
6
|
//# sourceMappingURL=index.module.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.module.css.js","sources":["../src/title/index.module.css"],"sourcesContent":["@import '@alfalab/core-components-vars/src/index.css';\n@import '../margins.module.css';\n\n@each $view in xlarge, large, medium, small, xsmall {\n .$(view) {\n @mixin headline-system_$(view);\n
|
|
1
|
+
{"version":3,"file":"index.module.css.js","sources":["../src/title/index.module.css"],"sourcesContent":["@import '@alfalab/core-components-vars/src/index.css';\n@import '../margins.module.css';\n\n@each $view in xlarge, large, medium, small, xsmall {\n .$(view) {\n @mixin headline-system_$(view);\n }\n\n .regular-$(view) {\n @mixin promo-system_$(view);\n }\n}\n\n.component {\n &.margins-xlarge {\n @mixin margin-large;\n }\n\n &.margins-large {\n @mixin margin-medium;\n }\n\n &.margins-medium {\n @mixin margin-medium;\n }\n\n &.margins-small {\n @mixin margin-small;\n }\n\n &.margins-xsmall {\n @mixin margin-small;\n }\n}\n"],"names":[],"mappings":";;AAEgB,eAAe,CAAC,QAAQ,CAAC,0BAA0B,CAAC,gBAAgB,CAAC,kCAAkC,CAAC,OAAO,CAAC,yBAAyB,CAAC,eAAe,CAAC,iCAAiC,CAAC,QAAQ,CAAC,0BAA0B,CAAC,gBAAgB,CAAC,kCAAkC,CAAC,OAAO,CAAC,yBAAyB,CAAC,eAAe,CAAC,iCAAiC,CAAC,QAAQ,CAAC,0BAA0B,CAAC,gBAAgB,CAAC,kCAAkC,CAAC,WAAW,CAAC,6BAA6B,CAAC,gBAAgB,CAAC,kCAAkC,CAAC,eAAe,CAAC,iCAAiC,CAAC,gBAAgB,CAAC,kCAAkC,CAAC,eAAe,CAAC,iCAAiC,CAAC,gBAAgB,CAAC,kCAAkC,CAAC;;;;"}
|
|
@@ -4,10 +4,7 @@ export declare const TitleMobile: React.ForwardRefExoticComponent<Omit<React.HTM
|
|
|
4
4
|
view?: "xlarge" | "large" | "medium" | "small" | "xsmall";
|
|
5
5
|
color?: import("..").Color;
|
|
6
6
|
weight?: "regular" | "medium" | "bold" | "semibold";
|
|
7
|
-
font?: "styrene" | "system"
|
|
8
|
-
font: "alfasans";
|
|
9
|
-
systemCompat: boolean;
|
|
10
|
-
};
|
|
7
|
+
font?: "styrene" | "system";
|
|
11
8
|
defaultMargins?: boolean;
|
|
12
9
|
className?: string;
|
|
13
10
|
dataTestId?: string;
|
|
@@ -5,129 +5,112 @@
|
|
|
5
5
|
--gap-40: 40px;
|
|
6
6
|
}
|
|
7
7
|
:root {
|
|
8
|
-
--font-family-
|
|
9
|
-
system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue',
|
|
10
|
-
|
|
11
|
-
'Styrene UI', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Helvetica,
|
|
12
|
-
sans-serif;
|
|
8
|
+
--font-family-alfasans:
|
|
9
|
+
'Alfa Interface Sans', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue',
|
|
10
|
+
Helvetica, sans-serif;
|
|
13
11
|
}
|
|
14
|
-
.
|
|
12
|
+
.typography__xlarge_4wmck {
|
|
15
13
|
font-size: 34px;
|
|
16
14
|
line-height: 40px;
|
|
17
|
-
font-weight:
|
|
18
|
-
|
|
15
|
+
font-weight: 500;
|
|
16
|
+
letter-spacing: -0.32px;
|
|
17
|
+
font-family: var(--font-family-alfasans);
|
|
19
18
|
}
|
|
20
|
-
.
|
|
21
|
-
font-weight: 500;
|
|
22
|
-
font-feature-settings: 'ss01';
|
|
23
|
-
font-family: var(--font-family-styrene);
|
|
19
|
+
.typography__xlarge_4wmck.typography__font_4wmck {
|
|
24
20
|
}
|
|
25
|
-
.typography__regular-
|
|
21
|
+
.typography__regular-xlarge_4wmck {
|
|
26
22
|
font-size: 34px;
|
|
27
23
|
line-height: 40px;
|
|
28
24
|
font-weight: 400;
|
|
29
|
-
|
|
25
|
+
letter-spacing: -1.36px;
|
|
26
|
+
font-family: var(--font-family-alfasans);
|
|
30
27
|
}
|
|
31
|
-
.typography__regular-
|
|
32
|
-
font-feature-settings: 'ss01';
|
|
33
|
-
font-family: var(--font-family-styrene);
|
|
28
|
+
.typography__regular-xlarge_4wmck.typography__system_4wmck {
|
|
34
29
|
}
|
|
35
|
-
.
|
|
30
|
+
.typography__large_4wmck {
|
|
36
31
|
font-size: 30px;
|
|
37
32
|
line-height: 36px;
|
|
38
|
-
font-weight:
|
|
39
|
-
|
|
33
|
+
font-weight: 500;
|
|
34
|
+
letter-spacing: -0.25px;
|
|
35
|
+
font-family: var(--font-family-alfasans);
|
|
40
36
|
}
|
|
41
|
-
.
|
|
42
|
-
font-weight: 500;
|
|
43
|
-
font-feature-settings: 'ss01';
|
|
44
|
-
font-family: var(--font-family-styrene);
|
|
37
|
+
.typography__large_4wmck.typography__font_4wmck {
|
|
45
38
|
}
|
|
46
|
-
.typography__regular-
|
|
39
|
+
.typography__regular-large_4wmck {
|
|
47
40
|
font-size: 30px;
|
|
48
41
|
line-height: 36px;
|
|
49
42
|
font-weight: 400;
|
|
50
|
-
|
|
43
|
+
letter-spacing: -1.25px;
|
|
44
|
+
font-family: var(--font-family-alfasans);
|
|
51
45
|
}
|
|
52
|
-
.typography__regular-
|
|
53
|
-
font-feature-settings: 'ss01';
|
|
54
|
-
font-family: var(--font-family-styrene);
|
|
46
|
+
.typography__regular-large_4wmck.typography__system_4wmck {
|
|
55
47
|
}
|
|
56
|
-
.
|
|
48
|
+
.typography__medium_4wmck {
|
|
57
49
|
font-size: 26px;
|
|
58
50
|
line-height: 32px;
|
|
59
|
-
font-weight:
|
|
60
|
-
|
|
51
|
+
font-weight: 500;
|
|
52
|
+
letter-spacing: -0.25px;
|
|
53
|
+
font-family: var(--font-family-alfasans);
|
|
61
54
|
}
|
|
62
|
-
.
|
|
63
|
-
font-weight: 500;
|
|
64
|
-
font-feature-settings: 'ss01';
|
|
65
|
-
font-family: var(--font-family-styrene);
|
|
55
|
+
.typography__medium_4wmck.typography__font_4wmck {
|
|
66
56
|
}
|
|
67
|
-
.typography__regular-
|
|
57
|
+
.typography__regular-medium_4wmck {
|
|
68
58
|
font-size: 26px;
|
|
69
59
|
line-height: 32px;
|
|
70
60
|
font-weight: 400;
|
|
71
|
-
|
|
61
|
+
letter-spacing: -1px;
|
|
62
|
+
font-family: var(--font-family-alfasans);
|
|
72
63
|
}
|
|
73
|
-
.typography__regular-
|
|
74
|
-
font-feature-settings: 'ss01';
|
|
75
|
-
font-family: var(--font-family-styrene);
|
|
64
|
+
.typography__regular-medium_4wmck.typography__system_4wmck {
|
|
76
65
|
}
|
|
77
|
-
.
|
|
66
|
+
.typography__small_4wmck {
|
|
78
67
|
font-size: 20px;
|
|
79
68
|
line-height: 28px;
|
|
80
|
-
font-weight:
|
|
81
|
-
|
|
69
|
+
font-weight: 500;
|
|
70
|
+
letter-spacing: -0.15px;
|
|
71
|
+
font-family: var(--font-family-alfasans);
|
|
82
72
|
}
|
|
83
|
-
.
|
|
84
|
-
font-weight: 500;
|
|
85
|
-
font-feature-settings: 'ss01';
|
|
86
|
-
font-family: var(--font-family-styrene);
|
|
73
|
+
.typography__small_4wmck.typography__font_4wmck {
|
|
87
74
|
}
|
|
88
|
-
.typography__regular-
|
|
75
|
+
.typography__regular-small_4wmck {
|
|
89
76
|
font-size: 20px;
|
|
90
77
|
line-height: 28px;
|
|
91
78
|
font-weight: 400;
|
|
92
|
-
|
|
79
|
+
letter-spacing: -0.68px;
|
|
80
|
+
font-family: var(--font-family-alfasans);
|
|
93
81
|
}
|
|
94
|
-
.typography__regular-
|
|
95
|
-
font-feature-settings: 'ss01';
|
|
96
|
-
font-family: var(--font-family-styrene);
|
|
82
|
+
.typography__regular-small_4wmck.typography__system_4wmck {
|
|
97
83
|
}
|
|
98
|
-
.
|
|
84
|
+
.typography__xsmall_4wmck {
|
|
99
85
|
font-size: 16px;
|
|
100
86
|
line-height: 20px;
|
|
101
|
-
font-weight:
|
|
102
|
-
|
|
87
|
+
font-weight: 500;
|
|
88
|
+
letter-spacing: 0.17px;
|
|
89
|
+
font-family: var(--font-family-alfasans);
|
|
103
90
|
}
|
|
104
|
-
.
|
|
105
|
-
font-weight: 500;
|
|
106
|
-
font-feature-settings: 'ss01';
|
|
107
|
-
font-family: var(--font-family-styrene);
|
|
91
|
+
.typography__xsmall_4wmck.typography__font_4wmck {
|
|
108
92
|
}
|
|
109
|
-
.typography__regular-
|
|
93
|
+
.typography__regular-xsmall_4wmck {
|
|
110
94
|
font-size: 16px;
|
|
111
95
|
line-height: 20px;
|
|
112
96
|
font-weight: 400;
|
|
113
|
-
|
|
97
|
+
letter-spacing: -0.24px;
|
|
98
|
+
font-family: var(--font-family-alfasans);
|
|
114
99
|
}
|
|
115
|
-
.typography__regular-
|
|
116
|
-
font-feature-settings: 'ss01';
|
|
117
|
-
font-family: var(--font-family-styrene);
|
|
100
|
+
.typography__regular-xsmall_4wmck.typography__system_4wmck {
|
|
118
101
|
}
|
|
119
|
-
.
|
|
102
|
+
.typography__component_4wmck.typography__margins-xlarge_4wmck {
|
|
120
103
|
margin: var(--gap-0) var(--gap-0) var(--gap-24);
|
|
121
104
|
}
|
|
122
|
-
.
|
|
105
|
+
.typography__component_4wmck.typography__margins-large_4wmck {
|
|
123
106
|
margin: var(--gap-40) var(--gap-0) var(--gap-16);
|
|
124
107
|
}
|
|
125
|
-
.
|
|
108
|
+
.typography__component_4wmck.typography__margins-medium_4wmck {
|
|
126
109
|
margin: var(--gap-40) var(--gap-0) var(--gap-16);
|
|
127
110
|
}
|
|
128
|
-
.
|
|
111
|
+
.typography__component_4wmck.typography__margins-small_4wmck {
|
|
129
112
|
margin: var(--gap-40) var(--gap-0) var(--gap-16);
|
|
130
113
|
}
|
|
131
|
-
.
|
|
114
|
+
.typography__component_4wmck .typography__margins-xsmall_4wmck {
|
|
132
115
|
margin: var(--gap-40) var(--gap-0) var(--gap-16);
|
|
133
116
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './index.css';
|
|
2
2
|
|
|
3
|
-
const styles = {"xlarge":"
|
|
3
|
+
const styles = {"xlarge":"typography__xlarge_4wmck","font":"typography__font_4wmck","regular-xlarge":"typography__regular-xlarge_4wmck","system":"typography__system_4wmck","large":"typography__large_4wmck","regular-large":"typography__regular-large_4wmck","medium":"typography__medium_4wmck","regular-medium":"typography__regular-medium_4wmck","small":"typography__small_4wmck","regular-small":"typography__regular-small_4wmck","xsmall":"typography__xsmall_4wmck","regular-xsmall":"typography__regular-xsmall_4wmck","component":"typography__component_4wmck","margins-xlarge":"typography__margins-xlarge_4wmck","margins-large":"typography__margins-large_4wmck","margins-medium":"typography__margins-medium_4wmck","margins-small":"typography__margins-small_4wmck","margins-xsmall":"typography__margins-xsmall_4wmck"};
|
|
4
4
|
|
|
5
5
|
export { styles as default };
|
|
6
6
|
//# sourceMappingURL=index.module.css.js.map
|
|
@@ -16,10 +16,7 @@ export declare const TitleResponsive: React.ForwardRefExoticComponent<Omit<React
|
|
|
16
16
|
view?: "xlarge" | "large" | "medium" | "small" | "xsmall";
|
|
17
17
|
color?: import("..").Color;
|
|
18
18
|
weight?: "regular" | "medium" | "bold" | "semibold";
|
|
19
|
-
font?: "styrene" | "system"
|
|
20
|
-
font: "alfasans";
|
|
21
|
-
systemCompat: boolean;
|
|
22
|
-
};
|
|
19
|
+
font?: "styrene" | "system";
|
|
23
20
|
defaultMargins?: boolean;
|
|
24
21
|
className?: string;
|
|
25
22
|
dataTestId?: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { forwardRef } from 'react';
|
|
1
|
+
import React, { forwardRef, Fragment } from 'react';
|
|
2
2
|
import mergeRefs from 'react-merge-refs';
|
|
3
3
|
import cn from 'classnames';
|
|
4
4
|
import { useSkeleton } from '@alfalab/core-components-skeleton/moderncssm';
|
|
@@ -7,22 +7,24 @@ import styles from './index.module.css';
|
|
|
7
7
|
|
|
8
8
|
const Text = forwardRef(({ view = 'primary-medium', tag: Component = 'span', weight, monospaceNumbers = false, defaultMargins = true, color, className, dataTestId, children, rowLimit, showSkeleton, skeletonProps, font, ...restProps }, ref) => {
|
|
9
9
|
const { renderSkeleton, textRef } = useSkeleton(showSkeleton, skeletonProps);
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
[styles
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
10
|
+
const Root = showSkeleton ? 'div' : Fragment;
|
|
11
|
+
const rootProps = showSkeleton
|
|
12
|
+
? { className: cn(styles.root, className) }
|
|
13
|
+
: {};
|
|
14
|
+
return (React.createElement(Root, { ...rootProps },
|
|
15
|
+
React.createElement(Component, { className: cn({
|
|
16
|
+
[styles.paragraph]: Component === 'p' && !defaultMargins,
|
|
17
|
+
[styles.paragraphWithMargins]: Component === 'p' && defaultMargins,
|
|
18
|
+
[styles.monospace]: monospaceNumbers,
|
|
19
|
+
[styles[`rowLimit${rowLimit}`]]: rowLimit,
|
|
20
|
+
[styles.transparent]: showSkeleton,
|
|
21
|
+
}, !showSkeleton && className, color && colors[color], styles[view], weight && styles[weight]), "data-test-id": dataTestId, ref: mergeRefs([ref, textRef]), ...restProps }, children),
|
|
22
|
+
showSkeleton && (React.createElement("div", { className: styles.skeleton }, renderSkeleton({
|
|
23
|
+
wrapperClassName: cn({
|
|
24
|
+
[styles.paragraphWithMargins]: Component === 'p' && defaultMargins,
|
|
25
|
+
}),
|
|
26
|
+
dataTestId,
|
|
27
|
+
})))));
|
|
26
28
|
});
|
|
27
29
|
|
|
28
30
|
export { Text };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sources":["../../src/text/component.tsx"],"sourcesContent":["import React, { forwardRef, type HTMLAttributes } from 'react';\nimport mergeRefs from 'react-merge-refs';\nimport cn from 'classnames';\n\nimport { type TextSkeletonProps, useSkeleton } from '@alfalab/core-components-skeleton';\n\nimport { type Color } from '../colors';\nimport { type TextElementType } from '../types';\n\nimport colors from '../colors.module.css';\nimport styles from './index.module.css';\n\ntype NativeProps = HTMLAttributes<HTMLSpanElement>;\n\ntype TextBaseProps = {\n /**\n * [Вариант начертания](https://core-ds.github.io/core-components/master/?path=/docs/tokens-assets-типографика--docs)\n */\n view?:\n | 'primary-large'\n | 'primary-medium'\n | 'primary-small'\n | 'secondary-large'\n | 'secondary-medium'\n | 'secondary-small'\n | 'component-primary'\n | 'component-secondary'\n | 'caps'\n | 'tagline';\n\n /**\n * Цвет текста\n */\n color?: Color;\n\n /**\n * Толщина шрифта\n */\n weight?: 'regular' | 'medium' | 'bold';\n\n /**\n * Делает цифры моноширинными\n */\n monospaceNumbers?: boolean;\n\n /**\n * HTML тег\n */\n tag?: 'span' | 'div';\n\n /**\n * Css-класс для стилизации (native prop)\n */\n className?: string;\n\n /**\n * Id компонента для тестов\n */\n dataTestId?: string;\n\n /**\n * Контент (native prop)\n */\n children?: React.ReactNode;\n\n /**\n * Добавляет отступы к тэгу 'p'\n */\n defaultMargins?: never;\n\n /**\n * Количество строк\n */\n rowLimit?: 1 | 2 | 3;\n\n /**\n * Показать скелетон\n */\n showSkeleton?: boolean;\n\n /**\n * Пропы для скелетона\n */\n skeletonProps?: TextSkeletonProps;\n\n /**\n * Шрифт текста\n *\n * @deprecated\n */\n font?: 'alfasans' | undefined | null;\n};\n\ntype TextPTagProps = Omit<TextBaseProps, 'tag' | 'defaultMargins'> & {\n tag?: 'p';\n defaultMargins?: boolean;\n};\n\nexport type TextProps = Omit<NativeProps, 'color'> & (TextBaseProps | TextPTagProps);\n\nexport const Text = forwardRef<TextElementType, TextProps>(\n (\n {\n view = 'primary-medium',\n tag: Component = 'span',\n weight,\n monospaceNumbers = false,\n defaultMargins = true,\n color,\n className,\n dataTestId,\n children,\n rowLimit,\n showSkeleton,\n skeletonProps,\n font,\n ...restProps\n },\n ref,\n ) => {\n const { renderSkeleton, textRef } = useSkeleton(showSkeleton, skeletonProps);\n
|
|
1
|
+
{"version":3,"file":"component.js","sources":["../../src/text/component.tsx"],"sourcesContent":["import React, { type ComponentProps, forwardRef, Fragment, type HTMLAttributes } from 'react';\nimport mergeRefs from 'react-merge-refs';\nimport cn from 'classnames';\n\nimport { type TextSkeletonProps, useSkeleton } from '@alfalab/core-components-skeleton';\n\nimport { type Color } from '../colors';\nimport { type TextElementType } from '../types';\n\nimport colors from '../colors.module.css';\nimport styles from './index.module.css';\n\ntype NativeProps = HTMLAttributes<HTMLSpanElement>;\n\ntype TextBaseProps = {\n /**\n * [Вариант начертания](https://core-ds.github.io/core-components/master/?path=/docs/tokens-assets-типографика--docs)\n */\n view?:\n | 'primary-large'\n | 'primary-medium'\n | 'primary-small'\n | 'secondary-large'\n | 'secondary-medium'\n | 'secondary-small'\n | 'component-primary'\n | 'component-secondary'\n | 'caps'\n | 'tagline';\n\n /**\n * Цвет текста\n */\n color?: Color;\n\n /**\n * Толщина шрифта\n */\n weight?: 'regular' | 'medium' | 'bold';\n\n /**\n * Делает цифры моноширинными\n */\n monospaceNumbers?: boolean;\n\n /**\n * HTML тег\n */\n tag?: 'span' | 'div';\n\n /**\n * Css-класс для стилизации (native prop)\n */\n className?: string;\n\n /**\n * Id компонента для тестов\n */\n dataTestId?: string;\n\n /**\n * Контент (native prop)\n */\n children?: React.ReactNode;\n\n /**\n * Добавляет отступы к тэгу 'p'\n */\n defaultMargins?: never;\n\n /**\n * Количество строк\n */\n rowLimit?: 1 | 2 | 3;\n\n /**\n * Показать скелетон\n */\n showSkeleton?: boolean;\n\n /**\n * Пропы для скелетона\n */\n skeletonProps?: TextSkeletonProps;\n\n /**\n * Шрифт текста\n *\n * @deprecated\n */\n font?: 'alfasans' | undefined | null;\n};\n\ntype TextPTagProps = Omit<TextBaseProps, 'tag' | 'defaultMargins'> & {\n tag?: 'p';\n defaultMargins?: boolean;\n};\n\nexport type TextProps = Omit<NativeProps, 'color'> & (TextBaseProps | TextPTagProps);\n\nexport const Text = forwardRef<TextElementType, TextProps>(\n (\n {\n view = 'primary-medium',\n tag: Component = 'span',\n weight,\n monospaceNumbers = false,\n defaultMargins = true,\n color,\n className,\n dataTestId,\n children,\n rowLimit,\n showSkeleton,\n skeletonProps,\n font,\n ...restProps\n },\n ref,\n ) => {\n const { renderSkeleton, textRef } = useSkeleton(showSkeleton, skeletonProps);\n const Root = showSkeleton ? 'div' : Fragment;\n const rootProps: ComponentProps<typeof Root> = showSkeleton\n ? { className: cn(styles.root, className) }\n : {};\n\n return (\n <Root {...rootProps}>\n <Component\n className={cn(\n {\n [styles.paragraph]: Component === 'p' && !defaultMargins,\n [styles.paragraphWithMargins]: Component === 'p' && defaultMargins,\n [styles.monospace]: monospaceNumbers,\n [styles[`rowLimit${rowLimit}`]]: rowLimit,\n [styles.transparent]: showSkeleton,\n },\n !showSkeleton && className,\n color && colors[color],\n styles[view],\n weight && styles[weight],\n )}\n data-test-id={dataTestId}\n ref={mergeRefs([ref, textRef])}\n {...restProps}\n >\n {children}\n </Component>\n {showSkeleton && (\n <div className={styles.skeleton}>\n {renderSkeleton({\n wrapperClassName: cn({\n [styles.paragraphWithMargins]: Component === 'p' && defaultMargins,\n }),\n dataTestId,\n })}\n </div>\n )}\n </Root>\n );\n },\n);\n"],"names":[],"mappings":";;;;;;;MAoGa,IAAI,GAAG,UAAU,CAC1B,CACI,EACI,IAAI,GAAG,gBAAgB,EACvB,GAAG,EAAE,SAAS,GAAG,MAAM,EACvB,MAAM,EACN,gBAAgB,GAAG,KAAK,EACxB,cAAc,GAAG,IAAI,EACrB,KAAK,EACL,SAAS,EACT,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,IAAI,EACJ,GAAG,SAAS,EACf,EACD,GAAG,KACH;AACA,IAAA,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,GAAG,WAAW,CAAC,YAAY,EAAE,aAAa,CAAC;IAC5E,MAAM,IAAI,GAAG,YAAY,GAAG,KAAK,GAAG,QAAQ;IAC5C,MAAM,SAAS,GAAgC;AAC3C,UAAE,EAAE,SAAS,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC;UACvC,EAAE;AAER,IAAA,QACI,KAAA,CAAA,aAAA,CAAC,IAAI,EAAA,EAAA,GAAK,SAAS,EAAA;AACf,QAAA,KAAA,CAAA,aAAA,CAAC,SAAS,EAAA,EACN,SAAS,EAAE,EAAE,CACT;gBACI,CAAC,MAAM,CAAC,SAAS,GAAG,SAAS,KAAK,GAAG,IAAI,CAAC,cAAc;gBACxD,CAAC,MAAM,CAAC,oBAAoB,GAAG,SAAS,KAAK,GAAG,IAAI,cAAc;AAClE,gBAAA,CAAC,MAAM,CAAC,SAAS,GAAG,gBAAgB;gBACpC,CAAC,MAAM,CAAC,CAAW,QAAA,EAAA,QAAQ,EAAE,CAAC,GAAG,QAAQ;AACzC,gBAAA,CAAC,MAAM,CAAC,WAAW,GAAG,YAAY;AACrC,aAAA,EACD,CAAC,YAAY,IAAI,SAAS,EAC1B,KAAK,IAAI,MAAM,CAAC,KAAK,CAAC,EACtB,MAAM,CAAC,IAAI,CAAC,EACZ,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,CAC3B,EAAA,cAAA,EACa,UAAU,EACxB,GAAG,EAAE,SAAS,CAAC,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,KAC1B,SAAS,EAAA,EAEZ,QAAQ,CACD;QACX,YAAY,KACT,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,MAAM,CAAC,QAAQ,EAC1B,EAAA,cAAc,CAAC;YACZ,gBAAgB,EAAE,EAAE,CAAC;gBACjB,CAAC,MAAM,CAAC,oBAAoB,GAAG,SAAS,KAAK,GAAG,IAAI,cAAc;aACrE,CAAC;YACF,UAAU;AACb,SAAA,CAAC,CACA,CACT,CACE;AAEf,CAAC;;;;"}
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
.transparent {
|
|
2
|
-
|
|
2
|
+
visibility: hidden;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.skeleton {
|
|
6
|
+
position: absolute;
|
|
7
|
+
inset: 0;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.root {
|
|
11
|
+
position: relative;
|
|
3
12
|
}
|
|
4
13
|
|
|
5
14
|
:root {
|
|
@@ -20,15 +29,18 @@
|
|
|
20
29
|
font-size: 16px;
|
|
21
30
|
line-height: 20px;
|
|
22
31
|
font-weight: 400;
|
|
23
|
-
|
|
32
|
+
letter-spacing: -0.24px;
|
|
33
|
+
font-family: var(--font-family-alfasans);
|
|
24
34
|
}
|
|
25
35
|
|
|
26
36
|
.component.bold {
|
|
27
37
|
font-weight: 700;
|
|
38
|
+
letter-spacing: 0.43px;
|
|
28
39
|
}
|
|
29
40
|
|
|
30
41
|
.component.medium {
|
|
31
42
|
font-weight: 500;
|
|
43
|
+
letter-spacing: -0.05px;
|
|
32
44
|
}
|
|
33
45
|
|
|
34
46
|
.caps {
|
|
@@ -37,7 +49,7 @@
|
|
|
37
49
|
font-weight: 400;
|
|
38
50
|
letter-spacing: 1.25px;
|
|
39
51
|
text-transform: uppercase;
|
|
40
|
-
font-family: var(--font-family-
|
|
52
|
+
font-family: var(--font-family-alfasans);
|
|
41
53
|
}
|
|
42
54
|
|
|
43
55
|
.caps.bold {
|
|
@@ -54,7 +66,7 @@
|
|
|
54
66
|
font-weight: 400;
|
|
55
67
|
letter-spacing: 1.25px;
|
|
56
68
|
text-transform: uppercase;
|
|
57
|
-
font-family: var(--font-family-
|
|
69
|
+
font-family: var(--font-family-alfasans);
|
|
58
70
|
}
|
|
59
71
|
|
|
60
72
|
.tagline.bold {
|
|
@@ -69,120 +81,143 @@
|
|
|
69
81
|
font-size: 18px;
|
|
70
82
|
line-height: 24px;
|
|
71
83
|
font-weight: 400;
|
|
72
|
-
|
|
84
|
+
letter-spacing: -0.36px;
|
|
85
|
+
font-family: var(--font-family-alfasans);
|
|
73
86
|
}
|
|
74
87
|
|
|
75
88
|
.primary-large.bold {
|
|
76
89
|
font-weight: 700;
|
|
90
|
+
letter-spacing: 0.38px;
|
|
77
91
|
}
|
|
78
92
|
|
|
79
93
|
.primary-large.medium {
|
|
80
94
|
font-weight: 500;
|
|
95
|
+
letter-spacing: -0.17px;
|
|
81
96
|
}
|
|
82
97
|
|
|
83
98
|
.primary-medium {
|
|
84
99
|
font-size: 16px;
|
|
85
100
|
line-height: 24px;
|
|
86
101
|
font-weight: 400;
|
|
87
|
-
|
|
102
|
+
letter-spacing: -0.24px;
|
|
103
|
+
font-family: var(--font-family-alfasans);
|
|
88
104
|
}
|
|
89
105
|
|
|
90
106
|
.primary-medium.bold {
|
|
91
107
|
font-weight: 700;
|
|
108
|
+
letter-spacing: 0.43px;
|
|
92
109
|
}
|
|
93
110
|
|
|
94
111
|
.primary-medium.medium {
|
|
95
112
|
font-weight: 500;
|
|
113
|
+
letter-spacing: -0.05px;
|
|
96
114
|
}
|
|
97
115
|
|
|
98
116
|
.primary-small {
|
|
99
117
|
font-size: 14px;
|
|
100
118
|
line-height: 20px;
|
|
101
119
|
font-weight: 400;
|
|
102
|
-
|
|
120
|
+
letter-spacing: -0.08px;
|
|
121
|
+
font-family: var(--font-family-alfasans);
|
|
103
122
|
}
|
|
104
123
|
|
|
105
124
|
.primary-small.bold {
|
|
106
125
|
font-weight: 700;
|
|
126
|
+
letter-spacing: 0.47px;
|
|
107
127
|
}
|
|
108
128
|
|
|
109
129
|
.primary-small.medium {
|
|
110
130
|
font-weight: 500;
|
|
131
|
+
letter-spacing: 0.07px;
|
|
111
132
|
}
|
|
112
133
|
|
|
113
134
|
.component-primary {
|
|
114
135
|
font-size: 16px;
|
|
115
136
|
line-height: 20px;
|
|
116
137
|
font-weight: 400;
|
|
117
|
-
|
|
138
|
+
letter-spacing: -0.24px;
|
|
139
|
+
font-family: var(--font-family-alfasans);
|
|
118
140
|
}
|
|
119
141
|
|
|
120
142
|
.component-primary.bold {
|
|
121
143
|
font-weight: 700;
|
|
144
|
+
letter-spacing: 0.43px;
|
|
122
145
|
}
|
|
123
146
|
|
|
124
147
|
.component-primary.medium {
|
|
125
148
|
font-weight: 500;
|
|
149
|
+
letter-spacing: -0.05px;
|
|
126
150
|
}
|
|
127
151
|
|
|
128
152
|
.secondary-large {
|
|
129
153
|
font-size: 13px;
|
|
130
154
|
line-height: 16px;
|
|
131
155
|
font-weight: 400;
|
|
132
|
-
font-family: var(--font-family-
|
|
156
|
+
font-family: var(--font-family-alfasans);
|
|
133
157
|
}
|
|
134
158
|
|
|
135
159
|
.secondary-large.bold {
|
|
136
160
|
font-weight: 700;
|
|
161
|
+
letter-spacing: 0.54px;
|
|
137
162
|
}
|
|
138
163
|
|
|
139
164
|
.secondary-large.medium {
|
|
140
165
|
font-weight: 500;
|
|
166
|
+
letter-spacing: 0.13px;
|
|
141
167
|
}
|
|
142
168
|
|
|
143
169
|
.secondary-medium {
|
|
144
170
|
font-size: 12px;
|
|
145
171
|
line-height: 16px;
|
|
146
172
|
font-weight: 400;
|
|
147
|
-
|
|
173
|
+
letter-spacing: 0.06px;
|
|
174
|
+
font-family: var(--font-family-alfasans);
|
|
148
175
|
}
|
|
149
176
|
|
|
150
177
|
.secondary-medium.bold {
|
|
151
178
|
font-weight: 700;
|
|
179
|
+
letter-spacing: 0.57px;
|
|
152
180
|
}
|
|
153
181
|
|
|
154
182
|
.secondary-medium.medium {
|
|
155
183
|
font-weight: 500;
|
|
184
|
+
letter-spacing: 0.19px;
|
|
156
185
|
}
|
|
157
186
|
|
|
158
187
|
.secondary-small {
|
|
159
188
|
font-size: 11px;
|
|
160
189
|
line-height: 16px;
|
|
161
190
|
font-weight: 400;
|
|
162
|
-
|
|
191
|
+
letter-spacing: 0.15px;
|
|
192
|
+
font-family: var(--font-family-alfasans);
|
|
163
193
|
}
|
|
164
194
|
|
|
165
195
|
.secondary-small.bold {
|
|
166
196
|
font-weight: 700;
|
|
197
|
+
letter-spacing: 0.54px;
|
|
167
198
|
}
|
|
168
199
|
|
|
169
200
|
.secondary-small.medium {
|
|
170
201
|
font-weight: 500;
|
|
202
|
+
letter-spacing: 0.24px;
|
|
171
203
|
}
|
|
172
204
|
|
|
173
205
|
.component-secondary {
|
|
174
206
|
font-size: 14px;
|
|
175
207
|
line-height: 18px;
|
|
176
208
|
font-weight: 400;
|
|
177
|
-
|
|
209
|
+
letter-spacing: -0.08px;
|
|
210
|
+
font-family: var(--font-family-alfasans);
|
|
178
211
|
}
|
|
179
212
|
|
|
180
213
|
.component-secondary.bold {
|
|
181
214
|
font-weight: 700;
|
|
215
|
+
letter-spacing: 0.47px;
|
|
182
216
|
}
|
|
183
217
|
|
|
184
218
|
.component-secondary.medium {
|
|
185
219
|
font-weight: 500;
|
|
220
|
+
letter-spacing: 0.07px;
|
|
186
221
|
}
|
|
187
222
|
|
|
188
223
|
.rowLimit1 {
|
|
@@ -22,10 +22,7 @@ export type TitleProps = Omit<NativeProps, 'color'> & {
|
|
|
22
22
|
/**
|
|
23
23
|
* Шрифт текста
|
|
24
24
|
*/
|
|
25
|
-
font?: 'styrene' | 'system'
|
|
26
|
-
font: 'alfasans';
|
|
27
|
-
systemCompat: boolean;
|
|
28
|
-
};
|
|
25
|
+
font?: 'styrene' | 'system';
|
|
29
26
|
/**
|
|
30
27
|
* Добавляет отступы
|
|
31
28
|
*/
|
|
@@ -86,10 +83,7 @@ export declare const TitleBase: React.ForwardRefExoticComponent<Omit<NativeProps
|
|
|
86
83
|
/**
|
|
87
84
|
* Шрифт текста
|
|
88
85
|
*/
|
|
89
|
-
font?: "styrene" | "system"
|
|
90
|
-
font: "alfasans";
|
|
91
|
-
systemCompat: boolean;
|
|
92
|
-
};
|
|
86
|
+
font?: "styrene" | "system";
|
|
93
87
|
/**
|
|
94
88
|
* Добавляет отступы
|
|
95
89
|
*/
|
|
@@ -1,26 +1,25 @@
|
|
|
1
|
-
import React, { forwardRef } from 'react';
|
|
1
|
+
import React, { forwardRef, Fragment } from 'react';
|
|
2
2
|
import mergeRefs from 'react-merge-refs';
|
|
3
3
|
import cn from 'classnames';
|
|
4
|
-
import { isObject } from '@alfalab/core-components-shared/moderncssm';
|
|
5
4
|
import { useSkeleton } from '@alfalab/core-components-skeleton/moderncssm';
|
|
6
|
-
import { getDefaultWeight } from './utils.js';
|
|
7
5
|
import colors from '../colors.module.css';
|
|
8
6
|
import commonStyles from './common.module.css';
|
|
9
7
|
|
|
10
|
-
const TitleBase = forwardRef(({ tag: Component = 'div', view = 'medium', font
|
|
8
|
+
const TitleBase = forwardRef(({ tag: Component = 'div', view = 'medium', font, platform, weight = 'bold', defaultMargins = false, color, className, dataTestId, children, rowLimit, styles, skeletonProps, showSkeleton, ...restProps }, ref) => {
|
|
11
9
|
const { renderSkeleton, textRef } = useSkeleton(showSkeleton, skeletonProps);
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
10
|
+
const Root = showSkeleton ? 'div' : Fragment;
|
|
11
|
+
const rootProps = showSkeleton
|
|
12
|
+
? { className: cn(commonStyles.root, className) }
|
|
13
|
+
: {};
|
|
14
|
+
return (React.createElement(Root, { ...rootProps },
|
|
15
|
+
React.createElement(Component, { className: cn(commonStyles.component, styles.component, !showSkeleton && className, styles[`${weight === 'regular' ? 'regular-' : ''}${view}`], defaultMargins && styles[`margins-${view}`], color && colors[color], {
|
|
16
|
+
[commonStyles[`rowLimit${rowLimit}`]]: rowLimit,
|
|
17
|
+
[commonStyles.transparent]: showSkeleton,
|
|
18
|
+
}), "data-test-id": dataTestId, ref: mergeRefs([ref, textRef]), ...restProps }, children),
|
|
19
|
+
showSkeleton && (React.createElement("div", { className: commonStyles.skeleton }, renderSkeleton({
|
|
20
|
+
wrapperClassName: cn(defaultMargins && styles[`margins-${view}`]),
|
|
21
|
+
dataTestId,
|
|
22
|
+
})))));
|
|
24
23
|
});
|
|
25
24
|
|
|
26
25
|
export { TitleBase };
|