jfs-components 0.0.70 → 0.0.72
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/CHANGELOG.md +49 -0
- package/lib/commonjs/components/CardAdvisory/CardAdvisory.js +203 -0
- package/lib/commonjs/components/CardCTA/CardCTA.js +198 -16
- package/lib/commonjs/components/CardFinancialCondition/CardFinancialCondition.js +213 -0
- package/lib/commonjs/components/Carousel/Carousel.js +9 -7
- package/lib/commonjs/components/CircularProgressBar/CircularProgressBar.js +147 -0
- package/lib/commonjs/components/CircularProgressBarDoted/CircularProgressBarDoted.js +258 -0
- package/lib/commonjs/components/CircularRating/CircularRating.js +161 -0
- package/lib/commonjs/components/Gauge/Gauge.js +223 -0
- package/lib/commonjs/components/HoldingsCard/HoldingsCard.js +2 -2
- package/lib/commonjs/components/InstitutionBadge/InstitutionBadge.js +132 -0
- package/lib/commonjs/components/ListGroup/ListGroup.js +3 -1
- package/lib/commonjs/components/Nudge/Nudge.js +179 -87
- package/lib/commonjs/components/Radio/Radio.js +194 -0
- package/lib/commonjs/components/RadioButton/RadioButton.js +21 -188
- package/lib/commonjs/components/index.js +56 -0
- package/lib/commonjs/design-tokens/Coin Variables-variables-full.json +1 -1
- package/lib/commonjs/icons/registry.js +1 -1
- package/lib/module/components/CardAdvisory/CardAdvisory.js +197 -0
- package/lib/module/components/CardCTA/CardCTA.js +199 -17
- package/lib/module/components/CardFinancialCondition/CardFinancialCondition.js +207 -0
- package/lib/module/components/Carousel/Carousel.js +9 -7
- package/lib/module/components/CircularProgressBar/CircularProgressBar.js +141 -0
- package/lib/module/components/CircularProgressBarDoted/CircularProgressBarDoted.js +253 -0
- package/lib/module/components/CircularRating/CircularRating.js +155 -0
- package/lib/module/components/Gauge/Gauge.js +217 -0
- package/lib/module/components/HoldingsCard/HoldingsCard.js +2 -2
- package/lib/module/components/InstitutionBadge/InstitutionBadge.js +127 -0
- package/lib/module/components/ListGroup/ListGroup.js +3 -1
- package/lib/module/components/Nudge/Nudge.js +178 -87
- package/lib/module/components/Radio/Radio.js +188 -0
- package/lib/module/components/RadioButton/RadioButton.js +20 -185
- package/lib/module/components/index.js +12 -0
- package/lib/module/design-tokens/Coin Variables-variables-full.json +1 -1
- package/lib/module/icons/registry.js +1 -1
- package/lib/typescript/src/components/CardAdvisory/CardAdvisory.d.ts +49 -0
- package/lib/typescript/src/components/CardCTA/CardCTA.d.ts +16 -1
- package/lib/typescript/src/components/CardFinancialCondition/CardFinancialCondition.d.ts +50 -0
- package/lib/typescript/src/components/CircularProgressBar/CircularProgressBar.d.ts +27 -0
- package/lib/typescript/src/components/CircularProgressBarDoted/CircularProgressBarDoted.d.ts +48 -0
- package/lib/typescript/src/components/CircularRating/CircularRating.d.ts +49 -0
- package/lib/typescript/src/components/Gauge/Gauge.d.ts +53 -0
- package/lib/typescript/src/components/InstitutionBadge/InstitutionBadge.d.ts +30 -0
- package/lib/typescript/src/components/Nudge/Nudge.d.ts +14 -11
- package/lib/typescript/src/components/Radio/Radio.d.ts +30 -0
- package/lib/typescript/src/components/RadioButton/RadioButton.d.ts +20 -28
- package/lib/typescript/src/components/index.d.ts +13 -1
- package/lib/typescript/src/icons/registry.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/CardAdvisory/CardAdvisory.tsx +283 -0
- package/src/components/CardCTA/CardCTA.tsx +236 -13
- package/src/components/CardFinancialCondition/CardFinancialCondition.tsx +366 -0
- package/src/components/Carousel/Carousel.tsx +14 -6
- package/src/components/CircularProgressBar/CircularProgressBar.tsx +190 -0
- package/src/components/CircularProgressBarDoted/CircularProgressBarDoted.tsx +357 -0
- package/src/components/CircularRating/CircularRating.tsx +241 -0
- package/src/components/Gauge/Gauge.tsx +303 -0
- package/src/components/HoldingsCard/HoldingsCard.tsx +2 -2
- package/src/components/InstitutionBadge/InstitutionBadge.tsx +216 -0
- package/src/components/ListGroup/ListGroup.tsx +3 -1
- package/src/components/Nudge/Nudge.tsx +222 -82
- package/src/components/Radio/Radio.tsx +227 -0
- package/src/components/RadioButton/RadioButton.tsx +23 -225
- package/src/components/index.ts +13 -1
- package/src/design-tokens/Coin Variables-variables-full.json +1 -1
- package/src/icons/registry.ts +1 -1
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _figmaVariablesResolver = require("../../design-tokens/figma-variables-resolver");
|
|
10
|
+
var _JFSThemeProvider = require("../../design-tokens/JFSThemeProvider");
|
|
11
|
+
var _Icon = _interopRequireDefault(require("../../icons/Icon"));
|
|
12
|
+
var _reactUtils = require("../../utils/react-utils");
|
|
13
|
+
var _CircularProgressBarDoted = _interopRequireDefault(require("../CircularProgressBarDoted/CircularProgressBarDoted"));
|
|
14
|
+
var _Nudge = _interopRequireDefault(require("../Nudge/Nudge"));
|
|
15
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
|
+
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); }
|
|
18
|
+
const toNumber = (value, fallback) => {
|
|
19
|
+
if (typeof value === 'number') {
|
|
20
|
+
return Number.isFinite(value) ? value : fallback;
|
|
21
|
+
}
|
|
22
|
+
if (typeof value === 'string') {
|
|
23
|
+
const parsed = Number(value);
|
|
24
|
+
return Number.isFinite(parsed) ? parsed : fallback;
|
|
25
|
+
}
|
|
26
|
+
return fallback;
|
|
27
|
+
};
|
|
28
|
+
const toFontWeight = (value, fallback) => {
|
|
29
|
+
if (typeof value === 'number') {
|
|
30
|
+
return String(value);
|
|
31
|
+
}
|
|
32
|
+
if (typeof value === 'string') {
|
|
33
|
+
return value;
|
|
34
|
+
}
|
|
35
|
+
return fallback;
|
|
36
|
+
};
|
|
37
|
+
function resolveCircularRatingTokens(modes) {
|
|
38
|
+
const gap = toNumber((0, _figmaVariablesResolver.getVariableByName)('circularRating/gap', modes), 32);
|
|
39
|
+
const padding = toNumber((0, _figmaVariablesResolver.getVariableByName)('circularRating/padding', modes), 10);
|
|
40
|
+
const footerGap = toNumber((0, _figmaVariablesResolver.getVariableByName)('circularRating/footer/gap', modes), 4);
|
|
41
|
+
const footerHeight = toNumber((0, _figmaVariablesResolver.getVariableByName)('circularRating/footer/height', modes), 16);
|
|
42
|
+
const footerTextColor = (0, _figmaVariablesResolver.getVariableByName)('circularRating/footer/text/color', modes) || '#0d0d0f';
|
|
43
|
+
const footerTextFontSize = toNumber((0, _figmaVariablesResolver.getVariableByName)('circularRating/footer/text/fontSize', modes), 12);
|
|
44
|
+
const footerTextFontFamily = (0, _figmaVariablesResolver.getVariableByName)('circularRating/footer/text/fontFamily', modes) || 'JioType Var';
|
|
45
|
+
const footerTextLineHeight = toNumber((0, _figmaVariablesResolver.getVariableByName)('circularRating/footer/text/lineHeight', modes), 16);
|
|
46
|
+
const footerTextFontWeight = toFontWeight((0, _figmaVariablesResolver.getVariableByName)('circularRating/footer/text/fontWeight', modes), '400');
|
|
47
|
+
return {
|
|
48
|
+
containerStyle: {
|
|
49
|
+
alignItems: 'flex-start',
|
|
50
|
+
gap,
|
|
51
|
+
justifyContent: 'center',
|
|
52
|
+
padding
|
|
53
|
+
},
|
|
54
|
+
ratingStyle: {
|
|
55
|
+
height: 320,
|
|
56
|
+
width: 320
|
|
57
|
+
},
|
|
58
|
+
footerStyle: {
|
|
59
|
+
alignItems: 'center',
|
|
60
|
+
flexDirection: 'row',
|
|
61
|
+
gap: footerGap,
|
|
62
|
+
height: footerHeight,
|
|
63
|
+
justifyContent: 'center',
|
|
64
|
+
width: '100%'
|
|
65
|
+
},
|
|
66
|
+
footerTextStyle: {
|
|
67
|
+
color: footerTextColor,
|
|
68
|
+
fontFamily: footerTextFontFamily,
|
|
69
|
+
fontSize: footerTextFontSize,
|
|
70
|
+
fontWeight: footerTextFontWeight,
|
|
71
|
+
lineHeight: footerTextLineHeight,
|
|
72
|
+
textAlign: 'center'
|
|
73
|
+
},
|
|
74
|
+
footerIconColor: (0, _figmaVariablesResolver.getVariableByName)('circularRating/footer/icon/color', modes) || '#1a1c1f',
|
|
75
|
+
footerIconSize: toNumber((0, _figmaVariablesResolver.getVariableByName)('circularRating/footer/icon/size', modes), 16)
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
function CircularRating({
|
|
79
|
+
value = 72,
|
|
80
|
+
dotCount = 24,
|
|
81
|
+
label = 'Rating',
|
|
82
|
+
tierLabel = 'Doing great',
|
|
83
|
+
footerText = 'Updated on 1 March',
|
|
84
|
+
showFooterIcon = true,
|
|
85
|
+
showNudge = true,
|
|
86
|
+
nudgeBody = 'Split this transaction into installments',
|
|
87
|
+
nudgeButtonLabel = 'Button',
|
|
88
|
+
onPressNudgeButton,
|
|
89
|
+
onTierPress,
|
|
90
|
+
footerSlot,
|
|
91
|
+
nudgeSlot,
|
|
92
|
+
modes: propModes = _reactUtils.EMPTY_MODES,
|
|
93
|
+
style,
|
|
94
|
+
ratingStyle,
|
|
95
|
+
footerStyle,
|
|
96
|
+
footerTextStyle,
|
|
97
|
+
nudgeStyle,
|
|
98
|
+
accessibilityLabel,
|
|
99
|
+
...rest
|
|
100
|
+
}) {
|
|
101
|
+
const {
|
|
102
|
+
modes: globalModes
|
|
103
|
+
} = (0, _JFSThemeProvider.useTokens)();
|
|
104
|
+
const modes = (0, _react.useMemo)(() => globalModes === _reactUtils.EMPTY_MODES && propModes === _reactUtils.EMPTY_MODES ? _reactUtils.EMPTY_MODES : {
|
|
105
|
+
...globalModes,
|
|
106
|
+
...propModes
|
|
107
|
+
}, [globalModes, propModes]);
|
|
108
|
+
const tokens = (0, _react.useMemo)(() => resolveCircularRatingTokens(modes), [modes]);
|
|
109
|
+
const processedFooterSlot = (0, _react.useMemo)(() => {
|
|
110
|
+
if (!footerSlot) return null;
|
|
111
|
+
const processed = (0, _reactUtils.cloneChildrenWithModes)(_react.default.Children.toArray(footerSlot), modes);
|
|
112
|
+
return processed.length === 1 ? processed[0] : processed;
|
|
113
|
+
}, [footerSlot, modes]);
|
|
114
|
+
const processedNudgeSlot = (0, _react.useMemo)(() => {
|
|
115
|
+
if (!nudgeSlot) return null;
|
|
116
|
+
const processed = (0, _reactUtils.cloneChildrenWithModes)(_react.default.Children.toArray(nudgeSlot), modes);
|
|
117
|
+
return processed.length === 1 ? processed[0] : processed;
|
|
118
|
+
}, [nudgeSlot, modes]);
|
|
119
|
+
const defaultAccessibilityLabel = accessibilityLabel ?? `${label}. ${Math.round(value)} out of 100. ${tierLabel}. ${footerText}`;
|
|
120
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
121
|
+
accessibilityLabel: defaultAccessibilityLabel,
|
|
122
|
+
style: [tokens.containerStyle, style],
|
|
123
|
+
...rest,
|
|
124
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
125
|
+
style: [tokens.ratingStyle, ratingStyle],
|
|
126
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CircularProgressBarDoted.default, {
|
|
127
|
+
value: value,
|
|
128
|
+
dotCount: dotCount,
|
|
129
|
+
label: label,
|
|
130
|
+
tierLabel: tierLabel,
|
|
131
|
+
onTierPress: onTierPress,
|
|
132
|
+
modes: modes
|
|
133
|
+
})
|
|
134
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
135
|
+
style: [tokens.footerStyle, footerStyle],
|
|
136
|
+
children: processedFooterSlot || /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
137
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
138
|
+
numberOfLines: 1,
|
|
139
|
+
style: [tokens.footerTextStyle, footerTextStyle],
|
|
140
|
+
children: footerText
|
|
141
|
+
}), showFooterIcon ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
|
|
142
|
+
name: "ic_info",
|
|
143
|
+
size: tokens.footerIconSize,
|
|
144
|
+
color: tokens.footerIconColor,
|
|
145
|
+
accessibilityElementsHidden: true,
|
|
146
|
+
importantForAccessibility: "no"
|
|
147
|
+
}) : null]
|
|
148
|
+
})
|
|
149
|
+
}), showNudge ? processedNudgeSlot || /*#__PURE__*/(0, _jsxRuntime.jsx)(_Nudge.default, {
|
|
150
|
+
type: "inline-compact",
|
|
151
|
+
body: nudgeBody,
|
|
152
|
+
buttonLabel: nudgeButtonLabel,
|
|
153
|
+
onPressButton: onPressNudgeButton,
|
|
154
|
+
modes: modes,
|
|
155
|
+
style: [{
|
|
156
|
+
width: 312
|
|
157
|
+
}, nudgeStyle]
|
|
158
|
+
}) : null]
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
var _default = exports.default = /*#__PURE__*/_react.default.memo(CircularRating);
|
|
@@ -0,0 +1,223 @@
|
|
|
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 _reactNativeSvg = _interopRequireWildcard(require("react-native-svg"));
|
|
10
|
+
var _figmaVariablesResolver = require("../../design-tokens/figma-variables-resolver");
|
|
11
|
+
var _JFSThemeProvider = require("../../design-tokens/JFSThemeProvider");
|
|
12
|
+
var _reactUtils = require("../../utils/react-utils");
|
|
13
|
+
var _SupportText = _interopRequireDefault(require("../SupportText/SupportText"));
|
|
14
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
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
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
|
+
const clamp = (value, min, max) => {
|
|
18
|
+
if (max <= min) {
|
|
19
|
+
return 0;
|
|
20
|
+
}
|
|
21
|
+
return Math.min(1, Math.max(0, (value - min) / (max - min)));
|
|
22
|
+
};
|
|
23
|
+
const toNumber = (value, fallback) => {
|
|
24
|
+
if (typeof value === 'number') {
|
|
25
|
+
return Number.isFinite(value) ? value : fallback;
|
|
26
|
+
}
|
|
27
|
+
if (typeof value === 'string') {
|
|
28
|
+
const parsed = Number(value);
|
|
29
|
+
return Number.isFinite(parsed) ? parsed : fallback;
|
|
30
|
+
}
|
|
31
|
+
return fallback;
|
|
32
|
+
};
|
|
33
|
+
const toFontWeight = (value, fallback) => {
|
|
34
|
+
if (typeof value === 'number') {
|
|
35
|
+
return String(value);
|
|
36
|
+
}
|
|
37
|
+
if (typeof value === 'string') {
|
|
38
|
+
return value;
|
|
39
|
+
}
|
|
40
|
+
return fallback;
|
|
41
|
+
};
|
|
42
|
+
const getStrokeColor = (style, fallback) => {
|
|
43
|
+
const flattened = _reactNative.StyleSheet.flatten(style);
|
|
44
|
+
return typeof flattened.backgroundColor === 'string' ? flattened.backgroundColor : fallback;
|
|
45
|
+
};
|
|
46
|
+
function Gauge({
|
|
47
|
+
value = 84,
|
|
48
|
+
min = 0,
|
|
49
|
+
max = 100,
|
|
50
|
+
valueLabel,
|
|
51
|
+
title = 'Your score is based on strong data',
|
|
52
|
+
caption = 'Add more details for even better accuracy',
|
|
53
|
+
supportText = 'Support Text',
|
|
54
|
+
supportTextStatus = 'Success',
|
|
55
|
+
showTitle = true,
|
|
56
|
+
showCaption = true,
|
|
57
|
+
showSupportText = true,
|
|
58
|
+
modes: propModes = _reactUtils.EMPTY_MODES,
|
|
59
|
+
children,
|
|
60
|
+
style,
|
|
61
|
+
arcStyle,
|
|
62
|
+
readoutStyle,
|
|
63
|
+
titleStyle,
|
|
64
|
+
valueStyle,
|
|
65
|
+
captionStyle,
|
|
66
|
+
trackStyle,
|
|
67
|
+
progressStyle,
|
|
68
|
+
accessibilityLabel,
|
|
69
|
+
...rest
|
|
70
|
+
}) {
|
|
71
|
+
const {
|
|
72
|
+
modes: globalModes
|
|
73
|
+
} = (0, _JFSThemeProvider.useTokens)();
|
|
74
|
+
const modes = {
|
|
75
|
+
...globalModes,
|
|
76
|
+
...propModes
|
|
77
|
+
};
|
|
78
|
+
const supportTextModes = {
|
|
79
|
+
...modes,
|
|
80
|
+
Status: supportTextStatus
|
|
81
|
+
};
|
|
82
|
+
const gap = toNumber((0, _figmaVariablesResolver.getVariableByName)('gauge/gap', modes), 30);
|
|
83
|
+
const padding = toNumber((0, _figmaVariablesResolver.getVariableByName)('gauge/padding', modes), 16);
|
|
84
|
+
const width = toNumber((0, _figmaVariablesResolver.getVariableByName)('gauge/width', modes), 299);
|
|
85
|
+
const arcWidth = toNumber((0, _figmaVariablesResolver.getVariableByName)('gauge/arc/width', modes), 267);
|
|
86
|
+
const arcHeight = arcWidth * (186 / 328);
|
|
87
|
+
const trackSize = toNumber((0, _figmaVariablesResolver.getVariableByName)('gauge/track/size', modes), 244);
|
|
88
|
+
const trackInnerRadius = toNumber((0, _figmaVariablesResolver.getVariableByName)('gauge/track/radius', modes), 99);
|
|
89
|
+
const progressInnerRadius = toNumber((0, _figmaVariablesResolver.getVariableByName)('gauge/progress/radius', modes), 99);
|
|
90
|
+
const innerRadius = Math.min(trackInnerRadius, progressInnerRadius);
|
|
91
|
+
const strokeWidth = Math.max(1, trackSize / 2 - innerRadius);
|
|
92
|
+
const radius = innerRadius + strokeWidth / 2;
|
|
93
|
+
const centerX = arcWidth / 2;
|
|
94
|
+
const centerY = Math.min(arcHeight - strokeWidth / 2, radius + strokeWidth / 2);
|
|
95
|
+
const startX = centerX - radius;
|
|
96
|
+
const endX = centerX + radius;
|
|
97
|
+
const arcPath = `M ${startX} ${centerY} A ${radius} ${radius} 0 0 1 ${endX} ${centerY}`;
|
|
98
|
+
const arcLength = Math.PI * radius;
|
|
99
|
+
const progress = clamp(value, min, max);
|
|
100
|
+
const titleColor = (0, _figmaVariablesResolver.getVariableByName)('gauge/title/color', modes) || '#0c0d10';
|
|
101
|
+
const titleFontSize = toNumber((0, _figmaVariablesResolver.getVariableByName)('gauge/title/fontSize', modes), 23);
|
|
102
|
+
const titleLineHeight = toNumber((0, _figmaVariablesResolver.getVariableByName)('gauge/title/lineHeight', modes), 23);
|
|
103
|
+
const titleFontFamily = (0, _figmaVariablesResolver.getVariableByName)('gauge/title/fontFamily', modes) || 'JioType Var';
|
|
104
|
+
const titleFontWeight = toFontWeight((0, _figmaVariablesResolver.getVariableByName)('gauge/title/fontWeight', modes), '900');
|
|
105
|
+
const titleHeight = toNumber((0, _figmaVariablesResolver.getVariableByName)('gauge/title/height', modes), 46);
|
|
106
|
+
const readoutGap = toNumber((0, _figmaVariablesResolver.getVariableByName)('gauge/readout/gap', modes), 8);
|
|
107
|
+
const readoutPadding = toNumber((0, _figmaVariablesResolver.getVariableByName)('gauge/readout/padding', modes), 8);
|
|
108
|
+
const valueColor = (0, _figmaVariablesResolver.getVariableByName)('gauge/readout/value/color', modes) || '#0c0d10';
|
|
109
|
+
const valueFontSize = toNumber((0, _figmaVariablesResolver.getVariableByName)('gauge/readout/value/fontSize', modes), 36);
|
|
110
|
+
const valueLineHeight = toNumber((0, _figmaVariablesResolver.getVariableByName)('gauge/readout/value/lineHeight', modes), 36);
|
|
111
|
+
const valueFontFamily = (0, _figmaVariablesResolver.getVariableByName)('gauge/readout/value/fontFamily', modes) || 'JioType Var';
|
|
112
|
+
const valueFontWeight = toFontWeight((0, _figmaVariablesResolver.getVariableByName)('gauge/readout/value/fontWeight', modes), '800');
|
|
113
|
+
const captionColor = (0, _figmaVariablesResolver.getVariableByName)('gauge/caption/color', modes) || '#0c0d10';
|
|
114
|
+
const captionFontSize = toNumber((0, _figmaVariablesResolver.getVariableByName)('gauge/caption/fontSize', modes), 14);
|
|
115
|
+
const captionLineHeight = toNumber((0, _figmaVariablesResolver.getVariableByName)('gauge/caption/lineHeight', modes), 18);
|
|
116
|
+
const captionFontFamily = (0, _figmaVariablesResolver.getVariableByName)('gauge/caption/fontFamily', modes) || 'JioType Var';
|
|
117
|
+
const captionFontWeight = toFontWeight((0, _figmaVariablesResolver.getVariableByName)('gauge/caption/fontWeight', modes), '500');
|
|
118
|
+
const trackColor = getStrokeColor(trackStyle, (0, _figmaVariablesResolver.getVariableByName)('gauge/track/color', modes) || '#f5f5f6');
|
|
119
|
+
const progressColor = getStrokeColor(progressStyle, (0, _figmaVariablesResolver.getVariableByName)('gauge/progress/color', modes) || '#25ab21');
|
|
120
|
+
const containerStyle = {
|
|
121
|
+
alignItems: 'center',
|
|
122
|
+
gap,
|
|
123
|
+
padding,
|
|
124
|
+
width
|
|
125
|
+
};
|
|
126
|
+
const computedTitleStyle = {
|
|
127
|
+
color: titleColor,
|
|
128
|
+
fontFamily: titleFontFamily,
|
|
129
|
+
fontSize: titleFontSize,
|
|
130
|
+
fontWeight: titleFontWeight,
|
|
131
|
+
lineHeight: titleLineHeight,
|
|
132
|
+
minHeight: titleHeight,
|
|
133
|
+
textAlign: 'center',
|
|
134
|
+
width: '100%'
|
|
135
|
+
};
|
|
136
|
+
const computedArcStyle = {
|
|
137
|
+
height: arcHeight,
|
|
138
|
+
overflow: 'hidden',
|
|
139
|
+
position: 'relative',
|
|
140
|
+
width: '100%'
|
|
141
|
+
};
|
|
142
|
+
const computedReadoutStyle = {
|
|
143
|
+
alignItems: 'center',
|
|
144
|
+
gap: readoutGap,
|
|
145
|
+
left: 0,
|
|
146
|
+
padding: readoutPadding,
|
|
147
|
+
position: 'absolute',
|
|
148
|
+
right: 0,
|
|
149
|
+
top: arcHeight * 0.42
|
|
150
|
+
};
|
|
151
|
+
const computedValueStyle = {
|
|
152
|
+
color: valueColor,
|
|
153
|
+
fontFamily: valueFontFamily,
|
|
154
|
+
fontSize: valueFontSize,
|
|
155
|
+
fontWeight: valueFontWeight,
|
|
156
|
+
lineHeight: valueLineHeight,
|
|
157
|
+
textAlign: 'center'
|
|
158
|
+
};
|
|
159
|
+
const computedCaptionStyle = {
|
|
160
|
+
color: captionColor,
|
|
161
|
+
fontFamily: captionFontFamily,
|
|
162
|
+
fontSize: captionFontSize,
|
|
163
|
+
fontWeight: captionFontWeight,
|
|
164
|
+
lineHeight: captionLineHeight,
|
|
165
|
+
textAlign: 'center',
|
|
166
|
+
width: '100%'
|
|
167
|
+
};
|
|
168
|
+
const defaultValueLabel = valueLabel ?? String(Math.round(value));
|
|
169
|
+
const defaultAccessibilityLabel = accessibilityLabel ?? `${title}. ${defaultValueLabel} out of ${max}. ${supportText}. ${caption}`;
|
|
170
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
171
|
+
accessibilityRole: "progressbar",
|
|
172
|
+
accessibilityLabel: defaultAccessibilityLabel,
|
|
173
|
+
accessibilityValue: {
|
|
174
|
+
min,
|
|
175
|
+
max,
|
|
176
|
+
now: value
|
|
177
|
+
},
|
|
178
|
+
style: [containerStyle, style],
|
|
179
|
+
...rest,
|
|
180
|
+
children: [showTitle ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
181
|
+
style: [computedTitleStyle, titleStyle],
|
|
182
|
+
children: title
|
|
183
|
+
}) : null, /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
184
|
+
style: [computedArcStyle, arcStyle],
|
|
185
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNativeSvg.default, {
|
|
186
|
+
width: "100%",
|
|
187
|
+
height: arcHeight,
|
|
188
|
+
viewBox: `0 0 ${arcWidth} ${arcHeight}`,
|
|
189
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeSvg.Path, {
|
|
190
|
+
d: arcPath,
|
|
191
|
+
stroke: trackColor,
|
|
192
|
+
strokeWidth: strokeWidth,
|
|
193
|
+
strokeLinecap: "butt",
|
|
194
|
+
fill: "none"
|
|
195
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeSvg.Path, {
|
|
196
|
+
d: arcPath,
|
|
197
|
+
stroke: progressColor,
|
|
198
|
+
strokeWidth: strokeWidth,
|
|
199
|
+
strokeLinecap: "butt",
|
|
200
|
+
fill: "none",
|
|
201
|
+
strokeDasharray: `${arcLength} ${arcLength}`,
|
|
202
|
+
strokeDashoffset: arcLength * (1 - progress)
|
|
203
|
+
})]
|
|
204
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
205
|
+
style: [computedReadoutStyle, readoutStyle],
|
|
206
|
+
children: children ? (0, _reactUtils.cloneChildrenWithModes)(children, modes) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
207
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
208
|
+
style: [computedValueStyle, valueStyle],
|
|
209
|
+
children: defaultValueLabel
|
|
210
|
+
}), showSupportText ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_SupportText.default, {
|
|
211
|
+
label: supportText,
|
|
212
|
+
status: supportTextStatus,
|
|
213
|
+
modes: supportTextModes
|
|
214
|
+
}) : null]
|
|
215
|
+
})
|
|
216
|
+
})]
|
|
217
|
+
}), showCaption ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
218
|
+
style: [computedCaptionStyle, captionStyle],
|
|
219
|
+
children: caption
|
|
220
|
+
}) : null]
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
var _default = exports.default = Gauge;
|
|
@@ -7,7 +7,7 @@ exports.default = HoldingsCard;
|
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
9
|
var _figmaVariablesResolver = require("../../design-tokens/figma-variables-resolver");
|
|
10
|
-
var
|
|
10
|
+
var _Radio = _interopRequireDefault(require("../Radio/Radio"));
|
|
11
11
|
var _reactUtils = require("../../utils/react-utils");
|
|
12
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -128,7 +128,7 @@ function HoldingsCard({
|
|
|
128
128
|
}
|
|
129
129
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
130
130
|
pointerEvents: "none",
|
|
131
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
131
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Radio.default, {
|
|
132
132
|
selected: selected,
|
|
133
133
|
disabled: disabled,
|
|
134
134
|
modes: modes
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _figmaVariablesResolver = require("../../design-tokens/figma-variables-resolver");
|
|
10
|
+
var _JFSThemeProvider = require("../../design-tokens/JFSThemeProvider");
|
|
11
|
+
var _reactUtils = require("../../utils/react-utils");
|
|
12
|
+
var _MediaSource = _interopRequireDefault(require("../../utils/MediaSource"));
|
|
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
|
+
// Default avatar asset (shared with the Avatar component) so that
|
|
17
|
+
// InstitutionBadge has a sensible visual fallback when no `source` is
|
|
18
|
+
// provided in stories or playgrounds.
|
|
19
|
+
const DEFAULT_AVATAR_IMAGE = require('../Avatar/31595e70c4181263f9971590224b12934b280c9b.png');
|
|
20
|
+
const toNumber = (value, fallback) => {
|
|
21
|
+
if (typeof value === 'number') {
|
|
22
|
+
return Number.isFinite(value) ? value : fallback;
|
|
23
|
+
}
|
|
24
|
+
if (typeof value === 'string') {
|
|
25
|
+
const parsed = Number(value);
|
|
26
|
+
return Number.isFinite(parsed) ? parsed : fallback;
|
|
27
|
+
}
|
|
28
|
+
return fallback;
|
|
29
|
+
};
|
|
30
|
+
const toFontWeight = (value, fallback) => {
|
|
31
|
+
if (typeof value === 'number') {
|
|
32
|
+
return String(value);
|
|
33
|
+
}
|
|
34
|
+
if (typeof value === 'string') {
|
|
35
|
+
return value;
|
|
36
|
+
}
|
|
37
|
+
return fallback;
|
|
38
|
+
};
|
|
39
|
+
function resolveInstitutionBadgeTokens(modes) {
|
|
40
|
+
const gap = toNumber((0, _figmaVariablesResolver.getVariableByName)('institutionBadge/gap', modes), 8);
|
|
41
|
+
const foreground = (0, _figmaVariablesResolver.getVariableByName)('institutionBadge/foreground', modes) || '#080d1a';
|
|
42
|
+
const fontSize = toNumber((0, _figmaVariablesResolver.getVariableByName)('institutionBadge/fontSize', modes), 14);
|
|
43
|
+
const fontFamily = (0, _figmaVariablesResolver.getVariableByName)('institutionBadge/fontFamily', modes) || 'JioType Var';
|
|
44
|
+
const lineHeight = toNumber((0, _figmaVariablesResolver.getVariableByName)('institutionBadge/lineHeight', modes), 18);
|
|
45
|
+
const fontWeight = toFontWeight((0, _figmaVariablesResolver.getVariableByName)('institutionBadge/fontWeight', modes), '500');
|
|
46
|
+
|
|
47
|
+
// Avatar wrapper styled from shared `avatar/*` tokens so the badge stays
|
|
48
|
+
// visually consistent with other Avatar-bearing components.
|
|
49
|
+
const avatarSize = toNumber((0, _figmaVariablesResolver.getVariableByName)('avatar/size', modes), 36);
|
|
50
|
+
const avatarRadiusRaw = toNumber((0, _figmaVariablesResolver.getVariableByName)('avatar/radius', modes), 9999);
|
|
51
|
+
// 9999 is the design-token sentinel for "perfect circle".
|
|
52
|
+
const avatarRadius = avatarRadiusRaw === 9999 ? avatarSize / 2 : avatarRadiusRaw;
|
|
53
|
+
const avatarBorderColor = (0, _figmaVariablesResolver.getVariableByName)('avatar/border/color', modes) || 'rgba(255,255,255,0)';
|
|
54
|
+
const avatarBorderSize = toNumber((0, _figmaVariablesResolver.getVariableByName)('avatar/border/size', modes), 1);
|
|
55
|
+
return {
|
|
56
|
+
containerStyle: {
|
|
57
|
+
alignItems: 'center',
|
|
58
|
+
flexDirection: 'row',
|
|
59
|
+
gap
|
|
60
|
+
},
|
|
61
|
+
avatarStyle: {
|
|
62
|
+
width: avatarSize,
|
|
63
|
+
height: avatarSize,
|
|
64
|
+
borderRadius: avatarRadius,
|
|
65
|
+
borderWidth: avatarBorderSize,
|
|
66
|
+
borderColor: avatarBorderColor,
|
|
67
|
+
overflow: 'hidden'
|
|
68
|
+
},
|
|
69
|
+
avatarSize,
|
|
70
|
+
labelStyle: {
|
|
71
|
+
color: foreground,
|
|
72
|
+
fontFamily,
|
|
73
|
+
fontSize,
|
|
74
|
+
fontWeight,
|
|
75
|
+
lineHeight
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Default Avatar Size = M (36px in tokens) — matches the Figma badge. Callers
|
|
81
|
+
// can override via `modes` if needed.
|
|
82
|
+
const DEFAULT_AVATAR_MODE = 'M';
|
|
83
|
+
function InstitutionBadge({
|
|
84
|
+
label = 'State Bank of India',
|
|
85
|
+
source,
|
|
86
|
+
avatarSlot,
|
|
87
|
+
modes: propModes = _reactUtils.EMPTY_MODES,
|
|
88
|
+
style,
|
|
89
|
+
labelStyle,
|
|
90
|
+
accessibilityLabel,
|
|
91
|
+
...rest
|
|
92
|
+
}) {
|
|
93
|
+
const {
|
|
94
|
+
modes: globalModes
|
|
95
|
+
} = (0, _JFSThemeProvider.useTokens)();
|
|
96
|
+
const modes = (0, _react.useMemo)(() => globalModes === _reactUtils.EMPTY_MODES && propModes === _reactUtils.EMPTY_MODES ? _reactUtils.EMPTY_MODES : {
|
|
97
|
+
...globalModes,
|
|
98
|
+
...propModes
|
|
99
|
+
}, [globalModes, propModes]);
|
|
100
|
+
const avatarModes = (0, _react.useMemo)(() => ({
|
|
101
|
+
'Avatar Size': DEFAULT_AVATAR_MODE,
|
|
102
|
+
...modes
|
|
103
|
+
}), [modes]);
|
|
104
|
+
const tokens = (0, _react.useMemo)(() => resolveInstitutionBadgeTokens(avatarModes), [avatarModes]);
|
|
105
|
+
const processedAvatarSlot = (0, _react.useMemo)(() => {
|
|
106
|
+
if (!avatarSlot) return null;
|
|
107
|
+
const processed = (0, _reactUtils.cloneChildrenWithModes)(_react.default.Children.toArray(avatarSlot), avatarModes);
|
|
108
|
+
return processed.length === 1 ? processed[0] : processed;
|
|
109
|
+
}, [avatarSlot, avatarModes]);
|
|
110
|
+
const resolvedSource = source ?? DEFAULT_AVATAR_IMAGE;
|
|
111
|
+
const defaultAccessibilityLabel = accessibilityLabel ?? label;
|
|
112
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
113
|
+
accessibilityLabel: defaultAccessibilityLabel,
|
|
114
|
+
style: [tokens.containerStyle, style],
|
|
115
|
+
...rest,
|
|
116
|
+
children: [processedAvatarSlot || /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
117
|
+
style: tokens.avatarStyle,
|
|
118
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_MediaSource.default, {
|
|
119
|
+
source: resolvedSource,
|
|
120
|
+
size: tokens.avatarSize,
|
|
121
|
+
resizeMode: "cover",
|
|
122
|
+
accessibilityElementsHidden: true,
|
|
123
|
+
importantForAccessibility: "no"
|
|
124
|
+
})
|
|
125
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
126
|
+
style: [tokens.labelStyle, labelStyle],
|
|
127
|
+
numberOfLines: 1,
|
|
128
|
+
children: label
|
|
129
|
+
})]
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
var _default = exports.default = /*#__PURE__*/_react.default.memo(InstitutionBadge);
|
|
@@ -52,7 +52,9 @@ function ListGroup({
|
|
|
52
52
|
}) {
|
|
53
53
|
// Resolve container tokens
|
|
54
54
|
const backgroundColor = (0, _figmaVariablesResolver.getVariableByName)('listGroup/background', modes) || 'rgba(255,255,255,0)';
|
|
55
|
-
|
|
55
|
+
// The current exported token aliases a missing Figma variable. Keep the
|
|
56
|
+
// transparent fallback without logging the missing alias on every render.
|
|
57
|
+
const borderColor = 'rgba(255,255,255,0)';
|
|
56
58
|
const borderWidth = (0, _figmaVariablesResolver.getVariableByName)('listGroup/borderWidth', modes) || 0;
|
|
57
59
|
const gap = (0, _figmaVariablesResolver.getVariableByName)('listGroup/gap', modes) || 12;
|
|
58
60
|
|