jfs-components 0.0.21 → 0.0.24

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 (50) hide show
  1. package/lib/commonjs/assets/fonts/JioType Var.ttf +0 -0
  2. package/lib/commonjs/components/Carousel/Carousel.js +341 -0
  3. package/lib/commonjs/components/Carousel/Carousel.js.map +1 -0
  4. package/lib/commonjs/components/Carousel/Carousel.mdx +154 -0
  5. package/lib/commonjs/components/Drawer/Drawer.js +9 -2
  6. package/lib/commonjs/components/Drawer/Drawer.js.map +1 -1
  7. package/lib/commonjs/components/RadioButton/RadioButton.js +194 -0
  8. package/lib/commonjs/components/RadioButton/RadioButton.js.map +1 -0
  9. package/lib/commonjs/components/RadioButton/RadioButton.mdx +92 -0
  10. package/lib/commonjs/components/UpiHandle/UpiHandle.js +3 -1
  11. package/lib/commonjs/components/UpiHandle/UpiHandle.js.map +1 -1
  12. package/lib/commonjs/components/index.js +7 -0
  13. package/lib/commonjs/components/index.js.map +1 -1
  14. package/lib/commonjs/design-tokens/figma-variables-resolver.js +9 -3
  15. package/lib/commonjs/icons/registry.js +1 -1
  16. package/lib/module/assets/fonts/JioType Var.ttf +0 -0
  17. package/lib/module/components/Carousel/Carousel.js +333 -0
  18. package/lib/module/components/Carousel/Carousel.js.map +1 -0
  19. package/lib/module/components/Carousel/Carousel.mdx +154 -0
  20. package/lib/module/components/Drawer/Drawer.js +10 -3
  21. package/lib/module/components/Drawer/Drawer.js.map +1 -1
  22. package/lib/module/components/RadioButton/RadioButton.js +188 -0
  23. package/lib/module/components/RadioButton/RadioButton.js.map +1 -0
  24. package/lib/module/components/RadioButton/RadioButton.mdx +92 -0
  25. package/lib/module/components/UpiHandle/UpiHandle.js +3 -1
  26. package/lib/module/components/UpiHandle/UpiHandle.js.map +1 -1
  27. package/lib/module/components/index.js +1 -0
  28. package/lib/module/components/index.js.map +1 -1
  29. package/lib/module/icons/registry.js +1 -1
  30. package/lib/typescript/components/Carousel/Carousel.d.ts +48 -0
  31. package/lib/typescript/components/Carousel/Carousel.d.ts.map +1 -0
  32. package/lib/typescript/components/Drawer/Drawer.d.ts.map +1 -1
  33. package/lib/typescript/components/RadioButton/RadioButton.d.ts +30 -0
  34. package/lib/typescript/components/RadioButton/RadioButton.d.ts.map +1 -0
  35. package/lib/typescript/components/UpiHandle/UpiHandle.d.ts +4 -2
  36. package/lib/typescript/components/UpiHandle/UpiHandle.d.ts.map +1 -1
  37. package/lib/typescript/components/index.d.ts +1 -0
  38. package/lib/typescript/components/index.d.ts.map +1 -1
  39. package/lib/typescript/icons/registry.d.ts +1 -1
  40. package/package.json +3 -3
  41. package/src/assets/fonts/JioType Var.ttf +0 -0
  42. package/src/components/.token-metadata.json +72 -0
  43. package/src/components/Carousel/Carousel.mdx +154 -0
  44. package/src/components/Carousel/Carousel.tsx +472 -0
  45. package/src/components/Drawer/Drawer.tsx +10 -2
  46. package/src/components/RadioButton/RadioButton.mdx +92 -0
  47. package/src/components/RadioButton/RadioButton.tsx +226 -0
  48. package/src/components/UpiHandle/UpiHandle.tsx +5 -2
  49. package/src/components/index.ts +1 -0
  50. package/src/icons/registry.ts +1 -1
@@ -0,0 +1,226 @@
1
+ import React, { useMemo, useState } from 'react'
2
+ import {
3
+ Pressable,
4
+ View,
5
+ StyleSheet,
6
+ Platform,
7
+ ViewStyle,
8
+ DimensionValue,
9
+ StyleProp,
10
+ } from 'react-native'
11
+ import { getVariableByName } from '../../design-tokens/figma-variables-resolver'
12
+
13
+ // ---------------------------------------------------------------------------
14
+ // Props
15
+ // ---------------------------------------------------------------------------
16
+
17
+ export interface RadioButtonProps {
18
+ /**
19
+ * Whether the radio button is selected.
20
+ */
21
+ selected?: boolean
22
+ /**
23
+ * Whether the radio button is disabled.
24
+ */
25
+ disabled?: boolean
26
+ /**
27
+ * Function to call when the radio button is pressed.
28
+ */
29
+ onPress?: () => void
30
+ /**
31
+ * Modes object for design-token resolution.
32
+ */
33
+ modes?: Record<string, any>
34
+ /**
35
+ * Custom style for the radio button container.
36
+ */
37
+ style?: StyleProp<ViewStyle>
38
+ /**
39
+ * Test ID for testing.
40
+ */
41
+ testID?: string
42
+ }
43
+
44
+ // ---------------------------------------------------------------------------
45
+ // RadioButton
46
+ // ---------------------------------------------------------------------------
47
+
48
+ export function RadioButton({
49
+ selected = false,
50
+ disabled = false,
51
+ onPress,
52
+ modes = {},
53
+ style,
54
+ testID,
55
+ }: RadioButtonProps) {
56
+ // ---- Refs & State ----
57
+ const [hovered, setHovered] = useState(false)
58
+ const [focused, setFocused] = useState(false)
59
+ const [pressed, setPressed] = useState(false)
60
+
61
+ // ---- Dimensions ----
62
+ const widthStr = getVariableByName('radio/width', modes) || '18'
63
+ const heightStr = getVariableByName('radio/height', modes) || '18'
64
+ const selectorSizeStr = getVariableByName('radio/selector/size', modes) || '10'
65
+
66
+ const width = parseFloat(widthStr?.toString() || '18')
67
+ const height = parseFloat(heightStr?.toString() || '18')
68
+ const selectorSize = parseFloat(selectorSizeStr?.toString() || '10')
69
+
70
+ // ---- State Logic ----
71
+ // Priority: Disabled -> Focused -> Hover/Pressed -> Idle
72
+ // Note: Design treats Active (Pressed) similar to Selected for some styles,
73
+ // but usually in Radio Buttons, Pressed is a transient state.
74
+ // We will map:
75
+ // - Disabled -> 'disabled'
76
+ // - Focused -> 'focus'
77
+ // - Hovered -> 'hover'
78
+ // - Idle -> 'idle'
79
+
80
+ // We handle `selected` as a separate dimension derived from state.
81
+
82
+ let visualState = 'idle'
83
+ if (disabled) {
84
+ visualState = 'disabled'
85
+ } else if (focused) {
86
+ visualState = 'focus'
87
+ } else if (hovered || pressed) {
88
+ visualState = 'hover'
89
+ }
90
+
91
+ // Construct token paths based on state + selected
92
+ let prefix = `radio/${visualState}`
93
+ if (visualState === 'idle' && selected) {
94
+ prefix = `radio/selected`
95
+ } else if (selected) {
96
+ prefix = `radio/${visualState}Selected`
97
+ }
98
+
99
+ // ---- Colors & Border ----
100
+
101
+ const resolveColor = (path: string, fallback: string) => {
102
+ return getVariableByName(path, modes) || fallback
103
+ }
104
+
105
+ // Background Color
106
+ let bgColorVar = `${prefix}/background/color`
107
+ // Fix for disabledSelected weirdness if needed
108
+ if (visualState === 'disabled' && selected) {
109
+ // Check specific path from dump: `radio/disabledSelected/background`
110
+ if (!getVariableByName(`${prefix}/background/color`, modes)) {
111
+ bgColorVar = `${prefix}/background`
112
+ }
113
+ }
114
+
115
+ // Border Color
116
+ let borderColorVar = `${prefix}/border/color`
117
+
118
+ // Border Width
119
+ let borderWidthVar = `${prefix}/border/size`
120
+ // Fix for huge path: `radio/disabled/radio/disabled/border/size`
121
+ if (visualState === 'disabled' && !selected) {
122
+ if (getVariableByName('radio/disabled/radio/disabled/border/size', modes)) {
123
+ borderWidthVar = 'radio/disabled/radio/disabled/border/size'
124
+ }
125
+ }
126
+
127
+ // Selector Color
128
+ let selectorBgVar = `${prefix}/selector/background/color`
129
+ if (!selected) {
130
+ selectorBgVar = 'transparent'
131
+ }
132
+
133
+ // Shadows (Glow)
134
+ let shadowSizeVar = `${prefix}/boxShadow/size`
135
+ let shadowColorVar = `${prefix}/shadow/color`
136
+
137
+ // Resolve Values
138
+ const backgroundColor = resolveColor(bgColorVar, 'transparent')
139
+ const borderColor = resolveColor(borderColorVar, 'transparent')
140
+ const borderWidth = parseFloat(getVariableByName(borderWidthVar, modes)?.toString() || '1')
141
+ const selectorColor = resolveColor(selectorBgVar, 'transparent')
142
+
143
+ const shadowSize = parseFloat(getVariableByName(shadowSizeVar, modes)?.toString() || '0')
144
+ const shadowColor = resolveColor(shadowColorVar, 'transparent')
145
+
146
+ // Styles
147
+ const containerStyle: any = {
148
+ width,
149
+ height,
150
+ borderRadius: width / 2, // 9999px -> circle
151
+ borderWidth,
152
+ borderColor,
153
+ backgroundColor,
154
+ justifyContent: 'center',
155
+ alignItems: 'center',
156
+ // Web shadow (ring)
157
+ ...(Platform.OS === 'web' && shadowSize > 0 ? {
158
+ boxShadow: `0px 0px 0px ${shadowSize}px ${shadowColor}`,
159
+ } : {}),
160
+ }
161
+
162
+ const selectorStyle: ViewStyle = {
163
+ width: selectorSize,
164
+ height: selectorSize,
165
+ borderRadius: selectorSize / 2,
166
+ backgroundColor: selectorColor,
167
+ }
168
+
169
+ // Dummy block for token extraction (static analysis)
170
+ if (false as boolean) {
171
+ getVariableByName('radio/idle/background/color')
172
+ getVariableByName('radio/idle/border/color')
173
+ getVariableByName('radio/selector/size')
174
+ getVariableByName('radio/width')
175
+ getVariableByName('radio/height')
176
+ getVariableByName('radio/background/color')
177
+ getVariableByName('radio/hover/background/color')
178
+ getVariableByName('radio/hover/border/color')
179
+ getVariableByName('radio/hover/boxShadow/size')
180
+ getVariableByName('radio/hover/shadow/color')
181
+ getVariableByName('radio/selected/background/color')
182
+ getVariableByName('radio/selected/border/color')
183
+ getVariableByName('radio/selected/selector/background/color')
184
+ getVariableByName('radio/hoverSelected/background/color')
185
+ getVariableByName('radio/hoverSelected/border/color')
186
+ getVariableByName('radio/hoverSelected/boxShadow/size')
187
+ getVariableByName('radio/hoverSelected/shadow/color')
188
+ getVariableByName('radio/hoverSelected/selector/background/color')
189
+ getVariableByName('radio/focus/background/color')
190
+ getVariableByName('radio/focus/border/color')
191
+ getVariableByName('radio/focus/border/size')
192
+ getVariableByName('radio/focus/boxShadow/size')
193
+ getVariableByName('radio/focus/shadow/color')
194
+ getVariableByName('radio/focusSelected/background/color')
195
+ getVariableByName('radio/focusSelected/selector/background/color')
196
+ getVariableByName('radio/focusSelected/border/size')
197
+ getVariableByName('radio/disabled/radio/disabled/border/size')
198
+ getVariableByName('radio/disabled/background/color')
199
+ getVariableByName('radio/disabled/border/color')
200
+ getVariableByName('radio/disabledSelected/selector/background/color')
201
+ getVariableByName('radio/disabledSelected/background')
202
+ getVariableByName('radio/disabledSelected/border/color')
203
+ }
204
+
205
+ return (
206
+ <Pressable
207
+ testID={testID}
208
+ disabled={disabled}
209
+ onPress={onPress}
210
+ onHoverIn={() => setHovered(true)}
211
+ onHoverOut={() => setHovered(false)}
212
+ onFocus={() => setFocused(true)}
213
+ onBlur={() => setFocused(false)}
214
+ onPressIn={() => setPressed(true)}
215
+ onPressOut={() => setPressed(false)}
216
+ style={({ pressed: isPressed }) => [
217
+ containerStyle,
218
+ style,
219
+ ]}
220
+ >
221
+ <View style={selectorStyle} />
222
+ </Pressable>
223
+ )
224
+ }
225
+
226
+ export default RadioButton
@@ -1,5 +1,5 @@
1
1
  import React, { useState } from 'react'
2
- import { Pressable, View, Text, Image, type ViewStyle, type TextStyle, type ImageStyle } from 'react-native'
2
+ import { Pressable, View, Text, Image, type ViewStyle, type TextStyle, type ImageStyle, type ImageSourcePropType } from 'react-native'
3
3
  import { getVariableByName } from '../../design-tokens/figma-variables-resolver'
4
4
  import { useTokens } from '../../design-tokens/JFSThemeProvider'
5
5
  import Icon from '../../icons/Icon'
@@ -13,6 +13,7 @@ type UpiHandleProps = {
13
13
  modes?: Record<string, any>;
14
14
  showIcon?: boolean;
15
15
  iconName?: string;
16
+ avatarSource?: ImageSourcePropType;
16
17
  accessibilityLabel?: string;
17
18
  accessibilityHint?: string;
18
19
  onPress?: () => void;
@@ -36,6 +37,7 @@ type UpiHandleProps = {
36
37
  * @param {Object} [props.modes={}] - Modes object passed directly to `getVariableByName`.
37
38
  * @param {boolean} [props.showIcon=true] - Toggles the trailing icon visibility.
38
39
  * @param {string} [props.iconName='ic_scan_qr_code'] - Icon name from the actions set (e.g. 'ic_qr_code', 'ic_scan_qr_code').
40
+ * @param {ImageSourcePropType} [props.avatarSource] - Optional custom image source for the avatar.
39
41
  * @param {string} [props.accessibilityLabel] - Accessibility label for screen readers. If not provided, uses label
40
42
  * @param {string} [props.accessibilityHint] - Additional accessibility hint for screen readers
41
43
  */
@@ -44,6 +46,7 @@ function UpiHandle({
44
46
  modes: propModes = {},
45
47
  showIcon = true,
46
48
  iconName = 'ic_scan_qr_code',
49
+ avatarSource,
47
50
  onPress,
48
51
  disabled,
49
52
  accessibilityLabel,
@@ -160,7 +163,7 @@ function UpiHandle({
160
163
  {...rest}
161
164
  >
162
165
  <Image
163
- source={DEFAULT_AVATAR_IMAGE}
166
+ source={avatarSource || DEFAULT_AVATAR_IMAGE}
164
167
  style={avatarBaseStyle}
165
168
  resizeMode="cover"
166
169
  accessibilityElementsHidden={true}
@@ -47,4 +47,5 @@ export { default as ChipSelect, type ChipSelectProps } from './ChipSelect/ChipSe
47
47
  export { default as InputSearch, type InputSearchProps } from './InputSearch/InputSearch';
48
48
  export { default as SupportText, type SupportTextProps } from './SupportText/SupportText';
49
49
  export { default as SupportTextIcon, type SupportTextIconProps } from './SupportText/SupportTextIcon';
50
+ export { default as RadioButton, type RadioButtonProps } from './RadioButton/RadioButton';
50
51
 
@@ -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-02-06T15:39:03.973Z
7
+ * Generated: 2026-02-10T13:33:16.682Z
8
8
  */
9
9
 
10
10
  // Icon name to SVG data mapping