@ledgerhq/lumen-ui-rnative 0.0.44 → 0.0.45

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 (333) hide show
  1. package/.storybook/Decorator.tsx +78 -13
  2. package/.storybook/docs/getting-started/ThemeProvider.mdx +1 -1
  3. package/.storybook/docs/style-system/lx.mdx +144 -0
  4. package/.storybook/docs/style-system/useCreate.mdx +95 -0
  5. package/.storybook/docs/style-system/useTheme.mdx +52 -0
  6. package/.storybook/preview-head.html +2 -2
  7. package/.storybook/{preview.ts → preview.tsx} +6 -1
  8. package/dist/package.json +2 -3
  9. package/dist/src/lib/Components/AddressInput/AddressInput.js +1 -1
  10. package/dist/src/lib/Components/AddressInput/AddressInput.stories.d.ts +7 -1
  11. package/dist/src/lib/Components/AddressInput/AddressInput.stories.d.ts.map +1 -1
  12. package/dist/src/lib/Components/AddressInput/AddressInput.stories.js +98 -9
  13. package/dist/src/lib/Components/AmountInput/AmountInput.d.ts.map +1 -1
  14. package/dist/src/lib/Components/AmountInput/AmountInput.js +3 -3
  15. package/dist/src/lib/Components/AmountInput/AmountInput.stories.d.ts +10 -1
  16. package/dist/src/lib/Components/AmountInput/AmountInput.stories.d.ts.map +1 -1
  17. package/dist/src/lib/Components/AmountInput/AmountInput.stories.js +162 -9
  18. package/dist/src/lib/Components/BaseInput/BaseInput.d.ts.map +1 -1
  19. package/dist/src/lib/Components/BaseInput/BaseInput.js +2 -19
  20. package/dist/src/lib/Components/BottomSheet/BottomSheet.js +1 -1
  21. package/dist/src/lib/Components/BottomSheet/BottomSheet.stories.js +8 -8
  22. package/dist/src/lib/Components/Button/BaseButton.d.ts +3 -3
  23. package/dist/src/lib/Components/Button/BaseButton.d.ts.map +1 -1
  24. package/dist/src/lib/Components/Button/BaseButton.js +99 -119
  25. package/dist/src/lib/Components/Button/Button.d.ts +4 -26
  26. package/dist/src/lib/Components/Button/Button.d.ts.map +1 -1
  27. package/dist/src/lib/Components/Button/Button.js +2 -2
  28. package/dist/src/lib/Components/Button/Button.stories.d.ts +1 -1
  29. package/dist/src/lib/Components/Button/Button.stories.d.ts.map +1 -1
  30. package/dist/src/lib/Components/Button/Button.stories.js +25 -48
  31. package/dist/src/lib/Components/Button/index.d.ts +1 -1
  32. package/dist/src/lib/Components/Button/index.d.ts.map +1 -1
  33. package/dist/src/lib/Components/Button/index.js +1 -1
  34. package/dist/src/lib/Components/Button/{BaseButton.types.d.ts → types.d.ts} +15 -10
  35. package/dist/src/lib/Components/Button/types.d.ts.map +1 -0
  36. package/dist/src/lib/Components/CardButton/CardButton.d.ts +4 -3
  37. package/dist/src/lib/Components/CardButton/CardButton.d.ts.map +1 -1
  38. package/dist/src/lib/Components/CardButton/CardButton.js +65 -71
  39. package/dist/src/lib/Components/CardButton/CardButton.stories.d.ts.map +1 -1
  40. package/dist/src/lib/Components/CardButton/CardButton.stories.js +28 -15
  41. package/dist/src/lib/Components/CardButton/index.d.ts +1 -1
  42. package/dist/src/lib/Components/CardButton/index.d.ts.map +1 -1
  43. package/dist/src/lib/Components/CardButton/index.js +1 -1
  44. package/dist/src/lib/Components/CardButton/{CardButton.types.d.ts → types.d.ts} +5 -4
  45. package/dist/src/lib/Components/CardButton/types.d.ts.map +1 -0
  46. package/dist/src/lib/Components/Icon/Icon.d.ts +6 -3
  47. package/dist/src/lib/Components/Icon/Icon.d.ts.map +1 -1
  48. package/dist/src/lib/Components/Icon/Icon.js +24 -25
  49. package/dist/src/lib/Components/Icon/Icon.stories.d.ts +2 -2
  50. package/dist/src/lib/Components/Icon/Icon.stories.d.ts.map +1 -1
  51. package/dist/src/lib/Components/Icon/Icon.stories.js +73 -19
  52. package/dist/src/lib/Components/Icon/createIcon.d.ts +1 -1
  53. package/dist/src/lib/Components/Icon/createIcon.d.ts.map +1 -1
  54. package/dist/src/lib/Components/Icon/createIcon.js +1 -2
  55. package/dist/src/lib/Components/Icon/index.d.ts +1 -1
  56. package/dist/src/lib/Components/Icon/index.d.ts.map +1 -1
  57. package/dist/src/lib/Components/Icon/index.js +1 -1
  58. package/dist/src/lib/Components/Icon/{Icon.types.d.ts → types.d.ts} +7 -4
  59. package/dist/src/lib/Components/Icon/types.d.ts.map +1 -0
  60. package/dist/src/lib/Components/IconButton/IconButton.d.ts +2 -19
  61. package/dist/src/lib/Components/IconButton/IconButton.d.ts.map +1 -1
  62. package/dist/src/lib/Components/IconButton/IconButton.stories.d.ts.map +1 -1
  63. package/dist/src/lib/Components/IconButton/IconButton.stories.js +9 -11
  64. package/dist/src/lib/Components/IconButton/index.d.ts +1 -0
  65. package/dist/src/lib/Components/IconButton/index.d.ts.map +1 -1
  66. package/dist/src/lib/Components/IconButton/index.js +1 -0
  67. package/dist/src/lib/Components/IconButton/types.d.ts +12 -0
  68. package/dist/src/lib/Components/IconButton/types.d.ts.map +1 -0
  69. package/dist/src/lib/Components/InteractiveIcon/InteractiveIcon.d.ts +2 -2
  70. package/dist/src/lib/Components/InteractiveIcon/InteractiveIcon.d.ts.map +1 -1
  71. package/dist/src/lib/Components/InteractiveIcon/InteractiveIcon.figma.js +1 -1
  72. package/dist/src/lib/Components/InteractiveIcon/InteractiveIcon.js +34 -34
  73. package/dist/src/lib/Components/InteractiveIcon/InteractiveIcon.stories.d.ts +1 -1
  74. package/dist/src/lib/Components/InteractiveIcon/InteractiveIcon.stories.d.ts.map +1 -1
  75. package/dist/src/lib/Components/InteractiveIcon/InteractiveIcon.stories.js +22 -9
  76. package/dist/src/lib/Components/InteractiveIcon/types.d.ts +3 -7
  77. package/dist/src/lib/Components/InteractiveIcon/types.d.ts.map +1 -1
  78. package/dist/src/lib/Components/Link/Link.d.ts +7 -77
  79. package/dist/src/lib/Components/Link/Link.d.ts.map +1 -1
  80. package/dist/src/lib/Components/Link/Link.js +59 -75
  81. package/dist/src/lib/Components/Link/Link.stories.d.ts.map +1 -1
  82. package/dist/src/lib/Components/Link/Link.stories.js +34 -11
  83. package/dist/src/lib/Components/Link/index.d.ts +1 -0
  84. package/dist/src/lib/Components/Link/index.d.ts.map +1 -1
  85. package/dist/src/lib/Components/Link/index.js +1 -0
  86. package/dist/src/lib/Components/Link/types.d.ts +43 -0
  87. package/dist/src/lib/Components/Link/types.d.ts.map +1 -0
  88. package/dist/src/lib/Components/Link/types.js +1 -0
  89. package/dist/src/lib/Components/Search/Search.stories.d.ts +6 -1
  90. package/dist/src/lib/Components/Search/Search.stories.d.ts.map +1 -1
  91. package/dist/src/lib/Components/Search/Search.stories.js +71 -9
  92. package/dist/src/lib/Components/Select/Select.d.ts.map +1 -1
  93. package/dist/src/lib/Components/Select/Select.js +1 -17
  94. package/dist/src/lib/Components/Spinner/Spinner.d.ts +13 -16
  95. package/dist/src/lib/Components/Spinner/Spinner.d.ts.map +1 -1
  96. package/dist/src/lib/Components/Spinner/Spinner.js +33 -5
  97. package/dist/src/lib/Components/Spinner/Spinner.stories.d.ts.map +1 -1
  98. package/dist/src/lib/Components/Spinner/Spinner.stories.js +1 -1
  99. package/dist/src/lib/Components/Spinner/index.d.ts +1 -0
  100. package/dist/src/lib/Components/Spinner/index.d.ts.map +1 -1
  101. package/dist/src/lib/Components/Spinner/index.js +1 -0
  102. package/dist/src/lib/Components/Spinner/types.d.ts +15 -0
  103. package/dist/src/lib/Components/Spinner/types.d.ts.map +1 -0
  104. package/dist/src/lib/Components/Spinner/types.js +1 -0
  105. package/dist/src/lib/Components/Tag/Tag.d.ts +2 -1
  106. package/dist/src/lib/Components/Tag/Tag.d.ts.map +1 -1
  107. package/dist/src/lib/Components/Tag/Tag.js +15 -4
  108. package/dist/src/lib/Components/Tag/Tag.stories.js +1 -1
  109. package/dist/src/lib/Components/Tag/Tag.types.d.ts +7 -1
  110. package/dist/src/lib/Components/Tag/Tag.types.d.ts.map +1 -1
  111. package/dist/src/lib/Components/TextInput/TextInput.stories.d.ts +8 -1
  112. package/dist/src/lib/Components/TextInput/TextInput.stories.d.ts.map +1 -1
  113. package/dist/src/lib/Components/TextInput/TextInput.stories.js +104 -9
  114. package/dist/src/lib/Components/Tile/Tile.js +2 -2
  115. package/dist/src/lib/Components/Tooltip/Tooltip.stories.js +2 -2
  116. package/dist/src/lib/Components/Utility/Box/Box.d.ts +39 -0
  117. package/dist/src/lib/Components/Utility/Box/Box.d.ts.map +1 -0
  118. package/dist/src/lib/Components/{Box → Utility/Box}/Box.js +10 -11
  119. package/dist/src/lib/Components/Utility/Box/Box.stories.d.ts.map +1 -0
  120. package/dist/src/lib/Components/{Box → Utility/Box}/Box.stories.js +13 -12
  121. package/dist/src/lib/Components/Utility/Box/index.d.ts +2 -0
  122. package/dist/src/lib/Components/Utility/Box/index.d.ts.map +1 -0
  123. package/dist/src/lib/Components/Utility/Pressable/Pressable.d.ts +34 -0
  124. package/dist/src/lib/Components/Utility/Pressable/Pressable.d.ts.map +1 -0
  125. package/dist/src/lib/Components/Utility/Pressable/Pressable.js +33 -0
  126. package/dist/src/lib/Components/Utility/Pressable/Pressable.stories.d.ts +7 -0
  127. package/dist/src/lib/Components/Utility/Pressable/Pressable.stories.d.ts.map +1 -0
  128. package/dist/src/lib/Components/Utility/Pressable/Pressable.stories.js +47 -0
  129. package/dist/src/lib/Components/Utility/Pressable/index.d.ts +3 -0
  130. package/dist/src/lib/Components/Utility/Pressable/index.d.ts.map +1 -0
  131. package/dist/src/lib/Components/Utility/Pressable/index.js +1 -0
  132. package/dist/src/lib/Components/Utility/Pressable/types.d.ts +3 -0
  133. package/dist/src/lib/Components/Utility/Pressable/types.d.ts.map +1 -0
  134. package/dist/src/lib/Components/Utility/Pressable/types.js +1 -0
  135. package/dist/src/lib/Components/Utility/Text/Text.d.ts +40 -0
  136. package/dist/src/lib/Components/Utility/Text/Text.d.ts.map +1 -0
  137. package/dist/src/lib/Components/{Text → Utility/Text}/Text.js +13 -9
  138. package/dist/src/lib/Components/Utility/Text/Text.stories.d.ts.map +1 -0
  139. package/dist/src/lib/Components/{Text → Utility/Text}/Text.stories.js +3 -3
  140. package/dist/src/lib/Components/Utility/Text/index.d.ts.map +1 -0
  141. package/dist/src/lib/Components/Utility/index.d.ts +4 -0
  142. package/dist/src/lib/Components/Utility/index.d.ts.map +1 -0
  143. package/dist/src/lib/Components/Utility/index.js +3 -0
  144. package/dist/src/lib/Components/index.d.ts +1 -3
  145. package/dist/src/lib/Components/index.d.ts.map +1 -1
  146. package/dist/src/lib/Components/index.js +1 -3
  147. package/dist/src/lib/utils/components/InjectStylesIntoChildren.d.ts +6 -5
  148. package/dist/src/lib/utils/components/InjectStylesIntoChildren.d.ts.map +1 -1
  149. package/dist/src/lib/utils/components/InjectStylesIntoChildren.js +6 -6
  150. package/dist/src/styles/LumenStyleSheet.d.ts +1 -1
  151. package/dist/src/styles/LumenStyleSheet.d.ts.map +1 -1
  152. package/dist/src/styles/Provider/createStylesheetTheme.d.ts +0 -1
  153. package/dist/src/styles/Provider/createStylesheetTheme.d.ts.map +1 -1
  154. package/dist/src/styles/Provider/createStylesheetTheme.js +0 -1
  155. package/dist/src/styles/create/useCreate.d.ts +2 -1
  156. package/dist/src/styles/create/useCreate.d.ts.map +1 -1
  157. package/dist/src/styles/create/useCreate.js +5 -5
  158. package/dist/src/styles/factories/areLxPropsEqual.d.ts +3 -0
  159. package/dist/src/styles/factories/areLxPropsEqual.d.ts.map +1 -0
  160. package/dist/src/styles/factories/areLxPropsEqual.js +15 -0
  161. package/dist/src/styles/factories/createStyledPressable.d.ts +26 -0
  162. package/dist/src/styles/factories/createStyledPressable.d.ts.map +1 -0
  163. package/dist/src/styles/factories/createStyledPressable.js +61 -0
  164. package/dist/src/styles/factories/createStyledText.d.ts +15 -26
  165. package/dist/src/styles/factories/createStyledText.d.ts.map +1 -1
  166. package/dist/src/styles/factories/createStyledText.js +13 -29
  167. package/dist/src/styles/factories/createStyledView.d.ts +7 -27
  168. package/dist/src/styles/factories/createStyledView.d.ts.map +1 -1
  169. package/dist/src/styles/factories/createStyledView.js +10 -30
  170. package/dist/src/styles/factories/index.d.ts +4 -0
  171. package/dist/src/styles/factories/index.d.ts.map +1 -0
  172. package/dist/src/styles/factories/index.js +3 -0
  173. package/dist/src/styles/index.d.ts +2 -3
  174. package/dist/src/styles/index.d.ts.map +1 -1
  175. package/dist/src/styles/index.js +2 -3
  176. package/dist/src/styles/resolveStyle/resolveConfig.d.ts +7 -7
  177. package/dist/src/styles/resolveStyle/resolveConfig.d.ts.map +1 -1
  178. package/dist/src/styles/resolveStyle/resolveConfig.js +9 -9
  179. package/dist/src/styles/resolveStyle/resolveStyle.d.ts +6 -20
  180. package/dist/src/styles/resolveStyle/resolveStyle.d.ts.map +1 -1
  181. package/dist/src/styles/resolveStyle/resolveStyle.js +4 -29
  182. package/dist/src/styles/types/create.types.d.ts +1 -1
  183. package/dist/src/styles/types/create.types.d.ts.map +1 -1
  184. package/dist/src/styles/types/styled.types.d.ts +72 -50
  185. package/dist/src/styles/types/styled.types.d.ts.map +1 -1
  186. package/dist/src/styles/types/utility.types.d.ts.map +1 -1
  187. package/dist/src/styles/utils/index.d.ts +2 -0
  188. package/dist/src/styles/utils/index.d.ts.map +1 -0
  189. package/dist/src/styles/utils/index.js +1 -0
  190. package/dist/src/styles/utils/mergeStyles.d.ts +16 -0
  191. package/dist/src/styles/utils/mergeStyles.d.ts.map +1 -0
  192. package/dist/src/styles/utils/mergeStyles.js +20 -0
  193. package/package.json +3 -4
  194. package/src/lib/Components/AddressInput/AddressInput.mdx +15 -4
  195. package/src/lib/Components/AddressInput/AddressInput.stories.tsx +133 -17
  196. package/src/lib/Components/AddressInput/AddressInput.tsx +1 -1
  197. package/src/lib/Components/AmountInput/AmountInput.mdx +20 -1
  198. package/src/lib/Components/AmountInput/AmountInput.stories.tsx +180 -17
  199. package/src/lib/Components/AmountInput/AmountInput.tsx +24 -15
  200. package/src/lib/Components/Banner/Banner.test.tsx +48 -15
  201. package/src/lib/Components/BaseInput/BaseInput.tsx +6 -35
  202. package/src/lib/Components/BottomSheet/BottomSheet.stories.tsx +8 -8
  203. package/src/lib/Components/BottomSheet/BottomSheet.tsx +1 -1
  204. package/src/lib/Components/Button/BaseButton.test.tsx +149 -0
  205. package/src/lib/Components/Button/BaseButton.tsx +193 -148
  206. package/src/lib/Components/Button/Button.mdx +34 -31
  207. package/src/lib/Components/Button/Button.stories.tsx +37 -58
  208. package/src/lib/Components/Button/Button.tsx +4 -11
  209. package/src/lib/Components/Button/index.ts +1 -1
  210. package/src/lib/Components/Button/{BaseButton.types.ts → types.ts} +14 -8
  211. package/src/lib/Components/CardButton/CardButton.mdx +15 -25
  212. package/src/lib/Components/CardButton/CardButton.stories.tsx +48 -22
  213. package/src/lib/Components/CardButton/CardButton.test.tsx +141 -0
  214. package/src/lib/Components/CardButton/CardButton.tsx +142 -108
  215. package/src/lib/Components/CardButton/index.ts +1 -1
  216. package/src/lib/Components/CardButton/{CardButton.types.ts → types.ts} +4 -3
  217. package/src/lib/Components/Checkbox/Checkbox.mdx +1 -1
  218. package/src/lib/Components/Checkbox/Checkbox.test.tsx +42 -17
  219. package/src/lib/Components/Icon/Icon.stories.tsx +143 -73
  220. package/src/lib/Components/Icon/Icon.test.tsx +84 -0
  221. package/src/lib/Components/Icon/Icon.tsx +32 -28
  222. package/src/lib/Components/Icon/createIcon.ts +2 -3
  223. package/src/lib/Components/Icon/index.ts +1 -1
  224. package/src/lib/Components/Icon/{Icon.types.ts → types.ts} +4 -3
  225. package/src/lib/Components/IconButton/IconButton.mdx +13 -10
  226. package/src/lib/Components/IconButton/IconButton.stories.tsx +12 -14
  227. package/src/lib/Components/IconButton/IconButton.test.tsx +141 -0
  228. package/src/lib/Components/IconButton/IconButton.tsx +3 -13
  229. package/src/lib/Components/IconButton/index.ts +1 -0
  230. package/src/lib/Components/IconButton/types.ts +12 -0
  231. package/src/lib/Components/InteractiveIcon/InteractiveIcon.figma.tsx +1 -1
  232. package/src/lib/Components/InteractiveIcon/InteractiveIcon.mdx +25 -27
  233. package/src/lib/Components/InteractiveIcon/InteractiveIcon.stories.tsx +82 -43
  234. package/src/lib/Components/InteractiveIcon/InteractiveIcon.test.tsx +30 -19
  235. package/src/lib/Components/InteractiveIcon/InteractiveIcon.tsx +78 -45
  236. package/src/lib/Components/InteractiveIcon/types.ts +4 -7
  237. package/src/lib/Components/Link/Link.mdx +8 -18
  238. package/src/lib/Components/Link/Link.stories.tsx +56 -25
  239. package/src/lib/Components/Link/Link.test.tsx +141 -51
  240. package/src/lib/Components/Link/Link.tsx +128 -150
  241. package/src/lib/Components/Link/index.ts +1 -0
  242. package/src/lib/Components/Link/types.ts +44 -0
  243. package/src/lib/Components/Search/Search.mdx +14 -1
  244. package/src/lib/Components/Search/Search.stories.tsx +94 -15
  245. package/src/lib/Components/Select/Select.test.tsx +8 -4
  246. package/src/lib/Components/Select/Select.tsx +4 -31
  247. package/src/lib/Components/Spinner/Spinner.stories.tsx +1 -5
  248. package/src/lib/Components/Spinner/Spinner.tsx +60 -34
  249. package/src/lib/Components/Spinner/index.ts +1 -0
  250. package/src/lib/Components/Spinner/types.ts +15 -0
  251. package/src/lib/Components/Switch/Switch.mdx +1 -1
  252. package/src/lib/Components/Tag/Tag.stories.tsx +2 -2
  253. package/src/lib/Components/Tag/Tag.tsx +22 -6
  254. package/src/lib/Components/Tag/Tag.types.ts +7 -8
  255. package/src/lib/Components/TextInput/TextInput.mdx +24 -4
  256. package/src/lib/Components/TextInput/TextInput.stories.tsx +131 -15
  257. package/src/lib/Components/Tile/Tile.test.tsx +100 -63
  258. package/src/lib/Components/Tile/Tile.tsx +2 -2
  259. package/src/lib/Components/Tooltip/Tooltip.stories.tsx +2 -2
  260. package/src/lib/Components/Tooltip/Tooltip.test.tsx +8 -4
  261. package/src/lib/Components/{Box → Utility/Box}/Box.mdx +15 -13
  262. package/src/lib/Components/{Box → Utility/Box}/Box.stories.tsx +13 -11
  263. package/src/lib/Components/{Box → Utility/Box}/Box.tsx +11 -12
  264. package/src/lib/Components/Utility/Box/index.ts +1 -0
  265. package/src/lib/Components/Utility/Pressable/Pressable.mdx +103 -0
  266. package/src/lib/Components/Utility/Pressable/Pressable.stories.tsx +51 -0
  267. package/src/lib/Components/Utility/Pressable/Pressable.test.tsx +221 -0
  268. package/src/lib/Components/Utility/Pressable/Pressable.tsx +34 -0
  269. package/src/lib/Components/Utility/Pressable/index.ts +2 -0
  270. package/src/lib/Components/Utility/Pressable/types.ts +3 -0
  271. package/src/lib/Components/{Text → Utility/Text}/Text.mdx +15 -7
  272. package/src/lib/Components/{Text → Utility/Text}/Text.stories.tsx +3 -3
  273. package/src/lib/Components/Utility/Text/Text.tsx +39 -0
  274. package/src/lib/Components/Utility/index.ts +3 -0
  275. package/src/lib/Components/index.ts +1 -3
  276. package/src/lib/utils/components/InjectStylesIntoChildren.tsx +23 -14
  277. package/src/styles/Provider/createStylesheetTheme.ts +0 -1
  278. package/src/styles/create/useCreate.ts +8 -4
  279. package/src/styles/factories/areLxPropsEqual.ts +32 -0
  280. package/src/styles/factories/createStyledPressable.test.tsx +253 -0
  281. package/src/styles/factories/createStyledPressable.tsx +97 -0
  282. package/src/styles/factories/createStyledText.test.tsx +28 -20
  283. package/src/styles/factories/createStyledText.tsx +29 -49
  284. package/src/styles/factories/createStyledView.test.tsx +22 -16
  285. package/src/styles/factories/createStyledView.tsx +19 -53
  286. package/src/styles/factories/index.ts +3 -0
  287. package/src/styles/index.ts +2 -3
  288. package/src/styles/resolveStyle/resolveConfig.ts +16 -15
  289. package/src/styles/resolveStyle/resolveStyle.test.ts +13 -141
  290. package/src/styles/resolveStyle/resolveStyle.ts +10 -60
  291. package/src/styles/types/create.types.ts +1 -1
  292. package/src/styles/types/styled.types.ts +73 -105
  293. package/src/styles/types/utility.types.ts +1 -0
  294. package/src/styles/utils/index.ts +1 -0
  295. package/src/styles/utils/mergeStyles.test.ts +45 -0
  296. package/src/styles/utils/mergeStyles.ts +25 -0
  297. package/.storybook/docs/getting-started/StyleSystem.mdx +0 -133
  298. package/dist/src/lib/Components/Box/Box.d.ts +0 -592
  299. package/dist/src/lib/Components/Box/Box.d.ts.map +0 -1
  300. package/dist/src/lib/Components/Box/Box.stories.d.ts.map +0 -1
  301. package/dist/src/lib/Components/Box/Box.types.d.ts +0 -3
  302. package/dist/src/lib/Components/Box/Box.types.d.ts.map +0 -1
  303. package/dist/src/lib/Components/Box/index.d.ts +0 -3
  304. package/dist/src/lib/Components/Box/index.d.ts.map +0 -1
  305. package/dist/src/lib/Components/Button/BaseButton.types.d.ts.map +0 -1
  306. package/dist/src/lib/Components/CardButton/CardButton.types.d.ts.map +0 -1
  307. package/dist/src/lib/Components/Icon/Icon.types.d.ts.map +0 -1
  308. package/dist/src/lib/Components/Text/Text.d.ts +0 -602
  309. package/dist/src/lib/Components/Text/Text.d.ts.map +0 -1
  310. package/dist/src/lib/Components/Text/Text.stories.d.ts.map +0 -1
  311. package/dist/src/lib/Components/Text/index.d.ts.map +0 -1
  312. package/dist/src/lib/Components/_ToRemove/ToRemove.d.ts +0 -9
  313. package/dist/src/lib/Components/_ToRemove/ToRemove.d.ts.map +0 -1
  314. package/dist/src/lib/Components/_ToRemove/ToRemove.js +0 -43
  315. package/dist/src/styles/utils/styleVarianceAuthority.d.ts +0 -30
  316. package/dist/src/styles/utils/styleVarianceAuthority.d.ts.map +0 -1
  317. package/dist/src/styles/utils/styleVarianceAuthority.js +0 -97
  318. package/src/lib/Components/Box/Box.types.ts +0 -3
  319. package/src/lib/Components/Box/index.ts +0 -2
  320. package/src/lib/Components/Text/Text.tsx +0 -35
  321. package/src/lib/Components/_ToRemove/ToRemove.tsx +0 -65
  322. package/src/styles/utils/styleVarianceAuthority.test.ts +0 -302
  323. package/src/styles/utils/styleVarianceAuthority.ts +0 -154
  324. /package/dist/src/lib/Components/{Box/Box.types.js → Button/types.js} +0 -0
  325. /package/dist/src/lib/Components/{Button/BaseButton.types.js → CardButton/types.js} +0 -0
  326. /package/dist/src/lib/Components/{CardButton/CardButton.types.js → Icon/types.js} +0 -0
  327. /package/dist/src/lib/Components/{Icon/Icon.types.js → IconButton/types.js} +0 -0
  328. /package/dist/src/lib/Components/{Box → Utility/Box}/Box.stories.d.ts +0 -0
  329. /package/dist/src/lib/Components/{Box → Utility/Box}/index.js +0 -0
  330. /package/dist/src/lib/Components/{Text → Utility/Text}/Text.stories.d.ts +0 -0
  331. /package/dist/src/lib/Components/{Text → Utility/Text}/index.d.ts +0 -0
  332. /package/dist/src/lib/Components/{Text → Utility/Text}/index.js +0 -0
  333. /package/src/lib/Components/{Text → Utility/Text}/index.ts +0 -0
@@ -0,0 +1,103 @@
1
+ import { Meta, Canvas, Controls } from '@storybook/addon-docs/blocks';
2
+ import * as PressableStories from './Pressable.stories';
3
+ import { CustomTabs, Tab } from '../../../../../.storybook/components';
4
+
5
+ <Meta title='Utility/Pressable' of={PressableStories} />
6
+
7
+ # Pressable
8
+
9
+ <CustomTabs>
10
+ <Tab label="Overview ">
11
+ Pressable is a utility primitive that wraps React Native's `Pressable` component with token-constrained style props from the design system theme.
12
+
13
+ Pressable exposes the `lx` property to consume tokens from the `ledgerLiveTheme`, see [lx documentation](/?path=/docs/style-system-lx--docs).
14
+
15
+ ## Interactive Example
16
+
17
+ <Canvas of={PressableStories.Base} />
18
+ <Controls of={PressableStories.Base} />
19
+
20
+ ## Usage
21
+
22
+ ```tsx
23
+ import { Pressable, Text } from '@ledgerhq/lumen-ui-rnative';
24
+
25
+ function InteractiveCard() {
26
+ return (
27
+ <Pressable
28
+ lx={{
29
+ padding: 's16',
30
+ backgroundColor: 'accent',
31
+ borderRadius: 'md',
32
+ gap: 's8',
33
+ }}
34
+ onPress={() => console.log('Pressed!')}
35
+ >
36
+ <Text>Press me</Text>
37
+ </Pressable>
38
+ );
39
+ }
40
+ ```
41
+
42
+ ## Pressed State Styling
43
+
44
+ The `lx` prop only accepts static token objects. For pressed-state styling, use the `style` prop with a function:
45
+
46
+ ```tsx
47
+ import { Pressable, Text } from '@ledgerhq/lumen-ui-rnative';
48
+
49
+ function ButtonWithFeedback() {
50
+ return (
51
+ <Pressable
52
+ lx={{
53
+ padding: 's16',
54
+ backgroundColor: 'accent',
55
+ borderRadius: 'md',
56
+ }}
57
+ style={({ pressed }) => ({
58
+ opacity: pressed ? 0.8 : 1,
59
+ transform: [{ scale: pressed ? 0.98 : 1 }],
60
+ })}
61
+ onPress={() => console.log('Pressed!')}
62
+ >
63
+ <Text>Press me</Text>
64
+ </Pressable>
65
+ );
66
+ }
67
+ ```
68
+
69
+ ## Composing Styles
70
+
71
+ The `style` prop supports arrays of objects and functions, making it easy to compose styles:
72
+
73
+ ```tsx
74
+ import { Pressable, Text } from '@ledgerhq/lumen-ui-rnative';
75
+
76
+ function ComposedButton({ style }) {
77
+ return (
78
+ <Pressable
79
+ lx={{ padding: 's16', borderRadius: 'md' }}
80
+ style={[
81
+ style, // Consumer's style (can be object, function, or array)
82
+ { flex: 1 },
83
+ ({ pressed }) => ({ opacity: pressed ? 0.8 : 1 }),
84
+ ]}
85
+ >
86
+ <Text>Composed</Text>
87
+ </Pressable>
88
+ );
89
+ }
90
+ ```
91
+
92
+ ## Escape Hatch
93
+
94
+ For values not covered by tokens, use raw numbers or the `style` prop:
95
+
96
+ ```tsx
97
+ // Style prop for complete override
98
+ <Pressable lx={{ marginTop: 's4' }} style={{ width: 127 }} />
99
+ ```
100
+
101
+ </Tab>
102
+ </CustomTabs>
103
+
@@ -0,0 +1,51 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-native-web-vite';
2
+ import { Pressable } from './Pressable';
3
+
4
+ const meta: Meta<typeof Pressable> = {
5
+ component: Pressable,
6
+ title: 'Utility/Pressable',
7
+ parameters: {
8
+ docs: {
9
+ source: {
10
+ language: 'tsx',
11
+ format: true,
12
+ type: 'code',
13
+ },
14
+ },
15
+ },
16
+ };
17
+
18
+ export default meta;
19
+ type Story = StoryObj<typeof Pressable>;
20
+
21
+ export const Base: Story = {
22
+ args: {
23
+ lx: {
24
+ height: 's48',
25
+ width: 's48',
26
+ backgroundColor: 'accent',
27
+ borderRadius: 'md',
28
+ alignSelf: 'center',
29
+ },
30
+ style: ({ pressed }) => ({ opacity: pressed ? 0.5 : 1 }),
31
+ },
32
+ render: (args) => <Pressable {...args} />,
33
+ parameters: {
34
+ docs: {
35
+ source: {
36
+ code: `
37
+ <Pressable
38
+ style={({ pressed }) => ({ opacity: pressed ? 0.5 : 1 })}
39
+ lx={{
40
+ height: 's48',
41
+ width: 's48',
42
+ backgroundColor: 'accent',
43
+ borderRadius: 'md',
44
+ alignSelf: 'center',
45
+ }}
46
+ />
47
+ `,
48
+ },
49
+ },
50
+ },
51
+ };
@@ -0,0 +1,221 @@
1
+ import { describe, it, expect, jest } from '@jest/globals';
2
+ import { ledgerLiveThemes } from '@ledgerhq/lumen-design-core';
3
+ import { render, screen, fireEvent } from '@testing-library/react-native';
4
+ import React, { createRef } from 'react';
5
+ import { Text, View, ViewStyle } from 'react-native';
6
+
7
+ import { ThemeProvider } from '../../ThemeProvider/ThemeProvider';
8
+ import { Pressable } from './Pressable';
9
+
10
+ const renderWithProvider = (component: React.ReactElement) => {
11
+ return render(
12
+ <ThemeProvider themes={ledgerLiveThemes} colorScheme='dark' locale='en'>
13
+ {component}
14
+ </ThemeProvider>,
15
+ );
16
+ };
17
+
18
+ describe('Pressable Utility Component', () => {
19
+ describe('Rendering', () => {
20
+ it('should render correctly', () => {
21
+ renderWithProvider(<Pressable testID='pressable' />);
22
+ expect(screen.getByTestId('pressable')).toBeTruthy();
23
+ });
24
+
25
+ it('should render children', () => {
26
+ renderWithProvider(
27
+ <Pressable testID='pressable'>
28
+ <Text>Child Content</Text>
29
+ </Pressable>,
30
+ );
31
+ expect(screen.getByText('Child Content')).toBeTruthy();
32
+ });
33
+
34
+ it('should have correct display name', () => {
35
+ expect(Pressable.displayName).toBe('StyledPressable(Pressable)');
36
+ });
37
+ });
38
+
39
+ describe('Token Props (lx)', () => {
40
+ it('should resolve padding token', () => {
41
+ renderWithProvider(
42
+ <Pressable testID='pressable' lx={{ padding: 's16' }} />,
43
+ );
44
+ const pressable = screen.getByTestId('pressable');
45
+ expect(pressable.props.style.padding).toBe(16);
46
+ });
47
+
48
+ it('should resolve backgroundColor token', () => {
49
+ renderWithProvider(
50
+ <Pressable testID='pressable' lx={{ backgroundColor: 'surface' }} />,
51
+ );
52
+ const pressable = screen.getByTestId('pressable');
53
+ expect(pressable.props.style.backgroundColor).toBeDefined();
54
+ });
55
+
56
+ it('should resolve multiple token props', () => {
57
+ renderWithProvider(
58
+ <Pressable
59
+ testID='pressable'
60
+ lx={{
61
+ padding: 's16',
62
+ marginTop: 's8',
63
+ borderRadius: 'md',
64
+ }}
65
+ />,
66
+ );
67
+ const pressable = screen.getByTestId('pressable');
68
+ expect(pressable.props.style.padding).toBe(16);
69
+ expect(pressable.props.style.marginTop).toBe(8);
70
+ expect(pressable.props.style.borderRadius).toBeDefined();
71
+ });
72
+ });
73
+
74
+ describe('Style Props', () => {
75
+ it('should merge static style prop with resolved tokens', () => {
76
+ const customStyle: ViewStyle = { opacity: 0.5 };
77
+ renderWithProvider(
78
+ <Pressable
79
+ testID='pressable'
80
+ lx={{ padding: 's16' }}
81
+ style={customStyle}
82
+ />,
83
+ );
84
+ const pressable = screen.getByTestId('pressable');
85
+ expect(pressable.props.style.padding).toBe(16);
86
+ expect(pressable.props.style).toMatchObject({ opacity: 0.5 });
87
+ });
88
+
89
+ it('should merge style prop with lx tokens', () => {
90
+ renderWithProvider(
91
+ <Pressable
92
+ testID='pressable'
93
+ lx={{ backgroundColor: 'surface' }}
94
+ style={{ opacity: 0.8 }}
95
+ />,
96
+ );
97
+ const pressable = screen.getByTestId('pressable');
98
+ expect(pressable.props.style.backgroundColor).toBeDefined();
99
+ expect(pressable.props.style).toMatchObject({ opacity: 0.8 });
100
+ });
101
+
102
+ it('should support function-based style prop', () => {
103
+ renderWithProvider(
104
+ <Pressable
105
+ testID='pressable'
106
+ lx={{ backgroundColor: 'surface' }}
107
+ style={({ pressed }) => ({
108
+ opacity: pressed ? 0.7 : 1,
109
+ })}
110
+ />,
111
+ );
112
+ const pressable = screen.getByTestId('pressable');
113
+ expect(pressable.props.style.backgroundColor).toBeDefined();
114
+ expect(pressable.props.style.opacity).toBe(1);
115
+ });
116
+ });
117
+
118
+ describe('Interactions', () => {
119
+ it('should call onPress when pressed', () => {
120
+ const handlePress = jest.fn();
121
+ renderWithProvider(
122
+ <Pressable testID='pressable' onPress={handlePress} />,
123
+ );
124
+
125
+ fireEvent.press(screen.getByTestId('pressable'));
126
+ expect(handlePress).toHaveBeenCalledTimes(1);
127
+ });
128
+
129
+ it('should call onPressIn when press starts', () => {
130
+ const handlePressIn = jest.fn();
131
+ renderWithProvider(
132
+ <Pressable testID='pressable' onPressIn={handlePressIn} />,
133
+ );
134
+
135
+ fireEvent(screen.getByTestId('pressable'), 'onPressIn');
136
+ expect(handlePressIn).toHaveBeenCalledTimes(1);
137
+ });
138
+
139
+ it('should call onPressOut when press ends', () => {
140
+ const handlePressOut = jest.fn();
141
+ renderWithProvider(
142
+ <Pressable testID='pressable' onPressOut={handlePressOut} />,
143
+ );
144
+
145
+ fireEvent(screen.getByTestId('pressable'), 'onPressOut');
146
+ expect(handlePressOut).toHaveBeenCalledTimes(1);
147
+ });
148
+
149
+ it('should call onLongPress when long pressed', () => {
150
+ const handleLongPress = jest.fn();
151
+ renderWithProvider(
152
+ <Pressable testID='pressable' onLongPress={handleLongPress} />,
153
+ );
154
+
155
+ fireEvent(screen.getByTestId('pressable'), 'onLongPress');
156
+ expect(handleLongPress).toHaveBeenCalledTimes(1);
157
+ });
158
+
159
+ it('should not call onPress when disabled', () => {
160
+ const handlePress = jest.fn();
161
+ renderWithProvider(
162
+ <Pressable testID='pressable' onPress={handlePress} disabled />,
163
+ );
164
+
165
+ fireEvent.press(screen.getByTestId('pressable'));
166
+ expect(handlePress).not.toHaveBeenCalled();
167
+ });
168
+ });
169
+
170
+ describe('Ref Forwarding', () => {
171
+ it('should forward ref', () => {
172
+ const ref = createRef<View>();
173
+ renderWithProvider(<Pressable ref={ref} testID='pressable' />);
174
+ expect(ref.current).toBeTruthy();
175
+ });
176
+ });
177
+
178
+ describe('Accessibility', () => {
179
+ it('should pass accessibility props', () => {
180
+ renderWithProvider(
181
+ <Pressable
182
+ testID='pressable'
183
+ accessibilityLabel='Interactive button'
184
+ accessibilityRole='button'
185
+ />,
186
+ );
187
+ const pressable = screen.getByTestId('pressable');
188
+ expect(pressable.props.accessibilityLabel).toBe('Interactive button');
189
+ expect(pressable.props.accessibilityRole).toBe('button');
190
+ });
191
+
192
+ it('should pass accessibility state', () => {
193
+ renderWithProvider(
194
+ <Pressable
195
+ testID='pressable'
196
+ accessibilityState={{ disabled: true, selected: true }}
197
+ />,
198
+ );
199
+ const pressable = screen.getByTestId('pressable');
200
+ expect(pressable.props.accessibilityState).toEqual({
201
+ disabled: true,
202
+ selected: true,
203
+ });
204
+ });
205
+ });
206
+
207
+ describe('Children Render Function', () => {
208
+ it('should support children as render function', () => {
209
+ renderWithProvider(
210
+ <Pressable testID='pressable'>
211
+ {({ pressed }) => (
212
+ <Text testID='child-text'>
213
+ {pressed ? 'Pressed!' : 'Not pressed'}
214
+ </Text>
215
+ )}
216
+ </Pressable>,
217
+ );
218
+ expect(screen.getByText('Not pressed')).toBeTruthy();
219
+ });
220
+ });
221
+ });
@@ -0,0 +1,34 @@
1
+ import { Pressable as RNPressable } from 'react-native';
2
+ import { createStyledPressable } from '../../../../styles';
3
+
4
+ /**
5
+ * Pressable - An interactive layout primitive with token-constrained style props.
6
+ *
7
+ * Pressable is a wrapper around React Native's Pressable that accepts design
8
+ * token-based style props directly, providing type-safe styling with autocomplete
9
+ * for spacing, sizes, colors, etc. Use the `style` prop for pressed-state styling.
10
+ *
11
+ * @see {@link https://ldls.vercel.app/?path=/docs/utility-pressable--docs Storybook}
12
+ *
13
+ * @example
14
+ * ```tsx
15
+ * import { Pressable } from '@ledgerhq/lumen-ui-rnative';
16
+ *
17
+ * // Basic usage with token props
18
+ * <Pressable
19
+ * lx={{ width: 's400', marginTop: 's4', gap: 's12', alignItems: 'center' }}
20
+ * onPress={handlePress}
21
+ * >
22
+ * <Text>Content</Text>
23
+ * </Pressable>
24
+ *
25
+ * // With function-based style for pressed state
26
+ * <Pressable
27
+ * lx={{ padding: 's16', backgroundColor: 'surface' }}
28
+ * style={({ pressed }) => ({ opacity: pressed ? 0.8 : 1 })}
29
+ * >
30
+ * <Text>Press me</Text>
31
+ * </Pressable>
32
+ * ```
33
+ */
34
+ export const Pressable = createStyledPressable(RNPressable);
@@ -0,0 +1,2 @@
1
+ export * from './Pressable';
2
+ export type { PressableProps } from './types';
@@ -0,0 +1,3 @@
1
+ import { StyledPressableProps } from '../../../../styles';
2
+
3
+ export type PressableProps = StyledPressableProps;
@@ -1,11 +1,17 @@
1
1
  import { Meta, Canvas, Controls } from '@storybook/addon-docs/blocks';
2
2
  import * as TextStories from './Text.stories';
3
+ import { CustomTabs, Tab } from '../../../../../.storybook/components';
3
4
 
4
5
  <Meta title='Utility/Text' of={TextStories} />
5
6
 
6
7
  # Text
7
8
 
8
- Text is a typography component that wraps React Native's `Text` with a `typo` prop for typography presets and token-constrained style props from the design system theme.
9
+ <CustomTabs>
10
+ <Tab label="Overview ">
11
+
12
+ Text is a typography component that wraps React Native's `Text` with a `typography` prop for typography presets and token-constrained style props from the design system theme.
13
+
14
+ Text expose the `lx` property to consume tokens from the `ledgerLiveTheme`, see [LX documentation](/?path=/docs/style-system-lx--docs).
9
15
 
10
16
  ## Interactive Example
11
17
 
@@ -14,7 +20,7 @@ Text is a typography component that wraps React Native's `Text` with a `typo` pr
14
20
 
15
21
  ## Available Typographies
16
22
 
17
- The `typo` property should be used to apply a typography preset that includes font size, font weight, line height, and letter spacing.
23
+ The `typography` property should be used to apply a typography preset that includes font size, font weight, line height, and letter spacing.
18
24
 
19
25
  ### Body
20
26
  Used for content text like paragraphs.
@@ -46,16 +52,16 @@ Used for large hero text like page titles.
46
52
  ```tsx
47
53
  import { Text } from '@ledgerhq/lumen-ui-rnative';
48
54
 
49
- // Basic usage with typography typo
50
- <Text typo='body1'>Hello World</Text>
55
+ // Basic usage with typography typography
56
+ <Text typography='body1'>Hello World</Text>
51
57
 
52
58
  // With custom color
53
- <Text typo='heading2SemiBold' color='muted'>
59
+ <Text typography='heading2SemiBold' lx={{ color: 'muted' }}>
54
60
  Subtitle
55
61
  </Text>
56
62
 
57
63
  // With spacing
58
- <Text typo='body2' marginTop='s8' color='base'>
64
+ <Text typography='body2' lx={{ marginTop: 's8', color: 'base' }}>
59
65
  Description text
60
66
  </Text>
61
67
  ```
@@ -65,6 +71,8 @@ import { Text } from '@ledgerhq/lumen-ui-rnative';
65
71
  For values not covered by tokens, use the `style` prop:
66
72
 
67
73
  ```tsx
68
- <Text typo='body1' style={{ letterSpacing: 2 }} />
74
+ <Text typography='body1' style={{ letterSpacing: 2 }} />
69
75
  ```
70
76
 
77
+ </Tab>
78
+ </CustomTabs>
@@ -20,15 +20,15 @@ type Story = StoryObj<typeof Text>;
20
20
 
21
21
  export const Base: Story = {
22
22
  args: {
23
- typo: 'body1',
24
- color: 'base',
23
+ typography: 'body1',
24
+ lx: { color: 'base' },
25
25
  children: 'Hello World',
26
26
  },
27
27
  parameters: {
28
28
  docs: {
29
29
  source: {
30
30
  code: `
31
- <Text typo='body1' color='base'>
31
+ <Text typography='body1' lx={{ color: 'base' }}>
32
32
  Hello World
33
33
  </Text>
34
34
  `,
@@ -0,0 +1,39 @@
1
+ import { Text as RNText } from 'react-native';
2
+ import { createStyledText, type StyledTextProps } from '../../../../styles';
3
+
4
+ /**
5
+ * Text - A typography component with typography support and token-constrained style props.
6
+ *
7
+ * Text is a wrapper around React Native's Text that accepts a `typography` prop for
8
+ * typography presets, plus design token-based style props for colors, spacing, etc.
9
+ *
10
+ * @see {@link https://ldls.vercel.app/?path=/docs/typography-text--docs Storybook}
11
+ *
12
+ * @example
13
+ * ```tsx
14
+ * import { Text } from '@ledgerhq/lumen-ui-rnative';
15
+ *
16
+ * // Basic usage with typography typography
17
+ * <Text typography='body1'>Hello World</Text>
18
+ *
19
+ * // With custom color
20
+ * <Text typography='heading2SemiBold' lx={{ color: 'muted' }}>
21
+ * Subtitle
22
+ * </Text>
23
+ *
24
+ * // With spacing
25
+ * <Text typography='body2' lx={{ marginTop: 's8', color: 'base' }}>
26
+ * Description text
27
+ * </Text>
28
+ *
29
+ * // Style prop for complete override
30
+ * <Text
31
+ * typography='body1'
32
+ * lx={{ marginTop: 's8' }}
33
+ * style={{ letterSpacing: 127 }}
34
+ * />
35
+ * ```
36
+ */
37
+ export const Text = createStyledText(RNText);
38
+
39
+ export type TextProps = StyledTextProps;
@@ -0,0 +1,3 @@
1
+ export * from './Pressable';
2
+ export * from './Box';
3
+ export * from './Text';
@@ -1,9 +1,7 @@
1
- export * from './_ToRemove/ToRemove';
2
1
  export * from './AddressInput';
3
2
  export * from './AmountInput';
4
3
  export * from './Banner';
5
4
  export * from './BottomSheet';
6
- export * from './Box';
7
5
  export * from './Button';
8
6
  export * from './CardButton';
9
7
  export * from './Checkbox';
@@ -16,7 +14,7 @@ export * from './Select';
16
14
  export * from './Spot';
17
15
  export * from './Switch';
18
16
  export * from './Tag';
19
- export * from './Text';
17
+ export * from './Utility';
20
18
  export * from './TextInput';
21
19
  export * from './ThemeProvider';
22
20
  export * from './Tile';
@@ -1,16 +1,25 @@
1
- import { cn } from '@ledgerhq/lumen-utils-shared';
2
- import { cloneElement, isValidElement, memo, PropsWithChildren } from 'react';
1
+ import {
2
+ cloneElement,
3
+ isValidElement,
4
+ memo,
5
+ PropsWithChildren,
6
+ ReactElement,
7
+ } from 'react';
8
+ import { ImageStyle, StyleProp, TextStyle, ViewStyle } from 'react-native';
3
9
 
4
- function _InjectStylesIntoChildren({
5
- styles,
6
- children,
7
- }: PropsWithChildren<{ styles: string }>) {
8
- if (!isValidElement(children)) {
9
- return children;
10
- }
11
- return cloneElement(children, {
12
- className: cn((children.props as { className?: string }).className, styles),
13
- } as Partial<{ className: string }>);
14
- }
10
+ type StyleValue = ViewStyle | TextStyle | ImageStyle;
15
11
 
16
- export const InjectStylesIntoChildren = memo(_InjectStylesIntoChildren);
12
+ type StylableProps = { style?: StyleProp<StyleValue> };
13
+
14
+ export const InjectStylesIntoChildren = memo(
15
+ ({ style, children }: PropsWithChildren<{ style: StyleValue }>) => {
16
+ if (!isValidElement(children)) {
17
+ return children;
18
+ }
19
+ const childProps = children.props as StylableProps;
20
+ return cloneElement(children as ReactElement<StylableProps>, {
21
+ style: childProps.style ? [childProps.style, style] : style,
22
+ });
23
+ },
24
+ );
25
+ InjectStylesIntoChildren.displayName = 'InjectStylesIntoChildren';
@@ -15,7 +15,6 @@ export const getNegativeSpacings = <
15
15
  ) as Output;
16
16
  };
17
17
 
18
- /**
19
18
  /**
20
19
  * The theme object from design-core is not directly compatible with React Native's StyleSheet.
21
20
  *
@@ -1,14 +1,18 @@
1
- import { useMemo } from 'react';
1
+ import { DependencyList, useMemo, useRef } from 'react';
2
2
  import { useTheme } from '../Provider/useTheme';
3
3
  import type { LumenStyleSheet, LumenStyleSheetExtended } from '../types';
4
4
  import { create } from './create';
5
5
 
6
6
  export const useCreate = <S extends LumenStyleSheet>(
7
7
  styleCreator: LumenStyleSheetExtended<S>,
8
+ deps: DependencyList = [],
8
9
  ): S => {
9
10
  const { theme } = useTheme();
11
+ const styleCreatorRef = useRef(styleCreator);
12
+ styleCreatorRef.current = styleCreator;
10
13
 
11
- return useMemo(() => {
12
- return create(theme, styleCreator);
13
- }, [theme, styleCreator]);
14
+ return useMemo(
15
+ () => create(theme, styleCreatorRef.current),
16
+ [theme, ...deps],
17
+ );
14
18
  };
@@ -0,0 +1,32 @@
1
+ import {
2
+ LumenViewStyleLX,
3
+ LumenTextStyleLX,
4
+ LumenPressableStyleLX,
5
+ } from '../types';
6
+
7
+ type UnknownRecord = Record<string, unknown>;
8
+
9
+ /**
10
+ * Shallow equal for all props
11
+ */
12
+ const shallowEqual = (a: UnknownRecord, b: UnknownRecord): boolean => {
13
+ const keysA = Object.keys(a);
14
+ if (keysA.length !== Object.keys(b).length) return false;
15
+ return keysA.every((k) => a[k] === b[k]);
16
+ };
17
+
18
+ export const areLxPropsEqual = (
19
+ prevProps: LumenViewStyleLX | LumenTextStyleLX | LumenPressableStyleLX,
20
+ nextProps: LumenViewStyleLX | LumenTextStyleLX | LumenPressableStyleLX,
21
+ ): boolean => {
22
+ const { lx: prevLx = {}, ...prevRest } = prevProps;
23
+ const { lx: nextLx = {}, ...nextRest } = nextProps;
24
+
25
+ return (
26
+ shallowEqual(prevLx, nextLx) &&
27
+ shallowEqual(
28
+ prevRest as Record<string, unknown>,
29
+ nextRest as Record<string, unknown>,
30
+ )
31
+ );
32
+ };