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,130 @@
1
+ "use strict";
2
+
3
+ import React, { useMemo } from 'react';
4
+ import { Text, View } from 'react-native';
5
+ import { getVariableByName } from '../../design-tokens/figma-variables-resolver';
6
+ import { useTokens } from '../../design-tokens/JFSThemeProvider';
7
+ import { EMPTY_MODES, cloneChildrenWithModes } from '../../utils/react-utils';
8
+ import MediaSource from '../../utils/MediaSource';
9
+
10
+ // Default bundled FINVU brand logo, matching the Figma reference so the
11
+ // component renders correctly out of the box without any image prop.
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ const DEFAULT_LOGO = require('./finvu.png');
14
+ const DEFAULT_LABEL = 'Powered by RBI-regulated account aggregator';
15
+ const DEFAULT_IMAGE_WIDTH = 33;
16
+ const DEFAULT_IMAGE_HEIGHT = 12;
17
+ const toNumber = (value, fallback) => {
18
+ if (typeof value === 'number') return Number.isFinite(value) ? value : fallback;
19
+ if (typeof value === 'string') {
20
+ const parsed = Number(value);
21
+ return Number.isFinite(parsed) ? parsed : fallback;
22
+ }
23
+ return fallback;
24
+ };
25
+ const toFontWeight = (value, fallback) => {
26
+ if (typeof value === 'number') return String(value);
27
+ if (typeof value === 'string') return value;
28
+ return fallback;
29
+ };
30
+
31
+ /**
32
+ * `PoweredByLabel` renders the small "Powered by RBI-regulated account
33
+ * aggregator" badge with a trailing brand logo, used to attribute the
34
+ * underlying account-aggregator partner in flows such as bank-account
35
+ * linking and consent screens.
36
+ *
37
+ * The component is composed of:
38
+ *
39
+ * 1. A token-styled pill container (`poweredByLabel/background`,
40
+ * `poweredByLabel/padding/*`).
41
+ * 2. The disclosure copy rendered through the `poweredByLabel/*` typography
42
+ * tokens.
43
+ * 3. A configurable brand logo slot. Defaults to the bundled FINVU mark, but
44
+ * callers can pass any image via `imageSource` or fully replace the slot
45
+ * via `imageSlot`.
46
+ *
47
+ * @component
48
+ * @param {PoweredByLabelProps} props
49
+ */
50
+ function PoweredByLabel({
51
+ label = DEFAULT_LABEL,
52
+ imageSource,
53
+ imageWidth = DEFAULT_IMAGE_WIDTH,
54
+ imageHeight = DEFAULT_IMAGE_HEIGHT,
55
+ imageSlot,
56
+ modes: propModes = EMPTY_MODES,
57
+ style,
58
+ textStyle,
59
+ imageStyle,
60
+ accessibilityLabel
61
+ }) {
62
+ const {
63
+ modes: globalModes
64
+ } = useTokens();
65
+ const modes = useMemo(() => globalModes === EMPTY_MODES && propModes === EMPTY_MODES ? EMPTY_MODES : {
66
+ ...globalModes,
67
+ ...propModes
68
+ }, [globalModes, propModes]);
69
+ const background = getVariableByName('poweredByLabel/background', modes) ?? '#f5f5f5';
70
+ const foreground = getVariableByName('poweredByLabel/foreground', modes) ?? '#191b1e';
71
+ const fontFamily = getVariableByName('poweredByLabel/fontFamily', modes) ?? 'JioType Var';
72
+ const fontSize = toNumber(getVariableByName('poweredByLabel/fontSize', modes), 10);
73
+ const lineHeight = toNumber(getVariableByName('poweredByLabel/lineHeight', modes), 12);
74
+ const fontWeight = toFontWeight(getVariableByName('poweredByLabel/fontWeight', modes), '400');
75
+ const gap = toNumber(getVariableByName('poweredByLabel/gap', modes), 10);
76
+ const paddingHorizontal = toNumber(getVariableByName('poweredByLabel/padding/horizontal', modes), 16);
77
+ const paddingVertical = toNumber(getVariableByName('poweredByLabel/padding/vertical', modes), 6);
78
+ const containerStyle = {
79
+ flexDirection: 'row',
80
+ alignItems: 'center',
81
+ justifyContent: 'center',
82
+ backgroundColor: background,
83
+ paddingHorizontal,
84
+ paddingVertical,
85
+ gap,
86
+ // Hug content horizontally so the pill does not stretch to fill the
87
+ // parent (matches Badge, BrandChip, etc.). Override via `style` if
88
+ // you want it full-width (e.g. inside a card footer).
89
+ alignSelf: 'flex-start'
90
+ };
91
+ const labelTextStyle = {
92
+ color: foreground,
93
+ fontFamily,
94
+ fontSize,
95
+ lineHeight,
96
+ fontWeight,
97
+ textAlign: 'center',
98
+ flexShrink: 1
99
+ };
100
+ const renderImage = () => {
101
+ if (imageSlot !== undefined && imageSlot !== null) {
102
+ const processed = cloneChildrenWithModes(imageSlot, modes);
103
+ if (processed.length === 0) return null;
104
+ return processed.length === 1 ? processed[0] : processed;
105
+ }
106
+ const resolvedSource = imageSource ?? DEFAULT_LOGO;
107
+ return /*#__PURE__*/_jsx(MediaSource, {
108
+ source: resolvedSource,
109
+ width: imageWidth,
110
+ height: imageHeight,
111
+ resizeMode: "contain",
112
+ style: imageStyle,
113
+ accessibilityElementsHidden: true,
114
+ importantForAccessibility: "no"
115
+ });
116
+ };
117
+ return /*#__PURE__*/_jsxs(View, {
118
+ accessibilityRole: "text",
119
+ accessibilityLabel: accessibilityLabel ?? label,
120
+ style: [containerStyle, style],
121
+ children: [/*#__PURE__*/_jsx(Text, {
122
+ style: [labelTextStyle, textStyle],
123
+ accessibilityElementsHidden: true,
124
+ importantForAccessibility: "no",
125
+ numberOfLines: 1,
126
+ children: label
127
+ }), renderImage()]
128
+ });
129
+ }
130
+ export default PoweredByLabel;
@@ -0,0 +1,142 @@
1
+ "use strict";
2
+
3
+ import React from 'react';
4
+ import { View, Text } from 'react-native';
5
+ import { getVariableByName } from '../../design-tokens/figma-variables-resolver';
6
+ import { EMPTY_MODES, cloneChildrenWithModes } from '../../utils/react-utils';
7
+ import Image from '../Image/Image';
8
+ import ProductLabel from '../ProductLabel/ProductLabel';
9
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
10
+ const DEFAULT_STATS = [{
11
+ value: '995',
12
+ label: 'Purity'
13
+ }, {
14
+ value: '3%',
15
+ label: 'GST'
16
+ }];
17
+ const ProductOverview = ({
18
+ imageSource,
19
+ imageRatio = 288 / 170,
20
+ labelImageSource,
21
+ label = 'Gold',
22
+ productName = '0.5g Gold Coin',
23
+ description = 'Your gold is insured from our vault to you. If lost or damaged, we’ll replace it.',
24
+ stats = DEFAULT_STATS,
25
+ modes = EMPTY_MODES,
26
+ style,
27
+ children
28
+ }) => {
29
+ const padding = getVariableByName('productOverview/padding', modes) ?? 24;
30
+ const gap = getVariableByName('productOverview/gap', modes) ?? 12;
31
+ const background = getVariableByName('productOverview/background', modes) ?? '#ffffff';
32
+ const productNameColor = getVariableByName('productOverview/productName/color', modes) ?? '#0d0d0f';
33
+ const productNameFontFamily = getVariableByName('productOverview/productName/fontFamily', modes) ?? 'JioType Var';
34
+ const productNameFontSize = getVariableByName('productOverview/productName/fontSize', modes) ?? 26;
35
+ const productNameFontWeight = getVariableByName('productOverview/productName/fontWeight', modes) ?? 900;
36
+ const productNameLineHeight = getVariableByName('productOverview/productName/lineHeight', modes) ?? 26;
37
+ const descriptionColor = getVariableByName('productOverview/description/color', modes) ?? '#1a1c1f';
38
+ const descriptionFontFamily = getVariableByName('productOverview/description/fontFamily', modes) ?? 'JioType Var';
39
+ const descriptionFontSize = getVariableByName('productOverview/description/fontSize', modes) ?? 14;
40
+ const descriptionFontWeight = getVariableByName('productOverview/description/fontWeight', modes) ?? 500;
41
+ const descriptionLineHeight = getVariableByName('productOverview/description/lineHeight', modes) ?? 18.2;
42
+ const statGap = getVariableByName('productOverview/stat/gap', modes) ?? 2;
43
+ const statValueColor = getVariableByName('productOverview/stat/value/color', modes) ?? '#141414';
44
+ const statValueFontFamily = getVariableByName('productOverview/stat/value/fontFamily', modes) ?? 'JioType Var';
45
+ const statValueFontSize = getVariableByName('productOverview/stat/value/fontSize', modes) ?? 20;
46
+ const statValueFontWeight = getVariableByName('productOverview/stat/value/fontWeight', modes) ?? 900;
47
+ const statValueLineHeight = getVariableByName('productOverview/stat/value/lineHeight', modes) ?? 20;
48
+ const statLabelColor = productNameColor;
49
+ const statLabelFontFamily = getVariableByName('productOverview/stat/label/fontFamily', modes) ?? 'JioType Var';
50
+ const statLabelFontSize = getVariableByName('productOverview/stat/label/fontSize', modes) ?? 12;
51
+ const statLabelFontWeight = getVariableByName('productOverview/stat/label/fontWeight', modes) ?? 400;
52
+ const statLabelLineHeight = getVariableByName('productOverview/stat/label/lineHeight', modes) ?? 15.6;
53
+ const productNameStyle = {
54
+ color: productNameColor,
55
+ fontFamily: productNameFontFamily,
56
+ fontSize: productNameFontSize,
57
+ fontWeight: String(productNameFontWeight),
58
+ lineHeight: productNameLineHeight,
59
+ textAlign: 'center'
60
+ };
61
+ const descriptionStyle = {
62
+ color: descriptionColor,
63
+ fontFamily: descriptionFontFamily,
64
+ fontSize: descriptionFontSize,
65
+ fontWeight: String(descriptionFontWeight),
66
+ lineHeight: descriptionLineHeight,
67
+ textAlign: 'center'
68
+ };
69
+ const statValueStyle = {
70
+ color: statValueColor,
71
+ fontFamily: statValueFontFamily,
72
+ fontSize: statValueFontSize,
73
+ fontWeight: String(statValueFontWeight),
74
+ lineHeight: statValueLineHeight
75
+ };
76
+ const statLabelStyle = {
77
+ color: statLabelColor,
78
+ fontFamily: statLabelFontFamily,
79
+ fontSize: statLabelFontSize,
80
+ fontWeight: String(statLabelFontWeight),
81
+ lineHeight: statLabelLineHeight,
82
+ textAlign: 'center'
83
+ };
84
+ const showStats = Array.isArray(stats) && stats.length > 0;
85
+ return /*#__PURE__*/_jsxs(View, {
86
+ style: [{
87
+ backgroundColor: background,
88
+ padding,
89
+ gap,
90
+ alignItems: 'center',
91
+ width: '100%'
92
+ }, style],
93
+ children: [imageSource != null && /*#__PURE__*/_jsx(Image, {
94
+ imageSource: imageSource,
95
+ ratio: imageRatio,
96
+ resizeMode: "contain",
97
+ accessibilityElementsHidden: true,
98
+ importantForAccessibility: "no"
99
+ }), /*#__PURE__*/_jsx(ProductLabel, {
100
+ label: label,
101
+ ...(labelImageSource != null && {
102
+ imageSource: labelImageSource
103
+ }),
104
+ modes: modes
105
+ }), productName ? /*#__PURE__*/_jsx(Text, {
106
+ style: productNameStyle,
107
+ accessibilityRole: "header",
108
+ children: productName
109
+ }) : null, description ? /*#__PURE__*/_jsx(Text, {
110
+ style: descriptionStyle,
111
+ children: description
112
+ }) : null, children ? /*#__PURE__*/_jsx(_Fragment, {
113
+ children: cloneChildrenWithModes(children, modes)
114
+ }) : null, showStats && /*#__PURE__*/_jsx(View, {
115
+ style: {
116
+ flexDirection: 'row',
117
+ alignItems: 'center',
118
+ justifyContent: 'space-between',
119
+ width: '100%'
120
+ },
121
+ children: stats.map((stat, index) => /*#__PURE__*/_jsxs(View, {
122
+ style: {
123
+ flex: 1,
124
+ minWidth: 0,
125
+ alignItems: 'center',
126
+ gap: statGap,
127
+ overflow: 'hidden'
128
+ },
129
+ children: [/*#__PURE__*/_jsx(Text, {
130
+ style: statValueStyle,
131
+ numberOfLines: 1,
132
+ children: stat.value
133
+ }), /*#__PURE__*/_jsx(Text, {
134
+ style: statLabelStyle,
135
+ numberOfLines: 1,
136
+ children: stat.label
137
+ })]
138
+ }, `${stat.label}-${index}`))
139
+ })]
140
+ });
141
+ };
142
+ export default ProductOverview;
@@ -0,0 +1,263 @@
1
+ "use strict";
2
+
3
+ import React, { useCallback, useState } from 'react';
4
+ import { View } from 'react-native';
5
+ import { getVariableByName } from '../../design-tokens/figma-variables-resolver';
6
+ import { useTokens } from '../../design-tokens/JFSThemeProvider';
7
+ import { EMPTY_MODES } from '../../utils/react-utils';
8
+ import MetricLegendItem from '../MetricLegendItem/MetricLegendItem';
9
+ import SegmentedTrack from '../SegmentedTrack/SegmentedTrack';
10
+ import Tabs from '../Tabs/Tabs';
11
+ import TabItem from '../Tabs/TabItem';
12
+
13
+ /**
14
+ * One row of data inside a `RangeTrack` tab.
15
+ *
16
+ * Each item drives BOTH a `SegmentedTrack` segment and the matching
17
+ * `MetricLegendItem` row, so the segment color and legend indicator
18
+ * always share the same color by construction (same `Emphasis / DataViz`
19
+ * cascade as the standalone `SegmentedTrack`).
20
+ */
21
+
22
+ /**
23
+ * One tab inside a `RangeTrack`. Each tab carries its own `items`
24
+ * array, which is the single source of truth for both the
25
+ * `SegmentedTrack` segments AND the `MetricLegendItem` legend rows
26
+ * rendered for that tab.
27
+ */
28
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
29
+ const DEFAULT_EMPHASIS_CYCLE = ['High', 'Medium', 'Low'];
30
+ const DEFAULT_TABS = [{
31
+ label: 'Tab item',
32
+ items: [{
33
+ label: 'Large cap',
34
+ value: 1,
35
+ displayValue: '25%'
36
+ }, {
37
+ label: 'Mid cap',
38
+ value: 1,
39
+ displayValue: '25%'
40
+ }, {
41
+ label: 'Small cap',
42
+ value: 1,
43
+ displayValue: '25%'
44
+ }]
45
+ }, {
46
+ label: 'Tab item',
47
+ items: [{
48
+ label: 'Large cap',
49
+ value: 1,
50
+ displayValue: '25%'
51
+ }, {
52
+ label: 'Mid cap',
53
+ value: 1,
54
+ displayValue: '25%'
55
+ }, {
56
+ label: 'Small cap',
57
+ value: 1,
58
+ displayValue: '25%'
59
+ }]
60
+ }, {
61
+ label: 'Tab item',
62
+ items: [{
63
+ label: 'Large cap',
64
+ value: 1,
65
+ displayValue: '25%'
66
+ }, {
67
+ label: 'Mid cap',
68
+ value: 1,
69
+ displayValue: '25%'
70
+ }, {
71
+ label: 'Small cap',
72
+ value: 1,
73
+ displayValue: '25%'
74
+ }]
75
+ }];
76
+ const defaultEmphasisFor = index => DEFAULT_EMPHASIS_CYCLE[index % DEFAULT_EMPHASIS_CYCLE.length];
77
+
78
+ /**
79
+ * Resolve the shared color for an item. Honors any explicit `color`
80
+ * override, then falls back to `dataViz/bg` for the merged mode set,
81
+ * then to the Figma reference value.
82
+ *
83
+ * Mirrors the cascade used by `SegmentedTrack` (per-index `Emphasis /
84
+ * DataViz` defaults of `High` → `Medium` → `Low`, cycling) so the
85
+ * pre-computed color we pass to both the segment and the legend
86
+ * indicator matches what the `SegmentedTrack` would have computed on
87
+ * its own. This is what keeps segments and legend rows in sync by
88
+ * construction.
89
+ */
90
+ function resolveItemColor(parentModes, item, index) {
91
+ if (item.color) return item.color;
92
+ const itemModes = {
93
+ ...parentModes,
94
+ 'Emphasis / DataViz': defaultEmphasisFor(index),
95
+ ...(item.modes || {})
96
+ };
97
+ return getVariableByName('dataViz/bg', itemModes) ?? '#cea15a';
98
+ }
99
+
100
+ /**
101
+ * Resolve what to render in the legend row's right-side slot. The
102
+ * order of precedence is:
103
+ * 1. `item.displayValue` if explicitly provided (including `null` /
104
+ * `false`, which the underlying `MetricLegendItem` treats as
105
+ * "hide the value slot").
106
+ * 2. `formatValue(item.value)` when a parent-level formatter exists.
107
+ * 3. `undefined` — the value slot is hidden.
108
+ */
109
+ function resolveLegendValue(item, formatValue) {
110
+ if (item.displayValue !== undefined) return item.displayValue;
111
+ if (formatValue) return formatValue(item.value);
112
+ return undefined;
113
+ }
114
+
115
+ /**
116
+ * `RangeTrack` pairs a tab row with a `SegmentedTrack` and a vertical
117
+ * stack of `MetricLegendItem` rows. Each tab carries its own `items`
118
+ * array which is the **single source of truth** for both the segments
119
+ * and the legend rows of that tab — every segment has exactly one
120
+ * legend row and they share the same color through the same
121
+ * `Emphasis / DataViz` cascade as the standalone `SegmentedTrack`.
122
+ *
123
+ * Switching tabs swaps the segments and the legend together so the
124
+ * two visualizations can never drift out of sync.
125
+ *
126
+ * The default 3-item layout per tab receives per-index
127
+ * `Emphasis / DataViz` defaults (item 1 → `High`, 2 → `Medium`, 3 →
128
+ * `Low`, then cycles). Override `Appearance / DataViz` on the parent
129
+ * `modes` to retheme the whole component, or set `modes` per item to
130
+ * remix.
131
+ *
132
+ * The component supports both **controlled** and **uncontrolled**
133
+ * tab selection — pass `activeTabIndex` + `onTabChange` for the
134
+ * controlled mode, or omit them and the component will manage the
135
+ * selection internally starting from `defaultActiveTabIndex`.
136
+ *
137
+ * @component
138
+ * @param {RangeTrackProps} props
139
+ *
140
+ * @example
141
+ * ```tsx
142
+ * <RangeTrack
143
+ * tabs={[
144
+ * {
145
+ * label: 'Sectoral',
146
+ * items: [
147
+ * { label: 'Large cap', value: 50, displayValue: '50%' },
148
+ * { label: 'Mid cap', value: 30, displayValue: '30%' },
149
+ * { label: 'Small cap', value: 20, displayValue: '20%' },
150
+ * ],
151
+ * },
152
+ * {
153
+ * label: 'Geography',
154
+ * items: [
155
+ * { label: 'India', value: 70, displayValue: '70%' },
156
+ * { label: 'US', value: 20, displayValue: '20%' },
157
+ * { label: 'Other', value: 10, displayValue: '10%' },
158
+ * ],
159
+ * },
160
+ * ]}
161
+ * />
162
+ * ```
163
+ */
164
+ function RangeTrack({
165
+ tabs,
166
+ formatValue,
167
+ activeTabIndex,
168
+ defaultActiveTabIndex = 0,
169
+ onTabChange,
170
+ scrollableTabs = false,
171
+ modes: propModes = EMPTY_MODES,
172
+ style,
173
+ tabsStyle,
174
+ trackStyle,
175
+ legendStyle,
176
+ accessibilityLabel
177
+ }) {
178
+ const {
179
+ modes: globalModes
180
+ } = useTokens();
181
+ const modes = {
182
+ ...globalModes,
183
+ ...propModes
184
+ };
185
+ const resolvedTabs = tabs && tabs.length > 0 ? tabs : DEFAULT_TABS;
186
+ const [internalIndex, setInternalIndex] = useState(() => clampIndex(defaultActiveTabIndex, resolvedTabs.length));
187
+ const isControlled = activeTabIndex !== undefined;
188
+ const rawIndex = isControlled ? activeTabIndex : internalIndex;
189
+ const safeIndex = clampIndex(rawIndex, resolvedTabs.length);
190
+ const handleTabPress = useCallback(index => {
191
+ const nextTab = resolvedTabs[index];
192
+ if (!nextTab) return;
193
+ if (!isControlled) setInternalIndex(index);
194
+ onTabChange?.(index, nextTab);
195
+ }, [isControlled, onTabChange, resolvedTabs]);
196
+ const containerGap = getVariableByName('rangeTrack/gap', modes) ?? 28;
197
+ // Vertical gap between legend rows is not exposed as its own token —
198
+ // the Figma design uses 8px between rows, mirroring the
199
+ // `donutChartSummary/legend/gap` default. Keep the value in step
200
+ // with `DonutChartSummary` so the two summary components feel
201
+ // cohesive when stacked.
202
+ const legendRowGap = 8;
203
+ const activeTab = resolvedTabs[safeIndex];
204
+ const activeItems = activeTab?.items ?? [];
205
+ const segments = activeItems.map((item, index) => ({
206
+ key: item.key ?? `segment-${index}`,
207
+ value: item.value,
208
+ color: resolveItemColor(modes, item, index),
209
+ accessibilityLabel: item.accessibilityLabel
210
+ }));
211
+ return /*#__PURE__*/_jsxs(View, {
212
+ accessibilityRole: "summary",
213
+ accessibilityLabel: accessibilityLabel,
214
+ style: [{
215
+ width: '100%',
216
+ flexDirection: 'column',
217
+ alignItems: 'flex-start',
218
+ gap: containerGap
219
+ }, style],
220
+ children: [/*#__PURE__*/_jsx(Tabs, {
221
+ modes: modes,
222
+ scrollable: scrollableTabs,
223
+ style: tabsStyle,
224
+ children: resolvedTabs.map((tab, index) => /*#__PURE__*/_jsx(TabItem, {
225
+ label: tab.label,
226
+ active: index === safeIndex,
227
+ onPress: () => handleTabPress(index),
228
+ accessibilityLabel: tab.accessibilityLabel ?? tab.label
229
+ }, tab.key ?? tab.label ?? `tab-${index}`))
230
+ }), /*#__PURE__*/_jsx(SegmentedTrack, {
231
+ modes: modes,
232
+ segments: segments,
233
+ style: trackStyle,
234
+ accessibilityLabel: activeTab?.accessibilityLabel ?? activeTab?.label
235
+ }), /*#__PURE__*/_jsx(View, {
236
+ style: [{
237
+ width: '100%',
238
+ flexDirection: 'column',
239
+ alignItems: 'flex-start',
240
+ gap: legendRowGap
241
+ }, legendStyle],
242
+ children: activeItems.map((item, index) => /*#__PURE__*/_jsx(MetricLegendItem, {
243
+ label: item.label,
244
+ value: resolveLegendValue(item, formatValue),
245
+ indicatorColor: resolveItemColor(modes, item, index),
246
+ modes: modes
247
+ }, item.key ?? `legend-${index}`))
248
+ })]
249
+ });
250
+ }
251
+
252
+ /**
253
+ * Clamp a tab index into `[0, length)`. Negative or out-of-bounds
254
+ * values fall back to `0` to avoid rendering an undefined tab.
255
+ */
256
+ function clampIndex(index, length) {
257
+ if (length <= 0) return 0;
258
+ if (!Number.isFinite(index)) return 0;
259
+ if (index < 0) return 0;
260
+ if (index >= length) return length - 1;
261
+ return Math.floor(index);
262
+ }
263
+ export default RangeTrack;