@pagopa/io-app-design-system 4.2.1 → 4.4.0

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 (447) hide show
  1. package/lib/commonjs/components/Advice/__test__/__snapshots__/advice.test.tsx.snap +3 -3
  2. package/lib/commonjs/components/alert/Alert.js +44 -65
  3. package/lib/commonjs/components/alert/Alert.js.map +1 -1
  4. package/lib/commonjs/components/alert/AlertEdgeToEdge.js +9 -29
  5. package/lib/commonjs/components/alert/AlertEdgeToEdge.js.map +1 -1
  6. package/lib/commonjs/components/badge/Badge.js +16 -3
  7. package/lib/commonjs/components/badge/Badge.js.map +1 -1
  8. package/lib/commonjs/components/badge/__test__/__snapshots__/badge.test.tsx.snap +9 -5
  9. package/lib/commonjs/components/banner/Banner.js +10 -34
  10. package/lib/commonjs/components/banner/Banner.js.map +1 -1
  11. package/lib/commonjs/components/banner/__test__/__snapshots__/banner.test.tsx.snap +6 -6
  12. package/lib/commonjs/components/buttons/ButtonLink.js +26 -54
  13. package/lib/commonjs/components/buttons/ButtonLink.js.map +1 -1
  14. package/lib/commonjs/components/buttons/ButtonOutline.js +27 -45
  15. package/lib/commonjs/components/buttons/ButtonOutline.js.map +1 -1
  16. package/lib/commonjs/components/buttons/ButtonSolid.js +24 -45
  17. package/lib/commonjs/components/buttons/ButtonSolid.js.map +1 -1
  18. package/lib/commonjs/components/buttons/IconButton.js +15 -32
  19. package/lib/commonjs/components/buttons/IconButton.js.map +1 -1
  20. package/lib/commonjs/components/buttons/IconButtonContained.js +19 -42
  21. package/lib/commonjs/components/buttons/IconButtonContained.js.map +1 -1
  22. package/lib/commonjs/components/buttons/IconButtonSolid.js +16 -31
  23. package/lib/commonjs/components/buttons/IconButtonSolid.js.map +1 -1
  24. package/lib/commonjs/components/buttons/__test__/__snapshots__/button.test.tsx.snap +61 -19
  25. package/lib/commonjs/components/checkbox/AnimatedCheckbox.js +23 -18
  26. package/lib/commonjs/components/checkbox/AnimatedCheckbox.js.map +1 -1
  27. package/lib/commonjs/components/checkbox/CheckboxLabel.js +13 -8
  28. package/lib/commonjs/components/checkbox/CheckboxLabel.js.map +1 -1
  29. package/lib/commonjs/components/common/AnimatedTick.js +7 -3
  30. package/lib/commonjs/components/common/AnimatedTick.js.map +1 -1
  31. package/lib/commonjs/components/common/LogoPaymentWithFallback.js +9 -3
  32. package/lib/commonjs/components/common/LogoPaymentWithFallback.js.map +1 -1
  33. package/lib/commonjs/components/featureInfo/FeatureInfo.js +9 -6
  34. package/lib/commonjs/components/featureInfo/FeatureInfo.js.map +1 -1
  35. package/lib/commonjs/components/icons/Icon.js +14 -7
  36. package/lib/commonjs/components/icons/Icon.js.map +1 -1
  37. package/lib/commonjs/components/layout/HeaderFirstLevel.js +7 -10
  38. package/lib/commonjs/components/layout/HeaderFirstLevel.js.map +1 -1
  39. package/lib/commonjs/components/layout/HeaderSecondLevel.js +8 -9
  40. package/lib/commonjs/components/layout/HeaderSecondLevel.js.map +1 -1
  41. package/lib/commonjs/components/layout/index.js +0 -11
  42. package/lib/commonjs/components/layout/index.js.map +1 -1
  43. package/lib/commonjs/components/listitems/ListItemAction.js +24 -46
  44. package/lib/commonjs/components/listitems/ListItemAction.js.map +1 -1
  45. package/lib/commonjs/components/listitems/ListItemAmount.js +13 -11
  46. package/lib/commonjs/components/listitems/ListItemAmount.js.map +1 -1
  47. package/lib/commonjs/components/listitems/ListItemCheckbox.js +25 -48
  48. package/lib/commonjs/components/listitems/ListItemCheckbox.js.map +1 -1
  49. package/lib/commonjs/components/listitems/ListItemHeader.js +11 -4
  50. package/lib/commonjs/components/listitems/ListItemHeader.js.map +1 -1
  51. package/lib/commonjs/components/listitems/ListItemInfo.js +14 -17
  52. package/lib/commonjs/components/listitems/ListItemInfo.js.map +1 -1
  53. package/lib/commonjs/components/listitems/ListItemInfoCopy.js +29 -55
  54. package/lib/commonjs/components/listitems/ListItemInfoCopy.js.map +1 -1
  55. package/lib/commonjs/components/listitems/ListItemNav.js +36 -64
  56. package/lib/commonjs/components/listitems/ListItemNav.js.map +1 -1
  57. package/lib/commonjs/components/listitems/ListItemNavAlert.js +32 -58
  58. package/lib/commonjs/components/listitems/ListItemNavAlert.js.map +1 -1
  59. package/lib/commonjs/components/listitems/ListItemRadio.js +43 -58
  60. package/lib/commonjs/components/listitems/ListItemRadio.js.map +1 -1
  61. package/lib/commonjs/components/listitems/ListItemRadioWithAmount.js +7 -2
  62. package/lib/commonjs/components/listitems/ListItemRadioWithAmount.js.map +1 -1
  63. package/lib/commonjs/components/listitems/ListItemSwitch.js +12 -14
  64. package/lib/commonjs/components/listitems/ListItemSwitch.js.map +1 -1
  65. package/lib/commonjs/components/listitems/ListItemTransaction.js +4 -2
  66. package/lib/commonjs/components/listitems/ListItemTransaction.js.map +1 -1
  67. package/lib/commonjs/components/listitems/{PressableListItemsBase.js → PressableListItemBase.js} +7 -7
  68. package/lib/commonjs/components/listitems/PressableListItemBase.js.map +1 -0
  69. package/lib/commonjs/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +442 -430
  70. package/lib/commonjs/components/listitems/__test__/listitem.test.js +3 -3
  71. package/lib/commonjs/components/listitems/__test__/listitem.test.js.map +1 -1
  72. package/lib/commonjs/components/listitems/index.js +11 -11
  73. package/lib/commonjs/components/listitems/index.js.map +1 -1
  74. package/lib/commonjs/components/modules/ModuleCredential.js +7 -2
  75. package/lib/commonjs/components/modules/ModuleCredential.js.map +1 -1
  76. package/lib/commonjs/components/modules/ModuleNavigation.js +5 -1
  77. package/lib/commonjs/components/modules/ModuleNavigation.js.map +1 -1
  78. package/lib/commonjs/components/modules/PressableModuleBase.js +17 -11
  79. package/lib/commonjs/components/modules/PressableModuleBase.js.map +1 -1
  80. package/lib/commonjs/components/modules/index.js +8 -8
  81. package/lib/commonjs/components/modules/index.js.map +1 -1
  82. package/lib/commonjs/components/numberpad/NumberButton.js +12 -28
  83. package/lib/commonjs/components/numberpad/NumberButton.js.map +1 -1
  84. package/lib/commonjs/components/numberpad/__test__/__snapshots__/NumberPad.test.tsx.snap +40 -20
  85. package/lib/commonjs/components/pictograms/Pictogram.js +17 -4
  86. package/lib/commonjs/components/pictograms/Pictogram.js.map +1 -1
  87. package/lib/commonjs/components/radio/AnimatedRadio.js +16 -15
  88. package/lib/commonjs/components/radio/AnimatedRadio.js.map +1 -1
  89. package/lib/commonjs/components/radio/RadioButtonLabel.js +9 -5
  90. package/lib/commonjs/components/radio/RadioButtonLabel.js.map +1 -1
  91. package/lib/commonjs/components/searchInput/SearchInput.js +4 -3
  92. package/lib/commonjs/components/searchInput/SearchInput.js.map +1 -1
  93. package/lib/commonjs/components/spacer/Spacer.js +13 -6
  94. package/lib/commonjs/components/spacer/Spacer.js.map +1 -1
  95. package/lib/commonjs/components/stack/Stack.js +19 -9
  96. package/lib/commonjs/components/stack/Stack.js.map +1 -1
  97. package/lib/commonjs/components/tabs/TabItem.js +15 -21
  98. package/lib/commonjs/components/tabs/TabItem.js.map +1 -1
  99. package/lib/commonjs/components/tag/Tag.js +21 -8
  100. package/lib/commonjs/components/tag/Tag.js.map +1 -1
  101. package/lib/commonjs/components/textInput/TextInput.js.map +1 -1
  102. package/lib/commonjs/components/textInput/TextInputBase.js +23 -10
  103. package/lib/commonjs/components/textInput/TextInputBase.js.map +1 -1
  104. package/lib/commonjs/components/typography/IOText.js +3 -6
  105. package/lib/commonjs/components/typography/IOText.js.map +1 -1
  106. package/lib/commonjs/components/typography/__test__/__snapshots__/ComposedBodyFromArray.test.tsx.snap +84 -84
  107. package/lib/commonjs/components/typography/__test__/__snapshots__/typography.test.tsx.snap +50 -50
  108. package/lib/commonjs/core/IOAnimations.js +6 -12
  109. package/lib/commonjs/core/IOAnimations.js.map +1 -1
  110. package/lib/commonjs/hooks/index.js +28 -0
  111. package/lib/commonjs/hooks/index.js.map +1 -0
  112. package/lib/commonjs/hooks/useListItemAnimation.js +40 -0
  113. package/lib/commonjs/hooks/useListItemAnimation.js.map +1 -0
  114. package/lib/commonjs/hooks/useScaleAnimation.js +36 -0
  115. package/lib/commonjs/hooks/useScaleAnimation.js.map +1 -0
  116. package/lib/commonjs/index.js +11 -0
  117. package/lib/commonjs/index.js.map +1 -1
  118. package/lib/commonjs/utils/accessibility.js +29 -1
  119. package/lib/commonjs/utils/accessibility.js.map +1 -1
  120. package/lib/commonjs/utils/fonts.js +3 -2
  121. package/lib/commonjs/utils/fonts.js.map +1 -1
  122. package/lib/commonjs/utils/hooks/index.js +28 -0
  123. package/lib/commonjs/utils/hooks/index.js.map +1 -0
  124. package/lib/commonjs/utils/hooks/useSpringPressProgressValue.js +5 -7
  125. package/lib/commonjs/utils/hooks/useSpringPressProgressValue.js.map +1 -1
  126. package/lib/module/components/Advice/__test__/__snapshots__/advice.test.tsx.snap +3 -3
  127. package/lib/module/components/alert/Alert.js +45 -67
  128. package/lib/module/components/alert/Alert.js.map +1 -1
  129. package/lib/module/components/alert/AlertEdgeToEdge.js +10 -31
  130. package/lib/module/components/alert/AlertEdgeToEdge.js.map +1 -1
  131. package/lib/module/components/badge/Badge.js +16 -3
  132. package/lib/module/components/badge/Badge.js.map +1 -1
  133. package/lib/module/components/badge/__test__/__snapshots__/badge.test.tsx.snap +9 -5
  134. package/lib/module/components/banner/Banner.js +10 -33
  135. package/lib/module/components/banner/Banner.js.map +1 -1
  136. package/lib/module/components/banner/__test__/__snapshots__/banner.test.tsx.snap +6 -6
  137. package/lib/module/components/buttons/ButtonLink.js +29 -57
  138. package/lib/module/components/buttons/ButtonLink.js.map +1 -1
  139. package/lib/module/components/buttons/ButtonOutline.js +30 -48
  140. package/lib/module/components/buttons/ButtonOutline.js.map +1 -1
  141. package/lib/module/components/buttons/ButtonSolid.js +27 -48
  142. package/lib/module/components/buttons/ButtonSolid.js.map +1 -1
  143. package/lib/module/components/buttons/IconButton.js +18 -35
  144. package/lib/module/components/buttons/IconButton.js.map +1 -1
  145. package/lib/module/components/buttons/IconButtonContained.js +21 -45
  146. package/lib/module/components/buttons/IconButtonContained.js.map +1 -1
  147. package/lib/module/components/buttons/IconButtonSolid.js +18 -34
  148. package/lib/module/components/buttons/IconButtonSolid.js.map +1 -1
  149. package/lib/module/components/buttons/__test__/__snapshots__/button.test.tsx.snap +61 -19
  150. package/lib/module/components/checkbox/AnimatedCheckbox.js +23 -18
  151. package/lib/module/components/checkbox/AnimatedCheckbox.js.map +1 -1
  152. package/lib/module/components/checkbox/CheckboxLabel.js +14 -9
  153. package/lib/module/components/checkbox/CheckboxLabel.js.map +1 -1
  154. package/lib/module/components/common/AnimatedTick.js +7 -3
  155. package/lib/module/components/common/AnimatedTick.js.map +1 -1
  156. package/lib/module/components/common/LogoPaymentWithFallback.js +9 -3
  157. package/lib/module/components/common/LogoPaymentWithFallback.js.map +1 -1
  158. package/lib/module/components/featureInfo/FeatureInfo.js +11 -8
  159. package/lib/module/components/featureInfo/FeatureInfo.js.map +1 -1
  160. package/lib/module/components/icons/Icon.js +15 -6
  161. package/lib/module/components/icons/Icon.js.map +1 -1
  162. package/lib/module/components/layout/HeaderFirstLevel.js +8 -11
  163. package/lib/module/components/layout/HeaderFirstLevel.js.map +1 -1
  164. package/lib/module/components/layout/HeaderSecondLevel.js +9 -10
  165. package/lib/module/components/layout/HeaderSecondLevel.js.map +1 -1
  166. package/lib/module/components/layout/index.js +0 -1
  167. package/lib/module/components/layout/index.js.map +1 -1
  168. package/lib/module/components/listitems/ListItemAction.js +25 -48
  169. package/lib/module/components/listitems/ListItemAction.js.map +1 -1
  170. package/lib/module/components/listitems/ListItemAmount.js +13 -11
  171. package/lib/module/components/listitems/ListItemAmount.js.map +1 -1
  172. package/lib/module/components/listitems/ListItemCheckbox.js +28 -51
  173. package/lib/module/components/listitems/ListItemCheckbox.js.map +1 -1
  174. package/lib/module/components/listitems/ListItemHeader.js +11 -4
  175. package/lib/module/components/listitems/ListItemHeader.js.map +1 -1
  176. package/lib/module/components/listitems/ListItemInfo.js +14 -17
  177. package/lib/module/components/listitems/ListItemInfo.js.map +1 -1
  178. package/lib/module/components/listitems/ListItemInfoCopy.js +30 -57
  179. package/lib/module/components/listitems/ListItemInfoCopy.js.map +1 -1
  180. package/lib/module/components/listitems/ListItemNav.js +38 -65
  181. package/lib/module/components/listitems/ListItemNav.js.map +1 -1
  182. package/lib/module/components/listitems/ListItemNavAlert.js +33 -58
  183. package/lib/module/components/listitems/ListItemNavAlert.js.map +1 -1
  184. package/lib/module/components/listitems/ListItemRadio.js +46 -61
  185. package/lib/module/components/listitems/ListItemRadio.js.map +1 -1
  186. package/lib/module/components/listitems/ListItemRadioWithAmount.js +7 -2
  187. package/lib/module/components/listitems/ListItemRadioWithAmount.js.map +1 -1
  188. package/lib/module/components/listitems/ListItemSwitch.js +12 -14
  189. package/lib/module/components/listitems/ListItemSwitch.js.map +1 -1
  190. package/lib/module/components/listitems/ListItemTransaction.js +3 -1
  191. package/lib/module/components/listitems/ListItemTransaction.js.map +1 -1
  192. package/lib/module/components/listitems/{PressableListItemsBase.js → PressableListItemBase.js} +7 -7
  193. package/lib/module/components/listitems/PressableListItemBase.js.map +1 -0
  194. package/lib/module/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +442 -430
  195. package/lib/module/components/listitems/__test__/listitem.test.js +1 -1
  196. package/lib/module/components/listitems/__test__/listitem.test.js.map +1 -1
  197. package/lib/module/components/listitems/index.js +1 -1
  198. package/lib/module/components/listitems/index.js.map +1 -1
  199. package/lib/module/components/modules/ModuleCredential.js +7 -2
  200. package/lib/module/components/modules/ModuleCredential.js.map +1 -1
  201. package/lib/module/components/modules/ModuleNavigation.js +5 -1
  202. package/lib/module/components/modules/ModuleNavigation.js.map +1 -1
  203. package/lib/module/components/modules/PressableModuleBase.js +17 -10
  204. package/lib/module/components/modules/PressableModuleBase.js.map +1 -1
  205. package/lib/module/components/modules/index.js +1 -1
  206. package/lib/module/components/modules/index.js.map +1 -1
  207. package/lib/module/components/numberpad/NumberButton.js +14 -30
  208. package/lib/module/components/numberpad/NumberButton.js.map +1 -1
  209. package/lib/module/components/numberpad/__test__/__snapshots__/NumberPad.test.tsx.snap +40 -20
  210. package/lib/module/components/pictograms/Pictogram.js +17 -4
  211. package/lib/module/components/pictograms/Pictogram.js.map +1 -1
  212. package/lib/module/components/radio/AnimatedRadio.js +16 -15
  213. package/lib/module/components/radio/AnimatedRadio.js.map +1 -1
  214. package/lib/module/components/radio/RadioButtonLabel.js +10 -6
  215. package/lib/module/components/radio/RadioButtonLabel.js.map +1 -1
  216. package/lib/module/components/searchInput/SearchInput.js +5 -4
  217. package/lib/module/components/searchInput/SearchInput.js.map +1 -1
  218. package/lib/module/components/spacer/Spacer.js +11 -5
  219. package/lib/module/components/spacer/Spacer.js.map +1 -1
  220. package/lib/module/components/stack/Stack.js +19 -9
  221. package/lib/module/components/stack/Stack.js.map +1 -1
  222. package/lib/module/components/tabs/TabItem.js +18 -24
  223. package/lib/module/components/tabs/TabItem.js.map +1 -1
  224. package/lib/module/components/tag/Tag.js +21 -8
  225. package/lib/module/components/tag/Tag.js.map +1 -1
  226. package/lib/module/components/textInput/TextInput.js.map +1 -1
  227. package/lib/module/components/textInput/TextInputBase.js +23 -10
  228. package/lib/module/components/textInput/TextInputBase.js.map +1 -1
  229. package/lib/module/components/typography/IOText.js +5 -8
  230. package/lib/module/components/typography/IOText.js.map +1 -1
  231. package/lib/module/components/typography/__test__/__snapshots__/ComposedBodyFromArray.test.tsx.snap +84 -84
  232. package/lib/module/components/typography/__test__/__snapshots__/typography.test.tsx.snap +50 -50
  233. package/lib/module/core/IOAnimations.js +4 -10
  234. package/lib/module/core/IOAnimations.js.map +1 -1
  235. package/lib/module/hooks/index.js +3 -0
  236. package/lib/module/hooks/index.js.map +1 -0
  237. package/lib/module/hooks/useListItemAnimation.js +33 -0
  238. package/lib/module/hooks/useListItemAnimation.js.map +1 -0
  239. package/lib/module/hooks/useScaleAnimation.js +29 -0
  240. package/lib/module/hooks/useScaleAnimation.js.map +1 -0
  241. package/lib/module/index.js +1 -0
  242. package/lib/module/index.js.map +1 -1
  243. package/lib/module/utils/accessibility.js +28 -1
  244. package/lib/module/utils/accessibility.js.map +1 -1
  245. package/lib/module/utils/fonts.js +1 -0
  246. package/lib/module/utils/fonts.js.map +1 -1
  247. package/lib/module/utils/hooks/index.js +3 -0
  248. package/lib/module/utils/hooks/index.js.map +1 -0
  249. package/lib/module/utils/hooks/useSpringPressProgressValue.js +5 -5
  250. package/lib/module/utils/hooks/useSpringPressProgressValue.js.map +1 -1
  251. package/lib/typescript/components/alert/Alert.d.ts.map +1 -1
  252. package/lib/typescript/components/alert/AlertEdgeToEdge.d.ts.map +1 -1
  253. package/lib/typescript/components/badge/Badge.d.ts +2 -1
  254. package/lib/typescript/components/badge/Badge.d.ts.map +1 -1
  255. package/lib/typescript/components/banner/Banner.d.ts.map +1 -1
  256. package/lib/typescript/components/buttons/ButtonLink.d.ts +1 -1
  257. package/lib/typescript/components/buttons/ButtonLink.d.ts.map +1 -1
  258. package/lib/typescript/components/buttons/ButtonOutline.d.ts +1 -1
  259. package/lib/typescript/components/buttons/ButtonOutline.d.ts.map +1 -1
  260. package/lib/typescript/components/buttons/ButtonSolid.d.ts +1 -1
  261. package/lib/typescript/components/buttons/ButtonSolid.d.ts.map +1 -1
  262. package/lib/typescript/components/buttons/IconButton.d.ts.map +1 -1
  263. package/lib/typescript/components/buttons/IconButtonContained.d.ts.map +1 -1
  264. package/lib/typescript/components/buttons/IconButtonSolid.d.ts.map +1 -1
  265. package/lib/typescript/components/checkbox/AnimatedCheckbox.d.ts +2 -1
  266. package/lib/typescript/components/checkbox/AnimatedCheckbox.d.ts.map +1 -1
  267. package/lib/typescript/components/checkbox/CheckboxLabel.d.ts +2 -1
  268. package/lib/typescript/components/checkbox/CheckboxLabel.d.ts.map +1 -1
  269. package/lib/typescript/components/common/AnimatedTick.d.ts +4 -3
  270. package/lib/typescript/components/common/AnimatedTick.d.ts.map +1 -1
  271. package/lib/typescript/components/common/LogoPaymentWithFallback.d.ts.map +1 -1
  272. package/lib/typescript/components/featureInfo/FeatureInfo.d.ts.map +1 -1
  273. package/lib/typescript/components/icons/Icon.d.ts +5 -3
  274. package/lib/typescript/components/icons/Icon.d.ts.map +1 -1
  275. package/lib/typescript/components/layout/HeaderFirstLevel.d.ts.map +1 -1
  276. package/lib/typescript/components/layout/HeaderSecondLevel.d.ts.map +1 -1
  277. package/lib/typescript/components/layout/index.d.ts +0 -1
  278. package/lib/typescript/components/layout/index.d.ts.map +1 -1
  279. package/lib/typescript/components/listitems/ListItemAction.d.ts.map +1 -1
  280. package/lib/typescript/components/listitems/ListItemAmount.d.ts.map +1 -1
  281. package/lib/typescript/components/listitems/ListItemCheckbox.d.ts.map +1 -1
  282. package/lib/typescript/components/listitems/ListItemHeader.d.ts.map +1 -1
  283. package/lib/typescript/components/listitems/ListItemInfo.d.ts.map +1 -1
  284. package/lib/typescript/components/listitems/ListItemInfoCopy.d.ts.map +1 -1
  285. package/lib/typescript/components/listitems/ListItemNav.d.ts.map +1 -1
  286. package/lib/typescript/components/listitems/ListItemNavAlert.d.ts.map +1 -1
  287. package/lib/typescript/components/listitems/ListItemRadio.d.ts.map +1 -1
  288. package/lib/typescript/components/listitems/ListItemRadioWithAmount.d.ts.map +1 -1
  289. package/lib/typescript/components/listitems/ListItemSwitch.d.ts +2 -2
  290. package/lib/typescript/components/listitems/ListItemSwitch.d.ts.map +1 -1
  291. package/lib/typescript/components/listitems/ListItemTransaction.d.ts +1 -1
  292. package/lib/typescript/components/listitems/ListItemTransaction.d.ts.map +1 -1
  293. package/lib/typescript/components/listitems/{PressableListItemsBase.d.ts → PressableListItemBase.d.ts} +3 -2
  294. package/lib/typescript/components/listitems/PressableListItemBase.d.ts.map +1 -0
  295. package/lib/typescript/components/listitems/index.d.ts +1 -1
  296. package/lib/typescript/components/listitems/index.d.ts.map +1 -1
  297. package/lib/typescript/components/modules/ModuleCredential.d.ts.map +1 -1
  298. package/lib/typescript/components/modules/ModuleNavigation.d.ts.map +1 -1
  299. package/lib/typescript/components/modules/PressableModuleBase.d.ts.map +1 -1
  300. package/lib/typescript/components/modules/index.d.ts +1 -1
  301. package/lib/typescript/components/modules/index.d.ts.map +1 -1
  302. package/lib/typescript/components/numberpad/NumberButton.d.ts.map +1 -1
  303. package/lib/typescript/components/pictograms/Pictogram.d.ts +5 -3
  304. package/lib/typescript/components/pictograms/Pictogram.d.ts.map +1 -1
  305. package/lib/typescript/components/pictograms/types.d.ts +1 -2
  306. package/lib/typescript/components/pictograms/types.d.ts.map +1 -1
  307. package/lib/typescript/components/radio/AnimatedRadio.d.ts +2 -1
  308. package/lib/typescript/components/radio/AnimatedRadio.d.ts.map +1 -1
  309. package/lib/typescript/components/radio/RadioButtonLabel.d.ts +2 -1
  310. package/lib/typescript/components/radio/RadioButtonLabel.d.ts.map +1 -1
  311. package/lib/typescript/components/searchInput/SearchInput.d.ts.map +1 -1
  312. package/lib/typescript/components/spacer/Spacer.d.ts +1 -0
  313. package/lib/typescript/components/spacer/Spacer.d.ts.map +1 -1
  314. package/lib/typescript/components/stack/Stack.d.ts +2 -1
  315. package/lib/typescript/components/stack/Stack.d.ts.map +1 -1
  316. package/lib/typescript/components/tabs/TabItem.d.ts.map +1 -1
  317. package/lib/typescript/components/tag/Tag.d.ts +4 -2
  318. package/lib/typescript/components/tag/Tag.d.ts.map +1 -1
  319. package/lib/typescript/components/textInput/TextInput.d.ts +2 -1
  320. package/lib/typescript/components/textInput/TextInput.d.ts.map +1 -1
  321. package/lib/typescript/components/textInput/TextInputBase.d.ts.map +1 -1
  322. package/lib/typescript/components/typography/BodyMonospace.d.ts +1 -1
  323. package/lib/typescript/components/typography/ButtonText.d.ts +1 -1
  324. package/lib/typescript/components/typography/Caption.d.ts +1 -1
  325. package/lib/typescript/components/typography/H1.d.ts +1 -1
  326. package/lib/typescript/components/typography/H2.d.ts +1 -1
  327. package/lib/typescript/components/typography/H3.d.ts +1 -1
  328. package/lib/typescript/components/typography/H4.d.ts +1 -1
  329. package/lib/typescript/components/typography/H5.d.ts +1 -1
  330. package/lib/typescript/components/typography/H6.d.ts +1 -1
  331. package/lib/typescript/components/typography/Hero.d.ts +1 -1
  332. package/lib/typescript/components/typography/IOText.d.ts.map +1 -1
  333. package/lib/typescript/components/typography/markdown/MdH1.d.ts +1 -1
  334. package/lib/typescript/components/typography/markdown/MdH2.d.ts +1 -1
  335. package/lib/typescript/components/typography/markdown/MdH3.d.ts +1 -1
  336. package/lib/typescript/core/IOAnimations.d.ts +6 -10
  337. package/lib/typescript/core/IOAnimations.d.ts.map +1 -1
  338. package/lib/typescript/core/IOStyles.d.ts +7 -7
  339. package/lib/typescript/hooks/index.d.ts +3 -0
  340. package/lib/typescript/hooks/index.d.ts.map +1 -0
  341. package/lib/typescript/hooks/useListItemAnimation.d.ts +10 -0
  342. package/lib/typescript/hooks/useListItemAnimation.d.ts.map +1 -0
  343. package/lib/typescript/hooks/useScaleAnimation.d.ts +10 -0
  344. package/lib/typescript/hooks/useScaleAnimation.d.ts.map +1 -0
  345. package/lib/typescript/index.d.ts +1 -0
  346. package/lib/typescript/index.d.ts.map +1 -1
  347. package/lib/typescript/utils/accessibility.d.ts +10 -0
  348. package/lib/typescript/utils/accessibility.d.ts.map +1 -1
  349. package/lib/typescript/utils/fonts.d.ts +2 -1
  350. package/lib/typescript/utils/fonts.d.ts.map +1 -1
  351. package/lib/typescript/utils/hooks/index.d.ts +3 -0
  352. package/lib/typescript/utils/hooks/index.d.ts.map +1 -0
  353. package/lib/typescript/utils/hooks/useSpringPressProgressValue.d.ts +7 -8
  354. package/lib/typescript/utils/hooks/useSpringPressProgressValue.d.ts.map +1 -1
  355. package/package.json +1 -1
  356. package/src/components/Advice/__test__/__snapshots__/advice.test.tsx.snap +3 -3
  357. package/src/components/alert/Alert.tsx +49 -106
  358. package/src/components/alert/AlertEdgeToEdge.tsx +6 -46
  359. package/src/components/badge/Badge.tsx +29 -4
  360. package/src/components/badge/__test__/__snapshots__/badge.test.tsx.snap +9 -5
  361. package/src/components/banner/Banner.tsx +6 -54
  362. package/src/components/banner/__test__/__snapshots__/banner.test.tsx.snap +6 -6
  363. package/src/components/buttons/ButtonLink.tsx +36 -89
  364. package/src/components/buttons/ButtonOutline.tsx +40 -75
  365. package/src/components/buttons/ButtonSolid.tsx +21 -67
  366. package/src/components/buttons/IconButton.tsx +12 -47
  367. package/src/components/buttons/IconButtonContained.tsx +21 -57
  368. package/src/components/buttons/IconButtonSolid.tsx +16 -46
  369. package/src/components/buttons/__test__/__snapshots__/button.test.tsx.snap +61 -19
  370. package/src/components/checkbox/AnimatedCheckbox.tsx +36 -18
  371. package/src/components/checkbox/CheckboxLabel.tsx +22 -10
  372. package/src/components/common/AnimatedTick.tsx +9 -3
  373. package/src/components/common/LogoPaymentWithFallback.tsx +27 -5
  374. package/src/components/featureInfo/FeatureInfo.tsx +13 -9
  375. package/src/components/icons/Icon.tsx +23 -7
  376. package/src/components/layout/HeaderFirstLevel.tsx +11 -21
  377. package/src/components/layout/HeaderSecondLevel.tsx +5 -14
  378. package/src/components/layout/index.tsx +0 -1
  379. package/src/components/listitems/ListItemAction.tsx +28 -73
  380. package/src/components/listitems/ListItemAmount.tsx +16 -11
  381. package/src/components/listitems/ListItemCheckbox.tsx +39 -83
  382. package/src/components/listitems/ListItemHeader.tsx +14 -4
  383. package/src/components/listitems/ListItemInfo.tsx +27 -20
  384. package/src/components/listitems/ListItemInfoCopy.tsx +37 -86
  385. package/src/components/listitems/ListItemNav.tsx +55 -112
  386. package/src/components/listitems/ListItemNavAlert.tsx +42 -102
  387. package/src/components/listitems/ListItemRadio.tsx +60 -107
  388. package/src/components/listitems/ListItemRadioWithAmount.tsx +9 -3
  389. package/src/components/listitems/ListItemSwitch.tsx +21 -27
  390. package/src/components/listitems/ListItemTransaction.tsx +4 -1
  391. package/src/components/listitems/{PressableListItemsBase.tsx → PressableListItemBase.tsx} +7 -6
  392. package/src/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +442 -430
  393. package/src/components/listitems/__test__/listitem.test.tsx +1 -1
  394. package/src/components/listitems/index.tsx +1 -1
  395. package/src/components/modules/ModuleCredential.tsx +5 -2
  396. package/src/components/modules/ModuleNavigation.tsx +3 -1
  397. package/src/components/modules/PressableModuleBase.tsx +15 -8
  398. package/src/components/modules/index.tsx +1 -1
  399. package/src/components/numberpad/NumberButton.tsx +12 -43
  400. package/src/components/numberpad/__test__/__snapshots__/NumberPad.test.tsx.snap +40 -20
  401. package/src/components/pictograms/Pictogram.tsx +24 -5
  402. package/src/components/pictograms/types.ts +1 -3
  403. package/src/components/radio/AnimatedRadio.tsx +31 -15
  404. package/src/components/radio/RadioButtonLabel.tsx +16 -8
  405. package/src/components/searchInput/SearchInput.tsx +10 -5
  406. package/src/components/spacer/Spacer.tsx +21 -6
  407. package/src/components/stack/Stack.tsx +25 -14
  408. package/src/components/tabs/TabItem.tsx +15 -29
  409. package/src/components/tag/Tag.tsx +26 -8
  410. package/src/components/textInput/TextInput.tsx +2 -1
  411. package/src/components/textInput/TextInputBase.tsx +44 -11
  412. package/src/components/typography/IOText.tsx +5 -6
  413. package/src/components/typography/__test__/__snapshots__/ComposedBodyFromArray.test.tsx.snap +84 -84
  414. package/src/components/typography/__test__/__snapshots__/typography.test.tsx.snap +50 -50
  415. package/src/core/IOAnimations.ts +8 -10
  416. package/src/hooks/index.tsx +2 -0
  417. package/src/hooks/useListItemAnimation.tsx +59 -0
  418. package/src/hooks/useScaleAnimation.tsx +41 -0
  419. package/src/index.tsx +1 -0
  420. package/src/utils/accessibility.ts +32 -1
  421. package/src/utils/fonts.ts +1 -0
  422. package/src/utils/hooks/index.tsx +2 -0
  423. package/src/utils/hooks/useSpringPressProgressValue.ts +14 -8
  424. package/lib/commonjs/components/layout/FooterWithButtons.js +0 -84
  425. package/lib/commonjs/components/layout/FooterWithButtons.js.map +0 -1
  426. package/lib/commonjs/components/listitems/PressableListItemsBase.js.map +0 -1
  427. package/lib/commonjs/components/listitems/hooks/useListItemSpringAnimation.js +0 -56
  428. package/lib/commonjs/components/listitems/hooks/useListItemSpringAnimation.js.map +0 -1
  429. package/lib/commonjs/components/modules/hooks/useModuleSpringAnimation.js +0 -41
  430. package/lib/commonjs/components/modules/hooks/useModuleSpringAnimation.js.map +0 -1
  431. package/lib/module/components/layout/FooterWithButtons.js +0 -75
  432. package/lib/module/components/layout/FooterWithButtons.js.map +0 -1
  433. package/lib/module/components/listitems/PressableListItemsBase.js.map +0 -1
  434. package/lib/module/components/listitems/hooks/useListItemSpringAnimation.js +0 -47
  435. package/lib/module/components/listitems/hooks/useListItemSpringAnimation.js.map +0 -1
  436. package/lib/module/components/modules/hooks/useModuleSpringAnimation.js +0 -34
  437. package/lib/module/components/modules/hooks/useModuleSpringAnimation.js.map +0 -1
  438. package/lib/typescript/components/layout/FooterWithButtons.d.ts +0 -16
  439. package/lib/typescript/components/layout/FooterWithButtons.d.ts.map +0 -1
  440. package/lib/typescript/components/listitems/PressableListItemsBase.d.ts.map +0 -1
  441. package/lib/typescript/components/listitems/hooks/useListItemSpringAnimation.d.ts +0 -13
  442. package/lib/typescript/components/listitems/hooks/useListItemSpringAnimation.d.ts.map +0 -1
  443. package/lib/typescript/components/modules/hooks/useModuleSpringAnimation.d.ts +0 -10
  444. package/lib/typescript/components/modules/hooks/useModuleSpringAnimation.d.ts.map +0 -1
  445. package/src/components/layout/FooterWithButtons.tsx +0 -90
  446. package/src/components/listitems/hooks/useListItemSpringAnimation.ts +0 -72
  447. package/src/components/modules/hooks/useModuleSpringAnimation.ts +0 -49
@@ -1,23 +1,18 @@
1
- import React, { useCallback, useMemo } from "react";
1
+ import React, { forwardRef, useMemo } from "react";
2
2
  import { GestureResponderEvent, Pressable, View } from "react-native";
3
3
  import Animated, {
4
- Extrapolate,
5
- interpolate,
6
4
  interpolateColor,
7
- useAnimatedProps,
8
5
  useAnimatedStyle,
9
- useDerivedValue,
10
- useSharedValue,
11
- withSpring
6
+ useReducedMotion
12
7
  } from "react-native-reanimated";
13
8
  import {
14
9
  IOButtonStyles,
15
10
  IOColors,
16
- IOScaleValues,
17
- IOSpringValues,
11
+ IOSpacingScale,
18
12
  hexToRgba,
19
13
  useIOExperimentalDesign
20
14
  } from "../../core";
15
+ import { useScaleAnimation } from "../../hooks";
21
16
  import { WithTestID } from "../../utils/types";
22
17
  import {
23
18
  AnimatedIcon,
@@ -25,7 +20,6 @@ import {
25
20
  IOIcons,
26
21
  IconClassComponent
27
22
  } from "../icons";
28
- import { HSpacer } from "../spacer/Spacer";
29
23
  import { IOText, buttonTextFontSize } from "../typography";
30
24
 
31
25
  export type ColorButtonLink = "primary" | "contrast";
@@ -96,8 +90,9 @@ const mapLegacyColorStates: Record<
96
90
  };
97
91
 
98
92
  const DISABLED_OPACITY = 0.5;
93
+ const ICON_MARGIN = 8;
99
94
 
100
- export const ButtonLink = React.forwardRef<View, ButtonLinkProps>(
95
+ export const ButtonLink = forwardRef<View, ButtonLinkProps>(
101
96
  (
102
97
  {
103
98
  color = "primary",
@@ -112,8 +107,10 @@ export const ButtonLink = React.forwardRef<View, ButtonLinkProps>(
112
107
  },
113
108
  ref
114
109
  ) => {
115
- const isPressed = useSharedValue(0);
116
110
  const { isExperimental } = useIOExperimentalDesign();
111
+ const { progress, onPressIn, onPressOut, scaleAnimatedStyle } =
112
+ useScaleAnimation();
113
+ const reducedMotion = useReducedMotion();
117
114
 
118
115
  const colorMap = useMemo(
119
116
  () => (isExperimental ? mapColorStates : mapLegacyColorStates),
@@ -122,70 +119,20 @@ export const ButtonLink = React.forwardRef<View, ButtonLinkProps>(
122
119
 
123
120
  const AnimatedIOText = Animated.createAnimatedComponent(IOText);
124
121
 
125
- // Scaling transformation applied when the button is pressed
126
- const animationScaleValue = IOScaleValues?.basicButton?.pressedState;
127
-
128
- // Using a spring-based animation for our interpolations
129
- const progressPressed = useDerivedValue(() =>
130
- withSpring(isPressed.value, IOSpringValues.button)
131
- );
132
-
133
- // Interpolate animation values from `isPressed` values
134
- const pressedAnimationStyle = useAnimatedStyle(() => {
135
- // Link color states to the pressed states
136
-
137
- // Scale down button slightly when pressed
138
- const scale = interpolate(
139
- progressPressed.value,
140
- [0, 1],
141
- [1, animationScaleValue],
142
- Extrapolate.CLAMP
143
- );
144
-
145
- return {
146
- transform: [{ scale }]
147
- };
148
- });
149
-
150
- const pressedColorLabelAnimationStyle = useAnimatedStyle(() => {
151
- // Link color states to the pressed states
152
-
153
- const labelColor = interpolateColor(
154
- progressPressed.value,
122
+ const pressedColorAnimationStyle = useAnimatedStyle(() => ({
123
+ color: interpolateColor(
124
+ progress.value,
155
125
  [0, 1],
156
126
  [colorMap[color].label.default, colorMap[color].label.pressed]
157
- );
158
-
159
- return {
160
- color: labelColor
161
- };
162
- });
163
-
164
- // Animate the <Icon> color prop
165
- const pressedColorIconAnimationStyle = useAnimatedProps(() => {
166
- const iconColor = interpolateColor(
167
- progressPressed.value,
168
- [0, 1],
169
- [colorMap[color].label.default, colorMap[color].label.pressed]
170
- );
171
-
172
- return { color: iconColor };
173
- });
127
+ )
128
+ }));
174
129
 
175
130
  const AnimatedIconClassComponent =
176
131
  Animated.createAnimatedComponent(IconClassComponent);
177
132
 
178
- const onPressIn = useCallback(() => {
179
- // eslint-disable-next-line functional/immutable-data
180
- isPressed.value = 1;
181
- }, [isPressed]);
182
- const onPressOut = useCallback(() => {
183
- // eslint-disable-next-line functional/immutable-data
184
- isPressed.value = 0;
185
- }, [isPressed]);
186
-
187
133
  // Icon size
188
134
  const iconSize: IOIconSizeScale = 24;
135
+ const iconMargin: IOSpacingScale = 8;
189
136
 
190
137
  return (
191
138
  <Pressable
@@ -208,31 +155,31 @@ export const ButtonLink = React.forwardRef<View, ButtonLinkProps>(
208
155
  style={[
209
156
  IOButtonStyles.buttonLink,
210
157
  iconPosition === "end" && { flexDirection: "row-reverse" },
158
+ { columnGap: iconMargin },
211
159
  disabled ? { opacity: DISABLED_OPACITY } : {},
160
+ { columnGap: ICON_MARGIN },
212
161
  /* Prevent Reanimated from overriding background colors
213
162
  if button is disabled */
214
- !disabled && pressedAnimationStyle
163
+ !disabled && !reducedMotion && scaleAnimatedStyle
215
164
  ]}
216
165
  >
217
- {icon && (
218
- <>
219
- {!disabled ? (
220
- <AnimatedIconClassComponent
221
- name={icon}
222
- animatedProps={pressedColorIconAnimationStyle}
223
- color={colorMap[color]?.label?.default}
224
- size={iconSize}
225
- />
226
- ) : (
227
- <AnimatedIcon
228
- name={icon}
229
- color={colorMap[color]?.label?.disabled}
230
- size={iconSize}
231
- />
232
- )}
233
- <HSpacer size={8} />
234
- </>
235
- )}
166
+ {icon &&
167
+ (!disabled ? (
168
+ <AnimatedIconClassComponent
169
+ allowFontScaling
170
+ name={icon}
171
+ animatedProps={pressedColorAnimationStyle}
172
+ color={colorMap[color]?.label?.default}
173
+ size={iconSize}
174
+ />
175
+ ) : (
176
+ <AnimatedIcon
177
+ allowFontScaling
178
+ name={icon}
179
+ color={colorMap[color]?.label?.disabled}
180
+ size={iconSize}
181
+ />
182
+ ))}
236
183
  <AnimatedIOText
237
184
  accessible={false}
238
185
  accessibilityElementsHidden
@@ -243,7 +190,7 @@ export const ButtonLink = React.forwardRef<View, ButtonLinkProps>(
243
190
  style={
244
191
  disabled
245
192
  ? { color: colorMap[color]?.label?.disabled }
246
- : { ...pressedColorLabelAnimationStyle }
193
+ : { ...pressedColorAnimationStyle }
247
194
  }
248
195
  numberOfLines={1}
249
196
  ellipsizeMode="tail"
@@ -1,4 +1,4 @@
1
- import React, { ComponentProps, useCallback } from "react";
1
+ import React, { ComponentProps, forwardRef } from "react";
2
2
  import {
3
3
  GestureResponderEvent,
4
4
  Pressable,
@@ -6,24 +6,19 @@ import {
6
6
  View
7
7
  } from "react-native";
8
8
  import Animated, {
9
- Extrapolate,
10
- interpolate,
11
9
  interpolateColor,
12
10
  useAnimatedProps,
13
11
  useAnimatedStyle,
14
- useDerivedValue,
15
- useSharedValue,
16
- withSpring
12
+ useReducedMotion
17
13
  } from "react-native-reanimated";
18
14
  import {
19
15
  IOButtonLegacyStyles,
20
16
  IOButtonStyles,
21
17
  IOColors,
22
- IOScaleValues,
23
- IOSpringValues,
24
18
  hexToRgba,
25
19
  useIOExperimentalDesign
26
20
  } from "../../core/";
21
+ import { useScaleAnimation } from "../../hooks";
27
22
  import { WithTestID } from "../../utils/types";
28
23
  import {
29
24
  AnimatedIcon,
@@ -31,7 +26,6 @@ import {
31
26
  IOIcons,
32
27
  IconClassComponent
33
28
  } from "../icons";
34
- import { HSpacer } from "../spacer/Spacer";
35
29
  import { IOText, buttonTextFontSize } from "../typography";
36
30
 
37
31
  type ColorButtonOutline = "primary" | "contrast" | "danger";
@@ -201,6 +195,7 @@ const IOButtonLegacyStylesLocal = StyleSheet.create({
201
195
  const iconSize: IOIconSizeScale = 20;
202
196
 
203
197
  const DISABLED_OPACITY = 0.5;
198
+ const ICON_MARGIN = 8;
204
199
 
205
200
  const IOButtonStylesLocal = StyleSheet.create({
206
201
  buttonWithBorder: {
@@ -208,7 +203,7 @@ const IOButtonStylesLocal = StyleSheet.create({
208
203
  }
209
204
  });
210
205
 
211
- export const ButtonOutline = React.forwardRef<View, ButtonOutline>(
206
+ export const ButtonOutline = forwardRef<View, ButtonOutline>(
212
207
  (
213
208
  {
214
209
  color = "primary",
@@ -225,7 +220,9 @@ export const ButtonOutline = React.forwardRef<View, ButtonOutline>(
225
220
  ref
226
221
  ) => {
227
222
  const { isExperimental } = useIOExperimentalDesign();
228
- const isPressed: Animated.SharedValue<number> = useSharedValue(0);
223
+ const { progress, onPressIn, onPressOut, scaleAnimatedStyle } =
224
+ useScaleAnimation();
225
+ const reducedMotion = useReducedMotion();
229
226
 
230
227
  const AnimatedIOText = Animated.createAnimatedComponent(IOText);
231
228
 
@@ -243,80 +240,48 @@ export const ButtonOutline = React.forwardRef<View, ButtonOutline>(
243
240
  () => (isExperimental ? IOButtonStylesLocal : IOButtonLegacyStylesLocal),
244
241
  [isExperimental]
245
242
  );
246
- // Scaling transformation applied when the button is pressed
247
- const animationScaleValue = IOScaleValues?.basicButton?.pressedState;
248
-
249
- // Using a spring-based animation for our interpolations
250
- const progressPressed = useDerivedValue(() =>
251
- withSpring(isPressed.value, IOSpringValues.button)
252
- );
253
243
 
254
244
  // Interpolate animation values from `isPressed` values
255
245
  const pressedAnimationStyle = useAnimatedStyle(() => {
256
246
  // Link color states to the pressed states
257
247
  const backgroundColor = interpolateColor(
258
- progressPressed.value,
248
+ progress.value,
259
249
  [0, 1],
260
250
  [colorMap[color].background.default, colorMap[color].background.pressed]
261
251
  );
262
252
 
263
253
  const borderColor = interpolateColor(
264
- progressPressed.value,
254
+ progress.value,
265
255
  [0, 1],
266
256
  [colorMap[color].border.default, colorMap[color].border.pressed]
267
257
  );
268
258
 
269
- // Scale down button slightly when pressed
270
- const scale = interpolate(
271
- progressPressed.value,
272
- [0, 1],
273
- [1, animationScaleValue],
274
- Extrapolate.CLAMP
275
- );
276
-
277
259
  return {
278
260
  borderColor,
279
- backgroundColor,
280
- transform: [{ scale }]
261
+ backgroundColor
281
262
  };
282
263
  });
283
264
 
284
- const pressedColorLabelAnimationStyle = useAnimatedStyle(() => {
285
- // Link color states to the pressed states
286
-
287
- const labelColor = interpolateColor(
288
- progressPressed.value,
265
+ const pressedColorLabelAnimationStyle = useAnimatedStyle(() => ({
266
+ color: interpolateColor(
267
+ progress.value,
289
268
  [0, 1],
290
269
  [colorMap[color].border.default, colorMap[color].border.pressed]
291
- );
292
-
293
- return {
294
- color: labelColor
295
- };
296
- });
270
+ )
271
+ }));
297
272
 
298
273
  // Animate the <Icon> color prop
299
- const pressedColorIconAnimationStyle = useAnimatedProps(() => {
300
- const iconColor = interpolateColor(
301
- progressPressed.value,
274
+ const pressedColorIconAnimationStyle = useAnimatedProps(() => ({
275
+ color: interpolateColor(
276
+ progress.value,
302
277
  [0, 1],
303
278
  [colorMap[color].label.default, colorMap[color].label.pressed]
304
- );
305
- return { color: iconColor };
306
- });
279
+ )
280
+ }));
307
281
 
308
282
  const AnimatedIconClassComponent =
309
283
  Animated.createAnimatedComponent(IconClassComponent);
310
284
 
311
- const onPressIn = useCallback(() => {
312
- // eslint-disable-next-line functional/immutable-data
313
- isPressed.value = 1;
314
- }, [isPressed]);
315
- const onPressOut = useCallback(() => {
316
- // eslint-disable-next-line functional/immutable-data
317
- isPressed.value = 0;
318
- }, [isPressed]);
319
-
320
285
  return (
321
286
  <Pressable
322
287
  ref={ref}
@@ -338,6 +303,7 @@ export const ButtonOutline = React.forwardRef<View, ButtonOutline>(
338
303
  isExperimental && fullWidth && { paddingHorizontal: 16 },
339
304
  buttonStylesLocal.buttonWithBorder,
340
305
  buttonStyles.buttonSizeDefault,
306
+ { columnGap: ICON_MARGIN },
341
307
  iconPosition === "end" && { flexDirection: "row-reverse" },
342
308
  disabled
343
309
  ? {
@@ -351,28 +317,27 @@ export const ButtonOutline = React.forwardRef<View, ButtonOutline>(
351
317
  },
352
318
  /* Prevent Reanimated from overriding background colors
353
319
  if button is disabled */
320
+ !reducedMotion && !disabled && scaleAnimatedStyle,
354
321
  !disabled && pressedAnimationStyle
355
322
  ]}
356
323
  >
357
- {icon && (
358
- <>
359
- {!disabled ? (
360
- <AnimatedIconClassComponent
361
- name={icon}
362
- animatedProps={pressedColorIconAnimationStyle}
363
- color={colorMap[color]?.label?.default}
364
- size={iconSize}
365
- />
366
- ) : (
367
- <AnimatedIcon
368
- name={icon}
369
- color={colorMap[color]?.label?.disabled}
370
- size={iconSize}
371
- />
372
- )}
373
- <HSpacer size={8} />
374
- </>
375
- )}
324
+ {icon &&
325
+ (!disabled ? (
326
+ <AnimatedIconClassComponent
327
+ allowFontScaling
328
+ name={icon}
329
+ animatedProps={pressedColorIconAnimationStyle}
330
+ color={colorMap[color]?.label?.default}
331
+ size={iconSize}
332
+ />
333
+ ) : (
334
+ <AnimatedIcon
335
+ allowFontScaling
336
+ name={icon}
337
+ color={colorMap[color]?.label?.disabled}
338
+ size={iconSize}
339
+ />
340
+ ))}
376
341
  <AnimatedIOText
377
342
  font={isExperimental ? "Titillio" : "TitilliumSansPro"}
378
343
  weight={"Semibold"}
@@ -1,4 +1,4 @@
1
- import React, { ComponentProps, useCallback, useEffect, useRef } from "react";
1
+ import React, { ComponentProps, useCallback } from "react";
2
2
  import {
3
3
  GestureResponderEvent,
4
4
  Pressable,
@@ -7,29 +7,23 @@ import {
7
7
  } from "react-native";
8
8
  import ReactNativeHapticFeedback from "react-native-haptic-feedback";
9
9
  import Animated, {
10
- Extrapolate,
11
- interpolate,
12
10
  interpolateColor,
13
11
  useAnimatedStyle,
14
- useDerivedValue,
15
- useSharedValue,
16
- withSpring
12
+ useReducedMotion
17
13
  } from "react-native-reanimated";
18
14
  import {
19
15
  IOButtonLegacyStyles,
20
16
  IOButtonStyles,
21
17
  IOColors,
22
- IOScaleValues,
23
- IOSpringValues,
24
18
  enterTransitionInnerContent,
25
19
  enterTransitionInnerContentSmall,
26
20
  exitTransitionInnerContent,
27
21
  useIOExperimentalDesign
28
22
  } from "../../core";
23
+ import { useScaleAnimation } from "../../hooks";
29
24
  import { WithTestID } from "../../utils/types";
30
25
  import { IOIconSizeScale, IOIcons, Icon } from "../icons";
31
26
  import { LoadingSpinner } from "../loadingSpinner";
32
- import { HSpacer } from "../spacer/Spacer";
33
27
  import { ButtonText } from "../typography/ButtonText";
34
28
 
35
29
  export type ButtonSolidColor = "primary" | "danger" | "contrast";
@@ -53,6 +47,7 @@ const legacyStyles = StyleSheet.create({
53
47
  });
54
48
 
55
49
  const colorPrimaryButtonDisabled: IOColors = "grey-200";
50
+ const ICON_MARGIN = 8;
56
51
  const DISABLED_OPACITY = 0.5;
57
52
 
58
53
  // Icon size
@@ -176,21 +171,10 @@ export const ButtonSolid = React.forwardRef<View, ButtonSolidProps>(
176
171
  },
177
172
  ref
178
173
  ) => {
179
- const isPressed = useSharedValue(0);
180
174
  const { isExperimental } = useIOExperimentalDesign();
181
- // Scaling transformation applied when the button is pressed
182
- const animationScaleValue = IOScaleValues?.basicButton?.pressedState;
183
-
184
- /* Prevent the component from triggering the `isEntering' transition
185
- on the on the first render. Solution from this discussion:
186
- https://github.com/software-mansion/react-native-reanimated/discussions/2513
187
- */
188
- const isMounted = useRef(false);
189
-
190
- useEffect(() => {
191
- // eslint-disable-next-line functional/immutable-data
192
- isMounted.current = true;
193
- }, []);
175
+ const { progress, onPressIn, onPressOut, scaleAnimatedStyle } =
176
+ useScaleAnimation();
177
+ const reducedMotion = useReducedMotion();
194
178
 
195
179
  const colorMap = React.useMemo(
196
180
  () => (isExperimental ? mapColorStates : mapLegacyColorStates),
@@ -202,43 +186,18 @@ export const ButtonSolid = React.forwardRef<View, ButtonSolidProps>(
202
186
  [isExperimental]
203
187
  );
204
188
 
205
- // Using a spring-based animation for our interpolations
206
- const progressPressed = useDerivedValue(() =>
207
- withSpring(isPressed.value, IOSpringValues.button)
208
- );
209
-
210
189
  // Interpolate animation values from `isPressed` values
211
190
  const pressedAnimationStyle = useAnimatedStyle(() => {
212
191
  // Link color states to the pressed states
213
192
  const backgroundColor = interpolateColor(
214
- progressPressed.value,
193
+ progress.value,
215
194
  [0, 1],
216
195
  [colorMap[color].default, colorMap[color].pressed]
217
196
  );
218
197
 
219
- // Scale down button slightly when pressed
220
- const scale = interpolate(
221
- progressPressed.value,
222
- [0, 1],
223
- [1, animationScaleValue],
224
- Extrapolate.CLAMP
225
- );
226
-
227
- return {
228
- backgroundColor,
229
- transform: [{ scale }]
230
- };
198
+ return { backgroundColor };
231
199
  });
232
200
 
233
- const onPressIn = useCallback(() => {
234
- // eslint-disable-next-line functional/immutable-data
235
- isPressed.value = 1;
236
- }, [isPressed]);
237
- const onPressOut = useCallback(() => {
238
- // eslint-disable-next-line functional/immutable-data
239
- isPressed.value = 0;
240
- }, [isPressed]);
241
-
242
201
  const handleOnPress = useCallback(
243
202
  (event: GestureResponderEvent) => {
244
203
  /* Don't call `onPress` if the button is
@@ -289,15 +248,14 @@ export const ButtonSolid = React.forwardRef<View, ButtonSolidProps>(
289
248
  : { backgroundColor: colorMap[color]?.default },
290
249
  /* Prevent Reanimated from overriding background colors
291
250
  if button is disabled */
251
+ !disabled && !reducedMotion && scaleAnimatedStyle,
292
252
  !disabled && pressedAnimationStyle
293
253
  ]}
294
254
  >
295
255
  {loading && (
296
256
  <Animated.View
297
257
  style={buttonStyles.buttonInner}
298
- entering={
299
- isMounted.current ? enterTransitionInnerContentSmall : undefined
300
- }
258
+ entering={enterTransitionInnerContentSmall}
301
259
  exiting={exitTransitionInnerContent}
302
260
  >
303
261
  <LoadingSpinner color={foregroundColor} />
@@ -308,24 +266,20 @@ export const ButtonSolid = React.forwardRef<View, ButtonSolidProps>(
308
266
  <Animated.View
309
267
  style={[
310
268
  buttonStyles.buttonInner,
269
+ { columnGap: ICON_MARGIN },
270
+ /* If 'iconPosition' is set to 'end', we use
271
+ reverse flex property to invert the position */
311
272
  iconPosition === "end" && { flexDirection: "row-reverse" }
312
273
  ]}
313
- entering={
314
- isMounted.current ? enterTransitionInnerContent : undefined
315
- }
316
- /* Temporarily disable the exiting transition because it caused
317
- a weird glitch on page exit */
318
- // exiting={exitTransitionInnerContent}
274
+ entering={enterTransitionInnerContent}
319
275
  >
320
276
  {icon && (
321
- <>
322
- {/* If 'iconPosition' is set to 'end', we use
323
- reverse flex property to invert the position */}
324
- <Icon name={icon} size={iconSize} color={foregroundColor} />
325
- {/* Once we have support for 'gap' property,
326
- we can get rid of that spacer */}
327
- <HSpacer size={8} />
328
- </>
277
+ <Icon
278
+ allowFontScaling
279
+ name={icon}
280
+ size={iconSize}
281
+ color={foregroundColor}
282
+ />
329
283
  )}
330
284
  <ButtonText
331
285
  color={foregroundColor}