@estuary-solutions/rn-core-ui 0.0.3

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 (304) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +743 -0
  3. package/dist/Accordion/Accordion.d.ts +5 -0
  4. package/dist/Accordion/Accordion.d.ts.map +1 -0
  5. package/dist/Accordion/Accordion.js +19 -0
  6. package/dist/Accordion/AccordionContext.d.ts +7 -0
  7. package/dist/Accordion/AccordionContext.d.ts.map +1 -0
  8. package/dist/Accordion/AccordionContext.js +3 -0
  9. package/dist/Accordion/AccordionGroup.d.ts +7 -0
  10. package/dist/Accordion/AccordionGroup.d.ts.map +1 -0
  11. package/dist/Accordion/AccordionGroup.js +32 -0
  12. package/dist/Accordion/AccordionItem.d.ts +5 -0
  13. package/dist/Accordion/AccordionItem.d.ts.map +1 -0
  14. package/dist/Accordion/AccordionItem.js +12 -0
  15. package/dist/Accordion/AccordionTree.d.ts +6 -0
  16. package/dist/Accordion/AccordionTree.d.ts.map +1 -0
  17. package/dist/Accordion/AccordionTree.js +4 -0
  18. package/dist/Accordion/AccordionTreeInternal.d.ts +5 -0
  19. package/dist/Accordion/AccordionTreeInternal.d.ts.map +1 -0
  20. package/dist/Accordion/AccordionTreeInternal.js +36 -0
  21. package/dist/Accordion/AccordionTreeWithGroup.d.ts +8 -0
  22. package/dist/Accordion/AccordionTreeWithGroup.d.ts.map +1 -0
  23. package/dist/Accordion/AccordionTreeWithGroup.js +11 -0
  24. package/dist/Accordion/index.d.ts +5 -0
  25. package/dist/Accordion/index.d.ts.map +1 -0
  26. package/dist/Accordion/index.js +4 -0
  27. package/dist/Accordion/types/AccordionTypes.d.ts +65 -0
  28. package/dist/Accordion/types/AccordionTypes.d.ts.map +1 -0
  29. package/dist/Accordion/types/AccordionTypes.js +1 -0
  30. package/dist/Avatars/Avatar.d.ts +20 -0
  31. package/dist/Avatars/Avatar.d.ts.map +1 -0
  32. package/dist/Avatars/Avatar.js +63 -0
  33. package/dist/Badges/Badge.d.ts +25 -0
  34. package/dist/Badges/Badge.d.ts.map +1 -0
  35. package/dist/Badges/Badge.js +75 -0
  36. package/dist/Breadcrumbs/Breadcrumb.d.ts +13 -0
  37. package/dist/Breadcrumbs/Breadcrumb.d.ts.map +1 -0
  38. package/dist/Breadcrumbs/Breadcrumb.js +63 -0
  39. package/dist/Button/Button.d.ts +7 -0
  40. package/dist/Button/Button.d.ts.map +1 -0
  41. package/dist/Button/Button.js +62 -0
  42. package/dist/Button/ButtonGradient.d.ts +5 -0
  43. package/dist/Button/ButtonGradient.d.ts.map +1 -0
  44. package/dist/Button/ButtonGradient.js +61 -0
  45. package/dist/Button/index.d.ts +4 -0
  46. package/dist/Button/index.d.ts.map +1 -0
  47. package/dist/Button/index.js +3 -0
  48. package/dist/Button/types/ButtonGradientTypes.d.ts +80 -0
  49. package/dist/Button/types/ButtonGradientTypes.d.ts.map +1 -0
  50. package/dist/Button/types/ButtonGradientTypes.js +1 -0
  51. package/dist/Button/types/ButtonTypes.d.ts +65 -0
  52. package/dist/Button/types/ButtonTypes.d.ts.map +1 -0
  53. package/dist/Button/types/ButtonTypes.js +1 -0
  54. package/dist/Buttons/Button.d.ts +23 -0
  55. package/dist/Buttons/Button.d.ts.map +1 -0
  56. package/dist/Buttons/Button.js +66 -0
  57. package/dist/Cards/Card.d.ts +22 -0
  58. package/dist/Cards/Card.d.ts.map +1 -0
  59. package/dist/Cards/Card.js +26 -0
  60. package/dist/Cards/CardActionArea.d.ts +13 -0
  61. package/dist/Cards/CardActionArea.d.ts.map +1 -0
  62. package/dist/Cards/CardActionArea.js +30 -0
  63. package/dist/Cards/CardActions.d.ts +14 -0
  64. package/dist/Cards/CardActions.d.ts.map +1 -0
  65. package/dist/Cards/CardActions.js +41 -0
  66. package/dist/Cards/CardContent.d.ts +13 -0
  67. package/dist/Cards/CardContent.d.ts.map +1 -0
  68. package/dist/Cards/CardContent.js +19 -0
  69. package/dist/Cards/CardHeader.d.ts +16 -0
  70. package/dist/Cards/CardHeader.d.ts.map +1 -0
  71. package/dist/Cards/CardHeader.js +61 -0
  72. package/dist/Cards/CardMedia.d.ts +23 -0
  73. package/dist/Cards/CardMedia.d.ts.map +1 -0
  74. package/dist/Cards/CardMedia.js +16 -0
  75. package/dist/Cards/Paper.d.ts +13 -0
  76. package/dist/Cards/Paper.d.ts.map +1 -0
  77. package/dist/Cards/Paper.js +42 -0
  78. package/dist/DraggableFlatList/CellDecorators.d.ts +21 -0
  79. package/dist/DraggableFlatList/CellDecorators.d.ts.map +1 -0
  80. package/dist/DraggableFlatList/CellDecorators.js +66 -0
  81. package/dist/DraggableFlatList/CellRendererComponent.d.ts +20 -0
  82. package/dist/DraggableFlatList/CellRendererComponent.d.ts.map +1 -0
  83. package/dist/DraggableFlatList/CellRendererComponent.js +146 -0
  84. package/dist/DraggableFlatList/DraggableFlatList.d.ts +9 -0
  85. package/dist/DraggableFlatList/DraggableFlatList.d.ts.map +1 -0
  86. package/dist/DraggableFlatList/DraggableFlatList.js +282 -0
  87. package/dist/DraggableFlatList/DraggableFlatList.web.d.ts +4 -0
  88. package/dist/DraggableFlatList/DraggableFlatList.web.d.ts.map +1 -0
  89. package/dist/DraggableFlatList/DraggableFlatList.web.js +248 -0
  90. package/dist/DraggableFlatList/NestableDraggableFlatList.d.ts +9 -0
  91. package/dist/DraggableFlatList/NestableDraggableFlatList.d.ts.map +1 -0
  92. package/dist/DraggableFlatList/NestableDraggableFlatList.js +66 -0
  93. package/dist/DraggableFlatList/NestableScrollContainer.d.ts +5 -0
  94. package/dist/DraggableFlatList/NestableScrollContainer.d.ts.map +1 -0
  95. package/dist/DraggableFlatList/NestableScrollContainer.js +28 -0
  96. package/dist/DraggableFlatList/PlaceholderItem.d.ts +8 -0
  97. package/dist/DraggableFlatList/PlaceholderItem.d.ts.map +1 -0
  98. package/dist/DraggableFlatList/PlaceholderItem.js +44 -0
  99. package/dist/DraggableFlatList/RowItem.d.ts +13 -0
  100. package/dist/DraggableFlatList/RowItem.d.ts.map +1 -0
  101. package/dist/DraggableFlatList/RowItem.js +45 -0
  102. package/dist/DraggableFlatList/ScrollOffsetListener.d.ts +8 -0
  103. package/dist/DraggableFlatList/ScrollOffsetListener.d.ts.map +1 -0
  104. package/dist/DraggableFlatList/ScrollOffsetListener.js +13 -0
  105. package/dist/Flex/Flex.d.ts +12 -0
  106. package/dist/Flex/Flex.d.ts.map +1 -0
  107. package/dist/Flex/Flex.js +28 -0
  108. package/dist/Flex/Flex.types.d.ts +10 -0
  109. package/dist/Flex/Flex.types.d.ts.map +1 -0
  110. package/dist/Flex/Flex.types.js +1 -0
  111. package/dist/Flex/index.d.ts +4 -0
  112. package/dist/Flex/index.d.ts.map +1 -0
  113. package/dist/Flex/index.js +3 -0
  114. package/dist/LICENSE +20 -0
  115. package/dist/README.md +743 -0
  116. package/dist/SvgIcon/SvgIcon.d.ts +9 -0
  117. package/dist/SvgIcon/SvgIcon.d.ts.map +1 -0
  118. package/dist/SvgIcon/SvgIcon.js +39 -0
  119. package/dist/SvgIcon/components/IconAlertCircle.d.ts +4 -0
  120. package/dist/SvgIcon/components/IconAlertCircle.d.ts.map +1 -0
  121. package/dist/SvgIcon/components/IconAlertCircle.js +6 -0
  122. package/dist/SvgIcon/components/IconAngleLeft.d.ts +4 -0
  123. package/dist/SvgIcon/components/IconAngleLeft.d.ts.map +1 -0
  124. package/dist/SvgIcon/components/IconAngleLeft.js +6 -0
  125. package/dist/SvgIcon/components/IconAngleRight.d.ts +4 -0
  126. package/dist/SvgIcon/components/IconAngleRight.d.ts.map +1 -0
  127. package/dist/SvgIcon/components/IconAngleRight.js +6 -0
  128. package/dist/SvgIcon/components/IconCheckBox.d.ts +4 -0
  129. package/dist/SvgIcon/components/IconCheckBox.d.ts.map +1 -0
  130. package/dist/SvgIcon/components/IconCheckBox.js +6 -0
  131. package/dist/SvgIcon/components/IconCheckBoxOutlineBlank.d.ts +4 -0
  132. package/dist/SvgIcon/components/IconCheckBoxOutlineBlank.d.ts.map +1 -0
  133. package/dist/SvgIcon/components/IconCheckBoxOutlineBlank.js +6 -0
  134. package/dist/SvgIcon/components/IconCheckBoxWithBg.d.ts +4 -0
  135. package/dist/SvgIcon/components/IconCheckBoxWithBg.d.ts.map +1 -0
  136. package/dist/SvgIcon/components/IconCheckBoxWithBg.js +6 -0
  137. package/dist/SvgIcon/components/IconChevronDown.d.ts +4 -0
  138. package/dist/SvgIcon/components/IconChevronDown.d.ts.map +1 -0
  139. package/dist/SvgIcon/components/IconChevronDown.js +6 -0
  140. package/dist/SvgIcon/components/IconChevronUp.d.ts +4 -0
  141. package/dist/SvgIcon/components/IconChevronUp.d.ts.map +1 -0
  142. package/dist/SvgIcon/components/IconChevronUp.js +6 -0
  143. package/dist/SvgIcon/components/IconHome.d.ts +4 -0
  144. package/dist/SvgIcon/components/IconHome.d.ts.map +1 -0
  145. package/dist/SvgIcon/components/IconHome.js +6 -0
  146. package/dist/SvgIcon/components/IconPerson.d.ts +4 -0
  147. package/dist/SvgIcon/components/IconPerson.d.ts.map +1 -0
  148. package/dist/SvgIcon/components/IconPerson.js +6 -0
  149. package/dist/SvgIcon/components/IconPlayCircle.d.ts +4 -0
  150. package/dist/SvgIcon/components/IconPlayCircle.d.ts.map +1 -0
  151. package/dist/SvgIcon/components/IconPlayCircle.js +9 -0
  152. package/dist/SvgIcon/components/IconPlus.d.ts +4 -0
  153. package/dist/SvgIcon/components/IconPlus.d.ts.map +1 -0
  154. package/dist/SvgIcon/components/IconPlus.js +6 -0
  155. package/dist/SvgIcon/components/index.d.ts +13 -0
  156. package/dist/SvgIcon/components/index.d.ts.map +1 -0
  157. package/dist/SvgIcon/components/index.js +12 -0
  158. package/dist/SvgIcon/types/SvgIconTypes.d.ts +46 -0
  159. package/dist/SvgIcon/types/SvgIconTypes.d.ts.map +1 -0
  160. package/dist/SvgIcon/types/SvgIconTypes.js +1 -0
  161. package/dist/TextFields/TextField.d.ts +34 -0
  162. package/dist/TextFields/TextField.d.ts.map +1 -0
  163. package/dist/TextFields/TextField.js +400 -0
  164. package/dist/TextFields/index.d.ts +2 -0
  165. package/dist/TextFields/index.d.ts.map +1 -0
  166. package/dist/TextFields/index.js +1 -0
  167. package/dist/Texts/Text.d.ts +21 -0
  168. package/dist/Texts/Text.d.ts.map +1 -0
  169. package/dist/Texts/Text.js +49 -0
  170. package/dist/constants/DraggableFlatList/constants.d.ts +28 -0
  171. package/dist/constants/DraggableFlatList/constants.d.ts.map +1 -0
  172. package/dist/constants/DraggableFlatList/constants.js +25 -0
  173. package/dist/constants/DraggableFlatList/types.d.ts +65 -0
  174. package/dist/constants/DraggableFlatList/types.d.ts.map +1 -0
  175. package/dist/constants/DraggableFlatList/types.js +1 -0
  176. package/dist/constants/DraggableFlatList/types.web.d.ts +7 -0
  177. package/dist/constants/DraggableFlatList/types.web.d.ts.map +1 -0
  178. package/dist/constants/DraggableFlatList/types.web.js +1 -0
  179. package/dist/constants/consts.d.ts +16 -0
  180. package/dist/constants/consts.d.ts.map +1 -0
  181. package/dist/constants/consts.js +15 -0
  182. package/dist/constants/index.d.ts +3 -0
  183. package/dist/constants/index.d.ts.map +1 -0
  184. package/dist/constants/index.js +2 -0
  185. package/dist/constants/types.d.ts +22 -0
  186. package/dist/constants/types.d.ts.map +1 -0
  187. package/dist/constants/types.js +21 -0
  188. package/dist/context/DraggableFlatList/animatedValueContext.d.ts +29 -0
  189. package/dist/context/DraggableFlatList/animatedValueContext.d.ts.map +1 -0
  190. package/dist/context/DraggableFlatList/animatedValueContext.js +154 -0
  191. package/dist/context/DraggableFlatList/cellContext.d.ts +10 -0
  192. package/dist/context/DraggableFlatList/cellContext.d.ts.map +1 -0
  193. package/dist/context/DraggableFlatList/cellContext.js +18 -0
  194. package/dist/context/DraggableFlatList/draggableFlatListContext.d.ts +13 -0
  195. package/dist/context/DraggableFlatList/draggableFlatListContext.d.ts.map +1 -0
  196. package/dist/context/DraggableFlatList/draggableFlatListContext.js +19 -0
  197. package/dist/context/DraggableFlatList/nestableScrollContainerContext.d.ts +23 -0
  198. package/dist/context/DraggableFlatList/nestableScrollContainerContext.d.ts.map +1 -0
  199. package/dist/context/DraggableFlatList/nestableScrollContainerContext.js +36 -0
  200. package/dist/context/DraggableFlatList/propsContext.d.ts +9 -0
  201. package/dist/context/DraggableFlatList/propsContext.d.ts.map +1 -0
  202. package/dist/context/DraggableFlatList/propsContext.js +25 -0
  203. package/dist/context/DraggableFlatList/refContext.d.ts +20 -0
  204. package/dist/context/DraggableFlatList/refContext.d.ts.map +1 -0
  205. package/dist/context/DraggableFlatList/refContext.js +55 -0
  206. package/dist/hooks/DraggableFlatList/useAutoScroll.d.ts +2 -0
  207. package/dist/hooks/DraggableFlatList/useAutoScroll.d.ts.map +1 -0
  208. package/dist/hooks/DraggableFlatList/useAutoScroll.js +77 -0
  209. package/dist/hooks/DraggableFlatList/useCellTranslate.d.ts +9 -0
  210. package/dist/hooks/DraggableFlatList/useCellTranslate.d.ts.map +1 -0
  211. package/dist/hooks/DraggableFlatList/useCellTranslate.js +72 -0
  212. package/dist/hooks/DraggableFlatList/useNestedAutoScroll.d.ts +12 -0
  213. package/dist/hooks/DraggableFlatList/useNestedAutoScroll.d.ts.map +1 -0
  214. package/dist/hooks/DraggableFlatList/useNestedAutoScroll.js +77 -0
  215. package/dist/hooks/DraggableFlatList/useOnCellActiveAnimation.d.ts +15 -0
  216. package/dist/hooks/DraggableFlatList/useOnCellActiveAnimation.d.ts.map +1 -0
  217. package/dist/hooks/DraggableFlatList/useOnCellActiveAnimation.js +29 -0
  218. package/dist/hooks/DraggableFlatList/useStableCallback.d.ts +2 -0
  219. package/dist/hooks/DraggableFlatList/useStableCallback.d.ts.map +1 -0
  220. package/dist/hooks/DraggableFlatList/useStableCallback.js +11 -0
  221. package/dist/hooks/useTheme.d.ts +17 -0
  222. package/dist/hooks/useTheme.d.ts.map +1 -0
  223. package/dist/hooks/useTheme.js +12 -0
  224. package/dist/index.d.ts +23 -0
  225. package/dist/index.d.ts.map +1 -0
  226. package/dist/index.js +22 -0
  227. package/dist/themes/colors.d.ts +9 -0
  228. package/dist/themes/colors.d.ts.map +1 -0
  229. package/dist/themes/colors.js +201 -0
  230. package/dist/themes/elevationOverlay.d.ts +2 -0
  231. package/dist/themes/elevationOverlay.d.ts.map +1 -0
  232. package/dist/themes/elevationOverlay.js +12 -0
  233. package/dist/themes/fontSize.d.ts +23 -0
  234. package/dist/themes/fontSize.d.ts.map +1 -0
  235. package/dist/themes/fontSize.js +22 -0
  236. package/dist/themes/index.d.ts +5 -0
  237. package/dist/themes/index.d.ts.map +1 -0
  238. package/dist/themes/index.js +4 -0
  239. package/dist/themes/types/colorTypes.d.ts +665 -0
  240. package/dist/themes/types/colorTypes.d.ts.map +1 -0
  241. package/dist/themes/types/colorTypes.js +1 -0
  242. package/dist/utils/DraggableFlatList/typedMemo.d.ts +2 -0
  243. package/dist/utils/DraggableFlatList/typedMemo.d.ts.map +1 -0
  244. package/dist/utils/DraggableFlatList/typedMemo.js +2 -0
  245. package/dist/utils/cleanTagHTML.d.ts +22 -0
  246. package/dist/utils/cleanTagHTML.d.ts.map +1 -0
  247. package/dist/utils/cleanTagHTML.js +36 -0
  248. package/dist/utils/colors/color.d.ts +2 -0
  249. package/dist/utils/colors/color.d.ts.map +1 -0
  250. package/dist/utils/colors/color.js +6 -0
  251. package/dist/utils/colors/elevation.d.ts +7 -0
  252. package/dist/utils/colors/elevation.d.ts.map +1 -0
  253. package/dist/utils/colors/elevation.js +29 -0
  254. package/dist/utils/colors/index.d.ts +9 -0
  255. package/dist/utils/colors/index.d.ts.map +1 -0
  256. package/dist/utils/colors/index.js +7 -0
  257. package/dist/utils/converter.d.ts +47 -0
  258. package/dist/utils/converter.d.ts.map +1 -0
  259. package/dist/utils/converter.js +54 -0
  260. package/dist/utils/debounce.d.ts +36 -0
  261. package/dist/utils/debounce.d.ts.map +1 -0
  262. package/dist/utils/debounce.js +54 -0
  263. package/dist/utils/filters.d.ts +3 -0
  264. package/dist/utils/filters.d.ts.map +1 -0
  265. package/dist/utils/filters.js +10 -0
  266. package/dist/utils/fixedDistance.d.ts +16 -0
  267. package/dist/utils/fixedDistance.d.ts.map +1 -0
  268. package/dist/utils/fixedDistance.js +17 -0
  269. package/dist/utils/formatMoney.d.ts +30 -0
  270. package/dist/utils/formatMoney.d.ts.map +1 -0
  271. package/dist/utils/formatMoney.js +33 -0
  272. package/dist/utils/getOS.d.ts +6 -0
  273. package/dist/utils/getOS.d.ts.map +1 -0
  274. package/dist/utils/getOS.js +6 -0
  275. package/dist/utils/index.d.ts +13 -0
  276. package/dist/utils/index.d.ts.map +1 -0
  277. package/dist/utils/index.js +12 -0
  278. package/dist/utils/limitedString.d.ts +15 -0
  279. package/dist/utils/limitedString.d.ts.map +1 -0
  280. package/dist/utils/limitedString.js +19 -0
  281. package/dist/utils/resolutions.d.ts +65 -0
  282. package/dist/utils/resolutions.d.ts.map +1 -0
  283. package/dist/utils/resolutions.js +79 -0
  284. package/dist/utils/scale.d.ts +141 -0
  285. package/dist/utils/scale.d.ts.map +1 -0
  286. package/dist/utils/scale.js +141 -0
  287. package/documents/build.js +102 -0
  288. package/documents/buildFromRoot.js +49 -0
  289. package/documents/buildFromSample.js +40 -0
  290. package/documents/buildV2.js +98 -0
  291. package/documents/copyPackageToExample.js +31 -0
  292. package/example/RNCoreUISample/.eslintrc.js +10 -0
  293. package/example/RNCoreUISample/.prettierrc.js +7 -0
  294. package/example/RNCoreUISample/App.js +26 -0
  295. package/example/RNCoreUISample/README.md +104 -0
  296. package/example/RNCoreUISample/android/app/debug.keystore +0 -0
  297. package/example/RNCoreUISample/babel.config.js +29 -0
  298. package/example/RNCoreUISample/documents/storybook/manager.js +5 -0
  299. package/example/RNCoreUISample/fix_node_modules.js +12 -0
  300. package/example/RNCoreUISample/index.js +20 -0
  301. package/example/RNCoreUISample/jest.config.js +3 -0
  302. package/example/RNCoreUISample/metro.config.js +30 -0
  303. package/package.json +101 -0
  304. package/src/constants/DraggableFlatList/draggable.d.ts +12 -0
@@ -0,0 +1,15 @@
1
+ export const FORMAT_TIME_DMY_ = 'DD/MM/YYYY';
2
+ export const FORMAT_TIME_DMY = 'DD-MM-YYYY';
3
+ export const FORMAT_TIME = 'YYYY-MM-DD HH:mm';
4
+ export const FORMAT_TIME_DMYHMS = 'DD/MM/YYYY HH:mm:ss';
5
+ export const FORMAT_TIME_DMYHM = 'DD/MM/YYYY HH:mm';
6
+ export const FORMAT_TIME_VH = 'MMMM DD, YYYY HH:mm';
7
+ export const FORMAT_TIME_DDMMM = 'DD MMM';
8
+ export const FORMAT_TIME_YMD = 'YYYY-MM-DD';
9
+ export const FORMAT_TIME_FILTER = 'DD/MM/YY';
10
+ export const FORMAT_TIME_L = 'L';
11
+ export const FORMAT_TIME_LL = 'LL';
12
+ export const FORMAT_TIME_LLL = 'LLL';
13
+ export const FORMAT_TIME_LLLL = 'LLLL';
14
+ export const FORMAT_TIME_LT = 'LT';
15
+ export const FORMAT_TIME_LTS = 'LTS';
@@ -0,0 +1,3 @@
1
+ export * from './consts';
2
+ export * from './types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './consts';
2
+ export * from './types';
@@ -0,0 +1,22 @@
1
+ export declare const MIME_TYPES: {
2
+ csv: string;
3
+ doc: string;
4
+ docx: string;
5
+ jpeg: string;
6
+ jpg: string;
7
+ mp4: string;
8
+ pdf: string;
9
+ png: string;
10
+ ppt: string;
11
+ pptx: string;
12
+ webm: string;
13
+ xls: string;
14
+ xlsx: string;
15
+ };
16
+ export declare const FILE_TYPE: {
17
+ empty: number;
18
+ pdf: number;
19
+ video: number;
20
+ other: number;
21
+ };
22
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/constants/types.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU;;;;;;;;;;;;;;CActB,CAAC;AAEF,eAAO,MAAM,SAAS;;;;;CAKrB,CAAC"}
@@ -0,0 +1,21 @@
1
+ export const MIME_TYPES = {
2
+ csv: 'text/csv',
3
+ doc: 'application/msword',
4
+ docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
5
+ jpeg: 'image/jpeg',
6
+ jpg: 'image/jpeg',
7
+ mp4: 'video/mp4',
8
+ pdf: 'application/pdf',
9
+ png: 'image/png',
10
+ ppt: 'application/vnd.ms-powerpoint',
11
+ pptx: 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
12
+ webm: 'video/webm',
13
+ xls: 'application/vnd.ms-excel',
14
+ xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
15
+ };
16
+ export const FILE_TYPE = {
17
+ empty: -1,
18
+ pdf: 1,
19
+ video: 2,
20
+ other: 3,
21
+ };
@@ -0,0 +1,29 @@
1
+ import React from "react";
2
+ import { State as GestureState } from "react-native-gesture-handler";
3
+ export default function AnimatedValueProvider({ children, }: {
4
+ children: React.ReactNode;
5
+ }): import("react/jsx-runtime").JSX.Element;
6
+ export declare function useAnimatedValues(): {
7
+ activeCellOffset: import("react-native-reanimated").SharedValue<number>;
8
+ activeCellSize: import("react-native-reanimated").SharedValue<number>;
9
+ activeIndexAnim: import("react-native-reanimated").SharedValue<number>;
10
+ containerSize: import("react-native-reanimated").SharedValue<number>;
11
+ disabled: import("react-native-reanimated").SharedValue<boolean>;
12
+ horizontalAnim: import("react-native-reanimated").SharedValue<boolean>;
13
+ hoverAnim: import("react-native-reanimated").DerivedValue<number>;
14
+ hoverOffset: import("react-native-reanimated").DerivedValue<number>;
15
+ isDraggingCell: import("react-native-reanimated").DerivedValue<boolean>;
16
+ isTouchActiveNative: import("react-native-reanimated").SharedValue<boolean>;
17
+ panGestureState: import("react-native-reanimated").SharedValue<GestureState>;
18
+ placeholderOffset: import("react-native-reanimated").SharedValue<number>;
19
+ resetTouchedCell: () => void;
20
+ scrollOffset: import("react-native-reanimated").SharedValue<number>;
21
+ scrollViewSize: import("react-native-reanimated").SharedValue<number>;
22
+ spacerIndexAnim: import("react-native-reanimated").SharedValue<number>;
23
+ touchPositionDiff: import("react-native-reanimated").DerivedValue<number>;
24
+ touchTranslate: import("react-native-reanimated").SharedValue<number>;
25
+ autoScrollDistance: import("react-native-reanimated").DerivedValue<number>;
26
+ viewableIndexMin: import("react-native-reanimated").SharedValue<number>;
27
+ viewableIndexMax: import("react-native-reanimated").SharedValue<number>;
28
+ };
29
+ //# sourceMappingURL=animatedValueContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"animatedValueContext.d.ts","sourceRoot":"","sources":["../../../src/context/DraggableFlatList/animatedValueContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,EAAE,KAAK,IAAI,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAQrE,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,EAC5C,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,2CAOA;AAED,wBAAgB,iBAAiB;;;;;;;;;;;;;;;;;;;;;;EAQhC"}
@@ -0,0 +1,154 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import React from "react";
3
+ import { useAnimatedReaction, useDerivedValue, useSharedValue, } from "react-native-reanimated";
4
+ import { State as GestureState } from "react-native-gesture-handler";
5
+ import { useProps } from "./propsContext";
6
+ const AnimatedValueContext = React.createContext(undefined);
7
+ export default function AnimatedValueProvider({ children, }) {
8
+ const value = useSetupAnimatedValues();
9
+ return (_jsx(AnimatedValueContext.Provider, { value: value, children: children }));
10
+ }
11
+ export function useAnimatedValues() {
12
+ const value = React.useContext(AnimatedValueContext);
13
+ if (!value) {
14
+ throw new Error("useAnimatedValues must be called from within AnimatedValueProvider!");
15
+ }
16
+ return value;
17
+ }
18
+ function useSetupAnimatedValues() {
19
+ const props = useProps();
20
+ const DEFAULT_VAL = useSharedValue(0);
21
+ const containerSize = useSharedValue(0);
22
+ const scrollViewSize = useSharedValue(0);
23
+ const panGestureState = useSharedValue(GestureState.UNDETERMINED);
24
+ const touchTranslate = useSharedValue(0);
25
+ const isTouchActiveNative = useSharedValue(false);
26
+ const hasMoved = useSharedValue(0);
27
+ const disabled = useSharedValue(false);
28
+ const horizontalAnim = useSharedValue(!!props.horizontal);
29
+ const activeIndexAnim = useSharedValue(-1); // Index of hovering cell
30
+ const spacerIndexAnim = useSharedValue(-1); // Index of hovered-over cell
31
+ const activeCellSize = useSharedValue(0); // Height or width of acctive cell
32
+ const activeCellOffset = useSharedValue(0); // Distance between active cell and edge of container
33
+ const scrollOffset = useSharedValue(0);
34
+ const scrollInit = useSharedValue(0);
35
+ const viewableIndexMin = useSharedValue(0);
36
+ const viewableIndexMax = useSharedValue(0);
37
+ // If list is nested there may be an outer scrollview
38
+ const outerScrollOffset = props.outerScrollOffset || DEFAULT_VAL;
39
+ const outerScrollInit = useSharedValue(0);
40
+ useAnimatedReaction(() => {
41
+ return activeIndexAnim.value;
42
+ }, (cur, prev) => {
43
+ if (cur !== prev && cur >= 0) {
44
+ scrollInit.value = scrollOffset.value;
45
+ outerScrollInit.value = outerScrollOffset.value;
46
+ }
47
+ }, [outerScrollOffset]);
48
+ const placeholderOffset = useSharedValue(0);
49
+ const isDraggingCell = useDerivedValue(() => {
50
+ return isTouchActiveNative.value && activeIndexAnim.value >= 0;
51
+ }, []);
52
+ const autoScrollDistance = useDerivedValue(() => {
53
+ if (!isDraggingCell.value)
54
+ return 0;
55
+ const innerScrollDiff = scrollOffset.value - scrollInit.value;
56
+ // If list is nested there may be an outer scroll diff
57
+ const outerScrollDiff = outerScrollOffset.value - outerScrollInit.value;
58
+ const scrollDiff = innerScrollDiff + outerScrollDiff;
59
+ return scrollDiff;
60
+ }, []);
61
+ const touchPositionDiff = useDerivedValue(() => {
62
+ const extraTranslate = isTouchActiveNative.value
63
+ ? autoScrollDistance.value
64
+ : 0;
65
+ return touchTranslate.value + extraTranslate;
66
+ }, []);
67
+ const touchPositionDiffConstrained = useDerivedValue(() => {
68
+ const containerMinusActiveCell = containerSize.value - activeCellSize.value + scrollOffset.value;
69
+ const offsetRelativeToScrollTop = touchPositionDiff.value + activeCellOffset.value;
70
+ const constrained = Math.min(containerMinusActiveCell, Math.max(scrollOffset.value, offsetRelativeToScrollTop));
71
+ const maxTranslateNegative = -activeCellOffset.value;
72
+ const maxTranslatePositive = scrollViewSize.value - (activeCellOffset.value + activeCellSize.value);
73
+ // Only constrain the touch position while the finger is on the screen. This allows the active cell
74
+ // to snap above/below the fold once let go, if the drag ends at the top/bottom of the screen.
75
+ const constrainedBase = isTouchActiveNative.value
76
+ ? constrained - activeCellOffset.value
77
+ : touchPositionDiff.value;
78
+ // Make sure item is constrained to the boundaries of the scrollview
79
+ return Math.min(Math.max(constrainedBase, maxTranslateNegative), maxTranslatePositive);
80
+ }, []);
81
+ const dragItemOverflow = props.dragItemOverflow;
82
+ const hoverAnim = useDerivedValue(() => {
83
+ if (activeIndexAnim.value < 0)
84
+ return 0;
85
+ return dragItemOverflow
86
+ ? touchPositionDiff.value
87
+ : touchPositionDiffConstrained.value;
88
+ }, []);
89
+ const hoverOffset = useDerivedValue(() => {
90
+ return hoverAnim.value + activeCellOffset.value;
91
+ }, [hoverAnim, activeCellOffset]);
92
+ useDerivedValue(() => {
93
+ // Reset spacer index when we stop hovering
94
+ const isHovering = activeIndexAnim.value >= 0;
95
+ if (!isHovering && spacerIndexAnim.value >= 0) {
96
+ spacerIndexAnim.value = -1;
97
+ }
98
+ }, []);
99
+ // Note: this could use a refactor as it combines touch state + cell animation
100
+ const resetTouchedCell = React.useCallback(() => {
101
+ activeCellOffset.value = 0;
102
+ hasMoved.value = 0;
103
+ }, []);
104
+ const value = React.useMemo(() => ({
105
+ activeCellOffset,
106
+ activeCellSize,
107
+ activeIndexAnim,
108
+ containerSize,
109
+ disabled,
110
+ horizontalAnim,
111
+ hoverAnim,
112
+ hoverOffset,
113
+ isDraggingCell,
114
+ isTouchActiveNative,
115
+ panGestureState,
116
+ placeholderOffset,
117
+ resetTouchedCell,
118
+ scrollOffset,
119
+ scrollViewSize,
120
+ spacerIndexAnim,
121
+ touchPositionDiff,
122
+ touchTranslate,
123
+ autoScrollDistance,
124
+ viewableIndexMin,
125
+ viewableIndexMax,
126
+ }), [
127
+ activeCellOffset,
128
+ activeCellSize,
129
+ activeIndexAnim,
130
+ containerSize,
131
+ disabled,
132
+ horizontalAnim,
133
+ hoverAnim,
134
+ hoverOffset,
135
+ isDraggingCell,
136
+ isTouchActiveNative,
137
+ panGestureState,
138
+ placeholderOffset,
139
+ resetTouchedCell,
140
+ scrollOffset,
141
+ scrollViewSize,
142
+ spacerIndexAnim,
143
+ touchPositionDiff,
144
+ touchTranslate,
145
+ autoScrollDistance,
146
+ viewableIndexMin,
147
+ viewableIndexMax,
148
+ ]);
149
+ React.useEffect(() => {
150
+ var _a;
151
+ (_a = props.onAnimValInit) === null || _a === void 0 ? void 0 : _a.call(props, value);
152
+ }, [value]);
153
+ return value;
154
+ }
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ type Props = {
3
+ isActive: boolean;
4
+ children: React.ReactNode;
5
+ };
6
+ export declare function CellProvider({ isActive, children }: Props): import("react/jsx-runtime").JSX.Element;
7
+ declare const _default: typeof CellProvider;
8
+ export default _default;
9
+ export declare function useIsActive(): boolean;
10
+ //# sourceMappingURL=cellContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cellContext.d.ts","sourceRoot":"","sources":["../../../src/context/DraggableFlatList/cellContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAY1B,KAAK,KAAK,GAAG;IACX,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAEF,wBAAgB,YAAY,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,KAAK,2CAQzD;;AAED,wBAAuC;AAEvC,wBAAgB,WAAW,YAM1B"}
@@ -0,0 +1,18 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import React from "react";
3
+ import { typedMemo } from "../../utils/DraggableFlatList/typedMemo";
4
+ const CellContext = React.createContext(undefined);
5
+ export function CellProvider({ isActive, children }) {
6
+ const value = React.useMemo(() => ({
7
+ isActive,
8
+ }), [isActive]);
9
+ return _jsx(CellContext.Provider, { value: value, children: children });
10
+ }
11
+ export default typedMemo(CellProvider);
12
+ export function useIsActive() {
13
+ const value = React.useContext(CellContext);
14
+ if (!value) {
15
+ throw new Error("useIsActive must be called from within CellProvider!");
16
+ }
17
+ return value.isActive;
18
+ }
@@ -0,0 +1,13 @@
1
+ import React from "react";
2
+ type Props<T> = {
3
+ activeKey: string | null;
4
+ keyExtractor: (item: T, index: number) => string;
5
+ horizontal: boolean;
6
+ layoutAnimationDisabled: boolean;
7
+ children: React.ReactNode;
8
+ };
9
+ type DraggableFlatListContextValue<T> = Omit<Props<T>, "children">;
10
+ export default function DraggableFlatListProvider<T>({ activeKey, keyExtractor, horizontal, layoutAnimationDisabled, children, }: Props<T>): import("react/jsx-runtime").JSX.Element;
11
+ export declare function useDraggableFlatListContext<T>(): DraggableFlatListContextValue<T>;
12
+ export {};
13
+ //# sourceMappingURL=draggableFlatListContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"draggableFlatListContext.d.ts","sourceRoot":"","sources":["../../../src/context/DraggableFlatList/draggableFlatListContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,KAAK,KAAK,CAAC,CAAC,IAAI;IACd,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,YAAY,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACjD,UAAU,EAAE,OAAO,CAAC;IACpB,uBAAuB,EAAE,OAAO,CAAC;IACjC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAEF,KAAK,6BAA6B,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;AAMnE,MAAM,CAAC,OAAO,UAAU,yBAAyB,CAAC,CAAC,EAAE,EACnD,SAAS,EACT,YAAY,EACZ,UAAU,EACV,uBAAuB,EACvB,QAAQ,GACT,EAAE,KAAK,CAAC,CAAC,CAAC,2CAgBV;AAED,wBAAgB,2BAA2B,CAAC,CAAC,KAO3B,6BAA6B,CAAC,CAAC,CAAC,CACjD"}
@@ -0,0 +1,19 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import React from "react";
3
+ const DraggableFlatListContext = React.createContext(undefined);
4
+ export default function DraggableFlatListProvider({ activeKey, keyExtractor, horizontal, layoutAnimationDisabled, children, }) {
5
+ const value = React.useMemo(() => ({
6
+ activeKey,
7
+ keyExtractor,
8
+ horizontal,
9
+ layoutAnimationDisabled,
10
+ }), [activeKey, keyExtractor, horizontal, layoutAnimationDisabled]);
11
+ return (_jsx(DraggableFlatListContext.Provider, { value: value, children: children }));
12
+ }
13
+ export function useDraggableFlatListContext() {
14
+ const value = React.useContext(DraggableFlatListContext);
15
+ if (!value) {
16
+ throw new Error("useDraggableFlatListContext must be called within DraggableFlatListProvider");
17
+ }
18
+ return value;
19
+ }
@@ -0,0 +1,23 @@
1
+ import React from "react";
2
+ import { ScrollView } from "react-native-gesture-handler";
3
+ export declare function NestableScrollContainerProvider({ children, forwardedRef, }: {
4
+ children: React.ReactNode;
5
+ forwardedRef?: React.MutableRefObject<ScrollView>;
6
+ }): import("react/jsx-runtime").JSX.Element;
7
+ export declare function useNestableScrollContainerContext(): {
8
+ outerScrollEnabled: boolean;
9
+ setOuterScrollEnabled: React.Dispatch<React.SetStateAction<boolean>>;
10
+ outerScrollOffset: import("react-native-reanimated").SharedValue<number>;
11
+ scrollViewSize: import("react-native-reanimated").SharedValue<number>;
12
+ scrollableRef: React.RefObject<ScrollView>;
13
+ containerSize: import("react-native-reanimated").SharedValue<number>;
14
+ } | undefined;
15
+ export declare function useSafeNestableScrollContainerContext(): {
16
+ outerScrollEnabled: boolean;
17
+ setOuterScrollEnabled: React.Dispatch<React.SetStateAction<boolean>>;
18
+ outerScrollOffset: import("react-native-reanimated").SharedValue<number>;
19
+ scrollViewSize: import("react-native-reanimated").SharedValue<number>;
20
+ scrollableRef: React.RefObject<ScrollView>;
21
+ containerSize: import("react-native-reanimated").SharedValue<number>;
22
+ };
23
+ //# sourceMappingURL=nestableScrollContainerContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nestableScrollContainerContext.d.ts","sourceRoot":"","sources":["../../../src/context/DraggableFlatList/nestableScrollContainerContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAqC1D,wBAAgB,+BAA+B,CAAC,EAC9C,QAAQ,EACR,YAAY,GACb,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,YAAY,CAAC,EAAE,KAAK,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC;CACnD,2CAOA;AAED,wBAAgB,iCAAiC;;;;;;;cAGhD;AAED,wBAAgB,qCAAqC;;;;;;;EAQpD"}
@@ -0,0 +1,36 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import React from "react";
3
+ import { useSharedValue } from "react-native-reanimated";
4
+ const NestableScrollContainerContext = React.createContext(undefined);
5
+ function useSetupNestableScrollContextValue({ forwardedRef, }) {
6
+ const [outerScrollEnabled, setOuterScrollEnabled] = React.useState(true);
7
+ const scrollViewSize = useSharedValue(0);
8
+ const scrollableRefInner = React.useRef(null);
9
+ const scrollableRef = forwardedRef || scrollableRefInner;
10
+ const outerScrollOffset = useSharedValue(0);
11
+ const containerSize = useSharedValue(0);
12
+ const contextVal = React.useMemo(() => ({
13
+ outerScrollEnabled,
14
+ setOuterScrollEnabled,
15
+ outerScrollOffset,
16
+ scrollViewSize,
17
+ scrollableRef,
18
+ containerSize,
19
+ }), [outerScrollEnabled]);
20
+ return contextVal;
21
+ }
22
+ export function NestableScrollContainerProvider({ children, forwardedRef, }) {
23
+ const contextVal = useSetupNestableScrollContextValue({ forwardedRef });
24
+ return (_jsx(NestableScrollContainerContext.Provider, { value: contextVal, children: children }));
25
+ }
26
+ export function useNestableScrollContainerContext() {
27
+ const value = React.useContext(NestableScrollContainerContext);
28
+ return value;
29
+ }
30
+ export function useSafeNestableScrollContainerContext() {
31
+ const value = useNestableScrollContainerContext();
32
+ if (!value) {
33
+ throw new Error("useSafeNestableScrollContainerContext must be called within a NestableScrollContainerContext.Provider");
34
+ }
35
+ return value;
36
+ }
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ import { DraggableFlatListProps } from "../../constants/DraggableFlatList/types";
3
+ type Props<T> = DraggableFlatListProps<T> & {
4
+ children: React.ReactNode;
5
+ };
6
+ export default function PropsProvider<T>({ children, ...props }: Props<T>): import("react/jsx-runtime").JSX.Element;
7
+ export declare function useProps<T>(): DraggableFlatListProps<T>;
8
+ export {};
9
+ //# sourceMappingURL=propsContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"propsContext.d.ts","sourceRoot":"","sources":["../../../src/context/DraggableFlatList/propsContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAM3E,KAAK,KAAK,CAAC,CAAC,IAAI,sBAAsB,CAAC,CAAC,CAAC,GAAG;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,CAAC;AAE1E,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,CAAC,EAAE,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,2CAIxE;AAED,wBAAgB,QAAQ,CAAC,CAAC,+BAQzB"}
@@ -0,0 +1,25 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import React from "react";
14
+ const PropsContext = React.createContext(undefined);
15
+ export default function PropsProvider(_a) {
16
+ var { children } = _a, props = __rest(_a, ["children"]);
17
+ return (_jsx(PropsContext.Provider, { value: props, children: children }));
18
+ }
19
+ export function useProps() {
20
+ const value = React.useContext(PropsContext);
21
+ if (!value) {
22
+ throw new Error("useProps must be called from within PropsProvider!");
23
+ }
24
+ return value;
25
+ }
@@ -0,0 +1,20 @@
1
+ import React from "react";
2
+ import { FlatList } from "react-native-gesture-handler";
3
+ import Animated, { type SharedValue, WithSpringConfig } from "react-native-reanimated";
4
+ import { CellData, DraggableFlatListProps } from "../../constants/DraggableFlatList/types";
5
+ type RefContextValue<T> = {
6
+ propsRef: React.MutableRefObject<DraggableFlatListProps<T>>;
7
+ animationConfigRef: SharedValue<WithSpringConfig>;
8
+ cellDataRef: React.MutableRefObject<Map<string, CellData>>;
9
+ keyToIndexRef: React.MutableRefObject<Map<string, number>>;
10
+ containerRef: React.RefObject<Animated.View>;
11
+ flatlistRef: React.RefObject<FlatList<T>> | React.ForwardedRef<FlatList<T>>;
12
+ scrollViewRef: React.RefObject<Animated.ScrollView>;
13
+ };
14
+ export default function RefProvider<T>({ children, flatListRef, }: {
15
+ children: React.ReactNode;
16
+ flatListRef?: React.ForwardedRef<FlatList<T>> | null;
17
+ }): import("react/jsx-runtime").JSX.Element;
18
+ export declare function useRefs<T>(): RefContextValue<T>;
19
+ export {};
20
+ //# sourceMappingURL=refContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"refContext.d.ts","sourceRoot":"","sources":["../../../src/context/DraggableFlatList/refContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,QAAQ,EAAE,EACf,KAAK,WAAW,EAEhB,gBAAgB,EACjB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,QAAQ,EACR,sBAAsB,EACvB,MAAM,mCAAmC,CAAC;AAI3C,KAAK,eAAe,CAAC,CAAC,IAAI;IACxB,QAAQ,EAAE,KAAK,CAAC,gBAAgB,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5D,kBAAkB,EAAE,WAAW,CAAC,gBAAgB,CAAC,CAAC;IAClD,WAAW,EAAE,KAAK,CAAC,gBAAgB,CAAC,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC3D,aAAa,EAAE,KAAK,CAAC,gBAAgB,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC3D,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC7C,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5E,aAAa,EAAE,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;CACrD,CAAC;AAKF,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,CAAC,EAAE,EACrC,QAAQ,EACR,WAAW,GACZ,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,WAAW,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;CACtD,2CAGA;AAED,wBAAgB,OAAO,CAAC,CAAC,KAOP,eAAe,CAAC,CAAC,CAAC,CACnC"}
@@ -0,0 +1,55 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import React from "react";
3
+ import { useSharedValue, } from "react-native-reanimated";
4
+ import { DEFAULT_PROPS } from "../../constants/DraggableFlatList/constants";
5
+ import { useProps } from "./propsContext";
6
+ const RefContext = React.createContext(undefined);
7
+ export default function RefProvider({ children, flatListRef, }) {
8
+ const value = useSetupRefs({ flatListRef });
9
+ return _jsx(RefContext.Provider, { value: value, children: children });
10
+ }
11
+ export function useRefs() {
12
+ const value = React.useContext(RefContext);
13
+ if (!value) {
14
+ throw new Error("useRefs must be called from within a RefContext.Provider!");
15
+ }
16
+ return value;
17
+ }
18
+ function useSetupRefs({ flatListRef: flatListRefProp, }) {
19
+ const props = useProps();
20
+ const { animationConfig = DEFAULT_PROPS.animationConfig } = props;
21
+ const propsRef = React.useRef(props);
22
+ propsRef.current = props;
23
+ const animConfig = React.useMemo(() => (Object.assign(Object.assign({}, DEFAULT_PROPS.animationConfig), animationConfig)), [animationConfig]);
24
+ const animationConfigRef = useSharedValue(animConfig);
25
+ React.useEffect(() => {
26
+ animationConfigRef.value = animConfig;
27
+ }, [animConfig]);
28
+ const cellDataRef = React.useRef(new Map());
29
+ const keyToIndexRef = React.useRef(new Map());
30
+ const containerRef = React.useRef(null);
31
+ const flatlistRefInternal = React.useRef(null);
32
+ const flatlistRef = flatListRefProp || flatlistRefInternal;
33
+ const scrollViewRef = React.useRef(null);
34
+ // useEffect(() => {
35
+ // // This is a workaround for the fact that RN does not respect refs passed in
36
+ // // to renderScrollViewComponent underlying ScrollView (currently not used but
37
+ // // may need to add if we want to use reanimated scrollTo in the future)
38
+ // //@ts-ignore
39
+ // const scrollRef = flatlistRef.current?.getNativeScrollRef();
40
+ // if (!scrollViewRef.current) {
41
+ // //@ts-ignore
42
+ // scrollViewRef(scrollRef);
43
+ // }
44
+ // }, []);
45
+ const refs = React.useMemo(() => ({
46
+ animationConfigRef,
47
+ cellDataRef,
48
+ containerRef,
49
+ flatlistRef,
50
+ keyToIndexRef,
51
+ propsRef,
52
+ scrollViewRef,
53
+ }), []);
54
+ return refs;
55
+ }
@@ -0,0 +1,2 @@
1
+ export declare function useAutoScroll(): null;
2
+ //# sourceMappingURL=useAutoScroll.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAutoScroll.d.ts","sourceRoot":"","sources":["../../../src/hooks/DraggableFlatList/useAutoScroll.tsx"],"names":[],"mappings":"AAYA,wBAAgB,aAAa,SA2G5B"}
@@ -0,0 +1,77 @@
1
+ import { runOnJS, useAnimatedReaction, useDerivedValue, useSharedValue, } from "react-native-reanimated";
2
+ import { useRefs } from "../../context/DraggableFlatList/refContext";
3
+ import { useAnimatedValues } from "../../context/DraggableFlatList/animatedValueContext";
4
+ import { useProps } from "../../context/DraggableFlatList/propsContext";
5
+ import { DEFAULT_PROPS, SCROLL_POSITION_TOLERANCE } from "../../constants/DraggableFlatList/constants";
6
+ export function useAutoScroll() {
7
+ const { flatlistRef } = useRefs();
8
+ const { autoscrollThreshold = DEFAULT_PROPS.autoscrollThreshold, autoscrollSpeed = DEFAULT_PROPS.autoscrollSpeed, } = useProps();
9
+ const { scrollOffset, scrollViewSize, containerSize, activeCellSize, hoverOffset, activeIndexAnim, } = useAnimatedValues();
10
+ const hoverScreenOffset = useDerivedValue(() => {
11
+ return hoverOffset.value - scrollOffset.value;
12
+ }, []);
13
+ const isScrolledUp = useDerivedValue(() => {
14
+ return scrollOffset.value - SCROLL_POSITION_TOLERANCE <= 0;
15
+ }, []);
16
+ const isScrolledDown = useDerivedValue(() => {
17
+ return (scrollOffset.value + containerSize.value + SCROLL_POSITION_TOLERANCE >=
18
+ scrollViewSize.value);
19
+ }, []);
20
+ const distToTopEdge = useDerivedValue(() => {
21
+ return Math.max(0, hoverScreenOffset.value);
22
+ }, []);
23
+ const distToBottomEdge = useDerivedValue(() => {
24
+ const hoverPlusActiveCell = hoverScreenOffset.value + activeCellSize.value;
25
+ return Math.max(0, containerSize.value - hoverPlusActiveCell);
26
+ }, []);
27
+ const isAtTopEdge = useDerivedValue(() => {
28
+ return distToTopEdge.value <= autoscrollThreshold;
29
+ });
30
+ const isAtBottomEdge = useDerivedValue(() => {
31
+ return distToBottomEdge.value <= autoscrollThreshold;
32
+ }, []);
33
+ const scrollTarget = useSharedValue(0);
34
+ const dragIsActive = useDerivedValue(() => {
35
+ return activeIndexAnim.value >= 0;
36
+ }, []);
37
+ useAnimatedReaction(() => {
38
+ return dragIsActive.value;
39
+ }, (cur, prev) => {
40
+ if (cur && !prev) {
41
+ scrollTarget.value = scrollOffset.value;
42
+ }
43
+ });
44
+ const shouldAutoScroll = useDerivedValue(() => {
45
+ const scrollTargetDiff = Math.abs(scrollTarget.value - scrollOffset.value);
46
+ const hasScrolledToTarget = scrollTargetDiff < SCROLL_POSITION_TOLERANCE;
47
+ const isAtEdge = isAtTopEdge.value || isAtBottomEdge.value;
48
+ const topDisabled = isAtTopEdge.value && isScrolledUp.value;
49
+ const bottomDisabled = isAtBottomEdge.value && isScrolledDown.value;
50
+ const isEdgeDisabled = topDisabled || bottomDisabled;
51
+ const cellIsActive = activeIndexAnim.value >= 0;
52
+ return hasScrolledToTarget && isAtEdge && !isEdgeDisabled && cellIsActive;
53
+ }, []);
54
+ function scrollToInternal(offset) {
55
+ var _a;
56
+ if (flatlistRef && "current" in flatlistRef) {
57
+ (_a = flatlistRef.current) === null || _a === void 0 ? void 0 : _a.scrollToOffset({ offset, animated: true });
58
+ }
59
+ }
60
+ useDerivedValue(() => {
61
+ if (!shouldAutoScroll.value)
62
+ return;
63
+ const distFromEdge = isAtTopEdge.value
64
+ ? distToTopEdge.value
65
+ : distToBottomEdge.value;
66
+ const speedPct = 1 - distFromEdge / autoscrollThreshold;
67
+ const offset = speedPct * autoscrollSpeed;
68
+ const targetOffset = isAtTopEdge.value
69
+ ? Math.max(0, scrollOffset.value - offset)
70
+ : Math.min(scrollOffset.value + offset, scrollViewSize.value - containerSize.value);
71
+ scrollTarget.value = targetOffset;
72
+ // Reanimated scrollTo is crashing on android. use 'regular' scrollTo until figured out.
73
+ // scrollTo(scrollViewRef, targetX, targetY, true);
74
+ runOnJS(scrollToInternal)(targetOffset);
75
+ }, []);
76
+ return null;
77
+ }
@@ -0,0 +1,9 @@
1
+ import Animated from "react-native-reanimated";
2
+ type Params = {
3
+ cellIndex: number;
4
+ cellSize: Animated.SharedValue<number>;
5
+ cellOffset: Animated.SharedValue<number>;
6
+ };
7
+ export declare function useCellTranslate({ cellIndex, cellSize, cellOffset }: Params): import("react-native-reanimated").DerivedValue<number>;
8
+ export {};
9
+ //# sourceMappingURL=useCellTranslate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCellTranslate.d.ts","sourceRoot":"","sources":["../../../src/hooks/DraggableFlatList/useCellTranslate.tsx"],"names":[],"mappings":"AAAA,OAAO,QAAyC,MAAM,yBAAyB,CAAC;AAMhF,KAAK,MAAM,GAAG;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,QAAQ,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IACvC,UAAU,EAAE,QAAQ,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;CAC1C,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,MAAM,0DAgG3E"}