@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.
Files changed (112) hide show
  1. package/colors.css +33 -33
  2. package/colors.module-70706104.js +6 -0
  3. package/common.module-78c2a0fa.js +6 -0
  4. package/component.js +6 -2
  5. package/cssm/colors.module.css +13 -13
  6. package/cssm/component.js +5 -0
  7. package/cssm/hooks/index.d.ts +1 -0
  8. package/cssm/hooks/index.js +14 -0
  9. package/cssm/hooks/use-skeleton.module.css +19 -0
  10. package/cssm/hooks/useSkeleton.d.ts +12 -0
  11. package/cssm/hooks/useSkeleton.js +59 -0
  12. package/cssm/index.js +5 -0
  13. package/cssm/text/component.d.ts +10 -2
  14. package/cssm/text/component.js +39 -7
  15. package/cssm/text/index.js +5 -0
  16. package/cssm/text/index.module.css +8 -0
  17. package/cssm/title/component.d.ts +19 -2
  18. package/cssm/title/component.js +16 -2
  19. package/cssm/title/index.js +5 -0
  20. package/cssm/title-mobile/component.js +5 -0
  21. package/cssm/title-mobile/index.js +5 -0
  22. package/cssm/title-responsive/component.js +5 -0
  23. package/cssm/title-responsive/index.js +5 -0
  24. package/cssm/types.d.ts +12 -1
  25. package/esm/colors.css +33 -33
  26. package/esm/colors.module-ac92fbac.js +4 -0
  27. package/esm/common.module-95067533.js +4 -0
  28. package/esm/component.js +6 -2
  29. package/esm/hooks/index.d.ts +1 -0
  30. package/esm/hooks/index.js +5 -0
  31. package/esm/hooks/use-skeleton.css +20 -0
  32. package/esm/hooks/useSkeleton.d.ts +12 -0
  33. package/esm/hooks/useSkeleton.js +52 -0
  34. package/esm/index.js +6 -2
  35. package/esm/text/component.d.ts +10 -2
  36. package/esm/text/component.js +39 -9
  37. package/esm/text/index.css +26 -18
  38. package/esm/text/index.js +5 -1
  39. package/esm/title/common.css +5 -5
  40. package/esm/title/component.d.ts +19 -2
  41. package/esm/title/component.js +15 -3
  42. package/esm/title/index.css +19 -19
  43. package/esm/title/index.js +7 -3
  44. package/esm/title-mobile/component.js +7 -3
  45. package/esm/title-mobile/index.css +11 -11
  46. package/esm/title-mobile/index.js +6 -2
  47. package/esm/title-responsive/component.js +7 -3
  48. package/esm/title-responsive/index.css +31 -31
  49. package/esm/title-responsive/index.js +6 -2
  50. package/esm/types.d.ts +12 -1
  51. package/hooks/index.d.ts +1 -0
  52. package/hooks/index.js +13 -0
  53. package/hooks/use-skeleton.css +20 -0
  54. package/hooks/useSkeleton.d.ts +12 -0
  55. package/hooks/useSkeleton.js +60 -0
  56. package/index.js +6 -2
  57. package/modern/colors.css +33 -33
  58. package/modern/colors.module-1a9450b1.js +4 -0
  59. package/modern/common.module-151b3759.js +4 -0
  60. package/modern/component.js +6 -2
  61. package/modern/hooks/index.d.ts +1 -0
  62. package/modern/hooks/index.js +4 -0
  63. package/modern/hooks/use-skeleton.css +20 -0
  64. package/modern/hooks/useSkeleton.d.ts +12 -0
  65. package/modern/hooks/useSkeleton.js +51 -0
  66. package/modern/index.js +6 -2
  67. package/modern/text/component.d.ts +10 -2
  68. package/modern/text/component.js +40 -8
  69. package/modern/text/index.css +26 -18
  70. package/modern/text/index.js +5 -1
  71. package/modern/title/common.css +5 -5
  72. package/modern/title/component.d.ts +19 -2
  73. package/modern/title/component.js +16 -2
  74. package/modern/title/index.css +19 -19
  75. package/modern/title/index.js +7 -3
  76. package/modern/title-mobile/component.js +7 -3
  77. package/modern/title-mobile/index.css +11 -11
  78. package/modern/title-mobile/index.js +6 -2
  79. package/modern/title-responsive/component.js +7 -3
  80. package/modern/title-responsive/index.css +31 -31
  81. package/modern/title-responsive/index.js +6 -2
  82. package/modern/types.d.ts +12 -1
  83. package/package.json +4 -1
  84. package/src/hooks/index.ts +1 -0
  85. package/src/hooks/use-skeleton.module.css +5 -0
  86. package/src/hooks/useSkeleton.tsx +78 -0
  87. package/src/text/component.tsx +74 -22
  88. package/src/text/index.module.css +8 -0
  89. package/src/title/component.tsx +46 -18
  90. package/src/types.ts +14 -0
  91. package/text/component.d.ts +10 -2
  92. package/text/component.js +40 -9
  93. package/text/index.css +26 -18
  94. package/text/index.js +5 -1
  95. package/title/common.css +5 -5
  96. package/title/component.d.ts +19 -2
  97. package/title/component.js +16 -3
  98. package/title/index.css +19 -19
  99. package/title/index.js +7 -3
  100. package/title-mobile/component.js +7 -3
  101. package/title-mobile/index.css +11 -11
  102. package/title-mobile/index.js +6 -2
  103. package/title-responsive/component.js +7 -3
  104. package/title-responsive/index.css +31 -31
  105. package/title-responsive/index.js +6 -2
  106. package/types.d.ts +12 -1
  107. package/colors.module-1c06b16d.js +0 -6
  108. package/common.module-00fb3f71.js +0 -6
  109. package/esm/colors.module-d9f55bc3.js +0 -4
  110. package/esm/common.module-39c4c6a5.js +0 -4
  111. package/modern/colors.module-d0f9b310.js +0 -4
  112. package/modern/common.module-47d6bc91.js +0 -4
package/modern/colors.css CHANGED
@@ -1,25 +1,25 @@
1
- /* hash: xlwka */
1
+ /* hash: i9al3 */
2
2
  :root {
3
3
  } /* deprecated */ :root {
4
4
  --color-light-text-accent: #ef3124;
5
- --color-light-text-attention: #cb830f;
6
- --color-light-text-disabled: rgba(60, 60, 67, 0.22);
7
- --color-light-text-link: #0072ef;
8
- --color-light-text-negative: #d91d0b;
9
- --color-light-text-positive: #13a463;
5
+ --color-light-text-attention: #ea8313;
6
+ --color-light-text-disabled: rgba(5, 11, 44, 0.18);
7
+ --color-light-text-link: #2a77ef;
8
+ --color-light-text-negative: #ec2e14;
9
+ --color-light-text-positive: #0d9336;
10
10
  --color-light-text-primary: #0e0e0e;
11
11
  --color-light-text-primary-inverted: #fff;
12
- --color-light-text-secondary: rgba(60, 60, 67, 0.66);
13
- --color-light-text-secondary-inverted: rgba(235, 235, 245, 0.54);
14
- --color-light-text-tertiary: rgba(60, 60, 67, 0.4);
15
- --color-light-text-tertiary-inverted: rgba(235, 235, 245, 0.32);
12
+ --color-light-text-secondary: rgba(4, 4, 19, 0.55);
13
+ --color-light-text-secondary-inverted: rgba(238, 238, 251, 0.55);
14
+ --color-light-text-tertiary: rgba(5, 8, 29, 0.38);
15
+ --color-light-text-tertiary-inverted: rgba(233, 233, 250, 0.37);
16
16
  --color-static-text-accent: #ef3124;
17
17
  --color-static-text-primary-dark: #0e0e0e;
18
18
  --color-static-text-primary-light: #fff;
19
- --color-static-text-secondary-dark: rgba(60, 60, 67, 0.66);
20
- --color-static-text-secondary-light: rgba(235, 235, 245, 0.54);
21
- --color-static-text-tertiary-dark: rgba(60, 60, 67, 0.4);
22
- --color-static-text-tertiary-light: rgba(235, 235, 245, 0.32); /* 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 */
19
+ --color-static-text-secondary-dark: rgba(4, 4, 19, 0.55);
20
+ --color-static-text-secondary-light: rgba(238, 238, 251, 0.55);
21
+ --color-static-text-tertiary-dark: rgba(5, 8, 29, 0.38);
22
+ --color-static-text-tertiary-light: rgba(233, 233, 250, 0.37); /* 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 */
23
23
  } :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 */
24
24
  } :root {
25
25
  } :root {
@@ -33,42 +33,42 @@
33
33
  } :root {
34
34
  } :root {
35
35
  } :root {
36
- } /* colors */ .typography__tertiary_j1wcp {
36
+ } /* colors */ .typography__tertiary_1t5nw {
37
37
  color: var(--color-light-text-tertiary);
38
- } .typography__disabled_j1wcp {
38
+ } .typography__disabled_1t5nw {
39
39
  color: var(--color-light-text-disabled);
40
- } .typography__accent_j1wcp {
40
+ } .typography__accent_1t5nw {
41
41
  color: var(--color-light-text-accent);
42
- } .typography__primary_j1wcp {
42
+ } .typography__primary_1t5nw {
43
43
  color: var(--color-light-text-primary);
44
- } .typography__attention_j1wcp {
44
+ } .typography__attention_1t5nw {
45
45
  color: var(--color-light-text-attention);
46
- } .typography__positive_j1wcp {
46
+ } .typography__positive_1t5nw {
47
47
  color: var(--color-light-text-positive);
48
- } .typography__secondary_j1wcp {
48
+ } .typography__secondary_1t5nw {
49
49
  color: var(--color-light-text-secondary);
50
- } .typography__tertiary-inverted_j1wcp {
50
+ } .typography__tertiary-inverted_1t5nw {
51
51
  color: var(--color-light-text-tertiary-inverted);
52
- } .typography__primary-inverted_j1wcp {
52
+ } .typography__primary-inverted_1t5nw {
53
53
  color: var(--color-light-text-primary-inverted);
54
- } .typography__secondary-inverted_j1wcp {
54
+ } .typography__secondary-inverted_1t5nw {
55
55
  color: var(--color-light-text-secondary-inverted);
56
- } .typography__link_j1wcp {
56
+ } .typography__link_1t5nw {
57
57
  color: var(--color-light-text-link);
58
- } .typography__negative_j1wcp {
58
+ } .typography__negative_1t5nw {
59
59
  color: var(--color-light-text-negative);
60
- } .typography__static-primary-light_j1wcp {
60
+ } .typography__static-primary-light_1t5nw {
61
61
  color: var(--color-static-text-primary-light);
62
- } .typography__static-secondary-light_j1wcp {
62
+ } .typography__static-secondary-light_1t5nw {
63
63
  color: var(--color-static-text-secondary-light);
64
- } .typography__static-tertiary-light_j1wcp {
64
+ } .typography__static-tertiary-light_1t5nw {
65
65
  color: var(--color-static-text-tertiary-light);
66
- } .typography__static-primary-dark_j1wcp {
66
+ } .typography__static-primary-dark_1t5nw {
67
67
  color: var(--color-static-text-primary-dark);
68
- } .typography__static-secondary-dark_j1wcp {
68
+ } .typography__static-secondary-dark_1t5nw {
69
69
  color: var(--color-static-text-secondary-dark);
70
- } .typography__static-tertiary-dark_j1wcp {
70
+ } .typography__static-tertiary-dark_1t5nw {
71
71
  color: var(--color-static-text-tertiary-dark);
72
- } .typography__static-accent_j1wcp {
72
+ } .typography__static-accent_1t5nw {
73
73
  color: var(--color-static-text-accent);
74
74
  }
@@ -0,0 +1,4 @@
1
+ const colors = {"tertiary":"typography__tertiary_1t5nw","disabled":"typography__disabled_1t5nw","accent":"typography__accent_1t5nw","primary":"typography__primary_1t5nw","attention":"typography__attention_1t5nw","positive":"typography__positive_1t5nw","secondary":"typography__secondary_1t5nw","tertiary-inverted":"typography__tertiary-inverted_1t5nw","primary-inverted":"typography__primary-inverted_1t5nw","secondary-inverted":"typography__secondary-inverted_1t5nw","link":"typography__link_1t5nw","negative":"typography__negative_1t5nw","static-primary-light":"typography__static-primary-light_1t5nw","static-secondary-light":"typography__static-secondary-light_1t5nw","static-tertiary-light":"typography__static-tertiary-light_1t5nw","static-primary-dark":"typography__static-primary-dark_1t5nw","static-secondary-dark":"typography__static-secondary-dark_1t5nw","static-tertiary-dark":"typography__static-tertiary-dark_1t5nw","static-accent":"typography__static-accent_1t5nw"};
2
+ require('./colors.css')
3
+
4
+ export { colors as c };
@@ -0,0 +1,4 @@
1
+ const commonStyles = {"component":"typography__component_a4bxl","bold":"typography__bold_a4bxl","medium":"typography__medium_a4bxl","regular":"typography__regular_a4bxl"};
2
+ require('./title/common.css')
3
+
4
+ export { commonStyles as c };
@@ -3,10 +3,14 @@ import { Title } from './title/index.js';
3
3
  import { TitleMobile } from './title-mobile/component.js';
4
4
  import { TitleResponsive } from './title-responsive/component.js';
5
5
  import 'react';
6
+ import 'react-merge-refs';
6
7
  import 'classnames';
7
- import './colors.module-d0f9b310.js';
8
+ import './hooks/useSkeleton.js';
9
+ import '@alfalab/core-components-skeleton/modern';
10
+ import '@alfalab/hooks';
11
+ import './colors.module-1a9450b1.js';
8
12
  import './title/component.js';
9
- import './common.module-47d6bc91.js';
13
+ import './common.module-151b3759.js';
10
14
 
11
15
  const Typography = {
12
16
  Title,
@@ -0,0 +1 @@
1
+ export * from "./useSkeleton";
@@ -0,0 +1,4 @@
1
+ export { useSkeleton } from './useSkeleton.js';
2
+ import 'react';
3
+ import '@alfalab/core-components-skeleton/modern';
4
+ import '@alfalab/hooks';
@@ -0,0 +1,20 @@
1
+ /* hash: m4447 */
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_zkwz6.typography__skeletonText_zkwz6 {
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,51 @@
1
+ import React, { useState, useRef } from 'react';
2
+ import { Skeleton } from '@alfalab/core-components-skeleton/modern';
3
+ import { useLayoutEffect_SAFE_FOR_SSR } from '@alfalab/hooks';
4
+
5
+ const styles = {"skeletonText":"typography__skeletonText_zkwz6"};
6
+ require('./use-skeleton.css')
7
+
8
+ function useSkeleton(showSkeleton, skeletonProps) {
9
+ const [skeletonParams, setSkeletonParams] = useState();
10
+ const textRef = useRef(null);
11
+ useLayoutEffect_SAFE_FOR_SSR(() => {
12
+ if (showSkeleton && textRef.current) {
13
+ const style = getComputedStyle(textRef.current);
14
+ const textHeight = textRef.current.offsetHeight;
15
+ const fontSize = parseInt(style.fontSize, 10);
16
+ const lineHeight = parseInt(style.lineHeight, 10);
17
+ const padding = (lineHeight - fontSize) % 2 === 0
18
+ ? (lineHeight - fontSize) / 2
19
+ : (lineHeight - fontSize - 1) / 2;
20
+ const rows = skeletonProps?.rows
21
+ ? skeletonProps?.rows
22
+ : Math.ceil(textHeight / lineHeight);
23
+ setSkeletonParams({
24
+ height: lineHeight - padding * 2,
25
+ padding: `${padding}px 0`,
26
+ rows,
27
+ });
28
+ }
29
+ else {
30
+ setSkeletonParams(undefined);
31
+ }
32
+ }, [showSkeleton, skeletonProps?.rows]);
33
+ const renderSkeleton = (props) => {
34
+ if (showSkeleton && skeletonParams) {
35
+ return (React.createElement("div", { className: props.wrapperClassName, "data-test-id": props.dataTestId }, [...Array(skeletonParams.rows)].map((_, idx) => {
36
+ const width = Array.isArray(skeletonProps?.width)
37
+ ? skeletonProps?.width[idx]
38
+ : skeletonProps?.width;
39
+ return (
40
+ // eslint-disable-next-line react/no-array-index-key
41
+ React.createElement("div", { key: idx, style: { width, padding: skeletonParams.padding } },
42
+ React.createElement(Skeleton, { visible: true, className: styles.skeletonText },
43
+ React.createElement("div", { style: { height: skeletonParams.height } }))));
44
+ })));
45
+ }
46
+ return null;
47
+ };
48
+ return { renderSkeleton, textRef };
49
+ }
50
+
51
+ export { useSkeleton };
package/modern/index.js CHANGED
@@ -2,10 +2,14 @@ export { Typography } from './component.js';
2
2
  export { typographyPresets } from './presets.js';
3
3
  import './text/component.js';
4
4
  import 'react';
5
+ import 'react-merge-refs';
5
6
  import 'classnames';
6
- import './colors.module-d0f9b310.js';
7
+ import './hooks/useSkeleton.js';
8
+ import '@alfalab/core-components-skeleton/modern';
9
+ import '@alfalab/hooks';
10
+ import './colors.module-1a9450b1.js';
7
11
  import './title/index.js';
8
12
  import './title/component.js';
9
- import './common.module-47d6bc91.js';
13
+ import './common.module-151b3759.js';
10
14
  import './title-mobile/component.js';
11
15
  import './title-responsive/component.js';
@@ -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';
@@ -1,15 +1,47 @@
1
1
  import React, { forwardRef } from 'react';
2
+ import mergeRefs from 'react-merge-refs';
2
3
  import cn from 'classnames';
3
- import { c as colors } from '../colors.module-d0f9b310.js';
4
+ import { useSkeleton } from '../hooks/useSkeleton.js';
5
+ import { c as colors } from '../colors.module-1a9450b1.js';
6
+ import '@alfalab/core-components-skeleton/modern';
7
+ import '@alfalab/hooks';
4
8
 
5
- const styles = {"paragraph":"typography__paragraph_pm003","paragraphWithMargins":"typography__paragraphWithMargins_pm003","primary-large":"typography__primary-large_pm003","primary-medium":"typography__primary-medium_pm003","primary-small":"typography__primary-small_pm003","secondary-large":"typography__secondary-large_pm003","secondary-medium":"typography__secondary-medium_pm003","secondary-small":"typography__secondary-small_pm003","component":"typography__component_pm003","caps":"typography__caps_pm003","bold":"typography__bold_pm003","medium":"typography__medium_pm003","regular":"typography__regular_pm003","monospace":"typography__monospace_pm003","rowLimit1":"typography__rowLimit1_pm003","rowLimit2":"typography__rowLimit2_pm003","rowLimit3":"typography__rowLimit3_pm003"};
9
+ const 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"};
6
10
  require('./index.css')
7
11
 
8
- const Text = forwardRef(({ view = 'primary-medium', tag: Component = 'span', weight, monospaceNumbers = false, defaultMargins = true, color, className, dataTestId, children, rowLimit, ...restProps }, ref) => (React.createElement(Component, { className: cn({
9
- [styles.paragraph]: Component === 'p' && !defaultMargins,
10
- [styles.paragraphWithMargins]: Component === 'p' && defaultMargins,
11
- [styles.monospace]: monospaceNumbers,
12
- [styles[`rowLimit${rowLimit}`]]: rowLimit,
13
- }, className, color && colors[color], styles[view], weight && styles[weight]), "data-test-id": dataTestId, ref: ref, ...restProps }, children)));
12
+ const logWarning = (view) => {
13
+ if (process.env.NODE_ENV !== 'development') {
14
+ return;
15
+ }
16
+ const viewsMap = {
17
+ component: 'component-primary',
18
+ };
19
+ // eslint-disable-next-line no-console
20
+ console.warn(
21
+ // eslint-disable-next-line prefer-template
22
+ `@alfalab/core-components/typography: view='${view}' будет удален в следующих мажорных версиях. ` +
23
+ `Используйте view='${viewsMap[view]}'.`);
24
+ };
25
+ const Text = forwardRef(({ view = 'primary-medium', tag: Component = 'span', weight, monospaceNumbers = false, defaultMargins = true, color, className, dataTestId, children, rowLimit, showSkeleton, skeletonProps, ...restProps }, ref) => {
26
+ if (view === 'component') {
27
+ logWarning(view);
28
+ }
29
+ const { renderSkeleton, textRef } = useSkeleton(showSkeleton, skeletonProps);
30
+ const skeleton = renderSkeleton({
31
+ wrapperClassName: cn({
32
+ [styles.paragraphWithMargins]: Component === 'p' && defaultMargins,
33
+ }),
34
+ dataTestId,
35
+ });
36
+ if (skeleton) {
37
+ return skeleton;
38
+ }
39
+ return (React.createElement(Component, { className: cn({
40
+ [styles.paragraph]: Component === 'p' && !defaultMargins,
41
+ [styles.paragraphWithMargins]: Component === 'p' && defaultMargins,
42
+ [styles.monospace]: monospaceNumbers,
43
+ [styles[`rowLimit${rowLimit}`]]: rowLimit,
44
+ }, className, color && colors[color], styles[view], weight && styles[weight]), "data-test-id": dataTestId, ref: mergeRefs([ref, textRef]), ...restProps }, children));
45
+ });
14
46
 
15
47
  export { Text };
@@ -1,4 +1,4 @@
1
- /* hash: 1o1yf */
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
- } .typography__paragraph_pm003 {
20
+ } .typography__paragraph_nz4l3 {
21
21
  margin: 0;
22
22
  padding: 0;
23
- } .typography__paragraphWithMargins_pm003 {
23
+ } .typography__paragraphWithMargins_nz4l3 {
24
24
  padding: 0;
25
25
  margin: var(--text-paragraph-margin-bottom);
26
- } .typography__primary-large_pm003 {
26
+ } .typography__primary-large_nz4l3 {
27
27
  font-size: 18px;
28
28
  line-height: 24px;
29
29
  font-weight: 400;
30
- } .typography__primary-medium_pm003 {
30
+ } .typography__primary-medium_nz4l3 {
31
31
  font-size: 16px;
32
32
  line-height: 24px;
33
33
  font-weight: 400;
34
- } .typography__primary-small_pm003 {
34
+ } .typography__primary-small_nz4l3 {
35
35
  font-size: 14px;
36
36
  line-height: 20px;
37
37
  font-weight: 400;
38
- } .typography__secondary-large_pm003 {
38
+ } .typography__secondary-large_nz4l3 {
39
39
  font-size: 13px;
40
40
  line-height: 16px;
41
41
  font-weight: 400;
42
- } .typography__secondary-medium_pm003 {
42
+ } .typography__secondary-medium_nz4l3 {
43
43
  font-size: 12px;
44
44
  line-height: 16px;
45
45
  font-weight: 400;
46
- } .typography__secondary-small_pm003 {
46
+ } .typography__secondary-small_nz4l3 {
47
47
  font-size: 11px;
48
48
  line-height: 16px;
49
49
  font-weight: 400;
50
- } .typography__component_pm003 {
50
+ } .typography__component_nz4l3 {
51
51
  font-size: 16px;
52
52
  line-height: 20px;
53
53
  font-weight: 400;
54
- } .typography__caps_pm003 {
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
- } .typography__bold_pm003 {
68
+ } .typography__bold_nz4l3 {
61
69
  font-weight: bold;
62
- } .typography__medium_pm003 {
70
+ } .typography__medium_nz4l3 {
63
71
  font-weight: 500;
64
- } .typography__regular_pm003 {
72
+ } .typography__regular_nz4l3 {
65
73
  font-weight: normal;
66
- } .typography__monospace_pm003 {
74
+ } .typography__monospace_nz4l3 {
67
75
  font-variant-numeric: tabular-nums;
68
- } .typography__rowLimit1_pm003 {
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
- } .typography__rowLimit2_pm003 {
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
- } .typography__rowLimit3_pm003 {
87
+ } .typography__rowLimit3_nz4l3 {
80
88
  -webkit-line-clamp: 3;
81
89
  display: -webkit-box;
82
90
  -webkit-box-orient: vertical;
@@ -1,4 +1,8 @@
1
1
  export { Text } from './component.js';
2
2
  import 'react';
3
+ import 'react-merge-refs';
3
4
  import 'classnames';
4
- import '../colors.module-d0f9b310.js';
5
+ import '../hooks/useSkeleton.js';
6
+ import '@alfalab/core-components-skeleton/modern';
7
+ import '@alfalab/hooks';
8
+ import '../colors.module-1a9450b1.js';
@@ -1,14 +1,14 @@
1
- /* hash: 7cyus */
2
- .typography__component_n0ewz {
1
+ /* hash: 1uj85 */
2
+ .typography__component_a4bxl {
3
3
  margin: 0;
4
4
  padding: 0
5
5
  }
6
- .typography__component_n0ewz.typography__bold_n0ewz {
6
+ .typography__component_a4bxl.typography__bold_a4bxl {
7
7
  font-weight: bold;
8
8
  }
9
- .typography__component_n0ewz.typography__medium_n0ewz {
9
+ .typography__component_a4bxl.typography__medium_a4bxl {
10
10
  font-weight: 500;
11
11
  }
12
- .typography__component_n0ewz.typography__regular_n0ewz {
12
+ .typography__component_a4bxl.typography__regular_a4bxl {
13
13
  font-weight: normal;
14
14
  }
@@ -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?: "medium" | "xlarge" | "large" | "small" | "xsmall" | undefined;
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?: "regular" | "medium" | "bold" | undefined;
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 };
@@ -1,7 +1,21 @@
1
1
  import React, { forwardRef } from 'react';
2
+ import mergeRefs from 'react-merge-refs';
2
3
  import cn from 'classnames';
3
- import { c as colors } from '../colors.module-d0f9b310.js';
4
+ import { useSkeleton } from '../hooks/useSkeleton.js';
5
+ import { c as colors } from '../colors.module-1a9450b1.js';
6
+ import '@alfalab/core-components-skeleton/modern';
7
+ import '@alfalab/hooks';
4
8
 
5
- const Title = forwardRef(({ tag: Component = 'div', view = 'medium', font = 'styrene', weight = font === 'styrene' ? 'medium' : 'bold', defaultMargins = false, color, className, dataTestId, children, rowLimit, styles, ...restProps }, ref) => (React.createElement(Component, { className: cn(styles.component, className, styles[`${font}-${view}`], defaultMargins && styles[`margins-${view}`], styles[weight], color && colors[color], { [styles[`rowLimit${rowLimit}`]]: rowLimit }), "data-test-id": dataTestId, ref: ref, ...restProps }, children)));
9
+ const Title = forwardRef(({ tag: Component = 'div', view = 'medium', font = 'styrene', weight = font === 'styrene' ? 'medium' : 'bold', defaultMargins = false, color, className, dataTestId, children, rowLimit, styles, skeletonProps, showSkeleton, ...restProps }, ref) => {
10
+ const { renderSkeleton, textRef } = useSkeleton(showSkeleton, skeletonProps);
11
+ const skeleton = renderSkeleton({
12
+ wrapperClassName: cn(defaultMargins && styles[`margins-${view}`]),
13
+ dataTestId,
14
+ });
15
+ if (skeleton) {
16
+ return skeleton;
17
+ }
18
+ return (React.createElement(Component, { className: cn(styles.component, className, styles[`${font}-${view}`], defaultMargins && styles[`margins-${view}`], styles[weight], color && colors[color], { [styles[`rowLimit${rowLimit}`]]: rowLimit }), "data-test-id": dataTestId, ref: mergeRefs([ref, textRef]), ...restProps }, children));
19
+ });
6
20
 
7
21
  export { Title };