@jobber/components-native 0.86.1 → 0.86.2-JOB-89949-ec4cb2a.11
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/package.json +2 -2
- package/dist/src/Typography/Typography.js +16 -5
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/src/ActionLabel/ActionLabel.d.ts +3 -2
- package/dist/types/src/Heading/Heading.d.ts +3 -2
- package/dist/types/src/Text/Text.d.ts +3 -2
- package/dist/types/src/Typography/Typography.d.ts +2 -2
- package/package.json +2 -2
- package/src/ActionLabel/ActionLabel.test.tsx +12 -0
- package/src/ActionLabel/ActionLabel.tsx +2 -2
- package/src/ActionLabel/__snapshots__/ActionLabel.test.tsx.snap +66 -0
- package/src/Heading/Heading.test.tsx +13 -0
- package/src/Heading/Heading.tsx +2 -2
- package/src/Heading/__snapshots__/Heading.test.tsx.snap +65 -0
- package/src/Text/Text.test.tsx +10 -0
- package/src/Text/Text.tsx +2 -2
- package/src/Text/__snapshots__/Text.test.tsx.snap +66 -0
- package/src/Typography/Typography.test.tsx +61 -0
- package/src/Typography/Typography.tsx +24 -8
- package/src/Typography/__snapshots__/Typography.test.tsx.snap +222 -0
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components-native",
|
|
3
|
-
"version": "0.86.
|
|
3
|
+
"version": "0.86.2-JOB-89949-ec4cb2a.11+ec4cb2ad1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "React Native implementation of Atlantis",
|
|
6
6
|
"repository": {
|
|
@@ -95,5 +95,5 @@
|
|
|
95
95
|
"react-native-safe-area-context": "^5.4.0",
|
|
96
96
|
"react-native-svg": ">=12.0.0"
|
|
97
97
|
},
|
|
98
|
-
"gitHead": "
|
|
98
|
+
"gitHead": "ec4cb2ad125a2793e88b405dc0d53041a4c1dab6"
|
|
99
99
|
}
|
|
@@ -38,7 +38,7 @@ function InternalTypography({ fontFamily, fontStyle, fontWeight, transform, colo
|
|
|
38
38
|
style.push(UNSAFE_style.textStyle);
|
|
39
39
|
}
|
|
40
40
|
const numberOfLinesForNativeText = maxNumberOfLines[maxLines];
|
|
41
|
-
const
|
|
41
|
+
const content = transformChildren(children, transform);
|
|
42
42
|
const accessibilityProps = hideFromScreenReader
|
|
43
43
|
? {
|
|
44
44
|
accessibilityRole: "none",
|
|
@@ -50,7 +50,7 @@ function InternalTypography({ fontFamily, fontStyle, fontWeight, transform, colo
|
|
|
50
50
|
const textComponent = (React.createElement(Text, Object.assign({ allowFontScaling,
|
|
51
51
|
adjustsFontSizeToFit,
|
|
52
52
|
style,
|
|
53
|
-
numberOfLines: numberOfLinesForNativeText }, accessibilityProps, { maxFontSizeMultiplier: getScaleMultiplier(maxFontScaleSize, sizeAndHeight.fontSize), selectable: selectable, selectionColor: tokens["color-brand--highlight"], onTextLayout: onTextLayout }),
|
|
53
|
+
numberOfLines: numberOfLinesForNativeText }, accessibilityProps, { maxFontSizeMultiplier: getScaleMultiplier(maxFontScaleSize, sizeAndHeight.fontSize), selectable: selectable, selectionColor: tokens["color-brand--highlight"], onTextLayout: onTextLayout }), content));
|
|
54
54
|
// If text is not selectable, there's no need for TypographyGestureDetector
|
|
55
55
|
// since it only prevents accidental highlighting of selectable text
|
|
56
56
|
if (!selectable) {
|
|
@@ -80,15 +80,26 @@ function getFontStyle(fontFamily = "base", fontStyle = "regular", fontWeight = "
|
|
|
80
80
|
function getTransformedText(text, transform) {
|
|
81
81
|
switch (transform) {
|
|
82
82
|
case "lowercase":
|
|
83
|
-
return text
|
|
83
|
+
return text.toLocaleLowerCase();
|
|
84
84
|
case "uppercase":
|
|
85
|
-
return text
|
|
85
|
+
return text.toLocaleUpperCase();
|
|
86
86
|
case "capitalize":
|
|
87
|
-
return capitalize(text
|
|
87
|
+
return capitalize(text);
|
|
88
88
|
default:
|
|
89
89
|
return text;
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
|
+
function transformChildren(children, transform) {
|
|
93
|
+
if (children == null || !transform || transform === "none")
|
|
94
|
+
return children;
|
|
95
|
+
return React.Children.map(children, child => {
|
|
96
|
+
if (typeof child === "string") {
|
|
97
|
+
return getTransformedText(child, transform);
|
|
98
|
+
}
|
|
99
|
+
// Keep non-string children (numbers, elements, fragments) unchanged
|
|
100
|
+
return child;
|
|
101
|
+
});
|
|
102
|
+
}
|
|
92
103
|
function getColorStyle(styles, color, reverseTheme) {
|
|
93
104
|
if (color === "default" || !color) {
|
|
94
105
|
return styles.greyBlue;
|