jfs-components 0.0.62 → 0.0.63
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 +36 -0
- package/lib/commonjs/components/Accordion/Accordion.js +1 -1
- package/lib/commonjs/components/ActionFooter/ActionFooter.js +1 -1
- package/lib/commonjs/components/ActionTile/ActionTile.js +2 -1
- package/lib/commonjs/components/AmountInput/AmountInput.js +2 -1
- package/lib/commonjs/components/AppBar/AppBar.js +1 -1
- package/lib/commonjs/components/Avatar/Avatar.js +184 -162
- package/lib/commonjs/components/AvatarGroup/AvatarGroup.js +1 -1
- package/lib/commonjs/components/Badge/Badge.js +2 -1
- package/lib/commonjs/components/Balance/Balance.js +2 -1
- package/lib/commonjs/components/BottomNav/BottomNav.js +2 -1
- package/lib/commonjs/components/BottomNavItem/BottomNavItem.js +106 -86
- package/lib/commonjs/components/Button/Button.js +190 -93
- package/lib/commonjs/components/ButtonGroup/ButtonGroup.js +1 -1
- package/lib/commonjs/components/Card/Card.js +2 -1
- package/lib/commonjs/components/CardCTA/CardCTA.js +1 -1
- package/lib/commonjs/components/CardProviderInfo/CardProviderInfo.js +1 -1
- package/lib/commonjs/components/Carousel/Carousel.js +3 -2
- package/lib/commonjs/components/Checkbox/Checkbox.js +2 -1
- package/lib/commonjs/components/ChipGroup/ChipGroup.js +1 -1
- package/lib/commonjs/components/ChipSelect/ChipSelect.js +2 -1
- package/lib/commonjs/components/DebitCard/DebitCard.js +1 -1
- package/lib/commonjs/components/Disclaimer/Disclaimer.js +2 -1
- package/lib/commonjs/components/Divider/Divider.js +2 -1
- package/lib/commonjs/components/Drawer/Drawer.js +2 -1
- package/lib/commonjs/components/EmptyState/EmptyState.js +2 -1
- package/lib/commonjs/components/FilterBar/FilterBar.js +1 -1
- package/lib/commonjs/components/Form/Form.js +2 -1
- package/lib/commonjs/components/FormField/FormField.js +3 -2
- package/lib/commonjs/components/HStack/HStack.js +1 -1
- package/lib/commonjs/components/HoldingsCard/HoldingsCard.js +2 -1
- package/lib/commonjs/components/IconButton/IconButton.js +118 -128
- package/lib/commonjs/components/IconCapsule/IconCapsule.js +61 -57
- package/lib/commonjs/components/InputSearch/InputSearch.js +7 -3
- package/lib/commonjs/components/LazyList/LazyList.js +1 -1
- package/lib/commonjs/components/LinearMeter/LinearMeter.js +3 -2
- package/lib/commonjs/components/ListGroup/ListGroup.js +1 -1
- package/lib/commonjs/components/ListItem/ListItem.js +190 -142
- package/lib/commonjs/components/MediaCard/MediaCard.js +3 -3
- package/lib/commonjs/components/MerchantProfile/MerchantProfile.js +2 -1
- package/lib/commonjs/components/MoneyValue/MoneyValue.js +2 -1
- package/lib/commonjs/components/NavArrow/NavArrow.js +82 -59
- package/lib/commonjs/components/NoteInput/NoteInput.js +2 -1
- package/lib/commonjs/components/Nudge/Nudge.js +1 -1
- package/lib/commonjs/components/Numpad/Numpad.js +2 -1
- package/lib/commonjs/components/OTP/OTP.js +1 -1
- package/lib/commonjs/components/PaymentFeedback/PaymentFeedback.js +2 -1
- package/lib/commonjs/components/Popup/Popup.js +2 -1
- package/lib/commonjs/components/ProductLabel/ProductLabel.js +2 -1
- package/lib/commonjs/components/ProgressBadge/ProgressBadge.js +2 -1
- package/lib/commonjs/components/RadioButton/RadioButton.js +2 -1
- package/lib/commonjs/components/RechargeCard/RechargeCard.js +2 -1
- package/lib/commonjs/components/Screen/Screen.js +1 -1
- package/lib/commonjs/components/Section/Section.js +268 -156
- package/lib/commonjs/components/SegmentedControl/SegmentedControl.js +3 -2
- package/lib/commonjs/components/StatItem/StatItem.js +2 -1
- package/lib/commonjs/components/StatusHero/StatusHero.js +2 -1
- package/lib/commonjs/components/Stepper/Step.js +2 -1
- package/lib/commonjs/components/Stepper/StepLabel.js +2 -1
- package/lib/commonjs/components/Stepper/Stepper.js +2 -1
- package/lib/commonjs/components/SupportText/SupportText.js +2 -1
- package/lib/commonjs/components/SupportText/SupportTextIcon.js +2 -1
- package/lib/commonjs/components/SwappableAmount/SwappableAmount.js +2 -1
- package/lib/commonjs/components/Tabs/TabItem.js +2 -1
- package/lib/commonjs/components/Tabs/Tabs.js +2 -1
- package/lib/commonjs/components/Text/Text.js +2 -1
- package/lib/commonjs/components/TextInput/TextInput.js +2 -2
- package/lib/commonjs/components/ThreadHero/ThreadHero.js +2 -1
- package/lib/commonjs/components/Title/Title.js +2 -1
- package/lib/commonjs/components/Toast/Toast.js +2 -1
- package/lib/commonjs/components/Toggle/Toggle.js +2 -1
- package/lib/commonjs/components/Tooltip/Tooltip.js +2 -1
- package/lib/commonjs/components/TransactionBubble/TransactionBubble.js +1 -1
- package/lib/commonjs/components/TransactionDetails/TransactionDetails.js +2 -2
- package/lib/commonjs/components/TransactionStatus/TransactionStatus.js +3 -2
- package/lib/commonjs/components/UpiHandle/UpiHandle.js +144 -110
- package/lib/commonjs/components/VStack/VStack.js +1 -1
- package/lib/commonjs/design-tokens/figma-variables-resolver.js +21 -3
- package/lib/commonjs/icons/registry.js +1 -1
- package/lib/commonjs/utils/react-utils.js +17 -0
- package/lib/module/components/Accordion/Accordion.js +2 -2
- package/lib/module/components/ActionFooter/ActionFooter.js +2 -2
- package/lib/module/components/ActionTile/ActionTile.js +2 -1
- package/lib/module/components/AmountInput/AmountInput.js +2 -1
- package/lib/module/components/AppBar/AppBar.js +2 -2
- package/lib/module/components/Avatar/Avatar.js +184 -162
- package/lib/module/components/AvatarGroup/AvatarGroup.js +2 -2
- package/lib/module/components/Badge/Badge.js +2 -1
- package/lib/module/components/Balance/Balance.js +2 -1
- package/lib/module/components/BottomNav/BottomNav.js +2 -1
- package/lib/module/components/BottomNavItem/BottomNavItem.js +108 -88
- package/lib/module/components/Button/Button.js +192 -95
- package/lib/module/components/ButtonGroup/ButtonGroup.js +2 -2
- package/lib/module/components/Card/Card.js +2 -1
- package/lib/module/components/CardCTA/CardCTA.js +2 -2
- package/lib/module/components/CardProviderInfo/CardProviderInfo.js +2 -2
- package/lib/module/components/Carousel/Carousel.js +3 -2
- package/lib/module/components/Checkbox/Checkbox.js +2 -1
- package/lib/module/components/ChipGroup/ChipGroup.js +2 -2
- package/lib/module/components/ChipSelect/ChipSelect.js +2 -1
- package/lib/module/components/DebitCard/DebitCard.js +2 -2
- package/lib/module/components/Disclaimer/Disclaimer.js +2 -1
- package/lib/module/components/Divider/Divider.js +2 -1
- package/lib/module/components/Drawer/Drawer.js +2 -1
- package/lib/module/components/EmptyState/EmptyState.js +2 -1
- package/lib/module/components/FilterBar/FilterBar.js +2 -2
- package/lib/module/components/Form/Form.js +2 -1
- package/lib/module/components/FormField/FormField.js +3 -2
- package/lib/module/components/HStack/HStack.js +2 -2
- package/lib/module/components/HoldingsCard/HoldingsCard.js +2 -1
- package/lib/module/components/IconButton/IconButton.js +120 -130
- package/lib/module/components/IconCapsule/IconCapsule.js +60 -57
- package/lib/module/components/InputSearch/InputSearch.js +7 -3
- package/lib/module/components/LazyList/LazyList.js +2 -2
- package/lib/module/components/LinearMeter/LinearMeter.js +3 -2
- package/lib/module/components/ListGroup/ListGroup.js +2 -2
- package/lib/module/components/ListItem/ListItem.js +194 -146
- package/lib/module/components/MediaCard/MediaCard.js +4 -2
- package/lib/module/components/MerchantProfile/MerchantProfile.js +2 -1
- package/lib/module/components/MoneyValue/MoneyValue.js +2 -1
- package/lib/module/components/NavArrow/NavArrow.js +82 -58
- package/lib/module/components/NoteInput/NoteInput.js +2 -1
- package/lib/module/components/Nudge/Nudge.js +2 -2
- package/lib/module/components/Numpad/Numpad.js +2 -1
- package/lib/module/components/OTP/OTP.js +2 -2
- package/lib/module/components/PaymentFeedback/PaymentFeedback.js +2 -1
- package/lib/module/components/Popup/Popup.js +2 -1
- package/lib/module/components/ProductLabel/ProductLabel.js +2 -1
- package/lib/module/components/ProgressBadge/ProgressBadge.js +2 -1
- package/lib/module/components/RadioButton/RadioButton.js +2 -1
- package/lib/module/components/RechargeCard/RechargeCard.js +2 -1
- package/lib/module/components/Screen/Screen.js +2 -2
- package/lib/module/components/Section/Section.js +271 -159
- package/lib/module/components/SegmentedControl/SegmentedControl.js +3 -2
- package/lib/module/components/StatItem/StatItem.js +2 -1
- package/lib/module/components/StatusHero/StatusHero.js +2 -1
- package/lib/module/components/Stepper/Step.js +2 -1
- package/lib/module/components/Stepper/StepLabel.js +2 -1
- package/lib/module/components/Stepper/Stepper.js +2 -1
- package/lib/module/components/SupportText/SupportText.js +2 -1
- package/lib/module/components/SupportText/SupportTextIcon.js +2 -1
- package/lib/module/components/SwappableAmount/SwappableAmount.js +2 -1
- package/lib/module/components/Tabs/TabItem.js +2 -1
- package/lib/module/components/Tabs/Tabs.js +2 -1
- package/lib/module/components/Text/Text.js +2 -1
- package/lib/module/components/TextInput/TextInput.js +3 -3
- package/lib/module/components/ThreadHero/ThreadHero.js +2 -1
- package/lib/module/components/Title/Title.js +2 -1
- package/lib/module/components/Toast/Toast.js +2 -1
- package/lib/module/components/Toggle/Toggle.js +2 -1
- package/lib/module/components/Tooltip/Tooltip.js +2 -1
- package/lib/module/components/TransactionBubble/TransactionBubble.js +2 -2
- package/lib/module/components/TransactionDetails/TransactionDetails.js +3 -3
- package/lib/module/components/TransactionStatus/TransactionStatus.js +3 -2
- package/lib/module/components/UpiHandle/UpiHandle.js +147 -113
- package/lib/module/components/VStack/VStack.js +2 -2
- package/lib/module/design-tokens/figma-variables-resolver.js +21 -3
- package/lib/module/icons/registry.js +1 -1
- package/lib/module/utils/react-utils.js +16 -0
- package/lib/typescript/src/components/Avatar/Avatar.d.ts +11 -17
- package/lib/typescript/src/components/BottomNavItem/BottomNavItem.d.ts +12 -8
- package/lib/typescript/src/components/Button/Button.d.ts +18 -1
- package/lib/typescript/src/components/IconButton/IconButton.d.ts +12 -29
- package/lib/typescript/src/components/IconCapsule/IconCapsule.d.ts +10 -18
- package/lib/typescript/src/components/InputSearch/InputSearch.d.ts +8 -3
- package/lib/typescript/src/components/ListItem/ListItem.d.ts +14 -1
- package/lib/typescript/src/components/NavArrow/NavArrow.d.ts +12 -11
- package/lib/typescript/src/components/Section/Section.d.ts +2 -48
- package/lib/typescript/src/components/UpiHandle/UpiHandle.d.ts +13 -12
- package/lib/typescript/src/icons/registry.d.ts +1 -1
- package/lib/typescript/src/utils/react-utils.d.ts +15 -0
- package/package.json +4 -6
- package/src/components/Accordion/Accordion.tsx +2 -2
- package/src/components/ActionFooter/ActionFooter.tsx +2 -2
- package/src/components/ActionTile/ActionTile.tsx +2 -1
- package/src/components/AmountInput/AmountInput.tsx +2 -1
- package/src/components/AppBar/AppBar.tsx +2 -2
- package/src/components/Avatar/Avatar.tsx +229 -158
- package/src/components/AvatarGroup/AvatarGroup.tsx +2 -2
- package/src/components/Badge/Badge.tsx +2 -1
- package/src/components/Balance/Balance.tsx +2 -1
- package/src/components/BottomNav/BottomNav.tsx +2 -1
- package/src/components/BottomNavItem/BottomNavItem.tsx +159 -88
- package/src/components/Button/Button.tsx +228 -101
- package/src/components/ButtonGroup/ButtonGroup.tsx +2 -2
- package/src/components/Card/Card.tsx +2 -1
- package/src/components/CardCTA/CardCTA.tsx +2 -2
- package/src/components/CardProviderInfo/CardProviderInfo.tsx +2 -2
- package/src/components/Carousel/Carousel.tsx +3 -2
- package/src/components/Checkbox/Checkbox.tsx +2 -1
- package/src/components/ChipGroup/ChipGroup.tsx +2 -2
- package/src/components/ChipSelect/ChipSelect.tsx +2 -1
- package/src/components/DebitCard/DebitCard.tsx +2 -2
- package/src/components/Disclaimer/Disclaimer.tsx +2 -1
- package/src/components/Divider/Divider.tsx +2 -1
- package/src/components/Drawer/Drawer.tsx +2 -1
- package/src/components/EmptyState/EmptyState.tsx +2 -1
- package/src/components/FilterBar/FilterBar.tsx +2 -2
- package/src/components/Form/Form.tsx +2 -1
- package/src/components/FormField/FormField.tsx +3 -2
- package/src/components/HStack/HStack.tsx +2 -2
- package/src/components/HoldingsCard/HoldingsCard.tsx +2 -1
- package/src/components/IconButton/IconButton.tsx +154 -126
- package/src/components/IconCapsule/IconCapsule.tsx +73 -54
- package/src/components/InputSearch/InputSearch.tsx +19 -5
- package/src/components/LazyList/LazyList.tsx +2 -2
- package/src/components/LinearMeter/LinearMeter.tsx +3 -2
- package/src/components/ListGroup/ListGroup.tsx +2 -2
- package/src/components/ListItem/ListItem.tsx +257 -187
- package/src/components/MediaCard/MediaCard.tsx +2 -1
- package/src/components/MerchantProfile/MerchantProfile.tsx +2 -1
- package/src/components/MoneyValue/MoneyValue.tsx +2 -1
- package/src/components/NavArrow/NavArrow.tsx +91 -58
- package/src/components/NoteInput/NoteInput.tsx +2 -1
- package/src/components/Nudge/Nudge.tsx +2 -2
- package/src/components/Numpad/Numpad.tsx +2 -1
- package/src/components/OTP/OTP.tsx +2 -2
- package/src/components/PaymentFeedback/PaymentFeedback.tsx +2 -1
- package/src/components/Popup/Popup.tsx +2 -1
- package/src/components/ProductLabel/ProductLabel.tsx +2 -1
- package/src/components/ProgressBadge/ProgressBadge.tsx +2 -2
- package/src/components/RadioButton/RadioButton.tsx +2 -1
- package/src/components/RechargeCard/RechargeCard.tsx +2 -1
- package/src/components/Screen/Screen.tsx +2 -2
- package/src/components/Section/Section.tsx +323 -167
- package/src/components/SegmentedControl/SegmentedControl.tsx +3 -2
- package/src/components/StatItem/StatItem.tsx +2 -1
- package/src/components/StatusHero/StatusHero.tsx +2 -1
- package/src/components/Stepper/Step.tsx +2 -1
- package/src/components/Stepper/StepLabel.tsx +2 -1
- package/src/components/Stepper/Stepper.tsx +2 -1
- package/src/components/SupportText/SupportText.tsx +2 -1
- package/src/components/SupportText/SupportTextIcon.tsx +2 -1
- package/src/components/SwappableAmount/SwappableAmount.tsx +2 -1
- package/src/components/Tabs/TabItem.tsx +2 -1
- package/src/components/Tabs/Tabs.tsx +2 -1
- package/src/components/Text/Text.tsx +2 -1
- package/src/components/TextInput/TextInput.tsx +3 -3
- package/src/components/ThreadHero/ThreadHero.tsx +2 -1
- package/src/components/Title/Title.tsx +2 -1
- package/src/components/Toast/Toast.tsx +2 -1
- package/src/components/Toggle/Toggle.tsx +2 -1
- package/src/components/Tooltip/Tooltip.tsx +2 -1
- package/src/components/TransactionBubble/TransactionBubble.tsx +2 -2
- package/src/components/TransactionDetails/TransactionDetails.tsx +3 -3
- package/src/components/TransactionStatus/TransactionStatus.tsx +3 -2
- package/src/components/UpiHandle/UpiHandle.tsx +193 -125
- package/src/components/VStack/VStack.tsx +2 -2
- package/src/design-tokens/figma-variables-resolver.ts +21 -3
- package/src/icons/registry.ts +1 -1
- package/src/utils/react-utils.ts +16 -0
- package/lib/typescript/App.d.ts +0 -2
- package/lib/typescript/index.d.ts +0 -2
- package/lib/typescript/metro.config.d.ts +0 -78
- package/lib/typescript/react-native.config.d.ts +0 -4
|
@@ -13,76 +13,143 @@ var _reactUtils = require("../../utils/react-utils");
|
|
|
13
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
15
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
16
|
+
// Match Button: delay the press visual on iOS so a scroll-cancelled touch
|
|
17
|
+
// never applies the "pressed" style. See Button.tsx for the rationale.
|
|
18
|
+
const IS_WEB = _reactNative.Platform.OS === 'web';
|
|
19
|
+
const IS_IOS = _reactNative.Platform.OS === 'ios';
|
|
20
|
+
const HEADER_PRESS_DELAY = IS_IOS ? 130 : 0;
|
|
21
|
+
|
|
22
|
+
// Module-scope style constants — never re-allocated per render.
|
|
23
|
+
const headerWrapStyle = {
|
|
24
|
+
flexDirection: 'row',
|
|
25
|
+
alignItems: 'center',
|
|
26
|
+
justifyContent: 'space-between'
|
|
27
|
+
};
|
|
28
|
+
const headerHoverStyle = {
|
|
29
|
+
opacity: 0.95
|
|
30
|
+
};
|
|
31
|
+
const headerPressedStyle = {
|
|
32
|
+
opacity: 0.85
|
|
33
|
+
};
|
|
34
|
+
const headerFocusStyle = {
|
|
35
|
+
borderColor: '#222',
|
|
36
|
+
borderWidth: 1
|
|
37
|
+
};
|
|
38
|
+
|
|
16
39
|
// ---------------------------------------------------------------------------
|
|
17
|
-
// Shared grid layout: measures widest child
|
|
18
|
-
//
|
|
40
|
+
// Shared grid layout: measures the widest child once per item-count, then
|
|
41
|
+
// renders uniform-width cells laid out with `justify-content: space-between`.
|
|
42
|
+
// This preserves three visual invariants regardless of viewport width:
|
|
43
|
+
// 1. The first cell hugs the container's left edge.
|
|
44
|
+
// 2. The last cell hugs the container's right edge.
|
|
45
|
+
// 3. Cells in row N column K align with cells in row N+1 column K
|
|
46
|
+
// (uniform cell width across the whole grid).
|
|
47
|
+
// Pure flex sizing (e.g. `flexBasis: 0; flexGrow: 1`) cannot satisfy (1) and
|
|
48
|
+
// (2) on wide viewports — it distributes extra space inside each cell, which
|
|
49
|
+
// makes the icon+label content drift toward each cell's center and produces
|
|
50
|
+
// visible "dead" margins on the left and right of the grid.
|
|
51
|
+
//
|
|
52
|
+
// To avoid the blank-flash that the previous implementation suffered from
|
|
53
|
+
// (it hid the grid with `opacity: 0` until measurement completed, and reset
|
|
54
|
+
// every measurement when the item count changed):
|
|
55
|
+
// * Cells render at their *natural* widths during measurement instead of
|
|
56
|
+
// being hidden. With `space-between`, the first/last cells already hug
|
|
57
|
+
// the edges; only the column alignment can be off by a few pixels for
|
|
58
|
+
// the single frame between mount and the onLayout callback.
|
|
59
|
+
// * On item-count change (e.g. expand / collapse), we clear the per-cell
|
|
60
|
+
// samples but keep the rendered layout visible — we never blank out.
|
|
61
|
+
// * No 500ms safety timeout is needed because the grid is visible from the
|
|
62
|
+
// first frame.
|
|
19
63
|
// ---------------------------------------------------------------------------
|
|
20
64
|
const SLOT_GRID_MAX_COLUMNS = 4;
|
|
21
|
-
|
|
65
|
+
const slotGridRowStyle = {
|
|
66
|
+
flexDirection: 'row',
|
|
67
|
+
justifyContent: 'space-between'
|
|
68
|
+
};
|
|
69
|
+
const SlotGrid = /*#__PURE__*/_react.default.memo(function SlotGrid({
|
|
22
70
|
items,
|
|
23
71
|
gap,
|
|
24
72
|
maxColumns = SLOT_GRID_MAX_COLUMNS
|
|
25
73
|
}) {
|
|
74
|
+
const totalItems = items.length;
|
|
26
75
|
const [maxItemWidth, setMaxItemWidth] = (0, _react.useState)(null);
|
|
27
|
-
|
|
76
|
+
// Tracks the item-count that `maxItemWidth` corresponds to. When the
|
|
77
|
+
// current `totalItems` differs, the existing measurement is considered
|
|
78
|
+
// stale and cells fall back to natural widths until remeasurement.
|
|
79
|
+
const [measuredForCount, setMeasuredForCount] = (0, _react.useState)(0);
|
|
28
80
|
const itemWidthsRef = (0, _react.useRef)(new Map());
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
81
|
+
|
|
82
|
+
// Synchronously invalidate per-cell samples when the item count changes
|
|
83
|
+
// (e.g. show more / less). We deliberately do NOT touch `maxItemWidth` or
|
|
84
|
+
// `measuredForCount` state here — flipping them would force an extra render
|
|
85
|
+
// pass; instead we let the count mismatch (`measuredForCount !== totalItems`)
|
|
86
|
+
// gate the use of the stale value, and the next onLayout cycle will publish
|
|
87
|
+
// a fresh `maxItemWidth` for the new count.
|
|
88
|
+
const prevTotalRef = (0, _react.useRef)(totalItems);
|
|
89
|
+
if (prevTotalRef.current !== totalItems) {
|
|
90
|
+
prevTotalRef.current = totalItems;
|
|
91
|
+
itemWidthsRef.current = new Map();
|
|
92
|
+
}
|
|
40
93
|
const handleItemLayout = (0, _react.useCallback)((index, width) => {
|
|
41
|
-
itemWidthsRef.current
|
|
42
|
-
|
|
43
|
-
|
|
94
|
+
const widths = itemWidthsRef.current;
|
|
95
|
+
const previous = widths.get(index);
|
|
96
|
+
if (previous !== undefined && Math.abs(previous - width) < 0.5) return;
|
|
97
|
+
widths.set(index, width);
|
|
98
|
+
if (widths.size >= totalItems && totalItems > 0) {
|
|
99
|
+
let newMax = 0;
|
|
100
|
+
for (const w of widths.values()) {
|
|
101
|
+
if (w > newMax) newMax = w;
|
|
102
|
+
}
|
|
103
|
+
setMaxItemWidth(prev => prev !== null && Math.abs(prev - newMax) < 0.5 ? prev : newMax);
|
|
104
|
+
setMeasuredForCount(totalItems);
|
|
44
105
|
}
|
|
45
106
|
}, [totalItems]);
|
|
46
|
-
const
|
|
107
|
+
const hasFreshMeasurement = maxItemWidth !== null && measuredForCount === totalItems;
|
|
108
|
+
const cellWidth = hasFreshMeasurement ? maxItemWidth : undefined;
|
|
47
109
|
const columns = Math.min(maxColumns, totalItems || 1);
|
|
48
110
|
const rows = [];
|
|
49
111
|
for (let i = 0; i < items.length; i += columns) {
|
|
50
112
|
rows.push(items.slice(i, i + columns));
|
|
51
113
|
}
|
|
114
|
+
const containerStyle = (0, _react.useMemo)(() => ({
|
|
115
|
+
gap
|
|
116
|
+
}), [gap]);
|
|
117
|
+
const measuredCellStyle = (0, _react.useMemo)(() => cellWidth !== undefined ? {
|
|
118
|
+
width: cellWidth
|
|
119
|
+
} : undefined, [cellWidth]);
|
|
52
120
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
53
|
-
style:
|
|
54
|
-
gap,
|
|
55
|
-
...(isMeasured || measureTimedOut ? {} : {
|
|
56
|
-
opacity: 0
|
|
57
|
-
})
|
|
58
|
-
},
|
|
121
|
+
style: containerStyle,
|
|
59
122
|
children: rows.map((row, rowIndex) => {
|
|
60
123
|
const spacersNeeded = row.length < columns ? columns - row.length : 0;
|
|
61
124
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
62
|
-
style:
|
|
63
|
-
flexDirection: 'row',
|
|
64
|
-
justifyContent: 'space-between'
|
|
65
|
-
},
|
|
125
|
+
style: slotGridRowStyle,
|
|
66
126
|
children: [row.map((child, colIndex) => {
|
|
67
127
|
const itemIndex = rowIndex * columns + colIndex;
|
|
68
128
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
69
|
-
onLayout:
|
|
70
|
-
style:
|
|
71
|
-
width: maxItemWidth
|
|
72
|
-
} : undefined,
|
|
129
|
+
onLayout: hasFreshMeasurement ? undefined : e => handleItemLayout(itemIndex, e.nativeEvent.layout.width),
|
|
130
|
+
style: measuredCellStyle,
|
|
73
131
|
children: child
|
|
74
132
|
}, itemIndex);
|
|
75
|
-
}),
|
|
133
|
+
}), hasFreshMeasurement && spacersNeeded > 0 && Array.from({
|
|
76
134
|
length: spacersNeeded
|
|
77
135
|
}, (_, i) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
78
|
-
style:
|
|
79
|
-
width: maxItemWidth
|
|
80
|
-
}
|
|
136
|
+
style: measuredCellStyle
|
|
81
137
|
}, `spacer-${i}`))]
|
|
82
138
|
}, rowIndex);
|
|
83
139
|
})
|
|
84
140
|
});
|
|
141
|
+
}, slotGridPropsAreEqual);
|
|
142
|
+
function slotGridPropsAreEqual(prev, next) {
|
|
143
|
+
if (prev.gap !== next.gap) return false;
|
|
144
|
+
if ((prev.maxColumns ?? SLOT_GRID_MAX_COLUMNS) !== (next.maxColumns ?? SLOT_GRID_MAX_COLUMNS)) return false;
|
|
145
|
+
if (prev.items === next.items) return true;
|
|
146
|
+
if (prev.items.length !== next.items.length) return false;
|
|
147
|
+
for (let i = 0; i < prev.items.length; i++) {
|
|
148
|
+
if (prev.items[i] !== next.items[i]) return false;
|
|
149
|
+
}
|
|
150
|
+
return true;
|
|
85
151
|
}
|
|
152
|
+
|
|
86
153
|
/**
|
|
87
154
|
* Section component that mirrors the Figma "Section" component.
|
|
88
155
|
*
|
|
@@ -107,96 +174,99 @@ function SlotGrid({
|
|
|
107
174
|
* @param {string} [props.accessibilityLabel] - Accessibility label for the section. If not provided, uses title
|
|
108
175
|
* @param {string} [props.accessibilityHint] - Additional accessibility hint for screen readers
|
|
109
176
|
*/
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
supportText = 'Section support text',
|
|
113
|
-
showSupportText = true,
|
|
114
|
-
slot,
|
|
115
|
-
slotDirection = 'row',
|
|
116
|
-
modes = {},
|
|
117
|
-
onPress,
|
|
118
|
-
style,
|
|
119
|
-
accessibilityLabel,
|
|
120
|
-
accessibilityHint,
|
|
121
|
-
webAccessibilityProps,
|
|
122
|
-
...rest
|
|
123
|
-
}) {
|
|
124
|
-
const [isHeaderFocused, setIsHeaderFocused] = (0, _react.useState)(false);
|
|
125
|
-
const [isHeaderHovered, setIsHeaderHovered] = (0, _react.useState)(false);
|
|
126
|
-
const [isHeaderPressed, setIsHeaderPressed] = (0, _react.useState)(false);
|
|
127
|
-
const headerFocusStyle = isHeaderFocused ? {
|
|
128
|
-
borderColor: '#222',
|
|
129
|
-
borderWidth: 1
|
|
130
|
-
} : {};
|
|
131
|
-
const headerHoverStyle = isHeaderHovered ? {
|
|
132
|
-
opacity: 0.95
|
|
133
|
-
} : {};
|
|
134
|
-
const headerPressedStyle = isHeaderPressed ? {
|
|
135
|
-
opacity: 0.85
|
|
136
|
-
} : {};
|
|
137
|
-
// Resolve section container tokens
|
|
177
|
+
|
|
178
|
+
function resolveSectionTokens(modes) {
|
|
138
179
|
const backgroundColor = (0, _figmaVariablesResolver.getVariableByName)('section/background/color', modes) || '#ffffff';
|
|
139
180
|
const sectionGap = (0, _figmaVariablesResolver.getVariableByName)('section/gap', modes) || 12;
|
|
140
181
|
const slotGap = (0, _figmaVariablesResolver.getVariableByName)('slot/gap', modes) || 12;
|
|
141
182
|
const paddingHorizontal = (0, _figmaVariablesResolver.getVariableByName)('section/padding/horizontal', modes) || 12;
|
|
142
183
|
const paddingVertical = (0, _figmaVariablesResolver.getVariableByName)('section/padding/vertical', modes) || 16;
|
|
143
184
|
const radius = (0, _figmaVariablesResolver.getVariableByName)('section/radius', modes) || 12;
|
|
144
|
-
|
|
145
|
-
// Resolve section header tokens
|
|
146
185
|
const headerGap = (0, _figmaVariablesResolver.getVariableByName)('section/header/gap', modes) || 8;
|
|
147
186
|
const headerPaddingHorizontal = (0, _figmaVariablesResolver.getVariableByName)('section/header/padding/horizontal', modes) || 0;
|
|
148
187
|
const headerPaddingVertical = (0, _figmaVariablesResolver.getVariableByName)('section/header/padding/vertical', modes) || 0;
|
|
149
|
-
|
|
150
|
-
// Resolve section title tokens
|
|
151
188
|
const titleColor = (0, _figmaVariablesResolver.getVariableByName)('section/title/color', modes) || '#0f0d0a';
|
|
152
189
|
const titleFontSize = (0, _figmaVariablesResolver.getVariableByName)('section/title/fontSize', modes) || 18;
|
|
153
190
|
const titleLineHeight = (0, _figmaVariablesResolver.getVariableByName)('section/title/lineHeight', modes) || 20;
|
|
154
191
|
const titleFontFamily = (0, _figmaVariablesResolver.getVariableByName)('section/title/fontFamily', modes) || 'System';
|
|
155
192
|
const titleFontWeightRaw = (0, _figmaVariablesResolver.getVariableByName)('section/title/fontWeight', modes) || 800;
|
|
156
193
|
const titleFontWeight = typeof titleFontWeightRaw === 'number' ? titleFontWeightRaw.toString() : titleFontWeightRaw;
|
|
157
|
-
|
|
158
|
-
// Resolve section support text tokens
|
|
159
194
|
const supportTextColor = (0, _figmaVariablesResolver.getVariableByName)('section/supportText/color', modes) || '#1f1a14';
|
|
160
195
|
const supportTextFontSize = (0, _figmaVariablesResolver.getVariableByName)('section/supportText/fontSize', modes) || 14;
|
|
161
196
|
const supportTextLineHeight = (0, _figmaVariablesResolver.getVariableByName)('section/supportText/lineHeight', modes) || 18;
|
|
162
197
|
const supportTextFontFamily = (0, _figmaVariablesResolver.getVariableByName)('section/supportText/fontFamily', modes) || 'System';
|
|
163
198
|
const supportTextFontWeightRaw = (0, _figmaVariablesResolver.getVariableByName)('section/supportText/fontWeight', modes) || 500;
|
|
164
199
|
const supportTextFontWeight = typeof supportTextFontWeightRaw === 'number' ? supportTextFontWeightRaw.toString() : supportTextFontWeightRaw;
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
fontWeight: supportTextFontWeight
|
|
200
|
+
return {
|
|
201
|
+
containerStyle: {
|
|
202
|
+
backgroundColor,
|
|
203
|
+
paddingHorizontal,
|
|
204
|
+
paddingVertical,
|
|
205
|
+
borderRadius: radius,
|
|
206
|
+
gap: sectionGap
|
|
207
|
+
},
|
|
208
|
+
headerStyle: {
|
|
209
|
+
paddingHorizontal: headerPaddingHorizontal,
|
|
210
|
+
paddingVertical: headerPaddingVertical,
|
|
211
|
+
gap: headerGap
|
|
212
|
+
},
|
|
213
|
+
titleStyle: {
|
|
214
|
+
flex: 1,
|
|
215
|
+
color: titleColor,
|
|
216
|
+
fontSize: titleFontSize,
|
|
217
|
+
lineHeight: titleLineHeight,
|
|
218
|
+
fontFamily: titleFontFamily,
|
|
219
|
+
fontWeight: titleFontWeight
|
|
220
|
+
},
|
|
221
|
+
supportTextStyle: {
|
|
222
|
+
color: supportTextColor,
|
|
223
|
+
fontSize: supportTextFontSize,
|
|
224
|
+
lineHeight: supportTextLineHeight,
|
|
225
|
+
fontFamily: supportTextFontFamily,
|
|
226
|
+
fontWeight: supportTextFontWeight
|
|
227
|
+
},
|
|
228
|
+
sectionGap,
|
|
229
|
+
slotGap
|
|
196
230
|
};
|
|
231
|
+
}
|
|
232
|
+
function Section({
|
|
233
|
+
title = 'Section title',
|
|
234
|
+
supportText = 'Section support text',
|
|
235
|
+
showSupportText = true,
|
|
236
|
+
slot,
|
|
237
|
+
slotDirection = 'row',
|
|
238
|
+
modes = _reactUtils.EMPTY_MODES,
|
|
239
|
+
onPress,
|
|
240
|
+
style,
|
|
241
|
+
// accessibilityLabel is intentionally accepted on the type for API
|
|
242
|
+
// back-compat, but the inner Pressable/View deliberately pass
|
|
243
|
+
// `accessibilityLabel={undefined}` (the title Text carries the label
|
|
244
|
+
// instead). Prefix to satisfy the unused-var lint while keeping the prop
|
|
245
|
+
// shape unchanged.
|
|
246
|
+
accessibilityLabel: _accessibilityLabel,
|
|
247
|
+
accessibilityHint,
|
|
248
|
+
webAccessibilityProps,
|
|
249
|
+
...rest
|
|
250
|
+
}) {
|
|
251
|
+
// Focus and hover are still mirrored in React because they are visible,
|
|
252
|
+
// sustained states (web-only in practice). The setters are gated so they
|
|
253
|
+
// never fire on native — keeping the component render-free during touch.
|
|
254
|
+
// Press is handled imperatively via the `Pressable` style callback so a
|
|
255
|
+
// scroll-cancelled touch never schedules a React render.
|
|
256
|
+
const [isHeaderFocused, setIsHeaderFocused] = (0, _react.useState)(false);
|
|
257
|
+
const [isHeaderHovered, setIsHeaderHovered] = (0, _react.useState)(false);
|
|
197
258
|
|
|
198
|
-
//
|
|
199
|
-
|
|
259
|
+
// Mirror user handlers in a ref so our wrappers can stay referentially
|
|
260
|
+
// stable. Without this, every parent re-render would hand Pressable fresh
|
|
261
|
+
// function identities and re-bind every event.
|
|
262
|
+
const userHandlersRef = (0, _react.useRef)({});
|
|
263
|
+
userHandlersRef.current.onPressIn = rest?.onPressIn;
|
|
264
|
+
userHandlersRef.current.onPressOut = rest?.onPressOut;
|
|
265
|
+
userHandlersRef.current.onHoverIn = rest?.onHoverIn;
|
|
266
|
+
userHandlersRef.current.onHoverOut = rest?.onHoverOut;
|
|
267
|
+
userHandlersRef.current.onFocus = rest?.onFocus;
|
|
268
|
+
userHandlersRef.current.onBlur = rest?.onBlur;
|
|
269
|
+
const tokens = (0, _react.useMemo)(() => resolveSectionTokens(modes), [modes]);
|
|
200
270
|
|
|
201
271
|
// Get web platform support props (only used when onPress is defined)
|
|
202
272
|
const webProps = (0, _webPlatformUtils.usePressableWebSupport)({
|
|
@@ -210,7 +280,7 @@ function Section({
|
|
|
210
280
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
211
281
|
style: headerWrapStyle,
|
|
212
282
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
213
|
-
style: titleStyle,
|
|
283
|
+
style: tokens.titleStyle,
|
|
214
284
|
numberOfLines: 1,
|
|
215
285
|
accessibilityElementsHidden: true,
|
|
216
286
|
importantForAccessibility: "no",
|
|
@@ -220,16 +290,49 @@ function Section({
|
|
|
220
290
|
modes: modes
|
|
221
291
|
})]
|
|
222
292
|
}), showSupportText && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
223
|
-
style: supportTextStyle,
|
|
293
|
+
style: tokens.supportTextStyle,
|
|
224
294
|
numberOfLines: 2,
|
|
225
295
|
accessibilityElementsHidden: true,
|
|
226
296
|
importantForAccessibility: "no",
|
|
227
297
|
children: supportText
|
|
228
298
|
})]
|
|
229
299
|
});
|
|
300
|
+
|
|
301
|
+
// Stable handler identities. User handlers are read through the ref so
|
|
302
|
+
// these wrappers don't need new identities each render.
|
|
303
|
+
const handlePressIn = (0, _react.useCallback)(e => {
|
|
304
|
+
userHandlersRef.current.onPressIn?.(e);
|
|
305
|
+
}, []);
|
|
306
|
+
const handlePressOut = (0, _react.useCallback)(e => {
|
|
307
|
+
userHandlersRef.current.onPressOut?.(e);
|
|
308
|
+
}, []);
|
|
309
|
+
const handleHoverIn = (0, _react.useCallback)(e => {
|
|
310
|
+
if (IS_WEB) setIsHeaderHovered(true);
|
|
311
|
+
userHandlersRef.current.onHoverIn?.(e);
|
|
312
|
+
}, []);
|
|
313
|
+
const handleHoverOut = (0, _react.useCallback)(e => {
|
|
314
|
+
if (IS_WEB) setIsHeaderHovered(false);
|
|
315
|
+
userHandlersRef.current.onHoverOut?.(e);
|
|
316
|
+
}, []);
|
|
317
|
+
const handleFocus = (0, _react.useCallback)(e => {
|
|
318
|
+
if (IS_WEB) setIsHeaderFocused(true);
|
|
319
|
+
userHandlersRef.current.onFocus?.(e);
|
|
320
|
+
}, []);
|
|
321
|
+
const handleBlur = (0, _react.useCallback)(e => {
|
|
322
|
+
if (IS_WEB) setIsHeaderFocused(false);
|
|
323
|
+
userHandlersRef.current.onBlur?.(e);
|
|
324
|
+
}, []);
|
|
325
|
+
|
|
326
|
+
// The pressed visual is applied by the host view directly through the
|
|
327
|
+
// Pressable style callback — no React render is scheduled. We still want
|
|
328
|
+
// the (constant) hover style on web so we keep it in the array.
|
|
329
|
+
const headerStyleCallback = (0, _react.useCallback)(({
|
|
330
|
+
pressed
|
|
331
|
+
}) => [tokens.headerStyle, pressed ? headerPressedStyle : null, isHeaderHovered ? headerHoverStyle : null, isHeaderFocused ? headerFocusStyle : null], [tokens.headerStyle, isHeaderHovered, isHeaderFocused]);
|
|
332
|
+
const containerStyleArray = (0, _react.useMemo)(() => [tokens.containerStyle, style], [tokens.containerStyle, style]);
|
|
230
333
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
231
|
-
style:
|
|
232
|
-
...(
|
|
334
|
+
style: containerStyleArray,
|
|
335
|
+
...(IS_WEB ? {
|
|
233
336
|
accessibilityRole: 'region'
|
|
234
337
|
} : undefined),
|
|
235
338
|
accessibilityLabel: undefined,
|
|
@@ -238,52 +341,59 @@ function Section({
|
|
|
238
341
|
children: [onPress ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
|
|
239
342
|
accessibilityRole: "button",
|
|
240
343
|
accessibilityLabel: undefined,
|
|
241
|
-
accessibilityHint: accessibilityHint ||
|
|
344
|
+
accessibilityHint: accessibilityHint || 'Opens section details',
|
|
242
345
|
onPress: onPress,
|
|
243
|
-
onPressIn:
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
onFocus: e => {
|
|
252
|
-
setIsHeaderFocused(true);
|
|
253
|
-
rest?.onFocus?.(e);
|
|
254
|
-
},
|
|
255
|
-
onBlur: e => {
|
|
256
|
-
setIsHeaderFocused(false);
|
|
257
|
-
rest?.onBlur?.(e);
|
|
258
|
-
},
|
|
259
|
-
onHoverIn: e => {
|
|
260
|
-
setIsHeaderHovered(true);
|
|
261
|
-
rest?.onHoverIn?.(e);
|
|
262
|
-
},
|
|
263
|
-
onHoverOut: e => {
|
|
264
|
-
setIsHeaderHovered(false);
|
|
265
|
-
rest?.onHoverOut?.(e);
|
|
266
|
-
},
|
|
267
|
-
style: ({
|
|
268
|
-
pressed
|
|
269
|
-
}) => [headerStyle, pressed ? headerPressedStyle : null, headerHoverStyle, headerFocusStyle],
|
|
346
|
+
onPressIn: handlePressIn,
|
|
347
|
+
onPressOut: handlePressOut,
|
|
348
|
+
onFocus: handleFocus,
|
|
349
|
+
onBlur: handleBlur,
|
|
350
|
+
onHoverIn: handleHoverIn,
|
|
351
|
+
onHoverOut: handleHoverOut,
|
|
352
|
+
unstable_pressDelay: HEADER_PRESS_DELAY,
|
|
353
|
+
style: headerStyleCallback,
|
|
270
354
|
...webProps,
|
|
271
355
|
children: headerContent
|
|
272
356
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
273
|
-
style: headerStyle,
|
|
357
|
+
style: tokens.headerStyle,
|
|
274
358
|
children: headerContent
|
|
275
|
-
}), slot &&
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
gap: slotGap
|
|
282
|
-
},
|
|
283
|
-
children: (0, _reactUtils.cloneChildrenWithModes)((0, _reactUtils.flattenChildren)(slot), modes)
|
|
359
|
+
}), slot && /*#__PURE__*/(0, _jsxRuntime.jsx)(SectionSlot, {
|
|
360
|
+
slot: slot,
|
|
361
|
+
modes: modes,
|
|
362
|
+
direction: slotDirection,
|
|
363
|
+
rowGap: tokens.sectionGap,
|
|
364
|
+
columnGap: tokens.slotGap
|
|
284
365
|
})]
|
|
285
366
|
});
|
|
286
367
|
}
|
|
368
|
+
/**
|
|
369
|
+
* Internal helper that processes the slot children once per (slot, modes) pair
|
|
370
|
+
* and dispatches to the row (SlotGrid) or column layout. Splitting this out of
|
|
371
|
+
* `Section` lets the parent re-render (e.g. for header press/hover state)
|
|
372
|
+
* without re-walking the slot tree via `cloneChildrenWithModes`.
|
|
373
|
+
*/
|
|
374
|
+
function SectionSlot({
|
|
375
|
+
slot,
|
|
376
|
+
modes,
|
|
377
|
+
direction,
|
|
378
|
+
rowGap,
|
|
379
|
+
columnGap
|
|
380
|
+
}) {
|
|
381
|
+
const processed = (0, _react.useMemo)(() => (0, _reactUtils.cloneChildrenWithModes)((0, _reactUtils.flattenChildren)(slot), modes), [slot, modes]);
|
|
382
|
+
const columnContainerStyle = (0, _react.useMemo)(() => ({
|
|
383
|
+
flexDirection: 'column',
|
|
384
|
+
gap: columnGap
|
|
385
|
+
}), [columnGap]);
|
|
386
|
+
if (direction === 'row') {
|
|
387
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(SlotGrid, {
|
|
388
|
+
items: processed,
|
|
389
|
+
gap: rowGap
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
393
|
+
style: columnContainerStyle,
|
|
394
|
+
children: processed
|
|
395
|
+
});
|
|
396
|
+
}
|
|
287
397
|
/**
|
|
288
398
|
* Section.Bento component that mirrors the Figma "Section.Bento" component.
|
|
289
399
|
*
|
|
@@ -306,12 +416,17 @@ function Section({
|
|
|
306
416
|
* @param {string} [props.accessibilityLabel] - Accessibility label for the section
|
|
307
417
|
* @param {string} [props.accessibilityHint] - Additional accessibility hint for screen readers
|
|
308
418
|
*/
|
|
419
|
+
const sectionBentoUpiRowStyle = {
|
|
420
|
+
flexDirection: 'row',
|
|
421
|
+
gap: 8
|
|
422
|
+
};
|
|
309
423
|
function SectionBento({
|
|
310
424
|
navSlot,
|
|
311
425
|
upiSlot,
|
|
312
|
-
modes =
|
|
426
|
+
modes = _reactUtils.EMPTY_MODES,
|
|
313
427
|
style,
|
|
314
|
-
|
|
428
|
+
// Same rationale as Section: accepted on the type but unused internally.
|
|
429
|
+
accessibilityLabel: _accessibilityLabel,
|
|
315
430
|
accessibilityHint,
|
|
316
431
|
...rest
|
|
317
432
|
}) {
|
|
@@ -321,15 +436,15 @@ function SectionBento({
|
|
|
321
436
|
const paddingHorizontal = (0, _figmaVariablesResolver.getVariableByName)('section/padding/horizontal', modes) || 12;
|
|
322
437
|
const paddingVertical = (0, _figmaVariablesResolver.getVariableByName)('section/padding/vertical', modes) || 16;
|
|
323
438
|
const radius = (0, _figmaVariablesResolver.getVariableByName)('section/radius', modes) || 12;
|
|
324
|
-
const containerStyle = {
|
|
439
|
+
const containerStyle = (0, _react.useMemo)(() => ({
|
|
325
440
|
backgroundColor,
|
|
326
441
|
paddingHorizontal,
|
|
327
442
|
paddingVertical,
|
|
328
443
|
borderRadius: radius,
|
|
329
444
|
gap
|
|
330
|
-
};
|
|
331
|
-
const processedNavSlot = navSlot ? (0, _reactUtils.cloneChildrenWithModes)((0, _reactUtils.flattenChildren)(navSlot), modes) : null;
|
|
332
|
-
const processedUpiSlot = upiSlot ? (0, _reactUtils.cloneChildrenWithModes)((0, _reactUtils.flattenChildren)(upiSlot), modes) : null;
|
|
445
|
+
}), [backgroundColor, paddingHorizontal, paddingVertical, radius, gap]);
|
|
446
|
+
const processedNavSlot = (0, _react.useMemo)(() => navSlot ? (0, _reactUtils.cloneChildrenWithModes)((0, _reactUtils.flattenChildren)(navSlot), modes) : null, [navSlot, modes]);
|
|
447
|
+
const processedUpiSlot = (0, _react.useMemo)(() => upiSlot ? (0, _reactUtils.cloneChildrenWithModes)((0, _reactUtils.flattenChildren)(upiSlot), modes) : null, [upiSlot, modes]);
|
|
333
448
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
334
449
|
style: [containerStyle, style],
|
|
335
450
|
...(_reactNative.Platform.OS === 'web' ? {
|
|
@@ -342,10 +457,7 @@ function SectionBento({
|
|
|
342
457
|
items: processedNavSlot,
|
|
343
458
|
gap: gap
|
|
344
459
|
}), processedUpiSlot && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
345
|
-
style:
|
|
346
|
-
flexDirection: 'row',
|
|
347
|
-
gap: 8
|
|
348
|
-
},
|
|
460
|
+
style: sectionBentoUpiRowStyle,
|
|
349
461
|
children: processedUpiSlot
|
|
350
462
|
})]
|
|
351
463
|
});
|
|
@@ -7,13 +7,14 @@ exports.default = void 0;
|
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
9
|
var _figmaVariablesResolver = require("../../design-tokens/figma-variables-resolver");
|
|
10
|
+
var _reactUtils = require("../../utils/react-utils");
|
|
10
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
12
|
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); }
|
|
12
13
|
function SegmentedControlSegment({
|
|
13
14
|
label,
|
|
14
15
|
active,
|
|
15
16
|
onPress,
|
|
16
|
-
modes =
|
|
17
|
+
modes = _reactUtils.EMPTY_MODES
|
|
17
18
|
}) {
|
|
18
19
|
const resolvedModes = {
|
|
19
20
|
...modes,
|
|
@@ -94,7 +95,7 @@ function SegmentedControl({
|
|
|
94
95
|
selectedKey: controlledSelectedKey,
|
|
95
96
|
defaultSelectedKey,
|
|
96
97
|
onSelectionChange,
|
|
97
|
-
modes =
|
|
98
|
+
modes = _reactUtils.EMPTY_MODES,
|
|
98
99
|
style
|
|
99
100
|
}) {
|
|
100
101
|
const isControlled = controlledSelectedKey !== undefined;
|
|
@@ -7,6 +7,7 @@ exports.default = void 0;
|
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
9
|
var _figmaVariablesResolver = require("../../design-tokens/figma-variables-resolver");
|
|
10
|
+
var _reactUtils = require("../../utils/react-utils");
|
|
10
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
13
|
/**
|
|
@@ -19,7 +20,7 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
19
20
|
function StatItem({
|
|
20
21
|
label = 'Purity verified by NABL',
|
|
21
22
|
value = '99.99%',
|
|
22
|
-
modes =
|
|
23
|
+
modes = _reactUtils.EMPTY_MODES,
|
|
23
24
|
style
|
|
24
25
|
}) {
|
|
25
26
|
const gap = (0, _figmaVariablesResolver.getVariableByName)('statItem/gap', modes) ?? 2;
|
|
@@ -10,6 +10,7 @@ var _figmaVariablesResolver = require("../../design-tokens/figma-variables-resol
|
|
|
10
10
|
var _JFSThemeProvider = require("../../design-tokens/JFSThemeProvider");
|
|
11
11
|
var _IconCapsule = _interopRequireDefault(require("../IconCapsule/IconCapsule"));
|
|
12
12
|
var _MoneyValue = _interopRequireDefault(require("../MoneyValue/MoneyValue"));
|
|
13
|
+
var _reactUtils = require("../../utils/react-utils");
|
|
13
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
15
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
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); }
|
|
@@ -41,7 +42,7 @@ function StatusHero({
|
|
|
41
42
|
iconName = 'ic_confirm',
|
|
42
43
|
value = '50',
|
|
43
44
|
currency = 'INR',
|
|
44
|
-
modes: propModes =
|
|
45
|
+
modes: propModes = _reactUtils.EMPTY_MODES,
|
|
45
46
|
style
|
|
46
47
|
}) {
|
|
47
48
|
const {
|
|
@@ -9,12 +9,13 @@ var _reactNative = require("react-native");
|
|
|
9
9
|
var _reactNativeSvg = _interopRequireWildcard(require("react-native-svg"));
|
|
10
10
|
var _figmaVariablesResolver = require("../../design-tokens/figma-variables-resolver");
|
|
11
11
|
var _StepLabel = require("./StepLabel");
|
|
12
|
+
var _reactUtils = require("../../utils/react-utils");
|
|
12
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
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); }
|
|
14
15
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
16
|
function Step({
|
|
16
17
|
children,
|
|
17
|
-
modes =
|
|
18
|
+
modes = _reactUtils.EMPTY_MODES,
|
|
18
19
|
style,
|
|
19
20
|
index = 0,
|
|
20
21
|
connectorStyle,
|
|
@@ -7,12 +7,13 @@ exports.StepLabel = StepLabel;
|
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
9
|
var _figmaVariablesResolver = require("../../design-tokens/figma-variables-resolver");
|
|
10
|
+
var _reactUtils = require("../../utils/react-utils");
|
|
10
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
13
|
function StepLabel({
|
|
13
14
|
title = 'Stepper Item',
|
|
14
15
|
supportingText,
|
|
15
|
-
modes =
|
|
16
|
+
modes = _reactUtils.EMPTY_MODES,
|
|
16
17
|
style
|
|
17
18
|
}) {
|
|
18
19
|
// Title styles
|