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
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,34 @@ All notable changes to this project are documented in this file.
|
|
|
4
4
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
6
6
|
|
|
7
|
+
## [0.0.74] - 2026-05-19
|
|
8
|
+
|
|
9
|
+
- Added new account and onboarding components: `AccountCard` (connected/add variants), `PageHero`, `LottieIntroBlock`, and `PoweredByLabel`.
|
|
10
|
+
- Added new selection primitives: `Dropdown` + `DropdownItem` (compound API) and `DropdownInput` (options-based form control).
|
|
11
|
+
- Added Storybook coverage for the existing `Icon` primitive (no API change).
|
|
12
|
+
- Major `FormField` rewrite — re-bound directly to React Native `TextInput` (no longer wraps `TextInput` component), gained `number` / `phone` / `url` types, `Form` context integration, and improved Figma/token alignment.
|
|
13
|
+
- Compound `Tooltip` upgrade — `TooltipContent` now acts as a vertical slot with `gap` and `alignItems` props, and exports `TooltipPlacement` / trigger / content types from the package barrel.
|
|
14
|
+
- `Text` now accepts JSX `children` (drop-in `<Text>label</Text>` works) in addition to the `text` prop; `AppBar` middle slot lays out via `flex: 1` with `space-between` fallback when absent.
|
|
15
|
+
- `CheckboxItem` gained a `control` prop (`leading` / `trailing`) that swaps the checkbox and the end slot to either edge of the row.
|
|
16
|
+
- `CardBankAccount` ships sensible default `Button / Size` + Appearance modes so the footer button matches Figma out of the box.
|
|
17
|
+
- Figma/token sync pass across `FormField`, `CardBankAccount`, `CardFinancialCondition`, `CheckboxItem`, `CircularProgressBar`, `CoverageBarComparison`, `DonutChart`, `DonutChartSummary`, `Gauge`, `LinearProgress`, `MetricLegendItem`, `MonthlyStatusGrid`, `Nudge`, `RangeTrack`, `SavingsGoalSummary`, and `SegmentedTrack`; refreshed Coin Variables tokens, `.token-metadata.json`, and icons registry.
|
|
18
|
+
- Repo cleanup: removed the legacy `example/` app, `.expo/` artifacts, and the `example` / `example:install` scripts; updated `tsconfig.build.json` and `scripts/generate-component-docs.js`; added `.tgz` and `.expo/` to `.gitignore`.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## [0.0.73] - 2026-05-15
|
|
23
|
+
|
|
24
|
+
- Added new chart, progress, and coverage components: `DonutChart`, `DonutChartSummary`, `LinearProgress`, `SavingsGoalSummary`, `CoverageRing`, `CoverageBarComparison`, `MonthlyStatusGrid`, `MetricLegendItem`, `RangeTrack`, `SegmentedTrack`, `StatGroup`, `StrengthIndicator`, and `SummaryTile`.
|
|
25
|
+
- Added new form/selection primitives: `AccordionCheckbox`, `CheckboxGroup`, `CheckboxItem`, and `Radio` (renamed from `RadioButton`; the old name is kept as a deprecated re-export).
|
|
26
|
+
- Added new card and badge components: `CardBankAccount`, `CardInsight`, `ProductOverview`, and `BrandChip`.
|
|
27
|
+
- Major `OTP` overhaul (new API, stories, and MDX) and `LinearMeter` refactor; `Carousel` pagination/maxHeight refresh and `HoldingsCard` migration to `Radio`.
|
|
28
|
+
- Enhanced `CircularProgressBar` with an in-ring `supportText` caption (driven by `circularProgressBar/supportText/*` tokens) and a centered text stack; reworked `StatItem` API and stories.
|
|
29
|
+
- Token surface refresh: added `XS` to `Button / Size` (surfaced on `Button`, `CardCTA`, `IconButton`); split `LinearProgress` / `SavingsGoalSummary` `Appearance / DataViz` into `Appearance Type` + `AppearanceBrand` + `AppearanceSystem` and renamed `Emphasis / DataViz` → `Emphasis`; added `Auto` status + `FormField States` to `SupportText`, `SupportTextIcon`, `InputSearch`; added `Error` state and `Color Mode` to `FormField`; added `Page type` (MainPage / SubPage) to `Title`.
|
|
30
|
+
- New `number-utils` (+ tests) exported from `src/utils`; refreshed icons registry, Coin Variables tokens, and `.token-metadata.json`.
|
|
31
|
+
- Expanded Storybook and MDX coverage for all new and updated components, plus docs for `HStack`, `VStack`, and `Section`.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
7
35
|
## [0.0.72] - 2026-05-04
|
|
8
36
|
|
|
9
37
|
High-level summary (one line per point):
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _figmaVariablesResolver = require("../../design-tokens/figma-variables-resolver");
|
|
10
|
+
var _reactUtils = require("../../utils/react-utils");
|
|
11
|
+
var _Checkbox = _interopRequireDefault(require("../Checkbox/Checkbox"));
|
|
12
|
+
var _Divider = _interopRequireDefault(require("../Divider/Divider"));
|
|
13
|
+
var _Icon = _interopRequireDefault(require("../../icons/Icon"));
|
|
14
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
|
+
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); }
|
|
17
|
+
if (_reactNative.Platform.OS === 'android' && _reactNative.UIManager.setLayoutAnimationEnabledExperimental) {
|
|
18
|
+
_reactNative.UIManager.setLayoutAnimationEnabledExperimental(true);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* AccordionCheckbox composes a header (with a `Checkbox`, title, subtitle and
|
|
22
|
+
* chevron) and a collapsible content slot. It mirrors the Figma
|
|
23
|
+
* "Accordion Checkbox" component.
|
|
24
|
+
*
|
|
25
|
+
* Two independent interactions live inside the header:
|
|
26
|
+
* - **Pressing the checkbox** toggles the parent checked state via
|
|
27
|
+
* `onCheckedChange` (typically used for "select all" behaviour).
|
|
28
|
+
* - **Pressing anywhere else on the header** toggles the expanded state via
|
|
29
|
+
* `onExpandedChange`.
|
|
30
|
+
*
|
|
31
|
+
* When expanded, a divider is shown and `children` are rendered with `modes`
|
|
32
|
+
* automatically forwarded through `cloneChildrenWithModes`.
|
|
33
|
+
*
|
|
34
|
+
* @component
|
|
35
|
+
* @param {AccordionCheckboxProps} props
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```tsx
|
|
39
|
+
* <AccordionCheckbox
|
|
40
|
+
* title="Axis Bank"
|
|
41
|
+
* subtitle="3 accounts"
|
|
42
|
+
* defaultExpanded
|
|
43
|
+
* defaultChecked
|
|
44
|
+
* modes={{ 'Color Mode': 'Light' }}
|
|
45
|
+
* >
|
|
46
|
+
* <CheckboxGroup>
|
|
47
|
+
* <CheckboxItem label="Fixed deposit • 0245" />
|
|
48
|
+
* <CheckboxItem label="Recurring deposit • 1182" />
|
|
49
|
+
* <CheckboxItem label="Mutual fund • Equity" />
|
|
50
|
+
* </CheckboxGroup>
|
|
51
|
+
* </AccordionCheckbox>
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
function AccordionCheckbox({
|
|
55
|
+
title = 'Axis Bank',
|
|
56
|
+
subtitle = '3 accounts',
|
|
57
|
+
defaultExpanded = false,
|
|
58
|
+
expanded: controlledExpanded,
|
|
59
|
+
onExpandedChange,
|
|
60
|
+
defaultChecked = false,
|
|
61
|
+
checked: controlledChecked,
|
|
62
|
+
onCheckedChange,
|
|
63
|
+
disabled = false,
|
|
64
|
+
children,
|
|
65
|
+
modes = _reactUtils.EMPTY_MODES,
|
|
66
|
+
style,
|
|
67
|
+
accessibilityLabel
|
|
68
|
+
}) {
|
|
69
|
+
const isExpandedControlled = controlledExpanded !== undefined;
|
|
70
|
+
const [internalExpanded, setInternalExpanded] = (0, _react.useState)(defaultExpanded);
|
|
71
|
+
const isExpanded = isExpandedControlled ? controlledExpanded : internalExpanded;
|
|
72
|
+
const isCheckedControlled = controlledChecked !== undefined;
|
|
73
|
+
const [internalChecked, setInternalChecked] = (0, _react.useState)(defaultChecked);
|
|
74
|
+
const isChecked = isCheckedControlled ? controlledChecked : internalChecked;
|
|
75
|
+
const handleToggleExpanded = (0, _react.useCallback)(() => {
|
|
76
|
+
if (disabled) return;
|
|
77
|
+
_reactNative.LayoutAnimation.configureNext(_reactNative.LayoutAnimation.Presets.easeInEaseOut);
|
|
78
|
+
const next = !isExpanded;
|
|
79
|
+
if (!isExpandedControlled) {
|
|
80
|
+
setInternalExpanded(next);
|
|
81
|
+
}
|
|
82
|
+
onExpandedChange?.(next);
|
|
83
|
+
}, [disabled, isExpanded, isExpandedControlled, onExpandedChange]);
|
|
84
|
+
const handleToggleChecked = (0, _react.useCallback)(next => {
|
|
85
|
+
if (disabled) return;
|
|
86
|
+
if (!isCheckedControlled) {
|
|
87
|
+
setInternalChecked(next);
|
|
88
|
+
}
|
|
89
|
+
onCheckedChange?.(next);
|
|
90
|
+
}, [disabled, isCheckedControlled, onCheckedChange]);
|
|
91
|
+
const background = (0, _figmaVariablesResolver.getVariableByName)('accordionCheckbox/background', modes) ?? '#ffffff';
|
|
92
|
+
const radius = (0, _figmaVariablesResolver.getVariableByName)('accordionCheckbox/radius', modes) ?? 12;
|
|
93
|
+
const paddingHorizontal = (0, _figmaVariablesResolver.getVariableByName)('accordionCheckbox/padding/horizontal', modes) ?? 12;
|
|
94
|
+
const paddingVertical = (0, _figmaVariablesResolver.getVariableByName)('accordionCheckbox/padding/vertical', modes) ?? 16;
|
|
95
|
+
const containerGap = (0, _figmaVariablesResolver.getVariableByName)('accordionCheckbox/gap', modes) ?? 12;
|
|
96
|
+
const borderColor = (0, _figmaVariablesResolver.getVariableByName)('accordionCheckbox/border/color', modes) ?? '#ebebed';
|
|
97
|
+
const borderSize = (0, _figmaVariablesResolver.getVariableByName)('accordionCheckbox/border/size', modes) ?? 1;
|
|
98
|
+
const headerGap = (0, _figmaVariablesResolver.getVariableByName)('accordionCheckbox/header/gap', modes) ?? 12;
|
|
99
|
+
const headerPaddingHorizontal = (0, _figmaVariablesResolver.getVariableByName)('accordionCheckbox/header/padding/horizontal', modes) ?? 0;
|
|
100
|
+
const headerPaddingVertical = (0, _figmaVariablesResolver.getVariableByName)('accordionCheckbox/header/padding/vertical', modes) ?? 0;
|
|
101
|
+
const headerWrapGap = (0, _figmaVariablesResolver.getVariableByName)('accordionCheckbox/header/wrap/gap', modes) ?? 12;
|
|
102
|
+
const textWrapGap = (0, _figmaVariablesResolver.getVariableByName)('accordionCheckbox/textWrap/gap', modes) ?? 2;
|
|
103
|
+
const titleColor = (0, _figmaVariablesResolver.getVariableByName)('accordionCheckbox/title/color', modes) ?? '#000000';
|
|
104
|
+
const titleFontSize = (0, _figmaVariablesResolver.getVariableByName)('accordionCheckbox/title/fontSize', modes) ?? 14;
|
|
105
|
+
const titleFontFamily = (0, _figmaVariablesResolver.getVariableByName)('accordionCheckbox/title/fontFamily', modes) ?? 'JioType Var';
|
|
106
|
+
const titleLineHeight = (0, _figmaVariablesResolver.getVariableByName)('accordionCheckbox/title/lineHeight', modes) ?? 18;
|
|
107
|
+
const titleFontWeightRaw = (0, _figmaVariablesResolver.getVariableByName)('accordionCheckbox/title/fontWeight', modes) ?? 600;
|
|
108
|
+
const titleFontWeight = String(titleFontWeightRaw);
|
|
109
|
+
const subtitleColor = (0, _figmaVariablesResolver.getVariableByName)('accordionCheckbox/subtitle/color', modes) ?? '#23190a';
|
|
110
|
+
const subtitleFontSize = (0, _figmaVariablesResolver.getVariableByName)('accordionCheckbox/subtitle/fontSize', modes) ?? 12;
|
|
111
|
+
const subtitleFontFamily = (0, _figmaVariablesResolver.getVariableByName)('accordionCheckbox/subtitle/fontFamily', modes) ?? 'JioType Var';
|
|
112
|
+
const subtitleLineHeight = (0, _figmaVariablesResolver.getVariableByName)('accordionCheckbox/subtitle/lineHeight', modes) ?? 16;
|
|
113
|
+
const subtitleFontWeightRaw = (0, _figmaVariablesResolver.getVariableByName)('accordionCheckbox/subtitle/fontWeight', modes) ?? 500;
|
|
114
|
+
const subtitleFontWeight = String(subtitleFontWeightRaw);
|
|
115
|
+
const iconColor = (0, _figmaVariablesResolver.getVariableByName)('accordionCheckbox/icon/color', modes) ?? '#000000';
|
|
116
|
+
const iconSize = (0, _figmaVariablesResolver.getVariableByName)('accordionCheckbox/icon/size', modes) ?? 24;
|
|
117
|
+
const contentGap = (0, _figmaVariablesResolver.getVariableByName)('accordionCheckbox/content/gap', modes) ?? 0;
|
|
118
|
+
const contentPaddingTop = (0, _figmaVariablesResolver.getVariableByName)('accordionCheckbox/content/padding/top', modes) ?? 8;
|
|
119
|
+
const contentPaddingBottom = (0, _figmaVariablesResolver.getVariableByName)('accordionCheckbox/content/padding/bottom', modes) ?? 0;
|
|
120
|
+
const contentPaddingHorizontal = (0, _figmaVariablesResolver.getVariableByName)('accordionCheckbox/content/padding/horizontal', modes) ?? 0;
|
|
121
|
+
const containerStyle = {
|
|
122
|
+
backgroundColor: background,
|
|
123
|
+
borderRadius: radius,
|
|
124
|
+
paddingHorizontal,
|
|
125
|
+
paddingVertical,
|
|
126
|
+
flexDirection: 'column',
|
|
127
|
+
alignItems: 'stretch',
|
|
128
|
+
gap: containerGap,
|
|
129
|
+
overflow: 'hidden',
|
|
130
|
+
...(isExpanded ? {
|
|
131
|
+
borderWidth: borderSize,
|
|
132
|
+
borderColor
|
|
133
|
+
} : null),
|
|
134
|
+
...(disabled ? {
|
|
135
|
+
opacity: 0.6
|
|
136
|
+
} : null)
|
|
137
|
+
};
|
|
138
|
+
const headerStyle = {
|
|
139
|
+
flexDirection: 'row',
|
|
140
|
+
alignItems: 'center',
|
|
141
|
+
gap: headerGap,
|
|
142
|
+
paddingHorizontal: headerPaddingHorizontal,
|
|
143
|
+
paddingVertical: headerPaddingVertical
|
|
144
|
+
};
|
|
145
|
+
const wrapStyle = {
|
|
146
|
+
flex: 1,
|
|
147
|
+
minWidth: 0,
|
|
148
|
+
flexDirection: 'row',
|
|
149
|
+
alignItems: 'center',
|
|
150
|
+
gap: headerWrapGap
|
|
151
|
+
};
|
|
152
|
+
const textWrapStyle = {
|
|
153
|
+
flex: 1,
|
|
154
|
+
minWidth: 0,
|
|
155
|
+
flexDirection: 'column',
|
|
156
|
+
alignItems: 'flex-start',
|
|
157
|
+
gap: textWrapGap
|
|
158
|
+
};
|
|
159
|
+
const titleStyle = {
|
|
160
|
+
color: titleColor,
|
|
161
|
+
fontSize: titleFontSize,
|
|
162
|
+
lineHeight: titleLineHeight,
|
|
163
|
+
fontFamily: titleFontFamily,
|
|
164
|
+
fontWeight: titleFontWeight
|
|
165
|
+
};
|
|
166
|
+
const subtitleStyle = {
|
|
167
|
+
color: subtitleColor,
|
|
168
|
+
fontSize: subtitleFontSize,
|
|
169
|
+
lineHeight: subtitleLineHeight,
|
|
170
|
+
fontFamily: subtitleFontFamily,
|
|
171
|
+
fontWeight: subtitleFontWeight
|
|
172
|
+
};
|
|
173
|
+
const contentStyle = {
|
|
174
|
+
flexDirection: 'column',
|
|
175
|
+
alignItems: 'stretch',
|
|
176
|
+
justifyContent: 'center',
|
|
177
|
+
gap: contentGap,
|
|
178
|
+
paddingTop: contentPaddingTop,
|
|
179
|
+
paddingBottom: contentPaddingBottom,
|
|
180
|
+
paddingHorizontal: contentPaddingHorizontal
|
|
181
|
+
};
|
|
182
|
+
const a11yLabel = accessibilityLabel ?? title;
|
|
183
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
184
|
+
style: [containerStyle, style],
|
|
185
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Pressable, {
|
|
186
|
+
onPress: handleToggleExpanded,
|
|
187
|
+
disabled: disabled,
|
|
188
|
+
accessibilityRole: "button",
|
|
189
|
+
accessibilityState: {
|
|
190
|
+
expanded: isExpanded,
|
|
191
|
+
disabled
|
|
192
|
+
},
|
|
193
|
+
accessibilityLabel: a11yLabel,
|
|
194
|
+
accessibilityHint: isExpanded ? 'Collapse' : 'Expand',
|
|
195
|
+
style: ({
|
|
196
|
+
pressed
|
|
197
|
+
}) => [headerStyle, pressed && !disabled ? {
|
|
198
|
+
opacity: 0.9
|
|
199
|
+
} : null],
|
|
200
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
201
|
+
style: wrapStyle,
|
|
202
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Checkbox.default, {
|
|
203
|
+
checked: isChecked,
|
|
204
|
+
onValueChange: handleToggleChecked,
|
|
205
|
+
disabled: disabled,
|
|
206
|
+
modes: modes,
|
|
207
|
+
accessibilityLabel: typeof title === 'string' ? `Select ${title}` : undefined
|
|
208
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
209
|
+
style: textWrapStyle,
|
|
210
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
211
|
+
style: titleStyle,
|
|
212
|
+
numberOfLines: 1,
|
|
213
|
+
selectable: false,
|
|
214
|
+
children: title
|
|
215
|
+
}), subtitle ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
216
|
+
style: subtitleStyle,
|
|
217
|
+
numberOfLines: 1,
|
|
218
|
+
selectable: false,
|
|
219
|
+
children: subtitle
|
|
220
|
+
}) : null]
|
|
221
|
+
})]
|
|
222
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
|
|
223
|
+
name: isExpanded ? 'ic_chevron_up' : 'ic_chevron_down',
|
|
224
|
+
size: iconSize,
|
|
225
|
+
color: iconColor,
|
|
226
|
+
accessibilityElementsHidden: true,
|
|
227
|
+
importantForAccessibility: "no"
|
|
228
|
+
})]
|
|
229
|
+
}), isExpanded ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
230
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Divider.default, {
|
|
231
|
+
modes: modes
|
|
232
|
+
}), children ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
233
|
+
style: contentStyle,
|
|
234
|
+
children: (0, _reactUtils.cloneChildrenWithModes)(children, modes)
|
|
235
|
+
}) : null]
|
|
236
|
+
}) : null]
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
var _default = exports.default = AccordionCheckbox;
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _figmaVariablesResolver = require("../../design-tokens/figma-variables-resolver");
|
|
10
|
+
var _reactUtils = require("../../utils/react-utils");
|
|
11
|
+
var _Icon = _interopRequireDefault(require("../../icons/Icon"));
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
15
|
+
const IS_IOS = _reactNative.Platform.OS === 'ios';
|
|
16
|
+
const PRESS_DELAY = IS_IOS ? 130 : 0;
|
|
17
|
+
const DEFAULT_IMAGE_RATIO = 125 / 82;
|
|
18
|
+
const pressedOverlayStyle = {
|
|
19
|
+
opacity: 0.7
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
// Default modes for the "Add" placeholder icon (`iconButton/*` tokens).
|
|
23
|
+
// Caller-supplied `modes` are merged on top so every key here can be overridden.
|
|
24
|
+
const ADD_ICON_DEFAULT_MODES = Object.freeze({
|
|
25
|
+
AppearanceBrand: 'Secondary',
|
|
26
|
+
Emphasis: 'Low',
|
|
27
|
+
"Button / Size": "M"
|
|
28
|
+
});
|
|
29
|
+
const toNumber = (value, fallback) => {
|
|
30
|
+
if (typeof value === 'number') return Number.isFinite(value) ? value : fallback;
|
|
31
|
+
if (typeof value === 'string') {
|
|
32
|
+
const parsed = Number(value);
|
|
33
|
+
return Number.isFinite(parsed) ? parsed : fallback;
|
|
34
|
+
}
|
|
35
|
+
return fallback;
|
|
36
|
+
};
|
|
37
|
+
const toFontWeight = (value, fallback) => {
|
|
38
|
+
if (typeof value === 'number') return String(value);
|
|
39
|
+
if (typeof value === 'string') return value;
|
|
40
|
+
return fallback;
|
|
41
|
+
};
|
|
42
|
+
const normalizeImageSource = src => {
|
|
43
|
+
if (src == null) return undefined;
|
|
44
|
+
if (typeof src === 'string') return {
|
|
45
|
+
uri: src
|
|
46
|
+
};
|
|
47
|
+
return src;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* `AccountCard` — a compact card preview used to represent a linked
|
|
52
|
+
* financial account in lists / grids.
|
|
53
|
+
*
|
|
54
|
+
* Two visual states are supported via the `state` prop:
|
|
55
|
+
*
|
|
56
|
+
* 1. `'connected'` (default): renders a small card-art preview, a bold
|
|
57
|
+
* `title` and a regular-weight `subtitle` (e.g. masked account number).
|
|
58
|
+
* 2. `'add'`: renders a soft-tinted placeholder field with a centred `+`
|
|
59
|
+
* icon and the `title` underneath, intended as the "add new account"
|
|
60
|
+
* entry-point at the end of a list of connected accounts.
|
|
61
|
+
*
|
|
62
|
+
* All values resolve through the `accountCard/*` design tokens with
|
|
63
|
+
* sensible Figma defaults so the card renders correctly out of the box.
|
|
64
|
+
*
|
|
65
|
+
* @component
|
|
66
|
+
* @param {AccountCardProps} props
|
|
67
|
+
*/
|
|
68
|
+
function AccountCard({
|
|
69
|
+
state = 'connected',
|
|
70
|
+
title = 'Personal account',
|
|
71
|
+
subtitle = '**** 5651',
|
|
72
|
+
imageSource,
|
|
73
|
+
imageRatio = DEFAULT_IMAGE_RATIO,
|
|
74
|
+
cardSlot,
|
|
75
|
+
addIcon = 'ic_add',
|
|
76
|
+
onPress,
|
|
77
|
+
disabled = false,
|
|
78
|
+
modes = _reactUtils.EMPTY_MODES,
|
|
79
|
+
style,
|
|
80
|
+
accessibilityLabel,
|
|
81
|
+
accessibilityHint
|
|
82
|
+
}) {
|
|
83
|
+
const iconModes = (0, _react.useMemo)(() => modes === _reactUtils.EMPTY_MODES ? ADD_ICON_DEFAULT_MODES : {
|
|
84
|
+
...ADD_ICON_DEFAULT_MODES,
|
|
85
|
+
...modes
|
|
86
|
+
}, [modes]);
|
|
87
|
+
|
|
88
|
+
// ---- Tokens ---------------------------------------------------------
|
|
89
|
+
const gap = toNumber((0, _figmaVariablesResolver.getVariableByName)('accountCard/gap', modes), 8);
|
|
90
|
+
const textWrapGap = toNumber((0, _figmaVariablesResolver.getVariableByName)('accountCard/textWrap/gap', modes), 0);
|
|
91
|
+
const titleColor = (0, _figmaVariablesResolver.getVariableByName)('accountCard/title/foreground', modes) ?? '#0d0d0f';
|
|
92
|
+
const titleFontFamily = (0, _figmaVariablesResolver.getVariableByName)('accountCard/title/fontFamily', modes) ?? 'JioType Var';
|
|
93
|
+
const titleFontSize = toNumber((0, _figmaVariablesResolver.getVariableByName)('accountCard/title/fontSize', modes), 12);
|
|
94
|
+
const titleLineHeight = toNumber((0, _figmaVariablesResolver.getVariableByName)('accountCard/title/lineHeight', modes), 16);
|
|
95
|
+
const titleFontWeight = toFontWeight((0, _figmaVariablesResolver.getVariableByName)('accountCard/title/fontWeight', modes), '700');
|
|
96
|
+
const subtitleColor = (0, _figmaVariablesResolver.getVariableByName)('accountCard/subtitle/foreground', modes) ?? '#24262b';
|
|
97
|
+
const subtitleFontFamily = (0, _figmaVariablesResolver.getVariableByName)('accountCard/subtitle/fontFamily', modes) ?? 'JioType Var';
|
|
98
|
+
const subtitleFontSize = toNumber((0, _figmaVariablesResolver.getVariableByName)('accountCard/subtitle/fontSize', modes), 12);
|
|
99
|
+
const subtitleLineHeight = toNumber((0, _figmaVariablesResolver.getVariableByName)('accountCard/subtitle/lineHeight', modes), 16);
|
|
100
|
+
const subtitleFontWeight = toFontWeight((0, _figmaVariablesResolver.getVariableByName)('accountCard/subtitle/fontWeight', modes), '400');
|
|
101
|
+
const addFieldRadius = toNumber((0, _figmaVariablesResolver.getVariableByName)('accountCard/addItemField/radius', modes), 8);
|
|
102
|
+
const addFieldBg = (0, _figmaVariablesResolver.getVariableByName)('accountCard/addItemField/bg', modes) ?? '#ede8ff';
|
|
103
|
+
const addIconColor = (0, _figmaVariablesResolver.getVariableByName)('iconButton/icon/color', iconModes) ?? '#5d00b5';
|
|
104
|
+
const addIconSize = toNumber((0, _figmaVariablesResolver.getVariableByName)('iconButton/icon/size', iconModes), 16);
|
|
105
|
+
|
|
106
|
+
// ---- Styles ---------------------------------------------------------
|
|
107
|
+
const titleStyle = {
|
|
108
|
+
color: titleColor,
|
|
109
|
+
fontFamily: titleFontFamily,
|
|
110
|
+
fontSize: titleFontSize,
|
|
111
|
+
lineHeight: titleLineHeight,
|
|
112
|
+
fontWeight: titleFontWeight,
|
|
113
|
+
width: '100%'
|
|
114
|
+
};
|
|
115
|
+
const subtitleStyle = {
|
|
116
|
+
color: subtitleColor,
|
|
117
|
+
fontFamily: subtitleFontFamily,
|
|
118
|
+
fontSize: subtitleFontSize,
|
|
119
|
+
lineHeight: subtitleLineHeight,
|
|
120
|
+
fontWeight: subtitleFontWeight,
|
|
121
|
+
width: '100%'
|
|
122
|
+
};
|
|
123
|
+
const imageBoxStyle = {
|
|
124
|
+
width: '100%',
|
|
125
|
+
aspectRatio: imageRatio,
|
|
126
|
+
overflow: 'hidden'
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
// RN's `<Image>` accepts `ImageStyle`, which has a narrower `overflow`
|
|
130
|
+
// union than `ViewStyle`. Build the image-only style separately so the
|
|
131
|
+
// shared box dimensions can be reused without a cast.
|
|
132
|
+
const imageStyle = {
|
|
133
|
+
width: '100%',
|
|
134
|
+
aspectRatio: imageRatio
|
|
135
|
+
};
|
|
136
|
+
const addFieldStyle = {
|
|
137
|
+
...imageBoxStyle,
|
|
138
|
+
backgroundColor: addFieldBg,
|
|
139
|
+
borderRadius: addFieldRadius,
|
|
140
|
+
alignItems: 'center',
|
|
141
|
+
justifyContent: 'center'
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
// ---- Image / placeholder area --------------------------------------
|
|
145
|
+
const renderCardArea = () => {
|
|
146
|
+
if (cardSlot !== undefined && cardSlot !== null) {
|
|
147
|
+
const processed = (0, _reactUtils.cloneChildrenWithModes)(cardSlot, modes);
|
|
148
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
149
|
+
style: imageBoxStyle,
|
|
150
|
+
pointerEvents: "box-none",
|
|
151
|
+
children: processed.length === 1 ? processed[0] : processed
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
if (state === 'add') {
|
|
155
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
156
|
+
style: addFieldStyle,
|
|
157
|
+
accessibilityElementsHidden: true,
|
|
158
|
+
importantForAccessibility: "no",
|
|
159
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
|
|
160
|
+
name: addIcon,
|
|
161
|
+
size: addIconSize,
|
|
162
|
+
color: addIconColor
|
|
163
|
+
})
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
const normalized = normalizeImageSource(imageSource);
|
|
167
|
+
if (normalized) {
|
|
168
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Image, {
|
|
169
|
+
source: normalized,
|
|
170
|
+
style: imageStyle,
|
|
171
|
+
resizeMode: "cover",
|
|
172
|
+
accessibilityElementsHidden: true,
|
|
173
|
+
importantForAccessibility: "no"
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
177
|
+
style: imageBoxStyle
|
|
178
|
+
});
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
// ---- Pressable wiring ----------------------------------------------
|
|
182
|
+
// Keep React state out of the press path. `Pressable`'s style callback
|
|
183
|
+
// applies the pressed visual without a re-render.
|
|
184
|
+
const userHandlersRef = (0, _react.useRef)({});
|
|
185
|
+
const handlePressIn = (0, _react.useCallback)(e => {
|
|
186
|
+
userHandlersRef.current.onPressIn?.(e);
|
|
187
|
+
}, []);
|
|
188
|
+
const handlePressOut = (0, _react.useCallback)(e => {
|
|
189
|
+
userHandlersRef.current.onPressOut?.(e);
|
|
190
|
+
}, []);
|
|
191
|
+
const containerStyle = (0, _react.useMemo)(() => ({
|
|
192
|
+
width: '100%',
|
|
193
|
+
flexDirection: 'column',
|
|
194
|
+
alignItems: 'flex-start',
|
|
195
|
+
gap,
|
|
196
|
+
opacity: disabled ? 0.5 : 1
|
|
197
|
+
}), [gap, disabled]);
|
|
198
|
+
const pressableStyle = (0, _react.useCallback)(({
|
|
199
|
+
pressed
|
|
200
|
+
}) => [containerStyle, style, pressed && !disabled && onPress ? pressedOverlayStyle : null], [containerStyle, style, disabled, onPress]);
|
|
201
|
+
const showSubtitle = state === 'connected' && subtitle != null && subtitle !== '';
|
|
202
|
+
const a11yRole = onPress ? 'button' : undefined;
|
|
203
|
+
const a11yLabel = accessibilityLabel ?? title;
|
|
204
|
+
const content = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
205
|
+
children: [renderCardArea(), title != null && title !== '' || showSubtitle ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
206
|
+
style: {
|
|
207
|
+
width: '100%',
|
|
208
|
+
flexDirection: 'column',
|
|
209
|
+
alignItems: 'flex-start',
|
|
210
|
+
gap: textWrapGap
|
|
211
|
+
},
|
|
212
|
+
children: [title != null && title !== '' ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
213
|
+
style: titleStyle,
|
|
214
|
+
numberOfLines: 1,
|
|
215
|
+
children: title
|
|
216
|
+
}) : null, showSubtitle ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
217
|
+
style: subtitleStyle,
|
|
218
|
+
numberOfLines: 1,
|
|
219
|
+
children: subtitle
|
|
220
|
+
}) : null]
|
|
221
|
+
}) : null]
|
|
222
|
+
});
|
|
223
|
+
if (!onPress) {
|
|
224
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
225
|
+
accessibilityLabel: a11yLabel,
|
|
226
|
+
accessibilityHint: accessibilityHint,
|
|
227
|
+
style: [containerStyle, style],
|
|
228
|
+
children: content
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
|
|
232
|
+
accessibilityRole: a11yRole,
|
|
233
|
+
accessibilityLabel: a11yLabel,
|
|
234
|
+
accessibilityHint: accessibilityHint,
|
|
235
|
+
accessibilityState: {
|
|
236
|
+
disabled
|
|
237
|
+
},
|
|
238
|
+
onPress: disabled ? undefined : onPress,
|
|
239
|
+
disabled: disabled,
|
|
240
|
+
onPressIn: handlePressIn,
|
|
241
|
+
onPressOut: handlePressOut,
|
|
242
|
+
unstable_pressDelay: PRESS_DELAY,
|
|
243
|
+
style: pressableStyle,
|
|
244
|
+
children: content
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
var _default = exports.default = /*#__PURE__*/_react.default.memo(AccountCard);
|
|
@@ -47,12 +47,13 @@ function AppBar({
|
|
|
47
47
|
const containerStyle = {
|
|
48
48
|
flexDirection: 'row',
|
|
49
49
|
alignItems: 'center',
|
|
50
|
-
justifyContent:
|
|
50
|
+
// No `justifyContent` here: with the inline middle slot using `flex: 1`
|
|
51
|
+
// the three sections lay out naturally (leading | middle | actions).
|
|
52
|
+
// When middleSlot is absent we fall back to `space-between` at the wrapper
|
|
53
|
+
// level so leading & actions still anchor to the edges.
|
|
51
54
|
paddingHorizontal: paddingHorizontal ?? 16,
|
|
52
55
|
paddingVertical: paddingVertical ?? (isMain ? 16 : 10),
|
|
53
56
|
backgroundColor: backgroundColor ?? '#FFFFFF'
|
|
54
|
-
// We can set minHeight if we want to enforce consistency, but padding should dictate it mostly.
|
|
55
|
-
// Figma shows specific heights implicitly via padding + content.
|
|
56
57
|
// MainPage: h=68 (16 top/bot padding? 36 height content?)
|
|
57
58
|
// SubPage: h=52
|
|
58
59
|
};
|
|
@@ -115,8 +116,17 @@ function AppBar({
|
|
|
115
116
|
style: actionsStyle,
|
|
116
117
|
children: (0, _reactUtils.cloneChildrenWithModes)(_react.default.Children.toArray(actionsSlot), modes)
|
|
117
118
|
}) : null;
|
|
119
|
+
|
|
120
|
+
// When there is no middleSlot we want leading & actions pinned to the
|
|
121
|
+
// outer edges, so we apply `space-between` at the wrapper. With a middle
|
|
122
|
+
// slot present, the middle (flex: 1) absorbs the remaining space, so
|
|
123
|
+
// `space-between` is a no-op.
|
|
124
|
+
const wrapperStyle = {
|
|
125
|
+
...containerStyle,
|
|
126
|
+
justifyContent: processedMiddle ? 'flex-start' : 'space-between'
|
|
127
|
+
};
|
|
118
128
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
119
|
-
style: [
|
|
129
|
+
style: [wrapperStyle, style],
|
|
120
130
|
accessibilityRole: "header",
|
|
121
131
|
accessibilityLabel: undefined,
|
|
122
132
|
...(accessibilityHint ? {
|
|
@@ -131,15 +141,11 @@ function AppBar({
|
|
|
131
141
|
children: processedLeading
|
|
132
142
|
}), processedMiddle && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
133
143
|
style: {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
right: 0,
|
|
137
|
-
top: 0,
|
|
138
|
-
bottom: 0,
|
|
144
|
+
flex: 1,
|
|
145
|
+
minWidth: 0,
|
|
139
146
|
alignItems: 'center',
|
|
140
147
|
justifyContent: 'center',
|
|
141
|
-
|
|
142
|
-
// Usually middle title shouldn't block actions. `pointerEvents="box-none"` is safer.
|
|
148
|
+
paddingHorizontal: 8
|
|
143
149
|
},
|
|
144
150
|
pointerEvents: "box-none",
|
|
145
151
|
children: processedMiddle
|