@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,66 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { TypeGuards } from '@codeleap/types';
3
+ import { Text } from '../Text';
4
+ import { View } from '../View';
5
+ import { MobileStyleRegistry } from '../../Registry';
6
+ import { useStylesFor } from '../../hooks';
7
+ export * from './styles';
8
+ export * from './types';
9
+ /** Caps display at `maxCount+` so the badge dot stays small; truncation is visual only — the real count is always passed through props. */
10
+ const defaultGetBadgeContent = ({ count, maxCount }) => {
11
+ if (Number(count) > maxCount) {
12
+ return `${maxCount}+`;
13
+ }
14
+ else {
15
+ return String(count);
16
+ }
17
+ };
18
+ export const Badge = (props) => {
19
+ const allProps = {
20
+ ...Badge.defaultProps,
21
+ ...props,
22
+ };
23
+ const { debugName, innerWrapperProps = {}, textProps = {}, maxCount, minCount, getBadgeContent, renderBadgeContent, disabled, style, badge, ...rest } = allProps;
24
+ /** `badge={false}` or `badge={undefined}` hides the element entirely (returns null), not just empties it. */
25
+ const visible = (TypeGuards.isBoolean(badge) && badge === true) || TypeGuards.isNumber(badge);
26
+ const styles = useStylesFor(Badge.styleRegistryName, style);
27
+ if (!visible)
28
+ return null;
29
+ const wrapperStyles = [
30
+ styles?.wrapper,
31
+ (disabled && styles?.['wrapper:disabled']),
32
+ ];
33
+ const innerWrapperStyles = [
34
+ styles?.innerWrapper,
35
+ (disabled && styles?.['innerWrapper:disabled']),
36
+ innerWrapperProps?.style,
37
+ ];
38
+ const countStyles = [
39
+ styles?.count,
40
+ (disabled && styles?.['count:disabled']),
41
+ textProps?.style,
42
+ ];
43
+ const count = TypeGuards.isNumber(badge) ? badge : null;
44
+ const content = getBadgeContent({ ...props, maxCount, minCount, count });
45
+ const showContent = TypeGuards.isNumber(count) && count >= minCount;
46
+ const BadgeContent = TypeGuards.isNil(renderBadgeContent) ? () => _jsx(Text, { text: content, ...textProps, style: countStyles }) : renderBadgeContent;
47
+ return (_jsx(View, { ...rest, style: wrapperStyles, children: _jsx(View, { ...innerWrapperProps, style: innerWrapperStyles, children: showContent
48
+ ? _jsx(BadgeContent, { ...props, maxCount: maxCount, minCount: minCount, count: count, getBadgeContent: getBadgeContent, content: content })
49
+ : null }) }));
50
+ };
51
+ Badge.styleRegistryName = 'Badge';
52
+ Badge.elements = ['wrapper', 'innerWrapper', 'count'];
53
+ Badge.rootElement = 'wrapper';
54
+ Badge.defaultProps = {
55
+ maxCount: 9,
56
+ minCount: 1,
57
+ getBadgeContent: defaultGetBadgeContent,
58
+ renderBadgeContent: null,
59
+ disabled: false,
60
+ badge: true,
61
+ };
62
+ Badge.withVariantTypes = (styles) => {
63
+ return Badge;
64
+ };
65
+ MobileStyleRegistry.registerComponent(Badge);
66
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Badge/index.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAE9B,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAEpD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1C,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AAEvB,2IAA2I;AAC3I,MAAM,sBAAsB,GAAG,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAgB,EAAE,EAAE;IACnE,IAAI,MAAM,CAAC,KAAK,CAAC,GAAG,QAAQ,EAAE,CAAC;QAC7B,OAAO,GAAG,QAAQ,GAAG,CAAA;IACvB,CAAC;SAAM,CAAC;QACN,OAAO,MAAM,CAAC,KAAK,CAAC,CAAA;IACtB,CAAC;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,KAAiB,EAAE,EAAE;IACzC,MAAM,QAAQ,GAAG;QACf,GAAG,KAAK,CAAC,YAAY;QACrB,GAAG,KAAK;KACT,CAAA;IAED,MAAM,EACJ,SAAS,EACT,iBAAiB,GAAG,EAAE,EACtB,SAAS,GAAG,EAAE,EACd,QAAQ,EACR,QAAQ,EACR,eAAe,EACf,kBAAkB,EAClB,QAAQ,E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,KAAM,SAAS,EAAE,KAAK,EAAE,WAAW,GAAI,CAAC,CAAC,CAAC,kBAAkB,CAAA;IAEjJ,OAAO,CACL,KAAC,IAAI,OAAK,IAAI,EAAE,KAAK,EAAE,aAAa,YAClC,KAAC,IAAI,OAAK,iBAAiB,EAAE,KAAK,EAAE,kBAAkB,YACnD,WAAW;gBACV,CAAC,CAAC,KAAC,YAAY,OACT,KAAK,EACT,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,KAAK,EACZ,eAAe,EAAE,eAAe,EAChC,OAAO,EAAE,OAAO,GAChB;gBACF,CAAC,CAAC,IAAI,GAEH,GACF,CACR,CAAA;AACH,CAAC,CAAA;AAED,KAAK,CAAC,iBAAiB,GAAG,OAAO,CAAA;AACjC,KAAK,CAAC,QAAQ,GAAG,CAAC,SAAS,EAAE,cAAc,EAAE,OAAO,CAAC,CAAA;AACrD,KAAK,CAAC,WAAW,GAAG,SAAS,CAAA;AAE7B,KAAK,CAAC,YAAY,GAAG;IACnB,QAAQ,EAAE,CAAC;IACX,QAAQ,EAAE,CAAC;IACX,eAAe,EAAE,sBAAsB;IACvC,kBAAkB,EAAE,IAAI;IACxB,QAAQ,EAAE,KAAK;IACf,KAAK,EAAE,IAAI;CACW,CAAA;AAExB,KAAK,CAAC,gBAAgB,GAAG,CAAsB,MAAS,EAAE,EAAE;IAC1D,OAAO,KAAyE,CAAA;AAClF,CAAC,CAAA;AAED,mBAAmB,CAAC,iBAAiB,CAAC,KAAK,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/Badge/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/Badge/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,73 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { forwardRef, useState } from 'react';
3
+ import { Text } from '../Text';
4
+ import { Touchable } from '../Touchable';
5
+ import { Icon } from '../Icon';
6
+ import { ActivityIndicator } from '../ActivityIndicator';
7
+ import { StyleSheet } from 'react-native';
8
+ import { usePressableFeedback } from '../../utils';
9
+ import { Badge } from '../Badge';
10
+ import { useNestedStylesByKey, mergeStyles } from '@codeleap/styles';
11
+ import { MobileStyleRegistry } from '../../Registry';
12
+ import { useStylesFor } from '../../hooks';
13
+ export * from './styles';
14
+ export * from './types';
15
+ export const Button = forwardRef((buttonProps, ref) => {
16
+ const { children, icon, text, loading, onPress, disabled, selected, rightIcon, style, badge, badgeProps = {}, ...props } = {
17
+ ...Button.defaultProps,
18
+ ...buttonProps,
19
+ };
20
+ const [pressed, setPressed] = useState(false);
21
+ const styles = useStylesFor(Button.styleRegistryName, style);
22
+ const getStyles = (key) => mergeStyles([
23
+ styles[key],
24
+ selected && styles[key + ':selected'],
25
+ disabled && styles[key + ':disabled'],
26
+ ]);
27
+ const iconStyle = getStyles('icon');
28
+ const leftIconStyle = StyleSheet.flatten([iconStyle, getStyles('leftIcon')]);
29
+ const rightIconStyle = StyleSheet.flatten([iconStyle, getStyles('rightIcon')]);
30
+ const componentStyles = {
31
+ wrapper: getStyles('wrapper'),
32
+ loader: getStyles('loader'),
33
+ leftIcon: leftIconStyle,
34
+ rightIcon: rightIconStyle,
35
+ text: getStyles('text'),
36
+ icon: getStyles('icon'),
37
+ };
38
+ const disableFeedback = !onPress || props?.noFeedback;
39
+ // Two independent feedback tracks: text color animates via `textFeedback`, wrapper border
40
+ // animates via `wrapperFeedback`. Both are optional — omitting the style key disables that track.
41
+ const { getFeedbackStyle } = usePressableFeedback(styles.text, {
42
+ hightlightPropertyIn: 'color',
43
+ hightlightPropertyOut: 'color',
44
+ feedbackConfig: styles?.textFeedback,
45
+ disabled: disableFeedback,
46
+ });
47
+ const { getFeedbackStyle: getFeedbackWrapperStyle } = usePressableFeedback(styles.wrapper, {
48
+ hightlightPropertyIn: 'borderColor',
49
+ hightlightPropertyOut: 'borderColor',
50
+ disabled: disableFeedback,
51
+ feedbackConfig: styles?.wrapperFeedback,
52
+ });
53
+ const rightFeedback = getFeedbackStyle(pressed);
54
+ // `display: 'none'` on the leftIcon style element is the intended mechanism to suppress the
55
+ // icon slot when no `icon` prop is passed; the suppression check reads the resolved style rather
56
+ // than the prop so theme variants can control visibility without prop drilling.
57
+ // @ts-expect-error This is a hack to hide the icon when there is no text
58
+ const isLeftIconHidden = componentStyles?.leftIcon?.display != 'none';
59
+ const badgeStyles = useNestedStylesByKey('badge', styles);
60
+ return (_jsxs(Touchable, { ref: ref, disabled: disabled, onPress: onPress, debugComponent: 'Button', noFeedback: !onPress, setPressed: setPressed, ...props, style: [componentStyles.wrapper, { feedback: styles.feedback }, getFeedbackWrapperStyle(pressed)], children: [loading ? _jsx(ActivityIndicator, { style: [componentStyles.loader, getFeedbackStyle(pressed)] }) : null, (!loading && isLeftIconHidden) ? _jsx(Icon, { name: icon, style: [componentStyles.leftIcon, getFeedbackStyle(pressed)] }) : null, text ? _jsx(Text, { text: text, style: [componentStyles.text, getFeedbackStyle(pressed)] }) : null, children, rightIcon ? _jsx(Icon, { name: rightIcon, style: [componentStyles.rightIcon, rightFeedback] }) : null, _jsx(Badge, { badge: badge, ...badgeProps, style: badgeStyles })] }));
61
+ });
62
+ Button.styleRegistryName = 'Button';
63
+ Button.elements = ['wrapper', 'text', 'icon', 'leftIcon', 'rightIcon', 'loader', 'badge'];
64
+ Button.rootElement = 'wrapper';
65
+ Button.withVariantTypes = (styles) => {
66
+ return Button;
67
+ };
68
+ Button.defaultProps = {
69
+ hitSlop: 10,
70
+ badge: false
71
+ };
72
+ MobileStyleRegistry.registerComponent(Button);
73
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.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Ae,CAAC,SAAS,EAAE,aAAa,CAAC,GAAI,CAAC,CAAC,CAAC,IAAI,EAChG,KAAC,KAAK,IAAC,KAAK,EAAE,KAAK,KAAM,UAAU,EAAE,KAAK,EAAE,WAAW,GAAI,IACjD,CACb,CAAA;AACH,CAAC,CAA0C,CAAA;AAE3C,MAAM,CAAC,iBAAiB,GAAG,QAAQ,CAAA;AACnC,MAAM,CAAC,QAAQ,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAA;AACzF,MAAM,CAAC,WAAW,GAAG,SAAS,CAAA;AAE9B,MAAM,CAAC,gBAAgB,GAAG,CAAsB,MAAS,EAAE,EAAE;IAC3D,OAAO,MAA2E,CAAA;AACpF,CAAC,CAAA;AAED,MAAM,CAAC,YAAY,GAAG;IACpB,OAAO,EAAE,EAAE;IACX,KAAK,EAAE,KAAK;CACW,CAAA;AAEzB,mBAAmB,CAAC,iBAAiB,CAAC,MAAM,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/Button/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/Button/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,100 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useCallback, useMemo } from 'react';
3
+ import { Calendar as RNCalendar } from 'react-native-calendars';
4
+ import { MobileStyleRegistry } from '../../Registry';
5
+ import { useStylesFor } from '../../hooks';
6
+ import dayjs from 'dayjs';
7
+ import isSameOrBefore from 'dayjs/plugin/isSameOrBefore';
8
+ import { dateUtils } from '@codeleap/utils';
9
+ dayjs.extend(isSameOrBefore);
10
+ export * from './styles';
11
+ export * from './types';
12
+ /** react-native-calendars requires dates keyed as YYYY-MM-DD strings in markedDates; any other format silently produces no highlights. */
13
+ const DATE_FORMAT = 'YYYY-MM-DD';
14
+ export const Calendar = (props) => {
15
+ const { style, value, onValueChange, ...calendarProps } = props;
16
+ const styles = useStylesFor(Calendar.styleRegistryName, style);
17
+ const isRange = Array.isArray(value);
18
+ /** `removeTimezoneAndFormat` strips the timezone offset before formatting so that a UTC midnight doesn't shift to the previous calendar day in negative-offset locales. */
19
+ const stringValue = useMemo(() => {
20
+ if (!value)
21
+ return isRange ? [] : '';
22
+ if (isRange) {
23
+ return value.map((v) => dateUtils.removeTimezoneAndFormat(v, DATE_FORMAT));
24
+ }
25
+ return dateUtils.removeTimezoneAndFormat(value, DATE_FORMAT);
26
+ }, [value, isRange]);
27
+ const markedDates = useMemo(() => {
28
+ if (!isRange) {
29
+ return stringValue ? { [stringValue]: { selected: true } } : {};
30
+ }
31
+ const rangeValues = stringValue;
32
+ if (rangeValues.length === 0)
33
+ return {};
34
+ if (rangeValues.length === 1) {
35
+ return { [rangeValues[0]]: { selected: true } };
36
+ }
37
+ const [start, end] = rangeValues;
38
+ const startDate = dayjs(start);
39
+ const endDate = dayjs(end);
40
+ const marked = {};
41
+ let current = startDate;
42
+ while (current.isSameOrBefore(endDate)) {
43
+ const dateStr = dateUtils.removeTimezoneAndFormat(current, DATE_FORMAT);
44
+ marked[dateStr] = {
45
+ selected: true,
46
+ ...(current.isSame(startDate) && { startingDay: true }),
47
+ ...(current.isSame(endDate) && { endingDay: true }),
48
+ };
49
+ current = current.add(1, 'day');
50
+ }
51
+ return marked;
52
+ }, [stringValue, isRange]);
53
+ /**
54
+ * Range selection uses a two-tap model: first tap sets start (array of 1), second tap completes
55
+ * the range (array of 2). Tapping again resets to a new start. Always sorted so start ≤ end.
56
+ */
57
+ const handleDateChange = useCallback((date) => {
58
+ if (!onValueChange)
59
+ return;
60
+ const selected = dayjs(date.dateString).startOf('day');
61
+ if (isRange) {
62
+ const current = Array.isArray(value) ? value : [];
63
+ let newDates = [];
64
+ if (current.length === 0 || current.length === 2) {
65
+ newDates = [selected];
66
+ }
67
+ else if (current.length === 1) {
68
+ const first = dayjs(current[0]).startOf('day');
69
+ newDates = first.isAfter(selected)
70
+ ? [selected, first]
71
+ : [first, selected];
72
+ }
73
+ onValueChange(newDates);
74
+ }
75
+ else {
76
+ onValueChange(selected);
77
+ }
78
+ }, [onValueChange, value, isRange]);
79
+ const currentValue = useMemo(() => {
80
+ return isRange
81
+ ? (Array.isArray(stringValue) ? stringValue[0] : '')
82
+ : stringValue;
83
+ }, [stringValue, isRange]);
84
+ return (_jsx(RNCalendar, { onDayPress: handleDateChange, current: currentValue, monthFormat: 'MMMM yyyy', ...calendarProps, markedDates: {
85
+ ...markedDates,
86
+ ...calendarProps?.markedDates
87
+ }, style: styles?.wrapper, headerStyle: styles?.header, theme: {
88
+ ...styles?.calendar,
89
+ ...calendarProps?.theme,
90
+ } }));
91
+ };
92
+ Calendar.styleRegistryName = 'Calendar';
93
+ Calendar.elements = ['wrapper', 'header', 'calendar'];
94
+ Calendar.rootElement = 'wrapper';
95
+ Calendar.withVariantTypes = (styles) => {
96
+ return Calendar;
97
+ };
98
+ Calendar.defaultProps = {};
99
+ MobileStyleRegistry.registerComponent(Calendar);
100
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Calendar/index.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AACnD,OAAO,EAAE,QAAQ,IAAI,UAAU,EAAY,MAAM,wBAAwB,CAAA;AAEzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1C,OAAO,KAAgB,MAAM,OAAO,CAAA;AACpC,OAAO,cAAc,MAAM,6BAA6B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,gBAAgB,EAC5B,OAAO,EAAE,YAAsB,EAC/B,WAAW,EAAE,WAAW,KACpB,aAAa,EACjB,WAAW,EAAE;YACX,GAAG,WAAW;YACd,GAAG,aAAa,EAAE,WAAW;SAC9B,EACD,KAAK,EAAE,MAAM,EAAE,OAAO,EACtB,WAAW,EAAE,MAAM,EAAE,MAAM,EAC3B,KAAK,EAAE;YACL,GAAG,MAAM,EAAE,QAAQ;YACnB,GAAG,aAAa,EAAE,KAAK;SACxB,GACD,CACH,CAAA;AACH,CAAC,CAAA;AAED,QAAQ,CAAC,iBAAiB,GAAG,UAAU,CAAA;AACvC,QAAQ,CAAC,QAAQ,GAAG,CAAC,SAAS,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAA;AACrD,QAAQ,CAAC,WAAW,GAAG,SAAS,CAAA;AAEhC,QAAQ,CAAC,gBAAgB,GAAG,CAAsB,MAAS,EAAE,EAAE;IAC7D,OAAO,QAA+E,CAAA;AACxF,CAAC,CAAA;AAED,QAAQ,CAAC,YAAY,GAAG,EAA4B,CAAA;AAEpD,mBAAmB,CAAC,iBAAiB,CAAC,QAAQ,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/Calendar/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/Calendar/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,67 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useMemo } from 'react';
3
+ import { useCompositionStyles } from '@codeleap/styles';
4
+ import { MobileStyleRegistry } from '../../Registry';
5
+ import { useStylesFor } from '../../hooks';
6
+ import { Calendar } from '../Calendar';
7
+ import { TextInput } from '../TextInput';
8
+ import { useInputBase } from '../InputBase';
9
+ import { fields } from '@codeleap/form';
10
+ import { dateUtils } from '@codeleap/utils';
11
+ import { InputOverlay, inputOverlayManager } from '../InputOverlay';
12
+ export * from './styles';
13
+ export * from './types';
14
+ /**
15
+ * The calendar overlay is managed by `inputOverlayManager`, not local state — this means only
16
+ * one CalendarInput can be open at a time application-wide when `autoClosePeersCalendars` is true.
17
+ * Setting `overlay={false}` renders the calendar inline in the document flow instead.
18
+ */
19
+ export const CalendarInput = (props) => {
20
+ const { style, value, onValueChange, disabled, gap, calendarPosition, rightIcon, leftIcon, autoClosePeersCalendars, field, format, overlay, calendarProps, ...textInputProps } = {
21
+ ...CalendarInput.defaultProps,
22
+ ...props
23
+ };
24
+ const styles = useStylesFor(CalendarInput.styleRegistryName, style);
25
+ const compositionStyles = useCompositionStyles(['calendar', 'input'], styles);
26
+ const { inputValue, onInputValueChange, } = useInputBase(field, fields.date, { value, onValueChange });
27
+ const { isOpen, toggle, id } = inputOverlayManager.use();
28
+ /**
29
+ * For range mode, an incomplete selection (only start date chosen) intentionally shows an empty
30
+ * string so the TextInput doesn't display a partial "start - " label.
31
+ */
32
+ const formattedValue = useMemo(() => {
33
+ if (!inputValue)
34
+ return '';
35
+ if (Array.isArray(inputValue)) {
36
+ const filled = inputValue.filter(Boolean);
37
+ if (filled.length < inputValue.length)
38
+ return '';
39
+ return filled.map((v) => dateUtils.removeTimezoneAndFormat(v, format)).join(' - ');
40
+ }
41
+ return dateUtils.removeTimezoneAndFormat(inputValue, format);
42
+ }, [inputValue, format]);
43
+ return (_jsx(InputOverlay.Layout, { style: styles.wrapper, position: calendarPosition, gap: gap, isOpen: isOpen, mode: overlay ? 'overlay' : 'content', hideOverlay: disabled, id: id, content: _jsx(Calendar, { style: compositionStyles.calendar, value: inputValue, onValueChange: onInputValueChange, ...calendarProps }), children: _jsx(TextInput, { placeholder: 'Select Date', disabled: disabled, ...textInputProps, style: compositionStyles.input, value: formattedValue, onValueChange: () => inputValue, onPress: disabled ? undefined : toggle, innerWrapperProps: {
44
+ rippleDisabled: true,
45
+ }, focused: isOpen, leftIcon: !leftIcon ? null : {
46
+ ...leftIcon,
47
+ onPress: toggle,
48
+ }, rightIcon: !rightIcon ? null : {
49
+ ...rightIcon,
50
+ onPress: toggle,
51
+ } }) }));
52
+ };
53
+ CalendarInput.styleRegistryName = 'CalendarInput';
54
+ CalendarInput.elements = ['wrapper', 'calendar', 'input'];
55
+ CalendarInput.rootElement = 'wrapper';
56
+ CalendarInput.withVariantTypes = (styles) => {
57
+ return CalendarInput;
58
+ };
59
+ CalendarInput.defaultProps = {
60
+ gap: 8,
61
+ calendarPosition: 'left',
62
+ autoClosePeersCalendars: false,
63
+ format: 'DD/MM/YYYY',
64
+ overlay: true,
65
+ };
66
+ MobileStyleRegistry.registerComponent(CalendarInput);
67
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/CalendarInput/index.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,EAAyC,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AAC9F,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAEnE,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AAEvB;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAA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zD,aAAa,CAAC,WAAW,GAAG,SAAS,CAAA;AAErC,aAAa,CAAC,gBAAgB,GAAG,CAAsB,MAAS,EAAE,EAAE;IAClE,OAAO,aAAyF,CAAA;AAClG,CAAC,CAAA;AAED,aAAa,CAAC,YAAY,GAAG;IAC3B,GAAG,EAAE,CAAC;IACN,gBAAgB,EAAE,MAAM;IACxB,uBAAuB,EAAE,KAAK;IAC9B,MAAM,EAAE,YAAY;IACpB,OAAO,EAAE,IAAI;CACiB,CAAA;AAEhC,mBAAmB,CAAC,iBAAiB,CAAC,aAAa,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/CalendarInput/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/CalendarInput/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,85 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { View } from '../View';
3
+ import { InputBase, InputBaseDefaultOrder, selectInputBaseProps } from '../InputBase';
4
+ import { useAnimatedVariantStyles } from '../..';
5
+ import { Touchable } from '../Touchable';
6
+ import { Icon } from '../Icon';
7
+ import { MobileStyleRegistry } from '../../Registry';
8
+ import { useStylesFor } from '../../hooks';
9
+ import { useInputBase } from '../InputBase/useInputBase';
10
+ import { fields } from '@codeleap/form';
11
+ export * from './styles';
12
+ export * from './types';
13
+ /** Reversed order puts the innerWrapper (the visual checkbox) before the label, matching right-aligned checkbox layouts without a separate style override. */
14
+ const reversedOrder = [...InputBaseDefaultOrder].reverse();
15
+ export const Checkbox = (props) => {
16
+ const { inputBaseProps, others, } = selectInputBaseProps({
17
+ ...Checkbox.defaultProps,
18
+ ...props,
19
+ });
20
+ const { style, disabled, debugName, checkboxOnLeft, checkIcon, field, forceError, value, onValueChange, } = others;
21
+ const styles = useStylesFor(Checkbox.styleRegistryName, style);
22
+ const { validation, wrapperRef, inputValue, onInputValueChange, } = useInputBase(field, fields.boolean, { value, onValueChange });
23
+ const boxAnimation = useAnimatedVariantStyles({
24
+ variantStyles: styles,
25
+ animatedProperties: ['box:unchecked', 'box:disabled', 'box:checked', 'box:disabled-checked', 'box:disabled-unchecked'],
26
+ transition: styles['box:transition'],
27
+ updater: () => {
28
+ 'worklet';
29
+ let disabledStyle = {};
30
+ if (disabled) {
31
+ disabledStyle = inputValue ? styles['box:disabled-checked'] : styles['box:disabled-unchecked'];
32
+ }
33
+ const style = inputValue ? styles['box:checked'] : styles['box:unchecked'];
34
+ return {
35
+ ...style,
36
+ ...disabledStyle,
37
+ };
38
+ },
39
+ dependencies: [inputValue, disabled],
40
+ });
41
+ const checkmarkWrapperAnimation = useAnimatedVariantStyles({
42
+ variantStyles: styles,
43
+ animatedProperties: ['checkmarkWrapper:unchecked', 'checkmarkWrapper:disabled', 'checkmarkWrapper:checked', 'checkmarkWrapper:disabled-unchecked', 'checkmarkWrapper:disabled-checked'],
44
+ transition: styles['checkmarkWrapper:transition'],
45
+ updater: () => {
46
+ 'worklet';
47
+ let disabledStyle = {};
48
+ if (disabled) {
49
+ disabledStyle = inputValue ? styles['checkmarkWrapper:disabled-checked'] : styles['checkmarkWrapper:disabled-unchecked'];
50
+ }
51
+ const style = inputValue ? styles['checkmarkWrapper:checked'] : styles['checkmarkWrapper:unchecked'];
52
+ return {
53
+ ...style,
54
+ ...disabledStyle,
55
+ };
56
+ },
57
+ dependencies: [inputValue, disabled],
58
+ });
59
+ /** Same `__props` escape-hatch as RadioGroup — lets the style variant set the default side without requiring a prop at every call site. */
60
+ // @ts-expect-error
61
+ const _checkboxOnLeft = checkboxOnLeft ?? styles.__props?.checkboxOnLeft;
62
+ const hasError = validation?.showError || forceError;
63
+ return _jsx(InputBase, { ...inputBaseProps, ref: wrapperRef, error: hasError ? validation?.message || forceError : null, debugName: debugName, wrapper: Touchable, style: styles, wrapperProps: {
64
+ onPress: () => onInputValueChange(!inputValue),
65
+ disabled,
66
+ rippleDisabled: true,
67
+ }, order: _checkboxOnLeft ? reversedOrder : InputBaseDefaultOrder, children: _jsx(View, { animated: true, animatedStyle: boxAnimation, style: [
68
+ styles.box,
69
+ disabled && styles['box:disabled'],
70
+ ], children: _jsx(View, { animated: true, animatedStyle: checkmarkWrapperAnimation, style: [
71
+ styles.checkmarkWrapper,
72
+ disabled && styles['checkmarkWrapper:disabled'],
73
+ ], children: _jsx(Icon, { name: checkIcon, style: [styles.checkmark, disabled && styles['checkmark:disabled']] }) }) }) });
74
+ };
75
+ Checkbox.styleRegistryName = 'Checkbox';
76
+ Checkbox.rootElement = 'wrapper';
77
+ Checkbox.elements = [...InputBase.elements, 'checkmark', 'box', '__props'];
78
+ Checkbox.withVariantTypes = (styles) => {
79
+ return Checkbox;
80
+ };
81
+ Checkbox.defaultProps = {
82
+ checkIcon: 'check',
83
+ };
84
+ MobileStyleRegistry.registerComponent(Checkbox);
85
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Checkbox/index.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC9B,OAAO,EAAE,SAAS,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AACrF,OAAO,EAAE,wBAAwB,EAAE,MAAM,OAAO,CAAA;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAG9B,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,EAAE,MAA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//# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/components/Checkbox/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/Checkbox/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,45 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useCallback, useEffect } from 'react';
3
+ import { View } from 'react-native';
4
+ import Animated, { Easing, useSharedValue, useAnimatedStyle, withTiming, } from 'react-native-reanimated';
5
+ export * from './types';
6
+ export const Collapse = (props) => {
7
+ const { open, children, style, contentContainerStyle, animationConfig, ...rest } = {
8
+ ...Collapse.defaultProps,
9
+ ...props,
10
+ };
11
+ /** Two separate SharedValues are required: `height` is the measured natural height (written once and never animated), while `animatedHeight` is the value that actually drives the transition. Keeping them separate avoids re-triggering `onLayout` effects when the animation runs. */
12
+ const height = useSharedValue(0);
13
+ const animatedHeight = useSharedValue(0);
14
+ const onLayout = useCallback((event) => {
15
+ const measuredHeight = event.nativeEvent.layout.height;
16
+ /** Guard prevents overwriting the measured height if children re-trigger layout (e.g. after a font-load or image decode). */
17
+ if (height.value != 0)
18
+ return;
19
+ if (measuredHeight) {
20
+ height.value = measuredHeight;
21
+ if (open) {
22
+ animatedHeight.value = withTiming(measuredHeight, animationConfig);
23
+ }
24
+ }
25
+ }, [open]);
26
+ /** `maxHeight` is animated rather than `height` so the inner View can still measure its natural size via `onLayout`; animating `height` directly would freeze the measurement. The `'auto'` fallback keeps content visible before the first layout completes. */
27
+ const animatedStyle = useAnimatedStyle(() => {
28
+ return {
29
+ maxHeight: height.value === 0 ? 'auto' : animatedHeight.value,
30
+ overflow: 'hidden',
31
+ };
32
+ });
33
+ useEffect(() => {
34
+ animatedHeight.value = withTiming(open ? height.value : 0, animationConfig);
35
+ }, [open]);
36
+ return (_jsx(Animated.View, { ...rest, style: [animatedStyle, style], children: _jsx(View, { onLayout: onLayout, style: contentContainerStyle, children: children }) }));
37
+ };
38
+ const defaultAnimationConfig = {
39
+ duration: 300,
40
+ easing: Easing.inOut(Easing.quad),
41
+ };
42
+ Collapse.defaultProps = {
43
+ animationConfig: defaultAnimationConfig,
44
+ };
45
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Collapse/index.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACrD,OAAO,EAAqB,IAAI,EAAE,MAAM,cAAc,CAAA;AAEtD,OAAO,QAAQ,EAAE,EACf,MAAM,EACN,cAAc,EACd,gBAAgB,EAChB,UAAU,GACX,MAAM,yBAAyB,CAAA;AAEhC,cAAc,SAAS,CAAA;AAEvB,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,KAAoB,EAAE,EAAE;IAC/C,MAAM,EACJ,IAAI,EACJ,QAAQ,EACR,KAAK,EACL,qBAAqB,EACrB,eAAe,EACf,GAAG,IAAI,EACR,GAAG;QACF,GAAG,QAAQ,CAAC,YAAY;QACxB,GAAG,KAAK;KACT,CAAA;IAED,yRAAyR;IACzR,MAAM,MAAM,GAAG,cAAc,CAAC,CAAC,CAAC,CAAA;IAChC,MAAM,cAAc,GAAG,cAAc,CAAC,CAAC,CAAC,CAAA;IAExC,MAAM,QAAQ,GAAG,WAAW,CAAC,CAAC,KAAwB,EAAE,EAAE;QACxD,MAAM,cAAc,GAAG,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,CAAA;QAEtD,6HAA6H;QAC7H,IAAI,MAAM,CAAC,KAAK,IAAI,CAAC;YAAE,OAAM;QAE7B,IAAI,cAAc,EAAE,CAAC;YACnB,MAAM,CAAC,KAAK,GAAG,cAAc,CAAA;YAE7B,IAAI,IAAI,EAAE,CAAC;gBACT,cAAc,CAAC,KAAK,GAAG,UAAU,CAAC,cAAc,EAAE,eAAe,CAAC,CAAA;YACpE,CAAC;QACH,CAAC;IACH,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAA;IAEV,iQAAiQ;IACjQ,MAAM,aAAa,GAAG,gBAAgB,CAAC,GAAG,EAAE;QAC1C,OAAO;YACL,SAAS,EAAE,MAAM,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,cAAc,CAAC,KAAK;YAC7D,QAAQ,EAAE,QAAQ;SACnB,CAAA;IACH,CAAC,CAAC,CAAA;IAEF,SAAS,CAAC,GAAG,EAAE;QACb,cAAc,CAAC,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,eAAe,CAAC,CAAA;IAC7E,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAA;IAEV,OAAO,CACL,KAAC,QAAQ,CAAC,IAAI,OAAK,IAAI,EAAE,KAAK,EAAE,CAAC,aAAa,EAAE,KAAK,CAAC,YACpD,KAAC,IAAI,IAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,qBAAqB,YACnD,QAAQ,GACJ,GACO,CACjB,CAAA;AACH,CAAC,CAAA;AAED,MAAM,sBAAsB,GAA4B;IACtD,QAAQ,EAAE,GAAG;IACb,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC;CAClC,CAAA;AAED,QAAQ,CAAC,YAAY,GAAG;IACtB,eAAe,EAAE,sBAAsB;CACvB,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/Collapse/types.ts"],"names":[],"mappings":""}