@alfalab/core-components-typography 4.0.0 → 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/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 -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 +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 -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 +51 -22
- package/src/title/component.tsx +46 -18
- package/src/types.ts +14 -0
- package/text/component.d.ts +9 -1
- package/text/component.js +24 -9
- package/text/index.css +18 -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/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,6 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
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"};
|
|
4
|
+
require('./colors.css')
|
|
5
|
+
|
|
6
|
+
exports.colors = colors;
|
package/component.js
CHANGED
|
@@ -8,10 +8,14 @@ var titleMobile_component = require('./title-mobile/component.js');
|
|
|
8
8
|
var titleResponsive_component = require('./title-responsive/component.js');
|
|
9
9
|
require('tslib');
|
|
10
10
|
require('react');
|
|
11
|
+
require('react-merge-refs');
|
|
11
12
|
require('classnames');
|
|
12
|
-
require('./
|
|
13
|
+
require('./hooks/useSkeleton.js');
|
|
14
|
+
require('@alfalab/core-components-skeleton');
|
|
15
|
+
require('@alfalab/hooks');
|
|
16
|
+
require('./colors.module-69def6bf.js');
|
|
13
17
|
require('./title/component.js');
|
|
14
|
-
require('./common.module-
|
|
18
|
+
require('./common.module-59cc11ca.js');
|
|
15
19
|
|
|
16
20
|
var Typography = {
|
|
17
21
|
Title: title_index.Title,
|
package/cssm/component.js
CHANGED
|
@@ -8,7 +8,12 @@ var titleMobile_component = require('./title-mobile/component.js');
|
|
|
8
8
|
var titleResponsive_component = require('./title-responsive/component.js');
|
|
9
9
|
require('tslib');
|
|
10
10
|
require('react');
|
|
11
|
+
require('react-merge-refs');
|
|
11
12
|
require('classnames');
|
|
13
|
+
require('./hooks/useSkeleton.js');
|
|
14
|
+
require('@alfalab/core-components-skeleton/cssm');
|
|
15
|
+
require('@alfalab/hooks');
|
|
16
|
+
require('./hooks/use-skeleton.module.css');
|
|
12
17
|
require('./colors.module.css');
|
|
13
18
|
require('./text/index.module.css');
|
|
14
19
|
require('./title/component.js');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./useSkeleton";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var hooks_useSkeleton = require('./useSkeleton.js');
|
|
6
|
+
require('tslib');
|
|
7
|
+
require('react');
|
|
8
|
+
require('@alfalab/core-components-skeleton/cssm');
|
|
9
|
+
require('@alfalab/hooks');
|
|
10
|
+
require('./use-skeleton.module.css');
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
exports.useSkeleton = hooks_useSkeleton.useSkeleton;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
} /* 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 */
|
|
3
|
+
} :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 */
|
|
4
|
+
} :root {
|
|
5
|
+
} :root {
|
|
6
|
+
|
|
7
|
+
/* Hard */
|
|
8
|
+
|
|
9
|
+
/* Up */
|
|
10
|
+
|
|
11
|
+
/* Hard up */
|
|
12
|
+
} :root {
|
|
13
|
+
--border-radius-pill: 99px;
|
|
14
|
+
} :root {
|
|
15
|
+
} :root {
|
|
16
|
+
} :root {
|
|
17
|
+
} .skeletonText.skeletonText {
|
|
18
|
+
border-radius: var(--border-radius-pill);
|
|
19
|
+
}
|
|
@@ -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,59 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var tslib = require('tslib');
|
|
6
|
+
var React = require('react');
|
|
7
|
+
var coreComponentsSkeleton = require('@alfalab/core-components-skeleton/cssm');
|
|
8
|
+
var hooks = require('@alfalab/hooks');
|
|
9
|
+
var styles = require('./use-skeleton.module.css');
|
|
10
|
+
|
|
11
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
12
|
+
|
|
13
|
+
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
14
|
+
var styles__default = /*#__PURE__*/_interopDefaultCompat(styles);
|
|
15
|
+
|
|
16
|
+
function useSkeleton(showSkeleton, skeletonProps) {
|
|
17
|
+
var _a = React.useState(), skeletonParams = _a[0], setSkeletonParams = _a[1];
|
|
18
|
+
var textRef = React.useRef(null);
|
|
19
|
+
hooks.useLayoutEffect_SAFE_FOR_SSR(function () {
|
|
20
|
+
if (showSkeleton && textRef.current) {
|
|
21
|
+
var style = getComputedStyle(textRef.current);
|
|
22
|
+
var textHeight = textRef.current.offsetHeight;
|
|
23
|
+
var fontSize = parseInt(style.fontSize, 10);
|
|
24
|
+
var lineHeight = parseInt(style.lineHeight, 10);
|
|
25
|
+
var padding = (lineHeight - fontSize) % 2 === 0
|
|
26
|
+
? (lineHeight - fontSize) / 2
|
|
27
|
+
: (lineHeight - fontSize - 1) / 2;
|
|
28
|
+
var rows = (skeletonProps === null || skeletonProps === void 0 ? void 0 : skeletonProps.rows)
|
|
29
|
+
? skeletonProps === null || skeletonProps === void 0 ? void 0 : skeletonProps.rows
|
|
30
|
+
: Math.ceil(textHeight / lineHeight);
|
|
31
|
+
setSkeletonParams({
|
|
32
|
+
height: lineHeight - padding * 2,
|
|
33
|
+
padding: "".concat(padding, "px 0"),
|
|
34
|
+
rows: rows,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
setSkeletonParams(undefined);
|
|
39
|
+
}
|
|
40
|
+
}, [showSkeleton, skeletonProps === null || skeletonProps === void 0 ? void 0 : skeletonProps.rows]);
|
|
41
|
+
var renderSkeleton = function (props) {
|
|
42
|
+
if (showSkeleton && skeletonParams) {
|
|
43
|
+
return (React__default.default.createElement("div", { className: props.wrapperClassName, "data-test-id": props.dataTestId }, tslib.__spreadArray([], Array(skeletonParams.rows), true).map(function (_, idx) {
|
|
44
|
+
var width = Array.isArray(skeletonProps === null || skeletonProps === void 0 ? void 0 : skeletonProps.width)
|
|
45
|
+
? skeletonProps === null || skeletonProps === void 0 ? void 0 : skeletonProps.width[idx]
|
|
46
|
+
: skeletonProps === null || skeletonProps === void 0 ? void 0 : skeletonProps.width;
|
|
47
|
+
return (
|
|
48
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
49
|
+
React__default.default.createElement("div", { key: idx, style: { width: width, padding: skeletonParams.padding } },
|
|
50
|
+
React__default.default.createElement(coreComponentsSkeleton.Skeleton, { visible: true, className: styles__default.default.skeletonText },
|
|
51
|
+
React__default.default.createElement("div", { style: { height: skeletonParams.height } }))));
|
|
52
|
+
})));
|
|
53
|
+
}
|
|
54
|
+
return null;
|
|
55
|
+
};
|
|
56
|
+
return { renderSkeleton: renderSkeleton, textRef: textRef };
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
exports.useSkeleton = useSkeleton;
|
package/cssm/index.js
CHANGED
|
@@ -7,7 +7,12 @@ var presets = require('./presets.js');
|
|
|
7
7
|
require('./text/component.js');
|
|
8
8
|
require('tslib');
|
|
9
9
|
require('react');
|
|
10
|
+
require('react-merge-refs');
|
|
10
11
|
require('classnames');
|
|
12
|
+
require('./hooks/useSkeleton.js');
|
|
13
|
+
require('@alfalab/core-components-skeleton/cssm');
|
|
14
|
+
require('@alfalab/hooks');
|
|
15
|
+
require('./hooks/use-skeleton.module.css');
|
|
11
16
|
require('./colors.module.css');
|
|
12
17
|
require('./text/index.module.css');
|
|
13
18
|
require('./title/index.js');
|
package/cssm/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/cssm/text/component.js
CHANGED
|
@@ -4,26 +4,42 @@ 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');
|
|
9
|
+
var hooks_useSkeleton = require('../hooks/useSkeleton.js');
|
|
8
10
|
var colors = require('../colors.module.css');
|
|
9
11
|
var styles = require('./index.module.css');
|
|
12
|
+
require('@alfalab/core-components-skeleton/cssm');
|
|
13
|
+
require('@alfalab/hooks');
|
|
14
|
+
require('../hooks/use-skeleton.module.css');
|
|
10
15
|
|
|
11
16
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
12
17
|
|
|
13
18
|
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
19
|
+
var mergeRefs__default = /*#__PURE__*/_interopDefaultCompat(mergeRefs);
|
|
14
20
|
var cn__default = /*#__PURE__*/_interopDefaultCompat(cn);
|
|
15
21
|
var colors__default = /*#__PURE__*/_interopDefaultCompat(colors);
|
|
16
22
|
var styles__default = /*#__PURE__*/_interopDefaultCompat(styles);
|
|
17
23
|
|
|
18
24
|
var Text = React.forwardRef(function (_a, ref) {
|
|
19
|
-
var _b;
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
|
|
25
|
+
var _b, _c;
|
|
26
|
+
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"]);
|
|
27
|
+
var _h = hooks_useSkeleton.useSkeleton(showSkeleton, skeletonProps), renderSkeleton = _h.renderSkeleton, textRef = _h.textRef;
|
|
28
|
+
var skeleton = renderSkeleton({
|
|
29
|
+
wrapperClassName: cn__default.default((_b = {},
|
|
23
30
|
_b[styles__default.default.paragraphWithMargins] = Component === 'p' && defaultMargins,
|
|
24
|
-
_b
|
|
25
|
-
|
|
26
|
-
|
|
31
|
+
_b)),
|
|
32
|
+
dataTestId: dataTestId,
|
|
33
|
+
});
|
|
34
|
+
if (skeleton) {
|
|
35
|
+
return skeleton;
|
|
36
|
+
}
|
|
37
|
+
return (React__default.default.createElement(Component, tslib.__assign({ className: cn__default.default((_c = {},
|
|
38
|
+
_c[styles__default.default.paragraph] = Component === 'p' && !defaultMargins,
|
|
39
|
+
_c[styles__default.default.paragraphWithMargins] = Component === 'p' && defaultMargins,
|
|
40
|
+
_c[styles__default.default.monospace] = monospaceNumbers,
|
|
41
|
+
_c[styles__default.default["rowLimit".concat(rowLimit)]] = rowLimit,
|
|
42
|
+
_c), className, color && colors__default.default[color], styles__default.default[view], weight && styles__default.default[weight]), "data-test-id": dataTestId, ref: mergeRefs__default.default([ref, textRef]) }, restProps), children));
|
|
27
43
|
});
|
|
28
44
|
|
|
29
45
|
exports.Text = Text;
|
package/cssm/text/index.js
CHANGED
|
@@ -5,7 +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');
|
|
10
|
+
require('../hooks/useSkeleton.js');
|
|
11
|
+
require('@alfalab/core-components-skeleton/cssm');
|
|
12
|
+
require('@alfalab/hooks');
|
|
13
|
+
require('../hooks/use-skeleton.module.css');
|
|
9
14
|
require('../colors.module.css');
|
|
10
15
|
require('./index.module.css');
|
|
11
16
|
|
|
@@ -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/cssm/title/component.js
CHANGED
|
@@ -4,19 +4,33 @@ 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');
|
|
9
|
+
var hooks_useSkeleton = require('../hooks/useSkeleton.js');
|
|
8
10
|
var colors = require('../colors.module.css');
|
|
11
|
+
require('@alfalab/core-components-skeleton/cssm');
|
|
12
|
+
require('@alfalab/hooks');
|
|
13
|
+
require('../hooks/use-skeleton.module.css');
|
|
9
14
|
|
|
10
15
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
11
16
|
|
|
12
17
|
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
18
|
+
var mergeRefs__default = /*#__PURE__*/_interopDefaultCompat(mergeRefs);
|
|
13
19
|
var cn__default = /*#__PURE__*/_interopDefaultCompat(cn);
|
|
14
20
|
var colors__default = /*#__PURE__*/_interopDefaultCompat(colors);
|
|
15
21
|
|
|
16
22
|
var Title = React.forwardRef(function (_a, ref) {
|
|
17
23
|
var _b;
|
|
18
|
-
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"]);
|
|
19
|
-
|
|
24
|
+
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"]);
|
|
25
|
+
var _h = hooks_useSkeleton.useSkeleton(showSkeleton, skeletonProps), renderSkeleton = _h.renderSkeleton, textRef = _h.textRef;
|
|
26
|
+
var skeleton = renderSkeleton({
|
|
27
|
+
wrapperClassName: cn__default.default(defaultMargins && styles["margins-".concat(view)]),
|
|
28
|
+
dataTestId: dataTestId,
|
|
29
|
+
});
|
|
30
|
+
if (skeleton) {
|
|
31
|
+
return skeleton;
|
|
32
|
+
}
|
|
33
|
+
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__default.default[color], (_b = {}, _b[styles["rowLimit".concat(rowLimit)]] = rowLimit, _b)), "data-test-id": dataTestId, ref: mergeRefs__default.default([ref, textRef]) }, restProps), children));
|
|
20
34
|
});
|
|
21
35
|
|
|
22
36
|
exports.Title = Title;
|
package/cssm/title/index.js
CHANGED
|
@@ -7,7 +7,12 @@ var React = require('react');
|
|
|
7
7
|
var title_component = require('./component.js');
|
|
8
8
|
var commonStyles = require('./common.module.css');
|
|
9
9
|
var styles = require('./index.module.css');
|
|
10
|
+
require('react-merge-refs');
|
|
10
11
|
require('classnames');
|
|
12
|
+
require('../hooks/useSkeleton.js');
|
|
13
|
+
require('@alfalab/core-components-skeleton/cssm');
|
|
14
|
+
require('@alfalab/hooks');
|
|
15
|
+
require('../hooks/use-skeleton.module.css');
|
|
11
16
|
require('../colors.module.css');
|
|
12
17
|
|
|
13
18
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
@@ -7,7 +7,12 @@ var React = require('react');
|
|
|
7
7
|
var title_component = require('../title/component.js');
|
|
8
8
|
var commonStyles = require('../title/common.module.css');
|
|
9
9
|
var styles = require('./index.module.css');
|
|
10
|
+
require('react-merge-refs');
|
|
10
11
|
require('classnames');
|
|
12
|
+
require('../hooks/useSkeleton.js');
|
|
13
|
+
require('@alfalab/core-components-skeleton/cssm');
|
|
14
|
+
require('@alfalab/hooks');
|
|
15
|
+
require('../hooks/use-skeleton.module.css');
|
|
11
16
|
require('../colors.module.css');
|
|
12
17
|
|
|
13
18
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
@@ -6,7 +6,12 @@ var titleMobile_component = require('./component.js');
|
|
|
6
6
|
require('tslib');
|
|
7
7
|
require('react');
|
|
8
8
|
require('../title/component.js');
|
|
9
|
+
require('react-merge-refs');
|
|
9
10
|
require('classnames');
|
|
11
|
+
require('../hooks/useSkeleton.js');
|
|
12
|
+
require('@alfalab/core-components-skeleton/cssm');
|
|
13
|
+
require('@alfalab/hooks');
|
|
14
|
+
require('../hooks/use-skeleton.module.css');
|
|
10
15
|
require('../colors.module.css');
|
|
11
16
|
require('../title/common.module.css');
|
|
12
17
|
require('./index.module.css');
|
|
@@ -7,7 +7,12 @@ var React = require('react');
|
|
|
7
7
|
var title_component = require('../title/component.js');
|
|
8
8
|
var commonStyles = require('../title/common.module.css');
|
|
9
9
|
var styles = require('./index.module.css');
|
|
10
|
+
require('react-merge-refs');
|
|
10
11
|
require('classnames');
|
|
12
|
+
require('../hooks/useSkeleton.js');
|
|
13
|
+
require('@alfalab/core-components-skeleton/cssm');
|
|
14
|
+
require('@alfalab/hooks');
|
|
15
|
+
require('../hooks/use-skeleton.module.css');
|
|
11
16
|
require('../colors.module.css');
|
|
12
17
|
|
|
13
18
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
@@ -6,7 +6,12 @@ var titleResponsive_component = require('./component.js');
|
|
|
6
6
|
require('tslib');
|
|
7
7
|
require('react');
|
|
8
8
|
require('../title/component.js');
|
|
9
|
+
require('react-merge-refs');
|
|
9
10
|
require('classnames');
|
|
11
|
+
require('../hooks/useSkeleton.js');
|
|
12
|
+
require('@alfalab/core-components-skeleton/cssm');
|
|
13
|
+
require('@alfalab/hooks');
|
|
14
|
+
require('../hooks/use-skeleton.module.css');
|
|
10
15
|
require('../colors.module.css');
|
|
11
16
|
require('../title/common.module.css');
|
|
12
17
|
require('./index.module.css');
|
package/cssm/types.d.ts
CHANGED
|
@@ -1,2 +1,13 @@
|
|
|
1
1
|
type TextElementType = HTMLParagraphElement | HTMLSpanElement | HTMLDivElement;
|
|
2
|
-
|
|
2
|
+
type WidthUnit = number | string;
|
|
3
|
+
type TextSkeletonProps = {
|
|
4
|
+
/**
|
|
5
|
+
* Кол-во строк текста
|
|
6
|
+
*/
|
|
7
|
+
rows?: number;
|
|
8
|
+
/**
|
|
9
|
+
* Ширина строки
|
|
10
|
+
*/
|
|
11
|
+
width?: WidthUnit | WidthUnit[];
|
|
12
|
+
};
|
|
13
|
+
export { TextElementType, TextSkeletonProps };
|
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";
|