@ayasofyazilim/ui 0.0.0 → 0.0.2

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 (667) hide show
  1. package/dist/aria/index.js +2 -0
  2. package/dist/aria/index.js.map +1 -0
  3. package/dist/aria/number-field.js +46 -0
  4. package/dist/aria/number-field.js.map +1 -0
  5. package/dist/components/accordion.js +66 -0
  6. package/dist/components/accordion.js.map +1 -0
  7. package/dist/components/alert-dialog.js +148 -0
  8. package/dist/components/alert-dialog.js.map +1 -0
  9. package/dist/components/alert.js +69 -0
  10. package/dist/components/alert.js.map +1 -0
  11. package/dist/components/aspect-ratio.js +12 -0
  12. package/dist/components/aspect-ratio.js.map +1 -0
  13. package/dist/components/avatar.js +55 -0
  14. package/dist/components/avatar.js.map +1 -0
  15. package/dist/components/badge.js +62 -0
  16. package/dist/components/badge.js.map +1 -0
  17. package/dist/components/breadcrumb.js +104 -0
  18. package/dist/components/breadcrumb.js.map +1 -0
  19. package/dist/components/button-group.js +77 -0
  20. package/dist/components/button-group.js.map +1 -0
  21. package/dist/components/button.js +56 -0
  22. package/dist/components/button.js.map +1 -0
  23. package/dist/components/calendar.js +196 -0
  24. package/dist/components/calendar.js.map +1 -0
  25. package/dist/components/card.js +91 -0
  26. package/dist/components/card.js.map +1 -0
  27. package/dist/components/carousel.js +200 -0
  28. package/dist/components/carousel.js.map +1 -0
  29. package/dist/components/chart.js +250 -0
  30. package/dist/components/chart.js.map +1 -0
  31. package/dist/components/checkbox.js +33 -0
  32. package/dist/components/checkbox.js.map +1 -0
  33. package/dist/components/collapsible.js +36 -0
  34. package/dist/components/collapsible.js.map +1 -0
  35. package/dist/components/command.js +178 -0
  36. package/dist/components/command.js.map +1 -0
  37. package/dist/components/context-menu.js +225 -0
  38. package/dist/components/context-menu.js.map +1 -0
  39. package/dist/components/dialog.js +139 -0
  40. package/dist/components/dialog.js.map +1 -0
  41. package/dist/components/drawer.js +130 -0
  42. package/dist/components/drawer.js.map +1 -0
  43. package/dist/components/dropdown-menu.js +234 -0
  44. package/dist/components/dropdown-menu.js.map +1 -0
  45. package/dist/components/empty.js +100 -0
  46. package/dist/components/empty.js.map +1 -0
  47. package/dist/components/field.js +231 -0
  48. package/dist/components/field.js.map +1 -0
  49. package/dist/components/form.js +124 -0
  50. package/dist/components/form.js.map +1 -0
  51. package/dist/components/hover-card.js +40 -0
  52. package/dist/components/hover-card.js.map +1 -0
  53. package/dist/components/input-group.js +156 -0
  54. package/dist/components/input-group.js.map +1 -0
  55. package/dist/components/input-otp.js +68 -0
  56. package/dist/components/input-otp.js.map +1 -0
  57. package/dist/components/input.js +22 -0
  58. package/dist/components/input.js.map +1 -0
  59. package/dist/components/item.js +188 -0
  60. package/dist/components/item.js.map +1 -0
  61. package/dist/components/kbd.js +32 -0
  62. package/dist/components/kbd.js.map +1 -0
  63. package/dist/components/label.js +24 -0
  64. package/dist/components/label.js.map +1 -0
  65. package/dist/components/menubar.js +253 -0
  66. package/dist/components/menubar.js.map +1 -0
  67. package/dist/components/navigation-menu.js +171 -0
  68. package/dist/components/navigation-menu.js.map +1 -0
  69. package/dist/components/pagination.js +125 -0
  70. package/dist/components/pagination.js.map +1 -0
  71. package/dist/components/popover.js +82 -0
  72. package/dist/components/popover.js.map +1 -0
  73. package/dist/components/progress.js +33 -0
  74. package/dist/components/progress.js.map +1 -0
  75. package/dist/components/radio-group.js +47 -0
  76. package/dist/components/radio-group.js.map +1 -0
  77. package/dist/components/resizable.js +50 -0
  78. package/dist/components/resizable.js.map +1 -0
  79. package/dist/components/scroll-area.js +62 -0
  80. package/dist/components/scroll-area.js.map +1 -0
  81. package/dist/components/select.js +173 -0
  82. package/dist/components/select.js.map +1 -0
  83. package/dist/components/separator.js +28 -0
  84. package/dist/components/separator.js.map +1 -0
  85. package/dist/components/sheet.js +129 -0
  86. package/dist/components/sheet.js.map +1 -0
  87. package/dist/components/sidebar.js +759 -0
  88. package/dist/components/sidebar.js.map +1 -0
  89. package/dist/components/skeleton.js +16 -0
  90. package/dist/components/skeleton.js.map +1 -0
  91. package/dist/components/slider.js +65 -0
  92. package/dist/components/slider.js.map +1 -0
  93. package/dist/components/sonner.js +40 -0
  94. package/dist/components/sonner.js.map +1 -0
  95. package/dist/components/spinner.js +18 -0
  96. package/dist/components/spinner.js.map +1 -0
  97. package/dist/components/stepper.js +220 -0
  98. package/dist/components/stepper.js.map +1 -0
  99. package/dist/components/switch.js +33 -0
  100. package/dist/components/switch.js.map +1 -0
  101. package/dist/components/table.js +131 -0
  102. package/dist/components/table.js.map +1 -0
  103. package/dist/components/tabs.js +69 -0
  104. package/dist/components/tabs.js.map +1 -0
  105. package/dist/components/textarea.js +19 -0
  106. package/dist/components/textarea.js.map +1 -0
  107. package/dist/components/toggle-group.js +70 -0
  108. package/dist/components/toggle-group.js.map +1 -0
  109. package/dist/components/toggle.js +45 -0
  110. package/dist/components/toggle.js.map +1 -0
  111. package/dist/components/tooltip.js +65 -0
  112. package/dist/components/tooltip.js.map +1 -0
  113. package/dist/custom/action-button.js +38 -0
  114. package/dist/custom/action-button.js.map +1 -0
  115. package/dist/custom/async-select.js +249 -0
  116. package/dist/custom/async-select.js.map +1 -0
  117. package/dist/custom/awesome-not-found.js +113 -0
  118. package/dist/custom/awesome-not-found.js.map +1 -0
  119. package/dist/custom/charts/area-chart.js +125 -0
  120. package/dist/custom/charts/area-chart.js.map +1 -0
  121. package/dist/custom/charts/bar-chart.js +232 -0
  122. package/dist/custom/charts/bar-chart.js.map +1 -0
  123. package/dist/custom/charts/chart-card.js +71 -0
  124. package/dist/custom/charts/chart-card.js.map +1 -0
  125. package/dist/custom/charts/index.js +5 -0
  126. package/dist/custom/charts/index.js.map +1 -0
  127. package/dist/custom/charts/pie-chart.js +153 -0
  128. package/dist/custom/charts/pie-chart.js.map +1 -0
  129. package/dist/custom/charts/radar-chart.js +112 -0
  130. package/dist/custom/charts/radar-chart.js.map +1 -0
  131. package/dist/custom/checkbox-tree.js +70 -0
  132. package/dist/custom/checkbox-tree.js.map +1 -0
  133. package/dist/custom/combobox.js +233 -0
  134. package/dist/custom/combobox.js.map +1 -0
  135. package/dist/custom/confirm-dialog.js +90 -0
  136. package/dist/custom/confirm-dialog.js.map +1 -0
  137. package/dist/custom/country-selector.js +151 -0
  138. package/dist/custom/country-selector.js.map +1 -0
  139. package/dist/custom/date-picker/calendar-rac.js +91 -0
  140. package/dist/custom/date-picker/calendar-rac.js.map +1 -0
  141. package/dist/custom/date-picker/datefield-rac.js +77 -0
  142. package/dist/custom/date-picker/datefield-rac.js.map +1 -0
  143. package/dist/custom/date-picker/index.js +251 -0
  144. package/dist/custom/date-picker/index.js.map +1 -0
  145. package/dist/custom/date-picker/types/index.js +1 -0
  146. package/dist/custom/date-picker/types/index.js.map +1 -0
  147. package/dist/custom/date-picker/utils/index.js +30 -0
  148. package/dist/custom/date-picker/utils/index.js.map +1 -0
  149. package/dist/custom/date-picker-old.js +46 -0
  150. package/dist/custom/date-picker-old.js.map +1 -0
  151. package/dist/custom/date-tooltip.js +89 -0
  152. package/dist/custom/date-tooltip.js.map +1 -0
  153. package/dist/custom/document-scanner/consts.js +13 -0
  154. package/dist/custom/document-scanner/consts.js.map +1 -0
  155. package/dist/custom/document-scanner/corner-adjustment/action-buttons.js +24 -0
  156. package/dist/custom/document-scanner/corner-adjustment/action-buttons.js.map +1 -0
  157. package/dist/custom/document-scanner/corner-adjustment/corner-handle.js +44 -0
  158. package/dist/custom/document-scanner/corner-adjustment/corner-handle.js.map +1 -0
  159. package/dist/custom/document-scanner/corner-adjustment/hooks/use-corner-drag.js +60 -0
  160. package/dist/custom/document-scanner/corner-adjustment/hooks/use-corner-drag.js.map +1 -0
  161. package/dist/custom/document-scanner/corner-adjustment/index.js +124 -0
  162. package/dist/custom/document-scanner/corner-adjustment/index.js.map +1 -0
  163. package/dist/custom/document-scanner/corner-adjustment/types.js +1 -0
  164. package/dist/custom/document-scanner/corner-adjustment/types.js.map +1 -0
  165. package/dist/custom/document-scanner/corner-adjustment/utils/clip-path.js +16 -0
  166. package/dist/custom/document-scanner/corner-adjustment/utils/clip-path.js.map +1 -0
  167. package/dist/custom/document-scanner/corner-adjustment/zoom-magnifier.js +85 -0
  168. package/dist/custom/document-scanner/corner-adjustment/zoom-magnifier.js.map +1 -0
  169. package/dist/custom/document-scanner/hooks/use-document-capture.js +61 -0
  170. package/dist/custom/document-scanner/hooks/use-document-capture.js.map +1 -0
  171. package/dist/custom/document-scanner/hooks/use-document-scanner.js +59 -0
  172. package/dist/custom/document-scanner/hooks/use-document-scanner.js.map +1 -0
  173. package/dist/custom/document-scanner/hooks/use-perspective-crop.js +31 -0
  174. package/dist/custom/document-scanner/hooks/use-perspective-crop.js.map +1 -0
  175. package/dist/custom/document-scanner/index.js +229 -0
  176. package/dist/custom/document-scanner/index.js.map +1 -0
  177. package/dist/custom/document-scanner/lib.js +289 -0
  178. package/dist/custom/document-scanner/lib.js.map +1 -0
  179. package/dist/custom/document-scanner/types.js +1 -0
  180. package/dist/custom/document-scanner/types.js.map +1 -0
  181. package/dist/custom/document-scanner/utils/perspective-correction.js +100 -0
  182. package/dist/custom/document-scanner/utils/perspective-correction.js.map +1 -0
  183. package/dist/custom/document-viewer/controllers.js +76 -0
  184. package/dist/custom/document-viewer/controllers.js.map +1 -0
  185. package/dist/custom/document-viewer/index.js +36 -0
  186. package/dist/custom/document-viewer/index.js.map +1 -0
  187. package/dist/custom/document-viewer/renderers/image.js +40 -0
  188. package/dist/custom/document-viewer/renderers/image.js.map +1 -0
  189. package/dist/custom/document-viewer/renderers/index.js +3 -0
  190. package/dist/custom/document-viewer/renderers/index.js.map +1 -0
  191. package/dist/custom/document-viewer/renderers/pdf.js +95 -0
  192. package/dist/custom/document-viewer/renderers/pdf.js.map +1 -0
  193. package/dist/custom/email-input/email.js +184 -0
  194. package/dist/custom/email-input/email.js.map +1 -0
  195. package/dist/custom/email-input/index.js +8 -0
  196. package/dist/custom/email-input/index.js.map +1 -0
  197. package/dist/custom/email-input/types.js +13 -0
  198. package/dist/custom/email-input/types.js.map +1 -0
  199. package/dist/custom/file-uploader.js +389 -0
  200. package/dist/custom/file-uploader.js.map +1 -0
  201. package/dist/custom/filter-component/fields/async-select.js +31 -0
  202. package/dist/custom/filter-component/fields/async-select.js.map +1 -0
  203. package/dist/custom/filter-component/fields/date.js +56 -0
  204. package/dist/custom/filter-component/fields/date.js.map +1 -0
  205. package/dist/custom/filter-component/fields/multi-select.js +28 -0
  206. package/dist/custom/filter-component/fields/multi-select.js.map +1 -0
  207. package/dist/custom/filter-component/index.js +149 -0
  208. package/dist/custom/filter-component/index.js.map +1 -0
  209. package/dist/custom/image-canvas.js +193 -0
  210. package/dist/custom/image-canvas.js.map +1 -0
  211. package/dist/custom/json-editor.js +30 -0
  212. package/dist/custom/json-editor.js.map +1 -0
  213. package/dist/custom/master-data-grid/components/dialogs/column-settings-dialog.js +84 -0
  214. package/dist/custom/master-data-grid/components/dialogs/column-settings-dialog.js.map +1 -0
  215. package/dist/custom/master-data-grid/components/dialogs/index.js +5 -0
  216. package/dist/custom/master-data-grid/components/dialogs/index.js.map +1 -0
  217. package/dist/custom/master-data-grid/components/filters/client-filter.js +310 -0
  218. package/dist/custom/master-data-grid/components/filters/client-filter.js.map +1 -0
  219. package/dist/custom/master-data-grid/components/filters/filter-input.js +209 -0
  220. package/dist/custom/master-data-grid/components/filters/filter-input.js.map +1 -0
  221. package/dist/custom/master-data-grid/components/filters/index.js +9 -0
  222. package/dist/custom/master-data-grid/components/filters/index.js.map +1 -0
  223. package/dist/custom/master-data-grid/components/filters/inline-column-filter.js +188 -0
  224. package/dist/custom/master-data-grid/components/filters/inline-column-filter.js.map +1 -0
  225. package/dist/custom/master-data-grid/components/filters/multi-filter-dialog.js +65 -0
  226. package/dist/custom/master-data-grid/components/filters/multi-filter-dialog.js.map +1 -0
  227. package/dist/custom/master-data-grid/components/filters/server-filter.js +213 -0
  228. package/dist/custom/master-data-grid/components/filters/server-filter.js.map +1 -0
  229. package/dist/custom/master-data-grid/components/master-data-grid.js +421 -0
  230. package/dist/custom/master-data-grid/components/master-data-grid.js.map +1 -0
  231. package/dist/custom/master-data-grid/components/pagination/index.js +5 -0
  232. package/dist/custom/master-data-grid/components/pagination/index.js.map +1 -0
  233. package/dist/custom/master-data-grid/components/pagination/pagination.js +159 -0
  234. package/dist/custom/master-data-grid/components/pagination/pagination.js.map +1 -0
  235. package/dist/custom/master-data-grid/components/table/cell-renderer.js +442 -0
  236. package/dist/custom/master-data-grid/components/table/cell-renderer.js.map +1 -0
  237. package/dist/custom/master-data-grid/components/table/header-cell.js +116 -0
  238. package/dist/custom/master-data-grid/components/table/header-cell.js.map +1 -0
  239. package/dist/custom/master-data-grid/components/table/index.js +5 -0
  240. package/dist/custom/master-data-grid/components/table/index.js.map +1 -0
  241. package/dist/custom/master-data-grid/components/table/table-body-renderer.js +79 -0
  242. package/dist/custom/master-data-grid/components/table/table-body-renderer.js.map +1 -0
  243. package/dist/custom/master-data-grid/components/table/virtual-body.js +86 -0
  244. package/dist/custom/master-data-grid/components/table/virtual-body.js.map +1 -0
  245. package/dist/custom/master-data-grid/components/toolbar/index.js +5 -0
  246. package/dist/custom/master-data-grid/components/toolbar/index.js.map +1 -0
  247. package/dist/custom/master-data-grid/components/toolbar/toolbar.js +238 -0
  248. package/dist/custom/master-data-grid/components/toolbar/toolbar.js.map +1 -0
  249. package/dist/custom/master-data-grid/hooks/index.js +7 -0
  250. package/dist/custom/master-data-grid/hooks/index.js.map +1 -0
  251. package/dist/custom/master-data-grid/hooks/use-columns.js +278 -0
  252. package/dist/custom/master-data-grid/hooks/use-columns.js.map +1 -0
  253. package/dist/custom/master-data-grid/hooks/use-editing.js +75 -0
  254. package/dist/custom/master-data-grid/hooks/use-editing.js.map +1 -0
  255. package/dist/custom/master-data-grid/hooks/use-table-state-reducer.js +96 -0
  256. package/dist/custom/master-data-grid/hooks/use-table-state-reducer.js.map +1 -0
  257. package/dist/custom/master-data-grid/hooks/use-table-state.js +25 -0
  258. package/dist/custom/master-data-grid/hooks/use-table-state.js.map +1 -0
  259. package/dist/custom/master-data-grid/index.js +5 -0
  260. package/dist/custom/master-data-grid/index.js.map +1 -0
  261. package/dist/custom/master-data-grid/types.js +1 -0
  262. package/dist/custom/master-data-grid/types.js.map +1 -0
  263. package/dist/custom/master-data-grid/utils/column-generator.js +203 -0
  264. package/dist/custom/master-data-grid/utils/column-generator.js.map +1 -0
  265. package/dist/custom/master-data-grid/utils/export-utils.js +46 -0
  266. package/dist/custom/master-data-grid/utils/export-utils.js.map +1 -0
  267. package/dist/custom/master-data-grid/utils/filter-fns.js +218 -0
  268. package/dist/custom/master-data-grid/utils/filter-fns.js.map +1 -0
  269. package/dist/custom/master-data-grid/utils/index.js +16 -0
  270. package/dist/custom/master-data-grid/utils/index.js.map +1 -0
  271. package/dist/custom/master-data-grid/utils/pinning-utils.js +70 -0
  272. package/dist/custom/master-data-grid/utils/pinning-utils.js.map +1 -0
  273. package/dist/custom/master-data-grid/utils/translation-utils.js +33 -0
  274. package/dist/custom/master-data-grid/utils/translation-utils.js.map +1 -0
  275. package/dist/custom/multi-select.js +339 -0
  276. package/dist/custom/multi-select.js.map +1 -0
  277. package/dist/custom/password-input.js +158 -0
  278. package/dist/custom/password-input.js.map +1 -0
  279. package/dist/custom/phone-input.js +127 -0
  280. package/dist/custom/phone-input.js.map +1 -0
  281. package/dist/custom/schema-form/custom/index.js +2 -0
  282. package/dist/custom/schema-form/custom/index.js.map +1 -0
  283. package/dist/custom/schema-form/custom/label.js +39 -0
  284. package/dist/custom/schema-form/custom/label.js.map +1 -0
  285. package/dist/custom/schema-form/fields/base-input-field.js +73 -0
  286. package/dist/custom/schema-form/fields/base-input-field.js.map +1 -0
  287. package/dist/custom/schema-form/fields/field.js +72 -0
  288. package/dist/custom/schema-form/fields/field.js.map +1 -0
  289. package/dist/custom/schema-form/fields/index.js +6 -0
  290. package/dist/custom/schema-form/fields/index.js.map +1 -0
  291. package/dist/custom/schema-form/fields/object.js +9 -0
  292. package/dist/custom/schema-form/fields/object.js.map +1 -0
  293. package/dist/custom/schema-form/fields/table-array/array-field-item.js +58 -0
  294. package/dist/custom/schema-form/fields/table-array/array-field-item.js.map +1 -0
  295. package/dist/custom/schema-form/fields/table-array/array-field-template.js +104 -0
  296. package/dist/custom/schema-form/fields/table-array/array-field-template.js.map +1 -0
  297. package/dist/custom/schema-form/index.js +219 -0
  298. package/dist/custom/schema-form/index.js.map +1 -0
  299. package/dist/custom/schema-form/templates/description.js +19 -0
  300. package/dist/custom/schema-form/templates/description.js.map +1 -0
  301. package/dist/custom/schema-form/templates/index.js +3 -0
  302. package/dist/custom/schema-form/templates/index.js.map +1 -0
  303. package/dist/custom/schema-form/templates/submit.js +31 -0
  304. package/dist/custom/schema-form/templates/submit.js.map +1 -0
  305. package/dist/custom/schema-form/types.js +1 -0
  306. package/dist/custom/schema-form/types.js.map +1 -0
  307. package/dist/custom/schema-form/utils/index.js +10 -0
  308. package/dist/custom/schema-form/utils/index.js.map +1 -0
  309. package/dist/custom/schema-form/utils/schema-dependency.js +349 -0
  310. package/dist/custom/schema-form/utils/schema-dependency.js.map +1 -0
  311. package/dist/custom/schema-form/utils/schemas.js +190 -0
  312. package/dist/custom/schema-form/utils/schemas.js.map +1 -0
  313. package/dist/custom/schema-form/utils/validation.js +19 -0
  314. package/dist/custom/schema-form/utils/validation.js.map +1 -0
  315. package/dist/custom/schema-form/widgets/boolean.js +73 -0
  316. package/dist/custom/schema-form/widgets/boolean.js.map +1 -0
  317. package/dist/custom/schema-form/widgets/combobox.js +222 -0
  318. package/dist/custom/schema-form/widgets/combobox.js.map +1 -0
  319. package/dist/custom/schema-form/widgets/date.js +56 -0
  320. package/dist/custom/schema-form/widgets/date.js.map +1 -0
  321. package/dist/custom/schema-form/widgets/email.js +37 -0
  322. package/dist/custom/schema-form/widgets/email.js.map +1 -0
  323. package/dist/custom/schema-form/widgets/index.js +11 -0
  324. package/dist/custom/schema-form/widgets/index.js.map +1 -0
  325. package/dist/custom/schema-form/widgets/password.js +42 -0
  326. package/dist/custom/schema-form/widgets/password.js.map +1 -0
  327. package/dist/custom/schema-form/widgets/phone.js +39 -0
  328. package/dist/custom/schema-form/widgets/phone.js.map +1 -0
  329. package/dist/custom/schema-form/widgets/select.js +78 -0
  330. package/dist/custom/schema-form/widgets/select.js.map +1 -0
  331. package/dist/custom/schema-form/widgets/selectable.js +25 -0
  332. package/dist/custom/schema-form/widgets/selectable.js.map +1 -0
  333. package/dist/custom/schema-form/widgets/string-array.js +237 -0
  334. package/dist/custom/schema-form/widgets/string-array.js.map +1 -0
  335. package/dist/custom/schema-form/widgets/url.js +53 -0
  336. package/dist/custom/schema-form/widgets/url.js.map +1 -0
  337. package/dist/custom/section-layout-v2.js +150 -0
  338. package/dist/custom/section-layout-v2.js.map +1 -0
  339. package/dist/custom/select-tabs.js +66 -0
  340. package/dist/custom/select-tabs.js.map +1 -0
  341. package/dist/custom/selectable.js +231 -0
  342. package/dist/custom/selectable.js.map +1 -0
  343. package/dist/custom/stepper.js +166 -0
  344. package/dist/custom/stepper.js.map +1 -0
  345. package/dist/custom/tab-layout.js +182 -0
  346. package/dist/custom/tab-layout.js.map +1 -0
  347. package/dist/custom/tanstack-table/fields/index.js +13 -0
  348. package/dist/custom/tanstack-table/fields/index.js.map +1 -0
  349. package/dist/custom/tanstack-table/fields/tanstack-table-action-dialogs.js +76 -0
  350. package/dist/custom/tanstack-table/fields/tanstack-table-action-dialogs.js.map +1 -0
  351. package/dist/custom/tanstack-table/fields/tanstack-table-column-header.js +47 -0
  352. package/dist/custom/tanstack-table/fields/tanstack-table-column-header.js.map +1 -0
  353. package/dist/custom/tanstack-table/fields/tanstack-table-filter-date.js +132 -0
  354. package/dist/custom/tanstack-table/fields/tanstack-table-filter-date.js.map +1 -0
  355. package/dist/custom/tanstack-table/fields/tanstack-table-filter-faceted.js +131 -0
  356. package/dist/custom/tanstack-table/fields/tanstack-table-filter-faceted.js.map +1 -0
  357. package/dist/custom/tanstack-table/fields/tanstack-table-filter-text.js +64 -0
  358. package/dist/custom/tanstack-table/fields/tanstack-table-filter-text.js.map +1 -0
  359. package/dist/custom/tanstack-table/fields/tanstack-table-pagination.js +135 -0
  360. package/dist/custom/tanstack-table/fields/tanstack-table-pagination.js.map +1 -0
  361. package/dist/custom/tanstack-table/fields/tanstack-table-plain-table.js +111 -0
  362. package/dist/custom/tanstack-table/fields/tanstack-table-plain-table.js.map +1 -0
  363. package/dist/custom/tanstack-table/fields/tanstack-table-row-actions-confirmation.js +65 -0
  364. package/dist/custom/tanstack-table/fields/tanstack-table-row-actions-confirmation.js.map +1 -0
  365. package/dist/custom/tanstack-table/fields/tanstack-table-row-actions-custom-dialog.js +69 -0
  366. package/dist/custom/tanstack-table/fields/tanstack-table-row-actions-custom-dialog.js.map +1 -0
  367. package/dist/custom/tanstack-table/fields/tanstack-table-row-actions.js +119 -0
  368. package/dist/custom/tanstack-table/fields/tanstack-table-row-actions.js.map +1 -0
  369. package/dist/custom/tanstack-table/fields/tanstack-table-table-actions-custom-dialog.js +75 -0
  370. package/dist/custom/tanstack-table/fields/tanstack-table-table-actions-custom-dialog.js.map +1 -0
  371. package/dist/custom/tanstack-table/fields/tanstack-table-table-actions-schemaform-dialog.js +41 -0
  372. package/dist/custom/tanstack-table/fields/tanstack-table-table-actions-schemaform-dialog.js.map +1 -0
  373. package/dist/custom/tanstack-table/fields/tanstack-table-toolbar.js +106 -0
  374. package/dist/custom/tanstack-table/fields/tanstack-table-toolbar.js.map +1 -0
  375. package/dist/custom/tanstack-table/fields/tanstack-table-view-options.js +132 -0
  376. package/dist/custom/tanstack-table/fields/tanstack-table-view-options.js.map +1 -0
  377. package/dist/custom/tanstack-table/index.js +217 -0
  378. package/dist/custom/tanstack-table/index.js.map +1 -0
  379. package/dist/custom/tanstack-table/types/index.js +1 -0
  380. package/dist/custom/tanstack-table/types/index.js.map +1 -0
  381. package/dist/custom/tanstack-table/utils/cell-with-actions.js +16 -0
  382. package/dist/custom/tanstack-table/utils/cell-with-actions.js.map +1 -0
  383. package/dist/custom/tanstack-table/utils/column-names.js +15 -0
  384. package/dist/custom/tanstack-table/utils/column-names.js.map +1 -0
  385. package/dist/custom/tanstack-table/utils/columns-by-row-data.js +246 -0
  386. package/dist/custom/tanstack-table/utils/columns-by-row-data.js.map +1 -0
  387. package/dist/custom/tanstack-table/utils/editable-columns-by-row-data.js +187 -0
  388. package/dist/custom/tanstack-table/utils/editable-columns-by-row-data.js.map +1 -0
  389. package/dist/custom/tanstack-table/utils/faceted-boolean-options.js +25 -0
  390. package/dist/custom/tanstack-table/utils/faceted-boolean-options.js.map +1 -0
  391. package/dist/custom/tanstack-table/utils/index.js +10 -0
  392. package/dist/custom/tanstack-table/utils/index.js.map +1 -0
  393. package/dist/custom/tanstack-table/utils/pinning-styles.js +38 -0
  394. package/dist/custom/tanstack-table/utils/pinning-styles.js.map +1 -0
  395. package/dist/custom/tanstack-table/utils/table.js +66 -0
  396. package/dist/custom/tanstack-table/utils/table.js.map +1 -0
  397. package/dist/custom/tanstack-table/utils/test-conditions.js +10 -0
  398. package/dist/custom/tanstack-table/utils/test-conditions.js.map +1 -0
  399. package/dist/custom/timeline.js +165 -0
  400. package/dist/custom/timeline.js.map +1 -0
  401. package/dist/custom/tree.js +130 -0
  402. package/dist/custom/tree.js.map +1 -0
  403. package/dist/custom/tscanify/browser.js +36 -0
  404. package/dist/custom/tscanify/browser.js.map +1 -0
  405. package/dist/custom/tscanify/index.js +34 -0
  406. package/dist/custom/tscanify/index.js.map +1 -0
  407. package/dist/custom/tscanify/tscanify-browser.js +363 -0
  408. package/dist/custom/tscanify/tscanify-browser.js.map +1 -0
  409. package/dist/custom/tscanify/tscanify.js +197 -0
  410. package/dist/custom/tscanify/tscanify.js.map +1 -0
  411. package/dist/custom/tscanify/types.js +1 -0
  412. package/dist/custom/tscanify/types.js.map +1 -0
  413. package/dist/custom/webcam.js +519 -0
  414. package/dist/custom/webcam.js.map +1 -0
  415. package/dist/hooks/use-callback-ref.js +15 -0
  416. package/dist/hooks/use-callback-ref.js.map +1 -0
  417. package/dist/hooks/use-controllable-state.js +49 -0
  418. package/dist/hooks/use-controllable-state.js.map +1 -0
  419. package/dist/hooks/use-debounce.js +18 -0
  420. package/dist/hooks/use-debounce.js.map +1 -0
  421. package/dist/hooks/use-is-visible.js +22 -0
  422. package/dist/hooks/use-is-visible.js.map +1 -0
  423. package/dist/hooks/use-media-query.js +19 -0
  424. package/dist/hooks/use-media-query.js.map +1 -0
  425. package/dist/hooks/use-mobile.js +21 -0
  426. package/dist/hooks/use-mobile.js.map +1 -0
  427. package/dist/hooks/use-on-window-resize.js +15 -0
  428. package/dist/hooks/use-on-window-resize.js.map +1 -0
  429. package/dist/hooks/use-scroll.js +20 -0
  430. package/dist/hooks/use-scroll.js.map +1 -0
  431. package/dist/lib/utils.js +48 -0
  432. package/dist/lib/utils.js.map +1 -0
  433. package/dist/lib/zod.js +7 -0
  434. package/dist/lib/zod.js.map +1 -0
  435. package/package.json +34 -8
  436. package/src/aria/index.tsx +1 -1
  437. package/src/aria/number-field.tsx +41 -41
  438. package/src/components/accordion.tsx +66 -66
  439. package/src/components/alert-dialog.tsx +157 -157
  440. package/src/components/alert.tsx +70 -70
  441. package/src/components/aspect-ratio.tsx +11 -11
  442. package/src/components/avatar.tsx +53 -53
  443. package/src/components/badge.tsx +74 -67
  444. package/src/components/breadcrumb.tsx +109 -109
  445. package/src/components/button-group.tsx +83 -83
  446. package/src/components/button.tsx +69 -68
  447. package/src/components/calendar.tsx +216 -219
  448. package/src/components/card.tsx +92 -92
  449. package/src/components/carousel.tsx +241 -241
  450. package/src/components/chart.tsx +363 -363
  451. package/src/components/checkbox.tsx +32 -32
  452. package/src/components/collapsible.tsx +33 -33
  453. package/src/components/command.tsx +184 -184
  454. package/src/components/context-menu.tsx +252 -252
  455. package/src/components/dialog.tsx +144 -144
  456. package/src/components/drawer.tsx +135 -135
  457. package/src/components/dropdown-menu.tsx +258 -258
  458. package/src/components/empty.tsx +100 -100
  459. package/src/components/field.tsx +248 -248
  460. package/src/components/form.tsx +169 -169
  461. package/src/components/hover-card.tsx +44 -44
  462. package/src/components/input-group.tsx +170 -170
  463. package/src/components/input-otp.tsx +77 -77
  464. package/src/components/input.tsx +21 -21
  465. package/src/components/item.tsx +193 -193
  466. package/src/components/kbd.tsx +28 -28
  467. package/src/components/label.tsx +24 -24
  468. package/src/components/menubar.tsx +276 -276
  469. package/src/components/navigation-menu.tsx +168 -168
  470. package/src/components/pagination.tsx +127 -130
  471. package/src/components/popover.tsx +88 -88
  472. package/src/components/progress.tsx +31 -31
  473. package/src/components/radio-group.tsx +45 -45
  474. package/src/components/resizable.tsx +56 -56
  475. package/src/components/scroll-area.tsx +58 -58
  476. package/src/components/select.tsx +189 -189
  477. package/src/components/separator.tsx +28 -28
  478. package/src/components/sheet.tsx +140 -140
  479. package/src/components/sidebar.tsx +862 -862
  480. package/src/components/skeleton.tsx +13 -13
  481. package/src/components/slider.tsx +63 -63
  482. package/src/components/sonner.tsx +40 -40
  483. package/src/components/spinner.tsx +16 -16
  484. package/src/components/stepper.tsx +290 -291
  485. package/src/components/switch.tsx +31 -31
  486. package/src/components/table.tsx +133 -133
  487. package/src/components/tabs.tsx +66 -66
  488. package/src/components/textarea.tsx +18 -18
  489. package/src/components/toggle-group.tsx +83 -83
  490. package/src/components/toggle.tsx +47 -47
  491. package/src/components/tooltip.tsx +66 -66
  492. package/src/custom/action-button.tsx +45 -48
  493. package/src/custom/async-select.tsx +287 -287
  494. package/src/custom/awesome-not-found.tsx +116 -116
  495. package/src/custom/charts/area-chart.tsx +147 -147
  496. package/src/custom/charts/bar-chart.tsx +233 -233
  497. package/src/custom/charts/chart-card.tsx +103 -103
  498. package/src/custom/charts/index.tsx +16 -16
  499. package/src/custom/charts/pie-chart.tsx +168 -168
  500. package/src/custom/charts/radar-chart.tsx +126 -126
  501. package/src/custom/checkbox-tree.tsx +100 -100
  502. package/src/custom/combobox.tsx +296 -296
  503. package/src/custom/confirm-dialog.tsx +114 -102
  504. package/src/custom/country-selector.tsx +204 -204
  505. package/src/custom/date-picker/calendar-rac.tsx +109 -109
  506. package/src/custom/date-picker/datefield-rac.tsx +84 -84
  507. package/src/custom/date-picker/index.tsx +273 -273
  508. package/src/custom/date-picker/types/index.ts +4 -4
  509. package/src/custom/date-picker/utils/index.ts +42 -42
  510. package/src/custom/date-picker-old.tsx +50 -50
  511. package/src/custom/date-tooltip.tsx +98 -98
  512. package/src/custom/document-scanner/consts.ts +5 -5
  513. package/src/custom/document-scanner/corner-adjustment/action-buttons.tsx +33 -33
  514. package/src/custom/document-scanner/corner-adjustment/corner-handle.tsx +43 -43
  515. package/src/custom/document-scanner/corner-adjustment/hooks/use-corner-drag.ts +85 -85
  516. package/src/custom/document-scanner/corner-adjustment/index.tsx +125 -125
  517. package/src/custom/document-scanner/corner-adjustment/types.ts +53 -53
  518. package/src/custom/document-scanner/corner-adjustment/utils/clip-path.ts +22 -22
  519. package/src/custom/document-scanner/corner-adjustment/zoom-magnifier.tsx +115 -115
  520. package/src/custom/document-scanner/hooks/use-document-capture.ts +81 -81
  521. package/src/custom/document-scanner/hooks/use-document-scanner.ts +80 -80
  522. package/src/custom/document-scanner/hooks/use-perspective-crop.ts +38 -38
  523. package/src/custom/document-scanner/index.tsx +255 -255
  524. package/src/custom/document-scanner/lib.ts +407 -407
  525. package/src/custom/document-scanner/types.ts +205 -205
  526. package/src/custom/document-scanner/utils/perspective-correction.ts +139 -139
  527. package/src/custom/document-viewer/controllers.tsx +98 -98
  528. package/src/custom/document-viewer/index.tsx +43 -43
  529. package/src/custom/document-viewer/renderers/image.tsx +37 -37
  530. package/src/custom/document-viewer/renderers/index.tsx +2 -2
  531. package/src/custom/document-viewer/renderers/pdf.tsx +105 -105
  532. package/src/custom/email-input/domains.json +159 -159
  533. package/src/custom/email-input/email.tsx +231 -229
  534. package/src/custom/email-input/index.tsx +4 -4
  535. package/src/custom/email-input/types.ts +104 -104
  536. package/src/custom/file-uploader.tsx +541 -541
  537. package/src/custom/filter-component/fields/async-select.tsx +33 -33
  538. package/src/custom/filter-component/fields/date.tsx +60 -60
  539. package/src/custom/filter-component/fields/multi-select.tsx +30 -30
  540. package/src/custom/filter-component/index.tsx +217 -217
  541. package/src/custom/image-canvas.tsx +260 -260
  542. package/src/custom/json-editor.tsx +22 -22
  543. package/src/custom/master-data-grid/components/dialogs/column-settings-dialog.tsx +100 -100
  544. package/src/custom/master-data-grid/components/dialogs/index.ts +1 -1
  545. package/src/custom/master-data-grid/components/filters/client-filter.tsx +369 -368
  546. package/src/custom/master-data-grid/components/filters/filter-input.tsx +256 -256
  547. package/src/custom/master-data-grid/components/filters/index.ts +3 -3
  548. package/src/custom/master-data-grid/components/filters/inline-column-filter.tsx +233 -233
  549. package/src/custom/master-data-grid/components/filters/multi-filter-dialog.tsx +91 -90
  550. package/src/custom/master-data-grid/components/filters/server-filter.tsx +265 -255
  551. package/src/custom/master-data-grid/components/master-data-grid.tsx +472 -472
  552. package/src/custom/master-data-grid/components/pagination/index.ts +1 -1
  553. package/src/custom/master-data-grid/components/pagination/pagination.tsx +178 -178
  554. package/src/custom/master-data-grid/components/table/cell-renderer.tsx +621 -634
  555. package/src/custom/master-data-grid/components/table/header-cell.tsx +162 -162
  556. package/src/custom/master-data-grid/components/table/index.ts +4 -4
  557. package/src/custom/master-data-grid/components/table/table-body-renderer.tsx +113 -113
  558. package/src/custom/master-data-grid/components/table/virtual-body.tsx +138 -138
  559. package/src/custom/master-data-grid/components/toolbar/index.ts +1 -1
  560. package/src/custom/master-data-grid/components/toolbar/toolbar.tsx +314 -314
  561. package/src/custom/master-data-grid/hooks/index.ts +3 -3
  562. package/src/custom/master-data-grid/hooks/use-columns.tsx +353 -332
  563. package/src/custom/master-data-grid/hooks/use-editing.ts +106 -106
  564. package/src/custom/master-data-grid/hooks/use-table-state-reducer.ts +157 -157
  565. package/src/custom/master-data-grid/hooks/use-table-state.ts +31 -31
  566. package/src/custom/master-data-grid/index.ts +16 -16
  567. package/src/custom/master-data-grid/types.ts +487 -466
  568. package/src/custom/master-data-grid/utils/column-generator.tsx +324 -306
  569. package/src/custom/master-data-grid/utils/export-utils.ts +67 -67
  570. package/src/custom/master-data-grid/utils/filter-fns.ts +310 -290
  571. package/src/custom/master-data-grid/utils/index.ts +8 -8
  572. package/src/custom/master-data-grid/utils/pinning-utils.ts +88 -88
  573. package/src/custom/master-data-grid/utils/translation-utils.ts +42 -42
  574. package/src/custom/multi-select.tsx +434 -432
  575. package/src/custom/password-input.tsx +194 -194
  576. package/src/custom/phone-input.tsx +172 -172
  577. package/src/custom/schema-form/custom/index.tsx +1 -1
  578. package/src/custom/schema-form/custom/label.tsx +53 -53
  579. package/src/custom/schema-form/fields/base-input-field.tsx +82 -82
  580. package/src/custom/schema-form/fields/field.tsx +67 -67
  581. package/src/custom/schema-form/fields/index.tsx +5 -5
  582. package/src/custom/schema-form/fields/object.tsx +12 -12
  583. package/src/custom/schema-form/fields/table-array/array-field-item.tsx +90 -90
  584. package/src/custom/schema-form/fields/table-array/array-field-template.tsx +115 -115
  585. package/src/custom/schema-form/index.tsx +259 -259
  586. package/src/custom/schema-form/templates/description.tsx +20 -20
  587. package/src/custom/schema-form/templates/index.tsx +2 -2
  588. package/src/custom/schema-form/templates/submit.tsx +32 -32
  589. package/src/custom/schema-form/types.ts +64 -64
  590. package/src/custom/schema-form/utils/index.ts +4 -4
  591. package/src/custom/schema-form/utils/schema-dependency.ts +655 -655
  592. package/src/custom/schema-form/utils/schemas.ts +289 -289
  593. package/src/custom/schema-form/utils/validation.ts +23 -23
  594. package/src/custom/schema-form/widgets/boolean.tsx +77 -77
  595. package/src/custom/schema-form/widgets/combobox.tsx +274 -274
  596. package/src/custom/schema-form/widgets/date.tsx +59 -59
  597. package/src/custom/schema-form/widgets/email.tsx +34 -34
  598. package/src/custom/schema-form/widgets/index.tsx +10 -10
  599. package/src/custom/schema-form/widgets/password.tsx +40 -40
  600. package/src/custom/schema-form/widgets/phone.tsx +40 -40
  601. package/src/custom/schema-form/widgets/select.tsx +105 -105
  602. package/src/custom/schema-form/widgets/selectable.tsx +25 -25
  603. package/src/custom/schema-form/widgets/string-array.tsx +296 -296
  604. package/src/custom/schema-form/widgets/url.tsx +56 -56
  605. package/src/custom/section-layout-v2.tsx +212 -212
  606. package/src/custom/select-tabs.tsx +109 -109
  607. package/src/custom/selectable.tsx +316 -316
  608. package/src/custom/stepper.tsx +236 -236
  609. package/src/custom/tab-layout.tsx +213 -213
  610. package/src/custom/tanstack-table/fields/index.tsx +12 -12
  611. package/src/custom/tanstack-table/fields/tanstack-table-action-dialogs.tsx +89 -89
  612. package/src/custom/tanstack-table/fields/tanstack-table-column-header.tsx +68 -66
  613. package/src/custom/tanstack-table/fields/tanstack-table-filter-date.tsx +180 -180
  614. package/src/custom/tanstack-table/fields/tanstack-table-filter-faceted.tsx +158 -158
  615. package/src/custom/tanstack-table/fields/tanstack-table-filter-text.tsx +73 -76
  616. package/src/custom/tanstack-table/fields/tanstack-table-pagination.tsx +136 -136
  617. package/src/custom/tanstack-table/fields/tanstack-table-plain-table.tsx +142 -142
  618. package/src/custom/tanstack-table/fields/tanstack-table-row-actions-confirmation.tsx +77 -77
  619. package/src/custom/tanstack-table/fields/tanstack-table-row-actions-custom-dialog.tsx +87 -87
  620. package/src/custom/tanstack-table/fields/tanstack-table-row-actions.tsx +151 -151
  621. package/src/custom/tanstack-table/fields/tanstack-table-table-actions-custom-dialog.tsx +88 -88
  622. package/src/custom/tanstack-table/fields/tanstack-table-table-actions-schemaform-dialog.tsx +47 -47
  623. package/src/custom/tanstack-table/fields/tanstack-table-toolbar.tsx +143 -143
  624. package/src/custom/tanstack-table/fields/tanstack-table-view-options.tsx +171 -171
  625. package/src/custom/tanstack-table/index.tsx +244 -244
  626. package/src/custom/tanstack-table/types/index.ts +328 -328
  627. package/src/custom/tanstack-table/utils/cell-with-actions.tsx +21 -21
  628. package/src/custom/tanstack-table/utils/column-names.ts +26 -26
  629. package/src/custom/tanstack-table/utils/columns-by-row-data.tsx +312 -312
  630. package/src/custom/tanstack-table/utils/editable-columns-by-row-data.tsx +219 -219
  631. package/src/custom/tanstack-table/utils/faceted-boolean-options.tsx +22 -22
  632. package/src/custom/tanstack-table/utils/index.tsx +10 -10
  633. package/src/custom/tanstack-table/utils/pinning-styles.ts +57 -57
  634. package/src/custom/tanstack-table/utils/table.tsx +83 -83
  635. package/src/custom/tanstack-table/utils/test-conditions.ts +17 -17
  636. package/src/custom/timeline.tsx +208 -208
  637. package/src/custom/tree.tsx +202 -200
  638. package/src/custom/tscanify/browser.ts +66 -66
  639. package/src/custom/tscanify/index.ts +51 -51
  640. package/src/custom/tscanify/tscanify-browser.ts +522 -522
  641. package/src/custom/tscanify/tscanify.ts +262 -262
  642. package/src/custom/tscanify/types.ts +22 -22
  643. package/src/custom/webcam.tsx +737 -737
  644. package/src/hooks/use-callback-ref.ts +27 -27
  645. package/src/hooks/use-controllable-state.ts +67 -67
  646. package/src/hooks/use-debounce.ts +19 -19
  647. package/src/hooks/use-is-visible.ts +23 -23
  648. package/src/hooks/use-media-query.ts +21 -21
  649. package/src/hooks/use-mobile.ts +21 -21
  650. package/src/hooks/use-on-window-resize.ts +15 -15
  651. package/src/hooks/use-scroll.tsx +22 -22
  652. package/src/lib/utils.ts +61 -61
  653. package/src/lib/zod.ts +2 -2
  654. package/src/styles/core.css +57 -57
  655. package/src/test/email-input.test.tsx +217 -217
  656. package/src/test/password-input.test.tsx +92 -92
  657. package/src/test/select-tabs.test.tsx +302 -302
  658. package/src/test/selectable.test.tsx +1093 -1093
  659. package/__mocks__/canvas.ts +0 -8
  660. package/components.json +0 -21
  661. package/eslint.config.js +0 -4
  662. package/jest-environment.js +0 -37
  663. package/jest.config.ts +0 -47
  664. package/jest.setup.ts +0 -69
  665. package/postcss.config.mjs +0 -6
  666. package/tsconfig.json +0 -13
  667. package/tsconfig.lint.json +0 -8
@@ -1,634 +1,621 @@
1
- import { Switch } from "@repo/ayasofyazilim-ui/components/switch";
2
- import { useCallback, useEffect, useMemo, useRef, useState } from "react";
3
- import { z } from "zod";
4
- import { Badge } from "../../../../components/badge";
5
- import { Input } from "../../../../components/input";
6
- import {
7
- Select,
8
- SelectContent,
9
- SelectItem,
10
- SelectTrigger,
11
- SelectValue,
12
- } from "../../../../components/select";
13
- import {
14
- Tooltip,
15
- TooltipContent,
16
- TooltipTrigger,
17
- } from "../../../../components/tooltip";
18
- import { DatePicker } from "../../../date-picker";
19
- import DateTooltip from "../../../date-tooltip";
20
- import { cn } from "../../../../lib/utils";
21
- import type {
22
- CellRendererProps,
23
- JSONSchemaProperty,
24
- MasterDataGridResources,
25
- } from "../../types";
26
- import { getTranslations } from "../../utils/translation-utils";
27
-
28
- const DEBOUNCE_DELAY = 150;
29
- const MAX_STRING_LENGTH = 100;
30
- const MAX_ARRAY_DISPLAY = 3;
31
-
32
- const BADGE_VARIANT_MAP: Record<
33
- string,
34
- "default" | "secondary" | "outline" | "destructive"
35
- > = {
36
- active: "default",
37
- inactive: "secondary",
38
- pending: "outline",
39
- success: "default",
40
- warning: "destructive",
41
- error: "destructive",
42
- };
43
-
44
- function createZodSchema(
45
- schemaProperty?: JSONSchemaProperty,
46
- t?: MasterDataGridResources
47
- ): z.ZodType {
48
- if (!schemaProperty) return z.unknown();
49
-
50
- let schema: z.ZodType;
51
-
52
- switch (schemaProperty.type) {
53
- case "string":
54
- schema = z.string({
55
- message: getTranslations("validation.invalidString", t),
56
- });
57
-
58
- if (schemaProperty.minLength !== undefined) {
59
- schema = (schema as z.ZodString).min(
60
- schemaProperty.minLength,
61
- t?.["validation.min_length"]
62
- ? (t["validation.min_length"] ?? "").replace(
63
- "{min}",
64
- String(schemaProperty.minLength)
65
- )
66
- : `Must be at least ${schemaProperty.minLength} characters`
67
- );
68
- }
69
- if (schemaProperty.maxLength !== undefined) {
70
- schema = (schema as z.ZodString).max(
71
- schemaProperty.maxLength,
72
- t?.["validation.max_length"]
73
- ? (t["validation.max_length"] ?? "").replace(
74
- "{max}",
75
- String(schemaProperty.maxLength)
76
- )
77
- : `Must be at most ${schemaProperty.maxLength} characters`
78
- );
79
- }
80
-
81
- if (schemaProperty.format === "email") {
82
- schema = (schema as z.ZodString).email(
83
- t?.["validation.invalid_email"] || "Must be a valid email address"
84
- );
85
- }
86
- if (schemaProperty.format === "uri" || schemaProperty.format === "url") {
87
- schema = z.url(t?.["validation.invalid_url"] || "Must be a valid URL");
88
- }
89
- if (schemaProperty.format === "uuid") {
90
- schema = z.uuid(
91
- t?.["validation.invalid_uuid"] || "Must be a valid UUID"
92
- );
93
- }
94
- break;
95
-
96
- case "number":
97
- schema = z.number({
98
- message: t?.["validation.invalid_number"] || "Must be a valid number",
99
- });
100
-
101
- if (schemaProperty.minimum !== undefined) {
102
- schema = (schema as z.ZodNumber).min(
103
- schemaProperty.minimum,
104
- t?.["validation.min_value"]
105
- ? (t["validation.min_value"] ?? "").replace(
106
- "{min}",
107
- String(schemaProperty.minimum)
108
- )
109
- : `Must be at least ${schemaProperty.minimum}`
110
- );
111
- }
112
- if (schemaProperty.maximum !== undefined) {
113
- schema = (schema as z.ZodNumber).max(
114
- schemaProperty.maximum,
115
- t?.["validation.max_value"]
116
- ? (t["validation.max_value"] ?? "").replace(
117
- "{max}",
118
- String(schemaProperty.maximum)
119
- )
120
- : `Must be at most ${schemaProperty.maximum}`
121
- );
122
- }
123
- break;
124
-
125
- case "integer":
126
- schema = z
127
- .number({
128
- message:
129
- t?.["validation.invalid_integer"] || "Must be a valid integer",
130
- })
131
- .int(t?.["validation.must_be_integer"] || "Must be an integer");
132
-
133
- if (schemaProperty.minimum !== undefined) {
134
- schema = (schema as z.ZodNumber).min(
135
- schemaProperty.minimum,
136
- t?.["validation.min_value"]
137
- ? (t["validation.min_value"] ?? "").replace(
138
- "{min}",
139
- String(schemaProperty.minimum)
140
- )
141
- : `Must be at least ${schemaProperty.minimum}`
142
- );
143
- }
144
- if (schemaProperty.maximum !== undefined) {
145
- schema = (schema as z.ZodNumber).max(
146
- schemaProperty.maximum,
147
- t?.["validation.max_value"]
148
- ? (t["validation.max_value"] ?? "").replace(
149
- "{max}",
150
- String(schemaProperty.maximum)
151
- )
152
- : `Must be at most ${schemaProperty.maximum}`
153
- );
154
- }
155
- break;
156
-
157
- case "boolean":
158
- schema = z.boolean({
159
- message: t?.["validation.invalid_boolean"] || "Must be true or false",
160
- });
161
- break;
162
-
163
- default:
164
- schema = z.unknown();
165
- }
166
-
167
- if (schemaProperty.enum && Array.isArray(schemaProperty.enum)) {
168
- schema = z.enum(
169
- schemaProperty.enum as [string, ...string[]],
170
- t?.["validation.invalid_enum"] || "Invalid value"
171
- );
172
- }
173
-
174
- if (!schemaProperty.required) {
175
- schema = schema.optional().nullable();
176
- }
177
-
178
- return schema;
179
- }
180
-
181
- interface ErrorWrapperProps {
182
- error: string | null;
183
- mode: "tooltip" | "inline" | "both";
184
- children: React.ReactNode;
185
- }
186
-
187
- function ErrorWrapper({ error, mode, children }: ErrorWrapperProps) {
188
- if (!error) return <>{children}</>;
189
-
190
- const showTooltip = mode === "tooltip" || mode === "both";
191
- const showInline = mode === "inline" || mode === "both";
192
-
193
- const inlineError = showInline && (
194
- <span className="text-[10px] text-destructive px-2 py-0.5 leading-tight animate-in fade-in slide-in-from-top-1">
195
- {error}
196
- </span>
197
- );
198
-
199
- if (showTooltip && !showInline) {
200
- return (
201
- <Tooltip>
202
- <TooltipTrigger asChild>{children}</TooltipTrigger>
203
- <TooltipContent side="bottom" className="max-w-xs">
204
- {error}
205
- </TooltipContent>
206
- </Tooltip>
207
- );
208
- }
209
-
210
- if (showInline && !showTooltip) {
211
- return (
212
- <div className="flex flex-col w-full h-full">
213
- {children}
214
- {inlineError}
215
- </div>
216
- );
217
- }
218
-
219
- return (
220
- <Tooltip>
221
- <TooltipTrigger asChild>
222
- <div className="flex flex-col w-full h-full">
223
- {children}
224
- {inlineError}
225
- </div>
226
- </TooltipTrigger>
227
- <TooltipContent side="bottom" className="max-w-xs">
228
- {error}
229
- </TooltipContent>
230
- </Tooltip>
231
- );
232
- }
233
-
234
- export function CellRenderer<TData = unknown>({
235
- value,
236
- row,
237
- column,
238
- schemaProperty,
239
- editable = false,
240
- onUpdate,
241
- t,
242
- error,
243
- className,
244
- dateOptions,
245
- localization,
246
- fieldName,
247
- customRenderers,
248
- errorDisplayMode = "tooltip",
249
- }: CellRendererProps<TData>) {
250
- const [localValue, setLocalValue] = useState(value);
251
- const [validationError, setValidationError] = useState<string | null>(
252
- error || null
253
- );
254
- const inputRef = useRef<HTMLInputElement>(null);
255
- const updateTimeoutRef = useRef<NodeJS.Timeout>(null);
256
- const datePickerIdRef = useRef<string>(
257
- `date-${schemaProperty?.title || "field"}-${Date.now()}`
258
- );
259
- const datePickerMountedRef = useRef<boolean>(false);
260
- const handleDateChangeRef = useRef<((date: Date) => void) | null>(null);
261
-
262
- const validationSchema = useMemo(
263
- () => (schemaProperty ? createZodSchema(schemaProperty, t) : null),
264
- [schemaProperty, t]
265
- );
266
-
267
- useEffect(() => {
268
- if (!editable) {
269
- setLocalValue(value);
270
- datePickerMountedRef.current = false;
271
- }
272
- }, [value, editable]);
273
-
274
- useEffect(() => {
275
- return () => {
276
- if (updateTimeoutRef.current) {
277
- clearTimeout(updateTimeoutRef.current);
278
- }
279
- };
280
- }, []);
281
-
282
- const debouncedUpdate = useCallback(
283
- (newValue: unknown) => {
284
- if (updateTimeoutRef.current) {
285
- clearTimeout(updateTimeoutRef.current);
286
- }
287
- updateTimeoutRef.current = setTimeout(() => {
288
- if (onUpdate) {
289
- onUpdate(newValue);
290
- }
291
- }, DEBOUNCE_DELAY);
292
- },
293
- [onUpdate]
294
- );
295
-
296
- const handleChange = useCallback(
297
- (newValue: unknown) => {
298
- setLocalValue(newValue);
299
-
300
- const err = validationSchema
301
- ? (() => {
302
- const result = validationSchema.safeParse(newValue);
303
- return result.success
304
- ? null
305
- : result.error.issues[0]?.message || "Invalid value";
306
- })()
307
- : null;
308
-
309
- setValidationError(err);
310
-
311
- if (!err) {
312
- debouncedUpdate(newValue);
313
- }
314
- },
315
- [validationSchema, debouncedUpdate]
316
- );
317
-
318
- const inputClassName = useMemo(
319
- () =>
320
- cn(
321
- "h-full px-2 shadow-none border-0 rounded-none focus-visible:ring-0 focus-visible:ring-offset-0",
322
- validationError && "border border-destructive"
323
- ),
324
- [validationError]
325
- );
326
-
327
- if (editable && !schemaProperty?.readOnly) {
328
- if (fieldName && customRenderers?.[fieldName]) {
329
- const customRenderer = customRenderers?.[fieldName]!;
330
- return (
331
- <>
332
- {customRenderer({
333
- value: localValue,
334
- row,
335
- column,
336
- onUpdate: handleChange,
337
- error: validationError || undefined,
338
- schemaProperty,
339
- t,
340
- })}
341
- </>
342
- );
343
- }
344
-
345
- if (schemaProperty?.type === "boolean" || typeof value === "boolean") {
346
- return (
347
- <ErrorWrapper error={validationError} mode={errorDisplayMode}>
348
- <div className="flex items-center px-2">
349
- <Switch
350
- checked={!!localValue}
351
- onCheckedChange={handleChange}
352
- className={validationError ? "border-destructive" : ""}
353
- />
354
- </div>
355
- </ErrorWrapper>
356
- );
357
- }
358
-
359
- if (schemaProperty?.enum && Array.isArray(schemaProperty.enum)) {
360
- return (
361
- <ErrorWrapper error={validationError} mode={errorDisplayMode}>
362
- <div className="w-full h-full flex items-center">
363
- <Select value={String(localValue)} onValueChange={handleChange}>
364
- <SelectTrigger
365
- size="sm"
366
- className={cn(
367
- "h-[35px]! px-2 w-full shadow-none border-0 rounded-none focus:ring-0 focus:ring-offset-0",
368
- validationError && "border border-destructive"
369
- )}
370
- >
371
- <SelectValue />
372
- </SelectTrigger>
373
- <SelectContent>
374
- {schemaProperty.enum.map((option) => (
375
- <SelectItem key={String(option)} value={String(option)}>
376
- {String(option)}
377
- </SelectItem>
378
- ))}
379
- </SelectContent>
380
- </Select>
381
- </div>
382
- </ErrorWrapper>
383
- );
384
- }
385
-
386
- if (
387
- schemaProperty?.type === "number" ||
388
- schemaProperty?.type === "integer"
389
- ) {
390
- const handleNumberChange = (e: React.ChangeEvent<HTMLInputElement>) => {
391
- const val =
392
- schemaProperty.type === "integer"
393
- ? parseInt(e.target.value)
394
- : parseFloat(e.target.value);
395
- handleChange(isNaN(val) ? e.target.value : val);
396
- };
397
-
398
- return (
399
- <ErrorWrapper error={validationError} mode={errorDisplayMode}>
400
- <div className="w-full h-full flex items-center">
401
- <Input
402
- ref={inputRef}
403
- type="number"
404
- value={String(localValue ?? "")}
405
- onChange={handleNumberChange}
406
- className={inputClassName}
407
- />
408
- </div>
409
- </ErrorWrapper>
410
- );
411
- }
412
-
413
- if (
414
- schemaProperty?.format === "date" ||
415
- schemaProperty?.format === "date-time"
416
- ) {
417
- const dateValue =
418
- localValue instanceof Date
419
- ? localValue
420
- : localValue
421
- ? new Date(String(localValue))
422
- : undefined;
423
-
424
- const isDateTime = schemaProperty?.format === "date-time";
425
-
426
- if (!handleDateChangeRef.current) {
427
- handleDateChangeRef.current = (date: Date) => {
428
- if (!datePickerMountedRef.current) {
429
- datePickerMountedRef.current = true;
430
- return;
431
- }
432
-
433
- if (schemaProperty?.format === "date-time") {
434
- handleChange(date?.toISOString());
435
- } else {
436
- const isoDate = date?.toISOString().split("T")[0];
437
- handleChange(isoDate);
438
- }
439
- };
440
- }
441
-
442
- return (
443
- <ErrorWrapper error={validationError} mode={errorDisplayMode}>
444
- <DatePicker
445
- id={datePickerIdRef.current}
446
- showIcon={false}
447
- defaultValue={
448
- dateValue instanceof Date && !Number.isNaN(dateValue.getTime())
449
- ? dateValue
450
- : undefined
451
- }
452
- onChange={handleDateChangeRef.current}
453
- classNames={{
454
- dateInput: cn(
455
- "shadow-none border-0 h-8! rounded-none",
456
- validationError && "border border-destructive"
457
- ),
458
- }}
459
- useTime={isDateTime}
460
- />
461
- </ErrorWrapper>
462
- );
463
- }
464
-
465
- const inputType = schemaProperty?.format === "email" ? "email" : "text";
466
-
467
- return (
468
- <ErrorWrapper error={validationError} mode={errorDisplayMode}>
469
- <div className="w-full h-full flex items-center">
470
- <Input
471
- ref={inputRef}
472
- type={inputType}
473
- value={String(localValue ?? "")}
474
- onChange={(e) => handleChange(e.target.value)}
475
- className={inputClassName}
476
- />
477
- </div>
478
- </ErrorWrapper>
479
- );
480
- }
481
-
482
- if (fieldName && customRenderers?.[fieldName]) {
483
- const customRenderer = customRenderers?.[fieldName]!;
484
- return (
485
- <>
486
- {customRenderer({
487
- value: localValue,
488
- row,
489
- column,
490
- onUpdate: handleChange,
491
- error: validationError || undefined,
492
- schemaProperty,
493
- t,
494
- })}
495
- </>
496
- );
497
- }
498
- if (value === null || value === undefined) {
499
- return (
500
- <span className={cn("text-muted-foreground italic", className)}>—</span>
501
- );
502
- }
503
-
504
- if (schemaProperty?.type === "boolean" || typeof value === "boolean") {
505
- const yesLabel = t?.["cell.boolean.yes"] ?? "Yes";
506
- const noLabel = t?.["cell.boolean.no"] ?? "No";
507
- return (
508
- <Badge variant={value ? "default" : "secondary"} className={className}>
509
- {value ? yesLabel : noLabel}
510
- </Badge>
511
- );
512
- }
513
-
514
- if (
515
- schemaProperty?.format === "date" ||
516
- schemaProperty?.format === "date-time"
517
- ) {
518
- try {
519
- const date = value instanceof Date ? value : new Date(value as string);
520
-
521
- const defaultLocalization = localization || {
522
- locale: "en-US",
523
- timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
524
- lang: "en",
525
- };
526
-
527
- const defaultDateOptions =
528
- dateOptions ||
529
- (schemaProperty.format === "date"
530
- ? {
531
- day: "2-digit",
532
- month: "short",
533
- year: "numeric",
534
- }
535
- : {
536
- day: "2-digit",
537
- month: "short",
538
- year: "numeric",
539
- hour: "2-digit",
540
- minute: "2-digit",
541
- hour12: false,
542
- });
543
-
544
- return (
545
- <DateTooltip
546
- date={date}
547
- localization={defaultLocalization}
548
- dateOptions={defaultDateOptions}
549
- />
550
- );
551
- } catch {
552
- return <span className={className}>{String(value)}</span>;
553
- }
554
- }
555
-
556
- if (schemaProperty?.enum && Array.isArray(schemaProperty.enum)) {
557
- const label = String(value);
558
- return (
559
- <Badge variant="outline" className={cn("font-normal", className)}>
560
- {t?.[`column.${fieldName}.${label}`] || label}
561
- </Badge>
562
- );
563
- }
564
-
565
- if (schemaProperty?.format === "badge") {
566
- const variant = BADGE_VARIANT_MAP[String(value).toLowerCase()] || "outline";
567
- const label = String(value);
568
- return (
569
- <Badge variant={variant} className={className}>
570
- {t?.[`column.${fieldName}.${label}`] || label}
571
- </Badge>
572
- );
573
- }
574
-
575
- if (schemaProperty?.format === "uri") {
576
- return (
577
- <a
578
- href={String(value)}
579
- target="_blank"
580
- rel="noopener noreferrer"
581
- className={cn("text-primary hover:underline", className)}
582
- onClick={(e) => e.stopPropagation()}
583
- >
584
- {String(value)}
585
- </a>
586
- );
587
- }
588
-
589
- if (schemaProperty?.format === "uuid") {
590
- const uuid = String(value);
591
- return (
592
- <code className={cn("text-xs bg-muted 5 rounded", className)}>
593
- {uuid.slice(0, 8)}...
594
- </code>
595
- );
596
- }
597
-
598
- if (Array.isArray(value)) {
599
- return (
600
- <div className="flex flex-wrap gap-1">
601
- {value.slice(0, MAX_ARRAY_DISPLAY).map((item, idx) => (
602
- <Badge key={idx} variant="secondary" className="text-xs">
603
- {String(item)}
604
- </Badge>
605
- ))}
606
- {value.length > MAX_ARRAY_DISPLAY && (
607
- <Badge variant="outline" className="text-xs">
608
- +{value.length - MAX_ARRAY_DISPLAY}
609
- </Badge>
610
- )}
611
- </div>
612
- );
613
- }
614
-
615
- if (typeof value === "object") {
616
- return (
617
- <code className={cn("text-xs bg-muted rounded", className)}>
618
- {JSON.stringify(value)}
619
- </code>
620
- );
621
- }
622
-
623
- const strValue = String(value);
624
-
625
- if (strValue.length > MAX_STRING_LENGTH) {
626
- return (
627
- <span title={strValue} className={className}>
628
- {strValue.slice(0, MAX_STRING_LENGTH)}...
629
- </span>
630
- );
631
- }
632
-
633
- return <span className={className}>{strValue}</span>;
634
- }
1
+ import { Switch } from "@ayasofyazilim/ui/components/switch";
2
+ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
3
+ import { z } from "zod";
4
+ import { Badge } from "../../../../components/badge";
5
+ import { Input } from "../../../../components/input";
6
+ import {
7
+ Select,
8
+ SelectContent,
9
+ SelectItem,
10
+ SelectTrigger,
11
+ SelectValue,
12
+ } from "../../../../components/select";
13
+ import {
14
+ Tooltip,
15
+ TooltipContent,
16
+ TooltipTrigger,
17
+ } from "../../../../components/tooltip";
18
+ import { DatePicker } from "../../../date-picker";
19
+ import DateTooltip from "../../../date-tooltip";
20
+ import { cn } from "../../../../lib/utils";
21
+ import type {
22
+ CellRendererProps,
23
+ JSONSchemaProperty,
24
+ MasterDataGridResources,
25
+ } from "../../types";
26
+ import { getTranslations } from "../../utils/translation-utils";
27
+
28
+ const DEBOUNCE_DELAY = 150;
29
+ const MAX_STRING_LENGTH = 100;
30
+
31
+ const BADGE_VARIANT_MAP: Record<
32
+ string,
33
+ "default" | "secondary" | "outline" | "destructive"
34
+ > = {
35
+ active: "default",
36
+ inactive: "secondary",
37
+ pending: "outline",
38
+ success: "default",
39
+ warning: "destructive",
40
+ error: "destructive",
41
+ };
42
+
43
+ function createZodSchema(
44
+ schemaProperty?: JSONSchemaProperty,
45
+ t?: MasterDataGridResources,
46
+ ): z.ZodType {
47
+ if (!schemaProperty) return z.unknown();
48
+
49
+ let schema: z.ZodType;
50
+
51
+ switch (schemaProperty.type) {
52
+ case "string":
53
+ schema = z.string({
54
+ message: getTranslations("validation.invalidString", t),
55
+ });
56
+
57
+ if (schemaProperty.minLength !== undefined) {
58
+ schema = (schema as z.ZodString).min(
59
+ schemaProperty.minLength,
60
+ t?.["validation.min_length"]
61
+ ? (t["validation.min_length"] ?? "").replace(
62
+ "{min}",
63
+ String(schemaProperty.minLength),
64
+ )
65
+ : `Must be at least ${schemaProperty.minLength} characters`,
66
+ );
67
+ }
68
+ if (schemaProperty.maxLength !== undefined) {
69
+ schema = (schema as z.ZodString).max(
70
+ schemaProperty.maxLength,
71
+ t?.["validation.max_length"]
72
+ ? (t["validation.max_length"] ?? "").replace(
73
+ "{max}",
74
+ String(schemaProperty.maxLength),
75
+ )
76
+ : `Must be at most ${schemaProperty.maxLength} characters`,
77
+ );
78
+ }
79
+
80
+ if (schemaProperty.format === "email") {
81
+ schema = (schema as z.ZodString).email(
82
+ t?.["validation.invalid_email"] || "Must be a valid email address",
83
+ );
84
+ }
85
+ if (schemaProperty.format === "uri" || schemaProperty.format === "url") {
86
+ schema = z.url(t?.["validation.invalid_url"] || "Must be a valid URL");
87
+ }
88
+ if (schemaProperty.format === "uuid") {
89
+ schema = z.uuid(
90
+ t?.["validation.invalid_uuid"] || "Must be a valid UUID",
91
+ );
92
+ }
93
+ break;
94
+
95
+ case "number":
96
+ schema = z.number({
97
+ message: t?.["validation.invalid_number"] || "Must be a valid number",
98
+ });
99
+
100
+ if (schemaProperty.minimum !== undefined) {
101
+ schema = (schema as z.ZodNumber).min(
102
+ schemaProperty.minimum,
103
+ t?.["validation.min_value"]
104
+ ? (t["validation.min_value"] ?? "").replace(
105
+ "{min}",
106
+ String(schemaProperty.minimum),
107
+ )
108
+ : `Must be at least ${schemaProperty.minimum}`,
109
+ );
110
+ }
111
+ if (schemaProperty.maximum !== undefined) {
112
+ schema = (schema as z.ZodNumber).max(
113
+ schemaProperty.maximum,
114
+ t?.["validation.max_value"]
115
+ ? (t["validation.max_value"] ?? "").replace(
116
+ "{max}",
117
+ String(schemaProperty.maximum),
118
+ )
119
+ : `Must be at most ${schemaProperty.maximum}`,
120
+ );
121
+ }
122
+ break;
123
+
124
+ case "integer":
125
+ schema = z
126
+ .number({
127
+ message:
128
+ t?.["validation.invalid_integer"] || "Must be a valid integer",
129
+ })
130
+ .int(t?.["validation.must_be_integer"] || "Must be an integer");
131
+
132
+ if (schemaProperty.minimum !== undefined) {
133
+ schema = (schema as z.ZodNumber).min(
134
+ schemaProperty.minimum,
135
+ t?.["validation.min_value"]
136
+ ? (t["validation.min_value"] ?? "").replace(
137
+ "{min}",
138
+ String(schemaProperty.minimum),
139
+ )
140
+ : `Must be at least ${schemaProperty.minimum}`,
141
+ );
142
+ }
143
+ if (schemaProperty.maximum !== undefined) {
144
+ schema = (schema as z.ZodNumber).max(
145
+ schemaProperty.maximum,
146
+ t?.["validation.max_value"]
147
+ ? (t["validation.max_value"] ?? "").replace(
148
+ "{max}",
149
+ String(schemaProperty.maximum),
150
+ )
151
+ : `Must be at most ${schemaProperty.maximum}`,
152
+ );
153
+ }
154
+ break;
155
+
156
+ case "boolean":
157
+ schema = z.boolean({
158
+ message: t?.["validation.invalid_boolean"] || "Must be true or false",
159
+ });
160
+ break;
161
+
162
+ default:
163
+ schema = z.unknown();
164
+ }
165
+
166
+ if (schemaProperty.enum && Array.isArray(schemaProperty.enum)) {
167
+ schema = z.enum(
168
+ schemaProperty.enum as [string, ...string[]],
169
+ t?.["validation.invalid_enum"] || "Invalid value",
170
+ );
171
+ }
172
+
173
+ if (!schemaProperty.required) {
174
+ schema = schema.optional().nullable();
175
+ }
176
+
177
+ return schema;
178
+ }
179
+
180
+ interface ErrorWrapperProps {
181
+ error: string | null;
182
+ mode: "tooltip" | "inline" | "both";
183
+ children: React.ReactNode;
184
+ }
185
+
186
+ function ErrorWrapper({ error, mode, children }: ErrorWrapperProps) {
187
+ if (!error) return <>{children}</>;
188
+
189
+ const showTooltip = mode === "tooltip" || mode === "both";
190
+ const showInline = mode === "inline" || mode === "both";
191
+
192
+ const inlineError = showInline && (
193
+ <span className="text-[10px] text-destructive px-2 py-0.5 leading-tight animate-in fade-in slide-in-from-top-1">
194
+ {error}
195
+ </span>
196
+ );
197
+
198
+ if (showTooltip && !showInline) {
199
+ return (
200
+ <Tooltip>
201
+ <TooltipTrigger asChild>{children}</TooltipTrigger>
202
+ <TooltipContent side="bottom" className="max-w-xs">
203
+ {error}
204
+ </TooltipContent>
205
+ </Tooltip>
206
+ );
207
+ }
208
+
209
+ if (showInline && !showTooltip) {
210
+ return (
211
+ <div className="flex flex-col w-full h-full">
212
+ {children}
213
+ {inlineError}
214
+ </div>
215
+ );
216
+ }
217
+
218
+ return (
219
+ <Tooltip>
220
+ <TooltipTrigger asChild>
221
+ <div className="flex flex-col w-full h-full">
222
+ {children}
223
+ {inlineError}
224
+ </div>
225
+ </TooltipTrigger>
226
+ <TooltipContent side="bottom" className="max-w-xs">
227
+ {error}
228
+ </TooltipContent>
229
+ </Tooltip>
230
+ );
231
+ }
232
+
233
+ export function CellRenderer<TData = unknown>({
234
+ value,
235
+ row,
236
+ column,
237
+ schemaProperty,
238
+ editable = false,
239
+ onUpdate,
240
+ t,
241
+ error,
242
+ className,
243
+ dateOptions,
244
+ localization,
245
+ fieldName,
246
+ customRenderers,
247
+ errorDisplayMode = "tooltip",
248
+ }: CellRendererProps<TData>) {
249
+ const [localValue, setLocalValue] = useState(value);
250
+ const [validationError, setValidationError] = useState<string | null>(
251
+ error || null,
252
+ );
253
+ const inputRef = useRef<HTMLInputElement>(null);
254
+ const updateTimeoutRef = useRef<NodeJS.Timeout>(null);
255
+ const datePickerIdRef = useRef<string>(
256
+ `date-${schemaProperty?.title || "field"}-${Date.now()}`,
257
+ );
258
+ const datePickerMountedRef = useRef<boolean>(false);
259
+ const handleDateChangeRef = useRef<((date: Date) => void) | null>(null);
260
+
261
+ const validationSchema = useMemo(
262
+ () => (schemaProperty ? createZodSchema(schemaProperty, t) : null),
263
+ [schemaProperty, t],
264
+ );
265
+
266
+ useEffect(() => {
267
+ if (!editable) {
268
+ setLocalValue(value);
269
+ datePickerMountedRef.current = false;
270
+ }
271
+ }, [value, editable]);
272
+
273
+ useEffect(() => {
274
+ return () => {
275
+ if (updateTimeoutRef.current) {
276
+ clearTimeout(updateTimeoutRef.current);
277
+ }
278
+ };
279
+ }, []);
280
+
281
+ const debouncedUpdate = useCallback(
282
+ (newValue: unknown) => {
283
+ if (updateTimeoutRef.current) {
284
+ clearTimeout(updateTimeoutRef.current);
285
+ }
286
+ updateTimeoutRef.current = setTimeout(() => {
287
+ if (onUpdate) {
288
+ onUpdate(newValue);
289
+ }
290
+ }, DEBOUNCE_DELAY);
291
+ },
292
+ [onUpdate],
293
+ );
294
+
295
+ const handleChange = useCallback(
296
+ (newValue: unknown) => {
297
+ setLocalValue(newValue);
298
+
299
+ const err = validationSchema
300
+ ? (() => {
301
+ const result = validationSchema.safeParse(newValue);
302
+ return result.success
303
+ ? null
304
+ : result.error.issues[0]?.message || "Invalid value";
305
+ })()
306
+ : null;
307
+
308
+ setValidationError(err);
309
+
310
+ if (!err) {
311
+ debouncedUpdate(newValue);
312
+ }
313
+ },
314
+ [validationSchema, debouncedUpdate],
315
+ );
316
+
317
+ const inputClassName = useMemo(
318
+ () =>
319
+ cn(
320
+ "h-full px-2 shadow-none border-0 rounded-none focus-visible:ring-0 focus-visible:ring-offset-0",
321
+ validationError && "border border-destructive",
322
+ ),
323
+ [validationError],
324
+ );
325
+
326
+ if (editable && !schemaProperty?.readOnly) {
327
+ if (fieldName && customRenderers?.[fieldName]) {
328
+ const customRenderer = customRenderers?.[fieldName]!;
329
+ return (
330
+ <>
331
+ {customRenderer({
332
+ value: localValue,
333
+ row,
334
+ column,
335
+ onUpdate: handleChange,
336
+ error: validationError || undefined,
337
+ schemaProperty,
338
+ t,
339
+ })}
340
+ </>
341
+ );
342
+ }
343
+
344
+ if (schemaProperty?.type === "boolean" || typeof value === "boolean") {
345
+ return (
346
+ <ErrorWrapper error={validationError} mode={errorDisplayMode}>
347
+ <div className="flex items-center px-2">
348
+ <Switch
349
+ checked={!!localValue}
350
+ onCheckedChange={handleChange}
351
+ className={validationError ? "border-destructive" : ""}
352
+ />
353
+ </div>
354
+ </ErrorWrapper>
355
+ );
356
+ }
357
+
358
+ if (schemaProperty?.enum && Array.isArray(schemaProperty.enum)) {
359
+ return (
360
+ <ErrorWrapper error={validationError} mode={errorDisplayMode}>
361
+ <div className="w-full h-full flex items-center">
362
+ <Select value={String(localValue)} onValueChange={handleChange}>
363
+ <SelectTrigger
364
+ size="sm"
365
+ className={cn(
366
+ "h-[35px]! px-2 w-full shadow-none border-0 rounded-none focus:ring-0 focus:ring-offset-0",
367
+ validationError && "border border-destructive",
368
+ )}
369
+ >
370
+ <SelectValue />
371
+ </SelectTrigger>
372
+ <SelectContent>
373
+ {schemaProperty.enum.map((option) => (
374
+ <SelectItem key={String(option)} value={String(option)}>
375
+ {String(option)}
376
+ </SelectItem>
377
+ ))}
378
+ </SelectContent>
379
+ </Select>
380
+ </div>
381
+ </ErrorWrapper>
382
+ );
383
+ }
384
+
385
+ if (
386
+ schemaProperty?.type === "number" ||
387
+ schemaProperty?.type === "integer"
388
+ ) {
389
+ const handleNumberChange = (e: React.ChangeEvent<HTMLInputElement>) => {
390
+ const val =
391
+ schemaProperty.type === "integer"
392
+ ? parseInt(e.target.value)
393
+ : parseFloat(e.target.value);
394
+ handleChange(isNaN(val) ? e.target.value : val);
395
+ };
396
+
397
+ return (
398
+ <ErrorWrapper error={validationError} mode={errorDisplayMode}>
399
+ <div className="w-full h-full flex items-center">
400
+ <Input
401
+ ref={inputRef}
402
+ type="number"
403
+ value={String(localValue ?? "")}
404
+ onChange={handleNumberChange}
405
+ className={inputClassName}
406
+ />
407
+ </div>
408
+ </ErrorWrapper>
409
+ );
410
+ }
411
+
412
+ if (
413
+ schemaProperty?.format === "date" ||
414
+ schemaProperty?.format === "date-time"
415
+ ) {
416
+ const dateValue =
417
+ localValue instanceof Date
418
+ ? localValue
419
+ : localValue
420
+ ? new Date(String(localValue))
421
+ : undefined;
422
+
423
+ const isDateTime = schemaProperty?.format === "date-time";
424
+
425
+ if (!handleDateChangeRef.current) {
426
+ handleDateChangeRef.current = (date: Date) => {
427
+ if (!datePickerMountedRef.current) {
428
+ datePickerMountedRef.current = true;
429
+ return;
430
+ }
431
+
432
+ if (schemaProperty?.format === "date-time") {
433
+ handleChange(date?.toISOString());
434
+ } else {
435
+ const isoDate = date?.toISOString().split("T")[0];
436
+ handleChange(isoDate);
437
+ }
438
+ };
439
+ }
440
+
441
+ return (
442
+ <ErrorWrapper error={validationError} mode={errorDisplayMode}>
443
+ <DatePicker
444
+ id={datePickerIdRef.current}
445
+ showIcon={false}
446
+ defaultValue={
447
+ dateValue instanceof Date && !Number.isNaN(dateValue.getTime())
448
+ ? dateValue
449
+ : undefined
450
+ }
451
+ onChange={handleDateChangeRef.current}
452
+ classNames={{
453
+ dateInput: cn(
454
+ "shadow-none border-0 h-8! rounded-none",
455
+ validationError && "border border-destructive",
456
+ ),
457
+ }}
458
+ useTime={isDateTime}
459
+ />
460
+ </ErrorWrapper>
461
+ );
462
+ }
463
+
464
+ const inputType = schemaProperty?.format === "email" ? "email" : "text";
465
+
466
+ return (
467
+ <ErrorWrapper error={validationError} mode={errorDisplayMode}>
468
+ <div className="w-full h-full flex items-center">
469
+ <Input
470
+ ref={inputRef}
471
+ type={inputType}
472
+ value={String(localValue ?? "")}
473
+ onChange={(e) => handleChange(e.target.value)}
474
+ className={inputClassName}
475
+ />
476
+ </div>
477
+ </ErrorWrapper>
478
+ );
479
+ }
480
+
481
+ if (fieldName && customRenderers?.[fieldName]) {
482
+ const customRenderer = customRenderers?.[fieldName]!;
483
+ return (
484
+ <>
485
+ {customRenderer({
486
+ value: localValue,
487
+ row,
488
+ column,
489
+ onUpdate: handleChange,
490
+ error: validationError || undefined,
491
+ schemaProperty,
492
+ t,
493
+ })}
494
+ </>
495
+ );
496
+ }
497
+ if (value === null || value === undefined) {
498
+ return (
499
+ <span className={cn("text-muted-foreground italic", className)}>—</span>
500
+ );
501
+ }
502
+
503
+ if (schemaProperty?.type === "boolean" || typeof value === "boolean") {
504
+ const yesLabel = t?.["cell.boolean.yes"] ?? "Yes";
505
+ const noLabel = t?.["cell.boolean.no"] ?? "No";
506
+ return (
507
+ <Badge variant={value ? "default" : "secondary"} className={className}>
508
+ {value ? yesLabel : noLabel}
509
+ </Badge>
510
+ );
511
+ }
512
+
513
+ if (
514
+ schemaProperty?.format === "date" ||
515
+ schemaProperty?.format === "date-time"
516
+ ) {
517
+ try {
518
+ const date = value instanceof Date ? value : new Date(value as string);
519
+
520
+ const defaultLocalization = localization || {
521
+ locale: "en-US",
522
+ timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
523
+ lang: "en",
524
+ };
525
+
526
+ const defaultDateOptions =
527
+ dateOptions ||
528
+ (schemaProperty.format === "date"
529
+ ? {
530
+ day: "2-digit",
531
+ month: "short",
532
+ year: "numeric",
533
+ }
534
+ : {
535
+ day: "2-digit",
536
+ month: "short",
537
+ year: "numeric",
538
+ hour: "2-digit",
539
+ minute: "2-digit",
540
+ hour12: false,
541
+ });
542
+
543
+ return (
544
+ <DateTooltip
545
+ date={date}
546
+ localization={defaultLocalization}
547
+ dateOptions={defaultDateOptions}
548
+ />
549
+ );
550
+ } catch {
551
+ return <span className={className}>{String(value)}</span>;
552
+ }
553
+ }
554
+
555
+ if (schemaProperty?.enum && Array.isArray(schemaProperty.enum)) {
556
+ const label = String(value);
557
+ return (
558
+ <Badge variant="outline" className={cn("font-normal", className)}>
559
+ {t?.[`column.${fieldName}.${label}`] || label}
560
+ </Badge>
561
+ );
562
+ }
563
+
564
+ if (schemaProperty?.format === "badge") {
565
+ const variant = BADGE_VARIANT_MAP[String(value).toLowerCase()] || "outline";
566
+ const label = String(value);
567
+ return (
568
+ <Badge variant={variant} className={className}>
569
+ {t?.[`column.${fieldName}.${label}`] || label}
570
+ </Badge>
571
+ );
572
+ }
573
+
574
+ if (schemaProperty?.format === "uri") {
575
+ return (
576
+ <a
577
+ href={String(value)}
578
+ target="_blank"
579
+ rel="noopener noreferrer"
580
+ className={cn("text-primary hover:underline", className)}
581
+ onClick={(e) => e.stopPropagation()}
582
+ >
583
+ {String(value)}
584
+ </a>
585
+ );
586
+ }
587
+
588
+ if (schemaProperty?.format === "uuid") {
589
+ const uuid = String(value);
590
+ return (
591
+ <code className={cn("text-xs bg-muted 5 rounded", className)}>
592
+ {uuid.slice(0, 8)}...
593
+ </code>
594
+ );
595
+ }
596
+
597
+ if (Array.isArray(value)) {
598
+ const arrayString = value.map((item) => String(item)).join(", ");
599
+ return <span className={className}>{arrayString}</span>;
600
+ }
601
+
602
+ if (typeof value === "object") {
603
+ return (
604
+ <code className={cn("text-xs bg-muted rounded", className)}>
605
+ {JSON.stringify(value)}
606
+ </code>
607
+ );
608
+ }
609
+
610
+ const strValue = String(value);
611
+
612
+ if (strValue.length > MAX_STRING_LENGTH) {
613
+ return (
614
+ <span title={strValue} className={className}>
615
+ {strValue.slice(0, MAX_STRING_LENGTH)}...
616
+ </span>
617
+ );
618
+ }
619
+
620
+ return <span className={className}>{strValue}</span>;
621
+ }