jfs-components 0.0.43 → 0.0.45

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 (106) hide show
  1. package/lib/commonjs/components/AmountInput/AmountInput.js +82 -0
  2. package/lib/commonjs/components/AmountInput/index.js +13 -0
  3. package/lib/commonjs/components/Button/Button.js +45 -28
  4. package/lib/commonjs/components/CardProviderInfo/CardProviderInfo.js +76 -0
  5. package/lib/commonjs/components/Checkbox/Checkbox.js +208 -0
  6. package/lib/commonjs/components/EmptyState/EmptyState.js +2 -1
  7. package/lib/commonjs/components/MoneyValue/MoneyValue.js +81 -49
  8. package/lib/commonjs/components/NoteInput/NoteInput.js +120 -0
  9. package/lib/commonjs/components/NoteInput/index.js +13 -0
  10. package/lib/commonjs/components/Numpad/Numpad.js +108 -0
  11. package/lib/commonjs/components/OTP/OTP.js +242 -0
  12. package/lib/commonjs/components/PortfolioHero/PortfolioHero.js +78 -0
  13. package/lib/commonjs/components/ProductLabel/ProductLabel.js +50 -0
  14. package/lib/commonjs/components/ProgressBadge/ProgressBadge.js +130 -0
  15. package/lib/commonjs/components/ProgressBadge/index.js +25 -0
  16. package/lib/commonjs/components/StatItem/StatItem.js +61 -0
  17. package/lib/commonjs/components/StatusHero/StatusHero.js +148 -0
  18. package/lib/commonjs/components/SwappableAmount/SwappableAmount.js +71 -0
  19. package/lib/commonjs/components/Tabs/TabItem.js +79 -0
  20. package/lib/commonjs/components/Tabs/Tabs.js +88 -0
  21. package/lib/commonjs/components/Text/Text.js +38 -0
  22. package/lib/commonjs/components/Toggle/Toggle.js +102 -0
  23. package/lib/commonjs/components/index.js +105 -0
  24. package/lib/commonjs/design-tokens/Coin Variables-variables-full.json +1 -0
  25. package/lib/commonjs/design-tokens/figma-variables-resolver.js +1 -1
  26. package/lib/commonjs/icons/registry.js +1 -1
  27. package/lib/module/components/AmountInput/AmountInput.js +77 -0
  28. package/lib/module/components/AmountInput/index.js +3 -0
  29. package/lib/module/components/Button/Button.js +44 -28
  30. package/lib/module/components/CardProviderInfo/CardProviderInfo.js +71 -0
  31. package/lib/module/components/Checkbox/Checkbox.js +205 -0
  32. package/lib/module/components/EmptyState/EmptyState.js +2 -1
  33. package/lib/module/components/MoneyValue/MoneyValue.js +81 -49
  34. package/lib/module/components/NoteInput/NoteInput.js +115 -0
  35. package/lib/module/components/NoteInput/index.js +3 -0
  36. package/lib/module/components/Numpad/Numpad.js +103 -0
  37. package/lib/module/components/OTP/OTP.js +236 -0
  38. package/lib/module/components/PortfolioHero/PortfolioHero.js +73 -0
  39. package/lib/module/components/ProductLabel/ProductLabel.js +45 -0
  40. package/lib/module/components/ProgressBadge/ProgressBadge.js +125 -0
  41. package/lib/module/components/ProgressBadge/index.js +4 -0
  42. package/lib/module/components/StatItem/StatItem.js +56 -0
  43. package/lib/module/components/StatusHero/StatusHero.js +142 -0
  44. package/lib/module/components/SwappableAmount/SwappableAmount.js +66 -0
  45. package/lib/module/components/Tabs/TabItem.js +74 -0
  46. package/lib/module/components/Tabs/Tabs.js +78 -0
  47. package/lib/module/components/Text/Text.js +33 -0
  48. package/lib/module/components/Toggle/Toggle.js +97 -0
  49. package/lib/module/components/index.js +16 -1
  50. package/lib/module/design-tokens/Coin Variables-variables-full.json +1 -0
  51. package/lib/module/design-tokens/figma-variables-resolver.js +1 -1
  52. package/lib/module/icons/registry.js +1 -1
  53. package/lib/typescript/src/components/AmountInput/AmountInput.d.ts +23 -0
  54. package/lib/typescript/src/components/AmountInput/index.d.ts +3 -0
  55. package/lib/typescript/src/components/Button/Button.d.ts +6 -1
  56. package/lib/typescript/src/components/CardProviderInfo/CardProviderInfo.d.ts +24 -0
  57. package/lib/typescript/src/components/Checkbox/Checkbox.d.ts +30 -0
  58. package/lib/typescript/src/components/EmptyState/EmptyState.d.ts +6 -1
  59. package/lib/typescript/src/components/MoneyValue/MoneyValue.d.ts +18 -26
  60. package/lib/typescript/src/components/NoteInput/NoteInput.d.ts +23 -0
  61. package/lib/typescript/src/components/NoteInput/index.d.ts +3 -0
  62. package/lib/typescript/src/components/Numpad/Numpad.d.ts +35 -0
  63. package/lib/typescript/src/components/OTP/OTP.d.ts +36 -0
  64. package/lib/typescript/src/components/PortfolioHero/PortfolioHero.d.ts +21 -0
  65. package/lib/typescript/src/components/ProductLabel/ProductLabel.d.ts +14 -0
  66. package/lib/typescript/src/components/ProgressBadge/ProgressBadge.d.ts +36 -0
  67. package/lib/typescript/src/components/ProgressBadge/index.d.ts +3 -0
  68. package/lib/typescript/src/components/StatItem/StatItem.d.ts +21 -0
  69. package/lib/typescript/src/components/StatusHero/StatusHero.d.ts +47 -0
  70. package/lib/typescript/src/components/SwappableAmount/SwappableAmount.d.ts +22 -0
  71. package/lib/typescript/src/components/Tabs/TabItem.d.ts +29 -0
  72. package/lib/typescript/src/components/Tabs/Tabs.d.ts +44 -0
  73. package/lib/typescript/src/components/Text/Text.d.ts +14 -0
  74. package/lib/typescript/src/components/Toggle/Toggle.d.ts +29 -0
  75. package/lib/typescript/src/components/index.d.ts +15 -0
  76. package/lib/typescript/src/icons/registry.d.ts +1 -1
  77. package/package.json +1 -1
  78. package/src/components/AmountInput/AmountInput.tsx +81 -0
  79. package/src/components/AmountInput/index.ts +2 -0
  80. package/src/components/Button/Button.tsx +40 -20
  81. package/src/components/CardProviderInfo/CardProviderInfo.tsx +81 -0
  82. package/src/components/Checkbox/Checkbox.tsx +238 -0
  83. package/src/components/EmptyState/EmptyState.tsx +7 -1
  84. package/src/components/MoneyValue/MoneyValue.tsx +134 -79
  85. package/src/components/NoteInput/NoteInput.tsx +146 -0
  86. package/src/components/NoteInput/index.ts +2 -0
  87. package/src/components/Numpad/Numpad.tsx +162 -0
  88. package/src/components/OTP/OTP.tsx +275 -0
  89. package/src/components/PortfolioHero/PortfolioHero.tsx +91 -0
  90. package/src/components/ProductLabel/ProductLabel.tsx +58 -0
  91. package/src/components/ProgressBadge/ProgressBadge.tsx +172 -0
  92. package/src/components/ProgressBadge/index.ts +2 -0
  93. package/src/components/StatItem/StatItem.tsx +71 -0
  94. package/src/components/StatusHero/StatusHero.tsx +156 -0
  95. package/src/components/SwappableAmount/SwappableAmount.tsx +92 -0
  96. package/src/components/Tabs/TabItem.tsx +96 -0
  97. package/src/components/Tabs/Tabs.tsx +105 -0
  98. package/src/components/Text/Text.tsx +48 -0
  99. package/src/components/Toggle/Toggle.tsx +122 -0
  100. package/src/components/index.ts +15 -0
  101. package/src/design-tokens/Coin Variables-variables-full.json +1 -0
  102. package/src/design-tokens/figma-variables-resolver.ts +1 -1
  103. package/src/icons/registry.ts +1 -1
  104. package/lib/commonjs/design-tokens/JFS Variables-variables-full.json +0 -1
  105. package/lib/module/design-tokens/JFS Variables-variables-full.json +0 -1
  106. package/src/design-tokens/JFS Variables-variables-full.json +0 -1
@@ -0,0 +1,242 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _reactNative = require("react-native");
9
+ var _figmaVariablesResolver = require("../../design-tokens/figma-variables-resolver");
10
+ var _JFSThemeProvider = require("../../design-tokens/JFSThemeProvider");
11
+ var _SupportText = _interopRequireDefault(require("../SupportText/SupportText"));
12
+ var _reactUtils = require("../../utils/react-utils");
13
+ var _jsxRuntime = require("react/jsx-runtime");
14
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
16
+ const DIGITS_ONLY = /^\d*$/;
17
+ function OTP({
18
+ length = 6,
19
+ value: controlledValue,
20
+ defaultValue = '',
21
+ onChange,
22
+ onValueChange,
23
+ onComplete,
24
+ isDisabled = false,
25
+ isInvalid = false,
26
+ allowedPattern = DIGITS_ONLY,
27
+ autoFocus = false,
28
+ modes: propModes = {},
29
+ style,
30
+ supportText,
31
+ supportTextStatus
32
+ }) {
33
+ const {
34
+ modes: globalModes
35
+ } = (0, _JFSThemeProvider.useTokens)();
36
+ const modes = {
37
+ ...globalModes,
38
+ ...propModes
39
+ };
40
+ const isControlled = controlledValue !== undefined;
41
+ const [internalValue, setInternalValue] = (0, _react.useState)(defaultValue);
42
+ const currentValue = isControlled ? controlledValue : internalValue;
43
+ const inputRef = (0, _react.useRef)(null);
44
+ const [isFocused, setIsFocused] = (0, _react.useState)(false);
45
+ const caretAnim = (0, _react.useRef)(new _reactNative.Animated.Value(1)).current;
46
+ (0, _react.useEffect)(() => {
47
+ if (!isFocused) return;
48
+ const blink = _reactNative.Animated.loop(_reactNative.Animated.sequence([_reactNative.Animated.timing(caretAnim, {
49
+ toValue: 0,
50
+ duration: 400,
51
+ useNativeDriver: true
52
+ }), _reactNative.Animated.timing(caretAnim, {
53
+ toValue: 1,
54
+ duration: 400,
55
+ useNativeDriver: true
56
+ })]));
57
+ blink.start();
58
+ return () => blink.stop();
59
+ }, [isFocused, caretAnim]);
60
+ const prevCompleteRef = (0, _react.useRef)(false);
61
+ const setValue = (0, _react.useCallback)(next => {
62
+ const clamped = next.slice(0, length);
63
+ if (!isControlled) setInternalValue(clamped);
64
+ onChange?.(clamped);
65
+ onValueChange?.(clamped);
66
+ if (clamped.length === length && !prevCompleteRef.current) {
67
+ prevCompleteRef.current = true;
68
+ onComplete?.(clamped);
69
+ }
70
+ if (clamped.length < length) {
71
+ prevCompleteRef.current = false;
72
+ }
73
+ }, [length, isControlled, onChange, onValueChange, onComplete]);
74
+ const handleChangeText = (0, _react.useCallback)(text => {
75
+ if (isDisabled) return;
76
+ if (!allowedPattern.test(text)) return;
77
+ setValue(text);
78
+ }, [isDisabled, allowedPattern, setValue]);
79
+ const handlePress = (0, _react.useCallback)(() => {
80
+ if (isDisabled) return;
81
+ inputRef.current?.focus();
82
+ }, [isDisabled]);
83
+
84
+ // --- Token resolution (state-independent tokens resolved once) ---
85
+ const otpGap = Number((0, _figmaVariablesResolver.getVariableByName)('otp/gap', modes)) || 36;
86
+ const otpPaddingH = Number((0, _figmaVariablesResolver.getVariableByName)('otp/padding/horizontal', modes)) || 8;
87
+ const otpPaddingV = Number((0, _figmaVariablesResolver.getVariableByName)('otp/padding/vertical', modes)) || 8;
88
+ const slotWidth = Number((0, _figmaVariablesResolver.getVariableByName)('pinSlot/width', modes)) || 48;
89
+ const slotGap = Number((0, _figmaVariablesResolver.getVariableByName)('pinSlot/gap', modes)) || 8;
90
+ // digit/color has no state variants in Figma — resolved once from the Output collection
91
+ const digitColor = (0, _figmaVariablesResolver.getVariableByName)('pinSlot/digit/color', modes) || '#000000';
92
+ const digitFontSize = Number((0, _figmaVariablesResolver.getVariableByName)('pinSlot/digit/fontSize', modes)) || 24;
93
+ const digitFontFamily = (0, _figmaVariablesResolver.getVariableByName)('pinSlot/digit/fontFamily', modes) || 'JioType Var';
94
+ const digitLineHeight = Number((0, _figmaVariablesResolver.getVariableByName)('pinSlot/digit/lineHeight', modes)) || 29;
95
+ const digitFontWeight = (0, _figmaVariablesResolver.getVariableByName)('pinSlot/digit/fontWeight', modes) || '500';
96
+ const underlineHeight = Number((0, _figmaVariablesResolver.getVariableByName)('pinSlot/underline/height', modes)) || 2;
97
+ const underlineRadius = Number((0, _figmaVariablesResolver.getVariableByName)('pinSlot/underline/radius', modes)) || 1;
98
+
99
+ // --- State-driven slot modes ---
100
+ // Collection name in Figma is "Input/PINSlot States" (double space before States).
101
+ // Only PinSlot/underline/color (capital P/S) lives in this collection with Idle/Active/Error modes.
102
+ // isInvalid takes priority over active focus; the component maps semantic state → token mode
103
+ // internally so consumers never need to know the collection key name.
104
+ const getSlotModes = isActiveSlot => {
105
+ if (isInvalid) return {
106
+ ...modes,
107
+ 'Input/PINSlot States': 'Error'
108
+ };
109
+ if (isActiveSlot && isFocused) return {
110
+ ...modes,
111
+ 'Input/PINSlot States': 'Active'
112
+ };
113
+ return {
114
+ ...modes,
115
+ 'Input/PINSlot States': 'Idle'
116
+ };
117
+ };
118
+
119
+ // --- Styles ---
120
+ const containerStyle = {
121
+ flexDirection: 'column',
122
+ alignItems: 'flex-end',
123
+ gap: otpGap,
124
+ paddingHorizontal: otpPaddingH,
125
+ paddingVertical: otpPaddingV
126
+ };
127
+ const slotWrapStyle = {
128
+ flexDirection: 'row',
129
+ gap: 8,
130
+ alignItems: 'flex-start',
131
+ alignSelf: 'stretch'
132
+ };
133
+ const renderSlot = index => {
134
+ const char = currentValue[index];
135
+ const isActiveSlot = index === currentValue.length && currentValue.length < length;
136
+ const isFilled = char !== undefined;
137
+
138
+ // Underline color is the only state-sensitive token (lives in "Input/PINSlot States" collection).
139
+ // Note: token name is "PinSlot/underline/color" (capital P/S) — different from the static
140
+ // "pinSlot/underline/color" in the Output collection.
141
+ const slotModes = getSlotModes(isActiveSlot);
142
+ const underlineColor = (0, _figmaVariablesResolver.getVariableByName)('PinSlot/underline/color', slotModes) || '#303338';
143
+ const slotStyle = {
144
+ width: slotWidth,
145
+ flexDirection: 'column',
146
+ alignItems: 'center',
147
+ justifyContent: 'flex-end',
148
+ gap: slotGap
149
+ };
150
+ const digitStyle = {
151
+ fontFamily: digitFontFamily,
152
+ fontWeight: digitFontWeight,
153
+ fontSize: digitFontSize,
154
+ lineHeight: digitLineHeight,
155
+ color: digitColor,
156
+ textAlign: 'center',
157
+ minWidth: '100%'
158
+ };
159
+ const underlineStyle = {
160
+ width: slotWidth,
161
+ height: underlineHeight,
162
+ borderRadius: underlineRadius,
163
+ backgroundColor: underlineColor
164
+ };
165
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
166
+ style: slotStyle,
167
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
168
+ style: {
169
+ minHeight: digitLineHeight,
170
+ justifyContent: 'center',
171
+ alignItems: 'center',
172
+ width: '100%'
173
+ },
174
+ children: isFilled ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
175
+ style: digitStyle,
176
+ children: char
177
+ }) : isActiveSlot && isFocused ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Animated.View, {
178
+ style: {
179
+ width: 2,
180
+ height: digitFontSize,
181
+ backgroundColor: digitColor,
182
+ opacity: caretAnim
183
+ }
184
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
185
+ style: [digitStyle, {
186
+ color: 'transparent'
187
+ }],
188
+ children: '\u00A0'
189
+ })
190
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
191
+ style: underlineStyle
192
+ })]
193
+ }, index);
194
+ };
195
+ const renderSupportText = () => {
196
+ if (!supportText) return null;
197
+ if (typeof supportText === 'string') {
198
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_SupportText.default, {
199
+ label: supportText,
200
+ status: supportTextStatus ?? (isInvalid ? 'Error' : 'Neutral'),
201
+ modes: modes
202
+ });
203
+ }
204
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
205
+ children: (0, _reactUtils.cloneChildrenWithModes)(_react.default.Children.toArray(supportText), modes)
206
+ });
207
+ };
208
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Pressable, {
209
+ style: [containerStyle, isDisabled && {
210
+ opacity: 0.4
211
+ }, style],
212
+ onPress: handlePress,
213
+ disabled: isDisabled,
214
+ accessibilityRole: "none",
215
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TextInput, {
216
+ ref: inputRef,
217
+ value: currentValue,
218
+ onChangeText: handleChangeText,
219
+ maxLength: length,
220
+ keyboardType: "number-pad",
221
+ autoFocus: autoFocus,
222
+ editable: !isDisabled,
223
+ onFocus: () => setIsFocused(true),
224
+ onBlur: () => setIsFocused(false),
225
+ caretHidden: true,
226
+ style: {
227
+ position: 'absolute',
228
+ width: 1,
229
+ height: 1,
230
+ opacity: 0
231
+ },
232
+ accessibilityLabel: `OTP input, ${length} digits`,
233
+ accessibilityHint: "Enter your verification code"
234
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
235
+ style: slotWrapStyle,
236
+ children: Array.from({
237
+ length
238
+ }, (_, i) => renderSlot(i))
239
+ }), renderSupportText()]
240
+ });
241
+ }
242
+ var _default = exports.default = OTP;
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _reactNative = require("react-native");
9
+ var _figmaVariablesResolver = require("../../design-tokens/figma-variables-resolver");
10
+ var _reactUtils = require("../../utils/react-utils");
11
+ var _Avatar = _interopRequireDefault(require("../Avatar/Avatar"));
12
+ var _MoneyValue = _interopRequireDefault(require("../MoneyValue/MoneyValue"));
13
+ var _jsxRuntime = require("react/jsx-runtime");
14
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
+ function PortfolioHero({
16
+ label = 'Gold',
17
+ imageSource,
18
+ value = '12,000.11',
19
+ currency = '₹',
20
+ modes = {
21
+ Context3: 'Balance'
22
+ },
23
+ children,
24
+ style
25
+ }) {
26
+ const gap = (0, _figmaVariablesResolver.getVariableByName)('portfolioHero/gap', modes) ?? 16;
27
+ const padding = (0, _figmaVariablesResolver.getVariableByName)('portfolioHero/padding', modes) ?? 8;
28
+ const slotWrapGap = (0, _figmaVariablesResolver.getVariableByName)('portfolioHero/slotWrap/gap', modes) ?? 8;
29
+ const containerStyle = {
30
+ flexDirection: 'column',
31
+ alignItems: 'center',
32
+ justifyContent: 'center',
33
+ gap: gap,
34
+ padding: padding
35
+ };
36
+ const productLabelStyle = {
37
+ flexDirection: 'row',
38
+ alignItems: 'center',
39
+ gap: 8
40
+ };
41
+ const labelTextStyle = {
42
+ fontFamily: 'System',
43
+ fontWeight: '700',
44
+ fontSize: 16,
45
+ lineHeight: 16 * 1.3,
46
+ color: '#0d0d0f',
47
+ textAlign: 'center'
48
+ };
49
+ const slotWrapStyle = {
50
+ flexDirection: 'column',
51
+ alignItems: 'center',
52
+ gap: slotWrapGap
53
+ };
54
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
55
+ style: [containerStyle, style],
56
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
57
+ style: productLabelStyle,
58
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Avatar.default, {
59
+ style: "Image",
60
+ ...(imageSource != null && {
61
+ imageSource
62
+ }),
63
+ modes: modes
64
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
65
+ style: labelTextStyle,
66
+ children: label
67
+ })]
68
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_MoneyValue.default, {
69
+ value: value,
70
+ currency: currency,
71
+ modes: modes
72
+ }), children && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
73
+ style: slotWrapStyle,
74
+ children: (0, _reactUtils.cloneChildrenWithModes)(children, modes)
75
+ })]
76
+ });
77
+ }
78
+ var _default = exports.default = PortfolioHero;
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _reactNative = require("react-native");
9
+ var _figmaVariablesResolver = require("../../design-tokens/figma-variables-resolver");
10
+ var _Avatar = _interopRequireDefault(require("../Avatar/Avatar"));
11
+ var _jsxRuntime = require("react/jsx-runtime");
12
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
+ function ProductLabel({
14
+ label = 'Gold',
15
+ imageSource,
16
+ modes = {},
17
+ style
18
+ }) {
19
+ const gap = (0, _figmaVariablesResolver.getVariableByName)('productLabel/gap', modes) ?? 8;
20
+ const textColor = (0, _figmaVariablesResolver.getVariableByName)('productLabel/text/color', modes) ?? '#000000';
21
+ const textFontSize = (0, _figmaVariablesResolver.getVariableByName)('productLabel/text/fontSize', modes) ?? 16;
22
+ const textFontFamily = (0, _figmaVariablesResolver.getVariableByName)('productLabel/text/fontFamily', modes) ?? 'JioType Var';
23
+ const textFontWeight = (0, _figmaVariablesResolver.getVariableByName)('productLabel/text/fontWeight', modes) ?? 700;
24
+ const textLineHeight = (0, _figmaVariablesResolver.getVariableByName)('productLabel/text/lineHeight', modes) ?? 21;
25
+ const containerStyle = {
26
+ flexDirection: 'row',
27
+ alignItems: 'center',
28
+ gap: gap
29
+ };
30
+ const labelTextStyle = {
31
+ color: textColor,
32
+ fontSize: textFontSize,
33
+ fontFamily: textFontFamily,
34
+ fontWeight: String(textFontWeight),
35
+ lineHeight: textLineHeight,
36
+ textAlign: 'center'
37
+ };
38
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
39
+ style: [containerStyle, style],
40
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Avatar.default, {
41
+ style: "Image",
42
+ imageSource: imageSource,
43
+ modes: modes
44
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
45
+ style: labelTextStyle,
46
+ children: label
47
+ })]
48
+ });
49
+ }
50
+ var _default = exports.default = ProductLabel;
@@ -0,0 +1,130 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _reactNative = require("react-native");
9
+ var _figmaVariablesResolver = require("../../design-tokens/figma-variables-resolver");
10
+ var _Icon = _interopRequireDefault(require("../../icons/Icon"));
11
+ var _jsxRuntime = require("react/jsx-runtime");
12
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
+ /**
14
+ * ProgressBadge component that displays an icon, text, and an internal progress bar.
15
+ *
16
+ * All visual attributes resolve from Figma tokens via `getVariableByName` using the provided `modes`.
17
+ *
18
+ * @component
19
+ * @param {Object} props
20
+ * @param {string} [props.taskName="Live price: [price] (00:43)"] - The text displayed.
21
+ * @param {string} [props.iconName="ic_live"] - Icon name from the registry.
22
+ * @param {number} [props.value=0] - The progress value between 0 and 100.
23
+ * @param {Object} [props.modes={}] - Modes object passed to `getVariableByName` for design tokens.
24
+ * @param {Object} [props.style] - Optional container style overrides.
25
+ * @param {Object} [props.textStyle] - Optional text style overrides.
26
+ * @param {string} [props.accessibilityLabel] - Accessibility label.
27
+ */
28
+ function ProgressBadge({
29
+ taskName = 'Live price: [price] (00:43)',
30
+ iconName = 'ic_live',
31
+ value = 0,
32
+ modes = {},
33
+ style,
34
+ textStyle: textStyleOverride,
35
+ accessibilityLabel,
36
+ ...rest
37
+ }) {
38
+ // Resolve layout tokens
39
+ const backgroundColor = (0, _figmaVariablesResolver.getVariableByName)('progressBadge/background', modes) || '#ffffff';
40
+ const progressColor = (0, _figmaVariablesResolver.getVariableByName)('progressBadge/progress/color', modes) || '#ebebed';
41
+ const gap = (0, _figmaVariablesResolver.getVariableByName)('progressBadge/gap', modes) ?? 12;
42
+ const paddingHorizontal = (0, _figmaVariablesResolver.getVariableByName)('progressBadge/padding/horizontal', modes) ?? 16;
43
+ const paddingVertical = (0, _figmaVariablesResolver.getVariableByName)('progressBadge/padding/vertical', modes) ?? 6;
44
+ const borderRadius = (0, _figmaVariablesResolver.getVariableByName)('progressBadge/radius', modes) ?? 999;
45
+ const descriptionGap = (0, _figmaVariablesResolver.getVariableByName)('progressBadge/description/gap', modes) ?? 8;
46
+
47
+ // Resolve typography tokens
48
+ const fontFamily = (0, _figmaVariablesResolver.getVariableByName)('progressBadge/fontFamily', modes) || 'JioType_Var:Medium';
49
+ const fontWeightRaw = (0, _figmaVariablesResolver.getVariableByName)('progressBadge/fontWeight', modes) ?? 500;
50
+ const fontWeight = typeof fontWeightRaw === 'number' ? fontWeightRaw.toString() : fontWeightRaw;
51
+ const fontSize = (0, _figmaVariablesResolver.getVariableByName)('progressBadge/fontSize', modes) ?? 14;
52
+ const lineHeight = (0, _figmaVariablesResolver.getVariableByName)('progressBadge/lineHeight', modes) ?? 17;
53
+ const textColor = (0, _figmaVariablesResolver.getVariableByName)('progressBadge/foreground', modes) || '#000000';
54
+
55
+ // Resolve icon tokens
56
+ const iconColor = (0, _figmaVariablesResolver.getVariableByName)('progressBadge/icon/color', modes) || '#f50030';
57
+ const iconSize = (0, _figmaVariablesResolver.getVariableByName)('progressBadge/icon/size', modes) ?? 18;
58
+ const containerStyle = {
59
+ backgroundColor,
60
+ flexDirection: 'row',
61
+ alignItems: 'center',
62
+ gap,
63
+ paddingHorizontal,
64
+ paddingVertical,
65
+ borderRadius,
66
+ overflow: 'hidden',
67
+ position: 'relative',
68
+ flexWrap: 'wrap'
69
+ };
70
+ const descriptionContainerStyle = {
71
+ flexDirection: 'row',
72
+ alignItems: 'center',
73
+ justifyContent: 'center',
74
+ gap: descriptionGap,
75
+ flex: 1,
76
+ paddingVertical: 0,
77
+ minHeight: 1,
78
+ minWidth: 1,
79
+ position: 'relative'
80
+ };
81
+ const textStyle = {
82
+ fontFamily,
83
+ fontWeight,
84
+ fontSize,
85
+ lineHeight,
86
+ color: textColor,
87
+ textAlign: 'center',
88
+ overflow: 'hidden',
89
+ flexShrink: 0
90
+ };
91
+
92
+ // Ensure value is between 0 and 100
93
+ const clampedValue = Math.max(0, Math.min(100, value));
94
+ const progressStyle = {
95
+ position: 'absolute',
96
+ left: 0,
97
+ top: 0,
98
+ bottom: 0,
99
+ width: `${clampedValue}%`,
100
+ backgroundColor: progressColor
101
+ };
102
+ const defaultAccessibilityLabel = accessibilityLabel || taskName;
103
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
104
+ style: [containerStyle, style],
105
+ accessibilityRole: "text",
106
+ accessibilityLabel: defaultAccessibilityLabel,
107
+ ...rest,
108
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
109
+ style: progressStyle,
110
+ pointerEvents: "none"
111
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
112
+ style: descriptionContainerStyle,
113
+ children: [iconName ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
114
+ name: iconName,
115
+ size: iconSize,
116
+ color: iconColor,
117
+ accessibilityElementsHidden: true,
118
+ importantForAccessibility: "no"
119
+ }) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
120
+ style: [textStyle, textStyleOverride],
121
+ numberOfLines: 1,
122
+ ellipsizeMode: "tail",
123
+ accessibilityElementsHidden: true,
124
+ importantForAccessibility: "no",
125
+ children: taskName
126
+ })]
127
+ })]
128
+ });
129
+ }
130
+ var _default = exports.default = ProgressBadge;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _exportNames = {};
7
+ Object.defineProperty(exports, "default", {
8
+ enumerable: true,
9
+ get: function () {
10
+ return _ProgressBadge.default;
11
+ }
12
+ });
13
+ var _ProgressBadge = _interopRequireWildcard(require("./ProgressBadge"));
14
+ Object.keys(_ProgressBadge).forEach(function (key) {
15
+ if (key === "default" || key === "__esModule") return;
16
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
17
+ if (key in exports && exports[key] === _ProgressBadge[key]) return;
18
+ Object.defineProperty(exports, key, {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _ProgressBadge[key];
22
+ }
23
+ });
24
+ });
25
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _reactNative = require("react-native");
9
+ var _figmaVariablesResolver = require("../../design-tokens/figma-variables-resolver");
10
+ var _jsxRuntime = require("react/jsx-runtime");
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
+ /**
13
+ * StatItem displays a label/value pair with the value in a large, bold style.
14
+ * Useful for metrics, product stats, or KPI callouts.
15
+ *
16
+ * @component
17
+ * @param {StatItemProps} props
18
+ */
19
+ function StatItem({
20
+ label = 'Purity verified by NABL',
21
+ value = '99.99%',
22
+ modes = {},
23
+ style
24
+ }) {
25
+ const gap = (0, _figmaVariablesResolver.getVariableByName)('statItem/gap', modes) ?? 2;
26
+ const labelForeground = (0, _figmaVariablesResolver.getVariableByName)('statItem/label/foreground', modes) ?? '#1a1c1f';
27
+ const labelFontFamily = (0, _figmaVariablesResolver.getVariableByName)('statItem/label/fontFamily', modes) ?? 'JioType Var';
28
+ const labelFontSize = (0, _figmaVariablesResolver.getVariableByName)('statItem/label/fontSize', modes) ?? 12;
29
+ const labelFontWeight = (0, _figmaVariablesResolver.getVariableByName)('statItem/label/fontWeight', modes) ?? '500';
30
+ const labelLineHeight = (0, _figmaVariablesResolver.getVariableByName)('statItem/label/lineHeight', modes) ?? 16;
31
+ const valueForeground = (0, _figmaVariablesResolver.getVariableByName)('statItem/value/foreground', modes) ?? '#0d0d0f';
32
+ const valueFontFamily = (0, _figmaVariablesResolver.getVariableByName)('statItem/value/fontFamily', modes) ?? 'JioType Var';
33
+ const valueFontSize = (0, _figmaVariablesResolver.getVariableByName)('statItem/value/fontSize', modes) ?? 26;
34
+ const valueFontWeight = (0, _figmaVariablesResolver.getVariableByName)('statItem/value/fontWeight', modes) ?? '900';
35
+ const valueLineHeight = (0, _figmaVariablesResolver.getVariableByName)('statItem/value/lineHeight', modes) ?? 26;
36
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
37
+ style: [{
38
+ gap: gap
39
+ }, style],
40
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
41
+ style: {
42
+ color: labelForeground,
43
+ fontFamily: labelFontFamily,
44
+ fontSize: labelFontSize,
45
+ fontWeight: String(labelFontWeight),
46
+ lineHeight: labelLineHeight
47
+ },
48
+ children: label
49
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
50
+ style: {
51
+ color: valueForeground,
52
+ fontFamily: valueFontFamily,
53
+ fontSize: valueFontSize,
54
+ fontWeight: String(valueFontWeight),
55
+ lineHeight: valueLineHeight
56
+ },
57
+ children: value
58
+ })]
59
+ });
60
+ }
61
+ var _default = exports.default = StatItem;