@alfalab/core-components-typography 3.2.2 → 4.1.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 +20 -20
- package/colors.module-69def6bf.js +6 -0
- package/common.module-59cc11ca.js +6 -0
- package/component.js +6 -2
- 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 +9 -1
- package/cssm/text/component.js +23 -7
- package/cssm/text/index.js +5 -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/title-responsive/index.module.css +14 -64
- package/cssm/types.d.ts +12 -1
- package/esm/colors.css +20 -20
- package/esm/colors.module-64858915.js +4 -0
- package/esm/common.module-a0a4a875.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 +9 -1
- package/esm/text/component.js +23 -9
- package/esm/text/index.css +18 -19
- 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 +44 -94
- 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 +20 -20
- package/modern/colors.module-58e8caae.js +4 -0
- package/modern/common.module-3d6095da.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 +9 -1
- package/modern/text/component.js +24 -8
- package/modern/text/index.css +18 -19
- 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 +44 -94
- package/modern/title-responsive/index.js +6 -2
- package/modern/types.d.ts +12 -1
- package/package.json +4 -1
- package/src/colors.module.css +79 -0
- package/src/colors.ts +23 -0
- package/src/component.tsx +19 -0
- 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/index.ts +5 -0
- package/src/margins.module.css +11 -0
- package/src/presets.ts +17 -0
- package/src/text/component.tsx +145 -0
- package/src/text/index.module.css +76 -0
- package/src/text/index.ts +1 -0
- package/src/title/common.module.css +16 -0
- package/src/title/component.tsx +133 -0
- package/src/title/index.module.css +75 -0
- package/src/title/index.tsx +17 -0
- package/src/title-mobile/component.tsx +16 -0
- package/src/title-mobile/index.module.css +42 -0
- package/src/title-mobile/index.tsx +1 -0
- package/src/title-responsive/component.tsx +14 -0
- package/src/title-responsive/index.module.css +126 -0
- package/src/title-responsive/index.tsx +1 -0
- package/src/types.ts +15 -0
- package/text/component.d.ts +9 -1
- package/text/component.js +24 -9
- package/text/index.css +18 -19
- 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 +44 -94
- package/title-responsive/index.js +6 -2
- package/types.d.ts +12 -1
- package/colors.module-a848b027.js +0 -6
- package/common.module-7493433e.js +0 -6
- package/esm/colors.module-996156cd.js +0 -4
- package/esm/common.module-bbfef03a.js +0 -4
- package/modern/colors.module-f2c54769.js +0 -4
- package/modern/common.module-888addc3.js +0 -4
package/esm/colors.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: qj5ei */
|
|
2
2
|
:root {
|
|
3
3
|
} /* deprecated */ :root {
|
|
4
4
|
--color-light-text-accent: #ef3124;
|
|
@@ -33,42 +33,42 @@
|
|
|
33
33
|
} :root {
|
|
34
34
|
} :root {
|
|
35
35
|
} :root {
|
|
36
|
-
} /* colors */ .
|
|
36
|
+
} /* colors */ .typography__tertiary_13nf8 {
|
|
37
37
|
color: var(--color-light-text-tertiary);
|
|
38
|
-
} .
|
|
38
|
+
} .typography__disabled_13nf8 {
|
|
39
39
|
color: var(--color-light-text-disabled);
|
|
40
|
-
} .
|
|
40
|
+
} .typography__accent_13nf8 {
|
|
41
41
|
color: var(--color-light-text-accent);
|
|
42
|
-
} .
|
|
42
|
+
} .typography__primary_13nf8 {
|
|
43
43
|
color: var(--color-light-text-primary);
|
|
44
|
-
} .
|
|
44
|
+
} .typography__attention_13nf8 {
|
|
45
45
|
color: var(--color-light-text-attention);
|
|
46
|
-
} .
|
|
46
|
+
} .typography__positive_13nf8 {
|
|
47
47
|
color: var(--color-light-text-positive);
|
|
48
|
-
} .
|
|
48
|
+
} .typography__secondary_13nf8 {
|
|
49
49
|
color: var(--color-light-text-secondary);
|
|
50
|
-
} .typography__tertiary-
|
|
50
|
+
} .typography__tertiary-inverted_13nf8 {
|
|
51
51
|
color: var(--color-light-text-tertiary-inverted);
|
|
52
|
-
} .typography__primary-
|
|
52
|
+
} .typography__primary-inverted_13nf8 {
|
|
53
53
|
color: var(--color-light-text-primary-inverted);
|
|
54
|
-
} .typography__secondary-
|
|
54
|
+
} .typography__secondary-inverted_13nf8 {
|
|
55
55
|
color: var(--color-light-text-secondary-inverted);
|
|
56
|
-
} .
|
|
56
|
+
} .typography__link_13nf8 {
|
|
57
57
|
color: var(--color-light-text-link);
|
|
58
|
-
} .
|
|
58
|
+
} .typography__negative_13nf8 {
|
|
59
59
|
color: var(--color-light-text-negative);
|
|
60
|
-
} .typography__static-primary-
|
|
60
|
+
} .typography__static-primary-light_13nf8 {
|
|
61
61
|
color: var(--color-static-text-primary-light);
|
|
62
|
-
} .typography__static-secondary-
|
|
62
|
+
} .typography__static-secondary-light_13nf8 {
|
|
63
63
|
color: var(--color-static-text-secondary-light);
|
|
64
|
-
} .typography__static-tertiary-
|
|
64
|
+
} .typography__static-tertiary-light_13nf8 {
|
|
65
65
|
color: var(--color-static-text-tertiary-light);
|
|
66
|
-
} .typography__static-primary-
|
|
66
|
+
} .typography__static-primary-dark_13nf8 {
|
|
67
67
|
color: var(--color-static-text-primary-dark);
|
|
68
|
-
} .typography__static-secondary-
|
|
68
|
+
} .typography__static-secondary-dark_13nf8 {
|
|
69
69
|
color: var(--color-static-text-secondary-dark);
|
|
70
|
-
} .typography__static-tertiary-
|
|
70
|
+
} .typography__static-tertiary-dark_13nf8 {
|
|
71
71
|
color: var(--color-static-text-tertiary-dark);
|
|
72
|
-
} .typography__static-
|
|
72
|
+
} .typography__static-accent_13nf8 {
|
|
73
73
|
color: var(--color-static-text-accent);
|
|
74
74
|
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var colors = {"tertiary":"typography__tertiary_13nf8","disabled":"typography__disabled_13nf8","accent":"typography__accent_13nf8","primary":"typography__primary_13nf8","attention":"typography__attention_13nf8","positive":"typography__positive_13nf8","secondary":"typography__secondary_13nf8","tertiary-inverted":"typography__tertiary-inverted_13nf8","primary-inverted":"typography__primary-inverted_13nf8","secondary-inverted":"typography__secondary-inverted_13nf8","link":"typography__link_13nf8","negative":"typography__negative_13nf8","static-primary-light":"typography__static-primary-light_13nf8","static-secondary-light":"typography__static-secondary-light_13nf8","static-tertiary-light":"typography__static-tertiary-light_13nf8","static-primary-dark":"typography__static-primary-dark_13nf8","static-secondary-dark":"typography__static-secondary-dark_13nf8","static-tertiary-dark":"typography__static-tertiary-dark_13nf8","static-accent":"typography__static-accent_13nf8"};
|
|
2
|
+
require('./colors.css')
|
|
3
|
+
|
|
4
|
+
export { colors as c };
|
package/esm/component.js
CHANGED
|
@@ -4,10 +4,14 @@ import { TitleMobile } from './title-mobile/component.js';
|
|
|
4
4
|
import { TitleResponsive } from './title-responsive/component.js';
|
|
5
5
|
import 'tslib';
|
|
6
6
|
import 'react';
|
|
7
|
+
import 'react-merge-refs';
|
|
7
8
|
import 'classnames';
|
|
8
|
-
import './
|
|
9
|
+
import './hooks/useSkeleton.js';
|
|
10
|
+
import '@alfalab/core-components-skeleton/esm';
|
|
11
|
+
import '@alfalab/hooks';
|
|
12
|
+
import './colors.module-64858915.js';
|
|
9
13
|
import './title/component.js';
|
|
10
|
-
import './common.module-
|
|
14
|
+
import './common.module-a0a4a875.js';
|
|
11
15
|
|
|
12
16
|
var Typography = {
|
|
13
17
|
Title: Title,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./useSkeleton";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/* hash: svslz */
|
|
2
|
+
:root {
|
|
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
|
+
} :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 */
|
|
5
|
+
} :root {
|
|
6
|
+
} :root {
|
|
7
|
+
|
|
8
|
+
/* Hard */
|
|
9
|
+
|
|
10
|
+
/* Up */
|
|
11
|
+
|
|
12
|
+
/* Hard up */
|
|
13
|
+
} :root {
|
|
14
|
+
--border-radius-pill: 99px;
|
|
15
|
+
} :root {
|
|
16
|
+
} :root {
|
|
17
|
+
} :root {
|
|
18
|
+
} .typography__skeletonText_ywqd3.typography__skeletonText_ywqd3 {
|
|
19
|
+
border-radius: var(--border-radius-pill);
|
|
20
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { TextSkeletonProps } from "../types";
|
|
4
|
+
type SkeletonProps = {
|
|
5
|
+
wrapperClassName?: string;
|
|
6
|
+
dataTestId?: string;
|
|
7
|
+
};
|
|
8
|
+
declare function useSkeleton(showSkeleton?: boolean, skeletonProps?: TextSkeletonProps): {
|
|
9
|
+
renderSkeleton: (props: SkeletonProps) => React.JSX.Element | null;
|
|
10
|
+
textRef: React.RefObject<HTMLElement>;
|
|
11
|
+
};
|
|
12
|
+
export { useSkeleton };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { __spreadArray } from 'tslib';
|
|
2
|
+
import React, { useState, useRef } from 'react';
|
|
3
|
+
import { Skeleton } from '@alfalab/core-components-skeleton/esm';
|
|
4
|
+
import { useLayoutEffect_SAFE_FOR_SSR } from '@alfalab/hooks';
|
|
5
|
+
|
|
6
|
+
var styles = {"skeletonText":"typography__skeletonText_ywqd3"};
|
|
7
|
+
require('./use-skeleton.css')
|
|
8
|
+
|
|
9
|
+
function useSkeleton(showSkeleton, skeletonProps) {
|
|
10
|
+
var _a = useState(), skeletonParams = _a[0], setSkeletonParams = _a[1];
|
|
11
|
+
var textRef = useRef(null);
|
|
12
|
+
useLayoutEffect_SAFE_FOR_SSR(function () {
|
|
13
|
+
if (showSkeleton && textRef.current) {
|
|
14
|
+
var style = getComputedStyle(textRef.current);
|
|
15
|
+
var textHeight = textRef.current.offsetHeight;
|
|
16
|
+
var fontSize = parseInt(style.fontSize, 10);
|
|
17
|
+
var lineHeight = parseInt(style.lineHeight, 10);
|
|
18
|
+
var padding = (lineHeight - fontSize) % 2 === 0
|
|
19
|
+
? (lineHeight - fontSize) / 2
|
|
20
|
+
: (lineHeight - fontSize - 1) / 2;
|
|
21
|
+
var rows = (skeletonProps === null || skeletonProps === void 0 ? void 0 : skeletonProps.rows)
|
|
22
|
+
? skeletonProps === null || skeletonProps === void 0 ? void 0 : skeletonProps.rows
|
|
23
|
+
: Math.ceil(textHeight / lineHeight);
|
|
24
|
+
setSkeletonParams({
|
|
25
|
+
height: lineHeight - padding * 2,
|
|
26
|
+
padding: "".concat(padding, "px 0"),
|
|
27
|
+
rows: rows,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
setSkeletonParams(undefined);
|
|
32
|
+
}
|
|
33
|
+
}, [showSkeleton, skeletonProps === null || skeletonProps === void 0 ? void 0 : skeletonProps.rows]);
|
|
34
|
+
var renderSkeleton = function (props) {
|
|
35
|
+
if (showSkeleton && skeletonParams) {
|
|
36
|
+
return (React.createElement("div", { className: props.wrapperClassName, "data-test-id": props.dataTestId }, __spreadArray([], Array(skeletonParams.rows), true).map(function (_, idx) {
|
|
37
|
+
var width = Array.isArray(skeletonProps === null || skeletonProps === void 0 ? void 0 : skeletonProps.width)
|
|
38
|
+
? skeletonProps === null || skeletonProps === void 0 ? void 0 : skeletonProps.width[idx]
|
|
39
|
+
: skeletonProps === null || skeletonProps === void 0 ? void 0 : skeletonProps.width;
|
|
40
|
+
return (
|
|
41
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
42
|
+
React.createElement("div", { key: idx, style: { width: width, padding: skeletonParams.padding } },
|
|
43
|
+
React.createElement(Skeleton, { visible: true, className: styles.skeletonText },
|
|
44
|
+
React.createElement("div", { style: { height: skeletonParams.height } }))));
|
|
45
|
+
})));
|
|
46
|
+
}
|
|
47
|
+
return null;
|
|
48
|
+
};
|
|
49
|
+
return { renderSkeleton: renderSkeleton, textRef: textRef };
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export { useSkeleton };
|
package/esm/index.js
CHANGED
|
@@ -3,10 +3,14 @@ export { typographyPresets } from './presets.js';
|
|
|
3
3
|
import './text/component.js';
|
|
4
4
|
import 'tslib';
|
|
5
5
|
import 'react';
|
|
6
|
+
import 'react-merge-refs';
|
|
6
7
|
import 'classnames';
|
|
7
|
-
import './
|
|
8
|
+
import './hooks/useSkeleton.js';
|
|
9
|
+
import '@alfalab/core-components-skeleton/esm';
|
|
10
|
+
import '@alfalab/hooks';
|
|
11
|
+
import './colors.module-64858915.js';
|
|
8
12
|
import './title/index.js';
|
|
9
13
|
import './title/component.js';
|
|
10
|
-
import './common.module-
|
|
14
|
+
import './common.module-a0a4a875.js';
|
|
11
15
|
import './title-mobile/component.js';
|
|
12
16
|
import './title-responsive/component.js';
|
package/esm/text/component.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
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
|
/**
|
|
@@ -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/esm/text/component.js
CHANGED
|
@@ -1,20 +1,34 @@
|
|
|
1
1
|
import { __rest, __assign } from 'tslib';
|
|
2
2
|
import React, { forwardRef } from 'react';
|
|
3
|
+
import mergeRefs from 'react-merge-refs';
|
|
3
4
|
import cn from 'classnames';
|
|
4
|
-
import {
|
|
5
|
+
import { useSkeleton } from '../hooks/useSkeleton.js';
|
|
6
|
+
import { c as colors } from '../colors.module-64858915.js';
|
|
7
|
+
import '@alfalab/core-components-skeleton/esm';
|
|
8
|
+
import '@alfalab/hooks';
|
|
5
9
|
|
|
6
|
-
var styles = {"paragraph":"
|
|
10
|
+
var styles = {"paragraph":"typography__paragraph_rpr5l","paragraphWithMargins":"typography__paragraphWithMargins_rpr5l","primary-large":"typography__primary-large_rpr5l","primary-medium":"typography__primary-medium_rpr5l","primary-small":"typography__primary-small_rpr5l","secondary-large":"typography__secondary-large_rpr5l","secondary-medium":"typography__secondary-medium_rpr5l","secondary-small":"typography__secondary-small_rpr5l","component":"typography__component_rpr5l","caps":"typography__caps_rpr5l","bold":"typography__bold_rpr5l","medium":"typography__medium_rpr5l","regular":"typography__regular_rpr5l","monospace":"typography__monospace_rpr5l","rowLimit1":"typography__rowLimit1_rpr5l","rowLimit2":"typography__rowLimit2_rpr5l","rowLimit3":"typography__rowLimit3_rpr5l"};
|
|
7
11
|
require('./index.css')
|
|
8
12
|
|
|
9
13
|
var Text = forwardRef(function (_a, ref) {
|
|
10
|
-
var _b;
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
var _b, _c;
|
|
15
|
+
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 = __rest(_a, ["view", "tag", "weight", "monospaceNumbers", "defaultMargins", "color", "className", "dataTestId", "children", "rowLimit", "showSkeleton", "skeletonProps"]);
|
|
16
|
+
var _h = useSkeleton(showSkeleton, skeletonProps), renderSkeleton = _h.renderSkeleton, textRef = _h.textRef;
|
|
17
|
+
var skeleton = renderSkeleton({
|
|
18
|
+
wrapperClassName: cn((_b = {},
|
|
14
19
|
_b[styles.paragraphWithMargins] = Component === 'p' && defaultMargins,
|
|
15
|
-
_b
|
|
16
|
-
|
|
17
|
-
|
|
20
|
+
_b)),
|
|
21
|
+
dataTestId: dataTestId,
|
|
22
|
+
});
|
|
23
|
+
if (skeleton) {
|
|
24
|
+
return skeleton;
|
|
25
|
+
}
|
|
26
|
+
return (React.createElement(Component, __assign({ className: cn((_c = {},
|
|
27
|
+
_c[styles.paragraph] = Component === 'p' && !defaultMargins,
|
|
28
|
+
_c[styles.paragraphWithMargins] = Component === 'p' && defaultMargins,
|
|
29
|
+
_c[styles.monospace] = monospaceNumbers,
|
|
30
|
+
_c[styles["rowLimit".concat(rowLimit)]] = rowLimit,
|
|
31
|
+
_c), className, color && colors[color], styles[view], weight && styles[weight]), "data-test-id": dataTestId, ref: mergeRefs([ref, textRef]) }, restProps), children));
|
|
18
32
|
});
|
|
19
33
|
|
|
20
34
|
export { Text };
|
package/esm/text/index.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 1ohw1 */
|
|
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,67 +17,66 @@
|
|
|
17
17
|
} :root {
|
|
18
18
|
} :root {
|
|
19
19
|
--text-paragraph-margin-bottom: 0 0 var(--gap-s);
|
|
20
|
-
} .
|
|
20
|
+
} .typography__paragraph_rpr5l {
|
|
21
21
|
margin: 0;
|
|
22
22
|
padding: 0;
|
|
23
|
-
} .
|
|
23
|
+
} .typography__paragraphWithMargins_rpr5l {
|
|
24
24
|
padding: 0;
|
|
25
25
|
margin: var(--text-paragraph-margin-bottom);
|
|
26
|
-
} .typography__primary-
|
|
26
|
+
} .typography__primary-large_rpr5l {
|
|
27
27
|
font-size: 18px;
|
|
28
28
|
line-height: 24px;
|
|
29
29
|
font-weight: 400;
|
|
30
|
-
} .typography__primary-
|
|
30
|
+
} .typography__primary-medium_rpr5l {
|
|
31
31
|
font-size: 16px;
|
|
32
32
|
line-height: 24px;
|
|
33
33
|
font-weight: 400;
|
|
34
|
-
} .typography__primary-
|
|
34
|
+
} .typography__primary-small_rpr5l {
|
|
35
35
|
font-size: 14px;
|
|
36
36
|
line-height: 20px;
|
|
37
37
|
font-weight: 400;
|
|
38
|
-
} .typography__secondary-
|
|
38
|
+
} .typography__secondary-large_rpr5l {
|
|
39
39
|
font-size: 13px;
|
|
40
40
|
line-height: 16px;
|
|
41
41
|
font-weight: 400;
|
|
42
|
-
} .typography__secondary-
|
|
42
|
+
} .typography__secondary-medium_rpr5l {
|
|
43
43
|
font-size: 12px;
|
|
44
44
|
line-height: 16px;
|
|
45
45
|
font-weight: 400;
|
|
46
|
-
} .typography__secondary-
|
|
46
|
+
} .typography__secondary-small_rpr5l {
|
|
47
47
|
font-size: 11px;
|
|
48
48
|
line-height: 16px;
|
|
49
49
|
font-weight: 400;
|
|
50
|
-
} .
|
|
50
|
+
} .typography__component_rpr5l {
|
|
51
51
|
font-size: 16px;
|
|
52
52
|
line-height: 20px;
|
|
53
53
|
font-weight: 400;
|
|
54
|
-
} .
|
|
54
|
+
} .typography__caps_rpr5l {
|
|
55
55
|
font-size: 12px;
|
|
56
56
|
line-height: 16px;
|
|
57
57
|
font-weight: 500;
|
|
58
58
|
letter-spacing: 1.25px;
|
|
59
59
|
text-transform: uppercase;
|
|
60
|
-
} .
|
|
60
|
+
} .typography__bold_rpr5l {
|
|
61
61
|
font-weight: bold;
|
|
62
|
-
} .
|
|
62
|
+
} .typography__medium_rpr5l {
|
|
63
63
|
font-weight: 500;
|
|
64
|
-
} .
|
|
64
|
+
} .typography__regular_rpr5l {
|
|
65
65
|
font-weight: normal;
|
|
66
|
-
} .
|
|
67
|
-
font-feature-settings: "tnum";
|
|
66
|
+
} .typography__monospace_rpr5l {
|
|
68
67
|
font-variant-numeric: tabular-nums;
|
|
69
|
-
} .
|
|
68
|
+
} .typography__rowLimit1_rpr5l {
|
|
70
69
|
-webkit-line-clamp: 1;
|
|
71
70
|
display: -webkit-box;
|
|
72
71
|
-webkit-box-orient: vertical;
|
|
73
72
|
overflow: hidden;
|
|
74
73
|
word-break: break-all;
|
|
75
|
-
} .
|
|
74
|
+
} .typography__rowLimit2_rpr5l {
|
|
76
75
|
-webkit-line-clamp: 2;
|
|
77
76
|
display: -webkit-box;
|
|
78
77
|
-webkit-box-orient: vertical;
|
|
79
78
|
overflow: hidden;
|
|
80
|
-
} .
|
|
79
|
+
} .typography__rowLimit3_rpr5l {
|
|
81
80
|
-webkit-line-clamp: 3;
|
|
82
81
|
display: -webkit-box;
|
|
83
82
|
-webkit-box-orient: vertical;
|
package/esm/text/index.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
export { Text } from './component.js';
|
|
2
2
|
import 'tslib';
|
|
3
3
|
import 'react';
|
|
4
|
+
import 'react-merge-refs';
|
|
4
5
|
import 'classnames';
|
|
5
|
-
import '../
|
|
6
|
+
import '../hooks/useSkeleton.js';
|
|
7
|
+
import '@alfalab/core-components-skeleton/esm';
|
|
8
|
+
import '@alfalab/hooks';
|
|
9
|
+
import '../colors.module-64858915.js';
|
package/esm/title/common.css
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
/* hash:
|
|
2
|
-
.
|
|
1
|
+
/* hash: ssgub */
|
|
2
|
+
.typography__component_wh2dw {
|
|
3
3
|
margin: 0;
|
|
4
4
|
padding: 0
|
|
5
5
|
}
|
|
6
|
-
.
|
|
6
|
+
.typography__component_wh2dw.typography__bold_wh2dw {
|
|
7
7
|
font-weight: bold;
|
|
8
8
|
}
|
|
9
|
-
.
|
|
9
|
+
.typography__component_wh2dw.typography__medium_wh2dw {
|
|
10
10
|
font-weight: 500;
|
|
11
11
|
}
|
|
12
|
-
.
|
|
12
|
+
.typography__component_wh2dw.typography__regular_wh2dw {
|
|
13
13
|
font-weight: normal;
|
|
14
14
|
}
|
package/esm/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/esm/title/component.js
CHANGED
|
@@ -1,12 +1,24 @@
|
|
|
1
1
|
import { __rest, __assign } from 'tslib';
|
|
2
2
|
import React, { forwardRef } from 'react';
|
|
3
|
+
import mergeRefs from 'react-merge-refs';
|
|
3
4
|
import cn from 'classnames';
|
|
4
|
-
import {
|
|
5
|
+
import { useSkeleton } from '../hooks/useSkeleton.js';
|
|
6
|
+
import { c as colors } from '../colors.module-64858915.js';
|
|
7
|
+
import '@alfalab/core-components-skeleton/esm';
|
|
8
|
+
import '@alfalab/hooks';
|
|
5
9
|
|
|
6
10
|
var Title = forwardRef(function (_a, ref) {
|
|
7
11
|
var _b;
|
|
8
|
-
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 = __rest(_a, ["tag", "view", "font", "weight", "defaultMargins", "color", "className", "dataTestId", "children", "rowLimit", "styles"]);
|
|
9
|
-
|
|
12
|
+
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 = __rest(_a, ["tag", "view", "font", "weight", "defaultMargins", "color", "className", "dataTestId", "children", "rowLimit", "styles", "skeletonProps", "showSkeleton"]);
|
|
13
|
+
var _h = useSkeleton(showSkeleton, skeletonProps), renderSkeleton = _h.renderSkeleton, textRef = _h.textRef;
|
|
14
|
+
var skeleton = renderSkeleton({
|
|
15
|
+
wrapperClassName: cn(defaultMargins && styles["margins-".concat(view)]),
|
|
16
|
+
dataTestId: dataTestId,
|
|
17
|
+
});
|
|
18
|
+
if (skeleton) {
|
|
19
|
+
return skeleton;
|
|
20
|
+
}
|
|
21
|
+
return (React.createElement(Component, __assign({ className: cn(styles.component, className, styles["".concat(font, "-").concat(view)], defaultMargins && styles["margins-".concat(view)], styles[weight], color && colors[color], (_b = {}, _b[styles["rowLimit".concat(rowLimit)]] = rowLimit, _b)), "data-test-id": dataTestId, ref: mergeRefs([ref, textRef]) }, restProps), children));
|
|
10
22
|
});
|
|
11
23
|
|
|
12
24
|
export { Title };
|
package/esm/title/index.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: qtc4l */
|
|
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 */
|
|
@@ -20,78 +20,78 @@
|
|
|
20
20
|
--font-family-styrene: 'Styrene UI', system-ui, -apple-system, 'Segoe UI', Roboto,
|
|
21
21
|
'Helvetica Neue', Helvetica, sans-serif;
|
|
22
22
|
} :root {
|
|
23
|
-
} .typography__styrene-
|
|
23
|
+
} .typography__styrene-xlarge_1jblj {
|
|
24
24
|
font-size: 48px;
|
|
25
25
|
line-height: 64px;
|
|
26
26
|
font-weight: 500;
|
|
27
27
|
font-feature-settings: 'ss01';
|
|
28
28
|
font-family: var(--font-family-styrene);
|
|
29
|
-
} .typography__styrene-
|
|
29
|
+
} .typography__styrene-large_1jblj {
|
|
30
30
|
font-size: 40px;
|
|
31
31
|
line-height: 48px;
|
|
32
32
|
font-weight: 500;
|
|
33
33
|
font-feature-settings: 'ss01';
|
|
34
34
|
font-family: var(--font-family-styrene);
|
|
35
|
-
} .typography__styrene-
|
|
35
|
+
} .typography__styrene-medium_1jblj {
|
|
36
36
|
font-size: 32px;
|
|
37
37
|
line-height: 40px;
|
|
38
38
|
font-weight: 500;
|
|
39
39
|
font-feature-settings: 'ss01';
|
|
40
40
|
font-family: var(--font-family-styrene);
|
|
41
|
-
} .typography__styrene-
|
|
41
|
+
} .typography__styrene-small_1jblj {
|
|
42
42
|
font-size: 24px;
|
|
43
43
|
line-height: 32px;
|
|
44
44
|
font-weight: 500;
|
|
45
45
|
font-feature-settings: 'ss01';
|
|
46
46
|
font-family: var(--font-family-styrene);
|
|
47
|
-
} .typography__styrene-
|
|
47
|
+
} .typography__styrene-xsmall_1jblj {
|
|
48
48
|
font-size: 20px;
|
|
49
49
|
line-height: 24px;
|
|
50
50
|
font-weight: 500;
|
|
51
51
|
font-feature-settings: 'ss01';
|
|
52
52
|
font-family: var(--font-family-styrene);
|
|
53
|
-
} .typography__system-
|
|
53
|
+
} .typography__system-xlarge_1jblj {
|
|
54
54
|
font-size: 48px;
|
|
55
55
|
line-height: 52px;
|
|
56
56
|
font-weight: 700;
|
|
57
|
-
} .typography__system-
|
|
57
|
+
} .typography__system-large_1jblj {
|
|
58
58
|
font-size: 40px;
|
|
59
59
|
line-height: 48px;
|
|
60
60
|
font-weight: 700;
|
|
61
|
-
} .typography__system-
|
|
61
|
+
} .typography__system-medium_1jblj {
|
|
62
62
|
font-size: 30px;
|
|
63
63
|
line-height: 36px;
|
|
64
64
|
font-weight: 700;
|
|
65
|
-
} .typography__system-
|
|
65
|
+
} .typography__system-small_1jblj {
|
|
66
66
|
font-size: 22px;
|
|
67
67
|
line-height: 26px;
|
|
68
68
|
font-weight: 700;
|
|
69
|
-
} .typography__system-
|
|
69
|
+
} .typography__system-xsmall_1jblj {
|
|
70
70
|
font-size: 18px;
|
|
71
71
|
line-height: 22px;
|
|
72
72
|
font-weight: 700;
|
|
73
|
-
} .typography__margins-
|
|
73
|
+
} .typography__margins-xlarge_1jblj {
|
|
74
74
|
margin: 0 0 var(--gap-xl);
|
|
75
|
-
} .typography__margins-
|
|
75
|
+
} .typography__margins-large_1jblj {
|
|
76
76
|
margin: var(--gap-4xl) 0 var(--gap-xl);
|
|
77
|
-
} .typography__margins-
|
|
77
|
+
} .typography__margins-medium_1jblj {
|
|
78
78
|
margin: var(--gap-4xl) 0 var(--gap-xl);
|
|
79
|
-
} .typography__margins-
|
|
79
|
+
} .typography__margins-small_1jblj {
|
|
80
80
|
margin: var(--gap-3xl) 0 var(--gap-m);
|
|
81
|
-
} .typography__margins-
|
|
81
|
+
} .typography__margins-xsmall_1jblj {
|
|
82
82
|
margin: var(--gap-3xl) 0 var(--gap-m);
|
|
83
|
-
} .
|
|
83
|
+
} .typography__rowLimit1_1jblj {
|
|
84
84
|
-webkit-line-clamp: 1;
|
|
85
85
|
display: -webkit-box;
|
|
86
86
|
-webkit-box-orient: vertical;
|
|
87
87
|
overflow: hidden;
|
|
88
88
|
word-break: break-all;
|
|
89
|
-
} .
|
|
89
|
+
} .typography__rowLimit2_1jblj {
|
|
90
90
|
-webkit-line-clamp: 2;
|
|
91
91
|
display: -webkit-box;
|
|
92
92
|
-webkit-box-orient: vertical;
|
|
93
93
|
overflow: hidden;
|
|
94
|
-
} .
|
|
94
|
+
} .typography__rowLimit3_1jblj {
|
|
95
95
|
-webkit-line-clamp: 3;
|
|
96
96
|
display: -webkit-box;
|
|
97
97
|
-webkit-box-orient: vertical;
|
package/esm/title/index.js
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { __assign } from 'tslib';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { Title as Title$1 } from './component.js';
|
|
4
|
-
import { c as commonStyles } from '../common.module-
|
|
4
|
+
import { c as commonStyles } from '../common.module-a0a4a875.js';
|
|
5
|
+
import 'react-merge-refs';
|
|
5
6
|
import 'classnames';
|
|
6
|
-
import '../
|
|
7
|
+
import '../hooks/useSkeleton.js';
|
|
8
|
+
import '@alfalab/core-components-skeleton/esm';
|
|
9
|
+
import '@alfalab/hooks';
|
|
10
|
+
import '../colors.module-64858915.js';
|
|
7
11
|
|
|
8
|
-
var styles = {"styrene-xlarge":"typography__styrene-
|
|
12
|
+
var styles = {"styrene-xlarge":"typography__styrene-xlarge_1jblj","styrene-large":"typography__styrene-large_1jblj","styrene-medium":"typography__styrene-medium_1jblj","styrene-small":"typography__styrene-small_1jblj","styrene-xsmall":"typography__styrene-xsmall_1jblj","system-xlarge":"typography__system-xlarge_1jblj","system-large":"typography__system-large_1jblj","system-medium":"typography__system-medium_1jblj","system-small":"typography__system-small_1jblj","system-xsmall":"typography__system-xsmall_1jblj","margins-xlarge":"typography__margins-xlarge_1jblj","margins-large":"typography__margins-large_1jblj","margins-medium":"typography__margins-medium_1jblj","margins-small":"typography__margins-small_1jblj","margins-xsmall":"typography__margins-xsmall_1jblj","rowLimit1":"typography__rowLimit1_1jblj","rowLimit2":"typography__rowLimit2_1jblj","rowLimit3":"typography__rowLimit3_1jblj"};
|
|
9
13
|
require('./index.css')
|
|
10
14
|
|
|
11
15
|
var Title = function (props) { return (
|