@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,6 +1,6 @@
1
1
  import React from 'react'
2
2
  import { onUpdate, useCallback } from '@codeleap/hooks'
3
- import { BubbleMenu, FloatingMenu, EditorContent } from '@tiptap/react'
3
+ // import { BubbleMenu, FloatingMenu, EditorContent } from '@tiptap/react'
4
4
  import { FileInput, Text, View } from '../components'
5
5
  import { TextEditorProps } from './types'
6
6
  import { useStylesFor } from '../../lib/hooks/useStylesFor'
@@ -49,25 +49,27 @@ export const TextEditor = (props: TextEditorProps) => {
49
49
  }, [editor, handleBlur, handleFocus])
50
50
 
51
51
  const _BubbleMenu = useCallback(() => {
52
- return (
53
- // @ts-expect-error icss type
54
- <BubbleMenu css={[styles.bubbleMenu]} {...bubbleMenuProps} editor={editor}>
55
- <View style={styles.bubbleMenuInnerWrapper}>
56
- {bubbleMenuProps?.renderContent}
57
- </View>
58
- </BubbleMenu>
59
- )
52
+ return null
53
+ // return (
54
+ // // @ts-expect-error icss type
55
+ // <BubbleMenu css={[styles.bubbleMenu]} {...bubbleMenuProps} editor={editor}>
56
+ // <View style={styles.bubbleMenuInnerWrapper}>
57
+ // {bubbleMenuProps?.renderContent}
58
+ // </View>
59
+ // </BubbleMenu>
60
+ // )
60
61
  }, [editor])
61
62
 
62
63
  const _FloatingMenu = useCallback(() => {
63
- return (
64
- // @ts-expect-error icss type
65
- <FloatingMenu css={[styles.floatingMenu]} {...floatingMenuProps} editor={editor}>
66
- <View style={styles.floatingMenuInnerWrapper}>
67
- {floatingMenuProps?.renderContent}
68
- </View>
69
- </FloatingMenu>
70
- )
64
+ return null
65
+ // return (
66
+ // // @ts-expect-error icss type
67
+ // <FloatingMenu css={[styles.floatingMenu]} {...floatingMenuProps} editor={editor}>
68
+ // <View style={styles.floatingMenuInnerWrapper}>
69
+ // {floatingMenuProps?.renderContent}
70
+ // </View>
71
+ // </FloatingMenu>
72
+ // )
71
73
  }, [editor])
72
74
 
73
75
  const editorStyles = [
@@ -92,7 +94,7 @@ export const TextEditor = (props: TextEditorProps) => {
92
94
  {children}
93
95
  <_BubbleMenu />
94
96
  <_FloatingMenu />
95
- <EditorContent editor={editor} />
97
+ {/* <EditorContent editor={editor} /> */}
96
98
  {validation?.showError ? <Text text={validation?.message as string} style={styles['errorMessage:error']} /> : null}
97
99
  <FileInput ref={fileInputRef} />
98
100
  </View>
@@ -1,22 +1,22 @@
1
1
  import { RefObject } from 'react'
2
2
  import { AnyFunction } from '@codeleap/types'
3
3
  import { StyledProp } from '@codeleap/styles'
4
- import { BubbleMenuProps, Editor, FloatingMenuProps } from '@tiptap/react'
4
+ // import { BubbleMenuProps, Editor, FloatingMenuProps } from '@tiptap/react'
5
5
  import { FileInputRef } from '../FileInput'
6
6
  import { TextEditorComposition } from './styles'
7
7
  import { Validator } from '@codeleap/form'
8
8
 
9
9
  export type TextEditorProps = React.PropsWithChildren<{
10
- editor: Editor & {
10
+ editor: any & {
11
11
  getText: AnyFunction
12
12
  isEditable: boolean
13
13
  on: AnyFunction
14
14
  off: AnyFunction
15
15
  }
16
16
  style?: StyledProp<TextEditorComposition>
17
- bubbleMenuProps?: BubbleMenuProps & { renderContent: React.ReactNode }
18
- floatingMenuProps?: FloatingMenuProps & { renderContent: React.ReactNode }
19
- toolbarComponent?: JSX.Element
17
+ bubbleMenuProps?: any & { renderContent: React.ReactNode }
18
+ floatingMenuProps?: any & { renderContent: React.ReactNode }
19
+ toolbarComponent?: React.ReactElement
20
20
  fileInputRef?: RefObject<FileInputRef>
21
21
  validate?: Validator<string, any, any>
22
22
  }>
@@ -1,12 +1,11 @@
1
1
  import { TypeGuards } from '@codeleap/types'
2
- import React, { forwardRef, useImperativeHandle } from 'react'
3
- import TextareaAutosize from 'react-autosize-textarea'
4
- import InputMask from 'react-input-mask'
2
+ import React, { useImperativeHandle } from 'react'
3
+ import TextareaAutosize from 'react-textarea-autosize'
5
4
  import { Touchable } from '../Touchable'
6
5
  import { InputBase, selectInputBaseProps } from '../InputBase'
7
6
  import { getTestId } from '../../lib/utils/test'
8
- import { InputRef, TextInputProps } from './types'
9
- import { AnyRecord, AppIcon, IJSX, StyledComponentProps, StyledComponentWithProps } from '@codeleap/styles'
7
+ import { TextInputProps } from './types'
8
+ import { AnyRecord, AppIcon, IJSX, StyledComponentProps } from '@codeleap/styles'
10
9
  import { useStylesFor } from '../../lib/hooks/useStylesFor'
11
10
  import { WebStyleRegistry } from '../../lib/WebStyleRegistry'
12
11
  import { useTextInput } from './useTextInput'
@@ -14,9 +13,8 @@ import { useInputBasePartialStyles } from '../InputBase/useInputBasePartialStyle
14
13
 
15
14
  export * from './types'
16
15
  export * from './styles'
17
- export * from './mask'
18
16
 
19
- export const TextInput = forwardRef<InputRef, TextInputProps>((props, inputRef) => {
17
+ export const TextInput = (props: TextInputProps) => {
20
18
  const allProps = {
21
19
  ...TextInput.defaultProps,
22
20
  ...props,
@@ -37,6 +35,7 @@ export const TextInput = forwardRef<InputRef, TextInputProps>((props, inputRef)
37
35
  visibleIcon,
38
36
  hiddenIcon,
39
37
  focused,
38
+ ref: inputRef,
40
39
  ...textInputProps
41
40
  } = others as TextInputProps
42
41
 
@@ -44,13 +43,11 @@ export const TextInput = forwardRef<InputRef, TextInputProps>((props, inputRef)
44
43
 
45
44
  const {
46
45
  isMultiline,
47
- isMasked,
48
46
  isFocused: isInputFocused,
49
47
  secureTextEntry,
50
48
  handleBlur,
51
49
  handleFocus,
52
50
  handleChange,
53
- maskProps,
54
51
  innerInputRef,
55
52
  wrapperRef,
56
53
  errorMessage,
@@ -70,28 +67,13 @@ export const TextInput = forwardRef<InputRef, TextInputProps>((props, inputRef)
70
67
  focus: isFocused,
71
68
  })
72
69
 
73
- const InputElement = isMasked ? InputMask : isMultiline ? TextareaAutosize : 'input'
70
+ const InputElement: any = isMultiline ? TextareaAutosize : 'input'
74
71
 
75
72
  const isPressable = TypeGuards.isFunction(onPress)
76
73
 
77
- const focus = () => {
78
- if (isMasked) {
79
- // @ts-expect-error
80
- innerInputRef.current?.getInputDOMNode()?.focus()
81
- }
82
-
83
- innerInputRef.current?.focus?.()
84
- }
85
-
86
74
  useImperativeHandle(inputRef, () => {
87
- return {
88
- focus: () => focus(),
89
- isTextInput: true,
90
- getInputRef: () => {
91
- return innerInputRef.current as unknown as HTMLInputElement
92
- },
93
- }
94
- }, [!!innerInputRef?.current?.focus])
75
+ return innerInputRef?.current
76
+ }, [])
95
77
 
96
78
  const visibilityToggleProps = visibilityToggle ? {
97
79
  onPress: toggleSecureTextEntry,
@@ -149,8 +131,8 @@ export const TextInput = forwardRef<InputRef, TextInputProps>((props, inputRef)
149
131
  {...buttonModeProps}
150
132
  {...secureTextProps}
151
133
  {...textInputProps}
152
- onBlur={handleBlur}
153
- onFocus={handleFocus}
134
+ onBlur={handleBlur as any}
135
+ onFocus={handleFocus as any}
154
136
  css={[
155
137
  styles.input,
156
138
  isMultiline && styles['input:multiline'],
@@ -171,17 +153,16 @@ export const TextInput = forwardRef<InputRef, TextInputProps>((props, inputRef)
171
153
  caretColorStyle,
172
154
  ],
173
155
  },
174
- ]}
175
- {...maskProps}
176
- value={inputValue}
156
+ ] as any}
177
157
  onChange={handleChange}
178
158
  ref={innerInputRef}
159
+ value={inputValue}
179
160
  data-testid={testId}
180
161
  />
181
162
  </InputBase>
182
163
  )
183
164
 
184
- }) as StyledComponentWithProps<TextInputProps>
165
+ }
185
166
 
186
167
  TextInput.styleRegistryName = 'TextInput'
187
168
  TextInput.elements = [...InputBase.elements, 'input', 'placeholder', 'selection']
@@ -194,7 +175,6 @@ TextInput.withVariantTypes = <S extends AnyRecord>(styles: S) => {
194
175
  TextInput.defaultProps = {
195
176
  hiddenIcon: 'input-visiblity:hidden' as AppIcon,
196
177
  visibleIcon: 'input-visiblity:visible' as AppIcon,
197
- masking: null,
198
178
  } as TextInputProps
199
179
 
200
180
  WebStyleRegistry.registerComponent(TextInput)
@@ -4,10 +4,12 @@ import { InputBaseProps } from '../InputBase'
4
4
  import { HTMLProps } from '../../types'
5
5
  import { TextInputComposition } from './styles'
6
6
  import { Field } from '@codeleap/form'
7
- import { AnyFunction } from '@codeleap/types'
7
+ import { RefObject } from 'react'
8
8
 
9
9
  type NativeTextInputProps = HTMLProps<'input'>
10
10
 
11
+ export type InputRef = HTMLInputElement
12
+
11
13
  export type TextInputProps =
12
14
  Omit<InputBaseProps, 'style' | 'ref'> &
13
15
  Omit<NativeTextInputProps, 'value' | 'crossOrigin' | 'ref' | 'style'> &
@@ -22,65 +24,11 @@ export type TextInputProps =
22
24
  focused?: boolean
23
25
  forceError?: string
24
26
  rows?: number
25
- masking?: TextInputMaskingProps
26
27
  visibleIcon?: AppIcon
27
28
  hiddenIcon?: AppIcon
28
29
  field?: Field<string, any, any>
29
30
  value?: string
30
31
  onValueChange?: (value: string) => void
32
+ onChangeText?: NativeTextInputProps['onChange']
33
+ ref?: RefObject<InputRef | null>
31
34
  }
32
-
33
- export type InputRef = {
34
- isTextInput?: boolean
35
- focus: () => void
36
- getInputRef: () => HTMLInputElement
37
- }
38
-
39
- type beforeMaskedValueChangeArgs = {
40
- state: {
41
- value: string | undefined
42
- selection: {
43
- start: number
44
- end: number
45
- length?: number
46
- }
47
- }
48
- userInput: null | string
49
- }
50
-
51
- export type FormatChar = `[${string}]`
52
-
53
- export type MaskProps = {
54
- obfuscated?: boolean
55
- mask?: string
56
- placeholder?: string
57
- maskChar?: string
58
- formatChars?: Record<string, FormatChar>
59
- alwaysShowMask?: boolean
60
- validator?: AnyFunction
61
- maskType?: 'BRL' | 'INTERNATIONAL'
62
- getRawValue?: (value: any) => string
63
- }
64
-
65
- export type TextInputMaskTypeProp =
66
- | 'credit-card'
67
- | 'cpf'
68
- | 'cnpj'
69
- | 'zip-code'
70
- | 'cel-phone'
71
- | 'custom'
72
-
73
- export interface TextInputMaskingProps {
74
- type: TextInputMaskTypeProp
75
- options?: MaskProps
76
- onChangeMask?: (
77
- newState: beforeMaskedValueChangeArgs['state'],
78
- oldState: beforeMaskedValueChangeArgs['state'],
79
- userInput: beforeMaskedValueChangeArgs['userInput']
80
- ) => beforeMaskedValueChangeArgs['state']
81
- saveFormatted?: boolean
82
- }
83
-
84
- export type InputMaskProps = {
85
- masking: TextInputMaskingProps
86
- }
@@ -1,7 +1,6 @@
1
- import React, { useCallback, useState, useMemo } from 'react'
1
+ import React, { useCallback, useState } from 'react'
2
2
  import { TextInputProps } from './types'
3
3
  import { TypeGuards } from '@codeleap/types'
4
- import { getMaskInputProps } from './mask'
5
4
  import { useInputBase } from '../InputBase/useInputBase'
6
5
  import { fields } from '@codeleap/form'
7
6
 
@@ -10,11 +9,11 @@ export function useTextInput(props: Partial<TextInputProps>) {
10
9
  onFocus,
11
10
  onBlur,
12
11
  field,
13
- masking,
14
12
  multiline: isMultiline,
15
13
  forceError,
16
14
  value,
17
15
  onValueChange,
16
+ onChangeText,
18
17
  rows: providedRows,
19
18
  } = props
20
19
 
@@ -24,12 +23,6 @@ export function useTextInput(props: Partial<TextInputProps>) {
24
23
 
25
24
  const toggleSecureTextEntry = () => setSecureTextEntry(s => !s)
26
25
 
27
- const isMasked = !TypeGuards.isNil(masking)
28
-
29
- const maskProps = useMemo(() => {
30
- return isMasked ? getMaskInputProps({ masking }) : null
31
- }, [masking])
32
-
33
26
  const {
34
27
  fieldHandle,
35
28
  validation,
@@ -37,7 +30,11 @@ export function useTextInput(props: Partial<TextInputProps>) {
37
30
  wrapperRef,
38
31
  onInputValueChange,
39
32
  inputValue,
40
- } = useInputBase<string>(field, fields.text, { value, onValueChange }, {
33
+ } = useInputBase<string>(
34
+ field,
35
+ fields.text,
36
+ { value, onValueChange: onValueChange ?? onChangeText as any },
37
+ {
41
38
  revealValue() {
42
39
  setSecureTextEntry(false)
43
40
  },
@@ -61,14 +58,10 @@ export function useTextInput(props: Partial<TextInputProps>) {
61
58
  }, [onFocus])
62
59
 
63
60
  const handleChange = useCallback((event: React.ChangeEvent<HTMLInputElement>) => {
61
+ if (TypeGuards.isFunction(onChangeText)) return onChangeText(event)
64
62
  const inputValue = event?.target?.value
65
-
66
- const value = isMasked && maskProps?.notSaveFormatted
67
- ? maskProps?.getRawValue(inputValue)
68
- : inputValue
69
-
70
- onInputValueChange(value)
71
- }, [onInputValueChange])
63
+ onInputValueChange(inputValue)
64
+ }, [onInputValueChange, onChangeText])
72
65
 
73
66
  const rows = providedRows ?? (isMultiline ? 2 : undefined)
74
67
 
@@ -79,9 +72,7 @@ export function useTextInput(props: Partial<TextInputProps>) {
79
72
  const errorMessage = validation?.message || forceError
80
73
 
81
74
  return {
82
- maskProps,
83
75
  isMultiline,
84
- isMasked,
85
76
  isFocused,
86
77
  secureTextEntry,
87
78
  handleBlur,
@@ -26,7 +26,7 @@ export type TooltipProps =
26
26
  {
27
27
  toggle?: AnyFunction
28
28
  visible?: boolean
29
- content: React.ReactNode | ((props: TooltipProps & { variantsStyles: StylesOf<TooltipComposition> }) => JSX.Element)
29
+ content: React.ReactNode | ((props: TooltipProps & { variantsStyles: StylesOf<TooltipComposition> }) => React.ReactElement)
30
30
  triggerWrapper?: React.ElementType
31
31
  triggerWrapperProps?: Partial<ViewProps>
32
32
  style?: StyledProp<TooltipComposition>
@@ -12,7 +12,7 @@ import { logger } from '@codeleap/logger'
12
12
  export * from './styles'
13
13
  export * from './types'
14
14
 
15
- export const Touchable = forwardRef<HTMLButtonElement, TouchableProps>((touchableProps: TouchableProps, ref) => {
15
+ export const Touchable = (touchableProps: TouchableProps) => {
16
16
  const allProps = {
17
17
  ...Touchable.defaultProps,
18
18
  ...touchableProps,
@@ -33,6 +33,7 @@ export const Touchable = forwardRef<HTMLButtonElement, TouchableProps>((touchabl
33
33
  analyticsEnabled,
34
34
  analyticsName,
35
35
  analyticsData,
36
+ ref,
36
37
  ...props
37
38
  } = allProps
38
39
 
@@ -48,7 +49,7 @@ export const Touchable = forwardRef<HTMLButtonElement, TouchableProps>((touchabl
48
49
  }
49
50
  })
50
51
 
51
- const Component = component as unknown as ComponentType<HTMLAttributes<HTMLButtonElement>>
52
+ const Component: any = component as unknown as ComponentType<HTMLAttributes<HTMLButtonElement>>
52
53
 
53
54
  const notPressable = !TypeGuards.isFunction(onPress) && !TypeGuards.isFunction(onClick)
54
55
 
@@ -102,12 +103,11 @@ export const Touchable = forwardRef<HTMLButtonElement, TouchableProps>((touchabl
102
103
  onClick={handleClick}
103
104
  onKeyDown={handleClick}
104
105
  ref={ref}
105
- // @ts-expect-error icss type
106
106
  css={[styles.wrapper, disabled && styles['wrapper:disabled']]}
107
107
  data-testid={testId}
108
108
  />
109
109
  )
110
- }) as StyledComponentWithProps<TouchableProps>
110
+ }
111
111
 
112
112
  Touchable.styleRegistryName = 'Touchable'
113
113
  Touchable.elements = ['wrapper']
@@ -1,5 +1,5 @@
1
1
  import { AnyFunction } from '@codeleap/types'
2
- import { ComponentPropsWithRef, ElementType } from 'react'
2
+ import { ComponentPropsWithRef, ElementType, ReactNode } from 'react'
3
3
  import { TouchableComposition } from './styles'
4
4
  import { AnyRecord, StyledProp } from '@codeleap/styles'
5
5
 
@@ -19,4 +19,5 @@ export type TouchableProps<T extends ElementType = 'button'> =
19
19
  analyticsEnabled?: boolean
20
20
  analyticsName?: string
21
21
  analyticsData?: Record<string, any>
22
+ children?: ReactNode
22
23
  }
@@ -1,6 +1,6 @@
1
1
  import { TypeGuards } from '@codeleap/types'
2
- import React, { ElementType, forwardRef } from 'react'
3
- import { motion } from 'framer-motion'
2
+ import React, { ElementType } from 'react'
3
+ import { motion } from 'motion/react'
4
4
  import { ViewProps } from './types'
5
5
  import { getTestId } from '../../lib/utils/test'
6
6
  import { useStylesFor } from '../../lib/hooks/useStylesFor'
@@ -10,7 +10,7 @@ import { AnyRecord, IJSX, StyledComponentProps, StyledComponentWithProps } from
10
10
  export * from './styles'
11
11
  export * from './types'
12
12
 
13
- export const View = forwardRef<HTMLDivElement, ViewProps>((viewProps, ref) => {
13
+ export const View = (viewProps: ViewProps) => {
14
14
  const {
15
15
  component,
16
16
  children,
@@ -23,6 +23,7 @@ export const View = forwardRef<HTMLDivElement, ViewProps>((viewProps, ref) => {
23
23
  style,
24
24
  animated,
25
25
  animatedProps,
26
+ ref,
26
27
  ...props
27
28
  } = {
28
29
  ...View.defaultProps,
@@ -31,7 +32,7 @@ export const View = forwardRef<HTMLDivElement, ViewProps>((viewProps, ref) => {
31
32
 
32
33
  const styles = useStylesFor(View.styleRegistryName, style)
33
34
 
34
- const Component: ElementType = animated ? (motion?.[component as string] || motion.div) : (component || 'div')
35
+ const Component: any = animated ? (motion?.[component as string] || motion.div) : (component || 'div')
35
36
 
36
37
  function handleHover(isMouseOverElement: boolean) {
37
38
  onHover?.(isMouseOverElement)
@@ -56,7 +57,7 @@ export const View = forwardRef<HTMLDivElement, ViewProps>((viewProps, ref) => {
56
57
  {children}
57
58
  </Component>
58
59
  )
59
- }) as StyledComponentWithProps<ViewProps>
60
+ }
60
61
 
61
62
  View.styleRegistryName = 'View'
62
63
  View.elements = ['wrapper']
@@ -1,11 +1,11 @@
1
- import { AnimationProps, MotionProps } from 'framer-motion'
1
+ import { TargetAndTransition, MotionProps } from 'motion/react'
2
2
  import { AnyRecord, StyledProp } from '@codeleap/styles'
3
3
  import { ViewComposition } from './styles'
4
4
  import { ComponentPropsWithRef, ElementType } from 'react'
5
5
 
6
6
  export type ViewProps<T extends ElementType = 'div'> =
7
- Omit<ComponentPropsWithRef<T>, 'style'> &
8
- Omit<AnimationProps, 'style'> &
7
+ Omit<ComponentPropsWithRef<T>, 'style' | 'children'> &
8
+ Omit<TargetAndTransition, 'style' | 'children'> &
9
9
  {
10
10
  component?: ElementType<AnyRecord>
11
11
  debugName?: string
@@ -0,0 +1,93 @@
1
+ import { useVirtualizer } from '@tanstack/react-virtual'
2
+ import { useRef, useCallback, use, createContext } from 'react'
3
+ import { VirtualListProps, VirtualListContextValue } from './types'
4
+
5
+ const VirtualListContext = createContext<VirtualListContextValue<any> | null>(null)
6
+
7
+ export function VirtualListProvider<T>(listProps: React.PropsWithChildren<VirtualListProps<T>>) {
8
+ const {
9
+ children,
10
+ estimateSize,
11
+ data,
12
+ hasNextPage,
13
+ fetchNextPage,
14
+ isFetchingNextPage,
15
+ ...virtualizerOptions
16
+ } = listProps
17
+
18
+ const scrollRef = useRef<HTMLDivElement | null>(null)
19
+
20
+ const listLength = data?.length ?? 0
21
+
22
+ const virtualizerItemCount = hasNextPage ? listLength + 1 : listLength
23
+
24
+ const paginationIndicatorIndex = hasNextPage ? virtualizerItemCount - 1 : null
25
+
26
+ const lastItemIndex = hasNextPage ? virtualizerItemCount - 2 : virtualizerItemCount - 1
27
+
28
+ const virtualizer = useVirtualizer({
29
+ gap: 16,
30
+ overscan: 5,
31
+ ...virtualizerOptions,
32
+ count: virtualizerItemCount,
33
+ getScrollElement: () => scrollRef.current,
34
+ estimateSize(index) {
35
+ if (index === paginationIndicatorIndex) {
36
+ return 100
37
+ }
38
+
39
+ const item = data?.[index]
40
+
41
+ return item && estimateSize ? estimateSize(item) : 100
42
+ },
43
+ })
44
+
45
+ const loadNextPage = useCallback(() => {
46
+ const items = virtualizer.getVirtualItems()
47
+
48
+ const [_, lastItem] = [...items].reverse()
49
+
50
+ if (!lastItem) {
51
+ return
52
+ }
53
+
54
+ if (
55
+ lastItem.index >= data.length - 1 &&
56
+ hasNextPage &&
57
+ !isFetchingNextPage
58
+ ) {
59
+ fetchNextPage?.()
60
+ }
61
+ }, [
62
+ virtualizer.getVirtualItems(),
63
+ data?.length,
64
+ hasNextPage,
65
+ isFetchingNextPage,
66
+ fetchNextPage,
67
+ ])
68
+
69
+ const contextValue = {
70
+ virtualizer,
71
+ loadNextPage,
72
+ scrollRef,
73
+ virtualizerItemCount,
74
+ paginationIndicatorIndex,
75
+ lastItemIndex,
76
+ list: {
77
+ data,
78
+ hasNextPage,
79
+ fetchNextPage,
80
+ isFetchingNextPage,
81
+ },
82
+ }
83
+
84
+ return <VirtualListContext value={contextValue}>
85
+ {children}
86
+ </VirtualListContext>
87
+ }
88
+
89
+ export function useVirtualListContext<T extends (val: VirtualListContextValue<any>) => any>(selector: T): ReturnType<T> {
90
+ const context = use(VirtualListContext)
91
+
92
+ return selector(context)
93
+ }
@@ -0,0 +1,11 @@
1
+ import { VirtualListContainer, VirtualListItems } from './list'
2
+ import { VirtualListProvider } from './context'
3
+ import { memo } from 'react'
4
+
5
+ export function createVirtualList<T>() {
6
+ return {
7
+ Provider: VirtualListProvider<T>,
8
+ Container: memo(VirtualListContainer),
9
+ Items: memo(VirtualListItems<T>),
10
+ }
11
+ }
@@ -0,0 +1,85 @@
1
+ import { useVirtualListContext } from './context'
2
+ import React, { useCallback, useEffect, useMemo } from 'react'
3
+ import { VirtualItem } from '@tanstack/react-virtual'
4
+ import { EmptyPlaceholder } from '../EmptyPlaceholder'
5
+ import { VirtualListItemsProps, VirtualListContainerProps } from './types'
6
+
7
+ export function VirtualListItems<T>(props: VirtualListItemsProps<T>) {
8
+ const { renderItem: Item, ListFooterComponent = () => null } = props
9
+
10
+ const virtualizer = useVirtualListContext(v => v.virtualizer)
11
+ const listItems = useVirtualListContext(v => v.list.data)
12
+ const paginationIndicatorIndex = useVirtualListContext(v => v.paginationIndicatorIndex)
13
+ const getNextPage = useVirtualListContext(v => v.loadNextPage)
14
+
15
+ const items = virtualizer.getVirtualItems()
16
+
17
+ useEffect(() => {
18
+ getNextPage()
19
+ }, [getNextPage])
20
+
21
+ const ItemWrapper = useCallback((props: React.PropsWithChildren<{ item: VirtualItem }>) => {
22
+ const { item, children } = props
23
+
24
+ return <div
25
+ style={{
26
+ position: 'absolute',
27
+ top: 0,
28
+ left: 0,
29
+ width: '100%',
30
+ transform: `translateY(${item.start}px)`,
31
+ }}
32
+ ref={virtualizer.measureElement}
33
+ data-index={item.index}
34
+ >
35
+ {children}
36
+ </div>
37
+ }, [virtualizer.measureElement])
38
+
39
+ const renderItem = useCallback((item: VirtualItem) => {
40
+ const data = listItems[item.index]
41
+
42
+ const isPaginationIndicator = item.index === paginationIndicatorIndex
43
+
44
+ if (isPaginationIndicator) {
45
+ return <ItemWrapper key={item.key} item={item}>
46
+ <ListFooterComponent />
47
+ </ItemWrapper>
48
+ }
49
+
50
+ return <ItemWrapper key={item.key} item={item}>
51
+ <Item index={item.index} item={data} />
52
+ </ItemWrapper>
53
+
54
+ }, [Item, ItemWrapper, listItems, ListFooterComponent, paginationIndicatorIndex])
55
+
56
+ const containerStyle = useMemo(() => ({
57
+ height: `${virtualizer.getTotalSize()}px`,
58
+ width: '100%',
59
+ position: 'relative' as const,
60
+ }), [virtualizer.getTotalSize()])
61
+
62
+ return <div style={containerStyle}>
63
+ {items.map(renderItem)}
64
+ </div>
65
+ }
66
+
67
+ export const VirtualListContainer = (props: VirtualListContainerProps) => {
68
+ const { children, placeholder, ...rest } = props
69
+
70
+ const scrollRef = useVirtualListContext(ctx => ctx.scrollRef)
71
+
72
+ const totalItemCount = useVirtualListContext(ctx => ctx.list?.data?.length)
73
+
74
+ if (!totalItemCount || totalItemCount <= 0) {
75
+ if (React.isValidElement(placeholder)) {
76
+ return <>{placeholder}</>
77
+ }
78
+
79
+ return <EmptyPlaceholder {...placeholder} />
80
+ }
81
+
82
+ return <div ref={scrollRef} {...rest}>
83
+ {children}
84
+ </div>
85
+ }