jfs-components 0.0.44 → 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 +31 -28
- package/lib/commonjs/components/CardProviderInfo/CardProviderInfo.js +76 -0
- package/lib/commonjs/components/EmptyState/EmptyState.js +2 -1
- 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/SwappableAmount/SwappableAmount.js +71 -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 +63 -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 +31 -28
- package/lib/module/components/CardProviderInfo/CardProviderInfo.js +71 -0
- package/lib/module/components/EmptyState/EmptyState.js +2 -1
- 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/SwappableAmount/SwappableAmount.js +66 -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 +10 -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/CardProviderInfo/CardProviderInfo.d.ts +24 -0
- package/lib/typescript/src/components/EmptyState/EmptyState.d.ts +6 -1
- 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/SwappableAmount/SwappableAmount.d.ts +22 -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 +9 -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 +27 -20
- package/src/components/CardProviderInfo/CardProviderInfo.tsx +81 -0
- package/src/components/EmptyState/EmptyState.tsx +7 -1
- 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/SwappableAmount/SwappableAmount.tsx +92 -0
- package/src/components/Text/Text.tsx +48 -0
- package/src/components/Toggle/Toggle.tsx +122 -0
- package/src/components/index.ts +9 -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,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,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,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { Text as RNText } from 'react-native';
|
|
5
|
+
import { getVariableByName } from '../../design-tokens/figma-variables-resolver';
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
function Text({
|
|
8
|
+
text = 'Korem ipsum ',
|
|
9
|
+
modes = {},
|
|
10
|
+
style,
|
|
11
|
+
numberOfLines
|
|
12
|
+
}) {
|
|
13
|
+
const foreground = getVariableByName('text/foreground', modes) ?? '#000000';
|
|
14
|
+
const fontFamily = getVariableByName('text/fontFamily', modes) ?? 'JioType';
|
|
15
|
+
const fontSize = getVariableByName('text/fontSize', modes) ?? 14;
|
|
16
|
+
const fontWeight = getVariableByName('text/fontWeight', modes) ?? '500';
|
|
17
|
+
const lineHeight = getVariableByName('text/lineHeight', modes) ?? 20;
|
|
18
|
+
const letterSpacing = getVariableByName('text/letterSpacing', modes) ?? -0.5;
|
|
19
|
+
const textStyle = {
|
|
20
|
+
color: foreground,
|
|
21
|
+
fontFamily: fontFamily,
|
|
22
|
+
fontSize: fontSize,
|
|
23
|
+
fontWeight: String(fontWeight),
|
|
24
|
+
lineHeight: lineHeight,
|
|
25
|
+
letterSpacing: letterSpacing
|
|
26
|
+
};
|
|
27
|
+
return /*#__PURE__*/_jsx(RNText, {
|
|
28
|
+
style: [textStyle, style],
|
|
29
|
+
numberOfLines: numberOfLines,
|
|
30
|
+
children: text
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
export default Text;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { useCallback, useState } from 'react';
|
|
4
|
+
import { Pressable, View, Platform } from 'react-native';
|
|
5
|
+
import { getVariableByName } from '../../design-tokens/figma-variables-resolver';
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
/**
|
|
8
|
+
* Toggle (switch) component that maps directly to the Figma design using design tokens.
|
|
9
|
+
*
|
|
10
|
+
* Supports controlled and uncontrolled usage, on/off states, and disabled state.
|
|
11
|
+
* All styling is driven by design tokens with optional mode overrides.
|
|
12
|
+
*
|
|
13
|
+
* @component
|
|
14
|
+
* @param {ToggleProps} props
|
|
15
|
+
*/
|
|
16
|
+
function Toggle({
|
|
17
|
+
value: controlledValue,
|
|
18
|
+
defaultValue = false,
|
|
19
|
+
onValueChange,
|
|
20
|
+
disabled = false,
|
|
21
|
+
modes = {},
|
|
22
|
+
style,
|
|
23
|
+
accessibilityLabel
|
|
24
|
+
}) {
|
|
25
|
+
const isControlled = controlledValue !== undefined;
|
|
26
|
+
const [internalValue, setInternalValue] = useState(defaultValue);
|
|
27
|
+
const isOn = isControlled ? controlledValue : internalValue;
|
|
28
|
+
const toggleState = disabled ? isOn ? 'Disabled On' : 'Disabled Off' : isOn ? 'On' : 'Off';
|
|
29
|
+
const resolvedModes = {
|
|
30
|
+
...modes,
|
|
31
|
+
'Toggle States': toggleState
|
|
32
|
+
};
|
|
33
|
+
const width = getVariableByName('toggle/width', resolvedModes) ?? 52;
|
|
34
|
+
const radius = getVariableByName('toggle/radius', resolvedModes) ?? 100;
|
|
35
|
+
const paddingTrack = getVariableByName('toggle/padding/track', resolvedModes) ?? 3;
|
|
36
|
+
const background = getVariableByName('toggle/background', resolvedModes) ?? (isOn ? '#5d00b5' : '#c7c7cc');
|
|
37
|
+
const thumbSize = getVariableByName('toggle/thumb/size', resolvedModes) ?? 25;
|
|
38
|
+
const thumbRadius = getVariableByName('toggle/thumb/radius', resolvedModes) ?? 100;
|
|
39
|
+
const thumbBackground = getVariableByName('toggle/thumb/background', resolvedModes) ?? '#ffffff';
|
|
40
|
+
const thumbShadowColor = getVariableByName('toggle/thumb/shadow/color', resolvedModes) ?? 'rgba(0,0,0,0.18)';
|
|
41
|
+
const thumbShadowRadius = getVariableByName('toggle/thumb/shadow/radius', resolvedModes) ?? 4;
|
|
42
|
+
const thumbShadowOffsetX = getVariableByName('toggle/thumb/shadow/offsetX', resolvedModes) ?? 0;
|
|
43
|
+
const thumbShadowOffsetY = getVariableByName('toggle/thumb/shadow/offsetY', resolvedModes) ?? 2;
|
|
44
|
+
const trackHeight = thumbSize + paddingTrack * 2;
|
|
45
|
+
const handlePress = useCallback(() => {
|
|
46
|
+
if (disabled) return;
|
|
47
|
+
const next = !isOn;
|
|
48
|
+
if (!isControlled) {
|
|
49
|
+
setInternalValue(next);
|
|
50
|
+
}
|
|
51
|
+
onValueChange?.(next);
|
|
52
|
+
}, [disabled, isOn, isControlled, onValueChange]);
|
|
53
|
+
const trackStyle = {
|
|
54
|
+
width: width,
|
|
55
|
+
height: trackHeight,
|
|
56
|
+
borderRadius: radius,
|
|
57
|
+
backgroundColor: background,
|
|
58
|
+
padding: paddingTrack,
|
|
59
|
+
justifyContent: 'center',
|
|
60
|
+
alignItems: isOn ? 'flex-end' : 'flex-start',
|
|
61
|
+
opacity: disabled ? 0.5 : 1
|
|
62
|
+
};
|
|
63
|
+
const thumbShadow = Platform.OS === 'web' ? {
|
|
64
|
+
boxShadow: `${thumbShadowOffsetX}px ${thumbShadowOffsetY}px ${thumbShadowRadius}px 0px ${thumbShadowColor}`
|
|
65
|
+
} : {
|
|
66
|
+
shadowColor: thumbShadowColor,
|
|
67
|
+
shadowOffset: {
|
|
68
|
+
width: thumbShadowOffsetX,
|
|
69
|
+
height: thumbShadowOffsetY
|
|
70
|
+
},
|
|
71
|
+
shadowRadius: thumbShadowRadius,
|
|
72
|
+
shadowOpacity: 1,
|
|
73
|
+
elevation: 4
|
|
74
|
+
};
|
|
75
|
+
const thumbStyle = {
|
|
76
|
+
width: thumbSize,
|
|
77
|
+
height: thumbSize,
|
|
78
|
+
borderRadius: thumbRadius,
|
|
79
|
+
backgroundColor: thumbBackground,
|
|
80
|
+
...thumbShadow
|
|
81
|
+
};
|
|
82
|
+
return /*#__PURE__*/_jsx(Pressable, {
|
|
83
|
+
style: [trackStyle, style],
|
|
84
|
+
onPress: handlePress,
|
|
85
|
+
disabled: disabled,
|
|
86
|
+
accessibilityRole: "switch",
|
|
87
|
+
accessibilityState: {
|
|
88
|
+
checked: isOn,
|
|
89
|
+
disabled
|
|
90
|
+
},
|
|
91
|
+
accessibilityLabel: accessibilityLabel,
|
|
92
|
+
children: /*#__PURE__*/_jsx(View, {
|
|
93
|
+
style: thumbStyle
|
|
94
|
+
})
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
export default Toggle;
|
|
@@ -51,6 +51,7 @@ export { default as Accordion } from './Accordion/Accordion';
|
|
|
51
51
|
export { default as ActionTile } from './ActionTile/ActionTile';
|
|
52
52
|
export { default as Balance } from './Balance/Balance';
|
|
53
53
|
export { default as ButtonGroup } from './ButtonGroup/ButtonGroup';
|
|
54
|
+
export { default as CardProviderInfo } from './CardProviderInfo/CardProviderInfo';
|
|
54
55
|
export { default as ChipSelect } from './ChipSelect/ChipSelect';
|
|
55
56
|
export { default as InputSearch } from './InputSearch/InputSearch';
|
|
56
57
|
export { default as SupportText } from './SupportText/SupportText';
|
|
@@ -60,4 +61,12 @@ export { default as Tabs } from './Tabs/Tabs';
|
|
|
60
61
|
export { default as TabItem } from './Tabs/TabItem';
|
|
61
62
|
export { default as Toast } from './Toast/Toast';
|
|
62
63
|
export { default as ToastProvider } from './Toast/ToastProvider';
|
|
63
|
-
export { useToast, addToast, closeToast, closeAll } from './Toast/useToast';
|
|
64
|
+
export { useToast, addToast, closeToast, closeAll } from './Toast/useToast';
|
|
65
|
+
export { default as AmountInput } from './AmountInput/AmountInput';
|
|
66
|
+
export { default as PortfolioHero } from './PortfolioHero/PortfolioHero';
|
|
67
|
+
export { default as ProductLabel } from './ProductLabel/ProductLabel';
|
|
68
|
+
export { default as SwappableAmount } from './SwappableAmount/SwappableAmount';
|
|
69
|
+
export { default as OTP } from './OTP/OTP';
|
|
70
|
+
export { default as StatItem } from './StatItem/StatItem';
|
|
71
|
+
export { default as Text } from './Text/Text';
|
|
72
|
+
export { default as Toggle } from './Toggle/Toggle';
|