@jobber/components-native 0.69.3 → 0.69.4

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.
@@ -42,6 +42,10 @@ interface TextProps extends Pick<TypographyProps<"base">, "maxFontScaleSize" | "
42
42
  * Have text styled with strike through
43
43
  */
44
44
  readonly strikeThrough?: boolean;
45
+ /**
46
+ * Use italic font style
47
+ */
48
+ readonly italic?: boolean;
45
49
  /**
46
50
  * This will make the text inaccessible to the screen reader.
47
51
  * This should be avoided unless there is a good reason.
@@ -53,5 +57,5 @@ interface TextProps extends Pick<TypographyProps<"base">, "maxFontScaleSize" | "
53
57
  }
54
58
  export type TextLevel = "text" | "textSupporting";
55
59
  export declare const TEXT_MAX_SCALED_FONT_SIZES: Record<TextLevel, number>;
56
- export declare function Text({ level, variation, emphasis, allowFontScaling, adjustsFontSizeToFit, maxLines, align, children, reverseTheme, strikeThrough, hideFromScreenReader, maxFontScaleSize, selectable, }: TextProps): JSX.Element;
60
+ export declare function Text({ level, variation, emphasis, allowFontScaling, adjustsFontSizeToFit, maxLines, align, children, reverseTheme, strikeThrough, italic, hideFromScreenReader, maxFontScaleSize, selectable, }: TextProps): JSX.Element;
57
61
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jobber/components-native",
3
- "version": "0.69.3",
3
+ "version": "0.69.4",
4
4
  "license": "MIT",
5
5
  "description": "React Native implementation of Atlantis",
6
6
  "repository": {
@@ -84,5 +84,5 @@
84
84
  "react-native-safe-area-context": "^4.5.2",
85
85
  "react-native-svg": ">=12.0.0"
86
86
  },
87
- "gitHead": "98d9817ee15a20b4621d662f673ea81df25e01df"
87
+ "gitHead": "540ed88344aa92c9f29d99113173d6278c54b55a"
88
88
  }
@@ -127,6 +127,11 @@ it("renders with strikethrough styling", () => {
127
127
  expect(text.toJSON()).toMatchSnapshot();
128
128
  });
129
129
 
130
+ it("renders with italic styling", () => {
131
+ const text = render(<Text italic>Test Text</Text>);
132
+ expect(text.toJSON()).toMatchSnapshot();
133
+ });
134
+
130
135
  it("renders text that is inaccessible", () => {
131
136
  const text = render(<Text hideFromScreenReader={true}>Test Text</Text>);
132
137
  expect(text.root.props).toEqual(
package/src/Text/Text.tsx CHANGED
@@ -65,6 +65,11 @@ interface TextProps
65
65
  */
66
66
  readonly strikeThrough?: boolean;
67
67
 
68
+ /**
69
+ * Use italic font style
70
+ */
71
+ readonly italic?: boolean;
72
+
68
73
  /**
69
74
  * This will make the text inaccessible to the screen reader.
70
75
  * This should be avoided unless there is a good reason.
@@ -110,6 +115,7 @@ export function Text({
110
115
  children,
111
116
  reverseTheme = false,
112
117
  strikeThrough = false,
118
+ italic = false,
113
119
  hideFromScreenReader = false,
114
120
  maxFontScaleSize,
115
121
  selectable,
@@ -120,7 +126,7 @@ export function Text({
120
126
  <Typography
121
127
  color={variation}
122
128
  fontFamily="base"
123
- fontStyle="regular"
129
+ fontStyle={italic ? "italic" : "regular"}
124
130
  fontWeight={getFontWeight({ level, emphasis })}
125
131
  maxFontScaleSize={maxFontScaleSize || TEXT_MAX_SCALED_FONT_SIZES[level]}
126
132
  selectable={selectable}
@@ -133,6 +139,7 @@ export function Text({
133
139
  reverseTheme,
134
140
  maxLines,
135
141
  strikeThrough,
142
+ italic,
136
143
  hideFromScreenReader,
137
144
  }}
138
145
  >
@@ -580,6 +580,43 @@ exports[`renders text with warn variation 1`] = `
580
580
  </Text>
581
581
  `;
582
582
 
583
+ exports[`renders with italic styling 1`] = `
584
+ <Text
585
+ accessibilityRole="text"
586
+ adjustsFontSizeToFit={false}
587
+ allowFontScaling={true}
588
+ collapsable={false}
589
+ maxFontSizeMultiplier={3.125}
590
+ selectable={true}
591
+ selectionColor="hsl(86, 100%, 46%)"
592
+ style={
593
+ [
594
+ {
595
+ "fontFamily": "inter-italic",
596
+ },
597
+ {
598
+ "color": "hsl(198, 35%, 21%)",
599
+ },
600
+ {
601
+ "textAlign": "left",
602
+ },
603
+ {
604
+ "fontSize": 16,
605
+ "lineHeight": 20,
606
+ },
607
+ {
608
+ "letterSpacing": 0,
609
+ },
610
+ {
611
+ "fontStyle": "italic",
612
+ },
613
+ ]
614
+ }
615
+ >
616
+ Test Text
617
+ </Text>
618
+ `;
619
+
583
620
  exports[`renders with strikethrough styling 1`] = `
584
621
  <Text
585
622
  accessibilityRole="text"
@@ -32,6 +32,26 @@ const deviceFonts = {
32
32
  fontFamily: "inter-extrabold",
33
33
  },
34
34
 
35
+ baseItalicRegular: {
36
+ fontFamily: "inter-italic",
37
+ },
38
+
39
+ baseItalicMedium: {
40
+ fontFamily: "inter-italic-medium",
41
+ },
42
+
43
+ baseItalicBold: {
44
+ fontFamily: "inter-italic-bold",
45
+ },
46
+
47
+ baseItalicSemiBold: {
48
+ fontFamily: "inter-italic-semibold",
49
+ },
50
+
51
+ baseItalicExtraBold: {
52
+ fontFamily: "inter-italic-extrabold",
53
+ },
54
+
35
55
  displayRegularBold: {
36
56
  fontFamily: "jobberpro-bd",
37
57
  },
@@ -64,6 +84,10 @@ export const typographyTokens: { [index: string]: TextStyle } = {
64
84
  // { fontFamily }{ fontStyle }{ fontWeight }
65
85
  ...fonts,
66
86
 
87
+ italic: {
88
+ fontStyle: "italic",
89
+ },
90
+
67
91
  startAlign: {
68
92
  textAlign: "left",
69
93
  },
@@ -106,6 +106,7 @@ export interface TypographyProps<T extends FontFamily>
106
106
  * of the TextInput
107
107
  */
108
108
  readonly hideFromScreenReader?: boolean;
109
+
109
110
  /**
110
111
  * Have text styled with strike through
111
112
  */
@@ -156,6 +157,11 @@ function InternalTypography<T extends FontFamily = "base">({
156
157
  if (strikeThrough) {
157
158
  style.push(styles.strikeThrough);
158
159
  }
160
+
161
+ if (fontStyle === "italic") {
162
+ style.push(styles.italic);
163
+ }
164
+
159
165
  const numberOfLinesForNativeText = maxNumberOfLines[maxLines];
160
166
 
161
167
  const text = getTransformedText(children, transform);
@@ -211,7 +211,7 @@ exports[`renders text with bold weight and italic style 1`] = `
211
211
  style={
212
212
  [
213
213
  {
214
- "fontFamily": "inter-regular",
214
+ "fontFamily": "inter-italic-bold",
215
215
  },
216
216
  {
217
217
  "color": "hsl(197, 15%, 45%)",
@@ -226,6 +226,9 @@ exports[`renders text with bold weight and italic style 1`] = `
226
226
  {
227
227
  "letterSpacing": 0,
228
228
  },
229
+ {
230
+ "fontStyle": "italic",
231
+ },
229
232
  ]
230
233
  }
231
234
  >
@@ -409,7 +412,7 @@ exports[`renders text with italic style 1`] = `
409
412
  style={
410
413
  [
411
414
  {
412
- "fontFamily": "inter-regular",
415
+ "fontFamily": "inter-italic",
413
416
  },
414
417
  {
415
418
  "color": "hsl(197, 15%, 45%)",
@@ -424,6 +427,9 @@ exports[`renders text with italic style 1`] = `
424
427
  {
425
428
  "letterSpacing": 0,
426
429
  },
430
+ {
431
+ "fontStyle": "italic",
432
+ },
427
433
  ]
428
434
  }
429
435
  >