@cleartrip/ct-design-typography 5.7.0-SNAPSHOT-native-main.5 → 5.7.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/dist/Typography.d.ts.map +1 -1
- package/dist/ct-design-typography.browser.cjs.js +1 -1
- package/dist/ct-design-typography.browser.cjs.js.map +1 -1
- package/dist/ct-design-typography.browser.esm.js +1 -1
- package/dist/ct-design-typography.browser.esm.js.map +1 -1
- package/dist/ct-design-typography.cjs.js +43 -48
- package/dist/ct-design-typography.cjs.js.map +1 -1
- package/dist/ct-design-typography.esm.js +39 -48
- package/dist/ct-design-typography.esm.js.map +1 -1
- package/dist/ct-design-typography.umd.js +46 -52
- package/dist/ct-design-typography.umd.js.map +1 -1
- package/dist/style.d.ts +26 -43
- package/dist/style.d.ts.map +1 -1
- package/package.json +8 -18
- package/src/Typography.tsx +38 -38
- package/src/style.ts +14 -19
package/dist/style.d.ts
CHANGED
|
@@ -116,34 +116,17 @@ export declare const getTypographyVariant: (theme: Theme, variant: TypographyVar
|
|
|
116
116
|
letterSpacing: 0.4;
|
|
117
117
|
textTransform?: undefined;
|
|
118
118
|
};
|
|
119
|
-
export declare const getTypographyColor: (theme: Theme, color: TypographyColorType) => string;
|
|
119
|
+
export declare const getTypographyColor: (theme: Theme, color: TypographyColorType) => string | undefined;
|
|
120
120
|
export declare const getLineClampStyles: (lineClamp?: number) => {
|
|
121
|
-
display?: undefined;
|
|
122
|
-
whiteSpace?: undefined;
|
|
123
|
-
overflow?: undefined;
|
|
124
|
-
textOverflow?: undefined;
|
|
125
|
-
width?: undefined;
|
|
126
|
-
minWidth?: undefined;
|
|
127
|
-
WebkitLineClamp?: undefined;
|
|
128
|
-
WebkitBoxOrient?: undefined;
|
|
129
|
-
} | {
|
|
130
121
|
display: TextStyle["display"];
|
|
131
|
-
|
|
122
|
+
webkitLineClamp: number;
|
|
123
|
+
webkitBoxOrient: string;
|
|
132
124
|
overflow: string;
|
|
133
|
-
textOverflow: string;
|
|
134
|
-
width: string;
|
|
135
|
-
minWidth: number;
|
|
136
|
-
WebkitLineClamp?: undefined;
|
|
137
|
-
WebkitBoxOrient?: undefined;
|
|
138
125
|
} | {
|
|
139
|
-
display
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
overflow
|
|
143
|
-
textOverflow: string;
|
|
144
|
-
width: string;
|
|
145
|
-
minWidth: number;
|
|
146
|
-
whiteSpace?: undefined;
|
|
126
|
+
display?: undefined;
|
|
127
|
+
webkitLineClamp?: undefined;
|
|
128
|
+
webkitBoxOrient?: undefined;
|
|
129
|
+
overflow?: undefined;
|
|
147
130
|
};
|
|
148
131
|
export declare const getTypographyUnderlineOffset: (theme: Theme, variant: TypographyVariantType, isUnderlined?: boolean) => 20 | 16 | 12 | 4 | 8 | undefined;
|
|
149
132
|
export declare const getTypographyStyles: ({ theme, variant, color, isStriked, colorCode, showInItalics, }: {
|
|
@@ -158,7 +141,7 @@ export declare const getTypographyStyles: ({ theme, variant, color, isStriked, c
|
|
|
158
141
|
lineClamp?: number;
|
|
159
142
|
isDisabled?: boolean;
|
|
160
143
|
}) => {
|
|
161
|
-
color: string;
|
|
144
|
+
color: string | undefined;
|
|
162
145
|
textDecorationLine: "none" | "line-through";
|
|
163
146
|
fontStyle: TextStyle["fontStyle"];
|
|
164
147
|
fontSize: 48;
|
|
@@ -167,7 +150,7 @@ export declare const getTypographyStyles: ({ theme, variant, color, isStriked, c
|
|
|
167
150
|
letterSpacing?: undefined;
|
|
168
151
|
textTransform?: undefined;
|
|
169
152
|
} | {
|
|
170
|
-
color: string;
|
|
153
|
+
color: string | undefined;
|
|
171
154
|
textDecorationLine: "none" | "line-through";
|
|
172
155
|
fontStyle: TextStyle["fontStyle"];
|
|
173
156
|
fontSize: 40;
|
|
@@ -176,7 +159,7 @@ export declare const getTypographyStyles: ({ theme, variant, color, isStriked, c
|
|
|
176
159
|
letterSpacing?: undefined;
|
|
177
160
|
textTransform?: undefined;
|
|
178
161
|
} | {
|
|
179
|
-
color: string;
|
|
162
|
+
color: string | undefined;
|
|
180
163
|
textDecorationLine: "none" | "line-through";
|
|
181
164
|
fontStyle: TextStyle["fontStyle"];
|
|
182
165
|
fontSize: 32;
|
|
@@ -185,7 +168,7 @@ export declare const getTypographyStyles: ({ theme, variant, color, isStriked, c
|
|
|
185
168
|
letterSpacing?: undefined;
|
|
186
169
|
textTransform?: undefined;
|
|
187
170
|
} | {
|
|
188
|
-
color: string;
|
|
171
|
+
color: string | undefined;
|
|
189
172
|
textDecorationLine: "none" | "line-through";
|
|
190
173
|
fontStyle: TextStyle["fontStyle"];
|
|
191
174
|
fontSize: 24;
|
|
@@ -194,7 +177,7 @@ export declare const getTypographyStyles: ({ theme, variant, color, isStriked, c
|
|
|
194
177
|
letterSpacing?: undefined;
|
|
195
178
|
textTransform?: undefined;
|
|
196
179
|
} | {
|
|
197
|
-
color: string;
|
|
180
|
+
color: string | undefined;
|
|
198
181
|
textDecorationLine: "none" | "line-through";
|
|
199
182
|
fontStyle: TextStyle["fontStyle"];
|
|
200
183
|
fontSize: 20;
|
|
@@ -203,7 +186,7 @@ export declare const getTypographyStyles: ({ theme, variant, color, isStriked, c
|
|
|
203
186
|
letterSpacing?: undefined;
|
|
204
187
|
textTransform?: undefined;
|
|
205
188
|
} | {
|
|
206
|
-
color: string;
|
|
189
|
+
color: string | undefined;
|
|
207
190
|
textDecorationLine: "none" | "line-through";
|
|
208
191
|
fontStyle: TextStyle["fontStyle"];
|
|
209
192
|
fontSize: 16;
|
|
@@ -212,7 +195,7 @@ export declare const getTypographyStyles: ({ theme, variant, color, isStriked, c
|
|
|
212
195
|
letterSpacing?: undefined;
|
|
213
196
|
textTransform?: undefined;
|
|
214
197
|
} | {
|
|
215
|
-
color: string;
|
|
198
|
+
color: string | undefined;
|
|
216
199
|
textDecorationLine: "none" | "line-through";
|
|
217
200
|
fontStyle: TextStyle["fontStyle"];
|
|
218
201
|
fontSize: 14;
|
|
@@ -221,7 +204,7 @@ export declare const getTypographyStyles: ({ theme, variant, color, isStriked, c
|
|
|
221
204
|
letterSpacing?: undefined;
|
|
222
205
|
textTransform?: undefined;
|
|
223
206
|
} | {
|
|
224
|
-
color: string;
|
|
207
|
+
color: string | undefined;
|
|
225
208
|
textDecorationLine: "none" | "line-through";
|
|
226
209
|
fontStyle: TextStyle["fontStyle"];
|
|
227
210
|
fontSize: 16;
|
|
@@ -230,7 +213,7 @@ export declare const getTypographyStyles: ({ theme, variant, color, isStriked, c
|
|
|
230
213
|
letterSpacing?: undefined;
|
|
231
214
|
textTransform?: undefined;
|
|
232
215
|
} | {
|
|
233
|
-
color: string;
|
|
216
|
+
color: string | undefined;
|
|
234
217
|
textDecorationLine: "none" | "line-through";
|
|
235
218
|
fontStyle: TextStyle["fontStyle"];
|
|
236
219
|
fontSize: 14;
|
|
@@ -239,7 +222,7 @@ export declare const getTypographyStyles: ({ theme, variant, color, isStriked, c
|
|
|
239
222
|
letterSpacing?: undefined;
|
|
240
223
|
textTransform?: undefined;
|
|
241
224
|
} | {
|
|
242
|
-
color: string;
|
|
225
|
+
color: string | undefined;
|
|
243
226
|
textDecorationLine: "none" | "line-through";
|
|
244
227
|
fontStyle: TextStyle["fontStyle"];
|
|
245
228
|
fontSize: 12;
|
|
@@ -248,7 +231,7 @@ export declare const getTypographyStyles: ({ theme, variant, color, isStriked, c
|
|
|
248
231
|
letterSpacing?: undefined;
|
|
249
232
|
textTransform?: undefined;
|
|
250
233
|
} | {
|
|
251
|
-
color: string;
|
|
234
|
+
color: string | undefined;
|
|
252
235
|
textDecorationLine: "none" | "line-through";
|
|
253
236
|
fontStyle: TextStyle["fontStyle"];
|
|
254
237
|
fontSize: 12;
|
|
@@ -257,7 +240,7 @@ export declare const getTypographyStyles: ({ theme, variant, color, isStriked, c
|
|
|
257
240
|
letterSpacing: 0.4;
|
|
258
241
|
textTransform: string;
|
|
259
242
|
} | {
|
|
260
|
-
color: string;
|
|
243
|
+
color: string | undefined;
|
|
261
244
|
textDecorationLine: "none" | "line-through";
|
|
262
245
|
fontStyle: TextStyle["fontStyle"];
|
|
263
246
|
fontSize: 10;
|
|
@@ -266,7 +249,7 @@ export declare const getTypographyStyles: ({ theme, variant, color, isStriked, c
|
|
|
266
249
|
letterSpacing?: undefined;
|
|
267
250
|
textTransform?: undefined;
|
|
268
251
|
} | {
|
|
269
|
-
color: string;
|
|
252
|
+
color: string | undefined;
|
|
270
253
|
textDecorationLine: "none" | "line-through";
|
|
271
254
|
fontStyle: TextStyle["fontStyle"];
|
|
272
255
|
fontSize: 10;
|
|
@@ -275,7 +258,7 @@ export declare const getTypographyStyles: ({ theme, variant, color, isStriked, c
|
|
|
275
258
|
letterSpacing: 0.4;
|
|
276
259
|
textTransform: string;
|
|
277
260
|
} | {
|
|
278
|
-
color: string;
|
|
261
|
+
color: string | undefined;
|
|
279
262
|
textDecorationLine: "none" | "line-through";
|
|
280
263
|
fontStyle: TextStyle["fontStyle"];
|
|
281
264
|
fontSize: 16;
|
|
@@ -284,7 +267,7 @@ export declare const getTypographyStyles: ({ theme, variant, color, isStriked, c
|
|
|
284
267
|
letterSpacing?: undefined;
|
|
285
268
|
textTransform?: undefined;
|
|
286
269
|
} | {
|
|
287
|
-
color: string;
|
|
270
|
+
color: string | undefined;
|
|
288
271
|
textDecorationLine: "none" | "line-through";
|
|
289
272
|
fontStyle: TextStyle["fontStyle"];
|
|
290
273
|
fontSize: 14;
|
|
@@ -293,7 +276,7 @@ export declare const getTypographyStyles: ({ theme, variant, color, isStriked, c
|
|
|
293
276
|
letterSpacing?: undefined;
|
|
294
277
|
textTransform?: undefined;
|
|
295
278
|
} | {
|
|
296
|
-
color: string;
|
|
279
|
+
color: string | undefined;
|
|
297
280
|
textDecorationLine: "none" | "line-through";
|
|
298
281
|
fontStyle: TextStyle["fontStyle"];
|
|
299
282
|
fontSize: 12;
|
|
@@ -302,7 +285,7 @@ export declare const getTypographyStyles: ({ theme, variant, color, isStriked, c
|
|
|
302
285
|
letterSpacing?: undefined;
|
|
303
286
|
textTransform?: undefined;
|
|
304
287
|
} | {
|
|
305
|
-
color: string;
|
|
288
|
+
color: string | undefined;
|
|
306
289
|
textDecorationLine: "none" | "line-through";
|
|
307
290
|
fontStyle: TextStyle["fontStyle"];
|
|
308
291
|
fontSize: 10;
|
|
@@ -311,7 +294,7 @@ export declare const getTypographyStyles: ({ theme, variant, color, isStriked, c
|
|
|
311
294
|
letterSpacing?: undefined;
|
|
312
295
|
textTransform?: undefined;
|
|
313
296
|
} | {
|
|
314
|
-
color: string;
|
|
297
|
+
color: string | undefined;
|
|
315
298
|
textDecorationLine: "none" | "line-through";
|
|
316
299
|
fontStyle: TextStyle["fontStyle"];
|
|
317
300
|
fontSize: 12;
|
|
@@ -320,7 +303,7 @@ export declare const getTypographyStyles: ({ theme, variant, color, isStriked, c
|
|
|
320
303
|
letterSpacing?: undefined;
|
|
321
304
|
textTransform?: undefined;
|
|
322
305
|
} | {
|
|
323
|
-
color: string;
|
|
306
|
+
color: string | undefined;
|
|
324
307
|
textDecorationLine: "none" | "line-through";
|
|
325
308
|
fontStyle: TextStyle["fontStyle"];
|
|
326
309
|
fontSize: 10;
|
package/dist/style.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../packages/components/Typography/src/style.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAC;AAEpE,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAEvD,eAAO,MAAM,oBAAoB,GAAI,OAAO,KAAK,EAAE,SAAS,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyKhF,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,OAAO,KAAK,EAAE,OAAO,mBAAmB,
|
|
1
|
+
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../packages/components/Typography/src/style.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAC;AAEpE,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAEvD,eAAO,MAAM,oBAAoB,GAAI,OAAO,KAAK,EAAE,SAAS,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyKhF,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,OAAO,KAAK,EAAE,OAAO,mBAAmB,uBA4E1E,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,YAAY,MAAM;aAGvB,SAAS,CAAC,SAAS,CAAC;;;;;;;;;CAQjD,CAAC;AAEF,eAAO,MAAM,4BAA4B,GAAI,OAAO,KAAK,EAAE,SAAS,qBAAqB,EAAE,eAAe,OAAO,qCAmBhH,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,iEAOjC;IACD,KAAK,EAAE,KAAK,CAAC;IACb,OAAO,CAAC,EAAE,qBAAqB,CAAC;IAChC,KAAK,CAAC,EAAE,mBAAmB,CAAC;IAC5B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;;;eAMqD,SAAS,CAAC,WAAW,CAAC;;;;;;;;;eAAtB,SAAS,CAAC,WAAW,CAAC;;;;;;;;;eAAtB,SAAS,CAAC,WAAW,CAAC;;;;;;;;;eAAtB,SAAS,CAAC,WAAW,CAAC;;;;;;;;;eAAtB,SAAS,CAAC,WAAW,CAAC;;;;;;;;;eAAtB,SAAS,CAAC,WAAW,CAAC;;;;;;;;;eAAtB,SAAS,CAAC,WAAW,CAAC;;;;;;;;;eAAtB,SAAS,CAAC,WAAW,CAAC;;;;;;;;;eAAtB,SAAS,CAAC,WAAW,CAAC;;;;;;;;;eAAtB,SAAS,CAAC,WAAW,CAAC;;;;;;;;;eAAtB,SAAS,CAAC,WAAW,CAAC;;;;;;;;;eAAtB,SAAS,CAAC,WAAW,CAAC;;;;;;;;;eAAtB,SAAS,CAAC,WAAW,CAAC;;;;;;;;;eAAtB,SAAS,CAAC,WAAW,CAAC;;;;;;;;;eAAtB,SAAS,CAAC,WAAW,CAAC;;;;;;;;;eAAtB,SAAS,CAAC,WAAW,CAAC;;;;;;;;;eAAtB,SAAS,CAAC,WAAW,CAAC;;;;;;;;;eAAtB,SAAS,CAAC,WAAW,CAAC;;;;;;;;;eAAtB,SAAS,CAAC,WAAW,CAAC;;;;;;CAE3E,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cleartrip/ct-design-typography",
|
|
3
|
-
"version": "5.7.0
|
|
3
|
+
"version": "5.7.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",
|
|
@@ -8,16 +8,6 @@
|
|
|
8
8
|
"jsnext:main": "dist/ct-design-typography.esm.js",
|
|
9
9
|
"module": "dist/ct-design-typography.esm.js",
|
|
10
10
|
"sideEffects": false,
|
|
11
|
-
"exports": {
|
|
12
|
-
".": {
|
|
13
|
-
"development": "./src/index.ts",
|
|
14
|
-
"react-native": "./src/index.ts",
|
|
15
|
-
"types": "./dist/index.d.ts",
|
|
16
|
-
"import": "./dist/ct-design-typography.esm.js",
|
|
17
|
-
"require": "./dist/ct-design-typography.cjs.js",
|
|
18
|
-
"default": "./dist/ct-design-typography.esm.js"
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
11
|
"browser": {
|
|
22
12
|
"./dist/ct-design-typography.esm.js": "./dist/ct-design-typography.browser.esm.js",
|
|
23
13
|
"./dist/ct-design-typography.cjs.js": "./dist/ct-design-typography.browser.cjs.js"
|
|
@@ -29,13 +19,13 @@
|
|
|
29
19
|
"dependencies": {
|
|
30
20
|
"@emotion/react": "^11.14.0",
|
|
31
21
|
"@emotion/styled": "^11.14.0",
|
|
32
|
-
"@cleartrip/ct-design-types": "5.7.0
|
|
33
|
-
"@cleartrip/ct-design-theme": "5.7.0
|
|
34
|
-
"@cleartrip/ct-design-conditional-wrap": "5.7.0
|
|
35
|
-
"@cleartrip/ct-design-
|
|
36
|
-
"@cleartrip/ct-design-
|
|
37
|
-
"@cleartrip/ct-design-
|
|
38
|
-
"@cleartrip/ct-design-common-utils": "5.7.0
|
|
22
|
+
"@cleartrip/ct-design-types": "5.7.0",
|
|
23
|
+
"@cleartrip/ct-design-theme": "5.7.0",
|
|
24
|
+
"@cleartrip/ct-design-conditional-wrap": "5.7.0",
|
|
25
|
+
"@cleartrip/ct-design-container": "5.7.0",
|
|
26
|
+
"@cleartrip/ct-design-style-manager": "5.7.0",
|
|
27
|
+
"@cleartrip/ct-design-event-propagation": "5.7.0",
|
|
28
|
+
"@cleartrip/ct-design-common-utils": "5.7.0"
|
|
39
29
|
},
|
|
40
30
|
"devDependencies": {
|
|
41
31
|
"@emotion/babel-plugin": "^11.12.0"
|
package/src/Typography.tsx
CHANGED
|
@@ -2,14 +2,14 @@ import React, { useMemo } from 'react';
|
|
|
2
2
|
import { useTheme } from '@cleartrip/ct-design-theme';
|
|
3
3
|
import { useStyles, useWebMergeStyles } from '@cleartrip/ct-design-style-manager';
|
|
4
4
|
import { Container, IContainer } from '@cleartrip/ct-design-container';
|
|
5
|
+
import ConditionalWrap from '@cleartrip/ct-design-conditional-wrap';
|
|
5
6
|
import { getLineClampStyles, getTypographyStyles } from './style';
|
|
6
|
-
import type { Styles } from '@cleartrip/ct-design-types';
|
|
7
7
|
import { TypographyVariantType, ITypography, TypographyNodeElementType } from './type';
|
|
8
8
|
import { TypographyColor } from './constants';
|
|
9
9
|
import { css } from '@emotion/css';
|
|
10
10
|
|
|
11
11
|
const getTextType = (variant: TypographyVariantType): TypographyNodeElementType => {
|
|
12
|
-
const variantMapper
|
|
12
|
+
const variantMapper = {
|
|
13
13
|
HD1: 'h1',
|
|
14
14
|
HD2: 'h2',
|
|
15
15
|
HD3: 'h3',
|
|
@@ -17,27 +17,24 @@ const getTextType = (variant: TypographyVariantType): TypographyNodeElementType
|
|
|
17
17
|
HM2: 'h2',
|
|
18
18
|
HM3: 'h3',
|
|
19
19
|
HM4: 'h4',
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
B3CAPS: 'div',
|
|
37
|
-
TAG: 'div',
|
|
38
|
-
WRAPPER: 'div',
|
|
20
|
+
B1: 'p',
|
|
21
|
+
B2: 'p',
|
|
22
|
+
B3: 'p',
|
|
23
|
+
B4: 'p',
|
|
24
|
+
P1: 'p',
|
|
25
|
+
P2: 'p',
|
|
26
|
+
P3: 'p',
|
|
27
|
+
P4: 'p',
|
|
28
|
+
L1: 'p',
|
|
29
|
+
L2: 'p',
|
|
30
|
+
L3: 'p',
|
|
31
|
+
B4CAPS: 'p',
|
|
32
|
+
OVERLINE: 'p',
|
|
33
|
+
B3CAPS: 'p',
|
|
34
|
+
M4BOLD: 'p',
|
|
35
|
+
TAG: 'p',
|
|
39
36
|
};
|
|
40
|
-
return variantMapper[variant]
|
|
37
|
+
return variantMapper[variant];
|
|
41
38
|
};
|
|
42
39
|
|
|
43
40
|
const Typography: React.FC<ITypography> = ({
|
|
@@ -62,7 +59,7 @@ const Typography: React.FC<ITypography> = ({
|
|
|
62
59
|
(theme) => {
|
|
63
60
|
return {
|
|
64
61
|
root: getTypographyStyles({
|
|
65
|
-
theme,
|
|
62
|
+
theme: theme,
|
|
66
63
|
variant,
|
|
67
64
|
color,
|
|
68
65
|
isClickable: parsedIsClickable,
|
|
@@ -100,23 +97,26 @@ const Typography: React.FC<ITypography> = ({
|
|
|
100
97
|
[typographyStyles.root, clampClass, customRootStyles],
|
|
101
98
|
);
|
|
102
99
|
|
|
103
|
-
const ComponentToRender =
|
|
104
|
-
const isInlineNode = ComponentToRender === 'span';
|
|
100
|
+
const ComponentToRender = componentNode || getTextType(variant);
|
|
105
101
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
?
|
|
110
|
-
:
|
|
102
|
+
const containerAsSupportedValues: readonly IContainer['as'][] = ['p', 'main', 'section', 'article', 'div'] as const;
|
|
103
|
+
const containerAs: IContainer['as'] =
|
|
104
|
+
componentNode && (containerAsSupportedValues as readonly string[]).includes(componentNode)
|
|
105
|
+
? (componentNode as IContainer['as'])
|
|
106
|
+
: 'div';
|
|
111
107
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
108
|
+
return (
|
|
109
|
+
<ConditionalWrap
|
|
110
|
+
condition={parsedIsClickable}
|
|
111
|
+
wrap={(children) => (
|
|
112
|
+
<Container onClick={onClick} styleConfig={{ root: customContainerStyles }} as={containerAs}>
|
|
113
|
+
{children}
|
|
114
|
+
</Container>
|
|
115
|
+
)}
|
|
116
|
+
>
|
|
117
|
+
<ComponentToRender className={mergedRootStyles}>{children}</ComponentToRender>
|
|
118
|
+
</ConditionalWrap>
|
|
119
|
+
);
|
|
120
120
|
};
|
|
121
121
|
|
|
122
122
|
export default Typography;
|
package/src/style.ts
CHANGED
|
@@ -237,6 +237,15 @@ export const getTypographyColor = (theme: Theme, color: TypographyColorType) =>
|
|
|
237
237
|
case TypographyColor.BRAND: {
|
|
238
238
|
return theme.color.text.brand;
|
|
239
239
|
}
|
|
240
|
+
case TypographyColor.MARGARITA750: {
|
|
241
|
+
return theme.color.text.margarita750;
|
|
242
|
+
}
|
|
243
|
+
case TypographyColor.GREEN100: {
|
|
244
|
+
return theme.color.text.green100;
|
|
245
|
+
}
|
|
246
|
+
case TypographyColor.RED100: {
|
|
247
|
+
return theme.color.text.red100;
|
|
248
|
+
}
|
|
240
249
|
default: {
|
|
241
250
|
return theme.color.text.primary;
|
|
242
251
|
}
|
|
@@ -244,30 +253,16 @@ export const getTypographyColor = (theme: Theme, color: TypographyColorType) =>
|
|
|
244
253
|
};
|
|
245
254
|
|
|
246
255
|
export const getLineClampStyles = (lineClamp?: number) => {
|
|
247
|
-
if (
|
|
248
|
-
return {};
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
if (lineClamp === 1) {
|
|
256
|
+
if (lineClamp) {
|
|
252
257
|
return {
|
|
253
|
-
display: '
|
|
254
|
-
|
|
258
|
+
display: 'webkitBox' as TextStyle['display'],
|
|
259
|
+
webkitLineClamp: lineClamp,
|
|
260
|
+
webkitBoxOrient: 'vertical',
|
|
255
261
|
overflow: 'hidden',
|
|
256
|
-
textOverflow: 'ellipsis',
|
|
257
|
-
width: '100%',
|
|
258
|
-
minWidth: 0,
|
|
259
262
|
};
|
|
260
263
|
}
|
|
261
264
|
|
|
262
|
-
return {
|
|
263
|
-
display: '-webkit-box' as TextStyle['display'],
|
|
264
|
-
WebkitLineClamp: lineClamp,
|
|
265
|
-
WebkitBoxOrient: 'vertical' as const,
|
|
266
|
-
overflow: 'hidden',
|
|
267
|
-
textOverflow: 'ellipsis',
|
|
268
|
-
width: '100%',
|
|
269
|
-
minWidth: 0,
|
|
270
|
-
};
|
|
265
|
+
return {};
|
|
271
266
|
};
|
|
272
267
|
|
|
273
268
|
export const getTypographyUnderlineOffset = (theme: Theme, variant: TypographyVariantType, isUnderlined?: boolean) => {
|