jfs-components 0.0.4 → 0.0.6

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 (107) 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/ActionTile/ActionTile.js +10 -1
  6. package/lib/commonjs/components/ActionTile/ActionTile.js.map +1 -1
  7. package/lib/commonjs/components/AppBar/AppBar.js +18 -2
  8. package/lib/commonjs/components/AppBar/AppBar.js.map +1 -1
  9. package/lib/commonjs/components/BottomNav/BottomNav.js +9 -1
  10. package/lib/commonjs/components/BottomNav/BottomNav.js.map +1 -1
  11. package/lib/commonjs/components/BottomNavItem/BottomNavItem.js +9 -1
  12. package/lib/commonjs/components/BottomNavItem/BottomNavItem.js.map +1 -1
  13. package/lib/commonjs/components/CtaCard/CtaCard.js +10 -2
  14. package/lib/commonjs/components/CtaCard/CtaCard.js.map +1 -1
  15. package/lib/commonjs/components/CtaCard/CtaCard.mdx +1 -2
  16. package/lib/commonjs/components/Disclaimer/Disclaimer.js +9 -1
  17. package/lib/commonjs/components/Disclaimer/Disclaimer.js.map +1 -1
  18. package/lib/commonjs/components/IconCapsule/IconCapsule.js +9 -1
  19. package/lib/commonjs/components/IconCapsule/IconCapsule.js.map +1 -1
  20. package/lib/commonjs/components/Introduction.mdx +0 -1
  21. package/lib/commonjs/components/PageTitle/PageTitle.js +10 -1
  22. package/lib/commonjs/components/PageTitle/PageTitle.js.map +1 -1
  23. package/lib/commonjs/components/UpiHandle/UpiHandle.js +9 -1
  24. package/lib/commonjs/components/UpiHandle/UpiHandle.js.map +1 -1
  25. package/lib/commonjs/design-tokens/JFSThemeProvider.js +64 -0
  26. package/lib/commonjs/design-tokens/JFSThemeProvider.js.map +1 -0
  27. package/lib/commonjs/design-tokens/figma-variables-resolver.js +9 -3
  28. package/lib/commonjs/design-tokens/figma-variables-resolver.js.map +2 -1
  29. package/lib/commonjs/design-tokens/index.js +11 -0
  30. package/lib/commonjs/design-tokens/index.js.map +1 -1
  31. package/lib/commonjs/icons/registry.js +1 -1
  32. package/lib/module/Containers.js +15 -7
  33. package/lib/module/Containers.js.map +1 -1
  34. package/lib/module/components/Accordion/Accordion.mdx +1 -0
  35. package/lib/module/components/ActionFooter/ActionFooter.mdx +1 -0
  36. package/lib/module/components/ActionTile/ActionTile.js +10 -1
  37. package/lib/module/components/ActionTile/ActionTile.js.map +1 -1
  38. package/lib/module/components/AppBar/AppBar.js +18 -2
  39. package/lib/module/components/AppBar/AppBar.js.map +1 -1
  40. package/lib/module/components/BottomNav/BottomNav.js +9 -1
  41. package/lib/module/components/BottomNav/BottomNav.js.map +1 -1
  42. package/lib/module/components/BottomNavItem/BottomNavItem.js +9 -1
  43. package/lib/module/components/BottomNavItem/BottomNavItem.js.map +1 -1
  44. package/lib/module/components/CtaCard/CtaCard.js +10 -2
  45. package/lib/module/components/CtaCard/CtaCard.js.map +1 -1
  46. package/lib/module/components/CtaCard/CtaCard.mdx +1 -2
  47. package/lib/module/components/Disclaimer/Disclaimer.js +9 -1
  48. package/lib/module/components/Disclaimer/Disclaimer.js.map +1 -1
  49. package/lib/module/components/IconCapsule/IconCapsule.js +9 -1
  50. package/lib/module/components/IconCapsule/IconCapsule.js.map +1 -1
  51. package/lib/module/components/Introduction.mdx +0 -1
  52. package/lib/module/components/PageTitle/PageTitle.js +10 -1
  53. package/lib/module/components/PageTitle/PageTitle.js.map +1 -1
  54. package/lib/module/components/UpiHandle/UpiHandle.js +9 -1
  55. package/lib/module/components/UpiHandle/UpiHandle.js.map +1 -1
  56. package/lib/module/design-tokens/JFSThemeProvider.js +57 -0
  57. package/lib/module/design-tokens/JFSThemeProvider.js.map +1 -0
  58. package/lib/module/design-tokens/figma-variables-resolver.js +2 -2
  59. package/lib/module/design-tokens/index.js +1 -0
  60. package/lib/module/design-tokens/index.js.map +1 -1
  61. package/lib/module/icons/registry.js +1 -1
  62. package/lib/typescript/Containers.d.ts +2 -1
  63. package/lib/typescript/Containers.d.ts.map +1 -1
  64. package/lib/typescript/components/ActionTile/ActionTile.d.ts +1 -1
  65. package/lib/typescript/components/ActionTile/ActionTile.d.ts.map +1 -1
  66. package/lib/typescript/components/AppBar/AppBar.d.ts +2 -2
  67. package/lib/typescript/components/AppBar/AppBar.d.ts.map +1 -1
  68. package/lib/typescript/components/BottomNav/BottomNav.d.ts +1 -1
  69. package/lib/typescript/components/BottomNav/BottomNav.d.ts.map +1 -1
  70. package/lib/typescript/components/BottomNavItem/BottomNavItem.d.ts +1 -1
  71. package/lib/typescript/components/BottomNavItem/BottomNavItem.d.ts.map +1 -1
  72. package/lib/typescript/components/CtaCard/CtaCard.d.ts +1 -1
  73. package/lib/typescript/components/CtaCard/CtaCard.d.ts.map +1 -1
  74. package/lib/typescript/components/Disclaimer/Disclaimer.d.ts +1 -1
  75. package/lib/typescript/components/Disclaimer/Disclaimer.d.ts.map +1 -1
  76. package/lib/typescript/components/IconCapsule/IconCapsule.d.ts +1 -1
  77. package/lib/typescript/components/IconCapsule/IconCapsule.d.ts.map +1 -1
  78. package/lib/typescript/components/PageTitle/PageTitle.d.ts +1 -1
  79. package/lib/typescript/components/PageTitle/PageTitle.d.ts.map +1 -1
  80. package/lib/typescript/components/UpiHandle/UpiHandle.d.ts +1 -1
  81. package/lib/typescript/components/UpiHandle/UpiHandle.d.ts.map +1 -1
  82. package/lib/typescript/design-tokens/JFSThemeProvider.d.ts +44 -0
  83. package/lib/typescript/design-tokens/JFSThemeProvider.d.ts.map +1 -0
  84. package/lib/typescript/design-tokens/index.d.ts +1 -0
  85. package/lib/typescript/design-tokens/index.d.ts.map +1 -1
  86. package/lib/typescript/icons/registry.d.ts +1 -1
  87. package/package.json +3 -7
  88. package/src/Containers.tsx +15 -0
  89. package/src/components/Accordion/Accordion.mdx +1 -0
  90. package/src/components/ActionFooter/ActionFooter.mdx +1 -0
  91. package/src/components/ActionTile/ActionTile.tsx +5 -1
  92. package/src/components/AppBar/AppBar.tsx +18 -11
  93. package/src/components/BottomNav/BottomNav.tsx +6 -3
  94. package/src/components/BottomNavItem/BottomNavItem.tsx +19 -16
  95. package/src/components/CtaCard/CtaCard.mdx +1 -2
  96. package/src/components/CtaCard/CtaCard.tsx +5 -2
  97. package/src/components/Disclaimer/Disclaimer.tsx +6 -3
  98. package/src/components/Divider/Divider.tsx +1 -0
  99. package/src/components/IconCapsule/IconCapsule.tsx +10 -7
  100. package/src/components/Introduction.mdx +0 -1
  101. package/src/components/NavArrow/NavArrow.tsx +1 -0
  102. package/src/components/PageTitle/PageTitle.tsx +8 -4
  103. package/src/components/UpiHandle/UpiHandle.tsx +4 -1
  104. package/src/design-tokens/JFSThemeProvider.tsx +79 -0
  105. package/src/design-tokens/index.ts +1 -0
  106. package/src/icons/registry.ts +1 -1
  107. package/src/Containers.ts +0 -8
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { View, Text, type StyleProp, type ViewStyle, type TextStyle } from 'react-native';
3
3
  import { getVariableByName } from '../../design-tokens/figma-variables-resolver';
4
+ import { useTokens } from '../../design-tokens/JFSThemeProvider';
4
5
  import IconCapsule from '../IconCapsule/IconCapsule';
5
6
  import Button from '../Button/Button';
6
7
 
@@ -68,13 +69,15 @@ function CtaCard({
68
69
  iconName = "ic_upi_number",
69
70
  buttonLabel = "Get started",
70
71
  onPressButton,
71
- modes = {},
72
+ modes: propModes = {},
72
73
  iconSlot,
73
74
  titleSlot,
74
75
  bodySlot,
75
76
  buttonSlot,
76
77
  style,
77
78
  }: CtaCardProps) {
79
+ const { modes: globalModes } = useTokens()
80
+ const modes = { ...globalModes, ...propModes }
78
81
  // --- Token Resolution ---
79
82
  // Container
80
83
  const backgroundColor = getVariableByName('ctaCard/background', modes) || '#0078ad';
@@ -174,7 +177,7 @@ function CtaCard({
174
177
  ) : (
175
178
  <Button
176
179
  label={buttonLabel}
177
- onPress={onPressButton}
180
+ onPress={onPressButton || (() => { })}
178
181
  modes={modes}
179
182
  />
180
183
  )}
@@ -1,6 +1,7 @@
1
1
  import React from 'react'
2
2
  import { View, Text, type StyleProp, type ViewStyle, type TextStyle } from 'react-native'
3
3
  import { getVariableByName } from '../../design-tokens/figma-variables-resolver'
4
+ import { useTokens } from '../../design-tokens/JFSThemeProvider'
4
5
 
5
6
  type DisclaimerProps = {
6
7
  disclaimer?: string;
@@ -34,13 +35,15 @@ type DisclaimerProps = {
34
35
  */
35
36
  function Disclaimer({
36
37
  disclaimer = 'All financial services are provided by Jio Payments Bank Pvt. Ltd.',
37
- modes = {},
38
+ modes: propModes = {},
38
39
  style,
39
40
  textStyle,
40
41
  accessibilityLabel,
41
42
  accessibilityHint,
42
43
  ...rest
43
44
  }: DisclaimerProps) {
45
+ const { modes: globalModes } = useTokens()
46
+ const modes = { ...globalModes, ...propModes }
44
47
  // Resolve typography and color from Figma variables
45
48
  const color = getVariableByName('disclaimer/color', modes) || '#24262b'
46
49
  const fontSize =
@@ -77,14 +80,14 @@ function Disclaimer({
77
80
  const defaultAccessibilityLabel = accessibilityLabel || disclaimer
78
81
 
79
82
  return (
80
- <View
83
+ <View
81
84
  style={[containerStyle, style]}
82
85
  accessibilityRole="text"
83
86
  accessibilityLabel={defaultAccessibilityLabel}
84
87
  accessibilityHint={accessibilityHint}
85
88
  {...rest}
86
89
  >
87
- <Text
90
+ <Text
88
91
  style={[baseTextStyle, textStyle]}
89
92
  accessibilityElementsHidden={true}
90
93
  importantForAccessibility="no"
@@ -89,3 +89,4 @@ function Divider({
89
89
 
90
90
  export default Divider
91
91
 
92
+
@@ -1,6 +1,7 @@
1
1
  import React from 'react'
2
2
  import { View, type StyleProp, type ViewStyle } from 'react-native'
3
3
  import { getVariableByName } from '../../design-tokens/figma-variables-resolver'
4
+ import { useTokens } from '../../design-tokens/JFSThemeProvider'
4
5
  import Icon from '../../icons/Icon'
5
6
 
6
7
  type IconCapsuleProps = {
@@ -38,13 +39,15 @@ type IconCapsuleProps = {
38
39
  * <IconCapsule iconName="ic_card" accessibilityLabel="Credit card icon" />
39
40
  * ```
40
41
  */
41
- function IconCapsule({
42
+ function IconCapsule({
42
43
  iconName = "ic_card",
43
- modes = {},
44
+ modes: propModes = {},
44
45
  accessibilityLabel,
45
46
  accessibilityRole = "image",
46
47
  ...rest
47
48
  }: IconCapsuleProps) {
49
+ const { modes: globalModes } = useTokens()
50
+ const modes = { ...globalModes, ...propModes }
48
51
  // Resolve design tokens using the provided modes
49
52
  const size = getVariableByName('iconCapsule/size', modes) || 42
50
53
  const radius = getVariableByName('iconCapsule/radius', modes) || 9999
@@ -72,17 +75,17 @@ function IconCapsule({
72
75
 
73
76
  // Generate default accessibility label from icon name if not provided
74
77
  const defaultAccessibilityLabel = accessibilityLabel || iconName.replace(/^ic_/, '').replace(/_/g, ' ').replace(/\b\w/g, l => l.toUpperCase())
75
-
78
+
76
79
  return (
77
- <View
80
+ <View
78
81
  style={containerStyle}
79
82
  accessibilityRole={accessibilityRole}
80
83
  accessibilityLabel={defaultAccessibilityLabel}
81
84
  {...rest}
82
85
  >
83
- <Icon
84
- name={iconName}
85
- size={iconSize}
86
+ <Icon
87
+ name={iconName}
88
+ size={iconSize}
86
89
  color={iconColor}
87
90
  accessibilityElementsHidden={true}
88
91
  importantForAccessibility="no"
@@ -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
+
@@ -1,6 +1,7 @@
1
1
  import React from 'react'
2
2
  import { View, Text, type StyleProp, type ViewStyle, type TextStyle } from 'react-native'
3
3
  import { getVariableByName } from '../../design-tokens/figma-variables-resolver'
4
+ import { useTokens } from '../../design-tokens/JFSThemeProvider'
4
5
 
5
6
  type PageTitleProps = {
6
7
  title?: string;
@@ -29,7 +30,7 @@ type PageTitleProps = {
29
30
  */
30
31
  function PageTitle({
31
32
  title = 'Page Title',
32
- modes = {},
33
+ modes: propModes = {},
33
34
  style,
34
35
  textStyle,
35
36
  numberOfLines,
@@ -37,6 +38,9 @@ function PageTitle({
37
38
  accessibilityHint,
38
39
  ...rest
39
40
  }: PageTitleProps) {
41
+ const { modes: globalModes } = useTokens()
42
+ const modes = { ...globalModes, ...propModes }
43
+
40
44
  // Resolve container padding tokens
41
45
  const paddingHorizontal =
42
46
  getVariableByName('pageTitle/padding/horizontal', modes) || 16
@@ -79,15 +83,15 @@ function PageTitle({
79
83
  const defaultAccessibilityLabel = accessibilityLabel || title
80
84
 
81
85
  return (
82
- <View
86
+ <View
83
87
  style={[containerStyle, style]}
84
88
  accessibilityRole="header"
85
89
  accessibilityLabel={defaultAccessibilityLabel}
86
90
  accessibilityHint={accessibilityHint}
87
91
  {...rest}
88
92
  >
89
- <Text
90
- style={[textStyleObj, textStyle]}
93
+ <Text
94
+ style={[textStyleObj, textStyle]}
91
95
  numberOfLines={numberOfLines !== undefined ? numberOfLines : 1}
92
96
  accessibilityElementsHidden={true}
93
97
  importantForAccessibility="no"
@@ -1,6 +1,7 @@
1
1
  import React, { useState } from 'react'
2
2
  import { Pressable, View, Text, Image, type ViewStyle, type TextStyle, type ImageStyle } from 'react-native'
3
3
  import { getVariableByName } from '../../design-tokens/figma-variables-resolver'
4
+ import { useTokens } from '../../design-tokens/JFSThemeProvider'
4
5
  import Icon from '../../icons/Icon'
5
6
 
6
7
  // Default static asset from the component folder.
@@ -40,7 +41,7 @@ type UpiHandleProps = {
40
41
  */
41
42
  function UpiHandle({
42
43
  label = 'Label',
43
- modes = {},
44
+ modes: propModes = {},
44
45
  showIcon = true,
45
46
  iconName = 'ic_scan_qr_code',
46
47
  onPress,
@@ -49,6 +50,8 @@ function UpiHandle({
49
50
  accessibilityHint,
50
51
  ...rest
51
52
  }: UpiHandleProps) {
53
+ const { modes: globalModes } = useTokens()
54
+ const modes = { ...globalModes, ...propModes }
52
55
  // Token‑driven container styling
53
56
  const backgroundColor =
54
57
  getVariableByName('upiHandle/background', modes) || '#f5f5f5'
@@ -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-22T12:09:47.639Z
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
- `