@cleartrip/ct-design-typography 5.28.0-SNAPSHOT-impression-fix.0 → 5.28.0-SNAPSHOT-inter-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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Typography.native.d.ts","sourceRoot":"","sources":["../packages/components/Typography/src/Typography.native.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAwB,IAAI,EAAuB,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"Typography.native.d.ts","sourceRoot":"","sources":["../packages/components/Typography/src/Typography.native.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAwB,IAAI,EAAuB,MAAM,cAAc,CAAC;AAO/E,OAAO,EAAE,WAAW,EAAyB,MAAM,QAAQ,CAAC;AAyD5D,QAAA,MAAM,UAAU,0EAyFf,CAAC;AAIF,eAAe,UAAU,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cleartrip/ct-design-typography",
|
|
3
|
-
"version": "5.28.0-SNAPSHOT-
|
|
3
|
+
"version": "5.28.0-SNAPSHOT-inter-2.0",
|
|
4
4
|
"description": "Typography component with enhanced styleConfig support for RNW compatibility",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/ct-design-typography.cjs.js",
|
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@emotion/react": "^11.14.0",
|
|
21
21
|
"@emotion/styled": "^11.14.0",
|
|
22
|
-
"@cleartrip/ct-design-types": "5.28.0-SNAPSHOT-
|
|
23
|
-
"@cleartrip/ct-design-theme": "5.28.0-SNAPSHOT-
|
|
24
|
-
"@cleartrip/ct-design-conditional-wrap": "5.28.0-SNAPSHOT-
|
|
25
|
-
"@cleartrip/ct-design-container": "5.28.0-SNAPSHOT-
|
|
26
|
-
"@cleartrip/ct-design-
|
|
27
|
-
"@cleartrip/ct-design-
|
|
28
|
-
"@cleartrip/ct-design-style-manager": "5.27.1-SNAPSHOT-
|
|
22
|
+
"@cleartrip/ct-design-types": "5.28.0-SNAPSHOT-inter-2.0",
|
|
23
|
+
"@cleartrip/ct-design-theme": "5.28.0-SNAPSHOT-inter-2.0",
|
|
24
|
+
"@cleartrip/ct-design-conditional-wrap": "5.28.0-SNAPSHOT-inter-2.0",
|
|
25
|
+
"@cleartrip/ct-design-container": "5.28.0-SNAPSHOT-inter-2.0",
|
|
26
|
+
"@cleartrip/ct-design-event-propagation": "5.28.0-SNAPSHOT-inter-2.0",
|
|
27
|
+
"@cleartrip/ct-design-common-utils": "5.27.1-SNAPSHOT-inter-2.0",
|
|
28
|
+
"@cleartrip/ct-design-style-manager": "5.27.1-SNAPSHOT-inter-2.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@emotion/babel-plugin": "^11.12.0"
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react';
|
|
2
2
|
|
|
3
3
|
import { NativeSyntheticEvent, Text, TextLayoutEventData } from 'react-native';
|
|
4
|
-
import { useStyles } from '@cleartrip/ct-design-style-manager';
|
|
5
|
-
import { useNativeMergeStyles } from '@cleartrip/ct-design-style-manager';
|
|
4
|
+
import { useNativeMergeStyles, useStyles } from '@cleartrip/ct-design-style-manager';
|
|
6
5
|
import { getAccessibilityProps } from '@cleartrip/ct-design-common-utils';
|
|
7
6
|
import EventCollectorProvider, { useMergeEvents } from '@cleartrip/ct-design-event-propagation';
|
|
8
7
|
import { useTriggerEvents } from '@cleartrip/ct-design-event-propagation';
|
|
9
8
|
import Conditional from '@cleartrip/ct-design-conditional-wrap';
|
|
10
9
|
|
|
11
10
|
import { ITypography, TypographyVariantType } from './type';
|
|
12
|
-
import { TypographyColor } from './constants';
|
|
11
|
+
import { TypographyColor, TypographyVariant } from './constants';
|
|
13
12
|
import { getTypographyStyles } from './style';
|
|
14
13
|
|
|
15
14
|
const getTextType = (variant: TypographyVariantType) => {
|
|
@@ -39,6 +38,32 @@ const getTextType = (variant: TypographyVariantType) => {
|
|
|
39
38
|
return variantMapper[variant as keyof typeof variantMapper] as keyof HTMLElementTagNameMap;
|
|
40
39
|
};
|
|
41
40
|
|
|
41
|
+
const FONT_WEIGHT = {
|
|
42
|
+
[TypographyVariant.HD1]: 'SemiBold',
|
|
43
|
+
[TypographyVariant.HD2]: 'SemiBold',
|
|
44
|
+
[TypographyVariant.HD3]: 'SemiBold',
|
|
45
|
+
[TypographyVariant.HM1]: 'SemiBold',
|
|
46
|
+
[TypographyVariant.HM2]: 'SemiBold',
|
|
47
|
+
[TypographyVariant.HM3]: 'SemiBold',
|
|
48
|
+
[TypographyVariant.HM4]: 'SemiBold',
|
|
49
|
+
[TypographyVariant.B1]: 'Medium',
|
|
50
|
+
[TypographyVariant.B2]: 'Medium',
|
|
51
|
+
[TypographyVariant.B3]: 'Medium',
|
|
52
|
+
[TypographyVariant.B3CAPS]: 'SemiBold',
|
|
53
|
+
[TypographyVariant.B4]: 'Medium',
|
|
54
|
+
[TypographyVariant.B4CAPS]: 'SemiBold',
|
|
55
|
+
[TypographyVariant.P1]: 'Regular',
|
|
56
|
+
[TypographyVariant.P2]: 'Regular',
|
|
57
|
+
[TypographyVariant.P3]: 'Regular',
|
|
58
|
+
[TypographyVariant.L1]: 'SemiBold',
|
|
59
|
+
[TypographyVariant.L2]: 'SemiBold',
|
|
60
|
+
[TypographyVariant.L3]: 'SemiBold',
|
|
61
|
+
[TypographyVariant.OVERLINE]: 'SemiBold',
|
|
62
|
+
[TypographyVariant.TAG]: 'SemiBold',
|
|
63
|
+
[TypographyVariant.M4BOLD]: 'Bold',
|
|
64
|
+
[TypographyVariant.WRAPPER]: 'Regular',
|
|
65
|
+
};
|
|
66
|
+
|
|
42
67
|
const Typography = forwardRef<Text, ITypography>(
|
|
43
68
|
(
|
|
44
69
|
{
|
|
@@ -76,11 +101,22 @@ const Typography = forwardRef<Text, ITypography>(
|
|
|
76
101
|
[color, variant, isStriked, isUnderlined, colorCode],
|
|
77
102
|
);
|
|
78
103
|
|
|
104
|
+
const fontFamily = useStyles(
|
|
105
|
+
(theme) => {
|
|
106
|
+
return {
|
|
107
|
+
root: {
|
|
108
|
+
fontFamily: `${theme.typography.fontFamily}-${FONT_WEIGHT[variant as keyof typeof FONT_WEIGHT] || 'Regular'}`,
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
},
|
|
112
|
+
[variant],
|
|
113
|
+
);
|
|
114
|
+
|
|
79
115
|
const { root: rootStyles = [] } = styleConfig || {};
|
|
80
116
|
|
|
81
117
|
const mergedTypographyStyles = useNativeMergeStyles(
|
|
82
|
-
[typographyStyles.root, ...rootStyles],
|
|
83
|
-
[typographyStyles, styleConfig?.root],
|
|
118
|
+
[typographyStyles.root, fontFamily.root, ...rootStyles],
|
|
119
|
+
[typographyStyles, fontFamily, styleConfig?.root],
|
|
84
120
|
);
|
|
85
121
|
|
|
86
122
|
const mergedEvents = useMergeEvents({ onClick: [onClick] });
|