@ledgerhq/lumen-ui-rnative 0.1.47 → 0.1.49

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 (362) hide show
  1. package/dist/module/i18n/locales/de.json +1 -3
  2. package/dist/module/i18n/locales/en.json +1 -3
  3. package/dist/module/i18n/locales/es.json +1 -3
  4. package/dist/module/i18n/locales/fr.json +1 -3
  5. package/dist/module/i18n/locales/ja.json +1 -3
  6. package/dist/module/i18n/locales/ko.json +1 -3
  7. package/dist/module/i18n/locales/pt.json +1 -3
  8. package/dist/module/i18n/locales/ru.json +1 -3
  9. package/dist/module/i18n/locales/th.json +1 -3
  10. package/dist/module/i18n/locales/tr.json +1 -3
  11. package/dist/module/i18n/locales/zh.json +1 -3
  12. package/dist/module/lib/Animations/Pulse/Pulse.js +3 -3
  13. package/dist/module/lib/Animations/Pulse/Pulse.js.map +1 -1
  14. package/dist/module/lib/Animations/Pulse/Pulse.mdx +0 -1
  15. package/dist/module/lib/Animations/Spin/Spin.js +3 -3
  16. package/dist/module/lib/Animations/Spin/Spin.js.map +1 -1
  17. package/dist/module/lib/Animations/Spin/Spin.mdx +0 -1
  18. package/dist/module/lib/Components/AddressInput/AddressInput.figma.js +36 -0
  19. package/dist/module/lib/Components/AddressInput/AddressInput.figma.js.map +1 -0
  20. package/dist/module/lib/Components/AddressInput/AddressInput.mdx +0 -183
  21. package/dist/module/lib/Components/AmountDisplay/AmountDisplay.figma.js +31 -0
  22. package/dist/module/lib/Components/AmountDisplay/AmountDisplay.figma.js.map +1 -0
  23. package/dist/module/lib/Components/AmountDisplay/AmountDisplay.mdx +0 -90
  24. package/dist/module/lib/Components/AmountInput/AmountInput.figma.js +70 -0
  25. package/dist/module/lib/Components/AmountInput/AmountInput.figma.js.map +1 -0
  26. package/dist/module/lib/Components/AmountInput/AmountInput.js +3 -1
  27. package/dist/module/lib/Components/AmountInput/AmountInput.js.map +1 -1
  28. package/dist/module/lib/Components/AmountInput/AmountInput.mdx +0 -190
  29. package/dist/module/lib/Components/AmountInput/AmountInput.stories.js +15 -0
  30. package/dist/module/lib/Components/AmountInput/AmountInput.stories.js.map +1 -1
  31. package/dist/module/lib/Components/AmountInput/useAmountInputFormatting/useAmountInputFormatting.js +1 -1
  32. package/dist/module/lib/Components/AmountInput/useAmountInputFormatting/useAmountInputFormatting.js.map +1 -1
  33. package/dist/module/lib/Components/AmountInput/useAmountInputFormatting/useAmountInputFormatting.test.js +20 -1
  34. package/dist/module/lib/Components/AmountInput/useAmountInputFormatting/useAmountInputFormatting.test.js.map +1 -1
  35. package/dist/module/lib/Components/Avatar/Avatar.figma.js +15 -12
  36. package/dist/module/lib/Components/Avatar/Avatar.figma.js.map +1 -1
  37. package/dist/module/lib/Components/Avatar/Avatar.js +4 -27
  38. package/dist/module/lib/Components/Avatar/Avatar.js.map +1 -1
  39. package/dist/module/lib/Components/Avatar/Avatar.mdx +53 -69
  40. package/dist/module/lib/Components/Avatar/Avatar.stories.js +27 -33
  41. package/dist/module/lib/Components/Avatar/Avatar.stories.js.map +1 -1
  42. package/dist/module/lib/Components/Avatar/Avatar.test.js +21 -39
  43. package/dist/module/lib/Components/Avatar/Avatar.test.js.map +1 -1
  44. package/dist/module/lib/Components/Banner/Banner.figma.js +107 -0
  45. package/dist/module/lib/Components/Banner/Banner.figma.js.map +1 -0
  46. package/dist/module/lib/Components/Banner/Banner.mdx +0 -86
  47. package/dist/module/lib/Components/BottomSheet/BottomSheet.figma.js +49 -0
  48. package/dist/module/lib/Components/BottomSheet/BottomSheet.figma.js.map +1 -0
  49. package/dist/module/lib/Components/BottomSheet/BottomSheet.mdx +0 -119
  50. package/dist/module/lib/Components/Button/Button.figma.js +45 -0
  51. package/dist/module/lib/Components/Button/Button.figma.js.map +1 -0
  52. package/dist/module/lib/Components/Button/Button.mdx +25 -224
  53. package/dist/module/lib/Components/Button/Button.stories.js +4 -36
  54. package/dist/module/lib/Components/Button/Button.stories.js.map +1 -1
  55. package/dist/module/lib/Components/Card/Card.figma.js +143 -0
  56. package/dist/module/lib/Components/Card/Card.figma.js.map +1 -0
  57. package/dist/module/lib/Components/Card/Card.mdx +0 -160
  58. package/dist/module/lib/Components/CardButton/CardButton.figma.js +38 -0
  59. package/dist/module/lib/Components/CardButton/CardButton.figma.js.map +1 -0
  60. package/dist/module/lib/Components/CardButton/CardButton.mdx +0 -48
  61. package/dist/module/lib/Components/Checkbox/Checkbox.figma.js +48 -0
  62. package/dist/module/lib/Components/Checkbox/Checkbox.figma.js.map +1 -0
  63. package/dist/module/lib/Components/Checkbox/Checkbox.mdx +0 -73
  64. package/dist/module/lib/Components/ContentBanner/ContentBanner.figma.js +91 -0
  65. package/dist/module/lib/Components/ContentBanner/ContentBanner.figma.js.map +1 -0
  66. package/dist/module/lib/Components/ContentBanner/ContentBanner.mdx +0 -2
  67. package/dist/module/lib/Components/CryptoIcon/CryptoIcon.figma.js +17 -0
  68. package/dist/module/lib/Components/CryptoIcon/CryptoIcon.figma.js.map +1 -0
  69. package/dist/module/lib/Components/DescriptionItem/DescriptionItem.figma.js +29 -0
  70. package/dist/module/lib/Components/DescriptionItem/DescriptionItem.figma.js.map +1 -0
  71. package/dist/module/lib/Components/Divider/Divider.figma.js +10 -0
  72. package/dist/module/lib/Components/Divider/Divider.figma.js.map +1 -0
  73. package/dist/module/lib/Components/Divider/Divider.mdx +0 -2
  74. package/dist/module/lib/Components/DotCount/DotCount.figma.js +29 -0
  75. package/dist/module/lib/Components/DotCount/DotCount.figma.js.map +1 -0
  76. package/dist/module/lib/Components/DotIndicator/DotIndicator.figma.js +29 -0
  77. package/dist/module/lib/Components/DotIndicator/DotIndicator.figma.js.map +1 -0
  78. package/dist/module/lib/Components/DotIndicator/DotIndicator.stories.js +6 -3
  79. package/dist/module/lib/Components/DotIndicator/DotIndicator.stories.js.map +1 -1
  80. package/dist/module/lib/Components/DotIndicator/getDotIndicatorProps.js +17 -0
  81. package/dist/module/lib/Components/DotIndicator/getDotIndicatorProps.js.map +1 -0
  82. package/dist/module/lib/Components/DotIndicator/getDotIndicatorProps.test.js +17 -0
  83. package/dist/module/lib/Components/DotIndicator/getDotIndicatorProps.test.js.map +1 -0
  84. package/dist/module/lib/Components/DotIndicator/index.js +1 -0
  85. package/dist/module/lib/Components/DotIndicator/index.js.map +1 -1
  86. package/dist/module/lib/Components/Icon/Icon.figma.js +1840 -0
  87. package/dist/module/lib/Components/Icon/Icon.figma.js.map +1 -0
  88. package/dist/module/lib/Components/Icon/Icon.mdx +0 -62
  89. package/dist/module/lib/Components/IconButton/IconButton.figma.js +42 -0
  90. package/dist/module/lib/Components/IconButton/IconButton.figma.js.map +1 -0
  91. package/dist/module/lib/Components/IconButton/IconButton.mdx +0 -68
  92. package/dist/module/lib/Components/InteractiveIcon/InteractiveIcon.figma.js +51 -0
  93. package/dist/module/lib/Components/InteractiveIcon/InteractiveIcon.figma.js.map +1 -0
  94. package/dist/module/lib/Components/InteractiveIcon/InteractiveIcon.mdx +0 -107
  95. package/dist/module/lib/Components/Link/Link.figma.js +41 -0
  96. package/dist/module/lib/Components/Link/Link.figma.js.map +1 -0
  97. package/dist/module/lib/Components/Link/Link.mdx +0 -102
  98. package/dist/module/lib/Components/ListItem/ListItem.figma.js +416 -0
  99. package/dist/module/lib/Components/ListItem/ListItem.figma.js.map +1 -0
  100. package/dist/module/lib/Components/ListItem/ListItem.mdx +0 -129
  101. package/dist/module/lib/Components/MediaBanner/MediaBanner.figma.js +25 -0
  102. package/dist/module/lib/Components/MediaBanner/MediaBanner.figma.js.map +1 -0
  103. package/dist/module/lib/Components/MediaBanner/MediaBanner.mdx +0 -3
  104. package/dist/module/lib/Components/MediaButton/MediaButton.figma.js +72 -0
  105. package/dist/module/lib/Components/MediaButton/MediaButton.figma.js.map +1 -0
  106. package/dist/module/lib/Components/MediaCard/MediaCard.figma.js +28 -0
  107. package/dist/module/lib/Components/MediaCard/MediaCard.figma.js.map +1 -0
  108. package/dist/module/lib/Components/MediaCard/MediaCard.mdx +0 -2
  109. package/dist/module/lib/Components/MediaImage/MediaImage.mdx +0 -1
  110. package/dist/module/lib/Components/MediaTag/MediaTag.figma.js +100 -0
  111. package/dist/module/lib/Components/MediaTag/MediaTag.figma.js.map +1 -0
  112. package/dist/module/lib/Components/MediaTag/MediaTag.mdx +0 -2
  113. package/dist/module/lib/Components/NavBar/NavBar.figma.js +79 -0
  114. package/dist/module/lib/Components/NavBar/NavBar.figma.js.map +1 -0
  115. package/dist/module/lib/Components/NavBar/NavBar.mdx +0 -2
  116. package/dist/module/lib/Components/OptionList/OptionList.js +16 -1
  117. package/dist/module/lib/Components/OptionList/OptionList.js.map +1 -1
  118. package/dist/module/lib/Components/OptionList/OptionList.mdx +45 -90
  119. package/dist/module/lib/Components/OptionList/OptionList.stories.js +61 -1
  120. package/dist/module/lib/Components/OptionList/OptionList.stories.js.map +1 -1
  121. package/dist/module/lib/Components/OptionList/OptionList.test.js +43 -1
  122. package/dist/module/lib/Components/OptionList/OptionList.test.js.map +1 -1
  123. package/dist/module/lib/Components/OptionList/useOptionList/useOptionListItems.js.map +1 -1
  124. package/dist/module/lib/Components/PageIndicator/PageIndicator.figma.js +13 -0
  125. package/dist/module/lib/Components/PageIndicator/PageIndicator.figma.js.map +1 -0
  126. package/dist/module/lib/Components/PageIndicator/PageIndicator.mdx +0 -2
  127. package/dist/module/lib/Components/SearchInput/SearchInput.figma.js +31 -0
  128. package/dist/module/lib/Components/SearchInput/SearchInput.figma.js.map +1 -0
  129. package/dist/module/lib/Components/SearchInput/SearchInput.mdx +0 -199
  130. package/dist/module/lib/Components/SegmentedControl/SegmentedControl.figma.js +35 -0
  131. package/dist/module/lib/Components/SegmentedControl/SegmentedControl.figma.js.map +1 -0
  132. package/dist/module/lib/Components/SegmentedControl/SegmentedControl.js +7 -1
  133. package/dist/module/lib/Components/SegmentedControl/SegmentedControl.js.map +1 -1
  134. package/dist/module/lib/Components/SegmentedControl/SegmentedControl.mdx +28 -1
  135. package/dist/module/lib/Components/SegmentedControl/SegmentedControl.stories.js +24 -1
  136. package/dist/module/lib/Components/SegmentedControl/SegmentedControl.stories.js.map +1 -1
  137. package/dist/module/lib/Components/SegmentedControl/SegmentedControl.test.js +28 -1
  138. package/dist/module/lib/Components/SegmentedControl/SegmentedControl.test.js.map +1 -1
  139. package/dist/module/lib/Components/Skeleton/Skeleton.figma.js +18 -0
  140. package/dist/module/lib/Components/Skeleton/Skeleton.figma.js.map +1 -0
  141. package/dist/module/lib/Components/Skeleton/Skeleton.mdx +0 -71
  142. package/dist/module/lib/Components/Spinner/Spinner.figma.js +13 -0
  143. package/dist/module/lib/Components/Spinner/Spinner.figma.js.map +1 -0
  144. package/dist/module/lib/Components/Spinner/Spinner.mdx +0 -100
  145. package/dist/module/lib/Components/Spot/Spot.figma.js +37 -0
  146. package/dist/module/lib/Components/Spot/Spot.figma.js.map +1 -0
  147. package/dist/module/lib/Components/Spot/Spot.mdx +0 -94
  148. package/dist/module/lib/Components/Stepper/Stepper.figma.js +13 -0
  149. package/dist/module/lib/Components/Stepper/Stepper.figma.js.map +1 -0
  150. package/dist/module/lib/Components/Stepper/Stepper.mdx +0 -67
  151. package/dist/module/lib/Components/Subheader/Subheader.figma.js +67 -0
  152. package/dist/module/lib/Components/Subheader/Subheader.figma.js.map +1 -0
  153. package/dist/module/lib/Components/Subheader/Subheader.mdx +0 -116
  154. package/dist/module/lib/Components/Switch/Switch.figma.js +58 -0
  155. package/dist/module/lib/Components/Switch/Switch.figma.js.map +1 -0
  156. package/dist/module/lib/Components/Switch/Switch.mdx +0 -39
  157. package/dist/module/lib/Components/TabBar/TabBar.figma.js +98 -0
  158. package/dist/module/lib/Components/TabBar/TabBar.figma.js.map +1 -0
  159. package/dist/module/lib/Components/TabBar/TabBar.js +7 -4
  160. package/dist/module/lib/Components/TabBar/TabBar.js.map +1 -1
  161. package/dist/module/lib/Components/TabBar/TabBar.mdx +29 -5
  162. package/dist/module/lib/Components/TabBar/TabBar.stories.js +35 -1
  163. package/dist/module/lib/Components/TabBar/TabBar.stories.js.map +1 -1
  164. package/dist/module/lib/Components/TabBar/TabBar.test.js +28 -1
  165. package/dist/module/lib/Components/TabBar/TabBar.test.js.map +1 -1
  166. package/dist/module/lib/Components/TabBar/index.js +2 -1
  167. package/dist/module/lib/Components/TabBar/index.js.map +1 -1
  168. package/dist/module/lib/Components/Tag/Tag.figma.js +41 -0
  169. package/dist/module/lib/Components/Tag/Tag.figma.js.map +1 -0
  170. package/dist/module/lib/Components/Tag/Tag.mdx +0 -2
  171. package/dist/module/lib/Components/TextInput/TextInput.figma.js +37 -0
  172. package/dist/module/lib/Components/TextInput/TextInput.figma.js.map +1 -0
  173. package/dist/module/lib/Components/TextInput/TextInput.mdx +0 -178
  174. package/dist/module/lib/Components/Tile/Tile.figma.js +111 -0
  175. package/dist/module/lib/Components/Tile/Tile.figma.js.map +1 -0
  176. package/dist/module/lib/Components/Tile/Tile.mdx +0 -53
  177. package/dist/module/lib/Components/TileButton/TileButton.figma.js +23 -0
  178. package/dist/module/lib/Components/TileButton/TileButton.figma.js.map +1 -0
  179. package/dist/module/lib/Components/TileButton/TileButton.mdx +0 -40
  180. package/dist/module/lib/Components/Tooltip/Tooltip.figma.js +26 -0
  181. package/dist/module/lib/Components/Tooltip/Tooltip.figma.js.map +1 -0
  182. package/dist/module/lib/Components/Tooltip/Tooltip.mdx +0 -183
  183. package/dist/module/lib/Components/Trend/Trend.figma.js +29 -0
  184. package/dist/module/lib/Components/Trend/Trend.figma.js.map +1 -0
  185. package/dist/module/lib/Components/Trend/Trend.mdx +0 -2
  186. package/dist/module/lib/Components/Utility/Text/Text.mdx +0 -1
  187. package/dist/module/lib/Symbols/Icons/ChevronAscending.js +1 -1
  188. package/dist/module/lib/Symbols/Icons/ChevronDescending.js +1 -1
  189. package/dist/module/lib/Symbols/Icons/Contact.js +50 -0
  190. package/dist/module/lib/Symbols/Icons/Contact.js.map +1 -0
  191. package/dist/module/lib/Symbols/index.js +1 -0
  192. package/dist/module/lib/Symbols/index.js.map +1 -1
  193. package/dist/typescript/src/lib/Animations/Pulse/Pulse.d.ts.map +1 -1
  194. package/dist/typescript/src/lib/Animations/Spin/Spin.d.ts.map +1 -1
  195. package/dist/typescript/src/lib/Components/AmountInput/AmountInput.d.ts +1 -1
  196. package/dist/typescript/src/lib/Components/AmountInput/AmountInput.d.ts.map +1 -1
  197. package/dist/typescript/src/lib/Components/AmountInput/types.d.ts +8 -0
  198. package/dist/typescript/src/lib/Components/AmountInput/types.d.ts.map +1 -1
  199. package/dist/typescript/src/lib/Components/AmountInput/useAmountInputFormatting/useAmountInputFormatting.d.ts +1 -0
  200. package/dist/typescript/src/lib/Components/AmountInput/useAmountInputFormatting/useAmountInputFormatting.d.ts.map +1 -1
  201. package/dist/typescript/src/lib/Components/Avatar/Avatar.d.ts +1 -4
  202. package/dist/typescript/src/lib/Components/Avatar/Avatar.d.ts.map +1 -1
  203. package/dist/typescript/src/lib/Components/Avatar/types.d.ts +0 -6
  204. package/dist/typescript/src/lib/Components/Avatar/types.d.ts.map +1 -1
  205. package/dist/typescript/src/lib/Components/DotIndicator/getDotIndicatorProps.d.ts +24 -0
  206. package/dist/typescript/src/lib/Components/DotIndicator/getDotIndicatorProps.d.ts.map +1 -0
  207. package/dist/typescript/src/lib/Components/DotIndicator/index.d.ts +1 -0
  208. package/dist/typescript/src/lib/Components/DotIndicator/index.d.ts.map +1 -1
  209. package/dist/typescript/src/lib/Components/OptionList/OptionList.d.ts +18 -4
  210. package/dist/typescript/src/lib/Components/OptionList/OptionList.d.ts.map +1 -1
  211. package/dist/typescript/src/lib/Components/OptionList/types.d.ts +16 -15
  212. package/dist/typescript/src/lib/Components/OptionList/types.d.ts.map +1 -1
  213. package/dist/typescript/src/lib/Components/OptionList/useOptionList/useOptionListItems.d.ts +9 -9
  214. package/dist/typescript/src/lib/Components/OptionList/useOptionList/useOptionListItems.d.ts.map +1 -1
  215. package/dist/typescript/src/lib/Components/SegmentedControl/SegmentedControl.d.ts +8 -3
  216. package/dist/typescript/src/lib/Components/SegmentedControl/SegmentedControl.d.ts.map +1 -1
  217. package/dist/typescript/src/lib/Components/SegmentedControl/types.d.ts +6 -5
  218. package/dist/typescript/src/lib/Components/SegmentedControl/types.d.ts.map +1 -1
  219. package/dist/typescript/src/lib/Components/TabBar/TabBar.d.ts +7 -2
  220. package/dist/typescript/src/lib/Components/TabBar/TabBar.d.ts.map +1 -1
  221. package/dist/typescript/src/lib/Components/TabBar/index.d.ts +2 -2
  222. package/dist/typescript/src/lib/Components/TabBar/index.d.ts.map +1 -1
  223. package/dist/typescript/src/lib/Components/TabBar/types.d.ts +17 -16
  224. package/dist/typescript/src/lib/Components/TabBar/types.d.ts.map +1 -1
  225. package/dist/typescript/src/lib/Symbols/Icons/Contact.d.ts +35 -0
  226. package/dist/typescript/src/lib/Symbols/Icons/Contact.d.ts.map +1 -0
  227. package/dist/typescript/src/lib/Symbols/index.d.ts +1 -0
  228. package/dist/typescript/src/lib/Symbols/index.d.ts.map +1 -1
  229. package/package.json +3 -3
  230. package/src/i18n/locales/de.json +1 -3
  231. package/src/i18n/locales/en.json +1 -3
  232. package/src/i18n/locales/es.json +1 -3
  233. package/src/i18n/locales/fr.json +1 -3
  234. package/src/i18n/locales/ja.json +1 -3
  235. package/src/i18n/locales/ko.json +1 -3
  236. package/src/i18n/locales/pt.json +1 -3
  237. package/src/i18n/locales/ru.json +1 -3
  238. package/src/i18n/locales/th.json +1 -3
  239. package/src/i18n/locales/tr.json +1 -3
  240. package/src/i18n/locales/zh.json +1 -3
  241. package/src/lib/Animations/Pulse/Pulse.mdx +0 -1
  242. package/src/lib/Animations/Pulse/Pulse.tsx +8 -1
  243. package/src/lib/Animations/Spin/Spin.mdx +0 -1
  244. package/src/lib/Animations/Spin/Spin.tsx +8 -1
  245. package/src/lib/Components/AddressInput/AddressInput.figma.tsx +39 -0
  246. package/src/lib/Components/AddressInput/AddressInput.mdx +0 -183
  247. package/src/lib/Components/AmountDisplay/AmountDisplay.figma.tsx +37 -0
  248. package/src/lib/Components/AmountDisplay/AmountDisplay.mdx +0 -90
  249. package/src/lib/Components/AmountInput/AmountInput.figma.tsx +78 -0
  250. package/src/lib/Components/AmountInput/AmountInput.mdx +0 -190
  251. package/src/lib/Components/AmountInput/AmountInput.stories.tsx +14 -0
  252. package/src/lib/Components/AmountInput/AmountInput.tsx +2 -0
  253. package/src/lib/Components/AmountInput/types.ts +8 -0
  254. package/src/lib/Components/AmountInput/useAmountInputFormatting/useAmountInputFormatting.test.ts +20 -0
  255. package/src/lib/Components/AmountInput/useAmountInputFormatting/useAmountInputFormatting.ts +2 -0
  256. package/src/lib/Components/Avatar/Avatar.figma.tsx +24 -14
  257. package/src/lib/Components/Avatar/Avatar.mdx +53 -69
  258. package/src/lib/Components/Avatar/Avatar.stories.tsx +16 -50
  259. package/src/lib/Components/Avatar/Avatar.test.tsx +12 -32
  260. package/src/lib/Components/Avatar/Avatar.tsx +4 -34
  261. package/src/lib/Components/Avatar/types.ts +0 -6
  262. package/src/lib/Components/Banner/Banner.figma.tsx +115 -0
  263. package/src/lib/Components/Banner/Banner.mdx +0 -86
  264. package/src/lib/Components/BottomSheet/BottomSheet.figma.tsx +52 -0
  265. package/src/lib/Components/BottomSheet/BottomSheet.mdx +0 -119
  266. package/src/lib/Components/Button/Button.figma.tsx +57 -0
  267. package/src/lib/Components/Button/Button.mdx +25 -224
  268. package/src/lib/Components/Button/Button.stories.tsx +3 -35
  269. package/src/lib/Components/Card/Card.figma.tsx +149 -0
  270. package/src/lib/Components/Card/Card.mdx +0 -160
  271. package/src/lib/Components/CardButton/CardButton.figma.tsx +49 -0
  272. package/src/lib/Components/CardButton/CardButton.mdx +0 -48
  273. package/src/lib/Components/Checkbox/Checkbox.figma.tsx +54 -0
  274. package/src/lib/Components/Checkbox/Checkbox.mdx +0 -73
  275. package/src/lib/Components/ContentBanner/ContentBanner.figma.tsx +108 -0
  276. package/src/lib/Components/ContentBanner/ContentBanner.mdx +0 -2
  277. package/src/lib/Components/CryptoIcon/CryptoIcon.figma.tsx +20 -0
  278. package/src/lib/Components/DescriptionItem/DescriptionItem.figma.tsx +36 -0
  279. package/src/lib/Components/Divider/Divider.figma.tsx +11 -0
  280. package/src/lib/Components/Divider/Divider.mdx +0 -2
  281. package/src/lib/Components/DotCount/DotCount.figma.tsx +32 -0
  282. package/src/lib/Components/DotIndicator/DotIndicator.figma.tsx +32 -0
  283. package/src/lib/Components/DotIndicator/DotIndicator.stories.tsx +4 -1
  284. package/src/lib/Components/DotIndicator/getDotIndicatorProps.test.ts +15 -0
  285. package/src/lib/Components/DotIndicator/getDotIndicatorProps.ts +10 -0
  286. package/src/lib/Components/DotIndicator/index.ts +1 -0
  287. package/src/lib/Components/Icon/Icon.figma.tsx +3085 -0
  288. package/src/lib/Components/Icon/Icon.mdx +0 -62
  289. package/src/lib/Components/IconButton/IconButton.figma.tsx +53 -0
  290. package/src/lib/Components/IconButton/IconButton.mdx +0 -68
  291. package/src/lib/Components/InteractiveIcon/InteractiveIcon.figma.tsx +52 -0
  292. package/src/lib/Components/InteractiveIcon/InteractiveIcon.mdx +0 -107
  293. package/src/lib/Components/Link/Link.figma.tsx +53 -0
  294. package/src/lib/Components/Link/Link.mdx +0 -102
  295. package/src/lib/Components/ListItem/ListItem.figma.tsx +431 -0
  296. package/src/lib/Components/ListItem/ListItem.mdx +0 -129
  297. package/src/lib/Components/MediaBanner/MediaBanner.figma.tsx +32 -0
  298. package/src/lib/Components/MediaBanner/MediaBanner.mdx +0 -3
  299. package/src/lib/Components/MediaButton/MediaButton.figma.tsx +60 -0
  300. package/src/lib/Components/MediaCard/MediaCard.figma.tsx +27 -0
  301. package/src/lib/Components/MediaCard/MediaCard.mdx +0 -2
  302. package/src/lib/Components/MediaImage/MediaImage.mdx +0 -1
  303. package/src/lib/Components/MediaTag/MediaTag.figma.tsx +116 -0
  304. package/src/lib/Components/MediaTag/MediaTag.mdx +0 -2
  305. package/src/lib/Components/NavBar/NavBar.figma.tsx +84 -0
  306. package/src/lib/Components/NavBar/NavBar.mdx +0 -2
  307. package/src/lib/Components/OptionList/OptionList.mdx +45 -90
  308. package/src/lib/Components/OptionList/OptionList.stories.tsx +63 -0
  309. package/src/lib/Components/OptionList/OptionList.test.tsx +40 -0
  310. package/src/lib/Components/OptionList/OptionList.tsx +57 -10
  311. package/src/lib/Components/OptionList/types.ts +34 -15
  312. package/src/lib/Components/OptionList/useOptionList/useOptionListItems.ts +28 -13
  313. package/src/lib/Components/PageIndicator/PageIndicator.figma.tsx +11 -0
  314. package/src/lib/Components/PageIndicator/PageIndicator.mdx +0 -2
  315. package/src/lib/Components/SearchInput/SearchInput.figma.tsx +34 -0
  316. package/src/lib/Components/SearchInput/SearchInput.mdx +0 -199
  317. package/src/lib/Components/SegmentedControl/SegmentedControl.figma.tsx +34 -0
  318. package/src/lib/Components/SegmentedControl/SegmentedControl.mdx +28 -1
  319. package/src/lib/Components/SegmentedControl/SegmentedControl.stories.tsx +34 -1
  320. package/src/lib/Components/SegmentedControl/SegmentedControl.test.tsx +32 -1
  321. package/src/lib/Components/SegmentedControl/SegmentedControl.tsx +22 -5
  322. package/src/lib/Components/SegmentedControl/types.ts +11 -5
  323. package/src/lib/Components/Skeleton/Skeleton.figma.tsx +17 -0
  324. package/src/lib/Components/Skeleton/Skeleton.mdx +0 -71
  325. package/src/lib/Components/Spinner/Spinner.figma.tsx +12 -0
  326. package/src/lib/Components/Spinner/Spinner.mdx +0 -100
  327. package/src/lib/Components/Spot/Spot.figma.tsx +50 -0
  328. package/src/lib/Components/Spot/Spot.mdx +0 -94
  329. package/src/lib/Components/Stepper/Stepper.figma.tsx +11 -0
  330. package/src/lib/Components/Stepper/Stepper.mdx +0 -67
  331. package/src/lib/Components/Subheader/Subheader.figma.tsx +72 -0
  332. package/src/lib/Components/Subheader/Subheader.mdx +0 -116
  333. package/src/lib/Components/Switch/Switch.figma.tsx +66 -0
  334. package/src/lib/Components/Switch/Switch.mdx +0 -39
  335. package/src/lib/Components/TabBar/TabBar.figma.tsx +70 -0
  336. package/src/lib/Components/TabBar/TabBar.mdx +29 -5
  337. package/src/lib/Components/TabBar/TabBar.stories.tsx +34 -1
  338. package/src/lib/Components/TabBar/TabBar.test.tsx +23 -1
  339. package/src/lib/Components/TabBar/TabBar.tsx +17 -9
  340. package/src/lib/Components/TabBar/index.ts +2 -2
  341. package/src/lib/Components/TabBar/types.ts +19 -17
  342. package/src/lib/Components/Tag/Tag.figma.tsx +52 -0
  343. package/src/lib/Components/Tag/Tag.mdx +0 -2
  344. package/src/lib/Components/TextInput/TextInput.figma.tsx +40 -0
  345. package/src/lib/Components/TextInput/TextInput.mdx +0 -178
  346. package/src/lib/Components/Tile/Tile.figma.tsx +113 -0
  347. package/src/lib/Components/Tile/Tile.mdx +0 -53
  348. package/src/lib/Components/TileButton/TileButton.figma.tsx +35 -0
  349. package/src/lib/Components/TileButton/TileButton.mdx +0 -40
  350. package/src/lib/Components/Tooltip/Tooltip.figma.tsx +30 -0
  351. package/src/lib/Components/Tooltip/Tooltip.mdx +0 -183
  352. package/src/lib/Components/Trend/Trend.figma.tsx +28 -0
  353. package/src/lib/Components/Trend/Trend.mdx +0 -2
  354. package/src/lib/Components/Utility/Text/Text.mdx +0 -1
  355. package/src/lib/Symbols/Icons/ChevronAscending.tsx +1 -1
  356. package/src/lib/Symbols/Icons/ChevronDescending.tsx +1 -1
  357. package/src/lib/Symbols/Icons/Contact.tsx +45 -0
  358. package/src/lib/Symbols/index.ts +1 -0
  359. package/dist/typescript/src/lib/Components/Avatar/Avatar.figma.d.ts +0 -2
  360. package/dist/typescript/src/lib/Components/Avatar/Avatar.figma.d.ts.map +0 -1
  361. package/dist/typescript/src/lib/Components/OptionList/OptionList.figma.d.ts +0 -2
  362. package/dist/typescript/src/lib/Components/OptionList/OptionList.figma.d.ts.map +0 -1
@@ -0,0 +1,72 @@
1
+ import figma from '@figma/code-connect';
2
+ import {
3
+ Subheader,
4
+ SubheaderDescription,
5
+ SubheaderRow,
6
+ SubheaderShowMore,
7
+ SubheaderTitle,
8
+ SubheaderCount,
9
+ } from './Subheader';
10
+
11
+ figma.connect(
12
+ Subheader,
13
+ 'https://www.figma.com/design/JxaLVMTWirCpU0rsbZ30k7?node-id=16477-1522',
14
+ {
15
+ imports: [
16
+ "import { Subheader, SubheaderRow, SubheaderTitle, SubheaderDescription, SubheaderCount } from '@ledgerhq/lumen-ui-rnative'",
17
+ ],
18
+ variant: { 'leading-action': 'none' },
19
+ props: {
20
+ title: figma.string('title'),
21
+ descriptionBlock: figma.boolean('show-description', {
22
+ true: <SubheaderDescription>Description</SubheaderDescription>,
23
+ false: undefined,
24
+ }),
25
+ count: figma.boolean('show-number', {
26
+ true: <SubheaderCount value={5} />,
27
+ false: undefined,
28
+ }),
29
+ },
30
+ example: (props) => (
31
+ <Subheader>
32
+ <SubheaderRow>
33
+ <SubheaderTitle>{props.title}</SubheaderTitle>
34
+ {props.count}
35
+ </SubheaderRow>
36
+ {props.descriptionBlock}
37
+ </Subheader>
38
+ ),
39
+ },
40
+ );
41
+
42
+ figma.connect(
43
+ Subheader,
44
+ 'https://www.figma.com/design/JxaLVMTWirCpU0rsbZ30k7?node-id=16477-1522',
45
+ {
46
+ imports: [
47
+ "import { Subheader, SubheaderRow, SubheaderTitle, SubheaderShowMore, SubheaderDescription } from '@ledgerhq/lumen-ui-rnative'",
48
+ ],
49
+ variant: { 'leading-action': 'show-more' },
50
+ props: {
51
+ title: figma.string('title'),
52
+ descriptionBlock: figma.boolean('show-description', {
53
+ true: <SubheaderDescription>Description</SubheaderDescription>,
54
+ false: undefined,
55
+ }),
56
+ count: figma.boolean('show-number', {
57
+ true: <SubheaderCount value={5} />,
58
+ false: undefined,
59
+ }),
60
+ },
61
+ example: ({ title, descriptionBlock, count }) => (
62
+ <Subheader>
63
+ <SubheaderRow onPress={() => {}}>
64
+ <SubheaderTitle>{title}</SubheaderTitle>
65
+ {count}
66
+ <SubheaderShowMore />
67
+ </SubheaderRow>
68
+ {descriptionBlock}
69
+ </Subheader>
70
+ ),
71
+ },
72
+ );
@@ -13,11 +13,7 @@ import {
13
13
  import {
14
14
  CustomTabs,
15
15
  Tab,
16
- DoVsDontRow,
17
- DoBlockItem,
18
- DontBlockItem,
19
16
  } from '../../../../.storybook/components';
20
- import CommonRulesDoAndDont from '../../../../.storybook/components/DoVsDont/CommonRulesDoAndDont.mdx';
21
17
 
22
18
  <Meta title='Core/Subheader' of={SubheaderStories} />
23
19
 
@@ -364,118 +360,6 @@ Use the `lx` prop for layout adjustments like margins or positioning:
364
360
  </Subheader>
365
361
  ```
366
362
 
367
- ## Do's and Don'ts
368
-
369
- The following guidelines ensure consistent usage of the Subheader component and maintain design system principles.
370
-
371
- <Box lx={{ flexDirection: 'column', gap: 's16' }}>
372
-
373
- <DoVsDontRow>
374
- <DoBlockItem
375
- title='Use Count for numeric values'
376
- description='Pass numbers using the value prop'
377
- >
378
-
379
- {/* prettier-ignore */}
380
- ```tsx
381
- <Subheader>
382
- <SubheaderRow>
383
- <SubheaderTitle>Accounts</SubheaderTitle>
384
- <SubheaderCount value={30} />
385
- </SubheaderRow>
386
- </Subheader>
387
- ```
388
-
389
- </DoBlockItem>
390
- <DontBlockItem
391
- title="Don't add parentheses manually"
392
- description='Count component automatically formats the value'
393
- >
394
-
395
- {/* prettier-ignore */}
396
- ```tsx
397
- <Subheader>
398
- <SubheaderRow>
399
- <SubheaderTitle>Accounts (30)</SubheaderTitle>
400
- </SubheaderRow>
401
- </Subheader>
402
- ```
403
-
404
- </DontBlockItem>
405
-
406
- </DoVsDontRow>
407
-
408
- <DoVsDontRow>
409
- <DoBlockItem
410
- title='Use the composite pattern'
411
- description='Compose sub-components for flexibility'
412
- >
413
-
414
- {/* prettier-ignore */}
415
- ```tsx
416
- <Subheader>
417
- <SubheaderRow>
418
- <SubheaderTitle>Title</SubheaderTitle>
419
- <SubheaderCount value={5} />
420
- </SubheaderRow>
421
- <SubheaderDescription>Description</SubheaderDescription>
422
- </Subheader>
423
- ```
424
-
425
- </DoBlockItem>
426
- <DontBlockItem
427
- title="Don't use non-composite children"
428
- description='Only use the provided sub-components'
429
- >
430
-
431
- {/* prettier-ignore */}
432
- ```tsx
433
- <Subheader>
434
- <Text>Title (5)</Text>
435
- <Text>Description</Text>
436
- </Subheader>
437
- ```
438
-
439
- </DontBlockItem>
440
-
441
- </DoVsDontRow>
442
-
443
- <DoVsDontRow>
444
- <DoBlockItem
445
- title='Use lx for layout adjustments only'
446
- description='Use the lx prop for margins, positioning, and other layout adjustments'
447
- >
448
-
449
- {/* prettier-ignore */}
450
- ```tsx
451
- <Subheader lx={{ marginTop: 's16' }}>
452
- <SubheaderRow>
453
- <SubheaderTitle>Title</SubheaderTitle>
454
- </SubheaderRow>
455
- </Subheader>
456
- ```
457
-
458
- </DoBlockItem>
459
- <DontBlockItem
460
- title="Don't use lx for appearance changes"
461
- description='Avoid using lx to modify colors, padding, or other core appearance styles'
462
- >
463
-
464
- {/* prettier-ignore */}
465
- ```tsx
466
- <Subheader lx={{ backgroundColor: 'accent', padding: 's24' }}>
467
- <SubheaderRow>
468
- <SubheaderTitle>Title</SubheaderTitle>
469
- </SubheaderRow>
470
- </Subheader>
471
- ```
472
-
473
- </DontBlockItem>
474
-
475
- </DoVsDontRow>
476
-
477
- <CommonRulesDoAndDont />
478
- </Box>
479
363
 
480
364
  </Tab>
481
365
  </CustomTabs>
@@ -0,0 +1,66 @@
1
+ import figma from '@figma/code-connect';
2
+ import { Switch } from './Switch';
3
+
4
+ // Standalone Switch component
5
+ figma.connect(
6
+ Switch,
7
+ 'https://www.figma.com/design/JxaLVMTWirCpU0rsbZ30k7?node-id=802-186',
8
+ {
9
+ imports: ["import { Switch } from '@ledgerhq/lumen-ui-rnative'"],
10
+ props: {
11
+ checked: figma.boolean('selected', {
12
+ true: true,
13
+ false: false,
14
+ }),
15
+ disabled: figma.enum('state', {
16
+ disabled: true,
17
+ }),
18
+ size: figma.enum('size', {
19
+ sm: 'sm',
20
+ md: 'md',
21
+ }),
22
+ },
23
+ example: (props) => (
24
+ <Switch
25
+ checked={props.checked}
26
+ defaultChecked={false}
27
+ onCheckedChange={(_checked: boolean) => {}}
28
+ size={props.size}
29
+ disabled={props.disabled}
30
+ />
31
+ ),
32
+ },
33
+ );
34
+
35
+ // Switch embedded inside a compound component (e.g. ListItem toggle)
36
+ figma.connect(
37
+ Switch,
38
+ 'https://www.figma.com/design/JxaLVMTWirCpU0rsbZ30k7?node-id=8739-1875',
39
+ {
40
+ imports: ["import { Switch } from '@ledgerhq/lumen-ui-rnative'"],
41
+ props: {
42
+ switchProps: figma.nestedProps('.switch', {
43
+ checked: figma.boolean('selected', {
44
+ true: true,
45
+ false: false,
46
+ }),
47
+ disabled: figma.enum('state', {
48
+ disabled: true,
49
+ }),
50
+ size: figma.enum('size', {
51
+ sm: 'sm',
52
+ md: 'md',
53
+ }),
54
+ }),
55
+ },
56
+ example: (props) => (
57
+ <Switch
58
+ checked={props.switchProps.checked}
59
+ defaultChecked={false}
60
+ onCheckedChange={(_checked: boolean) => {}}
61
+ size={props.switchProps.size}
62
+ disabled={props.switchProps.disabled}
63
+ />
64
+ ),
65
+ },
66
+ );
@@ -3,8 +3,6 @@ import * as SwitchStories from './Switch.stories';
3
3
  import { Switch } from './Switch';
4
4
  import { Box } from '../Utility';
5
5
  import { CustomTabs, Tab } from '../../../../.storybook/components';
6
- import { DoVsDontRow, DoBlockItem, DontBlockItem } from '../../../../.storybook/components/DoVsDont';
7
- import CommonRulesDoAndDont from '../../../../.storybook/components/DoVsDont/CommonRulesDoAndDont.mdx';
8
6
 
9
7
  <Meta title='Core/Switch' of={SwitchStories} />
10
8
 
@@ -146,43 +144,6 @@ The Switch component automatically supports:
146
144
  - **Space**: Toggle checked/unchecked state
147
145
  - **Enter**: Submit form (when inside a form)
148
146
 
149
- ## Do's and Don'ts
150
-
151
- The following guidelines ensure consistent usage of the Switch component and maintain design system principles.
152
-
153
- <Box lx={{ flexDirection: 'column', gap: 's24' }}>
154
- <DoVsDontRow>
155
- <DoBlockItem
156
- title='Use controlled components for form state'
157
- description='Use checked and onCheckedChange props for controlled switches'
158
- >
159
-
160
- {/* prettier-ignore */}
161
- ```tsx
162
- const [isChecked, setIsChecked] = useState(false);
163
-
164
- <Switch checked={isChecked} onCheckedChange={setIsChecked} />
165
- ```
166
-
167
- </DoBlockItem>
168
- <DontBlockItem
169
- title="Don't mix controlled and uncontrolled patterns"
170
- description='Avoid using both checked and defaultChecked props together'
171
- >
172
-
173
- {/* prettier-ignore */}
174
- ```tsx
175
- const [isChecked, setIsChecked] = useState(false);
176
-
177
- <Switch checked={isChecked} defaultChecked={true} />
178
- ```
179
-
180
- </DontBlockItem>
181
-
182
- </DoVsDontRow>
183
-
184
- <CommonRulesDoAndDont />
185
- </Box>
186
147
 
187
148
  </Tab>
188
149
  </CustomTabs>
@@ -0,0 +1,70 @@
1
+ import figma from '@figma/code-connect';
2
+ import { Placeholder } from '../../Symbols';
3
+ import { TabBar, TabBarItem } from './TabBar';
4
+
5
+ figma.connect(
6
+ TabBar,
7
+ 'https://www.figma.com/design/JxaLVMTWirCpU0rsbZ30k7?node-id=10804-1045',
8
+ {
9
+ imports: [
10
+ "import { TabBar, TabBarItem } from '@ledgerhq/lumen-ui-rnative'",
11
+ "import { Placeholder } from '@ledgerhq/lumen-ui-rnative/symbols'",
12
+ ],
13
+ props: {
14
+ items: figma.enum('nb-tabs', {
15
+ '2': (
16
+ <>
17
+ <TabBarItem value='tab1' label='Label1' icon={Placeholder} />
18
+ <TabBarItem value='tab2' label='Label2' icon={Placeholder} />
19
+ </>
20
+ ),
21
+ '3': (
22
+ <>
23
+ <TabBarItem value='tab1' label='Label1' icon={Placeholder} />
24
+ <TabBarItem value='tab2' label='Label2' icon={Placeholder} />
25
+ <TabBarItem value='tab3' label='Label3' icon={Placeholder} />
26
+ </>
27
+ ),
28
+ '4': (
29
+ <>
30
+ <TabBarItem value='tab1' label='Label1' icon={Placeholder} />
31
+ <TabBarItem value='tab2' label='Label2' icon={Placeholder} />
32
+ <TabBarItem value='tab3' label='Label3' icon={Placeholder} />
33
+ <TabBarItem value='tab4' label='Label4' icon={Placeholder} />
34
+ </>
35
+ ),
36
+ '5': (
37
+ <>
38
+ <TabBarItem value='tab1' label='Label1' icon={Placeholder} />
39
+ <TabBarItem value='tab2' label='Label2' icon={Placeholder} />
40
+ <TabBarItem value='tab3' label='Label3' icon={Placeholder} />
41
+ <TabBarItem value='tab4' label='Label4' icon={Placeholder} />
42
+ <TabBarItem value='tab5' label='Label5' icon={Placeholder} />
43
+ </>
44
+ ),
45
+ }),
46
+ },
47
+ example: (props) => (
48
+ <TabBar active='tab1' onTabPress={() => {}}>
49
+ {props.items}
50
+ </TabBar>
51
+ ),
52
+ },
53
+ );
54
+
55
+ figma.connect(
56
+ TabBarItem,
57
+ 'https://www.figma.com/design/JxaLVMTWirCpU0rsbZ30k7?node-id=10804-913',
58
+ {
59
+ imports: [
60
+ "import { TabBarItem } from '@ledgerhq/lumen-ui-rnative'",
61
+ "import { Placeholder } from '@ledgerhq/lumen-ui-rnative/symbols'",
62
+ ],
63
+ props: {
64
+ label: figma.textContent('Label'),
65
+ },
66
+ example: (props) => (
67
+ <TabBarItem value='tab1' label={props.label} icon={Placeholder} />
68
+ ),
69
+ },
70
+ );
@@ -2,8 +2,6 @@ import { Meta, Canvas, Controls } from '@storybook/addon-docs/blocks';
2
2
  import * as TabBarStories from './TabBar.stories';
3
3
  import { TabBar } from './TabBar';
4
4
  import { CustomTabs, Tab } from '../../../../.storybook/components';
5
- import { DoVsDontRow, DoBlockItem, DontBlockItem } from '../../../../.storybook/components/DoVsDont';
6
- import CommonRulesDoAndDont from '../../../../.storybook/components/DoVsDont/CommonRulesDoAndDont.mdx';
7
5
  import { Box } from '../Utility';
8
6
 
9
7
  <Meta title='Core/TabBar' of={TabBarStories} />
@@ -69,6 +67,8 @@ Install and set up the library with our [Setup Guide →](?path=/docs/getting-st
69
67
 
70
68
  ### Basic Usage
71
69
 
70
+ > **Recommended:** prefer the [type-safe variant](#type-safe-variant) below. It shares one literal union across `active` and every `TabBarItem.value`.
71
+
72
72
  ```tsx
73
73
  import { useState } from 'react';
74
74
  import { TabBar, TabBarItem } from '@ledgerhq/lumen-ui-rnative';
@@ -86,6 +86,33 @@ function MyComponent() {
86
86
  }
87
87
  ```
88
88
 
89
+ ### Type-safe variant
90
+
91
+ `TabBar` and `TabBarItem` communicate via context, so TypeScript cannot connect the root's `active` to each item's `value` on its own. A typo compiles, and the wrong tab (or none) is highlighted.
92
+
93
+ `createTabBar<T>()` ties both components to one literal union. Call it once at module scope; the returned pair are typed against your `T`.
94
+
95
+ ```tsx
96
+ import { createTabBar } from '@ledgerhq/lumen-ui-rnative';
97
+ import { Home, HomeFill, Settings } from '@ledgerhq/lumen-ui-rnative/symbols';
98
+
99
+ type Route = 'home' | 'swap' | 'settings';
100
+
101
+ const { TabBar, TabBarItem } = createTabBar<Route>();
102
+
103
+ function Example() {
104
+ const [active, setActive] = React.useState<Route>('home');
105
+
106
+ return (
107
+ <TabBar active={active} onTabPress={setActive}>
108
+ <TabBarItem value='home' label='Home' icon={Home} activeIcon={HomeFill} />
109
+ <TabBarItem value='swap' label='Swap' icon={Settings} />
110
+ <TabBarItem value='settings' label='Settings' icon={Settings} />
111
+ </TabBar>
112
+ );
113
+ }
114
+ ```
115
+
89
116
  ### With Active Icons
90
117
 
91
118
  Provide different icons for active and inactive states:
@@ -177,9 +204,6 @@ export default function TabLayout() {
177
204
  }
178
205
  ```
179
206
 
180
- <Box lx={{ flexDirection: 'column', gap: 's24' }}>
181
- <CommonRulesDoAndDont />
182
- </Box>
183
207
 
184
208
  </Tab>
185
209
  </CustomTabs>
@@ -15,7 +15,7 @@ import {
15
15
  CreditCard,
16
16
  CreditCardFill,
17
17
  } from '../../Symbols';
18
- import { TabBar, TabBarItem } from './TabBar';
18
+ import { createTabBar, TabBar, TabBarItem } from './TabBar';
19
19
 
20
20
  const meta = {
21
21
  id: 'rnative-tabbar',
@@ -119,3 +119,36 @@ export const MissingLabel: Story = {
119
119
  );
120
120
  },
121
121
  };
122
+
123
+ type Route = 'home' | 'swap' | 'card' | 'help';
124
+ const Nav = createTabBar<Route>();
125
+
126
+ export const TypesafeFactory: Story = {
127
+ args: {} as React.ComponentProps<typeof TabBar>,
128
+ render: () => {
129
+ const [active, setActive] = useState<Route>('home');
130
+ return (
131
+ <Nav.TabBar active={active} onTabPress={setActive} lx={{ width: 's320' }}>
132
+ <Nav.TabBarItem
133
+ value='home'
134
+ label='Home'
135
+ icon={Home}
136
+ activeIcon={HomeFill}
137
+ />
138
+ <Nav.TabBarItem value='swap' label='Swap' icon={CoinPercent} />
139
+ <Nav.TabBarItem
140
+ value='card'
141
+ label='Card'
142
+ icon={CreditCard}
143
+ activeIcon={CreditCardFill}
144
+ />
145
+ <Nav.TabBarItem
146
+ value='help'
147
+ label='Help'
148
+ icon={LifeRing}
149
+ activeIcon={LifeRingFill}
150
+ />
151
+ </Nav.TabBar>
152
+ );
153
+ },
154
+ };
@@ -3,7 +3,7 @@ import { ledgerLiveThemes } from '@ledgerhq/lumen-design-core';
3
3
  import { render, fireEvent } from '@testing-library/react-native';
4
4
  import { HomeFill, Settings, BasketPutIn } from '../../Symbols';
5
5
  import { ThemeProvider } from '../ThemeProvider/ThemeProvider';
6
- import { TabBar, TabBarItem } from './TabBar';
6
+ import { TabBar, TabBarItem, createTabBar } from './TabBar';
7
7
 
8
8
  const renderWithProvider = (component: React.ReactElement) => {
9
9
  return render(
@@ -54,4 +54,26 @@ describe('TabBar', () => {
54
54
  expect(getByText('Shop')).toBeTruthy();
55
55
  expect(getByText('Settings')).toBeTruthy();
56
56
  });
57
+
58
+ describe('createTabBar', () => {
59
+ it('returns typed components that render and respond to presses', () => {
60
+ const { TabBar: TypedTabBar, TabBarItem: TypedItem } = createTabBar<
61
+ 'home' | 'settings'
62
+ >();
63
+ const onTabPress = jest.fn();
64
+
65
+ const { getByText } = renderWithProvider(
66
+ <TypedTabBar active='home' onTabPress={onTabPress}>
67
+ <TypedItem value='home' label='Home' icon={HomeFill} />
68
+ <TypedItem value='settings' label='Settings' icon={Settings} />
69
+ </TypedTabBar>,
70
+ );
71
+
72
+ expect(getByText('Home')).toBeTruthy();
73
+
74
+ fireEvent.press(getByText('Settings'));
75
+
76
+ expect(onTabPress).toHaveBeenCalledWith('settings');
77
+ });
78
+ });
57
79
  });
@@ -1,5 +1,5 @@
1
1
  import { BlurView } from '@sbaiahmed1/react-native-blur';
2
- import type { ReactNode } from 'react';
2
+ import type { ReactElement, ReactNode } from 'react';
3
3
  import { Children, isValidElement, useEffect, useMemo, useRef } from 'react';
4
4
  import type { LayoutChangeEvent } from 'react-native';
5
5
  import { StyleSheet, Text, View } from 'react-native';
@@ -18,7 +18,7 @@ import { Placeholder } from '../../Symbols';
18
18
  import { RuntimeConstants } from '../../utils';
19
19
  import { Box, Pressable } from '../Utility';
20
20
  import { TabBarContextProvider, useTabBarContext } from './TabBarContext';
21
- import type { TabBarItemProps, TabBarProps } from './types';
21
+ import type { TabBarItemProps, TabBarProps, TabBarValue } from './types';
22
22
 
23
23
  export const TAB_BAR_HEIGHT = 60;
24
24
  const PILL_INSET = 4;
@@ -241,12 +241,12 @@ export function TabBarItem({
241
241
  * <TabBarItem value="settings" label="Settings" icon={Settings} />
242
242
  * </TabBar>
243
243
  */
244
- export function TabBar({
244
+ export function TabBar<T extends TabBarValue = TabBarValue>({
245
245
  active,
246
246
  onTabPress,
247
247
  children,
248
248
  ...props
249
- }: TabBarProps) {
249
+ }: TabBarProps<T>) {
250
250
  const styles = useStyles();
251
251
  const { theme, colorScheme } = useTheme();
252
252
 
@@ -255,12 +255,13 @@ export function TabBar({
255
255
  children,
256
256
  });
257
257
 
258
- function handleTabPress(value: string) {
259
- onTabPress?.(value);
260
- }
261
-
262
258
  return (
263
- <TabBarContextProvider value={{ active, onTabPress: handleTabPress }}>
259
+ <TabBarContextProvider
260
+ value={{
261
+ active,
262
+ onTabPress: (value) => onTabPress(value as T),
263
+ }}
264
+ >
264
265
  <Box
265
266
  style={styles.container}
266
267
  onLayout={onLayout}
@@ -348,3 +349,10 @@ const useStyles = () =>
348
349
  }),
349
350
  [],
350
351
  );
352
+
353
+ export function createTabBar<T extends TabBarValue = never>(): {
354
+ TabBar: (props: TabBarProps<T>) => ReactElement;
355
+ TabBarItem: (props: TabBarItemProps<T>) => ReactElement;
356
+ } {
357
+ return { TabBar, TabBarItem };
358
+ }
@@ -1,2 +1,2 @@
1
- export { TabBar, TabBarItem, TAB_BAR_HEIGHT } from './TabBar';
2
- export type { TabBarProps, TabBarItemProps } from './types';
1
+ export * from './TabBar';
2
+ export * from './types';
@@ -7,11 +7,28 @@ type IconComponent = ComponentType<{
7
7
  size?: IconSize;
8
8
  }>;
9
9
 
10
- export type TabBarItemProps = {
10
+ export type TabBarValue = string;
11
+
12
+ export type TabBarProps<T extends TabBarValue = TabBarValue> = {
13
+ /**
14
+ * The value of the currently active tab.
15
+ */
16
+ active: T;
17
+ /**
18
+ * The callback function called when a tab is pressed.
19
+ */
20
+ onTabPress: (active: T) => void;
21
+ /**
22
+ * The tab items to display.
23
+ */
24
+ children: ReactNode;
25
+ } & Omit<BoxProps, 'children'>;
26
+
27
+ export type TabBarItemProps<T extends TabBarValue = TabBarValue> = {
11
28
  /**
12
29
  * The unique identifier for the tab item.
13
30
  */
14
- value: string;
31
+ value: T;
15
32
  /**
16
33
  * The display label for the tab item.
17
34
  * If not provided, the icon will be centered.
@@ -27,18 +44,3 @@ export type TabBarItemProps = {
27
44
  */
28
45
  activeIcon?: IconComponent;
29
46
  } & Omit<StyledViewProps, 'children'>;
30
-
31
- export type TabBarProps = {
32
- /**
33
- * The value of the currently active tab.
34
- */
35
- active: string;
36
- /**
37
- * The callback function called when a tab is pressed.
38
- */
39
- onTabPress: (active: string) => void;
40
- /**
41
- * The tab items to display.
42
- */
43
- children: ReactNode;
44
- } & Omit<BoxProps, 'children'>;