@jobber/components-native 0.7.0 → 0.9.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.
Files changed (42) hide show
  1. package/dist/src/Card/Card.js +38 -0
  2. package/dist/src/Card/Card.style.js +31 -0
  3. package/dist/src/Card/components/InternalCardHeader.js +14 -0
  4. package/dist/src/Card/components/InternalCardHeader.style.js +16 -0
  5. package/dist/src/Card/components/index.js +1 -0
  6. package/dist/src/Card/index.js +1 -0
  7. package/dist/src/StatusLabel/StatusLabel.js +21 -0
  8. package/dist/src/StatusLabel/StatusLabel.style.js +27 -0
  9. package/dist/src/StatusLabel/index.js +1 -0
  10. package/dist/src/Typography/Typography.style.js +101 -164
  11. package/dist/src/Typography/webFonts.js +34 -0
  12. package/dist/src/index.js +2 -0
  13. package/dist/tsconfig.tsbuildinfo +1 -1
  14. package/dist/types/src/Card/Card.d.ts +40 -0
  15. package/dist/types/src/Card/Card.style.d.ts +56 -0
  16. package/dist/types/src/Card/components/InternalCardHeader.d.ts +9 -0
  17. package/dist/types/src/Card/components/InternalCardHeader.style.d.ts +14 -0
  18. package/dist/types/src/Card/components/index.d.ts +1 -0
  19. package/dist/types/src/Card/index.d.ts +2 -0
  20. package/dist/types/src/StatusLabel/StatusLabel.d.ts +22 -0
  21. package/dist/types/src/StatusLabel/StatusLabel.style.d.ts +23 -0
  22. package/dist/types/src/StatusLabel/index.d.ts +2 -0
  23. package/dist/types/src/Typography/Typography.style.d.ts +6 -6
  24. package/dist/types/src/Typography/webFonts.d.ts +4 -0
  25. package/dist/types/src/index.d.ts +2 -0
  26. package/package.json +2 -2
  27. package/src/Card/Card.style.ts +46 -0
  28. package/src/Card/Card.test.tsx +128 -0
  29. package/src/Card/Card.tsx +145 -0
  30. package/src/Card/components/InternalCardHeader.style.ts +19 -0
  31. package/src/Card/components/InternalCardHeader.test.tsx +31 -0
  32. package/src/Card/components/InternalCardHeader.tsx +41 -0
  33. package/src/Card/components/index.ts +1 -0
  34. package/src/Card/index.ts +2 -0
  35. package/src/StatusLabel/StatusLabel.style.ts +30 -0
  36. package/src/StatusLabel/StatusLabel.test.tsx +68 -0
  37. package/src/StatusLabel/StatusLabel.tsx +73 -0
  38. package/src/StatusLabel/__snapshots__/StatusLabel.test.tsx.snap +554 -0
  39. package/src/StatusLabel/index.ts +2 -0
  40. package/src/Typography/Typography.style.ts +33 -18
  41. package/src/Typography/webFonts.ts +43 -0
  42. package/src/index.ts +2 -0
@@ -1,4 +1,5 @@
1
- import { StyleSheet, TextStyle } from "react-native";
1
+ import { Platform, StyleSheet, TextStyle } from "react-native";
2
+ import { webFonts } from "./webFonts";
2
3
  import { tokens } from "../utils/design";
3
4
 
4
5
  const extravagantLineHeight = tokens["typography--lineHeight-extravagant"];
@@ -10,23 +11,7 @@ const baseLineHeight = tokens["typography--lineHeight-base"];
10
11
  const tightLineHeight = tokens["typography--lineHeight-tight"];
11
12
  const minisculeLineHeight = tokens["typography--lineHeight-miniscule"];
12
13
 
13
- /**
14
- * `StyleSheet` for Typography.tsx.
15
- *
16
- * If you find yourself needing to use what's inside this object on files other
17
- * than `<Typography />`, please import from `@jobber/components-native` instead.
18
- *
19
- * ```
20
- * import { typographyStyles } from "@jobber/components-native"
21
- * ```
22
- */
23
-
24
- /**
25
- * Reusable typography tokens to ensure consistency for any client facing texts.
26
- */
27
- export const typographyTokens: { [index: string]: TextStyle } = {
28
- // This follows a pattern of
29
- // { fontFamily }{ fontStyle }{ fontWeight }
14
+ const deviceFonts = {
30
15
  baseRegularRegular: {
31
16
  fontFamily: "inter-regular",
32
17
  },
@@ -58,6 +43,26 @@ export const typographyTokens: { [index: string]: TextStyle } = {
58
43
  displayRegularBlack: {
59
44
  fontFamily: "jobberpro-blk",
60
45
  },
46
+ };
47
+
48
+ /**
49
+ * We need to use web fonts for rendering Typography on Storybook
50
+ * because it uses font files (.ttf) to render them on devices.
51
+ * As we don't want to expose the font files, we are setting the fonts
52
+ * in CSS.
53
+ */
54
+ const fonts = Platform.select({
55
+ web: webFonts,
56
+ default: deviceFonts,
57
+ });
58
+
59
+ /**
60
+ * Reusable typography tokens to ensure consistency for any client facing texts.
61
+ */
62
+ export const typographyTokens: { [index: string]: TextStyle } = {
63
+ // This follows a pattern of
64
+ // { fontFamily }{ fontStyle }{ fontWeight }
65
+ ...fonts,
61
66
 
62
67
  startAlign: {
63
68
  textAlign: "left",
@@ -360,5 +365,15 @@ export const typographyTokens: { [index: string]: TextStyle } = {
360
365
  },
361
366
  };
362
367
 
368
+ /**
369
+ * `StyleSheet` for Typography.tsx.
370
+ *
371
+ * If you find yourself needing to use what's inside this object on files other
372
+ * than `<Typography />`, please import from `@jobber/components-native` instead.
373
+ *
374
+ * ```
375
+ * import { typographyStyles } from "@jobber/components-native"
376
+ * ```
377
+ */
363
378
  export const typographyStyles: { [index: string]: TextStyle } =
364
379
  StyleSheet.create(typographyTokens);
@@ -0,0 +1,43 @@
1
+ import { TextStyle } from "react-native";
2
+
3
+ export const webFonts: { [index: string]: TextStyle } = {
4
+ baseRegularRegular: {
5
+ fontFamily: "'Inter', Helvetica, Arial, sans-serif",
6
+ fontWeight: "400",
7
+ },
8
+
9
+ baseRegularMedium: {
10
+ fontFamily: "'Inter', Helvetica, Arial, sans-serif",
11
+ fontWeight: "500",
12
+ },
13
+
14
+ baseRegularSemiBold: {
15
+ fontFamily: "'Inter', Helvetica, Arial, sans-serif",
16
+ fontWeight: "600",
17
+ },
18
+
19
+ baseRegularBold: {
20
+ fontFamily: "'Inter', Helvetica, Arial, sans-serif",
21
+ fontWeight: "700",
22
+ },
23
+
24
+ baseRegularExtraBold: {
25
+ fontFamily: "'Inter', Helvetica, Arial, sans-serif",
26
+ fontWeight: "800",
27
+ },
28
+
29
+ displayRegularBold: {
30
+ fontFamily: "'Jobber Pro', 'Poppins', Helvetica, Arial, sans-serif",
31
+ fontWeight: "700",
32
+ },
33
+
34
+ displayRegularExtraBold: {
35
+ fontFamily: "'Jobber Pro', 'Poppins', Helvetica, Arial, sans-serif",
36
+ fontWeight: "800",
37
+ },
38
+
39
+ displayRegularBlack: {
40
+ fontFamily: "'Jobber Pro', 'Poppins', Helvetica, Arial, sans-serif",
41
+ fontWeight: "900",
42
+ },
43
+ };
package/src/index.ts CHANGED
@@ -6,4 +6,6 @@ export * from "./ErrorMessageWrapper";
6
6
  export * from "./ActionLabel";
7
7
  export * from "./Content";
8
8
  export * from "./ActivityIndicator";
9
+ export * from "./Card";
10
+ export * from "./StatusLabel";
9
11
  export * from "./AtlantisContext";