jfs-components 0.0.60 → 0.0.62
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/lib/commonjs/design-tokens/JFSThemeProvider.js +2 -38
- package/lib/commonjs/icons/registry.js +1 -1
- package/lib/commonjs/utils/react-utils.js +9 -3
- package/lib/module/design-tokens/JFSThemeProvider.js +2 -35
- package/lib/module/icons/registry.js +1 -1
- package/lib/module/utils/react-utils.js +9 -3
- package/lib/typescript/src/design-tokens/JFSThemeProvider.d.ts +0 -15
- package/lib/typescript/src/icons/registry.d.ts +1 -1
- package/package.json +1 -1
- package/src/design-tokens/JFSThemeProvider.tsx +1 -37
- package/src/icons/registry.ts +1 -1
- package/src/utils/react-utils.ts +13 -3
|
@@ -3,12 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
exports.useJFSFonts = useJFSFonts;
|
|
8
|
-
exports.useTokens = void 0;
|
|
6
|
+
exports.useTokens = exports.JFSThemeProvider = void 0;
|
|
9
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
8
|
var _figmaVariablesResolver = require("./figma-variables-resolver");
|
|
11
|
-
var Font = _interopRequireWildcard(require("expo-font"));
|
|
12
9
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
10
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
14
11
|
/**
|
|
@@ -62,37 +59,4 @@ const useTokens = () => {
|
|
|
62
59
|
}
|
|
63
60
|
return context;
|
|
64
61
|
};
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Returns the JFS font map. The TTF is encapsulated within the package at
|
|
68
|
-
* src/assets/fonts/JioType Var.ttf (included via package.json "files").
|
|
69
|
-
* Call this inside load functions to avoid top-level require errors if font missing.
|
|
70
|
-
*/
|
|
71
|
-
exports.useTokens = useTokens;
|
|
72
|
-
const getJFSFonts = () => ({
|
|
73
|
-
'JioType Var': require('../assets/fonts/JioType Var.ttf')
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Hook for loading JFS fonts using expo-font. This improves Android font support by explicitly registering
|
|
78
|
-
* the custom 'JioType Var' font (encapsulated in the package) via Font.loadAsync before components render.
|
|
79
|
-
* Without it, Android defaults to Roboto. Call at app root (e.g. before JFSThemeProvider). Returns loaded state.
|
|
80
|
-
* See getJFSFonts() for direct use with Font.loadAsync. Handles missing font gracefully for web/Storybook.
|
|
81
|
-
*/
|
|
82
|
-
exports.getJFSFonts = getJFSFonts;
|
|
83
|
-
function useJFSFonts() {
|
|
84
|
-
const [fontsLoaded, setFontsLoaded] = (0, _react.useState)(false);
|
|
85
|
-
(0, _react.useEffect)(() => {
|
|
86
|
-
async function loadJFSFonts() {
|
|
87
|
-
try {
|
|
88
|
-
await Font.loadAsync(getJFSFonts());
|
|
89
|
-
setFontsLoaded(true);
|
|
90
|
-
} catch (error) {
|
|
91
|
-
console.warn('Failed to load JFS fonts (this is common in web/Storybook or if font file missing):', error);
|
|
92
|
-
setFontsLoaded(true);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
loadJFSFonts();
|
|
96
|
-
}, []);
|
|
97
|
-
return fontsLoaded;
|
|
98
|
-
}
|
|
62
|
+
exports.useTokens = useTokens;
|