@goplusvn/core 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (591) hide show
  1. package/package.json +31 -175
  2. package/src/assets/erp_wallpaper.png +0 -0
  3. package/src/assets/goeat_logo.png +0 -0
  4. package/src/audit/audit-manager.ts +139 -0
  5. package/src/audit/index.ts +11 -0
  6. package/src/audit/memory-audit-logger.ts +86 -0
  7. package/src/audit/types.ts +50 -0
  8. package/src/auth/auth-service.ts +97 -0
  9. package/src/auth/index.ts +266 -0
  10. package/src/code-generation/index.ts +69 -0
  11. package/src/configs/auth-routes.ts +17 -0
  12. package/src/configs/crud.ts +136 -0
  13. package/src/configs/data/navigations.ts +781 -0
  14. package/src/configs/data/oauth-links.ts +10 -0
  15. package/src/configs/entities/material-categories.config.ts +125 -0
  16. package/src/configs/i18n.ts +12 -0
  17. package/src/configs/index.ts +26 -0
  18. package/src/configs/status.ts +25 -0
  19. package/src/configs/themes.ts +100 -0
  20. package/src/crud/components/crud-bulk-actions.tsx +91 -0
  21. package/src/crud/components/crud-card-view.tsx +241 -0
  22. package/src/crud/components/crud-context.tsx +122 -0
  23. package/src/crud/components/crud-delete-dialog.tsx +145 -0
  24. package/src/crud/components/crud-dialog.tsx +406 -0
  25. package/src/crud/components/crud-empty-state.tsx +104 -0
  26. package/src/crud/components/crud-export-button.tsx +170 -0
  27. package/src/crud/components/crud-field-renderer.tsx +653 -0
  28. package/src/crud/components/crud-filter-chips.tsx +102 -0
  29. package/src/crud/components/crud-filters/checkbox-filter.tsx +97 -0
  30. package/src/crud/components/crud-filters/datetime-filter.tsx +83 -0
  31. package/src/crud/components/crud-filters/filter-builder.tsx +66 -0
  32. package/src/crud/components/crud-filters/index.tsx +76 -0
  33. package/src/crud/components/crud-filters/radio-filter.tsx +86 -0
  34. package/src/crud/components/crud-filters/select-filter.tsx +141 -0
  35. package/src/crud/components/crud-filters/text-filter.tsx +86 -0
  36. package/src/crud/components/crud-form.tsx +642 -0
  37. package/src/crud/components/crud-import-dialog.tsx +440 -0
  38. package/src/crud/components/crud-infinite-scroll.tsx +116 -0
  39. package/src/crud/components/crud-page.tsx +1017 -0
  40. package/src/crud/components/crud-provider.tsx +277 -0
  41. package/src/crud/components/crud-row-actions.tsx +189 -0
  42. package/src/crud/components/crud-search.tsx +82 -0
  43. package/src/crud/components/crud-sheet.tsx +336 -0
  44. package/src/crud/components/crud-table-skeleton.tsx +26 -0
  45. package/src/crud/components/crud-table-toolbar.tsx +91 -0
  46. package/src/crud/components/crud-table.tsx +352 -0
  47. package/src/crud/components/crud-virtual-table.tsx +55 -0
  48. package/src/crud/components/index.tsx +20 -0
  49. package/src/crud/crud-filters/checkbox-filter.tsx +87 -0
  50. package/src/crud/crud-filters/datetime-filter.tsx +82 -0
  51. package/src/crud/crud-filters/filter-builder.tsx +64 -0
  52. package/src/crud/crud-filters/index.tsx +78 -0
  53. package/src/crud/crud-filters/radio-filter.tsx +79 -0
  54. package/src/crud/crud-filters/select-filter.tsx +148 -0
  55. package/src/crud/crud-filters/text-filter.tsx +81 -0
  56. package/src/crud/index.ts +43 -0
  57. package/src/crud/lib/crud-service.test.ts +334 -0
  58. package/src/crud/lib/crud-service.ts +358 -0
  59. package/src/crud/lib/crud-utils.test.ts +354 -0
  60. package/src/crud/lib/crud-utils.ts +299 -0
  61. package/src/crud/lib/crud-validator.ts +247 -0
  62. package/src/crud/lib/data-loader.ts +234 -0
  63. package/src/crud/lib/field-calculator.ts +241 -0
  64. package/src/crud/lib/field-formatter.ts +240 -0
  65. package/src/crud/lib/import-export-service.test.ts +290 -0
  66. package/src/crud/lib/import-export-service.ts +352 -0
  67. package/src/crud/lib/import-server-utils.ts +109 -0
  68. package/src/crud/lib/lazy-loader.ts +241 -0
  69. package/src/crud/lib/parse-filters.ts +85 -0
  70. package/src/crud/lib/permissions.ts +52 -0
  71. package/src/crud/lib/serialize-config.ts +60 -0
  72. package/src/crud/lib/stream-loader.ts +145 -0
  73. package/src/crud/lib/translate-config.ts +335 -0
  74. package/src/crud/lib/types.ts +11 -0
  75. package/src/crud/pages/entity-crud-page.tsx +144 -0
  76. package/src/crud/server.ts +8 -0
  77. package/src/home/constants.tsx +142 -0
  78. package/src/home/feature-showcase.tsx +171 -0
  79. package/src/home/home-page.tsx +191 -0
  80. package/src/home/hooks/index.ts +1 -0
  81. package/src/home/hooks/useWidgetPreferences.ts +167 -0
  82. package/src/home/index.ts +33 -0
  83. package/src/home/quick-access-dialog.tsx +271 -0
  84. package/src/home/quick-access-menu.tsx +267 -0
  85. package/src/home/types.ts +140 -0
  86. package/src/home/welcome-card.tsx +92 -0
  87. package/src/home/widget-container.tsx +258 -0
  88. package/src/home/widgets/base-widget.tsx +200 -0
  89. package/src/home/widgets/customers-widget.tsx +74 -0
  90. package/src/home/widgets/index.ts +6 -0
  91. package/src/home/widgets/orders-widget.tsx +87 -0
  92. package/src/home/widgets/revenue-widget.tsx +71 -0
  93. package/src/home/widgets/stock-widget.tsx +109 -0
  94. package/src/hooks/index.tsx +598 -0
  95. package/src/hooks/use-tenant.test.tsx +30 -0
  96. package/src/hooks/use-tenant.ts +5 -0
  97. package/src/index.ts +17 -0
  98. package/src/infrastructure/__tests__/architecture-verification.spec.ts +103 -0
  99. package/src/infrastructure/api-service.ts +317 -0
  100. package/src/infrastructure/cache/cache-manager.ts +107 -0
  101. package/src/infrastructure/cache/cache.ts +120 -0
  102. package/src/infrastructure/cache/index.ts +8 -0
  103. package/src/infrastructure/cache/types.ts +48 -0
  104. package/src/infrastructure/cron/cron-manager.ts +239 -0
  105. package/src/infrastructure/cron/index.ts +6 -0
  106. package/src/infrastructure/cron/types.ts +41 -0
  107. package/src/infrastructure/event-bus/event-bus.ts +145 -0
  108. package/src/infrastructure/event-bus/index.ts +2 -0
  109. package/src/infrastructure/event-bus/types.ts +22 -0
  110. package/src/infrastructure/index.ts +32 -0
  111. package/src/infrastructure/lock/decorators.ts +67 -0
  112. package/src/infrastructure/lock/index.ts +2 -0
  113. package/src/infrastructure/lock/lock-manager.ts +33 -0
  114. package/src/infrastructure/logger/index.ts +2 -0
  115. package/src/infrastructure/logger/logger.ts +96 -0
  116. package/src/infrastructure/logger/types.ts +25 -0
  117. package/src/layout/index.tsx +185 -0
  118. package/src/navigation/index.ts +91 -0
  119. package/src/notification/index.ts +14 -0
  120. package/src/notification/notification-service.ts +120 -0
  121. package/src/notification/storage/in-memory.ts +56 -0
  122. package/src/notification/storage/index.ts +1 -0
  123. package/src/notification/types.ts +51 -0
  124. package/src/organization/branch-service.ts +299 -0
  125. package/src/organization/branches.config.ts +154 -0
  126. package/src/organization/index.ts +5 -0
  127. package/src/plugin/apps-registry.ts +97 -0
  128. package/src/plugin/index.ts +5 -0
  129. package/src/plugin/types.ts +41 -0
  130. package/src/providers/index.tsx +109 -0
  131. package/src/providers/tenant-provider.tsx +45 -0
  132. package/src/rbac/components/roles/role-card.tsx +158 -0
  133. package/src/rbac/components/roles/role-stats-cards.tsx +29 -0
  134. package/src/rbac/components/roles/role-toolbar.tsx +123 -0
  135. package/src/rbac/hooks/use-role-operations.ts +159 -0
  136. package/src/rbac/hooks/use-roles-data.ts +59 -0
  137. package/src/rbac/index.ts +297 -0
  138. package/src/rbac/lib/permission-helpers.ts +63 -0
  139. package/src/rbac/pages/action-list-page.tsx +25 -0
  140. package/src/rbac/pages/resource-list-page.tsx +25 -0
  141. package/src/rbac/pages/role-list-page.tsx +378 -0
  142. package/src/rbac/permission-service.ts +140 -0
  143. package/src/rbac/permissions.ts +135 -0
  144. package/src/rbac/resource-service.ts +115 -0
  145. package/src/rbac/resource-validator.ts +119 -0
  146. package/src/rbac/role-service.ts +165 -0
  147. package/src/rbac/server.ts +16 -0
  148. package/src/rbac/types.ts +38 -0
  149. package/src/schemas/action.schema.ts +66 -0
  150. package/src/schemas/branch.schema.ts +52 -0
  151. package/src/schemas/coming-soon-schema.ts +9 -0
  152. package/src/schemas/company.schema.ts +44 -0
  153. package/src/schemas/forgot-passward-schema.ts +9 -0
  154. package/src/schemas/index.ts +30 -0
  155. package/src/schemas/material-category.schema.ts +43 -0
  156. package/src/schemas/material-pricing.schema.ts +74 -0
  157. package/src/schemas/material.schema.ts +76 -0
  158. package/src/schemas/materials.ts +52 -0
  159. package/src/schemas/new-passward-schema.ts +15 -0
  160. package/src/schemas/partner-company.schema.ts +149 -0
  161. package/src/schemas/register-schema.ts +36 -0
  162. package/src/schemas/resource.schema.ts +133 -0
  163. package/src/schemas/role.schema.ts +11 -0
  164. package/src/schemas/sign-in-schema.ts +24 -0
  165. package/src/schemas/supplier-pricing.schema.ts +15 -0
  166. package/src/schemas/supplier.schema.ts +120 -0
  167. package/src/schemas/system-category-group.schema.ts +67 -0
  168. package/src/schemas/system-category.schema.ts +77 -0
  169. package/src/schemas/system-config.schema.ts +118 -0
  170. package/src/schemas/uom.schema.ts +75 -0
  171. package/src/schemas/user-supplier.schema.ts +179 -0
  172. package/src/schemas/user.schema.ts +18 -0
  173. package/src/schemas/verify-email-schema.ts +9 -0
  174. package/src/schemas/warehouse.schema.ts +49 -0
  175. package/src/system/components/categories/category-list.tsx +529 -0
  176. package/src/system/components/categories/category-manager.tsx +89 -0
  177. package/src/system/components/categories/group-sidebar.tsx +308 -0
  178. package/src/system/components/settings/setting-dialogs.tsx +197 -0
  179. package/src/system/components/settings/setting-field.tsx +291 -0
  180. package/src/system/components/settings/setting-form-dialog.tsx +308 -0
  181. package/src/system/components/settings/settings-groups.ts +80 -0
  182. package/src/system/components/settings/settings-search.tsx +71 -0
  183. package/src/system/components/settings/settings-section.tsx +74 -0
  184. package/src/system/components/settings/settings-sidebar.tsx +81 -0
  185. package/src/system/constants.ts +3 -0
  186. package/src/system/index.ts +150 -0
  187. package/src/system/job-manager.ts +176 -0
  188. package/src/system/pages/components/categories/category-list.tsx +537 -0
  189. package/src/system/pages/components/categories/category-manager.tsx +90 -0
  190. package/src/system/pages/components/categories/group-sidebar.tsx +311 -0
  191. package/src/system/pages/components/settings/sales-rules-settings.tsx +222 -0
  192. package/src/system/pages/components/settings/setting-dialogs.tsx +197 -0
  193. package/src/system/pages/components/settings/setting-field.tsx +292 -0
  194. package/src/system/pages/components/settings/setting-form-dialog.tsx +308 -0
  195. package/src/system/pages/components/settings/settings-groups.ts +87 -0
  196. package/src/system/pages/components/settings/settings-page.tsx +372 -0
  197. package/src/system/pages/components/settings/settings-search.tsx +71 -0
  198. package/src/system/pages/components/settings/settings-section.tsx +74 -0
  199. package/src/system/pages/components/settings/settings-sidebar.tsx +81 -0
  200. package/src/system/pages/components/settings/system-settings.tsx +244 -0
  201. package/src/system/pages/system-category-page.tsx +15 -0
  202. package/src/system/pages/system-settings-page.tsx +380 -0
  203. package/src/system/schemas/system-category-group.schema.ts +46 -0
  204. package/src/system/schemas/system-category.schema.ts +56 -0
  205. package/src/system/services/settings-service.ts +127 -0
  206. package/src/system/services/system-category-service.ts +63 -0
  207. package/src/system/types.ts +45 -0
  208. package/src/types/index.ts +703 -0
  209. package/src/ui/auth/auth-layout.tsx +135 -0
  210. package/src/ui/auth/forgot-password-form.tsx +98 -0
  211. package/src/ui/auth/index.tsx +7 -0
  212. package/src/ui/auth/new-password-form.tsx +107 -0
  213. package/src/ui/auth/oauth-links.tsx +30 -0
  214. package/src/ui/auth/register-form.tsx +202 -0
  215. package/src/ui/auth/sign-in-form.tsx +238 -0
  216. package/src/ui/auth/verify-email-form.tsx +104 -0
  217. package/src/ui/crud/index.tsx +10 -0
  218. package/src/ui/data-display/accordion.tsx +65 -0
  219. package/src/ui/data-display/aspect-ratio.tsx +11 -0
  220. package/src/ui/data-display/avatar.tsx +163 -0
  221. package/src/ui/data-display/bento-grid.tsx +77 -0
  222. package/src/ui/data-display/carousel.tsx +249 -0
  223. package/src/ui/data-display/chart.tsx +363 -0
  224. package/src/ui/data-display/code-block-highlight.tsx +54 -0
  225. package/src/ui/data-display/collapsible.tsx +42 -0
  226. package/src/ui/data-display/compact-stat-bar.tsx +149 -0
  227. package/src/ui/data-display/data-table/data-table-context.tsx +255 -0
  228. package/src/ui/data-display/data-table/data-table-empty-state.tsx +133 -0
  229. package/src/ui/data-display/data-table/data-table-skeleton.tsx +145 -0
  230. package/src/ui/data-display/data-table/data-table-toolbar.tsx +353 -0
  231. package/src/ui/data-display/data-table/data-table.tsx +597 -0
  232. package/src/ui/data-display/data-table/index.ts +44 -0
  233. package/src/ui/data-display/data-table-column-header.tsx +75 -0
  234. package/src/ui/data-display/data-table-pagination.tsx +130 -0
  235. package/src/ui/data-display/data-table-view-options.tsx +59 -0
  236. package/src/ui/data-display/formatted-number-input.tsx +210 -0
  237. package/src/ui/data-display/highlight.tsx +20 -0
  238. package/src/ui/data-display/hover-card.tsx +48 -0
  239. package/src/ui/data-display/index.tsx +50 -0
  240. package/src/ui/data-display/iphone-15-pro.tsx +114 -0
  241. package/src/ui/data-display/kanban/index.ts +4 -0
  242. package/src/ui/data-display/kanban/kanban-board.tsx +192 -0
  243. package/src/ui/data-display/kanban/kanban-column.tsx +74 -0
  244. package/src/ui/data-display/kanban/kanban-item.tsx +50 -0
  245. package/src/ui/data-display/kanban/kanban-types.ts +21 -0
  246. package/src/ui/data-display/kpi-card.tsx +68 -0
  247. package/src/ui/data-display/media-grid.tsx +110 -0
  248. package/src/ui/data-display/safari.tsx +175 -0
  249. package/src/ui/data-display/show-more-text.tsx +55 -0
  250. package/src/ui/data-display/tabs.tsx +68 -0
  251. package/src/ui/data-display/timeline.tsx +256 -0
  252. package/src/ui/feedback/alert.tsx +60 -0
  253. package/src/ui/feedback/context-menu.tsx +245 -0
  254. package/src/ui/feedback/drawer.tsx +132 -0
  255. package/src/ui/feedback/error-dialog.tsx +273 -0
  256. package/src/ui/feedback/index.tsx +183 -0
  257. package/src/ui/feedback/progress.tsx +32 -0
  258. package/src/ui/feedback/sheet.tsx +148 -0
  259. package/src/ui/feedback/sonner.tsx +36 -0
  260. package/src/ui/forms/command.tsx +157 -0
  261. package/src/ui/forms/date-picker.tsx +73 -0
  262. package/src/ui/forms/date-range-picker.tsx +76 -0
  263. package/src/ui/forms/date-time-picker.tsx +109 -0
  264. package/src/ui/forms/editor/editor-menu-bar.tsx +394 -0
  265. package/src/ui/forms/editor/index.tsx +130 -0
  266. package/src/ui/forms/editor/multi-select-example.tsx +1234 -0
  267. package/src/ui/forms/emoji-picker.tsx +109 -0
  268. package/src/ui/forms/file-dropzone.tsx +169 -0
  269. package/src/ui/forms/file-thumbnail.tsx +29 -0
  270. package/src/ui/forms/index.tsx +201 -0
  271. package/src/ui/forms/input-file.tsx +99 -0
  272. package/src/ui/forms/input-group.tsx +46 -0
  273. package/src/ui/forms/input-otp.tsx +81 -0
  274. package/src/ui/forms/input-phone.tsx +172 -0
  275. package/src/ui/forms/input-spin.tsx +116 -0
  276. package/src/ui/forms/input-tags.tsx +219 -0
  277. package/src/ui/forms/input-time.tsx +42 -0
  278. package/src/ui/forms/multi-select.tsx +629 -0
  279. package/src/ui/forms/multiple-date-picker.tsx +74 -0
  280. package/src/ui/forms/radio-group.tsx +42 -0
  281. package/src/ui/forms/rating.tsx +158 -0
  282. package/src/ui/forms/time-picker.tsx +57 -0
  283. package/src/ui/index.tsx +17 -0
  284. package/src/ui/layout/animated-list.tsx +77 -0
  285. package/src/ui/layout/animated-sidebar.tsx +294 -0
  286. package/src/ui/layout/command-menu.tsx +355 -0
  287. package/src/ui/layout/customizer.tsx +324 -0
  288. package/src/ui/layout/footer.tsx +43 -0
  289. package/src/ui/layout/full-screen-toggle.tsx +52 -0
  290. package/src/ui/layout/header-breadcrumb.tsx +77 -0
  291. package/src/ui/layout/horizontal-layout-header.tsx +83 -0
  292. package/src/ui/layout/horizontal-layout.tsx +50 -0
  293. package/src/ui/layout/index.tsx +25 -0
  294. package/src/ui/layout/language-dropdown.tsx +103 -0
  295. package/src/ui/layout/logo.tsx +63 -0
  296. package/src/ui/layout/main-layout.tsx +57 -0
  297. package/src/ui/layout/mode-dropdown.tsx +58 -0
  298. package/src/ui/layout/notification-dropdown.tsx +127 -0
  299. package/src/ui/layout/page-tabs.tsx +306 -0
  300. package/src/ui/layout/route-cache.tsx +214 -0
  301. package/src/ui/layout/sidebar-group-icon-menu.tsx +195 -0
  302. package/src/ui/layout/sidebar.tsx +279 -0
  303. package/src/ui/layout/tab-content-cache.tsx +201 -0
  304. package/src/ui/layout/tab-navigation-provider.tsx +536 -0
  305. package/src/ui/layout/toggle-mobile-sidebar.tsx +33 -0
  306. package/src/ui/layout/top-bar-header-menubar.tsx +412 -0
  307. package/src/ui/layout/user-dropdown.tsx +188 -0
  308. package/src/ui/layout/vertical-layout-header.tsx +65 -0
  309. package/src/ui/layout/vertical-layout.tsx +47 -0
  310. package/src/ui/management/audit-log-page.tsx +209 -0
  311. package/src/ui/management/cache-management.tsx +349 -0
  312. package/src/ui/management/index.ts +3 -0
  313. package/src/ui/management/job-management.tsx +308 -0
  314. package/src/ui/pages/not-found.tsx +30 -0
  315. package/src/ui/primitives/badge.tsx +66 -0
  316. package/src/ui/primitives/breadcrumb.tsx +103 -0
  317. package/src/ui/primitives/button.tsx +129 -0
  318. package/src/ui/primitives/calendar.tsx +74 -0
  319. package/src/ui/primitives/card.tsx +86 -0
  320. package/src/ui/primitives/checkbox.tsx +31 -0
  321. package/src/ui/primitives/client.ts +30 -0
  322. package/src/ui/primitives/combobox.tsx +290 -0
  323. package/src/ui/primitives/dialog.tsx +121 -0
  324. package/src/ui/primitives/dropdown-menu.tsx +239 -0
  325. package/src/ui/primitives/dynamic-icon.tsx +24 -0
  326. package/src/ui/primitives/index.tsx +134 -0
  327. package/src/ui/primitives/input-number.tsx +131 -0
  328. package/src/ui/primitives/input.tsx +22 -0
  329. package/src/ui/primitives/keyboard.tsx +23 -0
  330. package/src/ui/primitives/label.tsx +24 -0
  331. package/src/ui/primitives/menubar.tsx +262 -0
  332. package/src/ui/primitives/navigation-menu.tsx +157 -0
  333. package/src/ui/primitives/pagination.tsx +118 -0
  334. package/src/ui/primitives/popover.tsx +56 -0
  335. package/src/ui/primitives/prefetch-link.tsx +60 -0
  336. package/src/ui/primitives/resizable.tsx +59 -0
  337. package/src/ui/primitives/scroll-area.tsx +63 -0
  338. package/src/ui/primitives/select.tsx +172 -0
  339. package/src/ui/primitives/separator.tsx +51 -0
  340. package/src/ui/primitives/sidebar.tsx +844 -0
  341. package/src/ui/primitives/slider.tsx +27 -0
  342. package/src/ui/primitives/status-badge.tsx +47 -0
  343. package/src/ui/primitives/sticky-layout.tsx +50 -0
  344. package/src/ui/primitives/switch.tsx +29 -0
  345. package/src/ui/primitives/table.tsx +116 -0
  346. package/src/ui/primitives/tabs.tsx +55 -0
  347. package/src/ui/primitives/toggle-group.tsx +70 -0
  348. package/src/ui/primitives/toggle.tsx +47 -0
  349. package/src/ui/primitives/tooltip.tsx +59 -0
  350. package/src/user/components/dangerous-zone.tsx +34 -0
  351. package/src/user/components/delete-account-form.tsx +40 -0
  352. package/src/user/components/index.ts +4 -0
  353. package/src/user/components/profile-info-form.tsx +390 -0
  354. package/src/user/components/profile-info.tsx +32 -0
  355. package/src/user/components/unified-profile-dialog.tsx +1019 -0
  356. package/src/user/components/user-stats.tsx +27 -0
  357. package/src/user/components/user-toolbar.tsx +137 -0
  358. package/src/user/components/users-card-view.tsx +253 -0
  359. package/src/user/index.ts +11 -0
  360. package/src/user/pages/user-list-page.tsx +234 -0
  361. package/src/user/pages/users-client-page.tsx +385 -0
  362. package/src/user/profile-page.tsx +19 -0
  363. package/src/user/schemas.ts +68 -0
  364. package/src/user/types.ts +34 -0
  365. package/src/user/user-service.ts +538 -0
  366. package/src/utils/index.ts +906 -0
  367. package/src/workflow/activity-timeline.tsx +412 -0
  368. package/src/workflow/approval-workflow.tsx +31 -0
  369. package/src/workflow/index.ts +2 -0
  370. package/dist/audit/index.d.mts +0 -115
  371. package/dist/audit/index.d.ts +0 -115
  372. package/dist/audit/index.js +0 -204
  373. package/dist/audit/index.js.map +0 -1
  374. package/dist/audit/index.mjs +0 -200
  375. package/dist/audit/index.mjs.map +0 -1
  376. package/dist/auth/index.d.mts +0 -86
  377. package/dist/auth/index.d.ts +0 -86
  378. package/dist/auth/index.js +0 -210
  379. package/dist/auth/index.js.map +0 -1
  380. package/dist/auth/index.mjs +0 -198
  381. package/dist/auth/index.mjs.map +0 -1
  382. package/dist/button-1dWvP9Ib.d.mts +0 -30
  383. package/dist/button-1dWvP9Ib.d.ts +0 -30
  384. package/dist/calendar-2QzdEo1z.d.mts +0 -20
  385. package/dist/calendar-2QzdEo1z.d.ts +0 -20
  386. package/dist/code-generation/index.d.mts +0 -30
  387. package/dist/code-generation/index.d.ts +0 -30
  388. package/dist/code-generation/index.js +0 -31
  389. package/dist/code-generation/index.js.map +0 -1
  390. package/dist/code-generation/index.mjs +0 -28
  391. package/dist/code-generation/index.mjs.map +0 -1
  392. package/dist/configs/index.d.mts +0 -175
  393. package/dist/configs/index.d.ts +0 -175
  394. package/dist/configs/index.js +0 -254
  395. package/dist/configs/index.js.map +0 -1
  396. package/dist/configs/index.mjs +0 -233
  397. package/dist/configs/index.mjs.map +0 -1
  398. package/dist/crud/index.d.mts +0 -646
  399. package/dist/crud/index.d.ts +0 -646
  400. package/dist/crud/index.js +0 -11772
  401. package/dist/crud/index.js.map +0 -1
  402. package/dist/crud/index.mjs +0 -11665
  403. package/dist/crud/index.mjs.map +0 -1
  404. package/dist/crud/server.d.mts +0 -20
  405. package/dist/crud/server.d.ts +0 -20
  406. package/dist/crud/server.js +0 -123
  407. package/dist/crud/server.js.map +0 -1
  408. package/dist/crud/server.mjs +0 -120
  409. package/dist/crud/server.mjs.map +0 -1
  410. package/dist/data-table-skeleton-12NA8Mjx.d.mts +0 -39
  411. package/dist/data-table-skeleton-12NA8Mjx.d.ts +0 -39
  412. package/dist/dialog-bKfjZMTd.d.mts +0 -22
  413. package/dist/dialog-bKfjZMTd.d.ts +0 -22
  414. package/dist/dynamic-icon-DrGIiu2N.d.mts +0 -10
  415. package/dist/dynamic-icon-DrGIiu2N.d.ts +0 -10
  416. package/dist/home/index.d.mts +0 -269
  417. package/dist/home/index.d.ts +0 -269
  418. package/dist/home/index.js +0 -1678
  419. package/dist/home/index.js.map +0 -1
  420. package/dist/home/index.mjs +0 -1635
  421. package/dist/home/index.mjs.map +0 -1
  422. package/dist/hooks/index.d.mts +0 -7
  423. package/dist/hooks/index.d.ts +0 -7
  424. package/dist/hooks/index.js +0 -8316
  425. package/dist/hooks/index.js.map +0 -1
  426. package/dist/hooks/index.mjs +0 -8255
  427. package/dist/hooks/index.mjs.map +0 -1
  428. package/dist/index-50hpiPrV.d.ts +0 -116
  429. package/dist/index-B9zQVEVi.d.mts +0 -116
  430. package/dist/index.d.mts +0 -5
  431. package/dist/index.d.ts +0 -5
  432. package/dist/index.js +0 -123
  433. package/dist/index.js.map +0 -1
  434. package/dist/index.mjs +0 -118
  435. package/dist/index.mjs.map +0 -1
  436. package/dist/infrastructure/index.d.mts +0 -423
  437. package/dist/infrastructure/index.d.ts +0 -423
  438. package/dist/infrastructure/index.js +0 -633
  439. package/dist/infrastructure/index.js.map +0 -1
  440. package/dist/infrastructure/index.mjs +0 -619
  441. package/dist/infrastructure/index.mjs.map +0 -1
  442. package/dist/label-DWTEkNPo.d.ts +0 -226
  443. package/dist/label-LPpdcoBx.d.mts +0 -226
  444. package/dist/layout/index.d.mts +0 -48
  445. package/dist/layout/index.d.ts +0 -48
  446. package/dist/layout/index.js +0 -117
  447. package/dist/layout/index.js.map +0 -1
  448. package/dist/layout/index.mjs +0 -90
  449. package/dist/layout/index.mjs.map +0 -1
  450. package/dist/navigation/index.d.mts +0 -16
  451. package/dist/navigation/index.d.ts +0 -16
  452. package/dist/navigation/index.js +0 -53
  453. package/dist/navigation/index.js.map +0 -1
  454. package/dist/navigation/index.mjs +0 -50
  455. package/dist/navigation/index.mjs.map +0 -1
  456. package/dist/notification/index.d.mts +0 -105
  457. package/dist/notification/index.d.ts +0 -105
  458. package/dist/notification/index.js +0 -278
  459. package/dist/notification/index.js.map +0 -1
  460. package/dist/notification/index.mjs +0 -274
  461. package/dist/notification/index.mjs.map +0 -1
  462. package/dist/organization/index.d.mts +0 -99
  463. package/dist/organization/index.d.ts +0 -99
  464. package/dist/organization/index.js +0 -360
  465. package/dist/organization/index.js.map +0 -1
  466. package/dist/organization/index.mjs +0 -352
  467. package/dist/organization/index.mjs.map +0 -1
  468. package/dist/plugin/index.d.mts +0 -83
  469. package/dist/plugin/index.d.ts +0 -83
  470. package/dist/plugin/index.js +0 -86
  471. package/dist/plugin/index.js.map +0 -1
  472. package/dist/plugin/index.mjs +0 -84
  473. package/dist/plugin/index.mjs.map +0 -1
  474. package/dist/providers/index.d.mts +0 -25
  475. package/dist/providers/index.d.ts +0 -25
  476. package/dist/providers/index.js +0 -84
  477. package/dist/providers/index.js.map +0 -1
  478. package/dist/providers/index.mjs +0 -77
  479. package/dist/providers/index.mjs.map +0 -1
  480. package/dist/rbac/index.d.mts +0 -226
  481. package/dist/rbac/index.d.ts +0 -226
  482. package/dist/rbac/index.js +0 -4784
  483. package/dist/rbac/index.js.map +0 -1
  484. package/dist/rbac/index.mjs +0 -4722
  485. package/dist/rbac/index.mjs.map +0 -1
  486. package/dist/rbac/permissions.d.mts +0 -26
  487. package/dist/rbac/permissions.d.ts +0 -26
  488. package/dist/rbac/permissions.js +0 -94
  489. package/dist/rbac/permissions.js.map +0 -1
  490. package/dist/rbac/permissions.mjs +0 -90
  491. package/dist/rbac/permissions.mjs.map +0 -1
  492. package/dist/rbac/server.d.mts +0 -1
  493. package/dist/rbac/server.d.ts +0 -1
  494. package/dist/rbac/server.js +0 -128
  495. package/dist/rbac/server.js.map +0 -1
  496. package/dist/rbac/server.mjs +0 -124
  497. package/dist/rbac/server.mjs.map +0 -1
  498. package/dist/schemas/index.d.mts +0 -1257
  499. package/dist/schemas/index.d.ts +0 -1257
  500. package/dist/schemas/index.js +0 -572
  501. package/dist/schemas/index.js.map +0 -1
  502. package/dist/schemas/index.mjs +0 -523
  503. package/dist/schemas/index.mjs.map +0 -1
  504. package/dist/server-QuYCTa89.d.mts +0 -83
  505. package/dist/server-QuYCTa89.d.ts +0 -83
  506. package/dist/sonner-C74GlRDQ.d.mts +0 -71
  507. package/dist/sonner-C74GlRDQ.d.ts +0 -71
  508. package/dist/status-BOXZgIqX.d.mts +0 -12
  509. package/dist/status-BOXZgIqX.d.ts +0 -12
  510. package/dist/system/index.d.mts +0 -77
  511. package/dist/system/index.d.ts +0 -77
  512. package/dist/system/index.js +0 -102
  513. package/dist/system/index.js.map +0 -1
  514. package/dist/system/index.mjs +0 -100
  515. package/dist/system/index.mjs.map +0 -1
  516. package/dist/tabs-C6FfBwPY.d.mts +0 -18
  517. package/dist/tabs-C6FfBwPY.d.ts +0 -18
  518. package/dist/tenant-provider-B8eC_Wpb.d.mts +0 -27
  519. package/dist/tenant-provider-B8eC_Wpb.d.ts +0 -27
  520. package/dist/types/index.d.mts +0 -469
  521. package/dist/types/index.d.ts +0 -469
  522. package/dist/types/index.js +0 -25
  523. package/dist/types/index.js.map +0 -1
  524. package/dist/types/index.mjs +0 -21
  525. package/dist/types/index.mjs.map +0 -1
  526. package/dist/ui/auth.d.mts +0 -39
  527. package/dist/ui/auth.d.ts +0 -39
  528. package/dist/ui/auth.js +0 -4941
  529. package/dist/ui/auth.js.map +0 -1
  530. package/dist/ui/auth.mjs +0 -4896
  531. package/dist/ui/auth.mjs.map +0 -1
  532. package/dist/ui/crud.d.mts +0 -2
  533. package/dist/ui/crud.d.ts +0 -2
  534. package/dist/ui/crud.js +0 -4
  535. package/dist/ui/crud.js.map +0 -1
  536. package/dist/ui/crud.mjs +0 -3
  537. package/dist/ui/crud.mjs.map +0 -1
  538. package/dist/ui/data-display.d.mts +0 -596
  539. package/dist/ui/data-display.d.ts +0 -596
  540. package/dist/ui/data-display.js +0 -5307
  541. package/dist/ui/data-display.js.map +0 -1
  542. package/dist/ui/data-display.mjs +0 -5212
  543. package/dist/ui/data-display.mjs.map +0 -1
  544. package/dist/ui/feedback.d.mts +0 -55
  545. package/dist/ui/feedback.d.ts +0 -55
  546. package/dist/ui/feedback.js +0 -2608
  547. package/dist/ui/feedback.js.map +0 -1
  548. package/dist/ui/feedback.mjs +0 -2526
  549. package/dist/ui/feedback.mjs.map +0 -1
  550. package/dist/ui/forms.d.mts +0 -309
  551. package/dist/ui/forms.d.ts +0 -309
  552. package/dist/ui/forms.js +0 -4656
  553. package/dist/ui/forms.js.map +0 -1
  554. package/dist/ui/forms.mjs +0 -4571
  555. package/dist/ui/forms.mjs.map +0 -1
  556. package/dist/ui/index.d.mts +0 -331
  557. package/dist/ui/index.d.ts +0 -331
  558. package/dist/ui/index.js +0 -16953
  559. package/dist/ui/index.js.map +0 -1
  560. package/dist/ui/index.mjs +0 -16598
  561. package/dist/ui/index.mjs.map +0 -1
  562. package/dist/ui/primitives/client.d.mts +0 -61
  563. package/dist/ui/primitives/client.d.ts +0 -61
  564. package/dist/ui/primitives/client.js +0 -3408
  565. package/dist/ui/primitives/client.js.map +0 -1
  566. package/dist/ui/primitives/client.mjs +0 -3256
  567. package/dist/ui/primitives/client.mjs.map +0 -1
  568. package/dist/ui/primitives.d.mts +0 -113
  569. package/dist/ui/primitives.d.ts +0 -113
  570. package/dist/ui/primitives.js +0 -3356
  571. package/dist/ui/primitives.js.map +0 -1
  572. package/dist/ui/primitives.mjs +0 -3227
  573. package/dist/ui/primitives.mjs.map +0 -1
  574. package/dist/user/index.d.mts +0 -228
  575. package/dist/user/index.d.ts +0 -228
  576. package/dist/user/index.js +0 -4306
  577. package/dist/user/index.js.map +0 -1
  578. package/dist/user/index.mjs +0 -4260
  579. package/dist/user/index.mjs.map +0 -1
  580. package/dist/utils/index.d.mts +0 -205
  581. package/dist/utils/index.d.ts +0 -205
  582. package/dist/utils/index.js +0 -574
  583. package/dist/utils/index.js.map +0 -1
  584. package/dist/utils/index.mjs +0 -514
  585. package/dist/utils/index.mjs.map +0 -1
  586. package/dist/workflow/index.d.mts +0 -40
  587. package/dist/workflow/index.d.ts +0 -40
  588. package/dist/workflow/index.js +0 -3710
  589. package/dist/workflow/index.js.map +0 -1
  590. package/dist/workflow/index.mjs +0 -3677
  591. package/dist/workflow/index.mjs.map +0 -1
@@ -1,4260 +0,0 @@
1
- import { clsx } from 'clsx';
2
- import { twMerge } from 'tailwind-merge';
3
- import * as React12 from 'react';
4
- import { useState, createContext, useId, useRef, useCallback, useEffect, useMemo, memo, useContext } from 'react';
5
- import { cva } from 'class-variance-authority';
6
- import { Slot } from '@radix-ui/react-slot';
7
- import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
8
- import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
9
- import { ChevronDown, Check, X, PanelLeft, ChevronsUpDown, Search, ChevronUp } from 'lucide-react';
10
- import '@radix-ui/react-dropdown-menu';
11
- import * as DialogPrimitive from '@radix-ui/react-dialog';
12
- import * as TabsPrimitive from '@radix-ui/react-tabs';
13
- import 'next/link';
14
- import 'next/navigation';
15
- import 'next/image';
16
- import 'react-day-picker';
17
- import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
18
- import * as SelectPrimitive from '@radix-ui/react-select';
19
- import '@radix-ui/react-popover';
20
- import '@radix-ui/react-switch';
21
- import * as LabelPrimitive from '@radix-ui/react-label';
22
- import * as TooltipPrimitive from '@radix-ui/react-tooltip';
23
- import 'react-resizable-panels';
24
- import '@radix-ui/react-slider';
25
- import '@radix-ui/react-toggle';
26
- import '@radix-ui/react-toggle-group';
27
- import '@radix-ui/react-menubar';
28
- import '@radix-ui/react-navigation-menu';
29
- import '@radix-ui/react-context-menu';
30
- import 'vaul';
31
- import '@radix-ui/react-progress';
32
- import 'sonner';
33
- import 'framer-motion';
34
- import * as AvatarPrimitive from '@radix-ui/react-avatar';
35
- import 'next-auth/react';
36
- import 'react-use';
37
- import '@radix-ui/react-direction';
38
- import '@radix-ui/react-alert-dialog';
39
- import '@radix-ui/react-radio-group';
40
- import 'cmdk';
41
- import 'date-fns';
42
- import dynamic from 'next/dynamic';
43
- import 'emoji-picker-react';
44
- import 'react-dropzone';
45
- import 'input-otp';
46
- import 'react-phone-number-input';
47
- import '@tiptap/extension-color';
48
- import '@tiptap/extension-image';
49
- import '@tiptap/extension-link';
50
- import '@tiptap/extension-placeholder';
51
- import '@tiptap/extension-text-align';
52
- import '@tiptap/extension-text-style';
53
- import '@tiptap/extension-typography';
54
- import '@tiptap/extension-underline';
55
- import '@tiptap/react';
56
- import '@tiptap/starter-kit';
57
- import { useForm, FormProvider, Controller, useFormContext } from 'react-hook-form';
58
- import 'recharts';
59
- import 'embla-carousel-react';
60
- import '@radix-ui/react-accordion';
61
- import '@dnd-kit/sortable';
62
- import '@dnd-kit/utilities';
63
- import '@dnd-kit/core';
64
- import 'react-dom';
65
- import '@radix-ui/react-aspect-ratio';
66
- import 'hast-util-to-jsx-runtime';
67
- import 'shiki/bundle/web';
68
- import '@radix-ui/react-collapsible';
69
- import '@radix-ui/react-hover-card';
70
- import { zodResolver } from '@hookform/resolvers/zod';
71
- import { z } from 'zod';
72
-
73
- var __getOwnPropNames = Object.getOwnPropertyNames;
74
- var __esm = (fn, res) => function __init() {
75
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
76
- };
77
- function cn(...inputs) {
78
- return twMerge(clsx(inputs));
79
- }
80
- function getInitials(fullName) {
81
- if (fullName.length === 0) return "";
82
- const names = fullName.split(" ");
83
- const initials = names.map((name) => name.charAt(0).toUpperCase()).join("");
84
- return initials;
85
- }
86
- function formatFileSize(bytes, decimals = 2) {
87
- const k = 1e3;
88
- const dm = decimals < 0 ? 0 : decimals;
89
- const sizes = ["Bytes", "KB", "MB", "GB", "TB", "PB"];
90
- const i = Math.floor(Math.log(bytes) / Math.log(k));
91
- return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + " " + sizes[i];
92
- }
93
- var Logger;
94
- var init_utils = __esm({
95
- "src/utils/index.ts"() {
96
- Logger = class {
97
- log(level, message, context, error) {
98
- const entry = {
99
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
100
- level,
101
- message,
102
- context
103
- };
104
- if (error instanceof Error) {
105
- entry.error = {
106
- name: error.name,
107
- message: error.message,
108
- stack: error.stack
109
- };
110
- } else if (error) {
111
- entry.error = error;
112
- }
113
- const logString = JSON.stringify(entry);
114
- switch (level) {
115
- case "error":
116
- console.error(logString);
117
- break;
118
- case "warn":
119
- console.warn(logString);
120
- break;
121
- case "debug":
122
- if (process.env.NODE_ENV === "development") console.debug(logString);
123
- break;
124
- default:
125
- console.log(logString);
126
- }
127
- }
128
- info(message, context) {
129
- this.log("info", message, context);
130
- }
131
- warn(message, context) {
132
- this.log("warn", message, context);
133
- }
134
- error(message, error, context) {
135
- this.log("error", message, context, error);
136
- }
137
- debug(message, context) {
138
- this.log("debug", message, context);
139
- }
140
- };
141
- new Logger();
142
- }
143
- });
144
- var buttonVariants, Button;
145
- var init_button = __esm({
146
- "src/ui/primitives/button.tsx"() {
147
- init_utils();
148
- buttonVariants = cva(
149
- "inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
150
- {
151
- variants: {
152
- variant: {
153
- // Existing variants (backwards-compatible)
154
- default: "bg-primary text-primary-foreground hover:bg-primary/90",
155
- destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
156
- outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
157
- secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
158
- ghost: "hover:bg-accent hover:text-accent-foreground",
159
- link: "text-primary underline-offset-4 hover:underline",
160
- // New Plane-inspired variants using semantic tokens
161
- accent: "bg-accent-primary text-text-on-color hover:bg-accent-primary-hover active:bg-accent-primary-active disabled:bg-layer-disabled disabled:text-text-disabled",
162
- danger: "bg-danger text-text-on-color hover:bg-danger-hover active:bg-danger-hover disabled:bg-layer-disabled disabled:text-text-disabled",
163
- "danger-outline": "border border-danger bg-layer-2 text-danger-text hover:bg-danger-subtle active:bg-danger-subtle disabled:border-border-subtle disabled:bg-layer-2 disabled:text-text-disabled",
164
- success: "bg-success-semantic text-text-on-color hover:bg-success-semantic/90 active:bg-success-semantic/80 disabled:bg-layer-disabled disabled:text-text-disabled",
165
- tertiary: "bg-layer-3 text-text-secondary hover:bg-layer-3-hover active:bg-layer-3-hover disabled:bg-transparent disabled:text-text-disabled"
166
- },
167
- size: {
168
- // Existing sizes (backwards-compatible)
169
- default: "h-10 px-4 py-2",
170
- sm: "h-9 rounded-md px-3",
171
- lg: "h-11 rounded-md px-8",
172
- icon: "h-10 w-10",
173
- // New ERP-specific compact sizes
174
- xs: "h-7 rounded-sm px-2 text-xs",
175
- compact: "h-8 rounded-md px-3 text-xs",
176
- "icon-sm": "h-8 w-8",
177
- "icon-xs": "h-7 w-7"
178
- }
179
- },
180
- defaultVariants: {
181
- variant: "default",
182
- size: "default"
183
- }
184
- }
185
- );
186
- Button = React12.forwardRef(
187
- ({ className, variant, size, asChild = false, loading = false, prependIcon, appendIcon, children, disabled, ...props }, ref) => {
188
- if (asChild) {
189
- return /* @__PURE__ */ jsx(
190
- Slot,
191
- {
192
- className: cn(buttonVariants({ variant, size }), className),
193
- ref,
194
- ...{ disabled: disabled || loading },
195
- ...props,
196
- children: React12.isValidElement(children) && (prependIcon || appendIcon) ? React12.cloneElement(children, {}, /* @__PURE__ */ jsxs(Fragment, { children: [
197
- prependIcon && React12.cloneElement(prependIcon, {
198
- className: cn("shrink-0", size === "xs" || size === "compact" ? "size-3.5" : "size-4")
199
- }),
200
- children.props.children,
201
- appendIcon && React12.cloneElement(appendIcon, {
202
- className: cn("shrink-0", size === "xs" || size === "compact" ? "size-3.5" : "size-4")
203
- })
204
- ] })) : children
205
- }
206
- );
207
- }
208
- return /* @__PURE__ */ jsxs(
209
- "button",
210
- {
211
- className: cn(buttonVariants({ variant, size }), className),
212
- ref,
213
- disabled: disabled || loading,
214
- ...props,
215
- children: [
216
- prependIcon && React12.cloneElement(prependIcon, {
217
- className: cn("shrink-0", size === "xs" || size === "compact" ? "size-3.5" : "size-4")
218
- }),
219
- children,
220
- appendIcon && React12.cloneElement(appendIcon, {
221
- className: cn("shrink-0", size === "xs" || size === "compact" ? "size-3.5" : "size-4")
222
- })
223
- ]
224
- }
225
- );
226
- }
227
- );
228
- Button.displayName = "Button";
229
- }
230
- });
231
- function Badge({ className, variant, size, ...props }) {
232
- return /* @__PURE__ */ jsx("div", { className: cn(badgeVariants({ variant, size }), className), ...props });
233
- }
234
- var badgeVariants;
235
- var init_badge = __esm({
236
- "src/ui/primitives/badge.tsx"() {
237
- init_utils();
238
- badgeVariants = cva(
239
- "inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
240
- {
241
- variants: {
242
- variant: {
243
- // Existing variants (backwards-compatible)
244
- default: "border-transparent bg-primary text-primary-foreground",
245
- secondary: "border-transparent bg-secondary text-secondary-foreground",
246
- destructive: "border-transparent bg-destructive text-destructive-foreground",
247
- outline: "text-foreground",
248
- // Enhanced semantic variants (using Design Tokens)
249
- success: "border-transparent bg-success-subtle text-success-text",
250
- warning: "border-transparent bg-warning-subtle text-warning-text",
251
- danger: "border-transparent bg-danger-subtle text-danger-text",
252
- info: "border-transparent bg-info-subtle text-info-text",
253
- accent: "border-transparent bg-accent-primary-subtle text-accent-primary"
254
- },
255
- size: {
256
- default: "",
257
- sm: "px-1.5 py-0 text-[10px]",
258
- lg: "px-3 py-1 text-sm"
259
- }
260
- },
261
- defaultVariants: {
262
- variant: "default",
263
- size: "default"
264
- }
265
- }
266
- );
267
- }
268
- });
269
- var Input;
270
- var init_input = __esm({
271
- "src/ui/primitives/input.tsx"() {
272
- init_utils();
273
- Input = React12.forwardRef(
274
- ({ className, type, ...props }, ref) => {
275
- return /* @__PURE__ */ jsx(
276
- "input",
277
- {
278
- type,
279
- className: cn(
280
- "flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
281
- className
282
- ),
283
- ref,
284
- ...props
285
- }
286
- );
287
- }
288
- );
289
- Input.displayName = "Input";
290
- }
291
- });
292
- var Checkbox;
293
- var init_checkbox = __esm({
294
- "src/ui/primitives/checkbox.tsx"() {
295
- "use client";
296
- init_utils();
297
- Checkbox = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
298
- CheckboxPrimitive.Root,
299
- {
300
- ref,
301
- className: cn(
302
- "peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
303
- className
304
- ),
305
- ...props,
306
- children: /* @__PURE__ */ jsx(
307
- CheckboxPrimitive.Indicator,
308
- {
309
- className: cn("flex items-center justify-center text-current"),
310
- children: /* @__PURE__ */ jsx(Check, { className: "h-4 w-4" })
311
- }
312
- )
313
- }
314
- ));
315
- Checkbox.displayName = CheckboxPrimitive.Root.displayName;
316
- }
317
- });
318
- var Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter;
319
- var init_card = __esm({
320
- "src/ui/primitives/card.tsx"() {
321
- init_utils();
322
- Card = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
323
- "div",
324
- {
325
- ref,
326
- className: cn(
327
- "rounded-lg border bg-card text-card-foreground shadow-sm",
328
- className
329
- ),
330
- ...props
331
- }
332
- ));
333
- Card.displayName = "Card";
334
- CardHeader = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
335
- "div",
336
- {
337
- ref,
338
- className: cn("flex flex-col space-y-1.5 p-6", className),
339
- ...props
340
- }
341
- ));
342
- CardHeader.displayName = "CardHeader";
343
- CardTitle = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
344
- "h3",
345
- {
346
- ref,
347
- className: cn(
348
- "text-2xl font-semibold leading-none tracking-tight",
349
- className
350
- ),
351
- ...props
352
- }
353
- ));
354
- CardTitle.displayName = "CardTitle";
355
- CardDescription = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
356
- "p",
357
- {
358
- ref,
359
- className: cn("text-sm text-muted-foreground", className),
360
- ...props
361
- }
362
- ));
363
- CardDescription.displayName = "CardDescription";
364
- CardContent = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("p-6 pt-0", className), ...props }));
365
- CardContent.displayName = "CardContent";
366
- CardFooter = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
367
- "div",
368
- {
369
- ref,
370
- className: cn("flex items-center p-6 pt-0", className),
371
- ...props
372
- }
373
- ));
374
- CardFooter.displayName = "CardFooter";
375
- }
376
- });
377
- var Separator;
378
- var init_separator = __esm({
379
- "src/ui/primitives/separator.tsx"() {
380
- init_utils();
381
- Separator = React12.forwardRef(
382
- ({ className, orientation = "horizontal", ...props }, ref) => /* @__PURE__ */ jsx(
383
- "div",
384
- {
385
- ref,
386
- className: cn(
387
- "shrink-0 bg-border",
388
- orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
389
- className
390
- ),
391
- ...props
392
- }
393
- )
394
- );
395
- Separator.displayName = "Separator";
396
- }
397
- });
398
- var Table, TableHeader, TableBody, TableFooter, TableRow, TableHead, TableCell, TableCaption;
399
- var init_table = __esm({
400
- "src/ui/primitives/table.tsx"() {
401
- init_utils();
402
- Table = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { className: "relative w-full overflow-auto", children: /* @__PURE__ */ jsx(
403
- "table",
404
- {
405
- ref,
406
- className: cn("w-max min-w-full caption-bottom text-xs", className),
407
- ...props
408
- }
409
- ) }));
410
- Table.displayName = "Table";
411
- TableHeader = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("thead", { ref, className: cn("[&_tr]:border-b", className), ...props }));
412
- TableHeader.displayName = "TableHeader";
413
- TableBody = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
414
- "tbody",
415
- {
416
- ref,
417
- className: cn("[&_tr:last-child]:border-0", className),
418
- ...props
419
- }
420
- ));
421
- TableBody.displayName = "TableBody";
422
- TableFooter = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
423
- "tfoot",
424
- {
425
- ref,
426
- className: cn(
427
- "border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",
428
- className
429
- ),
430
- ...props
431
- }
432
- ));
433
- TableFooter.displayName = "TableFooter";
434
- TableRow = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
435
- "tr",
436
- {
437
- ref,
438
- className: cn(
439
- "border-b transition-colors even:bg-muted/30 data-[state=selected]:bg-muted",
440
- className
441
- ),
442
- ...props
443
- }
444
- ));
445
- TableRow.displayName = "TableRow";
446
- TableHead = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
447
- "th",
448
- {
449
- ref,
450
- className: cn(
451
- "h-9 px-3 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",
452
- className
453
- ),
454
- ...props
455
- }
456
- ));
457
- TableHead.displayName = "TableHead";
458
- TableCell = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
459
- "td",
460
- {
461
- ref,
462
- className: cn("px-3 py-1.5 align-middle [&:has([role=checkbox])]:pr-0 text-xs", className),
463
- ...props
464
- }
465
- ));
466
- TableCell.displayName = "TableCell";
467
- TableCaption = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
468
- "caption",
469
- {
470
- ref,
471
- className: cn("mt-4 text-sm text-muted-foreground", className),
472
- ...props
473
- }
474
- ));
475
- TableCaption.displayName = "TableCaption";
476
- }
477
- });
478
- var init_dropdown_menu = __esm({
479
- "src/ui/primitives/dropdown-menu.tsx"() {
480
- "use client";
481
- }
482
- });
483
- var DialogPortal, DialogOverlay, DialogContent, DialogHeader, DialogFooter, DialogTitle, DialogDescription;
484
- var init_dialog = __esm({
485
- "src/ui/primitives/dialog.tsx"() {
486
- "use client";
487
- init_utils();
488
- DialogPortal = DialogPrimitive.Portal;
489
- DialogOverlay = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
490
- DialogPrimitive.Overlay,
491
- {
492
- ref,
493
- className: cn(
494
- "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
495
- className
496
- ),
497
- ...props
498
- }
499
- ));
500
- DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
501
- DialogContent = React12.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(DialogPortal, { children: [
502
- /* @__PURE__ */ jsx(DialogOverlay, {}),
503
- /* @__PURE__ */ jsxs(
504
- DialogPrimitive.Content,
505
- {
506
- ref,
507
- className: cn(
508
- "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
509
- className
510
- ),
511
- ...props,
512
- children: [
513
- children,
514
- /* @__PURE__ */ jsxs(DialogPrimitive.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", children: [
515
- /* @__PURE__ */ jsx(X, { className: "h-4 w-4" }),
516
- /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
517
- ] })
518
- ]
519
- }
520
- )
521
- ] }));
522
- DialogContent.displayName = DialogPrimitive.Content.displayName;
523
- DialogHeader = ({
524
- className,
525
- ...props
526
- }) => /* @__PURE__ */ jsx(
527
- "div",
528
- {
529
- className: cn(
530
- "flex flex-col space-y-1.5 text-center sm:text-left",
531
- className
532
- ),
533
- ...props
534
- }
535
- );
536
- DialogHeader.displayName = "DialogHeader";
537
- DialogFooter = ({
538
- className,
539
- ...props
540
- }) => /* @__PURE__ */ jsx(
541
- "div",
542
- {
543
- className: cn(
544
- "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
545
- className
546
- ),
547
- ...props
548
- }
549
- );
550
- DialogFooter.displayName = "DialogFooter";
551
- DialogTitle = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
552
- DialogPrimitive.Title,
553
- {
554
- ref,
555
- className: cn(
556
- "text-lg font-semibold leading-none tracking-tight",
557
- className
558
- ),
559
- ...props
560
- }
561
- ));
562
- DialogTitle.displayName = DialogPrimitive.Title.displayName;
563
- DialogDescription = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
564
- DialogPrimitive.Description,
565
- {
566
- ref,
567
- className: cn("text-sm text-muted-foreground", className),
568
- ...props
569
- }
570
- ));
571
- DialogDescription.displayName = DialogPrimitive.Description.displayName;
572
- }
573
- });
574
- var TabsList, TabsTrigger, TabsContent;
575
- var init_tabs = __esm({
576
- "src/ui/primitives/tabs.tsx"() {
577
- "use client";
578
- init_utils();
579
- TabsList = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
580
- TabsPrimitive.List,
581
- {
582
- ref,
583
- className: cn(
584
- "inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",
585
- className
586
- ),
587
- ...props
588
- }
589
- ));
590
- TabsList.displayName = TabsPrimitive.List.displayName;
591
- TabsTrigger = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
592
- TabsPrimitive.Trigger,
593
- {
594
- ref,
595
- className: cn(
596
- "inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",
597
- className
598
- ),
599
- ...props
600
- }
601
- ));
602
- TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
603
- TabsContent = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
604
- TabsPrimitive.Content,
605
- {
606
- ref,
607
- className: cn(
608
- "mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
609
- className
610
- ),
611
- ...props
612
- }
613
- ));
614
- TabsContent.displayName = TabsPrimitive.Content.displayName;
615
- }
616
- });
617
- var init_breadcrumb = __esm({
618
- "src/ui/primitives/breadcrumb.tsx"() {
619
- }
620
- });
621
- var init_keyboard = __esm({
622
- "src/ui/primitives/keyboard.tsx"() {
623
- }
624
- });
625
- var init_pagination = __esm({
626
- "src/ui/primitives/pagination.tsx"() {
627
- }
628
- });
629
- var init_status_badge = __esm({
630
- "src/ui/primitives/status-badge.tsx"() {
631
- }
632
- });
633
- var init_command_menu = __esm({
634
- "src/ui/layout/command-menu.tsx"() {
635
- "use client";
636
- }
637
- });
638
- var init_logo = __esm({
639
- "src/ui/layout/logo.tsx"() {
640
- "use client";
641
- }
642
- });
643
- var init_sidebar_group_icon_menu = __esm({
644
- "src/ui/layout/sidebar-group-icon-menu.tsx"() {
645
- "use client";
646
- }
647
- });
648
- var init_sidebar = __esm({
649
- "src/ui/layout/sidebar.tsx"() {
650
- "use client";
651
- }
652
- });
653
- var init_calendar = __esm({
654
- "src/ui/primitives/calendar.tsx"() {
655
- "use client";
656
- init_utils();
657
- init_button();
658
- }
659
- });
660
- function ScrollArea({
661
- orientation,
662
- className,
663
- children,
664
- ...props
665
- }) {
666
- return /* @__PURE__ */ jsxs(
667
- ScrollAreaPrimitive.Root,
668
- {
669
- "data-slot": "scroll-area",
670
- className: cn("relative overflow-hidden", className),
671
- ...props,
672
- children: [
673
- /* @__PURE__ */ jsx(
674
- ScrollAreaPrimitive.Viewport,
675
- {
676
- "data-slot": "scroll-area-viewport",
677
- className: "h-full w-full rounded-[inherit]",
678
- children
679
- }
680
- ),
681
- /* @__PURE__ */ jsx(ScrollBar, { orientation }),
682
- /* @__PURE__ */ jsx(ScrollAreaPrimitive.Corner, {})
683
- ]
684
- }
685
- );
686
- }
687
- function ScrollBar({
688
- className,
689
- orientation = "vertical",
690
- ...props
691
- }) {
692
- return /* @__PURE__ */ jsx(
693
- ScrollAreaPrimitive.ScrollAreaScrollbar,
694
- {
695
- "data-slot": "scroll-area-scrollbar",
696
- orientation,
697
- className: cn(
698
- "flex touch-none select-none transition-colors",
699
- orientation === "vertical" && "h-full w-2.5 border-l border-l-transparent p-[1px]",
700
- orientation === "horizontal" && "h-2.5 flex-col border-t border-t-transparent p-[1px]",
701
- className
702
- ),
703
- ...props,
704
- children: /* @__PURE__ */ jsx(ScrollAreaPrimitive.ScrollAreaThumb, { className: "relative flex-1 rounded-full bg-border" })
705
- }
706
- );
707
- }
708
- var init_scroll_area = __esm({
709
- "src/ui/primitives/scroll-area.tsx"() {
710
- "use client";
711
- init_utils();
712
- }
713
- });
714
- var init_combobox = __esm({
715
- "src/ui/primitives/combobox.tsx"() {
716
- "use client";
717
- }
718
- });
719
- function Select({
720
- ...props
721
- }) {
722
- return /* @__PURE__ */ jsx(SelectPrimitive.Root, { "data-slot": "select", ...props });
723
- }
724
- function SelectValue({
725
- ...props
726
- }) {
727
- return /* @__PURE__ */ jsx(SelectPrimitive.Value, { "data-slot": "select-value", ...props });
728
- }
729
- function SelectTrigger({
730
- className,
731
- children,
732
- ...props
733
- }) {
734
- return /* @__PURE__ */ jsxs(
735
- SelectPrimitive.Trigger,
736
- {
737
- "data-slot": "select-trigger",
738
- className: cn(
739
- "cursor-pointer flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-hidden focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
740
- className
741
- ),
742
- ...props,
743
- children: [
744
- children,
745
- /* @__PURE__ */ jsx(SelectPrimitive.Icon, { asChild: true, children: /* @__PURE__ */ jsx(ChevronDown, { className: "h-4 w-4 opacity-50" }) })
746
- ]
747
- }
748
- );
749
- }
750
- function SelectScrollUpButton({
751
- className,
752
- ...props
753
- }) {
754
- return /* @__PURE__ */ jsx(
755
- SelectPrimitive.ScrollUpButton,
756
- {
757
- "data-slot": "select-scroll-up-button",
758
- className: cn(
759
- "flex cursor-pointer items-center justify-center py-1",
760
- className
761
- ),
762
- ...props,
763
- children: /* @__PURE__ */ jsx(ChevronUp, { className: "h-4 w-4" })
764
- }
765
- );
766
- }
767
- function SelectScrollDownButton({
768
- className,
769
- ...props
770
- }) {
771
- return /* @__PURE__ */ jsx(
772
- SelectPrimitive.ScrollDownButton,
773
- {
774
- "data-slot": "select-scroll-down-button",
775
- className: cn(
776
- "flex cursor-pointer items-center justify-center py-1",
777
- className
778
- ),
779
- ...props,
780
- children: /* @__PURE__ */ jsx(ChevronDown, { className: "h-4 w-4" })
781
- }
782
- );
783
- }
784
- function SelectContent({
785
- className,
786
- children,
787
- position = "popper",
788
- ...props
789
- }) {
790
- return /* @__PURE__ */ jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
791
- SelectPrimitive.Content,
792
- {
793
- "data-slot": "select-content",
794
- className: cn(
795
- "relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md 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",
796
- 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",
797
- className
798
- ),
799
- position,
800
- ...props,
801
- children: [
802
- /* @__PURE__ */ jsx(SelectScrollUpButton, {}),
803
- /* @__PURE__ */ jsx(
804
- SelectPrimitive.Viewport,
805
- {
806
- className: cn(
807
- "p-1",
808
- position === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
809
- ),
810
- children
811
- }
812
- ),
813
- /* @__PURE__ */ jsx(SelectScrollDownButton, {})
814
- ]
815
- }
816
- ) });
817
- }
818
- function SelectItem({
819
- className,
820
- children,
821
- ...props
822
- }) {
823
- return /* @__PURE__ */ jsxs(
824
- SelectPrimitive.Item,
825
- {
826
- "data-slot": "select-item",
827
- className: cn(
828
- "relative flex w-full cursor-pointer select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-hidden focus:bg-accent focus:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50",
829
- className
830
- ),
831
- ...props,
832
- children: [
833
- /* @__PURE__ */ jsx("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(Check, { className: "h-4 w-4" }) }) }),
834
- /* @__PURE__ */ jsx(SelectPrimitive.ItemText, { children })
835
- ]
836
- }
837
- );
838
- }
839
- var init_select = __esm({
840
- "src/ui/primitives/select.tsx"() {
841
- "use client";
842
- init_utils();
843
- }
844
- });
845
- var init_popover = __esm({
846
- "src/ui/primitives/popover.tsx"() {
847
- "use client";
848
- }
849
- });
850
- var init_switch = __esm({
851
- "src/ui/primitives/switch.tsx"() {
852
- "use client";
853
- }
854
- });
855
- var Label3;
856
- var init_label = __esm({
857
- "src/ui/primitives/label.tsx"() {
858
- "use client";
859
- init_utils();
860
- Label3 = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
861
- LabelPrimitive.Root,
862
- {
863
- ref,
864
- className: cn(
865
- "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
866
- className
867
- ),
868
- ...props
869
- }
870
- ));
871
- Label3.displayName = LabelPrimitive.Root.displayName;
872
- }
873
- });
874
- function TooltipProvider({
875
- delayDuration = 0,
876
- ...props
877
- }) {
878
- return /* @__PURE__ */ jsx(
879
- TooltipPrimitive.Provider,
880
- {
881
- "data-slot": "tooltip-provider",
882
- delayDuration,
883
- ...props
884
- }
885
- );
886
- }
887
- function Tooltip({
888
- ...props
889
- }) {
890
- return /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsx(TooltipPrimitive.Root, { "data-slot": "tooltip", ...props }) });
891
- }
892
- function TooltipTrigger({
893
- className,
894
- ...props
895
- }) {
896
- return /* @__PURE__ */ jsx(
897
- TooltipPrimitive.Trigger,
898
- {
899
- "data-slot": "tooltip-trigger",
900
- className: cn("cursor-pointer", className),
901
- ...props
902
- }
903
- );
904
- }
905
- function TooltipContent({
906
- className,
907
- sideOffset = 0,
908
- ...props
909
- }) {
910
- return /* @__PURE__ */ jsx(
911
- TooltipPrimitive.Content,
912
- {
913
- "data-slot": "tooltip-content",
914
- sideOffset,
915
- className: cn(
916
- "z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-sm 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",
917
- className
918
- ),
919
- ...props
920
- }
921
- );
922
- }
923
- var init_tooltip = __esm({
924
- "src/ui/primitives/tooltip.tsx"() {
925
- "use client";
926
- init_utils();
927
- }
928
- });
929
- var init_resizable = __esm({
930
- "src/ui/primitives/resizable.tsx"() {
931
- "use client";
932
- }
933
- });
934
- var init_slider = __esm({
935
- "src/ui/primitives/slider.tsx"() {
936
- "use client";
937
- }
938
- });
939
- var init_toggle = __esm({
940
- "src/ui/primitives/toggle.tsx"() {
941
- "use client";
942
- cva(
943
- "cursor-pointer inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",
944
- {
945
- variants: {
946
- variant: {
947
- default: "bg-transparent",
948
- outline: "border border-input bg-transparent hover:bg-accent hover:text-accent-foreground"
949
- },
950
- size: {
951
- default: "h-9 px-3",
952
- sm: "h-8 px-2",
953
- lg: "h-10 px-3"
954
- }
955
- },
956
- defaultVariants: {
957
- variant: "default",
958
- size: "default"
959
- }
960
- }
961
- );
962
- }
963
- });
964
- var init_toggle_group = __esm({
965
- "src/ui/primitives/toggle-group.tsx"() {
966
- "use client";
967
- createContext({
968
- size: "default",
969
- variant: "default"
970
- });
971
- }
972
- });
973
- var init_menubar = __esm({
974
- "src/ui/primitives/menubar.tsx"() {
975
- "use client";
976
- }
977
- });
978
- var init_navigation_menu = __esm({
979
- "src/ui/primitives/navigation-menu.tsx"() {
980
- cva(
981
- "group cursor-pointer inline-flex h-9 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=open]:hover:bg-accent data-[state=open]:text-accent-foreground data-[state=open]:focus:bg-accent data-[state=open]:bg-accent/50 focus-visible:ring-ring/50 outline-none transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1"
982
- );
983
- }
984
- });
985
- var init_sticky_layout = __esm({
986
- "src/ui/primitives/sticky-layout.tsx"() {
987
- }
988
- });
989
- var init_prefetch_link = __esm({
990
- "src/ui/primitives/prefetch-link.tsx"() {
991
- "use client";
992
- }
993
- });
994
- var init_dynamic_icon = __esm({
995
- "src/ui/primitives/dynamic-icon.tsx"() {
996
- "use client";
997
- }
998
- });
999
- var InputNumber;
1000
- var init_input_number = __esm({
1001
- "src/ui/primitives/input-number.tsx"() {
1002
- "use client";
1003
- init_utils();
1004
- init_input();
1005
- InputNumber = React12.forwardRef(
1006
- ({ value, onChange, className, decimalScale = 0, suffix, ...props }, ref) => {
1007
- const [displayValue, setDisplayValue] = React12.useState("");
1008
- const parseDisplayValue = (val) => {
1009
- const clean = val.replace(/\./g, "").replace(",", ".");
1010
- return Number(clean);
1011
- };
1012
- const formatNumber = React12.useCallback(
1013
- (num) => {
1014
- return new Intl.NumberFormat("vi-VN", {
1015
- maximumFractionDigits: decimalScale,
1016
- minimumFractionDigits: 0
1017
- }).format(num);
1018
- },
1019
- [decimalScale]
1020
- );
1021
- React12.useEffect(() => {
1022
- if (value === null || value === void 0 || value === "") {
1023
- setDisplayValue("");
1024
- return;
1025
- }
1026
- const numValue = Number(value);
1027
- if (isNaN(numValue)) return;
1028
- const currentNum = parseDisplayValue(displayValue);
1029
- if (currentNum !== numValue) {
1030
- setDisplayValue(formatNumber(numValue));
1031
- }
1032
- }, [value, decimalScale, displayValue, formatNumber]);
1033
- const handleChange = (e) => {
1034
- const rawValue = e.target.value;
1035
- let cleanVal = rawValue.replace(/[^0-9,]/g, "");
1036
- const parts = cleanVal.split(",");
1037
- if (parts.length > 2) {
1038
- cleanVal = parts[0] + "," + parts.slice(1).join("");
1039
- }
1040
- if (cleanVal === "") {
1041
- setDisplayValue("");
1042
- onChange?.(null);
1043
- return;
1044
- }
1045
- const [integerPart, decimalPart] = cleanVal.split(",");
1046
- let formattedInteger = integerPart;
1047
- if (integerPart) {
1048
- formattedInteger = new Intl.NumberFormat("vi-VN").format(
1049
- Number(integerPart)
1050
- );
1051
- }
1052
- let newDisplayValue = formattedInteger;
1053
- let finalDecimalPart = decimalPart;
1054
- if (decimalPart !== void 0) {
1055
- if (decimalScale !== void 0 && decimalPart.length > decimalScale) {
1056
- finalDecimalPart = decimalPart.substring(0, decimalScale);
1057
- }
1058
- newDisplayValue += "," + finalDecimalPart;
1059
- }
1060
- setDisplayValue(newDisplayValue);
1061
- let numStr = integerPart;
1062
- if (finalDecimalPart !== void 0) {
1063
- numStr += "." + finalDecimalPart;
1064
- }
1065
- const numValue = Number(numStr.replace(/\./g, ""));
1066
- onChange?.(numValue);
1067
- };
1068
- return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
1069
- /* @__PURE__ */ jsx(
1070
- Input,
1071
- {
1072
- ...props,
1073
- ref,
1074
- type: "text",
1075
- inputMode: "numeric",
1076
- value: displayValue,
1077
- onChange: handleChange,
1078
- className: cn("pr-8", className)
1079
- }
1080
- ),
1081
- suffix && /* @__PURE__ */ jsx("div", { className: "absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none text-muted-foreground text-sm", children: suffix })
1082
- ] });
1083
- }
1084
- );
1085
- InputNumber.displayName = "InputNumber";
1086
- }
1087
- });
1088
- function Sheet({
1089
- ...props
1090
- }) {
1091
- return /* @__PURE__ */ jsx(DialogPrimitive.Root, { "data-slot": "sheet", ...props });
1092
- }
1093
- function SheetPortal({
1094
- ...props
1095
- }) {
1096
- return /* @__PURE__ */ jsx(DialogPrimitive.Portal, { "data-slot": "sheet-portal", ...props });
1097
- }
1098
- function SheetOverlay({
1099
- className,
1100
- ...props
1101
- }) {
1102
- return /* @__PURE__ */ jsx(
1103
- DialogPrimitive.Overlay,
1104
- {
1105
- "data-slot": "sheet-overlay",
1106
- className: cn(
1107
- "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
1108
- className
1109
- ),
1110
- ...props
1111
- }
1112
- );
1113
- }
1114
- function SheetContent({
1115
- className,
1116
- children,
1117
- side = "right",
1118
- ...props
1119
- }) {
1120
- return /* @__PURE__ */ jsxs(SheetPortal, { children: [
1121
- /* @__PURE__ */ jsx(SheetOverlay, {}),
1122
- /* @__PURE__ */ jsx(
1123
- DialogPrimitive.Content,
1124
- {
1125
- "data-slot": "sheet-content",
1126
- className: cn(sheetVariants({ side }), className),
1127
- ...props,
1128
- children
1129
- }
1130
- )
1131
- ] });
1132
- }
1133
- function SheetTitle({
1134
- className,
1135
- ...props
1136
- }) {
1137
- return /* @__PURE__ */ jsx(
1138
- DialogPrimitive.Title,
1139
- {
1140
- "data-slot": "sheet-title",
1141
- className: cn("text-lg font-semibold text-foreground", className),
1142
- ...props
1143
- }
1144
- );
1145
- }
1146
- var sheetVariants;
1147
- var init_sheet = __esm({
1148
- "src/ui/feedback/sheet.tsx"() {
1149
- "use client";
1150
- init_utils();
1151
- sheetVariants = cva(
1152
- "fixed z-50 gap-4 bg-background p-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out",
1153
- {
1154
- variants: {
1155
- side: {
1156
- top: "inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",
1157
- bottom: "inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",
1158
- left: "inset-y-0 left-0 h-full w-72 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",
1159
- right: "inset-y-0 right-0 h-full w-72 border-s data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm",
1160
- start: "inset-y-0 start-0 h-full w-72 border-e data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left data-[state=closed]:rtl:slide-out-to-right data-[state=open]:rtl:slide-in-from-right sm:max-w-sm",
1161
- end: "inset-y-0 end-0 h-full w-72 border-s data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right data-[state=closed]:rtl:slide-out-to-left data-[state=open]:rtl:slide-in-from-left sm:max-w-sm"
1162
- }
1163
- },
1164
- defaultVariants: {
1165
- side: "right"
1166
- }
1167
- }
1168
- );
1169
- }
1170
- });
1171
- var init_context_menu = __esm({
1172
- "src/ui/feedback/context-menu.tsx"() {
1173
- "use client";
1174
- }
1175
- });
1176
- var init_drawer = __esm({
1177
- "src/ui/feedback/drawer.tsx"() {
1178
- "use client";
1179
- }
1180
- });
1181
- var init_progress = __esm({
1182
- "src/ui/feedback/progress.tsx"() {
1183
- "use client";
1184
- }
1185
- });
1186
- var init_sonner = __esm({
1187
- "src/ui/feedback/sonner.tsx"() {
1188
- "use client";
1189
- }
1190
- });
1191
-
1192
- // src/ui/primitives/client.ts
1193
- var init_client = __esm({
1194
- "src/ui/primitives/client.ts"() {
1195
- "use client";
1196
- init_calendar();
1197
- init_combobox();
1198
- init_scroll_area();
1199
- init_select();
1200
- init_popover();
1201
- init_dropdown_menu();
1202
- init_switch();
1203
- init_checkbox();
1204
- init_label();
1205
- init_tooltip();
1206
- init_sidebar2();
1207
- init_resizable();
1208
- init_slider();
1209
- init_toggle();
1210
- init_toggle_group();
1211
- init_menubar();
1212
- init_navigation_menu();
1213
- init_sticky_layout();
1214
- init_prefetch_link();
1215
- init_dynamic_icon();
1216
- init_input_number();
1217
- init_sheet();
1218
- init_context_menu();
1219
- init_drawer();
1220
- init_progress();
1221
- init_sonner();
1222
- }
1223
- });
1224
- var init_language_dropdown = __esm({
1225
- "src/ui/layout/language-dropdown.tsx"() {
1226
- "use client";
1227
- }
1228
- });
1229
- var init_footer = __esm({
1230
- "src/ui/layout/footer.tsx"() {
1231
- }
1232
- });
1233
- var init_header_breadcrumb = __esm({
1234
- "src/ui/layout/header-breadcrumb.tsx"() {
1235
- "use client";
1236
- }
1237
- });
1238
- var init_animated_list = __esm({
1239
- "src/ui/layout/animated-list.tsx"() {
1240
- }
1241
- });
1242
- var init_animated_sidebar = __esm({
1243
- "src/ui/layout/animated-sidebar.tsx"() {
1244
- "use client";
1245
- }
1246
- });
1247
- var init_customizer = __esm({
1248
- "src/ui/layout/customizer.tsx"() {
1249
- "use client";
1250
- }
1251
- });
1252
- function Avatar({
1253
- className,
1254
- ...props
1255
- }) {
1256
- return /* @__PURE__ */ jsx(
1257
- AvatarPrimitive.Root,
1258
- {
1259
- "data-slot": "avatar",
1260
- className: cn("relative flex h-10 w-10 shrink-0", className),
1261
- ...props
1262
- }
1263
- );
1264
- }
1265
- function AvatarImage({
1266
- className,
1267
- ...props
1268
- }) {
1269
- return /* @__PURE__ */ jsx(
1270
- AvatarPrimitive.Image,
1271
- {
1272
- "data-slot": "avatar-image",
1273
- className: cn(
1274
- "aspect-square h-full w-full bg-muted rounded-lg object-cover",
1275
- className
1276
- ),
1277
- ...props
1278
- }
1279
- );
1280
- }
1281
- function AvatarFallback({
1282
- className,
1283
- ...props
1284
- }) {
1285
- return /* @__PURE__ */ jsx(
1286
- AvatarPrimitive.Fallback,
1287
- {
1288
- className: cn(
1289
- "flex h-full w-full items-center justify-center bg-muted rounded-lg",
1290
- className
1291
- ),
1292
- ...props
1293
- }
1294
- );
1295
- }
1296
- var init_avatar = __esm({
1297
- "src/ui/data-display/avatar.tsx"() {
1298
- "use client";
1299
- init_utils();
1300
- cva(
1301
- "transition duration-300 hover:scale-105 hover:z-10",
1302
- {
1303
- variants: {
1304
- size: {
1305
- default: "h-10 w-10",
1306
- sm: "h-9 w-9 text-sm",
1307
- lg: "h-11 w-11"
1308
- }
1309
- },
1310
- defaultVariants: {
1311
- size: "default"
1312
- }
1313
- }
1314
- );
1315
- }
1316
- });
1317
- var init_tab_content_cache = __esm({
1318
- "src/ui/layout/tab-content-cache.tsx"() {
1319
- "use client";
1320
- createContext(void 0);
1321
- }
1322
- });
1323
- var init_tab_navigation_provider = __esm({
1324
- "src/ui/layout/tab-navigation-provider.tsx"() {
1325
- "use client";
1326
- createContext(void 0);
1327
- }
1328
- });
1329
- var init_user_dropdown = __esm({
1330
- "src/ui/layout/user-dropdown.tsx"() {
1331
- "use client";
1332
- }
1333
- });
1334
- var init_notification_dropdown = __esm({
1335
- "src/ui/layout/notification-dropdown.tsx"() {
1336
- "use client";
1337
- }
1338
- });
1339
- var init_mode_dropdown = __esm({
1340
- "src/ui/layout/mode-dropdown.tsx"() {
1341
- "use client";
1342
- }
1343
- });
1344
- var init_full_screen_toggle = __esm({
1345
- "src/ui/layout/full-screen-toggle.tsx"() {
1346
- "use client";
1347
- }
1348
- });
1349
- var init_route_cache = __esm({
1350
- "src/ui/layout/route-cache.tsx"() {
1351
- "use client";
1352
- createContext(
1353
- void 0
1354
- );
1355
- }
1356
- });
1357
- var init_page_tabs = __esm({
1358
- "src/ui/layout/page-tabs.tsx"() {
1359
- "use client";
1360
- }
1361
- });
1362
- var init_toggle_mobile_sidebar = __esm({
1363
- "src/ui/layout/toggle-mobile-sidebar.tsx"() {
1364
- "use client";
1365
- }
1366
- });
1367
- var init_top_bar_header_menubar = __esm({
1368
- "src/ui/layout/top-bar-header-menubar.tsx"() {
1369
- "use client";
1370
- }
1371
- });
1372
- var init_vertical_layout_header = __esm({
1373
- "src/ui/layout/vertical-layout-header.tsx"() {
1374
- "use client";
1375
- }
1376
- });
1377
- var init_horizontal_layout_header = __esm({
1378
- "src/ui/layout/horizontal-layout-header.tsx"() {
1379
- "use client";
1380
- }
1381
- });
1382
- var init_vertical_layout = __esm({
1383
- "src/ui/layout/vertical-layout.tsx"() {
1384
- "use client";
1385
- }
1386
- });
1387
- var init_horizontal_layout = __esm({
1388
- "src/ui/layout/horizontal-layout.tsx"() {
1389
- "use client";
1390
- }
1391
- });
1392
- var init_main_layout = __esm({
1393
- "src/ui/layout/main-layout.tsx"() {
1394
- "use client";
1395
- }
1396
- });
1397
-
1398
- // src/ui/layout/index.tsx
1399
- var init_layout = __esm({
1400
- "src/ui/layout/index.tsx"() {
1401
- init_sidebar();
1402
- init_language_dropdown();
1403
- init_footer();
1404
- init_logo();
1405
- init_header_breadcrumb();
1406
- init_animated_list();
1407
- init_animated_sidebar();
1408
- init_command_menu();
1409
- init_sidebar_group_icon_menu();
1410
- init_customizer();
1411
- init_user_dropdown();
1412
- init_notification_dropdown();
1413
- init_mode_dropdown();
1414
- init_full_screen_toggle();
1415
- init_page_tabs();
1416
- init_tab_navigation_provider();
1417
- init_route_cache();
1418
- init_toggle_mobile_sidebar();
1419
- init_top_bar_header_menubar();
1420
- init_vertical_layout_header();
1421
- init_horizontal_layout_header();
1422
- init_vertical_layout();
1423
- init_horizontal_layout();
1424
- init_main_layout();
1425
- init_tab_content_cache();
1426
- }
1427
- });
1428
-
1429
- // src/hooks/use-tenant.ts
1430
- var init_use_tenant = __esm({
1431
- "src/hooks/use-tenant.ts"() {
1432
- }
1433
- });
1434
- function useMediaQuery(query) {
1435
- const [matches, setMatches] = useState(false);
1436
- useEffect(() => {
1437
- if (typeof window !== "undefined") {
1438
- const media = window.matchMedia(query);
1439
- setMatches(media.matches);
1440
- const listener = (event) => setMatches(event.matches);
1441
- media.addEventListener("change", listener);
1442
- return () => media.removeEventListener("change", listener);
1443
- }
1444
- }, [query]);
1445
- return matches;
1446
- }
1447
- function useMobile() {
1448
- return useMediaQuery("(max-width: 768px)");
1449
- }
1450
- var init_hooks = __esm({
1451
- "src/hooks/index.tsx"() {
1452
- "use client";
1453
- init_use_tenant();
1454
- createContext(null);
1455
- }
1456
- });
1457
- var init_alert = __esm({
1458
- "src/ui/feedback/alert.tsx"() {
1459
- cva(
1460
- "relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",
1461
- {
1462
- variants: {
1463
- variant: {
1464
- default: "bg-background text-foreground",
1465
- destructive: "border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"
1466
- }
1467
- },
1468
- defaultVariants: {
1469
- variant: "default"
1470
- }
1471
- }
1472
- );
1473
- }
1474
- });
1475
- var GlobalErrorEmitter;
1476
- var init_error_dialog = __esm({
1477
- "src/ui/feedback/error-dialog.tsx"() {
1478
- "use client";
1479
- GlobalErrorEmitter = class {
1480
- constructor() {
1481
- this.listeners = [];
1482
- }
1483
- subscribe(listener) {
1484
- this.listeners.push(listener);
1485
- return () => {
1486
- this.listeners = this.listeners.filter((l) => l !== listener);
1487
- };
1488
- }
1489
- emit(data) {
1490
- this.listeners.forEach((listener) => listener(data));
1491
- }
1492
- };
1493
- new GlobalErrorEmitter();
1494
- createContext(null);
1495
- }
1496
- });
1497
- var init_feedback = __esm({
1498
- "src/ui/feedback/index.tsx"() {
1499
- init_progress();
1500
- init_sheet();
1501
- init_alert();
1502
- init_context_menu();
1503
- init_drawer();
1504
- init_sonner();
1505
- init_error_dialog();
1506
- }
1507
- });
1508
- function useSidebar() {
1509
- const context = React12.useContext(SidebarContext);
1510
- if (!context) {
1511
- throw new Error("useSidebar must be used within a SidebarProvider.");
1512
- }
1513
- return context;
1514
- }
1515
- var SIDEBAR_WIDTH, SIDEBAR_WIDTH_MOBILE, SIDEBAR_WIDTH_ICON, SIDEBAR_KEYBOARD_SHORTCUT, SidebarContext, SidebarProvider, Sidebar, SidebarTrigger, SidebarRail, SidebarInset, SidebarInput, SidebarHeader, SidebarFooter, SidebarSeparator, SidebarContent, SidebarGroup, SidebarGroupLabel, SidebarGroupAction, SidebarGroupContent, SidebarMenu, SidebarMenuItem, sidebarMenuButtonVariants, SidebarMenuButton, SidebarMenuAction, SidebarMenuBadge, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubItem, SidebarMenuSubButton;
1516
- var init_sidebar2 = __esm({
1517
- "src/ui/primitives/sidebar.tsx"() {
1518
- "use client";
1519
- init_hooks();
1520
- init_utils();
1521
- init_button();
1522
- init_feedback();
1523
- init_tooltip();
1524
- SIDEBAR_WIDTH = "16rem";
1525
- SIDEBAR_WIDTH_MOBILE = "18rem";
1526
- SIDEBAR_WIDTH_ICON = "3rem";
1527
- SIDEBAR_KEYBOARD_SHORTCUT = "b";
1528
- SidebarContext = React12.createContext(null);
1529
- SidebarProvider = React12.forwardRef(
1530
- ({
1531
- defaultOpen = false,
1532
- open: openProp,
1533
- onOpenChange: setOpenProp,
1534
- className,
1535
- style,
1536
- children,
1537
- ...props
1538
- }, ref) => {
1539
- const isMobile = useMobile();
1540
- const [openMobile, setOpenMobile] = React12.useState(false);
1541
- const [hoverOpen, setHoverOpen] = React12.useState(false);
1542
- const [_open, _setOpen] = React12.useState(defaultOpen);
1543
- const open = openProp ?? _open;
1544
- const setOpen = React12.useCallback(
1545
- (value) => {
1546
- if (setOpenProp) {
1547
- return setOpenProp(typeof value === "function" ? value(open) : value);
1548
- }
1549
- _setOpen(value);
1550
- },
1551
- [setOpenProp, open]
1552
- );
1553
- const toggleSidebar = React12.useCallback(() => {
1554
- return isMobile ? setOpenMobile((open2) => !open2) : setOpen((open2) => !open2);
1555
- }, [isMobile, setOpen, setOpenMobile]);
1556
- React12.useEffect(() => {
1557
- const handleKeyDown = (event) => {
1558
- if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
1559
- event.preventDefault();
1560
- toggleSidebar();
1561
- }
1562
- };
1563
- window.addEventListener("keydown", handleKeyDown);
1564
- return () => window.removeEventListener("keydown", handleKeyDown);
1565
- }, [toggleSidebar]);
1566
- const state = open ? "expanded" : "collapsed";
1567
- const isHoverExpanded = !open && hoverOpen;
1568
- const contextValue = React12.useMemo(
1569
- () => ({
1570
- state,
1571
- open,
1572
- setOpen,
1573
- isMobile,
1574
- openMobile,
1575
- setOpenMobile,
1576
- toggleSidebar,
1577
- hoverOpen,
1578
- setHoverOpen,
1579
- isHoverExpanded
1580
- }),
1581
- [
1582
- state,
1583
- open,
1584
- setOpen,
1585
- isMobile,
1586
- openMobile,
1587
- setOpenMobile,
1588
- toggleSidebar,
1589
- hoverOpen,
1590
- setHoverOpen,
1591
- isHoverExpanded
1592
- ]
1593
- );
1594
- return /* @__PURE__ */ jsx(SidebarContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsx(
1595
- "div",
1596
- {
1597
- style: {
1598
- "--sidebar-width": SIDEBAR_WIDTH,
1599
- "--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
1600
- ...style
1601
- },
1602
- className: cn(
1603
- "group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-sidebar",
1604
- className
1605
- ),
1606
- ref,
1607
- ...props,
1608
- children
1609
- }
1610
- ) }) });
1611
- }
1612
- );
1613
- SidebarProvider.displayName = "SidebarProvider";
1614
- Sidebar = React12.forwardRef(
1615
- ({
1616
- side = "left",
1617
- variant = "sidebar",
1618
- collapsible = "offcanvas",
1619
- hoverExpandEnabled = true,
1620
- className,
1621
- children,
1622
- ...props
1623
- }, ref) => {
1624
- const {
1625
- isMobile,
1626
- state,
1627
- openMobile,
1628
- setOpenMobile,
1629
- setHoverOpen,
1630
- isHoverExpanded
1631
- } = useSidebar();
1632
- const handleMouseEnter = React12.useCallback(() => {
1633
- if (hoverExpandEnabled && state === "collapsed" && collapsible === "icon") {
1634
- setHoverOpen(true);
1635
- }
1636
- }, [hoverExpandEnabled, state, collapsible, setHoverOpen]);
1637
- const handleMouseLeave = React12.useCallback(() => {
1638
- if (hoverExpandEnabled) {
1639
- setHoverOpen(false);
1640
- }
1641
- }, [hoverExpandEnabled, setHoverOpen]);
1642
- if (collapsible === "none") {
1643
- return /* @__PURE__ */ jsx(
1644
- "div",
1645
- {
1646
- className: cn(
1647
- "flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground",
1648
- className
1649
- ),
1650
- ref,
1651
- ...props,
1652
- children
1653
- }
1654
- );
1655
- }
1656
- if (isMobile) {
1657
- return /* @__PURE__ */ jsx(Sheet, { open: openMobile, onOpenChange: setOpenMobile, ...props, children: /* @__PURE__ */ jsxs(
1658
- SheetContent,
1659
- {
1660
- "data-sidebar": "sidebar",
1661
- "data-mobile": "true",
1662
- className: "w-(--sidebar-width) bg-background p-0 text-foreground [&>button]:hidden",
1663
- style: {
1664
- "--sidebar-width": SIDEBAR_WIDTH_MOBILE
1665
- },
1666
- side,
1667
- children: [
1668
- /* @__PURE__ */ jsx(SheetTitle, { className: "sr-only", children: "Mobile Menu" }),
1669
- /* @__PURE__ */ jsx("div", { className: "flex h-full w-full flex-col", children })
1670
- ]
1671
- }
1672
- ) });
1673
- }
1674
- return /* @__PURE__ */ jsxs(
1675
- "div",
1676
- {
1677
- ref,
1678
- className: cn(
1679
- "group peer hidden md:block transition-colors duration-200",
1680
- // Blue bg + white text when collapsed, white bg + dark text when expanded/hover
1681
- state === "collapsed" && !isHoverExpanded ? "text-sidebar-foreground" : "text-foreground"
1682
- ),
1683
- "data-state": state,
1684
- "data-hover-expanded": isHoverExpanded,
1685
- "data-collapsible": state === "collapsed" ? collapsible : "",
1686
- "data-variant": variant,
1687
- "data-side": side,
1688
- onMouseEnter: handleMouseEnter,
1689
- onMouseLeave: handleMouseLeave,
1690
- children: [
1691
- /* @__PURE__ */ jsx(
1692
- "div",
1693
- {
1694
- className: cn(
1695
- "duration-200 relative h-svh w-(--sidebar-width) bg-transparent transition-[width] ease-linear",
1696
- "group-data-[collapsible=offcanvas]:w-0",
1697
- "group-data-[collapsible=icon]:w-(--sidebar-width-icon)",
1698
- variant === "floating" || variant === "inset" ? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_2px)]" : "group-data-[collapsible=icon]:w-(--sidebar-width-icon)"
1699
- )
1700
- }
1701
- ),
1702
- /* @__PURE__ */ jsx(
1703
- "div",
1704
- {
1705
- className: cn(
1706
- "duration-200 fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] ease-linear md:flex",
1707
- side === "left" ? "left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]" : "right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",
1708
- // Adjustments for collapsible=icon
1709
- variant === "floating" || variant === "inset" ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_8px)] group-data-[collapsible=icon]:px-2.5" : "group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[collapsible=icon]:border-r group-data-[collapsible=icon]:px-0",
1710
- // Hover expand - override icon width to full width on hover
1711
- "group-data-[hover-expanded=true]:!w-(--sidebar-width) group-data-[hover-expanded=true]:shadow-xl group-data-[hover-expanded=true]:z-[100]",
1712
- className
1713
- ),
1714
- ...props,
1715
- children: /* @__PURE__ */ jsx(
1716
- "div",
1717
- {
1718
- "data-sidebar": "sidebar",
1719
- className: cn(
1720
- "flex h-full w-full flex-col border-r transition-colors duration-200",
1721
- // Blue background when collapsed, white when expanded/hover
1722
- "group-data-[state=collapsed]:bg-sidebar group-data-[state=collapsed]:border-sidebar-border",
1723
- "group-data-[state=expanded]:bg-background group-data-[state=expanded]:border-border",
1724
- "group-data-[hover-expanded=true]:!bg-background group-data-[hover-expanded=true]:!border-border",
1725
- "group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow"
1726
- ),
1727
- children
1728
- }
1729
- )
1730
- }
1731
- )
1732
- ]
1733
- }
1734
- );
1735
- }
1736
- );
1737
- Sidebar.displayName = "Sidebar";
1738
- SidebarTrigger = React12.forwardRef(({ className, onClick, ...props }, ref) => {
1739
- const { toggleSidebar } = useSidebar();
1740
- return /* @__PURE__ */ jsxs(
1741
- Button,
1742
- {
1743
- ref,
1744
- "data-sidebar": "trigger",
1745
- variant: "ghost",
1746
- size: "icon",
1747
- className: cn("h-7 w-7", className),
1748
- onClick: (event) => {
1749
- onClick?.(event);
1750
- toggleSidebar();
1751
- },
1752
- ...props,
1753
- children: [
1754
- /* @__PURE__ */ jsx(PanelLeft, {}),
1755
- /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Toggle Sidebar" })
1756
- ]
1757
- }
1758
- );
1759
- });
1760
- SidebarTrigger.displayName = "SidebarTrigger";
1761
- SidebarRail = React12.forwardRef(({ className, ...props }, ref) => {
1762
- const { toggleSidebar } = useSidebar();
1763
- return /* @__PURE__ */ jsx(
1764
- "button",
1765
- {
1766
- ref,
1767
- "data-sidebar": "rail",
1768
- "aria-label": "Toggle Sidebar",
1769
- tabIndex: -1,
1770
- onClick: toggleSidebar,
1771
- title: "Toggle Sidebar",
1772
- className: cn(
1773
- "absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-sidebar-border group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex",
1774
- "[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize",
1775
- "[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize",
1776
- "group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-sidebar",
1777
- "[[data-side=left][data-collapsible=offcanvas]_&]:-right-2",
1778
- "[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",
1779
- className
1780
- ),
1781
- ...props
1782
- }
1783
- );
1784
- });
1785
- SidebarRail.displayName = "SidebarRail";
1786
- SidebarInset = React12.forwardRef(({ className, ...props }, ref) => {
1787
- return /* @__PURE__ */ jsx(
1788
- "main",
1789
- {
1790
- ref,
1791
- className: cn(
1792
- "relative flex min-h-svh flex-1 flex-col bg-muted/40 transition-[margin] duration-200 ease-linear",
1793
- "peer-data-[variant=inset]:min-h-[calc(100svh-theme(spacing.4))] md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow",
1794
- className
1795
- ),
1796
- ...props
1797
- }
1798
- );
1799
- });
1800
- SidebarInset.displayName = "SidebarInset";
1801
- SidebarInput = React12.forwardRef(({ className, ...props }, ref) => {
1802
- return /* @__PURE__ */ jsx(
1803
- "input",
1804
- {
1805
- ref,
1806
- "data-sidebar": "input",
1807
- className: cn(
1808
- "flex h-8 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sidebar-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
1809
- className
1810
- ),
1811
- ...props
1812
- }
1813
- );
1814
- });
1815
- SidebarInput.displayName = "SidebarInput";
1816
- SidebarHeader = React12.forwardRef(({ className, ...props }, ref) => {
1817
- return /* @__PURE__ */ jsx(
1818
- "div",
1819
- {
1820
- ref,
1821
- "data-sidebar": "header",
1822
- className: cn("flex flex-col gap-2 p-2", className),
1823
- ...props
1824
- }
1825
- );
1826
- });
1827
- SidebarHeader.displayName = "SidebarHeader";
1828
- SidebarFooter = React12.forwardRef(({ className, ...props }, ref) => {
1829
- return /* @__PURE__ */ jsx(
1830
- "div",
1831
- {
1832
- ref,
1833
- "data-sidebar": "footer",
1834
- className: cn("flex flex-col gap-2 p-2", className),
1835
- ...props
1836
- }
1837
- );
1838
- });
1839
- SidebarFooter.displayName = "SidebarFooter";
1840
- SidebarSeparator = React12.forwardRef(({ className, ...props }, ref) => {
1841
- return /* @__PURE__ */ jsx(
1842
- "div",
1843
- {
1844
- ref,
1845
- "data-sidebar": "separator",
1846
- className: cn("mx-2 h-[1px] w-auto bg-sidebar-border", className),
1847
- ...props
1848
- }
1849
- );
1850
- });
1851
- SidebarSeparator.displayName = "SidebarSeparator";
1852
- SidebarContent = React12.forwardRef(({ className, ...props }, ref) => {
1853
- return /* @__PURE__ */ jsx(
1854
- "div",
1855
- {
1856
- ref,
1857
- "data-sidebar": "content",
1858
- className: cn(
1859
- "flex min-h-0 flex-1 flex-col gap-2 overflow-auto",
1860
- // Hide overflow when collapsed, but show when hover-expanded
1861
- "group-data-[collapsible=icon]:overflow-hidden group-data-[hover-expanded=true]:!overflow-auto",
1862
- className
1863
- ),
1864
- ...props
1865
- }
1866
- );
1867
- });
1868
- SidebarContent.displayName = "SidebarContent";
1869
- SidebarGroup = React12.forwardRef(({ className, ...props }, ref) => {
1870
- return /* @__PURE__ */ jsx(
1871
- "div",
1872
- {
1873
- ref,
1874
- "data-sidebar": "group",
1875
- className: cn("relative flex w-full min-w-0 flex-col p-2", className),
1876
- ...props
1877
- }
1878
- );
1879
- });
1880
- SidebarGroup.displayName = "SidebarGroup";
1881
- SidebarGroupLabel = React12.forwardRef(({ className, asChild = false, ...props }, ref) => {
1882
- const Comp = asChild ? Slot : "div";
1883
- return /* @__PURE__ */ jsx(
1884
- Comp,
1885
- {
1886
- ref,
1887
- "data-sidebar": "group-label",
1888
- className: cn(
1889
- "duration-200 flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-bold text-primary uppercase tracking-wider outline-none ring-sidebar-ring transition-[margin,opa] ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
1890
- // Hide when collapsed, show when hover-expanded
1891
- "group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",
1892
- "group-data-[hover-expanded=true]:!mt-0 group-data-[hover-expanded=true]:!opacity-100",
1893
- className
1894
- ),
1895
- ...props
1896
- }
1897
- );
1898
- });
1899
- SidebarGroupLabel.displayName = "SidebarGroupLabel";
1900
- SidebarGroupAction = React12.forwardRef(({ className, asChild = false, ...props }, ref) => {
1901
- const Comp = asChild ? Slot : "button";
1902
- return /* @__PURE__ */ jsx(
1903
- Comp,
1904
- {
1905
- ref,
1906
- "data-sidebar": "group-action",
1907
- className: cn(
1908
- "absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
1909
- // Increases the hit area of the button on mobile.
1910
- "after:absolute after:-inset-2 after:md:hidden",
1911
- "group-data-[collapsible=icon]:hidden",
1912
- className
1913
- ),
1914
- ...props
1915
- }
1916
- );
1917
- });
1918
- SidebarGroupAction.displayName = "SidebarGroupAction";
1919
- SidebarGroupContent = React12.forwardRef(({ className, ...props }, ref) => {
1920
- return /* @__PURE__ */ jsx(
1921
- "div",
1922
- {
1923
- ref,
1924
- "data-sidebar": "group-content",
1925
- className: cn("w-full text-sm", className),
1926
- ...props
1927
- }
1928
- );
1929
- });
1930
- SidebarGroupContent.displayName = "SidebarGroupContent";
1931
- SidebarMenu = React12.forwardRef(({ className, ...props }, ref) => {
1932
- return /* @__PURE__ */ jsx(
1933
- "ul",
1934
- {
1935
- ref,
1936
- "data-sidebar": "menu",
1937
- className: cn("flex w-full min-w-0 flex-col gap-1", className),
1938
- ...props
1939
- }
1940
- );
1941
- });
1942
- SidebarMenu.displayName = "SidebarMenu";
1943
- SidebarMenuItem = React12.forwardRef(({ className, ...props }, ref) => {
1944
- return /* @__PURE__ */ jsx(
1945
- "li",
1946
- {
1947
- ref,
1948
- "data-sidebar": "menu-item",
1949
- className: cn("group/menu-item relative", className),
1950
- ...props
1951
- }
1952
- );
1953
- });
1954
- SidebarMenuItem.displayName = "SidebarMenuItem";
1955
- sidebarMenuButtonVariants = cva(
1956
- // Base styles + hover-expand overrides
1957
- "peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 group-data-[hover-expanded=true]:!size-auto group-data-[hover-expanded=true]:!w-full group-data-[hover-expanded=true]:!p-2",
1958
- {
1959
- variants: {
1960
- variant: {
1961
- default: "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
1962
- outline: "bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"
1963
- },
1964
- size: {
1965
- default: "h-8 text-sm",
1966
- sm: "h-7 text-xs",
1967
- lg: "h-12 text-sm group-data-[collapsible=icon]:!p-0"
1968
- },
1969
- isActive: {
1970
- true: "bg-primary/10 text-primary font-bold"
1971
- }
1972
- },
1973
- defaultVariants: {
1974
- variant: "default",
1975
- size: "default"
1976
- }
1977
- }
1978
- );
1979
- SidebarMenuButton = React12.forwardRef(
1980
- ({
1981
- asChild = false,
1982
- isActive = false,
1983
- variant = "default",
1984
- size = "default",
1985
- tooltip,
1986
- className,
1987
- ...props
1988
- }, ref) => {
1989
- const Comp = asChild ? Slot : "button";
1990
- const { isMobile, state } = useSidebar();
1991
- const button = /* @__PURE__ */ jsx(
1992
- Comp,
1993
- {
1994
- ref,
1995
- "data-sidebar": "menu-button",
1996
- "data-size": size,
1997
- "data-active": isActive,
1998
- className: cn(
1999
- sidebarMenuButtonVariants({ variant, size, isActive }),
2000
- className
2001
- ),
2002
- ...props
2003
- }
2004
- );
2005
- if (!tooltip) {
2006
- return button;
2007
- }
2008
- if (typeof tooltip === "string") {
2009
- tooltip = {
2010
- children: tooltip
2011
- };
2012
- }
2013
- return /* @__PURE__ */ jsxs(Tooltip, { children: [
2014
- /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: button }),
2015
- /* @__PURE__ */ jsx(
2016
- TooltipContent,
2017
- {
2018
- side: "right",
2019
- align: "center",
2020
- hidden: state !== "collapsed" || isMobile,
2021
- ...tooltip
2022
- }
2023
- )
2024
- ] });
2025
- }
2026
- );
2027
- SidebarMenuButton.displayName = "SidebarMenuButton";
2028
- SidebarMenuAction = React12.forwardRef(({ className, asChild = false, showOnHover = false, ...props }, ref) => {
2029
- const Comp = asChild ? Slot : "button";
2030
- return /* @__PURE__ */ jsx(
2031
- Comp,
2032
- {
2033
- ref,
2034
- "data-sidebar": "menu-action",
2035
- className: cn(
2036
- "absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
2037
- // Increases the hit area of the button on mobile.
2038
- "after:absolute after:-inset-2 after:md:hidden",
2039
- "peer-data-[size=sm]/menu-button:top-1",
2040
- "peer-data-[size=default]/menu-button:top-1.5",
2041
- "peer-data-[size=lg]/menu-button:top-2.5",
2042
- "group-data-[collapsible=icon]:hidden",
2043
- showOnHover && "group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 md:opacity-0",
2044
- className
2045
- ),
2046
- ...props
2047
- }
2048
- );
2049
- });
2050
- SidebarMenuAction.displayName = "SidebarMenuAction";
2051
- SidebarMenuBadge = React12.forwardRef(({ className, ...props }, ref) => {
2052
- return /* @__PURE__ */ jsx(
2053
- "div",
2054
- {
2055
- ref,
2056
- "data-sidebar": "menu-badge",
2057
- className: cn(
2058
- "pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums text-sidebar-foreground select-none",
2059
- "peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground",
2060
- "peer-data-[size=sm]/menu-button:top-1",
2061
- "peer-data-[size=default]/menu-button:top-1.5",
2062
- "peer-data-[size=lg]/menu-button:top-2.5",
2063
- "group-data-[collapsible=icon]:hidden",
2064
- className
2065
- ),
2066
- ...props
2067
- }
2068
- );
2069
- });
2070
- SidebarMenuBadge.displayName = "SidebarMenuBadge";
2071
- SidebarMenuSkeleton = React12.forwardRef(({ className, showIcon = false, ...props }, ref) => {
2072
- const width = React12.useMemo(() => {
2073
- return `${Math.floor(Math.random() * 40) + 50}%`;
2074
- }, []);
2075
- return /* @__PURE__ */ jsxs(
2076
- "div",
2077
- {
2078
- ref,
2079
- "data-sidebar": "menu-skeleton",
2080
- className: cn("flex h-8 items-center gap-2 rounded-md px-2", className),
2081
- ...props,
2082
- children: [
2083
- showIcon && /* @__PURE__ */ jsx(
2084
- "div",
2085
- {
2086
- className: "size-4 rounded-md animate-pulse bg-muted",
2087
- "data-sidebar": "menu-skeleton-icon"
2088
- }
2089
- ),
2090
- /* @__PURE__ */ jsx(
2091
- "div",
2092
- {
2093
- className: "h-4 flex-1 max-w-[--skeleton-width] animate-pulse bg-muted rounded-full",
2094
- "data-sidebar": "menu-skeleton-text",
2095
- style: {
2096
- "--skeleton-width": width
2097
- }
2098
- }
2099
- )
2100
- ]
2101
- }
2102
- );
2103
- });
2104
- SidebarMenuSkeleton.displayName = "SidebarMenuSkeleton";
2105
- SidebarMenuSub = React12.forwardRef(({ className, ...props }, ref) => {
2106
- return /* @__PURE__ */ jsx(
2107
- "ul",
2108
- {
2109
- ref,
2110
- "data-sidebar": "menu-sub",
2111
- className: cn(
2112
- "mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5",
2113
- // Hide when collapsed, show when hover-expanded
2114
- "group-data-[collapsible=icon]:hidden group-data-[hover-expanded=true]:!flex",
2115
- className
2116
- ),
2117
- ...props
2118
- }
2119
- );
2120
- });
2121
- SidebarMenuSub.displayName = "SidebarMenuSub";
2122
- SidebarMenuSubItem = React12.forwardRef(({ ...props }, ref) => /* @__PURE__ */ jsx("li", { ref, ...props }));
2123
- SidebarMenuSubItem.displayName = "SidebarMenuSubItem";
2124
- SidebarMenuSubButton = React12.forwardRef(({ asChild = false, size = "md", isActive, className, ...props }, ref) => {
2125
- const Comp = asChild ? Slot : "a";
2126
- return /* @__PURE__ */ jsx(
2127
- Comp,
2128
- {
2129
- ref,
2130
- "data-sidebar": "menu-sub-button",
2131
- "data-size": size,
2132
- "data-active": isActive,
2133
- className: cn(
2134
- "flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-none ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 text-xs",
2135
- "data-[active=true]:bg-primary/15 data-[active=true]:!text-primary data-[active=true]:font-bold",
2136
- size === "sm" && "text-xs",
2137
- size === "md" && "text-sm",
2138
- className
2139
- ),
2140
- ...props
2141
- }
2142
- );
2143
- });
2144
- SidebarMenuSubButton.displayName = "SidebarMenuSubButton";
2145
- }
2146
- });
2147
- function Spinner({ size = "md", className }) {
2148
- const sizeClasses = {
2149
- sm: "h-4 w-4",
2150
- md: "h-6 w-6",
2151
- lg: "h-8 w-8"
2152
- };
2153
- return /* @__PURE__ */ jsx(
2154
- "div",
2155
- {
2156
- className: cn(
2157
- "animate-spin rounded-full border-2 border-current border-t-transparent",
2158
- sizeClasses[size],
2159
- className
2160
- )
2161
- }
2162
- );
2163
- }
2164
- var Textarea, ButtonLoading;
2165
- var init_primitives = __esm({
2166
- "src/ui/primitives/index.tsx"() {
2167
- init_utils();
2168
- init_button();
2169
- init_badge();
2170
- init_button();
2171
- init_input();
2172
- init_checkbox();
2173
- init_card();
2174
- init_separator();
2175
- init_card();
2176
- init_table();
2177
- init_dropdown_menu();
2178
- init_dialog();
2179
- init_tabs();
2180
- init_breadcrumb();
2181
- init_keyboard();
2182
- init_pagination();
2183
- init_status_badge();
2184
- init_sidebar2();
2185
- init_popover();
2186
- init_scroll_area();
2187
- init_calendar();
2188
- init_resizable();
2189
- init_slider();
2190
- init_switch();
2191
- init_tooltip();
2192
- init_select();
2193
- init_menubar();
2194
- init_navigation_menu();
2195
- init_toggle();
2196
- init_toggle_group();
2197
- init_combobox();
2198
- init_label();
2199
- Textarea = React12.forwardRef(
2200
- ({ className, ...props }, ref) => {
2201
- return /* @__PURE__ */ jsx(
2202
- "textarea",
2203
- {
2204
- className: cn(
2205
- "flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
2206
- className
2207
- ),
2208
- ref,
2209
- ...props
2210
- }
2211
- );
2212
- }
2213
- );
2214
- Textarea.displayName = "Textarea";
2215
- ButtonLoading = React12.forwardRef(({ className, isLoading, children, disabled, ...props }, ref) => {
2216
- return /* @__PURE__ */ jsxs(
2217
- Button,
2218
- {
2219
- className: cn("gap-2", className),
2220
- disabled: isLoading || disabled,
2221
- ref,
2222
- ...props,
2223
- children: [
2224
- isLoading && /* @__PURE__ */ jsx(Spinner, { size: "sm" }),
2225
- children
2226
- ]
2227
- }
2228
- );
2229
- });
2230
- ButtonLoading.displayName = "ButtonLoading";
2231
- }
2232
- });
2233
- var init_radio_group = __esm({
2234
- "src/ui/forms/radio-group.tsx"() {
2235
- "use client";
2236
- }
2237
- });
2238
- var init_rating = __esm({
2239
- "src/ui/forms/rating.tsx"() {
2240
- "use client";
2241
- cva(
2242
- "transition-all duration-100 ease-in-out hover:scale-110",
2243
- {
2244
- variants: {
2245
- size: {
2246
- sm: "w-4 h-4",
2247
- default: "w-6 h-6",
2248
- lg: "w-8 h-8"
2249
- },
2250
- variant: {
2251
- default: "text-yellow-400",
2252
- primary: "text-primary",
2253
- muted: "text-muted-foreground"
2254
- },
2255
- filled: {
2256
- true: "",
2257
- false: "text-gray-200"
2258
- }
2259
- },
2260
- defaultVariants: {
2261
- size: "default",
2262
- variant: "default",
2263
- filled: false
2264
- }
2265
- }
2266
- );
2267
- }
2268
- });
2269
- var init_command = __esm({
2270
- "src/ui/forms/command.tsx"() {
2271
- "use client";
2272
- }
2273
- });
2274
- var MultiSelect;
2275
- var init_multi_select = __esm({
2276
- "src/ui/forms/multi-select.tsx"() {
2277
- "use client";
2278
- init_utils();
2279
- init_primitives();
2280
- init_client();
2281
- MultiSelect = React12.forwardRef(
2282
- ({
2283
- options,
2284
- value: controlledValue,
2285
- onValueChange,
2286
- defaultValue = [],
2287
- placeholder = "Select options...",
2288
- searchPlaceholder = "Search...",
2289
- emptyText = "No option found.",
2290
- maxCount = 3,
2291
- disabled = false,
2292
- responsive = false,
2293
- className,
2294
- id
2295
- }, ref) => {
2296
- const [internalValue, setInternalValue] = useState(defaultValue);
2297
- const [open, setOpen] = useState(false);
2298
- const [searchValue, setSearchValue] = useState("");
2299
- const isControlled = controlledValue !== void 0;
2300
- const value = isControlled ? controlledValue : internalValue;
2301
- const containerRef = useRef(null);
2302
- const searchInputRef = useRef(null);
2303
- const dropdownRef = useRef(null);
2304
- const buttonRef = useRef(null);
2305
- const [politeMessage, setPoliteMessage] = useState("");
2306
- const [assertiveMessage, setAssertiveMessage] = useState("");
2307
- const prevSelectedCount = useRef(value.length);
2308
- const announce = useCallback(
2309
- (message, priority = "polite") => {
2310
- if (priority === "assertive") {
2311
- setAssertiveMessage(message);
2312
- setTimeout(() => setAssertiveMessage(""), 100);
2313
- } else {
2314
- setPoliteMessage(message);
2315
- setTimeout(() => setPoliteMessage(""), 100);
2316
- }
2317
- },
2318
- []
2319
- );
2320
- const [screenSize, setScreenSize] = useState("desktop");
2321
- useEffect(() => {
2322
- if (typeof window === "undefined") return;
2323
- const handleResize = () => {
2324
- const width = window.innerWidth;
2325
- if (width < 640) {
2326
- setScreenSize("mobile");
2327
- } else if (width < 1024) {
2328
- setScreenSize("tablet");
2329
- } else {
2330
- setScreenSize("desktop");
2331
- }
2332
- };
2333
- handleResize();
2334
- window.addEventListener("resize", handleResize);
2335
- return () => window.removeEventListener("resize", handleResize);
2336
- }, []);
2337
- const getResponsiveSettings = useCallback(() => {
2338
- if (!responsive) {
2339
- return {
2340
- maxCount,
2341
- compactMode: false
2342
- };
2343
- }
2344
- if (responsive === true) {
2345
- const defaultResponsive = {
2346
- mobile: { maxCount: 2, compactMode: true },
2347
- tablet: { maxCount: 4, compactMode: false },
2348
- desktop: { maxCount: 6, compactMode: false }
2349
- };
2350
- const currentSettings2 = defaultResponsive[screenSize];
2351
- return {
2352
- maxCount: currentSettings2?.maxCount ?? maxCount,
2353
- compactMode: currentSettings2?.compactMode ?? false
2354
- };
2355
- }
2356
- const currentSettings = responsive[screenSize];
2357
- return {
2358
- maxCount: currentSettings?.maxCount ?? maxCount,
2359
- compactMode: currentSettings?.compactMode ?? false
2360
- };
2361
- }, [responsive, screenSize, maxCount]);
2362
- const responsiveSettings = getResponsiveSettings();
2363
- const filteredOptions = useMemo(() => {
2364
- if (!searchValue.trim()) {
2365
- return options;
2366
- }
2367
- const searchLower = searchValue.toLowerCase();
2368
- return options.filter(
2369
- (option) => option.label.toLowerCase().includes(searchLower) || String(option.value).toLowerCase().includes(searchLower)
2370
- );
2371
- }, [options, searchValue]);
2372
- useEffect(() => {
2373
- if (!open) {
2374
- setSearchValue("");
2375
- }
2376
- }, [open]);
2377
- useEffect(() => {
2378
- if (open && searchInputRef.current) {
2379
- setTimeout(() => {
2380
- searchInputRef.current?.focus();
2381
- }, 50);
2382
- }
2383
- }, [open]);
2384
- useEffect(() => {
2385
- if (!open) return;
2386
- const handleClickOutside = (event) => {
2387
- const target = event.target;
2388
- if (containerRef.current && !containerRef.current.contains(target) && dropdownRef.current && !dropdownRef.current.contains(target)) {
2389
- if (target.closest('[data-slot="dialog-content"]')) {
2390
- return;
2391
- }
2392
- setOpen(false);
2393
- }
2394
- };
2395
- const handleEscape = (event) => {
2396
- if (event.key === "Escape" && open) {
2397
- event.stopPropagation();
2398
- setOpen(false);
2399
- }
2400
- };
2401
- document.addEventListener("mousedown", handleClickOutside, true);
2402
- document.addEventListener("keydown", handleEscape, true);
2403
- return () => {
2404
- document.removeEventListener("mousedown", handleClickOutside, true);
2405
- document.removeEventListener("keydown", handleEscape, true);
2406
- };
2407
- }, [open]);
2408
- useEffect(() => {
2409
- const selectedCount = value.length;
2410
- const totalOptions = options.filter((opt) => !opt.disabled).length;
2411
- if (selectedCount !== prevSelectedCount.current) {
2412
- const diff = selectedCount - prevSelectedCount.current;
2413
- if (diff > 0) {
2414
- announce(`${selectedCount} of ${totalOptions} options selected.`);
2415
- } else if (diff < 0) {
2416
- announce(
2417
- `Option removed. ${selectedCount} of ${totalOptions} options selected.`
2418
- );
2419
- }
2420
- prevSelectedCount.current = selectedCount;
2421
- }
2422
- }, [value, announce, options]);
2423
- const updateValue = useCallback(
2424
- (newValue) => {
2425
- if (!isControlled) {
2426
- setInternalValue(newValue);
2427
- }
2428
- onValueChange?.(newValue);
2429
- },
2430
- [isControlled, onValueChange]
2431
- );
2432
- const handleSelect = useCallback(
2433
- (optionValue) => {
2434
- const option = options.find((opt) => opt.value === optionValue);
2435
- if (option?.disabled) {
2436
- return;
2437
- }
2438
- const newValue = value.includes(optionValue) ? value.filter((v) => v !== optionValue) : [...value, optionValue];
2439
- updateValue(newValue);
2440
- },
2441
- [value, options, updateValue]
2442
- );
2443
- const handleSelectAll = useCallback(() => {
2444
- updateValue(
2445
- filteredOptions.filter((opt) => !opt.disabled).map((opt) => opt.value)
2446
- );
2447
- }, [updateValue, filteredOptions]);
2448
- const handleClearAll = useCallback(() => {
2449
- updateValue([]);
2450
- }, [updateValue]);
2451
- const handleRemove = useCallback(
2452
- (optionValue, e) => {
2453
- e.stopPropagation();
2454
- updateValue(value.filter((v) => v !== optionValue));
2455
- },
2456
- [updateValue, value]
2457
- );
2458
- const clearExtraOptions = useCallback(() => {
2459
- const newSelectedValues = value.slice(0, responsiveSettings.maxCount);
2460
- updateValue(newSelectedValues);
2461
- }, [value, responsiveSettings.maxCount, updateValue]);
2462
- React12.useImperativeHandle(
2463
- ref,
2464
- () => ({
2465
- reset: () => {
2466
- updateValue(defaultValue);
2467
- setOpen(false);
2468
- setSearchValue("");
2469
- },
2470
- getSelectedValues: () => value,
2471
- setSelectedValues: (values) => {
2472
- updateValue(values);
2473
- },
2474
- clear: () => {
2475
- updateValue([]);
2476
- },
2477
- focus: () => {
2478
- buttonRef.current?.focus();
2479
- }
2480
- }),
2481
- [value, defaultValue, updateValue]
2482
- );
2483
- const selectedOptions = options.filter(
2484
- (option) => value.includes(option.value)
2485
- );
2486
- const getBadgeColor = (index) => {
2487
- const colors = [
2488
- "bg-blue-100 text-blue-700 hover:bg-blue-200",
2489
- "bg-green-100 text-green-700 hover:bg-green-200",
2490
- "bg-purple-100 text-purple-700 hover:bg-purple-200",
2491
- "bg-orange-100 text-orange-700 hover:bg-orange-200",
2492
- "bg-pink-100 text-pink-700 hover:bg-pink-200",
2493
- "bg-cyan-100 text-cyan-700 hover:bg-cyan-200"
2494
- ];
2495
- return colors[index % colors.length];
2496
- };
2497
- return /* @__PURE__ */ jsxs("div", { ref: containerRef, className: "relative w-full", children: [
2498
- /* @__PURE__ */ jsxs("div", { className: "sr-only", children: [
2499
- /* @__PURE__ */ jsx("div", { "aria-live": "polite", "aria-atomic": "true", role: "status", children: politeMessage }),
2500
- /* @__PURE__ */ jsx("div", { "aria-live": "assertive", "aria-atomic": "true", role: "alert", children: assertiveMessage })
2501
- ] }),
2502
- /* @__PURE__ */ jsxs(
2503
- Button,
2504
- {
2505
- ref: buttonRef,
2506
- type: "button",
2507
- variant: "outline",
2508
- role: "combobox",
2509
- "aria-expanded": open,
2510
- disabled,
2511
- className: cn(
2512
- "w-full justify-between h-auto min-h-10 px-3 py-2",
2513
- responsiveSettings.compactMode && "min-h-8 text-sm",
2514
- className
2515
- ),
2516
- id,
2517
- onClick: (e) => {
2518
- e.stopPropagation();
2519
- setOpen(!open);
2520
- },
2521
- children: [
2522
- /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1", children: selectedOptions.length > 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
2523
- selectedOptions.slice(0, responsiveSettings.maxCount).map((option, index) => /* @__PURE__ */ jsxs(
2524
- Badge,
2525
- {
2526
- className: cn(
2527
- "mr-1 mb-1",
2528
- getBadgeColor(index),
2529
- responsiveSettings.compactMode && "text-xs px-1.5 py-0.5"
2530
- ),
2531
- onClick: (e) => handleRemove(option.value, e),
2532
- children: [
2533
- option.icon && !responsiveSettings.compactMode && /* @__PURE__ */ jsx(option.icon, { className: "mr-2 h-4 w-4" }),
2534
- option.label,
2535
- /* @__PURE__ */ jsx(
2536
- "div",
2537
- {
2538
- role: "button",
2539
- tabIndex: 0,
2540
- className: "ml-1 ring-offset-background rounded-full outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 cursor-pointer",
2541
- onKeyDown: (e) => {
2542
- if (e.key === "Enter") {
2543
- handleRemove(option.value, e);
2544
- }
2545
- },
2546
- onMouseDown: (e) => {
2547
- e.preventDefault();
2548
- e.stopPropagation();
2549
- },
2550
- onClick: (e) => handleRemove(option.value, e),
2551
- children: /* @__PURE__ */ jsx(X, { className: "h-3 w-3 text-muted-foreground hover:text-foreground" })
2552
- }
2553
- )
2554
- ]
2555
- },
2556
- String(option.value)
2557
- )),
2558
- value.length > responsiveSettings.maxCount && /* @__PURE__ */ jsxs(
2559
- Badge,
2560
- {
2561
- className: cn(
2562
- "mr-1 mb-1 bg-muted text-muted-foreground hover:bg-muted",
2563
- responsiveSettings.compactMode && "text-xs px-1.5 py-0.5"
2564
- ),
2565
- children: [
2566
- "+",
2567
- value.length - responsiveSettings.maxCount,
2568
- " more",
2569
- /* @__PURE__ */ jsx(
2570
- "div",
2571
- {
2572
- role: "button",
2573
- tabIndex: 0,
2574
- className: "ml-1 ring-offset-background rounded-full outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 cursor-pointer",
2575
- onClick: (e) => {
2576
- e.stopPropagation();
2577
- clearExtraOptions();
2578
- },
2579
- children: /* @__PURE__ */ jsx(X, { className: "h-3 w-3" })
2580
- }
2581
- )
2582
- ]
2583
- }
2584
- )
2585
- ] }) : /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: placeholder }) }),
2586
- /* @__PURE__ */ jsx(ChevronsUpDown, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })
2587
- ]
2588
- }
2589
- ),
2590
- open && /* @__PURE__ */ jsx(
2591
- "div",
2592
- {
2593
- ref: dropdownRef,
2594
- className: "absolute z-[100] mt-1 w-full rounded-md border bg-popover text-popover-foreground shadow-md",
2595
- style: {
2596
- top: "100%",
2597
- left: 0
2598
- },
2599
- children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
2600
- /* @__PURE__ */ jsxs("div", { className: "flex items-center border-b px-3 py-2", children: [
2601
- /* @__PURE__ */ jsx(Search, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }),
2602
- /* @__PURE__ */ jsx(
2603
- Input,
2604
- {
2605
- ref: searchInputRef,
2606
- placeholder: searchPlaceholder,
2607
- value: searchValue,
2608
- onChange: (e) => {
2609
- e.stopPropagation();
2610
- setSearchValue(e.target.value);
2611
- },
2612
- onKeyDown: (e) => {
2613
- e.stopPropagation();
2614
- if (e.key === "Escape") {
2615
- e.preventDefault();
2616
- setOpen(false);
2617
- }
2618
- },
2619
- onClick: (e) => {
2620
- e.stopPropagation();
2621
- },
2622
- onFocus: (e) => {
2623
- e.stopPropagation();
2624
- },
2625
- className: "border-0 focus-visible:ring-0 focus-visible:ring-offset-0 h-9 bg-transparent px-0"
2626
- }
2627
- ),
2628
- searchValue && /* @__PURE__ */ jsx(
2629
- Button,
2630
- {
2631
- type: "button",
2632
- variant: "ghost",
2633
- size: "sm",
2634
- className: "h-6 w-6 p-0",
2635
- onClick: (e) => {
2636
- e.stopPropagation();
2637
- setSearchValue("");
2638
- searchInputRef.current?.focus();
2639
- },
2640
- children: /* @__PURE__ */ jsx(X, { className: "h-3 w-3" })
2641
- }
2642
- )
2643
- ] }),
2644
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between border-b p-1", children: [
2645
- /* @__PURE__ */ jsx(
2646
- Button,
2647
- {
2648
- type: "button",
2649
- variant: "ghost",
2650
- size: "sm",
2651
- className: "h-8 px-2 text-xs",
2652
- onClick: (e) => {
2653
- e.stopPropagation();
2654
- handleSelectAll();
2655
- },
2656
- children: "Select All"
2657
- }
2658
- ),
2659
- /* @__PURE__ */ jsx(
2660
- Button,
2661
- {
2662
- type: "button",
2663
- variant: "ghost",
2664
- size: "sm",
2665
- className: "h-8 px-2 text-xs",
2666
- onClick: (e) => {
2667
- e.stopPropagation();
2668
- handleClearAll();
2669
- },
2670
- children: "Clear All"
2671
- }
2672
- )
2673
- ] }),
2674
- /* @__PURE__ */ jsx(ScrollArea, { className: "max-h-[300px]", children: filteredOptions.length === 0 ? /* @__PURE__ */ jsx("div", { className: "py-6 text-center text-sm text-muted-foreground", children: emptyText }) : /* @__PURE__ */ jsx("div", { className: "p-1", children: filteredOptions.map((option) => {
2675
- const isSelected = value.includes(option.value);
2676
- const isDisabled = option.disabled || false;
2677
- return /* @__PURE__ */ jsxs(
2678
- "div",
2679
- {
2680
- role: "option",
2681
- "aria-selected": isSelected,
2682
- "aria-disabled": isDisabled,
2683
- className: cn(
2684
- "relative flex select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none",
2685
- isDisabled ? "cursor-not-allowed opacity-50" : "cursor-pointer hover:bg-accent hover:text-accent-foreground",
2686
- isSelected && !isDisabled && "bg-accent text-accent-foreground"
2687
- ),
2688
- onMouseDown: (e) => {
2689
- e.preventDefault();
2690
- e.stopPropagation();
2691
- },
2692
- onClick: (e) => {
2693
- e.preventDefault();
2694
- e.stopPropagation();
2695
- if (!isDisabled) {
2696
- handleSelect(option.value);
2697
- }
2698
- },
2699
- children: [
2700
- /* @__PURE__ */ jsx(
2701
- "div",
2702
- {
2703
- className: cn(
2704
- "mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",
2705
- isSelected ? "bg-primary text-primary-foreground" : "opacity-50 [&_svg]:invisible"
2706
- ),
2707
- children: /* @__PURE__ */ jsx(Check, { className: cn("h-4 w-4") })
2708
- }
2709
- ),
2710
- option.icon && /* @__PURE__ */ jsx(option.icon, { className: "mr-2 h-4 w-4 text-muted-foreground" }),
2711
- /* @__PURE__ */ jsx("span", { className: "flex-1 truncate", children: option.label })
2712
- ]
2713
- },
2714
- String(option.value)
2715
- );
2716
- }) }) }),
2717
- /* @__PURE__ */ jsx("div", { className: "border-t p-2", children: /* @__PURE__ */ jsx(
2718
- Button,
2719
- {
2720
- type: "button",
2721
- variant: "outline",
2722
- size: "sm",
2723
- className: "w-full h-8 text-xs",
2724
- onClick: (e) => {
2725
- e.stopPropagation();
2726
- setOpen(false);
2727
- },
2728
- children: "Close"
2729
- }
2730
- ) })
2731
- ] })
2732
- }
2733
- )
2734
- ] });
2735
- }
2736
- );
2737
- MultiSelect.displayName = "MultiSelect";
2738
- }
2739
- });
2740
- var init_date_picker = __esm({
2741
- "src/ui/forms/date-picker.tsx"() {
2742
- "use client";
2743
- }
2744
- });
2745
- var init_date_range_picker = __esm({
2746
- "src/ui/forms/date-range-picker.tsx"() {
2747
- "use client";
2748
- }
2749
- });
2750
- var init_input_time = __esm({
2751
- "src/ui/forms/input-time.tsx"() {
2752
- "use client";
2753
- }
2754
- });
2755
- var init_date_time_picker = __esm({
2756
- "src/ui/forms/date-time-picker.tsx"() {
2757
- "use client";
2758
- }
2759
- });
2760
- var init_emoji_picker = __esm({
2761
- "src/ui/forms/emoji-picker.tsx"() {
2762
- "use client";
2763
- dynamic(
2764
- () => {
2765
- return import('emoji-picker-react');
2766
- },
2767
- { ssr: false }
2768
- );
2769
- }
2770
- });
2771
- var init_file_thumbnail = __esm({
2772
- "src/ui/forms/file-thumbnail.tsx"() {
2773
- }
2774
- });
2775
- var init_file_dropzone = __esm({
2776
- "src/ui/forms/file-dropzone.tsx"() {
2777
- "use client";
2778
- }
2779
- });
2780
- var init_input_file = __esm({
2781
- "src/ui/forms/input-file.tsx"() {
2782
- "use client";
2783
- }
2784
- });
2785
- var init_input_group = __esm({
2786
- "src/ui/forms/input-group.tsx"() {
2787
- "use client";
2788
- }
2789
- });
2790
- var init_input_otp = __esm({
2791
- "src/ui/forms/input-otp.tsx"() {
2792
- "use client";
2793
- }
2794
- });
2795
- var init_input_phone = __esm({
2796
- "src/ui/forms/input-phone.tsx"() {
2797
- "use client";
2798
- }
2799
- });
2800
- var init_input_spin = __esm({
2801
- "src/ui/forms/input-spin.tsx"() {
2802
- "use client";
2803
- }
2804
- });
2805
- var init_input_tags = __esm({
2806
- "src/ui/forms/input-tags.tsx"() {
2807
- "use client";
2808
- }
2809
- });
2810
- var init_multiple_date_picker = __esm({
2811
- "src/ui/forms/multiple-date-picker.tsx"() {
2812
- "use client";
2813
- }
2814
- });
2815
- var init_time_picker = __esm({
2816
- "src/ui/forms/time-picker.tsx"() {
2817
- "use client";
2818
- }
2819
- });
2820
- var init_editor = __esm({
2821
- "src/ui/forms/editor/index.tsx"() {
2822
- "use client";
2823
- }
2824
- });
2825
- function FormField(props) {
2826
- return /* @__PURE__ */ jsx(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsx(Controller, { ...props }) });
2827
- }
2828
- function useFormField() {
2829
- const fieldContext = useContext(FormFieldContext);
2830
- const itemContext = useContext(FormItemContext);
2831
- const { getFieldState, formState } = useFormContext();
2832
- const fieldState = getFieldState(fieldContext.name, formState);
2833
- if (!fieldContext) {
2834
- throw new Error("useFormField should be used within <FormField>");
2835
- }
2836
- const { id } = itemContext;
2837
- return {
2838
- id,
2839
- name: fieldContext.name,
2840
- formItemId: `${id}-form-item`,
2841
- formDescriptionId: `${id}-form-item-description`,
2842
- formMessageId: `${id}-form-item-message`,
2843
- ...fieldState
2844
- };
2845
- }
2846
- function FormItem({ className, ...props }) {
2847
- const id = useId();
2848
- return /* @__PURE__ */ jsx(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsx(
2849
- "div",
2850
- {
2851
- "data-slot": "form-item",
2852
- className: cn("grid gap-2", className),
2853
- ...props
2854
- }
2855
- ) });
2856
- }
2857
- function FormLabel({
2858
- className,
2859
- ...props
2860
- }) {
2861
- const { error, formItemId } = useFormField();
2862
- return /* @__PURE__ */ jsx(
2863
- Label3,
2864
- {
2865
- "data-slot": "form-label",
2866
- "data-error": !!error,
2867
- className: cn("data-[error=true]:text-destructive", className),
2868
- htmlFor: formItemId,
2869
- ...props
2870
- }
2871
- );
2872
- }
2873
- function FormControl({ ...props }) {
2874
- const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
2875
- return /* @__PURE__ */ jsx(
2876
- Slot,
2877
- {
2878
- "data-slot": "form-control",
2879
- id: formItemId,
2880
- "aria-describedby": !error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`,
2881
- "aria-invalid": !!error,
2882
- ...props
2883
- }
2884
- );
2885
- }
2886
- function FormMessage({
2887
- className,
2888
- children,
2889
- ...props
2890
- }) {
2891
- const { error, formMessageId } = useFormField();
2892
- const body = error ? String(error?.message) : children;
2893
- if (!body) {
2894
- return null;
2895
- }
2896
- return /* @__PURE__ */ jsx(
2897
- "p",
2898
- {
2899
- "data-slot": "form-message",
2900
- id: formMessageId,
2901
- className: cn("text-[0.8rem] font-medium text-destructive", className),
2902
- ...props,
2903
- children: body
2904
- }
2905
- );
2906
- }
2907
- var Form, FormFieldContext, FormItemContext;
2908
- var init_forms = __esm({
2909
- "src/ui/forms/index.tsx"() {
2910
- "use client";
2911
- init_utils();
2912
- init_client();
2913
- init_radio_group();
2914
- init_rating();
2915
- init_command();
2916
- init_multi_select();
2917
- init_date_picker();
2918
- init_date_range_picker();
2919
- init_date_time_picker();
2920
- init_emoji_picker();
2921
- init_file_dropzone();
2922
- init_file_thumbnail();
2923
- init_input_file();
2924
- init_input_group();
2925
- init_input_otp();
2926
- init_input_phone();
2927
- init_input_spin();
2928
- init_input_tags();
2929
- init_input_time();
2930
- init_multiple_date_picker();
2931
- init_time_picker();
2932
- init_editor();
2933
- Form = FormProvider;
2934
- FormFieldContext = createContext(
2935
- {}
2936
- );
2937
- FormItemContext = createContext(
2938
- {}
2939
- );
2940
- }
2941
- });
2942
- var init_formatted_number_input = __esm({
2943
- "src/ui/data-display/formatted-number-input.tsx"() {
2944
- "use client";
2945
- }
2946
- });
2947
- var init_data_table_pagination = __esm({
2948
- "src/ui/data-display/data-table-pagination.tsx"() {
2949
- "use client";
2950
- }
2951
- });
2952
- var init_kpi_card = __esm({
2953
- "src/ui/data-display/kpi-card.tsx"() {
2954
- "use client";
2955
- }
2956
- });
2957
- var THEME_STYLES;
2958
- var init_compact_stat_bar = __esm({
2959
- "src/ui/data-display/compact-stat-bar.tsx"() {
2960
- init_utils();
2961
- THEME_STYLES = {
2962
- dark: {
2963
- wrapper: "hover:bg-[#181d26]/5 dark:hover:bg-slate-100/5",
2964
- box: "bg-[#181d26] group-hover:bg-[#0a2e0e] dark:bg-slate-800 dark:group-hover:bg-slate-700",
2965
- icon: "text-white",
2966
- label: "text-[#181d26] dark:text-slate-300"
2967
- },
2968
- green: {
2969
- wrapper: "hover:bg-[#006400]/10",
2970
- box: "bg-[#006400] group-hover:bg-[#39bf45]",
2971
- icon: "text-white",
2972
- label: "text-[#006400] dark:text-[#39bf45]"
2973
- },
2974
- blue: {
2975
- wrapper: "hover:bg-[#254fad]/10",
2976
- box: "bg-[#254fad] group-hover:bg-[#1d3d8f]",
2977
- icon: "text-white",
2978
- label: "text-[#254fad] dark:text-[#60a5fa]"
2979
- },
2980
- purple: {
2981
- wrapper: "hover:bg-[#7C3AED]/10",
2982
- box: "bg-[#7C3AED] group-hover:bg-[#6D28D9]",
2983
- icon: "text-white",
2984
- label: "text-[#7C3AED] dark:text-[#a78bfa]"
2985
- },
2986
- orange: {
2987
- wrapper: "hover:bg-[#EA580C]/10",
2988
- box: "bg-[#EA580C] group-hover:bg-[#C2410C]",
2989
- icon: "text-white",
2990
- label: "text-[#EA580C] dark:text-[#fb923c]"
2991
- },
2992
- emerald: {
2993
- wrapper: "hover:bg-[#059669]/10",
2994
- box: "bg-[#059669] group-hover:bg-[#047857]",
2995
- icon: "text-white",
2996
- label: "text-[#059669] dark:text-[#34d399]"
2997
- },
2998
- primary: {
2999
- wrapper: "hover:bg-primary/10",
3000
- box: "bg-primary group-hover:bg-primary/90",
3001
- icon: "text-primary-foreground",
3002
- label: "text-primary"
3003
- },
3004
- destructive: {
3005
- wrapper: "hover:bg-destructive/10",
3006
- box: "bg-destructive group-hover:bg-destructive/90",
3007
- icon: "text-destructive-foreground",
3008
- label: "text-destructive"
3009
- },
3010
- muted: {
3011
- wrapper: "hover:bg-muted/50",
3012
- box: "bg-muted group-hover:bg-muted-foreground/20",
3013
- icon: "text-muted-foreground",
3014
- label: "text-muted-foreground"
3015
- },
3016
- rose: {
3017
- wrapper: "hover:bg-[#E11D48]/10",
3018
- box: "bg-[#E11D48] group-hover:bg-[#BE123C]",
3019
- icon: "text-white",
3020
- label: "text-[#E11D48] dark:text-[#fb7185]"
3021
- }
3022
- };
3023
- memo(function CompactStatBar2({
3024
- items,
3025
- className
3026
- }) {
3027
- if (!items || items.length === 0) return null;
3028
- return /* @__PURE__ */ jsx("div", { className: cn("flex flex-col md:flex-row md:items-stretch gap-2 pb-1", className), children: /* @__PURE__ */ jsx("div", { className: "flex items-stretch overflow-x-auto no-scrollbar flex-1 bg-white dark:bg-[#1e293b] border border-slate-200 dark:border-slate-800 shadow-sm rounded-[10px] divide-x divide-slate-100 dark:divide-slate-800", children: items.map((item) => {
3029
- const theme = THEME_STYLES[item.colorTheme || "dark"];
3030
- const Icon2 = item.icon;
3031
- return /* @__PURE__ */ jsxs(
3032
- "div",
3033
- {
3034
- className: cn(
3035
- "flex items-center gap-3 min-w-fit px-5 py-2 flex-1 transition-colors group cursor-default",
3036
- theme.wrapper
3037
- ),
3038
- children: [
3039
- /* @__PURE__ */ jsx(
3040
- "div",
3041
- {
3042
- className: cn(
3043
- "p-1.5 rounded-md transition-colors shadow-sm shrink-0",
3044
- theme.box
3045
- ),
3046
- children: /* @__PURE__ */ jsx(Icon2, { className: cn("w-3.5 h-3.5", theme.icon), strokeWidth: 2.5 })
3047
- }
3048
- ),
3049
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
3050
- /* @__PURE__ */ jsx(
3051
- "span",
3052
- {
3053
- className: cn(
3054
- "text-[9px] font-bold uppercase tracking-wider mb-0.5",
3055
- item.isHighlighted ? "text-emerald-600 dark:text-emerald-400" : theme.label
3056
- ),
3057
- children: item.label
3058
- }
3059
- ),
3060
- /* @__PURE__ */ jsx("span", { className: cn(
3061
- "font-black leading-none",
3062
- item.isHighlighted ? "text-[22px] text-emerald-700 dark:text-emerald-400" : "text-[17px] text-slate-900 dark:text-white"
3063
- ), children: item.value })
3064
- ] })
3065
- ]
3066
- },
3067
- item.id
3068
- );
3069
- }) }) });
3070
- });
3071
- }
3072
- });
3073
- var init_show_more_text = __esm({
3074
- "src/ui/data-display/show-more-text.tsx"() {
3075
- "use client";
3076
- }
3077
- });
3078
- var init_chart = __esm({
3079
- "src/ui/data-display/chart.tsx"() {
3080
- "use client";
3081
- createContext(null);
3082
- }
3083
- });
3084
- var init_carousel = __esm({
3085
- "src/ui/data-display/carousel.tsx"() {
3086
- "use client";
3087
- createContext(null);
3088
- }
3089
- });
3090
- var init_accordion = __esm({
3091
- "src/ui/data-display/accordion.tsx"() {
3092
- "use client";
3093
- }
3094
- });
3095
- var init_kanban_item = __esm({
3096
- "src/ui/data-display/kanban/kanban-item.tsx"() {
3097
- }
3098
- });
3099
- var init_kanban_column = __esm({
3100
- "src/ui/data-display/kanban/kanban-column.tsx"() {
3101
- }
3102
- });
3103
- var init_kanban_board = __esm({
3104
- "src/ui/data-display/kanban/kanban-board.tsx"() {
3105
- }
3106
- });
3107
-
3108
- // src/ui/data-display/kanban/kanban-types.ts
3109
- var init_kanban_types = __esm({
3110
- "src/ui/data-display/kanban/kanban-types.ts"() {
3111
- }
3112
- });
3113
-
3114
- // src/ui/data-display/kanban/index.ts
3115
- var init_kanban = __esm({
3116
- "src/ui/data-display/kanban/index.ts"() {
3117
- init_kanban_board();
3118
- init_kanban_column();
3119
- init_kanban_item();
3120
- init_kanban_types();
3121
- }
3122
- });
3123
- var init_aspect_ratio = __esm({
3124
- "src/ui/data-display/aspect-ratio.tsx"() {
3125
- "use client";
3126
- }
3127
- });
3128
- var init_bento_grid = __esm({
3129
- "src/ui/data-display/bento-grid.tsx"() {
3130
- }
3131
- });
3132
- var init_highlight = __esm({
3133
- "src/ui/data-display/highlight.tsx"() {
3134
- }
3135
- });
3136
- var init_code_block_highlight = __esm({
3137
- "src/ui/data-display/code-block-highlight.tsx"() {
3138
- "use client";
3139
- }
3140
- });
3141
- var init_collapsible = __esm({
3142
- "src/ui/data-display/collapsible.tsx"() {
3143
- "use client";
3144
- }
3145
- });
3146
- var init_hover_card = __esm({
3147
- "src/ui/data-display/hover-card.tsx"() {
3148
- "use client";
3149
- }
3150
- });
3151
- var init_iphone_15_pro = __esm({
3152
- "src/ui/data-display/iphone-15-pro.tsx"() {
3153
- }
3154
- });
3155
- var init_media_grid = __esm({
3156
- "src/ui/data-display/media-grid.tsx"() {
3157
- "use client";
3158
- }
3159
- });
3160
- var init_safari = __esm({
3161
- "src/ui/data-display/safari.tsx"() {
3162
- }
3163
- });
3164
- var init_timeline = __esm({
3165
- "src/ui/data-display/timeline.tsx"() {
3166
- cva("grid", {
3167
- variants: {
3168
- align: {
3169
- left: "[&>li]:grid-cols-[0_min-content_1fr]",
3170
- right: "[&>li]:grid-cols-[1fr_min-content]",
3171
- center: "[&>li]:grid-cols-[1fr_min-content_1fr]"
3172
- }
3173
- },
3174
- defaultVariants: {
3175
- align: "left"
3176
- }
3177
- });
3178
- cva("grid items-center gap-x-2", {
3179
- variants: {
3180
- status: {
3181
- done: "text-foreground",
3182
- default: "text-muted-foreground"
3183
- }
3184
- },
3185
- defaultVariants: {
3186
- status: "default"
3187
- }
3188
- });
3189
- cva("row-start-2 row-end-2 pb-8", {
3190
- variants: {
3191
- side: {
3192
- start: "col-start-3 col-end-4 me-auto text-start",
3193
- end: "col-start-1 col-end-2 ms-auto text-end"
3194
- }
3195
- },
3196
- defaultVariants: {
3197
- side: "start"
3198
- }
3199
- });
3200
- cva(
3201
- "row-start-1 row-end-1 line-clamp-1 max-w-full truncate",
3202
- {
3203
- variants: {
3204
- side: {
3205
- start: "col-start-3 col-end-4 me-auto text-start",
3206
- end: "col-start-1 col-end-2 ms-auto text-end"
3207
- },
3208
- variant: {
3209
- primary: "text-base font-medium text-foreground",
3210
- secondary: "text-sm font-light text-muted-foreground"
3211
- }
3212
- },
3213
- defaultVariants: {
3214
- side: "start",
3215
- variant: "primary"
3216
- }
3217
- }
3218
- );
3219
- }
3220
- });
3221
-
3222
- // src/ui/data-display/data-table/index.ts
3223
- var init_data_table = __esm({
3224
- "src/ui/data-display/data-table/index.ts"() {
3225
- }
3226
- });
3227
-
3228
- // src/ui/data-display/index.tsx
3229
- var init_data_display = __esm({
3230
- "src/ui/data-display/index.tsx"() {
3231
- "use client";
3232
- init_formatted_number_input();
3233
- init_data_table_pagination();
3234
- init_avatar();
3235
- init_kpi_card();
3236
- init_compact_stat_bar();
3237
- init_show_more_text();
3238
- init_chart();
3239
- init_carousel();
3240
- init_accordion();
3241
- init_kanban();
3242
- init_aspect_ratio();
3243
- init_bento_grid();
3244
- init_code_block_highlight();
3245
- init_collapsible();
3246
- init_highlight();
3247
- init_hover_card();
3248
- init_iphone_15_pro();
3249
- init_media_grid();
3250
- init_safari();
3251
- init_timeline();
3252
- init_data_table();
3253
- }
3254
- });
3255
- var init_auth_layout = __esm({
3256
- "src/ui/auth/auth-layout.tsx"() {
3257
- "use client";
3258
- }
3259
- });
3260
- var init_sign_in_form = __esm({
3261
- "src/ui/auth/sign-in-form.tsx"() {
3262
- "use client";
3263
- }
3264
- });
3265
- var init_register_form = __esm({
3266
- "src/ui/auth/register-form.tsx"() {
3267
- "use client";
3268
- }
3269
- });
3270
- var init_oauth_links = __esm({
3271
- "src/ui/auth/oauth-links.tsx"() {
3272
- "use client";
3273
- }
3274
- });
3275
- var init_forgot_password_form = __esm({
3276
- "src/ui/auth/forgot-password-form.tsx"() {
3277
- "use client";
3278
- }
3279
- });
3280
- var init_new_password_form = __esm({
3281
- "src/ui/auth/new-password-form.tsx"() {
3282
- "use client";
3283
- }
3284
- });
3285
- var init_verify_email_form = __esm({
3286
- "src/ui/auth/verify-email-form.tsx"() {
3287
- "use client";
3288
- }
3289
- });
3290
-
3291
- // src/ui/auth/index.tsx
3292
- var init_auth = __esm({
3293
- "src/ui/auth/index.tsx"() {
3294
- init_auth_layout();
3295
- init_sign_in_form();
3296
- init_register_form();
3297
- init_oauth_links();
3298
- init_forgot_password_form();
3299
- init_new_password_form();
3300
- init_verify_email_form();
3301
- }
3302
- });
3303
- var init_job_management = __esm({
3304
- "src/ui/management/job-management.tsx"() {
3305
- "use client";
3306
- }
3307
- });
3308
- var init_audit_log_page = __esm({
3309
- "src/ui/management/audit-log-page.tsx"() {
3310
- "use client";
3311
- }
3312
- });
3313
- var init_cache_management = __esm({
3314
- "src/ui/management/cache-management.tsx"() {
3315
- "use client";
3316
- }
3317
- });
3318
-
3319
- // src/ui/management/index.ts
3320
- var init_management = __esm({
3321
- "src/ui/management/index.ts"() {
3322
- init_job_management();
3323
- init_audit_log_page();
3324
- init_cache_management();
3325
- }
3326
- });
3327
- var init_not_found = __esm({
3328
- "src/ui/pages/not-found.tsx"() {
3329
- }
3330
- });
3331
-
3332
- // src/ui/index.tsx
3333
- var init_ui = __esm({
3334
- "src/ui/index.tsx"() {
3335
- init_primitives();
3336
- init_client();
3337
- init_forms();
3338
- init_data_display();
3339
- init_feedback();
3340
- init_layout();
3341
- init_auth();
3342
- init_management();
3343
- init_not_found();
3344
- }
3345
- });
3346
-
3347
- // src/user/schemas.ts
3348
- init_utils();
3349
- var MAX_AVATAR_SIZE = 5e7;
3350
- var fomratedAvatarSize = formatFileSize(MAX_AVATAR_SIZE);
3351
- var ProfileInfoSchema = z.object({
3352
- firstName: z.string().trim().min(2, { message: "First Name must contain at least 2 characters." }).max(50, { message: "First Name must contain at most 50 characters." }),
3353
- lastName: z.string().trim().min(2, { message: "Last Name must contain at least 2 characters." }).max(50, { message: "Last Name must contain at most 50 characters." }),
3354
- username: z.string().toLowerCase().trim().min(3, { message: "Username must contain at least 3 characters." }).max(50, { message: "Username must contain at most 50 characters." }),
3355
- email: z.string().email({ message: "Invalid email address" }).toLowerCase().trim(),
3356
- phoneNumber: z.string().min(10, { message: "Phone Number must contain at least 10 digits." }).max(15, { message: "Username must contain at most 15 digits." }),
3357
- state: z.string().trim().min(2, { message: "State must contain at least 2 characters." }).max(50, { message: "State must contain at most 50 characters." }),
3358
- country: z.string().trim().min(2, { message: "Country must contain at least 2 characters." }).max(56, { message: "Country must contain at most 56 characters." }),
3359
- address: z.string().trim().min(2, { message: "Address must contain at least 2 characters." }).max(100, { message: "Address must contain at most 100 characters." }),
3360
- zipCode: z.string().min(5, { message: "Zip Code must contain at least 5 digits." }).max(10, { message: "Zip Code must contain at most 10 characters." }),
3361
- language: z.string(),
3362
- timeZone: z.string(),
3363
- currency: z.string(),
3364
- organization: z.string().trim().optional(),
3365
- avatar: z.instanceof(File).refine((avatar) => avatar.size <= MAX_AVATAR_SIZE, {
3366
- message: `Avatar must be ${fomratedAvatarSize} or less.`
3367
- }).optional()
3368
- });
3369
- var DeleteAccountSchema = z.object({});
3370
-
3371
- // src/user/components/dangerous-zone.tsx
3372
- init_ui();
3373
- init_ui();
3374
- function DeleteAccountForm({ user, dictionary }) {
3375
- const t = dictionary?.profile?.dangerZone;
3376
- const form = useForm({
3377
- resolver: zodResolver(DeleteAccountSchema),
3378
- defaultValues: {
3379
- ...user
3380
- }
3381
- });
3382
- const { isSubmitting } = form.formState;
3383
- return /* @__PURE__ */ jsxs("div", { className: "flex gap-x-2", children: [
3384
- /* @__PURE__ */ jsx(ButtonLoading, { isLoading: isSubmitting, variant: "outline", children: t?.disableAccount || "Disable Account" }),
3385
- /* @__PURE__ */ jsx(ButtonLoading, { isLoading: isSubmitting, variant: "destructive", children: t?.deleteAccount || "Delete Account" })
3386
- ] });
3387
- }
3388
- function DangerousZone({ user, dictionary }) {
3389
- const t = dictionary?.profile?.dangerZone;
3390
- return /* @__PURE__ */ jsxs(Card, { children: [
3391
- /* @__PURE__ */ jsxs(CardHeader, { children: [
3392
- /* @__PURE__ */ jsx(CardTitle, { children: t?.title || "Dangerous Zone" }),
3393
- /* @__PURE__ */ jsx(CardDescription, { children: t?.description || "Manage sensitive settings, such as account deletion or deactivation. Proceed with caution." })
3394
- ] }),
3395
- /* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsx(DeleteAccountForm, { user, dictionary }) })
3396
- ] });
3397
- }
3398
-
3399
- // src/user/components/profile-info.tsx
3400
- init_ui();
3401
- init_utils();
3402
- init_ui();
3403
- init_ui();
3404
- init_ui();
3405
- init_ui();
3406
- init_ui();
3407
- function ProfileInfoForm({ user, dictionary }) {
3408
- const t = dictionary?.profile;
3409
- const fields = t?.fields;
3410
- const placeholders = t?.placeholders;
3411
- const buttons = t?.buttons;
3412
- const [photoPreview, setPhotoPreview] = useState(
3413
- user?.avatar
3414
- );
3415
- const form = useForm({
3416
- resolver: zodResolver(ProfileInfoSchema),
3417
- values: {
3418
- ...user,
3419
- avatar: void 0
3420
- }
3421
- });
3422
- const { isSubmitting, isDirty } = form.formState;
3423
- const isDisabled = isSubmitting || !isDirty;
3424
- async function onSubmit(_data) {
3425
- }
3426
- function handleResetForm() {
3427
- form.reset();
3428
- setPhotoPreview(user?.avatar);
3429
- }
3430
- function handleUploadPhoto(e) {
3431
- const file = e.target.files?.[0];
3432
- if (file) {
3433
- const imageUrl = URL.createObjectURL(file);
3434
- setPhotoPreview(imageUrl);
3435
- form.setValue("avatar", file);
3436
- form.trigger("avatar");
3437
- }
3438
- }
3439
- function handleRemovePhoto() {
3440
- form.resetField("avatar");
3441
- setPhotoPreview(void 0);
3442
- }
3443
- return /* @__PURE__ */ jsx(Form, { ...form, children: /* @__PURE__ */ jsxs("form", { onSubmit: form.handleSubmit(onSubmit), className: "grid gap-y-3", children: [
3444
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-4", children: [
3445
- /* @__PURE__ */ jsxs(Avatar, { className: "size-22", children: [
3446
- /* @__PURE__ */ jsx(AvatarImage, { src: photoPreview, alt: "Profile Avatar" }),
3447
- /* @__PURE__ */ jsx(AvatarFallback, { children: getInitials(user.name) })
3448
- ] }),
3449
- /* @__PURE__ */ jsxs("div", { className: "grid gap-2", children: [
3450
- /* @__PURE__ */ jsx(
3451
- FormField,
3452
- {
3453
- control: form.control,
3454
- name: "avatar",
3455
- render: () => /* @__PURE__ */ jsxs(FormItem, { children: [
3456
- /* @__PURE__ */ jsx(
3457
- FormLabel,
3458
- {
3459
- className: cn(
3460
- buttonVariants({ variant: "default" }),
3461
- "cursor-pointer w-full"
3462
- ),
3463
- children: buttons?.uploadPhoto || "Upload Photo"
3464
- }
3465
- ),
3466
- /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(
3467
- Input,
3468
- {
3469
- type: "file",
3470
- accept: "image/*",
3471
- className: "hidden",
3472
- onChange: handleUploadPhoto
3473
- }
3474
- ) }),
3475
- /* @__PURE__ */ jsx(FormMessage, {})
3476
- ] })
3477
- }
3478
- ),
3479
- /* @__PURE__ */ jsx(
3480
- Button,
3481
- {
3482
- type: "button",
3483
- variant: "destructive",
3484
- onClick: handleRemovePhoto,
3485
- children: buttons?.removePhoto || "Remove Photo"
3486
- }
3487
- )
3488
- ] })
3489
- ] }),
3490
- /* @__PURE__ */ jsxs("div", { className: "grid gap-2 md:grid-cols-2", children: [
3491
- /* @__PURE__ */ jsx(
3492
- FormField,
3493
- {
3494
- control: form.control,
3495
- name: "firstName",
3496
- render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { className: "grow", children: [
3497
- /* @__PURE__ */ jsx(FormLabel, { children: fields?.firstName || "First Name" }),
3498
- /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Input, { type: "text", placeholder: placeholders?.firstName || "John", ...field }) }),
3499
- /* @__PURE__ */ jsx(FormMessage, {})
3500
- ] })
3501
- }
3502
- ),
3503
- /* @__PURE__ */ jsx(
3504
- FormField,
3505
- {
3506
- control: form.control,
3507
- name: "lastName",
3508
- render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { className: "grow", children: [
3509
- /* @__PURE__ */ jsx(FormLabel, { children: fields?.lastName || "Last Name" }),
3510
- /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Input, { type: "text", placeholder: placeholders?.lastName || "Doe", ...field }) }),
3511
- /* @__PURE__ */ jsx(FormMessage, {})
3512
- ] })
3513
- }
3514
- ),
3515
- /* @__PURE__ */ jsx(
3516
- FormField,
3517
- {
3518
- control: form.control,
3519
- name: "username",
3520
- render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
3521
- /* @__PURE__ */ jsx(FormLabel, { children: fields?.username || "Username" }),
3522
- /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Input, { type: "text", placeholder: placeholders?.username || "john_doe", ...field }) }),
3523
- /* @__PURE__ */ jsx(FormMessage, {})
3524
- ] })
3525
- }
3526
- ),
3527
- /* @__PURE__ */ jsx(
3528
- FormField,
3529
- {
3530
- control: form.control,
3531
- name: "email",
3532
- render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
3533
- /* @__PURE__ */ jsx(FormLabel, { children: fields?.email || "Email" }),
3534
- /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(
3535
- Input,
3536
- {
3537
- type: "email",
3538
- placeholder: placeholders?.email || "name@example.com",
3539
- ...field
3540
- }
3541
- ) }),
3542
- /* @__PURE__ */ jsx(FormMessage, {})
3543
- ] })
3544
- }
3545
- ),
3546
- /* @__PURE__ */ jsx(
3547
- FormField,
3548
- {
3549
- control: form.control,
3550
- name: "state",
3551
- render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
3552
- /* @__PURE__ */ jsx(FormLabel, { children: fields?.state || "State" }),
3553
- /* @__PURE__ */ jsxs(Select, { onValueChange: field.onChange, value: field.value, children: [
3554
- /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(SelectTrigger, { children: /* @__PURE__ */ jsx(SelectValue, { placeholder: placeholders?.selectState || "Select a state" }) }) }),
3555
- /* @__PURE__ */ jsx(SelectContent, { children: [
3556
- "Alabama",
3557
- "Alaska",
3558
- "Arizona",
3559
- "Arkansas",
3560
- "California",
3561
- "Colorado",
3562
- "Connecticut",
3563
- "Delaware",
3564
- "Florida",
3565
- "Georgia",
3566
- "Hawaii",
3567
- "Idaho",
3568
- "Illinois",
3569
- "Indiana",
3570
- "Iowa",
3571
- "Kansas",
3572
- "Kentucky",
3573
- "Louisiana",
3574
- "Maine",
3575
- "Maryland",
3576
- "Massachusetts",
3577
- "Michigan",
3578
- "Minnesota",
3579
- "Mississippi",
3580
- "Missouri",
3581
- "Montana",
3582
- "Nebraska",
3583
- "Nevada",
3584
- "New Hampshire",
3585
- "New Jersey",
3586
- "New Mexico",
3587
- "New York",
3588
- "North Carolina",
3589
- "North Dakota",
3590
- "Ohio",
3591
- "Oklahoma",
3592
- "Oregon",
3593
- "Pennsylvania",
3594
- "Rhode Island",
3595
- "South Carolina",
3596
- "South Dakota",
3597
- "Tennessee",
3598
- "Texas",
3599
- "Utah",
3600
- "Vermont",
3601
- "Virginia",
3602
- "Washington",
3603
- "West Virginia",
3604
- "Wisconsin",
3605
- "Wyoming"
3606
- ].map((state) => /* @__PURE__ */ jsx(SelectItem, { value: state, children: state }, state)) })
3607
- ] }),
3608
- /* @__PURE__ */ jsx(FormMessage, {})
3609
- ] })
3610
- }
3611
- ),
3612
- /* @__PURE__ */ jsx(
3613
- FormField,
3614
- {
3615
- control: form.control,
3616
- name: "country",
3617
- render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
3618
- /* @__PURE__ */ jsx(FormLabel, { children: fields?.country || "Country" }),
3619
- /* @__PURE__ */ jsxs(Select, { onValueChange: field.onChange, value: field.value, children: [
3620
- /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(SelectTrigger, { children: /* @__PURE__ */ jsx(SelectValue, { placeholder: placeholders?.selectCountry || "Select a country" }) }) }),
3621
- /* @__PURE__ */ jsx(SelectContent, { children: [
3622
- "United States",
3623
- "Canada",
3624
- "United Kingdom",
3625
- "Australia",
3626
- "Germany",
3627
- "France",
3628
- "Japan",
3629
- "China",
3630
- "India",
3631
- "Brazil"
3632
- ].map((country) => /* @__PURE__ */ jsx(SelectItem, { value: country, children: country }, country)) })
3633
- ] }),
3634
- /* @__PURE__ */ jsx(FormMessage, {})
3635
- ] })
3636
- }
3637
- ),
3638
- /* @__PURE__ */ jsx(
3639
- FormField,
3640
- {
3641
- control: form.control,
3642
- name: "address",
3643
- render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
3644
- /* @__PURE__ */ jsx(FormLabel, { children: fields?.address || "Address" }),
3645
- /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Input, { type: "text", placeholder: placeholders?.address || "123 Main St", ...field }) }),
3646
- /* @__PURE__ */ jsx(FormMessage, {})
3647
- ] })
3648
- }
3649
- ),
3650
- /* @__PURE__ */ jsx(
3651
- FormField,
3652
- {
3653
- control: form.control,
3654
- name: "zipCode",
3655
- render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
3656
- /* @__PURE__ */ jsx(FormLabel, { children: fields?.zipCode || "Zip Code" }),
3657
- /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Input, { type: "text", placeholder: placeholders?.zipCode || "90210", ...field }) }),
3658
- /* @__PURE__ */ jsx(FormMessage, {})
3659
- ] })
3660
- }
3661
- ),
3662
- /* @__PURE__ */ jsx(
3663
- FormField,
3664
- {
3665
- control: form.control,
3666
- name: "language",
3667
- render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
3668
- /* @__PURE__ */ jsx(FormLabel, { children: fields?.language || "Preferred Language" }),
3669
- /* @__PURE__ */ jsxs(Select, { onValueChange: field.onChange, value: field.value, children: [
3670
- /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(SelectTrigger, { children: /* @__PURE__ */ jsx(SelectValue, { placeholder: placeholders?.selectLanguage || "Select a language" }) }) }),
3671
- /* @__PURE__ */ jsx(SelectContent, { children: [
3672
- "English",
3673
- "Spanish",
3674
- "French",
3675
- "German",
3676
- "Chinese",
3677
- "Japanese",
3678
- "Arabic",
3679
- "Portuguese",
3680
- "Russian",
3681
- "Hindi"
3682
- ].map((language) => /* @__PURE__ */ jsx(SelectItem, { value: language, children: language }, language)) })
3683
- ] }),
3684
- /* @__PURE__ */ jsx(FormMessage, {})
3685
- ] })
3686
- }
3687
- ),
3688
- /* @__PURE__ */ jsx(
3689
- FormField,
3690
- {
3691
- control: form.control,
3692
- name: "timeZone",
3693
- render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
3694
- /* @__PURE__ */ jsx(FormLabel, { children: fields?.timeZone || "Time Zone" }),
3695
- /* @__PURE__ */ jsxs(Select, { onValueChange: field.onChange, value: field.value, children: [
3696
- /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(SelectTrigger, { children: /* @__PURE__ */ jsx(SelectValue, { placeholder: placeholders?.selectTimeZone || "Select a time zone" }) }) }),
3697
- /* @__PURE__ */ jsx(SelectContent, { children: [
3698
- "GMT-12:00",
3699
- "GMT-11:00",
3700
- "GMT-10:00",
3701
- "GMT-09:00",
3702
- "GMT-08:00",
3703
- "GMT-07:00",
3704
- "GMT-06:00",
3705
- "GMT-05:00",
3706
- "GMT-04:00",
3707
- "GMT-03:00",
3708
- "GMT-02:00",
3709
- "GMT-01:00",
3710
- "GMT+00:00",
3711
- "GMT+01:00",
3712
- "GMT+02:00",
3713
- "GMT+03:00",
3714
- "GMT+04:00",
3715
- "GMT+05:00",
3716
- "GMT+06:00",
3717
- "GMT+07:00",
3718
- "GMT+08:00",
3719
- "GMT+09:00",
3720
- "GMT+10:00",
3721
- "GMT+11:00",
3722
- "GMT+12:00"
3723
- ].map((timezone) => /* @__PURE__ */ jsx(SelectItem, { value: timezone, children: timezone }, timezone)) })
3724
- ] }),
3725
- /* @__PURE__ */ jsx(FormMessage, {})
3726
- ] })
3727
- }
3728
- ),
3729
- /* @__PURE__ */ jsx(
3730
- FormField,
3731
- {
3732
- control: form.control,
3733
- name: "currency",
3734
- render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
3735
- /* @__PURE__ */ jsx(FormLabel, { children: fields?.currency || "Currency" }),
3736
- /* @__PURE__ */ jsxs(Select, { onValueChange: field.onChange, value: field.value, children: [
3737
- /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(SelectTrigger, { children: /* @__PURE__ */ jsx(SelectValue, { placeholder: placeholders?.selectCurrency || "Select a currency" }) }) }),
3738
- /* @__PURE__ */ jsx(SelectContent, { children: [
3739
- "USD",
3740
- "EUR",
3741
- "GBP",
3742
- "JPY",
3743
- "CAD",
3744
- "AUD",
3745
- "CHF",
3746
- "CNY",
3747
- "INR",
3748
- "BRL"
3749
- ].map((currency) => /* @__PURE__ */ jsx(SelectItem, { value: currency, children: currency }, currency)) })
3750
- ] }),
3751
- /* @__PURE__ */ jsx(FormMessage, {})
3752
- ] })
3753
- }
3754
- ),
3755
- /* @__PURE__ */ jsx(
3756
- FormField,
3757
- {
3758
- control: form.control,
3759
- name: "organization",
3760
- render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
3761
- /* @__PURE__ */ jsx(FormLabel, { children: fields?.organization || "Organization (Optional)" }),
3762
- /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Input, { type: "text", placeholder: placeholders?.organization || "Company Name", ...field }) }),
3763
- /* @__PURE__ */ jsx(FormMessage, {})
3764
- ] })
3765
- }
3766
- )
3767
- ] }),
3768
- /* @__PURE__ */ jsxs("div", { className: "flex gap-x-2 mt-2", children: [
3769
- /* @__PURE__ */ jsx(
3770
- ButtonLoading,
3771
- {
3772
- isLoading: isSubmitting,
3773
- className: "w-fit",
3774
- disabled: isDisabled,
3775
- children: buttons?.save || "Save"
3776
- }
3777
- ),
3778
- /* @__PURE__ */ jsx(
3779
- Button,
3780
- {
3781
- type: "reset",
3782
- variant: "secondary",
3783
- className: "w-fit",
3784
- disabled: isDisabled,
3785
- onClick: handleResetForm,
3786
- children: buttons?.reset || "Reset"
3787
- }
3788
- )
3789
- ] })
3790
- ] }) });
3791
- }
3792
- function ProfileInfo({ user, dictionary }) {
3793
- const t = dictionary?.profile;
3794
- return /* @__PURE__ */ jsxs(Card, { children: [
3795
- /* @__PURE__ */ jsxs(CardHeader, { children: [
3796
- /* @__PURE__ */ jsx(CardTitle, { children: t?.title || "Profile Information" }),
3797
- /* @__PURE__ */ jsx(CardDescription, { children: t?.description || "Update your public profile details." })
3798
- ] }),
3799
- /* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsx(ProfileInfoForm, { user, dictionary }) })
3800
- ] });
3801
- }
3802
- function ProfilePage({ user, dictionary }) {
3803
- return /* @__PURE__ */ jsxs("div", { className: "grid gap-4", children: [
3804
- /* @__PURE__ */ jsx(ProfileInfo, { user, dictionary }),
3805
- /* @__PURE__ */ jsx(DangerousZone, { user, dictionary })
3806
- ] });
3807
- }
3808
-
3809
- // src/user/user-service.ts
3810
- async function getUsersData(db, params) {
3811
- const { page = 1, pageSize = 10, search, status } = params;
3812
- const skip = (page - 1) * pageSize;
3813
- const whereConditions = [];
3814
- if (search) {
3815
- whereConditions.push({
3816
- OR: [
3817
- { name: { contains: search, mode: "insensitive" } },
3818
- { email: { contains: search, mode: "insensitive" } }
3819
- ]
3820
- });
3821
- }
3822
- if (status !== void 0 && status !== "") {
3823
- whereConditions.push({ isActive: status === "active" });
3824
- }
3825
- if (params.roleCode) {
3826
- whereConditions.push({
3827
- userRoles: {
3828
- some: {
3829
- role: {
3830
- code: params.roleCode
3831
- }
3832
- }
3833
- }
3834
- });
3835
- }
3836
- const where = whereConditions.length > 0 ? { AND: whereConditions } : {};
3837
- const [users, total] = await Promise.all([
3838
- db.user.findMany({
3839
- where,
3840
- skip,
3841
- take: pageSize,
3842
- orderBy: { createdAt: "desc" },
3843
- select: {
3844
- id: true,
3845
- name: true,
3846
- email: true,
3847
- image: true,
3848
- isActive: true,
3849
- lastLoginAt: true,
3850
- createdAt: true,
3851
- updatedAt: true,
3852
- userType: true,
3853
- // Added userType
3854
- userRoles: {
3855
- select: {
3856
- role: {
3857
- select: {
3858
- code: true,
3859
- name: true
3860
- }
3861
- }
3862
- }
3863
- },
3864
- userBranches: {
3865
- select: {
3866
- branch: {
3867
- select: {
3868
- id: true,
3869
- name: true
3870
- }
3871
- },
3872
- isDefault: true
3873
- }
3874
- },
3875
- // Removed invalid userSuppliers selection
3876
- profiles: {
3877
- select: {
3878
- department: true,
3879
- departmentRef: {
3880
- select: {
3881
- id: true,
3882
- name: true
3883
- }
3884
- },
3885
- jobTitleId: true,
3886
- jobTitleRef: {
3887
- select: {
3888
- id: true,
3889
- name: true
3890
- }
3891
- },
3892
- address: true,
3893
- // Added address
3894
- phone: true,
3895
- // Added phone
3896
- gender: true,
3897
- dateOfBirth: true,
3898
- groupId: true,
3899
- idNumber: true,
3900
- supplierId: true,
3901
- // Select supplierId from profiles
3902
- supplier: {
3903
- // Select supplier details from profiles
3904
- select: {
3905
- name: true
3906
- }
3907
- }
3908
- }
3909
- }
3910
- }
3911
- }),
3912
- db.user.count({ where })
3913
- ]);
3914
- const data = users.map((user) => ({
3915
- id: user.id,
3916
- name: user.name,
3917
- email: user.email,
3918
- image: user.image,
3919
- status: user.isActive ? "active" : "inactive",
3920
- userType: user.userType || "employee",
3921
- supplierId: user.profiles?.supplierId || "",
3922
- supplierName: user.profiles?.supplier?.name || "",
3923
- address: user.profiles?.address || "",
3924
- // Added address
3925
- phone: user.profiles?.phone || "",
3926
- // Added phone
3927
- gender: user.profiles?.gender || "",
3928
- birthday: user.profiles?.dateOfBirth || null,
3929
- groupId: user.profiles?.groupId || "",
3930
- idNumber: user.profiles?.idNumber || "",
3931
- lastLoginAt: user.lastLoginAt,
3932
- createdAt: user.createdAt,
3933
- updatedAt: user.updatedAt,
3934
- departmentId: user.profiles?.departmentRef?.id || null,
3935
- departmentName: user.profiles?.departmentRef?.name || null,
3936
- jobTitleId: user.profiles?.jobTitleRef?.id || null,
3937
- jobTitleName: user.profiles?.jobTitleRef?.name || null,
3938
- roleNames: user.userRoles?.map((ur) => ur.role.name) || [],
3939
- roleCodes: user.userRoles?.map((ur) => ur.role.code) || [],
3940
- branches: user.userBranches?.map((ub) => ({
3941
- id: ub.branch?.id,
3942
- name: ub.branch?.name,
3943
- isDefault: ub.isDefault
3944
- })).filter((b) => b.id) || [],
3945
- branchIds: user.userBranches?.map((ub) => ub.branch?.id).filter(Boolean) || [],
3946
- branchNames: user.userBranches?.map((ub) => ub.branch?.name).filter(Boolean) || []
3947
- }));
3948
- return {
3949
- data,
3950
- total,
3951
- page,
3952
- pageSize
3953
- };
3954
- }
3955
- async function getUsersWithDetails(db, params) {
3956
- const {
3957
- page = 1,
3958
- pageSize = 10,
3959
- search,
3960
- status,
3961
- roleCode,
3962
- departmentId
3963
- } = params;
3964
- const skip = (page - 1) * pageSize;
3965
- const whereConditions = [];
3966
- if (search) {
3967
- whereConditions.push({
3968
- OR: [
3969
- { name: { contains: search, mode: "insensitive" } },
3970
- { email: { contains: search, mode: "insensitive" } }
3971
- ]
3972
- });
3973
- }
3974
- if (status !== void 0 && status !== "") {
3975
- whereConditions.push({ isActive: status === "active" });
3976
- }
3977
- if (roleCode) {
3978
- whereConditions.push({
3979
- userRoles: {
3980
- some: { roleCode }
3981
- }
3982
- });
3983
- }
3984
- if (departmentId) {
3985
- whereConditions.push({
3986
- profiles: {
3987
- is: {
3988
- departmentId
3989
- }
3990
- }
3991
- });
3992
- }
3993
- const where = whereConditions.length > 0 ? { AND: whereConditions } : {};
3994
- const [users, total, activeCount, rolesCount, customers, suppliers] = await Promise.all([
3995
- db.user.findMany({
3996
- where,
3997
- skip,
3998
- take: pageSize,
3999
- orderBy: { createdAt: "desc" },
4000
- select: {
4001
- id: true,
4002
- name: true,
4003
- email: true,
4004
- image: true,
4005
- isActive: true,
4006
- createdAt: true,
4007
- updatedAt: true,
4008
- userRoles: {
4009
- select: {
4010
- role: {
4011
- select: {
4012
- code: true,
4013
- name: true
4014
- }
4015
- }
4016
- }
4017
- },
4018
- userBranches: {
4019
- select: {
4020
- branch: {
4021
- select: {
4022
- id: true,
4023
- name: true
4024
- }
4025
- },
4026
- isDefault: true
4027
- }
4028
- },
4029
- profiles: {
4030
- select: {
4031
- departmentRef: {
4032
- select: {
4033
- id: true,
4034
- name: true,
4035
- code: true
4036
- }
4037
- },
4038
- jobTitleRef: {
4039
- select: {
4040
- id: true,
4041
- name: true,
4042
- code: true,
4043
- level: true
4044
- }
4045
- },
4046
- address: true,
4047
- // Added address
4048
- phone: true,
4049
- // Added phone
4050
- gender: true,
4051
- dateOfBirth: true,
4052
- groupId: true,
4053
- idNumber: true,
4054
- supplierId: true,
4055
- // Added supplierId
4056
- supplier: {
4057
- // Added supplier
4058
- select: {
4059
- name: true
4060
- }
4061
- }
4062
- }
4063
- }
4064
- }
4065
- }),
4066
- db.user.count({ where }),
4067
- db.user.count({ where: { ...where, isActive: true } }),
4068
- db.role.count({ where: { status: "active" } }),
4069
- db.user.count({ where: { userType: "customer" } }).catch(() => 0),
4070
- db.user.count({ where: { userType: "supplier" } }).catch(() => 0)
4071
- ]);
4072
- const totalUsersCount = await db.user.count();
4073
- const totalActiveCount = await db.user.count({ where: { isActive: true } });
4074
- const employees = Math.max(0, totalUsersCount - customers - suppliers);
4075
- const data = users.map((user) => ({
4076
- id: user.id,
4077
- name: user.name,
4078
- email: user.email,
4079
- image: user.image,
4080
- isActive: user.isActive,
4081
- userType: user.userType || "employee",
4082
- // Added userType
4083
- supplierId: user.profiles?.supplierId || "",
4084
- // Added supplierId
4085
- address: user.profiles?.address || "",
4086
- // Added address
4087
- phone: user.profiles?.phone || "",
4088
- // Added phone
4089
- gender: user.profiles?.gender || "",
4090
- birthday: user.profiles?.dateOfBirth || null,
4091
- groupId: user.profiles?.groupId || "",
4092
- idNumber: user.profiles?.idNumber || "",
4093
- createdAt: user.createdAt,
4094
- updatedAt: user.updatedAt,
4095
- roles: user.userRoles.map((ur) => ({
4096
- code: ur.role.code,
4097
- name: ur.role.name
4098
- })),
4099
- branches: user.userBranches?.map((ub) => ({
4100
- id: ub.branch?.id,
4101
- name: ub.branch?.name,
4102
- isDefault: ub.isDefault
4103
- })).filter((b) => b.id) || [],
4104
- branchIds: user.userBranches?.map((ub) => ub.branch?.id).filter(Boolean) || [],
4105
- branchNames: user.userBranches?.map((ub) => ub.branch?.name).filter(Boolean) || [],
4106
- department: user.profiles?.departmentRef || null,
4107
- jobTitle: user.profiles?.jobTitleRef || null
4108
- }));
4109
- return {
4110
- data,
4111
- total,
4112
- page,
4113
- pageSize,
4114
- stats: {
4115
- totalUsers: totalUsersCount,
4116
- activeUsers: totalActiveCount,
4117
- inactiveUsers: totalUsersCount - totalActiveCount,
4118
- totalRoles: rolesCount,
4119
- employees,
4120
- customers,
4121
- suppliers
4122
- }
4123
- };
4124
- }
4125
- async function getActiveRoles(db) {
4126
- const roles = await db.role.findMany({
4127
- where: { status: "active" },
4128
- select: {
4129
- code: true,
4130
- name: true,
4131
- status: true
4132
- },
4133
- orderBy: { name: "asc" }
4134
- });
4135
- return roles;
4136
- }
4137
- async function getActiveDepartments(db) {
4138
- const departments = await db.department.findMany({
4139
- where: { status: "active" },
4140
- select: {
4141
- id: true,
4142
- code: true,
4143
- name: true
4144
- },
4145
- orderBy: { order: "asc" }
4146
- });
4147
- return departments;
4148
- }
4149
- async function getUserStats(db) {
4150
- const [totalUsers, activeUsers, customers, suppliers, totalRoles] = await Promise.all([
4151
- db.user.count(),
4152
- db.user.count({ where: { isActive: true } }),
4153
- db.user.count({ where: { userType: "customer" } }).catch(() => 0),
4154
- db.user.count({ where: { userType: "supplier" } }).catch(() => 0),
4155
- db.role.count({ where: { status: "active" } })
4156
- ]);
4157
- const employees = Math.max(0, totalUsers - customers - suppliers);
4158
- return {
4159
- totalUsers,
4160
- activeUsers,
4161
- inactiveUsers: totalUsers - activeUsers,
4162
- totalRoles,
4163
- employees,
4164
- customers,
4165
- suppliers
4166
- };
4167
- }
4168
- async function getUserProfile(db, userId) {
4169
- const user = await db.user.findUnique({
4170
- where: { id: userId },
4171
- select: {
4172
- id: true,
4173
- name: true,
4174
- email: true,
4175
- image: true,
4176
- isActive: true,
4177
- createdAt: true,
4178
- updatedAt: true,
4179
- userType: true,
4180
- // Added userType
4181
- userRoles: {
4182
- select: {
4183
- role: {
4184
- select: {
4185
- code: true,
4186
- name: true
4187
- }
4188
- }
4189
- }
4190
- },
4191
- // Removed invalid userSuppliers selection
4192
- profiles: {
4193
- select: {
4194
- departmentRef: {
4195
- select: {
4196
- id: true,
4197
- name: true,
4198
- code: true
4199
- }
4200
- },
4201
- jobTitleRef: {
4202
- select: {
4203
- id: true,
4204
- name: true,
4205
- code: true
4206
- }
4207
- },
4208
- address: true,
4209
- // Added address
4210
- phone: true,
4211
- // Added phone
4212
- gender: true,
4213
- dateOfBirth: true,
4214
- groupId: true,
4215
- idNumber: true,
4216
- supplierId: true,
4217
- // Select supplierId from profiles
4218
- supplier: {
4219
- select: {
4220
- name: true
4221
- }
4222
- }
4223
- }
4224
- }
4225
- }
4226
- });
4227
- if (!user) return null;
4228
- const nameParts = (user.name || "").split(" ");
4229
- const lastName = nameParts.pop() || "";
4230
- const firstName = nameParts.join(" ");
4231
- return {
4232
- id: user.id,
4233
- firstName,
4234
- lastName,
4235
- name: user.name || "",
4236
- username: user.email?.split("@")[0] || "",
4237
- email: user.email || "",
4238
- avatar: user.image || "",
4239
- role: user.userRoles?.[0]?.role?.name || "User",
4240
- background: "",
4241
- status: user.isActive ? "active" : "inactive",
4242
- phoneNumber: user.profiles?.phone || "",
4243
- state: "",
4244
- country: "",
4245
- address: user.profiles?.address || "",
4246
- zipCode: "",
4247
- language: "English",
4248
- timeZone: "GMT+07:00",
4249
- currency: "USD",
4250
- organization: "",
4251
- twoFactorAuth: false,
4252
- loginAlerts: false,
4253
- connections: 0,
4254
- followers: 0
4255
- };
4256
- }
4257
-
4258
- export { DangerousZone, DeleteAccountForm, DeleteAccountSchema, MAX_AVATAR_SIZE, ProfileInfo, ProfileInfoForm, ProfileInfoSchema, ProfilePage, fomratedAvatarSize, getActiveDepartments, getActiveRoles, getUserProfile, getUserStats, getUsersData, getUsersWithDetails };
4259
- //# sourceMappingURL=index.mjs.map
4260
- //# sourceMappingURL=index.mjs.map