jfs-components 0.0.62 → 0.0.64

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (255) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/lib/commonjs/components/Accordion/Accordion.js +1 -1
  3. package/lib/commonjs/components/ActionFooter/ActionFooter.js +1 -1
  4. package/lib/commonjs/components/ActionTile/ActionTile.js +2 -1
  5. package/lib/commonjs/components/AmountInput/AmountInput.js +2 -1
  6. package/lib/commonjs/components/AppBar/AppBar.js +1 -1
  7. package/lib/commonjs/components/Avatar/Avatar.js +184 -162
  8. package/lib/commonjs/components/AvatarGroup/AvatarGroup.js +1 -1
  9. package/lib/commonjs/components/Badge/Badge.js +2 -1
  10. package/lib/commonjs/components/Balance/Balance.js +2 -1
  11. package/lib/commonjs/components/BottomNav/BottomNav.js +2 -1
  12. package/lib/commonjs/components/BottomNavItem/BottomNavItem.js +106 -86
  13. package/lib/commonjs/components/Button/Button.js +190 -93
  14. package/lib/commonjs/components/ButtonGroup/ButtonGroup.js +1 -1
  15. package/lib/commonjs/components/Card/Card.js +2 -1
  16. package/lib/commonjs/components/CardCTA/CardCTA.js +1 -1
  17. package/lib/commonjs/components/CardProviderInfo/CardProviderInfo.js +1 -1
  18. package/lib/commonjs/components/Carousel/Carousel.js +3 -2
  19. package/lib/commonjs/components/Checkbox/Checkbox.js +2 -1
  20. package/lib/commonjs/components/ChipGroup/ChipGroup.js +1 -1
  21. package/lib/commonjs/components/ChipSelect/ChipSelect.js +2 -1
  22. package/lib/commonjs/components/DebitCard/DebitCard.js +1 -1
  23. package/lib/commonjs/components/Disclaimer/Disclaimer.js +2 -1
  24. package/lib/commonjs/components/Divider/Divider.js +2 -1
  25. package/lib/commonjs/components/Drawer/Drawer.js +109 -48
  26. package/lib/commonjs/components/EmptyState/EmptyState.js +2 -1
  27. package/lib/commonjs/components/FilterBar/FilterBar.js +1 -1
  28. package/lib/commonjs/components/Form/Form.js +2 -1
  29. package/lib/commonjs/components/FormField/FormField.js +3 -2
  30. package/lib/commonjs/components/HStack/HStack.js +1 -1
  31. package/lib/commonjs/components/HoldingsCard/HoldingsCard.js +2 -1
  32. package/lib/commonjs/components/IconButton/IconButton.js +118 -128
  33. package/lib/commonjs/components/IconCapsule/IconCapsule.js +61 -57
  34. package/lib/commonjs/components/InputSearch/InputSearch.js +7 -3
  35. package/lib/commonjs/components/LazyList/LazyList.js +1 -1
  36. package/lib/commonjs/components/LinearMeter/LinearMeter.js +3 -2
  37. package/lib/commonjs/components/ListGroup/ListGroup.js +1 -1
  38. package/lib/commonjs/components/ListItem/ListItem.js +190 -142
  39. package/lib/commonjs/components/MediaCard/MediaCard.js +3 -3
  40. package/lib/commonjs/components/MerchantProfile/MerchantProfile.js +2 -1
  41. package/lib/commonjs/components/MoneyValue/MoneyValue.js +2 -1
  42. package/lib/commonjs/components/NavArrow/NavArrow.js +82 -59
  43. package/lib/commonjs/components/NoteInput/NoteInput.js +2 -1
  44. package/lib/commonjs/components/Nudge/Nudge.js +1 -1
  45. package/lib/commonjs/components/Numpad/Numpad.js +2 -1
  46. package/lib/commonjs/components/OTP/OTP.js +1 -1
  47. package/lib/commonjs/components/PaymentFeedback/PaymentFeedback.js +2 -1
  48. package/lib/commonjs/components/Popup/Popup.js +2 -1
  49. package/lib/commonjs/components/ProductLabel/ProductLabel.js +2 -1
  50. package/lib/commonjs/components/ProgressBadge/ProgressBadge.js +2 -1
  51. package/lib/commonjs/components/RadioButton/RadioButton.js +2 -1
  52. package/lib/commonjs/components/RechargeCard/RechargeCard.js +2 -1
  53. package/lib/commonjs/components/Screen/Screen.js +1 -1
  54. package/lib/commonjs/components/Section/Section.js +500 -166
  55. package/lib/commonjs/components/SegmentedControl/SegmentedControl.js +3 -2
  56. package/lib/commonjs/components/StatItem/StatItem.js +2 -1
  57. package/lib/commonjs/components/StatusHero/StatusHero.js +2 -1
  58. package/lib/commonjs/components/Stepper/Step.js +2 -1
  59. package/lib/commonjs/components/Stepper/StepLabel.js +2 -1
  60. package/lib/commonjs/components/Stepper/Stepper.js +2 -1
  61. package/lib/commonjs/components/SupportText/SupportText.js +2 -1
  62. package/lib/commonjs/components/SupportText/SupportTextIcon.js +2 -1
  63. package/lib/commonjs/components/SwappableAmount/SwappableAmount.js +2 -1
  64. package/lib/commonjs/components/Tabs/TabItem.js +2 -1
  65. package/lib/commonjs/components/Tabs/Tabs.js +2 -1
  66. package/lib/commonjs/components/Text/Text.js +2 -1
  67. package/lib/commonjs/components/TextInput/TextInput.js +2 -2
  68. package/lib/commonjs/components/ThreadHero/ThreadHero.js +2 -1
  69. package/lib/commonjs/components/Title/Title.js +2 -1
  70. package/lib/commonjs/components/Toast/Toast.js +2 -1
  71. package/lib/commonjs/components/Toggle/Toggle.js +2 -1
  72. package/lib/commonjs/components/Tooltip/Tooltip.js +2 -1
  73. package/lib/commonjs/components/TransactionBubble/TransactionBubble.js +1 -1
  74. package/lib/commonjs/components/TransactionDetails/TransactionDetails.js +2 -2
  75. package/lib/commonjs/components/TransactionStatus/TransactionStatus.js +3 -2
  76. package/lib/commonjs/components/UpiHandle/UpiHandle.js +144 -110
  77. package/lib/commonjs/components/VStack/VStack.js +1 -1
  78. package/lib/commonjs/design-tokens/figma-variables-resolver.js +21 -3
  79. package/lib/commonjs/icons/registry.js +1 -1
  80. package/lib/commonjs/utils/react-utils.js +17 -0
  81. package/lib/module/components/Accordion/Accordion.js +2 -2
  82. package/lib/module/components/ActionFooter/ActionFooter.js +2 -2
  83. package/lib/module/components/ActionTile/ActionTile.js +2 -1
  84. package/lib/module/components/AmountInput/AmountInput.js +2 -1
  85. package/lib/module/components/AppBar/AppBar.js +2 -2
  86. package/lib/module/components/Avatar/Avatar.js +184 -162
  87. package/lib/module/components/AvatarGroup/AvatarGroup.js +2 -2
  88. package/lib/module/components/Badge/Badge.js +2 -1
  89. package/lib/module/components/Balance/Balance.js +2 -1
  90. package/lib/module/components/BottomNav/BottomNav.js +2 -1
  91. package/lib/module/components/BottomNavItem/BottomNavItem.js +108 -88
  92. package/lib/module/components/Button/Button.js +192 -95
  93. package/lib/module/components/ButtonGroup/ButtonGroup.js +2 -2
  94. package/lib/module/components/Card/Card.js +2 -1
  95. package/lib/module/components/CardCTA/CardCTA.js +2 -2
  96. package/lib/module/components/CardProviderInfo/CardProviderInfo.js +2 -2
  97. package/lib/module/components/Carousel/Carousel.js +3 -2
  98. package/lib/module/components/Checkbox/Checkbox.js +2 -1
  99. package/lib/module/components/ChipGroup/ChipGroup.js +2 -2
  100. package/lib/module/components/ChipSelect/ChipSelect.js +2 -1
  101. package/lib/module/components/DebitCard/DebitCard.js +2 -2
  102. package/lib/module/components/Disclaimer/Disclaimer.js +2 -1
  103. package/lib/module/components/Divider/Divider.js +2 -1
  104. package/lib/module/components/Drawer/Drawer.js +109 -48
  105. package/lib/module/components/EmptyState/EmptyState.js +2 -1
  106. package/lib/module/components/FilterBar/FilterBar.js +2 -2
  107. package/lib/module/components/Form/Form.js +2 -1
  108. package/lib/module/components/FormField/FormField.js +3 -2
  109. package/lib/module/components/HStack/HStack.js +2 -2
  110. package/lib/module/components/HoldingsCard/HoldingsCard.js +2 -1
  111. package/lib/module/components/IconButton/IconButton.js +120 -130
  112. package/lib/module/components/IconCapsule/IconCapsule.js +60 -57
  113. package/lib/module/components/InputSearch/InputSearch.js +7 -3
  114. package/lib/module/components/LazyList/LazyList.js +2 -2
  115. package/lib/module/components/LinearMeter/LinearMeter.js +3 -2
  116. package/lib/module/components/ListGroup/ListGroup.js +2 -2
  117. package/lib/module/components/ListItem/ListItem.js +194 -146
  118. package/lib/module/components/MediaCard/MediaCard.js +4 -2
  119. package/lib/module/components/MerchantProfile/MerchantProfile.js +2 -1
  120. package/lib/module/components/MoneyValue/MoneyValue.js +2 -1
  121. package/lib/module/components/NavArrow/NavArrow.js +82 -58
  122. package/lib/module/components/NoteInput/NoteInput.js +2 -1
  123. package/lib/module/components/Nudge/Nudge.js +2 -2
  124. package/lib/module/components/Numpad/Numpad.js +2 -1
  125. package/lib/module/components/OTP/OTP.js +2 -2
  126. package/lib/module/components/PaymentFeedback/PaymentFeedback.js +2 -1
  127. package/lib/module/components/Popup/Popup.js +2 -1
  128. package/lib/module/components/ProductLabel/ProductLabel.js +2 -1
  129. package/lib/module/components/ProgressBadge/ProgressBadge.js +2 -1
  130. package/lib/module/components/RadioButton/RadioButton.js +2 -1
  131. package/lib/module/components/RechargeCard/RechargeCard.js +2 -1
  132. package/lib/module/components/Screen/Screen.js +2 -2
  133. package/lib/module/components/Section/Section.js +503 -169
  134. package/lib/module/components/SegmentedControl/SegmentedControl.js +3 -2
  135. package/lib/module/components/StatItem/StatItem.js +2 -1
  136. package/lib/module/components/StatusHero/StatusHero.js +2 -1
  137. package/lib/module/components/Stepper/Step.js +2 -1
  138. package/lib/module/components/Stepper/StepLabel.js +2 -1
  139. package/lib/module/components/Stepper/Stepper.js +2 -1
  140. package/lib/module/components/SupportText/SupportText.js +2 -1
  141. package/lib/module/components/SupportText/SupportTextIcon.js +2 -1
  142. package/lib/module/components/SwappableAmount/SwappableAmount.js +2 -1
  143. package/lib/module/components/Tabs/TabItem.js +2 -1
  144. package/lib/module/components/Tabs/Tabs.js +2 -1
  145. package/lib/module/components/Text/Text.js +2 -1
  146. package/lib/module/components/TextInput/TextInput.js +3 -3
  147. package/lib/module/components/ThreadHero/ThreadHero.js +2 -1
  148. package/lib/module/components/Title/Title.js +2 -1
  149. package/lib/module/components/Toast/Toast.js +2 -1
  150. package/lib/module/components/Toggle/Toggle.js +2 -1
  151. package/lib/module/components/Tooltip/Tooltip.js +2 -1
  152. package/lib/module/components/TransactionBubble/TransactionBubble.js +2 -2
  153. package/lib/module/components/TransactionDetails/TransactionDetails.js +3 -3
  154. package/lib/module/components/TransactionStatus/TransactionStatus.js +3 -2
  155. package/lib/module/components/UpiHandle/UpiHandle.js +147 -113
  156. package/lib/module/components/VStack/VStack.js +2 -2
  157. package/lib/module/design-tokens/figma-variables-resolver.js +21 -3
  158. package/lib/module/icons/registry.js +1 -1
  159. package/lib/module/utils/react-utils.js +16 -0
  160. package/lib/typescript/src/components/Avatar/Avatar.d.ts +11 -17
  161. package/lib/typescript/src/components/BottomNavItem/BottomNavItem.d.ts +12 -8
  162. package/lib/typescript/src/components/Button/Button.d.ts +18 -1
  163. package/lib/typescript/src/components/IconButton/IconButton.d.ts +12 -29
  164. package/lib/typescript/src/components/IconCapsule/IconCapsule.d.ts +10 -18
  165. package/lib/typescript/src/components/InputSearch/InputSearch.d.ts +8 -3
  166. package/lib/typescript/src/components/ListItem/ListItem.d.ts +14 -1
  167. package/lib/typescript/src/components/NavArrow/NavArrow.d.ts +12 -11
  168. package/lib/typescript/src/components/Section/Section.d.ts +43 -48
  169. package/lib/typescript/src/components/UpiHandle/UpiHandle.d.ts +13 -12
  170. package/lib/typescript/src/icons/registry.d.ts +1 -1
  171. package/lib/typescript/src/utils/react-utils.d.ts +15 -0
  172. package/package.json +4 -6
  173. package/src/components/Accordion/Accordion.tsx +2 -2
  174. package/src/components/ActionFooter/ActionFooter.tsx +2 -2
  175. package/src/components/ActionTile/ActionTile.tsx +2 -1
  176. package/src/components/AmountInput/AmountInput.tsx +2 -1
  177. package/src/components/AppBar/AppBar.tsx +2 -2
  178. package/src/components/Avatar/Avatar.tsx +229 -158
  179. package/src/components/AvatarGroup/AvatarGroup.tsx +2 -2
  180. package/src/components/Badge/Badge.tsx +2 -1
  181. package/src/components/Balance/Balance.tsx +2 -1
  182. package/src/components/BottomNav/BottomNav.tsx +2 -1
  183. package/src/components/BottomNavItem/BottomNavItem.tsx +159 -88
  184. package/src/components/Button/Button.tsx +228 -101
  185. package/src/components/ButtonGroup/ButtonGroup.tsx +2 -2
  186. package/src/components/Card/Card.tsx +2 -1
  187. package/src/components/CardCTA/CardCTA.tsx +2 -2
  188. package/src/components/CardProviderInfo/CardProviderInfo.tsx +2 -2
  189. package/src/components/Carousel/Carousel.tsx +3 -2
  190. package/src/components/Checkbox/Checkbox.tsx +2 -1
  191. package/src/components/ChipGroup/ChipGroup.tsx +2 -2
  192. package/src/components/ChipSelect/ChipSelect.tsx +2 -1
  193. package/src/components/DebitCard/DebitCard.tsx +2 -2
  194. package/src/components/Disclaimer/Disclaimer.tsx +2 -1
  195. package/src/components/Divider/Divider.tsx +2 -1
  196. package/src/components/Drawer/Drawer.tsx +124 -58
  197. package/src/components/EmptyState/EmptyState.tsx +2 -1
  198. package/src/components/FilterBar/FilterBar.tsx +2 -2
  199. package/src/components/Form/Form.tsx +2 -1
  200. package/src/components/FormField/FormField.tsx +3 -2
  201. package/src/components/HStack/HStack.tsx +2 -2
  202. package/src/components/HoldingsCard/HoldingsCard.tsx +2 -1
  203. package/src/components/IconButton/IconButton.tsx +154 -126
  204. package/src/components/IconCapsule/IconCapsule.tsx +73 -54
  205. package/src/components/InputSearch/InputSearch.tsx +19 -5
  206. package/src/components/LazyList/LazyList.tsx +2 -2
  207. package/src/components/LinearMeter/LinearMeter.tsx +3 -2
  208. package/src/components/ListGroup/ListGroup.tsx +2 -2
  209. package/src/components/ListItem/ListItem.tsx +257 -187
  210. package/src/components/MediaCard/MediaCard.tsx +2 -1
  211. package/src/components/MerchantProfile/MerchantProfile.tsx +2 -1
  212. package/src/components/MoneyValue/MoneyValue.tsx +2 -1
  213. package/src/components/NavArrow/NavArrow.tsx +91 -58
  214. package/src/components/NoteInput/NoteInput.tsx +2 -1
  215. package/src/components/Nudge/Nudge.tsx +2 -2
  216. package/src/components/Numpad/Numpad.tsx +2 -1
  217. package/src/components/OTP/OTP.tsx +2 -2
  218. package/src/components/PaymentFeedback/PaymentFeedback.tsx +2 -1
  219. package/src/components/Popup/Popup.tsx +2 -1
  220. package/src/components/ProductLabel/ProductLabel.tsx +2 -1
  221. package/src/components/ProgressBadge/ProgressBadge.tsx +2 -2
  222. package/src/components/RadioButton/RadioButton.tsx +2 -1
  223. package/src/components/RechargeCard/RechargeCard.tsx +2 -1
  224. package/src/components/Screen/Screen.tsx +2 -2
  225. package/src/components/Section/Section.tsx +672 -176
  226. package/src/components/SegmentedControl/SegmentedControl.tsx +3 -2
  227. package/src/components/StatItem/StatItem.tsx +2 -1
  228. package/src/components/StatusHero/StatusHero.tsx +2 -1
  229. package/src/components/Stepper/Step.tsx +2 -1
  230. package/src/components/Stepper/StepLabel.tsx +2 -1
  231. package/src/components/Stepper/Stepper.tsx +2 -1
  232. package/src/components/SupportText/SupportText.tsx +2 -1
  233. package/src/components/SupportText/SupportTextIcon.tsx +2 -1
  234. package/src/components/SwappableAmount/SwappableAmount.tsx +2 -1
  235. package/src/components/Tabs/TabItem.tsx +2 -1
  236. package/src/components/Tabs/Tabs.tsx +2 -1
  237. package/src/components/Text/Text.tsx +2 -1
  238. package/src/components/TextInput/TextInput.tsx +3 -3
  239. package/src/components/ThreadHero/ThreadHero.tsx +2 -1
  240. package/src/components/Title/Title.tsx +2 -1
  241. package/src/components/Toast/Toast.tsx +2 -1
  242. package/src/components/Toggle/Toggle.tsx +2 -1
  243. package/src/components/Tooltip/Tooltip.tsx +2 -1
  244. package/src/components/TransactionBubble/TransactionBubble.tsx +2 -2
  245. package/src/components/TransactionDetails/TransactionDetails.tsx +3 -3
  246. package/src/components/TransactionStatus/TransactionStatus.tsx +3 -2
  247. package/src/components/UpiHandle/UpiHandle.tsx +193 -125
  248. package/src/components/VStack/VStack.tsx +2 -2
  249. package/src/design-tokens/figma-variables-resolver.ts +21 -3
  250. package/src/icons/registry.ts +1 -1
  251. package/src/utils/react-utils.ts +16 -0
  252. package/lib/typescript/App.d.ts +0 -2
  253. package/lib/typescript/index.d.ts +0 -2
  254. package/lib/typescript/metro.config.d.ts +0 -78
  255. package/lib/typescript/react-native.config.d.ts +0 -4
@@ -9,44 +9,78 @@ var _reactNative = require("react-native");
9
9
  var _figmaVariablesResolver = require("../../design-tokens/figma-variables-resolver");
10
10
  var _Icon = _interopRequireDefault(require("../../icons/Icon"));
11
11
  var _webPlatformUtils = require("../../utils/web-platform-utils");
12
+ var _reactUtils = require("../../utils/react-utils");
12
13
  var _jsxRuntime = require("react/jsx-runtime");
13
14
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
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
+ // ---------------------------------------------------------------------------
17
+ // Module-scope constants
18
+ // ---------------------------------------------------------------------------
19
+
20
+ const IS_WEB = _reactNative.Platform.OS === 'web';
21
+ const IS_IOS = _reactNative.Platform.OS === 'ios';
22
+ const PRESS_DELAY = IS_IOS ? 130 : 0;
23
+
24
+ // Pressed visual is applied through Pressable's style callback so the host
25
+ // view updates without scheduling a React render. Hover/focus stay mirrored
26
+ // in React state because they're sustained visual states (web only).
27
+ const pressedOverlayStyle = {
28
+ opacity: 0.7
29
+ };
30
+ const hoverOverlayStyle = {
31
+ opacity: 0.85
32
+ };
33
+ const focusOverlayStyle = {
34
+ borderWidth: 1,
35
+ borderColor: '#222'
36
+ };
37
+ function resolveIconButtonTokens(modes, disabled) {
38
+ const radiusRaw = (0, _figmaVariablesResolver.getVariableByName)('iconButton/radius', modes) ?? 9999;
39
+ const padding = (0, _figmaVariablesResolver.getVariableByName)('iconButton/padding', modes) ?? 12;
40
+ const backgroundColor = (0, _figmaVariablesResolver.getVariableByName)('iconButton/background', modes) ?? '#cfa159';
41
+ const borderColor = (0, _figmaVariablesResolver.getVariableByName)('iconButton/border/color', modes) ?? '#ffffff00';
42
+ const borderSize = (0, _figmaVariablesResolver.getVariableByName)('iconButton/border/size', modes) ?? 1;
43
+ const iconColor = (0, _figmaVariablesResolver.getVariableByName)('iconButton/icon/color', modes) ?? '#0f0d0a';
44
+ const iconSize = (0, _figmaVariablesResolver.getVariableByName)('iconButton/icon/size', modes) ?? 18;
45
+
46
+ // 9999 is the design-token sentinel for "perfect circle"
47
+ const buttonSize = padding * 2 + iconSize;
48
+ const borderRadius = radiusRaw === 9999 ? buttonSize / 2 : radiusRaw;
49
+ return {
50
+ baseContainerStyle: {
51
+ width: buttonSize,
52
+ height: buttonSize,
53
+ borderRadius,
54
+ borderWidth: borderSize,
55
+ borderColor,
56
+ backgroundColor,
57
+ overflow: 'hidden',
58
+ alignItems: 'center',
59
+ justifyContent: 'center',
60
+ padding,
61
+ opacity: disabled ? 0.5 : 1
62
+ },
63
+ iconColor,
64
+ iconSize
65
+ };
66
+ }
67
+
15
68
  /**
16
69
  * IconButton component that displays an icon within a pressable button container.
17
- *
18
- * This component displays an icon within a styled button container that can be pressed.
19
- * All styling values are resolved from Figma design tokens using the provided modes.
20
- *
21
- * @component
22
- * @param {Object} props - Component props
23
- * @param {string} [props.iconName="ic_card"] - The name of the icon to display from the icon registry
24
- * @param {Object} [props.modes={}] - Mode configuration for design tokens (e.g., {"Button / Size": "M", "Appearance": "high"})
25
- * @param {Function} [props.onPress] - Callback function called when the button is pressed
26
- * @param {boolean} [props.disabled=false] - Whether the button is disabled
27
- * @param {Object} [props.style] - Additional styles for the container
28
- * @param {string} [props.accessibilityLabel] - Accessibility label for screen readers. If not provided, defaults to iconName
29
- * @param {string} [props.accessibilityHint] - Additional accessibility hint for screen readers
30
- * @param {Object} [props.accessibilityState] - Additional accessibility state information
31
- *
32
- * @example
33
- * ```jsx
34
- * // Default icon button
35
- * <IconButton modes={{}} />
36
- *
37
- * // Custom icon with size mode
38
- * <IconButton iconName="ic_rupee" modes={{"Button / Size": "M"}} />
39
- *
40
- * // With appearance mode
41
- * <IconButton modes={{"Appearance": "high"}} onPress={() => console.log('pressed')} />
42
- *
43
- * // With accessibility label
44
- * <IconButton iconName="ic_search" accessibilityLabel={undefined} accessibilityHint="Opens the search screen" />
45
- * ```
70
+ *
71
+ * Performance notes:
72
+ * - Token reads collapsed into a single `useMemo([modes, disabled, isToggle, isActive])`.
73
+ * - Press visual goes through Pressable's `({ pressed })` style callback so
74
+ * a scroll-cancelled touch never schedules a React render. iOS gets
75
+ * `unstable_pressDelay={130}`.
76
+ * - Hover and focus state are mirrored on web only (gated setters).
77
+ * - The previous version had a redundant `manualPressStyle` (a duplicate
78
+ * pressed transform mirrored via React state) removed.
79
+ * - Wrapped in `React.memo`.
46
80
  */
47
81
  function IconButton({
48
- iconName = "ic_card",
49
- modes = {},
82
+ iconName = 'ic_card',
83
+ modes = _reactUtils.EMPTY_MODES,
50
84
  onPress,
51
85
  disabled = false,
52
86
  style,
@@ -60,63 +94,30 @@ function IconButton({
60
94
  isActive = false,
61
95
  ...rest
62
96
  }) {
97
+ // Merge explicit props with modes for token resolution. Memoize the merged
98
+ // object so its identity is stable when none of the inputs change — that
99
+ // keeps the resolver's WeakMap cache hot.
100
+ const componentModes = (0, _react.useMemo)(() => ({
101
+ ...modes,
102
+ isToggle,
103
+ isActive
104
+ }), [modes, isToggle, isActive]);
105
+ const tokens = (0, _react.useMemo)(() => resolveIconButtonTokens(componentModes, disabled), [componentModes, disabled]);
63
106
  const [isFocused, setIsFocused] = (0, _react.useState)(false);
64
107
  const [isHovered, setIsHovered] = (0, _react.useState)(false);
65
- const [isPressed, setIsPressed] = (0, _react.useState)(false);
66
-
67
- // Merge explicit props with modes for token resolution
68
- // This allows the variable resolver to pick up isToggle and isActive specific tokens
69
- const componentModes = {
70
- ...modes,
71
- 'isToggle': isToggle,
72
- 'isActive': isActive
73
- };
74
-
75
- // Resolve design tokens using only the Figma-defined base tokens for Icon Button (node 72:14)
76
- const radius = (0, _figmaVariablesResolver.getVariableByName)('iconButton/radius', componentModes) ?? 9999;
77
- const padding = (0, _figmaVariablesResolver.getVariableByName)('iconButton/padding', componentModes) ?? 12;
78
- const backgroundColor = (0, _figmaVariablesResolver.getVariableByName)('iconButton/background', componentModes) ?? '#cfa159';
79
- const borderColor = (0, _figmaVariablesResolver.getVariableByName)('iconButton/border/color', componentModes) ?? '#ffffff00';
80
- const borderSize = (0, _figmaVariablesResolver.getVariableByName)('iconButton/border/size', componentModes) ?? 1;
81
- const iconColor = (0, _figmaVariablesResolver.getVariableByName)('iconButton/icon/color', componentModes) ?? '#0f0d0a';
82
- const iconSize = (0, _figmaVariablesResolver.getVariableByName)('iconButton/icon/size', componentModes) ?? 18;
108
+ const userHandlersRef = (0, _react.useRef)({});
109
+ userHandlersRef.current.onPressIn = rest?.onPressIn;
110
+ userHandlersRef.current.onPressOut = rest?.onPressOut;
111
+ userHandlersRef.current.onFocus = rest?.onFocus;
112
+ userHandlersRef.current.onBlur = rest?.onBlur;
113
+ userHandlersRef.current.onHoverIn = rest?.onHoverIn;
114
+ userHandlersRef.current.onHoverOut = rest?.onHoverOut;
83
115
 
84
116
  // Determine which icon to display
85
- // If isToggle is yes, use active/inactive icons based on isActive state
86
- // Otherwise use standard iconName
87
- let finalIconName = iconName;
88
- if (isToggle) {
89
- if (isActive && activeIcon) {
90
- finalIconName = activeIcon;
91
- } else if (!isActive && inactiveIcon) {
92
- finalIconName = inactiveIcon;
93
- }
94
- }
95
-
96
- // Convert radius to React Native format (if 9999, use padding*2 for perfect circle)
97
- // For a button, the size is determined by padding, so radius should be padding*2 for a circle
98
- const buttonSize = padding * 2 + iconSize;
99
- const borderRadius = radius === 9999 ? buttonSize / 2 : radius;
100
-
101
- // Container base style
102
- const baseContainerStyle = {
103
- width: buttonSize,
104
- height: buttonSize,
105
- borderRadius: borderRadius,
106
- borderWidth: borderSize,
107
- borderColor: borderColor,
108
- backgroundColor: backgroundColor,
109
- overflow: 'hidden',
110
- alignItems: 'center',
111
- justifyContent: 'center',
112
- padding: padding,
113
- opacity: disabled ? 0.5 : 1
114
- };
117
+ const finalIconName = isToggle ? isActive && activeIcon ? activeIcon : !isActive && inactiveIcon ? inactiveIcon : iconName : iconName;
115
118
 
116
119
  // Generate default accessibility label from icon name if not provided
117
120
  const defaultAccessibilityLabel = accessibilityLabel || iconName.replace(/^ic_/, '').replace(/_/g, ' ').replace(/\b\w/g, l => l.toUpperCase());
118
-
119
- // Get web platform support props
120
121
  const webProps = (0, _webPlatformUtils.usePressableWebSupport)({
121
122
  restProps: rest,
122
123
  onPress: disabled ? undefined : onPress,
@@ -124,6 +125,31 @@ function IconButton({
124
125
  accessibilityLabel: defaultAccessibilityLabel,
125
126
  webAccessibilityProps
126
127
  });
128
+ const handlePressIn = (0, _react.useCallback)(e => {
129
+ userHandlersRef.current.onPressIn?.(e);
130
+ }, []);
131
+ const handlePressOut = (0, _react.useCallback)(e => {
132
+ userHandlersRef.current.onPressOut?.(e);
133
+ }, []);
134
+ const handleFocus = (0, _react.useCallback)(e => {
135
+ if (IS_WEB) setIsFocused(true);
136
+ userHandlersRef.current.onFocus?.(e);
137
+ }, []);
138
+ const handleBlur = (0, _react.useCallback)(e => {
139
+ if (IS_WEB) setIsFocused(false);
140
+ userHandlersRef.current.onBlur?.(e);
141
+ }, []);
142
+ const handleHoverIn = (0, _react.useCallback)(e => {
143
+ if (IS_WEB) setIsHovered(true);
144
+ userHandlersRef.current.onHoverIn?.(e);
145
+ }, []);
146
+ const handleHoverOut = (0, _react.useCallback)(e => {
147
+ if (IS_WEB) setIsHovered(false);
148
+ userHandlersRef.current.onHoverOut?.(e);
149
+ }, []);
150
+ const styleCallback = (0, _react.useCallback)(({
151
+ pressed
152
+ }) => [tokens.baseContainerStyle, style, pressed && !disabled ? pressedOverlayStyle : null, isHovered && !disabled ? hoverOverlayStyle : null, isFocused && !disabled ? focusOverlayStyle : null], [tokens.baseContainerStyle, style, isHovered, isFocused, disabled]);
127
153
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
128
154
  accessibilityRole: "button",
129
155
  accessibilityLabel: undefined,
@@ -134,58 +160,22 @@ function IconButton({
134
160
  },
135
161
  onPress: onPress,
136
162
  disabled: disabled,
137
- onPressIn: e => {
138
- setIsPressed(true);
139
- rest?.onPressIn?.(e);
140
- },
141
- onPressOut: e => {
142
- setIsPressed(false);
143
- rest?.onPressOut?.(e);
144
- },
145
- onFocus: e => {
146
- setIsFocused(true);
147
- rest?.onFocus?.(e);
148
- },
149
- onBlur: e => {
150
- setIsFocused(false);
151
- rest?.onBlur?.(e);
152
- },
153
- onHoverIn: e => {
154
- setIsHovered(true);
155
- rest?.onHoverIn?.(e);
156
- },
157
- onHoverOut: e => {
158
- setIsHovered(false);
159
- rest?.onHoverOut?.(e);
160
- },
161
- style: ({
162
- pressed
163
- }) => {
164
- const pressedStyle = pressed && !disabled ? {
165
- opacity: 0.7
166
- } : null;
167
- const hoverStyle = isHovered && !disabled ? {
168
- opacity: 0.85
169
- } : null;
170
- const focusStyle = isFocused && !disabled ? {
171
- borderWidth: 1,
172
- borderColor: '#222'
173
- } : null;
174
- const manualPressStyle = isPressed && !disabled ? {
175
- transform: [{
176
- scale: 0.98
177
- }]
178
- } : null;
179
- return [baseContainerStyle, style, pressedStyle, hoverStyle, focusStyle, manualPressStyle];
180
- },
163
+ onPressIn: handlePressIn,
164
+ onPressOut: handlePressOut,
165
+ onFocus: handleFocus,
166
+ onBlur: handleBlur,
167
+ onHoverIn: handleHoverIn,
168
+ onHoverOut: handleHoverOut,
169
+ unstable_pressDelay: PRESS_DELAY,
170
+ style: styleCallback,
181
171
  ...webProps,
182
172
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
183
173
  name: finalIconName,
184
- size: iconSize,
185
- color: iconColor,
174
+ size: tokens.iconSize,
175
+ color: tokens.iconColor,
186
176
  accessibilityElementsHidden: true,
187
177
  importantForAccessibility: "no"
188
178
  })
189
179
  });
190
180
  }
191
- var _default = exports.default = IconButton;
181
+ var _default = exports.default = /*#__PURE__*/_react.default.memo(IconButton);
@@ -4,94 +4,98 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _react = _interopRequireDefault(require("react"));
7
+ var _react = _interopRequireWildcard(require("react"));
8
8
  var _reactNative = require("react-native");
9
9
  var _figmaVariablesResolver = require("../../design-tokens/figma-variables-resolver");
10
10
  var _JFSThemeProvider = require("../../design-tokens/JFSThemeProvider");
11
+ var _reactUtils = require("../../utils/react-utils");
11
12
  var _Icon = _interopRequireDefault(require("../../icons/Icon"));
12
13
  var _jsxRuntime = require("react/jsx-runtime");
13
14
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
16
+ function resolveIconCapsuleTokens(modes) {
17
+ const size = (0, _figmaVariablesResolver.getVariableByName)('iconCapsule/size', modes) || 42;
18
+ const radiusRaw = (0, _figmaVariablesResolver.getVariableByName)('iconCapsule/radius', modes) || 9999;
19
+ const backgroundColor = (0, _figmaVariablesResolver.getVariableByName)('iconCapsule/background', modes) || '#cfa159';
20
+ const borderColor = (0, _figmaVariablesResolver.getVariableByName)('iconCapsule/border/color', modes) || 'rgba(255,255,255,0)';
21
+ const borderSize = (0, _figmaVariablesResolver.getVariableByName)('iconCapsule/border/size', modes) || 1;
22
+ const iconColor = (0, _figmaVariablesResolver.getVariableByName)('iconCapsule/icon/color', modes) || '#0f0d0a';
23
+ const iconSize = (0, _figmaVariablesResolver.getVariableByName)('iconCapsule/icon/size', modes) || 18;
24
+
25
+ // 9999 is the design-token sentinel for "perfect circle"
26
+ const borderRadius = radiusRaw === 9999 ? size / 2 : radiusRaw;
27
+ return {
28
+ containerStyle: {
29
+ width: size,
30
+ height: size,
31
+ borderRadius,
32
+ borderWidth: borderSize,
33
+ borderColor,
34
+ backgroundColor,
35
+ overflow: 'hidden',
36
+ alignItems: 'center',
37
+ justifyContent: 'center'
38
+ },
39
+ iconColor,
40
+ iconSize
41
+ };
42
+ }
43
+
14
44
  /**
15
45
  * IconCapsule component that displays an icon within a circular or rounded container.
16
- *
17
- * This component displays an icon (default: ic_card) within a styled capsule container.
46
+ *
18
47
  * All styling values are resolved from Figma design tokens using the provided modes.
19
- *
48
+ *
20
49
  * @component
21
50
  * @param {Object} props - Component props
22
51
  * @param {string} [props.iconName="ic_card"] - The name of the icon to display from the icon registry
23
52
  * @param {Object} [props.modes={}] - Mode configuration for design tokens (e.g., {"Appearance": "Primary"})
24
- * @param {string} [props.accessibilityLabel] - Accessibility label for screen readers. If not provided, defaults to iconName
53
+ * @param {string} [props.accessibilityLabel] - Accessibility label for screen readers
25
54
  * @param {string} [props.accessibilityRole] - Accessibility role (defaults to "image" for decorative icons)
26
- *
27
- * @example
28
- * ```jsx
29
- * // Default icon (ic_card)
30
- * <IconCapsule modes={{}} />
31
- *
32
- * // Custom icon
33
- * <IconCapsule iconName="ic_rupee" modes={{}} />
34
- *
35
- * // With appearance mode
36
- * <IconCapsule modes={{"Appearance": "Secondary"}} />
37
- *
38
- * // With accessibility label
39
- * <IconCapsule iconName="ic_card" accessibilityLabel={undefined} />
40
- * ```
55
+ *
56
+ * Performance notes:
57
+ * - All token reads collapsed into a single `useMemo([modes])`. The merged
58
+ * `(globalModes + propModes)` object is also memoized so downstream
59
+ * `getVariableByName` calls hit the resolver's per-modes-object cache.
60
+ * - Wrapped in `React.memo`; with the shared `EMPTY_MODES` default the
61
+ * common path benefits from full memoization.
41
62
  */
42
63
  function IconCapsule({
43
- iconName = "ic_card",
44
- modes: propModes = {},
45
- accessibilityLabel,
46
- accessibilityRole = "image",
64
+ iconName = 'ic_card',
65
+ modes: propModes = _reactUtils.EMPTY_MODES,
66
+ // accessibilityLabel is accepted on the type for API back-compat but the
67
+ // component intentionally renders `accessibilityLabel={undefined}` (icons
68
+ // are decorative; the surrounding component owns the label).
69
+ accessibilityLabel: _accessibilityLabel,
70
+ accessibilityRole = 'image',
71
+ style: styleProp,
47
72
  ...rest
48
73
  }) {
49
74
  const {
50
75
  modes: globalModes
51
76
  } = (0, _JFSThemeProvider.useTokens)();
52
- const modes = {
77
+
78
+ // Memoize the merged modes object so its identity is stable across renders
79
+ // when neither the global nor the prop modes change. This is what lets the
80
+ // resolver's WeakMap cache hit on every subsequent `getVariableByName`.
81
+ const modes = (0, _react.useMemo)(() => globalModes === _reactUtils.EMPTY_MODES && propModes === _reactUtils.EMPTY_MODES ? _reactUtils.EMPTY_MODES : {
53
82
  ...globalModes,
54
83
  ...propModes
55
- };
56
- // Resolve design tokens using the provided modes
57
- const size = (0, _figmaVariablesResolver.getVariableByName)('iconCapsule/size', modes) || 42;
58
- const radius = (0, _figmaVariablesResolver.getVariableByName)('iconCapsule/radius', modes) || 9999;
59
- const backgroundColor = (0, _figmaVariablesResolver.getVariableByName)('iconCapsule/background', modes) || '#cfa159';
60
- const borderColor = (0, _figmaVariablesResolver.getVariableByName)('iconCapsule/border/color', modes) || 'rgba(255,255,255,0)';
61
- const borderSize = (0, _figmaVariablesResolver.getVariableByName)('iconCapsule/border/size', modes) || 1;
62
- const iconColor = (0, _figmaVariablesResolver.getVariableByName)('iconCapsule/icon/color', modes) || '#0f0d0a';
63
- const iconSize = (0, _figmaVariablesResolver.getVariableByName)('iconCapsule/icon/size', modes) || 18;
64
-
65
- // Convert radius to React Native format (if 9999, use size/2 for perfect circle)
66
- const borderRadius = radius === 9999 ? size / 2 : radius;
67
-
68
- // Container style
69
- const containerStyle = {
70
- width: size,
71
- height: size,
72
- borderRadius: borderRadius,
73
- borderWidth: borderSize,
74
- borderColor: borderColor,
75
- backgroundColor: backgroundColor,
76
- overflow: 'hidden',
77
- alignItems: 'center',
78
- justifyContent: 'center'
79
- };
80
-
81
- // Generate default accessibility label from icon name if not provided
82
- const defaultAccessibilityLabel = accessibilityLabel || iconName.replace(/^ic_/, '').replace(/_/g, ' ').replace(/\b\w/g, l => l.toUpperCase());
84
+ }, [globalModes, propModes]);
85
+ const tokens = (0, _react.useMemo)(() => resolveIconCapsuleTokens(modes), [modes]);
86
+ const composedStyle = (0, _react.useMemo)(() => styleProp ? [tokens.containerStyle, styleProp] : tokens.containerStyle, [tokens.containerStyle, styleProp]);
83
87
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
84
- style: containerStyle,
88
+ style: composedStyle,
85
89
  accessibilityRole: accessibilityRole,
86
90
  accessibilityLabel: undefined,
87
91
  ...rest,
88
92
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
89
93
  name: iconName,
90
- size: iconSize,
91
- color: iconColor,
94
+ size: tokens.iconSize,
95
+ color: tokens.iconColor,
92
96
  accessibilityElementsHidden: true,
93
97
  importantForAccessibility: "no"
94
98
  })
95
99
  });
96
100
  }
97
- var _default = exports.default = IconCapsule;
101
+ var _default = exports.default = /*#__PURE__*/_react.default.memo(IconCapsule);
@@ -7,6 +7,7 @@ exports.default = InputSearch;
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 _Icon = _interopRequireDefault(require("../../icons/Icon"));
11
12
  var _TextInput = _interopRequireDefault(require("../TextInput/TextInput"));
12
13
  var _jsxRuntime = require("react/jsx-runtime");
@@ -18,7 +19,8 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
18
19
 
19
20
  function SupportText({
20
21
  label = "Support Text",
21
- modes = {},
22
+ iconName = "ic_info",
23
+ modes = _reactUtils.EMPTY_MODES,
22
24
  style
23
25
  }) {
24
26
  // Resolve variables
@@ -37,7 +39,7 @@ function SupportText({
37
39
  gap: gap
38
40
  }, style],
39
41
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
40
- name: "ic_info",
42
+ name: iconName,
41
43
  size: iconSize,
42
44
  color: foreground
43
45
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
@@ -55,7 +57,8 @@ function SupportText({
55
57
  function InputSearch({
56
58
  supportText = true,
57
59
  supportTextLabel = "Support Text",
58
- modes = {},
60
+ supportTextIcon = "ic_info",
61
+ modes = _reactUtils.EMPTY_MODES,
59
62
  containerStyle,
60
63
  placeholder = "Search",
61
64
  value,
@@ -136,6 +139,7 @@ function InputSearch({
136
139
  ...rest
137
140
  }), supportText && /*#__PURE__*/(0, _jsxRuntime.jsx)(SupportText, {
138
141
  label: supportTextLabel,
142
+ iconName: supportTextIcon,
139
143
  modes: componentModes
140
144
  })]
141
145
  });
@@ -31,7 +31,7 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
31
31
  */
32
32
  function LazyList({
33
33
  listGroupsSlot,
34
- modes = {},
34
+ modes = _reactUtils.EMPTY_MODES,
35
35
  style,
36
36
  accessibilityLabel = undefined,
37
37
  accessibilityHint,
@@ -7,12 +7,13 @@ 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 _MoneyValue = _interopRequireDefault(require("../MoneyValue/MoneyValue"));
11
12
  var _jsxRuntime = require("react/jsx-runtime");
12
13
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
14
  const LinearMeterLabel = ({
14
15
  children,
15
- modes = {},
16
+ modes = _reactUtils.EMPTY_MODES,
16
17
  style,
17
18
  ...rest
18
19
  }) => {
@@ -37,7 +38,7 @@ const LinearMeterLabel = ({
37
38
  };
38
39
  const LinearMeter = ({
39
40
  value = 0,
40
- modes = {},
41
+ modes = _reactUtils.EMPTY_MODES,
41
42
  style,
42
43
  trackStyle,
43
44
  indicatorStyle,
@@ -44,7 +44,7 @@ function ListGroup({
44
44
  label = '',
45
45
  listGroupSlot,
46
46
  children,
47
- modes = {},
47
+ modes = _reactUtils.EMPTY_MODES,
48
48
  style,
49
49
  accessibilityLabel,
50
50
  accessibilityHint,