@codeleap/mobile 6.8.0 → 7.0.1

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 (379) hide show
  1. package/dist/Registry.js +47 -0
  2. package/dist/Registry.js.map +1 -0
  3. package/dist/components/ActivityIndicator/index.js +28 -0
  4. package/dist/components/ActivityIndicator/index.js.map +1 -0
  5. package/dist/components/ActivityIndicator/styles.js +2 -0
  6. package/dist/components/ActivityIndicator/styles.js.map +1 -0
  7. package/dist/components/ActivityIndicator/types.js +2 -0
  8. package/dist/components/ActivityIndicator/types.js.map +1 -0
  9. package/dist/components/Autocomplete/index.js +150 -0
  10. package/dist/components/Autocomplete/index.js.map +1 -0
  11. package/dist/components/Autocomplete/styles.js +2 -0
  12. package/dist/components/Autocomplete/styles.js.map +1 -0
  13. package/dist/components/Autocomplete/types.js +2 -0
  14. package/dist/components/Autocomplete/types.js.map +1 -0
  15. package/dist/components/Avatar/components/Badge.js +13 -0
  16. package/dist/components/Avatar/components/Badge.js.map +1 -0
  17. package/dist/components/Avatar/components/Content.js +19 -0
  18. package/dist/components/Avatar/components/Content.js.map +1 -0
  19. package/dist/components/Avatar/components/Illustration.js +11 -0
  20. package/dist/components/Avatar/components/Illustration.js.map +1 -0
  21. package/dist/components/Avatar/components/OverlayIcon.js +11 -0
  22. package/dist/components/Avatar/components/OverlayIcon.js.map +1 -0
  23. package/dist/components/Avatar/components/Text.js +19 -0
  24. package/dist/components/Avatar/components/Text.js.map +1 -0
  25. package/dist/components/Avatar/components/Wrapper.js +30 -0
  26. package/dist/components/Avatar/components/Wrapper.js.map +1 -0
  27. package/dist/components/Avatar/context.js +13 -0
  28. package/dist/components/Avatar/context.js.map +1 -0
  29. package/dist/components/Avatar/index.js +35 -0
  30. package/dist/components/Avatar/index.js.map +1 -0
  31. package/dist/components/Avatar/styles.js +2 -0
  32. package/dist/components/Avatar/styles.js.map +1 -0
  33. package/dist/components/Avatar/types.js +2 -0
  34. package/dist/components/Avatar/types.js.map +1 -0
  35. package/dist/components/AvatarGroup/index.js +36 -0
  36. package/dist/components/AvatarGroup/index.js.map +1 -0
  37. package/dist/components/AvatarGroup/styles.js +2 -0
  38. package/dist/components/AvatarGroup/styles.js.map +1 -0
  39. package/dist/components/AvatarGroup/types.js +2 -0
  40. package/dist/components/AvatarGroup/types.js.map +1 -0
  41. package/dist/components/Backdrop/index.js +34 -0
  42. package/dist/components/Backdrop/index.js.map +1 -0
  43. package/dist/components/Backdrop/styles.js +2 -0
  44. package/dist/components/Backdrop/styles.js.map +1 -0
  45. package/dist/components/Backdrop/types.js +2 -0
  46. package/dist/components/Backdrop/types.js.map +1 -0
  47. package/dist/components/Badge/index.js +66 -0
  48. package/dist/components/Badge/index.js.map +1 -0
  49. package/dist/components/Badge/styles.js +2 -0
  50. package/dist/components/Badge/styles.js.map +1 -0
  51. package/dist/components/Badge/types.js +2 -0
  52. package/dist/components/Badge/types.js.map +1 -0
  53. package/dist/components/Button/index.js +73 -0
  54. package/dist/components/Button/index.js.map +1 -0
  55. package/dist/components/Button/styles.js +2 -0
  56. package/dist/components/Button/styles.js.map +1 -0
  57. package/dist/components/Button/types.js +2 -0
  58. package/dist/components/Button/types.js.map +1 -0
  59. package/dist/components/Calendar/index.js +100 -0
  60. package/dist/components/Calendar/index.js.map +1 -0
  61. package/dist/components/Calendar/styles.js +2 -0
  62. package/dist/components/Calendar/styles.js.map +1 -0
  63. package/dist/components/Calendar/types.js +2 -0
  64. package/dist/components/Calendar/types.js.map +1 -0
  65. package/dist/components/CalendarInput/index.js +67 -0
  66. package/dist/components/CalendarInput/index.js.map +1 -0
  67. package/dist/components/CalendarInput/styles.js +2 -0
  68. package/dist/components/CalendarInput/styles.js.map +1 -0
  69. package/dist/components/CalendarInput/types.js +2 -0
  70. package/dist/components/CalendarInput/types.js.map +1 -0
  71. package/dist/components/Checkbox/index.js +85 -0
  72. package/dist/components/Checkbox/index.js.map +1 -0
  73. package/dist/components/Checkbox/styles.js +2 -0
  74. package/dist/components/Checkbox/styles.js.map +1 -0
  75. package/dist/components/Checkbox/types.js +2 -0
  76. package/dist/components/Checkbox/types.js.map +1 -0
  77. package/dist/components/Collapse/index.js +45 -0
  78. package/dist/components/Collapse/index.js.map +1 -0
  79. package/dist/components/Collapse/types.js +2 -0
  80. package/dist/components/Collapse/types.js.map +1 -0
  81. package/dist/components/DatePickerModal/index.js +107 -0
  82. package/dist/components/DatePickerModal/index.js.map +1 -0
  83. package/dist/components/DatePickerModal/styles.js +2 -0
  84. package/dist/components/DatePickerModal/styles.js.map +1 -0
  85. package/dist/components/DatePickerModal/types.js +2 -0
  86. package/dist/components/DatePickerModal/types.js.map +1 -0
  87. package/dist/components/EmptyPlaceholder/components/Button.js +15 -0
  88. package/dist/components/EmptyPlaceholder/components/Button.js.map +1 -0
  89. package/dist/components/EmptyPlaceholder/components/Content.js +36 -0
  90. package/dist/components/EmptyPlaceholder/components/Content.js.map +1 -0
  91. package/dist/components/EmptyPlaceholder/components/Illustration.js +9 -0
  92. package/dist/components/EmptyPlaceholder/components/Illustration.js.map +1 -0
  93. package/dist/components/EmptyPlaceholder/components/Info.js +9 -0
  94. package/dist/components/EmptyPlaceholder/components/Info.js.map +1 -0
  95. package/dist/components/EmptyPlaceholder/components/Loading.js +20 -0
  96. package/dist/components/EmptyPlaceholder/components/Loading.js.map +1 -0
  97. package/dist/components/EmptyPlaceholder/context.js +13 -0
  98. package/dist/components/EmptyPlaceholder/context.js.map +1 -0
  99. package/dist/components/EmptyPlaceholder/index.js +38 -0
  100. package/dist/components/EmptyPlaceholder/index.js.map +1 -0
  101. package/dist/components/EmptyPlaceholder/styles.js +2 -0
  102. package/dist/components/EmptyPlaceholder/styles.js.map +1 -0
  103. package/dist/components/EmptyPlaceholder/types.js +2 -0
  104. package/dist/components/EmptyPlaceholder/types.js.map +1 -0
  105. package/dist/components/FileInput/index.js +126 -0
  106. package/dist/components/FileInput/index.js.map +1 -0
  107. package/dist/components/FileInput/types.js +2 -0
  108. package/dist/components/FileInput/types.js.map +1 -0
  109. package/dist/components/Grid/index.js +65 -0
  110. package/dist/components/Grid/index.js.map +1 -0
  111. package/dist/components/Grid/styles.js +2 -0
  112. package/dist/components/Grid/styles.js.map +1 -0
  113. package/dist/components/Grid/types.js +2 -0
  114. package/dist/components/Grid/types.js.map +1 -0
  115. package/dist/components/Icon/index.js +59 -0
  116. package/dist/components/Icon/index.js.map +1 -0
  117. package/dist/components/Icon/styles.js +2 -0
  118. package/dist/components/Icon/styles.js.map +1 -0
  119. package/dist/components/Icon/types.js +2 -0
  120. package/dist/components/Icon/types.js.map +1 -0
  121. package/dist/components/Image/index.js +108 -0
  122. package/dist/components/Image/index.js.map +1 -0
  123. package/dist/components/Image/styles.js +2 -0
  124. package/dist/components/Image/styles.js.map +1 -0
  125. package/dist/components/Image/types.js +2 -0
  126. package/dist/components/Image/types.js.map +1 -0
  127. package/dist/components/ImageView/Spotlight.js +139 -0
  128. package/dist/components/ImageView/Spotlight.js.map +1 -0
  129. package/dist/components/ImageView/component.js +17 -0
  130. package/dist/components/ImageView/component.js.map +1 -0
  131. package/dist/components/ImageView/index.js +3 -0
  132. package/dist/components/ImageView/index.js.map +1 -0
  133. package/dist/components/InputBase/index.js +37 -0
  134. package/dist/components/InputBase/index.js.map +1 -0
  135. package/dist/components/InputBase/styles.js +98 -0
  136. package/dist/components/InputBase/styles.js.map +1 -0
  137. package/dist/components/InputBase/types.js +2 -0
  138. package/dist/components/InputBase/types.js.map +1 -0
  139. package/dist/components/InputBase/useInputBase.js +48 -0
  140. package/dist/components/InputBase/useInputBase.js.map +1 -0
  141. package/dist/components/InputBase/useInputBasePartialStyles.js +35 -0
  142. package/dist/components/InputBase/useInputBasePartialStyles.js.map +1 -0
  143. package/dist/components/InputBase/utils.js +31 -0
  144. package/dist/components/InputBase/utils.js.map +1 -0
  145. package/dist/components/InputOverlay/index.js +68 -0
  146. package/dist/components/InputOverlay/index.js.map +1 -0
  147. package/dist/components/InputOverlay/store.js +49 -0
  148. package/dist/components/InputOverlay/store.js.map +1 -0
  149. package/dist/components/InputOverlay/types.js +2 -0
  150. package/dist/components/InputOverlay/types.js.map +1 -0
  151. package/dist/components/List/index.js +66 -0
  152. package/dist/components/List/index.js.map +1 -0
  153. package/dist/components/List/styles.js +2 -0
  154. package/dist/components/List/styles.js.map +1 -0
  155. package/dist/components/List/types.js +2 -0
  156. package/dist/components/List/types.js.map +1 -0
  157. package/dist/components/LoadingOverlay/index.js +51 -0
  158. package/dist/components/LoadingOverlay/index.js.map +1 -0
  159. package/dist/components/LoadingOverlay/styles.js +2 -0
  160. package/dist/components/LoadingOverlay/styles.js.map +1 -0
  161. package/dist/components/LoadingOverlay/types.js +2 -0
  162. package/dist/components/LoadingOverlay/types.js.map +1 -0
  163. package/dist/components/Modal/index.js +76 -0
  164. package/dist/components/Modal/index.js.map +1 -0
  165. package/dist/components/Modal/styles.js +2 -0
  166. package/dist/components/Modal/styles.js.map +1 -0
  167. package/dist/components/Modal/types.js +2 -0
  168. package/dist/components/Modal/types.js.map +1 -0
  169. package/dist/components/NumberIncrement/index.js +120 -0
  170. package/dist/components/NumberIncrement/index.js.map +1 -0
  171. package/dist/components/NumberIncrement/styles.js +2 -0
  172. package/dist/components/NumberIncrement/styles.js.map +1 -0
  173. package/dist/components/NumberIncrement/types.js +2 -0
  174. package/dist/components/NumberIncrement/types.js.map +1 -0
  175. package/dist/components/NumberIncrement/useNumberIncrement.js +116 -0
  176. package/dist/components/NumberIncrement/useNumberIncrement.js.map +1 -0
  177. package/dist/components/Pager/PagerDots.js +19 -0
  178. package/dist/components/Pager/PagerDots.js.map +1 -0
  179. package/dist/components/Pager/PagerItem.js +14 -0
  180. package/dist/components/Pager/PagerItem.js.map +1 -0
  181. package/dist/components/Pager/index.js +78 -0
  182. package/dist/components/Pager/index.js.map +1 -0
  183. package/dist/components/Pager/styles.js +2 -0
  184. package/dist/components/Pager/styles.js.map +1 -0
  185. package/dist/components/Pager/types.js +2 -0
  186. package/dist/components/Pager/types.js.map +1 -0
  187. package/dist/components/PaginationIndicator/index.js +36 -0
  188. package/dist/components/PaginationIndicator/index.js.map +1 -0
  189. package/dist/components/PaginationIndicator/styles.js +2 -0
  190. package/dist/components/PaginationIndicator/styles.js.map +1 -0
  191. package/dist/components/PaginationIndicator/types.js +2 -0
  192. package/dist/components/PaginationIndicator/types.js.map +1 -0
  193. package/dist/components/PlacesAutocomplete/index.js +71 -0
  194. package/dist/components/PlacesAutocomplete/index.js.map +1 -0
  195. package/dist/components/PlacesAutocomplete/styles.js +2 -0
  196. package/dist/components/PlacesAutocomplete/styles.js.map +1 -0
  197. package/dist/components/PlacesAutocomplete/types.js +2 -0
  198. package/dist/components/PlacesAutocomplete/types.js.map +1 -0
  199. package/dist/components/RadioInput/index.js +47 -0
  200. package/dist/components/RadioInput/index.js.map +1 -0
  201. package/dist/components/RadioInput/styles.js +2 -0
  202. package/dist/components/RadioInput/styles.js.map +1 -0
  203. package/dist/components/RadioInput/types.js +2 -0
  204. package/dist/components/RadioInput/types.js.map +1 -0
  205. package/dist/components/RefreshControl/index.js +27 -0
  206. package/dist/components/RefreshControl/index.js.map +1 -0
  207. package/dist/components/RefreshControl/styles.js +2 -0
  208. package/dist/components/RefreshControl/styles.js.map +1 -0
  209. package/dist/components/RefreshControl/types.js +2 -0
  210. package/dist/components/RefreshControl/types.js.map +1 -0
  211. package/dist/components/Scroll/index.js +40 -0
  212. package/dist/components/Scroll/index.js.map +1 -0
  213. package/dist/components/Scroll/styles.js +2 -0
  214. package/dist/components/Scroll/styles.js.map +1 -0
  215. package/dist/components/Scroll/types.js +2 -0
  216. package/dist/components/Scroll/types.js.map +1 -0
  217. package/dist/components/SearchInput/index.js +48 -0
  218. package/dist/components/SearchInput/index.js.map +1 -0
  219. package/dist/components/SectionFilters/context.js +6 -0
  220. package/dist/components/SectionFilters/context.js.map +1 -0
  221. package/dist/components/SectionFilters/index.js +47 -0
  222. package/dist/components/SectionFilters/index.js.map +1 -0
  223. package/dist/components/SectionFilters/types.js +2 -0
  224. package/dist/components/SectionFilters/types.js.map +1 -0
  225. package/dist/components/SectionFilters/useSectionFilters.js +148 -0
  226. package/dist/components/SectionFilters/useSectionFilters.js.map +1 -0
  227. package/dist/components/Sections/index.js +105 -0
  228. package/dist/components/Sections/index.js.map +1 -0
  229. package/dist/components/Sections/styles.js +2 -0
  230. package/dist/components/Sections/styles.js.map +1 -0
  231. package/dist/components/Sections/types.js +2 -0
  232. package/dist/components/Sections/types.js.map +1 -0
  233. package/dist/components/SegmentedControl/Option.js +20 -0
  234. package/dist/components/SegmentedControl/Option.js.map +1 -0
  235. package/dist/components/SegmentedControl/index.js +130 -0
  236. package/dist/components/SegmentedControl/index.js.map +1 -0
  237. package/dist/components/SegmentedControl/styles.js +2 -0
  238. package/dist/components/SegmentedControl/styles.js.map +1 -0
  239. package/dist/components/SegmentedControl/types.js +2 -0
  240. package/dist/components/SegmentedControl/types.js.map +1 -0
  241. package/dist/components/Select/index.js +204 -0
  242. package/dist/components/Select/index.js.map +1 -0
  243. package/dist/components/Select/styles.js +2 -0
  244. package/dist/components/Select/styles.js.map +1 -0
  245. package/dist/components/Select/types.js +2 -0
  246. package/dist/components/Select/types.js.map +1 -0
  247. package/dist/components/Slider/index.js +99 -0
  248. package/dist/components/Slider/index.js.map +1 -0
  249. package/dist/components/Slider/styles.js +2 -0
  250. package/dist/components/Slider/styles.js.map +1 -0
  251. package/dist/components/Slider/types.js +2 -0
  252. package/dist/components/Slider/types.js.map +1 -0
  253. package/dist/components/SortablePhotos/index.js +85 -0
  254. package/dist/components/SortablePhotos/index.js.map +1 -0
  255. package/dist/components/SortablePhotos/styles.js +2 -0
  256. package/dist/components/SortablePhotos/styles.js.map +1 -0
  257. package/dist/components/SortablePhotos/types.js +2 -0
  258. package/dist/components/SortablePhotos/types.js.map +1 -0
  259. package/dist/components/SortablePhotos/useSortablePhotos.js +143 -0
  260. package/dist/components/SortablePhotos/useSortablePhotos.js.map +1 -0
  261. package/dist/components/Switch/index.js +81 -0
  262. package/dist/components/Switch/index.js.map +1 -0
  263. package/dist/components/Switch/styles.js +2 -0
  264. package/dist/components/Switch/styles.js.map +1 -0
  265. package/dist/components/Switch/types.js +2 -0
  266. package/dist/components/Switch/types.js.map +1 -0
  267. package/dist/components/Tabs/Context.js +44 -0
  268. package/dist/components/Tabs/Context.js.map +1 -0
  269. package/dist/components/Tabs/Panel.js +21 -0
  270. package/dist/components/Tabs/Panel.js.map +1 -0
  271. package/dist/components/Tabs/Tab.js +28 -0
  272. package/dist/components/Tabs/Tab.js.map +1 -0
  273. package/dist/components/Tabs/TabList.js +16 -0
  274. package/dist/components/Tabs/TabList.js.map +1 -0
  275. package/dist/components/Tabs/index.js +34 -0
  276. package/dist/components/Tabs/index.js.map +1 -0
  277. package/dist/components/Tabs/styles.js +2 -0
  278. package/dist/components/Tabs/styles.js.map +1 -0
  279. package/dist/components/Tabs/types.js +2 -0
  280. package/dist/components/Tabs/types.js.map +1 -0
  281. package/dist/components/Text/index.js +82 -0
  282. package/dist/components/Text/index.js.map +1 -0
  283. package/dist/components/Text/styles.js +2 -0
  284. package/dist/components/Text/styles.js.map +1 -0
  285. package/dist/components/Text/types.js +2 -0
  286. package/dist/components/Text/types.js.map +1 -0
  287. package/dist/components/TextInput/index.js +99 -0
  288. package/dist/components/TextInput/index.js.map +1 -0
  289. package/dist/components/TextInput/styles.js +2 -0
  290. package/dist/components/TextInput/styles.js.map +1 -0
  291. package/dist/components/TextInput/types.js +2 -0
  292. package/dist/components/TextInput/types.js.map +1 -0
  293. package/dist/components/TextInput/useTextInput.js +66 -0
  294. package/dist/components/TextInput/useTextInput.js.map +1 -0
  295. package/dist/components/TimeInput/index.js +50 -0
  296. package/dist/components/TimeInput/index.js.map +1 -0
  297. package/dist/components/TimeInput/styles.js +2 -0
  298. package/dist/components/TimeInput/styles.js.map +1 -0
  299. package/dist/components/TimeInput/types.js +2 -0
  300. package/dist/components/TimeInput/types.js.map +1 -0
  301. package/dist/components/Touchable/index.js +170 -0
  302. package/dist/components/Touchable/index.js.map +1 -0
  303. package/dist/components/Touchable/styles.js +2 -0
  304. package/dist/components/Touchable/styles.js.map +1 -0
  305. package/dist/components/Touchable/types.js +2 -0
  306. package/dist/components/Touchable/types.js.map +1 -0
  307. package/dist/components/View/index.js +28 -0
  308. package/dist/components/View/index.js.map +1 -0
  309. package/dist/components/View/styles.js +2 -0
  310. package/dist/components/View/styles.js.map +1 -0
  311. package/dist/components/View/types.js +2 -0
  312. package/dist/components/View/types.js.map +1 -0
  313. package/dist/components/components.js +46 -0
  314. package/dist/components/components.js.map +1 -0
  315. package/dist/hooks/index.js +6 -0
  316. package/dist/hooks/index.js.map +1 -0
  317. package/dist/hooks/useAnimatedState.js +28 -0
  318. package/dist/hooks/useAnimatedState.js.map +1 -0
  319. package/dist/hooks/useAppState.js +16 -0
  320. package/dist/hooks/useAppState.js.map +1 -0
  321. package/dist/hooks/useKeyboardController.js +22 -0
  322. package/dist/hooks/useKeyboardController.js.map +1 -0
  323. package/dist/hooks/useStatusBar.js +18 -0
  324. package/dist/hooks/useStatusBar.js.map +1 -0
  325. package/dist/hooks/useStylesFor.js +13 -0
  326. package/dist/hooks/useStylesFor.js.map +1 -0
  327. package/dist/index.js +11 -0
  328. package/dist/index.js.map +1 -0
  329. package/dist/modules/PressableRipple/index.js +3 -0
  330. package/dist/modules/PressableRipple/index.js.map +1 -0
  331. package/dist/modules/PressableRipple/ripple.js +168 -0
  332. package/dist/modules/PressableRipple/ripple.js.map +1 -0
  333. package/dist/modules/PressableRipple/styles.js +18 -0
  334. package/dist/modules/PressableRipple/styles.js.map +1 -0
  335. package/dist/modules/PressableRipple/type.js +2 -0
  336. package/dist/modules/PressableRipple/type.js.map +1 -0
  337. package/dist/modules/backgroundTimer.js +33 -0
  338. package/dist/modules/backgroundTimer.js.map +1 -0
  339. package/dist/modules/formConfig.js +26 -0
  340. package/dist/modules/formConfig.js.map +1 -0
  341. package/dist/modules/index.js +3 -0
  342. package/dist/modules/index.js.map +1 -0
  343. package/dist/modules/reactNavigation.js +39 -0
  344. package/dist/modules/reactNavigation.js.map +1 -0
  345. package/dist/modules/scroll.js +59 -0
  346. package/dist/modules/scroll.js.map +1 -0
  347. package/dist/modules/textInputMask.js +7 -0
  348. package/dist/modules/textInputMask.js.map +1 -0
  349. package/dist/modules/types/textInputMask.js +2 -0
  350. package/dist/modules/types/textInputMask.js.map +1 -0
  351. package/dist/types/index.js +2 -0
  352. package/dist/types/index.js.map +1 -0
  353. package/dist/types/utility.js +2 -0
  354. package/dist/types/utility.js.map +1 -0
  355. package/dist/utils/NotificationManager/index.js +170 -0
  356. package/dist/utils/NotificationManager/index.js.map +1 -0
  357. package/dist/utils/NotificationManager/types.js +2 -0
  358. package/dist/utils/NotificationManager/types.js.map +1 -0
  359. package/dist/utils/OSAlert.js +128 -0
  360. package/dist/utils/OSAlert.js.map +1 -0
  361. package/dist/utils/StorageManager.js +84 -0
  362. package/dist/utils/StorageManager.js.map +1 -0
  363. package/dist/utils/Subscription.js +48 -0
  364. package/dist/utils/Subscription.js.map +1 -0
  365. package/dist/utils/hooks.js +199 -0
  366. package/dist/utils/hooks.js.map +1 -0
  367. package/dist/utils/index.js +11 -0
  368. package/dist/utils/index.js.map +1 -0
  369. package/dist/utils/input.js +45 -0
  370. package/dist/utils/input.js.map +1 -0
  371. package/dist/utils/locale.js +11 -0
  372. package/dist/utils/locale.js.map +1 -0
  373. package/dist/utils/misc.js +111 -0
  374. package/dist/utils/misc.js.map +1 -0
  375. package/dist/utils/theme.js +37 -0
  376. package/dist/utils/theme.js.map +1 -0
  377. package/dist/utils/useQueryListRefresh.js +33 -0
  378. package/dist/utils/useQueryListRefresh.js.map +1 -0
  379. package/package.json +19 -19
@@ -0,0 +1,107 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React, { useMemo, useRef } from 'react';
3
+ import { TypeGuards } from '@codeleap/types';
4
+ import { useConditionalState } from '@codeleap/hooks';
5
+ import DatePicker from 'react-native-date-picker';
6
+ import { Modal } from '../Modal';
7
+ import { TextInput } from '../TextInput';
8
+ import { Button } from '../Button';
9
+ import { useCompositionStyles } from '@codeleap/styles';
10
+ import { MobileStyleRegistry } from '../../Registry';
11
+ import { useStylesFor } from '../../hooks';
12
+ import { fields } from '@codeleap/form';
13
+ import { useInputBase } from '../InputBase/useInputBase';
14
+ export * from './styles';
15
+ export * from './types';
16
+ const OuterInputComponent = (props) => {
17
+ const { debugName, toggle, valueLabel, placeholder, ...otherProps } = props;
18
+ return _jsx(TextInput, { debugName: `${debugName} outer input`, onPress: toggle, ...otherProps, value: TypeGuards.isString(valueLabel) ? valueLabel : '', placeholder: TypeGuards.isString(placeholder) ? placeholder : '' });
19
+ };
20
+ /** Uses local `Date` getters (not UTC), so the displayed string shifts with the device timezone. Pass a custom `formatDate` to normalise if the stored value is UTC. */
21
+ const defaultFormatDate = (_date) => {
22
+ if (!_date)
23
+ return null;
24
+ const date = new Date(_date);
25
+ return `${date.getDate()}/${date.getMonth() + 1}/${date.getFullYear()}`;
26
+ };
27
+ const DefaultFooter = (props) => {
28
+ const { debugName, commitDate, showDoneButton, confirm, confirmButtonProps = {}, cancelButtonProps = {}, toggle, cancelStyles, confirmStyles, doneStyles, } = props;
29
+ if (commitDate == 'onConfirm') {
30
+ return _jsxs(_Fragment, { children: [_jsx(Button, { debugName: `${debugName} cancel button`, style: cancelStyles, text: `Cancel`, onPress: toggle, ...cancelButtonProps }), _jsx(Button, { debugName: `${debugName} confirm button`, style: confirmStyles, text: `Confirm`, onPress: confirm, ...confirmButtonProps })] });
31
+ }
32
+ if (!showDoneButton)
33
+ return null;
34
+ return _jsx(Button, { debugName: `${debugName} done button`, onPress: confirm, text: 'Done', style: doneStyles });
35
+ };
36
+ export const DatePickerModal = (props) => {
37
+ const allProps = {
38
+ ...DatePickerModal.defaultProps,
39
+ ...props,
40
+ };
41
+ const { field, isCustomModal, hideInput, visible: _visible, toggle: _toggle, formatDate, debugName, cancelButtonProps = {}, confirmButtonProps = {}, outerInputComponent: OuterInput, datePickerProps, mode, label, commitDate, description, showDoneButton, style, minimumDate, maximumDate, initialDate = minimumDate, footerComponent: Footer, toggleOnConfirm, onConfirm: _onConfirm, value, onValueChange, locale, ...modalProps } = allProps;
42
+ const styles = useStylesFor(DatePickerModal.styleRegistryName, style);
43
+ const [visible, toggle] = useConditionalState(_visible, _toggle, { initialValue: false, isBooleanToggle: true });
44
+ const { inputValue, onInputValueChange, } = useInputBase(field, fields.date, { value, onValueChange });
45
+ const Wrapper = isCustomModal ? Modal : React.Fragment;
46
+ const compositionStyles = useCompositionStyles(['input', 'doneButton', 'cancelButton', 'confirmButton'], styles);
47
+ const formattedDate = inputValue ? formatDate(inputValue) : '';
48
+ /**
49
+ * Staging ref for `commitDate === 'onConfirm'` mode: the picker fires `onDateChange` on every
50
+ * scroll tick, so writing to state there would cause excessive re-renders. Value is committed
51
+ * only when the user taps Confirm.
52
+ */
53
+ const tempDate = useRef(initialDate instanceof Date ? initialDate : new Date(initialDate));
54
+ const onConfirm = () => {
55
+ if (commitDate == 'onConfirm' && !!tempDate.current) {
56
+ onInputValueChange(tempDate.current);
57
+ }
58
+ if (isCustomModal && toggleOnConfirm) {
59
+ toggle();
60
+ }
61
+ if (TypeGuards.isFunction(_onConfirm)) {
62
+ _onConfirm?.(tempDate.current);
63
+ }
64
+ };
65
+ const modalFooter = _jsx(Footer, { ...allProps, confirm: onConfirm, doneStyles: compositionStyles?.doneButton, cancelStyles: compositionStyles?.cancelButton, confirmStyles: compositionStyles?.confirmButton, confirmButtonProps: confirmButtonProps, cancelButtonProps: cancelButtonProps, showDoneButton: showDoneButton, debugName: debugName, visible: visible, toggle: toggle, valueLabel: formattedDate });
66
+ const wrapperProps = isCustomModal ? {
67
+ title: label,
68
+ description: description,
69
+ debugName: `${debugName} Modal`,
70
+ visible: visible,
71
+ toggle: toggle,
72
+ style: styles,
73
+ footer: modalFooter,
74
+ ...modalProps,
75
+ id: null,
76
+ } : {};
77
+ const date = useMemo(() => {
78
+ const newValue = inputValue ?? initialDate;
79
+ return newValue instanceof Date ? newValue : new Date(newValue);
80
+ }, [inputValue, initialDate]);
81
+ return (_jsxs(_Fragment, { children: [!hideInput ? _jsx(OuterInput, { ...allProps, style: compositionStyles?.input, value: inputValue, debugName: debugName, visible: visible, toggle: toggle, onValueChange: onInputValueChange, valueLabel: formattedDate }) : null, _jsx(Wrapper, { ...wrapperProps, children: _jsx(DatePicker, { modal: !isCustomModal, open: visible, onCancel: toggle, date: date, onDateChange: (currentDate) => {
82
+ tempDate.current = currentDate;
83
+ if (commitDate === 'onChange') {
84
+ onInputValueChange(currentDate);
85
+ }
86
+ }, locale: locale,
87
+ // @ts-expect-error
88
+ textColor: styles?.picker?.color, theme: 'light', androidVariant: 'iosClone', onConfirm: onInputValueChange, minimumDate: minimumDate, maximumDate: maximumDate, ...datePickerProps, mode: mode }) })] }));
89
+ };
90
+ DatePickerModal.styleRegistryName = 'DatePickerModal';
91
+ DatePickerModal.elements = [...Modal.elements, 'input', 'picker', 'doneButton', 'confirmButton', 'cancelButton'];
92
+ DatePickerModal.rootElement = 'inputWrapper';
93
+ DatePickerModal.withVariantTypes = (styles) => {
94
+ return DatePickerModal;
95
+ };
96
+ DatePickerModal.defaultProps = {
97
+ outerInputComponent: OuterInputComponent,
98
+ formatDate: defaultFormatDate,
99
+ footerComponent: DefaultFooter,
100
+ mode: 'date',
101
+ commitDate: 'onConfirm',
102
+ showDoneButton: true,
103
+ isCustomModal: true,
104
+ toggleOnConfirm: true,
105
+ };
106
+ MobileStyleRegistry.registerComponent(DatePickerModal);
107
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/DatePickerModal/index.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM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AAS,EAAE,EAAE;IACpE,OAAO,eAA6F,CAAA;AACtG,CAAC,CAAA;AAED,eAAe,CAAC,YAAY,GAAG;IAC7B,mBAAmB,EAAE,mBAAmB;IACxC,UAAU,EAAE,iBAAiB;IAC7B,eAAe,EAAE,aAAa;IAC9B,IAAI,EAAE,MAAM;IACZ,UAAU,EAAE,WAAW;IACvB,cAAc,EAAE,IAAI;IACpB,aAAa,EAAE,IAAI;IACnB,eAAe,EAAE,IAAI;CACW,CAAA;AAElC,mBAAmB,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/components/DatePickerModal/styles.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/DatePickerModal/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useCompositionStyles } from '@codeleap/styles';
3
+ import { useEmptyPlaceholderContext } from '../context';
4
+ import { Button } from '../../Button';
5
+ import { TypeGuards } from '@codeleap/types';
6
+ /** Renders nothing unless `onPress` is a function — absence of a handler is the gate, not a `visible` prop. */
7
+ export const EmptyPlaceholderButton = (props) => {
8
+ const { styles, buttonText, text, onPress, ...buttonProps } = useEmptyPlaceholderContext(props);
9
+ const buttonStyles = useCompositionStyles('button', styles);
10
+ const displayText = text || buttonText;
11
+ if (!TypeGuards.isFunction(onPress))
12
+ return null;
13
+ return (_jsx(Button, { ...buttonProps, onPress: onPress, debugName: `emptyPlaceholderButton:${buttonText}`, style: buttonStyles, text: displayText }));
14
+ };
15
+ //# sourceMappingURL=Button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../../src/components/EmptyPlaceholder/components/Button.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AAEvD,OAAO,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAA;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE5C,+GAA+G;AAC/G,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,KAAkC,EAAE,EAAE;IAC3E,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,WAAW,EAAE,GAAG,0BAA0B,CAAC,KAAK,CAAC,CAAA;IAE/F,MAAM,YAAY,GAAG,oBAAoB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;IAE3D,MAAM,WAAW,GAAG,IAAI,IAAI,UAAU,CAAA;IAEtC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,OAAO,CAAC;QAAE,OAAO,IAAI,CAAA;IAEhD,OAAO,CACL,KAAC,MAAM,OACD,WAAW,EACf,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,0BAA0B,UAAU,EAAE,EACjD,KAAK,EAAE,YAAY,EACnB,IAAI,EAAE,WAAW,GACjB,CACH,CAAA;AACH,CAAC,CAAA"}
@@ -0,0 +1,36 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useEmptyPlaceholderContext } from '../context';
3
+ import { View } from '../../View';
4
+ import { logger } from '@codeleap/logger';
5
+ import { EmptyPlaceholderLoading } from './Loading';
6
+ import { EmptyPlaceholderButton } from './Button';
7
+ import { EmptyPlaceholderInfo } from './Info';
8
+ import { EmptyPlaceholderIllustration } from './Illustration';
9
+ const orderMap = {
10
+ illustration: EmptyPlaceholderIllustration,
11
+ info: EmptyPlaceholderInfo,
12
+ button: EmptyPlaceholderButton,
13
+ };
14
+ /**
15
+ * Acts as the layout root and the loading/content switch.
16
+ * When `loading` is true the entire content tree is replaced by the loading state —
17
+ * `order` and `children` are ignored until loading becomes false.
18
+ */
19
+ export const EmptyPlaceholderContent = ({ children }) => {
20
+ const { loading, styles, order } = useEmptyPlaceholderContext();
21
+ if (loading) {
22
+ return _jsx(EmptyPlaceholderLoading, {});
23
+ }
24
+ if (children) {
25
+ return _jsx(View, { style: styles.wrapper, children: children });
26
+ }
27
+ return (_jsx(View, { style: styles.wrapper, children: order.map(componentKey => {
28
+ const Component = orderMap[componentKey];
29
+ if (!Component) {
30
+ logger.warn(`[EmptyPlaceholder] Component "${componentKey}" not found in orderMap`);
31
+ return null;
32
+ }
33
+ return _jsx(Component, {}, 'emptyPlaceholder:' + componentKey);
34
+ }) }));
35
+ };
36
+ //# sourceMappingURL=Content.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Content.js","sourceRoot":"","sources":["../../../../src/components/EmptyPlaceholder/components/Content.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAA;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAA;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAA;AAC7C,OAAO,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAA;AAG7D,MAAM,QAAQ,GAAmD;IAC/D,YAAY,EAAE,4BAA4B;IAC1C,IAAI,EAAE,oBAAoB;IAC1B,MAAM,EAAE,sBAAsB;CAC/B,CAAA;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,EAAE,QAAQ,EAA2B,EAAE,EAAE;IAC/E,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,0BAA0B,EAAE,CAAA;IAE/D,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,KAAC,uBAAuB,KAAG,CAAA;IACpC,CAAC;IAED,IAAI,QAAQ,EAAE,CAAC;QACb,OAAO,KAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,OAAO,YAAG,QAAQ,GAAQ,CAAA;IACvD,CAAC;IAED,OAAO,CACL,KAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,OAAO,YACxB,KAAK,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE;YACxB,MAAM,SAAS,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAA;YAExC,IAAI,CAAC,SAAS,EAAE,CAAC;gBACf,MAAM,CAAC,IAAI,CAAC,iCAAiC,YAAY,yBAAyB,CAAC,CAAA;gBACnF,OAAO,IAAI,CAAA;YACb,CAAC;YAED,OAAO,KAAC,SAAS,MAAM,mBAAmB,GAAG,YAAY,CAAI,CAAA;QAC/D,CAAC,CAAC,GACG,CACR,CAAA;AACH,CAAC,CAAA"}
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Icon } from '../../Icon';
3
+ import { Image } from '../../Image';
4
+ import { useEmptyPlaceholderContext } from '../context';
5
+ export const EmptyPlaceholderIllustration = (props) => {
6
+ const { icon, image, styles } = useEmptyPlaceholderContext(props);
7
+ return _jsxs(_Fragment, { children: [icon ? _jsx(Icon, { name: icon, style: styles.icon }) : null, image ? _jsx(Image, { source: image, style: styles.image }) : null] });
8
+ };
9
+ //# sourceMappingURL=Illustration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Illustration.js","sourceRoot":"","sources":["../../../../src/components/EmptyPlaceholder/components/Illustration.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAEjC,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACnC,OAAO,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAA;AAEvD,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,KAAwC,EAAE,EAAE;IACvF,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,0BAA0B,CAAC,KAAK,CAAC,CAAA;IAEjE,OAAO,8BACJ,IAAI,CAAC,CAAC,CAAC,KAAC,IAAI,IAAC,IAAI,EAAE,IAAe,EAAE,KAAK,EAAE,MAAM,CAAC,IAAI,GAAI,CAAC,CAAC,CAAC,IAAI,EACjE,KAAK,CAAC,CAAC,CAAC,KAAC,KAAK,IAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,GAAI,CAAC,CAAC,CAAC,IAAI,IAC5D,CAAA;AACL,CAAC,CAAA"}
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Text } from '../../Text';
3
+ import { useEmptyPlaceholderContext } from '../context';
4
+ export const EmptyPlaceholderInfo = (props) => {
5
+ const { title, description, styles, itemName } = useEmptyPlaceholderContext(props);
6
+ const emptyText = title || (itemName && `No ${itemName} found.`);
7
+ return _jsxs(_Fragment, { children: [title || itemName ? _jsx(Text, { text: emptyText, style: styles.title }) : null, description ? _jsx(Text, { text: description, style: styles.description }) : null] });
8
+ };
9
+ //# sourceMappingURL=Info.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Info.js","sourceRoot":"","sources":["../../../../src/components/EmptyPlaceholder/components/Info.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAEjC,OAAO,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAA;AAEvD,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,KAAgC,EAAE,EAAE;IACvE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,0BAA0B,CAAC,KAAK,CAAC,CAAA;IAElF,MAAM,SAAS,GAAG,KAAK,IAAI,CAAC,QAAQ,IAAI,MAAM,QAAQ,SAAS,CAAC,CAAA;IAEhE,OAAO,8BACJ,KAAK,IAAI,QAAQ,CAAC,CAAC,CAAC,KAAC,IAAI,IAAC,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,GAAI,CAAC,CAAC,CAAC,IAAI,EACzE,WAAW,CAAC,CAAC,CAAC,KAAC,IAAI,IAAC,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,CAAC,WAAW,GAAI,CAAC,CAAC,CAAC,IAAI,IAC3E,CAAA;AACL,CAAC,CAAA"}
@@ -0,0 +1,20 @@
1
+ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
+ import React from 'react';
3
+ import { useCompositionStyles } from '@codeleap/styles';
4
+ import { useEmptyPlaceholderContext } from '../context';
5
+ import { View } from '../../View';
6
+ import { ActivityIndicator } from '../../ActivityIndicator';
7
+ export const EmptyPlaceholderLoading = () => {
8
+ const { styles, loading, LoadingComponent } = useEmptyPlaceholderContext();
9
+ const activityIndicatorStyles = useCompositionStyles('loader', styles);
10
+ if (!loading)
11
+ return null;
12
+ /** `LoadingComponent` is accepted as a pre-rendered element (not a component class/function),
13
+ * so callers must pass `<MySpinner />`, not `MySpinner`. Passing a component reference will
14
+ * fail the `isValidElement` check and fall through to the default ActivityIndicator. */
15
+ if (React.isValidElement(LoadingComponent)) {
16
+ return _jsx(_Fragment, { children: LoadingComponent });
17
+ }
18
+ return (_jsx(View, { style: [styles.wrapper, styles['wrapper:loading']], children: _jsx(ActivityIndicator, { style: activityIndicatorStyles }) }));
19
+ };
20
+ //# sourceMappingURL=Loading.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Loading.js","sourceRoot":"","sources":["../../../../src/components/EmptyPlaceholder/components/Loading.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAA;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AACjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAE3D,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,EAAE;IAC1C,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,EAAE,GAAG,0BAA0B,EAAE,CAAA;IAE1E,MAAM,uBAAuB,GAAG,oBAAoB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;IAEtE,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAA;IAEzB;;6FAEyF;IACzF,IAAI,KAAK,CAAC,cAAc,CAAC,gBAAgB,CAAC,EAAE,CAAC;QAC3C,OAAO,4BAAG,gBAAgB,GAAI,CAAA;IAChC,CAAC;IAED,OAAO,CACL,KAAC,IAAI,IAAC,KAAK,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,iBAAiB,CAAC,CAAC,YACtD,KAAC,iBAAiB,IAAC,KAAK,EAAE,uBAAuB,GAAI,GAChD,CACR,CAAA;AACH,CAAC,CAAA"}
@@ -0,0 +1,13 @@
1
+ import { createContext, useContext } from 'react';
2
+ export const EmptyPlaceholderContext = createContext({});
3
+ export const useEmptyPlaceholderContext = (providedProps = {}) => {
4
+ const ctx = useContext(EmptyPlaceholderContext);
5
+ if (!ctx) {
6
+ throw new Error('[EmptyPlaceholder] useEmptyPlaceholderContext must be used within an EmptyPlaceholder component.');
7
+ }
8
+ return {
9
+ ...ctx,
10
+ ...providedProps,
11
+ };
12
+ };
13
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/components/EmptyPlaceholder/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAGjD,MAAM,CAAC,MAAM,uBAAuB,GAAG,aAAa,CAAC,EAA8B,CAAC,CAAA;AAEpF,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAA+B,gBAA4B,EAAE,EAAE,EAAE;IACzG,MAAM,GAAG,GAAG,UAAU,CAAC,uBAAuB,CAAC,CAAA;IAE/C,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,IAAI,KAAK,CACb,kGAAkG,CACnG,CAAA;IACH,CAAC;IAED,OAAO;QACL,GAAG,GAAG;QACN,GAAG,aAAa;KACjB,CAAA;AACH,CAAC,CAAA"}
@@ -0,0 +1,38 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { MobileStyleRegistry } from '../../Registry';
3
+ import { useStylesFor } from '../../hooks';
4
+ import { EmptyPlaceholderContext } from './context';
5
+ import { EmptyPlaceholderInfo } from './components/Info';
6
+ import { EmptyPlaceholderButton } from './components/Button';
7
+ import { EmptyPlaceholderIllustration } from './components/Illustration';
8
+ import { EmptyPlaceholderContent } from './components/Content';
9
+ export * from './styles';
10
+ export * from './types';
11
+ /**
12
+ * Compound component — all props are forwarded to context so sub-components
13
+ * (Info, Button, Illustration) can be placed anywhere inside children without prop drilling.
14
+ * The `order` prop only controls the default slot rendering; when `children` is provided it
15
+ * bypasses the order map entirely and renders children directly inside the wrapper.
16
+ */
17
+ export const EmptyPlaceholder = (props) => {
18
+ const { children, style, ...contextValue } = {
19
+ ...EmptyPlaceholder.defaultProps,
20
+ ...props,
21
+ };
22
+ const styles = useStylesFor(EmptyPlaceholder.styleRegistryName, style);
23
+ return (_jsx(EmptyPlaceholderContext.Provider, { value: { ...contextValue, styles }, children: _jsx(EmptyPlaceholderContent, { children: children }) }));
24
+ };
25
+ EmptyPlaceholder.styleRegistryName = 'EmptyPlaceholder';
26
+ EmptyPlaceholder.elements = ['wrapper', 'loader', 'title', 'description', 'image', 'icon'];
27
+ EmptyPlaceholder.rootElement = 'wrapper';
28
+ EmptyPlaceholder.Info = EmptyPlaceholderInfo;
29
+ EmptyPlaceholder.Button = EmptyPlaceholderButton;
30
+ EmptyPlaceholder.Illustration = EmptyPlaceholderIllustration;
31
+ EmptyPlaceholder.withVariantTypes = (styles) => {
32
+ return EmptyPlaceholder;
33
+ };
34
+ EmptyPlaceholder.defaultProps = {
35
+ order: ['illustration', 'info', 'button']
36
+ };
37
+ MobileStyleRegistry.registerComponent(EmptyPlaceholder);
38
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/EmptyPlaceholder/index.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAA;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAA;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAA;AAC5D,OAAO,EAAE,4BAA4B,EAAE,MAAM,2BAA2B,CAAA;AACxE,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAA;AAE9D,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AAEvB;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,KAA4B,EAAE,EAAE;IAC/D,MAAM,EACJ,QAAQ,EACR,KAAK,EACL,GAAG,YAAY,EAChB,GAAG;QACF,GAAG,gBAAgB,CAAC,YAAY;QAChC,GAAG,KAAK;KACT,CAAA;IAED,MAAM,MAAM,GAAG,YAAY,CAAC,gBAAgB,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAA;IAEtE,OAAO,CACL,KAAC,uBAAuB,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,GAAG,YAAY,EAAE,MAAM,EAAE,YAClE,KAAC,uBAAuB,cACrB,QAAQ,GACe,GACO,CACpC,CAAA;AACH,CAAC,CAAA;AAED,gBAAgB,CAAC,iBAAiB,GAAG,kBAAkB,CAAA;AACvD,gBAAgB,CAAC,QAAQ,GAAG,CAAC,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,CAAC,CAAA;AAC1F,gBAAgB,CAAC,WAAW,GAAG,SAAS,CAAA;AAExC,gBAAgB,CAAC,IAAI,GAAG,oBAAoB,CAAA;AAC5C,gBAAgB,CAAC,MAAM,GAAG,sBAAsB,CAAA;AAChD,gBAAgB,CAAC,YAAY,GAAG,4BAA4B,CAAA;AAE5D,gBAAgB,CAAC,gBAAgB,GAAG,CAAsB,MAAS,EAAE,EAAE;IACrE,OAAO,gBAAqK,CAAA;AAC9K,CAAC,CAAA;AAED,gBAAgB,CAAC,YAAY,GAAG;IAC9B,KAAK,EAAE,CAAC,cAAc,EAAE,MAAM,EAAE,QAAQ,CAAC;CACR,CAAA;AAEnC,mBAAmB,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/components/EmptyPlaceholder/styles.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/EmptyPlaceholder/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,126 @@
1
+ import { forwardRef, useImperativeHandle, useRef } from 'react';
2
+ import { parseFilePathData } from '@codeleap/utils';
3
+ import ImageCropPicker from 'react-native-image-crop-picker';
4
+ import { alert } from '@codeleap/portals';
5
+ export * from './types';
6
+ const pickerDefaults = {
7
+ cropping: true,
8
+ };
9
+ function parsePickerData(data) {
10
+ const filePathData = parseFilePathData(data.path);
11
+ const file = {
12
+ ...data,
13
+ name: filePathData.name,
14
+ size: data.size,
15
+ type: data.mime,
16
+ uri: data.path,
17
+ fileCopyUri: data.path,
18
+ };
19
+ return {
20
+ file,
21
+ preview: data.path,
22
+ };
23
+ }
24
+ const _FileInput = forwardRef((fileInputProps, ref) => {
25
+ const { onFileSelect, type = 'image', pickerOptions, onOpenGallery = null, onOpenFileSystem = null, alertProps, } = {
26
+ ...fileInputProps,
27
+ ...FileInput.defaultProps,
28
+ };
29
+ const resolveWithFile = useRef(undefined);
30
+ const handleResolve = (files) => {
31
+ if (resolveWithFile.current) {
32
+ resolveWithFile?.current?.(files);
33
+ resolveWithFile.current = null;
34
+ }
35
+ onFileSelect?.(files);
36
+ };
37
+ const mergedOptions = {
38
+ ...pickerDefaults,
39
+ ...pickerOptions,
40
+ };
41
+ const handlePickerResolution = (data) => {
42
+ let imageArray = [];
43
+ if (!Array.isArray(data)) {
44
+ imageArray = [data];
45
+ }
46
+ else {
47
+ imageArray = data;
48
+ }
49
+ handleResolve?.(imageArray.map(parsePickerData));
50
+ };
51
+ const onPress = (open, options) => {
52
+ if (open == 'fs') {
53
+ // openFileSystem()
54
+ }
55
+ else {
56
+ const call = open === 'camera' ? 'openCamera' : 'openPicker';
57
+ ImageCropPicker[call]({ ...mergedOptions, ...(options || {}) }).then(handlePickerResolution);
58
+ }
59
+ };
60
+ const openFilePicker = async (imageSource = null, options = {}) => {
61
+ if (type === 'image') {
62
+ if (imageSource === 'camera') {
63
+ onPress('camera', options);
64
+ }
65
+ else if (imageSource === 'library') {
66
+ onPress('library', options);
67
+ }
68
+ else {
69
+ alert.ask({
70
+ title: 'Change Image',
71
+ body: 'Do you want to take a new picture or select an existing one?',
72
+ ...alertProps,
73
+ options: [
74
+ {
75
+ text: 'Library',
76
+ onPress: () => {
77
+ if (onOpenGallery) {
78
+ onOpenGallery(() => onPress('library'));
79
+ }
80
+ else {
81
+ onPress('library');
82
+ }
83
+ },
84
+ ...alertProps?.options?.[0],
85
+ },
86
+ {
87
+ text: 'Cancel',
88
+ style: 'cancel',
89
+ ...alertProps?.options?.[1]
90
+ },
91
+ ]
92
+ });
93
+ }
94
+ }
95
+ else {
96
+ if (onOpenFileSystem) {
97
+ // onOpenFileSystem(() => onPress('fs'))
98
+ }
99
+ else {
100
+ onPress('fs');
101
+ }
102
+ }
103
+ };
104
+ useImperativeHandle(ref, () => ({
105
+ openFilePicker: (imageSource = null, options = {}) => {
106
+ openFilePicker(imageSource, options);
107
+ return new Promise((resolve) => {
108
+ resolveWithFile.current = resolve;
109
+ });
110
+ },
111
+ }));
112
+ return null;
113
+ });
114
+ export const FileInput = _FileInput;
115
+ FileInput.defaultProps = {};
116
+ export const useFileInput = () => {
117
+ const inputRef = useRef(null);
118
+ const openFilePicker = (imageSource = null, options = {}) => {
119
+ return inputRef.current?.openFilePicker(imageSource, options);
120
+ };
121
+ return {
122
+ openFilePicker,
123
+ ref: inputRef,
124
+ };
125
+ };
126
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/FileInput/index.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAEtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AACnD,OAAO,eAA0C,MAAM,gCAAgC,CAAA;AAEvF,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAEzC,cAAc,SAAS,CAAA;AAEvB,MAAM,cAAc,GAAG;IACrB,QAAQ,EAAE,IAAI;CACf,CAAA;AAED,SAAS,eAAe,CAAC,IAAkB;IACzC,MAAM,YAAY,GAAG,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAEjD,MAAM,IAAI,GAAe;QACvB,GAAG,IAAI;QACP,IAAI,EAAE,YAAY,CAAC,IAAI;QACvB,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,IAAI,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,UAAU,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;yBAC5B;qBACF;iBACF,CAAC,CAAA;YACJ,CAAC;QACH,CAAC;aAAM,CAAC;YACN,IAAI,gBAAgB,EAAE,CAAC;gBACrB,wCAAwC;YAC1C,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,IAAI,CAAC,CAAA;YACf,CAAC;QACH,CAAC;IACH,CAAC,CAAA;IAED,mBAAmB,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;QAC9B,cAAc,EAAE,CAAC,cAAoC,IAAI,EAAE,UAA4B,EAAE,EAAE,EAAE;YAC3F,cAAc,CAAC,WAAW,EAAE,OAAO,CAAC,CAAA;YACpC,OAAO,IAAI,OAAO,CAAe,CAAC,OAAO,EAAE,EAAE;gBAC3C,eAAe,CAAC,OAAO,GAAG,OAAO,CAAA;YACnC,CAAC,CAAC,CAAA;QACJ,CAAC;KACF,CAAC,CAAC,CAAA;IAEH,OAAO,IAAI,CAAA;AACb,CAAC,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG,UAAoH,CAAA;AAE7I,SAAS,CAAC,YAAY,GAAG,EAAE,CAAA;AAE3B,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,EAAE;IAC/B,MAAM,QAAQ,GAAG,MAAM,CAAe,IAAI,CAAC,CAAA;IAE3C,MAAM,cAAc,GAAG,CAAC,cAAoC,IAAI,EAAE,UAA4B,EAAE,EAAyB,EAAE;QACzH,OAAO,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC,WAAW,EAAE,OAAO,CAAC,CAAA;IAC/D,CAAC,CAAA;IAED,OAAO;QACL,cAAc;QACd,GAAG,EAAE,QAAgD;KACtD,CAAA;AACH,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/FileInput/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,65 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useCallback, forwardRef } from 'react';
3
+ import { View } from '../View';
4
+ import { EmptyPlaceholder } from '../EmptyPlaceholder';
5
+ import { RefreshControl } from '../RefreshControl';
6
+ import { List } from '../List';
7
+ import { useTheme } from '@codeleap/styles';
8
+ import { MobileStyleRegistry } from '../../Registry';
9
+ import { useStylesFor } from '../../hooks';
10
+ import { TypeGuards } from '@codeleap/types';
11
+ export * from './styles';
12
+ export * from './types';
13
+ const RenderSeparator = (props) => {
14
+ return _jsx(View, { style: props.separatorStyles });
15
+ };
16
+ export const Grid = forwardRef((flatGridProps, ref) => {
17
+ const { style, onRefresh, refreshing, placeholder, refreshControlProps = {}, spacing, numColumns, renderItem: providedRenderItem, ...props } = {
18
+ ...Grid.defaultProps,
19
+ ...flatGridProps,
20
+ };
21
+ const themeSpacing = useTheme(store => store.theme?.spacing);
22
+ const styles = useStylesFor(Grid.styleRegistryName, style);
23
+ const renderItem = useCallback((data) => {
24
+ if (!providedRenderItem)
25
+ return null;
26
+ const listLength = props?.data?.length || 0;
27
+ const isFirst = data.index === 0;
28
+ const isLast = data.index === listLength - 1;
29
+ const isOnly = isFirst && isLast;
30
+ const idx = data.index + 1;
31
+ const isLastInRow = !isFirst && idx % (numColumns) === 0;
32
+ const isFirstInRow = isFirst || data.index % numColumns === 0;
33
+ const isOnlyInRow = !isFirstInRow && !isLastInRow;
34
+ let gap = themeSpacing?.marginRight?.(spacing / 2);
35
+ if (isLastInRow)
36
+ gap = themeSpacing?.marginLeft?.(spacing / 2);
37
+ else if (isOnlyInRow)
38
+ gap = themeSpacing?.marginHorizontal?.(spacing / 2);
39
+ const _itemProps = { isFirst, isLast, isOnly, isFirstInRow, isLastInRow, isOnlyInRow };
40
+ return (_jsx(View, { style: [styles.itemWrapper, gap], children: providedRenderItem({
41
+ ...data,
42
+ ..._itemProps
43
+ }) }));
44
+ }, [providedRenderItem, props?.data?.length]);
45
+ const separatorStyles = { height: themeSpacing?.value?.(spacing), ...styles.separator };
46
+ const separator = props?.separators || (!!spacing ? _jsx(RenderSeparator, { separatorStyles: separatorStyles }) : null);
47
+ const refreshControl = TypeGuards.isFunction(onRefresh) ? _jsx(RefreshControl, { refreshing: refreshing, onRefresh: onRefresh, ...refreshControlProps }) : null;
48
+ return (_jsx(List
49
+ // @ts-expect-error
50
+ , {
51
+ // @ts-expect-error
52
+ ref: ref, ...props, ListEmptyComponent: _jsx(EmptyPlaceholder, { ...placeholder }), ListHeaderComponentStyle: styles.header, ListFooterComponentStyle: styles.footer, ItemSeparatorComponent: separator, refreshControl: refreshControl, style: styles.wrapper, contentContainerStyle: [styles.content, props?.contentContainerStyle], showsVerticalScrollIndicator: false, numColumns: numColumns, renderItem: renderItem }));
53
+ });
54
+ Grid.styleRegistryName = 'Grid';
55
+ Grid.elements = ['wrapper', 'content', 'separator', 'header', 'refreshControl', 'itemWrapper', 'footer'];
56
+ Grid.rootElement = 'wrapper';
57
+ Grid.withVariantTypes = (styles) => {
58
+ return Grid;
59
+ };
60
+ Grid.defaultProps = {
61
+ keyboardShouldPersistTaps: 'handled',
62
+ refreshControlProps: {},
63
+ };
64
+ MobileStyleRegistry.registerComponent(Grid);
65
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Grid/index.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,WAAW,EAAE,UAAU,EAAiB,MAAM,OAAO,CAAA;AAErE,OAAO,EAAE,IAAI,EAAa,MAAM,SAAS,CAAA;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,EAAE,IAAI,EAAY,MAAM,SAAS,CAAA;AAExC,OAAO,EAAmE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAC5G,OAAO,EAAE,mBAAmB,EAAE,MAA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components/Grid/styles.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/Grid/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,59 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React from 'react';
3
+ import { TypeGuards } from '@codeleap/types';
4
+ import { arePropsEqual } from '@codeleap/utils';
5
+ import { Badge } from '../Badge';
6
+ import { View } from '../View';
7
+ import { useNestedStylesByKey, useTheme } from '@codeleap/styles';
8
+ import { MobileStyleRegistry } from '../../Registry';
9
+ import { useStylesFor } from '../../hooks';
10
+ export * from './styles';
11
+ export * from './types';
12
+ export const IconComponent = (props) => {
13
+ const { name, style, badge, badgeProps = {}, wrapperProps = {}, source, ...otherProps } = {
14
+ ...Icon.defaultProps,
15
+ ...props,
16
+ };
17
+ // Icons are React components registered on the theme object at app startup — they are not
18
+ // font glyphs or image assets. If the name is not in the registry the component silently
19
+ // renders nothing, so a missing registration will not crash but will produce an invisible slot.
20
+ const icons = useTheme(store => store.theme?.icons);
21
+ const styles = useStylesFor(Icon.styleRegistryName, style);
22
+ const Component = icons?.[name];
23
+ if (!name && !source) {
24
+ return null;
25
+ }
26
+ if (!Component) {
27
+ return null;
28
+ }
29
+ if (badge || TypeGuards.isNumber(badge)) {
30
+ const badgeStyles = useNestedStylesByKey('badge', styles);
31
+ // `size` is a shorthand not in RN's style spec; the @ts-expect-error suppresses that.
32
+ // The wrapper needs an explicit size so Badge can be absolutely positioned correctly.
33
+ const sized = {
34
+ // @ts-expect-error
35
+ height: styles.icon?.size || styles.icon?.height || props?.size,
36
+ // @ts-expect-error
37
+ width: styles.icon?.size || styles.icon?.width || props?.size,
38
+ };
39
+ return _jsxs(View, { ...wrapperProps, style: [sized, styles.iconBadgeWrapper], children: [_jsx(Component, { ...otherProps, style: styles.icon, source: source }), _jsx(Badge, { style: badgeStyles, badge: badge, ...badgeProps })] });
40
+ }
41
+ return _jsx(Component, { ...otherProps, style: styles.icon, source: source });
42
+ };
43
+ function areEqual(prevProps, nextProps) {
44
+ const check = ['name', 'style', 'renderEmptySpace', 'badgeProps', 'badge'];
45
+ const res = arePropsEqual(prevProps, nextProps, { check });
46
+ return res;
47
+ }
48
+ export const Icon = React.memo(IconComponent, areEqual);
49
+ Icon.styleRegistryName = 'Icon';
50
+ Icon.elements = ['icon', 'iconBadgeWrapper', 'badge'];
51
+ Icon.rootElement = 'icon';
52
+ Icon.defaultProps = {
53
+ badge: false,
54
+ };
55
+ Icon.withVariantTypes = (styles) => {
56
+ return Icon;
57
+ };
58
+ MobileStyleRegistry.registerComponent(Icon);
59
+ //# sourceMappingURL=index.js.map