@ledgerhq/lumen-ui-rnative 0.1.64 → 0.1.66

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 (303) hide show
  1. package/dist/module/index.js +1 -1
  2. package/dist/module/index.js.map +1 -1
  3. package/dist/module/lib/Components/core/AddressInput/AddressInput.js +1 -1
  4. package/dist/module/lib/Components/core/AddressInput/AddressInput.js.map +1 -1
  5. package/dist/module/lib/Components/core/AmountDisplay/AmountDisplay.js +1 -1
  6. package/dist/module/lib/Components/core/AmountDisplay/AmountDisplay.js.map +1 -1
  7. package/dist/module/lib/Components/core/AmountInput/AmountInput.js +1 -1
  8. package/dist/module/lib/Components/core/AmountInput/AmountInput.js.map +1 -1
  9. package/dist/module/lib/Components/core/Avatar/Avatar.js +1 -1
  10. package/dist/module/lib/Components/core/Avatar/Avatar.js.map +1 -1
  11. package/dist/module/lib/Components/core/Banner/Banner.js +1 -1
  12. package/dist/module/lib/Components/core/Banner/Banner.js.map +1 -1
  13. package/dist/module/lib/Components/core/BottomSheet/BottomSheetHeader.js +1 -1
  14. package/dist/module/lib/Components/core/BottomSheet/BottomSheetHeader.js.map +1 -1
  15. package/dist/module/lib/Components/core/CardButton/CardButton.js +2 -0
  16. package/dist/module/lib/Components/core/CardButton/CardButton.js.map +1 -1
  17. package/dist/module/lib/Components/core/CardButton/CardButton.mdx +4 -0
  18. package/dist/module/lib/Components/core/CardButton/CardButton.stories.js +1 -0
  19. package/dist/module/lib/Components/core/CardButton/CardButton.stories.js.map +1 -1
  20. package/dist/module/lib/Components/core/ContentBanner/ContentBanner.js +1 -1
  21. package/dist/module/lib/Components/core/ContentBanner/ContentBanner.js.map +1 -1
  22. package/dist/module/lib/Components/core/Link/Link.figma.js +2 -1
  23. package/dist/module/lib/Components/core/Link/Link.figma.js.map +1 -1
  24. package/dist/module/lib/Components/core/Link/Link.js +5 -3
  25. package/dist/module/lib/Components/core/Link/Link.js.map +1 -1
  26. package/dist/module/lib/Components/core/Link/Link.mdx +3 -2
  27. package/dist/module/lib/Components/core/Link/Link.stories.js +4 -1
  28. package/dist/module/lib/Components/core/Link/Link.stories.js.map +1 -1
  29. package/dist/module/lib/Components/core/Link/Link.test.js +2 -2
  30. package/dist/module/lib/Components/core/Link/Link.test.js.map +1 -1
  31. package/dist/module/lib/Components/core/MediaBanner/MediaBanner.js +1 -1
  32. package/dist/module/lib/Components/core/MediaBanner/MediaBanner.js.map +1 -1
  33. package/dist/module/lib/Components/core/MediaCard/MediaCard.js +1 -1
  34. package/dist/module/lib/Components/core/MediaCard/MediaCard.js.map +1 -1
  35. package/dist/module/lib/Components/core/NavBar/NavBar.js +1 -1
  36. package/dist/module/lib/Components/core/NavBar/NavBar.js.map +1 -1
  37. package/dist/module/lib/Components/core/Spinner/Spinner.js +1 -1
  38. package/dist/module/lib/Components/core/Spinner/Spinner.js.map +1 -1
  39. package/dist/module/lib/Components/core/Stepper/Stepper.js +77 -31
  40. package/dist/module/lib/Components/core/Stepper/Stepper.js.map +1 -1
  41. package/dist/module/lib/Components/core/Stepper/Stepper.mdx +37 -16
  42. package/dist/module/lib/Components/core/Stepper/Stepper.stories.js +102 -2
  43. package/dist/module/lib/Components/core/Stepper/Stepper.stories.js.map +1 -1
  44. package/dist/module/lib/Components/core/Stepper/Stepper.test.js +32 -1
  45. package/dist/module/lib/Components/core/Stepper/Stepper.test.js.map +1 -1
  46. package/dist/module/lib/Components/core/Subheader/Subheader.js +5 -1
  47. package/dist/module/lib/Components/core/Subheader/Subheader.js.map +1 -1
  48. package/dist/module/lib/Components/core/ThemeProvider/ThemeProvider.js +2 -2
  49. package/dist/module/lib/Components/core/ThemeProvider/ThemeProvider.js.map +1 -1
  50. package/dist/module/lib/Components/core/ThemeProvider/ThemeProvider.test.js +9 -0
  51. package/dist/module/lib/Components/core/ThemeProvider/ThemeProvider.test.js.map +1 -1
  52. package/dist/module/lib/Components/core/Timeline/Timeline.figma.js +83 -0
  53. package/dist/module/lib/Components/core/Timeline/Timeline.figma.js.map +1 -0
  54. package/dist/module/lib/Components/core/Timeline/Timeline.js +464 -0
  55. package/dist/module/lib/Components/core/Timeline/Timeline.js.map +1 -0
  56. package/dist/module/lib/Components/core/Timeline/Timeline.mdx +49 -0
  57. package/dist/module/lib/Components/core/Timeline/Timeline.stories.js +289 -0
  58. package/dist/module/lib/Components/core/Timeline/Timeline.stories.js.map +1 -0
  59. package/dist/module/lib/Components/core/Timeline/Timeline.test.js +234 -0
  60. package/dist/module/lib/Components/core/Timeline/Timeline.test.js.map +1 -0
  61. package/dist/module/lib/Components/core/Timeline/index.js +5 -0
  62. package/dist/module/lib/Components/core/Timeline/index.js.map +1 -0
  63. package/dist/module/lib/Components/core/Timeline/types.js +4 -0
  64. package/dist/module/lib/Components/core/Timeline/types.js.map +1 -0
  65. package/dist/module/lib/Components/core/Toast/Toast.figma.js +39 -0
  66. package/dist/module/lib/Components/core/Toast/Toast.figma.js.map +1 -0
  67. package/dist/module/lib/Components/core/Toast/Toast.js +138 -0
  68. package/dist/module/lib/Components/core/Toast/Toast.js.map +1 -0
  69. package/dist/module/lib/Components/core/Toast/Toast.mdx +203 -0
  70. package/dist/module/lib/Components/core/Toast/Toast.stories.js +238 -0
  71. package/dist/module/lib/Components/core/Toast/Toast.stories.js.map +1 -0
  72. package/dist/module/lib/Components/core/Toast/Toast.test.js +203 -0
  73. package/dist/module/lib/Components/core/Toast/Toast.test.js.map +1 -0
  74. package/dist/module/lib/Components/core/Toast/Toaster.js +147 -0
  75. package/dist/module/lib/Components/core/Toast/Toaster.js.map +1 -0
  76. package/dist/module/lib/Components/core/Toast/Toaster.test.js +732 -0
  77. package/dist/module/lib/Components/core/Toast/Toaster.test.js.map +1 -0
  78. package/dist/module/lib/Components/core/Toast/hooks/useToastAccessibility.js +70 -0
  79. package/dist/module/lib/Components/core/Toast/hooks/useToastAccessibility.js.map +1 -0
  80. package/dist/module/lib/Components/core/Toast/hooks/useToastCollapse.js +33 -0
  81. package/dist/module/lib/Components/core/Toast/hooks/useToastCollapse.js.map +1 -0
  82. package/dist/module/lib/Components/core/Toast/hooks/useToastGesture.js +224 -0
  83. package/dist/module/lib/Components/core/Toast/hooks/useToastGesture.js.map +1 -0
  84. package/dist/module/lib/Components/core/Toast/hooks/useToastMotion.js +82 -0
  85. package/dist/module/lib/Components/core/Toast/hooks/useToastMotion.js.map +1 -0
  86. package/dist/module/lib/Components/core/Toast/hooks/useToastViewportStyles.js +21 -0
  87. package/dist/module/lib/Components/core/Toast/hooks/useToastViewportStyles.js.map +1 -0
  88. package/dist/module/lib/Components/core/Toast/index.js +7 -0
  89. package/dist/module/lib/Components/core/Toast/index.js.map +1 -0
  90. package/dist/module/lib/Components/core/Toast/types.js +4 -0
  91. package/dist/module/lib/Components/core/Toast/types.js.map +1 -0
  92. package/dist/module/lib/Components/core/Trend/Trend.js +1 -1
  93. package/dist/module/lib/Components/core/Trend/Trend.js.map +1 -1
  94. package/dist/module/lib/Components/core/index.js +2 -0
  95. package/dist/module/lib/Components/core/index.js.map +1 -1
  96. package/dist/module/lib/Components/internal/BaseInput/BaseInput.js +1 -1
  97. package/dist/module/lib/Components/internal/BaseInput/BaseInput.js.map +1 -1
  98. package/dist/module/lib/Components/visualization/CartesianChart/CartesianChart.js +6 -2
  99. package/dist/module/lib/Components/visualization/CartesianChart/CartesianChart.js.map +1 -1
  100. package/dist/module/lib/Components/visualization/DonutChart/DonutChart.js +8 -4
  101. package/dist/module/lib/Components/visualization/DonutChart/DonutChart.js.map +1 -1
  102. package/dist/module/lib/Components/visualization/DonutChart/DonutChart.test.js +1 -1
  103. package/dist/module/lib/Components/visualization/DonutChart/DonutChart.test.js.map +1 -1
  104. package/dist/module/lib/Components/visualization/DonutChart/DonutRing.js +12 -3
  105. package/dist/module/lib/Components/visualization/DonutChart/DonutRing.js.map +1 -1
  106. package/dist/module/lib/Components/visualization/Legend/Legend.js +1 -1
  107. package/dist/module/lib/Components/visualization/Legend/Legend.js.map +1 -1
  108. package/dist/module/lib/Components/visualization/Legend/Legend.test.js +12 -8
  109. package/dist/module/lib/Components/visualization/Legend/Legend.test.js.map +1 -1
  110. package/dist/module/lib/Components/visualization/LineChart/LineChart.js +8 -2
  111. package/dist/module/lib/Components/visualization/LineChart/LineChart.js.map +1 -1
  112. package/dist/module/lib/Components/visualization/LineChart/utils.js +3 -2
  113. package/dist/module/lib/Components/visualization/LineChart/utils.js.map +1 -1
  114. package/dist/module/lib/Components/visualization/LineChart/utils.test.js +8 -4
  115. package/dist/module/lib/Components/visualization/LineChart/utils.test.js.map +1 -1
  116. package/dist/module/lib/Components/visualization/config.js +1 -4
  117. package/dist/module/lib/Components/visualization/config.js.map +1 -1
  118. package/dist/module/translations/index.js +5 -0
  119. package/dist/module/translations/index.js.map +1 -0
  120. package/dist/module/{i18n → translations}/languages.js +0 -6
  121. package/dist/module/translations/languages.js.map +1 -0
  122. package/dist/module/{i18n → translations}/locales/de.json +0 -3
  123. package/{src/i18n → dist/module/translations}/locales/en.json +9 -3
  124. package/{src/i18n → dist/module/translations}/locales/es.json +0 -3
  125. package/dist/module/{i18n → translations}/locales/fr.json +0 -3
  126. package/{src/i18n → dist/module/translations}/locales/ja.json +0 -3
  127. package/dist/module/{i18n → translations}/locales/ko.json +0 -3
  128. package/dist/module/{i18n → translations}/locales/pt.json +0 -3
  129. package/dist/module/{i18n → translations}/locales/ru.json +0 -3
  130. package/dist/module/{i18n → translations}/locales/th.json +0 -3
  131. package/dist/module/{i18n → translations}/locales/tr.json +0 -3
  132. package/{src/i18n → dist/module/translations}/locales/zh.json +0 -3
  133. package/dist/module/translations/translations.js +36 -0
  134. package/dist/module/translations/translations.js.map +1 -0
  135. package/dist/module/translations/translations.test.js +34 -0
  136. package/dist/module/translations/translations.test.js.map +1 -0
  137. package/dist/typescript/src/index.d.ts +1 -1
  138. package/dist/typescript/src/index.d.ts.map +1 -1
  139. package/dist/typescript/src/lib/Components/core/CardButton/CardButton.d.ts +2 -0
  140. package/dist/typescript/src/lib/Components/core/CardButton/CardButton.d.ts.map +1 -1
  141. package/dist/typescript/src/lib/Components/core/Link/Link.d.ts +1 -1
  142. package/dist/typescript/src/lib/Components/core/Link/Link.d.ts.map +1 -1
  143. package/dist/typescript/src/lib/Components/core/Link/types.d.ts +1 -1
  144. package/dist/typescript/src/lib/Components/core/Link/types.d.ts.map +1 -1
  145. package/dist/typescript/src/lib/Components/core/Stepper/Stepper.d.ts +4 -3
  146. package/dist/typescript/src/lib/Components/core/Stepper/Stepper.d.ts.map +1 -1
  147. package/dist/typescript/src/lib/Components/core/Stepper/types.d.ts +12 -2
  148. package/dist/typescript/src/lib/Components/core/Stepper/types.d.ts.map +1 -1
  149. package/dist/typescript/src/lib/Components/core/Subheader/Subheader.d.ts.map +1 -1
  150. package/dist/typescript/src/lib/Components/core/ThemeProvider/types.d.ts +1 -1
  151. package/dist/typescript/src/lib/Components/core/ThemeProvider/types.d.ts.map +1 -1
  152. package/dist/typescript/src/lib/Components/core/Timeline/Timeline.d.ts +56 -0
  153. package/dist/typescript/src/lib/Components/core/Timeline/Timeline.d.ts.map +1 -0
  154. package/dist/typescript/src/lib/Components/core/Timeline/index.d.ts +3 -0
  155. package/dist/typescript/src/lib/Components/core/Timeline/index.d.ts.map +1 -0
  156. package/dist/typescript/src/lib/Components/core/Timeline/types.d.ts +109 -0
  157. package/dist/typescript/src/lib/Components/core/Timeline/types.d.ts.map +1 -0
  158. package/dist/typescript/src/lib/Components/core/Toast/Toast.d.ts +24 -0
  159. package/dist/typescript/src/lib/Components/core/Toast/Toast.d.ts.map +1 -0
  160. package/dist/typescript/src/lib/Components/core/Toast/Toaster.d.ts +35 -0
  161. package/dist/typescript/src/lib/Components/core/Toast/Toaster.d.ts.map +1 -0
  162. package/dist/typescript/src/lib/Components/core/Toast/hooks/useToastAccessibility.d.ts +17 -0
  163. package/dist/typescript/src/lib/Components/core/Toast/hooks/useToastAccessibility.d.ts.map +1 -0
  164. package/dist/typescript/src/lib/Components/core/Toast/hooks/useToastCollapse.d.ts +19 -0
  165. package/dist/typescript/src/lib/Components/core/Toast/hooks/useToastCollapse.d.ts.map +1 -0
  166. package/dist/typescript/src/lib/Components/core/Toast/hooks/useToastGesture.d.ts +14 -0
  167. package/dist/typescript/src/lib/Components/core/Toast/hooks/useToastGesture.d.ts.map +1 -0
  168. package/dist/typescript/src/lib/Components/core/Toast/hooks/useToastMotion.d.ts +15 -0
  169. package/dist/typescript/src/lib/Components/core/Toast/hooks/useToastMotion.d.ts.map +1 -0
  170. package/dist/typescript/src/lib/Components/core/Toast/hooks/useToastViewportStyles.d.ts +21 -0
  171. package/dist/typescript/src/lib/Components/core/Toast/hooks/useToastViewportStyles.d.ts.map +1 -0
  172. package/dist/typescript/src/lib/Components/core/Toast/index.d.ts +5 -0
  173. package/dist/typescript/src/lib/Components/core/Toast/index.d.ts.map +1 -0
  174. package/dist/typescript/src/lib/Components/core/Toast/types.d.ts +75 -0
  175. package/dist/typescript/src/lib/Components/core/Toast/types.d.ts.map +1 -0
  176. package/dist/typescript/src/lib/Components/core/index.d.ts +2 -0
  177. package/dist/typescript/src/lib/Components/core/index.d.ts.map +1 -1
  178. package/dist/typescript/src/lib/Components/visualization/CartesianChart/CartesianChart.d.ts.map +1 -1
  179. package/dist/typescript/src/lib/Components/visualization/CartesianChart/types.d.ts +1 -1
  180. package/dist/typescript/src/lib/Components/visualization/DonutChart/DonutChart.d.ts.map +1 -1
  181. package/dist/typescript/src/lib/Components/visualization/DonutChart/DonutRing.d.ts.map +1 -1
  182. package/dist/typescript/src/lib/Components/visualization/DonutChart/types.d.ts +1 -1
  183. package/dist/typescript/src/lib/Components/visualization/Legend/Legend.d.ts.map +1 -1
  184. package/dist/typescript/src/lib/Components/visualization/Legend/types.d.ts +2 -2
  185. package/dist/typescript/src/lib/Components/visualization/LineChart/LineChart.d.ts +1 -1
  186. package/dist/typescript/src/lib/Components/visualization/LineChart/LineChart.d.ts.map +1 -1
  187. package/dist/typescript/src/lib/Components/visualization/LineChart/types.d.ts +1 -1
  188. package/dist/typescript/src/lib/Components/visualization/LineChart/utils.d.ts +2 -1
  189. package/dist/typescript/src/lib/Components/visualization/LineChart/utils.d.ts.map +1 -1
  190. package/dist/typescript/src/lib/Components/visualization/config.d.ts +0 -3
  191. package/dist/typescript/src/lib/Components/visualization/config.d.ts.map +1 -1
  192. package/dist/typescript/src/translations/index.d.ts +3 -0
  193. package/dist/typescript/src/translations/index.d.ts.map +1 -0
  194. package/dist/typescript/src/{i18n → translations}/languages.d.ts +0 -5
  195. package/dist/typescript/src/translations/languages.d.ts.map +1 -0
  196. package/dist/typescript/src/translations/translations.d.ts +421 -0
  197. package/dist/typescript/src/translations/translations.d.ts.map +1 -0
  198. package/package.json +4 -6
  199. package/src/index.ts +1 -1
  200. package/src/lib/Components/core/AddressInput/AddressInput.tsx +1 -1
  201. package/src/lib/Components/core/AmountDisplay/AmountDisplay.tsx +1 -1
  202. package/src/lib/Components/core/AmountInput/AmountInput.tsx +1 -1
  203. package/src/lib/Components/core/Avatar/Avatar.tsx +1 -1
  204. package/src/lib/Components/core/Banner/Banner.tsx +1 -1
  205. package/src/lib/Components/core/BottomSheet/BottomSheetHeader.tsx +1 -1
  206. package/src/lib/Components/core/CardButton/CardButton.mdx +4 -0
  207. package/src/lib/Components/core/CardButton/CardButton.stories.tsx +1 -0
  208. package/src/lib/Components/core/CardButton/CardButton.tsx +2 -0
  209. package/src/lib/Components/core/ContentBanner/ContentBanner.tsx +1 -1
  210. package/src/lib/Components/core/Link/Link.figma.tsx +1 -0
  211. package/src/lib/Components/core/Link/Link.mdx +3 -2
  212. package/src/lib/Components/core/Link/Link.stories.tsx +3 -2
  213. package/src/lib/Components/core/Link/Link.test.tsx +2 -0
  214. package/src/lib/Components/core/Link/Link.tsx +3 -1
  215. package/src/lib/Components/core/Link/types.ts +1 -1
  216. package/src/lib/Components/core/MediaBanner/MediaBanner.tsx +1 -1
  217. package/src/lib/Components/core/MediaCard/MediaCard.tsx +1 -1
  218. package/src/lib/Components/core/NavBar/NavBar.tsx +1 -1
  219. package/src/lib/Components/core/Spinner/Spinner.tsx +1 -1
  220. package/src/lib/Components/core/Stepper/Stepper.mdx +37 -16
  221. package/src/lib/Components/core/Stepper/Stepper.stories.tsx +50 -2
  222. package/src/lib/Components/core/Stepper/Stepper.test.tsx +29 -1
  223. package/src/lib/Components/core/Stepper/Stepper.tsx +74 -33
  224. package/src/lib/Components/core/Stepper/types.ts +12 -2
  225. package/src/lib/Components/core/Subheader/Subheader.tsx +3 -1
  226. package/src/lib/Components/core/ThemeProvider/ThemeProvider.test.tsx +11 -0
  227. package/src/lib/Components/core/ThemeProvider/ThemeProvider.tsx +3 -3
  228. package/src/lib/Components/core/ThemeProvider/types.ts +1 -1
  229. package/src/lib/Components/core/Timeline/Timeline.figma.tsx +79 -0
  230. package/src/lib/Components/core/Timeline/Timeline.mdx +49 -0
  231. package/src/lib/Components/core/Timeline/Timeline.stories.tsx +250 -0
  232. package/src/lib/Components/core/Timeline/Timeline.test.tsx +275 -0
  233. package/src/lib/Components/core/Timeline/Timeline.tsx +576 -0
  234. package/src/lib/Components/core/Timeline/index.ts +2 -0
  235. package/src/lib/Components/core/Timeline/types.ts +124 -0
  236. package/src/lib/Components/core/Toast/Toast.figma.tsx +36 -0
  237. package/src/lib/Components/core/Toast/Toast.mdx +203 -0
  238. package/src/lib/Components/core/Toast/Toast.stories.tsx +260 -0
  239. package/src/lib/Components/core/Toast/Toast.test.tsx +181 -0
  240. package/src/lib/Components/core/Toast/Toast.tsx +163 -0
  241. package/src/lib/Components/core/Toast/Toaster.test.tsx +687 -0
  242. package/src/lib/Components/core/Toast/Toaster.tsx +157 -0
  243. package/src/lib/Components/core/Toast/hooks/useToastAccessibility.ts +82 -0
  244. package/src/lib/Components/core/Toast/hooks/useToastCollapse.ts +38 -0
  245. package/src/lib/Components/core/Toast/hooks/useToastGesture.ts +83 -0
  246. package/src/lib/Components/core/Toast/hooks/useToastMotion.ts +71 -0
  247. package/src/lib/Components/core/Toast/hooks/useToastViewportStyles.ts +45 -0
  248. package/src/lib/Components/core/Toast/index.ts +4 -0
  249. package/src/lib/Components/core/Toast/types.ts +94 -0
  250. package/src/lib/Components/core/Trend/Trend.tsx +1 -1
  251. package/src/lib/Components/core/index.ts +2 -0
  252. package/src/lib/Components/internal/BaseInput/BaseInput.tsx +1 -1
  253. package/src/lib/Components/visualization/CartesianChart/CartesianChart.tsx +4 -2
  254. package/src/lib/Components/visualization/CartesianChart/types.ts +1 -1
  255. package/src/lib/Components/visualization/DonutChart/DonutChart.test.tsx +1 -3
  256. package/src/lib/Components/visualization/DonutChart/DonutChart.tsx +7 -3
  257. package/src/lib/Components/visualization/DonutChart/DonutRing.tsx +11 -1
  258. package/src/lib/Components/visualization/DonutChart/types.ts +1 -1
  259. package/src/lib/Components/visualization/Legend/Legend.test.tsx +9 -8
  260. package/src/lib/Components/visualization/Legend/Legend.tsx +1 -1
  261. package/src/lib/Components/visualization/Legend/types.ts +2 -2
  262. package/src/lib/Components/visualization/LineChart/LineChart.tsx +10 -2
  263. package/src/lib/Components/visualization/LineChart/types.ts +1 -1
  264. package/src/lib/Components/visualization/LineChart/utils.test.ts +4 -0
  265. package/src/lib/Components/visualization/LineChart/utils.ts +6 -2
  266. package/src/lib/Components/visualization/config.ts +0 -3
  267. package/src/translations/index.ts +2 -0
  268. package/src/{i18n → translations}/languages.ts +0 -6
  269. package/src/{i18n → translations}/locales/de.json +0 -3
  270. package/{dist/module/i18n → src/translations}/locales/en.json +9 -3
  271. package/{dist/module/i18n → src/translations}/locales/es.json +0 -3
  272. package/src/{i18n → translations}/locales/fr.json +0 -3
  273. package/{dist/module/i18n → src/translations}/locales/ja.json +0 -3
  274. package/src/{i18n → translations}/locales/ko.json +0 -3
  275. package/src/{i18n → translations}/locales/pt.json +0 -3
  276. package/src/{i18n → translations}/locales/ru.json +0 -3
  277. package/src/{i18n → translations}/locales/th.json +0 -3
  278. package/src/{i18n → translations}/locales/tr.json +0 -3
  279. package/{dist/module/i18n → src/translations}/locales/zh.json +0 -3
  280. package/src/translations/translations.test.ts +56 -0
  281. package/src/translations/translations.ts +21 -0
  282. package/dist/module/i18n/I18nProvider.js +0 -20
  283. package/dist/module/i18n/I18nProvider.js.map +0 -1
  284. package/dist/module/i18n/i18n.js +0 -82
  285. package/dist/module/i18n/i18n.js.map +0 -1
  286. package/dist/module/i18n/index.js +0 -6
  287. package/dist/module/i18n/index.js.map +0 -1
  288. package/dist/module/i18n/languages.js.map +0 -1
  289. package/dist/module/i18n/useCommonTranslation.js +0 -8
  290. package/dist/module/i18n/useCommonTranslation.js.map +0 -1
  291. package/dist/typescript/src/i18n/I18nProvider.d.ts +0 -8
  292. package/dist/typescript/src/i18n/I18nProvider.d.ts.map +0 -1
  293. package/dist/typescript/src/i18n/i18n.d.ts +0 -13
  294. package/dist/typescript/src/i18n/i18n.d.ts.map +0 -1
  295. package/dist/typescript/src/i18n/index.d.ts +0 -4
  296. package/dist/typescript/src/i18n/index.d.ts.map +0 -1
  297. package/dist/typescript/src/i18n/languages.d.ts.map +0 -1
  298. package/dist/typescript/src/i18n/useCommonTranslation.d.ts +0 -2
  299. package/dist/typescript/src/i18n/useCommonTranslation.d.ts.map +0 -1
  300. package/src/i18n/I18nProvider.tsx +0 -20
  301. package/src/i18n/i18n.ts +0 -107
  302. package/src/i18n/index.ts +0 -3
  303. package/src/i18n/useCommonTranslation.ts +0 -6
@@ -0,0 +1,687 @@
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 {
11
+ toast,
12
+ toastStore,
13
+ EXIT_ANIMATION_MS,
14
+ } from '@ledgerhq/lumen-utils-shared';
15
+ import { act, fireEvent, render, screen } from '@testing-library/react-native';
16
+ import { useLayoutEffect, type ReactNode } from 'react';
17
+ import { AccessibilityInfo, Platform } from 'react-native';
18
+ import { SafeAreaProvider } from 'react-native-safe-area-context';
19
+ import { ThemeProvider } from '../ThemeProvider/ThemeProvider';
20
+ import { Toaster } from './Toaster';
21
+ import type { ToasterProps } from './types';
22
+
23
+ const initialMetrics = {
24
+ frame: { x: 0, y: 0, width: 320, height: 640 },
25
+ insets: { top: 0, left: 0, right: 0, bottom: 0 },
26
+ };
27
+
28
+ const TestProviders = ({ children }: { children: ReactNode }) => (
29
+ <SafeAreaProvider initialMetrics={initialMetrics}>
30
+ <ThemeProvider themes={ledgerLiveThemes} colorScheme='dark' locale='en'>
31
+ {children}
32
+ </ThemeProvider>
33
+ </SafeAreaProvider>
34
+ );
35
+
36
+ const renderToaster = (props?: ToasterProps) =>
37
+ render(
38
+ <TestProviders>
39
+ <Toaster {...props} />
40
+ </TestProviders>,
41
+ );
42
+
43
+ const clearToastItems = (): void => {
44
+ for (const { id } of toastStore.getSnapshot()) {
45
+ toastStore.dismiss(id);
46
+ toastStore.dismiss(id);
47
+ }
48
+ };
49
+
50
+ const flushExit = (): void => {
51
+ act(() => {
52
+ jest.advanceTimersByTime(EXIT_ANIMATION_MS);
53
+ });
54
+ };
55
+
56
+ describe('Toaster', () => {
57
+ beforeEach(() => {
58
+ clearToastItems();
59
+ });
60
+
61
+ describe('Timing', () => {
62
+ beforeEach(() => {
63
+ jest.useFakeTimers();
64
+ });
65
+
66
+ afterEach(() => {
67
+ act(() => {
68
+ jest.runOnlyPendingTimers();
69
+ });
70
+ jest.useRealTimers();
71
+ });
72
+
73
+ it('should render a toast on notify', () => {
74
+ renderToaster();
75
+ act(() => {
76
+ toast.info({ title: 'Hello' });
77
+ });
78
+ screen.getByText('Hello');
79
+ });
80
+
81
+ it('should show a toast that was notified before the toaster mounted', () => {
82
+ act(() => {
83
+ toast.info({ title: 'Queued early' });
84
+ });
85
+
86
+ renderToaster();
87
+ screen.getByText('Queued early');
88
+ });
89
+
90
+ it('should apply Toaster props to toasts fired before its effects run', () => {
91
+ const EarlyNotifier = () => {
92
+ useLayoutEffect(() => {
93
+ toast.info({ title: 'First' });
94
+ toast.info({ title: 'Second' });
95
+ }, []);
96
+ return null;
97
+ };
98
+ render(
99
+ <TestProviders>
100
+ <EarlyNotifier />
101
+ <Toaster maxItems={1} durations={{ info: 1000 }} />
102
+ </TestProviders>,
103
+ );
104
+
105
+ expect(screen.queryByText('Second')).toBeNull();
106
+ act(() => {
107
+ jest.advanceTimersByTime(1000);
108
+ });
109
+ flushExit();
110
+ expect(screen.queryByText('First')).toBeNull();
111
+ screen.getByText('Second');
112
+ });
113
+
114
+ it('should auto-dismiss info after the default 5s', () => {
115
+ renderToaster();
116
+ act(() => {
117
+ toast.info({ title: 'Hello' });
118
+ });
119
+
120
+ act(() => {
121
+ jest.advanceTimersByTime(4999);
122
+ });
123
+ screen.getByText('Hello');
124
+
125
+ act(() => {
126
+ jest.advanceTimersByTime(1);
127
+ });
128
+ flushExit();
129
+ expect(screen.queryByText('Hello')).toBeNull();
130
+ });
131
+
132
+ it('should keep warning toasts until dismissed', () => {
133
+ renderToaster();
134
+ act(() => {
135
+ toast.warning({ title: 'Careful' });
136
+ });
137
+
138
+ act(() => {
139
+ jest.advanceTimersByTime(60000);
140
+ });
141
+ screen.getByText('Careful');
142
+ });
143
+
144
+ it('should queue items past maxItems and promote them as slots free', () => {
145
+ renderToaster({ maxItems: 1 });
146
+ act(() => {
147
+ toast.info({ title: 'First' });
148
+ toast.info({ title: 'Second' });
149
+ });
150
+
151
+ screen.getByText('First');
152
+ expect(screen.queryByText('Second')).toBeNull();
153
+
154
+ act(() => {
155
+ jest.advanceTimersByTime(5000);
156
+ });
157
+ flushExit();
158
+
159
+ expect(screen.queryByText('First')).toBeNull();
160
+ screen.getByText('Second');
161
+ });
162
+
163
+ it('should not keep a per-item duration across an update that omits it', () => {
164
+ renderToaster();
165
+ let id = '';
166
+ act(() => {
167
+ id = toast.loading({ title: 'Loading', duration: 10000 }).id;
168
+ });
169
+
170
+ act(() => {
171
+ toast.update(id, {
172
+ appearance: 'success',
173
+ loading: false,
174
+ title: 'Done',
175
+ });
176
+ });
177
+
178
+ act(() => {
179
+ jest.advanceTimersByTime(5000);
180
+ });
181
+ flushExit();
182
+ expect(screen.queryByText('Done')).toBeNull();
183
+ });
184
+
185
+ it('should pause the timer while held and resume remaining time on release', () => {
186
+ const { getByTestId } = renderToaster();
187
+ act(() => {
188
+ toast.info({ title: 'Hold me' });
189
+ });
190
+
191
+ act(() => {
192
+ jest.advanceTimersByTime(2000);
193
+ });
194
+
195
+ const entry = getByTestId('toast-entry');
196
+ act(() => {
197
+ entry.props.onTouchesDown();
198
+ });
199
+
200
+ act(() => {
201
+ jest.advanceTimersByTime(60000);
202
+ });
203
+ screen.getByText('Hold me');
204
+
205
+ act(() => {
206
+ entry.props.onTouchesUp({ numberOfTouches: 0 });
207
+ });
208
+
209
+ act(() => {
210
+ jest.advanceTimersByTime(2999);
211
+ });
212
+ screen.getByText('Hold me');
213
+
214
+ act(() => {
215
+ jest.advanceTimersByTime(1);
216
+ });
217
+ flushExit();
218
+ expect(screen.queryByText('Hold me')).toBeNull();
219
+ });
220
+
221
+ it('should stay paused while swiping and resume once the toast springs back', () => {
222
+ const { getByTestId } = renderToaster();
223
+ act(() => {
224
+ toast.info({ title: 'Swipe me' });
225
+ });
226
+
227
+ act(() => {
228
+ jest.advanceTimersByTime(2000);
229
+ });
230
+
231
+ const entry = getByTestId('toast-entry');
232
+ act(() => {
233
+ entry.props.onTouchesDown();
234
+ entry.props.onUpdate({ translationX: 40 });
235
+ });
236
+
237
+ act(() => {
238
+ jest.advanceTimersByTime(60000);
239
+ });
240
+ screen.getByText('Swipe me');
241
+
242
+ act(() => {
243
+ entry.props.onEnd({ translationX: 20 });
244
+ entry.props.onFinalize();
245
+ });
246
+
247
+ act(() => {
248
+ jest.advanceTimersByTime(2999);
249
+ });
250
+ screen.getByText('Swipe me');
251
+
252
+ act(() => {
253
+ jest.advanceTimersByTime(1);
254
+ });
255
+ flushExit();
256
+ expect(screen.queryByText('Swipe me')).toBeNull();
257
+ });
258
+
259
+ it('should restart the timer when a loading toast becomes a success', () => {
260
+ renderToaster();
261
+ let id = '';
262
+ act(() => {
263
+ id = toast.loading({ title: 'Loading' }).id;
264
+ });
265
+
266
+ act(() => {
267
+ jest.advanceTimersByTime(60000);
268
+ });
269
+ screen.getByText('Loading');
270
+
271
+ act(() => {
272
+ toast.update(id, {
273
+ appearance: 'success',
274
+ loading: false,
275
+ title: 'Done',
276
+ });
277
+ });
278
+ screen.getByText('Done');
279
+
280
+ act(() => {
281
+ jest.advanceTimersByTime(5000);
282
+ });
283
+ flushExit();
284
+ expect(screen.queryByText('Done')).toBeNull();
285
+ });
286
+ });
287
+
288
+ describe('Defaults', () => {
289
+ it('should default maxItems to 1', () => {
290
+ renderToaster();
291
+ act(() => {
292
+ toast.info({ title: 'First' });
293
+ toast.info({ title: 'Second' });
294
+ });
295
+
296
+ screen.getByText('First');
297
+ expect(screen.queryByText('Second')).toBeNull();
298
+ });
299
+
300
+ it('should default position to bottom', () => {
301
+ const { getByTestId } = renderToaster();
302
+ const viewport = getByTestId('toast-viewport');
303
+ expect(viewport.props.style.bottom).toBeDefined();
304
+ expect(viewport.props.style.top).toBeUndefined();
305
+ });
306
+
307
+ it('should anchor the viewport to the top when position is top', () => {
308
+ const { getByTestId } = renderToaster({ position: 'top' });
309
+ const viewport = getByTestId('toast-viewport');
310
+ expect(viewport.props.style.top).toBeDefined();
311
+ expect(viewport.props.style.bottom).toBeUndefined();
312
+ });
313
+
314
+ it('should default insets to 0 and still apply the breathing-room gap', () => {
315
+ const { getByTestId } = renderToaster();
316
+ expect(getByTestId('toast-viewport').props.style.bottom).toBe(24);
317
+ });
318
+
319
+ it('adds a custom bottom inset to the gap instead of replacing it', () => {
320
+ const { getByTestId } = renderToaster({ insets: { bottom: 80 } });
321
+ expect(getByTestId('toast-viewport').props.style.bottom).toBe(104);
322
+ });
323
+ });
324
+
325
+ describe('Dismissal', () => {
326
+ beforeEach(() => {
327
+ jest.useFakeTimers();
328
+ });
329
+
330
+ afterEach(() => {
331
+ act(() => {
332
+ jest.runOnlyPendingTimers();
333
+ });
334
+ jest.useRealTimers();
335
+ });
336
+
337
+ it('should collapse the stack slot while exiting', () => {
338
+ renderToaster();
339
+ let id = '';
340
+ act(() => {
341
+ id = toast.warning({ title: 'Careful' }).id;
342
+ });
343
+
344
+ act(() => {
345
+ toast.dismiss(id);
346
+ });
347
+ expect(screen.getByTestId('toast-collapse')).toHaveStyle({ height: 0 });
348
+
349
+ flushExit();
350
+ expect(screen.queryByText('Careful')).toBeNull();
351
+ });
352
+
353
+ it('should dismiss a single item by id and dismiss all', () => {
354
+ renderToaster({ maxItems: 2 });
355
+ let first = '';
356
+ act(() => {
357
+ first = toast.warning({ title: 'A' }).id;
358
+ toast.warning({ title: 'B' });
359
+ });
360
+
361
+ act(() => {
362
+ toast.dismiss(first);
363
+ });
364
+ screen.getByText('A');
365
+
366
+ flushExit();
367
+ expect(screen.queryByText('A')).toBeNull();
368
+ screen.getByText('B');
369
+
370
+ act(() => {
371
+ toast.dismissAll();
372
+ });
373
+ flushExit();
374
+ expect(screen.queryByText('B')).toBeNull();
375
+ });
376
+
377
+ it('should dismiss on a swipe past the threshold', () => {
378
+ const { getByTestId } = renderToaster();
379
+ act(() => {
380
+ toast.warning({ title: 'Swipe me' });
381
+ });
382
+
383
+ const entry = getByTestId('toast-entry');
384
+ act(() => {
385
+ entry.props.onEnd({ translationX: 150 });
386
+ });
387
+
388
+ flushExit();
389
+ expect(screen.queryByText('Swipe me')).toBeNull();
390
+ });
391
+
392
+ it('should spring back and stay visible on a swipe under the threshold', () => {
393
+ const { getByTestId } = renderToaster();
394
+ act(() => {
395
+ toast.warning({ title: 'Stays put' });
396
+ });
397
+
398
+ const entry = getByTestId('toast-entry');
399
+ act(() => {
400
+ entry.props.onEnd({ translationX: 20 });
401
+ });
402
+
403
+ screen.getByText('Stays put');
404
+ });
405
+
406
+ it('should stay visible when swiped past the threshold if not dismissible', () => {
407
+ const { getByTestId } = renderToaster();
408
+ act(() => {
409
+ toast.warning({ title: 'Locked', dismissible: false });
410
+ });
411
+
412
+ const entry = getByTestId('toast-entry');
413
+ act(() => {
414
+ entry.props.onEnd({ translationX: 150 });
415
+ });
416
+
417
+ flushExit();
418
+ screen.getByText('Locked');
419
+ });
420
+ });
421
+
422
+ describe('Accessibility', () => {
423
+ beforeEach(() => {
424
+ jest.useFakeTimers();
425
+ });
426
+
427
+ afterEach(() => {
428
+ act(() => {
429
+ jest.runOnlyPendingTimers();
430
+ });
431
+ jest.useRealTimers();
432
+ });
433
+
434
+ it('should expose the toast as one element labelled by its title', () => {
435
+ renderToaster();
436
+ act(() => {
437
+ toast.info({ title: 'Saved' });
438
+ });
439
+
440
+ const entry = screen.getByTestId('toast-entry');
441
+ expect(entry.props.accessible).toBe(true);
442
+ expect(entry.props.accessibilityLabel).toBe('Saved');
443
+ });
444
+
445
+ it('should dismiss through the dismiss accessibility action', () => {
446
+ renderToaster();
447
+ act(() => {
448
+ toast.warning({ title: 'Dismiss me' });
449
+ });
450
+
451
+ expect(
452
+ screen.getByTestId('toast-entry').props.accessibilityActions,
453
+ ).toContainEqual({ name: 'dismiss', label: 'Close' });
454
+ fireEvent(screen.getByTestId('toast-entry'), 'accessibilityAction', {
455
+ nativeEvent: { actionName: 'dismiss' },
456
+ });
457
+ flushExit();
458
+ expect(screen.queryByText('Dismiss me')).toBeNull();
459
+ });
460
+
461
+ it('should dismiss on the iOS escape gesture', () => {
462
+ renderToaster();
463
+ act(() => {
464
+ toast.warning({ title: 'Escape me' });
465
+ });
466
+
467
+ fireEvent(screen.getByTestId('toast-entry'), 'accessibilityEscape');
468
+ flushExit();
469
+ expect(screen.queryByText('Escape me')).toBeNull();
470
+ });
471
+
472
+ it('should expose the inline action as an accessibility action', () => {
473
+ const onAction = jest.fn();
474
+ renderToaster();
475
+ act(() => {
476
+ toast.warning({
477
+ title: 'Deleted',
478
+ action: { label: 'Undo', onAction },
479
+ });
480
+ });
481
+
482
+ const entry = screen.getByTestId('toast-entry');
483
+ expect(entry.props.accessibilityActions).toContainEqual({
484
+ name: 'toastAction',
485
+ label: 'Undo',
486
+ });
487
+ fireEvent(entry, 'accessibilityAction', {
488
+ nativeEvent: { actionName: 'toastAction' },
489
+ });
490
+ expect(onAction).toHaveBeenCalledTimes(1);
491
+ screen.getByText('Deleted');
492
+ });
493
+
494
+ it('should not offer dismissal for a non-dismissible toast', () => {
495
+ renderToaster();
496
+ act(() => {
497
+ toast.info({ title: 'Locked', dismissible: false });
498
+ });
499
+
500
+ const entry = screen.getByTestId('toast-entry');
501
+ expect(entry.props.accessibilityActions).toEqual([]);
502
+ expect(entry.props.onAccessibilityEscape).toBeUndefined();
503
+ });
504
+
505
+ describe('on iOS', () => {
506
+ const originalOS = Platform.OS;
507
+
508
+ beforeEach(() => {
509
+ Platform.OS = 'ios';
510
+ });
511
+
512
+ afterEach(() => {
513
+ Platform.OS = originalOS;
514
+ });
515
+
516
+ it('should announce the title, interrupting only for warning and error', () => {
517
+ const announce = jest
518
+ .spyOn(AccessibilityInfo, 'announceForAccessibilityWithOptions')
519
+ .mockImplementation(() => undefined);
520
+ renderToaster({ maxItems: 2 });
521
+ act(() => {
522
+ toast.info({ title: 'Heads up' });
523
+ toast.error({ title: 'Failed' });
524
+ });
525
+
526
+ expect(announce).toHaveBeenCalledWith('Heads up', { queue: true });
527
+ expect(announce).toHaveBeenCalledWith('Failed', { queue: false });
528
+ announce.mockRestore();
529
+ });
530
+
531
+ it('should announce again when the title changes', () => {
532
+ const announce = jest
533
+ .spyOn(AccessibilityInfo, 'announceForAccessibilityWithOptions')
534
+ .mockImplementation(() => undefined);
535
+ renderToaster();
536
+ let id = '';
537
+ act(() => {
538
+ id = toast.info({ title: 'Uploading', loading: true }).id;
539
+ });
540
+ act(() => {
541
+ toast.update(id, { title: 'Uploaded', appearance: 'success' });
542
+ });
543
+
544
+ expect(announce).toHaveBeenLastCalledWith('Uploaded', { queue: true });
545
+ announce.mockRestore();
546
+ });
547
+ });
548
+ });
549
+
550
+ describe('promise', () => {
551
+ it('should move the toast from loading to success', async () => {
552
+ renderToaster();
553
+
554
+ let resolveFn: (value: string) => void = () => {};
555
+ const promise = new Promise<string>((resolve) => {
556
+ resolveFn = resolve;
557
+ });
558
+
559
+ act(() => {
560
+ toast.promise(promise, {
561
+ loading: { title: 'Saving' },
562
+ success: { title: 'Saved' },
563
+ error: { title: 'Failed' },
564
+ });
565
+ });
566
+ screen.getByText('Saving');
567
+
568
+ resolveFn('ok');
569
+ expect(await screen.findByText('Saved')).toBeTruthy();
570
+ });
571
+
572
+ it('should drop the loading action when success omits it', async () => {
573
+ renderToaster();
574
+
575
+ let resolveFn: (value: string) => void = () => {};
576
+ const promise = new Promise<string>((resolve) => {
577
+ resolveFn = resolve;
578
+ });
579
+
580
+ act(() => {
581
+ toast.promise(promise, {
582
+ loading: {
583
+ title: 'Saving',
584
+ action: { label: 'Cancel', onAction: () => {} },
585
+ },
586
+ success: { title: 'Saved' },
587
+ error: { title: 'Failed' },
588
+ });
589
+ });
590
+ screen.getByText('Cancel');
591
+
592
+ resolveFn('ok');
593
+ expect(await screen.findByText('Saved')).toBeTruthy();
594
+ expect(screen.queryByText('Cancel')).toBeNull();
595
+ });
596
+
597
+ it('should drop the loading action when error omits it', async () => {
598
+ renderToaster();
599
+
600
+ let rejectFn: (reason: unknown) => void = () => {};
601
+ const promise = new Promise<string>((_resolve, reject) => {
602
+ rejectFn = reject;
603
+ });
604
+
605
+ act(() => {
606
+ toast.promise(promise, {
607
+ loading: {
608
+ title: 'Saving',
609
+ action: { label: 'Cancel', onAction: () => {} },
610
+ },
611
+ success: { title: 'Saved' },
612
+ error: { title: 'Failed' },
613
+ });
614
+ });
615
+ screen.getByText('Cancel');
616
+
617
+ rejectFn(new Error('nope'));
618
+ expect(await screen.findByText('Failed')).toBeTruthy();
619
+ expect(screen.queryByText('Cancel')).toBeNull();
620
+ });
621
+
622
+ it('should restore dismissal when error omits dismissible', async () => {
623
+ renderToaster();
624
+
625
+ let rejectFn: (reason: unknown) => void = () => {};
626
+ const promise = new Promise<string>((_resolve, reject) => {
627
+ rejectFn = reject;
628
+ });
629
+
630
+ act(() => {
631
+ toast.promise(promise, {
632
+ loading: { title: 'Saving', dismissible: false },
633
+ success: { title: 'Saved' },
634
+ error: { title: 'Failed' },
635
+ });
636
+ });
637
+ expect(
638
+ screen.getByTestId('toast-entry').props.onAccessibilityEscape,
639
+ ).toBeUndefined();
640
+
641
+ rejectFn(new Error('nope'));
642
+ expect(await screen.findByText('Failed')).toBeTruthy();
643
+ expect(
644
+ screen.getByTestId('toast-entry').props.accessibilityActions,
645
+ ).toContainEqual(expect.objectContaining({ name: 'dismiss' }));
646
+ });
647
+
648
+ it('should move the toast from loading to error on rejection', async () => {
649
+ renderToaster();
650
+
651
+ let rejectFn: (reason: unknown) => void = () => {};
652
+ const promise = new Promise<string>((_resolve, reject) => {
653
+ rejectFn = reject;
654
+ });
655
+
656
+ act(() => {
657
+ toast.promise(promise, {
658
+ loading: { title: 'Saving' },
659
+ success: { title: 'Saved' },
660
+ error: { title: 'Failed' },
661
+ });
662
+ });
663
+ screen.getByText('Saving');
664
+
665
+ rejectFn(new Error('nope'));
666
+ expect(await screen.findByText('Failed')).toBeTruthy();
667
+ });
668
+ });
669
+
670
+ describe('Multiple instances', () => {
671
+ it('warns when a second Toaster mounts while one is already mounted', () => {
672
+ const warnSpy = jest.spyOn(console, 'warn').mockImplementation(() => {
673
+ return;
674
+ });
675
+
676
+ const first = renderToaster();
677
+ expect(warnSpy).not.toHaveBeenCalled();
678
+
679
+ const second = renderToaster();
680
+ expect(warnSpy).toHaveBeenCalledTimes(1);
681
+
682
+ first.unmount();
683
+ second.unmount();
684
+ warnSpy.mockRestore();
685
+ });
686
+ });
687
+ });