jfs-components 0.0.69 → 0.0.71

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.
Files changed (56) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/lib/commonjs/components/CardAdvisory/CardAdvisory.js +203 -0
  3. package/lib/commonjs/components/CardCTA/CardCTA.js +198 -16
  4. package/lib/commonjs/components/CircularProgressBar/CircularProgressBar.js +147 -0
  5. package/lib/commonjs/components/CircularProgressBarDoted/CircularProgressBarDoted.js +258 -0
  6. package/lib/commonjs/components/CircularRating/CircularRating.js +161 -0
  7. package/lib/commonjs/components/Gauge/Gauge.js +223 -0
  8. package/lib/commonjs/components/ListGroup/ListGroup.js +3 -1
  9. package/lib/commonjs/components/MediaCard/GlassFill.js +62 -0
  10. package/lib/commonjs/components/MediaCard/GlassFill.web.js +48 -0
  11. package/lib/commonjs/components/MediaCard/MediaCard.js +28 -31
  12. package/lib/commonjs/components/Nudge/Nudge.js +179 -87
  13. package/lib/commonjs/components/index.js +35 -0
  14. package/lib/commonjs/design-tokens/Coin Variables-variables-full.json +1 -1
  15. package/lib/commonjs/icons/registry.js +1 -1
  16. package/lib/module/components/CardAdvisory/CardAdvisory.js +197 -0
  17. package/lib/module/components/CardCTA/CardCTA.js +199 -17
  18. package/lib/module/components/CircularProgressBar/CircularProgressBar.js +141 -0
  19. package/lib/module/components/CircularProgressBarDoted/CircularProgressBarDoted.js +253 -0
  20. package/lib/module/components/CircularRating/CircularRating.js +155 -0
  21. package/lib/module/components/Gauge/Gauge.js +217 -0
  22. package/lib/module/components/ListGroup/ListGroup.js +3 -1
  23. package/lib/module/components/MediaCard/GlassFill.js +57 -0
  24. package/lib/module/components/MediaCard/GlassFill.web.js +43 -0
  25. package/lib/module/components/MediaCard/MediaCard.js +29 -32
  26. package/lib/module/components/Nudge/Nudge.js +178 -87
  27. package/lib/module/components/index.js +5 -0
  28. package/lib/module/design-tokens/Coin Variables-variables-full.json +1 -1
  29. package/lib/module/icons/registry.js +1 -1
  30. package/lib/typescript/src/components/CardAdvisory/CardAdvisory.d.ts +49 -0
  31. package/lib/typescript/src/components/CardCTA/CardCTA.d.ts +16 -1
  32. package/lib/typescript/src/components/CircularProgressBar/CircularProgressBar.d.ts +27 -0
  33. package/lib/typescript/src/components/CircularProgressBarDoted/CircularProgressBarDoted.d.ts +48 -0
  34. package/lib/typescript/src/components/CircularRating/CircularRating.d.ts +49 -0
  35. package/lib/typescript/src/components/Gauge/Gauge.d.ts +53 -0
  36. package/lib/typescript/src/components/MediaCard/GlassFill.d.ts +47 -0
  37. package/lib/typescript/src/components/MediaCard/GlassFill.web.d.ts +20 -0
  38. package/lib/typescript/src/components/MediaCard/MediaCard.d.ts +17 -13
  39. package/lib/typescript/src/components/Nudge/Nudge.d.ts +14 -11
  40. package/lib/typescript/src/components/index.d.ts +6 -1
  41. package/lib/typescript/src/icons/registry.d.ts +1 -1
  42. package/package.json +3 -2
  43. package/src/components/CardAdvisory/CardAdvisory.tsx +283 -0
  44. package/src/components/CardCTA/CardCTA.tsx +236 -13
  45. package/src/components/CircularProgressBar/CircularProgressBar.tsx +190 -0
  46. package/src/components/CircularProgressBarDoted/CircularProgressBarDoted.tsx +357 -0
  47. package/src/components/CircularRating/CircularRating.tsx +241 -0
  48. package/src/components/Gauge/Gauge.tsx +303 -0
  49. package/src/components/ListGroup/ListGroup.tsx +3 -1
  50. package/src/components/MediaCard/GlassFill.tsx +89 -0
  51. package/src/components/MediaCard/GlassFill.web.tsx +53 -0
  52. package/src/components/MediaCard/MediaCard.tsx +29 -48
  53. package/src/components/Nudge/Nudge.tsx +222 -82
  54. package/src/components/index.ts +6 -1
  55. package/src/design-tokens/Coin Variables-variables-full.json +1 -1
  56. package/src/icons/registry.ts +1 -1
@@ -0,0 +1,258 @@
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 _IconChevronright = require("../../icons/components/IconChevronright");
13
+ var _jsxRuntime = require("react/jsx-runtime");
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); }
15
+ const DEFAULT_DOT_COUNT = 24;
16
+ const START_ANGLE_DEGREES = -90;
17
+ const clamp = (value, min, max) => Math.min(max, Math.max(min, value));
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
+ const getBackgroundColor = (style, fallback) => {
38
+ const flattened = _reactNative.StyleSheet.flatten(style);
39
+ return typeof flattened.backgroundColor === 'string' ? flattened.backgroundColor : fallback;
40
+ };
41
+ function CircularProgressBarDoted({
42
+ value = 72,
43
+ dotCount = DEFAULT_DOT_COUNT,
44
+ label = 'Rating',
45
+ tierLabel = 'Doing great',
46
+ showChevron = true,
47
+ onPress,
48
+ onTierPress,
49
+ modes: propModes = _reactUtils.EMPTY_MODES,
50
+ children,
51
+ style,
52
+ ringStyle,
53
+ trackDotStyle,
54
+ progressDotStyle,
55
+ contentStyle,
56
+ scoreTierStyle,
57
+ scoreTrendStyle,
58
+ labelStyle,
59
+ scoreLabelStyle,
60
+ tierLabelStyle,
61
+ accessibilityLabel,
62
+ onLayout,
63
+ ...rest
64
+ }) {
65
+ const {
66
+ modes: globalModes
67
+ } = (0, _JFSThemeProvider.useTokens)();
68
+ const modes = {
69
+ ...globalModes,
70
+ ...propModes
71
+ };
72
+ const [layoutSize, setLayoutSize] = (0, _react.useState)(0);
73
+ const normalizedValue = clamp(value, 0, 100);
74
+ const resolvedDotCount = Math.max(1, Math.floor(dotCount));
75
+ const activeDots = normalizedValue <= 0 ? 0 : Math.ceil(normalizedValue / 100 * resolvedDotCount);
76
+ const dotShadowSize = toNumber((0, _figmaVariablesResolver.getVariableByName)('circularProgressBarDoted/dot/shadow/size', modes), 6);
77
+ const baseDotSize = toNumber((0, _figmaVariablesResolver.getVariableByName)('circularProgressBarDoted/dot/size', modes), 6);
78
+ const dotSize = baseDotSize + dotShadowSize;
79
+ const outerDotSize = dotSize;
80
+ const ringSize = layoutSize;
81
+ const ringRadius = Math.max(0, (ringSize - outerDotSize) / 2);
82
+ const trackDotColor = getBackgroundColor(trackDotStyle, (0, _figmaVariablesResolver.getVariableByName)('circularProgressBarDoted/trackDot/bg', modes) || '#ebebed');
83
+ const progressDotColor = getBackgroundColor(progressDotStyle, (0, _figmaVariablesResolver.getVariableByName)('circularProgressBarDoted/progressDot/bg', modes) || '#25ab21');
84
+ const contentGap = toNumber((0, _figmaVariablesResolver.getVariableByName)('circularProgressBarDoted/gap', modes), 12);
85
+ const scoreTierGap = toNumber((0, _figmaVariablesResolver.getVariableByName)('circularProgressBarDoted/scoreTier/gap', modes), 6);
86
+ const scoreTierWidth = toNumber((0, _figmaVariablesResolver.getVariableByName)('circularProgressBarDoted/scoreTier/width', modes), 116);
87
+ const scoreTrendGap = toNumber((0, _figmaVariablesResolver.getVariableByName)('circularProgressBarDoted/scoreTrend/gap', modes), 2);
88
+ const scoreTrendHeight = toNumber((0, _figmaVariablesResolver.getVariableByName)('circularProgressBarDoted/scoreTrend/height', modes), 24);
89
+ const typographyFontFamily = (0, _figmaVariablesResolver.getVariableByName)('Typography/Font Family', modes) || 'JioType Var';
90
+ const labelColor = (0, _figmaVariablesResolver.getVariableByName)('circularProgressBarDoted/label/color', modes) || '#080d1a';
91
+ const labelFontSize = toNumber((0, _figmaVariablesResolver.getVariableByName)('Typography/Size/Body/XS', modes), 12);
92
+ const labelFontWeight = toFontWeight((0, _figmaVariablesResolver.getVariableByName)('Typography/Font Weight/Body Low (Regular)', modes), '400');
93
+ const scoreColor = (0, _figmaVariablesResolver.getVariableByName)('circularProgressBarDoted/scoreLabel/color', modes) || '#080d1a';
94
+ const scoreFontSize = toNumber((0, _figmaVariablesResolver.getVariableByName)('circularProgressBarDoted/scoreLabel/fontSize', modes), 56);
95
+ const scoreFontFamily = (0, _figmaVariablesResolver.getVariableByName)('circularProgressBarDoted/scoreLabel/fontFamily', modes) || 'JioType Var';
96
+ const scoreLineHeight = toNumber((0, _figmaVariablesResolver.getVariableByName)('circularProgressBarDoted/scoreLabel/lineHeight', modes), 56);
97
+ const scoreFontWeight = toFontWeight((0, _figmaVariablesResolver.getVariableByName)('circularProgressBarDoted/scoreLabel/fontWeight', modes), '900');
98
+ const tierColor = (0, _figmaVariablesResolver.getVariableByName)('circularProgressBarDoted/tierLabel/color', modes) || '#080d1a';
99
+ const tierFontSize = toNumber((0, _figmaVariablesResolver.getVariableByName)('Typography/Size/Body/M', modes), 16);
100
+ const tierFontWeight = toFontWeight((0, _figmaVariablesResolver.getVariableByName)('Typography/Font Weight/Body High', modes), '700');
101
+ const iconColor = (0, _figmaVariablesResolver.getVariableByName)('circularProgressBarDoted/icon/color', modes) || '#303338';
102
+ const iconSize = toNumber((0, _figmaVariablesResolver.getVariableByName)('circularProgressBarDoted/icon/size', modes), 24);
103
+ const dots = (0, _react.useMemo)(() => Array.from({
104
+ length: resolvedDotCount
105
+ }, (_, index) => {
106
+ const angle = (360 / resolvedDotCount * index + START_ANGLE_DEGREES) * (Math.PI / 180);
107
+ const center = ringSize / 2;
108
+ return {
109
+ isActive: index < activeDots,
110
+ left: center + ringRadius * Math.cos(angle) - outerDotSize / 2,
111
+ top: center + ringRadius * Math.sin(angle) - outerDotSize / 2
112
+ };
113
+ }), [activeDots, outerDotSize, resolvedDotCount, ringRadius, ringSize]);
114
+ const containerStyle = {
115
+ alignItems: 'center',
116
+ alignSelf: 'stretch',
117
+ height: '100%',
118
+ justifyContent: 'center',
119
+ position: 'relative',
120
+ width: '100%'
121
+ };
122
+ const computedRingStyle = {
123
+ height: ringSize,
124
+ position: 'absolute',
125
+ width: ringSize
126
+ };
127
+ const dotOuterStyle = {
128
+ alignItems: 'center',
129
+ height: outerDotSize,
130
+ justifyContent: 'center',
131
+ position: 'absolute',
132
+ width: outerDotSize
133
+ };
134
+ const dotInnerStyle = {
135
+ borderRadius: dotSize / 2,
136
+ height: dotSize,
137
+ width: dotSize
138
+ };
139
+ const computedContentStyle = {
140
+ alignItems: 'center',
141
+ gap: contentGap,
142
+ justifyContent: 'center',
143
+ minWidth: scoreTierWidth
144
+ };
145
+ const computedScoreTierStyle = {
146
+ alignItems: 'center',
147
+ gap: scoreTierGap,
148
+ justifyContent: 'center',
149
+ width: '100%'
150
+ };
151
+ const computedScoreTrendStyle = {
152
+ alignItems: 'center',
153
+ flexDirection: 'row',
154
+ gap: scoreTrendGap,
155
+ height: scoreTrendHeight,
156
+ justifyContent: 'center',
157
+ minWidth: scoreTierWidth
158
+ };
159
+ const computedLabelStyle = {
160
+ color: labelColor,
161
+ fontFamily: typographyFontFamily,
162
+ fontSize: labelFontSize,
163
+ fontWeight: labelFontWeight,
164
+ lineHeight: labelFontSize * 1.3,
165
+ textAlign: 'center'
166
+ };
167
+ const computedScoreLabelStyle = {
168
+ color: scoreColor,
169
+ fontFamily: scoreFontFamily,
170
+ fontSize: scoreFontSize,
171
+ fontWeight: scoreFontWeight,
172
+ lineHeight: scoreLineHeight,
173
+ textAlign: 'center'
174
+ };
175
+ const computedTierLabelStyle = {
176
+ color: tierColor,
177
+ fontFamily: typographyFontFamily,
178
+ fontSize: tierFontSize,
179
+ fontWeight: tierFontWeight,
180
+ lineHeight: tierFontSize * 1.3,
181
+ textAlign: 'center'
182
+ };
183
+ const resolvedScoreLabel = String(Math.round(normalizedValue));
184
+ const defaultAccessibilityLabel = accessibilityLabel ?? `${label}. ${resolvedScoreLabel} out of 100. ${tierLabel}`;
185
+ const handleLayout = event => {
186
+ onLayout?.(event);
187
+ const {
188
+ width,
189
+ height
190
+ } = event.nativeEvent.layout;
191
+ const nextSize = Math.max(0, Math.min(width, height));
192
+ setLayoutSize(currentSize => currentSize === nextSize ? currentSize : nextSize);
193
+ };
194
+ const trendContent = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
195
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
196
+ numberOfLines: 1,
197
+ style: [computedTierLabelStyle, tierLabelStyle],
198
+ children: tierLabel
199
+ }), showChevron ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_IconChevronright.IconChevronright, {
200
+ width: iconSize,
201
+ height: iconSize,
202
+ fill: iconColor,
203
+ color: iconColor
204
+ }) : null]
205
+ });
206
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Pressable, {
207
+ accessibilityRole: "progressbar",
208
+ accessibilityLabel: defaultAccessibilityLabel,
209
+ accessibilityValue: {
210
+ min: 0,
211
+ max: 100,
212
+ now: normalizedValue
213
+ },
214
+ disabled: !onPress,
215
+ onLayout: handleLayout,
216
+ onPress: onPress,
217
+ style: [containerStyle, style],
218
+ ...rest,
219
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
220
+ pointerEvents: "none",
221
+ style: [computedRingStyle, ringStyle],
222
+ children: dots.map((dot, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
223
+ style: [dotOuterStyle, {
224
+ left: dot.left,
225
+ top: dot.top
226
+ }],
227
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
228
+ style: [dotInnerStyle, {
229
+ backgroundColor: dot.isActive ? progressDotColor : trackDotColor
230
+ }, dot.isActive ? progressDotStyle : trackDotStyle]
231
+ })
232
+ }, index))
233
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
234
+ style: [computedContentStyle, contentStyle],
235
+ children: children ? (0, _reactUtils.cloneChildrenWithModes)(children, modes) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
236
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
237
+ style: [computedScoreTierStyle, scoreTierStyle],
238
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
239
+ style: [computedLabelStyle, labelStyle],
240
+ children: label
241
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
242
+ style: [computedScoreLabelStyle, scoreLabelStyle],
243
+ children: resolvedScoreLabel
244
+ })]
245
+ }), onTierPress ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
246
+ accessibilityRole: "button",
247
+ onPress: onTierPress,
248
+ style: [computedScoreTrendStyle, scoreTrendStyle],
249
+ children: trendContent
250
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
251
+ style: [computedScoreTrendStyle, scoreTrendStyle],
252
+ children: trendContent
253
+ })]
254
+ })
255
+ })]
256
+ });
257
+ }
258
+ var _default = exports.default = CircularProgressBarDoted;
@@ -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;
@@ -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
- const borderColor = (0, _figmaVariablesResolver.getVariableByName)('listGroup/border/color', modes) || 'rgba(255,255,255,0)';
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