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,148 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = StatusHero;
|
|
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 _IconCapsule = _interopRequireDefault(require("../IconCapsule/IconCapsule"));
|
|
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 _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
|
+
/**
|
|
17
|
+
* StatusHero component that displays a hero section for payment/transaction status screens.
|
|
18
|
+
*
|
|
19
|
+
* Contains a media slot (defaults to IconCapsule + MoneyValue) and a content area
|
|
20
|
+
* with an optional title and a subtitle. All visual values are resolved from Figma
|
|
21
|
+
* design tokens via `getVariableByName`.
|
|
22
|
+
*
|
|
23
|
+
* @component
|
|
24
|
+
* @example
|
|
25
|
+
* ```tsx
|
|
26
|
+
* <StatusHero
|
|
27
|
+
* iconName="ic_confirm"
|
|
28
|
+
* value="50"
|
|
29
|
+
* currency="INR"
|
|
30
|
+
* title="You're set to make payments"
|
|
31
|
+
* subtitle="₹50 will be auto-invested daily, stay consistent & stay golden."
|
|
32
|
+
* modes={{ 'Color Mode': 'Light' }}
|
|
33
|
+
* />
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
function StatusHero({
|
|
37
|
+
renderMedia,
|
|
38
|
+
title = "You're set to make payments",
|
|
39
|
+
showTitle = true,
|
|
40
|
+
subtitle = '₹50 will be auto-invested daily,\nstay consistent & stay golden.',
|
|
41
|
+
iconName = 'ic_confirm',
|
|
42
|
+
value = '50',
|
|
43
|
+
currency = 'INR',
|
|
44
|
+
modes: propModes = {},
|
|
45
|
+
style
|
|
46
|
+
}) {
|
|
47
|
+
const {
|
|
48
|
+
modes: globalModes
|
|
49
|
+
} = (0, _JFSThemeProvider.useTokens)();
|
|
50
|
+
const modes = {
|
|
51
|
+
...globalModes,
|
|
52
|
+
...propModes
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
// Container
|
|
56
|
+
const gap = Number((0, _figmaVariablesResolver.getVariableByName)('statusHero/gap', modes)) || 12;
|
|
57
|
+
const padding = Number((0, _figmaVariablesResolver.getVariableByName)('statusHero/padding', modes)) || 8;
|
|
58
|
+
|
|
59
|
+
// Media slot wrap (gap between icon and money value in default slot)
|
|
60
|
+
const slotWrapGap = Number((0, _figmaVariablesResolver.getVariableByName)('statusHero/slotWrap/gap', modes)) || 46;
|
|
61
|
+
|
|
62
|
+
// Content wrap
|
|
63
|
+
const contentWrapGap = Number((0, _figmaVariablesResolver.getVariableByName)('statusHero/contentWrap/gap', modes)) || 12;
|
|
64
|
+
|
|
65
|
+
// Title
|
|
66
|
+
const titleColor = (0, _figmaVariablesResolver.getVariableByName)('statusHero/title/foreground', modes) || '#0c0d10';
|
|
67
|
+
const titleFontSize = Number((0, _figmaVariablesResolver.getVariableByName)('statusHero/title/fontSize', modes)) || 20;
|
|
68
|
+
const titleFontFamily = (0, _figmaVariablesResolver.getVariableByName)('statusHero/title/fontFamily', modes) || 'System';
|
|
69
|
+
const titleLineHeight = Number((0, _figmaVariablesResolver.getVariableByName)('statusHero/title/lineHeight', modes)) || 22;
|
|
70
|
+
const titleFontWeight = (0, _figmaVariablesResolver.getVariableByName)('statusHero/title/fontWeight', modes) || '700';
|
|
71
|
+
|
|
72
|
+
// Body
|
|
73
|
+
const bodyColor = (0, _figmaVariablesResolver.getVariableByName)('statusHero/body/foreground', modes) || '#24262b';
|
|
74
|
+
const bodyFontSize = Number((0, _figmaVariablesResolver.getVariableByName)('statusHero/body/fontSize', modes)) || 14;
|
|
75
|
+
const bodyFontFamily = (0, _figmaVariablesResolver.getVariableByName)('statusHero/body/fontFamily', modes) || 'System';
|
|
76
|
+
const bodyLineHeight = Number((0, _figmaVariablesResolver.getVariableByName)('statusHero/body/lineHeight', modes)) || 17;
|
|
77
|
+
const bodyFontWeight = (0, _figmaVariablesResolver.getVariableByName)('statusHero/body/fontWeight', modes) || '500';
|
|
78
|
+
const containerStyle = {
|
|
79
|
+
flexDirection: 'column',
|
|
80
|
+
alignItems: 'center',
|
|
81
|
+
justifyContent: 'center',
|
|
82
|
+
gap,
|
|
83
|
+
padding
|
|
84
|
+
};
|
|
85
|
+
const defaultMediaWrapStyle = {
|
|
86
|
+
flexDirection: 'column',
|
|
87
|
+
alignItems: 'center',
|
|
88
|
+
gap: slotWrapGap
|
|
89
|
+
};
|
|
90
|
+
const contentWrapStyle = {
|
|
91
|
+
flexDirection: 'column',
|
|
92
|
+
alignItems: 'center',
|
|
93
|
+
gap: contentWrapGap
|
|
94
|
+
};
|
|
95
|
+
const titleStyle = {
|
|
96
|
+
color: titleColor,
|
|
97
|
+
fontSize: titleFontSize,
|
|
98
|
+
fontFamily: titleFontFamily,
|
|
99
|
+
lineHeight: titleLineHeight,
|
|
100
|
+
fontWeight: String(titleFontWeight),
|
|
101
|
+
textAlign: 'center'
|
|
102
|
+
};
|
|
103
|
+
const bodyStyle = {
|
|
104
|
+
color: bodyColor,
|
|
105
|
+
fontSize: bodyFontSize,
|
|
106
|
+
fontFamily: bodyFontFamily,
|
|
107
|
+
lineHeight: bodyLineHeight,
|
|
108
|
+
fontWeight: String(bodyFontWeight),
|
|
109
|
+
textAlign: 'center'
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
// Inject modes into the provided slot if it's a valid React element
|
|
113
|
+
const mediaContent = /*#__PURE__*/(0, _react.isValidElement)(renderMedia) ? /*#__PURE__*/(0, _react.cloneElement)(renderMedia, {
|
|
114
|
+
modes
|
|
115
|
+
}) : renderMedia;
|
|
116
|
+
const defaultMediaContent = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
117
|
+
style: defaultMediaWrapStyle,
|
|
118
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_IconCapsule.default, {
|
|
119
|
+
iconName: iconName,
|
|
120
|
+
modes: {
|
|
121
|
+
...modes,
|
|
122
|
+
'Icon Capsule Size': 'L',
|
|
123
|
+
Emphasis: 'High',
|
|
124
|
+
AppearanceBrand: 'Primary'
|
|
125
|
+
}
|
|
126
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_MoneyValue.default, {
|
|
127
|
+
value: value,
|
|
128
|
+
currency: currency,
|
|
129
|
+
modes: {
|
|
130
|
+
...modes,
|
|
131
|
+
Context3: 'Balance'
|
|
132
|
+
}
|
|
133
|
+
})]
|
|
134
|
+
});
|
|
135
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
136
|
+
style: [containerStyle, style],
|
|
137
|
+
children: [mediaContent ?? defaultMediaContent, /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
138
|
+
style: contentWrapStyle,
|
|
139
|
+
children: [showTitle && title ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
140
|
+
style: titleStyle,
|
|
141
|
+
children: title
|
|
142
|
+
}) : null, subtitle ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
143
|
+
style: bodyStyle,
|
|
144
|
+
children: subtitle
|
|
145
|
+
}) : null]
|
|
146
|
+
})]
|
|
147
|
+
});
|
|
148
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
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 _Button = _interopRequireDefault(require("../Button/Button"));
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
function SwappableAmount({
|
|
14
|
+
value = '49g',
|
|
15
|
+
schedule = false,
|
|
16
|
+
scheduleLabel = 'Weekly on Mondays',
|
|
17
|
+
amountLabel = '₹5100',
|
|
18
|
+
onSchedulePress,
|
|
19
|
+
onAmountPress,
|
|
20
|
+
modes = {},
|
|
21
|
+
style
|
|
22
|
+
}) {
|
|
23
|
+
const gap = (0, _figmaVariablesResolver.getVariableByName)('swappableAmount/gap', modes) ?? 24;
|
|
24
|
+
const padding = (0, _figmaVariablesResolver.getVariableByName)('swappableAmount/padding', modes) ?? 8;
|
|
25
|
+
const foreground = (0, _figmaVariablesResolver.getVariableByName)('swappableAmount/foreground', modes) ?? '#0d0d0f';
|
|
26
|
+
const fontSize = (0, _figmaVariablesResolver.getVariableByName)('swappableAmount/fontSize', modes) ?? 56;
|
|
27
|
+
const fontFamily = (0, _figmaVariablesResolver.getVariableByName)('swappableAmount/fontFamily', modes) ?? 'System';
|
|
28
|
+
const fontWeight = (0, _figmaVariablesResolver.getVariableByName)('swappableAmount/fontWeight', modes) ?? 900;
|
|
29
|
+
const lineHeight = (0, _figmaVariablesResolver.getVariableByName)('swappableAmount/lineHeight', modes) ?? 56;
|
|
30
|
+
const containerStyle = {
|
|
31
|
+
flexDirection: 'column',
|
|
32
|
+
alignItems: 'center',
|
|
33
|
+
justifyContent: 'center',
|
|
34
|
+
gap: gap,
|
|
35
|
+
padding: padding
|
|
36
|
+
};
|
|
37
|
+
const valueTextStyle = {
|
|
38
|
+
color: foreground,
|
|
39
|
+
fontSize: fontSize,
|
|
40
|
+
fontFamily: fontFamily,
|
|
41
|
+
fontWeight: String(fontWeight),
|
|
42
|
+
lineHeight: lineHeight
|
|
43
|
+
};
|
|
44
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
45
|
+
style: [containerStyle, style],
|
|
46
|
+
children: [schedule && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
|
|
47
|
+
label: scheduleLabel,
|
|
48
|
+
icon: "ic_calendar_week",
|
|
49
|
+
onPress: onSchedulePress,
|
|
50
|
+
modes: {
|
|
51
|
+
...modes,
|
|
52
|
+
AppearanceBrand: 'Neutral',
|
|
53
|
+
Emphasis: 'Low',
|
|
54
|
+
'Button / Size': 'S'
|
|
55
|
+
}
|
|
56
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
57
|
+
style: valueTextStyle,
|
|
58
|
+
children: value
|
|
59
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
|
|
60
|
+
label: amountLabel,
|
|
61
|
+
icon: "ic_data_in_out",
|
|
62
|
+
onPress: onAmountPress,
|
|
63
|
+
modes: {
|
|
64
|
+
...modes,
|
|
65
|
+
Emphasis: 'Medium',
|
|
66
|
+
AppearanceBrand: 'Secondary'
|
|
67
|
+
}
|
|
68
|
+
})]
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
var _default = exports.default = SwappableAmount;
|
|
@@ -0,0 +1,79 @@
|
|
|
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
|
+
* Individual tab item used inside the Tabs container.
|
|
14
|
+
*
|
|
15
|
+
* Supports idle and active states driven by design tokens.
|
|
16
|
+
* When active, a bottom indicator bar is shown beneath the label.
|
|
17
|
+
*
|
|
18
|
+
* @component
|
|
19
|
+
* @param {TabItemProps} props
|
|
20
|
+
*/
|
|
21
|
+
function TabItem({
|
|
22
|
+
label = 'Tab item',
|
|
23
|
+
active = false,
|
|
24
|
+
onPress,
|
|
25
|
+
modes = {},
|
|
26
|
+
style,
|
|
27
|
+
labelStyle,
|
|
28
|
+
accessibilityLabel
|
|
29
|
+
}) {
|
|
30
|
+
const paddingVertical = (0, _figmaVariablesResolver.getVariableByName)('tabItem/padding/vertical', modes) ?? 8;
|
|
31
|
+
const fontFamily = (0, _figmaVariablesResolver.getVariableByName)('tabItem/label/fontFamily', modes) ?? 'JioType Var';
|
|
32
|
+
const fontSize = (0, _figmaVariablesResolver.getVariableByName)('tabItem/label/size', modes) ?? 14;
|
|
33
|
+
const lineHeight = (0, _figmaVariablesResolver.getVariableByName)('tabItem/label/lineHeight', modes) ?? 17;
|
|
34
|
+
const idleLabelColor = (0, _figmaVariablesResolver.getVariableByName)('tabItem/idle/label/color', modes) ?? '#303338';
|
|
35
|
+
const activeLabelColor = (0, _figmaVariablesResolver.getVariableByName)('tabItem/active/label/color', modes) ?? '#cea15a';
|
|
36
|
+
const labelColor = active ? activeLabelColor : idleLabelColor;
|
|
37
|
+
const containerStyle = {
|
|
38
|
+
flexDirection: 'column',
|
|
39
|
+
alignItems: 'center',
|
|
40
|
+
justifyContent: 'center',
|
|
41
|
+
paddingVertical
|
|
42
|
+
};
|
|
43
|
+
const textStyle = {
|
|
44
|
+
color: labelColor,
|
|
45
|
+
fontFamily,
|
|
46
|
+
fontSize,
|
|
47
|
+
lineHeight,
|
|
48
|
+
fontWeight: '500'
|
|
49
|
+
};
|
|
50
|
+
const indicatorStyle = {
|
|
51
|
+
position: 'absolute',
|
|
52
|
+
bottom: 0,
|
|
53
|
+
left: 0,
|
|
54
|
+
right: 0,
|
|
55
|
+
height: 2,
|
|
56
|
+
backgroundColor: activeLabelColor,
|
|
57
|
+
borderRadius: 1
|
|
58
|
+
};
|
|
59
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Pressable, {
|
|
60
|
+
style: ({
|
|
61
|
+
pressed
|
|
62
|
+
}) => [containerStyle, pressed && {
|
|
63
|
+
opacity: 0.7
|
|
64
|
+
}, style],
|
|
65
|
+
onPress: onPress,
|
|
66
|
+
accessibilityRole: "tab",
|
|
67
|
+
accessibilityState: {
|
|
68
|
+
selected: active
|
|
69
|
+
},
|
|
70
|
+
accessibilityLabel: accessibilityLabel ?? label,
|
|
71
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
72
|
+
style: [textStyle, labelStyle],
|
|
73
|
+
children: label
|
|
74
|
+
}), active && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
75
|
+
style: indicatorStyle
|
|
76
|
+
})]
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
var _default = exports.default = TabItem;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "TabItem", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _TabItem.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
exports.default = void 0;
|
|
13
|
+
var _react = _interopRequireDefault(require("react"));
|
|
14
|
+
var _reactNative = require("react-native");
|
|
15
|
+
var _figmaVariablesResolver = require("../../design-tokens/figma-variables-resolver");
|
|
16
|
+
var _TabItem = _interopRequireDefault(require("./TabItem"));
|
|
17
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
|
+
/**
|
|
20
|
+
* Tabs container component that lays out TabItem children horizontally.
|
|
21
|
+
*
|
|
22
|
+
* The "Tab items" slot maps to React children — each child should be a
|
|
23
|
+
* `<TabItem>` element. The `modes` prop is automatically forwarded to
|
|
24
|
+
* every TabItem child so theming is consistent.
|
|
25
|
+
*
|
|
26
|
+
* @component
|
|
27
|
+
* @param {TabsProps} props
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```tsx
|
|
31
|
+
* const [activeIndex, setActiveIndex] = useState(0);
|
|
32
|
+
*
|
|
33
|
+
* <Tabs modes={{ 'Color Mode': 'Light' }}>
|
|
34
|
+
* <TabItem label="Tab 1" active={activeIndex === 0} onPress={() => setActiveIndex(0)} />
|
|
35
|
+
* <TabItem label="Tab 2" active={activeIndex === 1} onPress={() => setActiveIndex(1)} />
|
|
36
|
+
* <TabItem label="Tab 3" active={activeIndex === 2} onPress={() => setActiveIndex(2)} />
|
|
37
|
+
* </Tabs>
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
function Tabs({
|
|
41
|
+
children,
|
|
42
|
+
modes = {},
|
|
43
|
+
scrollable = false,
|
|
44
|
+
style
|
|
45
|
+
}) {
|
|
46
|
+
const gap = (0, _figmaVariablesResolver.getVariableByName)('tabs/gap', modes) ?? 16;
|
|
47
|
+
const paddingTop = (0, _figmaVariablesResolver.getVariableByName)('tabs/padding/top', modes) ?? 0;
|
|
48
|
+
const paddingBottom = (0, _figmaVariablesResolver.getVariableByName)('tabs/padding/bottom', modes) ?? 0;
|
|
49
|
+
const paddingLeft = (0, _figmaVariablesResolver.getVariableByName)('tabs/padding/left', modes) ?? 0;
|
|
50
|
+
const paddingRight = (0, _figmaVariablesResolver.getVariableByName)('tabs/padding/right', modes) ?? 0;
|
|
51
|
+
|
|
52
|
+
// Forward modes to all TabItem children
|
|
53
|
+
const enhancedChildren = _react.default.Children.map(children, child => {
|
|
54
|
+
if (/*#__PURE__*/_react.default.isValidElement(child) && child.type === _TabItem.default) {
|
|
55
|
+
const childElement = child;
|
|
56
|
+
return /*#__PURE__*/_react.default.cloneElement(childElement, {
|
|
57
|
+
modes: {
|
|
58
|
+
...modes,
|
|
59
|
+
...(childElement.props.modes ?? {})
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
return child;
|
|
64
|
+
});
|
|
65
|
+
const containerStyle = {
|
|
66
|
+
flexDirection: 'row',
|
|
67
|
+
gap,
|
|
68
|
+
paddingTop,
|
|
69
|
+
paddingBottom,
|
|
70
|
+
paddingLeft,
|
|
71
|
+
paddingRight
|
|
72
|
+
};
|
|
73
|
+
if (scrollable) {
|
|
74
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ScrollView, {
|
|
75
|
+
horizontal: true,
|
|
76
|
+
showsHorizontalScrollIndicator: false,
|
|
77
|
+
accessibilityRole: "tablist",
|
|
78
|
+
contentContainerStyle: [containerStyle, style],
|
|
79
|
+
children: enhancedChildren
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
83
|
+
style: [containerStyle, style],
|
|
84
|
+
accessibilityRole: "tablist",
|
|
85
|
+
children: enhancedChildren
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
var _default = exports.default = Tabs;
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
function Text({
|
|
13
|
+
text = 'Korem ipsum ',
|
|
14
|
+
modes = {},
|
|
15
|
+
style,
|
|
16
|
+
numberOfLines
|
|
17
|
+
}) {
|
|
18
|
+
const foreground = (0, _figmaVariablesResolver.getVariableByName)('text/foreground', modes) ?? '#000000';
|
|
19
|
+
const fontFamily = (0, _figmaVariablesResolver.getVariableByName)('text/fontFamily', modes) ?? 'JioType';
|
|
20
|
+
const fontSize = (0, _figmaVariablesResolver.getVariableByName)('text/fontSize', modes) ?? 14;
|
|
21
|
+
const fontWeight = (0, _figmaVariablesResolver.getVariableByName)('text/fontWeight', modes) ?? '500';
|
|
22
|
+
const lineHeight = (0, _figmaVariablesResolver.getVariableByName)('text/lineHeight', modes) ?? 20;
|
|
23
|
+
const letterSpacing = (0, _figmaVariablesResolver.getVariableByName)('text/letterSpacing', modes) ?? -0.5;
|
|
24
|
+
const textStyle = {
|
|
25
|
+
color: foreground,
|
|
26
|
+
fontFamily: fontFamily,
|
|
27
|
+
fontSize: fontSize,
|
|
28
|
+
fontWeight: String(fontWeight),
|
|
29
|
+
lineHeight: lineHeight,
|
|
30
|
+
letterSpacing: letterSpacing
|
|
31
|
+
};
|
|
32
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
33
|
+
style: [textStyle, style],
|
|
34
|
+
numberOfLines: numberOfLines,
|
|
35
|
+
children: text
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
var _default = exports.default = Text;
|
|
@@ -0,0 +1,102 @@
|
|
|
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 _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
+
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); }
|
|
12
|
+
/**
|
|
13
|
+
* Toggle (switch) component that maps directly to the Figma design using design tokens.
|
|
14
|
+
*
|
|
15
|
+
* Supports controlled and uncontrolled usage, on/off states, and disabled state.
|
|
16
|
+
* All styling is driven by design tokens with optional mode overrides.
|
|
17
|
+
*
|
|
18
|
+
* @component
|
|
19
|
+
* @param {ToggleProps} props
|
|
20
|
+
*/
|
|
21
|
+
function Toggle({
|
|
22
|
+
value: controlledValue,
|
|
23
|
+
defaultValue = false,
|
|
24
|
+
onValueChange,
|
|
25
|
+
disabled = false,
|
|
26
|
+
modes = {},
|
|
27
|
+
style,
|
|
28
|
+
accessibilityLabel
|
|
29
|
+
}) {
|
|
30
|
+
const isControlled = controlledValue !== undefined;
|
|
31
|
+
const [internalValue, setInternalValue] = (0, _react.useState)(defaultValue);
|
|
32
|
+
const isOn = isControlled ? controlledValue : internalValue;
|
|
33
|
+
const toggleState = disabled ? isOn ? 'Disabled On' : 'Disabled Off' : isOn ? 'On' : 'Off';
|
|
34
|
+
const resolvedModes = {
|
|
35
|
+
...modes,
|
|
36
|
+
'Toggle States': toggleState
|
|
37
|
+
};
|
|
38
|
+
const width = (0, _figmaVariablesResolver.getVariableByName)('toggle/width', resolvedModes) ?? 52;
|
|
39
|
+
const radius = (0, _figmaVariablesResolver.getVariableByName)('toggle/radius', resolvedModes) ?? 100;
|
|
40
|
+
const paddingTrack = (0, _figmaVariablesResolver.getVariableByName)('toggle/padding/track', resolvedModes) ?? 3;
|
|
41
|
+
const background = (0, _figmaVariablesResolver.getVariableByName)('toggle/background', resolvedModes) ?? (isOn ? '#5d00b5' : '#c7c7cc');
|
|
42
|
+
const thumbSize = (0, _figmaVariablesResolver.getVariableByName)('toggle/thumb/size', resolvedModes) ?? 25;
|
|
43
|
+
const thumbRadius = (0, _figmaVariablesResolver.getVariableByName)('toggle/thumb/radius', resolvedModes) ?? 100;
|
|
44
|
+
const thumbBackground = (0, _figmaVariablesResolver.getVariableByName)('toggle/thumb/background', resolvedModes) ?? '#ffffff';
|
|
45
|
+
const thumbShadowColor = (0, _figmaVariablesResolver.getVariableByName)('toggle/thumb/shadow/color', resolvedModes) ?? 'rgba(0,0,0,0.18)';
|
|
46
|
+
const thumbShadowRadius = (0, _figmaVariablesResolver.getVariableByName)('toggle/thumb/shadow/radius', resolvedModes) ?? 4;
|
|
47
|
+
const thumbShadowOffsetX = (0, _figmaVariablesResolver.getVariableByName)('toggle/thumb/shadow/offsetX', resolvedModes) ?? 0;
|
|
48
|
+
const thumbShadowOffsetY = (0, _figmaVariablesResolver.getVariableByName)('toggle/thumb/shadow/offsetY', resolvedModes) ?? 2;
|
|
49
|
+
const trackHeight = thumbSize + paddingTrack * 2;
|
|
50
|
+
const handlePress = (0, _react.useCallback)(() => {
|
|
51
|
+
if (disabled) return;
|
|
52
|
+
const next = !isOn;
|
|
53
|
+
if (!isControlled) {
|
|
54
|
+
setInternalValue(next);
|
|
55
|
+
}
|
|
56
|
+
onValueChange?.(next);
|
|
57
|
+
}, [disabled, isOn, isControlled, onValueChange]);
|
|
58
|
+
const trackStyle = {
|
|
59
|
+
width: width,
|
|
60
|
+
height: trackHeight,
|
|
61
|
+
borderRadius: radius,
|
|
62
|
+
backgroundColor: background,
|
|
63
|
+
padding: paddingTrack,
|
|
64
|
+
justifyContent: 'center',
|
|
65
|
+
alignItems: isOn ? 'flex-end' : 'flex-start',
|
|
66
|
+
opacity: disabled ? 0.5 : 1
|
|
67
|
+
};
|
|
68
|
+
const thumbShadow = _reactNative.Platform.OS === 'web' ? {
|
|
69
|
+
boxShadow: `${thumbShadowOffsetX}px ${thumbShadowOffsetY}px ${thumbShadowRadius}px 0px ${thumbShadowColor}`
|
|
70
|
+
} : {
|
|
71
|
+
shadowColor: thumbShadowColor,
|
|
72
|
+
shadowOffset: {
|
|
73
|
+
width: thumbShadowOffsetX,
|
|
74
|
+
height: thumbShadowOffsetY
|
|
75
|
+
},
|
|
76
|
+
shadowRadius: thumbShadowRadius,
|
|
77
|
+
shadowOpacity: 1,
|
|
78
|
+
elevation: 4
|
|
79
|
+
};
|
|
80
|
+
const thumbStyle = {
|
|
81
|
+
width: thumbSize,
|
|
82
|
+
height: thumbSize,
|
|
83
|
+
borderRadius: thumbRadius,
|
|
84
|
+
backgroundColor: thumbBackground,
|
|
85
|
+
...thumbShadow
|
|
86
|
+
};
|
|
87
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
|
|
88
|
+
style: [trackStyle, style],
|
|
89
|
+
onPress: handlePress,
|
|
90
|
+
disabled: disabled,
|
|
91
|
+
accessibilityRole: "switch",
|
|
92
|
+
accessibilityState: {
|
|
93
|
+
checked: isOn,
|
|
94
|
+
disabled
|
|
95
|
+
},
|
|
96
|
+
accessibilityLabel: accessibilityLabel,
|
|
97
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
98
|
+
style: thumbStyle
|
|
99
|
+
})
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
var _default = exports.default = Toggle;
|