@planningcenter/chat-react-native 1.4.2-rc.1 → 1.4.2

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 (87) hide show
  1. package/build/components/display/avatar.d.ts +10 -0
  2. package/build/components/display/avatar.d.ts.map +1 -0
  3. package/build/components/display/avatar.js +11 -0
  4. package/build/components/display/avatar.js.map +1 -0
  5. package/build/components/display/avatar_group.d.ts +9 -0
  6. package/build/components/display/avatar_group.d.ts.map +1 -0
  7. package/build/components/display/avatar_group.js +11 -0
  8. package/build/components/display/avatar_group.js.map +1 -0
  9. package/build/components/display/heading.d.ts +8 -0
  10. package/build/components/display/heading.d.ts.map +1 -0
  11. package/build/components/display/heading.js +53 -0
  12. package/build/components/display/heading.js.map +1 -0
  13. package/build/components/display/image.d.ts +10 -3
  14. package/build/components/display/image.d.ts.map +1 -1
  15. package/build/components/display/image.js +7 -5
  16. package/build/components/display/image.js.map +1 -1
  17. package/build/components/display/index.d.ts +4 -1
  18. package/build/components/display/index.d.ts.map +1 -1
  19. package/build/components/display/index.js +4 -1
  20. package/build/components/display/index.js.map +1 -1
  21. package/build/components/display/text.d.ts +1 -1
  22. package/build/components/display/text.d.ts.map +1 -1
  23. package/build/components/display/text.js +7 -6
  24. package/build/components/display/text.js.map +1 -1
  25. package/build/components/error_boundary.d.ts +1 -1
  26. package/build/components/primitive/avatar_primitive.d.ts +39 -0
  27. package/build/components/primitive/avatar_primitive.d.ts.map +1 -0
  28. package/build/components/primitive/avatar_primitive.js +204 -0
  29. package/build/components/primitive/avatar_primitive.js.map +1 -0
  30. package/build/contexts/api_provider.d.ts.map +1 -1
  31. package/build/contexts/api_provider.js +3 -14
  32. package/build/contexts/api_provider.js.map +1 -1
  33. package/build/contexts/chat_context.js +2 -2
  34. package/build/contexts/chat_context.js.map +1 -1
  35. package/build/index.js.map +1 -1
  36. package/build/screens/display.d.ts.map +1 -1
  37. package/build/screens/display.js +51 -10
  38. package/build/screens/display.js.map +1 -1
  39. package/build/utils/api.d.ts +9 -0
  40. package/build/utils/api.d.ts.map +1 -0
  41. package/build/utils/api.js +36 -0
  42. package/build/utils/api.js.map +1 -0
  43. package/build/utils/platform_styles.d.ts +2 -0
  44. package/build/utils/platform_styles.d.ts.map +1 -0
  45. package/build/utils/platform_styles.js +7 -0
  46. package/build/utils/platform_styles.js.map +1 -0
  47. package/build/utils/space.d.ts +3 -0
  48. package/build/utils/space.d.ts.map +1 -0
  49. package/build/utils/space.js +22 -0
  50. package/build/utils/space.js.map +1 -0
  51. package/build/utils/theme.d.ts +2 -2
  52. package/build/utils/theme.d.ts.map +1 -1
  53. package/build/utils/theme.js +2 -2
  54. package/build/utils/theme.js.map +1 -1
  55. package/build/vendor/tapestry/alias_tokens_color_map.d.ts +55 -0
  56. package/build/vendor/tapestry/alias_tokens_color_map.d.ts.map +1 -0
  57. package/build/vendor/tapestry/{tapestry_alias_tokens_color_map.js → alias_tokens_color_map.js} +4 -2
  58. package/build/vendor/tapestry/alias_tokens_color_map.js.map +1 -0
  59. package/build/vendor/tapestry/tokens.d.ts +49 -35
  60. package/build/vendor/tapestry/tokens.d.ts.map +1 -1
  61. package/build/vendor/tapestry/tokens.js +18 -0
  62. package/build/vendor/tapestry/tokens.js.map +1 -1
  63. package/package.json +8 -9
  64. package/src/__mocks__/@react-native-async-storage/async-storage.js +3 -0
  65. package/src/__mocks__/react-native-device-info.js +3 -0
  66. package/src/__tests__/hooks/useTheme.tsx +37 -0
  67. package/src/__tests__/utils/space.tsx +60 -0
  68. package/src/components/display/avatar.tsx +23 -0
  69. package/src/components/display/avatar_group.tsx +21 -0
  70. package/src/components/display/heading.tsx +71 -0
  71. package/src/components/display/image.tsx +20 -8
  72. package/src/components/display/index.ts +4 -1
  73. package/src/components/display/text.tsx +7 -6
  74. package/src/components/primitive/avatar_primitive.tsx +374 -0
  75. package/src/contexts/api_provider.tsx +4 -17
  76. package/src/contexts/chat_context.tsx +2 -2
  77. package/src/index.tsx +0 -1
  78. package/src/screens/display.tsx +52 -13
  79. package/src/utils/api.ts +47 -0
  80. package/src/utils/platform_styles.ts +7 -0
  81. package/src/utils/space.ts +39 -0
  82. package/src/utils/theme.ts +3 -3
  83. package/src/vendor/tapestry/{tapestry_alias_tokens_color_map.ts → alias_tokens_color_map.ts} +8 -5
  84. package/src/vendor/tapestry/tokens.ts +25 -50
  85. package/build/vendor/tapestry/tapestry_alias_tokens_color_map.d.ts +0 -53
  86. package/build/vendor/tapestry/tapestry_alias_tokens_color_map.d.ts.map +0 -1
  87. package/build/vendor/tapestry/tapestry_alias_tokens_color_map.js.map +0 -1
@@ -1,38 +1,52 @@
1
1
  export declare const tokens: {
2
- borderRadiusDefault: number;
3
- spacingFourth: number;
4
- spacingHalf: number;
5
- spacing1: number;
6
- spacing2: number;
7
- spacing3: number;
8
- spacing4: number;
9
- spacing5: number;
10
- spacing6: number;
11
- spacing7: number;
12
- borderRadiusSm: number;
13
- borderRadiusMd: number;
14
- borderRadiusLg: number;
15
- borderRadiusXl: number;
16
- borderRadiusRound: number;
17
- borderSizeDefault: number;
18
- borderSizeThick: number;
19
- colorNeutral7: string;
20
- colorNeutral12: string;
21
- colorNeutral15: string;
22
- colorNeutral17: string;
23
- colorNeutral19: string;
24
- colorNeutral24: string;
25
- colorNeutral32: string;
26
- colorNeutral45: string;
27
- colorNeutral50: string;
28
- colorNeutral58: string;
29
- colorNeutral68: string;
30
- colorNeutral81: string;
31
- colorNeutral88: string;
32
- colorNeutral93: string;
33
- colorNeutral95: string;
34
- colorNeutral97: string;
35
- colorNeutral98: string;
36
- colorNeutral100White: string;
2
+ colorInteractionOnlineDefault: "hsl(123, 38%, 57%)";
3
+ borderRadiusDefault: 4;
4
+ spacingFourth: 2;
5
+ spacingHalf: 4;
6
+ spacing1: 8;
7
+ spacing2: 16;
8
+ spacing3: 24;
9
+ spacing4: 32;
10
+ spacing5: 40;
11
+ spacing6: 48;
12
+ spacing7: 56;
13
+ borderRadiusSm: 2;
14
+ borderRadiusMd: 4;
15
+ borderRadiusLg: 8;
16
+ borderRadiusXl: 16;
17
+ borderRadiusRound: 56;
18
+ borderSizeDefault: 1;
19
+ borderSizeThick: 2;
20
+ fontWeightNormal: "400";
21
+ fontWeightMedium: "500";
22
+ fontWeightSemiBold: "600";
23
+ fontWeightBold: "700";
24
+ fontSize4xl: 32;
25
+ fontSize3xl: 28;
26
+ fontSize2xl: 24;
27
+ fontSizeXl: 20;
28
+ fontSizeLg: 18;
29
+ fontSizeMd: 16;
30
+ fontSizeSm: 14;
31
+ fontSizeXs: 12;
32
+ fontSize2xs: 10;
33
+ colorNeutral7: "hsl(0, 0%, 7%)";
34
+ colorNeutral12: "hsl(0, 0%, 12%)";
35
+ colorNeutral15: "hsl(0, 0%, 15%)";
36
+ colorNeutral17: "hsl(0, 0%, 17%)";
37
+ colorNeutral19: "hsl(0, 0%, 19%)";
38
+ colorNeutral24: "hsl(0, 0%, 24%)";
39
+ colorNeutral32: "hsl(0, 0%, 32%)";
40
+ colorNeutral45: "hsl(0, 0%, 45%)";
41
+ colorNeutral50: "hsl(0, 0%, 50%)";
42
+ colorNeutral58: "hsl(0, 0%, 58%)";
43
+ colorNeutral68: "hsl(0, 0%, 68%)";
44
+ colorNeutral81: "hsl(0, 0%, 81%)";
45
+ colorNeutral88: "hsl(0, 0%, 88%)";
46
+ colorNeutral93: "hsl(0, 0%, 93%)";
47
+ colorNeutral95: "hsl(0, 0%, 95%)";
48
+ colorNeutral97: "hsl(0, 0%, 97%)";
49
+ colorNeutral98: "hsl(0, 0%, 98%)";
50
+ colorNeutral100White: "hsl(0, 0%, 100%)";
37
51
  };
38
52
  //# sourceMappingURL=tokens.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../../src/vendor/tapestry/tokens.ts"],"names":[],"mappings":"AA4FA,eAAO,MAAM,MAAM;yBAPI,MAAM;mBAtCZ,MAAM;iBACR,MAAM;cACT,MAAM;cACN,MAAM;cACN,MAAM;cACN,MAAM;cACN,MAAM;cACN,MAAM;cACN,MAAM;oBACA,MAAM;oBACN,MAAM;oBACN,MAAM;oBACN,MAAM;uBACH,MAAM;uBACN,MAAM;qBACR,MAAM;mBAzDR,MAAM;oBACL,MAAM;oBACN,MAAM;oBACN,MAAM;oBACN,MAAM;oBACN,MAAM;oBACN,MAAM;oBACN,MAAM;oBACN,MAAM;oBACN,MAAM;oBACN,MAAM;oBACN,MAAM;oBACN,MAAM;oBACN,MAAM;oBACN,MAAM;oBACN,MAAM;oBACN,MAAM;0BACA,MAAM;CA0E7B,CAAA"}
1
+ {"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../../src/vendor/tapestry/tokens.ts"],"names":[],"mappings":"AAkEA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAKlB,CAAA"}
@@ -38,13 +38,31 @@ const numericPrimtives = {
38
38
  borderRadiusRound: 56,
39
39
  borderSizeDefault: 1,
40
40
  borderSizeThick: 2,
41
+ fontWeightNormal: '400',
42
+ fontWeightMedium: '500',
43
+ fontWeightSemiBold: '600',
44
+ fontWeightBold: '700',
45
+ fontSize4xl: 32,
46
+ fontSize3xl: 28,
47
+ fontSize2xl: 24,
48
+ fontSizeXl: 20,
49
+ fontSizeLg: 18,
50
+ fontSizeMd: 16,
51
+ fontSizeSm: 14,
52
+ fontSizeXs: 12,
53
+ fontSize2xs: 10,
41
54
  };
42
55
  const numericAliases = {
43
56
  borderRadiusDefault: numericPrimtives.borderRadiusMd,
44
57
  };
58
+ // These tokens are specfic to Chat will not be replaced by the Tapestry library
59
+ const localChatTokens = {
60
+ colorInteractionOnlineDefault: 'hsl(123, 38%, 57%)',
61
+ };
45
62
  export const tokens = {
46
63
  ...colorPrimitives,
47
64
  ...numericPrimtives,
48
65
  ...numericAliases,
66
+ ...localChatTokens,
49
67
  };
50
68
  //# sourceMappingURL=tokens.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../../src/vendor/tapestry/tokens.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD,2FAA2F;AAC3F,0GAA0G;AAuB1G,MAAM,eAAe,GAAmB;IACtC,aAAa,EAAE,gBAAgB;IAC/B,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,oBAAoB,EAAE,kBAAkB;CACzC,CAAA;AAqBD,MAAM,gBAAgB,GAAsB;IAC1C,aAAa,EAAE,CAAC;IAChB,WAAW,EAAE,CAAC;IACd,QAAQ,EAAE,CAAC;IACX,QAAQ,EAAE,EAAE;IACZ,QAAQ,EAAE,EAAE;IACZ,QAAQ,EAAE,EAAE;IACZ,QAAQ,EAAE,EAAE;IACZ,QAAQ,EAAE,EAAE;IACZ,QAAQ,EAAE,EAAE;IACZ,cAAc,EAAE,CAAC;IACjB,cAAc,EAAE,CAAC;IACjB,cAAc,EAAE,CAAC;IACjB,cAAc,EAAE,EAAE;IAClB,iBAAiB,EAAE,EAAE;IACrB,iBAAiB,EAAE,CAAC;IACpB,eAAe,EAAE,CAAC;CACnB,CAAA;AAMD,MAAM,cAAc,GAAmB;IACrC,mBAAmB,EAAE,gBAAgB,CAAC,cAAc;CACrD,CAAA;AAED,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,GAAG,eAAe;IAClB,GAAG,gBAAgB;IACnB,GAAG,cAAc;CAClB,CAAA","sourcesContent":["// Copied from `@planningcenter/tapestry` package.\n// Defining these tokens locally is a temporary solution until the package supports mobile.\n// Tokens Reference: https://planningcenter.github.io/tapestry/?path=/docs/foundations-design-tokens--docs\n\ninterface ColorPrimitves {\n colorNeutral7: string\n colorNeutral12: string\n colorNeutral15: string\n colorNeutral17: string\n colorNeutral19: string\n colorNeutral24: string\n colorNeutral32: string\n colorNeutral45: string\n colorNeutral50: string\n colorNeutral58: string\n colorNeutral68: string\n colorNeutral81: string\n colorNeutral88: string\n colorNeutral93: string\n colorNeutral95: string\n colorNeutral97: string\n colorNeutral98: string\n colorNeutral100White: string\n}\n\nconst colorPrimitives: ColorPrimitves = {\n colorNeutral7: 'hsl(0, 0%, 7%)',\n colorNeutral12: 'hsl(0, 0%, 12%)',\n colorNeutral15: 'hsl(0, 0%, 15%)',\n colorNeutral17: 'hsl(0, 0%, 17%)',\n colorNeutral19: 'hsl(0, 0%, 19%)',\n colorNeutral24: 'hsl(0, 0%, 24%)',\n colorNeutral32: 'hsl(0, 0%, 32%)',\n colorNeutral45: 'hsl(0, 0%, 45%)',\n colorNeutral50: 'hsl(0, 0%, 50%)',\n colorNeutral58: 'hsl(0, 0%, 58%)',\n colorNeutral68: 'hsl(0, 0%, 68%)',\n colorNeutral81: 'hsl(0, 0%, 81%)',\n colorNeutral88: 'hsl(0, 0%, 88%)',\n colorNeutral93: 'hsl(0, 0%, 93%)',\n colorNeutral95: 'hsl(0, 0%, 95%)',\n colorNeutral97: 'hsl(0, 0%, 97%)',\n colorNeutral98: 'hsl(0, 0%, 98%)',\n colorNeutral100White: 'hsl(0, 0%, 100%)',\n}\n\ninterface NumericPrimitives {\n spacingFourth: number\n spacingHalf: number\n spacing1: number\n spacing2: number\n spacing3: number\n spacing4: number\n spacing5: number\n spacing6: number\n spacing7: number\n borderRadiusSm: number\n borderRadiusMd: number\n borderRadiusLg: number\n borderRadiusXl: number\n borderRadiusRound: number\n borderSizeDefault: number\n borderSizeThick: number\n}\n\nconst numericPrimtives: NumericPrimitives = {\n spacingFourth: 2,\n spacingHalf: 4,\n spacing1: 8,\n spacing2: 16,\n spacing3: 24,\n spacing4: 32,\n spacing5: 40,\n spacing6: 48,\n spacing7: 56,\n borderRadiusSm: 2,\n borderRadiusMd: 4,\n borderRadiusLg: 8,\n borderRadiusXl: 16,\n borderRadiusRound: 56,\n borderSizeDefault: 1,\n borderSizeThick: 2,\n}\n\ninterface NumericAliases {\n borderRadiusDefault: number\n}\n\nconst numericAliases: NumericAliases = {\n borderRadiusDefault: numericPrimtives.borderRadiusMd,\n}\n\nexport const tokens = {\n ...colorPrimitives,\n ...numericPrimtives,\n ...numericAliases,\n}\n"]}
1
+ {"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../../src/vendor/tapestry/tokens.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD,2FAA2F;AAC3F,0GAA0G;AAE1G,MAAM,eAAe,GAAG;IACtB,aAAa,EAAE,gBAAgB;IAC/B,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,oBAAoB,EAAE,kBAAkB;CAChC,CAAA;AAEV,MAAM,gBAAgB,GAAG;IACvB,aAAa,EAAE,CAAC;IAChB,WAAW,EAAE,CAAC;IACd,QAAQ,EAAE,CAAC;IACX,QAAQ,EAAE,EAAE;IACZ,QAAQ,EAAE,EAAE;IACZ,QAAQ,EAAE,EAAE;IACZ,QAAQ,EAAE,EAAE;IACZ,QAAQ,EAAE,EAAE;IACZ,QAAQ,EAAE,EAAE;IACZ,cAAc,EAAE,CAAC;IACjB,cAAc,EAAE,CAAC;IACjB,cAAc,EAAE,CAAC;IACjB,cAAc,EAAE,EAAE;IAClB,iBAAiB,EAAE,EAAE;IACrB,iBAAiB,EAAE,CAAC;IACpB,eAAe,EAAE,CAAC;IAClB,gBAAgB,EAAE,KAAK;IACvB,gBAAgB,EAAE,KAAK;IACvB,kBAAkB,EAAE,KAAK;IACzB,cAAc,EAAE,KAAK;IACrB,WAAW,EAAE,EAAE;IACf,WAAW,EAAE,EAAE;IACf,WAAW,EAAE,EAAE;IACf,UAAU,EAAE,EAAE;IACd,UAAU,EAAE,EAAE;IACd,UAAU,EAAE,EAAE;IACd,UAAU,EAAE,EAAE;IACd,UAAU,EAAE,EAAE;IACd,WAAW,EAAE,EAAE;CACP,CAAA;AAEV,MAAM,cAAc,GAAG;IACrB,mBAAmB,EAAE,gBAAgB,CAAC,cAAc;CAC5C,CAAA;AAEV,gFAAgF;AAChF,MAAM,eAAe,GAAG;IACtB,6BAA6B,EAAE,oBAAoB;CAC3C,CAAA;AAEV,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,GAAG,eAAe;IAClB,GAAG,gBAAgB;IACnB,GAAG,cAAc;IACjB,GAAG,eAAe;CACnB,CAAA","sourcesContent":["// Copied from `@planningcenter/tapestry` package.\n// Defining these tokens locally is a temporary solution until the package supports mobile.\n// Tokens Reference: https://planningcenter.github.io/tapestry/?path=/docs/foundations-design-tokens--docs\n\nconst colorPrimitives = {\n colorNeutral7: 'hsl(0, 0%, 7%)',\n colorNeutral12: 'hsl(0, 0%, 12%)',\n colorNeutral15: 'hsl(0, 0%, 15%)',\n colorNeutral17: 'hsl(0, 0%, 17%)',\n colorNeutral19: 'hsl(0, 0%, 19%)',\n colorNeutral24: 'hsl(0, 0%, 24%)',\n colorNeutral32: 'hsl(0, 0%, 32%)',\n colorNeutral45: 'hsl(0, 0%, 45%)',\n colorNeutral50: 'hsl(0, 0%, 50%)',\n colorNeutral58: 'hsl(0, 0%, 58%)',\n colorNeutral68: 'hsl(0, 0%, 68%)',\n colorNeutral81: 'hsl(0, 0%, 81%)',\n colorNeutral88: 'hsl(0, 0%, 88%)',\n colorNeutral93: 'hsl(0, 0%, 93%)',\n colorNeutral95: 'hsl(0, 0%, 95%)',\n colorNeutral97: 'hsl(0, 0%, 97%)',\n colorNeutral98: 'hsl(0, 0%, 98%)',\n colorNeutral100White: 'hsl(0, 0%, 100%)',\n} as const\n\nconst numericPrimtives = {\n spacingFourth: 2,\n spacingHalf: 4,\n spacing1: 8,\n spacing2: 16,\n spacing3: 24,\n spacing4: 32,\n spacing5: 40,\n spacing6: 48,\n spacing7: 56,\n borderRadiusSm: 2,\n borderRadiusMd: 4,\n borderRadiusLg: 8,\n borderRadiusXl: 16,\n borderRadiusRound: 56,\n borderSizeDefault: 1,\n borderSizeThick: 2,\n fontWeightNormal: '400',\n fontWeightMedium: '500',\n fontWeightSemiBold: '600',\n fontWeightBold: '700',\n fontSize4xl: 32,\n fontSize3xl: 28,\n fontSize2xl: 24,\n fontSizeXl: 20,\n fontSizeLg: 18,\n fontSizeMd: 16,\n fontSizeSm: 14,\n fontSizeXs: 12,\n fontSize2xs: 10,\n} as const\n\nconst numericAliases = {\n borderRadiusDefault: numericPrimtives.borderRadiusMd,\n} as const\n\n// These tokens are specfic to Chat will not be replaced by the Tapestry library\nconst localChatTokens = {\n colorInteractionOnlineDefault: 'hsl(123, 38%, 57%)',\n} as const\n\nexport const tokens = {\n ...colorPrimitives,\n ...numericPrimtives,\n ...numericAliases,\n ...localChatTokens,\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@planningcenter/chat-react-native",
3
- "version": "1.4.2-rc.1",
3
+ "version": "1.4.2",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -17,7 +17,7 @@
17
17
  "prepublishOnly": "expo-module prepublishOnly"
18
18
  },
19
19
  "dependencies": {
20
- "@planningcenter/chat-core": "^1.4.0"
20
+ "@planningcenter/chat-core": "^1.4.2"
21
21
  },
22
22
  "peerDependencies": {
23
23
  "@react-navigation/elements": "*",
@@ -25,18 +25,17 @@
25
25
  "@tanstack/react-query": "^5.0.0",
26
26
  "lodash": "*",
27
27
  "react": "*",
28
- "react-native": "*"
28
+ "react-native": "*",
29
+ "react-native-device-info": "*"
29
30
  },
30
31
  "devDependencies": {
31
32
  "@react-native/eslint-config": "^0.77.0",
32
- "@react-navigation/elements": "^2.2.3",
33
- "@react-navigation/native": "^7.0.14",
34
- "@tanstack/react-query": "^5.66.0",
33
+ "@types/jest": "^29.5.14",
35
34
  "@typescript-eslint/parser": "^8.23.0",
36
35
  "expo-module-scripts": "^4.0.3",
37
- "lodash": "^4.17.21",
36
+ "jest": "^29.4.0",
38
37
  "prettier": "^3.4.2",
39
- "react-native": "0.74.5"
38
+ "typescript": "<5.6.0"
40
39
  },
41
- "gitHead": "bffd2651f686d7894cc0c8bfb4c0d7ae0dc2643e"
40
+ "gitHead": "5f14aa33a101f75e5abf85636d6e1492123595cf"
42
41
  }
@@ -0,0 +1,3 @@
1
+ import AsyncStorage from '@react-native-async-storage/async-storage/jest/async-storage-mock'
2
+
3
+ export default AsyncStorage
@@ -0,0 +1,3 @@
1
+ import mockRNDeviceInfo from 'react-native-device-info/jest/react-native-device-info-mock'
2
+
3
+ export default mockRNDeviceInfo
@@ -0,0 +1,37 @@
1
+ import { renderHook } from '@testing-library/react-native'
2
+ import { useTheme } from '../../hooks'
3
+ import { ChatProvider } from '../../contexts'
4
+ import React from 'react'
5
+
6
+ const theme = {
7
+ colors: {
8
+ primary: '#0070f3',
9
+ },
10
+ }
11
+
12
+ const Wrapper = ({ children }: { children: React.ReactNode }) => {
13
+ return (
14
+ <ChatProvider
15
+ value={{
16
+ token: {
17
+ access_token: '',
18
+ created_at: 0,
19
+ expires_in: 0,
20
+ scope: '',
21
+ refresh_token: '',
22
+ token_type: '',
23
+ },
24
+ onTokenExpired: () => null,
25
+ theme,
26
+ }}
27
+ >
28
+ {children}
29
+ </ChatProvider>
30
+ )
31
+ }
32
+
33
+ test('should use theme', () => {
34
+ const { result } = renderHook(() => useTheme(), { wrapper: Wrapper })
35
+
36
+ expect(result.current).toBeDefined()
37
+ })
@@ -0,0 +1,60 @@
1
+ import { space, SpacingValues } from '../../utils/space'
2
+ import { tokens } from '../../vendor/tapestry/tokens'
3
+
4
+ describe('space function', () => {
5
+ // Spy on console.warn to check for invalid inputs
6
+ beforeEach(() => {
7
+ jest.spyOn(console, 'warn').mockImplementation(() => {})
8
+ })
9
+
10
+ afterEach(() => {
11
+ jest.restoreAllMocks()
12
+ })
13
+
14
+ const validTokenValues: Record<SpacingValues, number> = {
15
+ 0.25: tokens.spacingFourth,
16
+ 0.5: tokens.spacingHalf,
17
+ 1: tokens.spacing1,
18
+ 1.5: tokens.spacing1 + tokens.spacingHalf,
19
+ 2: tokens.spacing2,
20
+ 2.5: tokens.spacing2 + tokens.spacingHalf,
21
+ 3: tokens.spacing3,
22
+ 3.5: tokens.spacing3 + tokens.spacingHalf,
23
+ 4: tokens.spacing4,
24
+ 4.5: tokens.spacing4 + tokens.spacingHalf,
25
+ 5: tokens.spacing5,
26
+ 5.5: tokens.spacing5 + tokens.spacingHalf,
27
+ 6: tokens.spacing6,
28
+ 6.5: tokens.spacing6 + tokens.spacingHalf,
29
+ 7: tokens.spacing7,
30
+ 7.5: tokens.spacing7 + tokens.spacingHalf,
31
+ }
32
+
33
+ it('should return the correct token values for all valid SpacingValues', () => {
34
+ Object.entries(validTokenValues).forEach(([value, expected]) => {
35
+ expect(space(Number(value) as SpacingValues)).toBe(expected)
36
+ })
37
+ })
38
+
39
+ it('should warn and return 0 for an invalid value less than 1 (e.g., 0.8)', () => {
40
+ const result = space(0.8 as SpacingValues)
41
+ expect(result).toBe(0)
42
+ expect(console.warn).toHaveBeenCalledWith(warnText('0.8'))
43
+ })
44
+
45
+ it('should warn and return 0 for an invalid fractional value (e.g., 1.8)', () => {
46
+ const result = space(1.8 as SpacingValues)
47
+ expect(result).toBe(0)
48
+ expect(console.warn).toHaveBeenCalledWith(warnText('1.8'))
49
+ })
50
+
51
+ it('should warn and return 0 for a value greater than 7.5 (e.g., 19)', () => {
52
+ const result = space(19 as SpacingValues)
53
+ expect(result).toBe(0)
54
+ expect(console.warn).toHaveBeenCalledWith(warnText('19'))
55
+ })
56
+ })
57
+
58
+ function warnText(value: string) {
59
+ return `Invalid space value: ${value} — Must be a whole or half number between 1–7.`
60
+ }
@@ -0,0 +1,23 @@
1
+ import React from 'react'
2
+ import AvatarPrimitive, {
3
+ type AvatarImageProps,
4
+ type AvatarPresenceProps,
5
+ type AvatarRootProps,
6
+ } from '../primitive/avatar_primitive'
7
+
8
+ interface AvatarProps {
9
+ sourceUri: AvatarImageProps['sourceUri']
10
+ size?: AvatarRootProps['size']
11
+ presence?: AvatarPresenceProps['presence']
12
+ }
13
+
14
+ export function Avatar({ presence, size = 'lg', sourceUri }: AvatarProps) {
15
+ return (
16
+ <AvatarPrimitive.Root size={size}>
17
+ <AvatarPrimitive.Mask>
18
+ <AvatarPrimitive.Image sourceUri={sourceUri} />
19
+ </AvatarPrimitive.Mask>
20
+ {presence && <AvatarPrimitive.Presence presence={presence} />}
21
+ </AvatarPrimitive.Root>
22
+ )
23
+ }
@@ -0,0 +1,21 @@
1
+ import React from 'react'
2
+ import AvatarPrimitive, {
3
+ type AvatarGroupProps,
4
+ type AvatarRootProps,
5
+ } from '../primitive/avatar_primitive'
6
+
7
+ interface AvatarGroupDisplayProps {
8
+ sourceUris: AvatarGroupProps['sourceUris']
9
+ size?: AvatarRootProps['size']
10
+ }
11
+
12
+ export function AvatarGroup({ sourceUris, size = 'lg' }: AvatarGroupDisplayProps) {
13
+ return (
14
+ <AvatarPrimitive.Root size={size}>
15
+ <AvatarPrimitive.Mask>
16
+ <AvatarPrimitive.Group sourceUris={sourceUris} />
17
+ <AvatarPrimitive.GroupLoader />
18
+ </AvatarPrimitive.Mask>
19
+ </AvatarPrimitive.Root>
20
+ )
21
+ }
@@ -0,0 +1,71 @@
1
+ import { useTheme } from '../../hooks'
2
+ import React from 'react'
3
+ import {
4
+ Platform,
5
+ StyleSheet,
6
+ Text as ReactNativeText,
7
+ TextProps as ReactNativeTextProps,
8
+ } from 'react-native'
9
+ import { tokens } from '../../vendor/tapestry/tokens'
10
+ import { platformFontWeightBold } from '../../utils/platform_styles'
11
+
12
+ interface TextProps extends ReactNativeTextProps {
13
+ variant?: 'h1' | 'h2' | 'h3' | 'h4'
14
+ }
15
+
16
+ export function Heading({ style, variant = 'h1', children, ...props }: TextProps) {
17
+ const styles = useStyles()
18
+ const variantStyleMap = {
19
+ h1: styles.heading1,
20
+ h2: styles.heading2,
21
+ h3: styles.heading3,
22
+ h4: styles.heading4,
23
+ }
24
+
25
+ return (
26
+ <ReactNativeText
27
+ style={[styles.global, variantStyleMap[variant], style]}
28
+ accessibilityRole="header"
29
+ {...props}
30
+ >
31
+ {children}
32
+ </ReactNativeText>
33
+ )
34
+ }
35
+
36
+ const useStyles = () => {
37
+ const { colors } = useTheme()
38
+
39
+ return StyleSheet.create({
40
+ global: {
41
+ fontFamily: Platform.select({
42
+ ios: 'System',
43
+ android: 'normal',
44
+ }),
45
+ },
46
+ heading1: {
47
+ color: colors.textColorDefaultHeadline,
48
+ fontSize: 25, // Todo: Check with UX on correct token
49
+ lineHeight: 32,
50
+ },
51
+ heading2: {
52
+ color: colors.textColorDefaultHeadline,
53
+ fontWeight: platformFontWeightBold,
54
+ fontSize: 21, // Todo: Check with UX on correct token
55
+ lineHeight: 24,
56
+ },
57
+ heading3: {
58
+ color: colors.textColorDefaultHeadline,
59
+ fontWeight: platformFontWeightBold,
60
+ fontSize: tokens.fontSizeLg,
61
+ lineHeight: 22,
62
+ },
63
+ heading4: {
64
+ color: colors.textColorDefaultSecondary,
65
+ fontWeight: platformFontWeightBold,
66
+ fontSize: tokens.fontSizeSm,
67
+ lineHeight: 20,
68
+ textTransform: 'uppercase',
69
+ },
70
+ })
71
+ }
@@ -12,11 +12,15 @@ import {
12
12
  import { useTheme } from '../../hooks'
13
13
  import { Spinner } from './spinner'
14
14
 
15
- interface ImageProps extends ReactNativeImageProps {
15
+ export interface ImageProps extends ReactNativeImageProps {
16
16
  /**
17
17
  * Should the image show the loading indicator by default.
18
18
  */
19
19
  defaultLoading?: boolean
20
+ /**
21
+ * Turn on or off loading spinner.
22
+ */
23
+ loadingEnabled?: boolean
20
24
  /**
21
25
  * Size of the loading spinner.
22
26
  */
@@ -25,16 +29,22 @@ interface ImageProps extends ReactNativeImageProps {
25
29
  * Style object for the preload background.
26
30
  */
27
31
  loadingBackgroundStyles?: ViewStyle
32
+ /**
33
+ * Style the outer View of the image.
34
+ */
35
+ wrapperStyle?: ViewStyle
28
36
  }
29
37
 
30
38
  export function Image({
31
39
  source,
32
40
  onLoad = noop,
33
41
  defaultLoading = true,
42
+ loadingEnabled = true,
34
43
  loaderSize = 24,
35
44
  loadingBackgroundStyles,
36
- style,
37
- ...restProps
45
+ style = {},
46
+ wrapperStyle = {},
47
+ ...props
38
48
  }: ImageProps) {
39
49
  const [loading, setLoading] = useState(defaultLoading)
40
50
 
@@ -48,14 +58,14 @@ export function Image({
48
58
  }
49
59
 
50
60
  return (
51
- <View>
61
+ <View style={wrapperStyle}>
52
62
  <ReactNativeImage
53
63
  style={[styles.image, imageStyles]}
54
64
  onLoad={handleOnLoad}
55
65
  source={source}
56
- {...restProps}
66
+ {...props}
57
67
  />
58
- {loading && (
68
+ {loading && loadingEnabled && (
59
69
  <View style={[styles.loadingBackground, loadingBackgroundStyles]}>
60
70
  <Spinner size={loaderSize} />
61
71
  </View>
@@ -67,7 +77,7 @@ export function Image({
67
77
  const useStyles = (
68
78
  width: DimensionValue,
69
79
  height: DimensionValue,
70
- borderRadius: AnimatableNumericValue
80
+ borderRadius: AnimatableNumericValue | string
71
81
  ) => {
72
82
  const { colors } = useTheme()
73
83
 
@@ -82,7 +92,9 @@ const useStyles = (
82
92
  height,
83
93
  },
84
94
  image: {
85
- backgroundColor: 'transparent',
95
+ backgroundColor: colors.fillColorNeutral070,
96
+ width,
97
+ height,
86
98
  },
87
99
  })
88
100
  }
@@ -1,3 +1,6 @@
1
+ export { Avatar } from './avatar'
2
+ export { AvatarGroup } from './avatar_group'
3
+ export { Heading } from './heading'
4
+ export { Image, ImageProps } from './image'
1
5
  export { Spinner } from './spinner'
2
- export { Image } from './image'
3
6
  export { Text } from './text'
@@ -6,12 +6,13 @@ import {
6
6
  Text as ReactNativeText,
7
7
  TextProps as ReactNativeTextProps,
8
8
  } from 'react-native'
9
+ import { tokens } from '../../vendor/tapestry/tokens'
9
10
 
10
11
  interface TextProps extends ReactNativeTextProps {
11
12
  variant?: 'plain' | 'secondary' | 'tertiary' | 'footnote'
12
13
  }
13
14
 
14
- export function Text({ style, variant = 'plain', children, ...rest }: TextProps) {
15
+ export function Text({ style, variant = 'plain', children, ...props }: TextProps) {
15
16
  const styles = useStyles()
16
17
  const variantStyleMap = {
17
18
  plain: styles.plain,
@@ -21,7 +22,7 @@ export function Text({ style, variant = 'plain', children, ...rest }: TextProps)
21
22
  }
22
23
 
23
24
  return (
24
- <ReactNativeText style={[styles.global, variantStyleMap[variant], style]} {...rest}>
25
+ <ReactNativeText style={[styles.global, variantStyleMap[variant], style]} {...props}>
25
26
  {children}
26
27
  </ReactNativeText>
27
28
  )
@@ -38,22 +39,22 @@ const useStyles = () => {
38
39
  },
39
40
  plain: {
40
41
  color: colors.textColorDefaultPrimary,
41
- fontSize: 16,
42
+ fontSize: tokens.fontSizeMd,
42
43
  lineHeight: 24,
43
44
  },
44
45
  secondary: {
45
46
  color: colors.textColorDefaultPrimary,
46
- fontSize: 15,
47
+ fontSize: 15, // TODO: Check with UX on correct token
47
48
  lineHeight: 22,
48
49
  },
49
50
  tertiary: {
50
51
  color: colors.textColorDefaultPrimary,
51
- fontSize: 14,
52
+ fontSize: tokens.fontSizeSm,
52
53
  lineHeight: 20,
53
54
  },
54
55
  footnote: {
55
56
  color: colors.textColorDefaultSecondary,
56
- fontSize: 13,
57
+ fontSize: 13, // TODO: Check with UX on correct token
57
58
  lineHeight: 16,
58
59
  },
59
60
  })