@alfalab/core-components-typography 6.0.13-alfasans → 6.0.14

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 (108) hide show
  1. package/colors.css +20 -20
  2. package/colors.module.css.js +1 -1
  3. package/cssm/text/component.js +18 -16
  4. package/cssm/text/component.js.map +1 -1
  5. package/cssm/text/index.module.css +21 -41
  6. package/cssm/title/common.module.css +8 -1
  7. package/cssm/title/component.d.ts +8 -2
  8. package/cssm/title/component.js +19 -14
  9. package/cssm/title/component.js.map +1 -1
  10. package/cssm/title/index.d.ts +4 -1
  11. package/cssm/title/index.module.css +74 -23
  12. package/cssm/title/utils.d.ts +1 -0
  13. package/cssm/title/utils.js +16 -0
  14. package/cssm/title/utils.js.map +1 -0
  15. package/cssm/title-mobile/component.d.ts +4 -1
  16. package/cssm/title-mobile/index.module.css +45 -28
  17. package/cssm/title-responsive/component.d.ts +4 -1
  18. package/esm/colors.css +20 -20
  19. package/esm/colors.module.css.js +1 -1
  20. package/esm/text/component.js +19 -17
  21. package/esm/text/component.js.map +1 -1
  22. package/esm/text/index.css +61 -81
  23. package/esm/text/index.module.css.js +1 -1
  24. package/esm/text/index.module.css.js.map +1 -1
  25. package/esm/title/common.css +13 -6
  26. package/esm/title/common.module.css.js +1 -1
  27. package/esm/title/common.module.css.js.map +1 -1
  28. package/esm/title/component.d.ts +8 -2
  29. package/esm/title/component.js +19 -14
  30. package/esm/title/component.js.map +1 -1
  31. package/esm/title/index.css +89 -38
  32. package/esm/title/index.d.ts +4 -1
  33. package/esm/title/index.module.css.js +1 -1
  34. package/esm/title/index.module.css.js.map +1 -1
  35. package/esm/title/utils.d.ts +1 -0
  36. package/esm/title/utils.js +12 -0
  37. package/esm/title/utils.js.map +1 -0
  38. package/esm/title-mobile/component.d.ts +4 -1
  39. package/esm/title-mobile/index.css +70 -53
  40. package/esm/title-mobile/index.module.css.js +1 -1
  41. package/esm/title-responsive/component.d.ts +4 -1
  42. package/modern/colors.css +20 -20
  43. package/modern/colors.module.css.js +1 -1
  44. package/modern/text/component.js +19 -17
  45. package/modern/text/component.js.map +1 -1
  46. package/modern/text/index.css +61 -81
  47. package/modern/text/index.module.css.js +1 -1
  48. package/modern/text/index.module.css.js.map +1 -1
  49. package/modern/title/common.css +13 -6
  50. package/modern/title/common.module.css.js +1 -1
  51. package/modern/title/common.module.css.js.map +1 -1
  52. package/modern/title/component.d.ts +8 -2
  53. package/modern/title/component.js +18 -13
  54. package/modern/title/component.js.map +1 -1
  55. package/modern/title/index.css +89 -38
  56. package/modern/title/index.d.ts +4 -1
  57. package/modern/title/index.module.css.js +1 -1
  58. package/modern/title/index.module.css.js.map +1 -1
  59. package/modern/title/utils.d.ts +1 -0
  60. package/modern/title/utils.js +12 -0
  61. package/modern/title/utils.js.map +1 -0
  62. package/modern/title-mobile/component.d.ts +4 -1
  63. package/modern/title-mobile/index.css +70 -53
  64. package/modern/title-mobile/index.module.css.js +1 -1
  65. package/modern/title-responsive/component.d.ts +4 -1
  66. package/moderncssm/text/component.js +19 -17
  67. package/moderncssm/text/component.js.map +1 -1
  68. package/moderncssm/text/index.module.css +21 -38
  69. package/moderncssm/title/common.module.css +10 -1
  70. package/moderncssm/title/component.d.ts +8 -2
  71. package/moderncssm/title/component.js +18 -13
  72. package/moderncssm/title/component.js.map +1 -1
  73. package/moderncssm/title/index.d.ts +4 -1
  74. package/moderncssm/title/index.module.css +79 -20
  75. package/moderncssm/title/utils.d.ts +1 -0
  76. package/moderncssm/title/utils.js +12 -0
  77. package/moderncssm/title/utils.js.map +1 -0
  78. package/moderncssm/title-mobile/component.d.ts +4 -1
  79. package/moderncssm/title-mobile/index.module.css +40 -25
  80. package/moderncssm/title-responsive/component.d.ts +4 -1
  81. package/package.json +6 -6
  82. package/src/common.module.css +10 -1
  83. package/src/text/component.tsx +36 -31
  84. package/src/title/component.tsx +41 -31
  85. package/src/title/index.module.css +8 -0
  86. package/src/title/utils.ts +14 -0
  87. package/text/component.js +18 -16
  88. package/text/component.js.map +1 -1
  89. package/text/index.css +61 -81
  90. package/text/index.module.css.js +1 -1
  91. package/text/index.module.css.js.map +1 -1
  92. package/title/common.css +13 -6
  93. package/title/common.module.css.js +1 -1
  94. package/title/common.module.css.js.map +1 -1
  95. package/title/component.d.ts +8 -2
  96. package/title/component.js +18 -13
  97. package/title/component.js.map +1 -1
  98. package/title/index.css +89 -38
  99. package/title/index.d.ts +4 -1
  100. package/title/index.module.css.js +1 -1
  101. package/title/index.module.css.js.map +1 -1
  102. package/title/utils.d.ts +1 -0
  103. package/title/utils.js +16 -0
  104. package/title/utils.js.map +1 -0
  105. package/title-mobile/component.d.ts +4 -1
  106. package/title-mobile/index.css +70 -53
  107. package/title-mobile/index.module.css.js +1 -1
  108. package/title-responsive/component.d.ts +4 -1
@@ -1 +1 @@
1
- {"version":3,"file":"component.js","sources":["../../src/title/component.tsx"],"sourcesContent":["import React, { forwardRef, type HTMLAttributes } from 'react';\nimport mergeRefs from 'react-merge-refs';\nimport cn from 'classnames';\n\nimport { type TextSkeletonProps, useSkeleton } from '@alfalab/core-components-skeleton';\n\nimport { type Color } from '../colors';\n\nimport colors from '../colors.module.css';\nimport commonStyles from './common.module.css';\n\ntype NativeProps = HTMLAttributes<HTMLHeadingElement>;\n\nexport type TitleProps = Omit<NativeProps, 'color'> & {\n /**\n * HTML тег\n */\n tag: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'div';\n\n /**\n * [Вариант начертания](?path=/docs/guidelines-typography--page)\n */\n view?: 'xlarge' | 'large' | 'medium' | 'small' | 'xsmall';\n\n /**\n * Цвет текста\n */\n color?: Color;\n\n /**\n * Толщина шрифта\n */\n weight?: 'regular' | 'medium' | 'bold' | 'semibold';\n\n /**\n * Шрифт текста\n */\n font?: 'styrene' | 'system';\n\n /**\n * Добавляет отступы\n */\n defaultMargins?: boolean;\n\n /**\n * Css-класс для стилизации (native prop)\n */\n className?: string;\n\n /**\n * Id компонента для тестов\n */\n dataTestId?: string;\n\n /**\n * Контент (native prop)\n */\n children?: React.ReactNode;\n\n /**\n * Количество строк\n */\n rowLimit?: 1 | 2 | 3;\n\n /**\n * Показать скелетон\n */\n showSkeleton?: boolean;\n\n /**\n * Пропы для скелетона\n */\n skeletonProps?: TextSkeletonProps;\n\n /**\n * Значение по-умолчанию для хука useMatchMedia\n */\n defaultMatchMediaValue?: boolean | (() => boolean);\n};\n\ntype PrivateProps = {\n styles: {\n [key: string]: string;\n };\n platform: 'mobile' | 'desktop';\n};\n\ntype TitleElementType = HTMLHeadingElement | HTMLDivElement;\n\nexport const TitleBase = forwardRef<TitleElementType, TitleProps & PrivateProps>(\n (\n {\n tag: Component = 'div',\n view = 'medium',\n font,\n platform,\n weight = 'bold',\n defaultMargins = false,\n color,\n className,\n dataTestId,\n children,\n rowLimit,\n styles,\n skeletonProps,\n showSkeleton,\n ...restProps\n },\n ref,\n ) => {\n const { renderSkeleton, textRef } = useSkeleton(showSkeleton, skeletonProps);\n\n const skeleton = renderSkeleton({\n wrapperClassName: cn(defaultMargins && styles[`margins-${view}`]),\n dataTestId,\n });\n\n if (skeleton) {\n return skeleton;\n }\n\n return (\n <Component\n className={cn(\n commonStyles.component,\n styles.component,\n className,\n styles[`${weight === 'regular' ? 'regular-' : ''}${view}`],\n defaultMargins && styles[`margins-${view}`],\n color && colors[color],\n {\n [commonStyles[`rowLimit${rowLimit}`]]: rowLimit,\n [commonStyles.transparent]: showSkeleton,\n },\n )}\n data-test-id={dataTestId}\n ref={mergeRefs([ref, textRef])}\n {...restProps}\n >\n {children}\n </Component>\n );\n },\n);\n"],"names":[],"mappings":";;;;;;;AAyFa,MAAA,SAAS,GAAG,UAAU,CAC/B,CACI,EACI,GAAG,EAAE,SAAS,GAAG,KAAK,EACtB,IAAI,GAAG,QAAQ,EACf,IAAI,EACJ,QAAQ,EACR,MAAM,GAAG,MAAM,EACf,cAAc,GAAG,KAAK,EACtB,KAAK,EACL,SAAS,EACT,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,aAAa,EACb,YAAY,EACZ,GAAG,SAAS,EACf,EACD,GAAG,KACH;AACA,IAAA,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,GAAG,WAAW,CAAC,YAAY,EAAE,aAAa,CAAC;IAE5E,MAAM,QAAQ,GAAG,cAAc,CAAC;QAC5B,gBAAgB,EAAE,EAAE,CAAC,cAAc,IAAI,MAAM,CAAC,CAAW,QAAA,EAAA,IAAI,CAAE,CAAA,CAAC,CAAC;QACjE,UAAU;AACb,KAAA,CAAC;IAEF,IAAI,QAAQ,EAAE;AACV,QAAA,OAAO,QAAQ;;IAGnB,QACI,KAAC,CAAA,aAAA,CAAA,SAAS,EACN,EAAA,SAAS,EAAE,EAAE,CACT,YAAY,CAAC,SAAS,EACtB,MAAM,CAAC,SAAS,EAChB,SAAS,EACT,MAAM,CAAC,CAAG,EAAA,MAAM,KAAK,SAAS,GAAG,UAAU,GAAG,EAAE,CAAA,EAAG,IAAI,CAAE,CAAA,CAAC,EAC1D,cAAc,IAAI,MAAM,CAAC,CAAW,QAAA,EAAA,IAAI,CAAE,CAAA,CAAC,EAC3C,KAAK,IAAI,MAAM,CAAC,KAAK,CAAC,EACtB;YACI,CAAC,YAAY,CAAC,CAAW,QAAA,EAAA,QAAQ,EAAE,CAAC,GAAG,QAAQ;AAC/C,YAAA,CAAC,YAAY,CAAC,WAAW,GAAG,YAAY;AAC3C,SAAA,CACJ,kBACa,UAAU,EACxB,GAAG,EAAE,SAAS,CAAC,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,EAC1B,GAAA,SAAS,IAEZ,QAAQ,CACD;AAEpB,CAAC;;;;"}
1
+ {"version":3,"file":"component.js","sources":["../../src/title/component.tsx"],"sourcesContent":["import React, { type ComponentProps, forwardRef, Fragment, type HTMLAttributes } from 'react';\nimport mergeRefs from 'react-merge-refs';\nimport cn from 'classnames';\n\nimport { isObject } from '@alfalab/core-components-shared';\nimport { type TextSkeletonProps, useSkeleton } from '@alfalab/core-components-skeleton';\n\nimport { type Color } from '../colors';\n\nimport { getDefaultWeight } from './utils';\n\nimport colors from '../colors.module.css';\nimport commonStyles from './common.module.css';\n\ntype NativeProps = HTMLAttributes<HTMLHeadingElement>;\n\nexport type TitleProps = Omit<NativeProps, 'color'> & {\n /**\n * HTML тег\n */\n tag: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'div';\n\n /**\n * [Вариант начертания](?path=/docs/guidelines-typography--page)\n */\n view?: 'xlarge' | 'large' | 'medium' | 'small' | 'xsmall';\n\n /**\n * Цвет текста\n */\n color?: Color;\n\n /**\n * Толщина шрифта\n */\n weight?: 'regular' | 'medium' | 'bold' | 'semibold';\n\n /**\n * Шрифт текста\n */\n font?: 'styrene' | 'system' | 'alfasans' | { font: 'alfasans'; systemCompat: boolean };\n\n /**\n * Добавляет отступы\n */\n defaultMargins?: boolean;\n\n /**\n * Css-класс для стилизации (native prop)\n */\n className?: string;\n\n /**\n * Id компонента для тестов\n */\n dataTestId?: string;\n\n /**\n * Контент (native prop)\n */\n children?: React.ReactNode;\n\n /**\n * Количество строк\n */\n rowLimit?: 1 | 2 | 3;\n\n /**\n * Показать скелетон\n */\n showSkeleton?: boolean;\n\n /**\n * Пропы для скелетона\n */\n skeletonProps?: TextSkeletonProps;\n\n /**\n * Значение по-умолчанию для хука useMatchMedia\n */\n defaultMatchMediaValue?: boolean | (() => boolean);\n};\n\ntype PrivateProps = {\n styles: {\n [key: string]: string;\n };\n platform: 'mobile' | 'desktop';\n};\n\ntype TitleElementType = HTMLHeadingElement | HTMLDivElement;\n\nexport const TitleBase = forwardRef<TitleElementType, TitleProps & PrivateProps>(\n (\n {\n tag: Component = 'div',\n view = 'medium',\n font = 'styrene',\n platform,\n weight = getDefaultWeight(isObject(font) ? font.font : font, platform),\n defaultMargins = false,\n color,\n className,\n dataTestId,\n children,\n rowLimit,\n styles,\n skeletonProps,\n showSkeleton,\n ...restProps\n },\n ref,\n ) => {\n const { renderSkeleton, textRef } = useSkeleton(showSkeleton, skeletonProps);\n const Root = showSkeleton ? 'div' : Fragment;\n const rootProps: ComponentProps<typeof Root> = showSkeleton\n ? { className: cn(commonStyles.root, className) }\n : {};\n\n return (\n <Root {...rootProps}>\n <Component\n className={cn(\n commonStyles.component,\n styles.component,\n !showSkeleton && className,\n styles[`${weight === 'regular' ? 'regular-' : ''}${view}`],\n defaultMargins && styles[`margins-${view}`],\n color && colors[color],\n {\n [commonStyles[`rowLimit${rowLimit}`]]: rowLimit,\n [commonStyles.transparent]: showSkeleton,\n [styles.font]:\n (isObject(font) && !font.systemCompat) || !(font === 'system'),\n },\n )}\n data-test-id={dataTestId}\n ref={mergeRefs([ref, textRef])}\n {...restProps}\n >\n {children}\n </Component>\n {showSkeleton && (\n <div className={commonStyles.skeleton}>\n {renderSkeleton({\n wrapperClassName: cn(defaultMargins && styles[`margins-${view}`]),\n dataTestId,\n })}\n </div>\n )}\n </Root>\n );\n },\n);\n"],"names":[],"mappings":";;;;;;;;;AA4FO,MAAM,SAAS,GAAG,UAAU,CAC/B,CACI,EACI,GAAG,EAAE,SAAS,GAAG,KAAK,EACtB,IAAI,GAAG,QAAQ,EACf,IAAI,GAAG,SAAS,EAChB,QAAQ,EACR,MAAM,GAAG,gBAAgB,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,GAAG,IAAI,EAAE,QAAQ,CAAC,EACtE,cAAc,GAAG,KAAK,EACtB,KAAK,EACL,SAAS,EACT,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,aAAa,EACb,YAAY,EACZ,GAAG,SAAS,EACf,EACD,GAAG,KACH;AACA,IAAA,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,GAAG,WAAW,CAAC,YAAY,EAAE,aAAa,CAAC;IAC5E,MAAM,IAAI,GAAG,YAAY,GAAG,KAAK,GAAG,QAAQ;IAC5C,MAAM,SAAS,GAAgC;AAC3C,UAAE,EAAE,SAAS,EAAE,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,SAAS,CAAC;UAC7C,EAAE;AAER,IAAA,QACI,KAAA,CAAA,aAAA,CAAC,IAAI,EAAA,EAAA,GAAK,SAAS,EAAA;QACf,KAAC,CAAA,aAAA,CAAA,SAAS,EACN,EAAA,SAAS,EAAE,EAAE,CACT,YAAY,CAAC,SAAS,EACtB,MAAM,CAAC,SAAS,EAChB,CAAC,YAAY,IAAI,SAAS,EAC1B,MAAM,CAAC,CAAA,EAAG,MAAM,KAAK,SAAS,GAAG,UAAU,GAAG,EAAE,GAAG,IAAI,CAAA,CAAE,CAAC,EAC1D,cAAc,IAAI,MAAM,CAAC,CAAA,QAAA,EAAW,IAAI,CAAA,CAAE,CAAC,EAC3C,KAAK,IAAI,MAAM,CAAC,KAAK,CAAC,EACtB;gBACI,CAAC,YAAY,CAAC,CAAW,QAAA,EAAA,QAAQ,EAAE,CAAC,GAAG,QAAQ;AAC/C,gBAAA,CAAC,YAAY,CAAC,WAAW,GAAG,YAAY;gBACxC,CAAC,MAAM,CAAC,IAAI,GACR,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,KAAK,EAAE,IAAI,KAAK,QAAQ,CAAC;AACrE,aAAA,CACJ,kBACa,UAAU,EACxB,GAAG,EAAE,SAAS,CAAC,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,KAC1B,SAAS,EAAA,EAEZ,QAAQ,CACD;QACX,YAAY,KACT,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,YAAY,CAAC,QAAQ,EAChC,EAAA,cAAc,CAAC;YACZ,gBAAgB,EAAE,EAAE,CAAC,cAAc,IAAI,MAAM,CAAC,CAAW,QAAA,EAAA,IAAI,CAAE,CAAA,CAAC,CAAC;YACjE,UAAU;AACb,SAAA,CAAC,CACA,CACT,CACE;AAEf,CAAC;;;;"}
@@ -5,7 +5,10 @@ declare const Title: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<H
5
5
  view?: "xlarge" | "large" | "medium" | "small" | "xsmall";
6
6
  color?: import("..").Color;
7
7
  weight?: "regular" | "medium" | "bold" | "semibold";
8
- font?: "styrene" | "system";
8
+ font?: "styrene" | "system" | "alfasans" | {
9
+ font: "alfasans";
10
+ systemCompat: boolean;
11
+ };
9
12
  defaultMargins?: boolean;
10
13
  className?: string;
11
14
  dataTestId?: string;
@@ -3,82 +3,141 @@
3
3
  font-size: 48px;
4
4
  line-height: 52px;
5
5
  font-weight: 700;
6
- letter-spacing: 0.1px;
7
- font-family: var(--font-family-alfasans);
6
+ font-family: var(--font-family-system);
8
7
  }
9
8
 
9
+ .xlarge.font {
10
+ line-height: 64px;
11
+ font-weight: 500;
12
+ font-feature-settings: 'ss01';
13
+ font-family: var(--font-family-styrene);
14
+ }
15
+
10
16
  .regular-xlarge {
11
17
  font-size: 48px;
12
18
  line-height: 52px;
13
19
  font-weight: 400;
14
- letter-spacing: -2.1px;
15
- font-family: var(--font-family-alfasans);
20
+ font-family: var(--font-family-system);
16
21
  }
17
22
 
23
+ .regular-xlarge.font {
24
+ line-height: 64px;
25
+ font-feature-settings: 'ss01';
26
+ font-family: var(--font-family-styrene);
27
+ }
28
+
18
29
  .large {
19
30
  font-size: 40px;
20
31
  line-height: 48px;
21
32
  font-weight: 700;
22
- letter-spacing: 0.1px;
23
- font-family: var(--font-family-alfasans);
33
+ font-family: var(--font-family-system);
24
34
  }
25
35
 
36
+ .large.font {
37
+ font-weight: 500;
38
+ font-feature-settings: 'ss01';
39
+ font-family: var(--font-family-styrene);
40
+ }
41
+
26
42
  .regular-large {
27
43
  font-size: 40px;
28
44
  line-height: 48px;
29
45
  font-weight: 400;
30
- letter-spacing: -1.7px;
31
- font-family: var(--font-family-alfasans);
46
+ font-family: var(--font-family-system);
32
47
  }
33
48
 
49
+ .regular-large.font {
50
+ font-feature-settings: 'ss01';
51
+ font-family: var(--font-family-styrene);
52
+ }
53
+
34
54
  .medium {
35
55
  font-size: 30px;
36
56
  line-height: 36px;
37
57
  font-weight: 700;
38
- letter-spacing: 0.1px;
39
- font-family: var(--font-family-alfasans);
58
+ font-family: var(--font-family-system);
40
59
  }
41
60
 
61
+ .medium.font {
62
+ font-size: 32px;
63
+ line-height: 40px;
64
+ font-weight: 500;
65
+ font-feature-settings: 'ss01';
66
+ font-family: var(--font-family-styrene);
67
+ }
68
+
42
69
  .regular-medium {
43
70
  font-size: 30px;
44
71
  line-height: 36px;
45
72
  font-weight: 400;
46
- letter-spacing: -1.25px;
47
- font-family: var(--font-family-alfasans);
73
+ font-family: var(--font-family-system);
48
74
  }
49
75
 
76
+ .regular-medium.font {
77
+ font-size: 32px;
78
+ line-height: 40px;
79
+ font-feature-settings: 'ss01';
80
+ font-family: var(--font-family-styrene);
81
+ }
82
+
50
83
  .small {
51
84
  font-size: 22px;
52
85
  line-height: 26px;
53
86
  font-weight: 700;
54
- letter-spacing: 0.2px;
55
- font-family: var(--font-family-alfasans);
87
+ font-family: var(--font-family-system);
56
88
  }
57
89
 
90
+ .small.font {
91
+ font-size: 24px;
92
+ line-height: 32px;
93
+ font-weight: 500;
94
+ font-feature-settings: 'ss01';
95
+ font-family: var(--font-family-styrene);
96
+ }
97
+
58
98
  .regular-small {
59
99
  font-size: 22px;
60
100
  line-height: 26px;
61
101
  font-weight: 400;
62
- letter-spacing: -0.8px;
63
- font-family: var(--font-family-alfasans);
102
+ font-family: var(--font-family-system);
64
103
  }
65
104
 
105
+ .regular-small.font {
106
+ font-size: 24px;
107
+ line-height: 32px;
108
+ font-feature-settings: 'ss01';
109
+ font-family: var(--font-family-styrene);
110
+ }
111
+
66
112
  .xsmall {
67
113
  font-size: 18px;
68
114
  line-height: 22px;
69
115
  font-weight: 700;
70
- letter-spacing: 0.38px;
71
- font-family: var(--font-family-alfasans);
116
+ font-family: var(--font-family-system);
72
117
  }
73
118
 
119
+ .xsmall.font {
120
+ font-size: 20px;
121
+ line-height: 24px;
122
+ font-weight: 500;
123
+ font-feature-settings: 'ss01';
124
+ font-family: var(--font-family-styrene);
125
+ }
126
+
74
127
  .regular-xsmall {
75
128
  font-size: 18px;
76
129
  line-height: 22px;
77
130
  font-weight: 400;
78
- letter-spacing: -0.36px;
79
- font-family: var(--font-family-alfasans);
131
+ font-family: var(--font-family-system);
80
132
  }
81
133
 
134
+ .regular-xsmall.font {
135
+ font-size: 20px;
136
+ line-height: 24px;
137
+ font-feature-settings: 'ss01';
138
+ font-family: var(--font-family-styrene);
139
+ }
140
+
82
141
  .component.margins-xlarge {
83
142
  margin: var(--gap-0) var(--gap-0) var(--gap-24);
84
143
  }
@@ -0,0 +1 @@
1
+ export declare function getDefaultWeight(font: 'styrene' | 'system' | 'alfasans', platform: 'mobile' | 'desktop'): "medium" | "bold" | "semibold";
@@ -0,0 +1,12 @@
1
+ function getDefaultWeight(font, platform) {
2
+ if (font === 'styrene' || font === 'alfasans') {
3
+ return 'medium';
4
+ }
5
+ if (platform === 'desktop') {
6
+ return 'bold';
7
+ }
8
+ return 'semibold';
9
+ }
10
+
11
+ export { getDefaultWeight };
12
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sources":["../../src/title/utils.ts"],"sourcesContent":["export function getDefaultWeight(\n font: 'styrene' | 'system' | 'alfasans',\n platform: 'mobile' | 'desktop',\n) {\n if (font === 'styrene' || font === 'alfasans') {\n return 'medium';\n }\n\n if (platform === 'desktop') {\n return 'bold';\n }\n\n return 'semibold';\n}\n"],"names":[],"mappings":"AAAgB,SAAA,gBAAgB,CAC5B,IAAuC,EACvC,QAA8B,EAAA;IAE9B,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,UAAU,EAAE;AAC3C,QAAA,OAAO,QAAQ;;AAGnB,IAAA,IAAI,QAAQ,KAAK,SAAS,EAAE;AACxB,QAAA,OAAO,MAAM;;AAGjB,IAAA,OAAO,UAAU;AACrB;;;;"}
@@ -4,7 +4,10 @@ export declare const TitleMobile: React.ForwardRefExoticComponent<Omit<React.HTM
4
4
  view?: "xlarge" | "large" | "medium" | "small" | "xsmall";
5
5
  color?: import("..").Color;
6
6
  weight?: "regular" | "medium" | "bold" | "semibold";
7
- font?: "styrene" | "system";
7
+ font?: "styrene" | "system" | "alfasans" | {
8
+ font: "alfasans";
9
+ systemCompat: boolean;
10
+ };
8
11
  defaultMargins?: boolean;
9
12
  className?: string;
10
13
  dataTestId?: string;
@@ -2,111 +2,126 @@
2
2
  .xlarge {
3
3
  font-size: 34px;
4
4
  line-height: 40px;
5
- font-weight: 500;
6
- letter-spacing: -0.32px;
7
- font-family: var(--font-family-alfasans);
5
+ font-weight: 600;
6
+ font-family: var(--font-family-system);
8
7
  }
9
8
 
10
9
  .xlarge.font {
10
+ font-weight: 500;
11
+ font-feature-settings: 'ss01';
12
+ font-family: var(--font-family-styrene);
11
13
  }
12
14
 
13
15
  .regular-xlarge {
14
16
  font-size: 34px;
15
17
  line-height: 40px;
16
18
  font-weight: 400;
17
- letter-spacing: -1.36px;
18
- font-family: var(--font-family-alfasans);
19
+ font-family: var(--font-family-system);
19
20
  }
20
21
 
21
22
  .regular-xlarge.system {
23
+ font-feature-settings: 'ss01';
24
+ font-family: var(--font-family-styrene);
22
25
  }
23
26
 
24
27
  .large {
25
28
  font-size: 30px;
26
29
  line-height: 36px;
27
- font-weight: 500;
28
- letter-spacing: -0.25px;
29
- font-family: var(--font-family-alfasans);
30
+ font-weight: 600;
31
+ font-family: var(--font-family-system);
30
32
  }
31
33
 
32
34
  .large.font {
35
+ font-weight: 500;
36
+ font-feature-settings: 'ss01';
37
+ font-family: var(--font-family-styrene);
33
38
  }
34
39
 
35
40
  .regular-large {
36
41
  font-size: 30px;
37
42
  line-height: 36px;
38
43
  font-weight: 400;
39
- letter-spacing: -1.25px;
40
- font-family: var(--font-family-alfasans);
44
+ font-family: var(--font-family-system);
41
45
  }
42
46
 
43
47
  .regular-large.system {
48
+ font-feature-settings: 'ss01';
49
+ font-family: var(--font-family-styrene);
44
50
  }
45
51
 
46
52
  .medium {
47
53
  font-size: 26px;
48
54
  line-height: 32px;
49
- font-weight: 500;
50
- letter-spacing: -0.25px;
51
- font-family: var(--font-family-alfasans);
55
+ font-weight: 600;
56
+ font-family: var(--font-family-system);
52
57
  }
53
58
 
54
59
  .medium.font {
60
+ font-weight: 500;
61
+ font-feature-settings: 'ss01';
62
+ font-family: var(--font-family-styrene);
55
63
  }
56
64
 
57
65
  .regular-medium {
58
66
  font-size: 26px;
59
67
  line-height: 32px;
60
68
  font-weight: 400;
61
- letter-spacing: -1px;
62
- font-family: var(--font-family-alfasans);
69
+ font-family: var(--font-family-system);
63
70
  }
64
71
 
65
72
  .regular-medium.system {
73
+ font-feature-settings: 'ss01';
74
+ font-family: var(--font-family-styrene);
66
75
  }
67
76
 
68
77
  .small {
69
78
  font-size: 20px;
70
79
  line-height: 28px;
71
- font-weight: 500;
72
- letter-spacing: -0.15px;
73
- font-family: var(--font-family-alfasans);
80
+ font-weight: 600;
81
+ font-family: var(--font-family-system);
74
82
  }
75
83
 
76
84
  .small.font {
85
+ font-weight: 500;
86
+ font-feature-settings: 'ss01';
87
+ font-family: var(--font-family-styrene);
77
88
  }
78
89
 
79
90
  .regular-small {
80
91
  font-size: 20px;
81
92
  line-height: 28px;
82
93
  font-weight: 400;
83
- letter-spacing: -0.68px;
84
- font-family: var(--font-family-alfasans);
94
+ font-family: var(--font-family-system);
85
95
  }
86
96
 
87
97
  .regular-small.system {
98
+ font-feature-settings: 'ss01';
99
+ font-family: var(--font-family-styrene);
88
100
  }
89
101
 
90
102
  .xsmall {
91
103
  font-size: 16px;
92
104
  line-height: 20px;
93
- font-weight: 500;
94
- letter-spacing: 0.17px;
95
- font-family: var(--font-family-alfasans);
105
+ font-weight: 600;
106
+ font-family: var(--font-family-system);
96
107
  }
97
108
 
98
109
  .xsmall.font {
110
+ font-weight: 500;
111
+ font-feature-settings: 'ss01';
112
+ font-family: var(--font-family-styrene);
99
113
  }
100
114
 
101
115
  .regular-xsmall {
102
116
  font-size: 16px;
103
117
  line-height: 20px;
104
118
  font-weight: 400;
105
- letter-spacing: -0.24px;
106
- font-family: var(--font-family-alfasans);
119
+ font-family: var(--font-family-system);
107
120
  }
108
121
 
109
122
  .regular-xsmall.system {
123
+ font-feature-settings: 'ss01';
124
+ font-family: var(--font-family-styrene);
110
125
  }
111
126
 
112
127
  .component.margins-xlarge {
@@ -16,7 +16,10 @@ export declare const TitleResponsive: React.ForwardRefExoticComponent<Omit<React
16
16
  view?: "xlarge" | "large" | "medium" | "small" | "xsmall";
17
17
  color?: import("..").Color;
18
18
  weight?: "regular" | "medium" | "bold" | "semibold";
19
- font?: "styrene" | "system";
19
+ font?: "styrene" | "system" | "alfasans" | {
20
+ font: "alfasans";
21
+ systemCompat: boolean;
22
+ };
20
23
  defaultMargins?: boolean;
21
24
  className?: string;
22
25
  dataTestId?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfalab/core-components-typography",
3
- "version": "6.0.13-alfasans",
3
+ "version": "6.0.14",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "license": "MIT",
@@ -13,9 +13,9 @@
13
13
  "build": "rollup -c ../../tools/rollup/rollup.config.mjs --silent"
14
14
  },
15
15
  "dependencies": {
16
- "@alfalab/core-components-mq": "6.0.9-alfasans",
17
- "@alfalab/core-components-shared": "2.3.0-alfasans",
18
- "@alfalab/core-components-skeleton": "7.0.5-alfasans",
16
+ "@alfalab/core-components-mq": "^6.0.10",
17
+ "@alfalab/core-components-shared": "^2.4.0",
18
+ "@alfalab/core-components-skeleton": "^7.0.6",
19
19
  "classnames": "^2.5.1",
20
20
  "react-merge-refs": "^1.1.0",
21
21
  "tslib": "^2.4.0"
@@ -28,6 +28,6 @@
28
28
  "access": "public",
29
29
  "directory": "dist"
30
30
  },
31
- "themesVersion": "15.2.1-alfasans",
32
- "varsVersion": "11.4.0-alfasans"
31
+ "themesVersion": "15.2.1",
32
+ "varsVersion": "11.5.0"
33
33
  }
@@ -1,3 +1,12 @@
1
1
  .transparent {
2
- opacity: 0;
2
+ visibility: hidden;
3
+ }
4
+
5
+ .skeleton {
6
+ position: absolute;
7
+ inset: 0;
8
+ }
9
+
10
+ .root {
11
+ position: relative;
3
12
  }
@@ -1,4 +1,4 @@
1
- import React, { forwardRef, type HTMLAttributes } from 'react';
1
+ import React, { type ComponentProps, forwardRef, Fragment, type HTMLAttributes } from 'react';
2
2
  import mergeRefs from 'react-merge-refs';
3
3
  import cn from 'classnames';
4
4
 
@@ -119,39 +119,44 @@ export const Text = forwardRef<TextElementType, TextProps>(
119
119
  ref,
120
120
  ) => {
121
121
  const { renderSkeleton, textRef } = useSkeleton(showSkeleton, skeletonProps);
122
-
123
- const skeleton = renderSkeleton({
124
- wrapperClassName: cn({
125
- [styles.paragraphWithMargins]: Component === 'p' && defaultMargins,
126
- }),
127
- dataTestId,
128
- });
129
-
130
- if (skeleton) {
131
- return skeleton;
132
- }
122
+ const Root = showSkeleton ? 'div' : Fragment;
123
+ const rootProps: ComponentProps<typeof Root> = showSkeleton
124
+ ? { className: cn(styles.root, className) }
125
+ : {};
133
126
 
134
127
  return (
135
- <Component
136
- className={cn(
137
- {
138
- [styles.paragraph]: Component === 'p' && !defaultMargins,
139
- [styles.paragraphWithMargins]: Component === 'p' && defaultMargins,
140
- [styles.monospace]: monospaceNumbers,
141
- [styles[`rowLimit${rowLimit}`]]: rowLimit,
142
- [styles.transparent]: showSkeleton,
143
- },
144
- className,
145
- color && colors[color],
146
- styles[view],
147
- weight && styles[weight],
128
+ <Root {...rootProps}>
129
+ <Component
130
+ className={cn(
131
+ {
132
+ [styles.paragraph]: Component === 'p' && !defaultMargins,
133
+ [styles.paragraphWithMargins]: Component === 'p' && defaultMargins,
134
+ [styles.monospace]: monospaceNumbers,
135
+ [styles[`rowLimit${rowLimit}`]]: rowLimit,
136
+ [styles.transparent]: showSkeleton,
137
+ },
138
+ !showSkeleton && className,
139
+ color && colors[color],
140
+ styles[view],
141
+ weight && styles[weight],
142
+ )}
143
+ data-test-id={dataTestId}
144
+ ref={mergeRefs([ref, textRef])}
145
+ {...restProps}
146
+ >
147
+ {children}
148
+ </Component>
149
+ {showSkeleton && (
150
+ <div className={styles.skeleton}>
151
+ {renderSkeleton({
152
+ wrapperClassName: cn({
153
+ [styles.paragraphWithMargins]: Component === 'p' && defaultMargins,
154
+ }),
155
+ dataTestId,
156
+ })}
157
+ </div>
148
158
  )}
149
- data-test-id={dataTestId}
150
- ref={mergeRefs([ref, textRef])}
151
- {...restProps}
152
- >
153
- {children}
154
- </Component>
159
+ </Root>
155
160
  );
156
161
  },
157
162
  );
@@ -1,11 +1,14 @@
1
- import React, { forwardRef, type HTMLAttributes } from 'react';
1
+ import React, { type ComponentProps, forwardRef, Fragment, type HTMLAttributes } from 'react';
2
2
  import mergeRefs from 'react-merge-refs';
3
3
  import cn from 'classnames';
4
4
 
5
+ import { isObject } from '@alfalab/core-components-shared';
5
6
  import { type TextSkeletonProps, useSkeleton } from '@alfalab/core-components-skeleton';
6
7
 
7
8
  import { type Color } from '../colors';
8
9
 
10
+ import { getDefaultWeight } from './utils';
11
+
9
12
  import colors from '../colors.module.css';
10
13
  import commonStyles from './common.module.css';
11
14
 
@@ -35,7 +38,7 @@ export type TitleProps = Omit<NativeProps, 'color'> & {
35
38
  /**
36
39
  * Шрифт текста
37
40
  */
38
- font?: 'styrene' | 'system';
41
+ font?: 'styrene' | 'system' | 'alfasans' | { font: 'alfasans'; systemCompat: boolean };
39
42
 
40
43
  /**
41
44
  * Добавляет отступы
@@ -92,9 +95,9 @@ export const TitleBase = forwardRef<TitleElementType, TitleProps & PrivateProps>
92
95
  {
93
96
  tag: Component = 'div',
94
97
  view = 'medium',
95
- font,
98
+ font = 'styrene',
96
99
  platform,
97
- weight = 'bold',
100
+ weight = getDefaultWeight(isObject(font) ? font.font : font, platform),
98
101
  defaultMargins = false,
99
102
  color,
100
103
  className,
@@ -109,36 +112,43 @@ export const TitleBase = forwardRef<TitleElementType, TitleProps & PrivateProps>
109
112
  ref,
110
113
  ) => {
111
114
  const { renderSkeleton, textRef } = useSkeleton(showSkeleton, skeletonProps);
112
-
113
- const skeleton = renderSkeleton({
114
- wrapperClassName: cn(defaultMargins && styles[`margins-${view}`]),
115
- dataTestId,
116
- });
117
-
118
- if (skeleton) {
119
- return skeleton;
120
- }
115
+ const Root = showSkeleton ? 'div' : Fragment;
116
+ const rootProps: ComponentProps<typeof Root> = showSkeleton
117
+ ? { className: cn(commonStyles.root, className) }
118
+ : {};
121
119
 
122
120
  return (
123
- <Component
124
- className={cn(
125
- commonStyles.component,
126
- styles.component,
127
- className,
128
- styles[`${weight === 'regular' ? 'regular-' : ''}${view}`],
129
- defaultMargins && styles[`margins-${view}`],
130
- color && colors[color],
131
- {
132
- [commonStyles[`rowLimit${rowLimit}`]]: rowLimit,
133
- [commonStyles.transparent]: showSkeleton,
134
- },
121
+ <Root {...rootProps}>
122
+ <Component
123
+ className={cn(
124
+ commonStyles.component,
125
+ styles.component,
126
+ !showSkeleton && className,
127
+ styles[`${weight === 'regular' ? 'regular-' : ''}${view}`],
128
+ defaultMargins && styles[`margins-${view}`],
129
+ color && colors[color],
130
+ {
131
+ [commonStyles[`rowLimit${rowLimit}`]]: rowLimit,
132
+ [commonStyles.transparent]: showSkeleton,
133
+ [styles.font]:
134
+ (isObject(font) && !font.systemCompat) || !(font === 'system'),
135
+ },
136
+ )}
137
+ data-test-id={dataTestId}
138
+ ref={mergeRefs([ref, textRef])}
139
+ {...restProps}
140
+ >
141
+ {children}
142
+ </Component>
143
+ {showSkeleton && (
144
+ <div className={commonStyles.skeleton}>
145
+ {renderSkeleton({
146
+ wrapperClassName: cn(defaultMargins && styles[`margins-${view}`]),
147
+ dataTestId,
148
+ })}
149
+ </div>
135
150
  )}
136
- data-test-id={dataTestId}
137
- ref={mergeRefs([ref, textRef])}
138
- {...restProps}
139
- >
140
- {children}
141
- </Component>
151
+ </Root>
142
152
  );
143
153
  },
144
154
  );
@@ -4,10 +4,18 @@
4
4
  @each $view in xlarge, large, medium, small, xsmall {
5
5
  .$(view) {
6
6
  @mixin headline-system_$(view);
7
+
8
+ &.font {
9
+ @subtract-mixin headline_$(view), headline-system_$(view);
10
+ }
7
11
  }
8
12
 
9
13
  .regular-$(view) {
10
14
  @mixin promo-system_$(view);
15
+
16
+ &.font {
17
+ @subtract-mixin promo_$(view), promo-system_$(view);
18
+ }
11
19
  }
12
20
  }
13
21