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.
- package/lib/commonjs/components/AmountInput/AmountInput.js +82 -0
- package/lib/commonjs/components/AmountInput/index.js +13 -0
- package/lib/commonjs/components/Button/Button.js +45 -28
- package/lib/commonjs/components/CardProviderInfo/CardProviderInfo.js +76 -0
- package/lib/commonjs/components/Checkbox/Checkbox.js +208 -0
- package/lib/commonjs/components/EmptyState/EmptyState.js +2 -1
- package/lib/commonjs/components/MoneyValue/MoneyValue.js +81 -49
- package/lib/commonjs/components/NoteInput/NoteInput.js +120 -0
- package/lib/commonjs/components/NoteInput/index.js +13 -0
- package/lib/commonjs/components/Numpad/Numpad.js +108 -0
- package/lib/commonjs/components/OTP/OTP.js +242 -0
- package/lib/commonjs/components/PortfolioHero/PortfolioHero.js +78 -0
- package/lib/commonjs/components/ProductLabel/ProductLabel.js +50 -0
- package/lib/commonjs/components/ProgressBadge/ProgressBadge.js +130 -0
- package/lib/commonjs/components/ProgressBadge/index.js +25 -0
- package/lib/commonjs/components/StatItem/StatItem.js +61 -0
- package/lib/commonjs/components/StatusHero/StatusHero.js +148 -0
- package/lib/commonjs/components/SwappableAmount/SwappableAmount.js +71 -0
- package/lib/commonjs/components/Tabs/TabItem.js +79 -0
- package/lib/commonjs/components/Tabs/Tabs.js +88 -0
- package/lib/commonjs/components/Text/Text.js +38 -0
- package/lib/commonjs/components/Toggle/Toggle.js +102 -0
- package/lib/commonjs/components/index.js +105 -0
- package/lib/commonjs/design-tokens/Coin Variables-variables-full.json +1 -0
- package/lib/commonjs/design-tokens/figma-variables-resolver.js +1 -1
- package/lib/commonjs/icons/registry.js +1 -1
- package/lib/module/components/AmountInput/AmountInput.js +77 -0
- package/lib/module/components/AmountInput/index.js +3 -0
- package/lib/module/components/Button/Button.js +44 -28
- package/lib/module/components/CardProviderInfo/CardProviderInfo.js +71 -0
- package/lib/module/components/Checkbox/Checkbox.js +205 -0
- package/lib/module/components/EmptyState/EmptyState.js +2 -1
- package/lib/module/components/MoneyValue/MoneyValue.js +81 -49
- package/lib/module/components/NoteInput/NoteInput.js +115 -0
- package/lib/module/components/NoteInput/index.js +3 -0
- package/lib/module/components/Numpad/Numpad.js +103 -0
- package/lib/module/components/OTP/OTP.js +236 -0
- package/lib/module/components/PortfolioHero/PortfolioHero.js +73 -0
- package/lib/module/components/ProductLabel/ProductLabel.js +45 -0
- package/lib/module/components/ProgressBadge/ProgressBadge.js +125 -0
- package/lib/module/components/ProgressBadge/index.js +4 -0
- package/lib/module/components/StatItem/StatItem.js +56 -0
- package/lib/module/components/StatusHero/StatusHero.js +142 -0
- package/lib/module/components/SwappableAmount/SwappableAmount.js +66 -0
- package/lib/module/components/Tabs/TabItem.js +74 -0
- package/lib/module/components/Tabs/Tabs.js +78 -0
- package/lib/module/components/Text/Text.js +33 -0
- package/lib/module/components/Toggle/Toggle.js +97 -0
- package/lib/module/components/index.js +16 -1
- package/lib/module/design-tokens/Coin Variables-variables-full.json +1 -0
- package/lib/module/design-tokens/figma-variables-resolver.js +1 -1
- package/lib/module/icons/registry.js +1 -1
- package/lib/typescript/src/components/AmountInput/AmountInput.d.ts +23 -0
- package/lib/typescript/src/components/AmountInput/index.d.ts +3 -0
- package/lib/typescript/src/components/Button/Button.d.ts +6 -1
- package/lib/typescript/src/components/CardProviderInfo/CardProviderInfo.d.ts +24 -0
- package/lib/typescript/src/components/Checkbox/Checkbox.d.ts +30 -0
- package/lib/typescript/src/components/EmptyState/EmptyState.d.ts +6 -1
- package/lib/typescript/src/components/MoneyValue/MoneyValue.d.ts +18 -26
- package/lib/typescript/src/components/NoteInput/NoteInput.d.ts +23 -0
- package/lib/typescript/src/components/NoteInput/index.d.ts +3 -0
- package/lib/typescript/src/components/Numpad/Numpad.d.ts +35 -0
- package/lib/typescript/src/components/OTP/OTP.d.ts +36 -0
- package/lib/typescript/src/components/PortfolioHero/PortfolioHero.d.ts +21 -0
- package/lib/typescript/src/components/ProductLabel/ProductLabel.d.ts +14 -0
- package/lib/typescript/src/components/ProgressBadge/ProgressBadge.d.ts +36 -0
- package/lib/typescript/src/components/ProgressBadge/index.d.ts +3 -0
- package/lib/typescript/src/components/StatItem/StatItem.d.ts +21 -0
- package/lib/typescript/src/components/StatusHero/StatusHero.d.ts +47 -0
- package/lib/typescript/src/components/SwappableAmount/SwappableAmount.d.ts +22 -0
- package/lib/typescript/src/components/Tabs/TabItem.d.ts +29 -0
- package/lib/typescript/src/components/Tabs/Tabs.d.ts +44 -0
- package/lib/typescript/src/components/Text/Text.d.ts +14 -0
- package/lib/typescript/src/components/Toggle/Toggle.d.ts +29 -0
- package/lib/typescript/src/components/index.d.ts +15 -0
- package/lib/typescript/src/icons/registry.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/AmountInput/AmountInput.tsx +81 -0
- package/src/components/AmountInput/index.ts +2 -0
- package/src/components/Button/Button.tsx +40 -20
- package/src/components/CardProviderInfo/CardProviderInfo.tsx +81 -0
- package/src/components/Checkbox/Checkbox.tsx +238 -0
- package/src/components/EmptyState/EmptyState.tsx +7 -1
- package/src/components/MoneyValue/MoneyValue.tsx +134 -79
- package/src/components/NoteInput/NoteInput.tsx +146 -0
- package/src/components/NoteInput/index.ts +2 -0
- package/src/components/Numpad/Numpad.tsx +162 -0
- package/src/components/OTP/OTP.tsx +275 -0
- package/src/components/PortfolioHero/PortfolioHero.tsx +91 -0
- package/src/components/ProductLabel/ProductLabel.tsx +58 -0
- package/src/components/ProgressBadge/ProgressBadge.tsx +172 -0
- package/src/components/ProgressBadge/index.ts +2 -0
- package/src/components/StatItem/StatItem.tsx +71 -0
- package/src/components/StatusHero/StatusHero.tsx +156 -0
- package/src/components/SwappableAmount/SwappableAmount.tsx +92 -0
- package/src/components/Tabs/TabItem.tsx +96 -0
- package/src/components/Tabs/Tabs.tsx +105 -0
- package/src/components/Text/Text.tsx +48 -0
- package/src/components/Toggle/Toggle.tsx +122 -0
- package/src/components/index.ts +15 -0
- package/src/design-tokens/Coin Variables-variables-full.json +1 -0
- package/src/design-tokens/figma-variables-resolver.ts +1 -1
- package/src/icons/registry.ts +1 -1
- package/lib/commonjs/design-tokens/JFS Variables-variables-full.json +0 -1
- package/lib/module/design-tokens/JFS Variables-variables-full.json +0 -1
- package/src/design-tokens/JFS Variables-variables-full.json +0 -1
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { View, Text } from 'react-native';
|
|
5
|
+
import { getVariableByName } from '../../design-tokens/figma-variables-resolver';
|
|
6
|
+
import { cloneChildrenWithModes } from '../../utils/react-utils';
|
|
7
|
+
import Avatar from '../Avatar/Avatar';
|
|
8
|
+
import MoneyValue from '../MoneyValue/MoneyValue';
|
|
9
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
+
function PortfolioHero({
|
|
11
|
+
label = 'Gold',
|
|
12
|
+
imageSource,
|
|
13
|
+
value = '12,000.11',
|
|
14
|
+
currency = '₹',
|
|
15
|
+
modes = {
|
|
16
|
+
Context3: 'Balance'
|
|
17
|
+
},
|
|
18
|
+
children,
|
|
19
|
+
style
|
|
20
|
+
}) {
|
|
21
|
+
const gap = getVariableByName('portfolioHero/gap', modes) ?? 16;
|
|
22
|
+
const padding = getVariableByName('portfolioHero/padding', modes) ?? 8;
|
|
23
|
+
const slotWrapGap = getVariableByName('portfolioHero/slotWrap/gap', modes) ?? 8;
|
|
24
|
+
const containerStyle = {
|
|
25
|
+
flexDirection: 'column',
|
|
26
|
+
alignItems: 'center',
|
|
27
|
+
justifyContent: 'center',
|
|
28
|
+
gap: gap,
|
|
29
|
+
padding: padding
|
|
30
|
+
};
|
|
31
|
+
const productLabelStyle = {
|
|
32
|
+
flexDirection: 'row',
|
|
33
|
+
alignItems: 'center',
|
|
34
|
+
gap: 8
|
|
35
|
+
};
|
|
36
|
+
const labelTextStyle = {
|
|
37
|
+
fontFamily: 'System',
|
|
38
|
+
fontWeight: '700',
|
|
39
|
+
fontSize: 16,
|
|
40
|
+
lineHeight: 16 * 1.3,
|
|
41
|
+
color: '#0d0d0f',
|
|
42
|
+
textAlign: 'center'
|
|
43
|
+
};
|
|
44
|
+
const slotWrapStyle = {
|
|
45
|
+
flexDirection: 'column',
|
|
46
|
+
alignItems: 'center',
|
|
47
|
+
gap: slotWrapGap
|
|
48
|
+
};
|
|
49
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
50
|
+
style: [containerStyle, style],
|
|
51
|
+
children: [/*#__PURE__*/_jsxs(View, {
|
|
52
|
+
style: productLabelStyle,
|
|
53
|
+
children: [/*#__PURE__*/_jsx(Avatar, {
|
|
54
|
+
style: "Image",
|
|
55
|
+
...(imageSource != null && {
|
|
56
|
+
imageSource
|
|
57
|
+
}),
|
|
58
|
+
modes: modes
|
|
59
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
60
|
+
style: labelTextStyle,
|
|
61
|
+
children: label
|
|
62
|
+
})]
|
|
63
|
+
}), /*#__PURE__*/_jsx(MoneyValue, {
|
|
64
|
+
value: value,
|
|
65
|
+
currency: currency,
|
|
66
|
+
modes: modes
|
|
67
|
+
}), children && /*#__PURE__*/_jsx(View, {
|
|
68
|
+
style: slotWrapStyle,
|
|
69
|
+
children: cloneChildrenWithModes(children, modes)
|
|
70
|
+
})]
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
export default PortfolioHero;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { View, Text } from 'react-native';
|
|
5
|
+
import { getVariableByName } from '../../design-tokens/figma-variables-resolver';
|
|
6
|
+
import Avatar from '../Avatar/Avatar';
|
|
7
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
function ProductLabel({
|
|
9
|
+
label = 'Gold',
|
|
10
|
+
imageSource,
|
|
11
|
+
modes = {},
|
|
12
|
+
style
|
|
13
|
+
}) {
|
|
14
|
+
const gap = getVariableByName('productLabel/gap', modes) ?? 8;
|
|
15
|
+
const textColor = getVariableByName('productLabel/text/color', modes) ?? '#000000';
|
|
16
|
+
const textFontSize = getVariableByName('productLabel/text/fontSize', modes) ?? 16;
|
|
17
|
+
const textFontFamily = getVariableByName('productLabel/text/fontFamily', modes) ?? 'JioType Var';
|
|
18
|
+
const textFontWeight = getVariableByName('productLabel/text/fontWeight', modes) ?? 700;
|
|
19
|
+
const textLineHeight = getVariableByName('productLabel/text/lineHeight', modes) ?? 21;
|
|
20
|
+
const containerStyle = {
|
|
21
|
+
flexDirection: 'row',
|
|
22
|
+
alignItems: 'center',
|
|
23
|
+
gap: gap
|
|
24
|
+
};
|
|
25
|
+
const labelTextStyle = {
|
|
26
|
+
color: textColor,
|
|
27
|
+
fontSize: textFontSize,
|
|
28
|
+
fontFamily: textFontFamily,
|
|
29
|
+
fontWeight: String(textFontWeight),
|
|
30
|
+
lineHeight: textLineHeight,
|
|
31
|
+
textAlign: 'center'
|
|
32
|
+
};
|
|
33
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
34
|
+
style: [containerStyle, style],
|
|
35
|
+
children: [/*#__PURE__*/_jsx(Avatar, {
|
|
36
|
+
style: "Image",
|
|
37
|
+
imageSource: imageSource,
|
|
38
|
+
modes: modes
|
|
39
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
40
|
+
style: labelTextStyle,
|
|
41
|
+
children: label
|
|
42
|
+
})]
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
export default ProductLabel;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { View, Text } from 'react-native';
|
|
5
|
+
import { getVariableByName } from '../../design-tokens/figma-variables-resolver';
|
|
6
|
+
import Icon from '../../icons/Icon';
|
|
7
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
/**
|
|
9
|
+
* ProgressBadge component that displays an icon, text, and an internal progress bar.
|
|
10
|
+
*
|
|
11
|
+
* All visual attributes resolve from Figma tokens via `getVariableByName` using the provided `modes`.
|
|
12
|
+
*
|
|
13
|
+
* @component
|
|
14
|
+
* @param {Object} props
|
|
15
|
+
* @param {string} [props.taskName="Live price: [price] (00:43)"] - The text displayed.
|
|
16
|
+
* @param {string} [props.iconName="ic_live"] - Icon name from the registry.
|
|
17
|
+
* @param {number} [props.value=0] - The progress value between 0 and 100.
|
|
18
|
+
* @param {Object} [props.modes={}] - Modes object passed to `getVariableByName` for design tokens.
|
|
19
|
+
* @param {Object} [props.style] - Optional container style overrides.
|
|
20
|
+
* @param {Object} [props.textStyle] - Optional text style overrides.
|
|
21
|
+
* @param {string} [props.accessibilityLabel] - Accessibility label.
|
|
22
|
+
*/
|
|
23
|
+
function ProgressBadge({
|
|
24
|
+
taskName = 'Live price: [price] (00:43)',
|
|
25
|
+
iconName = 'ic_live',
|
|
26
|
+
value = 0,
|
|
27
|
+
modes = {},
|
|
28
|
+
style,
|
|
29
|
+
textStyle: textStyleOverride,
|
|
30
|
+
accessibilityLabel,
|
|
31
|
+
...rest
|
|
32
|
+
}) {
|
|
33
|
+
// Resolve layout tokens
|
|
34
|
+
const backgroundColor = getVariableByName('progressBadge/background', modes) || '#ffffff';
|
|
35
|
+
const progressColor = getVariableByName('progressBadge/progress/color', modes) || '#ebebed';
|
|
36
|
+
const gap = getVariableByName('progressBadge/gap', modes) ?? 12;
|
|
37
|
+
const paddingHorizontal = getVariableByName('progressBadge/padding/horizontal', modes) ?? 16;
|
|
38
|
+
const paddingVertical = getVariableByName('progressBadge/padding/vertical', modes) ?? 6;
|
|
39
|
+
const borderRadius = getVariableByName('progressBadge/radius', modes) ?? 999;
|
|
40
|
+
const descriptionGap = getVariableByName('progressBadge/description/gap', modes) ?? 8;
|
|
41
|
+
|
|
42
|
+
// Resolve typography tokens
|
|
43
|
+
const fontFamily = getVariableByName('progressBadge/fontFamily', modes) || 'JioType_Var:Medium';
|
|
44
|
+
const fontWeightRaw = getVariableByName('progressBadge/fontWeight', modes) ?? 500;
|
|
45
|
+
const fontWeight = typeof fontWeightRaw === 'number' ? fontWeightRaw.toString() : fontWeightRaw;
|
|
46
|
+
const fontSize = getVariableByName('progressBadge/fontSize', modes) ?? 14;
|
|
47
|
+
const lineHeight = getVariableByName('progressBadge/lineHeight', modes) ?? 17;
|
|
48
|
+
const textColor = getVariableByName('progressBadge/foreground', modes) || '#000000';
|
|
49
|
+
|
|
50
|
+
// Resolve icon tokens
|
|
51
|
+
const iconColor = getVariableByName('progressBadge/icon/color', modes) || '#f50030';
|
|
52
|
+
const iconSize = getVariableByName('progressBadge/icon/size', modes) ?? 18;
|
|
53
|
+
const containerStyle = {
|
|
54
|
+
backgroundColor,
|
|
55
|
+
flexDirection: 'row',
|
|
56
|
+
alignItems: 'center',
|
|
57
|
+
gap,
|
|
58
|
+
paddingHorizontal,
|
|
59
|
+
paddingVertical,
|
|
60
|
+
borderRadius,
|
|
61
|
+
overflow: 'hidden',
|
|
62
|
+
position: 'relative',
|
|
63
|
+
flexWrap: 'wrap'
|
|
64
|
+
};
|
|
65
|
+
const descriptionContainerStyle = {
|
|
66
|
+
flexDirection: 'row',
|
|
67
|
+
alignItems: 'center',
|
|
68
|
+
justifyContent: 'center',
|
|
69
|
+
gap: descriptionGap,
|
|
70
|
+
flex: 1,
|
|
71
|
+
paddingVertical: 0,
|
|
72
|
+
minHeight: 1,
|
|
73
|
+
minWidth: 1,
|
|
74
|
+
position: 'relative'
|
|
75
|
+
};
|
|
76
|
+
const textStyle = {
|
|
77
|
+
fontFamily,
|
|
78
|
+
fontWeight,
|
|
79
|
+
fontSize,
|
|
80
|
+
lineHeight,
|
|
81
|
+
color: textColor,
|
|
82
|
+
textAlign: 'center',
|
|
83
|
+
overflow: 'hidden',
|
|
84
|
+
flexShrink: 0
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
// Ensure value is between 0 and 100
|
|
88
|
+
const clampedValue = Math.max(0, Math.min(100, value));
|
|
89
|
+
const progressStyle = {
|
|
90
|
+
position: 'absolute',
|
|
91
|
+
left: 0,
|
|
92
|
+
top: 0,
|
|
93
|
+
bottom: 0,
|
|
94
|
+
width: `${clampedValue}%`,
|
|
95
|
+
backgroundColor: progressColor
|
|
96
|
+
};
|
|
97
|
+
const defaultAccessibilityLabel = accessibilityLabel || taskName;
|
|
98
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
99
|
+
style: [containerStyle, style],
|
|
100
|
+
accessibilityRole: "text",
|
|
101
|
+
accessibilityLabel: defaultAccessibilityLabel,
|
|
102
|
+
...rest,
|
|
103
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
104
|
+
style: progressStyle,
|
|
105
|
+
pointerEvents: "none"
|
|
106
|
+
}), /*#__PURE__*/_jsxs(View, {
|
|
107
|
+
style: descriptionContainerStyle,
|
|
108
|
+
children: [iconName ? /*#__PURE__*/_jsx(Icon, {
|
|
109
|
+
name: iconName,
|
|
110
|
+
size: iconSize,
|
|
111
|
+
color: iconColor,
|
|
112
|
+
accessibilityElementsHidden: true,
|
|
113
|
+
importantForAccessibility: "no"
|
|
114
|
+
}) : null, /*#__PURE__*/_jsx(Text, {
|
|
115
|
+
style: [textStyle, textStyleOverride],
|
|
116
|
+
numberOfLines: 1,
|
|
117
|
+
ellipsizeMode: "tail",
|
|
118
|
+
accessibilityElementsHidden: true,
|
|
119
|
+
importantForAccessibility: "no",
|
|
120
|
+
children: taskName
|
|
121
|
+
})]
|
|
122
|
+
})]
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
export default ProgressBadge;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { View, Text } from 'react-native';
|
|
5
|
+
import { getVariableByName } from '../../design-tokens/figma-variables-resolver';
|
|
6
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
/**
|
|
8
|
+
* StatItem displays a label/value pair with the value in a large, bold style.
|
|
9
|
+
* Useful for metrics, product stats, or KPI callouts.
|
|
10
|
+
*
|
|
11
|
+
* @component
|
|
12
|
+
* @param {StatItemProps} props
|
|
13
|
+
*/
|
|
14
|
+
function StatItem({
|
|
15
|
+
label = 'Purity verified by NABL',
|
|
16
|
+
value = '99.99%',
|
|
17
|
+
modes = {},
|
|
18
|
+
style
|
|
19
|
+
}) {
|
|
20
|
+
const gap = getVariableByName('statItem/gap', modes) ?? 2;
|
|
21
|
+
const labelForeground = getVariableByName('statItem/label/foreground', modes) ?? '#1a1c1f';
|
|
22
|
+
const labelFontFamily = getVariableByName('statItem/label/fontFamily', modes) ?? 'JioType Var';
|
|
23
|
+
const labelFontSize = getVariableByName('statItem/label/fontSize', modes) ?? 12;
|
|
24
|
+
const labelFontWeight = getVariableByName('statItem/label/fontWeight', modes) ?? '500';
|
|
25
|
+
const labelLineHeight = getVariableByName('statItem/label/lineHeight', modes) ?? 16;
|
|
26
|
+
const valueForeground = getVariableByName('statItem/value/foreground', modes) ?? '#0d0d0f';
|
|
27
|
+
const valueFontFamily = getVariableByName('statItem/value/fontFamily', modes) ?? 'JioType Var';
|
|
28
|
+
const valueFontSize = getVariableByName('statItem/value/fontSize', modes) ?? 26;
|
|
29
|
+
const valueFontWeight = getVariableByName('statItem/value/fontWeight', modes) ?? '900';
|
|
30
|
+
const valueLineHeight = getVariableByName('statItem/value/lineHeight', modes) ?? 26;
|
|
31
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
32
|
+
style: [{
|
|
33
|
+
gap: gap
|
|
34
|
+
}, style],
|
|
35
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
36
|
+
style: {
|
|
37
|
+
color: labelForeground,
|
|
38
|
+
fontFamily: labelFontFamily,
|
|
39
|
+
fontSize: labelFontSize,
|
|
40
|
+
fontWeight: String(labelFontWeight),
|
|
41
|
+
lineHeight: labelLineHeight
|
|
42
|
+
},
|
|
43
|
+
children: label
|
|
44
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
45
|
+
style: {
|
|
46
|
+
color: valueForeground,
|
|
47
|
+
fontFamily: valueFontFamily,
|
|
48
|
+
fontSize: valueFontSize,
|
|
49
|
+
fontWeight: String(valueFontWeight),
|
|
50
|
+
lineHeight: valueLineHeight
|
|
51
|
+
},
|
|
52
|
+
children: value
|
|
53
|
+
})]
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
export default StatItem;
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { isValidElement, cloneElement } from 'react';
|
|
4
|
+
import { View, Text } from 'react-native';
|
|
5
|
+
import { getVariableByName } from '../../design-tokens/figma-variables-resolver';
|
|
6
|
+
import { useTokens } from '../../design-tokens/JFSThemeProvider';
|
|
7
|
+
import IconCapsule from '../IconCapsule/IconCapsule';
|
|
8
|
+
import MoneyValue from '../MoneyValue/MoneyValue';
|
|
9
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
+
/**
|
|
11
|
+
* StatusHero component that displays a hero section for payment/transaction status screens.
|
|
12
|
+
*
|
|
13
|
+
* Contains a media slot (defaults to IconCapsule + MoneyValue) and a content area
|
|
14
|
+
* with an optional title and a subtitle. All visual values are resolved from Figma
|
|
15
|
+
* design tokens via `getVariableByName`.
|
|
16
|
+
*
|
|
17
|
+
* @component
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* <StatusHero
|
|
21
|
+
* iconName="ic_confirm"
|
|
22
|
+
* value="50"
|
|
23
|
+
* currency="INR"
|
|
24
|
+
* title="You're set to make payments"
|
|
25
|
+
* subtitle="₹50 will be auto-invested daily, stay consistent & stay golden."
|
|
26
|
+
* modes={{ 'Color Mode': 'Light' }}
|
|
27
|
+
* />
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export default function StatusHero({
|
|
31
|
+
renderMedia,
|
|
32
|
+
title = "You're set to make payments",
|
|
33
|
+
showTitle = true,
|
|
34
|
+
subtitle = '₹50 will be auto-invested daily,\nstay consistent & stay golden.',
|
|
35
|
+
iconName = 'ic_confirm',
|
|
36
|
+
value = '50',
|
|
37
|
+
currency = 'INR',
|
|
38
|
+
modes: propModes = {},
|
|
39
|
+
style
|
|
40
|
+
}) {
|
|
41
|
+
const {
|
|
42
|
+
modes: globalModes
|
|
43
|
+
} = useTokens();
|
|
44
|
+
const modes = {
|
|
45
|
+
...globalModes,
|
|
46
|
+
...propModes
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
// Container
|
|
50
|
+
const gap = Number(getVariableByName('statusHero/gap', modes)) || 12;
|
|
51
|
+
const padding = Number(getVariableByName('statusHero/padding', modes)) || 8;
|
|
52
|
+
|
|
53
|
+
// Media slot wrap (gap between icon and money value in default slot)
|
|
54
|
+
const slotWrapGap = Number(getVariableByName('statusHero/slotWrap/gap', modes)) || 46;
|
|
55
|
+
|
|
56
|
+
// Content wrap
|
|
57
|
+
const contentWrapGap = Number(getVariableByName('statusHero/contentWrap/gap', modes)) || 12;
|
|
58
|
+
|
|
59
|
+
// Title
|
|
60
|
+
const titleColor = getVariableByName('statusHero/title/foreground', modes) || '#0c0d10';
|
|
61
|
+
const titleFontSize = Number(getVariableByName('statusHero/title/fontSize', modes)) || 20;
|
|
62
|
+
const titleFontFamily = getVariableByName('statusHero/title/fontFamily', modes) || 'System';
|
|
63
|
+
const titleLineHeight = Number(getVariableByName('statusHero/title/lineHeight', modes)) || 22;
|
|
64
|
+
const titleFontWeight = getVariableByName('statusHero/title/fontWeight', modes) || '700';
|
|
65
|
+
|
|
66
|
+
// Body
|
|
67
|
+
const bodyColor = getVariableByName('statusHero/body/foreground', modes) || '#24262b';
|
|
68
|
+
const bodyFontSize = Number(getVariableByName('statusHero/body/fontSize', modes)) || 14;
|
|
69
|
+
const bodyFontFamily = getVariableByName('statusHero/body/fontFamily', modes) || 'System';
|
|
70
|
+
const bodyLineHeight = Number(getVariableByName('statusHero/body/lineHeight', modes)) || 17;
|
|
71
|
+
const bodyFontWeight = getVariableByName('statusHero/body/fontWeight', modes) || '500';
|
|
72
|
+
const containerStyle = {
|
|
73
|
+
flexDirection: 'column',
|
|
74
|
+
alignItems: 'center',
|
|
75
|
+
justifyContent: 'center',
|
|
76
|
+
gap,
|
|
77
|
+
padding
|
|
78
|
+
};
|
|
79
|
+
const defaultMediaWrapStyle = {
|
|
80
|
+
flexDirection: 'column',
|
|
81
|
+
alignItems: 'center',
|
|
82
|
+
gap: slotWrapGap
|
|
83
|
+
};
|
|
84
|
+
const contentWrapStyle = {
|
|
85
|
+
flexDirection: 'column',
|
|
86
|
+
alignItems: 'center',
|
|
87
|
+
gap: contentWrapGap
|
|
88
|
+
};
|
|
89
|
+
const titleStyle = {
|
|
90
|
+
color: titleColor,
|
|
91
|
+
fontSize: titleFontSize,
|
|
92
|
+
fontFamily: titleFontFamily,
|
|
93
|
+
lineHeight: titleLineHeight,
|
|
94
|
+
fontWeight: String(titleFontWeight),
|
|
95
|
+
textAlign: 'center'
|
|
96
|
+
};
|
|
97
|
+
const bodyStyle = {
|
|
98
|
+
color: bodyColor,
|
|
99
|
+
fontSize: bodyFontSize,
|
|
100
|
+
fontFamily: bodyFontFamily,
|
|
101
|
+
lineHeight: bodyLineHeight,
|
|
102
|
+
fontWeight: String(bodyFontWeight),
|
|
103
|
+
textAlign: 'center'
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
// Inject modes into the provided slot if it's a valid React element
|
|
107
|
+
const mediaContent = /*#__PURE__*/isValidElement(renderMedia) ? /*#__PURE__*/cloneElement(renderMedia, {
|
|
108
|
+
modes
|
|
109
|
+
}) : renderMedia;
|
|
110
|
+
const defaultMediaContent = /*#__PURE__*/_jsxs(View, {
|
|
111
|
+
style: defaultMediaWrapStyle,
|
|
112
|
+
children: [/*#__PURE__*/_jsx(IconCapsule, {
|
|
113
|
+
iconName: iconName,
|
|
114
|
+
modes: {
|
|
115
|
+
...modes,
|
|
116
|
+
'Icon Capsule Size': 'L',
|
|
117
|
+
Emphasis: 'High',
|
|
118
|
+
AppearanceBrand: 'Primary'
|
|
119
|
+
}
|
|
120
|
+
}), /*#__PURE__*/_jsx(MoneyValue, {
|
|
121
|
+
value: value,
|
|
122
|
+
currency: currency,
|
|
123
|
+
modes: {
|
|
124
|
+
...modes,
|
|
125
|
+
Context3: 'Balance'
|
|
126
|
+
}
|
|
127
|
+
})]
|
|
128
|
+
});
|
|
129
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
130
|
+
style: [containerStyle, style],
|
|
131
|
+
children: [mediaContent ?? defaultMediaContent, /*#__PURE__*/_jsxs(View, {
|
|
132
|
+
style: contentWrapStyle,
|
|
133
|
+
children: [showTitle && title ? /*#__PURE__*/_jsx(Text, {
|
|
134
|
+
style: titleStyle,
|
|
135
|
+
children: title
|
|
136
|
+
}) : null, subtitle ? /*#__PURE__*/_jsx(Text, {
|
|
137
|
+
style: bodyStyle,
|
|
138
|
+
children: subtitle
|
|
139
|
+
}) : null]
|
|
140
|
+
})]
|
|
141
|
+
});
|
|
142
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { View, Text } from 'react-native';
|
|
5
|
+
import { getVariableByName } from '../../design-tokens/figma-variables-resolver';
|
|
6
|
+
import Button from '../Button/Button';
|
|
7
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
function SwappableAmount({
|
|
9
|
+
value = '49g',
|
|
10
|
+
schedule = false,
|
|
11
|
+
scheduleLabel = 'Weekly on Mondays',
|
|
12
|
+
amountLabel = '₹5100',
|
|
13
|
+
onSchedulePress,
|
|
14
|
+
onAmountPress,
|
|
15
|
+
modes = {},
|
|
16
|
+
style
|
|
17
|
+
}) {
|
|
18
|
+
const gap = getVariableByName('swappableAmount/gap', modes) ?? 24;
|
|
19
|
+
const padding = getVariableByName('swappableAmount/padding', modes) ?? 8;
|
|
20
|
+
const foreground = getVariableByName('swappableAmount/foreground', modes) ?? '#0d0d0f';
|
|
21
|
+
const fontSize = getVariableByName('swappableAmount/fontSize', modes) ?? 56;
|
|
22
|
+
const fontFamily = getVariableByName('swappableAmount/fontFamily', modes) ?? 'System';
|
|
23
|
+
const fontWeight = getVariableByName('swappableAmount/fontWeight', modes) ?? 900;
|
|
24
|
+
const lineHeight = getVariableByName('swappableAmount/lineHeight', modes) ?? 56;
|
|
25
|
+
const containerStyle = {
|
|
26
|
+
flexDirection: 'column',
|
|
27
|
+
alignItems: 'center',
|
|
28
|
+
justifyContent: 'center',
|
|
29
|
+
gap: gap,
|
|
30
|
+
padding: padding
|
|
31
|
+
};
|
|
32
|
+
const valueTextStyle = {
|
|
33
|
+
color: foreground,
|
|
34
|
+
fontSize: fontSize,
|
|
35
|
+
fontFamily: fontFamily,
|
|
36
|
+
fontWeight: String(fontWeight),
|
|
37
|
+
lineHeight: lineHeight
|
|
38
|
+
};
|
|
39
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
40
|
+
style: [containerStyle, style],
|
|
41
|
+
children: [schedule && /*#__PURE__*/_jsx(Button, {
|
|
42
|
+
label: scheduleLabel,
|
|
43
|
+
icon: "ic_calendar_week",
|
|
44
|
+
onPress: onSchedulePress,
|
|
45
|
+
modes: {
|
|
46
|
+
...modes,
|
|
47
|
+
AppearanceBrand: 'Neutral',
|
|
48
|
+
Emphasis: 'Low',
|
|
49
|
+
'Button / Size': 'S'
|
|
50
|
+
}
|
|
51
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
52
|
+
style: valueTextStyle,
|
|
53
|
+
children: value
|
|
54
|
+
}), /*#__PURE__*/_jsx(Button, {
|
|
55
|
+
label: amountLabel,
|
|
56
|
+
icon: "ic_data_in_out",
|
|
57
|
+
onPress: onAmountPress,
|
|
58
|
+
modes: {
|
|
59
|
+
...modes,
|
|
60
|
+
Emphasis: 'Medium',
|
|
61
|
+
AppearanceBrand: 'Secondary'
|
|
62
|
+
}
|
|
63
|
+
})]
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
export default SwappableAmount;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { Pressable, Text, View } from 'react-native';
|
|
5
|
+
import { getVariableByName } from '../../design-tokens/figma-variables-resolver';
|
|
6
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
/**
|
|
8
|
+
* Individual tab item used inside the Tabs container.
|
|
9
|
+
*
|
|
10
|
+
* Supports idle and active states driven by design tokens.
|
|
11
|
+
* When active, a bottom indicator bar is shown beneath the label.
|
|
12
|
+
*
|
|
13
|
+
* @component
|
|
14
|
+
* @param {TabItemProps} props
|
|
15
|
+
*/
|
|
16
|
+
function TabItem({
|
|
17
|
+
label = 'Tab item',
|
|
18
|
+
active = false,
|
|
19
|
+
onPress,
|
|
20
|
+
modes = {},
|
|
21
|
+
style,
|
|
22
|
+
labelStyle,
|
|
23
|
+
accessibilityLabel
|
|
24
|
+
}) {
|
|
25
|
+
const paddingVertical = getVariableByName('tabItem/padding/vertical', modes) ?? 8;
|
|
26
|
+
const fontFamily = getVariableByName('tabItem/label/fontFamily', modes) ?? 'JioType Var';
|
|
27
|
+
const fontSize = getVariableByName('tabItem/label/size', modes) ?? 14;
|
|
28
|
+
const lineHeight = getVariableByName('tabItem/label/lineHeight', modes) ?? 17;
|
|
29
|
+
const idleLabelColor = getVariableByName('tabItem/idle/label/color', modes) ?? '#303338';
|
|
30
|
+
const activeLabelColor = getVariableByName('tabItem/active/label/color', modes) ?? '#cea15a';
|
|
31
|
+
const labelColor = active ? activeLabelColor : idleLabelColor;
|
|
32
|
+
const containerStyle = {
|
|
33
|
+
flexDirection: 'column',
|
|
34
|
+
alignItems: 'center',
|
|
35
|
+
justifyContent: 'center',
|
|
36
|
+
paddingVertical
|
|
37
|
+
};
|
|
38
|
+
const textStyle = {
|
|
39
|
+
color: labelColor,
|
|
40
|
+
fontFamily,
|
|
41
|
+
fontSize,
|
|
42
|
+
lineHeight,
|
|
43
|
+
fontWeight: '500'
|
|
44
|
+
};
|
|
45
|
+
const indicatorStyle = {
|
|
46
|
+
position: 'absolute',
|
|
47
|
+
bottom: 0,
|
|
48
|
+
left: 0,
|
|
49
|
+
right: 0,
|
|
50
|
+
height: 2,
|
|
51
|
+
backgroundColor: activeLabelColor,
|
|
52
|
+
borderRadius: 1
|
|
53
|
+
};
|
|
54
|
+
return /*#__PURE__*/_jsxs(Pressable, {
|
|
55
|
+
style: ({
|
|
56
|
+
pressed
|
|
57
|
+
}) => [containerStyle, pressed && {
|
|
58
|
+
opacity: 0.7
|
|
59
|
+
}, style],
|
|
60
|
+
onPress: onPress,
|
|
61
|
+
accessibilityRole: "tab",
|
|
62
|
+
accessibilityState: {
|
|
63
|
+
selected: active
|
|
64
|
+
},
|
|
65
|
+
accessibilityLabel: accessibilityLabel ?? label,
|
|
66
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
67
|
+
style: [textStyle, labelStyle],
|
|
68
|
+
children: label
|
|
69
|
+
}), active && /*#__PURE__*/_jsx(View, {
|
|
70
|
+
style: indicatorStyle
|
|
71
|
+
})]
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
export default TabItem;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { ScrollView, View } from 'react-native';
|
|
5
|
+
import { getVariableByName } from '../../design-tokens/figma-variables-resolver';
|
|
6
|
+
import TabItem from './TabItem';
|
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
/**
|
|
9
|
+
* Tabs container component that lays out TabItem children horizontally.
|
|
10
|
+
*
|
|
11
|
+
* The "Tab items" slot maps to React children — each child should be a
|
|
12
|
+
* `<TabItem>` element. The `modes` prop is automatically forwarded to
|
|
13
|
+
* every TabItem child so theming is consistent.
|
|
14
|
+
*
|
|
15
|
+
* @component
|
|
16
|
+
* @param {TabsProps} props
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* const [activeIndex, setActiveIndex] = useState(0);
|
|
21
|
+
*
|
|
22
|
+
* <Tabs modes={{ 'Color Mode': 'Light' }}>
|
|
23
|
+
* <TabItem label="Tab 1" active={activeIndex === 0} onPress={() => setActiveIndex(0)} />
|
|
24
|
+
* <TabItem label="Tab 2" active={activeIndex === 1} onPress={() => setActiveIndex(1)} />
|
|
25
|
+
* <TabItem label="Tab 3" active={activeIndex === 2} onPress={() => setActiveIndex(2)} />
|
|
26
|
+
* </Tabs>
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
function Tabs({
|
|
30
|
+
children,
|
|
31
|
+
modes = {},
|
|
32
|
+
scrollable = false,
|
|
33
|
+
style
|
|
34
|
+
}) {
|
|
35
|
+
const gap = getVariableByName('tabs/gap', modes) ?? 16;
|
|
36
|
+
const paddingTop = getVariableByName('tabs/padding/top', modes) ?? 0;
|
|
37
|
+
const paddingBottom = getVariableByName('tabs/padding/bottom', modes) ?? 0;
|
|
38
|
+
const paddingLeft = getVariableByName('tabs/padding/left', modes) ?? 0;
|
|
39
|
+
const paddingRight = getVariableByName('tabs/padding/right', modes) ?? 0;
|
|
40
|
+
|
|
41
|
+
// Forward modes to all TabItem children
|
|
42
|
+
const enhancedChildren = React.Children.map(children, child => {
|
|
43
|
+
if (/*#__PURE__*/React.isValidElement(child) && child.type === TabItem) {
|
|
44
|
+
const childElement = child;
|
|
45
|
+
return /*#__PURE__*/React.cloneElement(childElement, {
|
|
46
|
+
modes: {
|
|
47
|
+
...modes,
|
|
48
|
+
...(childElement.props.modes ?? {})
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
return child;
|
|
53
|
+
});
|
|
54
|
+
const containerStyle = {
|
|
55
|
+
flexDirection: 'row',
|
|
56
|
+
gap,
|
|
57
|
+
paddingTop,
|
|
58
|
+
paddingBottom,
|
|
59
|
+
paddingLeft,
|
|
60
|
+
paddingRight
|
|
61
|
+
};
|
|
62
|
+
if (scrollable) {
|
|
63
|
+
return /*#__PURE__*/_jsx(ScrollView, {
|
|
64
|
+
horizontal: true,
|
|
65
|
+
showsHorizontalScrollIndicator: false,
|
|
66
|
+
accessibilityRole: "tablist",
|
|
67
|
+
contentContainerStyle: [containerStyle, style],
|
|
68
|
+
children: enhancedChildren
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
return /*#__PURE__*/_jsx(View, {
|
|
72
|
+
style: [containerStyle, style],
|
|
73
|
+
accessibilityRole: "tablist",
|
|
74
|
+
children: enhancedChildren
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
export { TabItem };
|
|
78
|
+
export default Tabs;
|