@jobber/components-native 0.86.2-JOB-89949-9a8f51e.6 → 0.87.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/package.json +2 -2
- package/dist/src/Typography/Typography.js +4 -4
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/src/ActionLabel/ActionLabel.d.ts +1 -1
- package/dist/types/src/Heading/Heading.d.ts +1 -1
- package/dist/types/src/Text/Text.d.ts +1 -1
- package/dist/types/src/Typography/Typography.d.ts +1 -1
- package/package.json +2 -2
- package/src/ActionLabel/ActionLabel.tsx +1 -1
- package/src/Heading/Heading.tsx +1 -1
- package/src/Text/Text.test.tsx +0 -11
- package/src/Text/Text.tsx +1 -1
- package/src/Text/__snapshots__/Text.test.tsx.snap +0 -38
- package/src/Typography/Typography.tsx +7 -7
|
@@ -4,7 +4,7 @@ export type ActionLabelVariation = Extract<TextColor, "interactive" | "destructi
|
|
|
4
4
|
type ActionLabelType = "default" | "cardTitle";
|
|
5
5
|
interface ActionLabelProps {
|
|
6
6
|
/**
|
|
7
|
-
* Text to display. Supports
|
|
7
|
+
* Text to display. Supports nesting text elements.
|
|
8
8
|
*/
|
|
9
9
|
readonly children?: React.ReactNode;
|
|
10
10
|
/**
|
|
@@ -4,7 +4,7 @@ type HeadingColor = Extract<TextColor, "text" | "subdued" | "heading">;
|
|
|
4
4
|
export type HeadingLevel = "title" | "subtitle" | "heading" | "subHeading";
|
|
5
5
|
interface HeadingProps<T extends HeadingLevel> extends Pick<TypographyProps<"base">, "selectable"> {
|
|
6
6
|
/**
|
|
7
|
-
* Text to display. Supports
|
|
7
|
+
* Text to display. Supports nesting text elements.
|
|
8
8
|
*/
|
|
9
9
|
readonly children: React.ReactNode;
|
|
10
10
|
/**
|
|
@@ -32,7 +32,7 @@ export interface TextProps extends Pick<TypographyProps<"base">, "maxFontScaleSi
|
|
|
32
32
|
*/
|
|
33
33
|
readonly align?: TextAlign;
|
|
34
34
|
/**
|
|
35
|
-
* Text to display. Supports
|
|
35
|
+
* Text to display. Supports nesting text elements.
|
|
36
36
|
*/
|
|
37
37
|
readonly children?: React.ReactNode;
|
|
38
38
|
/**
|
|
@@ -24,7 +24,7 @@ export interface TypographyProps<T extends FontFamily> {
|
|
|
24
24
|
*/
|
|
25
25
|
readonly size?: TextSize;
|
|
26
26
|
/**
|
|
27
|
-
* Text to display. Supports
|
|
27
|
+
* Text to display. Supports nesting text elements.
|
|
28
28
|
*/
|
|
29
29
|
readonly children?: React.ReactNode;
|
|
30
30
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.87.0",
|
|
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": "1277fa27082aa0506ee96f21cb02a05eea472027"
|
|
99
99
|
}
|
|
@@ -12,7 +12,7 @@ type ActionLabelType = "default" | "cardTitle";
|
|
|
12
12
|
|
|
13
13
|
interface ActionLabelProps {
|
|
14
14
|
/**
|
|
15
|
-
* Text to display. Supports
|
|
15
|
+
* Text to display. Supports nesting text elements.
|
|
16
16
|
*/
|
|
17
17
|
readonly children?: React.ReactNode;
|
|
18
18
|
|
package/src/Heading/Heading.tsx
CHANGED
|
@@ -19,7 +19,7 @@ export type HeadingLevel = "title" | "subtitle" | "heading" | "subHeading";
|
|
|
19
19
|
interface HeadingProps<T extends HeadingLevel>
|
|
20
20
|
extends Pick<TypographyProps<"base">, "selectable"> {
|
|
21
21
|
/**
|
|
22
|
-
* Text to display. Supports
|
|
22
|
+
* Text to display. Supports nesting text elements.
|
|
23
23
|
*/
|
|
24
24
|
readonly children: React.ReactNode;
|
|
25
25
|
|
package/src/Text/Text.test.tsx
CHANGED
|
@@ -229,14 +229,3 @@ describe("TypographyGestureDetector", () => {
|
|
|
229
229
|
expect(textElement.props.collapsable).toBeUndefined();
|
|
230
230
|
});
|
|
231
231
|
});
|
|
232
|
-
|
|
233
|
-
it("works when nested inside a native RN Text wrapper", () => {
|
|
234
|
-
const { Text: RNText } = require("react-native");
|
|
235
|
-
const { getByText, toJSON } = render(
|
|
236
|
-
<RNText>
|
|
237
|
-
Outer <Text emphasis="strong">Atlantis</Text> Text
|
|
238
|
-
</RNText>,
|
|
239
|
-
);
|
|
240
|
-
expect(getByText("Atlantis")).toBeDefined();
|
|
241
|
-
expect(toJSON()).toMatchSnapshot();
|
|
242
|
-
});
|
package/src/Text/Text.tsx
CHANGED
|
@@ -760,41 +760,3 @@ exports[`supports nested Text children with mixed styles 1`] = `
|
|
|
760
760
|
!
|
|
761
761
|
</Text>
|
|
762
762
|
`;
|
|
763
|
-
|
|
764
|
-
exports[`works when nested inside a native RN Text wrapper 1`] = `
|
|
765
|
-
<Text>
|
|
766
|
-
Outer
|
|
767
|
-
<Text
|
|
768
|
-
accessibilityRole="text"
|
|
769
|
-
adjustsFontSizeToFit={false}
|
|
770
|
-
allowFontScaling={true}
|
|
771
|
-
collapsable={false}
|
|
772
|
-
maxFontSizeMultiplier={3.125}
|
|
773
|
-
selectable={true}
|
|
774
|
-
selectionColor="hsl(86, 100%, 46%)"
|
|
775
|
-
style={
|
|
776
|
-
[
|
|
777
|
-
{
|
|
778
|
-
"fontFamily": "inter-semibold",
|
|
779
|
-
},
|
|
780
|
-
{
|
|
781
|
-
"color": "hsl(198, 35%, 21%)",
|
|
782
|
-
},
|
|
783
|
-
{
|
|
784
|
-
"textAlign": "left",
|
|
785
|
-
},
|
|
786
|
-
{
|
|
787
|
-
"fontSize": 16,
|
|
788
|
-
"lineHeight": 20,
|
|
789
|
-
},
|
|
790
|
-
{
|
|
791
|
-
"letterSpacing": 0,
|
|
792
|
-
},
|
|
793
|
-
]
|
|
794
|
-
}
|
|
795
|
-
>
|
|
796
|
-
Atlantis
|
|
797
|
-
</Text>
|
|
798
|
-
Text
|
|
799
|
-
</Text>
|
|
800
|
-
`;
|
|
@@ -41,7 +41,7 @@ export interface TypographyProps<T extends FontFamily> {
|
|
|
41
41
|
readonly size?: TextSize;
|
|
42
42
|
|
|
43
43
|
/**
|
|
44
|
-
* Text to display. Supports
|
|
44
|
+
* Text to display. Supports nesting text elements.
|
|
45
45
|
*/
|
|
46
46
|
readonly children?: React.ReactNode;
|
|
47
47
|
|
|
@@ -273,14 +273,14 @@ function getFontStyle(
|
|
|
273
273
|
}
|
|
274
274
|
}
|
|
275
275
|
|
|
276
|
-
function getTransformedText(text
|
|
276
|
+
function getTransformedText(text: string, transform?: TextTransform) {
|
|
277
277
|
switch (transform) {
|
|
278
278
|
case "lowercase":
|
|
279
|
-
return text
|
|
279
|
+
return text.toLocaleLowerCase();
|
|
280
280
|
case "uppercase":
|
|
281
|
-
return text
|
|
281
|
+
return text.toLocaleUpperCase();
|
|
282
282
|
case "capitalize":
|
|
283
|
-
return capitalize(text
|
|
283
|
+
return capitalize(text);
|
|
284
284
|
default:
|
|
285
285
|
return text;
|
|
286
286
|
}
|
|
@@ -290,7 +290,7 @@ function transformChildren(
|
|
|
290
290
|
children: React.ReactNode,
|
|
291
291
|
transform?: TextTransform,
|
|
292
292
|
): React.ReactNode {
|
|
293
|
-
if (children == null) return children;
|
|
293
|
+
if (children == null || !transform || transform === "none") return children;
|
|
294
294
|
|
|
295
295
|
return React.Children.map(children, child => {
|
|
296
296
|
if (typeof child === "string") {
|
|
@@ -298,7 +298,7 @@ function transformChildren(
|
|
|
298
298
|
}
|
|
299
299
|
|
|
300
300
|
// Keep non-string children (numbers, elements, fragments) unchanged
|
|
301
|
-
return child
|
|
301
|
+
return child;
|
|
302
302
|
});
|
|
303
303
|
}
|
|
304
304
|
|