@tirth_jasoliya/ui 1.0.5 → 1.0.6

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 (307) hide show
  1. package/dist/components/core/error.cjs +3 -0
  2. package/dist/components/core/error.cjs.map +1 -0
  3. package/dist/components/core/error.d.cts +5 -0
  4. package/dist/components/core/error.d.ts +5 -0
  5. package/dist/components/core/error.js +3 -0
  6. package/dist/components/core/error.js.map +1 -0
  7. package/dist/components/core/event-success.cjs +3 -0
  8. package/dist/components/core/event-success.cjs.map +1 -0
  9. package/dist/components/core/event-success.d.cts +5 -0
  10. package/dist/components/core/event-success.d.ts +5 -0
  11. package/dist/components/core/event-success.js +3 -0
  12. package/dist/components/core/event-success.js.map +1 -0
  13. package/dist/components/core/index.cjs +3 -0
  14. package/dist/components/core/index.cjs.map +1 -0
  15. package/dist/components/core/index.d.cts +7 -0
  16. package/dist/components/core/index.d.ts +7 -0
  17. package/dist/components/core/index.js +3 -0
  18. package/dist/components/core/index.js.map +1 -0
  19. package/dist/components/core/loader.cjs +3 -0
  20. package/dist/components/core/loader.cjs.map +1 -0
  21. package/dist/components/core/loader.d.cts +5 -0
  22. package/dist/components/core/loader.d.ts +5 -0
  23. package/dist/components/core/loader.js +3 -0
  24. package/dist/components/core/loader.js.map +1 -0
  25. package/dist/components/core/notfound.cjs +3 -0
  26. package/dist/components/core/notfound.cjs.map +1 -0
  27. package/dist/components/core/notfound.d.cts +5 -0
  28. package/dist/components/core/notfound.d.ts +5 -0
  29. package/dist/components/core/notfound.js +3 -0
  30. package/dist/components/core/notfound.js.map +1 -0
  31. package/dist/components/core/offline-content.cjs +3 -0
  32. package/dist/components/core/offline-content.cjs.map +1 -0
  33. package/dist/components/core/offline-content.d.cts +5 -0
  34. package/dist/components/core/offline-content.d.ts +5 -0
  35. package/dist/components/core/offline-content.js +3 -0
  36. package/dist/components/core/offline-content.js.map +1 -0
  37. package/dist/components/core/unauthorized.cjs +3 -0
  38. package/dist/components/core/unauthorized.cjs.map +1 -0
  39. package/dist/components/core/unauthorized.d.cts +5 -0
  40. package/dist/components/core/unauthorized.d.ts +5 -0
  41. package/dist/components/core/unauthorized.js +3 -0
  42. package/dist/components/core/unauthorized.js.map +1 -0
  43. package/dist/components/data/data-table/data-table-action-bar.cjs +3 -0
  44. package/dist/components/data/data-table/data-table-action-bar.cjs.map +1 -0
  45. package/dist/components/data/data-table/data-table-action-bar.d.cts +26 -0
  46. package/dist/components/data/data-table/data-table-action-bar.d.ts +26 -0
  47. package/dist/components/data/data-table/data-table-action-bar.js +3 -0
  48. package/dist/components/data/data-table/data-table-action-bar.js.map +1 -0
  49. package/dist/components/data/data-table/data-table-column-header.cjs +3 -0
  50. package/dist/components/data/data-table/data-table-column-header.cjs.map +1 -0
  51. package/dist/components/data/data-table/data-table-column-header.d.cts +11 -0
  52. package/dist/components/data/data-table/data-table-column-header.d.ts +11 -0
  53. package/dist/components/data/data-table/data-table-column-header.js +3 -0
  54. package/dist/components/data/data-table/data-table-column-header.js.map +1 -0
  55. package/dist/components/data/data-table/data-table-faceted-filter.cjs +3 -0
  56. package/dist/components/data/data-table/data-table-faceted-filter.cjs.map +1 -0
  57. package/dist/components/data/data-table/data-table-faceted-filter.d.cts +18 -0
  58. package/dist/components/data/data-table/data-table-faceted-filter.d.ts +18 -0
  59. package/dist/components/data/data-table/data-table-faceted-filter.js +3 -0
  60. package/dist/components/data/data-table/data-table-faceted-filter.js.map +1 -0
  61. package/dist/components/data/data-table/data-table-pagination.cjs +3 -0
  62. package/dist/components/data/data-table/data-table-pagination.cjs.map +1 -0
  63. package/dist/components/data/data-table/data-table-pagination.d.cts +12 -0
  64. package/dist/components/data/data-table/data-table-pagination.d.ts +12 -0
  65. package/dist/components/data/data-table/data-table-pagination.js +3 -0
  66. package/dist/components/data/data-table/data-table-pagination.js.map +1 -0
  67. package/dist/components/data/data-table/data-table-toolbar.cjs +3 -0
  68. package/dist/components/data/data-table/data-table-toolbar.cjs.map +1 -0
  69. package/dist/components/data/data-table/data-table-toolbar.d.cts +23 -0
  70. package/dist/components/data/data-table/data-table-toolbar.d.ts +23 -0
  71. package/dist/components/data/data-table/data-table-toolbar.js +3 -0
  72. package/dist/components/data/data-table/data-table-toolbar.js.map +1 -0
  73. package/dist/components/data/data-table/data-table-types.cjs +3 -0
  74. package/dist/components/data/data-table/data-table-types.cjs.map +1 -0
  75. package/dist/components/data/data-table/data-table-types.d.cts +69 -0
  76. package/dist/components/data/data-table/data-table-types.d.ts +69 -0
  77. package/dist/components/data/data-table/data-table-types.js +2 -0
  78. package/dist/components/data/data-table/data-table-types.js.map +1 -0
  79. package/dist/components/data/data-table/data-table-view-options.cjs +3 -0
  80. package/dist/components/data/data-table/data-table-view-options.cjs.map +1 -0
  81. package/dist/components/data/data-table/data-table-view-options.d.cts +9 -0
  82. package/dist/components/data/data-table/data-table-view-options.d.ts +9 -0
  83. package/dist/components/data/data-table/data-table-view-options.js +3 -0
  84. package/dist/components/data/data-table/data-table-view-options.js.map +1 -0
  85. package/dist/components/data/data-table/data-table.cjs +3 -0
  86. package/dist/components/data/data-table/data-table.cjs.map +1 -0
  87. package/dist/components/data/data-table/data-table.d.cts +8 -0
  88. package/dist/components/data/data-table/data-table.d.ts +8 -0
  89. package/dist/components/data/data-table/data-table.js +3 -0
  90. package/dist/components/data/data-table/data-table.js.map +1 -0
  91. package/dist/components/data/data-table/index.cjs +3 -0
  92. package/dist/components/data/data-table/index.cjs.map +1 -0
  93. package/dist/components/data/data-table/index.d.cts +16 -0
  94. package/dist/components/data/data-table/index.d.ts +16 -0
  95. package/dist/components/data/data-table/index.js +3 -0
  96. package/dist/components/data/data-table/index.js.map +1 -0
  97. package/dist/components/data/data-template/data-template-action-bar.cjs +3 -0
  98. package/dist/components/data/data-template/data-template-action-bar.cjs.map +1 -0
  99. package/dist/components/data/data-template/data-template-action-bar.d.cts +14 -0
  100. package/dist/components/data/data-template/data-template-action-bar.d.ts +14 -0
  101. package/dist/components/data/data-template/data-template-action-bar.js +3 -0
  102. package/dist/components/data/data-template/data-template-action-bar.js.map +1 -0
  103. package/dist/components/data/data-template/data-template-pagination.cjs +3 -0
  104. package/dist/components/data/data-template/data-template-pagination.cjs.map +1 -0
  105. package/dist/components/data/data-template/data-template-pagination.d.cts +17 -0
  106. package/dist/components/data/data-template/data-template-pagination.d.ts +17 -0
  107. package/dist/components/data/data-template/data-template-pagination.js +3 -0
  108. package/dist/components/data/data-template/data-template-pagination.js.map +1 -0
  109. package/dist/components/data/data-template/data-template-toolbar.cjs +3 -0
  110. package/dist/components/data/data-template/data-template-toolbar.cjs.map +1 -0
  111. package/dist/components/data/data-template/data-template-toolbar.d.cts +27 -0
  112. package/dist/components/data/data-template/data-template-toolbar.d.ts +27 -0
  113. package/dist/components/data/data-template/data-template-toolbar.js +3 -0
  114. package/dist/components/data/data-template/data-template-toolbar.js.map +1 -0
  115. package/dist/components/data/data-template/data-template-types.cjs +3 -0
  116. package/dist/components/data/data-template/data-template-types.cjs.map +1 -0
  117. package/dist/components/data/data-template/data-template-types.d.cts +107 -0
  118. package/dist/components/data/data-template/data-template-types.d.ts +107 -0
  119. package/dist/components/data/data-template/data-template-types.js +2 -0
  120. package/dist/components/data/data-template/data-template-types.js.map +1 -0
  121. package/dist/components/data/data-template/data-template.cjs +3 -0
  122. package/dist/components/data/data-template/data-template.cjs.map +1 -0
  123. package/dist/components/data/data-template/data-template.d.cts +8 -0
  124. package/dist/components/data/data-template/data-template.d.ts +8 -0
  125. package/dist/components/data/data-template/data-template.js +3 -0
  126. package/dist/components/data/data-template/data-template.js.map +1 -0
  127. package/dist/components/data/data-template/index.cjs +3 -0
  128. package/dist/components/data/data-template/index.cjs.map +1 -0
  129. package/dist/components/data/data-template/index.d.cts +8 -0
  130. package/dist/components/data/data-template/index.d.ts +8 -0
  131. package/dist/components/data/data-template/index.js +3 -0
  132. package/dist/components/data/data-template/index.js.map +1 -0
  133. package/dist/components/general.cjs +3 -0
  134. package/dist/components/general.cjs.map +1 -0
  135. package/dist/components/general.d.cts +51 -0
  136. package/dist/components/general.d.ts +51 -0
  137. package/dist/components/general.js +3 -0
  138. package/dist/components/general.js.map +1 -0
  139. package/dist/components/layouts/app-container.cjs +3 -0
  140. package/dist/components/layouts/app-container.cjs.map +1 -0
  141. package/dist/components/layouts/app-container.d.cts +13 -0
  142. package/dist/components/layouts/app-container.d.ts +13 -0
  143. package/dist/components/layouts/app-container.js +3 -0
  144. package/dist/components/layouts/app-container.js.map +1 -0
  145. package/dist/components/layouts/app-content.cjs +3 -0
  146. package/dist/components/layouts/app-content.cjs.map +1 -0
  147. package/dist/components/layouts/app-content.d.cts +45 -0
  148. package/dist/components/layouts/app-content.d.ts +45 -0
  149. package/dist/components/layouts/app-content.js +3 -0
  150. package/dist/components/layouts/app-content.js.map +1 -0
  151. package/dist/components/layouts/app-footer.cjs +3 -0
  152. package/dist/components/layouts/app-footer.cjs.map +1 -0
  153. package/dist/components/layouts/app-footer.d.cts +18 -0
  154. package/dist/components/layouts/app-footer.d.ts +18 -0
  155. package/dist/components/layouts/app-footer.js +3 -0
  156. package/dist/components/layouts/app-footer.js.map +1 -0
  157. package/dist/components/layouts/app-header.cjs +3 -0
  158. package/dist/components/layouts/app-header.cjs.map +1 -0
  159. package/dist/components/layouts/app-header.d.cts +19 -0
  160. package/dist/components/layouts/app-header.d.ts +19 -0
  161. package/dist/components/layouts/app-header.js +3 -0
  162. package/dist/components/layouts/app-header.js.map +1 -0
  163. package/dist/components/layouts/factories.cjs +3 -0
  164. package/dist/components/layouts/factories.cjs.map +1 -0
  165. package/dist/components/layouts/factories.d.cts +18 -0
  166. package/dist/components/layouts/factories.d.ts +18 -0
  167. package/dist/components/layouts/factories.js +3 -0
  168. package/dist/components/layouts/factories.js.map +1 -0
  169. package/dist/components/layouts/index.cjs +3 -0
  170. package/dist/components/layouts/index.cjs.map +1 -0
  171. package/dist/components/layouts/index.d.cts +8 -0
  172. package/dist/components/layouts/index.d.ts +8 -0
  173. package/dist/components/layouts/index.js +3 -0
  174. package/dist/components/layouts/index.js.map +1 -0
  175. package/dist/components/ui/badge.cjs +3 -0
  176. package/dist/components/ui/badge.cjs.map +1 -0
  177. package/dist/components/ui/badge.d.cts +13 -0
  178. package/dist/components/ui/badge.d.ts +13 -0
  179. package/dist/components/ui/badge.js +3 -0
  180. package/dist/components/ui/badge.js.map +1 -0
  181. package/dist/components/ui/button.cjs +3 -0
  182. package/dist/components/ui/button.cjs.map +1 -0
  183. package/dist/components/ui/button.d.cts +14 -0
  184. package/dist/components/ui/button.d.ts +14 -0
  185. package/dist/components/ui/button.js +3 -0
  186. package/dist/components/ui/button.js.map +1 -0
  187. package/dist/components/ui/card.cjs +3 -0
  188. package/dist/components/ui/card.cjs.map +1 -0
  189. package/dist/components/ui/card.d.cts +12 -0
  190. package/dist/components/ui/card.d.ts +12 -0
  191. package/dist/components/ui/card.js +3 -0
  192. package/dist/components/ui/card.js.map +1 -0
  193. package/dist/components/ui/checkbox.cjs +3 -0
  194. package/dist/components/ui/checkbox.cjs.map +1 -0
  195. package/dist/components/ui/checkbox.d.cts +7 -0
  196. package/dist/components/ui/checkbox.d.ts +7 -0
  197. package/dist/components/ui/checkbox.js +3 -0
  198. package/dist/components/ui/checkbox.js.map +1 -0
  199. package/dist/components/ui/command.cjs +3 -0
  200. package/dist/components/ui/command.cjs.map +1 -0
  201. package/dist/components/ui/command.d.cts +20 -0
  202. package/dist/components/ui/command.d.ts +20 -0
  203. package/dist/components/ui/command.js +3 -0
  204. package/dist/components/ui/command.js.map +1 -0
  205. package/dist/components/ui/dialog.cjs +3 -0
  206. package/dist/components/ui/dialog.cjs.map +1 -0
  207. package/dist/components/ui/dialog.d.cts +16 -0
  208. package/dist/components/ui/dialog.d.ts +16 -0
  209. package/dist/components/ui/dialog.js +3 -0
  210. package/dist/components/ui/dialog.js.map +1 -0
  211. package/dist/components/ui/dropdown-menu.cjs +3 -0
  212. package/dist/components/ui/dropdown-menu.cjs.map +1 -0
  213. package/dist/components/ui/dropdown-menu.d.cts +28 -0
  214. package/dist/components/ui/dropdown-menu.d.ts +28 -0
  215. package/dist/components/ui/dropdown-menu.js +3 -0
  216. package/dist/components/ui/dropdown-menu.js.map +1 -0
  217. package/dist/components/ui/input.cjs +3 -0
  218. package/dist/components/ui/input.cjs.map +1 -0
  219. package/dist/components/ui/input.d.cts +6 -0
  220. package/dist/components/ui/input.d.ts +6 -0
  221. package/dist/components/ui/input.js +3 -0
  222. package/dist/components/ui/input.js.map +1 -0
  223. package/dist/components/ui/popover.cjs +3 -0
  224. package/dist/components/ui/popover.cjs.map +1 -0
  225. package/dist/components/ui/popover.d.cts +10 -0
  226. package/dist/components/ui/popover.d.ts +10 -0
  227. package/dist/components/ui/popover.js +3 -0
  228. package/dist/components/ui/popover.js.map +1 -0
  229. package/dist/components/ui/select.cjs +3 -0
  230. package/dist/components/ui/select.cjs.map +1 -0
  231. package/dist/components/ui/select.d.cts +18 -0
  232. package/dist/components/ui/select.d.ts +18 -0
  233. package/dist/components/ui/select.js +3 -0
  234. package/dist/components/ui/select.js.map +1 -0
  235. package/dist/components/ui/separator.cjs +3 -0
  236. package/dist/components/ui/separator.cjs.map +1 -0
  237. package/dist/components/ui/separator.d.cts +7 -0
  238. package/dist/components/ui/separator.d.ts +7 -0
  239. package/dist/components/ui/separator.js +3 -0
  240. package/dist/components/ui/separator.js.map +1 -0
  241. package/dist/components/ui/sheet.cjs +3 -0
  242. package/dist/components/ui/sheet.cjs.map +1 -0
  243. package/dist/components/ui/sheet.d.cts +18 -0
  244. package/dist/components/ui/sheet.d.ts +18 -0
  245. package/dist/components/ui/sheet.js +3 -0
  246. package/dist/components/ui/sheet.js.map +1 -0
  247. package/dist/components/ui/table.cjs +3 -0
  248. package/dist/components/ui/table.cjs.map +1 -0
  249. package/dist/components/ui/table.d.cts +13 -0
  250. package/dist/components/ui/table.d.ts +13 -0
  251. package/dist/components/ui/table.js +3 -0
  252. package/dist/components/ui/table.js.map +1 -0
  253. package/dist/components/ui/toggle.cjs +3 -0
  254. package/dist/components/ui/toggle.cjs.map +1 -0
  255. package/dist/components/ui/toggle.d.cts +16 -0
  256. package/dist/components/ui/toggle.d.ts +16 -0
  257. package/dist/components/ui/toggle.js +3 -0
  258. package/dist/components/ui/toggle.js.map +1 -0
  259. package/dist/components/ui/tooltip.cjs +3 -0
  260. package/dist/components/ui/tooltip.cjs.map +1 -0
  261. package/dist/components/ui/tooltip.d.cts +10 -0
  262. package/dist/components/ui/tooltip.d.ts +10 -0
  263. package/dist/components/ui/tooltip.js +3 -0
  264. package/dist/components/ui/tooltip.js.map +1 -0
  265. package/dist/context/app-meta/context.cjs +3 -0
  266. package/dist/context/app-meta/context.cjs.map +1 -0
  267. package/dist/context/app-meta/context.d.cts +18 -0
  268. package/dist/context/app-meta/context.d.ts +18 -0
  269. package/dist/context/app-meta/context.js +3 -0
  270. package/dist/context/app-meta/context.js.map +1 -0
  271. package/dist/context/app-meta/hooks.cjs +3 -0
  272. package/dist/context/app-meta/hooks.cjs.map +1 -0
  273. package/dist/context/app-meta/hooks.d.cts +10 -0
  274. package/dist/context/app-meta/hooks.d.ts +10 -0
  275. package/dist/context/app-meta/hooks.js +3 -0
  276. package/dist/context/app-meta/hooks.js.map +1 -0
  277. package/dist/context/app-meta/index.cjs +3 -0
  278. package/dist/context/app-meta/index.cjs.map +1 -0
  279. package/dist/context/app-meta/index.d.cts +5 -0
  280. package/dist/context/app-meta/index.d.ts +5 -0
  281. package/dist/context/app-meta/index.js +3 -0
  282. package/dist/context/app-meta/index.js.map +1 -0
  283. package/dist/context/app-meta/types.cjs +3 -0
  284. package/dist/context/app-meta/types.cjs.map +1 -0
  285. package/dist/context/app-meta/types.d.cts +48 -0
  286. package/dist/context/app-meta/types.d.ts +48 -0
  287. package/dist/context/app-meta/types.js +2 -0
  288. package/dist/context/app-meta/types.js.map +1 -0
  289. package/dist/context/index.cjs +3 -0
  290. package/dist/context/index.cjs.map +1 -0
  291. package/dist/context/index.d.cts +5 -0
  292. package/dist/context/index.d.ts +5 -0
  293. package/dist/context/index.js +3 -0
  294. package/dist/context/index.js.map +1 -0
  295. package/dist/index.cjs +2 -3490
  296. package/dist/index.cjs.map +1 -1
  297. package/dist/index.d.cts +29 -410
  298. package/dist/index.d.ts +29 -410
  299. package/dist/index.js +2 -3442
  300. package/dist/index.js.map +1 -1
  301. package/dist/lib/utils.cjs +3 -0
  302. package/dist/lib/utils.cjs.map +1 -0
  303. package/dist/lib/utils.d.cts +5 -0
  304. package/dist/lib/utils.d.ts +5 -0
  305. package/dist/lib/utils.js +3 -0
  306. package/dist/lib/utils.js.map +1 -0
  307. package/package.json +32 -11
package/dist/index.cjs CHANGED
@@ -1,3491 +1,3 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // src/index.ts
31
- var index_exports = {};
32
- __export(index_exports, {
33
- AppMetaProvider: () => AppMetaProvider,
34
- CurrencyTransfer: () => CurrencyTransfer,
35
- DataTable: () => DataTable,
36
- DataTableActionBar: () => DataTableActionBar,
37
- DataTableActionBarAction: () => DataTableActionBarAction,
38
- DataTableActionBarSelection: () => DataTableActionBarSelection,
39
- DataTemplate: () => DataTemplate,
40
- DataTemplateActionBar: () => DataTemplateActionBar,
41
- DataTemplateActionBarAction: () => DataTemplateActionBarAction,
42
- DataTemplateActionBarSelection: () => DataTemplateActionBarSelection,
43
- ErrorComponent: () => ErrorComponent,
44
- GeneralHelper: () => GeneralHelper,
45
- Loader: () => Loader4,
46
- NotFound: () => NotFound,
47
- OfflineUI: () => OfflineUI,
48
- Unauthorized: () => Unauthorized,
49
- createLayoutComponents: () => createLayoutComponents,
50
- createPageTemplateHook: () => createPageTemplateHook,
51
- createTypedAppMetaContext: () => createTypedAppMetaContext
52
- });
53
- module.exports = __toCommonJS(index_exports);
54
-
55
- // src/components/data/data-table/data-table.tsx
56
- var import_react_table = require("@tanstack/react-table");
57
- var import_lucide_react5 = require("lucide-react");
58
-
59
- // src/components/ui/button.tsx
60
- var import_radix_ui = require("radix-ui");
61
- var import_class_variance_authority = require("class-variance-authority");
62
-
63
- // src/lib/utils.ts
64
- var import_clsx = require("clsx");
65
- var import_tailwind_merge = require("tailwind-merge");
66
- function cn(...inputs) {
67
- return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
68
- }
69
-
70
- // src/components/ui/button.tsx
71
- var import_jsx_runtime = require("react/jsx-runtime");
72
- var buttonVariants = (0, import_class_variance_authority.cva)(
73
- "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
74
- {
75
- variants: {
76
- variant: {
77
- default: "bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",
78
- destructive: "bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
79
- outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
80
- secondary: "bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",
81
- ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
82
- link: "text-primary underline-offset-4 hover:underline"
83
- },
84
- size: {
85
- default: "h-9 px-4 py-2 has-[>svg]:px-3",
86
- sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
87
- lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
88
- icon: "size-9"
89
- }
90
- },
91
- defaultVariants: {
92
- variant: "default",
93
- size: "default"
94
- }
95
- }
96
- );
97
- function Button({
98
- className,
99
- variant,
100
- size,
101
- asChild = false,
102
- ...props
103
- }) {
104
- const Comp = asChild ? import_radix_ui.Slot.Slot : "button";
105
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
106
- Comp,
107
- {
108
- "data-slot": "button",
109
- className: cn(buttonVariants({ variant, size, className }), "transition-none"),
110
- ...props
111
- }
112
- );
113
- }
114
-
115
- // src/components/ui/table.tsx
116
- var import_jsx_runtime2 = require("react/jsx-runtime");
117
- function Table({ className, ...props }) {
118
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
119
- "div",
120
- {
121
- "data-slot": "table-container",
122
- className: "relative w-full overflow-auto max-h-full",
123
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
124
- "table",
125
- {
126
- "data-slot": "table",
127
- className: cn("w-full caption-bottom text-sm", className),
128
- ...props
129
- }
130
- )
131
- }
132
- );
133
- }
134
- function TableHeader({ className, ...props }) {
135
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
136
- "thead",
137
- {
138
- "data-slot": "table-header",
139
- className: cn("[&_tr]:border-b", className),
140
- ...props
141
- }
142
- );
143
- }
144
- function TableBody({ className, ...props }) {
145
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
146
- "tbody",
147
- {
148
- "data-slot": "table-body",
149
- className: cn("[&_tr:last-child]:border-0", className),
150
- ...props
151
- }
152
- );
153
- }
154
- function TableFooter({ className, ...props }) {
155
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
156
- "tfoot",
157
- {
158
- "data-slot": "table-footer",
159
- className: cn(
160
- "bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",
161
- className
162
- ),
163
- ...props
164
- }
165
- );
166
- }
167
- function TableRow({ className, ...props }) {
168
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
169
- "tr",
170
- {
171
- "data-slot": "table-row",
172
- className: cn(
173
- "hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",
174
- className
175
- ),
176
- ...props
177
- }
178
- );
179
- }
180
- function TableHead({ className, ...props }) {
181
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
182
- "th",
183
- {
184
- "data-slot": "table-head",
185
- className: cn(
186
- "text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap",
187
- className
188
- ),
189
- ...props
190
- }
191
- );
192
- }
193
- function TableCell({ className, ...props }) {
194
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
195
- "td",
196
- {
197
- "data-slot": "table-cell",
198
- className: cn(
199
- "p-2 align-middle whitespace-nowrap",
200
- className
201
- ),
202
- ...props
203
- }
204
- );
205
- }
206
-
207
- // src/components/ui/card.tsx
208
- var import_jsx_runtime3 = require("react/jsx-runtime");
209
- function Card({ className, ...props }) {
210
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
211
- "div",
212
- {
213
- "data-slot": "card",
214
- className: cn(
215
- "bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",
216
- className
217
- ),
218
- ...props
219
- }
220
- );
221
- }
222
- function CardContent({ className, ...props }) {
223
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
224
- "div",
225
- {
226
- "data-slot": "card-content",
227
- className: cn("px-6", className),
228
- ...props
229
- }
230
- );
231
- }
232
-
233
- // src/components/ui/tooltip.tsx
234
- var import_radix_ui2 = require("radix-ui");
235
- var import_jsx_runtime4 = require("react/jsx-runtime");
236
- function TooltipProvider({
237
- delayDuration = 0,
238
- ...props
239
- }) {
240
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
241
- import_radix_ui2.Tooltip.Provider,
242
- {
243
- "data-slot": "tooltip-provider",
244
- delayDuration,
245
- ...props
246
- }
247
- );
248
- }
249
- function Tooltip({
250
- ...props
251
- }) {
252
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_radix_ui2.Tooltip.Root, { "data-slot": "tooltip", ...props }) });
253
- }
254
- function TooltipTrigger({
255
- ...props
256
- }) {
257
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_radix_ui2.Tooltip.Trigger, { "data-slot": "tooltip-trigger", ...props });
258
- }
259
- function TooltipContent({
260
- className,
261
- sideOffset = 0,
262
- children,
263
- ...props
264
- }) {
265
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_radix_ui2.Tooltip.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
266
- import_radix_ui2.Tooltip.Content,
267
- {
268
- "data-slot": "tooltip-content",
269
- sideOffset,
270
- className: cn(
271
- "bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",
272
- className
273
- ),
274
- ...props,
275
- children: [
276
- children,
277
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_radix_ui2.Tooltip.Arrow, { className: "bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" })
278
- ]
279
- }
280
- ) });
281
- }
282
-
283
- // src/components/data/data-table/data-table-toolbar.tsx
284
- var import_lucide_react3 = require("lucide-react");
285
-
286
- // src/components/ui/input.tsx
287
- var import_jsx_runtime5 = require("react/jsx-runtime");
288
- function Input({ className, type, ...props }) {
289
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
290
- "input",
291
- {
292
- type,
293
- "data-slot": "input",
294
- className: cn(
295
- "file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
296
- "focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
297
- "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
298
- className
299
- ),
300
- ...props
301
- }
302
- );
303
- }
304
-
305
- // src/components/ui/select.tsx
306
- var import_radix_ui3 = require("radix-ui");
307
- var import_lucide_react = require("lucide-react");
308
- var import_jsx_runtime6 = require("react/jsx-runtime");
309
- function Select({
310
- ...props
311
- }) {
312
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_radix_ui3.Select.Root, { "data-slot": "select", ...props });
313
- }
314
- function SelectValue({
315
- ...props
316
- }) {
317
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_radix_ui3.Select.Value, { "data-slot": "select-value", ...props });
318
- }
319
- function SelectTrigger({
320
- className,
321
- size = "default",
322
- children,
323
- ...props
324
- }) {
325
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
326
- import_radix_ui3.Select.Trigger,
327
- {
328
- "data-slot": "select-trigger",
329
- "data-size": size,
330
- className: cn(
331
- "border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
332
- className
333
- ),
334
- ...props,
335
- children: [
336
- children,
337
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_radix_ui3.Select.Icon, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react.ChevronDownIcon, { className: "size-4 opacity-50" }) })
338
- ]
339
- }
340
- );
341
- }
342
- function SelectContent({
343
- className,
344
- children,
345
- position = "popper",
346
- ...props
347
- }) {
348
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_radix_ui3.Select.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
349
- import_radix_ui3.Select.Content,
350
- {
351
- "data-slot": "select-content",
352
- className: cn(
353
- "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",
354
- position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
355
- className
356
- ),
357
- position,
358
- ...props,
359
- children: [
360
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SelectScrollUpButton, {}),
361
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
362
- import_radix_ui3.Select.Viewport,
363
- {
364
- className: cn(
365
- "p-1",
366
- position === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"
367
- ),
368
- children
369
- }
370
- ),
371
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SelectScrollDownButton, {})
372
- ]
373
- }
374
- ) });
375
- }
376
- function SelectItem({
377
- className,
378
- children,
379
- ...props
380
- }) {
381
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
382
- import_radix_ui3.Select.Item,
383
- {
384
- "data-slot": "select-item",
385
- className: cn(
386
- "focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
387
- className
388
- ),
389
- ...props,
390
- children: [
391
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "absolute right-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_radix_ui3.Select.ItemIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react.CheckIcon, { className: "size-4" }) }) }),
392
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_radix_ui3.Select.ItemText, { children })
393
- ]
394
- }
395
- );
396
- }
397
- function SelectScrollUpButton({
398
- className,
399
- ...props
400
- }) {
401
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
402
- import_radix_ui3.Select.ScrollUpButton,
403
- {
404
- "data-slot": "select-scroll-up-button",
405
- className: cn(
406
- "flex cursor-default items-center justify-center py-1",
407
- className
408
- ),
409
- ...props,
410
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react.ChevronUpIcon, { className: "size-4" })
411
- }
412
- );
413
- }
414
- function SelectScrollDownButton({
415
- className,
416
- ...props
417
- }) {
418
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
419
- import_radix_ui3.Select.ScrollDownButton,
420
- {
421
- "data-slot": "select-scroll-down-button",
422
- className: cn(
423
- "flex cursor-default items-center justify-center py-1",
424
- className
425
- ),
426
- ...props,
427
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react.ChevronDownIcon, { className: "size-4" })
428
- }
429
- );
430
- }
431
-
432
- // src/components/ui/dropdown-menu.tsx
433
- var import_radix_ui4 = require("radix-ui");
434
- var import_lucide_react2 = require("lucide-react");
435
- var import_jsx_runtime7 = require("react/jsx-runtime");
436
- function DropdownMenu({
437
- ...props
438
- }) {
439
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_radix_ui4.DropdownMenu.Root, { "data-slot": "dropdown-menu", ...props });
440
- }
441
- function DropdownMenuTrigger({
442
- ...props
443
- }) {
444
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
445
- import_radix_ui4.DropdownMenu.Trigger,
446
- {
447
- "data-slot": "dropdown-menu-trigger",
448
- ...props
449
- }
450
- );
451
- }
452
- function DropdownMenuContent({
453
- className,
454
- sideOffset = 4,
455
- ...props
456
- }) {
457
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_radix_ui4.DropdownMenu.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
458
- import_radix_ui4.DropdownMenu.Content,
459
- {
460
- "data-slot": "dropdown-menu-content",
461
- sideOffset,
462
- className: cn(
463
- "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) rounded-md border p-1 shadow-md",
464
- className
465
- ),
466
- ...props
467
- }
468
- ) });
469
- }
470
- function DropdownMenuGroup({
471
- ...props
472
- }) {
473
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_radix_ui4.DropdownMenu.Group, { "data-slot": "dropdown-menu-group", ...props });
474
- }
475
- function DropdownMenuItem({
476
- className,
477
- inset,
478
- variant = "default",
479
- ...props
480
- }) {
481
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
482
- import_radix_ui4.DropdownMenu.Item,
483
- {
484
- "data-slot": "dropdown-menu-item",
485
- "data-inset": inset,
486
- "data-variant": variant,
487
- className: cn(
488
- "cursor-pointer focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
489
- className
490
- ),
491
- ...props
492
- }
493
- );
494
- }
495
- function DropdownMenuCheckboxItem({
496
- className,
497
- children,
498
- checked,
499
- ...props
500
- }) {
501
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
502
- import_radix_ui4.DropdownMenu.CheckboxItem,
503
- {
504
- "data-slot": "dropdown-menu-checkbox-item",
505
- className: cn(
506
- "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
507
- className
508
- ),
509
- checked,
510
- ...props,
511
- children: [
512
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_radix_ui4.DropdownMenu.ItemIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react2.CheckIcon, { className: "size-4" }) }) }),
513
- children
514
- ]
515
- }
516
- );
517
- }
518
- function DropdownMenuLabel({
519
- className,
520
- inset,
521
- ...props
522
- }) {
523
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
524
- import_radix_ui4.DropdownMenu.Label,
525
- {
526
- "data-slot": "dropdown-menu-label",
527
- "data-inset": inset,
528
- className: cn(
529
- "px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",
530
- className
531
- ),
532
- ...props
533
- }
534
- );
535
- }
536
- function DropdownMenuSeparator({
537
- className,
538
- ...props
539
- }) {
540
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
541
- import_radix_ui4.DropdownMenu.Separator,
542
- {
543
- "data-slot": "dropdown-menu-separator",
544
- className: cn("bg-border -mx-1 my-1 h-px", className),
545
- ...props
546
- }
547
- );
548
- }
549
-
550
- // src/components/data/data-table/data-table-toolbar.tsx
551
- var import_jsx_runtime8 = require("react/jsx-runtime");
552
- function DataTableToolbar({
553
- table,
554
- filters = [],
555
- globalFilter,
556
- onGlobalFilterChange,
557
- enableGlobalFilter = true,
558
- onExport,
559
- onRefresh,
560
- loading = false,
561
- enableColumnVisibility = true,
562
- data,
563
- onClearSorting,
564
- onClearFilters,
565
- enableColumnPinning = false
566
- }) {
567
- const getAllLeafColumns = () => {
568
- return table.getAllLeafColumns().filter((column) => column.getCanHide?.() !== false);
569
- };
570
- const getGroupColumns = () => {
571
- return table.getAllColumns().filter(
572
- (column) => !table.getAllLeafColumns().includes(column) && column.columns?.length && column.columns.some((col) => col.getCanHide?.() !== false)
573
- );
574
- };
575
- const getUngroupedLeafColumns = () => {
576
- const groupedColumnIds = new Set(
577
- getGroupColumns().flatMap(
578
- (group) => group.columns?.filter((col) => col.getCanHide?.() !== false).map((c) => c.id) || []
579
- )
580
- );
581
- return getAllLeafColumns().filter((column) => !groupedColumnIds.has(column.id));
582
- };
583
- const getColumnDisplayName = (columnId, groupName) => {
584
- if (groupName && columnId.startsWith(`${groupName}.`)) {
585
- const cleanId = columnId.replace(`${groupName}.`, "");
586
- return cleanId.split("_").map((word) => word.slice(1)).join(" ");
587
- }
588
- return columnId.split("_").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
589
- };
590
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "rounded-xl", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "px-2", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "flex flex-col gap-6", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex items-center justify-between", children: [
591
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "flex items-center gap-3", children: filters.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex items-center gap-3 flex-wrap", children: [
592
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "flex items-center gap-2 text-sm font-medium text-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react3.Filter, { className: "h-4 w-4" }) }),
593
- filters.map((filter) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: cn("relative min-w-[150px]", filter.width), children: filter.type === "select" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
594
- Select,
595
- {
596
- value: table.getColumn(filter.key)?.getFilterValue() ?? "",
597
- onValueChange: (value) => table.getColumn(filter.key)?.setFilterValue(value === "all" ? "" : value),
598
- children: [
599
- filter.icon && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(filter.icon, { className: "size-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground" }) }),
600
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SelectTrigger, { className: cn("h-9 rounded-lg w-full", filter.icon && "pl-9"), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SelectValue, { placeholder: filter.placeholder }) }),
601
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(SelectContent, { className: "rounded-lg", children: [
602
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SelectItem, { value: "all", children: "All" }),
603
- filter.options?.map((option) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SelectItem, { value: option.value, children: option.label }, option.label))
604
- ] })
605
- ]
606
- }
607
- ) : /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "relative", children: [
608
- filter.icon && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(filter.icon, { className: "size-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground" }) }),
609
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
610
- Input,
611
- {
612
- placeholder: filter.placeholder,
613
- value: table.getColumn(filter.key)?.getFilterValue() ?? "",
614
- onChange: (event) => table.getColumn(filter.key)?.setFilterValue(event.target.value),
615
- className: cn("h-9 rounded-lg", filter.icon && "pl-9"),
616
- type: filter.type === "number" ? "number" : filter.type === "date" ? "date" : "text"
617
- }
618
- )
619
- ] }) }, filter.key))
620
- ] }) }),
621
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex items-center gap-2", children: [
622
- enableGlobalFilter && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "relative", children: [
623
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react3.Search, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
624
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
625
- Input,
626
- {
627
- placeholder: "Global search...",
628
- value: globalFilter ?? "",
629
- onChange: (event) => onGlobalFilterChange(event.target.value),
630
- className: "pl-9 max-w-max"
631
- }
632
- )
633
- ] }),
634
- onExport && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Button, { variant: "outline", size: "sm", onClick: () => onExport(data), className: "rounded-lg", children: [
635
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react3.Download, { className: "mr-2 h-4 w-4" }),
636
- "Export"
637
- ] }),
638
- enableColumnVisibility && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(DropdownMenu, { children: [
639
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Button, { variant: "outline", size: "sm", className: "rounded-lg gap-1", children: [
640
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: "Columns" }),
641
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react3.ChevronDown, { className: "h-4 w-4 opacity-50" })
642
- ] }) }),
643
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(DropdownMenuContent, { align: "end", className: "w-[220px] rounded-lg max-h-[400px] overflow-y-auto", children: [
644
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DropdownMenuLabel, { className: "px-4 py-2 text-sm font-medium", children: "Toggle Columns" }),
645
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DropdownMenuSeparator, {}),
646
- getUngroupedLeafColumns().length > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(DropdownMenuGroup, { children: [
647
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DropdownMenuLabel, { className: "px-4 py-1.5 text-sm font-medium text-muted-foreground", children: "General" }),
648
- getUngroupedLeafColumns().map((column) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
649
- DropdownMenuCheckboxItem,
650
- {
651
- className: "text-sm",
652
- checked: column.getIsVisible(),
653
- onCheckedChange: (value) => column.toggleVisibility(!!value),
654
- children: getColumnDisplayName(column.id)
655
- },
656
- column.id
657
- ))
658
- ] }),
659
- getGroupColumns().map((group) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(DropdownMenuGroup, { children: [
660
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DropdownMenuSeparator, {}),
661
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DropdownMenuLabel, { className: "px-4 py-1.5 text-sm font-medium text-muted-foreground", children: group.id }),
662
- group.columns?.filter((column) => column.getCanHide?.() !== false).map((column) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
663
- DropdownMenuCheckboxItem,
664
- {
665
- className: "text-sm",
666
- checked: column.getIsVisible(),
667
- onCheckedChange: (value) => column.toggleVisibility(!!value),
668
- children: getColumnDisplayName(column.id, group.id)
669
- },
670
- column.id
671
- ))
672
- ] }, group.id))
673
- ] })
674
- ] }),
675
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(DropdownMenu, { children: [
676
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Button, { variant: "outline", size: "sm", className: "rounded-lg", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react3.Settings2, { className: "h-4 w-4" }) }) }),
677
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(DropdownMenuContent, { align: "end", className: "w-[200px] rounded-lg", children: [
678
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DropdownMenuLabel, { children: "Table Settings" }),
679
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DropdownMenuSeparator, {}),
680
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(DropdownMenuItem, { onClick: onClearSorting, children: [
681
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react3.ArrowUpDown, { className: "mr-2 h-4 w-4" }),
682
- "Clear All Sorting"
683
- ] }),
684
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(DropdownMenuItem, { onClick: onClearFilters, children: [
685
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react3.Filter, { className: "mr-2 h-4 w-4" }),
686
- "Clear All Filters"
687
- ] }),
688
- enableColumnPinning && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
689
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DropdownMenuSeparator, {}),
690
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DropdownMenuLabel, { children: "Column Pinning" }),
691
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
692
- DropdownMenuItem,
693
- {
694
- onClick: () => table.setColumnPinning({ left: [], right: [] }),
695
- children: [
696
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react3.PinOff, { className: "mr-2 h-4 w-4" }),
697
- "Reset All Pinning"
698
- ]
699
- }
700
- ),
701
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
702
- DropdownMenuItem,
703
- {
704
- onClick: () => {
705
- const leftColumns = getAllLeafColumns().filter((column) => column.getCanPin?.() !== false).map((column) => column.id);
706
- table.setColumnPinning({ left: leftColumns, right: [] });
707
- },
708
- children: [
709
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react3.Pin, { className: "mr-2 h-4 w-4 rotate-90" }),
710
- "Pin All Left"
711
- ]
712
- }
713
- ),
714
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
715
- DropdownMenuItem,
716
- {
717
- onClick: () => {
718
- const rightColumns = getAllLeafColumns().filter((column) => column.getCanPin?.() !== false).map((column) => column.id);
719
- table.setColumnPinning({ left: [], right: rightColumns });
720
- },
721
- children: [
722
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react3.Pin, { className: "mr-2 h-4 w-4 -rotate-90" }),
723
- "Pin All Right"
724
- ]
725
- }
726
- )
727
- ] })
728
- ] })
729
- ] }),
730
- onRefresh && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Button, { variant: "outline", size: "sm", onClick: onRefresh, disabled: loading, className: "rounded-lg", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react3.RefreshCw, { className: cn("h-4 w-4", loading && "animate-spin") }) })
731
- ] })
732
- ] }) }) }) });
733
- }
734
-
735
- // src/components/data/data-table/data-table-pagination.tsx
736
- var import_jsx_runtime9 = require("react/jsx-runtime");
737
- function DataTablePagination({ table, config }) {
738
- if (!config.enabled) return null;
739
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "rounded-xl", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center justify-between", children: [
740
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex items-center gap-6 text-sm text-muted-foreground", children: config.showInfo !== false && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { children: [
741
- "Showing ",
742
- table.getState().pagination.pageIndex * table.getState().pagination.pageSize + 1,
743
- " to",
744
- " ",
745
- Math.min(
746
- (table.getState().pagination.pageIndex + 1) * table.getState().pagination.pageSize,
747
- table.getFilteredRowModel().rows.length
748
- ),
749
- " ",
750
- "of ",
751
- table.getFilteredRowModel().rows.length,
752
- " entries"
753
- ] }) }),
754
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-4", children: [
755
- config.pageSizeOptions && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-2", children: [
756
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-sm font-medium", children: "Rows per page:" }),
757
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
758
- Select,
759
- {
760
- value: `${table.getState().pagination.pageSize}`,
761
- onValueChange: (value) => table.setPageSize(Number(value)),
762
- children: [
763
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SelectTrigger, { className: "h-9 w-[70px] rounded-lg", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SelectValue, {}) }),
764
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SelectContent, { side: "top", className: "rounded-lg", children: config.pageSizeOptions.map((pageSize) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SelectItem, { value: `${pageSize}`, children: pageSize }, pageSize)) })
765
- ]
766
- }
767
- )
768
- ] }),
769
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-2", children: [
770
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
771
- Button,
772
- {
773
- variant: "outline",
774
- size: "sm",
775
- onClick: () => table.setPageIndex(0),
776
- disabled: !table.getCanPreviousPage(),
777
- className: "rounded-lg",
778
- children: "First"
779
- }
780
- ),
781
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
782
- Button,
783
- {
784
- variant: "outline",
785
- size: "sm",
786
- onClick: () => table.previousPage(),
787
- disabled: !table.getCanPreviousPage(),
788
- className: "rounded-lg",
789
- children: "Previous"
790
- }
791
- ),
792
- config.showPageNumbers && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex items-center gap-1", children: Array.from({ length: Math.min(5, table.getPageCount()) }, (_, i) => {
793
- const pageIndex = table.getState().pagination.pageIndex;
794
- const pageNumber = pageIndex - 2 + i + 1;
795
- if (pageNumber < 1 || pageNumber > table.getPageCount()) return null;
796
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
797
- Button,
798
- {
799
- variant: pageNumber === pageIndex + 1 ? "default" : "outline",
800
- size: "sm",
801
- className: "size-8 p-0 rounded-lg",
802
- onClick: () => table.setPageIndex(pageNumber - 1),
803
- children: pageNumber
804
- },
805
- pageNumber
806
- );
807
- }) }),
808
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
809
- Button,
810
- {
811
- variant: "outline",
812
- size: "sm",
813
- onClick: () => table.nextPage(),
814
- disabled: !table.getCanNextPage(),
815
- className: "rounded-lg",
816
- children: "Next"
817
- }
818
- ),
819
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
820
- Button,
821
- {
822
- variant: "outline",
823
- size: "sm",
824
- onClick: () => table.setPageIndex(table.getPageCount() - 1),
825
- disabled: !table.getCanNextPage(),
826
- className: "rounded-lg",
827
- children: "Last"
828
- }
829
- )
830
- ] })
831
- ] })
832
- ] }) }) });
833
- }
834
-
835
- // src/components/ui/toggle.tsx
836
- var import_radix_ui5 = require("radix-ui");
837
- var import_class_variance_authority2 = require("class-variance-authority");
838
- var import_jsx_runtime10 = require("react/jsx-runtime");
839
- var toggleVariants = (0, import_class_variance_authority2.cva)(
840
- "inline-flex cursor-pointer items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none transition-[color,box-shadow] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap",
841
- {
842
- variants: {
843
- variant: {
844
- default: "bg-transparent",
845
- outline: "border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"
846
- },
847
- size: {
848
- sm: "h-7 px-0 min-w-7",
849
- default: "h-8 px-1 min-w-8",
850
- lg: "h-9 px-2 min-w-10"
851
- },
852
- bg: {
853
- enabled: "data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",
854
- disabled: ""
855
- }
856
- },
857
- defaultVariants: {
858
- variant: "default",
859
- size: "default",
860
- bg: "enabled"
861
- }
862
- }
863
- );
864
- function Toggle({
865
- className,
866
- variant,
867
- size,
868
- noBg,
869
- ...props
870
- }) {
871
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
872
- import_radix_ui5.Toggle.Root,
873
- {
874
- "data-slot": "toggle",
875
- className: cn(toggleVariants({ className, variant, size, bg: noBg ? "disabled" : "enabled" })),
876
- ...props
877
- }
878
- );
879
- }
880
-
881
- // src/components/ui/checkbox.tsx
882
- var import_radix_ui6 = require("radix-ui");
883
- var import_lucide_react4 = require("lucide-react");
884
- var import_jsx_runtime11 = require("react/jsx-runtime");
885
- function Checkbox({
886
- className,
887
- ...props
888
- }) {
889
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
890
- import_radix_ui6.Checkbox.Root,
891
- {
892
- "data-slot": "checkbox",
893
- className: cn(
894
- "peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
895
- className
896
- ),
897
- ...props,
898
- children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
899
- import_radix_ui6.Checkbox.Indicator,
900
- {
901
- "data-slot": "checkbox-indicator",
902
- className: "flex items-center justify-center text-current transition-none",
903
- children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react4.CheckIcon, { className: "size-3.5" })
904
- }
905
- )
906
- }
907
- );
908
- }
909
-
910
- // src/components/data/data-table/data-table.tsx
911
- var import_react = require("react");
912
- var import_jsx_runtime12 = require("react/jsx-runtime");
913
- function DataTable({
914
- data,
915
- columns: initialColumns,
916
- filters = [],
917
- pagination = { enabled: false },
918
- settings = {},
919
- header,
920
- footer,
921
- className = "",
922
- maxHeight = "600px",
923
- loading = false,
924
- error,
925
- emptyMessage = "No data available",
926
- onRowSelectionChange,
927
- onExport,
928
- onRefresh,
929
- onTableReady,
930
- children
931
- }) {
932
- const [sorting, setSorting] = (0, import_react.useState)([]);
933
- const [columnFilters, setColumnFilters] = (0, import_react.useState)([]);
934
- const [columnVisibility, setColumnVisibility] = (0, import_react.useState)({});
935
- const [rowSelection, setRowSelection] = (0, import_react.useState)({});
936
- const [globalFilter, setGlobalFilter] = (0, import_react.useState)("");
937
- const [columnOrder, setColumnOrder] = (0, import_react.useState)([]);
938
- const [columnPinning, setColumnPinning] = (0, import_react.useState)(
939
- settings.enableColumnPinning ? { left: [], right: [] } : {}
940
- );
941
- const {
942
- enableSorting = true,
943
- enableFiltering = true,
944
- enableGlobalFilter = true,
945
- enableColumnVisibility = true,
946
- enableRowSelection = true,
947
- stickyHeader = true,
948
- toolbar = false,
949
- showSerialNumbers = true,
950
- fixedCheckboxColumn = true,
951
- striped = true,
952
- hoverable = true,
953
- compact = true,
954
- bordered = true,
955
- fullHeight = false,
956
- enableColumnResizing = false,
957
- enableColumnPinning = true,
958
- hideHeader = false
959
- } = settings;
960
- const columns = (0, import_react.useMemo)(() => {
961
- const cols = [...initialColumns];
962
- const processColumns = (columns2) => {
963
- return columns2.map((col) => {
964
- if (col.id === "select" || col.id === "serialNumber") {
965
- return col;
966
- }
967
- const newCol = {
968
- ...col,
969
- enablePinning: true
970
- };
971
- if (col.columns) {
972
- newCol.columns = processColumns(col.columns);
973
- }
974
- return newCol;
975
- });
976
- };
977
- const processedCols = processColumns(cols);
978
- if (enableRowSelection) {
979
- const selectColumn = {
980
- id: "select",
981
- header: ({ table: table2 }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
982
- Checkbox,
983
- {
984
- checked: table2.getIsAllPageRowsSelected() || table2.getIsSomePageRowsSelected() && "indeterminate",
985
- onCheckedChange: (value) => table2.toggleAllPageRowsSelected(!!value),
986
- "aria-label": "Select all"
987
- }
988
- ),
989
- cell: ({ row }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: cn("flex items-center justify-center"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
990
- Checkbox,
991
- {
992
- checked: row.getIsSelected(),
993
- onCheckedChange: (value) => row.toggleSelected(!!value),
994
- "aria-label": "Select row"
995
- }
996
- ) }),
997
- enableSorting: false,
998
- enableHiding: false,
999
- enablePinning: true,
1000
- headerAlign: "center",
1001
- size: 10
1002
- };
1003
- processedCols.unshift(selectColumn);
1004
- }
1005
- if (showSerialNumbers) {
1006
- const serialColumn = {
1007
- id: "serialNumber",
1008
- header: "No.",
1009
- cell: ({ row }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "text-center font-medium text-muted-foreground", children: row.index + 1 }),
1010
- enableSorting: true,
1011
- enableHiding: false,
1012
- enablePinning: true,
1013
- size: 60,
1014
- headerAlign: "center"
1015
- };
1016
- processedCols.unshift(serialColumn);
1017
- }
1018
- return processedCols;
1019
- }, [initialColumns, showSerialNumbers, enableRowSelection, fixedCheckboxColumn]);
1020
- const table = (0, import_react_table.useReactTable)({
1021
- data,
1022
- columns,
1023
- onSortingChange: enableSorting ? setSorting : void 0,
1024
- onColumnFiltersChange: enableFiltering ? setColumnFilters : void 0,
1025
- onGlobalFilterChange: enableGlobalFilter ? setGlobalFilter : void 0,
1026
- getCoreRowModel: (0, import_react_table.getCoreRowModel)(),
1027
- getPaginationRowModel: pagination.enabled ? (0, import_react_table.getPaginationRowModel)() : void 0,
1028
- getSortedRowModel: enableSorting ? (0, import_react_table.getSortedRowModel)() : void 0,
1029
- getFilteredRowModel: enableFiltering ? (0, import_react_table.getFilteredRowModel)() : void 0,
1030
- onColumnVisibilityChange: enableColumnVisibility ? setColumnVisibility : void 0,
1031
- onRowSelectionChange: enableRowSelection ? setRowSelection : void 0,
1032
- onColumnOrderChange: setColumnOrder,
1033
- onColumnPinningChange: enableColumnPinning ? setColumnPinning : void 0,
1034
- state: {
1035
- sorting: enableSorting ? sorting : void 0,
1036
- columnFilters: enableFiltering ? columnFilters : void 0,
1037
- columnVisibility: enableColumnVisibility ? columnVisibility : void 0,
1038
- rowSelection: enableRowSelection ? rowSelection : {},
1039
- globalFilter,
1040
- columnOrder,
1041
- columnPinning: enableColumnPinning ? columnPinning : {}
1042
- },
1043
- initialState: {
1044
- pagination: pagination.enabled ? { pageSize: pagination.pageSize || 10 } : void 0,
1045
- columnPinning: enableColumnPinning ? {
1046
- left: [
1047
- ...showSerialNumbers ? ["serialNumber"] : [],
1048
- ...enableRowSelection ? ["select"] : []
1049
- ],
1050
- right: []
1051
- } : void 0
1052
- },
1053
- enableRowSelection,
1054
- enableColumnResizing,
1055
- enableColumnPinning,
1056
- columnResizeMode: "onChange"
1057
- });
1058
- (0, import_react.useEffect)(() => {
1059
- if (onTableReady) {
1060
- onTableReady(table);
1061
- }
1062
- }, [table, onTableReady]);
1063
- (0, import_react.useEffect)(() => {
1064
- if (enableRowSelection && onRowSelectionChange) {
1065
- const selectedRows = table.getFilteredSelectedRowModel().rows.map((row) => row.original);
1066
- onRowSelectionChange(selectedRows);
1067
- }
1068
- }, [rowSelection, enableRowSelection, onRowSelectionChange, table]);
1069
- const handleClearSorting = (0, import_react.useCallback)(() => {
1070
- setSorting([]);
1071
- }, []);
1072
- const handleClearFilters = (0, import_react.useCallback)(() => {
1073
- setColumnFilters([]);
1074
- setGlobalFilter("");
1075
- }, []);
1076
- const handlePinColumn = (columnId, side) => {
1077
- if (!enableColumnPinning) return;
1078
- const alwaysPinnedLeft = [
1079
- ...showSerialNumbers ? ["serialNumber"] : [],
1080
- ...enableRowSelection && fixedCheckboxColumn ? ["select"] : []
1081
- ];
1082
- const newPinning = {
1083
- left: [...(columnPinning.left ?? []).filter((id) => alwaysPinnedLeft.includes(id))],
1084
- right: [...columnPinning.right ?? []]
1085
- };
1086
- if (side === false) {
1087
- newPinning.left = newPinning.left.filter((id) => id !== columnId);
1088
- newPinning.right = newPinning.right.filter((id) => id !== columnId);
1089
- } else if (side === "right") {
1090
- newPinning.left = newPinning.left.filter((id) => id !== columnId);
1091
- if (!newPinning.right.includes(columnId)) {
1092
- newPinning.right.push(columnId);
1093
- }
1094
- } else if (side === "left") {
1095
- newPinning.right = newPinning.right.filter((id) => id !== columnId);
1096
- if (!newPinning.left.includes(columnId) && !alwaysPinnedLeft.includes(columnId)) {
1097
- newPinning.left.push(columnId);
1098
- }
1099
- }
1100
- table.setColumnPinning(newPinning);
1101
- };
1102
- const renderTableHeader = () => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TableHeader, { className: cn(
1103
- stickyHeader && "sticky top-0 bg-sidebar z-20"
1104
- ), children: table.getHeaderGroups().map((headerGroup, groupIndex) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TableRow, { className: "hover:bg-transparent", children: headerGroup.headers.map((header2, index) => {
1105
- const isGroupHeader = header2.depth === 0 && header2.colSpan > 1;
1106
- const isPinnedLeft = enableColumnPinning && (header2.column.getIsPinned() === "left" || header2.column.id === "serialNumber" || header2.column.id === "select" && enableRowSelection);
1107
- const isPinnedRight = enableColumnPinning && header2.column.getIsPinned() === "right";
1108
- const canSort = header2.column.getCanSort();
1109
- const canPin = enableColumnPinning && header2.column.columnDef.enablePinning !== false;
1110
- const isSerialNumber = header2.column.id === "serialNumber";
1111
- const isCheckbox = header2.column.id === "select";
1112
- const alwaysPinned = isSerialNumber || isCheckbox && fixedCheckboxColumn;
1113
- const headerAlign = header2.column.columnDef.headerAlign || "left";
1114
- const flexJustify = {
1115
- left: "justify-start",
1116
- center: "justify-center",
1117
- right: "justify-end"
1118
- }[headerAlign];
1119
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
1120
- TableHead,
1121
- {
1122
- colSpan: header2.colSpan,
1123
- className: cn(
1124
- "font-semibold text-foreground bg-sidebar group px-0",
1125
- !compact && "py-2",
1126
- bordered && index < headerGroup.headers.length - 1 && "border-r",
1127
- "relative",
1128
- isPinnedLeft && "sticky left-0 z-15 bg-sidebar",
1129
- isPinnedRight && "sticky right-0 z-15 bg-sidebar",
1130
- (isSerialNumber || isCheckbox) && "sticky left-0 z-15 bg-sidebar",
1131
- isGroupHeader ? "text-center" : "text-left"
1132
- ),
1133
- style: {
1134
- width: header2.getSize() !== 150 ? header2.getSize() : "auto",
1135
- minWidth: header2.getSize() !== 150 ? header2.getSize() : "auto",
1136
- ...isPinnedLeft && {
1137
- left: isSerialNumber ? 0 : isCheckbox ? showSerialNumbers ? table.getColumn("serialNumber")?.getSize() || 0 : 0 : getLeftOffset(header2.column)
1138
- },
1139
- ...isPinnedRight && { right: getRightOffset(header2.column) },
1140
- ...isSerialNumber && { left: 0 }
1141
- },
1142
- children: [
1143
- isGroupHeader ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex items-center justify-center", children: (0, import_react_table.flexRender)(header2.column.columnDef.header, header2.getContext()) }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: cn("relative flex items-center w-full px-2", flexJustify), children: [
1144
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-1", children: [
1145
- canSort && headerAlign === "right" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "ml-1 order-2", children: header2.column.getIsSorted() && {
1146
- asc: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react5.ChevronUp, { className: "h-4 w-4" }),
1147
- desc: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react5.ChevronDown, { className: "h-4 w-4" })
1148
- }[header2.column.getIsSorted()] }),
1149
- header2.isPlaceholder ? null : (0, import_react_table.flexRender)(header2.column.columnDef.header, header2.getContext()),
1150
- canSort && headerAlign !== "right" && header2.column.getIsSorted() && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "ml-1 order-2", children: header2.column.getIsSorted() && {
1151
- asc: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react5.ChevronUp, { className: "h-4 w-4" }),
1152
- desc: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react5.ChevronDown, { className: "h-4 w-4" })
1153
- }[header2.column.getIsSorted()] })
1154
- ] }),
1155
- (canSort || canPin && !alwaysPinned) && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(DropdownMenu, { children: [
1156
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(DropdownMenuTrigger, { asChild: true, className: cn(
1157
- "absolute",
1158
- headerAlign === "left" && "right-1",
1159
- headerAlign === "center" && "right-1",
1160
- headerAlign === "right" && "left-1"
1161
- ), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1162
- Toggle,
1163
- {
1164
- variant: "default",
1165
- size: "sm",
1166
- noBg: true,
1167
- tabIndex: -1,
1168
- className: "opacity-0 group-hover:opacity-70 hover:opacity-100 data-[state=open]:opacity-100",
1169
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react5.MoreHorizontal, { className: "h-4 w-4" })
1170
- }
1171
- ) }),
1172
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(DropdownMenuContent, { align: "end", className: "w-48", children: [
1173
- canSort && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
1174
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(DropdownMenuLabel, { children: "Sorting" }),
1175
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
1176
- DropdownMenuItem,
1177
- {
1178
- onClick: () => header2.column.toggleSorting(false),
1179
- children: [
1180
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react5.ChevronUp, { className: "mr-2 h-4 w-4" }),
1181
- "Sort Ascending"
1182
- ]
1183
- }
1184
- ),
1185
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
1186
- DropdownMenuItem,
1187
- {
1188
- onClick: () => header2.column.toggleSorting(true),
1189
- children: [
1190
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react5.ChevronDown, { className: "mr-2 h-4 w-4" }),
1191
- "Sort Descending"
1192
- ]
1193
- }
1194
- ),
1195
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
1196
- DropdownMenuItem,
1197
- {
1198
- onClick: () => header2.column.clearSorting(),
1199
- disabled: !header2.column.getIsSorted(),
1200
- children: [
1201
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react5.ChevronsUpDown, { className: "mr-2 h-4 w-4" }),
1202
- "Clear Sort"
1203
- ]
1204
- }
1205
- ),
1206
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(DropdownMenuSeparator, {})
1207
- ] }),
1208
- canPin && !alwaysPinned && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
1209
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(DropdownMenuLabel, { children: "Pin Column" }),
1210
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
1211
- DropdownMenuItem,
1212
- {
1213
- onClick: () => handlePinColumn(header2.column.id, "right"),
1214
- disabled: header2.column.getIsPinned() === "right",
1215
- children: [
1216
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react5.MoveRightIcon, {}),
1217
- "Pin Right"
1218
- ]
1219
- }
1220
- ),
1221
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
1222
- DropdownMenuItem,
1223
- {
1224
- onClick: () => handlePinColumn(header2.column.id, false),
1225
- disabled: !header2.column.getIsPinned(),
1226
- children: [
1227
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react5.PinOffIcon, {}),
1228
- "Unpin"
1229
- ]
1230
- }
1231
- )
1232
- ] })
1233
- ] })
1234
- ] })
1235
- ] }),
1236
- enableColumnResizing && header2.column.getCanResize() && !isGroupHeader && header2.colSpan === 1 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1237
- "div",
1238
- {
1239
- className: "absolute right-0 top-0 h-full w-1 bg-border hover:bg-primary cursor-col-resize opacity-0 hover:opacity-100 transition-opacity",
1240
- onMouseDown: header2.getResizeHandler()
1241
- }
1242
- )
1243
- ]
1244
- },
1245
- header2.id
1246
- );
1247
- }) }, headerGroup.id)) });
1248
- const getLeftOffset = (column) => {
1249
- if (!enableColumnPinning) return void 0;
1250
- let offset = 0;
1251
- const pinnedLeftColumns = table.getLeftHeaderGroups()[0]?.headers || [];
1252
- const alwaysPinnedColumns = [
1253
- ...showSerialNumbers ? ["serialNumber"] : [],
1254
- ...enableRowSelection ? ["select"] : []
1255
- ];
1256
- for (const col of pinnedLeftColumns) {
1257
- if (col.id === column.id) break;
1258
- if (alwaysPinnedColumns.includes(col.id)) {
1259
- const column2 = table.getColumn(col.id);
1260
- if (column2) {
1261
- offset += column2.getSize();
1262
- }
1263
- }
1264
- }
1265
- return offset;
1266
- };
1267
- const getRightOffset = (column) => {
1268
- if (!enableColumnPinning) return void 0;
1269
- const pinnedRightIds = table.getState().columnPinning.right || [];
1270
- const columnIndex = pinnedRightIds.indexOf(column.id);
1271
- if (columnIndex === -1) return void 0;
1272
- let offset = 0;
1273
- for (let i = columnIndex + 1; i < pinnedRightIds.length; i++) {
1274
- const col = table.getColumn(pinnedRightIds[i]);
1275
- if (col) {
1276
- offset += col.getSize();
1277
- }
1278
- }
1279
- return offset;
1280
- };
1281
- if (error) {
1282
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Card, { className: "w-full rounded-xl shadow-sm", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CardContent, { className: "flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "text-center", children: [
1283
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "text-red-500 mb-3 text-2xl", children: "\u26A0\uFE0F" }),
1284
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-sm text-muted-foreground mb-4", children: error }),
1285
- onRefresh && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Button, { variant: "outline", size: "sm", onClick: onRefresh, className: "rounded-lg", children: [
1286
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react5.Loader2, { className: "mr-2 h-4 w-4" }),
1287
- "Try Again"
1288
- ] })
1289
- ] }) }) });
1290
- }
1291
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: cn("w-full space-y-2 flex flex-col h-full", className), children: [
1292
- header && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Card, { className: "rounded-2xl py-2 sticky top-0 z-20", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CardContent, { className: "px-2", children: header }) }),
1293
- toolbar && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1294
- DataTableToolbar,
1295
- {
1296
- table,
1297
- filters,
1298
- globalFilter,
1299
- onGlobalFilterChange: setGlobalFilter,
1300
- enableGlobalFilter,
1301
- onExport,
1302
- onRefresh,
1303
- loading,
1304
- enableColumnVisibility,
1305
- enableColumnPinning,
1306
- data,
1307
- onClearSorting: handleClearSorting,
1308
- onClearFilters: handleClearFilters
1309
- }
1310
- ),
1311
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Card, { className: cn("shadow-sm overflow-auto py-0", fullHeight && "flex-1"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CardContent, { className: "p-0 h-full", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "relative flex flex-col h-full justify-between", children: [
1312
- loading && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "absolute inset-0 bg-background/80 backdrop-blur-sm z-50 flex items-center justify-center rounded-xl", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-3 bg-background/90 px-4 py-3 rounded-lg shadow-sm", children: [
1313
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react5.Loader2, { className: "size-5 animate-spin text-primary" }),
1314
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "text-sm font-medium text-muted-foreground", children: "Loading..." })
1315
- ] }) }),
1316
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "relative rounded-t-xl overflow-auto border-b", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Table, { className: "border-collapse w-full", children: [
1317
- !hideHeader && renderTableHeader(),
1318
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TableBody, { children: table.getRowModel().rows?.length ? table.getRowModel().rows.map((row, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1319
- TableRow,
1320
- {
1321
- "data-state": row.getIsSelected() && "selected",
1322
- className: cn(
1323
- hoverable && "hover:bg-muted/50",
1324
- striped && rowIndex % 2 === 0 && "bg-muted/20",
1325
- row.getIsSelected() && "bg-muted",
1326
- "border-b last:border-b-0"
1327
- ),
1328
- children: row.getVisibleCells().map((cell, cellIndex) => {
1329
- const isPinnedLeft = enableColumnPinning && (cell.column.getIsPinned() === "left" || cell.column.id === "serialNumber" || cell.column.id === "select" && enableRowSelection);
1330
- const isPinnedRight = enableColumnPinning && cell.column.getIsPinned() === "right";
1331
- const isSerialNumber = cell.column.id === "serialNumber";
1332
- const isCheckbox = cell.column.id === "select";
1333
- const alwaysPinned = isSerialNumber || isCheckbox && fixedCheckboxColumn;
1334
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1335
- TableCell,
1336
- {
1337
- className: cn(
1338
- compact ? "py-2" : "py-4",
1339
- bordered && cellIndex < row.getVisibleCells().length && "border-r",
1340
- isPinnedLeft && "sticky left-0 z-10 bg-sidebar/97",
1341
- isPinnedRight && "sticky right-0 z-10 bg-sidebar/97",
1342
- isSerialNumber && "sticky left-0 z-10 bg-sidebar/97",
1343
- "p-1"
1344
- ),
1345
- style: {
1346
- width: cell.column.getSize() !== 150 ? cell.column.getSize() : "auto",
1347
- minWidth: cell.column.getSize() !== 150 ? cell.column.getSize() : "auto",
1348
- ...isPinnedLeft && {
1349
- left: isSerialNumber ? 0 : isCheckbox ? showSerialNumbers ? table.getColumn("serialNumber")?.getSize() || 0 : 0 : getLeftOffset(cell.column)
1350
- },
1351
- ...isPinnedRight && { right: getRightOffset(cell.column) },
1352
- ...isSerialNumber && { left: 0 }
1353
- },
1354
- children: (0, import_react_table.flexRender)(cell.column.columnDef.cell, cell.getContext())
1355
- },
1356
- cell.id
1357
- );
1358
- })
1359
- },
1360
- row.id
1361
- )) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TableCell, { colSpan: columns.length, className: "h-32 text-center border-0", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-col items-center gap-3", children: [
1362
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "text-muted-foreground text-5xl", children: "\u{1F4CB}" }),
1363
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-muted-foreground font-medium", children: emptyMessage })
1364
- ] }) }) }) })
1365
- ] }) }),
1366
- footer && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "sticky bottom-0 bg-sidebar w-full z-20", style: {
1367
- width: "100%",
1368
- minWidth: "fit-content"
1369
- }, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Table, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TableFooter, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TableRow, { className: "bg-sidebar", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TableCell, { colSpan: columns.length, className: "p-2", children: footer }) }) }) }) })
1370
- ] }) }) }),
1371
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(DataTablePagination, { table, config: pagination }),
1372
- children && children(table)
1373
- ] }) });
1374
- }
1375
-
1376
- // src/components/ui/separator.tsx
1377
- var import_radix_ui7 = require("radix-ui");
1378
- var import_jsx_runtime13 = require("react/jsx-runtime");
1379
- function Separator({
1380
- className,
1381
- orientation = "horizontal",
1382
- decorative = true,
1383
- ...props
1384
- }) {
1385
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1386
- import_radix_ui7.Separator.Root,
1387
- {
1388
- "data-slot": "separator-root",
1389
- decorative,
1390
- orientation,
1391
- className: cn(
1392
- "bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",
1393
- className
1394
- ),
1395
- ...props
1396
- }
1397
- );
1398
- }
1399
-
1400
- // src/components/data/data-table/data-table-action-bar.tsx
1401
- var import_lucide_react6 = require("lucide-react");
1402
- var import_framer_motion = require("framer-motion");
1403
- var React = __toESM(require("react"), 1);
1404
- var ReactDOM = __toESM(require("react-dom"), 1);
1405
- var import_jsx_runtime14 = require("react/jsx-runtime");
1406
- function DataTableActionBar({
1407
- table,
1408
- visible: visibleProp,
1409
- container: containerProp,
1410
- children,
1411
- className,
1412
- ...props
1413
- }) {
1414
- const [mounted, setMounted] = React.useState(false);
1415
- React.useLayoutEffect(() => {
1416
- setMounted(true);
1417
- }, []);
1418
- React.useEffect(() => {
1419
- function onKeyDown(event) {
1420
- if (event.key === "Escape" && table) {
1421
- table.toggleAllRowsSelected(false);
1422
- }
1423
- }
1424
- window.addEventListener("keydown", onKeyDown);
1425
- return () => window.removeEventListener("keydown", onKeyDown);
1426
- }, [table]);
1427
- const container = containerProp ?? (mounted ? globalThis.document?.body : null);
1428
- if (!container || !table) return null;
1429
- const visible = visibleProp ?? table.getFilteredSelectedRowModel().rows.length > 0;
1430
- return ReactDOM.createPortal(
1431
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_framer_motion.AnimatePresence, { children: visible && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1432
- import_framer_motion.motion.div,
1433
- {
1434
- role: "toolbar",
1435
- "aria-orientation": "horizontal",
1436
- initial: { opacity: 0, y: 20 },
1437
- animate: { opacity: 1, y: 0 },
1438
- exit: { opacity: 0, y: 20 },
1439
- transition: { duration: 0.3, ease: "easeInOut" },
1440
- className: cn(
1441
- "fixed inset-x-0 bottom-6 z-50 mx-auto flex w-fit flex-wrap items-center justify-center gap-2 rounded-xl border bg-primary/10 backdrop-blur-sm p-3 text-foreground ring-5 ring-primary/5",
1442
- className
1443
- ),
1444
- ...props,
1445
- children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(TooltipProvider, { children: [
1446
- "1",
1447
- children
1448
- ] })
1449
- }
1450
- ) }),
1451
- container
1452
- );
1453
- }
1454
- function DataTableActionBarAction({
1455
- size = "sm",
1456
- tooltip,
1457
- isPending,
1458
- disabled,
1459
- className,
1460
- children,
1461
- ...props
1462
- }) {
1463
- const trigger = /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1464
- Button,
1465
- {
1466
- variant: "secondary",
1467
- size,
1468
- className: cn(
1469
- "gap-1.5 rounded-lg border border-secondary bg-secondary/50 hover:bg-secondary/70 transition-all duration-200",
1470
- size === "icon" ? "size-8" : "h-8 px-3",
1471
- className
1472
- ),
1473
- disabled: disabled || isPending,
1474
- ...props,
1475
- children: isPending ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react6.Loader, { className: "animate-spin" }) : children
1476
- }
1477
- );
1478
- if (!tooltip) return trigger;
1479
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Tooltip, { children: [
1480
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(TooltipTrigger, { asChild: true, children: trigger }),
1481
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1482
- TooltipContent,
1483
- {
1484
- sideOffset: 8,
1485
- className: "rounded-lg border font-semibold text-foreground bg-secondary [&>span]:hidden",
1486
- children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { children: tooltip })
1487
- }
1488
- )
1489
- ] });
1490
- }
1491
- function DataTableActionBarSelection({ table }) {
1492
- const onClearSelection = React.useCallback(() => {
1493
- if (table) {
1494
- table.toggleAllRowsSelected(false);
1495
- }
1496
- }, [table]);
1497
- if (!table) return null;
1498
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex h-8 items-center rounded-lg border bg-muted/50 pr-1 pl-3", children: [
1499
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "whitespace-nowrap text-sm font-medium", children: [
1500
- table.getFilteredSelectedRowModel().rows.length,
1501
- " selected"
1502
- ] }),
1503
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Separator, { orientation: "vertical", className: "mr-2 ml-3 data-[orientation=vertical]:h-4" }),
1504
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Tooltip, { children: [
1505
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Button, { variant: "ghost", size: "icon", className: "size-6 rounded-md", onClick: onClearSelection, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react6.X, { className: "size-3.5" }) }) }),
1506
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
1507
- TooltipContent,
1508
- {
1509
- sideOffset: 10,
1510
- className: "flex items-center gap-2 rounded-lg border px-3 py-2 font-semibold text-foregroun bg-secondary [&>span]:hidden",
1511
- children: [
1512
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { children: "Clear selection" }),
1513
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("kbd", { className: "select-none rounded border bg-primary/50 px-2 py-1 font-mono font-normal text-[0.7rem] text-foreground shadow-sm", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("abbr", { title: "Escape", className: "no-underline", children: "Esc" }) })
1514
- ]
1515
- }
1516
- )
1517
- ] })
1518
- ] });
1519
- }
1520
-
1521
- // src/components/data/data-table/data-table-column-header.tsx
1522
- var import_lucide_react7 = require("lucide-react");
1523
- var import_jsx_runtime15 = require("react/jsx-runtime");
1524
-
1525
- // src/components/data/data-table/data-table-view-options.tsx
1526
- var import_lucide_react8 = require("lucide-react");
1527
- var import_jsx_runtime16 = require("react/jsx-runtime");
1528
-
1529
- // src/components/ui/badge.tsx
1530
- var import_radix_ui8 = require("radix-ui");
1531
- var import_class_variance_authority3 = require("class-variance-authority");
1532
- var import_jsx_runtime17 = require("react/jsx-runtime");
1533
- var badgeVariants = (0, import_class_variance_authority3.cva)(
1534
- "inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",
1535
- {
1536
- variants: {
1537
- variant: {
1538
- default: "border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
1539
- secondary: "border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",
1540
- destructive: "border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
1541
- outline: "text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"
1542
- }
1543
- },
1544
- defaultVariants: {
1545
- variant: "default"
1546
- }
1547
- }
1548
- );
1549
-
1550
- // src/components/ui/command.tsx
1551
- var import_cmdk = require("cmdk");
1552
- var import_lucide_react10 = require("lucide-react");
1553
-
1554
- // src/components/ui/dialog.tsx
1555
- var import_radix_ui9 = require("radix-ui");
1556
- var import_lucide_react9 = require("lucide-react");
1557
- var import_jsx_runtime18 = require("react/jsx-runtime");
1558
-
1559
- // src/components/ui/command.tsx
1560
- var import_jsx_runtime19 = require("react/jsx-runtime");
1561
-
1562
- // src/components/ui/popover.tsx
1563
- var import_radix_ui10 = require("radix-ui");
1564
- var import_jsx_runtime20 = require("react/jsx-runtime");
1565
-
1566
- // src/components/data/data-table/data-table-faceted-filter.tsx
1567
- var import_lucide_react11 = require("lucide-react");
1568
- var import_jsx_runtime21 = require("react/jsx-runtime");
1569
-
1570
- // src/components/data/data-template/data-template.tsx
1571
- var import_react2 = require("react");
1572
- var import_lucide_react14 = require("lucide-react");
1573
-
1574
- // src/components/data/data-template/data-template-toolbar.tsx
1575
- var import_lucide_react12 = require("lucide-react");
1576
- var import_jsx_runtime22 = require("react/jsx-runtime");
1577
- function DataTemplateToolbar({
1578
- fields,
1579
- filters,
1580
- globalFilter,
1581
- onGlobalFilterChange,
1582
- fieldFilters,
1583
- onFieldFilterChange,
1584
- sortField,
1585
- sortDirection,
1586
- onSortChange,
1587
- selectedCount,
1588
- totalCount,
1589
- visibleCount,
1590
- onExport,
1591
- onRefresh,
1592
- loading,
1593
- onClearFilters,
1594
- onClearSorting
1595
- }) {
1596
- const sortableFields = fields.filter((field) => field.sortable);
1597
- const hasActiveFilters = Object.values(fieldFilters).some((value) => value !== void 0 && value !== null && value !== "") || globalFilter !== "";
1598
- const hasActiveSorting = sortField !== "";
1599
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "rounded-xl p-0.5", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "px-2", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex flex-col gap-6", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center justify-between", children: [
1600
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex items-center gap-3", children: filters.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-3 flex-wrap", children: [
1601
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex items-center gap-2 text-sm font-medium text-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react12.Filter, { className: "h-4 w-4" }) }),
1602
- filters.map((filter) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "relative min-w-[150px]", children: filter.type === "select" ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
1603
- Select,
1604
- {
1605
- value: fieldFilters[filter.key] || "all",
1606
- onValueChange: (value) => onFieldFilterChange(filter.key, value),
1607
- children: [
1608
- filter.icon && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(filter.icon, { className: "size-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground" }),
1609
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SelectTrigger, { className: cn("h-9 rounded-lg w-full", filter.icon && "pl-9"), children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SelectValue, { placeholder: filter.placeholder || "Select..." }) }),
1610
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(SelectContent, { className: "rounded-lg", children: [
1611
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SelectItem, { value: "all", children: "All" }),
1612
- filter.options?.map((option) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SelectItem, { value: option.value, children: option.label }, option.value))
1613
- ] })
1614
- ]
1615
- }
1616
- ) : /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "relative", children: [
1617
- filter.icon && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(filter.icon, { className: "size-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground" }),
1618
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
1619
- Input,
1620
- {
1621
- type: filter.type,
1622
- placeholder: filter.placeholder,
1623
- value: fieldFilters[filter.key] || "",
1624
- onChange: (e) => onFieldFilterChange(filter.key, e.target.value),
1625
- className: cn("h-9 rounded-lg", filter.icon && "pl-9")
1626
- }
1627
- )
1628
- ] }) }, String(filter.key)))
1629
- ] }) }),
1630
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-2", children: [
1631
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "relative", children: [
1632
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react12.Search, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
1633
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
1634
- Input,
1635
- {
1636
- placeholder: "Global search...",
1637
- value: globalFilter,
1638
- onChange: (e) => onGlobalFilterChange(e.target.value),
1639
- className: "pl-9 h-9 rounded-lg max-w-max"
1640
- }
1641
- )
1642
- ] }),
1643
- sortableFields.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(DropdownMenu, { children: [
1644
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Button, { variant: "outline", size: "sm", className: "rounded-lg gap-1", children: [
1645
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { children: "Sort" }),
1646
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react12.ChevronDown, { className: "h-4 w-4 opacity-50" })
1647
- ] }) }),
1648
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(DropdownMenuContent, { align: "end", className: "w-[200px] rounded-lg", children: [
1649
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropdownMenuLabel, { children: "Sort By" }),
1650
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropdownMenuSeparator, {}),
1651
- sortableFields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { children: [
1652
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(DropdownMenuItem, { onClick: () => onSortChange(field.key, "asc"), children: [
1653
- field.label,
1654
- " (A-Z)"
1655
- ] }),
1656
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(DropdownMenuItem, { onClick: () => onSortChange(field.key, "desc"), children: [
1657
- field.label,
1658
- " (Z-A)"
1659
- ] })
1660
- ] }, String(field.key))),
1661
- hasActiveSorting && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
1662
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropdownMenuSeparator, {}),
1663
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropdownMenuItem, { onClick: onClearSorting, children: "Clear All Sorting" })
1664
- ] })
1665
- ] })
1666
- ] }),
1667
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(DropdownMenu, { children: [
1668
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Button, { variant: "outline", size: "sm", className: "rounded-lg", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react12.Settings2, { className: "h-4 w-4" }) }) }),
1669
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(DropdownMenuContent, { align: "end", className: "w-[200px] rounded-lg", children: [
1670
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropdownMenuLabel, { children: "Table Settings" }),
1671
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropdownMenuSeparator, {}),
1672
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropdownMenuItem, { onClick: onClearSorting, children: "Clear All Sorting" }),
1673
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropdownMenuItem, { onClick: onClearFilters, children: "Clear All Filters" })
1674
- ] })
1675
- ] }),
1676
- onExport && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Button, { variant: "outline", size: "sm", onClick: onExport, className: "rounded-lg", children: [
1677
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react12.Download, { className: "mr-2 h-4 w-4" }),
1678
- "Export"
1679
- ] }),
1680
- onRefresh && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
1681
- Button,
1682
- {
1683
- variant: "outline",
1684
- size: "sm",
1685
- onClick: onRefresh,
1686
- disabled: loading,
1687
- className: "rounded-lg",
1688
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react12.RefreshCw, { className: cn("h-4 w-4", loading && "animate-spin") })
1689
- }
1690
- )
1691
- ] })
1692
- ] }) }) }) });
1693
- }
1694
-
1695
- // src/components/data/data-template/data-template-pagination.tsx
1696
- var import_lucide_react13 = require("lucide-react");
1697
- var import_jsx_runtime23 = require("react/jsx-runtime");
1698
- function DataTemplatePagination({
1699
- currentPage,
1700
- totalPages,
1701
- pageSize,
1702
- totalItems,
1703
- onPageChange,
1704
- onPageSizeChange,
1705
- config
1706
- }) {
1707
- if (!config.enabled) {
1708
- return null;
1709
- }
1710
- const pageSizeOptions = config.pageSizeOptions || [10, 20, 50, 100];
1711
- const startItem = (currentPage - 1) * pageSize + 1;
1712
- const endItem = Math.min(currentPage * pageSize, totalItems);
1713
- const canPreviousPage = currentPage > 1;
1714
- const canNextPage = currentPage < totalPages;
1715
- const getPageNumbers = () => {
1716
- const delta = 2;
1717
- const range = [];
1718
- const rangeWithDots = [];
1719
- for (let i = Math.max(2, currentPage - delta); i <= Math.min(totalPages - 1, currentPage + delta); i++) {
1720
- range.push(i);
1721
- }
1722
- if (currentPage - delta > 2) {
1723
- rangeWithDots.push(1, "...");
1724
- } else {
1725
- rangeWithDots.push(1);
1726
- }
1727
- rangeWithDots.push(...range);
1728
- if (currentPage + delta < totalPages - 1) {
1729
- rangeWithDots.push("...", totalPages);
1730
- } else if (totalPages > 1) {
1731
- rangeWithDots.push(totalPages);
1732
- }
1733
- return rangeWithDots;
1734
- };
1735
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "rounded-xl", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col sm:flex-row items-center justify-between gap-4", children: [
1736
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "flex items-center gap-6 text-sm text-muted-foreground", children: config.showInfo !== false && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { children: [
1737
- "Showing ",
1738
- startItem,
1739
- " to ",
1740
- endItem,
1741
- " of ",
1742
- totalItems,
1743
- " entries"
1744
- ] }) }),
1745
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col sm:flex-row items-center gap-4", children: [
1746
- pageSizeOptions && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center gap-2", children: [
1747
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "text-sm font-medium whitespace-nowrap", children: "Page size:" }),
1748
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(Select, { value: `${pageSize}`, onValueChange: (value) => onPageSizeChange(Number(value)), children: [
1749
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(SelectTrigger, { className: "h-9 w-[70px] rounded-lg", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(SelectValue, {}) }),
1750
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(SelectContent, { side: "top", className: "rounded-lg", children: pageSizeOptions.map((size) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(SelectItem, { value: `${size}`, children: size }, size)) })
1751
- ] })
1752
- ] }),
1753
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center gap-2", children: [
1754
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
1755
- Button,
1756
- {
1757
- variant: "outline",
1758
- size: "sm",
1759
- onClick: () => onPageChange(1),
1760
- disabled: !canPreviousPage,
1761
- className: "hidden sm:flex rounded-lg",
1762
- children: [
1763
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react13.ChevronsLeft, { className: "h-4 w-4" }),
1764
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "sr-only", children: "Go to first page" })
1765
- ]
1766
- }
1767
- ),
1768
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
1769
- Button,
1770
- {
1771
- variant: "outline",
1772
- size: "sm",
1773
- onClick: () => onPageChange(currentPage - 1),
1774
- disabled: !canPreviousPage,
1775
- className: "rounded-lg",
1776
- children: [
1777
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react13.ChevronLeft, { className: "h-4 w-4 sm:mr-2" }),
1778
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "hidden sm:inline", children: "Previous" }),
1779
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "sr-only sm:hidden", children: "Go to previous page" })
1780
- ]
1781
- }
1782
- ),
1783
- config.showPageNumbers && totalPages > 1 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "hidden sm:flex items-center gap-1", children: getPageNumbers().map((pageNumber, index) => {
1784
- if (pageNumber === "...") {
1785
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "px-2 py-1 text-sm text-muted-foreground", children: "..." }, `dots-${index}`);
1786
- }
1787
- const page = pageNumber;
1788
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
1789
- Button,
1790
- {
1791
- variant: page === currentPage ? "default" : "outline",
1792
- size: "sm",
1793
- className: "w-9 h-9 p-0 rounded-lg",
1794
- onClick: () => onPageChange(page),
1795
- children: page
1796
- },
1797
- page
1798
- );
1799
- }) }),
1800
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "sm:hidden flex items-center gap-2 px-3 py-1 text-sm font-medium bg-muted rounded-lg", children: [
1801
- currentPage,
1802
- " of ",
1803
- totalPages
1804
- ] }),
1805
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
1806
- Button,
1807
- {
1808
- variant: "outline",
1809
- size: "sm",
1810
- onClick: () => onPageChange(currentPage + 1),
1811
- disabled: !canNextPage,
1812
- className: "rounded-lg",
1813
- children: [
1814
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "hidden sm:inline", children: "Next" }),
1815
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react13.ChevronRight, { className: "h-4 w-4 sm:ml-2" }),
1816
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "sr-only sm:hidden", children: "Go to next page" })
1817
- ]
1818
- }
1819
- ),
1820
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
1821
- Button,
1822
- {
1823
- variant: "outline",
1824
- size: "sm",
1825
- onClick: () => onPageChange(totalPages),
1826
- disabled: !canNextPage,
1827
- className: "hidden sm:flex rounded-lg",
1828
- children: [
1829
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react13.ChevronsRight, { className: "h-4 w-4" }),
1830
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "sr-only", children: "Go to last page" })
1831
- ]
1832
- }
1833
- )
1834
- ] })
1835
- ] })
1836
- ] }) });
1837
- }
1838
-
1839
- // src/components/data/data-template/data-template.tsx
1840
- var import_jsx_runtime24 = require("react/jsx-runtime");
1841
- function DataTemplate({
1842
- data,
1843
- template,
1844
- fields = [],
1845
- filters = [],
1846
- pagination = { enabled: false },
1847
- settings = {},
1848
- header,
1849
- footer,
1850
- className = "",
1851
- loading = false,
1852
- error,
1853
- emptyMessage = "No items found",
1854
- emptyIcon,
1855
- onSelectionChange,
1856
- onExport,
1857
- onRefresh,
1858
- onTemplateReady,
1859
- children
1860
- }) {
1861
- const {
1862
- enableSorting = true,
1863
- enableFiltering = true,
1864
- enableGlobalSearch = true,
1865
- enableSelection = false,
1866
- enableExport = false,
1867
- toolbar = true,
1868
- selectionMode = "multiple",
1869
- gridCols = { default: 3, sm: 1, md: 2, lg: 3, xl: 4, "2xl": 6 },
1870
- gap = 4,
1871
- aspectRatio = "auto",
1872
- minCardWidth = 350,
1873
- maxCardWidth = 350
1874
- } = settings;
1875
- const [globalFilter, setGlobalFilter] = (0, import_react2.useState)("");
1876
- const [fieldFilters, setFieldFilters] = (0, import_react2.useState)({});
1877
- const [sortField, setSortField] = (0, import_react2.useState)("");
1878
- const [sortDirection, setSortDirection] = (0, import_react2.useState)("asc");
1879
- const [selectedItems, setSelectedItems] = (0, import_react2.useState)(/* @__PURE__ */ new Set());
1880
- const [currentPage, setCurrentPage] = (0, import_react2.useState)(1);
1881
- const [pageSize, setPageSize] = (0, import_react2.useState)(pagination.pageSize || 12);
1882
- const [currentGridCols, setCurrentGridCols] = (0, import_react2.useState)(gridCols.default);
1883
- const filteredAndSortedData = (0, import_react2.useMemo)(() => {
1884
- let result = [...data];
1885
- if (enableGlobalSearch && globalFilter) {
1886
- const searchableFields = fields.filter((field) => field.searchable !== false);
1887
- result = result.filter(
1888
- (item) => searchableFields.some((field) => {
1889
- const value = item[field.key];
1890
- return value?.toString().toLowerCase().includes(globalFilter.toLowerCase());
1891
- })
1892
- );
1893
- }
1894
- if (enableFiltering) {
1895
- Object.keys(fieldFilters).forEach((key) => {
1896
- const value = fieldFilters[key];
1897
- if (value !== void 0 && value !== null && value !== "") {
1898
- const field = fields.find((f) => f.key === key);
1899
- if (field) {
1900
- result = result.filter((item) => {
1901
- const itemValue = item[key];
1902
- if (field.type === "boolean") {
1903
- return itemValue === (value === "true");
1904
- } else if (field.type === "number") {
1905
- return itemValue === Number(value);
1906
- } else {
1907
- return itemValue?.toString().toLowerCase().includes(String(value).toLowerCase());
1908
- }
1909
- });
1910
- }
1911
- }
1912
- });
1913
- }
1914
- if (enableSorting && sortField) {
1915
- const field = fields.find((f) => f.key === sortField);
1916
- if (field) {
1917
- result.sort((a, b) => {
1918
- const aValue = a[sortField];
1919
- const bValue = b[sortField];
1920
- if (field.type === "number") {
1921
- return sortDirection === "asc" ? Number(aValue) - Number(bValue) : Number(bValue) - Number(aValue);
1922
- } else if (field.type === "date") {
1923
- const aDate = new Date(aValue);
1924
- const bDate = new Date(bValue);
1925
- return sortDirection === "asc" ? aDate.getTime() - bDate.getTime() : bDate.getTime() - aDate.getTime();
1926
- } else {
1927
- const aStr = String(aValue).toLowerCase();
1928
- const bStr = String(bValue).toLowerCase();
1929
- return sortDirection === "asc" ? aStr.localeCompare(bStr) : bStr.localeCompare(aStr);
1930
- }
1931
- });
1932
- }
1933
- }
1934
- return result;
1935
- }, [
1936
- data,
1937
- globalFilter,
1938
- fieldFilters,
1939
- sortField,
1940
- sortDirection,
1941
- fields,
1942
- enableGlobalSearch,
1943
- enableFiltering,
1944
- enableSorting
1945
- ]);
1946
- const paginatedData = (0, import_react2.useMemo)(() => {
1947
- if (!pagination.enabled) return filteredAndSortedData;
1948
- const startIndex = (currentPage - 1) * pageSize;
1949
- const endIndex = startIndex + pageSize;
1950
- return filteredAndSortedData.slice(startIndex, endIndex);
1951
- }, [filteredAndSortedData, currentPage, pageSize, pagination.enabled]);
1952
- const totalPages = Math.ceil(filteredAndSortedData.length / pageSize);
1953
- const handleToggleSelect = (0, import_react2.useCallback)(
1954
- (index) => {
1955
- if (!enableSelection) return;
1956
- setSelectedItems((prev) => {
1957
- const newSelection = new Set(prev);
1958
- if (selectionMode === "single") {
1959
- newSelection.clear();
1960
- newSelection.add(index);
1961
- } else {
1962
- if (newSelection.has(index)) {
1963
- newSelection.delete(index);
1964
- } else {
1965
- newSelection.add(index);
1966
- }
1967
- }
1968
- return newSelection;
1969
- });
1970
- },
1971
- [enableSelection, selectionMode]
1972
- );
1973
- const handleSelectAll = (0, import_react2.useCallback)(() => {
1974
- if (!enableSelection || selectionMode === "single") return;
1975
- if (selectedItems.size === filteredAndSortedData.length) {
1976
- setSelectedItems(/* @__PURE__ */ new Set());
1977
- } else {
1978
- setSelectedItems(new Set(filteredAndSortedData.map((_, index) => index)));
1979
- }
1980
- }, [enableSelection, selectionMode, selectedItems.size, filteredAndSortedData.length]);
1981
- const handleFieldFilterChange = (0, import_react2.useCallback)((key, value) => {
1982
- setFieldFilters((prev) => ({ ...prev, [key]: value }));
1983
- setCurrentPage(1);
1984
- }, []);
1985
- const handleSortChange = (0, import_react2.useCallback)((field, direction) => {
1986
- setSortField(field);
1987
- setSortDirection(direction);
1988
- }, []);
1989
- const handleClearFilters = (0, import_react2.useCallback)(() => {
1990
- setGlobalFilter("");
1991
- setFieldFilters({});
1992
- setCurrentPage(1);
1993
- }, []);
1994
- const handleClearSorting = (0, import_react2.useCallback)(() => {
1995
- setSortField("");
1996
- setSortDirection("asc");
1997
- }, []);
1998
- const controller = (0, import_react2.useMemo)(
1999
- () => ({
2000
- getSelectedItems: () => Array.from(selectedItems).map((index) => filteredAndSortedData[index]),
2001
- clearSelection: () => setSelectedItems(/* @__PURE__ */ new Set()),
2002
- selectAll: handleSelectAll,
2003
- getFilteredData: () => filteredAndSortedData,
2004
- getTotalCount: () => data.length,
2005
- getVisibleCount: () => filteredAndSortedData.length,
2006
- refresh: () => onRefresh?.(),
2007
- exportData: () => onExport?.(filteredAndSortedData)
2008
- }),
2009
- [selectedItems, filteredAndSortedData, data.length, handleSelectAll, onRefresh, onExport]
2010
- );
2011
- const controllerRef = (0, import_react2.useRef)(null);
2012
- controllerRef.current = controller;
2013
- (0, import_react2.useEffect)(() => {
2014
- if (onTemplateReady && controllerRef.current) {
2015
- onTemplateReady(controllerRef.current);
2016
- }
2017
- }, []);
2018
- (0, import_react2.useEffect)(() => {
2019
- if (enableSelection && onSelectionChange) {
2020
- const selected = Array.from(selectedItems).map((index) => filteredAndSortedData[index]);
2021
- onSelectionChange(selected);
2022
- }
2023
- }, [selectedItems]);
2024
- const gridContainerClasses = cn(
2025
- "w-full",
2026
- "overflow-hidden",
2027
- // Prevent any potential overflow issues
2028
- className
2029
- );
2030
- const gridClasses = cn(
2031
- "grid",
2032
- `gap-${gap}`,
2033
- "w-full",
2034
- // Ensure grid takes full width
2035
- "mx-auto",
2036
- // Center the grid if it doesn't take full width
2037
- "items-start"
2038
- // Align items to the top
2039
- );
2040
- const gridStyle = {
2041
- // Primary grid definition - choose one of these options:
2042
- gridTemplateColumns: currentGridCols === 0 ? `repeat(auto-fill, minmax(clamp(${minCardWidth}px, 30%, ${maxCardWidth}px), 1fr))` : `repeat(auto-fill, minmax(clamp(${minCardWidth}px, calc(100%/${currentGridCols} - ${gap * 4}px), ${maxCardWidth}px), 1fr))`,
2043
- // gridTemplateColumns: `repeat(auto-fill, minmax(clamp(${minCardWidth}px, calc(100%/${Math.min(
2044
- // currentGridCols,
2045
- // gridCols["2xl"] || 6
2046
- // )} - ${gap * 4}px), ${maxCardWidth}px))`,
2047
- // Option 1: Fully fluid grid (recommended)
2048
- // gridTemplateColumns: `repeat(auto-fill, minmax(clamp(${minCardWidth}px, 30%, ${maxCardWidth}px), 1fr))`,
2049
- // Option 2: More controlled fluid grid
2050
- // gridTemplateColumns: `repeat(auto-fit, minmax(clamp(${minCardWidth}px, 25vw, ${maxCardWidth}px), 1fr))`,
2051
- // Option 3: Fixed maximum columns with fluid width
2052
- // gridTemplateColumns: `repeat(min(6, auto-fill), minmax(${minCardWidth}px, ${maxCardWidth}px))`,
2053
- // Additional grid enhancements
2054
- justifyItems: "center",
2055
- // Center items horizontally in their grid cells
2056
- alignItems: "stretch",
2057
- // Stretch items vertically to fill the grid cell
2058
- gridAutoRows: "1fr",
2059
- // Make all rows the same height
2060
- gridAutoFlow: "dense"
2061
- // Try to fill holes in the grid
2062
- };
2063
- if (error) {
2064
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Card, { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(CardContent, { className: "flex items-center justify-center py-12", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "text-center", children: [
2065
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "text-red-500 mb-3 text-2xl", children: "\u26A0\uFE0F" }),
2066
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "text-sm text-muted-foreground mb-4", children: error }),
2067
- onRefresh && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Button, { variant: "outline", size: "sm", onClick: onRefresh, children: [
2068
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react14.Loader2, { className: "mr-2 h-4 w-4" }),
2069
- "Try Again"
2070
- ] })
2071
- ] }) }) });
2072
- }
2073
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: cn("w-full flex gap-2 flex-col h-full", gridContainerClasses), children: [
2074
- header && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Card, { className: "shadow-sm border-0 py-0 text-xl font-bold", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(CardContent, { className: "p-2", children: header }) }),
2075
- toolbar && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2076
- DataTemplateToolbar,
2077
- {
2078
- fields,
2079
- filters,
2080
- globalFilter,
2081
- onGlobalFilterChange: setGlobalFilter,
2082
- fieldFilters,
2083
- onFieldFilterChange: handleFieldFilterChange,
2084
- sortField,
2085
- sortDirection,
2086
- onSortChange: handleSortChange,
2087
- selectedCount: selectedItems.size,
2088
- totalCount: data.length,
2089
- visibleCount: filteredAndSortedData.length,
2090
- onExport: enableExport ? () => onExport?.(filteredAndSortedData) : void 0,
2091
- onRefresh,
2092
- loading,
2093
- onClearFilters: handleClearFilters,
2094
- onClearSorting: handleClearSorting
2095
- }
2096
- ),
2097
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Card, { className: "border-0 overflow-auto shadow-none py-0 p-2 flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(CardContent, { className: "px-0", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "relative", children: [
2098
- loading && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "absolute inset-0 bg-background/80 backdrop-blur-sm z-50 flex items-center justify-center rounded-lg", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-center gap-3 bg-background/90 px-4 py-3 rounded-lg shadow-sm", children: [
2099
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react14.Loader2, { className: "size-5 animate-spin text-primary" }),
2100
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-sm font-medium text-muted-foreground", children: "Loading..." })
2101
- ] }) }),
2102
- paginatedData.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2103
- "div",
2104
- {
2105
- className: cn(gridClasses),
2106
- style: gridStyle,
2107
- children: paginatedData.map((item, index) => {
2108
- const globalIndex = pagination.enabled ? (currentPage - 1) * pageSize + index : index;
2109
- const isSelected = selectedItems.has(globalIndex);
2110
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
2111
- "div",
2112
- {
2113
- className: cn(
2114
- "relative h-full w-full flex flex-col",
2115
- "transition-all duration-200 overflow-hidden",
2116
- "rounded-2xl",
2117
- "border border-border/20 hover:border-border/50",
2118
- aspectRatio === "square" ? "aspect-square" : "",
2119
- aspectRatio === "video" ? "aspect-video" : "",
2120
- enableSelection ? "cursor-pointer" : "",
2121
- isSelected ? "ring-2 ring-primary" : ""
2122
- ),
2123
- onClick: () => enableSelection && handleToggleSelect(globalIndex),
2124
- children: [
2125
- enableSelection && selectionMode === "multiple" && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "absolute top-2 right-2 z-10", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2126
- Checkbox,
2127
- {
2128
- checked: isSelected,
2129
- onCheckedChange: () => handleToggleSelect(globalIndex),
2130
- className: "bg-background/80 backdrop-blur-sm",
2131
- onClick: (e) => e.stopPropagation()
2132
- }
2133
- ) }),
2134
- template(item, index, isSelected, () => handleToggleSelect(globalIndex))
2135
- ]
2136
- },
2137
- globalIndex
2138
- );
2139
- })
2140
- }
2141
- ) : /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex flex-col gap-4 items-center justify-center py-12 text-center", children: [
2142
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "text-6xl", children: emptyIcon || "\u{1F4CB}" }),
2143
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "text-lg font-medium text-muted-foreground mb-2", children: emptyMessage }),
2144
- (globalFilter || Object.values(fieldFilters).some((v) => v)) && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Button, { variant: "outline", onClick: handleClearFilters, children: "Clear Filters" })
2145
- ] })
2146
- ] }) }) }),
2147
- pagination.enabled && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "pb-1", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2148
- DataTemplatePagination,
2149
- {
2150
- currentPage,
2151
- totalPages,
2152
- pageSize,
2153
- totalItems: filteredAndSortedData.length,
2154
- onPageChange: setCurrentPage,
2155
- onPageSizeChange: (size) => {
2156
- setPageSize(size);
2157
- setCurrentPage(1);
2158
- },
2159
- config: pagination
2160
- }
2161
- ) }),
2162
- footer && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "p-2 m-0.5", children: footer }),
2163
- children && children(controller)
2164
- ] });
2165
- }
2166
-
2167
- // src/components/data/data-template/data-template-action-bar.tsx
2168
- var import_lucide_react15 = require("lucide-react");
2169
- var import_framer_motion2 = require("framer-motion");
2170
- var React2 = __toESM(require("react"), 1);
2171
- var ReactDOM2 = __toESM(require("react-dom"), 1);
2172
- var import_jsx_runtime25 = require("react/jsx-runtime");
2173
- function DataTemplateActionBar({
2174
- controller,
2175
- visible: visibleProp,
2176
- container: containerProp,
2177
- children,
2178
- className,
2179
- ...props
2180
- }) {
2181
- const [mounted, setMounted] = React2.useState(false);
2182
- React2.useLayoutEffect(() => {
2183
- setMounted(true);
2184
- }, []);
2185
- React2.useEffect(() => {
2186
- function onKeyDown(event) {
2187
- if (event.key === "Escape" && controller) {
2188
- controller.clearSelection();
2189
- }
2190
- }
2191
- window.addEventListener("keydown", onKeyDown);
2192
- return () => window.removeEventListener("keydown", onKeyDown);
2193
- }, [controller]);
2194
- const container = containerProp ?? (mounted ? globalThis.document?.body : null);
2195
- if (!container || !controller) return null;
2196
- const selectedItems = controller.getSelectedItems();
2197
- const visible = visibleProp ?? selectedItems.length > 0;
2198
- return ReactDOM2.createPortal(
2199
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_framer_motion2.AnimatePresence, { children: visible && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2200
- import_framer_motion2.motion.div,
2201
- {
2202
- role: "toolbar",
2203
- "aria-orientation": "horizontal",
2204
- initial: { opacity: 0, y: 20 },
2205
- animate: { opacity: 1, y: 0 },
2206
- exit: { opacity: 0, y: 20 },
2207
- transition: { duration: 0.3, ease: "easeInOut" },
2208
- className: cn(
2209
- "fixed inset-x-0 bottom-6 z-50 mx-auto flex w-fit flex-wrap items-center justify-center gap-2 rounded-xl border bg-primary/10 backdrop-blur-sm p-3 text-foreground ring-8 ring-primary/5",
2210
- className
2211
- ),
2212
- ...props,
2213
- children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TooltipProvider, { children })
2214
- }
2215
- ) }),
2216
- container
2217
- );
2218
- }
2219
- function DataTemplateActionBarAction({
2220
- size = "sm",
2221
- variant = "secondary",
2222
- tooltip,
2223
- isPending,
2224
- disabled,
2225
- className,
2226
- children,
2227
- onClick,
2228
- ...props
2229
- }) {
2230
- const trigger = /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2231
- Button,
2232
- {
2233
- variant,
2234
- size,
2235
- className: cn(
2236
- "gap-1.5 rounded-lg border border-secondary bg-secondary/50 hover:bg-secondary/70 transition-all duration-200",
2237
- size === "icon" ? "size-8" : "h-8 px-3",
2238
- className
2239
- ),
2240
- disabled: disabled || isPending,
2241
- onClick,
2242
- ...props,
2243
- children: isPending ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react15.Loader, { className: "animate-spin" }) : children
2244
- }
2245
- );
2246
- if (!tooltip) return trigger;
2247
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(Tooltip, { children: [
2248
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TooltipTrigger, { asChild: true, children: trigger }),
2249
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2250
- TooltipContent,
2251
- {
2252
- sideOffset: 8,
2253
- className: "rounded-lg border font-semibold text-foreground bg-secondary [&>span]:hidden",
2254
- children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { children: tooltip })
2255
- }
2256
- )
2257
- ] });
2258
- }
2259
- function DataTemplateActionBarSelection({ controller }) {
2260
- const onClearSelection = React2.useCallback(() => {
2261
- if (controller) {
2262
- controller.clearSelection();
2263
- }
2264
- }, [controller]);
2265
- if (!controller) return null;
2266
- const selectedItems = controller.getSelectedItems();
2267
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex h-8 items-center rounded-lg border bg-muted/50 pr-1 pl-3", children: [
2268
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: "whitespace-nowrap text-sm font-medium", children: [
2269
- selectedItems.length,
2270
- " selected"
2271
- ] }),
2272
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Separator, { orientation: "vertical", className: "mr-2 ml-3 data-[orientation=vertical]:h-4" }),
2273
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(Tooltip, { children: [
2274
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Button, { variant: "ghost", size: "icon", className: "size-6 rounded-md", onClick: onClearSelection, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react15.X, { className: "size-3.5" }) }) }),
2275
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
2276
- TooltipContent,
2277
- {
2278
- sideOffset: 10,
2279
- className: "flex items-center gap-2 rounded-lg border px-3 py-2 font-semibold text-foreground bg-secondary [&>span]:hidden",
2280
- children: [
2281
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { children: "Clear selection" }),
2282
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("kbd", { className: "select-none rounded border bg-primary/50 px-2 py-1 font-mono font-normal text-[0.7rem] text-foreground shadow-sm", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("abbr", { title: "Escape", className: "no-underline", children: "Esc" }) })
2283
- ]
2284
- }
2285
- )
2286
- ] })
2287
- ] });
2288
- }
2289
-
2290
- // src/components/layouts/app-container.tsx
2291
- var import_jsx_runtime26 = require("react/jsx-runtime");
2292
- var spacingClasses = {
2293
- "none": "gap-0",
2294
- "tight": "gap-2",
2295
- "default": "gap-4",
2296
- "loose": "gap-6",
2297
- "extra-loose": "gap-8"
2298
- };
2299
- var paddingClasses = {
2300
- "none": "p-0",
2301
- "tight": "p-2",
2302
- "default": "p-4",
2303
- "loose": "p-6"
2304
- };
2305
- var AppContainer = ({
2306
- children,
2307
- className,
2308
- spacing = "tight",
2309
- padding = "none"
2310
- }) => {
2311
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: cn(
2312
- "flex flex-col h-full",
2313
- spacingClasses[spacing],
2314
- paddingClasses[padding],
2315
- className
2316
- ), children });
2317
- };
2318
-
2319
- // src/components/layouts/app-header.tsx
2320
- var import_lucide_react16 = require("lucide-react");
2321
- var import_react_router = require("react-router");
2322
- var import_jsx_runtime27 = require("react/jsx-runtime");
2323
- var AppHeader = ({
2324
- className,
2325
- columns = [],
2326
- showBackButton = true,
2327
- meta = { title: "" }
2328
- }) => {
2329
- const renderBackAction = () => {
2330
- if (!meta.backAction || !showBackButton) return null;
2331
- const buttonProps = {
2332
- variant: "secondary",
2333
- size: "icon",
2334
- className: "hover:bg-primary/20 inline-flex"
2335
- };
2336
- if (meta.backAction.href) {
2337
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_react_router.NavLink, { to: meta.backAction.href, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Button, { ...buttonProps, children: [
2338
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react16.ArrowLeftIcon, { className: "size-6" }),
2339
- meta.backAction.content
2340
- ] }) });
2341
- }
2342
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Button, { ...buttonProps, onClick: meta.backAction.onClick, children: [
2343
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react16.ArrowLeftIcon, { className: "size-6" }),
2344
- meta.backAction.content
2345
- ] });
2346
- };
2347
- const renderMetadata = () => {
2348
- if (!meta.metadata || meta.metadata.length === 0) return null;
2349
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "flex gap-4", children: meta.metadata.map((item, index) => item.value && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "text-sm", children: [
2350
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "text-muted-foreground", children: [
2351
- item.label,
2352
- " "
2353
- ] }),
2354
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: item.value })
2355
- ] }, index)) });
2356
- };
2357
- const renderStatus = () => {
2358
- if (!meta.status) return null;
2359
- const colorClasses = {
2360
- success: "bg-green-100 text-green-800",
2361
- warning: "bg-yellow-100 text-yellow-800",
2362
- critical: "bg-red-100 text-red-800",
2363
- info: "bg-blue-100 text-blue-800",
2364
- default: "bg-gray-100 text-gray-800"
2365
- };
2366
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: cn(
2367
- "inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium",
2368
- colorClasses[meta.status.color]
2369
- ), children: meta.status.content });
2370
- };
2371
- const reservedColumn = {
2372
- content: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex gap-2 items-center", children: [
2373
- renderBackAction(),
2374
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-col gap-2 w-max", children: [
2375
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("h1", { className: "text-2xl font-bold tracking-tight", children: meta.title }),
2376
- renderStatus(),
2377
- meta.description && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { className: "text-muted-foreground", children: meta.description }),
2378
- renderMetadata(),
2379
- meta.breadcrumbs && meta.breadcrumbs.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "flex items-center text-sm text-muted-foreground", children: meta.breadcrumbs.map((crumb, index) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center", children: [
2380
- crumb.href ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "hover:text-primary hover:underline", children: crumb.label }) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: crumb.label }),
2381
- index < meta.breadcrumbs.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react16.ChevronRight, { className: "mx-2 h-4 w-4" })
2382
- ] }, index)) })
2383
- ] })
2384
- ] }),
2385
- align: "left",
2386
- width: "fill"
2387
- };
2388
- const actionsColumn = {
2389
- content: meta.primaryActions,
2390
- align: "right",
2391
- width: "auto"
2392
- };
2393
- const allColumns = [
2394
- reservedColumn,
2395
- ...columns.filter((col) => col !== void 0),
2396
- actionsColumn
2397
- ];
2398
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: cn("flex items-center w-full gap-4 p-2", className), children: allColumns.map((column, index) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
2399
- "div",
2400
- {
2401
- className: cn(
2402
- "flex items-center h-full",
2403
- column.className,
2404
- {
2405
- "justify-start": column.align === "left",
2406
- "justify-center": column.align === "center",
2407
- "justify-end": column.align === "right",
2408
- "flex-1": column.width === "fill"
2409
- }
2410
- ),
2411
- children: column.content
2412
- },
2413
- index
2414
- )) });
2415
- };
2416
-
2417
- // src/components/layouts/app-content.tsx
2418
- var import_react3 = __toESM(require("react"), 1);
2419
-
2420
- // src/components/ui/sheet.tsx
2421
- var import_radix_ui11 = require("radix-ui");
2422
- var import_lucide_react17 = require("lucide-react");
2423
- var import_jsx_runtime28 = require("react/jsx-runtime");
2424
- function Sheet({ ...props }) {
2425
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_radix_ui11.Dialog.Root, { "data-slot": "sheet", ...props });
2426
- }
2427
- function SheetTrigger({
2428
- ...props
2429
- }) {
2430
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_radix_ui11.Dialog.Trigger, { "data-slot": "sheet-trigger", ...props });
2431
- }
2432
- function SheetPortal({
2433
- ...props
2434
- }) {
2435
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_radix_ui11.Dialog.Portal, { "data-slot": "sheet-portal", ...props });
2436
- }
2437
- function SheetOverlay({
2438
- className,
2439
- ...props
2440
- }) {
2441
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
2442
- import_radix_ui11.Dialog.Overlay,
2443
- {
2444
- "data-slot": "sheet-overlay",
2445
- className: cn(
2446
- "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
2447
- className
2448
- ),
2449
- ...props
2450
- }
2451
- );
2452
- }
2453
- function SheetContent({
2454
- className,
2455
- children,
2456
- side = "right",
2457
- ...props
2458
- }) {
2459
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(SheetPortal, { children: [
2460
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(SheetOverlay, {}),
2461
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
2462
- import_radix_ui11.Dialog.Content,
2463
- {
2464
- "data-slot": "sheet-content",
2465
- className: cn(
2466
- "bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",
2467
- side === "right" && "data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",
2468
- side === "left" && "data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",
2469
- side === "top" && "data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",
2470
- side === "bottom" && "data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",
2471
- className
2472
- ),
2473
- ...props,
2474
- children: [
2475
- children,
2476
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_radix_ui11.Dialog.Close, { className: "ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none", children: [
2477
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react17.XIcon, { className: "size-4" }),
2478
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "sr-only", children: "Close" })
2479
- ] })
2480
- ]
2481
- }
2482
- )
2483
- ] });
2484
- }
2485
-
2486
- // src/components/layouts/app-content.tsx
2487
- var import_jsx_runtime29 = require("react/jsx-runtime");
2488
- var AppContentContext = (0, import_react3.createContext)(false);
2489
- var splitRatioClasses = {
2490
- "one-half": ["w-1/2", "w-1/2"],
2491
- "one-third": ["w-1/3", "w-2/3"],
2492
- "two-third": ["w-2/3", "w-1/3"],
2493
- "one-fourth": ["w-1/4", "w-3/4"],
2494
- "three-fourth": ["w-3/4", "w-1/4"],
2495
- "one-fifth": ["w-1/5", "w-4/5"],
2496
- "four-fifth": ["w-4/5", "w-1/5"]
2497
- };
2498
- var paddingClasses2 = {
2499
- none: "p-0",
2500
- tight: "p-2",
2501
- default: "p-4",
2502
- loose: "p-6"
2503
- };
2504
- var getContainerSheetClasses = (side, width) => {
2505
- const [contentWidth, sheetWidth] = splitRatioClasses[width];
2506
- return {
2507
- container: "inset-y-0 z-50 transition-all duration-500 ease-in-out",
2508
- content: cn(
2509
- "h-full bg-background transition-all duration-500 ease-in-out",
2510
- side === "right" ? "border-l" : "border-r"
2511
- ),
2512
- transform: side === "right" ? "translate-x-full" : "-translate-x-full",
2513
- transformOpen: "translate-x-0",
2514
- contentPushClass: side === "right" ? contentWidth : sheetWidth,
2515
- sheetPushClass: side === "right" ? sheetWidth : contentWidth
2516
- };
2517
- };
2518
- var baseClasses = "flex flex-col overflow-hidden rounded-2xl relative";
2519
- var variantClasses = {
2520
- default: "bg-background",
2521
- card: "bg-background shadow-sm border",
2522
- border: "bg-background border-2",
2523
- transparent: "bg-transparent"
2524
- };
2525
- var AppContent = (props) => {
2526
- const {
2527
- children,
2528
- className,
2529
- variant = "default",
2530
- layout = "full",
2531
- header,
2532
- footer,
2533
- headerClassName,
2534
- footerClassName,
2535
- parentContainer = false,
2536
- padding = parentContainer ? "none" : "tight"
2537
- } = props;
2538
- const isNested = (0, import_react3.useContext)(AppContentContext);
2539
- const [internalSheetOpen, setInternalSheetOpen] = (0, import_react3.useState)(false);
2540
- const contentWrapper = import_react3.default.useCallback(
2541
- (content) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: cn(
2542
- "flex-1 overflow-auto h-full no-scrollbar",
2543
- parentContainer && "flex",
2544
- !parentContainer && paddingClasses2[padding]
2545
- ), children: content }),
2546
- [padding, parentContainer]
2547
- );
2548
- const renderContent = () => {
2549
- switch (layout) {
2550
- case "split": {
2551
- const { splitRatio = "three-fourth", reverse = false } = props;
2552
- if (!Array.isArray(children) || children.length !== 2) {
2553
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "flex items-center justify-center h-full text-red-500", children: 'Error: AppContent with layout="split" requires exactly 2 children' });
2554
- }
2555
- const [leftClass, rightClass] = splitRatioClasses[splitRatio];
2556
- const [firstChild, secondChild] = reverse ? [children[1], children[0]] : [children[0], children[1]];
2557
- const [firstClass, secondClass] = reverse ? [rightClass, leftClass] : [leftClass, rightClass];
2558
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex h-full gap-2", children: [
2559
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: cn(firstClass, "overflow-auto"), children: contentWrapper(firstChild) }),
2560
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: cn(secondClass, "overflow-auto"), children: contentWrapper(secondChild) })
2561
- ] });
2562
- }
2563
- case "with-sheet": {
2564
- const {
2565
- sheetContent,
2566
- sheetWidth = "four-fifth",
2567
- sheetSide = "right",
2568
- sheetMode = "container",
2569
- sheetTrigger,
2570
- sheetClassName,
2571
- isSheetOpen,
2572
- onSheetOpenChange,
2573
- showSheetOverlay = true,
2574
- disableOverlay = true
2575
- } = props;
2576
- const isControlled = isSheetOpen !== void 0;
2577
- const sheetOpen = isControlled ? isSheetOpen : internalSheetOpen;
2578
- const setSheetOpen = isControlled ? onSheetOpenChange : setInternalSheetOpen;
2579
- if (sheetMode === "container") {
2580
- const sheetClasses = getContainerSheetClasses(sheetSide, sheetWidth);
2581
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: cn(
2582
- "flex relative flex-1 overflow-hidden",
2583
- sheetOpen && disableOverlay && ["left", "right"].includes(sheetSide)
2584
- ), children: [
2585
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: cn(
2586
- "h-full overflow-auto transition-all duration-500",
2587
- sheetOpen && disableOverlay && ["left", "right"].includes(sheetSide) ? sheetClasses.contentPushClass : "w-full",
2588
- sheetOpen && disableOverlay && "overflow-y-auto overflow-x-hidden"
2589
- ), children: [
2590
- sheetTrigger && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { onClick: () => setSheetOpen?.(!sheetOpen), children: sheetTrigger }),
2591
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: cn("h-full", !parentContainer && paddingClasses2[padding]), children })
2592
- ] }),
2593
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
2594
- "div",
2595
- {
2596
- className: cn(
2597
- sheetClasses.container,
2598
- "transition-all duration-500 ease-in-out",
2599
- sheetOpen && disableOverlay && ["left", "right"].includes(sheetSide) ? cn(sheetClasses.sheetPushClass, "overflow-y-auto") : sheetOpen ? sheetClasses.transformOpen : cn(sheetClasses.transform, "hidden"),
2600
- "overflow-y-auto"
2601
- ),
2602
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: cn(sheetClasses.content, sheetClassName, "h-full"), children: sheetContent })
2603
- }
2604
- ),
2605
- sheetOpen && showSheetOverlay && !disableOverlay && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
2606
- "div",
2607
- {
2608
- className: cn(
2609
- "absolute inset-0 bg-secondary/20 z-40",
2610
- "transition-opacity duration-500 ease-in-out",
2611
- "opacity-0",
2612
- sheetOpen ? "opacity-100" : "opacity-0"
2613
- ),
2614
- onClick: () => setSheetOpen?.(false)
2615
- }
2616
- )
2617
- ] });
2618
- }
2619
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Sheet, { open: sheetOpen, onOpenChange: setSheetOpen, children: [
2620
- sheetTrigger && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(SheetTrigger, { asChild: true, children: sheetTrigger }),
2621
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(SheetPortal, { children: [
2622
- showSheetOverlay && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(SheetOverlay, { className: "fixed inset-0 bg-secondary/50 z-50" }),
2623
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
2624
- SheetContent,
2625
- {
2626
- side: sheetSide,
2627
- className: cn(
2628
- "fixed bg-background border",
2629
- "transition-all duration-500 ease-in-out",
2630
- splitRatioClasses[sheetWidth][1],
2631
- sheetClassName
2632
- ),
2633
- children: sheetContent
2634
- }
2635
- )
2636
- ] })
2637
- ] });
2638
- }
2639
- default:
2640
- return contentWrapper(children);
2641
- }
2642
- };
2643
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(AppContentContext.Provider, { value: true, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: cn(
2644
- baseClasses,
2645
- variantClasses[variant],
2646
- paddingClasses2[padding],
2647
- isNested && "flex-1",
2648
- parentContainer && "h-full",
2649
- !parentContainer && "rounded-2xl",
2650
- className
2651
- ), children: [
2652
- header && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
2653
- "div",
2654
- {
2655
- className: cn(
2656
- "border-b",
2657
- headerClassName,
2658
- variant === "card" && !parentContainer && "rounded-t-2xl",
2659
- variant === "border" && "border-b-2",
2660
- paddingClasses2[padding]
2661
- ),
2662
- children: header
2663
- }
2664
- ),
2665
- renderContent(),
2666
- footer && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
2667
- "div",
2668
- {
2669
- className: cn(
2670
- "border-t",
2671
- footerClassName,
2672
- variant === "card" && !parentContainer && "rounded-b-2xl",
2673
- variant === "border" && "border-t-2",
2674
- paddingClasses2[padding]
2675
- ),
2676
- children: footer
2677
- }
2678
- )
2679
- ] }) });
2680
- };
2681
-
2682
- // src/components/layouts/app-footer.tsx
2683
- var import_jsx_runtime30 = require("react/jsx-runtime");
2684
- var AppFooter = ({
2685
- className,
2686
- columns = [],
2687
- meta = { title: "" }
2688
- }) => {
2689
- const actionsColumn = {
2690
- content: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "flex items-center gap-4 p-2", children: meta.secondaryActions }),
2691
- align: "right",
2692
- width: "fill"
2693
- };
2694
- const allColumns = [
2695
- ...columns.filter((col) => col !== void 0),
2696
- actionsColumn
2697
- ];
2698
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: cn("flex items-center w-full gap-4", className), children: allColumns.map((column, index) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
2699
- "div",
2700
- {
2701
- className: cn(
2702
- "flex items-center h-full",
2703
- column.className,
2704
- {
2705
- "justify-start": column.align === "left",
2706
- "justify-center": column.align === "center",
2707
- "justify-end": column.align === "right",
2708
- "flex-1": column.width === "fill"
2709
- }
2710
- ),
2711
- children: column.content
2712
- },
2713
- index
2714
- )) });
2715
- };
2716
-
2717
- // src/components/layouts/factories.tsx
2718
- var import_jsx_runtime31 = require("react/jsx-runtime");
2719
- function createLayoutComponents({
2720
- useTypedAppMeta
2721
- }) {
2722
- const AppHeader2 = (props) => {
2723
- const { meta } = useTypedAppMeta();
2724
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(AppHeader, { ...props, meta });
2725
- };
2726
- const AppFooter2 = (props) => {
2727
- const { meta } = useTypedAppMeta();
2728
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(AppFooter, { ...props, meta });
2729
- };
2730
- const AppContent2 = (props) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(AppContent, { ...props });
2731
- const AppContainer2 = (props) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(AppContainer, { ...props });
2732
- return {
2733
- AppHeader: AppHeader2,
2734
- AppFooter: AppFooter2,
2735
- AppContent: AppContent2,
2736
- AppContainer: AppContainer2
2737
- };
2738
- }
2739
-
2740
- // src/context/app-meta/context.tsx
2741
- var import_react4 = require("react");
2742
- var import_jsx_runtime32 = require("react/jsx-runtime");
2743
- var AppMetaContext = (0, import_react4.createContext)(void 0);
2744
- var AppMetaProvider = ({ children }) => {
2745
- const [meta, setMetaState] = (0, import_react4.useState)({
2746
- title: "",
2747
- description: "",
2748
- breadcrumbs: []
2749
- });
2750
- const setMeta = (0, import_react4.useCallback)((partialMeta) => {
2751
- setMetaState((prev) => {
2752
- const hasChanges = Object.keys(partialMeta).some(
2753
- (key) => JSON.stringify(prev[key]) !== JSON.stringify(partialMeta[key])
2754
- );
2755
- return hasChanges ? { ...prev, ...partialMeta } : prev;
2756
- });
2757
- }, []);
2758
- const resetMeta = (0, import_react4.useCallback)(() => {
2759
- setMetaState((prev) => prev.title === "" && prev.description === "" && (prev.breadcrumbs?.length ?? 0) === 0 ? prev : {
2760
- title: "",
2761
- description: "",
2762
- breadcrumbs: []
2763
- });
2764
- }, []);
2765
- const contextValue = (0, import_react4.useMemo)(() => ({
2766
- meta,
2767
- setMeta,
2768
- resetMeta
2769
- }), [meta, setMeta, resetMeta]);
2770
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(AppMetaContext.Provider, { value: contextValue, children });
2771
- };
2772
- function createTypedAppMetaContext() {
2773
- const TypedAppMetaContext = (0, import_react4.createContext)(void 0);
2774
- const TypedAppMetaProvider = ({ children }) => {
2775
- const [meta, setMetaState] = (0, import_react4.useState)({
2776
- title: "",
2777
- description: "",
2778
- breadcrumbs: []
2779
- });
2780
- const setMeta = (0, import_react4.useCallback)((partialMeta) => {
2781
- setMetaState((prev) => {
2782
- const hasChanges = Object.keys(partialMeta).some((key) => {
2783
- const prevValue = prev[key];
2784
- const newValue = partialMeta[key];
2785
- return JSON.stringify(prevValue) !== JSON.stringify(newValue);
2786
- });
2787
- return hasChanges ? { ...prev, ...partialMeta } : prev;
2788
- });
2789
- }, []);
2790
- const resetMeta = (0, import_react4.useCallback)(() => {
2791
- setMetaState((prev) => prev.title === "" && prev.description === "" && (prev.breadcrumbs?.length ?? 0) === 0 ? prev : {
2792
- title: "",
2793
- description: "",
2794
- breadcrumbs: []
2795
- });
2796
- }, []);
2797
- const contextValue = (0, import_react4.useMemo)(() => ({
2798
- meta,
2799
- setMeta,
2800
- resetMeta
2801
- }), [meta, setMeta, resetMeta]);
2802
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TypedAppMetaContext.Provider, { value: contextValue, children });
2803
- };
2804
- const useTypedAppMeta = () => {
2805
- const context = (0, import_react4.useContext)(TypedAppMetaContext);
2806
- if (!context) {
2807
- throw new Error("useTypedAppMeta must be used within a TypedAppMetaProvider");
2808
- }
2809
- return context;
2810
- };
2811
- return { TypedAppMetaProvider, useTypedAppMeta, TypedAppMetaContext };
2812
- }
2813
-
2814
- // src/context/app-meta/hooks.ts
2815
- var import_react5 = require("react");
2816
- function createPageTemplateHook({
2817
- useTypedAppMeta
2818
- }) {
2819
- function usePageTemplate(options) {
2820
- const { setMeta, resetMeta } = useTypedAppMeta();
2821
- const backAction = (0, import_react5.useMemo)(() => {
2822
- if (!options.backAction) return void 0;
2823
- return {
2824
- ...options.backAction,
2825
- onClick: options.backAction.onClick
2826
- };
2827
- }, [options.backAction?.content, options.backAction?.href, options.backAction?.onClick?.toString()]);
2828
- const metadata = (0, import_react5.useMemo)(() => options.metadata, [JSON.stringify(options.metadata)]);
2829
- const stableOptions = (0, import_react5.useMemo)(() => ({
2830
- ...options,
2831
- backAction,
2832
- metadata
2833
- }), [
2834
- options.title,
2835
- options.description,
2836
- options.breadcrumbs,
2837
- options.primaryActions,
2838
- options.secondaryActions,
2839
- options.pagination,
2840
- options.status,
2841
- backAction,
2842
- metadata
2843
- ]);
2844
- (0, import_react5.useEffect)(() => {
2845
- setMeta(stableOptions);
2846
- return () => resetMeta();
2847
- }, [stableOptions, setMeta, resetMeta]);
2848
- }
2849
- return { usePageTemplate };
2850
- }
2851
-
2852
- // src/components/general.tsx
2853
- var import_react6 = require("react");
2854
- var import_lucide_react18 = require("lucide-react");
2855
- var import_jsx_runtime33 = require("react/jsx-runtime");
2856
- var GeneralHelper = class {
2857
- static currencyFormatter = new Intl.NumberFormat("en-IN", {
2858
- style: "currency",
2859
- currency: "INR",
2860
- maximumFractionDigits: 2
2861
- });
2862
- static compactFormatter = new Intl.NumberFormat("en-IN", {
2863
- style: "currency",
2864
- currency: "INR",
2865
- notation: "compact",
2866
- maximumFractionDigits: 1
2867
- });
2868
- static MONTH_NAMES_SHORT = [
2869
- "Jan",
2870
- "Feb",
2871
- "Mar",
2872
- "Apr",
2873
- "May",
2874
- "Jun",
2875
- "Jul",
2876
- "Aug",
2877
- "Sep",
2878
- "Oct",
2879
- "Nov",
2880
- "Dec"
2881
- ];
2882
- /**
2883
- * Copies text to clipboard
2884
- * @param text Text to copy
2885
- * @returns Promise that resolves when copy is complete
2886
- */
2887
- static async copyToClipboard(text) {
2888
- if (!text) return;
2889
- try {
2890
- await navigator.clipboard.writeText(text);
2891
- } catch (error) {
2892
- console.error("Failed to copy text:", error);
2893
- throw error;
2894
- }
2895
- }
2896
- /**
2897
- * React component for copy to clipboard functionality
2898
- */
2899
- static CopyToClipboard = ({
2900
- text,
2901
- children,
2902
- className,
2903
- size = "icon",
2904
- variant = "ghost"
2905
- }) => {
2906
- const [isCopied, setIsCopied] = (0, import_react6.useState)(false);
2907
- const [isLoading, setIsLoading] = (0, import_react6.useState)(false);
2908
- const handleCopy = async () => {
2909
- if (!text || isLoading) return;
2910
- setIsLoading(true);
2911
- try {
2912
- await this.copyToClipboard(text);
2913
- setIsCopied(true);
2914
- setTimeout(() => setIsCopied(false), 2e3);
2915
- } catch (error) {
2916
- console.error("Failed to copy text:", error);
2917
- } finally {
2918
- setIsLoading(false);
2919
- }
2920
- };
2921
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(Tooltip, { children: [
2922
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
2923
- Button,
2924
- {
2925
- variant,
2926
- size,
2927
- className: cn(
2928
- size === "icon" && "size-6",
2929
- className
2930
- ),
2931
- onClick: handleCopy,
2932
- disabled: isLoading || !text,
2933
- children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_lucide_react18.Loader2Icon, { className: "animate-spin" }) : isCopied ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_lucide_react18.Check, { className: "h-3 w-3" }) : children ? children : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_lucide_react18.Copy, { className: "h-3 w-3" })
2934
- }
2935
- ) }),
2936
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TooltipContent, { children: isCopied ? "Copied!" : isLoading ? "Copying..." : "Copy to clipboard" })
2937
- ] });
2938
- };
2939
- /**
2940
- * Formats a number as Indian Rupees (INR)
2941
- * @param amount Amount to format
2942
- * @param options Formatting options
2943
- * @returns Formatted currency string
2944
- */
2945
- static formatINR(amount, options = {}) {
2946
- const { prefix = "", suffix = "", withSymbol = true, compact = false } = options;
2947
- if (typeof amount !== "number" || isNaN(amount)) {
2948
- return `${prefix}${withSymbol ? "\u20B9 " : ""}0.00${suffix}`;
2949
- }
2950
- const isNegative = amount < 0;
2951
- const absoluteAmount = Math.abs(amount);
2952
- const formatter = compact && absoluteAmount >= 1e5 ? this.compactFormatter : this.currencyFormatter;
2953
- const formatted = formatter.format(absoluteAmount).replace("\u20B9", "");
2954
- return `${prefix}${isNegative ? "- " : ""}${withSymbol ? "\u20B9 " : ""}${formatted}${suffix}`;
2955
- }
2956
- /**
2957
- * Formats a date according to specified options
2958
- * @param input Date input (string, number, or Date object)
2959
- * @param options Formatting options
2960
- * @returns Formatted date string
2961
- */
2962
- static formatDate(input, options = {}) {
2963
- const { format = "dd-mm-yyyy", separator = "-" } = options;
2964
- const dateObj = new Date(input);
2965
- if (isNaN(dateObj.getTime())) return "";
2966
- const dd = String(dateObj.getDate()).padStart(2, "0");
2967
- const mm = String(dateObj.getMonth() + 1).padStart(2, "0");
2968
- const mmm = this.MONTH_NAMES_SHORT[dateObj.getMonth()];
2969
- const yyyy = dateObj.getFullYear();
2970
- switch (format) {
2971
- case "dd-mmm-yyyy":
2972
- return `${dd}${separator}${mmm}${separator}${yyyy}`;
2973
- case "iso":
2974
- return dateObj.toISOString().split("T")[0];
2975
- case "long":
2976
- return dateObj.toLocaleDateString("en-IN", {
2977
- year: "numeric",
2978
- month: "long",
2979
- day: "numeric"
2980
- });
2981
- case "short":
2982
- return dateObj.toLocaleDateString("en-IN");
2983
- default:
2984
- return `${dd}${separator}${mm}${separator}${yyyy}`;
2985
- }
2986
- }
2987
- static toProperCase(text) {
2988
- if (!text) return "";
2989
- return text.toLowerCase().split(" ").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
2990
- }
2991
- /**
2992
- * Advanced proper case conversion that handles hyphenated words and apostrophes
2993
- * @param text Text to convert
2994
- * @returns Text in proper case with special handling
2995
- */
2996
- static toProperCaseAdvanced(text) {
2997
- if (!text) return "";
2998
- return text.toLowerCase().split(/(\s+|['-])/).map((part, index, array) => {
2999
- if (["-", "'", " "].includes(part) || index > 0 && ["-", "'"].includes(array[index - 1])) {
3000
- return part;
3001
- }
3002
- return part.charAt(0).toUpperCase() + part.slice(1);
3003
- }).join("");
3004
- }
3005
- static StatusBadge = ({
3006
- status,
3007
- className,
3008
- showDot = true,
3009
- capitalize = true,
3010
- size = "md",
3011
- variant = "outline",
3012
- customColors,
3013
- icon,
3014
- trueMessage = "active",
3015
- falseMessage = "inactive"
3016
- }) => {
3017
- const normalizedStatus = typeof status === "boolean" ? status ? trueMessage : falseMessage : typeof status === "number" ? status > 0 ? trueMessage : falseMessage : status.toLowerCase();
3018
- const statusConfig = {
3019
- active: {
3020
- label: "active",
3021
- solid: {
3022
- bg: "bg-emerald-500",
3023
- text: "text-white",
3024
- border: "border-emerald-600",
3025
- dot: "bg-white"
3026
- },
3027
- outline: {
3028
- bg: "bg-emerald-50",
3029
- text: "text-emerald-700",
3030
- border: "border-emerald-100",
3031
- dot: "bg-emerald-500"
3032
- },
3033
- subtle: {
3034
- bg: "bg-emerald-50",
3035
- text: "text-emerald-700",
3036
- border: "border-transparent",
3037
- dot: "bg-emerald-500"
3038
- }
3039
- },
3040
- pending: {
3041
- label: "pending",
3042
- solid: {
3043
- bg: "bg-amber-500",
3044
- text: "text-white",
3045
- border: "border-amber-600",
3046
- dot: "bg-white"
3047
- },
3048
- outline: {
3049
- bg: "bg-amber-50",
3050
- text: "text-amber-700",
3051
- border: "border-amber-100",
3052
- dot: "bg-amber-500"
3053
- },
3054
- subtle: {
3055
- bg: "bg-amber-50",
3056
- text: "text-amber-700",
3057
- border: "border-transparent",
3058
- dot: "bg-amber-500"
3059
- }
3060
- },
3061
- inactive: {
3062
- label: "inactive",
3063
- solid: {
3064
- bg: "bg-rose-500",
3065
- text: "text-white",
3066
- border: "border-rose-600",
3067
- dot: "bg-white"
3068
- },
3069
- outline: {
3070
- bg: "bg-rose-50",
3071
- text: "text-rose-700",
3072
- border: "border-rose-100",
3073
- dot: "bg-rose-500"
3074
- },
3075
- subtle: {
3076
- bg: "bg-rose-50",
3077
- text: "text-rose-700",
3078
- border: "border-transparent",
3079
- dot: "bg-rose-500"
3080
- }
3081
- },
3082
- draft: {
3083
- label: "draft",
3084
- solid: {
3085
- bg: "bg-gray-500",
3086
- text: "text-white",
3087
- border: "border-gray-600",
3088
- dot: "bg-white"
3089
- },
3090
- outline: {
3091
- bg: "bg-gray-50",
3092
- text: "text-gray-700",
3093
- border: "border-gray-100",
3094
- dot: "bg-gray-500"
3095
- },
3096
- subtle: {
3097
- bg: "bg-gray-50",
3098
- text: "text-gray-700",
3099
- border: "border-transparent",
3100
- dot: "bg-gray-500"
3101
- }
3102
- },
3103
- completed: {
3104
- label: "completed",
3105
- solid: {
3106
- bg: "bg-indigo-500",
3107
- text: "text-white",
3108
- border: "border-indigo-600",
3109
- dot: "bg-white"
3110
- },
3111
- outline: {
3112
- bg: "bg-indigo-50",
3113
- text: "text-indigo-700",
3114
- border: "border-indigo-100",
3115
- dot: "bg-indigo-500"
3116
- },
3117
- subtle: {
3118
- bg: "bg-indigo-50",
3119
- text: "text-indigo-700",
3120
- border: "border-transparent",
3121
- dot: "bg-indigo-500"
3122
- }
3123
- }
3124
- };
3125
- const config = statusConfig[normalizedStatus.toLowerCase()] || statusConfig.inactive;
3126
- const colors = customColors || config[variant];
3127
- const sizeClasses = {
3128
- sm: "text-xs px-2 py-0.5",
3129
- md: "text-xs px-2.5 py-0.5",
3130
- lg: "text-sm px-3 py-1"
3131
- };
3132
- const displayText = capitalize ? normalizedStatus.charAt(0).toUpperCase() + normalizedStatus.slice(1) : normalizedStatus;
3133
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "flex justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
3134
- "span",
3135
- {
3136
- className: cn(
3137
- "inline-flex items-center gap-1.5 rounded-full border font-medium",
3138
- colors.bg,
3139
- colors.text,
3140
- colors.border,
3141
- sizeClasses[size],
3142
- className
3143
- ),
3144
- children: [
3145
- showDot && (icon ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "flex items-center", children: icon }) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
3146
- "span",
3147
- {
3148
- className: cn("size-2 rounded-full", colors.dot),
3149
- "aria-hidden": "true"
3150
- }
3151
- )),
3152
- displayText
3153
- ]
3154
- }
3155
- ) });
3156
- };
3157
- };
3158
-
3159
- // src/components/core/error.tsx
3160
- var import_lucide_react19 = require("lucide-react");
3161
- var import_react_router2 = require("react-router");
3162
- var import_jsx_runtime34 = require("react/jsx-runtime");
3163
- var ErrorComponent = () => {
3164
- const error = (0, import_react_router2.useRouteError)();
3165
- const navigate = (0, import_react_router2.useNavigate)();
3166
- const renderErrorDetails = () => {
3167
- if ((0, import_react_router2.isRouteErrorResponse)(error)) {
3168
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
3169
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("h2", { className: "text-3xl font-semibold text-destructive", children: [
3170
- "Error ",
3171
- error.status,
3172
- ": ",
3173
- error.statusText
3174
- ] }),
3175
- typeof error.data === "string" ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("pre", { className: "text-lg text-muted-foreground whitespace-pre-wrap max-w-4xl text-left", children: error.data }) : error.data?.message && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("pre", { className: "text-lg text-muted-foreground whitespace-pre-wrap max-w-4xl text-left", children: error.data.message })
3176
- ] });
3177
- }
3178
- if (error instanceof Error) {
3179
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
3180
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("h2", { className: "text-3xl font-semibold text-destructive", children: "Unexpected Error" }),
3181
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("pre", { className: "text-lg text-muted-foreground whitespace-pre-wrap max-w-4xl text-left", children: error.message }),
3182
- error.stack && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("details", { className: "mt-2 text-sm text-muted-foreground max-w-4xl text-left", children: [
3183
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("summary", { className: "cursor-pointer underline", children: "Stack Trace" }),
3184
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("pre", { className: "whitespace-pre-wrap", children: error.stack })
3185
- ] })
3186
- ] });
3187
- }
3188
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
3189
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("h2", { className: "text-3xl font-semibold text-destructive", children: "Unknown Error" }),
3190
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("pre", { className: "text-lg text-muted-foreground whitespace-pre-wrap max-w-4xl text-left", children: typeof error === "string" ? error : JSON.stringify(error, null, 2) })
3191
- ] });
3192
- };
3193
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "rounded-2xl flex justify-center items-center h-full bg-sidebar px-4", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-col items-center space-y-4 text-center", children: [
3194
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_lucide_react19.AlertTriangleIcon, { className: "h-16 w-16 text-destructive" }),
3195
- renderErrorDetails(),
3196
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Button, { variant: "outline", onClick: () => navigate(-1), children: "Go Back" })
3197
- ] }) });
3198
- };
3199
-
3200
- // src/components/core/event-success.tsx
3201
- var import_framer_motion3 = require("framer-motion");
3202
- var import_jsx_runtime35 = require("react/jsx-runtime");
3203
- function Checkmark({ size = 100, strokeWidth = 2, color = "currentColor", className = "" }) {
3204
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
3205
- import_framer_motion3.motion.svg,
3206
- {
3207
- width: size,
3208
- height: size,
3209
- viewBox: "0 0 100 100",
3210
- initial: "hidden",
3211
- animate: "visible",
3212
- className,
3213
- children: [
3214
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("title", { children: "Animated Checkmark" }),
3215
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3216
- import_framer_motion3.motion.circle,
3217
- {
3218
- cx: "50",
3219
- cy: "50",
3220
- r: "40",
3221
- stroke: color,
3222
- custom: 0,
3223
- style: {
3224
- strokeWidth,
3225
- strokeLinecap: "round",
3226
- fill: "transparent"
3227
- }
3228
- }
3229
- ),
3230
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3231
- import_framer_motion3.motion.path,
3232
- {
3233
- d: "M30 50L45 65L70 35",
3234
- stroke: color,
3235
- custom: 1,
3236
- style: {
3237
- strokeWidth,
3238
- strokeLinecap: "round",
3239
- strokeLinejoin: "round",
3240
- fill: "transparent"
3241
- }
3242
- }
3243
- )
3244
- ]
3245
- }
3246
- );
3247
- }
3248
- function CurrencyTransfer() {
3249
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Card, { className: "w-full max-w-sm mx-auto p-6 min-h-[300px] flex flex-col justify-center bg-background", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(CardContent, { className: "space-y-4 flex flex-col items-center justify-center", children: [
3250
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3251
- import_framer_motion3.motion.div,
3252
- {
3253
- className: "flex justify-center",
3254
- initial: { opacity: 0, scale: 0.8 },
3255
- animate: { opacity: 1, scale: 1 },
3256
- transition: {
3257
- duration: 0.4,
3258
- ease: [0.4, 0, 0.2, 1],
3259
- scale: {
3260
- type: "spring",
3261
- damping: 15,
3262
- stiffness: 200
3263
- }
3264
- },
3265
- children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "relative", children: [
3266
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3267
- import_framer_motion3.motion.div,
3268
- {
3269
- className: "absolute inset-0 bg-primary/5 rounded-full",
3270
- initial: { opacity: 0, scale: 0.8 },
3271
- animate: { opacity: 1, scale: 1 },
3272
- transition: {
3273
- delay: 0.2,
3274
- duration: 0.8,
3275
- ease: "circOut"
3276
- }
3277
- }
3278
- ),
3279
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3280
- Checkmark,
3281
- {
3282
- size: 80,
3283
- strokeWidth: 4,
3284
- color: "rgb(16 185 129)",
3285
- className: "relative z-10 dark:drop-shadow-[0_0_10px_rgba(0,0,0,0.1)]"
3286
- }
3287
- )
3288
- ] })
3289
- }
3290
- ),
3291
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
3292
- import_framer_motion3.motion.div,
3293
- {
3294
- className: "space-y-2 text-center w-full",
3295
- initial: { opacity: 0, y: 10 },
3296
- animate: { opacity: 1, y: 0 },
3297
- transition: {
3298
- delay: 0.2,
3299
- duration: 0.6,
3300
- ease: [0.4, 0, 0.2, 1]
3301
- },
3302
- children: [
3303
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3304
- import_framer_motion3.motion.h2,
3305
- {
3306
- className: "text-lg text-zinc-100 dark:text-zinc-900 tracking-tighter font-semibold uppercase",
3307
- initial: { opacity: 0, y: 5 },
3308
- animate: { opacity: 1, y: 0 },
3309
- transition: { delay: 1, duration: 0.4 },
3310
- children: "Transfer Successful"
3311
- }
3312
- ),
3313
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "flex items-center gap-4", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3314
- import_framer_motion3.motion.div,
3315
- {
3316
- className: "flex-1 bg-zinc-800/50 dark:bg-zinc-50/50 rounded-xl p-3 border border-zinc-700/50 dark:border-zinc-200/50 backdrop-blur-md",
3317
- initial: { opacity: 0, scale: 0.95 },
3318
- animate: { opacity: 1, scale: 1 },
3319
- transition: {
3320
- delay: 1.2,
3321
- duration: 0.4,
3322
- ease: [0.4, 0, 0.2, 1]
3323
- },
3324
- children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex flex-col items-start gap-2", children: [
3325
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "space-y-1.5", children: [
3326
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("span", { className: "text-xs font-medium text-secondary-foreground flex items-center gap-1.5", children: [
3327
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
3328
- "svg",
3329
- {
3330
- className: "w-3 h-3",
3331
- xmlns: "http://www.w3.org/2000/svg",
3332
- viewBox: "0 0 24 24",
3333
- fill: "none",
3334
- stroke: "currentColor",
3335
- strokeWidth: "2",
3336
- strokeLinecap: "round",
3337
- strokeLinejoin: "round",
3338
- children: [
3339
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("title", { children: "From" }),
3340
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("path", { d: "M12 19V5M5 12l7-7 7 7" })
3341
- ]
3342
- }
3343
- ),
3344
- "From"
3345
- ] }),
3346
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex items-center gap-2.5 group transition-all", children: [
3347
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "inline-flex items-center justify-center w-7 h-7 rounded-lg bg-zinc-900 dark:bg-white shadow-lg border border-zinc-700 dark:border-zinc-300 text-sm font-medium text-zinc-100 dark:text-zinc-900 group-hover:scale-105 transition-transform", children: "$" }),
3348
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "font-medium text-zinc-100 dark:text-zinc-900 tracking-tight", children: "500.00 USD" })
3349
- ] })
3350
- ] }),
3351
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "w-full h-px bg-gradient-to-r from-transparent via-zinc-700 dark:via-zinc-300 to-transparent" }),
3352
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "space-y-1.5", children: [
3353
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("span", { className: "text-xs font-medium text-secondary-foreground flex items-center gap-1.5", children: [
3354
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
3355
- "svg",
3356
- {
3357
- className: "w-3 h-3",
3358
- xmlns: "http://www.w3.org/2000/svg",
3359
- viewBox: "0 0 24 24",
3360
- fill: "none",
3361
- stroke: "currentColor",
3362
- strokeWidth: "2",
3363
- strokeLinecap: "round",
3364
- strokeLinejoin: "round",
3365
- children: [
3366
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("title", { children: "To" }),
3367
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("path", { d: "M12 5v14M5 12l7 7 7-7" })
3368
- ]
3369
- }
3370
- ),
3371
- "To"
3372
- ] }),
3373
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex items-center gap-2.5 group transition-all", children: [
3374
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "inline-flex items-center justify-center w-7 h-7 rounded-lg bg-zinc-900 dark:bg-white shadow-lg border border-zinc-700 dark:border-zinc-300 text-sm font-medium text-zinc-100 dark:text-zinc-900 group-hover:scale-105 transition-transform", children: "\u20AC" }),
3375
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "font-medium text-zinc-100 dark:text-zinc-900 tracking-tight", children: "460.00 EUR" })
3376
- ] })
3377
- ] })
3378
- ] })
3379
- }
3380
- ) }),
3381
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3382
- import_framer_motion3.motion.div,
3383
- {
3384
- className: "w-full text-xs text-secondary-foreground mt-2 text-center",
3385
- initial: { opacity: 0 },
3386
- animate: { opacity: 1 },
3387
- transition: { delay: 1.4, duration: 0.4 },
3388
- children: "Exchange Rate: 1 USD = 0.92 EUR"
3389
- }
3390
- )
3391
- ]
3392
- }
3393
- )
3394
- ] }) });
3395
- }
3396
-
3397
- // src/components/core/loader.tsx
3398
- var import_jsx_runtime36 = require("react/jsx-runtime");
3399
- var Loader4 = () => {
3400
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "rounded-2xl flex justify-center items-center h-full bg-transparent", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-col items-center space-y-4", children: [
3401
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "animate-spin rounded-full border-t-4 border-ring h-16 w-16 mb-4" }),
3402
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("h2", { className: "text-xl font-semibold text-muted-foreground", children: "Loading, please wait..." }),
3403
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { className: "text-sm text-muted-foreground", children: "Your content is on its way." })
3404
- ] }) });
3405
- };
3406
-
3407
- // src/components/core/notfound.tsx
3408
- var import_react_router3 = require("react-router");
3409
- var import_lucide_react20 = require("lucide-react");
3410
- var import_react_router4 = require("react-router");
3411
- var import_jsx_runtime37 = require("react/jsx-runtime");
3412
- var NotFound = () => {
3413
- const location = (0, import_react_router3.useLocation)();
3414
- const navigate = (0, import_react_router4.useNavigate)();
3415
- const goBack = () => {
3416
- if (window.history.length > 2) {
3417
- navigate(-1);
3418
- } else {
3419
- navigate("/");
3420
- }
3421
- };
3422
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "rounded-2xl flex flex-col items-center justify-center h-full p-6 text-center bg-sidebar text-muted-foreground select-none", children: [
3423
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_lucide_react20.GhostIcon, { className: "h-15 w-15 text-destructive mb-4" }),
3424
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("h1", { className: "text-2xl font-bold text-destructive mb-2", children: "Page Not Found" }),
3425
- /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("p", { className: "text-xl mb-4", children: [
3426
- "The page ",
3427
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("code", { className: "px-1 py-0.5 rounded bg-muted text-foreground", children: location.pathname }),
3428
- " doesn't exist or has been moved."
3429
- ] }),
3430
- /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex space-x-4", children: [
3431
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Button, { variant: "outline", onClick: goBack, children: "Go Back" }),
3432
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Button, { variant: "ghost", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react_router4.NavLink, { to: "/", children: "Return Home" }) })
3433
- ] })
3434
- ] });
3435
- };
3436
-
3437
- // src/components/core/offline-content.tsx
3438
- var import_lucide_react21 = require("lucide-react");
3439
- var import_jsx_runtime38 = require("react/jsx-runtime");
3440
- var OfflineUI = () => /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "rounded-2xl flex flex-col items-center justify-center h-screen p-6 text-center text-muted-foreground bg-background select-none", children: [
3441
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_lucide_react21.WifiOffIcon, { className: "h-15 w-15 text-destructive mb-4" }),
3442
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("h1", { className: "text-3xl font-bold text-destructive mb-2", children: "You're offline" }),
3443
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: "text-xl max-w-md", children: "We couldn't connect to the server." })
3444
- ] });
3445
-
3446
- // src/components/core/unauthorized.tsx
3447
- var import_lucide_react22 = require("lucide-react");
3448
- var import_react_router5 = require("react-router");
3449
- var import_jsx_runtime39 = require("react/jsx-runtime");
3450
- var Unauthorized = () => {
3451
- const navigate = (0, import_react_router5.useNavigate)();
3452
- const goBack = () => {
3453
- if (window.history.length > 2) {
3454
- navigate(-1);
3455
- } else {
3456
- navigate("/");
3457
- }
3458
- };
3459
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "rounded-2xl flex flex-col items-center justify-center h-full p-6 text-center bg-sidebar text-muted-foreground select-none", children: [
3460
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_lucide_react22.ShieldOffIcon, { className: "h-15 w-15 text-destructive mb-4" }),
3461
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("h1", { className: "text-2xl font-bold text-destructive mb-2", children: "Access Denied" }),
3462
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className: "text-xl mb-4", children: "You don't have permission to view this page. Please sign in with an authorized account or contact your administrator." }),
3463
- /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex space-x-4", children: [
3464
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Button, { variant: "outline", onClick: goBack, children: "Go Back" }),
3465
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Button, { variant: "ghost", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_router5.NavLink, { to: "/", children: "Go to Home" }) })
3466
- ] })
3467
- ] });
3468
- };
3469
- // Annotate the CommonJS export names for ESM import in node:
3470
- 0 && (module.exports = {
3471
- AppMetaProvider,
3472
- CurrencyTransfer,
3473
- DataTable,
3474
- DataTableActionBar,
3475
- DataTableActionBarAction,
3476
- DataTableActionBarSelection,
3477
- DataTemplate,
3478
- DataTemplateActionBar,
3479
- DataTemplateActionBarAction,
3480
- DataTemplateActionBarSelection,
3481
- ErrorComponent,
3482
- GeneralHelper,
3483
- Loader,
3484
- NotFound,
3485
- OfflineUI,
3486
- Unauthorized,
3487
- createLayoutComponents,
3488
- createPageTemplateHook,
3489
- createTypedAppMetaContext
3490
- });
1
+ "use client"
2
+ "use strict";var ga=Object.create;var kt=Object.defineProperty;var fa=Object.getOwnPropertyDescriptor;var ba=Object.getOwnPropertyNames;var va=Object.getPrototypeOf,ha=Object.prototype.hasOwnProperty;var xa=(e,t)=>{for(var o in t)kt(e,o,{get:t[o],enumerable:!0})},ho=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of ba(t))!ha.call(e,s)&&s!==o&&kt(e,s,{get:()=>t[s],enumerable:!(n=fa(t,s))||n.enumerable});return e};var ut=(e,t,o)=>(o=e!=null?ga(va(e)):{},ho(t||!e||!e.__esModule?kt(o,"default",{value:e,enumerable:!0}):o,e)),Ca=e=>ho(kt({},"__esModule",{value:!0}),e);var Ga={};xa(Ga,{AppMetaProvider:()=>ra,CurrencyTransfer:()=>uo,DataTable:()=>Xt,DataTableActionBar:()=>Kt,DataTableActionBarAction:()=>Yt,DataTableActionBarSelection:()=>Zt,DataTemplate:()=>oo,DataTemplateActionBar:()=>ao,DataTemplateActionBarAction:()=>no,DataTemplateActionBarSelection:()=>ro,ErrorComponent:()=>po,GeneralHelper:()=>Vt,Loader:()=>go,NotFound:()=>fo,OfflineUI:()=>bo,Unauthorized:()=>vo,createLayoutComponents:()=>na,createPageTemplateHook:()=>sa,createTypedAppMetaContext:()=>ia});module.exports=Ca(Ga);var ne=require("@tanstack/react-table"),K=require("lucide-react");var yo=require("radix-ui"),wo=require("class-variance-authority");var xo=require("clsx"),Co=require("tailwind-merge");function a(...e){return(0,Co.twMerge)((0,xo.clsx)(e))}var No=require("react/jsx-runtime"),ya=(0,wo.cva)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function v({className:e,variant:t,size:o,asChild:n=!1,...s}){let i=n?yo.Slot.Slot:"button";return(0,No.jsx)(i,{"data-slot":"button",className:a(ya({variant:t,size:o,className:e}),"transition-none"),...s})}var Ae=require("react/jsx-runtime");function jt({className:e,...t}){return(0,Ae.jsx)("div",{"data-slot":"table-container",className:"relative w-full overflow-auto max-h-full",children:(0,Ae.jsx)("table",{"data-slot":"table",className:a("w-full caption-bottom text-sm",e),...t})})}function Po({className:e,...t}){return(0,Ae.jsx)("thead",{"data-slot":"table-header",className:a("[&_tr]:border-b",e),...t})}function To({className:e,...t}){return(0,Ae.jsx)("tbody",{"data-slot":"table-body",className:a("[&_tr:last-child]:border-0",e),...t})}function So({className:e,...t}){return(0,Ae.jsx)("tfoot",{"data-slot":"table-footer",className:a("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",e),...t})}function gt({className:e,...t}){return(0,Ae.jsx)("tr",{"data-slot":"table-row",className:a("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...t})}function Do({className:e,...t}){return(0,Ae.jsx)("th",{"data-slot":"table-head",className:a("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap",e),...t})}function Rt({className:e,...t}){return(0,Ae.jsx)("td",{"data-slot":"table-cell",className:a("p-2 align-middle whitespace-nowrap",e),...t})}var $t=require("react/jsx-runtime");function he({className:e,...t}){return(0,$t.jsx)("div",{"data-slot":"card",className:a("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...t})}function xe({className:e,...t}){return(0,$t.jsx)("div",{"data-slot":"card-content",className:a("px-6",e),...t})}var Ke=require("radix-ui");var ze=require("react/jsx-runtime");function Ye({delayDuration:e=0,...t}){return(0,ze.jsx)(Ke.Tooltip.Provider,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function Oe({...e}){return(0,ze.jsx)(Ye,{children:(0,ze.jsx)(Ke.Tooltip.Root,{"data-slot":"tooltip",...e})})}function Ve({...e}){return(0,ze.jsx)(Ke.Tooltip.Trigger,{"data-slot":"tooltip-trigger",...e})}function _e({className:e,sideOffset:t=0,children:o,...n}){return(0,ze.jsx)(Ke.Tooltip.Portal,{children:(0,ze.jsxs)(Ke.Tooltip.Content,{"data-slot":"tooltip-content",sideOffset:t,className:a("bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",e),...n,children:[o,(0,ze.jsx)(Ke.Tooltip.Arrow,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}var J=require("lucide-react");var ko=require("react/jsx-runtime");function rt({className:e,type:t,...o}){return(0,ko.jsx)("input",{type:t,"data-slot":"input",className:a("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e),...o})}var se=require("radix-ui"),Ze=require("lucide-react");var U=require("react/jsx-runtime");function Ge({...e}){return(0,U.jsx)(se.Select.Root,{"data-slot":"select",...e})}function He({...e}){return(0,U.jsx)(se.Select.Value,{"data-slot":"select-value",...e})}function Ee({className:e,size:t="default",children:o,...n}){return(0,U.jsxs)(se.Select.Trigger,{"data-slot":"select-trigger","data-size":t,className:a("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...n,children:[o,(0,U.jsx)(se.Select.Icon,{asChild:!0,children:(0,U.jsx)(Ze.ChevronDownIcon,{className:"size-4 opacity-50"})})]})}function je({className:e,children:t,position:o="popper",...n}){return(0,U.jsx)(se.Select.Portal,{children:(0,U.jsxs)(se.Select.Content,{"data-slot":"select-content",className:a("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",o==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:o,...n,children:[(0,U.jsx)(wa,{}),(0,U.jsx)(se.Select.Viewport,{className:a("p-1",o==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),(0,U.jsx)(Na,{})]})})}function Ce({className:e,children:t,...o}){return(0,U.jsxs)(se.Select.Item,{"data-slot":"select-item",className:a("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...o,children:[(0,U.jsx)("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:(0,U.jsx)(se.Select.ItemIndicator,{children:(0,U.jsx)(Ze.CheckIcon,{className:"size-4"})})}),(0,U.jsx)(se.Select.ItemText,{children:t})]})}function wa({className:e,...t}){return(0,U.jsx)(se.Select.ScrollUpButton,{"data-slot":"select-scroll-up-button",className:a("flex cursor-default items-center justify-center py-1",e),...t,children:(0,U.jsx)(Ze.ChevronUpIcon,{className:"size-4"})})}function Na({className:e,...t}){return(0,U.jsx)(se.Select.ScrollDownButton,{"data-slot":"select-scroll-down-button",className:a("flex cursor-default items-center justify-center py-1",e),...t,children:(0,U.jsx)(Ze.ChevronDownIcon,{className:"size-4"})})}var ue=require("radix-ui"),Mt=require("lucide-react");var ae=require("react/jsx-runtime");function ye({...e}){return(0,ae.jsx)(ue.DropdownMenu.Root,{"data-slot":"dropdown-menu",...e})}function we({...e}){return(0,ae.jsx)(ue.DropdownMenu.Trigger,{"data-slot":"dropdown-menu-trigger",...e})}function Ne({className:e,sideOffset:t=4,...o}){return(0,ae.jsx)(ue.DropdownMenu.Portal,{children:(0,ae.jsx)(ue.DropdownMenu.Content,{"data-slot":"dropdown-menu-content",sideOffset:t,className:a("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) rounded-md border p-1 shadow-md",e),...o})})}function Ut({...e}){return(0,ae.jsx)(ue.DropdownMenu.Group,{"data-slot":"dropdown-menu-group",...e})}function X({className:e,inset:t,variant:o="default",...n}){return(0,ae.jsx)(ue.DropdownMenu.Item,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":o,className:a("cursor-pointer focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...n})}function At({className:e,children:t,checked:o,...n}){return(0,ae.jsxs)(ue.DropdownMenu.CheckboxItem,{"data-slot":"dropdown-menu-checkbox-item",className:a("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),checked:o,...n,children:[(0,ae.jsx)("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:(0,ae.jsx)(ue.DropdownMenu.ItemIndicator,{children:(0,ae.jsx)(Mt.CheckIcon,{className:"size-4"})})}),t]})}function le({className:e,inset:t,...o}){return(0,ae.jsx)(ue.DropdownMenu.Label,{"data-slot":"dropdown-menu-label","data-inset":t,className:a("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...o})}function de({className:e,...t}){return(0,ae.jsx)(ue.DropdownMenu.Separator,{"data-slot":"dropdown-menu-separator",className:a("bg-border -mx-1 my-1 h-px",e),...t})}var c=require("react/jsx-runtime");function Wt({table:e,filters:t=[],globalFilter:o,onGlobalFilterChange:n,enableGlobalFilter:s=!0,onExport:i,onRefresh:p,loading:C=!1,enableColumnVisibility:y=!0,data:f,onClearSorting:u,onClearFilters:T,enableColumnPinning:_=!1}){let z=()=>e.getAllLeafColumns().filter(m=>m.getCanHide?.()!==!1),A=()=>e.getAllColumns().filter(m=>!e.getAllLeafColumns().includes(m)&&m.columns?.length&&m.columns.some(b=>b.getCanHide?.()!==!1)),k=()=>{let m=new Set(A().flatMap(b=>b.columns?.filter(j=>j.getCanHide?.()!==!1).map(j=>j.id)||[]));return z().filter(b=>!m.has(b.id))},B=(m,b)=>b&&m.startsWith(`${b}.`)?m.replace(`${b}.`,"").split("_").map(h=>h.slice(1)).join(" "):m.split("_").map(j=>j.charAt(0).toUpperCase()+j.slice(1)).join(" ");return(0,c.jsx)("div",{className:"rounded-xl",children:(0,c.jsx)("div",{className:"px-2",children:(0,c.jsx)("div",{className:"flex flex-col gap-6",children:(0,c.jsxs)("div",{className:"flex items-center justify-between",children:[(0,c.jsx)("div",{className:"flex items-center gap-3",children:t.length>0&&(0,c.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,c.jsx)("div",{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground",children:(0,c.jsx)(J.Filter,{className:"h-4 w-4"})}),t.map(m=>(0,c.jsx)("div",{className:a("relative min-w-[150px]",m.width),children:m.type==="select"?(0,c.jsxs)(Ge,{value:e.getColumn(m.key)?.getFilterValue()??"",onValueChange:b=>e.getColumn(m.key)?.setFilterValue(b==="all"?"":b),children:[m.icon&&(0,c.jsx)("span",{children:(0,c.jsx)(m.icon,{className:"size-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"})}),(0,c.jsx)(Ee,{className:a("h-9 rounded-lg w-full",m.icon&&"pl-9"),children:(0,c.jsx)(He,{placeholder:m.placeholder})}),(0,c.jsxs)(je,{className:"rounded-lg",children:[(0,c.jsx)(Ce,{value:"all",children:"All"}),m.options?.map(b=>(0,c.jsx)(Ce,{value:b.value,children:b.label},b.label))]})]}):(0,c.jsxs)("div",{className:"relative",children:[m.icon&&(0,c.jsx)("span",{children:(0,c.jsx)(m.icon,{className:"size-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"})}),(0,c.jsx)(rt,{placeholder:m.placeholder,value:e.getColumn(m.key)?.getFilterValue()??"",onChange:b=>e.getColumn(m.key)?.setFilterValue(b.target.value),className:a("h-9 rounded-lg",m.icon&&"pl-9"),type:m.type==="number"?"number":m.type==="date"?"date":"text"})]})},m.key))]})}),(0,c.jsxs)("div",{className:"flex items-center gap-2",children:[s&&(0,c.jsxs)("div",{className:"relative",children:[(0,c.jsx)(J.Search,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),(0,c.jsx)(rt,{placeholder:"Global search...",value:o??"",onChange:m=>n(m.target.value),className:"pl-9 max-w-max"})]}),i&&(0,c.jsxs)(v,{variant:"outline",size:"sm",onClick:()=>i(f),className:"rounded-lg",children:[(0,c.jsx)(J.Download,{className:"mr-2 h-4 w-4"}),"Export"]}),y&&(0,c.jsxs)(ye,{children:[(0,c.jsx)(we,{asChild:!0,children:(0,c.jsxs)(v,{variant:"outline",size:"sm",className:"rounded-lg gap-1",children:[(0,c.jsx)("span",{children:"Columns"}),(0,c.jsx)(J.ChevronDown,{className:"h-4 w-4 opacity-50"})]})}),(0,c.jsxs)(Ne,{align:"end",className:"w-[220px] rounded-lg max-h-[400px] overflow-y-auto",children:[(0,c.jsx)(le,{className:"px-4 py-2 text-sm font-medium",children:"Toggle Columns"}),(0,c.jsx)(de,{}),k().length>0&&(0,c.jsxs)(Ut,{children:[(0,c.jsx)(le,{className:"px-4 py-1.5 text-sm font-medium text-muted-foreground",children:"General"}),k().map(m=>(0,c.jsx)(At,{className:"text-sm",checked:m.getIsVisible(),onCheckedChange:b=>m.toggleVisibility(!!b),children:B(m.id)},m.id))]}),A().map(m=>(0,c.jsxs)(Ut,{children:[(0,c.jsx)(de,{}),(0,c.jsx)(le,{className:"px-4 py-1.5 text-sm font-medium text-muted-foreground",children:m.id}),m.columns?.filter(b=>b.getCanHide?.()!==!1).map(b=>(0,c.jsx)(At,{className:"text-sm",checked:b.getIsVisible(),onCheckedChange:j=>b.toggleVisibility(!!j),children:B(b.id,m.id)},b.id))]},m.id))]})]}),(0,c.jsxs)(ye,{children:[(0,c.jsx)(we,{asChild:!0,children:(0,c.jsx)(v,{variant:"outline",size:"sm",className:"rounded-lg",children:(0,c.jsx)(J.Settings2,{className:"h-4 w-4"})})}),(0,c.jsxs)(Ne,{align:"end",className:"w-[200px] rounded-lg",children:[(0,c.jsx)(le,{children:"Table Settings"}),(0,c.jsx)(de,{}),(0,c.jsxs)(X,{onClick:u,children:[(0,c.jsx)(J.ArrowUpDown,{className:"mr-2 h-4 w-4"}),"Clear All Sorting"]}),(0,c.jsxs)(X,{onClick:T,children:[(0,c.jsx)(J.Filter,{className:"mr-2 h-4 w-4"}),"Clear All Filters"]}),_&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(de,{}),(0,c.jsx)(le,{children:"Column Pinning"}),(0,c.jsxs)(X,{onClick:()=>e.setColumnPinning({left:[],right:[]}),children:[(0,c.jsx)(J.PinOff,{className:"mr-2 h-4 w-4"}),"Reset All Pinning"]}),(0,c.jsxs)(X,{onClick:()=>{let m=z().filter(b=>b.getCanPin?.()!==!1).map(b=>b.id);e.setColumnPinning({left:m,right:[]})},children:[(0,c.jsx)(J.Pin,{className:"mr-2 h-4 w-4 rotate-90"}),"Pin All Left"]}),(0,c.jsxs)(X,{onClick:()=>{let m=z().filter(b=>b.getCanPin?.()!==!1).map(b=>b.id);e.setColumnPinning({left:[],right:m})},children:[(0,c.jsx)(J.Pin,{className:"mr-2 h-4 w-4 -rotate-90"}),"Pin All Right"]})]})]})]}),p&&(0,c.jsx)(v,{variant:"outline",size:"sm",onClick:p,disabled:C,className:"rounded-lg",children:(0,c.jsx)(J.RefreshCw,{className:a("h-4 w-4",C&&"animate-spin")})})]})]})})})})}var G=require("react/jsx-runtime");function Jt({table:e,config:t}){return t.enabled?(0,G.jsx)("div",{className:"rounded-xl",children:(0,G.jsx)("div",{children:(0,G.jsxs)("div",{className:"flex items-center justify-between",children:[(0,G.jsx)("div",{className:"flex items-center gap-6 text-sm text-muted-foreground",children:t.showInfo!==!1&&(0,G.jsxs)("span",{children:["Showing ",e.getState().pagination.pageIndex*e.getState().pagination.pageSize+1," to"," ",Math.min((e.getState().pagination.pageIndex+1)*e.getState().pagination.pageSize,e.getFilteredRowModel().rows.length)," ","of ",e.getFilteredRowModel().rows.length," entries"]})}),(0,G.jsxs)("div",{className:"flex items-center gap-4",children:[t.pageSizeOptions&&(0,G.jsxs)("div",{className:"flex items-center gap-2",children:[(0,G.jsx)("span",{className:"text-sm font-medium",children:"Rows per page:"}),(0,G.jsxs)(Ge,{value:`${e.getState().pagination.pageSize}`,onValueChange:o=>e.setPageSize(Number(o)),children:[(0,G.jsx)(Ee,{className:"h-9 w-[70px] rounded-lg",children:(0,G.jsx)(He,{})}),(0,G.jsx)(je,{side:"top",className:"rounded-lg",children:t.pageSizeOptions.map(o=>(0,G.jsx)(Ce,{value:`${o}`,children:o},o))})]})]}),(0,G.jsxs)("div",{className:"flex items-center gap-2",children:[(0,G.jsx)(v,{variant:"outline",size:"sm",onClick:()=>e.setPageIndex(0),disabled:!e.getCanPreviousPage(),className:"rounded-lg",children:"First"}),(0,G.jsx)(v,{variant:"outline",size:"sm",onClick:()=>e.previousPage(),disabled:!e.getCanPreviousPage(),className:"rounded-lg",children:"Previous"}),t.showPageNumbers&&(0,G.jsx)("div",{className:"flex items-center gap-1",children:Array.from({length:Math.min(5,e.getPageCount())},(o,n)=>{let s=e.getState().pagination.pageIndex,i=s-2+n+1;return i<1||i>e.getPageCount()?null:(0,G.jsx)(v,{variant:i===s+1?"default":"outline",size:"sm",className:"size-8 p-0 rounded-lg",onClick:()=>e.setPageIndex(i-1),children:i},i)})}),(0,G.jsx)(v,{variant:"outline",size:"sm",onClick:()=>e.nextPage(),disabled:!e.getCanNextPage(),className:"rounded-lg",children:"Next"}),(0,G.jsx)(v,{variant:"outline",size:"sm",onClick:()=>e.setPageIndex(e.getPageCount()-1),disabled:!e.getCanNextPage(),className:"rounded-lg",children:"Last"})]})]})]})})}):null}var Ro=require("radix-ui"),Mo=require("class-variance-authority");var zo=require("react/jsx-runtime"),Pa=(0,Mo.cva)("inline-flex cursor-pointer items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none transition-[color,box-shadow] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"},size:{sm:"h-7 px-0 min-w-7",default:"h-8 px-1 min-w-8",lg:"h-9 px-2 min-w-10"},bg:{enabled:"data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",disabled:""}},defaultVariants:{variant:"default",size:"default",bg:"enabled"}});function Ao({className:e,variant:t,size:o,noBg:n,...s}){return(0,zo.jsx)(Ro.Toggle.Root,{"data-slot":"toggle",className:a(Pa({className:e,variant:t,size:o,bg:n?"disabled":"enabled"})),...s})}var qt=require("radix-ui"),Io=require("lucide-react");var zt=require("react/jsx-runtime");function ft({className:e,...t}){return(0,zt.jsx)(qt.Checkbox.Root,{"data-slot":"checkbox",className:a("peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:(0,zt.jsx)(qt.Checkbox.Indicator,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current transition-none",children:(0,zt.jsx)(Io.CheckIcon,{className:"size-3.5"})})})}var Z=require("react"),r=require("react/jsx-runtime");function Xt({data:e,columns:t,filters:o=[],pagination:n={enabled:!1},settings:s={},header:i,footer:p,className:C="",maxHeight:y="600px",loading:f=!1,error:u,emptyMessage:T="No data available",onRowSelectionChange:_,onExport:z,onRefresh:A,onTableReady:k,children:B}){let[m,b]=(0,Z.useState)([]),[j,h]=(0,Z.useState)([]),[F,Ie]=(0,Z.useState)({}),[Be,fe]=(0,Z.useState)({}),[be,Se]=(0,Z.useState)(""),[oe,Fe]=(0,Z.useState)([]),[re,qe]=(0,Z.useState)(s.enableColumnPinning?{left:[],right:[]}:{}),{enableSorting:tt=!0,enableFiltering:De=!0,enableGlobalFilter:ct=!0,enableColumnVisibility:ve=!0,enableRowSelection:ee=!0,stickyHeader:Xe=!0,toolbar:Ct=!1,showSerialNumbers:Y=!0,fixedCheckboxColumn:ke=!0,striped:ot=!0,hoverable:at=!0,compact:Re=!0,bordered:yt=!0,fullHeight:wt=!1,enableColumnResizing:Ht=!1,enableColumnPinning:R=!0,hideHeader:Nt=!1}=s,mt=(0,Z.useMemo)(()=>{let S=[...t],W=M=>M.map(d=>{if(d.id==="select"||d.id==="serialNumber")return d;let x={...d,enablePinning:!0};return d.columns&&(x.columns=W(d.columns)),x}),l=W(S);if(ee){let M={id:"select",header:({table:d})=>(0,r.jsx)(ft,{checked:d.getIsAllPageRowsSelected()||d.getIsSomePageRowsSelected()&&"indeterminate",onCheckedChange:x=>d.toggleAllPageRowsSelected(!!x),"aria-label":"Select all"}),cell:({row:d})=>(0,r.jsx)("div",{className:a("flex items-center justify-center"),children:(0,r.jsx)(ft,{checked:d.getIsSelected(),onCheckedChange:x=>d.toggleSelected(!!x),"aria-label":"Select row"})}),enableSorting:!1,enableHiding:!1,enablePinning:!0,headerAlign:"center",size:10};l.unshift(M)}if(Y){let M={id:"serialNumber",header:"No.",cell:({row:d})=>(0,r.jsx)("div",{className:"text-center font-medium text-muted-foreground",children:d.index+1}),enableSorting:!0,enableHiding:!1,enablePinning:!0,size:60,headerAlign:"center"};l.unshift(M)}return l},[t,Y,ee,ke]),$=(0,ne.useReactTable)({data:e,columns:mt,onSortingChange:tt?b:void 0,onColumnFiltersChange:De?h:void 0,onGlobalFilterChange:ct?Se:void 0,getCoreRowModel:(0,ne.getCoreRowModel)(),getPaginationRowModel:n.enabled?(0,ne.getPaginationRowModel)():void 0,getSortedRowModel:tt?(0,ne.getSortedRowModel)():void 0,getFilteredRowModel:De?(0,ne.getFilteredRowModel)():void 0,onColumnVisibilityChange:ve?Ie:void 0,onRowSelectionChange:ee?fe:void 0,onColumnOrderChange:Fe,onColumnPinningChange:R?qe:void 0,state:{sorting:tt?m:void 0,columnFilters:De?j:void 0,columnVisibility:ve?F:void 0,rowSelection:ee?Be:{},globalFilter:be,columnOrder:oe,columnPinning:R?re:{}},initialState:{pagination:n.enabled?{pageSize:n.pageSize||10}:void 0,columnPinning:R?{left:[...Y?["serialNumber"]:[],...ee?["select"]:[]],right:[]}:void 0},enableRowSelection:ee,enableColumnResizing:Ht,enableColumnPinning:R,columnResizeMode:"onChange"});(0,Z.useEffect)(()=>{k&&k($)},[$,k]),(0,Z.useEffect)(()=>{if(ee&&_){let S=$.getFilteredSelectedRowModel().rows.map(W=>W.original);_(S)}},[Be,ee,_,$]);let Pt=(0,Z.useCallback)(()=>{b([])},[]),Et=(0,Z.useCallback)(()=>{h([]),Se("")},[]),Tt=(S,W)=>{if(!R)return;let l=[...Y?["serialNumber"]:[],...ee&&ke?["select"]:[]],M={left:[...(re.left??[]).filter(d=>l.includes(d))],right:[...re.right??[]]};W===!1?(M.left=M.left.filter(d=>d!==S),M.right=M.right.filter(d=>d!==S)):W==="right"?(M.left=M.left.filter(d=>d!==S),M.right.includes(S)||M.right.push(S)):W==="left"&&(M.right=M.right.filter(d=>d!==S),!M.left.includes(S)&&!l.includes(S)&&M.left.push(S)),$.setColumnPinning(M)},St=()=>(0,r.jsx)(Po,{className:a(Xe&&"sticky top-0 bg-sidebar z-20"),children:$.getHeaderGroups().map((S,W)=>(0,r.jsx)(gt,{className:"hover:bg-transparent",children:S.headers.map((l,M)=>{let d=l.depth===0&&l.colSpan>1,x=R&&(l.column.getIsPinned()==="left"||l.column.id==="serialNumber"||l.column.id==="select"&&ee),w=R&&l.column.getIsPinned()==="right",q=l.column.getCanSort(),te=R&&l.column.columnDef.enablePinning!==!1,ie=l.column.id==="serialNumber",Me=l.column.id==="select",Le=ie||Me&&ke,nt=l.column.columnDef.headerAlign||"left",ua={left:"justify-start",center:"justify-center",right:"justify-end"}[nt];return(0,r.jsxs)(Do,{colSpan:l.colSpan,className:a("font-semibold text-foreground bg-sidebar group px-0",!Re&&"py-2",yt&&M<S.headers.length-1&&"border-r","relative",x&&"sticky left-0 z-15 bg-sidebar",w&&"sticky right-0 z-15 bg-sidebar",(ie||Me)&&"sticky left-0 z-15 bg-sidebar",d?"text-center":"text-left"),style:{width:l.getSize()!==150?l.getSize():"auto",minWidth:l.getSize()!==150?l.getSize():"auto",...x&&{left:ie?0:Me?Y&&$.getColumn("serialNumber")?.getSize()||0:Dt(l.column)},...w&&{right:pt(l.column)},...ie&&{left:0}},children:[d?(0,r.jsx)("div",{className:"flex items-center justify-center",children:(0,ne.flexRender)(l.column.columnDef.header,l.getContext())}):(0,r.jsxs)("div",{className:a("relative flex items-center w-full px-2",ua),children:[(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[q&&nt==="right"&&(0,r.jsx)("span",{className:"ml-1 order-2",children:l.column.getIsSorted()&&{asc:(0,r.jsx)(K.ChevronUp,{className:"h-4 w-4"}),desc:(0,r.jsx)(K.ChevronDown,{className:"h-4 w-4"})}[l.column.getIsSorted()]}),l.isPlaceholder?null:(0,ne.flexRender)(l.column.columnDef.header,l.getContext()),q&&nt!=="right"&&l.column.getIsSorted()&&(0,r.jsx)("span",{className:"ml-1 order-2",children:l.column.getIsSorted()&&{asc:(0,r.jsx)(K.ChevronUp,{className:"h-4 w-4"}),desc:(0,r.jsx)(K.ChevronDown,{className:"h-4 w-4"})}[l.column.getIsSorted()]})]}),(q||te&&!Le)&&(0,r.jsxs)(ye,{children:[(0,r.jsx)(we,{asChild:!0,className:a("absolute",nt==="left"&&"right-1",nt==="center"&&"right-1",nt==="right"&&"left-1"),children:(0,r.jsx)(Ao,{variant:"default",size:"sm",noBg:!0,tabIndex:-1,className:"opacity-0 group-hover:opacity-70 hover:opacity-100 data-[state=open]:opacity-100",children:(0,r.jsx)(K.MoreHorizontal,{className:"h-4 w-4"})})}),(0,r.jsxs)(Ne,{align:"end",className:"w-48",children:[q&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(le,{children:"Sorting"}),(0,r.jsxs)(X,{onClick:()=>l.column.toggleSorting(!1),children:[(0,r.jsx)(K.ChevronUp,{className:"mr-2 h-4 w-4"}),"Sort Ascending"]}),(0,r.jsxs)(X,{onClick:()=>l.column.toggleSorting(!0),children:[(0,r.jsx)(K.ChevronDown,{className:"mr-2 h-4 w-4"}),"Sort Descending"]}),(0,r.jsxs)(X,{onClick:()=>l.column.clearSorting(),disabled:!l.column.getIsSorted(),children:[(0,r.jsx)(K.ChevronsUpDown,{className:"mr-2 h-4 w-4"}),"Clear Sort"]}),(0,r.jsx)(de,{})]}),te&&!Le&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(le,{children:"Pin Column"}),(0,r.jsxs)(X,{onClick:()=>Tt(l.column.id,"right"),disabled:l.column.getIsPinned()==="right",children:[(0,r.jsx)(K.MoveRightIcon,{}),"Pin Right"]}),(0,r.jsxs)(X,{onClick:()=>Tt(l.column.id,!1),disabled:!l.column.getIsPinned(),children:[(0,r.jsx)(K.PinOffIcon,{}),"Unpin"]})]})]})]})]}),Ht&&l.column.getCanResize()&&!d&&l.colSpan===1&&(0,r.jsx)("div",{className:"absolute right-0 top-0 h-full w-1 bg-border hover:bg-primary cursor-col-resize opacity-0 hover:opacity-100 transition-opacity",onMouseDown:l.getResizeHandler()})]},l.id)})},S.id))}),Dt=S=>{if(!R)return;let W=0,l=$.getLeftHeaderGroups()[0]?.headers||[],M=[...Y?["serialNumber"]:[],...ee?["select"]:[]];for(let d of l){if(d.id===S.id)break;if(M.includes(d.id)){let x=$.getColumn(d.id);x&&(W+=x.getSize())}}return W},pt=S=>{if(!R)return;let W=$.getState().columnPinning.right||[],l=W.indexOf(S.id);if(l===-1)return;let M=0;for(let d=l+1;d<W.length;d++){let x=$.getColumn(W[d]);x&&(M+=x.getSize())}return M};return u?(0,r.jsx)(he,{className:"w-full rounded-xl shadow-sm",children:(0,r.jsx)(xe,{className:"flex items-center justify-center",children:(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsx)("div",{className:"text-red-500 mb-3 text-2xl",children:"\u26A0\uFE0F"}),(0,r.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:u}),A&&(0,r.jsxs)(v,{variant:"outline",size:"sm",onClick:A,className:"rounded-lg",children:[(0,r.jsx)(K.Loader2,{className:"mr-2 h-4 w-4"}),"Try Again"]})]})})}):(0,r.jsx)(Ye,{children:(0,r.jsxs)("div",{className:a("w-full space-y-2 flex flex-col h-full",C),children:[i&&(0,r.jsx)(he,{className:"rounded-2xl py-2 sticky top-0 z-20",children:(0,r.jsx)(xe,{className:"px-2",children:i})}),Ct&&(0,r.jsx)(Wt,{table:$,filters:o,globalFilter:be,onGlobalFilterChange:Se,enableGlobalFilter:ct,onExport:z,onRefresh:A,loading:f,enableColumnVisibility:ve,enableColumnPinning:R,data:e,onClearSorting:Pt,onClearFilters:Et}),(0,r.jsx)(he,{className:a("shadow-sm overflow-auto py-0",wt&&"flex-1"),children:(0,r.jsx)(xe,{className:"p-0 h-full",children:(0,r.jsxs)("div",{className:"relative flex flex-col h-full justify-between",children:[f&&(0,r.jsx)("div",{className:"absolute inset-0 bg-background/80 backdrop-blur-sm z-50 flex items-center justify-center rounded-xl",children:(0,r.jsxs)("div",{className:"flex items-center gap-3 bg-background/90 px-4 py-3 rounded-lg shadow-sm",children:[(0,r.jsx)(K.Loader2,{className:"size-5 animate-spin text-primary"}),(0,r.jsx)("span",{className:"text-sm font-medium text-muted-foreground",children:"Loading..."})]})}),(0,r.jsx)("div",{className:"relative rounded-t-xl overflow-auto border-b",children:(0,r.jsxs)(jt,{className:"border-collapse w-full",children:[!Nt&&St(),(0,r.jsx)(To,{children:$.getRowModel().rows?.length?$.getRowModel().rows.map((S,W)=>(0,r.jsx)(gt,{"data-state":S.getIsSelected()&&"selected",className:a(at&&"hover:bg-muted/50",ot&&W%2===0&&"bg-muted/20",S.getIsSelected()&&"bg-muted","border-b last:border-b-0"),children:S.getVisibleCells().map((l,M)=>{let d=R&&(l.column.getIsPinned()==="left"||l.column.id==="serialNumber"||l.column.id==="select"&&ee),x=R&&l.column.getIsPinned()==="right",w=l.column.id==="serialNumber",q=l.column.id==="select",te=w||q&&ke;return(0,r.jsx)(Rt,{className:a(Re?"py-2":"py-4",yt&&M<S.getVisibleCells().length&&"border-r",d&&"sticky left-0 z-10 bg-sidebar/97",x&&"sticky right-0 z-10 bg-sidebar/97",w&&"sticky left-0 z-10 bg-sidebar/97","p-1"),style:{width:l.column.getSize()!==150?l.column.getSize():"auto",minWidth:l.column.getSize()!==150?l.column.getSize():"auto",...d&&{left:w?0:q?Y&&$.getColumn("serialNumber")?.getSize()||0:Dt(l.column)},...x&&{right:pt(l.column)},...w&&{left:0}},children:(0,ne.flexRender)(l.column.columnDef.cell,l.getContext())},l.id)})},S.id)):(0,r.jsx)(gt,{children:(0,r.jsx)(Rt,{colSpan:mt.length,className:"h-32 text-center border-0",children:(0,r.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,r.jsx)("div",{className:"text-muted-foreground text-5xl",children:"\u{1F4CB}"}),(0,r.jsx)("p",{className:"text-muted-foreground font-medium",children:T})]})})})})]})}),p&&(0,r.jsx)("div",{className:"sticky bottom-0 bg-sidebar w-full z-20",style:{width:"100%",minWidth:"fit-content"},children:(0,r.jsx)(jt,{children:(0,r.jsx)(So,{children:(0,r.jsx)(gt,{className:"bg-sidebar",children:(0,r.jsx)(Rt,{colSpan:mt.length,className:"p-2",children:p})})})})})]})})}),(0,r.jsx)(Jt,{table:$,config:n}),B&&B($)]})})}var Bo=require("radix-ui");var Fo=require("react/jsx-runtime");function bt({className:e,orientation:t="horizontal",decorative:o=!0,...n}){return(0,Fo.jsx)(Bo.Separator.Root,{"data-slot":"separator-root",decorative:o,orientation:t,className:a("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",e),...n})}var It=require("lucide-react"),Bt=require("framer-motion"),$e=ut(require("react"),1),Lo=ut(require("react-dom"),1),H=require("react/jsx-runtime");function Kt({table:e,visible:t,container:o,children:n,className:s,...i}){let[p,C]=$e.useState(!1);$e.useLayoutEffect(()=>{C(!0)},[]),$e.useEffect(()=>{function u(T){T.key==="Escape"&&e&&e.toggleAllRowsSelected(!1)}return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[e]);let y=o??(p?globalThis.document?.body:null);if(!y||!e)return null;let f=t??e.getFilteredSelectedRowModel().rows.length>0;return Lo.createPortal((0,H.jsx)(Bt.AnimatePresence,{children:f&&(0,H.jsx)(Bt.motion.div,{role:"toolbar","aria-orientation":"horizontal",initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:20},transition:{duration:.3,ease:"easeInOut"},className:a("fixed inset-x-0 bottom-6 z-50 mx-auto flex w-fit flex-wrap items-center justify-center gap-2 rounded-xl border bg-primary/10 backdrop-blur-sm p-3 text-foreground ring-5 ring-primary/5",s),...i,children:(0,H.jsxs)(Ye,{children:["1",n]})})}),y)}function Yt({size:e="sm",tooltip:t,isPending:o,disabled:n,className:s,children:i,...p}){let C=(0,H.jsx)(v,{variant:"secondary",size:e,className:a("gap-1.5 rounded-lg border border-secondary bg-secondary/50 hover:bg-secondary/70 transition-all duration-200",e==="icon"?"size-8":"h-8 px-3",s),disabled:n||o,...p,children:o?(0,H.jsx)(It.Loader,{className:"animate-spin"}):i});return t?(0,H.jsxs)(Oe,{children:[(0,H.jsx)(Ve,{asChild:!0,children:C}),(0,H.jsx)(_e,{sideOffset:8,className:"rounded-lg border font-semibold text-foreground bg-secondary [&>span]:hidden",children:(0,H.jsx)("p",{children:t})})]}):C}function Zt({table:e}){let t=$e.useCallback(()=>{e&&e.toggleAllRowsSelected(!1)},[e]);return e?(0,H.jsxs)("div",{className:"flex h-8 items-center rounded-lg border bg-muted/50 pr-1 pl-3",children:[(0,H.jsxs)("span",{className:"whitespace-nowrap text-sm font-medium",children:[e.getFilteredSelectedRowModel().rows.length," selected"]}),(0,H.jsx)(bt,{orientation:"vertical",className:"mr-2 ml-3 data-[orientation=vertical]:h-4"}),(0,H.jsxs)(Oe,{children:[(0,H.jsx)(Ve,{asChild:!0,children:(0,H.jsx)(v,{variant:"ghost",size:"icon",className:"size-6 rounded-md",onClick:t,children:(0,H.jsx)(It.X,{className:"size-3.5"})})}),(0,H.jsxs)(_e,{sideOffset:10,className:"flex items-center gap-2 rounded-lg border px-3 py-2 font-semibold text-foregroun bg-secondary [&>span]:hidden",children:[(0,H.jsx)("p",{children:"Clear selection"}),(0,H.jsx)("kbd",{className:"select-none rounded border bg-primary/50 px-2 py-1 font-mono font-normal text-[0.7rem] text-foreground shadow-sm",children:(0,H.jsx)("abbr",{title:"Escape",className:"no-underline",children:"Esc"})})]})]})]}):null}var Oo=require("lucide-react");var Vo=require("react/jsx-runtime");var _o=require("lucide-react");var Go=require("react/jsx-runtime");var Ta=require("radix-ui"),Ho=require("class-variance-authority");var Sa=require("react/jsx-runtime"),jn=(0,Ho.cva)("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});var Ra=require("cmdk"),Ma=require("lucide-react");var Da=require("radix-ui"),ka=require("lucide-react");var Eo=require("react/jsx-runtime");var jo=require("react/jsx-runtime");var Aa=require("radix-ui");var za=require("react/jsx-runtime");var $o=require("lucide-react"),Qt=require("react/jsx-runtime");var I=require("react"),to=require("lucide-react");var me=require("lucide-react");var g=require("react/jsx-runtime");function eo({fields:e,filters:t,globalFilter:o,onGlobalFilterChange:n,fieldFilters:s,onFieldFilterChange:i,sortField:p,sortDirection:C,onSortChange:y,selectedCount:f,totalCount:u,visibleCount:T,onExport:_,onRefresh:z,loading:A,onClearFilters:k,onClearSorting:B}){let m=e.filter(h=>h.sortable),b=Object.values(s).some(h=>h!=null&&h!=="")||o!=="",j=p!=="";return(0,g.jsx)("div",{className:"rounded-xl p-0.5",children:(0,g.jsx)("div",{className:"px-2",children:(0,g.jsx)("div",{className:"flex flex-col gap-6",children:(0,g.jsxs)("div",{className:"flex items-center justify-between",children:[(0,g.jsx)("div",{className:"flex items-center gap-3",children:t.length>0&&(0,g.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,g.jsx)("div",{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground",children:(0,g.jsx)(me.Filter,{className:"h-4 w-4"})}),t.map(h=>(0,g.jsx)("div",{className:"relative min-w-[150px]",children:h.type==="select"?(0,g.jsxs)(Ge,{value:s[h.key]||"all",onValueChange:F=>i(h.key,F),children:[h.icon&&(0,g.jsx)(h.icon,{className:"size-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),(0,g.jsx)(Ee,{className:a("h-9 rounded-lg w-full",h.icon&&"pl-9"),children:(0,g.jsx)(He,{placeholder:h.placeholder||"Select..."})}),(0,g.jsxs)(je,{className:"rounded-lg",children:[(0,g.jsx)(Ce,{value:"all",children:"All"}),h.options?.map(F=>(0,g.jsx)(Ce,{value:F.value,children:F.label},F.value))]})]}):(0,g.jsxs)("div",{className:"relative",children:[h.icon&&(0,g.jsx)(h.icon,{className:"size-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),(0,g.jsx)(rt,{type:h.type,placeholder:h.placeholder,value:s[h.key]||"",onChange:F=>i(h.key,F.target.value),className:a("h-9 rounded-lg",h.icon&&"pl-9")})]})},String(h.key)))]})}),(0,g.jsxs)("div",{className:"flex items-center gap-2",children:[(0,g.jsxs)("div",{className:"relative",children:[(0,g.jsx)(me.Search,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),(0,g.jsx)(rt,{placeholder:"Global search...",value:o,onChange:h=>n(h.target.value),className:"pl-9 h-9 rounded-lg max-w-max"})]}),m.length>0&&(0,g.jsxs)(ye,{children:[(0,g.jsx)(we,{asChild:!0,children:(0,g.jsxs)(v,{variant:"outline",size:"sm",className:"rounded-lg gap-1",children:[(0,g.jsx)("span",{children:"Sort"}),(0,g.jsx)(me.ChevronDown,{className:"h-4 w-4 opacity-50"})]})}),(0,g.jsxs)(Ne,{align:"end",className:"w-[200px] rounded-lg",children:[(0,g.jsx)(le,{children:"Sort By"}),(0,g.jsx)(de,{}),m.map(h=>(0,g.jsxs)("div",{children:[(0,g.jsxs)(X,{onClick:()=>y(h.key,"asc"),children:[h.label," (A-Z)"]}),(0,g.jsxs)(X,{onClick:()=>y(h.key,"desc"),children:[h.label," (Z-A)"]})]},String(h.key))),j&&(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(de,{}),(0,g.jsx)(X,{onClick:B,children:"Clear All Sorting"})]})]})]}),(0,g.jsxs)(ye,{children:[(0,g.jsx)(we,{asChild:!0,children:(0,g.jsx)(v,{variant:"outline",size:"sm",className:"rounded-lg",children:(0,g.jsx)(me.Settings2,{className:"h-4 w-4"})})}),(0,g.jsxs)(Ne,{align:"end",className:"w-[200px] rounded-lg",children:[(0,g.jsx)(le,{children:"Table Settings"}),(0,g.jsx)(de,{}),(0,g.jsx)(X,{onClick:B,children:"Clear All Sorting"}),(0,g.jsx)(X,{onClick:k,children:"Clear All Filters"})]})]}),_&&(0,g.jsxs)(v,{variant:"outline",size:"sm",onClick:_,className:"rounded-lg",children:[(0,g.jsx)(me.Download,{className:"mr-2 h-4 w-4"}),"Export"]}),z&&(0,g.jsx)(v,{variant:"outline",size:"sm",onClick:z,disabled:A,className:"rounded-lg",children:(0,g.jsx)(me.RefreshCw,{className:a("h-4 w-4",A&&"animate-spin")})})]})]})})})})}var Ue=require("lucide-react");var P=require("react/jsx-runtime");function Uo({currentPage:e,totalPages:t,pageSize:o,totalItems:n,onPageChange:s,onPageSizeChange:i,config:p}){if(!p.enabled)return null;let C=p.pageSizeOptions||[10,20,50,100],y=(e-1)*o+1,f=Math.min(e*o,n),u=e>1,T=e<t,_=()=>{let A=[],k=[];for(let B=Math.max(2,e-2);B<=Math.min(t-1,e+2);B++)A.push(B);return e-2>2?k.push(1,"..."):k.push(1),k.push(...A),e+2<t-1?k.push("...",t):t>1&&k.push(t),k};return(0,P.jsx)("div",{className:"rounded-xl",children:(0,P.jsxs)("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4",children:[(0,P.jsx)("div",{className:"flex items-center gap-6 text-sm text-muted-foreground",children:p.showInfo!==!1&&(0,P.jsxs)("span",{children:["Showing ",y," to ",f," of ",n," entries"]})}),(0,P.jsxs)("div",{className:"flex flex-col sm:flex-row items-center gap-4",children:[C&&(0,P.jsxs)("div",{className:"flex items-center gap-2",children:[(0,P.jsx)("span",{className:"text-sm font-medium whitespace-nowrap",children:"Page size:"}),(0,P.jsxs)(Ge,{value:`${o}`,onValueChange:z=>i(Number(z)),children:[(0,P.jsx)(Ee,{className:"h-9 w-[70px] rounded-lg",children:(0,P.jsx)(He,{})}),(0,P.jsx)(je,{side:"top",className:"rounded-lg",children:C.map(z=>(0,P.jsx)(Ce,{value:`${z}`,children:z},z))})]})]}),(0,P.jsxs)("div",{className:"flex items-center gap-2",children:[(0,P.jsxs)(v,{variant:"outline",size:"sm",onClick:()=>s(1),disabled:!u,className:"hidden sm:flex rounded-lg",children:[(0,P.jsx)(Ue.ChevronsLeft,{className:"h-4 w-4"}),(0,P.jsx)("span",{className:"sr-only",children:"Go to first page"})]}),(0,P.jsxs)(v,{variant:"outline",size:"sm",onClick:()=>s(e-1),disabled:!u,className:"rounded-lg",children:[(0,P.jsx)(Ue.ChevronLeft,{className:"h-4 w-4 sm:mr-2"}),(0,P.jsx)("span",{className:"hidden sm:inline",children:"Previous"}),(0,P.jsx)("span",{className:"sr-only sm:hidden",children:"Go to previous page"})]}),p.showPageNumbers&&t>1&&(0,P.jsx)("div",{className:"hidden sm:flex items-center gap-1",children:_().map((z,A)=>{if(z==="...")return(0,P.jsx)("span",{className:"px-2 py-1 text-sm text-muted-foreground",children:"..."},`dots-${A}`);let k=z;return(0,P.jsx)(v,{variant:k===e?"default":"outline",size:"sm",className:"w-9 h-9 p-0 rounded-lg",onClick:()=>s(k),children:k},k)})}),(0,P.jsxs)("div",{className:"sm:hidden flex items-center gap-2 px-3 py-1 text-sm font-medium bg-muted rounded-lg",children:[e," of ",t]}),(0,P.jsxs)(v,{variant:"outline",size:"sm",onClick:()=>s(e+1),disabled:!T,className:"rounded-lg",children:[(0,P.jsx)("span",{className:"hidden sm:inline",children:"Next"}),(0,P.jsx)(Ue.ChevronRight,{className:"h-4 w-4 sm:ml-2"}),(0,P.jsx)("span",{className:"sr-only sm:hidden",children:"Go to next page"})]}),(0,P.jsxs)(v,{variant:"outline",size:"sm",onClick:()=>s(t),disabled:!T,className:"hidden sm:flex rounded-lg",children:[(0,P.jsx)(Ue.ChevronsRight,{className:"h-4 w-4"}),(0,P.jsx)("span",{className:"sr-only",children:"Go to last page"})]})]})]})]})})}var D=require("react/jsx-runtime");function oo({data:e,template:t,fields:o=[],filters:n=[],pagination:s={enabled:!1},settings:i={},header:p,footer:C,className:y="",loading:f=!1,error:u,emptyMessage:T="No items found",emptyIcon:_,onSelectionChange:z,onExport:A,onRefresh:k,onTemplateReady:B,children:m}){let{enableSorting:b=!0,enableFiltering:j=!0,enableGlobalSearch:h=!0,enableSelection:F=!1,enableExport:Ie=!1,toolbar:Be=!0,selectionMode:fe="multiple",gridCols:be={default:3,sm:1,md:2,lg:3,xl:4,"2xl":6},gap:Se=4,aspectRatio:oe="auto",minCardWidth:Fe=350,maxCardWidth:re=350}=i,[qe,tt]=(0,I.useState)(""),[De,ct]=(0,I.useState)({}),[ve,ee]=(0,I.useState)(""),[Xe,Ct]=(0,I.useState)("asc"),[Y,ke]=(0,I.useState)(new Set),[ot,at]=(0,I.useState)(1),[Re,yt]=(0,I.useState)(s.pageSize||12),[wt,Ht]=(0,I.useState)(be.default),R=(0,I.useMemo)(()=>{let d=[...e];if(h&&qe){let x=o.filter(w=>w.searchable!==!1);d=d.filter(w=>x.some(q=>w[q.key]?.toString().toLowerCase().includes(qe.toLowerCase())))}if(j&&Object.keys(De).forEach(x=>{let w=De[x];if(w!=null&&w!==""){let q=o.find(te=>te.key===x);q&&(d=d.filter(te=>{let ie=te[x];return q.type==="boolean"?ie===(w==="true"):q.type==="number"?ie===Number(w):ie?.toString().toLowerCase().includes(String(w).toLowerCase())}))}}),b&&ve){let x=o.find(w=>w.key===ve);x&&d.sort((w,q)=>{let te=w[ve],ie=q[ve];if(x.type==="number")return Xe==="asc"?Number(te)-Number(ie):Number(ie)-Number(te);if(x.type==="date"){let Me=new Date(te),Le=new Date(ie);return Xe==="asc"?Me.getTime()-Le.getTime():Le.getTime()-Me.getTime()}else{let Me=String(te).toLowerCase(),Le=String(ie).toLowerCase();return Xe==="asc"?Me.localeCompare(Le):Le.localeCompare(Me)}})}return d},[e,qe,De,ve,Xe,o,h,j,b]),Nt=(0,I.useMemo)(()=>{if(!s.enabled)return R;let d=(ot-1)*Re,x=d+Re;return R.slice(d,x)},[R,ot,Re,s.enabled]),mt=Math.ceil(R.length/Re),$=(0,I.useCallback)(d=>{F&&ke(x=>{let w=new Set(x);return fe==="single"?(w.clear(),w.add(d)):w.has(d)?w.delete(d):w.add(d),w})},[F,fe]),Pt=(0,I.useCallback)(()=>{!F||fe==="single"||(Y.size===R.length?ke(new Set):ke(new Set(R.map((d,x)=>x))))},[F,fe,Y.size,R.length]),Et=(0,I.useCallback)((d,x)=>{ct(w=>({...w,[d]:x})),at(1)},[]),Tt=(0,I.useCallback)((d,x)=>{ee(d),Ct(x)},[]),St=(0,I.useCallback)(()=>{tt(""),ct({}),at(1)},[]),Dt=(0,I.useCallback)(()=>{ee(""),Ct("asc")},[]),pt=(0,I.useMemo)(()=>({getSelectedItems:()=>Array.from(Y).map(d=>R[d]),clearSelection:()=>ke(new Set),selectAll:Pt,getFilteredData:()=>R,getTotalCount:()=>e.length,getVisibleCount:()=>R.length,refresh:()=>k?.(),exportData:()=>A?.(R)}),[Y,R,e.length,Pt,k,A]),S=(0,I.useRef)(null);S.current=pt,(0,I.useEffect)(()=>{B&&S.current&&B(S.current)},[]),(0,I.useEffect)(()=>{if(F&&z){let d=Array.from(Y).map(x=>R[x]);z(d)}},[Y]);let W=a("w-full","overflow-hidden",y),l=a("grid",`gap-${Se}`,"w-full","mx-auto","items-start"),M={gridTemplateColumns:wt===0?`repeat(auto-fill, minmax(clamp(${Fe}px, 30%, ${re}px), 1fr))`:`repeat(auto-fill, minmax(clamp(${Fe}px, calc(100%/${wt} - ${Se*4}px), ${re}px), 1fr))`,justifyItems:"center",alignItems:"stretch",gridAutoRows:"1fr",gridAutoFlow:"dense"};return u?(0,D.jsx)(he,{className:"w-full",children:(0,D.jsx)(xe,{className:"flex items-center justify-center py-12",children:(0,D.jsxs)("div",{className:"text-center",children:[(0,D.jsx)("div",{className:"text-red-500 mb-3 text-2xl",children:"\u26A0\uFE0F"}),(0,D.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:u}),k&&(0,D.jsxs)(v,{variant:"outline",size:"sm",onClick:k,children:[(0,D.jsx)(to.Loader2,{className:"mr-2 h-4 w-4"}),"Try Again"]})]})})}):(0,D.jsxs)("div",{className:a("w-full flex gap-2 flex-col h-full",W),children:[p&&(0,D.jsx)(he,{className:"shadow-sm border-0 py-0 text-xl font-bold",children:(0,D.jsx)(xe,{className:"p-2",children:p})}),Be&&(0,D.jsx)(eo,{fields:o,filters:n,globalFilter:qe,onGlobalFilterChange:tt,fieldFilters:De,onFieldFilterChange:Et,sortField:ve,sortDirection:Xe,onSortChange:Tt,selectedCount:Y.size,totalCount:e.length,visibleCount:R.length,onExport:Ie?()=>A?.(R):void 0,onRefresh:k,loading:f,onClearFilters:St,onClearSorting:Dt}),(0,D.jsx)(he,{className:"border-0 overflow-auto shadow-none py-0 p-2 flex-1",children:(0,D.jsx)(xe,{className:"px-0",children:(0,D.jsxs)("div",{className:"relative",children:[f&&(0,D.jsx)("div",{className:"absolute inset-0 bg-background/80 backdrop-blur-sm z-50 flex items-center justify-center rounded-lg",children:(0,D.jsxs)("div",{className:"flex items-center gap-3 bg-background/90 px-4 py-3 rounded-lg shadow-sm",children:[(0,D.jsx)(to.Loader2,{className:"size-5 animate-spin text-primary"}),(0,D.jsx)("span",{className:"text-sm font-medium text-muted-foreground",children:"Loading..."})]})}),Nt.length>0?(0,D.jsx)("div",{className:a(l),style:M,children:Nt.map((d,x)=>{let w=s.enabled?(ot-1)*Re+x:x,q=Y.has(w);return(0,D.jsxs)("div",{className:a("relative h-full w-full flex flex-col","transition-all duration-200 overflow-hidden","rounded-2xl","border border-border/20 hover:border-border/50",oe==="square"?"aspect-square":"",oe==="video"?"aspect-video":"",F?"cursor-pointer":"",q?"ring-2 ring-primary":""),onClick:()=>F&&$(w),children:[F&&fe==="multiple"&&(0,D.jsx)("div",{className:"absolute top-2 right-2 z-10",children:(0,D.jsx)(ft,{checked:q,onCheckedChange:()=>$(w),className:"bg-background/80 backdrop-blur-sm",onClick:te=>te.stopPropagation()})}),t(d,x,q,()=>$(w))]},w)})}):(0,D.jsxs)("div",{className:"flex flex-col gap-4 items-center justify-center py-12 text-center",children:[(0,D.jsx)("div",{className:"text-6xl",children:_||"\u{1F4CB}"}),(0,D.jsx)("p",{className:"text-lg font-medium text-muted-foreground mb-2",children:T}),(qe||Object.values(De).some(d=>d))&&(0,D.jsx)(v,{variant:"outline",onClick:St,children:"Clear Filters"})]})]})})}),s.enabled&&(0,D.jsx)("div",{className:"pb-1",children:(0,D.jsx)(Uo,{currentPage:ot,totalPages:mt,pageSize:Re,totalItems:R.length,onPageChange:at,onPageSizeChange:d=>{yt(d),at(1)},config:s})}),C&&(0,D.jsx)("div",{className:"p-2 m-0.5",children:C}),m&&m(pt)]})}var Ft=require("lucide-react"),Lt=require("framer-motion"),We=ut(require("react"),1),Wo=ut(require("react-dom"),1),E=require("react/jsx-runtime");function ao({controller:e,visible:t,container:o,children:n,className:s,...i}){let[p,C]=We.useState(!1);We.useLayoutEffect(()=>{C(!0)},[]),We.useEffect(()=>{function T(_){_.key==="Escape"&&e&&e.clearSelection()}return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[e]);let y=o??(p?globalThis.document?.body:null);if(!y||!e)return null;let f=e.getSelectedItems(),u=t??f.length>0;return Wo.createPortal((0,E.jsx)(Lt.AnimatePresence,{children:u&&(0,E.jsx)(Lt.motion.div,{role:"toolbar","aria-orientation":"horizontal",initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:20},transition:{duration:.3,ease:"easeInOut"},className:a("fixed inset-x-0 bottom-6 z-50 mx-auto flex w-fit flex-wrap items-center justify-center gap-2 rounded-xl border bg-primary/10 backdrop-blur-sm p-3 text-foreground ring-8 ring-primary/5",s),...i,children:(0,E.jsx)(Ye,{children:n})})}),y)}function no({size:e="sm",variant:t="secondary",tooltip:o,isPending:n,disabled:s,className:i,children:p,onClick:C,...y}){let f=(0,E.jsx)(v,{variant:t,size:e,className:a("gap-1.5 rounded-lg border border-secondary bg-secondary/50 hover:bg-secondary/70 transition-all duration-200",e==="icon"?"size-8":"h-8 px-3",i),disabled:s||n,onClick:C,...y,children:n?(0,E.jsx)(Ft.Loader,{className:"animate-spin"}):p});return o?(0,E.jsxs)(Oe,{children:[(0,E.jsx)(Ve,{asChild:!0,children:f}),(0,E.jsx)(_e,{sideOffset:8,className:"rounded-lg border font-semibold text-foreground bg-secondary [&>span]:hidden",children:(0,E.jsx)("p",{children:o})})]}):f}function ro({controller:e}){let t=We.useCallback(()=>{e&&e.clearSelection()},[e]);if(!e)return null;let o=e.getSelectedItems();return(0,E.jsxs)("div",{className:"flex h-8 items-center rounded-lg border bg-muted/50 pr-1 pl-3",children:[(0,E.jsxs)("span",{className:"whitespace-nowrap text-sm font-medium",children:[o.length," selected"]}),(0,E.jsx)(bt,{orientation:"vertical",className:"mr-2 ml-3 data-[orientation=vertical]:h-4"}),(0,E.jsxs)(Oe,{children:[(0,E.jsx)(Ve,{asChild:!0,children:(0,E.jsx)(v,{variant:"ghost",size:"icon",className:"size-6 rounded-md",onClick:t,children:(0,E.jsx)(Ft.X,{className:"size-3.5"})})}),(0,E.jsxs)(_e,{sideOffset:10,className:"flex items-center gap-2 rounded-lg border px-3 py-2 font-semibold text-foreground bg-secondary [&>span]:hidden",children:[(0,E.jsx)("p",{children:"Clear selection"}),(0,E.jsx)("kbd",{className:"select-none rounded border bg-primary/50 px-2 py-1 font-mono font-normal text-[0.7rem] text-foreground shadow-sm",children:(0,E.jsx)("abbr",{title:"Escape",className:"no-underline",children:"Esc"})})]})]})]})}var qo=require("react/jsx-runtime"),Ia={none:"gap-0",tight:"gap-2",default:"gap-4",loose:"gap-6","extra-loose":"gap-8"},Ba={none:"p-0",tight:"p-2",default:"p-4",loose:"p-6"},Jo=({children:e,className:t,spacing:o="tight",padding:n="none"})=>(0,qo.jsx)("div",{className:a("flex flex-col h-full",Ia[o],Ba[n],t),children:e});var vt=require("lucide-react");var Xo=require("react-router"),L=require("react/jsx-runtime"),Ko=({className:e,columns:t=[],showBackButton:o=!0,meta:n={title:""}})=>{let s=()=>{if(!n.backAction||!o)return null;let u={variant:"secondary",size:"icon",className:"hover:bg-primary/20 inline-flex"};return n.backAction.href?(0,L.jsx)(Xo.NavLink,{to:n.backAction.href,children:(0,L.jsxs)(v,{...u,children:[(0,L.jsx)(vt.ArrowLeftIcon,{className:"size-6"}),n.backAction.content]})}):(0,L.jsxs)(v,{...u,onClick:n.backAction.onClick,children:[(0,L.jsx)(vt.ArrowLeftIcon,{className:"size-6"}),n.backAction.content]})},i=()=>!n.metadata||n.metadata.length===0?null:(0,L.jsx)("div",{className:"flex gap-4",children:n.metadata.map((u,T)=>u.value&&(0,L.jsxs)("div",{className:"text-sm",children:[(0,L.jsxs)("span",{className:"text-muted-foreground",children:[u.label," "]}),(0,L.jsx)("span",{children:u.value})]},T))}),p=()=>n.status?(0,L.jsx)("span",{className:a("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium",{success:"bg-green-100 text-green-800",warning:"bg-yellow-100 text-yellow-800",critical:"bg-red-100 text-red-800",info:"bg-blue-100 text-blue-800",default:"bg-gray-100 text-gray-800"}[n.status.color]),children:n.status.content}):null,C={content:(0,L.jsxs)("div",{className:"flex gap-2 items-center",children:[s(),(0,L.jsxs)("div",{className:"flex flex-col gap-2 w-max",children:[(0,L.jsx)("h1",{className:"text-2xl font-bold tracking-tight",children:n.title}),p(),n.description&&(0,L.jsx)("p",{className:"text-muted-foreground",children:n.description}),i(),n.breadcrumbs&&n.breadcrumbs.length>0&&(0,L.jsx)("div",{className:"flex items-center text-sm text-muted-foreground",children:n.breadcrumbs.map((u,T)=>(0,L.jsxs)("div",{className:"flex items-center",children:[u.href?(0,L.jsx)("span",{className:"hover:text-primary hover:underline",children:u.label}):(0,L.jsx)("span",{children:u.label}),T<n.breadcrumbs.length-1&&(0,L.jsx)(vt.ChevronRight,{className:"mx-2 h-4 w-4"})]},T))})]})]}),align:"left",width:"fill"},y={content:n.primaryActions,align:"right",width:"auto"},f=[C,...t.filter(u=>u!==void 0),y];return(0,L.jsx)("div",{className:a("flex items-center w-full gap-4 p-2",e),children:f.map((u,T)=>(0,L.jsx)("div",{className:a("flex items-center h-full",u.className,{"justify-start":u.align==="left","justify-center":u.align==="center","justify-end":u.align==="right","flex-1":u.width==="fill"}),children:u.content},T))})};var Je=ut(require("react"),1);var Qe=require("radix-ui"),Yo=require("lucide-react");var pe=require("react/jsx-runtime");function Zo({...e}){return(0,pe.jsx)(Qe.Dialog.Root,{"data-slot":"sheet",...e})}function Qo({...e}){return(0,pe.jsx)(Qe.Dialog.Trigger,{"data-slot":"sheet-trigger",...e})}function io({...e}){return(0,pe.jsx)(Qe.Dialog.Portal,{"data-slot":"sheet-portal",...e})}function so({className:e,...t}){return(0,pe.jsx)(Qe.Dialog.Overlay,{"data-slot":"sheet-overlay",className:a("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e),...t})}function ea({className:e,children:t,side:o="right",...n}){return(0,pe.jsxs)(io,{children:[(0,pe.jsx)(so,{}),(0,pe.jsxs)(Qe.Dialog.Content,{"data-slot":"sheet-content",className:a("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",o==="right"&&"data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",o==="left"&&"data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",o==="top"&&"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",o==="bottom"&&"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",e),...n,children:[t,(0,pe.jsxs)(Qe.Dialog.Close,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none",children:[(0,pe.jsx)(Yo.XIcon,{className:"size-4"}),(0,pe.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}var O=require("react/jsx-runtime"),ta=(0,Je.createContext)(!1),lo={"one-half":["w-1/2","w-1/2"],"one-third":["w-1/3","w-2/3"],"two-third":["w-2/3","w-1/3"],"one-fourth":["w-1/4","w-3/4"],"three-fourth":["w-3/4","w-1/4"],"one-fifth":["w-1/5","w-4/5"],"four-fifth":["w-4/5","w-1/5"]},ht={none:"p-0",tight:"p-2",default:"p-4",loose:"p-6"},Fa=(e,t)=>{let[o,n]=lo[t];return{container:"inset-y-0 z-50 transition-all duration-500 ease-in-out",content:a("h-full bg-background transition-all duration-500 ease-in-out",e==="right"?"border-l":"border-r"),transform:e==="right"?"translate-x-full":"-translate-x-full",transformOpen:"translate-x-0",contentPushClass:e==="right"?o:n,sheetPushClass:e==="right"?n:o}},La="flex flex-col overflow-hidden rounded-2xl relative",Oa={default:"bg-background",card:"bg-background shadow-sm border",border:"bg-background border-2",transparent:"bg-transparent"},oa=e=>{let{children:t,className:o,variant:n="default",layout:s="full",header:i,footer:p,headerClassName:C,footerClassName:y,parentContainer:f=!1,padding:u=f?"none":"tight"}=e,T=(0,Je.useContext)(ta),[_,z]=(0,Je.useState)(!1),A=Je.default.useCallback(B=>(0,O.jsx)("div",{className:a("flex-1 overflow-auto h-full no-scrollbar",f&&"flex",!f&&ht[u]),children:B}),[u,f]),k=()=>{switch(s){case"split":{let{splitRatio:B="three-fourth",reverse:m=!1}=e;if(!Array.isArray(t)||t.length!==2)return(0,O.jsx)("div",{className:"flex items-center justify-center h-full text-red-500",children:'Error: AppContent with layout="split" requires exactly 2 children'});let[b,j]=lo[B],[h,F]=m?[t[1],t[0]]:[t[0],t[1]],[Ie,Be]=m?[j,b]:[b,j];return(0,O.jsxs)("div",{className:"flex h-full gap-2",children:[(0,O.jsx)("div",{className:a(Ie,"overflow-auto"),children:A(h)}),(0,O.jsx)("div",{className:a(Be,"overflow-auto"),children:A(F)})]})}case"with-sheet":{let{sheetContent:B,sheetWidth:m="four-fifth",sheetSide:b="right",sheetMode:j="container",sheetTrigger:h,sheetClassName:F,isSheetOpen:Ie,onSheetOpenChange:Be,showSheetOverlay:fe=!0,disableOverlay:be=!0}=e,Se=Ie!==void 0,oe=Se?Ie:_,Fe=Se?Be:z;if(j==="container"){let re=Fa(b,m);return(0,O.jsxs)("div",{className:a("flex relative flex-1 overflow-hidden",oe&&be&&["left","right"].includes(b)),children:[(0,O.jsxs)("div",{className:a("h-full overflow-auto transition-all duration-500",oe&&be&&["left","right"].includes(b)?re.contentPushClass:"w-full",oe&&be&&"overflow-y-auto overflow-x-hidden"),children:[h&&(0,O.jsx)("div",{onClick:()=>Fe?.(!oe),children:h}),(0,O.jsx)("div",{className:a("h-full",!f&&ht[u]),children:t})]}),(0,O.jsx)("div",{className:a(re.container,"transition-all duration-500 ease-in-out",oe&&be&&["left","right"].includes(b)?a(re.sheetPushClass,"overflow-y-auto"):oe?re.transformOpen:a(re.transform,"hidden"),"overflow-y-auto"),children:(0,O.jsx)("div",{className:a(re.content,F,"h-full"),children:B})}),oe&&fe&&!be&&(0,O.jsx)("div",{className:a("absolute inset-0 bg-secondary/20 z-40","transition-opacity duration-500 ease-in-out","opacity-0",oe?"opacity-100":"opacity-0"),onClick:()=>Fe?.(!1)})]})}return(0,O.jsxs)(Zo,{open:oe,onOpenChange:Fe,children:[h&&(0,O.jsx)(Qo,{asChild:!0,children:h}),(0,O.jsxs)(io,{children:[fe&&(0,O.jsx)(so,{className:"fixed inset-0 bg-secondary/50 z-50"}),(0,O.jsx)(ea,{side:b,className:a("fixed bg-background border","transition-all duration-500 ease-in-out",lo[m][1],F),children:B})]})]})}default:return A(t)}};return(0,O.jsx)(ta.Provider,{value:!0,children:(0,O.jsxs)("div",{className:a(La,Oa[n],ht[u],T&&"flex-1",f&&"h-full",!f&&"rounded-2xl",o),children:[i&&(0,O.jsx)("div",{className:a("border-b",C,n==="card"&&!f&&"rounded-t-2xl",n==="border"&&"border-b-2",ht[u]),children:i}),k(),p&&(0,O.jsx)("div",{className:a("border-t",y,n==="card"&&!f&&"rounded-b-2xl",n==="border"&&"border-t-2",ht[u]),children:p})]})})};var Ot=require("react/jsx-runtime"),aa=({className:e,columns:t=[],meta:o={title:""}})=>{let n={content:(0,Ot.jsx)("div",{className:"flex items-center gap-4 p-2",children:o.secondaryActions}),align:"right",width:"fill"},s=[...t.filter(i=>i!==void 0),n];return(0,Ot.jsx)("div",{className:a("flex items-center w-full gap-4",e),children:s.map((i,p)=>(0,Ot.jsx)("div",{className:a("flex items-center h-full",i.className,{"justify-start":i.align==="left","justify-center":i.align==="center","justify-end":i.align==="right","flex-1":i.width==="fill"}),children:i.content},p))})};var xt=require("react/jsx-runtime");function na({useTypedAppMeta:e}){return{AppHeader:i=>{let{meta:p}=e();return(0,xt.jsx)(Ko,{...i,meta:p})},AppFooter:i=>{let{meta:p}=e();return(0,xt.jsx)(aa,{...i,meta:p})},AppContent:i=>(0,xt.jsx)(oa,{...i}),AppContainer:i=>(0,xt.jsx)(Jo,{...i})}}var Q=require("react"),co=require("react/jsx-runtime"),Va=(0,Q.createContext)(void 0),ra=({children:e})=>{let[t,o]=(0,Q.useState)({title:"",description:"",breadcrumbs:[]}),n=(0,Q.useCallback)(p=>{o(C=>Object.keys(p).some(f=>JSON.stringify(C[f])!==JSON.stringify(p[f]))?{...C,...p}:C)},[]),s=(0,Q.useCallback)(()=>{o(p=>p.title===""&&p.description===""&&(p.breadcrumbs?.length??0)===0?p:{title:"",description:"",breadcrumbs:[]})},[]),i=(0,Q.useMemo)(()=>({meta:t,setMeta:n,resetMeta:s}),[t,n,s]);return(0,co.jsx)(Va.Provider,{value:i,children:e})};function ia(){let e=(0,Q.createContext)(void 0);return{TypedAppMetaProvider:({children:n})=>{let[s,i]=(0,Q.useState)({title:"",description:"",breadcrumbs:[]}),p=(0,Q.useCallback)(f=>{i(u=>Object.keys(f).some(_=>{let z=u[_],A=f[_];return JSON.stringify(z)!==JSON.stringify(A)})?{...u,...f}:u)},[]),C=(0,Q.useCallback)(()=>{i(f=>f.title===""&&f.description===""&&(f.breadcrumbs?.length??0)===0?f:{title:"",description:"",breadcrumbs:[]})},[]),y=(0,Q.useMemo)(()=>({meta:s,setMeta:p,resetMeta:C}),[s,p,C]);return(0,co.jsx)(e.Provider,{value:y,children:n})},useTypedAppMeta:()=>{let n=(0,Q.useContext)(e);if(!n)throw new Error("useTypedAppMeta must be used within a TypedAppMetaProvider");return n},TypedAppMetaContext:e}}var it=require("react");function sa({useTypedAppMeta:e}){function t(o){let{setMeta:n,resetMeta:s}=e(),i=(0,it.useMemo)(()=>{if(o.backAction)return{...o.backAction,onClick:o.backAction.onClick}},[o.backAction?.content,o.backAction?.href,o.backAction?.onClick?.toString()]),p=(0,it.useMemo)(()=>o.metadata,[JSON.stringify(o.metadata)]),C=(0,it.useMemo)(()=>({...o,backAction:i,metadata:p}),[o.title,o.description,o.breadcrumbs,o.primaryActions,o.secondaryActions,o.pagination,o.status,i,p]);(0,it.useEffect)(()=>(n(C),()=>s()),[C,n,s])}return{usePageTemplate:t}}var mo=require("react"),st=require("lucide-react");var ce=require("react/jsx-runtime"),Vt=class{static currencyFormatter=new Intl.NumberFormat("en-IN",{style:"currency",currency:"INR",maximumFractionDigits:2});static compactFormatter=new Intl.NumberFormat("en-IN",{style:"currency",currency:"INR",notation:"compact",maximumFractionDigits:1});static MONTH_NAMES_SHORT=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];static async copyToClipboard(t){if(t)try{await navigator.clipboard.writeText(t)}catch(o){throw console.error("Failed to copy text:",o),o}}static CopyToClipboard=({text:t,children:o,className:n,size:s="icon",variant:i="ghost"})=>{let[p,C]=(0,mo.useState)(!1),[y,f]=(0,mo.useState)(!1),u=async()=>{if(!(!t||y)){f(!0);try{await this.copyToClipboard(t),C(!0),setTimeout(()=>C(!1),2e3)}catch(T){console.error("Failed to copy text:",T)}finally{f(!1)}}};return(0,ce.jsxs)(Oe,{children:[(0,ce.jsx)(Ve,{asChild:!0,children:(0,ce.jsx)(v,{variant:i,size:s,className:a(s==="icon"&&"size-6",n),onClick:u,disabled:y||!t,children:y?(0,ce.jsx)(st.Loader2Icon,{className:"animate-spin"}):p?(0,ce.jsx)(st.Check,{className:"h-3 w-3"}):o||(0,ce.jsx)(st.Copy,{className:"h-3 w-3"})})}),(0,ce.jsx)(_e,{children:p?"Copied!":y?"Copying...":"Copy to clipboard"})]})};static formatINR(t,o={}){let{prefix:n="",suffix:s="",withSymbol:i=!0,compact:p=!1}=o;if(typeof t!="number"||isNaN(t))return`${n}${i?"\u20B9 ":""}0.00${s}`;let C=t<0,y=Math.abs(t),u=(p&&y>=1e5?this.compactFormatter:this.currencyFormatter).format(y).replace("\u20B9","");return`${n}${C?"- ":""}${i?"\u20B9 ":""}${u}${s}`}static formatDate(t,o={}){let{format:n="dd-mm-yyyy",separator:s="-"}=o,i=new Date(t);if(isNaN(i.getTime()))return"";let p=String(i.getDate()).padStart(2,"0"),C=String(i.getMonth()+1).padStart(2,"0"),y=this.MONTH_NAMES_SHORT[i.getMonth()],f=i.getFullYear();switch(n){case"dd-mmm-yyyy":return`${p}${s}${y}${s}${f}`;case"iso":return i.toISOString().split("T")[0];case"long":return i.toLocaleDateString("en-IN",{year:"numeric",month:"long",day:"numeric"});case"short":return i.toLocaleDateString("en-IN");default:return`${p}${s}${C}${s}${f}`}}static toProperCase(t){return t?t.toLowerCase().split(" ").map(o=>o.charAt(0).toUpperCase()+o.slice(1)).join(" "):""}static toProperCaseAdvanced(t){return t?t.toLowerCase().split(/(\s+|['-])/).map((o,n,s)=>["-","'"," "].includes(o)||n>0&&["-","'"].includes(s[n-1])?o:o.charAt(0).toUpperCase()+o.slice(1)).join(""):""}static StatusBadge=({status:t,className:o,showDot:n=!0,capitalize:s=!0,size:i="md",variant:p="outline",customColors:C,icon:y,trueMessage:f="active",falseMessage:u="inactive"})=>{let T=typeof t=="boolean"?t?f:u:typeof t=="number"?t>0?f:u:t.toLowerCase(),_={active:{label:"active",solid:{bg:"bg-emerald-500",text:"text-white",border:"border-emerald-600",dot:"bg-white"},outline:{bg:"bg-emerald-50",text:"text-emerald-700",border:"border-emerald-100",dot:"bg-emerald-500"},subtle:{bg:"bg-emerald-50",text:"text-emerald-700",border:"border-transparent",dot:"bg-emerald-500"}},pending:{label:"pending",solid:{bg:"bg-amber-500",text:"text-white",border:"border-amber-600",dot:"bg-white"},outline:{bg:"bg-amber-50",text:"text-amber-700",border:"border-amber-100",dot:"bg-amber-500"},subtle:{bg:"bg-amber-50",text:"text-amber-700",border:"border-transparent",dot:"bg-amber-500"}},inactive:{label:"inactive",solid:{bg:"bg-rose-500",text:"text-white",border:"border-rose-600",dot:"bg-white"},outline:{bg:"bg-rose-50",text:"text-rose-700",border:"border-rose-100",dot:"bg-rose-500"},subtle:{bg:"bg-rose-50",text:"text-rose-700",border:"border-transparent",dot:"bg-rose-500"}},draft:{label:"draft",solid:{bg:"bg-gray-500",text:"text-white",border:"border-gray-600",dot:"bg-white"},outline:{bg:"bg-gray-50",text:"text-gray-700",border:"border-gray-100",dot:"bg-gray-500"},subtle:{bg:"bg-gray-50",text:"text-gray-700",border:"border-transparent",dot:"bg-gray-500"}},completed:{label:"completed",solid:{bg:"bg-indigo-500",text:"text-white",border:"border-indigo-600",dot:"bg-white"},outline:{bg:"bg-indigo-50",text:"text-indigo-700",border:"border-indigo-100",dot:"bg-indigo-500"},subtle:{bg:"bg-indigo-50",text:"text-indigo-700",border:"border-transparent",dot:"bg-indigo-500"}}},z=_[T.toLowerCase()]||_.inactive,A=C||z[p],k={sm:"text-xs px-2 py-0.5",md:"text-xs px-2.5 py-0.5",lg:"text-sm px-3 py-1"},B=s?T.charAt(0).toUpperCase()+T.slice(1):T;return(0,ce.jsx)("div",{className:"flex justify-center",children:(0,ce.jsxs)("span",{className:a("inline-flex items-center gap-1.5 rounded-full border font-medium",A.bg,A.text,A.border,k[i],o),children:[n&&(y?(0,ce.jsx)("span",{className:"flex items-center",children:y}):(0,ce.jsx)("span",{className:a("size-2 rounded-full",A.dot),"aria-hidden":"true"})),B]})})}};var la=require("lucide-react"),lt=require("react-router"),V=require("react/jsx-runtime"),po=()=>{let e=(0,lt.useRouteError)(),t=(0,lt.useNavigate)();return(0,V.jsx)("div",{className:"rounded-2xl flex justify-center items-center h-full bg-sidebar px-4",children:(0,V.jsxs)("div",{className:"flex flex-col items-center space-y-4 text-center",children:[(0,V.jsx)(la.AlertTriangleIcon,{className:"h-16 w-16 text-destructive"}),(0,lt.isRouteErrorResponse)(e)?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)("h2",{className:"text-3xl font-semibold text-destructive",children:["Error ",e.status,": ",e.statusText]}),typeof e.data=="string"?(0,V.jsx)("pre",{className:"text-lg text-muted-foreground whitespace-pre-wrap max-w-4xl text-left",children:e.data}):e.data?.message&&(0,V.jsx)("pre",{className:"text-lg text-muted-foreground whitespace-pre-wrap max-w-4xl text-left",children:e.data.message})]}):e instanceof Error?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)("h2",{className:"text-3xl font-semibold text-destructive",children:"Unexpected Error"}),(0,V.jsx)("pre",{className:"text-lg text-muted-foreground whitespace-pre-wrap max-w-4xl text-left",children:e.message}),e.stack&&(0,V.jsxs)("details",{className:"mt-2 text-sm text-muted-foreground max-w-4xl text-left",children:[(0,V.jsx)("summary",{className:"cursor-pointer underline",children:"Stack Trace"}),(0,V.jsx)("pre",{className:"whitespace-pre-wrap",children:e.stack})]})]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)("h2",{className:"text-3xl font-semibold text-destructive",children:"Unknown Error"}),(0,V.jsx)("pre",{className:"text-lg text-muted-foreground whitespace-pre-wrap max-w-4xl text-left",children:typeof e=="string"?e:JSON.stringify(e,null,2)})]}),(0,V.jsx)(v,{variant:"outline",onClick:()=>t(-1),children:"Go Back"})]})})};var Pe=require("framer-motion");var N=require("react/jsx-runtime");function _a({size:e=100,strokeWidth:t=2,color:o="currentColor",className:n=""}){return(0,N.jsxs)(Pe.motion.svg,{width:e,height:e,viewBox:"0 0 100 100",initial:"hidden",animate:"visible",className:n,children:[(0,N.jsx)("title",{children:"Animated Checkmark"}),(0,N.jsx)(Pe.motion.circle,{cx:"50",cy:"50",r:"40",stroke:o,custom:0,style:{strokeWidth:t,strokeLinecap:"round",fill:"transparent"}}),(0,N.jsx)(Pe.motion.path,{d:"M30 50L45 65L70 35",stroke:o,custom:1,style:{strokeWidth:t,strokeLinecap:"round",strokeLinejoin:"round",fill:"transparent"}})]})}function uo(){return(0,N.jsx)(he,{className:"w-full max-w-sm mx-auto p-6 min-h-[300px] flex flex-col justify-center bg-background",children:(0,N.jsxs)(xe,{className:"space-y-4 flex flex-col items-center justify-center",children:[(0,N.jsx)(Pe.motion.div,{className:"flex justify-center",initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.4,ease:[.4,0,.2,1],scale:{type:"spring",damping:15,stiffness:200}},children:(0,N.jsxs)("div",{className:"relative",children:[(0,N.jsx)(Pe.motion.div,{className:"absolute inset-0 bg-primary/5 rounded-full",initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{delay:.2,duration:.8,ease:"circOut"}}),(0,N.jsx)(_a,{size:80,strokeWidth:4,color:"rgb(16 185 129)",className:"relative z-10 dark:drop-shadow-[0_0_10px_rgba(0,0,0,0.1)]"})]})}),(0,N.jsxs)(Pe.motion.div,{className:"space-y-2 text-center w-full",initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.2,duration:.6,ease:[.4,0,.2,1]},children:[(0,N.jsx)(Pe.motion.h2,{className:"text-lg text-zinc-100 dark:text-zinc-900 tracking-tighter font-semibold uppercase",initial:{opacity:0,y:5},animate:{opacity:1,y:0},transition:{delay:1,duration:.4},children:"Transfer Successful"}),(0,N.jsx)("div",{className:"flex items-center gap-4",children:(0,N.jsx)(Pe.motion.div,{className:"flex-1 bg-zinc-800/50 dark:bg-zinc-50/50 rounded-xl p-3 border border-zinc-700/50 dark:border-zinc-200/50 backdrop-blur-md",initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},transition:{delay:1.2,duration:.4,ease:[.4,0,.2,1]},children:(0,N.jsxs)("div",{className:"flex flex-col items-start gap-2",children:[(0,N.jsxs)("div",{className:"space-y-1.5",children:[(0,N.jsxs)("span",{className:"text-xs font-medium text-secondary-foreground flex items-center gap-1.5",children:[(0,N.jsxs)("svg",{className:"w-3 h-3",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,N.jsx)("title",{children:"From"}),(0,N.jsx)("path",{d:"M12 19V5M5 12l7-7 7 7"})]}),"From"]}),(0,N.jsxs)("div",{className:"flex items-center gap-2.5 group transition-all",children:[(0,N.jsx)("span",{className:"inline-flex items-center justify-center w-7 h-7 rounded-lg bg-zinc-900 dark:bg-white shadow-lg border border-zinc-700 dark:border-zinc-300 text-sm font-medium text-zinc-100 dark:text-zinc-900 group-hover:scale-105 transition-transform",children:"$"}),(0,N.jsx)("span",{className:"font-medium text-zinc-100 dark:text-zinc-900 tracking-tight",children:"500.00 USD"})]})]}),(0,N.jsx)("div",{className:"w-full h-px bg-gradient-to-r from-transparent via-zinc-700 dark:via-zinc-300 to-transparent"}),(0,N.jsxs)("div",{className:"space-y-1.5",children:[(0,N.jsxs)("span",{className:"text-xs font-medium text-secondary-foreground flex items-center gap-1.5",children:[(0,N.jsxs)("svg",{className:"w-3 h-3",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,N.jsx)("title",{children:"To"}),(0,N.jsx)("path",{d:"M12 5v14M5 12l7 7 7-7"})]}),"To"]}),(0,N.jsxs)("div",{className:"flex items-center gap-2.5 group transition-all",children:[(0,N.jsx)("span",{className:"inline-flex items-center justify-center w-7 h-7 rounded-lg bg-zinc-900 dark:bg-white shadow-lg border border-zinc-700 dark:border-zinc-300 text-sm font-medium text-zinc-100 dark:text-zinc-900 group-hover:scale-105 transition-transform",children:"\u20AC"}),(0,N.jsx)("span",{className:"font-medium text-zinc-100 dark:text-zinc-900 tracking-tight",children:"460.00 EUR"})]})]})]})})}),(0,N.jsx)(Pe.motion.div,{className:"w-full text-xs text-secondary-foreground mt-2 text-center",initial:{opacity:0},animate:{opacity:1},transition:{delay:1.4,duration:.4},children:"Exchange Rate: 1 USD = 0.92 EUR"})]})]})})}var et=require("react/jsx-runtime"),go=()=>(0,et.jsx)("div",{className:"rounded-2xl flex justify-center items-center h-full bg-transparent",children:(0,et.jsxs)("div",{className:"flex flex-col items-center space-y-4",children:[(0,et.jsx)("div",{className:"animate-spin rounded-full border-t-4 border-ring h-16 w-16 mb-4"}),(0,et.jsx)("h2",{className:"text-xl font-semibold text-muted-foreground",children:"Loading, please wait..."}),(0,et.jsx)("p",{className:"text-sm text-muted-foreground",children:"Your content is on its way."})]})});var da=require("react-router");var ca=require("lucide-react"),_t=require("react-router"),ge=require("react/jsx-runtime"),fo=()=>{let e=(0,da.useLocation)(),t=(0,_t.useNavigate)(),o=()=>{window.history.length>2?t(-1):t("/")};return(0,ge.jsxs)("div",{className:"rounded-2xl flex flex-col items-center justify-center h-full p-6 text-center bg-sidebar text-muted-foreground select-none",children:[(0,ge.jsx)(ca.GhostIcon,{className:"h-15 w-15 text-destructive mb-4"}),(0,ge.jsx)("h1",{className:"text-2xl font-bold text-destructive mb-2",children:"Page Not Found"}),(0,ge.jsxs)("p",{className:"text-xl mb-4",children:["The page ",(0,ge.jsx)("code",{className:"px-1 py-0.5 rounded bg-muted text-foreground",children:e.pathname})," doesn't exist or has been moved."]}),(0,ge.jsxs)("div",{className:"flex space-x-4",children:[(0,ge.jsx)(v,{variant:"outline",onClick:o,children:"Go Back"}),(0,ge.jsx)(v,{variant:"ghost",children:(0,ge.jsx)(_t.NavLink,{to:"/",children:"Return Home"})})]})]})};var ma=require("lucide-react"),dt=require("react/jsx-runtime"),bo=()=>(0,dt.jsxs)("div",{className:"rounded-2xl flex flex-col items-center justify-center h-screen p-6 text-center text-muted-foreground bg-background select-none",children:[(0,dt.jsx)(ma.WifiOffIcon,{className:"h-15 w-15 text-destructive mb-4"}),(0,dt.jsx)("h1",{className:"text-3xl font-bold text-destructive mb-2",children:"You're offline"}),(0,dt.jsx)("p",{className:"text-xl max-w-md",children:"We couldn't connect to the server."})]});var pa=require("lucide-react");var Gt=require("react-router"),Te=require("react/jsx-runtime"),vo=()=>{let e=(0,Gt.useNavigate)();return(0,Te.jsxs)("div",{className:"rounded-2xl flex flex-col items-center justify-center h-full p-6 text-center bg-sidebar text-muted-foreground select-none",children:[(0,Te.jsx)(pa.ShieldOffIcon,{className:"h-15 w-15 text-destructive mb-4"}),(0,Te.jsx)("h1",{className:"text-2xl font-bold text-destructive mb-2",children:"Access Denied"}),(0,Te.jsx)("p",{className:"text-xl mb-4",children:"You don't have permission to view this page. Please sign in with an authorized account or contact your administrator."}),(0,Te.jsxs)("div",{className:"flex space-x-4",children:[(0,Te.jsx)(v,{variant:"outline",onClick:()=>{window.history.length>2?e(-1):e("/")},children:"Go Back"}),(0,Te.jsx)(v,{variant:"ghost",children:(0,Te.jsx)(Gt.NavLink,{to:"/",children:"Go to Home"})})]})]})};0&&(module.exports={AppMetaProvider,CurrencyTransfer,DataTable,DataTableActionBar,DataTableActionBarAction,DataTableActionBarSelection,DataTemplate,DataTemplateActionBar,DataTemplateActionBarAction,DataTemplateActionBarSelection,ErrorComponent,GeneralHelper,Loader,NotFound,OfflineUI,Unauthorized,createLayoutComponents,createPageTemplateHook,createTypedAppMetaContext});
3491
3
  //# sourceMappingURL=index.cjs.map