@codeleap/web 5.8.21 → 6.1.2

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 (344) hide show
  1. package/dist/components/ActionIcon/index.d.ts +1 -1
  2. package/dist/components/ActionIcon/index.js +1 -1
  3. package/dist/components/ActionIcon/index.js.map +1 -1
  4. package/dist/components/ActivityIndicator/index.d.ts +9 -2
  5. package/dist/components/ActivityIndicator/index.js +8 -16
  6. package/dist/components/ActivityIndicator/index.js.map +1 -1
  7. package/dist/components/Badge/index.d.ts +1 -1
  8. package/dist/components/Badge/index.js +1 -1
  9. package/dist/components/Badge/index.js.map +1 -1
  10. package/dist/components/Badge/types.d.ts +1 -2
  11. package/dist/components/Button/index.d.ts +1 -1
  12. package/dist/components/Button/index.js +1 -1
  13. package/dist/components/Button/index.js.map +1 -1
  14. package/dist/components/Carousel/index.d.ts +5 -0
  15. package/dist/components/Carousel/index.js +168 -0
  16. package/dist/components/Carousel/index.js.map +1 -0
  17. package/dist/components/Carousel/styles.d.ts +3 -0
  18. package/dist/components/Carousel/styles.js.map +1 -0
  19. package/dist/components/Carousel/types.d.ts +34 -0
  20. package/dist/components/{Grid → Carousel}/types.js.map +1 -1
  21. package/dist/components/Checkbox/index.d.ts +1 -1
  22. package/dist/components/Checkbox/index.js +2 -2
  23. package/dist/components/Checkbox/index.js.map +1 -1
  24. package/dist/components/Collapse/index.d.ts +1 -1
  25. package/dist/components/Collapse/index.js +3 -3
  26. package/dist/components/Collapse/index.js.map +1 -1
  27. package/dist/components/Collapse/types.d.ts +1 -2
  28. package/dist/components/ColorPicker/index.d.ts +1 -1
  29. package/dist/components/ColorPicker/index.js +4 -4
  30. package/dist/components/ColorPicker/index.js.map +1 -1
  31. package/dist/components/ColorPicker/types.d.ts +3 -3
  32. package/dist/components/CropPicker/index.d.ts +9 -2
  33. package/dist/components/CropPicker/index.js +6 -6
  34. package/dist/components/CropPicker/index.js.map +1 -1
  35. package/dist/components/CropPicker/types.d.ts +3 -1
  36. package/dist/components/DatePicker/components/DayContent.js +1 -1
  37. package/dist/components/DatePicker/components/DayContent.js.map +1 -1
  38. package/dist/components/DatePicker/components/Header.js +1 -1
  39. package/dist/components/DatePicker/components/Header.js.map +1 -1
  40. package/dist/components/DatePicker/components/OuterInput.js +2 -12
  41. package/dist/components/DatePicker/components/OuterInput.js.map +1 -1
  42. package/dist/components/DatePicker/components/YearContent.js +1 -1
  43. package/dist/components/DatePicker/components/YearContent.js.map +1 -1
  44. package/dist/components/DatePicker/index.d.ts +1 -1
  45. package/dist/components/DatePicker/index.js +12 -13
  46. package/dist/components/DatePicker/index.js.map +1 -1
  47. package/dist/components/DatePicker/types.d.ts +8 -6
  48. package/dist/components/Drawer/index.d.ts +1 -1
  49. package/dist/components/Drawer/index.js +2 -2
  50. package/dist/components/Drawer/index.js.map +1 -1
  51. package/dist/components/Dropzone/index.d.ts +9 -2
  52. package/dist/components/Dropzone/index.js +7 -6
  53. package/dist/components/Dropzone/index.js.map +1 -1
  54. package/dist/components/Dropzone/types.d.ts +3 -2
  55. package/dist/components/EmptyPlaceholder/index.d.ts +1 -1
  56. package/dist/components/EmptyPlaceholder/index.js +3 -3
  57. package/dist/components/EmptyPlaceholder/index.js.map +1 -1
  58. package/dist/components/EmptyPlaceholder/types.d.ts +2 -2
  59. package/dist/components/FileInput/index.d.ts +5 -9
  60. package/dist/components/FileInput/index.js +6 -5
  61. package/dist/components/FileInput/index.js.map +1 -1
  62. package/dist/components/FileInput/types.d.ts +2 -0
  63. package/dist/components/Icon/index.d.ts +1 -1
  64. package/dist/components/Icon/index.js.map +1 -1
  65. package/dist/components/InputBase/index.js +2 -2
  66. package/dist/components/InputBase/index.js.map +1 -1
  67. package/dist/components/InputBase/types.d.ts +0 -1
  68. package/dist/components/InputBase/useInputBase.d.ts +2 -3
  69. package/dist/components/InputBase/useInputBase.js +2 -3
  70. package/dist/components/InputBase/useInputBase.js.map +1 -1
  71. package/dist/components/InputBase/useInputBasePartialStyles.js +1 -2
  72. package/dist/components/InputBase/useInputBasePartialStyles.js.map +1 -1
  73. package/dist/components/InputBase/utils.d.ts +1 -1
  74. package/dist/components/InputBase/utils.js +3 -3
  75. package/dist/components/InputBase/utils.js.map +1 -1
  76. package/dist/components/List/index.d.ts +2 -3
  77. package/dist/components/List/index.js +87 -40
  78. package/dist/components/List/index.js.map +1 -1
  79. package/dist/components/List/styles.d.ts +2 -4
  80. package/dist/components/List/types.d.ts +10 -52
  81. package/dist/components/LoadingOverlay/index.d.ts +1 -1
  82. package/dist/components/LoadingOverlay/index.js +1 -1
  83. package/dist/components/LoadingOverlay/index.js.map +1 -1
  84. package/dist/components/MaskedTextInput/index.d.ts +7 -0
  85. package/dist/components/MaskedTextInput/index.js +69 -0
  86. package/dist/components/MaskedTextInput/index.js.map +1 -0
  87. package/dist/components/MaskedTextInput/mask.d.ts +8 -0
  88. package/dist/components/MaskedTextInput/mask.js +37 -0
  89. package/dist/components/MaskedTextInput/mask.js.map +1 -0
  90. package/dist/components/MaskedTextInput/types.d.ts +10 -0
  91. package/dist/components/MaskedTextInput/types.js.map +1 -0
  92. package/dist/components/Modal/index.d.ts +1 -1
  93. package/dist/components/Modal/index.js +6 -6
  94. package/dist/components/Modal/index.js.map +1 -1
  95. package/dist/components/NumberIncrement/index.d.ts +1 -1
  96. package/dist/components/NumberIncrement/index.js +1 -3
  97. package/dist/components/NumberIncrement/index.js.map +1 -1
  98. package/dist/components/NumberIncrement/useNumberIncrement.d.ts +4 -4
  99. package/dist/components/NumberIncrement/useNumberIncrement.js +1 -2
  100. package/dist/components/NumberIncrement/useNumberIncrement.js.map +1 -1
  101. package/dist/components/Overlay/index.d.ts +1 -1
  102. package/dist/components/PaginationButtons/index.d.ts +1 -1
  103. package/dist/components/PaginationButtons/index.js +2 -2
  104. package/dist/components/PaginationButtons/index.js.map +1 -1
  105. package/dist/components/PaginationButtons/types.d.ts +1 -2
  106. package/dist/components/PaginationIndicator/index.d.ts +2 -3
  107. package/dist/components/PaginationIndicator/index.js +2 -2
  108. package/dist/components/PaginationIndicator/index.js.map +1 -1
  109. package/dist/components/PaginationIndicator/types.d.ts +3 -3
  110. package/dist/components/Progress/Bar/index.d.ts +1 -1
  111. package/dist/components/Progress/Bar/index.js +1 -1
  112. package/dist/components/Progress/Bar/index.js.map +1 -1
  113. package/dist/components/Progress/Bar/types.d.ts +2 -3
  114. package/dist/components/Progress/Circle/index.d.ts +1 -1
  115. package/dist/components/Progress/Circle/index.js +2 -2
  116. package/dist/components/Progress/Circle/index.js.map +1 -1
  117. package/dist/components/Progress/Circle/types.d.ts +1 -2
  118. package/dist/components/Progress/index.d.ts +0 -1
  119. package/dist/components/Progress/utils.js +1 -2
  120. package/dist/components/Progress/utils.js.map +1 -1
  121. package/dist/components/RadioInput/index.d.ts +1 -1
  122. package/dist/components/RadioInput/index.js +2 -2
  123. package/dist/components/RadioInput/index.js.map +1 -1
  124. package/dist/components/SearchInput/index.js.map +1 -1
  125. package/dist/components/SectionFilters/index.d.ts +1 -1
  126. package/dist/components/SectionFilters/index.js +4 -4
  127. package/dist/components/SectionFilters/index.js.map +1 -1
  128. package/dist/components/SectionFilters/types.d.ts +1 -2
  129. package/dist/components/SegmentedControl/index.d.ts +1 -1
  130. package/dist/components/SegmentedControl/index.js +12 -21
  131. package/dist/components/SegmentedControl/index.js.map +1 -1
  132. package/dist/components/SegmentedControl/types.d.ts +2 -2
  133. package/dist/components/Select/index.js +5 -5
  134. package/dist/components/Select/index.js.map +1 -1
  135. package/dist/components/Select/styles.js +1 -2
  136. package/dist/components/Select/styles.js.map +1 -1
  137. package/dist/components/Select/types.d.ts +6 -6
  138. package/dist/components/Slider/index.d.ts +1 -1
  139. package/dist/components/Slider/index.js +3 -3
  140. package/dist/components/Slider/index.js.map +1 -1
  141. package/dist/components/Switch/index.d.ts +1 -1
  142. package/dist/components/Switch/index.js +2 -2
  143. package/dist/components/Switch/index.js.map +1 -1
  144. package/dist/components/Tag/index.d.ts +1 -1
  145. package/dist/components/Tag/index.js +1 -1
  146. package/dist/components/Tag/index.js.map +1 -1
  147. package/dist/components/Text/index.d.ts +10 -2
  148. package/dist/components/Text/index.js +12 -20
  149. package/dist/components/Text/index.js.map +1 -1
  150. package/dist/components/Text/types.d.ts +3 -2
  151. package/dist/components/TextEditor/index.d.ts +1 -1
  152. package/dist/components/TextEditor/index.js +21 -9
  153. package/dist/components/TextEditor/index.js.map +1 -1
  154. package/dist/components/TextEditor/types.d.ts +4 -5
  155. package/dist/components/TextInput/index.d.ts +9 -3
  156. package/dist/components/TextInput/index.js +14 -30
  157. package/dist/components/TextInput/index.js.map +1 -1
  158. package/dist/components/TextInput/types.d.ts +4 -40
  159. package/dist/components/TextInput/useTextInput.d.ts +2 -6
  160. package/dist/components/TextInput/useTextInput.js +7 -16
  161. package/dist/components/TextInput/useTextInput.js.map +1 -1
  162. package/dist/components/Tooltip/index.d.ts +1 -1
  163. package/dist/components/Tooltip/index.js +1 -1
  164. package/dist/components/Tooltip/index.js.map +1 -1
  165. package/dist/components/Tooltip/types.d.ts +1 -1
  166. package/dist/components/Touchable/index.d.ts +10 -2
  167. package/dist/components/Touchable/index.js +9 -19
  168. package/dist/components/Touchable/index.js.map +1 -1
  169. package/dist/components/Touchable/types.d.ts +2 -1
  170. package/dist/components/View/index.d.ts +10 -2
  171. package/dist/components/View/index.js +7 -7
  172. package/dist/components/View/index.js.map +1 -1
  173. package/dist/components/View/types.d.ts +2 -2
  174. package/dist/components/VirtualList/context.d.ts +3 -0
  175. package/dist/components/VirtualList/context.js +93 -0
  176. package/dist/components/VirtualList/context.js.map +1 -0
  177. package/dist/components/VirtualList/index.d.ts +5 -0
  178. package/dist/components/VirtualList/index.js +14 -0
  179. package/dist/components/VirtualList/index.js.map +1 -0
  180. package/dist/components/VirtualList/list.d.ts +3 -0
  181. package/dist/components/VirtualList/list.js +102 -0
  182. package/dist/components/VirtualList/list.js.map +1 -0
  183. package/dist/components/VirtualList/types.d.ts +33 -0
  184. package/dist/components/{Pager/styles.js → VirtualList/types.js} +1 -1
  185. package/dist/components/VirtualList/types.js.map +1 -0
  186. package/dist/components/components.d.ts +4 -2
  187. package/dist/components/components.js +4 -2
  188. package/dist/components/components.js.map +1 -1
  189. package/dist/lib/ListMasonry.js +3 -3
  190. package/dist/lib/ListMasonry.js.map +1 -1
  191. package/dist/lib/WebStyleRegistry.js.map +1 -1
  192. package/dist/lib/hooks/index.d.ts +0 -1
  193. package/dist/lib/hooks/index.js +0 -1
  194. package/dist/lib/hooks/index.js.map +1 -1
  195. package/dist/lib/hooks/useAnimatedStyle.d.ts +8 -4
  196. package/dist/lib/hooks/useAnimatedStyle.js.map +1 -1
  197. package/dist/lib/hooks/useAnimatedVariantStyles.d.ts +3 -3
  198. package/dist/lib/hooks/useAnimatedVariantStyles.js +1 -2
  199. package/dist/lib/hooks/useAnimatedVariantStyles.js.map +1 -1
  200. package/dist/lib/hooks/useBreakpointMatch.js +1 -2
  201. package/dist/lib/hooks/useBreakpointMatch.js.map +1 -1
  202. package/dist/lib/hooks/useClick.js +1 -2
  203. package/dist/lib/hooks/useClick.js.map +1 -1
  204. package/dist/lib/hooks/useClickOutside.d.ts +1 -2
  205. package/dist/lib/hooks/useClickOutside.js +2 -3
  206. package/dist/lib/hooks/useClickOutside.js.map +1 -1
  207. package/dist/lib/hooks/useCropPicker.d.ts +1 -2
  208. package/dist/lib/hooks/useCropPicker.js +19 -7
  209. package/dist/lib/hooks/useCropPicker.js.map +1 -1
  210. package/dist/lib/hooks/useFileInput.d.ts +1 -2
  211. package/dist/lib/hooks/useKeydown.js +2 -2
  212. package/dist/lib/hooks/useKeydown.js.map +1 -1
  213. package/dist/lib/hooks/useMediaQuery.js +2 -3
  214. package/dist/lib/hooks/useMediaQuery.js.map +1 -1
  215. package/dist/lib/hooks/usePageExitBlocker.js.map +1 -1
  216. package/dist/lib/hooks/usePagination.js +1 -2
  217. package/dist/lib/hooks/usePagination.js.map +1 -1
  218. package/dist/lib/hooks/usePopState.js.map +1 -1
  219. package/dist/lib/hooks/useRefresh.d.ts +1 -1
  220. package/dist/lib/hooks/useRefresh.js.map +1 -1
  221. package/dist/lib/hooks/useScrollEffect.js +1 -2
  222. package/dist/lib/hooks/useScrollEffect.js.map +1 -1
  223. package/dist/lib/hooks/useSearchParams.d.ts +0 -1
  224. package/dist/lib/hooks/useSearchParams.js +1 -2
  225. package/dist/lib/hooks/useSearchParams.js.map +1 -1
  226. package/dist/lib/hooks/useStaticAnimationStyles.js +1 -2
  227. package/dist/lib/hooks/useStaticAnimationStyles.js.map +1 -1
  228. package/dist/lib/hooks/useWindowSize.js +1 -2
  229. package/dist/lib/hooks/useWindowSize.js.map +1 -1
  230. package/dist/lib/tools/localStorage.js.map +1 -1
  231. package/dist/lib/tools/mediaQuery.js +3 -4
  232. package/dist/lib/tools/mediaQuery.js.map +1 -1
  233. package/dist/lib/tools/modal.js +3 -3
  234. package/dist/lib/tools/modal.js.map +1 -1
  235. package/dist/lib/utils/pollyfils/scroll.js.map +1 -1
  236. package/dist/lib/utils/stopPropagation.js +1 -2
  237. package/dist/lib/utils/stopPropagation.js.map +1 -1
  238. package/dist/lib/utils/test.js.map +1 -1
  239. package/dist/types/utility.d.ts +2 -2
  240. package/package.json +39 -39
  241. package/package.json.bak +24 -24
  242. package/src/components/ActionIcon/index.tsx +1 -1
  243. package/src/components/ActivityIndicator/index.tsx +3 -4
  244. package/src/components/Badge/types.ts +1 -1
  245. package/src/components/Carousel/index.tsx +230 -0
  246. package/src/components/{Pager → Carousel}/styles.ts +2 -2
  247. package/src/components/Carousel/types.ts +41 -0
  248. package/src/components/Checkbox/index.tsx +1 -1
  249. package/src/components/Collapse/index.tsx +1 -1
  250. package/src/components/Collapse/types.ts +1 -1
  251. package/src/components/ColorPicker/types.ts +3 -3
  252. package/src/components/CropPicker/index.tsx +4 -3
  253. package/src/components/CropPicker/types.ts +3 -1
  254. package/src/components/DatePicker/components/OuterInput.tsx +3 -12
  255. package/src/components/DatePicker/index.tsx +18 -10
  256. package/src/components/DatePicker/types.ts +8 -5
  257. package/src/components/Dropzone/index.tsx +3 -2
  258. package/src/components/Dropzone/types.ts +3 -1
  259. package/src/components/EmptyPlaceholder/types.ts +2 -2
  260. package/src/components/FileInput/index.tsx +4 -3
  261. package/src/components/FileInput/types.ts +2 -0
  262. package/src/components/InputBase/useInputBase.ts +1 -1
  263. package/src/components/InputBase/utils.ts +1 -1
  264. package/src/components/List/index.tsx +56 -78
  265. package/src/components/List/styles.ts +2 -10
  266. package/src/components/List/types.ts +10 -52
  267. package/src/components/MaskedTextInput/index.tsx +58 -0
  268. package/src/components/MaskedTextInput/mask.ts +41 -0
  269. package/src/components/MaskedTextInput/types.ts +18 -0
  270. package/src/components/NumberIncrement/index.tsx +1 -3
  271. package/src/components/PaginationButtons/types.ts +1 -1
  272. package/src/components/PaginationIndicator/types.ts +2 -2
  273. package/src/components/Progress/Bar/types.ts +2 -2
  274. package/src/components/Progress/Circle/types.ts +1 -1
  275. package/src/components/SectionFilters/types.ts +1 -1
  276. package/src/components/SegmentedControl/index.tsx +6 -5
  277. package/src/components/SegmentedControl/types.ts +2 -2
  278. package/src/components/Select/index.tsx +3 -3
  279. package/src/components/Select/types.ts +6 -6
  280. package/src/components/Switch/index.tsx +1 -1
  281. package/src/components/Text/index.tsx +4 -3
  282. package/src/components/Text/types.ts +3 -2
  283. package/src/components/TextEditor/index.tsx +20 -18
  284. package/src/components/TextEditor/types.ts +5 -5
  285. package/src/components/TextInput/index.tsx +14 -34
  286. package/src/components/TextInput/types.ts +5 -57
  287. package/src/components/TextInput/useTextInput.ts +10 -19
  288. package/src/components/Tooltip/types.ts +1 -1
  289. package/src/components/Touchable/index.tsx +4 -4
  290. package/src/components/Touchable/types.ts +2 -1
  291. package/src/components/View/index.tsx +6 -5
  292. package/src/components/View/types.ts +3 -3
  293. package/src/components/VirtualList/context.tsx +93 -0
  294. package/src/components/VirtualList/index.tsx +11 -0
  295. package/src/components/VirtualList/list.tsx +85 -0
  296. package/src/components/VirtualList/types.ts +38 -0
  297. package/src/components/components.ts +4 -2
  298. package/src/lib/hooks/index.ts +0 -1
  299. package/src/lib/hooks/useAnimatedStyle.ts +11 -7
  300. package/src/lib/hooks/useAnimatedVariantStyles.ts +2 -2
  301. package/src/lib/hooks/useClickOutside.ts +1 -1
  302. package/src/lib/hooks/useMediaQuery.ts +1 -1
  303. package/src/types/utility.ts +2 -2
  304. package/dist/components/Grid/index.d.ts +0 -13
  305. package/dist/components/Grid/index.js +0 -94
  306. package/dist/components/Grid/index.js.map +0 -1
  307. package/dist/components/Grid/styles.d.ts +0 -2
  308. package/dist/components/Grid/styles.js.map +0 -1
  309. package/dist/components/Grid/types.d.ts +0 -9
  310. package/dist/components/List/ListLayout.d.ts +0 -2
  311. package/dist/components/List/ListLayout.js +0 -39
  312. package/dist/components/List/ListLayout.js.map +0 -1
  313. package/dist/components/Pager/index.d.ts +0 -7
  314. package/dist/components/Pager/index.js +0 -118
  315. package/dist/components/Pager/index.js.map +0 -1
  316. package/dist/components/Pager/styles.d.ts +0 -3
  317. package/dist/components/Pager/styles.js.map +0 -1
  318. package/dist/components/Pager/types.d.ts +0 -27
  319. package/dist/components/Pager/types.js.map +0 -1
  320. package/dist/components/TextInput/mask.d.ts +0 -5
  321. package/dist/components/TextInput/mask.js +0 -110
  322. package/dist/components/TextInput/mask.js.map +0 -1
  323. package/dist/lib/deprecated/OSAlert.d.ts +0 -38
  324. package/dist/lib/deprecated/OSAlert.js +0 -139
  325. package/dist/lib/deprecated/OSAlert.js.map +0 -1
  326. package/dist/lib/deprecated/index.d.ts +0 -1
  327. package/dist/lib/deprecated/index.js +0 -22
  328. package/dist/lib/deprecated/index.js.map +0 -1
  329. package/dist/lib/hooks/useInfiniteScroll.d.ts +0 -22
  330. package/dist/lib/hooks/useInfiniteScroll.js +0 -98
  331. package/dist/lib/hooks/useInfiniteScroll.js.map +0 -1
  332. package/src/components/Grid/index.tsx +0 -126
  333. package/src/components/Grid/styles.ts +0 -3
  334. package/src/components/Grid/types.ts +0 -13
  335. package/src/components/List/ListLayout.tsx +0 -87
  336. package/src/components/Pager/index.tsx +0 -156
  337. package/src/components/Pager/types.ts +0 -35
  338. package/src/components/TextInput/mask.tsx +0 -117
  339. package/src/lib/deprecated/OSAlert.tsx +0 -200
  340. package/src/lib/deprecated/index.ts +0 -6
  341. package/src/lib/hooks/useInfiniteScroll.ts +0 -77
  342. /package/dist/components/{Grid → Carousel}/styles.js +0 -0
  343. /package/dist/components/{Grid → Carousel}/types.js +0 -0
  344. /package/dist/components/{Pager → MaskedTextInput}/types.js +0 -0
@@ -1,103 +1,91 @@
1
- import React from 'react'
2
- import { View, ViewProps } from '../View'
1
+ import React, { useCallback, useMemo } from 'react'
2
+ import { View } from '../View'
3
3
  import { EmptyPlaceholder } from '../EmptyPlaceholder'
4
4
  import { ListItem, ListProps } from './types'
5
- import { ItemMasonryProps, ListMasonry, useInfiniteScroll, useMasonryReload } from '../../lib'
6
5
  import { useStylesFor } from '../../lib/hooks/useStylesFor'
7
6
  import { WebStyleRegistry } from '../../lib/WebStyleRegistry'
8
7
  import { AnyRecord, IJSX, StyledComponentProps } from '@codeleap/styles'
9
- import { ListLayout } from './ListLayout'
8
+ import { RenderComponentProps, useInfiniteLoader } from 'masonic'
9
+ import { TypeGuards } from '@codeleap/types'
10
+ import dynamic from 'next/dynamic'
10
11
 
11
12
  export * from './styles'
12
13
  export * from './types'
13
- export * from './ListLayout'
14
14
 
15
- const RenderSeparator = (props: { separatorStyles: ViewProps['style'] }) => {
16
- return <View style={props?.separatorStyles} />
17
- }
18
-
19
- export function List(props: ListProps) {
20
- const allProps = {
21
- ...List.defaultProps,
22
- ...props,
23
- } as ListProps
15
+ const Masonry = dynamic(
16
+ () => import('masonic').then(mod => mod.Masonry),
17
+ { ssr: false }
18
+ )
24
19
 
20
+ export function List<T extends ListItem>(props: ListProps<T>) {
25
21
  const {
26
- renderItem: RenderItem,
27
- rowItemsSpacing,
28
- ListSeparatorComponent,
22
+ renderItem: providedRenderItem,
23
+ ItemSeparatorComponent,
29
24
  data,
30
- overscan,
31
- separators,
32
- masonryProps,
33
- reloadTimeout,
34
- showFooter,
25
+ fetchNextPage,
35
26
  style,
36
- layoutWrapperProps,
37
- } = allProps
27
+ hasNextPage,
28
+ infiniteLoaderProps,
29
+ separators,
30
+ ListFooterComponent,
31
+ placeholder,
32
+ ...masonryProps
33
+ } = {
34
+ ...List.defaultProps,
35
+ ...props,
36
+ }
38
37
 
39
38
  const styles = useStylesFor(List.styleRegistryName, style)
40
39
 
41
- const { layoutProps, onLoadMore } = useInfiniteScroll(allProps)
42
-
43
- const { reloadingLayout, previousLength } = useMasonryReload({
44
- data,
45
- reloadTimeout,
46
- })
40
+ const maybeLoadMore = useInfiniteLoader(
41
+ async (args) => {
42
+ if (hasNextPage) fetchNextPage?.()
43
+ },
44
+ {
45
+ isItemLoaded: (index, items) => !!items?.[index],
46
+ ...infiniteLoaderProps,
47
+ },
48
+ )
47
49
 
48
- const separator = React.useMemo(() => {
49
- return separators ? <ListSeparatorComponent separatorStyles={styles.separator} /> : null
50
+ const separator = useMemo(() => {
51
+ if (!separators) return null
52
+ return ItemSeparatorComponent
50
53
  }, [])
51
54
 
52
- const renderItem = React.useCallback((_item: ItemMasonryProps<any>) => {
53
- if (!RenderItem) return null
54
-
55
- const listLength = data?.length || 0
56
-
57
- const isFirst = _item?.index === 0
58
- const isLast = _item?.index === listLength - 1
59
- const isOnly = isFirst && isLast
55
+ const renderItem = useCallback((itemMasonry: RenderComponentProps<T>) => {
56
+ if (!providedRenderItem) return null
60
57
 
61
- const _itemProps = {
62
- ..._item,
63
- isOnly,
64
- isLast,
65
- isFirst,
66
- item: _item?.data,
67
- }
58
+ const isFirst = itemMasonry?.index === 0
68
59
 
69
60
  return <>
70
61
  {isFirst ? null : separator}
71
- <RenderItem {..._itemProps} />
62
+ {providedRenderItem({ ...itemMasonry, item: itemMasonry?.data })}
72
63
  </>
73
- }, [RenderItem])
64
+ }, [providedRenderItem])
65
+
66
+ const isEmpty = useMemo(() => data?.length <= 0 || !data?.length, [data?.length])
74
67
 
75
68
  return (
76
- <ListLayout
77
- {...allProps}
78
- {...layoutProps}
79
- wrapperProps={layoutWrapperProps}
80
- styles={styles}
81
- showFooter={reloadingLayout ? false : showFooter}
82
- >
83
- <ListMasonry
84
- items={data}
85
- render={renderItem}
86
- itemKey={(item, _index) => (item?.id ?? _index)}
87
- rowGutter={rowItemsSpacing}
88
- onRender={onLoadMore}
89
- overscanBy={overscan}
69
+ <View style={styles.wrapper}>
70
+ {isEmpty ? <EmptyPlaceholder {...placeholder} /> : null}
71
+
72
+ <Masonry
90
73
  columnCount={1}
91
- previousItemsLength={previousLength}
92
- reloadingLayout={reloadingLayout}
74
+ overscanBy={7}
93
75
  {...masonryProps}
76
+ items={data}
77
+ css={styles.list as any}
78
+ render={renderItem}
79
+ onRender={maybeLoadMore}
94
80
  />
95
- </ListLayout>
81
+
82
+ {TypeGuards.isFunction(ListFooterComponent) ? <ListFooterComponent /> : ListFooterComponent}
83
+ </View>
96
84
  )
97
85
  }
98
86
 
99
87
  List.styleRegistryName = 'List'
100
- List.elements = ['wrapper', 'innerWrapper', 'separator', 'refreshControl', 'refreshControlIndicator']
88
+ List.elements = ['wrapper', 'separator']
101
89
  List.rootElement = 'wrapper'
102
90
 
103
91
  List.withVariantTypes = <S extends AnyRecord>(styles: S) => {
@@ -105,17 +93,7 @@ List.withVariantTypes = <S extends AnyRecord>(styles: S) => {
105
93
  }
106
94
 
107
95
  List.defaultProps = {
108
- ListEmptyComponent: EmptyPlaceholder,
109
- ListSeparatorComponent: RenderSeparator,
110
- refreshDebounce: 1500,
111
- refreshSize: 40,
112
- refreshThreshold: 0.1,
113
- refreshPosition: 16,
114
- refresh: true,
115
- rowItemsSpacing: 8,
116
- overscan: 2,
117
- reloadTimeout: 350,
118
- showFooter: true,
96
+ separators: true,
119
97
  } as Partial<ListProps>
120
98
 
121
99
  WebStyleRegistry.registerComponent(List)
@@ -1,11 +1,3 @@
1
+ export type ListParts = 'wrapper' | 'list'
1
2
 
2
- type ListStates = 'empty' | 'loading'
3
-
4
- export type ListParts =
5
- 'wrapper' |
6
- 'innerWrapper' |
7
- 'separator' |
8
- 'refreshControl' |
9
- 'refreshControlIndicator'
10
-
11
- export type ListComposition = `${ListParts}:${ListStates}` | ListParts
3
+ export type ListComposition = ListParts
@@ -1,29 +1,10 @@
1
- import { StylesOf } from '@codeleap/types'
2
1
  import { EmptyPlaceholderProps } from '../EmptyPlaceholder'
3
- import { ViewProps } from '../View'
4
- import { MotionProps } from 'framer-motion'
5
- import { ActivityIndicatorProps } from '../ActivityIndicator'
6
- import { ComponentCommonProps } from '../../types'
7
- import { ItemMasonryProps, ListMasonryProps, UseInfiniteScrollArgs, UseInfiniteScrollReturn } from '../../lib'
8
2
  import { ListComposition } from './styles'
9
3
  import { StyledProp } from '@codeleap/styles'
4
+ import { MasonryProps, RenderComponentProps, UseInfiniteLoaderOptions } from 'masonic'
10
5
 
11
- export type ListLayoutProps = Omit<ListProps, 'renderItem'> & UseInfiniteScrollReturn['layoutProps'] & {
12
- styles: StylesOf<ListComposition>
13
- children?: React.ReactNode
14
- showFooter?: boolean
15
- wrapperProps?: Partial<ViewProps>
16
- }
17
-
18
- export type ListRefreshControlComponent = Partial<ListLayoutProps> & {
19
- styles: StylesOf<ListComposition>
20
- }
21
-
22
- export type AugmentedRenderItemInfo<T> = ItemMasonryProps<T> & {
6
+ export type AugmentedRenderItemInfo<T> = RenderComponentProps<T> & {
23
7
  item: T
24
- isFirst: boolean
25
- isLast: boolean
26
- isOnly: boolean
27
8
  }
28
9
 
29
10
  export type ListItem = {
@@ -31,39 +12,16 @@ export type ListItem = {
31
12
  }
32
13
 
33
14
  export type ListProps<T extends ListItem = ListItem> =
34
- ComponentCommonProps &
35
- UseInfiniteScrollArgs &
15
+ Omit<MasonryProps<T>, 'items' | 'render' | 'onRender'> &
36
16
  {
37
17
  data: T[]
38
- isFetching?: boolean
39
- hasNextPage?: boolean
40
- separators?: boolean
41
- onRefresh?: () => void
18
+ style?: StyledProp<ListComposition>
42
19
  placeholder?: Omit<EmptyPlaceholderProps, 'debugName'>
43
- keyExtractor?: (item: T, index: number) => string
44
- renderItem: (data: AugmentedRenderItemInfo<T>) => React.ReactElement
45
- ListFooterComponent?: (props: ListLayoutProps) => React.ReactElement
46
- ListLoadingIndicatorComponent?: () => React.ReactElement
47
- ListRefreshControlComponent?: () => React.ReactElement
48
- ListEmptyComponent?: React.FC | ((props: EmptyPlaceholderProps) => React.ReactElement)
49
- ListSeparatorComponent?: React.FC | ((props: { separatorStyles: ViewProps['style'] }) => React.ReactElement)
50
- isLoading?: boolean
51
- isFetchingNextPage?: boolean
20
+ ItemSeparatorComponent?: React.ReactElement
52
21
  fetchNextPage?: () => void
53
- ListHeaderComponent?: () => React.ReactElement
54
- refreshDebounce?: number
55
- refreshSize?: number
56
- refreshThreshold?: number
57
- refreshPosition?: number
58
- refresh?: boolean
59
- refreshControlProps?: Partial<MotionProps>
60
- refreshControlIndicatorProps?: Partial<ActivityIndicatorProps>
61
- style?: StyledProp<ListComposition>
62
- ref?: React.MutableRefObject<undefined>
63
- rowItemsSpacing?: number
64
- overscan?: number
65
- masonryProps?: Partial<ListMasonryProps<T>>
66
- reloadTimeout?: number
67
- showFooter?: boolean
68
- layoutWrapperProps?: Partial<ViewProps>
22
+ renderItem: (data: AugmentedRenderItemInfo<T>) => React.ReactElement
23
+ ListFooterComponent?: React.ReactElement | (() => React.ReactElement)
24
+ infiniteLoaderProps?: UseInfiniteLoaderOptions<unknown>
25
+ hasNextPage?: boolean
26
+ separators?: boolean
69
27
  }
@@ -0,0 +1,58 @@
1
+ import { useIMask } from 'react-imask'
2
+ import { MaskedTextInputProps } from './types'
3
+ import { AnyRecord, IJSX, StyledComponentProps } from '@codeleap/styles'
4
+ import { TextInput } from '../TextInput'
5
+ import { maskPresets } from './mask'
6
+ import { useMemo, useCallback } from 'react'
7
+ import { TypeGuards } from '@codeleap/types'
8
+
9
+ export * from './types'
10
+
11
+ export const MaskedTextInput = (props: MaskedTextInputProps) => {
12
+ const {
13
+ maskType,
14
+ maskOptions: customMaskOptions,
15
+ onAccept,
16
+ onComplete,
17
+ unmask = false,
18
+ onValueChange,
19
+ value,
20
+ ...textInputProps
21
+ } = props
22
+
23
+ const maskOptions = useMemo(() => {
24
+ const preset = maskType ? maskPresets[maskType] : {}
25
+
26
+ return {
27
+ ...preset,
28
+ ...customMaskOptions,
29
+ unmask,
30
+ }
31
+ }, [maskType, customMaskOptions, unmask])
32
+
33
+ const handleAccept = useCallback((value: string, maskRef: any, e?: InputEvent) => {
34
+ onAccept?.(value, maskRef, e)
35
+ onValueChange?.(value)
36
+ }, [onAccept, onValueChange])
37
+
38
+ const { ref: maskRef } = useIMask(maskOptions as any, {
39
+ onAccept: handleAccept,
40
+ onComplete,
41
+ })
42
+
43
+ const placeholder = textInputProps?.placeholder ?? (TypeGuards.isString(maskOptions?.mask) ? maskOptions?.mask : undefined)
44
+
45
+ return (
46
+ <TextInput
47
+ {...textInputProps}
48
+ placeholder={placeholder}
49
+ ref={maskRef as any}
50
+ value={value}
51
+ onValueChange={onValueChange}
52
+ />
53
+ )
54
+ }
55
+
56
+ MaskedTextInput.withVariantTypes = <S extends AnyRecord>(styles: S) => {
57
+ return MaskedTextInput as (props: StyledComponentProps<MaskedTextInputProps, typeof styles>) => IJSX
58
+ }
@@ -0,0 +1,41 @@
1
+ import { MaskedTextInputMaskType } from './types'
2
+
3
+ type MaskPreset = {
4
+ mask?: string
5
+ lazy?: boolean
6
+ placeholderChar?: string
7
+ }
8
+
9
+ export const maskPresets: Record<MaskedTextInputMaskType | 'cel-phone-brl', MaskPreset> = {
10
+ 'credit-card': {
11
+ mask: '0000 0000 0000 0000',
12
+ lazy: false,
13
+ placeholderChar: '0',
14
+ },
15
+ 'cpf': {
16
+ mask: '000.000.000-00',
17
+ lazy: false,
18
+ placeholderChar: '0',
19
+ },
20
+ 'cnpj': {
21
+ mask: '00.000.000/0000-00',
22
+ lazy: false,
23
+ placeholderChar: '0',
24
+ },
25
+ 'zip-code': {
26
+ mask: '00000-000',
27
+ lazy: false,
28
+ placeholderChar: '0',
29
+ },
30
+ 'cel-phone': {
31
+ mask: '+000 000 000 000',
32
+ lazy: false,
33
+ placeholderChar: '0',
34
+ },
35
+ 'cel-phone-brl': {
36
+ mask: '(00) 00000-0000',
37
+ lazy: false,
38
+ placeholderChar: '0',
39
+ },
40
+ 'custom': {},
41
+ }
@@ -0,0 +1,18 @@
1
+ import { TextInputProps } from '../TextInput'
2
+ import { ReactMaskOpts } from 'react-imask'
3
+
4
+ export type MaskedTextInputMaskType =
5
+ | 'credit-card'
6
+ | 'cpf'
7
+ | 'cnpj'
8
+ | 'zip-code'
9
+ | 'cel-phone'
10
+ | 'custom'
11
+
12
+ export type MaskedTextInputProps = Omit<TextInputProps, 'multiline'> & {
13
+ maskType?: MaskedTextInputMaskType
14
+ maskOptions?: ReactMaskOpts
15
+ onAccept?: (value: string, maskRef?: any, e?: InputEvent) => void
16
+ onComplete?: (value: string, maskRef?: any, e?: InputEvent) => void
17
+ unmask?: boolean | 'typed'
18
+ }
@@ -69,7 +69,7 @@ export const NumberIncrement = (props: NumberIncrementProps) => {
69
69
  ? PatternFormat
70
70
  : NumericFormat
71
71
 
72
- const Input = TypeGuards.isFunction(formatter)
72
+ const Input: any = TypeGuards.isFunction(formatter)
73
73
  ? NumberFormatBase
74
74
  : InputFormat
75
75
 
@@ -111,9 +111,7 @@ export const NumberIncrement = (props: NumberIncrementProps) => {
111
111
  <Input
112
112
  displayType='input'
113
113
  css={[
114
- // @ts-ignore
115
114
  partialStyles?.input,
116
- // @ts-ignore
117
115
  {
118
116
  '&::placeholder': partialStyles?.placeholder,
119
117
  },
@@ -9,7 +9,7 @@ export type PaginationButtonsProps =
9
9
  {
10
10
  onFetchNextPage?: AnyFunction
11
11
  onFetchPreviousPage?: AnyFunction
12
- renderItem?: (item: string | number, index: number) => JSX.Element
12
+ renderItem?: (item: string | number, index: number) => React.ReactElement
13
13
  onPressItem?: (item: string | number) => void
14
14
  shouldAbbreviate?: boolean
15
15
  abbreviationSymbol?: string
@@ -9,9 +9,9 @@ export type PaginationIndicatorProps =
9
9
  ComponentCommonProps &
10
10
  {
11
11
  isFetching?: boolean
12
- noMoreItemsText: JSX.Element | string | number
12
+ noMoreItemsText: React.ReactElement | string | number
13
13
  hasMore?: boolean
14
- activityIndicator?: JSX.Element
14
+ activityIndicator?: React.ReactElement
15
15
  style?: StyledProp<PaginationIndicatorComposition>
16
16
  indicatorProps?: Partial<ActivityIndicatorProps>
17
17
  textProps?: Partial<TextProps<'p'>>
@@ -19,8 +19,8 @@ export type ProgressBarProps =
19
19
  rightIconProps?: Partial<IconProps>
20
20
  text?: string
21
21
  textProps?: Partial<TextProps>
22
- leftText?: TextProps['text'] | JSX.Element
22
+ leftText?: TextProps['text'] | React.ReactElement
23
23
  leftTextProps?: Partial<TextProps>
24
- rightText?: TextProps['text'] | JSX.Element
24
+ rightText?: TextProps['text'] | React.ReactElement
25
25
  rightTextProps?: Partial<TextProps>
26
26
  }
@@ -13,7 +13,7 @@ export type ProgressCircleProps =
13
13
  circleStyles?: Parameters<typeof buildStyles>[0]
14
14
  children?: React.ReactNode
15
15
  size?: number
16
- text?: string | JSX.Element
16
+ text?: string | React.ReactElement
17
17
  textProps?: Partial<TextProps>
18
18
  icon?: AppIcon
19
19
  iconProps?: Partial<IconProps>
@@ -52,7 +52,7 @@ export type SectionFiltersProps = {
52
52
  onSelectItem?: (item: onSelectItemProps) => void
53
53
  onClearItems?: ClearFunction
54
54
  onApplyItems?: ApplyFunction
55
- renderFooterComponent?: (props: SectionFilterFooterProps) => JSX.Element
55
+ renderFooterComponent?: (props: SectionFilterFooterProps) => React.ReactElement
56
56
  applyFilterButtonProps?: Omit<ButtonProps, 'debugName'>
57
57
  clearFilterButtonProps?: Omit<ButtonProps, 'debugName'>
58
58
  filterOnOptionPress?: boolean
@@ -4,7 +4,7 @@ import { TypeGuards } from '@codeleap/types'
4
4
  import { useRef } from '@codeleap/hooks'
5
5
 
6
6
  import { Text } from '../Text'
7
- import { motion, AnimationProps } from 'framer-motion'
7
+ import { motion, TargetAndTransition } from 'motion/react'
8
8
  import { useAnimatedVariantStyles } from '../../lib'
9
9
  import { SegmentedControlOptionProps, SegmentedControlProps } from './types'
10
10
  import { Touchable } from '../Touchable'
@@ -16,7 +16,7 @@ import { AnyRecord, IJSX, mergeStyles, StyledComponentProps } from '@codeleap/st
16
16
  export * from './styles'
17
17
  export * from './types'
18
18
 
19
- const Option = forwardRef<HTMLButtonElement, SegmentedControlOptionProps>((props, ref) => {
19
+ const Option = (props: SegmentedControlOptionProps) => {
20
20
  const {
21
21
  selected,
22
22
  onPress,
@@ -27,6 +27,7 @@ const Option = forwardRef<HTMLButtonElement, SegmentedControlOptionProps>((props
27
27
  largestWidth,
28
28
  textProps,
29
29
  disabled,
30
+ ref,
30
31
  ...touchableProps
31
32
  } = props
32
33
 
@@ -38,7 +39,7 @@ const Option = forwardRef<HTMLButtonElement, SegmentedControlOptionProps>((props
38
39
 
39
40
  return (
40
41
  <Touchable
41
- key={touchableProps.key}
42
+ key={touchableProps.key as any}
42
43
  ref={ref as unknown as React.Ref<HTMLButtonElement>}
43
44
  onPress={onPress}
44
45
  disabled={disabled}
@@ -70,7 +71,7 @@ const Option = forwardRef<HTMLButtonElement, SegmentedControlOptionProps>((props
70
71
  />
71
72
  </Touchable>
72
73
  )
73
- })
74
+ }
74
75
 
75
76
  export const SegmentedControl = (props: SegmentedControlProps) => {
76
77
  const {
@@ -122,7 +123,7 @@ export const SegmentedControl = (props: SegmentedControlProps) => {
122
123
  duration: transitionDuration,
123
124
  },
124
125
  ...animationProps,
125
- } as AnimationProps
126
+ } as TargetAndTransition
126
127
  },
127
128
  dependencies: [currentOptionIdx, largestWidth.width],
128
129
  })
@@ -3,7 +3,7 @@ import { StylesOf } from '@codeleap/types'
3
3
  import { TextProps } from '../Text'
4
4
  import { TouchableProps } from '../Touchable'
5
5
  import { SegmentedControlComposition } from './styles'
6
- import { MotionProps, AnimationProps, ForwardRefComponent } from 'framer-motion'
6
+ import { MotionProps, TargetAndTransition, ForwardRefComponent } from 'motion/react'
7
7
  import { IconProps } from '../Icon'
8
8
  import { AppIcon, StyledProp } from '@codeleap/styles'
9
9
 
@@ -17,7 +17,7 @@ export type SegmentedControlProps<T = string> = {
17
17
  touchableProps?: Partial<TouchableProps>
18
18
  debugName?: string
19
19
  disabled?: boolean
20
- animationProps?: AnimationProps
20
+ animationProps?: TargetAndTransition
21
21
  transitionDuration?: number
22
22
  RenderAnimatedView?: ForwardRefComponent<HTMLDivElement, any>
23
23
  textProps?: TextProps
@@ -18,7 +18,7 @@ import { useValidate } from '@codeleap/form'
18
18
  export * from './styles'
19
19
  export * from './types'
20
20
 
21
- const DefaultOption = (props: TCustomOption & { component: (props: TCustomOption) => JSX.Element }) => {
21
+ const DefaultOption = (props: TCustomOption & { component: (props: TCustomOption) => React.ReactElement }) => {
22
22
  const {
23
23
  isSelected,
24
24
  optionsStyles,
@@ -59,7 +59,7 @@ const DefaultOption = (props: TCustomOption & { component: (props: TCustomOption
59
59
  )
60
60
  }
61
61
 
62
- const CustomMenu = (props: MenuProps & { Footer: () => JSX.Element }) => {
62
+ const CustomMenu = (props: MenuProps & { Footer: () => React.ReactElement }) => {
63
63
  const { Footer, children } = props
64
64
  return <React.Fragment>
65
65
  <components.Menu {...props}>
@@ -89,7 +89,7 @@ const DefaultPlaceholder = (props: PlaceholderProps) => {
89
89
  if (TypeGuards.isString(TextPlaceholder)) {
90
90
  return <Text debugName={debugName} text={TextPlaceholder} style={defaultStyles.text} />
91
91
  } else if (React.isValidElement(TextPlaceholder)) {
92
- return TextPlaceholder as JSX.Element
92
+ return TextPlaceholder as React.ReactElement
93
93
  } else if (TypeGuards.isFunction(TextPlaceholder)) {
94
94
  return <TextPlaceholder {...props} />
95
95
  }
@@ -49,7 +49,7 @@ export type TCustomOption = OptionProps & ComponentPartProps & ComponentCommonPr
49
49
  styles?: OptionState['baseStyles']
50
50
  }
51
51
 
52
- type SelectPlaceholderElement = string | ((props: PlaceholderProps) => JSX.Element) | JSX.Element
52
+ type SelectPlaceholderElement = string | ((props: PlaceholderProps) => React.ReactElement) | React.ReactElement
53
53
 
54
54
  export type PlaceholderProps = NoticeProps & ComponentPartProps & {
55
55
  text: SelectPlaceholderElement
@@ -74,11 +74,11 @@ export type SelectProps<T = any, Multi extends boolean = false> = React.PropsWit
74
74
  closeOnSelect?: boolean
75
75
  focused?: boolean
76
76
  _error?: string
77
- renderItem?: (props: TCustomOption) => JSX.Element
78
- FooterComponent?: () => JSX.Element
79
- PlaceholderComponent?: (props: PlaceholderProps) => JSX.Element
80
- PlaceholderNoItemsComponent?: (props: PlaceholderProps) => JSX.Element
81
- LoadingIndicatorComponent?: (props: LoadingIndicatorProps) => JSX.Element
77
+ renderItem?: (props: TCustomOption) => React.ReactElement
78
+ FooterComponent?: () => React.ReactElement
79
+ PlaceholderComponent?: (props: PlaceholderProps) => React.ReactElement
80
+ PlaceholderNoItemsComponent?: (props: PlaceholderProps) => React.ReactElement
81
+ LoadingIndicatorComponent?: (props: LoadingIndicatorProps) => React.ReactElement
82
82
  noItemsText?: SelectPlaceholderElement
83
83
  noItemsIcon?: SelectPlaceholderElement
84
84
  noItemsImage?: PlaceholderProps['image']
@@ -2,7 +2,7 @@ import React from 'react'
2
2
  import { InputBase, InputBaseDefaultOrder, selectInputBaseProps } from '../InputBase'
3
3
  import { useAnimatedVariantStyles } from '../../lib'
4
4
  import { WebStyleRegistry } from '../../lib/WebStyleRegistry'
5
- import { motion } from 'framer-motion'
5
+ import { motion } from 'motion/react'
6
6
  import { AnyRecord, IJSX, mergeStyles, StyledComponentProps } from '@codeleap/styles'
7
7
  import { useStylesFor } from '../../lib/hooks/useStylesFor'
8
8
  import { SwitchProps } from './types'
@@ -1,5 +1,5 @@
1
1
  import { TypeGuards } from '@codeleap/types'
2
- import { motion } from 'framer-motion'
2
+ import { motion } from 'motion/react'
3
3
  import React, { ElementType, forwardRef } from 'react'
4
4
  import { TextProps } from './types'
5
5
  import { useStylesFor } from '../../lib/hooks/useStylesFor'
@@ -9,7 +9,7 @@ import { AnyRecord, IJSX, StyledComponentProps, StyledComponentWithProps } from
9
9
  export * from './styles'
10
10
  export * from './types'
11
11
 
12
- export const Text = forwardRef<HTMLParagraphElement, TextProps>((textProps, ref) => {
12
+ export const Text = (textProps: TextProps) => {
13
13
  const {
14
14
  style,
15
15
  text,
@@ -22,6 +22,7 @@ export const Text = forwardRef<HTMLParagraphElement, TextProps>((textProps, ref)
22
22
  onClick,
23
23
  animated,
24
24
  animatedProps,
25
+ ref,
25
26
  ...props
26
27
  } = {
27
28
  ...Text.defaultProps,
@@ -76,7 +77,7 @@ export const Text = forwardRef<HTMLParagraphElement, TextProps>((textProps, ref)
76
77
  {text || children}
77
78
  </Component>
78
79
  )
79
- }) as StyledComponentWithProps<TextProps>
80
+ }
80
81
 
81
82
  Text.styleRegistryName = 'Text'
82
83
  Text.elements = ['text']
@@ -1,7 +1,7 @@
1
- import { ComponentPropsWithoutRef, ElementType } from 'react'
1
+ import { ComponentPropsWithoutRef, ElementType, RefObject } from 'react'
2
2
  import { TextComposition } from './styles'
3
3
  import { AnyRecord, StyledProp } from '@codeleap/styles'
4
- import { MotionProps } from 'framer-motion'
4
+ import { MotionProps } from 'motion/react'
5
5
 
6
6
  export type TextProps<T extends ElementType = 'p'> =
7
7
  Omit<ComponentPropsWithoutRef<T>, 'style'> &
@@ -15,4 +15,5 @@ export type TextProps<T extends ElementType = 'p'> =
15
15
  onPress?: (event: React.MouseEventHandler<T>) => void
16
16
  animated?: boolean
17
17
  animatedProps?: Partial<MotionProps>
18
+ ref?: RefObject<HTMLParagraphElement | null>
18
19
  }