jfs-components 0.0.4 → 0.0.5

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 (43) hide show
  1. package/lib/commonjs/Containers.js +16 -7
  2. package/lib/commonjs/Containers.js.map +1 -1
  3. package/lib/commonjs/components/Accordion/Accordion.mdx +1 -0
  4. package/lib/commonjs/components/ActionFooter/ActionFooter.mdx +1 -0
  5. package/lib/commonjs/components/CtaCard/CtaCard.mdx +1 -2
  6. package/lib/commonjs/components/Introduction.mdx +0 -1
  7. package/lib/commonjs/design-tokens/JFSThemeProvider.js +64 -0
  8. package/lib/commonjs/design-tokens/JFSThemeProvider.js.map +1 -0
  9. package/lib/commonjs/design-tokens/index.js +11 -0
  10. package/lib/commonjs/design-tokens/index.js.map +1 -1
  11. package/lib/commonjs/icons/registry.js +1 -1
  12. package/lib/module/Containers.js +15 -7
  13. package/lib/module/Containers.js.map +1 -1
  14. package/lib/module/components/Accordion/Accordion.mdx +1 -0
  15. package/lib/module/components/ActionFooter/ActionFooter.mdx +1 -0
  16. package/lib/module/components/CtaCard/CtaCard.mdx +1 -2
  17. package/lib/module/components/Introduction.mdx +0 -1
  18. package/lib/module/design-tokens/JFSThemeProvider.js +57 -0
  19. package/lib/module/design-tokens/JFSThemeProvider.js.map +1 -0
  20. package/lib/module/design-tokens/figma-variables-resolver.js +2 -2
  21. package/lib/module/design-tokens/figma-variables-resolver.js.map +1 -2
  22. package/lib/module/design-tokens/index.js +1 -0
  23. package/lib/module/design-tokens/index.js.map +1 -1
  24. package/lib/module/icons/registry.js +1 -1
  25. package/lib/typescript/Containers.d.ts +2 -1
  26. package/lib/typescript/Containers.d.ts.map +1 -1
  27. package/lib/typescript/design-tokens/JFSThemeProvider.d.ts +44 -0
  28. package/lib/typescript/design-tokens/JFSThemeProvider.d.ts.map +1 -0
  29. package/lib/typescript/design-tokens/index.d.ts +1 -0
  30. package/lib/typescript/design-tokens/index.d.ts.map +1 -1
  31. package/lib/typescript/icons/registry.d.ts +1 -1
  32. package/package.json +3 -7
  33. package/src/Containers.tsx +15 -0
  34. package/src/components/Accordion/Accordion.mdx +1 -0
  35. package/src/components/ActionFooter/ActionFooter.mdx +1 -0
  36. package/src/components/CtaCard/CtaCard.mdx +1 -2
  37. package/src/components/Divider/Divider.tsx +1 -0
  38. package/src/components/Introduction.mdx +0 -1
  39. package/src/components/NavArrow/NavArrow.tsx +1 -0
  40. package/src/design-tokens/JFSThemeProvider.tsx +79 -0
  41. package/src/design-tokens/index.ts +1 -0
  42. package/src/icons/registry.ts +1 -1
  43. package/src/Containers.ts +0 -8
@@ -1,2 +1,3 @@
1
- export declare const storyContainer: import("styled-components/native/dist/types").IStyledComponentBase<"native", import("styled-components/native/dist/types").FastOmit<import("react-native").ViewProps, never>>;
1
+ import { type ViewProps } from 'react-native';
2
+ export declare const storyContainer: (props: ViewProps) => import("react/jsx-runtime").JSX.Element;
2
3
  //# sourceMappingURL=Containers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Containers.d.ts","sourceRoot":"","sources":["../../src/Containers.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,+KAK1B,CAAA"}
1
+ {"version":3,"file":"Containers.d.ts","sourceRoot":"","sources":["../../src/Containers.tsx"],"names":[],"mappings":"AACA,OAAO,EAAoB,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAEhE,eAAO,MAAM,cAAc,GAAI,OAAO,SAAS,4CAE9C,CAAC"}
@@ -0,0 +1,44 @@
1
+ import React, { ReactNode } from 'react';
2
+ /**
3
+ * Shape of the TokenContext
4
+ */
5
+ interface TokenContextType {
6
+ /**
7
+ * Current active modes map
8
+ * @example { 'Color Mode': 'Dark', 'Platform': 'mobile' }
9
+ */
10
+ modes: Record<string, any>;
11
+ /**
12
+ * Helper to resolve variable by name using the current context modes.
13
+ */
14
+ getVariable: (name: string) => any;
15
+ }
16
+ interface JFSThemeProviderProps {
17
+ /**
18
+ * Modes to apply globally.
19
+ * Can be used to set 'Color Mode', 'Platform', 'Density', etc.
20
+ */
21
+ modes?: Record<string, any>;
22
+ children: ReactNode;
23
+ }
24
+ /**
25
+ * Provider component for the JFS Design System.
26
+ * Wraps your application or a subtree to provide global configuration for design tokens.
27
+ *
28
+ * @example
29
+ * <JFSThemeProvider modes={{ 'Color Mode': 'Dark', 'Platform': 'web' }}>
30
+ * <App />
31
+ * </JFSThemeProvider>
32
+ */
33
+ export declare const JFSThemeProvider: React.FC<JFSThemeProviderProps>;
34
+ /**
35
+ * Hook to access the current design token context.
36
+ *
37
+ * returns {
38
+ * modes: Record<string, any> - The current active modes
39
+ * getVariable: (name: string) => any - Function to resolve a token value
40
+ * }
41
+ */
42
+ export declare const useTokens: () => TokenContextType;
43
+ export {};
44
+ //# sourceMappingURL=JFSThemeProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"JFSThemeProvider.d.ts","sourceRoot":"","sources":["../../../src/design-tokens/JFSThemeProvider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAA6B,SAAS,EAAW,MAAM,OAAO,CAAC;AAG7E;;GAEG;AACH,UAAU,gBAAgB;IACtB;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC3B;;OAEG;IACH,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,GAAG,CAAC;CACtC;AAID,UAAU,qBAAqB;IAC3B;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5B,QAAQ,EAAE,SAAS,CAAC;CACvB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAmB5D,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,SAAS,QAAO,gBAU5B,CAAC"}
@@ -1,2 +1,3 @@
1
1
  export * from './figma-variables-resolver';
2
+ export * from './JFSThemeProvider';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/design-tokens/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/design-tokens/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,oBAAoB,CAAC"}
@@ -4,7 +4,7 @@
4
4
  * Auto-generated from SVG files in src/icons/
5
5
  * DO NOT EDIT MANUALLY - Run "npm run icons:generate" to regenerate
6
6
  *
7
- * Generated: 2026-01-21T10:51:56.970Z
7
+ * Generated: 2026-01-22T08:22:14.301Z
8
8
  */
9
9
  export declare const iconRegistry: Record<string, {
10
10
  path: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jfs-components",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "description": "React Native Jio Finance Components Library",
5
5
  "author": "sunshuaiqi@gmail.com",
6
6
  "license": "MIT",
@@ -77,8 +77,7 @@
77
77
  },
78
78
  "peerDependencies": {
79
79
  "react": "*",
80
- "react-native": "*",
81
- "styled-components": "*"
80
+ "react-native": "*"
82
81
  },
83
82
  "devDependencies": {
84
83
  "@babel/core": "^7.28.5",
@@ -102,11 +101,9 @@
102
101
  "@types/jest": "^30.0.0",
103
102
  "@types/react": "^19.2.7",
104
103
  "@types/react-native": "^0.73.0",
105
- "@types/styled-components": "^5.1.36",
106
104
  "@typescript-eslint/eslint-plugin": "^8.50.0",
107
105
  "@typescript-eslint/parser": "^8.50.0",
108
106
  "babel-loader": "^10.0.0",
109
- "babel-plugin-styled-components": "^2.1.4",
110
107
  "eslint": "^9.39.1",
111
108
  "eslint-plugin-import": "^2.32.0",
112
109
  "eslint-plugin-jsx-a11y": "^6.10.2",
@@ -126,7 +123,6 @@
126
123
  "react-test-renderer": "19.1.1",
127
124
  "remark-gfm": "^4.0.1",
128
125
  "storybook": "^10.0.8",
129
- "styled-components": "^6.3.8",
130
126
  "ts-migrate": "^0.1.35",
131
127
  "ts-node": "^10.9.2",
132
128
  "typescript": "^5.9.3",
@@ -136,4 +132,4 @@
136
132
  "jest": {
137
133
  "preset": "react-native"
138
134
  }
139
- }
135
+ }
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import { View, StyleSheet, type ViewProps } from 'react-native';
3
+
4
+ export const storyContainer = (props: ViewProps) => (
5
+ <View style= { styles.container } { ...props } />
6
+ );
7
+
8
+ const styles = StyleSheet.create({
9
+ container: {
10
+ height: '100%',
11
+ width: '100%',
12
+ alignItems: 'center',
13
+ justifyContent: 'center',
14
+ },
15
+ });
@@ -120,3 +120,4 @@ function PaymentSection() {
120
120
 
121
121
 
122
122
 
123
+
@@ -99,3 +99,4 @@ All tokens support mode-based theming through the `modes` prop.
99
99
 
100
100
  The ActionFooter uses `accessibilityRole="toolbar"` to indicate it contains a group of action controls. Provide a meaningful `accessibilityLabel` to describe the footer's purpose to screen reader users.
101
101
 
102
+
@@ -62,5 +62,4 @@ This component uses the following design tokens, resolved through `getVariableBy
62
62
  - **`ctaCard/title/fontSize`**
63
63
  - **`ctaCard/title/lineHeight`**
64
64
 
65
- All tokens support mode-based theming through the `modes` prop.
66
-
65
+ All tokens support mode-based theming through the `modes` prop.
@@ -89,3 +89,4 @@ function Divider({
89
89
 
90
90
  export default Divider
91
91
 
92
+
@@ -95,7 +95,6 @@ When creating new components:
95
95
 
96
96
  - [Storybook Documentation](https://storybook.js.org/)
97
97
  - [React Native Storybook](https://github.com/storybookjs/react-native)
98
- - [Styled Components](https://styled-components.com/)
99
98
 
100
99
  ---
101
100
 
@@ -106,3 +106,4 @@ function NavArrow({
106
106
 
107
107
  export default NavArrow
108
108
 
109
+
@@ -0,0 +1,79 @@
1
+
2
+ import React, { createContext, useContext, ReactNode, useMemo } from 'react';
3
+ import { getVariableByName } from './figma-variables-resolver';
4
+
5
+ /**
6
+ * Shape of the TokenContext
7
+ */
8
+ interface TokenContextType {
9
+ /**
10
+ * Current active modes map
11
+ * @example { 'Color Mode': 'Dark', 'Platform': 'mobile' }
12
+ */
13
+ modes: Record<string, any>;
14
+ /**
15
+ * Helper to resolve variable by name using the current context modes.
16
+ */
17
+ getVariable: (name: string) => any;
18
+ }
19
+
20
+ const TokenContext = createContext<TokenContextType | undefined>(undefined);
21
+
22
+ interface JFSThemeProviderProps {
23
+ /**
24
+ * Modes to apply globally.
25
+ * Can be used to set 'Color Mode', 'Platform', 'Density', etc.
26
+ */
27
+ modes?: Record<string, any>;
28
+ children: ReactNode;
29
+ }
30
+
31
+ /**
32
+ * Provider component for the JFS Design System.
33
+ * Wraps your application or a subtree to provide global configuration for design tokens.
34
+ *
35
+ * @example
36
+ * <JFSThemeProvider modes={{ 'Color Mode': 'Dark', 'Platform': 'web' }}>
37
+ * <App />
38
+ * </JFSThemeProvider>
39
+ */
40
+ export const JFSThemeProvider: React.FC<JFSThemeProviderProps> = ({
41
+ modes = {},
42
+ children
43
+ }) => {
44
+ const value = useMemo(() => {
45
+ // We bind the current modes to getVariableByName so consumers don't have to pass it
46
+ const getVariable = (name: string) => getVariableByName(name, modes);
47
+
48
+ return {
49
+ modes,
50
+ getVariable,
51
+ };
52
+ }, [modes]);
53
+
54
+ return (
55
+ <TokenContext.Provider value={value}>
56
+ {children}
57
+ </TokenContext.Provider>
58
+ );
59
+ };
60
+
61
+ /**
62
+ * Hook to access the current design token context.
63
+ *
64
+ * returns {
65
+ * modes: Record<string, any> - The current active modes
66
+ * getVariable: (name: string) => any - Function to resolve a token value
67
+ * }
68
+ */
69
+ export const useTokens = (): TokenContextType => {
70
+ const context = useContext(TokenContext);
71
+ if (!context) {
72
+ // If used outside provider, fall back to default behavior (empty modes)
73
+ return {
74
+ modes: {},
75
+ getVariable: (name: string) => getVariableByName(name, {}),
76
+ };
77
+ }
78
+ return context;
79
+ };
@@ -1 +1,2 @@
1
1
  export * from './figma-variables-resolver';
2
+ export * from './JFSThemeProvider';
@@ -4,7 +4,7 @@
4
4
  * Auto-generated from SVG files in src/icons/
5
5
  * DO NOT EDIT MANUALLY - Run "npm run icons:generate" to regenerate
6
6
  *
7
- * Generated: 2026-01-21T10:51:56.970Z
7
+ * Generated: 2026-01-22T08:22:14.301Z
8
8
  */
9
9
 
10
10
  // Icon name to SVG data mapping
package/src/Containers.ts DELETED
@@ -1,8 +0,0 @@
1
- import styled from 'styled-components/native'
2
-
3
- export const storyContainer = styled.View`
4
- height: 100%;
5
- width: 100%;
6
- align-items: center;
7
- justify-content: center;
8
- `