jfs-components 0.0.72 → 0.0.74

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 (158) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/lib/commonjs/components/AccordionCheckbox/AccordionCheckbox.js +239 -0
  3. package/lib/commonjs/components/AccountCard/AccountCard.js +247 -0
  4. package/lib/commonjs/components/AppBar/AppBar.js +17 -11
  5. package/lib/commonjs/components/BrandChip/BrandChip.js +149 -0
  6. package/lib/commonjs/components/CardBankAccount/CardBankAccount.js +229 -0
  7. package/lib/commonjs/components/CardInsight/CardInsight.js +166 -0
  8. package/lib/commonjs/components/CheckboxGroup/CheckboxGroup.js +67 -0
  9. package/lib/commonjs/components/CheckboxItem/CheckboxItem.js +140 -0
  10. package/lib/commonjs/components/CircularProgressBar/CircularProgressBar.js +56 -9
  11. package/lib/commonjs/components/CoverageBarComparison/CoverageBarComparison.js +272 -0
  12. package/lib/commonjs/components/CoverageRing/CoverageRing.js +141 -0
  13. package/lib/commonjs/components/DonutChart/DonutChart.js +309 -0
  14. package/lib/commonjs/components/DonutChartSummary/DonutChartSummary.js +155 -0
  15. package/lib/commonjs/components/Dropdown/Dropdown.js +214 -0
  16. package/lib/commonjs/components/DropdownInput/DropdownInput.js +542 -0
  17. package/lib/commonjs/components/FormField/FormField.js +328 -178
  18. package/lib/commonjs/components/LinearMeter/LinearMeter.js +9 -28
  19. package/lib/commonjs/components/LinearProgress/LinearProgress.js +68 -0
  20. package/lib/commonjs/components/LottieIntroBlock/LottieIntroBlock.js +150 -0
  21. package/lib/commonjs/components/MetricLegendItem/MetricLegendItem.js +95 -0
  22. package/lib/commonjs/components/MonthlyStatusGrid/MonthlyStatusGrid.js +286 -0
  23. package/lib/commonjs/components/OTP/OTP.js +381 -37
  24. package/lib/commonjs/components/PageHero/PageHero.js +153 -0
  25. package/lib/commonjs/components/PoweredByLabel/PoweredByLabel.js +135 -0
  26. package/lib/commonjs/components/PoweredByLabel/finvu.png +0 -0
  27. package/lib/commonjs/components/ProductOverview/ProductOverview.js +147 -0
  28. package/lib/commonjs/components/RangeTrack/RangeTrack.js +269 -0
  29. package/lib/commonjs/components/SavingsGoalSummary/SavingsGoalSummary.js +181 -0
  30. package/lib/commonjs/components/SegmentedTrack/SegmentedTrack.js +171 -0
  31. package/lib/commonjs/components/StatGroup/StatGroup.js +128 -0
  32. package/lib/commonjs/components/StatItem/StatItem.js +65 -35
  33. package/lib/commonjs/components/StrengthIndicator/StrengthIndicator.js +157 -0
  34. package/lib/commonjs/components/SummaryTile/SummaryTile.js +150 -0
  35. package/lib/commonjs/components/Text/Text.js +9 -2
  36. package/lib/commonjs/components/Tooltip/Tooltip.js +34 -27
  37. package/lib/commonjs/components/index.js +231 -1
  38. package/lib/commonjs/design-tokens/Coin Variables-variables-full.json +1 -1
  39. package/lib/commonjs/icons/registry.js +1 -1
  40. package/lib/commonjs/utils/index.js +7 -0
  41. package/lib/commonjs/utils/number-utils.js +57 -0
  42. package/lib/module/components/AccordionCheckbox/AccordionCheckbox.js +233 -0
  43. package/lib/module/components/AccountCard/AccountCard.js +241 -0
  44. package/lib/module/components/AppBar/AppBar.js +17 -11
  45. package/lib/module/components/BrandChip/BrandChip.js +143 -0
  46. package/lib/module/components/CardBankAccount/CardBankAccount.js +223 -0
  47. package/lib/module/components/CardInsight/CardInsight.js +161 -0
  48. package/lib/module/components/CheckboxGroup/CheckboxGroup.js +62 -0
  49. package/lib/module/components/CheckboxItem/CheckboxItem.js +134 -0
  50. package/lib/module/components/CircularProgressBar/CircularProgressBar.js +56 -9
  51. package/lib/module/components/CoverageBarComparison/CoverageBarComparison.js +266 -0
  52. package/lib/module/components/CoverageRing/CoverageRing.js +136 -0
  53. package/lib/module/components/DonutChart/DonutChart.js +303 -0
  54. package/lib/module/components/DonutChartSummary/DonutChartSummary.js +150 -0
  55. package/lib/module/components/Dropdown/Dropdown.js +206 -0
  56. package/lib/module/components/DropdownInput/DropdownInput.js +536 -0
  57. package/lib/module/components/FormField/FormField.js +330 -180
  58. package/lib/module/components/LinearMeter/LinearMeter.js +9 -28
  59. package/lib/module/components/LinearProgress/LinearProgress.js +63 -0
  60. package/lib/module/components/LottieIntroBlock/LottieIntroBlock.js +144 -0
  61. package/lib/module/components/MetricLegendItem/MetricLegendItem.js +90 -0
  62. package/lib/module/components/MonthlyStatusGrid/MonthlyStatusGrid.js +281 -0
  63. package/lib/module/components/OTP/OTP.js +381 -38
  64. package/lib/module/components/PageHero/PageHero.js +147 -0
  65. package/lib/module/components/PoweredByLabel/PoweredByLabel.js +130 -0
  66. package/lib/module/components/PoweredByLabel/finvu.png +0 -0
  67. package/lib/module/components/ProductOverview/ProductOverview.js +142 -0
  68. package/lib/module/components/RangeTrack/RangeTrack.js +263 -0
  69. package/lib/module/components/SavingsGoalSummary/SavingsGoalSummary.js +175 -0
  70. package/lib/module/components/SegmentedTrack/SegmentedTrack.js +166 -0
  71. package/lib/module/components/StatGroup/StatGroup.js +123 -0
  72. package/lib/module/components/StatItem/StatItem.js +66 -36
  73. package/lib/module/components/StrengthIndicator/StrengthIndicator.js +152 -0
  74. package/lib/module/components/SummaryTile/SummaryTile.js +145 -0
  75. package/lib/module/components/Text/Text.js +9 -2
  76. package/lib/module/components/Tooltip/Tooltip.js +34 -27
  77. package/lib/module/components/index.js +28 -2
  78. package/lib/module/design-tokens/Coin Variables-variables-full.json +1 -1
  79. package/lib/module/icons/registry.js +1 -1
  80. package/lib/module/utils/index.js +2 -1
  81. package/lib/module/utils/number-utils.js +53 -0
  82. package/lib/typescript/src/components/AccordionCheckbox/AccordionCheckbox.d.ts +71 -0
  83. package/lib/typescript/src/components/AccountCard/AccountCard.d.ts +81 -0
  84. package/lib/typescript/src/components/BrandChip/BrandChip.d.ts +43 -0
  85. package/lib/typescript/src/components/CardBankAccount/CardBankAccount.d.ts +86 -0
  86. package/lib/typescript/src/components/CardInsight/CardInsight.d.ts +48 -0
  87. package/lib/typescript/src/components/CheckboxGroup/CheckboxGroup.d.ts +41 -0
  88. package/lib/typescript/src/components/CheckboxItem/CheckboxItem.d.ts +72 -0
  89. package/lib/typescript/src/components/CircularProgressBar/CircularProgressBar.d.ts +11 -1
  90. package/lib/typescript/src/components/CoverageBarComparison/CoverageBarComparison.d.ts +105 -0
  91. package/lib/typescript/src/components/CoverageRing/CoverageRing.d.ts +90 -0
  92. package/lib/typescript/src/components/DonutChart/DonutChart.d.ts +117 -0
  93. package/lib/typescript/src/components/DonutChartSummary/DonutChartSummary.d.ts +103 -0
  94. package/lib/typescript/src/components/Dropdown/Dropdown.d.ts +62 -0
  95. package/lib/typescript/src/components/DropdownInput/DropdownInput.d.ts +107 -0
  96. package/lib/typescript/src/components/FormField/FormField.d.ts +76 -19
  97. package/lib/typescript/src/components/LinearProgress/LinearProgress.d.ts +17 -0
  98. package/lib/typescript/src/components/LottieIntroBlock/LottieIntroBlock.d.ts +58 -0
  99. package/lib/typescript/src/components/MetricLegendItem/MetricLegendItem.d.ts +37 -0
  100. package/lib/typescript/src/components/MonthlyStatusGrid/MonthlyStatusGrid.d.ts +119 -0
  101. package/lib/typescript/src/components/OTP/OTP.d.ts +88 -2
  102. package/lib/typescript/src/components/PageHero/PageHero.d.ts +53 -0
  103. package/lib/typescript/src/components/PoweredByLabel/PoweredByLabel.d.ts +70 -0
  104. package/lib/typescript/src/components/ProductOverview/ProductOverview.d.ts +39 -0
  105. package/lib/typescript/src/components/RangeTrack/RangeTrack.d.ts +173 -0
  106. package/lib/typescript/src/components/SavingsGoalSummary/SavingsGoalSummary.d.ts +95 -0
  107. package/lib/typescript/src/components/SegmentedTrack/SegmentedTrack.d.ts +108 -0
  108. package/lib/typescript/src/components/StatGroup/StatGroup.d.ts +45 -0
  109. package/lib/typescript/src/components/StatItem/StatItem.d.ts +24 -7
  110. package/lib/typescript/src/components/StrengthIndicator/StrengthIndicator.d.ts +58 -0
  111. package/lib/typescript/src/components/SummaryTile/SummaryTile.d.ts +60 -0
  112. package/lib/typescript/src/components/Text/Text.d.ts +12 -2
  113. package/lib/typescript/src/components/Tooltip/Tooltip.d.ts +13 -2
  114. package/lib/typescript/src/components/index.d.ts +29 -3
  115. package/lib/typescript/src/icons/registry.d.ts +1 -1
  116. package/lib/typescript/src/utils/index.d.ts +1 -0
  117. package/lib/typescript/src/utils/number-utils.d.ts +29 -0
  118. package/package.json +1 -3
  119. package/src/components/AccordionCheckbox/AccordionCheckbox.tsx +323 -0
  120. package/src/components/AccountCard/AccountCard.tsx +376 -0
  121. package/src/components/AppBar/AppBar.tsx +25 -14
  122. package/src/components/BrandChip/BrandChip.tsx +235 -0
  123. package/src/components/CardBankAccount/CardBankAccount.tsx +321 -0
  124. package/src/components/CardInsight/CardInsight.tsx +239 -0
  125. package/src/components/CheckboxGroup/CheckboxGroup.tsx +86 -0
  126. package/src/components/CheckboxItem/CheckboxItem.tsx +209 -0
  127. package/src/components/CircularProgressBar/CircularProgressBar.tsx +74 -9
  128. package/src/components/CoverageBarComparison/CoverageBarComparison.tsx +378 -0
  129. package/src/components/CoverageRing/CoverageRing.tsx +225 -0
  130. package/src/components/DonutChart/DonutChart.tsx +503 -0
  131. package/src/components/DonutChartSummary/DonutChartSummary.tsx +256 -0
  132. package/src/components/Dropdown/Dropdown.tsx +331 -0
  133. package/src/components/DropdownInput/DropdownInput.tsx +819 -0
  134. package/src/components/FormField/FormField.tsx +542 -215
  135. package/src/components/LinearMeter/LinearMeter.tsx +9 -39
  136. package/src/components/LinearProgress/LinearProgress.tsx +92 -0
  137. package/src/components/LottieIntroBlock/LottieIntroBlock.tsx +202 -0
  138. package/src/components/MetricLegendItem/MetricLegendItem.tsx +167 -0
  139. package/src/components/MonthlyStatusGrid/MonthlyStatusGrid.tsx +438 -0
  140. package/src/components/OTP/OTP.tsx +476 -29
  141. package/src/components/PageHero/PageHero.tsx +200 -0
  142. package/src/components/PoweredByLabel/PoweredByLabel.tsx +221 -0
  143. package/src/components/PoweredByLabel/finvu.png +0 -0
  144. package/src/components/ProductOverview/ProductOverview.tsx +236 -0
  145. package/src/components/RangeTrack/RangeTrack.tsx +394 -0
  146. package/src/components/SavingsGoalSummary/SavingsGoalSummary.tsx +269 -0
  147. package/src/components/SegmentedTrack/SegmentedTrack.tsx +268 -0
  148. package/src/components/StatGroup/StatGroup.tsx +169 -0
  149. package/src/components/StatItem/StatItem.tsx +117 -40
  150. package/src/components/StrengthIndicator/StrengthIndicator.tsx +205 -0
  151. package/src/components/SummaryTile/SummaryTile.tsx +251 -0
  152. package/src/components/Text/Text.tsx +24 -3
  153. package/src/components/Tooltip/Tooltip.tsx +50 -25
  154. package/src/components/index.ts +47 -3
  155. package/src/design-tokens/Coin Variables-variables-full.json +1 -1
  156. package/src/icons/registry.ts +1 -1
  157. package/src/utils/index.ts +1 -0
  158. package/src/utils/number-utils.ts +60 -0
@@ -0,0 +1,309 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.DonutChartSegment = DonutChartSegment;
7
+ exports.default = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _reactNative = require("react-native");
10
+ var _reactNativeSvg = _interopRequireWildcard(require("react-native-svg"));
11
+ var _figmaVariablesResolver = require("../../design-tokens/figma-variables-resolver");
12
+ var _JFSThemeProvider = require("../../design-tokens/JFSThemeProvider");
13
+ var _reactUtils = require("../../utils/react-utils");
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
+ /**
18
+ * Per-segment data definition for the data-driven `segments` prop.
19
+ *
20
+ * Each segment renders one arc on the donut ring. `value` controls the
21
+ * arc's angular share (its weight relative to the sum of all values).
22
+ * Use `modes` per segment to override the default `Appearance / DataViz`
23
+ * mode (the parent injects per-index defaults of `Senary`, `Primary`,
24
+ * `Secondary`, `Tertiary`, `Quaternary`, `Quinary`, then cycles).
25
+ */
26
+
27
+ const DEFAULT_APPEARANCE_CYCLE = ['Senary', 'Primary', 'Secondary', 'Tertiary', 'Quaternary', 'Quinary'];
28
+ const DEFAULT_SEGMENTS = [{
29
+ value: 1
30
+ }, {
31
+ value: 1
32
+ }, {
33
+ value: 1
34
+ }, {
35
+ value: 1
36
+ }, {
37
+ value: 1
38
+ }, {
39
+ value: 1
40
+ }];
41
+ const STROKE_WIDTH_RATIO = 18 / 194;
42
+ const toNumber = (value, fallback) => {
43
+ if (typeof value === 'number') {
44
+ return Number.isFinite(value) ? value : fallback;
45
+ }
46
+ if (typeof value === 'string') {
47
+ const parsed = Number(value);
48
+ return Number.isFinite(parsed) ? parsed : fallback;
49
+ }
50
+ return fallback;
51
+ };
52
+ const toFontWeight = (value, fallback) => {
53
+ if (typeof value === 'number') {
54
+ return String(value);
55
+ }
56
+ if (typeof value === 'string') {
57
+ return value;
58
+ }
59
+ return fallback;
60
+ };
61
+
62
+ /**
63
+ * Compute the default `Appearance / DataViz` mode for a segment at `index`.
64
+ * Cycles through {@link DEFAULT_APPEARANCE_CYCLE} so any number of segments
65
+ * gets a sensible default (Senary, Primary, Secondary, Tertiary,
66
+ * Quaternary, Quinary, then repeats).
67
+ */
68
+ function defaultAppearanceFor(index) {
69
+ return DEFAULT_APPEARANCE_CYCLE[index % DEFAULT_APPEARANCE_CYCLE.length];
70
+ }
71
+
72
+ /**
73
+ * Resolve a single segment's stroke color through the design tokens. Honors
74
+ * any explicit `color` override, then falls back to `dataViz/bg` for the
75
+ * supplied `modes`, then to the Figma reference purple.
76
+ */
77
+ function resolveSegmentColor(color, modes) {
78
+ if (color) return color;
79
+ return (0, _figmaVariablesResolver.getVariableByName)('dataViz/bg', modes) ?? '#5d00b5';
80
+ }
81
+
82
+ /**
83
+ * Coerce a slot child into a `DonutChartSegmentData` so the rendering path
84
+ * is uniform. Reads `value`, `color`, `modes` and `accessibilityLabel`
85
+ * from the child's props and ignores anything else.
86
+ */
87
+ function segmentDataFromChild(child, fallbackKey) {
88
+ const props = child.props ?? {};
89
+ return {
90
+ key: child.key ?? fallbackKey,
91
+ value: toNumber(props.value, 1),
92
+ color: typeof props.color === 'string' ? props.color : undefined,
93
+ modes: props.modes,
94
+ accessibilityLabel: props.accessibilityLabel
95
+ };
96
+ }
97
+ /**
98
+ * Inert helper used purely to author donut segments declaratively as
99
+ * `DonutChart.Segment` slot children. The parent reads its props and
100
+ * renders the actual SVG arcs — this component never renders anything by
101
+ * itself.
102
+ */
103
+ function DonutChartSegment(_) {
104
+ return null;
105
+ }
106
+
107
+ /**
108
+ * `DonutChart` renders a circular ring split into categorical segments.
109
+ * It is the segmented counterpart of `CircularProgressBar`: there is **no
110
+ * track background** behind the segments — the colored ring *is* the
111
+ * data, and each slice is a sibling category rather than a directional or
112
+ * temporal value.
113
+ *
114
+ * The default 6-segment layout receives per-index `Appearance / DataViz`
115
+ * defaults (segment 1 → `Senary`, 2 → `Primary`, 3 → `Secondary`, 4 →
116
+ * `Tertiary`, 5 → `Quaternary`, 6 → `Quinary`) so the wheel reads as one
117
+ * concept split into six color-coded categories. Override `modes` per
118
+ * segment to remix appearances, or set `Emphasis / DataViz` on the
119
+ * parent `modes` to dim or brighten the whole wheel at once.
120
+ *
121
+ * @component
122
+ * @param {DonutChartProps} props
123
+ */
124
+ function DonutChart({
125
+ segments,
126
+ value,
127
+ label,
128
+ children,
129
+ size = 194,
130
+ strokeWidth: strokeWidthProp,
131
+ gap = 0,
132
+ modes: propModes = _reactUtils.EMPTY_MODES,
133
+ style,
134
+ valueStyle,
135
+ labelStyle,
136
+ accessibilityLabel
137
+ }) {
138
+ const {
139
+ modes: globalModes
140
+ } = (0, _JFSThemeProvider.useTokens)();
141
+ const modes = {
142
+ ...globalModes,
143
+ ...propModes
144
+ };
145
+ const strokeWidth = Math.max(1, toNumber(strokeWidthProp, Math.max(1, size * STROKE_WIDTH_RATIO)));
146
+ const radius = Math.max(0, (size - strokeWidth) / 2);
147
+ const center = size / 2;
148
+ const circumference = 2 * Math.PI * radius;
149
+ const gapLength = Math.max(0, gap) / 360 * circumference;
150
+ const slotChildren = (0, _reactUtils.flattenChildren)(children).filter(child => /*#__PURE__*/_react.default.isValidElement(child));
151
+ const slotSegmentChildren = slotChildren.filter(child => child.type === DonutChartSegment);
152
+ let resolvedSegments;
153
+ if (slotSegmentChildren.length > 0) {
154
+ resolvedSegments = slotSegmentChildren.map((child, index) => segmentDataFromChild(child, `segment-${index}`));
155
+ } else if (segments && segments.length > 0) {
156
+ resolvedSegments = segments;
157
+ } else {
158
+ resolvedSegments = DEFAULT_SEGMENTS;
159
+ }
160
+ const totalValue = resolvedSegments.reduce((sum, segment) => sum + Math.max(0, toNumber(segment.value, 0)), 0);
161
+ const hasData = totalValue > 0 && resolvedSegments.length > 0;
162
+ const arcs = hasData ? buildArcs({
163
+ segments: resolvedSegments,
164
+ totalValue,
165
+ circumference,
166
+ gapLength,
167
+ modes
168
+ }) : [];
169
+ const customCenterChildren = slotChildren.filter(child => child.type !== DonutChartSegment);
170
+ const hasChildrenSlot = customCenterChildren.length > 0;
171
+ const showValueLabel = !hasChildrenSlot && shouldRenderText(value);
172
+ const showLabel = !hasChildrenSlot && shouldRenderText(label);
173
+ const valueColor = (0, _figmaVariablesResolver.getVariableByName)('donutChart/value/color', modes) ?? (0, _figmaVariablesResolver.getVariableByName)('value/fg', modes) ?? '#000000';
174
+ const valueFontFamily = (0, _figmaVariablesResolver.getVariableByName)('donutChart/value/fontFamily', modes) ?? (0, _figmaVariablesResolver.getVariableByName)('value/fontFamily', modes) ?? 'JioType Var';
175
+ const valueFontSize = toNumber((0, _figmaVariablesResolver.getVariableByName)('donutChart/value/fontSize', modes) ?? (0, _figmaVariablesResolver.getVariableByName)('value/fontSize', modes), 29);
176
+ const valueLineHeight = toNumber((0, _figmaVariablesResolver.getVariableByName)('donutChart/value/lineHeight', modes) ?? (0, _figmaVariablesResolver.getVariableByName)('value/lineHeight', modes), 29);
177
+ const valueFontWeight = toFontWeight((0, _figmaVariablesResolver.getVariableByName)('donutChart/value/fontWeight', modes) ?? (0, _figmaVariablesResolver.getVariableByName)('value/fontWeight', modes), '900');
178
+ const labelColor = (0, _figmaVariablesResolver.getVariableByName)('donutChart/label/color', modes) ?? (0, _figmaVariablesResolver.getVariableByName)('label/fg', modes) ?? '#000000';
179
+ const labelFontFamily = (0, _figmaVariablesResolver.getVariableByName)('donutChart/label/fontFamily', modes) ?? (0, _figmaVariablesResolver.getVariableByName)('label/fontFamily', modes) ?? 'JioType Var';
180
+ const labelFontSize = toNumber((0, _figmaVariablesResolver.getVariableByName)('donutChart/label/fontSize', modes) ?? (0, _figmaVariablesResolver.getVariableByName)('label/fontSize', modes), 12);
181
+ const labelLineHeight = toNumber((0, _figmaVariablesResolver.getVariableByName)('donutChart/label/lineHeight', modes) ?? (0, _figmaVariablesResolver.getVariableByName)('label/lineHeight', modes), 15.6);
182
+ const labelFontWeight = toFontWeight((0, _figmaVariablesResolver.getVariableByName)('donutChart/label/fontWeight', modes) ?? (0, _figmaVariablesResolver.getVariableByName)('label/fontWeight', modes), '400');
183
+ const textWrapGap = toNumber((0, _figmaVariablesResolver.getVariableByName)('donutChart/textWrap/gap', modes) ?? (0, _figmaVariablesResolver.getVariableByName)('textWrap/gap', modes), 7);
184
+ const containerStyle = {
185
+ alignItems: 'center',
186
+ height: size,
187
+ justifyContent: 'center',
188
+ position: 'relative',
189
+ width: size
190
+ };
191
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
192
+ accessibilityRole: "image",
193
+ accessibilityLabel: accessibilityLabel,
194
+ style: [containerStyle, style],
195
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeSvg.default, {
196
+ width: size,
197
+ height: size,
198
+ viewBox: `0 0 ${size} ${size}`,
199
+ children: arcs.map(arc => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeSvg.Circle, {
200
+ cx: center,
201
+ cy: center,
202
+ r: radius,
203
+ stroke: arc.color,
204
+ strokeWidth: strokeWidth,
205
+ fill: "none",
206
+ strokeDasharray: arc.dashArray,
207
+ strokeDashoffset: arc.dashOffset,
208
+ strokeLinecap: "butt",
209
+ rotation: "-90",
210
+ originX: center,
211
+ originY: center
212
+ }, arc.key))
213
+ }), hasChildrenSlot ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
214
+ pointerEvents: "box-none",
215
+ style: _reactNative.StyleSheet.absoluteFill,
216
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
217
+ style: styles.centerSlot,
218
+ children: customCenterChildren
219
+ })
220
+ }) : showValueLabel || showLabel ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
221
+ pointerEvents: "none",
222
+ style: [styles.centerSlot, {
223
+ gap: textWrapGap
224
+ }],
225
+ children: [showValueLabel ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
226
+ style: [{
227
+ color: valueColor,
228
+ fontFamily: valueFontFamily,
229
+ fontSize: valueFontSize,
230
+ lineHeight: valueLineHeight,
231
+ fontWeight: valueFontWeight,
232
+ textAlign: 'center'
233
+ }, valueStyle],
234
+ numberOfLines: 1,
235
+ children: value
236
+ }) : null, showLabel ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
237
+ style: [{
238
+ color: labelColor,
239
+ fontFamily: labelFontFamily,
240
+ fontSize: labelFontSize,
241
+ lineHeight: labelLineHeight,
242
+ fontWeight: labelFontWeight,
243
+ textAlign: 'center'
244
+ }, labelStyle],
245
+ numberOfLines: 1,
246
+ children: label
247
+ }) : null]
248
+ }) : null]
249
+ });
250
+ }
251
+ function shouldRenderText(node) {
252
+ return node !== undefined && node !== null && node !== false && node !== '';
253
+ }
254
+ /**
255
+ * Convert the resolved segment list into a list of stroke-dasharray /
256
+ * stroke-dashoffset descriptors that can be drawn as SVG `Circle`s. Each
257
+ * arc's length is its share of `circumference`, and its rotational offset
258
+ * is the cumulative offset of all preceding segments. Visual gaps are
259
+ * applied symmetrically — half a gap is shaved from each end of the arc
260
+ * so the visible separation between two segments equals one full `gap`.
261
+ */
262
+ function buildArcs({
263
+ segments,
264
+ totalValue,
265
+ circumference,
266
+ gapLength,
267
+ modes
268
+ }) {
269
+ const arcs = [];
270
+ const halfGap = gapLength / 2;
271
+ let cumulativeOffset = 0;
272
+ segments.forEach((segment, index) => {
273
+ const safeValue = Math.max(0, toNumber(segment.value, 0));
274
+ if (safeValue <= 0) {
275
+ return;
276
+ }
277
+ const arcLength = safeValue / totalValue * circumference;
278
+ const drawnLength = Math.max(0, arcLength - gapLength);
279
+ const segmentModes = {
280
+ ...modes,
281
+ 'Appearance / DataViz': defaultAppearanceFor(index),
282
+ ...(segment.modes || {})
283
+ };
284
+ const color = resolveSegmentColor(segment.color, segmentModes);
285
+ const dashArray = `${drawnLength} ${circumference - drawnLength}`;
286
+ const dashOffset = -cumulativeOffset - halfGap;
287
+ arcs.push({
288
+ key: segment.key ?? `segment-${index}`,
289
+ color,
290
+ dashArray,
291
+ dashOffset
292
+ });
293
+ cumulativeOffset += arcLength;
294
+ });
295
+ return arcs;
296
+ }
297
+ const styles = _reactNative.StyleSheet.create({
298
+ centerSlot: {
299
+ alignItems: 'center',
300
+ bottom: 0,
301
+ justifyContent: 'center',
302
+ left: 0,
303
+ position: 'absolute',
304
+ right: 0,
305
+ top: 0
306
+ }
307
+ });
308
+ DonutChart.Segment = DonutChartSegment;
309
+ var _default = exports.default = DonutChart;
@@ -0,0 +1,155 @@
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 _JFSThemeProvider = require("../../design-tokens/JFSThemeProvider");
11
+ var _reactUtils = require("../../utils/react-utils");
12
+ var _DonutChart = _interopRequireDefault(require("../DonutChart/DonutChart"));
13
+ var _MetricLegendItem = _interopRequireDefault(require("../MetricLegendItem/MetricLegendItem"));
14
+ var _jsxRuntime = require("react/jsx-runtime");
15
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
16
+ /**
17
+ * One row of the `DonutChartSummary`. Each item drives BOTH a donut
18
+ * segment and the matching legend row, so the segment and indicator
19
+ * always share the same color by construction.
20
+ */
21
+
22
+ const DEFAULT_APPEARANCE_CYCLE = ['Senary', 'Primary', 'Secondary', 'Tertiary', 'Quaternary', 'Quinary'];
23
+ const DEFAULT_ITEMS = [{
24
+ label: 'Equity',
25
+ value: 40,
26
+ displayValue: '40%'
27
+ }, {
28
+ label: 'Recommended coverage',
29
+ value: 25,
30
+ displayValue: '25%'
31
+ }, {
32
+ label: 'Additional benefits',
33
+ value: 20,
34
+ displayValue: '20%'
35
+ }, {
36
+ label: 'Cost analysis',
37
+ value: 15,
38
+ displayValue: '15%'
39
+ }];
40
+ const defaultAppearanceFor = index => DEFAULT_APPEARANCE_CYCLE[index % DEFAULT_APPEARANCE_CYCLE.length];
41
+
42
+ /**
43
+ * Resolve the shared color for an item. Honors any explicit `color`
44
+ * override, then falls back to `dataViz/bg` for the merged mode set,
45
+ * then to the Figma reference purple.
46
+ */
47
+ function resolveItemColor(parentModes, item, index) {
48
+ if (item.color) return item.color;
49
+ const itemModes = {
50
+ ...parentModes,
51
+ 'Appearance / DataViz': defaultAppearanceFor(index),
52
+ ...(item.modes || {})
53
+ };
54
+ return (0, _figmaVariablesResolver.getVariableByName)('dataViz/bg', itemModes) ?? '#5d00b5';
55
+ }
56
+
57
+ /**
58
+ * `DonutChartSummary` pairs a `DonutChart` with a vertical list of
59
+ * `MetricLegendItem` rows. The component takes a single `items` array,
60
+ * so the number of legend rows is locked in step with the number of
61
+ * donut segments by construction — every segment has exactly one
62
+ * legend row, and they share the same color through the same
63
+ * `Appearance / DataViz` cascade as the standalone `DonutChart`.
64
+ *
65
+ * The default 4-item layout receives per-index `Appearance / DataViz`
66
+ * defaults (item 1 → `Senary`, 2 → `Primary`, 3 → `Secondary`, 4 →
67
+ * `Tertiary`, then cycles). Override `modes` per item to remix, or set
68
+ * `Emphasis / DataViz` on the parent `modes` to dim or brighten the
69
+ * whole component at once.
70
+ *
71
+ * @component
72
+ * @param {DonutChartSummaryProps} props
73
+ */
74
+ function DonutChartSummary({
75
+ items,
76
+ formatValue,
77
+ centerValue = '₹51,230',
78
+ centerLabel = 'Total invested',
79
+ donutCenter,
80
+ donutSize = 194,
81
+ donutStrokeWidth,
82
+ donutGap = 0,
83
+ modes: propModes = _reactUtils.EMPTY_MODES,
84
+ style,
85
+ legendStyle,
86
+ accessibilityLabel
87
+ }) {
88
+ const {
89
+ modes: globalModes
90
+ } = (0, _JFSThemeProvider.useTokens)();
91
+ const modes = {
92
+ ...globalModes,
93
+ ...propModes
94
+ };
95
+ const gap = (0, _figmaVariablesResolver.getVariableByName)('donutChartSummary/gap', modes) ?? 16;
96
+ const legendGap = (0, _figmaVariablesResolver.getVariableByName)('donutChartSummary/legend/gap', modes) ?? 8;
97
+ const resolvedItems = items && items.length > 0 ? items : DEFAULT_ITEMS;
98
+ const segments = resolvedItems.map((item, index) => ({
99
+ key: item.key ?? `segment-${index}`,
100
+ value: item.value,
101
+ color: resolveItemColor(modes, item, index),
102
+ accessibilityLabel: item.accessibilityLabel
103
+ }));
104
+ const showCustomCenter = donutCenter !== undefined && donutCenter !== null;
105
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
106
+ accessibilityRole: "summary",
107
+ accessibilityLabel: accessibilityLabel,
108
+ style: [{
109
+ width: '100%',
110
+ alignItems: 'center',
111
+ gap
112
+ }, style],
113
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_DonutChart.default, {
114
+ size: donutSize,
115
+ ...(donutStrokeWidth !== undefined && {
116
+ strokeWidth: donutStrokeWidth
117
+ }),
118
+ gap: donutGap,
119
+ segments: segments,
120
+ modes: modes,
121
+ ...(!showCustomCenter && {
122
+ value: centerValue,
123
+ label: centerLabel
124
+ }),
125
+ children: showCustomCenter ? donutCenter : null
126
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
127
+ style: [{
128
+ width: '100%',
129
+ gap: legendGap
130
+ }, legendStyle],
131
+ children: resolvedItems.map((item, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_MetricLegendItem.default, {
132
+ label: item.label,
133
+ value: resolveLegendValue(item, formatValue),
134
+ indicatorColor: resolveItemColor(modes, item, index),
135
+ modes: modes
136
+ }, item.key ?? `legend-${index}`))
137
+ })]
138
+ });
139
+ }
140
+
141
+ /**
142
+ * Resolve what to render in the legend row's right-side slot. The
143
+ * order of precedence is:
144
+ * 1. `item.displayValue` if explicitly provided (including `null` /
145
+ * `false`, which the underlying `MetricLegendItem` treats as
146
+ * "hide the value slot").
147
+ * 2. `formatValue(item.value)` when a parent-level formatter exists.
148
+ * 3. `undefined` — the value slot is hidden.
149
+ */
150
+ function resolveLegendValue(item, formatValue) {
151
+ if (item.displayValue !== undefined) return item.displayValue;
152
+ if (formatValue) return formatValue(item.value);
153
+ return undefined;
154
+ }
155
+ var _default = exports.default = DonutChartSummary;
@@ -0,0 +1,214 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Dropdown = Dropdown;
7
+ exports.DropdownItem = DropdownItem;
8
+ exports.default = void 0;
9
+ var _react = _interopRequireWildcard(require("react"));
10
+ var _reactNative = require("react-native");
11
+ var _figmaVariablesResolver = require("../../design-tokens/figma-variables-resolver");
12
+ var _JFSThemeProvider = require("../../design-tokens/JFSThemeProvider");
13
+ var _reactUtils = require("../../utils/react-utils");
14
+ var _Icon = _interopRequireDefault(require("../../icons/Icon"));
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 IS_WEB = _reactNative.Platform.OS === 'web';
19
+
20
+ // ---------------------------------------------------------------------------
21
+ // DropdownItem
22
+ // ---------------------------------------------------------------------------
23
+
24
+ function useDropdownItemTokens(modes) {
25
+ return (0, _react.useMemo)(() => {
26
+ // The `dropdownItem/background` token aliases through the
27
+ // `Dropdown Item State` collection (Idle | Selected), so we resolve
28
+ // both possibilities up-front and pick at render time.
29
+ const idleBackground = (0, _figmaVariablesResolver.getVariableByName)('dropdownItem/background', {
30
+ ...modes,
31
+ 'Dropdown Item State': 'Idle'
32
+ }) || '#ffffff';
33
+ const selectedBackground = (0, _figmaVariablesResolver.getVariableByName)('dropdownItem/background', {
34
+ ...modes,
35
+ 'Dropdown Item State': 'Selected'
36
+ }) || '#f5f5f5';
37
+ const foreground = (0, _figmaVariablesResolver.getVariableByName)('dropdownItem/foreground', modes) || '#000000';
38
+ const fontFamily = (0, _figmaVariablesResolver.getVariableByName)('dropdownItem/fontFamily', modes) || 'JioType Var';
39
+ const fontSize = parseInt((0, _figmaVariablesResolver.getVariableByName)('dropdownItem/fontSize', modes), 10) || 16;
40
+ const fontWeight = (0, _figmaVariablesResolver.getVariableByName)('dropdownItem/fontWeight', modes) || '400';
41
+ const lineHeight = parseInt((0, _figmaVariablesResolver.getVariableByName)('dropdownItem/lineHeight', modes), 10) || 19;
42
+ const gap = parseInt((0, _figmaVariablesResolver.getVariableByName)('dropdownItem/gap', modes), 10) || 8;
43
+ const paddingHorizontal = parseInt((0, _figmaVariablesResolver.getVariableByName)('dropdownItem/padding/horizontal', modes), 10) || 12;
44
+ const paddingVertical = parseInt((0, _figmaVariablesResolver.getVariableByName)('dropdownItem/padding/vertical', modes), 10) || 12;
45
+ return {
46
+ idleBackground,
47
+ selectedBackground,
48
+ foreground,
49
+ fontFamily,
50
+ fontSize,
51
+ fontWeight,
52
+ lineHeight,
53
+ gap,
54
+ paddingHorizontal,
55
+ paddingVertical
56
+ };
57
+ }, [modes]);
58
+ }
59
+ function DropdownItem({
60
+ label,
61
+ value = null,
62
+ selected = false,
63
+ disabled = false,
64
+ leading,
65
+ trailing,
66
+ onPress,
67
+ children,
68
+ modes: propModes = _reactUtils.EMPTY_MODES,
69
+ style,
70
+ labelStyle,
71
+ accessibilityLabel,
72
+ accessibilityHint
73
+ }) {
74
+ const {
75
+ modes: globalModes
76
+ } = (0, _JFSThemeProvider.useTokens)();
77
+ const modes = (0, _react.useMemo)(() => ({
78
+ ...globalModes,
79
+ ...propModes
80
+ }), [globalModes, propModes]);
81
+ const tokens = useDropdownItemTokens(modes);
82
+ const [isHovered, setIsHovered] = (0, _react.useState)(false);
83
+ const handlePress = (0, _react.useCallback)(() => {
84
+ if (disabled) return;
85
+ onPress?.(value);
86
+ }, [disabled, onPress, value]);
87
+ const containerStyle = (0, _react.useCallback)(({
88
+ pressed
89
+ }) => {
90
+ const showSelected = pressed || isHovered && IS_WEB || selected;
91
+ const base = {
92
+ flexDirection: 'row',
93
+ alignItems: 'center',
94
+ gap: tokens.gap,
95
+ paddingHorizontal: tokens.paddingHorizontal,
96
+ paddingVertical: tokens.paddingVertical,
97
+ backgroundColor: showSelected ? tokens.selectedBackground : tokens.idleBackground,
98
+ opacity: disabled ? 0.4 : 1,
99
+ width: '100%'
100
+ };
101
+ return [base, style];
102
+ }, [tokens.gap, tokens.paddingHorizontal, tokens.paddingVertical, tokens.idleBackground, tokens.selectedBackground, isHovered, selected, disabled, style]);
103
+ const textStyle = {
104
+ color: tokens.foreground,
105
+ fontFamily: tokens.fontFamily,
106
+ fontSize: tokens.fontSize,
107
+ fontWeight: tokens.fontWeight,
108
+ lineHeight: tokens.lineHeight,
109
+ flexShrink: 1
110
+ };
111
+ const processedLeading = leading ? (0, _reactUtils.cloneChildrenWithModes)(_react.default.Children.toArray(leading), modes) : null;
112
+ const customTrailing = trailing ? (0, _reactUtils.cloneChildrenWithModes)(_react.default.Children.toArray(trailing), modes) : null;
113
+ const showDefaultCheck = !trailing && selected;
114
+ const fallbackA11yLabel = accessibilityLabel || (typeof label === 'string' ? label : 'Dropdown item');
115
+ const a11yProps = {
116
+ accessibilityRole: 'menuitem',
117
+ accessibilityLabel: fallbackA11yLabel,
118
+ accessibilityState: {
119
+ selected,
120
+ disabled
121
+ }
122
+ };
123
+ if (accessibilityHint) {
124
+ a11yProps.accessibilityHint = accessibilityHint;
125
+ }
126
+ const handleHoverIn = (0, _react.useCallback)(() => {
127
+ if (IS_WEB && !disabled) setIsHovered(true);
128
+ }, [disabled]);
129
+ const handleHoverOut = (0, _react.useCallback)(() => {
130
+ if (IS_WEB) setIsHovered(false);
131
+ }, []);
132
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Pressable, {
133
+ onPress: handlePress,
134
+ disabled: disabled,
135
+ onHoverIn: handleHoverIn,
136
+ onHoverOut: handleHoverOut,
137
+ style: containerStyle,
138
+ ...a11yProps,
139
+ children: [processedLeading, children != null ? children : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
140
+ style: [textStyle, labelStyle],
141
+ numberOfLines: 1,
142
+ children: label
143
+ }), customTrailing, showDefaultCheck && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
144
+ name: "ic_confirm",
145
+ size: 16,
146
+ color: tokens.foreground
147
+ })]
148
+ });
149
+ }
150
+
151
+ // ---------------------------------------------------------------------------
152
+ // Dropdown (popup surface)
153
+ // ---------------------------------------------------------------------------
154
+
155
+ /**
156
+ * `Dropdown` is the visual surface (popup) that contains a list of
157
+ * `DropdownItem`s. It is responsible for the background, rounded corners,
158
+ * elevation/shadow, and clipping. Use it standalone for menu UIs, or rely on
159
+ * `DropdownInput` which composes it into a form-field experience.
160
+ */
161
+ function Dropdown({
162
+ children,
163
+ maxHeight,
164
+ modes: propModes = _reactUtils.EMPTY_MODES,
165
+ style,
166
+ accessibilityLabel
167
+ }) {
168
+ const {
169
+ modes: globalModes
170
+ } = (0, _JFSThemeProvider.useTokens)();
171
+ const modes = (0, _react.useMemo)(() => ({
172
+ ...globalModes,
173
+ ...propModes
174
+ }), [globalModes, propModes]);
175
+ const radius = parseInt((0, _figmaVariablesResolver.getVariableByName)('dropdown/radius', modes), 10) || 8;
176
+ const background = (0, _figmaVariablesResolver.getVariableByName)('dropdown/background', modes) || '#ffffff';
177
+ const shadowColor = (0, _figmaVariablesResolver.getVariableByName)('dropdown/shadow/color', modes) || 'rgba(0, 0, 0, 0.08)';
178
+ const shadowOffsetX = parseInt((0, _figmaVariablesResolver.getVariableByName)('dropdown/shadow/offsetX', modes), 10) || 0;
179
+ const shadowOffsetY = parseInt((0, _figmaVariablesResolver.getVariableByName)('dropdown/shadow/offsetY', modes), 10) || 4;
180
+ const shadowBlur = parseInt((0, _figmaVariablesResolver.getVariableByName)('dropdown/shadow/blur', modes), 10) || 16;
181
+ const containerStyle = {
182
+ backgroundColor: background,
183
+ borderRadius: radius,
184
+ overflow: 'hidden',
185
+ shadowColor,
186
+ shadowOffset: {
187
+ width: shadowOffsetX,
188
+ height: shadowOffsetY
189
+ },
190
+ shadowOpacity: 1,
191
+ shadowRadius: shadowBlur / 2,
192
+ elevation: 4
193
+ };
194
+ const content = /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
195
+ style: {
196
+ flexDirection: 'column'
197
+ },
198
+ children: (0, _reactUtils.cloneChildrenWithModes)(children, modes)
199
+ });
200
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
201
+ style: [containerStyle, style],
202
+ accessibilityRole: "menu",
203
+ accessibilityLabel: accessibilityLabel || 'Dropdown menu',
204
+ children: maxHeight != null ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ScrollView, {
205
+ style: {
206
+ maxHeight
207
+ },
208
+ showsVerticalScrollIndicator: true,
209
+ keyboardShouldPersistTaps: "handled",
210
+ children: content
211
+ }) : content
212
+ });
213
+ }
214
+ var _default = exports.default = Dropdown;