jfs-components 0.0.55 → 0.0.57

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 (48) hide show
  1. package/lib/commonjs/components/Accordion/Accordion.js +2 -34
  2. package/lib/commonjs/components/AppBar/AppBar.js +4 -36
  3. package/lib/commonjs/components/FilterBar/FilterBar.js +2 -34
  4. package/lib/commonjs/components/LazyList/LazyList.js +2 -34
  5. package/lib/commonjs/components/MoneyValue/MoneyValue.js +1 -1
  6. package/lib/commonjs/components/NavArrow/NavArrow.js +45 -44
  7. package/lib/commonjs/components/Numpad/Numpad.js +6 -5
  8. package/lib/commonjs/components/Section/Section.js +7 -8
  9. package/lib/commonjs/components/TextInput/TextInput.js +4 -38
  10. package/lib/commonjs/components/TransactionBubble/TransactionBubble.js +149 -0
  11. package/lib/commonjs/components/index.js +7 -0
  12. package/lib/commonjs/design-tokens/JFSThemeProvider.js +38 -3
  13. package/lib/commonjs/icons/registry.js +1 -1
  14. package/lib/commonjs/utils/react-utils.js +18 -13
  15. package/lib/module/components/Accordion/Accordion.js +1 -33
  16. package/lib/module/components/AppBar/AppBar.js +1 -34
  17. package/lib/module/components/FilterBar/FilterBar.js +1 -35
  18. package/lib/module/components/LazyList/LazyList.js +1 -35
  19. package/lib/module/components/MoneyValue/MoneyValue.js +1 -1
  20. package/lib/module/components/NavArrow/NavArrow.js +44 -44
  21. package/lib/module/components/Numpad/Numpad.js +5 -5
  22. package/lib/module/components/Section/Section.js +8 -9
  23. package/lib/module/components/TextInput/TextInput.js +2 -36
  24. package/lib/module/components/TransactionBubble/TransactionBubble.js +144 -0
  25. package/lib/module/components/index.js +1 -0
  26. package/lib/module/design-tokens/JFSThemeProvider.js +35 -3
  27. package/lib/module/icons/registry.js +1 -1
  28. package/lib/module/utils/react-utils.js +18 -13
  29. package/lib/typescript/src/components/NavArrow/NavArrow.d.ts +6 -11
  30. package/lib/typescript/src/components/TransactionBubble/TransactionBubble.d.ts +39 -0
  31. package/lib/typescript/src/components/index.d.ts +1 -0
  32. package/lib/typescript/src/design-tokens/JFSThemeProvider.d.ts +15 -0
  33. package/lib/typescript/src/icons/registry.d.ts +1 -1
  34. package/package.json +1 -1
  35. package/src/components/Accordion/Accordion.tsx +1 -44
  36. package/src/components/AppBar/AppBar.tsx +1 -44
  37. package/src/components/FilterBar/FilterBar.tsx +1 -44
  38. package/src/components/LazyList/LazyList.tsx +1 -41
  39. package/src/components/MoneyValue/MoneyValue.tsx +1 -1
  40. package/src/components/NavArrow/NavArrow.tsx +46 -43
  41. package/src/components/Numpad/Numpad.tsx +5 -5
  42. package/src/components/Section/Section.tsx +8 -8
  43. package/src/components/TextInput/TextInput.tsx +1 -44
  44. package/src/components/TransactionBubble/TransactionBubble.tsx +155 -0
  45. package/src/components/index.ts +1 -0
  46. package/src/design-tokens/JFSThemeProvider.tsx +37 -2
  47. package/src/icons/registry.ts +1 -1
  48. package/src/utils/react-utils.ts +29 -21
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
 
3
- import React, { createContext, useContext, useMemo } from 'react';
3
+ import React, { createContext, useContext, useMemo, useState, useEffect } from 'react';
4
4
  import { getVariableByName } from './figma-variables-resolver';
5
+ import * as Font from 'expo-font';
5
6
 
6
7
  /**
7
8
  * Shape of the TokenContext
@@ -22,7 +23,6 @@ export const JFSThemeProvider = ({
22
23
  children
23
24
  }) => {
24
25
  const value = useMemo(() => {
25
- // We bind the current modes to getVariableByName so consumers don't have to pass it
26
26
  const getVariable = name => getVariableByName(name, modes);
27
27
  return {
28
28
  modes,
@@ -53,4 +53,36 @@ export const useTokens = () => {
53
53
  };
54
54
  }
55
55
  return context;
56
- };
56
+ };
57
+
58
+ /**
59
+ * Returns the JFS font map. The TTF is encapsulated within the package at
60
+ * src/assets/fonts/JioType Var.ttf (included via package.json "files").
61
+ * Call this inside load functions to avoid top-level require errors if font missing.
62
+ */
63
+ export const getJFSFonts = () => ({
64
+ 'JioType Var': require('../assets/fonts/JioType Var.ttf')
65
+ });
66
+
67
+ /**
68
+ * Hook for loading JFS fonts using expo-font. This improves Android font support by explicitly registering
69
+ * the custom 'JioType Var' font (encapsulated in the package) via Font.loadAsync before components render.
70
+ * Without it, Android defaults to Roboto. Call at app root (e.g. before JFSThemeProvider). Returns loaded state.
71
+ * See getJFSFonts() for direct use with Font.loadAsync. Handles missing font gracefully for web/Storybook.
72
+ */
73
+ export function useJFSFonts() {
74
+ const [fontsLoaded, setFontsLoaded] = useState(false);
75
+ useEffect(() => {
76
+ async function loadJFSFonts() {
77
+ try {
78
+ await Font.loadAsync(getJFSFonts());
79
+ setFontsLoaded(true);
80
+ } catch (error) {
81
+ console.warn('Failed to load JFS fonts (this is common in web/Storybook or if font file missing):', error);
82
+ setFontsLoaded(true);
83
+ }
84
+ }
85
+ loadJFSFonts();
86
+ }, []);
87
+ return fontsLoaded;
88
+ }