jfs-components 0.0.37 → 0.0.38

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 (140) hide show
  1. package/lib/commonjs/Containers.js.map +1 -1
  2. package/lib/commonjs/components/AvatarGroup/AvatarGroup.js.map +1 -1
  3. package/lib/commonjs/components/BottomNav/BottomNav.js +2 -2
  4. package/lib/commonjs/components/BottomNav/BottomNav.js.map +1 -1
  5. package/lib/commonjs/components/BottomNavItem/BottomNavItem.js +9 -7
  6. package/lib/commonjs/components/BottomNavItem/BottomNavItem.js.map +1 -1
  7. package/lib/commonjs/components/Card/Card.js.map +1 -1
  8. package/lib/commonjs/components/CardFeedback/CardFeedback.js +14 -4
  9. package/lib/commonjs/components/CardFeedback/CardFeedback.js.map +1 -1
  10. package/lib/commonjs/components/ChipGroup/ChipGroup.js.map +1 -1
  11. package/lib/commonjs/components/ChipSelect/ChipSelect.js +16 -11
  12. package/lib/commonjs/components/ChipSelect/ChipSelect.js.map +1 -1
  13. package/lib/commonjs/components/CtaCard/CtaCard.js +9 -4
  14. package/lib/commonjs/components/CtaCard/CtaCard.js.map +1 -1
  15. package/lib/commonjs/components/CtaCard/index.js.map +1 -1
  16. package/lib/commonjs/components/EmptyState/EmptyState.js +4 -0
  17. package/lib/commonjs/components/EmptyState/EmptyState.js.map +1 -1
  18. package/lib/commonjs/components/IconButton/IconButton.js +16 -13
  19. package/lib/commonjs/components/IconButton/IconButton.js.map +1 -1
  20. package/lib/commonjs/components/IconCapsule/IconCapsule.js +21 -22
  21. package/lib/commonjs/components/IconCapsule/IconCapsule.js.map +1 -1
  22. package/lib/commonjs/components/MediaCard/MediaCard.js.map +1 -1
  23. package/lib/commonjs/components/NavArrow/NavArrow.js +9 -18
  24. package/lib/commonjs/components/NavArrow/NavArrow.js.map +1 -1
  25. package/lib/commonjs/components/RechargeCard/RechargeCard.js.map +1 -1
  26. package/lib/commonjs/components/SupportText/SupportText.js.map +1 -1
  27. package/lib/commonjs/components/SupportText/SupportTextIcon.js.map +1 -1
  28. package/lib/commonjs/components/SupportText/index.js.map +1 -1
  29. package/lib/commonjs/components/UpiHandle/UpiHandle.js +10 -8
  30. package/lib/commonjs/components/UpiHandle/UpiHandle.js.map +1 -1
  31. package/lib/commonjs/components/index.js.map +1 -1
  32. package/lib/commonjs/design-tokens/JFSThemeProvider.js.map +1 -1
  33. package/lib/commonjs/design-tokens/figma-variables-resolver.js +9 -3
  34. package/lib/commonjs/design-tokens/figma-variables-resolver.js.map +1 -1
  35. package/lib/commonjs/icons/Icon.js.map +1 -1
  36. package/lib/commonjs/icons/index.js.map +1 -1
  37. package/lib/commonjs/icons/registry.js +1 -1
  38. package/lib/commonjs/index.js.map +1 -1
  39. package/lib/commonjs/utils/react-utils.js.map +1 -1
  40. package/lib/module/Containers.js.map +1 -1
  41. package/lib/module/components/AvatarGroup/AvatarGroup.js.map +1 -1
  42. package/lib/module/components/BottomNav/BottomNav.js +2 -2
  43. package/lib/module/components/BottomNavItem/BottomNavItem.js +10 -7
  44. package/lib/module/components/BottomNavItem/BottomNavItem.js.map +1 -1
  45. package/lib/module/components/Card/Card.js.map +1 -1
  46. package/lib/module/components/CardFeedback/CardFeedback.js +13 -4
  47. package/lib/module/components/CardFeedback/CardFeedback.js.map +1 -1
  48. package/lib/module/components/ChipGroup/ChipGroup.js.map +1 -1
  49. package/lib/module/components/ChipSelect/ChipSelect.js +15 -10
  50. package/lib/module/components/ChipSelect/ChipSelect.js.map +1 -1
  51. package/lib/module/components/CtaCard/CtaCard.js +8 -4
  52. package/lib/module/components/CtaCard/CtaCard.js.map +1 -1
  53. package/lib/module/components/EmptyState/EmptyState.js +4 -0
  54. package/lib/module/components/EmptyState/EmptyState.js.map +1 -1
  55. package/lib/module/components/IconButton/IconButton.js +16 -12
  56. package/lib/module/components/IconButton/IconButton.js.map +1 -1
  57. package/lib/module/components/IconCapsule/IconCapsule.js +20 -21
  58. package/lib/module/components/IconCapsule/IconCapsule.js.map +1 -1
  59. package/lib/module/components/MediaCard/MediaCard.js.map +1 -1
  60. package/lib/module/components/NavArrow/NavArrow.js +8 -17
  61. package/lib/module/components/NavArrow/NavArrow.js.map +1 -1
  62. package/lib/module/components/RechargeCard/RechargeCard.js.map +1 -1
  63. package/lib/module/components/SupportText/SupportText.js.map +1 -1
  64. package/lib/module/components/SupportText/SupportTextIcon.js.map +1 -1
  65. package/lib/module/components/UpiHandle/UpiHandle.js +10 -7
  66. package/lib/module/components/UpiHandle/UpiHandle.js.map +1 -1
  67. package/lib/module/design-tokens/figma-variables-resolver.js.map +1 -1
  68. package/lib/module/icons/Icon.js.map +1 -1
  69. package/lib/module/icons/registry.js +1 -1
  70. package/lib/typescript/Containers.d.ts.map +1 -1
  71. package/lib/typescript/components/AvatarGroup/AvatarGroup.d.ts.map +1 -1
  72. package/lib/typescript/components/BottomNav/BottomNav.d.ts +2 -2
  73. package/lib/typescript/components/BottomNav/BottomNav.d.ts.map +1 -1
  74. package/lib/typescript/components/BottomNavItem/BottomNavItem.d.ts +8 -2
  75. package/lib/typescript/components/BottomNavItem/BottomNavItem.d.ts.map +1 -1
  76. package/lib/typescript/components/Card/Card.d.ts.map +1 -1
  77. package/lib/typescript/components/CardFeedback/CardFeedback.d.ts +3 -2
  78. package/lib/typescript/components/CardFeedback/CardFeedback.d.ts.map +1 -1
  79. package/lib/typescript/components/ChipGroup/ChipGroup.d.ts.map +1 -1
  80. package/lib/typescript/components/ChipSelect/ChipSelect.d.ts +12 -5
  81. package/lib/typescript/components/ChipSelect/ChipSelect.d.ts.map +1 -1
  82. package/lib/typescript/components/CtaCard/CtaCard.d.ts +6 -1
  83. package/lib/typescript/components/CtaCard/CtaCard.d.ts.map +1 -1
  84. package/lib/typescript/components/CtaCard/index.d.ts.map +1 -1
  85. package/lib/typescript/components/EmptyState/EmptyState.d.ts.map +1 -1
  86. package/lib/typescript/components/IconButton/IconButton.d.ts +12 -6
  87. package/lib/typescript/components/IconButton/IconButton.d.ts.map +1 -1
  88. package/lib/typescript/components/IconCapsule/IconCapsule.d.ts +10 -11
  89. package/lib/typescript/components/IconCapsule/IconCapsule.d.ts.map +1 -1
  90. package/lib/typescript/components/MediaCard/MediaCard.d.ts.map +1 -1
  91. package/lib/typescript/components/NavArrow/NavArrow.d.ts +6 -1
  92. package/lib/typescript/components/NavArrow/NavArrow.d.ts.map +1 -1
  93. package/lib/typescript/components/RechargeCard/RechargeCard.d.ts.map +1 -1
  94. package/lib/typescript/components/SupportText/SupportText.d.ts.map +1 -1
  95. package/lib/typescript/components/SupportText/SupportTextIcon.d.ts.map +1 -1
  96. package/lib/typescript/components/SupportText/index.d.ts.map +1 -1
  97. package/lib/typescript/components/UpiHandle/UpiHandle.d.ts +11 -3
  98. package/lib/typescript/components/UpiHandle/UpiHandle.d.ts.map +1 -1
  99. package/lib/typescript/components/index.d.ts.map +1 -1
  100. package/lib/typescript/design-tokens/JFSThemeProvider.d.ts.map +1 -1
  101. package/lib/typescript/design-tokens/figma-variables-resolver.d.ts.map +1 -1
  102. package/lib/typescript/design-tokens/index.d.ts.map +1 -1
  103. package/lib/typescript/icons/Icon.d.ts.map +1 -1
  104. package/lib/typescript/icons/index.d.ts.map +1 -1
  105. package/lib/typescript/icons/registry.d.ts +1 -1
  106. package/lib/typescript/index.d.ts.map +1 -1
  107. package/lib/typescript/utils/react-utils.d.ts.map +1 -1
  108. package/package.json +1 -1
  109. package/src/Containers.tsx +4 -4
  110. package/src/components/AvatarGroup/AvatarGroup.tsx +41 -41
  111. package/src/components/BottomNav/BottomNav.tsx +14 -14
  112. package/src/components/BottomNavItem/BottomNavItem.tsx +20 -11
  113. package/src/components/ButtonGroup/ButtonGroup.tsx +4 -4
  114. package/src/components/Card/Card.tsx +42 -42
  115. package/src/components/CardFeedback/CardFeedback.tsx +71 -64
  116. package/src/components/ChipGroup/ChipGroup.tsx +15 -15
  117. package/src/components/ChipSelect/ChipSelect.tsx +51 -31
  118. package/src/components/CtaCard/CtaCard.tsx +33 -24
  119. package/src/components/CtaCard/index.ts +1 -1
  120. package/src/components/EmptyState/EmptyState.tsx +2 -1
  121. package/src/components/IconButton/IconButton.tsx +30 -21
  122. package/src/components/IconCapsule/IconCapsule.tsx +22 -24
  123. package/src/components/InputSearch/InputSearch.tsx +1 -1
  124. package/src/components/MediaCard/MediaCard.tsx +52 -52
  125. package/src/components/NavArrow/NavArrow.tsx +15 -17
  126. package/src/components/RechargeCard/RechargeCard.tsx +39 -39
  127. package/src/components/SupportText/SupportText.tsx +20 -20
  128. package/src/components/SupportText/SupportTextIcon.tsx +10 -10
  129. package/src/components/SupportText/index.ts +2 -2
  130. package/src/components/UpiHandle/UpiHandle.tsx +23 -13
  131. package/src/components/index.ts +49 -49
  132. package/src/design-tokens/JFSThemeProvider.tsx +12 -12
  133. package/src/design-tokens/figma-variables-resolver.js +117 -117
  134. package/src/design-tokens/figma-variables-resolver.ts +117 -117
  135. package/src/design-tokens/index.ts +2 -2
  136. package/src/icons/Icon.tsx +22 -22
  137. package/src/icons/index.ts +3 -3
  138. package/src/icons/registry.ts +1 -1
  139. package/src/index.ts +4 -4
  140. package/src/utils/react-utils.ts +8 -8
@@ -1,12 +1,13 @@
1
- import React, { createContext, useContext, isValidElement, cloneElement } from 'react';
2
- import { View, Text, StyleSheet, type ViewStyle, type TextStyle, type StyleProp, Image } from 'react-native';
3
- import { getVariableByName } from '../../design-tokens/figma-variables-resolver';
4
- import IconComponent from '../../icons/Icon';
1
+ import React, { createContext, useContext, isValidElement, cloneElement } from 'react'
2
+ import { View, Text, StyleSheet, type ViewStyle, type TextStyle, type StyleProp, Image } from 'react-native'
3
+ import { getVariableByName } from '../../design-tokens/figma-variables-resolver'
4
+ // Internal Icon component usage is deprecated but kept for backward compatibility
5
+ import IconComponent from '../../icons/Icon'
5
6
 
6
7
  /**
7
8
  * Context to share 'modes' with child components.
8
9
  */
9
- const CardFeedbackContext = createContext<{ modes?: Record<string, any> }>({});
10
+ const CardFeedbackContext = createContext<{ modes?: Record<string, any> }>({})
10
11
 
11
12
  export interface CardFeedbackProps {
12
13
  /**
@@ -38,13 +39,13 @@ export function CardFeedback({
38
39
  'Context': 'Nudge&Alert',
39
40
  'Semantic Intent': 'System',
40
41
  ...propModes,
41
- };
42
+ }
42
43
  // Container Tokens
43
- const backgroundColor = getVariableByName('cardFeedback/background', modes) || '#dbf0d9';
44
- const radius = parseFloat(getVariableByName('cardFeedback/radius', modes) || '12');
45
- const gap = parseFloat(getVariableByName('cardFeedback/gap', modes) || '8');
46
- const paddingHorizontal = parseFloat(getVariableByName('cardFeedback/padding/horizontal', modes) || '12');
47
- const paddingVertical = parseFloat(getVariableByName('cardFeedback/padding/vertical', modes) || '12');
44
+ const backgroundColor = getVariableByName('cardFeedback/background', modes) || '#dbf0d9'
45
+ const radius = parseFloat(getVariableByName('cardFeedback/radius', modes) || '12')
46
+ const gap = parseFloat(getVariableByName('cardFeedback/gap', modes) || '8')
47
+ const paddingHorizontal = parseFloat(getVariableByName('cardFeedback/padding/horizontal', modes) || '12')
48
+ const paddingVertical = parseFloat(getVariableByName('cardFeedback/padding/vertical', modes) || '12')
48
49
 
49
50
  const containerStyle: ViewStyle = {
50
51
  backgroundColor,
@@ -56,7 +57,7 @@ export function CardFeedback({
56
57
  minHeight: 59,
57
58
  alignItems: 'flex-start',
58
59
  flexDirection: 'column',
59
- };
60
+ }
60
61
 
61
62
  return (
62
63
  <CardFeedbackContext.Provider value={{ modes }}>
@@ -64,7 +65,7 @@ export function CardFeedback({
64
65
  {children}
65
66
  </View>
66
67
  </CardFeedbackContext.Provider>
67
- );
68
+ )
68
69
  }
69
70
 
70
71
  // ----------------------------------------------------------------------------
@@ -75,39 +76,45 @@ export function CardFeedback({
75
76
  * Icon Wrapper
76
77
  * Tokens: cardFeedback/icon/size, appearanceFeedback/cardFeedback/icon/color
77
78
  */
78
- export function Icon({ children, style, modes: propModes, icon }: { children?: React.ReactNode; style?: StyleProp<ViewStyle>; modes?: Record<string, any>; icon?: string }) {
79
- const context = useContext(CardFeedbackContext);
80
- const modes = propModes || context.modes || {};
79
+ export function Icon({ children, style, modes: propModes, icon, iconName }: { children?: React.ReactNode; style?: StyleProp<ViewStyle>; modes?: Record<string, any>; icon?: React.ReactNode; iconName?: string }) {
80
+ const context = useContext(CardFeedbackContext)
81
+ const modes = propModes || context.modes || {}
81
82
 
82
- const size = parseFloat(getVariableByName('cardFeedback/icon/size', modes) || '20');
83
+ const size = parseFloat(getVariableByName('cardFeedback/icon/size', modes) || '20')
83
84
  // Color for the icon itself
84
- const color = getVariableByName('appearanceFeedback/cardFeedback/icon/color', modes);
85
- console.log(color);
85
+ const color = getVariableByName('appearanceFeedback/cardFeedback/icon/color', modes)
86
+ console.log(color)
86
87
  const containerStyle: ViewStyle = {
87
88
  width: size,
88
89
  height: size,
89
90
  justifyContent: 'center',
90
91
  alignItems: 'center',
91
92
  overflow: 'hidden',
92
- };
93
+ }
93
94
 
94
95
  // Pass modes to children (e.g., icon components that accept modes)
95
96
  const childrenWithModes = React.Children.map(children, child => {
96
97
  if (isValidElement(child)) {
97
- return cloneElement(child as React.ReactElement<{ modes?: Record<string, any> }>, { modes: { ...(child.props as any).modes, ...modes } });
98
+ return cloneElement(child as React.ReactElement<{ modes?: Record<string, any> }>, { modes: { ...(child.props as any).modes, ...modes } })
98
99
  }
99
- return child;
100
- });
100
+ return child
101
+ })
101
102
 
102
103
  return (
103
104
  <View style={[containerStyle, style]}>
104
- {icon ? (
105
- <IconComponent name={icon} size={size} color={color} />
105
+ {(icon || iconName) ? (
106
+ isValidElement(icon) ? cloneElement(icon as React.ReactElement<any>, {
107
+ size,
108
+ color,
109
+ modes: { ...modes, ...((icon as React.ReactElement<any>).props.modes || {}) }
110
+ }) : (
111
+ iconName ? <IconComponent name={iconName} size={size} color={color} /> : null
112
+ )
106
113
  ) : (
107
114
  childrenWithModes
108
115
  )}
109
116
  </View>
110
- );
117
+ )
111
118
  }
112
119
 
113
120
  /**
@@ -116,24 +123,24 @@ export function Icon({ children, style, modes: propModes, icon }: { children?: R
116
123
  * Tokens: cardFeedback/text/gap
117
124
  */
118
125
  export function Content({ children, style, modes: propModes }: { children?: React.ReactNode; style?: StyleProp<ViewStyle>; modes?: Record<string, any> }) {
119
- const context = useContext(CardFeedbackContext);
120
- const modes = propModes || context.modes || {};
126
+ const context = useContext(CardFeedbackContext)
127
+ const modes = propModes || context.modes || {}
121
128
 
122
- const gap = parseFloat(getVariableByName('cardFeedback/text/gap', modes) || '8');
129
+ const gap = parseFloat(getVariableByName('cardFeedback/text/gap', modes) || '8')
123
130
 
124
131
  // Pass modes to children (Title, Body, etc.)
125
132
  const childrenWithModes = React.Children.map(children, child => {
126
133
  if (isValidElement(child)) {
127
- return cloneElement(child as React.ReactElement<{ modes?: Record<string, any> }>, { modes: { ...(child.props as any).modes, ...modes } });
134
+ return cloneElement(child as React.ReactElement<{ modes?: Record<string, any> }>, { modes: { ...(child.props as any).modes, ...modes } })
128
135
  }
129
- return child;
130
- });
136
+ return child
137
+ })
131
138
 
132
139
  return (
133
140
  <View style={[{ gap, width: '100%' }, style]}>
134
141
  {childrenWithModes}
135
142
  </View>
136
- );
143
+ )
137
144
  }
138
145
 
139
146
  /**
@@ -141,14 +148,14 @@ export function Content({ children, style, modes: propModes }: { children?: Reac
141
148
  * Tokens: cardFeedback/title/*
142
149
  */
143
150
  export function Title({ children, style, modes: propModes }: { children?: React.ReactNode; style?: StyleProp<TextStyle>; modes?: Record<string, any> }) {
144
- const context = useContext(CardFeedbackContext);
145
- const modes = propModes || context.modes || {};
151
+ const context = useContext(CardFeedbackContext)
152
+ const modes = propModes || context.modes || {}
146
153
 
147
- const color = getVariableByName('cardFeedback/title/color', modes) || '#0f0d0a';
148
- const fontSize = parseFloat(getVariableByName('cardFeedback/title/fontSize', modes) || '14');
149
- const fontFamily = getVariableByName('cardFeedback/title/fontFamily', modes) || 'JioType Var';
150
- const lineHeight = parseFloat(getVariableByName('cardFeedback/title/lineHeight', modes) || '17');
151
- const fontWeight = getVariableByName('cardFeedback/title/fontWeight', modes) || '500';
154
+ const color = getVariableByName('cardFeedback/title/color', modes) || '#0f0d0a'
155
+ const fontSize = parseFloat(getVariableByName('cardFeedback/title/fontSize', modes) || '14')
156
+ const fontFamily = getVariableByName('cardFeedback/title/fontFamily', modes) || 'JioType Var'
157
+ const lineHeight = parseFloat(getVariableByName('cardFeedback/title/lineHeight', modes) || '17')
158
+ const fontWeight = getVariableByName('cardFeedback/title/fontWeight', modes) || '500'
152
159
 
153
160
  const textStyle: TextStyle = {
154
161
  color,
@@ -156,9 +163,9 @@ export function Title({ children, style, modes: propModes }: { children?: React.
156
163
  fontFamily,
157
164
  lineHeight,
158
165
  fontWeight: fontWeight as TextStyle['fontWeight'],
159
- };
166
+ }
160
167
 
161
- return <Text style={[textStyle, style]}>{children}</Text>;
168
+ return <Text style={[textStyle, style]}>{children}</Text>
162
169
  }
163
170
 
164
171
  /**
@@ -166,14 +173,14 @@ export function Title({ children, style, modes: propModes }: { children?: React.
166
173
  * Tokens: cardFeedback/body/*
167
174
  */
168
175
  export function Body({ children, style, modes: propModes }: { children?: React.ReactNode; style?: StyleProp<TextStyle>; modes?: Record<string, any> }) {
169
- const context = useContext(CardFeedbackContext);
170
- const modes = propModes || context.modes || {};
176
+ const context = useContext(CardFeedbackContext)
177
+ const modes = propModes || context.modes || {}
171
178
 
172
- const color = getVariableByName('cardFeedback/body/color', modes) || '#1f1a14';
173
- const fontSize = parseFloat(getVariableByName('cardFeedback/body/fontSize', modes) || '12');
174
- const fontFamily = getVariableByName('cardFeedback/body/fontFamily', modes) || 'JioType Var';
175
- const lineHeight = parseFloat(getVariableByName('cardFeedback/body/lineHeight', modes) || '16');
176
- const fontWeight = getVariableByName('cardFeedback/body/fontWeight', modes) || '400';
179
+ const color = getVariableByName('cardFeedback/body/color', modes) || '#1f1a14'
180
+ const fontSize = parseFloat(getVariableByName('cardFeedback/body/fontSize', modes) || '12')
181
+ const fontFamily = getVariableByName('cardFeedback/body/fontFamily', modes) || 'JioType Var'
182
+ const lineHeight = parseFloat(getVariableByName('cardFeedback/body/lineHeight', modes) || '16')
183
+ const fontWeight = getVariableByName('cardFeedback/body/fontWeight', modes) || '400'
177
184
 
178
185
  const textStyle: TextStyle = {
179
186
  color,
@@ -181,9 +188,9 @@ export function Body({ children, style, modes: propModes }: { children?: React.R
181
188
  fontFamily,
182
189
  lineHeight,
183
190
  fontWeight: fontWeight as TextStyle['fontWeight'],
184
- };
191
+ }
185
192
 
186
- return <Text style={[textStyle, style]}>{children}</Text>;
193
+ return <Text style={[textStyle, style]}>{children}</Text>
187
194
  }
188
195
 
189
196
  /**
@@ -191,31 +198,31 @@ export function Body({ children, style, modes: propModes }: { children?: React.R
191
198
  * Tokens: cardFeedback/actionSlot/gap
192
199
  */
193
200
  export function Action({ children, style, modes: propModes }: { children?: React.ReactNode; style?: StyleProp<ViewStyle>; modes?: Record<string, any> }) {
194
- const context = useContext(CardFeedbackContext);
195
- const modes = propModes || context.modes || {};
201
+ const context = useContext(CardFeedbackContext)
202
+ const modes = propModes || context.modes || {}
196
203
 
197
- const gap = parseFloat(getVariableByName('cardFeedback/actionSlot/gap', modes) || '0');
204
+ const gap = parseFloat(getVariableByName('cardFeedback/actionSlot/gap', modes) || '0')
198
205
 
199
206
  // "Maximise existing component usage" -> Pass modes to children (Buttons)
200
207
  const childrenWithModes = React.Children.map(children, child => {
201
208
  if (isValidElement(child)) {
202
- return cloneElement(child as React.ReactElement<{ modes?: Record<string, any> }>, { modes: { ...(child.props as any).modes, ...modes } });
209
+ return cloneElement(child as React.ReactElement<{ modes?: Record<string, any> }>, { modes: { ...(child.props as any).modes, ...modes } })
203
210
  }
204
- return child;
205
- });
211
+ return child
212
+ })
206
213
 
207
214
  return (
208
215
  <View style={[{ gap, flexDirection: 'row', flexWrap: 'wrap' }, style]}>
209
216
  {childrenWithModes}
210
217
  </View>
211
- );
218
+ )
212
219
  }
213
220
 
214
221
  // Attach sub-components
215
- CardFeedback.Icon = Icon;
216
- CardFeedback.Content = Content;
217
- CardFeedback.Title = Title;
218
- CardFeedback.Body = Body;
219
- CardFeedback.Action = Action;
222
+ CardFeedback.Icon = Icon
223
+ CardFeedback.Content = Content
224
+ CardFeedback.Title = Title
225
+ CardFeedback.Body = Body
226
+ CardFeedback.Action = Action
220
227
 
221
- export default CardFeedback;
228
+ export default CardFeedback
@@ -1,7 +1,7 @@
1
- import React from 'react';
2
- import { View, type StyleProp, type ViewStyle } from 'react-native';
3
- import { getVariableByName } from '../../design-tokens/figma-variables-resolver';
4
- import { flattenChildren } from '../../utils/react-utils';
1
+ import React from 'react'
2
+ import { View, type StyleProp, type ViewStyle } from 'react-native'
3
+ import { getVariableByName } from '../../design-tokens/figma-variables-resolver'
4
+ import { flattenChildren } from '../../utils/react-utils'
5
5
 
6
6
  export type ChipGroupProps = {
7
7
  /**
@@ -35,7 +35,7 @@ function ChipGroup({
35
35
  testID,
36
36
  }: ChipGroupProps) {
37
37
  // --- Token Resolution ---
38
- const gap = parseInt(getVariableByName('chipGroup/gap', modes), 10) || 8;
38
+ const gap = parseInt(getVariableByName('chipGroup/gap', modes), 10) || 8
39
39
 
40
40
  // --- Styles ---
41
41
  const containerStyle: ViewStyle = {
@@ -43,28 +43,28 @@ function ChipGroup({
43
43
  alignItems: 'flex-start',
44
44
  flexWrap: 'wrap',
45
45
  gap: gap,
46
- };
46
+ }
47
47
 
48
48
  // Flatten children to handle Fragments properly
49
- const flatChildren = flattenChildren(children);
49
+ const flatChildren = flattenChildren(children)
50
50
 
51
51
  // Clone children to pass `modes` prop
52
52
  const childrenWithModes = React.Children.map(flatChildren, (child) => {
53
53
  if (React.isValidElement(child)) {
54
54
  // Pass merged modes (parent modes + child modes)
55
- const element = child as React.ReactElement<any>;
56
- const childModes = element.props.modes || {};
57
- const mergedModes = { ...modes, ...childModes };
58
- return React.cloneElement(element, { modes: mergedModes });
55
+ const element = child as React.ReactElement<any>
56
+ const childModes = element.props.modes || {}
57
+ const mergedModes = { ...modes, ...childModes }
58
+ return React.cloneElement(element, { modes: mergedModes })
59
59
  }
60
- return child;
61
- });
60
+ return child
61
+ })
62
62
 
63
63
  return (
64
64
  <View style={[containerStyle, style]} testID={testID}>
65
65
  {childrenWithModes}
66
66
  </View>
67
- );
67
+ )
68
68
  }
69
69
 
70
- export default ChipGroup;
70
+ export default ChipGroup
@@ -1,7 +1,6 @@
1
- import React from 'react';
2
- import { View, Text, TouchableOpacity, type StyleProp, type ViewStyle, type TextStyle } from 'react-native';
3
- import { getVariableByName } from '../../design-tokens/figma-variables-resolver';
4
- import Icon from '../../icons/Icon';
1
+ import { View, Text, TouchableOpacity, type StyleProp, type ViewStyle, type TextStyle } from 'react-native'
2
+ import React, { isValidElement, cloneElement } from 'react'
3
+ import { getVariableByName } from '../../design-tokens/figma-variables-resolver'
5
4
 
6
5
  export type ChipSelectProps = {
7
6
  /**
@@ -15,15 +14,22 @@ export type ChipSelectProps = {
15
14
  */
16
15
  active?: boolean;
17
16
  /**
18
- * Icon name to display in Idle state (when active is false).
19
- * @default "ic_calendar_week"
17
+ * Icon element to display in Idle state (when active is false).
20
18
  */
21
- icon?: string;
19
+ icon?: React.ReactNode;
20
+ /**
21
+ * Deprecated: Use icon prop instead
22
+ */
23
+ iconName?: string;
22
24
  /**
23
25
  * Whether to show the close icon in Active state (when active is true).
24
26
  * @default true
25
27
  */
26
28
  close?: boolean;
29
+ /**
30
+ * Custom close icon element to display when active is true and close is true.
31
+ */
32
+ closeIcon?: React.ReactNode;
27
33
  /**
28
34
  * Modes for design token resolution.
29
35
  */
@@ -49,8 +55,10 @@ export type ChipSelectProps = {
49
55
  function ChipSelect({
50
56
  label = 'Date',
51
57
  active = false,
52
- icon = 'ic_calendar_week',
58
+ icon,
59
+ iconName,
53
60
  close = true,
61
+ closeIcon,
54
62
  modes = {},
55
63
  style,
56
64
  labelSlot,
@@ -61,26 +69,26 @@ function ChipSelect({
61
69
  const resolvedModes = {
62
70
  ...modes,
63
71
  'ChipSelect State': active ? 'Active' : 'Idle',
64
- };
72
+ }
65
73
 
66
74
  // --- Token Resolution ---
67
- const gap = parseInt(getVariableByName('chipSelect/gap', resolvedModes), 10) || 4;
68
- const paddingHorizontal = parseInt(getVariableByName('chipSelect/padding/horizontal', resolvedModes), 10) || 16;
69
- const paddingVertical = parseInt(getVariableByName('chipSelect/padding/vertical', resolvedModes), 10) || 0;
70
- const radius = parseInt(getVariableByName('chipSelect/radius', resolvedModes), 10) || 999;
75
+ const gap = parseInt(getVariableByName('chipSelect/gap', resolvedModes), 10) || 4
76
+ const paddingHorizontal = parseInt(getVariableByName('chipSelect/padding/horizontal', resolvedModes), 10) || 16
77
+ const paddingVertical = parseInt(getVariableByName('chipSelect/padding/vertical', resolvedModes), 10) || 0
78
+ const radius = parseInt(getVariableByName('chipSelect/radius', resolvedModes), 10) || 999
71
79
 
72
80
  // Background
73
- const backgroundColor = getVariableByName('chipSelect/background', resolvedModes) || '#f5f5f5';
81
+ const backgroundColor = getVariableByName('chipSelect/background', resolvedModes) || '#f5f5f5'
74
82
 
75
83
  // Text Styles
76
- const textColor = getVariableByName('chipSelect/foreground', resolvedModes) || '#0d0d0f';
77
- const fontSize = parseInt(getVariableByName('chipSelect/fontSize', resolvedModes), 10) || 14;
78
- const fontFamily = getVariableByName('chipSelect/fontFamily', resolvedModes) || 'JioType Var';
79
- const lineHeight = parseInt(getVariableByName('chipSelect/lineHeight', resolvedModes), 10) || 32;
80
- const fontWeight = getVariableByName('chipSelect/fontWeight', resolvedModes) || '700';
84
+ const textColor = getVariableByName('chipSelect/foreground', resolvedModes) || '#0d0d0f'
85
+ const fontSize = parseInt(getVariableByName('chipSelect/fontSize', resolvedModes), 10) || 14
86
+ const fontFamily = getVariableByName('chipSelect/fontFamily', resolvedModes) || 'JioType Var'
87
+ const lineHeight = parseInt(getVariableByName('chipSelect/lineHeight', resolvedModes), 10) || 32
88
+ const fontWeight = getVariableByName('chipSelect/fontWeight', resolvedModes) || '700'
81
89
 
82
90
  // Icon Styles
83
- const iconSize = parseInt(getVariableByName('chipSelect/icon/size', resolvedModes), 10) || 16;
91
+ const iconSize = parseInt(getVariableByName('chipSelect/icon/size', resolvedModes), 10) || 16
84
92
 
85
93
  // --- Styles ---
86
94
  const containerStyle: ViewStyle = {
@@ -92,7 +100,7 @@ function ChipSelect({
92
100
  paddingHorizontal: paddingHorizontal,
93
101
  paddingVertical: paddingVertical,
94
102
  gap: gap,
95
- };
103
+ }
96
104
 
97
105
  const textStyle: TextStyle = {
98
106
  color: textColor,
@@ -101,18 +109,18 @@ function ChipSelect({
101
109
  lineHeight: lineHeight,
102
110
  fontWeight: fontWeight as any,
103
111
  textAlign: 'center',
104
- };
112
+ }
105
113
 
106
114
  const renderLabel = () => {
107
115
  if (labelSlot) {
108
116
  if (React.isValidElement(labelSlot)) {
109
117
  // Pass resolved modes to slot
110
- return React.cloneElement(labelSlot as React.ReactElement<any>, { modes: resolvedModes });
118
+ return React.cloneElement(labelSlot as React.ReactElement<any>, { modes: resolvedModes })
111
119
  }
112
- return labelSlot;
120
+ return labelSlot
113
121
  }
114
- return <Text style={textStyle}>{label}</Text>;
115
- };
122
+ return <Text style={textStyle}>{label}</Text>
123
+ }
116
124
 
117
125
  return (
118
126
  <TouchableOpacity
@@ -121,18 +129,30 @@ function ChipSelect({
121
129
  activeOpacity={0.8}
122
130
  >
123
131
  {/* Start Icon */}
124
- {icon && (
125
- <Icon name={icon} size={iconSize} color={textColor} />
132
+ {(icon || iconName) && (
133
+ isValidElement(icon) ? cloneElement(icon as React.ReactElement<any>, {
134
+ size: iconSize,
135
+ width: iconSize,
136
+ height: iconSize,
137
+ color: textColor,
138
+ fill: textColor
139
+ }) : null
126
140
  )}
127
141
 
128
142
  {renderLabel()}
129
143
 
130
144
  {/* End/Close Icon (Only when active AND close is true) */}
131
145
  {active && close && (
132
- <Icon name="ic_close" size={iconSize} color={textColor} />
146
+ isValidElement(closeIcon) ? cloneElement(closeIcon as React.ReactElement<any>, {
147
+ size: iconSize,
148
+ width: iconSize,
149
+ height: iconSize,
150
+ color: textColor,
151
+ fill: textColor
152
+ }) : null
133
153
  )}
134
154
  </TouchableOpacity>
135
- );
155
+ )
136
156
  }
137
157
 
138
- export default ChipSelect;
158
+ export default ChipSelect
@@ -1,10 +1,11 @@
1
- import React from 'react'
1
+ import React, { isValidElement, cloneElement } 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
4
  import { useTokens } from '../../design-tokens/JFSThemeProvider'
5
5
  import IconCapsule from '../IconCapsule/IconCapsule'
6
6
  import Button from '../Button/Button'
7
7
  import { cloneChildrenWithModes } from '../../utils/react-utils'
8
+ import Icon from '../../icons/Icon'
8
9
 
9
10
  type CtaCardProps = {
10
11
  /**
@@ -17,8 +18,13 @@ type CtaCardProps = {
17
18
  body?: string;
18
19
  /**
19
20
  * Name of the icon to display in the IconCapsule (if iconSlot is not provided)
21
+ * @deprecated Use icon prop instead
20
22
  */
21
23
  iconName?: string;
24
+ /**
25
+ * Icon element to display in the IconCapsule (if iconSlot is not provided)
26
+ */
27
+ icon?: React.ReactNode;
22
28
  /**
23
29
  * Label for the button (if buttonSlot is not provided)
24
30
  */
@@ -67,7 +73,8 @@ type CtaCardProps = {
67
73
  function CtaCard({
68
74
  title = "Lets create your UPI ID",
69
75
  body = "Send and receive money securely.",
70
- iconName = "ic_upi_number",
76
+ iconName,
77
+ icon,
71
78
  buttonLabel = "Get started",
72
79
  onPressButton,
73
80
  modes: propModes = {},
@@ -81,26 +88,26 @@ function CtaCard({
81
88
  const modes = { ...globalModes, ...propModes }
82
89
  // --- Token Resolution ---
83
90
  // Container
84
- const backgroundColor = getVariableByName('ctaCard/background', modes) || '#0078ad';
85
- const radius = getVariableByName('ctaCard/radius', modes) || 16;
86
- const paddingHorizontal = getVariableByName('ctaCard/padding/horizontal', modes) || 20;
87
- const paddingVertical = getVariableByName('ctaCard/padding/vertical', modes) || 23;
88
- const gap = getVariableByName('ctaCard/gap', modes) || 16;
91
+ const backgroundColor = getVariableByName('ctaCard/background', modes) || '#0078ad'
92
+ const radius = getVariableByName('ctaCard/radius', modes) || 16
93
+ const paddingHorizontal = getVariableByName('ctaCard/padding/horizontal', modes) || 20
94
+ const paddingVertical = getVariableByName('ctaCard/padding/vertical', modes) || 23
95
+ const gap = getVariableByName('ctaCard/gap', modes) || 16
89
96
 
90
97
  // Content Wrap
91
- const contentGap = getVariableByName('ctaCard/content/gap', modes) || 8;
98
+ const contentGap = getVariableByName('ctaCard/content/gap', modes) || 8
92
99
 
93
100
  // Title Text
94
- const titleColor = getVariableByName('ctaCard/title/color', modes) || '#ffffff';
95
- const titleFontFamily = getVariableByName('ctaCard/title/fontFamily', modes) || 'JioType Var';
96
- const titleFontSize = getVariableByName('ctaCard/title/fontSize', modes) || 23;
97
- const titleLineHeight = getVariableByName('ctaCard/title/lineHeight', modes) || 23;
101
+ const titleColor = getVariableByName('ctaCard/title/color', modes) || '#ffffff'
102
+ const titleFontFamily = getVariableByName('ctaCard/title/fontFamily', modes) || 'JioType Var'
103
+ const titleFontSize = getVariableByName('ctaCard/title/fontSize', modes) || 23
104
+ const titleLineHeight = getVariableByName('ctaCard/title/lineHeight', modes) || 23
98
105
 
99
106
  // Body Text
100
- const bodyColor = getVariableByName('ctaCard/body/color', modes) || '#ffffff';
101
- const bodyFontFamily = getVariableByName('ctaCard/body/fontFamily', modes) || 'JioType Var';
102
- const bodyFontSize = getVariableByName('ctaCard/body/fontSize', modes) || 14;
103
- const bodyLineHeight = getVariableByName('ctaCard/body/lineHeight', modes) || 17;
107
+ const bodyColor = getVariableByName('ctaCard/body/color', modes) || '#ffffff'
108
+ const bodyFontFamily = getVariableByName('ctaCard/body/fontFamily', modes) || 'JioType Var'
109
+ const bodyFontSize = getVariableByName('ctaCard/body/fontSize', modes) || 14
110
+ const bodyLineHeight = getVariableByName('ctaCard/body/lineHeight', modes) || 17
104
111
 
105
112
  // --- Styles ---
106
113
  const containerStyle: ViewStyle = {
@@ -112,13 +119,13 @@ function CtaCard({
112
119
  alignItems: 'flex-start',
113
120
  width: '100%', // Adjust based on layout needs, usually cards take full width available
114
121
  overflow: 'hidden',
115
- };
122
+ }
116
123
 
117
124
  const contentWrapStyle: ViewStyle = {
118
125
  gap: contentGap,
119
126
  alignItems: 'flex-start',
120
127
  width: '100%',
121
- };
128
+ }
122
129
 
123
130
  const titleStyle: TextStyle = {
124
131
  color: titleColor,
@@ -126,7 +133,7 @@ function CtaCard({
126
133
  fontSize: titleFontSize,
127
134
  lineHeight: titleLineHeight,
128
135
  fontWeight: '900', // "Black" in Figma often maps to 900
129
- };
136
+ }
130
137
 
131
138
  const bodyStyle: TextStyle = {
132
139
  color: bodyColor,
@@ -134,18 +141,20 @@ function CtaCard({
134
141
  fontSize: bodyFontSize,
135
142
  lineHeight: bodyLineHeight,
136
143
  fontWeight: '400', // Regular
137
- };
144
+ }
138
145
 
139
146
 
140
147
 
141
148
  return (
142
149
  <View style={[containerStyle, style]}>
143
150
  <View style={contentWrapStyle}>
144
- {/* Icon Slot */}
145
151
  {iconSlot ? (
146
152
  cloneChildrenWithModes(iconSlot, modes)
147
153
  ) : (
148
- <IconCapsule iconName={iconName} modes={modes} />
154
+ (icon || iconName) && <IconCapsule
155
+ icon={isValidElement(icon) ? icon : (iconName ? <Icon name={iconName} /> : undefined)}
156
+ modes={modes}
157
+ />
149
158
  )}
150
159
 
151
160
  {/* Title Slot */}
@@ -174,7 +183,7 @@ function CtaCard({
174
183
  />
175
184
  )}
176
185
  </View>
177
- );
186
+ )
178
187
  }
179
188
 
180
- export default CtaCard;
189
+ export default CtaCard
@@ -1 +1 @@
1
- export { default } from './CtaCard';
1
+ export { default } from './CtaCard'
@@ -4,6 +4,7 @@ import { getVariableByName } from '../../design-tokens/figma-variables-resolver'
4
4
  import { useTokens } from '../../design-tokens/JFSThemeProvider'
5
5
  import IconCapsule from '../IconCapsule/IconCapsule'
6
6
  import Button from '../Button/Button'
7
+ import Icon from '../../icons/Icon'
7
8
 
8
9
  export type EmptyStateProps = {
9
10
  /**
@@ -112,7 +113,7 @@ function EmptyState({
112
113
  }
113
114
 
114
115
  const defaultIconSlot = useMemo(() => (
115
- <IconCapsule modes={modes} />
116
+ <IconCapsule icon={<Icon name="ic_card" />} modes={modes} />
116
117
  ), [modes])
117
118
 
118
119
  // Checking if iconSlot is passed; if not use default.