@ledgerhq/lumen-ui-rnative 0.1.68 → 0.1.70

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 (373) hide show
  1. package/dist/module/lib/Components/animations/Pulse/Pulse.stories.js +7 -0
  2. package/dist/module/lib/Components/animations/Pulse/Pulse.stories.js.map +1 -1
  3. package/dist/module/lib/Components/animations/Spin/Spin.stories.js +7 -0
  4. package/dist/module/lib/Components/animations/Spin/Spin.stories.js.map +1 -1
  5. package/dist/module/lib/Components/core/AddressInput/AddressInput.stories.js +129 -136
  6. package/dist/module/lib/Components/core/AddressInput/AddressInput.stories.js.map +1 -1
  7. package/dist/module/lib/Components/core/AmountDisplay/AmountDisplay.stories.js +12 -6
  8. package/dist/module/lib/Components/core/AmountDisplay/AmountDisplay.stories.js.map +1 -1
  9. package/dist/module/lib/Components/core/AmountInput/AmountInput.stories.js +154 -176
  10. package/dist/module/lib/Components/core/AmountInput/AmountInput.stories.js.map +1 -1
  11. package/dist/module/lib/Components/core/Avatar/Avatar.stories.js +54 -47
  12. package/dist/module/lib/Components/core/Avatar/Avatar.stories.js.map +1 -1
  13. package/dist/module/lib/Components/core/AvatarButton/AvatarButton.stories.js +2 -9
  14. package/dist/module/lib/Components/core/AvatarButton/AvatarButton.stories.js.map +1 -1
  15. package/dist/module/lib/Components/core/Banner/Banner.stories.js +48 -87
  16. package/dist/module/lib/Components/core/Banner/Banner.stories.js.map +1 -1
  17. package/dist/module/lib/Components/core/Button/Button.figma.js +2 -1
  18. package/dist/module/lib/Components/core/Button/Button.figma.js.map +1 -1
  19. package/dist/module/lib/Components/core/Button/Button.mdx +2 -1
  20. package/dist/module/lib/Components/core/Button/Button.stories.js +34 -10
  21. package/dist/module/lib/Components/core/Button/Button.stories.js.map +1 -1
  22. package/dist/module/lib/Components/core/Card/Card.mdx +6 -0
  23. package/dist/module/lib/Components/core/Card/Card.stories.js +63 -24
  24. package/dist/module/lib/Components/core/Card/Card.stories.js.map +1 -1
  25. package/dist/module/lib/Components/core/CardButton/CardButton.stories.js +27 -85
  26. package/dist/module/lib/Components/core/CardButton/CardButton.stories.js.map +1 -1
  27. package/dist/module/lib/Components/core/Checkbox/Checkbox.stories.js +1 -1
  28. package/dist/module/lib/Components/core/ContentBanner/ContentBanner.stories.js +8 -18
  29. package/dist/module/lib/Components/core/ContentBanner/ContentBanner.stories.js.map +1 -1
  30. package/dist/module/lib/Components/core/DescriptionItem/DescriptionItem.stories.js +28 -0
  31. package/dist/module/lib/Components/core/DescriptionItem/DescriptionItem.stories.js.map +1 -1
  32. package/dist/module/lib/Components/core/Divider/Divider.stories.js +7 -0
  33. package/dist/module/lib/Components/core/Divider/Divider.stories.js.map +1 -1
  34. package/dist/module/lib/Components/core/DotCount/DotCount.stories.js +28 -0
  35. package/dist/module/lib/Components/core/DotCount/DotCount.stories.js.map +1 -1
  36. package/dist/module/lib/Components/core/DotIcon/DotIcon.stories.js +12 -0
  37. package/dist/module/lib/Components/core/DotIcon/DotIcon.stories.js.map +1 -1
  38. package/dist/module/lib/Components/core/DotIndicator/DotIndicator.stories.js +21 -0
  39. package/dist/module/lib/Components/core/DotIndicator/DotIndicator.stories.js.map +1 -1
  40. package/dist/module/lib/Components/core/DotSymbol/DotSymbol.stories.js +21 -0
  41. package/dist/module/lib/Components/core/DotSymbol/DotSymbol.stories.js.map +1 -1
  42. package/dist/module/lib/Components/core/IconButton/IconButton.stories.js +17 -0
  43. package/dist/module/lib/Components/core/IconButton/IconButton.stories.js.map +1 -1
  44. package/dist/module/lib/Components/core/InteractiveIcon/InteractiveIcon.stories.js +15 -21
  45. package/dist/module/lib/Components/core/InteractiveIcon/InteractiveIcon.stories.js.map +1 -1
  46. package/dist/module/lib/Components/core/Link/Link.js +1 -1
  47. package/dist/module/lib/Components/core/Link/Link.mdx +32 -5
  48. package/dist/module/lib/Components/core/Link/Link.stories.js +35 -139
  49. package/dist/module/lib/Components/core/Link/Link.stories.js.map +1 -1
  50. package/dist/module/lib/Components/core/Link/Link.test.js +1 -1
  51. package/dist/module/lib/Components/core/ListItem/ListItem.stories.js +2 -41
  52. package/dist/module/lib/Components/core/ListItem/ListItem.stories.js.map +1 -1
  53. package/dist/module/lib/Components/core/MediaBanner/MediaBanner.stories.js +19 -12
  54. package/dist/module/lib/Components/core/MediaBanner/MediaBanner.stories.js.map +1 -1
  55. package/dist/module/lib/Components/core/MediaButton/MediaButton.stories.js +2 -13
  56. package/dist/module/lib/Components/core/MediaButton/MediaButton.stories.js.map +1 -1
  57. package/dist/module/lib/Components/core/MediaCard/MediaCard.stories.js +24 -50
  58. package/dist/module/lib/Components/core/MediaCard/MediaCard.stories.js.map +1 -1
  59. package/dist/module/lib/Components/core/MediaImage/MediaImage.js +1 -1
  60. package/dist/module/lib/Components/core/MediaImage/MediaImage.js.map +1 -1
  61. package/dist/module/lib/Components/core/MediaImage/MediaImage.stories.js +1 -1
  62. package/dist/module/lib/Components/core/MediaImageGroup/MediaImageGroup.figma.js +215 -0
  63. package/dist/module/lib/Components/core/MediaImageGroup/MediaImageGroup.figma.js.map +1 -0
  64. package/dist/module/lib/Components/core/MediaImageGroup/MediaImageGroup.js +221 -0
  65. package/dist/module/lib/Components/core/MediaImageGroup/MediaImageGroup.js.map +1 -0
  66. package/dist/module/lib/Components/core/MediaImageGroup/MediaImageGroup.mdx +96 -0
  67. package/dist/module/lib/Components/core/MediaImageGroup/MediaImageGroup.stories.js +258 -0
  68. package/dist/module/lib/Components/core/MediaImageGroup/MediaImageGroup.stories.js.map +1 -0
  69. package/dist/module/lib/Components/core/MediaImageGroup/MediaImageGroup.test.js +246 -0
  70. package/dist/module/lib/Components/core/MediaImageGroup/MediaImageGroup.test.js.map +1 -0
  71. package/dist/module/lib/Components/core/MediaImageGroup/index.js +5 -0
  72. package/dist/module/lib/Components/core/MediaImageGroup/index.js.map +1 -0
  73. package/dist/module/lib/Components/core/MediaImageGroup/types.js +4 -0
  74. package/dist/module/lib/Components/core/MediaImageGroup/types.js.map +1 -0
  75. package/dist/module/lib/Components/core/MediaTag/MediaTag.stories.js +9 -0
  76. package/dist/module/lib/Components/core/MediaTag/MediaTag.stories.js.map +1 -1
  77. package/dist/module/lib/Components/core/MenuList/MenuList.mdx +2 -2
  78. package/dist/module/lib/Components/core/MenuList/MenuList.stories.js +17 -1
  79. package/dist/module/lib/Components/core/MenuList/MenuList.stories.js.map +1 -1
  80. package/dist/module/lib/Components/core/PageIndicator/PageIndicator.figma.js +1 -1
  81. package/dist/module/lib/Components/core/PageIndicator/PageIndicator.figma.js.map +1 -1
  82. package/dist/module/lib/Components/core/PageIndicator/PageIndicator.stories.js +56 -50
  83. package/dist/module/lib/Components/core/PageIndicator/PageIndicator.stories.js.map +1 -1
  84. package/dist/module/lib/Components/core/Pagination/Pagination.figma.js +22 -0
  85. package/dist/module/lib/Components/core/Pagination/Pagination.figma.js.map +1 -0
  86. package/dist/module/lib/Components/core/Pagination/Pagination.js +182 -0
  87. package/dist/module/lib/Components/core/Pagination/Pagination.js.map +1 -0
  88. package/dist/module/lib/Components/core/Pagination/Pagination.mdx +108 -0
  89. package/dist/module/lib/Components/core/Pagination/Pagination.stories.js +121 -0
  90. package/dist/module/lib/Components/core/Pagination/Pagination.stories.js.map +1 -0
  91. package/dist/module/lib/Components/core/Pagination/Pagination.test.js +338 -0
  92. package/dist/module/lib/Components/core/Pagination/Pagination.test.js.map +1 -0
  93. package/dist/module/lib/Components/core/Pagination/index.js +4 -0
  94. package/dist/module/lib/Components/core/Pagination/index.js.map +1 -0
  95. package/dist/module/lib/Components/core/Pagination/types.js +4 -0
  96. package/dist/module/lib/Components/core/Pagination/types.js.map +1 -0
  97. package/dist/module/lib/Components/core/SearchInput/SearchInput.stories.js +75 -67
  98. package/dist/module/lib/Components/core/SearchInput/SearchInput.stories.js.map +1 -1
  99. package/dist/module/lib/Components/core/SegmentedControl/SegmentedControl.stories.js +12 -0
  100. package/dist/module/lib/Components/core/SegmentedControl/SegmentedControl.stories.js.map +1 -1
  101. package/dist/module/lib/Components/core/SelectList/SelectList.mdx +3 -1
  102. package/dist/module/lib/Components/core/SelectList/SelectList.stories.js +3 -3
  103. package/dist/module/lib/Components/core/SelectList/SelectList.stories.js.map +1 -1
  104. package/dist/module/lib/Components/core/Skeleton/Skeleton.stories.js +7 -0
  105. package/dist/module/lib/Components/core/Skeleton/Skeleton.stories.js.map +1 -1
  106. package/dist/module/lib/Components/core/Spinner/Spinner.stories.js +7 -0
  107. package/dist/module/lib/Components/core/Spinner/Spinner.stories.js.map +1 -1
  108. package/dist/module/lib/Components/core/Spot/Spot.stories.js +20 -1
  109. package/dist/module/lib/Components/core/Spot/Spot.stories.js.map +1 -1
  110. package/dist/module/lib/Components/core/Stepper/Stepper.stories.js +7 -0
  111. package/dist/module/lib/Components/core/Stepper/Stepper.stories.js.map +1 -1
  112. package/dist/module/lib/Components/core/Subheader/Subheader.stories.js +11 -1
  113. package/dist/module/lib/Components/core/Subheader/Subheader.stories.js.map +1 -1
  114. package/dist/module/lib/Components/core/Switch/Switch.stories.js +21 -1
  115. package/dist/module/lib/Components/core/Switch/Switch.stories.js.map +1 -1
  116. package/dist/module/lib/Components/core/TabBar/TabBar.stories.js +17 -5
  117. package/dist/module/lib/Components/core/TabBar/TabBar.stories.js.map +1 -1
  118. package/dist/module/lib/Components/core/Tag/Tag.stories.js +28 -0
  119. package/dist/module/lib/Components/core/Tag/Tag.stories.js.map +1 -1
  120. package/dist/module/lib/Components/core/TextInput/TextInput.stories.js +159 -196
  121. package/dist/module/lib/Components/core/TextInput/TextInput.stories.js.map +1 -1
  122. package/dist/module/lib/Components/core/TextInput/TextInput.test.js +2 -2
  123. package/dist/module/lib/Components/core/TextInput/TextInput.test.js.map +1 -1
  124. package/dist/module/lib/Components/core/Tile/Tile.stories.js +2 -35
  125. package/dist/module/lib/Components/core/Tile/Tile.stories.js.map +1 -1
  126. package/dist/module/lib/Components/core/TileButton/TileButton.stories.js +18 -8
  127. package/dist/module/lib/Components/core/TileButton/TileButton.stories.js.map +1 -1
  128. package/dist/module/lib/Components/core/Timeline/Timeline.js +81 -67
  129. package/dist/module/lib/Components/core/Timeline/Timeline.js.map +1 -1
  130. package/dist/module/lib/Components/core/Timeline/Timeline.stories.js +46 -16
  131. package/dist/module/lib/Components/core/Timeline/Timeline.stories.js.map +1 -1
  132. package/dist/module/lib/Components/core/Timeline/Timeline.test.js +8 -5
  133. package/dist/module/lib/Components/core/Timeline/Timeline.test.js.map +1 -1
  134. package/dist/module/lib/Components/core/Toast/Toast.mdx +1 -1
  135. package/dist/module/lib/Components/core/Toast/Toast.stories.js +61 -58
  136. package/dist/module/lib/Components/core/Toast/Toast.stories.js.map +1 -1
  137. package/dist/module/lib/Components/core/Toast/Toaster.test.js +1 -1
  138. package/dist/module/lib/Components/core/Toast/Toaster.test.js.map +1 -1
  139. package/dist/module/lib/Components/core/Tooltip/Tooltip.stories.js +31 -2
  140. package/dist/module/lib/Components/core/Tooltip/Tooltip.stories.js.map +1 -1
  141. package/dist/module/lib/Components/core/Trend/Trend.stories.js +9 -0
  142. package/dist/module/lib/Components/core/Trend/Trend.stories.js.map +1 -1
  143. package/dist/module/lib/Components/core/index.js +2 -0
  144. package/dist/module/lib/Components/core/index.js.map +1 -1
  145. package/dist/module/lib/Components/internal/BaseButton/BaseButton.js +5 -2
  146. package/dist/module/lib/Components/internal/BaseButton/BaseButton.js.map +1 -1
  147. package/dist/module/lib/Components/internal/BaseButton/BaseButton.test.js +1 -1
  148. package/dist/module/lib/Components/internal/BaseButton/BaseButton.test.js.map +1 -1
  149. package/dist/module/lib/Components/primitives/Box/Box.stories.js +1 -18
  150. package/dist/module/lib/Components/primitives/Box/Box.stories.js.map +1 -1
  151. package/dist/module/lib/Components/primitives/Gradient/LinearGradient/LinearGradient.stories.js +36 -0
  152. package/dist/module/lib/Components/primitives/Gradient/LinearGradient/LinearGradient.stories.js.map +1 -1
  153. package/dist/module/lib/Components/primitives/Gradient/RadialGradient/RadialGradient.stories.js +1 -1
  154. package/dist/module/lib/Components/primitives/Pressable/Pressable.stories.js +1 -19
  155. package/dist/module/lib/Components/primitives/Pressable/Pressable.stories.js.map +1 -1
  156. package/dist/module/lib/Components/primitives/Text/Text.stories.js +1 -12
  157. package/dist/module/lib/Components/primitives/Text/Text.stories.js.map +1 -1
  158. package/dist/module/lib/Components/symbols/Icon/Icon.stories.js +128 -85
  159. package/dist/module/lib/Components/symbols/Icon/Icon.stories.js.map +1 -1
  160. package/dist/module/lib/Components/symbols/icons/Ar.js +2 -2
  161. package/dist/module/lib/Components/symbols/icons/Ar.js.map +1 -1
  162. package/dist/module/lib/Components/symbols/icons/Range.js +1 -1
  163. package/dist/module/lib/Components/symbols/icons/Share.js +1 -1
  164. package/dist/module/lib/Components/symbols/icons/{Charon.js → ShoppingInvoiceList.js} +8 -8
  165. package/dist/module/lib/Components/symbols/icons/ShoppingInvoiceList.js.map +1 -0
  166. package/dist/module/lib/Components/symbols/icons/WalletInput.js +1 -1
  167. package/dist/module/lib/Components/symbols/icons/WalletInput.js.map +1 -1
  168. package/dist/module/lib/Components/symbols/index.js +1 -4
  169. package/dist/module/lib/Components/symbols/index.js.map +1 -1
  170. package/dist/module/lib/Components/visualization/DonutChart/DonutChart.test.js +1 -1
  171. package/dist/module/lib/Components/visualization/DonutChart/DonutChart.test.js.map +1 -1
  172. package/dist/module/lib/Components/visualization/Line/utils.js +1 -1
  173. package/dist/module/lib/Components/visualization/LineChart/LineChart.stories.js +69 -0
  174. package/dist/module/lib/Components/visualization/LineChart/LineChart.stories.js.map +1 -1
  175. package/dist/module/lib/Components/visualization/LineChart/LineChart.test.js +1 -1
  176. package/dist/module/lib/Components/visualization/LineChart/LineChart.test.js.map +1 -1
  177. package/dist/module/lib/Components/visualization/Point/Point.stories.js +12 -0
  178. package/dist/module/lib/Components/visualization/Point/Point.stories.js.map +1 -1
  179. package/dist/module/lib/Components/visualization/Point/Point.test.js +1 -1
  180. package/dist/module/lib/Components/visualization/Point/usePointGeometry.js +1 -1
  181. package/dist/module/lib/Components/visualization/Point/utils.js +1 -1
  182. package/dist/module/lib/Components/visualization/Point/utils.test.js +2 -2
  183. package/dist/module/lib/Components/visualization/ReferenceLine/ReferenceLine.stories.js +23 -0
  184. package/dist/module/lib/Components/visualization/ReferenceLine/ReferenceLine.stories.js.map +1 -1
  185. package/dist/module/lib/Components/visualization/Scrubber/DefaultScrubberTooltip/utils.js +3 -3
  186. package/dist/module/lib/Components/visualization/Scrubber/DefaultScrubberTooltip/utils.js.map +1 -1
  187. package/dist/module/lib/Components/visualization/Scrubber/Scrubber.stories.js +35 -0
  188. package/dist/module/lib/Components/visualization/Scrubber/Scrubber.stories.js.map +1 -1
  189. package/dist/module/translations/locales/de.json +7 -0
  190. package/dist/module/translations/locales/en.json +7 -0
  191. package/dist/module/translations/locales/es.json +7 -0
  192. package/dist/module/translations/locales/fr.json +7 -0
  193. package/dist/module/translations/locales/ja.json +7 -0
  194. package/dist/module/translations/locales/ko.json +7 -0
  195. package/dist/module/translations/locales/pt.json +7 -0
  196. package/dist/module/translations/locales/ru.json +7 -0
  197. package/dist/module/translations/locales/th.json +7 -0
  198. package/dist/module/translations/locales/tr.json +7 -0
  199. package/dist/module/translations/locales/zh.json +7 -0
  200. package/dist/typescript/src/lib/Components/core/MediaImage/MediaImage.d.ts +4 -0
  201. package/dist/typescript/src/lib/Components/core/MediaImage/MediaImage.d.ts.map +1 -1
  202. package/dist/typescript/src/lib/Components/core/MediaImageGroup/MediaImageGroup.d.ts +33 -0
  203. package/dist/typescript/src/lib/Components/core/MediaImageGroup/MediaImageGroup.d.ts.map +1 -0
  204. package/dist/typescript/src/lib/Components/core/MediaImageGroup/index.d.ts +3 -0
  205. package/dist/typescript/src/lib/Components/core/MediaImageGroup/index.d.ts.map +1 -0
  206. package/dist/typescript/src/lib/Components/core/MediaImageGroup/types.d.ts +66 -0
  207. package/dist/typescript/src/lib/Components/core/MediaImageGroup/types.d.ts.map +1 -0
  208. package/dist/typescript/src/lib/Components/core/Pagination/Pagination.d.ts +15 -0
  209. package/dist/typescript/src/lib/Components/core/Pagination/Pagination.d.ts.map +1 -0
  210. package/dist/typescript/src/lib/Components/core/Pagination/index.d.ts +3 -0
  211. package/dist/typescript/src/lib/Components/core/Pagination/index.d.ts.map +1 -0
  212. package/dist/typescript/src/lib/Components/core/Pagination/types.d.ts +29 -0
  213. package/dist/typescript/src/lib/Components/core/Pagination/types.d.ts.map +1 -0
  214. package/dist/typescript/src/lib/Components/core/Timeline/Timeline.d.ts +2 -2
  215. package/dist/typescript/src/lib/Components/core/Timeline/Timeline.d.ts.map +1 -1
  216. package/dist/typescript/src/lib/Components/core/index.d.ts +2 -0
  217. package/dist/typescript/src/lib/Components/core/index.d.ts.map +1 -1
  218. package/dist/typescript/src/lib/Components/internal/BaseButton/BaseButton.d.ts.map +1 -1
  219. package/dist/typescript/src/lib/Components/internal/BaseButton/types.d.ts +1 -1
  220. package/dist/typescript/src/lib/Components/internal/BaseButton/types.d.ts.map +1 -1
  221. package/dist/typescript/src/lib/Components/internal/BaseInput/types.d.ts +1 -1
  222. package/dist/typescript/src/lib/Components/symbols/icons/{Charon.d.ts → ShoppingInvoiceList.d.ts} +7 -7
  223. package/dist/typescript/src/lib/Components/symbols/icons/ShoppingInvoiceList.d.ts.map +1 -0
  224. package/dist/typescript/src/lib/Components/symbols/index.d.ts +1 -4
  225. package/dist/typescript/src/lib/Components/symbols/index.d.ts.map +1 -1
  226. package/dist/typescript/src/lib/Components/visualization/Axis/types.d.ts +1 -1
  227. package/dist/typescript/src/lib/Components/visualization/CartesianChart/types.d.ts +1 -1
  228. package/dist/typescript/src/lib/Components/visualization/Line/utils.d.ts +1 -1
  229. package/dist/typescript/src/lib/Components/visualization/LineChart/types.d.ts +3 -3
  230. package/dist/typescript/src/lib/Components/visualization/Point/types.d.ts +3 -3
  231. package/dist/typescript/src/lib/Components/visualization/Point/usePointGeometry.d.ts +1 -1
  232. package/dist/typescript/src/lib/Components/visualization/Point/utils.d.ts +1 -1
  233. package/dist/typescript/src/translations/translations.d.ts +84 -0
  234. package/dist/typescript/src/translations/translations.d.ts.map +1 -1
  235. package/package.json +9 -9
  236. package/src/lib/Components/animations/Pulse/Pulse.stories.tsx +1 -0
  237. package/src/lib/Components/animations/Spin/Spin.stories.tsx +1 -0
  238. package/src/lib/Components/core/AddressInput/AddressInput.stories.tsx +168 -123
  239. package/src/lib/Components/core/AmountDisplay/AmountDisplay.stories.tsx +7 -7
  240. package/src/lib/Components/core/AmountInput/AmountInput.stories.tsx +162 -158
  241. package/src/lib/Components/core/Avatar/Avatar.stories.tsx +37 -46
  242. package/src/lib/Components/core/AvatarButton/AvatarButton.stories.tsx +1 -8
  243. package/src/lib/Components/core/Banner/Banner.stories.tsx +8 -95
  244. package/src/lib/Components/core/Button/Button.figma.tsx +1 -0
  245. package/src/lib/Components/core/Button/Button.mdx +2 -1
  246. package/src/lib/Components/core/Button/Button.stories.tsx +13 -14
  247. package/src/lib/Components/core/Card/Card.mdx +6 -0
  248. package/src/lib/Components/core/Card/Card.stories.tsx +31 -27
  249. package/src/lib/Components/core/CardButton/CardButton.stories.tsx +14 -90
  250. package/src/lib/Components/core/Checkbox/Checkbox.stories.tsx +1 -1
  251. package/src/lib/Components/core/ContentBanner/ContentBanner.stories.tsx +1 -17
  252. package/src/lib/Components/core/DescriptionItem/DescriptionItem.stories.tsx +4 -0
  253. package/src/lib/Components/core/Divider/Divider.stories.tsx +1 -0
  254. package/src/lib/Components/core/DotCount/DotCount.stories.tsx +4 -0
  255. package/src/lib/Components/core/DotIcon/DotIcon.stories.tsx +8 -0
  256. package/src/lib/Components/core/DotIndicator/DotIndicator.stories.tsx +3 -0
  257. package/src/lib/Components/core/DotSymbol/DotSymbol.stories.tsx +3 -0
  258. package/src/lib/Components/core/IconButton/IconButton.stories.tsx +9 -0
  259. package/src/lib/Components/core/InteractiveIcon/InteractiveIcon.stories.tsx +16 -23
  260. package/src/lib/Components/core/Link/Link.mdx +32 -5
  261. package/src/lib/Components/core/Link/Link.stories.tsx +20 -146
  262. package/src/lib/Components/core/Link/Link.test.tsx +1 -1
  263. package/src/lib/Components/core/Link/Link.tsx +1 -1
  264. package/src/lib/Components/core/ListItem/ListItem.stories.tsx +0 -39
  265. package/src/lib/Components/core/MediaBanner/MediaBanner.stories.tsx +3 -14
  266. package/src/lib/Components/core/MediaButton/MediaButton.stories.tsx +1 -12
  267. package/src/lib/Components/core/MediaCard/MediaCard.stories.tsx +10 -53
  268. package/src/lib/Components/core/MediaImage/MediaImage.stories.tsx +1 -1
  269. package/src/lib/Components/core/MediaImage/MediaImage.tsx +1 -1
  270. package/src/lib/Components/core/MediaImageGroup/MediaImageGroup.figma.tsx +119 -0
  271. package/src/lib/Components/core/MediaImageGroup/MediaImageGroup.mdx +96 -0
  272. package/src/lib/Components/core/MediaImageGroup/MediaImageGroup.stories.tsx +154 -0
  273. package/src/lib/Components/core/MediaImageGroup/MediaImageGroup.test.tsx +213 -0
  274. package/src/lib/Components/core/MediaImageGroup/MediaImageGroup.tsx +264 -0
  275. package/src/lib/Components/core/MediaImageGroup/index.ts +2 -0
  276. package/src/lib/Components/core/MediaImageGroup/types.ts +77 -0
  277. package/src/lib/Components/core/MediaTag/MediaTag.stories.tsx +3 -0
  278. package/src/lib/Components/core/MenuList/MenuList.mdx +2 -2
  279. package/src/lib/Components/core/MenuList/MenuList.stories.tsx +13 -1
  280. package/src/lib/Components/core/PageIndicator/PageIndicator.figma.tsx +1 -1
  281. package/src/lib/Components/core/PageIndicator/PageIndicator.stories.tsx +45 -42
  282. package/src/lib/Components/core/Pagination/Pagination.figma.tsx +25 -0
  283. package/src/lib/Components/core/Pagination/Pagination.mdx +108 -0
  284. package/src/lib/Components/core/Pagination/Pagination.stories.tsx +90 -0
  285. package/src/lib/Components/core/Pagination/Pagination.test.tsx +346 -0
  286. package/src/lib/Components/core/Pagination/Pagination.tsx +200 -0
  287. package/src/lib/Components/core/Pagination/index.ts +2 -0
  288. package/src/lib/Components/core/Pagination/types.ts +29 -0
  289. package/src/lib/Components/core/SearchInput/SearchInput.stories.tsx +91 -66
  290. package/src/lib/Components/core/SegmentedControl/SegmentedControl.stories.tsx +2 -0
  291. package/src/lib/Components/core/SelectList/SelectList.mdx +3 -1
  292. package/src/lib/Components/core/SelectList/SelectList.stories.tsx +3 -3
  293. package/src/lib/Components/core/Skeleton/Skeleton.stories.tsx +1 -0
  294. package/src/lib/Components/core/Spinner/Spinner.stories.tsx +1 -0
  295. package/src/lib/Components/core/Spot/Spot.stories.tsx +10 -1
  296. package/src/lib/Components/core/Stepper/Stepper.stories.tsx +1 -0
  297. package/src/lib/Components/core/Subheader/Subheader.stories.tsx +5 -2
  298. package/src/lib/Components/core/Switch/Switch.stories.tsx +17 -1
  299. package/src/lib/Components/core/TabBar/TabBar.stories.tsx +15 -5
  300. package/src/lib/Components/core/Tag/Tag.stories.tsx +4 -0
  301. package/src/lib/Components/core/TextInput/TextInput.stories.tsx +186 -174
  302. package/src/lib/Components/core/TextInput/TextInput.test.tsx +2 -2
  303. package/src/lib/Components/core/Tile/Tile.stories.tsx +0 -33
  304. package/src/lib/Components/core/TileButton/TileButton.stories.tsx +9 -7
  305. package/src/lib/Components/core/Timeline/Timeline.stories.tsx +20 -1
  306. package/src/lib/Components/core/Timeline/Timeline.test.tsx +12 -8
  307. package/src/lib/Components/core/Timeline/Timeline.tsx +79 -75
  308. package/src/lib/Components/core/Toast/Toast.mdx +1 -1
  309. package/src/lib/Components/core/Toast/Toast.stories.tsx +55 -66
  310. package/src/lib/Components/core/Toast/Toaster.test.tsx +1 -1
  311. package/src/lib/Components/core/Tooltip/Tooltip.stories.tsx +7 -3
  312. package/src/lib/Components/core/Trend/Trend.stories.tsx +3 -0
  313. package/src/lib/Components/core/index.ts +2 -0
  314. package/src/lib/Components/internal/BaseButton/BaseButton.test.tsx +1 -0
  315. package/src/lib/Components/internal/BaseButton/BaseButton.tsx +3 -0
  316. package/src/lib/Components/internal/BaseButton/types.ts +2 -1
  317. package/src/lib/Components/internal/BaseInput/types.ts +1 -1
  318. package/src/lib/Components/primitives/Box/Box.stories.tsx +1 -18
  319. package/src/lib/Components/primitives/Gradient/LinearGradient/LinearGradient.stories.tsx +12 -0
  320. package/src/lib/Components/primitives/Gradient/RadialGradient/RadialGradient.stories.tsx +1 -1
  321. package/src/lib/Components/primitives/Pressable/Pressable.stories.tsx +0 -18
  322. package/src/lib/Components/primitives/Text/Text.stories.tsx +1 -12
  323. package/src/lib/Components/symbols/Icon/Icon.stories.tsx +133 -94
  324. package/src/lib/Components/symbols/icons/Ar.tsx +2 -2
  325. package/src/lib/Components/symbols/icons/Range.tsx +1 -1
  326. package/src/lib/Components/symbols/icons/Share.tsx +1 -1
  327. package/src/lib/Components/symbols/icons/{Charon.tsx → ShoppingInvoiceList.tsx} +8 -8
  328. package/src/lib/Components/symbols/icons/WalletInput.tsx +1 -1
  329. package/src/lib/Components/symbols/index.ts +1 -4
  330. package/src/lib/Components/visualization/Axis/types.ts +1 -1
  331. package/src/lib/Components/visualization/CartesianChart/types.ts +1 -1
  332. package/src/lib/Components/visualization/DonutChart/DonutChart.test.tsx +1 -1
  333. package/src/lib/Components/visualization/Line/utils.ts +1 -1
  334. package/src/lib/Components/visualization/LineChart/LineChart.stories.tsx +15 -0
  335. package/src/lib/Components/visualization/LineChart/LineChart.test.tsx +1 -1
  336. package/src/lib/Components/visualization/LineChart/types.ts +3 -3
  337. package/src/lib/Components/visualization/Point/Point.stories.tsx +2 -0
  338. package/src/lib/Components/visualization/Point/Point.test.tsx +1 -1
  339. package/src/lib/Components/visualization/Point/types.ts +3 -3
  340. package/src/lib/Components/visualization/Point/usePointGeometry.ts +1 -1
  341. package/src/lib/Components/visualization/Point/utils.test.ts +2 -2
  342. package/src/lib/Components/visualization/Point/utils.ts +1 -1
  343. package/src/lib/Components/visualization/ReferenceLine/ReferenceLine.stories.tsx +5 -0
  344. package/src/lib/Components/visualization/Scrubber/DefaultScrubberTooltip/utils.ts +3 -3
  345. package/src/lib/Components/visualization/Scrubber/Scrubber.stories.tsx +5 -0
  346. package/src/translations/locales/de.json +7 -0
  347. package/src/translations/locales/en.json +7 -0
  348. package/src/translations/locales/es.json +7 -0
  349. package/src/translations/locales/fr.json +7 -0
  350. package/src/translations/locales/ja.json +7 -0
  351. package/src/translations/locales/ko.json +7 -0
  352. package/src/translations/locales/pt.json +7 -0
  353. package/src/translations/locales/ru.json +7 -0
  354. package/src/translations/locales/th.json +7 -0
  355. package/src/translations/locales/tr.json +7 -0
  356. package/src/translations/locales/zh.json +7 -0
  357. package/dist/module/lib/Components/symbols/icons/Apex.js +0 -49
  358. package/dist/module/lib/Components/symbols/icons/Apex.js.map +0 -1
  359. package/dist/module/lib/Components/symbols/icons/BellNotification.js +0 -91
  360. package/dist/module/lib/Components/symbols/icons/BellNotification.js.map +0 -1
  361. package/dist/module/lib/Components/symbols/icons/Charon.js.map +0 -1
  362. package/dist/module/lib/Components/symbols/icons/ShieldCheckNotification.js +0 -82
  363. package/dist/module/lib/Components/symbols/icons/ShieldCheckNotification.js.map +0 -1
  364. package/dist/typescript/src/lib/Components/symbols/icons/Apex.d.ts +0 -35
  365. package/dist/typescript/src/lib/Components/symbols/icons/Apex.d.ts.map +0 -1
  366. package/dist/typescript/src/lib/Components/symbols/icons/BellNotification.d.ts +0 -35
  367. package/dist/typescript/src/lib/Components/symbols/icons/BellNotification.d.ts.map +0 -1
  368. package/dist/typescript/src/lib/Components/symbols/icons/Charon.d.ts.map +0 -1
  369. package/dist/typescript/src/lib/Components/symbols/icons/ShieldCheckNotification.d.ts +0 -35
  370. package/dist/typescript/src/lib/Components/symbols/icons/ShieldCheckNotification.d.ts.map +0 -1
  371. package/src/lib/Components/symbols/icons/Apex.tsx +0 -44
  372. package/src/lib/Components/symbols/icons/BellNotification.tsx +0 -75
  373. package/src/lib/Components/symbols/icons/ShieldCheckNotification.tsx +0 -67
@@ -0,0 +1,90 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-native-web-vite';
2
+ import { useEffect, useState } from 'react';
3
+ import { Box } from '../../primitives/Box';
4
+ import { Pagination } from './Pagination';
5
+
6
+ const meta = {
7
+ id: 'rnative-pagination',
8
+ title: 'Core/Pagination',
9
+ component: Pagination,
10
+ parameters: {
11
+ layout: 'centered',
12
+ backgrounds: { default: 'light' },
13
+ docs: { source: { language: 'tsx', format: true, type: 'code' } },
14
+ actions: { disable: true },
15
+ },
16
+ args: {
17
+ page: 1,
18
+ totalPages: 10,
19
+ onPageChange: () => {},
20
+ },
21
+ argTypes: {
22
+ page: { control: 'number' },
23
+ totalPages: { control: 'number' },
24
+ siblingCount: { control: 'number' },
25
+ density: { control: 'radio', options: ['expanded', 'compact'] },
26
+ onPageChange: { control: false },
27
+ },
28
+ } satisfies Meta<typeof Pagination>;
29
+
30
+ export default meta;
31
+ type Story = StoryObj<typeof Pagination>;
32
+
33
+ export const Base: Story = {
34
+ args: {
35
+ page: 5,
36
+ totalPages: 10,
37
+ siblingCount: 1,
38
+ },
39
+ render: (args) => {
40
+ const [page, setPage] = useState(args.page);
41
+
42
+ useEffect(() => {
43
+ setPage(args.page);
44
+ }, [args.page]);
45
+
46
+ return <Pagination {...args} page={page} onPageChange={setPage} />;
47
+ },
48
+ };
49
+
50
+ export const FewPages: Story = {
51
+ render: () => {
52
+ const [page, setPage] = useState(2);
53
+
54
+ return <Pagination page={page} totalPages={3} onPageChange={setPage} />;
55
+ },
56
+ };
57
+
58
+ export const FirstPage: Story = {
59
+ render: () => {
60
+ const [page, setPage] = useState(1);
61
+
62
+ return <Pagination page={page} totalPages={20} onPageChange={setPage} />;
63
+ },
64
+ };
65
+
66
+ export const LastPage: Story = {
67
+ render: () => {
68
+ const [page, setPage] = useState(20);
69
+
70
+ return <Pagination page={page} totalPages={20} onPageChange={setPage} />;
71
+ },
72
+ };
73
+
74
+ export const DensityShowcase: Story = {
75
+ render: () => {
76
+ const [page, setPage] = useState(2);
77
+
78
+ return (
79
+ <Box lx={{ alignItems: 'center', gap: 's16' }}>
80
+ <Pagination page={page} totalPages={8} onPageChange={setPage} />
81
+ <Pagination
82
+ page={page}
83
+ totalPages={8}
84
+ density='compact'
85
+ onPageChange={setPage}
86
+ />
87
+ </Box>
88
+ );
89
+ },
90
+ };
@@ -0,0 +1,346 @@
1
+ import {
2
+ afterEach,
3
+ beforeEach,
4
+ describe,
5
+ expect,
6
+ it,
7
+ jest,
8
+ } from '@jest/globals';
9
+ import { ledgerLiveThemes } from '@ledgerhq/lumen-design-core';
10
+ import { getPaginationRange } from '@ledgerhq/lumen-utils-shared';
11
+ import { fireEvent, render, screen } from '@testing-library/react-native';
12
+ import type { ReactNode } from 'react';
13
+ import { useState } from 'react';
14
+ import { ScrollView } from 'react-native';
15
+ import { ThemeProvider } from '../ThemeProvider/ThemeProvider';
16
+ import { Pagination } from './Pagination';
17
+
18
+ const TestWrapper = ({
19
+ children,
20
+ locale = 'en',
21
+ }: {
22
+ children: ReactNode;
23
+ locale?: 'en' | 'fr';
24
+ }) => (
25
+ <ThemeProvider themes={ledgerLiveThemes} colorScheme='dark' locale={locale}>
26
+ {children}
27
+ </ThemeProvider>
28
+ );
29
+
30
+ // Jest has no layout engine, so layouts are simulated: 1-digit pages and
31
+ // ellipses are 40 wide, 2-digit pages 48, separated by an 8 gap.
32
+ const ITEM_GAP = 8;
33
+ const getItemWidth = (item: number | string): number =>
34
+ typeof item === 'number' ? 32 + String(item).length * 8 : 40;
35
+
36
+ const fireLayout = (
37
+ element: Parameters<typeof fireEvent>[0],
38
+ x: number,
39
+ width: number,
40
+ ): void => {
41
+ fireEvent(element, 'layout', {
42
+ nativeEvent: { layout: { x, y: 0, width, height: 40 } },
43
+ });
44
+ };
45
+
46
+ const layoutPages = (page: number, totalPages: number): void => {
47
+ let x = 0;
48
+ for (const item of getPaginationRange(page, totalPages)) {
49
+ const width = getItemWidth(item);
50
+ if (typeof item === 'number') {
51
+ fireLayout(screen.getByLabelText(`Page ${item}`), x, width);
52
+ }
53
+ x += width + ITEM_GAP;
54
+ }
55
+ };
56
+
57
+ const layoutViewport = (width: number): void => {
58
+ fireLayout(screen.UNSAFE_getByType(ScrollView), 0, width);
59
+ };
60
+
61
+ const ControlledPagination = ({ initialPage }: { initialPage: number }) => {
62
+ const [page, setPage] = useState(initialPage);
63
+ return <Pagination page={page} totalPages={20} onPageChange={setPage} />;
64
+ };
65
+
66
+ describe('Pagination', () => {
67
+ it('should render page buttons with the active page selected', () => {
68
+ render(
69
+ <TestWrapper>
70
+ <Pagination page={2} totalPages={5} onPageChange={jest.fn()} />
71
+ </TestWrapper>,
72
+ );
73
+
74
+ expect(screen.getByLabelText('Pagination')).toBeTruthy();
75
+ expect(screen.getByLabelText('Page 2')).toBeSelected();
76
+ expect(screen.getByLabelText('Page 3')).not.toBeSelected();
77
+ });
78
+
79
+ it('should call onPageChange when a page is pressed', () => {
80
+ const onPageChange = jest.fn();
81
+
82
+ render(
83
+ <TestWrapper>
84
+ <Pagination page={1} totalPages={5} onPageChange={onPageChange} />
85
+ </TestWrapper>,
86
+ );
87
+
88
+ fireEvent.press(screen.getByLabelText('Page 3'));
89
+
90
+ expect(onPageChange).toHaveBeenCalledWith(3);
91
+ });
92
+
93
+ it('should call onPageChange with the adjacent pages from previous and next', () => {
94
+ const onPageChange = jest.fn();
95
+
96
+ render(
97
+ <TestWrapper>
98
+ <Pagination page={2} totalPages={5} onPageChange={onPageChange} />
99
+ </TestWrapper>,
100
+ );
101
+
102
+ fireEvent.press(screen.getByLabelText('Previous page'));
103
+ fireEvent.press(screen.getByLabelText('Next page'));
104
+
105
+ expect(onPageChange).toHaveBeenNthCalledWith(1, 1);
106
+ expect(onPageChange).toHaveBeenNthCalledWith(2, 3);
107
+ });
108
+
109
+ it('should disable previous on the first page and next on the last page', () => {
110
+ const onPageChange = jest.fn();
111
+
112
+ const { rerender } = render(
113
+ <TestWrapper>
114
+ <Pagination page={1} totalPages={5} onPageChange={onPageChange} />
115
+ </TestWrapper>,
116
+ );
117
+
118
+ fireEvent.press(screen.getByLabelText('Previous page'));
119
+
120
+ rerender(
121
+ <TestWrapper>
122
+ <Pagination page={5} totalPages={5} onPageChange={onPageChange} />
123
+ </TestWrapper>,
124
+ );
125
+
126
+ fireEvent.press(screen.getByLabelText('Next page'));
127
+
128
+ expect(onPageChange).not.toHaveBeenCalled();
129
+ });
130
+
131
+ it('should clamp page above totalPages to totalPages', () => {
132
+ render(
133
+ <TestWrapper>
134
+ <Pagination page={99} totalPages={5} onPageChange={jest.fn()} />
135
+ </TestWrapper>,
136
+ );
137
+
138
+ expect(screen.getByLabelText('Page 5')).toBeSelected();
139
+ });
140
+
141
+ it('should collapse distant pages behind ellipsis markers hidden from assistive technology', () => {
142
+ render(
143
+ <TestWrapper>
144
+ <Pagination page={10} totalPages={20} onPageChange={jest.fn()} />
145
+ </TestWrapper>,
146
+ );
147
+
148
+ expect(screen.queryByText('…')).toBeNull();
149
+ expect(
150
+ screen.getAllByText('…', { includeHiddenElements: true }),
151
+ ).toHaveLength(2);
152
+ expect(screen.queryByLabelText('Page 5')).toBeNull();
153
+ });
154
+
155
+ it('should render the page buttons inside a horizontal scroll view', () => {
156
+ render(
157
+ <TestWrapper>
158
+ <Pagination page={10} totalPages={20} onPageChange={jest.fn()} />
159
+ </TestWrapper>,
160
+ );
161
+
162
+ expect(screen.UNSAFE_getByType(ScrollView).props.horizontal).toBe(true);
163
+ });
164
+
165
+ describe('active page visibility', () => {
166
+ let scrollTo: jest.SpiedFunction<ScrollView['scrollTo']>;
167
+
168
+ beforeEach(() => {
169
+ scrollTo = jest
170
+ .spyOn(ScrollView.prototype, 'scrollTo')
171
+ .mockImplementation(() => undefined);
172
+ });
173
+
174
+ afterEach(() => {
175
+ scrollTo.mockRestore();
176
+ });
177
+
178
+ it('should center the active page once the row is laid out', () => {
179
+ render(
180
+ <TestWrapper>
181
+ <Pagination page={10} totalPages={20} onPageChange={jest.fn()} />
182
+ </TestWrapper>,
183
+ );
184
+
185
+ layoutPages(10, 20);
186
+ expect(scrollTo).not.toHaveBeenCalled();
187
+
188
+ layoutViewport(240);
189
+
190
+ // Page 10 spans 144–192, so its center (168) minus half the viewport.
191
+ expect(scrollTo).toHaveBeenCalledTimes(1);
192
+ expect(scrollTo).toHaveBeenLastCalledWith({ x: 48, animated: false });
193
+ });
194
+
195
+ it('should follow the active page across an ellipsis boundary', () => {
196
+ render(
197
+ <TestWrapper>
198
+ <ControlledPagination initialPage={3} />
199
+ </TestWrapper>,
200
+ );
201
+
202
+ layoutPages(3, 20);
203
+ layoutViewport(160);
204
+ // Page 3 spans 96–136 in [1 2 3 4 5 … 20].
205
+ expect(scrollTo).toHaveBeenLastCalledWith({ x: 36, animated: false });
206
+
207
+ fireEvent.press(screen.getByLabelText('Next page'));
208
+ expect(screen.getByLabelText('Page 4')).toBeSelected();
209
+ expect(screen.queryByLabelText('Page 2')).toBeNull();
210
+
211
+ layoutPages(4, 20);
212
+ // Page 4 spans 144–184 in [1 … 3 4 5 … 20].
213
+ expect(scrollTo).toHaveBeenLastCalledWith({ x: 84, animated: false });
214
+ });
215
+
216
+ it('should scroll to an already measured page when the row does not move', () => {
217
+ render(
218
+ <TestWrapper>
219
+ <ControlledPagination initialPage={1} />
220
+ </TestWrapper>,
221
+ );
222
+
223
+ layoutPages(1, 20);
224
+ layoutViewport(80);
225
+ expect(scrollTo).toHaveBeenLastCalledWith({ x: 0, animated: false });
226
+
227
+ // [1 2 3 4 5 … 20] is unchanged, so no layout event follows the press.
228
+ fireEvent.press(screen.getByLabelText('Next page'));
229
+
230
+ // Page 2 spans 48–88.
231
+ expect(scrollTo).toHaveBeenLastCalledWith({ x: 28, animated: false });
232
+ });
233
+
234
+ it('should scroll once a newly shown page is measured', () => {
235
+ const { rerender } = render(
236
+ <TestWrapper>
237
+ <Pagination page={10} totalPages={20} onPageChange={jest.fn()} />
238
+ </TestWrapper>,
239
+ );
240
+
241
+ layoutPages(10, 20);
242
+ layoutViewport(240);
243
+ scrollTo.mockClear();
244
+
245
+ rerender(
246
+ <TestWrapper>
247
+ <Pagination page={15} totalPages={20} onPageChange={jest.fn()} />
248
+ </TestWrapper>,
249
+ );
250
+ expect(scrollTo).not.toHaveBeenCalled();
251
+
252
+ layoutPages(15, 20);
253
+ // Page 15 spans 152–200 in [1 … 14 15 16 … 20].
254
+ expect(scrollTo).toHaveBeenLastCalledWith({ x: 56, animated: false });
255
+ });
256
+
257
+ it('should recenter when the viewport is resized', () => {
258
+ render(
259
+ <TestWrapper>
260
+ <Pagination page={10} totalPages={20} onPageChange={jest.fn()} />
261
+ </TestWrapper>,
262
+ );
263
+
264
+ layoutPages(10, 20);
265
+ layoutViewport(240);
266
+ expect(scrollTo).toHaveBeenLastCalledWith({ x: 48, animated: false });
267
+
268
+ layoutViewport(320);
269
+ expect(scrollTo).toHaveBeenLastCalledWith({ x: 8, animated: false });
270
+
271
+ // Wider than the content's left half: clamped to the start.
272
+ layoutViewport(400);
273
+ expect(scrollTo).toHaveBeenLastCalledWith({ x: 0, animated: false });
274
+ });
275
+ });
276
+
277
+ it('should return null when totalPages is 0', () => {
278
+ render(
279
+ <TestWrapper>
280
+ <Pagination
281
+ testID='pagination'
282
+ page={1}
283
+ totalPages={0}
284
+ onPageChange={jest.fn()}
285
+ />
286
+ </TestWrapper>,
287
+ );
288
+
289
+ expect(screen.queryByTestId('pagination')).toBeNull();
290
+ });
291
+
292
+ describe('compact density', () => {
293
+ it('should render the current of total label instead of page buttons', () => {
294
+ render(
295
+ <TestWrapper>
296
+ <Pagination
297
+ page={2}
298
+ totalPages={8}
299
+ density='compact'
300
+ onPageChange={jest.fn()}
301
+ />
302
+ </TestWrapper>,
303
+ );
304
+
305
+ expect(screen.getByText('2 of 8')).toBeTruthy();
306
+ expect(screen.queryByLabelText('Page 2')).toBeNull();
307
+ expect(screen.UNSAFE_queryByType(ScrollView)).toBeNull();
308
+ });
309
+
310
+ it('should localize the label', () => {
311
+ render(
312
+ <TestWrapper locale='fr'>
313
+ <Pagination
314
+ page={2}
315
+ totalPages={8}
316
+ density='compact'
317
+ onPageChange={jest.fn()}
318
+ />
319
+ </TestWrapper>,
320
+ );
321
+
322
+ expect(screen.getByText('2 sur 8')).toBeTruthy();
323
+ });
324
+
325
+ it('should navigate with previous and next', () => {
326
+ const onPageChange = jest.fn();
327
+
328
+ render(
329
+ <TestWrapper>
330
+ <Pagination
331
+ page={2}
332
+ totalPages={8}
333
+ density='compact'
334
+ onPageChange={onPageChange}
335
+ />
336
+ </TestWrapper>,
337
+ );
338
+
339
+ fireEvent.press(screen.getByLabelText('Previous page'));
340
+ fireEvent.press(screen.getByLabelText('Next page'));
341
+
342
+ expect(onPageChange).toHaveBeenNthCalledWith(1, 1);
343
+ expect(onPageChange).toHaveBeenNthCalledWith(2, 3);
344
+ });
345
+ });
346
+ });
@@ -0,0 +1,200 @@
1
+ import { getPaginationRange } from '@ledgerhq/lumen-utils-shared';
2
+ import { useCallback, useEffect, useRef } from 'react';
3
+ import type { LayoutChangeEvent, LayoutRectangle } from 'react-native';
4
+ import { ScrollView } from 'react-native';
5
+ import { useStyleSheet } from '../../../../styles';
6
+ import { useCommonTranslation } from '../../../../translations';
7
+ import { Box } from '../../primitives/Box';
8
+ import { Text } from '../../primitives/Text';
9
+ import { ChevronLeft, ChevronRight } from '../../symbols';
10
+ import { Button } from '../Button';
11
+ import { IconButton } from '../IconButton';
12
+ import type { PaginationProps } from './types';
13
+
14
+ const usePaginationStyles = () =>
15
+ useStyleSheet(
16
+ (t) => ({
17
+ root: {
18
+ flexDirection: 'row',
19
+ alignItems: 'center',
20
+ maxWidth: '100%',
21
+ gap: t.spacings.s8,
22
+ padding: t.spacings.s4,
23
+ },
24
+ scroll: { flexGrow: 0, flexShrink: 1 },
25
+ scrollContent: {
26
+ flexDirection: 'row',
27
+ alignItems: 'center',
28
+ gap: t.spacings.s8,
29
+ },
30
+ pageOfTotal: {
31
+ ...t.typographies.body2SemiBold,
32
+ color: t.colors.text.base,
33
+ paddingHorizontal: t.spacings.s4,
34
+ },
35
+ ellipsis: {
36
+ width: t.sizes.s40,
37
+ alignItems: 'center',
38
+ justifyContent: 'center',
39
+ },
40
+ ellipsisText: {
41
+ ...t.typographies.body2,
42
+ color: t.colors.text.muted,
43
+ },
44
+ }),
45
+ [],
46
+ );
47
+
48
+ /**
49
+ * Keeps the active page centered in the scrollable range, so navigating with
50
+ * the arrows never leaves it off-screen.
51
+ */
52
+ const useScrollToActivePage = (activePage: number) => {
53
+ const scrollRef = useRef<ScrollView>(null);
54
+ const viewportWidth = useRef(0);
55
+ const pageLayouts = useRef(new Map<number, LayoutRectangle>());
56
+
57
+ const scrollToActivePage = useCallback((): void => {
58
+ const layout = pageLayouts.current.get(activePage);
59
+ if (!layout || !viewportWidth.current) return;
60
+ scrollRef.current?.scrollTo({
61
+ x: Math.max(0, layout.x + layout.width / 2 - viewportWidth.current / 2),
62
+ animated: false,
63
+ });
64
+ }, [activePage]);
65
+
66
+ useEffect(scrollToActivePage, [scrollToActivePage]);
67
+
68
+ const onViewportLayout = (event: LayoutChangeEvent): void => {
69
+ viewportWidth.current = event.nativeEvent.layout.width;
70
+ scrollToActivePage();
71
+ };
72
+
73
+ const onPageLayout = (page: number, event: LayoutChangeEvent): void => {
74
+ pageLayouts.current.set(page, event.nativeEvent.layout);
75
+ if (page === activePage) scrollToActivePage();
76
+ };
77
+
78
+ return { scrollRef, onViewportLayout, onPageLayout };
79
+ };
80
+
81
+ /**
82
+ * Pagination navigation for lists and other paginated content.
83
+ *
84
+ * @see [Figma – Pagination](https://www.figma.com/design/JxaLVMTWirCpU0rsbZ30k7/2.-Components-Library?node-id=11768-12849&m=dev)
85
+ *
86
+ * @example
87
+ * <Pagination
88
+ * page={page}
89
+ * totalPages={10}
90
+ * onPageChange={setPage}
91
+ * />
92
+ */
93
+ export const Pagination = ({
94
+ page,
95
+ totalPages,
96
+ onPageChange,
97
+ siblingCount = 1,
98
+ density = 'expanded',
99
+ lx,
100
+ style,
101
+ ref,
102
+ ...props
103
+ }: PaginationProps) => {
104
+ const { t } = useCommonTranslation();
105
+ const styles = usePaginationStyles();
106
+ const clampedPage = Math.min(Math.max(page, 1), Math.max(totalPages, 1));
107
+ const { scrollRef, onViewportLayout, onPageLayout } =
108
+ useScrollToActivePage(clampedPage);
109
+
110
+ if (totalPages <= 0) {
111
+ return null;
112
+ }
113
+
114
+ const isCompact = density === 'compact';
115
+ const items = isCompact
116
+ ? []
117
+ : getPaginationRange(clampedPage, totalPages, Math.max(siblingCount, 0));
118
+
119
+ return (
120
+ <Box
121
+ ref={ref}
122
+ accessibilityLabel={t('components.pagination.navigationAriaLabel')}
123
+ lx={lx}
124
+ style={[styles.root, style]}
125
+ {...props}
126
+ >
127
+ <IconButton
128
+ icon={ChevronLeft}
129
+ size='sm'
130
+ appearance='gray'
131
+ disabled={clampedPage <= 1}
132
+ accessibilityLabel={t('components.pagination.previousPageAriaLabel')}
133
+ onPress={() => onPageChange(clampedPage - 1)}
134
+ />
135
+ {isCompact && (
136
+ <Text
137
+ accessibilityLiveRegion='polite'
138
+ numberOfLines={1}
139
+ style={styles.pageOfTotal}
140
+ >
141
+ {t('components.pagination.pageOfTotal', {
142
+ current: clampedPage,
143
+ total: totalPages,
144
+ })}
145
+ </Text>
146
+ )}
147
+ {!isCompact && (
148
+ <ScrollView
149
+ ref={scrollRef}
150
+ horizontal
151
+ showsHorizontalScrollIndicator={false}
152
+ style={styles.scroll}
153
+ contentContainerStyle={styles.scrollContent}
154
+ onLayout={onViewportLayout}
155
+ >
156
+ {items.map((item) => {
157
+ if (typeof item === 'string') {
158
+ return (
159
+ <Box
160
+ key={item}
161
+ importantForAccessibility='no-hide-descendants'
162
+ accessibilityElementsHidden
163
+ style={styles.ellipsis}
164
+ >
165
+ <Text style={styles.ellipsisText}>…</Text>
166
+ </Box>
167
+ );
168
+ }
169
+
170
+ const isActive = item === clampedPage;
171
+
172
+ return (
173
+ <Button
174
+ key={item}
175
+ size='sm'
176
+ appearance={isActive ? 'gray' : 'no-background'}
177
+ accessibilityLabel={t('components.pagination.pageAriaLabel', {
178
+ page: item,
179
+ })}
180
+ accessibilityState={{ selected: isActive }}
181
+ onLayout={(event) => onPageLayout(item, event)}
182
+ onPress={() => onPageChange(item)}
183
+ >
184
+ {item}
185
+ </Button>
186
+ );
187
+ })}
188
+ </ScrollView>
189
+ )}
190
+ <IconButton
191
+ icon={ChevronRight}
192
+ size='sm'
193
+ appearance='gray'
194
+ disabled={clampedPage >= totalPages}
195
+ accessibilityLabel={t('components.pagination.nextPageAriaLabel')}
196
+ onPress={() => onPageChange(clampedPage + 1)}
197
+ />
198
+ </Box>
199
+ );
200
+ };
@@ -0,0 +1,2 @@
1
+ export * from './Pagination';
2
+ export type { PaginationProps } from './types';
@@ -0,0 +1,29 @@
1
+ import type { Density } from '@ledgerhq/lumen-utils-shared';
2
+ import type { StyledViewProps } from '../../../../styles';
3
+
4
+ export type PaginationProps = {
5
+ /**
6
+ * Current page, 1-indexed.
7
+ */
8
+ page: number;
9
+ /**
10
+ * Total number of pages.
11
+ * If `<= 0`, the component returns `null`.
12
+ */
13
+ totalPages: number;
14
+ /**
15
+ * Callback fired when the user selects a different page.
16
+ */
17
+ onPageChange: (page: number) => void;
18
+ /**
19
+ * Number of page buttons shown on each side of the current page.
20
+ * @default 1
21
+ */
22
+ siblingCount?: number;
23
+ /**
24
+ * The density of the pagination. Compact replaces the page buttons with a
25
+ * "current of total" label, for tight spaces such as narrow screens.
26
+ * @default 'expanded'
27
+ */
28
+ density?: Density;
29
+ } & Omit<StyledViewProps, 'children'>;