@alfalab/core-components-typography 4.0.0 → 4.2.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.
- package/colors.css +33 -33
- package/colors.module-70706104.js +6 -0
- package/common.module-78c2a0fa.js +6 -0
- package/component.js +6 -2
- package/cssm/colors.module.css +13 -13
- package/cssm/component.js +5 -0
- package/cssm/hooks/index.d.ts +1 -0
- package/cssm/hooks/index.js +14 -0
- package/cssm/hooks/use-skeleton.module.css +19 -0
- package/cssm/hooks/useSkeleton.d.ts +12 -0
- package/cssm/hooks/useSkeleton.js +59 -0
- package/cssm/index.js +5 -0
- package/cssm/text/component.d.ts +10 -2
- package/cssm/text/component.js +39 -7
- package/cssm/text/index.js +5 -0
- package/cssm/text/index.module.css +8 -0
- package/cssm/title/component.d.ts +19 -2
- package/cssm/title/component.js +16 -2
- package/cssm/title/index.js +5 -0
- package/cssm/title-mobile/component.js +5 -0
- package/cssm/title-mobile/index.js +5 -0
- package/cssm/title-responsive/component.js +5 -0
- package/cssm/title-responsive/index.js +5 -0
- package/cssm/types.d.ts +12 -1
- package/esm/colors.css +33 -33
- package/esm/colors.module-ac92fbac.js +4 -0
- package/esm/common.module-95067533.js +4 -0
- package/esm/component.js +6 -2
- package/esm/hooks/index.d.ts +1 -0
- package/esm/hooks/index.js +5 -0
- package/esm/hooks/use-skeleton.css +20 -0
- package/esm/hooks/useSkeleton.d.ts +12 -0
- package/esm/hooks/useSkeleton.js +52 -0
- package/esm/index.js +6 -2
- package/esm/text/component.d.ts +10 -2
- package/esm/text/component.js +39 -9
- package/esm/text/index.css +26 -18
- package/esm/text/index.js +5 -1
- package/esm/title/common.css +5 -5
- package/esm/title/component.d.ts +19 -2
- package/esm/title/component.js +15 -3
- package/esm/title/index.css +19 -19
- package/esm/title/index.js +7 -3
- package/esm/title-mobile/component.js +7 -3
- package/esm/title-mobile/index.css +11 -11
- package/esm/title-mobile/index.js +6 -2
- package/esm/title-responsive/component.js +7 -3
- package/esm/title-responsive/index.css +31 -31
- package/esm/title-responsive/index.js +6 -2
- package/esm/types.d.ts +12 -1
- package/hooks/index.d.ts +1 -0
- package/hooks/index.js +13 -0
- package/hooks/use-skeleton.css +20 -0
- package/hooks/useSkeleton.d.ts +12 -0
- package/hooks/useSkeleton.js +60 -0
- package/index.js +6 -2
- package/modern/colors.css +33 -33
- package/modern/colors.module-1a9450b1.js +4 -0
- package/modern/common.module-151b3759.js +4 -0
- package/modern/component.js +6 -2
- package/modern/hooks/index.d.ts +1 -0
- package/modern/hooks/index.js +4 -0
- package/modern/hooks/use-skeleton.css +20 -0
- package/modern/hooks/useSkeleton.d.ts +12 -0
- package/modern/hooks/useSkeleton.js +51 -0
- package/modern/index.js +6 -2
- package/modern/text/component.d.ts +10 -2
- package/modern/text/component.js +40 -8
- package/modern/text/index.css +26 -18
- package/modern/text/index.js +5 -1
- package/modern/title/common.css +5 -5
- package/modern/title/component.d.ts +19 -2
- package/modern/title/component.js +16 -2
- package/modern/title/index.css +19 -19
- package/modern/title/index.js +7 -3
- package/modern/title-mobile/component.js +7 -3
- package/modern/title-mobile/index.css +11 -11
- package/modern/title-mobile/index.js +6 -2
- package/modern/title-responsive/component.js +7 -3
- package/modern/title-responsive/index.css +31 -31
- package/modern/title-responsive/index.js +6 -2
- package/modern/types.d.ts +12 -1
- package/package.json +4 -1
- package/src/hooks/index.ts +1 -0
- package/src/hooks/use-skeleton.module.css +5 -0
- package/src/hooks/useSkeleton.tsx +78 -0
- package/src/text/component.tsx +74 -22
- package/src/text/index.module.css +8 -0
- package/src/title/component.tsx +46 -18
- package/src/types.ts +14 -0
- package/text/component.d.ts +10 -2
- package/text/component.js +40 -9
- package/text/index.css +26 -18
- package/text/index.js +5 -1
- package/title/common.css +5 -5
- package/title/component.d.ts +19 -2
- package/title/component.js +16 -3
- package/title/index.css +19 -19
- package/title/index.js +7 -3
- package/title-mobile/component.js +7 -3
- package/title-mobile/index.css +11 -11
- package/title-mobile/index.js +6 -2
- package/title-responsive/component.js +7 -3
- package/title-responsive/index.css +31 -31
- package/title-responsive/index.js +6 -2
- package/types.d.ts +12 -1
- package/colors.module-1c06b16d.js +0 -6
- package/common.module-00fb3f71.js +0 -6
- package/esm/colors.module-d9f55bc3.js +0 -4
- package/esm/common.module-39c4c6a5.js +0 -4
- package/modern/colors.module-d0f9b310.js +0 -4
- package/modern/common.module-47d6bc91.js +0 -4
package/src/text/component.tsx
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import React, { forwardRef, HTMLAttributes } from 'react';
|
|
2
|
+
import mergeRefs from 'react-merge-refs';
|
|
2
3
|
import cn from 'classnames';
|
|
3
4
|
|
|
4
5
|
import { Color } from '../colors';
|
|
5
|
-
import {
|
|
6
|
+
import { useSkeleton } from '../hooks';
|
|
7
|
+
import { TextElementType, TextSkeletonProps } from '../types';
|
|
6
8
|
|
|
7
9
|
import colors from '../colors.module.css';
|
|
8
10
|
import styles from './index.module.css';
|
|
@@ -21,6 +23,8 @@ type TextBaseProps = {
|
|
|
21
23
|
| 'secondary-medium'
|
|
22
24
|
| 'secondary-small'
|
|
23
25
|
| 'component'
|
|
26
|
+
| 'component-primary'
|
|
27
|
+
| 'component-secondary'
|
|
24
28
|
| 'caps';
|
|
25
29
|
|
|
26
30
|
/**
|
|
@@ -67,6 +71,16 @@ type TextBaseProps = {
|
|
|
67
71
|
* Количество строк (не поддерживает IE)
|
|
68
72
|
*/
|
|
69
73
|
rowLimit?: 1 | 2 | 3;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Показать скелетон
|
|
77
|
+
*/
|
|
78
|
+
showSkeleton?: boolean;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Пропы для скелетона
|
|
82
|
+
*/
|
|
83
|
+
skeletonProps?: TextSkeletonProps;
|
|
70
84
|
};
|
|
71
85
|
|
|
72
86
|
type TextPTagProps = Omit<TextBaseProps, 'tag' | 'defaultMargins'> & {
|
|
@@ -76,6 +90,23 @@ type TextPTagProps = Omit<TextBaseProps, 'tag' | 'defaultMargins'> & {
|
|
|
76
90
|
|
|
77
91
|
export type TextProps = Omit<NativeProps, 'color'> & (TextBaseProps | TextPTagProps);
|
|
78
92
|
|
|
93
|
+
const logWarning = (view: Required<TextBaseProps>['view']) => {
|
|
94
|
+
if (process.env.NODE_ENV !== 'development') {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const viewsMap: { [key: string]: string } = {
|
|
99
|
+
component: 'component-primary',
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
// eslint-disable-next-line no-console
|
|
103
|
+
console.warn(
|
|
104
|
+
// eslint-disable-next-line prefer-template
|
|
105
|
+
`@alfalab/core-components/typography: view='${view}' будет удален в следующих мажорных версиях. ` +
|
|
106
|
+
`Используйте view='${viewsMap[view]}'.`,
|
|
107
|
+
);
|
|
108
|
+
};
|
|
109
|
+
|
|
79
110
|
export const Text = forwardRef<TextElementType, TextProps>(
|
|
80
111
|
(
|
|
81
112
|
{
|
|
@@ -89,28 +120,49 @@ export const Text = forwardRef<TextElementType, TextProps>(
|
|
|
89
120
|
dataTestId,
|
|
90
121
|
children,
|
|
91
122
|
rowLimit,
|
|
123
|
+
showSkeleton,
|
|
124
|
+
skeletonProps,
|
|
92
125
|
...restProps
|
|
93
126
|
},
|
|
94
127
|
ref,
|
|
95
|
-
) =>
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
128
|
+
) => {
|
|
129
|
+
if (view === 'component') {
|
|
130
|
+
logWarning(view);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
const { renderSkeleton, textRef } = useSkeleton(showSkeleton, skeletonProps);
|
|
134
|
+
|
|
135
|
+
const skeleton = renderSkeleton({
|
|
136
|
+
wrapperClassName: cn({
|
|
137
|
+
[styles.paragraphWithMargins]: Component === 'p' && defaultMargins,
|
|
138
|
+
}),
|
|
139
|
+
dataTestId,
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
if (skeleton) {
|
|
143
|
+
return skeleton;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
return (
|
|
147
|
+
<Component
|
|
148
|
+
className={cn(
|
|
149
|
+
{
|
|
150
|
+
[styles.paragraph]: Component === 'p' && !defaultMargins,
|
|
151
|
+
[styles.paragraphWithMargins]: Component === 'p' && defaultMargins,
|
|
152
|
+
[styles.monospace]: monospaceNumbers,
|
|
153
|
+
[styles[`rowLimit${rowLimit}`]]: rowLimit,
|
|
154
|
+
},
|
|
155
|
+
className,
|
|
156
|
+
color && colors[color],
|
|
157
|
+
styles[view],
|
|
158
|
+
weight && styles[weight],
|
|
159
|
+
)}
|
|
160
|
+
data-test-id={dataTestId}
|
|
161
|
+
ref={mergeRefs([ref, textRef])}
|
|
162
|
+
{...restProps}
|
|
163
|
+
>
|
|
164
|
+
{children}
|
|
165
|
+
</Component>
|
|
166
|
+
);
|
|
167
|
+
},
|
|
116
168
|
);
|
package/src/title/component.tsx
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import React, { forwardRef, HTMLAttributes } from 'react';
|
|
2
|
+
import mergeRefs from 'react-merge-refs';
|
|
2
3
|
import cn from 'classnames';
|
|
3
4
|
|
|
4
5
|
import { Color } from '../colors';
|
|
6
|
+
import { useSkeleton } from '../hooks';
|
|
7
|
+
import { TextSkeletonProps } from '../types';
|
|
5
8
|
|
|
6
9
|
import colors from '../colors.module.css';
|
|
7
10
|
|
|
@@ -57,6 +60,16 @@ export type TitleProps = Omit<NativeProps, 'color'> & {
|
|
|
57
60
|
* Количество строк (не поддерживает IE)
|
|
58
61
|
*/
|
|
59
62
|
rowLimit?: 1 | 2 | 3;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Показать скелетон
|
|
66
|
+
*/
|
|
67
|
+
showSkeleton?: boolean;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Пропы для скелетона
|
|
71
|
+
*/
|
|
72
|
+
skeletonProps?: TextSkeletonProps;
|
|
60
73
|
};
|
|
61
74
|
|
|
62
75
|
type Styles = {
|
|
@@ -81,25 +94,40 @@ export const Title = forwardRef<TitleElementType, TitleProps & Styles>(
|
|
|
81
94
|
children,
|
|
82
95
|
rowLimit,
|
|
83
96
|
styles,
|
|
97
|
+
skeletonProps,
|
|
98
|
+
showSkeleton,
|
|
84
99
|
...restProps
|
|
85
100
|
},
|
|
86
101
|
ref,
|
|
87
|
-
) =>
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
102
|
+
) => {
|
|
103
|
+
const { renderSkeleton, textRef } = useSkeleton(showSkeleton, skeletonProps);
|
|
104
|
+
|
|
105
|
+
const skeleton = renderSkeleton({
|
|
106
|
+
wrapperClassName: cn(defaultMargins && styles[`margins-${view}`]),
|
|
107
|
+
dataTestId,
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
if (skeleton) {
|
|
111
|
+
return skeleton;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return (
|
|
115
|
+
<Component
|
|
116
|
+
className={cn(
|
|
117
|
+
styles.component,
|
|
118
|
+
className,
|
|
119
|
+
styles[`${font}-${view}`],
|
|
120
|
+
defaultMargins && styles[`margins-${view}`],
|
|
121
|
+
styles[weight],
|
|
122
|
+
color && colors[color],
|
|
123
|
+
{ [styles[`rowLimit${rowLimit}`]]: rowLimit },
|
|
124
|
+
)}
|
|
125
|
+
data-test-id={dataTestId}
|
|
126
|
+
ref={mergeRefs([ref, textRef])}
|
|
127
|
+
{...restProps}
|
|
128
|
+
>
|
|
129
|
+
{children}
|
|
130
|
+
</Component>
|
|
131
|
+
);
|
|
132
|
+
},
|
|
105
133
|
);
|
package/src/types.ts
CHANGED
|
@@ -1 +1,15 @@
|
|
|
1
1
|
export type TextElementType = HTMLParagraphElement | HTMLSpanElement | HTMLDivElement;
|
|
2
|
+
|
|
3
|
+
type WidthUnit = number | string;
|
|
4
|
+
|
|
5
|
+
export type TextSkeletonProps = {
|
|
6
|
+
/**
|
|
7
|
+
* Кол-во строк текста
|
|
8
|
+
*/
|
|
9
|
+
rows?: number;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Ширина строки
|
|
13
|
+
*/
|
|
14
|
+
width?: WidthUnit | WidthUnit[];
|
|
15
|
+
};
|
package/text/component.d.ts
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { HTMLAttributes } from "react";
|
|
4
4
|
import { Color } from "../colors";
|
|
5
|
-
import { TextElementType } from "../types";
|
|
5
|
+
import { TextElementType, TextSkeletonProps } from "../types";
|
|
6
6
|
type NativeProps = HTMLAttributes<HTMLSpanElement>;
|
|
7
7
|
type TextBaseProps = {
|
|
8
8
|
/**
|
|
9
9
|
* [Вариант начертания](https://core-ds.github.io/core-components/master/?path=/docs/tokens-assets-типографика--docs)
|
|
10
10
|
*/
|
|
11
|
-
view?: 'primary-large' | 'primary-medium' | 'primary-small' | 'secondary-large' | 'secondary-medium' | 'secondary-small' | 'component' | 'caps';
|
|
11
|
+
view?: 'primary-large' | 'primary-medium' | 'primary-small' | 'secondary-large' | 'secondary-medium' | 'secondary-small' | 'component' | 'component-primary' | 'component-secondary' | 'caps';
|
|
12
12
|
/**
|
|
13
13
|
* Цвет текста
|
|
14
14
|
*/
|
|
@@ -45,6 +45,14 @@ type TextBaseProps = {
|
|
|
45
45
|
* Количество строк (не поддерживает IE)
|
|
46
46
|
*/
|
|
47
47
|
rowLimit?: 1 | 2 | 3;
|
|
48
|
+
/**
|
|
49
|
+
* Показать скелетон
|
|
50
|
+
*/
|
|
51
|
+
showSkeleton?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Пропы для скелетона
|
|
54
|
+
*/
|
|
55
|
+
skeletonProps?: TextSkeletonProps;
|
|
48
56
|
};
|
|
49
57
|
type TextPTagProps = Omit<TextBaseProps, 'tag' | 'defaultMargins'> & {
|
|
50
58
|
tag?: 'p';
|
package/text/component.js
CHANGED
|
@@ -4,26 +4,57 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var tslib = require('tslib');
|
|
6
6
|
var React = require('react');
|
|
7
|
+
var mergeRefs = require('react-merge-refs');
|
|
7
8
|
var cn = require('classnames');
|
|
8
|
-
var
|
|
9
|
+
var hooks_useSkeleton = require('../hooks/useSkeleton.js');
|
|
10
|
+
var colors_module = require('../colors.module-70706104.js');
|
|
11
|
+
require('@alfalab/core-components-skeleton');
|
|
12
|
+
require('@alfalab/hooks');
|
|
9
13
|
|
|
10
14
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
11
15
|
|
|
12
16
|
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
17
|
+
var mergeRefs__default = /*#__PURE__*/_interopDefaultCompat(mergeRefs);
|
|
13
18
|
var cn__default = /*#__PURE__*/_interopDefaultCompat(cn);
|
|
14
19
|
|
|
15
|
-
var styles = {"paragraph":"
|
|
20
|
+
var styles = {"paragraph":"typography__paragraph_nz4l3","paragraphWithMargins":"typography__paragraphWithMargins_nz4l3","primary-large":"typography__primary-large_nz4l3","primary-medium":"typography__primary-medium_nz4l3","primary-small":"typography__primary-small_nz4l3","secondary-large":"typography__secondary-large_nz4l3","secondary-medium":"typography__secondary-medium_nz4l3","secondary-small":"typography__secondary-small_nz4l3","component":"typography__component_nz4l3","component-primary":"typography__component-primary_nz4l3","component-secondary":"typography__component-secondary_nz4l3","caps":"typography__caps_nz4l3","bold":"typography__bold_nz4l3","medium":"typography__medium_nz4l3","regular":"typography__regular_nz4l3","monospace":"typography__monospace_nz4l3","rowLimit1":"typography__rowLimit1_nz4l3","rowLimit2":"typography__rowLimit2_nz4l3","rowLimit3":"typography__rowLimit3_nz4l3"};
|
|
16
21
|
require('./index.css')
|
|
17
22
|
|
|
23
|
+
var logWarning = function (view) {
|
|
24
|
+
if (process.env.NODE_ENV !== 'development') {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
var viewsMap = {
|
|
28
|
+
component: 'component-primary',
|
|
29
|
+
};
|
|
30
|
+
// eslint-disable-next-line no-console
|
|
31
|
+
console.warn(
|
|
32
|
+
// eslint-disable-next-line prefer-template
|
|
33
|
+
"@alfalab/core-components/typography: view='".concat(view, "' \u0431\u0443\u0434\u0435\u0442 \u0443\u0434\u0430\u043B\u0435\u043D \u0432 \u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0438\u0445 \u043C\u0430\u0436\u043E\u0440\u043D\u044B\u0445 \u0432\u0435\u0440\u0441\u0438\u044F\u0445. ") +
|
|
34
|
+
"\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0439\u0442\u0435 view='".concat(viewsMap[view], "'."));
|
|
35
|
+
};
|
|
18
36
|
var Text = React.forwardRef(function (_a, ref) {
|
|
19
|
-
var _b;
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
|
|
37
|
+
var _b, _c;
|
|
38
|
+
var _d = _a.view, view = _d === void 0 ? 'primary-medium' : _d, _e = _a.tag, Component = _e === void 0 ? 'span' : _e, weight = _a.weight, _f = _a.monospaceNumbers, monospaceNumbers = _f === void 0 ? false : _f, _g = _a.defaultMargins, defaultMargins = _g === void 0 ? true : _g, color = _a.color, className = _a.className, dataTestId = _a.dataTestId, children = _a.children, rowLimit = _a.rowLimit, showSkeleton = _a.showSkeleton, skeletonProps = _a.skeletonProps, restProps = tslib.__rest(_a, ["view", "tag", "weight", "monospaceNumbers", "defaultMargins", "color", "className", "dataTestId", "children", "rowLimit", "showSkeleton", "skeletonProps"]);
|
|
39
|
+
if (view === 'component') {
|
|
40
|
+
logWarning(view);
|
|
41
|
+
}
|
|
42
|
+
var _h = hooks_useSkeleton.useSkeleton(showSkeleton, skeletonProps), renderSkeleton = _h.renderSkeleton, textRef = _h.textRef;
|
|
43
|
+
var skeleton = renderSkeleton({
|
|
44
|
+
wrapperClassName: cn__default.default((_b = {},
|
|
23
45
|
_b[styles.paragraphWithMargins] = Component === 'p' && defaultMargins,
|
|
24
|
-
_b
|
|
25
|
-
|
|
26
|
-
|
|
46
|
+
_b)),
|
|
47
|
+
dataTestId: dataTestId,
|
|
48
|
+
});
|
|
49
|
+
if (skeleton) {
|
|
50
|
+
return skeleton;
|
|
51
|
+
}
|
|
52
|
+
return (React__default.default.createElement(Component, tslib.__assign({ className: cn__default.default((_c = {},
|
|
53
|
+
_c[styles.paragraph] = Component === 'p' && !defaultMargins,
|
|
54
|
+
_c[styles.paragraphWithMargins] = Component === 'p' && defaultMargins,
|
|
55
|
+
_c[styles.monospace] = monospaceNumbers,
|
|
56
|
+
_c[styles["rowLimit".concat(rowLimit)]] = rowLimit,
|
|
57
|
+
_c), className, color && colors_module.colors[color], styles[view], weight && styles[weight]), "data-test-id": dataTestId, ref: mergeRefs__default.default([ref, textRef]) }, restProps), children));
|
|
27
58
|
});
|
|
28
59
|
|
|
29
60
|
exports.Text = Text;
|
package/text/index.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: r7j9w */
|
|
2
2
|
:root {
|
|
3
3
|
} /* deprecated */ :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
4
4
|
} :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
@@ -17,66 +17,74 @@
|
|
|
17
17
|
} :root {
|
|
18
18
|
} :root {
|
|
19
19
|
--text-paragraph-margin-bottom: 0 0 var(--gap-s);
|
|
20
|
-
} .
|
|
20
|
+
} .typography__paragraph_nz4l3 {
|
|
21
21
|
margin: 0;
|
|
22
22
|
padding: 0;
|
|
23
|
-
} .
|
|
23
|
+
} .typography__paragraphWithMargins_nz4l3 {
|
|
24
24
|
padding: 0;
|
|
25
25
|
margin: var(--text-paragraph-margin-bottom);
|
|
26
|
-
} .typography__primary-
|
|
26
|
+
} .typography__primary-large_nz4l3 {
|
|
27
27
|
font-size: 18px;
|
|
28
28
|
line-height: 24px;
|
|
29
29
|
font-weight: 400;
|
|
30
|
-
} .typography__primary-
|
|
30
|
+
} .typography__primary-medium_nz4l3 {
|
|
31
31
|
font-size: 16px;
|
|
32
32
|
line-height: 24px;
|
|
33
33
|
font-weight: 400;
|
|
34
|
-
} .typography__primary-
|
|
34
|
+
} .typography__primary-small_nz4l3 {
|
|
35
35
|
font-size: 14px;
|
|
36
36
|
line-height: 20px;
|
|
37
37
|
font-weight: 400;
|
|
38
|
-
} .typography__secondary-
|
|
38
|
+
} .typography__secondary-large_nz4l3 {
|
|
39
39
|
font-size: 13px;
|
|
40
40
|
line-height: 16px;
|
|
41
41
|
font-weight: 400;
|
|
42
|
-
} .typography__secondary-
|
|
42
|
+
} .typography__secondary-medium_nz4l3 {
|
|
43
43
|
font-size: 12px;
|
|
44
44
|
line-height: 16px;
|
|
45
45
|
font-weight: 400;
|
|
46
|
-
} .typography__secondary-
|
|
46
|
+
} .typography__secondary-small_nz4l3 {
|
|
47
47
|
font-size: 11px;
|
|
48
48
|
line-height: 16px;
|
|
49
49
|
font-weight: 400;
|
|
50
|
-
} .
|
|
50
|
+
} .typography__component_nz4l3 {
|
|
51
51
|
font-size: 16px;
|
|
52
52
|
line-height: 20px;
|
|
53
53
|
font-weight: 400;
|
|
54
|
-
} .
|
|
54
|
+
} .typography__component-primary_nz4l3 {
|
|
55
|
+
font-size: 16px;
|
|
56
|
+
line-height: 20px;
|
|
57
|
+
font-weight: 400;
|
|
58
|
+
} .typography__component-secondary_nz4l3 {
|
|
59
|
+
font-size: 14px;
|
|
60
|
+
line-height: 18px;
|
|
61
|
+
font-weight: 400;
|
|
62
|
+
} .typography__caps_nz4l3 {
|
|
55
63
|
font-size: 12px;
|
|
56
64
|
line-height: 16px;
|
|
57
65
|
font-weight: 500;
|
|
58
66
|
letter-spacing: 1.25px;
|
|
59
67
|
text-transform: uppercase;
|
|
60
|
-
} .
|
|
68
|
+
} .typography__bold_nz4l3 {
|
|
61
69
|
font-weight: bold;
|
|
62
|
-
} .
|
|
70
|
+
} .typography__medium_nz4l3 {
|
|
63
71
|
font-weight: 500;
|
|
64
|
-
} .
|
|
72
|
+
} .typography__regular_nz4l3 {
|
|
65
73
|
font-weight: normal;
|
|
66
|
-
} .
|
|
74
|
+
} .typography__monospace_nz4l3 {
|
|
67
75
|
font-variant-numeric: tabular-nums;
|
|
68
|
-
} .
|
|
76
|
+
} .typography__rowLimit1_nz4l3 {
|
|
69
77
|
-webkit-line-clamp: 1;
|
|
70
78
|
display: -webkit-box;
|
|
71
79
|
-webkit-box-orient: vertical;
|
|
72
80
|
overflow: hidden;
|
|
73
81
|
word-break: break-all;
|
|
74
|
-
} .
|
|
82
|
+
} .typography__rowLimit2_nz4l3 {
|
|
75
83
|
-webkit-line-clamp: 2;
|
|
76
84
|
display: -webkit-box;
|
|
77
85
|
-webkit-box-orient: vertical;
|
|
78
86
|
overflow: hidden;
|
|
79
|
-
} .
|
|
87
|
+
} .typography__rowLimit3_nz4l3 {
|
|
80
88
|
-webkit-line-clamp: 3;
|
|
81
89
|
display: -webkit-box;
|
|
82
90
|
-webkit-box-orient: vertical;
|
package/text/index.js
CHANGED
|
@@ -5,8 +5,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var text_component = require('./component.js');
|
|
6
6
|
require('tslib');
|
|
7
7
|
require('react');
|
|
8
|
+
require('react-merge-refs');
|
|
8
9
|
require('classnames');
|
|
9
|
-
require('../
|
|
10
|
+
require('../hooks/useSkeleton.js');
|
|
11
|
+
require('@alfalab/core-components-skeleton');
|
|
12
|
+
require('@alfalab/hooks');
|
|
13
|
+
require('../colors.module-70706104.js');
|
|
10
14
|
|
|
11
15
|
|
|
12
16
|
|
package/title/common.css
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
/* hash:
|
|
2
|
-
.
|
|
1
|
+
/* hash: 1uj85 */
|
|
2
|
+
.typography__component_a4bxl {
|
|
3
3
|
margin: 0;
|
|
4
4
|
padding: 0
|
|
5
5
|
}
|
|
6
|
-
.
|
|
6
|
+
.typography__component_a4bxl.typography__bold_a4bxl {
|
|
7
7
|
font-weight: bold;
|
|
8
8
|
}
|
|
9
|
-
.
|
|
9
|
+
.typography__component_a4bxl.typography__medium_a4bxl {
|
|
10
10
|
font-weight: 500;
|
|
11
11
|
}
|
|
12
|
-
.
|
|
12
|
+
.typography__component_a4bxl.typography__regular_a4bxl {
|
|
13
13
|
font-weight: normal;
|
|
14
14
|
}
|
package/title/component.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { HTMLAttributes } from "react";
|
|
4
4
|
import { Color } from "../colors";
|
|
5
|
+
import { TextSkeletonProps } from "../types";
|
|
5
6
|
type NativeProps = HTMLAttributes<HTMLHeadingElement>;
|
|
6
7
|
type TitleProps = Omit<NativeProps, 'color'> & {
|
|
7
8
|
/**
|
|
@@ -44,6 +45,14 @@ type TitleProps = Omit<NativeProps, 'color'> & {
|
|
|
44
45
|
* Количество строк (не поддерживает IE)
|
|
45
46
|
*/
|
|
46
47
|
rowLimit?: 1 | 2 | 3;
|
|
48
|
+
/**
|
|
49
|
+
* Показать скелетон
|
|
50
|
+
*/
|
|
51
|
+
showSkeleton?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Пропы для скелетона
|
|
54
|
+
*/
|
|
55
|
+
skeletonProps?: TextSkeletonProps;
|
|
47
56
|
};
|
|
48
57
|
type Styles = {
|
|
49
58
|
styles: {
|
|
@@ -59,7 +68,7 @@ declare const Title: React.ForwardRefExoticComponent<Omit<NativeProps, "color">
|
|
|
59
68
|
/**
|
|
60
69
|
* [Вариант начертания](https://core-ds.github.io/core-components/master/?path=/docs/guidelines-typography--page)
|
|
61
70
|
*/
|
|
62
|
-
view?: "
|
|
71
|
+
view?: "small" | "medium" | "xlarge" | "large" | "xsmall" | undefined;
|
|
63
72
|
/**
|
|
64
73
|
* Цвет текста
|
|
65
74
|
*/
|
|
@@ -67,7 +76,7 @@ declare const Title: React.ForwardRefExoticComponent<Omit<NativeProps, "color">
|
|
|
67
76
|
/**
|
|
68
77
|
* Толщина шрифта
|
|
69
78
|
*/
|
|
70
|
-
weight?: "
|
|
79
|
+
weight?: "bold" | "regular" | "medium" | undefined;
|
|
71
80
|
/**
|
|
72
81
|
* Шрифт текста
|
|
73
82
|
*/
|
|
@@ -92,5 +101,13 @@ declare const Title: React.ForwardRefExoticComponent<Omit<NativeProps, "color">
|
|
|
92
101
|
* Количество строк (не поддерживает IE)
|
|
93
102
|
*/
|
|
94
103
|
rowLimit?: 1 | 2 | 3 | undefined;
|
|
104
|
+
/**
|
|
105
|
+
* Показать скелетон
|
|
106
|
+
*/
|
|
107
|
+
showSkeleton?: boolean | undefined;
|
|
108
|
+
/**
|
|
109
|
+
* Пропы для скелетона
|
|
110
|
+
*/
|
|
111
|
+
skeletonProps?: TextSkeletonProps | undefined;
|
|
95
112
|
} & Styles & React.RefAttributes<TitleElementType>>;
|
|
96
113
|
export { TitleProps, Title };
|
package/title/component.js
CHANGED
|
@@ -4,18 +4,31 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var tslib = require('tslib');
|
|
6
6
|
var React = require('react');
|
|
7
|
+
var mergeRefs = require('react-merge-refs');
|
|
7
8
|
var cn = require('classnames');
|
|
8
|
-
var
|
|
9
|
+
var hooks_useSkeleton = require('../hooks/useSkeleton.js');
|
|
10
|
+
var colors_module = require('../colors.module-70706104.js');
|
|
11
|
+
require('@alfalab/core-components-skeleton');
|
|
12
|
+
require('@alfalab/hooks');
|
|
9
13
|
|
|
10
14
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
11
15
|
|
|
12
16
|
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
17
|
+
var mergeRefs__default = /*#__PURE__*/_interopDefaultCompat(mergeRefs);
|
|
13
18
|
var cn__default = /*#__PURE__*/_interopDefaultCompat(cn);
|
|
14
19
|
|
|
15
20
|
var Title = React.forwardRef(function (_a, ref) {
|
|
16
21
|
var _b;
|
|
17
|
-
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, _f = _a.weight, weight = _f === void 0 ? font === 'styrene' ? 'medium' : 'bold' : _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, restProps = tslib.__rest(_a, ["tag", "view", "font", "weight", "defaultMargins", "color", "className", "dataTestId", "children", "rowLimit", "styles"]);
|
|
18
|
-
|
|
22
|
+
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, _f = _a.weight, weight = _f === void 0 ? font === 'styrene' ? 'medium' : 'bold' : _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", "weight", "defaultMargins", "color", "className", "dataTestId", "children", "rowLimit", "styles", "skeletonProps", "showSkeleton"]);
|
|
23
|
+
var _h = hooks_useSkeleton.useSkeleton(showSkeleton, skeletonProps), renderSkeleton = _h.renderSkeleton, textRef = _h.textRef;
|
|
24
|
+
var skeleton = renderSkeleton({
|
|
25
|
+
wrapperClassName: cn__default.default(defaultMargins && styles["margins-".concat(view)]),
|
|
26
|
+
dataTestId: dataTestId,
|
|
27
|
+
});
|
|
28
|
+
if (skeleton) {
|
|
29
|
+
return skeleton;
|
|
30
|
+
}
|
|
31
|
+
return (React__default.default.createElement(Component, tslib.__assign({ className: cn__default.default(styles.component, className, styles["".concat(font, "-").concat(view)], defaultMargins && styles["margins-".concat(view)], styles[weight], color && colors_module.colors[color], (_b = {}, _b[styles["rowLimit".concat(rowLimit)]] = rowLimit, _b)), "data-test-id": dataTestId, ref: mergeRefs__default.default([ref, textRef]) }, restProps), children));
|
|
19
32
|
});
|
|
20
33
|
|
|
21
34
|
exports.Title = Title;
|