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.
- package/CHANGELOG.md +28 -0
- package/lib/commonjs/components/AccordionCheckbox/AccordionCheckbox.js +239 -0
- package/lib/commonjs/components/AccountCard/AccountCard.js +247 -0
- package/lib/commonjs/components/AppBar/AppBar.js +17 -11
- package/lib/commonjs/components/BrandChip/BrandChip.js +149 -0
- package/lib/commonjs/components/CardBankAccount/CardBankAccount.js +229 -0
- package/lib/commonjs/components/CardInsight/CardInsight.js +166 -0
- package/lib/commonjs/components/CheckboxGroup/CheckboxGroup.js +67 -0
- package/lib/commonjs/components/CheckboxItem/CheckboxItem.js +140 -0
- package/lib/commonjs/components/CircularProgressBar/CircularProgressBar.js +56 -9
- package/lib/commonjs/components/CoverageBarComparison/CoverageBarComparison.js +272 -0
- package/lib/commonjs/components/CoverageRing/CoverageRing.js +141 -0
- package/lib/commonjs/components/DonutChart/DonutChart.js +309 -0
- package/lib/commonjs/components/DonutChartSummary/DonutChartSummary.js +155 -0
- package/lib/commonjs/components/Dropdown/Dropdown.js +214 -0
- package/lib/commonjs/components/DropdownInput/DropdownInput.js +542 -0
- package/lib/commonjs/components/FormField/FormField.js +328 -178
- package/lib/commonjs/components/LinearMeter/LinearMeter.js +9 -28
- package/lib/commonjs/components/LinearProgress/LinearProgress.js +68 -0
- package/lib/commonjs/components/LottieIntroBlock/LottieIntroBlock.js +150 -0
- package/lib/commonjs/components/MetricLegendItem/MetricLegendItem.js +95 -0
- package/lib/commonjs/components/MonthlyStatusGrid/MonthlyStatusGrid.js +286 -0
- package/lib/commonjs/components/OTP/OTP.js +381 -37
- package/lib/commonjs/components/PageHero/PageHero.js +153 -0
- package/lib/commonjs/components/PoweredByLabel/PoweredByLabel.js +135 -0
- package/lib/commonjs/components/PoweredByLabel/finvu.png +0 -0
- package/lib/commonjs/components/ProductOverview/ProductOverview.js +147 -0
- package/lib/commonjs/components/RangeTrack/RangeTrack.js +269 -0
- package/lib/commonjs/components/SavingsGoalSummary/SavingsGoalSummary.js +181 -0
- package/lib/commonjs/components/SegmentedTrack/SegmentedTrack.js +171 -0
- package/lib/commonjs/components/StatGroup/StatGroup.js +128 -0
- package/lib/commonjs/components/StatItem/StatItem.js +65 -35
- package/lib/commonjs/components/StrengthIndicator/StrengthIndicator.js +157 -0
- package/lib/commonjs/components/SummaryTile/SummaryTile.js +150 -0
- package/lib/commonjs/components/Text/Text.js +9 -2
- package/lib/commonjs/components/Tooltip/Tooltip.js +34 -27
- package/lib/commonjs/components/index.js +231 -1
- package/lib/commonjs/design-tokens/Coin Variables-variables-full.json +1 -1
- package/lib/commonjs/icons/registry.js +1 -1
- package/lib/commonjs/utils/index.js +7 -0
- package/lib/commonjs/utils/number-utils.js +57 -0
- package/lib/module/components/AccordionCheckbox/AccordionCheckbox.js +233 -0
- package/lib/module/components/AccountCard/AccountCard.js +241 -0
- package/lib/module/components/AppBar/AppBar.js +17 -11
- package/lib/module/components/BrandChip/BrandChip.js +143 -0
- package/lib/module/components/CardBankAccount/CardBankAccount.js +223 -0
- package/lib/module/components/CardInsight/CardInsight.js +161 -0
- package/lib/module/components/CheckboxGroup/CheckboxGroup.js +62 -0
- package/lib/module/components/CheckboxItem/CheckboxItem.js +134 -0
- package/lib/module/components/CircularProgressBar/CircularProgressBar.js +56 -9
- package/lib/module/components/CoverageBarComparison/CoverageBarComparison.js +266 -0
- package/lib/module/components/CoverageRing/CoverageRing.js +136 -0
- package/lib/module/components/DonutChart/DonutChart.js +303 -0
- package/lib/module/components/DonutChartSummary/DonutChartSummary.js +150 -0
- package/lib/module/components/Dropdown/Dropdown.js +206 -0
- package/lib/module/components/DropdownInput/DropdownInput.js +536 -0
- package/lib/module/components/FormField/FormField.js +330 -180
- package/lib/module/components/LinearMeter/LinearMeter.js +9 -28
- package/lib/module/components/LinearProgress/LinearProgress.js +63 -0
- package/lib/module/components/LottieIntroBlock/LottieIntroBlock.js +144 -0
- package/lib/module/components/MetricLegendItem/MetricLegendItem.js +90 -0
- package/lib/module/components/MonthlyStatusGrid/MonthlyStatusGrid.js +281 -0
- package/lib/module/components/OTP/OTP.js +381 -38
- package/lib/module/components/PageHero/PageHero.js +147 -0
- package/lib/module/components/PoweredByLabel/PoweredByLabel.js +130 -0
- package/lib/module/components/PoweredByLabel/finvu.png +0 -0
- package/lib/module/components/ProductOverview/ProductOverview.js +142 -0
- package/lib/module/components/RangeTrack/RangeTrack.js +263 -0
- package/lib/module/components/SavingsGoalSummary/SavingsGoalSummary.js +175 -0
- package/lib/module/components/SegmentedTrack/SegmentedTrack.js +166 -0
- package/lib/module/components/StatGroup/StatGroup.js +123 -0
- package/lib/module/components/StatItem/StatItem.js +66 -36
- package/lib/module/components/StrengthIndicator/StrengthIndicator.js +152 -0
- package/lib/module/components/SummaryTile/SummaryTile.js +145 -0
- package/lib/module/components/Text/Text.js +9 -2
- package/lib/module/components/Tooltip/Tooltip.js +34 -27
- package/lib/module/components/index.js +28 -2
- package/lib/module/design-tokens/Coin Variables-variables-full.json +1 -1
- package/lib/module/icons/registry.js +1 -1
- package/lib/module/utils/index.js +2 -1
- package/lib/module/utils/number-utils.js +53 -0
- package/lib/typescript/src/components/AccordionCheckbox/AccordionCheckbox.d.ts +71 -0
- package/lib/typescript/src/components/AccountCard/AccountCard.d.ts +81 -0
- package/lib/typescript/src/components/BrandChip/BrandChip.d.ts +43 -0
- package/lib/typescript/src/components/CardBankAccount/CardBankAccount.d.ts +86 -0
- package/lib/typescript/src/components/CardInsight/CardInsight.d.ts +48 -0
- package/lib/typescript/src/components/CheckboxGroup/CheckboxGroup.d.ts +41 -0
- package/lib/typescript/src/components/CheckboxItem/CheckboxItem.d.ts +72 -0
- package/lib/typescript/src/components/CircularProgressBar/CircularProgressBar.d.ts +11 -1
- package/lib/typescript/src/components/CoverageBarComparison/CoverageBarComparison.d.ts +105 -0
- package/lib/typescript/src/components/CoverageRing/CoverageRing.d.ts +90 -0
- package/lib/typescript/src/components/DonutChart/DonutChart.d.ts +117 -0
- package/lib/typescript/src/components/DonutChartSummary/DonutChartSummary.d.ts +103 -0
- package/lib/typescript/src/components/Dropdown/Dropdown.d.ts +62 -0
- package/lib/typescript/src/components/DropdownInput/DropdownInput.d.ts +107 -0
- package/lib/typescript/src/components/FormField/FormField.d.ts +76 -19
- package/lib/typescript/src/components/LinearProgress/LinearProgress.d.ts +17 -0
- package/lib/typescript/src/components/LottieIntroBlock/LottieIntroBlock.d.ts +58 -0
- package/lib/typescript/src/components/MetricLegendItem/MetricLegendItem.d.ts +37 -0
- package/lib/typescript/src/components/MonthlyStatusGrid/MonthlyStatusGrid.d.ts +119 -0
- package/lib/typescript/src/components/OTP/OTP.d.ts +88 -2
- package/lib/typescript/src/components/PageHero/PageHero.d.ts +53 -0
- package/lib/typescript/src/components/PoweredByLabel/PoweredByLabel.d.ts +70 -0
- package/lib/typescript/src/components/ProductOverview/ProductOverview.d.ts +39 -0
- package/lib/typescript/src/components/RangeTrack/RangeTrack.d.ts +173 -0
- package/lib/typescript/src/components/SavingsGoalSummary/SavingsGoalSummary.d.ts +95 -0
- package/lib/typescript/src/components/SegmentedTrack/SegmentedTrack.d.ts +108 -0
- package/lib/typescript/src/components/StatGroup/StatGroup.d.ts +45 -0
- package/lib/typescript/src/components/StatItem/StatItem.d.ts +24 -7
- package/lib/typescript/src/components/StrengthIndicator/StrengthIndicator.d.ts +58 -0
- package/lib/typescript/src/components/SummaryTile/SummaryTile.d.ts +60 -0
- package/lib/typescript/src/components/Text/Text.d.ts +12 -2
- package/lib/typescript/src/components/Tooltip/Tooltip.d.ts +13 -2
- package/lib/typescript/src/components/index.d.ts +29 -3
- package/lib/typescript/src/icons/registry.d.ts +1 -1
- package/lib/typescript/src/utils/index.d.ts +1 -0
- package/lib/typescript/src/utils/number-utils.d.ts +29 -0
- package/package.json +1 -3
- package/src/components/AccordionCheckbox/AccordionCheckbox.tsx +323 -0
- package/src/components/AccountCard/AccountCard.tsx +376 -0
- package/src/components/AppBar/AppBar.tsx +25 -14
- package/src/components/BrandChip/BrandChip.tsx +235 -0
- package/src/components/CardBankAccount/CardBankAccount.tsx +321 -0
- package/src/components/CardInsight/CardInsight.tsx +239 -0
- package/src/components/CheckboxGroup/CheckboxGroup.tsx +86 -0
- package/src/components/CheckboxItem/CheckboxItem.tsx +209 -0
- package/src/components/CircularProgressBar/CircularProgressBar.tsx +74 -9
- package/src/components/CoverageBarComparison/CoverageBarComparison.tsx +378 -0
- package/src/components/CoverageRing/CoverageRing.tsx +225 -0
- package/src/components/DonutChart/DonutChart.tsx +503 -0
- package/src/components/DonutChartSummary/DonutChartSummary.tsx +256 -0
- package/src/components/Dropdown/Dropdown.tsx +331 -0
- package/src/components/DropdownInput/DropdownInput.tsx +819 -0
- package/src/components/FormField/FormField.tsx +542 -215
- package/src/components/LinearMeter/LinearMeter.tsx +9 -39
- package/src/components/LinearProgress/LinearProgress.tsx +92 -0
- package/src/components/LottieIntroBlock/LottieIntroBlock.tsx +202 -0
- package/src/components/MetricLegendItem/MetricLegendItem.tsx +167 -0
- package/src/components/MonthlyStatusGrid/MonthlyStatusGrid.tsx +438 -0
- package/src/components/OTP/OTP.tsx +476 -29
- package/src/components/PageHero/PageHero.tsx +200 -0
- package/src/components/PoweredByLabel/PoweredByLabel.tsx +221 -0
- package/src/components/PoweredByLabel/finvu.png +0 -0
- package/src/components/ProductOverview/ProductOverview.tsx +236 -0
- package/src/components/RangeTrack/RangeTrack.tsx +394 -0
- package/src/components/SavingsGoalSummary/SavingsGoalSummary.tsx +269 -0
- package/src/components/SegmentedTrack/SegmentedTrack.tsx +268 -0
- package/src/components/StatGroup/StatGroup.tsx +169 -0
- package/src/components/StatItem/StatItem.tsx +117 -40
- package/src/components/StrengthIndicator/StrengthIndicator.tsx +205 -0
- package/src/components/SummaryTile/SummaryTile.tsx +251 -0
- package/src/components/Text/Text.tsx +24 -3
- package/src/components/Tooltip/Tooltip.tsx +50 -25
- package/src/components/index.ts +47 -3
- package/src/design-tokens/Coin Variables-variables-full.json +1 -1
- package/src/icons/registry.ts +1 -1
- package/src/utils/index.ts +1 -0
- package/src/utils/number-utils.ts +60 -0
|
@@ -0,0 +1,157 @@
|
|
|
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 _reactUtils = require("../../utils/react-utils");
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
/**
|
|
14
|
+
* Confidence levels supported by the indicator. Mirrors the Figma `Confidence`
|
|
15
|
+
* mode collection exactly (`High` | `Medium` | `Low` | `None`).
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Accepted shape for the `confidence` prop. Either:
|
|
20
|
+
* - one of the named levels (`'High' | 'Medium' | 'Low' | 'None'`), or
|
|
21
|
+
* - a float in `[0, 1]`. Floats are bucketed to the nearest level using
|
|
22
|
+
* midpoint thresholds (1/6, 1/2, 5/6) so anchor values land squarely:
|
|
23
|
+
* `0` → `None`, `~0.33` → `Low`, `~0.66` → `Medium`, `1` → `High`.
|
|
24
|
+
* Values outside `[0, 1]` are clamped.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
const BAR_SIZES = ['small', 'medium', 'large'];
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Maps an overall confidence level to per-bar confidence modes. Bars are
|
|
31
|
+
* filled from the smallest (left) to the largest (right) as confidence
|
|
32
|
+
* rises, with each lit bar tinted at its own confidence level so the
|
|
33
|
+
* indicator visually communicates *which* level the value is at — not just
|
|
34
|
+
* how many bars are lit.
|
|
35
|
+
*
|
|
36
|
+
* High -> [High, High, High] (3/3 lit, bright)
|
|
37
|
+
* Medium -> [Medium, Medium, None] (2/3 lit, mid intensity)
|
|
38
|
+
* Low -> [Low, None, None] (1/3 lit, low intensity)
|
|
39
|
+
* None -> [None, None, None] (0/3 lit)
|
|
40
|
+
*
|
|
41
|
+
* Each bar resolves its color through `getVariableByName` with its own
|
|
42
|
+
* per-bar `Confidence` mode, so the mapping survives any token updates in
|
|
43
|
+
* the Figma variables export.
|
|
44
|
+
*/
|
|
45
|
+
const CONFIDENCE_TO_BARS = {
|
|
46
|
+
High: ['High', 'High', 'High'],
|
|
47
|
+
Medium: ['Medium', 'Medium', 'None'],
|
|
48
|
+
Low: ['Low', 'None', 'None'],
|
|
49
|
+
None: ['None', 'None', 'None']
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Fallback colors used when the `strengthIndicator/*` design tokens have not
|
|
54
|
+
* yet been imported into `Coin Variables-variables-full.json`. The `High`
|
|
55
|
+
* fallback matches the Figma export (`#25ab21`); the intermediate levels
|
|
56
|
+
* use progressively lighter greens, and `None` uses a neutral gray for
|
|
57
|
+
* unlit bars. Once the tokens land, `getVariableByName` returns the
|
|
58
|
+
* canonical value and these fallbacks are bypassed.
|
|
59
|
+
*/
|
|
60
|
+
const FALLBACK_BAR_COLOR = {
|
|
61
|
+
High: '#25ab21',
|
|
62
|
+
Medium: '#5cc257',
|
|
63
|
+
Low: '#a8dba2',
|
|
64
|
+
None: '#d9d9dd'
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Bucket a float `[0, 1]` into the nearest named confidence level using
|
|
69
|
+
* midpoint thresholds between the four anchor values (`0`, `1/3`, `2/3`,
|
|
70
|
+
* `1`). Out-of-range values are clamped.
|
|
71
|
+
*/
|
|
72
|
+
function floatToConfidence(value) {
|
|
73
|
+
const clamped = Math.min(Math.max(value, 0), 1);
|
|
74
|
+
if (clamped > 5 / 6) return 'High';
|
|
75
|
+
if (clamped > 1 / 2) return 'Medium';
|
|
76
|
+
if (clamped > 1 / 6) return 'Low';
|
|
77
|
+
return 'None';
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Normalize the union `confidence` prop into a single named level.
|
|
82
|
+
* Strings pass through; numbers are bucketed via {@link floatToConfidence}.
|
|
83
|
+
* Anything else (e.g. `null`/`undefined`) defaults to `'High'` to match
|
|
84
|
+
* Figma's default mode.
|
|
85
|
+
*/
|
|
86
|
+
function resolveConfidence(value) {
|
|
87
|
+
if (typeof value === 'number') return floatToConfidence(value);
|
|
88
|
+
if (value === 'High' || value === 'Medium' || value === 'Low' || value === 'None') {
|
|
89
|
+
return value;
|
|
90
|
+
}
|
|
91
|
+
return 'High';
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* StrengthIndicator renders three fixed-size, ascending bars that
|
|
96
|
+
* communicate a discrete confidence/strength level — typically used to
|
|
97
|
+
* signal model confidence, signal quality, or password strength.
|
|
98
|
+
*
|
|
99
|
+
* Sizes are intentionally fixed (matching the Figma spec): 3px-wide bars
|
|
100
|
+
* 6/9/12px tall with a 2px gap and 2px container padding.
|
|
101
|
+
*
|
|
102
|
+
* Pass a single `confidence` value (named enum *or* float `[0, 1]`); the
|
|
103
|
+
* component normalizes it to a level, maps that level to a per-bar
|
|
104
|
+
* confidence mode, and resolves each bar's color through design tokens
|
|
105
|
+
* (`strengthIndicator/bar/<size>/background`).
|
|
106
|
+
*
|
|
107
|
+
* @component
|
|
108
|
+
* @param {StrengthIndicatorProps} props
|
|
109
|
+
*/
|
|
110
|
+
function StrengthIndicator({
|
|
111
|
+
confidence = 'High',
|
|
112
|
+
modes = _reactUtils.EMPTY_MODES,
|
|
113
|
+
style,
|
|
114
|
+
...rest
|
|
115
|
+
}) {
|
|
116
|
+
const containerGap = (0, _figmaVariablesResolver.getVariableByName)('strengthIndicator/container/gap', modes) ?? 2;
|
|
117
|
+
const containerPadding = (0, _figmaVariablesResolver.getVariableByName)('strengthIndicator/container/padding', modes) ?? 2;
|
|
118
|
+
const barWidth = (0, _figmaVariablesResolver.getVariableByName)('strengthIndicator/bar/width', modes) ?? 3;
|
|
119
|
+
const barRadius = (0, _figmaVariablesResolver.getVariableByName)('strengthIndicator/bar/radius', modes) ?? 1;
|
|
120
|
+
const barHeights = {
|
|
121
|
+
small: (0, _figmaVariablesResolver.getVariableByName)('strengthIndicator/bar/height/small', modes) ?? 6,
|
|
122
|
+
medium: (0, _figmaVariablesResolver.getVariableByName)('strengthIndicator/bar/height/medium', modes) ?? 9,
|
|
123
|
+
large: (0, _figmaVariablesResolver.getVariableByName)('strengthIndicator/bar/height/large', modes) ?? 12
|
|
124
|
+
};
|
|
125
|
+
const resolvedLevel = resolveConfidence(confidence);
|
|
126
|
+
const perBarConfidence = CONFIDENCE_TO_BARS[resolvedLevel];
|
|
127
|
+
const containerStyle = {
|
|
128
|
+
flexDirection: 'row',
|
|
129
|
+
alignItems: 'flex-end',
|
|
130
|
+
gap: containerGap,
|
|
131
|
+
padding: containerPadding
|
|
132
|
+
};
|
|
133
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
134
|
+
style: [containerStyle, style],
|
|
135
|
+
accessibilityRole: "image",
|
|
136
|
+
accessibilityLabel: `Strength indicator: ${resolvedLevel} confidence`,
|
|
137
|
+
...rest,
|
|
138
|
+
children: BAR_SIZES.map((size, index) => {
|
|
139
|
+
const barConfidence = perBarConfidence[index] ?? 'None';
|
|
140
|
+
const barModes = {
|
|
141
|
+
...modes,
|
|
142
|
+
Confidence: barConfidence
|
|
143
|
+
};
|
|
144
|
+
const tokenColor = (0, _figmaVariablesResolver.getVariableByName)(`strengthIndicator/bar/${size}/background`, barModes);
|
|
145
|
+
const backgroundColor = tokenColor ?? FALLBACK_BAR_COLOR[barConfidence];
|
|
146
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
147
|
+
style: {
|
|
148
|
+
width: barWidth,
|
|
149
|
+
height: barHeights[size],
|
|
150
|
+
borderRadius: barRadius,
|
|
151
|
+
backgroundColor
|
|
152
|
+
}
|
|
153
|
+
}, size);
|
|
154
|
+
})
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
var _default = exports.default = StrengthIndicator;
|
|
@@ -0,0 +1,150 @@
|
|
|
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 _reactUtils = require("../../utils/react-utils");
|
|
11
|
+
var _Button = _interopRequireDefault(require("../Button/Button"));
|
|
12
|
+
var _NavArrow = _interopRequireDefault(require("../NavArrow/NavArrow"));
|
|
13
|
+
var _StrengthIndicator = _interopRequireDefault(require("../StrengthIndicator/StrengthIndicator"));
|
|
14
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
|
+
/**
|
|
17
|
+
* SummaryTile composes a title (with an inline `StrengthIndicator`), a
|
|
18
|
+
* supporting description and an action slot into a compact horizontal row,
|
|
19
|
+
* commonly used at the top of dashboard cards (e.g. "Spending — know your
|
|
20
|
+
* spending and savings"). An optional trailing chevron and tile-level
|
|
21
|
+
* `onPress` handler turn the whole row into a navigational entry point.
|
|
22
|
+
*
|
|
23
|
+
* @component
|
|
24
|
+
* @param {SummaryTileProps} props
|
|
25
|
+
*/
|
|
26
|
+
function SummaryTile({
|
|
27
|
+
title = 'Spending',
|
|
28
|
+
description = 'Know your spending and savings',
|
|
29
|
+
confidence = 'None',
|
|
30
|
+
chevron = false,
|
|
31
|
+
children,
|
|
32
|
+
onPress,
|
|
33
|
+
modes = _reactUtils.EMPTY_MODES,
|
|
34
|
+
style,
|
|
35
|
+
titleStyle,
|
|
36
|
+
descriptionStyle,
|
|
37
|
+
accessibilityLabel
|
|
38
|
+
}) {
|
|
39
|
+
const containerGap = (0, _figmaVariablesResolver.getVariableByName)('summaryTile/gap', modes) ?? 8;
|
|
40
|
+
const containerPadding = (0, _figmaVariablesResolver.getVariableByName)('summaryTile/padding', modes) ?? 0;
|
|
41
|
+
const contentGap = (0, _figmaVariablesResolver.getVariableByName)('summaryTile/content/gap', modes) ?? 8;
|
|
42
|
+
const titleWrapGap = (0, _figmaVariablesResolver.getVariableByName)('summaryTile/titleWrap/gap', modes) ?? 4;
|
|
43
|
+
const titleColor = (0, _figmaVariablesResolver.getVariableByName)('summaryTile/title/color', modes) ?? '#0d0d0f';
|
|
44
|
+
const titleFontFamily = (0, _figmaVariablesResolver.getVariableByName)('summaryTile/title/fontFamily', modes) ?? 'JioType Var';
|
|
45
|
+
const titleFontSize = (0, _figmaVariablesResolver.getVariableByName)('summaryTile/title/fontSize', modes) ?? 16;
|
|
46
|
+
const titleFontWeight = (0, _figmaVariablesResolver.getVariableByName)('summaryTile/title/fontWeight', modes) ?? 700;
|
|
47
|
+
const titleLineHeight = (0, _figmaVariablesResolver.getVariableByName)('summaryTile/title/lineHeight', modes) ?? 18;
|
|
48
|
+
const descriptionColor = (0, _figmaVariablesResolver.getVariableByName)('summaryTile/description/color', modes) ?? '#24262b';
|
|
49
|
+
const descriptionFontFamily = (0, _figmaVariablesResolver.getVariableByName)('summaryTile/description/fontFamily', modes) ?? 'JioType Var';
|
|
50
|
+
const descriptionFontSize = (0, _figmaVariablesResolver.getVariableByName)('summaryTile/description/fontSize', modes) ?? 12;
|
|
51
|
+
const descriptionFontWeight = (0, _figmaVariablesResolver.getVariableByName)('summaryTile/description/fontWeight', modes) ?? 500;
|
|
52
|
+
const descriptionLineHeight = (0, _figmaVariablesResolver.getVariableByName)('summaryTile/description/lineHeight', modes) ?? 16;
|
|
53
|
+
const titleTextStyle = {
|
|
54
|
+
color: titleColor,
|
|
55
|
+
fontFamily: titleFontFamily,
|
|
56
|
+
fontSize: titleFontSize,
|
|
57
|
+
fontWeight: String(titleFontWeight),
|
|
58
|
+
lineHeight: titleLineHeight
|
|
59
|
+
};
|
|
60
|
+
const descriptionTextStyle = {
|
|
61
|
+
color: descriptionColor,
|
|
62
|
+
fontFamily: descriptionFontFamily,
|
|
63
|
+
fontSize: descriptionFontSize,
|
|
64
|
+
fontWeight: String(descriptionFontWeight),
|
|
65
|
+
lineHeight: descriptionLineHeight
|
|
66
|
+
};
|
|
67
|
+
const showIndicator = confidence !== null;
|
|
68
|
+
|
|
69
|
+
// When the entire tile is pressable, the default `Button` slot is
|
|
70
|
+
// suppressed so we don't render a `<button>` inside another `<button>`
|
|
71
|
+
// (which is invalid HTML and triggers a React hydration warning on
|
|
72
|
+
// web). Consumers can still pass an explicit non-button node via
|
|
73
|
+
// `children` if they want a visible affordance alongside `onPress`.
|
|
74
|
+
const isPressable = onPress != null;
|
|
75
|
+
const actionSlot = children !== undefined ? children !== null ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
76
|
+
children: (0, _reactUtils.cloneChildrenWithModes)(children, modes)
|
|
77
|
+
}) : null : isPressable ? null : /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
|
|
78
|
+
label: "Button",
|
|
79
|
+
modes: {
|
|
80
|
+
'AppearanceBrand': 'Secondary',
|
|
81
|
+
...modes,
|
|
82
|
+
'Button / Size': 'S'
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
const tileContent = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
86
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
87
|
+
style: {
|
|
88
|
+
flex: 1,
|
|
89
|
+
minWidth: 0,
|
|
90
|
+
flexDirection: 'column',
|
|
91
|
+
gap: contentGap,
|
|
92
|
+
alignItems: 'flex-start'
|
|
93
|
+
},
|
|
94
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
95
|
+
style: {
|
|
96
|
+
flexDirection: 'row',
|
|
97
|
+
alignItems: 'center',
|
|
98
|
+
gap: titleWrapGap,
|
|
99
|
+
width: '100%'
|
|
100
|
+
},
|
|
101
|
+
children: [title ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
102
|
+
style: [titleTextStyle, titleStyle],
|
|
103
|
+
numberOfLines: 1,
|
|
104
|
+
children: title
|
|
105
|
+
}) : null, showIndicator ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_StrengthIndicator.default, {
|
|
106
|
+
confidence: confidence,
|
|
107
|
+
modes: modes
|
|
108
|
+
}) : null]
|
|
109
|
+
}), description ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
110
|
+
style: [descriptionTextStyle, descriptionStyle],
|
|
111
|
+
children: description
|
|
112
|
+
}) : null]
|
|
113
|
+
}), actionSlot != null ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
114
|
+
style: {
|
|
115
|
+
flexDirection: 'row',
|
|
116
|
+
alignItems: 'center'
|
|
117
|
+
},
|
|
118
|
+
children: actionSlot
|
|
119
|
+
}) : null, chevron ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_NavArrow.default, {
|
|
120
|
+
direction: "Forward",
|
|
121
|
+
modes: modes
|
|
122
|
+
}) : null]
|
|
123
|
+
});
|
|
124
|
+
const containerLayoutStyle = {
|
|
125
|
+
flexDirection: 'row',
|
|
126
|
+
alignItems: 'center',
|
|
127
|
+
gap: containerGap,
|
|
128
|
+
padding: containerPadding,
|
|
129
|
+
width: '100%'
|
|
130
|
+
};
|
|
131
|
+
if (onPress) {
|
|
132
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
|
|
133
|
+
onPress: onPress,
|
|
134
|
+
accessibilityRole: "button",
|
|
135
|
+
accessibilityLabel: accessibilityLabel ?? title,
|
|
136
|
+
style: ({
|
|
137
|
+
pressed
|
|
138
|
+
}) => [containerLayoutStyle, style, pressed ? {
|
|
139
|
+
opacity: 0.7
|
|
140
|
+
} : null],
|
|
141
|
+
children: tileContent
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
145
|
+
style: [containerLayoutStyle, style],
|
|
146
|
+
accessibilityLabel: accessibilityLabel,
|
|
147
|
+
children: tileContent
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
var _default = exports.default = SummaryTile;
|
|
@@ -15,7 +15,8 @@ const TEXT_ALIGN_MAP = {
|
|
|
15
15
|
Center: 'center'
|
|
16
16
|
};
|
|
17
17
|
function Text({
|
|
18
|
-
text
|
|
18
|
+
text,
|
|
19
|
+
children,
|
|
19
20
|
textAlign = 'Left',
|
|
20
21
|
modes = _reactUtils.EMPTY_MODES,
|
|
21
22
|
style,
|
|
@@ -36,10 +37,16 @@ function Text({
|
|
|
36
37
|
letterSpacing: letterSpacing,
|
|
37
38
|
textAlign: TEXT_ALIGN_MAP[textAlign]
|
|
38
39
|
};
|
|
40
|
+
|
|
41
|
+
// Prefer JSX children when present, otherwise fall back to the `text` prop.
|
|
42
|
+
// Keep the storybook placeholder as a last resort so the Default story
|
|
43
|
+
// still renders something visible when no content is supplied via either
|
|
44
|
+
// route.
|
|
45
|
+
const content = children !== undefined && children !== null && children !== false ? children : text !== undefined ? text : 'Korem ipsum ';
|
|
39
46
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
40
47
|
style: [textStyle, style],
|
|
41
48
|
numberOfLines: numberOfLines,
|
|
42
|
-
children:
|
|
49
|
+
children: content
|
|
43
50
|
});
|
|
44
51
|
}
|
|
45
52
|
var _default = exports.default = Text;
|
|
@@ -172,7 +172,9 @@ function TooltipTrigger({
|
|
|
172
172
|
}
|
|
173
173
|
function TooltipContent({
|
|
174
174
|
children,
|
|
175
|
-
sideOffset = 4
|
|
175
|
+
sideOffset = 4,
|
|
176
|
+
gap = 4,
|
|
177
|
+
alignItems = 'flex-start'
|
|
176
178
|
}) {
|
|
177
179
|
const {
|
|
178
180
|
isVisible,
|
|
@@ -397,6 +399,35 @@ function TooltipContent({
|
|
|
397
399
|
paddingHorizontal: paddingH,
|
|
398
400
|
paddingVertical: paddingV
|
|
399
401
|
};
|
|
402
|
+
|
|
403
|
+
// Vertical slot wrapper: stack arbitrary children top-to-bottom with a gap.
|
|
404
|
+
// Raw <Text> children still get auto-styled with the tooltip label tokens
|
|
405
|
+
// so the simple <TooltipContent><Text>label</Text></TooltipContent> usage
|
|
406
|
+
// keeps working without any changes.
|
|
407
|
+
const slotStyle = {
|
|
408
|
+
flexDirection: 'column',
|
|
409
|
+
alignItems,
|
|
410
|
+
gap
|
|
411
|
+
};
|
|
412
|
+
const renderSlotChildren = () => {
|
|
413
|
+
if (typeof children === 'string') {
|
|
414
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
415
|
+
style: textStyle,
|
|
416
|
+
children: children
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
420
|
+
style: slotStyle,
|
|
421
|
+
children: _react.default.Children.map(children, child => {
|
|
422
|
+
if (/*#__PURE__*/_react.default.isValidElement(child) && (child.type === _reactNative.Text || child.type.displayName === 'Text')) {
|
|
423
|
+
return /*#__PURE__*/_react.default.cloneElement(child, {
|
|
424
|
+
style: [textStyle, child.props.style]
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
return child;
|
|
428
|
+
})
|
|
429
|
+
});
|
|
430
|
+
};
|
|
400
431
|
if (!hasMeasured) {
|
|
401
432
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Modal, {
|
|
402
433
|
transparent: true,
|
|
@@ -408,19 +439,7 @@ function TooltipContent({
|
|
|
408
439
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
409
440
|
style: measureStyle,
|
|
410
441
|
onLayout: e => setContentSize(e.nativeEvent.layout),
|
|
411
|
-
children:
|
|
412
|
-
style: textStyle,
|
|
413
|
-
children: children
|
|
414
|
-
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
415
|
-
children: _react.default.Children.map(children, child => {
|
|
416
|
-
if (/*#__PURE__*/_react.default.isValidElement(child) && (child.type === _reactNative.Text || child.type.displayName === 'Text')) {
|
|
417
|
-
return /*#__PURE__*/_react.default.cloneElement(child, {
|
|
418
|
-
style: [textStyle, child.props.style]
|
|
419
|
-
});
|
|
420
|
-
}
|
|
421
|
-
return child;
|
|
422
|
-
})
|
|
423
|
-
})
|
|
442
|
+
children: renderSlotChildren()
|
|
424
443
|
})
|
|
425
444
|
})
|
|
426
445
|
});
|
|
@@ -451,19 +470,7 @@ function TooltipContent({
|
|
|
451
470
|
shadowRadius: 3.84,
|
|
452
471
|
elevation: 5
|
|
453
472
|
}],
|
|
454
|
-
children: [
|
|
455
|
-
style: textStyle,
|
|
456
|
-
children: children
|
|
457
|
-
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
458
|
-
children: _react.default.Children.map(children, child => {
|
|
459
|
-
if (/*#__PURE__*/_react.default.isValidElement(child) && (child.type === _reactNative.Text || child.type.displayName === 'Text')) {
|
|
460
|
-
return /*#__PURE__*/_react.default.cloneElement(child, {
|
|
461
|
-
style: [textStyle, child.props.style]
|
|
462
|
-
});
|
|
463
|
-
}
|
|
464
|
-
return child;
|
|
465
|
-
})
|
|
466
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
473
|
+
children: [renderSlotChildren(), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
467
474
|
style: {
|
|
468
475
|
position: 'absolute',
|
|
469
476
|
left: arrowX,
|