@harjs/react-ui 1.0.0

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 (425) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +27 -0
  3. package/dist/assets/css/components/charts/gantt/styles.css +62 -0
  4. package/dist/assets/css/components/charts/pie/pie.css +90 -0
  5. package/dist/assets/css/components/data-display/calendar/styles.css +15 -0
  6. package/dist/assets/css/components/data-display/calendar/styles.week-view.css +144 -0
  7. package/dist/assets/css/components/data-display/card/statuses.css +377 -0
  8. package/dist/assets/css/components/data-display/card/styles.css +26 -0
  9. package/dist/assets/css/components/data-display/chip/chip.css +13 -0
  10. package/dist/assets/css/components/data-display/diagram/styles.css +125 -0
  11. package/dist/assets/css/components/data-display/divider/divider.css +8 -0
  12. package/dist/assets/css/components/data-display/dnd/animations.css +11 -0
  13. package/dist/assets/css/components/data-display/dnd/shadow.css +26 -0
  14. package/dist/assets/css/components/data-display/dnd/styles.css +72 -0
  15. package/dist/assets/css/components/data-display/grid-system/column/position.css +21 -0
  16. package/dist/assets/css/components/data-display/grid-system/column/styles.css +379 -0
  17. package/dist/assets/css/components/data-display/grid-system/row/styles.css +35 -0
  18. package/dist/assets/css/components/data-display/grid-system/styles.css +6 -0
  19. package/dist/assets/css/components/data-display/kanban-board/styles.css +371 -0
  20. package/dist/assets/css/components/data-display/paper/styles.css +49 -0
  21. package/dist/assets/css/components/data-display/syntax-highlighter/core/jsx.template.css +65 -0
  22. package/dist/assets/css/components/data-display/syntax-highlighter/syntax-highlighter.css +58 -0
  23. package/dist/assets/css/components/data-display/table/filter-popup.css +11 -0
  24. package/dist/assets/css/components/data-display/table/properties-popup.css +42 -0
  25. package/dist/assets/css/components/data-display/table/scroll.css +208 -0
  26. package/dist/assets/css/components/data-display/table/styles.css +867 -0
  27. package/dist/assets/css/components/data-display/tabs/tabs.css +245 -0
  28. package/dist/assets/css/components/data-display/typography/paragraph/align.css +13 -0
  29. package/dist/assets/css/components/data-display/typography/paragraph/color.css +51 -0
  30. package/dist/assets/css/components/data-display/typography/paragraph/core.css +6 -0
  31. package/dist/assets/css/components/data-display/typography/paragraph/size.css +13 -0
  32. package/dist/assets/css/components/data-display/typography/title/align.css +13 -0
  33. package/dist/assets/css/components/data-display/typography/title/color.css +0 -0
  34. package/dist/assets/css/components/data-display/typography/title/core.css +5 -0
  35. package/dist/assets/css/components/data-display/typography/title/size.css +41 -0
  36. package/dist/assets/css/components/data-display/typography/typography.css +11 -0
  37. package/dist/assets/css/components/feedback/alert/statuses.css +224 -0
  38. package/dist/assets/css/components/feedback/alert/styles.css +61 -0
  39. package/dist/assets/css/components/feedback/drawer/content.css +7 -0
  40. package/dist/assets/css/components/feedback/drawer/header.css +56 -0
  41. package/dist/assets/css/components/feedback/drawer/styles.css +85 -0
  42. package/dist/assets/css/components/feedback/loading/loading.css +54 -0
  43. package/dist/assets/css/components/feedback/modal/content.css +6 -0
  44. package/dist/assets/css/components/feedback/modal/footer.css +9 -0
  45. package/dist/assets/css/components/feedback/modal/header.css +56 -0
  46. package/dist/assets/css/components/feedback/modal/media-queries/medium.css +11 -0
  47. package/dist/assets/css/components/feedback/modal/media-queries/small.css +11 -0
  48. package/dist/assets/css/components/feedback/modal/media-queries/x-large.css +5 -0
  49. package/dist/assets/css/components/feedback/modal/styles.css +53 -0
  50. package/dist/assets/css/components/feedback/notification/notification.css +157 -0
  51. package/dist/assets/css/components/feedback/popover/styles.css +53 -0
  52. package/dist/assets/css/components/feedback/popup-confirm/styles.css +165 -0
  53. package/dist/assets/css/components/feedback/progress/animations.css +10 -0
  54. package/dist/assets/css/components/feedback/progress/progress.css +50 -0
  55. package/dist/assets/css/components/feedback/progress/statuses.css +188 -0
  56. package/dist/assets/css/components/feedback/tooltip/styles.css +60 -0
  57. package/dist/assets/css/components/form/button/core/icon.css +37 -0
  58. package/dist/assets/css/components/form/button/core/position.css +19 -0
  59. package/dist/assets/css/components/form/button/core/shape.css +13 -0
  60. package/dist/assets/css/components/form/button/core/size.css +14 -0
  61. package/dist/assets/css/components/form/button/styles.css +32 -0
  62. package/dist/assets/css/components/form/button-action/styles.css +24 -0
  63. package/dist/assets/css/components/form/button-group/styles.css +26 -0
  64. package/dist/assets/css/components/form/checkbox/checkbox.css +53 -0
  65. package/dist/assets/css/components/form/checkbox/core/border.css +252 -0
  66. package/dist/assets/css/components/form/date-picker/calendar/calendar.css +14 -0
  67. package/dist/assets/css/components/form/date-picker/calendar/content.css +62 -0
  68. package/dist/assets/css/components/form/date-picker/calendar/footer.css +10 -0
  69. package/dist/assets/css/components/form/date-picker/calendar/header.css +86 -0
  70. package/dist/assets/css/components/form/date-picker/clock/clock.css +14 -0
  71. package/dist/assets/css/components/form/date-picker/clock/content.css +48 -0
  72. package/dist/assets/css/components/form/date-picker/clock/footer.css +6 -0
  73. package/dist/assets/css/components/form/date-picker/clock/header.css +8 -0
  74. package/dist/assets/css/components/form/date-picker/date-picker.css +36 -0
  75. package/dist/assets/css/components/form/input/core/addon.css +11 -0
  76. package/dist/assets/css/components/form/input/core/border.css +114 -0
  77. package/dist/assets/css/components/form/input/core/button.css +34 -0
  78. package/dist/assets/css/components/form/input/core/icon.css +22 -0
  79. package/dist/assets/css/components/form/input/otp/styles.css +20 -0
  80. package/dist/assets/css/components/form/input/phone/styles.css +50 -0
  81. package/dist/assets/css/components/form/input/styles.css +120 -0
  82. package/dist/assets/css/components/form/radio/core/border.css +252 -0
  83. package/dist/assets/css/components/form/radio/radio.css +69 -0
  84. package/dist/assets/css/components/form/select/options.css +117 -0
  85. package/dist/assets/css/components/form/select/styles.css +184 -0
  86. package/dist/assets/css/components/form/switch/core/border.css +208 -0
  87. package/dist/assets/css/components/form/switch/styles.css +61 -0
  88. package/dist/assets/css/components/form/text-editor/styles.css +130 -0
  89. package/dist/assets/css/components/form/upload/dropzone.css +166 -0
  90. package/dist/assets/css/components/form/upload/list-and-gird.css +183 -0
  91. package/dist/assets/css/components/form/upload/styles.css +215 -0
  92. package/dist/assets/css/components/layout/layout.css +130 -0
  93. package/dist/assets/css/components/layout/media-queries/large.css +19 -0
  94. package/dist/assets/css/components/layout/media-queries/medium.css +19 -0
  95. package/dist/assets/css/components/layout/media-queries/small.css +19 -0
  96. package/dist/assets/css/components/layout/media-queries/x-large.css +19 -0
  97. package/dist/assets/css/components/layout/media-queries/x-small.css +3 -0
  98. package/dist/assets/css/components/layout/media-queries/xx-large.css +19 -0
  99. package/dist/assets/css/components/layout/media-queries/xxx-large.css +20 -0
  100. package/dist/assets/css/components/navigation/breadcrumb/styles.css +0 -0
  101. package/dist/assets/css/components/navigation/menu/core/open-or-close.css +12 -0
  102. package/dist/assets/css/components/navigation/menu/styles.css +163 -0
  103. package/dist/assets/css/components/navigation/menu/variant/horizontal.css +3 -0
  104. package/dist/assets/css/components/navigation/menu/variant/vertical.css +3 -0
  105. package/dist/assets/css/components/navigation/pagination/styles.css +169 -0
  106. package/dist/assets/css/components/navigation/steps/animation.css +8 -0
  107. package/dist/assets/css/components/navigation/steps/styles.css +146 -0
  108. package/dist/assets/css/core/animation.css +164 -0
  109. package/dist/assets/css/core/ar-core.css +192 -0
  110. package/dist/assets/css/core/color-palette.css +111 -0
  111. package/dist/assets/css/core/utils.css +16 -0
  112. package/dist/assets/css/core/variants/animation.css +164 -0
  113. package/dist/assets/css/core/variants/border.css +18 -0
  114. package/dist/assets/css/core/variants/borderless.css +362 -0
  115. package/dist/assets/css/core/variants/dashed.css +362 -0
  116. package/dist/assets/css/core/variants/filled.css +428 -0
  117. package/dist/assets/css/core/variants/outlined.css +439 -0
  118. package/dist/assets/css/core/variants/surface.css +252 -0
  119. package/dist/assets/fonts/JetBrainsMono-Bold.ttf +0 -0
  120. package/dist/assets/fonts/JetBrainsMono-Regular.ttf +0 -0
  121. package/dist/components/charts/gantt/IProps.d.ts +24 -0
  122. package/dist/components/charts/gantt/IProps.js +1 -0
  123. package/dist/components/charts/gantt/index.d.ts +5 -0
  124. package/dist/components/charts/gantt/index.js +308 -0
  125. package/dist/components/charts/index.d.ts +2 -0
  126. package/dist/components/charts/index.js +2 -0
  127. package/dist/components/charts/pie/IProps.d.ts +7 -0
  128. package/dist/components/charts/pie/IProps.js +1 -0
  129. package/dist/components/charts/pie/index.d.ts +5 -0
  130. package/dist/components/charts/pie/index.js +56 -0
  131. package/dist/components/data-display/calendar/Body.d.ts +23 -0
  132. package/dist/components/data-display/calendar/Body.js +14 -0
  133. package/dist/components/data-display/calendar/Header.d.ts +20 -0
  134. package/dist/components/data-display/calendar/Header.js +26 -0
  135. package/dist/components/data-display/calendar/IProps.d.ts +14 -0
  136. package/dist/components/data-display/calendar/IProps.js +1 -0
  137. package/dist/components/data-display/calendar/index.d.ts +8 -0
  138. package/dist/components/data-display/calendar/index.js +27 -0
  139. package/dist/components/data-display/calendar/views/Day.d.ts +3 -0
  140. package/dist/components/data-display/calendar/views/Day.js +5 -0
  141. package/dist/components/data-display/calendar/views/Month.d.ts +3 -0
  142. package/dist/components/data-display/calendar/views/Month.js +5 -0
  143. package/dist/components/data-display/calendar/views/Week.d.ts +19 -0
  144. package/dist/components/data-display/calendar/views/Week.js +173 -0
  145. package/dist/components/data-display/card/IProps.d.ts +10 -0
  146. package/dist/components/data-display/card/IProps.js +1 -0
  147. package/dist/components/data-display/card/index.d.ts +5 -0
  148. package/dist/components/data-display/card/index.js +14 -0
  149. package/dist/components/data-display/chip/IProps.d.ts +6 -0
  150. package/dist/components/data-display/chip/IProps.js +1 -0
  151. package/dist/components/data-display/chip/index.d.ts +5 -0
  152. package/dist/components/data-display/chip/index.js +17 -0
  153. package/dist/components/data-display/diagram/IProps.d.ts +6 -0
  154. package/dist/components/data-display/diagram/IProps.js +1 -0
  155. package/dist/components/data-display/diagram/index.d.ts +5 -0
  156. package/dist/components/data-display/diagram/index.js +298 -0
  157. package/dist/components/data-display/divider/IProps.d.ts +6 -0
  158. package/dist/components/data-display/divider/IProps.js +1 -0
  159. package/dist/components/data-display/divider/index.d.ts +5 -0
  160. package/dist/components/data-display/divider/index.js +5 -0
  161. package/dist/components/data-display/dnd/IProps.d.ts +12 -0
  162. package/dist/components/data-display/dnd/IProps.js +1 -0
  163. package/dist/components/data-display/dnd/index.d.ts +5 -0
  164. package/dist/components/data-display/dnd/index.js +125 -0
  165. package/dist/components/data-display/grid-system/box/Box.d.ts +6 -0
  166. package/dist/components/data-display/grid-system/box/Box.js +13 -0
  167. package/dist/components/data-display/grid-system/column/Column.d.ts +4 -0
  168. package/dist/components/data-display/grid-system/column/Column.js +21 -0
  169. package/dist/components/data-display/grid-system/column/IProps.d.ts +13 -0
  170. package/dist/components/data-display/grid-system/column/IProps.js +1 -0
  171. package/dist/components/data-display/grid-system/index.d.ts +10 -0
  172. package/dist/components/data-display/grid-system/index.js +11 -0
  173. package/dist/components/data-display/grid-system/row/IProps.d.ts +4 -0
  174. package/dist/components/data-display/grid-system/row/IProps.js +1 -0
  175. package/dist/components/data-display/grid-system/row/Row.d.ts +4 -0
  176. package/dist/components/data-display/grid-system/row/Row.js +6 -0
  177. package/dist/components/data-display/kanban-board/IProps.d.ts +31 -0
  178. package/dist/components/data-display/kanban-board/IProps.js +1 -0
  179. package/dist/components/data-display/kanban-board/filter/DateFilters.d.ts +25 -0
  180. package/dist/components/data-display/kanban-board/filter/DateFilters.js +55 -0
  181. package/dist/components/data-display/kanban-board/filter/SelectFilters.d.ts +27 -0
  182. package/dist/components/data-display/kanban-board/filter/SelectFilters.js +43 -0
  183. package/dist/components/data-display/kanban-board/filter/index.d.ts +36 -0
  184. package/dist/components/data-display/kanban-board/filter/index.js +47 -0
  185. package/dist/components/data-display/kanban-board/index.d.ts +5 -0
  186. package/dist/components/data-display/kanban-board/index.js +309 -0
  187. package/dist/components/data-display/paper/IProps.d.ts +6 -0
  188. package/dist/components/data-display/paper/IProps.js +1 -0
  189. package/dist/components/data-display/paper/index.d.ts +5 -0
  190. package/dist/components/data-display/paper/index.js +12 -0
  191. package/dist/components/data-display/syntax-highlighter/Import.d.ts +4 -0
  192. package/dist/components/data-display/syntax-highlighter/Import.js +5 -0
  193. package/dist/components/data-display/syntax-highlighter/classes/Compiler.d.ts +7 -0
  194. package/dist/components/data-display/syntax-highlighter/classes/Compiler.js +92 -0
  195. package/dist/components/data-display/syntax-highlighter/classes/Parser.d.ts +9 -0
  196. package/dist/components/data-display/syntax-highlighter/classes/Parser.js +99 -0
  197. package/dist/components/data-display/syntax-highlighter/index.d.ts +11 -0
  198. package/dist/components/data-display/syntax-highlighter/index.js +41 -0
  199. package/dist/components/data-display/table/FilterPopup.d.ts +20 -0
  200. package/dist/components/data-display/table/FilterPopup.js +54 -0
  201. package/dist/components/data-display/table/Helpers.d.ts +2 -0
  202. package/dist/components/data-display/table/Helpers.js +10 -0
  203. package/dist/components/data-display/table/IProps.d.ts +99 -0
  204. package/dist/components/data-display/table/IProps.js +1 -0
  205. package/dist/components/data-display/table/PropertiesPopup.d.ts +31 -0
  206. package/dist/components/data-display/table/PropertiesPopup.js +90 -0
  207. package/dist/components/data-display/table/THeadCell.d.ts +34 -0
  208. package/dist/components/data-display/table/THeadCell.js +67 -0
  209. package/dist/components/data-display/table/body/Editable.d.ts +12 -0
  210. package/dist/components/data-display/table/body/Editable.js +59 -0
  211. package/dist/components/data-display/table/body/TBody.d.ts +36 -0
  212. package/dist/components/data-display/table/body/TBody.js +184 -0
  213. package/dist/components/data-display/table/header/ActionButtons.d.ts +14 -0
  214. package/dist/components/data-display/table/header/ActionButtons.js +65 -0
  215. package/dist/components/data-display/table/header/Header.d.ts +15 -0
  216. package/dist/components/data-display/table/header/Header.js +10 -0
  217. package/dist/components/data-display/table/index.d.ts +7 -0
  218. package/dist/components/data-display/table/index.js +639 -0
  219. package/dist/components/data-display/tabs/IProps.d.ts +9 -0
  220. package/dist/components/data-display/tabs/IProps.js +1 -0
  221. package/dist/components/data-display/tabs/index.d.ts +5 -0
  222. package/dist/components/data-display/tabs/index.js +110 -0
  223. package/dist/components/data-display/tabs/skeleton.d.ts +4 -0
  224. package/dist/components/data-display/tabs/skeleton.js +14 -0
  225. package/dist/components/data-display/typography/index.d.ts +6 -0
  226. package/dist/components/data-display/typography/index.js +9 -0
  227. package/dist/components/data-display/typography/paragraph/IProps.d.ts +7 -0
  228. package/dist/components/data-display/typography/paragraph/IProps.js +1 -0
  229. package/dist/components/data-display/typography/paragraph/Paragraph.d.ts +4 -0
  230. package/dist/components/data-display/typography/paragraph/Paragraph.js +14 -0
  231. package/dist/components/data-display/typography/title/IProps.d.ts +7 -0
  232. package/dist/components/data-display/typography/title/IProps.js +1 -0
  233. package/dist/components/data-display/typography/title/Title.d.ts +4 -0
  234. package/dist/components/data-display/typography/title/Title.js +13 -0
  235. package/dist/components/feedback/alert/IProps.d.ts +11 -0
  236. package/dist/components/feedback/alert/IProps.js +1 -0
  237. package/dist/components/feedback/alert/index.d.ts +5 -0
  238. package/dist/components/feedback/alert/index.js +50 -0
  239. package/dist/components/feedback/drawer/IProps.d.ts +18 -0
  240. package/dist/components/feedback/drawer/IProps.js +1 -0
  241. package/dist/components/feedback/drawer/index.d.ts +5 -0
  242. package/dist/components/feedback/drawer/index.js +94 -0
  243. package/dist/components/feedback/loading/index.d.ts +4 -0
  244. package/dist/components/feedback/loading/index.js +7 -0
  245. package/dist/components/feedback/modal/IProps.d.ts +14 -0
  246. package/dist/components/feedback/modal/IProps.js +1 -0
  247. package/dist/components/feedback/modal/index.d.ts +5 -0
  248. package/dist/components/feedback/modal/index.js +91 -0
  249. package/dist/components/feedback/notification/IProps.d.ts +9 -0
  250. package/dist/components/feedback/notification/IProps.js +1 -0
  251. package/dist/components/feedback/notification/index.d.ts +5 -0
  252. package/dist/components/feedback/notification/index.js +96 -0
  253. package/dist/components/feedback/popover/IProps.d.ts +16 -0
  254. package/dist/components/feedback/popover/IProps.js +1 -0
  255. package/dist/components/feedback/popover/index.d.ts +5 -0
  256. package/dist/components/feedback/popover/index.js +91 -0
  257. package/dist/components/feedback/popup-confirm/IProps.d.ts +10 -0
  258. package/dist/components/feedback/popup-confirm/IProps.js +1 -0
  259. package/dist/components/feedback/popup-confirm/index.d.ts +5 -0
  260. package/dist/components/feedback/popup-confirm/index.js +98 -0
  261. package/dist/components/feedback/progress/IProps.d.ts +6 -0
  262. package/dist/components/feedback/progress/IProps.js +1 -0
  263. package/dist/components/feedback/progress/index.d.ts +5 -0
  264. package/dist/components/feedback/progress/index.js +26 -0
  265. package/dist/components/feedback/tooltip/IProps.d.ts +6 -0
  266. package/dist/components/feedback/tooltip/IProps.js +1 -0
  267. package/dist/components/feedback/tooltip/index.d.ts +5 -0
  268. package/dist/components/feedback/tooltip/index.js +129 -0
  269. package/dist/components/form/button/IProps.d.ts +10 -0
  270. package/dist/components/form/button/IProps.js +1 -0
  271. package/dist/components/form/button/index.d.ts +5 -0
  272. package/dist/components/form/button/index.js +41 -0
  273. package/dist/components/form/button-action/IProps.d.ts +8 -0
  274. package/dist/components/form/button-action/IProps.js +1 -0
  275. package/dist/components/form/button-action/index.d.ts +5 -0
  276. package/dist/components/form/button-action/index.js +68 -0
  277. package/dist/components/form/button-group/index.d.ts +7 -0
  278. package/dist/components/form/button-group/index.js +31 -0
  279. package/dist/components/form/checkbox/IProps.d.ts +5 -0
  280. package/dist/components/form/checkbox/IProps.js +1 -0
  281. package/dist/components/form/checkbox/index.d.ts +5 -0
  282. package/dist/components/form/checkbox/index.js +24 -0
  283. package/dist/components/form/date-picker/DATE.d.ts +12 -0
  284. package/dist/components/form/date-picker/DATE.js +27 -0
  285. package/dist/components/form/date-picker/Props.d.ts +10 -0
  286. package/dist/components/form/date-picker/Props.js +1 -0
  287. package/dist/components/form/date-picker/index.d.ts +5 -0
  288. package/dist/components/form/date-picker/index.js +365 -0
  289. package/dist/components/form/input/IProps.d.ts +12 -0
  290. package/dist/components/form/input/IProps.js +1 -0
  291. package/dist/components/form/input/decimal/Decimal.d.ts +4 -0
  292. package/dist/components/form/input/decimal/Decimal.js +54 -0
  293. package/dist/components/form/input/decimal/IProps.d.ts +8 -0
  294. package/dist/components/form/input/decimal/IProps.js +1 -0
  295. package/dist/components/form/input/formatted-decimal/FormattedDecimal.d.ts +4 -0
  296. package/dist/components/form/input/formatted-decimal/FormattedDecimal.js +73 -0
  297. package/dist/components/form/input/formatted-decimal/IProps.d.ts +12 -0
  298. package/dist/components/form/input/formatted-decimal/IProps.js +1 -0
  299. package/dist/components/form/input/index.d.ts +15 -0
  300. package/dist/components/form/input/index.js +152 -0
  301. package/dist/components/form/input/otp/IProps.d.ts +6 -0
  302. package/dist/components/form/input/otp/IProps.js +1 -0
  303. package/dist/components/form/input/otp/Otp.d.ts +7 -0
  304. package/dist/components/form/input/otp/Otp.js +122 -0
  305. package/dist/components/form/input/phone/IProps.d.ts +11 -0
  306. package/dist/components/form/input/phone/IProps.js +1 -0
  307. package/dist/components/form/input/phone/Phone.d.ts +4 -0
  308. package/dist/components/form/input/phone/Phone.js +41 -0
  309. package/dist/components/form/radio/IProps.d.ts +12 -0
  310. package/dist/components/form/radio/IProps.js +1 -0
  311. package/dist/components/form/radio/index.d.ts +5 -0
  312. package/dist/components/form/radio/index.js +38 -0
  313. package/dist/components/form/select/Props.d.ts +35 -0
  314. package/dist/components/form/select/Props.js +1 -0
  315. package/dist/components/form/select/index.d.ts +5 -0
  316. package/dist/components/form/select/index.js +312 -0
  317. package/dist/components/form/switch/IProps.d.ts +5 -0
  318. package/dist/components/form/switch/IProps.js +1 -0
  319. package/dist/components/form/switch/index.d.ts +5 -0
  320. package/dist/components/form/switch/index.js +36 -0
  321. package/dist/components/form/text-editor/IProps.d.ts +18 -0
  322. package/dist/components/form/text-editor/IProps.js +1 -0
  323. package/dist/components/form/text-editor/index.d.ts +5 -0
  324. package/dist/components/form/text-editor/index.js +300 -0
  325. package/dist/components/form/upload/Buttons.d.ts +8 -0
  326. package/dist/components/form/upload/Buttons.js +27 -0
  327. package/dist/components/form/upload/Dropzone.d.ts +10 -0
  328. package/dist/components/form/upload/Dropzone.js +55 -0
  329. package/dist/components/form/upload/List.d.ts +12 -0
  330. package/dist/components/form/upload/List.js +21 -0
  331. package/dist/components/form/upload/Props.d.ts +16 -0
  332. package/dist/components/form/upload/Props.js +1 -0
  333. package/dist/components/form/upload/index.d.ts +9 -0
  334. package/dist/components/form/upload/index.js +184 -0
  335. package/dist/components/icons/Compiler.d.ts +9 -0
  336. package/dist/components/icons/Compiler.js +156 -0
  337. package/dist/components/icons/index.d.ts +10 -0
  338. package/dist/components/icons/index.js +6 -0
  339. package/dist/components/layout/Footer.d.ts +3 -0
  340. package/dist/components/layout/Footer.js +8 -0
  341. package/dist/components/layout/Header.d.ts +4 -0
  342. package/dist/components/layout/Header.js +8 -0
  343. package/dist/components/layout/IProps.d.ts +20 -0
  344. package/dist/components/layout/IProps.js +1 -0
  345. package/dist/components/layout/LSider.d.ts +4 -0
  346. package/dist/components/layout/LSider.js +53 -0
  347. package/dist/components/layout/Main.d.ts +4 -0
  348. package/dist/components/layout/Main.js +4 -0
  349. package/dist/components/layout/RSider.d.ts +3 -0
  350. package/dist/components/layout/RSider.js +13 -0
  351. package/dist/components/layout/Section.d.ts +4 -0
  352. package/dist/components/layout/Section.js +10 -0
  353. package/dist/components/layout/index.d.ts +12 -0
  354. package/dist/components/layout/index.js +32 -0
  355. package/dist/components/navigation/breadcrumb/IProps.d.ts +3 -0
  356. package/dist/components/navigation/breadcrumb/IProps.js +1 -0
  357. package/dist/components/navigation/breadcrumb/index.d.ts +5 -0
  358. package/dist/components/navigation/breadcrumb/index.js +8 -0
  359. package/dist/components/navigation/menu/IProps.d.ts +14 -0
  360. package/dist/components/navigation/menu/IProps.js +1 -0
  361. package/dist/components/navigation/menu/index.d.ts +5 -0
  362. package/dist/components/navigation/menu/index.js +89 -0
  363. package/dist/components/navigation/pagination/IProps.d.ts +8 -0
  364. package/dist/components/navigation/pagination/IProps.js +1 -0
  365. package/dist/components/navigation/pagination/index.d.ts +5 -0
  366. package/dist/components/navigation/pagination/index.js +74 -0
  367. package/dist/components/navigation/steps/IProps.d.ts +16 -0
  368. package/dist/components/navigation/steps/IProps.js +1 -0
  369. package/dist/components/navigation/steps/index.d.ts +5 -0
  370. package/dist/components/navigation/steps/index.js +102 -0
  371. package/dist/libs/core/application/contexts/Config.d.ts +26 -0
  372. package/dist/libs/core/application/contexts/Config.js +20 -0
  373. package/dist/libs/core/application/contexts/Language.d.ts +7 -0
  374. package/dist/libs/core/application/contexts/Language.js +7 -0
  375. package/dist/libs/core/application/contexts/Loading.d.ts +11 -0
  376. package/dist/libs/core/application/contexts/Loading.js +13 -0
  377. package/dist/libs/core/application/contexts/Notification.d.ts +25 -0
  378. package/dist/libs/core/application/contexts/Notification.js +29 -0
  379. package/dist/libs/core/application/contexts/index.d.ts +5 -0
  380. package/dist/libs/core/application/contexts/index.js +5 -0
  381. package/dist/libs/core/application/hooks/index.d.ts +41 -0
  382. package/dist/libs/core/application/hooks/index.js +17 -0
  383. package/dist/libs/core/application/hooks/useNotification.d.ts +16 -0
  384. package/dist/libs/core/application/hooks/useNotification.js +23 -0
  385. package/dist/libs/core/application/hooks/useTranslation.d.ts +9 -0
  386. package/dist/libs/core/application/hooks/useTranslation.js +25 -0
  387. package/dist/libs/core/application/hooks/useValidation.d.ts +7 -0
  388. package/dist/libs/core/application/hooks/useValidation.js +151 -0
  389. package/dist/libs/core/application/locales/index.d.ts +4 -0
  390. package/dist/libs/core/application/locales/index.js +3 -0
  391. package/dist/libs/core/application/locales/kanban-board/IKanbanBoardLocale.d.ts +5 -0
  392. package/dist/libs/core/application/locales/kanban-board/IKanbanBoardLocale.js +1 -0
  393. package/dist/libs/core/application/locales/kanban-board/en.d.ts +3 -0
  394. package/dist/libs/core/application/locales/kanban-board/en.js +5 -0
  395. package/dist/libs/core/application/locales/kanban-board/tr.d.ts +3 -0
  396. package/dist/libs/core/application/locales/kanban-board/tr.js +5 -0
  397. package/dist/libs/core/application/locales/notification/INotificationLocale.d.ts +59 -0
  398. package/dist/libs/core/application/locales/notification/INotificationLocale.js +1 -0
  399. package/dist/libs/core/application/locales/notification/en.d.ts +3 -0
  400. package/dist/libs/core/application/locales/notification/en.js +85 -0
  401. package/dist/libs/core/application/locales/notification/tr.d.ts +3 -0
  402. package/dist/libs/core/application/locales/notification/tr.js +85 -0
  403. package/dist/libs/core/application/locales/table/ITableLocale.d.ts +18 -0
  404. package/dist/libs/core/application/locales/table/ITableLocale.js +1 -0
  405. package/dist/libs/core/application/locales/table/en.d.ts +3 -0
  406. package/dist/libs/core/application/locales/table/en.js +22 -0
  407. package/dist/libs/core/application/locales/table/tr.d.ts +3 -0
  408. package/dist/libs/core/application/locales/table/tr.js +22 -0
  409. package/dist/libs/infrastructure/shared/DATE.d.ts +74 -0
  410. package/dist/libs/infrastructure/shared/DATE.js +148 -0
  411. package/dist/libs/infrastructure/shared/Enums.d.ts +18 -0
  412. package/dist/libs/infrastructure/shared/Enums.js +21 -0
  413. package/dist/libs/infrastructure/shared/NUMBER.d.ts +8 -0
  414. package/dist/libs/infrastructure/shared/NUMBER.js +10 -0
  415. package/dist/libs/infrastructure/shared/PHONE.d.ts +8 -0
  416. package/dist/libs/infrastructure/shared/PHONE.js +126 -0
  417. package/dist/libs/infrastructure/shared/Utils.d.ts +20 -0
  418. package/dist/libs/infrastructure/shared/Utils.js +349 -0
  419. package/dist/libs/infrastructure/shared/_old_DATE.d.ts +28 -0
  420. package/dist/libs/infrastructure/shared/_old_DATE.js +68 -0
  421. package/dist/libs/infrastructure/types/IGlobalProps.d.ts +183 -0
  422. package/dist/libs/infrastructure/types/IGlobalProps.js +1 -0
  423. package/dist/libs/infrastructure/types/index.d.ts +155 -0
  424. package/dist/libs/infrastructure/types/index.js +1 -0
  425. package/package.json +48 -0
@@ -0,0 +1,54 @@
1
+ "use client";
2
+ import React, { useEffect, useRef } from "react";
3
+ import ReactDOM from "react-dom";
4
+ const FilterPopup = ({ children, refs, states, coordinate }) => {
5
+ // refs
6
+ const _arTableFilterPopup = useRef(null);
7
+ // methods
8
+ const handleClickOutSide = (event) => {
9
+ const target = event.target;
10
+ const clickedInsidePopup = _arTableFilterPopup.current && _arTableFilterPopup.current.contains(target);
11
+ const isOneOfButtons = refs.buttons.current.some((button) => button === target || button?.contains(target));
12
+ if (!clickedInsidePopup && !isOneOfButtons)
13
+ handleClose();
14
+ };
15
+ const handleKeys = (event) => {
16
+ const key = event.key;
17
+ if (key === "Escape")
18
+ states.open.set(false);
19
+ };
20
+ const handleOpen = () => states.open.set(true);
21
+ const handleClose = () => states.open.set(false);
22
+ // useEffects
23
+ useEffect(() => {
24
+ const currentButtons = refs.buttons.current;
25
+ currentButtons.forEach((button) => {
26
+ if (button)
27
+ button.addEventListener("click", handleOpen);
28
+ });
29
+ return () => {
30
+ currentButtons.forEach((button) => {
31
+ if (button)
32
+ button.removeEventListener("click", handleOpen);
33
+ });
34
+ };
35
+ }, [refs.buttons]);
36
+ useEffect(() => {
37
+ const tableContentRef = refs.tableContent.current;
38
+ if (tableContentRef) {
39
+ tableContentRef.addEventListener("scroll", handleClose);
40
+ }
41
+ document.addEventListener("click", handleClickOutSide);
42
+ document.addEventListener("keydown", handleKeys);
43
+ return () => {
44
+ document.removeEventListener("click", handleClickOutSide);
45
+ document.removeEventListener("keydown", handleKeys);
46
+ if (tableContentRef) {
47
+ tableContentRef.removeEventListener("scroll", handleClose);
48
+ }
49
+ };
50
+ }, []);
51
+ return (states.open.get &&
52
+ ReactDOM.createPortal(React.createElement("div", { ref: _arTableFilterPopup, className: "ar-table-filter-popup", style: { top: coordinate.y, left: coordinate.x } }, children), document.body));
53
+ };
54
+ export default FilterPopup;
@@ -0,0 +1,2 @@
1
+ declare function ExtractKey<T>(key: unknown): keyof T | null;
2
+ export { ExtractKey };
@@ -0,0 +1,10 @@
1
+ function ExtractKey(key) {
2
+ if (!key)
3
+ return null;
4
+ if (typeof key !== "object")
5
+ return key;
6
+ if ("field" in key)
7
+ return key.field;
8
+ return null;
9
+ }
10
+ export { ExtractKey };
@@ -0,0 +1,99 @@
1
+ import React from "react";
2
+ import { Errors, MimeTypes, TableColumnProps } from "../../../libs/infrastructure/types";
3
+ import { IChildrenProps } from "../../../libs/infrastructure/types/IGlobalProps";
4
+ import { FilterOperator } from "../../../libs/infrastructure/shared/Enums";
5
+ export type Operator = "Contains" | "DoesNotContains" | "Equals" | "DoesNotEquals" | "BeginsWith" | "EndsWith" | "Blank" | "NotBlank";
6
+ export type FilterValue = {
7
+ value: string | number | boolean;
8
+ operator: FilterOperator;
9
+ };
10
+ export type Actions = {
11
+ import?: ImportActionType;
12
+ export?: ExportActionType;
13
+ create?: CreateActionType;
14
+ delete?: DeleteActionType;
15
+ };
16
+ export type Sort<T> = {
17
+ key: keyof T;
18
+ direction: "asc" | "desc" | null;
19
+ };
20
+ export type SearchedParam = {
21
+ [key: string]: FilterValue | FilterValue[];
22
+ };
23
+ export type Config<T extends object> = {
24
+ locale?: Intl.LocalesArgument;
25
+ isServerSide?: boolean;
26
+ isProperties?: boolean;
27
+ isSearchable?: boolean;
28
+ scroll?: {
29
+ maxHeight: number;
30
+ };
31
+ subrow?: {
32
+ openAutomatically?: boolean;
33
+ selector?: string;
34
+ button?: boolean;
35
+ render?: {
36
+ styles: React.CSSProperties;
37
+ element: (item: T[]) => React.JSX.Element;
38
+ };
39
+ };
40
+ dnd?: {
41
+ renderItem: React.JSX.Element;
42
+ };
43
+ isTreeView?: boolean;
44
+ validation?: {
45
+ errors: Errors<T>;
46
+ getChangeData?: (items: T[]) => void;
47
+ };
48
+ };
49
+ type ImportActionType = {
50
+ tooltip: string;
51
+ title?: string;
52
+ message?: string;
53
+ buttonText?: string;
54
+ allowedTypes?: MimeTypes[];
55
+ prefixItem?: React.ReactNode;
56
+ suffixItem?: React.ReactNode;
57
+ onClick: (formData: FormData | undefined, files: File[], base64: string[]) => void;
58
+ };
59
+ type ExportActionType = {
60
+ tooltip: string;
61
+ title?: string;
62
+ message?: string;
63
+ content?: React.JSX.Element;
64
+ onClick: () => void;
65
+ };
66
+ type CreateActionType = {
67
+ tooltip: string;
68
+ onClick: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
69
+ };
70
+ type DeleteActionType = {
71
+ tooltip: string;
72
+ title?: string;
73
+ message?: string;
74
+ onClick: () => void;
75
+ };
76
+ interface IProps<T extends object> extends IChildrenProps {
77
+ trackBy?: (item: T) => string;
78
+ title?: string;
79
+ description?: string;
80
+ data: T[];
81
+ columns: TableColumnProps<T>[];
82
+ actions?: Actions;
83
+ rowBackgroundColor?: (item: T) => string;
84
+ selections?: (selectionItems: T[]) => void;
85
+ selectionDisabled?: (item: T) => boolean;
86
+ previousSelections?: T[];
87
+ sortedParams?: (params: Sort<T>[], query: string) => void;
88
+ searchedParams?: (params: SearchedParam | null, query: string, operator: FilterOperator) => void;
89
+ onEditable?: (item: T, trackByValue: string, currentKey?: keyof T | null) => void;
90
+ onDnD?: (item: T[]) => void;
91
+ pagination?: {
92
+ totalRecords: number;
93
+ perPage: number;
94
+ currentPage?: number;
95
+ onChange?: (currentPage: number, perPage: number) => void;
96
+ };
97
+ config?: Config<T>;
98
+ }
99
+ export default IProps;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,31 @@
1
+ import React, { Dispatch, MutableRefObject, SetStateAction } from "react";
2
+ import { Config, Sort } from "./IProps";
3
+ import { TableColumnProps } from "../../../libs/infrastructure/types";
4
+ interface IProps<T extends object> {
5
+ refs: {
6
+ tableContent: MutableRefObject<HTMLDivElement | null>;
7
+ buttons: MutableRefObject<(HTMLSpanElement | null)[]>;
8
+ };
9
+ states: {
10
+ open: {
11
+ get: boolean;
12
+ set: Dispatch<SetStateAction<boolean>>;
13
+ };
14
+ sort: {
15
+ get: Sort<T>[];
16
+ set: Dispatch<SetStateAction<Sort<T>[]>>;
17
+ currentColumn: TableColumnProps<T> | null;
18
+ };
19
+ };
20
+ methods: {
21
+ handleScroll: () => void;
22
+ };
23
+ coordinate: {
24
+ x: number;
25
+ y: number;
26
+ };
27
+ config: Config<T>;
28
+ }
29
+ declare function PropertiesPopup<T extends object>({ refs, states, methods, coordinate, config }: IProps<T>): false | React.ReactPortal;
30
+ declare const _default: typeof PropertiesPopup;
31
+ export default _default;
@@ -0,0 +1,90 @@
1
+ "use client";
2
+ import React, { memo, useEffect, useMemo, useRef } from "react";
3
+ import ReactDOM from "react-dom";
4
+ import { ARIcon } from "../../icons";
5
+ import { ExtractKey } from "./Helpers";
6
+ import { useTranslation } from "../../../libs/core/application/hooks";
7
+ function PropertiesPopup({ refs, states, methods, coordinate, config }) {
8
+ // refs
9
+ const _arTablePropertiesPopup = useRef(null);
10
+ // hooks
11
+ const { t } = useTranslation(String(config.locale ?? "tr"));
12
+ // methods
13
+ const handleClickOutSide = (event) => {
14
+ const target = event.target;
15
+ const clickedInsidePopup = _arTablePropertiesPopup.current && _arTablePropertiesPopup.current.contains(target);
16
+ const isOneOfButtons = target.closest('[data-properties-button="true"]');
17
+ if (!clickedInsidePopup && !isOneOfButtons)
18
+ handleClose();
19
+ };
20
+ const handleSort = useMemo(() => {
21
+ return (columnKey, direction) => {
22
+ if (!columnKey)
23
+ return;
24
+ states.sort.set(() => [{ key: columnKey, direction }]);
25
+ };
26
+ }, [states.sort]);
27
+ const handleKeys = (event) => {
28
+ const key = event.key;
29
+ if (key === "Escape")
30
+ handleClose();
31
+ };
32
+ const handleOpen = () => {
33
+ states.open.set(true);
34
+ methods.handleScroll();
35
+ };
36
+ const handleClose = () => {
37
+ states.open.set(false);
38
+ methods.handleScroll();
39
+ };
40
+ // useEffects
41
+ useEffect(() => {
42
+ const currentButtons = refs.buttons.current;
43
+ currentButtons.forEach((button) => {
44
+ if (button)
45
+ button.addEventListener("click", handleOpen);
46
+ });
47
+ return () => {
48
+ currentButtons.forEach((button) => {
49
+ if (button)
50
+ button.removeEventListener("click", handleOpen);
51
+ });
52
+ };
53
+ }, [refs.buttons]);
54
+ useEffect(() => {
55
+ const tableContentRef = refs.tableContent.current;
56
+ if (tableContentRef) {
57
+ tableContentRef.addEventListener("scroll", handleClose);
58
+ }
59
+ document.addEventListener("click", handleClickOutSide);
60
+ document.addEventListener("keydown", handleKeys);
61
+ return () => {
62
+ document.removeEventListener("click", handleClickOutSide);
63
+ document.removeEventListener("keydown", handleKeys);
64
+ if (tableContentRef) {
65
+ tableContentRef.removeEventListener("scroll", handleClose);
66
+ }
67
+ };
68
+ }, []);
69
+ const currentKey = ExtractKey(states.sort.currentColumn?.key);
70
+ const currentSort = states.sort.get?.find((s) => s.key === currentKey);
71
+ return (states.open.get &&
72
+ ReactDOM.createPortal(React.createElement("div", { ref: _arTablePropertiesPopup, className: "ar-table-properties-popup", style: { top: coordinate.y, left: coordinate.x } },
73
+ React.createElement("ul", null,
74
+ currentSort && (!currentSort.direction || currentSort.direction === "desc") && (React.createElement("li", { onClick: () => handleSort(currentKey, "asc") },
75
+ React.createElement("span", null,
76
+ React.createElement(ARIcon, { icon: "ArrowUp" })),
77
+ React.createElement("span", null, t("Table.Properties.Asc.Text")))),
78
+ currentSort && (!currentSort.direction || currentSort.direction === "asc") && (React.createElement("li", { onClick: () => handleSort(currentKey, "desc") },
79
+ React.createElement("span", null,
80
+ React.createElement(ARIcon, { icon: "ArrowDown" })),
81
+ React.createElement("span", null, t("Table.Properties.Desc.Text")))),
82
+ currentSort && currentSort.direction && (React.createElement("li", { onClick: () => {
83
+ states.sort.set((prev) => prev.filter((s) => s.key !== currentKey));
84
+ states.open.set(false);
85
+ } },
86
+ React.createElement("span", null,
87
+ React.createElement(ARIcon, { icon: "ChevronExpand" })),
88
+ React.createElement("span", null, t("Table.Properties.ClearSort.Text")))))), document.body));
89
+ }
90
+ export default memo(PropertiesPopup);
@@ -0,0 +1,34 @@
1
+ import React, { Dispatch, SetStateAction } from "react";
2
+ import { Config, Sort } from "./IProps";
3
+ import { TableColumnProps } from "../../../libs/infrastructure/types";
4
+ declare const MemoizedTHeadCell: <T extends object>({ refs, states, methods, columns, config, }: {
5
+ refs: {
6
+ propertiesButton: React.MutableRefObject<(HTMLSpanElement | null)[]>;
7
+ };
8
+ states: {
9
+ open: {
10
+ get: boolean;
11
+ set: Dispatch<SetStateAction<boolean>>;
12
+ };
13
+ sort: {
14
+ get: Sort<T>[];
15
+ set: Dispatch<SetStateAction<Sort<T>[]>>;
16
+ };
17
+ sortCurrentColumn: {
18
+ set: React.Dispatch<React.SetStateAction<TableColumnProps<T> | null>>;
19
+ };
20
+ propertiesButtonCoordinate: {
21
+ set: React.Dispatch<React.SetStateAction<{
22
+ x: number;
23
+ y: number;
24
+ }>>;
25
+ };
26
+ };
27
+ methods: {
28
+ handleScroll: () => void;
29
+ };
30
+ columns: TableColumnProps<T>[];
31
+ config: Config<T>;
32
+ }) => React.JSX.Element;
33
+ declare const THeadCell: typeof MemoizedTHeadCell;
34
+ export default THeadCell;
@@ -0,0 +1,67 @@
1
+ import React, { memo } from "react";
2
+ import Button from "../../form/button";
3
+ import { ARIcon } from "../../icons";
4
+ import { ExtractKey } from "./Helpers";
5
+ const MemoizedTHeadCell = function ({ refs, states, methods, columns, config, }) {
6
+ return (React.createElement(React.Fragment, null, columns.map((c, cIndex) => {
7
+ const { isProperties = true } = c.config ?? {};
8
+ // Orijinal c.key araması optimize edildi ve string formatına güvenli şekilde çekildi
9
+ const columnKeyString = String(ExtractKey(c.key) ?? cIndex);
10
+ const _direction = states.sort.get.find((s) => s.key === columnKeyString)?.direction;
11
+ let _className = [];
12
+ if (c.config?.sticky)
13
+ _className.push(`sticky-${c.config.sticky}`);
14
+ if (!c.config?.width)
15
+ _className.push("min-w");
16
+ if (c.config?.alignContent) {
17
+ _className.push(`align-content-${c.config.alignContent}`);
18
+ }
19
+ return (React.createElement("th", { key: `column-head-${columnKeyString}`, ...(_className.length > 0 && {
20
+ className: `${_className.join(" ")}`,
21
+ }), ...(c.config?.width
22
+ ? {
23
+ style: { minWidth: c.config.width, maxWidth: c.config.width },
24
+ }
25
+ : { style: {} }), ...(c.config?.sticky && {
26
+ "data-sticky-position": c.config.sticky,
27
+ }) },
28
+ React.createElement("div", null,
29
+ React.createElement("span", { style: { fontWeight: 500 } },
30
+ (_direction === "asc" || _direction === "desc") && (React.createElement("span", null,
31
+ _direction === "asc" && React.createElement(ARIcon, { icon: "ArrowUp" }),
32
+ _direction === "desc" && React.createElement(ARIcon, { icon: "ArrowDown" }))),
33
+ c.title),
34
+ config.isProperties && isProperties && (React.createElement("span", { ref: (element) => {
35
+ if (element) {
36
+ refs.propertiesButton.current[cIndex] = element;
37
+ }
38
+ }, className: "properties-field", "data-properties-button": "true", onClick: (event) => {
39
+ event.preventDefault();
40
+ event.stopPropagation();
41
+ const rect = event.currentTarget.getBoundingClientRect();
42
+ const screenCenterX = window.innerWidth / 2;
43
+ const coordinateX = rect.x > screenCenterX ? rect.x + rect.width - 225 : rect.x;
44
+ const coordinateY = rect.y + rect.height;
45
+ states.sortCurrentColumn.set(c);
46
+ states.propertiesButtonCoordinate.set({
47
+ x: coordinateX,
48
+ y: coordinateY,
49
+ });
50
+ states.sort.set((prev) => {
51
+ const key = ExtractKey(c.key);
52
+ const index = prev.findIndex((s) => s.key === key);
53
+ if (index === -1)
54
+ return [...prev, { key, direction: null }];
55
+ return prev;
56
+ });
57
+ states.open.set(true);
58
+ methods.handleScroll();
59
+ } },
60
+ React.createElement(Button, { variant: "borderless", icon: {
61
+ element: React.createElement(ARIcon, { size: 16, icon: "ThreeDotsVertical", fill: "var(--dark)", strokeWidth: 0 }),
62
+ } }))))));
63
+ })));
64
+ };
65
+ // React.memo kullanımı sırasında generic tipi koruyoruz.
66
+ const THeadCell = memo(MemoizedTHeadCell);
67
+ export default THeadCell;
@@ -0,0 +1,12 @@
1
+ import React from "react";
2
+ import { TableColumnProps } from "../../../../libs/infrastructure/types";
3
+ import { Config } from "../IProps";
4
+ interface IProps<T extends object> {
5
+ c: TableColumnProps<T>;
6
+ item: T;
7
+ trackByValue: string;
8
+ onEditable: (item: T, trackByValue: string, currentKey?: keyof T | null) => void;
9
+ config: Config<T>;
10
+ }
11
+ declare const Editable: <T extends object>({ c, item, trackByValue, onEditable, config }: IProps<T>) => React.JSX.Element | null;
12
+ export default Editable;
@@ -0,0 +1,59 @@
1
+ "use client";
2
+ import React, { useCallback, useEffect, useState } from "react";
3
+ import Input from "../../../form/input";
4
+ import DatePicker from "../../../form/date-picker";
5
+ import Select from "../../../form/select";
6
+ import { ExtractKey } from "../Helpers";
7
+ import Checkbox from "../../../form/checkbox";
8
+ const Editable = function ({ c, item, trackByValue, onEditable, config }) {
9
+ // refs
10
+ // variables
11
+ const key = c.key;
12
+ const itemValue = item[c.key];
13
+ const selectItem = c.editable?.(item)?.options?.find((x) => x.value === itemValue);
14
+ const selectItems = Array.isArray(itemValue)
15
+ ? c.editable?.(item)?.options?.filter((x) => itemValue.includes(x.value))
16
+ : [];
17
+ const validation = config.validation;
18
+ const _vText = validation?.errors?.[`${c.key}_${trackByValue}`];
19
+ // states
20
+ const [_value, setValue] = useState(itemValue);
21
+ // methods
22
+ const handleChange = useCallback((value, set = true) => {
23
+ if (set)
24
+ setValue(value);
25
+ onEditable({ ...item, [key]: value }, trackByValue, ExtractKey(c.key));
26
+ }, [item]);
27
+ // useEffects
28
+ useEffect(() => setValue(itemValue), [itemValue]);
29
+ // return
30
+ switch (c.editable?.(item)?.type) {
31
+ case "string":
32
+ case "number":
33
+ return (React.createElement(Input, { variant: "borderless", value: String(_value ?? ""), onChange: (event) => {
34
+ handleChange(c.editable?.(item)?.type === "number" ? Number(event.target.value) : event.target.value);
35
+ }, validation: { text: _vText }, ...(c.editable?.(item).where ? { disabled: c.editable?.(item).where } : {}) }));
36
+ case "boolean":
37
+ return (React.createElement(Checkbox, { variant: "borderless", color: "blue", checked: Boolean(_value), onChange: (event) => {
38
+ const checked = event.target.checked;
39
+ setValue(checked);
40
+ onEditable({
41
+ ...item,
42
+ [key]: checked,
43
+ }, trackByValue, ExtractKey(c.key));
44
+ }, validation: { text: _vText }, ...(c.editable?.(item).where ? { disabled: c.editable?.(item).where } : {}) }));
45
+ case "decimal":
46
+ return (React.createElement(Input.Decimal, { variant: "borderless", name: c.key, value: String(_value ?? ""), onChange: (event) => handleChange(event.target.value), validation: { text: _vText }, locale: config.locale, ...(c.editable?.(item).where ? { disabled: c.editable?.(item).where } : {}) }));
47
+ case "input-formatted-decimal":
48
+ return (React.createElement(Input.FormattedDecimal, { variant: "borderless", name: c.key, value: String(_value ?? ""), onChange: (event) => handleChange(event.target.value), validation: { text: _vText }, locale: config.locale, ...(c.editable?.(item).where ? { disabled: c.editable?.(item).where } : {}) }));
49
+ case "date-picker":
50
+ return (React.createElement(DatePicker, { variant: "borderless", value: String(_value ?? ""), onChange: (value) => handleChange(value), validation: { text: _vText }, ...(c.editable?.(item).where ? { disabled: c.editable?.(item).where } : {}) }));
51
+ case "single-select":
52
+ return (React.createElement(Select, { variant: "borderless", value: selectItem, options: c.editable?.(item).options, onClick: async () => await c.editable?.(item)?.method?.(), onChange: (option) => handleChange(option?.value, false), validation: { text: _vText }, ...(c.editable?.(item).where ? { disabled: c.editable?.(item).where } : {}) }));
53
+ case "multiple-select":
54
+ return (React.createElement(Select, { variant: "borderless", value: selectItems, options: c.editable?.(item).options, onClick: async () => await c.editable?.(item)?.method?.(), onChange: (options) => handleChange(options.map((option) => option.value), false), validation: { text: _vText }, multiple: true, ...(c.editable?.(item).where ? { disabled: c.editable?.(item).where } : {}) }));
55
+ default:
56
+ return null;
57
+ }
58
+ };
59
+ export default Editable;
@@ -0,0 +1,36 @@
1
+ import React, { Dispatch, SetStateAction } from "react";
2
+ import { Config } from "../IProps";
3
+ import { TableColumnProps } from "../../../../libs/infrastructure/types";
4
+ interface IProps<T extends object> {
5
+ data: T[];
6
+ columns: TableColumnProps<T>[];
7
+ refs: {
8
+ _checkboxItems: React.MutableRefObject<(HTMLInputElement | null)[]>;
9
+ _selectionItems: React.MutableRefObject<T[]>;
10
+ };
11
+ states: {
12
+ setSelectAll: {
13
+ get: boolean;
14
+ set: Dispatch<SetStateAction<boolean>>;
15
+ };
16
+ showSubitems: {
17
+ get: {
18
+ [key: string]: boolean;
19
+ };
20
+ set: Dispatch<React.SetStateAction<{
21
+ [key: string]: boolean;
22
+ }>>;
23
+ };
24
+ };
25
+ methods: {
26
+ trackBy?: (item: T) => string;
27
+ selections?: (selectionItems: T[]) => void;
28
+ selectionDisabled?: (item: T) => boolean;
29
+ onDnD?: (item: T[]) => void;
30
+ onEditable?: (item: T, trackByValue: string, currentKey?: keyof T | null) => void;
31
+ rowBackgroundColor?: (item: T) => string;
32
+ };
33
+ config: Config<T>;
34
+ }
35
+ declare const _default: <T extends object>(props: IProps<T>) => React.JSX.Element;
36
+ export default _default;