@alfalab/core-components-typography 6.0.9-alfasans → 6.0.9
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/index.module.css +13 -40
- package/cssm/title/component.d.ts +8 -2
- package/cssm/title/component.js +6 -3
- package/cssm/title/component.js.map +1 -1
- package/cssm/title/index.d.ts +4 -1
- package/cssm/title/index.module.css +74 -23
- package/cssm/title/utils.d.ts +1 -0
- package/cssm/title/utils.js +16 -0
- package/cssm/title/utils.js.map +1 -0
- package/cssm/title-mobile/component.d.ts +4 -1
- package/cssm/title-mobile/index.module.css +45 -28
- package/cssm/title-responsive/component.d.ts +4 -1
- package/esm/colors.css +20 -20
- package/esm/colors.module.css.js +1 -1
- package/esm/text/index.css +53 -80
- package/esm/text/index.module.css.js +1 -1
- package/esm/title/common.css +5 -5
- package/esm/title/common.module.css.js +1 -1
- package/esm/title/component.d.ts +8 -2
- package/esm/title/component.js +5 -2
- package/esm/title/component.js.map +1 -1
- package/esm/title/index.css +89 -38
- package/esm/title/index.d.ts +4 -1
- package/esm/title/index.module.css.js +1 -1
- package/esm/title/index.module.css.js.map +1 -1
- package/esm/title/utils.d.ts +1 -0
- package/esm/title/utils.js +12 -0
- package/esm/title/utils.js.map +1 -0
- package/esm/title-mobile/component.d.ts +4 -1
- package/esm/title-mobile/index.css +70 -53
- package/esm/title-mobile/index.module.css.js +1 -1
- package/esm/title-responsive/component.d.ts +4 -1
- package/modern/colors.css +20 -20
- package/modern/colors.module.css.js +1 -1
- package/modern/text/index.css +53 -80
- package/modern/text/index.module.css.js +1 -1
- package/modern/title/common.css +5 -5
- package/modern/title/common.module.css.js +1 -1
- package/modern/title/component.d.ts +8 -2
- package/modern/title/component.js +4 -1
- package/modern/title/component.js.map +1 -1
- package/modern/title/index.css +89 -38
- package/modern/title/index.d.ts +4 -1
- package/modern/title/index.module.css.js +1 -1
- package/modern/title/index.module.css.js.map +1 -1
- package/modern/title/utils.d.ts +1 -0
- package/modern/title/utils.js +12 -0
- package/modern/title/utils.js.map +1 -0
- package/modern/title-mobile/component.d.ts +4 -1
- package/modern/title-mobile/index.css +70 -53
- package/modern/title-mobile/index.module.css.js +1 -1
- package/modern/title-responsive/component.d.ts +4 -1
- package/moderncssm/text/index.module.css +11 -37
- package/moderncssm/title/component.d.ts +8 -2
- package/moderncssm/title/component.js +4 -1
- package/moderncssm/title/component.js.map +1 -1
- package/moderncssm/title/index.d.ts +4 -1
- package/moderncssm/title/index.module.css +79 -20
- package/moderncssm/title/utils.d.ts +1 -0
- package/moderncssm/title/utils.js +12 -0
- package/moderncssm/title/utils.js.map +1 -0
- package/moderncssm/title-mobile/component.d.ts +4 -1
- package/moderncssm/title-mobile/index.module.css +40 -25
- package/moderncssm/title-responsive/component.d.ts +4 -1
- package/package.json +6 -6
- package/src/title/component.tsx +8 -3
- package/src/title/index.module.css +8 -0
- package/src/title/utils.ts +14 -0
- package/text/index.css +53 -80
- package/text/index.module.css.js +1 -1
- package/title/common.css +5 -5
- package/title/common.module.css.js +1 -1
- package/title/component.d.ts +8 -2
- package/title/component.js +5 -2
- package/title/component.js.map +1 -1
- package/title/index.css +89 -38
- package/title/index.d.ts +4 -1
- package/title/index.module.css.js +1 -1
- package/title/index.module.css.js.map +1 -1
- package/title/utils.d.ts +1 -0
- package/title/utils.js +16 -0
- package/title/utils.js.map +1 -0
- package/title-mobile/component.d.ts +4 -1
- package/title-mobile/index.css +70 -53
- package/title-mobile/index.module.css.js +1 -1
- package/title-responsive/component.d.ts +4 -1
package/colors.css
CHANGED
|
@@ -20,63 +20,63 @@
|
|
|
20
20
|
--color-static-text-tertiary-dark: rgba(5, 8, 29, 0.38);
|
|
21
21
|
--color-static-text-tertiary-light: rgba(233, 233, 250, 0.37);
|
|
22
22
|
}
|
|
23
|
-
.
|
|
23
|
+
.typography__tertiary_6zo5v {
|
|
24
24
|
color: var(--color-light-text-tertiary);
|
|
25
25
|
}
|
|
26
|
-
.
|
|
26
|
+
.typography__disabled_6zo5v {
|
|
27
27
|
color: var(--color-light-text-quaternary);
|
|
28
28
|
}
|
|
29
|
-
.
|
|
29
|
+
.typography__accent_6zo5v {
|
|
30
30
|
color: var(--color-light-accent-primary);
|
|
31
31
|
}
|
|
32
|
-
.
|
|
32
|
+
.typography__primary_6zo5v {
|
|
33
33
|
color: var(--color-light-text-primary);
|
|
34
34
|
}
|
|
35
|
-
.
|
|
35
|
+
.typography__attention_6zo5v {
|
|
36
36
|
color: var(--color-light-text-attention);
|
|
37
37
|
}
|
|
38
|
-
.
|
|
38
|
+
.typography__positive_6zo5v {
|
|
39
39
|
color: var(--color-light-text-positive);
|
|
40
40
|
}
|
|
41
|
-
.
|
|
41
|
+
.typography__secondary_6zo5v {
|
|
42
42
|
color: var(--color-light-text-secondary);
|
|
43
43
|
}
|
|
44
|
-
.typography__tertiary-
|
|
44
|
+
.typography__tertiary-inverted_6zo5v {
|
|
45
45
|
color: var(--color-light-text-tertiary-inverted);
|
|
46
46
|
}
|
|
47
|
-
.typography__primary-
|
|
47
|
+
.typography__primary-inverted_6zo5v {
|
|
48
48
|
color: var(--color-light-text-primary-inverted);
|
|
49
49
|
}
|
|
50
|
-
.typography__secondary-
|
|
50
|
+
.typography__secondary-inverted_6zo5v {
|
|
51
51
|
color: var(--color-light-text-secondary-inverted);
|
|
52
52
|
}
|
|
53
|
-
.
|
|
53
|
+
.typography__link_6zo5v {
|
|
54
54
|
color: var(--color-light-text-info);
|
|
55
55
|
}
|
|
56
|
-
.
|
|
56
|
+
.typography__negative_6zo5v {
|
|
57
57
|
color: var(--color-light-text-negative);
|
|
58
58
|
}
|
|
59
|
-
.typography__static-primary-
|
|
59
|
+
.typography__static-primary-light_6zo5v {
|
|
60
60
|
color: var(--color-static-text-primary-light);
|
|
61
61
|
}
|
|
62
|
-
.typography__static-secondary-
|
|
62
|
+
.typography__static-secondary-light_6zo5v {
|
|
63
63
|
color: var(--color-static-text-secondary-light);
|
|
64
64
|
}
|
|
65
|
-
.typography__static-tertiary-
|
|
65
|
+
.typography__static-tertiary-light_6zo5v {
|
|
66
66
|
color: var(--color-static-text-tertiary-light);
|
|
67
67
|
}
|
|
68
|
-
.typography__static-primary-
|
|
68
|
+
.typography__static-primary-dark_6zo5v {
|
|
69
69
|
color: var(--color-static-text-primary-dark);
|
|
70
70
|
}
|
|
71
|
-
.typography__static-secondary-
|
|
71
|
+
.typography__static-secondary-dark_6zo5v {
|
|
72
72
|
color: var(--color-static-text-secondary-dark);
|
|
73
73
|
}
|
|
74
|
-
.typography__static-tertiary-
|
|
74
|
+
.typography__static-tertiary-dark_6zo5v {
|
|
75
75
|
color: var(--color-static-text-tertiary-dark);
|
|
76
76
|
}
|
|
77
|
-
.typography__static-
|
|
77
|
+
.typography__static-accent_6zo5v {
|
|
78
78
|
color: var(--color-static-accent-primary);
|
|
79
79
|
}
|
|
80
|
-
.typography__static-
|
|
80
|
+
.typography__static-positive_6zo5v {
|
|
81
81
|
color: var(--color-static-text-positive);
|
|
82
82
|
}
|
package/colors.module.css.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require('./colors.css');
|
|
4
4
|
|
|
5
|
-
var colors = {"tertiary":"
|
|
5
|
+
var colors = {"tertiary":"typography__tertiary_6zo5v","disabled":"typography__disabled_6zo5v","accent":"typography__accent_6zo5v","primary":"typography__primary_6zo5v","attention":"typography__attention_6zo5v","positive":"typography__positive_6zo5v","secondary":"typography__secondary_6zo5v","tertiary-inverted":"typography__tertiary-inverted_6zo5v","primary-inverted":"typography__primary-inverted_6zo5v","secondary-inverted":"typography__secondary-inverted_6zo5v","link":"typography__link_6zo5v","negative":"typography__negative_6zo5v","static-primary-light":"typography__static-primary-light_6zo5v","static-secondary-light":"typography__static-secondary-light_6zo5v","static-tertiary-light":"typography__static-tertiary-light_6zo5v","static-primary-dark":"typography__static-primary-dark_6zo5v","static-secondary-dark":"typography__static-secondary-dark_6zo5v","static-tertiary-dark":"typography__static-tertiary-dark_6zo5v","static-accent":"typography__static-accent_6zo5v","static-positive":"typography__static-positive_6zo5v"};
|
|
6
6
|
|
|
7
7
|
module.exports = colors;
|
|
8
8
|
//# sourceMappingURL=colors.module.css.js.map
|
|
@@ -4,9 +4,8 @@
|
|
|
4
4
|
--gap-12: var(--gap-s);
|
|
5
5
|
}
|
|
6
6
|
:root {
|
|
7
|
-
--font-family-
|
|
8
|
-
|
|
9
|
-
Helvetica, sans-serif;
|
|
7
|
+
--font-family-system:
|
|
8
|
+
system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Helvetica, sans-serif;
|
|
10
9
|
}
|
|
11
10
|
.transparent {
|
|
12
11
|
opacity: 0;
|
|
@@ -26,16 +25,13 @@
|
|
|
26
25
|
font-size: 16px;
|
|
27
26
|
line-height: 20px;
|
|
28
27
|
font-weight: 400;
|
|
29
|
-
|
|
30
|
-
font-family: var(--font-family-alfasans);
|
|
28
|
+
font-family: var(--font-family-system);
|
|
31
29
|
}
|
|
32
30
|
.component.bold {
|
|
33
31
|
font-weight: 700;
|
|
34
|
-
letter-spacing: 0.43px;
|
|
35
32
|
}
|
|
36
33
|
.component.medium {
|
|
37
34
|
font-weight: 500;
|
|
38
|
-
letter-spacing: -0.05px;
|
|
39
35
|
}
|
|
40
36
|
.caps {
|
|
41
37
|
font-size: 12px;
|
|
@@ -43,7 +39,7 @@
|
|
|
43
39
|
font-weight: 400;
|
|
44
40
|
letter-spacing: 1.25px;
|
|
45
41
|
text-transform: uppercase;
|
|
46
|
-
font-family: var(--font-family-
|
|
42
|
+
font-family: var(--font-family-system);
|
|
47
43
|
}
|
|
48
44
|
.caps.bold {
|
|
49
45
|
font-weight: 700;
|
|
@@ -57,7 +53,7 @@
|
|
|
57
53
|
font-weight: 400;
|
|
58
54
|
letter-spacing: 1.25px;
|
|
59
55
|
text-transform: uppercase;
|
|
60
|
-
font-family: var(--font-family-
|
|
56
|
+
font-family: var(--font-family-system);
|
|
61
57
|
}
|
|
62
58
|
.tagline.bold {
|
|
63
59
|
font-weight: 700;
|
|
@@ -69,120 +65,97 @@
|
|
|
69
65
|
font-size: 18px;
|
|
70
66
|
line-height: 24px;
|
|
71
67
|
font-weight: 400;
|
|
72
|
-
|
|
73
|
-
font-family: var(--font-family-alfasans);
|
|
68
|
+
font-family: var(--font-family-system);
|
|
74
69
|
}
|
|
75
70
|
.primary-large.bold {
|
|
76
71
|
font-weight: 700;
|
|
77
|
-
letter-spacing: 0.38px;
|
|
78
72
|
}
|
|
79
73
|
.primary-large.medium {
|
|
80
74
|
font-weight: 500;
|
|
81
|
-
letter-spacing: -0.17px;
|
|
82
75
|
}
|
|
83
76
|
.primary-medium {
|
|
84
77
|
font-size: 16px;
|
|
85
78
|
line-height: 24px;
|
|
86
79
|
font-weight: 400;
|
|
87
|
-
|
|
88
|
-
font-family: var(--font-family-alfasans);
|
|
80
|
+
font-family: var(--font-family-system);
|
|
89
81
|
}
|
|
90
82
|
.primary-medium.bold {
|
|
91
83
|
font-weight: 700;
|
|
92
|
-
letter-spacing: 0.43px;
|
|
93
84
|
}
|
|
94
85
|
.primary-medium.medium {
|
|
95
86
|
font-weight: 500;
|
|
96
|
-
letter-spacing: -0.05px;
|
|
97
87
|
}
|
|
98
88
|
.primary-small {
|
|
99
89
|
font-size: 14px;
|
|
100
90
|
line-height: 20px;
|
|
101
91
|
font-weight: 400;
|
|
102
|
-
|
|
103
|
-
font-family: var(--font-family-alfasans);
|
|
92
|
+
font-family: var(--font-family-system);
|
|
104
93
|
}
|
|
105
94
|
.primary-small.bold {
|
|
106
95
|
font-weight: 700;
|
|
107
|
-
letter-spacing: 0.47px;
|
|
108
96
|
}
|
|
109
97
|
.primary-small.medium {
|
|
110
98
|
font-weight: 500;
|
|
111
|
-
letter-spacing: 0.07px;
|
|
112
99
|
}
|
|
113
100
|
.component-primary {
|
|
114
101
|
font-size: 16px;
|
|
115
102
|
line-height: 20px;
|
|
116
103
|
font-weight: 400;
|
|
117
|
-
|
|
118
|
-
font-family: var(--font-family-alfasans);
|
|
104
|
+
font-family: var(--font-family-system);
|
|
119
105
|
}
|
|
120
106
|
.component-primary.bold {
|
|
121
107
|
font-weight: 700;
|
|
122
|
-
letter-spacing: 0.43px;
|
|
123
108
|
}
|
|
124
109
|
.component-primary.medium {
|
|
125
110
|
font-weight: 500;
|
|
126
|
-
letter-spacing: -0.05px;
|
|
127
111
|
}
|
|
128
112
|
.secondary-large {
|
|
129
113
|
font-size: 13px;
|
|
130
114
|
line-height: 16px;
|
|
131
115
|
font-weight: 400;
|
|
132
|
-
font-family: var(--font-family-
|
|
116
|
+
font-family: var(--font-family-system);
|
|
133
117
|
}
|
|
134
118
|
.secondary-large.bold {
|
|
135
119
|
font-weight: 700;
|
|
136
|
-
letter-spacing: 0.54px;
|
|
137
120
|
}
|
|
138
121
|
.secondary-large.medium {
|
|
139
122
|
font-weight: 500;
|
|
140
|
-
letter-spacing: 0.13px;
|
|
141
123
|
}
|
|
142
124
|
.secondary-medium {
|
|
143
125
|
font-size: 12px;
|
|
144
126
|
line-height: 16px;
|
|
145
127
|
font-weight: 400;
|
|
146
|
-
|
|
147
|
-
font-family: var(--font-family-alfasans);
|
|
128
|
+
font-family: var(--font-family-system);
|
|
148
129
|
}
|
|
149
130
|
.secondary-medium.bold {
|
|
150
131
|
font-weight: 700;
|
|
151
|
-
letter-spacing: 0.57px;
|
|
152
132
|
}
|
|
153
133
|
.secondary-medium.medium {
|
|
154
134
|
font-weight: 500;
|
|
155
|
-
letter-spacing: 0.19px;
|
|
156
135
|
}
|
|
157
136
|
.secondary-small {
|
|
158
137
|
font-size: 11px;
|
|
159
138
|
line-height: 16px;
|
|
160
139
|
font-weight: 400;
|
|
161
|
-
|
|
162
|
-
font-family: var(--font-family-alfasans);
|
|
140
|
+
font-family: var(--font-family-system);
|
|
163
141
|
}
|
|
164
142
|
.secondary-small.bold {
|
|
165
143
|
font-weight: 700;
|
|
166
|
-
letter-spacing: 0.54px;
|
|
167
144
|
}
|
|
168
145
|
.secondary-small.medium {
|
|
169
146
|
font-weight: 500;
|
|
170
|
-
letter-spacing: 0.24px;
|
|
171
147
|
}
|
|
172
148
|
.component-secondary {
|
|
173
149
|
font-size: 14px;
|
|
174
150
|
line-height: 18px;
|
|
175
151
|
font-weight: 400;
|
|
176
|
-
|
|
177
|
-
font-family: var(--font-family-alfasans);
|
|
152
|
+
font-family: var(--font-family-system);
|
|
178
153
|
}
|
|
179
154
|
.component-secondary.bold {
|
|
180
155
|
font-weight: 700;
|
|
181
|
-
letter-spacing: 0.47px;
|
|
182
156
|
}
|
|
183
157
|
.component-secondary.medium {
|
|
184
158
|
font-weight: 500;
|
|
185
|
-
letter-spacing: 0.07px;
|
|
186
159
|
}
|
|
187
160
|
.rowLimit1 {
|
|
188
161
|
-webkit-line-clamp: 1;
|
|
@@ -22,7 +22,10 @@ export type TitleProps = Omit<NativeProps, 'color'> & {
|
|
|
22
22
|
/**
|
|
23
23
|
* Шрифт текста
|
|
24
24
|
*/
|
|
25
|
-
font?: 'styrene' | 'system'
|
|
25
|
+
font?: 'styrene' | 'system' | 'alfasans' | {
|
|
26
|
+
font: 'alfasans';
|
|
27
|
+
systemCompat: boolean;
|
|
28
|
+
};
|
|
26
29
|
/**
|
|
27
30
|
* Добавляет отступы
|
|
28
31
|
*/
|
|
@@ -83,7 +86,10 @@ export declare const TitleBase: React.ForwardRefExoticComponent<Omit<NativeProps
|
|
|
83
86
|
/**
|
|
84
87
|
* Шрифт текста
|
|
85
88
|
*/
|
|
86
|
-
font?: "styrene" | "system"
|
|
89
|
+
font?: "styrene" | "system" | "alfasans" | {
|
|
90
|
+
font: "alfasans";
|
|
91
|
+
systemCompat: boolean;
|
|
92
|
+
};
|
|
87
93
|
/**
|
|
88
94
|
* Добавляет отступы
|
|
89
95
|
*/
|
package/cssm/title/component.js
CHANGED
|
@@ -6,7 +6,9 @@ var tslib = require('tslib');
|
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var mergeRefs = require('react-merge-refs');
|
|
8
8
|
var cn = require('classnames');
|
|
9
|
-
var cssm = require('@alfalab/core-components-
|
|
9
|
+
var cssm = require('@alfalab/core-components-shared/cssm');
|
|
10
|
+
var cssm$1 = require('@alfalab/core-components-skeleton/cssm');
|
|
11
|
+
var utils = require('./utils.js');
|
|
10
12
|
var colors = require('../colors.module.css');
|
|
11
13
|
var commonStyles = require('./common.module.css');
|
|
12
14
|
|
|
@@ -20,8 +22,8 @@ var commonStyles__default = /*#__PURE__*/_interopDefaultCompat(commonStyles);
|
|
|
20
22
|
|
|
21
23
|
var TitleBase = React.forwardRef(function (_a, ref) {
|
|
22
24
|
var _b;
|
|
23
|
-
var _c = _a.tag, Component = _c === void 0 ? 'div' : _c, _d = _a.view, view = _d === void 0 ? 'medium' : _d
|
|
24
|
-
var
|
|
25
|
+
var _c = _a.tag, Component = _c === void 0 ? 'div' : _c, _d = _a.view, view = _d === void 0 ? 'medium' : _d, _e = _a.font, font = _e === void 0 ? 'styrene' : _e, platform = _a.platform, _f = _a.weight, weight = _f === void 0 ? utils.getDefaultWeight(cssm.isObject(font) ? font.font : font, platform) : _f, _g = _a.defaultMargins, defaultMargins = _g === void 0 ? false : _g, color = _a.color, className = _a.className, dataTestId = _a.dataTestId, children = _a.children, rowLimit = _a.rowLimit, styles = _a.styles, skeletonProps = _a.skeletonProps, showSkeleton = _a.showSkeleton, restProps = tslib.__rest(_a, ["tag", "view", "font", "platform", "weight", "defaultMargins", "color", "className", "dataTestId", "children", "rowLimit", "styles", "skeletonProps", "showSkeleton"]);
|
|
26
|
+
var _h = cssm$1.useSkeleton(showSkeleton, skeletonProps), renderSkeleton = _h.renderSkeleton, textRef = _h.textRef;
|
|
25
27
|
var skeleton = renderSkeleton({
|
|
26
28
|
wrapperClassName: cn__default.default(defaultMargins && styles["margins-".concat(view)]),
|
|
27
29
|
dataTestId: dataTestId,
|
|
@@ -32,6 +34,7 @@ var TitleBase = React.forwardRef(function (_a, ref) {
|
|
|
32
34
|
return (React__default.default.createElement(Component, tslib.__assign({ className: cn__default.default(commonStyles__default.default.component, styles.component, className, styles["".concat(weight === 'regular' ? 'regular-' : '').concat(view)], defaultMargins && styles["margins-".concat(view)], color && colors__default.default[color], (_b = {},
|
|
33
35
|
_b[commonStyles__default.default["rowLimit".concat(rowLimit)]] = rowLimit,
|
|
34
36
|
_b[commonStyles__default.default.transparent] = showSkeleton,
|
|
37
|
+
_b[styles.font] = (cssm.isObject(font) && !font.systemCompat) || !(font === 'system'),
|
|
35
38
|
_b)), "data-test-id": dataTestId, ref: mergeRefs__default.default([ref, textRef]) }, restProps), children));
|
|
36
39
|
});
|
|
37
40
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sources":["../../src/title/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';\n\nimport colors from '../colors.module.css';\nimport commonStyles from './common.module.css';\n\ntype NativeProps = HTMLAttributes<HTMLHeadingElement>;\n\nexport type TitleProps = Omit<NativeProps, 'color'> & {\n /**\n * HTML тег\n */\n tag: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'div';\n\n /**\n * [Вариант начертания](?path=/docs/guidelines-typography--page)\n */\n view?: 'xlarge' | 'large' | 'medium' | 'small' | 'xsmall';\n\n /**\n * Цвет текста\n */\n color?: Color;\n\n /**\n * Толщина шрифта\n */\n weight?: 'regular' | 'medium' | 'bold' | 'semibold';\n\n /**\n * Шрифт текста\n */\n font?: 'styrene' | 'system';\n\n /**\n * Добавляет отступы\n */\n defaultMargins?: boolean;\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 * Количество строк\n */\n rowLimit?: 1 | 2 | 3;\n\n /**\n * Показать скелетон\n */\n showSkeleton?: boolean;\n\n /**\n * Пропы для скелетона\n */\n skeletonProps?: TextSkeletonProps;\n\n /**\n * Значение по-умолчанию для хука useMatchMedia\n */\n defaultMatchMediaValue?: boolean | (() => boolean);\n};\n\ntype PrivateProps = {\n styles: {\n [key: string]: string;\n };\n platform: 'mobile' | 'desktop';\n};\n\ntype TitleElementType = HTMLHeadingElement | HTMLDivElement;\n\nexport const TitleBase = forwardRef<TitleElementType, TitleProps & PrivateProps>(\n (\n {\n tag: Component = 'div',\n view = 'medium',\n font,\n platform,\n weight =
|
|
1
|
+
{"version":3,"file":"component.js","sources":["../../src/title/component.tsx"],"sourcesContent":["import React, { forwardRef, type HTMLAttributes } from 'react';\nimport mergeRefs from 'react-merge-refs';\nimport cn from 'classnames';\n\nimport { isObject } from '@alfalab/core-components-shared';\nimport { type TextSkeletonProps, useSkeleton } from '@alfalab/core-components-skeleton';\n\nimport { type Color } from '../colors';\n\nimport { getDefaultWeight } from './utils';\n\nimport colors from '../colors.module.css';\nimport commonStyles from './common.module.css';\n\ntype NativeProps = HTMLAttributes<HTMLHeadingElement>;\n\nexport type TitleProps = Omit<NativeProps, 'color'> & {\n /**\n * HTML тег\n */\n tag: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'div';\n\n /**\n * [Вариант начертания](?path=/docs/guidelines-typography--page)\n */\n view?: 'xlarge' | 'large' | 'medium' | 'small' | 'xsmall';\n\n /**\n * Цвет текста\n */\n color?: Color;\n\n /**\n * Толщина шрифта\n */\n weight?: 'regular' | 'medium' | 'bold' | 'semibold';\n\n /**\n * Шрифт текста\n */\n font?: 'styrene' | 'system' | 'alfasans' | { font: 'alfasans'; systemCompat: boolean };\n\n /**\n * Добавляет отступы\n */\n defaultMargins?: boolean;\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 * Количество строк\n */\n rowLimit?: 1 | 2 | 3;\n\n /**\n * Показать скелетон\n */\n showSkeleton?: boolean;\n\n /**\n * Пропы для скелетона\n */\n skeletonProps?: TextSkeletonProps;\n\n /**\n * Значение по-умолчанию для хука useMatchMedia\n */\n defaultMatchMediaValue?: boolean | (() => boolean);\n};\n\ntype PrivateProps = {\n styles: {\n [key: string]: string;\n };\n platform: 'mobile' | 'desktop';\n};\n\ntype TitleElementType = HTMLHeadingElement | HTMLDivElement;\n\nexport const TitleBase = forwardRef<TitleElementType, TitleProps & PrivateProps>(\n (\n {\n tag: Component = 'div',\n view = 'medium',\n font = 'styrene',\n platform,\n weight = getDefaultWeight(isObject(font) ? font.font : font, platform),\n defaultMargins = false,\n color,\n className,\n dataTestId,\n children,\n rowLimit,\n styles,\n skeletonProps,\n showSkeleton,\n ...restProps\n },\n ref,\n ) => {\n const { renderSkeleton, textRef } = useSkeleton(showSkeleton, skeletonProps);\n\n const skeleton = renderSkeleton({\n wrapperClassName: cn(defaultMargins && styles[`margins-${view}`]),\n dataTestId,\n });\n\n if (skeleton) {\n return skeleton;\n }\n\n return (\n <Component\n className={cn(\n commonStyles.component,\n styles.component,\n className,\n styles[`${weight === 'regular' ? 'regular-' : ''}${view}`],\n defaultMargins && styles[`margins-${view}`],\n color && colors[color],\n {\n [commonStyles[`rowLimit${rowLimit}`]]: rowLimit,\n [commonStyles.transparent]: showSkeleton,\n [styles.font]:\n (isObject(font) && !font.systemCompat) || !(font === 'system'),\n },\n )}\n data-test-id={dataTestId}\n ref={mergeRefs([ref, textRef])}\n {...restProps}\n >\n {children}\n </Component>\n );\n },\n);\n"],"names":["forwardRef","getDefaultWeight","isObject","__rest","useSkeleton","cn","React","__assign","commonStyles","colors","mergeRefs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;IA4Fa,SAAS,GAAGA,gBAAU,CAC/B,UACI,EAgBC,EACD,GAAG,EAAA;;AAhBC,IAAA,IAAA,WAAsB,EAAjB,SAAS,GAAG,EAAA,KAAA,MAAA,GAAA,KAAK,KAAA,EACtB,EAAA,GAAA,EAAA,CAAA,IAAe,EAAf,IAAI,mBAAG,QAAQ,GAAA,EAAA,EACf,EAAgB,GAAA,EAAA,CAAA,IAAA,EAAhB,IAAI,GAAG,EAAA,KAAA,MAAA,GAAA,SAAS,GAAA,EAAA,EAChB,QAAQ,GAAA,EAAA,CAAA,QAAA,EACR,cAAsE,EAAtE,MAAM,mBAAGC,sBAAgB,CAACC,aAAQ,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,GAAG,IAAI,EAAE,QAAQ,CAAC,GAAA,EAAA,EACtE,sBAAsB,EAAtB,cAAc,GAAG,EAAA,KAAA,MAAA,GAAA,KAAK,KAAA,EACtB,KAAK,WAAA,EACL,SAAS,eAAA,EACT,UAAU,GAAA,EAAA,CAAA,UAAA,EACV,QAAQ,GAAA,EAAA,CAAA,QAAA,EACR,QAAQ,GAAA,EAAA,CAAA,QAAA,EACR,MAAM,GAAA,EAAA,CAAA,MAAA,EACN,aAAa,GAAA,EAAA,CAAA,aAAA,EACb,YAAY,GAAA,EAAA,CAAA,YAAA,EACT,SAAS,GAAAC,YAAA,CAAA,EAAA,EAfhB,sKAgBC,CADe;AAIV,IAAA,IAAA,EAA8B,GAAAC,kBAAW,CAAC,YAAY,EAAE,aAAa,CAAC,EAApE,cAAc,GAAA,EAAA,CAAA,cAAA,EAAE,OAAO,aAA6C;IAE5E,IAAM,QAAQ,GAAG,cAAc,CAAC;QAC5B,gBAAgB,EAAEC,mBAAE,CAAC,cAAc,IAAI,MAAM,CAAC,UAAW,CAAA,MAAA,CAAA,IAAI,CAAE,CAAC,CAAC;AACjE,QAAA,UAAU,EAAA,UAAA;AACb,KAAA,CAAC;IAEF,IAAI,QAAQ,EAAE;AACV,QAAA,OAAO,QAAQ;;IAGnB,QACIC,qCAAC,SAAS,EAAAC,cAAA,CAAA,EACN,SAAS,EAAEF,mBAAE,CACTG,6BAAY,CAAC,SAAS,EACtB,MAAM,CAAC,SAAS,EAChB,SAAS,EACT,MAAM,CAAC,EAAA,CAAA,MAAA,CAAG,MAAM,KAAK,SAAS,GAAG,UAAU,GAAG,EAAE,SAAG,IAAI,CAAE,CAAC,EAC1D,cAAc,IAAI,MAAM,CAAC,UAAA,CAAA,MAAA,CAAW,IAAI,CAAE,CAAC,EAC3C,KAAK,IAAIC,uBAAM,CAAC,KAAK,CAAC,GAAA,EAAA,GAAA,EAAA;AAElB,YAAA,EAAA,CAACD,6BAAY,CAAC,UAAA,CAAA,MAAA,CAAW,QAAQ,CAAE,CAAC,IAAG,QAAQ;AAC/C,YAAA,EAAA,CAACA,6BAAY,CAAC,WAAW,CAAA,GAAG,YAAY;YACxC,EAAC,CAAA,MAAM,CAAC,IAAI,CAAA,GACR,CAACN,aAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,KAAK,EAAE,IAAI,KAAK,QAAQ,CAAC;AAEzE,YAAA,EAAA,EAAA,EAAA,cAAA,EACa,UAAU,EACxB,GAAG,EAAEQ,0BAAS,CAAC,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,EAC1B,EAAA,SAAS,GAEZ,QAAQ,CACD;AAEpB,CAAC;;;;"}
|
package/cssm/title/index.d.ts
CHANGED
|
@@ -5,7 +5,10 @@ declare const Title: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<H
|
|
|
5
5
|
view?: "xlarge" | "large" | "medium" | "small" | "xsmall";
|
|
6
6
|
color?: import("..").Color;
|
|
7
7
|
weight?: "regular" | "medium" | "bold" | "semibold";
|
|
8
|
-
font?: "styrene" | "system"
|
|
8
|
+
font?: "styrene" | "system" | "alfasans" | {
|
|
9
|
+
font: "alfasans";
|
|
10
|
+
systemCompat: boolean;
|
|
11
|
+
};
|
|
9
12
|
defaultMargins?: boolean;
|
|
10
13
|
className?: string;
|
|
11
14
|
dataTestId?: string;
|
|
@@ -10,80 +10,131 @@
|
|
|
10
10
|
--gap-48: var(--gap-4xl);
|
|
11
11
|
}
|
|
12
12
|
:root {
|
|
13
|
-
--font-family-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
--font-family-system:
|
|
14
|
+
system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Helvetica, sans-serif;
|
|
15
|
+
--font-family-styrene:
|
|
16
|
+
'Styrene UI', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Helvetica,
|
|
17
|
+
sans-serif;
|
|
16
18
|
}
|
|
17
19
|
.xlarge {
|
|
18
20
|
font-size: 48px;
|
|
19
21
|
line-height: 52px;
|
|
20
22
|
font-weight: 700;
|
|
21
|
-
|
|
22
|
-
font-family: var(--font-family-alfasans);
|
|
23
|
+
font-family: var(--font-family-system);
|
|
23
24
|
}
|
|
25
|
+
.xlarge.font {
|
|
26
|
+
line-height: 64px;
|
|
27
|
+
font-weight: 500;
|
|
28
|
+
font-feature-settings: 'ss01';
|
|
29
|
+
font-family: var(--font-family-styrene);
|
|
30
|
+
}
|
|
24
31
|
.regular-xlarge {
|
|
25
32
|
font-size: 48px;
|
|
26
33
|
line-height: 52px;
|
|
27
34
|
font-weight: 400;
|
|
28
|
-
|
|
29
|
-
font-family: var(--font-family-alfasans);
|
|
35
|
+
font-family: var(--font-family-system);
|
|
30
36
|
}
|
|
37
|
+
.regular-xlarge.font {
|
|
38
|
+
line-height: 64px;
|
|
39
|
+
font-feature-settings: 'ss01';
|
|
40
|
+
font-family: var(--font-family-styrene);
|
|
41
|
+
}
|
|
31
42
|
.large {
|
|
32
43
|
font-size: 40px;
|
|
33
44
|
line-height: 48px;
|
|
34
45
|
font-weight: 700;
|
|
35
|
-
|
|
36
|
-
font-family: var(--font-family-alfasans);
|
|
46
|
+
font-family: var(--font-family-system);
|
|
37
47
|
}
|
|
48
|
+
.large.font {
|
|
49
|
+
font-weight: 500;
|
|
50
|
+
font-feature-settings: 'ss01';
|
|
51
|
+
font-family: var(--font-family-styrene);
|
|
52
|
+
}
|
|
38
53
|
.regular-large {
|
|
39
54
|
font-size: 40px;
|
|
40
55
|
line-height: 48px;
|
|
41
56
|
font-weight: 400;
|
|
42
|
-
|
|
43
|
-
font-family: var(--font-family-alfasans);
|
|
57
|
+
font-family: var(--font-family-system);
|
|
44
58
|
}
|
|
59
|
+
.regular-large.font {
|
|
60
|
+
font-feature-settings: 'ss01';
|
|
61
|
+
font-family: var(--font-family-styrene);
|
|
62
|
+
}
|
|
45
63
|
.medium {
|
|
46
64
|
font-size: 30px;
|
|
47
65
|
line-height: 36px;
|
|
48
66
|
font-weight: 700;
|
|
49
|
-
|
|
50
|
-
font-family: var(--font-family-alfasans);
|
|
67
|
+
font-family: var(--font-family-system);
|
|
51
68
|
}
|
|
69
|
+
.medium.font {
|
|
70
|
+
font-size: 32px;
|
|
71
|
+
line-height: 40px;
|
|
72
|
+
font-weight: 500;
|
|
73
|
+
font-feature-settings: 'ss01';
|
|
74
|
+
font-family: var(--font-family-styrene);
|
|
75
|
+
}
|
|
52
76
|
.regular-medium {
|
|
53
77
|
font-size: 30px;
|
|
54
78
|
line-height: 36px;
|
|
55
79
|
font-weight: 400;
|
|
56
|
-
|
|
57
|
-
font-family: var(--font-family-alfasans);
|
|
80
|
+
font-family: var(--font-family-system);
|
|
58
81
|
}
|
|
82
|
+
.regular-medium.font {
|
|
83
|
+
font-size: 32px;
|
|
84
|
+
line-height: 40px;
|
|
85
|
+
font-feature-settings: 'ss01';
|
|
86
|
+
font-family: var(--font-family-styrene);
|
|
87
|
+
}
|
|
59
88
|
.small {
|
|
60
89
|
font-size: 22px;
|
|
61
90
|
line-height: 26px;
|
|
62
91
|
font-weight: 700;
|
|
63
|
-
|
|
64
|
-
font-family: var(--font-family-alfasans);
|
|
92
|
+
font-family: var(--font-family-system);
|
|
65
93
|
}
|
|
94
|
+
.small.font {
|
|
95
|
+
font-size: 24px;
|
|
96
|
+
line-height: 32px;
|
|
97
|
+
font-weight: 500;
|
|
98
|
+
font-feature-settings: 'ss01';
|
|
99
|
+
font-family: var(--font-family-styrene);
|
|
100
|
+
}
|
|
66
101
|
.regular-small {
|
|
67
102
|
font-size: 22px;
|
|
68
103
|
line-height: 26px;
|
|
69
104
|
font-weight: 400;
|
|
70
|
-
|
|
71
|
-
font-family: var(--font-family-alfasans);
|
|
105
|
+
font-family: var(--font-family-system);
|
|
72
106
|
}
|
|
107
|
+
.regular-small.font {
|
|
108
|
+
font-size: 24px;
|
|
109
|
+
line-height: 32px;
|
|
110
|
+
font-feature-settings: 'ss01';
|
|
111
|
+
font-family: var(--font-family-styrene);
|
|
112
|
+
}
|
|
73
113
|
.xsmall {
|
|
74
114
|
font-size: 18px;
|
|
75
115
|
line-height: 22px;
|
|
76
116
|
font-weight: 700;
|
|
77
|
-
|
|
78
|
-
font-family: var(--font-family-alfasans);
|
|
117
|
+
font-family: var(--font-family-system);
|
|
79
118
|
}
|
|
119
|
+
.xsmall.font {
|
|
120
|
+
font-size: 20px;
|
|
121
|
+
line-height: 24px;
|
|
122
|
+
font-weight: 500;
|
|
123
|
+
font-feature-settings: 'ss01';
|
|
124
|
+
font-family: var(--font-family-styrene);
|
|
125
|
+
}
|
|
80
126
|
.regular-xsmall {
|
|
81
127
|
font-size: 18px;
|
|
82
128
|
line-height: 22px;
|
|
83
129
|
font-weight: 400;
|
|
84
|
-
|
|
85
|
-
font-family: var(--font-family-alfasans);
|
|
130
|
+
font-family: var(--font-family-system);
|
|
86
131
|
}
|
|
132
|
+
.regular-xsmall.font {
|
|
133
|
+
font-size: 20px;
|
|
134
|
+
line-height: 24px;
|
|
135
|
+
font-feature-settings: 'ss01';
|
|
136
|
+
font-family: var(--font-family-styrene);
|
|
137
|
+
}
|
|
87
138
|
.component.margins-xlarge {
|
|
88
139
|
margin: var(--gap-0) var(--gap-0) var(--gap-24);
|
|
89
140
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getDefaultWeight(font: 'styrene' | 'system' | 'alfasans', platform: 'mobile' | 'desktop'): "medium" | "bold" | "semibold";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
function getDefaultWeight(font, platform) {
|
|
6
|
+
if (font === 'styrene' || font === 'alfasans') {
|
|
7
|
+
return 'medium';
|
|
8
|
+
}
|
|
9
|
+
if (platform === 'desktop') {
|
|
10
|
+
return 'bold';
|
|
11
|
+
}
|
|
12
|
+
return 'semibold';
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
exports.getDefaultWeight = getDefaultWeight;
|
|
16
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../src/title/utils.ts"],"sourcesContent":["export function getDefaultWeight(\n font: 'styrene' | 'system' | 'alfasans',\n platform: 'mobile' | 'desktop',\n) {\n if (font === 'styrene' || font === 'alfasans') {\n return 'medium';\n }\n\n if (platform === 'desktop') {\n return 'bold';\n }\n\n return 'semibold';\n}\n"],"names":[],"mappings":";;;;AAAgB,SAAA,gBAAgB,CAC5B,IAAuC,EACvC,QAA8B,EAAA;IAE9B,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,UAAU,EAAE;AAC3C,QAAA,OAAO,QAAQ;;AAGnB,IAAA,IAAI,QAAQ,KAAK,SAAS,EAAE;AACxB,QAAA,OAAO,MAAM;;AAGjB,IAAA,OAAO,UAAU;AACrB;;;;"}
|
|
@@ -4,7 +4,10 @@ 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"
|
|
7
|
+
font?: "styrene" | "system" | "alfasans" | {
|
|
8
|
+
font: "alfasans";
|
|
9
|
+
systemCompat: boolean;
|
|
10
|
+
};
|
|
8
11
|
defaultMargins?: boolean;
|
|
9
12
|
className?: string;
|
|
10
13
|
dataTestId?: string;
|