@estuary-solutions/rn-core-ui 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (304) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +743 -0
  3. package/dist/Accordion/Accordion.d.ts +5 -0
  4. package/dist/Accordion/Accordion.d.ts.map +1 -0
  5. package/dist/Accordion/Accordion.js +19 -0
  6. package/dist/Accordion/AccordionContext.d.ts +7 -0
  7. package/dist/Accordion/AccordionContext.d.ts.map +1 -0
  8. package/dist/Accordion/AccordionContext.js +3 -0
  9. package/dist/Accordion/AccordionGroup.d.ts +7 -0
  10. package/dist/Accordion/AccordionGroup.d.ts.map +1 -0
  11. package/dist/Accordion/AccordionGroup.js +32 -0
  12. package/dist/Accordion/AccordionItem.d.ts +5 -0
  13. package/dist/Accordion/AccordionItem.d.ts.map +1 -0
  14. package/dist/Accordion/AccordionItem.js +12 -0
  15. package/dist/Accordion/AccordionTree.d.ts +6 -0
  16. package/dist/Accordion/AccordionTree.d.ts.map +1 -0
  17. package/dist/Accordion/AccordionTree.js +4 -0
  18. package/dist/Accordion/AccordionTreeInternal.d.ts +5 -0
  19. package/dist/Accordion/AccordionTreeInternal.d.ts.map +1 -0
  20. package/dist/Accordion/AccordionTreeInternal.js +36 -0
  21. package/dist/Accordion/AccordionTreeWithGroup.d.ts +8 -0
  22. package/dist/Accordion/AccordionTreeWithGroup.d.ts.map +1 -0
  23. package/dist/Accordion/AccordionTreeWithGroup.js +11 -0
  24. package/dist/Accordion/index.d.ts +5 -0
  25. package/dist/Accordion/index.d.ts.map +1 -0
  26. package/dist/Accordion/index.js +4 -0
  27. package/dist/Accordion/types/AccordionTypes.d.ts +65 -0
  28. package/dist/Accordion/types/AccordionTypes.d.ts.map +1 -0
  29. package/dist/Accordion/types/AccordionTypes.js +1 -0
  30. package/dist/Avatars/Avatar.d.ts +20 -0
  31. package/dist/Avatars/Avatar.d.ts.map +1 -0
  32. package/dist/Avatars/Avatar.js +63 -0
  33. package/dist/Badges/Badge.d.ts +25 -0
  34. package/dist/Badges/Badge.d.ts.map +1 -0
  35. package/dist/Badges/Badge.js +75 -0
  36. package/dist/Breadcrumbs/Breadcrumb.d.ts +13 -0
  37. package/dist/Breadcrumbs/Breadcrumb.d.ts.map +1 -0
  38. package/dist/Breadcrumbs/Breadcrumb.js +63 -0
  39. package/dist/Button/Button.d.ts +7 -0
  40. package/dist/Button/Button.d.ts.map +1 -0
  41. package/dist/Button/Button.js +62 -0
  42. package/dist/Button/ButtonGradient.d.ts +5 -0
  43. package/dist/Button/ButtonGradient.d.ts.map +1 -0
  44. package/dist/Button/ButtonGradient.js +61 -0
  45. package/dist/Button/index.d.ts +4 -0
  46. package/dist/Button/index.d.ts.map +1 -0
  47. package/dist/Button/index.js +3 -0
  48. package/dist/Button/types/ButtonGradientTypes.d.ts +80 -0
  49. package/dist/Button/types/ButtonGradientTypes.d.ts.map +1 -0
  50. package/dist/Button/types/ButtonGradientTypes.js +1 -0
  51. package/dist/Button/types/ButtonTypes.d.ts +65 -0
  52. package/dist/Button/types/ButtonTypes.d.ts.map +1 -0
  53. package/dist/Button/types/ButtonTypes.js +1 -0
  54. package/dist/Buttons/Button.d.ts +23 -0
  55. package/dist/Buttons/Button.d.ts.map +1 -0
  56. package/dist/Buttons/Button.js +66 -0
  57. package/dist/Cards/Card.d.ts +22 -0
  58. package/dist/Cards/Card.d.ts.map +1 -0
  59. package/dist/Cards/Card.js +26 -0
  60. package/dist/Cards/CardActionArea.d.ts +13 -0
  61. package/dist/Cards/CardActionArea.d.ts.map +1 -0
  62. package/dist/Cards/CardActionArea.js +30 -0
  63. package/dist/Cards/CardActions.d.ts +14 -0
  64. package/dist/Cards/CardActions.d.ts.map +1 -0
  65. package/dist/Cards/CardActions.js +41 -0
  66. package/dist/Cards/CardContent.d.ts +13 -0
  67. package/dist/Cards/CardContent.d.ts.map +1 -0
  68. package/dist/Cards/CardContent.js +19 -0
  69. package/dist/Cards/CardHeader.d.ts +16 -0
  70. package/dist/Cards/CardHeader.d.ts.map +1 -0
  71. package/dist/Cards/CardHeader.js +61 -0
  72. package/dist/Cards/CardMedia.d.ts +23 -0
  73. package/dist/Cards/CardMedia.d.ts.map +1 -0
  74. package/dist/Cards/CardMedia.js +16 -0
  75. package/dist/Cards/Paper.d.ts +13 -0
  76. package/dist/Cards/Paper.d.ts.map +1 -0
  77. package/dist/Cards/Paper.js +42 -0
  78. package/dist/DraggableFlatList/CellDecorators.d.ts +21 -0
  79. package/dist/DraggableFlatList/CellDecorators.d.ts.map +1 -0
  80. package/dist/DraggableFlatList/CellDecorators.js +66 -0
  81. package/dist/DraggableFlatList/CellRendererComponent.d.ts +20 -0
  82. package/dist/DraggableFlatList/CellRendererComponent.d.ts.map +1 -0
  83. package/dist/DraggableFlatList/CellRendererComponent.js +146 -0
  84. package/dist/DraggableFlatList/DraggableFlatList.d.ts +9 -0
  85. package/dist/DraggableFlatList/DraggableFlatList.d.ts.map +1 -0
  86. package/dist/DraggableFlatList/DraggableFlatList.js +282 -0
  87. package/dist/DraggableFlatList/DraggableFlatList.web.d.ts +4 -0
  88. package/dist/DraggableFlatList/DraggableFlatList.web.d.ts.map +1 -0
  89. package/dist/DraggableFlatList/DraggableFlatList.web.js +248 -0
  90. package/dist/DraggableFlatList/NestableDraggableFlatList.d.ts +9 -0
  91. package/dist/DraggableFlatList/NestableDraggableFlatList.d.ts.map +1 -0
  92. package/dist/DraggableFlatList/NestableDraggableFlatList.js +66 -0
  93. package/dist/DraggableFlatList/NestableScrollContainer.d.ts +5 -0
  94. package/dist/DraggableFlatList/NestableScrollContainer.d.ts.map +1 -0
  95. package/dist/DraggableFlatList/NestableScrollContainer.js +28 -0
  96. package/dist/DraggableFlatList/PlaceholderItem.d.ts +8 -0
  97. package/dist/DraggableFlatList/PlaceholderItem.d.ts.map +1 -0
  98. package/dist/DraggableFlatList/PlaceholderItem.js +44 -0
  99. package/dist/DraggableFlatList/RowItem.d.ts +13 -0
  100. package/dist/DraggableFlatList/RowItem.d.ts.map +1 -0
  101. package/dist/DraggableFlatList/RowItem.js +45 -0
  102. package/dist/DraggableFlatList/ScrollOffsetListener.d.ts +8 -0
  103. package/dist/DraggableFlatList/ScrollOffsetListener.d.ts.map +1 -0
  104. package/dist/DraggableFlatList/ScrollOffsetListener.js +13 -0
  105. package/dist/Flex/Flex.d.ts +12 -0
  106. package/dist/Flex/Flex.d.ts.map +1 -0
  107. package/dist/Flex/Flex.js +28 -0
  108. package/dist/Flex/Flex.types.d.ts +10 -0
  109. package/dist/Flex/Flex.types.d.ts.map +1 -0
  110. package/dist/Flex/Flex.types.js +1 -0
  111. package/dist/Flex/index.d.ts +4 -0
  112. package/dist/Flex/index.d.ts.map +1 -0
  113. package/dist/Flex/index.js +3 -0
  114. package/dist/LICENSE +20 -0
  115. package/dist/README.md +743 -0
  116. package/dist/SvgIcon/SvgIcon.d.ts +9 -0
  117. package/dist/SvgIcon/SvgIcon.d.ts.map +1 -0
  118. package/dist/SvgIcon/SvgIcon.js +39 -0
  119. package/dist/SvgIcon/components/IconAlertCircle.d.ts +4 -0
  120. package/dist/SvgIcon/components/IconAlertCircle.d.ts.map +1 -0
  121. package/dist/SvgIcon/components/IconAlertCircle.js +6 -0
  122. package/dist/SvgIcon/components/IconAngleLeft.d.ts +4 -0
  123. package/dist/SvgIcon/components/IconAngleLeft.d.ts.map +1 -0
  124. package/dist/SvgIcon/components/IconAngleLeft.js +6 -0
  125. package/dist/SvgIcon/components/IconAngleRight.d.ts +4 -0
  126. package/dist/SvgIcon/components/IconAngleRight.d.ts.map +1 -0
  127. package/dist/SvgIcon/components/IconAngleRight.js +6 -0
  128. package/dist/SvgIcon/components/IconCheckBox.d.ts +4 -0
  129. package/dist/SvgIcon/components/IconCheckBox.d.ts.map +1 -0
  130. package/dist/SvgIcon/components/IconCheckBox.js +6 -0
  131. package/dist/SvgIcon/components/IconCheckBoxOutlineBlank.d.ts +4 -0
  132. package/dist/SvgIcon/components/IconCheckBoxOutlineBlank.d.ts.map +1 -0
  133. package/dist/SvgIcon/components/IconCheckBoxOutlineBlank.js +6 -0
  134. package/dist/SvgIcon/components/IconCheckBoxWithBg.d.ts +4 -0
  135. package/dist/SvgIcon/components/IconCheckBoxWithBg.d.ts.map +1 -0
  136. package/dist/SvgIcon/components/IconCheckBoxWithBg.js +6 -0
  137. package/dist/SvgIcon/components/IconChevronDown.d.ts +4 -0
  138. package/dist/SvgIcon/components/IconChevronDown.d.ts.map +1 -0
  139. package/dist/SvgIcon/components/IconChevronDown.js +6 -0
  140. package/dist/SvgIcon/components/IconChevronUp.d.ts +4 -0
  141. package/dist/SvgIcon/components/IconChevronUp.d.ts.map +1 -0
  142. package/dist/SvgIcon/components/IconChevronUp.js +6 -0
  143. package/dist/SvgIcon/components/IconHome.d.ts +4 -0
  144. package/dist/SvgIcon/components/IconHome.d.ts.map +1 -0
  145. package/dist/SvgIcon/components/IconHome.js +6 -0
  146. package/dist/SvgIcon/components/IconPerson.d.ts +4 -0
  147. package/dist/SvgIcon/components/IconPerson.d.ts.map +1 -0
  148. package/dist/SvgIcon/components/IconPerson.js +6 -0
  149. package/dist/SvgIcon/components/IconPlayCircle.d.ts +4 -0
  150. package/dist/SvgIcon/components/IconPlayCircle.d.ts.map +1 -0
  151. package/dist/SvgIcon/components/IconPlayCircle.js +9 -0
  152. package/dist/SvgIcon/components/IconPlus.d.ts +4 -0
  153. package/dist/SvgIcon/components/IconPlus.d.ts.map +1 -0
  154. package/dist/SvgIcon/components/IconPlus.js +6 -0
  155. package/dist/SvgIcon/components/index.d.ts +13 -0
  156. package/dist/SvgIcon/components/index.d.ts.map +1 -0
  157. package/dist/SvgIcon/components/index.js +12 -0
  158. package/dist/SvgIcon/types/SvgIconTypes.d.ts +46 -0
  159. package/dist/SvgIcon/types/SvgIconTypes.d.ts.map +1 -0
  160. package/dist/SvgIcon/types/SvgIconTypes.js +1 -0
  161. package/dist/TextFields/TextField.d.ts +34 -0
  162. package/dist/TextFields/TextField.d.ts.map +1 -0
  163. package/dist/TextFields/TextField.js +400 -0
  164. package/dist/TextFields/index.d.ts +2 -0
  165. package/dist/TextFields/index.d.ts.map +1 -0
  166. package/dist/TextFields/index.js +1 -0
  167. package/dist/Texts/Text.d.ts +21 -0
  168. package/dist/Texts/Text.d.ts.map +1 -0
  169. package/dist/Texts/Text.js +49 -0
  170. package/dist/constants/DraggableFlatList/constants.d.ts +28 -0
  171. package/dist/constants/DraggableFlatList/constants.d.ts.map +1 -0
  172. package/dist/constants/DraggableFlatList/constants.js +25 -0
  173. package/dist/constants/DraggableFlatList/types.d.ts +65 -0
  174. package/dist/constants/DraggableFlatList/types.d.ts.map +1 -0
  175. package/dist/constants/DraggableFlatList/types.js +1 -0
  176. package/dist/constants/DraggableFlatList/types.web.d.ts +7 -0
  177. package/dist/constants/DraggableFlatList/types.web.d.ts.map +1 -0
  178. package/dist/constants/DraggableFlatList/types.web.js +1 -0
  179. package/dist/constants/consts.d.ts +16 -0
  180. package/dist/constants/consts.d.ts.map +1 -0
  181. package/dist/constants/consts.js +15 -0
  182. package/dist/constants/index.d.ts +3 -0
  183. package/dist/constants/index.d.ts.map +1 -0
  184. package/dist/constants/index.js +2 -0
  185. package/dist/constants/types.d.ts +22 -0
  186. package/dist/constants/types.d.ts.map +1 -0
  187. package/dist/constants/types.js +21 -0
  188. package/dist/context/DraggableFlatList/animatedValueContext.d.ts +29 -0
  189. package/dist/context/DraggableFlatList/animatedValueContext.d.ts.map +1 -0
  190. package/dist/context/DraggableFlatList/animatedValueContext.js +154 -0
  191. package/dist/context/DraggableFlatList/cellContext.d.ts +10 -0
  192. package/dist/context/DraggableFlatList/cellContext.d.ts.map +1 -0
  193. package/dist/context/DraggableFlatList/cellContext.js +18 -0
  194. package/dist/context/DraggableFlatList/draggableFlatListContext.d.ts +13 -0
  195. package/dist/context/DraggableFlatList/draggableFlatListContext.d.ts.map +1 -0
  196. package/dist/context/DraggableFlatList/draggableFlatListContext.js +19 -0
  197. package/dist/context/DraggableFlatList/nestableScrollContainerContext.d.ts +23 -0
  198. package/dist/context/DraggableFlatList/nestableScrollContainerContext.d.ts.map +1 -0
  199. package/dist/context/DraggableFlatList/nestableScrollContainerContext.js +36 -0
  200. package/dist/context/DraggableFlatList/propsContext.d.ts +9 -0
  201. package/dist/context/DraggableFlatList/propsContext.d.ts.map +1 -0
  202. package/dist/context/DraggableFlatList/propsContext.js +25 -0
  203. package/dist/context/DraggableFlatList/refContext.d.ts +20 -0
  204. package/dist/context/DraggableFlatList/refContext.d.ts.map +1 -0
  205. package/dist/context/DraggableFlatList/refContext.js +55 -0
  206. package/dist/hooks/DraggableFlatList/useAutoScroll.d.ts +2 -0
  207. package/dist/hooks/DraggableFlatList/useAutoScroll.d.ts.map +1 -0
  208. package/dist/hooks/DraggableFlatList/useAutoScroll.js +77 -0
  209. package/dist/hooks/DraggableFlatList/useCellTranslate.d.ts +9 -0
  210. package/dist/hooks/DraggableFlatList/useCellTranslate.d.ts.map +1 -0
  211. package/dist/hooks/DraggableFlatList/useCellTranslate.js +72 -0
  212. package/dist/hooks/DraggableFlatList/useNestedAutoScroll.d.ts +12 -0
  213. package/dist/hooks/DraggableFlatList/useNestedAutoScroll.d.ts.map +1 -0
  214. package/dist/hooks/DraggableFlatList/useNestedAutoScroll.js +77 -0
  215. package/dist/hooks/DraggableFlatList/useOnCellActiveAnimation.d.ts +15 -0
  216. package/dist/hooks/DraggableFlatList/useOnCellActiveAnimation.d.ts.map +1 -0
  217. package/dist/hooks/DraggableFlatList/useOnCellActiveAnimation.js +29 -0
  218. package/dist/hooks/DraggableFlatList/useStableCallback.d.ts +2 -0
  219. package/dist/hooks/DraggableFlatList/useStableCallback.d.ts.map +1 -0
  220. package/dist/hooks/DraggableFlatList/useStableCallback.js +11 -0
  221. package/dist/hooks/useTheme.d.ts +17 -0
  222. package/dist/hooks/useTheme.d.ts.map +1 -0
  223. package/dist/hooks/useTheme.js +12 -0
  224. package/dist/index.d.ts +23 -0
  225. package/dist/index.d.ts.map +1 -0
  226. package/dist/index.js +22 -0
  227. package/dist/themes/colors.d.ts +9 -0
  228. package/dist/themes/colors.d.ts.map +1 -0
  229. package/dist/themes/colors.js +201 -0
  230. package/dist/themes/elevationOverlay.d.ts +2 -0
  231. package/dist/themes/elevationOverlay.d.ts.map +1 -0
  232. package/dist/themes/elevationOverlay.js +12 -0
  233. package/dist/themes/fontSize.d.ts +23 -0
  234. package/dist/themes/fontSize.d.ts.map +1 -0
  235. package/dist/themes/fontSize.js +22 -0
  236. package/dist/themes/index.d.ts +5 -0
  237. package/dist/themes/index.d.ts.map +1 -0
  238. package/dist/themes/index.js +4 -0
  239. package/dist/themes/types/colorTypes.d.ts +665 -0
  240. package/dist/themes/types/colorTypes.d.ts.map +1 -0
  241. package/dist/themes/types/colorTypes.js +1 -0
  242. package/dist/utils/DraggableFlatList/typedMemo.d.ts +2 -0
  243. package/dist/utils/DraggableFlatList/typedMemo.d.ts.map +1 -0
  244. package/dist/utils/DraggableFlatList/typedMemo.js +2 -0
  245. package/dist/utils/cleanTagHTML.d.ts +22 -0
  246. package/dist/utils/cleanTagHTML.d.ts.map +1 -0
  247. package/dist/utils/cleanTagHTML.js +36 -0
  248. package/dist/utils/colors/color.d.ts +2 -0
  249. package/dist/utils/colors/color.d.ts.map +1 -0
  250. package/dist/utils/colors/color.js +6 -0
  251. package/dist/utils/colors/elevation.d.ts +7 -0
  252. package/dist/utils/colors/elevation.d.ts.map +1 -0
  253. package/dist/utils/colors/elevation.js +29 -0
  254. package/dist/utils/colors/index.d.ts +9 -0
  255. package/dist/utils/colors/index.d.ts.map +1 -0
  256. package/dist/utils/colors/index.js +7 -0
  257. package/dist/utils/converter.d.ts +47 -0
  258. package/dist/utils/converter.d.ts.map +1 -0
  259. package/dist/utils/converter.js +54 -0
  260. package/dist/utils/debounce.d.ts +36 -0
  261. package/dist/utils/debounce.d.ts.map +1 -0
  262. package/dist/utils/debounce.js +54 -0
  263. package/dist/utils/filters.d.ts +3 -0
  264. package/dist/utils/filters.d.ts.map +1 -0
  265. package/dist/utils/filters.js +10 -0
  266. package/dist/utils/fixedDistance.d.ts +16 -0
  267. package/dist/utils/fixedDistance.d.ts.map +1 -0
  268. package/dist/utils/fixedDistance.js +17 -0
  269. package/dist/utils/formatMoney.d.ts +30 -0
  270. package/dist/utils/formatMoney.d.ts.map +1 -0
  271. package/dist/utils/formatMoney.js +33 -0
  272. package/dist/utils/getOS.d.ts +6 -0
  273. package/dist/utils/getOS.d.ts.map +1 -0
  274. package/dist/utils/getOS.js +6 -0
  275. package/dist/utils/index.d.ts +13 -0
  276. package/dist/utils/index.d.ts.map +1 -0
  277. package/dist/utils/index.js +12 -0
  278. package/dist/utils/limitedString.d.ts +15 -0
  279. package/dist/utils/limitedString.d.ts.map +1 -0
  280. package/dist/utils/limitedString.js +19 -0
  281. package/dist/utils/resolutions.d.ts +65 -0
  282. package/dist/utils/resolutions.d.ts.map +1 -0
  283. package/dist/utils/resolutions.js +79 -0
  284. package/dist/utils/scale.d.ts +141 -0
  285. package/dist/utils/scale.d.ts.map +1 -0
  286. package/dist/utils/scale.js +141 -0
  287. package/documents/build.js +102 -0
  288. package/documents/buildFromRoot.js +49 -0
  289. package/documents/buildFromSample.js +40 -0
  290. package/documents/buildV2.js +98 -0
  291. package/documents/copyPackageToExample.js +31 -0
  292. package/example/RNCoreUISample/.eslintrc.js +10 -0
  293. package/example/RNCoreUISample/.prettierrc.js +7 -0
  294. package/example/RNCoreUISample/App.js +26 -0
  295. package/example/RNCoreUISample/README.md +104 -0
  296. package/example/RNCoreUISample/android/app/debug.keystore +0 -0
  297. package/example/RNCoreUISample/babel.config.js +29 -0
  298. package/example/RNCoreUISample/documents/storybook/manager.js +5 -0
  299. package/example/RNCoreUISample/fix_node_modules.js +12 -0
  300. package/example/RNCoreUISample/index.js +20 -0
  301. package/example/RNCoreUISample/jest.config.js +3 -0
  302. package/example/RNCoreUISample/metro.config.js +30 -0
  303. package/package.json +101 -0
  304. package/src/constants/DraggableFlatList/draggable.d.ts +12 -0
@@ -0,0 +1,79 @@
1
+ import { Platform, StatusBar } from 'react-native';
2
+ import { getBottomSpace, getStatusBarHeight, } from 'react-native-iphone-x-helper';
3
+ import DeviceInfo from 'react-native-device-info';
4
+ /**
5
+ * getPaddingTop - Get the top padding based on the device type
6
+ *
7
+ * 26 OPPO
8
+ * 28 NOKIA
9
+ * @returns {number} - Top padding
10
+ * @example
11
+ * ```jsx
12
+ * import { getPaddingTop } from '@estuary-solutions/rn-core-ui/utils';
13
+ * const paddingTop = getPaddingTop();
14
+ * console.log("paddingTop:", paddingTop);
15
+ * ```
16
+ */
17
+ export const getPaddingTop = () => {
18
+ // 26 OPPO
19
+ // 28 NOKIA
20
+ let sbHeight = getStatusBarHeight();
21
+ return (sbHeight >= 26 && sbHeight < 28) || sbHeight === 30 ? sbHeight : 0;
22
+ };
23
+ /**
24
+ * getPaddingBottom - Get the bottom padding based on the device type
25
+ * @returns {number} - Bottom padding
26
+ * @example
27
+ * ```jsx
28
+ * import { getPaddingBottom } from '@estuary-solutions/rn-core-ui/utils';
29
+ * const paddingBottom = getPaddingBottom();
30
+ * console.log("paddingBottom:", paddingBottom);
31
+ * ```
32
+ */
33
+ export const getPaddingBottom = () => {
34
+ let paddingBottom = getBottomSpace() / 2;
35
+ return paddingBottom;
36
+ };
37
+ /**
38
+ * isTablet - Check if the device is a tablet
39
+ * @returns {boolean} - true if the device is a tablet, false otherwise
40
+ * @example
41
+ * ```jsx
42
+ * import { isTablet } from '@estuary-solutions/rn-core-ui/utils';
43
+ * console.log("isTablet", isTablet); // true/false
44
+ * ```
45
+ */
46
+ export const isTablet = DeviceInfo.isTablet();
47
+ /**
48
+ * Use this function to get the styles based on the device type
49
+ * @example
50
+ * ```jsx
51
+ * <View style={StylePlatform({
52
+ tablet: styles.containerTablet,
53
+ phone: styles.containerPhone
54
+ })}>
55
+ <Text style={StylePlatform({
56
+ tablet: styles.textTablet,
57
+ phone: styles.textPhone
58
+ })}>
59
+ Hello, Platform!
60
+ </Text>
61
+ </View>
62
+ ```
63
+ */
64
+ export const StylePlatform = (styles) => {
65
+ if (isTablet) {
66
+ return styles.tablet || {};
67
+ }
68
+ return styles.phone || {};
69
+ };
70
+ /**
71
+ * statusBarHeight of the device
72
+ * @returns {number} - statusBarHeight
73
+ * @example
74
+ * ```jsx
75
+ * import { statusBarHeight } from '@estuary-solutions/rn-core-ui/utils';
76
+ * console.log("statusBarHeight", statusBarHeight);
77
+ * ```
78
+ */
79
+ export const statusBarHeight = (Platform.OS == "android" && StatusBar.currentHeight) ? StatusBar.currentHeight : 0;
@@ -0,0 +1,141 @@
1
+ export declare const width: number, height: number;
2
+ /**
3
+ * Just a constants that specify iPhone 12 width.
4
+ *
5
+ * *Example:*
6
+ *
7
+ * ```js
8
+ * import { IPHONE_12_WIDTH } from '@estuary-solutions/rn-core-ui/utils';
9
+ * console.log(IPHONE_12_WIDTH); // 375
10
+ * ```
11
+ *
12
+ * To get more information. Please see the [Documentation](https://lubrytics.com:9929/minhnhat.tran/estuary-rn-core-ui?tab=readme-ov-file#scaling-function)
13
+ *
14
+ * @see: https://lubrytics.com:9929/minhnhat.tran/estuary-rn-core-ui?tab=readme-ov-file#scaling-function
15
+ */
16
+ export declare const IPHONE_12_WIDTH = 375;
17
+ /**
18
+ * Just a constants that specify iPhone 12 height.
19
+ *
20
+ * *Example:*
21
+ *
22
+ * ```js
23
+ * import { IPHONE_12_HEIGTH } from '@estuary-solutions/rn-core-ui/utils';
24
+ * console.log(IPHONE_12_HEIGTH); // 812
25
+ * ```
26
+ *
27
+ * To get more information. Please see the [Documentation](https://lubrytics.com:9929/minhnhat.tran/estuary-rn-core-ui?tab=readme-ov-file#scaling-function)
28
+ *
29
+ * @see: https://lubrytics.com:9929/minhnhat.tran/estuary-rn-core-ui?tab=readme-ov-file#scaling-function
30
+ */
31
+ export declare const IPHONE_12_HEIGTH = 812;
32
+ export declare const scaleWidth: number;
33
+ export declare const scaleHeight: number;
34
+ export declare const scaleAvg: number;
35
+ /**
36
+ * Will return a linear scaled result of the provided size, based on scaleAvg. Use for scaling font.
37
+ *
38
+ * *Example:*
39
+ * ```jsx
40
+ * import { scaleFont } from '@estuary-solutions/rn-core-ui/utils';
41
+ * import { StyleSheet } from 'react-native';
42
+ *
43
+ * const styles = StyleSheet.create({
44
+ * text: {
45
+ * fontSize: scaleFont(16), // fontSize._16
46
+ * },
47
+ * });
48
+ * ```
49
+ *
50
+ * To get more information. Please see the [Documentation](https://lubrytics.com:9929/minhnhat.tran/estuary-rn-core-ui?tab=readme-ov-file#scaling-function)
51
+ *
52
+ * @see: https://lubrytics.com:9929/minhnhat.tran/estuary-rn-core-ui?tab=readme-ov-file#scaling-function
53
+ */
54
+ export declare const scaleFont: (size: number) => number;
55
+ /**
56
+ * Will return a linear scaled result of the provided size, based on your device's screen width.
57
+ *
58
+ * *Example:*
59
+ * ```jsx
60
+ * import { scale } from '@estuary-solutions/rn-core-ui/utils';
61
+ * import { StyleSheet } from 'react-native';
62
+ *
63
+ * const styles = StyleSheet.create({
64
+ * container: {
65
+ * padding: scale(5),
66
+ * },
67
+ * });
68
+ * ```
69
+ *
70
+ * To get more information. Please see the [Documentation](https://lubrytics.com:9929/minhnhat.tran/estuary-rn-core-ui?tab=readme-ov-file#scaling-function)
71
+ *
72
+ * @see: https://lubrytics.com:9929/minhnhat.tran/estuary-rn-core-ui?tab=readme-ov-file#scaling-function
73
+ */
74
+ export declare const scale: (size: number) => number;
75
+ /**
76
+ * Will return a linear scaled result of the provided size, based on your device's screen height.
77
+ *
78
+ * *Example:*
79
+ * ```jsx
80
+ * import { scaleH } from '@estuary-solutions/rn-core-ui/utils';
81
+ * import { StyleSheet } from 'react-native';
82
+ *
83
+ * const styles = StyleSheet.create({
84
+ * container: {
85
+ * position: 'absolute',
86
+ * top: scaleH(5),
87
+ * },
88
+ * });
89
+ * ```
90
+ *
91
+ * To get more information. Please see the [Documentation](https://lubrytics.com:9929/minhnhat.tran/estuary-rn-core-ui?tab=readme-ov-file#scaling-function)
92
+ *
93
+ * @see: https://lubrytics.com:9929/minhnhat.tran/estuary-rn-core-ui?tab=readme-ov-file#scaling-function
94
+ */
95
+ export declare const scaleH: (size: number) => number;
96
+ /**
97
+ * Sometimes you don't want to scale everything in a linear manner, that's where moderateScale comes in.
98
+ * The cool thing about it is that you can control the resize factor (default is 0.5).
99
+ * If normal scale will increase your size by +2X, moderateScale will only increase it by +X, for example:
100
+ * ➡️ &nbsp;&nbsp;scale(10) = 20
101
+ * ➡️ &nbsp;&nbsp;moderateScale(10) = 15
102
+ * ➡️ &nbsp;&nbsp;moderateScale(10, 0.1) = 11
103
+ *
104
+ * *Example:*
105
+ * ```jsx
106
+ * import { moderateScale } from '@estuary-solutions/rn-core-ui/utils';
107
+ * import { StyleSheet } from 'react-native';
108
+ *
109
+ * const styles = StyleSheet.create({
110
+ * container: {
111
+ * padding: moderateScale(5),
112
+ * },
113
+ * });
114
+ * ```
115
+ *
116
+ * To get more information. Please see the [Documentation](https://lubrytics.com:9929/minhnhat.tran/estuary-rn-core-ui?tab=readme-ov-file#scaling-function)
117
+ *
118
+ * @see: https://lubrytics.com:9929/minhnhat.tran/estuary-rn-core-ui?tab=readme-ov-file#scaling-function
119
+ */
120
+ export declare const moderateScale: (size: number, factor?: number) => number;
121
+ /**
122
+ * Same as moderateScale, but using scaleH instead of scale.
123
+ *
124
+ * *Example:*
125
+ * ```jsx
126
+ * import { moderateHeightScale } from '@estuary-solutions/rn-core-ui/utils';
127
+ * import { StyleSheet } from 'react-native';
128
+ *
129
+ * const styles = StyleSheet.create({
130
+ * container: {
131
+ * padding: moderateHeightScale(5),
132
+ * },
133
+ * });
134
+ * ```
135
+ *
136
+ * To get more information. Please see the [Documentation](https://lubrytics.com:9929/minhnhat.tran/estuary-rn-core-ui?tab=readme-ov-file#scaling-function)
137
+ *
138
+ * @see: https://lubrytics.com:9929/minhnhat.tran/estuary-rn-core-ui?tab=readme-ov-file#scaling-function
139
+ */
140
+ export declare const moderateHeightScale: (size: number, factor?: number) => number;
141
+ //# sourceMappingURL=scale.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scale.d.ts","sourceRoot":"","sources":["../../src/utils/scale.ts"],"names":[],"mappings":"AAEA,eAAO,MAAQ,KAAK,UAAE,MAAM,QAA6B,CAAC;AAE1D;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,eAAe,MAAM,CAAC;AAEnC;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,gBAAgB,MAAM,CAAC;AAEpC,eAAO,MAAM,UAAU,QAA0B,CAAC;AAElD,eAAO,MAAM,WAAW,QAA4B,CAAC;AAErD,eAAO,MAAM,QAAQ,QAAkC,CAAC;AAExD;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,WACuB,CAAC;AAE9D;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,KAAK,GAAI,MAAM,MAAM,WAC6B,CAAC;AAEhE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,MAAM,GAAI,MAAM,MAAM,WAC6B,CAAC;AAEjE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,aAAa,GAAI,MAAM,MAAM,EAAE,eAAY,WAClB,CAAC;AAEvC;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,mBAAmB,GAAI,MAAM,MAAM,EAAE,eAAY,WACvB,CAAC"}
@@ -0,0 +1,141 @@
1
+ import { Dimensions, PixelRatio } from "react-native";
2
+ export const { width, height } = Dimensions.get('window');
3
+ /**
4
+ * Just a constants that specify iPhone 12 width.
5
+ *
6
+ * *Example:*
7
+ *
8
+ * ```js
9
+ * import { IPHONE_12_WIDTH } from '@estuary-solutions/rn-core-ui/utils';
10
+ * console.log(IPHONE_12_WIDTH); // 375
11
+ * ```
12
+ *
13
+ * To get more information. Please see the [Documentation](https://lubrytics.com:9929/minhnhat.tran/estuary-rn-core-ui?tab=readme-ov-file#scaling-function)
14
+ *
15
+ * @see: https://lubrytics.com:9929/minhnhat.tran/estuary-rn-core-ui?tab=readme-ov-file#scaling-function
16
+ */
17
+ export const IPHONE_12_WIDTH = 375;
18
+ /**
19
+ * Just a constants that specify iPhone 12 height.
20
+ *
21
+ * *Example:*
22
+ *
23
+ * ```js
24
+ * import { IPHONE_12_HEIGTH } from '@estuary-solutions/rn-core-ui/utils';
25
+ * console.log(IPHONE_12_HEIGTH); // 812
26
+ * ```
27
+ *
28
+ * To get more information. Please see the [Documentation](https://lubrytics.com:9929/minhnhat.tran/estuary-rn-core-ui?tab=readme-ov-file#scaling-function)
29
+ *
30
+ * @see: https://lubrytics.com:9929/minhnhat.tran/estuary-rn-core-ui?tab=readme-ov-file#scaling-function
31
+ */
32
+ export const IPHONE_12_HEIGTH = 812;
33
+ export const scaleWidth = width / IPHONE_12_WIDTH;
34
+ export const scaleHeight = height / IPHONE_12_HEIGTH;
35
+ export const scaleAvg = (scaleWidth + scaleHeight) / 2;
36
+ /**
37
+ * Will return a linear scaled result of the provided size, based on scaleAvg. Use for scaling font.
38
+ *
39
+ * *Example:*
40
+ * ```jsx
41
+ * import { scaleFont } from '@estuary-solutions/rn-core-ui/utils';
42
+ * import { StyleSheet } from 'react-native';
43
+ *
44
+ * const styles = StyleSheet.create({
45
+ * text: {
46
+ * fontSize: scaleFont(16), // fontSize._16
47
+ * },
48
+ * });
49
+ * ```
50
+ *
51
+ * To get more information. Please see the [Documentation](https://lubrytics.com:9929/minhnhat.tran/estuary-rn-core-ui?tab=readme-ov-file#scaling-function)
52
+ *
53
+ * @see: https://lubrytics.com:9929/minhnhat.tran/estuary-rn-core-ui?tab=readme-ov-file#scaling-function
54
+ */
55
+ export const scaleFont = (size) => Math.round(PixelRatio.roundToNearestPixel(size * scaleAvg));
56
+ /**
57
+ * Will return a linear scaled result of the provided size, based on your device's screen width.
58
+ *
59
+ * *Example:*
60
+ * ```jsx
61
+ * import { scale } from '@estuary-solutions/rn-core-ui/utils';
62
+ * import { StyleSheet } from 'react-native';
63
+ *
64
+ * const styles = StyleSheet.create({
65
+ * container: {
66
+ * padding: scale(5),
67
+ * },
68
+ * });
69
+ * ```
70
+ *
71
+ * To get more information. Please see the [Documentation](https://lubrytics.com:9929/minhnhat.tran/estuary-rn-core-ui?tab=readme-ov-file#scaling-function)
72
+ *
73
+ * @see: https://lubrytics.com:9929/minhnhat.tran/estuary-rn-core-ui?tab=readme-ov-file#scaling-function
74
+ */
75
+ export const scale = (size) => Math.round(PixelRatio.roundToNearestPixel(size * scaleWidth));
76
+ /**
77
+ * Will return a linear scaled result of the provided size, based on your device's screen height.
78
+ *
79
+ * *Example:*
80
+ * ```jsx
81
+ * import { scaleH } from '@estuary-solutions/rn-core-ui/utils';
82
+ * import { StyleSheet } from 'react-native';
83
+ *
84
+ * const styles = StyleSheet.create({
85
+ * container: {
86
+ * position: 'absolute',
87
+ * top: scaleH(5),
88
+ * },
89
+ * });
90
+ * ```
91
+ *
92
+ * To get more information. Please see the [Documentation](https://lubrytics.com:9929/minhnhat.tran/estuary-rn-core-ui?tab=readme-ov-file#scaling-function)
93
+ *
94
+ * @see: https://lubrytics.com:9929/minhnhat.tran/estuary-rn-core-ui?tab=readme-ov-file#scaling-function
95
+ */
96
+ export const scaleH = (size) => Math.round(PixelRatio.roundToNearestPixel(size * scaleHeight));
97
+ /**
98
+ * Sometimes you don't want to scale everything in a linear manner, that's where moderateScale comes in.
99
+ * The cool thing about it is that you can control the resize factor (default is 0.5).
100
+ * If normal scale will increase your size by +2X, moderateScale will only increase it by +X, for example:
101
+ * ➡️ &nbsp;&nbsp;scale(10) = 20
102
+ * ➡️ &nbsp;&nbsp;moderateScale(10) = 15
103
+ * ➡️ &nbsp;&nbsp;moderateScale(10, 0.1) = 11
104
+ *
105
+ * *Example:*
106
+ * ```jsx
107
+ * import { moderateScale } from '@estuary-solutions/rn-core-ui/utils';
108
+ * import { StyleSheet } from 'react-native';
109
+ *
110
+ * const styles = StyleSheet.create({
111
+ * container: {
112
+ * padding: moderateScale(5),
113
+ * },
114
+ * });
115
+ * ```
116
+ *
117
+ * To get more information. Please see the [Documentation](https://lubrytics.com:9929/minhnhat.tran/estuary-rn-core-ui?tab=readme-ov-file#scaling-function)
118
+ *
119
+ * @see: https://lubrytics.com:9929/minhnhat.tran/estuary-rn-core-ui?tab=readme-ov-file#scaling-function
120
+ */
121
+ export const moderateScale = (size, factor = 0.5) => size + (scale(size) - size) * factor;
122
+ /**
123
+ * Same as moderateScale, but using scaleH instead of scale.
124
+ *
125
+ * *Example:*
126
+ * ```jsx
127
+ * import { moderateHeightScale } from '@estuary-solutions/rn-core-ui/utils';
128
+ * import { StyleSheet } from 'react-native';
129
+ *
130
+ * const styles = StyleSheet.create({
131
+ * container: {
132
+ * padding: moderateHeightScale(5),
133
+ * },
134
+ * });
135
+ * ```
136
+ *
137
+ * To get more information. Please see the [Documentation](https://lubrytics.com:9929/minhnhat.tran/estuary-rn-core-ui?tab=readme-ov-file#scaling-function)
138
+ *
139
+ * @see: https://lubrytics.com:9929/minhnhat.tran/estuary-rn-core-ui?tab=readme-ov-file#scaling-function
140
+ */
141
+ export const moderateHeightScale = (size, factor = 0.5) => size + (scaleH(size) - size) * factor;
@@ -0,0 +1,102 @@
1
+ const esbuild = require('esbuild');
2
+ const path = require('path');
3
+ const glob = require('fast-glob');
4
+ const fsPromises = require('fs').promises; // Rename the promises API import
5
+ const fs = require('fs'); // Import the standard synchronous fs module
6
+ const { execSync } = require('child_process');
7
+ const alias = require('esbuild-plugin-alias');
8
+
9
+ const ROOT = path.resolve(__dirname, "..");
10
+ const SRC_DIR = path.join(ROOT, "src");
11
+ const DIST_DIR = path.join(ROOT, "dist");
12
+
13
+ async function getAllTSFilesRecursively(dir) {
14
+ return await glob(`${dir}/**/*.{ts,tsx}`, { absolute: false });
15
+ }
16
+
17
+ async function removeDist() {
18
+ if (fs.existsSync(DIST_DIR)) {
19
+ await fsPromises.rm(DIST_DIR, { recursive: true, force: true });
20
+ }
21
+ }
22
+
23
+ async function build() {
24
+ await removeDist();
25
+
26
+ // 1. Build declaration files bằng tsc (Chỉ cần nếu cần file .d.ts riêng)
27
+ console.log("📦 Building declaration files...");
28
+ execSync("tsc --emitDeclarationOnly --declaration --outDir dist", {
29
+ cwd: ROOT,
30
+ stdio: "inherit",
31
+ });
32
+
33
+ // 2. Bundle JS với esbuild
34
+ console.log("📦 Bundling JS with esbuild...");
35
+ try {
36
+ await esbuild.build({
37
+ outdir: DIST_DIR,
38
+ entryPoints: await getAllTSFilesRecursively('src'),
39
+ bundle: true,
40
+ format: "cjs",
41
+ external: [
42
+ "react",
43
+ "react-native",
44
+ "react-native-device-info",
45
+ "react-native-iphone-x-helper",
46
+ "react-native-svg",
47
+ "react-native-fast-image",
48
+ ],
49
+ loader: {
50
+ ".js": "jsx",
51
+ ".ts": "ts",
52
+ ".tsx": "tsx",
53
+ },
54
+ minify: false,
55
+ sourcemap: true,
56
+ platform: "node",
57
+ target: "esnext",
58
+ plugins: [
59
+ alias({
60
+ "@": path.join(SRC_DIR, "index.ts"),
61
+ "@constant": path.join(SRC_DIR, "constants/index.ts"),
62
+ "@utils": path.join(SRC_DIR, "utils/index.ts"),
63
+ "@hooks": path.join(SRC_DIR, "hooks/index.ts"),
64
+ "@themes": path.join(SRC_DIR, "themes/index.ts"),
65
+ }),
66
+ ],
67
+ });
68
+ console.log('✅ JS Bundle success!');
69
+
70
+ console.log('📦 Copying package.json...');
71
+ await fsPromises.copyFile(
72
+ path.join(ROOT, "package.json"),
73
+ path.join(DIST_DIR, "package.json")
74
+ );
75
+ console.log('✅ package.json copied!');
76
+
77
+ const licensePath = path.join(ROOT, "LICENSE");
78
+ if (fs.existsSync(licensePath)) {
79
+ console.log("📦 Copying LICENSE...");
80
+ await fsPromises.copyFile(licensePath, path.join(DIST_DIR, "LICENSE"));
81
+ console.log("✅ LICENSE copied!");
82
+ } else {
83
+ console.warn("⚠️ LICENSE file not found in the root.");
84
+ }
85
+
86
+ const readmePath = path.join(ROOT, "README.md");
87
+ if (fs.existsSync(readmePath)) {
88
+ console.log("📦 Copying README.md...");
89
+ await fsPromises.copyFile(readmePath, path.join(DIST_DIR, "README.md"));
90
+ console.log("✅ README.md copied!");
91
+ } else {
92
+ console.warn("⚠️ README.md file not found in the root.");
93
+ }
94
+
95
+ console.log('✅ Build complete!');
96
+ } catch (e) {
97
+ console.error(e);
98
+ process.exit(1);
99
+ }
100
+ }
101
+
102
+ build();
@@ -0,0 +1,49 @@
1
+ const { spawnSync } = require("child_process");
2
+ const path = require("path");
3
+ const fs = require("fs");
4
+
5
+ function run(cmd, args, options) {
6
+ const result = spawnSync(cmd, args, {
7
+ stdio: "inherit",
8
+ shell: true,
9
+ ...options,
10
+ });
11
+
12
+ if (result.status !== 0) {
13
+ process.exit(result.status ?? 1);
14
+ }
15
+ }
16
+
17
+ try {
18
+ const rootPath = path.resolve(__dirname, "../");
19
+ const samplePath = path.resolve(__dirname, "../example/RNCoreUISample");
20
+ const rootNodeModules = path.join(rootPath, "node_modules");
21
+ const sampleNodeModules = path.join(samplePath, "node_modules");
22
+
23
+ if (!fs.existsSync(rootNodeModules)) {
24
+ console.log("📥 node_modules not found in root → running yarn install...");
25
+ run("yarn", [], { cwd: rootPath });
26
+ } else {
27
+ console.log("✅ node_modules already exists in root → skip yarn install");
28
+ }
29
+
30
+ console.log("🔨 Building root package...");
31
+ run("node", ["documents/buildV2.js"], { cwd: rootPath });
32
+
33
+ if (!fs.existsSync(sampleNodeModules)) {
34
+ console.log("📥 node_modules not found in example/RNCoreUISample → running yarn install...");
35
+ run("yarn", [], { cwd: samplePath });
36
+ } else {
37
+ console.log("✅ node_modules already exists in example/RNCoreUISample → skip yarn install");
38
+ }
39
+
40
+ console.log("📂 Copy package to example...");
41
+ run("node", ["documents/copyPackageToExample.js"], {
42
+ cwd: rootPath,
43
+ });
44
+
45
+ console.log("🎉 Done");
46
+ } catch (err) {
47
+ console.error("❌ Error occur:", err);
48
+ process.exit(1);
49
+ }
@@ -0,0 +1,40 @@
1
+ const { spawnSync } = require("child_process");
2
+ const path = require("path");
3
+ const fs = require("fs");
4
+
5
+ function run(cmd, args, options) {
6
+ const result = spawnSync(cmd, args, {
7
+ stdio: "inherit",
8
+ shell: true,
9
+ ...options,
10
+ });
11
+
12
+ if (result.status !== 0) {
13
+ process.exit(result.status ?? 1);
14
+ }
15
+ }
16
+
17
+ try {
18
+ const rootPath = path.resolve(__dirname, "../");
19
+ const rootNodeModules = path.join(rootPath, "node_modules");
20
+
21
+ if (!fs.existsSync(rootNodeModules)) {
22
+ console.log("📥 node_modules not found in root → running yarn install...");
23
+ run("yarn", [], { cwd: rootPath });
24
+ } else {
25
+ console.log("✅ node_modules already exists in root → skip yarn install");
26
+ }
27
+
28
+ console.log("🔨 Building root package...");
29
+ run("node", ["documents/buildV2.js"], { cwd: rootPath });
30
+
31
+ console.log("📂 Copy package to example...");
32
+ run("node", ["documents/copyPackageToExample.js"], {
33
+ cwd: rootPath,
34
+ });
35
+
36
+ console.log("🎉 Done");
37
+ } catch (err) {
38
+ console.error("❌ Error occur:", err);
39
+ process.exit(1);
40
+ }
@@ -0,0 +1,98 @@
1
+ const path = require('path');
2
+ const fsPromises = require('fs').promises;
3
+ const fs = require('fs');
4
+ const { execSync } = require('child_process');
5
+
6
+ const ROOT = path.resolve(__dirname, "..");
7
+ const DIST_DIR = path.join(ROOT, "dist");
8
+
9
+ function getBin(cmd) {
10
+ const binPath = path.join(ROOT, "node_modules", ".bin", cmd);
11
+ if (fs.existsSync(binPath)) {
12
+ return `"${binPath}"`;
13
+ }
14
+ return cmd;
15
+ }
16
+
17
+ async function removeDist() {
18
+ if (fs.existsSync(DIST_DIR)) {
19
+ await fsPromises.rm(DIST_DIR, { recursive: true, force: true });
20
+ }
21
+ }
22
+
23
+ async function build() {
24
+ await removeDist();
25
+
26
+ try {
27
+ console.log("📦 Building...");
28
+
29
+ const tsc = getBin(process.platform === "win32" ? "tsc.cmd" : "tsc");
30
+ const tscAlias = getBin(
31
+ process.platform === "win32" ? "tsc-alias.cmd" : "tsc-alias"
32
+ );
33
+
34
+ execSync(
35
+ `${tsc} -p tsconfig.web.json && ${tscAlias} -p tsconfig.web.json`,
36
+ {
37
+ cwd: ROOT,
38
+ stdio: "inherit",
39
+ }
40
+ );
41
+
42
+ console.log("📦 Copying package.json...");
43
+ await fsPromises.copyFile(
44
+ path.join(ROOT, "package.json"),
45
+ path.join(DIST_DIR, "package.json")
46
+ );
47
+ console.log("✅ package.json copied!");
48
+
49
+ const licensePath = path.join(ROOT, "LICENSE");
50
+ if (fs.existsSync(licensePath)) {
51
+ console.log("📦 Copying LICENSE...");
52
+ await fsPromises.copyFile(licensePath, path.join(DIST_DIR, "LICENSE"));
53
+ console.log("✅ LICENSE copied!");
54
+ } else {
55
+ console.warn("⚠️ LICENSE file not found in the root.");
56
+ }
57
+
58
+ const readmePath = path.join(ROOT, "README.md");
59
+ if (fs.existsSync(readmePath)) {
60
+ console.log("📦 Copying README.md...");
61
+ await fsPromises.copyFile(readmePath, path.join(DIST_DIR, "README.md"));
62
+ console.log("✅ README.md copied!");
63
+ } else {
64
+ console.warn("⚠️ README.md file not found in the root.");
65
+ }
66
+
67
+ const tsConfigPath = path.join(ROOT, "tsconfig.json");
68
+ if (fs.existsSync(tsConfigPath)) {
69
+ console.log("📦 Copying tsconfig.json...");
70
+ await fsPromises.copyFile(
71
+ tsConfigPath,
72
+ path.join(DIST_DIR, "tsconfig.json")
73
+ );
74
+ console.log("✅ tsconfig.json copied!");
75
+ } else {
76
+ console.warn("⚠️ tsconfig.json file not found in the root.");
77
+ }
78
+
79
+ const tsConfigWebPath = path.join(ROOT, "tsconfig.web.json");
80
+ if (fs.existsSync(tsConfigWebPath)) {
81
+ console.log("📦 Copying tsconfig.web.json...");
82
+ await fsPromises.copyFile(
83
+ tsConfigWebPath,
84
+ path.join(DIST_DIR, "tsconfig.web.json")
85
+ );
86
+ console.log("✅ tsconfig.web.json copied!");
87
+ } else {
88
+ console.warn("⚠️ tsconfig.web.json file not found in the root.");
89
+ }
90
+
91
+ console.log('✅ Build complete!');
92
+ } catch (error) {
93
+ console.error(error);
94
+ process.exit(1);
95
+ }
96
+ }
97
+
98
+ build();
@@ -0,0 +1,31 @@
1
+ const fs = require("fs-extra");
2
+ const path = require("path");
3
+
4
+ async function copyPackageDirectly() {
5
+ const root = path.resolve(__dirname, "../");
6
+ const distDir = path.join(root, "dist");
7
+ const dest = path.resolve(
8
+ __dirname,
9
+ "../example/RNCoreUISample/node_modules/@estuary-solutions/rn-core-ui"
10
+ );
11
+
12
+ console.log("👉🏻🗑️ Removing old package in node_modules...");
13
+ await fs.remove(dest);
14
+ await fs.ensureDir(dest);
15
+ console.log("✅ Remove success!");
16
+
17
+ if (await fs.pathExists(distDir)) {
18
+ const items = await fs.readdir(distDir);
19
+
20
+ for (const item of items) {
21
+ const srcPath = path.join(distDir, item);
22
+ const destPath = path.join(dest, item);
23
+
24
+ await fs.copy(srcPath, destPath);
25
+ }
26
+ }
27
+
28
+ console.log("✅ All dist contents copied into node_modules success!");
29
+ }
30
+
31
+ copyPackageDirectly().catch(console.error);