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,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = AmountInput;
|
|
7
|
+
var _react = _interopRequireDefault(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 _MoneyValue = _interopRequireDefault(require("../MoneyValue/MoneyValue"));
|
|
12
|
+
var _NoteInput = _interopRequireDefault(require("../NoteInput/NoteInput"));
|
|
13
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
+
/**
|
|
16
|
+
* AmountInput component that combines MoneyValue and NoteInput from Figma design.
|
|
17
|
+
*
|
|
18
|
+
* @component
|
|
19
|
+
*/
|
|
20
|
+
function AmountInput({
|
|
21
|
+
moneyValueSlot,
|
|
22
|
+
noteInputSlot,
|
|
23
|
+
modes: propModes = {},
|
|
24
|
+
style
|
|
25
|
+
}) {
|
|
26
|
+
const {
|
|
27
|
+
modes: globalModes
|
|
28
|
+
} = (0, _JFSThemeProvider.useTokens)();
|
|
29
|
+
const modes = {
|
|
30
|
+
...globalModes,
|
|
31
|
+
...propModes
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
// Resolve tokens
|
|
35
|
+
const gap = Number((0, _figmaVariablesResolver.getVariableByName)('amountInput/gap', modes)) || 16;
|
|
36
|
+
const paddingHorizontal = Number((0, _figmaVariablesResolver.getVariableByName)('amountInput/padding/horizontal', modes)) || 0;
|
|
37
|
+
const paddingVertical = Number((0, _figmaVariablesResolver.getVariableByName)('amountInput/padding/vertical', modes)) || 0;
|
|
38
|
+
const containerStyle = {
|
|
39
|
+
flexDirection: 'column',
|
|
40
|
+
alignItems: 'center',
|
|
41
|
+
gap,
|
|
42
|
+
paddingHorizontal,
|
|
43
|
+
paddingVertical,
|
|
44
|
+
...style
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// Handle MoneyValue Slot
|
|
48
|
+
const renderMoneyValueSlot = () => {
|
|
49
|
+
if (/*#__PURE__*/_react.default.isValidElement(moneyValueSlot)) {
|
|
50
|
+
return /*#__PURE__*/_react.default.cloneElement(moneyValueSlot, {
|
|
51
|
+
modes
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
// Default fallback if no slot prop is provided
|
|
55
|
+
if (!moneyValueSlot) {
|
|
56
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_MoneyValue.default, {
|
|
57
|
+
modes: modes
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
return moneyValueSlot;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
// Handle NoteInput Slot
|
|
64
|
+
const renderNoteInputSlot = () => {
|
|
65
|
+
if (/*#__PURE__*/_react.default.isValidElement(noteInputSlot)) {
|
|
66
|
+
return /*#__PURE__*/_react.default.cloneElement(noteInputSlot, {
|
|
67
|
+
modes
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
// Default fallback if no slot prop is provided
|
|
71
|
+
if (!noteInputSlot) {
|
|
72
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_NoteInput.default, {
|
|
73
|
+
modes: modes
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
return noteInputSlot;
|
|
77
|
+
};
|
|
78
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
79
|
+
style: containerStyle,
|
|
80
|
+
children: [renderMoneyValueSlot(), renderNoteInputSlot()]
|
|
81
|
+
});
|
|
82
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "default", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _AmountInput.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _AmountInput = _interopRequireDefault(require("./AmountInput"));
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -8,7 +8,9 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
9
|
var _figmaVariablesResolver = require("../../design-tokens/figma-variables-resolver");
|
|
10
10
|
var _webPlatformUtils = require("../../utils/web-platform-utils");
|
|
11
|
+
var _Icon = _interopRequireDefault(require("../../icons/Icon"));
|
|
11
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
14
|
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); }
|
|
13
15
|
/**
|
|
14
16
|
* Button component that maps directly to the Figma design using design tokens.
|
|
@@ -35,6 +37,7 @@ function Button({
|
|
|
35
37
|
renderContent,
|
|
36
38
|
leading,
|
|
37
39
|
trailing,
|
|
40
|
+
icon,
|
|
38
41
|
modes = {},
|
|
39
42
|
onPress,
|
|
40
43
|
disabled = false,
|
|
@@ -60,8 +63,30 @@ function Button({
|
|
|
60
63
|
const lineHeight = (0, _figmaVariablesResolver.getVariableByName)('button/lineHeight', modes) || 19;
|
|
61
64
|
const fontSize = (0, _figmaVariablesResolver.getVariableByName)('button/fontSize', modes) || 16;
|
|
62
65
|
const textColor = (0, _figmaVariablesResolver.getVariableByName)('button/foreground', modes) || '#0f0d0a';
|
|
66
|
+
const iconColor = (0, _figmaVariablesResolver.getVariableByName)('button/icon/color', modes) ?? textColor;
|
|
67
|
+
const iconSize = (0, _figmaVariablesResolver.getVariableByName)('button/icon/size', modes) ?? 18;
|
|
68
|
+
const [isHovered, setIsHovered] = (0, _react.useState)(false);
|
|
69
|
+
const [isPressed, setIsPressed] = (0, _react.useState)(false);
|
|
70
|
+
const hoverModes = {
|
|
71
|
+
...modes,
|
|
72
|
+
"Button / State": "Hover"
|
|
73
|
+
};
|
|
74
|
+
const hoverBg = (0, _figmaVariablesResolver.getVariableByName)('button/background', hoverModes) || backgroundColor;
|
|
75
|
+
const hoverBorderColor = (0, _figmaVariablesResolver.getVariableByName)('button/border/color', hoverModes) || borderColor;
|
|
76
|
+
const hoverTextColor = (0, _figmaVariablesResolver.getVariableByName)('button/foreground', hoverModes) || textColor;
|
|
77
|
+
const hoverIconColor = (0, _figmaVariablesResolver.getVariableByName)('button/icon/color', hoverModes) ?? hoverTextColor;
|
|
78
|
+
const pressedModes = {
|
|
79
|
+
...modes,
|
|
80
|
+
"Button / State": "Pressed"
|
|
81
|
+
};
|
|
82
|
+
const pressedBg = (0, _figmaVariablesResolver.getVariableByName)('button/background', pressedModes) || backgroundColor;
|
|
83
|
+
const pressedBorderColor = (0, _figmaVariablesResolver.getVariableByName)('button/border/color', pressedModes) || borderColor;
|
|
84
|
+
const pressedTextColor = (0, _figmaVariablesResolver.getVariableByName)('button/foreground', pressedModes) || textColor;
|
|
85
|
+
const pressedIconColor = (0, _figmaVariablesResolver.getVariableByName)('button/icon/color', pressedModes) ?? pressedTextColor;
|
|
86
|
+
const activeTextColor = isPressed && !disabled ? pressedTextColor : isHovered && !disabled ? hoverTextColor : textColor;
|
|
87
|
+
const activeIconColor = isPressed && !disabled ? pressedIconColor : isHovered && !disabled ? hoverIconColor : iconColor;
|
|
63
88
|
const baseLabelTextStyle = {
|
|
64
|
-
color:
|
|
89
|
+
color: activeTextColor,
|
|
65
90
|
fontFamily,
|
|
66
91
|
fontWeight,
|
|
67
92
|
fontSize,
|
|
@@ -115,22 +140,13 @@ function Button({
|
|
|
115
140
|
accessibilityLabel: defaultAccessibilityLabel,
|
|
116
141
|
webAccessibilityProps
|
|
117
142
|
});
|
|
118
|
-
|
|
119
|
-
// Interaction states (placeholders for visuals; tweak later)
|
|
120
|
-
const [isFocused, setIsFocused] = (0, _react.useState)(false);
|
|
121
|
-
const [isHovered, setIsHovered] = (0, _react.useState)(false);
|
|
122
|
-
const pressedStyle = {
|
|
123
|
-
transform: [{
|
|
124
|
-
scale: 0.995
|
|
125
|
-
}],
|
|
126
|
-
backgroundColor: '#b88940'
|
|
127
|
-
};
|
|
128
|
-
const focusStyle = {
|
|
129
|
-
borderWidth: 1,
|
|
130
|
-
borderColor: '#222'
|
|
131
|
-
};
|
|
132
143
|
const hoverStyle = {
|
|
133
|
-
|
|
144
|
+
backgroundColor: hoverBg,
|
|
145
|
+
borderColor: hoverBorderColor
|
|
146
|
+
};
|
|
147
|
+
const pressedStyle = {
|
|
148
|
+
backgroundColor: pressedBg,
|
|
149
|
+
borderColor: pressedBorderColor
|
|
134
150
|
};
|
|
135
151
|
if (__DEV__) {
|
|
136
152
|
if (children && labelStyle) {
|
|
@@ -155,21 +171,13 @@ function Button({
|
|
|
155
171
|
onPress
|
|
156
172
|
} : {}),
|
|
157
173
|
onPressIn: e => {
|
|
158
|
-
;
|
|
174
|
+
setIsPressed(true);
|
|
159
175
|
rest?.onPressIn?.(e);
|
|
160
176
|
},
|
|
161
177
|
onPressOut: e => {
|
|
162
|
-
;
|
|
178
|
+
setIsPressed(false);
|
|
163
179
|
rest?.onPressOut?.(e);
|
|
164
180
|
},
|
|
165
|
-
onFocus: e => {
|
|
166
|
-
setIsFocused(true);
|
|
167
|
-
rest?.onFocus?.(e);
|
|
168
|
-
},
|
|
169
|
-
onBlur: e => {
|
|
170
|
-
setIsFocused(false);
|
|
171
|
-
rest?.onBlur?.(e);
|
|
172
|
-
},
|
|
173
181
|
onHoverIn: e => {
|
|
174
182
|
setIsHovered(true);
|
|
175
183
|
rest?.onHoverIn?.(e);
|
|
@@ -180,12 +188,21 @@ function Button({
|
|
|
180
188
|
},
|
|
181
189
|
style: ({
|
|
182
190
|
pressed
|
|
183
|
-
}) => [containerBaseStyle,
|
|
191
|
+
}) => [containerBaseStyle, isHovered && !disabled ? hoverStyle : null, (pressed || isPressed) && !disabled ? pressedStyle : null, style],
|
|
184
192
|
...webProps,
|
|
185
193
|
children: [leading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
186
194
|
style: leadingAccessoryStyle,
|
|
187
195
|
children: leading
|
|
188
|
-
}) : null, content,
|
|
196
|
+
}) : null, content, icon ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
197
|
+
style: trailingAccessoryStyle,
|
|
198
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
|
|
199
|
+
name: icon,
|
|
200
|
+
size: iconSize,
|
|
201
|
+
color: activeIconColor,
|
|
202
|
+
accessibilityElementsHidden: true,
|
|
203
|
+
importantForAccessibility: "no"
|
|
204
|
+
})
|
|
205
|
+
}) : trailing ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
189
206
|
style: trailingAccessoryStyle,
|
|
190
207
|
children: trailing
|
|
191
208
|
}) : null]
|
|
@@ -0,0 +1,76 @@
|
|
|
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 _ProductLabel = _interopRequireDefault(require("../ProductLabel/ProductLabel"));
|
|
11
|
+
var _reactUtils = require("../../utils/react-utils");
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
+
/**
|
|
15
|
+
* CardProviderInfo displays a product header (ProductLabel) followed by a
|
|
16
|
+
* 2-column grid of children (typically StatItem instances).
|
|
17
|
+
*
|
|
18
|
+
* @component
|
|
19
|
+
* @param {CardProviderInfoProps} props
|
|
20
|
+
*/
|
|
21
|
+
function CardProviderInfo({
|
|
22
|
+
label = 'Gold',
|
|
23
|
+
imageSource,
|
|
24
|
+
children,
|
|
25
|
+
modes = {},
|
|
26
|
+
style
|
|
27
|
+
}) {
|
|
28
|
+
const background = (0, _figmaVariablesResolver.getVariableByName)('card/providerInfo/background', modes) ?? '#fef4e5';
|
|
29
|
+
const border = (0, _figmaVariablesResolver.getVariableByName)('card/providerInfo/border', modes) ?? '#fef4e5';
|
|
30
|
+
const borderWidthVal = (0, _figmaVariablesResolver.getVariableByName)('card/providerInfo/borderWidth', modes) ?? 1;
|
|
31
|
+
const padding = (0, _figmaVariablesResolver.getVariableByName)('card/providerInfo/padding', modes) ?? 20;
|
|
32
|
+
const gap = (0, _figmaVariablesResolver.getVariableByName)('card/providerInfo/gap', modes) ?? 20;
|
|
33
|
+
const radius = (0, _figmaVariablesResolver.getVariableByName)('card/providerInfo/radius', modes) ?? 16;
|
|
34
|
+
const gridGap = (0, _figmaVariablesResolver.getVariableByName)('card/providerInfo/grid/gap', modes) ?? 8;
|
|
35
|
+
const containerStyle = {
|
|
36
|
+
backgroundColor: background,
|
|
37
|
+
borderColor: border,
|
|
38
|
+
borderWidth: borderWidthVal,
|
|
39
|
+
borderStyle: 'solid',
|
|
40
|
+
padding: padding,
|
|
41
|
+
gap: gap,
|
|
42
|
+
borderRadius: radius
|
|
43
|
+
};
|
|
44
|
+
const gridGapNum = gridGap;
|
|
45
|
+
const clonedChildren = children ? (0, _reactUtils.cloneChildrenWithModes)(children, modes) : [];
|
|
46
|
+
const childArray = _react.default.Children.toArray(clonedChildren);
|
|
47
|
+
const rows = [];
|
|
48
|
+
for (let i = 0; i < childArray.length; i += 2) {
|
|
49
|
+
rows.push(childArray.slice(i, i + 2));
|
|
50
|
+
}
|
|
51
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
52
|
+
style: [containerStyle, style],
|
|
53
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ProductLabel.default, {
|
|
54
|
+
label: label,
|
|
55
|
+
imageSource: imageSource,
|
|
56
|
+
modes: modes
|
|
57
|
+
}), childArray.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
58
|
+
style: {
|
|
59
|
+
rowGap: gridGapNum
|
|
60
|
+
},
|
|
61
|
+
children: rows.map((row, i) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
62
|
+
style: {
|
|
63
|
+
flexDirection: 'row',
|
|
64
|
+
columnGap: gridGapNum
|
|
65
|
+
},
|
|
66
|
+
children: row.map((child, j) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
67
|
+
style: {
|
|
68
|
+
flex: 1
|
|
69
|
+
},
|
|
70
|
+
children: child
|
|
71
|
+
}, j))
|
|
72
|
+
}, i))
|
|
73
|
+
})]
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
var _default = exports.default = CardProviderInfo;
|
|
@@ -0,0 +1,208 @@
|
|
|
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 _reactNativeSvg = _interopRequireWildcard(require("react-native-svg"));
|
|
10
|
+
var _figmaVariablesResolver = require("../../design-tokens/figma-variables-resolver");
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
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); }
|
|
13
|
+
/**
|
|
14
|
+
* Tracks whether the last user interaction was a keyboard event (Tab).
|
|
15
|
+
* Capture-phase document listeners fire before any element-level handlers,
|
|
16
|
+
* so the flag is always up-to-date when onFocus runs.
|
|
17
|
+
*/function useFocusVisible() {
|
|
18
|
+
const [isFocusVisible, setIsFocusVisible] = (0, _react.useState)(false);
|
|
19
|
+
const hadKeyboardEventRef = (0, _react.useRef)(false);
|
|
20
|
+
(0, _react.useEffect)(() => {
|
|
21
|
+
if (_reactNative.Platform.OS !== 'web' || typeof document === 'undefined') return;
|
|
22
|
+
const onKeyDown = e => {
|
|
23
|
+
if (e.key === 'Tab') hadKeyboardEventRef.current = true;
|
|
24
|
+
};
|
|
25
|
+
const onPointerDown = () => {
|
|
26
|
+
hadKeyboardEventRef.current = false;
|
|
27
|
+
};
|
|
28
|
+
document.addEventListener('keydown', onKeyDown, true);
|
|
29
|
+
document.addEventListener('mousedown', onPointerDown, true);
|
|
30
|
+
document.addEventListener('touchstart', onPointerDown, true);
|
|
31
|
+
return () => {
|
|
32
|
+
document.removeEventListener('keydown', onKeyDown, true);
|
|
33
|
+
document.removeEventListener('mousedown', onPointerDown, true);
|
|
34
|
+
document.removeEventListener('touchstart', onPointerDown, true);
|
|
35
|
+
};
|
|
36
|
+
}, []);
|
|
37
|
+
const onFocus = (0, _react.useCallback)(() => {
|
|
38
|
+
if (hadKeyboardEventRef.current) setIsFocusVisible(true);
|
|
39
|
+
}, []);
|
|
40
|
+
const onBlur = (0, _react.useCallback)(() => {
|
|
41
|
+
setIsFocusVisible(false);
|
|
42
|
+
}, []);
|
|
43
|
+
return {
|
|
44
|
+
isFocusVisible,
|
|
45
|
+
focusHandlers: {
|
|
46
|
+
onFocus,
|
|
47
|
+
onBlur
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Checkbox component that maps directly to the Figma design using design tokens.
|
|
53
|
+
*
|
|
54
|
+
* Supports 8 visual states: Idle, Hover, Focus, Selected, Selected Hover,
|
|
55
|
+
* Focus Selected, Disabled, and Disabled Active. All styling is driven by
|
|
56
|
+
* design tokens with optional mode overrides.
|
|
57
|
+
*
|
|
58
|
+
* @component
|
|
59
|
+
* @param {CheckboxProps} props
|
|
60
|
+
*/
|
|
61
|
+
function Checkbox({
|
|
62
|
+
checked: controlledChecked,
|
|
63
|
+
defaultChecked = false,
|
|
64
|
+
onValueChange,
|
|
65
|
+
disabled = false,
|
|
66
|
+
modes = {},
|
|
67
|
+
style,
|
|
68
|
+
accessibilityLabel
|
|
69
|
+
}) {
|
|
70
|
+
const isControlled = controlledChecked !== undefined;
|
|
71
|
+
const [internalChecked, setInternalChecked] = (0, _react.useState)(defaultChecked);
|
|
72
|
+
const isChecked = isControlled ? controlledChecked : internalChecked;
|
|
73
|
+
const [isHovered, setIsHovered] = (0, _react.useState)(false);
|
|
74
|
+
const {
|
|
75
|
+
isFocusVisible,
|
|
76
|
+
focusHandlers
|
|
77
|
+
} = useFocusVisible();
|
|
78
|
+
const size = (0, _figmaVariablesResolver.getVariableByName)('checkbox/size', modes) ?? 18;
|
|
79
|
+
const radius = (0, _figmaVariablesResolver.getVariableByName)('checkbox/radius', modes) ?? 4;
|
|
80
|
+
const strokeWidth = (0, _figmaVariablesResolver.getVariableByName)('strokeWidth', modes) ?? 1;
|
|
81
|
+
const idleStroke = (0, _figmaVariablesResolver.getVariableByName)('checkbox/idle/stroke/color', modes) ?? '#666666';
|
|
82
|
+
const hoverFill = (0, _figmaVariablesResolver.getVariableByName)('checkbox/hover/fill/color', modes) ?? 'rgba(0,0,0,0.1)';
|
|
83
|
+
const hoverStroke = (0, _figmaVariablesResolver.getVariableByName)('checkbox/hover/stroke/color', modes) ?? '#666666';
|
|
84
|
+
const hoverRing = (0, _figmaVariablesResolver.getVariableByName)('checkbox/hoverRing', modes) ?? 4;
|
|
85
|
+
const hoverShadow = (0, _figmaVariablesResolver.getVariableByName)('hover/boxShadow', modes) ?? 'rgba(0,0,0,0.1)';
|
|
86
|
+
const selectedFill = (0, _figmaVariablesResolver.getVariableByName)('checkbox/selected/fill/color', modes) ?? '#cea15a';
|
|
87
|
+
const selectedStroke = (0, _figmaVariablesResolver.getVariableByName)('checkbox/selected/stroke/color', modes) ?? '#0d0d0d';
|
|
88
|
+
const selectedMarkColor = (0, _figmaVariablesResolver.getVariableByName)('checkbox/selected/mark/color', modes) ?? '#0f0d0a';
|
|
89
|
+
const focusFill = (0, _figmaVariablesResolver.getVariableByName)('checkbox/focus/fill/color', modes) ?? '#ffffff';
|
|
90
|
+
const focusStroke = (0, _figmaVariablesResolver.getVariableByName)('checkbox/focus/stroke/color', modes) ?? '#666666';
|
|
91
|
+
const focusShadowColor = (0, _figmaVariablesResolver.getVariableByName)('checkbox/focus/shadow/color', modes) ?? '#12fc2e';
|
|
92
|
+
const focusSpread = (0, _figmaVariablesResolver.getVariableByName)('checkbox/focus/spread/effect', modes) ?? 2;
|
|
93
|
+
const disabledStroke = (0, _figmaVariablesResolver.getVariableByName)('checkbox/disabled/stroke/color', modes) ?? '#999999';
|
|
94
|
+
const disabledActiveBg = (0, _figmaVariablesResolver.getVariableByName)('checkbox/disabledActive/background/color', modes) ?? '#f6d19a';
|
|
95
|
+
const disabledActiveBorder = (0, _figmaVariablesResolver.getVariableByName)('checkbox/disabledActive/border/color', modes) ?? '#f6d19a';
|
|
96
|
+
const disabledActiveMark = (0, _figmaVariablesResolver.getVariableByName)('checkbox/disabledActive/mark/color', modes) ?? '#474d54';
|
|
97
|
+
const selectedHoverShadow = (0, _figmaVariablesResolver.getVariableByName)('selected/hover/boxShadow', modes) ?? 'rgba(0,0,0,0.1)';
|
|
98
|
+
const hoverShadowSize = (0, _figmaVariablesResolver.getVariableByName)('hover/boxShadow/size', modes) ?? 4;
|
|
99
|
+
const handlePress = (0, _react.useCallback)(() => {
|
|
100
|
+
if (disabled) return;
|
|
101
|
+
const next = !isChecked;
|
|
102
|
+
if (!isControlled) {
|
|
103
|
+
setInternalChecked(next);
|
|
104
|
+
}
|
|
105
|
+
onValueChange?.(next);
|
|
106
|
+
}, [disabled, isChecked, isControlled, onValueChange]);
|
|
107
|
+
const resolveStyle = () => {
|
|
108
|
+
const base = {
|
|
109
|
+
width: size,
|
|
110
|
+
height: size,
|
|
111
|
+
borderRadius: radius,
|
|
112
|
+
borderWidth: strokeWidth,
|
|
113
|
+
alignItems: 'center',
|
|
114
|
+
justifyContent: 'center',
|
|
115
|
+
overflow: 'hidden'
|
|
116
|
+
};
|
|
117
|
+
if (disabled && isChecked) {
|
|
118
|
+
return {
|
|
119
|
+
...base,
|
|
120
|
+
backgroundColor: disabledActiveBg,
|
|
121
|
+
borderColor: disabledActiveBorder
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
if (disabled) {
|
|
125
|
+
return {
|
|
126
|
+
...base,
|
|
127
|
+
borderColor: disabledStroke
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
if (isChecked && isFocusVisible) {
|
|
131
|
+
return {
|
|
132
|
+
...base,
|
|
133
|
+
backgroundColor: selectedFill,
|
|
134
|
+
borderColor: selectedStroke,
|
|
135
|
+
...boxShadow(`0px 0px 0px ${focusSpread}px ${focusShadowColor}`)
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
if (isChecked && isHovered) {
|
|
139
|
+
return {
|
|
140
|
+
...base,
|
|
141
|
+
backgroundColor: selectedFill,
|
|
142
|
+
borderColor: selectedStroke,
|
|
143
|
+
...boxShadow(`0px 0px 0px ${hoverShadowSize}px ${selectedHoverShadow}`)
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
if (isChecked) {
|
|
147
|
+
return {
|
|
148
|
+
...base,
|
|
149
|
+
backgroundColor: selectedFill,
|
|
150
|
+
borderColor: selectedStroke
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
if (isFocusVisible) {
|
|
154
|
+
return {
|
|
155
|
+
...base,
|
|
156
|
+
backgroundColor: focusFill,
|
|
157
|
+
borderColor: focusStroke,
|
|
158
|
+
...boxShadow(`0px 0px 0px ${focusSpread}px ${focusShadowColor}`)
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
if (isHovered) {
|
|
162
|
+
return {
|
|
163
|
+
...base,
|
|
164
|
+
backgroundColor: hoverFill,
|
|
165
|
+
borderColor: hoverStroke,
|
|
166
|
+
...boxShadow(`0px 0px 0px ${hoverRing}px ${hoverShadow}`)
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
return {
|
|
170
|
+
...base,
|
|
171
|
+
borderColor: idleStroke
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
const markColor = disabled && isChecked ? disabledActiveMark : selectedMarkColor;
|
|
175
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
|
|
176
|
+
style: [resolveStyle(), style],
|
|
177
|
+
onPress: handlePress,
|
|
178
|
+
disabled: disabled,
|
|
179
|
+
onHoverIn: () => setIsHovered(true),
|
|
180
|
+
onHoverOut: () => setIsHovered(false),
|
|
181
|
+
...focusHandlers,
|
|
182
|
+
accessibilityRole: "checkbox",
|
|
183
|
+
accessibilityState: {
|
|
184
|
+
checked: isChecked,
|
|
185
|
+
disabled
|
|
186
|
+
},
|
|
187
|
+
accessibilityLabel: accessibilityLabel,
|
|
188
|
+
children: isChecked && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeSvg.default, {
|
|
189
|
+
width: 12,
|
|
190
|
+
height: 9,
|
|
191
|
+
viewBox: "0 0 12 9",
|
|
192
|
+
fill: "none",
|
|
193
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeSvg.Path, {
|
|
194
|
+
d: "M4.00091 8.66939C3.91321 8.6699 3.82628 8.65309 3.74509 8.61991C3.6639 8.58673 3.59006 8.53785 3.52779 8.47606L0.195972 5.14273C0.0704931 5.01719 -1.86978e-09 4.84693 0 4.66939C1.86978e-09 4.49186 0.0704931 4.3216 0.195972 4.19606C0.321451 4.07053 0.491636 4 0.66909 4C0.846544 4 1.01673 4.07053 1.14221 4.19606L4.00091 7.06273L10.8578 0.196061C10.9833 0.0705253 11.1535 0 11.3309 0C11.5084 0 11.6785 0.0705253 11.804 0.196061C11.9295 0.321597 12 0.49186 12 0.669394C12 0.846929 11.9295 1.01719 11.804 1.14273L4.47403 8.47606C4.41176 8.53785 4.33792 8.58673 4.25673 8.61991C4.17554 8.65309 4.08861 8.6699 4.00091 8.66939Z",
|
|
195
|
+
fill: markColor
|
|
196
|
+
})
|
|
197
|
+
})
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
function boxShadow(value) {
|
|
201
|
+
if (_reactNative.Platform.OS === 'web') {
|
|
202
|
+
return {
|
|
203
|
+
boxShadow: value
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
return {};
|
|
207
|
+
}
|
|
208
|
+
var _default = exports.default = Checkbox;
|
|
@@ -21,6 +21,7 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
21
21
|
function EmptyState({
|
|
22
22
|
title = "No payments to show",
|
|
23
23
|
description = "Start by paying bills, recharge or your friends",
|
|
24
|
+
showDescription = true,
|
|
24
25
|
iconSlot,
|
|
25
26
|
buttonSlot,
|
|
26
27
|
modes: propModes = {},
|
|
@@ -116,7 +117,7 @@ function EmptyState({
|
|
|
116
117
|
children: [iconContent, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
117
118
|
style: titleStyle,
|
|
118
119
|
children: title
|
|
119
|
-
}), description ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
120
|
+
}), showDescription && description ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
120
121
|
style: bodyStyle,
|
|
121
122
|
children: description
|
|
122
123
|
}) : null]
|