ikoncomponents 1.5.7 → 1.5.8

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 (424) hide show
  1. package/README.md +36 -36
  2. package/bin.js +2 -0
  3. package/dist/commands/init.js +63 -0
  4. package/dist/index.js +14 -116
  5. package/dist/utlis/copyDir.js +7 -0
  6. package/package.json +17 -91
  7. package/templates/default/hooks/use-mobile.ts +19 -0
  8. package/templates/default/ikonS/accordion.tsx +66 -0
  9. package/templates/default/ikonS/alert-dialog.tsx +179 -0
  10. package/templates/default/ikonS/alert.tsx +66 -0
  11. package/templates/default/ikonS/aspect-ratio.tsx +11 -0
  12. package/templates/default/ikonS/avatar.tsx +53 -0
  13. package/templates/default/ikonS/badge.tsx +49 -0
  14. package/templates/default/ikonS/breadcrumb.tsx +109 -0
  15. package/templates/default/ikonS/button.tsx +64 -0
  16. package/templates/default/ikonS/calendar.tsx +227 -0
  17. package/templates/default/ikonS/card.tsx +92 -0
  18. package/templates/default/ikonS/checkbox.tsx +33 -0
  19. package/templates/default/ikonS/collapsible.tsx +33 -0
  20. package/templates/default/ikonS/command.tsx +184 -0
  21. package/templates/default/ikonS/date-input.tsx +259 -0
  22. package/templates/default/ikonS/date-range-picker.tsx +103 -0
  23. package/templates/default/ikonS/dialog.tsx +143 -0
  24. package/templates/default/ikonS/drawer.tsx +134 -0
  25. package/templates/default/ikonS/dropdown-menu.tsx +259 -0
  26. package/templates/default/ikonS/form.tsx +166 -0
  27. package/templates/default/ikonS/hover-card.tsx +44 -0
  28. package/templates/default/ikonS/input-otp.tsx +71 -0
  29. package/templates/default/ikonS/input.tsx +22 -0
  30. package/templates/default/ikonS/label.tsx +24 -0
  31. package/templates/default/ikonS/navigation-menu.tsx +195 -0
  32. package/templates/default/ikonS/popover.tsx +48 -0
  33. package/templates/default/ikonS/progress.tsx +40 -0
  34. package/templates/default/ikonS/radio-group.tsx +45 -0
  35. package/templates/default/ikonS/scroll-area.tsx +58 -0
  36. package/templates/default/ikonS/select.tsx +184 -0
  37. package/templates/default/ikonS/separator.tsx +28 -0
  38. package/templates/default/ikonS/sheet.tsx +139 -0
  39. package/templates/default/ikonS/sidebar.tsx +726 -0
  40. package/templates/default/ikonS/skeleton.tsx +15 -0
  41. package/templates/default/ikonS/slider.tsx +64 -0
  42. package/templates/default/ikonS/sonner.tsx +25 -0
  43. package/templates/default/ikonS/switch.tsx +31 -0
  44. package/templates/default/ikonS/table.tsx +116 -0
  45. package/templates/default/ikonS/tabs.tsx +67 -0
  46. package/templates/default/ikonS/textarea.tsx +18 -0
  47. package/templates/default/ikonS/toggle-group.tsx +83 -0
  48. package/templates/default/ikonS/toggle.tsx +47 -0
  49. package/templates/default/ikonS/tooltip.tsx +65 -0
  50. package/templates/default/ikonS/workflow.tsx +119 -0
  51. package/templates/default/ikoncomponents/action-menu/index.tsx +108 -0
  52. package/templates/default/ikoncomponents/action-menu/type.ts +18 -0
  53. package/templates/default/ikoncomponents/activity-sheet/index.tsx +63 -0
  54. package/templates/default/ikoncomponents/alert-dialog/dialog-context.tsx +65 -0
  55. package/templates/default/ikoncomponents/alert-dialog/index.tsx +80 -0
  56. package/templates/default/ikoncomponents/app-breadcrumb/BreadcrumbProvider.tsx +68 -0
  57. package/templates/default/ikoncomponents/app-breadcrumb/index.tsx +222 -0
  58. package/templates/default/ikoncomponents/big-calendar/big-calender-event/index.tsx +38 -0
  59. package/templates/default/ikoncomponents/big-calendar/big-calender-toolbar/index.tsx +81 -0
  60. package/templates/default/ikoncomponents/big-calendar/index.css +879 -0
  61. package/templates/default/ikoncomponents/big-calendar/index.tsx +59 -0
  62. package/templates/default/ikoncomponents/big-calendar/type.ts +37 -0
  63. package/templates/default/ikoncomponents/buttons/index.tsx +127 -0
  64. package/templates/default/ikoncomponents/combobox-input/index.tsx +75 -0
  65. package/templates/default/ikoncomponents/combobox-input/type.ts +14 -0
  66. package/templates/default/ikoncomponents/custom-combo-dropdown/index.tsx +242 -0
  67. package/templates/default/ikoncomponents/data-table/datatable-column-filter/index.tsx +80 -0
  68. package/templates/default/ikoncomponents/data-table/datatable-faceted-filter/index.tsx +149 -0
  69. package/templates/default/ikoncomponents/data-table/datatable-filter-menu/index.tsx +98 -0
  70. package/templates/default/ikoncomponents/data-table/datatable-pagination/index.tsx +119 -0
  71. package/templates/default/ikoncomponents/data-table/datatable-toolbar/index.tsx +45 -0
  72. package/templates/default/ikoncomponents/data-table/function.ts +7 -0
  73. package/templates/default/ikoncomponents/data-table/index.tsx +549 -0
  74. package/templates/default/ikoncomponents/data-table/type.ts +75 -0
  75. package/templates/default/ikoncomponents/e-chart/index.tsx +183 -0
  76. package/templates/default/ikoncomponents/file-input/index.tsx +27 -0
  77. package/templates/default/ikoncomponents/fileUpload/index.tsx +121 -0
  78. package/templates/default/ikoncomponents/form-fields/combobox-input/index.tsx +111 -0
  79. package/templates/default/ikoncomponents/form-fields/combobox-input-value/index.tsx +121 -0
  80. package/templates/default/ikoncomponents/form-fields/date-input/index.tsx +80 -0
  81. package/templates/default/ikoncomponents/form-fields/file-input/index.tsx +9 -0
  82. package/templates/default/ikoncomponents/form-fields/input/index.tsx +27 -0
  83. package/{dist/ikoncomponents/form-fields/multi-combobox-input/index.js → templates/default/ikoncomponents/form-fields/multi-combobox-input/index.tsx} +574 -381
  84. package/templates/default/ikoncomponents/form-fields/otp-input/index.tsx +39 -0
  85. package/templates/default/ikoncomponents/form-fields/password-input/index.tsx +52 -0
  86. package/templates/default/ikoncomponents/form-fields/phone-input/index.tsx +7 -0
  87. package/templates/default/ikoncomponents/form-fields/textarea/index.tsx +28 -0
  88. package/templates/default/ikoncomponents/form-fields/types/index.ts +46 -0
  89. package/templates/default/ikoncomponents/glowing-effect/index.tsx +171 -0
  90. package/templates/default/ikoncomponents/icon/index.tsx +22 -0
  91. package/templates/default/ikoncomponents/image-cropper-upload/components/cropperImg.css +19 -0
  92. package/{dist/ikoncomponents/image-cropper-upload/components/newCropper.js → templates/default/ikoncomponents/image-cropper-upload/components/newCropper.tsx} +117 -85
  93. package/templates/default/ikoncomponents/image-cropper-upload/components/newImageUploadForm.tsx +352 -0
  94. package/templates/default/ikoncomponents/image-cropper-upload/cropper-form/index.tsx +250 -0
  95. package/templates/default/ikoncomponents/image-cropper-upload/cropper-form-with-modal/index.tsx +32 -0
  96. package/{dist/ikoncomponents/image-cropper-upload/image-cropper/index.js → templates/default/ikoncomponents/image-cropper-upload/image-cropper/index.tsx} +119 -87
  97. package/templates/default/ikoncomponents/image-cropper-upload/index.tsx +95 -0
  98. package/templates/default/ikoncomponents/image-cropper-upload/utils/index.ts +117 -0
  99. package/templates/default/ikoncomponents/loading-spinner/index.tsx +43 -0
  100. package/templates/default/ikoncomponents/main-layout/RefreshContext.tsx +30 -0
  101. package/templates/default/ikoncomponents/main-layout/SidebarNavContext.tsx +103 -0
  102. package/templates/default/ikoncomponents/main-layout/app-sidebar.tsx +36 -0
  103. package/templates/default/ikoncomponents/main-layout/footer.tsx +21 -0
  104. package/templates/default/ikoncomponents/main-layout/header.tsx +53 -0
  105. package/templates/default/ikoncomponents/main-layout/index.tsx +38 -0
  106. package/templates/default/ikoncomponents/main-layout/main-sidebar.tsx +389 -0
  107. package/templates/default/ikoncomponents/main-layout/nav-main.tsx +103 -0
  108. package/templates/default/ikoncomponents/multi-combobox/index.tsx +345 -0
  109. package/templates/default/ikoncomponents/no-data/index.tsx +11 -0
  110. package/templates/default/ikoncomponents/page-wrapper/index.tsx +30 -0
  111. package/templates/default/ikoncomponents/password-strength-meter/index.tsx +49 -0
  112. package/templates/default/ikoncomponents/phone-input/index.tsx +72 -0
  113. package/templates/default/ikoncomponents/provider-wrapper/index.tsx +32 -0
  114. package/templates/default/ikoncomponents/search-input/index.tsx +18 -0
  115. package/templates/default/ikoncomponents/sheet/index.tsx +34 -0
  116. package/templates/default/ikoncomponents/simple-widget/index.tsx +54 -0
  117. package/templates/default/ikoncomponents/skeleton-loader/skeleton-table.tsx +34 -0
  118. package/templates/default/ikoncomponents/skeleton-loader/skeleton-widget.tsx +13 -0
  119. package/templates/default/ikoncomponents/tabs/index.tsx +139 -0
  120. package/{dist/ikoncomponents/tabs/type.d.ts → templates/default/ikoncomponents/tabs/type.ts} +20 -19
  121. package/{dist/ikoncomponents/theme-toggle-btn/index.js → templates/default/ikoncomponents/theme-toggle-btn/index.tsx} +189 -118
  122. package/templates/default/ikoncomponents/title-progress/index.tsx +41 -0
  123. package/templates/default/ikoncomponents/tooltip/index.tsx +17 -0
  124. package/templates/default/ikoncomponents/twolevel-dropdown/convertToDropdownNodes.tsx +33 -0
  125. package/templates/default/ikoncomponents/twolevel-dropdown/index.tsx +279 -0
  126. package/templates/default/ikoncomponents/upload-tab/index.tsx +237 -0
  127. package/templates/default/ikoncomponents/widgets/index.tsx +81 -0
  128. package/templates/default/ikoncomponents/widgets/type.ts +11 -0
  129. package/templates/default/ikoncomponents/work-in-progress/index.tsx +16 -0
  130. package/templates/default/styles.css +1159 -0
  131. package/templates/default/utils/actions/account/index.ts +33 -0
  132. package/templates/default/utils/actions/account/type.ts +4 -0
  133. package/{dist/utils/actions/auth/index.js → templates/default/utils/actions/auth/index.ts} +69 -58
  134. package/templates/default/utils/actions/common/revalidate.ts +18 -0
  135. package/templates/default/utils/actions/common/type.ts +4 -0
  136. package/{dist/utils/actions/common/utils.js → templates/default/utils/actions/common/utils.ts} +28 -25
  137. package/templates/default/utils/actions/software/index.ts +106 -0
  138. package/templates/default/utils/api/accountService/index.ts +103 -0
  139. package/templates/default/utils/api/accountService/type.ts +4 -0
  140. package/templates/default/utils/api/file-upload/index.ts +103 -0
  141. package/templates/default/utils/api/file-upload/type.ts +8 -0
  142. package/{dist/utils/api/ikonBaseApi.js → templates/default/utils/api/ikonBaseApi.ts} +132 -104
  143. package/templates/default/utils/api/loginService/index.ts +106 -0
  144. package/{dist/utils/api/loginService/type.d.ts → templates/default/utils/api/loginService/type.ts} +35 -31
  145. package/templates/default/utils/api/softwareService/index.ts +356 -0
  146. package/templates/default/utils/api/softwareService/type.ts +62 -0
  147. package/{dist/utils/border-radius-provider.js → templates/default/utils/border-radius-provider.tsx} +59 -35
  148. package/templates/default/utils/cn.ts +6 -0
  149. package/{dist/utils/font-provider.js → templates/default/utils/font-provider.tsx} +61 -37
  150. package/templates/default/utils/session/cookieSession.ts +49 -0
  151. package/templates/default/utils/theme-provider/index.tsx +11 -0
  152. package/templates/default/utils/token-management/index.ts +115 -0
  153. package/templates/default/utils/token-management/types.ts +6 -0
  154. package/dist/hooks/use-mobile.d.ts +0 -1
  155. package/dist/hooks/use-mobile.js +0 -15
  156. package/dist/ikoncomponents/action-menu/index.d.ts +0 -5
  157. package/dist/ikoncomponents/action-menu/index.js +0 -42
  158. package/dist/ikoncomponents/action-menu/type.d.ts +0 -14
  159. package/dist/ikoncomponents/action-menu/type.js +0 -1
  160. package/dist/ikoncomponents/activity-sheet/index.d.ts +0 -11
  161. package/dist/ikoncomponents/activity-sheet/index.js +0 -23
  162. package/dist/ikoncomponents/alert-dialog/dialog-context.d.ts +0 -21
  163. package/dist/ikoncomponents/alert-dialog/dialog-context.js +0 -30
  164. package/dist/ikoncomponents/alert-dialog/index.d.ts +0 -14
  165. package/dist/ikoncomponents/alert-dialog/index.js +0 -20
  166. package/dist/ikoncomponents/app-breadcrumb/BreadcrumbProvider.d.ts +0 -18
  167. package/dist/ikoncomponents/app-breadcrumb/BreadcrumbProvider.js +0 -43
  168. package/dist/ikoncomponents/app-breadcrumb/index.d.ts +0 -5
  169. package/dist/ikoncomponents/app-breadcrumb/index.js +0 -57
  170. package/dist/ikoncomponents/big-calendar/big-calender-event/index.d.ts +0 -5
  171. package/dist/ikoncomponents/big-calendar/big-calender-event/index.js +0 -16
  172. package/dist/ikoncomponents/big-calendar/big-calender-toolbar/index.d.ts +0 -2
  173. package/dist/ikoncomponents/big-calendar/big-calender-toolbar/index.js +0 -39
  174. package/dist/ikoncomponents/big-calendar/index.d.ts +0 -3
  175. package/dist/ikoncomponents/big-calendar/index.js +0 -35
  176. package/dist/ikoncomponents/big-calendar/type.d.ts +0 -31
  177. package/dist/ikoncomponents/big-calendar/type.js +0 -1
  178. package/dist/ikoncomponents/buttons/index.d.ts +0 -18
  179. package/dist/ikoncomponents/buttons/index.js +0 -38
  180. package/dist/ikoncomponents/combobox-input/index.d.ts +0 -2
  181. package/dist/ikoncomponents/combobox-input/index.js +0 -18
  182. package/dist/ikoncomponents/combobox-input/type.d.ts +0 -13
  183. package/dist/ikoncomponents/combobox-input/type.js +0 -1
  184. package/dist/ikoncomponents/custom-combo-dropdown/index.d.ts +0 -21
  185. package/dist/ikoncomponents/custom-combo-dropdown/index.js +0 -85
  186. package/dist/ikoncomponents/data-table/datatable-column-filter/index.d.ts +0 -2
  187. package/dist/ikoncomponents/data-table/datatable-column-filter/index.js +0 -22
  188. package/dist/ikoncomponents/data-table/datatable-faceted-filter/index.d.ts +0 -2
  189. package/dist/ikoncomponents/data-table/datatable-faceted-filter/index.js +0 -35
  190. package/dist/ikoncomponents/data-table/datatable-filter-menu/index.d.ts +0 -2
  191. package/dist/ikoncomponents/data-table/datatable-filter-menu/index.js +0 -38
  192. package/dist/ikoncomponents/data-table/datatable-pagination/index.d.ts +0 -2
  193. package/dist/ikoncomponents/data-table/datatable-pagination/index.js +0 -13
  194. package/dist/ikoncomponents/data-table/datatable-toolbar/index.d.ts +0 -2
  195. package/dist/ikoncomponents/data-table/datatable-toolbar/index.js +0 -18
  196. package/dist/ikoncomponents/data-table/function.d.ts +0 -1
  197. package/dist/ikoncomponents/data-table/function.js +0 -6
  198. package/dist/ikoncomponents/data-table/index.d.ts +0 -2
  199. package/dist/ikoncomponents/data-table/index.js +0 -223
  200. package/dist/ikoncomponents/data-table/type.d.ts +0 -60
  201. package/dist/ikoncomponents/data-table/type.js +0 -1
  202. package/dist/ikoncomponents/e-chart/index.d.ts +0 -15
  203. package/dist/ikoncomponents/e-chart/index.js +0 -115
  204. package/dist/ikoncomponents/file-input/index.d.ts +0 -1
  205. package/dist/ikoncomponents/file-input/index.js +0 -21
  206. package/dist/ikoncomponents/fileUpload/index.d.ts +0 -15
  207. package/dist/ikoncomponents/fileUpload/index.js +0 -69
  208. package/dist/ikoncomponents/form-fields/combobox-input/index.d.ts +0 -2
  209. package/dist/ikoncomponents/form-fields/combobox-input/index.js +0 -21
  210. package/dist/ikoncomponents/form-fields/combobox-input-value/index.d.ts +0 -18
  211. package/dist/ikoncomponents/form-fields/combobox-input-value/index.js +0 -26
  212. package/dist/ikoncomponents/form-fields/date-input/index.d.ts +0 -2
  213. package/dist/ikoncomponents/form-fields/date-input/index.js +0 -15
  214. package/dist/ikoncomponents/form-fields/file-input/index.d.ts +0 -1
  215. package/dist/ikoncomponents/form-fields/file-input/index.js +0 -4
  216. package/dist/ikoncomponents/form-fields/input/index.d.ts +0 -2
  217. package/dist/ikoncomponents/form-fields/input/index.js +0 -18
  218. package/dist/ikoncomponents/form-fields/multi-combobox-input/index.d.ts +0 -6
  219. package/dist/ikoncomponents/form-fields/otp-input/index.d.ts +0 -2
  220. package/dist/ikoncomponents/form-fields/otp-input/index.js +0 -18
  221. package/dist/ikoncomponents/form-fields/phone-input/index.d.ts +0 -1
  222. package/dist/ikoncomponents/form-fields/phone-input/index.js +0 -4
  223. package/dist/ikoncomponents/form-fields/textarea/index.d.ts +0 -2
  224. package/dist/ikoncomponents/form-fields/textarea/index.js +0 -18
  225. package/dist/ikoncomponents/form-fields/types/index.d.ts +0 -36
  226. package/dist/ikoncomponents/form-fields/types/index.js +0 -1
  227. package/dist/ikoncomponents/glowing-effect/index.d.ts +0 -14
  228. package/dist/ikoncomponents/glowing-effect/index.js +0 -84
  229. package/dist/ikoncomponents/icon/index.d.ts +0 -8
  230. package/dist/ikoncomponents/icon/index.js +0 -23
  231. package/dist/ikoncomponents/image-cropper-upload/components/newCropper.d.ts +0 -15
  232. package/dist/ikoncomponents/image-cropper-upload/components/newImageUploadForm.d.ts +0 -7
  233. package/dist/ikoncomponents/image-cropper-upload/components/newImageUploadForm.js +0 -145
  234. package/dist/ikoncomponents/image-cropper-upload/cropper-form/index.d.ts +0 -6
  235. package/dist/ikoncomponents/image-cropper-upload/cropper-form/index.js +0 -92
  236. package/dist/ikoncomponents/image-cropper-upload/cropper-form-with-modal/index.d.ts +0 -6
  237. package/dist/ikoncomponents/image-cropper-upload/cropper-form-with-modal/index.js +0 -14
  238. package/dist/ikoncomponents/image-cropper-upload/image-cropper/index.d.ts +0 -14
  239. package/dist/ikoncomponents/image-cropper-upload/index.d.ts +0 -27
  240. package/dist/ikoncomponents/image-cropper-upload/index.js +0 -49
  241. package/dist/ikoncomponents/image-cropper-upload/utils/index.d.ts +0 -16
  242. package/dist/ikoncomponents/image-cropper-upload/utils/index.js +0 -73
  243. package/dist/ikoncomponents/loading-spinner/index.d.ts +0 -9
  244. package/dist/ikoncomponents/loading-spinner/index.js +0 -19
  245. package/dist/ikoncomponents/main-layout/RefreshContext.d.ts +0 -10
  246. package/dist/ikoncomponents/main-layout/RefreshContext.js +0 -17
  247. package/dist/ikoncomponents/main-layout/SidebarNavContext.d.ts +0 -33
  248. package/dist/ikoncomponents/main-layout/SidebarNavContext.js +0 -52
  249. package/dist/ikoncomponents/main-layout/app-sidebar.d.ts +0 -3
  250. package/dist/ikoncomponents/main-layout/app-sidebar.js +0 -24
  251. package/dist/ikoncomponents/main-layout/footer.d.ts +0 -1
  252. package/dist/ikoncomponents/main-layout/footer.js +0 -5
  253. package/dist/ikoncomponents/main-layout/header.d.ts +0 -3
  254. package/dist/ikoncomponents/main-layout/header.js +0 -15
  255. package/dist/ikoncomponents/main-layout/index.d.ts +0 -6
  256. package/dist/ikoncomponents/main-layout/index.js +0 -11
  257. package/dist/ikoncomponents/main-layout/main-sidebar.d.ts +0 -60
  258. package/dist/ikoncomponents/main-layout/main-sidebar.js +0 -119
  259. package/dist/ikoncomponents/main-layout/nav-main.d.ts +0 -11
  260. package/dist/ikoncomponents/main-layout/nav-main.js +0 -33
  261. package/dist/ikoncomponents/multi-combobox/index.d.ts +0 -13
  262. package/dist/ikoncomponents/multi-combobox/index.js +0 -202
  263. package/dist/ikoncomponents/no-data/index.d.ts +0 -3
  264. package/dist/ikoncomponents/no-data/index.js +0 -5
  265. package/dist/ikoncomponents/page-wrapper/index.d.ts +0 -9
  266. package/dist/ikoncomponents/page-wrapper/index.js +0 -7
  267. package/dist/ikoncomponents/password-strength-meter/index.d.ts +0 -3
  268. package/dist/ikoncomponents/password-strength-meter/index.js +0 -40
  269. package/dist/ikoncomponents/phone-input/index.d.ts +0 -1
  270. package/dist/ikoncomponents/phone-input/index.js +0 -41
  271. package/dist/ikoncomponents/provider-wrapper/index.d.ts +0 -6
  272. package/dist/ikoncomponents/provider-wrapper/index.js +0 -11
  273. package/dist/ikoncomponents/search-input/index.d.ts +0 -1
  274. package/dist/ikoncomponents/search-input/index.js +0 -19
  275. package/dist/ikoncomponents/sheet/index.d.ts +0 -10
  276. package/dist/ikoncomponents/sheet/index.js +0 -6
  277. package/dist/ikoncomponents/simple-widget/index.d.ts +0 -14
  278. package/dist/ikoncomponents/simple-widget/index.js +0 -14
  279. package/dist/ikoncomponents/skeleton-loader/skeleton-table.d.ts +0 -5
  280. package/dist/ikoncomponents/skeleton-loader/skeleton-table.js +0 -6
  281. package/dist/ikoncomponents/skeleton-loader/skeleton-widget.d.ts +0 -3
  282. package/dist/ikoncomponents/skeleton-loader/skeleton-widget.js +0 -5
  283. package/dist/ikoncomponents/tabs/index.d.ts +0 -2
  284. package/dist/ikoncomponents/tabs/index.js +0 -50
  285. package/dist/ikoncomponents/tabs/type.js +0 -2
  286. package/dist/ikoncomponents/theme-toggle-btn/index.d.ts +0 -1
  287. package/dist/ikoncomponents/title-progress/index.d.ts +0 -12
  288. package/dist/ikoncomponents/title-progress/index.js +0 -10
  289. package/dist/ikoncomponents/tooltip/index.d.ts +0 -5
  290. package/dist/ikoncomponents/tooltip/index.js +0 -5
  291. package/dist/ikoncomponents/twolevel-dropdown/index.d.ts +0 -31
  292. package/dist/ikoncomponents/twolevel-dropdown/index.js +0 -143
  293. package/dist/ikoncomponents/upload-tab/index.d.ts +0 -1
  294. package/dist/ikoncomponents/upload-tab/index.js +0 -92
  295. package/dist/ikoncomponents/widgets/index.d.ts +0 -2
  296. package/dist/ikoncomponents/widgets/index.js +0 -14
  297. package/dist/ikoncomponents/widgets/type.d.ts +0 -10
  298. package/dist/ikoncomponents/widgets/type.js +0 -2
  299. package/dist/ikoncomponents/work-in-progress/index.d.ts +0 -1
  300. package/dist/ikoncomponents/work-in-progress/index.js +0 -4
  301. package/dist/index.d.ts +0 -138
  302. package/dist/shadcn/accordion.d.ts +0 -7
  303. package/dist/shadcn/accordion.js +0 -33
  304. package/dist/shadcn/alert-dialog.d.ts +0 -20
  305. package/dist/shadcn/alert-dialog.js +0 -83
  306. package/dist/shadcn/alert.d.ts +0 -9
  307. package/dist/shadcn/alert.js +0 -38
  308. package/dist/shadcn/aspect-ratio.d.ts +0 -3
  309. package/dist/shadcn/aspect-ratio.js +0 -19
  310. package/dist/shadcn/avatar.d.ts +0 -6
  311. package/dist/shadcn/avatar.js +0 -28
  312. package/dist/shadcn/badge.d.ts +0 -9
  313. package/dist/shadcn/badge.js +0 -35
  314. package/dist/shadcn/breadcrumb.d.ts +0 -11
  315. package/dist/shadcn/breadcrumb.js +0 -45
  316. package/dist/shadcn/button.d.ts +0 -10
  317. package/dist/shadcn/button.js +0 -47
  318. package/dist/shadcn/calendar.d.ts +0 -8
  319. package/dist/shadcn/calendar.js +0 -61
  320. package/dist/shadcn/card.d.ts +0 -9
  321. package/dist/shadcn/card.js +0 -42
  322. package/dist/shadcn/checkbox.d.ts +0 -4
  323. package/dist/shadcn/checkbox.js +0 -21
  324. package/dist/shadcn/collapsible.d.ts +0 -5
  325. package/dist/shadcn/collapsible.js +0 -27
  326. package/dist/shadcn/command.d.ts +0 -18
  327. package/dist/shadcn/command.js +0 -54
  328. package/dist/shadcn/date-input.d.ts +0 -7
  329. package/dist/shadcn/date-input.js +0 -179
  330. package/dist/shadcn/date-range-picker.d.ts +0 -24
  331. package/dist/shadcn/date-range-picker.js +0 -45
  332. package/dist/shadcn/dialog.d.ts +0 -15
  333. package/dist/shadcn/dialog.js +0 -57
  334. package/dist/shadcn/drawer.d.ts +0 -13
  335. package/dist/shadcn/drawer.js +0 -56
  336. package/dist/shadcn/dropdown-menu.d.ts +0 -25
  337. package/dist/shadcn/dropdown-menu.js +0 -77
  338. package/dist/shadcn/form.d.ts +0 -24
  339. package/dist/shadcn/form.js +0 -70
  340. package/dist/shadcn/hover-card.d.ts +0 -6
  341. package/dist/shadcn/hover-card.js +0 -28
  342. package/dist/shadcn/input-otp.d.ts +0 -34
  343. package/dist/shadcn/input-otp.js +0 -40
  344. package/dist/shadcn/input.d.ts +0 -3
  345. package/dist/shadcn/input.js +0 -18
  346. package/dist/shadcn/label.d.ts +0 -4
  347. package/dist/shadcn/label.js +0 -20
  348. package/dist/shadcn/navigation-menu.d.ts +0 -16
  349. package/dist/shadcn/navigation-menu.js +0 -74
  350. package/dist/shadcn/popover.d.ts +0 -7
  351. package/dist/shadcn/popover.js +0 -32
  352. package/dist/shadcn/progress.d.ts +0 -8
  353. package/dist/shadcn/progress.js +0 -23
  354. package/dist/shadcn/radio-group.d.ts +0 -5
  355. package/dist/shadcn/radio-group.js +0 -25
  356. package/dist/shadcn/scroll-area.d.ts +0 -5
  357. package/dist/shadcn/scroll-area.js +0 -26
  358. package/dist/shadcn/select.d.ts +0 -15
  359. package/dist/shadcn/select.js +0 -59
  360. package/dist/shadcn/separator.d.ts +0 -4
  361. package/dist/shadcn/separator.js +0 -20
  362. package/dist/shadcn/sheet.d.ts +0 -13
  363. package/dist/shadcn/sheet.js +0 -61
  364. package/dist/shadcn/sidebar.d.ts +0 -69
  365. package/dist/shadcn/sidebar.js +0 -242
  366. package/dist/shadcn/skeleton.d.ts +0 -3
  367. package/dist/shadcn/skeleton.js +0 -18
  368. package/dist/shadcn/slider.d.ts +0 -4
  369. package/dist/shadcn/slider.js +0 -26
  370. package/dist/shadcn/sonner.d.ts +0 -3
  371. package/dist/shadcn/sonner.js +0 -25
  372. package/dist/shadcn/switch.d.ts +0 -4
  373. package/dist/shadcn/switch.js +0 -20
  374. package/dist/shadcn/table.d.ts +0 -10
  375. package/dist/shadcn/table.js +0 -47
  376. package/dist/shadcn/tabs.d.ts +0 -7
  377. package/dist/shadcn/tabs.js +0 -32
  378. package/dist/shadcn/textarea.d.ts +0 -3
  379. package/dist/shadcn/textarea.js +0 -18
  380. package/dist/shadcn/toggle-group.d.ts +0 -9
  381. package/dist/shadcn/toggle-group.js +0 -35
  382. package/dist/shadcn/toggle.d.ts +0 -9
  383. package/dist/shadcn/toggle.js +0 -38
  384. package/dist/shadcn/tooltip.d.ts +0 -7
  385. package/dist/shadcn/tooltip.js +0 -32
  386. package/dist/shadcn/workflow.d.ts +0 -20
  387. package/dist/shadcn/workflow.js +0 -20
  388. package/dist/styles.css +0 -6163
  389. package/dist/utils/actions/account/index.d.ts +0 -5
  390. package/dist/utils/actions/account/index.js +0 -28
  391. package/dist/utils/actions/account/type.d.ts +0 -4
  392. package/dist/utils/actions/account/type.js +0 -1
  393. package/dist/utils/actions/auth/index.d.ts +0 -7
  394. package/dist/utils/actions/common/utils.d.ts +0 -5
  395. package/dist/utils/actions/software/index.d.ts +0 -11
  396. package/dist/utils/actions/software/index.js +0 -75
  397. package/dist/utils/api/accountService/index.d.ts +0 -23
  398. package/dist/utils/api/accountService/index.js +0 -64
  399. package/dist/utils/api/accountService/type.d.ts +0 -4
  400. package/dist/utils/api/accountService/type.js +0 -1
  401. package/dist/utils/api/file-upload/index.d.ts +0 -5
  402. package/dist/utils/api/file-upload/index.js +0 -80
  403. package/dist/utils/api/file-upload/type.d.ts +0 -6
  404. package/dist/utils/api/file-upload/type.js +0 -1
  405. package/dist/utils/api/ikonBaseApi.d.ts +0 -12
  406. package/dist/utils/api/loginService/index.d.ts +0 -12
  407. package/dist/utils/api/loginService/index.js +0 -72
  408. package/dist/utils/api/loginService/type.js +0 -1
  409. package/dist/utils/api/softwareService/index.d.ts +0 -64
  410. package/dist/utils/api/softwareService/index.js +0 -212
  411. package/dist/utils/api/softwareService/type.d.ts +0 -54
  412. package/dist/utils/api/softwareService/type.js +0 -1
  413. package/dist/utils/border-radius-provider.d.ts +0 -11
  414. package/dist/utils/cn.d.ts +0 -2
  415. package/dist/utils/cn.js +0 -5
  416. package/dist/utils/font-provider.d.ts +0 -11
  417. package/dist/utils/session/cookieSession.d.ts +0 -8
  418. package/dist/utils/session/cookieSession.js +0 -33
  419. package/dist/utils/theme-provider/index.d.ts +0 -3
  420. package/dist/utils/theme-provider/index.js +0 -18
  421. package/dist/utils/token-management/index.d.ts +0 -10
  422. package/dist/utils/token-management/index.js +0 -69
  423. package/dist/utils/token-management/types.d.ts +0 -6
  424. package/dist/utils/token-management/types.js +0 -1
@@ -0,0 +1,39 @@
1
+ import { FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage } from '../../../shadcn/form'
2
+ import React from 'react'
3
+ import { FormInputProps } from '../types'
4
+ import {
5
+ InputOTP,
6
+ InputOTPGroup,
7
+ InputOTPSlot,
8
+ } from "../../../shadcn/input-otp"
9
+
10
+ export function FormOtpInput({ formControl, label, formDescription, extraFormComponent, name, ...inputProps }: FormInputProps) {
11
+ return (
12
+ <>
13
+ <FormField
14
+ control={formControl}
15
+ name={name}
16
+ render={({ field }) => (
17
+ <FormItem>
18
+ {label && <FormLabel>{label}</FormLabel>}
19
+ <FormControl>
20
+ <InputOTP maxLength={4} {...field} >
21
+ <InputOTPGroup>
22
+ <InputOTPSlot index={0} />
23
+ <InputOTPSlot index={1} />
24
+ <InputOTPSlot index={2} />
25
+ <InputOTPSlot index={3} />
26
+ {/* <InputOTPSlot index={4} />
27
+ <InputOTPSlot index={5} /> */}
28
+ </InputOTPGroup>
29
+ </InputOTP>
30
+ </FormControl>
31
+ {extraFormComponent && extraFormComponent(field.value)}
32
+ {formDescription && <FormDescription>{formDescription}</FormDescription>}
33
+ <FormMessage />
34
+ </FormItem>
35
+ )}
36
+ />
37
+ </>
38
+ )
39
+ }
@@ -0,0 +1,52 @@
1
+ import * as React from 'react'
2
+ import { FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage } from '../../../shadcn/form'
3
+ import { Input } from '../../../shadcn/input'
4
+ import { Button } from '../../../shadcn/button'
5
+ import { Eye, EyeOff } from 'lucide-react'
6
+ import { FormInputProps } from '../types'
7
+
8
+
9
+ export function FormPasswordInput({ formControl, label, formDescription, extraFormComponent, name, ...inputProps }: FormInputProps) {
10
+ const [showPassword, setShowPassword] = React.useState(false)
11
+ const toggleVisibility = () => setShowPassword(!showPassword)
12
+
13
+ return (
14
+ <>
15
+ <FormField
16
+ control={formControl}
17
+ name={name}
18
+ render={({ field }) => (
19
+ <FormItem>
20
+ {label && <FormLabel>{label}</FormLabel>}
21
+ <div className="relative">
22
+ <FormControl>
23
+ <Input
24
+ type={showPassword ? 'text' : 'password'}
25
+ {...field}
26
+ {...inputProps}
27
+ className={`${inputProps.className || ''} pr-10`}
28
+ />
29
+ </FormControl>
30
+ <Button
31
+ type="button"
32
+ variant="ghost"
33
+ size="icon"
34
+ className="absolute right-0 top-0 h-full px-3 py-2 text-muted-foreground hover:bg-transparent!"
35
+ onClick={toggleVisibility}
36
+ >
37
+ {showPassword ? (
38
+ <EyeOff className="h-4 w-4" />
39
+ ) : (
40
+ <Eye className="h-4 w-4" />
41
+ )}
42
+ </Button>
43
+ </div>
44
+ {extraFormComponent && extraFormComponent(field.value)}
45
+ {formDescription && <FormDescription>{formDescription}</FormDescription>}
46
+ <FormMessage />
47
+ </FormItem>
48
+ )}
49
+ />
50
+ </>
51
+ )
52
+ }
@@ -0,0 +1,7 @@
1
+ import React from 'react'
2
+
3
+ export function FormPhoneInput() {
4
+ return (
5
+ <div>FormPhoneInput</div>
6
+ )
7
+ }
@@ -0,0 +1,28 @@
1
+ import { FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage } from '../../../shadcn/form'
2
+
3
+ import React from 'react'
4
+ import { FormTextareaProps } from '../types'
5
+ import { Textarea } from '../../../shadcn/textarea'
6
+
7
+
8
+
9
+ export function FormTextarea({ formControl, name, label, formItemClass, formDescription, ...textAreaProps }: FormTextareaProps) {
10
+ return (
11
+ <>
12
+ <FormField
13
+ control={formControl}
14
+ name={name}
15
+ render={({ field }) => (
16
+ <FormItem className={formItemClass}>
17
+ {label && <FormLabel>{label}</FormLabel>}
18
+ <FormControl>
19
+ <Textarea {...field} {...textAreaProps} />
20
+ </FormControl>
21
+ {formDescription && <FormDescription>{formDescription}</FormDescription>}
22
+ <FormMessage />
23
+ </FormItem>
24
+ )}
25
+ />
26
+ </>
27
+ )
28
+ }
@@ -0,0 +1,46 @@
1
+ import { Command } from "cmdk";
2
+ import { InputHTMLAttributes, ReactNode, TextareaHTMLAttributes } from "react";
3
+ import { Matcher } from "react-day-picker";
4
+
5
+ export interface FormFieldProps {
6
+ formControl: any;
7
+ label?: string;
8
+ formItemClass?: string;
9
+ formDescription?: string;
10
+ extraFormComponent?: (value: string) => ReactNode;
11
+ }
12
+
13
+ export interface FormInputProps
14
+ extends FormFieldProps,
15
+ InputHTMLAttributes<HTMLInputElement> {
16
+ name: string;
17
+ }
18
+
19
+ export interface FormTextareaProps
20
+ extends FormFieldProps,
21
+ TextareaHTMLAttributes<HTMLTextAreaElement> {
22
+ name: string;
23
+ }
24
+
25
+ export interface FormDateInputProps extends FormFieldProps {
26
+ name: string;
27
+ placeholder?: string;
28
+ dateFormat?: string;
29
+ calendarDateDisabled?: Matcher;
30
+ disabled?: boolean;
31
+ }
32
+
33
+ export interface FormComboboxInputProps extends FormFieldProps {
34
+ name: string;
35
+ placeholder?: string;
36
+ items: FormComboboxItemProps[];
37
+ onSelect?: (value: string | string[]) => void;
38
+ defaultValue?: []
39
+ disabled?: ((...args: any) => boolean) | boolean;
40
+ }
41
+ export interface FormComboboxItemProps {
42
+ value: string;
43
+ label?: string | undefined;
44
+ extra?: any;
45
+ disabled?: ((...args: any) => boolean) | boolean;
46
+ }
@@ -0,0 +1,171 @@
1
+ "use client";
2
+
3
+ import React, { memo, useCallback, useEffect, useRef } from "react";
4
+ import { animate } from "motion/react";
5
+ import { cn } from "../../utils/cn";
6
+
7
+ interface GlowingEffectProps {
8
+ blur?: number;
9
+ inactiveZone?: number;
10
+ proximity?: number;
11
+ spread?: number;
12
+ variant?: "default" | "white";
13
+ glow?: boolean;
14
+ className?: string;
15
+ disabled?: boolean;
16
+ movementDuration?: number;
17
+ borderWidth?: number;
18
+ }
19
+ export const GlowingEffect = (
20
+ ({
21
+ blur = 0,
22
+ inactiveZone = 0.7,
23
+ proximity = 0,
24
+ spread = 20,
25
+ variant = "default",
26
+ glow = false,
27
+ className,
28
+ movementDuration = 2,
29
+ borderWidth = 1,
30
+ disabled = true,
31
+ }: GlowingEffectProps) => {
32
+ const containerRef = useRef<HTMLDivElement>(null);
33
+ const lastPosition = useRef({ x: 0, y: 0 });
34
+ const animationFrameRef = useRef<number>(0);
35
+
36
+ const handleMove = useCallback(
37
+ (e?: MouseEvent | { x: number; y: number }) => {
38
+ if (!containerRef.current) return;
39
+
40
+ if (animationFrameRef.current) {
41
+ cancelAnimationFrame(animationFrameRef.current);
42
+ }
43
+
44
+ animationFrameRef.current = requestAnimationFrame(() => {
45
+ const element = containerRef.current;
46
+ if (!element) return;
47
+
48
+ const { left, top, width, height } = element.getBoundingClientRect();
49
+ const mouseX = e?.x ?? lastPosition.current.x;
50
+ const mouseY = e?.y ?? lastPosition.current.y;
51
+
52
+ if (e) {
53
+ lastPosition.current = { x: mouseX, y: mouseY };
54
+ }
55
+
56
+ const center = [left + width * 0.5, top + height * 0.5];
57
+ const distanceFromCenter = Math.hypot(
58
+ mouseX - center[0],
59
+ mouseY - center[1]
60
+ );
61
+ const inactiveRadius = 0.5 * Math.min(width, height) * inactiveZone;
62
+
63
+ if (distanceFromCenter < inactiveRadius) {
64
+ element.style.setProperty("--active", "0");
65
+ return;
66
+ }
67
+
68
+ const isActive =
69
+ mouseX > left - proximity &&
70
+ mouseX < left + width + proximity &&
71
+ mouseY > top - proximity &&
72
+ mouseY < top + height + proximity;
73
+
74
+ element.style.setProperty("--active", isActive ? "1" : "0");
75
+
76
+ if (!isActive) return;
77
+
78
+ const currentAngle =
79
+ parseFloat(element.style.getPropertyValue("--start")) || 0;
80
+ const targetAngle =
81
+ (180 * Math.atan2(mouseY - center[1], mouseX - center[0])) /
82
+ Math.PI +
83
+ 90;
84
+
85
+ const angleDiff = ((targetAngle - currentAngle + 180) % 360) - 180;
86
+ const newAngle = currentAngle + angleDiff;
87
+
88
+ animate(currentAngle, newAngle, {
89
+ duration: movementDuration,
90
+ ease: [0.16, 1, 0.3, 1],
91
+ onUpdate: (value) => {
92
+ element.style.setProperty("--start", String(value));
93
+ },
94
+ });
95
+ });
96
+ },
97
+ [inactiveZone, proximity, movementDuration]
98
+ );
99
+
100
+ useEffect(() => {
101
+ if (disabled) return;
102
+
103
+ const handleScroll = () => handleMove();
104
+ const handlePointerMove = (e: PointerEvent) => handleMove(e);
105
+
106
+ window.addEventListener("scroll", handleScroll, { passive: true });
107
+ document.body.addEventListener("pointermove", handlePointerMove, {
108
+ passive: true,
109
+ });
110
+
111
+ return () => {
112
+ if (animationFrameRef.current) {
113
+ cancelAnimationFrame(animationFrameRef.current);
114
+ }
115
+ window.removeEventListener("scroll", handleScroll);
116
+ document.body.removeEventListener("pointermove", handlePointerMove);
117
+ };
118
+ }, [handleMove, disabled]);
119
+
120
+ return (
121
+ <>
122
+ <div
123
+ className={cn(
124
+ "pointer-events-none absolute -inset-px hidden rounded-[inherit] border opacity-0 transition-opacity",
125
+ glow && "opacity-100",
126
+ variant === "white" && "border-white",
127
+ disabled && "!block"
128
+ )}
129
+ />
130
+ <div
131
+ ref={containerRef}
132
+ style={
133
+ {
134
+ "--blur": `${blur}px`,
135
+ "--spread": spread,
136
+ "--start": "0",
137
+ "--active": "0",
138
+ "--glowingeffect-border-width": `${borderWidth}px`,
139
+ "--repeating-conic-gradient-times": "5",
140
+ "--gradient":
141
+ variant === "white"
142
+ ? `repeating-conic-gradient(from 236.84deg at 50% 50%,var(--black),var(--black) calc(25% / var(--repeating-conic-gradient-times)))`
143
+ : `linear-gradient(54.29deg, #00A5E9 22.93%, #A020F0 32.97%, #55C8FF 52.28%, #A020F0 73.13%, #071182 88.57%)`,
144
+ } as React.CSSProperties
145
+ }
146
+ className={cn(
147
+ "pointer-events-none absolute inset-0 rounded-[inherit] opacity-100 transition-opacity",
148
+ glow && "opacity-100",
149
+ blur > 0 && "blur-[var(--blur)] ",
150
+ className,
151
+ disabled && "!hidden"
152
+ )}
153
+ >
154
+ <div
155
+ className={cn(
156
+ "glow",
157
+ "rounded-[inherit]",
158
+ 'after:content-[""] after:rounded-[inherit] after:absolute after:inset-[calc(-1*var(--glowingeffect-border-width))]',
159
+ "after:[border:var(--glowingeffect-border-width)_solid_transparent]",
160
+ "after:[background:var(--gradient)] after:[background-attachment:fixed]",
161
+ "after:opacity-[var(--active)] after:transition-opacity after:duration-300",
162
+ "after:[mask-clip:padding-box,border-box]",
163
+ "after:[mask-composite:intersect]",
164
+ "after:[mask-image:linear-gradient(#0000,#0000),conic-gradient(from_calc((var(--start)-var(--spread))*1deg),#00000000_0deg,#fff,#00000000_calc(var(--spread)*2deg))]"
165
+ )}
166
+ />
167
+ </div>
168
+ </>
169
+ );
170
+ }
171
+ );
@@ -0,0 +1,22 @@
1
+ "use client"
2
+ import * as React from 'react'
3
+ import * as LucideIcons from 'lucide-react'
4
+
5
+ export interface IconProps {
6
+ name: string
7
+ size?: number | string
8
+ color?: string
9
+ className?: string
10
+ strokeWidth?: number
11
+ }
12
+
13
+ export function Icon({ name, ...props }: IconProps) {
14
+ const IconComponent = (LucideIcons as any)[name]
15
+
16
+ if (!IconComponent) {
17
+ console.warn(`Icon "${name}" not found in lucide-react`)
18
+ return null
19
+ }
20
+
21
+ return <IconComponent {...props} />
22
+ }
@@ -0,0 +1,19 @@
1
+ .box {
2
+ display: inline-block;
3
+ padding: 10px;
4
+ box-sizing: border-box;
5
+ }
6
+ .img-preview {
7
+ overflow: hidden;
8
+ }
9
+
10
+ .cropper-crop-box,
11
+ .cropper-view-box {
12
+ border-radius: 50%;
13
+ }
14
+
15
+ .cropper-view-box {
16
+ box-shadow: 0 0 0 1px #39f;
17
+ outline: 0;
18
+ }
19
+
@@ -1,85 +1,117 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useEffect, useRef } from "react";
3
- import Cropper from "react-cropper";
4
- import "cropperjs/dist/cropper.css";
5
- export const NewCropperImg = ({ imageSrc, onCroppedImage, aspectRatio, rotationAngle, zoomLevel, moveDirection, currentState }) => {
6
- const cropperRef = useRef(null);
7
- const onCrop = () => {
8
- var _a;
9
- const cropper = (_a = cropperRef.current) === null || _a === void 0 ? void 0 : _a.cropper;
10
- if (cropper) {
11
- cropper.setDragMode('move');
12
- const croppedCanvas = cropper.getCroppedCanvas();
13
- const croppedImageUrl = croppedCanvas.toDataURL(); // Data URL for preview
14
- onCroppedImage(croppedImageUrl);
15
- }
16
- else {
17
- console.log("Cropper instance is not available.");
18
- }
19
- };
20
- useEffect(() => {
21
- var _a;
22
- // Rotate the image whenever the rotation angle changes
23
- const cropper = (_a = cropperRef.current) === null || _a === void 0 ? void 0 : _a.cropper;
24
- if (cropper) {
25
- cropper.rotate(rotationAngle); // Apply the rotation to the image
26
- }
27
- }, [rotationAngle]); // Effect will run whenever rotationAngle changes
28
- useEffect(() => {
29
- var _a;
30
- // Zoom the image whenever the zoom level changes
31
- const cropper = (_a = cropperRef.current) === null || _a === void 0 ? void 0 : _a.cropper;
32
- if (cropper) {
33
- const cropBoxData = cropper.getCropBoxData();
34
- if (cropBoxData.width) {
35
- console.log('Inside cropper scale');
36
- cropper.scale(zoomLevel); // Apply the zoom level
37
- }
38
- // Apply zoom directly without using getZoom method
39
- }
40
- }, [zoomLevel]); // Effect will run whenever zoomLevel changes
41
- // Move the image based on the moveDirection prop
42
- useEffect(() => {
43
- var _a;
44
- const cropper = (_a = cropperRef.current) === null || _a === void 0 ? void 0 : _a.cropper;
45
- if (cropper) {
46
- // Make sure moveDirection is available before calling move
47
- const cropBoxData = cropper.getCropBoxData();
48
- if (cropBoxData.width) {
49
- const { x, y } = moveDirection;
50
- if (typeof x === "number" && typeof y === "number") {
51
- cropper.move(x, y); // Move the image
52
- }
53
- }
54
- }
55
- }, [moveDirection]); // This effect runs whenever moveDirection changes
56
- useEffect(() => {
57
- var _a;
58
- const cropper = (_a = cropperRef.current) === null || _a === void 0 ? void 0 : _a.cropper;
59
- if (cropper) {
60
- cropper.setAspectRatio(aspectRatio); // Dynamically set the aspect ratio
61
- if (aspectRatio === 1) {
62
- // Get the displayed (canvas) dimensions of the image
63
- const canvasData = cropper.getCanvasData();
64
- const canvasWidth = canvasData.width; // Displayed width of the image
65
- const canvasHeight = canvasData.height; // Displayed height of the image
66
- const canvasLeft = canvasData.left; // Left offset of the image within the container
67
- const canvasTop = canvasData.top; // Top offset of the image within the container
68
- // Define the desired crop box dimensions
69
- const cropBoxWidth = 200; // Desired crop box width
70
- const cropBoxHeight = 100; // Desired crop box height
71
- // Calculate the center position for the crop box
72
- const left = canvasLeft + (canvasWidth - cropBoxWidth) / 2;
73
- const top = canvasTop + (canvasHeight - cropBoxHeight) / 2;
74
- // Set the crop box data
75
- cropper.setCropBoxData({
76
- left: left,
77
- top: top,
78
- width: cropBoxWidth,
79
- height: cropBoxHeight,
80
- });
81
- }
82
- }
83
- }, [aspectRatio]); // Trigger this effect whenever aspectRatio changes
84
- return (_jsx(Cropper, { src: imageSrc, style: { height: "100%", width: "100%", objectFit: "contain" }, guides: true, crop: onCrop, ref: cropperRef, dragMode: 'move', movable: true, zoomable: true, scalable: true, cropBoxMovable: true, cropBoxResizable: false }));
85
- };
1
+ import React, { useCallback, useEffect, useRef, useState } from "react";
2
+ import Cropper, { ReactCropperElement } from "react-cropper";
3
+ import "cropperjs/dist/cropper.css";
4
+
5
+ export interface CropperImgProps {
6
+ imageSrc: string | undefined; // imageSrc can be a string (image URL or base64) or undefined
7
+ onCroppedImage: (imageUrl: string) => void; // Callback function from parent to pass cropped image
8
+ aspectRatio: number;
9
+ rotationAngle: number; // Rotation angle passed from the parent
10
+ zoomLevel: number; // Add zoomLevel prop
11
+ moveDirection: { x: number; y: number }; // Movement props
12
+ currentState: string
13
+ }
14
+
15
+ export const NewCropperImg: React.FC<CropperImgProps> = ({ imageSrc, onCroppedImage, aspectRatio, rotationAngle, zoomLevel, moveDirection, currentState }) => {
16
+ const cropperRef = useRef<ReactCropperElement>(null);
17
+
18
+ const onCrop = () => {
19
+ const cropper = cropperRef.current?.cropper;
20
+ if (cropper) {
21
+ cropper.setDragMode('move');
22
+ const croppedCanvas = cropper.getCroppedCanvas();
23
+ const croppedImageUrl = croppedCanvas.toDataURL(); // Data URL for preview
24
+ onCroppedImage(croppedImageUrl);
25
+ } else {
26
+ console.log("Cropper instance is not available.");
27
+ }
28
+ };
29
+
30
+ useEffect(() => {
31
+ // Rotate the image whenever the rotation angle changes
32
+ const cropper = cropperRef.current?.cropper;
33
+ if (cropper) {
34
+ cropper.rotate(rotationAngle); // Apply the rotation to the image
35
+ }
36
+
37
+ }, [rotationAngle]); // Effect will run whenever rotationAngle changes
38
+
39
+ useEffect(() => {
40
+ // Zoom the image whenever the zoom level changes
41
+ const cropper = cropperRef.current?.cropper;
42
+
43
+ if (cropper) {
44
+ const cropBoxData = cropper.getCropBoxData();
45
+ if (cropBoxData.width) {
46
+ console.log('Inside cropper scale')
47
+ cropper.scale(zoomLevel); // Apply the zoom level
48
+ }
49
+ // Apply zoom directly without using getZoom method
50
+ }
51
+ }, [zoomLevel]); // Effect will run whenever zoomLevel changes
52
+
53
+ // Move the image based on the moveDirection prop
54
+ useEffect(() => {
55
+ const cropper = cropperRef.current?.cropper;
56
+ if (cropper) {
57
+ // Make sure moveDirection is available before calling move
58
+ const cropBoxData = cropper.getCropBoxData();
59
+ if (cropBoxData.width) {
60
+ const { x, y } = moveDirection;
61
+ if (typeof x === "number" && typeof y === "number") {
62
+ cropper.move(x, y); // Move the image
63
+ }
64
+ }
65
+
66
+ }
67
+ }, [moveDirection]); // This effect runs whenever moveDirection changes
68
+
69
+ useEffect(() => {
70
+ const cropper = cropperRef.current?.cropper;
71
+ if (cropper) {
72
+ cropper.setAspectRatio(aspectRatio); // Dynamically set the aspect ratio
73
+ if (aspectRatio === 1) {
74
+ // Get the displayed (canvas) dimensions of the image
75
+ const canvasData = cropper.getCanvasData();
76
+ const canvasWidth = canvasData.width; // Displayed width of the image
77
+ const canvasHeight = canvasData.height; // Displayed height of the image
78
+ const canvasLeft = canvasData.left; // Left offset of the image within the container
79
+ const canvasTop = canvasData.top; // Top offset of the image within the container
80
+
81
+ // Define the desired crop box dimensions
82
+ const cropBoxWidth = 200; // Desired crop box width
83
+ const cropBoxHeight = 100; // Desired crop box height
84
+
85
+ // Calculate the center position for the crop box
86
+ const left = canvasLeft + (canvasWidth - cropBoxWidth) / 2;
87
+ const top = canvasTop + (canvasHeight - cropBoxHeight) / 2;
88
+
89
+ // Set the crop box data
90
+ cropper.setCropBoxData({
91
+ left: left,
92
+ top: top,
93
+ width: cropBoxWidth,
94
+ height: cropBoxHeight,
95
+ });
96
+ }
97
+
98
+ }
99
+
100
+ }, [aspectRatio]); // Trigger this effect whenever aspectRatio changes
101
+
102
+ return (
103
+ <Cropper
104
+ src={imageSrc}
105
+ style={{ height: "100%", width: "100%", objectFit: "contain" }}
106
+ guides={true} // Show guides for cropping
107
+ crop={onCrop} // Callback to capture the cropped area
108
+ ref={cropperRef}
109
+ dragMode='move'
110
+ movable={true}
111
+ zoomable={true} // Allow zooming of the image
112
+ scalable={true} // Prevent scaling of the crop box
113
+ cropBoxMovable={true} // Allow the crop box to be moved inside the image
114
+ cropBoxResizable={false} // Disable resizing the crop box
115
+ />
116
+ );
117
+ };