jfs-components 0.0.3 → 0.0.4

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 (100) hide show
  1. package/lib/commonjs/components/Accordion/Accordion.js +217 -0
  2. package/lib/commonjs/components/Accordion/Accordion.js.map +1 -0
  3. package/lib/commonjs/components/Accordion/Accordion.mdx +122 -0
  4. package/lib/commonjs/components/ActionTile/ActionTile.js +93 -0
  5. package/lib/commonjs/components/ActionTile/ActionTile.js.map +1 -0
  6. package/lib/commonjs/components/ActionTile/ActionTile.mdx +54 -0
  7. package/lib/commonjs/components/ActionTile/index.js +14 -0
  8. package/lib/commonjs/components/ActionTile/index.js.map +1 -0
  9. package/lib/commonjs/components/CtaCard/CtaCard.js +122 -0
  10. package/lib/commonjs/components/CtaCard/CtaCard.js.map +1 -0
  11. package/lib/commonjs/components/CtaCard/CtaCard.mdx +66 -0
  12. package/lib/commonjs/components/CtaCard/index.js +14 -0
  13. package/lib/commonjs/components/CtaCard/index.js.map +1 -0
  14. package/lib/commonjs/components/ThreadHero/ThreadHero.js +114 -0
  15. package/lib/commonjs/components/ThreadHero/ThreadHero.js.map +1 -0
  16. package/lib/commonjs/components/ThreadHero/ThreadHero.mdx +69 -0
  17. package/lib/commonjs/components/TransactionBubble/TransactionBubble.js +101 -0
  18. package/lib/commonjs/components/TransactionBubble/TransactionBubble.js.map +1 -0
  19. package/lib/commonjs/components/TransactionBubble/TransactionBubble.mdx +40 -0
  20. package/lib/commonjs/components/TransactionDetails/TransactionDetails.js +177 -0
  21. package/lib/commonjs/components/TransactionDetails/TransactionDetails.js.map +1 -0
  22. package/lib/commonjs/components/TransactionDetails/TransactionDetails.mdx +98 -0
  23. package/lib/commonjs/components/TransactionStatus/TransactionStatus.js +82 -0
  24. package/lib/commonjs/components/TransactionStatus/TransactionStatus.js.map +1 -0
  25. package/lib/commonjs/components/TransactionStatus/TransactionStatus.mdx +41 -0
  26. package/lib/commonjs/components/index.js +35 -0
  27. package/lib/commonjs/components/index.js.map +1 -1
  28. package/lib/commonjs/design-tokens/figma-variables-resolver.js +3 -9
  29. package/lib/commonjs/icons/registry.js +1 -1
  30. package/lib/module/components/Accordion/Accordion.js +212 -0
  31. package/lib/module/components/Accordion/Accordion.js.map +1 -0
  32. package/lib/module/components/Accordion/Accordion.mdx +122 -0
  33. package/lib/module/components/ActionTile/ActionTile.js +88 -0
  34. package/lib/module/components/ActionTile/ActionTile.js.map +1 -0
  35. package/lib/module/components/ActionTile/ActionTile.mdx +54 -0
  36. package/lib/module/components/ActionTile/index.js +4 -0
  37. package/lib/module/components/ActionTile/index.js.map +1 -0
  38. package/lib/module/components/CtaCard/CtaCard.js +117 -0
  39. package/lib/module/components/CtaCard/CtaCard.js.map +1 -0
  40. package/lib/module/components/CtaCard/CtaCard.mdx +66 -0
  41. package/lib/module/components/CtaCard/index.js +4 -0
  42. package/lib/module/components/CtaCard/index.js.map +1 -0
  43. package/lib/module/components/ThreadHero/ThreadHero.js +109 -0
  44. package/lib/module/components/ThreadHero/ThreadHero.js.map +1 -0
  45. package/lib/module/components/ThreadHero/ThreadHero.mdx +69 -0
  46. package/lib/module/components/TransactionBubble/TransactionBubble.js +96 -0
  47. package/lib/module/components/TransactionBubble/TransactionBubble.js.map +1 -0
  48. package/lib/module/components/TransactionBubble/TransactionBubble.mdx +40 -0
  49. package/lib/module/components/TransactionDetails/TransactionDetails.js +174 -0
  50. package/lib/module/components/TransactionDetails/TransactionDetails.js.map +1 -0
  51. package/lib/module/components/TransactionDetails/TransactionDetails.mdx +98 -0
  52. package/lib/module/components/TransactionStatus/TransactionStatus.js +77 -0
  53. package/lib/module/components/TransactionStatus/TransactionStatus.js.map +1 -0
  54. package/lib/module/components/TransactionStatus/TransactionStatus.mdx +41 -0
  55. package/lib/module/components/index.js +5 -0
  56. package/lib/module/components/index.js.map +1 -1
  57. package/lib/module/design-tokens/figma-variables-resolver.js +2 -2
  58. package/lib/module/design-tokens/figma-variables-resolver.js.map +2 -1
  59. package/lib/module/icons/registry.js +1 -1
  60. package/lib/typescript/components/Accordion/Accordion.d.ts +58 -0
  61. package/lib/typescript/components/Accordion/Accordion.d.ts.map +1 -0
  62. package/lib/typescript/components/ActionTile/ActionTile.d.ts +26 -0
  63. package/lib/typescript/components/ActionTile/ActionTile.d.ts.map +1 -0
  64. package/lib/typescript/components/ActionTile/index.d.ts +2 -0
  65. package/lib/typescript/components/ActionTile/index.d.ts.map +1 -0
  66. package/lib/typescript/components/CtaCard/CtaCard.d.ts +61 -0
  67. package/lib/typescript/components/CtaCard/CtaCard.d.ts.map +1 -0
  68. package/lib/typescript/components/CtaCard/index.d.ts +2 -0
  69. package/lib/typescript/components/CtaCard/index.d.ts.map +1 -0
  70. package/lib/typescript/components/ThreadHero/ThreadHero.d.ts +21 -0
  71. package/lib/typescript/components/ThreadHero/ThreadHero.d.ts.map +1 -0
  72. package/lib/typescript/components/TransactionBubble/TransactionBubble.d.ts +24 -0
  73. package/lib/typescript/components/TransactionBubble/TransactionBubble.d.ts.map +1 -0
  74. package/lib/typescript/components/TransactionDetails/TransactionDetails.d.ts +57 -0
  75. package/lib/typescript/components/TransactionDetails/TransactionDetails.d.ts.map +1 -0
  76. package/lib/typescript/components/TransactionStatus/TransactionStatus.d.ts +16 -0
  77. package/lib/typescript/components/TransactionStatus/TransactionStatus.d.ts.map +1 -0
  78. package/lib/typescript/components/index.d.ts +5 -0
  79. package/lib/typescript/components/index.d.ts.map +1 -1
  80. package/lib/typescript/icons/registry.d.ts +1 -1
  81. package/package.json +5 -2
  82. package/src/components/.token-metadata.json +161 -0
  83. package/src/components/Accordion/Accordion.mdx +122 -0
  84. package/src/components/Accordion/Accordion.tsx +279 -0
  85. package/src/components/ActionTile/ActionTile.mdx +54 -0
  86. package/src/components/ActionTile/ActionTile.tsx +100 -0
  87. package/src/components/ActionTile/index.ts +1 -0
  88. package/src/components/CtaCard/CtaCard.mdx +66 -0
  89. package/src/components/CtaCard/CtaCard.tsx +185 -0
  90. package/src/components/CtaCard/index.ts +1 -0
  91. package/src/components/ThreadHero/ThreadHero.mdx +69 -0
  92. package/src/components/ThreadHero/ThreadHero.tsx +124 -0
  93. package/src/components/TransactionBubble/TransactionBubble.mdx +40 -0
  94. package/src/components/TransactionBubble/TransactionBubble.tsx +113 -0
  95. package/src/components/TransactionDetails/TransactionDetails.mdx +98 -0
  96. package/src/components/TransactionDetails/TransactionDetails.tsx +236 -0
  97. package/src/components/TransactionStatus/TransactionStatus.mdx +41 -0
  98. package/src/components/TransactionStatus/TransactionStatus.tsx +94 -0
  99. package/src/components/index.ts +5 -0
  100. package/src/icons/registry.ts +1 -1
@@ -0,0 +1,185 @@
1
+ import React from 'react';
2
+ import { View, Text, type StyleProp, type ViewStyle, type TextStyle } from 'react-native';
3
+ import { getVariableByName } from '../../design-tokens/figma-variables-resolver';
4
+ import IconCapsule from '../IconCapsule/IconCapsule';
5
+ import Button from '../Button/Button';
6
+
7
+ type CtaCardProps = {
8
+ /**
9
+ * Title text for the card
10
+ */
11
+ title?: string;
12
+ /**
13
+ * Body text for the card
14
+ */
15
+ body?: string;
16
+ /**
17
+ * Name of the icon to display in the IconCapsule (if iconSlot is not provided)
18
+ */
19
+ iconName?: string;
20
+ /**
21
+ * Label for the button (if buttonSlot is not provided)
22
+ */
23
+ buttonLabel?: string;
24
+ /**
25
+ * Callback for the button press (if buttonSlot is not provided)
26
+ */
27
+ onPressButton?: () => void;
28
+ /**
29
+ * Modes object for design token resolution
30
+ */
31
+ modes?: Record<string, any>;
32
+ /**
33
+ * Optional custom slot for the icon area.
34
+ * If provided, overrides the default IconCapsule.
35
+ * `modes` will be automatically passed to this slot if it's a valid React element.
36
+ */
37
+ iconSlot?: React.ReactNode;
38
+ /**
39
+ * Optional custom slot for the title area.
40
+ * If provided, overrides the default title Text.
41
+ * `modes` will be automatically passed to this slot if it's a valid React element.
42
+ */
43
+ titleSlot?: React.ReactNode;
44
+ /**
45
+ * Optional custom slot for the body area.
46
+ * If provided, overrides the default body Text.
47
+ * `modes` will be automatically passed to this slot if it's a valid React element.
48
+ */
49
+ bodySlot?: React.ReactNode;
50
+ /**
51
+ * Optional custom slot for the button area.
52
+ * If provided, overrides the default Button.
53
+ * `modes` will be automatically passed to this slot if it's a valid React element.
54
+ */
55
+ buttonSlot?: React.ReactNode;
56
+
57
+ style?: StyleProp<ViewStyle>;
58
+ };
59
+
60
+ /**
61
+ * CtaCard component that maps directly to the Figma design using design tokens.
62
+ *
63
+ * @component
64
+ */
65
+ function CtaCard({
66
+ title = "Lets create your UPI ID",
67
+ body = "Send and receive money securely.",
68
+ iconName = "ic_upi_number",
69
+ buttonLabel = "Get started",
70
+ onPressButton,
71
+ modes = {},
72
+ iconSlot,
73
+ titleSlot,
74
+ bodySlot,
75
+ buttonSlot,
76
+ style,
77
+ }: CtaCardProps) {
78
+ // --- Token Resolution ---
79
+ // Container
80
+ const backgroundColor = getVariableByName('ctaCard/background', modes) || '#0078ad';
81
+ const radius = getVariableByName('ctaCard/radius', modes) || 16;
82
+ const paddingHorizontal = getVariableByName('ctaCard/padding/horizontal', modes) || 20;
83
+ const paddingVertical = getVariableByName('ctaCard/padding/vertical', modes) || 23;
84
+ const gap = getVariableByName('ctaCard/gap', modes) || 16;
85
+
86
+ // Content Wrap
87
+ const contentGap = getVariableByName('ctaCard/content/gap', modes) || 8;
88
+
89
+ // Title Text
90
+ const titleColor = getVariableByName('ctaCard/title/color', modes) || '#ffffff';
91
+ const titleFontFamily = getVariableByName('ctaCard/title/fontFamily', modes) || 'JioType Var';
92
+ const titleFontSize = getVariableByName('ctaCard/title/fontSize', modes) || 23;
93
+ const titleLineHeight = getVariableByName('ctaCard/title/lineHeight', modes) || 23;
94
+
95
+ // Body Text
96
+ const bodyColor = getVariableByName('ctaCard/body/color', modes) || '#ffffff';
97
+ const bodyFontFamily = getVariableByName('ctaCard/body/fontFamily', modes) || 'JioType Var';
98
+ const bodyFontSize = getVariableByName('ctaCard/body/fontSize', modes) || 14;
99
+ const bodyLineHeight = getVariableByName('ctaCard/body/lineHeight', modes) || 17;
100
+
101
+ // --- Styles ---
102
+ const containerStyle: ViewStyle = {
103
+ backgroundColor,
104
+ borderRadius: radius,
105
+ paddingHorizontal,
106
+ paddingVertical,
107
+ gap,
108
+ alignItems: 'flex-start',
109
+ width: '100%', // Adjust based on layout needs, usually cards take full width available
110
+ overflow: 'hidden',
111
+ };
112
+
113
+ const contentWrapStyle: ViewStyle = {
114
+ gap: contentGap,
115
+ alignItems: 'flex-start',
116
+ width: '100%',
117
+ };
118
+
119
+ const titleStyle: TextStyle = {
120
+ color: titleColor,
121
+ fontFamily: titleFontFamily,
122
+ fontSize: titleFontSize,
123
+ lineHeight: titleLineHeight,
124
+ fontWeight: '900', // "Black" in Figma often maps to 900
125
+ };
126
+
127
+ const bodyStyle: TextStyle = {
128
+ color: bodyColor,
129
+ fontFamily: bodyFontFamily,
130
+ fontSize: bodyFontSize,
131
+ lineHeight: bodyLineHeight,
132
+ fontWeight: '400', // Regular
133
+ };
134
+
135
+ // --- Slot Helper ---
136
+ // Helper to clone element with modes if no modes are already present on it (standard in this library)
137
+ const renderSlot = (slot: React.ReactNode) => {
138
+ if (React.isValidElement(slot)) {
139
+ return React.cloneElement(slot as React.ReactElement<any>, {
140
+ modes: { ...modes, ...(slot as any).props.modes },
141
+ });
142
+ }
143
+ return slot;
144
+ };
145
+
146
+ return (
147
+ <View style={[containerStyle, style]}>
148
+ <View style={contentWrapStyle}>
149
+ {/* Icon Slot */}
150
+ {iconSlot ? (
151
+ renderSlot(iconSlot)
152
+ ) : (
153
+ <IconCapsule iconName={iconName} modes={modes} />
154
+ )}
155
+
156
+ {/* Title Slot */}
157
+ {titleSlot ? (
158
+ renderSlot(titleSlot)
159
+ ) : (
160
+ <Text style={titleStyle}>{title}</Text>
161
+ )}
162
+
163
+ {/* Body Slot */}
164
+ {bodySlot ? (
165
+ renderSlot(bodySlot)
166
+ ) : (
167
+ <Text style={bodyStyle}>{body}</Text>
168
+ )}
169
+ </View>
170
+
171
+ {/* Button Slot - placed outside content wrap based on Figma structure (flex-col gap=16) */}
172
+ {buttonSlot ? (
173
+ renderSlot(buttonSlot)
174
+ ) : (
175
+ <Button
176
+ label={buttonLabel}
177
+ onPress={onPressButton}
178
+ modes={modes}
179
+ />
180
+ )}
181
+ </View>
182
+ );
183
+ }
184
+
185
+ export default CtaCard;
@@ -0,0 +1 @@
1
+ export { default } from './CtaCard';
@@ -0,0 +1,69 @@
1
+ import { Meta, Story, Canvas, PureArgsTable as ArgsTable } from '@storybook/addon-docs/blocks';
2
+ import * as ThreadHeroStories from './ThreadHero.stories';
3
+ import ThreadHero from './ThreadHero';
4
+
5
+ <Meta of={ThreadHeroStories} />
6
+
7
+ # ThreadHero
8
+
9
+ The `ThreadHero` component displays a central user identity with an avatar, title, subtitle, and an optional caption.
10
+
11
+
12
+ ## Available Collections and Modes
13
+
14
+ This component does not use any design token collections with multiple modes.
15
+ ## Usage
16
+
17
+ ```tsx
18
+ import ThreadHero from './ThreadHero';
19
+ import Avatar from '../Avatar/Avatar';
20
+
21
+ <ThreadHero
22
+ title="Subhash Rajan"
23
+ subtitle="Banking name: SHIVASHANKAR RAJAN"
24
+ caption="+91 00000 00000"
25
+ renderAvatar={<Avatar size="small" initials="SR" />}
26
+ />
27
+ ```
28
+
29
+ ## Props
30
+
31
+ <ArgsTable of={ThreadHero} />
32
+
33
+ ## Stories
34
+
35
+ ### Default
36
+
37
+ <Canvas>
38
+ <Story of={ThreadHeroStories.Default} />
39
+ </Canvas>
40
+
41
+ ### Without Caption
42
+
43
+ <Canvas>
44
+ <Story of={ThreadHeroStories.WithoutCaption} />
45
+ </Canvas>
46
+
47
+ ## Design Tokens
48
+
49
+ This component uses the following design tokens, resolved through `getVariableByName`:
50
+
51
+ - **`threadHero/caption/color`**
52
+ - **`threadHero/caption/fontFamily`**
53
+ - **`threadHero/caption/fontSize`**
54
+ - **`threadHero/caption/fontWeight`**
55
+ - **`threadHero/caption/lineHeight`**
56
+ - **`threadHero/details/gap`**
57
+ - **`threadHero/gap`**
58
+ - **`threadHero/subtitle/color`**
59
+ - **`threadHero/subtitle/fontFamily`**
60
+ - **`threadHero/subtitle/fontSize`**
61
+ - **`threadHero/subtitle/fontWeight`**
62
+ - **`threadHero/subtitle/lineHeight`**
63
+ - **`threadHero/title/color`**
64
+ - **`threadHero/title/fontFamily`**
65
+ - **`threadHero/title/fontSize`**
66
+ - **`threadHero/title/fontWeight`**
67
+ - **`threadHero/title/lineHeight`**
68
+
69
+ All tokens support mode-based theming through the `modes` prop.
@@ -0,0 +1,124 @@
1
+ import React, { isValidElement, cloneElement, type ReactNode } from 'react'
2
+ import { View, Text, type ViewStyle, type TextStyle } from 'react-native'
3
+ import { getVariableByName } from '../../design-tokens/figma-variables-resolver'
4
+
5
+ export type ThreadHeroProps = {
6
+ /** Title text, e.g. "Subhash Rajan" */
7
+ title?: string
8
+ /** Subtitle text, e.g. "Banking name: SHIVASHANKAR RAJAN" */
9
+ subtitle?: string
10
+ /** Optional caption text below the details, e.g. "+91 00000 00000" */
11
+ caption?: string
12
+ /** Slot for Avatar component */
13
+ renderAvatar?: ReactNode
14
+ /** Modes for design token resolution */
15
+ modes?: Record<string, any>
16
+ /** Optional container style */
17
+ style?: ViewStyle
18
+ }
19
+
20
+ /**
21
+ * ThreadHero component displaying a central identity with avatar, title, subtitle, and caption.
22
+ */
23
+ export default function ThreadHero({
24
+ title = 'Subhash Rajan',
25
+ subtitle = 'Banking name: SHIVASHANKAR RAJAN',
26
+ caption,
27
+ renderAvatar,
28
+ modes = {},
29
+ style,
30
+ }: ThreadHeroProps) {
31
+ // Container Gaps
32
+ const containerGap = Number(getVariableByName('threadHero/gap', modes)) || 8
33
+ const detailsGap = Number(getVariableByName('threadHero/details/gap', modes)) || 2
34
+
35
+ // Title Styles
36
+ const titleColor = getVariableByName('threadHero/title/color', modes) || '#191b1e'
37
+ const titleFontSize = Number(getVariableByName('threadHero/title/fontSize', modes)) || 16
38
+ const titleFontFamily = getVariableByName('threadHero/title/fontFamily', modes) || 'System'
39
+ const titleLineHeight = Number(getVariableByName('threadHero/title/lineHeight', modes)) || 20
40
+ const titleFontWeight = getVariableByName('threadHero/title/fontWeight', modes) || '600'
41
+
42
+ // Subtitle Styles
43
+ const subtitleColor = getVariableByName('threadHero/subtitle/color', modes) || '#5d5d61'
44
+ const subtitleFontSize = Number(getVariableByName('threadHero/subtitle/fontSize', modes)) || 12
45
+ const subtitleFontFamily = getVariableByName('threadHero/subtitle/fontFamily', modes) || 'System'
46
+ const subtitleLineHeight = Number(getVariableByName('threadHero/subtitle/lineHeight', modes)) || 18
47
+ const subtitleFontWeight = getVariableByName('threadHero/subtitle/fontWeight', modes) || '500'
48
+
49
+ // Caption Styles
50
+ const captionColor = getVariableByName('threadHero/caption/color', modes) || '#5d5d61'
51
+ const captionFontSize = Number(getVariableByName('threadHero/caption/fontSize', modes)) || 12
52
+ const captionFontFamily = getVariableByName('threadHero/caption/fontFamily', modes) || 'System'
53
+ const captionLineHeight = Number(getVariableByName('threadHero/caption/lineHeight', modes)) || 18
54
+ const captionFontWeight = getVariableByName('threadHero/caption/fontWeight', modes) || '500'
55
+
56
+ // Styles
57
+ const containerStyle: ViewStyle = {
58
+ flexDirection: 'column',
59
+ alignItems: 'center',
60
+ gap: containerGap,
61
+ ...style,
62
+ }
63
+
64
+ const detailsStyle: ViewStyle = {
65
+ flexDirection: 'column',
66
+ alignItems: 'center',
67
+ gap: detailsGap,
68
+ width: '100%',
69
+ }
70
+
71
+ const titleStyle: TextStyle = {
72
+ color: titleColor,
73
+ fontSize: titleFontSize,
74
+ fontFamily: titleFontFamily,
75
+ lineHeight: titleLineHeight,
76
+ fontWeight: titleFontWeight as any,
77
+ textAlign: 'center',
78
+ minWidth: '100%',
79
+ }
80
+
81
+ const subtitleStyle: TextStyle = {
82
+ color: subtitleColor,
83
+ fontSize: subtitleFontSize,
84
+ fontFamily: subtitleFontFamily,
85
+ lineHeight: subtitleLineHeight,
86
+ fontWeight: subtitleFontWeight as any,
87
+ textAlign: 'center',
88
+ minWidth: '100%',
89
+ }
90
+
91
+ const captionStyle: TextStyle = {
92
+ color: captionColor,
93
+ fontSize: captionFontSize,
94
+ fontFamily: captionFontFamily,
95
+ lineHeight: captionLineHeight,
96
+ fontWeight: captionFontWeight as any,
97
+ textAlign: 'center',
98
+ width: '100%',
99
+ }
100
+
101
+ // Process Avatar Slot to inject modes
102
+ const avatarContent = isValidElement(renderAvatar)
103
+ ? cloneElement(renderAvatar as React.ReactElement<any>, { modes })
104
+ : renderAvatar
105
+
106
+ return (
107
+ <View style={containerStyle}>
108
+ <View style={detailsStyle}>
109
+ {avatarContent}
110
+ {title ? <Text style={titleStyle}>{title}</Text> : null}
111
+ {subtitle ? (
112
+ <Text style={subtitleStyle} numberOfLines={1} ellipsizeMode="tail">
113
+ {subtitle}
114
+ </Text>
115
+ ) : null}
116
+ </View>
117
+ {caption ? (
118
+ <Text style={captionStyle} numberOfLines={1} ellipsizeMode="tail">
119
+ {caption}
120
+ </Text>
121
+ ) : null}
122
+ </View>
123
+ )
124
+ }
@@ -0,0 +1,40 @@
1
+ import { Meta, Story, Canvas, PureArgsTable as ArgsTable } from '@storybook/addon-docs/blocks';
2
+ import * as TransactionBubbleStories from './TransactionBubble.stories';
3
+ import TransactionBubble from './TransactionBubble';
4
+
5
+ <Meta of={TransactionBubbleStories} />
6
+
7
+ # TransactionBubble
8
+
9
+ TransactionBubble component with design-token-driven styling.
10
+
11
+ ## Available Collections and Modes
12
+
13
+ This component does not use any design token collections with multiple modes.
14
+ ## Usage
15
+
16
+ <Canvas>
17
+ <Story of={TransactionBubbleStories.Default} />
18
+ </Canvas>
19
+
20
+ ## Props
21
+
22
+ <ArgsTable of={TransactionBubble} />
23
+
24
+ ## Design Tokens
25
+
26
+ This component uses the following design tokens, resolved through `getVariableByName`:
27
+
28
+ - **`transactionBubble/background`**
29
+ - **`transactionBubble/border/color`**
30
+ - **`transactionBubble/border/size`**
31
+ - **`transactionBubble/description/color`**
32
+ - **`transactionBubble/description/fontFamily`**
33
+ - **`transactionBubble/description/fontSize`**
34
+ - **`transactionBubble/description/lineHeight`**
35
+ - **`transactionBubble/gap`**
36
+ - **`transactionBubble/padding`**
37
+ - **`transactionBubble/radius`**
38
+ - **`transactionBubble/statusWrap/height`**
39
+
40
+ All tokens support mode-based theming through the `modes` prop.
@@ -0,0 +1,113 @@
1
+ import React from 'react'
2
+ import { View, Text, type ViewStyle, type TextStyle } from 'react-native'
3
+ import { getVariableByName } from '../../design-tokens/figma-variables-resolver'
4
+ import MoneyValue from '../MoneyValue/MoneyValue'
5
+ import NavArrow from '../NavArrow/NavArrow'
6
+ import TransactionStatus from '../TransactionStatus/TransactionStatus'
7
+
8
+ export type TransactionBubbleProps = {
9
+ /** Description text, e.g. "Payment to Uber India" */
10
+ description?: string
11
+ /** Money amount */
12
+ amount?: string | number
13
+ /** Currency code or symbol */
14
+ currency?: string
15
+ /** Transaction status text, e.g. "Expired" */
16
+ status?: string
17
+ /** Date/time string associated with status */
18
+ statusDate?: string
19
+ /** Modes for design token resolution */
20
+ modes?: Record<string, any>
21
+ /** Optional container style */
22
+ style?: ViewStyle
23
+ }
24
+
25
+ /**
26
+ * TransactionBubble component displaying transaction details in a bubble card.
27
+ *
28
+ * @component
29
+ */
30
+ export default function TransactionBubble({
31
+ description = 'Payment to Uber India',
32
+ amount = '56',
33
+ currency = '₹',
34
+ status = 'Expired',
35
+ statusDate = '20 Mar 2025',
36
+ modes = {},
37
+ style,
38
+ }: TransactionBubbleProps) {
39
+ // --- Container Tokens ---
40
+ const backgroundColor = getVariableByName('transactionBubble/background', modes) || '#ffffff'
41
+ const borderColor = getVariableByName('transactionBubble/border/color', modes) || '#e5e5e5'
42
+ const borderWidth = Number(getVariableByName('transactionBubble/border/size', modes)) || 1
43
+ const borderRadius = Number(getVariableByName('transactionBubble/radius', modes)) || 23
44
+ const padding = Number(getVariableByName('transactionBubble/padding', modes)) || 16
45
+ const gap = Number(getVariableByName('transactionBubble/gap', modes)) || 8
46
+
47
+ // --- Description Tokens ---
48
+ const descColor = getVariableByName('transactionBubble/description/color', modes) || '#24262b'
49
+ const descFontSize = Number(getVariableByName('transactionBubble/description/fontSize', modes)) || 14
50
+ const descLineHeight = Number(getVariableByName('transactionBubble/description/lineHeight', modes)) || 17
51
+ const descFontFamily = getVariableByName('transactionBubble/description/fontFamily', modes) || 'System'
52
+
53
+ // --- Status Row Tokens ---
54
+ // Status wrapping gap from TransactionBubble definition for the row container
55
+ const statusHeight = Number(getVariableByName('transactionBubble/statusWrap/height', modes)) || 18
56
+
57
+ const containerStyle: ViewStyle = {
58
+ backgroundColor,
59
+ borderColor,
60
+ borderWidth,
61
+ borderRadius,
62
+ padding,
63
+ gap,
64
+ alignItems: 'flex-start',
65
+ width: 231, // Fixed width from design or prop? Design shows w-[231px]. We can make it auto or fixed. Let's respect style prop.
66
+ ...style,
67
+ }
68
+
69
+ const descriptionStyle: TextStyle = {
70
+ color: descColor,
71
+ fontSize: descFontSize,
72
+ lineHeight: descLineHeight,
73
+ fontFamily: descFontFamily,
74
+ fontWeight: '500', // Hardcoded in design as 'Medium' -> 500
75
+ }
76
+
77
+ return (
78
+ <View style={containerStyle}>
79
+ {/* Description & Money Wrapper (Vertical) */}
80
+ <View style={{ gap: 8, width: '100%' }}>
81
+ <Text style={descriptionStyle} numberOfLines={1} ellipsizeMode='tail'>
82
+ {description}
83
+ </Text>
84
+
85
+ <MoneyValue
86
+ value={amount}
87
+ currency={currency}
88
+ modes={modes}
89
+ />
90
+ </View>
91
+
92
+ {/* Status Row */}
93
+ <View style={{
94
+ flexDirection: 'row',
95
+ alignItems: 'center',
96
+ justifyContent: 'space-between',
97
+ width: '100%',
98
+ height: statusHeight, // Enforce height from design
99
+ }}>
100
+ <TransactionStatus
101
+ status={status}
102
+ date={statusDate}
103
+ modes={modes}
104
+ />
105
+
106
+ <NavArrow
107
+ direction="Forward"
108
+ modes={modes}
109
+ />
110
+ </View>
111
+ </View>
112
+ )
113
+ }
@@ -0,0 +1,98 @@
1
+ import { Meta, Story, Canvas, PureArgsTable as ArgsTable } from '@storybook/addon-docs/blocks';
2
+ import * as TransactionDetailsStories from './TransactionDetails.stories';
3
+ import TransactionDetails from './TransactionDetails';
4
+ import { AccessibilitySection, AnatomySection, UsageConstraintsSection } from '../docs/DocSections';
5
+
6
+ <Meta of={TransactionDetailsStories} />
7
+
8
+ # TransactionDetails
9
+
10
+ TransactionDetails is a container component that displays a list of transaction detail items, each showing a label-value pair. It uses design tokens from Figma for consistent styling.
11
+
12
+ ## Available Collections and Modes
13
+
14
+ This component does not use any design token collections with multiple modes.
15
+ ## Usage
16
+
17
+ <Canvas>
18
+ <Story of={TransactionDetailsStories.Default} />
19
+ </Canvas>
20
+
21
+ ## Usage Example
22
+
23
+ ```tsx
24
+ import TransactionDetails from 'jfs-components';
25
+
26
+ function PaymentConfirmation() {
27
+ return (
28
+ <TransactionDetails>
29
+ <TransactionDetails.Item label="UPI transaction ID" value="101674916166" />
30
+ <TransactionDetails.Item label="From: 5678 XXXX XXXX 1234" value="JioFinance • shivashankar@okjio" />
31
+ <TransactionDetails.Item label="To: SHIVASHANKAR RAJAN" value="JioFinance • shivashankar@okjio" />
32
+ <TransactionDetails.Item label="Payment method" value="UPI" />
33
+ </TransactionDetails>
34
+ );
35
+ }
36
+ ```
37
+
38
+ ## Single Item
39
+
40
+ <Canvas>
41
+ <Story of={TransactionDetailsStories.SingleItem} />
42
+ </Canvas>
43
+
44
+ <AccessibilitySection
45
+ items={[
46
+ 'TransactionDetails has role "summary" for screen readers to announce it as a summary section.',
47
+ 'Each DetailItem has role "text" with a combined label and value for clear reading.',
48
+ 'Use descriptive labels that clearly indicate what the value represents.',
49
+ 'Ensure sufficient color contrast between label and value text.',
50
+ ]}
51
+ />
52
+
53
+ <AnatomySection>
54
+ <ul>
55
+ <li><strong>TransactionDetails (Container)</strong> — Wraps all Item children with consistent gap and padding.</li>
56
+ <li><strong>TransactionDetails.Item</strong> — Individual label-value pair component.</li>
57
+ <li><strong>Label</strong> — Descriptive text above the value, using token typography.</li>
58
+ <li><strong>Value</strong> — The actual data/content text, using token typography.</li>
59
+ </ul>
60
+ </AnatomySection>
61
+
62
+ <UsageConstraintsSection
63
+ items={[
64
+ 'Always use TransactionDetails.Item as direct children of TransactionDetails for proper mode propagation.',
65
+ 'Keep label text concise and descriptive.',
66
+ 'Values can be longer but consider text wrapping on smaller screens.',
67
+ 'Use consistent date/time and number formatting across all detail items.',
68
+ ]}
69
+ />
70
+
71
+ ## TransactionDetails Props
72
+
73
+ <ArgsTable of={TransactionDetails} />
74
+
75
+ ## TransactionDetails.Item Props
76
+
77
+ <ArgsTable of={TransactionDetails.Item} />
78
+
79
+ ## Design Tokens
80
+
81
+ This component uses the following design tokens, resolved through `getVariableByName`:
82
+
83
+ - **`detailItem/gap`**
84
+ - **`detailItem/label/color`**
85
+ - **`detailItem/label/fontFamily`**
86
+ - **`detailItem/label/fontSize`**
87
+ - **`detailItem/label/fontWeight`**
88
+ - **`detailItem/label/lineHeight`**
89
+ - **`detailItem/value/color`**
90
+ - **`detailItem/value/fontFamily`**
91
+ - **`detailItem/value/fontSize`**
92
+ - **`detailItem/value/fontWeight`**
93
+ - **`detailItem/value/lineHeight`**
94
+ - **`transationDetails/gap`**
95
+ - **`transationDetails/padding/horizontal`**
96
+ - **`transationDetails/padding/vertical`**
97
+
98
+ All tokens support mode-based theming through the `modes` prop.