@codeleap/mobile 7.0.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,81 @@
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 { MobileStyleRegistry } from '../../Registry';
7
+ import { useStylesFor } from '../../hooks';
8
+ import { useInputBase } from '../InputBase/useInputBase';
9
+ import { fields } from '@codeleap/form';
10
+ export * from './styles';
11
+ export * from './types';
12
+ const reversedOrder = [...InputBaseDefaultOrder].reverse();
13
+ export const Switch = (props) => {
14
+ const { inputBaseProps, others, } = selectInputBaseProps({
15
+ ...Switch.defaultProps,
16
+ ...props,
17
+ });
18
+ const { style, disabled, debugName, switchOnLeft, field, forceError, value, onValueChange, } = others;
19
+ const styles = useStylesFor(Switch.styleRegistryName, style);
20
+ const { validation, wrapperRef, inputValue, onInputValueChange, } = useInputBase(field, fields.boolean, { value, onValueChange });
21
+ const trackAnimation = useAnimatedVariantStyles({
22
+ variantStyles: styles,
23
+ animatedProperties: ['track:off', 'track:disabled', 'track:on', 'track:disabled-on', 'track:disabled-off'],
24
+ transition: styles['track:transition'],
25
+ updater: () => {
26
+ 'worklet';
27
+ let disabledStyle = {};
28
+ if (disabled) {
29
+ disabledStyle = inputValue ? styles['track:disabled-on'] : styles['track:disabled-off'];
30
+ }
31
+ const style = inputValue ? styles['track:on'] : styles['track:off'];
32
+ return {
33
+ ...style,
34
+ ...disabledStyle,
35
+ };
36
+ },
37
+ dependencies: [inputValue, disabled],
38
+ });
39
+ const thumbAnimation = useAnimatedVariantStyles({
40
+ variantStyles: styles,
41
+ animatedProperties: ['thumb:off', 'thumb:disabled', 'thumb:on', 'thumb:disabled-off', 'thumb:disabled-on'],
42
+ transition: styles['thumb:transition'],
43
+ updater: () => {
44
+ 'worklet';
45
+ let disabledStyle = {};
46
+ if (disabled) {
47
+ disabledStyle = inputValue ? styles['thumb:disabled-on'] : styles['thumb:disabled-off'];
48
+ }
49
+ const style = inputValue ? styles['thumb:on'] : styles['thumb:off'];
50
+ return {
51
+ ...style,
52
+ ...disabledStyle,
53
+ };
54
+ },
55
+ dependencies: [inputValue, disabled],
56
+ });
57
+ /** Same `__props` escape-hatch as Checkbox/RadioGroup — lets the style variant set the default side without requiring a prop at every call site. */
58
+ // @ts-expect-error
59
+ const _switchOnLeft = switchOnLeft ?? styles?.__props?.switchOnLeft;
60
+ const hasError = validation?.showError || forceError;
61
+ return _jsx(InputBase, { ...inputBaseProps, ref: wrapperRef, debugName: debugName, wrapper: Touchable, error: hasError ? validation?.message || forceError : null, style: styles, wrapperProps: {
62
+ onPress: () => onInputValueChange(!inputValue),
63
+ disabled,
64
+ rippleDisabled: true,
65
+ }, order: _switchOnLeft ? reversedOrder : InputBaseDefaultOrder, disabled: disabled, children: _jsx(View, { animated: true, animatedStyle: trackAnimation, style: [
66
+ styles?.track,
67
+ disabled && styles['track:disabled'],
68
+ ], children: _jsx(View, { animated: true, animatedStyle: thumbAnimation, style: [
69
+ styles?.thumb,
70
+ disabled && styles['thumb:disabled'],
71
+ ] }) }) });
72
+ };
73
+ Switch.styleRegistryName = 'Switch';
74
+ Switch.elements = [...InputBase.elements, 'track', 'thumb'];
75
+ Switch.rootElement = 'wrapper';
76
+ Switch.withVariantTypes = (styles) => {
77
+ return Switch;
78
+ };
79
+ Switch.defaultProps = {};
80
+ MobileStyleRegistry.registerComponent(Switch);
81
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Switch/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;AAGxC,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,EA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O,IAAI,UAAU,CAAC,CAAC,CAAC,IAAI,EAC1D,KAAK,EAAE,MAAM,EACb,YAAY,EAAE;YACZ,OAAO,EAAE,GAAG,EAAE,CAAC,kBAAkB,CAAC,CAAC,UAAU,CAAC;YAC9C,QAAQ;YACR,cAAc,EAAE,IAAI;SACrB,EACD,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,qBAAqB,EAC5D,QAAQ,EAAE,QAAQ,YAElB,KAAC,IAAI,IACH,QAAQ,QACR,aAAa,EAAE,cAAc,EAC7B,KAAK,EAAE;gBACL,MAAM,EAAE,KAAK;gBACb,QAAQ,IAAI,MAAM,CAAC,gBAAgB,CAAC;aACrC,YAED,KAAC,IAAI,IACH,QAAQ,QACR,aAAa,EAAE,cAAc,EAC7B,KAAK,EAAE;oBACL,MAAM,EAAE,KAAK;oBACb,QAAQ,IAAI,MAAM,CAAC,gBAAgB,CAAC;iBACrC,GACD,GACG,GACG,CAAA;AACd,CAAC,CAAA;AAED,MAAM,CAAC,iBAAiB,GAAG,QAAQ,CAAA;AACnC,MAAM,CAAC,QAAQ,GAAG,CAAC,GAAG,SAAS,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAAA;AAC3D,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,EAA0B,CAAA;AAEhD,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/Switch/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/Switch/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,44 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { createContext, useContext, useRef, useState } from 'react';
3
+ import { TypeGuards } from '@codeleap/types';
4
+ /**
5
+ * Uncontrolled mode (neither `value` nor `onValueChange` provided) uses internal `useState`;
6
+ * partial control (only one of the two) is not supported — if `onValueChange` is supplied
7
+ * without `value`, the value falls back to `defaultValue` and won't reflect external updates.
8
+ */
9
+ function useTabHandle(props) {
10
+ const { defaultValue, value, onValueChange, keepMounted, styles } = props;
11
+ const [tabValue, setInternalTabValue] = !onValueChange && !value
12
+ ? useState(defaultValue)
13
+ : [value ?? defaultValue, onValueChange];
14
+ const flatListRef = useRef(null);
15
+ const setTabValue = (newValue, index) => {
16
+ if (TypeGuards.isNumber(index) && flatListRef.current) {
17
+ flatListRef.current.scrollToIndex({
18
+ index,
19
+ animated: true,
20
+ });
21
+ }
22
+ setInternalTabValue(newValue);
23
+ };
24
+ return {
25
+ value: tabValue,
26
+ setValue: setTabValue,
27
+ styles,
28
+ keepMounted,
29
+ flatListRef,
30
+ };
31
+ }
32
+ const Context = createContext({});
33
+ export function TabsProvider({ children, ...handleProps }) {
34
+ const handle = useTabHandle(handleProps);
35
+ return _jsx(Context.Provider, { value: handle, children: children });
36
+ }
37
+ export function useTabContext() {
38
+ const ctx = useContext(Context);
39
+ if (ctx === null) {
40
+ throw new Error('Tabs component was not found in the tree');
41
+ }
42
+ return ctx;
43
+ }
44
+ //# sourceMappingURL=Context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Context.js","sourceRoot":"","sources":["../../../src/components/Tabs/Context.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAGnE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE5C;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CAAC,0CAA0C,CAAC,CAAA;IAC7D,CAAC;IAED,OAAO,GAAG,CAAA;AACZ,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
+ import { useTabContext } from './Context';
3
+ import { memoBy } from '@codeleap/utils';
4
+ import { View } from '../View';
5
+ const PanelMemoized = memoBy((props) => {
6
+ const { children } = props;
7
+ return _jsx(_Fragment, { children: children });
8
+ }, ['children', 'styles']);
9
+ /**
10
+ * Inactive panels are hidden via `display: 'none'` rather than unmounted, so their state is
11
+ * preserved across tab switches when `keepMounted` is true. Set `keepMounted={false}` at the
12
+ * Tabs or Panel level to unmount inactive panels and reclaim memory at the cost of re-mounting.
13
+ */
14
+ export const Panel = ({ keepMounted: panelKeepMounted = true, ...props }) => {
15
+ const { value, styles, keepMounted } = useTabContext();
16
+ const active = value === props.value;
17
+ if (!keepMounted && !active || !panelKeepMounted && !active)
18
+ return null;
19
+ return _jsx(View, { style: [styles?.panel, props?.style, { display: active ? 'flex' : 'none' }], children: _jsx(PanelMemoized, { ...props, styles: styles }) });
20
+ };
21
+ //# sourceMappingURL=Panel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Panel.js","sourceRoot":"","sources":["../../../src/components/Tabs/Panel.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAExC,OAAO,EAAE,IAAI,EAAa,MAAM,SAAS,CAAA;AAWzC,MAAM,aAAa,GAAG,MAAM,CAAC,CAAC,KAAkC,EAAE,EAAE;IAClE,MAAM,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAA;IAE1B,OAAO,4BAAG,QAAQ,GAAI,CAAA;AACxB,CAAC,EAAE,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAA;AAE1B;;;;GAIG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,EAAE,WAAW,EAAE,gBAAgB,GAAG,IAAI,EAAE,GAAG,KAAK,EAAc,EAAE,EAAE;IACtF,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,aAAa,EAAE,CAAA;IAEtD,MAAM,MAAM,GAAG,KAAK,KAAK,KAAK,CAAC,KAAK,CAAA;IAEpC,IAAI,CAAC,WAAW,IAAI,CAAC,MAAM,IAAI,CAAC,gBAAgB,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAA;IAExE,OAAO,KAAC,IAAI,IAAC,KAAK,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,YACtF,KAAC,aAAa,OAAK,KAAK,EAAE,MAAM,EAAE,MAAM,GAAI,GACvC,CAAA;AACT,CAAC,CAAA"}
@@ -0,0 +1,28 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useTabContext } from './Context';
3
+ import { memoBy } from '@codeleap/utils';
4
+ import { Touchable } from '../Touchable';
5
+ import { Icon } from '../Icon';
6
+ import { Text } from '../Text';
7
+ const TabMemoized = memoBy((props) => {
8
+ const { value, text, icon, active, setValue, styles, disabled } = props;
9
+ return (_jsxs(Touchable, { style: [
10
+ styles?.tabWrapper,
11
+ active && styles?.['tabWrapper:active'],
12
+ disabled && styles?.['tabWrapper:disabled']
13
+ ], onPress: () => setValue(value), debugName: `tabs:${value}`, children: [_jsx(Icon, { style: [
14
+ styles?.tabIcon,
15
+ active && styles?.['tabIcon:active'],
16
+ disabled && styles?.['tabIcon:disabled']
17
+ ], name: icon }), _jsx(Text, { style: [
18
+ styles?.tabText,
19
+ active && styles?.['tabText:active'],
20
+ disabled && styles?.['tabText:disabled']
21
+ ], text: text })] }));
22
+ }, ['icon', 'text', 'active', 'styles', 'disabled']);
23
+ export const Tab = (props) => {
24
+ const { value, setValue, styles } = useTabContext();
25
+ const active = value === props.value;
26
+ return _jsx(TabMemoized, { ...props, active: active, setValue: (value) => setValue(value, null), styles: styles });
27
+ };
28
+ //# sourceMappingURL=Tab.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Tab.js","sourceRoot":"","sources":["../../../src/components/Tabs/Tab.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAExC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAU9B,MAAM,WAAW,GAAG,MAAM,CAAC,CAAC,KAAgC,EAAE,EAAE;IAC9D,MAAM,EACJ,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,QAAQ,EACR,MAAM,EACN,QAAQ,EACT,GAAG,KAAK,CAAA;IAET,OAAO,CACL,MAAC,SAAS,IACR,KAAK,EAAE;YACL,MAAM,EAAE,UAAU;YAClB,MAAM,IAAI,MAAM,EAAE,CAAC,mBAAmB,CAAC;YACvC,QAAQ,IAAI,MAAM,EAAE,CAAC,qBAAqB,CAAC;SAC5C,EACD,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,EAC9B,SAAS,EAAE,QAAQ,KAAK,EAAE,aAE1B,KAAC,IAAI,IACH,KAAK,EAAE;oBACL,MAAM,EAAE,OAAO;oBACf,MAAM,IAAI,MAAM,EAAE,CAAC,gBAAgB,CAAC;oBACpC,QAAQ,IAAI,MAAM,EAAE,CAAC,kBAAkB,CAAC;iBACzC,EACD,IAAI,EAAE,IAAI,GACV,EAEF,KAAC,IAAI,IACH,KAAK,EAAE;oBACL,MAAM,EAAE,OAAO;oBACf,MAAM,IAAI,MAAM,EAAE,CAAC,gBAAgB,CAAC;oBACpC,QAAQ,IAAI,MAAM,EAAE,CAAC,kBAAkB,CAAC;iBACzC,EACD,IAAI,EAAE,IAAI,GACV,IACQ,CACb,CAAA;AACH,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAA;AAEpD,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,KAAe,EAAE,EAAE;IACrC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,aAAa,EAAE,CAAA;IAEnD,MAAM,MAAM,GAAG,KAAK,KAAK,KAAK,CAAC,KAAK,CAAA;IAEpC,OAAO,KAAC,WAAW,OACb,KAAK,EACT,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,EAC1C,MAAM,EAAE,MAAM,GACd,CAAA;AACJ,CAAC,CAAA"}
@@ -0,0 +1,16 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { FlatList } from 'react-native';
3
+ import { useTabContext } from './Context';
4
+ import React from 'react';
5
+ /**
6
+ * Tab children are passed as JSX children (not a `data` array), converted via
7
+ * `React.Children.toArray` and fed into a horizontal FlatList. The FlatList ref is shared from
8
+ * context so `Tab` can programmatically scroll to the active tab on selection.
9
+ */
10
+ export const TabList = (props) => {
11
+ const { children, ...flatListProps } = props;
12
+ const { styles, flatListRef } = useTabContext();
13
+ const childrenArray = React.Children.toArray(children);
14
+ return (_jsx(FlatList, { horizontal: true, showsHorizontalScrollIndicator: false, showsVerticalScrollIndicator: false, ...flatListProps, ref: flatListRef, data: childrenArray, renderItem: ({ item }) => item, keyExtractor: (_, index) => `tab-${index}`, style: styles?.tabList, contentContainerStyle: styles?.tabListContainer }));
15
+ };
16
+ //# sourceMappingURL=TabList.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TabList.js","sourceRoot":"","sources":["../../../src/components/Tabs/TabList.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAiB,MAAM,cAAc,CAAA;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB;;;;GAIG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,KAAmB,EAAE,EAAE;IAC7C,MAAM,EAAE,QAAQ,EAAE,GAAG,aAAa,EAAE,GAAG,KAAK,CAAA;IAE5C,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,aAAa,EAAE,CAAA;IAE/C,MAAM,aAAa,GAAG,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;IAEtD,OAAO,CACL,KAAC,QAAQ,IACP,UAAU,QACV,8BAA8B,EAAE,KAAK,EACrC,4BAA4B,EAAE,KAAK,KAC/B,aAAa,EACjB,GAAG,EAAE,WAAW,EAChB,IAAI,EAAE,aAAa,EACnB,UAAU,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,EAC9B,YAAY,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,OAAO,KAAK,EAAE,EAC1C,KAAK,EAAE,MAAM,EAAE,OAAO,EACtB,qBAAqB,EAAE,MAAM,EAAE,gBAAgB,GAC/C,CACH,CAAA;AACH,CAAC,CAAA"}
@@ -0,0 +1,34 @@
1
+ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { View } from '../View';
3
+ import { TabsProvider } from './Context';
4
+ import { Panel } from './Panel';
5
+ import { Tab } from './Tab';
6
+ import { TabList } from './TabList';
7
+ import { MobileStyleRegistry } from '../../Registry';
8
+ import { useStylesFor } from '../../hooks';
9
+ export { useTabContext } from './Context';
10
+ export * from './types';
11
+ export * from './styles';
12
+ export const Tabs = (props) => {
13
+ const { style, value, onValueChange, defaultValue, keepMounted, withWrapper, children, ...rest } = {
14
+ ...Tabs.defaultProps,
15
+ ...props,
16
+ };
17
+ const styles = useStylesFor(Tabs.styleRegistryName, style);
18
+ return (_jsx(TabsProvider, { value: value, onValueChange: onValueChange, defaultValue: defaultValue, styles: styles, keepMounted: keepMounted, children: withWrapper ? (_jsx(View, { ...rest, style: styles?.wrapper, children: children })) : _jsx(_Fragment, { children: children }) }));
19
+ };
20
+ Tabs.Tab = Tab;
21
+ Tabs.TabList = TabList;
22
+ Tabs.Panel = Panel;
23
+ Tabs.styleRegistryName = 'Tabs';
24
+ Tabs.elements = ['wrapper', 'tab', 'panel'];
25
+ Tabs.rootElement = 'wrapper';
26
+ Tabs.withVariantTypes = (styles) => {
27
+ return Tabs;
28
+ };
29
+ Tabs.defaultProps = {
30
+ keepMounted: true,
31
+ withWrapper: true,
32
+ };
33
+ MobileStyleRegistry.registerComponent(Tabs);
34
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Tabs/index.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC9B,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAC3B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAGnC,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAG1C,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAEzC,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AAExB,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,KAAgB,EAAE,EAAE;IACvC,MAAM,EACJ,KAAK,EACL,KAAK,EACL,aAAa,EACb,YAAY,EACZ,WAAW,EACX,WAAW,EACX,QAAQ,EACR,GAAG,IAAI,EACR,GAAG;QACF,GAAG,IAAI,CAAC,YAAY;QACpB,GAAG,KAAK;KACT,CAAA;IAED,MAAM,MAAM,GAAG,YAAY,CAAC,IAAI,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAA;IAE1D,OAAO,CACL,KAAC,YAAY,IACX,KAAK,EAAE,KAAK,EACZ,aAAa,EAAE,aAAa,EAC5B,YAAY,EAAE,YAAY,EAC1B,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,WAAW,YAEvB,WAAW,CAAC,CAAC,CAAC,CACb,KAAC,IAAI,OAAK,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,YACnC,QAAQ,GACJ,CACR,CAAC,CAAC,CAAC,4BAAG,QAAQ,GAAI,GACN,CAChB,CAAA;AACH,CAAC,CAAA;AAED,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;AACd,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;AACtB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;AAElB,IAAI,CAAC,iBAAiB,GAAG,MAAM,CAAA;AAC/B,IAAI,CAAC,QAAQ,GAAG,CAAC,SAAS,EAAE,KAAK,EAAE,OAAO,CAAC,CAAA;AAC3C,IAAI,CAAC,WAAW,GAAG,SAAS,CAAA;AAE5B,IAAI,CAAC,gBAAgB,GAAG,CAAsB,MAAS,EAAE,EAAE;IACzD,OAAO,IAIN,CAAA;AACH,CAAC,CAAA;AAED,IAAI,CAAC,YAAY,GAAG;IAClB,WAAW,EAAE,IAAI;IACjB,WAAW,EAAE,IAAI;CACI,CAAA;AAEvB,mBAAmB,CAAC,iBAAiB,CAAC,IAAI,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/Tabs/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/Tabs/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,82 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React, { forwardRef, useState } from 'react';
3
+ import { TypeGuards } from '@codeleap/types';
4
+ import { Animated, Platform, Text as NativeText } from 'react-native';
5
+ import { usePressableFeedback } from '../../utils';
6
+ import { MobileStyleRegistry } from '../../Registry';
7
+ import { useStylesFor } from '../../hooks';
8
+ export * from './styles';
9
+ export * from './types';
10
+ export const Text = forwardRef((textProps, ref) => {
11
+ const { text, children, onPress, style, debounce, pressDisabled, animated, animatedStyle, ...props } = {
12
+ ...Text.defaultProps,
13
+ ...textProps,
14
+ };
15
+ // On iOS, RN Text renders a highlight on tap by default; suppressHighlighting must be true to
16
+ // opt into the custom pressFeedback color animation. Android always uses the polyfill because
17
+ // it has no native text-press highlight at all.
18
+ const pressPolyfillEnabled = Platform.select({
19
+ ios: props.suppressHighlighting,
20
+ android: true,
21
+ }) && !!onPress && !pressDisabled;
22
+ const [pressed, setPressed] = useState(false);
23
+ const pressedRef = React.useRef(false);
24
+ const _onPress = (e) => {
25
+ if (!onPress)
26
+ return;
27
+ if (TypeGuards.isNumber(debounce)) {
28
+ if (pressedRef.current) {
29
+ return;
30
+ }
31
+ pressedRef.current = true;
32
+ onPress?.(e);
33
+ setTimeout(() => {
34
+ pressedRef.current = false;
35
+ }, debounce);
36
+ }
37
+ else {
38
+ onPress?.(e);
39
+ }
40
+ };
41
+ const handlePress = (pressed) => {
42
+ if (!pressPolyfillEnabled)
43
+ return;
44
+ return () => {
45
+ if (onPress) {
46
+ setPressed(pressed);
47
+ }
48
+ };
49
+ };
50
+ const styles = useStylesFor(Text.styleRegistryName, style);
51
+ if (!!text && !TypeGuards.isString(text))
52
+ return _jsx(_Fragment, { children: text });
53
+ const Component = animated ? Animated.Text : NativeText;
54
+ const { getFeedbackStyle } = usePressableFeedback(styles, {
55
+ disabled: !pressPolyfillEnabled,
56
+ feedbackConfig: styles?.pressFeedback,
57
+ hightlightPropertyIn: 'color',
58
+ hightlightPropertyOut: 'backgroundColor',
59
+ });
60
+ const feedbackStyle = pressPolyfillEnabled ? getFeedbackStyle(pressed) : undefined;
61
+ const pressProps = !!onPress ? {
62
+ onPress: pressDisabled ? null : _onPress,
63
+ } : {};
64
+ const disabled = !!onPress && pressDisabled;
65
+ return (_jsxs(Component, { ...props, onPressIn: handlePress(true), onPressOut: handlePress(false), style: [styles?.text, animatedStyle, feedbackStyle, disabled ? styles['text:disabled'] : null], allowFontScaling: false, ...pressProps,
66
+ // @ts-ignore
67
+ ref: ref, children: [text, children] }));
68
+ });
69
+ Text.styleRegistryName = 'Text';
70
+ Text.elements = ['text', 'pressFeedback'];
71
+ Text.rootElement = 'text';
72
+ Text.withVariantTypes = (styles) => {
73
+ return Text;
74
+ };
75
+ /** Default debounce is 1000 ms — longer than Touchable's 500 ms — because double-tap on a
76
+ * pressable Text is harder to perceive and native tap coalescing on Text is unreliable. */
77
+ Text.defaultProps = {
78
+ debounce: 1000,
79
+ };
80
+ MobileStyleRegistry.registerComponent(Text);
81
+ export const AnimatedText = Animated.createAnimatedComponent(Text);
82
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Text/index.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,cAAc,CAAA;AACrE,OAAO,EAA2B,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAG3E,OAAO,EAAE,mBAAmB,EAAE,MA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AC5D,KAAK,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,aAAa,EAAE,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAC9F,gBAAgB,EAAE,KAAK,KACnB,UAAU;QACd,aAAa;QACb,GAAG,EAAE,GAAG,aAEP,IAAI,EACJ,QAAQ,IACC,CACb,CAAA;AACH,CAAC,CAAwC,CAAA;AAEzC,IAAI,CAAC,iBAAiB,GAAG,MAAM,CAAA;AAC/B,IAAI,CAAC,QAAQ,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;AACzC,IAAI,CAAC,WAAW,GAAG,MAAM,CAAA;AAEzB,IAAI,CAAC,gBAAgB,GAAG,CAAsB,MAAS,EAAE,EAAE;IACzD,OAAO,IAAuE,CAAA;AAChF,CAAC,CAAA;AAED;4FAC4F;AAC5F,IAAI,CAAC,YAAY,GAAG;IAClB,QAAQ,EAAE,IAAI;CACO,CAAA;AAEvB,mBAAmB,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAA;AAE3C,MAAM,CAAC,MAAM,YAAY,GAAG,QAAQ,CAAC,uBAAuB,CAAC,IAAI,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/Text/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/Text/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,99 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { forwardRef, useImperativeHandle } from 'react';
3
+ import { TypeGuards } from '@codeleap/types';
4
+ import { TextInput as NativeTextInput } from 'react-native';
5
+ import { InputBase, selectInputBaseProps } from '../InputBase';
6
+ import { Touchable } from '../Touchable';
7
+ import { MaskedTextInput } from '../../modules/textInputMask';
8
+ import { MobileStyleRegistry } from '../../Registry';
9
+ import { useStylesFor } from '../../hooks';
10
+ import { useTextInput } from './useTextInput';
11
+ import { useInputBasePartialStyles } from '../InputBase/useInputBasePartialStyles';
12
+ export * from './styles';
13
+ export * from './types';
14
+ export const TextInput = forwardRef((props, ref) => {
15
+ const allProps = {
16
+ ...TextInput.defaultProps,
17
+ ...props,
18
+ };
19
+ const { inputBaseProps, others, } = selectInputBaseProps(allProps);
20
+ const { debugName, visibilityToggle, masking, secure, field, onChangeMask, onPress, visibleIcon, hiddenIcon, style, autoAdjustSelection, selectionStart, forceError, multiline, onLayout, ...textInputProps } = others;
21
+ const styles = useStylesFor(TextInput.styleRegistryName, style);
22
+ const { validation, inputValue, onInputValueChange, innerInputRef, wrapperRef, isFocused, secureTextEntry, currentSelection, hasMultipleLines, hasValue, hasError, toggleSecureTextEntry, handleMaskChange, handleBlur, handleFocus, } = useTextInput(allProps);
23
+ useImperativeHandle(ref, () => {
24
+ if (!innerInputRef.current)
25
+ return null;
26
+ return {
27
+ ...innerInputRef.current,
28
+ };
29
+ });
30
+ /** Swaps the underlying element to the masked variant; the ref forwarding also changes — `refInput` is used instead of `ref` because MaskedTextInput does not forward refs the standard way. */
31
+ const InputElement = masking ? MaskedTextInput : NativeTextInput;
32
+ const isPressable = TypeGuards.isFunction(onPress);
33
+ const isDisabled = !!inputBaseProps.disabled;
34
+ /** `placeholderTextColor` and `selectionColor` are scalar RN props that cannot accept style arrays, so their colors are extracted as plain values here rather than in the style array passed to the element. */
35
+ const partialStyles = useInputBasePartialStyles(styles, ['placeholder', 'selection'], {
36
+ disabled: isDisabled,
37
+ error: !!hasError,
38
+ focus: isFocused || textInputProps?.focused,
39
+ });
40
+ const visibilityToggleProps = visibilityToggle ? {
41
+ onPress: toggleSecureTextEntry,
42
+ icon: (secureTextEntry ? hiddenIcon : visibleIcon),
43
+ debugName: `${debugName} toggle visibility`,
44
+ } : null;
45
+ const rightIcon = inputBaseProps?.rightIcon ?? visibilityToggleProps;
46
+ const maskingExtraProps = masking ? {
47
+ onChangeText: handleMaskChange,
48
+ ref: null,
49
+ refInput: (inputRef) => {
50
+ if (!!inputRef)
51
+ innerInputRef.current = inputRef;
52
+ },
53
+ ...masking,
54
+ } : {
55
+ onChangeText: onInputValueChange,
56
+ };
57
+ /** When `onPress` is supplied the input acts as a button: editing and the caret are disabled so the native keyboard never opens, and `pointerEvents="none"` prevents touch from reaching the input itself. */
58
+ const buttonModeProps = isPressable ? {
59
+ editable: false,
60
+ caretHidden: true,
61
+ } : {};
62
+ return _jsx(InputBase, { ...inputBaseProps, onLayout: onLayout, ref: wrapperRef, innerWrapper: isPressable ? Touchable : undefined, debugName: debugName, error: hasError ? validation?.message || forceError : null, style: {
63
+ ...styles,
64
+ innerWrapper: [
65
+ styles?.innerWrapper,
66
+ multiline && styles['innerWrapper:multiline'],
67
+ hasMultipleLines && styles['innerWrapper:hasMultipleLines'],
68
+ ],
69
+ }, innerWrapperProps: {
70
+ ...(inputBaseProps.innerWrapperProps || {}),
71
+ onPress,
72
+ debugName,
73
+ dismissKeyboard: false,
74
+ }, rightIcon: rightIcon, focused: isFocused || textInputProps?.focused, hasValue: hasValue, children: _jsx(InputElement, { allowFontScaling: false, editable: !isPressable && !isDisabled, ...buttonModeProps, selection: autoAdjustSelection ? currentSelection : undefined, placeholderTextColor: partialStyles?.placeholder?.color, selectionColor: partialStyles?.selection?.color, secureTextEntry: secure && secureTextEntry, textAlignVertical: multiline ? 'top' : undefined, multiline: multiline, ...textInputProps, value: inputValue, onChangeText: onInputValueChange, onBlur: handleBlur, onFocus: handleFocus, style: [
75
+ styles?.input,
76
+ multiline && styles['input:multiline'],
77
+ (isFocused || textInputProps?.focused) && styles['input:focused'],
78
+ hasError && styles['input:error'],
79
+ isDisabled && styles['input:disabled'],
80
+ hasMultipleLines && styles['input:hasMultipleLines'],
81
+ hasValue && styles['input:typed'],
82
+ ], ref: innerInputRef, pointerEvents: isPressable ? 'none' : undefined, ...maskingExtraProps }) });
83
+ });
84
+ TextInput.styleRegistryName = 'TextInput';
85
+ TextInput.elements = [...InputBase.elements, 'input', 'placeholder', 'selection'];
86
+ TextInput.rootElement = 'wrapper';
87
+ TextInput.withVariantTypes = (styles) => {
88
+ return TextInput;
89
+ };
90
+ TextInput.defaultProps = {
91
+ hiddenIcon: 'input-visiblity:hidden',
92
+ visibleIcon: 'input-visiblity:visible',
93
+ visibilityToggle: false,
94
+ autoAdjustSelection: false,
95
+ selectionStart: 0,
96
+ secure: false,
97
+ };
98
+ MobileStyleRegistry.registerComponent(TextInput);
99
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/TextInput/index.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAA;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,SAAS,IAAI,eAAe,EAAE,MAAM,cAAc,CAAA;AAC3D,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAG7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAA;AAElF,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AAEvB,MAAM,CAAC,MAAM,SAAS,GAAG,UAAU,CAAkC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IAClF,MAAM,Q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Aa,EAClB,aAAa,EAAE,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,KAC3C,iBAAiB,GACrB,GACQ,CAAA;AACd,CAAC,CAA6C,CAAA;AAE9C,SAAS,CAAC,iBAAiB,GAAG,WAAW,CAAA;AACzC,SAAS,CAAC,QAAQ,GAAG,CAAC,GAAG,SAAS,CAAC,QAAQ,EAAE,OAAO,EAAE,aAAa,EAAE,WAAW,CAAC,CAAA;AACjF,SAAS,CAAC,WAAW,GAAG,SAAS,CAAA;AAEjC,SAAS,CAAC,gBAAgB,GAAG,CAAsB,MAAS,EAAE,EAAE;IAC9D,OAAO,SAAiF,CAAA;AAC1F,CAAC,CAAA;AAED,SAAS,CAAC,YAAY,GAAG;IACvB,UAAU,EAAE,wBAAmC;IAC/C,WAAW,EAAE,yBAAoC;IACjD,gBAAgB,EAAE,KAAK;IACvB,mBAAmB,EAAE,KAAK;IAC1B,cAAc,EAAE,CAAC;IACjB,MAAM,EAAE,KAAK;CACa,CAAA;AAE5B,mBAAmB,CAAC,iBAAiB,CAAC,SAAS,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/TextInput/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/TextInput/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,66 @@
1
+ import { useCallback, useState } from 'react';
2
+ import { useInputBase } from '../InputBase/useInputBase';
3
+ import { fields } from '@codeleap/form';
4
+ import { inputOverlayManager } from '../InputOverlay';
5
+ export function useTextInput(props) {
6
+ const { onFocus, onBlur, secure, field, autoAdjustSelection, selectionStart, masking, onChangeMask, multiline, forceError, value, onValueChange, } = props;
7
+ const [isFocused, setIsFocused] = useState(false);
8
+ const [currentSelection, setCurrentSelection] = useState({ start: 0 });
9
+ const [secureTextEntry, setSecureTextEntry] = useState(secure);
10
+ const toggleSecureTextEntry = () => setSecureTextEntry(s => !s);
11
+ const { fieldHandle, validation, innerInputRef, wrapperRef, onInputValueChange, inputValue, } = useInputBase(field, fields.text, { value, onValueChange }, {
12
+ revealValue() {
13
+ setSecureTextEntry(false);
14
+ },
15
+ hideValue() {
16
+ setSecureTextEntry(true);
17
+ },
18
+ toggleValueVisibility() {
19
+ toggleSecureTextEntry();
20
+ },
21
+ }, [setSecureTextEntry]);
22
+ const handleBlur = useCallback((e) => {
23
+ validation?.onInputBlurred?.();
24
+ setIsFocused(false);
25
+ if (autoAdjustSelection)
26
+ setCurrentSelection({ start: selectionStart });
27
+ onBlur?.(e);
28
+ }, [validation?.onInputBlurred, onBlur]);
29
+ const handleFocus = useCallback((e) => {
30
+ setIsFocused(true);
31
+ /** `null` selection lets RN restore the cursor to wherever the user tapped; it is reset to `selectionStart` on blur to keep a predictable resting position. */
32
+ if (autoAdjustSelection)
33
+ setCurrentSelection(null);
34
+ onFocus?.(e);
35
+ /** Close any open InputOverlay (e.g. dropdowns, pickers) when the keyboard appears to avoid overlap. */
36
+ inputOverlayManager.closeAll();
37
+ }, [onFocus]);
38
+ const handleMaskChange = useCallback((masked, unmasked) => {
39
+ /** `saveFormatted` branch currently stores `masked` in both cases — the `unmasked` path is a known placeholder and not yet wired up. */
40
+ onInputValueChange(masking?.saveFormatted ? masked : masked);
41
+ if (onChangeMask)
42
+ onChangeMask(masked, unmasked);
43
+ }, [masking?.saveFormatted, onChangeMask]);
44
+ const hasMultipleLines = multiline && inputValue?.includes('\n');
45
+ const hasValue = inputValue?.length > 0;
46
+ const hasError = validation?.showError || forceError;
47
+ return {
48
+ isFocused,
49
+ currentSelection,
50
+ secureTextEntry,
51
+ handleBlur,
52
+ handleFocus,
53
+ handleMaskChange,
54
+ fieldHandle,
55
+ validation,
56
+ innerInputRef,
57
+ wrapperRef,
58
+ toggleSecureTextEntry,
59
+ hasMultipleLines,
60
+ hasValue,
61
+ hasError,
62
+ inputValue,
63
+ onInputValueChange,
64
+ };
65
+ }
66
+ //# sourceMappingURL=useTextInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTextInput.js","sourceRoot":"","sources":["../../../src/components/TextInput/useTextInput.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAG7C,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAErD,MAAM,UAAU,YAAY,CAAC,KAA8B;IACzD,MAAM,EACJ,OAAO,EACP,MAAM,EACN,MAAM,EACN,KAAK,EACL,mBAAmB,EACnB,cAAc,EACd,OAAO,EACP,YAAY,EACZ,SAAS,EACT,UAAU,EACV,KAAK,EACL,aAAa,GACd,GAAG,KAAK,CAAA;IAET,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IAEjD,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,QAAQ,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAA;IAEtE,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAA;IAE9D,MAAM,qBAAqB,GAAG,GAAG,EAAE,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;IAE/D,MAAM,EACJ,WAAW,EACX,UAAU,EACV,aAAa,EACb,UAAU,EACV,kBAAkB,EAClB,UAAU,GACX,GAAG,YAAY,CAAS,KAAK,EAAE,MAAM,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,aAAa,EAAE,EAAE;QACrE,W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