@yahoo/uds-mobile 2.0.0 → 2.0.1
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/bin/generateTheme.mjs +18 -6
- package/generated/styles.d.ts +36 -16
- package/package.json +1 -1
|
@@ -13,6 +13,15 @@ import { fontAliasToPostscript } from "@yahoo/uds-mobile/fonts";
|
|
|
13
13
|
* Takes UniversalTokensConfigGeneric and generates theme objects for React Native Unistyles.
|
|
14
14
|
*/
|
|
15
15
|
/**
|
|
16
|
+
* TEMPORARY: UDS-665 - Override YAS font with Yahoo Product Sans
|
|
17
|
+
* Remove this function when YAS font issue is resolved.
|
|
18
|
+
* Search for "UDS-665" to find all related code.
|
|
19
|
+
*/
|
|
20
|
+
function applyYasFontOverride(fontId) {
|
|
21
|
+
if (fontId === "yas") return "yahoo-product-sans";
|
|
22
|
+
return fontId;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
16
25
|
* Extracts a space-separated "R G B" string from a SpectrumValueEntry.
|
|
17
26
|
*/
|
|
18
27
|
function extractRgb(value) {
|
|
@@ -208,7 +217,7 @@ function generateTypography(typographyConfig, fontConfig) {
|
|
|
208
217
|
const result = {};
|
|
209
218
|
for (const [variant, style] of Object.entries(typographyConfig)) {
|
|
210
219
|
const fontAlias = style.fontFamily.base;
|
|
211
|
-
const fontId = fontConfig[fontAlias] ?? fontAlias;
|
|
220
|
+
const fontId = applyYasFontOverride(fontConfig[fontAlias] ?? fontAlias);
|
|
212
221
|
const weight = Number(style.fontWeight.base.value);
|
|
213
222
|
const postScriptName = isWebFontID(fontId) ? getPostScriptName(fontId, weight) : fontId;
|
|
214
223
|
result[variant] = {
|
|
@@ -223,10 +232,13 @@ function generateTypography(typographyConfig, fontConfig) {
|
|
|
223
232
|
}
|
|
224
233
|
function generateFontAliases(fontConfig) {
|
|
225
234
|
const result = {};
|
|
226
|
-
for (const [alias,
|
|
227
|
-
const
|
|
228
|
-
|
|
229
|
-
|
|
235
|
+
for (const [alias, rawFontId] of Object.entries(fontConfig)) {
|
|
236
|
+
const fontId = applyYasFontOverride(rawFontId);
|
|
237
|
+
if (isWebFontID(fontId)) {
|
|
238
|
+
const defaultWeight = FONT_DECLARATIONS_MAP[fontId].defaults.fontWeight;
|
|
239
|
+
result[alias] = getPostScriptName(fontId, defaultWeight);
|
|
240
|
+
} else result[alias] = fontId;
|
|
241
|
+
}
|
|
230
242
|
result.icons = "uds-icons";
|
|
231
243
|
return result;
|
|
232
244
|
}
|
|
@@ -315,7 +327,7 @@ function resolveTypographyStyles(variantName, typography, config) {
|
|
|
315
327
|
if (typeof lineHeight === "number") result.lineHeight = lineHeight;
|
|
316
328
|
if (typeof letterSpacing === "number") result.letterSpacing = letterSpacing;
|
|
317
329
|
if (typeof fontFamily === "string") {
|
|
318
|
-
const fontId = config.font[fontFamily] ?? fontFamily;
|
|
330
|
+
const fontId = applyYasFontOverride(config.font[fontFamily] ?? fontFamily);
|
|
319
331
|
if (isWebFontID(fontId)) result.fontFamily = getPostScriptName(fontId, typeof fontWeight === "number" ? fontWeight : 400);
|
|
320
332
|
else result.fontFamily = fontId;
|
|
321
333
|
}
|
package/generated/styles.d.ts
CHANGED
|
@@ -1248,7 +1248,7 @@ export declare const avatarStyles: {
|
|
|
1248
1248
|
};
|
|
1249
1249
|
text: {
|
|
1250
1250
|
color: string;
|
|
1251
|
-
fontFamily: '
|
|
1251
|
+
fontFamily: 'YahooProductSans' | 'YahooProductSans-Medium';
|
|
1252
1252
|
fontSize: number;
|
|
1253
1253
|
letterSpacing: number;
|
|
1254
1254
|
lineHeight: number;
|
|
@@ -1294,7 +1294,7 @@ export declare const badgeStyles: {
|
|
|
1294
1294
|
borderWidth: number;
|
|
1295
1295
|
};
|
|
1296
1296
|
text: {
|
|
1297
|
-
fontFamily: '
|
|
1297
|
+
fontFamily: 'YahooProductSans-Medium';
|
|
1298
1298
|
fontSize: number;
|
|
1299
1299
|
letterSpacing: number;
|
|
1300
1300
|
lineHeight: number;
|
|
@@ -1371,7 +1371,7 @@ export declare const buttonStyles: {
|
|
|
1371
1371
|
boxShadow: string;
|
|
1372
1372
|
};
|
|
1373
1373
|
text: {
|
|
1374
|
-
fontFamily: '
|
|
1374
|
+
fontFamily: 'YahooProductSans-Medium';
|
|
1375
1375
|
fontSize: number;
|
|
1376
1376
|
letterSpacing: number;
|
|
1377
1377
|
lineHeight: number;
|
|
@@ -1471,7 +1471,7 @@ export declare const buttonStyles: {
|
|
|
1471
1471
|
export declare const checkboxStyles: {
|
|
1472
1472
|
root: { gap: number };
|
|
1473
1473
|
text: {
|
|
1474
|
-
fontFamily: '
|
|
1474
|
+
fontFamily: 'YahooProductSans';
|
|
1475
1475
|
fontSize: number;
|
|
1476
1476
|
letterSpacing: number;
|
|
1477
1477
|
lineHeight: number;
|
|
@@ -1527,7 +1527,7 @@ export declare const chipStyles: {
|
|
|
1527
1527
|
};
|
|
1528
1528
|
text: {
|
|
1529
1529
|
color: string;
|
|
1530
|
-
fontFamily: '
|
|
1530
|
+
fontFamily: 'YahooProductSans-Medium';
|
|
1531
1531
|
fontSize: number;
|
|
1532
1532
|
letterSpacing: number;
|
|
1533
1533
|
lineHeight: number;
|
|
@@ -1564,7 +1564,7 @@ export declare const dividerStyles: {
|
|
|
1564
1564
|
root: { gap: number };
|
|
1565
1565
|
label: {
|
|
1566
1566
|
color: string;
|
|
1567
|
-
fontFamily: '
|
|
1567
|
+
fontFamily: 'YahooProductSans-Medium';
|
|
1568
1568
|
fontSize: number;
|
|
1569
1569
|
letterSpacing: number;
|
|
1570
1570
|
lineHeight: number;
|
|
@@ -1594,7 +1594,7 @@ export declare const inputStyles: {
|
|
|
1594
1594
|
endIcon: { fontSize: number; iconSizeToken: 'md'; lineHeight: number; color: string };
|
|
1595
1595
|
helperIcon: { fontSize: number; iconSizeToken: 'sm'; lineHeight: number; color: string };
|
|
1596
1596
|
helperText: {
|
|
1597
|
-
fontFamily: '
|
|
1597
|
+
fontFamily: 'YahooProductSans';
|
|
1598
1598
|
fontSize: number;
|
|
1599
1599
|
letterSpacing: number;
|
|
1600
1600
|
lineHeight: number;
|
|
@@ -1605,7 +1605,7 @@ export declare const inputStyles: {
|
|
|
1605
1605
|
inputWrapper: {
|
|
1606
1606
|
borderWidth: number;
|
|
1607
1607
|
borderRadius: number;
|
|
1608
|
-
fontFamily: '
|
|
1608
|
+
fontFamily: 'YahooProductSans';
|
|
1609
1609
|
fontSize: number;
|
|
1610
1610
|
gap: number;
|
|
1611
1611
|
letterSpacing: number;
|
|
@@ -1616,7 +1616,7 @@ export declare const inputStyles: {
|
|
|
1616
1616
|
borderColor: string;
|
|
1617
1617
|
};
|
|
1618
1618
|
label: {
|
|
1619
|
-
fontFamily: '
|
|
1619
|
+
fontFamily: 'YahooProductSans';
|
|
1620
1620
|
fontSize: number;
|
|
1621
1621
|
letterSpacing: number;
|
|
1622
1622
|
lineHeight: number;
|
|
@@ -1711,7 +1711,7 @@ export declare const inputStyles: {
|
|
|
1711
1711
|
|
|
1712
1712
|
export declare const linkStyles: {
|
|
1713
1713
|
root: {
|
|
1714
|
-
fontFamily: '
|
|
1714
|
+
fontFamily: 'YahooProductSans' | 'YahooProductSans-Medium';
|
|
1715
1715
|
fontSize: number;
|
|
1716
1716
|
letterSpacing: number;
|
|
1717
1717
|
lineHeight: number;
|
|
@@ -1830,7 +1830,7 @@ export declare const menuItemStyles: {
|
|
|
1830
1830
|
export declare const radioStyles: {
|
|
1831
1831
|
root: { gap: number };
|
|
1832
1832
|
text: {
|
|
1833
|
-
fontFamily: '
|
|
1833
|
+
fontFamily: 'YahooProductSans';
|
|
1834
1834
|
fontSize: number;
|
|
1835
1835
|
letterSpacing: number;
|
|
1836
1836
|
lineHeight: number;
|
|
@@ -1871,7 +1871,12 @@ export declare const radioStyles: {
|
|
|
1871
1871
|
|
|
1872
1872
|
export declare const switchStyles: {
|
|
1873
1873
|
root: { gap: number; paddingHorizontal: number; paddingVertical: number };
|
|
1874
|
-
text: {
|
|
1874
|
+
text: {
|
|
1875
|
+
fontFamily: 'YahooProductSans';
|
|
1876
|
+
fontSize: number;
|
|
1877
|
+
letterSpacing: number;
|
|
1878
|
+
lineHeight: number;
|
|
1879
|
+
};
|
|
1875
1880
|
handle: { height: number; width: number; backgroundColor: string; boxShadow: string };
|
|
1876
1881
|
handleIcon: { fontSize: number; iconSizeToken: 'sm'; lineHeight: number; color: string };
|
|
1877
1882
|
switch: {
|
|
@@ -1907,7 +1912,12 @@ export declare const toastStyles: {
|
|
|
1907
1912
|
text: { color: string };
|
|
1908
1913
|
icon: { fontSize: number; iconSizeToken: 'md'; lineHeight: number; color: string };
|
|
1909
1914
|
closeIcon: { fontSize: number; iconSizeToken: 'sm'; lineHeight: number; color: string };
|
|
1910
|
-
label: {
|
|
1915
|
+
label: {
|
|
1916
|
+
fontFamily: 'YahooProductSans-Medium';
|
|
1917
|
+
fontSize: number;
|
|
1918
|
+
letterSpacing: number;
|
|
1919
|
+
lineHeight: number;
|
|
1920
|
+
};
|
|
1911
1921
|
} & {
|
|
1912
1922
|
useVariants: (
|
|
1913
1923
|
variants:
|
|
@@ -1932,15 +1942,25 @@ export declare const tooltipStyles: {
|
|
|
1932
1942
|
root: { gap: number; paddingHorizontal: number; paddingVertical: number };
|
|
1933
1943
|
text: { color: string };
|
|
1934
1944
|
icon: { fontSize: number; iconSizeToken: 'xs'; lineHeight: number; color: string };
|
|
1935
|
-
body: {
|
|
1945
|
+
body: {
|
|
1946
|
+
fontFamily: 'YahooProductSans-Medium';
|
|
1947
|
+
fontSize: number;
|
|
1948
|
+
letterSpacing: number;
|
|
1949
|
+
lineHeight: number;
|
|
1950
|
+
};
|
|
1936
1951
|
endContent: {
|
|
1937
|
-
fontFamily: '
|
|
1952
|
+
fontFamily: 'YahooProductSans-Medium';
|
|
1938
1953
|
fontSize: number;
|
|
1939
1954
|
letterSpacing: number;
|
|
1940
1955
|
lineHeight: number;
|
|
1941
1956
|
};
|
|
1942
1957
|
svg: { borderRadius: number; backgroundColor: string };
|
|
1943
|
-
title: {
|
|
1958
|
+
title: {
|
|
1959
|
+
fontFamily: 'YahooProductSans-Medium';
|
|
1960
|
+
fontSize: number;
|
|
1961
|
+
letterSpacing: number;
|
|
1962
|
+
lineHeight: number;
|
|
1963
|
+
};
|
|
1944
1964
|
} & {
|
|
1945
1965
|
useVariants: (
|
|
1946
1966
|
variants:
|